Skip to content

Commit

Permalink
Fix table column consistency
Browse files Browse the repository at this point in the history
Refs: #6890
  • Loading branch information
anicyne committed Nov 8, 2024
1 parent c4d1706 commit 95947bc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/components/src/components/table-stateless/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,23 @@ export class KolTableStateless implements TableStatelessAPI {
dataField[0].push(emptyCell);
}
}
dataField.forEach((row, rowIndex) => {
if (row.length > maxCols) {
row = row.slice(0, maxCols);
}

if (row.length < maxCols) {
const missingColumns = maxCols - row.length;
for (let i = 0; i < missingColumns; i++) {
row.push({
label: '',
colSpan: undefined,
rowSpan: undefined,
});
}
}
dataField[rowIndex] = row;
});
return dataField;
}

Expand Down

0 comments on commit 95947bc

Please sign in to comment.