|
1
|
import { Dom, Graph, Node } from "@antv/x6";
|
|
2
3
4
5
6
7
8
9
|
import {
conveyor,
direction,
one_track,
pallet,
rgv,
stacker,
storage,
|
|
10
11
12
13
14
15
16
|
two_track,
point,
point_left,
point_up,
point_right,
point_down,
charging,
|
|
17
|
hoist,
|
|
18
|
shuttleCar,
|
|
19
20
|
} from "./images";
import { basicPorts, customPorts } from "./ports";
|
|
21
|
|
|
22
23
|
export const SRM = Graph.registerNode("SRM", {
inherit: "image",
|
|
24
25
26
27
|
width: 40,
height: 40,
attrs: {
image: {
|
|
28
|
"xlink:href": stacker,
|
|
29
30
31
|
height: 40,
x: 0,
y: 0,
|
|
32
33
|
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
|
|
34
|
},
|
|
35
|
imagePallet: {
|
|
36
|
"xlink:href": pallet,
|
|
37
38
|
height: 40,
width: 40,
|
|
39
40
41
|
class: "hide-pallet",
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
|
|
42
43
44
|
},
body: {
// stroke: '#5F95FF',
|
|
45
|
stroke: "#FF0000",
|
|
46
|
strokeWidth: 3,
|
|
47
|
fill: "rgba(95,149,255,0.0001)",
|
|
48
49
50
|
// fill: 'rgba(255,0,0,1)',
height: 0,
width: 0,
|
|
51
|
class: "flash-shrink-animation-close",
|
|
52
|
},
|
|
53
|
textCode: {
|
|
54
55
|
class: "animate-text1",
text: "",
|
|
56
|
fontSize: 8,
|
|
57
58
|
fill: "#000000",
stroke: "#000000",
|
|
59
60
|
strokeWidth: 1,
x: 0,
|
|
61
62
|
y: -5,
},
|
|
63
64
65
|
// text: {
// stroke: '#FF0000',
// strokeWidth: 1,
|
|
66
67
68
|
// class: 'animate-text1',
// text: '堆垛机',
// fontSize: 12,
|
|
69
70
71
|
// fill: '#FF0000',
// fillOpacity: 0.8,
// background: {
|
|
72
|
// fill: '#FFFF00',
|
|
73
|
// }
|
|
74
75
|
// }
},
|
|
76
|
markup: [
|
|
77
|
{
|
|
78
79
|
tagName: "image",
selector: "image",
|
|
80
81
|
},
{
|
|
82
83
|
tagName: "image",
selector: "imagePallet",
|
|
84
85
|
},
{
|
|
86
87
|
tagName: "rect",
selector: "body",
|
|
88
|
},
|
|
89
|
{
|
|
90
91
92
93
94
|
tagName: "text",
selector: "textCode",
},
],
});
|
|
95
|
|
|
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
export const Hoist = Graph.registerNode("Hoist", {
inherit: "image",
width: 40,
height: 40,
attrs: {
image: {
"xlink:href": hoist,
height: 40,
x: 0,
y: 0,
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
},
imagePallet: {
"xlink:href": pallet,
height: 40,
width: 40,
class: "hide-pallet",
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
},
body: {
// stroke: '#5F95FF',
stroke: "#FF0000",
strokeWidth: 3,
fill: "rgba(95,149,255,0.0001)",
// fill: 'rgba(255,0,0,1)',
height: 0,
width: 0,
class: "flash-shrink-animation-close",
},
textCode: {
class: "animate-text1",
text: "",
fontSize: 8,
fill: "#000000",
stroke: "#000000",
strokeWidth: 1,
x: 0,
y: -5,
},
},
markup: [
{
tagName: "image",
selector: "image",
},
{
tagName: "image",
selector: "imagePallet",
},
{
tagName: "rect",
selector: "body",
},
{
tagName: "text",
selector: "textCode",
},
],
});
|
|
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
export const ShuttleCar = Graph.registerNode("ShuttleCar", {
inherit: "image",
width: 40,
height: 40,
attrs: {
image: {
"xlink:href": shuttleCar,
height: 40,
x: 0,
y: 0,
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
},
imagePallet: {
"xlink:href": pallet,
height: 40,
width: 40,
class: "hide-pallet",
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
},
body: {
stroke: "#FF0000",
strokeWidth: 3,
fill: "rgba(95,149,255,0.0001)",
height: 0,
width: 0,
class: "flash-shrink-animation-close",
},
textCode: {
class: "animate-text1",
text: "",
fontSize: 8,
fill: "#000000",
stroke: "#000000",
strokeWidth: 1,
x: 5,
y: 20,
},
},
markup: [
{
tagName: "image",
selector: "image",
},
{
tagName: "image",
selector: "imagePallet",
},
{
tagName: "rect",
selector: "body",
},
{
tagName: "text",
selector: "textCode",
},
],
});
|
|
218
219
|
export const RGV = Graph.registerNode("RGV", {
inherit: "image",
|
|
220
221
222
223
|
width: 40,
height: 40,
attrs: {
image: {
|
|
224
|
"xlink:href": rgv,
|
|
225
226
227
|
height: 40,
x: 0,
y: 0,
|
|
228
229
|
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
|
|
230
231
|
},
imagePallet: {
|
|
232
|
"xlink:href": pallet,
|
|
233
234
|
height: 40,
width: 40,
|
|
235
236
237
|
class: "hide-pallet",
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
|
|
238
239
|
},
body: {
|
|
240
|
stroke: "#FF0000",
|
|
241
|
strokeWidth: 3,
|
|
242
|
fill: "rgba(95,149,255,0.0001)",
|
|
243
244
|
height: 0,
width: 0,
|
|
245
|
class: "flash-shrink-animation-close",
|
|
246
|
},
|
|
247
|
textCode: {
|
|
248
249
|
class: "animate-text1",
text: "",
|
|
250
|
fontSize: 8,
|
|
251
252
|
fill: "#000000",
stroke: "#000000",
|
|
253
254
|
strokeWidth: 1,
x: 5,
|
|
255
256
|
y: 20,
},
|
|
257
|
},
|
|
258
|
markup: [
|
|
259
|
{
|
|
260
261
|
tagName: "image",
selector: "image",
|
|
262
263
|
},
{
|
|
264
265
|
tagName: "image",
selector: "imagePallet",
|
|
266
267
|
},
{
|
|
268
269
|
tagName: "rect",
selector: "body",
|
|
270
|
},
|
|
271
|
{
|
|
272
273
274
275
276
|
tagName: "text",
selector: "textCode",
},
],
});
|
|
277
|
|
|
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
|
export const Point = Graph.registerNode("Point", {
inherit: "image",
width: 40,
height: 40,
attrs: {
image: {
"xlink:href": point,
height: 40,
x: 0,
y: 0,
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
},
imageLeft: {
"xlink:href": point_left,
height: 40,
width: 40,
class: "hide-pallet",
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
},
imageUp: {
"xlink:href": point_up,
height: 40,
width: 40,
class: "hide-pallet",
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
},
imageRight: {
"xlink:href": point_right,
height: 40,
width: 40,
class: "hide-pallet",
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
},
imageDown: {
"xlink:href": point_down,
height: 40,
width: 40,
class: "hide-pallet",
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
},
|
|
323
|
body1: {
|
|
324
|
stroke: "#FF0000",
|
|
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
fill: "#FF0000",
strokeWidth: 1,
// fill: "rgba(95,149,255,0.2)",
height: 5,
width: 5,
x: 1,
y: 1,
class: "flash-shrink-animation-close",
},
body2: {
stroke: "#007F19",
fill: "#007F19",
strokeWidth: 1,
// fill: "rgba(95,149,255,0.0001)",
height: 5,
width: 5,
x: 7.5,
y: 0.5,
class: "flash-shrink-animation-close",
},
body3: {
stroke: "#0000FF",
fill: "#0000FF",
strokeWidth: 1,
// fill: "rgba(95,149,255,0.0001)",
height: 5,
width: 5,
x: 14,
y: 0.5,
class: "flash-shrink-animation-close",
},
body4: {
stroke: "#FF9900",
fill: "#FF9900",
strokeWidth: 1,
// fill: "rgba(95,149,255,0.0001)",
height: 5,
width: 5,
x: 20.5,
y: 0.5,
class: "flash-shrink-animation-close",
},
body5: {
stroke: "#4C4C4C",
fill: "#4C4C4C",
strokeWidth: 1,
// fill: "rgba(95,149,255,0.0001)",
height: 5,
width: 5,
x: 27,
y: 0.5,
class: "flash-shrink-animation-close",
},
body6: {
stroke: "#FF00FF",
fill: "#FF00FF",
strokeWidth: 1,
// fill: "rgba(95,149,255,0.0001)",
height: 5,
width: 5,
x: 33.5,
y: 0.5,
|
|
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
|
class: "flash-shrink-animation-close",
},
text: {
class: "animate-text1",
fontSize: 12,
// fill: '#5F95FF',
// fill: '#0000FF',
fill: "#5F95FF",
},
textCode: {
class: "animate-text1",
text: "",
fontSize: 8,
fill: "#000000",
stroke: "#000000",
strokeWidth: 1,
x: 5,
y: 20,
},
},
markup: [
{
tagName: "image",
selector: "image",
},
{
tagName: "image",
selector: "imageLeft",
},
{
tagName: "image",
selector: "imageUp",
},
{
tagName: "image",
selector: "imageRight",
},
{
tagName: "image",
selector: "imageDown",
},
{
tagName: "rect",
|
|
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
|
selector: "body1",
},
{
tagName: "rect",
selector: "body2",
},
{
tagName: "rect",
selector: "body3",
},
{
tagName: "rect",
selector: "body4",
},
{
tagName: "rect",
selector: "body5",
},
{
tagName: "rect",
selector: "body6",
|
|
451
452
453
454
455
456
457
458
459
460
461
462
463
464
|
},
{
tagName: "text",
selector: "text",
},
{
tagName: "text",
selector: "textCode",
},
],
});
export const Station = Graph.registerNode("Station", {
inherit: "image",
|
|
465
466
467
468
|
width: 60,
height: 60,
attrs: {
image: {
|
|
469
|
"xlink:href": conveyor,
|
|
470
471
472
|
height: 60,
x: 0,
y: 0,
|
|
473
474
|
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
|
|
475
|
},
|
|
476
|
imagePallet: {
|
|
477
|
"xlink:href": pallet,
|
|
478
479
|
height: 40,
width: 40,
|
|
480
481
482
|
class: "hide-pallet",
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
|
|
483
|
},
|
|
484
|
body: {
|
|
485
|
stroke: "#FF0000",
|
|
486
|
strokeWidth: 3,
|
|
487
|
fill: "rgba(95,149,255,0.0001)",
|
|
488
489
|
height: 0,
width: 0,
|
|
490
|
class: "flash-shrink-animation-close",
|
|
491
492
|
},
text: {
|
|
493
|
class: "animate-text1",
|
|
494
495
|
fontSize: 12,
// fill: '#5F95FF',
|
|
496
|
// fill: '#0000FF',
|
|
497
|
fill: "#5F95FF",
|
|
498
499
|
},
textCode: {
|
|
500
501
|
class: "animate-text1",
text: "",
|
|
502
|
fontSize: 8,
|
|
503
504
|
fill: "#000000",
stroke: "#000000",
|
|
505
506
|
strokeWidth: 1,
x: 15,
|
|
507
508
|
y: 20,
},
|
|
509
510
511
|
},
markup: [
{
|
|
512
513
|
tagName: "image",
selector: "image",
|
|
514
515
|
},
{
|
|
516
517
|
tagName: "image",
selector: "imagePallet",
|
|
518
519
|
},
{
|
|
520
521
|
tagName: "rect",
selector: "body",
|
|
522
523
|
},
{
|
|
524
525
|
tagName: "rect",
selector: "textBackground",
|
|
526
527
|
},
{
|
|
528
529
|
tagName: "text",
selector: "text",
|
|
530
531
|
},
{
|
|
532
533
534
535
536
|
tagName: "text",
selector: "textCode",
},
],
});
|
|
537
|
|
|
538
539
|
export const Station_D = Graph.registerNode("Station-D", {
inherit: "image",
|
|
540
541
542
543
|
width: 60,
height: 60,
attrs: {
image: {
|
|
544
|
"xlink:href": direction,
|
|
545
546
547
|
height: 60,
x: 0,
y: 0,
|
|
548
549
|
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
|
|
550
|
},
|
|
551
|
imagePallet: {
|
|
552
|
"xlink:href": pallet,
|
|
553
554
|
height: 40,
width: 40,
|
|
555
556
557
|
class: "hide-pallet",
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
|
|
558
|
},
|
|
559
|
body: {
|
|
560
|
stroke: "#FF0000",
|
|
561
|
strokeWidth: 3,
|
|
562
|
fill: "rgba(95,149,255,0.0001)",
|
|
563
564
|
height: 0,
width: 0,
|
|
565
|
class: "flash-shrink-animation-close",
|
|
566
567
|
},
text: {
|
|
568
569
|
class: "animate-text1",
text: "",
|
|
570
571
|
fontSize: 12,
// fill: '#5F95FF',
|
|
572
|
// fill: '#0000FF',
|
|
573
|
fill: "#5F95FF",
|
|
574
575
|
},
textCode: {
|
|
576
577
|
class: "animate-text1",
text: "",
|
|
578
|
fontSize: 8,
|
|
579
580
|
fill: "#000000",
stroke: "#000000",
|
|
581
582
|
strokeWidth: 1,
x: 2,
|
|
583
584
|
y: 20,
},
|
|
585
586
587
|
},
markup: [
{
|
|
588
589
|
tagName: "image",
selector: "image",
|
|
590
591
|
},
{
|
|
592
593
|
tagName: "image",
selector: "imagePallet",
|
|
594
595
|
},
{
|
|
596
597
|
tagName: "rect",
selector: "body",
|
|
598
599
|
},
{
|
|
600
601
|
tagName: "text",
selector: "text",
|
|
602
603
|
},
{
|
|
604
605
606
607
608
|
tagName: "text",
selector: "textCode",
},
],
});
|
|
609
|
|
|
610
611
|
export const Storage = Graph.registerNode("Storage", {
inherit: "image",
|
|
612
613
614
|
width: 60,
height: 60,
attrs: {
|
|
615
|
image: {
|
|
616
|
"xlink:href": storage,
|
|
617
618
619
|
height: 60,
x: 0,
y: 0,
|
|
620
621
|
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
|
|
622
|
},
|
|
623
|
body: {
|
|
624
|
stroke: "#5F95FF",
|
|
625
|
strokeWidth: 1,
|
|
626
|
fill: "rgba(95,149,255,0.05)",
|
|
627
|
height: 40,
|
|
628
|
width: 40,
|
|
629
630
|
},
text: {
|
|
631
632
|
class: "animate-text1",
text: "1",
|
|
633
|
fontSize: 12,
|
|
634
|
fill: "#5F95FF",
|
|
635
|
// fill: '#0000FF',
|
|
636
|
},
|
|
637
638
639
|
},
markup: [
{
|
|
640
641
|
tagName: "image",
selector: "image",
|
|
642
|
},
|
|
643
|
{
|
|
644
645
|
tagName: "rect",
selector: "body",
|
|
646
|
},
|
|
647
|
{
|
|
648
649
650
651
652
|
tagName: "text",
selector: "text",
},
],
});
|
|
653
|
|
|
654
655
|
export const Charging = Graph.registerNode("Charging", {
inherit: "image",
|
|
656
657
658
659
|
width: 40,
height: 40,
attrs: {
image: {
|
|
660
|
"xlink:href": charging,
|
|
661
662
663
|
height: 40,
x: 0,
y: 0,
|
|
664
665
666
|
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
},
|
|
667
668
669
|
},
markup: [
{
|
|
670
671
672
673
674
|
tagName: "image",
selector: "image",
},
],
});
|
|
675
|
|
|
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
|
export const Pallet = Graph.registerNode("Pallet", {
inherit: "image",
width: 40,
height: 40,
attrs: {
image: {
"xlink:href": pallet,
height: 40,
x: 0,
y: 0,
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
},
},
markup: [
{
tagName: "image",
selector: "image",
},
],
});
|
|
698
699
|
export const OneTrack = Graph.registerNode("OneTrack", {
inherit: "image",
|
|
700
701
702
703
|
width: 40,
height: 40,
attrs: {
image: {
|
|
704
|
"xlink:href": one_track,
|
|
705
706
707
|
height: 40,
x: 0,
y: 0,
|
|
708
709
710
|
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
},
|
|
711
712
713
|
},
markup: [
{
|
|
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
|
tagName: "image",
selector: "image",
},
],
});
export const TwoTrack = Graph.registerNode("TwoTrack", {
inherit: "image",
width: 40,
height: 40,
attrs: {
image: {
"xlink:href": two_track,
height: 40,
x: 0,
y: 0,
preserveAspectRatio: "none",
"vector-effect": "non-scaling-stroke",
},
},
markup: [
{
tagName: "image",
selector: "image",
},
],
});
|
|
741
|
|
|
742
743
744
745
746
747
|
export const Text = Graph.registerNode("Text", {
inherit: "rect",
width: 200,
height: 60,
attrs: {
body: {
|
|
748
749
750
|
// stroke: "#5F95FF",
strokeWidth: 0,
fill: "rgba(95,149,255,0)",
|
|
751
752
|
},
text: {
|
|
753
|
class: "animate-text2",
|
|
754
|
text: "44444",
|
|
755
|
fontSize: 22,
|
|
756
757
758
|
fill: "#5F95FF",
},
// text2: {
|
|
759
760
761
762
|
// class: "animate-text2",
// text: "AntV X6",
// fontSize: 32,
// },
|
|
763
764
765
766
767
768
769
770
771
772
773
|
},
markup: [
{
tagName: "rect",
selector: "body",
},
{
tagName: "text",
selector: "text",
},
// {
|
|
774
775
776
|
// tagName: "text",
// selector: "text2",
// },
|
|
777
778
779
|
],
});
|
|
780
|
// 基础节点
|
|
781
782
|
export const FlowChartRect = Graph.registerNode("flow-chart-rect", {
inherit: "rect",
|
|
783
784
785
786
|
width: 80,
height: 42,
attrs: {
body: {
|
|
787
|
stroke: "#5F95FF",
|
|
788
|
strokeWidth: 1,
|
|
789
|
fill: "#ffffff",
|
|
790
791
|
},
fo: {
|
|
792
793
|
refWidth: "100%",
refHeight: "100%",
|
|
794
795
796
797
|
},
foBody: {
xmlns: Dom.ns.xhtml,
style: {
|
|
798
799
800
801
802
803
804
805
806
807
|
width: "100%",
height: "100%",
display: "flex",
justifyContent: "center",
alignItems: "center",
},
},
"edit-text": {
contenteditable: "true",
class: "x6-edit-text",
|
|
808
|
style: {
|
|
809
810
|
width: "100%",
textAlign: "center",
|
|
811
|
fontSize: 12,
|
|
812
813
|
color: "rgba(0,0,0,0.85)",
},
|
|
814
815
816
|
},
text: {
fontSize: 12,
|
|
817
818
|
fill: "#080808",
},
|
|
819
820
821
|
},
markup: [
{
|
|
822
823
|
tagName: "rect",
selector: "body",
|
|
824
825
|
},
{
|
|
826
827
828
|
tagName: "text",
selector: "text",
},
|
|
829
|
// 不让双击编辑文本
|
|
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
|
// {
// tagName: 'foreignObject',
// selector: 'fo',
// children: [
// {
// ns: Dom.ns.xhtml,
// tagName: 'body',
// selector: 'foBody',
// children: [
// {
// tagName: 'div',
// selector: 'edit-text'
// }
// ]
// }
// ]
// }
],
|
|
848
849
|
ports: { ...basicPorts },
});
|
|
850
|
// 组合节点
|
|
851
852
|
export const FlowChartImageRect = Graph.registerNode("flow-chart-image-rect", {
inherit: "rect",
|
|
853
854
855
856
|
width: 200,
height: 60,
attrs: {
body: {
|
|
857
|
stroke: "#5F95FF",
|
|
858
|
strokeWidth: 1,
|
|
859
|
fill: "rgba(95,149,255,0.05)",
|
|
860
861
|
},
image: {
|
|
862
863
|
"xlink:href":
"https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png",
|
|
864
865
866
|
width: 16,
height: 16,
x: 12,
|
|
867
|
y: 12,
|
|
868
869
|
},
title: {
|
|
870
|
text: "Node",
|
|
871
872
|
refX: 40,
refY: 14,
|
|
873
|
fill: "rgba(0,0,0,0.85)",
|
|
874
|
fontSize: 12,
|
|
875
|
"text-anchor": "start",
|
|
876
877
|
},
text: {
|
|
878
|
text: "this is content text",
|
|
879
880
881
|
refX: 40,
refY: 38,
fontSize: 12,
|
|
882
883
884
|
fill: "rgba(0,0,0,0.6)",
"text-anchor": "start",
},
|
|
885
886
887
|
},
markup: [
{
|
|
888
889
|
tagName: "rect",
selector: "body",
|
|
890
891
|
},
{
|
|
892
893
|
tagName: "image",
selector: "image",
|
|
894
895
|
},
{
|
|
896
897
|
tagName: "text",
selector: "title",
|
|
898
899
|
},
{
|
|
900
901
902
|
tagName: "text",
selector: "text",
},
|
|
903
|
],
|
|
904
905
|
ports: { ...basicPorts },
});
|
|
906
|
|
|
907
908
|
export const FlowChartTitleRect = Graph.registerNode("flow-chart-title-rect", {
inherit: "rect",
|
|
909
910
911
912
|
width: 200,
height: 68,
attrs: {
body: {
|
|
913
|
stroke: "#5F95FF",
|
|
914
|
strokeWidth: 1,
|
|
915
|
fill: "rgba(95,149,255,0.05)",
|
|
916
917
|
},
head: {
|
|
918
919
|
refWidth: "100%",
stroke: "transparent",
|
|
920
|
height: 28,
|
|
921
|
fill: "rgb(95,149,255)",
|
|
922
923
|
},
image: {
|
|
924
925
|
"xlink:href":
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAVCAYAAAAAY20CAAAJD0lEQVRIiV1XWXMU5xU9vffMSCPNjNCMVnbEIgG2cQpTIcaRUxW/UVR+Q/KYn4D4EY6f8563+MkJMTaJi0AEEhUsoRgZJKQZSWiZRTO9d+rcnh4raWhNL9937z3nrq188cUfoKkadF2HqqqIEQGxAiiQ+4P9faytrcee50FVFcRxjDCKMDg4iMmJiU903XgQhqE85z/wb/KDOI4QBmFXnAooMaAoFA3+VRReyQ65VhWVr7G910B9dxczzceIfQdr47MojB2HqcSIohiKyrXJXl1VNaiaioNGHe1WGxG1d403DAMrL19icWFBFGuahiiKEASBAAh+Ft4tlUoPaDzf6YYOTVERUokCmKYJzVCJRAz0g0CAUrVpGvIs8H2BzYOGaYaB129ef/z80cMHJ6cITsP8/Dyu54vTY+WhF47jgoRFSkKArqlq/uXySv3fL17AabehaCriKERA5uIQnudD7RpH1miAZVloNlv48s9f3lI1NbYzNgzdEKMymYy8V1X1wdDQ0NzU1PlvTMOE53sCMjFURafjCBDKFe+RBMuCbVkkbo5GKqEPx4uxt3+AMIx/a9v272lXkBJBAI7rjb9YWsLrH1dhWaZ4wHd9hFEIRYlh2VnkB/LQtUQRD0PX4XsBaltbcF1HPJWETgzLtNDf1wdN12/Z2b4Hvh9BUSK4jov3P/hAyWZzCAIfC8+e3vU8b+76R9cVTTeAOILv+x/7vj/nev4t1cqg3amj2fbRcQfxfHHhd+urK38sVypPR0dHJRIIUvd8rxIFQYLcshC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fj41P3Mrm+nr7k/ziZ2ZKTNxLVILhDMRvknQi4HpOtCwKHN8FDHMg6Byitt6BnbVlwdHQOWrf0aP3CXhkTeqVLuReBeHHS6FQvLdT3bi1u12VhtcjqTuKpMBFd4+gLpm972XKZqjybwKq1Wrhv83+VyBYZY9VAAAAAElFTkSuQmCC",
|
|
926
927
|
height: 16,
x: 6,
|
|
928
|
y: 6,
|
|
929
930
|
},
title: {
|
|
931
|
text: "Node",
|
|
932
933
|
refX: 30,
refY: 9,
|
|
934
|
fill: "#ffffff",
|
|
935
|
fontSize: 12,
|
|
936
|
"text-anchor": "start",
|
|
937
938
|
},
text: {
|
|
939
|
text: "this is content text",
|
|
940
941
942
|
refX: 8,
refY: 45,
fontSize: 12,
|
|
943
944
945
|
fill: "rgba(0,0,0,0.6)",
"text-anchor": "start",
},
|
|
946
947
948
|
},
markup: [
{
|
|
949
950
|
tagName: "rect",
selector: "body",
|
|
951
952
|
},
{
|
|
953
954
|
tagName: "rect",
selector: "head",
|
|
955
956
|
},
{
|
|
957
958
|
tagName: "image",
selector: "image",
|
|
959
960
|
},
{
|
|
961
962
|
tagName: "text",
selector: "title",
|
|
963
964
|
},
{
|
|
965
966
967
|
tagName: "text",
selector: "text",
},
|
|
968
|
],
|
|
969
970
|
ports: { ...basicPorts },
});
|
|
971
|
|
|
972
|
export const FlowChartAnimateText = Graph.registerNode(
|
|
973
|
"flow-chart-animate-text",
|
|
974
|
{
|
|
975
|
inherit: "rect",
|
|
976
977
978
979
|
width: 200,
height: 60,
attrs: {
body: {
|
|
980
|
stroke: "#5F95FF",
|
|
981
|
strokeWidth: 1,
|
|
982
|
fill: "rgba(95,149,255,0.05)",
|
|
983
984
|
},
text1: {
|
|
985
986
|
class: "animate-text1",
text: "|||||||||||||",
|
|
987
|
fontSize: 50,
|
|
988
989
|
fill: "#5F95FF",
},
|
|
990
991
992
993
994
995
996
997
|
// text2: {
// class: 'animate-text2',
// text: 'AntV X6',
// fontSize: 32
// }
},
markup: [
{
|
|
998
999
|
tagName: "rect",
selector: "body",
|
|
1000
1001
|
},
{
|
|
1002
1003
1004
|
tagName: "text",
selector: "text1",
},
|
|
1005
1006
1007
1008
|
// {
// tagName: 'text',
// selector: 'text2'
// }
|
|
1009
|
],
|
|
1010
|
}
|
|
1011
|
);
|
|
1012
1013
|
// 自定义 系统设计图
|
|
1014
|
export const FlowChartImageRectCustom = Graph.registerNode(
|
|
1015
|
"flow-chart-image-rect-custom",
|
|
1016
|
{
|
|
1017
|
inherit: "rect",
|
|
1018
1019
1020
1021
|
width: 80,
height: 80,
markup: [
{
|
|
1022
1023
|
tagName: "rect",
selector: "body",
|
|
1024
1025
|
},
{
|
|
1026
|
tagName: "image",
|
|
1027
1028
|
},
{
|
|
1029
1030
1031
|
tagName: "text",
selector: "label",
},
|
|
1032
1033
1034
1035
|
],
attrs: {
body: {
// 节点线的颜色
|
|
1036
|
stroke: "transparent",
|
|
1037
|
// 背景填充色
|
|
1038
|
fill: "transparent",
|
|
1039
1040
1041
1042
1043
1044
|
},
// 自定义图片
image: {
width: 60,
height: 60,
refX: 0,
|
|
1045
|
refY: 0,
|
|
1046
1047
1048
1049
|
},
label: {
refX: 3,
refY: 2,
|
|
1050
1051
|
textAnchor: "left",
textVerticalAnchor: "top",
|
|
1052
|
fontSize: 12,
|
|
1053
|
fill: "black",
|
|
1054
|
},
|
|
1055
1056
1057
|
"edit-text": {
contenteditable: "true",
class: "x6-edit-text",
|
|
1058
|
style: {
|
|
1059
1060
|
width: "100%",
textAlign: "center",
|
|
1061
|
fontSize: 12,
|
|
1062
1063
|
color: "rgba(0,0,0,0.85)",
},
|
|
1064
1065
|
},
text: {
|
|
1066
|
fontSize: 12,
|
|
1067
1068
|
fill: "#080808",
},
|
|
1069
|
},
|
|
1070
|
ports: { ...customPorts },
|
|
1071
|
}
|
|
1072
|
);
|
|
1073
1074
1075
|
// 节点组
export class NodeGroup extends Node {
|
|
1076
|
collapsed = true;
|
|
1077
1078
|
postprocess() {
|
|
1079
|
this.toggleCollapse(true);
|
|
1080
1081
1082
|
}
isCollapsed() {
|
|
1083
|
return this.collapsed;
|
|
1084
1085
1086
|
}
toggleCollapse(collapsed) {
|
|
1087
|
const target = collapsed == null ? !this.collapsed : collapsed;
|
|
1088
|
if (target) {
|
|
1089
1090
|
this.attr("buttonSign", { d: "M 1 5 9 5 M 5 1 5 9" });
this.resize(200, 40);
|
|
1091
|
} else {
|
|
1092
1093
|
this.attr("buttonSign", { d: "M 2 5 8 5" });
this.resize(240, 240);
|
|
1094
|
}
|
|
1095
|
this.collapsed = target;
|
|
1096
1097
1098
1099
|
}
}
NodeGroup.config({
|
|
1100
|
shape: "rect",
|
|
1101
1102
|
markup: [
{
|
|
1103
1104
|
tagName: "rect",
selector: "body",
|
|
1105
1106
|
},
{
|
|
1107
1108
|
tagName: "image",
selector: "image",
|
|
1109
1110
|
},
{
|
|
1111
1112
|
tagName: "text",
selector: "text",
|
|
1113
1114
|
},
{
|
|
1115
1116
|
tagName: "g",
selector: "buttonGroup",
|
|
1117
1118
|
children: [
{
|
|
1119
1120
|
tagName: "rect",
selector: "button",
|
|
1121
|
attrs: {
|
|
1122
1123
|
"pointer-events": "visiblePainted",
},
|
|
1124
1125
|
},
{
|
|
1126
1127
|
tagName: "path",
selector: "buttonSign",
|
|
1128
|
attrs: {
|
|
1129
1130
1131
1132
1133
1134
|
fill: "none",
"pointer-events": "none",
},
},
],
},
|
|
1135
1136
1137
|
],
attrs: {
body: {
|
|
1138
1139
|
refWidth: "100%",
refHeight: "100%",
|
|
1140
|
strokeWidth: 1,
|
|
1141
1142
|
fill: "rgba(95,149,255,0.05)",
stroke: "#5F95FF",
|
|
1143
1144
|
},
image: {
|
|
1145
1146
|
"xlink:href":
"https://gw.alipayobjects.com/mdn/rms_0b51a4/afts/img/A*X4e0TrDsEiIAAAAAAAAAAAAAARQnAQ",
|
|
1147
1148
1149
|
width: 16,
height: 16,
x: 8,
|
|
1150
|
y: 12,
|
|
1151
1152
1153
|
},
text: {
fontSize: 12,
|
|
1154
|
fill: "rgba(0,0,0,0.85)",
|
|
1155
|
refX: 30,
|
|
1156
|
refY: 15,
|
|
1157
1158
|
},
buttonGroup: {
|
|
1159
|
refX: "100%",
|
|
1160
|
refX2: -25,
|
|
1161
|
refY: 13,
|
|
1162
1163
1164
1165
1166
1167
|
},
button: {
height: 14,
width: 16,
rx: 2,
ry: 2,
|
|
1168
1169
1170
1171
|
fill: "#f5f5f5",
stroke: "#ccc",
cursor: "pointer",
event: "node:collapse",
|
|
1172
1173
1174
1175
|
},
buttonSign: {
refX: 3,
refY: 2,
|
|
1176
1177
1178
1179
|
stroke: "#808080",
},
},
});
|
|
1180
|
|
|
1181
|
Graph.registerNode("groupNode", NodeGroup);
|