화면간 데이터 전달기능 구현
This commit is contained in:
@@ -131,7 +131,7 @@ export const ScreenModal: React.FC<ScreenModalProps> = ({ className }) => {
|
||||
// 전역 모달 이벤트 리스너
|
||||
useEffect(() => {
|
||||
const handleOpenModal = (event: CustomEvent) => {
|
||||
const { screenId, title, description, size, urlParams, editData } = event.detail;
|
||||
const { screenId, title, description, size, urlParams, editData, splitPanelParentData } = event.detail;
|
||||
|
||||
// 🆕 모달 열린 시간 기록
|
||||
modalOpenedAtRef.current = Date.now();
|
||||
@@ -155,7 +155,12 @@ export const ScreenModal: React.FC<ScreenModalProps> = ({ className }) => {
|
||||
setOriginalData(editData); // 🆕 원본 데이터 저장 (UPDATE 판단용)
|
||||
} else {
|
||||
// 🆕 신규 등록 모드: 분할 패널 부모 데이터가 있으면 미리 설정
|
||||
const parentData = splitPanelContext?.getMappedParentData() || {};
|
||||
// 1순위: 이벤트로 전달된 splitPanelParentData (탭 안에서 열린 모달)
|
||||
// 2순위: splitPanelContext에서 직접 가져온 데이터 (분할 패널 내에서 열린 모달)
|
||||
const parentData = splitPanelParentData && Object.keys(splitPanelParentData).length > 0
|
||||
? splitPanelParentData
|
||||
: (splitPanelContext?.getMappedParentData() || {});
|
||||
|
||||
if (Object.keys(parentData).length > 0) {
|
||||
console.log("🔗 [ScreenModal] 분할 패널 부모 데이터 초기값 설정:", parentData);
|
||||
setFormData(parentData);
|
||||
|
||||
Reference in New Issue
Block a user