Skip to content

Commit

Permalink
✨ feat: flow props (#47)
Browse files Browse the repository at this point in the history
Co-authored-by: jiangchu <jiangchu.wzy@antgroup.com>
  • Loading branch information
ModestFun and jiangchu committed Dec 6, 2023
1 parent 642a92f commit 6121cee
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -64,6 +64,7 @@
"dependencies": {
"@ant-design/icons": "^5",
"@ant-design/pro-editor": "latest",
"@ant-design/pro-flow": "^0.15.0",
"@babel/runtime": "^7",
"@dagrejs/dagre": "^1.0.4",
"@dnd-kit/core": "^6.1.0",
Expand Down
1 change: 1 addition & 0 deletions src/FlowView/hooks/useFlowView.ts
Expand Up @@ -84,5 +84,6 @@ export const useFlowViewer = () => {
zoomToNode,
fitView,
setMiniMapPosition,
instance: reactFlowInstance,
};
};
2 changes: 2 additions & 0 deletions src/FlowView/index.tsx
Expand Up @@ -34,6 +34,7 @@ const FlowView: React.FC<Partial<FlowViewProps>> = (props) => {
background = true,
autoLayout = true,
stepLessZooming = true,
flowProps,
} = props;
const {
miniMapPosition,
Expand Down Expand Up @@ -117,6 +118,7 @@ const FlowView: React.FC<Partial<FlowViewProps>> = (props) => {
panOnScroll
fitView
minZoom={MIN_ZOOM}
{...flowProps}
>
{miniMap && <MiniMap position={miniMapPosition} className={'pro-flow-controller'} />}
{children}
Expand Down
9 changes: 7 additions & 2 deletions src/constants.tsx
@@ -1,5 +1,9 @@
import React, { type CSSProperties, type MouseEvent as ReactMouseEvent } from 'react';
import { Edge, EdgeProps, Node, NodeProps } from 'reactflow';
import React, {
ComponentProps,
type CSSProperties,
type MouseEvent as ReactMouseEvent,
} from 'react';
import ReactFlow, { Edge, EdgeProps, Node, NodeProps } from 'reactflow';
import { NodeMapItem } from './FlowView/constants';

export enum SelectType {
Expand Down Expand Up @@ -80,6 +84,7 @@ export interface FlowViewProps {
onPaneClick?: (event: ReactMouseEvent) => void;
onNodeClick?: (event: ReactMouseEvent, node: Node) => void;
onEdgeClick?: (event: ReactMouseEvent, edge: Edge) => void;
flowProps?: ComponentProps<typeof ReactFlow>;
nodes: FlowViewNode[];
edges: FlowViewEdge[];
nodeTypes?: Record<string, React.ComponentType<NodeProps>>;
Expand Down

0 comments on commit 6121cee

Please sign in to comment.