Added version folder for flatpickr v2

This commit is contained in:
Rowell Heria 2017-06-16 14:18:42 +01:00
parent 04e8ba2459
commit f6939c7a01
4 changed files with 109 additions and 0 deletions

View 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
View 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;

View 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"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }