From 3b06dded8296657b9f79f4f773fa01a10a986772 Mon Sep 17 00:00:00 2001 From: jiangchu Date: Sun, 8 Oct 2023 17:48:13 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20feat:=20=E6=9B=B4=E6=96=B0proflow?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=9A=84=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ProFlow/constants.tsx | 19 +------------------ src/ProFlow/index.tsx | 12 ++++-------- src/constants.tsx | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/src/ProFlow/constants.tsx b/src/ProFlow/constants.tsx index 8207ad6..79b9fc4 100644 --- a/src/ProFlow/constants.tsx +++ b/src/ProFlow/constants.tsx @@ -1,3 +1,4 @@ +import { ProFlowNode, ProFlowNodeData } from '@/constants'; import { Node } from 'reactflow'; export enum NodeSelect { @@ -6,24 +7,6 @@ export enum NodeSelect { WARNING = 'WARNING', DEFAULT = 'DEFAULT', } -export interface ProFlowNode { - id: string; - group?: boolean; - select?: NodeSelect; - data: ProFlowNodeData | ProFlowNode[]; -} - -export interface ProFlowNodeData { - title: string; - describe: string; - logo: string; -} - -export interface ProFLowEdge { - id: string; - source: string; - target: string; -} export interface InitialNode extends Node { width?: number; diff --git a/src/ProFlow/index.tsx b/src/ProFlow/index.tsx index 46efe50..128e06b 100644 --- a/src/ProFlow/index.tsx +++ b/src/ProFlow/index.tsx @@ -1,7 +1,6 @@ import React, { useMemo, type CSSProperties, type MouseEvent as ReactMouseEvent } from 'react'; -import ReactFlow, { Background, BackgroundVariant, Edge, Node, useEdgesState } from 'reactflow'; -import { ProFlowController, RadiusEdge } from '../index'; -import { ProFLowEdge, ProFlowNode } from './constants'; +import ReactFlow, { Background, BackgroundVariant, Edge, Node } from 'reactflow'; +import { ProFlowController, ProFlowEdge, ProFlowNode, RadiusEdge } from '../index'; import { convertMappingFrom, getRenderData } from './helper'; import { useStyles } from './styles'; @@ -12,7 +11,7 @@ interface ProFlowProps { onPaneClick: (event: ReactMouseEvent) => void; onNodeClick: (event: ReactMouseEvent, node: Node) => void; nodes: ProFlowNode[]; - edges: ProFLowEdge[]; + edges: ProFlowEdge[]; className?: string; style?: CSSProperties; miniMap?: boolean; @@ -40,10 +39,7 @@ const ProFlow: React.FC> = (props) => { }; } }, [mapping]); - const [_edges] = useEdgesState(renderData.edges); - - console.log(renderData.edges); - console.log(_edges); + // const [_edges] = useEdgesState(renderData.edges); return (