aloha-vue 2.2.0 → 2.3.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/CHANGELOG.md +27 -0
- package/dist/aloha-vue.es.js +8684 -8581
- package/dist/aloha-vue.umd.js +62 -62
- package/package.json +2 -1
- package/src/AAlert/AAlert.js +20 -2
- package/src/AAlert/compositionAPI/AttributesAPI.js +30 -0
- package/src/ADropdown/ADropdown.js +15 -2
- package/src/ADropdown/compositionAPI/ToggleAPI.js +9 -0
- package/src/AModal/compositionAPI/EscapeAPI.js +27 -21
- package/src/compositionAPI/AHttpAPI.js +5 -1
- package/src/compositionAPI/APopupAPI.js +21 -3
- package/src/index.js +7 -0
- package/src/ui/ASelect/ASelect.js +15 -2
- package/src/ui/ASelect/compositionAPI/ToggleAPI.js +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aloha-vue",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Aloha-vue is a JavaScript library that provides a wide range of accessible components and directives for Vue.js. Accessibility is of paramount importance to us, and we have designed all our components to meet accessibility compliance criteria. This library is a valuable tool for frontend developers and has already been used in three projects, including two large-scale ones",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility compliance criteria",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"babel-plugin-module-resolver": "5.0.2",
|
|
77
77
|
"eslint": "^9.19.0",
|
|
78
78
|
"eslint-plugin-import": "^2.31.0",
|
|
79
|
+
"eslint-plugin-import-group": "^1.0.1",
|
|
79
80
|
"eslint-plugin-jest": "28.11.0",
|
|
80
81
|
"eslint-plugin-vue": "^9.32.0",
|
|
81
82
|
"eslint-plugin-vue-pug": "^0.6.2",
|
package/src/AAlert/AAlert.js
CHANGED
|
@@ -6,6 +6,7 @@ import AButton from "../AButton/AButton";
|
|
|
6
6
|
import AIcon from "../AIcon/AIcon";
|
|
7
7
|
import ATranslation from "../ATranslation/ATranslation";
|
|
8
8
|
|
|
9
|
+
import AttributesAPI from "./compositionAPI/AttributesAPI";
|
|
9
10
|
import ClassAPI from "./compositionAPI/ClassAPI";
|
|
10
11
|
import CloseAPI from "./compositionAPI/CloseAPI";
|
|
11
12
|
import IconAPI from "./compositionAPI/IconAPI";
|
|
@@ -31,6 +32,11 @@ export default {
|
|
|
31
32
|
type: Boolean,
|
|
32
33
|
required: false,
|
|
33
34
|
},
|
|
35
|
+
ariaAtomic: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
required: false,
|
|
38
|
+
default: true,
|
|
39
|
+
},
|
|
34
40
|
btnCloseAttributes: {
|
|
35
41
|
type: Object,
|
|
36
42
|
required: false,
|
|
@@ -71,6 +77,11 @@ export default {
|
|
|
71
77
|
required: false,
|
|
72
78
|
default: () => alertPluginOptions.value.propsDefault.removeAlertOnClose,
|
|
73
79
|
},
|
|
80
|
+
role: {
|
|
81
|
+
type: String,
|
|
82
|
+
required: false,
|
|
83
|
+
default: "alert",
|
|
84
|
+
},
|
|
74
85
|
safeHtml: {
|
|
75
86
|
type: String,
|
|
76
87
|
required: false,
|
|
@@ -118,6 +129,11 @@ export default {
|
|
|
118
129
|
iconLocal,
|
|
119
130
|
} = IconAPI(props);
|
|
120
131
|
|
|
132
|
+
const {
|
|
133
|
+
ariaAtomicLocal,
|
|
134
|
+
roleLocal,
|
|
135
|
+
} = AttributesAPI(props);
|
|
136
|
+
|
|
121
137
|
expose({
|
|
122
138
|
close,
|
|
123
139
|
isHidden,
|
|
@@ -125,9 +141,11 @@ export default {
|
|
|
125
141
|
|
|
126
142
|
return {
|
|
127
143
|
alertClassLocal,
|
|
144
|
+
ariaAtomicLocal,
|
|
128
145
|
close,
|
|
129
146
|
iconLocal,
|
|
130
147
|
isHidden,
|
|
148
|
+
roleLocal,
|
|
131
149
|
};
|
|
132
150
|
},
|
|
133
151
|
render() {
|
|
@@ -143,8 +161,8 @@ export default {
|
|
|
143
161
|
],
|
|
144
162
|
}, [
|
|
145
163
|
h("div", {
|
|
146
|
-
role:
|
|
147
|
-
ariaAtomic:
|
|
164
|
+
role: this.roleLocal,
|
|
165
|
+
ariaAtomic: this.ariaAtomicLocal,
|
|
148
166
|
}, [
|
|
149
167
|
this.isVisible && h("div", {
|
|
150
168
|
class: [this.alertClass, this.alertClassLocal],
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
toRef,
|
|
4
|
+
} from "vue";
|
|
5
|
+
|
|
6
|
+
export default function AttributesAPI(props) {
|
|
7
|
+
const ariaAtomic = toRef(props, "ariaAtomic");
|
|
8
|
+
const role = toRef(props, "role");
|
|
9
|
+
|
|
10
|
+
const ariaAtomicLocal = computed(() => {
|
|
11
|
+
if (ariaAtomic.value) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return undefined;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const roleLocal = computed(() => {
|
|
19
|
+
if (role.value) {
|
|
20
|
+
return role.value;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return undefined;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
ariaAtomicLocal,
|
|
28
|
+
roleLocal,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
h,
|
|
3
3
|
onBeforeUnmount,
|
|
4
|
-
Teleport,
|
|
4
|
+
Teleport, toRef,
|
|
5
5
|
withDirectives,
|
|
6
6
|
} from "vue";
|
|
7
7
|
|
|
@@ -12,6 +12,7 @@ import AIcon from "../AIcon/AIcon";
|
|
|
12
12
|
import AOnHooks from "../directives/AOnHooks";
|
|
13
13
|
|
|
14
14
|
import ActionsAPI from "./compositionAPI/ActionsAPI";
|
|
15
|
+
import APopupAPI from "../compositionAPI/APopupAPI";
|
|
15
16
|
import AttributesAPI from "./compositionAPI/AttributesAPI";
|
|
16
17
|
import ClassAPI from "./compositionAPI/ClassAPI";
|
|
17
18
|
import EventsAPI from "./compositionAPI/EventsAPI";
|
|
@@ -291,6 +292,13 @@ export default {
|
|
|
291
292
|
"close",
|
|
292
293
|
],
|
|
293
294
|
setup(props, context) {
|
|
295
|
+
const id = toRef(props, "id");
|
|
296
|
+
|
|
297
|
+
const {
|
|
298
|
+
closePopup,
|
|
299
|
+
openPopup,
|
|
300
|
+
} = APopupAPI();
|
|
301
|
+
|
|
294
302
|
const {
|
|
295
303
|
dropdownButtonRef,
|
|
296
304
|
dropdownRef,
|
|
@@ -324,9 +332,11 @@ export default {
|
|
|
324
332
|
triggerOpen,
|
|
325
333
|
wasOpened,
|
|
326
334
|
} = ToggleAPI(props, context, {
|
|
335
|
+
closePopup,
|
|
336
|
+
destroyPopover,
|
|
327
337
|
dropdownButtonRef,
|
|
328
338
|
dropdownRef,
|
|
329
|
-
|
|
339
|
+
openPopup,
|
|
330
340
|
setFocusToFirstElement,
|
|
331
341
|
startPopper,
|
|
332
342
|
});
|
|
@@ -376,6 +386,9 @@ export default {
|
|
|
376
386
|
destroyEventCloseClick();
|
|
377
387
|
destroyEventPressArrows();
|
|
378
388
|
destroyPopover();
|
|
389
|
+
closePopup({
|
|
390
|
+
id: id.value,
|
|
391
|
+
});
|
|
379
392
|
});
|
|
380
393
|
|
|
381
394
|
return {
|
|
@@ -15,15 +15,18 @@ import {
|
|
|
15
15
|
} from "lodash-es";
|
|
16
16
|
|
|
17
17
|
export default function ToggleAPI(props, { emit }, {
|
|
18
|
+
closePopup = () => {},
|
|
18
19
|
dropdownButtonRef = ref(undefined),
|
|
19
20
|
dropdownRef = ref(undefined),
|
|
20
21
|
destroyPopover = () => {},
|
|
22
|
+
openPopup = () => {},
|
|
21
23
|
setFocusToFirstElement = () => {},
|
|
22
24
|
startPopper = () => {},
|
|
23
25
|
}) {
|
|
24
26
|
const disabled = toRef(props, "disabled");
|
|
25
27
|
const dropdownRenderDefault = toRef(props, "dropdownRenderDefault");
|
|
26
28
|
const elementsForArrows = toRef(props, "elementsForArrows");
|
|
29
|
+
const id = toRef(props, "id");
|
|
27
30
|
const isCloseByClickInside = toRef(props, "isCloseByClickInside");
|
|
28
31
|
const isCloseByClickOutside = toRef(props, "isCloseByClickOutside");
|
|
29
32
|
const isListWidthSameWithButton = toRef(props, "isListWidthSameWithButton");
|
|
@@ -183,6 +186,9 @@ export default function ToggleAPI(props, { emit }, {
|
|
|
183
186
|
});
|
|
184
187
|
}
|
|
185
188
|
openDropdownGlobal();
|
|
189
|
+
openPopup({
|
|
190
|
+
id: id.value,
|
|
191
|
+
});
|
|
186
192
|
emit("open");
|
|
187
193
|
});
|
|
188
194
|
};
|
|
@@ -227,6 +233,9 @@ export default function ToggleAPI(props, { emit }, {
|
|
|
227
233
|
setFocusToButton();
|
|
228
234
|
}
|
|
229
235
|
triggerOpen.value = undefined;
|
|
236
|
+
closePopup({
|
|
237
|
+
id: id.value,
|
|
238
|
+
});
|
|
230
239
|
emit("close");
|
|
231
240
|
}
|
|
232
241
|
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
toRef,
|
|
3
|
-
} from "vue";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import {
|
|
2
|
+
toRef,
|
|
3
|
+
} from "vue";
|
|
4
|
+
|
|
5
|
+
import APopupAPI from "../../compositionAPI/APopupAPI";
|
|
6
|
+
|
|
7
|
+
export default function EscapeAPI(props) {
|
|
8
|
+
const close = toRef(props, "close");
|
|
9
|
+
const useEscape = toRef(props, "useEscape");
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
isOnePopupOpen,
|
|
13
|
+
} = APopupAPI();
|
|
14
|
+
|
|
15
|
+
const pressEscape = $event => {
|
|
16
|
+
if (!useEscape.value || isOnePopupOpen.value) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
close.value();
|
|
20
|
+
$event.preventDefault();
|
|
21
|
+
$event.stopPropagation();
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
pressEscape,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -402,7 +402,11 @@ export function callHttpRequestAndCheckSavedApi({
|
|
|
402
402
|
if (error?.code === "ERR_CANCELED") { // workaround. we'll remake this in v2.0.0
|
|
403
403
|
return reject(error);
|
|
404
404
|
}
|
|
405
|
-
if (ignoreErrorHandler
|
|
405
|
+
if (isFunction(ignoreErrorHandler)) {
|
|
406
|
+
if (ignoreErrorHandler({ error: error.response, showError, client: API })) {
|
|
407
|
+
return reject(error.response);
|
|
408
|
+
}
|
|
409
|
+
} else if (ignoreErrorHandler || checkErrorStatus({ error: error.response, showError, client: API, reject, resolve })) {
|
|
406
410
|
return reject(error.response);
|
|
407
411
|
}
|
|
408
412
|
},
|
|
@@ -4,12 +4,14 @@ import {
|
|
|
4
4
|
} from "vue";
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
+
forEach,
|
|
8
|
+
isEmpty,
|
|
7
9
|
isUndefined,
|
|
8
10
|
} from "lodash-es";
|
|
9
11
|
|
|
10
12
|
const popupOpenIds = ref({});
|
|
11
13
|
|
|
12
|
-
export default function APopupAPI({ id, idRef }) {
|
|
14
|
+
export default function APopupAPI({ id, idRef } = {}) {
|
|
13
15
|
const isPopupOpen = computed(() => {
|
|
14
16
|
if (idRef) {
|
|
15
17
|
return isCurrentPopupOpen({ id: idRef.value });
|
|
@@ -17,9 +19,25 @@ export default function APopupAPI({ id, idRef }) {
|
|
|
17
19
|
return isCurrentPopupOpen({ id });
|
|
18
20
|
});
|
|
19
21
|
|
|
22
|
+
const isOnePopupOpen = computed(() => {
|
|
23
|
+
let isOneOpen = false;
|
|
24
|
+
if (isEmpty(popupOpenIds.value)) {
|
|
25
|
+
return isOneOpen;
|
|
26
|
+
}
|
|
27
|
+
forEach(popupOpenIds.value, _isOpen => {
|
|
28
|
+
if (_isOpen) {
|
|
29
|
+
isOneOpen = true;
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return isOneOpen;
|
|
35
|
+
});
|
|
36
|
+
|
|
20
37
|
return {
|
|
21
38
|
closePopup,
|
|
22
39
|
isCurrentPopupOpen,
|
|
40
|
+
isOnePopupOpen,
|
|
23
41
|
isPopupOpen,
|
|
24
42
|
openPopup,
|
|
25
43
|
popupOpenIds,
|
|
@@ -31,11 +49,11 @@ export function isCurrentPopupOpen({ id }) {
|
|
|
31
49
|
return !!popupOpenIds.value[id];
|
|
32
50
|
}
|
|
33
51
|
|
|
34
|
-
function openPopup({ id }) {
|
|
52
|
+
export function openPopup({ id }) {
|
|
35
53
|
popupOpenIds.value[id] = true;
|
|
36
54
|
}
|
|
37
55
|
|
|
38
|
-
function closePopup({ id }) {
|
|
56
|
+
export function closePopup({ id }) {
|
|
39
57
|
if (id in popupOpenIds.value) {
|
|
40
58
|
delete popupOpenIds.value[id];
|
|
41
59
|
}
|
package/src/index.js
CHANGED
|
@@ -107,6 +107,13 @@ export {
|
|
|
107
107
|
default as APageTabTitleAPI,
|
|
108
108
|
setBaseTitle as APageTabTitleAPI_setBaseTitle,
|
|
109
109
|
} from "./compositionAPI/APageTabTitleAPI";
|
|
110
|
+
export {
|
|
111
|
+
default as APopupAPI,
|
|
112
|
+
closePopup as APopupAPI_closePopup,
|
|
113
|
+
isCurrentPopupOpen as APopupAPI_isCurrentPopupOpen,
|
|
114
|
+
openPopup as APopupAPI_openPopup,
|
|
115
|
+
togglePopup as APopupAPI_togglePopup,
|
|
116
|
+
} from "./compositionAPI/APopupAPI";
|
|
110
117
|
export { default as UiAPI } from "./ui/compositionApi/UiAPI";
|
|
111
118
|
export { default as UIExcludeRenderAttributesAPI } from "./ui/compositionApi/UIExcludeRenderAttributesAPI";
|
|
112
119
|
export { default as UiStyleHideAPI } from "./ui/compositionApi/UiStyleHideAPI";
|
|
@@ -18,6 +18,7 @@ import ASelectLabelElement from "./ASelectLabelElement";
|
|
|
18
18
|
import ASelectValueCloseable from "./ASelectValueCloseable";
|
|
19
19
|
import ATranslation from "../../ATranslation/ATranslation";
|
|
20
20
|
|
|
21
|
+
import APopupAPI from "../../compositionAPI/APopupAPI";
|
|
21
22
|
import AttributesAPI from "./compositionAPI/AttributesAPI";
|
|
22
23
|
import DisabledAPI from "./compositionAPI/DisabledAPI";
|
|
23
24
|
import DividerAPI from "./compositionAPI/DividerAPI";
|
|
@@ -460,6 +461,11 @@ export default {
|
|
|
460
461
|
onFocus,
|
|
461
462
|
} = UiAPI(props, context);
|
|
462
463
|
|
|
464
|
+
const {
|
|
465
|
+
closePopup,
|
|
466
|
+
openPopup,
|
|
467
|
+
} = APopupAPI();
|
|
468
|
+
|
|
463
469
|
const {
|
|
464
470
|
dataAll,
|
|
465
471
|
dataFromServer,
|
|
@@ -585,8 +591,12 @@ export default {
|
|
|
585
591
|
menuParentRef,
|
|
586
592
|
menuRef,
|
|
587
593
|
togglePopover,
|
|
588
|
-
} = ToggleAPI(props, context
|
|
589
|
-
|
|
594
|
+
} = ToggleAPI(props, context, {
|
|
595
|
+
closePopup,
|
|
596
|
+
htmlIdLocal,
|
|
597
|
+
openPopup,
|
|
598
|
+
});
|
|
599
|
+
|
|
590
600
|
const {
|
|
591
601
|
deleteExceededItems,
|
|
592
602
|
onChangeModelValue,
|
|
@@ -640,6 +650,9 @@ export default {
|
|
|
640
650
|
|
|
641
651
|
onBeforeUnmount(() => {
|
|
642
652
|
destroyEventBusClickLabel();
|
|
653
|
+
closePopup({
|
|
654
|
+
id: htmlIdLocal.value,
|
|
655
|
+
});
|
|
643
656
|
});
|
|
644
657
|
|
|
645
658
|
return {
|
|
@@ -25,6 +25,10 @@ const ELEMENTS_FOR_ARROWS = ".a_select__element_clickable:not([disabled]):not([d
|
|
|
25
25
|
|
|
26
26
|
export default function ToggleAPI(props, {
|
|
27
27
|
emit,
|
|
28
|
+
}, {
|
|
29
|
+
closePopup = () => {},
|
|
30
|
+
htmlIdLocal = computed(() => ""),
|
|
31
|
+
openPopup = () => {},
|
|
28
32
|
}) {
|
|
29
33
|
const disabled = toRef(props, "disabled");
|
|
30
34
|
const menuWidthType = toRef(props, "menuWidthType");
|
|
@@ -113,6 +117,9 @@ export default function ToggleAPI(props, {
|
|
|
113
117
|
};
|
|
114
118
|
|
|
115
119
|
const onOpen = () => {
|
|
120
|
+
openPopup({
|
|
121
|
+
id: htmlIdLocal.value,
|
|
122
|
+
});
|
|
116
123
|
emit("open");
|
|
117
124
|
};
|
|
118
125
|
|
|
@@ -228,6 +235,9 @@ export default function ToggleAPI(props, {
|
|
|
228
235
|
destroyPopover();
|
|
229
236
|
destroyEventClickOutside();
|
|
230
237
|
destroyEventPressArrows();
|
|
238
|
+
closePopup({
|
|
239
|
+
id: htmlIdLocal.value,
|
|
240
|
+
});
|
|
231
241
|
}
|
|
232
242
|
|
|
233
243
|
onBeforeUnmount(() => destroyEventPressArrows());
|