ChkClass 타입의 정보로 동작되는 체크박스 추가.

This commit is contained in:
truthwing
2025-07-22 13:55:31 +09:00
parent ddf3a5cfa0
commit 7d95ddf6a5
@@ -5,7 +5,10 @@ import { useEffect, useState, useRef } from "react";
import { HeadMakeColSpan } from "./HeadMakeColSpan";
import UiPageNations from "./uiPageNations";
import { Check } from "lucide-react";
export type ChkClass={
chk:boolean
readonly:boolean
}
type UiTableProps = {
headName: React.ReactNode | undefined;
tableData: { [key: string]: any }[];
@@ -109,7 +112,17 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr
onClick={() => handleCellClick(index, head.id)}
key={`cell-${head.id}-${index}`}
>
{typeof el[head.id] === 'boolean'
{typeof el[head.id] === 'object'
? <Checkbox
checked={(el[head.id] as ChkClass).chk === true}
onCheckedChange={(checked) => {
if((el[head.id] as ChkClass).readonly == true) return
(el[head.id] as ChkClass).chk = Boolean(checked);
}}
>
<Check className="h-6 w-6 text-primary" />
</Checkbox>:
typeof el[head.id] === 'boolean'
? <Checkbox
checked={el[head.id] === true}
onCheckedChange={(checked) => {