Files
nocodb/packages/nc-gui/utils/virtualCell.ts
Pranav C 0e13bff899 Nc feat/one to one (#7915)
* feat: one-to-one relation - wip

* feat: one-to-one relation

* feat: one-to-one relation - link, unlink, list, excluded list, single query

* fix: pass proper fk value

* feat: add non-single-query support

* feat: filter, sort and delete

* fix: ui - keep only one as linked record in ui - similar to bt

* fix: initial column name correction

* fix: field modal related fixes

* fix: nested insert related bugs

* fix: nested insert corrections

* fix: formula support

* fix: delete cell data

* fix: invalid offset issue

* fix: form submit issue

* fix: return first element - oo relation

* fix: Lookup column rendering

* fix: add link api correction

* fix: sort and group by menu correction

* chore: lint

* refactor: spacing between radio buttons

* fix: undo/redo support with delete key

* fix: formula related issues

* fix: duplicate related issues

* fix: ui label and icon color

* chore: lint

* chore: reset page if offset is beyond offset(temporary solution)

* refactor: suggested review changes

* refactor: suggested review changes

* chore: lint

* fix: missing await

Signed-off-by: Pranav C <pranavxc@gmail.com>

* refactor: add comments

Signed-off-by: Pranav C <pranavxc@gmail.com>

---------

Signed-off-by: Pranav C <pranavxc@gmail.com>
2024-03-20 17:50:52 +05:30

28 lines
1.4 KiB
TypeScript

import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
import { RelationTypes, UITypes, isLinksOrLTAR } from 'nocodb-sdk'
export const isLTAR = (uidt: string | undefined, colOptions: unknown): colOptions is LinkToAnotherRecordType => {
if (!uidt) return false
return isLinksOrLTAR(uidt)
}
export const isHm = (column: ColumnType) =>
isLTAR(column.uidt!, column.colOptions) && column.colOptions?.type === RelationTypes.HAS_MANY
export const isMm = (column: ColumnType) =>
isLTAR(column.uidt!, column.colOptions) && column.colOptions?.type === RelationTypes.MANY_TO_MANY
export const isBt = (column: ColumnType) =>
isLTAR(column.uidt!, column.colOptions) && column.colOptions?.type === RelationTypes.BELONGS_TO
export const isOo = (column: ColumnType) =>
isLTAR(column.uidt!, column.colOptions) && column.colOptions?.type === RelationTypes.ONE_TO_ONE
export const isLookup = (column: ColumnType) => column.uidt === UITypes.Lookup
export const isRollup = (column: ColumnType) => column.uidt === UITypes.Rollup
export const isFormula = (column: ColumnType) => column.uidt === UITypes.Formula
export const isQrCode = (column: ColumnType) => column.uidt === UITypes.QrCode
export const isBarcode = (column: ColumnType) => column.uidt === UITypes.Barcode
export const isCount = (column: ColumnType) => column.uidt === UITypes.Count
export const isLink = (column: ColumnType) => column.uidt === UITypes.Links