UNPKG

@progress/kendo-react-dateinputs

Version:
158 lines (157 loc) • 5.24 kB
import * as React from 'react'; import * as PropTypes from 'prop-types'; import { MultiViewCalendar } from '../calendar/components/MultiViewCalendar'; import { SelectionRange } from '../calendar/models'; import { DateRangePickerSettings } from './models'; /** * @hidden */ export interface ReverseClickEvent { syntheticEvent: React.SyntheticEvent<any>; nativeEvent?: any; } /** * The arguments for the `onChange` event of the DateRangePicker. */ export interface DateRangePickerChangeEvent { syntheticEvent: React.SyntheticEvent<any>; nativeEvent?: any; value: SelectionRange; show?: boolean; target: DateRangePicker; } /** * Represents the props of the [KendoReact DateRangePicker component]({% slug overview_daterangepicker %}). */ export interface DateRangePickerProps extends DateRangePickerSettings { /** * Sets the default value of the DateRangePicker ([see example]({% slug default_value_daterangepicker %})). */ defaultValue?: SelectionRange; /** * Fires each time the user selects a part of a date range ([see example]({% slug controlled_daterangepicker %}#toc-controlling-the-value)). */ onChange?: (event: DateRangePickerChangeEvent) => void; /** * Specifies the selected date range of the DateRangePicker ([see example]({% slug controlled_daterangepicker %}#toc-controlling-the-value)). * * > The `value` has to be an object with `start` and `end` valid JavaScript [`Date`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date) instances or `null`. */ value?: SelectionRange; } /** * @hidden */ export interface DateRangePickerState { show: boolean; value: SelectionRange; } export declare class DateRangePicker extends React.Component<DateRangePickerProps, DateRangePickerState> { /** * @hidden */ static propTypes: { allowReverse: PropTypes.Requireable<any>; calendarSettings: PropTypes.Requireable<any>; className: PropTypes.Requireable<any>; defaultShow: PropTypes.Requireable<any>; defaultValue: PropTypes.Requireable<any>; disabled: PropTypes.Requireable<any>; endDateInputSettings: PropTypes.Requireable<any>; focusedDate: PropTypes.Requireable<any>; format: PropTypes.Requireable<any>; id: PropTypes.Requireable<any>; max: PropTypes.Requireable<any>; min: PropTypes.Requireable<any>; onBlur: PropTypes.Requireable<any>; onChange: PropTypes.Requireable<any>; onFocus: PropTypes.Requireable<any>; popupSettings: PropTypes.Requireable<any>; show: PropTypes.Requireable<any>; startDateInputSettings: PropTypes.Requireable<any>; style: PropTypes.Requireable<any>; swapButton: PropTypes.Requireable<any>; tabIndex: PropTypes.Requireable<any>; value: PropTypes.Requireable<any>; }; /** * @hidden */ static defaultProps: { allowReverse: boolean; defaultShow: boolean; defaultValue: SelectionRange; disabled: boolean; format: string; max: Date; min: Date; swapButton: boolean; }; private _element; private _wrapper; private _calendar; private _startDateInput; private _endDateInput; private valueDuringOnChange?; private showDuringOnChange?; private nextTickId; private _popupId; private _startInputId; private _endInputId; private shouldFocusDateInput; private shouldFocusCalendar; constructor(props: DateRangePickerProps); /** * Gets the wrapping element of the DateRangePicker. */ readonly element: HTMLSpanElement | null; /** * Gets the MultiVieCalendar inside the DateRangePicker. */ readonly calendar: MultiViewCalendar | null; /** * Gets the value of the DateRangePicker. */ readonly value: SelectionRange; /** * Gets the popup state of the DateRangePicker. */ readonly show: boolean; protected readonly min: Date; protected readonly max: Date; /** * @hidden */ componentDidMount(): void; /** * @hidden */ componentDidUpdate(): void; /** * @hidden */ componentWillUnmount(): void; /** * @hidden */ render(): any; protected setStartDateInputRef: (dateInput: any) => void; protected setEndDateInputRef: (dateInput: any) => void; protected setCalendarRef: (calendar: any) => void; protected focusCalendarElement: () => void; protected focusDateInputElement(): void; protected calculateValue: (props: DateRangePickerProps, state: DateRangePickerState) => SelectionRange; protected calculateShow: (nextProps: DateRangePickerProps, nextState: DateRangePickerState) => boolean; protected nextTick(f: () => any): void; protected setShow(show: boolean): void; private handleReverseClick; private handleReverseMouseDown; private handleFocus; private handleBlur; private handleEndChange; private handleStartChange; private extractRangeFromValue; private handleCalendarChange; private handleKeyDown; private handleChange; }