From 01d20e2b04b12671c8cf378347f278831638e82d Mon Sep 17 00:00:00 2001 From: mertmit Date: Fri, 3 May 2024 20:31:06 +0000 Subject: [PATCH 1/5] 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) => { From f43d442a6212fb3bfabc649b9a2d1e6bc3f1c365 Mon Sep 17 00:00:00 2001 From: mertmit Date: Fri, 3 May 2024 20:31:07 +0000 Subject: [PATCH 2/5] fix: avoid changing sources on deleting active table --- packages/nc-gui/components/dlg/TableDelete.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/dlg/TableDelete.vue b/packages/nc-gui/components/dlg/TableDelete.vue index 59f5d41dc2..3180b60f7a 100644 --- a/packages/nc-gui/components/dlg/TableDelete.vue +++ b/packages/nc-gui/components/dlg/TableDelete.vue @@ -79,8 +79,9 @@ const onDelete = async () => { $e('a:table:delete') if (oldActiveTableId === toBeDeletedTable.id) { + const sourceTables = tables.value.filter((t) => t.source_id === toBeDeletedTable.source_id) // Navigate to base if no tables left or open first table - if (tables.value.length === 0) { + if (sourceTables.length === 0) { await navigateTo( baseUrl({ id: props.baseId, @@ -88,7 +89,7 @@ const onDelete = async () => { }), ) } else { - await openTable(tables.value[0]) + await openTable(sourceTables[0]) } } From 2a788d405a8a93ac0e1691d50386f6a156e6e964 Mon Sep 17 00:00:00 2001 From: mertmit Date: Fri, 3 May 2024 20:31:07 +0000 Subject: [PATCH 3/5] fix: rating row height --- packages/nc-gui/components/cell/Rating.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/components/cell/Rating.vue b/packages/nc-gui/components/cell/Rating.vue index c189173351..bcc8d5114f 100644 --- a/packages/nc-gui/components/cell/Rating.vue +++ b/packages/nc-gui/components/cell/Rating.vue @@ -22,6 +22,8 @@ const column = inject(ColumnInj)! const readOnly = inject(ReadonlyInj, ref(false)) +const rowHeight = inject(RowHeightInj, ref(undefined)) + const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! const ratingMeta = computed(() => { @@ -78,7 +80,15 @@ watch(rateDomRef, () => { :disabled="readOnly" :count="ratingMeta.max" :class="readOnly ? 'pointer-events-none' : ''" - :style="`color: ${ratingMeta.color}; padding: ${isExpandedFormOpen ? '0px 8px' : '0px 2px'};`" + :style="{ + 'color': ratingMeta.color, + 'padding': isExpandedFormOpen ? '0px 8px' : '0px 2px', + 'display': '-webkit-box', + 'max-width': '100%', + '-webkit-line-clamp': rowHeightTruncateLines(rowHeight), + '-webkit-box-orient': 'vertical', + 'overflow': 'hidden', + }" @keydown="onKeyPress" >