@rc-component/select 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +9 -0
- package/README.md +191 -0
- package/assets/index.css +306 -0
- package/assets/index.less +397 -0
- package/es/BaseSelect/Polite.d.ts +7 -0
- package/es/BaseSelect/Polite.js +26 -0
- package/es/BaseSelect/index.d.ts +118 -0
- package/es/BaseSelect/index.js +569 -0
- package/es/OptGroup.d.ts +12 -0
- package/es/OptGroup.js +6 -0
- package/es/Option.d.ts +14 -0
- package/es/Option.js +6 -0
- package/es/OptionList.d.ts +10 -0
- package/es/OptionList.js +379 -0
- package/es/Select.d.ts +114 -0
- package/es/Select.js +480 -0
- package/es/SelectContext.d.ts +23 -0
- package/es/SelectContext.js +6 -0
- package/es/SelectTrigger.d.ts +30 -0
- package/es/SelectTrigger.js +138 -0
- package/es/Selector/Input.d.ts +27 -0
- package/es/Selector/Input.js +114 -0
- package/es/Selector/MultipleSelector.d.ts +16 -0
- package/es/Selector/MultipleSelector.js +185 -0
- package/es/Selector/SingleSelector.d.ts +8 -0
- package/es/Selector/SingleSelector.js +104 -0
- package/es/Selector/index.d.ts +85 -0
- package/es/Selector/index.js +184 -0
- package/es/TransBtn.d.ts +12 -0
- package/es/TransBtn.js +30 -0
- package/es/hooks/useAllowClear.d.ts +8 -0
- package/es/hooks/useAllowClear.js +26 -0
- package/es/hooks/useBaseProps.d.ts +13 -0
- package/es/hooks/useBaseProps.js +10 -0
- package/es/hooks/useCache.d.ts +7 -0
- package/es/hooks/useCache.js +40 -0
- package/es/hooks/useDelayReset.d.ts +5 -0
- package/es/hooks/useDelayReset.js +24 -0
- package/es/hooks/useFilterOptions.d.ts +3 -0
- package/es/hooks/useFilterOptions.js +57 -0
- package/es/hooks/useId.d.ts +5 -0
- package/es/hooks/useId.js +29 -0
- package/es/hooks/useLayoutEffect.d.ts +5 -0
- package/es/hooks/useLayoutEffect.js +17 -0
- package/es/hooks/useLock.d.ts +7 -0
- package/es/hooks/useLock.js +27 -0
- package/es/hooks/useOptions.d.ts +12 -0
- package/es/hooks/useOptions.js +45 -0
- package/es/hooks/useRefFunc.d.ts +5 -0
- package/es/hooks/useRefFunc.js +14 -0
- package/es/hooks/useSelectTriggerControl.d.ts +1 -0
- package/es/hooks/useSelectTriggerControl.js +27 -0
- package/es/index.d.ts +10 -0
- package/es/index.js +7 -0
- package/es/interface.d.ts +23 -0
- package/es/interface.js +1 -0
- package/es/utils/__mocks__/platformUtil.d.ts +1 -0
- package/es/utils/__mocks__/platformUtil.js +3 -0
- package/es/utils/commonUtil.d.ts +9 -0
- package/es/utils/commonUtil.js +32 -0
- package/es/utils/keyUtil.d.ts +2 -0
- package/es/utils/keyUtil.js +16 -0
- package/es/utils/legacyUtil.d.ts +3 -0
- package/es/utils/legacyUtil.js +44 -0
- package/es/utils/platformUtil.d.ts +1 -0
- package/es/utils/platformUtil.js +4 -0
- package/es/utils/valueUtil.d.ts +24 -0
- package/es/utils/valueUtil.js +128 -0
- package/es/utils/warningPropsUtil.d.ts +4 -0
- package/es/utils/warningPropsUtil.js +119 -0
- package/lib/BaseSelect/Polite.d.ts +7 -0
- package/lib/BaseSelect/Polite.js +34 -0
- package/lib/BaseSelect/index.d.ts +118 -0
- package/lib/BaseSelect/index.js +579 -0
- package/lib/OptGroup.d.ts +12 -0
- package/lib/OptGroup.js +12 -0
- package/lib/Option.d.ts +14 -0
- package/lib/Option.js +12 -0
- package/lib/OptionList.d.ts +10 -0
- package/lib/OptionList.js +387 -0
- package/lib/Select.d.ts +114 -0
- package/lib/Select.js +487 -0
- package/lib/SelectContext.d.ts +23 -0
- package/lib/SelectContext.js +13 -0
- package/lib/SelectTrigger.d.ts +30 -0
- package/lib/SelectTrigger.js +147 -0
- package/lib/Selector/Input.d.ts +27 -0
- package/lib/Selector/Input.js +123 -0
- package/lib/Selector/MultipleSelector.d.ts +16 -0
- package/lib/Selector/MultipleSelector.js +194 -0
- package/lib/Selector/SingleSelector.d.ts +8 -0
- package/lib/Selector/SingleSelector.js +113 -0
- package/lib/Selector/index.d.ts +85 -0
- package/lib/Selector/index.js +191 -0
- package/lib/TransBtn.d.ts +12 -0
- package/lib/TransBtn.js +39 -0
- package/lib/hooks/useAllowClear.d.ts +8 -0
- package/lib/hooks/useAllowClear.js +34 -0
- package/lib/hooks/useBaseProps.d.ts +13 -0
- package/lib/hooks/useBaseProps.js +19 -0
- package/lib/hooks/useCache.d.ts +7 -0
- package/lib/hooks/useCache.js +49 -0
- package/lib/hooks/useDelayReset.d.ts +5 -0
- package/lib/hooks/useDelayReset.js +31 -0
- package/lib/hooks/useFilterOptions.d.ts +3 -0
- package/lib/hooks/useFilterOptions.js +66 -0
- package/lib/hooks/useId.d.ts +5 -0
- package/lib/hooks/useId.js +40 -0
- package/lib/hooks/useLayoutEffect.d.ts +5 -0
- package/lib/hooks/useLayoutEffect.js +25 -0
- package/lib/hooks/useLock.d.ts +7 -0
- package/lib/hooks/useLock.js +34 -0
- package/lib/hooks/useOptions.d.ts +12 -0
- package/lib/hooks/useOptions.js +52 -0
- package/lib/hooks/useRefFunc.d.ts +5 -0
- package/lib/hooks/useRefFunc.js +21 -0
- package/lib/hooks/useSelectTriggerControl.d.ts +1 -0
- package/lib/hooks/useSelectTriggerControl.js +35 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +37 -0
- package/lib/interface.d.ts +23 -0
- package/lib/interface.js +5 -0
- package/lib/utils/__mocks__/platformUtil.d.ts +1 -0
- package/lib/utils/__mocks__/platformUtil.js +9 -0
- package/lib/utils/commonUtil.d.ts +9 -0
- package/lib/utils/commonUtil.js +42 -0
- package/lib/utils/keyUtil.d.ts +2 -0
- package/lib/utils/keyUtil.js +22 -0
- package/lib/utils/legacyUtil.d.ts +3 -0
- package/lib/utils/legacyUtil.js +53 -0
- package/lib/utils/platformUtil.d.ts +1 -0
- package/lib/utils/platformUtil.js +10 -0
- package/lib/utils/valueUtil.d.ts +24 -0
- package/lib/utils/valueUtil.js +140 -0
- package/lib/utils/warningPropsUtil.d.ts +4 -0
- package/lib/utils/warningPropsUtil.js +129 -0
- package/package.json +86 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
@select-prefix: ~'rc-select';
|
|
2
|
+
|
|
3
|
+
* {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.search-input-without-border() {
|
|
8
|
+
.@{select-prefix}-selection-search-input {
|
|
9
|
+
border: none;
|
|
10
|
+
outline: none;
|
|
11
|
+
background: rgba(255, 0, 0, 0.2);
|
|
12
|
+
width: 100%;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.@{select-prefix} {
|
|
17
|
+
display: inline-block;
|
|
18
|
+
font-size: 12px;
|
|
19
|
+
width: 100px;
|
|
20
|
+
position: relative;
|
|
21
|
+
|
|
22
|
+
&-disabled {
|
|
23
|
+
&,
|
|
24
|
+
& input {
|
|
25
|
+
cursor: not-allowed;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.@{select-prefix}-selector {
|
|
29
|
+
opacity: 0.3;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&-show-arrow&-loading {
|
|
34
|
+
.@{select-prefix}-arrow {
|
|
35
|
+
&-icon::after {
|
|
36
|
+
box-sizing: border-box;
|
|
37
|
+
width: 12px;
|
|
38
|
+
height: 12px;
|
|
39
|
+
border-radius: 100%;
|
|
40
|
+
border: 2px solid #999;
|
|
41
|
+
border-top-color: transparent;
|
|
42
|
+
border-bottom-color: transparent;
|
|
43
|
+
transform: none;
|
|
44
|
+
margin-top: 4px;
|
|
45
|
+
|
|
46
|
+
animation: rcSelectLoadingIcon 0.5s infinite;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ============== Selector ===============
|
|
52
|
+
.@{select-prefix}-selection-placeholder {
|
|
53
|
+
opacity: 0.4;
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ============== Search ===============
|
|
58
|
+
.@{select-prefix}-selection-search-input {
|
|
59
|
+
appearance: none;
|
|
60
|
+
|
|
61
|
+
&::-webkit-search-cancel-button {
|
|
62
|
+
display: none;
|
|
63
|
+
appearance: none;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// --------------- Single ----------------
|
|
68
|
+
&-single {
|
|
69
|
+
.@{select-prefix}-selector {
|
|
70
|
+
display: flex;
|
|
71
|
+
position: relative;
|
|
72
|
+
|
|
73
|
+
.@{select-prefix}-selection-wrap {
|
|
74
|
+
width: 100%;
|
|
75
|
+
position: relative;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.@{select-prefix}-selection-search {
|
|
79
|
+
width: 100%;
|
|
80
|
+
position: relative;
|
|
81
|
+
|
|
82
|
+
&-input {
|
|
83
|
+
width: 100%;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.@{select-prefix}-selection-item,
|
|
88
|
+
.@{select-prefix}-selection-placeholder {
|
|
89
|
+
position: absolute;
|
|
90
|
+
top: 1px;
|
|
91
|
+
left: 3px;
|
|
92
|
+
pointer-events: none;
|
|
93
|
+
font-weight: normal;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Not customize
|
|
98
|
+
&:not(.@{select-prefix}-customize-input) {
|
|
99
|
+
.@{select-prefix}-selector {
|
|
100
|
+
padding: 1px;
|
|
101
|
+
border: 1px solid #000;
|
|
102
|
+
|
|
103
|
+
.search-input-without-border();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// -------------- Multiple ---------------
|
|
109
|
+
&-multiple .@{select-prefix}-selector {
|
|
110
|
+
display: flex;
|
|
111
|
+
padding: 1px;
|
|
112
|
+
border: 1px solid #000;
|
|
113
|
+
|
|
114
|
+
.@{select-prefix}-selection-item {
|
|
115
|
+
flex: none;
|
|
116
|
+
background: #bbb;
|
|
117
|
+
border-radius: 4px;
|
|
118
|
+
margin-right: 2px;
|
|
119
|
+
padding: 0 8px;
|
|
120
|
+
|
|
121
|
+
&-disabled {
|
|
122
|
+
cursor: not-allowed;
|
|
123
|
+
opacity: 0.5;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.@{select-prefix}-selection-overflow {
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-wrap: wrap;
|
|
130
|
+
|
|
131
|
+
&-item {
|
|
132
|
+
flex: none;
|
|
133
|
+
max-width: 100%;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.@{select-prefix}-selection-search {
|
|
138
|
+
position: relative;
|
|
139
|
+
max-width: 100%;
|
|
140
|
+
|
|
141
|
+
&-input,
|
|
142
|
+
&-mirror {
|
|
143
|
+
padding: 1px;
|
|
144
|
+
font-family: system-ui;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&-mirror {
|
|
148
|
+
position: absolute;
|
|
149
|
+
z-index: 999;
|
|
150
|
+
white-space: nowrap;
|
|
151
|
+
position: none;
|
|
152
|
+
left: 0;
|
|
153
|
+
top: 0;
|
|
154
|
+
visibility: hidden;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.search-input-without-border();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// ================ Icons ================
|
|
162
|
+
&-allow-clear {
|
|
163
|
+
&.@{select-prefix}-multiple .@{select-prefix}-selector {
|
|
164
|
+
padding-right: 20px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.@{select-prefix}-clear {
|
|
168
|
+
position: absolute;
|
|
169
|
+
right: 20px;
|
|
170
|
+
top: 0;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&-show-arrow {
|
|
175
|
+
&.@{select-prefix}-multiple .@{select-prefix}-selector {
|
|
176
|
+
padding-right: 20px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.@{select-prefix}-arrow {
|
|
180
|
+
pointer-events: none;
|
|
181
|
+
position: absolute;
|
|
182
|
+
right: 5px;
|
|
183
|
+
top: 0;
|
|
184
|
+
|
|
185
|
+
&-icon::after {
|
|
186
|
+
content: '';
|
|
187
|
+
border: 5px solid transparent;
|
|
188
|
+
width: 0;
|
|
189
|
+
height: 0;
|
|
190
|
+
display: inline-block;
|
|
191
|
+
border-top-color: #999;
|
|
192
|
+
transform: translateY(5px);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// =============== Focused ===============
|
|
198
|
+
&-focused {
|
|
199
|
+
.@{select-prefix}-selector {
|
|
200
|
+
border-color: blue !important;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ============== Dropdown ===============
|
|
205
|
+
&-dropdown {
|
|
206
|
+
border: 1px solid green;
|
|
207
|
+
min-height: 100px;
|
|
208
|
+
position: absolute;
|
|
209
|
+
background: #fff;
|
|
210
|
+
|
|
211
|
+
&-hidden {
|
|
212
|
+
display: none;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// =============== Option ================
|
|
217
|
+
&-item {
|
|
218
|
+
font-size: 16px;
|
|
219
|
+
line-height: 1.5;
|
|
220
|
+
padding: 4px 16px;
|
|
221
|
+
|
|
222
|
+
// >>> Group
|
|
223
|
+
&-group {
|
|
224
|
+
color: #999;
|
|
225
|
+
font-weight: bold;
|
|
226
|
+
font-size: 80%;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// >>> Option
|
|
230
|
+
&-option {
|
|
231
|
+
position: relative;
|
|
232
|
+
|
|
233
|
+
&-grouped {
|
|
234
|
+
padding-left: 24px;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.@{select-prefix}-item-option-state {
|
|
238
|
+
position: absolute;
|
|
239
|
+
right: 0;
|
|
240
|
+
top: 4px;
|
|
241
|
+
pointer-events: none;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// ------- Active -------
|
|
245
|
+
&-active {
|
|
246
|
+
background: #ddd;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// ------ Disabled ------
|
|
250
|
+
&-disabled {
|
|
251
|
+
color: #999;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// >>> Empty
|
|
256
|
+
&-empty {
|
|
257
|
+
text-align: center;
|
|
258
|
+
color: #999;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.@{select-prefix}-selection__choice-zoom {
|
|
264
|
+
transition: all 0.3s;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.@{select-prefix}-selection__choice-zoom-appear {
|
|
268
|
+
opacity: 0;
|
|
269
|
+
transform: scale(0.5);
|
|
270
|
+
|
|
271
|
+
&&-active {
|
|
272
|
+
opacity: 1;
|
|
273
|
+
transform: scale(1);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
.@{select-prefix}-selection__choice-zoom-leave {
|
|
277
|
+
opacity: 1;
|
|
278
|
+
transform: scale(1);
|
|
279
|
+
|
|
280
|
+
&&-active {
|
|
281
|
+
opacity: 0;
|
|
282
|
+
transform: scale(0.5);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.effect() {
|
|
287
|
+
animation-duration: 0.3s;
|
|
288
|
+
animation-fill-mode: both;
|
|
289
|
+
transform-origin: 0 0;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.@{select-prefix}-dropdown {
|
|
293
|
+
&-slide-up-enter,
|
|
294
|
+
&-slide-up-appear {
|
|
295
|
+
.effect();
|
|
296
|
+
opacity: 0;
|
|
297
|
+
animation-timing-function: cubic-bezier(0.08, 0.82, 0.17, 1);
|
|
298
|
+
animation-play-state: paused;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
&-slide-up-leave {
|
|
302
|
+
.effect();
|
|
303
|
+
opacity: 1;
|
|
304
|
+
animation-timing-function: cubic-bezier(0.6, 0.04, 0.98, 0.34);
|
|
305
|
+
animation-play-state: paused;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
&-slide-up-enter&-slide-up-enter-active&-placement-bottomLeft,
|
|
309
|
+
&-slide-up-appear&-slide-up-appear-active&-placement-bottomLeft,
|
|
310
|
+
&-slide-up-enter&-slide-up-enter-active&-placement-bottomRight,
|
|
311
|
+
&-slide-up-appear&-slide-up-appear-active&-placement-bottomRight {
|
|
312
|
+
animation-name: rcSelectDropdownSlideUpIn;
|
|
313
|
+
animation-play-state: running;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
&-slide-up-leave&-slide-up-leave-active&-placement-bottomLeft,
|
|
317
|
+
&-slide-up-leave&-slide-up-leave-active&-placement-bottomRight {
|
|
318
|
+
animation-name: rcSelectDropdownSlideUpOut;
|
|
319
|
+
animation-play-state: running;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
&-slide-up-enter&-slide-up-enter-active&-placement-topLeft,
|
|
323
|
+
&-slide-up-appear&-slide-up-appear-active&-placement-topLeft,
|
|
324
|
+
&-slide-up-enter&-slide-up-enter-active&-placement-topRight,
|
|
325
|
+
&-slide-up-appear&-slide-up-appear-active&-placement-topRight {
|
|
326
|
+
animation-name: rcSelectDropdownSlideDownIn;
|
|
327
|
+
animation-play-state: running;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
&-slide-up-leave&-slide-up-leave-active&-placement-topLeft,
|
|
331
|
+
&-slide-up-leave&-slide-up-leave-active&-placement-topRight {
|
|
332
|
+
animation-name: rcSelectDropdownSlideDownOut;
|
|
333
|
+
animation-play-state: running;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
@keyframes rcSelectDropdownSlideUpIn {
|
|
338
|
+
0% {
|
|
339
|
+
opacity: 0;
|
|
340
|
+
transform-origin: 0% 0%;
|
|
341
|
+
transform: scaleY(0);
|
|
342
|
+
}
|
|
343
|
+
100% {
|
|
344
|
+
opacity: 1;
|
|
345
|
+
transform-origin: 0% 0%;
|
|
346
|
+
transform: scaleY(1);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
@keyframes rcSelectDropdownSlideUpOut {
|
|
350
|
+
0% {
|
|
351
|
+
opacity: 1;
|
|
352
|
+
transform-origin: 0% 0%;
|
|
353
|
+
transform: scaleY(1);
|
|
354
|
+
}
|
|
355
|
+
100% {
|
|
356
|
+
opacity: 0;
|
|
357
|
+
transform-origin: 0% 0%;
|
|
358
|
+
transform: scaleY(0);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
@keyframes rcSelectDropdownSlideDownIn {
|
|
363
|
+
0% {
|
|
364
|
+
transform: scaleY(0);
|
|
365
|
+
transform-origin: 100% 100%;
|
|
366
|
+
opacity: 0;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
100% {
|
|
370
|
+
transform: scaleY(1);
|
|
371
|
+
transform-origin: 100% 100%;
|
|
372
|
+
opacity: 1;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
@keyframes rcSelectDropdownSlideDownOut {
|
|
377
|
+
0% {
|
|
378
|
+
transform: scaleY(1);
|
|
379
|
+
transform-origin: 100% 100%;
|
|
380
|
+
opacity: 1;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
100% {
|
|
384
|
+
transform: scaleY(0);
|
|
385
|
+
transform-origin: 100% 100%;
|
|
386
|
+
opacity: 0;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
@keyframes rcSelectLoadingIcon {
|
|
391
|
+
0% {
|
|
392
|
+
transform: rotate(0);
|
|
393
|
+
}
|
|
394
|
+
100% {
|
|
395
|
+
transform: rotate(360deg);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export default function Polite(props) {
|
|
3
|
+
const {
|
|
4
|
+
visible,
|
|
5
|
+
values
|
|
6
|
+
} = props;
|
|
7
|
+
if (!visible) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Only cut part of values since it's a screen reader
|
|
12
|
+
const MAX_COUNT = 50;
|
|
13
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
14
|
+
"aria-live": "polite",
|
|
15
|
+
style: {
|
|
16
|
+
width: 0,
|
|
17
|
+
height: 0,
|
|
18
|
+
position: 'absolute',
|
|
19
|
+
overflow: 'hidden',
|
|
20
|
+
opacity: 0
|
|
21
|
+
}
|
|
22
|
+
}, `${values.slice(0, MAX_COUNT).map(({
|
|
23
|
+
label,
|
|
24
|
+
value
|
|
25
|
+
}) => ['number', 'string'].includes(typeof label) ? label : value).join(', ')}`, values.length > MAX_COUNT ? ', ...' : null);
|
|
26
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { AlignType, BuildInPlacements } from '@rc-component/trigger/lib/interface';
|
|
2
|
+
import type { ScrollConfig, ScrollTo } from 'rc-virtual-list/lib/List';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import type { DisplayInfoType, DisplayValueType, Mode, Placement, RawValueType, RenderDOMFunc, RenderNode } from '../interface';
|
|
5
|
+
export type { DisplayInfoType, DisplayValueType, Mode, Placement, RenderDOMFunc, RenderNode, RawValueType, };
|
|
6
|
+
export interface RefOptionListProps {
|
|
7
|
+
onKeyDown: React.KeyboardEventHandler;
|
|
8
|
+
onKeyUp: React.KeyboardEventHandler;
|
|
9
|
+
scrollTo?: (args: number | ScrollConfig) => void;
|
|
10
|
+
}
|
|
11
|
+
export type CustomTagProps = {
|
|
12
|
+
label: React.ReactNode;
|
|
13
|
+
value: any;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
onClose: (event?: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
16
|
+
closable: boolean;
|
|
17
|
+
isMaxTag: boolean;
|
|
18
|
+
index: number;
|
|
19
|
+
};
|
|
20
|
+
export interface BaseSelectRef {
|
|
21
|
+
focus: (options?: FocusOptions) => void;
|
|
22
|
+
blur: () => void;
|
|
23
|
+
scrollTo: ScrollTo;
|
|
24
|
+
nativeElement: HTMLElement;
|
|
25
|
+
}
|
|
26
|
+
export interface BaseSelectPrivateProps {
|
|
27
|
+
id: string;
|
|
28
|
+
prefixCls: string;
|
|
29
|
+
omitDomProps?: string[];
|
|
30
|
+
displayValues: DisplayValueType[];
|
|
31
|
+
onDisplayValuesChange: (values: DisplayValueType[], info: {
|
|
32
|
+
type: DisplayInfoType;
|
|
33
|
+
values: DisplayValueType[];
|
|
34
|
+
}) => void;
|
|
35
|
+
/** Current dropdown list active item string value */
|
|
36
|
+
activeValue?: string;
|
|
37
|
+
/** Link search input with target element */
|
|
38
|
+
activeDescendantId?: string;
|
|
39
|
+
onActiveValueChange?: (value: string | null) => void;
|
|
40
|
+
searchValue: string;
|
|
41
|
+
autoClearSearchValue?: boolean;
|
|
42
|
+
/** Trigger onSearch, return false to prevent trigger open event */
|
|
43
|
+
onSearch: (searchValue: string, info: {
|
|
44
|
+
source: 'typing' | 'effect' | 'submit' | 'blur';
|
|
45
|
+
}) => void;
|
|
46
|
+
/** Trigger when search text match the `tokenSeparators`. Will provide split content */
|
|
47
|
+
onSearchSplit?: (words: string[]) => void;
|
|
48
|
+
OptionList: React.ForwardRefExoticComponent<React.PropsWithoutRef<any> & React.RefAttributes<RefOptionListProps>>;
|
|
49
|
+
/** Tell if provided `options` is empty */
|
|
50
|
+
emptyOptions: boolean;
|
|
51
|
+
}
|
|
52
|
+
export type BaseSelectPropsWithoutPrivate = Omit<BaseSelectProps, keyof BaseSelectPrivateProps>;
|
|
53
|
+
export interface BaseSelectProps extends BaseSelectPrivateProps, React.AriaAttributes {
|
|
54
|
+
className?: string;
|
|
55
|
+
style?: React.CSSProperties;
|
|
56
|
+
title?: string;
|
|
57
|
+
showSearch?: boolean;
|
|
58
|
+
tagRender?: (props: CustomTagProps) => React.ReactElement;
|
|
59
|
+
direction?: 'ltr' | 'rtl';
|
|
60
|
+
maxLength?: number;
|
|
61
|
+
showScrollBar?: boolean | 'optional';
|
|
62
|
+
tabIndex?: number;
|
|
63
|
+
autoFocus?: boolean;
|
|
64
|
+
notFoundContent?: React.ReactNode;
|
|
65
|
+
placeholder?: React.ReactNode;
|
|
66
|
+
onClear?: () => void;
|
|
67
|
+
choiceTransitionName?: string;
|
|
68
|
+
mode?: Mode;
|
|
69
|
+
disabled?: boolean;
|
|
70
|
+
loading?: boolean;
|
|
71
|
+
open?: boolean;
|
|
72
|
+
defaultOpen?: boolean;
|
|
73
|
+
onPopupVisibleChange?: (open: boolean) => void;
|
|
74
|
+
/** @private Internal usage. Do not use in your production. */
|
|
75
|
+
getInputElement?: () => JSX.Element;
|
|
76
|
+
/** @private Internal usage. Do not use in your production. */
|
|
77
|
+
getRawInputElement?: () => JSX.Element;
|
|
78
|
+
maxTagTextLength?: number;
|
|
79
|
+
maxTagCount?: number | 'responsive';
|
|
80
|
+
maxTagPlaceholder?: React.ReactNode | ((omittedValues: DisplayValueType[]) => React.ReactNode);
|
|
81
|
+
tokenSeparators?: string[];
|
|
82
|
+
allowClear?: boolean | {
|
|
83
|
+
clearIcon?: RenderNode;
|
|
84
|
+
};
|
|
85
|
+
prefix?: React.ReactNode;
|
|
86
|
+
suffixIcon?: RenderNode;
|
|
87
|
+
/**
|
|
88
|
+
* Clear all icon
|
|
89
|
+
* @deprecated Please use `allowClear` instead
|
|
90
|
+
**/
|
|
91
|
+
clearIcon?: RenderNode;
|
|
92
|
+
/** Selector remove icon */
|
|
93
|
+
removeIcon?: RenderNode;
|
|
94
|
+
animation?: string;
|
|
95
|
+
transitionName?: string;
|
|
96
|
+
popupStyle?: React.CSSProperties;
|
|
97
|
+
popupClassName?: string;
|
|
98
|
+
popupMatchSelectWidth?: boolean | number;
|
|
99
|
+
popupRender?: (menu: React.ReactElement) => React.ReactElement;
|
|
100
|
+
popupAlign?: AlignType;
|
|
101
|
+
placement?: Placement;
|
|
102
|
+
builtinPlacements?: BuildInPlacements;
|
|
103
|
+
getPopupContainer?: RenderDOMFunc;
|
|
104
|
+
showAction?: ('focus' | 'click')[];
|
|
105
|
+
onBlur?: React.FocusEventHandler<HTMLElement>;
|
|
106
|
+
onFocus?: React.FocusEventHandler<HTMLElement>;
|
|
107
|
+
onKeyUp?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
108
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
109
|
+
onMouseDown?: React.MouseEventHandler<HTMLDivElement>;
|
|
110
|
+
onPopupScroll?: React.UIEventHandler<HTMLDivElement>;
|
|
111
|
+
onInputKeyDown?: React.KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
112
|
+
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
|
113
|
+
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
|
114
|
+
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
115
|
+
}
|
|
116
|
+
export declare const isMultiple: (mode: Mode) => boolean;
|
|
117
|
+
declare const BaseSelect: React.ForwardRefExoticComponent<BaseSelectProps & React.RefAttributes<BaseSelectRef>>;
|
|
118
|
+
export default BaseSelect;
|