Browse Source

refactor(gui): check default value is null or undefined

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3953/head
Pranav C 2 years ago
parent
commit
49ae42e4b4
  1. 8
      packages/nc-gui/utils/columnUtils.ts

8
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 LinkVariant from '~icons/mdi/link-variant'
import TableColumnPlusBefore from '~icons/mdi/table-column-plus-before' import TableColumnPlusBefore from '~icons/mdi/table-column-plus-before'
import FormatColorText from '~icons/mdi/format-color-text' import FormatColorText from '~icons/mdi/format-color-text'
@ -167,8 +167,10 @@ const getUIDTIcon = (uidt: UITypes | string) => {
).icon ).icon
} }
const isColumnRequiredAndNull = (col: any, row: Record<string, any>) => { const isColumnRequired = (col: ColumnType) => col.rqd && (col.cdf === null || col.cdf === undefined ) && !col.ai
return col.rqd && (!col.cdf || !col.ai) && (row[col.title!] === undefined || row[col.title!] === null)
const isColumnRequiredAndNull = (col: ColumnType, row: Record<string, any>) => {
return isColumnRequired(col) && (row[col.title!] === undefined || row[col.title!] === null)
} }
export { uiTypes, getUIDTIcon, isColumnRequiredAndNull } export { uiTypes, getUIDTIcon, isColumnRequiredAndNull }

Loading…
Cancel
Save