RangePicker.d.ts
3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import * as React from 'react';
import { DisabledTimes, PanelMode, RangeValue, EventValue } from './interface';
import { PickerBaseProps, PickerDateProps, PickerTimeProps, PickerRefConfig } from './Picker';
import { SharedTimeProps } from './panels/TimePanel';
export declare type RangeType = 'start' | 'end';
export interface RangeInfo {
range: RangeType;
}
export declare type RangeDateRender<DateType> = (currentDate: DateType, today: DateType, info: RangeInfo) => React.ReactNode;
export interface RangePickerSharedProps<DateType> {
id?: string;
value?: RangeValue<DateType>;
defaultValue?: RangeValue<DateType>;
defaultPickerValue?: [DateType, DateType];
placeholder?: [string, string];
disabled?: boolean | [boolean, boolean];
disabledTime?: (date: EventValue<DateType>, type: RangeType) => DisabledTimes;
ranges?: Record<string, Exclude<RangeValue<DateType>, null> | (() => Exclude<RangeValue<DateType>, null>)>;
separator?: React.ReactNode;
allowEmpty?: [boolean, boolean];
mode?: [PanelMode, PanelMode];
onChange?: (values: RangeValue<DateType>, formatString: [string, string]) => void;
onCalendarChange?: (values: RangeValue<DateType>, formatString: [string, string], info: RangeInfo) => void;
onPanelChange?: (values: RangeValue<DateType>, modes: [PanelMode, PanelMode]) => void;
onFocus?: React.FocusEventHandler<HTMLInputElement>;
onBlur?: React.FocusEventHandler<HTMLInputElement>;
onOk?: (dates: RangeValue<DateType>) => void;
direction?: 'ltr' | 'rtl';
autoComplete?: string;
/** @private Internal control of active picker. Do not use since it's private usage */
activePickerIndex?: 0 | 1;
dateRender?: RangeDateRender<DateType>;
panelRender?: (originPanel: React.ReactNode) => React.ReactNode;
}
declare type OmitPickerProps<Props> = Omit<Props, 'value' | 'defaultValue' | 'defaultPickerValue' | 'placeholder' | 'disabled' | 'disabledTime' | 'showToday' | 'showTime' | 'mode' | 'onChange' | 'onSelect' | 'onPanelChange' | 'pickerValue' | 'onPickerValueChange' | 'onOk' | 'dateRender'>;
declare type RangeShowTimeObject<DateType> = Omit<SharedTimeProps<DateType>, 'defaultValue'> & {
defaultValue?: DateType[];
};
export interface RangePickerBaseProps<DateType> extends RangePickerSharedProps<DateType>, OmitPickerProps<PickerBaseProps<DateType>> {
}
export interface RangePickerDateProps<DateType> extends RangePickerSharedProps<DateType>, OmitPickerProps<PickerDateProps<DateType>> {
showTime?: boolean | RangeShowTimeObject<DateType>;
}
export interface RangePickerTimeProps<DateType> extends RangePickerSharedProps<DateType>, OmitPickerProps<PickerTimeProps<DateType>> {
order?: boolean;
}
export declare type RangePickerProps<DateType> = RangePickerBaseProps<DateType> | RangePickerDateProps<DateType> | RangePickerTimeProps<DateType>;
declare class RangePicker<DateType> extends React.Component<RangePickerProps<DateType>> {
pickerRef: React.RefObject<PickerRefConfig>;
focus: () => void;
blur: () => void;
render(): JSX.Element;
}
export default RangePicker;