From 2ceddb5c40266ce9f203985da7f3d9adca8c7fc7 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Thu, 20 Jun 2024 18:29:13 +0800 Subject: [PATCH] =?UTF-8?q?=20feat:=20=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/workflow/common/app-node.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/src/workflow/common/app-node.ts b/ui/src/workflow/common/app-node.ts index fcfac040e..a46b7ee2a 100644 --- a/ui/src/workflow/common/app-node.ts +++ b/ui/src/workflow/common/app-node.ts @@ -110,12 +110,20 @@ class AppNodeModel extends HtmlResize.model { } setAttributes() { this.width = this.properties?.width || 340 + const circleOnlyAsTarget = { message: '只允许从右边的锚点连出', validate: (sourceNode: any, targetNode: any, sourceAnchor: any) => { return sourceAnchor.type === 'right' } } + + this.sourceRules.push({ + message: '只允许连一个节点', + validate: (sourceNode: any, targetNode: any, sourceAnchor: any) => { + return !this.graphModel.edges.some((item) => item.sourceNodeId === sourceNode.id) + } + }) this.sourceRules.push(circleOnlyAsTarget) this.targetRules.push({ message: '只允许连接左边的锚点',