Browse Source

chore(nc-gui): cleanup abstractType computed

pull/3847/head
braks 2 years ago
parent
commit
612978758c
  1. 8
      packages/nc-gui/components/smartsheet/Cell.vue
  2. 6
      packages/nc-gui/components/smartsheet/header/CellIcon.ts
  3. 2
      packages/nc-gui/components/smartsheet/header/VirtualCellIcon.vue

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

@ -1,6 +1,5 @@
<script setup lang="ts">
import type { ColumnType } from 'nocodb-sdk'
import { isVirtualCol, UITypes } from 'nocodb-sdk'
import {
ActiveCellInj,
ColumnInj,
@ -84,10 +83,7 @@ const { currentRow } = useSmartsheetRowStoreOrThrow()
const { sqlUi } = 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 : sqlUi.value.getAbstractType(column.value)
})
const abstractType = computed(() => column.value && sqlUi.value.getAbstractType(column.value))
const syncValue = useDebounceFn(() => {
currentRow.value.rowMeta.changed = false
@ -133,6 +129,7 @@ const syncAndNavigate = (dir: NavigateDir, e: KeyboardEvent) => {
@keydown.enter.exact="syncAndNavigate(NavigateDir.NEXT, $event)"
@keydown.shift.enter.exact="syncAndNavigate(NavigateDir.PREV, $event)"
>
<template v-if="column">
<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" />
@ -160,5 +157,6 @@ const syncAndNavigate = (dir: NavigateDir, e: KeyboardEvent) => {
class="nc-locked-overlay"
@click.stop.prevent
/>
</template>
</div>
</template>

6
packages/nc-gui/components/smartsheet/header/CellIcon.ts

@ -1,6 +1,5 @@
import type { ColumnType } from 'nocodb-sdk'
import type { PropType } from '@vue/runtime-core'
import { isVirtualCol } from 'nocodb-sdk'
import {
ColumnInj,
computed,
@ -122,10 +121,7 @@ export default defineComponent({
const { sqlUi } = useProject()
const abstractType = computed(() => {
// kludge: CY test hack; column is being received NULL during attach cell delete operation
return (column.value && isVirtualCol(column.value)) || !column.value ? null : sqlUi.value.getAbstractType(column.value)
})
const abstractType = computed(() => column.value && sqlUi.value.getAbstractType(column.value))
return () => {
if (!column.value) return null

2
packages/nc-gui/components/smartsheet/header/VirtualCellIcon.vue

@ -34,7 +34,7 @@ if (column) {
const icon = computed(() => {
switch (column.value?.uidt) {
case UITypes.LinkToAnotherRecord:
switch ((column.value?.colOptions as LinkToAnotherRecordType)?.type) {
switch ((column.value.colOptions as LinkToAnotherRecordType)?.type) {
case RelationTypes.MANY_TO_MANY:
return { icon: MMIcon, color: 'text-accent' }
case RelationTypes.HAS_MANY:

Loading…
Cancel
Save