SubMenu.d.ts
4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import * as React from 'react';
import { CSSMotionProps } from 'rc-motion';
import { SubPopupMenuProps } from './SubPopupMenu';
import { noop } from './util';
import { MiniStore, RenderIconType, LegacyFunctionRef, MenuMode, OpenEventHandler, SelectEventHandler, DestroyEventHandler, MenuHoverEventHandler, MenuClickEventHandler, MenuInfo, BuiltinPlacements, TriggerSubMenuAction, HoverEventHandler } from './interface';
import { MenuItem } from './MenuItem';
export interface SubMenuProps {
parentMenu?: React.ReactElement & {
isRootMenu: boolean;
subMenuInstance: React.ReactInstance;
};
title?: React.ReactNode;
children?: React.ReactNode;
selectedKeys?: string[];
openKeys?: string[];
onClick?: MenuClickEventHandler;
onOpenChange?: OpenEventHandler;
rootPrefixCls?: string;
eventKey?: string;
multiple?: boolean;
active?: boolean;
onItemHover?: HoverEventHandler;
onSelect?: SelectEventHandler;
triggerSubMenuAction?: TriggerSubMenuAction;
onDeselect?: SelectEventHandler;
onDestroy?: DestroyEventHandler;
onMouseEnter?: MenuHoverEventHandler;
onMouseLeave?: MenuHoverEventHandler;
onTitleMouseEnter?: MenuHoverEventHandler;
onTitleMouseLeave?: MenuHoverEventHandler;
onTitleClick?: (info: {
key: React.Key;
domEvent: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>;
}) => void;
popupOffset?: number[];
isOpen?: boolean;
store?: MiniStore;
mode?: MenuMode;
manualRef?: LegacyFunctionRef;
itemIcon?: RenderIconType;
expandIcon?: RenderIconType;
inlineIndent?: number;
level?: number;
subMenuOpenDelay?: number;
subMenuCloseDelay?: number;
forceSubMenuRender?: boolean;
builtinPlacements?: BuiltinPlacements;
disabled?: boolean;
className?: string;
popupClassName?: string;
motion?: CSSMotionProps;
direction?: 'ltr' | 'rtl';
}
interface SubMenuState {
mode: MenuMode;
isOpen: boolean;
}
export declare class SubMenu extends React.Component<SubMenuProps, SubMenuState> {
static defaultProps: {
onMouseEnter: typeof noop;
onMouseLeave: typeof noop;
onTitleMouseEnter: typeof noop;
onTitleMouseLeave: typeof noop;
onTitleClick: typeof noop;
manualRef: typeof noop;
mode: string;
title: string;
};
constructor(props: SubMenuProps);
isRootMenu: boolean;
menuInstance: MenuItem;
subMenuTitle: HTMLElement;
internalMenuId: string;
haveRendered: boolean;
haveOpened: boolean;
updateStateRaf: number;
/**
* Follow timeout should be `number`.
* Current is only convert code into TS,
* we not use `window.setTimeout` instead of `setTimeout`.
*/
minWidthTimeout: any;
mouseenterTimeout: any;
componentDidMount(): void;
componentDidUpdate(): void;
componentWillUnmount(): void;
onDestroy: (key: string) => void;
/**
* note:
* This legacy code that `onKeyDown` is called by parent instead of dom self.
* which need return code to check if this event is handled
*/
onKeyDown: React.KeyboardEventHandler<HTMLElement>;
onOpenChange: OpenEventHandler;
onPopupVisibleChange: (visible: boolean) => void;
onMouseEnter: React.MouseEventHandler<HTMLElement>;
onMouseLeave: React.MouseEventHandler<HTMLElement>;
onTitleMouseEnter: React.MouseEventHandler<HTMLElement>;
onTitleMouseLeave: React.MouseEventHandler<HTMLElement>;
onTitleClick: (e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;
onSubMenuClick: (info: MenuInfo) => void;
onSelect: SelectEventHandler;
onDeselect: SelectEventHandler;
getPrefixCls: () => string;
getActiveClassName: () => string;
getDisabledClassName: () => string;
getSelectedClassName: () => string;
getOpenClassName: () => string;
getVisible: () => boolean;
getMode: () => MenuMode;
saveMenuInstance: (c: MenuItem) => void;
addKeyPath: (info: MenuInfo) => {
keyPath: (string | number)[];
key: string | number;
item: React.ReactInstance;
domEvent: React.MouseEvent<HTMLElement, MouseEvent>;
};
triggerOpenChange: (open: boolean, type?: string) => void;
isChildrenSelected: () => boolean;
isInlineMode: () => boolean;
adjustWidth: () => void;
saveSubMenuTitle: (subMenuTitle: HTMLElement) => void;
getBaseProps: () => SubPopupMenuProps;
getMotion: (mode: MenuMode, visible: boolean) => CSSMotionProps;
renderPopupMenu(className: string, style?: React.CSSProperties): JSX.Element;
renderChildren(): JSX.Element;
render(): JSX.Element;
}
declare const connected: any;
export default connected;