1 | import * as React from 'react';
|
2 | import type { GenerateConfig } from 'rc-picker/lib/generate';
|
3 | import type { CellRenderInfo } from 'rc-picker/lib/interface';
|
4 | import type { AnyObject } from '../_util/type';
|
5 | import enUS from './locale/en_US';
|
6 | export type CalendarMode = 'year' | 'month';
|
7 | export type HeaderRender<DateType> = (config: {
|
8 | value: DateType;
|
9 | type: CalendarMode;
|
10 | onChange: (date: DateType) => void;
|
11 | onTypeChange: (type: CalendarMode) => void;
|
12 | }) => React.ReactNode;
|
13 | export interface SelectInfo {
|
14 | source: 'year' | 'month' | 'date' | 'customize';
|
15 | }
|
16 | export interface CalendarProps<DateType> {
|
17 | prefixCls?: string;
|
18 | className?: string;
|
19 | rootClassName?: string;
|
20 | style?: React.CSSProperties;
|
21 | locale?: typeof enUS;
|
22 | validRange?: [DateType, DateType];
|
23 | disabledDate?: (date: DateType) => boolean;
|
24 |
|
25 | dateFullCellRender?: (date: DateType) => React.ReactNode;
|
26 |
|
27 | dateCellRender?: (date: DateType) => React.ReactNode;
|
28 |
|
29 | monthFullCellRender?: (date: DateType) => React.ReactNode;
|
30 |
|
31 | monthCellRender?: (date: DateType) => React.ReactNode;
|
32 | cellRender?: (date: DateType, info: CellRenderInfo<DateType>) => React.ReactNode;
|
33 | fullCellRender?: (date: DateType, info: CellRenderInfo<DateType>) => React.ReactNode;
|
34 | headerRender?: HeaderRender<DateType>;
|
35 | value?: DateType;
|
36 | defaultValue?: DateType;
|
37 | mode?: CalendarMode;
|
38 | fullscreen?: boolean;
|
39 | onChange?: (date: DateType) => void;
|
40 | onPanelChange?: (date: DateType, mode: CalendarMode) => void;
|
41 | onSelect?: (date: DateType, selectInfo: SelectInfo) => void;
|
42 | }
|
43 | declare const generateCalendar: <DateType extends AnyObject>(generateConfig: GenerateConfig<DateType>) => React.FC<Readonly<CalendarProps<DateType>>>;
|
44 | export default generateCalendar;
|