aloha-vue 2.87.0 → 2.87.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 (52) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/aloha-vue.css +13827 -13827
  3. package/dist/aloha-vue.es.js +60256 -60235
  4. package/dist/aloha-vue.umd.js +319 -319
  5. package/package.json +1 -1
  6. package/scss/components/ui/ACheckbox.scss +17 -17
  7. package/scss/components/ui/AInputFile.scss +15 -15
  8. package/scss/utils/border_radius.scss +61 -61
  9. package/src/AAlert/compositionAPI/IconAPI.js +28 -28
  10. package/src/ACloak/ACloak.js +135 -135
  11. package/src/ALoading/ALoading.js +146 -146
  12. package/src/AMenu/compositionAPI/ResizeAPI.js +1 -1
  13. package/src/AMenu/compositionAPI/__tests__/ResizeAPI.test.js +33 -0
  14. package/src/ASpinner/ASpinner.js +71 -71
  15. package/src/filters/i18n/ar.json +11 -11
  16. package/src/filters/i18n/de.json +11 -11
  17. package/src/filters/i18n/en.json +11 -11
  18. package/src/filters/i18n/es.json +11 -11
  19. package/src/filters/i18n/fr.json +11 -11
  20. package/src/filters/i18n/hr.json +10 -10
  21. package/src/filters/i18n/it.json +11 -11
  22. package/src/filters/i18n/nl.json +11 -11
  23. package/src/filters/i18n/pl.json +11 -11
  24. package/src/filters/i18n/ru.json +10 -10
  25. package/src/plugins/ACloakPlugin.js +26 -26
  26. package/src/plugins/AFormPlugin.js +18 -18
  27. package/src/plugins/AGroupButtonDropdownPlugin.js +26 -26
  28. package/src/plugins/AInputNumberPlugin.js +29 -29
  29. package/src/plugins/ALoadingPlugin.js +26 -26
  30. package/src/plugins/AModalPlugin.js +41 -41
  31. package/src/plugins/ARouterLinkConfigPlugin.js +88 -88
  32. package/src/plugins/ASpinnerPlugin.js +26 -26
  33. package/src/plugins/ATablePlugin.js +28 -28
  34. package/src/ui/ACheckbox/i18n/ar.json +5 -5
  35. package/src/ui/ACheckbox/i18n/de.json +5 -5
  36. package/src/ui/ACheckbox/i18n/en.json +5 -5
  37. package/src/ui/ACheckbox/i18n/es.json +5 -5
  38. package/src/ui/ACheckbox/i18n/fr.json +5 -5
  39. package/src/ui/ACheckbox/i18n/hr.json +5 -5
  40. package/src/ui/ACheckbox/i18n/it.json +5 -5
  41. package/src/ui/ACheckbox/i18n/nl.json +4 -4
  42. package/src/ui/ACheckbox/i18n/pl.json +4 -4
  43. package/src/ui/ACheckbox/i18n/ru.json +5 -5
  44. package/src/ui/AColorPicker/AColorPicker.js +15 -11
  45. package/src/ui/AColorPicker/__tests__/AColorPicker.test.js +41 -0
  46. package/src/ui/AColorPicker/compositionAPI/ClearAPI.js +23 -0
  47. package/src/ui/AColorPicker/compositionAPI/IdAPI.js +15 -0
  48. package/src/ui/ADatepicker/compositionAPI/PlaceholderAPI.js +32 -32
  49. package/src/ui/AMultiselectOrdered/compositionAPI/TextsAPI.js +55 -55
  50. package/src/ui/ASlider/__tests__/ASlider.Form.test.js +38 -0
  51. package/src/ui/AUiComponents.js +2 -0
  52. package/src/ui/__tests__/ReadonlyValueParentClass.test.js +217 -217
