diff --git a/packages/nc-gui/utils/columnUtils.ts b/packages/nc-gui/utils/columnUtils.ts index e6a328928d..7d1f027f05 100644 --- a/packages/nc-gui/utils/columnUtils.ts +++ b/packages/nc-gui/utils/columnUtils.ts @@ -1,4 +1,4 @@ -import { UITypes } from 'nocodb-sdk' +import { ColumnType, UITypes } from 'nocodb-sdk' import LinkVariant from '~icons/mdi/link-variant' import TableColumnPlusBefore from '~icons/mdi/table-column-plus-before' import FormatColorText from '~icons/mdi/format-color-text' @@ -167,8 +167,10 @@ const getUIDTIcon = (uidt: UITypes | string) => { ).icon } -const isColumnRequiredAndNull = (col: any, row: Record) => { - return col.rqd && (!col.cdf || !col.ai) && (row[col.title!] === undefined || row[col.title!] === null) +const isColumnRequired = (col: ColumnType) => col.rqd && (col.cdf === null || col.cdf === undefined ) && !col.ai + +const isColumnRequiredAndNull = (col: ColumnType, row: Record) => { + return isColumnRequired(col) && (row[col.title!] === undefined || row[col.title!] === null) } export { uiTypes, getUIDTIcon, isColumnRequiredAndNull }