@hzab/flowlong-designer 0.1.2 → 0.1.3
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 +9 -0
- package/package.json +2 -2
- package/src/components/NodeWrap/Nodes/Branch/index.tsx +12 -3
- package/src/index.less +75 -8
- package/src/index.tsx +9 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hzab/flowlong-designer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "自定义审批流配置组件",
|
|
5
5
|
"main": "src",
|
|
6
6
|
"scripts": {
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"@hzab/data-model": "^1.7.0",
|
|
25
25
|
"@hzab/deep-list": "^0.0.2",
|
|
26
26
|
"@hzab/group-user-selector": "^0.0.4",
|
|
27
|
-
"nanoid": "^3.3.7",
|
|
28
27
|
"@hzab/permissions": "0.1.1",
|
|
29
28
|
"@hzab/webpack-config": "^0.7.1",
|
|
30
29
|
"@types/react": "^17.0.62",
|
|
@@ -35,6 +34,7 @@
|
|
|
35
34
|
"less": "^4.1.3",
|
|
36
35
|
"mobx": "^6.7.0",
|
|
37
36
|
"mobx-react": "^7.6.0",
|
|
37
|
+
"nanoid": "^3.3.7",
|
|
38
38
|
"react": "^17.0.2",
|
|
39
39
|
"react-dom": "^17.0.2",
|
|
40
40
|
"react-router-dom": "^6.14.1",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useRef, useState } from "react";
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
2
|
import { Drawer, Button, Input, Select } from "antd";
|
|
3
3
|
import { LeftOutlined, DeleteOutlined, RightOutlined, EditOutlined } from "@ant-design/icons";
|
|
4
4
|
|
|
@@ -80,17 +80,26 @@ export const Branch = (props) => {
|
|
|
80
80
|
});
|
|
81
81
|
onChange && onChange({ ...nodeConfig });
|
|
82
82
|
}
|
|
83
|
+
|
|
84
|
+
function reData(data, addData) {
|
|
85
|
+
if (!data.childNode) {
|
|
86
|
+
data.childNode = addData;
|
|
87
|
+
} else {
|
|
88
|
+
reData(data.childNode, addData);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
83
92
|
function onTermDel(idx) {
|
|
84
93
|
nodeConfig.conditionNodes?.splice(idx, 1);
|
|
85
94
|
if (nodeConfig.conditionNodes?.length == 1) {
|
|
86
95
|
if (nodeConfig.childNode) {
|
|
87
96
|
if (nodeConfig.conditionNodes[0].childNode) {
|
|
88
|
-
|
|
97
|
+
reData(nodeConfig.conditionNodes[0].childNode, nodeConfig.childNode);
|
|
89
98
|
} else {
|
|
90
99
|
nodeConfig.conditionNodes[0].childNode = nodeConfig.childNode;
|
|
91
100
|
}
|
|
92
101
|
}
|
|
93
|
-
onChange && onChange(
|
|
102
|
+
onChange && onChange(nodeConfig.conditionNodes[0].childNode);
|
|
94
103
|
}
|
|
95
104
|
}
|
|
96
105
|
function toText(nodeConfig, idx) {
|
package/src/index.less
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
.flowlong-designer {
|
|
2
|
-
--el-bg-color: #ffffff;
|
|
2
|
+
--el-bg-color: #ffffff;
|
|
3
|
+
/* 默认白色背景 */
|
|
3
4
|
width: 100%;
|
|
5
|
+
|
|
4
6
|
.designer-affix {
|
|
5
7
|
position: fixed;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
right: 20px;
|
|
9
|
+
bottom: 20px;
|
|
8
10
|
z-index: 9;
|
|
9
11
|
padding: 12px;
|
|
10
12
|
border: 1px solid #999;
|
|
11
13
|
|
|
12
|
-
.action-btn
|
|
14
|
+
.action-btn+.action-btn {
|
|
13
15
|
margin-left: 12px;
|
|
14
16
|
}
|
|
15
17
|
}
|
|
@@ -20,6 +22,7 @@
|
|
|
20
22
|
white-space: pre-wrap;
|
|
21
23
|
}
|
|
22
24
|
}
|
|
25
|
+
|
|
23
26
|
.flowlong-designer .box-scale {
|
|
24
27
|
display: inline-block;
|
|
25
28
|
position: relative;
|
|
@@ -41,6 +44,7 @@
|
|
|
41
44
|
position: relative;
|
|
42
45
|
z-index: 1;
|
|
43
46
|
}
|
|
47
|
+
|
|
44
48
|
.node-wrap-box {
|
|
45
49
|
display: inline-flex;
|
|
46
50
|
flex-direction: column;
|
|
@@ -53,6 +57,7 @@
|
|
|
53
57
|
cursor: pointer;
|
|
54
58
|
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1);
|
|
55
59
|
}
|
|
60
|
+
|
|
56
61
|
.node-wrap-box::before {
|
|
57
62
|
content: "";
|
|
58
63
|
position: absolute;
|
|
@@ -64,9 +69,11 @@
|
|
|
64
69
|
border-width: 8px 6px 4px;
|
|
65
70
|
border-color: rgb(202, 202, 202) transparent transparent;
|
|
66
71
|
}
|
|
72
|
+
|
|
67
73
|
.node-wrap-box.start-node:before {
|
|
68
74
|
content: none;
|
|
69
75
|
}
|
|
76
|
+
|
|
70
77
|
.node-wrap-box .title {
|
|
71
78
|
height: 24px;
|
|
72
79
|
line-height: 24px;
|
|
@@ -78,9 +85,11 @@
|
|
|
78
85
|
display: flex;
|
|
79
86
|
align-items: center;
|
|
80
87
|
}
|
|
88
|
+
|
|
81
89
|
.node-wrap-box .title .icon {
|
|
82
90
|
margin-right: 5px;
|
|
83
91
|
}
|
|
92
|
+
|
|
84
93
|
.node-wrap-box .title .close {
|
|
85
94
|
font-size: 15px;
|
|
86
95
|
position: absolute;
|
|
@@ -89,16 +98,20 @@
|
|
|
89
98
|
right: 10px;
|
|
90
99
|
display: none;
|
|
91
100
|
}
|
|
101
|
+
|
|
92
102
|
.node-wrap-box .content {
|
|
93
103
|
position: relative;
|
|
94
104
|
padding: 15px;
|
|
95
105
|
}
|
|
106
|
+
|
|
96
107
|
.node-wrap-box .content .placeholder {
|
|
97
108
|
color: #999;
|
|
98
109
|
}
|
|
110
|
+
|
|
99
111
|
.node-wrap-box:hover .close {
|
|
100
112
|
display: block;
|
|
101
113
|
}
|
|
114
|
+
|
|
102
115
|
.add-node-btn-box {
|
|
103
116
|
width: 240px;
|
|
104
117
|
display: inline-flex;
|
|
@@ -106,6 +119,7 @@
|
|
|
106
119
|
position: relative;
|
|
107
120
|
z-index: 1;
|
|
108
121
|
}
|
|
122
|
+
|
|
109
123
|
.add-node-btn-box:before {
|
|
110
124
|
content: "";
|
|
111
125
|
position: absolute;
|
|
@@ -119,6 +133,7 @@
|
|
|
119
133
|
height: 100%;
|
|
120
134
|
background-color: rgb(202, 202, 202);
|
|
121
135
|
}
|
|
136
|
+
|
|
122
137
|
.add-node-btn {
|
|
123
138
|
user-select: none;
|
|
124
139
|
// width: 240px;
|
|
@@ -129,8 +144,9 @@
|
|
|
129
144
|
flex-shrink: 0;
|
|
130
145
|
// flex-grow: 1;
|
|
131
146
|
}
|
|
132
|
-
|
|
133
|
-
}
|
|
147
|
+
|
|
148
|
+
.add-node-btn span {}
|
|
149
|
+
|
|
134
150
|
.add-branch {
|
|
135
151
|
justify-content: center;
|
|
136
152
|
padding: 0px 10px;
|
|
@@ -143,11 +159,13 @@
|
|
|
143
159
|
display: inline-flex;
|
|
144
160
|
align-items: center;
|
|
145
161
|
}
|
|
162
|
+
|
|
146
163
|
// branch-start
|
|
147
164
|
.branch-wrap {
|
|
148
165
|
display: inline-flex;
|
|
149
166
|
width: 100%;
|
|
150
167
|
}
|
|
168
|
+
|
|
151
169
|
.branch-box-wrap {
|
|
152
170
|
display: flex;
|
|
153
171
|
flex-flow: column wrap;
|
|
@@ -156,12 +174,14 @@
|
|
|
156
174
|
width: 100%;
|
|
157
175
|
flex-shrink: 0;
|
|
158
176
|
}
|
|
177
|
+
|
|
159
178
|
.col-box {
|
|
160
179
|
display: inline-flex;
|
|
161
180
|
flex-direction: column;
|
|
162
181
|
align-items: center;
|
|
163
182
|
position: relative;
|
|
164
183
|
}
|
|
184
|
+
|
|
165
185
|
.branch-box {
|
|
166
186
|
display: flex;
|
|
167
187
|
overflow: visible;
|
|
@@ -172,6 +192,7 @@
|
|
|
172
192
|
position: relative;
|
|
173
193
|
margin-top: 15px;
|
|
174
194
|
}
|
|
195
|
+
|
|
175
196
|
.branch-box .col-box::before {
|
|
176
197
|
content: "";
|
|
177
198
|
position: absolute;
|
|
@@ -185,11 +206,13 @@
|
|
|
185
206
|
height: 100%;
|
|
186
207
|
background-color: rgb(202, 202, 202);
|
|
187
208
|
}
|
|
209
|
+
|
|
188
210
|
.condition-node {
|
|
189
211
|
display: inline-flex;
|
|
190
212
|
flex-direction: column;
|
|
191
213
|
min-height: 220px;
|
|
192
214
|
}
|
|
215
|
+
|
|
193
216
|
.condition-node-box {
|
|
194
217
|
padding-top: 30px;
|
|
195
218
|
padding-right: 50px;
|
|
@@ -201,6 +224,7 @@
|
|
|
201
224
|
display: inline-flex;
|
|
202
225
|
flex-direction: column;
|
|
203
226
|
}
|
|
227
|
+
|
|
204
228
|
.condition-node-box::before {
|
|
205
229
|
content: "";
|
|
206
230
|
position: absolute;
|
|
@@ -213,6 +237,7 @@
|
|
|
213
237
|
height: 100%;
|
|
214
238
|
background-color: rgb(202, 202, 202);
|
|
215
239
|
}
|
|
240
|
+
|
|
216
241
|
.auto-judge {
|
|
217
242
|
position: relative;
|
|
218
243
|
width: 220px;
|
|
@@ -223,6 +248,7 @@
|
|
|
223
248
|
cursor: pointer;
|
|
224
249
|
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1);
|
|
225
250
|
}
|
|
251
|
+
|
|
226
252
|
.auto-judge::before {
|
|
227
253
|
content: "";
|
|
228
254
|
position: absolute;
|
|
@@ -236,12 +262,15 @@
|
|
|
236
262
|
// background: rgb(239, 239, 239);
|
|
237
263
|
background: #fff;
|
|
238
264
|
}
|
|
265
|
+
|
|
239
266
|
.auto-judge .title {
|
|
240
267
|
line-height: 16px;
|
|
241
268
|
}
|
|
269
|
+
|
|
242
270
|
.auto-judge .title .node-title {
|
|
243
271
|
color: #15bc83;
|
|
244
272
|
}
|
|
273
|
+
|
|
245
274
|
.auto-judge .title .close {
|
|
246
275
|
font-size: 15px;
|
|
247
276
|
position: absolute;
|
|
@@ -250,27 +279,33 @@
|
|
|
250
279
|
color: #999;
|
|
251
280
|
display: none;
|
|
252
281
|
}
|
|
282
|
+
|
|
253
283
|
.auto-judge .title .priority-title {
|
|
254
284
|
position: absolute;
|
|
255
285
|
top: 15px;
|
|
256
286
|
right: 15px;
|
|
257
287
|
color: #999;
|
|
258
288
|
}
|
|
289
|
+
|
|
259
290
|
.auto-judge .content {
|
|
260
291
|
position: relative;
|
|
261
292
|
padding-top: 15px;
|
|
262
293
|
}
|
|
294
|
+
|
|
263
295
|
.auto-judge .content .placeholder {
|
|
264
296
|
color: #999;
|
|
265
297
|
}
|
|
298
|
+
|
|
266
299
|
.auto-judge:hover {
|
|
267
300
|
.close {
|
|
268
301
|
display: block;
|
|
269
302
|
}
|
|
303
|
+
|
|
270
304
|
.priority-title {
|
|
271
305
|
display: none;
|
|
272
306
|
}
|
|
273
307
|
}
|
|
308
|
+
|
|
274
309
|
.top-left-cover-line,
|
|
275
310
|
.top-right-cover-line {
|
|
276
311
|
position: absolute;
|
|
@@ -279,6 +314,7 @@
|
|
|
279
314
|
background-color: #fff;
|
|
280
315
|
top: -2px;
|
|
281
316
|
}
|
|
317
|
+
|
|
282
318
|
.bottom-left-cover-line,
|
|
283
319
|
.bottom-right-cover-line {
|
|
284
320
|
position: absolute;
|
|
@@ -287,26 +323,33 @@
|
|
|
287
323
|
background-color: #fff;
|
|
288
324
|
bottom: -2px;
|
|
289
325
|
}
|
|
326
|
+
|
|
290
327
|
.top-left-cover-line {
|
|
291
328
|
left: -1px;
|
|
292
329
|
}
|
|
330
|
+
|
|
293
331
|
.top-right-cover-line {
|
|
294
332
|
right: -1px;
|
|
295
333
|
}
|
|
334
|
+
|
|
296
335
|
.bottom-left-cover-line {
|
|
297
336
|
left: -1px;
|
|
298
337
|
}
|
|
338
|
+
|
|
299
339
|
.bottom-right-cover-line {
|
|
300
340
|
right: -1px;
|
|
301
341
|
}
|
|
342
|
+
|
|
302
343
|
.auto-judge:hover {
|
|
303
344
|
.sort-left {
|
|
304
345
|
display: flex;
|
|
305
346
|
}
|
|
347
|
+
|
|
306
348
|
.sort-right {
|
|
307
349
|
display: flex;
|
|
308
350
|
}
|
|
309
351
|
}
|
|
352
|
+
|
|
310
353
|
.auto-judge .sort-left {
|
|
311
354
|
position: absolute;
|
|
312
355
|
top: 0;
|
|
@@ -318,6 +361,7 @@
|
|
|
318
361
|
align-items: center;
|
|
319
362
|
flex-direction: column;
|
|
320
363
|
}
|
|
364
|
+
|
|
321
365
|
.auto-judge .sort-right {
|
|
322
366
|
position: absolute;
|
|
323
367
|
top: 0;
|
|
@@ -329,10 +373,12 @@
|
|
|
329
373
|
align-items: center;
|
|
330
374
|
flex-direction: column;
|
|
331
375
|
}
|
|
376
|
+
|
|
332
377
|
.auto-judge .sort-left:hover,
|
|
333
378
|
.auto-judge .sort-right:hover {
|
|
334
379
|
background: #eee;
|
|
335
380
|
}
|
|
381
|
+
|
|
336
382
|
.auto-judge:after {
|
|
337
383
|
pointer-events: none;
|
|
338
384
|
content: "";
|
|
@@ -345,10 +391,12 @@
|
|
|
345
391
|
border-radius: 4px;
|
|
346
392
|
transition: all 0.1s;
|
|
347
393
|
}
|
|
394
|
+
|
|
348
395
|
.auto-judge:hover:after {
|
|
349
396
|
border: 1px solid #3296fa;
|
|
350
397
|
box-shadow: 0 0 6px 0 rgba(50, 150, 250, 0.3);
|
|
351
398
|
}
|
|
399
|
+
|
|
352
400
|
// branch-end
|
|
353
401
|
.end-node {
|
|
354
402
|
border-radius: 50%;
|
|
@@ -356,6 +404,7 @@
|
|
|
356
404
|
color: rgba(25, 31, 37, 0.4);
|
|
357
405
|
text-align: left;
|
|
358
406
|
}
|
|
407
|
+
|
|
359
408
|
.end-node-circle {
|
|
360
409
|
width: 10px;
|
|
361
410
|
height: 10px;
|
|
@@ -363,10 +412,12 @@
|
|
|
363
412
|
border-radius: 50%;
|
|
364
413
|
background: #ccc;
|
|
365
414
|
}
|
|
415
|
+
|
|
366
416
|
.end-node-text {
|
|
367
417
|
margin-top: 5px;
|
|
368
418
|
text-align: center;
|
|
369
419
|
}
|
|
420
|
+
|
|
370
421
|
.node-wrap-box:after {
|
|
371
422
|
pointer-events: none;
|
|
372
423
|
content: "";
|
|
@@ -379,6 +430,7 @@
|
|
|
379
430
|
border-radius: 4px;
|
|
380
431
|
transition: all 0.1s;
|
|
381
432
|
}
|
|
433
|
+
|
|
382
434
|
.node-wrap-box:hover:after {
|
|
383
435
|
border: 1px solid #3296fa;
|
|
384
436
|
box-shadow: 0 0 6px 0 rgba(50, 150, 250, 0.3);
|
|
@@ -389,12 +441,14 @@
|
|
|
389
441
|
margin-top: 15px;
|
|
390
442
|
width: 100%;
|
|
391
443
|
}
|
|
444
|
+
|
|
392
445
|
.add-node-popover-body li {
|
|
393
446
|
display: inline-block;
|
|
394
447
|
width: 80px;
|
|
395
448
|
text-align: center;
|
|
396
449
|
padding: 10px 0;
|
|
397
450
|
}
|
|
451
|
+
|
|
398
452
|
.add-node-popover-body li i {
|
|
399
453
|
border: 1px solid var(--el-border-color-light);
|
|
400
454
|
width: 40px;
|
|
@@ -405,24 +459,30 @@
|
|
|
405
459
|
font-size: 18px;
|
|
406
460
|
cursor: pointer;
|
|
407
461
|
}
|
|
462
|
+
|
|
408
463
|
.add-node-popover-body li i:hover {
|
|
409
464
|
border: 1px solid #3296fa;
|
|
410
465
|
background: #3296fa;
|
|
411
466
|
color: #fff !important;
|
|
412
467
|
}
|
|
468
|
+
|
|
413
469
|
.add-node-popover-body li p {
|
|
414
470
|
font-size: 12px;
|
|
415
471
|
margin-top: 5px;
|
|
416
472
|
}
|
|
473
|
+
|
|
417
474
|
.node-wrap-drawer__title {
|
|
418
475
|
padding-right: 40px;
|
|
419
476
|
}
|
|
477
|
+
|
|
420
478
|
.node-wrap-drawer__title label {
|
|
421
479
|
cursor: pointer;
|
|
422
480
|
}
|
|
481
|
+
|
|
423
482
|
.node-wrap-drawer__title label:hover {
|
|
424
483
|
border-bottom: 1px dashed #409eff;
|
|
425
484
|
}
|
|
485
|
+
|
|
426
486
|
.node-wrap-drawer__title .node-wrap-drawer__title-edit {
|
|
427
487
|
color: #409eff;
|
|
428
488
|
margin-left: 10px;
|
|
@@ -430,29 +490,36 @@
|
|
|
430
490
|
}
|
|
431
491
|
|
|
432
492
|
.dark .flowlong-designer {
|
|
493
|
+
|
|
433
494
|
.node-wrap-box,
|
|
434
495
|
.auto-judge {
|
|
435
496
|
background: #2b2b2b;
|
|
436
497
|
}
|
|
498
|
+
|
|
437
499
|
.col-box {
|
|
438
500
|
background: var(--el-bg-color);
|
|
439
501
|
}
|
|
502
|
+
|
|
440
503
|
.top-left-cover-line,
|
|
441
504
|
.top-right-cover-line,
|
|
442
505
|
.bottom-left-cover-line,
|
|
443
506
|
.bottom-right-cover-line {
|
|
444
507
|
background-color: var(--el-bg-color);
|
|
445
508
|
}
|
|
509
|
+
|
|
446
510
|
.node-wrap-box::before,
|
|
447
511
|
.auto-judge::before {
|
|
448
512
|
background-color: var(--el-bg-color);
|
|
449
513
|
}
|
|
514
|
+
|
|
450
515
|
.branch-box .add-branch {
|
|
451
516
|
background: var(--el-bg-color);
|
|
452
517
|
}
|
|
518
|
+
|
|
453
519
|
.end-node .end-node-text {
|
|
454
520
|
color: #ccc;
|
|
455
521
|
}
|
|
522
|
+
|
|
456
523
|
.auto-judge .sort-left:hover,
|
|
457
524
|
.auto-judge .sort-right:hover {
|
|
458
525
|
background: var(--el-bg-color);
|
|
@@ -460,7 +527,7 @@
|
|
|
460
527
|
}
|
|
461
528
|
|
|
462
529
|
.ant-drawer-footer {
|
|
463
|
-
.ant-btn
|
|
530
|
+
.ant-btn+.ant-btn {
|
|
464
531
|
margin-left: 12px;
|
|
465
532
|
}
|
|
466
|
-
}
|
|
533
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -79,6 +79,12 @@ function FlowlongDesigner(props, ref) {
|
|
|
79
79
|
function onDrawerClose() {
|
|
80
80
|
setDrawer(false);
|
|
81
81
|
}
|
|
82
|
+
/** 重置 */
|
|
83
|
+
const onReset = () => {
|
|
84
|
+
const newData = { ...data };
|
|
85
|
+
newData.nodeConfig.childNode = {};
|
|
86
|
+
setData(newData);
|
|
87
|
+
};
|
|
82
88
|
|
|
83
89
|
return (
|
|
84
90
|
<div className="flowlong-designer">
|
|
@@ -124,6 +130,9 @@ function FlowlongDesigner(props, ref) {
|
|
|
124
130
|
<Button className="action-btn zoom-out-btn" onClick={() => setZoom((z) => z + 0.1)}>
|
|
125
131
|
放大
|
|
126
132
|
</Button>
|
|
133
|
+
<Button className="action-btn zoom-out-btn" onClick={onReset}>
|
|
134
|
+
重置
|
|
135
|
+
</Button>
|
|
127
136
|
</div>
|
|
128
137
|
<div className="affix-container" style={{ transformOrigin: "0 0", transform: `scale(${zoom})` }}>
|
|
129
138
|
<ScWorkflow
|