aloha-vue 1.0.342 → 1.0.343
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/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,
|
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
|
}
|