UNPKG

@progress/kendo-react-dateinputs

Version:
147 lines (146 loc) • 5.41 kB
import * as React from 'react'; import * as PropTypes from 'prop-types'; import { Action, SelectionRange, CalendarViewEnum, SelectionRangeEnd, MultiViewCalendarSettings } from '../models'; /** * The arguments for the `onChange` event of the MultiViewCalendar. * The generic argument sets the target type of the event. Defaults to `MultiViewCalendar`. */ export interface MultiViewCalendarChangeEvent<T = MultiViewCalendar> { syntheticEvent: React.SyntheticEvent<any>; nativeEvent?: any; value: Date | Date[] | SelectionRange | null; target: T; } /** * Represents the props of the [KendoReact MultiViewCalendar component]({% slug overview_multiviewcalendar %}). The generic argument is passed to the `onChange` property and is used as a target in the [`MultiViewCalendarChangeEvent`]({% slug api_dateinputs_multiviewcalendarchangeevent %}) interface. */ export interface MultiViewCalendarProps<T = MultiViewCalendar> extends MultiViewCalendarSettings { /** * Sets the default value of the MultiViewCalendar. */ defaultValue?: Date | Date[] | SelectionRange | null; /** * An event that is called after the value of the MultiViewCalendar has changed. The new value is generated based on the current `mode` of the MultiViewCalendar. */ onChange?: (event: MultiViewCalendarChangeEvent<T>) => void; /** * Sets the value of the MultiViewCalendar. Based on the value type, the MultiViewcalendar renders a single, multiple, or range selection. */ value?: Date | Date[] | SelectionRange | null; } /** * @hidden */ export interface MultiViewCalendarState { value: Date | Date[] | SelectionRange | null; activeView: CalendarViewEnum; focusedDate: Date; } export declare class MultiViewCalendar extends React.Component<MultiViewCalendarProps, MultiViewCalendarState> { /** * @hidden */ static propTypes: { activeRangeEnd: PropTypes.Requireable<any>; allowReverse: PropTypes.Requireable<any>; bottomView: PropTypes.Requireable<any>; className: PropTypes.Requireable<any>; defaultActiveView: PropTypes.Requireable<any>; defaultValue: PropTypes.Requireable<any>; disabled: PropTypes.Requireable<any>; focusedDate: PropTypes.Requireable<any>; id: PropTypes.Requireable<any>; max: PropTypes.Requireable<any>; min: PropTypes.Requireable<any>; mode: PropTypes.Requireable<any>; onBlur: PropTypes.Requireable<any>; onChange: PropTypes.Requireable<any>; onFocus: PropTypes.Requireable<any>; tabIndex: PropTypes.Requireable<any>; topView: PropTypes.Requireable<any>; value: PropTypes.Requireable<any>; views: (props: any, propName: any, componentName: any) => Error; weekNumber: PropTypes.Requireable<any>; }; /** * @hidden */ static defaultProps: { disabled: boolean; min: Date; max: Date; navigation: boolean; defaultActiveView: string; defaultValue: any; topView: string; tabIndex: number; bottomView: string; views: number; allowReverse: boolean; }; protected selectedDate: Date | null; protected selectedMultiple: Date[] | null; protected selectedRange: SelectionRange; protected _focusedDate: Date; protected cellUID: string; private valueDuringOnChange?; private activeRangeEnd; private _element; private bus; private navigation; private intl; private localization; private service; private wrapperID; private calendarViewList; private isActive; private calculateFocusFromValue; /** * Gets the wrapping element of the MultiViewCalendar component. */ readonly element: HTMLDivElement | null; /** * Gets the value of the MultiViewCalendar. */ readonly value: Date | Date[] | SelectionRange | null; /** * Gets the current focused date of the MultiViewCalendar. */ readonly focusedDate: Date; protected readonly min: Date; protected readonly max: Date; protected readonly bottomView: CalendarViewEnum; protected readonly topView: CalendarViewEnum; protected readonly activeRange: SelectionRangeEnd; constructor(props: MultiViewCalendarProps); /** * @hidden */ componentDidMount(): void; /** * @hidden */ componentDidUpdate(): void; /** * @hidden */ render(): JSX.Element; protected clampRange: (value: Date) => SelectionRange; protected rangeWithFocused: (range: SelectionRange, focusedDate: Date) => SelectionRange; protected generateRange: (candidate: Date, value: SelectionRange) => SelectionRange; protected canNavigate: (action: Action) => boolean; protected isListInRange: (list: Date[]) => boolean; protected navigate: (action: Action) => void; protected move: (action: Action) => Date; protected clampDate: (value: Date) => Date; protected shouldAutoCorrect: (candidate: Date, value: SelectionRange) => boolean; private handleCellEnter; private handleMouseDown; private handleClick; private handleFocus; private handleBlur; private handlePrevButtonClick; private handleNextButtonClick; private handleKeyDown; private handleViewChange; private handleDateChange; }