@@ -1,217 +1,217 @@
1
- import {
2
- h,
3
- nextTick,
4
- } from "vue";
5
- import {
6
- afterEach,
7
- beforeEach,
8
- describe,
9
- expect,
10
- it,
11
- } from "vitest";
12
- import {
13
- mount,
14
- } from "@vue/test-utils";
15
- import {
16
- ACheckbox,
17
- ADatepicker,
18
- ADatepickerRange,
19
- AFieldset,
20
- AForm,
21
- AFormElement,
22
- AGroup,
23
- AInput,
24
- AInputCurrency,
25
- AInputFile,
26
- AInputNumber,
27
- AInputNumberRange,
28
- AJson,
29
- AMultiselectOrdered,
30
- AOneCheckbox,
31
- ARadio,
32
- ARouterLinkConfig,
33
- ASelect,
34
- ASelectIcon,
35
- ASelectStyle,
36
- ASlider,
37
- ASwitch,
38
- ATemplate,
39
- ATextarea,
40
- AValidatedJson,
41
- } from "../../index";
42
-
43
- import ACheckboxItem from "../ACheckbox/ACheckboxItem/ACheckboxItem";
44
- import ARadioItem from "../ARadio/ARadioItem/ARadioItem";
45
-
46
- import {
47
- setI18n,
48
- updateTranslation,
49
- } from "../../ATranslation/compositionAPI/ATranslationAPI";
50
-
51
- const wrappers = [];
52
-
53
- beforeEach(async() => {
54
- setI18n({ de: {} });
55
- updateTranslation();
56
- await nextTick();
57
- });
58
-
59
- afterEach(() => {
60
- wrappers.forEach(wrapper => wrapper.unmount());
61
- wrappers.length = 0;
62
- });
63
-
64
- function mountReadonly(component, props = {}, slots = {}) {
65
- const wrapper = mount(component, {
66
- props: {
67
- id: "test",
68
- readonly: true,
69
- readonlyValueParentClass: ["custom_value", { custom_object: true }],
70
- ...props,
71
- },
72
- slots,
73
- });
74
- wrappers.push(wrapper);
75
- return wrapper;
76
- }
77
-
78
- describe("readonlyValueParentClass", () => {
79
- it.each([
80
- ACheckbox,
81
- ADatepicker,
82
- ADatepickerRange,
83
- AFieldset,
84
- AInput,
85
- AInputCurrency,
86
- AInputFile,
87
- AInputNumber,
88
- AInputNumberRange,
89
- AJson,
90
- AMultiselectOrdered,
91
- AOneCheckbox,
92
- ARadio,
93
- ASelect,
94
- ASelectIcon,
95
- ASelectStyle,
96
- ASlider,
97
- ASwitch,
98
- ATextarea,
99
- ])("styles the value wrapper in $name and reacts to class/readonly changes", async component => {
100
- const wrapper = mountReadonly(component);
101
- await nextTick();
102
- const value = wrapper.get(".a_form_element_readonly_value");
103
- expect(value.classes()).toContain("custom_value");
104
- expect(value.classes()).toContain("custom_object");
105
- expect(wrapper.classes()).not.toContain("custom_value");
106
- await wrapper.setProps({ readonlyValueParentClass: "updated_value" });
107
- expect(value.classes()).toContain("updated_value");
108
- expect(value.classes()).not.toContain("custom_value");
109
- await wrapper.setProps({ readonly: false });
110
- expect(wrapper.find(".updated_value").exists()).toBe(false);
111
- });
112
-
113
- it.each([ADatepickerRange, AInputNumberRange])("preserves range layout in $name", component => {
114
- const wrapper = mountReadonly(component);
115
- expect(wrapper.get(".custom_value").classes()).toContain("a_form_element_readonly_value_range");
116
- });
117
-
118
- it("preserves fieldset columns and propagates defaults with per-child overrides", () => {
119
- const wrapper = mountReadonly(AFieldset, {
120
- children: [
121
- { id: "first", type: "text" },
122
- { id: "second", type: "text", readonlyValueParentClass: "child_value" },
123
- ],
124
- modelValue: {},
125
- });
126
- const value = wrapper.get(".a_form_element_readonly_value");
127
- expect(value.classes()).toContain("a_columns");
128
- const inputs = wrapper.findAllComponents(AInput);
129
- expect(inputs[0].get(".a_form_element_readonly_value").classes()).toContain("custom_value");
130
- expect(inputs[1].get(".a_form_element_readonly_value").classes()).toContain("child_value");
131
- expect(inputs[1].get(".a_form_element_readonly_value").classes()).not.toContain("custom_value");
132
- });
133
-
134
- it("propagates defaults through AForm and nested groups", () => {
135
- const wrapper = mountReadonly(AForm, {
136
- modelValue: { group: {} },
137
- data: [{
138
- id: "group",
139
- type: "group",
140
- children: [
141
- { id: "first", type: "text" },
142
- { id: "second", type: "text", readonlyValueParentClass: "child_value" },
143
- ],
144
- }],
145
- });
146
- const group = wrapper.findComponent(AGroup);
147
- expect(group.get(".a_columns").classes()).toContain("custom_value");
148
- const inputs = group.findAllComponents(AInput);
149
- expect(inputs[0].get(".a_form_element_readonly_value").classes()).toContain("custom_value");
150
- expect(inputs[1].get(".a_form_element_readonly_value").classes()).toContain("child_value");
151
- });
152
-
153
- it("passes the class through AFormElement", () => {
154
- const wrapper = mountReadonly(AFormElement, { type: "text" });
155
- expect(wrapper.get(".a_form_element_readonly_value").classes()).toContain("custom_value");
156
- });
157
-
158
- it.each(["routerLinkConfig", "selectRoute", "multiselectRoute"])("passes the class through ARouterLinkConfig (%s)", async type => {
159
- const wrapper = mountReadonly(ARouterLinkConfig, { type });
160
- await nextTick();
161
- expect(wrapper.get(".a_form_element_readonly_value").classes()).toContain("custom_value");
162
- });
163
-
164
- it("styles template HTML and slot content only in readonly mode", async() => {
165
- const wrapper = mountReadonly(ATemplate, { html: "Value", slotName: "content" }, {
166
- content: () => h("span", "Slot"),
167
- });
168
- expect(wrapper.findAll(".a_template.custom_value")).toHaveLength(2);
169
- await wrapper.setProps({ readonly: false });
170
- expect(wrapper.find(".custom_value").exists()).toBe(false);
171
- });
172
-
173
- it.each(["list", "json"])("styles AValidatedJson values and previews in %s mode", async mode => {
174
- const wrapper = mountReadonly(AValidatedJson, {
175
- mode,
176
- children: [{ id: "value", type: "text" }],
177
- modelValue: mode === "list" ? [{ value: "Hello" }] : { first: { value: "Hello" } },
178
- });
179
- expect(wrapper.get("ul.a_list_group").classes()).toContain("custom_value");
180
- await wrapper.get(".test_toggle_details").trigger("click");
181
- expect(wrapper.get(".a_form_element_readonly_value").classes()).toContain("custom_value");
182
- await wrapper.setProps({ readonly: false });
183
- expect(wrapper.get("ul.a_list_group").classes()).not.toContain("custom_value");
184
- });
185
-
186
- it("styles AValidatedJson values in single mode", () => {
187
- const wrapper = mountReadonly(AValidatedJson, {
188
- mode: "single",
189
- children: [{ id: "value", type: "text" }],
190
- modelValue: { value: "Hello" },
191
- });
192
- expect(wrapper.get(".a_form_element_readonly_value").classes()).toContain("custom_value");
193
- });
194
-
195
- it.each([ACheckboxItem, ARadioItem])("styles standalone readonly $name", async component => {
196
- const wrapper = mountReadonly(component, { itemIndex: 0, dataItem: { label: "Value", value: 1 } });
197
- expect(wrapper.classes()).toContain("custom_value");
198
- await wrapper.setProps({ readonly: false });
199
- expect(wrapper.find(".custom_value").exists()).toBe(false);
200
- });
201
-
202
- it.each([false, true])("shows file names without file input (multiple: %s)", isMultiple => {
203
- const files = [{ name: "<first>.txt" }, { name: "second.txt" }];
204
- const wrapper = mountReadonly(AInputFile, {
205
- isMultiple,
206
- modelValue: isMultiple ? files : files[0],
207
- });
208
- expect(wrapper.findAll("li").map(item => item.text())).toEqual(isMultiple ? ["<first>.txt", "second.txt"] : ["<first>.txt"]);
209
- expect(wrapper.find("input[type=file]").exists()).toBe(false);
210
- expect(wrapper.find("first").exists()).toBe(false);
211
- });
212
-
213
- it("shows readonlyDefault for an empty file value", () => {
214
- const wrapper = mountReadonly(AInputFile, { readonlyDefault: "No files" });
215
- expect(wrapper.get(".a_form_element_readonly_value").text()).toBe("No files");
216
- });
217
- });
1
+ import {
2
+ h,
3
+ nextTick,
4
+ } from "vue";
5
+ import {
6
+ afterEach,
7
+ beforeEach,
8
+ describe,
9
+ expect,
10
+ it,
11
+ } from "vitest";
12
+ import {
13
+ mount,
14
+ } from "@vue/test-utils";
15
+ import {
16
+ ACheckbox,
17
+ ADatepicker,
18
+ ADatepickerRange,
19
+ AFieldset,
20
+ AForm,
21
+ AFormElement,
22
+ AGroup,
23
+ AInput,
24
+ AInputCurrency,
25
+ AInputFile,
26
+ AInputNumber,
27
+ AInputNumberRange,
28
+ AJson,
29
+ AMultiselectOrdered,
30
+ AOneCheckbox,
31
+ ARadio,
32
+ ARouterLinkConfig,
33
+ ASelect,
34
+ ASelectIcon,
35
+ ASelectStyle,
36
+ ASlider,
37
+ ASwitch,
38
+ ATemplate,
39
+ ATextarea,
40
+ AValidatedJson,
41
+ } from "../../index";
42
+
43
+ import ACheckboxItem from "../ACheckbox/ACheckboxItem/ACheckboxItem";
44
+ import ARadioItem from "../ARadio/ARadioItem/ARadioItem";
45
+
46
+ import {
47
+ setI18n,
48
+ updateTranslation,
49
+ } from "../../ATranslation/compositionAPI/ATranslationAPI";
50
+
51
+ const wrappers = [];
52
+
53
+ beforeEach(async() => {
54
+ setI18n({ de: {} });
55
+ updateTranslation();
56
+ await nextTick();
57
+ });
58
+
59
+ afterEach(() => {
60
+ wrappers.forEach(wrapper => wrapper.unmount());
61
+ wrappers.length = 0;
62
+ });
63
+
64
+ function mountReadonly(component, props = {}, slots = {}) {
65
+ const wrapper = mount(component, {
66
+ props: {
67
+ id: "test",
68
+ readonly: true,
69
+ readonlyValueParentClass: ["custom_value", { custom_object: true }],
70
+ ...props,
71
+ },
72
+ slots,
73
+ });
74
+ wrappers.push(wrapper);
75
+ return wrapper;
76
+ }
77
+
78
+ describe("readonlyValueParentClass", () => {
79
+ it.each([
80
+ ACheckbox,
81
+ ADatepicker,
82
+ ADatepickerRange,
83
+ AFieldset,
84
+ AInput,
85
+ AInputCurrency,
86
+ AInputFile,
87
+ AInputNumber,
88
+ AInputNumberRange,
89
+ AJson,
90
+ AMultiselectOrdered,
91
+ AOneCheckbox,
92
+ ARadio,
93
+ ASelect,
94
+ ASelectIcon,
95
+ ASelectStyle,
96
+ ASlider,
97
+ ASwitch,
98
+ ATextarea,
99
+ ])("styles the value wrapper in $name and reacts to class/readonly changes", async component => {
100
+ const wrapper = mountReadonly(component);
101
+ await nextTick();
102
+ const value = wrapper.get(".a_form_element_readonly_value");
103
+ expect(value.classes()).toContain("custom_value");
104
+ expect(value.classes()).toContain("custom_object");
105
+ expect(wrapper.classes()).not.toContain("custom_value");
106
+ await wrapper.setProps({ readonlyValueParentClass: "updated_value" });
107
+ expect(value.classes()).toContain("updated_value");
108
+ expect(value.classes()).not.toContain("custom_value");
109
+ await wrapper.setProps({ readonly: false });
110
+ expect(wrapper.find(".updated_value").exists()).toBe(false);
111
+ });
112
+
113
+ it.each([ADatepickerRange, AInputNumberRange])("preserves range layout in $name", component => {
114
+ const wrapper = mountReadonly(component);
115
+ expect(wrapper.get(".custom_value").classes()).toContain("a_form_element_readonly_value_range");
116
+ });
117
+
118
+ it("preserves fieldset columns and propagates defaults with per-child overrides", () => {
119
+ const wrapper = mountReadonly(AFieldset, {
120
+ children: [
121
+ { id: "first", type: "text" },
122
+ { id: "second", type: "text", readonlyValueParentClass: "child_value" },
123
+ ],
124
+ modelValue: {},
125
+ });
126
+ const value = wrapper.get(".a_form_element_readonly_value");
127
+ expect(value.classes()).toContain("a_columns");
128
+ const inputs = wrapper.findAllComponents(AInput);
129
+ expect(inputs[0].get(".a_form_element_readonly_value").classes()).toContain("custom_value");
130
+ expect(inputs[1].get(".a_form_element_readonly_value").classes()).toContain("child_value");
131
+ expect(inputs[1].get(".a_form_element_readonly_value").classes()).not.toContain("custom_value");
132
+ });
133
+
134
+ it("propagates defaults through AForm and nested groups", () => {
135
+ const wrapper = mountReadonly(AForm, {
136
+ modelValue: { group: {} },
137
+ data: [{
138
+ id: "group",
139
+ type: "group",
140
+ children: [
141
+ { id: "first", type: "text" },
142
+ { id: "second", type: "text", readonlyValueParentClass: "child_value" },
143
+ ],
144
+ }],
145
+ });
146
+ const group = wrapper.findComponent(AGroup);
147
+ expect(group.get(".a_columns").classes()).toContain("custom_value");
148
+ const inputs = group.findAllComponents(AInput);
149
+ expect(inputs[0].get(".a_form_element_readonly_value").classes()).toContain("custom_value");
150
+ expect(inputs[1].get(".a_form_element_readonly_value").classes()).toContain("child_value");
151
+ });
152
+
153
+ it("passes the class through AFormElement", () => {
154
+ const wrapper = mountReadonly(AFormElement, { type: "text" });
155
+ expect(wrapper.get(".a_form_element_readonly_value").classes()).toContain("custom_value");
156
+ });
157
+
158
+ it.each(["routerLinkConfig", "selectRoute", "multiselectRoute"])("passes the class through ARouterLinkConfig (%s)", async type => {
159
+ const wrapper = mountReadonly(ARouterLinkConfig, { type });
160
+ await nextTick();
161
+ expect(wrapper.get(".a_form_element_readonly_value").classes()).toContain("custom_value");
162
+ });
163
+
164
+ it("styles template HTML and slot content only in readonly mode", async() => {
165
+ const wrapper = mountReadonly(ATemplate, { html: "Value", slotName: "content" }, {
166
+ content: () => h("span", "Slot"),
167
+ });
168
+ expect(wrapper.findAll(".a_template.custom_value")).toHaveLength(2);
169
+ await wrapper.setProps({ readonly: false });
170
+ expect(wrapper.find(".custom_value").exists()).toBe(false);
171
+ });
172
+
173
+ it.each(["list", "json"])("styles AValidatedJson values and previews in %s mode", async mode => {
174
+ const wrapper = mountReadonly(AValidatedJson, {
175
+ mode,
176
+ children: [{ id: "value", type: "text" }],
177
+ modelValue: mode === "list" ? [{ value: "Hello" }] : { first: { value: "Hello" } },
178
+ });
179
+ expect(wrapper.get("ul.a_list_group").classes()).toContain("custom_value");
180
+ await wrapper.get(".test_toggle_details").trigger("click");
181
+ expect(wrapper.get(".a_form_element_readonly_value").classes()).toContain("custom_value");
182
+ await wrapper.setProps({ readonly: false });
183
+ expect(wrapper.get("ul.a_list_group").classes()).not.toContain("custom_value");
184
+ });
185
+
186
+ it("styles AValidatedJson values in single mode", () => {
187
+ const wrapper = mountReadonly(AValidatedJson, {
188
+ mode: "single",
189
+ children: [{ id: "value", type: "text" }],
190
+ modelValue: { value: "Hello" },
191
+ });
192
+ expect(wrapper.get(".a_form_element_readonly_value").classes()).toContain("custom_value");
193
+ });
194
+
195
+ it.each([ACheckboxItem, ARadioItem])("styles standalone readonly $name", async component => {
196
+ const wrapper = mountReadonly(component, { itemIndex: 0, dataItem: { label: "Value", value: 1 } });
197
+ expect(wrapper.classes()).toContain("custom_value");
198
+ await wrapper.setProps({ readonly: false });
199
+ expect(wrapper.find(".custom_value").exists()).toBe(false);
200
+ });
201
+
202
+ it.each([false, true])("shows file names without file input (multiple: %s)", isMultiple => {
203
+ const files = [{ name: "<first>.txt" }, { name: "second.txt" }];
204
+ const wrapper = mountReadonly(AInputFile, {
205
+ isMultiple,
206
+ modelValue: isMultiple ? files : files[0],
207
+ });
208
+ expect(wrapper.findAll("li").map(item => item.text())).toEqual(isMultiple ? ["<first>.txt", "second.txt"] : ["<first>.txt"]);
209
+ expect(wrapper.find("input[type=file]").exists()).toBe(false);
210
+ expect(wrapper.find("first").exists()).toBe(false);
211
+ });
212
+
213
+ it("shows readonlyDefault for an empty file value", () => {
214
+ const wrapper = mountReadonly(AInputFile, { readonlyDefault: "No files" });
215
+ expect(wrapper.get(".a_form_element_readonly_value").text()).toBe("No files");
216
+ });
217
+ });