rsuite
Version:
A suite of react components
61 lines (60 loc) • 3.01 kB
TypeScript
import React from 'react';
import { FormControlBaseProps, PickerBaseProps } from '../@types/common';
import { PickerComponent, PickerToggleProps } from '../Picker';
import { DisabledDateFunction, RangeType, DateRange } from './types';
export interface DateRangePickerProps extends PickerBaseProps, FormControlBaseProps<DateRange | null>, Pick<PickerToggleProps, 'caretAs' | 'readOnly' | 'plaintext'> {
/** Configure shortcut options */
ranges?: RangeType[];
/** Format date */
format?: string;
/** The date range that will be selected when you click on the date */
hoverRange?: 'week' | 'month' | ((date: Date) => DateRange);
/** Whether to click once on selected date range,Can be used with hoverRange */
oneTap?: 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;
/** Show only one calendar select */
showOneCalendar?: boolean;
/** Meridian format */
showMeridian?: boolean;
/** Set default date for calendar */
defaultCalendarValue?: DateRange;
/** The character that separates two dates */
character?: string;
/** Disabled date */
disabledDate?: DisabledDateFunction;
/** Called when the option is selected */
onSelect?: (date: Date, event?: React.SyntheticEvent) => void;
/** Called after clicking the OK button */
onOk?: (date: DateRange, event: React.SyntheticEvent) => void;
/** Called when clean */
onClean?: (event: React.MouseEvent) => void;
/** Custom render value */
renderValue?: (value: DateRange, format: string) => React.ReactNode;
/** Custom render for calendar title */
renderTitle?: (date: Date) => React.ReactNode;
}
export interface DateRangePicker extends PickerComponent<DateRangePickerProps> {
/** Allow the maximum number of days specified, other dates are disabled */
allowedMaxDays?: (days: number) => DisabledDateFunction;
/** Only allowed days are specified, other dates are disabled */
allowedDays?: (days: number) => DisabledDateFunction;
/** Allow specified date range, other dates are disabled */
allowedRange?: (startDate: string | Date, endDate: string | Date) => DisabledDateFunction;
/** Disable dates after the specified date */
before?: (beforeDate: string | Date) => DisabledDateFunction;
/** Disable dates before the specified date */
after?: (afterDate: string | Date) => DisabledDateFunction;
/** Disable dates after today. */
beforeToday?: () => DisabledDateFunction;
/** Disable dates before today */
afterToday?: () => DisabledDateFunction;
/** Used to combine multiple conditions */
combine?: (...args: any) => DisabledDateFunction;
}
declare const DateRangePicker: DateRangePicker;
export default DateRangePicker;