Browse Source

refactor: treat it as virtual columns

pull/7304/head
Pranav C 9 months ago
parent
commit
26da9d7bf0
  1. 9
      packages/nc-gui/components/cell/ReadOnlyDateTimePicker.vue
  2. 1
      packages/nc-gui/components/smartsheet/Cell.vue
  3. 2
      packages/nc-gui/components/smartsheet/VirtualCell.vue
  4. 2
      packages/nocodb-sdk/src/lib/UITypes.ts

9
packages/nc-gui/components/cell/ReadOnlyDateTimePicker.vue

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ReadonlyInj, provide, ref } from '#imports'
import { ReadonlyInj, provide, ref, EditModeInj, ActiveCellInj } from '#imports'
interface Props {
modelValue?: string | null
@ -8,8 +8,13 @@ interface Props {
defineProps<Props>()
provide(ReadonlyInj, ref(true))
provide(EditModeInj, ref(true))
provide(ActiveCellInj, ref(true))
</script>
<template>
<CellDateTimePicker :model-value="modelValue" :is-pk="false" />
<LazyCellDateTimePicker :model-value="modelValue" :is-pk="false" />
</template>

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

@ -228,7 +228,6 @@ onUnmounted(() => {
:disable-option-creation="!!isEditColumnMenu"
:row-index="props.rowIndex"
/>
<LazyCellReadOnlyDateTimePicker v-else-if="isCreatedTimeOrUpdatedTimeCol(column)" :model-value="vModel" />
<LazyCellDatePicker v-else-if="isDate(column, abstractType)" v-model="vModel" :is-pk="isPrimaryKey(column)" />
<LazyCellYearPicker v-else-if="isYear(column, abstractType)" v-model="vModel" :is-pk="isPrimaryKey(column)" />
<LazyCellDateTimePicker

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

@ -1,5 +1,6 @@
<script setup lang="ts">
import type { ColumnType } from 'nocodb-sdk'
import { isCreatedTimeOrUpdatedTimeCol } from 'nocodb-sdk'
import {
ActiveCellInj,
CellValueInj,
@ -114,6 +115,7 @@ onUnmounted(() => {
<LazyVirtualCellBarcode v-else-if="isBarcode(column)" />
<LazyVirtualCellCount v-else-if="isCount(column)" />
<LazyVirtualCellLookup v-else-if="isLookup(column)" />
<LazyCellReadOnlyDateTimePicker v-else-if="isCreatedTimeOrUpdatedTimeCol(column)" :model-value="row && row.row && row.row[column.title]" />
</template>
</div>
</template>

2
packages/nocodb-sdk/src/lib/UITypes.ts

@ -83,6 +83,8 @@ export function isVirtualCol(
UITypes.Rollup,
UITypes.Lookup,
UITypes.Links,
UITypes.CreateTime,
UITypes.LastModifiedTime,
// UITypes.Count,
].includes(<UITypes>(typeof col === 'object' ? col?.uidt : col));
}

Loading…
Cancel
Save