Browse Source

feat(api): show warning for virtual cells when enter or delete key press

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4222/head
Pranav C 2 years ago
parent
commit
64f55b841a
  1. 10
      packages/nc-gui/components/cell/Checkbox.vue
  2. 6
      packages/nc-gui/components/smartsheet/Grid.vue
  3. 12
      packages/nc-gui/components/virtual-cell/Formula.vue
  4. 12
      packages/nc-gui/components/virtual-cell/Lookup.vue
  5. 12
      packages/nc-gui/components/virtual-cell/Rollup.vue

10
packages/nc-gui/components/cell/Checkbox.vue

@ -1,13 +1,5 @@
<script setup lang="ts">
import {
ActiveCellInj,
ColumnInj,
IsFormInj,
ReadonlyInj,
getMdiIcon,
inject,
useSelectedCellKeyupListener,
} from '#imports'
import { ActiveCellInj, ColumnInj, IsFormInj, ReadonlyInj, getMdiIcon, inject, useSelectedCellKeyupListener } from '#imports'
interface Props {
// If the previous cell value was a text, the initial checkbox value is a string type

6
packages/nc-gui/components/smartsheet/Grid.vue

@ -22,6 +22,7 @@ import {
extractPkFromRow,
inject,
isColumnRequiredAndNull,
isMac,
message,
onBeforeUnmount,
onClickOutside,
@ -39,9 +40,7 @@ import {
useUIPermission,
useViewData,
watch,
isMac,
} from '#imports'
import { switchAll } from 'rxjs'
import type { Row } from '~/lib'
import { NavigateDir } from '~/lib'
@ -163,6 +162,7 @@ const getContainerScrollForElement = (
return scroll
}
const { selectCell, selectBlock, selectedRange, clearRangeRows, startSelectRange, selected } = useMultiSelect(
fields,
data,
@ -251,7 +251,7 @@ function scrollToCell(row?: number | null, col?: number | null) {
behavior: 'smooth',
})
}
}
}
onMounted(loadGridViewColumns)

12
packages/nc-gui/components/virtual-cell/Formula.vue

@ -1,4 +1,5 @@
<script lang="ts" setup>
import { message } from 'ant-design-vue'
import type { ColumnType } from 'nocodb-sdk'
import type { Ref } from 'vue'
import { CellValueInj, ColumnInj, computed, handleTZ, inject, ref, replaceUrlsWithLink, useProject } from '#imports'
@ -23,6 +24,17 @@ const showEditFormulaWarningMessage = () => {
const result = computed(() => (isPg.value ? handleTZ(cellValue?.value) : cellValue?.value))
const urls = computed(() => replaceUrlsWithLink(result.value))
useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEvent) => {
switch (e.key) {
case 'Enter':
message.warning('Formula fields should be configured in the field menu dropdown')
break
case 'Delete':
message.warning('Computed field: unable to clear text')
break
}
})
</script>
<template>

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

@ -1,4 +1,5 @@
<script lang="ts" setup>
import { message } from 'ant-design-vue'
import type { ColumnType, LinkToAnotherRecordType, LookupType } from 'nocodb-sdk'
import { RelationTypes, UITypes, isVirtualCol } from 'nocodb-sdk'
import type { Ref } from 'vue'
@ -46,6 +47,17 @@ provide(MetaInj, lookupTableMeta)
provide(CellUrlDisableOverlayInj, ref(true))
const lookupColumnMetaProps = useColumn(lookupColumn)
useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEvent) => {
switch (e.key) {
case 'Enter':
message.warning('Computed field: unable to edit')
break
case 'Delete':
message.warning('Computed field: unable to clear text')
break
}
})
</script>
<template>

12
packages/nc-gui/components/virtual-cell/Rollup.vue

@ -1,7 +1,19 @@
<script setup lang="ts">
import { message } from 'ant-design-vue'
import { CellValueInj, inject } from '#imports'
const value = inject(CellValueInj)
useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEvent) => {
switch (e.key) {
case 'Enter':
message.warning('Computed field: unable to edit')
break
case 'Delete':
message.warning('Computed field: unable to clear text')
break
}
})
</script>
<template>

Loading…
Cancel
Save