Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: add export of MenuItemProps and SubMenuProps and optmize props of MenuItem #329

Merged
merged 1 commit into from
Jul 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/MenuItem.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import KeyCode from 'rc-util/lib/KeyCode';
import classNames from 'classnames';
import omit from 'omit.js';
import { connect } from 'mini-store';
import { noop, menuAllProps } from './util';
import {
Expand All @@ -16,7 +17,11 @@ import {

/* eslint react/no-is-mounted:0 */

export interface MenuItemProps {
export interface MenuItemProps
extends Omit<
React.HTMLAttributes<HTMLLIElement>,
'onClick' | 'onMouseEnter' | 'onMouseLeave' | 'onSelect'
> {
/** @deprecated No place to use this. Should remove */
attribute?: Record<string, string>;
rootPrefixCls?: string;
Expand Down Expand Up @@ -225,7 +230,12 @@ export class MenuItem extends React.Component<MenuItemProps> {
}
return (
<li
{...(props as any)}
{...omit(props, [
'onClick',
'onMouseEnter',
'onMouseLeave',
'onSelect',
])}
{...attrs}
{...mouseEvent}
style={style}
Expand Down
6 changes: 4 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Menu, { MenuProps } from './Menu';
import SubMenu from './SubMenu';
import MenuItem from './MenuItem';
import SubMenu, { SubMenuProps } from './SubMenu';
import MenuItem, { MenuItemProps } from './MenuItem';
import MenuItemGroup, { MenuItemGroupProps } from './MenuItemGroup';
import Divider from './Divider';

Expand All @@ -12,6 +12,8 @@ export {
MenuItemGroup as ItemGroup,
Divider,
MenuProps,
SubMenuProps,
MenuItemProps,
MenuItemGroupProps,
};

Expand Down