ERP-node/frontend/lib/registry/pop-components/pop-card-list/index.tsx

66 lines
1.7 KiB
TypeScript

"use client";
/**
* pop-card-list 컴포넌트 레지스트리 등록 진입점 (V2)
*
* 이 파일을 import하면 side-effect로 PopComponentRegistry에 자동 등록됨
*/
import { PopComponentRegistry } from "../../PopComponentRegistry";
import { PopCardListComponent } from "./PopCardListComponent";
import { PopCardListConfigPanel } from "./PopCardListConfig";
import { PopCardListPreviewComponent } from "./PopCardListPreview";
import type { PopCardListConfig } from "../types";
import { DEFAULT_CARD_IMAGE } from "../types";
const defaultConfig: PopCardListConfig = {
// 데이터 소스 (테이블 단위)
dataSource: {
tableName: "",
},
// 카드 템플릿
cardTemplate: {
header: {
codeField: undefined,
titleField: undefined,
},
image: {
enabled: true,
imageColumn: undefined,
defaultImage: DEFAULT_CARD_IMAGE,
},
body: {
fields: [],
},
},
// 스크롤 방향
scrollDirection: "vertical",
cardSize: "medium",
// 그리드 배치 (가로 x 세로)
gridColumns: 3,
gridRows: 2,
// 담기 버튼 기본 설정
cartAction: {
navigateMode: "none",
iconType: "lucide",
iconValue: "ShoppingCart",
label: "담기",
cancelLabel: "취소",
},
};
// 레지스트리 등록
PopComponentRegistry.registerComponent({
id: "pop-card-list",
name: "카드 목록",
description: "테이블 데이터를 카드 형태로 표시 (헤더 + 이미지 + 필드 목록)",
category: "display",
icon: "LayoutGrid",
component: PopCardListComponent,
configPanel: PopCardListConfigPanel,
preview: PopCardListPreviewComponent,
defaultProps: defaultConfig,
touchOptimized: true,
supportedDevices: ["mobile", "tablet"],
});