|
|
@ -1,5 +1,5 @@ |
|
|
|
import type { ColumnType } from 'nocodb-sdk' |
|
|
|
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk' |
|
|
|
import { UITypes } from 'nocodb-sdk' |
|
|
|
import { RelationTypes, 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' |
|
|
@ -168,13 +168,17 @@ const getUIDTIcon = (uidt: UITypes | string) => { |
|
|
|
).icon |
|
|
|
).icon |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const isColumnRequired = (col: ColumnType) => col.rqd && !col.cdf && !col.ai |
|
|
|
const isColumnRequired = (col?: ColumnType) => col && col.rqd && !col.cdf && !col.ai |
|
|
|
|
|
|
|
const isVirtualColRequired = (col: ColumnType, columns: ColumnType[]) => |
|
|
|
|
|
|
|
col.uidt === UITypes.LinkToAnotherRecord && |
|
|
|
|
|
|
|
(<LinkToAnotherRecordType>col.colOptions).type === RelationTypes.BELONGS_TO && |
|
|
|
|
|
|
|
isColumnRequired(columns.find((c) => c.id === (<LinkToAnotherRecordType>col.colOptions).fk_child_column_id)) |
|
|
|
|
|
|
|
|
|
|
|
const isColumnRequiredAndNull = (col: ColumnType, row: Record<string, any>) => { |
|
|
|
const isColumnRequiredAndNull = (col: ColumnType, row: Record<string, any>) => { |
|
|
|
return isColumnRequired(col) && (row[col.title!] === undefined || row[col.title!] === null) // && isVirtualColRequired()
|
|
|
|
return isColumnRequired(col) && (row[col.title!] === undefined || row[col.title!] === null) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export { uiTypes, getUIDTIcon, isColumnRequiredAndNull } |
|
|
|
export { uiTypes, getUIDTIcon, isColumnRequiredAndNull, isColumnRequired, isVirtualColRequired } |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd |
|
|
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd |
|
|
|