vue3-extended-multiselect 1.1.5 → 1.1.6
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.
|
|
3
|
+
Current `vue3-extended-multiselect` version: **1.1.6**
|
|
4
4
|
|
|
5
5
|
***
|
|
6
6
|
|
|
@@ -117,4 +117,9 @@ Adding descriptive comments for some types in typings.
|
|
|
117
117
|
* Fix bug with wrong name of label field
|
|
118
118
|
|
|
119
119
|
### 1.1.5 (2022-13-11)
|
|
120
|
-
* Fix bug with empty raw options list when using async loader.
|
|
120
|
+
* Fix bug with empty raw options list when using async loader.
|
|
121
|
+
|
|
122
|
+
### 1.1.6 (2022-13-11)
|
|
123
|
+
* Fix bug with extra call of async loader by changing value of search field.
|
|
124
|
+
* Adding new internal prop "externalOptionsLoader" to ExtendedMultiselectInput.
|
|
125
|
+
* Searching for options by async loader is moved to in separate method.
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -336,6 +336,17 @@ const props = defineProps({
|
|
|
336
336
|
required: true,
|
|
337
337
|
},
|
|
338
338
|
|
|
339
|
+
/**
|
|
340
|
+
* Loader function provided by user.
|
|
341
|
+
* @property {Function} externalOptionsLoader
|
|
342
|
+
* @default null
|
|
343
|
+
* @param {string} value - value of search field
|
|
344
|
+
*/
|
|
345
|
+
externalOptionsLoader: {
|
|
346
|
+
type: Boolean,
|
|
347
|
+
default: null,
|
|
348
|
+
},
|
|
349
|
+
|
|
339
350
|
/**
|
|
340
351
|
* Provides function that creates limit message for maximal of selected
|
|
341
352
|
* options to ExtendedMultiselectMultiple child component
|
|
@@ -372,9 +383,13 @@ const blurSkipByBlock = ref(0);
|
|
|
372
383
|
const labelBlocks = ref([]);
|
|
373
384
|
const searchDebounce = ref(debounce(() => {
|
|
374
385
|
const searchPattern = searchValue.value ? new RegExp(`${searchValue.value}`, "i") : null;
|
|
375
|
-
emitter.emit("extended:search-pattern-changed", searchValue.value);
|
|
376
386
|
|
|
377
|
-
|
|
387
|
+
if (externalOptionsLoader.value) {
|
|
388
|
+
emitter.emit("extended:loader-pattern-changed", searchValue.value);
|
|
389
|
+
} else {
|
|
390
|
+
emitter.emit("extended:search-pattern-changed", searchValue.value);
|
|
391
|
+
setSearchPattern(searchPattern);
|
|
392
|
+
}
|
|
378
393
|
}, 250));
|
|
379
394
|
|
|
380
395
|
/**
|
|
@@ -386,6 +401,7 @@ const {
|
|
|
386
401
|
createOnTheGo,
|
|
387
402
|
createOptionPlaceholder,
|
|
388
403
|
disabled,
|
|
404
|
+
externalOptionsLoader,
|
|
389
405
|
increaseDisplayBy,
|
|
390
406
|
multiple,
|
|
391
407
|
placeholder,
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
:create-on-the-go="createOnTheGo"
|
|
32
32
|
:disabled="inputDisabled"
|
|
33
33
|
:dropdown-active="dropdownActive"
|
|
34
|
+
:external-options-loader="externalOptionsLoader"
|
|
34
35
|
:loading="internalLoading"
|
|
35
36
|
:multiple="multiple"
|
|
36
37
|
:search-filter-active="searchFilterActive"
|
|
@@ -805,7 +806,7 @@ const props = defineProps({
|
|
|
805
806
|
|
|
806
807
|
/**
|
|
807
808
|
* Defines function that creates custom label for each option
|
|
808
|
-
* @default ()=>null
|
|
809
|
+
* @default (option)=>null
|
|
809
810
|
* @property {Function} createCustomOptionLabel
|
|
810
811
|
*/
|
|
811
812
|
createCustomOptionLabel: {
|
|
@@ -816,7 +817,7 @@ const props = defineProps({
|
|
|
816
817
|
/**
|
|
817
818
|
* Defines function that creates notification when maximal limit
|
|
818
819
|
* of selected options has been reached
|
|
819
|
-
* @default ()=>string
|
|
820
|
+
* @default (number)=>string
|
|
820
821
|
* @property {Function} multipleBlocksLimitMessage
|
|
821
822
|
*/
|
|
822
823
|
multipleBlocksLimitMessage: {
|
|
@@ -859,6 +860,7 @@ const emit = defineEmits([
|
|
|
859
860
|
const dropdownActive = ref(false);
|
|
860
861
|
const inputDisabled = ref(false);
|
|
861
862
|
const internalLoader = ref(false);
|
|
863
|
+
const externalOptionsLoader = ref(null);
|
|
862
864
|
const chosenToggleAppearanceSide = ref(null);
|
|
863
865
|
const rawOptions = ref([]);
|
|
864
866
|
const selectedOptions = ref([]);
|
|
@@ -1231,6 +1233,21 @@ const fieldFocus = (mouseEvent) => {
|
|
|
1231
1233
|
emitter.emit("extended:field-focus");
|
|
1232
1234
|
};
|
|
1233
1235
|
|
|
1236
|
+
/**
|
|
1237
|
+
* Initialises options list loading by external async method
|
|
1238
|
+
* @function
|
|
1239
|
+
* @param {string} pattern - value of search field
|
|
1240
|
+
*/
|
|
1241
|
+
const loadOptionsByExternalLoader = (pattern) => {
|
|
1242
|
+
internalLoader.value = true;
|
|
1243
|
+
externalOptionsLoader.value = options.value;
|
|
1244
|
+
options.value(pattern).then(options => {
|
|
1245
|
+
rawOptions.value = options;
|
|
1246
|
+
internalLoader.value = false;
|
|
1247
|
+
setPreselectedOptionsByConditions();
|
|
1248
|
+
});
|
|
1249
|
+
};
|
|
1250
|
+
|
|
1234
1251
|
/**
|
|
1235
1252
|
* Emits event whose listener resets index of "enter" key pressing
|
|
1236
1253
|
* @function
|
|
@@ -1648,15 +1665,11 @@ onBeforeMount(() => {
|
|
|
1648
1665
|
/**
|
|
1649
1666
|
* "onMounted" hook of the Vue3ExtendedMultiselect component
|
|
1650
1667
|
* @listens extended:expand-options
|
|
1668
|
+
* @listens extended:loader-pattern-changed
|
|
1651
1669
|
*/
|
|
1652
1670
|
onMounted(() => {
|
|
1653
1671
|
if (typeof options.value === "function") {
|
|
1654
|
-
|
|
1655
|
-
options.value().then(options => {
|
|
1656
|
-
rawOptions.value = options;
|
|
1657
|
-
internalLoader.value = false;
|
|
1658
|
-
setPreselectedOptionsByConditions();
|
|
1659
|
-
});
|
|
1672
|
+
loadOptionsByExternalLoader();
|
|
1660
1673
|
} else {
|
|
1661
1674
|
rawOptions.value = options.value;
|
|
1662
1675
|
setPreselectedOptionsByConditions();
|
|
@@ -1679,6 +1692,10 @@ onMounted(() => {
|
|
|
1679
1692
|
|
|
1680
1693
|
dropdownActive.value = true;
|
|
1681
1694
|
});
|
|
1695
|
+
|
|
1696
|
+
emitter.on("extended:loader-pattern-changed", (pattern) => {
|
|
1697
|
+
loadOptionsByExternalLoader(pattern);
|
|
1698
|
+
});
|
|
1682
1699
|
});
|
|
1683
1700
|
|
|
1684
1701
|
defineExpose({
|