vue3-extended-multiselect 1.1.8 → 1.2.1

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Patch notes
2
2
 
3
- Current `vue3-extended-multiselect` version: **1.1.8**
3
+ Current `vue3-extended-multiselect` version: **1.2.1**
4
4
 
5
5
  ***
6
6
 
@@ -128,4 +128,14 @@ Adding descriptive comments for some types in typings.
128
128
  * Adding "disableByField" prop for determination of field in options of type "object" which value will be used to disable such options.
129
129
 
130
130
  ### 1.1.8 (2022-12-18)
131
- * Changing default value of "toggleIcon" prop to "base-arrow".
131
+ * Changing default value of "toggleIcon" prop to "base-arrow".
132
+
133
+ ### 1.2.0 (2022-12-20)
134
+ * Adding "uuid" dependency
135
+ * Removal of "id" attribute of extended multiselect wrapper.
136
+ * Removal of "querySelector" usage in ExtendedMultiselect component. Switching to using event emitter.
137
+ * Fix bug with bound event emitters between two extended multiselects.
138
+ * Fix bug with undefined class in extended multiselect wrapper class list.
139
+
140
+ ### 1.2.1 (2022-12-21)
141
+ * Moving transitions of "border-radius" css-property from computed property to css variable.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # vue3-extended-multiselect v1.1.8
1
+ # vue3-extended-multiselect v1.2.1
2
2
 
3
3
  ***
4
4
 
@@ -171,6 +171,7 @@ Vue3 extended multiselect provides following css-variables:
171
171
  --icons-align-self: start;
172
172
  --icons-justify-self: center;
173
173
  --pointer-cursor: pointer;
