Merge pull request 'lhj' (#368) from lhj into main

Reviewed-on: http://39.117.244.52:3000/kjs/ERP-node/pulls/368
This commit is contained in:
hjlee 2026-01-16 16:51:03 +09:00
commit ee273c5103
1 changed files with 14 additions and 4 deletions

View File

@ -267,11 +267,13 @@ export const FieldChooser: React.FC<FieldChooserProps> = ({
const existingConfig = selectedFields.find((f) => f.field === field.field);
if (area === "none") {
// 필드 제거 또는 숨기기
// 🆕 필드 완전 제거 (visible: false 대신 배열에서 제거)
if (existingConfig) {
const newFields = selectedFields.map((f) =>
f.field === field.field ? { ...f, visible: false } : f
);
const newFields = selectedFields.filter((f) => f.field !== field.field);
console.log("🔷 [FieldChooser] 필드 제거:", {
removedField: field.field,
remainingFields: newFields.length,
});
onFieldsChange(newFields);
}
} else {
@ -282,6 +284,10 @@ export const FieldChooser: React.FC<FieldChooserProps> = ({
? { ...f, area, visible: true }
: f
);
console.log("🔷 [FieldChooser] 필드 영역 변경:", {
field: field.field,
newArea: area,
});
onFieldsChange(newFields);
} else {
// 새 필드 추가
@ -294,6 +300,10 @@ export const FieldChooser: React.FC<FieldChooserProps> = ({
summaryType: area === "data" ? "sum" : undefined,
areaIndex: selectedFields.filter((f) => f.area === area).length,
};
console.log("🔷 [FieldChooser] 필드 추가:", {
field: field.field,
area,
});
onFieldsChange([...selectedFields, newField]);
}
}