diff --git a/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx b/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx index dff4ee3a..dbb99963 100644 --- a/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx +++ b/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx @@ -160,6 +160,16 @@ export const SplitPanelLayoutComponent: React.FC // searchTerm 제거 - 클라이언트 사이드에서 필터링 }); + // 가나다순 정렬 (좌측 패널의 표시 컬럼 기준) + const leftColumn = componentConfig.rightPanel?.relation?.leftColumn; + if (leftColumn && result.data.length > 0) { + result.data.sort((a, b) => { + const aValue = String(a[leftColumn] || ''); + const bValue = String(b[leftColumn] || ''); + return aValue.localeCompare(bValue, 'ko-KR'); + }); + } + // 계층 구조 빌드 const hierarchicalData = buildHierarchy(result.data); setLeftData(hierarchicalData); @@ -173,7 +183,7 @@ export const SplitPanelLayoutComponent: React.FC } finally { setIsLoadingLeft(false); } - }, [componentConfig.leftPanel?.tableName, isDesignMode, toast, buildHierarchy]); + }, [componentConfig.leftPanel?.tableName, componentConfig.rightPanel?.relation?.leftColumn, isDesignMode, toast, buildHierarchy]); // 우측 데이터 로드 const loadRightData = useCallback( @@ -293,9 +303,19 @@ export const SplitPanelLayoutComponent: React.FC // 추가 버튼 핸들러 const handleAddClick = useCallback((panel: "left" | "right") => { setAddModalPanel(panel); - setAddModalFormData({}); + + // 우측 패널 추가 시, 좌측에서 선택된 항목의 조인 컬럼 값을 자동으로 채움 + if (panel === "right" && selectedLeftItem && componentConfig.leftPanel?.leftColumn && componentConfig.rightPanel?.rightColumn) { + const leftColumnValue = selectedLeftItem[componentConfig.leftPanel.leftColumn]; + setAddModalFormData({ + [componentConfig.rightPanel.rightColumn]: leftColumnValue + }); + } else { + setAddModalFormData({}); + } + setShowAddModal(true); - }, []); + }, [selectedLeftItem, componentConfig]); // 수정 버튼 핸들러 const handleEditClick = useCallback((panel: "left" | "right", item: any) => { @@ -1316,10 +1336,17 @@ export const SplitPanelLayoutComponent: React.FC return modalColumns?.map((col, index) => { // 항목별 추가 버튼으로 열렸을 때, parentColumn은 미리 채워져 있고 수정 불가 - const isPreFilled = addModalPanel === "left-item" + const isItemAddPreFilled = addModalPanel === "left-item" && componentConfig.leftPanel?.itemAddConfig?.parentColumn === col.name && addModalFormData[col.name]; + // 우측 패널 추가 시, 조인 컬럼(rightColumn)은 미리 채워져 있고 수정 불가 + const isRightJoinPreFilled = addModalPanel === "right" + && componentConfig.rightPanel?.rightColumn === col.name + && addModalFormData[col.name]; + + const isPreFilled = isItemAddPreFilled || isRightJoinPreFilled; + return (