Files
invyone/frontend/components/v2/registerV2Components.ts
T
DDD1542 5f945363b2 refactor: V2Date 일괄 폐기 + InvField type=date 통일
V2DateConfigPanel(262줄) + V2Date 본체(1046줄) + V2DateConfig 타입
+ lib/registry/components/v2-date/ + DynamicComponentRenderer 의
LEGACY alias 모두 삭제. 솔루션 정의 단계 정확한 1안.

데이터 모델
- FieldType / InputFieldType union 에 time, daterange 2종 추가하여 12종 확장
- canonical 키: dateFormat / minDate / maxDate / showToday / weekStart /
  dateDefault / rangePresets / maxRangeDays
- 옛 v2-date 의 snake_case (min_date / max_date / show_today) 와 dateType /
  type / range / format 키 충돌 종결

런타임 (InputComponent + pickers.tsx)
- V2Date 본체에 있던 SingleDatePicker / DateTimePicker / TimePicker /
  RangeDatePicker 4 picker 를 input/pickers.tsx 로 통합
- InputComponent 의 case "date"/"datetime" 의 native input 분기를 datepicker
  로 교체하고 case "time"/"daterange" 신규 추가
- type 결정 로직에 inputType prop 인식 (DB input_type 매핑) → date/time
  입력이 text 로 fallback 되던 silent breakage 해결

FC 계층
- FieldRenderer / CellRenderer / FcSearch 에 time / daterange 분기 추가
- TimeField, DateRangeField 신규 컴포넌트
- adapters.normalizeType allowed 배열 확장

ConfigPanel
- InvFieldConfigPanel.DateOptions 에 showToday CPRow + CPSwitch 신규
- 옛 호환 코드 (showSeconds:ss 보정 / dateType-format 격상 등) 모두 제거
- InvInputConfigPanel.TYPE_OPTIONS / 날짜 옵션 분기에 time/daterange 추가

dead code 삭제 14곳 + 잔존 정리
- V2Date / V2DateConfigPanel / V2DateConfig / lib/registry/v2-date/ 폴더
- LEGACY_TO_UNIFIED / CONFIG_PANEL_MAP / CONFIG_PANEL_ALIAS / register /
  V2PropertiesPanel hardcoded require / config-panels barrel / hidden 목록
- componentConfig 스키마, templateMigrate, webTypeMapping, DynamicConfigPanel
- withContainerQuery.css 의 v2-date 컨테이너 룰
- db/migrations/so_modal_layout(_kr).json 의 v2-date → input + type=date

37 files, +287 / -854.

Codex GO 판정 기준 (2회 NO-GO 후 FC 계층 / inputType prop / FieldType union /
잔존 v2-date / console.log 모두 처리 후 GO).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 13:22:55 +09:00

213 lines
7.0 KiB
TypeScript

