From 01d20e2b04b12671c8cf378347f278831638e82d Mon Sep 17 00:00:00 2001 From: mertmit Date: Fri, 3 May 2024 20:31:06 +0000 Subject: [PATCH] fix: keep selection while resizing column --- packages/nc-gui/components/smartsheet/grid/Table.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/nc-gui/components/smartsheet/grid/Table.vue b/packages/nc-gui/components/smartsheet/grid/Table.vue index 8a5ee4eecf..762857d532 100644 --- a/packages/nc-gui/components/smartsheet/grid/Table.vue +++ b/packages/nc-gui/components/smartsheet/grid/Table.vue @@ -204,6 +204,8 @@ const { height: tableHeadHeight, width: _tableHeadWidth } = useElementBounding(t const isViewColumnsLoading = computed(() => _isViewColumnsLoading.value || !meta.value) +const resizingColumn = ref(false) + // #Permissions const { isUIAllowed } = useRoles() const hasEditPermission = computed(() => isUIAllowed('dataEdit')) @@ -855,6 +857,11 @@ const deleteSelectedRangeOfRows = () => { } const selectColumn = (columnId: string) => { + // this is triggered with click event, so do nothing & clear resizingColumn flag if it's true + if (resizingColumn.value) { + resizingColumn.value = false + return + } const colIndex = fields.value.findIndex((col) => col.id === columnId) if (colIndex !== -1) { makeActive(0, colIndex) @@ -870,6 +877,10 @@ onClickOutside(tableBodyEl, (e) => { return } + if (resizingColumn.value) { + return + } + // do nothing if context menu was open if (contextMenu.value) return @@ -1117,6 +1128,7 @@ const onXcResizing = (cn: string | undefined, event: any) => { const onXcStartResizing = (cn: string | undefined, event: any) => { if (!cn) return resizingColOldWith.value = event.detail + resizingColumn.value = true } const loadColumn = (title: string, tp: string, colOptions?: any) => {