UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

85 lines (84 loc) 3.04 kB
import { CSSProperties, PureComponent, FocusEventHandler, ReactNode } from 'react'; import SubMenu from './SubMenu'; import Item from './MenuItem'; import { SiderContext } from '../layout/Sider'; import LayoutSiderContext, { LayoutSiderContextValue } from '../layout/LayoutSiderContext'; export interface SelectParam { key: string; keyPath: Array<string>; item: any; domEvent: any; selectedKeys: Array<string>; } export interface ClickParam { key: string; keyPath: Array<string>; item: any; domEvent: any; } export declare type MenuMode = 'vertical' | 'vertical-left' | 'vertical-right' | 'horizontal' | 'inline'; export declare type MenuTheme = 'light' | 'dark'; export interface MenuProps { id?: string; theme?: MenuTheme; mode?: MenuMode; selectable?: boolean; selectedKeys?: Array<string>; defaultSelectedKeys?: Array<string>; openKeys?: Array<string>; defaultOpenKeys?: Array<string>; onOpenChange?: (openKeys: string[]) => void; onSelect?: (param: SelectParam) => void; onDeselect?: (param: SelectParam) => void; onClick?: (param: ClickParam) => void; style?: CSSProperties; openAnimation?: string | Record<string, any>; openTransitionName?: string | Record<string, any>; className?: string; prefixCls?: string; multiple?: boolean; inlineIndent?: number; inlineCollapsed?: boolean; subMenuCloseDelay?: number; subMenuOpenDelay?: number; onFocus?: FocusEventHandler<HTMLElement>; onBlur?: FocusEventHandler<HTMLElement>; getPopupContainer?: (triggerNode: Element) => HTMLElement; focusable?: boolean; rippleDisabled?: boolean; children?: ReactNode; } export interface MenuState { openKeys: string[]; } export default class Menu extends PureComponent<MenuProps, MenuState> { static displayName: string; static get contextType(): typeof LayoutSiderContext; static Divider: any; static Item: typeof Item; static SubMenu: typeof SubMenu; static ItemGroup: any; static defaultProps: { className: string; theme: string; focusable: boolean; }; context: LayoutSiderContextValue; switchModeFromInline: boolean; leaveAnimationExecutedWhenInlineCollapsed: boolean; inlineOpenKeys: string[]; constructor(props: MenuProps, context: LayoutSiderContextValue); getContextValue(): { inlineCollapsed: boolean | undefined; menuTheme: "dark" | "light" | undefined; }; getPrefixCls(): string; componentWillReceiveProps(nextProps: MenuProps, nextContext: SiderContext): void; handleClick: (e: ClickParam) => void; handleOpenChange: (openKeys: string[]) => void; setOpenKeys(openKeys: string[]): void; getRealMenuMode(): "inline" | "horizontal" | "vertical" | "vertical-left" | "vertical-right" | undefined; getInlineCollapsed(): boolean | undefined; getMenuOpenAnimation(menuMode: MenuMode): string | Record<string, any> | undefined; render(): JSX.Element | null; }