Skip to content

Commit

Permalink
🐛 fix: edge params (#98)
Browse files Browse the repository at this point in the history
* 🐛 fix: edge params

* ✨ feat: version

---------

Co-authored-by: jiangchu <[email protected]>
  • Loading branch information
ModestFun and jiangchu authored Apr 2, 2024
1 parent fcec674 commit 0f33eac
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 2 deletions.
62 changes: 62 additions & 0 deletions docs/guide/demos/flowViewIntro/groupNode.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div
style={{
width: 500,
height: 800,
backgroundColor: 'red',
}}
></div>
);
};

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 (
<div className={styles.container}>
<FlowView nodeTypes={nodeTypes} nodes={nodes} edges={edges} autoLayout={false}></FlowView>
</div>
);
}

export default App;
4 changes: 4 additions & 0 deletions docs/guide/flowViewIntro.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ const nodes = [

<code src='./demos/flowViewIntro/dragableNode.tsx'></code>

<!-- ## 成组节点
<code src='./demos/flowViewIntro/groupNode.tsx'></code> -->

## 参数配置

### FlowView
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/FlowView/helper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export function getRenderEdges(edges: FlowViewEdge[]) {
} = edge;

return {
...edge,
id,
source,
target,
Expand Down
2 changes: 1 addition & 1 deletion src/FlowView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ const FlowView: React.FC<Partial<FlowViewProps>> = (props) => {
return (
<>
<ReactFlow
{...flowProps}
ref={flowViewRef as any}
className={cx(styles.container, className)}
onNodeDragStart={handleNodeDragStart}
Expand All @@ -164,7 +165,6 @@ const FlowView: React.FC<Partial<FlowViewProps>> = (props) => {
fitView
minZoom={minZoom}
maxZoom={maxZoom}
{...flowProps}
>
{miniMap && (
<MiniMap
Expand Down

0 comments on commit 0f33eac

Please sign in to comment.