"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 { 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 { 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 { InvRepeaterConfigPanel } from "./config-panels/InvRepeaterConfigPanel";
import { InvDataConfigPanel } from "./config-panels/InvDataConfigPanel";
// V2 컴포넌트 정의
const v2ComponentDefinitions: ComponentDefinition[] = [
{
id: "v2-input",
name: "통합 입력",
description: "텍스트, 숫자, 비밀번호, 슬라이더, 컬러 등 다양한 입력 타입을 지원하는 통합 컴포넌트",
category: ComponentCategory.V2,
web_type: "text" as WebType,
component: V2Input as any,
tags: ["input", "text", "number", "password", "slider", "color", "v2"],
default_size: { width: 200, height: 40 },
config_panel: V2InputConfigPanel as any,
default_config: {
inputType: "text",
format: "none",
placeholder: "",
},
},
{
id: "v2-select",
name: "통합 선택",
description: "드롭다운, 라디오, 체크박스, 태그, 토글 등 다양한 선택 방식을 지원하는 통합 컴포넌트",
category: ComponentCategory.V2,
web_type: "select" as WebType,
component: V2Select as any,
tags: ["select", "dropdown", "radio", "checkbox", "toggle", "v2"],
default_size: { width: 200, height: 40 },
config_panel: V2SelectConfigPanel as any,
default_config: {
mode: "dropdown",
source: "static",
options: [],
},
},
{
id: "v2-list",
name: "통합 목록",
description: "테이블, 카드, 칸반, 리스트 등 다양한 데이터 표시 방식을 지원하는 통합 컴포넌트",
category: ComponentCategory.V2,
web_type: "list" as WebType,
component: V2List as any,
tags: ["list", "table", "card", "kanban", "data", "v2"],
default_size: { width: 600, height: 400 },
config_panel: InvDataConfigPanel as any,
default_config: {
viewMode: "table",
source: "static",
columns: [],
pagination: true,
sortable: true,
},
},
{
id: "v2-layout",
name: "통합 레이아웃",
description: "그리드, 분할 패널, 플렉스 등 다양한 레이아웃 구조를 지원하는 통합 컴포넌트",
category: ComponentCategory.V2,
web_type: "container" as WebType,
component: V2Layout as any,
tags: ["layout", "grid", "split", "flex", "container", "v2"],
default_size: { width: 400, height: 300 },
config_panel: V2LayoutConfigPanel as any,
default_config: {
layoutType: "grid",
columns: 2,
gap: "16",
use12Column: true,
},
},
{
id: "v2-group",
name: "통합 그룹",
description: "탭, 아코디언, 섹션, 모달 등 그룹 요소를 지원하는 통합 컴포넌트",
category: ComponentCategory.V2,
web_type: "group" as WebType,
component: V2Group as any,
tags: ["group", "tabs", "accordion", "section", "modal", "v2"],
default_size: { width: 400, height: 300 },
config_panel: V2GroupConfigPanel as any,
default_config: {
groupType: "section",
title: "",
collapsible: false,
defaultOpen: true,
},
},
{
id: "v2-media",
name: "통합 미디어",
description: "이미지, 비디오, 오디오, 파일 업로드 등을 지원하는 통합 컴포넌트",
category: ComponentCategory.V2,
web_type: "file" as WebType,
component: V2Media as any,
tags: ["media", "image", "video", "audio", "file", "upload", "v2"],
default_size: { width: 300, height: 200 },
config_panel: V2MediaConfigPanel as any,
default_config: {
mediaType: "image",
multiple: false,
preview: true,
},
},
{
id: "v2-biz",
name: "통합 비즈니스",
description: "플로우, 랙, 채번규칙 등 비즈니스 기능을 지원하는 통합 컴포넌트",
category: ComponentCategory.V2,
web_type: "custom" as WebType,
component: V2Biz as any,
tags: ["business", "flow", "rack", "numbering", "category", "v2"],
default_size: { width: 500, height: 400 },
config_panel: V2BizConfigPanel as any,
default_config: {
bizType: "flow",
},
},
{
id: "v2-hierarchy",
name: "통합 계층",
description: "트리, 조직도, BOM, 연쇄 선택박스 등 계층 구조를 지원하는 통합 컴포넌트",
category: ComponentCategory.V2,
web_type: "tree" as WebType,
component: V2Hierarchy as any,
tags: ["hierarchy", "tree", "org-chart", "bom", "cascading", "v2"],
default_size: { width: 400, height: 400 },
config_panel: V2HierarchyConfigPanel as any,
default_config: {
hierarchyType: "tree",
viewMode: "tree",
dataSource: "static",
},
},
{
id: "v2-repeater",
name: "통합 반복",
description: "인라인 테이블, 모달, 버튼 등 다양한 반복 데이터 관리를 지원하는 통합 컴포넌트",
category: ComponentCategory.V2,
web_type: "entity" as WebType,
component: V2Repeater as any,
tags: ["repeater", "table", "modal", "button", "data", "v2"],
default_size: { width: 600, height: 300 },
config_panel: InvDataConfigPanel as any,
default_config: {
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;