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
package/src/styles/variables.css
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
.extended__multiselect-wrapper,
|
|
2
|
-
.extended__multiselect-wrapper--disabled {
|
|
3
|
-
--basic-color: #708090;
|
|
4
|
-
--dark-slate-grey: #2F4F4F;
|
|
5
|
-
--dark-slate-blue: #483D8B;
|
|
6
|
-
--teal: #008080;
|
|
7
|
-
--strict: #000000;
|
|
8
|
-
--hover-color: #FFFFFF;
|
|
9
|
-
--basic-transparent: rgba(112, 128, 144, 0.6);
|
|
10
|
-
--dark-slate-grey-transparent: rgba(47, 79, 79, 0.6);
|
|
11
|
-
--dark-slate-blue-transparent: rgba(72, 61, 139, 0.6);
|
|
12
|
-
--teal-transparent: rgba(0, 128, 128, 0.6);
|
|
13
|
-
--strict-transparent: rgba(0, 0, 0, 0.6);
|
|
14
|
-
--cancel: #B22222;
|
|
15
|
-
--cancel-backgound-color: rgba(179, 33, 33, 0.1);
|
|
16
|
-
--disabled: rgba(176, 176, 176, 0.6);
|
|
17
|
-
--loader-color: #00BFFF;
|
|
18
|
-
|
|
19
|
-
--wide-text: 700;
|
|
20
|
-
--max-size: 100%;
|
|
21
|
-
--half-size: 50%;
|
|
22
|
-
--icon-size-large: 18px;
|
|
23
|
-
--icon-size-medium: 15px;
|
|
24
|
-
--icon-size-small: 12px;
|
|
25
|
-
--wrapper-padding: 5px 10px;
|
|
26
|
-
--root-padding: 6px 10px;
|
|
27
|
-
--marker-padding: 6px 40px;
|
|
28
|
-
--options-padding: 6px 0;
|
|
29
|
-
--border-radius: 6px;
|
|
30
|
-
--block-border-radius: 4px;
|
|
31
|
-
--icon-size-block: 14px;
|
|
32
|
-
--block-gap: 6px;
|
|
33
|
-
--outer-gap: 10px;
|
|
34
|
-
--toggle-icon-gap: 1px;
|
|
35
|
-
--block-padding: 1px 3px 1px 7px;
|
|
36
|
-
--increaser-padding: 3px 7px;
|
|
37
|
-
--cancel-padding: 3px 8px;
|
|
38
|
-
--block-cancel-padding: 4px;
|
|
39
|
-
|
|
40
|
-
--border: 1px solid;
|
|
41
|
-
}
|
|
1
|
+
.extended__multiselect-wrapper,
|
|
2
|
+
.extended__multiselect-wrapper--disabled {
|
|
3
|
+
--basic-color: #708090;
|
|
4
|
+
--dark-slate-grey: #2F4F4F;
|
|
5
|
+
--dark-slate-blue: #483D8B;
|
|
6
|
+
--teal: #008080;
|
|
7
|
+
--strict: #000000;
|
|
8
|
+
--hover-color: #FFFFFF;
|
|
9
|
+
--basic-transparent: rgba(112, 128, 144, 0.6);
|
|
10
|
+
--dark-slate-grey-transparent: rgba(47, 79, 79, 0.6);
|
|
11
|
+
--dark-slate-blue-transparent: rgba(72, 61, 139, 0.6);
|
|
12
|
+
--teal-transparent: rgba(0, 128, 128, 0.6);
|
|
13
|
+
--strict-transparent: rgba(0, 0, 0, 0.6);
|
|
14
|
+
--cancel: #B22222;
|
|
15
|
+
--cancel-backgound-color: rgba(179, 33, 33, 0.1);
|
|
16
|
+
--disabled: rgba(176, 176, 176, 0.6);
|
|
17
|
+
--loader-color: #00BFFF;
|
|
18
|
+
|
|
19
|
+
--wide-text: 700;
|
|
20
|
+
--max-size: 100%;
|
|
21
|
+
--half-size: 50%;
|
|
22
|
+
--icon-size-large: 18px;
|
|
23
|
+
--icon-size-medium: 15px;
|
|
24
|
+
--icon-size-small: 12px;
|
|
25
|
+
--wrapper-padding: 5px 10px;
|
|
26
|
+
--root-padding: 6px 10px;
|
|
27
|
+
--marker-padding: 6px 40px;
|
|
28
|
+
--options-padding: 6px 0;
|
|
29
|
+
--border-radius: 6px;
|
|
30
|
+
--block-border-radius: 4px;
|
|
31
|
+
--icon-size-block: 14px;
|
|
32
|
+
--block-gap: 6px;
|
|
33
|
+
--outer-gap: 10px;
|
|
34
|
+
--toggle-icon-gap: 1px;
|
|
35
|
+
--block-padding: 1px 3px 1px 7px;
|
|
36
|
+
--increaser-padding: 3px 7px;
|
|
37
|
+
--cancel-padding: 3px 8px;
|
|
38
|
+
--block-cancel-padding: 4px;
|
|
39
|
+
|
|
40
|
+
--border: 1px solid;
|
|
41
|
+
}
|
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
import { fireEvent } from "@testing-library/dom";
|
|
2
|
-
import {
|
|
3
|
-
mountComponent,
|
|
4
|
-
wrapperProvides,
|
|
5
|
-
SEARCH_PATTERN,
|
|
6
|
-
} from "../utils/mount";
|
|
7
|
-
import {
|
|
8
|
-
mockOptionSelection,
|
|
9
|
-
createNewOptionsWrapper,
|
|
10
|
-
} from "../utils/utils";
|
|
11
|
-
|
|
12
|
-
import emitter from "tiny-emitter/instance";
|
|
13
|
-
|
|
14
|
-
import Vue3ExtendedMultiselect from "../../src/components/Vue3ExtendedMultiselect.vue";
|
|
15
|
-
import ExtendedMultiselectInput from "../../src/components/ExtendedMultiselectInput.vue";
|
|
16
|
-
import ExtendedMultiselectMultiple from "../../src/components/ExtendedMultiselectMultiple.vue";
|
|
17
|
-
|
|
18
|
-
let wrapper;
|
|
19
|
-
|
|
20
|
-
describe("events", () => {
|
|
21
|
-
it("correctly emits 'pattern-changed' event", async () => {
|
|
22
|
-
const propsData = {
|
|
23
|
-
options: globalThis.OPTIONS,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
wrapper = await mountComponent(Vue3ExtendedMultiselect, true, propsData);
|
|
27
|
-
|
|
28
|
-
emitter.emit("extended:search-pattern-changed", globalThis.SEARCH_VALUE);
|
|
29
|
-
|
|
30
|
-
expect(wrapper.emitted()['pattern-changed'][0][0]).toEqual(globalThis.SEARCH_VALUE);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
it("correctly emits 'select' event", async () => {
|
|
35
|
-
const propsData = {
|
|
36
|
-
defaultExpanded: true,
|
|
37
|
-
simpleEvents: false,
|
|
38
|
-
inputId: globalThis.INPUT_ID,
|
|
39
|
-
options: globalThis.OPTIONS,
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
|
|
43
|
-
|
|
44
|
-
await mockOptionSelection(wrapper);
|
|
45
|
-
|
|
46
|
-
expect(wrapper.emitted().select[0][0].option.label).toEqual("First Option");
|
|
47
|
-
expect(wrapper.emitted().select[0][0].inputId).toEqual(globalThis.INPUT_ID);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
it("correctly emits 'clean' event", async () => {
|
|
52
|
-
const propsData = {
|
|
53
|
-
showClearIcon: true,
|
|
54
|
-
defaultExpanded: true,
|
|
55
|
-
options: globalThis.OPTIONS,
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
|
|
59
|
-
|
|
60
|
-
const cleanButton = wrapper.find("#extended__multiselect-cancel");
|
|
61
|
-
|
|
62
|
-
await fireEvent.click(cleanButton.element);
|
|
63
|
-
|
|
64
|
-
expect(wrapper.emitted().clean).toBeDefined();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
it("correctly emits 'option-created' event", async () => {
|
|
69
|
-
const propsData = {
|
|
70
|
-
defaultExpanded: true,
|
|
71
|
-
createOnTheGo: true,
|
|
72
|
-
inputId: globalThis.INPUT_ID,
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
wrapper = await mountComponent(
|
|
76
|
-
Vue3ExtendedMultiselect,
|
|
77
|
-
false,
|
|
78
|
-
propsData,
|
|
79
|
-
wrapperProvides(globalThis.SEARCH_VALUE, SEARCH_PATTERN),
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
await fireEvent.mouseDown(createNewOptionsWrapper(wrapper).element);
|
|
83
|
-
|
|
84
|
-
expect(wrapper.emitted()["option-created"][0][0]).toEqual(globalThis.SEARCH_VALUE);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
it("correctly emits 'active' event", async () => {
|
|
89
|
-
wrapper = await mountComponent(Vue3ExtendedMultiselect, false);
|
|
90
|
-
|
|
91
|
-
const inputWrapper = wrapper.findComponent(ExtendedMultiselectInput);
|
|
92
|
-
const field = inputWrapper.find("input");
|
|
93
|
-
|
|
94
|
-
await fireEvent.focus(field.element);
|
|
95
|
-
|
|
96
|
-
expect(wrapper.emitted().active[0][0]).toBeNull();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
it("correctly emits 'close' event", async () => {
|
|
101
|
-
const propsData = {
|
|
102
|
-
defaultExpanded: true,
|
|
103
|
-
simpleEvents: false,
|
|
104
|
-
inputId: globalThis.INPUT_ID,
|
|
105
|
-
options: globalThis.OPTIONS,
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
|
|
109
|
-
|
|
110
|
-
await mockOptionSelection(wrapper);
|
|
111
|
-
|
|
112
|
-
expect(wrapper.emitted().close[0][0].inputId).toEqual(globalThis.INPUT_ID);
|
|
113
|
-
expect(wrapper.emitted().close[0][0].options).toHaveLength(0);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
it("correctly emits 'increase' event", async () => {
|
|
118
|
-
expect.assertions(1);
|
|
119
|
-
|
|
120
|
-
const propsData = {
|
|
121
|
-
multiple: true,
|
|
122
|
-
toggleMultipleBlocksLimit: true,
|
|
123
|
-
multipleBlocksLimit: 1,
|
|
124
|
-
increaseDisplayBy: 1,
|
|
125
|
-
preselectedOptions: globalThis.OPTIONS,
|
|
126
|
-
options: globalThis.OPTIONS,
|
|
127
|
-
};
|
|
128
|
-
const wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
|
|
129
|
-
const multipleWrapper = wrapper.findComponent(ExtendedMultiselectMultiple);
|
|
130
|
-
const increaserWrapper = multipleWrapper.find(".extended__multiselect-increaser");
|
|
131
|
-
|
|
132
|
-
await fireEvent.click(increaserWrapper.element);
|
|
133
|
-
|
|
134
|
-
expect(wrapper.emitted().increase[0][0]).toEqual(2);
|
|
135
|
-
});
|
|
1
|
+
import { fireEvent } from "@testing-library/dom";
|
|
2
|
+
import {
|
|
3
|
+
mountComponent,
|
|
4
|
+
wrapperProvides,
|
|
5
|
+
SEARCH_PATTERN,
|
|
6
|
+
} from "../utils/mount";
|
|
7
|
+
import {
|
|
8
|
+
mockOptionSelection,
|
|
9
|
+
createNewOptionsWrapper,
|
|
10
|
+
} from "../utils/utils";
|
|
11
|
+
|
|
12
|
+
import emitter from "tiny-emitter/instance";
|
|
13
|
+
|
|
14
|
+
import Vue3ExtendedMultiselect from "../../src/components/Vue3ExtendedMultiselect.vue";
|
|
15
|
+
import ExtendedMultiselectInput from "../../src/components/ExtendedMultiselectInput.vue";
|
|
16
|
+
import ExtendedMultiselectMultiple from "../../src/components/ExtendedMultiselectMultiple.vue";
|
|
17
|
+
|
|
18
|
+
let wrapper;
|
|
19
|
+
|
|
20
|
+
describe("events", () => {
|
|
21
|
+
it("correctly emits 'pattern-changed' event", async () => {
|
|
22
|
+
const propsData = {
|
|
23
|
+
options: globalThis.OPTIONS,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
wrapper = await mountComponent(Vue3ExtendedMultiselect, true, propsData);
|
|
27
|
+
|
|
28
|
+
emitter.emit("extended:search-pattern-changed", globalThis.SEARCH_VALUE);
|
|
29
|
+
|
|
30
|
+
expect(wrapper.emitted()['pattern-changed'][0][0]).toEqual(globalThis.SEARCH_VALUE);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
it("correctly emits 'select' event", async () => {
|
|
35
|
+
const propsData = {
|
|
36
|
+
defaultExpanded: true,
|
|
37
|
+
simpleEvents: false,
|
|
38
|
+
inputId: globalThis.INPUT_ID,
|
|
39
|
+
options: globalThis.OPTIONS,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
|
|
43
|
+
|
|
44
|
+
await mockOptionSelection(wrapper);
|
|
45
|
+
|
|
46
|
+
expect(wrapper.emitted().select[0][0].option.label).toEqual("First Option");
|
|
47
|
+
expect(wrapper.emitted().select[0][0].inputId).toEqual(globalThis.INPUT_ID);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
it("correctly emits 'clean' event", async () => {
|
|
52
|
+
const propsData = {
|
|
53
|
+
showClearIcon: true,
|
|
54
|
+
defaultExpanded: true,
|
|
55
|
+
options: globalThis.OPTIONS,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
|
|
59
|
+
|
|
60
|
+
const cleanButton = wrapper.find("#extended__multiselect-cancel");
|
|
61
|
+
|
|
62
|
+
await fireEvent.click(cleanButton.element);
|
|
63
|
+
|
|
64
|
+
expect(wrapper.emitted().clean).toBeDefined();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
it("correctly emits 'option-created' event", async () => {
|
|
69
|
+
const propsData = {
|
|
70
|
+
defaultExpanded: true,
|
|
71
|
+
createOnTheGo: true,
|
|
72
|
+
inputId: globalThis.INPUT_ID,
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
wrapper = await mountComponent(
|
|
76
|
+
Vue3ExtendedMultiselect,
|
|
77
|
+
false,
|
|
78
|
+
propsData,
|
|
79
|
+
wrapperProvides(globalThis.SEARCH_VALUE, SEARCH_PATTERN),
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
await fireEvent.mouseDown(createNewOptionsWrapper(wrapper).element);
|
|
83
|
+
|
|
84
|
+
expect(wrapper.emitted()["option-created"][0][0]).toEqual(globalThis.SEARCH_VALUE);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
it("correctly emits 'active' event", async () => {
|
|
89
|
+
wrapper = await mountComponent(Vue3ExtendedMultiselect, false);
|
|
90
|
+
|
|
91
|
+
const inputWrapper = wrapper.findComponent(ExtendedMultiselectInput);
|
|
92
|
+
const field = inputWrapper.find("input");
|
|
93
|
+
|
|
94
|
+
await fireEvent.focus(field.element);
|
|
95
|
+
|
|
96
|
+
expect(wrapper.emitted().active[0][0]).toBeNull();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
it("correctly emits 'close' event", async () => {
|
|
101
|
+
const propsData = {
|
|
102
|
+
defaultExpanded: true,
|
|
103
|
+
simpleEvents: false,
|
|
104
|
+
inputId: globalThis.INPUT_ID,
|
|
105
|
+
options: globalThis.OPTIONS,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
|
|
109
|
+
|
|
110
|
+
await mockOptionSelection(wrapper);
|
|
111
|
+
|
|
112
|
+
expect(wrapper.emitted().close[0][0].inputId).toEqual(globalThis.INPUT_ID);
|
|
113
|
+
expect(wrapper.emitted().close[0][0].options).toHaveLength(0);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
it("correctly emits 'increase' event", async () => {
|
|
118
|
+
expect.assertions(1);
|
|
119
|
+
|
|
120
|
+
const propsData = {
|
|
121
|
+
multiple: true,
|
|
122
|
+
toggleMultipleBlocksLimit: true,
|
|
123
|
+
multipleBlocksLimit: 1,
|
|
124
|
+
increaseDisplayBy: 1,
|
|
125
|
+
preselectedOptions: globalThis.OPTIONS,
|
|
126
|
+
options: globalThis.OPTIONS,
|
|
127
|
+
};
|
|
128
|
+
const wrapper = await mountComponent(Vue3ExtendedMultiselect, false, propsData);
|
|
129
|
+
const multipleWrapper = wrapper.findComponent(ExtendedMultiselectMultiple);
|
|
130
|
+
const increaserWrapper = multipleWrapper.find(".extended__multiselect-increaser");
|
|
131
|
+
|
|
132
|
+
await fireEvent.click(increaserWrapper.element);
|
|
133
|
+
|
|
134
|
+
expect(wrapper.emitted().increase[0][0]).toEqual(2);
|
|
135
|
+
});
|
|
136
136
|
});
|