UNPKG

2.2 kBTypeScriptView Raw
1import * as React from 'react';
2import { GenerateConfig } from 'rc-picker/lib/generate';
3import { PickerPanelBaseProps as RCPickerPanelBaseProps, PickerPanelDateProps as RCPickerPanelDateProps, PickerPanelTimeProps as RCPickerPanelTimeProps } from 'rc-picker/lib/PickerPanel';
4import enUS from './locale/en_US';
5declare type InjectDefaultProps<Props> = Omit<Props, 'locale' | 'generateConfig' | 'prevIcon' | 'nextIcon' | 'superPrevIcon' | 'superNextIcon'> & {
6 locale?: typeof enUS;
7 size?: 'large' | 'default' | 'small';
8};
9export declare type PickerPanelBaseProps<DateType> = InjectDefaultProps<RCPickerPanelBaseProps<DateType>>;
10export declare type PickerPanelDateProps<DateType> = InjectDefaultProps<RCPickerPanelDateProps<DateType>>;
11export declare type PickerPanelTimeProps<DateType> = InjectDefaultProps<RCPickerPanelTimeProps<DateType>>;
12export declare type PickerProps<DateType> = PickerPanelBaseProps<DateType> | PickerPanelDateProps<DateType> | PickerPanelTimeProps<DateType>;
13export declare type CalendarMode = 'year' | 'month';
14export declare type HeaderRender<DateType> = (config: {
15 value: DateType;
16 type: CalendarMode;
17 onChange: (date: DateType) => void;
18 onTypeChange: (type: CalendarMode) => void;
19}) => React.ReactNode;
20export interface CalendarProps<DateType> {
21 prefixCls?: string;
22 className?: string;
23 style?: React.CSSProperties;
24 locale?: typeof enUS;
25 validRange?: [DateType, DateType];
26 disabledDate?: (date: DateType) => boolean;
27 dateFullCellRender?: (date: DateType) => React.ReactNode;
28 dateCellRender?: (date: DateType) => React.ReactNode;
29 monthFullCellRender?: (date: DateType) => React.ReactNode;
30 monthCellRender?: (date: DateType) => React.ReactNode;
31 headerRender?: HeaderRender<DateType>;
32 value?: DateType;
33 defaultValue?: DateType;
34 mode?: CalendarMode;
35 fullscreen?: boolean;
36 onChange?: (date: DateType) => void;
37 onPanelChange?: (date: DateType, mode: CalendarMode) => void;
38 onSelect?: (date: DateType) => void;
39}
40declare function generateCalendar<DateType>(generateConfig: GenerateConfig<DateType>): (props: CalendarProps<DateType>) => JSX.Element;
41export default generateCalendar;