vue3-extended-multiselect 1.9.1 → 1.9.3

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.9.1**
3
+ Current `vue3-extended-multiselect` version: **1.9.3**
4
4
 
5
5
  ***
6
6
 
@@ -340,4 +340,13 @@ Adding descriptive comments for some types in typings.
340
340
 
341
341
  ### 1.9.1 (2023-03-20)
342
342
 
343
- * Fixing bug with "pattern-changed" event with a call to the internal loader method.
343
+ * Fixing bug with "pattern-changed" event with a call to the internal loader method.
344
+
345
+ ### 1.9.2 (2023-03-22)
346
+
347
+ * Fixing bug with always fixed "height" css-property of option block.
348
+ * Setting default value of "anyOptionWrapperBlockHeight" optional prop to "auto".
349
+
350
+ ### 1.9.3 (2023-03-22)
351
+
352
+ * Fixing a bug with v-model not clearing by computed property.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # vue3-extended-multiselect v1.9.1
1
+ # vue3-extended-multiselect v1.9.3
2
2
 
3
3
  ***
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue3-extended-multiselect",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
4
4
  "description": "Extended multiselect component for applications based on Vue 3 framework",
5
5
  "keywords": [
6
6
  "multiselect",
@@ -266,15 +266,6 @@ const props = defineProps({
266
266
  required: true,
267
267
  },
268
268
 
269
- /**
270
- * Defines "height" css-property of every option element
271
- * @property {number} anyOptionWrapperBlockHeight
272
- */
273
- anyOptionWrapperBlockHeight: {
274
- type: Number,
275
- required: true,
276
- },
277
-
278
269
  /**
279
270
  * Determines maximal limit of selected options
280
271
  * @property {number|null} maxOptionsCount
@@ -418,6 +409,15 @@ const props = defineProps({
418
409
  default: null,
419
410
  },
420
411
 
412
+ /**
413
+ * Defines "height" css-property of every option element
414
+ * @property {number} anyOptionWrapperBlockHeight
415
+ */
416
+ anyOptionWrapperBlockHeight: {
417
+ type: [Number, String],
418
+ required: true,
419
+ },
420
+
421
421
  /**
422
422
  * Option which should be selected by default
423
423
  * if "multiple" prop equals false
@@ -645,14 +645,15 @@ const minOptionsWereNotSelected = computed(() => {
645
645
  });
646
646
 
647
647
  /**
648
- * Defines styles for "padding" and "height" css-property
648
+ * Defines styles for "padding" and "height" css-property
649
649
  * of every option element
650
650
  * @function
651
651
  * @returns {Object} styles
652
652
  */
653
653
  const optionHeightByProps = computed(() => {
654
+ const heightNumeric = typeof anyOptionWrapperBlockHeight.value === "number";
654
655
  let height = {
655
- height: `${anyOptionWrapperBlockHeight.value}px`,
656
+ height: heightNumeric ? `${anyOptionWrapperBlockHeight.value}px` : `${anyOptionWrapperBlockHeight.value}`,
656
657
  };
657
658
 
658
659
  if (optionsPadding.value.length) {
@@ -46,7 +46,6 @@
46
46
  :theme-type="themeType"
47
47
  :increase-display-by="increaseDisplayBy"
48
48
  :multipleBlocksLimit="multipleBlocksLimit"
49
- :restricted-options-length="restrictedOptionsLength"
50
49
  :toggle-multiple-blocks-limit="toggleMultipleBlocksLimit"
51
50
  :selected-options="selectedOptions"
52
51
  :emitter="emitter"
@@ -227,6 +226,7 @@ import {
227
226
  onMounted,
228
227
  provide,
229
228
  ref,
229
+ toRaw,
230
230
  toRefs,
231
231
  useAttrs,
232
232
  useSlots,
@@ -262,9 +262,8 @@ import ExtendedMultiselectToggle from "./ExtendedMultiselectToggle.vue";
262
262
 
263
263
  /**
264
264
  * @author Ridiger Daniil Dmitrievich, 2022
265
- * @version 1.9.1
265
+ * @version 1.9.3
266
266
  */
267
-
268
267
  const props = defineProps({
269
268
  /**
270
269
  * Determines whether to select just now created option
@@ -680,16 +679,6 @@ const props = defineProps({
680
679
  },
681
680
  },
682
681
 
683
- /**
684
- * Defines "height" css-property for each option in options list
685
- * @default 30
686
- * @property {number} anyOptionWrapperBlockHeight
687
- */
688
- anyOptionWrapperBlockHeight: {
689
- type: Number,
690
- default: 30,
691
- },
692
-
693
682
  /**
694
683
  * Defines gap which increases limit of displayed elements with selected options
695
684
  * @default 5
@@ -879,6 +868,17 @@ const props = defineProps({
879
868
  default: (number) => `and ${number} more items`,
880
869
  },
881
870
 
871
+
872
+ /**
873
+ * Defines "height" css-property for each option in options list
874
+ * @default 30
875
+ * @property {number} anyOptionWrapperBlockHeight
876
+ */
877
+ anyOptionWrapperBlockHeight: {
878
+ type: [Number, String],
879
+ default: "auto",
880
+ },
881
+
882
882
  /**
883
883
  * "id" attribute of search field
884
884
  * @default null
@@ -913,7 +913,6 @@ const emit = defineEmits([
913
913
  ]);
914
914
 
915
915
  const dropdownActive = ref(false);
916
- const skipNextUpdate = ref(false);
917
916
  const externalOptionsLoader = ref(null);
918
917
  const chosenToggleAppearanceSide = ref(null);
919
918
  const selectedOptionsWatcher = ref(null);
@@ -1122,16 +1121,6 @@ const restrictedOptions = computed(() => {
1122
1121
  : rawOptions.value;
1123
1122
  });
1124
1123
 
1125
- /**
1126
- * Determines length of options list after filtering by
1127
- * maximal admissible options amount
1128
- * @function
1129
- * @returns {number} length
1130
- */
1131
- const restrictedOptionsLength = computed(() => {
1132
- return restrictedOptions.value.length;
1133
- });
1134
-
1135
1124
  /**
1136
1125
  * Defines "aria-roledescription" attribute of extended multiselect wrapper
1137
1126
  * @function
@@ -1178,11 +1167,8 @@ watch(dropdownActive, (value) => {
1178
1167
  * Changes selected options based on external modelValue changes
1179
1168
  * @function
1180
1169
  */
1181
- watch(modelValue, () => {
1182
- if (skipNextUpdate.value) {
1183
- skipNextUpdate.value = false;
1184
- return;
1185
- }
1170
+ watch(modelValue, (value, prevValue) => {
1171
+ if (JSON.stringify(toRaw(value)) === JSON.stringify(toRaw(prevValue))) return;
1186
1172
 
1187
1173
  setPreselectedOptionsByModelValue(true);
1188
1174
  }, { deep: true });
@@ -1443,9 +1429,7 @@ const setPreselectedOptionsByModelValue = (withRemoval = false) => {
1443
1429
  if (withRemoval) {
1444
1430
  updateModelValue();
1445
1431
 
1446
- skipNextUpdate.value = true;
1447
-
1448
- selectedOptionsWatcher.value = watch(selectedOptions, (value) => {
1432
+ selectedOptionsWatcher.value = watch(selectedOptions, () => {
1449
1433
  updateModelValue();
1450
1434
 
1451
1435
  if (resetSearchByValue.value) {
@@ -1888,8 +1872,8 @@ onMounted(() => {
1888
1872
  dropdownActive.value = true;
1889
1873
  });
1890
1874
 
1891
- emitter.value.on("extended:loader-pattern-changed", (pattern) => {
1892
- loadOptionsByExternalLoader(pattern, false);
1875
+ emitter.value.on("extended:loader-pattern-changed", async (pattern) => {
1876
+ await loadOptionsByExternalLoader(pattern, false);
1893
1877
  });
1894
1878
 
1895
1879
  clickOutside.value.init(extendedMultiselectWrapper.value, () => {