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

99 lines
2.7 KiB
TypeScript

/**
* UnifiedRepeater 컴포넌트 정의
*
* 반복 데이터 관리를 위한 통합 컴포넌트
* 기존 simple-repeater-table, modal-repeater-table, repeat-screen-modal, related-data-buttons 통합
*/
import { ComponentCategory } from "@/types/component";
import { createComponentDefinition } from "../../utils/createComponentDefinition";
import { UnifiedRepeaterConfigPanel } from "@/components/unified/config-panels/UnifiedRepeaterConfigPanel";
import { UnifiedRepeater } from "@/components/unified/UnifiedRepeater";
export const UnifiedRepeaterDefinition = createComponentDefinition({
id: "unified-repeater",
name: "통합 반복 데이터",
description: "반복 데이터 관리 (인라인/모달/버튼 모드)",
category: ComponentCategory.UNIFIED,
webType: "entity", // 반복 데이터는 엔티티 참조 타입
version: "1.0.0",
component: UnifiedRepeater, // 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", "unified"],
// 설정 패널
configPanel: UnifiedRepeaterConfigPanel,
});
export default UnifiedRepeaterDefinition;