"use client"; import React from "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[]; // 선택된 컬럼 목록 } export const TableNode: React.FC<{ data: TableNodeData }> = ({ data }) => { const { table, onColumnClick, onScrollAreaEnter, onScrollAreaLeave, selectedColumns = [] } = data; return (
{/* 테이블 헤더 */}

{table.displayName}

{table.description &&

{table.description}

}
{/* 컬럼 목록 */}
{table.columns.map((column) => { const isSelected = selectedColumns.includes(column.name); return (
onColumnClick(table.tableName, column.name)} className={`cursor-pointer rounded px-2 py-1 text-xs transition-colors ${ isSelected ? "bg-blue-100 text-blue-800 ring-2 ring-blue-500" : "text-gray-700 hover:bg-gray-100" }`} >
{column.name} {column.type}
{column.description &&
{column.description}
}
); })}
); };