Skip to content

Commit 3d2c3d0

Browse files
committed
chore: Update documentation
1 parent 7574555 commit 3d2c3d0

File tree

2 files changed

+468
-0
lines changed

2 files changed

+468
-0
lines changed

index.d.ts

+356
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,356 @@
1+
/* eslint-disable @typescript-eslint/ban-types */
2+
import type {
3+
ComponentOptionsMixin,
4+
ComponentPropsOptions,
5+
ComponentPublicInstance,
6+
ComputedOptions,
7+
DefineComponent,
8+
MethodOptions,
9+
} from 'vue';
10+
import type { Locale } from 'date-fns';
11+
12+
export type EmitEvents =
13+
| 'update:model-value'
14+
| 'update:model-timezone-value'
15+
| 'text-submit'
16+
| 'closed'
17+
| 'cleared'
18+
| 'open'
19+
| 'focus'
20+
| 'blur'
21+
| 'internal-model-change'
22+
| 'recalculate-position'
23+
| 'flow-step'
24+
| 'update-month-year'
25+
| 'invalid-select'
26+
| 'tooltip-open'
27+
| 'tooltip-close'
28+
| 'invalid-fixed-range'
29+
| 'time-picker-open'
30+
| 'time-picker-close'
31+
| 'am-pm-change'
32+
| 'range-start'
33+
| 'range-end'
34+
| 'date-update'
35+
| 'invalid-date';
36+
export type WeekNumberType = 'iso' | 'local' | ((date: Date) => string | number);
37+
export type TimeObj = { hours: number; minutes: number; seconds: number };
38+
export type PartialTimeObj = { hours?: number | string; minutes?: number | string; seconds?: number | string };
39+
export type TimeModel = {
40+
hours: number | string;
41+
minutes: number | string;
42+
seconds?: number | string;
43+
};
44+
export type MenuView = 'month' | 'year' | 'calendar' | 'time';
45+
export type ModelValue =
46+
| Date
47+
| Date[]
48+
| Array<Date[]>
49+
| Array<string[]>
50+
| string
51+
| string[]
52+
| number
53+
| number[]
54+
| TimeModel
55+
| TimeModel[]
56+
| { month: number | string; year: number | string }
57+
| { month: number | string; year: number | string }[]
58+
| null;
59+
60+
export interface DatePickerMarker {
61+
date: Date | string;
62+
type?: 'dot' | 'line';
63+
tooltip?: { text?: string; html?: string; color?: string }[];
64+
color?: string;
65+
}
66+
67+
export interface DisabledTime {
68+
hours: number | string;
69+
minutes: number | string;
70+
seconds?: number | string;
71+
}
72+
73+
export interface CalendarWeek {
74+
days: CalendarDay[];
75+
}
76+
export interface CalendarDay {
77+
text: number | string;
78+
value: Date;
79+
current: boolean;
80+
classData: Record<string, boolean>;
81+
marker?: DatePickerMarker;
82+
}
83+
84+
export interface Highlight {
85+
dates: Date[];
86+
years: number[];
87+
months: { month: number; year: number }[];
88+
quarters: { quarter: number; year: number }[];
89+
weekdays: number[];
90+
options: { highlightDisabled: boolean };
91+
}
92+
93+
export type DpOptionEnabled = boolean | number | string;
94+
95+
export interface RangeConfig {
96+
noDisabledRange?: boolean;
97+
showLastInRange?: boolean;
98+
minMaxRawRange?: boolean;
99+
partialRange?: boolean;
100+
disableTimeRangeValidation?: boolean;
101+
fixedStart?: boolean;
102+
fixedEnd?: boolean;
103+
maxRange?: string | number;
104+
minRange?: string | number;
105+
autoRange?: string | number;
106+
}
107+
108+
export interface VueDatePickerProps {
109+
uid?: string;
110+
name?: string;
111+
is24?: boolean;
112+
enableTimePicker?: boolean;
113+
range?: boolean | RangeConfig;
114+
multiCalendars?: DpOptionEnabled | Partial<{ static: boolean; solo: boolean; count: number | string }>;
115+
modelValue?: ModelValue;
116+
locale?: string;
117+
position?: 'left' | 'center' | 'right';
118+
dark?: boolean;
119+
placeholder?: string;
120+
weekNumbers?: WeekNumberType | { type: WeekNumberType; hideOnOffsetDates?: boolean };
121+
hoursIncrement?: number | string;
122+
hoursGridIncrement?: number | string;
123+
secondsGridIncrement?: number | string;
124+
minutesGridIncrement?: number | string;
125+
minutesIncrement?: number | string;
126+
secondsIncrement?: number | string;
127+
minDate?: Date | string;
128+
maxDate?: Date | string;
129+
minTime?: PartialTimeObj;
130+
maxTime?: PartialTimeObj;
131+
weekStart?: '0' | '1' | '2' | '3' | '4' | '5' | '6' | 0 | 1 | 2 | 3 | 4 | 5 | 6;
132+
disabled?: boolean;
133+
readonly?: boolean;
134+
required?: boolean;
135+
format?: string | ((date: Date) => string) | ((dates: Date[]) => string);
136+
previewFormat?: string | ((date: Date) => string) | ((dates: Date[]) => string);
137+
inputClassName?: string;
138+
menuClassName?: string;
139+
calendarClassName?: string;
140+
calendarCellClassName?: string;
141+
hideInputIcon?: boolean;
142+
state?: boolean;
143+
clearable?: boolean;
144+
autoApply?: boolean;
145+
filters?: {
146+
months?: number[];
147+
years?: number[];
148+
times?: { hours?: number[]; minutes?: number[]; seconds?: number[] };
149+
};
150+
disableMonthYearSelect?: boolean;
151+
yearRange?: number[];
152+
disabledDates?: Date[] | string[] | ((date: Date) => boolean);
153+
inline?: boolean | { input?: boolean };
154+
selectText?: string;
155+
cancelText?: string;
156+
weekNumName?: string;
157+
autoPosition?: boolean;
158+
monthPicker?: boolean;
159+
timePicker?: boolean;
160+
textInput?:
161+
| boolean
162+
| {
163+
enterSubmit?: boolean;
164+
tabSubmit?: boolean;
165+
openMenu?: boolean;
166+
rangeSeparator?: string;
167+
selectOnFocus?: boolean;
168+
format?: string | string[] | ((value: string) => Date | null);
169+
};
170+
monthNameFormat?: 'long' | 'short';
171+
startDate?: string | Date;
172+
startTime?: PartialTimeObj | PartialTimeObj[];
173+
hideOffsetDates?: boolean;
174+
/**
175+
* @deprecated
176+
*/
177+
autoRange?: number | string;
178+
noToday?: boolean;
179+
noHoursOverlay?: boolean;
180+
noMinutesOverlay?: boolean;
181+
noSecondsOverlay?: boolean;
182+
altPosition?: (el: HTMLElement | undefined) => { top: number | string; left: number | string; transform?: string };
183+
disabledWeekDays?: number[] | string[];
184+
allowedDates?: string[] | Date[];
185+
nowButtonLabel?: string;
186+
/**
187+
* @deprecated
188+
*/
189+
partialRange?: boolean;
190+
monthChangeOnScroll?: boolean | 'inverse';
191+
markers?: DatePickerMarker[];
192+
transitions?:
193+
| boolean
194+
| {
195+
menuAppearTop?: string;
196+
menuAppearBottom?: string;
197+
open?: string;
198+
close?: string;
199+
next?: string;
200+
previous?: string;
201+
vNext?: string;
202+
vPrevious?: string;
203+
};
204+
enableSeconds?: boolean;
205+
escClose?: boolean;
206+
spaceConfirm?: boolean;
207+
monthChangeOnArrows?: boolean;
208+
formatLocale?: Locale;
209+
autocomplete?: string;
210+
multiDates?: boolean | { limit?: number | string; dragSelect?: boolean };
211+
presetDates?: {
212+
label: string;
213+
value: Date[] | string[] | string | Date;
214+
style?: Record<string, string>;
215+
slot?: string;
216+
noTz?: boolean;
217+
}[];
218+
flow?: ('month' | 'year' | 'calendar' | 'time' | 'minutes' | 'hours' | 'seconds')[];
219+
partialFlow?: boolean;
220+
preventMinMaxNavigation?: boolean;
221+
/**
222+
* @deprecated
223+
*/
224+
minRange?: number | string;
225+
/**
226+
* @deprecated
227+
*/
228+
maxRange?: number | string;
229+
/**
230+
* @deprecated
231+
*/
232+
fixedStart?: boolean;
233+
/**
234+
* @deprecated
235+
*/
236+
fixedEnd?: boolean;
237+
utc?: boolean | 'preserve';
238+
/**
239+
* @deprecated
240+
*/
241+
multiDatesLimit?: number | string;
242+
reverseYears?: boolean;
243+
weekPicker?: boolean;
244+
vertical?: boolean;
245+
ariaLabels?: {
246+
toggleOverlay?: string;
247+
menu?: string;
248+
input?: string;
249+
calendarWrap?: string;
250+
calendarDays?: string;
251+
openTimePicker?: string;
252+
closeTimePicker?: string;
253+
incrementValue?: (type: 'hours' | 'minutes' | 'seconds') => string;
254+
decrementValue?: (type: 'hours' | 'minutes' | 'seconds') => string;
255+
openTpOverlay?: (type: 'hours' | 'minutes' | 'seconds') => string;
256+
amPmButton?: string;
257+
openYearsOverlay?: string;
258+
openMonthsOverlay?: string;
259+
nextMonth?: string;
260+
prevMonth?: string;
261+
nextYear?: string;
262+
prevYear?: string;
263+
day?: ({ value }: { value: Date }) => string;
264+
weekDay?: (day: number) => string;
265+
};
266+
arrowNavigation?: boolean;
267+
yearPicker?: boolean;
268+
/**
269+
* @deprecated
270+
*/
271+
disableTimeRangeValidation?: boolean;
272+
dayNames?: ((lang: string, weekStart: number) => string[]) | string[];
273+
modelType?: 'timestamp' | 'format' | string;
274+
modelAuto?: boolean;
275+
highlight?:
276+
| ((date: Date[], disabled?: boolean) => boolean)
277+
| ((month: { month: number; year: number }) => boolean)
278+
| ((year: number) => boolean)
279+
| ((quarter: { quarter: number; year: number }) => boolean)
280+
| Partial<Highlight>;
281+
offset?: string | number;
282+
teleportCenter?: boolean;
283+
teleport?: boolean | string | HTMLElement;
284+
ignoreTimeValidation?: boolean;
285+
dayClass?: (date: Date) => string;
286+
hideNavigation?: ('month' | 'year' | 'calendar' | 'time' | 'minutes' | 'hours' | 'seconds')[];
287+
/**
288+
* @deprecated
289+
*/
290+
noDisabledRange?: boolean;
291+
sixWeeks?: boolean | 'append' | 'prepend' | 'center' | 'fair';
292+
timezone?:
293+
| string
294+
| { timezone?: string; exactMatch?: boolean; dateInTz?: string; emitTimezone?: string; convertModel?: boolean };
295+
/**
296+
* @deprecated
297+
*/
298+
emitTimezone?: string;
299+
disableYearSelect?: boolean;
300+
focusStartDate?: boolean;
301+
disabledTimes?:
302+
| ((time: TimeObj | TimeObj[] | (TimeObj | undefined)[]) => boolean)
303+
| DisabledTime[]
304+
| [DisabledTime[], DisabledTime[]];
305+
/**
306+
* @deprecated
307+
*/
308+
showLastInRange?: boolean;
309+
timePickerInline?: boolean;
310+
calendar?: (weeks: CalendarWeek[]) => CalendarWeek[];
311+
config?: {
312+
allowStopPropagation?: boolean;
313+
closeOnScroll?: boolean;
314+
modeHeight?: number;
315+
allowPreventDefault?: boolean;
316+
closeOnClearValue?: boolean;
317+
closeOnAutoApply?: boolean;
318+
noSwipe?: boolean;
319+
keepActionRow?: boolean;
320+
onClickOutside?: (validate: () => boolean) => void;
321+
tabOutClosesMenu?: boolean;
322+
};
323+
quarterPicker?: boolean;
324+
yearFirst?: boolean;
325+
loading?: boolean;
326+
}
327+
328+
export type DatePickerInstance = ComponentPublicInstance<PublicMethods> | null;
329+
330+
export interface PublicMethods extends MethodOptions {
331+
selectDate: () => void;
332+
closeMenu: () => void;
333+
openMenu: () => void;
334+
clearValue: () => void;
335+
onScroll: () => void;
336+
updateInternalModelValue: (value: Date | Date[] | null) => void;
337+
setMonthYear: (value: { month?: number | string; year?: number | string }) => void;
338+
parseModel: (value?: ModelValue) => void;
339+
switchView: (view: MenuView, instance?: number) => void;
340+
toggleMenu: () => void;
341+
}
342+
343+
declare const _default: DefineComponent<
344+
ComponentPropsOptions<VueDatePickerProps>,
345+
{},
346+
{},
347+
ComputedOptions,
348+
PublicMethods,
349+
ComponentOptionsMixin,
350+
ComponentOptionsMixin,
351+
EmitEvents[],
352+
EmitEvents,
353+
VueDatePickerProps
354+
>;
355+
356+
export default _default;

0 commit comments

Comments
 (0)