From 423f7777143fab1450722a6934dd3d5fdab10f0e Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Fri, 11 Oct 2024 16:17:46 +0000 Subject: [PATCH] fix: paste order is incorrect --- packages/nc-gui/composables/useMultiSelect/index.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/nc-gui/composables/useMultiSelect/index.ts b/packages/nc-gui/composables/useMultiSelect/index.ts index 5987aa153e..246927c787 100644 --- a/packages/nc-gui/composables/useMultiSelect/index.ts +++ b/packages/nc-gui/composables/useMultiSelect/index.ts @@ -884,14 +884,16 @@ export function useMultiSelect( let pastedRows = 0 let isInfoShown = false - for (const pasteRow of rowsToPaste) { + for (let i = 0; i < pasteMatrixRows; i++) { + const pasteRow = rowsToPaste[i] + + // TODO handle insert new row if (!pasteRow || pasteRow.rowMeta.new) break pastedRows++ - let colIndex = 0 - - for (const pasteCol of colsToPaste) { + for (let j = 0; j < pasteMatrixCols; j++) { + const pasteCol = colsToPaste[j] if (!isPasteable(pasteRow, pasteCol)) { if ((isBt(pasteCol) || isOo(pasteCol) || isMm(pasteCol)) && !isInfoShown) { message.info(t('msg.info.groupPasteIsNotSupportedOnLinksColumn')) @@ -905,7 +907,7 @@ export function useMultiSelect( const pasteValue = convertCellData( { // Repeat the clipboard data array if the matrix is smaller than the selection - value: clipboardMatrix[pastedRows % clipboardMatrix.length][colIndex], + value: clipboardMatrix[i % clipboardMatrix.length][j], to: pasteCol.uidt as UITypes, column: pasteCol, appInfo: unref(appInfo), @@ -918,7 +920,6 @@ export function useMultiSelect( if (pasteValue !== undefined) { pasteRow.row[pasteCol.title!] = pasteValue } - colIndex++ } }