1 |
|
2 |
|
3 | import * as React from 'react';
|
4 | import CommonProps from '../util';
|
5 | import { PopupProps } from '../overlay';
|
6 | import { ButtonProps } from '../button';
|
7 |
|
8 | interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
|
9 | defaultValue?: any;
|
10 | onChange?: any;
|
11 | }
|
12 |
|
13 | type item = {
|
14 | value?: string | number;
|
15 | label?: React.ReactNode;
|
16 | [propName: string]: any;
|
17 | }
|
18 |
|
19 | export interface SearchProps extends HTMLAttributesWeak, CommonProps {
|
20 | |
21 |
|
22 |
|
23 | size?: 'large' | 'medium';
|
24 |
|
25 | |
26 |
|
27 |
|
28 | value?: string | number;
|
29 |
|
30 | |
31 |
|
32 |
|
33 | defaultValue?: string;
|
34 |
|
35 | |
36 |
|
37 |
|
38 | placeholder?: string;
|
39 |
|
40 | |
41 |
|
42 |
|
43 | autoWidth?: boolean;
|
44 |
|
45 | |
46 |
|
47 |
|
48 | label?: React.ReactNode;
|
49 |
|
50 | |
51 |
|
52 |
|
53 | hasClear?: boolean;
|
54 |
|
55 | |
56 |
|
57 |
|
58 | state?: 'error' | 'loading';
|
59 |
|
60 | |
61 |
|
62 |
|
63 | readOnly?: boolean;
|
64 |
|
65 | |
66 |
|
67 |
|
68 | disabled?: boolean;
|
69 |
|
70 | |
71 |
|
72 |
|
73 | visible?: boolean;
|
74 |
|
75 | |
76 |
|
77 |
|
78 | defaultVisible?: boolean;
|
79 |
|
80 | |
81 |
|
82 |
|
83 | onVisibleChange?: (visible: boolean) => void;
|
84 |
|
85 | |
86 |
|
87 |
|
88 | popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement);
|
89 |
|
90 | /**
|
91 | * 弹层的 className
|
92 | */
|
93 | popupClassName?: string;
|
94 |
|
95 | /**
|
96 | * 弹层的内联样式
|
97 | */
|
98 | popupStyle?: React.CSSProperties;
|
99 |
|
100 | /**
|
101 | * 添加到弹层上的属性
|
102 | */
|
103 | popupProps?: PopupProps;
|
104 |
|
105 | /**
|
106 | * 自定义渲染的的下拉框
|
107 | */
|
108 | popupContent?: React.ReactNode;
|
109 |
|
110 | /**
|
111 | * 是否使用本地过滤,在数据源为远程的时候需要关闭此项
|
112 | */
|
113 | filterLocal?: boolean;
|
114 |
|
115 | /**
|
116 | * 选择器
|
117 | */
|
118 | filter?: Array<any>;
|
119 |
|
120 | /**
|
121 | * 键盘上下键切换菜单高亮选项的回调
|
122 | */
|
123 | onToggleHighlightItem?: () => void;
|
124 |
|
125 | |
126 |
|
127 |
|
128 | useVirtual?: boolean;
|
129 |
|
130 | |
131 |
|
132 |
|
133 | dataSource?: Array<any>;
|
134 |
|
135 | |
136 |
|
137 |
|
138 | itemRender?: (item: item) => React.ReactNode;
|
139 |
|
140 | |
141 |
|
142 |
|
143 | onChange?: (value: any, actionType: string, item: any) => void;
|
144 |
|
145 | |
146 |
|
147 |
|
148 | fillProps?: string;
|
149 |
|
150 | |
151 |
|
152 |
|
153 | prefix?: string;
|
154 |
|
155 | |
156 |
|
157 |
|
158 | shape?: 'normal' | 'simple';
|
159 |
|
160 | |
161 |
|
162 |
|
163 | type?: 'primary' | 'secondary' | 'normal' | 'dark';
|
164 |
|
165 | |
166 |
|
167 |
|
168 | onSearch?: (value: string, filterValue?: any) => void;
|
169 |
|
170 | |
171 |
|
172 |
|
173 | defaultFilterValue?: string;
|
174 |
|
175 | |
176 |
|
177 |
|
178 | filterValue?: string;
|
179 |
|
180 | |
181 |
|
182 |
|
183 | onFilterChange?: (filter: {}) => void;
|
184 |
|
185 | |
186 |
|
187 |
|
188 | searchText?: React.ReactNode;
|
189 |
|
190 | |
191 |
|
192 |
|
193 | style?: React.CSSProperties;
|
194 |
|
195 | |
196 |
|
197 |
|
198 | className?: string;
|
199 |
|
200 | |
201 |
|
202 |
|
203 | filterProps?: any;
|
204 |
|
205 | |
206 |
|
207 |
|
208 | buttonProps?: ButtonProps;
|
209 |
|
210 | |
211 |
|
212 |
|
213 | hasIcon?: boolean;
|
214 | icons?: {
|
215 | search?: React.ReactNode;
|
216 | };
|
217 | }
|
218 |
|
219 | export default class Search extends React.Component<SearchProps, any> {}
|