174
+ --wrapper-transition: border-top-left-radius 250ms ease-out, border-top-right-radius 250ms ease-out;
174
175
  ```
175
176
 
176
177
  You can override it globally or by particular instance class name.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue3-extended-multiselect",
3
- "version": "1.1.8",
3
+ "version": "1.2.1",
4
4
  "description": "Extended multiselect component for applications based on Vue 3 framework",
5
5
  "keywords": [
6
6
  "multiselect",
@@ -25,6 +25,7 @@
25
25
  "core-js": "^3.6.5",
26
26
  "lodash-es": "^4.17.21",
27
27
  "mitt": "^3.0.0",
28
+ "uuid": "^9.0.0",
28
29
  "vue": "^3.0.0",
29
30
  "vue3-click-away": "^1.2.4"
30
31
  },
@@ -46,6 +46,16 @@ const props = defineProps({
46
46
  required: true,
47
47
  },
48
48
 
49
+ /**
50
+ * Assigns unique identifier of extended multiselect
51
+ * for each event
52
+ * @property {string} emitterUniqueId
53
+ */
54
+ emitterUniqueId: {
55
+ type: String,
56
+ required: true,
57
+ },
58
+
49
59
  /**
50
60
  * Defines a svg-filter for icons
51
61
  * @property {string} iconFilter
@@ -105,6 +115,7 @@ const props = defineProps({
105
115
 
106
116
  const {
107
117
  disabled,
118
+ emitterUniqueId,
108
119
  iconFilter,
109
120
  iconSize,
110
121
  loading,
@@ -121,6 +132,7 @@ const { cancel } = useCancel(
121
132
  disabled,
122
133
  showSearchField,
123
134
  selectedOptions,
135
+ emitterUniqueId,
124
136
  );
125
137
  const { iconSizeClass } = useSizes(iconSize);
126
138
 
@@ -37,6 +37,7 @@
37
37
  :disabled="disabled"
38
38
  :loading="loading"
39
39
  :toggle-multiple-blocks-limit="toggleMultipleBlocksLimit"
40
+ :emitter-unique-id="emitterUniqueId"
40
41
  :empty-objects-placeholder="emptyObjectsPlaceholder"
41
42
  :label="label"
42
43
  :multiple-blocks-limit-message="multipleBlocksLimitMessage"
@@ -75,6 +76,7 @@
75
76
  :disabled="disabled"
76
77
  :loading="loading"
77
78
  :toggle-multiple-blocks-limit="toggleMultipleBlocksLimit"
79
+ :emitter-unique-id="emitterUniqueId"
78
80
  :empty-objects-placeholder="emptyObjectsPlaceholder"
79
81
  :label="label"
80
82
  :multiple-blocks-limit-message="multipleBlocksLimitMessage"
@@ -140,6 +142,7 @@ import {
140
142
  onBeforeMount,
141
143
  onMounted,
142
144
  ref,
145
+ toRef,
143
146
  toRefs,
144
147
  useAttrs,
145
148
  watch,
@@ -257,6 +260,16 @@ const props = defineProps({
257
260
  required: true,
258
261
  },
259
262
 
263
+ /**
264
+ * Assigns unique identifier of extended multiselect
265
+ * for each event
266
+ * @property {string} emitterUniqueId
267
+ */
268
+ emitterUniqueId: {
269
+ type: String,
270
+ required: true,
271
+ },
272
+
260
273
  /**
261
274
  * Placeholder used in internal options filters
262
275
  * and provided to ExtendedMultiselectMultiple child component
@@ -372,6 +385,8 @@ const searchState = inject("searchState");
372
385
  const setSearchValue = inject("setSearchValue");
373
386
  const setSearchPattern = inject("setSearchPattern");
374
387
 
388
+ const emitterUniqueId = toRef(props, "emitterUniqueId");
389
+
375
390
  const blurSkip = ref(false);
376
391
  const reversePrevented = ref(false);
377
392
  const searchFieldFocused = ref(false);
@@ -385,9 +400,9 @@ const searchDebounce = ref(debounce(() => {
385
400
  const searchPattern = searchValue.value ? new RegExp(`${searchValue.value}`, "i") : null;
386
401
 
387
402
  if (externalOptionsLoader.value) {
388
- emitter.emit("extended:loader-pattern-changed", searchValue.value);
403
+ emitter.emit(`extended:loader-pattern-changed-${emitterUniqueId.value}`, searchValue.value);
389
404
  } else {
390
- emitter.emit("extended:search-pattern-changed", searchValue.value);
405
+ emitter.emit(`extended:search-pattern-changed-${emitterUniqueId.value}`, searchValue.value);
391
406
  setSearchPattern(searchPattern);
392
407
  }
393
408
  }, 250));
@@ -462,6 +477,16 @@ const searchFieldForwarding = computed(() => {
462
477
  return searchFieldFocused.value || optionWillBeTriggered.value;
463
478
  });
464
479
 
480
+ /**
481
+ * Determines whether option shall be triggered before selection
482
+ * @function
483
+ * @emits extended:renew-field-forwarding
484
+ * @param {boolean} searchFieldForwarding - restrictor of triggered option
485
+ */
486
+ watch(searchFieldForwarding, (value) => {
487
+ emitter.emit(`extended:renew-field-forwarding-${emitterUniqueId.value}`, value);
488
+ });
489
+
465
490
  /**
466
491
  * Sets pattern of internal search for available options from search field to store
467
492
  * @function
@@ -495,7 +520,7 @@ const expand = () => {
495
520
  if (disabled.value) return;
496
521
 
497
522
  searchFieldFocused.value = true;
498
- emitter.emit("extended:expand-options");
523
+ emitter.emit(`extended:expand-options-${emitterUniqueId.value}`);
499
524
  };
500
525
 
501
526
  /**
@@ -544,7 +569,7 @@ const rollUp = () => {
544
569
  blurSkipByBlock.value = 0;
545
570
  blurSkipByToggleIcon.value = 0;
546
571
 
547
- emitter.emit("extended:rollup-options", true);
572
+ emitter.emit(`extended:rollup-options-${emitterUniqueId.value}`, true);
548
573
  };
549
574
 
550
575
  /**
@@ -569,7 +594,7 @@ const search = () => {
569
594
  * @listens extended:trigger-selection
570
595
  */
571
596
  onBeforeMount(() => {
572
- emitter.on("extended:rollup-options", (internalRollup) => {
597
+ emitter.on(`extended:rollup-options-${emitterUniqueId.value}`, (internalRollup) => {
573
598
  if (blurSkip.value === true) {
574
599
  blurSkip.value = false;
575
600
  return;
@@ -582,7 +607,7 @@ onBeforeMount(() => {
582
607
  rollUp();
583
608
  });
584
609
 
585
- emitter.on("extended:select-option", (option) => {
610
+ emitter.on(`extended:select-option-${emitterUniqueId.value}`, (option) => {
586
611
  if (toggleOptionsBySelect.value) {
587
612
  rollUp();
588
613
  }
@@ -594,7 +619,7 @@ onBeforeMount(() => {
594
619
  }
595
620
  });
596
621
 
597
- emitter.on("extended:deselect-option", () => {
622
+ emitter.on(`extended:deselect-option-${emitterUniqueId.value}`, () => {
598
623
  if (multiple.value) {
599
624
  return;
600
625
  } else {
@@ -602,27 +627,27 @@ onBeforeMount(() => {
602
627
  }
603
628
  });
604
629
 
605
- emitter.on("extended:clean-options", () => {
630
+ emitter.on(`extended:clean-options-${emitterUniqueId.value}`, () => {
606
631
  searchValue.value = null;
607
632
  });
608
633
 
609
- emitter.on("extended:clear-field", () => {
634
+ emitter.on(`extended:clear-field-${emitterUniqueId.value}`, () => {
610
635
  searchValue.value = null;
611
636
  });
612
637
 
613
- emitter.on("extended:skip-blur", () => {
638
+ emitter.on(`extended:skip-blur-${emitterUniqueId.value}`, () => {
614
639
  blurSkipByToggleIcon.value++;
615
640
  });
616
641
 
617
- emitter.on("extended:skip-block-blur", () => {
642
+ emitter.on(`extended:skip-block-blur-${emitterUniqueId.value}`, () => {
618
643
  blurSkipByBlock.value++;
619
644
  });
620
645
 
621
- emitter.on("extended:skip-block-blur-zeroing", () => {
646
+ emitter.on(`extended:skip-block-blur-zeroing-${emitterUniqueId.value}`, () => {
622
647
  blurSkipByBlock.value = 0;
623
648
  });
624
649
 
625
- emitter.on("extended:trigger-selection", (triggerState) => {
650
+ emitter.on(`extended:trigger-selection-${emitterUniqueId.value}`, (triggerState) => {
626
651
  optionWillBeTriggered.value = triggerState;
627
652
  });
628
653
  });
@@ -632,7 +657,7 @@ onBeforeMount(() => {
632
657
  * @listens extended:field-focus
633
658
  */
634
659
  onMounted(() => {
635
- emitter.on("extended:field-focus", () => {
660
+ emitter.on(`extended:field-focus-${emitterUniqueId.value}`, () => {
636
661
  if (showSearchField.value) {
637
662
  nextTick(() => {
638
663
  extendedInput.value.focus();
@@ -82,6 +82,16 @@ const props = defineProps({
82
82
  required: true,
83
83
  },
84
84
 
85
+ /**
86
+ * Assigns unique identifier of extended multiselect
87
+ * for each event
88
+ * @property {string} emitterUniqueId
89
+ */
90
+ emitterUniqueId: {
91
+ type: String,
92
+ required: true,
93
+ },
94
+
85
95
  /**
86
96
  * Defines label for blocks with options of type "object"
87
97
  * or Array instances which length/keys length equals 0
@@ -169,6 +179,7 @@ const props = defineProps({
169
179
  const {
170
180
  createCustomOptionLabel,
171
181
  disabled,
182
+ emitterUniqueId,
172
183
  emptyObjectsPlaceholder,
173
184
  label,
174
185
  increaseDisplayBy,
@@ -286,7 +297,7 @@ const overLimitOptionsCount = computed(() => {
286
297
  const deselectBlock = (index) => {
287
298
  if (loading.value || disabled.value) return;
288
299
 
289
- emitter.emit("extended:deselect-option", { index });
300
+ emitter.emit(`extended:deselect-option-${emitterUniqueId.value}`, { index });
290
301
  };
291
302
 
292
303
  /**
@@ -298,7 +309,7 @@ const deselectBlock = (index) => {
298
309
  */
299
310
  const showMoreOptions = () => {
300
311
  optionsLimitIncreaser.value += increaseDisplayBy.value;
301
- emitter.emit("extended:increase-display", optionsLimitIncreaser.value);
312
+ emitter.emit(`extended:increase-display-${emitterUniqueId.value}`, optionsLimitIncreaser.value);
302
313
  };
303
314
 
304
315
  /**
@@ -217,6 +217,16 @@ const props = defineProps({
217
217
  required: true,
218
218
  },
219
219
 
220
+ /**
221
+ * Assigns unique identifier of extended multiselect
222
+ * for each event
223
+ * @property {string} emitterUniqueId
224
+ */
225
+ emitterUniqueId: {
226
+ type: String,
227
+ required: true,
228
+ },
229
+
220
230
  /**
221
231
  * Sets labels for options of type "object"
222
232
  * or Array instances which length/keys length equals 0
@@ -403,6 +413,7 @@ const searchState = inject("searchState");
403
413
  const setSearchValue = inject("setSearchValue");
404
414
  const setSearchPattern = inject("setSearchPattern");
405
415
 
416
+ const fieldWasShown = ref(false);
406
417
  const atopWithScroll = ref(null);
407
418
  const enterIndex = ref(null);
408
419
  const heightFromMounted = ref(null);
@@ -424,6 +435,7 @@ const {
424
435
  createOptionType,
425
436
  disableByField,
426
437
  disabledPrimitiveOptionsConverted,
438
+ emitterUniqueId,
427
439
  emptyObjectsPlaceholder,
428
440
  highlightOptions,
429
441
  label,
@@ -708,7 +720,7 @@ const createNewOption = () => {
708
720
  }
709
721
 
710
722
  options.value.unshift(newOption);
711
- emitter.emit("extended:create-option", newOption);
723
+ emitter.emit(`extended:create-option-${emitterUniqueId.value}`, newOption);
712
724
 
713
725
  if (autoSelectCreatedOption.value) {
714
726
  selectOption(newOption, { target: { id: "extended__multiselect" } });
@@ -974,7 +986,7 @@ const optionHighlightClasses = (option) => {
974
986
  * @param {MouseEvent|KeyboardEvent} clickEvent - MouseEvent or KeyboardEvent instance
975
987
  */
976
988
  const selectOption = (option, clickEvent) => {
977
- emitter.emit("extended:trigger-selection", false);
989
+ emitter.emit(`extended:trigger-selection-${emitterUniqueId.value}`, false);
978
990
 
979
991
  if (!clickEvent) return;
980
992
  if (keyBlocker(clickEvent)) return;
@@ -989,7 +1001,7 @@ const selectOption = (option, clickEvent) => {
989
1001
  const optionDeselected = lookForObjectOptions(option);
990
1002
 
991
1003
  if (!optionDeselected) {
992
- emitter.emit("extended:deselect-option");
1004
+ emitter.emit(`extended:deselect-option-${emitterUniqueId.value}`);
993
1005
  return;
994
1006
  }
995
1007
  }
@@ -1019,15 +1031,15 @@ const selectOptionEmitter = (option) => {
1019
1031
 
1020
1032
  if (multiple.value) {
1021
1033
  if (clearBySelectWhenMultiple.value) {
1022
- emitter.emit("extended:clear-field");
1034
+ emitter.emit(`extended:clear-field-${emitterUniqueId.value}`);
1023
1035
  }
1024
1036
 
1025
- emitter.emit("extended:select-option", {
1037
+ emitter.emit(`extended:select-option-${emitterUniqueId.value}`, {
1026
1038
  label,
1027
1039
  option,
1028
1040
  });
1029
1041
  } else {
1030
- emitter.emit("extended:select-option", {
1042
+ emitter.emit(`extended:select-option-${emitterUniqueId.value}`, {
1031
1043
  label,
1032
1044
  option,
1033
1045
  });
@@ -1065,16 +1077,15 @@ const showCurrentMarker = (option) => {
1065
1077
  * @emits extended:trigger-selection
1066
1078
  */
1067
1079
  const triggerOptionBeforeSelection = () => {
1068
- const fieldWasShown = document.querySelector(".extended__multiselect-input");
1069
-
1070
- if (fieldWasShown) {
1071
- emitter.emit("extended:trigger-selection", true);
1080
+ if (fieldWasShown.value) {
1081
+ emitter.emit(`extended:trigger-selection-${emitterUniqueId.value}`, true);
1072
1082
  }
1073
1083
  };
1074
1084
 
1075
1085
  /**
1076
1086
  * "onBeforeMount" hook of ExtendedMultiselectOptions component
1077
1087
  * @listens extended:select-enter
1088
+ * @listens extended:renew-field-forwarding
1078
1089
  * @listens extended:reset-index
1079
1090
  */
1080
1091
  onBeforeMount(() => {
@@ -1088,14 +1099,18 @@ onBeforeMount(() => {
1088
1099
  console.warn("vue-extended-multiselect: «label» property can not be of type «object»");
1089
1100
  }
1090
1101
 
1091
- emitter.on("extended:select-enter", (keyboardEvent) => {
1102
+ emitter.on(`extended:select-enter-${emitterUniqueId.value}`, (keyboardEvent) => {
1092
1103
  if (!enterIndex.value) return;
1093
1104
 
1094
1105
  const option = availableOptions.value[enterIndex.value];
1095
1106
  selectOption(option, keyboardEvent);
1096
1107
  });
1097
1108
 
1098
- emitter.on("extended:reset-index", () => {
1109
+ emitter.on(`extended:renew-field-forwarding-${emitterUniqueId.value}`, (value) => {
1110
+ fieldWasShown.value = value;
1111
+ });
1112
+
1113
+ emitter.on(`extended:reset-index-${emitterUniqueId.value}`, () => {
1099
1114
  enterIndex.value = null;
1100
1115
  });
1101
1116
  });
@@ -137,6 +137,16 @@ const props = defineProps({
137
137
  required: true,
138
138
  },
139
139
 
140
+ /**
141
+ * Assigns unique identifier of extended multiselect
142
+ * for each event
143
+ * @property {string} emitterUniqueId
144
+ */
145
+ emitterUniqueId: {
146
+ type: String,
147
+ required: true,
148
+ },
149
+
140
150
  /**
141
151
  * Determines toggle icon to be used in default toggle slot
142
152
  * @property {string} toggleIcon
@@ -160,6 +170,7 @@ const props = defineProps({
160
170
  const {
161
171
  disabled,
162
172
  dropdownActive,
173
+ emitterUniqueId,
163
174
  iconFilter,
164
175
  iconSize,
165
176
  loading,
@@ -173,6 +184,7 @@ const { toggleSlotClass, toggleOptionsList } = useToggle(
173
184
  loading,
174
185
  disabled,
175
186
  null,
187
+ emitterUniqueId,
176
188
  );
177
189
  const { iconSizeClass } = useSizes(iconSize);
178
190
 
@@ -15,7 +15,6 @@
15
15
  @mouseleave.stop="resetEnterIndex"
16
16
  >
17
17
  <div
18
- id="extended__multiselect"
19
18
  ref="extendedMultiselect"
20
19
  :class="classes"
21
20
  :style="[displayWrongValue, expanded]"
@@ -31,12 +30,12 @@
31
30
  :create-on-the-go="createOnTheGo"
32
31
  :disabled="inputDisabled"
33
32
  :dropdown-active="dropdownActive"
34
- :external-options-loader="externalOptionsLoader"
35
33
  :loading="internalLoading"
36
34
  :multiple="multiple"
37
35
  :search-filter-active="searchFilterActive"
38
36
  :toggling-saves-search-value="togglingSavesSearchValue"
39
37
  :toggle-options-by-select="toggleOptionsBySelect"
38
+ :emitter-unique-id="emitterUniqueId"
40
39
  :placeholder="placeholder"
41
40
  :show-search-field="showSearchField"
42
41
  :empty-objects-placeholder="emptyObjectsPlaceholder"
@@ -50,6 +49,7 @@
50
49
  :selected-options="selectedOptions"
51
50
  :create-custom-option-label="createCustomOptionLabel"
52
51
  :create-option-placeholder="createOptionPlaceholder"
52
+ :external-options-loader="externalOptionsLoader"
53
53
  :input-id="inputId"
54
54
  >
55
55
  <template
@@ -98,6 +98,7 @@
98
98
  :disabled="inputDisabled"
99
99
  :dropdown-active="dropdownActive"
100
100
  :loading="internalLoading"
101
+ :emitter-unique-id="emitterUniqueId"
101
102
  :icon-filter="iconFilter"
102
103
  :icon-size="iconSize"
103
104
  :toggle-icon="toggleIcon"
@@ -113,6 +114,7 @@
113
114
  :disabled="inputDisabled"
114
115
  :show-search-field="showSearchField"
115
116
  :loading="internalLoading"
117
+ :emitter-unique-id="emitterUniqueId"
116
118
  :icon-filter="iconFilter"
117
119
  :icon-size="iconSize"
118
120
  :selected-options="selectedOptions"
@@ -137,6 +139,7 @@
137
139
  :chosen-toggle-appearance-side="chosenToggleAppearanceSide"
138
140
  :create-option-type="createOptionType"
139
141
  :disable-by-field="disableByField"
142
+ :emitter-unique-id="emitterUniqueId"
140
143
  :empty-objects-placeholder="emptyObjectsPlaceholder"
141
144
  :label="label"
142
145
  :search-by-field="searchByField"
@@ -223,6 +226,7 @@ import {
223
226
 
224
227
  import { directive as vClickOutside } from "vue3-click-away";
225
228
  import emitter from "../events/emitter";
229
+ import { v4 } from "uuid";
226
230
 
227
231
  import {
228
232
  themeTypes,
@@ -249,7 +253,7 @@ import ExtendedMultiselectToggle from "./ExtendedMultiselectToggle.vue";
249
253
 
250
254
  /**
251
255
  * @author Ridiger Daniil Dmitrievich
252
- * @version 1.0.0
256
+ * @version 1.2.1
253
257
  */
254
258
 
255
259
  const props = defineProps({
@@ -874,6 +878,7 @@ const inputDisabled = ref(false);
874
878
  const internalLoader = ref(false);
875
879
  const externalOptionsLoader = ref(null);
876
880
  const chosenToggleAppearanceSide = ref(null);
881
+ const emitterUniqueId = ref(v4());
877
882
  const rawOptions = ref([]);
878
883
  const selectedOptions = ref([]);
879
884
  const togglePattern = /^extended__multiselect-toggle/i;
@@ -924,14 +929,16 @@ provide("setSearchValue", setSearchValue);
924
929
  provide("setSearchPattern", setSearchPattern);
925
930
 
926
931
  const { toggleOptionsList } = useToggle(
927
- loading,
928
- disabled,
929
- internalLoader,
932
+ loading,
933
+ disabled,
934
+ internalLoader,
935
+ emitterUniqueId,
930
936
  );
931
937
  const { cancel } = useCancel(
932
- disabled,
933
- showSearchField,
938
+ disabled,
939
+ showSearchField,
934
940
  selectedOptions,
941
+ emitterUniqueId,
935
942
  );
936
943
  const { createLabel, optionTypeRestrictor } = usePreselectedOptions(
937
944
  label,
@@ -971,7 +978,7 @@ const classes = computed(() => {
971
978
  case "strict":
972
979
  theme = "extended__multiselect-strict";
973
980
  break;
974
- default: return ["extended__multiselect"];
981
+ default: theme = "extended__multiselect";
975
982
  }
976
983
 
977
984
  localClassList.push(theme);
@@ -981,6 +988,7 @@ const classes = computed(() => {
981
988
  : "extended__multiselect-clear--locked";
982
989
 
983
990
  localClassList.push(clear);
991
+ localClassList.push("extended__multiselect-container");
984
992
 
985
993
  return localClassList;
986
994
  });
@@ -1025,13 +1033,11 @@ const expanded = computed(() => {
1025
1033
  borderStyles = {
1026
1034
  borderTopLeftRadius: 0,
1027
1035
  borderTopRightRadius: 0,
1028
- transition: "border-top-left-radius 250ms, border-top-right-radius 250ms",
1029
1036
  };
1030
1037
  } else {
1031
1038
  borderStyles = {
1032
1039
  borderBottomLeftRadius: 0,
1033
1040
  borderBottomRightRadius: 0,
1034
- transition: "border-bottom-left-radius 250ms, border-bottom-right-radius 250ms",
1035
1041
  };
1036
1042
  }
1037
1043
 
@@ -1118,7 +1124,7 @@ watch(disabled, (value) => {
1118
1124
  */
1119
1125
  watch(dropdownActive, (value) => {
1120
1126
  if (!value) {
1121
- emitter.emit("extended:rollup-options");
1127
+ emitter.emit(`extended:rollup-options-${emitterUniqueId.value}`);
1122
1128
  }
1123
1129
  });
1124
1130
 
@@ -1147,7 +1153,7 @@ watch(selectedOptions, (value) => {
1147
1153
  }
1148
1154
 
1149
1155
  if (resetSearchByValue.value) {
1150
- emitter.emit("extended:clear-field");
1156
+ emitter.emit(`extended:clear-field-${emitterUniqueId.value}`);
1151
1157
  }
1152
1158
  }, { deep: true });
1153
1159
 
@@ -1175,7 +1181,7 @@ const activeEmitter = () => {
1175
1181
  * @emits "extended:rollup-options"
1176
1182
  */
1177
1183
  const clickOutside = () => {
1178
- emitter.emit("extended:rollup-options");
1184
+ emitter.emit(`extended:rollup-options-${emitterUniqueId.value}`);
1179
1185
  };
1180
1186
 
1181
1187
  /**
@@ -1242,7 +1248,7 @@ const fieldFocus = (mouseEvent) => {
1242
1248
  if (filteredHasCancel.length) return;
1243
1249
  if (filteredHasToggle.length && dropdownActive.value === false) return;
1244
1250
 
1245
- emitter.emit("extended:field-focus");
1251
+ emitter.emit(`extended:field-focus-${emitterUniqueId.value}`);
1246
1252
  };
1247
1253
 
1248
1254
  /**
@@ -1266,7 +1272,7 @@ const loadOptionsByExternalLoader = (pattern) => {
1266
1272
  * @emits extended:reset-index
1267
1273
  */
1268
1274
  const resetEnterIndex = () => {
1269
- emitter.emit("extended:reset-index");
1275
+ emitter.emit(`extended:reset-index-${emitterUniqueId.value}`);
1270
1276
  };
1271
1277
 
1272
1278
  /**
@@ -1276,7 +1282,7 @@ const resetEnterIndex = () => {
1276
1282
  */
1277
1283
  const rollUp = () => {
1278
1284
  dropdownActive.value = false;
1279
- emitter.emit("extended:rollup-options");
1285
+ emitter.emit(`extended:rollup-options-${emitterUniqueId.value}`);
1280
1286
  };
1281
1287
 
1282
1288
  /**
@@ -1286,7 +1292,7 @@ const rollUp = () => {
1286
1292
  * @param {KeyboardEvent} keyboardEvent - KeyboardEvent instance
1287
1293
  */
1288
1294
  const selectByEnter = (keyboardEvent) => {
1289
- emitter.emit("extended:select-enter", keyboardEvent);
1295
+ emitter.emit(`extended:select-enter-${emitterUniqueId.value}`, keyboardEvent);
1290
1296
  };
1291
1297
 
1292
1298
  /**
@@ -1309,7 +1315,7 @@ const setPreselectedOption = () => {
1309
1315
  const isObjectOrArray = typeof preselectedOption.value === "object";
1310
1316
  const label = createLabel(isObjectOrArray, preselectedOption.value);
1311
1317
 
1312
- emitter.emit("extended:select-option", {
1318
+ emitter.emit(`extended:select-option-${emitterUniqueId.value}`, {
1313
1319
  label,
1314
1320
  option: preselectedOption.value,
1315
1321
  });
@@ -1339,7 +1345,7 @@ const setPreselectedOptions = async () => {
1339
1345
 
1340
1346
  allOptionsWereSelected++;
1341
1347
 
1342
- emitter.emit("extended:select-option", {
1348
+ emitter.emit(`extended:select-option-${emitterUniqueId.value}`, {
1343
1349
  label,
1344
1350
  option: preselectedOption,
1345
1351
  });
@@ -1374,7 +1380,9 @@ const toggleAppearanceRestrictor = () => {
1374
1380
  if (!window) return "under";
1375
1381
 
1376
1382
  const innerHeight = window.innerHeight;
1377
- const offsetTop = extendedMultiselect.value.getBoundingClientRect().y;
1383
+ const offsetTop = extendedMultiselect.value
1384
+ ? extendedMultiselect.value.getBoundingClientRect().y
1385
+ : 0;
1378
1386
  const difference = innerHeight - offsetTop;
1379
1387
 
1380
1388
  if (difference > toggleMaxHeight.value) {
@@ -1424,7 +1432,7 @@ const toggleBlockRestrictor = (mouseEvent) => {
1424
1432
  }
1425
1433
 
1426
1434
  if (generalRestriction) {
1427
- emitter.emit("extended:skip-block-blur");
1435
+ emitter.emit(`extended:skip-block-blur`);
1428
1436
  return true;
1429
1437
  }
1430
1438
 
@@ -1536,7 +1544,7 @@ const toggleRestrictor = (mouseEvent) => {
1536
1544
  const filteredHasToggle = toggleDetector(mouseEvent, togglePattern);
1537
1545
 
1538
1546
  if (filteredHasToggle.length && dropdownActive.value) {
1539
- emitter.emit("extended:skip-blur");
1547
+ emitter.emit(`extended:skip-blur-${emitterUniqueId.value}`);
1540
1548
  }
1541
1549
  };
1542
1550
 
@@ -1560,18 +1568,18 @@ const toggleRestrictor = (mouseEvent) => {
1560
1568
  onBeforeMount(() => {
1561
1569
  chosenToggleAppearanceSide.value = toggleAppearanceSide.value;
1562
1570
 
1563
- emitter.on("extended:rollup-options", () => {
1571
+ emitter.on(`extended:rollup-options-${emitterUniqueId.value}`, () => {
1564
1572
  if (!dropdownActive.value) return;
1565
1573
 
1566
1574
  closeEmitter();
1567
1575
  dropdownActive.value = false;
1568
1576
  });
1569
1577
 
1570
- emitter.on("extended:toggle-options", () => {
1578
+ emitter.on(`extended:toggle-options-${emitterUniqueId.value}`, () => {
1571
1579
  toggleOptions();
1572
1580
  });
1573
1581
 
1574
- emitter.on("extended:select-option", (option) => {
1582
+ emitter.on(`extended:select-option-${emitterUniqueId.value}`, (option) => {
1575
1583
  const eventData = simpleEvents.value
1576
1584
  ? option.option
1577
1585
  : createEventFields(option.option, "option");
@@ -1594,7 +1602,7 @@ onBeforeMount(() => {
1594
1602
  }
1595
1603
  });
1596
1604
 
1597
- emitter.on("extended:deselect-option", (payload) => {
1605
+ emitter.on(`extended:deselect-option-${emitterUniqueId.value}`, (payload) => {
1598
1606
  if (multiple.value && (payload && !payload.clearAll)) {
1599
1607
  const deselectedOption = selectedOptions.value[payload.index];
1600
1608
 
@@ -1617,11 +1625,11 @@ onBeforeMount(() => {
1617
1625
  }
1618
1626
 
1619
1627
  if (toggleOptionsBySelect.value) {
1620
- emitter.emit("extended:rollup-options");
1628
+ emitter.emit(`extended:rollup-options-${emitterUniqueId.value}`);
1621
1629
  }
1622
1630
  });
1623
1631
 
1624
- emitter.on("extended:clean-options", (selectedOptions) => {
1632
+ emitter.on(`extended:clean-options-${emitterUniqueId.value}`, (selectedOptions) => {
1625
1633
  const eventData = simpleEvents.value
1626
1634
  ? selectedOptions.value
1627
1635
  : createEventFields(selectedOptions, "options");
@@ -1633,7 +1641,7 @@ onBeforeMount(() => {
1633
1641
  emit("clean", eventData);
1634
1642
  });
1635
1643
 
1636
- emitter.on("extended:create-option", (createdOption) => {
1644
+ emitter.on(`extended:create-option-${emitterUniqueId.value}`, (createdOption) => {
1637
1645
  const eventData = simpleEvents.value
1638
1646
  ? createdOption
1639
1647
  : createEventFields(createdOption, "option");
@@ -1647,7 +1655,7 @@ onBeforeMount(() => {
1647
1655
  emit("option-created", eventData);
1648
1656
  });
1649
1657
 
1650
- emitter.on("extended:increase-display", (limit) => {
1658
+ emitter.on(`extended:increase-display-${emitterUniqueId.value}`, (limit) => {
1651
1659
  const eventData = simpleEvents.value ? limit : createEventFields(limit, "limit");
1652
1660
 
1653
1661
  /**
@@ -1659,7 +1667,7 @@ onBeforeMount(() => {
1659
1667
  emit("increase", eventData);
1660
1668
  });
1661
1669
 
1662
- emitter.on("extended:search-pattern-changed", (pattern) => {
1670
+ emitter.on(`extended:search-pattern-changed-${emitterUniqueId.value}`, (pattern) => {
1663
1671
  const eventData = simpleEvents.value
1664
1672
  ? pattern
1665
1673
  : createEventFields(pattern, "pattern");
@@ -1696,7 +1704,7 @@ onMounted(() => {
1696
1704
  dropdownActive.value = true;
1697
1705
  }
1698
1706
 
1699
- emitter.on("extended:expand-options", () => {
1707
+ emitter.on(`extended:expand-options-${emitterUniqueId.value}`, () => {
1700
1708
  if (dropdownActive.value === true) return;
1701
1709
 
1702
1710
  toggleAppearanceRestrictorActivate();
@@ -1705,7 +1713,7 @@ onMounted(() => {
1705
1713
  dropdownActive.value = true;
1706
1714
  });
1707
1715
 
1708
- emitter.on("extended:loader-pattern-changed", (pattern) => {
1716
+ emitter.on(`extended:loader-pattern-changed-${emitterUniqueId.value}`, (pattern) => {
1709
1717
  loadOptionsByExternalLoader(pattern);
1710
1718
  });
1711
1719
  });
@@ -2,7 +2,7 @@ import emitter from "../events/emitter";
2
2
 
3
3
  import useSearchValue from './search-value';
4
4
 
5
- export default function useCancel(disabled, showSearchField, selectedOptions) {
5
+ export default function useCancel(disabled, showSearchField, selectedOptions, emitterUniqueId) {
6
6
  /**
7
7
  * Removes all selected options or single selected option
8
8
  * when "multiple" prop equals false
@@ -16,15 +16,15 @@ export default function useCancel(disabled, showSearchField, selectedOptions) {
16
16
 
17
17
  if (disabled.value) return;
18
18
 
19
- emitter.emit("extended:skip-block-blur-zeroing");
20
- emitter.emit("extended:deselect-option", {
19
+ emitter.emit(`extended:skip-block-blur-zeroing-${emitterUniqueId.value}`);
20
+ emitter.emit(`extended:deselect-option-${emitterUniqueId.value}`, {
21
21
  index: null,
22
22
  clearAll: true,
23
23
  });
24
24
 
25
25
  if (!showSearchField.value) return;
26
26
 
27
- emitter.emit("extended:clean-options", selectedOptions.value);
27
+ emitter.emit(`extended:clean-options-${emitterUniqueId.value}`, selectedOptions.value);
28
28
 
29
29
  setSearchValue(null);
30
30
  setSearchPattern(null);
@@ -2,7 +2,7 @@ import { computed, readonly } from "vue";
2
2
 
3
3
  import emitter from "../events/emitter"
4
4
 
5
- export default function useToggle(loading, disabled, internalLoader) {
5
+ export default function useToggle(loading, disabled, internalLoader, emitterUniqueId) {
6
6
  /**
7
7
  * Toggles classes of slots if "loading"
8
8
  * or "disabled" props equals true
@@ -24,7 +24,7 @@ export default function useToggle(loading, disabled, internalLoader) {
24
24
  const toggleOptionsList = (event) => {
25
25
  if (event && event.code === "Tab") return;
26
26
 
27
- emitter.emit("extended:toggle-options");
27
+ emitter.emit(`extended:toggle-options-${emitterUniqueId.value}`);
28
28
  };
29
29
 
30
30
  return {
@@ -16,7 +16,7 @@
16
16
  font-style: inherit;
17
17
  }
18
18
 
19
- .extended__multiselect-wrapper--disabled #extended__multiselect {
19
+ .extended__multiselect-wrapper--disabled .extended__multiselect-container {
20
20
  background-color: var(--disabled);
21
21
  user-select: none;
22
22
  cursor: var(--default-cursor);
@@ -27,6 +27,11 @@
27
27
  cursor: --default-cursor;
28
28
  }
29
29
 
30
+ .extended__multiselect-container {
31
+ align-items: center;
32
+ transition: var(--wrapper-transition);
33
+ }
34
+
30
35
  .extended__multiselect,
31
36
  .extended__multiselect-slate-grey,
32
37
  .extended__multiselect-slate-blue,
@@ -119,7 +124,7 @@
119
124
 
120
125
  .extended__multiselect,
121
126
  .extended__multiselect-options {
122
- border-color: var(--basic-color) !important;
127
+ border-color: var(--basic-color);
123
128
  }
124
129
 
125
130
  .extended__multiselect-slate-grey,
@@ -390,8 +395,8 @@
390
395
  border-color: transparent;
391
396
  }
392
397
 
393
- #extended__multiselect + .extended__multiselect-options--marker > span:not([id^=option-label]),
394
- #extended__multiselect + .extended__multiselect-options--marker > .extended__multiselect-option-create {
398
+ .extended__multiselect-container + .extended__multiselect-options--marker > span:not([id^=option-label]),
399
+ .extended__multiselect-container + .extended__multiselect-options--marker > .extended__multiselect-option-create {
395
400
  padding-left: 30px;
396
401
  }
397
402
 
@@ -45,4 +45,5 @@
45
45
  --icons-align-self: start;
46
46
  --icons-justify-self: center;
47
47
  --pointer-cursor: pointer;
48
+ --wrapper-transition: border-top-left-radius 250ms ease-out, border-top-right-radius 250ms ease-out;
48
49
  }
@@ -25,7 +25,10 @@ describe("events", () => {
25
25
 
26
26
  wrapper = await mountComponent(Vue3ExtendedMultiselect, true, propsData);
27
27
 
28
- emitter.emit("extended:search-pattern-changed", globalThis.SEARCH_VALUE);
28
+ emitter.emit(
29
+ `extended:search-pattern-changed-${wrapper.vm.emitterUniqueId}`,
30
+ globalThis.SEARCH_VALUE,
31
+ );
29
32
 
30
33
  expect(wrapper.emitted()['pattern-changed'][0][0]).toEqual(globalThis.SEARCH_VALUE);
31
34
  });
@@ -110,7 +113,7 @@ describe("events", () => {
110
113
  await mockOptionSelection(wrapper);
111
114
 
112
115
  expect(wrapper.emitted().close[0][0].inputId).toEqual(globalThis.INPUT_ID);
113
- expect(wrapper.emitted().close[0][0].options).toHaveLength(0);
116
+ expect(wrapper.emitted().close[0][0].options).toHaveLength(1);
114
117
  });
115
118
 
116
119
 
@@ -423,7 +423,7 @@ describe("props", () => {
423
423
  wrongCurrentValue: true,
424
424
  };
425
425
 
426
- wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData).find("#extended__multiselect");
426
+ wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData).find(".extended__multiselect-container");
427
427
 
428
428
  expect(wrapper.attributes("style")).toMatch("border-color: #ff0000");
429
429
  });
@@ -526,7 +526,7 @@ describe("props", () => {
526
526
  errorBorderColor: "#DC143C",
527
527
  };
528
528
 
529
- wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData).find("#extended__multiselect");
529
+ wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData).find(".extended__multiselect-container");
530
530
 
531
531
  expect(wrapper.attributes("style")).toMatch("border-color: #dc143c");
532
532
  });
@@ -636,9 +636,7 @@ describe("props", () => {
636
636
 
637
637
  wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
638
638
 
639
- await expandOptionsList(wrapper);
640
-
641
- const multiselectWrapper = wrapper.find("#extended__multiselect");
639
+ const multiselectWrapper = wrapper.find(".extended__multiselect-container");
642
640
  const multipleWrapper = wrapper.findComponent(ExtendedMultiselectMultiple);
643
641
  const optionWrapper = wrapper.findComponent(ExtendedMultiselectOptions);
644
642