드래그 앤 드롭 기능 개선 및 Unified 컴포넌트 매핑 추가: ScreenDesigner, TabsWidget, DynamicComponentRenderer에서 드래그 앤 드롭 시 컴포넌트의 위치와 크기를 최적화하고, Unified 컴포넌트에 대한 매핑 로직을 추가하여 사용자 경험을 향상시켰습니다. 또한, ButtonConfigPanel에서 컴포넌트가 없는 경우 방어 처리 로직을 추가하여 안정성을 높였습니다.

This commit is contained in:
kjs
2026-01-20 14:01:35 +09:00
parent 58d658e638
commit 8cdb8a3047
7 changed files with 335 additions and 128 deletions

View File

@@ -187,7 +187,34 @@ export const DynamicComponentRenderer: React.FC<DynamicComponentRendererProps> =
...props
}) => {
// 컴포넌트 타입 추출 - 새 시스템에서는 componentType 속성 사용, 레거시는 type 사용
const componentType = (component as any).componentType || component.type;
const rawComponentType = (component as any).componentType || component.type;
// 🆕 레거시 타입을 v2 컴포넌트로 매핑 (v2 컴포넌트가 없으면 원본 유지)
const mapToV2ComponentType = (type: string | undefined): string | undefined => {
if (!type) return type;
// 이미 v2- 또는 unified- 접두사가 있으면 그대로 반환
if (type.startsWith("v2-") || type.startsWith("unified-")) return type;
// 레거시 타입을 v2로 매핑 시도
const v2Type = `v2-${type}`;
// v2 버전이 등록되어 있는지 확인
if (ComponentRegistry.hasComponent(v2Type)) {
return v2Type;
}
// v2 버전이 없으면 원본 유지
return type;
};
const componentType = mapToV2ComponentType(rawComponentType);
// 디버그: 컴포넌트 타입 확인
if (rawComponentType && rawComponentType.includes("table")) {
console.log("🔍 DynamicComponentRenderer 타입 변환:", {
raw: rawComponentType,
mapped: componentType,
hasComponent: ComponentRegistry.hasComponent(componentType || ""),
componentConfig: (component as any).componentConfig,
});
}
// 🆕 Unified 폼 시스템 연동 (최상위에서 한 번만 호출)
// eslint-disable-next-line react-hooks/rules-of-hooks