집계함수 제어 수정

This commit is contained in:
kjs
2025-12-05 17:28:44 +09:00
parent e713f55442
commit 47552bc35c
4 changed files with 110 additions and 51 deletions

View File

@@ -91,6 +91,8 @@ export const RepeaterInput: React.FC<RepeaterInputProps> = ({
fields.forEach((field) => {
item[field.name] = "";
});
// 🆕 새 항목임을 표시하는 플래그 추가 (백엔드에서 새 레코드로 처리)
item._isNewItem = true;
return item;
}
@@ -113,6 +115,11 @@ export const RepeaterInput: React.FC<RepeaterInputProps> = ({
}
});
// 🆕 기존 레코드임을 표시 (id가 있는 경우)
if (updatedItem.id) {
updatedItem._existingRecord = true;
}
return hasChange ? updatedItem : item;
});
@@ -125,7 +132,12 @@ export const RepeaterInput: React.FC<RepeaterInputProps> = ({
: updatedValue;
onChange?.(dataWithMeta);
} else {
setItems(value);
// 🆕 기존 레코드 플래그 추가
const valueWithFlag = value.map(item => ({
...item,
_existingRecord: !!item.id,
}));
setItems(valueWithFlag);
}
}
}, [value]);