From 3cde5c2c7d157bb0fe353de5e67e4b35506bb4e2 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Tue, 23 Sep 2025 20:05:46 +0900 Subject: (김준회) Vendorpool 수정요청사항 - 컬럼리사이징 관련 문제 해결 - 공통컴포넌트에 columnResizeMode: "onChange" 속성 추가 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/avl/table/avl-table-columns.tsx | 568 +++++++++++++++++++----------------- 1 file changed, 295 insertions(+), 273 deletions(-) (limited to 'lib/avl/table/avl-table-columns.tsx') diff --git a/lib/avl/table/avl-table-columns.tsx b/lib/avl/table/avl-table-columns.tsx index d95a29b0..6ec2c3db 100644 --- a/lib/avl/table/avl-table-columns.tsx +++ b/lib/avl/table/avl-table-columns.tsx @@ -1,7 +1,7 @@ import { Checkbox } from "@/components/ui/checkbox" import { Button } from "@/components/ui/button" import { Badge } from "@/components/ui/badge" -import { Eye, Edit, Trash2, History } from "lucide-react" +import { Eye, History } from "lucide-react" import { type ColumnDef } from "@tanstack/react-table" import { DataTableColumnHeaderSimple } from "@/components/data-table/data-table-column-simple-header" import { AvlListItem } from "../types" @@ -26,303 +26,325 @@ declare module "@tanstack/react-table" { // 테이블 컬럼 정의 함수 export function getColumns({ selectedRows = [], onRowSelect }: GetColumnsProps): ColumnDef[] { const columns: ColumnDef[] = [ - // 기본 정보 그룹 + // select 컬럼 { - header: "AVL 정보", - columns: [ - { - id: "select", - header: () =>
선택
, - cell: ({ row }) => ( -
- { - onRowSelect?.(row.original.id, !!checked) - }} - aria-label="행 선택" - className="translate-y-[2px]" - /> + id: "select", + header: () =>
선택
, + cell: ({ row }) => ( +
+ { + onRowSelect?.(row.original.id, !!checked) + }} + aria-label="행 선택" + className="translate-y-[2px]" + /> +
+ ), + enableSorting: false, + enableHiding: false, + enableResizing: false, + size: 10, + minSize: 10, + maxSize: 10, + }, + // No 컬럼 + { + accessorKey: "no", + header: ({ column }) => ( + + ), + cell: ({ getValue }) =>
{getValue() as number}
, + enableResizing: true, + size: 60, + }, + // AVL 분류 컬럼 + { + accessorKey: "isTemplate", + header: ({ column }) => ( + + ), + cell: ({ getValue }) => { + const value = getValue() as boolean + return ( +
+ {value ? "표준 AVL" : "프로젝트 AVL"}
- ), - enableSorting: false, - enableHiding: false, - size: 40, - }, - { - accessorKey: "no", - header: ({ column }) => ( - - ), - cell: ({ getValue }) =>
{getValue() as number}
, - size: 60, - }, - { - accessorKey: "isTemplate", - header: ({ column }) => ( - - ), - cell: ({ getValue }) => { - const value = getValue() as boolean - return ( -
- {value ? "표준 AVL" : "프로젝트 AVL"} -
- ) - }, - size: 120, + ) }, - { - accessorKey: "constructionSector", - header: ({ column }) => ( - - ), - cell: ({ getValue }) => { - const value = getValue() as string - return ( -
- {value} -
- ) - }, - size: 100, - }, - { - accessorKey: "projectCode", - header: ({ column }) => ( - - ), - cell: ({ getValue }) => { - const value = getValue() as string - return ( -
- {value} -
- ) - }, - size: 140, - }, - { - accessorKey: "shipType", - header: ({ column }) => ( - - ), - cell: ({ getValue }) => { - const value = getValue() as string - return ( -
- {value} -
- ) - }, - size: 100, - }, - { - accessorKey: "avlKind", - header: ({ column }) => ( - - ), - cell: ({ getValue }) => { - const value = getValue() as string - return ( -
- {value} -
- ) - }, - size: 120, - }, - { - accessorKey: "htDivision", - header: ({ column }) => ( - - ), - cell: ({ getValue }) => { - const value = getValue() as string - return ( -
- {value} -
- ) - }, - size: 80, - }, - { - accessorKey: "rev", - header: ({ column }) => ( - - ), - cell: ({ getValue, row, table }) => { - const value = getValue() as number - return ( -
- - {value || 1} - - -
- ) - }, - size: 100, - }, - ], - }, - - // 집계 그룹 - { - header: "등록정보", - columns: [ - { - accessorKey: "PKG", - header: ({ column }) => ( - - ), + enableResizing: true, + size: 120, + }, + // 공사부문 컬럼 + { + accessorKey: "constructionSector", + header: ({ column }) => ( + + ), + cell: ({ getValue }) => { + const value = getValue() as string + return ( +
+ {value} +
+ ) }, - { - accessorKey: "materialGroup", - header: ({ column }) => ( - - ), + enableResizing: true, + size: 100, + }, + // 프로젝트 코드 컬럼 + { + accessorKey: "projectCode", + header: ({ column }) => ( + + ), + cell: ({ getValue }) => { + const value = getValue() as string + return ( +
+ {value} +
+ ) }, - { - accessorKey: "vendor", - header: ({ column }) => ( - - ), + enableResizing: true, + size: 140, + }, + // 선종 컬럼 + { + accessorKey: "shipType", + header: ({ column }) => ( + + ), + cell: ({ getValue }) => { + const value = getValue() as string + return ( +
+ {value} +
+ ) }, - { - accessorKey: "Tier", - header: ({ column }) => ( - - ), + enableResizing: true, + size: 100, + }, + // AVL 종류 컬럼 + { + accessorKey: "avlKind", + header: ({ column }) => ( + + ), + cell: ({ getValue }) => { + const value = getValue() as string + return ( +
+ {value} +
+ ) }, - { - accessorKey: "ownerSuggestion", - header: ({ column }) => ( - - ), + enableResizing: true, + size: 120, + }, + // H/T 구분 컬럼 + { + accessorKey: "htDivision", + header: ({ column }) => ( + + ), + cell: ({ getValue }) => { + const value = getValue() as string + return ( +
+ {value} +
+ ) }, - { - accessorKey: "shiSuggestion", - header: ({ column }) => ( - - ), + enableResizing: true, + size: 80, + }, + // Rev 컬럼 + { + accessorKey: "rev", + header: ({ column }) => ( + + ), + cell: ({ getValue, row, table }) => { + const value = getValue() as number + return ( +
+ + {value || 1} + + +
+ ) }, - ], - }, - - // 등록 정보 그룹 - { - header: "작성정보", - columns: [ - { - accessorKey: "createdAt", - header: ({ column }) => ( - - ), - cell: ({ getValue }) => { - const date = getValue() as string - return
{date}
- }, - size: 100, + enableResizing: true, + size: 100, + }, + // PKG 컬럼 + { + accessorKey: "PKG", + header: ({ column }) => ( + + ), + enableResizing: true, + size: 80, + }, + // 자재그룹 컬럼 + { + accessorKey: "materialGroup", + header: ({ column }) => ( + + ), + enableResizing: true, + size: 120, + }, + // 협력업체 컬럼 + { + accessorKey: "vendor", + header: ({ column }) => ( + + ), + enableResizing: true, + size: 150, + }, + // Tier 컬럼 + { + accessorKey: "Tier", + header: ({ column }) => ( + + ), + enableResizing: true, + size: 60, + }, + // 선주 제안 컬럼 + { + accessorKey: "ownerSuggestion", + header: ({ column }) => ( + + ), + enableResizing: true, + size: 100, + }, + // SHI 제안 컬럼 + { + accessorKey: "shiSuggestion", + header: ({ column }) => ( + + ), + enableResizing: true, + size: 100, + }, + // 등록일 컬럼 + { + accessorKey: "createdAt", + header: ({ column }) => ( + + ), + cell: ({ getValue }) => { + const date = getValue() as string + return
{date}
}, - { - accessorKey: "createdBy", - header: ({ column }) => ( - - ), - cell: ({ getValue }) => { - const date = getValue() as string - return
{date}
- }, - size: 100, + enableResizing: true, + size: 100, + }, + // 등록자 컬럼 + { + accessorKey: "createdBy", + header: ({ column }) => ( + + ), + cell: ({ getValue }) => { + const value = getValue() as string + return
{value}
}, - { - accessorKey: "updatedAt", - header: ({ column }) => ( - - ), - cell: ({ getValue }) => { - const date = getValue() as string - return
{date}
- }, - size: 100, + enableResizing: true, + size: 100, + }, + // 최종변경일 컬럼 + { + accessorKey: "updatedAt", + header: ({ column }) => ( + + ), + cell: ({ getValue }) => { + const date = getValue() as string + return
{date}
}, - { - accessorKey: "updatedBy", - header: ({ column }) => ( - - ), - cell: ({ getValue }) => { - const date = getValue() as string - return
{date}
- }, - size: 100, + enableResizing: true, + size: 100, + }, + // 최종변경자 컬럼 + { + accessorKey: "updatedBy", + header: ({ column }) => ( + + ), + cell: ({ getValue }) => { + const value = getValue() as string + return
{value}
}, - ], - }, - - // 액션 그룹 - { - id: "actions", - header: "액션", - columns: [ - { - id: "actions", - header: () =>
액션
, - cell: ({ row, table }) => { - const isEmptyRow = table.options.meta?.isEmptyRow?.(row.id) || false - - if (isEmptyRow) { - return ( -
- - -
- ) - } + enableResizing: true, + size: 100, + }, + // 액션 컬럼 + { + id: "actions", + header: () =>
액션
, + cell: ({ row, table }) => { + const isEmptyRow = table.options.meta?.isEmptyRow?.(row.id) || false + if (isEmptyRow) { return (
+
) - }, - enableSorting: false, - enableHiding: false, - size: 120, + } + + return ( +
+ +
+ ) }, - ], + enableSorting: false, + enableHiding: false, + enableResizing: false, + size: 120, + minSize: 120, + maxSize: 120, }, ] -- cgit v1.2.3