@progress/kendo-react-dateinputs
Version:
KendoReact Date Inputs package
139 lines (138 loc) • 4.14 kB
TypeScript
import * as React from 'react';
import * as PropTypes from 'prop-types';
import { CalendarViewEnum, CalendarSettings } from '../models';
import { DOMService, ScrollSyncService } from '../services';
/**
* The arguments for the `change` event of the Calendar. The generic argument sets the target type of the event. Defaults to `Calendar`.
*/
export interface CalendarChangeEvent<T = Calendar> {
/**
* A native DOM event.
*/
nativeEvent?: any;
/**
* A React Synthetic Event.
*/
syntheticEvent: React.SyntheticEvent<any>;
/**
* The new value.
*/
value: Date;
/**
* The Calendar element.
*/
target: T;
}
/**
* Represents the props of the [KendoReact Calendar component]({% slug overview_calendar %}). The generic argument is passed to the `onChange` property and is used as a target in the [`CalendarChangeEvent`]({% slug api_dateinputs_calendarchangeevent %}) interface.
*/
export interface CalendarProps<T = Calendar> extends CalendarSettings {
/**
* Sets the default value of the Calendar.
*/
defaultValue?: Date;
/**
* An event that is called after the value of the Calendar has changed.
*/
onChange?: (event: CalendarChangeEvent<T>) => void;
/**
* Sets the value of the Calendar.
*/
value?: Date | null;
}
/**
* @hidden
*/
export interface CalendarState {
value: Date | null;
activeView: CalendarViewEnum;
focusedDate: Date;
}
export declare class Calendar extends React.Component<CalendarProps, CalendarState> {
/**
* @hidden
*/
static propTypes: {
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>;
navigation: PropTypes.Requireable<any>;
smoothScroll: PropTypes.Requireable<any>;
onBlur: PropTypes.Requireable<any>;
onChange: PropTypes.Requireable<any>;
onFocus: PropTypes.Requireable<any>;
tabIndex: PropTypes.Requireable<any>;
value: PropTypes.Requireable<any>;
weekNumber: PropTypes.Requireable<any>;
topView: (props: CalendarProps<Calendar>, propName: string, componentName: string) => Error;
bottomView: (props: CalendarProps<Calendar>, propName: string, componentName: string) => Error;
};
/**
* @hidden
*/
static defaultProps: {
disabled: boolean;
min: Date;
max: Date;
navigation: boolean;
defaultActiveView: string;
defaultValue: any;
smoothScroll: boolean;
topView: string;
bottomView: string;
};
protected dom: DOMService;
protected scrollSyncService: ScrollSyncService;
private valueDuringOnChange?;
private focusedDate;
private cellUID;
private id;
private Navigation;
private calendarViewList;
private _element;
private intl;
private bus;
private service;
private navigation;
private isActive;
private oldValue;
/**
* Gets the wrapping element of the Calendar.
*/
readonly element: HTMLDivElement | null;
/**
* Gets the value of the Calendar.
*/
readonly value: Date | null;
protected readonly min: Date;
protected readonly max: Date;
protected readonly bottomView: CalendarViewEnum;
protected readonly topView: CalendarViewEnum;
constructor(props: CalendarProps);
/**
* @hidden
*/
componentDidMount(): void;
/**
* @hidden
*/
componentDidUpdate(_: CalendarProps, prevState: CalendarState): void;
/**
* @hidden
*/
render(): JSX.Element;
private handleScroll;
private handleNavigationChange;
private handleViewChange;
private handleDateChange;
private handleFocus;
private handleBlur;
private handleKeyDown;
private handleMouseDown;
private handleClick;
}