rsuite
Version:
A suite of react components
85 lines (57 loc) • 2.47 kB
TypeScript
import * as React from 'react';
import { PickerBaseProps, FormControlBaseProps } from '../@types/common';
export interface RangeType {
label: React.ReactNode;
closeOverlay?: boolean;
value: Date | ((pageDate?: Date) => Date);
}
export interface DatePickerProps extends PickerBaseProps, FormControlBaseProps<Date> {
/** Configure shortcut options */
ranges?: RangeType[];
/** Calendar panel default presentation date and time */
calendarDefaultDate?: Date;
/** Format date */
format?: string;
/** Display date panel when component initial */
inline?: boolean;
/** ISO 8601 standard, each calendar week begins on Monday and Sunday on the seventh day */
isoWeek?: boolean;
/** Set the lower limit of the available year relative to the current selection date */
limitEndYear?: number;
/** Whether to show week numbers */
showWeekNumbers?: boolean;
/** Disabled date */
disabledDate?: (date?: Date) => boolean;
/** Disabled hours */
disabledHours?: (hour: number, date: Date) => boolean;
/** Disabled minutes */
disabledMinutes?: (minute: number, date: Date) => boolean;
/** Disabled seconds */
disabledSeconds?: (second: number, date: Date) => boolean;
/** Hidden hours */
hideHours?: (hour: number, date: Date) => boolean;
/** Hidden minutes */
hideMinutes?: (minute: number, date: Date) => boolean;
/** Hidden seconds */
hideSeconds?: (second: number, date: Date) => boolean;
/** Called when the calendar panel date changes */
onChangeCalendarDate?: (date: Date, event?: React.SyntheticEvent<HTMLElement>) => void;
/** Called when opening the month view */
onToggleMonthDropdown?: (toggle: boolean) => void;
/** Called when opening the time view */
onToggleTimeDropdown?: (toggle: boolean) => void;
/** Called when the option is selected */
onSelect?: (date: Date, event?: React.SyntheticEvent<HTMLElement>) => void;
/** Called after the prev month */
onPrevMonth?: (date: Date) => void;
/** Called after the next month */
onNextMonth?: (date: Date) => void;
/** Called after clicking the OK button */
onOk?: (date: Date, event: React.SyntheticEvent<HTMLElement>) => void;
/** Called when clean */
onClean?: (event: React.SyntheticEvent<HTMLElement>) => void;
/** Custom render value */
renderValue?: (value: Date, format: string) => React.ReactNode;
}
declare const DatePicker: React.ComponentType<DatePickerProps>;
export default DatePicker;