refactor: 코드 정리 및 불필요한 로그 제거
- scheduleService.ts에서 스케줄 생성 로직을 간소화하고, 불필요한 줄바꿈을 제거하여 가독성을 향상시켰습니다. - v2-sales-order-modal-layout.json에서 JSON 포맷을 정리하여 일관성을 유지했습니다. - page.tsx, ScreenModal.tsx, ScreenDesigner.tsx, V2Input.tsx, V2Select.tsx, V2SelectConfigPanel.tsx, SimpleRepeaterTableComponent.tsx, ButtonPrimaryComponent.tsx, FileUploadComponent.tsx 등 여러 파일에서 디버깅 로그를 제거하여 코드의 깔끔함을 유지했습니다. - 전반적으로 코드의 가독성을 높이고, 불필요한 로그를 제거하여 유지보수성을 개선했습니다.
This commit is contained in:
@@ -38,19 +38,19 @@ interface LegacyLayoutData {
|
||||
// ============================================
|
||||
function applyDefaultsToNestedComponents(components: any[]): any[] {
|
||||
if (!Array.isArray(components)) return components;
|
||||
|
||||
|
||||
return components.map((nestedComp: any) => {
|
||||
if (!nestedComp) return nestedComp;
|
||||
|
||||
|
||||
// 중첩 컴포넌트의 타입 확인 (componentType 또는 url에서 추출)
|
||||
let nestedComponentType = nestedComp.componentType;
|
||||
if (!nestedComponentType && nestedComp.url) {
|
||||
nestedComponentType = getComponentTypeFromUrl(nestedComp.url);
|
||||
}
|
||||
|
||||
|
||||
// 결과 객체 초기화 (원본 복사)
|
||||
let result = { ...nestedComp };
|
||||
|
||||
const result = { ...nestedComp };
|
||||
|
||||
// 🆕 탭 위젯인 경우 재귀적으로 탭 내부 컴포넌트도 처리
|
||||
if (nestedComponentType === "v2-tabs-widget") {
|
||||
const config = result.componentConfig || {};
|
||||
@@ -69,31 +69,35 @@ function applyDefaultsToNestedComponents(components: any[]): any[] {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 🆕 분할 패널인 경우 재귀적으로 내부 컴포넌트도 처리
|
||||
if (nestedComponentType === "v2-split-panel-layout") {
|
||||
const config = result.componentConfig || {};
|
||||
result.componentConfig = {
|
||||
...config,
|
||||
leftPanel: config.leftPanel ? {
|
||||
...config.leftPanel,
|
||||
components: applyDefaultsToNestedComponents(config.leftPanel.components || []),
|
||||
} : config.leftPanel,
|
||||
rightPanel: config.rightPanel ? {
|
||||
...config.rightPanel,
|
||||
components: applyDefaultsToNestedComponents(config.rightPanel.components || []),
|
||||
} : config.rightPanel,
|
||||
leftPanel: config.leftPanel
|
||||
? {
|
||||
...config.leftPanel,
|
||||
components: applyDefaultsToNestedComponents(config.leftPanel.components || []),
|
||||
}
|
||||
: config.leftPanel,
|
||||
rightPanel: config.rightPanel
|
||||
? {
|
||||
...config.rightPanel,
|
||||
components: applyDefaultsToNestedComponents(config.rightPanel.components || []),
|
||||
}
|
||||
: config.rightPanel,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// 컴포넌트 타입이 없으면 그대로 반환
|
||||
if (!nestedComponentType) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// 중첩 컴포넌트의 기본값 가져오기
|
||||
const nestedDefaults = getDefaultsByUrl(`registry://${nestedComponentType}`);
|
||||
|
||||
|
||||
// componentConfig가 있으면 기본값과 병합
|
||||
if (result.componentConfig && Object.keys(nestedDefaults).length > 0) {
|
||||
const mergedNestedConfig = mergeComponentConfig(nestedDefaults, result.componentConfig);
|
||||
@@ -102,7 +106,7 @@ function applyDefaultsToNestedComponents(components: any[]): any[] {
|
||||
componentConfig: mergedNestedConfig,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
});
|
||||
}
|
||||
@@ -112,7 +116,7 @@ function applyDefaultsToNestedComponents(components: any[]): any[] {
|
||||
// ============================================
|
||||
function applyDefaultsToSplitPanelComponents(mergedConfig: Record<string, any>): Record<string, any> {
|
||||
const result = { ...mergedConfig };
|
||||
|
||||
|
||||
// leftPanel.components 처리
|
||||
if (result.leftPanel?.components) {
|
||||
result.leftPanel = {
|
||||
@@ -120,7 +124,7 @@ function applyDefaultsToSplitPanelComponents(mergedConfig: Record<string, any>):
|
||||
components: applyDefaultsToNestedComponents(result.leftPanel.components),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// rightPanel.components 처리
|
||||
if (result.rightPanel?.components) {
|
||||
result.rightPanel = {
|
||||
@@ -128,7 +132,7 @@ function applyDefaultsToSplitPanelComponents(mergedConfig: Record<string, any>):
|
||||
components: applyDefaultsToNestedComponents(result.rightPanel.components),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -149,7 +153,7 @@ export function convertV2ToLegacy(v2Layout: LayoutV2 | null): LegacyLayoutData |
|
||||
if (componentType === "v2-split-panel-layout") {
|
||||
mergedConfig = applyDefaultsToSplitPanelComponents(mergedConfig);
|
||||
}
|
||||
|
||||
|
||||
// 🆕 탭 위젯인 경우 탭 내부 컴포넌트에도 기본값 적용
|
||||
if (componentType === "v2-tabs-widget" && mergedConfig.tabs) {
|
||||
mergedConfig = {
|
||||
@@ -273,15 +277,15 @@ export function convertLegacyToV2(legacyLayout: LegacyLayoutData): LayoutV2 {
|
||||
...(configOverrides.style || {}),
|
||||
...(topLevelProps.style || {}),
|
||||
};
|
||||
|
||||
|
||||
// 🔧 webTypeConfig도 병합 (topLevelProps가 우선, dataflowConfig 등 보존)
|
||||
const mergedWebTypeConfig = {
|
||||
...(configOverrides.webTypeConfig || {}),
|
||||
...(topLevelProps.webTypeConfig || {}),
|
||||
};
|
||||
|
||||
const overrides = {
|
||||
...topLevelProps,
|
||||
|
||||
const overrides = {
|
||||
...topLevelProps,
|
||||
...configOverrides,
|
||||
// 🆕 병합된 style 사용 (comp.style 값이 최종 우선)
|
||||
...(Object.keys(mergedStyle).length > 0 ? { style: mergedStyle } : {}),
|
||||
|
||||
Reference in New Issue
Block a user