ERP-node/frontend/lib/registry/components/repeat-screen-modal/index.ts

141 lines
4.2 KiB
TypeScript
Raw Normal View History

"use client";
import { createComponentDefinition } from "../../utils/createComponentDefinition";
import { ComponentCategory } from "@/types/component";
import { RepeatScreenModalComponent } from "./RepeatScreenModalComponent";
import { RepeatScreenModalConfigPanel } from "./RepeatScreenModalConfigPanel";
import type {
RepeatScreenModalProps,
CardRowConfig,
CardColumnConfig,
ColumnSourceConfig,
ColumnTargetConfig,
DataSourceConfig,
CardData,
GroupingConfig,
AggregationConfig,
TableLayoutConfig,
TableColumnConfig,
GroupedCardData,
CardRowData,
} from "./types";
/**
* RepeatScreenModal v2
* - ,
*
* :
* - 🆕 모드: 단순(simple) / (withTable)
* - 🆕 그룹핑: 특정
* - 🆕 집계: 그룹 //
* - 🆕 테이블: 그룹
* - 레이아웃: /
* - 설정: 직접 / /
* - 설정: 어느
* - 저장: 하나의
*
* :
* - ( + )
* - ( + )
* - ( + )
* - ( + )
*/
export const RepeatScreenModalDefinition = createComponentDefinition({
id: "repeat-screen-modal",
name: "반복 화면 모달",
nameEng: "Repeat Screen Modal",
description:
"선택한 행을 그룹핑하여 카드로 표시하고, 각 카드는 헤더+테이블 구조로 편집 가능한 폼 (출하계획, 구매발주 등)",
category: ComponentCategory.DATA,
webType: "form",
component: RepeatScreenModalComponent,
defaultConfig: {
// 기본 설정
cardTitle: "{part_code} - {part_name}",
cardSpacing: "24px",
showCardBorder: true,
saveMode: "all",
// 카드 모드 (simple: 1행=1카드, withTable: 그룹핑+테이블)
cardMode: "simple",
// 데이터 소스
dataSource: {
sourceTable: "",
filterField: "selectedIds",
},
// 그룹핑 설정 (withTable 모드에서 사용)
grouping: {
enabled: false,
groupByField: "",
aggregations: [],
},
// Simple 모드 레이아웃
cardLayout: [
{
id: "row-1",
columns: [
{
id: "col-1",
field: "name",
label: "이름",
type: "text",
width: "50%",
editable: true,
required: true,
},
{
id: "col-2",
field: "status",
label: "상태",
type: "select",
width: "50%",
editable: true,
required: false,
selectOptions: [
{ value: "active", label: "활성" },
{ value: "inactive", label: "비활성" },
],
},
],
gap: "16px",
layout: "horizontal",
},
],
// WithTable 모드 레이아웃
tableLayout: {
headerRows: [],
tableColumns: [],
},
} as Partial<RepeatScreenModalProps>,
defaultSize: { width: 1000, height: 800 },
configPanel: RepeatScreenModalConfigPanel,
icon: "LayoutGrid",
tags: ["모달", "폼", "반복", "카드", "그룹핑", "집계", "테이블", "편집", "데이터", "출하계획", "일괄등록"],
version: "2.0.0",
author: "개발팀",
});
// 타입 재 export
export type {
RepeatScreenModalProps,
CardRowConfig,
CardColumnConfig,
ColumnSourceConfig,
ColumnTargetConfig,
DataSourceConfig,
CardData,
GroupingConfig,
AggregationConfig,
TableLayoutConfig,
TableColumnConfig,
GroupedCardData,
CardRowData,
};
// 컴포넌트 재 export
export { RepeatScreenModalComponent, RepeatScreenModalConfigPanel };