중간저장 #267

Merged
hjlee merged 1 commits from lhj into main 2025-12-10 10:30:43 +09:00
4 changed files with 26 additions and 14 deletions

View File

@ -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도 호출 (호환성)

View File

@ -1316,11 +1316,13 @@ export function SimpleRepeaterTableConfigPanel({
</SelectValue>
</SelectTrigger>
<SelectContent>
{(localConfig.columns || []).map((col, colIndex) => (
<SelectItem key={col.field || `empty-${colIndex}`} value={col.field || ""}>
{col.label} ({col.field || '미설정'})
</SelectItem>
))}
{(localConfig.columns || [])
.filter((col) => col.field && col.field.trim() !== "")
.map((col, colIndex) => (
<SelectItem key={col.field || `col-${colIndex}`} value={col.field}>
{col.label} ({col.field})
</SelectItem>
))}
</SelectContent>
</Select>
<p className="text-[10px] text-muted-foreground">

View File

@ -9,7 +9,7 @@ import { ComponentRendererProps } from "@/types/component";
// 컴포넌트 자동 등록
ComponentRegistry.registerComponent(SimpleRepeaterTableDefinition);
console.log("✅ SimpleRepeaterTable 컴포넌트 등록 완료");
// console.log("✅ SimpleRepeaterTable 컴포넌트 등록 완료");
export function SimpleRepeaterTableRenderer(props: ComponentRendererProps) {
return <SimpleRepeaterTableComponent {...props} />;

View File

@ -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());
}