Browse Source

refactor: treat it as virtual columns

pull/7304/head
Pranav C 11 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"> <script setup lang="ts">
import { ReadonlyInj, provide, ref } from '#imports' import { ReadonlyInj, provide, ref, EditModeInj, ActiveCellInj } from '#imports'
interface Props { interface Props {
modelValue?: string | null modelValue?: string | null
@ -8,8 +8,13 @@ interface Props {
defineProps<Props>() defineProps<Props>()
provide(ReadonlyInj, ref(true)) provide(ReadonlyInj, ref(true))
provide(EditModeInj, ref(true))
provide(ActiveCellInj, ref(true))
</script> </script>
<template> <template>
<CellDateTimePicker :model-value="modelValue" :is-pk="false" /> <LazyCellDateTimePicker :model-value="modelValue" :is-pk="false" />
</template> </template>

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

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

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

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

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

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

Loading…
Cancel
Save