vue3-extended-multiselect 1.9.7 → 1.9.8

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.7**
3
+ Current `vue3-extended-multiselect` version: **1.9.8**
4
4
 
5
5
  ***
6
6
 
@@ -366,4 +366,8 @@ Adding descriptive comments for some types in typings.
366
366
 
367
367
  ### 1.9.7 (2023-03-23)
368
368
 
369
- * Fixing bug with non-rendering "labelBlock" slot when "showSearchField" prop is set to false.
369
+ * Fixing bug with non-rendering "labelBlock" slot when "showSearchField" prop is set to false.
370
+
371
+ ### 1.9.8 (2023-03-23)
372
+
373
+ * Fixing bug with "clean" event payload when all options were deselected.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # vue3-extended-multiselect v1.9.7
1
+ # vue3-extended-multiselect v1.9.8
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.7",
3
+ "version": "1.9.8",
4
4
  "description": "Extended multiselect component for applications based on Vue 3 framework",
5
5
  "keywords": [
6
6
  "multiselect",
@@ -269,7 +269,7 @@ import ExtendedMultiselectToggle from "./ExtendedMultiselectToggle.vue";
269
269
 
270
270
  /**
271
271
  * @author Ridiger Daniil Dmitrievich, 2022
272
- * @version 1.9.7
272
+ * @version 1.9.8
273
273
  */
274
274
  const props = defineProps({
275
275
  /**
@@ -916,7 +916,6 @@ const emit = defineEmits([
916
916
  "pattern-changed",
917
917
  "select",
918
918
  "update:modelValue",
919
- "update:wrapper"
920
919
  ]);
921
920
 
922
921
  const dropdownActive = ref(false);
@@ -1709,7 +1708,6 @@ const updateModelValue = () => {
1709
1708
  * @listens extended:toggle-options
1710
1709
  * @listens extended:select-option
1711
1710
  * @listens extended:deselect-option
1712
- * @listens extended:clean-options
1713
1711
  * @listens extended:create-option
1714
1712
  * @listens extended:increase-display
1715
1713
  * @listens extended:loader-pattern-changed
@@ -1758,6 +1756,8 @@ onBeforeMount(() => {
1758
1756
  */
1759
1757
  emit("select", eventData);
1760
1758
  }
1759
+
1760
+ updateModelValue();
1761
1761
  });
1762
1762
 
1763
1763
  emitter.value.on("extended:deselect-option", (payload) => {
@@ -1765,7 +1765,7 @@ onBeforeMount(() => {
1765
1765
  const deselectedOption = selectedOptions.value[payload.index];
1766
1766
 
1767
1767
  const eventData = simpleEvents.value
1768
- ? deselectedOption
1768
+ ? deselectedOption
1769
1769
  : createEventFields(deselectedOption, "option");
1770
1770
 
1771
1771
  /**
@@ -1785,6 +1785,24 @@ onBeforeMount(() => {
1785
1785
 
1786
1786
  return;
1787
1787
  } else {
1788
+ if (!selectedOptions.value.length) return;
1789
+
1790
+ const deselectedOption = payload.deselectedOptions
1791
+ ? payload.deselectedOptions
1792
+ : selectedOptions.value;
1793
+
1794
+ const eventData = simpleEvents.value
1795
+ ? deselectedOption
1796
+ : createEventFields(deselectedOption, "option");
1797
+
1798
+ /**
1799
+ * @event clean
1800
+ * @type {Object}
1801
+ * @property {string} inputId - id of search field set by "id" prop
1802
+ * @property {UnionPropType} options - just now deselected options
1803
+ */
1804
+ emit("clean", eventData);
1805
+
1788
1806
  selectedOptions.value = [];
1789
1807
  updateModelValue();
1790
1808
  }
@@ -1794,18 +1812,6 @@ onBeforeMount(() => {
1794
1812
  }
1795
1813
  });
1796
1814
 
1797
- emitter.value.on("extended:clean-options", (selectedOptions) => {
1798
- const eventData = simpleEvents.value
1799
- ? selectedOptions.value
1800
- : createEventFields(selectedOptions, "options");
1801
-
1802
- /**
1803
- * @see clean
1804
- * @property {Array} options - just now deselected options
1805
- */
1806
- emit("clean", eventData);
1807
- });
1808
-
1809
1815
  emitter.value.on("extended:create-option", (createdOption) => {
1810
1816
  const eventData = simpleEvents.value
1811
1817
  ? createdOption
@@ -18,16 +18,19 @@ export default function useCancel(
18
18
  */
19
19
  const cancel = () => {
20
20
  if (disabled.value) return;
21
+
22
+ const deselectedOptions = selectedOptions.value;
21
23
 
22
24
  emitter.value.emit("extended:skip-block-blur-zeroing");
23
25
  emitter.value.emit("extended:deselect-option", {
24
26
  index: null,
25
27
  clearAll: true,
28
+ deselectedOptions,
26
29
  });
27
30
 
28
31
  if (!showSearchField.value) return;
29
32
 
30
- emitter.value.emit("extended:clean-options", selectedOptions.value);
33
+ emitter.value.emit("extended:clean-options");
31
34
 
32
35
  setSearchValue(null);
33
36
  setSearchPattern(null);
@@ -70,6 +70,8 @@ describe("events", () => {
70
70
  wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
71
71
 
72
72
  const cleanButton = wrapper.find("#extended__multiselect-cancel");
73
+
74
+ await mockOptionSelection(wrapper);
73
75
 
74
76
  await fireEvent.click(cleanButton.element);
75
77