Skip to content

Commit 1b545ac

Browse files
committed
add EdgeType
1 parent cfa4db2 commit 1b545ac

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

admin-ui/src/components/Flow/flow/FlowChart.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ import Circulate from "@/components/Flow/nodes/Circulate";
99
import '@logicflow/core/es/index.css';
1010
import '@logicflow/extension/lib/style/index.css';
1111
import "./FlowChart.scss";
12+
import {EdgeType} from "@/components/Flow/flow/types";
1213

1314
interface FlowChartProps {
14-
flowData: FlowData
15+
flowData: FlowData;
16+
edgeType?: EdgeType;
1517
}
1618

1719
const FlowChart: React.FC<FlowChartProps> = (props) => {
1820

1921
const flowData = props.flowData;
20-
22+
const edgeType = props.edgeType || 'polyline';
2123
const container = useRef<HTMLDivElement>(null);
2224
const lfRef = useRef<LogicFlow>(null);
2325

@@ -40,14 +42,22 @@ const FlowChart: React.FC<FlowChartProps> = (props) => {
4042
},
4143
plugins: [Menu, DndPanel, MiniMap, Snapshot],
4244
grid: false,
43-
edgeType: 'bezier',
45+
edgeType: edgeType,
4446
});
4547

4648
lfRef.current.setTheme({
4749
bezier: {
4850
stroke: '#8f94e3',
4951
strokeWidth: 1,
5052
},
53+
polyline: {
54+
stroke: '#8f94e3',
55+
strokeWidth: 1,
56+
},
57+
line: {
58+
stroke: '#8f94e3',
59+
strokeWidth: 1,
60+
},
5161
});
5262
lfRef.current.register(Start);
5363
lfRef.current.register(Node);

admin-ui/src/components/Flow/flow/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import React from "react";
22
import {FormInstance} from "antd/es/form/hooks/useForm";
33
import {FlowData} from "@/components/Flow/flow/data";
4-
import {clearTriggerEventClick} from "@/components/Flow/store/FlowSlice";
54

65
// 自定义按钮类型
76
export type CustomButtonType = 'SAVE' | 'START' | 'SUBMIT' | 'TRY_SUBMIT' | 'SPECIFY_SUBMIT' | 'REJECT' | 'TRANSFER' | 'RECALL' | 'POSTPONED' | 'URGE' | 'CUSTOM' | 'VIEW';
87

8+
// 流程图中线的类型
9+
export type EdgeType = 'line' | 'polyline' | 'bezier';
10+
911
// 表单视图属性
1012
export interface FlowFormViewProps {
1113
// 表单数据

admin-ui/src/components/Flow/index.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,22 @@ import NodePanel from "@/components/Flow/layout/NodePanel";
1414
import {message} from "antd";
1515
import {copy} from "@/components/Flow/panel/shortcuts";
1616
import FlowUtils from "@/components/Flow/utils";
17+
import {EdgeType} from "@/components/Flow/flow/types";
1718

1819
export interface FlowActionType {
1920
getData: () => any;
2021
}
2122

2223
interface FlowProps {
2324
data?: LogicFlow.GraphConfigData;
24-
actionRef?: React.Ref<any>
25+
actionRef?: React.Ref<any>;
26+
edgeType?: EdgeType;
2527
}
2628

2729
const Flow: React.FC<FlowProps> = (props) => {
2830
const container = useRef<HTMLDivElement>(null);
2931
const lfRef = useRef<LogicFlow>(null);
32+
const edgeType = props.edgeType || 'polyline';
3033
const [mapVisible, setMapVisible] = React.useState(false);
3134

3235
if (props.actionRef) {
@@ -69,14 +72,22 @@ const Flow: React.FC<FlowProps> = (props) => {
6972
}
7073
]
7174
},
72-
edgeType: 'bezier',
75+
edgeType: edgeType,
7376
});
7477

7578
lfRef.current.setTheme({
7679
bezier: {
7780
stroke: '#8f94e3',
7881
strokeWidth: 1,
7982
},
83+
polyline: {
84+
stroke: '#8f94e3',
85+
strokeWidth: 1,
86+
},
87+
line: {
88+
stroke: '#8f94e3',
89+
strokeWidth: 1,
90+
},
8091
});
8192
lfRef.current.register(Start);
8293
lfRef.current.register(Node);

0 commit comments

Comments
 (0)