"use client"; import React from "react"; import { Handle, Position } from "@xyflow/react"; interface TableColumn { name: string; type: string; description: string; } interface Table { tableName: string; displayName: string; description: string; columns: TableColumn[]; } interface TableNodeData { table: Table; onColumnClick: (tableName: string, columnName: string) => void; onScrollAreaEnter?: () => void; onScrollAreaLeave?: () => void; selectedColumns?: string[]; // 선택된 컬럼 목록 connectedColumns?: { [columnName: string]: { direction: "source" | "target" | "both" } }; // 연결된 컬럼 정보 } export const TableNode: React.FC<{ data: TableNodeData }> = ({ data }) => { const { table, onColumnClick, onScrollAreaEnter, onScrollAreaLeave, selectedColumns = [], connectedColumns = {}, } = data; return (
{/* React Flow Handles - 숨김 처리 */} {/* 테이블 헤더 - 통일된 디자인 */}

{table.displayName}

{table.description &&

{table.description}

}
{/* 컬럼 목록 */}
{table.columns.map((column, index) => { const isSelected = selectedColumns.includes(column.name); return (
onColumnClick(table.tableName, column.name)} > {/* 핸들 제거됨 - 컬럼 클릭으로만 연결 생성 */}
{column.name} {column.type}
{column.description &&
{column.description}
}
); })}
); };