|
@@ -66,13 +66,11 @@ function TableNode({ node, graph }: { node: Node; graph: Graph }) {
|
|
|
}
|
|
|
}, []);
|
|
|
|
|
|
- // 连接桩,1用于开始连接拖拽,2用于关系连线连接
|
|
|
- useEffect(() => {
|
|
|
+ const renderPort = () => {
|
|
|
const ports = node.getPorts();
|
|
|
ports?.forEach((item) => {
|
|
|
if (!tableColumnList.find((column) => item.id?.includes(column.id))) {
|
|
|
node.removePort(item);
|
|
|
- console.log("removePort", item);
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -82,15 +80,15 @@ function TableNode({ node, graph }: { node: Node; graph: Graph }) {
|
|
|
id: item.id + "_port1",
|
|
|
group: "columnPort",
|
|
|
args: {
|
|
|
- y: 44 + 16 + index * 27,
|
|
|
+ y: 47 + 12 + index * 28,
|
|
|
},
|
|
|
attrs: {
|
|
|
circle: {
|
|
|
r: 4,
|
|
|
magnet: true,
|
|
|
stroke: "#31d0c6",
|
|
|
- strokeWidth: 2,
|
|
|
- fill: "#fff",
|
|
|
+ strokeWidth: 0,
|
|
|
+ fill: "rgba(255,255,255,0)",
|
|
|
},
|
|
|
},
|
|
|
zIndex: 5,
|
|
@@ -100,12 +98,12 @@ function TableNode({ node, graph }: { node: Node; graph: Graph }) {
|
|
|
group: "columnPort",
|
|
|
args: {
|
|
|
x: 0,
|
|
|
- y: 42 + index * 27,
|
|
|
+ y: 43 + index * 28,
|
|
|
},
|
|
|
attrs: {
|
|
|
rect: {
|
|
|
magnet: true,
|
|
|
- fill: "rgba(255,255,255,0)",
|
|
|
+ fill: "rgba(255,255,255, 0)",
|
|
|
strokeWidth: 0,
|
|
|
width: node.size().width,
|
|
|
height: 27,
|
|
@@ -115,8 +113,14 @@ function TableNode({ node, graph }: { node: Node; graph: Graph }) {
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
+ };
|
|
|
+
|
|
|
+ // 连接桩,1用于开始连接拖拽,2用于关系连线连接
|
|
|
+ useEffect(() => {
|
|
|
+ renderPort();
|
|
|
}, [tableColumnList]);
|
|
|
|
|
|
+
|
|
|
// 触发添加关系操作
|
|
|
// 字段位置鼠标抬起,判断有没有开始连线操作
|
|
|
const handleColumnMouseUp = (record: ColumnItem) => {
|
|
@@ -153,12 +157,12 @@ function TableNode({ node, graph }: { node: Node; graph: Graph }) {
|
|
|
)?.value;
|
|
|
return (
|
|
|
<div
|
|
|
- className="w-full flex py-4px px-8px"
|
|
|
+ className="w-full h-28px flex px-8px leading-28px overflow-hidden"
|
|
|
onMouseUp={() => handleColumnMouseUp(record)}
|
|
|
>
|
|
|
<span className="flex-1 truncate flex items-center justify-between">
|
|
|
<span className="flex items-center truncate">
|
|
|
- <span className=" w-6px h-6px rounded-full mr-4px shrink-0 inline-block cursor-pointer" />
|
|
|
+ <span className=" w-8px h-8px rounded-full mr-4px shrink-0 inline-block bg-#fff border-solid border-2px border-#31d0c6" />
|
|
|
<span className="flex-1 truncate">
|
|
|
{record.schemaName}
|
|
|
{columnName ? `(${columnName})` : ""}
|