From 742a68deb06d0a624a6b259d4e18c13f38ea7832 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Sat, 12 Nov 2022 10:18:26 +0530 Subject: [PATCH] fix(gui): if expanded form is active skip grid view keyboard event actions Signed-off-by: Pranav C --- packages/nc-gui/components/smartsheet/Grid.vue | 14 ++++++++++++-- .../components/smartsheet/expanded-form/index.vue | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index 1a8666e3d5..7ce1602d06 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -181,6 +181,11 @@ const { selectCell, selectBlock, selectedRange, clearRangeRows, startSelectRange return true } + // if expanded form is active skip keyboard event handling + if (document.querySelector('.nc-drawer-expanded-form.active')) { + return true + } + const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey if (e.key === ' ') { if (selected.row !== null && !editEnabled) { @@ -407,6 +412,11 @@ onClickOutside(smartTable, (e) => { ) return + // if expanded form is active skip resetting the active cell + if (document.querySelector('.nc-drawer-expanded-form.active')) { + return + } + selected.row = null selected.col = null }) @@ -457,8 +467,8 @@ const saveOrUpdateRecords = async (args: { metaValue?: TableType; viewMetaValue? currentRow.rowMeta.changed = false for (const field of (args.metaValue || meta.value)?.columns ?? []) { if (isVirtualCol(field)) continue - if (field.title! in currentRow.row && currentRow.row[field.title!] !== currentRow.oldRow[field.title!]) { - await updateOrSaveRow(currentRow, field.title!, {}, args) + if (currentRow.row[field.title!] !== currentRow.oldRow[field.title!]) { + await updateOrSaveRow(currentRow, field.title!, args) } } } diff --git a/packages/nc-gui/components/smartsheet/expanded-form/index.vue b/packages/nc-gui/components/smartsheet/expanded-form/index.vue index 10e48615cf..8b862c0e50 100644 --- a/packages/nc-gui/components/smartsheet/expanded-form/index.vue +++ b/packages/nc-gui/components/smartsheet/expanded-form/index.vue @@ -137,6 +137,7 @@ export default { :body-style="{ 'padding': 0, 'display': 'flex', 'flex-direction': 'column' }" :closable="false" class="nc-drawer-expanded-form" + :class="{ 'active': isExpanded }" >