Skip to content

Commit 681f833

Browse files
刘欢claude
andcommitted
refactor: rename popupRender tabs param to restTabs
Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0a3ac32 commit 681f833

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Then open `http://localhost:8000`.
107107
| Name | Type | Default | Description |
108108
| --- | --- | --- | --- |
109109
| `icon` | ReactNode | - | The icon shown in the more trigger. |
110-
| `popupRender` | `(menu: ReactElement, info: { tabs: Tab[], onClose: () => void }) => ReactElement` | - | Customize the dropdown popup content. The `info` object provides `tabs` (all overflowed tabs) and `onClose` (function to close the dropdown). |
110+
| `popupRender` | `(menu: ReactElement, info: { restTabs: Tab[], onClose: () => void }) => ReactElement` | - | Customize the dropdown popup content. The `info` object provides `restTabs` (all overflowed tabs) and `onClose` (function to close the dropdown). |
111111
| Other dropdown props | from DropdownProps | - | All other [rc-dropdown](https://github.com/react-component/dropdown) props such as `trigger`, `overlayClassName`, `visible`, etc. are also supported. |
112112

113113
## Development

README.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ npm start
107107
| 名称 | 类型 | 默认值 | 说明 |
108108
| --- | --- | --- | --- |
109109
| `icon` | ReactNode | - | 更多按钮的图标。 |
110-
| `popupRender` | `(menu: ReactElement, info: { tabs: Tab[], onClose: () => void }) => ReactElement` | - | 自定义下拉弹层内容。`info` 对象提供 `tabs`(所有溢出标签)和 `onClose`(关闭下拉菜单的函数)。 |
110+
| `popupRender` | `(menu: ReactElement, info: { restTabs: Tab[], onClose: () => void }) => ReactElement` | - | 自定义下拉弹层内容。`info` 对象提供 `restTabs`(所有溢出标签)和 `onClose`(关闭下拉菜单的函数)。 |
111111
| 其他下拉属性 | 来自 DropdownProps | - | 其他 [rc-dropdown](https://github.com/react-component/dropdown) 属性如 `trigger``overlayClassName``visible` 等也都支持。 |
112112

113113
## 本地开发

src/TabNavList/OperationNode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const OperationNode = React.forwardRef<HTMLDivElement, OperationNodeProps>((prop
121121

122122
const overlay = popupRender
123123
? popupRender(menu, {
124-
tabs,
124+
restTabs: tabs,
125125
onClose: () => setOpen(false),
126126
})
127127
: menu;

src/interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export type Tab = Omit<TabPaneProps, 'tab'> & {
1717
export type PopupRender = (
1818
menu: React.ReactElement,
1919
info: {
20-
tabs: Tab[];
20+
restTabs: Tab[];
2121
onClose: () => void;
2222
},
2323
) => React.ReactElement;

tests/overflow.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,9 +674,9 @@ describe('Tabs.Overflow', () => {
674674

675675
it('should pass correct params and support custom popup content', () => {
676676
jest.useFakeTimers();
677-
const popupRender = jest.fn((menu, { tabs }) => (
677+
const popupRender = jest.fn((menu, { restTabs }) => (
678678
<div data-testid="custom-popup">
679-
<div data-testid="tab-count">{tabs.length}</div>
679+
<div data-testid="tab-count">{restTabs.length}</div>
680680
{menu}
681681
</div>
682682
));
@@ -693,7 +693,7 @@ describe('Tabs.Overflow', () => {
693693

694694
expect(popupRender).toHaveBeenCalled();
695695
const callArgs = popupRender.mock.calls[0];
696-
expect(callArgs[1]).toHaveProperty('tabs');
696+
expect(callArgs[1]).toHaveProperty('restTabs');
697697
expect(callArgs[1]).toHaveProperty('onClose');
698698
expect(document.querySelector('[data-testid="custom-popup"]')).toBeTruthy();
699699

0 commit comments

Comments
 (0)