UNPKG

4.7 kBTypeScriptView Raw
1import { Instance } from "./instance";
2import { CustomLocale, key as LocaleKey, Locale } from "./locale";
3export declare type DateOption = Date | string | number;
4export declare type DateRangeLimit<D = DateOption> = {
5 from: D;
6 to: D;
7};
8export declare type DateLimit<D = DateOption> = D | DateRangeLimit<D> | ((date: Date) => boolean);
9export declare type Hook = (dates: Date[], currentDateString: string, self: Instance, data?: any) => void;
10export declare type HookKey = "onChange" | "onClose" | "onDayCreate" | "onDestroy" | "onKeyDown" | "onMonthChange" | "onOpen" | "onParseConfig" | "onReady" | "onValueUpdate" | "onYearChange" | "onPreCalendarPosition";
11export declare const HOOKS: HookKey[];
12export declare type Plugin<E = {}> = (fp: Instance & E) => Options;
13export interface BaseOptions {
14 allowInput: boolean;
15 allowInvalidPreload: boolean;
16 altFormat: string;
17 altInput: boolean;
18 altInputClass: string;
19 animate: boolean;
20 appendTo: HTMLElement;
21 ariaDateFormat: string;
22 autoFillDefaultTime: boolean;
23 clickOpens: boolean;
24 closeOnSelect: boolean;
25 conjunction: string;
26 dateFormat: string;
27 defaultDate: DateOption | DateOption[];
28 defaultHour: number;
29 defaultMinute: number;
30 defaultSeconds: number;
31 disable: DateLimit<DateOption>[];
32 disableMobile: boolean;
33 enable: DateLimit<DateOption>[];
34 enableSeconds: boolean;
35 enableTime: boolean;
36 errorHandler: (e: Error) => void;
37 formatDate: (date: Date, format: string, locale: Locale) => string;
38 getWeek: (date: Date) => string | number;
39 hourIncrement: number;
40 ignoredFocusElements: HTMLElement[];
41 inline: boolean;
42 locale: LocaleKey | CustomLocale;
43 maxDate: DateOption;
44 maxTime: DateOption;
45 minDate: DateOption;
46 minTime: DateOption;
47 minuteIncrement: number;
48 mode: "single" | "multiple" | "range" | "time";
49 monthSelectorType: "dropdown" | "static";
50 nextArrow: string;
51 noCalendar: boolean;
52 now?: DateOption;
53 onChange: Hook | Hook[];
54 onClose: Hook | Hook[];
55 onDayCreate: Hook | Hook[];
56 onDestroy: Hook | Hook[];
57 onKeyDown: Hook | Hook[];
58 onMonthChange: Hook | Hook[];
59 onOpen: Hook | Hook[];
60 onParseConfig: Hook | Hook[];
61 onReady: Hook | Hook[];
62 onValueUpdate: Hook | Hook[];
63 onYearChange: Hook | Hook[];
64 onPreCalendarPosition: Hook | Hook[];
65 parseDate: (date: string, format: string) => Date;
66 plugins: Plugin[];
67 position: "auto" | "above" | "below";
68 positionElement: Element;
69 prevArrow: string;
70 shorthandCurrentMonth: boolean;
71 static: boolean;
72 showMonths?: number;
73 time_24hr: boolean;
74 weekNumbers: boolean;
75 wrap: boolean;
76}
77export declare type Options = Partial<BaseOptions>;
78export interface ParsedOptions {
79 _disable: DateLimit<Date>[];
80 _enable: DateLimit<Date>[];
81 _maxDate?: Date;
82 _maxTime?: Date;
83 _minDate?: Date;
84 _minTime?: Date;
85 allowInput: boolean;
86 allowInvalidPreload: boolean;
87 altFormat: string;
88 altInput: boolean;
89 altInputClass: string;
90 animate: boolean;
91 appendTo?: HTMLElement;
92 ariaDateFormat: string;
93 autoFillDefaultTime: boolean;
94 clickOpens: boolean;
95 closeOnSelect: boolean;
96 conjunction: string;
97 dateFormat: string;
98 defaultDate?: Date | Date[];
99 defaultHour: number;
100 defaultMinute: number;
101 defaultSeconds: number;
102 disable: DateLimit<Date>[];
103 disableMobile: boolean;
104 enable: DateLimit<Date>[];
105 enableSeconds: boolean;
106 enableTime: boolean;
107 errorHandler: (err: Error) => void;
108 formatDate?: Options["formatDate"];
109 getWeek: (date: Date) => string | number;
110 hourIncrement: number;
111 ignoredFocusElements: HTMLElement[];
112 inline: boolean;
113 locale: LocaleKey | CustomLocale;
114 maxDate?: Date;
115 maxTime?: Date;
116 minDate?: Date;
117 minTime?: Date;
118 minuteIncrement: number;
119 mode: BaseOptions["mode"];
120 monthSelectorType: string;
121 nextArrow: string;
122 noCalendar: boolean;
123 now: Date;
124 onChange: Hook[];
125 onClose: Hook[];
126 onDayCreate: Hook[];
127 onDestroy: Hook[];
128 onKeyDown: Hook[];
129 onMonthChange: Hook[];
130 onOpen: Hook[];
131 onParseConfig: Hook[];
132 onReady: Hook[];
133 onValueUpdate: Hook[];
134 onYearChange: Hook[];
135 onPreCalendarPosition: Hook[];
136 parseDate?: BaseOptions["parseDate"];
137 plugins: Plugin[];
138 position: BaseOptions["position"];
139 positionElement?: HTMLElement;
140 prevArrow: string;
141 shorthandCurrentMonth: boolean;
142 showMonths: number;
143 static: boolean;
144 time_24hr: boolean;
145 weekNumbers: boolean;
146 wrap: boolean;
147}
148export declare const defaults: ParsedOptions;