aloha-vue 1.6.0 → 1.8.0

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 CHANGED
@@ -7,6 +7,14 @@
7
7
  ---
8
8
  # Versions
9
9
 
10
+ ## 1.8.0
11
+
12
+ - `AModal`: don't close modal if popup opened
13
+
14
+ ## 1.7.0
15
+
16
+ - `AAlert`: new props ariaAtomic and role
17
+
10
18
  ## 1.6.0
11
19
 
12
20
  - `AHttpAPI`: ignoreErrorHandler as function
@@ -21,6 +21,13 @@ export default function PropsAPI() {
21
21
  default: undefined,
22
22
  required: false,
23
23
  },
24
+ {
25
+ name: "aria-atomic",
26
+ description: "_A_ALERT_PROPS_ARIA_ATOMIC_DESCRIPTION_",
27
+ type: "Boolean",
28
+ default: true,
29
+ required: false,
30
+ },
24
31
  {
25
32
  name: "btn-close-attributes",
26
33
  description: "_A_ALERT_PROPS_BTN_CLOSE_ATTRIBUTES_DESCRIPTION_",
@@ -77,6 +84,13 @@ export default function PropsAPI() {
77
84
  default: false,
78
85
  required: false,
79
86
  },
87
+ {
88
+ name: "role",
89
+ description: "_A_ALERT_PROPS_ROLE_DESCRIPTION_",
90
+ type: "String",
91
+ default: "alert",
92
+ required: false,
93
+ },
80
94
  {
81
95
  name: "safe-html",
82
96
  description: "_A_ALERT_PROPS_SAFE_HTML_DESCRIPTION_",
@@ -1,4 +1,6 @@
1
1
  {
2
+ "_A_ALERT_PROPS_ARIA_ATOMIC_DESCRIPTION_": "",
3
+ "_A_ALERT_PROPS_ROLE_DESCRIPTION_": "",
2
4
  "_A_ALERT_COMPONENT_DESCRIPTION_": "يعرض رسائل تنبيه مهمة.",
3
5
  "_A_ALERT_COMPONENT_NAME_": "تنبيه",
4
6
  "_A_ALERT_EVENTS_CLOSE_DESCRIPTION_": "يتم إصداره عند إغلاق التنبيه.",
@@ -1,4 +1,6 @@
1
1
  {
2
+ "_A_ALERT_PROPS_ARIA_ATOMIC_DESCRIPTION_": "",
3
+ "_A_ALERT_PROPS_ROLE_DESCRIPTION_": "",
2
4
  "_A_ALERT_COMPONENT_DESCRIPTION_": "Zeigt wichtige Warnmeldungen an.",
3
5
  "_A_ALERT_COMPONENT_NAME_": "Warnung",
4
6
  "_A_ALERT_EVENTS_CLOSE_DESCRIPTION_": "Auslösen, wenn die Warnung geschlossen ist",
@@ -1,4 +1,6 @@
1
1
  {
2
+ "_A_ALERT_PROPS_ARIA_ATOMIC_DESCRIPTION_": "",
3
+ "_A_ALERT_PROPS_ROLE_DESCRIPTION_": "",
2
4
  "_A_ALERT_COMPONENT_DESCRIPTION_": "Displays important alert messages.",
3
5
  "_A_ALERT_COMPONENT_NAME_": "warning",
4
6
  "_A_ALERT_EVENTS_CLOSE_DESCRIPTION_": "Trigger when alert is closed",
@@ -1,4 +1,6 @@
1
1
  {
2
+ "_A_ALERT_PROPS_ARIA_ATOMIC_DESCRIPTION_": "",
3
+ "_A_ALERT_PROPS_ROLE_DESCRIPTION_": "",
2
4
  "_A_ALERT_COMPONENT_DESCRIPTION_": "Muestra mensajes de alerta importantes.",
3
5
  "_A_ALERT_COMPONENT_NAME_": "advertencia",
4
6
  "_A_ALERT_EVENTS_CLOSE_DESCRIPTION_": "Se desencadena cuando se cierra la alerta.",
@@ -1,4 +1,6 @@
1
1
  {
2
+ "_A_ALERT_PROPS_ARIA_ATOMIC_DESCRIPTION_": "",
3
+ "_A_ALERT_PROPS_ROLE_DESCRIPTION_": "",
2
4
  "_A_ALERT_COMPONENT_DESCRIPTION_": "Affiche des messages d'alerte importants.",
3
5
  "_A_ALERT_COMPONENT_NAME_": "avertissement",
4
6
  "_A_ALERT_EVENTS_CLOSE_DESCRIPTION_": "Déclenché lorsque l'alerte est fermée.",
@@ -1,4 +1,6 @@
1
1
  {
2
+ "_A_ALERT_PROPS_ARIA_ATOMIC_DESCRIPTION_": "",
3
+ "_A_ALERT_PROPS_ROLE_DESCRIPTION_": "",
2
4
  "_A_ALERT_COMPONENT_DESCRIPTION_": "Komponenta koja služi za prikaz važnih upozorenja.",
3
5
  "_A_ALERT_COMPONENT_NAME_": "Upozorenje",
4
6
  "_A_ALERT_EVENTS_CLOSE_DESCRIPTION_": "Aktivira se zatvaranjem upozorenja.",
@@ -1,4 +1,6 @@
1
1
  {
2
+ "_A_ALERT_PROPS_ARIA_ATOMIC_DESCRIPTION_": "",
3
+ "_A_ALERT_PROPS_ROLE_DESCRIPTION_": "",
2
4
  "_A_ALERT_COMPONENT_DESCRIPTION_": "Visualizza messaggi di avviso importanti.",
3
5
  "_A_ALERT_COMPONENT_NAME_": "avviso",
4
6
  "_A_ALERT_EVENTS_CLOSE_DESCRIPTION_": "Emesso quando l'avviso viene chiuso.",
@@ -1,4 +1,6 @@
1
1
  {
2
+ "_A_ALERT_PROPS_ARIA_ATOMIC_DESCRIPTION_": "",
3
+ "_A_ALERT_PROPS_ROLE_DESCRIPTION_": "",
2
4
  "_A_ALERT_COMPONENT_DESCRIPTION_": "Отображает важные предупреждающие сообщения.",
3
5
  "_A_ALERT_COMPONENT_NAME_": "Оповещение",
4
6
  "_A_ALERT_EVENTS_CLOSE_DESCRIPTION_": "Триггер, когда оповещение закрыто",
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "Vue.js"
15
15
  ],
16
16
  "homepage": "https://github.com/ilia-brykin/aloha/#README.md",
17
- "version": "1.6.0",
17
+ "version": "1.8.0",
18
18
  "author": {
19
19
  "name": "Ilia Brykin",
20
20
  "email": "brykin.ilia@gmail.com"
@@ -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
  required: false,
32
33
  default: () => alertPluginOptions.value.propsDefault.alertContentClass,
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: "alert",
147
- ariaAtomic: true,
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";
@@ -287,6 +288,13 @@ export default {
287
288
  "close",
288
289
  ],
289
290
  setup(props, context) {
291
+ const id = toRef(props, "id");
292
+
293
+ const {
294
+ closePopup,
295
+ openPopup,
296
+ } = APopupAPI();
297
+
290
298
  const {
291
299
  dropdownButtonRef,
292
300
  dropdownRef,
@@ -319,9 +327,11 @@ export default {
319
327
  triggerOpen,
320
328
  wasOpened,
321
329
  } = ToggleAPI(props, context, {
330
+ closePopup,
331
+ destroyPopover,
322
332
  dropdownButtonRef,
323
333
  dropdownRef,
324
- destroyPopover,
334
+ openPopup,
325
335
  setFocusToFirstElement,
326
336
  startPopper,
327
337
  });
@@ -370,6 +380,9 @@ export default {
370
380
  destroyEventCloseClick();
371
381
  destroyEventPressArrows();
372
382
  destroyPopover();
383
+ closePopup({
384
+ id: id.value,
385
+ });
373
386
  });
374
387
 
375
388
  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");
@@ -181,6 +184,9 @@ export default function ToggleAPI(props, { emit }, {
181
184
  });
182
185
  }
183
186
  openDropdownGlobal();
187
+ openPopup({
188
+ id: id.value,
189
+ });
184
190
  emit("open");
185
191
  });
186
192
  };
@@ -225,6 +231,9 @@ export default function ToggleAPI(props, { emit }, {
225
231
  setFocusToButton();
226
232
  }
227
233
  triggerOpen.value = undefined;
234
+ closePopup({
235
+ id: id.value,
236
+ });
228
237
  emit("close");
229
238
  }
230
239
 
@@ -2,12 +2,18 @@ import {
2
2
  toRef,
3
3
  } from "vue";
4
4
 
5
+ import APopupAPI from "../../compositionAPI/APopupAPI";
6
+
5
7
  export default function EscapeAPI(props) {
6
8
  const close = toRef(props, "close");
7
9
  const useEscape = toRef(props, "useEscape");
8
10
 
11
+ const {
12
+ isOnePopupOpen,
13
+ } = APopupAPI();
14
+
9
15
  const pressEscape = $event => {
10
- if (!useEscape.value) {
16
+ if (!useEscape.value || isOnePopupOpen.value) {
11
17
  return;
12
18
  }
13
19
  close.value();
@@ -4,22 +4,40 @@ 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 });
16
18
  }
17
19
  return isCurrentPopupOpen({ id });
18
20
  });
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
+ });
19
36
 
20
37
  return {
21
38
  closePopup,
22
39
  isCurrentPopupOpen,
40
+ isOnePopupOpen,
23
41
  isPopupOpen,
24
42
  openPopup,
25
43
  popupOpenIds,
@@ -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";
@@ -461,6 +462,11 @@ export default {
461
462
  onFocus,
462
463
  } = UiAPI(props, context);
463
464
 
465
+ const {
466
+ closePopup,
467
+ openPopup,
468
+ } = APopupAPI();
469
+
464
470
  const {
465
471
  dataAll,
466
472
  dataFromServer,
@@ -586,7 +592,11 @@ export default {
586
592
  menuParentRef,
587
593
  menuRef,
588
594
  togglePopover,
589
- } = ToggleAPI(props, context);
595
+ } = ToggleAPI(props, context, {
596
+ closePopup,
597
+ htmlIdLocal,
598
+ openPopup,
599
+ });
590
600
 
591
601
  const {
592
602
  deleteExceededItems,
@@ -641,6 +651,9 @@ export default {
641
651
 
642
652
  onBeforeUnmount(() => {
643
653
  destroyEventBusClickLabel();
654
+ closePopup({
655
+ id: htmlIdLocal.value,
656
+ });
644
657
  });
645
658
 
646
659
  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");
@@ -115,6 +119,9 @@ export default function ToggleAPI(props, {
115
119
  };
116
120
 
117
121
  const onOpen = () => {
122
+ openPopup({
123
+ id: htmlIdLocal.value,
124
+ });
118
125
  emit("open");
119
126
  };
120
127
 
@@ -230,6 +237,9 @@ export default function ToggleAPI(props, {
230
237
  destroyPopover();
231
238
  destroyEventClickOutside();
232
239
  destroyEventPressArrows();
240
+ closePopup({
241
+ id: htmlIdLocal.value,
242
+ });
233
243
  }
234
244
 
235
245
  onBeforeUnmount(() => destroyEventPressArrows());