aloha-vue 1.0.342 → 1.0.344
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/package.json +1 -1
- package/src/AButton/AButton.js +7 -1
- package/src/ADropdown/ADropdown.js +9 -2
- package/src/ADropdown/compositionAPI/AttributesAPI.js +3 -1
- package/src/ADropdown/compositionAPI/ToggleAPI.js +11 -2
- package/src/ALink/ALink.js +12 -1
- package/src/ATranslation/ATranslation.js +16 -18
- package/src/ATranslation/compositionAPI/AriaLabelAPI.js +18 -7
- package/src/ATranslation/compositionAPI/AttributesAPI.js +0 -20
- package/src/ATranslation/compositionAPI/PlaceholderAPI.js +18 -7
package/package.json
CHANGED
package/src/AButton/AButton.js
CHANGED
|
@@ -6,6 +6,7 @@ import AIcon from "../AIcon/AIcon";
|
|
|
6
6
|
import ASpinner from "../ASpinner/ASpinner";
|
|
7
7
|
import ATranslation from "../ATranslation/ATranslation";
|
|
8
8
|
|
|
9
|
+
import AriaLabelAPI from "../ATranslation/compositionAPI/AriaLabelAPI";
|
|
9
10
|
import ClickAPI from "./comositionAPI/ClickAPI";
|
|
10
11
|
import ComponentLocalAPI from "./comositionAPI/ComponentLocalAPI";
|
|
11
12
|
import HtmlTitleAPI from "./comositionAPI/HtmlTitleAPI";
|
|
@@ -222,7 +223,12 @@ export default {
|
|
|
222
223
|
htmlTitleAttributes,
|
|
223
224
|
} = HtmlTitleAPI(props);
|
|
224
225
|
|
|
226
|
+
const {
|
|
227
|
+
ariaLabelAttributes,
|
|
228
|
+
} = AriaLabelAPI(props);
|
|
229
|
+
|
|
225
230
|
return {
|
|
231
|
+
ariaLabelAttributes,
|
|
226
232
|
buttonRef,
|
|
227
233
|
componentLocal,
|
|
228
234
|
htmlTitleAttributes,
|
|
@@ -239,6 +245,7 @@ export default {
|
|
|
239
245
|
...this.$attrs,
|
|
240
246
|
...this.attributes,
|
|
241
247
|
...this.htmlTitleAttributes,
|
|
248
|
+
...this.ariaLabelAttributes,
|
|
242
249
|
ref: "buttonRef",
|
|
243
250
|
id: this.id,
|
|
244
251
|
class: [
|
|
@@ -291,7 +298,6 @@ export default {
|
|
|
291
298
|
this.$slots.default && this.$slots.default(),
|
|
292
299
|
this.isTextOrHtmlVisible && h(ATranslation, {
|
|
293
300
|
ariaHidden: this.textAriaHidden,
|
|
294
|
-
ariaLabel: this.ariaLabel,
|
|
295
301
|
class: this.textClass,
|
|
296
302
|
extra: this.extra,
|
|
297
303
|
html: this.html,
|
|
@@ -184,6 +184,7 @@ export default {
|
|
|
184
184
|
inBody: {
|
|
185
185
|
type: Boolean,
|
|
186
186
|
required: false,
|
|
187
|
+
default: true,
|
|
187
188
|
},
|
|
188
189
|
isCaret: {
|
|
189
190
|
type: Boolean,
|
|
@@ -204,6 +205,11 @@ export default {
|
|
|
204
205
|
required: false,
|
|
205
206
|
default: undefined,
|
|
206
207
|
},
|
|
208
|
+
persist: {
|
|
209
|
+
type: Boolean,
|
|
210
|
+
required: false,
|
|
211
|
+
default: true,
|
|
212
|
+
},
|
|
207
213
|
placement: {
|
|
208
214
|
type: String,
|
|
209
215
|
required: false,
|
|
@@ -248,11 +254,13 @@ export default {
|
|
|
248
254
|
onKeydown,
|
|
249
255
|
onToggle,
|
|
250
256
|
statusExpanded,
|
|
257
|
+
wasOpened,
|
|
251
258
|
} = ToggleAPI(props, {
|
|
252
259
|
dropdownButtonRef,
|
|
253
260
|
dropdownRef,
|
|
254
261
|
destroyPopover,
|
|
255
262
|
setFocusToFirstElement,
|
|
263
|
+
startPopper,
|
|
256
264
|
});
|
|
257
265
|
|
|
258
266
|
const {
|
|
@@ -263,8 +271,7 @@ export default {
|
|
|
263
271
|
isMenuRendered,
|
|
264
272
|
} = AttributesAPI(props, {
|
|
265
273
|
statusExpanded,
|
|
266
|
-
|
|
267
|
-
onKeydown,
|
|
274
|
+
wasOpened,
|
|
268
275
|
});
|
|
269
276
|
|
|
270
277
|
const {
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
export default function AttributesAPI(props, {
|
|
12
12
|
statusExpanded = ref(false),
|
|
13
|
+
wasOpened = ref(false),
|
|
13
14
|
}) {
|
|
14
15
|
const buttonAttributes = toRef(props, "buttonAttributes");
|
|
15
16
|
const buttonTag = toRef(props, "buttonTag");
|
|
@@ -18,6 +19,7 @@ export default function AttributesAPI(props, {
|
|
|
18
19
|
const dropdownClass = toRef(props, "dropdownClass");
|
|
19
20
|
const id = toRef(props, "id");
|
|
20
21
|
const menuWidth = toRef(props, "menuWidth");
|
|
22
|
+
const persist = toRef(props, "persist");
|
|
21
23
|
|
|
22
24
|
const idLocal = computed(() => {
|
|
23
25
|
return buttonAttributes.value.id || id.value;
|
|
@@ -60,7 +62,7 @@ export default function AttributesAPI(props, {
|
|
|
60
62
|
});
|
|
61
63
|
|
|
62
64
|
const isMenuRendered = computed(() => {
|
|
63
|
-
return statusExpanded.value;
|
|
65
|
+
return statusExpanded.value || (persist.value && wasOpened.value);
|
|
64
66
|
});
|
|
65
67
|
|
|
66
68
|
return {
|
|
@@ -15,15 +15,18 @@ export default function ToggleAPI(props, {
|
|
|
15
15
|
dropdownRef = ref(undefined),
|
|
16
16
|
destroyPopover = () => {},
|
|
17
17
|
setFocusToFirstElement = () => {},
|
|
18
|
+
startPopper = () => {},
|
|
18
19
|
}) {
|
|
19
20
|
const disabled = toRef(props, "disabled");
|
|
21
|
+
const elementsForArrows = toRef(props, "elementsForArrows");
|
|
20
22
|
const isCloseByClickInside = toRef(props, "isCloseByClickInside");
|
|
21
23
|
const isListWidthSameWithButton = toRef(props, "isListWidthSameWithButton");
|
|
22
|
-
const
|
|
24
|
+
const persist = toRef(props, "persist");
|
|
23
25
|
|
|
24
|
-
const statusExpanded = ref(false);
|
|
25
26
|
const buttonWidth = ref(undefined);
|
|
26
27
|
const statusEventPressArrows = ref(false);
|
|
28
|
+
const statusExpanded = ref(false);
|
|
29
|
+
const wasOpened = ref(false);
|
|
27
30
|
|
|
28
31
|
const {
|
|
29
32
|
closeDropdownGlobal,
|
|
@@ -109,6 +112,11 @@ export default function ToggleAPI(props, {
|
|
|
109
112
|
setButtonWidth();
|
|
110
113
|
initEventPressArrows();
|
|
111
114
|
statusExpanded.value = true;
|
|
115
|
+
if (persist.value &&
|
|
116
|
+
wasOpened.value) {
|
|
117
|
+
startPopper();
|
|
118
|
+
}
|
|
119
|
+
wasOpened.value = true;
|
|
112
120
|
setTimeout(() => {
|
|
113
121
|
setEventCloseClick();
|
|
114
122
|
setTimeout(() => {
|
|
@@ -166,5 +174,6 @@ export default function ToggleAPI(props, {
|
|
|
166
174
|
onKeydown,
|
|
167
175
|
onToggle,
|
|
168
176
|
statusExpanded,
|
|
177
|
+
wasOpened,
|
|
169
178
|
};
|
|
170
179
|
}
|
package/src/ALink/ALink.js
CHANGED
|
@@ -6,6 +6,7 @@ import AIcon from "../AIcon/AIcon";
|
|
|
6
6
|
import ASpinner from "../ASpinner/ASpinner";
|
|
7
7
|
import ATranslation from "../ATranslation/ATranslation";
|
|
8
8
|
|
|
9
|
+
import AriaLabelAPI from "../ATranslation/compositionAPI/AriaLabelAPI";
|
|
9
10
|
import ComponentLocalAPI from "./compositionAPI/ComponentLocalAPI";
|
|
10
11
|
import HtmlTitleAPI from "./compositionAPI/HtmlTitleAPI";
|
|
11
12
|
import LoadingAPI from "../AButton/comositionAPI/LoadingAPI";
|
|
@@ -22,6 +23,11 @@ export default {
|
|
|
22
23
|
name: "ALink",
|
|
23
24
|
inheritAttrs: false,
|
|
24
25
|
props: {
|
|
26
|
+
ariaLabel: {
|
|
27
|
+
type: [String, Number, Object],
|
|
28
|
+
required: false,
|
|
29
|
+
default: undefined,
|
|
30
|
+
},
|
|
25
31
|
attributes: {
|
|
26
32
|
type: Object,
|
|
27
33
|
required: false,
|
|
@@ -203,7 +209,12 @@ export default {
|
|
|
203
209
|
isRouterLink,
|
|
204
210
|
});
|
|
205
211
|
|
|
212
|
+
const {
|
|
213
|
+
ariaLabelAttributes,
|
|
214
|
+
} = AriaLabelAPI(props);
|
|
215
|
+
|
|
206
216
|
return {
|
|
217
|
+
ariaLabelAttributes,
|
|
207
218
|
componentLocal,
|
|
208
219
|
isLoadingLeft,
|
|
209
220
|
htmlTitleAttributes,
|
|
@@ -220,6 +231,7 @@ export default {
|
|
|
220
231
|
...this.attributes,
|
|
221
232
|
...this.htmlTitleAttributes,
|
|
222
233
|
...this.toHrefAttributes,
|
|
234
|
+
...this.ariaLabelAttributes,
|
|
223
235
|
id: this.id,
|
|
224
236
|
target: this.target,
|
|
225
237
|
class: [
|
|
@@ -266,7 +278,6 @@ export default {
|
|
|
266
278
|
this.$slots.default && this.$slots.default(),
|
|
267
279
|
this.isTextOrHtmlVisible && h(ATranslation, {
|
|
268
280
|
ariaHidden: this.textAriaHidden,
|
|
269
|
-
ariaLabel: this.ariaLabel,
|
|
270
281
|
class: this.textClass,
|
|
271
282
|
extra: this.extra,
|
|
272
283
|
html: this.html,
|
|
@@ -109,19 +109,13 @@ export default {
|
|
|
109
109
|
});
|
|
110
110
|
|
|
111
111
|
const {
|
|
112
|
-
|
|
113
|
-
isTranslatePlaceholder,
|
|
114
|
-
placeholderForCurrentDevice,
|
|
115
|
-
placeholderLocal,
|
|
112
|
+
placeholderAttributes,
|
|
116
113
|
} = PlaceholderAPI(props, {
|
|
117
114
|
translation,
|
|
118
115
|
});
|
|
119
116
|
|
|
120
117
|
const {
|
|
121
|
-
|
|
122
|
-
ariaLabelLocal,
|
|
123
|
-
hasAriaLabel,
|
|
124
|
-
isTranslateAriaLabel,
|
|
118
|
+
ariaLabelAttributes,
|
|
125
119
|
} = AriaLabelAPI(props, {
|
|
126
120
|
translation,
|
|
127
121
|
});
|
|
@@ -129,24 +123,17 @@ export default {
|
|
|
129
123
|
const {
|
|
130
124
|
attributesLocal,
|
|
131
125
|
} = AttributesAPI({
|
|
132
|
-
ariaLabelForCurrentDevice,
|
|
133
|
-
ariaLabelLocal,
|
|
134
|
-
hasAriaLabel,
|
|
135
|
-
hasPlaceholder,
|
|
136
126
|
htmlForCurrentDevice,
|
|
137
|
-
isTranslateAriaLabel,
|
|
138
127
|
isTranslateHtml,
|
|
139
|
-
isTranslatePlaceholder,
|
|
140
128
|
isTranslateSafeHtml,
|
|
141
129
|
isTranslateText,
|
|
142
|
-
placeholderForCurrentDevice,
|
|
143
|
-
placeholderLocal,
|
|
144
130
|
safeHtmlForCurrentDevice,
|
|
145
131
|
textForCurrentDevice,
|
|
146
132
|
titleLocalOptions,
|
|
147
133
|
});
|
|
148
134
|
|
|
149
135
|
return {
|
|
136
|
+
ariaLabelAttributes,
|
|
150
137
|
attributesLocal,
|
|
151
138
|
hasText,
|
|
152
139
|
hasTextAfter,
|
|
@@ -154,6 +141,7 @@ export default {
|
|
|
154
141
|
hasHtml,
|
|
155
142
|
hasSafeHtml,
|
|
156
143
|
htmlLocalWithBeforeAndAfter,
|
|
144
|
+
placeholderAttributes,
|
|
157
145
|
textAfterForCurrentDevice,
|
|
158
146
|
textBeforeForCurrentDevice,
|
|
159
147
|
textLocal,
|
|
@@ -162,7 +150,11 @@ export default {
|
|
|
162
150
|
},
|
|
163
151
|
render() {
|
|
164
152
|
if (this.hasText) {
|
|
165
|
-
return h(this.tag,
|
|
153
|
+
return h(this.tag, {
|
|
154
|
+
...this.attributesLocal,
|
|
155
|
+
...this.ariaLabelAttributes,
|
|
156
|
+
...this.placeholderAttributes,
|
|
157
|
+
}, [
|
|
166
158
|
this.textBeforeForCurrentDevice,
|
|
167
159
|
this.textLocal,
|
|
168
160
|
this.$slots.default && this.$slots.default(),
|
|
@@ -173,11 +165,17 @@ export default {
|
|
|
173
165
|
if (this.hasSafeHtml || this.hasHtml) {
|
|
174
166
|
return h(this.tag, {
|
|
175
167
|
...this.attributesLocal,
|
|
168
|
+
...this.ariaLabelAttributes,
|
|
169
|
+
...this.placeholderAttributes,
|
|
176
170
|
innerHTML: this.htmlLocalWithBeforeAndAfter,
|
|
177
171
|
});
|
|
178
172
|
}
|
|
179
173
|
|
|
180
|
-
return h(this.tag,
|
|
174
|
+
return h(this.tag, {
|
|
175
|
+
...this.attributesLocal,
|
|
176
|
+
...this.ariaLabelAttributes,
|
|
177
|
+
...this.placeholderAttributes,
|
|
178
|
+
}, [
|
|
181
179
|
this.textBeforeForCurrentDevice,
|
|
182
180
|
this.$slots.default && this.$slots.default(),
|
|
183
181
|
this.textAfterForCurrentDevice,
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
} from "vue";
|
|
5
5
|
|
|
6
6
|
import AMobileAPI from "../../compositionAPI/AMobileAPI";
|
|
7
|
+
import ATranslationAPI from "./ATranslationAPI";
|
|
7
8
|
import UtilsAPI from "./UtilsAPI";
|
|
8
9
|
|
|
9
10
|
import {
|
|
@@ -11,12 +12,14 @@ import {
|
|
|
11
12
|
isUndefined,
|
|
12
13
|
} from "lodash-es";
|
|
13
14
|
|
|
14
|
-
export default function AriaLabelAPI(props
|
|
15
|
-
translation = computed(() => ({})),
|
|
16
|
-
}) {
|
|
15
|
+
export default function AriaLabelAPI(props) {
|
|
17
16
|
const ariaLabel = toRef(props, "ariaLabel");
|
|
18
17
|
const extra = toRef(props, "extra");
|
|
19
18
|
|
|
19
|
+
const {
|
|
20
|
+
translation,
|
|
21
|
+
} = ATranslationAPI();
|
|
22
|
+
|
|
20
23
|
const {
|
|
21
24
|
isPlaceholderTranslate,
|
|
22
25
|
getTranslatedText,
|
|
@@ -55,10 +58,18 @@ export default function AriaLabelAPI(props, {
|
|
|
55
58
|
return ariaLabelForCurrentDevice.value;
|
|
56
59
|
});
|
|
57
60
|
|
|
61
|
+
const ariaLabelAttributes = computed(() => {
|
|
62
|
+
const ATTRIBUTES = {};
|
|
63
|
+
if (hasAriaLabel.value) {
|
|
64
|
+
ATTRIBUTES["aria-label"] = ariaLabelLocal.value;
|
|
65
|
+
if (isTranslateAriaLabel.value) {
|
|
66
|
+
ATTRIBUTES["data-translate-aria-label"] = ariaLabelForCurrentDevice.value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return ATTRIBUTES;
|
|
70
|
+
});
|
|
71
|
+
|
|
58
72
|
return {
|
|
59
|
-
|
|
60
|
-
ariaLabelLocal,
|
|
61
|
-
hasAriaLabel,
|
|
62
|
-
isTranslateAriaLabel,
|
|
73
|
+
ariaLabelAttributes,
|
|
63
74
|
};
|
|
64
75
|
}
|
|
@@ -3,18 +3,10 @@ import {
|
|
|
3
3
|
} from "vue";
|
|
4
4
|
|
|
5
5
|
export default function AttributesAPI({
|
|
6
|
-
ariaLabelForCurrentDevice = computed(() => ""),
|
|
7
|
-
ariaLabelLocal = computed(() => ""),
|
|
8
|
-
hasAriaLabel = computed(() => false),
|
|
9
|
-
hasPlaceholder = computed(() => false),
|
|
10
6
|
htmlForCurrentDevice = computed(() => ""),
|
|
11
|
-
isTranslateAriaLabel = computed(() => false),
|
|
12
7
|
isTranslateHtml = computed(() => false),
|
|
13
|
-
isTranslatePlaceholder = computed(() => false),
|
|
14
8
|
isTranslateSafeHtml = computed(() => false),
|
|
15
9
|
isTranslateText = computed(() => false),
|
|
16
|
-
placeholderForCurrentDevice = computed(() => ""),
|
|
17
|
-
placeholderLocal = computed(() => ""),
|
|
18
10
|
safeHtmlForCurrentDevice = computed(() => ""),
|
|
19
11
|
textForCurrentDevice = computed(() => ({})),
|
|
20
12
|
titleLocalOptions = computed(() => ({})),
|
|
@@ -34,18 +26,6 @@ export default function AttributesAPI({
|
|
|
34
26
|
ATTRIBUTES["data-translate-title"] = titleLocalOptions.value.dataTranslateTitle;
|
|
35
27
|
}
|
|
36
28
|
}
|
|
37
|
-
if (hasPlaceholder.value) {
|
|
38
|
-
ATTRIBUTES.placeholder = placeholderLocal.value;
|
|
39
|
-
if (isTranslatePlaceholder.value) {
|
|
40
|
-
ATTRIBUTES["data-translate-placeholder"] = placeholderForCurrentDevice.value;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (hasAriaLabel.value) {
|
|
44
|
-
ATTRIBUTES["aria-label"] = ariaLabelLocal.value;
|
|
45
|
-
if (isTranslateAriaLabel.value) {
|
|
46
|
-
ATTRIBUTES["data-translate-aria-label"] = ariaLabelForCurrentDevice.value;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
29
|
|
|
50
30
|
return ATTRIBUTES;
|
|
51
31
|
});
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
} from "vue";
|
|
5
5
|
|
|
6
6
|
import AMobileAPI from "../../compositionAPI/AMobileAPI";
|
|
7
|
+
import ATranslationAPI from "./ATranslationAPI";
|
|
7
8
|
import UtilsAPI from "./UtilsAPI";
|
|
8
9
|
|
|
9
10
|
import {
|
|
@@ -11,12 +12,14 @@ import {
|
|
|
11
12
|
isUndefined,
|
|
12
13
|
} from "lodash-es";
|
|
13
14
|
|
|
14
|
-
export default function PlaceholderAPI(props
|
|
15
|
-
translation = computed(() => ({})),
|
|
16
|
-
}) {
|
|
15
|
+
export default function PlaceholderAPI(props) {
|
|
17
16
|
const extra = toRef(props, "extra");
|
|
18
17
|
const placeholder = toRef(props, "placeholder");
|
|
19
18
|
|
|
19
|
+
const {
|
|
20
|
+
translation,
|
|
21
|
+
} = ATranslationAPI();
|
|
22
|
+
|
|
20
23
|
const {
|
|
21
24
|
isPlaceholderTranslate,
|
|
22
25
|
getTranslatedText,
|
|
@@ -55,10 +58,18 @@ export default function PlaceholderAPI(props, {
|
|
|
55
58
|
return placeholderForCurrentDevice.value;
|
|
56
59
|
});
|
|
57
60
|
|
|
61
|
+
const placeholderAttributes = computed(() => {
|
|
62
|
+
const ATTRIBUTES = {};
|
|
63
|
+
if (hasPlaceholder.value) {
|
|
64
|
+
ATTRIBUTES.placeholder = placeholderLocal.value;
|
|
65
|
+
if (isTranslatePlaceholder.value) {
|
|
66
|
+
ATTRIBUTES["data-translate-placeholder"] = placeholderForCurrentDevice.value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return ATTRIBUTES;
|
|
70
|
+
});
|
|
71
|
+
|
|
58
72
|
return {
|
|
59
|
-
|
|
60
|
-
isTranslatePlaceholder,
|
|
61
|
-
placeholderForCurrentDevice,
|
|
62
|
-
placeholderLocal,
|
|
73
|
+
placeholderAttributes,
|
|
63
74
|
};
|
|
64
75
|
}
|