aloha-vue 2.68.0 → 2.69.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 +5 -0
- package/dist/aloha-vue.es.js +613 -602
- package/dist/aloha-vue.umd.js +21 -21
- package/package.json +1 -1
- package/src/ATableForm/ATableFormCell/ATableFormCell.js +8 -0
- package/src/ui/AInputCurrency/AInputCurrency.js +9 -7
- package/src/ui/AInputCurrency/__tests__/AInputCurrency.ModelAPI.test.js +73 -0
- package/src/ui/AInputCurrency/compositionAPI/ModelAPI.js +18 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aloha-vue",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.69.0",
|
|
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",
|
|
@@ -161,8 +161,16 @@ export default {
|
|
|
161
161
|
} = this.formElementLocal;
|
|
162
162
|
|
|
163
163
|
const slotProps = {
|
|
164
|
+
change: this.updateRowData,
|
|
164
165
|
column: this.column,
|
|
165
166
|
columnIndex: this.columnIndex,
|
|
167
|
+
errorIcon: this.errorIcon,
|
|
168
|
+
errors: this.errors,
|
|
169
|
+
id: this.id,
|
|
170
|
+
isCreateMode: this.isCreateMode,
|
|
171
|
+
isEditMode: this.isEditMode,
|
|
172
|
+
isFooter: this.isFooter,
|
|
173
|
+
modelValue: get(this.rowDataLocal, this.column.id),
|
|
166
174
|
row: this.row,
|
|
167
175
|
rowIndex: this.rowIndex,
|
|
168
176
|
rows: this.rows,
|
|
@@ -353,9 +353,10 @@ export default {
|
|
|
353
353
|
} = VerifyAPI(props);
|
|
354
354
|
|
|
355
355
|
const {
|
|
356
|
-
clearModel,
|
|
357
|
-
displayValue,
|
|
358
|
-
|
|
356
|
+
clearModel,
|
|
357
|
+
displayValue,
|
|
358
|
+
displayValueReadonly,
|
|
359
|
+
initLocalVars,
|
|
359
360
|
isInternalChange,
|
|
360
361
|
localModel,
|
|
361
362
|
modelNumber,
|
|
@@ -415,9 +416,10 @@ export default {
|
|
|
415
416
|
attributesToExcludeFromRender,
|
|
416
417
|
clearModel,
|
|
417
418
|
componentStyleHide,
|
|
418
|
-
decrease,
|
|
419
|
-
displayValue,
|
|
420
|
-
|
|
419
|
+
decrease,
|
|
420
|
+
displayValue,
|
|
421
|
+
displayValueReadonly,
|
|
422
|
+
errorsId,
|
|
421
423
|
hasErrorIcon,
|
|
422
424
|
handleInput,
|
|
423
425
|
handleKeydown,
|
|
@@ -452,7 +454,7 @@ export default {
|
|
|
452
454
|
label: this.label,
|
|
453
455
|
labelClass: this.labelClass,
|
|
454
456
|
labelScreenReader: this.labelScreenReader,
|
|
455
|
-
modelValue: this.
|
|
457
|
+
modelValue: this.displayValueReadonly,
|
|
456
458
|
readonlyDefault: this.readonlyDefault,
|
|
457
459
|
required: this.required,
|
|
458
460
|
style: this.componentStyleHide,
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
reactive,
|
|
3
|
+
} from "vue";
|
|
4
|
+
import {
|
|
5
|
+
describe,
|
|
6
|
+
expect,
|
|
7
|
+
it,
|
|
8
|
+
} from "@jest/globals";
|
|
9
|
+
|
|
10
|
+
import ModelAPI from "../compositionAPI/ModelAPI";
|
|
11
|
+
|
|
12
|
+
const getModelAPI = () => {
|
|
13
|
+
const props = reactive({
|
|
14
|
+
currencySymbol: "€",
|
|
15
|
+
currencySymbolPosition: "right",
|
|
16
|
+
decimalDivider: ",",
|
|
17
|
+
decimalPartLength: 2,
|
|
18
|
+
disabled: false,
|
|
19
|
+
modelType: "number",
|
|
20
|
+
modelUndefined: undefined,
|
|
21
|
+
modelValue: 1234.5,
|
|
22
|
+
required: false,
|
|
23
|
+
skipRequiredModelInit: false,
|
|
24
|
+
thousandDivider: ".",
|
|
25
|
+
});
|
|
26
|
+
const modelAPI = ModelAPI(props, {
|
|
27
|
+
adjustFloatPartAndDivider: () => "1.234,50",
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
modelAPI.initLocalVars();
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
modelAPI,
|
|
34
|
+
props,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
describe("AInputCurrency ModelAPI", () => {
|
|
39
|
+
it("adds the currency symbol to the readonly display value at the configured position", () => {
|
|
40
|
+
const {
|
|
41
|
+
modelAPI,
|
|
42
|
+
props,
|
|
43
|
+
} = getModelAPI();
|
|
44
|
+
|
|
45
|
+
expect(modelAPI.displayValueReadonly.value).toBe("1.234,50 €");
|
|
46
|
+
|
|
47
|
+
props.currencySymbol = "$";
|
|
48
|
+
props.currencySymbolPosition = "left";
|
|
49
|
+
|
|
50
|
+
expect(modelAPI.displayValueReadonly.value).toBe("$ 1.234,50");
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("does not add the currency symbol to an empty readonly display value", () => {
|
|
54
|
+
const {
|
|
55
|
+
modelAPI,
|
|
56
|
+
} = getModelAPI();
|
|
57
|
+
|
|
58
|
+
modelAPI.displayValue.value = "";
|
|
59
|
+
|
|
60
|
+
expect(modelAPI.displayValueReadonly.value).toBe("");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("keeps the readonly display value unchanged when the currency symbol is empty", () => {
|
|
64
|
+
const {
|
|
65
|
+
modelAPI,
|
|
66
|
+
props,
|
|
67
|
+
} = getModelAPI();
|
|
68
|
+
|
|
69
|
+
props.currencySymbol = "";
|
|
70
|
+
|
|
71
|
+
expect(modelAPI.displayValueReadonly.value).toBe("1.234,50");
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -13,20 +13,32 @@ export default function ModelAPI(props, {
|
|
|
13
13
|
adjustFloatPartAndDivider = () => {},
|
|
14
14
|
changeModel = () => {},
|
|
15
15
|
}) {
|
|
16
|
-
const
|
|
17
|
-
const
|
|
16
|
+
const currencySymbol = toRef(props, "currencySymbol");
|
|
17
|
+
const currencySymbolPosition = toRef(props, "currencySymbolPosition");
|
|
18
|
+
const decimalDivider = toRef(props, "decimalDivider");
|
|
19
|
+
const decimalPartLength = toRef(props, "decimalPartLength");
|
|
20
|
+
const disabled = toRef(props, "disabled");
|
|
18
21
|
const modelType = toRef(props, "modelType");
|
|
19
22
|
const modelUndefined = toRef(props, "modelUndefined");
|
|
23
|
+
const modelValue = toRef(props, "modelValue");
|
|
24
|
+
const required = toRef(props, "required");
|
|
20
25
|
const skipRequiredModelInit = toRef(props, "skipRequiredModelInit");
|
|
21
|
-
const decimalDivider = toRef(props, "decimalDivider");
|
|
22
|
-
const disabled = toRef(props, "disabled");
|
|
23
|
-
const decimalPartLength = toRef(props, "decimalPartLength");
|
|
24
26
|
const thousandDivider = toRef(props, "thousandDivider");
|
|
25
27
|
|
|
26
28
|
const displayValue = ref(undefined);
|
|
27
29
|
const isInternalChange = ref(false);
|
|
28
30
|
const localModel = ref(undefined);
|
|
29
31
|
|
|
32
|
+
const displayValueReadonly = computed(() => {
|
|
33
|
+
if (isNil(displayValue.value) || displayValue.value === "" || !currencySymbol.value) {
|
|
34
|
+
return displayValue.value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return currencySymbolPosition.value === "left" ?
|
|
38
|
+
`${ currencySymbol.value } ${ displayValue.value }` :
|
|
39
|
+
`${ displayValue.value } ${ currencySymbol.value }`;
|
|
40
|
+
});
|
|
41
|
+
|
|
30
42
|
const initLocalVars = () => {
|
|
31
43
|
displayValue.value = adjustFloatPartAndDivider(modelValue.value);
|
|
32
44
|
localModel.value = modelValue.value;
|
|
@@ -78,6 +90,7 @@ export default function ModelAPI(props, {
|
|
|
78
90
|
return {
|
|
79
91
|
clearModel,
|
|
80
92
|
displayValue,
|
|
93
|
+
displayValueReadonly,
|
|
81
94
|
initLocalVars,
|
|
82
95
|
isInternalChange,
|
|
83
96
|
localModel,
|