11import React , { useCallback , useState } from "react" ;
22import { Meta , StoryFn } from "@storybook/react" ;
3- import { addEdge , Edge , OnConnect , Position , ReactFlow , useEdgesState , useNodesState } from "@xyflow/react" ;
3+ import { addEdge , Edge , Node , OnConnect , Position , useEdgesState , useNodesState } from "@xyflow/react" ;
44
5- import { NodeDefaultV12 } from "../../nodes/NodeDefaultV12" ;
6- import { EdgeDefaultV12 , EdgeDefaultV12DataProps as EdgeData } from "../EdgeDefaultV12" ;
7- import { EdgeDefs } from "../EdgeDefs" ;
8-
9- import { EdgeLabel , EdgeLabelObject } from "./../../../../../index" ;
5+ import {
6+ EdgeDefaultV12 ,
7+ EdgeDefaultV12DataProps as EdgeData ,
8+ EdgeLabel ,
9+ EdgeLabelObject ,
10+ ReactFlowExtended ,
11+ ReactFlowVersions ,
12+ } from "./../../../../../index" ;
1013
1114/**
1215 * this is only a mock to get it as sub element in the table
@@ -16,12 +19,6 @@ const EdgeDefaultDataProps = (data: EdgeData) => {
1619 return < > </ > ;
1720} ;
1821
19- const edgeTypes = {
20- default : EdgeDefaultV12 ,
21- } ;
22- const nodeTypes = {
23- default : NodeDefaultV12 ,
24- } ;
2522export default {
2623 title : "Extensions/React Flow V12/Edge" ,
2724 component : EdgeDefaultV12 ,
@@ -76,17 +73,11 @@ const EdgeDefault = (args: Edge) => {
7673 } ,
7774 position : { x : 600 , y : 200 } ,
7875 } ,
79- ] ) ;
76+ ] as Node [ ] ) ;
8077
8178 const [ edges , setEdges , onEdgesChange ] = useEdgesState ( [
8279 {
8380 ...args ,
84- // sourceX: 150,
85- // sourceY: 0,
86- // targetX: 250,
87- // targetY: 0,
88- sourcePosition : Position . Left ,
89- targetPosition : Position . Right ,
9081 } ,
9182 ] ) ;
9283
@@ -102,17 +93,16 @@ const EdgeDefault = (args: Edge) => {
10293 ) ;
10394
10495 return (
105- < div style = { { width : "1000px" , height : "800px " } } >
106- < EdgeDefs />
107- < ReactFlow
96+ < div style = { { height : "400px " } } >
97+ < ReactFlowExtended
98+ flowVersion = { ReactFlowVersions . V12 }
10899 nodes = { nodes }
109100 edges = { edges }
110101 onLoad = { onLoad }
111- edgeTypes = { edgeTypes }
112- nodeTypes = { nodeTypes }
113102 onNodesChange = { onNodesChange }
114103 onEdgesChange = { onEdgesChange }
115104 onConnect = { onConnect }
105+ defaultZoom = { 1 }
116106 />
117107 </ div >
118108 ) ;
0 commit comments