blob: 3d3043254332cf9577d17cf94232b70aaeb56339 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
"use client"
import * as React from "react"
import { type ColumnDef } from "@tanstack/react-table"
import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header"
// MaterialGroup 타입 정의 (서비스에서 반환되는 타입과 일치)
type MaterialGroup = {
materialGroupCode: string | null;
materialGroupDesc: string | null;
}
/**
* MaterialGroup 테이블 컬럼 정의
*/
export function getColumns(): ColumnDef<MaterialGroup>[] {
// ----------------------------------------------------------------
// 데이터 컬럼들
// ----------------------------------------------------------------
const dataColumns: ColumnDef<MaterialGroup>[] = [
{
accessorKey: "materialGroupCode",
header: ({ column }) => (
<DataTableColumnHeaderSimple column={column} title="자재그룹코드" />
),
cell: ({ row }) => {
const value = row.getValue("materialGroupCode") as string | null
return (
<div className="font-medium w-[100px]">
{value || "-"}
</div>
)
},
enableSorting: true,
enableHiding: false,
},
{
accessorKey: "materialGroupDesc",
header: ({ column }) => (
<DataTableColumnHeaderSimple column={column} title="자재그룹 설명" />
),
cell: ({ row }) => {
const value = row.getValue("materialGroupDesc") as string | null
return (
<div className="max-w-[400px] truncate">
{value || "-"}
</div>
)
},
enableSorting: true,
enableHiding: false,
},
]
// ----------------------------------------------------------------
// 최종 컬럼 배열
// ----------------------------------------------------------------
return dataColumns
}
|