Compare commits
No commits in common. "025c28bdbe8d24a2e9d34f4d803053dfe7036a15" and "ba5ee357cad7d0600f0a4a2bf3e652f277c169f5" have entirely different histories.
025c28bdbe
...
ba5ee357ca
|
|
@ -1632,36 +1632,16 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
|
|||
const handleEditClick = useCallback(
|
||||
(panel: "left" | "right", item: any) => {
|
||||
// 🆕 우측 패널 수정 버튼 설정 확인
|
||||
// 🔧 현재 활성 탭에 따라 해당 탭의 editButton 설정 사용
|
||||
if (panel === "right") {
|
||||
// 기본 탭(0)이면 rightPanel.editButton, 추가 탭이면 additionalTabs의 editButton 사용
|
||||
const editButtonConfig =
|
||||
activeTabIndex === 0
|
||||
? componentConfig.rightPanel?.editButton
|
||||
: componentConfig.rightPanel?.additionalTabs?.[activeTabIndex - 1]?.editButton;
|
||||
|
||||
// 해당 탭의 테이블명 가져오기
|
||||
const currentTableName =
|
||||
activeTabIndex === 0
|
||||
? componentConfig.rightPanel?.tableName || ""
|
||||
: componentConfig.rightPanel?.additionalTabs?.[activeTabIndex - 1]?.tableName || "";
|
||||
|
||||
console.log("🔧 [SplitPanel] 수정 버튼 클릭 - 현재 탭 설정 확인:", {
|
||||
activeTabIndex,
|
||||
editButtonConfig,
|
||||
currentTableName,
|
||||
isModalMode: editButtonConfig?.mode === "modal",
|
||||
});
|
||||
|
||||
if (editButtonConfig?.mode === "modal") {
|
||||
const modalScreenId = editButtonConfig.modalScreenId;
|
||||
if (panel === "right" && componentConfig.rightPanel?.editButton?.mode === "modal") {
|
||||
const modalScreenId = componentConfig.rightPanel?.editButton?.modalScreenId;
|
||||
|
||||
if (modalScreenId) {
|
||||
// 커스텀 모달 화면 열기
|
||||
const rightTableName = componentConfig.rightPanel?.tableName || "";
|
||||
|
||||
// Primary Key 찾기 (우선순위: 설정값 > id > ID > non-null 필드)
|
||||
// 🔧 설정에서 primaryKeyColumn 지정 가능
|
||||
const configuredPrimaryKey = editButtonConfig.primaryKeyColumn;
|
||||
const configuredPrimaryKey = componentConfig.rightPanel?.editButton?.primaryKeyColumn;
|
||||
|
||||
let primaryKeyName = "id";
|
||||
let primaryKeyValue: any;
|
||||
|
|
@ -1696,8 +1676,7 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
|
|||
}
|
||||
|
||||
console.log("✅ 수정 모달 열기:", {
|
||||
activeTabIndex,
|
||||
tableName: currentTableName,
|
||||
tableName: rightTableName,
|
||||
primaryKeyName,
|
||||
primaryKeyValue,
|
||||
screenId: modalScreenId,
|
||||
|
|
@ -1706,15 +1685,15 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
|
|||
|
||||
// modalDataStore에도 저장 (호환성 유지)
|
||||
import("@/stores/modalDataStore").then(({ useModalDataStore }) => {
|
||||
useModalDataStore.getState().setData(currentTableName, [item]);
|
||||
useModalDataStore.getState().setData(rightTableName, [item]);
|
||||
});
|
||||
|
||||
// 🆕 groupByColumns 추출
|
||||
const groupByColumns = editButtonConfig.groupByColumns || [];
|
||||
const groupByColumns = componentConfig.rightPanel?.editButton?.groupByColumns || [];
|
||||
|
||||
console.log("🔧 [SplitPanel] 수정 버튼 클릭 - groupByColumns 확인:", {
|
||||
groupByColumns,
|
||||
editButtonConfig,
|
||||
editButtonConfig: componentConfig.rightPanel?.editButton,
|
||||
hasGroupByColumns: groupByColumns.length > 0,
|
||||
});
|
||||
|
||||
|
|
@ -1726,7 +1705,7 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
|
|||
urlParams: {
|
||||
mode: "edit",
|
||||
editId: primaryKeyValue,
|
||||
tableName: currentTableName,
|
||||
tableName: rightTableName,
|
||||
primaryKeyColumn: primaryKeyName, // 🆕 Primary Key 컬럼명 전달
|
||||
...(groupByColumns.length > 0 && {
|
||||
groupByColumns: JSON.stringify(groupByColumns),
|
||||
|
|
@ -1739,7 +1718,7 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
|
|||
console.log("✅ [SplitPanel] openScreenModal 이벤트 발생:", {
|
||||
screenId: modalScreenId,
|
||||
editId: primaryKeyValue,
|
||||
tableName: currentTableName,
|
||||
tableName: rightTableName,
|
||||
primaryKeyColumn: primaryKeyName,
|
||||
groupByColumns: groupByColumns.length > 0 ? JSON.stringify(groupByColumns) : "없음",
|
||||
});
|
||||
|
|
@ -1747,7 +1726,6 @@ export const SplitPanelLayoutComponent: React.FC<SplitPanelLayoutComponentProps>
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 기존 자동 편집 모드 (인라인 편집 모달)
|
||||
setEditModalPanel(panel);
|
||||
|
|
|
|||
Loading…
Reference in New Issue