UNPKG

1.4 kBTypeScriptView Raw
1/// <reference types="react" />
2
3import * as React from 'react';
4import CommonProps from '../util';
5
6interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
7 defaultValue?: any;
8 onSelect?: any;
9}
10
11export interface CalendarProps extends HTMLAttributesWeak, CommonProps {
12 /**
13 * 默认选中的日期(moment 对象)
14 */
15 defaultValue?: any;
16
17 /**
18 * 选中的日期值 (moment 对象)
19 */
20 value?: any;
21
22 /**
23 * 是否展示非本月的日期
24 */
25 showOtherMonth?: boolean;
26
27 /**
28 * 默认展示的月份
29 */
30 defaultVisibleMonth?: () => void;
31
32 /**
33 * 展现形态
34 */
35 shape?: 'card' | 'fullscreen' | 'panel';
36
37 /**
38 * 选择日期单元格时的回调
39 */
40 onSelect?: (value: {}) => void;
41
42 /**
43 * 展现的月份变化时的回调
44 */
45 onVisibleMonthChange?: (value: {}, reason: string) => void;
46
47 /**
48 * 自定义样式类
49 */
50 className?: string;
51
52 /**
53 * 自定义日期渲染函数
54 */
55 dateCellRender?: (value: {}) => React.ReactNode;
56
57 /**
58 * 自定义月份渲染函数
59 */
60 monthCellRender?: (calendarDate: {}) => React.ReactNode;
61
62 /**
63 * 不可选择的日期
64 */
65 disabledDate?: (calendarDate: {}, view: string) => boolean;
66}
67
68export default class Calendar extends React.Component<CalendarProps, any> {}