vue3-extended-multiselect 1.7.0 → 1.7.2
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/.browserslistrc +2 -2
- package/.eslintrc.js +34 -34
- package/.github/workflows/publish.yml +41 -41
- package/CHANGELOG.md +284 -275
- package/LICENSE +21 -21
- package/README.md +267 -267
- package/babel.config.js +9 -9
- package/index.js +2 -2
- package/jest.config.js +61 -61
- package/package.json +46 -46
- package/src/assets/base-arrow.svg +70 -70
- package/src/assets/cancel.svg +34 -34
- package/src/assets/circle-arrow.svg +7 -7
- package/src/assets/double-arrow.svg +39 -39
- package/src/assets/inner-arrow.svg +8 -8
- package/src/assets/loader.svg +5 -5
- package/src/assets/triangle-arrow.svg +72 -72
- package/src/assets/triangle-circle-arrow.svg +38 -38
- package/src/assets/wide-arrow.svg +72 -72
- package/src/components/ExtendedMultiselectCancel.vue +165 -165
- package/src/components/ExtendedMultiselectInput.vue +705 -705
- package/src/components/ExtendedMultiselectLoader.vue +182 -182
- package/src/components/ExtendedMultiselectMultiple.vue +365 -365
- package/src/components/ExtendedMultiselectOptions.vue +1168 -1168
- package/src/components/ExtendedMultiselectToggle.vue +271 -271
- package/src/components/Vue3ExtendedMultiselect.vue +1803 -1783
- package/src/composition/cancel.js +36 -36
- package/src/composition/click-outside.js +8 -8
- package/src/composition/emitter.js +8 -8
- package/src/composition/image-path.js +16 -16
- package/src/composition/labels.js +41 -41
- package/src/composition/preselected-options.js +67 -67
- package/src/composition/search-value.js +33 -33
- package/src/composition/sizes.js +44 -44
- package/src/composition/toggle.js +31 -31
- package/src/events/LocalEmitter.js +31 -31
- package/src/events/instance.js +3 -0
- package/src/sets/sets.js +99 -99
- package/src/styles/animations.css +18 -18
- package/src/styles/main.css +454 -454
- package/src/styles/variables.css +49 -49
- package/tests/unit/events.spec.js +136 -136
- package/tests/unit/props.spec.js +1128 -1128
- package/tests/utils/mount.js +37 -37
- package/tests/utils/utils.js +20 -20
- package/typings/vue3-extended-multiselect.d.ts +43 -43
|
@@ -1,1784 +1,1804 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section
|
|
3
|
-
aria-owns="extended-search-field"
|
|
4
|
-
ref="extendedMultiselectWrapper"
|
|
5
|
-
role="combobox"
|
|
6
|
-
:aria-roledescription="roledescription"
|
|
7
|
-
:class="wrapperClasses"
|
|
8
|
-
:tabindex="tabindexIfSearch"
|
|
9
|
-
@click.stop.left="fieldFocus"
|
|
10
|
-
@click.stop.middle="fieldFocus"
|
|
11
|
-
@keyup.stop.esc="rollUp"
|
|
12
|
-
@keyup.stop.enter="selectByEnter"
|
|
13
|
-
@mousedown.stop.left="toggleRestrictor"
|
|
14
|
-
@mousedown.stop.middle="toggleRestrictor"
|
|
15
|
-
@mouseleave.stop="resetEnterIndex"
|
|
16
|
-
>
|
|
17
|
-
<div
|
|
18
|
-
ref="extendedMultiselect"
|
|
19
|
-
:class="classes"
|
|
20
|
-
:style="[displayWrongValue, expanded]"
|
|
21
|
-
>
|
|
22
|
-
<div>
|
|
23
|
-
<extended-multiselect-input
|
|
24
|
-
:accesskey="attrs.accesskey"
|
|
25
|
-
:autocomplete="attrs.autocomplete"
|
|
26
|
-
:name="attrs.name"
|
|
27
|
-
:spellcheck="attrs.spellcheck"
|
|
28
|
-
:tabindex="attrs.tabindex"
|
|
29
|
-
:translate="attrs.translate"
|
|
30
|
-
:auto-select-search-value="autoSelectSearchValue"
|
|
31
|
-
:create-on-the-go="createOnTheGo"
|
|
32
|
-
:disabled="disabled"
|
|
33
|
-
:dropdown-active="dropdownActive"
|
|
34
|
-
:loading="internalLoading"
|
|
35
|
-
:icon-filter="iconFilter"
|
|
36
|
-
:multiple="multiple"
|
|
37
|
-
:search-filter-active="searchFilterActive"
|
|
38
|
-
:show-deselect-icon-loader="showDeselectIconLoader"
|
|
39
|
-
:toggling-saves-search-value="togglingSavesSearchValue"
|
|
40
|
-
:toggle-options-by-select="toggleOptionsBySelect"
|
|
41
|
-
:placeholder="placeholder"
|
|
42
|
-
:show-search-field="showSearchField"
|
|
43
|
-
:empty-objects-placeholder="emptyObjectsPlaceholder"
|
|
44
|
-
:label="label"
|
|
45
|
-
:multiple-blocks-limit-message="multipleBlocksLimitMessage"
|
|
46
|
-
:theme-type="themeType"
|
|
47
|
-
:increase-display-by="increaseDisplayBy"
|
|
48
|
-
:multipleBlocksLimit="multipleBlocksLimit"
|
|
49
|
-
:restricted-options-length="restrictedOptionsLength"
|
|
50
|
-
:toggle-multiple-blocks-limit="toggleMultipleBlocksLimit"
|
|
51
|
-
:selected-options="selectedOptions"
|
|
52
|
-
:emitter="emitter"
|
|
53
|
-
:create-custom-option-label="createCustomOptionLabel"
|
|
54
|
-
:create-option-placeholder="createOptionPlaceholder"
|
|
55
|
-
:external-options-loader="externalOptionsLoader"
|
|
56
|
-
:input-id="inputId"
|
|
57
|
-
>
|
|
58
|
-
<template
|
|
59
|
-
v-if="!showSearchField"
|
|
60
|
-
#labelBlock="{ labelBlockValue }"
|
|
61
|
-
>
|
|
62
|
-
<slot
|
|
63
|
-
name="labelBlock"
|
|
64
|
-
:label="labelBlockValue"
|
|
65
|
-
>
|
|
66
|
-
</slot>
|
|
67
|
-
</template>
|
|
68
|
-
<template #optionBlock="{ label, deselectBlock, index }">
|
|
69
|
-
<slot
|
|
70
|
-
name="optionBlock"
|
|
71
|
-
:label="label"
|
|
72
|
-
:index="index"
|
|
73
|
-
:deselect-block="deselectBlock"
|
|
74
|
-
>
|
|
75
|
-
</slot>
|
|
76
|
-
</template>
|
|
77
|
-
<template
|
|
78
|
-
#maxElements
|
|
79
|
-
>
|
|
80
|
-
<slot name="maxElements"></slot>
|
|
81
|
-
</template>
|
|
82
|
-
<template
|
|
83
|
-
v-if="toggleMultipleBlocksLimit"
|
|
84
|
-
#showMore="{ showMoreOptions }"
|
|
85
|
-
>
|
|
86
|
-
<slot
|
|
87
|
-
name="showMore"
|
|
88
|
-
:increase="showMoreOptions"
|
|
89
|
-
>
|
|
90
|
-
</slot>
|
|
91
|
-
</template>
|
|
92
|
-
</extended-multiselect-input>
|
|
93
|
-
</div>
|
|
94
|
-
<div class="extended__multiselect-toggle_wrapper">
|
|
95
|
-
<slot
|
|
96
|
-
name="toggle"
|
|
97
|
-
:toggle-options-list="toggleOptionsList"
|
|
98
|
-
>
|
|
99
|
-
<extended-multiselect-toggle
|
|
100
|
-
ref="extendedMultiselectToggle"
|
|
101
|
-
:tabindex="attrs.tabindex"
|
|
102
|
-
:disabled="disabled"
|
|
103
|
-
:dropdown-active="dropdownActive"
|
|
104
|
-
:loading="internalLoading"
|
|
105
|
-
:icon-filter="iconFilter"
|
|
106
|
-
:icon-size="iconSize"
|
|
107
|
-
:toggle-icon="toggleIcon"
|
|
108
|
-
:emitter="emitter"
|
|
109
|
-
/>
|
|
110
|
-
</slot>
|
|
111
|
-
</div>
|
|
112
|
-
<div class="extended__multiselect-cancel_wrapper">
|
|
113
|
-
<slot
|
|
114
|
-
name="cancel"
|
|
115
|
-
:cancel="cancel"
|
|
116
|
-
>
|
|
117
|
-
<extended-multiselect-cancel
|
|
118
|
-
v-if="showClearIcon"
|
|
119
|
-
:tabindex="attrs.tabindex"
|
|
120
|
-
:disabled="disabled"
|
|
121
|
-
:show-search-field="showSearchField"
|
|
122
|
-
:loading="internalLoading"
|
|
123
|
-
:icon-filter="iconFilter"
|
|
124
|
-
:icon-size="iconSize"
|
|
125
|
-
:selected-options="selectedOptions"
|
|
126
|
-
:emitter="emitter"
|
|
127
|
-
/>
|
|
128
|
-
</slot>
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
<transition
|
|
132
|
-
name="extended-toggle"
|
|
133
|
-
type="transition"
|
|
134
|
-
>
|
|
135
|
-
<extended-multiselect-options
|
|
136
|
-
v-if="dropdownActive"
|
|
137
|
-
:auto-select-created-option="autoSelectCreatedOption"
|
|
138
|
-
:clear-by-select-when-multiple="clearBySelectWhenMultiple"
|
|
139
|
-
:create-on-the-go="createOnTheGo"
|
|
140
|
-
:disabled-primitive-options-converted="disabledPrimitiveOptionsConverted"
|
|
141
|
-
:highlight-options="highlightOptions"
|
|
142
|
-
:loading="internalLoading"
|
|
143
|
-
:multiple="multiple"
|
|
144
|
-
:selected-options-shown="selectedOptionsShown"
|
|
145
|
-
:show-insert-warnings="showInsertWarnings"
|
|
146
|
-
:show-marker="showMarker"
|
|
147
|
-
:chosen-toggle-appearance-side="chosenToggleAppearanceSide"
|
|
148
|
-
:create-option-type="createOptionType"
|
|
149
|
-
:disable-by-field="disableByField"
|
|
150
|
-
:empty-objects-placeholder="emptyObjectsPlaceholder"
|
|
151
|
-
:label="label"
|
|
152
|
-
:search-by-field="searchByField"
|
|
153
|
-
:theme-type="themeType"
|
|
154
|
-
:any-option-wrapper-block-height="anyOptionWrapperBlockHeight"
|
|
155
|
-
:max-options-count="maxOptionsCount"
|
|
156
|
-
:min-options-count="minOptionsCount"
|
|
157
|
-
:options-padding="optionsPadding"
|
|
158
|
-
:toggle-max-height="toggleMaxHeight"
|
|
159
|
-
:toggle-min-height="toggleMinHeight"
|
|
160
|
-
:create-option-fields="createOptionFields"
|
|
161
|
-
:options="restrictedOptions"
|
|
162
|
-
:restricted-options="restrictedOptions"
|
|
163
|
-
:selected-options="selectedOptions"
|
|
164
|
-
:special-keys-block="specialKeysBlock"
|
|
165
|
-
:preselected-option="preselectedOption"
|
|
166
|
-
:preselected-options="preselectedOptions"
|
|
167
|
-
:emitter="emitter"
|
|
168
|
-
:create-custom-option-label="createCustomOptionLabel"
|
|
169
|
-
:external-options-loader="externalOptionsLoader"
|
|
170
|
-
>
|
|
171
|
-
<template
|
|
172
|
-
v-if="slots.listHeader"
|
|
173
|
-
#listHeader
|
|
174
|
-
>
|
|
175
|
-
<slot name="listHeader"></slot>
|
|
176
|
-
</template>
|
|
177
|
-
<template
|
|
178
|
-
v-if="maxOptionsCount"
|
|
179
|
-
#moreThanLimit
|
|
180
|
-
>
|
|
181
|
-
<slot name="moreThanLimit"></slot>
|
|
182
|
-
</template>
|
|
183
|
-
<template
|
|
184
|
-
v-if="minOptionsCount"
|
|
185
|
-
#lessThanLimit
|
|
186
|
-
>
|
|
187
|
-
<slot name="lessThanLimit"></slot>
|
|
188
|
-
</template>
|
|
189
|
-
<template #option="{ option, createCustomOptionLabel }">
|
|
190
|
-
<slot
|
|
191
|
-
name="option"
|
|
192
|
-
:option="option"
|
|
193
|
-
:create-custom-option-label="createCustomOptionLabel"
|
|
194
|
-
>
|
|
195
|
-
</slot>
|
|
196
|
-
</template>
|
|
197
|
-
<template #marker>
|
|
198
|
-
<slot name="marker"></slot>
|
|
199
|
-
</template>
|
|
200
|
-
<template
|
|
201
|
-
v-if="noResultsBlockShown"
|
|
202
|
-
#noResults
|
|
203
|
-
>
|
|
204
|
-
<slot name="noResults"></slot>
|
|
205
|
-
</template>
|
|
206
|
-
<template #noOptions>
|
|
207
|
-
<slot name="noOptions"></slot>
|
|
208
|
-
</template>
|
|
209
|
-
<template
|
|
210
|
-
v-if="slots.listFooter"
|
|
211
|
-
#listFooter
|
|
212
|
-
>
|
|
213
|
-
<slot name="listFooter"></slot>
|
|
214
|
-
</template>
|
|
215
|
-
</extended-multiselect-options>
|
|
216
|
-
</transition>
|
|
217
|
-
</section>
|
|
218
|
-
</template>
|
|
219
|
-
|
|
220
|
-
<script setup>
|
|
221
|
-
import {
|
|
222
|
-
computed,
|
|
223
|
-
defineEmits,
|
|
224
|
-
defineExpose,
|
|
225
|
-
defineProps,
|
|
226
|
-
onBeforeMount,
|
|
227
|
-
onMounted,
|
|
228
|
-
provide,
|
|
229
|
-
ref,
|
|
230
|
-
toRefs,
|
|
231
|
-
useAttrs,
|
|
232
|
-
useSlots,
|
|
233
|
-
watch,
|
|
234
|
-
} from "vue";
|
|
235
|
-
|
|
236
|
-
import {
|
|
237
|
-
themeTypes,
|
|
238
|
-
loaderThemeTypes,
|
|
239
|
-
toggleIcons,
|
|
240
|
-
iconFilters,
|
|
241
|
-
iconSizes,
|
|
242
|
-
createOptionTypes,
|
|
243
|
-
specialKeysToBlock,
|
|
244
|
-
toggleAppearenceSides,
|
|
245
|
-
UnionPropType,
|
|
246
|
-
} from "../sets/sets";
|
|
247
|
-
|
|
248
|
-
import
|
|
249
|
-
|
|
250
|
-
import
|
|
251
|
-
import
|
|
252
|
-
import
|
|
253
|
-
import
|
|
254
|
-
import
|
|
255
|
-
|
|
256
|
-
import
|
|
257
|
-
|
|
258
|
-
import
|
|
259
|
-
import
|
|
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
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
*
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
*
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
*
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
*
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
*
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
*
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
*
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
*
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
*
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
*
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
*
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
*
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
*
|
|
770
|
-
*
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
*
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
*
|
|
798
|
-
*
|
|
799
|
-
*
|
|
800
|
-
*
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
*
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
*
|
|
827
|
-
*
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
*
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
*
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
*
|
|
863
|
-
*
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
*
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
*
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
"
|
|
895
|
-
"
|
|
896
|
-
"
|
|
897
|
-
"
|
|
898
|
-
"
|
|
899
|
-
"
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
const
|
|
905
|
-
const
|
|
906
|
-
const
|
|
907
|
-
const
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
const
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
provide("
|
|
954
|
-
provide("
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
const {
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
*
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
*
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
*
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
*
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
*
|
|
1079
|
-
*
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
*
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
*
|
|
1102
|
-
*
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
*
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
*
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
*
|
|
1130
|
-
*
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
*
|
|
1142
|
-
* @
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
*
|
|
1154
|
-
*
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
emit("update:modelValue", value
|
|
1161
|
-
}
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
*
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
* @
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
*
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
* @
|
|
1200
|
-
* @
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
*
|
|
1209
|
-
* @
|
|
1210
|
-
* @
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
*
|
|
1229
|
-
* @
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
if (
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
const
|
|
1243
|
-
const
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
if (
|
|
1248
|
-
if (
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
*
|
|
1257
|
-
* @
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
*
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
*
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
*
|
|
1290
|
-
* @
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
*
|
|
1299
|
-
* @
|
|
1300
|
-
* @
|
|
1301
|
-
* @param {
|
|
1302
|
-
*/
|
|
1303
|
-
const
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
if (
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
setPreselectedOption(
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
if (
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
*
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
*
|
|
1615
|
-
* @
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
* @
|
|
1701
|
-
* @property {
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
* @
|
|
1713
|
-
* @
|
|
1714
|
-
* @property {
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
* @
|
|
1726
|
-
* @
|
|
1727
|
-
* @property {
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<section
|
|
3
|
+
aria-owns="extended-search-field"
|
|
4
|
+
ref="extendedMultiselectWrapper"
|
|
5
|
+
role="combobox"
|
|
6
|
+
:aria-roledescription="roledescription"
|
|
7
|
+
:class="wrapperClasses"
|
|
8
|
+
:tabindex="tabindexIfSearch"
|
|
9
|
+
@click.stop.left="fieldFocus"
|
|
10
|
+
@click.stop.middle="fieldFocus"
|
|
11
|
+
@keyup.stop.esc="rollUp"
|
|
12
|
+
@keyup.stop.enter="selectByEnter"
|
|
13
|
+
@mousedown.stop.left="toggleRestrictor"
|
|
14
|
+
@mousedown.stop.middle="toggleRestrictor"
|
|
15
|
+
@mouseleave.stop="resetEnterIndex"
|
|
16
|
+
>
|
|
17
|
+
<div
|
|
18
|
+
ref="extendedMultiselect"
|
|
19
|
+
:class="classes"
|
|
20
|
+
:style="[displayWrongValue, expanded]"
|
|
21
|
+
>
|
|
22
|
+
<div>
|
|
23
|
+
<extended-multiselect-input
|
|
24
|
+
:accesskey="attrs.accesskey"
|
|
25
|
+
:autocomplete="attrs.autocomplete"
|
|
26
|
+
:name="attrs.name"
|
|
27
|
+
:spellcheck="attrs.spellcheck"
|
|
28
|
+
:tabindex="attrs.tabindex"
|
|
29
|
+
:translate="attrs.translate"
|
|
30
|
+
:auto-select-search-value="autoSelectSearchValue"
|
|
31
|
+
:create-on-the-go="createOnTheGo"
|
|
32
|
+
:disabled="disabled"
|
|
33
|
+
:dropdown-active="dropdownActive"
|
|
34
|
+
:loading="internalLoading"
|
|
35
|
+
:icon-filter="iconFilter"
|
|
36
|
+
:multiple="multiple"
|
|
37
|
+
:search-filter-active="searchFilterActive"
|
|
38
|
+
:show-deselect-icon-loader="showDeselectIconLoader"
|
|
39
|
+
:toggling-saves-search-value="togglingSavesSearchValue"
|
|
40
|
+
:toggle-options-by-select="toggleOptionsBySelect"
|
|
41
|
+
:placeholder="placeholder"
|
|
42
|
+
:show-search-field="showSearchField"
|
|
43
|
+
:empty-objects-placeholder="emptyObjectsPlaceholder"
|
|
44
|
+
:label="label"
|
|
45
|
+
:multiple-blocks-limit-message="multipleBlocksLimitMessage"
|
|
46
|
+
:theme-type="themeType"
|
|
47
|
+
:increase-display-by="increaseDisplayBy"
|
|
48
|
+
:multipleBlocksLimit="multipleBlocksLimit"
|
|
49
|
+
:restricted-options-length="restrictedOptionsLength"
|
|
50
|
+
:toggle-multiple-blocks-limit="toggleMultipleBlocksLimit"
|
|
51
|
+
:selected-options="selectedOptions"
|
|
52
|
+
:emitter="emitter"
|
|
53
|
+
:create-custom-option-label="createCustomOptionLabel"
|
|
54
|
+
:create-option-placeholder="createOptionPlaceholder"
|
|
55
|
+
:external-options-loader="externalOptionsLoader"
|
|
56
|
+
:input-id="inputId"
|
|
57
|
+
>
|
|
58
|
+
<template
|
|
59
|
+
v-if="!showSearchField"
|
|
60
|
+
#labelBlock="{ labelBlockValue }"
|
|
61
|
+
>
|
|
62
|
+
<slot
|
|
63
|
+
name="labelBlock"
|
|
64
|
+
:label="labelBlockValue"
|
|
65
|
+
>
|
|
66
|
+
</slot>
|
|
67
|
+
</template>
|
|
68
|
+
<template #optionBlock="{ label, deselectBlock, index }">
|
|
69
|
+
<slot
|
|
70
|
+
name="optionBlock"
|
|
71
|
+
:label="label"
|
|
72
|
+
:index="index"
|
|
73
|
+
:deselect-block="deselectBlock"
|
|
74
|
+
>
|
|
75
|
+
</slot>
|
|
76
|
+
</template>
|
|
77
|
+
<template
|
|
78
|
+
#maxElements
|
|
79
|
+
>
|
|
80
|
+
<slot name="maxElements"></slot>
|
|
81
|
+
</template>
|
|
82
|
+
<template
|
|
83
|
+
v-if="toggleMultipleBlocksLimit"
|
|
84
|
+
#showMore="{ showMoreOptions }"
|
|
85
|
+
>
|
|
86
|
+
<slot
|
|
87
|
+
name="showMore"
|
|
88
|
+
:increase="showMoreOptions"
|
|
89
|
+
>
|
|
90
|
+
</slot>
|
|
91
|
+
</template>
|
|
92
|
+
</extended-multiselect-input>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="extended__multiselect-toggle_wrapper">
|
|
95
|
+
<slot
|
|
96
|
+
name="toggle"
|
|
97
|
+
:toggle-options-list="toggleOptionsList"
|
|
98
|
+
>
|
|
99
|
+
<extended-multiselect-toggle
|
|
100
|
+
ref="extendedMultiselectToggle"
|
|
101
|
+
:tabindex="attrs.tabindex"
|
|
102
|
+
:disabled="disabled"
|
|
103
|
+
:dropdown-active="dropdownActive"
|
|
104
|
+
:loading="internalLoading"
|
|
105
|
+
:icon-filter="iconFilter"
|
|
106
|
+
:icon-size="iconSize"
|
|
107
|
+
:toggle-icon="toggleIcon"
|
|
108
|
+
:emitter="emitter"
|
|
109
|
+
/>
|
|
110
|
+
</slot>
|
|
111
|
+
</div>
|
|
112
|
+
<div class="extended__multiselect-cancel_wrapper">
|
|
113
|
+
<slot
|
|
114
|
+
name="cancel"
|
|
115
|
+
:cancel="cancel"
|
|
116
|
+
>
|
|
117
|
+
<extended-multiselect-cancel
|
|
118
|
+
v-if="showClearIcon"
|
|
119
|
+
:tabindex="attrs.tabindex"
|
|
120
|
+
:disabled="disabled"
|
|
121
|
+
:show-search-field="showSearchField"
|
|
122
|
+
:loading="internalLoading"
|
|
123
|
+
:icon-filter="iconFilter"
|
|
124
|
+
:icon-size="iconSize"
|
|
125
|
+
:selected-options="selectedOptions"
|
|
126
|
+
:emitter="emitter"
|
|
127
|
+
/>
|
|
128
|
+
</slot>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
<transition
|
|
132
|
+
name="extended-toggle"
|
|
133
|
+
type="transition"
|
|
134
|
+
>
|
|
135
|
+
<extended-multiselect-options
|
|
136
|
+
v-if="dropdownActive"
|
|
137
|
+
:auto-select-created-option="autoSelectCreatedOption"
|
|
138
|
+
:clear-by-select-when-multiple="clearBySelectWhenMultiple"
|
|
139
|
+
:create-on-the-go="createOnTheGo"
|
|
140
|
+
:disabled-primitive-options-converted="disabledPrimitiveOptionsConverted"
|
|
141
|
+
:highlight-options="highlightOptions"
|
|
142
|
+
:loading="internalLoading"
|
|
143
|
+
:multiple="multiple"
|
|
144
|
+
:selected-options-shown="selectedOptionsShown"
|
|
145
|
+
:show-insert-warnings="showInsertWarnings"
|
|
146
|
+
:show-marker="showMarker"
|
|
147
|
+
:chosen-toggle-appearance-side="chosenToggleAppearanceSide"
|
|
148
|
+
:create-option-type="createOptionType"
|
|
149
|
+
:disable-by-field="disableByField"
|
|
150
|
+
:empty-objects-placeholder="emptyObjectsPlaceholder"
|
|
151
|
+
:label="label"
|
|
152
|
+
:search-by-field="searchByField"
|
|
153
|
+
:theme-type="themeType"
|
|
154
|
+
:any-option-wrapper-block-height="anyOptionWrapperBlockHeight"
|
|
155
|
+
:max-options-count="maxOptionsCount"
|
|
156
|
+
:min-options-count="minOptionsCount"
|
|
157
|
+
:options-padding="optionsPadding"
|
|
158
|
+
:toggle-max-height="toggleMaxHeight"
|
|
159
|
+
:toggle-min-height="toggleMinHeight"
|
|
160
|
+
:create-option-fields="createOptionFields"
|
|
161
|
+
:options="restrictedOptions"
|
|
162
|
+
:restricted-options="restrictedOptions"
|
|
163
|
+
:selected-options="selectedOptions"
|
|
164
|
+
:special-keys-block="specialKeysBlock"
|
|
165
|
+
:preselected-option="preselectedOption"
|
|
166
|
+
:preselected-options="preselectedOptions"
|
|
167
|
+
:emitter="emitter"
|
|
168
|
+
:create-custom-option-label="createCustomOptionLabel"
|
|
169
|
+
:external-options-loader="externalOptionsLoader"
|
|
170
|
+
>
|
|
171
|
+
<template
|
|
172
|
+
v-if="slots.listHeader"
|
|
173
|
+
#listHeader
|
|
174
|
+
>
|
|
175
|
+
<slot name="listHeader"></slot>
|
|
176
|
+
</template>
|
|
177
|
+
<template
|
|
178
|
+
v-if="maxOptionsCount"
|
|
179
|
+
#moreThanLimit
|
|
180
|
+
>
|
|
181
|
+
<slot name="moreThanLimit"></slot>
|
|
182
|
+
</template>
|
|
183
|
+
<template
|
|
184
|
+
v-if="minOptionsCount"
|
|
185
|
+
#lessThanLimit
|
|
186
|
+
>
|
|
187
|
+
<slot name="lessThanLimit"></slot>
|
|
188
|
+
</template>
|
|
189
|
+
<template #option="{ option, createCustomOptionLabel }">
|
|
190
|
+
<slot
|
|
191
|
+
name="option"
|
|
192
|
+
:option="option"
|
|
193
|
+
:create-custom-option-label="createCustomOptionLabel"
|
|
194
|
+
>
|
|
195
|
+
</slot>
|
|
196
|
+
</template>
|
|
197
|
+
<template #marker>
|
|
198
|
+
<slot name="marker"></slot>
|
|
199
|
+
</template>
|
|
200
|
+
<template
|
|
201
|
+
v-if="noResultsBlockShown"
|
|
202
|
+
#noResults
|
|
203
|
+
>
|
|
204
|
+
<slot name="noResults"></slot>
|
|
205
|
+
</template>
|
|
206
|
+
<template #noOptions>
|
|
207
|
+
<slot name="noOptions"></slot>
|
|
208
|
+
</template>
|
|
209
|
+
<template
|
|
210
|
+
v-if="slots.listFooter"
|
|
211
|
+
#listFooter
|
|
212
|
+
>
|
|
213
|
+
<slot name="listFooter"></slot>
|
|
214
|
+
</template>
|
|
215
|
+
</extended-multiselect-options>
|
|
216
|
+
</transition>
|
|
217
|
+
</section>
|
|
218
|
+
</template>
|
|
219
|
+
|
|
220
|
+
<script setup>
|
|
221
|
+
import {
|
|
222
|
+
computed,
|
|
223
|
+
defineEmits,
|
|
224
|
+
defineExpose,
|
|
225
|
+
defineProps,
|
|
226
|
+
onBeforeMount,
|
|
227
|
+
onMounted,
|
|
228
|
+
provide,
|
|
229
|
+
ref,
|
|
230
|
+
toRefs,
|
|
231
|
+
useAttrs,
|
|
232
|
+
useSlots,
|
|
233
|
+
watch,
|
|
234
|
+
} from "vue";
|
|
235
|
+
|
|
236
|
+
import {
|
|
237
|
+
themeTypes,
|
|
238
|
+
loaderThemeTypes,
|
|
239
|
+
toggleIcons,
|
|
240
|
+
iconFilters,
|
|
241
|
+
iconSizes,
|
|
242
|
+
createOptionTypes,
|
|
243
|
+
specialKeysToBlock,
|
|
244
|
+
toggleAppearenceSides,
|
|
245
|
+
UnionPropType,
|
|
246
|
+
} from "../sets/sets";
|
|
247
|
+
|
|
248
|
+
import localEmitter from "../events/instance.js";
|
|
249
|
+
|
|
250
|
+
import useToggle from "../composition/toggle";
|
|
251
|
+
import useCancel from "../composition/cancel";
|
|
252
|
+
import useLabels from "../composition/labels";
|
|
253
|
+
import useEmitter from "../composition/emitter";
|
|
254
|
+
import useClickOutside from "../composition/click-outside";
|
|
255
|
+
import usePreselectedOptions from "../composition/preselected-options";
|
|
256
|
+
import useSearchValue from "../composition/search-value";
|
|
257
|
+
|
|
258
|
+
import ExtendedMultiselectCancel from "./ExtendedMultiselectCancel.vue";
|
|
259
|
+
import ExtendedMultiselectInput from "./ExtendedMultiselectInput.vue";
|
|
260
|
+
import ExtendedMultiselectOptions from "./ExtendedMultiselectOptions.vue";
|
|
261
|
+
import ExtendedMultiselectToggle from "./ExtendedMultiselectToggle.vue";
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* @author Ridiger Daniil Dmitrievich, 2022
|
|
265
|
+
* @version 1.7.2
|
|
266
|
+
*/
|
|
267
|
+
|
|
268
|
+
const props = defineProps({
|
|
269
|
+
/**
|
|
270
|
+
* Determines whether to select just now created option
|
|
271
|
+
* automatically
|
|
272
|
+
* @default false
|
|
273
|
+
* @property {boolean} autoSelectCreatedOption
|
|
274
|
+
*/
|
|
275
|
+
autoSelectCreatedOption: {
|
|
276
|
+
type: Boolean,
|
|
277
|
+
default: false,
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Determines whether to take search value from current
|
|
282
|
+
* selected option if "multiple" prop equals false
|
|
283
|
+
* @default false
|
|
284
|
+
* @property {boolean} autoSelectSearchValue
|
|
285
|
+
*/
|
|
286
|
+
autoSelectSearchValue: {
|
|
287
|
+
type: Boolean,
|
|
288
|
+
default: false,
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Determines whether to clear search field by option selection
|
|
293
|
+
* @default false
|
|
294
|
+
* @property {boolean} clearBySelectWhenMultiple
|
|
295
|
+
*/
|
|
296
|
+
clearBySelectWhenMultiple: {
|
|
297
|
+
type: Boolean,
|
|
298
|
+
default: false,
|
|
299
|
+
},
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Allows user to create new options from search field
|
|
303
|
+
* @default false
|
|
304
|
+
* @property {boolean} createOnTheGo
|
|
305
|
+
*/
|
|
306
|
+
createOnTheGo: {
|
|
307
|
+
type: Boolean,
|
|
308
|
+
default: false,
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Determines whether options list should be expanded by default
|
|
313
|
+
* @default false
|
|
314
|
+
* @property {boolean} defaultExpanded
|
|
315
|
+
*/
|
|
316
|
+
defaultExpanded: {
|
|
317
|
+
type: Boolean,
|
|
318
|
+
default: false,
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Disables extended multiselect
|
|
323
|
+
* @default false
|
|
324
|
+
* @property {boolean} disabled
|
|
325
|
+
*/
|
|
326
|
+
disabled: {
|
|
327
|
+
type: Boolean,
|
|
328
|
+
default: false,
|
|
329
|
+
},
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Switches options highlighting while hovering
|
|
333
|
+
* @default true
|
|
334
|
+
* @property {boolean} highlightOptions
|
|
335
|
+
*/
|
|
336
|
+
highlightOptions: {
|
|
337
|
+
type: Boolean,
|
|
338
|
+
default: true,
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Switches loading state of extended multiselect
|
|
343
|
+
* @default false
|
|
344
|
+
* @property {boolean} loading
|
|
345
|
+
*/
|
|
346
|
+
loading: {
|
|
347
|
+
type: Boolean,
|
|
348
|
+
default: false,
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Allows user to select multiple options
|
|
353
|
+
* @default false
|
|
354
|
+
* @property {boolean} multiple
|
|
355
|
+
*/
|
|
356
|
+
multiple: {
|
|
357
|
+
type: Boolean,
|
|
358
|
+
default: false,
|
|
359
|
+
},
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Determines whether to show special hint if no options were found
|
|
363
|
+
* @default true
|
|
364
|
+
* @property {boolean} noResultsBlockShown
|
|
365
|
+
*/
|
|
366
|
+
noResultsBlockShown: {
|
|
367
|
+
type: Boolean,
|
|
368
|
+
default: true,
|
|
369
|
+
},
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Determines whether to clear search field by selection/deselection of options
|
|
373
|
+
* @default true
|
|
374
|
+
* @property {boolean} resetSearchByValue
|
|
375
|
+
*/
|
|
376
|
+
resetSearchByValue: {
|
|
377
|
+
type: Boolean,
|
|
378
|
+
default: true,
|
|
379
|
+
},
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Allows user to use internal search for options
|
|
383
|
+
* @default true
|
|
384
|
+
* @property {boolean} searchFilterActive
|
|
385
|
+
*/
|
|
386
|
+
searchFilterActive: {
|
|
387
|
+
type: Boolean,
|
|
388
|
+
default: true,
|
|
389
|
+
},
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Switches full payload of extended multiselect events
|
|
393
|
+
* @default true
|
|
394
|
+
* @property {boolean} simpleEvents
|
|
395
|
+
*/
|
|
396
|
+
simpleEvents: {
|
|
397
|
+
type: Boolean,
|
|
398
|
+
default: true,
|
|
399
|
+
},
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Determines whether to show selected options in options list
|
|
403
|
+
* @default false
|
|
404
|
+
* @property {boolean} selectedOptionsShown
|
|
405
|
+
*/
|
|
406
|
+
selectedOptionsShown: {
|
|
407
|
+
type: Boolean,
|
|
408
|
+
default: false,
|
|
409
|
+
},
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Allows user to deselect all options by special icon
|
|
413
|
+
* @default false
|
|
414
|
+
* @property {boolean} showClearIcon
|
|
415
|
+
*/
|
|
416
|
+
showClearIcon: {
|
|
417
|
+
type: Boolean,
|
|
418
|
+
default: false,
|
|
419
|
+
},
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Determines whether to show loader icon in multiple
|
|
423
|
+
* options block if "loading" prop equals true
|
|
424
|
+
* @default true
|
|
425
|
+
* @property {boolean} showDeselectIconLoader
|
|
426
|
+
*/
|
|
427
|
+
showDeselectIconLoader: {
|
|
428
|
+
type: Boolean,
|
|
429
|
+
default: true,
|
|
430
|
+
},
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Determines whether to show useful internal warnings in console
|
|
434
|
+
* @default false
|
|
435
|
+
* @property {boolean} showInsertWarnings
|
|
436
|
+
*/
|
|
437
|
+
showInsertWarnings: {
|
|
438
|
+
type: Boolean,
|
|
439
|
+
default: false,
|
|
440
|
+
},
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Determines whether to show slot with special marker beside option in options list
|
|
444
|
+
* @default false
|
|
445
|
+
* @property {boolean} showMarker
|
|
446
|
+
*/
|
|
447
|
+
showMarker: {
|
|
448
|
+
type: Boolean,
|
|
449
|
+
default: false,
|
|
450
|
+
},
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Determines whether to show search field which allows user
|
|
454
|
+
* to search for options with internal search
|
|
455
|
+
* @default true
|
|
456
|
+
* @property {boolean} showSearchField
|
|
457
|
+
*/
|
|
458
|
+
showSearchField: {
|
|
459
|
+
type: Boolean,
|
|
460
|
+
default: true,
|
|
461
|
+
},
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Allows user to increase limit of shown elements with selected options
|
|
465
|
+
* by special icon
|
|
466
|
+
* @default false
|
|
467
|
+
* @property {boolean} toggleMultipleBlocksLimit
|
|
468
|
+
*/
|
|
469
|
+
toggleMultipleBlocksLimit: {
|
|
470
|
+
type: Boolean,
|
|
471
|
+
default: false,
|
|
472
|
+
},
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Determines whether to roll up options list by selection of option
|
|
476
|
+
* @default true
|
|
477
|
+
* @property {boolean} toggleOptionsBySelect
|
|
478
|
+
*/
|
|
479
|
+
toggleOptionsBySelect: {
|
|
480
|
+
type: Boolean,
|
|
481
|
+
default: true,
|
|
482
|
+
},
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Determines whether to save current search value if
|
|
486
|
+
* display of options list was toggled
|
|
487
|
+
* @default true
|
|
488
|
+
* @property {boolean} togglingSavesSearchValue
|
|
489
|
+
*/
|
|
490
|
+
togglingSavesSearchValue: {
|
|
491
|
+
type: Boolean,
|
|
492
|
+
default: true,
|
|
493
|
+
},
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Determines whether to define special class for extended multiselect
|
|
497
|
+
* if value is wrong
|
|
498
|
+
* Irregularity of value is defined by user
|
|
499
|
+
* @default false
|
|
500
|
+
* @property {boolean} wrongCurrentValue
|
|
501
|
+
*/
|
|
502
|
+
wrongCurrentValue: {
|
|
503
|
+
type: Boolean,
|
|
504
|
+
default: false,
|
|
505
|
+
},
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Placeholder for the search field to be used if
|
|
509
|
+
* user is allowed to create new options
|
|
510
|
+
* @default "Select or create features"
|
|
511
|
+
* @property {string} createOptionPlaceholder
|
|
512
|
+
*/
|
|
513
|
+
createOptionPlaceholder: {
|
|
514
|
+
type: String,
|
|
515
|
+
default: "Select or create features",
|
|
516
|
+
},
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Defines kind for all options which will be created by user
|
|
520
|
+
* @default "primitive"
|
|
521
|
+
* @property {string} createOptionType
|
|
522
|
+
*/
|
|
523
|
+
createOptionType: {
|
|
524
|
+
type: String,
|
|
525
|
+
default: "primitive",
|
|
526
|
+
validator(value) {
|
|
527
|
+
return createOptionTypes.includes(value);
|
|
528
|
+
},
|
|
529
|
+
},
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Determines a field in options of type "object"
|
|
533
|
+
* which value will be used to disable such options.
|
|
534
|
+
* @default "disabled"
|
|
535
|
+
* @property {string} disableByField
|
|
536
|
+
*/
|
|
537
|
+
disableByField: {
|
|
538
|
+
type: String,
|
|
539
|
+
default: "disabled",
|
|
540
|
+
},
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Placeholder for options of type "object"
|
|
544
|
+
* or Array instances which length/keys length equals 0
|
|
545
|
+
* @default "Empty Object/Array"
|
|
546
|
+
* @property {string} emptyObjectsPlaceholder
|
|
547
|
+
*/
|
|
548
|
+
emptyObjectsPlaceholder: {
|
|
549
|
+
type: String,
|
|
550
|
+
default: "Empty Object/Array",
|
|
551
|
+
},
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Defines "border-color" css-property for extended multiselect with wrong value
|
|
555
|
+
* @default "#FF0000"
|
|
556
|
+
* @property {string} errorBorderColor
|
|
557
|
+
*/
|
|
558
|
+
errorBorderColor: {
|
|
559
|
+
type: String,
|
|
560
|
+
default: "#FF0000",
|
|
561
|
+
},
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Defines svg-filter with color settings for all icons except loader
|
|
565
|
+
* @default "basic"
|
|
566
|
+
* @property {string} iconFilter
|
|
567
|
+
*/
|
|
568
|
+
iconFilter: {
|
|
569
|
+
type: String,
|
|
570
|
+
default: "basic",
|
|
571
|
+
validator(value) {
|
|
572
|
+
return iconFilters.includes(value);
|
|
573
|
+
},
|
|
574
|
+
},
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Defines sizes for all icons in pixels except loader
|
|
578
|
+
* @default "large"
|
|
579
|
+
* @property {string} iconSize
|
|
580
|
+
*/
|
|
581
|
+
iconSize: {
|
|
582
|
+
type: String,
|
|
583
|
+
default: "large",
|
|
584
|
+
validator(value) {
|
|
585
|
+
return iconSizes.includes(value);
|
|
586
|
+
},
|
|
587
|
+
},
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Defines field in options of type "object" that will be the label of option
|
|
591
|
+
* @default "label"
|
|
592
|
+
* @property {string} label
|
|
593
|
+
*/
|
|
594
|
+
label: {
|
|
595
|
+
type: String,
|
|
596
|
+
default: "label",
|
|
597
|
+
},
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Defines svg-filter with color settings for loader icon
|
|
601
|
+
* @default "loader-default"
|
|
602
|
+
* @property {string} loaderIconFilter
|
|
603
|
+
*/
|
|
604
|
+
loaderIconFilter: {
|
|
605
|
+
type: String,
|
|
606
|
+
default: "loader-default",
|
|
607
|
+
validator(value) {
|
|
608
|
+
return loaderThemeTypes.includes(value);
|
|
609
|
+
},
|
|
610
|
+
},
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Placeholder for search field to be used if
|
|
614
|
+
* user is not allowed to create new options
|
|
615
|
+
* @default "Select features"
|
|
616
|
+
* @property {string} placeholder
|
|
617
|
+
*/
|
|
618
|
+
placeholder: {
|
|
619
|
+
type: String,
|
|
620
|
+
default: "Select features",
|
|
621
|
+
},
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Determines field in options of type "object"
|
|
625
|
+
* to use in internal search.
|
|
626
|
+
* @default ""
|
|
627
|
+
* @property {string} searchByField
|
|
628
|
+
*/
|
|
629
|
+
searchByField: {
|
|
630
|
+
type: String,
|
|
631
|
+
default: "",
|
|
632
|
+
},
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Defines overall color theme for extended multiselect
|
|
636
|
+
* @default "basic"
|
|
637
|
+
* @property {string} themeType
|
|
638
|
+
*/
|
|
639
|
+
themeType: {
|
|
640
|
+
type: String,
|
|
641
|
+
default: "basic",
|
|
642
|
+
validator(value) {
|
|
643
|
+
return themeTypes.includes(value);
|
|
644
|
+
},
|
|
645
|
+
},
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Defines which side options list will be displayed on
|
|
649
|
+
* @default "auto"
|
|
650
|
+
* @property {string} toggleAppearanceSide
|
|
651
|
+
*/
|
|
652
|
+
toggleAppearanceSide: {
|
|
653
|
+
type: String,
|
|
654
|
+
default: "auto",
|
|
655
|
+
validator(value) {
|
|
656
|
+
return toggleAppearenceSides.includes(value);
|
|
657
|
+
},
|
|
658
|
+
},
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Defines kind of toggle icon from icons collection
|
|
662
|
+
* @default "base-arrow"
|
|
663
|
+
* @property {string} toggleIcon
|
|
664
|
+
*/
|
|
665
|
+
toggleIcon: {
|
|
666
|
+
type: String,
|
|
667
|
+
default: "base-arrow",
|
|
668
|
+
validator(value) {
|
|
669
|
+
return toggleIcons.includes(value);
|
|
670
|
+
},
|
|
671
|
+
},
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Defines "height" css-property for each option in options list
|
|
675
|
+
* @default 30
|
|
676
|
+
* @property {number} anyOptionWrapperBlockHeight
|
|
677
|
+
*/
|
|
678
|
+
anyOptionWrapperBlockHeight: {
|
|
679
|
+
type: Number,
|
|
680
|
+
default: 30,
|
|
681
|
+
},
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Defines gap which increases limit of displayed elements with selected options
|
|
685
|
+
* @default 5
|
|
686
|
+
* @property {number} increaseDisplayBy
|
|
687
|
+
*/
|
|
688
|
+
increaseDisplayBy: {
|
|
689
|
+
type: Number,
|
|
690
|
+
default: 5,
|
|
691
|
+
},
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Maximal limit of selected options
|
|
695
|
+
* @default null
|
|
696
|
+
* @property {number|null} maxOptionsCount
|
|
697
|
+
*/
|
|
698
|
+
maxOptionsCount: {
|
|
699
|
+
type: Number,
|
|
700
|
+
default: null,
|
|
701
|
+
},
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Minimal limit of selected options
|
|
705
|
+
* @default null
|
|
706
|
+
* @property {number|null} minOptionsCount
|
|
707
|
+
*/
|
|
708
|
+
minOptionsCount: {
|
|
709
|
+
type: Number,
|
|
710
|
+
default: null,
|
|
711
|
+
},
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Defines limit of displayed elements with selected options
|
|
715
|
+
* @default null
|
|
716
|
+
* @property {number|null} multipleBlocksLimit
|
|
717
|
+
*/
|
|
718
|
+
multipleBlocksLimit: {
|
|
719
|
+
type: Number,
|
|
720
|
+
default: null,
|
|
721
|
+
},
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Defines maximal limit of options list length
|
|
725
|
+
* @default null
|
|
726
|
+
* @property {number|null} optionsCountRestriction
|
|
727
|
+
*/
|
|
728
|
+
optionsCountRestriction: {
|
|
729
|
+
type: Number,
|
|
730
|
+
default: null,
|
|
731
|
+
},
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Defines maximal value in pixels of "max-height" css-property for options list
|
|
735
|
+
* @default 400
|
|
736
|
+
* @property {number} toggleMaxHeight
|
|
737
|
+
*/
|
|
738
|
+
toggleMaxHeight: {
|
|
739
|
+
type: Number,
|
|
740
|
+
default: 400,
|
|
741
|
+
},
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* Defines minimal value in pixels of "max-height" css-property for options list
|
|
745
|
+
* @default null
|
|
746
|
+
* @property {number} toggleMaxHeight
|
|
747
|
+
*/
|
|
748
|
+
toggleMinHeight: {
|
|
749
|
+
type: Number,
|
|
750
|
+
default: null,
|
|
751
|
+
},
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Defines a list of fields for options of type "object" created by user
|
|
755
|
+
* @default ["label"]
|
|
756
|
+
* @property {Array} createOptionFields
|
|
757
|
+
*/
|
|
758
|
+
createOptionFields: {
|
|
759
|
+
type: Array,
|
|
760
|
+
default: () => ["label"],
|
|
761
|
+
validator(value) {
|
|
762
|
+
return !value.some((field) => {
|
|
763
|
+
return typeof field !== "string";
|
|
764
|
+
});
|
|
765
|
+
},
|
|
766
|
+
},
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* Defines a list of primitive types for options.
|
|
770
|
+
* Options of given types will be disabled for selection.
|
|
771
|
+
* @default []
|
|
772
|
+
* @property {Array} disabledPrimitiveOptions
|
|
773
|
+
*/
|
|
774
|
+
disabledPrimitiveOptions: {
|
|
775
|
+
type: Array,
|
|
776
|
+
default: () => [],
|
|
777
|
+
validator(value) {
|
|
778
|
+
return value.every((option) => {
|
|
779
|
+
return typeof option === "string" || Array.isArray(option)
|
|
780
|
+
|| typeof option === "number" || typeof option === "boolean"
|
|
781
|
+
|| typeof option === "function";
|
|
782
|
+
});
|
|
783
|
+
},
|
|
784
|
+
},
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Raw options list
|
|
788
|
+
* @default []
|
|
789
|
+
* @property {Array|Function} options
|
|
790
|
+
*/
|
|
791
|
+
options: {
|
|
792
|
+
type: [Array, Function],
|
|
793
|
+
default: () => [],
|
|
794
|
+
},
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Defines a list with "padding-top", "padding-left", "padding-bottom"
|
|
798
|
+
* and "padding-right" css-properties for options in options list.
|
|
799
|
+
* Property "padding-top" matches index zero.
|
|
800
|
+
* Property "padding-right" matches index three.
|
|
801
|
+
* @default []
|
|
802
|
+
* @property {Array} optionsPadding
|
|
803
|
+
*/
|
|
804
|
+
optionsPadding: {
|
|
805
|
+
type: Array,
|
|
806
|
+
default: () => [],
|
|
807
|
+
validator(value) {
|
|
808
|
+
return value.length < 5
|
|
809
|
+
&& !value.some((padding) => {
|
|
810
|
+
return typeof padding !== "number";
|
|
811
|
+
});
|
|
812
|
+
},
|
|
813
|
+
},
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Defines a list of options that will be select by default
|
|
817
|
+
* @default []
|
|
818
|
+
* @property {Array} preselectedOptions
|
|
819
|
+
*/
|
|
820
|
+
preselectedOptions: {
|
|
821
|
+
type: Array,
|
|
822
|
+
default: () => [],
|
|
823
|
+
},
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* Defines a list of keys which in combination with mouse buttons or "enter" key
|
|
827
|
+
* will prevent selection of option
|
|
828
|
+
* @default []
|
|
829
|
+
* @property {Array} specialKeysBlock
|
|
830
|
+
*/
|
|
831
|
+
specialKeysBlock: {
|
|
832
|
+
type: Array,
|
|
833
|
+
default: () => [],
|
|
834
|
+
validator(value) {
|
|
835
|
+
return value.every((keyBlock) => {
|
|
836
|
+
return specialKeysToBlock.includes(keyBlock);
|
|
837
|
+
});
|
|
838
|
+
},
|
|
839
|
+
},
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Defines value of extended multiselect that can be used in "v-model" attribute
|
|
843
|
+
* @default []
|
|
844
|
+
* @property {Array|null} modelValue
|
|
845
|
+
*/
|
|
846
|
+
modelValue: {
|
|
847
|
+
type: UnionPropType,
|
|
848
|
+
default: null,
|
|
849
|
+
},
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Defines function that creates custom label for each option
|
|
853
|
+
* @default (option)=>null
|
|
854
|
+
* @property {Function} createCustomOptionLabel
|
|
855
|
+
*/
|
|
856
|
+
createCustomOptionLabel: {
|
|
857
|
+
type: Function,
|
|
858
|
+
default: (option) => null,
|
|
859
|
+
},
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* Defines function that creates notification when maximal limit
|
|
863
|
+
* of selected options has been reached
|
|
864
|
+
* @default (number)=>string
|
|
865
|
+
* @property {Function} multipleBlocksLimitMessage
|
|
866
|
+
*/
|
|
867
|
+
multipleBlocksLimitMessage: {
|
|
868
|
+
type: Function,
|
|
869
|
+
default: (number) => `and ${number} more items`,
|
|
870
|
+
},
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* "id" attribute of search field
|
|
874
|
+
* @default null
|
|
875
|
+
* @property {string|number|null} inputId
|
|
876
|
+
*/
|
|
877
|
+
inputId: {
|
|
878
|
+
type: [String, Number],
|
|
879
|
+
default: null,
|
|
880
|
+
},
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* Defines options that will be select by default
|
|
884
|
+
* @default null
|
|
885
|
+
* @property {UnionPropType|null} preselectedOption
|
|
886
|
+
*/
|
|
887
|
+
preselectedOption: {
|
|
888
|
+
type: UnionPropType,
|
|
889
|
+
default: null,
|
|
890
|
+
},
|
|
891
|
+
});
|
|
892
|
+
|
|
893
|
+
const emit = defineEmits([
|
|
894
|
+
"active",
|
|
895
|
+
"clean",
|
|
896
|
+
"close",
|
|
897
|
+
"increase",
|
|
898
|
+
"option-created",
|
|
899
|
+
"pattern-changed",
|
|
900
|
+
"select",
|
|
901
|
+
"update:modelValue"
|
|
902
|
+
]);
|
|
903
|
+
|
|
904
|
+
const dropdownActive = ref(false);
|
|
905
|
+
const externalOptionsLoader = ref(null);
|
|
906
|
+
const chosenToggleAppearanceSide = ref(null);
|
|
907
|
+
const rawOptions = ref([]);
|
|
908
|
+
const selectedOptions = ref([]);
|
|
909
|
+
const togglePattern = /^extended__multiselect-toggle_wrapper/i;
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* Element references
|
|
913
|
+
*/
|
|
914
|
+
const extendedMultiselect = ref(null);
|
|
915
|
+
const extendedMultiselectToggle = ref(null);
|
|
916
|
+
const extendedMultiselectWrapper = ref(null);
|
|
917
|
+
|
|
918
|
+
const {
|
|
919
|
+
defaultExpanded,
|
|
920
|
+
disabled,
|
|
921
|
+
disabledPrimitiveOptions,
|
|
922
|
+
emptyObjectsPlaceholder,
|
|
923
|
+
errorBorderColor,
|
|
924
|
+
inputId,
|
|
925
|
+
label,
|
|
926
|
+
loading,
|
|
927
|
+
loaderIconFilter,
|
|
928
|
+
modelValue,
|
|
929
|
+
multiple,
|
|
930
|
+
options,
|
|
931
|
+
optionsCountRestriction,
|
|
932
|
+
preselectedOption,
|
|
933
|
+
preselectedOptions,
|
|
934
|
+
resetSearchByValue,
|
|
935
|
+
simpleEvents,
|
|
936
|
+
showClearIcon,
|
|
937
|
+
showInsertWarnings,
|
|
938
|
+
showSearchField,
|
|
939
|
+
themeType,
|
|
940
|
+
toggleAppearanceSide,
|
|
941
|
+
toggleMaxHeight,
|
|
942
|
+
toggleOptionsBySelect,
|
|
943
|
+
wrongCurrentValue,
|
|
944
|
+
createCustomOptionLabel,
|
|
945
|
+
} = toRefs(props);
|
|
946
|
+
|
|
947
|
+
const {
|
|
948
|
+
searchState,
|
|
949
|
+
setSearchValue,
|
|
950
|
+
setSearchPattern,
|
|
951
|
+
} = useSearchValue();
|
|
952
|
+
|
|
953
|
+
provide("loaderIconFilter", loaderIconFilter.value);
|
|
954
|
+
provide("searchState", searchState);
|
|
955
|
+
provide("setSearchValue", setSearchValue);
|
|
956
|
+
provide("setSearchPattern", setSearchPattern);
|
|
957
|
+
|
|
958
|
+
const { emitter } = useEmitter();
|
|
959
|
+
const { clickOutside } = useClickOutside();
|
|
960
|
+
const { toggleOptionsList } = useToggle(
|
|
961
|
+
loading,
|
|
962
|
+
disabled,
|
|
963
|
+
emitter,
|
|
964
|
+
);
|
|
965
|
+
const { cancel } = useCancel(
|
|
966
|
+
disabled,
|
|
967
|
+
showSearchField,
|
|
968
|
+
selectedOptions,
|
|
969
|
+
emitter,
|
|
970
|
+
setSearchValue,
|
|
971
|
+
setSearchPattern,
|
|
972
|
+
);
|
|
973
|
+
const { createLabel, optionTypeRestrictor } = usePreselectedOptions(
|
|
974
|
+
label,
|
|
975
|
+
emptyObjectsPlaceholder,
|
|
976
|
+
showInsertWarnings,
|
|
977
|
+
);
|
|
978
|
+
const { optionCreateLabel } = useLabels(
|
|
979
|
+
label,
|
|
980
|
+
createCustomOptionLabel,
|
|
981
|
+
emptyObjectsPlaceholder,
|
|
982
|
+
);
|
|
983
|
+
const attrs = useAttrs();
|
|
984
|
+
const slots = useSlots();
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Defines a list of extended multiselect wrapper classes
|
|
988
|
+
* @function
|
|
989
|
+
* @returns {Array} classes
|
|
990
|
+
*/
|
|
991
|
+
const classes = computed(() => {
|
|
992
|
+
let theme;
|
|
993
|
+
const localClassList = [];
|
|
994
|
+
|
|
995
|
+
switch(themeType.value) {
|
|
996
|
+
case "basic":
|
|
997
|
+
theme = "extended__multiselect";
|
|
998
|
+
break;
|
|
999
|
+
case "slate-grey":
|
|
1000
|
+
theme = "extended__multiselect-slate-grey";
|
|
1001
|
+
break;
|
|
1002
|
+
case "slate-blue":
|
|
1003
|
+
theme = "extended__multiselect-slate-blue";
|
|
1004
|
+
break;
|
|
1005
|
+
case "teal":
|
|
1006
|
+
theme = "extended__multiselect-teal";
|
|
1007
|
+
break;
|
|
1008
|
+
case "strict":
|
|
1009
|
+
theme = "extended__multiselect-strict";
|
|
1010
|
+
break;
|
|
1011
|
+
default: theme = "extended__multiselect";
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
localClassList.push(theme);
|
|
1015
|
+
|
|
1016
|
+
const clear = showClearIcon.value
|
|
1017
|
+
? "extended__multiselect-clear--active"
|
|
1018
|
+
: "extended__multiselect-clear--locked";
|
|
1019
|
+
|
|
1020
|
+
localClassList.push(clear);
|
|
1021
|
+
localClassList.push("extended__multiselect-container");
|
|
1022
|
+
|
|
1023
|
+
return localClassList;
|
|
1024
|
+
});
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Defines a list of disabled options by types given in "disabledPrimitiveOptions" prop
|
|
1028
|
+
* @function
|
|
1029
|
+
* @returns {Array} options
|
|
1030
|
+
*/
|
|
1031
|
+
const disabledPrimitiveOptionsConverted = computed(() => {
|
|
1032
|
+
if (!disabledPrimitiveOptions.value) return null;
|
|
1033
|
+
|
|
1034
|
+
return disabledPrimitiveOptions.value.map((disabledOption) => {
|
|
1035
|
+
if (Array.isArray(disabledOption)) {
|
|
1036
|
+
if (!disabledOption.length) return emptyObjectsPlaceholder.value;
|
|
1037
|
+
|
|
1038
|
+
return disabledOption.join(", ");
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
return disabledOption;
|
|
1042
|
+
});
|
|
1043
|
+
});
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* Determines whether to display irregularity of value by "border-color" css-property
|
|
1047
|
+
* @function
|
|
1048
|
+
* @returns {Object|null} styles
|
|
1049
|
+
*/
|
|
1050
|
+
const displayWrongValue = computed(() => {
|
|
1051
|
+
return wrongCurrentValue.value ? { borderColor: errorBorderColor.value } : null;
|
|
1052
|
+
});
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Defines styles depending on current options list dropdown state
|
|
1056
|
+
* @function
|
|
1057
|
+
* @returns {Object|null} styles
|
|
1058
|
+
*/
|
|
1059
|
+
const expanded = computed(() => {
|
|
1060
|
+
let borderStyles;
|
|
1061
|
+
|
|
1062
|
+
if (chosenToggleAppearanceSide.value === "atop") {
|
|
1063
|
+
borderStyles = {
|
|
1064
|
+
borderTopLeftRadius: 0,
|
|
1065
|
+
borderTopRightRadius: 0,
|
|
1066
|
+
};
|
|
1067
|
+
} else {
|
|
1068
|
+
borderStyles = {
|
|
1069
|
+
borderBottomLeftRadius: 0,
|
|
1070
|
+
borderBottomRightRadius: 0,
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
return dropdownActive.value ? borderStyles : null;
|
|
1075
|
+
});
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* Determines whether to activate loading state by "loading" prop
|
|
1079
|
+
* or by internal loading sign
|
|
1080
|
+
* @function
|
|
1081
|
+
* @returns {boolean} loading
|
|
1082
|
+
*/
|
|
1083
|
+
const internalLoading = computed(() => {
|
|
1084
|
+
return loading.value;
|
|
1085
|
+
});
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* Defines a list of options filtered by maximal admissible options amount
|
|
1089
|
+
* @function
|
|
1090
|
+
* @returns {Array} options
|
|
1091
|
+
*/
|
|
1092
|
+
const restrictedOptions = computed(() => {
|
|
1093
|
+
if (!rawOptions.value) return [];
|
|
1094
|
+
|
|
1095
|
+
return optionsCountRestriction.value
|
|
1096
|
+
? rawOptions.value.filter((option, index) => index + 1 <= optionsCountRestriction.value)
|
|
1097
|
+
: rawOptions.value;
|
|
1098
|
+
});
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* Determines length of options list after filtering by
|
|
1102
|
+
* maximal admissible options amount
|
|
1103
|
+
* @function
|
|
1104
|
+
* @returns {number} length
|
|
1105
|
+
*/
|
|
1106
|
+
const restrictedOptionsLength = computed(() => {
|
|
1107
|
+
return restrictedOptions.value.length;
|
|
1108
|
+
});
|
|
1109
|
+
|
|
1110
|
+
/**
|
|
1111
|
+
* Defines "aria-roledescription" attribute of extended multiselect wrapper
|
|
1112
|
+
* @function
|
|
1113
|
+
* @returns {string} aria-roledescription
|
|
1114
|
+
*/
|
|
1115
|
+
const roledescription = computed(() => {
|
|
1116
|
+
return multiple.value ? "Multiselect" : "Select";
|
|
1117
|
+
});
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
* Defines "tabindex" attribute of extended multiselect wrapper if needed
|
|
1121
|
+
* @function
|
|
1122
|
+
* @returns {number} tabindex
|
|
1123
|
+
*/
|
|
1124
|
+
const tabindexIfSearch = computed(() => {
|
|
1125
|
+
return showSearchField.value ? attrs.tabindex : -1;
|
|
1126
|
+
});
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* Defines special class which indicates disabled or loading state
|
|
1130
|
+
* of extended multiselect wrapper
|
|
1131
|
+
* @function
|
|
1132
|
+
* @returns {string} class
|
|
1133
|
+
*/
|
|
1134
|
+
const wrapperClasses = computed(() => {
|
|
1135
|
+
return disabled.value && !internalLoading.value
|
|
1136
|
+
? "extended__multiselect-wrapper--disabled"
|
|
1137
|
+
: "extended__multiselect-wrapper";
|
|
1138
|
+
});
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Forcibly rolls up dropdown options list by changing "dropdownActive" flag
|
|
1142
|
+
* @function
|
|
1143
|
+
* @emits extended:rollup-options
|
|
1144
|
+
* @param {boolean} value - "dropdownActive" flag
|
|
1145
|
+
*/
|
|
1146
|
+
watch(dropdownActive, (value) => {
|
|
1147
|
+
if (!value) {
|
|
1148
|
+
emitter.value.emit("extended:rollup-options");
|
|
1149
|
+
}
|
|
1150
|
+
});
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* Clears value of search field after changing selected option/options
|
|
1154
|
+
* if "resetSearchByValue" prop equals true
|
|
1155
|
+
* @function
|
|
1156
|
+
* @emits extended:clear-field
|
|
1157
|
+
*/
|
|
1158
|
+
watch(selectedOptions, (value) => {
|
|
1159
|
+
if (multiple.value) {
|
|
1160
|
+
emit("update:modelValue", value);
|
|
1161
|
+
} else {
|
|
1162
|
+
emit("update:modelValue", value[0]);
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
if (resetSearchByValue.value) {
|
|
1166
|
+
emitter.value.emit("extended:clear-field");
|
|
1167
|
+
}
|
|
1168
|
+
}, { deep: true });
|
|
1169
|
+
|
|
1170
|
+
/**
|
|
1171
|
+
* Emits "active" when dropdown options list is active
|
|
1172
|
+
* @function
|
|
1173
|
+
* @emits active
|
|
1174
|
+
*/
|
|
1175
|
+
const activeEmitter = () => {
|
|
1176
|
+
const eventData = simpleEvents.value ? null : {
|
|
1177
|
+
inputId: inputId.value,
|
|
1178
|
+
};
|
|
1179
|
+
|
|
1180
|
+
/**
|
|
1181
|
+
* @event active
|
|
1182
|
+
* @type {object|null}
|
|
1183
|
+
* @property {string} inputId - id of search field set by "id" prop
|
|
1184
|
+
*/
|
|
1185
|
+
emit("active", eventData);
|
|
1186
|
+
};
|
|
1187
|
+
|
|
1188
|
+
/**
|
|
1189
|
+
* Emits "close" when dropdown options list is rolled up
|
|
1190
|
+
* @function
|
|
1191
|
+
* @emits close
|
|
1192
|
+
*/
|
|
1193
|
+
const closeEmitter = () => {
|
|
1194
|
+
const eventData = simpleEvents.value
|
|
1195
|
+
? selectedOptions.value
|
|
1196
|
+
: createEventFields(selectedOptions.value, "options");
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* @event close
|
|
1200
|
+
* @type {object|Array}
|
|
1201
|
+
* @property {string} inputId - id of search field set by "id" prop
|
|
1202
|
+
* @property {Array} options - array of selected options
|
|
1203
|
+
*/
|
|
1204
|
+
emit("close", eventData);
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
/**
|
|
1208
|
+
* Creates payload for events that can be listened by outer listeners
|
|
1209
|
+
* @function
|
|
1210
|
+
* @param {UnionPropType} field - main payload of event
|
|
1211
|
+
* @param {string} fieldName - name of field with main payload of event
|
|
1212
|
+
* @returns {object} payload
|
|
1213
|
+
*/
|
|
1214
|
+
const createEventFields = (field, fieldName) => {
|
|
1215
|
+
const eventFields = {
|
|
1216
|
+
inputId: inputId.value,
|
|
1217
|
+
};
|
|
1218
|
+
|
|
1219
|
+
Object.defineProperty(eventFields, fieldName, {
|
|
1220
|
+
value: field,
|
|
1221
|
+
enumerable: true,
|
|
1222
|
+
});
|
|
1223
|
+
|
|
1224
|
+
return eventFields;
|
|
1225
|
+
};
|
|
1226
|
+
|
|
1227
|
+
/**
|
|
1228
|
+
* Focuses search field if "click" native event was triggered on available element
|
|
1229
|
+
* @function
|
|
1230
|
+
* @emits extended:field-focus
|
|
1231
|
+
* @param {MouseEvent} mouseEvent - MouseEvent instance
|
|
1232
|
+
*/
|
|
1233
|
+
const fieldFocus = (mouseEvent) => {
|
|
1234
|
+
if (disabled.value) return;
|
|
1235
|
+
|
|
1236
|
+
if (!toggleOptionsBySelect.value) {
|
|
1237
|
+
const customFilteredOptions = toggleOptionsRestrictor(mouseEvent);
|
|
1238
|
+
|
|
1239
|
+
if (customFilteredOptions) return;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
const customFilteredCancel = toggleCustomRestrictor(mouseEvent, 2);
|
|
1243
|
+
const customFilteredSelf = toggleCustomRestrictor(mouseEvent, 1);
|
|
1244
|
+
const filteredHasCancel = toggleDetector(mouseEvent, /^extended__multiselect-cancel_wrapper/i);
|
|
1245
|
+
const filteredHasToggle = toggleDetector(mouseEvent, togglePattern);
|
|
1246
|
+
|
|
1247
|
+
if (customFilteredCancel) return;
|
|
1248
|
+
if (customFilteredSelf && dropdownActive.value === false) return;
|
|
1249
|
+
if (filteredHasCancel.length) return;
|
|
1250
|
+
if (filteredHasToggle.length && dropdownActive.value === false) return;
|
|
1251
|
+
|
|
1252
|
+
emitter.value.emit("extended:field-focus");
|
|
1253
|
+
};
|
|
1254
|
+
|
|
1255
|
+
/**
|
|
1256
|
+
* Initialises options list loading by external async method
|
|
1257
|
+
* @function
|
|
1258
|
+
* @param {string} pattern - value of search field
|
|
1259
|
+
* @param {boolean} initialValue - preselected options flag
|
|
1260
|
+
*/
|
|
1261
|
+
const loadOptionsByExternalLoader = (pattern, initialValue) => {
|
|
1262
|
+
externalOptionsLoader.value = options.value;
|
|
1263
|
+
options.value(pattern).then(options => {
|
|
1264
|
+
rawOptions.value = options;
|
|
1265
|
+
if (initialValue) setPreselectedOptionsByConditions();
|
|
1266
|
+
});
|
|
1267
|
+
};
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* Emits event whose listener resets index of "enter" key pressing
|
|
1271
|
+
* @function
|
|
1272
|
+
* @emits extended:reset-index
|
|
1273
|
+
*/
|
|
1274
|
+
const resetEnterIndex = () => {
|
|
1275
|
+
emitter.value.emit("extended:reset-index");
|
|
1276
|
+
};
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* Rolls up dropdown options list
|
|
1280
|
+
* @function
|
|
1281
|
+
* @emits extended:rollup-options
|
|
1282
|
+
*/
|
|
1283
|
+
const rollUp = () => {
|
|
1284
|
+
dropdownActive.value = false;
|
|
1285
|
+
emitter.value.emit("extended:rollup-options");
|
|
1286
|
+
};
|
|
1287
|
+
|
|
1288
|
+
/**
|
|
1289
|
+
* Rolls up dropdown options lists of other instances
|
|
1290
|
+
* @function
|
|
1291
|
+
* @emits extended:rollup-instances
|
|
1292
|
+
*/
|
|
1293
|
+
const rollupInstanses = () => {
|
|
1294
|
+
localEmitter.emit("extended:rollup-instances", extendedMultiselectWrapper.value);
|
|
1295
|
+
};
|
|
1296
|
+
|
|
1297
|
+
/**
|
|
1298
|
+
* Triggers selection of option by "enter" key pressing
|
|
1299
|
+
* @function
|
|
1300
|
+
* @emits extended:select-enter
|
|
1301
|
+
* @param {KeyboardEvent} keyboardEvent - KeyboardEvent instance
|
|
1302
|
+
*/
|
|
1303
|
+
const selectByEnter = (keyboardEvent) => {
|
|
1304
|
+
emitter.value.emit("extended:select-enter", keyboardEvent);
|
|
1305
|
+
};
|
|
1306
|
+
|
|
1307
|
+
/**
|
|
1308
|
+
* Sets preselected option provided by "preselectedOption" prop
|
|
1309
|
+
* @function
|
|
1310
|
+
* @emits extended:select-option
|
|
1311
|
+
* @param {UnionPropType} preselectedOption - option to be selected
|
|
1312
|
+
* @param {boolean} restriction - restriction of preselected option
|
|
1313
|
+
*/
|
|
1314
|
+
const setPreselectedOption = (preselectedOption, restriction = true) => {
|
|
1315
|
+
const availableOptionType = optionTypeRestrictor(preselectedOption);
|
|
1316
|
+
const mappedOptions = restrictedOptions.value.map((restrictedOption) => {
|
|
1317
|
+
return JSON.stringify(restrictedOption);
|
|
1318
|
+
});
|
|
1319
|
+
|
|
1320
|
+
if (!availableOptionType) return;
|
|
1321
|
+
if (!mappedOptions.includes(JSON.stringify(preselectedOption)) && restriction) {
|
|
1322
|
+
if (showInsertWarnings.value) {
|
|
1323
|
+
console.warn("vue-extended-multiselect: option in «preselectedOption» property should be the same as analogue in «options» property");
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
const isObjectOrArray = typeof preselectedOption === "object";
|
|
1330
|
+
const label = createLabel(isObjectOrArray, preselectedOption);
|
|
1331
|
+
|
|
1332
|
+
emitter.value.emit("extended:select-option", {
|
|
1333
|
+
label,
|
|
1334
|
+
option: preselectedOption,
|
|
1335
|
+
});
|
|
1336
|
+
};
|
|
1337
|
+
|
|
1338
|
+
/**
|
|
1339
|
+
* Sets preselected options provided by "preselectedOptions" prop
|
|
1340
|
+
* if "multiple" prop equals true
|
|
1341
|
+
* @function
|
|
1342
|
+
* @emits extended:select-option
|
|
1343
|
+
* @param {Array} preselectedOptions - options to be selected
|
|
1344
|
+
* @param {boolean} restriction - restriction of preselected options
|
|
1345
|
+
*/
|
|
1346
|
+
const setPreselectedOptions = async (preselectedOptions, restriction = true) => {
|
|
1347
|
+
let allOptionsWereSelected = 0;
|
|
1348
|
+
const mappedOptions = restrictedOptions.value.map((restrictedOption) => {
|
|
1349
|
+
return JSON.stringify(restrictedOption);
|
|
1350
|
+
});
|
|
1351
|
+
|
|
1352
|
+
preselectedOptions.forEach((preselectedOption) => {
|
|
1353
|
+
const availableOptionType = optionTypeRestrictor(preselectedOption);
|
|
1354
|
+
|
|
1355
|
+
if (!preselectedOption || !availableOptionType) return;
|
|
1356
|
+
if (selectedOptions.value.includes(preselectedOption)) return;
|
|
1357
|
+
|
|
1358
|
+
if (mappedOptions.includes(JSON.stringify(preselectedOption)) || !restriction) {
|
|
1359
|
+
const isObjectOrArray = typeof option === "object";
|
|
1360
|
+
const label = createLabel(isObjectOrArray, preselectedOption);
|
|
1361
|
+
|
|
1362
|
+
allOptionsWereSelected++;
|
|
1363
|
+
|
|
1364
|
+
emitter.value.emit("extended:select-option", {
|
|
1365
|
+
label,
|
|
1366
|
+
option: preselectedOption,
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
});
|
|
1370
|
+
|
|
1371
|
+
if (allOptionsWereSelected !== preselectedOptions.length && showInsertWarnings.value) {
|
|
1372
|
+
console.warn("vue-extended-multiselect: options in «preselectedOptions» property should be the same as analogues in «options» property");
|
|
1373
|
+
}
|
|
1374
|
+
};
|
|
1375
|
+
|
|
1376
|
+
/**
|
|
1377
|
+
* Determines conditions that control preselected options installattion
|
|
1378
|
+
* if "modelValue" prop is defined
|
|
1379
|
+
* @function
|
|
1380
|
+
*/
|
|
1381
|
+
const setPreselectedOptionsByModelValue = () => {
|
|
1382
|
+
if (!modelValue.value) return;
|
|
1383
|
+
|
|
1384
|
+
if (Array.isArray(modelValue.value) && multiple.value) {
|
|
1385
|
+
setPreselectedOptions(modelValue.value, false);
|
|
1386
|
+
} else {
|
|
1387
|
+
setPreselectedOption(modelValue.value, false);
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* Determines conditions that control preselected options installattion
|
|
1393
|
+
* by "preselectedOption" and "preselectedOptions" props
|
|
1394
|
+
* @function
|
|
1395
|
+
*/
|
|
1396
|
+
const setPreselectedOptionsByConditions = () => {
|
|
1397
|
+
if (preselectedOption.value && !multiple.value) {
|
|
1398
|
+
setPreselectedOption(preselectedOption.value);
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
if (preselectedOptions.value && multiple.value) {
|
|
1402
|
+
setPreselectedOptions(preselectedOptions.value);
|
|
1403
|
+
}
|
|
1404
|
+
};
|
|
1405
|
+
|
|
1406
|
+
/**
|
|
1407
|
+
* Defines a position of dropdown appearance
|
|
1408
|
+
* @function
|
|
1409
|
+
* @returns {string} position
|
|
1410
|
+
*/
|
|
1411
|
+
const toggleAppearanceRestrictor = () => {
|
|
1412
|
+
if (!window) return "under";
|
|
1413
|
+
|
|
1414
|
+
const innerHeight = window.innerHeight;
|
|
1415
|
+
const offsetTop = extendedMultiselect.value
|
|
1416
|
+
? extendedMultiselect.value.getBoundingClientRect().y
|
|
1417
|
+
: 0;
|
|
1418
|
+
const difference = innerHeight - offsetTop;
|
|
1419
|
+
|
|
1420
|
+
if (difference > toggleMaxHeight.value) {
|
|
1421
|
+
return "under";
|
|
1422
|
+
} else {
|
|
1423
|
+
return "atop";
|
|
1424
|
+
}
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1427
|
+
/**
|
|
1428
|
+
* Sets a position of dropdown appearance
|
|
1429
|
+
* @function
|
|
1430
|
+
*/
|
|
1431
|
+
const toggleAppearanceRestrictorActivate = () => {
|
|
1432
|
+
if (!dropdownActive.value) {
|
|
1433
|
+
chosenToggleAppearanceSide.value = toggleAppearanceSide.value !== "auto"
|
|
1434
|
+
? toggleAppearanceSide.value
|
|
1435
|
+
: toggleAppearanceRestrictor();
|
|
1436
|
+
}
|
|
1437
|
+
};
|
|
1438
|
+
|
|
1439
|
+
/**
|
|
1440
|
+
* Restricts toggling of dropdown options list
|
|
1441
|
+
* @function
|
|
1442
|
+
* @emits extended:skip-block-blur
|
|
1443
|
+
* @param {MouseEvent} mouseEvent - MouseEvent instance
|
|
1444
|
+
* @returns {boolean} toggling
|
|
1445
|
+
*/
|
|
1446
|
+
const toggleBlockRestrictor = (mouseEvent) => {
|
|
1447
|
+
let generalRestriction;
|
|
1448
|
+
let filteredCustomSelf;
|
|
1449
|
+
const filteredHasBlock = toggleDetector(mouseEvent, /^extended__multiselect-block/i, true);
|
|
1450
|
+
const filteredHasSlot = toggleDetector(mouseEvent, /^extended__multiselect-options(?!_option)/i, true)
|
|
1451
|
+
const filteredSelf = toggleDetector(mouseEvent, /^extended__multiselect-clear/i, true);
|
|
1452
|
+
|
|
1453
|
+
if (filteredSelf.length || filteredHasBlock.length || filteredHasSlot.length) {
|
|
1454
|
+
filteredCustomSelf = true;
|
|
1455
|
+
} else {
|
|
1456
|
+
filteredCustomSelf = toggleCustomRestrictor(mouseEvent);
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
if (extendedMultiselectToggle.value) {
|
|
1460
|
+
generalRestriction = (filteredHasBlock.length && dropdownActive.value && filteredCustomSelf)
|
|
1461
|
+
|| (filteredSelf.length && dropdownActive.value && filteredCustomSelf)
|
|
1462
|
+
|| (filteredHasSlot.length && dropdownActive.value && filteredCustomSelf);
|
|
1463
|
+
} else {
|
|
1464
|
+
generalRestriction = (filteredHasBlock.length && dropdownActive.value)
|
|
1465
|
+
|| (filteredSelf.length && dropdownActive.value)
|
|
1466
|
+
|| (filteredHasSlot.length && dropdownActive.value);
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
if (generalRestriction) {
|
|
1470
|
+
emitter.value.emit("extended:skip-block-blur");
|
|
1471
|
+
return true;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
return false;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
/**
|
|
1478
|
+
* Restricts toggling of dropdown options list by clicking
|
|
1479
|
+
* on particular descendants of toggle wrapper element
|
|
1480
|
+
* @function
|
|
1481
|
+
* @param {MouseEvent} mouseEvent - MouseEvent instance
|
|
1482
|
+
* @param {number} blockType - type of block which needs restriction
|
|
1483
|
+
* @returns {boolean} restriction
|
|
1484
|
+
*/
|
|
1485
|
+
const toggleCustomRestrictor = (mouseEvent, blockType) => {
|
|
1486
|
+
let eventTarget = mouseEvent.target;
|
|
1487
|
+
const toggleWrapper = extendedMultiselect.value;
|
|
1488
|
+
const customToggle = toggleWrapper.children[blockType];
|
|
1489
|
+
|
|
1490
|
+
while(eventTarget) {
|
|
1491
|
+
if (eventTarget === customToggle) return true;
|
|
1492
|
+
|
|
1493
|
+
eventTarget = eventTarget.parentNode;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
return false;
|
|
1497
|
+
};
|
|
1498
|
+
|
|
1499
|
+
/**
|
|
1500
|
+
* Restricts toggling of dropdown options list by clicking
|
|
1501
|
+
* on particular elements defined by given pattern
|
|
1502
|
+
* @function
|
|
1503
|
+
* @param {MouseEvent} mouseEvent - MouseEvent instance
|
|
1504
|
+
* @param {string} pattern - pattern with block class partial name
|
|
1505
|
+
* @param {boolean} mode - marks whether restrict by parent element or by current target
|
|
1506
|
+
* @returns {Array} classes
|
|
1507
|
+
*/
|
|
1508
|
+
const toggleDetector = (mouseEvent, pattern, mode) => {
|
|
1509
|
+
let target = mouseEvent.target;
|
|
1510
|
+
const optionPattern = /^extended__multiselect-options_option/i;
|
|
1511
|
+
|
|
1512
|
+
let filteredHasToggle = Array.prototype.filter.call(target.classList, (className) => {
|
|
1513
|
+
return pattern.test(className) === true;
|
|
1514
|
+
});
|
|
1515
|
+
|
|
1516
|
+
while(
|
|
1517
|
+
target
|
|
1518
|
+
&& (target.classList
|
|
1519
|
+
&& !target.classList.contains("extended__multiselect-wrapper")
|
|
1520
|
+
|| target.classList
|
|
1521
|
+
&& !target.classList.length)
|
|
1522
|
+
&& mode
|
|
1523
|
+
&& !filteredHasToggle.length
|
|
1524
|
+
) {
|
|
1525
|
+
filteredHasToggle = Array.prototype.filter.call(target.classList, (className) => {
|
|
1526
|
+
return pattern.test(className) === true;
|
|
1527
|
+
});
|
|
1528
|
+
|
|
1529
|
+
if (Array.prototype.some.call(target.classList, (className) => {
|
|
1530
|
+
return optionPattern.test(className);
|
|
1531
|
+
})) return [];
|
|
1532
|
+
|
|
1533
|
+
if (target.classList.contains("extended__multiselect-options_container")) {
|
|
1534
|
+
filteredHasToggle.push("extended__multiselect-options_container");
|
|
1535
|
+
return filteredHasToggle;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
if (target.classList.contains("extended__multiselect-toggle_wrapper")) {
|
|
1539
|
+
filteredHasToggle.push("extended__multiselect-toggle_wrapper");
|
|
1540
|
+
return filteredHasToggle;
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
target = target.parentNode;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
return filteredHasToggle;
|
|
1547
|
+
};
|
|
1548
|
+
|
|
1549
|
+
/**
|
|
1550
|
+
* Toggles dropdown options list and activates
|
|
1551
|
+
* necessary methods with relevant events
|
|
1552
|
+
* @function
|
|
1553
|
+
*/
|
|
1554
|
+
const toggleOptions = () => {
|
|
1555
|
+
if (internalLoading.value || disabled.value) return;
|
|
1556
|
+
|
|
1557
|
+
toggleAppearanceRestrictorActivate();
|
|
1558
|
+
|
|
1559
|
+
if (!dropdownActive.value) {
|
|
1560
|
+
activeEmitter();
|
|
1561
|
+
} else {
|
|
1562
|
+
closeEmitter();
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
dropdownActive.value = !dropdownActive.value;
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1568
|
+
/**
|
|
1569
|
+
* Prevents toggling dropdown options list
|
|
1570
|
+
* by selecting/deselecting option
|
|
1571
|
+
* @function
|
|
1572
|
+
* @param {MouseEvent} mouseEvent - MouseEvent instance
|
|
1573
|
+
* @returns {boolean} restriction
|
|
1574
|
+
*/
|
|
1575
|
+
const toggleOptionsRestrictor = (mouseEvent) => {
|
|
1576
|
+
try {
|
|
1577
|
+
let eventTarget = mouseEvent.target;
|
|
1578
|
+
const optionsWrapper = optionsWrapper.value;
|
|
1579
|
+
|
|
1580
|
+
while(eventTarget) {
|
|
1581
|
+
if (eventTarget === optionsWrapper) return true;
|
|
1582
|
+
|
|
1583
|
+
eventTarget = eventTarget.parentNode;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
return false;
|
|
1587
|
+
} catch(e) {
|
|
1588
|
+
return false;
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* Collects restrictions from other methods and defines
|
|
1594
|
+
* general restriction of toggling dropdown options list
|
|
1595
|
+
* @function
|
|
1596
|
+
* @emits extended:skip-blur
|
|
1597
|
+
* @param {MouseEvent} mouseEvent - MouseEvent instance
|
|
1598
|
+
*/
|
|
1599
|
+
const toggleRestrictor = (mouseEvent) => {
|
|
1600
|
+
rollupInstanses();
|
|
1601
|
+
|
|
1602
|
+
const targetContentBlock = toggleBlockRestrictor(mouseEvent);
|
|
1603
|
+
|
|
1604
|
+
if (targetContentBlock) return;
|
|
1605
|
+
|
|
1606
|
+
const filteredHasToggle = toggleDetector(mouseEvent, togglePattern);
|
|
1607
|
+
|
|
1608
|
+
if (filteredHasToggle.length && dropdownActive.value) {
|
|
1609
|
+
emitter.value.emit("extended:skip-blur");
|
|
1610
|
+
}
|
|
1611
|
+
};
|
|
1612
|
+
|
|
1613
|
+
/**
|
|
1614
|
+
* "onBeforeMount" hook of the Vue3ExtendedMultiselect component
|
|
1615
|
+
* @emits select
|
|
1616
|
+
* @emits clean
|
|
1617
|
+
* @emits option-created
|
|
1618
|
+
* @emits increase
|
|
1619
|
+
* @emits pattern-changed
|
|
1620
|
+
* @emits extended:rollup-options
|
|
1621
|
+
* @listens extended:rollup-options
|
|
1622
|
+
* @listens extended:toggle-options
|
|
1623
|
+
* @listens extended:select-option
|
|
1624
|
+
* @listens extended:deselect-option
|
|
1625
|
+
* @listens extended:clean-options
|
|
1626
|
+
* @listens extended:create-option
|
|
1627
|
+
* @listens extended:increase-display
|
|
1628
|
+
* @listens extended:search-pattern-changed
|
|
1629
|
+
*/
|
|
1630
|
+
onBeforeMount(() => {
|
|
1631
|
+
chosenToggleAppearanceSide.value = toggleAppearanceSide.value;
|
|
1632
|
+
|
|
1633
|
+
emitter.value.on("extended:rollup-options", () => {
|
|
1634
|
+
if (!dropdownActive.value) return;
|
|
1635
|
+
|
|
1636
|
+
closeEmitter();
|
|
1637
|
+
dropdownActive.value = false;
|
|
1638
|
+
});
|
|
1639
|
+
|
|
1640
|
+
emitter.value.on("extended:toggle-options", () => {
|
|
1641
|
+
toggleOptions();
|
|
1642
|
+
});
|
|
1643
|
+
|
|
1644
|
+
emitter.value.on("extended:select-option", (option) => {
|
|
1645
|
+
const eventData = simpleEvents.value
|
|
1646
|
+
? option.option
|
|
1647
|
+
: createEventFields(option.option, "option");
|
|
1648
|
+
|
|
1649
|
+
if (multiple.value) {
|
|
1650
|
+
selectedOptions.value.push(option.option);
|
|
1651
|
+
/**
|
|
1652
|
+
* @event select
|
|
1653
|
+
* @type {Object}
|
|
1654
|
+
* @property {string} inputId - id of search field set by "id" prop
|
|
1655
|
+
* @property {UnionPropType} option - just now selected option
|
|
1656
|
+
*/
|
|
1657
|
+
emit("select", eventData);
|
|
1658
|
+
} else {
|
|
1659
|
+
selectedOptions.value = [option.option];
|
|
1660
|
+
/**
|
|
1661
|
+
* @see select
|
|
1662
|
+
*/
|
|
1663
|
+
emit("select", eventData);
|
|
1664
|
+
}
|
|
1665
|
+
});
|
|
1666
|
+
|
|
1667
|
+
emitter.value.on("extended:deselect-option", (payload) => {
|
|
1668
|
+
if (multiple.value && (payload && !payload.clearAll)) {
|
|
1669
|
+
const deselectedOption = selectedOptions.value[payload.index];
|
|
1670
|
+
|
|
1671
|
+
const eventData = simpleEvents.value
|
|
1672
|
+
? deselectedOption
|
|
1673
|
+
: createEventFields(deselectedOption, "option");
|
|
1674
|
+
|
|
1675
|
+
/**
|
|
1676
|
+
* @event clean
|
|
1677
|
+
* @type {Object}
|
|
1678
|
+
* @property {string} inputId - id of search field set by "id" prop
|
|
1679
|
+
* @property {UnionPropType} option - just now deselected option
|
|
1680
|
+
*/
|
|
1681
|
+
emit("clean", eventData);
|
|
1682
|
+
|
|
1683
|
+
selectedOptions.value.splice(payload.index, 1);
|
|
1684
|
+
return;
|
|
1685
|
+
} else {
|
|
1686
|
+
selectedOptions.value = [];
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
if (toggleOptionsBySelect.value) {
|
|
1690
|
+
emitter.value.emit("extended:rollup-options");
|
|
1691
|
+
}
|
|
1692
|
+
});
|
|
1693
|
+
|
|
1694
|
+
emitter.value.on("extended:clean-options", (selectedOptions) => {
|
|
1695
|
+
const eventData = simpleEvents.value
|
|
1696
|
+
? selectedOptions.value
|
|
1697
|
+
: createEventFields(selectedOptions, "options");
|
|
1698
|
+
|
|
1699
|
+
/**
|
|
1700
|
+
* @see clean
|
|
1701
|
+
* @property {Array} options - just now deselected options
|
|
1702
|
+
*/
|
|
1703
|
+
emit("clean", eventData);
|
|
1704
|
+
});
|
|
1705
|
+
|
|
1706
|
+
emitter.value.on("extended:create-option", (createdOption) => {
|
|
1707
|
+
const eventData = simpleEvents.value
|
|
1708
|
+
? createdOption
|
|
1709
|
+
: createEventFields(createdOption, "option");
|
|
1710
|
+
|
|
1711
|
+
/**
|
|
1712
|
+
* @event option-created
|
|
1713
|
+
* @type {PluginObject}
|
|
1714
|
+
* @property {string} inputId - id of search field set by "id" prop
|
|
1715
|
+
* @property {UnionPropType} option - option created by user
|
|
1716
|
+
*/
|
|
1717
|
+
emit("option-created", eventData);
|
|
1718
|
+
});
|
|
1719
|
+
|
|
1720
|
+
emitter.value.on("extended:increase-display", (limit) => {
|
|
1721
|
+
const eventData = simpleEvents.value ? limit : createEventFields(limit, "limit");
|
|
1722
|
+
|
|
1723
|
+
/**
|
|
1724
|
+
* @event increase
|
|
1725
|
+
* @type {Object}
|
|
1726
|
+
* @property {string} inputId - id of search field set by "id" prop
|
|
1727
|
+
* @property {limit} - current limit of options to be shown next
|
|
1728
|
+
*/
|
|
1729
|
+
emit("increase", eventData);
|
|
1730
|
+
});
|
|
1731
|
+
|
|
1732
|
+
emitter.value.on("extended:search-pattern-changed", (pattern) => {
|
|
1733
|
+
const eventData = simpleEvents.value
|
|
1734
|
+
? pattern
|
|
1735
|
+
: createEventFields(pattern, "pattern");
|
|
1736
|
+
|
|
1737
|
+
/**
|
|
1738
|
+
* @event pattern-changed
|
|
1739
|
+
* @type {Object}
|
|
1740
|
+
* @property {string} inputId - id of search field set by "id" prop
|
|
1741
|
+
* @property {pattern} - pattern of internal search for available options
|
|
1742
|
+
*/
|
|
1743
|
+
emit("pattern-changed", eventData);
|
|
1744
|
+
});
|
|
1745
|
+
});
|
|
1746
|
+
|
|
1747
|
+
/**
|
|
1748
|
+
* "onMounted" hook of the Vue3ExtendedMultiselect component
|
|
1749
|
+
* @listens extended:expand-options
|
|
1750
|
+
* @listens extended:rollup-instances
|
|
1751
|
+
* @listens extended:loader-pattern-changed
|
|
1752
|
+
*/
|
|
1753
|
+
onMounted(() => {
|
|
1754
|
+
if (typeof options.value === "function") {
|
|
1755
|
+
loadOptionsByExternalLoader(null, true);
|
|
1756
|
+
} else {
|
|
1757
|
+
rawOptions.value = options.value;
|
|
1758
|
+
setPreselectedOptionsByConditions();
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
setPreselectedOptionsByModelValue();
|
|
1762
|
+
|
|
1763
|
+
if (
|
|
1764
|
+
defaultExpanded.value
|
|
1765
|
+
&& !disabled.value
|
|
1766
|
+
&& typeof options.value !== "function"
|
|
1767
|
+
) {
|
|
1768
|
+
dropdownActive.value = true;
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
emitter.value.on("extended:expand-options", () => {
|
|
1772
|
+
if (dropdownActive.value === true) return;
|
|
1773
|
+
|
|
1774
|
+
toggleAppearanceRestrictorActivate();
|
|
1775
|
+
activeEmitter();
|
|
1776
|
+
|
|
1777
|
+
dropdownActive.value = true;
|
|
1778
|
+
});
|
|
1779
|
+
|
|
1780
|
+
emitter.value.on("extended:loader-pattern-changed", (pattern) => {
|
|
1781
|
+
loadOptionsByExternalLoader(pattern, false);
|
|
1782
|
+
});
|
|
1783
|
+
|
|
1784
|
+
clickOutside.value.init(extendedMultiselectWrapper.value, () => {
|
|
1785
|
+
emitter.value.emit("extended:rollup-options");
|
|
1786
|
+
});
|
|
1787
|
+
|
|
1788
|
+
localEmitter.on("extended:rollup-instances", (instanceRef) => {
|
|
1789
|
+
if (instanceRef !== extendedMultiselectWrapper.value) {
|
|
1790
|
+
emitter.value.emit("extended:rollup-options");
|
|
1791
|
+
}
|
|
1792
|
+
});
|
|
1793
|
+
});
|
|
1794
|
+
|
|
1795
|
+
defineExpose({
|
|
1796
|
+
optionCreateLabel,
|
|
1797
|
+
});
|
|
1798
|
+
</script>
|
|
1799
|
+
|
|
1800
|
+
<style>
|
|
1801
|
+
|
|
1802
|
+
@import "../styles/main.css";
|
|
1803
|
+
|
|
1784
1804
|
</style>
|