Skip to content

Commit 6f7dde5

Browse files
authored
fix(vibrant-component): ensure column names are only pushed for full data selection in Table (#1036)
1 parent deaf79d commit 6f7dde5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/vibrant-components-web/src/lib/VirtualizedTable/VirtualizedTable.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,11 @@ export const VirtualizedTable = <Data extends Record<string, any>, RowKey extend
155155

156156
const selectedCells = [];
157157

158-
const columnNames = columns.slice(startCol, endCol + 1).map(column => column.title || column.dataKey || '');
158+
if (endRow - startRow + 1 === data.length) {
159+
const columnNames = columns.slice(startCol, endCol + 1).map(column => column.title || column.dataKey || '');
159160

160-
selectedCells.push(columnNames.join('\t'));
161+
selectedCells.push(columnNames.join('\t'));
162+
}
161163

162164
for (let rowIdx = startRow; rowIdx <= endRow; rowIdx++) {
163165
const row = data[rowIdx];

packages/vibrant-components/src/lib/Table/Table.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,11 @@ export const Table = <Data extends Record<string, any>, RowKey extends keyof Dat
270270

271271
const selectedCells = [];
272272

273-
const columnNames = columns.slice(startCol, endCol + 1).map(column => column.title || column.dataKey || '');
273+
if (endRow - startRow + 1 === data.length) {
274+
const columnNames = columns.slice(startCol, endCol + 1).map(column => column.title || column.dataKey || '');
274275

275-
selectedCells.push(columnNames.join('\t'));
276+
selectedCells.push(columnNames.join('\t'));
277+
}
276278

277279
for (let rowIdx = startRow; rowIdx <= endRow; rowIdx++) {
278280
const row = data[rowIdx];

0 commit comments

Comments
 (0)