"use client"; import dayjs from "dayjs"; import { type ColumnDef } from "@tanstack/react-table"; import { Checkbox } from "@common/components"; import { type Image } from "./image-interface"; import { IMAGE_TYPE } from "./image-interface"; export const columns: ColumnDef[] = [ { id: "select", header: ({ table }) => ( e.stopPropagation()} onCheckedChange={(checked) => table.toggleAllPageRowsSelected(!!checked) } className="h-4 w-4 rounded border-gray-300" /> ), cell: ({ row }) => ( e.stopPropagation()} onCheckedChange={(checked) => row.toggleSelected(!!checked)} className="h-4 w-4 rounded border-gray-300" /> ), }, { accessorKey: "imgSn", header: "NO", cell: ({ row }) => row.index + 1, }, { accessorKey: "imgTypeCd", header: "이미지구분", cell: ({ row }) => { const type = row.getValue("imgTypeCd"); switch (type) { case IMAGE_TYPE.IMGSUB: return "서브이미지"; case IMAGE_TYPE.IMGMAIN: return "메인이미지"; case IMAGE_TYPE.IMGLOGIN: return "로그인이미지"; default: return type; } }, }, { accessorKey: "imgTtl", header: "이미지명", }, { accessorKey: "useYn", header: "사용여부", }, { accessorKey: "mdfrNm", header: "최종수정자", }, { accessorKey: "mdfcnDt", header: "최종수정일", cell: ({ row }) => { const date = row.getValue("mdfcnDt") as string; return date ? dayjs(date).format("YYYY-MM-DD") : ""; }, }, ];