mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.0 KiB
33 lines
1.0 KiB
2 years ago
|
import { computed } from '@vue/reactivity'
|
||
|
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
|
||
|
import { RelationTypes, UITypes } from 'nocodb-sdk'
|
||
|
|
||
|
export default function useVirtualCell(column: ColumnType) {
|
||
|
const isHm = computed(
|
||
|
() =>
|
||
|
column.uidt === UITypes.LinkToAnotherRecord && (<LinkToAnotherRecordType>column.colOptions).type === RelationTypes.HAS_MANY,
|
||
|
)
|
||
|
const isMm = computed(
|
||
|
() =>
|
||
|
column.uidt === UITypes.LinkToAnotherRecord &&
|
||
|
(<LinkToAnotherRecordType>column.colOptions).type === RelationTypes.MANY_TO_MANY,
|
||
|
)
|
||
|
const isBt = computed(
|
||
|
() =>
|
||
|
column.uidt === UITypes.LinkToAnotherRecord &&
|
||
|
(<LinkToAnotherRecordType>column.colOptions).type === RelationTypes.BELONGS_TO,
|
||
|
)
|
||
|
const isLookup = computed(() => column.uidt === UITypes.Lookup)
|
||
|
const isRollup = computed(() => column.uidt === UITypes.Rollup)
|
||
|
const isFormula = computed(() => column.uidt === UITypes.Formula)
|
||
|
|
||
|
return {
|
||
|
isHm,
|
||
|
isMm,
|
||
|
isBt,
|
||
|
isLookup,
|
||
|
isRollup,
|
||
|
isFormula,
|
||
|
}
|
||
|
}
|