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

72 lines
2.5 KiB
TypeScript

"use client";
import { createComponentDefinition } from "../../utils/createComponentDefinition";
import { ComponentCategory } from "@/types/component";
import { SimpleRepeaterTableComponent } from "./SimpleRepeaterTableComponent";
import { SimpleRepeaterTableConfigPanel } from "./SimpleRepeaterTableConfigPanel";
/**
* 🆕 SimpleRepeaterTable 컴포넌트 정의
* 단순 반복 테이블 - 검색/추가 없이 데이터 표시 및 편집만
*
* 주요 기능:
* - 초기 데이터 로드: 어떤 테이블에서 어떤 조건으로 데이터를 가져올지 설정
* - 컬럼별 소스 설정: 각 컬럼의 데이터를 어디서 조회할지 설정 (직접 조회/조인 조회/수동 입력)
* - 컬럼별 타겟 설정: 각 컬럼의 데이터를 어느 테이블의 어느 컬럼에 저장할지 설정
* - 자동 계산: 수량 * 단가 = 금액 같은 자동 계산 지원
* - 읽기 전용 모드: 전체 테이블을 보기 전용으로 설정
*/
export const SimpleRepeaterTableDefinition = createComponentDefinition({
id: "simple-repeater-table",
name: "단순 반복 테이블",
nameEng: "Simple Repeater Table",
description: "어떤 테이블에서 조회하고 어떤 테이블에 저장할지 컬럼별로 설정 가능한 반복 테이블 (검색/추가 없음, 자동 계산 지원)",
category: ComponentCategory.DATA,
webType: "table",
component: SimpleRepeaterTableComponent,
defaultConfig: {
columns: [],
calculationRules: [],
initialDataConfig: undefined,
readOnly: false,
showRowNumber: true,
allowDelete: true,
allowAdd: false,
addButtonText: "행 추가",
addButtonPosition: "bottom",
minRows: 0,
maxRows: undefined,
summaryConfig: {
enabled: false,
fields: [],
},
maxHeight: "240px",
},
defaultSize: { width: 800, height: 400 },
configPanel: SimpleRepeaterTableConfigPanel,
icon: "Table",
tags: ["테이블", "반복", "편집", "데이터", "목록", "계산", "조회", "저장"],
version: "2.0.0",
author: "개발팀",
});
// 타입 내보내기
export type {
SimpleRepeaterTableProps,
SimpleRepeaterColumnConfig,
CalculationRule,
ColumnSourceConfig,
ColumnTargetConfig,
InitialDataConfig,
DataFilterCondition,
SourceJoinCondition,
SummaryConfig,
SummaryFieldConfig,
} from "./types";
// 컴포넌트 내보내기
export { SimpleRepeaterTableComponent } from "./SimpleRepeaterTableComponent";
export { SimpleRepeaterTableConfigPanel } from "./SimpleRepeaterTableConfigPanel";
export { useCalculation } from "./useCalculation";