Sync styleguide 2026.05.18.2
This commit is contained in:
1 parent
ae741aae61
commit
7306ded7dd
6 files changed
+41
-77
No files matched your search
@@ -125,24 +125,17 @@
|
||||
const applyWidths = (table, widths, minWidth) => {
|
||||
const safeWidths = widths.map((width) => Math.max(minWidth, width));
|
||||
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._largeTableColumnWidths = safeWidths;
|
||||
updateHandleState(table, safeWidths, minWidth);
|
||||
};
|
||||
|
||||
const resetWidths = (table) => {
|
||||
const headers = getColumnHeaders(table);
|
||||
const minWidth = getMinWidth(table);
|
||||
const widths = getDefaultWidths(table, headers, minWidth);
|
||||
try {
|
||||
window.localStorage.removeItem(getStorageKey(table));
|
||||
} catch (error) {
|
||||
// Storage can be unavailable in privacy-restricted browser contexts.
|
||||
}
|
||||
applyWidths(table, widths, minWidth);
|
||||
};
|
||||
|
||||
const resizeColumn = (table, index, delta, persist) => {
|
||||
const widths = [...table._largeTableColumnWidths];
|
||||
const minWidth = getMinWidth(table);
|
||||
@@ -225,12 +218,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
table.addEventListener('click', (event) => {
|
||||
const reset = event.target.closest('[data-large-table-reset-widths]');
|
||||
if (reset && table.contains(reset)) {
|
||||
resetWidths(table);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
window.sgInitLargeTableColumnResize = (options = {}) => {
|
||||
|
||||
Reference in new issue
Block a user