- merged with master;

This commit is contained in:
Vitalii Kiiko
2024-10-22 14:41:28 +02:00
6 changed files with 32 additions and 24 deletions

View File

@@ -1,5 +1,6 @@
import parse from 'html-react-parser';
import { isNil } from 'ramda';
const renderHtmlContent = (content) => parse(content);
const renderHtmlContent = (content = '') => !isNil(content) ? parse(content) : '';
export default renderHtmlContent;

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;
}