260205_05_ENH: 1차 lg 수정 요청사항 반영

This commit is contained in:
2026-02-05 16:54:55 +09:00
parent 8c015bd443
commit 84675b77b3
25 changed files with 452 additions and 316 deletions

View File

@@ -5,6 +5,7 @@ import { cn, parseNumber } from "@/lib/utils";
import type { DataColumn, SignStyle } from "../types";
import SectionTitle from "../SectionTitle";
import { TABLE_DIMENSIONS } from "@/const/chartConst";
import {isSampleRow} from "@/lib/lg-dashboard";
type MergedChartCell<T> = {
/** 차트를 삽입할 컬럼 key(해당 컬럼 td는 startRow에서만 렌더되고 rowSpan 적용) */
@@ -32,6 +33,7 @@ type Props<T extends Record<string, unknown>> = {
wrapperClassName?: string;
tableClassName?: string;
minWidthPx?: number;
starUnder30Sample?: boolean;
};
// toNumber는 utils.ts의 parseNumber로 통합됨
@@ -65,6 +67,7 @@ export default function LeftChartTable<T extends Record<string, unknown>>({
wrapperClassName,
tableClassName,
minWidthPx = TABLE_DIMENSIONS.MIN_WIDTH.COMPACT,
starUnder30Sample = true
}: Props<T>) {
const hasGroupHeader = useMemo(
() => columns.some((c) => c.group) || columns.some((c) => c.headRowSpan === 2),
@@ -169,6 +172,7 @@ export default function LeftChartTable<T extends Record<string, unknown>>({
<tbody>
{rows.map((row, ri) => {
const sampleRow = isSampleRow(row.rowLabel as string ?? "");
const isSignRow = signStyle?.rowSelector ? signStyle.rowSelector(row, ri) : false;
return (
@@ -199,7 +203,7 @@ export default function LeftChartTable<T extends Record<string, unknown>>({
? raw
: String(raw);
const n = isSignRow ? parseNumber(raw) : null;
const n = c.numeric ? parseNumber(raw) : null;
const shouldSign = isSignRow && (signStyle?.keys ? signStyle.keys.includes(c.key) : !!c.numeric);
if (c.rowHead) {
@@ -216,13 +220,16 @@ export default function LeftChartTable<T extends Record<string, unknown>>({
}
if (!shouldSign) {
const numContent = c.numeric ? parseNumber(content) ?? 0 : 0;
const isStar = starUnder30Sample && sampleRow && numContent < 30;
return (
<td
key={String(c.key)}
className={cn(c.cellClassName)}
style={c.width ? { width: c.width } : undefined}
>
{content}
{isStar?`${content}*`:content}
</td>
);
}
@@ -236,8 +243,10 @@ export default function LeftChartTable<T extends Record<string, unknown>>({
);
}
const cls = n > 0 ? posCls : n < 0 ? negCls : zeroCls;
const txt = renderSigned(n, { display, showPlus, arrowWithNumber, zeroText });
return (
<td key={String(c.key)} className={cn(c.cellClassName, cls)}>
{txt}