@progress/kendo-react-dateinputs
Version:
KendoReact Date Inputs package
167 lines (166 loc) • 5.21 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 { DateTimePickerSettings } from './models';
/**
* The arguments for the `onChange` event of the DateTimePicker.
*/
export interface DateTimePickerChangeEvent {
nativeEvent: any;
syntheticEvent: React.SyntheticEvent<any>;
value: Date | null;
show: boolean;
target: DateTimePicker;
}
/**
* Represents the props of the [KendoReact DateTimePicker component]({% slug overview_datetimepicker %}).
*/
export interface DateTimePickerProps extends DateTimePickerSettings, FormComponentProps {
/**
* Sets the default value of the DateTimePicker
* ([see example]({% slug default_value_datetimepicker %})).
* For more info about default values in uncontrolled state, please refer to the [Uncontrolled Components](https://reactjs.org/docs/uncontrolled-components.html) article.
*/
defaultValue?: Date;
/**
* Fires each time the user selects a new value
* ([see example]({% slug controlled_datetimepicker %}#toc-controlling-the-date-value)).
*/
onChange?: (event: DateTimePickerChangeEvent) => void;
/**
* Specifies the value of the DateTimePicker
* ([see example]({% slug controlled_datetimepicker %}#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 DateTimePickerState {
value: Date | null;
show: boolean;
}
export declare class DateTimePicker extends React.Component<DateTimePickerProps, DateTimePickerState> 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>;
cancelButton: 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;
cancelButton: boolean;
};
/**
* @hidden
*/
readonly state: DateTimePickerState;
private _popupId;
private _element;
private _wrapper;
private _dateInput;
private _dateTimeSelector;
private valueDuringOnChange?;
private showDuringOnChange?;
private nextTickId;
private shouldFocusDateInput;
constructor(props: DateTimePickerProps);
/**
* Gets the wrapping element of the DateTimePicker.
*/
readonly element: HTMLSpanElement | null;
/**
* Gets the DateInput component inside the DateTimePicker component.
*/
readonly dateInput: DateInput | null;
/**
* Gets the value of the DateTimePicker.
*/
readonly value: Date | null;
/**
* Gets the popup state of the DateTimePicker.
*/
readonly show: boolean;
/**
* Gets the `name` property of the DateTimePicker.
*/
readonly name: string | undefined;
protected readonly min: Date;
protected readonly max: Date;
/**
* Represents the validity state into which the DateTimePicker is set.
*/
readonly validity: FormComponentValidity;
/**
* @hidden
*/
protected readonly validityStyles: boolean;
/**
* @hidden
*/
protected readonly required: boolean;
/**
* @hidden
*/
componentDidMount(): void;
/**
* @hidden
*/
componentDidUpdate(prevProps: DateTimePickerProps): void;
/**
* @hidden
*/
componentWillUnmount(): void;
/**
* @hidden
*/
render(): any;
protected setShow(show: boolean): void;
protected nextTick(f: () => any): void;
private handleValueChange;
private handleFocus;
private handleBlur;
private handleDateIconClick;
private handleIconMouseDown;
private handleKeyDown;
}