From 7d132e3015c90adae004a0f56a29865421079b9e Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Fri, 30 Sep 2022 10:07:13 +0200 Subject: [PATCH] refactor(nc-gui): use lazy load for virtual cell --- .../components/smartsheet/VirtualCell.vue | 30 +++++-------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/VirtualCell.vue b/packages/nc-gui/components/smartsheet/VirtualCell.vue index 9b5fea1571..597562b75f 100644 --- a/packages/nc-gui/components/smartsheet/VirtualCell.vue +++ b/packages/nc-gui/components/smartsheet/VirtualCell.vue @@ -6,7 +6,6 @@ import { ColumnInj, FormInj, RowInj, - computed, isBt, isCount, isFormula, @@ -19,13 +18,6 @@ import { } from '#imports' import type { Row } from '~/lib' import { NavigateDir } from '~/lib' -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' const props = defineProps<{ column: ColumnType @@ -45,20 +37,6 @@ provide(ActiveCellInj, active) provide(RowInj, row) provide(CellValueInj, toRef(props, 'modelValue')) -const isForm = inject(IsFormInj, ref(false)) - -const virtualCell = computed(() => { - if (!column.value) return null - - 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 -}) - function onNavigate(dir: NavigateDir, e: KeyboardEvent) { emit('navigate', dir) @@ -72,6 +50,12 @@ function onNavigate(dir: NavigateDir, e: KeyboardEvent) { @keydown.enter.exact="onNavigate(NavigateDir.NEXT, $event)" @keydown.shift.enter.exact="onNavigate(NavigateDir.PREV, $event)" > - + + + + + + +