refactor: Improve label toggling functionality in ScreenDesigner and enhance SelectedItemsDetailInputComponent

- Updated the label toggling logic in ScreenDesigner to allow toggling of labels for selected components or all components based on the current selection.
- Enhanced the SelectedItemsDetailInputComponent by implementing a caching mechanism for table columns and refining the logic for loading category options based on field groups.
- Introduced a new helper function to convert category codes to labels, improving the clarity and maintainability of the price calculation logic.
- Added support for determining the source table for field groups, facilitating better data management and retrieval.
This commit is contained in:
DDD1542
2026-02-09 10:07:07 +09:00
parent 79d8f0b160
commit bb4d90fd58
4 changed files with 252 additions and 99 deletions
+23 -7
View File
@@ -1871,17 +1871,33 @@ export default function ScreenDesigner({ selectedScreen, onBackToList, onScreenU
[groupState.selectedComponents, layout, selectedComponent?.id, saveToHistory]
);
// 라벨 일괄 토글
// 라벨 일괄 토글 (선택된 컴포넌트가 있으면 선택된 것만, 없으면 전체)
const handleToggleAllLabels = useCallback(() => {
saveToHistory(layout);
const newComponents = toggleAllLabels(layout.components);
const selectedIds = groupState.selectedComponents;
const isPartial = selectedIds.length > 0;
// 토글 대상 컴포넌트 필터
const targetComponents = layout.components.filter((c) => {
if (!c.label || ["group", "datatable"].includes(c.type)) return false;
if (isPartial) return selectedIds.includes(c.id);
return true;
});
const hadHidden = targetComponents.some(
(c) => (c.style as any)?.labelDisplay === false
);
const newComponents = toggleAllLabels(layout.components, selectedIds);
setLayout((prev) => ({ ...prev, components: newComponents }));
const hasHidden = layout.components.some(
(c) => c.type === "widget" && (c.style as any)?.labelDisplay === false
);
toast.success(hasHidden ? "모든 라벨 표시" : "모든 라벨 숨기기");
}, [layout, saveToHistory]);
// 강제 리렌더링 트리거
setForceRenderTrigger((prev) => prev + 1);
const scope = isPartial ? `선택된 ${targetComponents.length}` : "모든";
toast.success(hadHidden ? `${scope} 라벨 표시` : `${scope} 라벨 숨기기`);
}, [layout, saveToHistory, groupState.selectedComponents]);
// Nudge (화살표 키 이동)
const handleNudge = useCallback(