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.
37 lines
1.2 KiB
37 lines
1.2 KiB
3 years ago
|
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
|
||
|
import { RelationTypes, UITypes } from 'nocodb-sdk'
|
||
2 years ago
|
import type { Ref } from 'vue'
|
||
2 years ago
|
import { computed } from '#imports'
|
||
3 years ago
|
|
||
2 years ago
|
export function useVirtualCell(column: Ref<ColumnType>) {
|
||
3 years ago
|
const isHm = computed(
|
||
|
() =>
|
||
2 years ago
|
column?.value?.uidt === UITypes.LinkToAnotherRecord &&
|
||
|
(<LinkToAnotherRecordType>column?.value?.colOptions).type === RelationTypes.HAS_MANY,
|
||
3 years ago
|
)
|
||
|
const isMm = computed(
|
||
|
() =>
|
||
2 years ago
|
column?.value?.uidt === UITypes.LinkToAnotherRecord &&
|
||
|
(<LinkToAnotherRecordType>column?.value?.colOptions).type === RelationTypes.MANY_TO_MANY,
|
||
3 years ago
|
)
|
||
|
const isBt = computed(
|
||
|
() =>
|
||
2 years ago
|
column?.value?.uidt === UITypes.LinkToAnotherRecord &&
|
||
|
(<LinkToAnotherRecordType>column?.value?.colOptions).type === RelationTypes.BELONGS_TO,
|
||
3 years ago
|
)
|
||
2 years ago
|
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)
|
||
3 years ago
|
|
||
|
return {
|
||
|
isHm,
|
||
|
isMm,
|
||
|
isBt,
|
||
|
isLookup,
|
||
|
isRollup,
|
||
|
isFormula,
|
||
2 years ago
|
isCount,
|
||
3 years ago
|
}
|
||
|
}
|