vue3-extended-multiselect 2.0.0 → 2.0.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/README.md +1 -1
- package/dist/Vue3ExtendedMultiselect.cjs.js +5295 -0
- package/dist/Vue3ExtendedMultiselect.cjs.js.map +1 -0
- package/dist/Vue3ExtendedMultiselect.esm.js +5290 -0
- package/dist/Vue3ExtendedMultiselect.esm.js.map +1 -0
- package/dist/types/index.d.ts +46 -0
- package/package.json +5 -1
- package/.browserslistrc +0 -3
- package/.eslintrc.js +0 -36
- package/.github/workflows/publish.yml +0 -41
- package/.nvmrc +0 -0
- package/CHANGELOG.md +0 -411
- package/CONTRIBUTING.md +0 -57
- package/babel.config.js +0 -10
- package/index.js +0 -3
- package/jest.config.js +0 -62
- package/rollup.config.mjs +0 -74
- package/src/components/ExtendedMultiselectCancel.vue +0 -165
- package/src/components/ExtendedMultiselectInput.vue +0 -742
- package/src/components/ExtendedMultiselectLoader.vue +0 -182
- package/src/components/ExtendedMultiselectMultiple.vue +0 -400
- package/src/components/ExtendedMultiselectOptions.vue +0 -1191
- package/src/components/ExtendedMultiselectToggle.vue +0 -272
- package/src/components/Vue3ExtendedMultiselect.vue +0 -2476
- package/src/composition/cancel.js +0 -40
- package/src/composition/click-outside.js +0 -9
- package/src/composition/debounce.js +0 -9
- package/src/composition/emitter.js +0 -9
- package/src/composition/image-path.js +0 -17
- package/src/composition/labels.js +0 -42
- package/src/composition/preselected-options.js +0 -68
- package/src/composition/search-value.js +0 -34
- package/src/composition/sizes.js +0 -45
- package/src/composition/toggle.js +0 -32
- package/src/sets/sets.js +0 -100
- package/src/styles/animations.css +0 -19
- package/src/styles/main.css +0 -460
- package/src/styles/variables.css +0 -52
- package/src/tools/Debounce.js +0 -26
- package/src/tools/LocalEmitter.js +0 -32
- package/src/tools/instance.js +0 -3
- package/tests/unit/events.spec.js +0 -150
- package/tests/unit/props.spec.js +0 -1155
- package/tests/unit/tools.spec.js +0 -56
- package/tests/utils/mocks.js +0 -1
- package/tests/utils/mount.js +0 -38
- package/tests/utils/stubs.js +0 -1
- package/tests/utils/utils.js +0 -25
- package/typings/vue3-extended-multiselect.d.ts +0 -44
- /package/{src → dist}/assets/images/base-arrow.svg +0 -0
- /package/{src → dist}/assets/images/cancel.svg +0 -0
- /package/{src → dist}/assets/images/circle-arrow.svg +0 -0
- /package/{src → dist}/assets/images/double-arrow.svg +0 -0
- /package/{src → dist}/assets/images/inner-arrow.svg +0 -0
- /package/{src → dist}/assets/images/loader.svg +0 -0
- /package/{src → dist}/assets/images/triangle-arrow.svg +0 -0
- /package/{src → dist}/assets/images/triangle-circle-arrow.svg +0 -0
- /package/{src → dist}/assets/images/wide-arrow.svg +0 -0
package/jest.config.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
preset: "@vue/cli-plugin-unit-jest",
|
|
3
|
-
transform: {
|
|
4
|
-
"^.+\\.vue$": "@vue/vue3-jest"
|
|
5
|
-
},
|
|
6
|
-
expand: true,
|
|
7
|
-
displayName: {
|
|
8
|
-
name: "vue3-extended-multiselect",
|
|
9
|
-
color: "bgGreen",
|
|
10
|
-
},
|
|
11
|
-
extraGlobals: [],
|
|
12
|
-
globals: {
|
|
13
|
-
OPTIONS: [
|
|
14
|
-
{ label: "First Option", customLabel: "First Option Custom Label" },
|
|
15
|
-
{ label: "Second Option" },
|
|
16
|
-
{ label: "Third Option", searchByField: "First" },
|
|
17
|
-
126,
|
|
18
|
-
],
|
|
19
|
-
INPUT_ID: "vue3-extended-multiselect-input-1",
|
|
20
|
-
SEARCH_VALUE: "Search for options",
|
|
21
|
-
SEARCH_VALUE_WITH_RESULTS: "First",
|
|
22
|
-
MORE_THAN_LIMIT: "You have to select no more than one option",
|
|
23
|
-
LESS_THAN_LIMIT: "You have to select at least two options",
|
|
24
|
-
},
|
|
25
|
-
include: [
|
|
26
|
-
"<rootDir>/components/ExtendedMultiselectOptions.vue",
|
|
27
|
-
],
|
|
28
|
-
injectGlobals: true,
|
|
29
|
-
moduleFileExtensions: [
|
|
30
|
-
"ts",
|
|
31
|
-
"tsx",
|
|
32
|
-
"js",
|
|
33
|
-
"json",
|
|
34
|
-
"jsx",
|
|
35
|
-
"mjs",
|
|
36
|
-
"node",
|
|
37
|
-
"vue"
|
|
38
|
-
],
|
|
39
|
-
moduleNameMapper: {
|
|
40
|
-
"\\.svg$" : "<rootDir>/tests/utils/stubs",
|
|
41
|
-
"\\.scss$" : "identity-obj-proxy",
|
|
42
|
-
},
|
|
43
|
-
modulePathIgnorePatterns: ["<rootDir>/assets"],
|
|
44
|
-
resetModules: true,
|
|
45
|
-
resetMocks: true,
|
|
46
|
-
rootDir: "./",
|
|
47
|
-
setupFiles: ["<rootDir>/tests/utils/mocks"],
|
|
48
|
-
slowTestThreshold: 20,
|
|
49
|
-
testEnvironment: "jsdom",
|
|
50
|
-
testLocationInResults: true,
|
|
51
|
-
testMatch: [
|
|
52
|
-
"**/tests/**/*.[jt]s?(x)",
|
|
53
|
-
"**/?(*.)+(spec|test).[tj]s?(x)"
|
|
54
|
-
],
|
|
55
|
-
testPathIgnorePatterns: [
|
|
56
|
-
"tests/utils"
|
|
57
|
-
],
|
|
58
|
-
transformIgnorePatterns: [
|
|
59
|
-
"<rootDir>/node_modules/"
|
|
60
|
-
],
|
|
61
|
-
timers: "real",
|
|
62
|
-
}
|
package/rollup.config.mjs
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { babel } from "@rollup/plugin-babel";
|
|
2
|
-
import dts from "rollup-plugin-dts";
|
|
3
|
-
import vue from "rollup-plugin-vue";
|
|
4
|
-
import copy from "rollup-plugin-copy";
|
|
5
|
-
import postcss from "rollup-plugin-postcss";
|
|
6
|
-
|
|
7
|
-
export default [
|
|
8
|
-
{
|
|
9
|
-
input: "src/components/Vue3ExtendedMultiselect.vue",
|
|
10
|
-
output: [
|
|
11
|
-
{
|
|
12
|
-
file: "dist/Vue3ExtendedMultiselect.cjs.js",
|
|
13
|
-
format: "cjs",
|
|
14
|
-
exports: "named",
|
|
15
|
-
sourcemap: true,
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
file: "dist/Vue3ExtendedMultiselect.esm.js",
|
|
19
|
-
format: "esm",
|
|
20
|
-
sourcemap: true,
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
plugins: [
|
|
24
|
-
babel({
|
|
25
|
-
babelHelpers: 'runtime',
|
|
26
|
-
exclude: ["./node_modules/**", "./qa/**"],
|
|
27
|
-
}),
|
|
28
|
-
copy({
|
|
29
|
-
targets: [
|
|
30
|
-
{ src: 'src/assets/images/*', dest: 'dist/assets/images' }
|
|
31
|
-
],
|
|
32
|
-
}),
|
|
33
|
-
vue({
|
|
34
|
-
preprocessStyles: true,
|
|
35
|
-
}),
|
|
36
|
-
postcss({
|
|
37
|
-
minimize: true,
|
|
38
|
-
}),
|
|
39
|
-
{
|
|
40
|
-
transform(code) {
|
|
41
|
-
const importMetaRegExp = /require\('url'\).pathToFileURL\(__filename\).toString\(\)/g;
|
|
42
|
-
const assetsRegExp = /\.\.\/assets\/images/g;
|
|
43
|
-
const importMetaMatches = Array.from(code.matchAll(importMetaRegExp));
|
|
44
|
-
const assetsMatches = Array.from(code.matchAll(assetsRegExp));
|
|
45
|
-
let newCode = code;
|
|
46
|
-
|
|
47
|
-
for (const [all] of importMetaMatches) {
|
|
48
|
-
newCode = newCode.replace(all, "import.meta.url");
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
for (const [all] of assetsMatches) {
|
|
52
|
-
newCode = newCode.replace(all, "./assets/images");
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
code: newCode,
|
|
57
|
-
map: {mappings: ""},
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
input: "typings/vue3-extended-multiselect.d.ts",
|
|
65
|
-
output: [
|
|
66
|
-
{
|
|
67
|
-
file: "dist/types/index.d.ts",
|
|
68
|
-
format: "esm",
|
|
69
|
-
sourcemap: false,
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
plugins: [dts()],
|
|
73
|
-
}
|
|
74
|
-
];
|
|
@@ -1,165 +0,0 @@
|
|
|
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>
|