1 |
|
2 |
|
3 | import * as React from 'react';
|
4 | import CommonProps from '../util';
|
5 | import { PopupProps } from '../overlay';
|
6 | import { MenuProps } from '../menu';
|
7 | import { InputProps } from '../input';
|
8 | import { data } from '../checkbox';
|
9 |
|
10 | interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement>, InputProps {
|
11 | defaultValue?: any;
|
12 | onChange?: any;
|
13 | onBlur?: any,
|
14 | onFocus?: any,
|
15 | onKeyDown?: any,
|
16 | }
|
17 |
|
18 | type item = {
|
19 | value?: string | number;
|
20 | label?: React.ReactNode;
|
21 | [propName: string]: any;
|
22 | }
|
23 |
|
24 | export interface AutoCompleteProps extends HTMLAttributesWeak, CommonProps {
|
25 | |
26 |
|
27 |
|
28 | size?: 'small' | 'medium' | 'large';
|
29 |
|
30 | |
31 |
|
32 |
|
33 | value?: string | number;
|
34 |
|
35 | |
36 |
|
37 |
|
38 | defaultValue?: string | number;
|
39 |
|
40 | |
41 |
|
42 |
|
43 | placeholder?: string;
|
44 |
|
45 | |
46 |
|
47 |
|
48 | autoWidth?: boolean;
|
49 |
|
50 | |
51 |
|
52 |
|
53 | label?: React.ReactNode;
|
54 |
|
55 | |
56 |
|
57 |
|
58 | hasClear?: boolean;
|
59 |
|
60 | |
61 |
|
62 |
|
63 | state?: 'error' | 'loading' | 'success' | 'warning';
|
64 |
|
65 | |
66 |
|
67 |
|
68 | readOnly?: boolean;
|
69 |
|
70 | |
71 |
|
72 |
|
73 | disabled?: boolean;
|
74 |
|
75 | |
76 |
|
77 |
|
78 | visible?: boolean;
|
79 |
|
80 | |
81 |
|
82 |
|
83 | defaultVisible?: boolean;
|
84 |
|
85 | |
86 |
|
87 |
|
88 | onVisibleChange?: (visible: boolean, type: string) => void;
|
89 |
|
90 | |
91 |
|
92 |
|
93 | popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement);
|
94 |
|
95 | /**
|
96 | * 弹层的 className
|
97 | */
|
98 | popupClassName?: string;
|
99 |
|
100 | /**
|
101 | * 弹层的内联样式
|
102 | */
|
103 | popupStyle?: React.CSSProperties;
|
104 |
|
105 | /**
|
106 | * 添加到弹层上的属性
|
107 | */
|
108 | popupProps?: PopupProps;
|
109 |
|
110 | /**
|
111 | * 自定义弹层的内容
|
112 | */
|
113 | popupContent?: React.ReactNode;
|
114 |
|
115 | /**
|
116 | * 是否跟随滚动
|
117 | */
|
118 | followTrigger?: boolean;
|
119 |
|
120 | /**
|
121 | * 是否使用本地过滤,在数据源为远程的时候需要关闭此项
|
122 | */
|
123 | filterLocal?: boolean;
|
124 |
|
125 | /**
|
126 | * 本地过滤方法,返回一个 Boolean 值确定是否保留
|
127 | */
|
128 | filter?: (key:string, item: any) => boolean;
|
129 |
|
130 | |
131 |
|
132 |
|
133 | onToggleHighlightItem?: () => void;
|
134 |
|
135 | |
136 |
|
137 |
|
138 | useVirtual?: boolean;
|
139 |
|
140 | |
141 |
|
142 |
|
143 | dataSource?: Array<any>;
|
144 |
|
145 | |
146 |
|
147 |
|
148 | itemRender?: (item: item) => React.ReactNode;
|
149 |
|
150 | |
151 |
|
152 |
|
153 | onChange?: (value: any, actionType: string, item: any) => void;
|
154 |
|
155 | |
156 |
|
157 |
|
158 | fillProps?: string;
|
159 |
|
160 | |
161 |
|
162 |
|
163 | autoHighlightFirstItem?: boolean;
|
164 |
|
165 | |
166 |
|
167 |
|
168 | highlightKey?: string;
|
169 |
|
170 | |
171 |
|
172 |
|
173 | defaultHighlightKey?: string;
|
174 | }
|
175 |
|
176 | export class AutoComplete extends React.Component<AutoCompleteProps, any> {}
|
177 |
|
178 | export interface OptionGroupProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
|
179 | |
180 |
|
181 |
|
182 | label?: React.ReactNode;
|
183 | }
|
184 |
|
185 | export class OptionGroup extends React.Component<OptionGroupProps, any> {}
|
186 |
|
187 | export interface OptionProps extends React.HTMLAttributes<HTMLElement>, CommonProps {
|
188 | |
189 |
|
190 |
|
191 | value: any;
|
192 |
|
193 | |
194 |
|
195 |
|
196 | disabled?: boolean;
|
197 | }
|
198 |
|
199 | export class Option extends React.Component<OptionProps, any> {}
|
200 | interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
|
201 | defaultValue?: any;
|
202 | onChange?: any;
|
203 | }
|
204 |
|
205 | export interface SelectProps extends Omit<HTMLAttributesWeak, 'renderPreview'>, CommonProps {
|
206 | |
207 |
|
208 |
|
209 | size?: 'small' | 'medium' | 'large';
|
210 |
|
211 | |
212 |
|
213 |
|
214 | name?: string;
|
215 |
|
216 | |
217 |
|
218 |
|
219 | value?: any;
|
220 |
|
221 | |
222 |
|
223 |
|
224 | defaultValue?: any;
|
225 |
|
226 | |
227 |
|
228 |
|
229 | placeholder?: string;
|
230 |
|
231 | |
232 |
|
233 |
|
234 | autoWidth?: boolean;
|
235 |
|
236 | |
237 |
|
238 |
|
239 | label?: React.ReactNode;
|
240 |
|
241 | |
242 |
|
243 |
|
244 | hasClear?: boolean;
|
245 |
|
246 | |
247 |
|
248 |
|
249 | state?: 'error' | 'loading' | 'success' | 'warning';
|
250 |
|
251 | |
252 |
|
253 |
|
254 | readOnly?: boolean;
|
255 |
|
256 | |
257 |
|
258 |
|
259 | disabled?: boolean;
|
260 |
|
261 | |
262 |
|
263 |
|
264 | visible?: boolean;
|
265 |
|
266 | |
267 |
|
268 |
|
269 | defaultVisible?: boolean;
|
270 |
|
271 | |
272 |
|
273 |
|
274 | onVisibleChange?: (visible: boolean) => void;
|
275 |
|
276 | |
277 |
|
278 |
|
279 | popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement);
|
280 |
|
281 | /**
|
282 | * 弹层的 className
|
283 | */
|
284 | popupClassName?: string;
|
285 |
|
286 | /**
|
287 | * 弹层的内联样式
|
288 | */
|
289 | popupStyle?: React.CSSProperties;
|
290 |
|
291 | /**
|
292 | * 添加到弹层上的属性
|
293 | */
|
294 | popupProps?: PopupProps;
|
295 |
|
296 | /**
|
297 | * 是否跟随滚动
|
298 | */
|
299 | followTrigger?: boolean;
|
300 |
|
301 | /**
|
302 | * 自定义弹层的内容
|
303 | */
|
304 | popupContent?: React.ReactNode;
|
305 | menuProps?: MenuProps;
|
306 |
|
307 | /**
|
308 | * 是否使用本地过滤,在数据源为远程的时候需要关闭此项
|
309 | */
|
310 | filterLocal?: boolean;
|
311 |
|
312 | /**
|
313 | * 本地过滤方法,返回一个 Boolean 值确定是否保留
|
314 | */
|
315 | filter?: (key:string, item: any) => boolean;
|
316 |
|
317 | |
318 |
|
319 |
|
320 | onToggleHighlightItem?: () => void;
|
321 |
|
322 | |
323 |
|
324 |
|
325 | useVirtual?: boolean;
|
326 |
|
327 | |
328 |
|
329 |
|
330 | dataSource?: Array<any>;
|
331 |
|
332 | |
333 |
|
334 |
|
335 | itemRender?: (item: item, searchValue: string) => React.ReactNode;
|
336 |
|
337 | |
338 |
|
339 |
|
340 | mode?: 'single' | 'multiple' | 'tag';
|
341 |
|
342 | |
343 |
|
344 |
|
345 | notFoundContent?: React.ReactNode;
|
346 |
|
347 | |
348 |
|
349 |
|
350 | onChange?: (value: any, actionType: string, item: any) => void;
|
351 |
|
352 | |
353 |
|
354 |
|
355 | hasBorder?: boolean;
|
356 |
|
357 | |
358 |
|
359 |
|
360 | hasArrow?: boolean;
|
361 |
|
362 | |
363 |
|
364 |
|
365 | showSearch?: boolean;
|
366 |
|
367 | |
368 |
|
369 |
|
370 | onSearch?: (value: string) => void;
|
371 |
|
372 | |
373 |
|
374 |
|
375 | onSearchClear?: (actionType: string) => void;
|
376 |
|
377 | |
378 |
|
379 |
|
380 | hasSelectAll?: boolean | string;
|
381 |
|
382 | |
383 |
|
384 |
|
385 | fillProps?: string;
|
386 |
|
387 | |
388 |
|
389 |
|
390 | useDetailValue?: boolean;
|
391 |
|
392 | |
393 |
|
394 |
|
395 | cacheValue?: boolean;
|
396 |
|
397 | |
398 |
|
399 |
|
400 | valueRender?: (item: any) => React.ReactNode;
|
401 |
|
402 | |
403 |
|
404 |
|
405 | searchValue?: string;
|
406 | |
407 |
|
408 |
|
409 | tagInline?: boolean;
|
410 | |
411 |
|
412 |
|
413 | maxTagCount?: number;
|
414 | |
415 |
|
416 |
|
417 | adjustTagSize?: boolean;
|
418 | |
419 |
|
420 |
|
421 |
|
422 |
|
423 | maxTagPlaceholder?: (selectedValues?: any[], totalValues?: any[]) => React.ReactNode | HTMLElement;
|
424 |
|
425 | |
426 |
|
427 |
|
428 | hiddenSelected?: boolean;
|
429 | |
430 |
|
431 |
|
432 | showDataSourceChildren?: boolean;
|
433 | |
434 |
|
435 |
|
436 | onRemove?: (item: {}) => void;
|
437 |
|
438 | |
439 |
|
440 |
|
441 | onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
442 |
|
443 | |
444 |
|
445 |
|
446 | onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
447 | isPreview?: boolean;
|
448 | renderPreview?: (values: number | string | data | Array<number | string | data>, props: any) => any;
|
449 | |
450 |
|
451 |
|
452 | autoHighlightFirstItem?: boolean;
|
453 |
|
454 | |
455 |
|
456 |
|
457 | highlightKey?: string;
|
458 |
|
459 | |
460 |
|
461 |
|
462 | defaultHighlightKey?: string;
|
463 |
|
464 | |
465 |
|
466 |
|
467 | popupAutoFocus?: boolean;
|
468 | }
|
469 |
|
470 | export default class Select extends React.Component<SelectProps, any> {
|
471 | static AutoComplete: typeof AutoComplete;
|
472 | static OptionGroup: typeof OptionGroup;
|
473 | static Option: typeof Option;
|
474 | }
|