260330_02_ENH: 연도별 사례수 row에서 Column으로 이동

This commit is contained in:
2026-03-30 16:59:51 +09:00
parent 7f9465e96f
commit a0ee062899
8 changed files with 66 additions and 32 deletions

View File

@@ -517,12 +517,16 @@ function colToLetters(col: number) {
*/
export function buildHeader_ProductKeyMap(
productKeyMap: Record<string, string>,
sampleHeadKey? :string,
rowHeadKey = "rowLabel"
): HeaderBlock {
const entries = typedEntries(productKeyMap);
const headerRow: HeaderCell[] = [
{ text: "", styleKey: "header", align: "center" },
...(sampleHeadKey
? [{ text: "사례수", styleKey: "header", align: "center" } as const]
: []),
...entries.map(([, label]) => ({
text: String(label),
styleKey: "header" as const,
@@ -530,7 +534,8 @@ export function buildHeader_ProductKeyMap(
})),
];
const leafKeys = [rowHeadKey, ...entries.map(([k]) => String(k))];
const leafKeys = [rowHeadKey, ...(sampleHeadKey? [sampleHeadKey]: []), ...entries.map(([k]) => String(k))];
return { headerRows: [headerRow], leafKeys, totalCols: headerRow.length };
}