UNPKG

@progress/kendo-react-dateinputs

Version:
176 lines (175 loc) • 5.62 kB
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 { TimeSelector } from './TimeSelector'; import { TimePickerSettings } from './models'; /** * The arguments for the `onChange` event of the TimePicker. */ export interface TimePickerChangeEvent { nativeEvent?: any; syntheticEvent: React.SyntheticEvent<any>; value: Date | null; show: boolean; target: TimePicker; } /** * Represents the props of the [KendoReact TimePicker component]({% slug overview_timepicker %}). */ export interface TimePickerProps extends TimePickerSettings, FormComponentProps { /** * Sets the default value of the TimePicker ([see example]({% slug default_value_timepicker %}#toc-setting-the-default-value)). */ defaultValue?: Date; /** * Fires each time the user selects a new value ([see example]({% slug controlled_timepicker %}#toc-controlling-the-date-value)). */ onChange?: (event: TimePickerChangeEvent) => void; /** * Specifies the value of the TimePicker ([see example]({% slug controlled_timepicker %}#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 TimePickerState { value: Date | null; show: boolean; } export declare class TimePicker extends React.Component<TimePickerProps, TimePickerState> implements FormComponent { /** * @hidden */ static propTypes: { className: PropTypes.Requireable<any>; cancelButton: PropTypes.Requireable<any>; nowButton: PropTypes.Requireable<any>; defaultShow: PropTypes.Requireable<any>; defaultValue: PropTypes.Requireable<any>; disabled: 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>; steps: PropTypes.Requireable<any>; smoothScroll: PropTypes.Requireable<any>; tabIndex: PropTypes.Requireable<any>; title: PropTypes.Requireable<any>; value: 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: {}; title: string; tabIndex: number; steps: {}; required: boolean; validityStyles: boolean; }; /** * @hidden */ readonly state: TimePickerState; private _popupId; private _element; private _wrapper; private _dateInput; private _timeSelector; private valueDuringOnChange?; private showDuringOnChange?; private nextTickId; private shouldFocusDateInput; constructor(props: TimePickerProps); /** * Gets the wrapping element of the TimePicker. */ readonly element: HTMLSpanElement | null; /** * Gets the DateInput component inside the TimePicker component. */ readonly dateInput: DateInput | null; /** * Gets the TimeSelector component inside the TimePicker component. */ readonly timeSelector: TimeSelector | null; /** * Gets the value of the TimePicker. */ readonly value: Date | null; /** * Gets the popup state of the TimeSelector. */ readonly show: boolean; /** * Gets the `name` property of the TimePicker. */ readonly name: string | undefined; /** * Represents the validity state into which the TimePicker is set. */ readonly validity: FormComponentValidity; /** * @hidden */ protected readonly validityStyles: boolean; /** * @hidden */ protected readonly required: boolean; private readonly popupSettings; private readonly min; private readonly max; /** * @hidden */ componentDidMount(): void; /** * @hidden */ componentWillUnmount(): void; /** * @hidden */ componentDidUpdate(prevProps: TimePickerProps): void; /** * @hidden */ render(): JSX.Element; protected setDateInputRef: (dateInput: any) => void; protected setTimeSelectorRef: (timeSelector: any) => void; protected nextValue: (nextProps: TimePickerProps, nextState: TimePickerState) => Date; protected nextShow: (nextProps: TimePickerProps, nextState: TimePickerState) => boolean; protected normalizeTime(date: Date): Date; protected setShow(show: boolean): void; protected nextTick(f: () => any): void; protected mergeTime(value: Date | null): Date | null; private handleInputValueChange; private handleValueChange; private handleFocus; private handleBlur; private handleValueReject; private handleIconClick; private handleIconMouseDown; private handleKeyDown; }