Cascader.d.ts
2.7 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import * as React from 'react';
import { BuildInPlacements, TriggerProps } from 'rc-trigger';
export interface CascaderFieldNames {
value?: string | number;
label?: string;
children?: string;
}
export declare type CascaderValueType = (string | number)[];
export interface CascaderOption {
value?: string | number;
label?: React.ReactNode;
disabled?: boolean;
isLeaf?: boolean;
loading?: boolean;
children?: CascaderOption[];
[key: string]: any;
}
export interface CascaderProps extends Pick<TriggerProps, 'getPopupContainer'> {
value?: CascaderValueType;
defaultValue?: CascaderValueType;
options?: CascaderOption[];
onChange?: (value: CascaderValueType, selectOptions: CascaderOption[]) => void;
onPopupVisibleChange?: (popupVisible: boolean) => void;
popupVisible?: boolean;
disabled?: boolean;
transitionName?: string;
popupClassName?: string;
popupPlacement?: string;
prefixCls?: string;
dropdownMenuColumnStyle?: React.CSSProperties;
dropdownRender?: (menu: React.ReactElement) => React.ReactElement;
builtinPlacements?: BuildInPlacements;
loadData?: (selectOptions: CascaderOption[]) => void;
changeOnSelect?: boolean;
children?: React.ReactElement;
onKeyDown?: (e: React.KeyboardEvent<HTMLElement>) => void;
expandTrigger?: string;
fieldNames?: CascaderFieldNames;
filedNames?: CascaderFieldNames;
expandIcon?: React.ReactNode;
loadingIcon?: React.ReactNode;
}
interface CascaderState {
popupVisible?: boolean;
activeValue?: CascaderValueType;
value?: CascaderValueType;
prevProps?: CascaderProps;
}
declare class Cascader extends React.Component<CascaderProps, CascaderState> {
defaultFieldNames: object;
trigger: any;
constructor(props: CascaderProps);
static defaultProps: CascaderProps;
static getDerivedStateFromProps(nextProps: CascaderProps, prevState: CascaderState): CascaderState;
getPopupDOMNode(): any;
getFieldName(name: string): string;
getFieldNames(): CascaderFieldNames;
getCurrentLevelOptions(): CascaderOption[];
getActiveOptions(activeValue: CascaderValueType): CascaderOption[];
setPopupVisible: (popupVisible: boolean) => void;
handleChange: (options: CascaderOption[], { visible }: {
visible: any;
}, e: React.KeyboardEvent<HTMLElement>) => void;
handlePopupVisibleChange: (popupVisible: boolean) => void;
handleMenuSelect: (targetOption: CascaderOption, menuIndex: number, e: React.KeyboardEvent<HTMLElement>) => void;
handleItemDoubleClick: () => void;
handleKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;
saveTrigger: (node: any) => void;
render(): JSX.Element;
}
export default Cascader;