From 2fac9371c868ee64cbebb800e186986d7c1a0d4a Mon Sep 17 00:00:00 2001 From: kjs Date: Wed, 28 Jan 2026 16:40:37 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20UnifiedSelect=20=EB=B0=8F=20DynamicComp?= =?UTF-8?q?onentRenderer=EC=97=90=EC=84=9C=20DISTINCT=20=EA=B0=92=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=20=EB=A1=9C=EB=93=9C=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - UnifiedSelect 컴포넌트에서 columnName이 유효하지 않은 경우 옵션 로드를 건너뛰도록 개선하였습니다. - DynamicComponentRenderer에서 unified-select의 기본 source를 'distinct'로 설정하여 항상 테이블 컬럼에서 DISTINCT 값을 자동으로 로드하도록 변경하였습니다. - layoutV2Converter에서 상위 레벨 속성을 추출하고, componentConfig와 병합하여 레거시 구조와의 호환성을 유지하였습니다. - 관련된 경고 메시지를 추가하여 유효하지 않은 columnName에 대한 정보를 로그로 남기도록 하였습니다. --- frontend/components/unified/UnifiedSelect.tsx | 7 ++++- .../lib/registry/DynamicComponentRenderer.tsx | 5 ++-- frontend/lib/utils/layoutV2Converter.ts | 29 +++++++++++++++++-- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/frontend/components/unified/UnifiedSelect.tsx b/frontend/components/unified/UnifiedSelect.tsx index d57ae9ad..a5c604be 100644 --- a/frontend/components/unified/UnifiedSelect.tsx +++ b/frontend/components/unified/UnifiedSelect.tsx @@ -621,7 +621,9 @@ export const UnifiedSelect = forwardRef( } else if (source === "select" || source === "distinct") { // 해당 테이블의 해당 컬럼에서 DISTINCT 값 조회 // tableName, columnName은 props에서 가져옴 - if (tableName && columnName) { + // 🆕 columnName이 컴포넌트 ID 형식(comp_xxx)이면 유효하지 않으므로 건너뜀 + const isValidColumnName = columnName && !columnName.startsWith("comp_"); + if (tableName && isValidColumnName) { const response = await apiClient.get(`/entity/${tableName}/distinct/${columnName}`); const data = response.data; if (data.success && data.data) { @@ -630,6 +632,9 @@ export const UnifiedSelect = forwardRef( label: String(item.label), })); } + } else if (!isValidColumnName) { + // columnName이 없거나 유효하지 않으면 빈 옵션 + console.warn("UnifiedSelect: 유효한 columnName이 없어 옵션을 로드하지 않습니다.", { tableName, columnName }); } } diff --git a/frontend/lib/registry/DynamicComponentRenderer.tsx b/frontend/lib/registry/DynamicComponentRenderer.tsx index 2a7440f6..8ef6a943 100644 --- a/frontend/lib/registry/DynamicComponentRenderer.tsx +++ b/frontend/lib/registry/DynamicComponentRenderer.tsx @@ -279,14 +279,15 @@ export const DynamicComponentRenderer: React.FC = ); case "unified-select": + // 🆕 unified-select는 항상 테이블 컬럼에서 distinct 값을 자동 로드 + // 정적 옵션(static)은 사용하지 않음 return ( = {}; + if (comp.tableName) topLevelProps.tableName = comp.tableName; + if (comp.columnName) topLevelProps.columnName = comp.columnName; + if (comp.label) topLevelProps.label = comp.label; + if (comp.required !== undefined) topLevelProps.required = comp.required; + if (comp.readonly !== undefined) topLevelProps.readonly = comp.readonly; + if (comp.codeCategory) topLevelProps.codeCategory = comp.codeCategory; + if (comp.inputType) topLevelProps.inputType = comp.inputType; + if (comp.webType) topLevelProps.webType = comp.webType; + // 현재 설정에서 차이값만 추출 const fullConfig = comp.componentConfig || {}; - const overrides = extractCustomConfig(fullConfig, defaults); + const configOverrides = extractCustomConfig(fullConfig, defaults); + + // 상위 레벨 속성과 componentConfig 병합 + const overrides = { ...topLevelProps, ...configOverrides }; return { id: comp.id,