chore: update Calendar type (#2731)

pull/2740/head
言肆 2020-08-20 18:54:19 +08:00 committed by GitHub
parent 03a42a5b35
commit 90de3f357b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 100 additions and 66 deletions

166
types/calendar.d.ts vendored
View File

@ -4,86 +4,120 @@
import { AntdComponent } from './component'; import { AntdComponent } from './component';
import { Moment } from 'moment'; import { Moment } from 'moment';
import { VNodeChild } from 'vue';
export interface RenderHeader { export interface RenderHeader {
value: Moment; value: Moment;
onChange?: (value: Moment) => void; onChange?: (value: Moment) => void;
type: string; type: string;
onTypeChange: (type: string) => void; onTypeChange?: (type: string) => void;
} }
export declare class Calendar extends AntdComponent { export declare class Calendar extends AntdComponent {
headerRender: (headerRender: RenderHeader) => any; $props: {
/** /**
* Customize the display of the date cell by setting a scoped slot, * render custom header in panel
* the returned content will be appended to the cell * @param headerRender
* @type Function * @version 1.5.0
*/ */
dateCellRender: (date: Moment) => any; headerRender?: (headerRender: RenderHeader) => VNodeChild | JSX.Element;
/**
* Customize the display of the date cell by setting a scoped slot,
* the returned content will be appended to the cell
* @type Function
*/
dateCellRender?: (date: Moment) => VNodeChild | JSX.Element;
/** /**
* Customize the display of the date cell by setting a scoped slot, * Customize the display of the date cell by setting a scoped slot,
* the returned content will override the cell * the returned content will override the cell
* @type Function * @type Function
*/ */
dateFullCellRender: (date: Moment) => any; dateFullCellRender?: (date: Moment) => VNodeChild | JSX.Element;
/** /**
* The date selected by default * The date selected by default
* @default default date * @default default date
* @type Moment * @type Moment
*/ */
defaultValue: Moment | string; defaultValue?: Moment | string;
/** /**
* Function that specifies the dates that cannot be selected * Function that specifies the dates that cannot be selected
* @type Function * @type Function
*/ */
disabledDate: (currentDate: Moment) => boolean; disabledDate?: (currentDate: Moment) => boolean;
/** /**
* Whether to display in full-screen * Whether to display in full-screen
* @default true * @default true
* @type boolean * @type boolean
*/ */
fullscreen: boolean; fullscreen?: boolean;
/** /**
* The calendar's locale * The calendar's locale
* @default [default] * @default [default]
* @type object * @type object
* @see https://github.com/vueComponent/ant-design-vue/blob/master/components/date-picker/locale/example.json * @see https://github.com/vueComponent/ant-design-vue/blob/master/components/date-picker/locale/example.json
*/ */
locale: object; locale?: object;
/** /**
* The display mode of the calendar * The display mode of the calendar
* @default 'month' * @default 'month'
* @type string * @type string
*/ */
mode: 'month' | 'year'; mode?: 'month' | 'year';
/** /**
* Customize the display of the month cell by setting a scoped slot, the returned content will be appended to the cell * Customize the display of the month cell by setting a scoped slot, the returned content will be appended to the cell
* @type Function * @type Function
*/ */
monthCellRender: (date: Moment) => any; monthCellRender?: (date: Moment) => VNodeChild | JSX.Element;
/** /**
* Customize the display of the month cell by setting a scoped slot, the returned content will override the cell * Customize the display of the month cell by setting a scoped slot, the returned content will override the cell
* @type Function * @type Function
*/ */
monthFullCellRender: (date: Moment) => any; monthFullCellRender?: (date: Moment) => VNodeChild | JSX.Element;
/** /**
* to set valid range * to set valid range
* @type [Moment, Moment] * @type [Moment, Moment]
*/ */
validRange: [Moment, Moment]; validRange?: [Moment, Moment];
/** /**
* The current selected date * The current selected date
* @default current date * @default current date
* @type Moment * @type Moment
*/ */
value: Moment | string; value?: Moment | string;
valueFormat: string; /**
* optional, format of binding value. If not specified,
* the binding value will be a Date object
* @version 1.5.4
*/
valueFormat?: string;
/**
* Callback for when panel changes
* @param date
* @param mode
*/
onPanelChange?: (date?: Moment | string, mode?: string) => void;
/**
* Callback for when a date is selected
* @param date
*/
onSelect?: (date?: Moment | string) => void;
/**
* Callback for when value change
* @param date
*/
onChange?: (date?: Moment | string) => void;
};
} }