ant-design / ant-design/pro-flow

👑 [需求]自定义连线

Open
#103 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
353
Forks
36
PR merge metrics
No merged PRs in 30d

Description

### 🥰 需求描述

flowEditor
自定义连线需要修改 onConnect 的参数,现在的封装```
updateEdgesOnConnection: (connection) => {
const { source, target, sourceHandle, targetHandle } = connection;

if (!source || !target) return;

const edgeId = generateEdgeId(source, target, sourceHandle, targetHandle);

const edge: Edge = {
id: edgeId,
source: source,
target: target,
sourceHandle,
targetHandle,
};
// 这里无法扩展 edge 的 type
get().dispatchEdges({ type: 'addEdge', edge });

return edge;
},```

### 🧐 解决方案

现在只能在 onConnect 里增加 type,手动 addEdge,然后在 afterConnect 里移除你们增加的
addEdge 的传参是不是可以交还给开发者

### 🚑 其他信息

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading flowEditor’s updateEdgesOnConnection implementation and the onConnect/afterConnect path shown in the issue. Confirm that custom edge data such as type can be passed through the connection flow without requiring a manual addEdge call or cleanup in afterConnect.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.