diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index a03b8b9635..216494d844 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -112,7 +112,7 @@ const expandedFormRow = ref() const expandedFormRowState = ref>() const gridWrapper = ref() const tableHeadEl = ref() -const tableBodyEl = ref() +const tableBodyEl = ref() const fillHandle = ref() const gridRect = useElementBounding(gridWrapper) @@ -917,8 +917,6 @@ function addEmptyRow(row?: number) { const fillHandleTop = ref() const fillHandleLeft = ref() -const cellRefs = ref<{ el: HTMLElement }[]>([]) - const showFillHandle = computed( () => !readOnly.value && @@ -929,17 +927,15 @@ const showFillHandle = computed( ) const refreshFillHandle = () => { - const cellRef = cellRefs.value.find( - (cell) => - cell.el.dataset.rowIndex === String(isNaN(selectedRange.end.row) ? activeCell.row : selectedRange.end.row) && - cell.el.dataset.colIndex === String(isNaN(selectedRange.end.col) ? activeCell.col : selectedRange.end.col), - ) - if (cellRef) { - const cellRect = useElementBounding(cellRef.el) - if (!cellRect || !gridWrapper.value) return - fillHandleTop.value = cellRect.top.value + cellRect.height.value - gridRect.top.value + gridWrapper.value.scrollTop - fillHandleLeft.value = cellRect.left.value + cellRect.width.value - gridRect.left.value + gridWrapper.value.scrollLeft - } + nextTick(() => { + const cellRef = document.querySelector('.last-cell') + if (cellRef) { + const cellRect = cellRef.getBoundingClientRect() + if (!cellRect || !gridWrapper.value) return + fillHandleTop.value = cellRect.top + cellRect.height - gridRect.top.value + gridWrapper.value.scrollTop + fillHandleLeft.value = cellRect.left + cellRect.width - gridRect.left.value + gridWrapper.value.scrollLeft + } + }) } const addRowExpandOnClose = (row: Row) => { @@ -1132,7 +1128,6 @@ useEventListener(document, 'mouseup', () => { -import { ColumnType, isVirtualCol } from 'nocodb-sdk' +import type { ColumnType } from 'nocodb-sdk' +import { isVirtualCol } from 'nocodb-sdk' const { column } = defineProps<{ column: ColumnType }>() -