Browse Source

fix: paste order is incorrect

nc-expand-rows
DarkPhoenix2704 2 months ago
parent
commit
423f777714
  1. 13
      packages/nc-gui/composables/useMultiSelect/index.ts

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

@ -884,14 +884,16 @@ export function useMultiSelect(
let pastedRows = 0 let pastedRows = 0
let isInfoShown = false 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 if (!pasteRow || pasteRow.rowMeta.new) break
pastedRows++ pastedRows++
let colIndex = 0 for (let j = 0; j < pasteMatrixCols; j++) {
const pasteCol = colsToPaste[j]
for (const pasteCol of colsToPaste) {
if (!isPasteable(pasteRow, pasteCol)) { if (!isPasteable(pasteRow, pasteCol)) {
if ((isBt(pasteCol) || isOo(pasteCol) || isMm(pasteCol)) && !isInfoShown) { if ((isBt(pasteCol) || isOo(pasteCol) || isMm(pasteCol)) && !isInfoShown) {
message.info(t('msg.info.groupPasteIsNotSupportedOnLinksColumn')) message.info(t('msg.info.groupPasteIsNotSupportedOnLinksColumn'))
@ -905,7 +907,7 @@ export function useMultiSelect(
const pasteValue = convertCellData( const pasteValue = convertCellData(
{ {
// Repeat the clipboard data array if the matrix is smaller than the selection // 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, to: pasteCol.uidt as UITypes,
column: pasteCol, column: pasteCol,
appInfo: unref(appInfo), appInfo: unref(appInfo),
@ -918,7 +920,6 @@ export function useMultiSelect(
if (pasteValue !== undefined) { if (pasteValue !== undefined) {
pasteRow.row[pasteCol.title!] = pasteValue pasteRow.row[pasteCol.title!] = pasteValue
} }
colIndex++
} }
} }

Loading…
Cancel
Save