Sync styleguide 2026.05.18.2
This commit is contained in:
1 parent
6a77b56d34
commit
1286333ead
2 files changed
+23
-7
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"styleguideVersion": "2026.05.18.2",
|
"styleguideVersion": "2026.05.18.2",
|
||||||
"styleguideCommit": "ab7a5d5",
|
"styleguideCommit": "2e2c07f",
|
||||||
"syncedAtUtc": "2026-09-28T07:04:15Z",
|
"syncedAtUtc": "2026-09-28T08:31:34Z",
|
||||||
"sourceRepo": "/Users/mathias/Documents/Dokumente Chouchou/Codebases/Styleguide",
|
"sourceRepo": "/Users/mathias/Documents/Dokumente Chouchou/Codebases/Styleguide",
|
||||||
"mirroredDocsPath": "docs/styleguide"
|
"mirroredDocsPath": "docs/styleguide"
|
||||||
}
|
}
|
||||||
@@ -44,6 +44,17 @@
|
|||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getGridTrackWidth = (table) => {
|
||||||
|
const row = table.querySelector('[data-component-part="large-table-header-row"]');
|
||||||
|
if (!row) {
|
||||||
|
return table.clientWidth;
|
||||||
|
}
|
||||||
|
const rowStyles = getComputedStyle(row);
|
||||||
|
const horizontalPadding = (parseFloat(rowStyles.paddingLeft) || 0)
|
||||||
|
+ (parseFloat(rowStyles.paddingRight) || 0);
|
||||||
|
return Math.max(0, row.clientWidth - horizontalPadding);
|
||||||
|
};
|
||||||
|
|
||||||
const normalizeWidths = (widths, tableWidth, minWidth) => {
|
const normalizeWidths = (widths, tableWidth, 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);
|
||||||
@@ -57,7 +68,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getDefaultWidths = (table, headers, minWidth) => {
|
const getDefaultWidths = (table, headers, minWidth) => {
|
||||||
const tableWidth = Math.max(table.clientWidth, minWidth * headers.length);
|
const tableWidth = Math.max(getGridTrackWidth(table), minWidth * headers.length);
|
||||||
const configured = headers.map((header) => parseDefaultWidth(header.dataset.defaultWidth, tableWidth));
|
const configured = headers.map((header) => parseDefaultWidth(header.dataset.defaultWidth, tableWidth));
|
||||||
if (configured.some((width) => width === null)) {
|
if (configured.some((width) => width === null)) {
|
||||||
return Array(headers.length).fill(Math.max(minWidth, tableWidth / headers.length));
|
return Array(headers.length).fill(Math.max(minWidth, tableWidth / headers.length));
|
||||||
@@ -124,16 +135,21 @@
|
|||||||
|
|
||||||
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 baseTotal = safeWidths.reduce((sum, width) => sum + width, 0);
|
||||||
const columnTemplate = safeWidths.map((width, index) => (
|
const effectiveTotal = Math.max(baseTotal, getGridTrackWidth(table));
|
||||||
|
const effectiveWidths = safeWidths.map((width, index) => (
|
||||||
|
index === safeWidths.length - 1 ? width + effectiveTotal - baseTotal : width
|
||||||
|
));
|
||||||
|
const total = effectiveWidths.reduce((sum, width) => sum + width, 0);
|
||||||
|
const columnTemplate = effectiveWidths.map((width, index) => (
|
||||||
index === safeWidths.length - 1
|
index === safeWidths.length - 1
|
||||||
? `minmax(${Math.round(width)}px, 1fr)`
|
? `minmax(${Math.round(width)}px, 1fr)`
|
||||||
: `${Math.round(width)}px`
|
: `${Math.round(width)}px`
|
||||||
)).join(' ');
|
)).join(' ');
|
||||||
table.style.setProperty('--large-table-grid-template-columns', columnTemplate);
|
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 = effectiveWidths;
|
||||||
updateHandleState(table, safeWidths, minWidth);
|
updateHandleState(table, effectiveWidths, minWidth);
|
||||||
};
|
};
|
||||||
|
|
||||||
const resizeColumn = (table, index, delta, persist) => {
|
const resizeColumn = (table, index, delta, persist) => {
|
||||||
|
|||||||
Reference in new issue
Block a user