vue3-extended-multiselect 0.1.2 → 0.1.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/.eslintrc.js +29 -29
- package/.github/workflows/publish.yml +41 -0
- package/.nvmrc +0 -0
- package/CHANGELOG.md +51 -43
- package/LICENSE +21 -21
- package/README.md +116 -116
- package/index.js +2 -2
- package/jest.config.js +57 -57
- package/package.json +46 -46
- package/src/assets/base-arrow.svg +70 -70
- package/src/assets/cancel.svg +34 -34
- package/src/assets/circle-arrow.svg +7 -7
- package/src/assets/double-arrow.svg +39 -39
- package/src/assets/inner-arrow.svg +8 -8
- package/src/assets/loader.svg +5 -5
- package/src/assets/triangle-arrow.svg +72 -72
- package/src/assets/triangle-circle-arrow.svg +38 -38
- package/src/assets/wide-arrow.svg +72 -72
- package/src/components/ExtendedMultiselectCancel.vue +142 -142
- package/src/components/ExtendedMultiselectInput.vue +618 -618
- package/src/components/ExtendedMultiselectLoader.vue +176 -176
- package/src/components/ExtendedMultiselectMultiple.vue +291 -291
- package/src/components/ExtendedMultiselectOptions.vue +1087 -1087
- package/src/components/ExtendedMultiselectToggle.vue +254 -254
- package/src/components/Vue3ExtendedMultiselect.vue +1651 -1651
- package/src/composition/cancel.js +30 -30
- package/src/composition/labels.js +39 -39
- package/src/composition/preselected-options.js +66 -66
- package/src/composition/search-value.js +33 -33
- package/src/composition/sizes.js +42 -42
- package/src/composition/toggle.js +33 -33
- package/src/sets/sets.js +99 -99
- package/src/styles/animations.css +19 -19
- package/src/styles/main.css +433 -433
- package/src/styles/variables.css +41 -41
- package/tests/unit/events.spec.js +135 -135
- package/tests/unit/props.spec.js +1040 -1040
- package/tests/utils/mount.js +37 -37
- package/tests/utils/utils.js +20 -20
- package/typings/vue3-extended-multiselect.d.ts +42 -33
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
-
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
-
viewBox="0 0 490 490" style="enable-background:new 0 0 490 490;" xml:space="preserve">
|
|
5
|
-
<g>
|
|
6
|
-
<g>
|
|
7
|
-
<g>
|
|
8
|
-
<polygon points="0,249.888 245.004,8.139 490,249.888 490,481.861 245.004,239.71 0,481.861 "/>
|
|
9
|
-
</g>
|
|
10
|
-
</g>
|
|
11
|
-
<g>
|
|
12
|
-
</g>
|
|
13
|
-
<g>
|
|
14
|
-
</g>
|
|
15
|
-
<g>
|
|
16
|
-
</g>
|
|
17
|
-
<g>
|
|
18
|
-
</g>
|
|
19
|
-
<g>
|
|
20
|
-
</g>
|
|
21
|
-
<g>
|
|
22
|
-
</g>
|
|
23
|
-
<g>
|
|
24
|
-
</g>
|
|
25
|
-
<g>
|
|
26
|
-
</g>
|
|
27
|
-
<g>
|
|
28
|
-
</g>
|
|
29
|
-
<g>
|
|
30
|
-
</g>
|
|
31
|
-
<g>
|
|
32
|
-
</g>
|
|
33
|
-
<g>
|
|
34
|
-
</g>
|
|
35
|
-
<g>
|
|
36
|
-
</g>
|
|
37
|
-
<g>
|
|
38
|
-
</g>
|
|
39
|
-
<g>
|
|
40
|
-
</g>
|
|
41
|
-
</g>
|
|
42
|
-
<g>
|
|
43
|
-
</g>
|
|
44
|
-
<g>
|
|
45
|
-
</g>
|
|
46
|
-
<g>
|
|
47
|
-
</g>
|
|
48
|
-
<g>
|
|
49
|
-
</g>
|
|
50
|
-
<g>
|
|
51
|
-
</g>
|
|
52
|
-
<g>
|
|
53
|
-
</g>
|
|
54
|
-
<g>
|
|
55
|
-
</g>
|
|
56
|
-
<g>
|
|
57
|
-
</g>
|
|
58
|
-
<g>
|
|
59
|
-
</g>
|
|
60
|
-
<g>
|
|
61
|
-
</g>
|
|
62
|
-
<g>
|
|
63
|
-
</g>
|
|
64
|
-
<g>
|
|
65
|
-
</g>
|
|
66
|
-
<g>
|
|
67
|
-
</g>
|
|
68
|
-
<g>
|
|
69
|
-
</g>
|
|
70
|
-
<g>
|
|
71
|
-
</g>
|
|
72
|
-
</svg>
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
viewBox="0 0 490 490" style="enable-background:new 0 0 490 490;" xml:space="preserve">
|
|
5
|
+
<g>
|
|
6
|
+
<g>
|
|
7
|
+
<g>
|
|
8
|
+
<polygon points="0,249.888 245.004,8.139 490,249.888 490,481.861 245.004,239.71 0,481.861 "/>
|
|
9
|
+
</g>
|
|
10
|
+
</g>
|
|
11
|
+
<g>
|
|
12
|
+
</g>
|
|
13
|
+
<g>
|
|
14
|
+
</g>
|
|
15
|
+
<g>
|
|
16
|
+
</g>
|
|
17
|
+
<g>
|
|
18
|
+
</g>
|
|
19
|
+
<g>
|
|
20
|
+
</g>
|
|
21
|
+
<g>
|
|
22
|
+
</g>
|
|
23
|
+
<g>
|
|
24
|
+
</g>
|
|
25
|
+
<g>
|
|
26
|
+
</g>
|
|
27
|
+
<g>
|
|
28
|
+
</g>
|
|
29
|
+
<g>
|
|
30
|
+
</g>
|
|
31
|
+
<g>
|
|
32
|
+
</g>
|
|
33
|
+
<g>
|
|
34
|
+
</g>
|
|
35
|
+
<g>
|
|
36
|
+
</g>
|
|
37
|
+
<g>
|
|
38
|
+
</g>
|
|
39
|
+
<g>
|
|
40
|
+
</g>
|
|
41
|
+
</g>
|
|
42
|
+
<g>
|
|
43
|
+
</g>
|
|
44
|
+
<g>
|
|
45
|
+
</g>
|
|
46
|
+
<g>
|
|
47
|
+
</g>
|
|
48
|
+
<g>
|
|
49
|
+
</g>
|
|
50
|
+
<g>
|
|
51
|
+
</g>
|
|
52
|
+
<g>
|
|
53
|
+
</g>
|
|
54
|
+
<g>
|
|
55
|
+
</g>
|
|
56
|
+
<g>
|
|
57
|
+
</g>
|
|
58
|
+
<g>
|
|
59
|
+
</g>
|
|
60
|
+
<g>
|
|
61
|
+
</g>
|
|
62
|
+
<g>
|
|
63
|
+
</g>
|
|
64
|
+
<g>
|
|
65
|
+
</g>
|
|
66
|
+
<g>
|
|
67
|
+
</g>
|
|
68
|
+
<g>
|
|
69
|
+
</g>
|
|
70
|
+
<g>
|
|
71
|
+
</g>
|
|
72
|
+
</svg>
|
|
@@ -1,142 +1,142 @@
|
|
|
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.stop="cancel"
|
|
9
|
-
@keypress.stop="cancel"
|
|
10
|
-
>
|
|
11
|
-
<img
|
|
12
|
-
alt=""
|
|
13
|
-
v-if="!loading"
|
|
14
|
-
:class="iconSizeClass"
|
|
15
|
-
:src="require('../assets/cancel.svg')"
|
|
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
|
-
toRefs,
|
|
30
|
-
} from "vue";
|
|
31
|
-
|
|
32
|
-
import useCancel from "../composition/cancel";
|
|
33
|
-
import useSizes from "../composition/sizes";
|
|
34
|
-
|
|
35
|
-
import ExtendedMultiselectLoader from "./ExtendedMultiselectLoader.vue";
|
|
36
|
-
|
|
37
|
-
const props = defineProps({
|
|
38
|
-
/**
|
|
39
|
-
* Blocks cancel button
|
|
40
|
-
* @property {boolean} disabled
|
|
41
|
-
*/
|
|
42
|
-
disabled: {
|
|
43
|
-
type: Boolean,
|
|
44
|
-
required: true,
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Defines a svg-filter for icons
|
|
49
|
-
* @property {string} iconFilter
|
|
50
|
-
*/
|
|
51
|
-
iconFilter: {
|
|
52
|
-
type: String,
|
|
53
|
-
required: true,
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Provides size to create special size-class
|
|
58
|
-
* for each kind of icon
|
|
59
|
-
* @property {string} iconSize
|
|
60
|
-
*/
|
|
61
|
-
iconSize: {
|
|
62
|
-
type: String,
|
|
63
|
-
required: true,
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Replaces cancel button with loader
|
|
68
|
-
* @property {boolean} loading
|
|
69
|
-
*/
|
|
70
|
-
loading: {
|
|
71
|
-
type: Boolean,
|
|
72
|
-
required: true,
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Determines whether to clear current value of search field
|
|
77
|
-
* @property {boolean} showSearchField
|
|
78
|
-
*/
|
|
79
|
-
showSearchField: {
|
|
80
|
-
type: Boolean,
|
|
81
|
-
required: true,
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Defines "tabindex" attribute of cancel button
|
|
86
|
-
* @default null
|
|
87
|
-
* @property {number|null} tabindex
|
|
88
|
-
*/
|
|
89
|
-
tabindex: {
|
|
90
|
-
type: Number,
|
|
91
|
-
default: null,
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* List of selected options
|
|
96
|
-
* @property {Array} selectedOptions
|
|
97
|
-
*/
|
|
98
|
-
selectedOptions: {
|
|
99
|
-
type: Array,
|
|
100
|
-
required: true,
|
|
101
|
-
},
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
const {
|
|
105
|
-
disabled,
|
|
106
|
-
iconFilter,
|
|
107
|
-
iconSize,
|
|
108
|
-
loading,
|
|
109
|
-
selectedOptions,
|
|
110
|
-
showSearchField,
|
|
111
|
-
tabindex,
|
|
112
|
-
} = toRefs(props);
|
|
113
|
-
|
|
114
|
-
const { cancel } = useCancel(
|
|
115
|
-
disabled,
|
|
116
|
-
showSearchField,
|
|
117
|
-
selectedOptions,
|
|
118
|
-
);
|
|
119
|
-
const { iconSizeClass } = useSizes(iconSize);
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Toggles classes of component if "loading"
|
|
123
|
-
* or "disabled" props equals true
|
|
124
|
-
* @function
|
|
125
|
-
* @returns {string} class
|
|
126
|
-
*/
|
|
127
|
-
const classes = computed(() => {
|
|
128
|
-
return (loading.value || disabled.value)
|
|
129
|
-
? "extended__multiselect-cancel--disabled"
|
|
130
|
-
: "extended__multiselect-cancel";
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Sets "tabindex" attibute of clear button based on
|
|
135
|
-
* given tabindex
|
|
136
|
-
* @function
|
|
137
|
-
* @returns {number} tabindex
|
|
138
|
-
*/
|
|
139
|
-
const increasedTabindex = computed(() => {
|
|
140
|
-
return tabindex.value ? tabindex.value + 2 : 0;
|
|
141
|
-
});
|
|
142
|
-
</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.stop="cancel"
|
|
9
|
+
@keypress.stop="cancel"
|
|
10
|
+
>
|
|
11
|
+
<img
|
|
12
|
+
alt=""
|
|
13
|
+
v-if="!loading"
|
|
14
|
+
:class="iconSizeClass"
|
|
15
|
+
:src="require('../assets/cancel.svg')"
|
|
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
|
+
toRefs,
|
|
30
|
+
} from "vue";
|
|
31
|
+
|
|
32
|
+
import useCancel from "../composition/cancel";
|
|
33
|
+
import useSizes from "../composition/sizes";
|
|
34
|
+
|
|
35
|
+
import ExtendedMultiselectLoader from "./ExtendedMultiselectLoader.vue";
|
|
36
|
+
|
|
37
|
+
const props = defineProps({
|
|
38
|
+
/**
|
|
39
|
+
* Blocks cancel button
|
|
40
|
+
* @property {boolean} disabled
|
|
41
|
+
*/
|
|
42
|
+
disabled: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
required: true,
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Defines a svg-filter for icons
|
|
49
|
+
* @property {string} iconFilter
|
|
50
|
+
*/
|
|
51
|
+
iconFilter: {
|
|
52
|
+
type: String,
|
|
53
|
+
required: true,
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Provides size to create special size-class
|
|
58
|
+
* for each kind of icon
|
|
59
|
+
* @property {string} iconSize
|
|
60
|
+
*/
|
|
61
|
+
iconSize: {
|
|
62
|
+
type: String,
|
|
63
|
+
required: true,
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Replaces cancel button with loader
|
|
68
|
+
* @property {boolean} loading
|
|
69
|
+
*/
|
|
70
|
+
loading: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
required: true,
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Determines whether to clear current value of search field
|
|
77
|
+
* @property {boolean} showSearchField
|
|
78
|
+
*/
|
|
79
|
+
showSearchField: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
required: true,
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Defines "tabindex" attribute of cancel button
|
|
86
|
+
* @default null
|
|
87
|
+
* @property {number|null} tabindex
|
|
88
|
+
*/
|
|
89
|
+
tabindex: {
|
|
90
|
+
type: Number,
|
|
91
|
+
default: null,
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* List of selected options
|
|
96
|
+
* @property {Array} selectedOptions
|
|
97
|
+
*/
|
|
98
|
+
selectedOptions: {
|
|
99
|
+
type: Array,
|
|
100
|
+
required: true,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const {
|
|
105
|
+
disabled,
|
|
106
|
+
iconFilter,
|
|
107
|
+
iconSize,
|
|
108
|
+
loading,
|
|
109
|
+
selectedOptions,
|
|
110
|
+
showSearchField,
|
|
111
|
+
tabindex,
|
|
112
|
+
} = toRefs(props);
|
|
113
|
+
|
|
114
|
+
const { cancel } = useCancel(
|
|
115
|
+
disabled,
|
|
116
|
+
showSearchField,
|
|
117
|
+
selectedOptions,
|
|
118
|
+
);
|
|
119
|
+
const { iconSizeClass } = useSizes(iconSize);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Toggles classes of component if "loading"
|
|
123
|
+
* or "disabled" props equals true
|
|
124
|
+
* @function
|
|
125
|
+
* @returns {string} class
|
|
126
|
+
*/
|
|
127
|
+
const classes = computed(() => {
|
|
128
|
+
return (loading.value || disabled.value)
|
|
129
|
+
? "extended__multiselect-cancel--disabled"
|
|
130
|
+
: "extended__multiselect-cancel";
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Sets "tabindex" attibute of clear button based on
|
|
135
|
+
* given tabindex
|
|
136
|
+
* @function
|
|
137
|
+
* @returns {number} tabindex
|
|
138
|
+
*/
|
|
139
|
+
const increasedTabindex = computed(() => {
|
|
140
|
+
return tabindex.value ? tabindex.value + 2 : 0;
|
|
141
|
+
});
|
|
142
|
+
</script>
|