"use client"; /** * UnifiedBiz 설정 패널 * 통합 비즈니스 컴포넌트의 세부 설정을 관리합니다. */ import React from "react"; import { Label } from "@/components/ui/label"; import { Input } from "@/components/ui/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Separator } from "@/components/ui/separator"; import { Checkbox } from "@/components/ui/checkbox"; interface UnifiedBizConfigPanelProps { config: Record; onChange: (config: Record) => void; } export const UnifiedBizConfigPanel: React.FC = ({ config, onChange, }) => { // 설정 업데이트 핸들러 const updateConfig = (field: string, value: any) => { onChange({ ...config, [field]: value }); }; return (
{/* 비즈니스 타입 */}
{/* 플로우 설정 */} {config.bizType === "flow" && (
updateConfig("flowId", e.target.value ? Number(e.target.value) : undefined)} placeholder="플로우 ID" className="h-8 text-xs" />
updateConfig("editable", checked)} />
updateConfig("showMinimap", checked)} />
)} {/* 랙 구조 설정 */} {config.bizType === "rack" && (
updateConfig("rows", e.target.value ? Number(e.target.value) : undefined)} placeholder="5" min="1" className="h-8 text-xs" />
updateConfig("columns", e.target.value ? Number(e.target.value) : undefined)} placeholder="10" min="1" className="h-8 text-xs" />
updateConfig("showLabels", checked)} />
)} {/* 채번 규칙 설정 */} {config.bizType === "numbering" && (
updateConfig("ruleId", e.target.value ? Number(e.target.value) : undefined)} placeholder="규칙 ID" className="h-8 text-xs" />
updateConfig("prefix", e.target.value)} placeholder="예: INV-" className="h-8 text-xs" />
updateConfig("autoGenerate", checked)} />
)} {/* 카테고리 설정 */} {config.bizType === "category" && (
updateConfig("tableName", e.target.value)} placeholder="카테고리 테이블명" className="h-8 text-xs" />
updateConfig("columnName", e.target.value)} placeholder="컬럼명" className="h-8 text-xs" />
)} {/* 데이터 매핑 설정 */} {config.bizType === "data-mapping" && (
updateConfig("sourceTable", e.target.value)} placeholder="소스 테이블명" className="h-8 text-xs" />
updateConfig("targetTable", e.target.value)} placeholder="대상 테이블명" className="h-8 text-xs" />
)} {/* 관련 데이터 설정 */} {config.bizType === "related-data" && (
updateConfig("relatedTable", e.target.value)} placeholder="관련 테이블명" className="h-8 text-xs" />
updateConfig("linkColumn", e.target.value)} placeholder="연결 컬럼명" className="h-8 text-xs" />
updateConfig("buttonText", e.target.value)} placeholder="관련 데이터 보기" className="h-8 text-xs" />
)}
); }; UnifiedBizConfigPanel.displayName = "UnifiedBizConfigPanel"; export default UnifiedBizConfigPanel;