import type { ColumnDef } from "@tanstack/react-table"; import type { UseFormReturn } from "react-hook-form"; import { Checkbox } from "@common/components"; import type { RoleAuthorizations } from "./role-authorizations-interface"; import type { RoleAuthorizationsFormData } from "./role-authorizations-interface"; export const createColumns = ( form: UseFormReturn, ): ColumnDef[] => [ { id: "select", header: ({ table }) => ( role.authYn === "Y")} onCheckedChange={(checked) => { table.getRowModel().rows.forEach((row, index) => { form.setValue( `roleAuthorizations.${index}.authYn`, checked ? "Y" : "N", ); }); }} className="h-4 w-4 rounded border-gray-300" /> ), cell: ({ row }) => ( { form.setValue( `roleAuthorizations.${row.index}.authYn`, checked ? "Y" : "N", ); }} className="h-4 w-4 rounded border-gray-300" /> ), }, { accessorKey: "roleId", header: "권한ID", }, { accessorKey: "roleName", header: "권한명", }, { accessorKey: "roleContent", header: "권한설명", }, ];