@progress/kendo-react-dateinputs
Version:
KendoReact Date Inputs package
172 lines (171 loc) • 5.42 kB
TypeScript
import * as React from 'react';
import * as PropTypes from 'prop-types';
import { FormComponent, FormComponentProps, FormComponentValidity } from '@progress/kendo-react-common';
import { DateInput } from '../dateinput/DateInput';
import { Calendar } from '../calendar/components/Calendar';
import { DatePickerSettings } from './models';
/**
* The arguments for the `onChange` event of the DatePicker.
*/
export interface DatePickerChangeEvent {
nativeEvent?: any;
syntheticEvent: React.SyntheticEvent<any>;
value: Date | null;
show: boolean;
target: DatePicker;
}
/**
* Represents the props of the [KendoReact DatePicker component]({% slug overview_datepicker %}).
*/
export interface DatePickerProps extends DatePickerSettings, FormComponentProps {
/**
* Sets the default value of the DatePicker ([see example]({% slug default_value_datepicker %})).
*/
defaultValue?: Date;
/**
* Fires each time the user selects a new value ([see example]({% slug controlled_datepicker %}#toc-controlling-the-date-value)).
*/
onChange?: (event: DatePickerChangeEvent) => void;
/**
* Specifies the value of the DatePicker ([see example]({% slug controlled_datepicker %}#toc-controlling-the-date-value)).
*
* > The `value` has to be a valid [JavaScript `Date`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date) instance.
*/
value?: Date | null;
}
/**
* @hidden
*/
export interface DatePickerState {
value: Date | null;
show: boolean;
}
export declare class DatePicker extends React.Component<DatePickerProps, DatePickerState> implements FormComponent {
/**
* @hidden
*/
static propTypes: {
className: PropTypes.Requireable<any>;
defaultShow: PropTypes.Requireable<any>;
defaultValue: PropTypes.Requireable<any>;
disabled: PropTypes.Requireable<any>;
focusedDate: PropTypes.Requireable<any>;
format: PropTypes.Requireable<any>;
formatPlaceholder: PropTypes.Requireable<any>;
id: PropTypes.Requireable<any>;
min: PropTypes.Requireable<any>;
max: PropTypes.Requireable<any>;
name: PropTypes.Requireable<any>;
popupSettings: PropTypes.Requireable<any>;
show: PropTypes.Requireable<any>;
tabIndex: PropTypes.Requireable<any>;
title: PropTypes.Requireable<any>;
value: PropTypes.Requireable<any>;
weekNumber: PropTypes.Requireable<any>;
width: PropTypes.Requireable<any>;
validationMessage: PropTypes.Requireable<any>;
required: PropTypes.Requireable<any>;
validate: PropTypes.Requireable<any>;
valid: PropTypes.Requireable<any>;
};
/**
* @hidden
*/
static defaultProps: {
defaultShow: boolean;
defaultValue: any;
disabled: boolean;
format: string;
max: Date;
min: Date;
popupSettings: {};
tabIndex: number;
title: string;
weekNumber: boolean;
required: boolean;
validityStyles: boolean;
};
/**
* @hidden
*/
readonly state: DatePickerState;
private _popupId;
private _element;
private _wrapper;
private _dateInput;
private _calendar;
private valueDuringOnChange?;
private showDuringOnChange?;
private nextTickId;
private shouldFocusDateInput;
constructor(props: DatePickerProps);
/**
* Gets the wrapping element of the DatePicker.
*/
readonly element: HTMLSpanElement | null;
/**
* Gets the DateInput component inside the DatePicker component.
*/
readonly dateInput: DateInput | null;
/**
* Gets the Calendar component inside the DatePicker component.
*/
readonly calendar: Calendar | null;
/**
* Gets the value of the DatePicker.
*/
readonly value: Date | null;
/**
* Gets the popup state of the DatePicker.
*/
readonly show: boolean;
/**
* Gets the `name` property of the DatePicker.
*/
readonly name: string | undefined;
protected readonly min: Date;
protected readonly max: Date;
/**
* Represents the validity state into which the DatePicker is set.
*/
readonly validity: FormComponentValidity;
/**
* @hidden
*/
protected readonly validityStyles: boolean;
/**
* @hidden
*/
protected readonly required: boolean;
/**
* @hidden
*/
componentDidMount(): void;
/**
* @hidden
*/
componentDidUpdate(prevProps: DatePickerProps): void;
/**
* @hidden
*/
componentWillUnmount(): void;
/**
* @hidden
*/
render(): any;
protected setDateInputRef: (dateInput: any) => void;
protected setCalendarRef: (calendar: any) => void;
protected nextValue: (nextProps: DatePickerProps, nextState: DatePickerState) => Date;
protected nextShow: (nextProps: DatePickerProps, nextState: DatePickerState) => boolean;
protected setShow(show: boolean): void;
protected mergeTime(value: Date | null): Date | null;
protected nextTick(f: () => any): void;
private handleInputValueChange;
private handleCalendarValueChange;
private handleValueChange;
private handleFocus;
private handleBlur;
private handleIconClick;
private handleIconMouseDown;
private handleKeyDown;
}