[flatpickr] Fix #20701: Deprecate redundant "flatpickr" types (#20983)

* Cut: Run "not-needed" script.

* Cut: .github/CODEOWNERS entries.

* Fix: "react-flatpickr" definition file and tests.
This commit is contained in:
Matt
2017-10-25 11:51:41 -07:00
committed by Sheetal Nandi
parent 302690e32c
commit a374bea71d
13 changed files with 16 additions and 262 deletions
-2
View File
@@ -931,8 +931,6 @@
/types/first-mate/ @GlenCFL
/types/fixed-data-table/ @pepaar @stephenjelfs
/types/flat/ @chrootsu
/types/flatpickr/v2/ @UnwrittenFun
/types/flatpickr/ @UnwrittenFun @rowellx68 @wagich
/types/flexslider/ @diullei
/types/flickity/ @clmcgrath @wagich
/types/flight/ @jonathanhedren
+6
View File
@@ -216,6 +216,12 @@
"sourceRepoURL": "http://fineuploader.com/",
"asOfVersion": "5.14.0"
},
{
"libraryName": "flatpickr",
"typingsPackageName": "flatpickr",
"sourceRepoURL": "https://github.com/chmln/flatpickr",
"asOfVersion": "3.1.2"
},
{
"libraryName": "gaea-model",
"typingsPackageName": "gaea-model",
-14
View File
@@ -1,14 +0,0 @@
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();
-105
View File
@@ -1,105 +0,0 @@
// Type definitions for flatpickr 3.0
// Project: https://github.com/chmln/flatpickr
// Definitions by: James Birtles <https://github.com/UnwrittenFun>
// Rowell Heria <https://github.com/rowellx68>
// Michael Wagner <https://github.com/wagich>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function flatpickr(element: string | Element | HTMLElement, options?: Flatpickr.Options): Flatpickr;
declare class Flatpickr {
constructor(element: string | Element | HTMLElement, options?: Flatpickr.Options);
changeMonth(month: number, isOffset?: boolean): void;
clear(): void;
close(): void;
destroy(): void;
formatDate(date: Date, format: string): string;
jumpToDate(date?: Flatpickr.DateString): void;
open(): void;
parseDate(date: string, format: string): Date;
redraw(): void;
set(option: string, value: any): void;
setDate(date: Flatpickr.DateString | Flatpickr.DateString[], triggerChange?: boolean, dateFormat?: string): void;
toggle(): void;
static localize(locale: string | Flatpickr.Locale): void;
static l10ns: {
default: Flatpickr.Locale;
};
}
declare namespace Flatpickr {
interface Options {
altFormat?: string;
altInput?: boolean;
altInputClass?: string;
allowInput?: boolean;
clickOpens?: boolean;
dateFormat?: string | null;
defaultDate?: DateString | DateString[];
defaultHour?: number;
defaultMinute?: number;
disable?: DateRange[];
disableMobile?: boolean;
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;
locale?: string | Locale;
plugins?: any[];
}
interface Locale {
weekdays?: {
shorthand?: string[];
longhand?: string[];
};
months?: {
shorthand?: string[];
longhand?: string[];
};
firstDayOfWeek?: number;
weekAbbreviation?: string;
rangeSeparator?: string;
am?: string;
pm?: string;
ordinal?: ((nth: number) => string) | string;
scrollTitle?: string;
toggleTitle?: string;
}
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;
-24
View File
@@ -1,24 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"flatpickr-tests.ts"
]
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }
-14
View File
@@ -1,14 +0,0 @@
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
View File
@@ -1,68 +0,0 @@
// 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;
-29
View File
@@ -1,29 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"paths": {
"flatpickr": [
"flatpickr/v2"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"flatpickr-tests.ts"
]
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }
+2 -2
View File
@@ -5,12 +5,12 @@
// TypeScript Version: 2.3
import { Component } from 'react';
import { EventCallback, Options } from 'flatpickr';
import { Hook, Options } from 'flatpickr';
export interface DateTimePickerProps {
defaultValue?: string;
options?: Options;
onChange?: EventCallback;
onChange?: Hook;
value?: string;
}
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"flatpickr": "^4.0.6"
}
}
@@ -1,4 +1,4 @@
import * as Flatpickr from 'flatpickr';
import { Instance } from 'flatpickr';
import * as React from 'react';
import DatePicker from 'react-flatpickr';
@@ -12,7 +12,7 @@ const options = {
const optionsElement = <DatePicker options={ options }/>;
const onChange = (
selectedDates: Date[], dateStr: string, instance: Flatpickr,
selectedDates: Date[], dateStr: string, instance: Instance,
elem: HTMLElement
) => null;
const onChangeElement = <DatePicker onChange={ onChange }/>;