bpmn-js 14.2.0 → 15.0.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/dist/bpmn-modeler.development.js +22264 -21402
- package/dist/bpmn-modeler.production.min.js +40 -40
- package/dist/bpmn-navigated-viewer.development.js +1519 -1126
- package/dist/bpmn-navigated-viewer.production.min.js +5 -5
- package/dist/bpmn-viewer.development.js +1519 -1126
- package/dist/bpmn-viewer.production.min.js +5 -5
- package/lib/Modeler.js +2 -0
- package/lib/draw/BpmnRenderUtil.d.ts +49 -3
- package/lib/draw/BpmnRenderUtil.js +53 -6
- package/lib/draw/BpmnRenderer.d.ts +50 -62
- package/lib/draw/BpmnRenderer.js +1294 -973
- package/lib/features/append-preview/AppendPreview.d.ts +36 -0
- package/lib/features/append-preview/AppendPreview.js +109 -0
- package/lib/features/append-preview/index.d.ts +16 -0
- package/lib/features/append-preview/index.js +15 -0
- package/lib/features/context-pad/ContextPadProvider.d.ts +14 -1
- package/lib/features/context-pad/ContextPadProvider.js +26 -7
- package/lib/features/context-pad/index.js +2 -0
- package/lib/features/modeling/index.d.ts +2 -2
- package/lib/features/outline/OutlineProvider.d.ts +34 -0
- package/lib/features/outline/OutlineProvider.js +163 -0
- package/lib/features/outline/OutlineUtil.d.ts +18 -0
- package/lib/features/outline/OutlineUtil.js +32 -0
- package/lib/features/outline/index.d.ts +7 -0
- package/lib/features/outline/index.js +10 -0
- package/package.json +3 -3
package/lib/draw/BpmnRenderer.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import inherits from 'inherits-browser';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
isObject,
|
|
5
4
|
assign,
|
|
6
|
-
forEach
|
|
5
|
+
forEach,
|
|
6
|
+
isObject
|
|
7
7
|
} from 'min-dash';
|
|
8
8
|
|
|
9
9
|
import BaseRenderer from 'diagram-js/lib/draw/BaseRenderer';
|
|
@@ -17,7 +17,9 @@ import {
|
|
|
17
17
|
getLabel
|
|
18
18
|
} from '../util/LabelUtil';
|
|
19
19
|
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
is
|
|
22
|
+
} from '../util/ModelUtil';
|
|
21
23
|
|
|
22
24
|
import {
|
|
23
25
|
createLine
|
|
@@ -27,6 +29,7 @@ import {
|
|
|
27
29
|
isTypedEvent,
|
|
28
30
|
isThrowEvent,
|
|
29
31
|
isCollection,
|
|
32
|
+
getBounds,
|
|
30
33
|
getDi,
|
|
31
34
|
getSemantic,
|
|
32
35
|
getCirclePath,
|
|
@@ -35,7 +38,9 @@ import {
|
|
|
35
38
|
getRectPath,
|
|
36
39
|
getFillColor,
|
|
37
40
|
getStrokeColor,
|
|
38
|
-
getLabelColor
|
|
41
|
+
getLabelColor,
|
|
42
|
+
getHeight,
|
|
43
|
+
getWidth
|
|
39
44
|
} from './BpmnRenderUtil';
|
|
40
45
|
|
|
41
46
|
import {
|
|
@@ -59,15 +64,16 @@ import Ids from 'ids';
|
|
|
59
64
|
|
|
60
65
|
import { black } from './BpmnRenderUtil';
|
|
61
66
|
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
var TASK_BORDER_RADIUS = 10;
|
|
65
|
-
var INNER_OUTER_DIST = 3;
|
|
67
|
+
var rendererIds = new Ids();
|
|
66
68
|
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
+
var ELEMENT_LABEL_DISTANCE = 10,
|
|
70
|
+
INNER_OUTER_DIST = 3,
|
|
71
|
+
PARTICIPANT_STROKE_WIDTH = 1.5,
|
|
72
|
+
TASK_BORDER_RADIUS = 10;
|
|
69
73
|
|
|
70
|
-
var
|
|
74
|
+
var DEFAULT_OPACITY = 0.95,
|
|
75
|
+
FULL_OPACITY = 1,
|
|
76
|
+
LOW_OPACITY = 0.25;
|
|
71
77
|
|
|
72
78
|
/**
|
|
73
79
|
* @typedef { Partial<{
|
|
@@ -75,6 +81,13 @@ var ELEMENT_LABEL_DISTANCE = 10;
|
|
|
75
81
|
* defaultStrokeColor: string,
|
|
76
82
|
* defaultLabelColor: string
|
|
77
83
|
* }> } BpmnRendererConfig
|
|
84
|
+
*
|
|
85
|
+
* @typedef { Partial<{
|
|
86
|
+
* fill: string,
|
|
87
|
+
* stroke: string,
|
|
88
|
+
* width: string,
|
|
89
|
+
* height: string
|
|
90
|
+
* }> } Attrs
|
|
78
91
|
*/
|
|
79
92
|
|
|
80
93
|
/**
|
|
@@ -102,7 +115,7 @@ export default function BpmnRenderer(
|
|
|
102
115
|
defaultStrokeColor = config && config.defaultStrokeColor,
|
|
103
116
|
defaultLabelColor = config && config.defaultLabelColor;
|
|
104
117
|
|
|
105
|
-
var rendererId =
|
|
118
|
+
var rendererId = rendererIds.next();
|
|
106
119
|
|
|
107
120
|
var markers = {};
|
|
108
121
|
|
|
@@ -198,7 +211,7 @@ export default function BpmnRenderer(
|
|
|
198
211
|
cy: 6,
|
|
199
212
|
r: 3.5,
|
|
200
213
|
...shapeStyle({
|
|
201
|
-
fill
|
|
214
|
+
fill,
|
|
202
215
|
stroke: stroke,
|
|
203
216
|
strokeWidth: 1,
|
|
204
217
|
|
|
@@ -218,7 +231,7 @@ export default function BpmnRenderer(
|
|
|
218
231
|
var messageflowEnd = svgCreate('path', {
|
|
219
232
|
d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
|
|
220
233
|
...shapeStyle({
|
|
221
|
-
fill
|
|
234
|
+
fill,
|
|
222
235
|
stroke: stroke,
|
|
223
236
|
strokeWidth: 1,
|
|
224
237
|
|
|
@@ -239,7 +252,7 @@ export default function BpmnRenderer(
|
|
|
239
252
|
d: 'M 11 5 L 1 10 L 11 15',
|
|
240
253
|
...lineStyle({
|
|
241
254
|
fill: 'none',
|
|
242
|
-
stroke
|
|
255
|
+
stroke,
|
|
243
256
|
strokeWidth: 1.5,
|
|
244
257
|
|
|
245
258
|
// fix for safari / chrome / firefox bug not correctly
|
|
@@ -260,7 +273,7 @@ export default function BpmnRenderer(
|
|
|
260
273
|
d: 'M 1 5 L 11 10 L 1 15',
|
|
261
274
|
...lineStyle({
|
|
262
275
|
fill: 'none',
|
|
263
|
-
stroke
|
|
276
|
+
stroke,
|
|
264
277
|
strokeWidth: 1.5,
|
|
265
278
|
|
|
266
279
|
// fix for safari / chrome / firefox bug not correctly
|
|
@@ -280,7 +293,7 @@ export default function BpmnRenderer(
|
|
|
280
293
|
var conditionalFlowMarker = svgCreate('path', {
|
|
281
294
|
d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
|
|
282
295
|
...shapeStyle({
|
|
283
|
-
fill
|
|
296
|
+
fill,
|
|
284
297
|
stroke: stroke
|
|
285
298
|
})
|
|
286
299
|
});
|
|
@@ -308,7 +321,7 @@ export default function BpmnRenderer(
|
|
|
308
321
|
}
|
|
309
322
|
}
|
|
310
323
|
|
|
311
|
-
function drawCircle(parentGfx, width, height, offset, attrs) {
|
|
324
|
+
function drawCircle(parentGfx, width, height, offset, attrs = {}) {
|
|
312
325
|
|
|
313
326
|
if (isObject(offset)) {
|
|
314
327
|
attrs = offset;
|
|
@@ -319,10 +332,6 @@ export default function BpmnRenderer(
|
|
|
319
332
|
|
|
320
333
|
attrs = shapeStyle(attrs);
|
|
321
334
|
|
|
322
|
-
if (attrs.fill === 'none') {
|
|
323
|
-
delete attrs.fillOpacity;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
335
|
var cx = width / 2,
|
|
327
336
|
cy = height / 2;
|
|
328
337
|
|
|
@@ -422,7 +431,6 @@ export default function BpmnRenderer(
|
|
|
422
431
|
}
|
|
423
432
|
|
|
424
433
|
function drawPath(parentGfx, d, attrs) {
|
|
425
|
-
|
|
426
434
|
attrs = lineStyle(attrs);
|
|
427
435
|
|
|
428
436
|
var path = svgCreate('path', {
|
|
@@ -444,171 +452,13 @@ export default function BpmnRenderer(
|
|
|
444
452
|
}
|
|
445
453
|
|
|
446
454
|
function as(type) {
|
|
447
|
-
return function(parentGfx, element,
|
|
448
|
-
return renderer(type)(parentGfx, element,
|
|
449
|
-
};
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
function renderEventContent(element, parentGfx) {
|
|
453
|
-
|
|
454
|
-
var event = getSemantic(element);
|
|
455
|
-
var isThrowing = isThrowEvent(event);
|
|
456
|
-
|
|
457
|
-
if (event.eventDefinitions && event.eventDefinitions.length > 1) {
|
|
458
|
-
if (event.parallelMultiple) {
|
|
459
|
-
return renderer('bpmn:ParallelMultipleEventDefinition')(parentGfx, element, isThrowing);
|
|
460
|
-
}
|
|
461
|
-
else {
|
|
462
|
-
return renderer('bpmn:MultipleEventDefinition')(parentGfx, element, isThrowing);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
if (isTypedEvent(event, 'bpmn:MessageEventDefinition')) {
|
|
467
|
-
return renderer('bpmn:MessageEventDefinition')(parentGfx, element, isThrowing);
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
if (isTypedEvent(event, 'bpmn:TimerEventDefinition')) {
|
|
471
|
-
return renderer('bpmn:TimerEventDefinition')(parentGfx, element, isThrowing);
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
if (isTypedEvent(event, 'bpmn:ConditionalEventDefinition')) {
|
|
475
|
-
return renderer('bpmn:ConditionalEventDefinition')(parentGfx, element);
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
if (isTypedEvent(event, 'bpmn:SignalEventDefinition')) {
|
|
479
|
-
return renderer('bpmn:SignalEventDefinition')(parentGfx, element, isThrowing);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
if (isTypedEvent(event, 'bpmn:EscalationEventDefinition')) {
|
|
483
|
-
return renderer('bpmn:EscalationEventDefinition')(parentGfx, element, isThrowing);
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
if (isTypedEvent(event, 'bpmn:LinkEventDefinition')) {
|
|
487
|
-
return renderer('bpmn:LinkEventDefinition')(parentGfx, element, isThrowing);
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
if (isTypedEvent(event, 'bpmn:ErrorEventDefinition')) {
|
|
491
|
-
return renderer('bpmn:ErrorEventDefinition')(parentGfx, element, isThrowing);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
if (isTypedEvent(event, 'bpmn:CancelEventDefinition')) {
|
|
495
|
-
return renderer('bpmn:CancelEventDefinition')(parentGfx, element, isThrowing);
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
if (isTypedEvent(event, 'bpmn:CompensateEventDefinition')) {
|
|
499
|
-
return renderer('bpmn:CompensateEventDefinition')(parentGfx, element, isThrowing);
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
if (isTypedEvent(event, 'bpmn:TerminateEventDefinition')) {
|
|
503
|
-
return renderer('bpmn:TerminateEventDefinition')(parentGfx, element, isThrowing);
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
return null;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
function renderLabel(parentGfx, label, options) {
|
|
510
|
-
|
|
511
|
-
options = assign({
|
|
512
|
-
size: {
|
|
513
|
-
width: 100
|
|
514
|
-
}
|
|
515
|
-
}, options);
|
|
516
|
-
|
|
517
|
-
var text = textRenderer.createText(label || '', options);
|
|
518
|
-
|
|
519
|
-
svgClasses(text).add('djs-label');
|
|
520
|
-
|
|
521
|
-
svgAppend(parentGfx, text);
|
|
522
|
-
|
|
523
|
-
return text;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
function renderEmbeddedLabel(parentGfx, element, align) {
|
|
527
|
-
var semantic = getSemantic(element);
|
|
528
|
-
|
|
529
|
-
return renderLabel(parentGfx, semantic.name, {
|
|
530
|
-
box: element,
|
|
531
|
-
align: align,
|
|
532
|
-
padding: 7,
|
|
533
|
-
style: {
|
|
534
|
-
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
|
|
535
|
-
}
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
function renderExternalLabel(parentGfx, element) {
|
|
540
|
-
|
|
541
|
-
var box = {
|
|
542
|
-
width: 90,
|
|
543
|
-
height: 30,
|
|
544
|
-
x: element.width / 2 + element.x,
|
|
545
|
-
y: element.height / 2 + element.y
|
|
455
|
+
return function(parentGfx, element, attrs) {
|
|
456
|
+
return renderer(type)(parentGfx, element, attrs);
|
|
546
457
|
};
|
|
547
|
-
|
|
548
|
-
return renderLabel(parentGfx, getLabel(element), {
|
|
549
|
-
box: box,
|
|
550
|
-
fitBox: true,
|
|
551
|
-
style: assign(
|
|
552
|
-
{},
|
|
553
|
-
textRenderer.getExternalStyle(),
|
|
554
|
-
{
|
|
555
|
-
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
|
|
556
|
-
}
|
|
557
|
-
)
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
function renderLaneLabel(parentGfx, text, element) {
|
|
562
|
-
var textBox = renderLabel(parentGfx, text, {
|
|
563
|
-
box: {
|
|
564
|
-
height: 30,
|
|
565
|
-
width: element.height
|
|
566
|
-
},
|
|
567
|
-
align: 'center-middle',
|
|
568
|
-
style: {
|
|
569
|
-
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
|
|
570
|
-
}
|
|
571
|
-
});
|
|
572
|
-
|
|
573
|
-
var top = -1 * element.height;
|
|
574
|
-
|
|
575
|
-
transform(textBox, 0, -top, 270);
|
|
576
458
|
}
|
|
577
459
|
|
|
578
|
-
var
|
|
579
|
-
'bpmn:
|
|
580
|
-
|
|
581
|
-
if (!('fillOpacity' in attrs)) {
|
|
582
|
-
attrs.fillOpacity = DEFAULT_FILL_OPACITY;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
return drawCircle(parentGfx, element.width, element.height, attrs);
|
|
586
|
-
},
|
|
587
|
-
'bpmn:StartEvent': function(parentGfx, element, options) {
|
|
588
|
-
var attrs = {
|
|
589
|
-
fill: getFillColor(element, defaultFillColor),
|
|
590
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
591
|
-
};
|
|
592
|
-
|
|
593
|
-
var semantic = getSemantic(element);
|
|
594
|
-
|
|
595
|
-
if (!semantic.isInterrupting) {
|
|
596
|
-
attrs = {
|
|
597
|
-
strokeDasharray: '6',
|
|
598
|
-
fill: getFillColor(element, defaultFillColor),
|
|
599
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
var circle = renderer('bpmn:Event')(parentGfx, element, attrs);
|
|
604
|
-
|
|
605
|
-
if (!options || options.renderIcon !== false) {
|
|
606
|
-
renderEventContent(element, parentGfx);
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
return circle;
|
|
610
|
-
},
|
|
611
|
-
'bpmn:MessageEventDefinition': function(parentGfx, element, isThrowing) {
|
|
460
|
+
var eventIconRenderers = {
|
|
461
|
+
'bpmn:MessageEventDefinition': function(parentGfx, element, attrs = {}, isThrowing) {
|
|
612
462
|
var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
|
|
613
463
|
xScaleFactor: 0.9,
|
|
614
464
|
yScaleFactor: 0.9,
|
|
@@ -620,22 +470,27 @@ export default function BpmnRenderer(
|
|
|
620
470
|
}
|
|
621
471
|
});
|
|
622
472
|
|
|
623
|
-
var fill = isThrowing
|
|
624
|
-
|
|
473
|
+
var fill = isThrowing
|
|
474
|
+
? getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
475
|
+
: getFillColor(element, defaultFillColor, attrs.fill);
|
|
476
|
+
|
|
477
|
+
var stroke = isThrowing
|
|
478
|
+
? getFillColor(element, defaultFillColor, attrs.fill)
|
|
479
|
+
: getStrokeColor(element, defaultStrokeColor, attrs.stroke);
|
|
625
480
|
|
|
626
481
|
var messagePath = drawPath(parentGfx, pathData, {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
482
|
+
fill,
|
|
483
|
+
stroke,
|
|
484
|
+
strokeWidth: 1
|
|
630
485
|
});
|
|
631
486
|
|
|
632
487
|
return messagePath;
|
|
633
488
|
},
|
|
634
|
-
'bpmn:TimerEventDefinition': function(parentGfx, element) {
|
|
489
|
+
'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) {
|
|
635
490
|
var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, {
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
491
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
492
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
493
|
+
strokeWidth: 2
|
|
639
494
|
});
|
|
640
495
|
|
|
641
496
|
var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
|
|
@@ -650,12 +505,11 @@ export default function BpmnRenderer(
|
|
|
650
505
|
});
|
|
651
506
|
|
|
652
507
|
drawPath(parentGfx, pathData, {
|
|
653
|
-
|
|
654
|
-
|
|
508
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
509
|
+
strokeWidth: 2
|
|
655
510
|
});
|
|
656
511
|
|
|
657
|
-
for (var i = 0;i < 12; i++) {
|
|
658
|
-
|
|
512
|
+
for (var i = 0; i < 12; i++) {
|
|
659
513
|
var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
|
|
660
514
|
xScaleFactor: 0.75,
|
|
661
515
|
yScaleFactor: 0.75,
|
|
@@ -667,19 +521,19 @@ export default function BpmnRenderer(
|
|
|
667
521
|
}
|
|
668
522
|
});
|
|
669
523
|
|
|
670
|
-
var width = element.width / 2
|
|
671
|
-
|
|
524
|
+
var width = element.width / 2,
|
|
525
|
+
height = element.height / 2;
|
|
672
526
|
|
|
673
527
|
drawPath(parentGfx, linePathData, {
|
|
674
528
|
strokeWidth: 1,
|
|
675
|
-
|
|
676
|
-
|
|
529
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
530
|
+
transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')'
|
|
677
531
|
});
|
|
678
532
|
}
|
|
679
533
|
|
|
680
534
|
return circle;
|
|
681
535
|
},
|
|
682
|
-
'bpmn:EscalationEventDefinition': function(parentGfx, event, isThrowing) {
|
|
536
|
+
'bpmn:EscalationEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
683
537
|
var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
|
|
684
538
|
xScaleFactor: 1,
|
|
685
539
|
yScaleFactor: 1,
|
|
@@ -691,15 +545,17 @@ export default function BpmnRenderer(
|
|
|
691
545
|
}
|
|
692
546
|
});
|
|
693
547
|
|
|
694
|
-
var fill = isThrowing
|
|
548
|
+
var fill = isThrowing
|
|
549
|
+
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
550
|
+
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
695
551
|
|
|
696
552
|
return drawPath(parentGfx, pathData, {
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
553
|
+
fill,
|
|
554
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
555
|
+
strokeWidth: 1
|
|
700
556
|
});
|
|
701
557
|
},
|
|
702
|
-
'bpmn:ConditionalEventDefinition': function(parentGfx, event) {
|
|
558
|
+
'bpmn:ConditionalEventDefinition': function(parentGfx, event, attrs = {}) {
|
|
703
559
|
var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
|
|
704
560
|
xScaleFactor: 1,
|
|
705
561
|
yScaleFactor: 1,
|
|
@@ -712,11 +568,12 @@ export default function BpmnRenderer(
|
|
|
712
568
|
});
|
|
713
569
|
|
|
714
570
|
return drawPath(parentGfx, pathData, {
|
|
715
|
-
|
|
716
|
-
stroke: getStrokeColor(event, defaultStrokeColor)
|
|
571
|
+
fill: getFillColor(event, defaultFillColor, attrs.fill),
|
|
572
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
573
|
+
strokeWidth: 1
|
|
717
574
|
});
|
|
718
575
|
},
|
|
719
|
-
'bpmn:LinkEventDefinition': function(parentGfx, event, isThrowing) {
|
|
576
|
+
'bpmn:LinkEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
720
577
|
var pathData = pathMap.getScaledPath('EVENT_LINK', {
|
|
721
578
|
xScaleFactor: 1,
|
|
722
579
|
yScaleFactor: 1,
|
|
@@ -728,15 +585,17 @@ export default function BpmnRenderer(
|
|
|
728
585
|
}
|
|
729
586
|
});
|
|
730
587
|
|
|
731
|
-
var fill = isThrowing
|
|
588
|
+
var fill = isThrowing
|
|
589
|
+
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
590
|
+
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
732
591
|
|
|
733
592
|
return drawPath(parentGfx, pathData, {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
593
|
+
fill,
|
|
594
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
595
|
+
strokeWidth: 1
|
|
737
596
|
});
|
|
738
597
|
},
|
|
739
|
-
'bpmn:ErrorEventDefinition': function(parentGfx, event, isThrowing) {
|
|
598
|
+
'bpmn:ErrorEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
740
599
|
var pathData = pathMap.getScaledPath('EVENT_ERROR', {
|
|
741
600
|
xScaleFactor: 1.1,
|
|
742
601
|
yScaleFactor: 1.1,
|
|
@@ -748,15 +607,17 @@ export default function BpmnRenderer(
|
|
|
748
607
|
}
|
|
749
608
|
});
|
|
750
609
|
|
|
751
|
-
var fill = isThrowing
|
|
610
|
+
var fill = isThrowing
|
|
611
|
+
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
612
|
+
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
752
613
|
|
|
753
614
|
return drawPath(parentGfx, pathData, {
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
615
|
+
fill,
|
|
616
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
617
|
+
strokeWidth: 1
|
|
757
618
|
});
|
|
758
619
|
},
|
|
759
|
-
'bpmn:CancelEventDefinition': function(parentGfx, event, isThrowing) {
|
|
620
|
+
'bpmn:CancelEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
760
621
|
var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
|
|
761
622
|
xScaleFactor: 1.0,
|
|
762
623
|
yScaleFactor: 1.0,
|
|
@@ -768,19 +629,19 @@ export default function BpmnRenderer(
|
|
|
768
629
|
}
|
|
769
630
|
});
|
|
770
631
|
|
|
771
|
-
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
|
|
632
|
+
var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : 'none';
|
|
772
633
|
|
|
773
634
|
var path = drawPath(parentGfx, pathData, {
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
635
|
+
fill,
|
|
636
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
637
|
+
strokeWidth: 1
|
|
777
638
|
});
|
|
778
639
|
|
|
779
640
|
rotate(path, 45);
|
|
780
641
|
|
|
781
642
|
return path;
|
|
782
643
|
},
|
|
783
|
-
'bpmn:CompensateEventDefinition': function(parentGfx, event, isThrowing) {
|
|
644
|
+
'bpmn:CompensateEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
784
645
|
var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
|
|
785
646
|
xScaleFactor: 1,
|
|
786
647
|
yScaleFactor: 1,
|
|
@@ -792,15 +653,17 @@ export default function BpmnRenderer(
|
|
|
792
653
|
}
|
|
793
654
|
});
|
|
794
655
|
|
|
795
|
-
var fill = isThrowing
|
|
656
|
+
var fill = isThrowing
|
|
657
|
+
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
658
|
+
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
796
659
|
|
|
797
660
|
return drawPath(parentGfx, pathData, {
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
661
|
+
fill,
|
|
662
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
663
|
+
strokeWidth: 1
|
|
801
664
|
});
|
|
802
665
|
},
|
|
803
|
-
'bpmn:SignalEventDefinition': function(parentGfx, event, isThrowing) {
|
|
666
|
+
'bpmn:SignalEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
804
667
|
var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
|
|
805
668
|
xScaleFactor: 0.9,
|
|
806
669
|
yScaleFactor: 0.9,
|
|
@@ -812,15 +675,17 @@ export default function BpmnRenderer(
|
|
|
812
675
|
}
|
|
813
676
|
});
|
|
814
677
|
|
|
815
|
-
var fill = isThrowing
|
|
678
|
+
var fill = isThrowing
|
|
679
|
+
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
680
|
+
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
816
681
|
|
|
817
682
|
return drawPath(parentGfx, pathData, {
|
|
818
683
|
strokeWidth: 1,
|
|
819
|
-
fill
|
|
820
|
-
stroke: getStrokeColor(event, defaultStrokeColor)
|
|
684
|
+
fill,
|
|
685
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
821
686
|
});
|
|
822
687
|
},
|
|
823
|
-
'bpmn:MultipleEventDefinition': function(parentGfx, event, isThrowing) {
|
|
688
|
+
'bpmn:MultipleEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
|
|
824
689
|
var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
|
|
825
690
|
xScaleFactor: 1.1,
|
|
826
691
|
yScaleFactor: 1.1,
|
|
@@ -832,14 +697,16 @@ export default function BpmnRenderer(
|
|
|
832
697
|
}
|
|
833
698
|
});
|
|
834
699
|
|
|
835
|
-
var fill = isThrowing
|
|
700
|
+
var fill = isThrowing
|
|
701
|
+
? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
|
|
702
|
+
: getFillColor(event, defaultFillColor, attrs.fill);
|
|
836
703
|
|
|
837
704
|
return drawPath(parentGfx, pathData, {
|
|
838
|
-
|
|
839
|
-
|
|
705
|
+
fill,
|
|
706
|
+
strokeWidth: 1
|
|
840
707
|
});
|
|
841
708
|
},
|
|
842
|
-
'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event) {
|
|
709
|
+
'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event, attrs = {}) {
|
|
843
710
|
var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
|
|
844
711
|
xScaleFactor: 1.2,
|
|
845
712
|
yScaleFactor: 1.2,
|
|
@@ -852,445 +719,640 @@ export default function BpmnRenderer(
|
|
|
852
719
|
});
|
|
853
720
|
|
|
854
721
|
return drawPath(parentGfx, pathData, {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
});
|
|
859
|
-
},
|
|
860
|
-
'bpmn:EndEvent': function(parentGfx, element, options) {
|
|
861
|
-
var circle = renderer('bpmn:Event')(parentGfx, element, {
|
|
862
|
-
strokeWidth: 4,
|
|
863
|
-
fill: getFillColor(element, defaultFillColor),
|
|
864
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
722
|
+
fill: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
723
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
724
|
+
strokeWidth: 1
|
|
865
725
|
});
|
|
866
|
-
|
|
867
|
-
if (!options || options.renderIcon !== false) {
|
|
868
|
-
renderEventContent(element, parentGfx, true);
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
return circle;
|
|
872
726
|
},
|
|
873
|
-
'bpmn:TerminateEventDefinition': function(parentGfx, element) {
|
|
727
|
+
'bpmn:TerminateEventDefinition': function(parentGfx, element, attrs = {}) {
|
|
874
728
|
var circle = drawCircle(parentGfx, element.width, element.height, 8, {
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
729
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
730
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
731
|
+
strokeWidth: 4
|
|
878
732
|
});
|
|
879
733
|
|
|
880
734
|
return circle;
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
var outer = renderer('bpmn:Event')(parentGfx, element, {
|
|
884
|
-
strokeWidth: 1.5,
|
|
885
|
-
fill: getFillColor(element, defaultFillColor),
|
|
886
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
887
|
-
});
|
|
735
|
+
}
|
|
736
|
+
};
|
|
888
737
|
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
fill: getFillColor(element, 'none'),
|
|
893
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
894
|
-
});
|
|
738
|
+
function renderEventIcon(element, parentGfx, attrs = {}) {
|
|
739
|
+
var semantic = getSemantic(element),
|
|
740
|
+
isThrowing = isThrowEvent(semantic);
|
|
895
741
|
|
|
896
|
-
|
|
897
|
-
|
|
742
|
+
if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
|
|
743
|
+
if (semantic.get('parallelMultiple')) {
|
|
744
|
+
return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
|
|
898
745
|
}
|
|
746
|
+
else {
|
|
747
|
+
return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
899
750
|
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
|
|
904
|
-
|
|
905
|
-
'bpmn:Activity': function(parentGfx, element, attrs) {
|
|
751
|
+
if (isTypedEvent(semantic, 'bpmn:MessageEventDefinition')) {
|
|
752
|
+
return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, element, attrs, isThrowing);
|
|
753
|
+
}
|
|
906
754
|
|
|
907
|
-
|
|
755
|
+
if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
|
|
756
|
+
return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, element, attrs, isThrowing);
|
|
757
|
+
}
|
|
908
758
|
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
759
|
+
if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
|
|
760
|
+
return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, element, attrs, isThrowing);
|
|
761
|
+
}
|
|
912
762
|
|
|
913
|
-
|
|
914
|
-
|
|
763
|
+
if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
|
|
764
|
+
return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, element, attrs, isThrowing);
|
|
765
|
+
}
|
|
915
766
|
|
|
916
|
-
'bpmn:
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
920
|
-
};
|
|
767
|
+
if (isTypedEvent(semantic, 'bpmn:EscalationEventDefinition')) {
|
|
768
|
+
return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, element, attrs, isThrowing);
|
|
769
|
+
}
|
|
921
770
|
|
|
922
|
-
|
|
771
|
+
if (isTypedEvent(semantic, 'bpmn:LinkEventDefinition')) {
|
|
772
|
+
return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, element, attrs, isThrowing);
|
|
773
|
+
}
|
|
923
774
|
|
|
924
|
-
|
|
925
|
-
|
|
775
|
+
if (isTypedEvent(semantic, 'bpmn:ErrorEventDefinition')) {
|
|
776
|
+
return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, element, attrs, isThrowing);
|
|
777
|
+
}
|
|
926
778
|
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
var task = renderer('bpmn:Task')(parentGfx, element);
|
|
779
|
+
if (isTypedEvent(semantic, 'bpmn:CancelEventDefinition')) {
|
|
780
|
+
return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, element, attrs, isThrowing);
|
|
781
|
+
}
|
|
931
782
|
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
y: 18
|
|
936
|
-
}
|
|
937
|
-
});
|
|
783
|
+
if (isTypedEvent(semantic, 'bpmn:CompensateEventDefinition')) {
|
|
784
|
+
return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, element, attrs, isThrowing);
|
|
785
|
+
}
|
|
938
786
|
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
943
|
-
});
|
|
787
|
+
if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
|
|
788
|
+
return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, element, attrs, isThrowing);
|
|
789
|
+
}
|
|
944
790
|
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
x: 17.2,
|
|
948
|
-
y: 18
|
|
949
|
-
}
|
|
950
|
-
});
|
|
791
|
+
return null;
|
|
792
|
+
}
|
|
951
793
|
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
794
|
+
var taskMarkerRenderers = {
|
|
795
|
+
'ParticipantMultiplicityMarker': function(parentGfx, element, attrs = {}) {
|
|
796
|
+
var width = getWidth(element, attrs),
|
|
797
|
+
height = getHeight(element, attrs);
|
|
956
798
|
|
|
957
|
-
var
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
799
|
+
var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
|
|
800
|
+
xScaleFactor: 1,
|
|
801
|
+
yScaleFactor: 1,
|
|
802
|
+
containerWidth: width,
|
|
803
|
+
containerHeight: height,
|
|
804
|
+
position: {
|
|
805
|
+
mx: ((width / 2 - 6) / width),
|
|
806
|
+
my: (height - 15) / height
|
|
961
807
|
}
|
|
962
808
|
});
|
|
963
809
|
|
|
964
|
-
|
|
965
|
-
strokeWidth:
|
|
966
|
-
fill: getFillColor(element, defaultFillColor),
|
|
967
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
810
|
+
drawMarker('participant-multiplicity', parentGfx, markerPath, {
|
|
811
|
+
strokeWidth: 2,
|
|
812
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
813
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
968
814
|
});
|
|
969
|
-
|
|
970
|
-
return task;
|
|
971
815
|
},
|
|
972
|
-
'
|
|
973
|
-
var
|
|
816
|
+
'SubProcessMarker': function(parentGfx, element, attrs = {}) {
|
|
817
|
+
var markerRect = drawRect(parentGfx, 14, 14, 0, {
|
|
818
|
+
strokeWidth: 1,
|
|
819
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
820
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
821
|
+
});
|
|
974
822
|
|
|
975
|
-
|
|
976
|
-
var y = 12;
|
|
823
|
+
translate(markerRect, element.width / 2 - 7.5, element.height - 20);
|
|
977
824
|
|
|
978
|
-
var
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
825
|
+
var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
|
|
826
|
+
xScaleFactor: 1.5,
|
|
827
|
+
yScaleFactor: 1.5,
|
|
828
|
+
containerWidth: element.width,
|
|
829
|
+
containerHeight: element.height,
|
|
830
|
+
position: {
|
|
831
|
+
mx: (element.width / 2 - 7.5) / element.width,
|
|
832
|
+
my: (element.height - 20) / element.height
|
|
982
833
|
}
|
|
983
834
|
});
|
|
984
835
|
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
836
|
+
drawMarker('sub-process', parentGfx, markerPath, {
|
|
837
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
838
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
989
839
|
});
|
|
840
|
+
},
|
|
841
|
+
'ParallelMarker': function(parentGfx, element, attrs) {
|
|
842
|
+
var width = getWidth(element, attrs),
|
|
843
|
+
height = getHeight(element, attrs);
|
|
990
844
|
|
|
991
|
-
var
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
845
|
+
var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
|
|
846
|
+
xScaleFactor: 1,
|
|
847
|
+
yScaleFactor: 1,
|
|
848
|
+
containerWidth: width,
|
|
849
|
+
containerHeight: height,
|
|
850
|
+
position: {
|
|
851
|
+
mx: ((width / 2 + attrs.parallel) / width),
|
|
852
|
+
my: (height - 20) / height
|
|
995
853
|
}
|
|
996
854
|
});
|
|
997
855
|
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
856
|
+
drawMarker('parallel', parentGfx, markerPath, {
|
|
857
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
858
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
1002
859
|
});
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
860
|
+
},
|
|
861
|
+
'SequentialMarker': function(parentGfx, element, attrs) {
|
|
862
|
+
var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
|
|
863
|
+
xScaleFactor: 1,
|
|
864
|
+
yScaleFactor: 1,
|
|
865
|
+
containerWidth: element.width,
|
|
866
|
+
containerHeight: element.height,
|
|
867
|
+
position: {
|
|
868
|
+
mx: ((element.width / 2 + attrs.seq) / element.width),
|
|
869
|
+
my: (element.height - 19) / element.height
|
|
1008
870
|
}
|
|
1009
871
|
});
|
|
1010
872
|
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
873
|
+
drawMarker('sequential', parentGfx, markerPath, {
|
|
874
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
875
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
1015
876
|
});
|
|
1016
|
-
|
|
1017
|
-
return task;
|
|
1018
877
|
},
|
|
1019
|
-
'
|
|
1020
|
-
var
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
878
|
+
'CompensationMarker': function(parentGfx, element, attrs) {
|
|
879
|
+
var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
|
|
880
|
+
xScaleFactor: 1,
|
|
881
|
+
yScaleFactor: 1,
|
|
882
|
+
containerWidth: element.width,
|
|
883
|
+
containerHeight: element.height,
|
|
884
|
+
position: {
|
|
885
|
+
mx: ((element.width / 2 + attrs.compensation) / element.width),
|
|
886
|
+
my: (element.height - 13) / element.height
|
|
1026
887
|
}
|
|
1027
888
|
});
|
|
1028
889
|
|
|
1029
|
-
|
|
1030
|
-
strokeWidth:
|
|
1031
|
-
fill: getFillColor(element, defaultFillColor),
|
|
1032
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
890
|
+
drawMarker('compensation', parentGfx, markerMath, {
|
|
891
|
+
strokeWidth: 1,
|
|
892
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
893
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
1033
894
|
});
|
|
1034
|
-
|
|
1035
|
-
return task;
|
|
1036
895
|
},
|
|
1037
|
-
'
|
|
1038
|
-
var
|
|
896
|
+
'LoopMarker': function(parentGfx, element, attrs) {
|
|
897
|
+
var width = getWidth(element, attrs),
|
|
898
|
+
height = getHeight(element, attrs);
|
|
1039
899
|
|
|
1040
|
-
var
|
|
900
|
+
var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
|
|
1041
901
|
xScaleFactor: 1,
|
|
1042
902
|
yScaleFactor: 1,
|
|
1043
|
-
containerWidth:
|
|
1044
|
-
containerHeight:
|
|
903
|
+
containerWidth: width,
|
|
904
|
+
containerHeight: height,
|
|
1045
905
|
position: {
|
|
1046
|
-
mx:
|
|
1047
|
-
my:
|
|
906
|
+
mx: ((width / 2 + attrs.loop) / width),
|
|
907
|
+
my: (height - 7) / height
|
|
1048
908
|
}
|
|
1049
909
|
});
|
|
1050
910
|
|
|
1051
|
-
|
|
1052
|
-
strokeWidth: 1,
|
|
1053
|
-
fill:
|
|
1054
|
-
stroke:
|
|
911
|
+
drawMarker('loop', parentGfx, markerPath, {
|
|
912
|
+
strokeWidth: 1.5,
|
|
913
|
+
fill: 'none',
|
|
914
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
915
|
+
strokeMiterlimit: 0.5
|
|
1055
916
|
});
|
|
1056
|
-
|
|
1057
|
-
return task;
|
|
1058
917
|
},
|
|
1059
|
-
'
|
|
1060
|
-
var
|
|
918
|
+
'AdhocMarker': function(parentGfx, element, attrs) {
|
|
919
|
+
var width = getWidth(element, attrs),
|
|
920
|
+
height = getHeight(element, attrs);
|
|
1061
921
|
|
|
1062
|
-
var
|
|
1063
|
-
|
|
922
|
+
var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
|
|
923
|
+
xScaleFactor: 1,
|
|
924
|
+
yScaleFactor: 1,
|
|
925
|
+
containerWidth: width,
|
|
926
|
+
containerHeight: height,
|
|
927
|
+
position: {
|
|
928
|
+
mx: ((width / 2 + attrs.adhoc) / width),
|
|
929
|
+
my: (height - 15) / height
|
|
930
|
+
}
|
|
931
|
+
});
|
|
1064
932
|
|
|
1065
|
-
|
|
1066
|
-
|
|
933
|
+
drawMarker('adhoc', parentGfx, markerPath, {
|
|
934
|
+
strokeWidth: 1,
|
|
935
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
936
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
};
|
|
1067
940
|
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
y: 9.52
|
|
1072
|
-
}
|
|
1073
|
-
});
|
|
1074
|
-
} else {
|
|
941
|
+
function renderTaskMarker(type, parentGfx, element, attrs) {
|
|
942
|
+
taskMarkerRenderers[ type ](parentGfx, element, attrs);
|
|
943
|
+
}
|
|
1075
944
|
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
945
|
+
function renderTaskMarkers(parentGfx, element, taskMarkers, attrs = {}) {
|
|
946
|
+
attrs = {
|
|
947
|
+
fill: attrs.fill,
|
|
948
|
+
stroke: attrs.stroke,
|
|
949
|
+
width: getWidth(element, attrs),
|
|
950
|
+
height: getHeight(element, attrs)
|
|
951
|
+
};
|
|
952
|
+
|
|
953
|
+
var semantic = getSemantic(element);
|
|
954
|
+
|
|
955
|
+
var subprocess = taskMarkers && taskMarkers.includes('SubProcessMarker');
|
|
956
|
+
|
|
957
|
+
if (subprocess) {
|
|
958
|
+
attrs = {
|
|
959
|
+
...attrs,
|
|
960
|
+
seq: -21,
|
|
961
|
+
parallel: -22,
|
|
962
|
+
compensation: -42,
|
|
963
|
+
loop: -18,
|
|
964
|
+
adhoc: 10
|
|
965
|
+
};
|
|
966
|
+
} else {
|
|
967
|
+
attrs = {
|
|
968
|
+
...attrs,
|
|
969
|
+
seq: -5,
|
|
970
|
+
parallel: -6,
|
|
971
|
+
compensation: -27,
|
|
972
|
+
loop: 0,
|
|
973
|
+
adhoc: 10
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
forEach(taskMarkers, function(marker) {
|
|
978
|
+
renderTaskMarker(marker, parentGfx, element, attrs);
|
|
979
|
+
});
|
|
980
|
+
|
|
981
|
+
if (semantic.get('isForCompensation')) {
|
|
982
|
+
renderTaskMarker('CompensationMarker', parentGfx, element, attrs);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
if (is(semantic, 'bpmn:AdHocSubProcess')) {
|
|
986
|
+
renderTaskMarker('AdhocMarker', parentGfx, element, attrs);
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
var loopCharacteristics = semantic.get('loopCharacteristics'),
|
|
990
|
+
isSequential = loopCharacteristics && loopCharacteristics.get('isSequential');
|
|
991
|
+
|
|
992
|
+
if (loopCharacteristics) {
|
|
993
|
+
|
|
994
|
+
if (isSequential === undefined) {
|
|
995
|
+
renderTaskMarker('LoopMarker', parentGfx, element, attrs);
|
|
1086
996
|
}
|
|
1087
997
|
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
1092
|
-
});
|
|
998
|
+
if (isSequential === false) {
|
|
999
|
+
renderTaskMarker('ParallelMarker', parentGfx, element, attrs);
|
|
1000
|
+
}
|
|
1093
1001
|
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1002
|
+
if (isSequential === true) {
|
|
1003
|
+
renderTaskMarker('SequentialMarker', parentGfx, element, attrs);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1098
1007
|
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1008
|
+
function renderLabel(parentGfx, label, attrs = {}) {
|
|
1009
|
+
attrs = assign({
|
|
1010
|
+
size: {
|
|
1011
|
+
width: 100
|
|
1012
|
+
}
|
|
1013
|
+
}, attrs);
|
|
1105
1014
|
|
|
1106
|
-
|
|
1107
|
-
strokeWidth: 1,
|
|
1108
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
1109
|
-
});
|
|
1015
|
+
var text = textRenderer.createText(label || '', attrs);
|
|
1110
1016
|
|
|
1111
|
-
|
|
1112
|
-
},
|
|
1113
|
-
'bpmn:BusinessRuleTask': function(parentGfx, element) {
|
|
1114
|
-
var task = renderer('bpmn:Task')(parentGfx, element);
|
|
1017
|
+
svgClasses(text).add('djs-label');
|
|
1115
1018
|
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1019
|
+
svgAppend(parentGfx, text);
|
|
1020
|
+
|
|
1021
|
+
return text;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
function renderEmbeddedLabel(parentGfx, element, align, attrs = {}) {
|
|
1025
|
+
var semantic = getSemantic(element);
|
|
1026
|
+
|
|
1027
|
+
var box = getBounds({
|
|
1028
|
+
x: element.x,
|
|
1029
|
+
y: element.y,
|
|
1030
|
+
width: element.width,
|
|
1031
|
+
height: element.height
|
|
1032
|
+
}, attrs);
|
|
1033
|
+
|
|
1034
|
+
return renderLabel(parentGfx, semantic.name, {
|
|
1035
|
+
align,
|
|
1036
|
+
box,
|
|
1037
|
+
padding: 7,
|
|
1038
|
+
style: {
|
|
1039
|
+
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
function renderExternalLabel(parentGfx, element, attrs = {}) {
|
|
1045
|
+
var box = {
|
|
1046
|
+
width: 90,
|
|
1047
|
+
height: 30,
|
|
1048
|
+
x: element.width / 2 + element.x,
|
|
1049
|
+
y: element.height / 2 + element.y
|
|
1050
|
+
};
|
|
1051
|
+
|
|
1052
|
+
return renderLabel(parentGfx, getLabel(element), {
|
|
1053
|
+
box: box,
|
|
1054
|
+
fitBox: true,
|
|
1055
|
+
style: assign(
|
|
1056
|
+
{},
|
|
1057
|
+
textRenderer.getExternalStyle(),
|
|
1058
|
+
{
|
|
1059
|
+
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
|
|
1120
1060
|
}
|
|
1121
|
-
|
|
1061
|
+
)
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1122
1064
|
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
}
|
|
1065
|
+
function renderLaneLabel(parentGfx, text, element, attrs = {}) {
|
|
1066
|
+
var textBox = renderLabel(parentGfx, text, {
|
|
1067
|
+
box: {
|
|
1068
|
+
height: 30,
|
|
1069
|
+
width: getHeight(element, attrs),
|
|
1070
|
+
},
|
|
1071
|
+
align: 'center-middle',
|
|
1072
|
+
style: {
|
|
1073
|
+
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
|
|
1074
|
+
}
|
|
1075
|
+
});
|
|
1129
1076
|
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1077
|
+
var top = -1 * getHeight(element, attrs);
|
|
1078
|
+
|
|
1079
|
+
transform(textBox, 0, -top, 270);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
function renderActivity(parentGfx, element, attrs = {}) {
|
|
1083
|
+
var {
|
|
1084
|
+
width,
|
|
1085
|
+
height
|
|
1086
|
+
} = getBounds(element, attrs);
|
|
1087
|
+
|
|
1088
|
+
return drawRect(parentGfx, width, height, TASK_BORDER_RADIUS, {
|
|
1089
|
+
...attrs,
|
|
1090
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1091
|
+
fillOpacity: DEFAULT_OPACITY,
|
|
1092
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
function renderAssociation(parentGfx, element, attrs = {}) {
|
|
1097
|
+
var semantic = getSemantic(element);
|
|
1098
|
+
|
|
1099
|
+
var fill = getFillColor(element, defaultFillColor, attrs.fill),
|
|
1100
|
+
stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
|
|
1101
|
+
|
|
1102
|
+
if (semantic.get('associationDirection') === 'One' ||
|
|
1103
|
+
semantic.get('associationDirection') === 'Both') {
|
|
1104
|
+
attrs.markerEnd = marker('association-end', fill, stroke);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
if (semantic.get('associationDirection') === 'Both') {
|
|
1108
|
+
attrs.markerStart = marker('association-start', fill, stroke);
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
attrs = pickAttrs(attrs, [
|
|
1112
|
+
'markerStart',
|
|
1113
|
+
'markerEnd'
|
|
1114
|
+
]);
|
|
1115
|
+
|
|
1116
|
+
return drawConnectionSegments(parentGfx, element.waypoints, {
|
|
1117
|
+
...attrs,
|
|
1118
|
+
stroke,
|
|
1119
|
+
strokeDasharray: '0, 5'
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
function renderDataObject(parentGfx, element, attrs = {}) {
|
|
1124
|
+
var fill = getFillColor(element, defaultFillColor, attrs.fill),
|
|
1125
|
+
stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
|
|
1126
|
+
|
|
1127
|
+
var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
|
|
1128
|
+
xScaleFactor: 1,
|
|
1129
|
+
yScaleFactor: 1,
|
|
1130
|
+
containerWidth: element.width,
|
|
1131
|
+
containerHeight: element.height,
|
|
1132
|
+
position: {
|
|
1133
|
+
mx: 0.474,
|
|
1134
|
+
my: 0.296
|
|
1135
|
+
}
|
|
1136
|
+
});
|
|
1137
|
+
|
|
1138
|
+
var dataObject = drawPath(parentGfx, pathData, {
|
|
1139
|
+
fill,
|
|
1140
|
+
fillOpacity: DEFAULT_OPACITY,
|
|
1141
|
+
stroke
|
|
1142
|
+
});
|
|
1143
|
+
|
|
1144
|
+
var semantic = getSemantic(element);
|
|
1145
|
+
|
|
1146
|
+
if (isCollection(semantic)) {
|
|
1147
|
+
var collectionPathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
|
|
1148
|
+
xScaleFactor: 1,
|
|
1149
|
+
yScaleFactor: 1,
|
|
1150
|
+
containerWidth: element.width,
|
|
1151
|
+
containerHeight: element.height,
|
|
1152
|
+
position: {
|
|
1153
|
+
mx: 0.33,
|
|
1154
|
+
my: (element.height - 18) / element.height
|
|
1134
1155
|
}
|
|
1135
1156
|
});
|
|
1136
1157
|
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
stroke
|
|
1158
|
+
drawPath(parentGfx, collectionPathData, {
|
|
1159
|
+
strokeWidth: 2,
|
|
1160
|
+
fill,
|
|
1161
|
+
stroke
|
|
1141
1162
|
});
|
|
1163
|
+
}
|
|
1142
1164
|
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
'bpmn:SubProcess': function(parentGfx, element, attrs) {
|
|
1146
|
-
attrs = {
|
|
1147
|
-
fill: getFillColor(element, defaultFillColor),
|
|
1148
|
-
stroke: getStrokeColor(element, defaultStrokeColor),
|
|
1149
|
-
...attrs
|
|
1150
|
-
};
|
|
1165
|
+
return dataObject;
|
|
1166
|
+
}
|
|
1151
1167
|
|
|
1152
|
-
|
|
1168
|
+
function renderEvent(parentGfx, element, attrs = {}) {
|
|
1169
|
+
return drawCircle(parentGfx, element.width, element.height, {
|
|
1170
|
+
fillOpacity: DEFAULT_OPACITY,
|
|
1171
|
+
...attrs,
|
|
1172
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1173
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1153
1176
|
|
|
1154
|
-
|
|
1177
|
+
function renderGateway(parentGfx, element, attrs = {}) {
|
|
1178
|
+
return drawDiamond(parentGfx, element.width, element.height, {
|
|
1179
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1180
|
+
fillOpacity: DEFAULT_OPACITY,
|
|
1181
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1155
1184
|
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1185
|
+
function renderLane(parentGfx, element, attrs = {}) {
|
|
1186
|
+
var lane = drawRect(parentGfx, getWidth(element, attrs), getHeight(element, attrs), 0, {
|
|
1187
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1188
|
+
fillOpacity: attrs.fillOpacity || DEFAULT_OPACITY,
|
|
1189
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1190
|
+
strokeWidth: 1.5
|
|
1191
|
+
});
|
|
1162
1192
|
|
|
1163
|
-
|
|
1193
|
+
var semantic = getSemantic(element);
|
|
1164
1194
|
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
} else {
|
|
1168
|
-
attachTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ]);
|
|
1169
|
-
}
|
|
1195
|
+
if (is(semantic, 'bpmn:Lane')) {
|
|
1196
|
+
var text = semantic.get('name');
|
|
1170
1197
|
|
|
1171
|
-
|
|
1172
|
-
}
|
|
1173
|
-
'bpmn:AdHocSubProcess': function(parentGfx, element) {
|
|
1174
|
-
return renderer('bpmn:SubProcess')(parentGfx, element);
|
|
1175
|
-
},
|
|
1176
|
-
'bpmn:Transaction': function(parentGfx, element) {
|
|
1177
|
-
var outer = renderer('bpmn:SubProcess')(parentGfx, element, { strokeWidth: 1.5 });
|
|
1198
|
+
renderLaneLabel(parentGfx, text, element, attrs);
|
|
1199
|
+
}
|
|
1178
1200
|
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
strokeWidth: 1.5
|
|
1182
|
-
});
|
|
1201
|
+
return lane;
|
|
1202
|
+
}
|
|
1183
1203
|
|
|
1184
|
-
|
|
1204
|
+
function renderSubProcess(parentGfx, element, attrs = {}) {
|
|
1205
|
+
var activity = renderActivity(parentGfx, element, attrs);
|
|
1185
1206
|
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
strokeWidth: 5
|
|
1207
|
+
if (isEventSubProcess(element)) {
|
|
1208
|
+
svgAttr(activity, {
|
|
1209
|
+
strokeDasharray: '0, 5.5',
|
|
1210
|
+
strokeWidth: 2.5
|
|
1191
1211
|
});
|
|
1192
|
-
}
|
|
1193
|
-
'bpmn:Participant': function(parentGfx, element) {
|
|
1212
|
+
}
|
|
1194
1213
|
|
|
1195
|
-
|
|
1214
|
+
var expanded = isExpanded(element);
|
|
1196
1215
|
|
|
1197
|
-
|
|
1198
|
-
fillOpacity: DEFAULT_FILL_OPACITY,
|
|
1199
|
-
fill: getFillColor(element, defaultFillColor),
|
|
1200
|
-
stroke: getStrokeColor(element, defaultStrokeColor),
|
|
1201
|
-
strokeWidth
|
|
1202
|
-
};
|
|
1216
|
+
renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle', attrs);
|
|
1203
1217
|
|
|
1204
|
-
|
|
1218
|
+
if (expanded) {
|
|
1219
|
+
renderTaskMarkers(parentGfx, element, undefined, attrs);
|
|
1220
|
+
} else {
|
|
1221
|
+
renderTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ], attrs);
|
|
1222
|
+
}
|
|
1205
1223
|
|
|
1206
|
-
|
|
1224
|
+
return activity;
|
|
1225
|
+
}
|
|
1207
1226
|
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
{ x: 30, y: 0 },
|
|
1211
|
-
{ x: 30, y: element.height }
|
|
1212
|
-
], {
|
|
1213
|
-
stroke: getStrokeColor(element, defaultStrokeColor),
|
|
1214
|
-
strokeWidth
|
|
1215
|
-
});
|
|
1216
|
-
var text = getSemantic(element).name;
|
|
1217
|
-
renderLaneLabel(parentGfx, text, element);
|
|
1218
|
-
} else {
|
|
1227
|
+
function renderTask(parentGfx, element, attrs = {}) {
|
|
1228
|
+
var activity = renderActivity(parentGfx, element, attrs);
|
|
1219
1229
|
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
box: element, align: 'center-middle',
|
|
1224
|
-
style: {
|
|
1225
|
-
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
|
|
1226
|
-
}
|
|
1227
|
-
});
|
|
1228
|
-
}
|
|
1230
|
+
renderEmbeddedLabel(parentGfx, element, 'center-middle', attrs);
|
|
1231
|
+
|
|
1232
|
+
renderTaskMarkers(parentGfx, element, undefined, attrs);
|
|
1229
1233
|
|
|
1230
|
-
|
|
1234
|
+
return activity;
|
|
1235
|
+
}
|
|
1231
1236
|
|
|
1232
|
-
|
|
1233
|
-
|
|
1237
|
+
var handlers = this.handlers = {
|
|
1238
|
+
'bpmn:AdHocSubProcess': function(parentGfx, element, attrs = {}) {
|
|
1239
|
+
if (isExpanded(element)) {
|
|
1240
|
+
attrs = pickAttrs(attrs, [
|
|
1241
|
+
'fill',
|
|
1242
|
+
'stroke',
|
|
1243
|
+
'width',
|
|
1244
|
+
'height'
|
|
1245
|
+
]);
|
|
1246
|
+
} else {
|
|
1247
|
+
attrs = pickAttrs(attrs, [
|
|
1248
|
+
'fill',
|
|
1249
|
+
'stroke'
|
|
1250
|
+
]);
|
|
1234
1251
|
}
|
|
1235
1252
|
|
|
1236
|
-
return
|
|
1253
|
+
return renderSubProcess(parentGfx, element, attrs);
|
|
1254
|
+
},
|
|
1255
|
+
'bpmn:Association': function(parentGfx, element, attrs = {}) {
|
|
1256
|
+
attrs = pickAttrs(attrs, [
|
|
1257
|
+
'fill',
|
|
1258
|
+
'stroke'
|
|
1259
|
+
]);
|
|
1260
|
+
|
|
1261
|
+
return renderAssociation(parentGfx, element, attrs);
|
|
1237
1262
|
},
|
|
1238
|
-
'bpmn:
|
|
1239
|
-
var
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1263
|
+
'bpmn:BoundaryEvent': function(parentGfx, element, attrs = {}) {
|
|
1264
|
+
var { renderIcon = true } = attrs;
|
|
1265
|
+
|
|
1266
|
+
attrs = pickAttrs(attrs, [
|
|
1267
|
+
'fill',
|
|
1268
|
+
'stroke'
|
|
1269
|
+
]);
|
|
1270
|
+
|
|
1271
|
+
var semantic = getSemantic(element),
|
|
1272
|
+
cancelActivity = semantic.get('cancelActivity');
|
|
1273
|
+
|
|
1274
|
+
attrs = {
|
|
1243
1275
|
strokeWidth: 1.5,
|
|
1244
|
-
|
|
1245
|
-
|
|
1276
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1277
|
+
fillOpacity: FULL_OPACITY,
|
|
1278
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
1279
|
+
};
|
|
1246
1280
|
|
|
1247
|
-
|
|
1281
|
+
if (!cancelActivity) {
|
|
1282
|
+
attrs.strokeDasharray = '6';
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
var event = renderEvent(parentGfx, element, attrs);
|
|
1286
|
+
|
|
1287
|
+
drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
|
|
1288
|
+
...attrs,
|
|
1289
|
+
fill: 'none'
|
|
1290
|
+
});
|
|
1248
1291
|
|
|
1249
|
-
if (
|
|
1250
|
-
|
|
1251
|
-
renderLaneLabel(parentGfx, text, element);
|
|
1292
|
+
if (renderIcon) {
|
|
1293
|
+
renderEventIcon(element, parentGfx, attrs);
|
|
1252
1294
|
}
|
|
1253
1295
|
|
|
1254
|
-
return
|
|
1296
|
+
return event;
|
|
1255
1297
|
},
|
|
1256
|
-
'bpmn:
|
|
1257
|
-
|
|
1298
|
+
'bpmn:BusinessRuleTask': function(parentGfx, element, attrs = {}) {
|
|
1299
|
+
attrs = pickAttrs(attrs, [
|
|
1300
|
+
'fill',
|
|
1301
|
+
'stroke'
|
|
1302
|
+
]);
|
|
1258
1303
|
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1304
|
+
var task = renderTask(parentGfx, element, attrs);
|
|
1305
|
+
|
|
1306
|
+
var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
|
|
1307
|
+
abspos: {
|
|
1308
|
+
x: 8,
|
|
1309
|
+
y: 8
|
|
1310
|
+
}
|
|
1264
1311
|
});
|
|
1265
1312
|
|
|
1266
|
-
|
|
1267
|
-
},
|
|
1268
|
-
'bpmn:ExclusiveGateway': function(parentGfx, element) {
|
|
1269
|
-
var diamond = renderer('bpmn:Gateway')(parentGfx, element);
|
|
1313
|
+
var businessPath = drawPath(parentGfx, headerData);
|
|
1270
1314
|
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1315
|
+
svgAttr(businessPath, {
|
|
1316
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1317
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1318
|
+
strokeWidth: 1
|
|
1319
|
+
});
|
|
1320
|
+
|
|
1321
|
+
var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
|
|
1322
|
+
abspos: {
|
|
1323
|
+
x: 8,
|
|
1324
|
+
y: 8
|
|
1279
1325
|
}
|
|
1280
1326
|
});
|
|
1281
1327
|
|
|
1282
|
-
|
|
1283
|
-
drawPath(parentGfx, pathData, {
|
|
1284
|
-
strokeWidth: 1,
|
|
1285
|
-
fill: getStrokeColor(element, defaultStrokeColor),
|
|
1286
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
1287
|
-
});
|
|
1288
|
-
}
|
|
1328
|
+
var businessHeaderPath = drawPath(parentGfx, headerPathData);
|
|
1289
1329
|
|
|
1290
|
-
|
|
1330
|
+
svgAttr(businessHeaderPath, {
|
|
1331
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1332
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1333
|
+
strokeWidth: 1
|
|
1334
|
+
});
|
|
1335
|
+
|
|
1336
|
+
return task;
|
|
1291
1337
|
},
|
|
1292
|
-
'bpmn:
|
|
1293
|
-
|
|
1338
|
+
'bpmn:CallActivity': function(parentGfx, element, attrs = {}) {
|
|
1339
|
+
attrs = pickAttrs(attrs, [
|
|
1340
|
+
'fill',
|
|
1341
|
+
'stroke'
|
|
1342
|
+
]);
|
|
1343
|
+
|
|
1344
|
+
return renderSubProcess(parentGfx, element, {
|
|
1345
|
+
strokeWidth: 5,
|
|
1346
|
+
...attrs
|
|
1347
|
+
});
|
|
1348
|
+
},
|
|
1349
|
+
'bpmn:ComplexGateway': function(parentGfx, element, attrs = {}) {
|
|
1350
|
+
attrs = pickAttrs(attrs, [
|
|
1351
|
+
'fill',
|
|
1352
|
+
'stroke'
|
|
1353
|
+
]);
|
|
1354
|
+
|
|
1355
|
+
var gateway = renderGateway(parentGfx, element, attrs);
|
|
1294
1356
|
|
|
1295
1357
|
var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
|
|
1296
1358
|
xScaleFactor: 0.5,
|
|
@@ -1303,50 +1365,142 @@ export default function BpmnRenderer(
|
|
|
1303
1365
|
}
|
|
1304
1366
|
});
|
|
1305
1367
|
|
|
1306
|
-
|
|
1368
|
+
drawPath(parentGfx, pathData, {
|
|
1369
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1370
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1371
|
+
strokeWidth: 1
|
|
1372
|
+
});
|
|
1373
|
+
|
|
1374
|
+
return gateway;
|
|
1375
|
+
},
|
|
1376
|
+
'bpmn:DataInput': function(parentGfx, element, attrs = {}) {
|
|
1377
|
+
attrs = pickAttrs(attrs, [
|
|
1378
|
+
'fill',
|
|
1379
|
+
'stroke'
|
|
1380
|
+
]);
|
|
1381
|
+
|
|
1382
|
+
var arrowPathData = pathMap.getRawPath('DATA_ARROW');
|
|
1383
|
+
|
|
1384
|
+
var dataObject = renderDataObject(parentGfx, element, attrs);
|
|
1385
|
+
|
|
1386
|
+
drawPath(parentGfx, arrowPathData, {
|
|
1387
|
+
fill: 'none',
|
|
1388
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1389
|
+
strokeWidth: 1
|
|
1390
|
+
});
|
|
1391
|
+
|
|
1392
|
+
return dataObject;
|
|
1393
|
+
},
|
|
1394
|
+
'bpmn:DataInputAssociation': function(parentGfx, element, attrs = {}) {
|
|
1395
|
+
attrs = pickAttrs(attrs, [
|
|
1396
|
+
'fill',
|
|
1397
|
+
'stroke'
|
|
1398
|
+
]);
|
|
1399
|
+
|
|
1400
|
+
return renderAssociation(parentGfx, element, {
|
|
1401
|
+
...attrs,
|
|
1402
|
+
markerEnd: marker('association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
|
|
1403
|
+
});
|
|
1404
|
+
},
|
|
1405
|
+
'bpmn:DataObject': function(parentGfx, element, attrs = {}) {
|
|
1406
|
+
attrs = pickAttrs(attrs, [
|
|
1407
|
+
'fill',
|
|
1408
|
+
'stroke'
|
|
1409
|
+
]);
|
|
1410
|
+
|
|
1411
|
+
return renderDataObject(parentGfx, element, attrs);
|
|
1412
|
+
},
|
|
1413
|
+
'bpmn:DataObjectReference': as('bpmn:DataObject'),
|
|
1414
|
+
'bpmn:DataOutput': function(parentGfx, element, attrs = {}) {
|
|
1415
|
+
attrs = pickAttrs(attrs, [
|
|
1416
|
+
'fill',
|
|
1417
|
+
'stroke'
|
|
1418
|
+
]);
|
|
1419
|
+
|
|
1420
|
+
var arrowPathData = pathMap.getRawPath('DATA_ARROW');
|
|
1421
|
+
|
|
1422
|
+
var dataObject = renderDataObject(parentGfx, element, attrs);
|
|
1423
|
+
|
|
1424
|
+
drawPath(parentGfx, arrowPathData, {
|
|
1307
1425
|
strokeWidth: 1,
|
|
1308
|
-
fill:
|
|
1309
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
1426
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1427
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
1310
1428
|
});
|
|
1311
1429
|
|
|
1312
|
-
return
|
|
1430
|
+
return dataObject;
|
|
1313
1431
|
},
|
|
1314
|
-
'bpmn:
|
|
1315
|
-
|
|
1432
|
+
'bpmn:DataOutputAssociation': function(parentGfx, element, attrs = {}) {
|
|
1433
|
+
attrs = pickAttrs(attrs, [
|
|
1434
|
+
'fill',
|
|
1435
|
+
'stroke'
|
|
1436
|
+
]);
|
|
1316
1437
|
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1438
|
+
return renderAssociation(parentGfx, element, {
|
|
1439
|
+
...attrs,
|
|
1440
|
+
markerEnd: marker('association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
|
|
1441
|
+
});
|
|
1442
|
+
},
|
|
1443
|
+
'bpmn:DataStoreReference': function(parentGfx, element, attrs = {}) {
|
|
1444
|
+
attrs = pickAttrs(attrs, [
|
|
1445
|
+
'fill',
|
|
1446
|
+
'stroke'
|
|
1447
|
+
]);
|
|
1448
|
+
|
|
1449
|
+
var dataStorePath = pathMap.getScaledPath('DATA_STORE', {
|
|
1450
|
+
xScaleFactor: 1,
|
|
1451
|
+
yScaleFactor: 1,
|
|
1320
1452
|
containerWidth: element.width,
|
|
1321
1453
|
containerHeight: element.height,
|
|
1322
1454
|
position: {
|
|
1323
|
-
mx: 0
|
|
1324
|
-
my: 0.
|
|
1455
|
+
mx: 0,
|
|
1456
|
+
my: 0.133
|
|
1325
1457
|
}
|
|
1326
1458
|
});
|
|
1327
1459
|
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
1460
|
+
return drawPath(parentGfx, dataStorePath, {
|
|
1461
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1462
|
+
fillOpacity: DEFAULT_OPACITY,
|
|
1463
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1464
|
+
strokeWidth: 2
|
|
1332
1465
|
});
|
|
1466
|
+
},
|
|
1467
|
+
'bpmn:EndEvent': function(parentGfx, element, attrs = {}) {
|
|
1468
|
+
var { renderIcon = true } = attrs;
|
|
1333
1469
|
|
|
1334
|
-
|
|
1470
|
+
attrs = pickAttrs(attrs, [
|
|
1471
|
+
'fill',
|
|
1472
|
+
'stroke'
|
|
1473
|
+
]);
|
|
1474
|
+
|
|
1475
|
+
var event = renderEvent(parentGfx, element, {
|
|
1476
|
+
...attrs,
|
|
1477
|
+
strokeWidth: 4
|
|
1478
|
+
});
|
|
1479
|
+
|
|
1480
|
+
if (renderIcon) {
|
|
1481
|
+
renderEventIcon(element, parentGfx, attrs);
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
return event;
|
|
1335
1485
|
},
|
|
1336
|
-
'bpmn:EventBasedGateway': function(parentGfx, element) {
|
|
1486
|
+
'bpmn:EventBasedGateway': function(parentGfx, element, attrs = {}) {
|
|
1487
|
+
attrs = pickAttrs(attrs, [
|
|
1488
|
+
'fill',
|
|
1489
|
+
'stroke'
|
|
1490
|
+
]);
|
|
1337
1491
|
|
|
1338
1492
|
var semantic = getSemantic(element);
|
|
1339
1493
|
|
|
1340
|
-
var diamond =
|
|
1494
|
+
var diamond = renderGateway(parentGfx, element, attrs);
|
|
1341
1495
|
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1496
|
+
drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
|
|
1497
|
+
fill: getFillColor(element, 'none', attrs.fill),
|
|
1498
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1499
|
+
strokeWidth: 1
|
|
1346
1500
|
});
|
|
1347
1501
|
|
|
1348
|
-
var type = semantic.eventGatewayType
|
|
1349
|
-
|
|
1502
|
+
var type = semantic.get('eventGatewayType'),
|
|
1503
|
+
instantiate = !!semantic.get('instantiate');
|
|
1350
1504
|
|
|
1351
1505
|
function drawEvent() {
|
|
1352
1506
|
|
|
@@ -1361,18 +1515,17 @@ export default function BpmnRenderer(
|
|
|
1361
1515
|
}
|
|
1362
1516
|
});
|
|
1363
1517
|
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1518
|
+
drawPath(parentGfx, pathData, {
|
|
1519
|
+
fill: 'none',
|
|
1520
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1521
|
+
strokeWidth: 2
|
|
1368
1522
|
});
|
|
1369
1523
|
}
|
|
1370
1524
|
|
|
1371
1525
|
if (type === 'Parallel') {
|
|
1372
|
-
|
|
1373
1526
|
var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
|
|
1374
1527
|
xScaleFactor: 0.4,
|
|
1375
|
-
yScaleFactor:0.4,
|
|
1528
|
+
yScaleFactor: 0.4,
|
|
1376
1529
|
containerWidth: element.width,
|
|
1377
1530
|
containerHeight: element.height,
|
|
1378
1531
|
position: {
|
|
@@ -1382,16 +1535,16 @@ export default function BpmnRenderer(
|
|
|
1382
1535
|
});
|
|
1383
1536
|
|
|
1384
1537
|
drawPath(parentGfx, pathData, {
|
|
1385
|
-
|
|
1386
|
-
|
|
1538
|
+
fill: 'none',
|
|
1539
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1540
|
+
strokeWidth: 1
|
|
1387
1541
|
});
|
|
1388
1542
|
} else if (type === 'Exclusive') {
|
|
1389
|
-
|
|
1390
1543
|
if (!instantiate) {
|
|
1391
1544
|
drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
|
|
1392
|
-
strokeWidth: 1,
|
|
1393
1545
|
fill: 'none',
|
|
1394
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
1546
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1547
|
+
strokeWidth: 1
|
|
1395
1548
|
});
|
|
1396
1549
|
}
|
|
1397
1550
|
|
|
@@ -1401,104 +1554,163 @@ export default function BpmnRenderer(
|
|
|
1401
1554
|
|
|
1402
1555
|
return diamond;
|
|
1403
1556
|
},
|
|
1404
|
-
'bpmn:
|
|
1405
|
-
|
|
1406
|
-
fill
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
});
|
|
1410
|
-
},
|
|
1411
|
-
'bpmn:SequenceFlow': function(parentGfx, element) {
|
|
1412
|
-
var fill = getFillColor(element, defaultFillColor),
|
|
1413
|
-
stroke = getStrokeColor(element, defaultStrokeColor);
|
|
1557
|
+
'bpmn:ExclusiveGateway': function(parentGfx, element, attrs = {}) {
|
|
1558
|
+
attrs = pickAttrs(attrs, [
|
|
1559
|
+
'fill',
|
|
1560
|
+
'stroke'
|
|
1561
|
+
]);
|
|
1414
1562
|
|
|
1415
|
-
var
|
|
1416
|
-
markerEnd: marker('sequenceflow-end', fill, stroke),
|
|
1417
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
1418
|
-
});
|
|
1563
|
+
var gateway = renderGateway(parentGfx, element, attrs);
|
|
1419
1564
|
|
|
1420
|
-
var
|
|
1565
|
+
var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
|
|
1566
|
+
xScaleFactor: 0.4,
|
|
1567
|
+
yScaleFactor: 0.4,
|
|
1568
|
+
containerWidth: element.width,
|
|
1569
|
+
containerHeight: element.height,
|
|
1570
|
+
position: {
|
|
1571
|
+
mx: 0.32,
|
|
1572
|
+
my: 0.3
|
|
1573
|
+
}
|
|
1574
|
+
});
|
|
1421
1575
|
|
|
1422
|
-
var
|
|
1576
|
+
var di = getDi(element);
|
|
1423
1577
|
|
|
1424
|
-
if (
|
|
1425
|
-
|
|
1578
|
+
if (di.get('isMarkerVisible')) {
|
|
1579
|
+
drawPath(parentGfx, pathData, {
|
|
1580
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1581
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1582
|
+
strokeWidth: 1
|
|
1583
|
+
});
|
|
1584
|
+
}
|
|
1426
1585
|
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1586
|
+
return gateway;
|
|
1587
|
+
},
|
|
1588
|
+
'bpmn:Gateway': function(parentGfx, element, attrs = {}) {
|
|
1589
|
+
attrs = pickAttrs(attrs, [
|
|
1590
|
+
'fill',
|
|
1591
|
+
'stroke'
|
|
1592
|
+
]);
|
|
1433
1593
|
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1594
|
+
return renderGateway(parentGfx, element, attrs);
|
|
1595
|
+
},
|
|
1596
|
+
'bpmn:Group': function(parentGfx, element, attrs = {}) {
|
|
1597
|
+
attrs = pickAttrs(attrs, [
|
|
1598
|
+
'fill',
|
|
1599
|
+
'stroke',
|
|
1600
|
+
'width',
|
|
1601
|
+
'height'
|
|
1602
|
+
]);
|
|
1442
1603
|
|
|
1443
|
-
return
|
|
1604
|
+
return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
|
|
1605
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1606
|
+
strokeWidth: 1.5,
|
|
1607
|
+
strokeDasharray: '10, 6, 0, 6',
|
|
1608
|
+
fill: 'none',
|
|
1609
|
+
pointerEvents: 'none',
|
|
1610
|
+
width: getWidth(element, attrs),
|
|
1611
|
+
height: getHeight(element, attrs)
|
|
1612
|
+
});
|
|
1444
1613
|
},
|
|
1445
|
-
'bpmn:
|
|
1614
|
+
'bpmn:InclusiveGateway': function(parentGfx, element, attrs = {}) {
|
|
1615
|
+
attrs = pickAttrs(attrs, [
|
|
1616
|
+
'fill',
|
|
1617
|
+
'stroke'
|
|
1618
|
+
]);
|
|
1446
1619
|
|
|
1447
|
-
var
|
|
1620
|
+
var gateway = renderGateway(parentGfx, element, attrs);
|
|
1448
1621
|
|
|
1449
|
-
|
|
1450
|
-
|
|
1622
|
+
drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
|
|
1623
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1624
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1625
|
+
strokeWidth: 2.5
|
|
1626
|
+
});
|
|
1451
1627
|
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
};
|
|
1628
|
+
return gateway;
|
|
1629
|
+
},
|
|
1630
|
+
'bpmn:IntermediateEvent': function(parentGfx, element, attrs = {}) {
|
|
1631
|
+
var { renderIcon = true } = attrs;
|
|
1457
1632
|
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1633
|
+
attrs = pickAttrs(attrs, [
|
|
1634
|
+
'fill',
|
|
1635
|
+
'stroke'
|
|
1636
|
+
]);
|
|
1637
|
+
|
|
1638
|
+
var outer = renderEvent(parentGfx, element, {
|
|
1639
|
+
...attrs,
|
|
1640
|
+
strokeWidth: 1.5
|
|
1641
|
+
});
|
|
1642
|
+
|
|
1643
|
+
drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
|
|
1644
|
+
fill: 'none',
|
|
1645
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1646
|
+
strokeWidth: 1.5
|
|
1647
|
+
});
|
|
1462
1648
|
|
|
1463
|
-
if (
|
|
1464
|
-
|
|
1649
|
+
if (renderIcon) {
|
|
1650
|
+
renderEventIcon(element, parentGfx, attrs);
|
|
1465
1651
|
}
|
|
1466
1652
|
|
|
1467
|
-
return
|
|
1653
|
+
return outer;
|
|
1468
1654
|
},
|
|
1469
|
-
'bpmn:
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1655
|
+
'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
|
|
1656
|
+
'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
|
|
1657
|
+
'bpmn:Lane': function(parentGfx, element, attrs = {}) {
|
|
1658
|
+
attrs = pickAttrs(attrs, [
|
|
1659
|
+
'fill',
|
|
1660
|
+
'stroke',
|
|
1661
|
+
'width',
|
|
1662
|
+
'height'
|
|
1663
|
+
]);
|
|
1664
|
+
|
|
1665
|
+
return renderLane(parentGfx, element, {
|
|
1666
|
+
...attrs,
|
|
1667
|
+
fillOpacity: LOW_OPACITY
|
|
1475
1668
|
});
|
|
1476
1669
|
},
|
|
1477
|
-
'bpmn:
|
|
1478
|
-
|
|
1479
|
-
|
|
1670
|
+
'bpmn:ManualTask': function(parentGfx, element, attrs = {}) {
|
|
1671
|
+
attrs = pickAttrs(attrs, [
|
|
1672
|
+
'fill',
|
|
1673
|
+
'stroke'
|
|
1674
|
+
]);
|
|
1480
1675
|
|
|
1481
|
-
|
|
1482
|
-
|
|
1676
|
+
var task = renderTask(parentGfx, element, attrs);
|
|
1677
|
+
|
|
1678
|
+
var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
|
|
1679
|
+
abspos: {
|
|
1680
|
+
x: 17,
|
|
1681
|
+
y: 15
|
|
1682
|
+
}
|
|
1483
1683
|
});
|
|
1684
|
+
|
|
1685
|
+
drawPath(parentGfx, pathData, {
|
|
1686
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1687
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1688
|
+
strokeWidth: 0.5
|
|
1689
|
+
});
|
|
1690
|
+
|
|
1691
|
+
return task;
|
|
1484
1692
|
},
|
|
1485
|
-
'bpmn:MessageFlow': function(parentGfx, element) {
|
|
1693
|
+
'bpmn:MessageFlow': function(parentGfx, element, attrs = {}) {
|
|
1694
|
+
attrs = pickAttrs(attrs, [
|
|
1695
|
+
'fill',
|
|
1696
|
+
'stroke'
|
|
1697
|
+
]);
|
|
1486
1698
|
|
|
1487
1699
|
var semantic = getSemantic(element),
|
|
1488
1700
|
di = getDi(element);
|
|
1489
1701
|
|
|
1490
|
-
var fill = getFillColor(element, defaultFillColor),
|
|
1491
|
-
stroke = getStrokeColor(element, defaultStrokeColor);
|
|
1702
|
+
var fill = getFillColor(element, defaultFillColor, attrs.fill),
|
|
1703
|
+
stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
|
|
1492
1704
|
|
|
1493
1705
|
var path = drawConnectionSegments(parentGfx, element.waypoints, {
|
|
1494
1706
|
markerEnd: marker('messageflow-end', fill, stroke),
|
|
1495
1707
|
markerStart: marker('messageflow-start', fill, stroke),
|
|
1708
|
+
stroke,
|
|
1496
1709
|
strokeDasharray: '10, 11',
|
|
1497
|
-
strokeWidth: 1.5
|
|
1498
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
1710
|
+
strokeWidth: 1.5
|
|
1499
1711
|
});
|
|
1500
1712
|
|
|
1501
|
-
if (semantic.messageRef) {
|
|
1713
|
+
if (semantic.get('messageRef')) {
|
|
1502
1714
|
var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
|
|
1503
1715
|
|
|
1504
1716
|
var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', {
|
|
@@ -1508,24 +1720,28 @@ export default function BpmnRenderer(
|
|
|
1508
1720
|
}
|
|
1509
1721
|
});
|
|
1510
1722
|
|
|
1511
|
-
var messageAttrs = {
|
|
1723
|
+
var messageAttrs = {
|
|
1724
|
+
strokeWidth: 1
|
|
1725
|
+
};
|
|
1512
1726
|
|
|
1513
|
-
if (di.messageVisibleKind === 'initiating') {
|
|
1514
|
-
messageAttrs.fill =
|
|
1515
|
-
messageAttrs.stroke =
|
|
1727
|
+
if (di.get('messageVisibleKind') === 'initiating') {
|
|
1728
|
+
messageAttrs.fill = fill;
|
|
1729
|
+
messageAttrs.stroke = stroke;
|
|
1516
1730
|
} else {
|
|
1517
|
-
messageAttrs.fill =
|
|
1518
|
-
messageAttrs.stroke =
|
|
1731
|
+
messageAttrs.fill = stroke;
|
|
1732
|
+
messageAttrs.stroke = fill;
|
|
1519
1733
|
}
|
|
1520
1734
|
|
|
1521
1735
|
var message = drawPath(parentGfx, markerPathData, messageAttrs);
|
|
1522
1736
|
|
|
1523
|
-
var
|
|
1524
|
-
|
|
1737
|
+
var messageRef = semantic.get('messageRef'),
|
|
1738
|
+
name = messageRef.get('name');
|
|
1739
|
+
|
|
1740
|
+
var label = renderLabel(parentGfx, name, {
|
|
1525
1741
|
align: 'center-top',
|
|
1526
1742
|
fitBox: true,
|
|
1527
1743
|
style: {
|
|
1528
|
-
fill:
|
|
1744
|
+
fill: stroke
|
|
1529
1745
|
}
|
|
1530
1746
|
});
|
|
1531
1747
|
|
|
@@ -1535,144 +1751,341 @@ export default function BpmnRenderer(
|
|
|
1535
1751
|
var translateX = midPoint.x - labelBounds.width / 2,
|
|
1536
1752
|
translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE;
|
|
1537
1753
|
|
|
1538
|
-
transform(label, translateX, translateY, 0);
|
|
1754
|
+
transform(label, translateX, translateY, 0);
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
return path;
|
|
1758
|
+
},
|
|
1759
|
+
'bpmn:ParallelGateway': function(parentGfx, element, attrs = {}) {
|
|
1760
|
+
attrs = pickAttrs(attrs, [
|
|
1761
|
+
'fill',
|
|
1762
|
+
'stroke'
|
|
1763
|
+
]);
|
|
1764
|
+
|
|
1765
|
+
var diamond = renderGateway(parentGfx, element, attrs);
|
|
1766
|
+
|
|
1767
|
+
var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
|
|
1768
|
+
xScaleFactor: 0.6,
|
|
1769
|
+
yScaleFactor: 0.6,
|
|
1770
|
+
containerWidth: element.width,
|
|
1771
|
+
containerHeight: element.height,
|
|
1772
|
+
position: {
|
|
1773
|
+
mx: 0.46,
|
|
1774
|
+
my: 0.2
|
|
1775
|
+
}
|
|
1776
|
+
});
|
|
1777
|
+
|
|
1778
|
+
drawPath(parentGfx, pathData, {
|
|
1779
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1780
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1781
|
+
strokeWidth: 1
|
|
1782
|
+
});
|
|
1783
|
+
|
|
1784
|
+
return diamond;
|
|
1785
|
+
},
|
|
1786
|
+
'bpmn:Participant': function(parentGfx, element, attrs = {}) {
|
|
1787
|
+
attrs = pickAttrs(attrs, [
|
|
1788
|
+
'fill',
|
|
1789
|
+
'stroke',
|
|
1790
|
+
'width',
|
|
1791
|
+
'height'
|
|
1792
|
+
]);
|
|
1793
|
+
|
|
1794
|
+
var participant = renderLane(parentGfx, element, attrs);
|
|
1795
|
+
|
|
1796
|
+
var expandedParticipant = isExpanded(element);
|
|
1797
|
+
|
|
1798
|
+
var semantic = getSemantic(element),
|
|
1799
|
+
name = semantic.get('name');
|
|
1800
|
+
|
|
1801
|
+
if (expandedParticipant) {
|
|
1802
|
+
drawLine(parentGfx, [
|
|
1803
|
+
{
|
|
1804
|
+
x: 30,
|
|
1805
|
+
y: 0
|
|
1806
|
+
},
|
|
1807
|
+
{
|
|
1808
|
+
x: 30,
|
|
1809
|
+
y: getHeight(element, attrs)
|
|
1810
|
+
}
|
|
1811
|
+
], {
|
|
1812
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1813
|
+
strokeWidth: PARTICIPANT_STROKE_WIDTH
|
|
1814
|
+
});
|
|
1815
|
+
|
|
1816
|
+
renderLaneLabel(parentGfx, name, element, attrs);
|
|
1817
|
+
} else {
|
|
1818
|
+
renderLabel(parentGfx, name, {
|
|
1819
|
+
box: getBounds(element, attrs),
|
|
1820
|
+
align: 'center-middle',
|
|
1821
|
+
style: {
|
|
1822
|
+
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
|
|
1823
|
+
}
|
|
1824
|
+
});
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
if (semantic.get('participantMultiplicity')) {
|
|
1828
|
+
renderTaskMarker('ParticipantMultiplicityMarker', parentGfx, element, attrs);
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
return participant;
|
|
1832
|
+
},
|
|
1833
|
+
'bpmn:ReceiveTask' : function(parentGfx, element, attrs = {}) {
|
|
1834
|
+
attrs = pickAttrs(attrs, [
|
|
1835
|
+
'fill',
|
|
1836
|
+
'stroke'
|
|
1837
|
+
]);
|
|
1838
|
+
|
|
1839
|
+
var semantic = getSemantic(element);
|
|
1840
|
+
|
|
1841
|
+
var task = renderTask(parentGfx, element, attrs);
|
|
1842
|
+
|
|
1843
|
+
var pathData;
|
|
1844
|
+
|
|
1845
|
+
if (semantic.get('instantiate')) {
|
|
1846
|
+
drawCircle(parentGfx, 28, 28, 20 * 0.22, {
|
|
1847
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1848
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1849
|
+
strokeWidth: 1
|
|
1850
|
+
});
|
|
1851
|
+
|
|
1852
|
+
pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
|
|
1853
|
+
abspos: {
|
|
1854
|
+
x: 7.77,
|
|
1855
|
+
y: 9.52
|
|
1856
|
+
}
|
|
1857
|
+
});
|
|
1858
|
+
} else {
|
|
1859
|
+
pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
|
|
1860
|
+
xScaleFactor: 0.9,
|
|
1861
|
+
yScaleFactor: 0.9,
|
|
1862
|
+
containerWidth: 21,
|
|
1863
|
+
containerHeight: 14,
|
|
1864
|
+
position: {
|
|
1865
|
+
mx: 0.3,
|
|
1866
|
+
my: 0.4
|
|
1867
|
+
}
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
drawPath(parentGfx, pathData, {
|
|
1872
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1873
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1874
|
+
strokeWidth: 1
|
|
1875
|
+
});
|
|
1876
|
+
|
|
1877
|
+
return task;
|
|
1878
|
+
},
|
|
1879
|
+
'bpmn:ScriptTask': function(parentGfx, element, attrs = {}) {
|
|
1880
|
+
attrs = pickAttrs(attrs, [
|
|
1881
|
+
'fill',
|
|
1882
|
+
'stroke'
|
|
1883
|
+
]);
|
|
1884
|
+
|
|
1885
|
+
var task = renderTask(parentGfx, element, attrs);
|
|
1886
|
+
|
|
1887
|
+
var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
|
|
1888
|
+
abspos: {
|
|
1889
|
+
x: 15,
|
|
1890
|
+
y: 20
|
|
1891
|
+
}
|
|
1892
|
+
});
|
|
1893
|
+
|
|
1894
|
+
drawPath(parentGfx, pathData, {
|
|
1895
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1896
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1897
|
+
strokeWidth: 1
|
|
1898
|
+
});
|
|
1899
|
+
|
|
1900
|
+
return task;
|
|
1901
|
+
},
|
|
1902
|
+
'bpmn:SendTask': function(parentGfx, element, attrs = {}) {
|
|
1903
|
+
attrs = pickAttrs(attrs, [
|
|
1904
|
+
'fill',
|
|
1905
|
+
'stroke'
|
|
1906
|
+
]);
|
|
1539
1907
|
|
|
1540
|
-
|
|
1908
|
+
var task = renderTask(parentGfx, element, attrs);
|
|
1541
1909
|
|
|
1542
|
-
|
|
1543
|
-
},
|
|
1544
|
-
'bpmn:DataObject': function(parentGfx, element) {
|
|
1545
|
-
var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
|
|
1910
|
+
var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
|
|
1546
1911
|
xScaleFactor: 1,
|
|
1547
1912
|
yScaleFactor: 1,
|
|
1548
|
-
containerWidth:
|
|
1549
|
-
containerHeight:
|
|
1913
|
+
containerWidth: 21,
|
|
1914
|
+
containerHeight: 14,
|
|
1550
1915
|
position: {
|
|
1551
|
-
mx: 0.
|
|
1552
|
-
my: 0.
|
|
1916
|
+
mx: 0.285,
|
|
1917
|
+
my: 0.357
|
|
1553
1918
|
}
|
|
1554
1919
|
});
|
|
1555
1920
|
|
|
1556
|
-
|
|
1557
|
-
fill:
|
|
1558
|
-
|
|
1559
|
-
|
|
1921
|
+
drawPath(parentGfx, pathData, {
|
|
1922
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1923
|
+
stroke: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1924
|
+
strokeWidth: 1
|
|
1560
1925
|
});
|
|
1561
1926
|
|
|
1562
|
-
|
|
1927
|
+
return task;
|
|
1928
|
+
},
|
|
1929
|
+
'bpmn:SequenceFlow': function(parentGfx, element, attrs = {}) {
|
|
1930
|
+
attrs = pickAttrs(attrs, [
|
|
1931
|
+
'fill',
|
|
1932
|
+
'stroke'
|
|
1933
|
+
]);
|
|
1563
1934
|
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
}
|
|
1935
|
+
var fill = getFillColor(element, defaultFillColor, attrs.fill),
|
|
1936
|
+
stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
|
|
1567
1937
|
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1938
|
+
var connection = drawConnectionSegments(parentGfx, element.waypoints, {
|
|
1939
|
+
markerEnd: marker('sequenceflow-end', fill, stroke),
|
|
1940
|
+
stroke
|
|
1941
|
+
});
|
|
1572
1942
|
|
|
1573
|
-
var
|
|
1943
|
+
var semantic = getSemantic(element);
|
|
1574
1944
|
|
|
1575
|
-
|
|
1576
|
-
var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
|
|
1945
|
+
var { source } = element;
|
|
1577
1946
|
|
|
1578
|
-
|
|
1947
|
+
if (source) {
|
|
1948
|
+
var sourceSemantic = getSemantic(source);
|
|
1949
|
+
|
|
1950
|
+
// conditional flow marker
|
|
1951
|
+
if (semantic.get('conditionExpression') && is(sourceSemantic, 'bpmn:Activity')) {
|
|
1952
|
+
svgAttr(connection, {
|
|
1953
|
+
markerStart: marker('conditional-flow-marker', fill, stroke)
|
|
1954
|
+
});
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
// default marker
|
|
1958
|
+
if (sourceSemantic.get('default') && (is(sourceSemantic, 'bpmn:Gateway') || is(sourceSemantic, 'bpmn:Activity')) &&
|
|
1959
|
+
sourceSemantic.get('default') === semantic) {
|
|
1960
|
+
svgAttr(connection, {
|
|
1961
|
+
markerStart: marker('conditional-default-flow-marker', fill, stroke)
|
|
1962
|
+
});
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1579
1965
|
|
|
1580
|
-
return
|
|
1966
|
+
return connection;
|
|
1581
1967
|
},
|
|
1582
|
-
'bpmn:
|
|
1583
|
-
|
|
1968
|
+
'bpmn:ServiceTask': function(parentGfx, element, attrs = {}) {
|
|
1969
|
+
attrs = pickAttrs(attrs, [
|
|
1970
|
+
'fill',
|
|
1971
|
+
'stroke'
|
|
1972
|
+
]);
|
|
1584
1973
|
|
|
1585
|
-
|
|
1586
|
-
var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
|
|
1974
|
+
var task = renderTask(parentGfx, element, attrs);
|
|
1587
1975
|
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1976
|
+
drawCircle(parentGfx, 10, 10, {
|
|
1977
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1978
|
+
stroke: 'none',
|
|
1979
|
+
transform: 'translate(6, 6)'
|
|
1591
1980
|
});
|
|
1592
1981
|
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
xScaleFactor: 1,
|
|
1598
|
-
yScaleFactor: 1,
|
|
1599
|
-
containerWidth: element.width,
|
|
1600
|
-
containerHeight: element.height,
|
|
1601
|
-
position: {
|
|
1602
|
-
mx: 0,
|
|
1603
|
-
my: 0.133
|
|
1982
|
+
var pathDataService1 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
|
|
1983
|
+
abspos: {
|
|
1984
|
+
x: 12,
|
|
1985
|
+
y: 18
|
|
1604
1986
|
}
|
|
1605
1987
|
});
|
|
1606
1988
|
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
1989
|
+
drawPath(parentGfx, pathDataService1, {
|
|
1990
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1991
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
1992
|
+
strokeWidth: 1
|
|
1612
1993
|
});
|
|
1613
1994
|
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1995
|
+
drawCircle(parentGfx, 10, 10, {
|
|
1996
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
1997
|
+
stroke: 'none',
|
|
1998
|
+
transform: 'translate(11, 10)'
|
|
1999
|
+
});
|
|
1617
2000
|
|
|
1618
|
-
var
|
|
1619
|
-
|
|
2001
|
+
var pathDataService2 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
|
|
2002
|
+
abspos: {
|
|
2003
|
+
x: 17,
|
|
2004
|
+
y: 22
|
|
2005
|
+
}
|
|
2006
|
+
});
|
|
1620
2007
|
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
};
|
|
2008
|
+
drawPath(parentGfx, pathDataService2, {
|
|
2009
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
2010
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
2011
|
+
strokeWidth: 1
|
|
2012
|
+
});
|
|
1626
2013
|
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
2014
|
+
return task;
|
|
2015
|
+
},
|
|
2016
|
+
'bpmn:StartEvent': function(parentGfx, element, attrs = {}) {
|
|
2017
|
+
var { renderIcon = true } = attrs;
|
|
1630
2018
|
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
};
|
|
2019
|
+
attrs = pickAttrs(attrs, [
|
|
2020
|
+
'fill',
|
|
2021
|
+
'stroke'
|
|
2022
|
+
]);
|
|
1636
2023
|
|
|
1637
|
-
|
|
1638
|
-
var innerAttrs = {
|
|
1639
|
-
...attrs,
|
|
1640
|
-
fill: 'none'
|
|
1641
|
-
};
|
|
2024
|
+
var semantic = getSemantic(element);
|
|
1642
2025
|
|
|
1643
|
-
|
|
2026
|
+
if (!semantic.get('isInterrupting')) {
|
|
2027
|
+
attrs = {
|
|
2028
|
+
...attrs,
|
|
2029
|
+
strokeDasharray: '6'
|
|
2030
|
+
};
|
|
2031
|
+
}
|
|
1644
2032
|
|
|
1645
|
-
|
|
2033
|
+
var event = renderEvent(parentGfx, element, attrs);
|
|
1646
2034
|
|
|
1647
|
-
if (
|
|
1648
|
-
|
|
2035
|
+
if (renderIcon) {
|
|
2036
|
+
renderEventIcon(element, parentGfx, attrs);
|
|
1649
2037
|
}
|
|
1650
2038
|
|
|
1651
|
-
return
|
|
2039
|
+
return event;
|
|
1652
2040
|
},
|
|
1653
|
-
'bpmn:
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
2041
|
+
'bpmn:SubProcess': function(parentGfx, element, attrs = {}) {
|
|
2042
|
+
if (isExpanded(element)) {
|
|
2043
|
+
attrs = pickAttrs(attrs, [
|
|
2044
|
+
'fill',
|
|
2045
|
+
'stroke',
|
|
2046
|
+
'width',
|
|
2047
|
+
'height'
|
|
2048
|
+
]);
|
|
2049
|
+
} else {
|
|
2050
|
+
attrs = pickAttrs(attrs, [
|
|
2051
|
+
'fill',
|
|
2052
|
+
'stroke'
|
|
2053
|
+
]);
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
return renderSubProcess(parentGfx, element, attrs);
|
|
1661
2057
|
},
|
|
1662
|
-
'
|
|
1663
|
-
|
|
2058
|
+
'bpmn:Task': function(parentGfx, element, attrs = {}) {
|
|
2059
|
+
attrs = pickAttrs(attrs, [
|
|
2060
|
+
'fill',
|
|
2061
|
+
'stroke'
|
|
2062
|
+
]);
|
|
2063
|
+
|
|
2064
|
+
return renderTask(parentGfx, element, attrs);
|
|
1664
2065
|
},
|
|
1665
|
-
'bpmn:TextAnnotation': function(parentGfx, element) {
|
|
1666
|
-
|
|
1667
|
-
'fill'
|
|
1668
|
-
'stroke'
|
|
2066
|
+
'bpmn:TextAnnotation': function(parentGfx, element, attrs = {}) {
|
|
2067
|
+
attrs = pickAttrs(attrs, [
|
|
2068
|
+
'fill',
|
|
2069
|
+
'stroke',
|
|
2070
|
+
'width',
|
|
2071
|
+
'height'
|
|
2072
|
+
]);
|
|
2073
|
+
|
|
2074
|
+
var {
|
|
2075
|
+
width,
|
|
2076
|
+
height
|
|
2077
|
+
} = getBounds(element, attrs);
|
|
2078
|
+
|
|
2079
|
+
var textElement = drawRect(parentGfx, width, height, 0, 0, {
|
|
2080
|
+
fill: 'none',
|
|
2081
|
+
stroke: 'none'
|
|
1669
2082
|
});
|
|
1670
2083
|
|
|
1671
2084
|
var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
|
|
1672
2085
|
xScaleFactor: 1,
|
|
1673
2086
|
yScaleFactor: 1,
|
|
1674
|
-
containerWidth:
|
|
1675
|
-
containerHeight:
|
|
2087
|
+
containerWidth: width,
|
|
2088
|
+
containerHeight: height,
|
|
1676
2089
|
position: {
|
|
1677
2090
|
mx: 0.0,
|
|
1678
2091
|
my: 0.0
|
|
@@ -1680,232 +2093,121 @@ export default function BpmnRenderer(
|
|
|
1680
2093
|
});
|
|
1681
2094
|
|
|
1682
2095
|
drawPath(parentGfx, textPathData, {
|
|
1683
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
2096
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
|
|
1684
2097
|
});
|
|
1685
2098
|
|
|
1686
|
-
var
|
|
2099
|
+
var semantic = getSemantic(element),
|
|
2100
|
+
text = semantic.get('text') || '';
|
|
2101
|
+
|
|
1687
2102
|
renderLabel(parentGfx, text, {
|
|
1688
|
-
box: element,
|
|
1689
2103
|
align: 'left-top',
|
|
2104
|
+
box: getBounds(element, attrs),
|
|
1690
2105
|
padding: 7,
|
|
1691
2106
|
style: {
|
|
1692
|
-
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
|
|
2107
|
+
fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
|
|
1693
2108
|
}
|
|
1694
2109
|
});
|
|
1695
2110
|
|
|
1696
2111
|
return textElement;
|
|
1697
2112
|
},
|
|
1698
|
-
'
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
2113
|
+
'bpmn:Transaction': function(parentGfx, element, attrs = {}) {
|
|
2114
|
+
if (isExpanded(element)) {
|
|
2115
|
+
attrs = pickAttrs(attrs, [
|
|
2116
|
+
'fill',
|
|
2117
|
+
'stroke',
|
|
2118
|
+
'width',
|
|
2119
|
+
'height'
|
|
2120
|
+
]);
|
|
2121
|
+
} else {
|
|
2122
|
+
attrs = pickAttrs(attrs, [
|
|
2123
|
+
'fill',
|
|
2124
|
+
'stroke'
|
|
2125
|
+
]);
|
|
2126
|
+
}
|
|
1709
2127
|
|
|
1710
|
-
|
|
1711
|
-
strokeWidth:
|
|
1712
|
-
|
|
1713
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
2128
|
+
var outer = renderSubProcess(parentGfx, element, {
|
|
2129
|
+
strokeWidth: 1.5,
|
|
2130
|
+
...attrs
|
|
1714
2131
|
});
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
strokeWidth: 1
|
|
1719
|
-
fill: getFillColor(element, defaultFillColor),
|
|
1720
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
2132
|
+
|
|
2133
|
+
var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
|
|
2134
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
2135
|
+
strokeWidth: 1.5
|
|
1721
2136
|
});
|
|
1722
2137
|
|
|
1723
|
-
|
|
1724
|
-
// therefore fixed values can be used here
|
|
1725
|
-
translate(markerRect, element.width / 2 - 7.5, element.height - 20);
|
|
2138
|
+
var expanded = isExpanded(element);
|
|
1726
2139
|
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
containerWidth: element.width,
|
|
1731
|
-
containerHeight: element.height,
|
|
1732
|
-
position: {
|
|
1733
|
-
mx: (element.width / 2 - 7.5) / element.width,
|
|
1734
|
-
my: (element.height - 20) / element.height
|
|
1735
|
-
}
|
|
1736
|
-
});
|
|
2140
|
+
if (!expanded) {
|
|
2141
|
+
attrs = {};
|
|
2142
|
+
}
|
|
1737
2143
|
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
yScaleFactor: 1,
|
|
1747
|
-
containerWidth: element.width,
|
|
1748
|
-
containerHeight: element.height,
|
|
1749
|
-
position: {
|
|
1750
|
-
mx: ((element.width / 2 + position.parallel) / element.width),
|
|
1751
|
-
my: (element.height - 20) / element.height
|
|
1752
|
-
}
|
|
1753
|
-
});
|
|
2144
|
+
drawRect(
|
|
2145
|
+
parentGfx,
|
|
2146
|
+
getWidth(element, attrs),
|
|
2147
|
+
getHeight(element, attrs),
|
|
2148
|
+
TASK_BORDER_RADIUS - INNER_OUTER_DIST,
|
|
2149
|
+
INNER_OUTER_DIST,
|
|
2150
|
+
innerAttrs
|
|
2151
|
+
);
|
|
1754
2152
|
|
|
1755
|
-
|
|
1756
|
-
fill: getFillColor(element, defaultFillColor),
|
|
1757
|
-
stroke: getStrokeColor(element, defaultStrokeColor)
|
|
1758
|
-
});
|
|
2153
|
+
return outer;
|
|
1759
2154
|
},
|
|
1760
|
-
'
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
containerHeight: element.height,
|
|
1766
|
-
position: {
|
|
1767
|
-
mx: ((element.width / 2 + position.seq) / element.width),
|
|
1768
|
-
my: (element.height - 19) / element.height
|
|
1769
|
-
}
|
|
1770
|
-
});
|
|
2155
|
+
'bpmn:UserTask': function(parentGfx, element, attrs = {}) {
|
|
2156
|
+
attrs = pickAttrs(attrs, [
|
|
2157
|
+
'fill',
|
|
2158
|
+
'stroke'
|
|
2159
|
+
]);
|
|
1771
2160
|
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
containerWidth: element.width,
|
|
1782
|
-
containerHeight: element.height,
|
|
1783
|
-
position: {
|
|
1784
|
-
mx: ((element.width / 2 + position.compensation) / element.width),
|
|
1785
|
-
my: (element.height - 13) / element.height
|
|
2161
|
+
var task = renderTask(parentGfx, element, attrs);
|
|
2162
|
+
|
|
2163
|
+
var x = 15;
|
|
2164
|
+
var y = 12;
|
|
2165
|
+
|
|
2166
|
+
var pathDataUser1 = pathMap.getScaledPath('TASK_TYPE_USER_1', {
|
|
2167
|
+
abspos: {
|
|
2168
|
+
x: x,
|
|
2169
|
+
y: y
|
|
1786
2170
|
}
|
|
1787
2171
|
});
|
|
1788
2172
|
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
2173
|
+
drawPath(parentGfx, pathDataUser1, {
|
|
2174
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
2175
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
2176
|
+
strokeWidth: 0.5
|
|
1793
2177
|
});
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
containerWidth: element.width,
|
|
1800
|
-
containerHeight: element.height,
|
|
1801
|
-
position: {
|
|
1802
|
-
mx: ((element.width / 2 + position.loop) / element.width),
|
|
1803
|
-
my: (element.height - 7) / element.height
|
|
2178
|
+
|
|
2179
|
+
var pathDataUser2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
|
|
2180
|
+
abspos: {
|
|
2181
|
+
x: x,
|
|
2182
|
+
y: y
|
|
1804
2183
|
}
|
|
1805
2184
|
});
|
|
1806
2185
|
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
strokeMiterlimit: 0.5
|
|
2186
|
+
drawPath(parentGfx, pathDataUser2, {
|
|
2187
|
+
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
2188
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
2189
|
+
strokeWidth: 0.5
|
|
1812
2190
|
});
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
containerWidth: element.width,
|
|
1819
|
-
containerHeight: element.height,
|
|
1820
|
-
position: {
|
|
1821
|
-
mx: ((element.width / 2 + position.adhoc) / element.width),
|
|
1822
|
-
my: (element.height - 15) / element.height
|
|
2191
|
+
|
|
2192
|
+
var pathDataUser3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
|
|
2193
|
+
abspos: {
|
|
2194
|
+
x: x,
|
|
2195
|
+
y: y
|
|
1823
2196
|
}
|
|
1824
2197
|
});
|
|
1825
2198
|
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
2199
|
+
drawPath(parentGfx, pathDataUser3, {
|
|
2200
|
+
fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
2201
|
+
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
2202
|
+
strokeWidth: 0.5
|
|
1830
2203
|
});
|
|
1831
|
-
}
|
|
1832
|
-
};
|
|
1833
2204
|
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
var position;
|
|
1839
|
-
|
|
1840
|
-
if (subprocess) {
|
|
1841
|
-
position = {
|
|
1842
|
-
seq: -21,
|
|
1843
|
-
parallel: -22,
|
|
1844
|
-
compensation: -42,
|
|
1845
|
-
loop: -18,
|
|
1846
|
-
adhoc: 10
|
|
1847
|
-
};
|
|
1848
|
-
} else {
|
|
1849
|
-
position = {
|
|
1850
|
-
seq: -3,
|
|
1851
|
-
parallel: -6,
|
|
1852
|
-
compensation: -27,
|
|
1853
|
-
loop: 0,
|
|
1854
|
-
adhoc: 10
|
|
1855
|
-
};
|
|
1856
|
-
}
|
|
1857
|
-
|
|
1858
|
-
forEach(taskMarkers, function(marker) {
|
|
1859
|
-
renderer(marker)(parentGfx, element, position);
|
|
1860
|
-
});
|
|
1861
|
-
|
|
1862
|
-
if (obj.isForCompensation) {
|
|
1863
|
-
renderer('CompensationMarker')(parentGfx, element, position);
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
if (obj.$type === 'bpmn:AdHocSubProcess') {
|
|
1867
|
-
renderer('AdhocMarker')(parentGfx, element, position);
|
|
1868
|
-
}
|
|
1869
|
-
|
|
1870
|
-
var loopCharacteristics = obj.loopCharacteristics,
|
|
1871
|
-
isSequential = loopCharacteristics && loopCharacteristics.isSequential;
|
|
1872
|
-
|
|
1873
|
-
if (loopCharacteristics) {
|
|
1874
|
-
|
|
1875
|
-
if (isSequential === undefined) {
|
|
1876
|
-
renderer('LoopMarker')(parentGfx, element, position);
|
|
1877
|
-
}
|
|
1878
|
-
|
|
1879
|
-
if (isSequential === false) {
|
|
1880
|
-
renderer('ParallelMarker')(parentGfx, element, position);
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1883
|
-
if (isSequential === true) {
|
|
1884
|
-
renderer('SequentialMarker')(parentGfx, element, position);
|
|
1885
|
-
}
|
|
2205
|
+
return task;
|
|
2206
|
+
},
|
|
2207
|
+
'label': function(parentGfx, element, attrs = {}) {
|
|
2208
|
+
return renderExternalLabel(parentGfx, element, attrs);
|
|
1886
2209
|
}
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
function renderDataItemCollection(parentGfx, element) {
|
|
1890
|
-
|
|
1891
|
-
var yPosition = (element.height - 18) / element.height;
|
|
1892
|
-
|
|
1893
|
-
var pathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
|
|
1894
|
-
xScaleFactor: 1,
|
|
1895
|
-
yScaleFactor: 1,
|
|
1896
|
-
containerWidth: element.width,
|
|
1897
|
-
containerHeight: element.height,
|
|
1898
|
-
position: {
|
|
1899
|
-
mx: 0.33,
|
|
1900
|
-
my: yPosition
|
|
1901
|
-
}
|
|
1902
|
-
});
|
|
1903
|
-
|
|
1904
|
-
/* collection path */ drawPath(parentGfx, pathData, {
|
|
1905
|
-
strokeWidth: 2
|
|
1906
|
-
});
|
|
1907
|
-
}
|
|
1908
|
-
|
|
2210
|
+
};
|
|
1909
2211
|
|
|
1910
2212
|
// extension API, use at your own risk
|
|
1911
2213
|
this._drawPath = drawPath;
|
|
@@ -1940,15 +2242,16 @@ BpmnRenderer.prototype.canRender = function(element) {
|
|
|
1940
2242
|
*
|
|
1941
2243
|
* @param {SVGElement} parentGfx
|
|
1942
2244
|
* @param {Element} element
|
|
2245
|
+
* @param {Attrs} [attrs]
|
|
1943
2246
|
*
|
|
1944
2247
|
* @return {SVGElement} mainGfx
|
|
1945
2248
|
*/
|
|
1946
|
-
BpmnRenderer.prototype.drawShape = function(parentGfx, element) {
|
|
1947
|
-
var type = element
|
|
1948
|
-
var h = this._renderer(type);
|
|
2249
|
+
BpmnRenderer.prototype.drawShape = function(parentGfx, element, attrs = {}) {
|
|
2250
|
+
var { type } = element;
|
|
1949
2251
|
|
|
1950
|
-
|
|
1951
|
-
|
|
2252
|
+
var handler = this._renderer(type);
|
|
2253
|
+
|
|
2254
|
+
return handler(parentGfx, element, attrs);
|
|
1952
2255
|
};
|
|
1953
2256
|
|
|
1954
2257
|
/**
|
|
@@ -1956,15 +2259,16 @@ BpmnRenderer.prototype.drawShape = function(parentGfx, element) {
|
|
|
1956
2259
|
*
|
|
1957
2260
|
* @param {SVGElement} parentGfx
|
|
1958
2261
|
* @param {Element} element
|
|
2262
|
+
* @param {Attrs} [attrs]
|
|
1959
2263
|
*
|
|
1960
2264
|
* @return {SVGElement} mainGfx
|
|
1961
2265
|
*/
|
|
1962
|
-
BpmnRenderer.prototype.drawConnection = function(parentGfx, element) {
|
|
1963
|
-
var type = element
|
|
1964
|
-
|
|
2266
|
+
BpmnRenderer.prototype.drawConnection = function(parentGfx, element, attrs = {}) {
|
|
2267
|
+
var { type } = element;
|
|
2268
|
+
|
|
2269
|
+
var handler = this._renderer(type);
|
|
1965
2270
|
|
|
1966
|
-
|
|
1967
|
-
return h(parentGfx, element);
|
|
2271
|
+
return handler(parentGfx, element, attrs);
|
|
1968
2272
|
};
|
|
1969
2273
|
|
|
1970
2274
|
/**
|
|
@@ -1975,7 +2279,6 @@ BpmnRenderer.prototype.drawConnection = function(parentGfx, element) {
|
|
|
1975
2279
|
* @return {string} path
|
|
1976
2280
|
*/
|
|
1977
2281
|
BpmnRenderer.prototype.getShapePath = function(element) {
|
|
1978
|
-
|
|
1979
2282
|
if (is(element, 'bpmn:Event')) {
|
|
1980
2283
|
return getCirclePath(element);
|
|
1981
2284
|
}
|
|
@@ -1990,3 +2293,21 @@ BpmnRenderer.prototype.getShapePath = function(element) {
|
|
|
1990
2293
|
|
|
1991
2294
|
return getRectPath(element);
|
|
1992
2295
|
};
|
|
2296
|
+
|
|
2297
|
+
/**
|
|
2298
|
+
* Pick attributes if they exist.
|
|
2299
|
+
*
|
|
2300
|
+
* @param {Object} attrs
|
|
2301
|
+
* @param {string[]} keys
|
|
2302
|
+
*
|
|
2303
|
+
* @returns {Object}
|
|
2304
|
+
*/
|
|
2305
|
+
function pickAttrs(attrs, keys = []) {
|
|
2306
|
+
return keys.reduce((pickedAttrs, key) => {
|
|
2307
|
+
if (attrs[ key ]) {
|
|
2308
|
+
pickedAttrs[ key ] = attrs[ key ];
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
return pickedAttrs;
|
|
2312
|
+
}, {});
|
|
2313
|
+
}
|