-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathFlowButtons.tsx
56 lines (47 loc) · 1.39 KB
/
FlowButtons.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import React from "react";
import {FlowData} from "@/components/Flow/flow/data";
import {Button, Space} from "antd";
interface FlowButtonsProps {
flowData: FlowData;
requestLoading: boolean;
setRequestLoading: (loading: boolean) => void;
handlerClick: (item: any) => void;
}
const FlowButtons: React.FC<FlowButtonsProps> = (props) => {
const flowData = props.flowData;
if (!flowData ) {
return null;
}
if(flowData.hasData() && flowData.isDone()){
return null;
}
if(flowData.hasData() && !flowData.canHandle()){
return null;
}
const buttons = flowData.getNodeButtons();
return (
<Space>
{buttons && buttons.map((item: any) => {
const style = item.style && {
...JSON.parse(item.style),
color: "white",
} || {};
return (
<Button
key={item.id}
onClick={() => {
props.handlerClick(item);
}}
loading={props.requestLoading}
style={{
...style
}}
>
{item.name}
</Button>
)
})}
</Space>
)
}
export default FlowButtons;