diff --git a/packages/nc-gui/composables/useMultiSelect/index.ts b/packages/nc-gui/composables/useMultiSelect/index.ts index 9816931d89..fd81438aa3 100644 --- a/packages/nc-gui/composables/useMultiSelect/index.ts +++ b/packages/nc-gui/composables/useMultiSelect/index.ts @@ -856,13 +856,21 @@ export function useMultiSelect( const totalRowsBeforeActiveCell = (page - 1) * pageSize + activeCell.row const availableRowsToUpdate = Math.max(0, totalRows - totalRowsBeforeActiveCell) - const rowsToAdd = Math.max(0, selectionRowCount - (totalRows - totalRowsBeforeActiveCell)) - - const unreffedData = unref(data).slice(activeCell.row, activeCell.row + selectionRowCount) + const totalRowsToPaste = clipboardMatrix.length + const rowsToAdd = Math.max(0, totalRowsToPaste - availableRowsToUpdate) const rowsInCurrentPage = unref(data).length - const recordsUpdatedInCurrentPage = Math.min(selectionRowCount, rowsInCurrentPage - activeCell.row) - const recordsUpdatedInSubsequentPages = Math.max(0, availableRowsToUpdate - recordsUpdatedInCurrentPage) + + const unreffedData = unref(data).slice( + activeCell.row, + activeCell.row + Math.min(totalRowsToPaste, rowsInCurrentPage - activeCell.row), + ) + + const recordsUpdatedInCurrentPage = Math.min(rowsInCurrentPage - activeCell.row, availableRowsToUpdate, totalRowsToPaste) + const recordsUpdatedInSubsequentPages = Math.min( + availableRowsToUpdate - recordsUpdatedInCurrentPage, + totalRowsToPaste - recordsUpdatedInCurrentPage, + ) let options = { continue: false, diff --git a/tests/playwright/pages/Dashboard/Grid/ExpandTable.ts b/tests/playwright/pages/Dashboard/Grid/ExpandTable.ts index c699e7e7c5..2c7fe0f4ca 100644 --- a/tests/playwright/pages/Dashboard/Grid/ExpandTable.ts +++ b/tests/playwright/pages/Dashboard/Grid/ExpandTable.ts @@ -9,23 +9,23 @@ export class ExpandTablePageObject extends BasePage { this.grid = grid; } - async getExpandTable() { - return this.rootPage.getByTestId('nc-expand-table-modal'); - } - async upsert() { - const expandTableModal = await this.getExpandTable(); + const expandTableModal = this.rootPage.getByTestId('nc-expand-table-modal'); + + await expandTableModal.isVisible(); await expandTableModal.getByTestId('nc-table-expand-yes').click(); - await expandTableModal.getByTestId('nc-table-expand').click(); + await this.rootPage.getByTestId('nc-table-expand').click(); } async updateOnly() { - const expandTableModal = await this.getExpandTable(); + const expandTableModal = this.rootPage.getByTestId('nc-expand-table-modal'); + + await expandTableModal.isVisible(); await expandTableModal.getByTestId('nc-table-expand-no').click(); - await expandTableModal.getByTestId('nc-table-expand').click(); + await this.rootPage.getByTestId('nc-table-expand').click(); } } diff --git a/tests/playwright/tests/db/general/cellSelection.spec.ts b/tests/playwright/tests/db/general/cellSelection.spec.ts index aeebae1ac2..141fa20d7d 100644 --- a/tests/playwright/tests/db/general/cellSelection.spec.ts +++ b/tests/playwright/tests/db/general/cellSelection.spec.ts @@ -21,6 +21,7 @@ test.describe('Verify cell selection', () => { test('Suite-1', async () => { // #1 when range is selected, it has correct number of selected cells await dashboard.treeView.openTable({ title: 'Customer' }); + await grid.selectRange({ start: { index: 0, columnHeader: 'FirstName' }, end: { index: 2, columnHeader: 'Email' },