- merged with master;
This commit is contained in:
@@ -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;
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user