diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index c2b5219e8..a6c5cfdee 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -1,9 +1,11 @@ "use client" -import { Table, TableBody, TableCell, TableHeader, TableRow } from "@common/components"; +import { Checkbox, Table, TableBody, TableCell, TableHeader, TableRow } from "@common/components"; import { useEffect, useState } from "react"; import { HeadMakeColSpan } from "./HeadMakeColSpan"; import UiPageNations from "./uiPageNations"; +import { AlignVerticalDistributeCenterIcon, Check } from "lucide-react"; +import { boolean } from "zod"; type UiTableProps = { headName: React.ReactNode | undefined; @@ -29,6 +31,9 @@ type UiHeadProps = { export function UiTable({ tableData, headlist, pageSize, total, headName, children, cellClick, onPageChange, className = '', resetPageNo = false, boldArray = [] }: UiTableProps) { const [cur, setCur] = useState(1); const [idx, setIdx] = useState(-1); + const [isCheck, seIsCheck] = useState(false); + + useEffect(() => { if (resetPageNo) { setCur(1); @@ -47,6 +52,7 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr setIdx(index); } }; + return ( <> @@ -65,7 +71,9 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr .filter((item) => item.visible != false) .map((head) => ( head.id && head.id.length > 1 && ( - boldArray.includes(index) ? : + + : handleCellClick(index, head.id)} key={`cell-${head.id}-${index}`} > - {typeof el[head.id] !== 'number'?String(el[head.id] ?? ''): String(el[head.id]).includes('.') + {typeof el[head.id] === 'boolean' + ? { + el[head.id]= checked; + }} + > + + + : + typeof el[head.id] !== 'number'? + String(el[head.id] ?? ''): + String(el[head.id]).includes('.') ? String(el[head.id]).split('.').map((part, index) => index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part - ).join('.') - : String(el[head.id] ?? '').replace(/\B(?=(\d{3})+(?!\d))/g, ",")} + ).join('.') + : + String(el[head.id] ?? '').replace(/\B(?=(\d{3})+(?!\d))/g, ",")} ) ))}