mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 19:09:18 +08:00
Updated React Datepicker types for version 1.0.4 (#22778)
This commit is contained in:
committed by
Ryan Cavanaugh
parent
435bb30c72
commit
d2df250b37
9
types/react-datepicker/index.d.ts
vendored
9
types/react-datepicker/index.d.ts
vendored
@@ -1,10 +1,11 @@
|
||||
// Type definitions for react-datepicker 0.62
|
||||
// Type definitions for react-datepicker 1.0
|
||||
// Project: https://github.com/Hacker0x01/react-datepicker
|
||||
// Definitions by: Rajab Shakirov <https://github.com/radziksh>,
|
||||
// Andrey Balokha <https://github.com/andrewBalekha>,
|
||||
// Greg Smith <https://github.com/smrq>,
|
||||
// Platon Pronko <https://github.com/Rogach>
|
||||
// Roy Xue <https://github.com/royxue>
|
||||
// Koala Human <https://github.com/KoalaHuman>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@@ -12,6 +13,7 @@ import * as React from "react";
|
||||
import * as moment from "moment";
|
||||
|
||||
export interface ReactDatePickerProps {
|
||||
adjustDateOnChange?: boolean;
|
||||
allowSameDay?: boolean;
|
||||
autoComplete?: string;
|
||||
autoFocus?: boolean;
|
||||
@@ -25,7 +27,7 @@ export interface ReactDatePickerProps {
|
||||
dayClassName?(date: moment.Moment): string | null;
|
||||
disabled?: boolean;
|
||||
disabledKeyboardNavigation?: boolean;
|
||||
dropdownMode?: string;
|
||||
dropdownMode?: 'scroll' | 'select';
|
||||
endDate?: moment.Moment;
|
||||
excludeDates?: any[];
|
||||
filterDate?(date: moment.Moment): boolean;
|
||||
@@ -51,12 +53,14 @@ export interface ReactDatePickerProps {
|
||||
onMonthChange?(date: moment.Moment): void;
|
||||
onSelect?(date: moment.Moment, event: React.SyntheticEvent<any> | undefined): void;
|
||||
onWeekSelect?(firstDayOfWeek: moment.Moment, weekNumber: string | number, event: React.SyntheticEvent<any> | undefined): void;
|
||||
onYearChange?(date: moment.Moment): void;
|
||||
openToDate?: moment.Moment;
|
||||
peekNextMonth?: boolean;
|
||||
placeholderText?: string;
|
||||
popperClassName?: string;
|
||||
popperModifiers?: any;
|
||||
popperPlacement?: string;
|
||||
preventOpenOnFocus?: boolean;
|
||||
readOnly?: boolean;
|
||||
required?: boolean;
|
||||
scrollableYearDropdown?: boolean;
|
||||
@@ -71,6 +75,7 @@ export interface ReactDatePickerProps {
|
||||
title?: string;
|
||||
todayButton?: string;
|
||||
useWeekdaysShort?: boolean;
|
||||
useShortMonthInDropdown?: boolean;
|
||||
utcOffset?: number;
|
||||
value?: string;
|
||||
weekLabel?: string;
|
||||
|
||||
@@ -18,11 +18,19 @@ class ReactDatePicker extends React.Component<{}, { startDate: moment.Moment; di
|
||||
});
|
||||
};
|
||||
|
||||
handleYearChange = (date: moment.Moment) => {
|
||||
this.setState({
|
||||
startDate: date
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<DatePicker
|
||||
selected={this.state.startDate}
|
||||
onChange={this.handleChange} />
|
||||
onChange={this.handleChange}
|
||||
onYearChange={this.handleYearChange}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user