ERP-node/frontend/lib/registry/components/v2-repeater/index.ts

102 lines
2.7 KiB
TypeScript

/**
* V2Repeater 컴포넌트 정의
*
* 반복 데이터 관리를 위한 통합 컴포넌트
* 기존 simple-repeater-table, modal-repeater-table, repeat-screen-modal, related-data-buttons 통합
*/
import { ComponentCategory } from "@/types/component";
import { createComponentDefinition } from "../../utils/createComponentDefinition";
import { V2RepeaterConfigPanel } from "@/components/v2/config-panels/V2RepeaterConfigPanel";
import { V2Repeater } from "@/components/v2/V2Repeater";
export const V2RepeaterDefinition = createComponentDefinition({
id: "v2-repeater",
name: "통합 반복 데이터",
description: "반복 데이터 관리 (인라인/모달/버튼 모드)",
category: ComponentCategory.V2,
webType: "entity", // 반복 데이터는 엔티티 참조 타입
version: "1.0.0",
component: V2Repeater, // React 컴포넌트 (필수)
// 기본 속성
defaultProps: {
config: {
renderMode: "inline",
dataSource: {
tableName: "",
foreignKey: "",
referenceKey: "",
},
columns: [],
modal: {
size: "md",
},
button: {
sourceType: "manual",
manualButtons: [],
layout: "horizontal",
style: "outline",
},
features: {
showAddButton: true,
showDeleteButton: true,
inlineEdit: false,
dragSort: false,
showRowNumber: false,
selectable: false,
multiSelect: false,
},
},
},
// 설정 스키마
configSchema: {
renderMode: {
type: "select",
label: "렌더링 모드",
options: [
{ value: "inline", label: "인라인 (테이블)" },
{ value: "modal", label: "모달" },
{ value: "button", label: "버튼" },
{ value: "mixed", label: "혼합 (테이블 + 버튼)" },
],
},
"dataSource.tableName": {
type: "tableSelect",
label: "데이터 테이블",
description: "반복 데이터가 저장된 테이블",
},
"dataSource.foreignKey": {
type: "columnSelect",
label: "연결 키 (FK)",
description: "부모 레코드를 참조하는 컬럼",
dependsOn: "dataSource.tableName",
},
"dataSource.referenceKey": {
type: "columnSelect",
label: "상위 키",
description: "현재 화면 테이블의 PK 컬럼",
useCurrentTable: true,
},
},
// 이벤트
events: ["onDataChange", "onRowClick", "onButtonClick"],
// 아이콘
icon: "Repeat",
// 태그
tags: ["data", "repeater", "table", "modal", "button", "v2"],
// 설정 패널
configPanel: V2RepeaterConfigPanel,
// v2-repeater 사용으로 패널에서 숨김
hidden: true,
});
export default V2RepeaterDefinition;