Skip to content

Commit 90de3f3

Browse files
authored
chore: update Calendar type (#2731)
1 parent 03a42a5 commit 90de3f3

File tree

1 file changed

+110
-76
lines changed

1 file changed

+110
-76
lines changed

types/calendar.d.ts

Lines changed: 110 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -4,86 +4,120 @@
44

55
import { AntdComponent } from './component';
66
import { Moment } from 'moment';
7+
import { VNodeChild } from 'vue';
8+
79
export interface RenderHeader {
810
value: Moment;
911
onChange?: (value: Moment) => void;
1012
type: string;
11-
onTypeChange: (type: string) => void;
13+
onTypeChange?: (type: string) => void;
1214
}
15+
1316
export declare class Calendar extends AntdComponent {
14-
headerRender: (headerRender: RenderHeader) => any;
15-
/**
16-
* Customize the display of the date cell by setting a scoped slot,
17-
* the returned content will be appended to the cell
18-
* @type Function
19-
*/
20-
dateCellRender: (date: Moment) => any;
21-
22-
/**
23-
* Customize the display of the date cell by setting a scoped slot,
24-
* the returned content will override the cell
25-
* @type Function
26-
*/
27-
dateFullCellRender: (date: Moment) => any;
28-
29-
/**
30-
* The date selected by default
31-
* @default default date
32-
* @type Moment
33-
*/
34-
defaultValue: Moment | string;
35-
36-
/**
37-
* Function that specifies the dates that cannot be selected
38-
* @type Function
39-
*/
40-
disabledDate: (currentDate: Moment) => boolean;
41-
42-
/**
43-
* Whether to display in full-screen
44-
* @default true
45-
* @type boolean
46-
*/
47-
fullscreen: boolean;
48-
49-
/**
50-
* The calendar's locale
51-
* @default [default]
52-
* @type object
53-
* @see https://github.com/vueComponent/ant-design-vue/blob/master/components/date-picker/locale/example.json
54-
*/
55-
locale: object;
56-
57-
/**
58-
* The display mode of the calendar
59-
* @default 'month'
60-
* @type string
61-
*/
62-
mode: 'month' | 'year';
63-
64-
/**
65-
* Customize the display of the month cell by setting a scoped slot, the returned content will be appended to the cell
66-
* @type Function
67-
*/
68-
monthCellRender: (date: Moment) => any;
69-
70-
/**
71-
* Customize the display of the month cell by setting a scoped slot, the returned content will override the cell
72-
* @type Function
73-
*/
74-
monthFullCellRender: (date: Moment) => any;
75-
76-
/**
77-
* to set valid range
78-
* @type [Moment, Moment]
79-
*/
80-
validRange: [Moment, Moment];
81-
82-
/**
83-
* The current selected date
84-
* @default current date
85-
* @type Moment
86-
*/
87-
value: Moment | string;
88-
valueFormat: string;
17+
$props: {
18+
/**
19+
* render custom header in panel
20+
* @param headerRender
21+
* @version 1.5.0
22+
*/
23+
headerRender?: (headerRender: RenderHeader) => VNodeChild | JSX.Element;
24+
/**
25+
* Customize the display of the date cell by setting a scoped slot,
26+
* the returned content will be appended to the cell
27+
* @type Function
28+
*/
29+
dateCellRender?: (date: Moment) => VNodeChild | JSX.Element;
30+
31+
/**
32+
* Customize the display of the date cell by setting a scoped slot,
33+
* the returned content will override the cell
34+
* @type Function
35+
*/
36+
dateFullCellRender?: (date: Moment) => VNodeChild | JSX.Element;
37+
38+
/**
39+
* The date selected by default
40+
* @default default date
41+
* @type Moment
42+
*/
43+
defaultValue?: Moment | string;
44+
45+
/**
46+
* Function that specifies the dates that cannot be selected
47+
* @type Function
48+
*/
49+
disabledDate?: (currentDate: Moment) => boolean;
50+
51+
/**
52+
* Whether to display in full-screen
53+
* @default true
54+
* @type boolean
55+
*/
56+
fullscreen?: boolean;
57+
58+
/**
59+
* The calendar's locale
60+
* @default [default]
61+
* @type object
62+
* @see https://github.com/vueComponent/ant-design-vue/blob/master/components/date-picker/locale/example.json
63+
*/
64+
locale?: object;
65+
66+
/**
67+
* The display mode of the calendar
68+
* @default 'month'
69+
* @type string
70+
*/
71+
mode?: 'month' | 'year';
72+
73+
/**
74+
* Customize the display of the month cell by setting a scoped slot, the returned content will be appended to the cell
75+
* @type Function
76+
*/
77+
monthCellRender?: (date: Moment) => VNodeChild | JSX.Element;
78+
79+
/**
80+
* Customize the display of the month cell by setting a scoped slot, the returned content will override the cell
81+
* @type Function
82+
*/
83+
monthFullCellRender?: (date: Moment) => VNodeChild | JSX.Element;
84+
85+
/**
86+
* to set valid range
87+
* @type [Moment, Moment]
88+
*/
89+
validRange?: [Moment, Moment];
90+
91+
/**
92+
* The current selected date
93+
* @default current date
94+
* @type Moment
95+
*/
96+
value?: Moment | string;
97+
/**
98+
* optional, format of binding value. If not specified,
99+
* the binding value will be a Date object
100+
* @version 1.5.4
101+
*/
102+
valueFormat?: string;
103+
104+
/**
105+
* Callback for when panel changes
106+
* @param date
107+
* @param mode
108+
*/
109+
onPanelChange?: (date?: Moment | string, mode?: string) => void;
110+
111+
/**
112+
* Callback for when a date is selected
113+
* @param date
114+
*/
115+
onSelect?: (date?: Moment | string) => void;
116+
117+
/**
118+
* Callback for when value change
119+
* @param date
120+
*/
121+
onChange?: (date?: Moment | string) => void;
122+
};
89123
}

0 commit comments

Comments
 (0)