260205_05_ENH: 1차 lg 수정 요청사항 반영
This commit is contained in:
@@ -5,6 +5,7 @@ import type React from "react";
|
||||
import { cn, parseNumber } from "@/lib/utils";
|
||||
import type { DataColumn, SignDisplayMode, SignStyle } from "../types";
|
||||
import SectionTitle from "../SectionTitle";
|
||||
import {isSampleRow} from "@/lib/lg-dashboard";
|
||||
|
||||
type Props<T extends Record<string, unknown>> = {
|
||||
columns: DataColumn<T>[];
|
||||
@@ -14,6 +15,7 @@ type Props<T extends Record<string, unknown>> = {
|
||||
wrapperClassName?: string;
|
||||
signStyle?: SignStyle<T>;
|
||||
fillGreaterThan5?: boolean;
|
||||
starUnder30Sample?: boolean;
|
||||
};
|
||||
|
||||
// parseSignedNumber는 utils.ts의 parseNumber로 통합됨
|
||||
@@ -55,6 +57,7 @@ const DataTable = <T extends Record<string, unknown>>({
|
||||
wrapperClassName,
|
||||
signStyle,
|
||||
fillGreaterThan5 = false,
|
||||
starUnder30Sample = false,
|
||||
}: Props<T>) => {
|
||||
const hasGroup = columns.some((c) => !!c.group) || columns.some((c) => c.headRowSpan === 2);
|
||||
|
||||
@@ -177,6 +180,7 @@ const DataTable = <T extends Record<string, unknown>>({
|
||||
|
||||
<tbody>
|
||||
{rows.map((row, rIdx) => {
|
||||
const sampleRow = isSampleRow(row.rowLabel as string ?? "");
|
||||
const signRow = isSignRow(row, rIdx);
|
||||
const total = parseNumber(row.total);
|
||||
|
||||
@@ -227,14 +231,15 @@ const DataTable = <T extends Record<string, unknown>>({
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
const numContent = c.numeric ? parseNumber(content) ?? 0 : 0;
|
||||
const isFill = fillGreaterThan5 && total && numContent > total + 5;
|
||||
const isStar = starUnder30Sample && sampleRow && numContent < 30;
|
||||
|
||||
return (
|
||||
<td key={String(c.key)} style={{ textAlign: align }} className={
|
||||
cn(c.cellClassName, isFill? "bg-red-200" :"")
|
||||
}>
|
||||
{content}
|
||||
{isStar?`${content}*`:content}
|
||||
</td>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user