260209_01_ENH: 테이블에 단위 텍스트 추가, 하단 설명 추가

This commit is contained in:
2026-02-09 16:28:29 +09:00
parent b7282bd07d
commit 6e6120f205
21 changed files with 249 additions and 173 deletions

View File

@@ -1,14 +1,18 @@
import {BannerGroupKey, ServerBannerRow} from "@/types/lg";
import {ChartData} from "@/components/lge-dashboard";
import {BANNER_GROUP} from "@/const/lgConst";
import {BANNER_GROUP, GAP_WORDING} from "@/const/lgConst";
import {formatNumber} from "@/lib/utils";
export const isSampleRow = (raw: string) => raw.replace(/\s+/g, "").includes("사례수");
export const isCagrRow = (raw: string) => raw.replace(/\s+/g, "").toUpperCase().includes("CAGR");
export const isGapRow = (raw: string) => raw.replace(/\s+/g, "").toUpperCase().includes("GAP");
/**
* Row Label을 표시용 텍스트로 포맷팅합니다.
* - "사례수" -> "(사례수)"
* - "gap" -> "전년 대비 GAP(%)"
* - "gap" -> "전년 대비 GAP(%p)"
* - "CAGR" -> "CAGR(%)"
* - "24" -> "24년"
* - "보급율" -> "보급율(%)"
@@ -18,7 +22,7 @@ export function formatRowLabel(
label: string,
options?: {
convertSample?: boolean; // "사례수" -> "(사례수)" (기본값: true)
convertGap?: boolean; // "gap" -> "전년 대비 GAP(%)" (기본값: true)
convertGap?: boolean; // "gap" -> "전년 대비 GAP(%p)" (기본값: true)
convertCagr?: boolean; // "CAGR" -> "CAGR(%)" (기본값: true)
convertYear?: boolean; // "24" -> "24년" (기본값: true)
convertRate?: boolean; // "~율" -> "~율(%)" (기본값: true)
@@ -37,11 +41,11 @@ export function formatRowLabel(
const t = label.trim();
if (convertSample && t === "사례수") return "(사례수)";
if (convertGap && t.toLowerCase() === "gap") return "전년 대비 GAP(%)";
if (convertCagr && t.toUpperCase() === "CAGR") return "CAGR(%)";
if (convertGap && t.toLowerCase() === "gap") return GAP_WORDING;
if (convertCagr && t.toUpperCase() === "CAGR") return "CAGR(%p)";
if (convertYear && /^\d{2}$/.test(t)) return `${t}년`;
if (convertRate && t.endsWith("율")) return `${t}(%)`;
if (convertCount && t.includes("대수")) return `${t}(대)`;
if (convertRate && t.endsWith("율")) return `${t.replaceAll('(%)','')}(%)`;
if (convertCount && t.includes("대수")) return `${t.replaceAll('(대)','')}(대)`;
return t;
}