- fixed validating table form field;

- fixed issue with bando preview;
This commit is contained in:
Vitalii Kiiko
2024-10-22 12:51:58 +02:00
parent 250a75e375
commit 1b37b7b548
4 changed files with 24 additions and 21 deletions

View File

@@ -68,7 +68,6 @@ export const maxChecks = (v, num) => {
}
export const nonEmptyTables = (v = [], tableCfg = []) => {
//console.log('nonEmptyTables',v)
const colsCfg = pathOr([], ['stateFieldData'], tableCfg);
const nonPredefinedCells = colsCfg
.filter(o => !o.predefined)
@@ -76,22 +75,24 @@ export const nonEmptyTables = (v = [], tableCfg = []) => {
let isTableValid = true;
let atLeastOneCellFilled = false
// eslint-disable-next-line array-callback-return
v.map((row) => {
if (isEmpty(row)) {
isTableValid = false;
} else {
// eslint-disable-next-line array-callback-return
nonPredefinedCells.map((k) => {
if (isNil(row[k]) || isEmpty(row[k])) {
isTableValid = atLeastOneCellFilled;
} else {
atLeastOneCellFilled = true;
isTableValid = true;
}
});
}
});
if (is(Array, v)) {
// eslint-disable-next-line array-callback-return
v.map((row) => {
if (isEmpty(row)) {
isTableValid = false;
} else {
// eslint-disable-next-line array-callback-return
nonPredefinedCells.map((k) => {
if (isNil(row[k]) || isEmpty(row[k])) {
isTableValid = atLeastOneCellFilled;
} else {
atLeastOneCellFilled = true;
isTableValid = true;
}
});
}
});
}
return is(Array, v) ? v.length >= 1 && isTableValid : false;
}