"use client"; import { PopComponentRegistry } from "../../PopComponentRegistry"; import { PopStatusBarComponent } from "./PopStatusBarComponent"; import { PopStatusBarConfigPanel } from "./PopStatusBarConfig"; import type { StatusBarConfig } from "./types"; import { DEFAULT_STATUS_BAR_CONFIG } from "./types"; function PopStatusBarPreviewComponent({ config, label, }: { config?: StatusBarConfig; label?: string; }) { const cfg = config || DEFAULT_STATUS_BAR_CONFIG; const options = cfg.options || []; const displayLabel = label || "상태 바"; return (
{displayLabel}
{options.length === 0 ? ( 옵션 없음 ) : ( options.slice(0, 4).map((opt) => (
0 {opt.label}
)) )}
); } PopComponentRegistry.registerComponent({ id: "pop-status-bar", name: "상태 바", description: "상태별 건수 대시보드 + 필터", category: "display", icon: "BarChart3", component: PopStatusBarComponent, configPanel: PopStatusBarConfigPanel, preview: PopStatusBarPreviewComponent, defaultProps: DEFAULT_STATUS_BAR_CONFIG, connectionMeta: { sendable: [ { key: "filter_value", label: "필터 값", type: "filter_value", category: "filter", description: "선택한 상태 칩 값을 카드에 필터로 전달", }, ], receivable: [ { key: "all_rows", label: "전체 데이터", type: "all_rows", category: "data", description: "연결된 카드의 전체 데이터를 받아 상태별 건수 집계", }, { key: "set_value", label: "값 설정", type: "filter_value", category: "filter", description: "외부에서 선택 값 설정", }, ], }, touchOptimized: true, supportedDevices: ["mobile", "tablet"], });