Browse Source

fix: calculation errors

nc-expand-rows
DarkPhoenix2704 2 months ago
parent
commit
8c32509b0c
  1. 8
      packages/nc-gui/composables/useMultiSelect/index.ts

8
packages/nc-gui/composables/useMultiSelect/index.ts

@ -853,6 +853,7 @@ export function useMultiSelect(
const colsToPaste = unref(fields).slice(activeCell.col, activeCell.col + pasteMatrixCols) const colsToPaste = unref(fields).slice(activeCell.col, activeCell.col + pasteMatrixCols)
const { totalRows = 0, page = 1, pageSize = 100 } = unref(paginationDataRef)! const { totalRows = 0, page = 1, pageSize = 100 } = unref(paginationDataRef)!
const totalRowsBeforeActiveCell = (page - 1) * pageSize + activeCell.row const totalRowsBeforeActiveCell = (page - 1) * pageSize + activeCell.row
const availableRowsToUpdate = Math.max(0, totalRows - totalRowsBeforeActiveCell) const availableRowsToUpdate = Math.max(0, totalRows - totalRowsBeforeActiveCell)
const rowsToAdd = Math.max(0, selectionRowCount - availableRowsToUpdate) const rowsToAdd = Math.max(0, selectionRowCount - availableRowsToUpdate)
@ -864,7 +865,7 @@ export function useMultiSelect(
Math.min(selectionRowCount, rowsInCurrentPage - activeCell.row), Math.min(selectionRowCount, rowsInCurrentPage - activeCell.row),
availableRowsToUpdate, availableRowsToUpdate,
) )
const recordsUpdatedInSubsequentPages = Math.max(0, availableRowsToUpdate - recordsUpdatedInCurrentPage) const recordsUpdatedInSubsequentPages = Math.max(0, selectionRowCount - recordsUpdatedInCurrentPage)
let options = { let options = {
continue: false, continue: false,
@ -947,7 +948,10 @@ export function useMultiSelect(
} }
selectedRange.startRange({ row: activeCell.row, col: activeCell.col }) selectedRange.startRange({ row: activeCell.row, col: activeCell.col })
selectedRange.endRange({ row: activeCell.row + selectionRowCount - 1, col: activeCell.col + pasteMatrixCols - 1 }) selectedRange.endRange({
row: activeCell.row + recordsUpdatedInCurrentPage - 1,
col: activeCell.col + pasteMatrixCols - 1,
})
} else { } else {
if (selectedRange.isSingleCell()) { if (selectedRange.isSingleCell()) {
const rowObj = unref(data)[activeCell.row] const rowObj = unref(data)[activeCell.row]

Loading…
Cancel
Save