From 0f33eac9310f5fec33811700529d90cd43deabed Mon Sep 17 00:00:00 2001 From: ModestFun <61576426+ModestFun@users.noreply.github.com> Date: Tue, 2 Apr 2024 18:47:43 +0800 Subject: [PATCH] :bug: fix: edge params (#98) * :bug: fix: edge params * :sparkles: feat: version --------- Co-authored-by: jiangchu --- docs/guide/demos/flowViewIntro/groupNode.tsx | 62 ++++++++++++++++++++ docs/guide/flowViewIntro.zh-CN.md | 4 ++ package.json | 2 +- src/FlowView/helper.tsx | 1 + src/FlowView/index.tsx | 2 +- 5 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 docs/guide/demos/flowViewIntro/groupNode.tsx diff --git a/docs/guide/demos/flowViewIntro/groupNode.tsx b/docs/guide/demos/flowViewIntro/groupNode.tsx new file mode 100644 index 0000000..e7831ca --- /dev/null +++ b/docs/guide/demos/flowViewIntro/groupNode.tsx @@ -0,0 +1,62 @@ +/** + * compact: true + * defaultShowCode: true + */ +import { FlowView } from '@ant-design/pro-flow'; +import useStyles from './css/index.style'; +// import { edges, nodes } from './data/data3'; + +const GroupNode = () => { + return ( +
+ ); +}; + +const nodeTypes = { GroupNode }; + +const nodes = [ + { + id: '1', + type: 'GroupNode', + position: { x: 0, y: 0 }, + zIndex: -1, + }, + { + id: '2', + position: { x: 50, y: 10 }, + parentNode: '1', + extent: 'parent', + }, + { + id: '3', + position: { x: 50, y: 190 }, + parentNode: '1', + extent: 'parent', + }, +]; + +const edges = [ + { + id: 'e1', + source: '2', + target: '3', + }, +]; + +function App() { + const { styles } = useStyles(); + + return ( +
+ +
+ ); +} + +export default App; diff --git a/docs/guide/flowViewIntro.zh-CN.md b/docs/guide/flowViewIntro.zh-CN.md index 774aa47..f0182bc 100644 --- a/docs/guide/flowViewIntro.zh-CN.md +++ b/docs/guide/flowViewIntro.zh-CN.md @@ -82,6 +82,10 @@ const nodes = [ + + ## 参数配置 ### FlowView diff --git a/package.json b/package.json index a9fa27f..9fd8653 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ant-design/pro-flow", - "version": "1.3.6", + "version": "1.3.7", "description": "A React based Flow components", "keywords": [ "flow", diff --git a/src/FlowView/helper.tsx b/src/FlowView/helper.tsx index fa1a917..a3cf7a7 100644 --- a/src/FlowView/helper.tsx +++ b/src/FlowView/helper.tsx @@ -161,6 +161,7 @@ export function getRenderEdges(edges: FlowViewEdge[]) { } = edge; return { + ...edge, id, source, target, diff --git a/src/FlowView/index.tsx b/src/FlowView/index.tsx index c0d16ab..62ae343 100644 --- a/src/FlowView/index.tsx +++ b/src/FlowView/index.tsx @@ -147,6 +147,7 @@ const FlowView: React.FC> = (props) => { return ( <> > = (props) => { fitView minZoom={minZoom} maxZoom={maxZoom} - {...flowProps} > {miniMap && (