From 2af18570552710088fb0a327acadfdba0de28fd6 Mon Sep 17 00:00:00 2001 From: truthwing Date: Thu, 24 Apr 2025 12:18:09 +0900 Subject: [PATCH] =?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=B8=94=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=EC=8B=9C=20=ED=82=A4=20=EA=B0=92=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=20=EB=B6=80=EB=B6=84=20=EC=88=98=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/table/index.tsx | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index f4a2230e4..c88385ac6 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -1,15 +1,14 @@ -import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@common/components"; +import { Table, TableBody, TableCell, TableHeader, TableRow } from "@common/components"; import { useEffect, useState } from "react"; -import UiPageNations from "./uiPageNations"; import { HeadMakeColSpan } from "./HeadMakeColSpan"; +import UiPageNations from "./uiPageNations"; type UiTableProps = { headName: React.ReactNode | undefined; - tableData: { [key: string]: string | number | boolean | object}[]; + tableData: { [key: string]:any}[]; headlist: UiHeadProps[]; pageSize: number; total: number; - children: React.ReactNode | undefined; cellClick : ((index:number|undefined, headId:string)=>void )| undefined; onPageChange: (page: number) => void; className?: string; @@ -22,7 +21,7 @@ type UiHeadProps = { align?: string; } -export function UiTable({ tableData, headlist, pageSize, total, children, headName, cellClick, onPageChange, className = '', resetPageNo = false }: UiTableProps) { +export function UiTable({ tableData, headlist, pageSize, total, headName, cellClick, onPageChange, className = '', resetPageNo = false }: UiTableProps) { const [cur, setCur] = useState(1); const [idx, setIdx] = useState(-1); @@ -44,7 +43,8 @@ export function UiTable({ tableData, headlist, pageSize, total, children, headNa setIdx(index); } }; - + console.log(tableData); + return ( <> {headName ?
@@ -56,24 +56,24 @@ export function UiTable({ tableData, headlist, pageSize, total, children, headNa - {tableData?.map((el: { [key: string]: string | number | boolean | object}, index) => ( - console.log(index), - + {tableData.length > 0 ? tableData?.map((el: { [key: string]: any}, index) => ( + {headlist?.map((head) => ( - head.id&&head.id.length == 1 ? <> : - handleCellClick(index, head.id)} - key={head.id + index} - > - {typeof el[head.id] === 'number' ? String(el[head.id]).replace(/\B(?=(\d{3})+(?!\d))/g, ",") : String(el[head.id] ?? '')} - + head.id && head.id.length > 1 && ( + handleCellClick(index, head.id)} + key={`cell-${head.id}-${index}`} + > + {typeof el[head.id] === 'number' ? String(el[head.id]).replace(/\B(?=(\d{3})+(?!\d))/g, ",") : String(el[head.id] ?? '')} + + ) ))} - ))} + )) : <>} {total <= 0 ? <> : }