docs(sdlc): merge group heading rows across the full table width
This commit is contained in:
@@ -104,6 +104,7 @@ table:not(.document-control) td.a-center { text-align: center; }
|
||||
taking an equal share of the table width. */
|
||||
table:not(.document-control) th.tight,
|
||||
table:not(.document-control) td.tight { white-space: nowrap; width: 1%; }
|
||||
table:not(.document-control) tr.group td { background: var(--brn-tint); font-weight: 600; }
|
||||
|
||||
thead { display: table-header-group; }
|
||||
tr { break-inside: avoid; }
|
||||
|
||||
@@ -71,13 +71,18 @@ function renderTable(lines, className = '') {
|
||||
const hasSeparator = isSeparator(rows[1] ?? []);
|
||||
const align = hasSeparator ? columnAlignment(rows[1]) : header.map(() => '');
|
||||
const data = hasSeparator ? rows.slice(2) : rows.slice(1);
|
||||
// A row with only its first cell filled is a group heading (CR01, SR06, UN04,
|
||||
// WP 1.0 …): it spans the full width and does not size the columns. Signature
|
||||
// tables keep their blank cells for signing.
|
||||
const isGroup = (row) => className !== 'signature-table' && header.length >= 3
|
||||
&& Boolean(row[0]) && row.slice(1).every((cell) => !cell);
|
||||
|
||||
// A column whose longest cell is short (IDs, dates, counts, statuses) is
|
||||
// marked "tight" so auto table layout shrinks it to its content instead of
|
||||
// handing every column an equal share of the page width.
|
||||
const widest = header.map((_, column) => Math.max(
|
||||
(header[column] ?? '').length,
|
||||
...data.map((row) => (row[column] ?? '').replace(/[`*]/g, '').length)
|
||||
...data.filter((row) => !isGroup(row)).map((row) => (row[column] ?? '').replace(/[`*]/g, '').length)
|
||||
));
|
||||
const classFor = (column) => [
|
||||
align[column] ?? '',
|
||||
@@ -89,7 +94,9 @@ function renderTable(lines, className = '') {
|
||||
return `<${tag}${attr ? ` class="${attr}"` : ''}>${renderInline(cell)}</${tag}>`;
|
||||
}).join('');
|
||||
const classes = [className, header.length >= 8 ? 'dense' : ''].filter(Boolean).join(' ');
|
||||
return `<table${classes ? ` class="${classes}"` : ''}><thead><tr>${cells('th', header)}</tr></thead><tbody>${data.map((row) => `<tr>${cells('td', row)}</tr>`).join('')}</tbody></table>`;
|
||||
return `<table${classes ? ` class="${classes}"` : ''}><thead><tr>${cells('th', header)}</tr></thead><tbody>${data.map((row) => isGroup(row)
|
||||
? `<tr class="group"><td colspan="${header.length}">${renderInline(row[0])}</td></tr>`
|
||||
: `<tr>${cells('td', row)}</tr>`).join('')}</tbody></table>`;
|
||||
}
|
||||
|
||||
function renderParagraph(lines) {
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user