Skip to content

Commit 5cb6207

Browse files
author
刘欢
committed
feat: update MenuItemInfo type and refactor info item handling in nodeUtil
1 parent bb48d9b commit 5cb6207

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/MenuItem.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ const InternalMenuItem = React.forwardRef((props: MenuItemProps, ref: React.Ref<
141141
const infoItem: MenuItemInfo = propsInfo?.item || {
142142
key: eventKey || '',
143143
label: children,
144-
disabled,
145144
itemIcon,
146145
extra: props.extra,
147146
};

src/interface.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,12 @@ export interface MenuItemType extends ItemSharedProps {
6464
}
6565

6666
/** Info item type passed to onSelect/onClick callbacks, excluding event handlers */
67-
export type MenuItemInfo = Omit<
68-
MenuItemType,
69-
'onMouseEnter' | 'onMouseLeave' | 'onClick' | 'className' | 'style' | 'ref'
70-
>;
67+
export type MenuItemInfo = {
68+
label?: React.ReactNode;
69+
itemIcon?: RenderIconType;
70+
extra?: React.ReactNode;
71+
key: React.Key;
72+
};
7173

7274
export interface MenuItemGroupType extends ItemSharedProps {
7375
type: 'group';

src/utils/nodeUtil.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import MenuItem from '../MenuItem';
55
import MenuItemGroup from '../MenuItemGroup';
66
import SubMenu from '../SubMenu';
77
import { parseChildren } from './commonUtil';
8-
import omit from '@rc-component/util/lib/omit';
98

109
function convertItemsToNodes(
1110
list: ItemType[],
@@ -56,7 +55,7 @@ function convertItemsToNodes(
5655
key={mergedKey}
5756
{...restProps}
5857
extra={extra}
59-
info={{ item: omit(opt, ['className', 'style']) }}
58+
info={{ item: { label, key, itemIcon: restProps?.itemIcon, extra } }}
6059
>
6160
{hasExtra ? (
6261
<>

0 commit comments

Comments
 (0)