Browse Source

Merge pull request #4715 from nocodb/fix/misc-bugs

Miscellaneous bug fixes
pull/4716/head
Raju Udava 2 years ago committed by GitHub
parent
commit
1212225811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      packages/nc-gui/components/cell/Decimal.vue
  2. 13
      packages/nc-gui/components/cell/Float.vue
  3. 13
      packages/nc-gui/components/cell/Integer.vue
  4. 27
      packages/nc-gui/components/virtual-cell/Lookup.vue
  5. 17
      packages/nc-gui/components/virtual-cell/Rollup.vue
  6. 4
      packages/nc-gui/composables/useViewData.ts

13
packages/nc-gui/components/cell/Decimal.vue

@ -16,7 +16,18 @@ const emits = defineEmits<Emits>()
const editEnabled = inject(EditModeInj) const editEnabled = inject(EditModeInj)
const vModel = useVModel(props, 'modelValue', emits) const _vModel = useVModel(props, 'modelValue', emits)
const vModel = computed({
get: () => _vModel.value,
set: (value: string) => {
if (value === '') {
_vModel.value = null
} else {
_vModel.value = value
}
},
})
const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus() const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
</script> </script>

13
packages/nc-gui/components/cell/Float.vue

@ -16,7 +16,18 @@ const emits = defineEmits<Emits>()
const editEnabled = inject(EditModeInj) const editEnabled = inject(EditModeInj)
const vModel = useVModel(props, 'modelValue', emits) const _vModel = useVModel(props, 'modelValue', emits)
const vModel = computed({
get: () => _vModel.value,
set: (value: string) => {
if (value === '') {
_vModel.value = null
} else {
_vModel.value = value
}
},
})
const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus() const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus()
</script> </script>

13
packages/nc-gui/components/cell/Integer.vue

@ -16,7 +16,18 @@ const emits = defineEmits<Emits>()
const editEnabled = inject(EditModeInj) const editEnabled = inject(EditModeInj)
const vModel = useVModel(props, 'modelValue', emits) const _vModel = useVModel(props, 'modelValue', emits)
const vModel = computed({
get: () => _vModel.value,
set: (value: string) => {
if (value === '') {
_vModel.value = null
} else {
_vModel.value = value
}
},
})
const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus() const focus: VNodeRef = (el) => (el as HTMLInputElement)?.focus()

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

@ -12,8 +12,8 @@ import {
isAttachment, isAttachment,
provide, provide,
ref, ref,
refAutoReset,
useMetas, useMetas,
useShowNotEditableWarning,
watch, watch,
} from '#imports' } from '#imports'
@ -75,26 +75,13 @@ provide(MetaInj, lookupTableMeta)
provide(CellUrlDisableOverlayInj, ref(true)) provide(CellUrlDisableOverlayInj, ref(true))
const timeout = 3000 // in ms const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning, activateShowEditNonEditableFieldWarning } =
useShowNotEditableWarning()
const showEditWarning = refAutoReset(false, timeout)
const showClearWarning = refAutoReset(false, timeout)
useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEvent) => {
switch (e.key) {
case 'Enter':
showEditWarning.value = true
break
default:
showClearWarning.value = true
}
})
</script> </script>
<template> <template>
<div class="h-full"> <div class="h-full" @dblclick="activateShowEditNonEditableFieldWarning">
<div class="h-full flex gap-1 overflow-x-auto p-1" @dblclick="showEditWarning = true"> <div class="h-full flex gap-1 overflow-x-auto p-1">
<template v-if="lookupColumn"> <template v-if="lookupColumn">
<!-- Render virtual cell --> <!-- Render virtual cell -->
<div v-if="isVirtualCol(lookupColumn)"> <div v-if="isVirtualCol(lookupColumn)">
@ -133,10 +120,10 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEven
</template> </template>
</div> </div>
<div> <div>
<div v-if="showEditWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs"> <div v-if="showEditNonEditableFieldWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
{{ $t('msg.info.computedFieldEditWarning') }} {{ $t('msg.info.computedFieldEditWarning') }}
</div> </div>
<div v-if="showClearWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs"> <div v-if="showClearNonEditableFieldWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
{{ $t('msg.info.computedFieldDeleteWarning') }} {{ $t('msg.info.computedFieldDeleteWarning') }}
</div> </div>
</div> </div>

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

@ -1,28 +1,23 @@
<script setup lang="ts"> <script setup lang="ts">
import { CellValueInj, inject, refAutoReset } from '#imports' import { CellValueInj, inject, useShowNotEditableWarning } from '#imports'
const value = inject(CellValueInj) const value = inject(CellValueInj)
const timeout = 3000 // in ms const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning, activateShowEditNonEditableFieldWarning } =
useShowNotEditableWarning()
const showEditWarning = refAutoReset(false, timeout)
const showClearWarning = refAutoReset(false, timeout)
useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), () => (showClearWarning.value = true))
</script> </script>
<template> <template>
<div> <div @dblclick="activateShowEditNonEditableFieldWarning">
<span class="text-center pl-3"> <span class="text-center pl-3">
{{ value }} {{ value }}
</span> </span>
<div> <div>
<div v-if="showEditWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs"> <div v-if="showEditNonEditableFieldWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
{{ $t('msg.info.computedFieldEditWarning') }} {{ $t('msg.info.computedFieldEditWarning') }}
</div> </div>
<div v-if="showClearWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs"> <div v-if="showClearNonEditableFieldWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
{{ $t('msg.info.computedFieldDeleteWarning') }} {{ $t('msg.info.computedFieldDeleteWarning') }}
</div> </div>
</div> </div>

4
packages/nc-gui/composables/useViewData.ts

@ -264,7 +264,7 @@ export function useViewData(
project?.value.id as string, project?.value.id as string,
metaValue?.id as string, metaValue?.id as string,
viewMetaValue?.id as string, viewMetaValue?.id as string,
id, encodeURIComponent(id),
{ {
// if value is undefined treat it as null // if value is undefined treat it as null
[property]: toUpdate.row[property] ?? null, [property]: toUpdate.row[property] ?? null,
@ -275,7 +275,7 @@ export function useViewData(
// } // }
) )
// audit // audit
$api.utils.auditRowUpdate(id, { $api.utils.auditRowUpdate(encodeURIComponent(id), {
fk_model_id: metaValue?.id as string, fk_model_id: metaValue?.id as string,
column_name: property, column_name: property,
row_id: id, row_id: id,

Loading…
Cancel
Save