vue3-extended-multiselect 1.9.2 → 1.9.4
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 +11 -2
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/components/ExtendedMultiselectInput.vue +8 -0
- package/src/components/ExtendedMultiselectMultiple.vue +26 -0
- package/src/components/ExtendedMultiselectOptions.vue +6 -1
- package/src/components/Vue3ExtendedMultiselect.vue +16 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Patch notes
|
|
2
2
|
|
|
3
|
-
Current `vue3-extended-multiselect` version: **1.9.
|
|
3
|
+
Current `vue3-extended-multiselect` version: **1.9.4**
|
|
4
4
|
|
|
5
5
|
***
|
|
6
6
|
|
|
@@ -345,4 +345,13 @@ Adding descriptive comments for some types in typings.
|
|
|
345
345
|
### 1.9.2 (2023-03-22)
|
|
346
346
|
|
|
347
347
|
* Fixing bug with always fixed "height" css-property of option block.
|
|
348
|
-
* Setting default value of "anyOptionWrapperBlockHeight" optional prop to "auto".
|
|
348
|
+
* Setting default value of "anyOptionWrapperBlockHeight" optional prop to "auto".
|
|
349
|
+
|
|
350
|
+
### 1.9.3 (2023-03-22)
|
|
351
|
+
|
|
352
|
+
* Fixing bug with v-model not clearing by computed property.
|
|
353
|
+
|
|
354
|
+
### 1.9.4 (2023-03-23)
|
|
355
|
+
|
|
356
|
+
* Fixing bug with hidden placeholder when "showSearchField" prop is set to false.
|
|
357
|
+
* Fixing bug with deselection of all options when "showSelectedOptions" prop is set to true.
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -84,8 +84,10 @@
|
|
|
84
84
|
:disabled="disabled"
|
|
85
85
|
:loading="loading"
|
|
86
86
|
:icon-filter="iconFilter"
|
|
87
|
+
:placeholder-block-shown="!selectedOptions.length"
|
|
87
88
|
:show-deselect-icon-loader="showDeselectIconLoader"
|
|
88
89
|
:toggle-multiple-blocks-limit="toggleMultipleBlocksLimit"
|
|
90
|
+
:appropriate-placeholder="appropriatePlaceholder"
|
|
89
91
|
:empty-objects-placeholder="emptyObjectsPlaceholder"
|
|
90
92
|
:label="label"
|
|
91
93
|
:multiple-blocks-limit-message="multipleBlocksLimitMessage"
|
|
@@ -127,6 +129,12 @@
|
|
|
127
129
|
class="extended__multiselect-block"
|
|
128
130
|
v-else
|
|
129
131
|
>
|
|
132
|
+
<span
|
|
133
|
+
v-if="placeholderBlockShown"
|
|
134
|
+
class="extended__multiselect-placeholder"
|
|
135
|
+
>
|
|
136
|
+
{{ appropriatePlaceholder }}
|
|
137
|
+
</span>
|
|
130
138
|
<slot
|
|
131
139
|
name="labelBlock"
|
|
132
140
|
:label-block-value="singleLabel"
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="extended__multiselect-block extended__multiselect-block--multiple">
|
|
3
|
+
<span
|
|
4
|
+
v-if="placeholderBlockShown"
|
|
5
|
+
class="extended__multiselect-placeholder"
|
|
6
|
+
>
|
|
7
|
+
{{ appropriatePlaceholder }}
|
|
8
|
+
</span>
|
|
3
9
|
<div
|
|
4
10
|
v-for="(option, index) in limitRestriction"
|
|
5
11
|
:key="index"
|
|
@@ -66,6 +72,16 @@ import useLabels from "../composition/labels";
|
|
|
66
72
|
import ExtendedMultiselectLoader from "./ExtendedMultiselectLoader.vue";
|
|
67
73
|
|
|
68
74
|
const props = defineProps({
|
|
75
|
+
/**
|
|
76
|
+
* Defines placeholder for extended multiselect
|
|
77
|
+
* placeholder element
|
|
78
|
+
* @property {string} appropriatePlaceholder
|
|
79
|
+
*/
|
|
80
|
+
appropriatePlaceholder: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: "",
|
|
83
|
+
},
|
|
84
|
+
|
|
69
85
|
/**
|
|
70
86
|
* Function that creates custom label for
|
|
71
87
|
* block with selected option
|
|
@@ -169,6 +185,16 @@ const props = defineProps({
|
|
|
169
185
|
required: true,
|
|
170
186
|
},
|
|
171
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Determines whether to show extended multiselect
|
|
190
|
+
* placeholder element
|
|
191
|
+
* @property {boolean} placeholderBlockShown
|
|
192
|
+
*/
|
|
193
|
+
placeholderBlockShown: {
|
|
194
|
+
type: Boolean,
|
|
195
|
+
default: false,
|
|
196
|
+
},
|
|
197
|
+
|
|
172
198
|
/**
|
|
173
199
|
* List of selected options that will be shown as option blocks
|
|
174
200
|
* @property {Array} selectedOptions
|
|
@@ -1061,7 +1061,12 @@ const selectOption = (option, clickEvent) => {
|
|
|
1061
1061
|
const optionDeselected = lookForObjectOptions(option);
|
|
1062
1062
|
|
|
1063
1063
|
if (!optionDeselected) {
|
|
1064
|
-
|
|
1064
|
+
const index = selectedOptions.value.findIndex((selectedOption) => {
|
|
1065
|
+
return JSON.stringify(selectedOption) === JSON.stringify(option);
|
|
1066
|
+
});
|
|
1067
|
+
|
|
1068
|
+
emitter.value.emit("extended:deselect-option", { skipNextRemoval: true, index });
|
|
1069
|
+
|
|
1065
1070
|
return;
|
|
1066
1071
|
}
|
|
1067
1072
|
}
|
|
@@ -226,6 +226,7 @@ import {
|
|
|
226
226
|
onMounted,
|
|
227
227
|
provide,
|
|
228
228
|
ref,
|
|
229
|
+
toRaw,
|
|
229
230
|
toRefs,
|
|
230
231
|
useAttrs,
|
|
231
232
|
useSlots,
|
|
@@ -261,9 +262,8 @@ import ExtendedMultiselectToggle from "./ExtendedMultiselectToggle.vue";
|
|
|
261
262
|
|
|
262
263
|
/**
|
|
263
264
|
* @author Ridiger Daniil Dmitrievich, 2022
|
|
264
|
-
* @version 1.9.
|
|
265
|
+
* @version 1.9.4
|
|
265
266
|
*/
|
|
266
|
-
|
|
267
267
|
const props = defineProps({
|
|
268
268
|
/**
|
|
269
269
|
* Determines whether to select just now created option
|
|
@@ -913,7 +913,7 @@ const emit = defineEmits([
|
|
|
913
913
|
]);
|
|
914
914
|
|
|
915
915
|
const dropdownActive = ref(false);
|
|
916
|
-
const
|
|
916
|
+
const skipNextRemoval = ref(false);
|
|
917
917
|
const externalOptionsLoader = ref(null);
|
|
918
918
|
const chosenToggleAppearanceSide = ref(null);
|
|
919
919
|
const selectedOptionsWatcher = ref(null);
|
|
@@ -1168,9 +1168,13 @@ watch(dropdownActive, (value) => {
|
|
|
1168
1168
|
* Changes selected options based on external modelValue changes
|
|
1169
1169
|
* @function
|
|
1170
1170
|
*/
|
|
1171
|
-
watch(modelValue, () => {
|
|
1172
|
-
if (
|
|
1173
|
-
|
|
1171
|
+
watch(modelValue, (value, prevValue) => {
|
|
1172
|
+
if (
|
|
1173
|
+
JSON.stringify(toRaw(value)) === JSON.stringify(toRaw(prevValue))
|
|
1174
|
+
|| skipNextRemoval.value
|
|
1175
|
+
) {
|
|
1176
|
+
skipNextRemoval.value = false;
|
|
1177
|
+
|
|
1174
1178
|
return;
|
|
1175
1179
|
}
|
|
1176
1180
|
|
|
@@ -1433,9 +1437,7 @@ const setPreselectedOptionsByModelValue = (withRemoval = false) => {
|
|
|
1433
1437
|
if (withRemoval) {
|
|
1434
1438
|
updateModelValue();
|
|
1435
1439
|
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
selectedOptionsWatcher.value = watch(selectedOptions, (value) => {
|
|
1440
|
+
selectedOptionsWatcher.value = watch(selectedOptions, () => {
|
|
1439
1441
|
updateModelValue();
|
|
1440
1442
|
|
|
1441
1443
|
if (resetSearchByValue.value) {
|
|
@@ -1767,7 +1769,12 @@ onBeforeMount(() => {
|
|
|
1767
1769
|
*/
|
|
1768
1770
|
emit("clean", eventData);
|
|
1769
1771
|
|
|
1772
|
+
if (payload.skipNextRemoval) {
|
|
1773
|
+
skipNextRemoval.value = true;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1770
1776
|
selectedOptions.value.splice(payload.index, 1);
|
|
1777
|
+
|
|
1771
1778
|
return;
|
|
1772
1779
|
} else {
|
|
1773
1780
|
selectedOptions.value = [];
|