Browse Source

refactor(nc-gui): reduce computed values generated by cells

pull/3847/head
braks 2 years ago
parent
commit
19c38753a4
  1. 1
      packages/nc-gui/components/dashboard/TreeView.vue
  2. 136
      packages/nc-gui/components/smartsheet/Cell.vue
  3. 10
      packages/nc-gui/components/smartsheet/VirtualCell.vue
  4. 5
      packages/nc-gui/components/virtual-cell/Lookup.vue
  5. 131
      packages/nc-gui/composables/useColumn.ts
  6. 50
      packages/nc-gui/composables/useVirtualCell.ts
  7. 59
      packages/nc-gui/utils/cell.ts
  8. 4
      packages/nc-gui/utils/parsers/parserHelpers.ts
  9. 2
      packages/nc-gui/utils/validation.ts
  10. 16
      packages/nc-gui/utils/virtualCell.ts

1
packages/nc-gui/components/dashboard/TreeView.vue

@ -336,6 +336,7 @@ const onSearchCloseIconClick = () => {
>
<GeneralTooltip class="pl-5 pr-3 py-2" modifier-key="Alt">
<template #title>{{ table.table_name }}</template>
<div class="flex items-center gap-2 h-full" @contextmenu="setMenuContext('table', table)">
<div class="flex w-auto" :data-testid="`tree-view-table-draggable-handle-${table.title}`">
<MdiDragVertical

136
packages/nc-gui/components/smartsheet/Cell.vue

@ -1,5 +1,6 @@
<script setup lang="ts">
import type { ColumnType } from 'nocodb-sdk'
import { SqlUiFactory, isVirtualCol, UITypes } from 'nocodb-sdk'
import {
ActiveCellInj,
ColumnInj,
@ -10,11 +11,36 @@ import {
ReadonlyInj,
computed,
inject,
isAttachment,
isAutoSaved,
isBoolean,
isCurrency,
isDate,
isDateTime,
isDecimal,
isDuration,
isEmail,
isFloat,
isInt,
isJSON,
isManualSaved,
isMultiSelect,
isPercent,
isPhoneNumber,
isPrimary,
isRating,
isSingleSelect,
isString,
isTextArea,
isTime,
isURL,
isYear,
isPrimaryKey,
provide,
ref,
toRef,
useColumn,
useDebounceFn,
useProject,
useSmartsheetRowStoreOrThrow,
useVModel,
} from '#imports'
@ -46,9 +72,7 @@ provide(EditModeInj, useVModel(props, 'editEnabled', emit))
provide(ActiveCellInj, active)
if (readOnly?.value) {
provide(ReadonlyInj, readOnly)
}
provide(ReadonlyInj, readOnly)
const isForm = inject(IsFormInj, ref(false))
@ -58,41 +82,23 @@ const isLocked = inject(IsLockedInj, ref(false))
const { currentRow } = useSmartsheetRowStoreOrThrow()
const syncValue = useDebounceFn(
() => {
currentRow.value.rowMeta.changed = false
emit('save')
},
500,
const { project } = useProject()
const abstractType = computed(() => {
// kludge: CY test hack; column.value is being received NULL during attach cell delete operation
return (column.value && isVirtualCol(column.value)) || !column.value
? null
: SqlUiFactory.create(
project.value?.bases?.[0]?.type ? { client: project.value.bases[0].type } : { client: 'mysql2' },
).getAbstractType(column.value)
})
const syncValue = useDebounceFn(() => {
currentRow.value.rowMeta.changed = false
emit('save')
}, 500,
{ maxWait: 2000 },
)
const {
isPrimary,
isURL,
isEmail,
isJSON,
isDate,
isYear,
isDateTime,
isTime,
isBoolean,
isDuration,
isRating,
isCurrency,
isAttachment,
isTextArea,
isString,
isInt,
isFloat,
isDecimal,
isSingleSelect,
isMultiSelect,
isPercent,
isPhoneNumber,
isAutoSaved,
isManualSaved,
isPrimaryKey,
} = useColumn(column)
const vModel = computed({
get: () => props.modelValue,
@ -100,9 +106,9 @@ const vModel = computed({
if (val !== props.modelValue) {
currentRow.value.rowMeta.changed = true
emit('update:modelValue', val)
if (isAutoSaved.value) {
if (isAutoSaved(column.value)) {
syncValue()
} else if (!isManualSaved.value) {
} else if (!isManualSaved(column.value)) {
emit('save')
currentRow.value.rowMeta.changed = true
}
@ -112,7 +118,7 @@ const vModel = computed({
const syncAndNavigate = (dir: NavigateDir, e: KeyboardEvent) => {
console.log('syncAndNavigate', e.target)
if (isJSON.value) return
if (isJSON(column.value)) return
if (currentRow.value.rowMeta.changed || currentRow.value.rowMeta.new) {
emit('save')
@ -127,32 +133,36 @@ const syncAndNavigate = (dir: NavigateDir, e: KeyboardEvent) => {
<template>
<div
class="nc-cell w-full"
:class="[`nc-cell-${(column?.uidt || 'default').toLowerCase()}`, { 'text-blue-600': isPrimary && !virtual && !isForm }]"
:class="[`nc-cell-${(column?.uidt || 'default').toLowerCase()}`, { 'text-blue-600': isPrimary(column) && !virtual && !isForm }]"
@keydown.enter.exact="syncAndNavigate(NavigateDir.NEXT, $event)"
@keydown.shift.enter.exact="syncAndNavigate(NavigateDir.PREV, $event)"
>
<LazyCellTextArea v-if="isTextArea" v-model="vModel" />
<LazyCellCheckbox v-else-if="isBoolean" v-model="vModel" />
<LazyCellAttachment v-else-if="isAttachment" v-model="vModel" :row-index="props.rowIndex" />
<LazyCellSingleSelect v-else-if="isSingleSelect" v-model="vModel" :row-index="props.rowIndex" />
<LazyCellMultiSelect v-else-if="isMultiSelect" v-model="vModel" :row-index="props.rowIndex" />
<LazyCellDatePicker v-else-if="isDate" v-model="vModel" :is-pk="isPrimaryKey" />
<LazyCellYearPicker v-else-if="isYear" v-model="vModel" :is-pk="isPrimaryKey" />
<LazyCellDateTimePicker v-else-if="isDateTime" v-model="vModel" :is-pk="isPrimaryKey" />
<LazyCellTimePicker v-else-if="isTime" v-model="vModel" :is-pk="isPrimaryKey" />
<LazyCellRating v-else-if="isRating" v-model="vModel" />
<LazyCellDuration v-else-if="isDuration" v-model="vModel" />
<LazyCellEmail v-else-if="isEmail" v-model="vModel" />
<LazyCellUrl v-else-if="isURL" v-model="vModel" />
<LazyCellPhoneNumber v-else-if="isPhoneNumber" v-model="vModel" />
<LazyCellPercent v-else-if="isPercent" v-model="vModel" />
<LazyCellCurrency v-else-if="isCurrency" v-model="vModel" @save="emit('save')" />
<LazyCellDecimal v-else-if="isDecimal" v-model="vModel" />
<LazyCellInteger v-else-if="isInt" v-model="vModel" />
<LazyCellFloat v-else-if="isFloat" v-model="vModel" />
<LazyCellText v-else-if="isString" v-model="vModel" />
<LazyCellJson v-else-if="isJSON" v-model="vModel" />
<LazyCellTextArea v-if="isTextArea(column)" v-model="vModel" />
<LazyCellCheckbox v-else-if="isBoolean(column)" v-model="vModel" />
<LazyCellAttachment v-else-if="isAttachment(column)" v-model="vModel" :row-index="props.rowIndex" />
<LazyCellSingleSelect v-else-if="isSingleSelect(column)" v-model="vModel" :row-index="props.rowIndex" />
<LazyCellMultiSelect v-else-if="isMultiSelect(column)" v-model="vModel" :row-index="props.rowIndex" />
<LazyCellDatePicker v-else-if="isDate(column, abstractType)" v-model="vModel" :is-pk="isPrimaryKey" />
<LazyCellYearPicker v-else-if="isYear(column, abstractType)" v-model="vModel" :is-pk="isPrimaryKey" />
<LazyCellDateTimePicker v-else-if="isDateTime(column, abstractType)" v-model="vModel" :is-pk="isPrimaryKey" />
<LazyCellTimePicker v-else-if="isTime(column, abstractType)" v-model="vModel" :is-pk="isPrimaryKey" />
<LazyCellRating v-else-if="isRating(column)" v-model="vModel" />
<LazyCellDuration v-else-if="isDuration(column)" v-model="vModel" />
<LazyCellEmail v-else-if="isEmail(column)" v-model="vModel" />
<LazyCellUrl v-else-if="isURL(column)" v-model="vModel" />
<LazyCellPhoneNumber v-else-if="isPhoneNumber(column)" v-model="vModel" />
<LazyCellPercent v-else-if="isPercent(column)" v-model="vModel" />
<LazyCellCurrency v-else-if="isCurrency(column)" v-model="vModel" @save="emit('save')" />
<LazyCellDecimal v-else-if="isDecimal(column)" v-model="vModel" />
<LazyCellInteger v-else-if="isInt(column, abstractType)" v-model="vModel" />
<LazyCellFloat v-else-if="isFloat(column, abstractType)" v-model="vModel" />
<LazyCellText v-else-if="isString(column, abstractType)" v-model="vModel" />
<LazyCellJson v-else-if="isJSON(column)" v-model="vModel" />
<LazyCellText v-else v-model="vModel" />
<div v-if="(isLocked || (isPublic && readOnly && !isForm)) && !isAttachment" class="nc-locked-overlay" @click.stop.prevent />
<div
v-if="(isLocked || (isPublic && readOnly && !isForm)) && !isAttachment(column)"
class="nc-locked-overlay"
@click.stop.prevent
/>
</div>
</template>

10
packages/nc-gui/components/smartsheet/VirtualCell.vue

@ -24,7 +24,7 @@ provide(CellValueInj, toRef(props, 'modelValue'))
const isForm = inject(IsFormInj, ref(false))
const { isLookup, isBt, isRollup, isMm, isHm, isFormula, isCount } = useVirtualCell(column)
const virtualCell = useVirtualCell(column)
function onNavigate(dir: NavigateDir, e: KeyboardEvent) {
emit('navigate', dir)
@ -39,12 +39,6 @@ function onNavigate(dir: NavigateDir, e: KeyboardEvent) {
@keydown.enter.exact="onNavigate(NavigateDir.NEXT, $event)"
@keydown.shift.enter.exact="onNavigate(NavigateDir.PREV, $event)"
>
<LazyVirtualCellHasMany v-if="isHm" />
<LazyVirtualCellManyToMany v-else-if="isMm" />
<LazyVirtualCellBelongsTo v-else-if="isBt" />
<LazyVirtualCellRollup v-else-if="isRollup" />
<LazyVirtualCellFormula v-else-if="isFormula" />
<LazyVirtualCellCount v-else-if="isCount" />
<LazyVirtualCellLookup v-else-if="isLookup" />
<component :is="virtualCell" />
</div>
</template>

5
packages/nc-gui/components/virtual-cell/Lookup.vue

@ -12,7 +12,6 @@ import {
inject,
provide,
refAutoReset,
useColumn,
useMetas,
} from '#imports'
@ -46,8 +45,6 @@ const lookupColumn = computed<any>(
provide(MetaInj, lookupTableMeta)
provide(CellUrlDisableOverlayInj, ref(true))
const lookupColumnMetaProps = useColumn(lookupColumn)
const timeout = 3000 // in ms
const showEditWarning = refAutoReset(false, timeout)
@ -94,7 +91,7 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEven
:key="i"
class="min-w-max"
:class="{
'bg-gray-100 px-1 rounded-full flex-1': !lookupColumnMetaProps.isAttachment,
'bg-gray-100 px-1 rounded-full flex-1': !isAttachment(lookupColumn),
' border-gray-200 rounded border-1': ![UITypes.Attachment, UITypes.MultiSelect, UITypes.SingleSelect].includes(
lookupColumn.uidt,
),

131
packages/nc-gui/composables/useColumn.ts

@ -1,98 +1,53 @@
import type { ColumnType } from 'nocodb-sdk'
import { SqlUiFactory, UITypes, isVirtualCol } from 'nocodb-sdk'
import type { ComputedRef, Ref } from 'vue'
import { computed, useProject } from '#imports'
import { computed, dataTypeLow, isBoolean, isPrimary, isString, isTextArea, useProject } from '#imports'
export function useColumn(column: Ref<ColumnType | undefined>) {
const { project } = useProject()
const uiDatatype: ComputedRef<UITypes> = computed(() => column.value?.uidt as UITypes)
const data = computed(() => {
if (!column.value) return null
const abstractType = computed(() => {
// kludge: CY test hack; column.value is being received NULL during attach cell delete operation
return (column.value && isVirtualCol(column.value)) || !column.value
? null
: SqlUiFactory.create(
project.value?.bases?.[0]?.type ? { client: project.value.bases[0].type } : { client: 'mysql2' },
).getAbstractType(column.value)
})
const dataTypeLow = computed(() => column.value?.dt?.toLowerCase())
const isBoolean = computed(() => abstractType.value === 'boolean')
const isString = computed(() => uiDatatype.value === UITypes.SingleLineText || abstractType.value === 'string')
const isTextArea = computed(() => uiDatatype.value === UITypes.LongText)
const isInt = computed(() => abstractType.value === 'integer')
const isFloat = computed(() => abstractType.value === 'float' || abstractType.value === UITypes.Number)
const isDate = computed(() => abstractType.value === 'date' || uiDatatype.value === UITypes.Date)
const isYear = computed(() => abstractType.value === 'year' || uiDatatype.value === UITypes.Year)
const isTime = computed(() => abstractType.value === 'time' || uiDatatype.value === UITypes.Time)
const isDateTime = computed(() => abstractType.value === 'datetime' || uiDatatype.value === UITypes.DateTime)
const isJSON = computed(() => uiDatatype.value === UITypes.JSON)
const isEnum = computed(() => uiDatatype.value === UITypes.SingleSelect)
const isSingleSelect = computed(() => uiDatatype.value === UITypes.SingleSelect)
const isSet = computed(() => uiDatatype.value === UITypes.MultiSelect)
const isMultiSelect = computed(() => uiDatatype.value === UITypes.MultiSelect)
const isURL = computed(() => uiDatatype.value === UITypes.URL)
const isEmail = computed(() => uiDatatype.value === UITypes.Email)
const isAttachment = computed(() => uiDatatype.value === UITypes.Attachment)
const isRating = computed(() => uiDatatype.value === UITypes.Rating)
const isCurrency = computed(() => uiDatatype.value === UITypes.Currency)
const isPhoneNumber = computed(() => uiDatatype.value === UITypes.PhoneNumber)
const isDecimal = computed(() => uiDatatype.value === UITypes.Decimal)
const isDuration = computed(() => uiDatatype.value === UITypes.Duration)
const isPercent = computed(() => uiDatatype.value === UITypes.Percent)
const isSpecificDBType = computed(() => uiDatatype.value === UITypes.SpecificDBType)
const isAutoSaved = computed(() =>
[
UITypes.SingleLineText,
UITypes.LongText,
UITypes.PhoneNumber,
UITypes.Email,
UITypes.URL,
UITypes.Number,
UITypes.Decimal,
UITypes.Percent,
UITypes.Count,
UITypes.AutoNumber,
UITypes.SpecificDBType,
UITypes.Geometry,
UITypes.Duration,
].includes(uiDatatype.value),
)
const isManualSaved = computed(() => [UITypes.Currency].includes(uiDatatype.value))
const isPrimary = computed(() => column.value?.pv)
const isPrimaryKey = computed(() => !!column.value?.pk)
const abstractType = computed(() => {
// kludge: CY test hack; column.value is being received NULL during attach cell delete operation
return (column.value && isVirtualCol(column.value)) || !column.value
? null
: SqlUiFactory.create(
project.value?.bases?.[0]?.type ? { client: project.value.bases[0].type } : { client: 'mysql2' },
).getAbstractType(column.value)
})
return {
abstractType,
dataTypeLow,
isPrimary,
isBoolean,
isString,
isTextArea,
isInt,
isFloat,
isDate,
isYear,
isTime,
isDateTime,
isJSON,
isEnum,
isSet,
isURL,
isEmail,
isAttachment,
isRating,
isCurrency,
isDecimal,
isDuration,
isAutoSaved,
isManualSaved,
isSingleSelect,
isMultiSelect,
isPercent,
isPhoneNumber,
isSpecificDBType,
isPrimaryKey,
}
return {
abstractType,
dataTypeLow: dataTypeLow(column.value),
isPrimary: isPrimary(column.value),
isBoolean: isBoolean(abstractType.value),
isString: isString(column.value, abstractType.value),
isTextArea: isTextArea(column.value),
isInt,
isFloat,
isDate,
isYear,
isTime,
isDateTime,
isJSON,
isEnum,
isSet,
isURL,
isEmail,
isAttachment,
isRating,
isCurrency,
isDecimal,
isDuration,
isAutoSaved,
isManualSaved,
isSingleSelect,
isMultiSelect,
isPercent,
isPhoneNumber,
isSpecificDBType,
}
})
}

50
packages/nc-gui/composables/useVirtualCell.ts

@ -1,36 +1,24 @@
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
import { RelationTypes, UITypes } from 'nocodb-sdk'
import type { ColumnType } from 'nocodb-sdk'
import type { Ref } from 'vue'
import { computed } from '#imports'
import { computed, isBt, isCount, isFormula, isHm, isLookup, isMm, isRollup } from '#imports'
import HasMany from '~/components/virtual-cell/HasMany.vue'
import ManyToMany from '~/components/virtual-cell/ManyToMany.vue'
import BelongsTo from '~/components/virtual-cell/BelongsTo.vue'
import Lookup from '~/components/virtual-cell/Lookup.vue'
import Rollup from '~/components/virtual-cell/Rollup.vue'
import Formula from '~/components/virtual-cell/Formula.vue'
import Count from '~/components/virtual-cell/Count.vue'
export function useVirtualCell(column: Ref<ColumnType | undefined>) {
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 computed(() => {
if (!column.value) return null
return {
isHm,
isMm,
isBt,
isLookup,
isRollup,
isFormula,
isCount,
}
if (isHm(column.value)) return HasMany
if (isMm(column.value)) return ManyToMany
if (isBt(column.value)) return BelongsTo
if (isLookup(column.value)) return Lookup
if (isRollup(column.value)) return Rollup
if (isFormula(column.value)) return Formula
if (isCount(column.value)) return Count
})
}

59
packages/nc-gui/utils/cell.ts

@ -0,0 +1,59 @@
import type { ColumnType, ProjectType } from 'nocodb-sdk'
import { SqlUiFactory, UITypes, isVirtualCol } from 'nocodb-sdk'
export const abstractType = (column: ColumnType, project: ProjectType) => {
// kludge: CY test hack; column.value is being received NULL during attach cell delete operation
return (column && isVirtualCol(column)) || !column
? null
: SqlUiFactory.create(project.bases?.[0]?.type ? { client: project.bases[0].type } : { client: 'mysql2' }).getAbstractType(
column,
)
}
export const dataTypeLow = (column: ColumnType) => column.dt?.toLowerCase()
export const isBoolean = (abstractType: any) => abstractType === 'boolean'
export const isString = (column: ColumnType, abstractType: any) =>
column.uidt === UITypes.SingleLineText || abstractType === 'string'
export const isTextArea = (column: ColumnType) => column.uidt === UITypes.LongText
export const isInt = (column: ColumnType, abstractType: any) => abstractType === 'integer'
export const isFloat = (column: ColumnType, abstractType: any) => abstractType === 'float' || abstractType === UITypes.Number
export const isDate = (column: ColumnType, abstractType: any) => abstractType === 'date' || column.uidt === UITypes.Date
export const isYear = (column: ColumnType, abstractType: any) => abstractType === 'year' || column.uidt === UITypes.Year
export const isTime = (column: ColumnType, abstractType: any) => abstractType === 'time' || column.uidt === UITypes.Time
export const isDateTime = (column: ColumnType, abstractType: any) =>
abstractType === 'datetime' || column.uidt === UITypes.DateTime
export const isJSON = (column: ColumnType) => column.uidt === UITypes.JSON
export const isEnum = (column: ColumnType) => column.uidt === UITypes.SingleSelect
export const isSingleSelect = (column: ColumnType) => column.uidt === UITypes.SingleSelect
export const isSet = (column: ColumnType) => column.uidt === UITypes.MultiSelect
export const isMultiSelect = (column: ColumnType) => column.uidt === UITypes.MultiSelect
export const isURL = (column: ColumnType) => column.uidt === UITypes.URL
export const isEmail = (column: ColumnType) => column.uidt === UITypes.Email
export const isAttachment = (column: ColumnType) => column.uidt === UITypes.Attachment
export const isRating = (column: ColumnType) => column.uidt === UITypes.Rating
export const isCurrency = (column: ColumnType) => column.uidt === UITypes.Currency
export const isPhoneNumber = (column: ColumnType) => column.uidt === UITypes.PhoneNumber
export const isDecimal = (column: ColumnType) => column.uidt === UITypes.Decimal
export const isDuration = (column: ColumnType) => column.uidt === UITypes.Duration
export const isPercent = (column: ColumnType) => column.uidt === UITypes.Percent
export const isSpecificDBType = (column: ColumnType) => column.uidt === UITypes.SpecificDBType
export const isAutoSaved = (column: ColumnType) =>
[
UITypes.SingleLineText,
UITypes.LongText,
UITypes.PhoneNumber,
UITypes.Email,
UITypes.URL,
UITypes.Number,
UITypes.Decimal,
UITypes.Percent,
UITypes.Count,
UITypes.AutoNumber,
UITypes.SpecificDBType,
UITypes.Geometry,
].includes(column.uidt as UITypes)
export const isManualSaved = (column: ColumnType) =>
[UITypes.Currency, UITypes.Year, UITypes.Time, UITypes.Duration].includes(column.uidt as UITypes)
export const isPrimary = (column: ColumnType) => column.pv

4
packages/nc-gui/utils/parsers/parserHelpers.ts

@ -1,6 +1,6 @@
import { UITypes } from 'nocodb-sdk'
import { isValidURL } from '~/utils/urlUtils'
import { isEmail } from '~/utils/validation'
import { validateEmail } from '~/utils/validation'
const booleanOptions = [
{ checked: true, unchecked: false },
@ -109,7 +109,7 @@ export const isDecimalType = (colData: []) =>
export const isEmailType = (colData: []) =>
colData.some((v: any) => {
return v && isEmail(v)
return v && validateEmail(v)
})
export const isUrlType = (colData: []) =>

2
packages/nc-gui/utils/validation.ts

@ -1,6 +1,6 @@
import { getI18n } from '~/plugins/a.i18n'
export const isEmail = (v: string) =>
export const validateEmail = (v: string) =>
/^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i.test(v)
export const validateTableName = {

16
packages/nc-gui/utils/virtualCell.ts

@ -0,0 +1,16 @@
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
import { RelationTypes, UITypes } from 'nocodb-sdk'
export const isHm = (column: ColumnType) =>
column.uidt === UITypes.LinkToAnotherRecord && (<LinkToAnotherRecordType>column.colOptions).type === RelationTypes.HAS_MANY
export const isMm = (column: ColumnType) =>
column.uidt === UITypes.LinkToAnotherRecord && (<LinkToAnotherRecordType>column.colOptions).type === RelationTypes.MANY_TO_MANY
export const isBt = (column: ColumnType) =>
column.uidt === UITypes.LinkToAnotherRecord && (<LinkToAnotherRecordType>column.colOptions).type === RelationTypes.BELONGS_TO
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 isCount = (column: ColumnType) => column.uidt === UITypes.Count
Loading…
Cancel
Save