From ef23f658b1de7bc3c52ba89a695f4b56412a6fe3 Mon Sep 17 00:00:00 2001 From: swcho Date: Wed, 28 May 2025 18:08:09 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20UiTable2=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20default,=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=97=86?= =?UTF-8?q?=EC=9D=84=20=EC=8B=9C=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/sn/app/map/SearchModal.tsx | 1 + .../src/ui/table/index-2.tsx | 82 +++++++++++-------- 2 files changed, 47 insertions(+), 36 deletions(-) diff --git a/apps/sn/app/map/SearchModal.tsx b/apps/sn/app/map/SearchModal.tsx index 3fe733cfe..d7ab3175d 100644 --- a/apps/sn/app/map/SearchModal.tsx +++ b/apps/sn/app/map/SearchModal.tsx @@ -414,6 +414,7 @@ const SearchModal: React.FC = ({ open, onOpenChange, onFeature console.log('필터링된 API 결과(데이터):', res.data.data); setTableData(res.data.data || []); setTableCount(res.data.count || []); + console.log('tableCount 상태 업데이트 후:', res.data.count); // tableCount 로그 추가 setShowTable(true); }) .catch(err => { diff --git a/packages/common/business_components/src/ui/table/index-2.tsx b/packages/common/business_components/src/ui/table/index-2.tsx index 58ae1bbd0..3a8caa90e 100644 --- a/packages/common/business_components/src/ui/table/index-2.tsx +++ b/packages/common/business_components/src/ui/table/index-2.tsx @@ -59,44 +59,54 @@ export function UiTable2({ tableData, headlist, pageSize, total, children, headN

{headName}

) : null} -
-
- - {/* 스크롤 관련 div 제거 */} - - {children ? ( - <>{children} - ) : ( - - {headlist?.map((head) => ( - + {(!tableData || tableData.length === 0) ? ( + // "데이터 없음" 메시지를 flex를 이용해 수직/수평 중앙 정렬 +
+ 조회된 데이터가 없습니다. +
+ ) : ( +
+ {/* 스크롤 관련 div 제거 */} + + {children ? ( + <>{children} + ) : ( + + {headlist?.map((head) => ( + - {head.title} - - ))} - - )} - - - {tableData.map((el: { [key: string]: string | number | boolean | object }, index) => ( - - {headlist?.map((head) => ( - handleCellClick(startIdx + index, head.id)} - key={head.id + index} - > - {typeof el[head.id] === 'number' ? String(el[head.id]).replace(/\B(?=(\d{3})+(?!\d))/g, ",") : String(el[head.id] ?? '')} - - ))} - - ))} - -
+ {head.title} + + ))} + + )} + + + {tableData.map((el: { [key: string]: string | number | boolean | object }, index) => ( + + {headlist?.map((head) => ( + handleCellClick(startIdx + index, head.id)} + key={head.id + index} + > + {typeof el[head.id] === 'number' ? String(el[head.id]).replace(/\B(?=(\d{3})+(?!\d))/g, ",") : String(el[head.id] ?? '')} + + ))} + + ))} + + + )}
{/* 페이지네이션을 sticky 하단에 고정 */} {total > 0 && (