diff --git a/frontend/components/screen/panels/V2PropertiesPanel.tsx b/frontend/components/screen/panels/V2PropertiesPanel.tsx index b3377139..622e70f6 100644 --- a/frontend/components/screen/panels/V2PropertiesPanel.tsx +++ b/frontend/components/screen/panels/V2PropertiesPanel.tsx @@ -8,7 +8,6 @@ import { Badge } from "@/components/ui/badge"; import { Separator } from "@/components/ui/separator"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Checkbox } from "@/components/ui/checkbox"; -import { Textarea } from "@/components/ui/textarea"; import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible"; import { ChevronDown, Settings, Info, Database, Trash2, Copy, Palette } from "lucide-react"; import { @@ -44,20 +43,11 @@ import { DetailTypeOption, } from "@/types/input-type-mapping"; -// 새로운 컴포넌트 설정 패널들 -import { ButtonConfigPanel } from "../config-panels/ButtonConfigPanel"; -import { CardConfigPanel } from "../config-panels/CardConfigPanel"; -import { DashboardConfigPanel } from "../config-panels/DashboardConfigPanel"; import { ColorPickerWithTransparent } from "../common/ColorPickerWithTransparent"; -import { StatsCardConfigPanel } from "../config-panels/StatsCardConfigPanel"; // ComponentRegistry import (동적 ConfigPanel 가져오기용) import { ComponentRegistry } from "@/lib/registry/ComponentRegistry"; -import { ProgressBarConfigPanel } from "../config-panels/ProgressBarConfigPanel"; -import { ChartConfigPanel } from "../config-panels/ChartConfigPanel"; -import { AlertConfigPanel } from "../config-panels/AlertConfigPanel"; -import { BadgeConfigPanel } from "../config-panels/BadgeConfigPanel"; -import { DynamicComponentConfigPanel } from "@/lib/utils/getComponentConfigPanel"; +import { DynamicComponentConfigPanel, hasComponentConfigPanel } from "@/lib/utils/getComponentConfigPanel"; import StyleEditor from "../StyleEditor"; import { Slider } from "@/components/ui/slider"; import { Zap } from "lucide-react"; @@ -186,17 +176,6 @@ export const V2PropertiesPanel: React.FC = ({ selectedComponent.componentConfig?.id || selectedComponent.type; - const handleUpdateProperty = (path: string, value: any) => { - onUpdateProperty(selectedComponent.id, path, value); - }; - - const handleConfigChange = (newConfig: any) => { - // 기존 config와 병합하여 다른 속성 유지 - const currentConfig = selectedComponent.componentConfig?.config || {}; - const mergedConfig = { ...currentConfig, ...newConfig }; - onUpdateProperty(selectedComponent.id, "componentConfig.config", mergedConfig); - }; - // 🆕 ComponentRegistry에서 ConfigPanel 가져오기 시도 const componentId = selectedComponent.componentType || // ⭐ section-card 등 @@ -204,58 +183,6 @@ export const V2PropertiesPanel: React.FC = ({ selectedComponent.componentConfig?.id || (selectedComponent.type === "component" ? selectedComponent.id : null); // 🆕 독립 컴포넌트 (table-search-widget 등) - // 🆕 V2 컴포넌트 직접 감지 및 설정 패널 렌더링 - if (componentId?.startsWith("v2-")) { - const v2ConfigPanels: Record void }>> = { - "v2-input": require("@/components/v2/config-panels/V2InputConfigPanel").V2InputConfigPanel, - "v2-select": require("@/components/v2/config-panels/V2SelectConfigPanel").V2SelectConfigPanel, - "v2-date": require("@/components/v2/config-panels/V2DateConfigPanel").V2DateConfigPanel, - "v2-list": require("@/components/v2/config-panels/V2ListConfigPanel").V2ListConfigPanel, - "v2-layout": require("@/components/v2/config-panels/V2LayoutConfigPanel").V2LayoutConfigPanel, - "v2-group": require("@/components/v2/config-panels/V2GroupConfigPanel").V2GroupConfigPanel, - "v2-media": require("@/components/v2/config-panels/V2MediaConfigPanel").V2MediaConfigPanel, - "v2-biz": require("@/components/v2/config-panels/V2BizConfigPanel").V2BizConfigPanel, - "v2-hierarchy": require("@/components/v2/config-panels/V2HierarchyConfigPanel").V2HierarchyConfigPanel, - "v2-bom-item-editor": require("@/components/v2/config-panels/V2BomItemEditorConfigPanel").V2BomItemEditorConfigPanel, - "v2-bom-tree": require("@/components/v2/config-panels/V2BomTreeConfigPanel").V2BomTreeConfigPanel, - }; - - const V2ConfigPanel = v2ConfigPanels[componentId]; - if (V2ConfigPanel) { - const currentConfig = selectedComponent.componentConfig || {}; - const handleV2ConfigChange = (newConfig: any) => { - onUpdateProperty(selectedComponent.id, "componentConfig", { ...currentConfig, ...newConfig }); - }; - - // 컬럼의 inputType 가져오기 (entity 타입인지 확인용) - const inputType = currentConfig.inputType || currentConfig.webType || (selectedComponent as any).inputType; - - // 현재 화면의 테이블명 가져오기 - const currentTableName = tables?.[0]?.tableName; - - // 컴포넌트별 추가 props - const extraProps: Record = {}; - if (componentId === "v2-select") { - extraProps.inputType = inputType; - extraProps.tableName = selectedComponent.tableName || currentTable?.tableName || currentTableName; - extraProps.columnName = selectedComponent.columnName || currentConfig.fieldKey || currentConfig.columnName; - } - if (componentId === "v2-list") { - extraProps.currentTableName = currentTableName; - } - if (componentId === "v2-bom-item-editor" || componentId === "v2-bom-tree") { - extraProps.currentTableName = currentTableName; - extraProps.screenTableName = selectedComponent.tableName || currentTable?.tableName || currentTableName; - } - - return ( -
- -
- ); - } - } - if (componentId) { const definition = ComponentRegistry.getComponent(componentId); @@ -322,335 +249,42 @@ export const V2PropertiesPanel: React.FC = ({ ); } - // ConfigPanel이 없으면 아래 switch case로 넘어감 + // ConfigPanel이 없으면 DynamicComponentConfigPanel fallback으로 처리 } - // 기존 하드코딩된 설정 패널들 (레거시) - switch (componentType) { - case "button": - case "button-primary": - case "button-secondary": - case "v2-button-primary": - // 🔧 component.id만 key로 사용 (unmount 방지) - return ( - - ); + // DynamicComponentConfigPanel을 통한 동적 로드 (CONFIG_PANEL_MAP 기반) + const fallbackId = componentId || componentType; + if (fallbackId && hasComponentConfigPanel(fallbackId)) { + const handleDynamicConfigChange = (newConfig: any) => { + const currentConfig = selectedComponent.componentConfig || {}; + const mergedConfig = { ...currentConfig, ...newConfig }; + onUpdateProperty(selectedComponent.id, "componentConfig", mergedConfig); + }; - case "card": - return ; - - case "dashboard": - return ; - - case "stats": - case "stats-card": - return ; - - case "progress": - case "progress-bar": - return ; - - case "chart": - case "chart-basic": - return ; - - case "alert": - case "alert-info": - return ; - - case "badge": - case "badge-status": - return ; - - case "section-card": - return ( -
-
-

Section Card 설정

-

제목과 테두리가 있는 명확한 그룹화 컨테이너

-
- - {/* 헤더 표시 */} -
- { - handleUpdateProperty(selectedComponent.id, "componentConfig.showHeader", checked); - }} - /> - -
- - {/* 제목 */} - {selectedComponent.componentConfig?.showHeader !== false && ( -
- - { - handleUpdateProperty(selectedComponent.id, "componentConfig.title", e.target.value); - }} - placeholder="섹션 제목 입력" - className="h-9 text-xs" - /> -
- )} - - {/* 설명 */} - {selectedComponent.componentConfig?.showHeader !== false && ( -
- -