aloha-vue 2.63.0 → 2.64.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 +12 -0
- package/dist/aloha-vue.es.js +15045 -14970
- package/dist/aloha-vue.umd.js +55 -55
- package/package.json +1 -1
- package/src/ATableForm/ATableFormCell/ATableFormCell.js +28 -7
- package/src/ATableForm/ATableFormCell/compositionAPI/DisabledAPI.js +5 -2
- package/src/ATableForm/ATableFormCell/compositionAPI/ReadonlyAPI.js +6 -3
- package/src/ATableForm/ATableFormCellAction/ATableFormCellAction.js +13 -13
- package/src/ATableForm/ATableFormCellList/ATableFormCellList.js +127 -122
- package/src/ATableForm/ATableFormCellList/compositionAPI/DataAPI.js +18 -2
- package/src/ATableForm/ATableFormRow/ATableFormRow.js +14 -12
- package/src/ATableForm/__tests__/ATableForm.ListView.test.js +350 -222
- package/src/ATableForm/utils/getFormElement.js +32 -0
- package/src/ui/AInputCurrency/AInputCurrency.js +2 -0
- package/src/ui/AInputCurrency/compositionAPI/InputEventsAPI.js +3 -2
- package/src/ui/AInputCurrency/compositionAPI/UtilsAPI.js +16 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aloha-vue",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.64.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",
|
|
@@ -10,6 +10,7 @@ import ReadonlyAPI from "./compositionAPI/ReadonlyAPI";
|
|
|
10
10
|
import SlotAPI from "./compositionAPI/SlotAPI";
|
|
11
11
|
import StylesAPI from "../compositionAPI/StylesAPI";
|
|
12
12
|
|
|
13
|
+
import getFormElement from "../utils/getFormElement";
|
|
13
14
|
import {
|
|
14
15
|
get,
|
|
15
16
|
} from "lodash-es";
|
|
@@ -44,6 +45,11 @@ export default {
|
|
|
44
45
|
type: String,
|
|
45
46
|
required: true,
|
|
46
47
|
},
|
|
48
|
+
isCreateMode: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
required: false,
|
|
51
|
+
default: false,
|
|
52
|
+
},
|
|
47
53
|
isEditMode: {
|
|
48
54
|
type: Boolean,
|
|
49
55
|
required: false,
|
|
@@ -86,6 +92,20 @@ export default {
|
|
|
86
92
|
"updateRowData",
|
|
87
93
|
],
|
|
88
94
|
setup(props) {
|
|
95
|
+
const rowDataLocal = computed(() => {
|
|
96
|
+
return props.rowData || props.row;
|
|
97
|
+
});
|
|
98
|
+
const formElementLocal = computed(() => getFormElement({
|
|
99
|
+
column: props.column,
|
|
100
|
+
columnIndex: props.columnIndex,
|
|
101
|
+
isCreateMode: props.isCreateMode,
|
|
102
|
+
isEditMode: props.isEditMode,
|
|
103
|
+
row: props.row,
|
|
104
|
+
rowData: rowDataLocal.value,
|
|
105
|
+
rowIndex: props.rowIndex,
|
|
106
|
+
rows: props.rows,
|
|
107
|
+
}));
|
|
108
|
+
|
|
89
109
|
const {
|
|
90
110
|
columnStyles,
|
|
91
111
|
} = StylesAPI({
|
|
@@ -94,11 +114,15 @@ export default {
|
|
|
94
114
|
|
|
95
115
|
const {
|
|
96
116
|
readonlyLocal,
|
|
97
|
-
} = ReadonlyAPI(props
|
|
117
|
+
} = ReadonlyAPI(props, {
|
|
118
|
+
formElement: formElementLocal,
|
|
119
|
+
});
|
|
98
120
|
|
|
99
121
|
const {
|
|
100
122
|
disabledLocal,
|
|
101
|
-
} = DisabledAPI(props
|
|
123
|
+
} = DisabledAPI(props, {
|
|
124
|
+
formElement: formElementLocal,
|
|
125
|
+
});
|
|
102
126
|
|
|
103
127
|
const {
|
|
104
128
|
hasSlot,
|
|
@@ -107,13 +131,10 @@ export default {
|
|
|
107
131
|
slotNameAfter,
|
|
108
132
|
} = SlotAPI(props);
|
|
109
133
|
|
|
110
|
-
const rowDataLocal = computed(() => {
|
|
111
|
-
return props.rowData || props.row;
|
|
112
|
-
});
|
|
113
|
-
|
|
114
134
|
return {
|
|
115
135
|
columnStyles,
|
|
116
136
|
disabledLocal,
|
|
137
|
+
formElementLocal,
|
|
117
138
|
hasSlot,
|
|
118
139
|
hasSlotAfter,
|
|
119
140
|
readonlyLocal,
|
|
@@ -137,7 +158,7 @@ export default {
|
|
|
137
158
|
const {
|
|
138
159
|
type = "text",
|
|
139
160
|
...formElement
|
|
140
|
-
} = this.
|
|
161
|
+
} = this.formElementLocal;
|
|
141
162
|
|
|
142
163
|
const slotProps = {
|
|
143
164
|
column: this.column,
|
|
@@ -3,13 +3,16 @@ import {
|
|
|
3
3
|
toRef,
|
|
4
4
|
} from "vue";
|
|
5
5
|
|
|
6
|
-
export default function DisabledAPI(props
|
|
6
|
+
export default function DisabledAPI(props, {
|
|
7
|
+
formElement,
|
|
8
|
+
} = {}) {
|
|
7
9
|
const column = toRef(props, "column");
|
|
8
10
|
const isEditable = toRef(props, "isEditable");
|
|
9
11
|
const isEditMode = toRef(props, "isEditMode");
|
|
12
|
+
const formElementLocal = formElement || computed(() => column.value?.formElement);
|
|
10
13
|
|
|
11
14
|
const disabledLocal = computed(() => {
|
|
12
|
-
return !!
|
|
15
|
+
return !!formElementLocal.value?.disabled ||
|
|
13
16
|
(isEditable.value &&
|
|
14
17
|
!isEditMode.value);
|
|
15
18
|
});
|
|
@@ -3,21 +3,24 @@ import {
|
|
|
3
3
|
toRef,
|
|
4
4
|
} from "vue";
|
|
5
5
|
|
|
6
|
-
export default function ReadonlyAPI(props
|
|
6
|
+
export default function ReadonlyAPI(props, {
|
|
7
|
+
formElement,
|
|
8
|
+
} = {}) {
|
|
7
9
|
const column = toRef(props, "column");
|
|
8
10
|
const isEditable = toRef(props, "isEditable");
|
|
9
11
|
const isEditMode = toRef(props, "isEditMode");
|
|
10
12
|
const isFooter = toRef(props, "isFooter");
|
|
13
|
+
const formElementLocal = formElement || computed(() => column.value?.formElement);
|
|
11
14
|
|
|
12
15
|
const readonlyLocal = computed(() => {
|
|
13
16
|
if (isFooter.value) {
|
|
14
17
|
return true;
|
|
15
18
|
}
|
|
16
19
|
if (isEditable.value) {
|
|
17
|
-
if (
|
|
20
|
+
if (formElementLocal.value?.useRowReadonly) {
|
|
18
21
|
return !isEditMode.value;
|
|
19
22
|
}
|
|
20
|
-
return !!
|
|
23
|
+
return !!formElementLocal.value?.readonly;
|
|
21
24
|
}
|
|
22
25
|
return true;
|
|
23
26
|
});
|
|
@@ -210,38 +210,38 @@ export default {
|
|
|
210
210
|
}, this.isActiveEditMode ?
|
|
211
211
|
[
|
|
212
212
|
h(AButton, {
|
|
213
|
-
id: this.
|
|
213
|
+
id: this.idBtnSave,
|
|
214
214
|
class: [
|
|
215
215
|
"a_table_form__action_button",
|
|
216
|
-
this.actionsClasses.
|
|
216
|
+
this.actionsClasses.editSave,
|
|
217
217
|
],
|
|
218
218
|
disabled: this.isSaving,
|
|
219
219
|
extra: this.extra,
|
|
220
|
-
iconLeft:
|
|
221
|
-
title: this.texts.
|
|
222
|
-
textScreenReader: this.texts.
|
|
223
|
-
onClick: () => this.
|
|
220
|
+
iconLeft: Floppy2Fill,
|
|
221
|
+
title: this.texts.actionEditSave,
|
|
222
|
+
textScreenReader: this.texts.actionEditSave,
|
|
223
|
+
onClick: () => this.onSaveEditRow({
|
|
224
224
|
id: this.id,
|
|
225
225
|
row: this.row,
|
|
226
226
|
rowIndex: this.rowIndex,
|
|
227
|
-
trigger: "cancel",
|
|
228
227
|
}),
|
|
229
228
|
}),
|
|
230
229
|
h(AButton, {
|
|
231
|
-
id: this.
|
|
230
|
+
id: this.idBtnCancel,
|
|
232
231
|
class: [
|
|
233
232
|
"a_table_form__action_button",
|
|
234
|
-
this.actionsClasses.
|
|
233
|
+
this.actionsClasses.editCancel,
|
|
235
234
|
],
|
|
236
235
|
disabled: this.isSaving,
|
|
237
236
|
extra: this.extra,
|
|
238
|
-
iconLeft:
|
|
239
|
-
title: this.texts.
|
|
240
|
-
textScreenReader: this.texts.
|
|
241
|
-
onClick: () => this.
|
|
237
|
+
iconLeft: XLg,
|
|
238
|
+
title: this.texts.actionEditCancel,
|
|
239
|
+
textScreenReader: this.texts.actionEditCancel,
|
|
240
|
+
onClick: () => this.onCancelEditRow({
|
|
242
241
|
id: this.id,
|
|
243
242
|
row: this.row,
|
|
244
243
|
rowIndex: this.rowIndex,
|
|
244
|
+
trigger: "cancel",
|
|
245
245
|
}),
|
|
246
246
|
}),
|
|
247
247
|
] :
|
|
@@ -1,122 +1,127 @@
|
|
|
1
|
-
import {
|
|
2
|
-
computed,
|
|
3
|
-
h,
|
|
4
|
-
} from "vue";
|
|
5
|
-
|
|
6
|
-
import AForm from "../../ui/AForm/AForm";
|
|
7
|
-
|
|
8
|
-
import DataAPI from "./compositionAPI/DataAPI";
|
|
9
|
-
|
|
10
|
-
function hasItemWithId(items, id) {
|
|
11
|
-
return items?.some(item => {
|
|
12
|
-
return item?.id === id || hasItemWithId(item?.children, id);
|
|
13
|
-
}) || false;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
name: "ATableFormCellList",
|
|
18
|
-
props: {
|
|
19
|
-
columns: {
|
|
20
|
-
type: Array,
|
|
21
|
-
required: true,
|
|
22
|
-
},
|
|
23
|
-
errors: {
|
|
24
|
-
type: Object,
|
|
25
|
-
required: false,
|
|
26
|
-
default: () => ({}),
|
|
27
|
-
},
|
|
28
|
-
id: {
|
|
29
|
-
type: String,
|
|
30
|
-
required: true,
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
type: Boolean,
|
|
34
|
-
required: false,
|
|
35
|
-
default: false,
|
|
36
|
-
},
|
|
37
|
-
isEditMode: {
|
|
38
|
-
type: Boolean,
|
|
39
|
-
required: false,
|
|
40
|
-
default: false,
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
type: Boolean,
|
|
44
|
-
required: false,
|
|
45
|
-
default: false,
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
type:
|
|
49
|
-
required:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
type:
|
|
58
|
-
required:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
this
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
h,
|
|
4
|
+
} from "vue";
|
|
5
|
+
|
|
6
|
+
import AForm from "../../ui/AForm/AForm";
|
|
7
|
+
|
|
8
|
+
import DataAPI from "./compositionAPI/DataAPI";
|
|
9
|
+
|
|
10
|
+
function hasItemWithId(items, id) {
|
|
11
|
+
return items?.some(item => {
|
|
12
|
+
return item?.id === id || hasItemWithId(item?.children, id);
|
|
13
|
+
}) || false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
name: "ATableFormCellList",
|
|
18
|
+
props: {
|
|
19
|
+
columns: {
|
|
20
|
+
type: Array,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
errors: {
|
|
24
|
+
type: Object,
|
|
25
|
+
required: false,
|
|
26
|
+
default: () => ({}),
|
|
27
|
+
},
|
|
28
|
+
id: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
isCreateMode: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
required: false,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
isEditMode: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
required: false,
|
|
40
|
+
default: false,
|
|
41
|
+
},
|
|
42
|
+
isEditable: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
required: false,
|
|
45
|
+
default: false,
|
|
46
|
+
},
|
|
47
|
+
isFooter: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
required: false,
|
|
50
|
+
default: false,
|
|
51
|
+
},
|
|
52
|
+
row: {
|
|
53
|
+
type: Object,
|
|
54
|
+
required: true,
|
|
55
|
+
},
|
|
56
|
+
rowData: {
|
|
57
|
+
type: Object,
|
|
58
|
+
required: false,
|
|
59
|
+
default: undefined,
|
|
60
|
+
},
|
|
61
|
+
rowIndex: {
|
|
62
|
+
type: Number,
|
|
63
|
+
required: true,
|
|
64
|
+
},
|
|
65
|
+
rows: {
|
|
66
|
+
type: Array,
|
|
67
|
+
required: true,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
emits: [
|
|
71
|
+
"updateRowData",
|
|
72
|
+
],
|
|
73
|
+
setup(props) {
|
|
74
|
+
const {
|
|
75
|
+
dataForm,
|
|
76
|
+
} = DataAPI(props);
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
dataForm,
|
|
80
|
+
rowDataLocal: computed(() => props.rowData || props.row),
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
methods: {
|
|
84
|
+
updateRowData({
|
|
85
|
+
fullModel,
|
|
86
|
+
id,
|
|
87
|
+
item,
|
|
88
|
+
model,
|
|
89
|
+
}) {
|
|
90
|
+
const column = this.columns.find(columnLocal => {
|
|
91
|
+
return columnLocal.id === id ||
|
|
92
|
+
hasItemWithId(columnLocal.formElement?.children, id);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
this.$emit("updateRowData", {
|
|
96
|
+
column,
|
|
97
|
+
columnId: id,
|
|
98
|
+
fullModel,
|
|
99
|
+
item,
|
|
100
|
+
model,
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
render() {
|
|
105
|
+
return h("td", {
|
|
106
|
+
class: [
|
|
107
|
+
"a_table_form__cell",
|
|
108
|
+
"a_table_form__cell_td",
|
|
109
|
+
"a_table_form__cell_list",
|
|
110
|
+
],
|
|
111
|
+
}, [
|
|
112
|
+
h(AForm, {
|
|
113
|
+
data: this.dataForm,
|
|
114
|
+
errors: this.errors,
|
|
115
|
+
idPrefix: this.id,
|
|
116
|
+
modelValue: this.rowDataLocal,
|
|
117
|
+
readonly: this.isFooter || !this.isEditable,
|
|
118
|
+
showErrors: true,
|
|
119
|
+
showRequiredText: false,
|
|
120
|
+
tag: "div",
|
|
121
|
+
useFlatErrors: true,
|
|
122
|
+
useFlatModel: true,
|
|
123
|
+
onChange: this.updateRowData,
|
|
124
|
+
}, this.$slots),
|
|
125
|
+
]);
|
|
126
|
+
},
|
|
127
|
+
};
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
toRef,
|
|
4
4
|
} from "vue";
|
|
5
5
|
|
|
6
|
+
import getFormElement from "../../utils/getFormElement";
|
|
6
7
|
import {
|
|
7
8
|
cloneDeep,
|
|
8
9
|
isNil,
|
|
@@ -33,14 +34,29 @@ function normalizeItem(item, {
|
|
|
33
34
|
|
|
34
35
|
export default function DataAPI(props) {
|
|
35
36
|
const columns = toRef(props, "columns");
|
|
37
|
+
const isCreateMode = toRef(props, "isCreateMode");
|
|
36
38
|
const isEditable = toRef(props, "isEditable");
|
|
37
39
|
const isEditMode = toRef(props, "isEditMode");
|
|
40
|
+
const row = toRef(props, "row");
|
|
41
|
+
const rowData = toRef(props, "rowData");
|
|
42
|
+
const rowIndex = toRef(props, "rowIndex");
|
|
43
|
+
const rows = toRef(props, "rows");
|
|
38
44
|
|
|
39
45
|
const dataForm = computed(() => {
|
|
40
46
|
const isRowDisabled = isEditable.value && !isEditMode.value;
|
|
41
47
|
|
|
42
|
-
return columns.value.map(column => {
|
|
43
|
-
const
|
|
48
|
+
return columns.value.map((column, columnIndex) => {
|
|
49
|
+
const formElement = getFormElement({
|
|
50
|
+
column,
|
|
51
|
+
columnIndex,
|
|
52
|
+
isCreateMode: isCreateMode.value,
|
|
53
|
+
isEditMode: isEditMode.value,
|
|
54
|
+
row: row.value,
|
|
55
|
+
rowData: rowData.value || row.value,
|
|
56
|
+
rowIndex: rowIndex.value,
|
|
57
|
+
rows: rows.value,
|
|
58
|
+
});
|
|
59
|
+
const ITEM = normalizeItem(formElement, {
|
|
44
60
|
isEditMode: isEditMode.value,
|
|
45
61
|
isRowDisabled,
|
|
46
62
|
});
|
|
@@ -184,16 +184,16 @@ export default {
|
|
|
184
184
|
required: false,
|
|
185
185
|
default: false,
|
|
186
186
|
},
|
|
187
|
-
isDndDisabled: {
|
|
188
|
-
type: Boolean,
|
|
189
|
-
required: false,
|
|
190
|
-
default: false,
|
|
191
|
-
},
|
|
192
|
-
isDndLocked: {
|
|
193
|
-
type: Boolean,
|
|
194
|
-
required: false,
|
|
195
|
-
default: false,
|
|
196
|
-
},
|
|
187
|
+
isDndDisabled: {
|
|
188
|
+
type: Boolean,
|
|
189
|
+
required: false,
|
|
190
|
+
default: false,
|
|
191
|
+
},
|
|
192
|
+
isDndLocked: {
|
|
193
|
+
type: Boolean,
|
|
194
|
+
required: false,
|
|
195
|
+
default: false,
|
|
196
|
+
},
|
|
197
197
|
isDragAndDrop: {
|
|
198
198
|
type: Boolean,
|
|
199
199
|
required: false,
|
|
@@ -481,8 +481,8 @@ export default {
|
|
|
481
481
|
canMoveRowDown: this.canMoveRowDown,
|
|
482
482
|
canMoveRowUp: this.canMoveRowUp,
|
|
483
483
|
isCreateMode: this.isCreateMode,
|
|
484
|
-
isDndDisabled: this.isDndDisabled,
|
|
485
|
-
isDndLocked: this.isDndLocked,
|
|
484
|
+
isDndDisabled: this.isDndDisabled,
|
|
485
|
+
isDndLocked: this.isDndLocked,
|
|
486
486
|
isDragAndDrop: this.isDragAndDrop,
|
|
487
487
|
isFooter: this.isFooter,
|
|
488
488
|
isHeader: this.isHeader,
|
|
@@ -500,6 +500,7 @@ export default {
|
|
|
500
500
|
id: this.idTr,
|
|
501
501
|
columns: this.columns,
|
|
502
502
|
errors: this.errorsLocal,
|
|
503
|
+
isCreateMode: this.isCreateMode,
|
|
503
504
|
isEditable: this.isEditable,
|
|
504
505
|
isEditMode: this.isActiveEditMode,
|
|
505
506
|
isFooter: this.isFooter,
|
|
@@ -525,6 +526,7 @@ export default {
|
|
|
525
526
|
columnStyle: this.columnsStylesGrow[column.id],
|
|
526
527
|
errorIcon: this.errorIcon,
|
|
527
528
|
errors: this.errorsLocal,
|
|
529
|
+
isCreateMode: this.isCreateMode,
|
|
528
530
|
isEditable: this.isEditable,
|
|
529
531
|
isEditMode: this.isActiveEditMode,
|
|
530
532
|
isFooter: this.isFooter,
|