From 8b777900a2908efebd767493f77ee3ad489b49a7 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Fri, 24 Oct 2025 16:46:30 +0900 Subject: (김준회) fix: expand 핸들러의 event bubbling 문제 처리, 파일업로드 버튼추가 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/swp/table/swp-table.tsx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'lib/swp/table/swp-table.tsx') diff --git a/lib/swp/table/swp-table.tsx b/lib/swp/table/swp-table.tsx index 9e8f7f6a..fb3a504e 100644 --- a/lib/swp/table/swp-table.tsx +++ b/lib/swp/table/swp-table.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState } from "react"; +import React, { useState } from "react"; import { useReactTable, getCoreRowModel, @@ -53,7 +53,7 @@ export function SwpTable({ onExpandedChange: setExpanded, getCoreRowModel: getCoreRowModel(), getExpandedRowModel: getExpandedRowModel(), - getRowCanExpand: (row) => true, // 모든 문서는 확장 가능 + getRowCanExpand: () => true, // 모든 문서는 확장 가능 }); // 리비전 로드 @@ -106,7 +106,7 @@ export function SwpTable({ // 문서 행 확장 핸들러 const handleDocumentExpand = (docNo: string, isExpanded: boolean) => { - if (!isExpanded) { + if (isExpanded) { loadRevisions(docNo); } }; @@ -135,10 +135,9 @@ export function SwpTable({ {table.getRowModel().rows?.length ? ( table.getRowModel().rows.map((row) => ( - <> + {/* 문서 행 */} @@ -187,7 +186,7 @@ export function SwpTable({ )} - + )) ) : ( @@ -264,7 +263,7 @@ function RevisionSubTable({ }); const handleRevisionExpand = (revisionId: number, isExpanded: boolean) => { - if (!isExpanded) { + if (isExpanded) { onLoadFiles(revisionId); } }; @@ -290,9 +289,9 @@ function RevisionSubTable({ {revisionTable.getRowModel().rows.map((row) => ( - <> + {/* 리비전 행 */} - + {row.getVisibleCells().map((cell) => ( {cell.column.id === "expander" ? ( @@ -333,7 +332,7 @@ function RevisionSubTable({ )} - + ))} -- cgit v1.2.3