"use client"; /** * V2Biz * * 통합 비즈니스 컴포넌트 * - flow: 플로우/워크플로우 * - rack: 랙 구조 * - map: 맵/위치 * - numbering: 채번 규칙 * - category: 카테고리 관리 * - mapping: 데이터 매핑 * - related-buttons: 관련 데이터 버튼 */ import React, { forwardRef } from "react"; import { Label } from "@/components/ui/label"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { cn } from "@/lib/utils"; import { V2BizProps } from "@/types/v2-components"; import { GitBranch, LayoutGrid, MapPin, Hash, FolderTree, Link2, FileText, ArrowRight } from "lucide-react"; /** * 플로우 컴포넌트 (플레이스홀더) * 실제 구현은 기존 FlowWidget과 연동 */ const FlowBiz = forwardRef; className?: string; }>(({ config, className }, ref) => { return ( 플로우

플로우 디자이너

기존 FlowWidget과 연동

); }); FlowBiz.displayName = "FlowBiz"; /** * 랙 구조 컴포넌트 (플레이스홀더) * 실제 구현은 기존 RackStructure와 연동 */ const RackBiz = forwardRef; className?: string; }>(({ config, className }, ref) => { return ( 랙 구조

랙 구조 뷰어

기존 RackStructure와 연동

); }); RackBiz.displayName = "RackBiz"; /** * 맵 컴포넌트 (플레이스홀더) */ const MapBiz = forwardRef; className?: string; }>(({ config, className }, ref) => { return ( 위치 맵

위치 맵 뷰어

지도 라이브러리 연동 예정

); }); MapBiz.displayName = "MapBiz"; /** * 채번 규칙 컴포넌트 (플레이스홀더) * 실제 구현은 기존 NumberingRuleComponent와 연동 */ const NumberingBiz = forwardRef; className?: string; }>(({ config, className }, ref) => { return ( 채번 규칙

자동 채번

규칙에 따라 자동 생성

PO-2024-0001

기존 NumberingRuleComponent와 연동

); }); NumberingBiz.displayName = "NumberingBiz"; /** * 카테고리 관리 컴포넌트 (플레이스홀더) * 실제 구현은 기존 CategoryManager와 연동 */ const CategoryBiz = forwardRef; className?: string; }>(({ config, className }, ref) => { return ( 카테고리
대분류
└ 중분류
└ 소분류

기존 CategoryManager와 연동

); }); CategoryBiz.displayName = "CategoryBiz"; /** * 데이터 매핑 컴포넌트 (플레이스홀더) */ const MappingBiz = forwardRef; className?: string; }>(({ config, className }, ref) => { return ( 데이터 매핑

소스

대상

); }); MappingBiz.displayName = "MappingBiz"; /** * 관련 데이터 버튼 컴포넌트 (플레이스홀더) */ const RelatedButtonsBiz = forwardRef; className?: string; }>(({ config, className }, ref) => { const buttons = (config?.buttons as Array<{ label: string; icon?: string }>) || [ { label: "관련 주문" }, { label: "관련 출고" }, { label: "이력 보기" }, ]; return (
{buttons.map((button, index) => ( ))}
); }); RelatedButtonsBiz.displayName = "RelatedButtonsBiz"; /** * 메인 V2Biz 컴포넌트 */ export const V2Biz = forwardRef( (props, ref) => { const { id, label, style, size, config: configProp, } = props; // config가 없으면 기본값 사용 const config = configProp || { type: "flow" as const }; // 타입별 비즈니스 컴포넌트 렌더링 const renderBiz = () => { const bizConfig = config.config || {}; const bizType = config.type || "flow"; switch (bizType) { case "flow": return ; case "rack": return ; case "map": return ; case "numbering": return ; case "category": return ; case "mapping": return ; case "related-buttons": return ; default: return (
알 수 없는 비즈니스 타입: {config.type}
); } }; const showLabel = label && style?.labelDisplay !== false; const componentWidth = size?.width || style?.width; const componentHeight = size?.height || style?.height; // 라벨 높이 계산 (기본 20px, 사용자 설정에 따라 조정) const labelFontSize = style?.labelFontSize ? parseInt(String(style.labelFontSize)) : 14; const labelMarginBottom = style?.labelMarginBottom ? parseInt(String(style.labelMarginBottom)) : 4; const estimatedLabelHeight = labelFontSize + labelMarginBottom + 2; return (
{/* 🔧 라벨을 absolute로 컴포넌트 위에 배치 */} {showLabel && ( )}
{renderBiz()}
); } ); V2Biz.displayName = "V2Biz"; export default V2Biz;