feat: 버튼 컴포넌트 수정 액션에서 모달 제목/설명 전달
변경 사항: 1. InteractiveScreenViewer - handleEditAction 수정 ✅ - config에서 editModalTitle, editModalDescription 읽기 - openEditModal 이벤트로 제목/설명 전달 2. ButtonTypeConfig 타입 추가 ✅ - editModalTitle 필드 추가 - editModalDescription 필드 추가 3. ButtonConfigPanel 수정 ✅ - webTypeConfig에도 제목/설명 저장 - 이중 저장 (action + webTypeConfig) 결과: - ✅ 버튼의 수정 액션 실행 시 설정한 제목이 모달에 표시됨 - ✅ 버튼의 수정 액션 실행 시 설정한 설명이 모달에 표시됨 - ✅ EditModal이 openEditModal 이벤트에서 제목/설명 받음 - ✅ 전체 데이터 흐름 완성
This commit is contained in:
parent
114928ca4f
commit
3f76d16afe
|
|
@ -1382,9 +1382,29 @@ export const InteractiveScreenViewer: React.FC<InteractiveScreenViewerProps> = (
|
|||
|
||||
// 편집 액션
|
||||
const handleEditAction = () => {
|
||||
console.log("✏️ 편집 모드 활성화");
|
||||
// 읽기 전용 모드를 편집 모드로 전환
|
||||
alert("편집 모드로 전환되었습니다.");
|
||||
console.log("✏️ 수정 액션 실행");
|
||||
|
||||
// 버튼 컴포넌트의 수정 모달 설정 가져오기
|
||||
const editModalTitle = config?.editModalTitle || "";
|
||||
const editModalDescription = config?.editModalDescription || "";
|
||||
|
||||
console.log("📝 버튼 수정 모달 설정:", { editModalTitle, editModalDescription });
|
||||
|
||||
// EditModal 열기 이벤트 발생
|
||||
const event = new CustomEvent("openEditModal", {
|
||||
detail: {
|
||||
screenId: screenInfo?.id,
|
||||
modalSize: "lg",
|
||||
editData: formData,
|
||||
modalTitle: editModalTitle,
|
||||
modalDescription: editModalDescription,
|
||||
onSave: () => {
|
||||
console.log("✅ 수정 완료");
|
||||
// 필요시 폼 새로고침 또는 콜백 실행
|
||||
},
|
||||
},
|
||||
});
|
||||
window.dispatchEvent(event);
|
||||
};
|
||||
|
||||
// 추가 액션
|
||||
|
|
|
|||
|
|
@ -402,12 +402,15 @@ export const ButtonConfigPanel: React.FC<ButtonConfigPanelProps> = ({ component,
|
|||
id="edit-modal-title"
|
||||
placeholder="모달 제목을 입력하세요 (예: 데이터 수정)"
|
||||
value={config.action?.editModalTitle || ""}
|
||||
onChange={(e) =>
|
||||
onChange={(e) => {
|
||||
const newValue = e.target.value;
|
||||
onUpdateProperty("componentConfig.action", {
|
||||
...config.action,
|
||||
editModalTitle: e.target.value,
|
||||
})
|
||||
}
|
||||
editModalTitle: newValue,
|
||||
});
|
||||
// webTypeConfig에도 저장
|
||||
onUpdateProperty("webTypeConfig.editModalTitle", newValue);
|
||||
}}
|
||||
/>
|
||||
<p className="mt-1 text-xs text-gray-500">비워두면 기본 제목이 표시됩니다</p>
|
||||
</div>
|
||||
|
|
@ -418,12 +421,15 @@ export const ButtonConfigPanel: React.FC<ButtonConfigPanelProps> = ({ component,
|
|||
id="edit-modal-description"
|
||||
placeholder="모달 설명을 입력하세요 (예: 선택한 데이터를 수정합니다)"
|
||||
value={config.action?.editModalDescription || ""}
|
||||
onChange={(e) =>
|
||||
onChange={(e) => {
|
||||
const newValue = e.target.value;
|
||||
onUpdateProperty("componentConfig.action", {
|
||||
...config.action,
|
||||
editModalDescription: e.target.value,
|
||||
})
|
||||
}
|
||||
editModalDescription: newValue,
|
||||
});
|
||||
// webTypeConfig에도 저장
|
||||
onUpdateProperty("webTypeConfig.editModalDescription", newValue);
|
||||
}}
|
||||
/>
|
||||
<p className="mt-1 text-xs text-gray-500">비워두면 설명이 표시되지 않습니다</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -882,6 +882,10 @@ export interface ButtonTypeConfig {
|
|||
navigateScreenId?: number; // 이동할 화면 ID
|
||||
navigateTarget?: "_self" | "_blank";
|
||||
|
||||
// 수정 모달 설정
|
||||
editModalTitle?: string; // 수정 모달 제목
|
||||
editModalDescription?: string; // 수정 모달 설명
|
||||
|
||||
// 커스텀 액션 설정
|
||||
customAction?: string; // JavaScript 코드 또는 함수명
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue