1 |
|
2 | import { Moment } from 'moment';
|
3 | import * as React from 'react';
|
4 | import CommonProps from '../util';
|
5 | import { PopupProps } from '../overlay';
|
6 | import { InputProps } from '../input';
|
7 |
|
8 | interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
|
9 | defaultValue?: any;
|
10 | onChange?: any;
|
11 | }
|
12 |
|
13 | export interface MonthPickerProps extends HTMLAttributesWeak, CommonProps {
|
14 | name?: string;
|
15 | |
16 |
|
17 |
|
18 | label?: React.ReactNode;
|
19 |
|
20 | |
21 |
|
22 |
|
23 | state?: 'success' | 'loading' | 'error';
|
24 |
|
25 | |
26 |
|
27 |
|
28 | placeholder?: string;
|
29 |
|
30 | |
31 |
|
32 |
|
33 | defaultVisibleYear?: () => void;
|
34 |
|
35 | |
36 |
|
37 |
|
38 | value?: any;
|
39 |
|
40 | |
41 |
|
42 |
|
43 | defaultValue?: any;
|
44 |
|
45 | |
46 |
|
47 |
|
48 | format?: string;
|
49 |
|
50 | |
51 |
|
52 |
|
53 | disabledDate?: (date: Moment, view: string) => boolean;
|
54 |
|
55 | |
56 |
|
57 |
|
58 | footerRender?: () => React.ReactNode;
|
59 |
|
60 | |
61 |
|
62 |
|
63 | onChange?: (value: any | string) => void;
|
64 |
|
65 | |
66 |
|
67 |
|
68 | size?: 'small' | 'medium' | 'large';
|
69 |
|
70 | |
71 |
|
72 |
|
73 | disabled?: boolean;
|
74 |
|
75 | |
76 |
|
77 |
|
78 | hasClear?: boolean;
|
79 |
|
80 | |
81 |
|
82 |
|
83 | visible?: boolean;
|
84 |
|
85 | |
86 |
|
87 |
|
88 | defaultVisible?: boolean;
|
89 |
|
90 | |
91 |
|
92 |
|
93 | onVisibleChange?: (visible: boolean, reason: string) => void;
|
94 |
|
95 | |
96 |
|
97 |
|
98 | popupTriggerType?: 'click' | 'hover';
|
99 |
|
100 | |
101 |
|
102 |
|
103 | popupAlign?: string;
|
104 |
|
105 | |
106 |
|
107 |
|
108 | popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement);
|
109 |
|
110 | /**
|
111 | * 弹层自定义样式
|
112 | */
|
113 | popupStyle?: React.CSSProperties;
|
114 |
|
115 | /**
|
116 | * 弹层自定义样式类
|
117 | */
|
118 | popupClassName?: string;
|
119 |
|
120 | /**
|
121 | * 弹层其他属性
|
122 | */
|
123 | popupProps?: PopupProps;
|
124 |
|
125 | /**
|
126 | * 输入框其他属性
|
127 | */
|
128 | inputProps?: InputProps;
|
129 |
|
130 | /**
|
131 | * 自定义月份渲染函数
|
132 | */
|
133 | monthCellRender?: (calendarDate: any) => React.ReactNode;
|
134 |
|
135 | |
136 |
|
137 |
|
138 | dateInputAriaLabel?: string;
|
139 | }
|
140 |
|
141 |
|
142 | export class MonthPicker extends React.Component<MonthPickerProps, any> {}
|
143 |
|
144 | interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
|
145 | defaultValue?: any;
|
146 | onChange?: any;
|
147 | placeholder?: any;
|
148 | }
|
149 |
|
150 | export interface RangePickerProps extends HTMLAttributesWeak, CommonProps {
|
151 | name?: string;
|
152 | type?: 'date' | 'month' | 'year',
|
153 |
|
154 | |
155 |
|
156 |
|
157 | defaultVisibleMonth?: () => void;
|
158 |
|
159 | |
160 |
|
161 |
|
162 | placeholder?: Array<string> | string;
|
163 |
|
164 | |
165 |
|
166 |
|
167 | value?: Array<any>;
|
168 |
|
169 | |
170 |
|
171 |
|
172 | defaultValue?: Array<any>;
|
173 |
|
174 | |
175 |
|
176 |
|
177 | format?: string;
|
178 |
|
179 | |
180 |
|
181 |
|
182 | showTime?: any | boolean;
|
183 |
|
184 | |
185 |
|
186 |
|
187 | resetTime?: boolean;
|
188 |
|
189 | |
190 |
|
191 |
|
192 | disabledDate?: (date: Moment, view: string) => boolean;
|
193 |
|
194 | |
195 |
|
196 |
|
197 | footerRender?: () => React.ReactNode;
|
198 |
|
199 | |
200 |
|
201 |
|
202 | onChange?: (value: Array<any>) => void;
|
203 |
|
204 | |
205 |
|
206 |
|
207 | onOk?: (value: Array<any>) => void;
|
208 |
|
209 | |
210 |
|
211 |
|
212 | label?: React.ReactNode;
|
213 |
|
214 | |
215 |
|
216 |
|
217 | state?: 'error' | 'loading' | 'success';
|
218 |
|
219 | |
220 |
|
221 |
|
222 | size?: 'small' | 'medium' | 'large';
|
223 |
|
224 | |
225 |
|
226 |
|
227 | disabled?: boolean;
|
228 |
|
229 | |
230 |
|
231 |
|
232 | hasClear?: boolean;
|
233 |
|
234 | |
235 |
|
236 |
|
237 | visible?: boolean;
|
238 |
|
239 | |
240 |
|
241 |
|
242 | defaultVisible?: boolean;
|
243 |
|
244 | |
245 |
|
246 |
|
247 | onVisibleChange?: (visible: boolean, reason: string) => void;
|
248 |
|
249 | |
250 |
|
251 |
|
252 | popupTriggerType?: 'click' | 'hover';
|
253 |
|
254 | |
255 |
|
256 |
|
257 | popupAlign?: string;
|
258 |
|
259 | |
260 |
|
261 |
|
262 | popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement);
|
263 |
|
264 | /**
|
265 | * 弹层自定义样式
|
266 | */
|
267 | popupStyle?: React.CSSProperties;
|
268 |
|
269 | /**
|
270 | * 弹层自定义样式类
|
271 | */
|
272 | popupClassName?: string;
|
273 |
|
274 | /**
|
275 | * 弹层其他属性
|
276 | */
|
277 | popupProps?: PopupProps;
|
278 |
|
279 | /**
|
280 | * 输入框其他属性
|
281 | */
|
282 | inputProps?: InputProps;
|
283 |
|
284 | /**
|
285 | * 自定义日期单元格渲染
|
286 | */
|
287 | dateCellRender?: () => void;
|
288 |
|
289 | |
290 |
|
291 |
|
292 | startDateInputAriaLabel?: string;
|
293 |
|
294 | |
295 |
|
296 |
|
297 | startTimeInputAriaLabel?: string;
|
298 |
|
299 | |
300 |
|
301 |
|
302 | endDateInputAriaLabel?: string;
|
303 |
|
304 | |
305 |
|
306 |
|
307 | endTimeInputAriaLabel?: string;
|
308 | }
|
309 |
|
310 | export class RangePicker extends React.Component<RangePickerProps, any> {}
|
311 |
|
312 | interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
|
313 | defaultValue?: any;
|
314 | onChange?: any;
|
315 | }
|
316 |
|
317 | export interface YearPickerProps extends HTMLAttributesWeak, CommonProps {
|
318 | name?: string;
|
319 | |
320 |
|
321 |
|
322 | label?: React.ReactNode;
|
323 |
|
324 | |
325 |
|
326 |
|
327 | state?: 'success' | 'loading' | 'error';
|
328 |
|
329 | |
330 |
|
331 |
|
332 | placeholder?: string;
|
333 |
|
334 | |
335 |
|
336 |
|
337 | value?: any;
|
338 |
|
339 | |
340 |
|
341 |
|
342 | defaultValue?: any;
|
343 |
|
344 | |
345 |
|
346 |
|
347 | format?: string;
|
348 |
|
349 | |
350 |
|
351 |
|
352 | disabledDate?: (date: Moment, view: string) => boolean;
|
353 |
|
354 | |
355 |
|
356 |
|
357 | footerRender?: () => React.ReactNode;
|
358 |
|
359 | |
360 |
|
361 |
|
362 | onChange?: (value: {} | string) => void;
|
363 |
|
364 | |
365 |
|
366 |
|
367 | size?: 'small' | 'medium' | 'large';
|
368 |
|
369 | |
370 |
|
371 |
|
372 | disabled?: boolean;
|
373 |
|
374 | |
375 |
|
376 |
|
377 | hasClear?: boolean;
|
378 |
|
379 | |
380 |
|
381 |
|
382 | visible?: boolean;
|
383 |
|
384 | |
385 |
|
386 |
|
387 | defaultVisible?: boolean;
|
388 |
|
389 | |
390 |
|
391 |
|
392 | onVisibleChange?: (visible: boolean, reason: string) => void;
|
393 |
|
394 | |
395 |
|
396 |
|
397 | popupTriggerType?: 'click' | 'hover';
|
398 |
|
399 | |
400 |
|
401 |
|
402 | popupAlign?: string;
|
403 |
|
404 | |
405 |
|
406 |
|
407 | popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement);
|
408 |
|
409 | /**
|
410 | * 弹层自定义样式
|
411 | */
|
412 | popupStyle?: React.CSSProperties;
|
413 |
|
414 | /**
|
415 | * 弹层自定义样式类
|
416 | */
|
417 | popupClassName?: string;
|
418 |
|
419 | /**
|
420 | * 弹层其他属性
|
421 | */
|
422 | popupProps?: PopupProps;
|
423 |
|
424 | /**
|
425 | * 输入框其他属性
|
426 | */
|
427 | inputProps?: InputProps;
|
428 |
|
429 | /**
|
430 | * 日期输入框的 aria-label 属性
|
431 | */
|
432 | dateInputAriaLabel?: string;
|
433 | }
|
434 |
|
435 | export class YearPicker extends React.Component<YearPickerProps, any> {}
|
436 | interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
|
437 | defaultValue?: any;
|
438 | onChange?: any;
|
439 | }
|
440 |
|
441 | export interface DatePickerProps extends HTMLAttributesWeak, CommonProps {
|
442 | name?: string;
|
443 | /**
|
444 | * 输入框内置标签
|
445 | */
|
446 | label?: React.ReactNode;
|
447 |
|
448 | /**
|
449 | * 输入框状态
|
450 | */
|
451 | state?: 'success' | 'loading' | 'error';
|
452 |
|
453 | /**
|
454 | * 输入提示
|
455 | */
|
456 | placeholder?: string;
|
457 |
|
458 | /**
|
459 | * 默认展现的月
|
460 | */
|
461 | defaultVisibleMonth?: () => void;
|
462 |
|
463 | |
464 |
|
465 |
|
466 | value?: any;
|
467 |
|
468 | |
469 |
|
470 |
|
471 | defaultValue?: any;
|
472 |
|
473 | |
474 |
|
475 |
|
476 | format?: string;
|
477 |
|
478 | |
479 |
|
480 |
|
481 | showTime?: any | boolean;
|
482 |
|
483 | |
484 |
|
485 |
|
486 | resetTime?: boolean;
|
487 |
|
488 | |
489 |
|
490 |
|
491 | disabledDate?: (date: Moment, view: string) => boolean;
|
492 |
|
493 | |
494 |
|
495 |
|
496 | footerRender?: () => React.ReactNode;
|
497 |
|
498 | |
499 |
|
500 |
|
501 | onChange?: (value: {} | string) => void;
|
502 |
|
503 | |
504 |
|
505 |
|
506 | onOk?: (value: {} | string) => void;
|
507 |
|
508 | |
509 |
|
510 |
|
511 | size?: 'small' | 'medium' | 'large';
|
512 |
|
513 | |
514 |
|
515 |
|
516 | disabled?: boolean;
|
517 |
|
518 | |
519 |
|
520 |
|
521 | hasClear?: boolean;
|
522 |
|
523 | |
524 |
|
525 |
|
526 | visible?: boolean;
|
527 |
|
528 | |
529 |
|
530 |
|
531 | defaultVisible?: boolean;
|
532 |
|
533 | |
534 |
|
535 |
|
536 | onVisibleChange?: (visible: boolean, reason: string) => void;
|
537 |
|
538 | |
539 |
|
540 |
|
541 | popupTriggerType?: 'click' | 'hover';
|
542 |
|
543 | |
544 |
|
545 |
|
546 | popupAlign?: string;
|
547 |
|
548 | |
549 |
|
550 |
|
551 | popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement);
|
552 |
|
553 | /**
|
554 | * 弹层自定义样式
|
555 | */
|
556 | popupStyle?: React.CSSProperties;
|
557 |
|
558 | /**
|
559 | * 弹层自定义样式类
|
560 | */
|
561 | popupClassName?: string;
|
562 |
|
563 | /**
|
564 | * 弹层其他属性
|
565 | */
|
566 | popupProps?: PopupProps;
|
567 |
|
568 | /**
|
569 | * 输入框其他属性
|
570 | */
|
571 | inputProps?: InputProps;
|
572 |
|
573 | /**
|
574 | * 自定义日期渲染函数
|
575 | */
|
576 | dateCellRender?: (value: {}) => React.ReactNode;
|
577 |
|
578 | |
579 |
|
580 |
|
581 | monthCellRender?: (calendarDate: {}) => React.ReactNode;
|
582 |
|
583 | |
584 |
|
585 |
|
586 | dateInputAriaLabel?: string;
|
587 |
|
588 | |
589 |
|
590 |
|
591 | timeInputAriaLabel?: string;
|
592 |
|
593 | |
594 |
|
595 |
|
596 | isPreview?: boolean;
|
597 |
|
598 | renderPreview?: (value: any) => React.ReactNode;
|
599 | }
|
600 |
|
601 | export default class DatePicker extends React.Component<DatePickerProps, any> {
|
602 | static MonthPicker: typeof MonthPicker;
|
603 | static RangePicker: typeof RangePicker;
|
604 | static YearPicker: typeof YearPicker;
|
605 | static WeekPicker: React.ComponentType<DatePickerProps>;
|
606 | }
|