이력테이블 기준 컬럼 설정 기능
This commit is contained in:
@@ -48,7 +48,6 @@ export async function getComponentConfigPanel(componentId: string): Promise<Reac
|
||||
}
|
||||
|
||||
try {
|
||||
console.log(`🔧 ConfigPanel 로드 중: ${componentId}`);
|
||||
const module = await importFn();
|
||||
|
||||
// 모듈에서 ConfigPanel 컴포넌트 추출
|
||||
@@ -65,7 +64,6 @@ export async function getComponentConfigPanel(componentId: string): Promise<Reac
|
||||
|
||||
// 캐시에 저장
|
||||
configPanelCache.set(componentId, ConfigPanelComponent);
|
||||
console.log(`✅ ConfigPanel 로드 완료: ${componentId}`);
|
||||
|
||||
return ConfigPanelComponent;
|
||||
} catch (error) {
|
||||
@@ -119,8 +117,6 @@ export const DynamicComponentConfigPanel: React.FC<ComponentConfigPanelProps> =
|
||||
tableColumns,
|
||||
tables,
|
||||
}) => {
|
||||
console.log(`🔥 DynamicComponentConfigPanel 렌더링 시작: ${componentId}`);
|
||||
|
||||
// 모든 useState를 최상단에 선언 (Hooks 규칙)
|
||||
const [ConfigPanelComponent, setConfigPanelComponent] = React.useState<React.ComponentType<any> | null>(null);
|
||||
const [loading, setLoading] = React.useState(true);
|
||||
@@ -133,12 +129,10 @@ export const DynamicComponentConfigPanel: React.FC<ComponentConfigPanelProps> =
|
||||
|
||||
async function loadConfigPanel() {
|
||||
try {
|
||||
console.log(`🔧 DynamicComponentConfigPanel: ${componentId} 로드 시작`);
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
const component = await getComponentConfigPanel(componentId);
|
||||
console.log(`🔧 DynamicComponentConfigPanel: ${componentId} 로드 결과:`, component);
|
||||
|
||||
if (mounted) {
|
||||
setConfigPanelComponent(() => component);
|
||||
@@ -217,38 +211,20 @@ export const DynamicComponentConfigPanel: React.FC<ComponentConfigPanelProps> =
|
||||
);
|
||||
}
|
||||
|
||||
console.log(`🔧 DynamicComponentConfigPanel 렌더링:`, {
|
||||
componentId,
|
||||
ConfigPanelComponent: ConfigPanelComponent?.name,
|
||||
config,
|
||||
configType: typeof config,
|
||||
configKeys: typeof config === "object" ? Object.keys(config || {}) : "not object",
|
||||
screenTableName,
|
||||
tableColumns: Array.isArray(tableColumns) ? tableColumns.length : tableColumns,
|
||||
tables: Array.isArray(tables) ? tables.length : tables,
|
||||
tablesType: typeof tables,
|
||||
tablesDetail: tables, // 전체 테이블 목록 확인
|
||||
});
|
||||
|
||||
// 테이블 변경 핸들러 - 선택된 테이블의 컬럼을 동적으로 로드
|
||||
const handleTableChange = async (tableName: string) => {
|
||||
console.log("🔄 테이블 변경:", tableName);
|
||||
try {
|
||||
// 먼저 tables에서 찾아보기 (이미 컬럼이 있는 경우)
|
||||
const existingTable = tables?.find((t) => t.tableName === tableName);
|
||||
if (existingTable && existingTable.columns && existingTable.columns.length > 0) {
|
||||
console.log("✅ 캐시된 테이블 컬럼 사용:", existingTable.columns.length, "개");
|
||||
setSelectedTableColumns(existingTable.columns);
|
||||
return;
|
||||
}
|
||||
|
||||
// 컬럼이 없으면 tableTypeApi로 조회 (ScreenDesigner와 동일한 방식)
|
||||
console.log("🔍 테이블 컬럼 API 조회:", tableName);
|
||||
const { tableTypeApi } = await import("@/lib/api/screen");
|
||||
const columnsResponse = await tableTypeApi.getColumns(tableName);
|
||||
|
||||
console.log("🔍 컬럼 응답 데이터:", columnsResponse);
|
||||
|
||||
const columns = (columnsResponse || []).map((col: any) => ({
|
||||
tableName: col.tableName || tableName,
|
||||
columnName: col.columnName || col.column_name,
|
||||
@@ -265,7 +241,6 @@ export const DynamicComponentConfigPanel: React.FC<ComponentConfigPanelProps> =
|
||||
codeValue: col.codeValue || col.code_value,
|
||||
}));
|
||||
|
||||
console.log("✅ 테이블 컬럼 로드 성공:", columns.length, "개");
|
||||
setSelectedTableColumns(columns);
|
||||
} catch (error) {
|
||||
console.error("❌ 테이블 변경 오류:", error);
|
||||
|
||||
@@ -165,11 +165,6 @@ export function migrateComponentsToColumnSpan(
|
||||
* @returns 새로운 그리드 시스템으로 변환된 레이아웃
|
||||
*/
|
||||
export function migrateLayoutToGridSystem(layout: LayoutData, canvasWidth: number = 1920): LayoutData {
|
||||
console.log("🔄 레이아웃 마이그레이션 시작:", {
|
||||
screenId: layout.screenId,
|
||||
componentCount: layout.components.length,
|
||||
});
|
||||
|
||||
// 1단계: width를 gridColumnSpan으로 변환
|
||||
let migratedComponents = migrateComponentsToColumnSpan(layout.components, canvasWidth);
|
||||
|
||||
@@ -179,11 +174,6 @@ export function migrateLayoutToGridSystem(layout: LayoutData, canvasWidth: numbe
|
||||
// 3단계: 같은 행 내에서 X 좌표로 gridColumnStart 계산
|
||||
migratedComponents = calculateColumnStarts(migratedComponents);
|
||||
|
||||
console.log("✅ 마이그레이션 완료:", {
|
||||
componentCount: migratedComponents.length,
|
||||
sampleComponent: migratedComponents[0],
|
||||
});
|
||||
|
||||
return {
|
||||
...layout,
|
||||
components: migratedComponents,
|
||||
@@ -233,7 +223,6 @@ export function needsMigration(layout: LayoutData): boolean {
|
||||
export function safeMigrateLayout(layout: LayoutData, canvasWidth: number = 1920): LayoutData {
|
||||
try {
|
||||
if (!needsMigration(layout)) {
|
||||
console.log("⏭️ 마이그레이션 불필요 - 이미 최신 형식");
|
||||
return layout;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user