1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | import type { AlignType } from '@rc-component/trigger/lib/interface';
|
14 | import * as React from 'react';
|
15 | import type { CustomFormat, PresetDate } from './interface';
|
16 | import type { PickerPanelBaseProps, PickerPanelDateProps, PickerPanelTimeProps } from './PickerPanel';
|
17 | export type PickerRefConfig = {
|
18 | focus: () => void;
|
19 | blur: () => void;
|
20 | };
|
21 | export type PickerSharedProps<DateType> = {
|
22 | dropdownClassName?: string;
|
23 | dropdownAlign?: AlignType;
|
24 | popupStyle?: React.CSSProperties;
|
25 | transitionName?: string;
|
26 | placeholder?: string;
|
27 | allowClear?: boolean | {
|
28 | clearIcon?: React.ReactNode;
|
29 | };
|
30 | autoFocus?: boolean;
|
31 | disabled?: boolean;
|
32 | tabIndex?: number;
|
33 | open?: boolean;
|
34 | defaultOpen?: boolean;
|
35 |
|
36 | inputReadOnly?: boolean;
|
37 | id?: string;
|
38 | presets?: PresetDate<DateType>[];
|
39 | format?: string | CustomFormat<DateType> | (string | CustomFormat<DateType>)[];
|
40 | suffixIcon?: React.ReactNode;
|
41 | |
42 |
|
43 |
|
44 |
|
45 | clearIcon?: React.ReactNode;
|
46 | prevIcon?: React.ReactNode;
|
47 | nextIcon?: React.ReactNode;
|
48 | superPrevIcon?: React.ReactNode;
|
49 | superNextIcon?: React.ReactNode;
|
50 | getPopupContainer?: (node: HTMLElement) => HTMLElement;
|
51 | panelRender?: (originPanel: React.ReactNode) => React.ReactNode;
|
52 | inputRender?: (props: React.InputHTMLAttributes<HTMLInputElement>) => React.ReactNode;
|
53 | onChange?: (value: DateType | null, dateString: string) => void;
|
54 | onOpenChange?: (open: boolean) => void;
|
55 | onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
56 | onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
57 | onMouseDown?: React.MouseEventHandler<HTMLDivElement>;
|
58 | onMouseUp?: React.MouseEventHandler<HTMLDivElement>;
|
59 | onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
60 | onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
61 | onClick?: React.MouseEventHandler<HTMLDivElement>;
|
62 | onContextMenu?: React.MouseEventHandler<HTMLDivElement>;
|
63 | onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>, preventDefault: () => void) => void;
|
64 | |
65 |
|
66 |
|
67 |
|
68 | changeOnBlur?: boolean;
|
69 |
|
70 | pickerRef?: React.MutableRefObject<PickerRefConfig>;
|
71 | role?: string;
|
72 | name?: string;
|
73 | autoComplete?: string;
|
74 | direction?: 'ltr' | 'rtl';
|
75 | } & React.AriaAttributes;
|
76 | type OmitPanelProps<Props> = Omit<Props, 'onChange' | 'hideHeader' | 'pickerValue' | 'onPickerValueChange'>;
|
77 | export type PickerBaseProps<DateType> = {} & PickerSharedProps<DateType> & OmitPanelProps<PickerPanelBaseProps<DateType>>;
|
78 | export type PickerDateProps<DateType> = {} & PickerSharedProps<DateType> & OmitPanelProps<PickerPanelDateProps<DateType>>;
|
79 | export type PickerTimeProps<DateType> = {
|
80 | picker: 'time';
|
81 | |
82 |
|
83 |
|
84 |
|
85 | defaultOpenValue?: DateType;
|
86 | } & PickerSharedProps<DateType> & Omit<OmitPanelProps<PickerPanelTimeProps<DateType>>, 'format'>;
|
87 | export type PickerProps<DateType> = PickerBaseProps<DateType> | PickerDateProps<DateType> | PickerTimeProps<DateType>;
|
88 | declare class Picker<DateType> extends React.Component<PickerProps<DateType>> {
|
89 | pickerRef: React.RefObject<PickerRefConfig>;
|
90 | focus: () => void;
|
91 | blur: () => void;
|
92 | render(): React.JSX.Element;
|
93 | }
|
94 | export default Picker;
|