1 |
|
2 |
|
3 | import * as React from 'react';
|
4 | import CommonProps from '../util';
|
5 | import { PopupProps } from '../overlay';
|
6 |
|
7 | export interface ItemProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
|
8 | |
9 |
|
10 |
|
11 | disabled?: boolean;
|
12 |
|
13 | |
14 |
|
15 |
|
16 | helper?: React.ReactNode;
|
17 |
|
18 | |
19 |
|
20 |
|
21 | children?: React.ReactNode;
|
22 | }
|
23 |
|
24 | export class Item extends React.Component<ItemProps, any> {}
|
25 |
|
26 | export interface SubMenuProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
|
27 | |
28 |
|
29 |
|
30 | label?: React.ReactNode;
|
31 |
|
32 | |
33 |
|
34 |
|
35 | selectable?: boolean;
|
36 |
|
37 | |
38 |
|
39 |
|
40 | mode?: 'inline' | 'popup';
|
41 |
|
42 | |
43 |
|
44 |
|
45 | children?: React.ReactNode;
|
46 | }
|
47 |
|
48 | export class SubMenu extends React.Component<SubMenuProps, any> {}
|
49 |
|
50 | export interface PopupItemProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
|
51 | |
52 |
|
53 |
|
54 | label?: React.ReactNode;
|
55 |
|
56 | |
57 |
|
58 |
|
59 | children?: React.ReactNode;
|
60 |
|
61 | |
62 |
|
63 |
|
64 | triggerType?: 'click' | 'hover';
|
65 | }
|
66 |
|
67 | export class PopupItem extends React.Component<PopupItemProps, any> {}
|
68 |
|
69 | interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
|
70 | onChange?: any;
|
71 | }
|
72 |
|
73 | export interface CheckboxItemProps extends HTMLAttributesWeak, CommonProps {
|
74 | |
75 |
|
76 |
|
77 | checked?: boolean;
|
78 |
|
79 | |
80 |
|
81 |
|
82 | indeterminate?: boolean;
|
83 |
|
84 | |
85 |
|
86 |
|
87 | disabled?: boolean;
|
88 |
|
89 | |
90 |
|
91 |
|
92 | onChange?: (checked: boolean, event: React.MouseEvent<HTMLElement>) => void;
|
93 |
|
94 | |
95 |
|
96 |
|
97 | helper?: React.ReactNode;
|
98 |
|
99 | |
100 |
|
101 |
|
102 | children?: React.ReactNode;
|
103 | }
|
104 |
|
105 | export class CheckboxItem extends React.Component<CheckboxItemProps, any> {}
|
106 |
|
107 | interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
|
108 | onChange?: any;
|
109 | }
|
110 |
|
111 | export interface RadioItemProps extends HTMLAttributesWeak, CommonProps {
|
112 | |
113 |
|
114 |
|
115 | checked?: boolean;
|
116 |
|
117 | |
118 |
|
119 |
|
120 | disabled?: boolean;
|
121 |
|
122 | |
123 |
|
124 |
|
125 | onChange?: (checked: boolean, event: {}) => void;
|
126 |
|
127 | |
128 |
|
129 |
|
130 | helper?: React.ReactNode;
|
131 |
|
132 | |
133 |
|
134 |
|
135 | children?: React.ReactNode;
|
136 | }
|
137 |
|
138 | export class RadioItem extends React.Component<RadioItemProps, any> {}
|
139 |
|
140 | export interface GroupProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
|
141 | |
142 |
|
143 |
|
144 | label?: React.ReactNode;
|
145 |
|
146 | |
147 |
|
148 |
|
149 | children?: React.ReactNode;
|
150 | }
|
151 |
|
152 | export class Group extends React.Component<GroupProps, any> {}
|
153 |
|
154 | export interface DividerProps extends React.HTMLAttributes<HTMLElement>, CommonProps {}
|
155 |
|
156 | export class Divider extends React.Component<DividerProps, any> {}
|
157 | interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
|
158 | onSelect?: any;
|
159 | }
|
160 |
|
161 | export interface MenuProps extends HTMLAttributesWeak, CommonProps {
|
162 | |
163 |
|
164 |
|
165 | children?: React.ReactNode;
|
166 |
|
167 | |
168 |
|
169 |
|
170 | onItemClick?: (key: string, item: any, event: React.MouseEvent) => void;
|
171 |
|
172 | |
173 |
|
174 |
|
175 | openKeys?: string | Array<any>;
|
176 |
|
177 | |
178 |
|
179 |
|
180 | defaultOpenKeys?: string | Array<any>;
|
181 |
|
182 | |
183 |
|
184 |
|
185 | defaultOpenAll?: boolean;
|
186 |
|
187 | |
188 |
|
189 |
|
190 | onOpen?: (key: string[], extra: { key: string; open: boolean }) => void;
|
191 |
|
192 | |
193 |
|
194 |
|
195 | mode?: 'inline' | 'popup';
|
196 |
|
197 | |
198 |
|
199 |
|
200 | triggerType?: 'click' | 'hover';
|
201 |
|
202 | |
203 |
|
204 |
|
205 | openMode?: 'single' | 'multiple';
|
206 |
|
207 | |
208 |
|
209 |
|
210 | inlineIndent?: number;
|
211 |
|
212 | |
213 |
|
214 |
|
215 | popupAutoWidth?: boolean;
|
216 |
|
217 | |
218 |
|
219 |
|
220 | popupAlign?: 'follow' | 'outside';
|
221 |
|
222 | |
223 |
|
224 |
|
225 | popupProps?: PopupProps | (() => void);
|
226 |
|
227 | /**
|
228 | * 弹出子菜单自定义 className
|
229 | */
|
230 | popupClassName?: string;
|
231 |
|
232 | /**
|
233 | * 弹出子菜单自定义 style
|
234 | */
|
235 | popupStyle?: React.CSSProperties;
|
236 |
|
237 | /**
|
238 | * 当前选中菜单项的 key 值
|
239 | */
|
240 | selectedKeys?: string | Array<any>;
|
241 |
|
242 | /**
|
243 | * 初始选中菜单项的 key 值
|
244 | */
|
245 | defaultSelectedKeys?: string | Array<any>;
|
246 |
|
247 | /**
|
248 | * 选中或取消选中菜单项触发的回调函数
|
249 | */
|
250 | onSelect?: (selectedKeys: Array<any>, item: any, extra: { select: boolean; lable: any; keyPath: any[]; key: string[] }) => void;
|
251 |
|
252 | |
253 |
|
254 |
|
255 | selectMode?: 'single' | 'multiple';
|
256 |
|
257 | |
258 |
|
259 |
|
260 | shallowSelect?: boolean;
|
261 |
|
262 | |
263 |
|
264 |
|
265 | hasSelectedIcon?: boolean;
|
266 |
|
267 | |
268 |
|
269 |
|
270 |
|
271 | isSelectIconRight?: boolean;
|
272 |
|
273 | |
274 |
|
275 |
|
276 | direction?: 'ver' | 'hoz';
|
277 |
|
278 | |
279 |
|
280 |
|
281 | hozAlign?: 'left' | 'right';
|
282 |
|
283 | |
284 |
|
285 |
|
286 | header?: React.ReactNode;
|
287 |
|
288 | |
289 |
|
290 |
|
291 | footer?: React.ReactNode;
|
292 |
|
293 | |
294 |
|
295 |
|
296 | autoFocus?: boolean;
|
297 |
|
298 | |
299 |
|
300 |
|
301 | focusedKey?: string;
|
302 | renderMore?: (items?: Array<any>) => React.ReactElement;
|
303 |
|
304 | |
305 |
|
306 |
|
307 | embeddable?: boolean;
|
308 | icons?: {
|
309 | select?: React.ReactNode;
|
310 | };
|
311 |
|
312 | |
313 |
|
314 |
|
315 | hozInLine?: boolean;
|
316 | }
|
317 |
|
318 | export default class Menu extends React.Component<MenuProps, any> {
|
319 | static Item: typeof Item;
|
320 | static SubMenu: typeof SubMenu;
|
321 | static PopupItem: typeof PopupItem;
|
322 | static CheckboxItem: typeof CheckboxItem;
|
323 | static RadioItem: typeof RadioItem;
|
324 | static Group: typeof Group;
|
325 | static Divider: typeof Divider;
|
326 | static create(props: any): void;
|
327 | }
|