"use client"; import React from "react"; import { Handle, Position } from "@xyflow/react"; interface TableColumn { columnName: string; name?: string; // 호환성을 위해 유지 columnLabel?: string; displayName?: string; dataType?: 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[]; // 선택된 컬럼 목록 } export const TableNode: React.FC<{ data: TableNodeData }> = ({ data }) => { const { table, onColumnClick, onScrollAreaEnter, onScrollAreaLeave, selectedColumns = [] } = data; return (
{/* React Flow Handles - 숨김 처리 */} {/* 테이블 헤더 - 통일된 디자인 */}

{table.displayName}

{table.description &&

{table.description}

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