summaryrefslogtreecommitdiff
path: root/components/form-data/form-data-table-columns.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'components/form-data/form-data-table-columns.tsx')
-rw-r--r--components/form-data/form-data-table-columns.tsx37
1 files changed, 18 insertions, 19 deletions
diff --git a/components/form-data/form-data-table-columns.tsx b/components/form-data/form-data-table-columns.tsx
index 38f5cad8..b23b2e70 100644
--- a/components/form-data/form-data-table-columns.tsx
+++ b/components/form-data/form-data-table-columns.tsx
@@ -1,8 +1,8 @@
-import type { ColumnDef, Row } from "@tanstack/react-table"
-import { ClientDataTableColumnHeaderSimple } from "../client-data-table/data-table-column-simple-header"
-import { Button } from "@/components/ui/button"
-import { Ellipsis } from "lucide-react"
-import { formatDate } from "@/lib/utils"
+import type { ColumnDef, Row } from "@tanstack/react-table";
+import { ClientDataTableColumnHeaderSimple } from "../client-data-table/data-table-column-simple-header";
+import { Button } from "@/components/ui/button";
+import { Ellipsis } from "lucide-react";
+import { formatDate } from "@/lib/utils";
import {
DropdownMenu,
DropdownMenuContent,
@@ -15,24 +15,23 @@ import {
DropdownMenuSubContent,
DropdownMenuSubTrigger,
DropdownMenuTrigger,
-} from "@/components/ui/dropdown-menu"
+} from "@/components/ui/dropdown-menu";
/** row 액션 관련 타입 */
export interface DataTableRowAction<TData> {
- row: Row<TData>
- type: "open" | "edit" | "update"
+ row: Row<TData>;
+ type: "open" | "edit" | "update";
}
/** 컬럼 타입 (필요에 따라 확장) */
-export type ColumnType = "STRING" | "NUMBER" | "LIST"
-
+export type ColumnType = "STRING" | "NUMBER" | "LIST";
export interface DataTableColumnJSON {
key: string;
/** 실제 Excel 등에서 구분용으로 쓰이는 label (고정) */
- label: string
+ label: string;
/** UI 표시용 label (예: 단위를 함께 표시) */
- displayLabel?: string
+ displayLabel?: string;
type: ColumnType;
options?: string[];
@@ -78,7 +77,7 @@ export function getColumns<TData extends object>({
},
// (2) 실제 셀(cell) 렌더링: type에 따라 분기 가능
cell: ({ row }) => {
- const cellValue = row.getValue(col.key)
+ const cellValue = row.getValue(col.key);
// 데이터 타입별 처리
switch (col.type) {
@@ -98,14 +97,14 @@ export function getColumns<TData extends object>({
case "LIST":
// 예: select인 경우 label만 표시
- return <div>{String(cellValue ?? "")}</div>
+ return <div>{String(cellValue ?? "")}</div>;
case "STRING":
default:
- return <div>{String(cellValue ?? "")}</div>
+ return <div>{String(cellValue ?? "")}</div>;
}
},
- }))
+ }));
// (3) 액션 칼럼 - update 버튼 예시
const actionColumn: ColumnDef<TData> = {
@@ -141,11 +140,11 @@ export function getColumns<TData extends object>({
),
size: 40,
meta: {
- // maxWidth: 40,
+ maxWidth: 40,
},
enablePinning: true,
};
// (4) 최종 반환
- return [...baseColumns, actionColumn]
-} \ No newline at end of file
+ return [...baseColumns, actionColumn];
+}