Skip to content

Commit 11a8381

Browse files
committed
fix above Multiline table error reporting
1 parent 026f447 commit 11a8381

8 files changed

+44
-58
lines changed

js/src/vue-components/multiline/multiline-body.component.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
:rowId="row.__atkml"
1111
:isDeletable="isDeletableRow(row)"
1212
:rowValues="row"
13-
:error="getError(row.__atkml)"
13+
:errors="getRowErrors(row.__atkml)"
1414
@onTabLastColumn="onTabLastColumn(i)"
1515
></AtkMultilineRow>
1616
</SuiTableBody>`,
@@ -37,12 +37,8 @@ export default {
3737
isDeletableRow: function (row) {
3838
return this.deletables.includes(row.__atkml);
3939
},
40-
getError: function (rowId) {
41-
if (rowId in this.errors) {
42-
return this.errors[rowId];
43-
}
44-
45-
return null;
40+
getRowErrors: function (rowId) {
41+
return this.errors[rowId] ? this.errors[rowId] : [];
4642
},
4743
},
4844
};

js/src/vue-components/multiline/multiline-header.component.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
<SuiTableRow v-if="hasError()">
88
<SuiTableCell :style="{ background: 'none' }" />
99
<SuiTableCell :style="{ background: 'none' }"
10-
state="error"
10+
error="true"
1111
v-for="column in filterVisibleColumns(columns)"
1212
:textAlign="getTextAlign(column)"
1313
>
@@ -34,7 +34,7 @@ export default {
3434
</SuiTableHeaderCell>
3535
</SuiTableRow>
3636
</SuiTableHeader>`,
37-
props: ['fields', 'state', 'errors', 'caption'],
37+
props: ['fields', 'selectionState', 'errors', 'caption'],
3838
data: function () {
3939
return { columns: this.fields, isDeleteAll: false };
4040
},
@@ -92,10 +92,10 @@ export default {
9292
},
9393
computed: {
9494
isIndeterminate: function () {
95-
return this.state === 'indeterminate';
95+
return this.selectionState === 'indeterminate';
9696
},
9797
isChecked: function () {
98-
return this.state === 'on';
98+
return this.selectionState === 'on';
9999
},
100100
},
101101
};

js/src/vue-components/multiline/multiline-row.component.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default {
1919
v-for="(column, i) in filterVisibleColumns(columns)"
2020
v-bind="column.cellProps"
2121
:width=null
22-
:state="getErrorState(column)"
22+
:error="hasColumnError(column)"
2323
:style="{ overflow: 'visible' }"
2424
@keydown.tab="onTab(i)"
2525
>
@@ -30,7 +30,7 @@ export default {
3030
></AtkMultilineCell>
3131
</SuiTableCell>
3232
</SuiTableRow>`,
33-
props: ['fields', 'rowId', 'isDeletable', 'rowValues', 'error'],
33+
props: ['fields', 'rowId', 'isDeletable', 'rowValues', 'errors'],
3434
data: function () {
3535
return { columns: this.fields };
3636
},
@@ -62,15 +62,8 @@ export default {
6262
this.$emit('onTabLastColumn');
6363
}
6464
},
65-
getErrorState: function (column) {
66-
if (this.error) {
67-
const error = this.error.filter((e) => column.name === e.name);
68-
if (error.length > 0) {
69-
return 'error';
70-
}
71-
}
72-
73-
return null;
65+
hasColumnError: function (column) {
66+
return this.errors.some((v) => column.name === v.name);
7467
},
7568
getColumnWidth: function (column) {
7669
return column.fieldOptions ? column.fieldOptions.width : null;

js/src/vue-components/multiline/multiline.component.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
<SuiTable v-bind="tableProp">
1111
<AtkMultilineHeader
1212
:fields="fieldData"
13-
:state="getMainToggleState"
13+
:selectionState="getMainToggleState"
1414
:errors="errors"
1515
:caption="caption"
1616
></AtkMultilineHeader>
@@ -276,14 +276,14 @@ export default {
276276
* deletables entries.
277277
*/
278278
getMainToggleState: function () {
279-
let state = 'off';
279+
let res = 'off';
280280
if (this.deletables.length > 0) {
281-
state = this.deletables.length === this.rowData.length
281+
res = this.deletables.length === this.rowData.length
282282
? 'on'
283283
: 'indeterminate';
284284
}
285285

286-
return state;
286+
return res;
287287
},
288288
isDeleteDisable: function () {
289289
return this.deletables.length === 0;

public/js/atk-vue-multiline.js

Lines changed: 26 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/atk-vue-multiline.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)