vue3-extended-multiselect 1.2.4 → 1.4.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.
Files changed (44) hide show
  1. package/.browserslistrc +3 -3
  2. package/.eslintrc.js +34 -34
  3. package/.github/workflows/publish.yml +41 -41
  4. package/CHANGELOG.md +181 -151
  5. package/LICENSE +21 -21
  6. package/README.md +266 -265
  7. package/babel.config.js +5 -5
  8. package/index.js +2 -2
  9. package/jest.config.js +61 -61
  10. package/package.json +47 -48
  11. package/src/assets/base-arrow.svg +70 -70
  12. package/src/assets/cancel.svg +34 -34
  13. package/src/assets/circle-arrow.svg +7 -7
  14. package/src/assets/double-arrow.svg +39 -39
  15. package/src/assets/inner-arrow.svg +8 -8
  16. package/src/assets/loader.svg +5 -5
  17. package/src/assets/triangle-arrow.svg +72 -72
  18. package/src/assets/triangle-circle-arrow.svg +38 -38
  19. package/src/assets/wide-arrow.svg +72 -72
  20. package/src/components/ExtendedMultiselectCancel.vue +166 -160
  21. package/src/components/ExtendedMultiselectInput.vue +687 -669
  22. package/src/components/ExtendedMultiselectLoader.vue +182 -182
  23. package/src/components/ExtendedMultiselectMultiple.vue +320 -320
  24. package/src/components/ExtendedMultiselectOptions.vue +1144 -1144
  25. package/src/components/ExtendedMultiselectToggle.vue +273 -273
  26. package/src/components/Vue3ExtendedMultiselect.vue +1752 -1729
  27. package/src/composition/cancel.js +38 -33
  28. package/src/composition/image-path.js +16 -16
  29. package/src/composition/labels.js +41 -41
  30. package/src/composition/preselected-options.js +67 -67
  31. package/src/composition/search-value.js +33 -33
  32. package/src/composition/sizes.js +42 -42
  33. package/src/composition/toggle.js +33 -33
  34. package/src/events/LocalEmitter.js +32 -0
  35. package/src/events/emitter.js +3 -3
  36. package/src/sets/sets.js +99 -99
  37. package/src/styles/animations.css +18 -18
  38. package/src/styles/main.css +441 -441
  39. package/src/styles/variables.css +49 -49
  40. package/tests/unit/events.spec.js +138 -138
  41. package/tests/unit/props.spec.js +1099 -1081
  42. package/tests/utils/mount.js +37 -37
  43. package/tests/utils/utils.js +20 -20
  44. package/typings/vue3-extended-multiselect.d.ts +43 -43
@@ -1,38 +1,38 @@
1
- import { mount, shallowMount } from "@vue/test-utils";
2
- import { reactive } from "vue";
3
-
4
- export const mountComponent = (component, shallow, propsData, options) => {
5
- if (shallow) {
6
- return shallowMount(component, {
7
- propsData,
8
- ...options,
9
- });
10
- } else {
11
- return mount(component, {
12
- propsData,
13
- ...options,
14
- });
15
- }
16
- };
17
-
18
- export const wrapperProvides = (searchValue, searchPattern) => {
19
- return {
20
- provide: {
21
- searchState: reactive({
22
- searchValue: searchValue,
23
- searchPattern: searchPattern,
24
- }),
25
- },
26
- };
27
- };
28
-
29
- export const wrapperSlots = {
30
- slots: {
31
- moreThanLimit: `<div>${globalThis.MORE_THAN_LIMIT}</div>`,
32
- lessThanLimit: `<div>${globalThis.LESS_THAN_LIMIT}</div>`,
33
- },
34
- };
35
-
36
- export const SEARCH_PATTERN = /126/;
37
- export const NO_OPTIONS_PATTERN = /No options/i;
1
+ import { mount, shallowMount } from "@vue/test-utils";
2
+ import { reactive } from "vue";
3
+
4
+ export const mountComponent = (component, shallow, propsData, options) => {
5
+ if (shallow) {
6
+ return shallowMount(component, {
7
+ propsData,
8
+ ...options,
9
+ });
10
+ } else {
11
+ return mount(component, {
12
+ propsData,
13
+ ...options,
14
+ });
15
+ }
16
+ };
17
+
18
+ export const wrapperProvides = (searchValue, searchPattern) => {
19
+ return {
20
+ provide: {
21
+ searchState: reactive({
22
+ searchValue: searchValue,
23
+ searchPattern: searchPattern,
24
+ }),
25
+ },
26
+ };
27
+ };
28
+
29
+ export const wrapperSlots = {
30
+ slots: {
31
+ moreThanLimit: `<div>${globalThis.MORE_THAN_LIMIT}</div>`,
32
+ lessThanLimit: `<div>${globalThis.LESS_THAN_LIMIT}</div>`,
33
+ },
34
+ };
35
+
36
+ export const SEARCH_PATTERN = /126/;
37
+ export const NO_OPTIONS_PATTERN = /No options/i;
38
38
  export const FIRST_OPTION_PATTERN = /F/i;
