@pixelium/web-vue 0.0.2 → 0.0.3-beta
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/README.md +42 -0
- package/README.zh.md +6 -3
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/coverage-final.json +106 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +926 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +210 -0
- package/dist/font.css +1 -1
- package/dist/index.d.ts +1593 -248
- package/dist/normalize.css +2 -0
- package/dist/pixelium-vue-icon-hn.cjs +1 -1
- package/dist/pixelium-vue-icon-hn.css +2 -1
- package/dist/pixelium-vue-icon-hn.js +8533 -8154
- package/dist/pixelium-vue-icon-hn.umd.cjs +1 -1
- package/dist/pixelium-vue-icon-pa.cjs +1 -1
- package/dist/pixelium-vue-icon-pa.css +2 -1
- package/dist/pixelium-vue-icon-pa.js +10625 -10143
- package/dist/pixelium-vue-icon-pa.umd.cjs +1 -1
- package/dist/pixelium-vue.cjs +2 -2
- package/dist/pixelium-vue.css +2 -1
- package/dist/pixelium-vue.js +7402 -5852
- package/dist/pixelium-vue.umd.cjs +2 -2
- package/es/aside/index.js +46 -151
- package/es/auto-complete/draw.d.ts +1 -1
- package/es/auto-complete/draw.js +26 -51
- package/es/auto-complete/index.css +92 -32
- package/es/auto-complete/index.d.ts +12 -15
- package/es/auto-complete/index.js +338 -400
- package/es/auto-complete/type.d.ts +25 -13
- package/es/avatar/css.js +2 -0
- package/es/avatar/draw.d.ts +2 -0
- package/es/avatar/draw.js +11 -0
- package/es/avatar/index.css +49 -0
- package/es/avatar/index.d.ts +15 -0
- package/es/avatar/index.js +110 -0
- package/es/avatar/type.d.ts +34 -0
- package/es/button/draw.d.ts +4 -4
- package/es/button/draw.js +213 -297
- package/es/button/index.css +40 -30
- package/es/button/index.d.ts +0 -4
- package/es/button/index.js +230 -256
- package/es/button/type.d.ts +3 -3
- package/es/button-group/index.css +0 -3
- package/es/button-group/index.d.ts +1 -2
- package/es/button-group/index.js +59 -31
- package/es/button-group/type.d.ts +21 -4
- package/es/checkbox/css.js +2 -0
- package/es/checkbox/draw.d.ts +4 -0
- package/es/checkbox/draw.js +46 -0
- package/es/checkbox/index.css +85 -0
- package/es/checkbox/index.d.ts +31 -0
- package/es/checkbox/index.js +206 -0
- package/es/checkbox/type.d.ts +88 -0
- package/es/checkbox-group/css.js +2 -0
- package/es/checkbox-group/index.css +20 -0
- package/es/checkbox-group/index.d.ts +23 -0
- package/es/checkbox-group/index.js +84 -0
- package/es/checkbox-group/type.d.ts +78 -0
- package/es/col/index.d.ts +2 -2
- package/es/col/index.js +43 -58
- package/es/container/index.js +18 -31
- package/es/divider/index.js +39 -53
- package/es/empty/index.css +4 -4
- package/es/empty/index.js +16 -71
- package/es/entry.js +102 -0
- package/es/footer/index.js +31 -40
- package/es/form/css.js +1 -0
- package/es/form/index.d.ts +27 -0
- package/es/form/index.js +125 -0
- package/es/form/type.d.ts +238 -0
- package/es/form/use-form.d.ts +4 -0
- package/es/form/use-form.js +48 -0
- package/es/form-item/css.js +2 -0
- package/es/form-item/index.css +77 -0
- package/es/form-item/index.d.ts +37 -0
- package/es/form-item/index.js +318 -0
- package/es/form-item/type.d.ts +96 -0
- package/es/grid/index.js +56 -75
- package/es/grid-item/css.js +0 -1
- package/es/grid-item/index.d.ts +1 -1
- package/es/grid-item/index.js +85 -121
- package/es/header/index.js +31 -40
- package/es/icon/index.js +44 -55
- package/es/icons/css-hn.js +0 -1
- package/es/icons/css-pa.js +0 -1
- package/es/icons/icon-hn.js +10337 -15986
- package/es/icons/icon-pa.js +12573 -17447
- package/es/image/css.js +2 -0
- package/es/image/index.css +69 -0
- package/es/image/index.d.ts +35 -0
- package/es/image/index.js +199 -0
- package/es/image/type.d.ts +126 -0
- package/es/index.css +1 -515
- package/es/index.d.ts +22 -2
- package/es/index.js +143 -123
- package/es/input/draw.d.ts +1 -1
- package/es/input/draw.js +26 -51
- package/es/input/index.css +85 -33
- package/es/input/index.d.ts +9 -16
- package/es/input/index.js +319 -423
- package/es/input/type.d.ts +3 -3
- package/es/input-group/index.css +0 -1
- package/es/input-group/index.d.ts +2 -2
- package/es/input-group/index.js +66 -37
- package/es/input-group/type.d.ts +16 -4
- package/es/input-group-label/draw.d.ts +1 -1
- package/es/input-group-label/draw.js +26 -51
- package/es/input-group-label/index.css +33 -22
- package/es/input-group-label/index.d.ts +1 -4
- package/es/input-group-label/index.js +104 -127
- package/es/input-group-label/type.d.ts +3 -3
- package/es/input-number/draw.d.ts +1 -1
- package/es/input-number/draw.js +26 -51
- package/es/input-number/index.css +90 -35
- package/es/input-number/index.d.ts +9 -16
- package/es/input-number/index.js +428 -536
- package/es/input-number/type.d.ts +3 -3
- package/es/input-tag/draw.d.ts +1 -1
- package/es/input-tag/draw.js +26 -48
- package/es/input-tag/index.css +100 -33
- package/es/input-tag/index.d.ts +7 -13
- package/es/input-tag/index.js +442 -467
- package/es/input-tag/type.d.ts +24 -13
- package/es/link/index.js +75 -106
- package/es/main/index.js +11 -15
- package/es/mask/index.js +94 -115
- package/es/message/index.css +1 -1
- package/es/message/index.js +168 -346
- package/es/message-box/css.js +1 -1
- package/es/message-box/index.js +98 -114
- package/es/message-box/message-box-wrapped.js +33 -46
- package/es/message-box/message-box.js +79 -111
- package/es/option-list/index.css +13 -13
- package/es/option-list/index.d.ts +4 -31
- package/es/option-list/index.js +99 -167
- package/es/option-list/type.d.ts +5 -1
- package/es/pixelate/pixel.d.ts +5 -0
- package/es/pixelate/pixel.js +70 -0
- package/es/pixelate/pixelate.worker.d.ts +1 -0
- package/es/popover/index.d.ts +13 -99
- package/es/popover/index.js +75 -238
- package/es/popover/type.d.ts +7 -2
- package/es/popup/css.js +1 -0
- package/es/popup/index.d.ts +210 -0
- package/es/popup/index.js +203 -0
- package/es/popup/type.d.ts +105 -0
- package/es/popup-content/draw.d.ts +2 -2
- package/es/popup-content/draw.js +98 -143
- package/es/popup-content/index.css +11 -11
- package/es/popup-content/index.d.ts +1 -0
- package/es/popup-content/index.js +253 -1576
- package/es/popup-content/type.d.ts +1 -0
- package/es/popup-trigger/index.d.ts +8 -2
- package/es/popup-trigger/index.js +122 -95
- package/es/popup-trigger/type.d.ts +4 -1
- package/es/popup-wrapper/css.js +2 -0
- package/es/popup-wrapper/index.css +14 -0
- package/es/popup-wrapper/index.d.ts +18 -0
- package/es/popup-wrapper/index.js +67 -0
- package/es/popup-wrapper/type.d.ts +9 -0
- package/es/radio/css.js +1 -0
- package/es/radio/draw.d.ts +4 -0
- package/es/radio/draw.js +47 -0
- package/es/radio/index.d.ts +30 -0
- package/es/radio/index.js +190 -0
- package/es/radio/style.css +73 -0
- package/es/radio/type.d.ts +76 -0
- package/es/radio-group/css.js +2 -0
- package/es/radio-group/index.css +20 -0
- package/es/radio-group/index.d.ts +23 -0
- package/es/radio-group/index.js +77 -0
- package/es/radio-group/type.d.ts +77 -0
- package/es/row/index.js +56 -70
- package/es/select/draw.d.ts +1 -1
- package/es/select/draw.js +26 -51
- package/es/select/index.css +118 -36
- package/es/select/index.d.ts +14 -16
- package/es/select/index.js +625 -672
- package/es/select/type.d.ts +60 -25
- package/es/share/const/event-bus-key.js +1 -6
- package/es/share/const/index.d.ts +4 -0
- package/es/share/const/index.js +22 -24
- package/es/share/const/provide-key.d.ts +5 -0
- package/es/share/const/provide-key.js +6 -5
- package/es/share/const/style.d.ts +6 -0
- package/es/share/const/style.js +7 -0
- package/es/share/hook/use-cancelable-delay.d.ts +1 -0
- package/es/share/hook/use-cancelable-delay.js +42 -0
- package/es/share/hook/use-click-outside-listener.d.ts +1 -1
- package/es/share/hook/use-click-outside-listener.js +28 -41
- package/es/share/hook/use-composition.js +17 -15
- package/es/share/hook/use-controlled-mode.d.ts +3 -3
- package/es/share/hook/use-controlled-mode.js +20 -23
- package/es/share/hook/use-dark-mode.js +51 -65
- package/es/share/hook/use-index-of-children.d.ts +2 -1
- package/es/share/hook/use-index-of-children.js +47 -45
- package/es/share/hook/use-lazy-load.d.ts +10 -0
- package/es/share/hook/use-lazy-load.js +133 -0
- package/es/share/hook/use-props-detect.d.ts +2 -0
- package/es/share/hook/use-resize-observer.d.ts +1 -2
- package/es/share/hook/use-resize-observer.js +28 -20
- package/es/share/hook/use-screen-width.js +27 -36
- package/es/share/hook/use-smooth-transition.d.ts +2 -0
- package/es/share/hook/use-smooth-transition.js +65 -0
- package/es/share/hook/use-textarea-height.js +86 -92
- package/es/share/hook/use-theme-mode.js +41 -42
- package/es/share/hook/use-transition-end.d.ts +2 -0
- package/es/share/hook/use-transition-end.js +12 -0
- package/es/share/hook/use-watch-global-css-var.js +12 -16
- package/es/share/hook/use-window-resize-listener.d.ts +1 -0
- package/es/share/hook/use-window-resize-listener.js +15 -0
- package/es/share/hook/use-z-index.js +30 -27
- package/es/share/type/index.d.ts +18 -3
- package/es/share/util/color.d.ts +5 -3
- package/es/share/util/color.js +156 -149
- package/es/share/util/common.d.ts +7 -2
- package/es/share/util/common.js +127 -65
- package/es/share/util/console.d.ts +3 -3
- package/es/share/util/console.js +10 -7
- package/es/share/util/dom.d.ts +19 -0
- package/es/share/util/dom.js +88 -0
- package/es/share/util/env.d.ts +1 -0
- package/es/share/util/env.js +5 -4
- package/es/share/util/event-bus.js +3 -20
- package/es/share/util/lru-cache.js +29 -33
- package/es/share/util/pixel.d.ts +4 -0
- package/es/share/util/plot.d.ts +8 -3
- package/es/share/util/plot.js +457 -229
- package/es/share/util/reactivity.d.ts +8 -0
- package/es/share/util/reactivity.js +23 -0
- package/es/share/util/render.js +31 -41
- package/es/share/util/theme.d.ts +3 -0
- package/es/share/util/theme.js +77 -57
- package/es/slider/css.js +2 -0
- package/es/slider/draw.d.ts +25 -0
- package/es/slider/draw.js +113 -0
- package/es/slider/index.css +119 -0
- package/es/slider/index.d.ts +66 -0
- package/es/slider/index.js +503 -0
- package/es/slider/type.d.ts +162 -0
- package/es/slider/util.d.ts +37 -0
- package/es/slider/util.js +130 -0
- package/es/space/index.css +24 -29
- package/es/space/index.js +73 -97
- package/es/spin/index.css +18 -17
- package/es/spin/index.js +72 -102
- package/es/spin/type.d.ts +11 -5
- package/es/switch/css.js +2 -0
- package/es/switch/draw.d.ts +2 -0
- package/es/switch/draw.js +18 -0
- package/es/switch/index.css +121 -0
- package/es/switch/index.d.ts +42 -0
- package/es/switch/index.js +259 -0
- package/es/switch/type.d.ts +133 -0
- package/es/tag/draw.d.ts +2 -2
- package/es/tag/draw.js +80 -127
- package/es/tag/index.css +38 -22
- package/es/tag/index.d.ts +2 -2
- package/es/tag/index.js +121 -190
- package/es/tag/type.d.ts +3 -3
- package/es/text-outline/css.js +2 -0
- package/es/text-outline/index.css +4 -0
- package/es/text-outline/index.d.ts +17 -0
- package/es/text-outline/index.js +33 -0
- package/es/text-outline/type.d.ts +23 -0
- package/es/textarea/draw.js +9 -11
- package/es/textarea/index.css +37 -23
- package/es/textarea/index.d.ts +8 -14
- package/es/textarea/index.js +274 -262
- package/es/tooltip/index.d.ts +100 -4
- package/es/tooltip/index.js +70 -226
- package/es/tooltip/type.d.ts +7 -2
- package/es/vendor.js +504 -0
- package/es/virtual-list/css.js +2 -0
- package/es/virtual-list/index.css +25 -0
- package/es/virtual-list/index.d.ts +11 -0
- package/es/virtual-list/index.js +313 -0
- package/es/virtual-list/type.d.ts +26 -0
- package/package.json +10 -16
- package/es/grid-item/index.css +0 -0
- /package/es/message-box/{message-box.css → index.css} +0 -0
package/es/select/index.js
CHANGED
|
@@ -1,674 +1,627 @@
|
|
|
1
1
|
import './css.js'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
"width-equal": true,
|
|
627
|
-
"arrow": false,
|
|
628
|
-
"visible": popoverVisible.value,
|
|
629
|
-
"onUpdate:visible": popoverVisibleUpdateHandler,
|
|
630
|
-
"trigger": "click",
|
|
631
|
-
"contentStyle": {
|
|
632
|
-
padding: `${pixelSize}px`
|
|
633
|
-
},
|
|
634
|
-
"ref": popoverRef
|
|
635
|
-
}, {
|
|
636
|
-
default: () => h("div", {
|
|
637
|
-
ref: wrapperRef,
|
|
638
|
-
class: ["pixelium px-select", sizeComputed.value && `px-select__${sizeComputed.value}`, shapeComputed.value && `px-select__${shapeComputed.value}`, {
|
|
639
|
-
"px-select__inner": innerInputGroup.value
|
|
640
|
-
}, {
|
|
641
|
-
"px-select__disabled": disabledComputed.value
|
|
642
|
-
}],
|
|
643
|
-
onClick: focusInputHandler,
|
|
644
|
-
onMouseenter: mouseenterHandler,
|
|
645
|
-
onMouseleave: mouseleaveHandler,
|
|
646
|
-
...scopeObj,
|
|
647
|
-
...attrs
|
|
648
|
-
}, [Inner]),
|
|
649
|
-
content: () => optionsFiltered.value.length ? createVNode(_sfc_main$4, {
|
|
650
|
-
"options": optionsFiltered.value,
|
|
651
|
-
"onSelect": selectHandler,
|
|
652
|
-
"activeValues": props.multiple ? modelValue.value : [modelValue.value]
|
|
653
|
-
}, {
|
|
654
|
-
"group-label": ({
|
|
655
|
-
option
|
|
656
|
-
}) => slots["group-label"] ? slots["group-label"]({
|
|
657
|
-
option
|
|
658
|
-
}) : option.label,
|
|
659
|
-
option: ({
|
|
660
|
-
option
|
|
661
|
-
}) => slots.option ? slots.option({
|
|
662
|
-
option
|
|
663
|
-
}) : p(option) ? option : option.label
|
|
664
|
-
}) : createVNode("div", {
|
|
665
|
-
"class": "px-select-empty"
|
|
666
|
-
}, [createVNode(_sfc_main$5, null, null)])
|
|
667
|
-
});
|
|
668
|
-
return Render;
|
|
669
|
-
};
|
|
670
|
-
}
|
|
2
|
+
import { A as d, B as y, D as S, V as spinner_third_solid_default, _ as E, g as A, h as $n, j as en, l as times_circle_solid_default } from "../vendor.js";
|
|
3
|
+
import { i as GROUP_OPTION_TYPE, o as POPUP_CONTENT_DEFAULT_MAX_WIDTH, r as GET_ELEMENT_RENDERED, t as BORDER_CORNER_RAD_RANGE } from "../share/const/index.js";
|
|
4
|
+
import { r as findSameOption, t as defaultFilter } from "../share/util/common.js";
|
|
5
|
+
import { i as canvasPreprocess, l as getBorderRadius, n as calcPixelSize, s as floodFill, t as calcBorderCornerCenter } from "../share/util/plot.js";
|
|
6
|
+
import { n as getGlobalThemeColor } from "../share/util/color.js";
|
|
7
|
+
import { t as useDarkMode } from "../share/hook/use-dark-mode.js";
|
|
8
|
+
import { t as useResizeObserver } from "../share/hook/use-resize-observer.js";
|
|
9
|
+
import { i as INPUT_GROUP_UPDATE } from "../share/const/event-bus-key.js";
|
|
10
|
+
import { t as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
|
|
11
|
+
import { n as useIndexOfChildren } from "../share/hook/use-index-of-children.js";
|
|
12
|
+
import { i as FORM_ITEM_PROVIDE, s as INPUT_GROUP_PROVIDE } from "../share/const/provide-key.js";
|
|
13
|
+
import { t as createProvideComputed } from "../share/util/reactivity.js";
|
|
14
|
+
import { t as useTransitionEnd } from "../share/hook/use-transition-end.js";
|
|
15
|
+
import { t as useComposition } from "../share/hook/use-composition.js";
|
|
16
|
+
import { t as useControlledMode } from "../share/hook/use-controlled-mode.js";
|
|
17
|
+
import { t as tag_default } from "../tag/index.js";
|
|
18
|
+
import { t as useCancelableDelay } from "../share/hook/use-cancelable-delay.js";
|
|
19
|
+
import { t as popover_default } from "../popover/index.js";
|
|
20
|
+
import { t as empty_default } from "../empty/index.js";
|
|
21
|
+
import { t as option_list_default } from "../option-list/index.js";
|
|
22
|
+
import { t as drawBorder } from "./draw.js";
|
|
23
|
+
import { Fragment, computed, createVNode, defineComponent, getCurrentInstance, h, inject, mergeProps, nextTick, onMounted, ref, shallowRef, useAttrs, useSlots, vShow, watch, withDirectives } from "vue";
|
|
24
|
+
var ANIMATION_DURATION = 250;
|
|
25
|
+
var select_default = /* @__PURE__ */ defineComponent({
|
|
26
|
+
name: "Select",
|
|
27
|
+
__name: "index",
|
|
28
|
+
props: {
|
|
29
|
+
modelValue: null,
|
|
30
|
+
defaultValue: null,
|
|
31
|
+
options: { default: () => [] },
|
|
32
|
+
placeholder: null,
|
|
33
|
+
disabled: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
},
|
|
37
|
+
readonly: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false
|
|
40
|
+
},
|
|
41
|
+
clearable: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
},
|
|
45
|
+
multiple: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
},
|
|
49
|
+
loading: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
inputValue: null,
|
|
54
|
+
defaultInputValue: null,
|
|
55
|
+
filterable: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false
|
|
58
|
+
},
|
|
59
|
+
shouldShowPopover: { type: Function },
|
|
60
|
+
filter: { type: Function },
|
|
61
|
+
creatable: { type: Boolean },
|
|
62
|
+
collapseTags: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false
|
|
65
|
+
},
|
|
66
|
+
maxDisplayTags: null,
|
|
67
|
+
collapseTagsPopover: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: true
|
|
70
|
+
},
|
|
71
|
+
virtualScroll: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false
|
|
74
|
+
},
|
|
75
|
+
virtualListProps: null,
|
|
76
|
+
tagProps: null,
|
|
77
|
+
size: null,
|
|
78
|
+
shape: null,
|
|
79
|
+
borderRadius: null,
|
|
80
|
+
status: { default: "normal" },
|
|
81
|
+
tagTheme: { default: "info" },
|
|
82
|
+
tagVariant: { default: "plain" },
|
|
83
|
+
tagColor: null,
|
|
84
|
+
popoverProps: null,
|
|
85
|
+
optionsDestroyOnHide: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
emits: [
|
|
91
|
+
"input",
|
|
92
|
+
"update:modelValue",
|
|
93
|
+
"update:inputValue",
|
|
94
|
+
"change",
|
|
95
|
+
"inputChange",
|
|
96
|
+
"clear",
|
|
97
|
+
"blur",
|
|
98
|
+
"focus",
|
|
99
|
+
"select",
|
|
100
|
+
"tagClose"
|
|
101
|
+
],
|
|
102
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
103
|
+
var _instance$parent;
|
|
104
|
+
const attrs = useAttrs();
|
|
105
|
+
const props = __props;
|
|
106
|
+
const emits = __emit;
|
|
107
|
+
const [isComposing, compositionStartHandler, compositionUpdateHandler] = useComposition({ afterComposition: (e) => {
|
|
108
|
+
nextTick(() => {
|
|
109
|
+
inputHandler(e);
|
|
110
|
+
});
|
|
111
|
+
} });
|
|
112
|
+
const instance = getCurrentInstance();
|
|
113
|
+
const innerInputGroup = ref((instance === null || instance === void 0 || (_instance$parent = instance.parent) === null || _instance$parent === void 0 ? void 0 : _instance$parent.type.name) === "InputGroup");
|
|
114
|
+
const [index, first, last] = innerInputGroup.value ? useIndexOfChildren(INPUT_GROUP_UPDATE, (instance$1) => {
|
|
115
|
+
var _instance$vnode$el;
|
|
116
|
+
return instance$1 === null || instance$1 === void 0 || (_instance$vnode$el = instance$1.vnode.el) === null || _instance$vnode$el === void 0 ? void 0 : _instance$vnode$el.nextElementSibling;
|
|
117
|
+
}) : [
|
|
118
|
+
ref(0),
|
|
119
|
+
ref(false),
|
|
120
|
+
ref(false)
|
|
121
|
+
];
|
|
122
|
+
const inputGroupProvide = inject(INPUT_GROUP_PROVIDE);
|
|
123
|
+
const formItemProvide = inject(FORM_ITEM_PROVIDE);
|
|
124
|
+
const borderRadiusComputed = createProvideComputed("borderRadius", [innerInputGroup.value && inputGroupProvide, props]);
|
|
125
|
+
const sizeComputed = createProvideComputed("size", () => [
|
|
126
|
+
innerInputGroup.value && inputGroupProvide,
|
|
127
|
+
props.size && props,
|
|
128
|
+
formItemProvide,
|
|
129
|
+
props
|
|
130
|
+
], "nullish", (val) => val || "medium");
|
|
131
|
+
const shapeComputed = createProvideComputed("shape", [innerInputGroup.value && inputGroupProvide, props], "nullish", (val) => val || "rect");
|
|
132
|
+
const disabledComputed = createProvideComputed("disabled", [
|
|
133
|
+
innerInputGroup.value && inputGroupProvide,
|
|
134
|
+
formItemProvide,
|
|
135
|
+
props
|
|
136
|
+
], "or");
|
|
137
|
+
const readonlyComputed = createProvideComputed("readonly", [
|
|
138
|
+
innerInputGroup.value && inputGroupProvide,
|
|
139
|
+
formItemProvide,
|
|
140
|
+
props
|
|
141
|
+
], "or");
|
|
142
|
+
const statusComputed = createProvideComputed("status", [formItemProvide, props]);
|
|
143
|
+
const nextIsTextButton = computed(() => {
|
|
144
|
+
if (index.value >= 0) {
|
|
145
|
+
var _inputGroupProvide$ch;
|
|
146
|
+
return innerInputGroup.value ? !!((inputGroupProvide === null || inputGroupProvide === void 0 || (_inputGroupProvide$ch = inputGroupProvide.childrenInfo.value.find((e) => e.index === index.value + 1)) === null || _inputGroupProvide$ch === void 0 ? void 0 : _inputGroupProvide$ch.variant) === "text") : false;
|
|
147
|
+
} else return false;
|
|
148
|
+
});
|
|
149
|
+
const modelValueIsFalse = (modelValue$1) => {
|
|
150
|
+
return $n(modelValue$1) || en(modelValue$1) || props.multiple && S(modelValue$1) && modelValue$1.length === 0;
|
|
151
|
+
};
|
|
152
|
+
const [modelValue, updateModelValue] = useControlledMode("modelValue", props, emits, {
|
|
153
|
+
defaultField: "defaultValue",
|
|
154
|
+
transform: (nextValue) => {
|
|
155
|
+
if (!props.multiple) return nextValue;
|
|
156
|
+
else if (E(nextValue)) return;
|
|
157
|
+
else if (S(nextValue)) return [...nextValue];
|
|
158
|
+
else return [nextValue];
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
const [inputValue, updateInputValue] = useControlledMode("inputValue", props, emits, {
|
|
162
|
+
defaultField: "defaultInputValue",
|
|
163
|
+
transform: (nextValue) => {
|
|
164
|
+
return nextValue || "";
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
const currentLabelSelectedMultiple = computed(() => {
|
|
168
|
+
if (!props.multiple) return [];
|
|
169
|
+
if (!props.options.length) return [];
|
|
170
|
+
if (modelValueIsFalse(modelValue.value)) return [];
|
|
171
|
+
const labelMap = /* @__PURE__ */ new Map();
|
|
172
|
+
props.options.forEach((option) => {
|
|
173
|
+
if (y(option)) labelMap.set(option, option);
|
|
174
|
+
else if ("type" in option && option.type === "group") return option.children.some((child) => {
|
|
175
|
+
if (y(child)) labelMap.set(child, child);
|
|
176
|
+
else labelMap.set(child.value, child.label);
|
|
177
|
+
});
|
|
178
|
+
else labelMap.set(option.value, option.label);
|
|
179
|
+
});
|
|
180
|
+
return modelValue.value.map((e) => labelMap.has(e) ? labelMap.get(e) : String(e));
|
|
181
|
+
});
|
|
182
|
+
const currentLabelSelected = computed(() => {
|
|
183
|
+
if (props.multiple) return "";
|
|
184
|
+
if (!props.options.length) return "";
|
|
185
|
+
if (modelValueIsFalse(modelValue.value)) return "";
|
|
186
|
+
let currentLabel = String(modelValue.value);
|
|
187
|
+
props.options.some((option) => {
|
|
188
|
+
if (y(option)) return modelValue.value === option;
|
|
189
|
+
else if ("type" in option && option.type === "group") return option.children.some((child) => {
|
|
190
|
+
if (y(child)) return modelValue.value === child;
|
|
191
|
+
else {
|
|
192
|
+
if (child.value === modelValue.value) {
|
|
193
|
+
currentLabel = child.label;
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
else {
|
|
200
|
+
if (option.value === modelValue.value) {
|
|
201
|
+
currentLabel = option.label;
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
return currentLabel;
|
|
208
|
+
});
|
|
209
|
+
const wrapperRef = shallowRef(null);
|
|
210
|
+
const contentRef = shallowRef(null);
|
|
211
|
+
const canvasRef = shallowRef(null);
|
|
212
|
+
const inputRef = shallowRef(null);
|
|
213
|
+
const popoverRef = shallowRef(null);
|
|
214
|
+
const closeRef = shallowRef(null);
|
|
215
|
+
watch(() => props.multiple, (val, old) => {
|
|
216
|
+
if (val && !old) updateModelValue([modelValue.value]);
|
|
217
|
+
else updateModelValue(modelValue.value[0] || null);
|
|
218
|
+
});
|
|
219
|
+
const triggerPopover = async () => {
|
|
220
|
+
await nextTick();
|
|
221
|
+
if (props.shouldShowPopover) {
|
|
222
|
+
popoverVisible.value = !!props.shouldShowPopover(inputValue.value || "", optionsFiltered.value);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
popoverVisible.value = true;
|
|
226
|
+
};
|
|
227
|
+
const closePopover = async () => {
|
|
228
|
+
popoverVisible.value = false;
|
|
229
|
+
};
|
|
230
|
+
const inputHandler = async (e) => {
|
|
231
|
+
e.stopPropagation();
|
|
232
|
+
const newValue = e.target.value;
|
|
233
|
+
inputValue.value = newValue;
|
|
234
|
+
if (isComposing.value) return;
|
|
235
|
+
emits("input", newValue, e);
|
|
236
|
+
updateInputValue(newValue);
|
|
237
|
+
await emits("update:inputValue", newValue);
|
|
238
|
+
triggerPopover();
|
|
239
|
+
};
|
|
240
|
+
const clearHandler = async () => {
|
|
241
|
+
await new Promise((res) => setTimeout(res));
|
|
242
|
+
const nextModelValue = props.multiple ? [] : null;
|
|
243
|
+
await updateInputValue("");
|
|
244
|
+
await updateModelValue(nextModelValue);
|
|
245
|
+
emits("change", nextModelValue);
|
|
246
|
+
emits("clear", nextModelValue);
|
|
247
|
+
emits("inputChange", "");
|
|
248
|
+
formItemProvide === null || formItemProvide === void 0 || formItemProvide.changeHandler();
|
|
249
|
+
};
|
|
250
|
+
const changeHandler = (e) => {
|
|
251
|
+
e.stopPropagation();
|
|
252
|
+
const target = e.target;
|
|
253
|
+
emits("inputChange", target.value, e);
|
|
254
|
+
};
|
|
255
|
+
const [wait, cancel] = useCancelableDelay();
|
|
256
|
+
const focusMode = ref(false);
|
|
257
|
+
const focusImpl = async (e) => {
|
|
258
|
+
if (disabledComputed.value || readonlyComputed.value) return;
|
|
259
|
+
cancel();
|
|
260
|
+
focusMode.value = true;
|
|
261
|
+
nextTick(() => {
|
|
262
|
+
if (inputRef.value && props.filterable) {
|
|
263
|
+
inputRef.value.focus();
|
|
264
|
+
if (props.multiple) return;
|
|
265
|
+
updateInputValue(modelValueIsFalse(modelValue.value) ? inputValue.value || "" : currentLabelSelected.value);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
triggerPopover();
|
|
269
|
+
emits("focus", e);
|
|
270
|
+
};
|
|
271
|
+
const focusInputHandler = async (e) => {
|
|
272
|
+
var _contentRef$value;
|
|
273
|
+
if (disabledComputed.value || readonlyComputed.value) return;
|
|
274
|
+
const target = e.target;
|
|
275
|
+
if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
276
|
+
var _closeRef$value;
|
|
277
|
+
if ((_closeRef$value = closeRef.value) === null || _closeRef$value === void 0 ? void 0 : _closeRef$value.$el.contains(target)) return;
|
|
278
|
+
}
|
|
279
|
+
(_contentRef$value = contentRef.value) === null || _contentRef$value === void 0 || _contentRef$value.focus();
|
|
280
|
+
};
|
|
281
|
+
const blurSelectImpl = async () => {
|
|
282
|
+
var _inputRef$value, _contentRef$value2;
|
|
283
|
+
const next = await wait();
|
|
284
|
+
if (!next) return next;
|
|
285
|
+
focusMode.value = false;
|
|
286
|
+
closePopover();
|
|
287
|
+
(_inputRef$value = inputRef.value) === null || _inputRef$value === void 0 || _inputRef$value.blur();
|
|
288
|
+
(_contentRef$value2 = contentRef.value) === null || _contentRef$value2 === void 0 || _contentRef$value2.blur();
|
|
289
|
+
setTimeout(async () => {
|
|
290
|
+
await updateInputValue("");
|
|
291
|
+
emits("inputChange", "");
|
|
292
|
+
}, ANIMATION_DURATION);
|
|
293
|
+
return next;
|
|
294
|
+
};
|
|
295
|
+
const blurSelect = async (e) => {
|
|
296
|
+
if (!await blurSelectImpl()) return;
|
|
297
|
+
emits("blur", e);
|
|
298
|
+
formItemProvide === null || formItemProvide === void 0 || formItemProvide.blurHandler();
|
|
299
|
+
};
|
|
300
|
+
const focusoutHandler = (e) => {
|
|
301
|
+
var _popoverRef$value, _wrapperRef$value;
|
|
302
|
+
const relatedTarget = e.relatedTarget;
|
|
303
|
+
if (relatedTarget && ((_popoverRef$value = popoverRef.value) === null || _popoverRef$value === void 0 || (_popoverRef$value = _popoverRef$value.triggerContent) === null || _popoverRef$value === void 0 || (_popoverRef$value = _popoverRef$value.content) === null || _popoverRef$value === void 0 ? void 0 : _popoverRef$value.contains(relatedTarget))) return;
|
|
304
|
+
if (relatedTarget && ((_wrapperRef$value = wrapperRef.value) === null || _wrapperRef$value === void 0 ? void 0 : _wrapperRef$value.contains(relatedTarget))) return;
|
|
305
|
+
blurSelect(e);
|
|
306
|
+
};
|
|
307
|
+
const hoverFlag = ref(false);
|
|
308
|
+
const mouseenterHandler = () => {
|
|
309
|
+
hoverFlag.value = true;
|
|
310
|
+
};
|
|
311
|
+
const mouseleaveHandler = () => {
|
|
312
|
+
hoverFlag.value = false;
|
|
313
|
+
};
|
|
314
|
+
const showClose = computed(() => {
|
|
315
|
+
return props.clearable && !disabledComputed.value && !readonlyComputed.value;
|
|
316
|
+
});
|
|
317
|
+
const getNextModelValue = (value) => {
|
|
318
|
+
if (!props.multiple) return value;
|
|
319
|
+
else if (S(modelValue.value)) {
|
|
320
|
+
const nextValue = [...modelValue.value];
|
|
321
|
+
const idx = nextValue.findIndex((e) => e === value);
|
|
322
|
+
if (idx === -1) nextValue.push(value);
|
|
323
|
+
else nextValue.splice(idx, 1);
|
|
324
|
+
return nextValue;
|
|
325
|
+
} else return [value];
|
|
326
|
+
};
|
|
327
|
+
const selectHandler = async (value, option, e) => {
|
|
328
|
+
await new Promise((res) => setTimeout(res));
|
|
329
|
+
const nextValue = getNextModelValue(value);
|
|
330
|
+
const nextInputValue = "";
|
|
331
|
+
await updateModelValue(nextValue);
|
|
332
|
+
if (!props.multiple) {
|
|
333
|
+
focusMode.value = false;
|
|
334
|
+
closePopover();
|
|
335
|
+
emits("select", nextValue, option, e);
|
|
336
|
+
emits("change", nextValue);
|
|
337
|
+
formItemProvide === null || formItemProvide === void 0 || formItemProvide.changeHandler();
|
|
338
|
+
setTimeout(async () => {
|
|
339
|
+
await updateInputValue(nextInputValue);
|
|
340
|
+
}, ANIMATION_DURATION);
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
const slots = useSlots();
|
|
344
|
+
const optionsFiltered = computed(() => {
|
|
345
|
+
const options = props.options || [];
|
|
346
|
+
if (!props.filterable) return options;
|
|
347
|
+
let ans = [];
|
|
348
|
+
if (props.filter) ans = props.filter(inputValue.value || "", options);
|
|
349
|
+
else ans = defaultFilter(inputValue.value || "", options);
|
|
350
|
+
if (props.multiple) {
|
|
351
|
+
if (!modelValueIsFalse(modelValue.value)) modelValue.value.forEach((e) => {
|
|
352
|
+
const dataInAns4E = findSameOption(e, ans);
|
|
353
|
+
const dataInOptions4E = findSameOption(e, options);
|
|
354
|
+
if (!dataInAns4E.length) if (!dataInOptions4E.length) ans.push(e);
|
|
355
|
+
else if (dataInOptions4E.length === 1) ans.push(dataInOptions4E[0]);
|
|
356
|
+
else {
|
|
357
|
+
const group = dataInOptions4E[1];
|
|
358
|
+
const idx = ans.findIndex((e$1) => d(e$1) && "type" in e$1 && e$1.type === "group" && e$1.key === group.key);
|
|
359
|
+
if (idx) ans[idx].children.push(dataInOptions4E[0]);
|
|
360
|
+
else ans.push({
|
|
361
|
+
...group,
|
|
362
|
+
children: [dataInOptions4E[0]]
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
if (props.creatable && inputValue.value) {
|
|
368
|
+
if (!findSameOption(inputValue.value, ans, true).length) ans.push(inputValue.value);
|
|
369
|
+
}
|
|
370
|
+
return ans;
|
|
371
|
+
});
|
|
372
|
+
__expose({
|
|
373
|
+
focus: () => {
|
|
374
|
+
var _contentRef$value3;
|
|
375
|
+
if (disabledComputed.value || readonlyComputed.value) return;
|
|
376
|
+
(_contentRef$value3 = contentRef.value) === null || _contentRef$value3 === void 0 || _contentRef$value3.focus();
|
|
377
|
+
},
|
|
378
|
+
blur: () => {
|
|
379
|
+
blurSelectImpl();
|
|
380
|
+
},
|
|
381
|
+
clear: () => clearHandler(),
|
|
382
|
+
[GET_ELEMENT_RENDERED]: () => wrapperRef.value
|
|
383
|
+
});
|
|
384
|
+
const popoverVisible = ref(false);
|
|
385
|
+
const popoverVisibleUpdateHandler = (value) => {
|
|
386
|
+
if (!value) popoverVisible.value = value;
|
|
387
|
+
};
|
|
388
|
+
const showPlaceholder = computed(() => {
|
|
389
|
+
return modelValueIsFalse(modelValue.value) && (!props.multiple && !currentLabelSelected.value || props.multiple);
|
|
390
|
+
});
|
|
391
|
+
const tagSize = computed(() => {
|
|
392
|
+
return sizeComputed.value === "small" ? "small" : "medium";
|
|
393
|
+
});
|
|
394
|
+
const tagCanClose = computed(() => {
|
|
395
|
+
return !disabledComputed.value && !readonlyComputed.value;
|
|
396
|
+
});
|
|
397
|
+
const tagCloseHandler = async (value, e) => {
|
|
398
|
+
const nextValue = [...modelValue.value];
|
|
399
|
+
const idx = nextValue.findIndex((e$1) => e$1 === value);
|
|
400
|
+
if (idx === -1) return;
|
|
401
|
+
nextValue.splice(idx, 1);
|
|
402
|
+
await updateModelValue(nextValue);
|
|
403
|
+
emits("tagClose", value, e);
|
|
404
|
+
emits("change", nextValue);
|
|
405
|
+
formItemProvide === null || formItemProvide === void 0 || formItemProvide.changeHandler();
|
|
406
|
+
};
|
|
407
|
+
const shouldCollapseTags = computed(() => {
|
|
408
|
+
return !!props.collapseTags && A(props.maxDisplayTags) && props.maxDisplayTags >= 0;
|
|
409
|
+
});
|
|
410
|
+
const tagsShowed = computed(() => {
|
|
411
|
+
if (!props.multiple) return [];
|
|
412
|
+
if (!props.options.length) return [];
|
|
413
|
+
if (E(modelValue.value)) return [];
|
|
414
|
+
return shouldCollapseTags.value ? modelValue.value.slice(0, props.maxDisplayTags) : modelValue.value;
|
|
415
|
+
});
|
|
416
|
+
const tagsCollapsed = computed(() => {
|
|
417
|
+
if (!props.multiple) return [];
|
|
418
|
+
if (!props.options.length) return [];
|
|
419
|
+
if (E(modelValue.value)) return [];
|
|
420
|
+
return shouldCollapseTags.value ? modelValue.value.slice(props.maxDisplayTags) : [];
|
|
421
|
+
});
|
|
422
|
+
watch([
|
|
423
|
+
first,
|
|
424
|
+
last,
|
|
425
|
+
borderRadiusComputed,
|
|
426
|
+
shapeComputed,
|
|
427
|
+
sizeComputed,
|
|
428
|
+
readonlyComputed,
|
|
429
|
+
disabledComputed,
|
|
430
|
+
() => slots,
|
|
431
|
+
useDarkMode(),
|
|
432
|
+
focusMode,
|
|
433
|
+
hoverFlag,
|
|
434
|
+
statusComputed,
|
|
435
|
+
nextIsTextButton
|
|
436
|
+
], () => {
|
|
437
|
+
drawPixel();
|
|
438
|
+
});
|
|
439
|
+
const drawPixel = () => {
|
|
440
|
+
const preprocessData = canvasPreprocess(wrapperRef, canvasRef);
|
|
441
|
+
if (!preprocessData) return;
|
|
442
|
+
const { ctx, width, height, canvas } = preprocessData;
|
|
443
|
+
const pixelSize = calcPixelSize();
|
|
444
|
+
const borderRadius = getBorderRadius(canvas, pixelSize, borderRadiusComputed.value, shapeComputed.value, sizeComputed.value || "medium", innerInputGroup.value, first.value, last.value);
|
|
445
|
+
const borderColor = statusComputed.value !== "normal" ? getGlobalThemeColor(statusComputed.value === "error" ? "danger" : statusComputed.value, 6) : (hoverFlag.value || focusMode.value) && !disabledComputed.value && !readonlyComputed.value ? getGlobalThemeColor("primary", 6) : getGlobalThemeColor("neutral", 10);
|
|
446
|
+
const center = calcBorderCornerCenter(borderRadius, width, height, pixelSize);
|
|
447
|
+
const rad = BORDER_CORNER_RAD_RANGE;
|
|
448
|
+
if (borderColor) drawBorder(ctx, width, height, center, borderRadius, rad, borderColor, pixelSize, innerInputGroup.value, first.value, last.value, nextIsTextButton.value);
|
|
449
|
+
const backgroundColor = disabledComputed.value ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 1);
|
|
450
|
+
if (backgroundColor) floodFill(ctx, Math.round(width / 2), Math.round(height / 2), backgroundColor);
|
|
451
|
+
};
|
|
452
|
+
onMounted(() => {
|
|
453
|
+
nextTick(() => {
|
|
454
|
+
drawPixel();
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
useResizeObserver(wrapperRef, drawPixel);
|
|
458
|
+
useWatchGlobalCssVal(drawPixel);
|
|
459
|
+
useTransitionEnd(wrapperRef, drawPixel);
|
|
460
|
+
const popoverProps = computed(() => {
|
|
461
|
+
var _props$popoverProps;
|
|
462
|
+
return {
|
|
463
|
+
...props.popoverProps,
|
|
464
|
+
contentStyle: {
|
|
465
|
+
maxWidth: `400px`,
|
|
466
|
+
...(_props$popoverProps = props.popoverProps) === null || _props$popoverProps === void 0 ? void 0 : _props$popoverProps.contentStyle
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
});
|
|
470
|
+
return () => {
|
|
471
|
+
const Inner = createVNode(Fragment, null, [
|
|
472
|
+
slots.prefix && createVNode("div", { "class": "px-select-prefix-wrapper" }, [slots.prefix()]),
|
|
473
|
+
createVNode("div", {
|
|
474
|
+
"class": "px-select-content",
|
|
475
|
+
"ref": contentRef,
|
|
476
|
+
"tabindex": disabledComputed.value || readonlyComputed.value ? -1 : 0
|
|
477
|
+
}, [
|
|
478
|
+
props.multiple && tagsShowed.value.map((e, index$1) => {
|
|
479
|
+
return createVNode(tag_default, mergeProps({
|
|
480
|
+
"key": e,
|
|
481
|
+
"size": tagSize.value,
|
|
482
|
+
"variant": props.tagVariant,
|
|
483
|
+
"theme": props.tagTheme,
|
|
484
|
+
"closable": tagCanClose.value,
|
|
485
|
+
"disabled": disabledComputed.value,
|
|
486
|
+
"color": props.tagColor
|
|
487
|
+
}, props.tagProps, { "onClose": (event) => tagCloseHandler(e, event) }), { default: () => slots.tag ? slots.tag({
|
|
488
|
+
value: e,
|
|
489
|
+
label: currentLabelSelectedMultiple.value[index$1],
|
|
490
|
+
index: index$1,
|
|
491
|
+
disabled: disabledComputed.value,
|
|
492
|
+
readonly: readonlyComputed.value
|
|
493
|
+
}) : currentLabelSelectedMultiple.value[index$1] });
|
|
494
|
+
}),
|
|
495
|
+
props.multiple && !!tagsCollapsed.value.length && shouldCollapseTags.value && createVNode(Fragment, null, [!props.collapseTagsPopover ? createVNode(tag_default, mergeProps({
|
|
496
|
+
"size": tagSize.value,
|
|
497
|
+
"variant": props.tagVariant,
|
|
498
|
+
"theme": props.tagTheme,
|
|
499
|
+
"disabled": disabledComputed.value,
|
|
500
|
+
"color": props.tagColor
|
|
501
|
+
}, props.tagProps), { default: () => slots.tag ? slots.tag({
|
|
502
|
+
value: null,
|
|
503
|
+
label: `+${tagsCollapsed.value.length}`,
|
|
504
|
+
index: -1,
|
|
505
|
+
disabled: disabledComputed.value,
|
|
506
|
+
readonly: readonlyComputed.value
|
|
507
|
+
}) : `+${tagsCollapsed.value.length}` }) : createVNode(popover_default, popoverProps.value, {
|
|
508
|
+
default: () => createVNode(tag_default, mergeProps({
|
|
509
|
+
"size": tagSize.value,
|
|
510
|
+
"variant": props.tagVariant,
|
|
511
|
+
"theme": props.tagTheme,
|
|
512
|
+
"disabled": disabledComputed.value,
|
|
513
|
+
"color": props.tagColor
|
|
514
|
+
}, props.tagProps), { default: () => slots.tag ? slots.tag({
|
|
515
|
+
value: null,
|
|
516
|
+
label: `+${tagsCollapsed.value.length}`,
|
|
517
|
+
index: -1,
|
|
518
|
+
disabled: disabledComputed.value,
|
|
519
|
+
readonly: readonlyComputed.value
|
|
520
|
+
}) : `+${tagsCollapsed.value.length}` }),
|
|
521
|
+
content: () => createVNode("div", { "class": "px-input-tag-content" }, [tagsCollapsed.value.map((e, index$1) => {
|
|
522
|
+
return createVNode(tag_default, mergeProps({
|
|
523
|
+
"key": e,
|
|
524
|
+
"size": tagSize.value,
|
|
525
|
+
"variant": props.tagVariant,
|
|
526
|
+
"theme": props.tagTheme,
|
|
527
|
+
"disabled": disabledComputed.value,
|
|
528
|
+
"color": props.tagColor,
|
|
529
|
+
"closable": tagCanClose.value
|
|
530
|
+
}, props.tagProps, { "onClose": (event) => tagCloseHandler(e, event) }), { default: () => {
|
|
531
|
+
const currentIndex = index$1 + Math.floor(props.maxDisplayTags);
|
|
532
|
+
return slots.tag ? slots.tag({
|
|
533
|
+
value: e,
|
|
534
|
+
label: currentLabelSelectedMultiple.value[currentIndex],
|
|
535
|
+
index: currentIndex,
|
|
536
|
+
disabled: disabledComputed.value,
|
|
537
|
+
readonly: readonlyComputed.value
|
|
538
|
+
}) : currentLabelSelectedMultiple.value[currentIndex];
|
|
539
|
+
} });
|
|
540
|
+
})])
|
|
541
|
+
})]),
|
|
542
|
+
withDirectives(createVNode("input", {
|
|
543
|
+
"tabindex": -1,
|
|
544
|
+
"ref": inputRef,
|
|
545
|
+
"class": "px-select-inner",
|
|
546
|
+
"value": inputValue.value,
|
|
547
|
+
"disabled": disabledComputed.value || readonlyComputed.value,
|
|
548
|
+
"onInput": inputHandler,
|
|
549
|
+
"onChange": changeHandler,
|
|
550
|
+
"onCompositionstart": compositionStartHandler,
|
|
551
|
+
"onCompositionend": compositionUpdateHandler,
|
|
552
|
+
"placeholder": showPlaceholder.value ? props.placeholder : ""
|
|
553
|
+
}, null), [[vShow, props.filterable && focusMode.value]]),
|
|
554
|
+
withDirectives(createVNode("div", { "class": { "px-select-placeholder": true } }, [props.placeholder]), [[vShow, showPlaceholder.value && (!props.filterable || !focusMode.value)]]),
|
|
555
|
+
!props.multiple && withDirectives(createVNode("div", { "class": {
|
|
556
|
+
"px-select-label": true,
|
|
557
|
+
"px-select-label__disabled": disabledComputed.value
|
|
558
|
+
} }, [slots.label ? slots.label({
|
|
559
|
+
label: currentLabelSelected.value,
|
|
560
|
+
value: modelValue.value,
|
|
561
|
+
disabled: disabledComputed.value,
|
|
562
|
+
readonly: readonlyComputed.value
|
|
563
|
+
}) : currentLabelSelected.value]), [[vShow, !showPlaceholder.value && (!props.filterable || !focusMode.value)]])
|
|
564
|
+
]),
|
|
565
|
+
showClose.value && createVNode("div", { "class": "px-select-close-wrapper" }, [hoverFlag.value && !modelValueIsFalse(modelValue.value) ? createVNode(times_circle_solid_default, {
|
|
566
|
+
"class": "px-select-icon",
|
|
567
|
+
"onClick": clearHandler,
|
|
568
|
+
"ref": (el) => {
|
|
569
|
+
closeRef.value = el;
|
|
570
|
+
}
|
|
571
|
+
}, null) : createVNode("div", { "class": "px-select-icon-placeholder" }, null)]),
|
|
572
|
+
props.loading && createVNode("div", { "class": "px-select-loading-wrapper" }, [createVNode(spinner_third_solid_default, { "class": "px-select-icon px-animation__loading" }, null)]),
|
|
573
|
+
slots.suffix && createVNode("div", { "class": "px-select-suffix-wrapper" }, [slots.suffix()]),
|
|
574
|
+
createVNode("canvas", {
|
|
575
|
+
"ref": canvasRef,
|
|
576
|
+
"class": "px-select-canvas"
|
|
577
|
+
}, null)
|
|
578
|
+
]);
|
|
579
|
+
const scopeObj = {};
|
|
580
|
+
const scopeId = instance === null || instance === void 0 ? void 0 : instance.vnode.scopeId;
|
|
581
|
+
const parentScopeId = instance === null || instance === void 0 ? void 0 : instance.vnode.scopeId;
|
|
582
|
+
if (scopeId) scopeObj[scopeId] = "";
|
|
583
|
+
if (parentScopeId) scopeObj[parentScopeId] = "";
|
|
584
|
+
const pixelSize = calcPixelSize();
|
|
585
|
+
return createVNode(popover_default, {
|
|
586
|
+
"placement": "bottom",
|
|
587
|
+
"offset": 0,
|
|
588
|
+
"width-equal": true,
|
|
589
|
+
"arrow": false,
|
|
590
|
+
"visible": popoverVisible.value,
|
|
591
|
+
"onUpdate:visible": popoverVisibleUpdateHandler,
|
|
592
|
+
"trigger": "click",
|
|
593
|
+
"contentStyle": { padding: `${pixelSize}px` },
|
|
594
|
+
"ref": popoverRef,
|
|
595
|
+
"destroyOnHide": props.optionsDestroyOnHide
|
|
596
|
+
}, {
|
|
597
|
+
default: () => h("div", mergeProps({
|
|
598
|
+
ref: wrapperRef,
|
|
599
|
+
class: [
|
|
600
|
+
"pixelium px-select",
|
|
601
|
+
sizeComputed.value && `px-select__${sizeComputed.value}`,
|
|
602
|
+
shapeComputed.value && `px-select__${shapeComputed.value}`,
|
|
603
|
+
{ "px-select__inner": innerInputGroup.value },
|
|
604
|
+
{ "px-select__disabled": disabledComputed.value }
|
|
605
|
+
],
|
|
606
|
+
onFocusin: focusImpl,
|
|
607
|
+
onFocusout: focusoutHandler,
|
|
608
|
+
onClick: focusInputHandler,
|
|
609
|
+
onMouseenter: mouseenterHandler,
|
|
610
|
+
onMouseleave: mouseleaveHandler,
|
|
611
|
+
...scopeObj
|
|
612
|
+
}, attrs), [Inner]),
|
|
613
|
+
content: () => optionsFiltered.value.length ? createVNode(option_list_default, {
|
|
614
|
+
"options": optionsFiltered.value,
|
|
615
|
+
"onSelect": selectHandler,
|
|
616
|
+
"activeValues": props.multiple ? modelValue.value : [modelValue.value],
|
|
617
|
+
"virtualScroll": props.virtualScroll,
|
|
618
|
+
"virtualListProps": props.virtualListProps
|
|
619
|
+
}, {
|
|
620
|
+
"group-label": ({ option }) => slots["group-label"] ? slots["group-label"]({ option }) : option.label,
|
|
621
|
+
option: ({ option }) => slots.option ? slots.option({ option }) : y(option) ? option : option.label
|
|
622
|
+
}) : createVNode("div", { "class": "px-select-empty" }, [createVNode(empty_default, null, null)])
|
|
623
|
+
});
|
|
624
|
+
};
|
|
625
|
+
}
|
|
671
626
|
});
|
|
672
|
-
export {
|
|
673
|
-
_sfc_main as _
|
|
674
|
-
};
|
|
627
|
+
export { select_default as t };
|