From c0266c007f384659ef556fd5b4b21a9fdd3ecaba Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 29 Dec 2022 13:03:18 +0530 Subject: [PATCH 1/3] fix(gui): encode id to escape special chars in url re #4704 Signed-off-by: Pranav C --- packages/nc-gui/composables/useViewData.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/composables/useViewData.ts b/packages/nc-gui/composables/useViewData.ts index 643d23100a..b572c9aea2 100644 --- a/packages/nc-gui/composables/useViewData.ts +++ b/packages/nc-gui/composables/useViewData.ts @@ -264,7 +264,7 @@ export function useViewData( project?.value.id as string, metaValue?.id as string, viewMetaValue?.id as string, - id, + encodeURIComponent(id), { // if value is undefined treat it as null [property]: toUpdate.row[property] ?? null, @@ -275,7 +275,7 @@ export function useViewData( // } ) // audit - $api.utils.auditRowUpdate(id, { + $api.utils.auditRowUpdate(encodeURIComponent(id), { fk_model_id: metaValue?.id as string, column_name: property, row_id: id, From d395d643bbc835df3adbc0beeb13e20ca80d8444 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 29 Dec 2022 13:09:49 +0530 Subject: [PATCH 2/3] fix(gui): treat empty string as null for number fields re #4701 Signed-off-by: Pranav C --- packages/nc-gui/components/cell/Decimal.vue | 13 ++++++++++++- packages/nc-gui/components/cell/Float.vue | 13 ++++++++++++- packages/nc-gui/components/cell/Integer.vue | 13 ++++++++++++- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui/components/cell/Decimal.vue b/packages/nc-gui/components/cell/Decimal.vue index 5e7ed247e3..0529cb206e 100644 --- a/packages/nc-gui/components/cell/Decimal.vue +++ b/packages/nc-gui/components/cell/Decimal.vue @@ -16,7 +16,18 @@ const emits = defineEmits() 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() diff --git a/packages/nc-gui/components/cell/Float.vue b/packages/nc-gui/components/cell/Float.vue index 86c8a47cba..44e9babee2 100644 --- a/packages/nc-gui/components/cell/Float.vue +++ b/packages/nc-gui/components/cell/Float.vue @@ -16,7 +16,18 @@ const emits = defineEmits() 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() diff --git a/packages/nc-gui/components/cell/Integer.vue b/packages/nc-gui/components/cell/Integer.vue index e9103ea54f..7b4426925f 100644 --- a/packages/nc-gui/components/cell/Integer.vue +++ b/packages/nc-gui/components/cell/Integer.vue @@ -16,7 +16,18 @@ const emits = defineEmits() 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() From aeda11d5ca4e16d2730b7082a70b863ffa3da0f8 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 29 Dec 2022 13:24:43 +0530 Subject: [PATCH 3/3] fix(gui): lookup and rollup - show readonly warning only when necessary re #4702 Signed-off-by: Pranav C --- .../nc-gui/components/virtual-cell/Lookup.vue | 27 +++++-------------- .../nc-gui/components/virtual-cell/Rollup.vue | 17 +++++------- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/packages/nc-gui/components/virtual-cell/Lookup.vue b/packages/nc-gui/components/virtual-cell/Lookup.vue index b358296361..02201a6769 100644 --- a/packages/nc-gui/components/virtual-cell/Lookup.vue +++ b/packages/nc-gui/components/virtual-cell/Lookup.vue @@ -12,8 +12,8 @@ import { isAttachment, provide, ref, - refAutoReset, useMetas, + useShowNotEditableWarning, watch, } from '#imports' @@ -75,26 +75,13 @@ provide(MetaInj, lookupTableMeta) provide(CellUrlDisableOverlayInj, ref(true)) -const timeout = 3000 // in ms - -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 - } -}) +const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning, activateShowEditNonEditableFieldWarning } = + useShowNotEditableWarning()