vue3-extended-multiselect 0.2.1 → 1.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/.eslintrc.js +35 -29
- package/.github/workflows/publish.yml +41 -41
- package/CHANGELOG.md +91 -65
- package/LICENSE +21 -21
- package/README.md +261 -262
- package/babel.config.js +3 -2
- package/index.js +2 -2
- package/jest.config.js +57 -57
- package/package.json +47 -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 +148 -145
- package/src/components/ExtendedMultiselectInput.vue +617 -617
- package/src/components/ExtendedMultiselectLoader.vue +182 -176
- package/src/components/ExtendedMultiselectMultiple.vue +295 -291
- package/src/components/ExtendedMultiselectOptions.vue +1091 -1088
- package/src/components/ExtendedMultiselectToggle.vue +261 -261
- package/src/components/Vue3ExtendedMultiselect.vue +1661 -1661
- package/src/composition/cancel.js +33 -28
- package/src/composition/image-path.js +17 -0
- 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 -31
- package/src/events/emitter.js +3 -0
- package/src/sets/sets.js +99 -99
- package/src/styles/animations.css +18 -18
- package/src/styles/main.css +432 -432
- package/src/styles/variables.css +47 -48
- 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 -42
- package/.eslintignore +0 -2
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!-- Generator: Adobe Illustrator 19.1.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 491.858 491.858" style="enable-background:new 0 0 491.858 491.858;" xml:space="preserve">
|
|
5
|
-
<g>
|
|
6
|
-
<g>
|
|
7
|
-
<path d="M491.858,442.461c0,13.931-11.293,25.224-25.224,25.224L245.93,373.097L25.224,467.686
|
|
8
|
-
C11.292,467.686,0,456.392,0,442.461L227.011,32.58c0,0,18.918-18.918,37.834,0C283.764,51.499,491.858,442.461,491.858,442.461z"
|
|
9
|
-
/>
|
|
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.1.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 491.858 491.858" style="enable-background:new 0 0 491.858 491.858;" xml:space="preserve">
|
|
5
|
+
<g>
|
|
6
|
+
<g>
|
|
7
|
+
<path d="M491.858,442.461c0,13.931-11.293,25.224-25.224,25.224L245.93,373.097L25.224,467.686
|
|
8
|
+
C11.292,467.686,0,456.392,0,442.461L227.011,32.58c0,0,18.918-18.918,37.834,0C283.764,51.499,491.858,442.461,491.858,442.461z"
|
|
9
|
+
/>
|
|
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,38 +1,38 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!-- Generator: Adobe Illustrator 18.1.1, 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 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
|
|
5
|
-
<g>
|
|
6
|
-
<path style="fill:#030104;" d="M8,0C3.582,0,0,3.582,0,8s3.582,8,8,8s8-3.582,8-8S12.418,0,8,0z M4,11l4-7l4,7H4z"/>
|
|
7
|
-
</g>
|
|
8
|
-
<g>
|
|
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
|
-
</svg>
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 18.1.1, 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 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
|
|
5
|
+
<g>
|
|
6
|
+
<path style="fill:#030104;" d="M8,0C3.582,0,0,3.582,0,8s3.582,8,8,8s8-3.582,8-8S12.418,0,8,0z M4,11l4-7l4,7H4z"/>
|
|
7
|
+
</g>
|
|
8
|
+
<g>
|
|
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
|
+
</svg>
|
|
@@ -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,145 +1,148 @@
|
|
|
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="
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
import
|
|
35
|
-
import useSizes from "../composition/sizes";
|
|
36
|
-
|
|
37
|
-
import ExtendedMultiselectLoader from "./ExtendedMultiselectLoader.vue";
|
|
38
|
-
|
|
39
|
-
const props = defineProps({
|
|
40
|
-
/**
|
|
41
|
-
* Blocks cancel button
|
|
42
|
-
* @property {boolean} disabled
|
|
43
|
-
*/
|
|
44
|
-
disabled: {
|
|
45
|
-
type: Boolean,
|
|
46
|
-
required: true,
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Defines a svg-filter for icons
|
|
51
|
-
* @property {string} iconFilter
|
|
52
|
-
*/
|
|
53
|
-
iconFilter: {
|
|
54
|
-
type: String,
|
|
55
|
-
required: true,
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Provides size to create special size-class
|
|
60
|
-
* for each kind of icon
|
|
61
|
-
* @property {string} iconSize
|
|
62
|
-
*/
|
|
63
|
-
iconSize: {
|
|
64
|
-
type: String,
|
|
65
|
-
required: true,
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Replaces cancel button with loader
|
|
70
|
-
* @property {boolean} loading
|
|
71
|
-
*/
|
|
72
|
-
loading: {
|
|
73
|
-
type: Boolean,
|
|
74
|
-
required: true,
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Determines whether to clear current value of search field
|
|
79
|
-
* @property {boolean} showSearchField
|
|
80
|
-
*/
|
|
81
|
-
showSearchField: {
|
|
82
|
-
type: Boolean,
|
|
83
|
-
required: true,
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Defines "tabindex" attribute of cancel button
|
|
88
|
-
* @default null
|
|
89
|
-
* @property {number|null} tabindex
|
|
90
|
-
*/
|
|
91
|
-
tabindex: {
|
|
92
|
-
type: Number,
|
|
93
|
-
default: null,
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* List of selected options
|
|
98
|
-
* @property {Array} selectedOptions
|
|
99
|
-
*/
|
|
100
|
-
selectedOptions: {
|
|
101
|
-
type: Array,
|
|
102
|
-
required: true,
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
const {
|
|
107
|
-
disabled,
|
|
108
|
-
iconFilter,
|
|
109
|
-
iconSize,
|
|
110
|
-
loading,
|
|
111
|
-
selectedOptions,
|
|
112
|
-
showSearchField,
|
|
113
|
-
tabindex,
|
|
114
|
-
} = toRefs(props);
|
|
115
|
-
|
|
116
|
-
const {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
*
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
*
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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="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
|
+
ref,
|
|
30
|
+
toRefs,
|
|
31
|
+
} from "vue";
|
|
32
|
+
|
|
33
|
+
import useCancel from "../composition/cancel";
|
|
34
|
+
import useImagePath from "../composition/image-path";
|
|
35
|
+
import useSizes from "../composition/sizes";
|
|
36
|
+
|
|
37
|
+
import ExtendedMultiselectLoader from "./ExtendedMultiselectLoader.vue";
|
|
38
|
+
|
|
39
|
+
const props = defineProps({
|
|
40
|
+
/**
|
|
41
|
+
* Blocks cancel button
|
|
42
|
+
* @property {boolean} disabled
|
|
43
|
+
*/
|
|
44
|
+
disabled: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
required: true,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Defines a svg-filter for icons
|
|
51
|
+
* @property {string} iconFilter
|
|
52
|
+
*/
|
|
53
|
+
iconFilter: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: true,
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Provides size to create special size-class
|
|
60
|
+
* for each kind of icon
|
|
61
|
+
* @property {string} iconSize
|
|
62
|
+
*/
|
|
63
|
+
iconSize: {
|
|
64
|
+
type: String,
|
|
65
|
+
required: true,
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Replaces cancel button with loader
|
|
70
|
+
* @property {boolean} loading
|
|
71
|
+
*/
|
|
72
|
+
loading: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
required: true,
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Determines whether to clear current value of search field
|
|
79
|
+
* @property {boolean} showSearchField
|
|
80
|
+
*/
|
|
81
|
+
showSearchField: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
required: true,
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Defines "tabindex" attribute of cancel button
|
|
88
|
+
* @default null
|
|
89
|
+
* @property {number|null} tabindex
|
|
90
|
+
*/
|
|
91
|
+
tabindex: {
|
|
92
|
+
type: Number,
|
|
93
|
+
default: null,
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* List of selected options
|
|
98
|
+
* @property {Array} selectedOptions
|
|
99
|
+
*/
|
|
100
|
+
selectedOptions: {
|
|
101
|
+
type: Array,
|
|
102
|
+
required: true,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const {
|
|
107
|
+
disabled,
|
|
108
|
+
iconFilter,
|
|
109
|
+
iconSize,
|
|
110
|
+
loading,
|
|
111
|
+
selectedOptions,
|
|
112
|
+
showSearchField,
|
|
113
|
+
tabindex,
|
|
114
|
+
} = toRefs(props);
|
|
115
|
+
|
|
116
|
+
const { createImagePath } = useImagePath();
|
|
117
|
+
|
|
118
|
+
const cancelIcon = ref(createImagePath("cancel.svg"));
|
|
119
|
+
|
|
120
|
+
const { cancel } = useCancel(
|
|
121
|
+
disabled,
|
|
122
|
+
showSearchField,
|
|
123
|
+
selectedOptions,
|
|
124
|
+
);
|
|
125
|
+
const { iconSizeClass } = useSizes(iconSize);
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Toggles classes of component if "loading"
|
|
129
|
+
* or "disabled" props equals true
|
|
130
|
+
* @function
|
|
131
|
+
* @returns {string} class
|
|
132
|
+
*/
|
|
133
|
+
const classes = computed(() => {
|
|
134
|
+
return (loading.value || disabled.value)
|
|
135
|
+
? "extended__multiselect-cancel--disabled"
|
|
136
|
+
: "extended__multiselect-cancel";
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Sets "tabindex" attibute of clear button based on
|
|
141
|
+
* given tabindex
|
|
142
|
+
* @function
|
|
143
|
+
* @returns {number} tabindex
|
|
144
|
+
*/
|
|
145
|
+
const increasedTabindex = computed(() => {
|
|
146
|
+
return tabindex.value ? tabindex.value + 2 : 0;
|
|
147
|
+
});
|
|
148
|
+
</script>
|