vue3-extended-multiselect 1.10.2 → 2.0.0
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/.browserslistrc +2 -2
- package/.eslintrc.js +35 -34
- package/.github/workflows/publish.yml +41 -41
- package/CHANGELOG.md +411 -389
- package/LICENSE +21 -21
- package/README.md +270 -270
- package/babel.config.js +9 -9
- package/index.js +2 -2
- package/jest.config.js +62 -62
- package/package.json +56 -46
- package/rollup.config.mjs +74 -0
- package/src/assets/{base-arrow.svg → images/base-arrow.svg} +70 -70
- package/src/assets/{cancel.svg → images/cancel.svg} +34 -34
- package/src/assets/{circle-arrow.svg → images/circle-arrow.svg} +7 -7
- package/src/assets/{double-arrow.svg → images/double-arrow.svg} +39 -39
- package/src/assets/{inner-arrow.svg → images/inner-arrow.svg} +8 -8
- package/src/assets/{loader.svg → images/loader.svg} +5 -5
- package/src/assets/{triangle-arrow.svg → images/triangle-arrow.svg} +72 -72
- package/src/assets/{triangle-circle-arrow.svg → images/triangle-circle-arrow.svg} +38 -38
- package/src/assets/{wide-arrow.svg → images/wide-arrow.svg} +72 -72
- package/src/components/ExtendedMultiselectCancel.vue +165 -165
- package/src/components/ExtendedMultiselectInput.vue +741 -741
- package/src/components/ExtendedMultiselectLoader.vue +182 -182
- package/src/components/ExtendedMultiselectMultiple.vue +399 -399
- package/src/components/ExtendedMultiselectOptions.vue +1190 -1190
- package/src/components/ExtendedMultiselectToggle.vue +271 -271
- package/src/components/Vue3ExtendedMultiselect.vue +2475 -1949
- package/src/composition/cancel.js +39 -39
- package/src/composition/click-outside.js +8 -8
- package/src/composition/debounce.js +8 -8
- package/src/composition/emitter.js +8 -8
- package/src/composition/image-path.js +16 -16
- package/src/composition/labels.js +41 -41
- package/src/composition/preselected-options.js +67 -67
- package/src/composition/search-value.js +33 -33
- package/src/composition/sizes.js +44 -44
- package/src/composition/toggle.js +31 -31
- package/src/sets/sets.js +99 -99
- package/src/styles/animations.css +18 -18
- package/src/styles/main.css +460 -460
- package/src/styles/variables.css +51 -51
- package/src/tools/Debounce.js +25 -25
- package/src/tools/LocalEmitter.js +31 -31
- package/src/tools/instance.js +2 -2
- package/tests/unit/events.spec.js +149 -149
- package/tests/unit/props.spec.js +1154 -1155
- package/tests/unit/tools.spec.js +55 -53
- package/tests/utils/mount.js +37 -37
- package/tests/utils/utils.js +24 -24
- package/typings/vue3-extended-multiselect.d.ts +43 -43
|
@@ -1,165 +1,165 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
aria-label="Clear options list"
|
|
4
|
-
id="extended__multiselect-cancel"
|
|
5
|
-
role="button"
|
|
6
|
-
:class="classes"
|
|
7
|
-
:tabindex="increasedTabindex"
|
|
8
|
-
@click="cancel"
|
|
9
|
-
@keypress.stop="cancel"
|
|
10
|
-
>
|
|
11
|
-
<img
|
|
12
|
-
alt=""
|
|
13
|
-
v-if="!loading"
|
|
14
|
-
:class="iconSizeClass"
|
|
15
|
-
:src="cancelIcon"
|
|
16
|
-
/>
|
|
17
|
-
<extended-multiselect-loader
|
|
18
|
-
v-else
|
|
19
|
-
:icon-filter="iconFilter"
|
|
20
|
-
:icon-size="iconSize"
|
|
21
|
-
/>
|
|
22
|
-
</div>
|
|
23
|
-
</template>
|
|
24
|
-
|
|
25
|
-
<script setup>
|
|
26
|
-
import {
|
|
27
|
-
computed,
|
|
28
|
-
defineProps,
|
|
29
|
-
inject,
|
|
30
|
-
ref,
|
|
31
|
-
toRefs,
|
|
32
|
-
} from "vue";
|
|
33
|
-
|
|
34
|
-
import useCancel from "../composition/cancel";
|
|
35
|
-
import useImagePath from "../composition/image-path";
|
|
36
|
-
import useSizes from "../composition/sizes";
|
|
37
|
-
|
|
38
|
-
import ExtendedMultiselectLoader from "./ExtendedMultiselectLoader.vue";
|
|
39
|
-
|
|
40
|
-
const props = defineProps({
|
|
41
|
-
/**
|
|
42
|
-
* Blocks cancel button
|
|
43
|
-
* @property {boolean} disabled
|
|
44
|
-
*/
|
|
45
|
-
disabled: {
|
|
46
|
-
type: Boolean,
|
|
47
|
-
required: true,
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Defines a svg-filter for icons
|
|
52
|
-
* @property {string} iconFilter
|
|
53
|
-
*/
|
|
54
|
-
iconFilter: {
|
|
55
|
-
type: String,
|
|
56
|
-
required: true,
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Provides size to create special size-class
|
|
61
|
-
* for each kind of icon
|
|
62
|
-
* @property {string} iconSize
|
|
63
|
-
*/
|
|
64
|
-
iconSize: {
|
|
65
|
-
type: String,
|
|
66
|
-
required: true,
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Replaces cancel button with loader
|
|
71
|
-
* @property {boolean} loading
|
|
72
|
-
*/
|
|
73
|
-
loading: {
|
|
74
|
-
type: Boolean,
|
|
75
|
-
required: true,
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Determines whether to clear current value of search field
|
|
80
|
-
* @property {boolean} showSearchField
|
|
81
|
-
*/
|
|
82
|
-
showSearchField: {
|
|
83
|
-
type: Boolean,
|
|
84
|
-
required: true,
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Defines "tabindex" attribute of cancel button
|
|
89
|
-
* @default null
|
|
90
|
-
* @property {number|null} tabindex
|
|
91
|
-
*/
|
|
92
|
-
tabindex: {
|
|
93
|
-
type: Number,
|
|
94
|
-
default: null,
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* List of selected options
|
|
99
|
-
* @property {Array} selectedOptions
|
|
100
|
-
*/
|
|
101
|
-
selectedOptions: {
|
|
102
|
-
type: Array,
|
|
103
|
-
required: true,
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Reactive instance of LocalEmitter class
|
|
108
|
-
* @property {object} emitter
|
|
109
|
-
*/
|
|
110
|
-
emitter: {
|
|
111
|
-
type: Object,
|
|
112
|
-
required: true,
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
const setSearchValue = inject("setSearchValue");
|
|
117
|
-
const setSearchPattern = inject("setSearchPattern");
|
|
118
|
-
|
|
119
|
-
const {
|
|
120
|
-
disabled,
|
|
121
|
-
emitter,
|
|
122
|
-
iconFilter,
|
|
123
|
-
iconSize,
|
|
124
|
-
loading,
|
|
125
|
-
selectedOptions,
|
|
126
|
-
showSearchField,
|
|
127
|
-
tabindex,
|
|
128
|
-
} = toRefs(props);
|
|
129
|
-
|
|
130
|
-
const { createImagePath } = useImagePath();
|
|
131
|
-
|
|
132
|
-
const cancelIcon = ref(createImagePath("cancel.svg"));
|
|
133
|
-
|
|
134
|
-
const { cancel } = useCancel(
|
|
135
|
-
disabled,
|
|
136
|
-
showSearchField,
|
|
137
|
-
selectedOptions,
|
|
138
|
-
emitter,
|
|
139
|
-
setSearchValue,
|
|
140
|
-
setSearchPattern,
|
|
141
|
-
);
|
|
142
|
-
const { iconSizeClass } = useSizes(iconSize);
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Toggles classes of component if "loading"
|
|
146
|
-
* or "disabled" props equals true
|
|
147
|
-
* @function
|
|
148
|
-
* @returns {string} class
|
|
149
|
-
*/
|
|
150
|
-
const classes = computed(() => {
|
|
151
|
-
return (loading.value || disabled.value)
|
|
152
|
-
? "extended__multiselect-cancel--disabled"
|
|
153
|
-
: "extended__multiselect-cancel";
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Sets "tabindex" attibute of clear button based on
|
|
158
|
-
* given tabindex
|
|
159
|
-
* @function
|
|
160
|
-
* @returns {number} tabindex
|
|
161
|
-
*/
|
|
162
|
-
const increasedTabindex = computed(() => {
|
|
163
|
-
return tabindex.value ? tabindex.value + 2 : 0;
|
|
164
|
-
});
|
|
165
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
aria-label="Clear options list"
|
|
4
|
+
id="extended__multiselect-cancel"
|
|
5
|
+
role="button"
|
|
6
|
+
:class="classes"
|
|
7
|
+
:tabindex="increasedTabindex"
|
|
8
|
+
@click="cancel"
|
|
9
|
+
@keypress.stop="cancel"
|
|
10
|
+
>
|
|
11
|
+
<img
|
|
12
|
+
alt=""
|
|
13
|
+
v-if="!loading"
|
|
14
|
+
:class="iconSizeClass"
|
|
15
|
+
:src="cancelIcon"
|
|
16
|
+
/>
|
|
17
|
+
<extended-multiselect-loader
|
|
18
|
+
v-else
|
|
19
|
+
:icon-filter="iconFilter"
|
|
20
|
+
:icon-size="iconSize"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup>
|
|
26
|
+
import {
|
|
27
|
+
computed,
|
|
28
|
+
defineProps,
|
|
29
|
+
inject,
|
|
30
|
+
ref,
|
|
31
|
+
toRefs,
|
|
32
|
+
} from "vue";
|
|
33
|
+
|
|
34
|
+
import useCancel from "../composition/cancel";
|
|
35
|
+
import useImagePath from "../composition/image-path";
|
|
36
|
+
import useSizes from "../composition/sizes";
|
|
37
|
+
|
|
38
|
+
import ExtendedMultiselectLoader from "./ExtendedMultiselectLoader.vue";
|
|
39
|
+
|
|
40
|
+
const props = defineProps({
|
|
41
|
+
/**
|
|
42
|
+
* Blocks cancel button
|
|
43
|
+
* @property {boolean} disabled
|
|
44
|
+
*/
|
|
45
|
+
disabled: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Defines a svg-filter for icons
|
|
52
|
+
* @property {string} iconFilter
|
|
53
|
+
*/
|
|
54
|
+
iconFilter: {
|
|
55
|
+
type: String,
|
|
56
|
+
required: true,
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Provides size to create special size-class
|
|
61
|
+
* for each kind of icon
|
|
62
|
+
* @property {string} iconSize
|
|
63
|
+
*/
|
|
64
|
+
iconSize: {
|
|
65
|
+
type: String,
|
|
66
|
+
required: true,
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Replaces cancel button with loader
|
|
71
|
+
* @property {boolean} loading
|
|
72
|
+
*/
|
|
73
|
+
loading: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
required: true,
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Determines whether to clear current value of search field
|
|
80
|
+
* @property {boolean} showSearchField
|
|
81
|
+
*/
|
|
82
|
+
showSearchField: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
required: true,
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Defines "tabindex" attribute of cancel button
|
|
89
|
+
* @default null
|
|
90
|
+
* @property {number|null} tabindex
|
|
91
|
+
*/
|
|
92
|
+
tabindex: {
|
|
93
|
+
type: Number,
|
|
94
|
+
default: null,
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* List of selected options
|
|
99
|
+
* @property {Array} selectedOptions
|
|
100
|
+
*/
|
|
101
|
+
selectedOptions: {
|
|
102
|
+
type: Array,
|
|
103
|
+
required: true,
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Reactive instance of LocalEmitter class
|
|
108
|
+
* @property {object} emitter
|
|
109
|
+
*/
|
|
110
|
+
emitter: {
|
|
111
|
+
type: Object,
|
|
112
|
+
required: true,
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const setSearchValue = inject("setSearchValue");
|
|
117
|
+
const setSearchPattern = inject("setSearchPattern");
|
|
118
|
+
|
|
119
|
+
const {
|
|
120
|
+
disabled,
|
|
121
|
+
emitter,
|
|
122
|
+
iconFilter,
|
|
123
|
+
iconSize,
|
|
124
|
+
loading,
|
|
125
|
+
selectedOptions,
|
|
126
|
+
showSearchField,
|
|
127
|
+
tabindex,
|
|
128
|
+
} = toRefs(props);
|
|
129
|
+
|
|
130
|
+
const { createImagePath } = useImagePath();
|
|
131
|
+
|
|
132
|
+
const cancelIcon = ref(createImagePath("cancel.svg"));
|
|
133
|
+
|
|
134
|
+
const { cancel } = useCancel(
|
|
135
|
+
disabled,
|
|
136
|
+
showSearchField,
|
|
137
|
+
selectedOptions,
|
|
138
|
+
emitter,
|
|
139
|
+
setSearchValue,
|
|
140
|
+
setSearchPattern,
|
|
141
|
+
);
|
|
142
|
+
const { iconSizeClass } = useSizes(iconSize);
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Toggles classes of component if "loading"
|
|
146
|
+
* or "disabled" props equals true
|
|
147
|
+
* @function
|
|
148
|
+
* @returns {string} class
|
|
149
|
+
*/
|
|
150
|
+
const classes = computed(() => {
|
|
151
|
+
return (loading.value || disabled.value)
|
|
152
|
+
? "extended__multiselect-cancel--disabled"
|
|
153
|
+
: "extended__multiselect-cancel";
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Sets "tabindex" attibute of clear button based on
|
|
158
|
+
* given tabindex
|
|
159
|
+
* @function
|
|
160
|
+
* @returns {number} tabindex
|
|
161
|
+
*/
|
|
162
|
+
const increasedTabindex = computed(() => {
|
|
163
|
+
return tabindex.value ? tabindex.value + 2 : 0;
|
|
164
|
+
});
|
|
165
|
+
</script>
|