@hzab/flowlong-designer 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/package.json +1 -1
- package/src/assets/img/add.png +0 -0
- package/src/assets/img/check-json.png +0 -0
- package/src/assets/img/control-bg.png +0 -0
- package/src/assets/img/reload.png +0 -0
- package/src/assets/img/sub.png +0 -0
- package/src/components/NodeWrap/Nodes/AddNode/index.tsx +9 -2
- package/src/components/NodeWrap/Nodes/Approver/index.tsx +14 -3
- package/src/components/NodeWrap/Nodes/Branch/components/GroupUserSelectorModal/index.tsx +1 -1
- package/src/components/NodeWrap/Nodes/Branch/index.tsx +5 -4
- package/src/components/NodeWrap/Nodes/Promoter/index.less +3 -2
- package/src/components/NodeWrap/Nodes/Promoter/index.tsx +6 -2
- package/src/components/NodeWrap/Nodes/Send/index.tsx +14 -3
- package/src/components/NodeWrap/index.tsx +7 -4
- package/src/components/ScWorkflow/index.tsx +2 -2
- package/src/components/Selector/SelectContext.tsx +6 -6
- package/src/index.less +54 -13
- package/src/index.tsx +22 -18
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -78,7 +78,7 @@ export function getNodeKey() {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
export const AddNode = (props) => {
|
|
81
|
-
const { modelValue, onChange } = props;
|
|
81
|
+
const { modelValue, onChange, disable } = props;
|
|
82
82
|
|
|
83
83
|
function addType(type) {
|
|
84
84
|
const data = _.cloneDeep(typeDataEnum[type]);
|
|
@@ -91,6 +91,7 @@ export const AddNode = (props) => {
|
|
|
91
91
|
<div className="add-node-box">
|
|
92
92
|
<div className="add-node-btn-box">
|
|
93
93
|
<Popover
|
|
94
|
+
open={disable ? false : undefined}
|
|
94
95
|
className="popover"
|
|
95
96
|
trigger="click"
|
|
96
97
|
placement="bottom"
|
|
@@ -109,7 +110,13 @@ export const AddNode = (props) => {
|
|
|
109
110
|
</div>
|
|
110
111
|
}
|
|
111
112
|
>
|
|
112
|
-
<Button
|
|
113
|
+
<Button
|
|
114
|
+
disabled={disable}
|
|
115
|
+
className="add-node-btn"
|
|
116
|
+
type="primary"
|
|
117
|
+
shape="circle"
|
|
118
|
+
icon={<PlusOutlined />}
|
|
119
|
+
></Button>
|
|
113
120
|
</Popover>
|
|
114
121
|
</div>
|
|
115
122
|
</div>
|
|
@@ -10,7 +10,7 @@ import { SelectContext } from "../../../Selector/SelectContext";
|
|
|
10
10
|
import "./index.less";
|
|
11
11
|
|
|
12
12
|
export const Approver = (props) => {
|
|
13
|
-
const { modelValue = {}, onChange } = props;
|
|
13
|
+
const { modelValue = {}, onChange, disable } = props;
|
|
14
14
|
const [form, setForm] = useState({
|
|
15
15
|
nodeName: "",
|
|
16
16
|
setType: undefined,
|
|
@@ -33,11 +33,17 @@ export const Approver = (props) => {
|
|
|
33
33
|
const nodeTitleRef = useRef();
|
|
34
34
|
|
|
35
35
|
function onShow() {
|
|
36
|
+
if (disable) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
36
39
|
setDrawer(true);
|
|
37
40
|
setForm(JSON.parse(JSON.stringify(modelValue)));
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
function onNodeDel(e) {
|
|
44
|
+
if (disable) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
41
47
|
e.stopPropagation();
|
|
42
48
|
onChange && onChange(modelValue.childNode);
|
|
43
49
|
}
|
|
@@ -113,11 +119,15 @@ export const Approver = (props) => {
|
|
|
113
119
|
return (
|
|
114
120
|
<div className="approver-wrap">
|
|
115
121
|
<div className="node-wrap">
|
|
116
|
-
<div className="node-wrap-box" onClick={onShow}>
|
|
122
|
+
<div className={`${disable ? "node-wrap-box-disable" : "node-wrap-box"}`} onClick={onShow}>
|
|
117
123
|
<div className="title" style={{ background: "#ff943e" }}>
|
|
118
124
|
<UserOutlined />
|
|
119
125
|
<span>{modelValue?.nodeName}</span>
|
|
120
|
-
<DeleteOutlined
|
|
126
|
+
<DeleteOutlined
|
|
127
|
+
className="node-close-btn"
|
|
128
|
+
onClick={onNodeDel}
|
|
129
|
+
style={disable ? { cursor: "not-allowed" } : {}}
|
|
130
|
+
/>
|
|
121
131
|
</div>
|
|
122
132
|
<div className="content">
|
|
123
133
|
{toText(modelValue) ? <span>{toText(modelValue)}</span> : <span className="placeholder">请选择</span>}
|
|
@@ -125,6 +135,7 @@ export const Approver = (props) => {
|
|
|
125
135
|
</div>
|
|
126
136
|
|
|
127
137
|
<AddNode
|
|
138
|
+
{...props}
|
|
128
139
|
modelValue={modelValue?.childNode}
|
|
129
140
|
onChange={(val) => {
|
|
130
141
|
modelValue.childNode = val;
|
|
@@ -90,7 +90,6 @@ const GroupUserSelectorModal = (props) => {
|
|
|
90
90
|
value: valueArr?.length && valueArr[index],
|
|
91
91
|
}));
|
|
92
92
|
}, [value, type]);
|
|
93
|
-
|
|
94
93
|
return (
|
|
95
94
|
<div>
|
|
96
95
|
<Input
|
|
@@ -120,6 +119,7 @@ const GroupUserSelectorModal = (props) => {
|
|
|
120
119
|
value={groupUserSelectorValue || []}
|
|
121
120
|
ref={groupUserSelectorRef}
|
|
122
121
|
model={model}
|
|
122
|
+
searchModel={model}
|
|
123
123
|
{...(type === "useId" ? userListConfig : {})}
|
|
124
124
|
></GroupUserSelector>
|
|
125
125
|
</div>
|
|
@@ -43,7 +43,7 @@ const timeType = ["day", "hour"];
|
|
|
43
43
|
/** 部门或用户 */
|
|
44
44
|
const deptUserType = ["dept", "useId"];
|
|
45
45
|
export const Branch = (props) => {
|
|
46
|
-
const { modelValue: nodeConfig, onChange, ItemSlot } = props;
|
|
46
|
+
const { modelValue: nodeConfig, onChange, ItemSlot, disable } = props;
|
|
47
47
|
const [form, setForm] = useState({
|
|
48
48
|
nodeName: "",
|
|
49
49
|
setType: undefined,
|
|
@@ -272,16 +272,15 @@ export const Branch = (props) => {
|
|
|
272
272
|
operatorOptions,
|
|
273
273
|
};
|
|
274
274
|
};
|
|
275
|
-
|
|
276
275
|
return (
|
|
277
276
|
<div className="branch-wrap">
|
|
278
277
|
<div className="branch-box-wrap">
|
|
279
278
|
<div className="branch-box">
|
|
280
|
-
<Button className="add-branch" onClick={onTermAdd}>
|
|
279
|
+
<Button className="add-branch" onClick={onTermAdd} disabled={disable}>
|
|
281
280
|
添加条件
|
|
282
281
|
</Button>
|
|
283
282
|
{nodeConfig?.conditionNodes?.map((item, idx) => {
|
|
284
|
-
const conditionDisable = idx == nodeConfig.conditionNodes?.length - 1;
|
|
283
|
+
const conditionDisable = idx == nodeConfig.conditionNodes?.length - 1 || disable;
|
|
285
284
|
|
|
286
285
|
return (
|
|
287
286
|
<div className="col-box" key={idx}>
|
|
@@ -341,6 +340,7 @@ export const Branch = (props) => {
|
|
|
341
340
|
) : null}
|
|
342
341
|
</div>
|
|
343
342
|
<AddNode
|
|
343
|
+
{...props}
|
|
344
344
|
modelValue={item.childNode}
|
|
345
345
|
onChange={(val) => {
|
|
346
346
|
item.childNode = val;
|
|
@@ -371,6 +371,7 @@ export const Branch = (props) => {
|
|
|
371
371
|
})}
|
|
372
372
|
</div>
|
|
373
373
|
<AddNode
|
|
374
|
+
{...props}
|
|
374
375
|
modelValue={nodeConfig.childNode}
|
|
375
376
|
onChange={(val) => {
|
|
376
377
|
nodeConfig.childNode = val;
|
|
@@ -9,7 +9,7 @@ import "./index.less";
|
|
|
9
9
|
|
|
10
10
|
export const Promoter = (props) => {
|
|
11
11
|
const selectorCtx = useContext(SelectContext);
|
|
12
|
-
const { modelValue: nodeConfig = {}, onChange } = props;
|
|
12
|
+
const { modelValue: nodeConfig = {}, onChange, disable } = props;
|
|
13
13
|
|
|
14
14
|
const [drawer, setDrawer] = useState(false);
|
|
15
15
|
const [isEditTitle, setIsEditTitle] = useState(false);
|
|
@@ -32,6 +32,9 @@ export const Promoter = (props) => {
|
|
|
32
32
|
const nodeTitleRef = useRef();
|
|
33
33
|
|
|
34
34
|
function onShow() {
|
|
35
|
+
if (disable) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
35
38
|
setForm(JSON.parse(JSON.stringify(nodeConfig)));
|
|
36
39
|
setIsEditTitle(false);
|
|
37
40
|
setDrawer(true);
|
|
@@ -81,7 +84,7 @@ export const Promoter = (props) => {
|
|
|
81
84
|
return (
|
|
82
85
|
<div className="promoter-wrap">
|
|
83
86
|
<div className="node-wrap">
|
|
84
|
-
<div className="node-wrap-box
|
|
87
|
+
<div className={`start-node ${disable ? "node-wrap-box-disable" : "node-wrap-box"}`} onClick={onShow}>
|
|
85
88
|
<div className="title">
|
|
86
89
|
<UserOutlined className="icon" />
|
|
87
90
|
<span>{nodeConfig.nodeName}</span>
|
|
@@ -91,6 +94,7 @@ export const Promoter = (props) => {
|
|
|
91
94
|
</div>
|
|
92
95
|
</div>
|
|
93
96
|
<AddNode
|
|
97
|
+
{...props}
|
|
94
98
|
modelValue={nodeConfig.childNode}
|
|
95
99
|
onChange={(val) => {
|
|
96
100
|
nodeConfig.childNode = val;
|
|
@@ -10,7 +10,7 @@ import { SelectContext } from "../../../Selector/SelectContext";
|
|
|
10
10
|
import "./index.less";
|
|
11
11
|
|
|
12
12
|
export const Approver = (props) => {
|
|
13
|
-
const { modelValue = {}, onChange } = props;
|
|
13
|
+
const { modelValue = {}, onChange, disable } = props;
|
|
14
14
|
const [form, setForm] = useState({
|
|
15
15
|
nodeName: "",
|
|
16
16
|
setType: undefined,
|
|
@@ -33,11 +33,17 @@ export const Approver = (props) => {
|
|
|
33
33
|
const nodeTitleRef = useRef();
|
|
34
34
|
|
|
35
35
|
function onShow() {
|
|
36
|
+
if (disable) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
36
39
|
setDrawer(true);
|
|
37
40
|
setForm(JSON.parse(JSON.stringify(modelValue)));
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
function onNodeDel(e) {
|
|
44
|
+
if (disable) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
41
47
|
e.stopPropagation();
|
|
42
48
|
onChange && onChange(modelValue.childNode);
|
|
43
49
|
}
|
|
@@ -115,11 +121,15 @@ export const Approver = (props) => {
|
|
|
115
121
|
return (
|
|
116
122
|
<div className="approver-wrap">
|
|
117
123
|
<div className="node-wrap">
|
|
118
|
-
<div className="node-wrap-box" onClick={onShow}>
|
|
124
|
+
<div className={`${disable ? "node-wrap-box-disable" : "node-wrap-box"}`} onClick={onShow}>
|
|
119
125
|
<div className="title send-title">
|
|
120
126
|
<UserOutlined />
|
|
121
127
|
<span>{modelValue?.nodeName}</span>
|
|
122
|
-
<DeleteOutlined
|
|
128
|
+
<DeleteOutlined
|
|
129
|
+
className="node-close-btn"
|
|
130
|
+
onClick={onNodeDel}
|
|
131
|
+
style={disable ? { cursor: "not-allowed" } : {}}
|
|
132
|
+
/>
|
|
123
133
|
</div>
|
|
124
134
|
<div className="content">
|
|
125
135
|
{toText(modelValue) ? <span>{toText(modelValue)}</span> : <span className="placeholder">请选择</span>}
|
|
@@ -127,6 +137,7 @@ export const Approver = (props) => {
|
|
|
127
137
|
</div>
|
|
128
138
|
|
|
129
139
|
<AddNode
|
|
140
|
+
{...props}
|
|
130
141
|
modelValue={modelValue?.childNode}
|
|
131
142
|
onChange={(val) => {
|
|
132
143
|
modelValue.childNode = val;
|
|
@@ -7,15 +7,18 @@ export const NodeWrap = (props) => {
|
|
|
7
7
|
const { modelValue: nodeConfig, onChange } = props;
|
|
8
8
|
return (
|
|
9
9
|
<div className="node-wrap">
|
|
10
|
-
{nodeConfig.type == 0 ? <Promoter modelValue={nodeConfig} onChange={onChange}></Promoter> : null}
|
|
10
|
+
{nodeConfig.type == 0 ? <Promoter {...props} modelValue={nodeConfig} onChange={onChange}></Promoter> : null}
|
|
11
11
|
|
|
12
|
-
{nodeConfig.type == 1 ? <Approver modelValue={nodeConfig} onChange={onChange}></Approver> : null}
|
|
12
|
+
{nodeConfig.type == 1 ? <Approver {...props} modelValue={nodeConfig} onChange={onChange}></Approver> : null}
|
|
13
13
|
|
|
14
|
-
{nodeConfig.type == 2 ? <Send modelValue={nodeConfig} onChange={onChange}></Send> : null}
|
|
15
|
-
{nodeConfig.type == 4 ?
|
|
14
|
+
{nodeConfig.type == 2 ? <Send {...props} modelValue={nodeConfig} onChange={onChange}></Send> : null}
|
|
15
|
+
{nodeConfig.type == 4 ? (
|
|
16
|
+
<Branch {...props} modelValue={nodeConfig} onChange={onChange} ItemSlot={NodeWrap}></Branch>
|
|
17
|
+
) : null}
|
|
16
18
|
|
|
17
19
|
{nodeConfig.childNode ? (
|
|
18
20
|
<NodeWrap
|
|
21
|
+
{...props}
|
|
19
22
|
modelValue={nodeConfig.childNode}
|
|
20
23
|
onChange={(val) => {
|
|
21
24
|
nodeConfig.childNode = val;
|
|
@@ -4,12 +4,12 @@ import NodeWrap from "../NodeWrap";
|
|
|
4
4
|
import Selector from "../Selector";
|
|
5
5
|
|
|
6
6
|
export const ScWorkflow = (props) => {
|
|
7
|
-
const { modelValue: nodeConfig, onChange } = props;
|
|
7
|
+
const { modelValue: nodeConfig, onChange, disable } = props;
|
|
8
8
|
|
|
9
9
|
return (
|
|
10
10
|
<div className="sc-workflow-design">
|
|
11
11
|
<div className="box-scale">
|
|
12
|
-
{nodeConfig ? <NodeWrap modelValue={nodeConfig} onChange={onChange}></NodeWrap> : null}
|
|
12
|
+
{nodeConfig ? <NodeWrap {...props} modelValue={nodeConfig} onChange={onChange}></NodeWrap> : null}
|
|
13
13
|
<div className="end-node">
|
|
14
14
|
<div className="end-node-circle"></div>
|
|
15
15
|
<div className="end-node-text">流程结束</div>
|
|
@@ -12,9 +12,9 @@ export interface ISelectHandlerI {
|
|
|
12
12
|
value: [];
|
|
13
13
|
/** 选中保存回调 */
|
|
14
14
|
onSave: (selected) => void;
|
|
15
|
-
roleListConfig
|
|
16
|
-
listConfig
|
|
17
|
-
initiatorListConfig
|
|
15
|
+
roleListConfig;
|
|
16
|
+
listConfig;
|
|
17
|
+
initiatorListConfig;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -26,11 +26,11 @@ export const SelectContext = createContext({
|
|
|
26
26
|
type: undefined,
|
|
27
27
|
drawerType: undefined,
|
|
28
28
|
value: [],
|
|
29
|
-
onSave: (s) => {
|
|
29
|
+
onSave: (s) => {},
|
|
30
30
|
roleListConfig: {},
|
|
31
31
|
listConfig: {},
|
|
32
32
|
initiatorListConfig: {},
|
|
33
33
|
},
|
|
34
|
-
setSelectHandler(type, value, onSave, drawerType) {
|
|
35
|
-
onClose() {
|
|
34
|
+
setSelectHandler(type, value, onSave, drawerType) {},
|
|
35
|
+
onClose() {},
|
|
36
36
|
});
|
package/src/index.less
CHANGED
|
@@ -3,17 +3,43 @@
|
|
|
3
3
|
/* 默认白色背景 */
|
|
4
4
|
width: 100%;
|
|
5
5
|
|
|
6
|
-
.designer-affix
|
|
6
|
+
.designer-affix,
|
|
7
|
+
.designer-affix-isShowJson {
|
|
7
8
|
position: fixed;
|
|
8
9
|
right: 20px;
|
|
9
10
|
bottom: 20px;
|
|
10
11
|
z-index: 9;
|
|
11
|
-
padding: 12px;
|
|
12
|
-
border: 1px solid #999;
|
|
12
|
+
// padding: 12px;
|
|
13
|
+
// border: 1px solid #999;
|
|
14
|
+
width: 132px;
|
|
15
|
+
height: 48px;
|
|
16
|
+
background: url("./assets/img/control-bg.png") no-repeat;
|
|
17
|
+
background-size: 100% 100%;
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
align-items: center;
|
|
21
|
+
background-position-x: 100%;
|
|
22
|
+
background-position-y: 100%;
|
|
13
23
|
|
|
14
24
|
.action-btn+.action-btn {
|
|
15
25
|
margin-left: 12px;
|
|
16
26
|
}
|
|
27
|
+
|
|
28
|
+
.action-img {
|
|
29
|
+
width: 28px;
|
|
30
|
+
height: 28px;
|
|
31
|
+
margin-right: 16px;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.action-img:last-child {
|
|
37
|
+
margin-right: 0px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.designer-affix-isShowJson {
|
|
42
|
+
width: 180px;
|
|
17
43
|
}
|
|
18
44
|
|
|
19
45
|
.json-viewer {
|
|
@@ -45,7 +71,8 @@
|
|
|
45
71
|
z-index: 1;
|
|
46
72
|
}
|
|
47
73
|
|
|
48
|
-
.node-wrap-box
|
|
74
|
+
.node-wrap-box,
|
|
75
|
+
.node-wrap-box-disable {
|
|
49
76
|
display: inline-flex;
|
|
50
77
|
flex-direction: column;
|
|
51
78
|
position: relative;
|
|
@@ -58,7 +85,12 @@
|
|
|
58
85
|
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1);
|
|
59
86
|
}
|
|
60
87
|
|
|
61
|
-
.node-wrap-box
|
|
88
|
+
.node-wrap-box-disable {
|
|
89
|
+
cursor: not-allowed;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.node-wrap-box::before,
|
|
93
|
+
.node-wrap-box-disable::before {
|
|
62
94
|
content: "";
|
|
63
95
|
position: absolute;
|
|
64
96
|
top: -12px;
|
|
@@ -70,11 +102,13 @@
|
|
|
70
102
|
border-color: rgb(202, 202, 202) transparent transparent;
|
|
71
103
|
}
|
|
72
104
|
|
|
73
|
-
.node-wrap-box.start-node:before
|
|
105
|
+
.node-wrap-box.start-node:before,
|
|
106
|
+
.node-wrap-box-disable.start-node:before {
|
|
74
107
|
content: none;
|
|
75
108
|
}
|
|
76
109
|
|
|
77
|
-
.node-wrap-box .title
|
|
110
|
+
.node-wrap-box .title,
|
|
111
|
+
.node-wrap-box-disable .title {
|
|
78
112
|
height: 24px;
|
|
79
113
|
line-height: 24px;
|
|
80
114
|
color: #fff;
|
|
@@ -86,11 +120,13 @@
|
|
|
86
120
|
align-items: center;
|
|
87
121
|
}
|
|
88
122
|
|
|
89
|
-
.node-wrap-box .title .icon
|
|
123
|
+
.node-wrap-box .title .icon,
|
|
124
|
+
.node-wrap-box-disable .title .icon {
|
|
90
125
|
margin-right: 5px;
|
|
91
126
|
}
|
|
92
127
|
|
|
93
|
-
.node-wrap-box .title .close
|
|
128
|
+
.node-wrap-box .title .close,
|
|
129
|
+
.node-wrap-box-disable .title .close {
|
|
94
130
|
font-size: 15px;
|
|
95
131
|
position: absolute;
|
|
96
132
|
top: 50%;
|
|
@@ -99,12 +135,14 @@
|
|
|
99
135
|
display: none;
|
|
100
136
|
}
|
|
101
137
|
|
|
102
|
-
.node-wrap-box .content
|
|
138
|
+
.node-wrap-box .content,
|
|
139
|
+
.node-wrap-box-disable .content {
|
|
103
140
|
position: relative;
|
|
104
141
|
padding: 15px;
|
|
105
142
|
}
|
|
106
143
|
|
|
107
|
-
.node-wrap-box .content .placeholder
|
|
144
|
+
.node-wrap-box .content .placeholder,
|
|
145
|
+
.node-wrap-box-disable .content .placeholder {
|
|
108
146
|
color: #999;
|
|
109
147
|
}
|
|
110
148
|
|
|
@@ -418,7 +456,8 @@
|
|
|
418
456
|
text-align: center;
|
|
419
457
|
}
|
|
420
458
|
|
|
421
|
-
.node-wrap-box:after
|
|
459
|
+
.node-wrap-box:after,
|
|
460
|
+
.node-wrap-box-disable:after {
|
|
422
461
|
pointer-events: none;
|
|
423
462
|
content: "";
|
|
424
463
|
position: absolute;
|
|
@@ -492,6 +531,7 @@
|
|
|
492
531
|
.dark .flowlong-designer {
|
|
493
532
|
|
|
494
533
|
.node-wrap-box,
|
|
534
|
+
.node-wrap-box-disable,
|
|
495
535
|
.auto-judge {
|
|
496
536
|
background: #2b2b2b;
|
|
497
537
|
}
|
|
@@ -508,7 +548,8 @@
|
|
|
508
548
|
}
|
|
509
549
|
|
|
510
550
|
.node-wrap-box::before,
|
|
511
|
-
.auto-judge::before
|
|
551
|
+
.auto-judge::before,
|
|
552
|
+
.node-wrap-box-disable::before {
|
|
512
553
|
background-color: var(--el-bg-color);
|
|
513
554
|
}
|
|
514
555
|
|
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useImperativeHandle, forwardRef, useState } from "react";
|
|
2
|
-
import { Button, Drawer } from "antd";
|
|
2
|
+
import { Button, Drawer, Tooltip } from "antd";
|
|
3
3
|
|
|
4
4
|
import ScWorkflow from "./components/ScWorkflow";
|
|
5
5
|
|
|
@@ -7,6 +7,10 @@ import { SelectContext, ISelectHandlerI } from "./components/Selector/SelectCont
|
|
|
7
7
|
import { getInitNodeData } from "./common/flowData";
|
|
8
8
|
|
|
9
9
|
import "./index.less";
|
|
10
|
+
import addImg from "./assets/img/add.png";
|
|
11
|
+
import subImg from "./assets/img/sub.png";
|
|
12
|
+
import reloadImg from "./assets/img/reload.png";
|
|
13
|
+
import checkJsonImg from "./assets/img/check-json.png";
|
|
10
14
|
|
|
11
15
|
/**
|
|
12
16
|
* 复制指定字符串
|
|
@@ -44,7 +48,7 @@ function copy(str) {
|
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
function FlowlongDesigner(props, ref) {
|
|
47
|
-
const { value, flowName, roleListConfig, listConfig, initiatorListConfig } = props;
|
|
51
|
+
const { value, flowName, roleListConfig, listConfig, initiatorListConfig, isShowJson, disable } = props;
|
|
48
52
|
const [drawer, setDrawer] = useState(false);
|
|
49
53
|
const [zoom, setZoom] = useState(1);
|
|
50
54
|
const [data, setData] = useState(Object.keys(value || {}).length > 0 ? value : getInitNodeData({ name: flowName }));
|
|
@@ -117,28 +121,28 @@ function FlowlongDesigner(props, ref) {
|
|
|
117
121
|
},
|
|
118
122
|
}}
|
|
119
123
|
>
|
|
120
|
-
<div className="designer-affix">
|
|
121
|
-
|
|
122
|
-
查看 JSON
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
</Button>
|
|
124
|
+
<div className={isShowJson ? "designer-affix-isShowJson" : "designer-affix"}>
|
|
125
|
+
{isShowJson && (
|
|
126
|
+
<Tooltip title={"查看 JSON"}>
|
|
127
|
+
<img className="action-img" src={checkJsonImg} onClick={() => setDrawer(true)} alt="" />
|
|
128
|
+
</Tooltip>
|
|
129
|
+
)}
|
|
130
|
+
<Tooltip title={"缩小"}>
|
|
131
|
+
<img className="action-img" src={subImg} onClick={() => setZoom((z) => z - 0.1)} alt="" />
|
|
132
|
+
</Tooltip>
|
|
133
|
+
<Tooltip title={"放大"}>
|
|
134
|
+
<img className="action-img" src={addImg} onClick={() => setZoom((z) => z + 0.1)} alt="" />
|
|
135
|
+
</Tooltip>
|
|
136
|
+
<Tooltip title={"重置"}>
|
|
137
|
+
<img className="action-img" src={reloadImg} onClick={onReset} alt="" />
|
|
138
|
+
</Tooltip>
|
|
136
139
|
</div>
|
|
137
140
|
<div className="affix-container" style={{ transformOrigin: "0 0", transform: `scale(${zoom})` }}>
|
|
138
141
|
<ScWorkflow
|
|
139
142
|
className="workflow"
|
|
140
143
|
id="content-to-capture"
|
|
141
144
|
modelValue={data.nodeConfig}
|
|
145
|
+
disable={disable}
|
|
142
146
|
onChange={(val) => {
|
|
143
147
|
setData((d) => {
|
|
144
148
|
d.nodeConfig = val;
|