From 3608d9f9c37fe581e023627f970db3437296fe99 Mon Sep 17 00:00:00 2001 From: leeheejin Date: Wed, 10 Dec 2025 10:27:54 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A4=91=EA=B0=84=EC=A0=80=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SimpleRepeaterTableComponent.tsx | 23 +++++++++++++------ .../SimpleRepeaterTableConfigPanel.tsx | 12 ++++++---- .../SimpleRepeaterTableRenderer.tsx | 2 +- .../simple-repeater-table/useCalculation.ts | 3 ++- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/frontend/lib/registry/components/simple-repeater-table/SimpleRepeaterTableComponent.tsx b/frontend/lib/registry/components/simple-repeater-table/SimpleRepeaterTableComponent.tsx index ba47d13a..84955c3e 100644 --- a/frontend/lib/registry/components/simple-repeater-table/SimpleRepeaterTableComponent.tsx +++ b/frontend/lib/registry/components/simple-repeater-table/SimpleRepeaterTableComponent.tsx @@ -48,8 +48,17 @@ export function SimpleRepeaterTableComponent({ allowAdd: propAllowAdd, maxHeight: propMaxHeight, + // DOM에 전달되면 안 되는 props 명시적 제거 (부모에서 전달될 수 있음) + initialData: _initialData, + originalData: _originalData, + groupedData: _groupedData, + ...props -}: SimpleRepeaterTableComponentProps) { +}: SimpleRepeaterTableComponentProps & { + initialData?: any; + originalData?: any; + groupedData?: any; +}) { // config 또는 component.config 또는 개별 prop 우선순위로 병합 const componentConfig = { ...config, @@ -265,7 +274,7 @@ export function SimpleRepeaterTableComponent({ useEffect(() => { const handleSaveRequest = async (event: Event) => { if (value.length === 0) { - console.warn("⚠️ [SimpleRepeaterTable] 저장할 데이터 없음"); + // console.warn("⚠️ [SimpleRepeaterTable] 저장할 데이터 없음"); return; } @@ -306,7 +315,7 @@ export function SimpleRepeaterTableComponent({ }); }); - console.log("✅ [SimpleRepeaterTable] 테이블별 저장 데이터:", dataByTable); + // console.log("✅ [SimpleRepeaterTable] 테이블별 저장 데이터:", dataByTable); // CustomEvent의 detail에 테이블별 데이터 추가 if (event instanceof CustomEvent && event.detail) { @@ -319,10 +328,10 @@ export function SimpleRepeaterTableComponent({ })); }); - console.log("✅ [SimpleRepeaterTable] 저장 데이터 준비:", { - tables: Object.keys(dataByTable), - totalRows: Object.values(dataByTable).reduce((sum, rows) => sum + rows.length, 0), - }); + // console.log("✅ [SimpleRepeaterTable] 저장 데이터 준비:", { + // tables: Object.keys(dataByTable), + // totalRows: Object.values(dataByTable).reduce((sum, rows) => sum + rows.length, 0), + // }); } // 기존 onFormDataChange도 호출 (호환성) diff --git a/frontend/lib/registry/components/simple-repeater-table/SimpleRepeaterTableConfigPanel.tsx b/frontend/lib/registry/components/simple-repeater-table/SimpleRepeaterTableConfigPanel.tsx index 396d831f..41e70e08 100644 --- a/frontend/lib/registry/components/simple-repeater-table/SimpleRepeaterTableConfigPanel.tsx +++ b/frontend/lib/registry/components/simple-repeater-table/SimpleRepeaterTableConfigPanel.tsx @@ -1316,11 +1316,13 @@ export function SimpleRepeaterTableConfigPanel({ - {(localConfig.columns || []).map((col, colIndex) => ( - - {col.label} ({col.field || '미설정'}) - - ))} + {(localConfig.columns || []) + .filter((col) => col.field && col.field.trim() !== "") + .map((col, colIndex) => ( + + {col.label} ({col.field}) + + ))}

diff --git a/frontend/lib/registry/components/simple-repeater-table/SimpleRepeaterTableRenderer.tsx b/frontend/lib/registry/components/simple-repeater-table/SimpleRepeaterTableRenderer.tsx index 13e75743..31a83548 100644 --- a/frontend/lib/registry/components/simple-repeater-table/SimpleRepeaterTableRenderer.tsx +++ b/frontend/lib/registry/components/simple-repeater-table/SimpleRepeaterTableRenderer.tsx @@ -9,7 +9,7 @@ import { ComponentRendererProps } from "@/types/component"; // 컴포넌트 자동 등록 ComponentRegistry.registerComponent(SimpleRepeaterTableDefinition); -console.log("✅ SimpleRepeaterTable 컴포넌트 등록 완료"); +// console.log("✅ SimpleRepeaterTable 컴포넌트 등록 완료"); export function SimpleRepeaterTableRenderer(props: ComponentRendererProps) { return ; diff --git a/frontend/lib/registry/components/simple-repeater-table/useCalculation.ts b/frontend/lib/registry/components/simple-repeater-table/useCalculation.ts index 8a0fdba5..7cb66219 100644 --- a/frontend/lib/registry/components/simple-repeater-table/useCalculation.ts +++ b/frontend/lib/registry/components/simple-repeater-table/useCalculation.ts @@ -30,7 +30,8 @@ export function useCalculation(calculationRules: CalculationRule[] = []) { // 결과 필드는 제외 if (dep === rule.result) continue; - const value = parseFloat(row[dep]) || 0; + // 이전 계산 결과(updatedRow)를 우선 사용, 없으면 원본(row) 사용 + const value = parseFloat(updatedRow[dep] ?? row[dep]) || 0; // 정확한 필드명만 대체 (단어 경계 사용) formula = formula.replace(new RegExp(`\\b${dep}\\b`, "g"), value.toString()); }