bpmn-js 18.3.2 → 18.5.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 +106 -46
- package/dist/bpmn-modeler.production.min.js +4 -4
- package/dist/bpmn-navigated-viewer.development.js +96 -46
- package/dist/bpmn-navigated-viewer.production.min.js +5 -5
- package/dist/bpmn-viewer.development.js +96 -46
- package/dist/bpmn-viewer.production.min.js +4 -4
- package/lib/draw/BpmnRenderer.js +92 -41
- package/lib/features/context-pad/ContextPadProvider.js +10 -0
- package/lib/import/BpmnTreeWalker.js +2 -3
- package/package.json +1 -1
package/lib/draw/BpmnRenderer.js
CHANGED
|
@@ -462,8 +462,8 @@ export default function BpmnRenderer(
|
|
|
462
462
|
var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
|
|
463
463
|
xScaleFactor: 0.9,
|
|
464
464
|
yScaleFactor: 0.9,
|
|
465
|
-
containerWidth: element.width,
|
|
466
|
-
containerHeight: element.height,
|
|
465
|
+
containerWidth: attrs.width || element.width,
|
|
466
|
+
containerHeight: attrs.height || element.height,
|
|
467
467
|
position: {
|
|
468
468
|
mx: 0.235,
|
|
469
469
|
my: 0.315
|
|
@@ -487,17 +487,23 @@ export default function BpmnRenderer(
|
|
|
487
487
|
return messagePath;
|
|
488
488
|
},
|
|
489
489
|
'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) {
|
|
490
|
-
var
|
|
490
|
+
var baseWidth = attrs.width || element.width;
|
|
491
|
+
var baseHeight = attrs.height || element.height;
|
|
492
|
+
|
|
493
|
+
// use a lighter stroke for event suprocess icons
|
|
494
|
+
var strokeWidth = attrs.width ? 1 : 2;
|
|
495
|
+
|
|
496
|
+
var circle = drawCircle(parentGfx, baseWidth, baseHeight, 0.2 * baseHeight, {
|
|
491
497
|
fill: getFillColor(element, defaultFillColor, attrs.fill),
|
|
492
498
|
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
493
|
-
strokeWidth:
|
|
499
|
+
strokeWidth: strokeWidth
|
|
494
500
|
});
|
|
495
501
|
|
|
496
502
|
var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
|
|
497
503
|
xScaleFactor: 0.75,
|
|
498
504
|
yScaleFactor: 0.75,
|
|
499
|
-
containerWidth:
|
|
500
|
-
containerHeight:
|
|
505
|
+
containerWidth: baseWidth,
|
|
506
|
+
containerHeight: baseHeight,
|
|
501
507
|
position: {
|
|
502
508
|
mx: 0.5,
|
|
503
509
|
my: 0.5
|
|
@@ -506,23 +512,23 @@ export default function BpmnRenderer(
|
|
|
506
512
|
|
|
507
513
|
drawPath(parentGfx, pathData, {
|
|
508
514
|
stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
|
|
509
|
-
strokeWidth:
|
|
515
|
+
strokeWidth: strokeWidth
|
|
510
516
|
});
|
|
511
517
|
|
|
512
518
|
for (var i = 0; i < 12; i++) {
|
|
513
519
|
var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
|
|
514
520
|
xScaleFactor: 0.75,
|
|
515
521
|
yScaleFactor: 0.75,
|
|
516
|
-
containerWidth:
|
|
517
|
-
containerHeight:
|
|
522
|
+
containerWidth: baseWidth,
|
|
523
|
+
containerHeight: baseHeight,
|
|
518
524
|
position: {
|
|
519
525
|
mx: 0.5,
|
|
520
526
|
my: 0.5
|
|
521
527
|
}
|
|
522
528
|
});
|
|
523
529
|
|
|
524
|
-
var width =
|
|
525
|
-
height =
|
|
530
|
+
var width = baseWidth / 2,
|
|
531
|
+
height = baseHeight / 2;
|
|
526
532
|
|
|
527
533
|
drawPath(parentGfx, linePathData, {
|
|
528
534
|
strokeWidth: 1,
|
|
@@ -537,8 +543,8 @@ export default function BpmnRenderer(
|
|
|
537
543
|
var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
|
|
538
544
|
xScaleFactor: 1,
|
|
539
545
|
yScaleFactor: 1,
|
|
540
|
-
containerWidth: event.width,
|
|
541
|
-
containerHeight: event.height,
|
|
546
|
+
containerWidth: attrs.width || event.width,
|
|
547
|
+
containerHeight: attrs.height || event.height,
|
|
542
548
|
position: {
|
|
543
549
|
mx: 0.5,
|
|
544
550
|
my: 0.2
|
|
@@ -559,8 +565,8 @@ export default function BpmnRenderer(
|
|
|
559
565
|
var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
|
|
560
566
|
xScaleFactor: 1,
|
|
561
567
|
yScaleFactor: 1,
|
|
562
|
-
containerWidth: event.width,
|
|
563
|
-
containerHeight: event.height,
|
|
568
|
+
containerWidth: attrs.width || event.width,
|
|
569
|
+
containerHeight: attrs.height || event.height,
|
|
564
570
|
position: {
|
|
565
571
|
mx: 0.5,
|
|
566
572
|
my: 0.222
|
|
@@ -599,8 +605,8 @@ export default function BpmnRenderer(
|
|
|
599
605
|
var pathData = pathMap.getScaledPath('EVENT_ERROR', {
|
|
600
606
|
xScaleFactor: 1.1,
|
|
601
607
|
yScaleFactor: 1.1,
|
|
602
|
-
containerWidth: event.width,
|
|
603
|
-
containerHeight: event.height,
|
|
608
|
+
containerWidth: attrs.width || event.width,
|
|
609
|
+
containerHeight: attrs.height || event.height,
|
|
604
610
|
position: {
|
|
605
611
|
mx: 0.2,
|
|
606
612
|
my: 0.722
|
|
@@ -645,8 +651,8 @@ export default function BpmnRenderer(
|
|
|
645
651
|
var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
|
|
646
652
|
xScaleFactor: 1,
|
|
647
653
|
yScaleFactor: 1,
|
|
648
|
-
containerWidth: event.width,
|
|
649
|
-
containerHeight: event.height,
|
|
654
|
+
containerWidth: attrs.width || event.width,
|
|
655
|
+
containerHeight: attrs.height || event.height,
|
|
650
656
|
position: {
|
|
651
657
|
mx: 0.22,
|
|
652
658
|
my: 0.5
|
|
@@ -667,8 +673,8 @@ export default function BpmnRenderer(
|
|
|
667
673
|
var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
|
|
668
674
|
xScaleFactor: 0.9,
|
|
669
675
|
yScaleFactor: 0.9,
|
|
670
|
-
containerWidth: event.width,
|
|
671
|
-
containerHeight: event.height,
|
|
676
|
+
containerWidth: attrs.width || event.width,
|
|
677
|
+
containerHeight: attrs.height || event.height,
|
|
672
678
|
position: {
|
|
673
679
|
mx: 0.5,
|
|
674
680
|
my: 0.2
|
|
@@ -689,10 +695,10 @@ export default function BpmnRenderer(
|
|
|
689
695
|
var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
|
|
690
696
|
xScaleFactor: 1.1,
|
|
691
697
|
yScaleFactor: 1.1,
|
|
692
|
-
containerWidth: event.width,
|
|
693
|
-
containerHeight: event.height,
|
|
698
|
+
containerWidth: attrs.width || event.width,
|
|
699
|
+
containerHeight: attrs.height || event.height,
|
|
694
700
|
position: {
|
|
695
|
-
mx: 0.
|
|
701
|
+
mx: 0.211,
|
|
696
702
|
my: 0.36
|
|
697
703
|
}
|
|
698
704
|
});
|
|
@@ -703,6 +709,7 @@ export default function BpmnRenderer(
|
|
|
703
709
|
|
|
704
710
|
return drawPath(parentGfx, pathData, {
|
|
705
711
|
fill,
|
|
712
|
+
stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
|
|
706
713
|
strokeWidth: 1
|
|
707
714
|
});
|
|
708
715
|
},
|
|
@@ -710,8 +717,8 @@ export default function BpmnRenderer(
|
|
|
710
717
|
var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
|
|
711
718
|
xScaleFactor: 1.2,
|
|
712
719
|
yScaleFactor: 1.2,
|
|
713
|
-
containerWidth: event.width,
|
|
714
|
-
containerHeight: event.height,
|
|
720
|
+
containerWidth: attrs.width || event.width,
|
|
721
|
+
containerHeight: attrs.height || event.height,
|
|
715
722
|
position: {
|
|
716
723
|
mx: 0.458,
|
|
717
724
|
my: 0.194
|
|
@@ -735,57 +742,59 @@ export default function BpmnRenderer(
|
|
|
735
742
|
}
|
|
736
743
|
};
|
|
737
744
|
|
|
738
|
-
function renderEventIcon(element, parentGfx, attrs = {}) {
|
|
745
|
+
function renderEventIcon(element, parentGfx, attrs = {}, proxyElement) {
|
|
739
746
|
var semantic = getSemantic(element),
|
|
740
747
|
isThrowing = isThrowEvent(semantic);
|
|
741
748
|
|
|
749
|
+
var nodeElement = proxyElement || element;
|
|
750
|
+
|
|
742
751
|
if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
|
|
743
752
|
if (semantic.get('parallelMultiple')) {
|
|
744
|
-
return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx,
|
|
753
|
+
return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
745
754
|
}
|
|
746
755
|
else {
|
|
747
|
-
return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx,
|
|
756
|
+
return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
748
757
|
}
|
|
749
758
|
}
|
|
750
759
|
|
|
751
760
|
if (isTypedEvent(semantic, 'bpmn:MessageEventDefinition')) {
|
|
752
|
-
return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx,
|
|
761
|
+
return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
753
762
|
}
|
|
754
763
|
|
|
755
764
|
if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
|
|
756
|
-
return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx,
|
|
765
|
+
return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
757
766
|
}
|
|
758
767
|
|
|
759
768
|
if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
|
|
760
|
-
return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx,
|
|
769
|
+
return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
761
770
|
}
|
|
762
771
|
|
|
763
772
|
if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
|
|
764
|
-
return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx,
|
|
773
|
+
return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
765
774
|
}
|
|
766
775
|
|
|
767
776
|
if (isTypedEvent(semantic, 'bpmn:EscalationEventDefinition')) {
|
|
768
|
-
return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx,
|
|
777
|
+
return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
769
778
|
}
|
|
770
779
|
|
|
771
780
|
if (isTypedEvent(semantic, 'bpmn:LinkEventDefinition')) {
|
|
772
|
-
return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx,
|
|
781
|
+
return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
773
782
|
}
|
|
774
783
|
|
|
775
784
|
if (isTypedEvent(semantic, 'bpmn:ErrorEventDefinition')) {
|
|
776
|
-
return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx,
|
|
785
|
+
return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
777
786
|
}
|
|
778
787
|
|
|
779
788
|
if (isTypedEvent(semantic, 'bpmn:CancelEventDefinition')) {
|
|
780
|
-
return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx,
|
|
789
|
+
return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
781
790
|
}
|
|
782
791
|
|
|
783
792
|
if (isTypedEvent(semantic, 'bpmn:CompensateEventDefinition')) {
|
|
784
|
-
return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx,
|
|
793
|
+
return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
785
794
|
}
|
|
786
795
|
|
|
787
796
|
if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
|
|
788
|
-
return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx,
|
|
797
|
+
return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
|
|
789
798
|
}
|
|
790
799
|
|
|
791
800
|
return null;
|
|
@@ -1207,14 +1216,23 @@ export default function BpmnRenderer(
|
|
|
1207
1216
|
function renderSubProcess(parentGfx, element, attrs = {}) {
|
|
1208
1217
|
var activity = renderActivity(parentGfx, element, attrs);
|
|
1209
1218
|
|
|
1219
|
+
var expanded = isExpanded(element);
|
|
1220
|
+
|
|
1210
1221
|
if (isEventSubProcess(element)) {
|
|
1211
1222
|
svgAttr(activity, {
|
|
1212
1223
|
strokeDasharray: '0, 5.5',
|
|
1213
1224
|
strokeWidth: 2.5
|
|
1214
1225
|
});
|
|
1215
|
-
}
|
|
1216
1226
|
|
|
1217
|
-
|
|
1227
|
+
if (!expanded) {
|
|
1228
|
+
var flowElements = getSemantic(element).flowElements || [];
|
|
1229
|
+
var startEvents = flowElements.filter(e => is(e, 'bpmn:StartEvent'));
|
|
1230
|
+
|
|
1231
|
+
if (startEvents.length === 1) {
|
|
1232
|
+
renderEventSubProcessIcon(startEvents[0], parentGfx, attrs, element);
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1218
1236
|
|
|
1219
1237
|
renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle', attrs);
|
|
1220
1238
|
|
|
@@ -1227,6 +1245,39 @@ export default function BpmnRenderer(
|
|
|
1227
1245
|
return activity;
|
|
1228
1246
|
}
|
|
1229
1247
|
|
|
1248
|
+
function renderEventSubProcessIcon(startEvent, parentGfx, attrs, proxyElement) {
|
|
1249
|
+
var iconSize = 22;
|
|
1250
|
+
|
|
1251
|
+
// match the colors of the enclosing subprocess
|
|
1252
|
+
var proxyAttrs = {
|
|
1253
|
+
fill: getFillColor(proxyElement, defaultFillColor, attrs.fill),
|
|
1254
|
+
stroke: getStrokeColor(proxyElement, defaultStrokeColor, attrs.stroke),
|
|
1255
|
+
width: iconSize,
|
|
1256
|
+
height: iconSize
|
|
1257
|
+
};
|
|
1258
|
+
|
|
1259
|
+
var interrupting = getSemantic(startEvent).isInterrupting;
|
|
1260
|
+
var strokeDasharray = interrupting ? 0 : 3;
|
|
1261
|
+
|
|
1262
|
+
// better visibility for non-interrupting events
|
|
1263
|
+
var strokeWidth = interrupting ? 1 : 1.2;
|
|
1264
|
+
|
|
1265
|
+
// make the icon look larger by drawing a smaller circle
|
|
1266
|
+
var circleSize = 20;
|
|
1267
|
+
var shift = (iconSize - circleSize) / 2;
|
|
1268
|
+
var transform = 'translate(' + shift + ',' + shift + ')';
|
|
1269
|
+
|
|
1270
|
+
drawCircle(parentGfx, circleSize, circleSize, {
|
|
1271
|
+
fill: proxyAttrs.fill,
|
|
1272
|
+
stroke: proxyAttrs.stroke,
|
|
1273
|
+
strokeWidth,
|
|
1274
|
+
strokeDasharray,
|
|
1275
|
+
transform
|
|
1276
|
+
});
|
|
1277
|
+
|
|
1278
|
+
renderEventIcon(startEvent, parentGfx, proxyAttrs, proxyElement);
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1230
1281
|
function renderTask(parentGfx, element, attrs = {}) {
|
|
1231
1282
|
var activity = renderActivity(parentGfx, element, attrs);
|
|
1232
1283
|
|
|
@@ -485,6 +485,16 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
487
|
|
|
488
|
+
if (is(businessObject, 'bpmn:MessageFlow')) {
|
|
489
|
+
assign(actions, {
|
|
490
|
+
'append.text-annotation': appendAction(
|
|
491
|
+
'bpmn:TextAnnotation',
|
|
492
|
+
'bpmn-icon-text-annotation',
|
|
493
|
+
translate('Add text annotation')
|
|
494
|
+
)
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
|
|
488
498
|
if (
|
|
489
499
|
isAny(businessObject, [
|
|
490
500
|
'bpmn:FlowNode',
|
|
@@ -430,12 +430,11 @@ export default function BpmnTreeWalker(handler) {
|
|
|
430
430
|
|
|
431
431
|
forEach(collaboration.participants, contextual(handleParticipant, context));
|
|
432
432
|
|
|
433
|
-
handleArtifacts(collaboration.artifacts, context);
|
|
434
|
-
|
|
435
|
-
// handle message flows latest in the process
|
|
436
433
|
deferred.push(function() {
|
|
437
434
|
handleMessageFlows(collaboration.messageFlows, context);
|
|
438
435
|
});
|
|
436
|
+
|
|
437
|
+
handleArtifacts(collaboration.artifacts, context);
|
|
439
438
|
}
|
|
440
439
|
|
|
441
440
|
|