vue3-extended-multiselect 1.0.0 → 1.1.1
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 +17 -2
- package/README.md +1 -1
- package/jest.config.js +3 -0
- package/package.json +5 -5
- package/src/components/ExtendedMultiselectInput.vue +1 -1
- package/src/components/ExtendedMultiselectOptions.vue +1 -0
- package/src/components/Vue3ExtendedMultiselect.vue +26 -21
- package/src/styles/main.css +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Patch notes
|
|
2
2
|
|
|
3
|
-
Current `vue3-extended-multiselect` version: **1.
|
|
3
|
+
Current `vue3-extended-multiselect` version: **1.1.1**
|
|
4
4
|
|
|
5
5
|
***
|
|
6
6
|
|
|
@@ -88,4 +88,19 @@ Adding descriptive comments for some types in typings.
|
|
|
88
88
|
* Changing styles of "marker" and "option" slots.
|
|
89
89
|
* Adding new fields in "parserOptions" section of .eslintrc.
|
|
90
90
|
* Disabling "no-undef" rule in .eslintrc.
|
|
91
|
-
* Static file import optimization for different module builders.
|
|
91
|
+
* Static file import optimization for different module builders.
|
|
92
|
+
|
|
93
|
+
### 1.1.0 (2022-12-10)
|
|
94
|
+
|
|
95
|
+
* Removal of dependency "lodash.debounce".
|
|
96
|
+
* Removal of dependency "click-outside".
|
|
97
|
+
* Adding "lodash-es" dependency.
|
|
98
|
+
* Adding "vue3-click-away" dependency.
|
|
99
|
+
* Adding "transformIgnorePatterns" section in jest.config.js.
|
|
100
|
+
* Replacing "clickOutside" function in "onMounted" hook with "v-click-outside" directive.
|
|
101
|
+
* Fix bug with rolling up options list when "toggleOptionsBySelect" prop is set to false.
|
|
102
|
+
* Fix bug with reaching "optionsWrapper" ref before initialization.
|
|
103
|
+
|
|
104
|
+
### 1.1.1 (2022-12-10)
|
|
105
|
+
|
|
106
|
+
* Replacing package-lock.json file with new one.
|
package/README.md
CHANGED
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue3-extended-multiselect",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Extended multiselect component for applications based on Vue 3 framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"multiselect",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"lint": "vue-cli-service lint"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"click-outside": "^2.0.2",
|
|
26
25
|
"core-js": "^3.6.5",
|
|
27
|
-
"lodash
|
|
26
|
+
"lodash-es": "^4.17.21",
|
|
28
27
|
"mitt": "^3.0.0",
|
|
29
|
-
"vue": "^3.0.0"
|
|
28
|
+
"vue": "^3.0.0",
|
|
29
|
+
"vue3-click-away": "^1.2.4"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@testing-library/vue": "^6.6.1",
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
"typescript": "~3.9.3",
|
|
45
45
|
"vue-jest": "^5.0.0-0"
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
}
|
|
@@ -143,7 +143,7 @@ import {
|
|
|
143
143
|
watch,
|
|
144
144
|
} from "vue";
|
|
145
145
|
|
|
146
|
-
import debounce from "lodash
|
|
146
|
+
import { debounce } from "lodash-es";
|
|
147
147
|
import emitter from "../events/emitter";
|
|
148
148
|
|
|
149
149
|
import ExtendedMultiselectMultiple from "./ExtendedMultiselectMultiple.vue";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<section
|
|
3
3
|
aria-owns="extended-search-field"
|
|
4
|
-
ref="extendedMultiselectWrapper"
|
|
5
4
|
role="combobox"
|
|
6
5
|
:aria-roledescription="roledescription"
|
|
7
6
|
:class="wrapperClasses"
|
|
8
7
|
:tabindex="tabindexIfSearch"
|
|
8
|
+
v-click-outside="clickOutside"
|
|
9
9
|
@click.stop.left="fieldFocus"
|
|
10
10
|
@click.stop.middle="fieldFocus"
|
|
11
11
|
@keyup.stop.esc="rollUp"
|
|
@@ -216,7 +216,7 @@ import {
|
|
|
216
216
|
watch,
|
|
217
217
|
} from "vue";
|
|
218
218
|
|
|
219
|
-
import
|
|
219
|
+
import { directive as vClickOutside } from "vue3-click-away";
|
|
220
220
|
import emitter from "../events/emitter";
|
|
221
221
|
|
|
222
222
|
import {
|
|
@@ -852,7 +852,6 @@ const togglePattern = /^extended__multiselect-toggle/i;
|
|
|
852
852
|
/**
|
|
853
853
|
* Element references
|
|
854
854
|
*/
|
|
855
|
-
const extendedMultiselectWrapper = ref(null);
|
|
856
855
|
const extendedMultiselect = ref(null);
|
|
857
856
|
const extendedMultiselectToggle = ref(null);
|
|
858
857
|
|
|
@@ -1133,6 +1132,15 @@ const activeEmitter = () => {
|
|
|
1133
1132
|
emit("active", eventData);
|
|
1134
1133
|
};
|
|
1135
1134
|
|
|
1135
|
+
/**
|
|
1136
|
+
* Handler for "v-click-outside" directive
|
|
1137
|
+
* @function
|
|
1138
|
+
* @emits "extended:rollup-options"
|
|
1139
|
+
*/
|
|
1140
|
+
const clickOutside = () => {
|
|
1141
|
+
emitter.emit("extended:rollup-options");
|
|
1142
|
+
};
|
|
1143
|
+
|
|
1136
1144
|
/**
|
|
1137
1145
|
* Emits "close" when dropdown options list is rolled up
|
|
1138
1146
|
* @function
|
|
@@ -1181,7 +1189,7 @@ const createEventFields = (field, fieldName) => {
|
|
|
1181
1189
|
const fieldFocus = (mouseEvent) => {
|
|
1182
1190
|
if (internalLoading.value || disabled.value) return;
|
|
1183
1191
|
|
|
1184
|
-
if (!toggleOptionsBySelect.value
|
|
1192
|
+
if (!toggleOptionsBySelect.value) {
|
|
1185
1193
|
const customFilteredOptions = toggleOptionsRestrictor(mouseEvent);
|
|
1186
1194
|
|
|
1187
1195
|
if (customFilteredOptions) return;
|
|
@@ -1445,18 +1453,20 @@ const toggleOptions = () => {
|
|
|
1445
1453
|
* @returns {boolean} restriction
|
|
1446
1454
|
*/
|
|
1447
1455
|
const toggleOptionsRestrictor = (mouseEvent) => {
|
|
1448
|
-
|
|
1456
|
+
try {
|
|
1457
|
+
let eventTarget = mouseEvent.target;
|
|
1458
|
+
const optionsWrapper = optionsWrapper.value;
|
|
1449
1459
|
|
|
1450
|
-
|
|
1451
|
-
|
|
1460
|
+
while(eventTarget) {
|
|
1461
|
+
if (eventTarget === optionsWrapper) return true;
|
|
1452
1462
|
|
|
1453
|
-
|
|
1454
|
-
|
|
1463
|
+
eventTarget = eventTarget.parentNode;
|
|
1464
|
+
}
|
|
1455
1465
|
|
|
1456
|
-
|
|
1466
|
+
return false;
|
|
1467
|
+
} catch(e) {
|
|
1468
|
+
return false;
|
|
1457
1469
|
}
|
|
1458
|
-
|
|
1459
|
-
return false;
|
|
1460
1470
|
};
|
|
1461
1471
|
|
|
1462
1472
|
/**
|
|
@@ -1553,8 +1563,10 @@ onBeforeMount(() => {
|
|
|
1553
1563
|
} else {
|
|
1554
1564
|
selectedOptions.value = [];
|
|
1555
1565
|
}
|
|
1556
|
-
|
|
1557
|
-
|
|
1566
|
+
|
|
1567
|
+
if (toggleOptionsBySelect.value) {
|
|
1568
|
+
emitter.emit("extended:rollup-options");
|
|
1569
|
+
}
|
|
1558
1570
|
});
|
|
1559
1571
|
|
|
1560
1572
|
emitter.on("extended:clean-options", (selectedOptions) => {
|
|
@@ -1612,7 +1624,6 @@ onBeforeMount(() => {
|
|
|
1612
1624
|
|
|
1613
1625
|
/**
|
|
1614
1626
|
* "onMounted" hook of the Vue3ExtendedMultiselect component
|
|
1615
|
-
* @emits extended:rollup-options
|
|
1616
1627
|
* @listens extended:expand-options
|
|
1617
1628
|
*/
|
|
1618
1629
|
onMounted(() => {
|
|
@@ -1627,12 +1638,6 @@ onMounted(() => {
|
|
|
1627
1638
|
rawOptions.value = options.value;
|
|
1628
1639
|
setPreselectedOptionsByConditions();
|
|
1629
1640
|
}
|
|
1630
|
-
|
|
1631
|
-
const root = extendedMultiselectWrapper.value;
|
|
1632
|
-
|
|
1633
|
-
clickOutside(root, () => {
|
|
1634
|
-
emitter.emit("extended:rollup-options");
|
|
1635
|
-
});
|
|
1636
1641
|
|
|
1637
1642
|
if (
|
|
1638
1643
|
defaultExpanded.value
|
package/src/styles/main.css
CHANGED
|
@@ -390,7 +390,8 @@
|
|
|
390
390
|
border-color: transparent;
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
-
#extended__multiselect + .extended__multiselect-options--marker > span:not([id^=option-label])
|
|
393
|
+
#extended__multiselect + .extended__multiselect-options--marker > span:not([id^=option-label]),
|
|
394
|
+
#extended__multiselect + .extended__multiselect-options--marker > .extended__multiselect-option-create {
|
|
394
395
|
padding-left: 30px;
|
|
395
396
|
}
|
|
396
397
|
|