1 |
|
2 |
|
3 | import * as React from 'react';
|
4 | import CommonProps from '../util';
|
5 |
|
6 | interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
|
7 | defaultValue?: any;
|
8 | onChange?: any;
|
9 | }
|
10 |
|
11 | type data = {
|
12 | value?: string;
|
13 | label?: string;
|
14 | disabled?: boolean;
|
15 | checkboxDisabled?: boolean;
|
16 | children?: Array<data>;
|
17 | [propName: string]: any;
|
18 | };
|
19 |
|
20 | type extra = {
|
21 | |
22 |
|
23 |
|
24 | selectedPath?: Array<data>;
|
25 | |
26 |
|
27 |
|
28 | checked?: boolean;
|
29 | |
30 |
|
31 |
|
32 | currentData?: any;
|
33 | |
34 |
|
35 |
|
36 | checkedData?: Array<data>;
|
37 | |
38 |
|
39 |
|
40 | indeterminateData?: Array<data>;
|
41 | };
|
42 |
|
43 | export interface CascaderProps extends HTMLAttributesWeak, CommonProps {
|
44 | |
45 |
|
46 |
|
47 | dataSource?: Array<data>;
|
48 |
|
49 | |
50 |
|
51 |
|
52 | defaultValue?: string | Array<string>;
|
53 |
|
54 | |
55 |
|
56 |
|
57 | value?: string | Array<string>;
|
58 |
|
59 | |
60 |
|
61 |
|
62 | onChange?: (value: string | Array<string>, data: data | Array<data>, extra: extra) => void;
|
63 |
|
64 | |
65 |
|
66 |
|
67 | defaultExpandedValue?: Array<string>;
|
68 |
|
69 | |
70 |
|
71 |
|
72 | expandedValue?: Array<string>;
|
73 |
|
74 | |
75 |
|
76 |
|
77 | expandTriggerType?: 'click' | 'hover';
|
78 |
|
79 | |
80 |
|
81 |
|
82 | onExpand?: (expandedValue: Array<string>) => void;
|
83 |
|
84 | |
85 |
|
86 |
|
87 | useVirtual?: boolean;
|
88 |
|
89 | |
90 |
|
91 |
|
92 | multiple?: boolean;
|
93 |
|
94 | |
95 |
|
96 |
|
97 | canOnlySelectLeaf?: boolean;
|
98 |
|
99 | |
100 |
|
101 |
|
102 | canOnlyCheckLeaf?: boolean;
|
103 |
|
104 | |
105 |
|
106 |
|
107 | checkStrictly?: boolean;
|
108 |
|
109 | |
110 |
|
111 |
|
112 | listStyle?: React.CSSProperties;
|
113 |
|
114 | |
115 |
|
116 |
|
117 | listClassName?: string;
|
118 |
|
119 | |
120 |
|
121 |
|
122 | itemRender?: (data: data) => React.ReactNode;
|
123 |
|
124 | |
125 |
|
126 |
|
127 | loadData?: (data: data, source: data) => void;
|
128 |
|
129 | |
130 |
|
131 |
|
132 | immutable?: boolean;
|
133 | }
|
134 |
|
135 | export default class Cascader extends React.Component<CascaderProps, any> {}
|