diff --git a/frontend/components/v2/config-panels/V2CardDisplayConfigPanel.tsx b/frontend/components/v2/config-panels/V2CardDisplayConfigPanel.tsx index 41fbd011..4336bfc9 100644 --- a/frontend/components/v2/config-panels/V2CardDisplayConfigPanel.tsx +++ b/frontend/components/v2/config-panels/V2CardDisplayConfigPanel.tsx @@ -134,6 +134,11 @@ export const V2CardDisplayConfigPanel: React.FC = } current[keys[keys.length - 1]] = value; onChange(newConfig); + if (typeof window !== "undefined") { + window.dispatchEvent( + new CustomEvent("componentConfigChanged", { detail: { config: newConfig } }) + ); + } }; // 테이블 목록 로드 @@ -214,25 +219,17 @@ export const V2CardDisplayConfigPanel: React.FC = fetchEntityJoinColumns(); }, [targetTableName]); - const handleTableSelect = (tableName: string, isScreenTable: boolean) => { - if (isScreenTable) { - onChange({ - ...config, - useCustomTable: false, - customTableName: undefined, - tableName: tableName, - columnMapping: { displayColumns: [] }, - }); - } else { - onChange({ - ...config, - useCustomTable: true, - customTableName: tableName, - tableName: tableName, - columnMapping: { displayColumns: [] }, - }); - } + const handleTableSelect = (selectedTable: string, isScreenTable: boolean) => { + const newConfig = isScreenTable + ? { ...config, useCustomTable: false, customTableName: undefined, tableName: selectedTable, columnMapping: { displayColumns: [] } } + : { ...config, useCustomTable: true, customTableName: selectedTable, tableName: selectedTable, columnMapping: { displayColumns: [] } }; + onChange(newConfig); setTableComboboxOpen(false); + if (typeof window !== "undefined") { + window.dispatchEvent( + new CustomEvent("componentConfigChanged", { detail: { config: newConfig } }) + ); + } }; const getSelectedTableDisplay = () => { @@ -241,7 +238,6 @@ export const V2CardDisplayConfigPanel: React.FC = return found?.displayName || targetTableName; }; - // 컬럼 선택 시 조인 컬럼이면 joinColumns도 업데이트 const handleColumnSelect = (path: string, columnName: string) => { const joinColumn = entityJoinColumns.availableColumns.find( (col) => col.joinAlias === columnName @@ -261,11 +257,17 @@ export const V2CardDisplayConfigPanel: React.FC = referenceColumn: joinColumn.columnName, isJoinColumn: true, }; - onChange({ + const newConfig = { ...config, columnMapping: { ...config.columnMapping, [path.split(".")[1]]: columnName }, joinColumns: [...joinColumnsConfig, newJoinColumnConfig], - }); + }; + onChange(newConfig); + if (typeof window !== "undefined") { + window.dispatchEvent( + new CustomEvent("componentConfigChanged", { detail: { config: newConfig } }) + ); + } return; } } @@ -298,7 +300,7 @@ export const V2CardDisplayConfigPanel: React.FC = const joinTableInfo = entityJoinColumns.joinTables?.find( (jt) => jt.tableName === joinColumn.tableName ); - onChange({ + const newConfig = { ...config, columnMapping: { ...config.columnMapping, displayColumns: current }, joinColumns: [ @@ -312,7 +314,13 @@ export const V2CardDisplayConfigPanel: React.FC = isJoinColumn: true, }, ], - }); + }; + onChange(newConfig); + if (typeof window !== "undefined") { + window.dispatchEvent( + new CustomEvent("componentConfigChanged", { detail: { config: newConfig } }) + ); + } return; } } diff --git a/frontend/components/v2/config-panels/V2CategoryManagerConfigPanel.tsx b/frontend/components/v2/config-panels/V2CategoryManagerConfigPanel.tsx index 34d6e33c..d9d5ee1d 100644 --- a/frontend/components/v2/config-panels/V2CategoryManagerConfigPanel.tsx +++ b/frontend/components/v2/config-panels/V2CategoryManagerConfigPanel.tsx @@ -32,7 +32,13 @@ export const V2CategoryManagerConfigPanel: React.FC(key: K, value: V2CategoryManagerConfig[K]) => { - onChange({ ...config, [key]: value }); + const newConfig = { ...config, [key]: value }; + onChange(newConfig); + if (typeof window !== "undefined") { + window.dispatchEvent( + new CustomEvent("componentConfigChanged", { detail: { config: newConfig } }) + ); + } }; return (