1 | import type React from 'react';
|
2 | import type { GenerateConfig } from './generate';
|
3 | export type Locale = {
|
4 | locale: string;
|
5 |
|
6 | monthBeforeYear?: boolean;
|
7 | yearFormat: string;
|
8 | monthFormat?: string;
|
9 | quarterFormat?: string;
|
10 | today: string;
|
11 | now: string;
|
12 | backToToday: string;
|
13 | ok: string;
|
14 | timeSelect: string;
|
15 | dateSelect: string;
|
16 | weekSelect?: string;
|
17 | clear: string;
|
18 | month: string;
|
19 | year: string;
|
20 | previousMonth: string;
|
21 | nextMonth: string;
|
22 | monthSelect: string;
|
23 | yearSelect: string;
|
24 | decadeSelect: string;
|
25 | dayFormat: string;
|
26 | dateFormat: string;
|
27 | dateTimeFormat: string;
|
28 | previousYear: string;
|
29 | nextYear: string;
|
30 | previousDecade: string;
|
31 | nextDecade: string;
|
32 | previousCentury: string;
|
33 | nextCentury: string;
|
34 | shortWeekDays?: string[];
|
35 | shortMonths?: string[];
|
36 | };
|
37 | export type PanelMode = 'time' | 'date' | 'week' | 'month' | 'quarter' | 'year' | 'decade';
|
38 | export type PickerMode = Exclude<PanelMode, 'datetime' | 'decade'>;
|
39 | export type CellRenderInfo<DateType> = {
|
40 | originNode: React.ReactElement;
|
41 | today: DateType;
|
42 | range?: 'start' | 'end';
|
43 | type: PanelMode;
|
44 | locale?: Locale;
|
45 | subType?: 'hour' | 'minute' | 'second' | 'meridiem';
|
46 | };
|
47 | export type CellRender<DateType, CurrentType = DateType | number> = (current: CurrentType, info: CellRenderInfo<DateType>) => React.ReactNode;
|
48 | export type PanelRefProps = {
|
49 | onKeyDown?: (e: React.KeyboardEvent<HTMLElement>) => boolean;
|
50 | onBlur?: React.FocusEventHandler<HTMLElement>;
|
51 | onClose?: () => void;
|
52 | };
|
53 | export type NullableDateType<DateType> = DateType | null | undefined;
|
54 | export type OnSelect<DateType> = (value: DateType, type: 'key' | 'mouse' | 'submit') => void;
|
55 | export type PanelSharedProps<DateType> = {
|
56 | prefixCls: string;
|
57 | generateConfig: GenerateConfig<DateType>;
|
58 | value?: NullableDateType<DateType>;
|
59 | viewDate: DateType;
|
60 | |
61 |
|
62 |
|
63 |
|
64 | defaultPickerValue?: DateType;
|
65 | locale: Locale;
|
66 | disabledDate?: (date: DateType) => boolean;
|
67 | prevIcon?: React.ReactNode;
|
68 | nextIcon?: React.ReactNode;
|
69 | superPrevIcon?: React.ReactNode;
|
70 | superNextIcon?: React.ReactNode;
|
71 | |
72 |
|
73 |
|
74 |
|
75 |
|
76 | operationRef: React.MutableRefObject<PanelRefProps>;
|
77 | onSelect: OnSelect<DateType>;
|
78 | onViewDateChange: (value: DateType) => void;
|
79 | onPanelChange: (mode: PanelMode | null, viewValue: DateType) => void;
|
80 | };
|
81 | export type DisabledTimes = {
|
82 | disabledHours?: () => number[];
|
83 | disabledMinutes?: (hour: number) => number[];
|
84 | disabledSeconds?: (hour: number, minute: number) => number[];
|
85 | };
|
86 | export type DisabledTime<DateType> = (date: DateType | null) => DisabledTimes;
|
87 | export type OnPanelChange<DateType> = (value: DateType, mode: PanelMode) => void;
|
88 | export type EventValue<DateType> = DateType | null;
|
89 | export type RangeValue<DateType> = [EventValue<DateType>, EventValue<DateType>] | null;
|
90 | export type Components = {
|
91 | button?: React.ComponentType | string;
|
92 | };
|
93 | export type RangeList = {
|
94 | label: React.ReactNode;
|
95 | onClick: () => void;
|
96 | onMouseEnter: () => void;
|
97 | onMouseLeave: () => void;
|
98 | }[];
|
99 | export type CustomFormat<DateType> = (value: DateType) => string;
|
100 | export interface PresetDate<T> {
|
101 | label: React.ReactNode;
|
102 | value: T | (() => T);
|
103 | }
|
104 | type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;
|
105 | export type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
|
106 | export {};
|
107 |
|
\ | No newline at end of file |