Skip to content

Commit 84f6e75

Browse files
option to paste values from a row into many rows baserow#3194 (baserow#4192)
option to paste values from a row into many rows
1 parent ff501b5 commit 84f6e75

File tree

2 files changed

+27
-10
lines changed

2 files changed

+27
-10
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"type": "feature",
3+
"message": "Paste values from a single row into many rows",
4+
"domain": "database",
5+
"issue_number": 3194,
6+
"bullet_points": [],
7+
"created_at": "2025-11-10"
8+
}

web-frontend/modules/database/store/view/grid.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2720,24 +2720,33 @@ export const actions = {
27202720
const isSingleCellCopied =
27212721
copiedRowsCount === 1 && copiedCellsInRowsCount === 1
27222722

2723+
const selectedRowsCount =
2724+
getters.getMultiSelectTailRowIndex -
2725+
getters.getMultiSelectHeadRowIndex +
2726+
1
2727+
const selectedFieldsCount =
2728+
getters.getMultiSelectTailFieldIndex -
2729+
getters.getMultiSelectHeadFieldIndex +
2730+
1
2731+
2732+
const isSingleRowCopied = copiedRowsCount === 1 && selectedRowsCount > 1
2733+
27232734
if (isSingleCellCopied) {
27242735
// the textData and jsonData are recreated
27252736
// to fill the entire multi selection
2726-
const selectedRowsCount =
2727-
getters.getMultiSelectTailRowIndex -
2728-
getters.getMultiSelectHeadRowIndex +
2729-
1
2730-
const selectedFieldsCount =
2731-
getters.getMultiSelectTailFieldIndex -
2732-
getters.getMultiSelectHeadFieldIndex +
2733-
1
2737+
27342738
const rowTextArray = Array(selectedFieldsCount).fill(textData[0][0])
27352739
textData = Array(selectedRowsCount).fill(rowTextArray)
27362740

27372741
if (jsonData) {
27382742
const rowJsonArray = Array(selectedFieldsCount).fill(jsonData[0][0])
27392743
jsonData = Array(selectedRowsCount).fill(rowJsonArray)
27402744
}
2745+
} else if (isSingleRowCopied) {
2746+
textData = Array(selectedRowsCount).fill(textData[0])
2747+
if (jsonData) {
2748+
jsonData = Array(selectedRowsCount).fill(jsonData[0])
2749+
}
27412750
}
27422751

27432752
// If the origin row and field index are not provided, we need to use the
@@ -2755,14 +2764,14 @@ export const actions = {
27552764
fieldHeadIndex + copiedCellsInRowsCount
27562765
) - 1
27572766

2758-
if (isSingleCellCopied) {
2767+
if (isSingleCellCopied || isSingleRowCopied) {
27592768
// we want the tail indexes to follow the multi select exactly
27602769
rowTailIndex = getters.getMultiSelectTailRowIndex
27612770
fieldTailIndex = getters.getMultiSelectTailFieldIndex
27622771
}
27632772

27642773
if (
2765-
!isSingleCellCopied &&
2774+
!(isSingleCellCopied || isSingleRowCopied) &&
27662775
selectUpdatedCells &&
27672776
!(view.sortings || view.group_bys || view.filters)
27682777
) {

0 commit comments

Comments
 (0)