vue3-extended-multiselect 1.5.3 → 1.5.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 +6 -2
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/components/Vue3ExtendedMultiselect.vue +9 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Patch notes
|
|
2
2
|
|
|
3
|
-
Current `vue3-extended-multiselect` version: **1.5.
|
|
3
|
+
Current `vue3-extended-multiselect` version: **1.5.4**
|
|
4
4
|
|
|
5
5
|
***
|
|
6
6
|
|
|
@@ -204,4 +204,8 @@ Adding descriptive comments for some types in typings.
|
|
|
204
204
|
### 1.5.3 (2023-01-25)
|
|
205
205
|
|
|
206
206
|
* Fixing bug with incorrect setting of preselected options from v-model.
|
|
207
|
-
* Fixing bug with incompatible single preselected option.
|
|
207
|
+
* Fixing bug with incompatible single preselected option.
|
|
208
|
+
|
|
209
|
+
### 1.5.4 (2023-01-25)
|
|
210
|
+
|
|
211
|
+
* Removal of restrictions for preselected options from v-model.
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -253,7 +253,7 @@ import ExtendedMultiselectToggle from "./ExtendedMultiselectToggle.vue";
|
|
|
253
253
|
|
|
254
254
|
/**
|
|
255
255
|
* @author Ridiger Daniil Dmitrievich
|
|
256
|
-
* @version 1.5.
|
|
256
|
+
* @version 1.5.4
|
|
257
257
|
*/
|
|
258
258
|
|
|
259
259
|
const props = defineProps({
|
|
@@ -1314,15 +1314,16 @@ const selectByEnter = (keyboardEvent) => {
|
|
|
1314
1314
|
* @function
|
|
1315
1315
|
* @emits extended:select-option
|
|
1316
1316
|
* @param {UnionPropType} preselectedOption - option to be selected
|
|
1317
|
+
* @param {boolean} restriction - restriction of preselected option
|
|
1317
1318
|
*/
|
|
1318
|
-
const setPreselectedOption = (preselectedOption) => {
|
|
1319
|
+
const setPreselectedOption = (preselectedOption, restriction = true) => {
|
|
1319
1320
|
const availableOptionType = optionTypeRestrictor(preselectedOption);
|
|
1320
1321
|
const mappedOptions = restrictedOptions.value.map((restrictedOption) => {
|
|
1321
1322
|
return JSON.stringify(restrictedOption);
|
|
1322
1323
|
});
|
|
1323
1324
|
|
|
1324
1325
|
if (!availableOptionType) return;
|
|
1325
|
-
if (!mappedOptions.includes(JSON.stringify(preselectedOption))) {
|
|
1326
|
+
if (!mappedOptions.includes(JSON.stringify(preselectedOption)) && restriction) {
|
|
1326
1327
|
if (showInsertWarnings.value) {
|
|
1327
1328
|
console.warn("vue-extended-multiselect: option in «preselectedOption» property should be the same as analogue in «options» property");
|
|
1328
1329
|
}
|
|
@@ -1345,8 +1346,9 @@ const setPreselectedOption = (preselectedOption) => {
|
|
|
1345
1346
|
* @function
|
|
1346
1347
|
* @emits extended:select-option
|
|
1347
1348
|
* @param {Array} preselectedOptions - options to be selected
|
|
1349
|
+
* @param {boolean} restriction - restriction of preselected options
|
|
1348
1350
|
*/
|
|
1349
|
-
const setPreselectedOptions = async (preselectedOptions) => {
|
|
1351
|
+
const setPreselectedOptions = async (preselectedOptions, restriction = true) => {
|
|
1350
1352
|
let allOptionsWereSelected = 0;
|
|
1351
1353
|
const mappedOptions = restrictedOptions.value.map((restrictedOption) => {
|
|
1352
1354
|
return JSON.stringify(restrictedOption);
|
|
@@ -1358,7 +1360,7 @@ const setPreselectedOptions = async (preselectedOptions) => {
|
|
|
1358
1360
|
if (!preselectedOption || !availableOptionType) return;
|
|
1359
1361
|
if (selectedOptions.value.includes(preselectedOption)) return;
|
|
1360
1362
|
|
|
1361
|
-
if (mappedOptions.includes(JSON.stringify(preselectedOption))) {
|
|
1363
|
+
if (mappedOptions.includes(JSON.stringify(preselectedOption)) || !restriction) {
|
|
1362
1364
|
const isObjectOrArray = typeof option === "object";
|
|
1363
1365
|
const label = createLabel(isObjectOrArray, preselectedOption);
|
|
1364
1366
|
|
|
@@ -1385,9 +1387,9 @@ const setPreselectedOptionsByModelValue = () => {
|
|
|
1385
1387
|
if (!modelValue.value) return;
|
|
1386
1388
|
|
|
1387
1389
|
if (Array.isArray(modelValue.value) && multiple.value) {
|
|
1388
|
-
setPreselectedOptions(modelValue.value);
|
|
1390
|
+
setPreselectedOptions(modelValue.value, false);
|
|
1389
1391
|
} else {
|
|
1390
|
-
setPreselectedOption(modelValue.value);
|
|
1392
|
+
setPreselectedOption(modelValue.value, false);
|
|
1391
1393
|
}
|
|
1392
1394
|
}
|
|
1393
1395
|
|