Browse Source

fix: use dynamic class to select last cell

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/6088/head
mertmit 1 year ago
parent
commit
e6fb3eaa27
  1. 23
      packages/nc-gui/components/smartsheet/Grid.vue

23
packages/nc-gui/components/smartsheet/Grid.vue

@ -927,17 +927,15 @@ const showFillHandle = computed(
) )
const refreshFillHandle = () => { const refreshFillHandle = () => {
const cellRef = [...(tableBodyEl.value?.querySelectorAll<HTMLTableCellElement>('td[data-row-index]') || [])].find( nextTick(() => {
(cell) => const cellRef = document.querySelector('.last-cell')
cell.dataset.rowIndex === String(isNaN(selectedRange.end.row) ? activeCell.row : selectedRange.end.row) && if (cellRef) {
cell.dataset.colIndex === String(isNaN(selectedRange.end.col) ? activeCell.col : selectedRange.end.col), const cellRect = cellRef.getBoundingClientRect()
) if (!cellRect || !gridWrapper.value) return
if (cellRef) { fillHandleTop.value = cellRect.top + cellRect.height - gridRect.top.value + gridWrapper.value.scrollTop
const cellRect = cellRef.getBoundingClientRect() fillHandleLeft.value = cellRect.left + cellRect.width - gridRect.left.value + gridWrapper.value.scrollLeft
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) => { const addRowExpandOnClose = (row: Row) => {
@ -1138,6 +1136,9 @@ useEventListener(document, 'mouseup', () => {
hasEditPermission && hasEditPermission &&
((activeCell.row === rowIndex && activeCell.col === colIndex) || ((activeCell.row === rowIndex && activeCell.col === colIndex) ||
(selectedRange._start?.row === rowIndex && selectedRange._start?.col === colIndex)), (selectedRange._start?.row === rowIndex && selectedRange._start?.col === colIndex)),
'last-cell':
rowIndex === (isNaN(selectedRange.end.row) ? activeCell.row : selectedRange.end.row) &&
colIndex === (isNaN(selectedRange.end.col) ? activeCell.col : selectedRange.end.col),
'nc-required-cell': isColumnRequiredAndNull(columnObj, row.row), 'nc-required-cell': isColumnRequiredAndNull(columnObj, row.row),
'align-middle': !rowHeight || rowHeight === 1, 'align-middle': !rowHeight || rowHeight === 1,
'align-top': rowHeight && rowHeight !== 1, 'align-top': rowHeight && rowHeight !== 1,

Loading…
Cancel
Save