203 lines
7.2 KiB
TypeScript
203 lines
7.2 KiB
TypeScript
|
|
"use client";
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Unified 컴포넌트 레지스트리 등록
|
||
|
|
*
|
||
|
|
* 9개의 Unified 컴포넌트를 ComponentRegistry에 등록합니다.
|
||
|
|
*/
|
||
|
|
|
||
|
|
import { ComponentRegistry } from "@/lib/registry/ComponentRegistry";
|
||
|
|
import { ComponentDefinition, ComponentCategory } from "@/types/component";
|
||
|
|
import { WebType } from "@/types/screen";
|
||
|
|
|
||
|
|
// 실제 컴포넌트 import
|
||
|
|
import { UnifiedInput } from "./UnifiedInput";
|
||
|
|
import { UnifiedSelect } from "./UnifiedSelect";
|
||
|
|
import { UnifiedDate } from "./UnifiedDate";
|
||
|
|
import { UnifiedList } from "./UnifiedList";
|
||
|
|
import { UnifiedLayout } from "./UnifiedLayout";
|
||
|
|
import { UnifiedGroup } from "./UnifiedGroup";
|
||
|
|
import { UnifiedMedia } from "./UnifiedMedia";
|
||
|
|
import { UnifiedBiz } from "./UnifiedBiz";
|
||
|
|
import { UnifiedHierarchy } from "./UnifiedHierarchy";
|
||
|
|
|
||
|
|
// 설정 패널 import
|
||
|
|
import { UnifiedInputConfigPanel } from "./config-panels/UnifiedInputConfigPanel";
|
||
|
|
import { UnifiedSelectConfigPanel } from "./config-panels/UnifiedSelectConfigPanel";
|
||
|
|
import { UnifiedDateConfigPanel } from "./config-panels/UnifiedDateConfigPanel";
|
||
|
|
import { UnifiedListConfigPanel } from "./config-panels/UnifiedListConfigPanel";
|
||
|
|
import { UnifiedLayoutConfigPanel } from "./config-panels/UnifiedLayoutConfigPanel";
|
||
|
|
import { UnifiedGroupConfigPanel } from "./config-panels/UnifiedGroupConfigPanel";
|
||
|
|
import { UnifiedMediaConfigPanel } from "./config-panels/UnifiedMediaConfigPanel";
|
||
|
|
import { UnifiedBizConfigPanel } from "./config-panels/UnifiedBizConfigPanel";
|
||
|
|
import { UnifiedHierarchyConfigPanel } from "./config-panels/UnifiedHierarchyConfigPanel";
|
||
|
|
|
||
|
|
// Unified 컴포넌트 정의
|
||
|
|
const unifiedComponentDefinitions: ComponentDefinition[] = [
|
||
|
|
{
|
||
|
|
id: "unified-input",
|
||
|
|
name: "통합 입력",
|
||
|
|
description: "텍스트, 숫자, 비밀번호, 슬라이더, 컬러 등 다양한 입력 타입을 지원하는 통합 컴포넌트",
|
||
|
|
category: ComponentCategory.UNIFIED,
|
||
|
|
webType: "text" as WebType,
|
||
|
|
component: UnifiedInput as any,
|
||
|
|
tags: ["input", "text", "number", "password", "slider", "color", "unified"],
|
||
|
|
defaultSize: { width: 200, height: 40 },
|
||
|
|
configPanel: UnifiedInputConfigPanel as any,
|
||
|
|
defaultConfig: {
|
||
|
|
inputType: "text",
|
||
|
|
format: "none",
|
||
|
|
placeholder: "",
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: "unified-select",
|
||
|
|
name: "통합 선택",
|
||
|
|
description: "드롭다운, 라디오, 체크박스, 태그, 토글 등 다양한 선택 방식을 지원하는 통합 컴포넌트",
|
||
|
|
category: ComponentCategory.UNIFIED,
|
||
|
|
webType: "select" as WebType,
|
||
|
|
component: UnifiedSelect as any,
|
||
|
|
tags: ["select", "dropdown", "radio", "checkbox", "toggle", "unified"],
|
||
|
|
defaultSize: { width: 200, height: 40 },
|
||
|
|
configPanel: UnifiedSelectConfigPanel as any,
|
||
|
|
defaultConfig: {
|
||
|
|
mode: "dropdown",
|
||
|
|
source: "static",
|
||
|
|
options: [],
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: "unified-date",
|
||
|
|
name: "통합 날짜",
|
||
|
|
description: "날짜, 시간, 날짜시간, 날짜 범위 등을 지원하는 통합 컴포넌트",
|
||
|
|
category: ComponentCategory.UNIFIED,
|
||
|
|
webType: "date" as WebType,
|
||
|
|
component: UnifiedDate as any,
|
||
|
|
tags: ["date", "time", "datetime", "datepicker", "unified"],
|
||
|
|
defaultSize: { width: 200, height: 40 },
|
||
|
|
configPanel: UnifiedDateConfigPanel as any,
|
||
|
|
defaultConfig: {
|
||
|
|
dateType: "date",
|
||
|
|
format: "YYYY-MM-DD",
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: "unified-list",
|
||
|
|
name: "통합 목록",
|
||
|
|
description: "테이블, 카드, 칸반, 리스트 등 다양한 데이터 표시 방식을 지원하는 통합 컴포넌트",
|
||
|
|
category: ComponentCategory.UNIFIED,
|
||
|
|
webType: "list" as WebType,
|
||
|
|
component: UnifiedList as any,
|
||
|
|
tags: ["list", "table", "card", "kanban", "data", "unified"],
|
||
|
|
defaultSize: { width: 600, height: 400 },
|
||
|
|
configPanel: UnifiedListConfigPanel as any,
|
||
|
|
defaultConfig: {
|
||
|
|
viewMode: "table",
|
||
|
|
source: "static",
|
||
|
|
columns: [],
|
||
|
|
pagination: true,
|
||
|
|
sortable: true,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: "unified-layout",
|
||
|
|
name: "통합 레이아웃",
|
||
|
|
description: "그리드, 분할 패널, 플렉스 등 다양한 레이아웃 구조를 지원하는 통합 컴포넌트",
|
||
|
|
category: ComponentCategory.UNIFIED,
|
||
|
|
webType: "container" as WebType,
|
||
|
|
component: UnifiedLayout as any,
|
||
|
|
tags: ["layout", "grid", "split", "flex", "container", "unified"],
|
||
|
|
defaultSize: { width: 400, height: 300 },
|
||
|
|
configPanel: UnifiedLayoutConfigPanel as any,
|
||
|
|
defaultConfig: {
|
||
|
|
layoutType: "grid",
|
||
|
|
columns: 2,
|
||
|
|
gap: "16",
|
||
|
|
use12Column: true,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: "unified-group",
|
||
|
|
name: "통합 그룹",
|
||
|
|
description: "탭, 아코디언, 섹션, 모달 등 그룹 요소를 지원하는 통합 컴포넌트",
|
||
|
|
category: ComponentCategory.UNIFIED,
|
||
|
|
webType: "group" as WebType,
|
||
|
|
component: UnifiedGroup as any,
|
||
|
|
tags: ["group", "tabs", "accordion", "section", "modal", "unified"],
|
||
|
|
defaultSize: { width: 400, height: 300 },
|
||
|
|
configPanel: UnifiedGroupConfigPanel as any,
|
||
|
|
defaultConfig: {
|
||
|
|
groupType: "section",
|
||
|
|
title: "",
|
||
|
|
collapsible: false,
|
||
|
|
defaultOpen: true,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: "unified-media",
|
||
|
|
name: "통합 미디어",
|
||
|
|
description: "이미지, 비디오, 오디오, 파일 업로드 등을 지원하는 통합 컴포넌트",
|
||
|
|
category: ComponentCategory.UNIFIED,
|
||
|
|
webType: "file" as WebType,
|
||
|
|
component: UnifiedMedia as any,
|
||
|
|
tags: ["media", "image", "video", "audio", "file", "upload", "unified"],
|
||
|
|
defaultSize: { width: 300, height: 200 },
|
||
|
|
configPanel: UnifiedMediaConfigPanel as any,
|
||
|
|
defaultConfig: {
|
||
|
|
mediaType: "image",
|
||
|
|
multiple: false,
|
||
|
|
preview: true,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: "unified-biz",
|
||
|
|
name: "통합 비즈니스",
|
||
|
|
description: "플로우, 랙, 채번규칙 등 비즈니스 기능을 지원하는 통합 컴포넌트",
|
||
|
|
category: ComponentCategory.UNIFIED,
|
||
|
|
webType: "custom" as WebType,
|
||
|
|
component: UnifiedBiz as any,
|
||
|
|
tags: ["business", "flow", "rack", "numbering", "category", "unified"],
|
||
|
|
defaultSize: { width: 500, height: 400 },
|
||
|
|
configPanel: UnifiedBizConfigPanel as any,
|
||
|
|
defaultConfig: {
|
||
|
|
bizType: "flow",
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: "unified-hierarchy",
|
||
|
|
name: "통합 계층",
|
||
|
|
description: "트리, 조직도, BOM, 연쇄 선택박스 등 계층 구조를 지원하는 통합 컴포넌트",
|
||
|
|
category: ComponentCategory.UNIFIED,
|
||
|
|
webType: "tree" as WebType,
|
||
|
|
component: UnifiedHierarchy as any,
|
||
|
|
tags: ["hierarchy", "tree", "org-chart", "bom", "cascading", "unified"],
|
||
|
|
defaultSize: { width: 400, height: 400 },
|
||
|
|
configPanel: UnifiedHierarchyConfigPanel as any,
|
||
|
|
defaultConfig: {
|
||
|
|
hierarchyType: "tree",
|
||
|
|
viewMode: "tree",
|
||
|
|
dataSource: "static",
|
||
|
|
},
|
||
|
|
},
|
||
|
|
];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Unified 컴포넌트들을 ComponentRegistry에 등록
|
||
|
|
*/
|
||
|
|
export function registerUnifiedComponents(): void {
|
||
|
|
for (const definition of unifiedComponentDefinitions) {
|
||
|
|
try {
|
||
|
|
// 이미 등록되어 있으면 스킵
|
||
|
|
if (ComponentRegistry.getComponent(definition.id)) {
|
||
|
|
continue;
|
||
|
|
}
|
||
|
|
ComponentRegistry.registerComponent(definition);
|
||
|
|
console.log(`✅ Unified 컴포넌트 등록: ${definition.id}`);
|
||
|
|
} catch (error) {
|
||
|
|
console.error(`❌ Unified 컴포넌트 등록 실패: ${definition.id}`, error);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export default registerUnifiedComponents;
|