251201_01_ENH : datatable, autocomplete, user관리 완성
This commit is contained in:
73
src/app/(pages)/(main)/manage/user/UserTableColumn.tsx
Normal file
73
src/app/(pages)/(main)/manage/user/UserTableColumn.tsx
Normal file
@@ -0,0 +1,73 @@
|
||||
import {ColumnDef} from "@tanstack/react-table";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {Pencil, Trash2} from "lucide-react";
|
||||
import {UserTableInfo} from "@/types/user";
|
||||
|
||||
|
||||
|
||||
export type UserColumnsActions = {
|
||||
onEdit: (userId: string) => void
|
||||
onDelete: (userId: string) => void
|
||||
}
|
||||
|
||||
export const getUserColumns = (actions: UserColumnsActions): ColumnDef<UserTableInfo>[] => [
|
||||
{
|
||||
accessorKey: "userId",
|
||||
header: "아이디",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "userCmpn",
|
||||
header: "소속",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "userName",
|
||||
header: "이름",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "userRole",
|
||||
header: "권한",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "regDt",
|
||||
header: "등록일",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "memo",
|
||||
header: "메모",
|
||||
enableSorting: false,
|
||||
},
|
||||
{
|
||||
id: "actions",
|
||||
header: "관리",
|
||||
cell: ({ row }) => (
|
||||
<div
|
||||
className="flex items-center justify-center gap-2"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => actions.onEdit(row.original.userId)}
|
||||
aria-label="수정"
|
||||
>
|
||||
<Pencil className="w-4 h-4" />
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => actions.onDelete(row.original.userId)}
|
||||
aria-label="삭제"
|
||||
>
|
||||
<Trash2 className="w-4 h-4 text-destructive" />
|
||||
</Button>
|
||||
</div>
|
||||
),
|
||||
enableSorting: false,
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user