mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Added version folder for flatpickr v2
This commit is contained in:
parent
04e8ba2459
commit
f6939c7a01
14
types/flatpickr/v2/flatpickr-tests.ts
Normal file
14
types/flatpickr/v2/flatpickr-tests.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import * as Flatpickr from 'flatpickr';
|
||||
|
||||
const picker1 = new Flatpickr('input');
|
||||
|
||||
const input = document.querySelector('input');
|
||||
if (input != null) {
|
||||
const picker2 = new Flatpickr(input, {
|
||||
mode: 'range',
|
||||
onChange: dates => null
|
||||
});
|
||||
picker2.setDate(['2016-11-15T00:00:00.000Z', new Date()]);
|
||||
}
|
||||
|
||||
picker1.destroy();
|
||||
68
types/flatpickr/v2/index.d.ts
vendored
Normal file
68
types/flatpickr/v2/index.d.ts
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
// Type definitions for flatpickr 2.2
|
||||
// Project: https://github.com/chmln/flatpickr
|
||||
// Definitions by: James Birtles <https://github.com/UnwrittenFun>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class Flatpickr {
|
||||
constructor(element: string | Element, options?: Flatpickr.Options);
|
||||
|
||||
changeMonth(month: number, isOffset: boolean): void;
|
||||
clear(): void;
|
||||
close(): void;
|
||||
destroy(): void;
|
||||
formatDate(format: string, date: Date): string;
|
||||
jumpToDate(date?: Flatpickr.DateString): void;
|
||||
open(): void;
|
||||
parseDate(date: string): Date;
|
||||
redraw(): void;
|
||||
set(option: string, value: any): void;
|
||||
setDate(date: Flatpickr.DateString | Flatpickr.DateString[]): void;
|
||||
toggle(): void;
|
||||
}
|
||||
|
||||
declare namespace Flatpickr {
|
||||
interface Options {
|
||||
altFormat?: string;
|
||||
altInput?: boolean;
|
||||
altInputClass?: string;
|
||||
allowInput?: boolean;
|
||||
clickOpens?: boolean;
|
||||
dateFormat?: string | null;
|
||||
defaultDate?: DateString | DateString[];
|
||||
disable?: DateRange[];
|
||||
enable?: DateRange[];
|
||||
enableTime?: boolean;
|
||||
enableSeconds?: boolean;
|
||||
hourIncrement?: number;
|
||||
inline?: boolean;
|
||||
maxDate?: DateString;
|
||||
minDate?: DateString;
|
||||
minuteIncrement?: number;
|
||||
mode?: Mode;
|
||||
nextArrow?: string;
|
||||
noCalendar?: boolean;
|
||||
onChange?: EventCallback | EventCallback[];
|
||||
onClose?: EventCallback | EventCallback[];
|
||||
onOpen?: EventCallback | EventCallback[];
|
||||
onReady?: EventCallback | EventCallback[];
|
||||
onMonthChange?: EventCallback | EventCallback[];
|
||||
onYearChange?: EventCallback | EventCallback[];
|
||||
onValueUpdate?: EventCallback | EventCallback[];
|
||||
onDayCreate?: EventCallback | EventCallback[];
|
||||
parseDate?(date: string): Date;
|
||||
prevArrow?: string;
|
||||
shorthandCurrentMonth?: boolean;
|
||||
static?: boolean;
|
||||
time_24hr?: boolean;
|
||||
utc?: boolean;
|
||||
weekNumbers?: boolean;
|
||||
wrap?: boolean;
|
||||
}
|
||||
|
||||
type DateString = Date | string;
|
||||
type DateRange = DateString | { from: DateString, to: DateString } | ((date: Date) => boolean);
|
||||
type Mode = 'single' | 'multiple' | 'range';
|
||||
type EventCallback = (selectedDates: Date[], dateStr: string, instance: Flatpickr, elem: HTMLElement) => void;
|
||||
}
|
||||
|
||||
export = Flatpickr;
|
||||
26
types/flatpickr/v2/tsconfig.json
Normal file
26
types/flatpickr/v2/tsconfig.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"flatpickr": [ "flatpickr/v2" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"flatpickr-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/flatpickr/v2/tslint.json
Normal file
1
types/flatpickr/v2/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user