"use client"; /** * V2 컴포넌트 레지스트리 등록 * * 9개의 V2 컴포넌트를 ComponentRegistry에 등록합니다. */ import { ComponentRegistry } from "@/lib/registry/ComponentRegistry"; import { ComponentDefinition, ComponentCategory } from "@/types/component"; import { WebType } from "@/types/screen"; // 실제 컴포넌트 import import { V2Input } from "./V2Input"; import { V2Select } from "./V2Select"; import { V2Date } from "./V2Date"; import { V2List } from "./V2List"; import { V2Layout } from "./V2Layout"; import { V2Group } from "./V2Group"; import { V2Media } from "./V2Media"; import { V2Biz } from "./V2Biz"; import { V2Hierarchy } from "./V2Hierarchy"; import { V2Repeater } from "./V2Repeater"; // 설정 패널 import import { V2InputConfigPanel } from "./config-panels/V2InputConfigPanel"; import { V2SelectConfigPanel } from "./config-panels/V2SelectConfigPanel"; import { V2DateConfigPanel } from "./config-panels/V2DateConfigPanel"; import { V2ListConfigPanel } from "./config-panels/V2ListConfigPanel"; import { V2LayoutConfigPanel } from "./config-panels/V2LayoutConfigPanel"; import { V2GroupConfigPanel } from "./config-panels/V2GroupConfigPanel"; import { V2MediaConfigPanel } from "./config-panels/V2MediaConfigPanel"; import { V2BizConfigPanel } from "./config-panels/V2BizConfigPanel"; import { V2HierarchyConfigPanel } from "./config-panels/V2HierarchyConfigPanel"; import { V2RepeaterConfigPanel } from "./config-panels/V2RepeaterConfigPanel"; // V2 컴포넌트 정의 const v2ComponentDefinitions: ComponentDefinition[] = [ { id: "v2-input", name: "통합 입력", description: "텍스트, 숫자, 비밀번호, 슬라이더, 컬러 등 다양한 입력 타입을 지원하는 통합 컴포넌트", category: ComponentCategory.V2, webType: "text" as WebType, component: V2Input as any, tags: ["input", "text", "number", "password", "slider", "color", "v2"], defaultSize: { width: 200, height: 40 }, configPanel: V2InputConfigPanel as any, defaultConfig: { inputType: "text", format: "none", placeholder: "", }, }, { id: "v2-select", name: "통합 선택", description: "드롭다운, 라디오, 체크박스, 태그, 토글 등 다양한 선택 방식을 지원하는 통합 컴포넌트", category: ComponentCategory.V2, webType: "select" as WebType, component: V2Select as any, tags: ["select", "dropdown", "radio", "checkbox", "toggle", "v2"], defaultSize: { width: 200, height: 40 }, configPanel: V2SelectConfigPanel as any, defaultConfig: { mode: "dropdown", source: "static", options: [], }, }, { id: "v2-date", name: "통합 날짜", description: "날짜, 시간, 날짜시간, 날짜 범위 등을 지원하는 통합 컴포넌트", category: ComponentCategory.V2, webType: "date" as WebType, component: V2Date as any, tags: ["date", "time", "datetime", "datepicker", "v2"], defaultSize: { width: 200, height: 40 }, configPanel: V2DateConfigPanel as any, defaultConfig: { dateType: "date", format: "YYYY-MM-DD", }, }, { id: "v2-list", name: "통합 목록", description: "테이블, 카드, 칸반, 리스트 등 다양한 데이터 표시 방식을 지원하는 통합 컴포넌트", category: ComponentCategory.V2, webType: "list" as WebType, component: V2List as any, tags: ["list", "table", "card", "kanban", "data", "v2"], defaultSize: { width: 600, height: 400 }, configPanel: V2ListConfigPanel as any, defaultConfig: { viewMode: "table", source: "static", columns: [], pagination: true, sortable: true, }, }, { id: "v2-layout", name: "통합 레이아웃", description: "그리드, 분할 패널, 플렉스 등 다양한 레이아웃 구조를 지원하는 통합 컴포넌트", category: ComponentCategory.V2, webType: "container" as WebType, component: V2Layout as any, tags: ["layout", "grid", "split", "flex", "container", "v2"], defaultSize: { width: 400, height: 300 }, configPanel: V2LayoutConfigPanel as any, defaultConfig: { layoutType: "grid", columns: 2, gap: "16", use12Column: true, }, }, { id: "v2-group", name: "통합 그룹", description: "탭, 아코디언, 섹션, 모달 등 그룹 요소를 지원하는 통합 컴포넌트", category: ComponentCategory.V2, webType: "group" as WebType, component: V2Group as any, tags: ["group", "tabs", "accordion", "section", "modal", "v2"], defaultSize: { width: 400, height: 300 }, configPanel: V2GroupConfigPanel as any, defaultConfig: { groupType: "section", title: "", collapsible: false, defaultOpen: true, }, }, { id: "v2-media", name: "통합 미디어", description: "이미지, 비디오, 오디오, 파일 업로드 등을 지원하는 통합 컴포넌트", category: ComponentCategory.V2, webType: "file" as WebType, component: V2Media as any, tags: ["media", "image", "video", "audio", "file", "upload", "v2"], defaultSize: { width: 300, height: 200 }, configPanel: V2MediaConfigPanel as any, defaultConfig: { mediaType: "image", multiple: false, preview: true, }, }, { id: "v2-biz", name: "통합 비즈니스", description: "플로우, 랙, 채번규칙 등 비즈니스 기능을 지원하는 통합 컴포넌트", category: ComponentCategory.V2, webType: "custom" as WebType, component: V2Biz as any, tags: ["business", "flow", "rack", "numbering", "category", "v2"], defaultSize: { width: 500, height: 400 }, configPanel: V2BizConfigPanel as any, defaultConfig: { bizType: "flow", }, }, { id: "v2-hierarchy", name: "통합 계층", description: "트리, 조직도, BOM, 연쇄 선택박스 등 계층 구조를 지원하는 통합 컴포넌트", category: ComponentCategory.V2, webType: "tree" as WebType, component: V2Hierarchy as any, tags: ["hierarchy", "tree", "org-chart", "bom", "cascading", "v2"], defaultSize: { width: 400, height: 400 }, configPanel: V2HierarchyConfigPanel as any, defaultConfig: { hierarchyType: "tree", viewMode: "tree", dataSource: "static", }, }, { id: "v2-repeater", name: "통합 반복", description: "인라인 테이블, 모달, 버튼 등 다양한 반복 데이터 관리를 지원하는 통합 컴포넌트", category: ComponentCategory.V2, webType: "entity" as WebType, component: V2Repeater as any, tags: ["repeater", "table", "modal", "button", "data", "v2"], defaultSize: { width: 600, height: 300 }, configPanel: V2RepeaterConfigPanel as any, defaultConfig: { renderMode: "inline", dataSource: { tableName: "", foreignKey: "", referenceKey: "", }, columns: [], features: { showAddButton: true, showDeleteButton: true, inlineEdit: false, }, }, }, ]; /** * V2 컴포넌트들을 ComponentRegistry에 등록 */ export function registerV2Components(): void { for (const definition of v2ComponentDefinitions) { try { // 이미 등록되어 있으면 스킵 if (ComponentRegistry.getComponent(definition.id)) { continue; } ComponentRegistry.registerComponent(definition); } catch (error) { console.error(`❌ V2 컴포넌트 등록 실패: ${definition.id}`, error); } } } export default registerV2Components;