多维表格
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.
 
 
 
 
 
 

36 lines
1.2 KiB

import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
import { RelationTypes, UITypes } from 'nocodb-sdk'
import type { Ref } from 'vue'
import { computed } from '#imports'
export function useVirtualCell(column: Ref<ColumnType>) {
const isHm = computed(
() =>
column?.value?.uidt === UITypes.LinkToAnotherRecord &&
(<LinkToAnotherRecordType>column?.value?.colOptions).type === RelationTypes.HAS_MANY,
)
const isMm = computed(
() =>
column?.value?.uidt === UITypes.LinkToAnotherRecord &&
(<LinkToAnotherRecordType>column?.value?.colOptions).type === RelationTypes.MANY_TO_MANY,
)
const isBt = computed(
() =>
column?.value?.uidt === UITypes.LinkToAnotherRecord &&
(<LinkToAnotherRecordType>column?.value?.colOptions).type === RelationTypes.BELONGS_TO,
)
const isLookup = computed(() => column?.value?.uidt === UITypes.Lookup)
const isRollup = computed(() => column?.value?.uidt === UITypes.Rollup)
const isFormula = computed(() => column?.value?.uidt === UITypes.Formula)
const isCount = computed(() => column?.value?.uidt === UITypes.Count)
return {
isHm,
isMm,
isBt,
isLookup,
isRollup,
isFormula,
isCount,
}
}