@@ -1,21 +1,21 @@
1
- import { fireEvent } from "@testing-library/dom";
2
-
3
- import ExtendedMultiselectOptions from "../../src/components/ExtendedMultiselectOptions.vue";
4
-
5
- export const mockOptionSelection = async (wrapper) => {
6
- const optionsWrapper = wrapper.findComponent(ExtendedMultiselectOptions);
7
- const optionsListWrapper = optionsWrapper.find(".extended__multiselect-options_container");
8
- const optionElement = optionsListWrapper.find(".extended__multiselect-options_option");
9
-
10
- await fireEvent.click(optionElement.element);
11
- }
12
-
13
- export const expandOptionsList = async (wrapper) => {
14
- const toggle = wrapper.find("#extended__multiselect-toggle");
15
- await fireEvent.click(toggle.element);
16
- }
17
-
18
- export const createNewOptionsWrapper = (wrapper) => {
19
- const optionsWrapper = wrapper.findComponent(ExtendedMultiselectOptions);
20
- return optionsWrapper.find("div > div:first-child");
1
+ import { fireEvent } from "@testing-library/dom";
2
+
3
+ import ExtendedMultiselectOptions from "../../src/components/ExtendedMultiselectOptions.vue";
4
+
5
+ export const mockOptionSelection = async (wrapper) => {
6
+ const optionsWrapper = wrapper.findComponent(ExtendedMultiselectOptions);
7
+ const optionsListWrapper = optionsWrapper.find(".extended__multiselect-options_container");
8
+ const optionElement = optionsListWrapper.find(".extended__multiselect-options_option");
9
+
10
+ await fireEvent.click(optionElement.element);
11
+ }
12
+
13
+ export const expandOptionsList = async (wrapper) => {
14
+ const toggle = wrapper.find("#extended__multiselect-toggle");
15
+ await fireEvent.click(toggle.element);
16
+ }
17
+
18
+ export const createNewOptionsWrapper = (wrapper) => {
19
+ const optionsWrapper = wrapper.findComponent(ExtendedMultiselectOptions);
20
+ return optionsWrapper.find("div > div:first-child");
21
21
  }
@@ -1,44 +1,44 @@
1
- /**
2
- * General type for any kind of option
3
- */
4
- export type UnionOptionType = string | number | boolean | object | Array<unknown> | Function | null | undefined;
5
-
6
- /**
7
- * Method types provided by slot-scope
8
- */
9
- export type Cancel = () => void;
10
- export type CreateCustomOptionLabel = (option: UnionOptionType) => null | string;
11
- export type Increase = Cancel;
12
- export type DeselectBlock = (index: number) => void;
13
- export type OptionCreateLabel = CreateCustomOptionLabel;
14
- export type ToggleOptionsList = (keyboardEvent?: KeyboardEvent) => void;
15
-
16
- interface InputIdInPayload {
17
- inputId?: string;
18
- }
19
-
20
- interface Limit extends InputIdInPayload {
21
- limit: number;
22
- }
23
-
24
- interface OptionsList extends InputIdInPayload {
25
- options: UnionOptionType[];
26
- }
27
-
28
- interface PatternChanged extends InputIdInPayload {
29
- pattern: string;
30
- }
31
-
32
- interface SingleOption extends InputIdInPayload {
33
- option: UnionOptionType;
34
- }
35
-
36
- /**
37
- * Event types
38
- */
39
- export type CleanEvent = UnionOptionType[] | OptionsList;
40
- export type CloseEvent = CleanEvent;
41
- export type IncreaseEvent = number | Limit;
42
- export type OptionCreatedEvent = UnionOptionType | SingleOption;
43
- export type PatternChangedEvent = string | PatternChanged;
1
+ /**
2
+ * General type for any kind of option
3
+ */
4
+ export type UnionOptionType = string | number | boolean | object | Array<unknown> | Function | null | undefined;
5
+
6
+ /**
7
+ * Method types provided by slot-scope
8
+ */
9
+ export type Cancel = () => void;
10
+ export type CreateCustomOptionLabel = (option: UnionOptionType) => null | string;
11
+ export type Increase = Cancel;
12
+ export type DeselectBlock = (index: number) => void;
13
+ export type OptionCreateLabel = CreateCustomOptionLabel;
14
+ export type ToggleOptionsList = (keyboardEvent?: KeyboardEvent) => void;
15
+
16
+ interface InputIdInPayload {
17
+ inputId?: string;
18
+ }
19
+
20
+ interface Limit extends InputIdInPayload {
21
+ limit: number;
22
+ }
23
+
24
+ interface OptionsList extends InputIdInPayload {
25
+ options: UnionOptionType[];
26
+ }
27
+
28
+ interface PatternChanged extends InputIdInPayload {
29
+ pattern: string;
30
+ }
31
+
32
+ interface SingleOption extends InputIdInPayload {
33
+ option: UnionOptionType;
34
+ }
35
+
36
+ /**
37
+ * Event types
38
+ */
39
+ export type CleanEvent = UnionOptionType[] | OptionsList;
40
+ export type CloseEvent = CleanEvent;
41
+ export type IncreaseEvent = number | Limit;
42
+ export type OptionCreatedEvent = UnionOptionType | SingleOption;
43
+ export type PatternChangedEvent = string | PatternChanged;
44
44
  export type SelectEvent = OptionCreatedEvent;