UNPKG

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