fix: stretch large table load more column
This commit is contained in:
1 parent
aa4ecfa485
commit
e8a127cb34
1 file changed
+6
-1
@@ -125,7 +125,12 @@
|
|||||||
const applyWidths = (table, widths, minWidth) => {
|
const applyWidths = (table, widths, minWidth) => {
|
||||||
const safeWidths = widths.map((width) => Math.max(minWidth, width));
|
const safeWidths = widths.map((width) => Math.max(minWidth, width));
|
||||||
const total = safeWidths.reduce((sum, width) => sum + width, 0);
|
const total = safeWidths.reduce((sum, width) => sum + width, 0);
|
||||||
table.style.setProperty('--large-table-grid-template-columns', safeWidths.map((width) => `${width}px`).join(' '));
|
const columnTemplate = safeWidths.map((width, index) => (
|
||||||
|
index === safeWidths.length - 1
|
||||||
|
? `minmax(${Math.round(width)}px, 1fr)`
|
||||||
|
: `${Math.round(width)}px`
|
||||||
|
)).join(' ');
|
||||||
|
table.style.setProperty('--large-table-grid-template-columns', columnTemplate);
|
||||||
table.style.setProperty('--large-table-grid-min-width', `${Math.ceil(total)}px`);
|
table.style.setProperty('--large-table-grid-min-width', `${Math.ceil(total)}px`);
|
||||||
table._largeTableColumnWidths = safeWidths;
|
table._largeTableColumnWidths = safeWidths;
|
||||||
updateHandleState(table, safeWidths, minWidth);
|
updateHandleState(table, safeWidths, minWidth);
|
||||||
|
|||||||
Reference in new issue
Block a user