bpmn-js 18.6.1 → 18.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v18.6.1
2
+ * bpmn-js - bpmn-modeler v18.6.3
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2025-04-25
11
+ * Date: 2025-08-19
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -12519,94 +12519,94 @@
12519
12519
  return prefixMap;
12520
12520
  }
12521
12521
 
12522
- /**
12523
- * A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.
12524
- *
12525
- * @class BpmnModdle
12526
- * @extends Moddle
12527
- *
12528
- * @param {Object|Array} packages to use for instantiating the model
12529
- * @param {Object} [options] additional options to pass over
12530
- */
12531
- function BpmnModdle(packages, options) {
12532
- Moddle.call(this, packages, options);
12533
- }
12534
-
12535
- BpmnModdle.prototype = Object.create(Moddle.prototype);
12536
-
12537
- /**
12538
- * The fromXML result.
12539
- *
12540
- * @typedef {Object} ParseResult
12541
- *
12542
- * @property {ModdleElement} rootElement
12543
- * @property {Array<Object>} references
12544
- * @property {Array<Error>} warnings
12545
- * @property {Object} elementsById - a mapping containing each ID -> ModdleElement
12546
- */
12547
-
12548
- /**
12549
- * The fromXML error.
12550
- *
12551
- * @typedef {Error} ParseError
12552
- *
12553
- * @property {Array<Error>} warnings
12554
- */
12555
-
12556
- /**
12557
- * Instantiates a BPMN model tree from a given xml string.
12558
- *
12559
- * @param {String} xmlStr
12560
- * @param {String} [typeName='bpmn:Definitions'] name of the root element
12561
- * @param {Object} [options] options to pass to the underlying reader
12562
- *
12563
- * @returns {Promise<ParseResult, ParseError>}
12564
- */
12565
- BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {
12566
-
12567
- if (!isString(typeName)) {
12568
- options = typeName;
12569
- typeName = 'bpmn:Definitions';
12570
- }
12571
-
12572
- var reader = new Reader(assign$1({ model: this, lax: true }, options));
12573
- var rootHandler = reader.handler(typeName);
12574
-
12575
- return reader.fromXML(xmlStr, rootHandler);
12576
- };
12577
-
12578
-
12579
- /**
12580
- * The toXML result.
12581
- *
12582
- * @typedef {Object} SerializationResult
12583
- *
12584
- * @property {String} xml
12585
- */
12586
-
12587
- /**
12588
- * Serializes a BPMN 2.0 object tree to XML.
12589
- *
12590
- * @param {String} element the root element, typically an instance of `bpmn:Definitions`
12591
- * @param {Object} [options] to pass to the underlying writer
12592
- *
12593
- * @returns {Promise<SerializationResult, Error>}
12594
- */
12595
- BpmnModdle.prototype.toXML = function(element, options) {
12596
-
12597
- var writer = new Writer(options);
12598
-
12599
- return new Promise(function(resolve, reject) {
12600
- try {
12601
- var result = writer.toXML(element);
12602
-
12603
- return resolve({
12604
- xml: result
12605
- });
12606
- } catch (err) {
12607
- return reject(err);
12608
- }
12609
- });
12522
+ /**
12523
+ * A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.
12524
+ *
12525
+ * @class BpmnModdle
12526
+ * @extends Moddle
12527
+ *
12528
+ * @param {Object|Array} packages to use for instantiating the model
12529
+ * @param {Object} [options] additional options to pass over
12530
+ */
12531
+ function BpmnModdle(packages, options) {
12532
+ Moddle.call(this, packages, options);
12533
+ }
12534
+
12535
+ BpmnModdle.prototype = Object.create(Moddle.prototype);
12536
+
12537
+ /**
12538
+ * The fromXML result.
12539
+ *
12540
+ * @typedef {Object} ParseResult
12541
+ *
12542
+ * @property {ModdleElement} rootElement
12543
+ * @property {Array<Object>} references
12544
+ * @property {Array<Error>} warnings
12545
+ * @property {Object} elementsById - a mapping containing each ID -> ModdleElement
12546
+ */
12547
+
12548
+ /**
12549
+ * The fromXML error.
12550
+ *
12551
+ * @typedef {Error} ParseError
12552
+ *
12553
+ * @property {Array<Error>} warnings
12554
+ */
12555
+
12556
+ /**
12557
+ * Instantiates a BPMN model tree from a given xml string.
12558
+ *
12559
+ * @param {String} xmlStr
12560
+ * @param {String} [typeName='bpmn:Definitions'] name of the root element
12561
+ * @param {Object} [options] options to pass to the underlying reader
12562
+ *
12563
+ * @returns {Promise<ParseResult, ParseError>}
12564
+ */
12565
+ BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {
12566
+
12567
+ if (!isString(typeName)) {
12568
+ options = typeName;
12569
+ typeName = 'bpmn:Definitions';
12570
+ }
12571
+
12572
+ var reader = new Reader(assign$1({ model: this, lax: true }, options));
12573
+ var rootHandler = reader.handler(typeName);
12574
+
12575
+ return reader.fromXML(xmlStr, rootHandler);
12576
+ };
12577
+
12578
+
12579
+ /**
12580
+ * The toXML result.
12581
+ *
12582
+ * @typedef {Object} SerializationResult
12583
+ *
12584
+ * @property {String} xml
12585
+ */
12586
+
12587
+ /**
12588
+ * Serializes a BPMN 2.0 object tree to XML.
12589
+ *
12590
+ * @param {String} element the root element, typically an instance of `bpmn:Definitions`
12591
+ * @param {Object} [options] to pass to the underlying writer
12592
+ *
12593
+ * @returns {Promise<SerializationResult, Error>}
12594
+ */
12595
+ BpmnModdle.prototype.toXML = function(element, options) {
12596
+
12597
+ var writer = new Writer(options);
12598
+
12599
+ return new Promise(function(resolve, reject) {
12600
+ try {
12601
+ var result = writer.toXML(element);
12602
+
12603
+ return resolve({
12604
+ xml: result
12605
+ });
12606
+ } catch (err) {
12607
+ return reject(err);
12608
+ }
12609
+ });
12610
12610
  };
12611
12611
 
12612
12612
  var name$5 = "BPMN20";
@@ -13459,7 +13459,6 @@
13459
13459
  {
13460
13460
  name: "operationRef",
13461
13461
  type: "Operation",
13462
- isAttr: true,
13463
13462
  isReference: true
13464
13463
  }
13465
13464
  ]
@@ -15211,7 +15210,6 @@
15211
15210
  },
15212
15211
  {
15213
15212
  name: "cancelRemainingInstances",
15214
- "default": true,
15215
15213
  isAttr: true,
15216
15214
  type: "Boolean"
15217
15215
  }
@@ -16245,19 +16243,19 @@
16245
16243
  associations: associations
16246
16244
  };
16247
16245
 
16248
- const packages = {
16249
- bpmn: BpmnPackage,
16250
- bpmndi: BpmnDiPackage,
16251
- dc: DcPackage,
16252
- di: DiPackage,
16253
- bioc: BiocPackage,
16254
- color: BpmnInColorPackage
16255
- };
16256
-
16257
- function SimpleBpmnModdle(additionalPackages, options) {
16258
- const pks = assign$1({}, packages, additionalPackages);
16259
-
16260
- return new BpmnModdle(pks, options);
16246
+ const packages = {
16247
+ bpmn: BpmnPackage,
16248
+ bpmndi: BpmnDiPackage,
16249
+ dc: DcPackage,
16250
+ di: DiPackage,
16251
+ bioc: BiocPackage,
16252
+ color: BpmnInColorPackage
16253
+ };
16254
+
16255
+ function SimpleBpmnModdle(additionalPackages, options) {
16256
+ const pks = assign$1({}, packages, additionalPackages);
16257
+
16258
+ return new BpmnModdle(pks, options);
16261
16259
  }
16262
16260
 
16263
16261
  function elementToString(e) {
@@ -18582,2329 +18580,2351 @@
18582
18580
  return has$1(overrides, 'height') ? overrides.height : bounds.height;
18583
18581
  }
18584
18582
 
18585
- var markerIds = new Ids$1();
18586
-
18587
- var ELEMENT_LABEL_DISTANCE$1 = 10,
18588
- INNER_OUTER_DIST = 3,
18589
- PARTICIPANT_STROKE_WIDTH = 1.5,
18590
- TASK_BORDER_RADIUS = 10;
18591
-
18592
- var DEFAULT_OPACITY = 0.95,
18593
- FULL_OPACITY = 1,
18594
- LOW_OPACITY = 0.25;
18595
-
18596
- /**
18597
- * @typedef { Partial<{
18598
- * defaultFillColor: string,
18599
- * defaultStrokeColor: string,
18600
- * defaultLabelColor: string
18601
- * }> } BpmnRendererConfig
18602
- *
18603
- * @typedef { Partial<{
18604
- * fill: string,
18605
- * stroke: string,
18606
- * width: string,
18607
- * height: string
18608
- * }> } Attrs
18609
- */
18610
-
18611
- /**
18612
- * @typedef { import('../model/Types').Element } Element
18613
- * @typedef { import('../model/Types').Shape } Shape
18614
- * @typedef { import('../model/Types').Connection } Connection
18615
- */
18616
-
18617
- /**
18618
- * A renderer for BPMN elements
18619
- *
18620
- * @param {BpmnRendererConfig} config
18621
- * @param {import('diagram-js/lib/core/EventBus').default} eventBus
18622
- * @param {import('diagram-js/lib/draw/Styles').default} styles
18623
- * @param {import('./PathMap').default} pathMap
18624
- * @param {import('diagram-js/lib/core/Canvas').default} canvas
18625
- * @param {import('./TextRenderer').default} textRenderer
18626
- * @param {number} [priority]
18627
- */
18628
- function BpmnRenderer(
18629
- config, eventBus, styles, pathMap,
18630
- canvas, textRenderer, priority) {
18631
-
18632
- BaseRenderer.call(this, eventBus, priority);
18633
-
18634
- var defaultFillColor = config && config.defaultFillColor,
18635
- defaultStrokeColor = config && config.defaultStrokeColor,
18636
- defaultLabelColor = config && config.defaultLabelColor;
18637
-
18638
- function shapeStyle(attrs) {
18639
- return styles.computeStyle(attrs, {
18640
- strokeLinecap: 'round',
18641
- strokeLinejoin: 'round',
18642
- stroke: black,
18643
- strokeWidth: 2,
18644
- fill: 'white'
18645
- });
18646
- }
18647
-
18648
- function lineStyle(attrs) {
18649
- return styles.computeStyle(attrs, [ 'no-fill' ], {
18650
- strokeLinecap: 'round',
18651
- strokeLinejoin: 'round',
18652
- stroke: black,
18653
- strokeWidth: 2
18654
- });
18655
- }
18656
-
18657
- function addMarker(id, options) {
18658
- var {
18659
- ref = { x: 0, y: 0 },
18660
- scale = 1,
18661
- element,
18662
- parentGfx = canvas._svg
18663
- } = options;
18664
-
18665
- var marker = create$1('marker', {
18666
- id: id,
18667
- viewBox: '0 0 20 20',
18668
- refX: ref.x,
18669
- refY: ref.y,
18670
- markerWidth: 20 * scale,
18671
- markerHeight: 20 * scale,
18672
- orient: 'auto'
18673
- });
18674
-
18675
- append(marker, element);
18676
-
18677
- var defs = query(':scope > defs', parentGfx);
18678
-
18679
- if (!defs) {
18680
- defs = create$1('defs');
18681
-
18682
- append(parentGfx, defs);
18683
- }
18684
-
18685
- append(defs, marker);
18686
- }
18687
-
18688
- function marker(parentGfx, type, fill, stroke) {
18689
-
18690
-
18691
- var id = markerIds.nextPrefixed('marker-');
18692
-
18693
- createMarker(parentGfx, id, type, fill, stroke);
18694
-
18695
- return 'url(#' + id + ')';
18696
- }
18697
-
18698
- function createMarker(parentGfx, id, type, fill, stroke) {
18699
-
18700
- if (type === 'sequenceflow-end') {
18701
- var sequenceflowEnd = create$1('path', {
18702
- d: 'M 1 5 L 11 10 L 1 15 Z',
18703
- ...shapeStyle({
18704
- fill: stroke,
18705
- stroke: stroke,
18706
- strokeWidth: 1
18707
- })
18708
- });
18709
-
18710
- addMarker(id, {
18711
- element: sequenceflowEnd,
18712
- ref: { x: 11, y: 10 },
18713
- scale: 0.5,
18714
- parentGfx
18715
- });
18716
- }
18717
-
18718
- if (type === 'messageflow-start') {
18719
- var messageflowStart = create$1('circle', {
18720
- cx: 6,
18721
- cy: 6,
18722
- r: 3.5,
18723
- ...shapeStyle({
18724
- fill,
18725
- stroke: stroke,
18726
- strokeWidth: 1,
18727
-
18728
- // fix for safari / chrome / firefox bug not correctly
18729
- // resetting stroke dash array
18730
- strokeDasharray: [ 10000, 1 ]
18731
- })
18732
- });
18733
-
18734
- addMarker(id, {
18735
- element: messageflowStart,
18736
- ref: { x: 6, y: 6 },
18737
- parentGfx
18738
- });
18739
- }
18740
-
18741
- if (type === 'messageflow-end') {
18742
- var messageflowEnd = create$1('path', {
18743
- d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
18744
- ...shapeStyle({
18745
- fill,
18746
- stroke: stroke,
18747
- strokeWidth: 1,
18748
-
18749
- // fix for safari / chrome / firefox bug not correctly
18750
- // resetting stroke dash array
18751
- strokeDasharray: [ 10000, 1 ]
18752
- })
18753
- });
18754
-
18755
- addMarker(id, {
18756
- element: messageflowEnd,
18757
- ref: { x: 8.5, y: 5 },
18758
- parentGfx
18759
- });
18760
- }
18761
-
18762
- if (type === 'association-start') {
18763
- var associationStart = create$1('path', {
18764
- d: 'M 11 5 L 1 10 L 11 15',
18765
- ...lineStyle({
18766
- fill: 'none',
18767
- stroke,
18768
- strokeWidth: 1.5,
18769
-
18770
- // fix for safari / chrome / firefox bug not correctly
18771
- // resetting stroke dash array
18772
- strokeDasharray: [ 10000, 1 ]
18773
- })
18774
- });
18775
-
18776
- addMarker(id, {
18777
- element: associationStart,
18778
- ref: { x: 1, y: 10 },
18779
- scale: 0.5,
18780
- parentGfx
18781
- });
18782
- }
18783
-
18784
- if (type === 'association-end') {
18785
- var associationEnd = create$1('path', {
18786
- d: 'M 1 5 L 11 10 L 1 15',
18787
- ...lineStyle({
18788
- fill: 'none',
18789
- stroke,
18790
- strokeWidth: 1.5,
18791
-
18792
- // fix for safari / chrome / firefox bug not correctly
18793
- // resetting stroke dash array
18794
- strokeDasharray: [ 10000, 1 ]
18795
- })
18796
- });
18797
-
18798
- addMarker(id, {
18799
- element: associationEnd,
18800
- ref: { x: 11, y: 10 },
18801
- scale: 0.5,
18802
- parentGfx
18803
- });
18804
- }
18805
-
18806
- if (type === 'conditional-flow-marker') {
18807
- var conditionalFlowMarker = create$1('path', {
18808
- d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
18809
- ...shapeStyle({
18810
- fill,
18811
- stroke: stroke
18812
- })
18813
- });
18814
-
18815
- addMarker(id, {
18816
- element: conditionalFlowMarker,
18817
- ref: { x: -1, y: 10 },
18818
- scale: 0.5,
18819
- parentGfx
18820
- });
18821
- }
18822
-
18823
- if (type === 'conditional-default-flow-marker') {
18824
- var defaultFlowMarker = create$1('path', {
18825
- d: 'M 6 4 L 10 16',
18826
- ...shapeStyle({
18827
- stroke: stroke,
18828
- fill: 'none'
18829
- })
18830
- });
18831
-
18832
- addMarker(id, {
18833
- element: defaultFlowMarker,
18834
- ref: { x: 0, y: 10 },
18835
- scale: 0.5,
18836
- parentGfx
18837
- });
18838
- }
18839
- }
18840
-
18841
- function drawCircle(parentGfx, width, height, offset, attrs = {}) {
18842
-
18843
- if (isObject(offset)) {
18844
- attrs = offset;
18845
- offset = 0;
18846
- }
18847
-
18848
- offset = offset || 0;
18849
-
18850
- attrs = shapeStyle(attrs);
18851
-
18852
- var cx = width / 2,
18853
- cy = height / 2;
18854
-
18855
- var circle = create$1('circle', {
18856
- cx: cx,
18857
- cy: cy,
18858
- r: Math.round((width + height) / 4 - offset),
18859
- ...attrs
18860
- });
18861
-
18862
- append(parentGfx, circle);
18863
-
18864
- return circle;
18865
- }
18866
-
18867
- function drawRect(parentGfx, width, height, r, offset, attrs) {
18868
-
18869
- if (isObject(offset)) {
18870
- attrs = offset;
18871
- offset = 0;
18872
- }
18873
-
18874
- offset = offset || 0;
18875
-
18876
- attrs = shapeStyle(attrs);
18877
-
18878
- var rect = create$1('rect', {
18879
- x: offset,
18880
- y: offset,
18881
- width: width - offset * 2,
18882
- height: height - offset * 2,
18883
- rx: r,
18884
- ry: r,
18885
- ...attrs
18886
- });
18887
-
18888
- append(parentGfx, rect);
18889
-
18890
- return rect;
18891
- }
18892
-
18893
- function drawDiamond(parentGfx, width, height, attrs) {
18894
-
18895
- var x_2 = width / 2;
18896
- var y_2 = height / 2;
18897
-
18898
- var points = [
18899
- { x: x_2, y: 0 },
18900
- { x: width, y: y_2 },
18901
- { x: x_2, y: height },
18902
- { x: 0, y: y_2 }
18903
- ];
18904
-
18905
- var pointsString = points.map(function(point) {
18906
- return point.x + ',' + point.y;
18907
- }).join(' ');
18908
-
18909
- attrs = shapeStyle(attrs);
18910
-
18911
- var polygon = create$1('polygon', {
18912
- ...attrs,
18913
- points: pointsString
18914
- });
18915
-
18916
- append(parentGfx, polygon);
18917
-
18918
- return polygon;
18919
- }
18920
-
18921
- /**
18922
- * @param {SVGElement} parentGfx
18923
- * @param {Point[]} waypoints
18924
- * @param {any} attrs
18925
- * @param {number} [radius]
18926
- *
18927
- * @return {SVGElement}
18928
- */
18929
- function drawLine(parentGfx, waypoints, attrs, radius) {
18930
- attrs = lineStyle(attrs);
18931
-
18932
- var line = createLine(waypoints, attrs, radius);
18933
-
18934
- append(parentGfx, line);
18935
-
18936
- return line;
18937
- }
18938
-
18939
- /**
18940
- * @param {SVGElement} parentGfx
18941
- * @param {Point[]} waypoints
18942
- * @param {any} attrs
18943
- *
18944
- * @return {SVGElement}
18945
- */
18946
- function drawConnectionSegments(parentGfx, waypoints, attrs) {
18947
- return drawLine(parentGfx, waypoints, attrs, 5);
18948
- }
18949
-
18950
- function drawPath(parentGfx, d, attrs) {
18951
- attrs = lineStyle(attrs);
18952
-
18953
- var path = create$1('path', {
18954
- ...attrs,
18955
- d
18956
- });
18957
-
18958
- append(parentGfx, path);
18959
-
18960
- return path;
18961
- }
18962
-
18963
- function drawMarker(type, parentGfx, path, attrs) {
18964
- return drawPath(parentGfx, path, assign$1({ 'data-marker': type }, attrs));
18965
- }
18966
-
18967
- function renderer(type) {
18968
- return handlers[type];
18969
- }
18970
-
18971
- function as(type) {
18972
- return function(parentGfx, element, attrs) {
18973
- return renderer(type)(parentGfx, element, attrs);
18974
- };
18975
- }
18976
-
18977
- var eventIconRenderers = {
18978
- 'bpmn:MessageEventDefinition': function(parentGfx, element, attrs = {}, isThrowing) {
18979
- var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
18980
- xScaleFactor: 0.9,
18981
- yScaleFactor: 0.9,
18982
- containerWidth: attrs.width || element.width,
18983
- containerHeight: attrs.height || element.height,
18984
- position: {
18985
- mx: 0.235,
18986
- my: 0.315
18987
- }
18988
- });
18989
-
18990
- var fill = isThrowing
18991
- ? getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
18992
- : getFillColor(element, defaultFillColor, attrs.fill);
18993
-
18994
- var stroke = isThrowing
18995
- ? getFillColor(element, defaultFillColor, attrs.fill)
18996
- : getStrokeColor$1(element, defaultStrokeColor, attrs.stroke);
18997
-
18998
- var messagePath = drawPath(parentGfx, pathData, {
18999
- fill,
19000
- stroke,
19001
- strokeWidth: 1
19002
- });
19003
-
19004
- return messagePath;
19005
- },
19006
- 'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) {
19007
- var baseWidth = attrs.width || element.width;
19008
- var baseHeight = attrs.height || element.height;
19009
-
19010
- // use a lighter stroke for event suprocess icons
19011
- var strokeWidth = attrs.width ? 1 : 2;
19012
-
19013
- var circle = drawCircle(parentGfx, baseWidth, baseHeight, 0.2 * baseHeight, {
19014
- fill: getFillColor(element, defaultFillColor, attrs.fill),
19015
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19016
- strokeWidth: strokeWidth
19017
- });
19018
-
19019
- var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
19020
- xScaleFactor: 0.75,
19021
- yScaleFactor: 0.75,
19022
- containerWidth: baseWidth,
19023
- containerHeight: baseHeight,
19024
- position: {
19025
- mx: 0.5,
19026
- my: 0.5
19027
- }
19028
- });
19029
-
19030
- drawPath(parentGfx, pathData, {
19031
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19032
- strokeWidth: strokeWidth
19033
- });
19034
-
19035
- for (var i = 0; i < 12; i++) {
19036
- var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
19037
- xScaleFactor: 0.75,
19038
- yScaleFactor: 0.75,
19039
- containerWidth: baseWidth,
19040
- containerHeight: baseHeight,
19041
- position: {
19042
- mx: 0.5,
19043
- my: 0.5
19044
- }
19045
- });
19046
-
19047
- var width = baseWidth / 2,
19048
- height = baseHeight / 2;
19049
-
19050
- drawPath(parentGfx, linePathData, {
19051
- strokeWidth: 1,
19052
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19053
- transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')'
19054
- });
19055
- }
19056
-
19057
- return circle;
19058
- },
19059
- 'bpmn:EscalationEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
19060
- var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
19061
- xScaleFactor: 1,
19062
- yScaleFactor: 1,
19063
- containerWidth: attrs.width || event.width,
19064
- containerHeight: attrs.height || event.height,
19065
- position: {
19066
- mx: 0.5,
19067
- my: 0.2
19068
- }
19069
- });
19070
-
19071
- var fill = isThrowing
19072
- ? getStrokeColor$1(event, defaultStrokeColor, attrs.stroke)
19073
- : getFillColor(event, defaultFillColor, attrs.fill);
19074
-
19075
- return drawPath(parentGfx, pathData, {
19076
- fill,
19077
- stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19078
- strokeWidth: 1
19079
- });
19080
- },
19081
- 'bpmn:ConditionalEventDefinition': function(parentGfx, event, attrs = {}) {
19082
- var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
19083
- xScaleFactor: 1,
19084
- yScaleFactor: 1,
19085
- containerWidth: attrs.width || event.width,
19086
- containerHeight: attrs.height || event.height,
19087
- position: {
19088
- mx: 0.5,
19089
- my: 0.222
19090
- }
19091
- });
19092
-
19093
- return drawPath(parentGfx, pathData, {
19094
- fill: getFillColor(event, defaultFillColor, attrs.fill),
19095
- stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19096
- strokeWidth: 1
19097
- });
19098
- },
19099
- 'bpmn:LinkEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
19100
- var pathData = pathMap.getScaledPath('EVENT_LINK', {
19101
- xScaleFactor: 1,
19102
- yScaleFactor: 1,
19103
- containerWidth: event.width,
19104
- containerHeight: event.height,
19105
- position: {
19106
- mx: 0.57,
19107
- my: 0.263
19108
- }
19109
- });
19110
-
19111
- var fill = isThrowing
19112
- ? getStrokeColor$1(event, defaultStrokeColor, attrs.stroke)
19113
- : getFillColor(event, defaultFillColor, attrs.fill);
19114
-
19115
- return drawPath(parentGfx, pathData, {
19116
- fill,
19117
- stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19118
- strokeWidth: 1
19119
- });
19120
- },
19121
- 'bpmn:ErrorEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
19122
- var pathData = pathMap.getScaledPath('EVENT_ERROR', {
19123
- xScaleFactor: 1.1,
19124
- yScaleFactor: 1.1,
19125
- containerWidth: attrs.width || event.width,
19126
- containerHeight: attrs.height || event.height,
19127
- position: {
19128
- mx: 0.2,
19129
- my: 0.722
19130
- }
19131
- });
19132
-
19133
- var fill = isThrowing
19134
- ? getStrokeColor$1(event, defaultStrokeColor, attrs.stroke)
19135
- : getFillColor(event, defaultFillColor, attrs.fill);
19136
-
19137
- return drawPath(parentGfx, pathData, {
19138
- fill,
19139
- stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19140
- strokeWidth: 1
19141
- });
19142
- },
19143
- 'bpmn:CancelEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
19144
- var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
19145
- xScaleFactor: 1.0,
19146
- yScaleFactor: 1.0,
19147
- containerWidth: event.width,
19148
- containerHeight: event.height,
19149
- position: {
19150
- mx: 0.638,
19151
- my: -0.055
19152
- }
19153
- });
19154
-
19155
- var fill = isThrowing ? getStrokeColor$1(event, defaultStrokeColor, attrs.stroke) : 'none';
19156
-
19157
- var path = drawPath(parentGfx, pathData, {
19158
- fill,
19159
- stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19160
- strokeWidth: 1
19161
- });
19162
-
19163
- rotate(path, 45);
19164
-
19165
- return path;
19166
- },
19167
- 'bpmn:CompensateEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
19168
- var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
19169
- xScaleFactor: 1,
19170
- yScaleFactor: 1,
19171
- containerWidth: attrs.width || event.width,
19172
- containerHeight: attrs.height || event.height,
19173
- position: {
19174
- mx: 0.22,
19175
- my: 0.5
19176
- }
19177
- });
19178
-
19179
- var fill = isThrowing
19180
- ? getStrokeColor$1(event, defaultStrokeColor, attrs.stroke)
19181
- : getFillColor(event, defaultFillColor, attrs.fill);
19182
-
19183
- return drawPath(parentGfx, pathData, {
19184
- fill,
19185
- stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19186
- strokeWidth: 1
19187
- });
19188
- },
19189
- 'bpmn:SignalEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
19190
- var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
19191
- xScaleFactor: 0.9,
19192
- yScaleFactor: 0.9,
19193
- containerWidth: attrs.width || event.width,
19194
- containerHeight: attrs.height || event.height,
19195
- position: {
19196
- mx: 0.5,
19197
- my: 0.2
19198
- }
19199
- });
19200
-
19201
- var fill = isThrowing
19202
- ? getStrokeColor$1(event, defaultStrokeColor, attrs.stroke)
19203
- : getFillColor(event, defaultFillColor, attrs.fill);
19204
-
19205
- return drawPath(parentGfx, pathData, {
19206
- strokeWidth: 1,
19207
- fill,
19208
- stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke)
19209
- });
19210
- },
19211
- 'bpmn:MultipleEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
19212
- var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
19213
- xScaleFactor: 1.1,
19214
- yScaleFactor: 1.1,
19215
- containerWidth: attrs.width || event.width,
19216
- containerHeight: attrs.height || event.height,
19217
- position: {
19218
- mx: 0.211,
19219
- my: 0.36
19220
- }
19221
- });
19222
-
19223
- var fill = isThrowing
19224
- ? getStrokeColor$1(event, defaultStrokeColor, attrs.stroke)
19225
- : getFillColor(event, defaultFillColor, attrs.fill);
19226
-
19227
- return drawPath(parentGfx, pathData, {
19228
- fill,
19229
- stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19230
- strokeWidth: 1
19231
- });
19232
- },
19233
- 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event, attrs = {}) {
19234
- var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
19235
- xScaleFactor: 1.2,
19236
- yScaleFactor: 1.2,
19237
- containerWidth: attrs.width || event.width,
19238
- containerHeight: attrs.height || event.height,
19239
- position: {
19240
- mx: 0.458,
19241
- my: 0.194
19242
- }
19243
- });
19244
-
19245
- return drawPath(parentGfx, pathData, {
19246
- fill: getFillColor(event, defaultFillColor, attrs.fill),
19247
- stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19248
- strokeWidth: 1
19249
- });
19250
- },
19251
- 'bpmn:TerminateEventDefinition': function(parentGfx, element, attrs = {}) {
19252
- var circle = drawCircle(parentGfx, element.width, element.height, 8, {
19253
- fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19254
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19255
- strokeWidth: 4
19256
- });
19257
-
19258
- return circle;
19259
- }
19260
- };
19261
-
19262
- function renderEventIcon(element, parentGfx, attrs = {}, proxyElement) {
19263
- var semantic = getBusinessObject(element),
19264
- isThrowing = isThrowEvent(semantic);
19265
-
19266
- var nodeElement = proxyElement || element;
19267
-
19268
- if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
19269
- if (semantic.get('parallelMultiple')) {
19270
- return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19271
- }
19272
- else {
19273
- return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19274
- }
19275
- }
19276
-
19277
- if (isTypedEvent(semantic, 'bpmn:MessageEventDefinition')) {
19278
- return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19279
- }
19280
-
19281
- if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
19282
- return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19283
- }
19284
-
19285
- if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
19286
- return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19287
- }
19288
-
19289
- if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
19290
- return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19291
- }
19292
-
19293
- if (isTypedEvent(semantic, 'bpmn:EscalationEventDefinition')) {
19294
- return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19295
- }
19296
-
19297
- if (isTypedEvent(semantic, 'bpmn:LinkEventDefinition')) {
19298
- return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19299
- }
19300
-
19301
- if (isTypedEvent(semantic, 'bpmn:ErrorEventDefinition')) {
19302
- return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19303
- }
19304
-
19305
- if (isTypedEvent(semantic, 'bpmn:CancelEventDefinition')) {
19306
- return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19307
- }
19308
-
19309
- if (isTypedEvent(semantic, 'bpmn:CompensateEventDefinition')) {
19310
- return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19311
- }
19312
-
19313
- if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
19314
- return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19315
- }
19316
-
19317
- return null;
19318
- }
19319
-
19320
- var taskMarkerRenderers = {
19321
- 'ParticipantMultiplicityMarker': function(parentGfx, element, attrs = {}) {
19322
- var width = getWidth(element, attrs),
19323
- height = getHeight(element, attrs);
19324
-
19325
- var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
19326
- xScaleFactor: 1,
19327
- yScaleFactor: 1,
19328
- containerWidth: width,
19329
- containerHeight: height,
19330
- position: {
19331
- mx: ((width / 2 - 6) / width),
19332
- my: (height - 15) / height
19333
- }
19334
- });
19335
-
19336
- drawMarker('participant-multiplicity', parentGfx, markerPath, {
19337
- strokeWidth: 2,
19338
- fill: getFillColor(element, defaultFillColor, attrs.fill),
19339
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19340
- });
19341
- },
19342
- 'SubProcessMarker': function(parentGfx, element, attrs = {}) {
19343
- var markerRect = drawRect(parentGfx, 14, 14, 0, {
19344
- strokeWidth: 1,
19345
- fill: getFillColor(element, defaultFillColor, attrs.fill),
19346
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19347
- });
19348
-
19349
- translate$1(markerRect, element.width / 2 - 7.5, element.height - 20);
19350
-
19351
- var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
19352
- xScaleFactor: 1.5,
19353
- yScaleFactor: 1.5,
19354
- containerWidth: element.width,
19355
- containerHeight: element.height,
19356
- position: {
19357
- mx: (element.width / 2 - 7.5) / element.width,
19358
- my: (element.height - 20) / element.height
19359
- }
19360
- });
19361
-
19362
- drawMarker('sub-process', parentGfx, markerPath, {
19363
- fill: getFillColor(element, defaultFillColor, attrs.fill),
19364
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19365
- });
19366
- },
19367
- 'ParallelMarker': function(parentGfx, element, attrs) {
19368
- var width = getWidth(element, attrs),
19369
- height = getHeight(element, attrs);
19370
-
19371
- var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
19372
- xScaleFactor: 1,
19373
- yScaleFactor: 1,
19374
- containerWidth: width,
19375
- containerHeight: height,
19376
- position: {
19377
- mx: ((width / 2 + attrs.parallel) / width),
19378
- my: (height - 20) / height
19379
- }
19380
- });
19381
-
19382
- drawMarker('parallel', parentGfx, markerPath, {
19383
- fill: getFillColor(element, defaultFillColor, attrs.fill),
19384
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19385
- });
19386
- },
19387
- 'SequentialMarker': function(parentGfx, element, attrs) {
19388
- var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
19389
- xScaleFactor: 1,
19390
- yScaleFactor: 1,
19391
- containerWidth: element.width,
19392
- containerHeight: element.height,
19393
- position: {
19394
- mx: ((element.width / 2 + attrs.seq) / element.width),
19395
- my: (element.height - 19) / element.height
19396
- }
19397
- });
19398
-
19399
- drawMarker('sequential', parentGfx, markerPath, {
19400
- fill: getFillColor(element, defaultFillColor, attrs.fill),
19401
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19402
- });
19403
- },
19404
- 'CompensationMarker': function(parentGfx, element, attrs) {
19405
- var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
19406
- xScaleFactor: 1,
19407
- yScaleFactor: 1,
19408
- containerWidth: element.width,
19409
- containerHeight: element.height,
19410
- position: {
19411
- mx: ((element.width / 2 + attrs.compensation) / element.width),
19412
- my: (element.height - 13) / element.height
19413
- }
19414
- });
19415
-
19416
- drawMarker('compensation', parentGfx, markerMath, {
19417
- strokeWidth: 1,
19418
- fill: getFillColor(element, defaultFillColor, attrs.fill),
19419
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19420
- });
19421
- },
19422
- 'LoopMarker': function(parentGfx, element, attrs) {
19423
- var width = getWidth(element, attrs),
19424
- height = getHeight(element, attrs);
19425
-
19426
- var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
19427
- xScaleFactor: 1,
19428
- yScaleFactor: 1,
19429
- containerWidth: width,
19430
- containerHeight: height,
19431
- position: {
19432
- mx: ((width / 2 + attrs.loop) / width),
19433
- my: (height - 7) / height
19434
- }
19435
- });
19436
-
19437
- drawMarker('loop', parentGfx, markerPath, {
19438
- strokeWidth: 1.5,
19439
- fill: 'none',
19440
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19441
- strokeMiterlimit: 0.5
19442
- });
19443
- },
19444
- 'AdhocMarker': function(parentGfx, element, attrs) {
19445
- var width = getWidth(element, attrs),
19446
- height = getHeight(element, attrs);
19447
-
19448
- var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
19449
- xScaleFactor: 1,
19450
- yScaleFactor: 1,
19451
- containerWidth: width,
19452
- containerHeight: height,
19453
- position: {
19454
- mx: ((width / 2 + attrs.adhoc) / width),
19455
- my: (height - 15) / height
19456
- }
19457
- });
19458
-
19459
- drawMarker('adhoc', parentGfx, markerPath, {
19460
- strokeWidth: 1,
19461
- fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19462
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19463
- });
19464
- }
19465
- };
19466
-
19467
- function renderTaskMarker(type, parentGfx, element, attrs) {
19468
- taskMarkerRenderers[ type ](parentGfx, element, attrs);
19469
- }
19470
-
19471
- function renderTaskMarkers(parentGfx, element, taskMarkers, attrs = {}) {
19472
- attrs = {
19473
- fill: attrs.fill,
19474
- stroke: attrs.stroke,
19475
- width: getWidth(element, attrs),
19476
- height: getHeight(element, attrs)
19477
- };
19478
-
19479
- var semantic = getBusinessObject(element);
19480
-
19481
- var subprocess = taskMarkers && taskMarkers.includes('SubProcessMarker');
19482
-
19483
- if (subprocess) {
19484
- attrs = {
19485
- ...attrs,
19486
- seq: -21,
19487
- parallel: -22,
19488
- compensation: -42,
19489
- loop: -18,
19490
- adhoc: 10
19491
- };
19492
- } else {
19493
- attrs = {
19494
- ...attrs,
19495
- seq: -5,
19496
- parallel: -6,
19497
- compensation: -27,
19498
- loop: 0,
19499
- adhoc: 10
19500
- };
19501
- }
19502
-
19503
- forEach$1(taskMarkers, function(marker) {
19504
- renderTaskMarker(marker, parentGfx, element, attrs);
19505
- });
19506
-
19507
- if (semantic.get('isForCompensation')) {
19508
- renderTaskMarker('CompensationMarker', parentGfx, element, attrs);
19509
- }
19510
-
19511
- if (is(semantic, 'bpmn:AdHocSubProcess')) {
19512
- renderTaskMarker('AdhocMarker', parentGfx, element, attrs);
19513
- }
19514
-
19515
- var loopCharacteristics = semantic.get('loopCharacteristics'),
19516
- isSequential = loopCharacteristics && loopCharacteristics.get('isSequential');
19517
-
19518
- if (loopCharacteristics) {
19519
-
19520
- if (isSequential === undefined) {
19521
- renderTaskMarker('LoopMarker', parentGfx, element, attrs);
19522
- }
19523
-
19524
- if (isSequential === false) {
19525
- renderTaskMarker('ParallelMarker', parentGfx, element, attrs);
19526
- }
19527
-
19528
- if (isSequential === true) {
19529
- renderTaskMarker('SequentialMarker', parentGfx, element, attrs);
19530
- }
19531
- }
19532
- }
19533
-
19534
- function renderLabel(parentGfx, label, attrs = {}) {
19535
- attrs = assign$1({
19536
- size: {
19537
- width: 100
19538
- }
19539
- }, attrs);
19540
-
19541
- var text = textRenderer.createText(label || '', attrs);
19542
-
19543
- classes(text).add('djs-label');
19544
-
19545
- append(parentGfx, text);
19546
-
19547
- return text;
19548
- }
19549
-
19550
- function renderEmbeddedLabel(parentGfx, element, align, attrs = {}) {
19551
- var semantic = getBusinessObject(element);
19552
-
19553
- var box = getBounds$1({
19554
- x: element.x,
19555
- y: element.y,
19556
- width: element.width,
19557
- height: element.height
19558
- }, attrs);
19559
-
19560
- return renderLabel(parentGfx, semantic.name, {
19561
- align,
19562
- box,
19563
- padding: 7,
19564
- style: {
19565
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
19566
- }
19567
- });
19568
- }
19569
-
19570
- function renderExternalLabel(parentGfx, element, attrs = {}) {
19571
- var box = {
19572
- width: 90,
19573
- height: 30,
19574
- x: element.width / 2 + element.x,
19575
- y: element.height / 2 + element.y
19576
- };
19577
-
19578
- return renderLabel(parentGfx, getLabel(element), {
19579
- box: box,
19580
- fitBox: true,
19581
- style: assign$1(
19582
- {},
19583
- textRenderer.getExternalStyle(),
19584
- {
19585
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
19586
- }
19587
- )
19588
- });
19589
- }
19590
-
19591
- function renderLaneLabel(parentGfx, text, element, attrs = {}) {
19592
- var isHorizontalLane = isHorizontal$3(element);
19593
-
19594
- var textBox = renderLabel(parentGfx, text, {
19595
- box: {
19596
- height: 30,
19597
- width: isHorizontalLane ? getHeight(element, attrs) : getWidth(element, attrs),
19598
- },
19599
- align: 'center-middle',
19600
- style: {
19601
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
19602
- }
19603
- });
19604
-
19605
- if (isHorizontalLane) {
19606
- var top = -1 * getHeight(element, attrs);
19607
- transform(textBox, 0, -top, 270);
19608
- }
19609
- }
19610
-
19611
- function renderActivity(parentGfx, element, attrs = {}) {
19612
- var {
19613
- width,
19614
- height
19615
- } = getBounds$1(element, attrs);
19616
-
19617
- return drawRect(parentGfx, width, height, TASK_BORDER_RADIUS, {
19618
- ...attrs,
19619
- fill: getFillColor(element, defaultFillColor, attrs.fill),
19620
- fillOpacity: DEFAULT_OPACITY,
19621
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19622
- });
19623
- }
19624
-
19625
- function renderAssociation(parentGfx, element, attrs = {}) {
19626
- var semantic = getBusinessObject(element);
19627
-
19628
- var fill = getFillColor(element, defaultFillColor, attrs.fill),
19629
- stroke = getStrokeColor$1(element, defaultStrokeColor, attrs.stroke);
19630
-
19631
- if (semantic.get('associationDirection') === 'One' ||
19632
- semantic.get('associationDirection') === 'Both') {
19633
- attrs.markerEnd = marker(parentGfx, 'association-end', fill, stroke);
19634
- }
19635
-
19636
- if (semantic.get('associationDirection') === 'Both') {
19637
- attrs.markerStart = marker(parentGfx, 'association-start', fill, stroke);
19638
- }
19639
-
19640
- attrs = pickAttrs(attrs, [
19641
- 'markerStart',
19642
- 'markerEnd'
19643
- ]);
19644
-
19645
- return drawConnectionSegments(parentGfx, element.waypoints, {
19646
- ...attrs,
19647
- stroke,
19648
- strokeDasharray: '0, 5'
19649
- });
19650
- }
19651
-
19652
- function renderDataObject(parentGfx, element, attrs = {}) {
19653
- var fill = getFillColor(element, defaultFillColor, attrs.fill),
19654
- stroke = getStrokeColor$1(element, defaultStrokeColor, attrs.stroke);
19655
-
19656
- var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
19657
- xScaleFactor: 1,
19658
- yScaleFactor: 1,
19659
- containerWidth: element.width,
19660
- containerHeight: element.height,
19661
- position: {
19662
- mx: 0.474,
19663
- my: 0.296
19664
- }
19665
- });
19666
-
19667
- var dataObject = drawPath(parentGfx, pathData, {
19668
- fill,
19669
- fillOpacity: DEFAULT_OPACITY,
19670
- stroke
19671
- });
19672
-
19673
- var semantic = getBusinessObject(element);
19674
-
19675
- if (isCollection(semantic)) {
19676
- var collectionPathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
19677
- xScaleFactor: 1,
19678
- yScaleFactor: 1,
19679
- containerWidth: element.width,
19680
- containerHeight: element.height,
19681
- position: {
19682
- mx: 0.33,
19683
- my: (element.height - 18) / element.height
19684
- }
19685
- });
19686
-
19687
- drawPath(parentGfx, collectionPathData, {
19688
- strokeWidth: 2,
19689
- fill,
19690
- stroke
19691
- });
19692
- }
19693
-
19694
- return dataObject;
19695
- }
19696
-
19697
- function renderEvent(parentGfx, element, attrs = {}) {
19698
- return drawCircle(parentGfx, element.width, element.height, {
19699
- fillOpacity: DEFAULT_OPACITY,
19700
- ...attrs,
19701
- fill: getFillColor(element, defaultFillColor, attrs.fill),
19702
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19703
- });
19704
- }
19705
-
19706
- function renderGateway(parentGfx, element, attrs = {}) {
19707
- return drawDiamond(parentGfx, element.width, element.height, {
19708
- fill: getFillColor(element, defaultFillColor, attrs.fill),
19709
- fillOpacity: DEFAULT_OPACITY,
19710
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19711
- });
19712
- }
19713
-
19714
- function renderLane(parentGfx, element, attrs = {}) {
19715
- var lane = drawRect(parentGfx, getWidth(element, attrs), getHeight(element, attrs), 0, {
19716
- fill: getFillColor(element, defaultFillColor, attrs.fill),
19717
- fillOpacity: attrs.fillOpacity || DEFAULT_OPACITY,
19718
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19719
- strokeWidth: 1.5
19720
- });
19721
-
19722
- var semantic = getBusinessObject(element);
19723
-
19724
- if (is(semantic, 'bpmn:Lane')) {
19725
- var text = semantic.get('name');
19726
-
19727
- renderLaneLabel(parentGfx, text, element, attrs);
19728
- }
19729
-
19730
- return lane;
19731
- }
19732
-
19733
- function renderSubProcess(parentGfx, element, attrs = {}) {
19734
- var activity = renderActivity(parentGfx, element, attrs);
19735
-
19736
- var expanded = isExpanded(element);
19737
-
19738
- if (isEventSubProcess(element)) {
19739
- attr(activity, {
19740
- strokeDasharray: '0, 5.5',
19741
- strokeWidth: 2.5
19742
- });
19743
-
19744
- if (!expanded) {
19745
- var flowElements = getBusinessObject(element).flowElements || [];
19746
- var startEvents = flowElements.filter(e => is(e, 'bpmn:StartEvent'));
19747
-
19748
- if (startEvents.length === 1) {
19749
- renderEventSubProcessIcon(startEvents[0], parentGfx, attrs, element);
19750
- }
19751
- }
19752
- }
19753
-
19754
- renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle', attrs);
19755
-
19756
- if (expanded) {
19757
- renderTaskMarkers(parentGfx, element, undefined, attrs);
19758
- } else {
19759
- renderTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ], attrs);
19760
- }
19761
-
19762
- return activity;
19763
- }
19764
-
19765
- function renderEventSubProcessIcon(startEvent, parentGfx, attrs, proxyElement) {
19766
- var iconSize = 22;
19767
-
19768
- // match the colors of the enclosing subprocess
19769
- var proxyAttrs = {
19770
- fill: getFillColor(proxyElement, defaultFillColor, attrs.fill),
19771
- stroke: getStrokeColor$1(proxyElement, defaultStrokeColor, attrs.stroke),
19772
- width: iconSize,
19773
- height: iconSize
19774
- };
19775
-
19776
- var interrupting = getBusinessObject(startEvent).isInterrupting;
19777
- var strokeDasharray = interrupting ? 0 : 3;
19778
-
19779
- // better visibility for non-interrupting events
19780
- var strokeWidth = interrupting ? 1 : 1.2;
19781
-
19782
- // make the icon look larger by drawing a smaller circle
19783
- var circleSize = 20;
19784
- var shift = (iconSize - circleSize) / 2;
19785
- var transform = 'translate(' + shift + ',' + shift + ')';
19786
-
19787
- drawCircle(parentGfx, circleSize, circleSize, {
19788
- fill: proxyAttrs.fill,
19789
- stroke: proxyAttrs.stroke,
19790
- strokeWidth,
19791
- strokeDasharray,
19792
- transform
19793
- });
19794
-
19795
- renderEventIcon(startEvent, parentGfx, proxyAttrs, proxyElement);
19796
- }
19797
-
19798
- function renderTask(parentGfx, element, attrs = {}) {
19799
- var activity = renderActivity(parentGfx, element, attrs);
19800
-
19801
- renderEmbeddedLabel(parentGfx, element, 'center-middle', attrs);
19802
-
19803
- renderTaskMarkers(parentGfx, element, undefined, attrs);
19804
-
19805
- return activity;
19806
- }
19807
-
19808
- var handlers = this.handlers = {
19809
- 'bpmn:AdHocSubProcess': function(parentGfx, element, attrs = {}) {
19810
- if (isExpanded(element)) {
19811
- attrs = pickAttrs(attrs, [
19812
- 'fill',
19813
- 'stroke',
19814
- 'width',
19815
- 'height'
19816
- ]);
19817
- } else {
19818
- attrs = pickAttrs(attrs, [
19819
- 'fill',
19820
- 'stroke'
19821
- ]);
19822
- }
19823
-
19824
- return renderSubProcess(parentGfx, element, attrs);
19825
- },
19826
- 'bpmn:Association': function(parentGfx, element, attrs = {}) {
19827
- attrs = pickAttrs(attrs, [
19828
- 'fill',
19829
- 'stroke'
19830
- ]);
19831
-
19832
- return renderAssociation(parentGfx, element, attrs);
19833
- },
19834
- 'bpmn:BoundaryEvent': function(parentGfx, element, attrs = {}) {
19835
- var { renderIcon = true } = attrs;
19836
-
19837
- attrs = pickAttrs(attrs, [
19838
- 'fill',
19839
- 'stroke'
19840
- ]);
19841
-
19842
- var semantic = getBusinessObject(element),
19843
- cancelActivity = semantic.get('cancelActivity');
19844
-
19845
- attrs = {
19846
- strokeWidth: 1.5,
19847
- fill: getFillColor(element, defaultFillColor, attrs.fill),
19848
- fillOpacity: FULL_OPACITY,
19849
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19850
- };
19851
-
19852
- if (!cancelActivity) {
19853
- attrs.strokeDasharray = '6';
19854
- }
19855
-
19856
- var event = renderEvent(parentGfx, element, attrs);
19857
-
19858
- drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
19859
- ...attrs,
19860
- fill: 'none'
19861
- });
19862
-
19863
- if (renderIcon) {
19864
- renderEventIcon(element, parentGfx, attrs);
19865
- }
19866
-
19867
- return event;
19868
- },
19869
- 'bpmn:BusinessRuleTask': function(parentGfx, element, attrs = {}) {
19870
- attrs = pickAttrs(attrs, [
19871
- 'fill',
19872
- 'stroke'
19873
- ]);
19874
-
19875
- var task = renderTask(parentGfx, element, attrs);
19876
-
19877
- var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
19878
- abspos: {
19879
- x: 8,
19880
- y: 8
19881
- }
19882
- });
19883
-
19884
- var businessPath = drawPath(parentGfx, headerData);
19885
-
19886
- attr(businessPath, {
19887
- fill: getFillColor(element, defaultFillColor, attrs.fill),
19888
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19889
- strokeWidth: 1
19890
- });
19891
-
19892
- var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
19893
- abspos: {
19894
- x: 8,
19895
- y: 8
19896
- }
19897
- });
19898
-
19899
- var businessHeaderPath = drawPath(parentGfx, headerPathData);
19900
-
19901
- attr(businessHeaderPath, {
19902
- fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19903
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19904
- strokeWidth: 1
19905
- });
19906
-
19907
- return task;
19908
- },
19909
- 'bpmn:CallActivity': function(parentGfx, element, attrs = {}) {
19910
- attrs = pickAttrs(attrs, [
19911
- 'fill',
19912
- 'stroke'
19913
- ]);
19914
-
19915
- return renderSubProcess(parentGfx, element, {
19916
- strokeWidth: 5,
19917
- ...attrs
19918
- });
19919
- },
19920
- 'bpmn:ComplexGateway': function(parentGfx, element, attrs = {}) {
19921
- attrs = pickAttrs(attrs, [
19922
- 'fill',
19923
- 'stroke'
19924
- ]);
19925
-
19926
- var gateway = renderGateway(parentGfx, element, attrs);
19927
-
19928
- var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
19929
- xScaleFactor: 0.5,
19930
- yScaleFactor:0.5,
19931
- containerWidth: element.width,
19932
- containerHeight: element.height,
19933
- position: {
19934
- mx: 0.46,
19935
- my: 0.26
19936
- }
19937
- });
19938
-
19939
- drawPath(parentGfx, pathData, {
19940
- fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19941
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19942
- strokeWidth: 1
19943
- });
19944
-
19945
- return gateway;
19946
- },
19947
- 'bpmn:DataInput': function(parentGfx, element, attrs = {}) {
19948
- attrs = pickAttrs(attrs, [
19949
- 'fill',
19950
- 'stroke'
19951
- ]);
19952
-
19953
- var arrowPathData = pathMap.getRawPath('DATA_ARROW');
19954
-
19955
- var dataObject = renderDataObject(parentGfx, element, attrs);
19956
-
19957
- drawPath(parentGfx, arrowPathData, {
19958
- fill: 'none',
19959
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19960
- strokeWidth: 1
19961
- });
19962
-
19963
- return dataObject;
19964
- },
19965
- 'bpmn:DataInputAssociation': function(parentGfx, element, attrs = {}) {
19966
- attrs = pickAttrs(attrs, [
19967
- 'fill',
19968
- 'stroke'
19969
- ]);
19970
-
19971
- return renderAssociation(parentGfx, element, {
19972
- ...attrs,
19973
- markerEnd: marker(parentGfx, 'association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor$1(element, defaultStrokeColor, attrs.stroke))
19974
- });
19975
- },
19976
- 'bpmn:DataObject': function(parentGfx, element, attrs = {}) {
19977
- attrs = pickAttrs(attrs, [
19978
- 'fill',
19979
- 'stroke'
19980
- ]);
19981
-
19982
- return renderDataObject(parentGfx, element, attrs);
19983
- },
19984
- 'bpmn:DataObjectReference': as('bpmn:DataObject'),
19985
- 'bpmn:DataOutput': function(parentGfx, element, attrs = {}) {
19986
- attrs = pickAttrs(attrs, [
19987
- 'fill',
19988
- 'stroke'
19989
- ]);
19990
-
19991
- var arrowPathData = pathMap.getRawPath('DATA_ARROW');
19992
-
19993
- var dataObject = renderDataObject(parentGfx, element, attrs);
19994
-
19995
- drawPath(parentGfx, arrowPathData, {
19996
- strokeWidth: 1,
19997
- fill: getFillColor(element, defaultFillColor, attrs.fill),
19998
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19999
- });
20000
-
20001
- return dataObject;
20002
- },
20003
- 'bpmn:DataOutputAssociation': function(parentGfx, element, attrs = {}) {
20004
- attrs = pickAttrs(attrs, [
20005
- 'fill',
20006
- 'stroke'
20007
- ]);
20008
-
20009
- return renderAssociation(parentGfx, element, {
20010
- ...attrs,
20011
- markerEnd: marker(parentGfx, 'association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor$1(element, defaultStrokeColor, attrs.stroke))
20012
- });
20013
- },
20014
- 'bpmn:DataStoreReference': function(parentGfx, element, attrs = {}) {
20015
- attrs = pickAttrs(attrs, [
20016
- 'fill',
20017
- 'stroke'
20018
- ]);
20019
-
20020
- var dataStorePath = pathMap.getScaledPath('DATA_STORE', {
20021
- xScaleFactor: 1,
20022
- yScaleFactor: 1,
20023
- containerWidth: element.width,
20024
- containerHeight: element.height,
20025
- position: {
20026
- mx: 0,
20027
- my: 0.133
20028
- }
20029
- });
20030
-
20031
- return drawPath(parentGfx, dataStorePath, {
20032
- fill: getFillColor(element, defaultFillColor, attrs.fill),
20033
- fillOpacity: DEFAULT_OPACITY,
20034
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20035
- strokeWidth: 2
20036
- });
20037
- },
20038
- 'bpmn:EndEvent': function(parentGfx, element, attrs = {}) {
20039
- var { renderIcon = true } = attrs;
20040
-
20041
- attrs = pickAttrs(attrs, [
20042
- 'fill',
20043
- 'stroke'
20044
- ]);
20045
-
20046
- var event = renderEvent(parentGfx, element, {
20047
- ...attrs,
20048
- strokeWidth: 4
20049
- });
20050
-
20051
- if (renderIcon) {
20052
- renderEventIcon(element, parentGfx, attrs);
20053
- }
20054
-
20055
- return event;
20056
- },
20057
- 'bpmn:EventBasedGateway': function(parentGfx, element, attrs = {}) {
20058
- attrs = pickAttrs(attrs, [
20059
- 'fill',
20060
- 'stroke'
20061
- ]);
20062
-
20063
- var semantic = getBusinessObject(element);
20064
-
20065
- var diamond = renderGateway(parentGfx, element, attrs);
20066
-
20067
- drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
20068
- fill: getFillColor(element, 'none', attrs.fill),
20069
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20070
- strokeWidth: 1
20071
- });
20072
-
20073
- var type = semantic.get('eventGatewayType'),
20074
- instantiate = !!semantic.get('instantiate');
20075
-
20076
- function drawEvent() {
20077
-
20078
- var pathData = pathMap.getScaledPath('GATEWAY_EVENT_BASED', {
20079
- xScaleFactor: 0.18,
20080
- yScaleFactor: 0.18,
20081
- containerWidth: element.width,
20082
- containerHeight: element.height,
20083
- position: {
20084
- mx: 0.36,
20085
- my: 0.44
20086
- }
20087
- });
20088
-
20089
- drawPath(parentGfx, pathData, {
20090
- fill: 'none',
20091
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20092
- strokeWidth: 2
20093
- });
20094
- }
20095
-
20096
- if (type === 'Parallel') {
20097
- var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
20098
- xScaleFactor: 0.4,
20099
- yScaleFactor: 0.4,
20100
- containerWidth: element.width,
20101
- containerHeight: element.height,
20102
- position: {
20103
- mx: 0.474,
20104
- my: 0.296
20105
- }
20106
- });
20107
-
20108
- drawPath(parentGfx, pathData, {
20109
- fill: 'none',
20110
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20111
- strokeWidth: 1
20112
- });
20113
- } else if (type === 'Exclusive') {
20114
- if (!instantiate) {
20115
- drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
20116
- fill: 'none',
20117
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20118
- strokeWidth: 1
20119
- });
20120
- }
20121
-
20122
- drawEvent();
20123
- }
20124
-
20125
-
20126
- return diamond;
20127
- },
20128
- 'bpmn:ExclusiveGateway': function(parentGfx, element, attrs = {}) {
20129
- attrs = pickAttrs(attrs, [
20130
- 'fill',
20131
- 'stroke'
20132
- ]);
20133
-
20134
- var gateway = renderGateway(parentGfx, element, attrs);
20135
-
20136
- var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
20137
- xScaleFactor: 0.4,
20138
- yScaleFactor: 0.4,
20139
- containerWidth: element.width,
20140
- containerHeight: element.height,
20141
- position: {
20142
- mx: 0.32,
20143
- my: 0.3
20144
- }
20145
- });
20146
-
20147
- var di = getDi(element);
20148
-
20149
- if (di.get('isMarkerVisible')) {
20150
- drawPath(parentGfx, pathData, {
20151
- fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20152
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20153
- strokeWidth: 1
20154
- });
20155
- }
20156
-
20157
- return gateway;
20158
- },
20159
- 'bpmn:Gateway': function(parentGfx, element, attrs = {}) {
20160
- attrs = pickAttrs(attrs, [
20161
- 'fill',
20162
- 'stroke'
20163
- ]);
20164
-
20165
- return renderGateway(parentGfx, element, attrs);
20166
- },
20167
- 'bpmn:Group': function(parentGfx, element, attrs = {}) {
20168
- attrs = pickAttrs(attrs, [
20169
- 'fill',
20170
- 'stroke',
20171
- 'width',
20172
- 'height'
20173
- ]);
20174
-
20175
- return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
20176
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20177
- strokeWidth: 1.5,
20178
- strokeDasharray: '10, 6, 0, 6',
20179
- fill: 'none',
20180
- pointerEvents: 'none',
20181
- width: getWidth(element, attrs),
20182
- height: getHeight(element, attrs)
20183
- });
20184
- },
20185
- 'bpmn:InclusiveGateway': function(parentGfx, element, attrs = {}) {
20186
- attrs = pickAttrs(attrs, [
20187
- 'fill',
20188
- 'stroke'
20189
- ]);
20190
-
20191
- var gateway = renderGateway(parentGfx, element, attrs);
20192
-
20193
- drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
20194
- fill: getFillColor(element, defaultFillColor, attrs.fill),
20195
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20196
- strokeWidth: 2.5
20197
- });
20198
-
20199
- return gateway;
20200
- },
20201
- 'bpmn:IntermediateEvent': function(parentGfx, element, attrs = {}) {
20202
- var { renderIcon = true } = attrs;
20203
-
20204
- attrs = pickAttrs(attrs, [
20205
- 'fill',
20206
- 'stroke'
20207
- ]);
20208
-
20209
- var outer = renderEvent(parentGfx, element, {
20210
- ...attrs,
20211
- strokeWidth: 1.5
20212
- });
20213
-
20214
- drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
20215
- fill: 'none',
20216
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20217
- strokeWidth: 1.5
20218
- });
20219
-
20220
- if (renderIcon) {
20221
- renderEventIcon(element, parentGfx, attrs);
20222
- }
20223
-
20224
- return outer;
20225
- },
20226
- 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
20227
- 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
20228
- 'bpmn:Lane': function(parentGfx, element, attrs = {}) {
20229
- attrs = pickAttrs(attrs, [
20230
- 'fill',
20231
- 'stroke',
20232
- 'width',
20233
- 'height'
20234
- ]);
20235
-
20236
- return renderLane(parentGfx, element, {
20237
- ...attrs,
20238
- fillOpacity: LOW_OPACITY
20239
- });
20240
- },
20241
- 'bpmn:ManualTask': function(parentGfx, element, attrs = {}) {
20242
- attrs = pickAttrs(attrs, [
20243
- 'fill',
20244
- 'stroke'
20245
- ]);
20246
-
20247
- var task = renderTask(parentGfx, element, attrs);
20248
-
20249
- var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
20250
- abspos: {
20251
- x: 17,
20252
- y: 15
20253
- }
20254
- });
20255
-
20256
- drawPath(parentGfx, pathData, {
20257
- fill: getFillColor(element, defaultFillColor, attrs.fill),
20258
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20259
- strokeWidth: 0.5
20260
- });
20261
-
20262
- return task;
20263
- },
20264
- 'bpmn:MessageFlow': function(parentGfx, element, attrs = {}) {
20265
- attrs = pickAttrs(attrs, [
20266
- 'fill',
20267
- 'stroke'
20268
- ]);
20269
-
20270
- var semantic = getBusinessObject(element),
20271
- di = getDi(element);
20272
-
20273
- var fill = getFillColor(element, defaultFillColor, attrs.fill),
20274
- stroke = getStrokeColor$1(element, defaultStrokeColor, attrs.stroke);
20275
-
20276
- var path = drawConnectionSegments(parentGfx, element.waypoints, {
20277
- markerEnd: marker(parentGfx, 'messageflow-end', fill, stroke),
20278
- markerStart: marker(parentGfx, 'messageflow-start', fill, stroke),
20279
- stroke,
20280
- strokeDasharray: '10, 11',
20281
- strokeWidth: 1.5
20282
- });
20283
-
20284
- if (semantic.get('messageRef')) {
20285
- var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
20286
-
20287
- var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', {
20288
- abspos: {
20289
- x: midPoint.x,
20290
- y: midPoint.y
20291
- }
20292
- });
20293
-
20294
- var messageAttrs = {
20295
- strokeWidth: 1
20296
- };
20297
-
20298
- if (di.get('messageVisibleKind') === 'initiating') {
20299
- messageAttrs.fill = fill;
20300
- messageAttrs.stroke = stroke;
20301
- } else {
20302
- messageAttrs.fill = stroke;
20303
- messageAttrs.stroke = fill;
20304
- }
20305
-
20306
- var message = drawPath(parentGfx, markerPathData, messageAttrs);
20307
-
20308
- var messageRef = semantic.get('messageRef'),
20309
- name = messageRef.get('name');
20310
-
20311
- var label = renderLabel(parentGfx, name, {
20312
- align: 'center-top',
20313
- fitBox: true,
20314
- style: {
20315
- fill: stroke
20316
- }
20317
- });
20318
-
20319
- var messageBounds = message.getBBox(),
20320
- labelBounds = label.getBBox();
20321
-
20322
- var translateX = midPoint.x - labelBounds.width / 2,
20323
- translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE$1;
20324
-
20325
- transform(label, translateX, translateY, 0);
20326
- }
20327
-
20328
- return path;
20329
- },
20330
- 'bpmn:ParallelGateway': function(parentGfx, element, attrs = {}) {
20331
- attrs = pickAttrs(attrs, [
20332
- 'fill',
20333
- 'stroke'
20334
- ]);
20335
-
20336
- var diamond = renderGateway(parentGfx, element, attrs);
20337
-
20338
- var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
20339
- xScaleFactor: 0.6,
20340
- yScaleFactor: 0.6,
20341
- containerWidth: element.width,
20342
- containerHeight: element.height,
20343
- position: {
20344
- mx: 0.46,
20345
- my: 0.2
20346
- }
20347
- });
20348
-
20349
- drawPath(parentGfx, pathData, {
20350
- fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20351
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20352
- strokeWidth: 1
20353
- });
20354
-
20355
- return diamond;
20356
- },
20357
- 'bpmn:Participant': function(parentGfx, element, attrs = {}) {
20358
- attrs = pickAttrs(attrs, [
20359
- 'fill',
20360
- 'stroke',
20361
- 'width',
20362
- 'height'
20363
- ]);
20364
-
20365
- var participant = renderLane(parentGfx, element, attrs);
20366
-
20367
- var expandedParticipant = isExpanded(element);
20368
- var horizontalParticipant = isHorizontal$3(element);
20369
-
20370
- var semantic = getBusinessObject(element),
20371
- name = semantic.get('name');
20372
-
20373
- if (expandedParticipant) {
20374
- var waypoints = horizontalParticipant ? [
20375
- {
20376
- x: 30,
20377
- y: 0
20378
- },
20379
- {
20380
- x: 30,
20381
- y: getHeight(element, attrs)
20382
- }
20383
- ] : [
20384
- {
20385
- x: 0,
20386
- y: 30
20387
- },
20388
- {
20389
- x: getWidth(element, attrs),
20390
- y: 30
20391
- }
20392
- ];
20393
-
20394
- drawLine(parentGfx, waypoints, {
20395
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20396
- strokeWidth: PARTICIPANT_STROKE_WIDTH
20397
- });
20398
-
20399
- renderLaneLabel(parentGfx, name, element, attrs);
20400
- } else {
20401
- var bounds = getBounds$1(element, attrs);
20402
-
20403
- if (!horizontalParticipant) {
20404
- bounds.height = getWidth(element, attrs);
20405
- bounds.width = getHeight(element, attrs);
20406
- }
20407
-
20408
- var textBox = renderLabel(parentGfx, name, {
20409
- box: bounds,
20410
- align: 'center-middle',
20411
- style: {
20412
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
20413
- }
20414
- });
20415
-
20416
- if (!horizontalParticipant) {
20417
- var top = -1 * getHeight(element, attrs);
20418
- transform(textBox, 0, -top, 270);
20419
- }
20420
- }
20421
-
20422
- if (semantic.get('participantMultiplicity')) {
20423
- renderTaskMarker('ParticipantMultiplicityMarker', parentGfx, element, attrs);
20424
- }
20425
-
20426
- return participant;
20427
- },
20428
- 'bpmn:ReceiveTask' : function(parentGfx, element, attrs = {}) {
20429
- attrs = pickAttrs(attrs, [
20430
- 'fill',
20431
- 'stroke'
20432
- ]);
20433
-
20434
- var semantic = getBusinessObject(element);
20435
-
20436
- var task = renderTask(parentGfx, element, attrs);
20437
-
20438
- var pathData;
20439
-
20440
- if (semantic.get('instantiate')) {
20441
- drawCircle(parentGfx, 28, 28, 20 * 0.22, {
20442
- fill: getFillColor(element, defaultFillColor, attrs.fill),
20443
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20444
- strokeWidth: 1
20445
- });
20446
-
20447
- pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
20448
- abspos: {
20449
- x: 7.77,
20450
- y: 9.52
20451
- }
20452
- });
20453
- } else {
20454
- pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
20455
- xScaleFactor: 0.9,
20456
- yScaleFactor: 0.9,
20457
- containerWidth: 21,
20458
- containerHeight: 14,
20459
- position: {
20460
- mx: 0.3,
20461
- my: 0.4
20462
- }
20463
- });
20464
- }
20465
-
20466
- drawPath(parentGfx, pathData, {
20467
- fill: getFillColor(element, defaultFillColor, attrs.fill),
20468
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20469
- strokeWidth: 1
20470
- });
20471
-
20472
- return task;
20473
- },
20474
- 'bpmn:ScriptTask': function(parentGfx, element, attrs = {}) {
20475
- attrs = pickAttrs(attrs, [
20476
- 'fill',
20477
- 'stroke'
20478
- ]);
20479
-
20480
- var task = renderTask(parentGfx, element, attrs);
20481
-
20482
- var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
20483
- abspos: {
20484
- x: 15,
20485
- y: 20
20486
- }
20487
- });
20488
-
20489
- drawPath(parentGfx, pathData, {
20490
- fill: getFillColor(element, defaultFillColor, attrs.fill),
20491
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20492
- strokeWidth: 1
20493
- });
20494
-
20495
- return task;
20496
- },
20497
- 'bpmn:SendTask': function(parentGfx, element, attrs = {}) {
20498
- attrs = pickAttrs(attrs, [
20499
- 'fill',
20500
- 'stroke'
20501
- ]);
20502
-
20503
- var task = renderTask(parentGfx, element, attrs);
20504
-
20505
- var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
20506
- xScaleFactor: 1,
20507
- yScaleFactor: 1,
20508
- containerWidth: 21,
20509
- containerHeight: 14,
20510
- position: {
20511
- mx: 0.285,
20512
- my: 0.357
20513
- }
20514
- });
20515
-
20516
- drawPath(parentGfx, pathData, {
20517
- fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20518
- stroke: getFillColor(element, defaultFillColor, attrs.fill),
20519
- strokeWidth: 1
20520
- });
20521
-
20522
- return task;
20523
- },
20524
- 'bpmn:SequenceFlow': function(parentGfx, element, attrs = {}) {
20525
- attrs = pickAttrs(attrs, [
20526
- 'fill',
20527
- 'stroke'
20528
- ]);
20529
-
20530
- var fill = getFillColor(element, defaultFillColor, attrs.fill),
20531
- stroke = getStrokeColor$1(element, defaultStrokeColor, attrs.stroke);
20532
-
20533
- var connection = drawConnectionSegments(parentGfx, element.waypoints, {
20534
- markerEnd: marker(parentGfx, 'sequenceflow-end', fill, stroke),
20535
- stroke
20536
- });
20537
-
20538
- var semantic = getBusinessObject(element);
20539
-
20540
- var { source } = element;
20541
-
20542
- if (source) {
20543
- var sourceSemantic = getBusinessObject(source);
20544
-
20545
- // conditional flow marker
20546
- if (semantic.get('conditionExpression') && is(sourceSemantic, 'bpmn:Activity')) {
20547
- attr(connection, {
20548
- markerStart: marker(parentGfx, 'conditional-flow-marker', fill, stroke)
20549
- });
20550
- }
20551
-
20552
- // default marker
20553
- if (sourceSemantic.get('default') && (is(sourceSemantic, 'bpmn:Gateway') || is(sourceSemantic, 'bpmn:Activity')) &&
20554
- sourceSemantic.get('default') === semantic) {
20555
- attr(connection, {
20556
- markerStart: marker(parentGfx, 'conditional-default-flow-marker', fill, stroke)
20557
- });
20558
- }
20559
- }
20560
-
20561
- return connection;
20562
- },
20563
- 'bpmn:ServiceTask': function(parentGfx, element, attrs = {}) {
20564
- attrs = pickAttrs(attrs, [
20565
- 'fill',
20566
- 'stroke'
20567
- ]);
20568
-
20569
- var task = renderTask(parentGfx, element, attrs);
20570
-
20571
- drawCircle(parentGfx, 10, 10, {
20572
- fill: getFillColor(element, defaultFillColor, attrs.fill),
20573
- stroke: 'none',
20574
- transform: 'translate(6, 6)'
20575
- });
20576
-
20577
- var pathDataService1 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
20578
- abspos: {
20579
- x: 12,
20580
- y: 18
20581
- }
20582
- });
20583
-
20584
- drawPath(parentGfx, pathDataService1, {
20585
- fill: getFillColor(element, defaultFillColor, attrs.fill),
20586
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20587
- strokeWidth: 1
20588
- });
20589
-
20590
- drawCircle(parentGfx, 10, 10, {
20591
- fill: getFillColor(element, defaultFillColor, attrs.fill),
20592
- stroke: 'none',
20593
- transform: 'translate(11, 10)'
20594
- });
20595
-
20596
- var pathDataService2 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
20597
- abspos: {
20598
- x: 17,
20599
- y: 22
20600
- }
20601
- });
20602
-
20603
- drawPath(parentGfx, pathDataService2, {
20604
- fill: getFillColor(element, defaultFillColor, attrs.fill),
20605
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20606
- strokeWidth: 1
20607
- });
20608
-
20609
- return task;
20610
- },
20611
- 'bpmn:StartEvent': function(parentGfx, element, attrs = {}) {
20612
- var { renderIcon = true } = attrs;
20613
-
20614
- attrs = pickAttrs(attrs, [
20615
- 'fill',
20616
- 'stroke'
20617
- ]);
20618
-
20619
- var semantic = getBusinessObject(element);
20620
-
20621
- if (!semantic.get('isInterrupting')) {
20622
- attrs = {
20623
- ...attrs,
20624
- strokeDasharray: '6'
20625
- };
20626
- }
20627
-
20628
- var event = renderEvent(parentGfx, element, attrs);
20629
-
20630
- if (renderIcon) {
20631
- renderEventIcon(element, parentGfx, attrs);
20632
- }
20633
-
20634
- return event;
20635
- },
20636
- 'bpmn:SubProcess': function(parentGfx, element, attrs = {}) {
20637
- if (isExpanded(element)) {
20638
- attrs = pickAttrs(attrs, [
20639
- 'fill',
20640
- 'stroke',
20641
- 'width',
20642
- 'height'
20643
- ]);
20644
- } else {
20645
- attrs = pickAttrs(attrs, [
20646
- 'fill',
20647
- 'stroke'
20648
- ]);
20649
- }
20650
-
20651
- return renderSubProcess(parentGfx, element, attrs);
20652
- },
20653
- 'bpmn:Task': function(parentGfx, element, attrs = {}) {
20654
- attrs = pickAttrs(attrs, [
20655
- 'fill',
20656
- 'stroke'
20657
- ]);
20658
-
20659
- return renderTask(parentGfx, element, attrs);
20660
- },
20661
- 'bpmn:TextAnnotation': function(parentGfx, element, attrs = {}) {
20662
- attrs = pickAttrs(attrs, [
20663
- 'fill',
20664
- 'stroke',
20665
- 'width',
20666
- 'height'
20667
- ]);
20668
-
20669
- var {
20670
- width,
20671
- height
20672
- } = getBounds$1(element, attrs);
20673
-
20674
- var textElement = drawRect(parentGfx, width, height, 0, 0, {
20675
- fill: 'none',
20676
- stroke: 'none'
20677
- });
20678
-
20679
- var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
20680
- xScaleFactor: 1,
20681
- yScaleFactor: 1,
20682
- containerWidth: width,
20683
- containerHeight: height,
20684
- position: {
20685
- mx: 0.0,
20686
- my: 0.0
20687
- }
20688
- });
20689
-
20690
- drawPath(parentGfx, textPathData, {
20691
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
20692
- });
20693
-
20694
- var semantic = getBusinessObject(element),
20695
- text = semantic.get('text') || '';
20696
-
20697
- renderLabel(parentGfx, text, {
20698
- align: 'left-top',
20699
- box: getBounds$1(element, attrs),
20700
- padding: 7,
20701
- style: {
20702
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
20703
- }
20704
- });
20705
-
20706
- return textElement;
20707
- },
20708
- 'bpmn:Transaction': function(parentGfx, element, attrs = {}) {
20709
- if (isExpanded(element)) {
20710
- attrs = pickAttrs(attrs, [
20711
- 'fill',
20712
- 'stroke',
20713
- 'width',
20714
- 'height'
20715
- ]);
20716
- } else {
20717
- attrs = pickAttrs(attrs, [
20718
- 'fill',
20719
- 'stroke'
20720
- ]);
20721
- }
20722
-
20723
- var outer = renderSubProcess(parentGfx, element, {
20724
- strokeWidth: 1.5,
20725
- ...attrs
20726
- });
20727
-
20728
- var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
20729
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20730
- strokeWidth: 1.5
20731
- });
20732
-
20733
- var expanded = isExpanded(element);
20734
-
20735
- if (!expanded) {
20736
- attrs = {};
20737
- }
20738
-
20739
- drawRect(
20740
- parentGfx,
20741
- getWidth(element, attrs),
20742
- getHeight(element, attrs),
20743
- TASK_BORDER_RADIUS - INNER_OUTER_DIST,
20744
- INNER_OUTER_DIST,
20745
- innerAttrs
20746
- );
20747
-
20748
- return outer;
20749
- },
20750
- 'bpmn:UserTask': function(parentGfx, element, attrs = {}) {
20751
- attrs = pickAttrs(attrs, [
20752
- 'fill',
20753
- 'stroke'
20754
- ]);
20755
-
20756
- var task = renderTask(parentGfx, element, attrs);
20757
-
20758
- var x = 15;
20759
- var y = 12;
20760
-
20761
- var pathDataUser1 = pathMap.getScaledPath('TASK_TYPE_USER_1', {
20762
- abspos: {
20763
- x: x,
20764
- y: y
20765
- }
20766
- });
20767
-
20768
- drawPath(parentGfx, pathDataUser1, {
20769
- fill: getFillColor(element, defaultFillColor, attrs.fill),
20770
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20771
- strokeWidth: 0.5
20772
- });
20773
-
20774
- var pathDataUser2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
20775
- abspos: {
20776
- x: x,
20777
- y: y
20778
- }
20779
- });
20780
-
20781
- drawPath(parentGfx, pathDataUser2, {
20782
- fill: getFillColor(element, defaultFillColor, attrs.fill),
20783
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20784
- strokeWidth: 0.5
20785
- });
20786
-
20787
- var pathDataUser3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
20788
- abspos: {
20789
- x: x,
20790
- y: y
20791
- }
20792
- });
20793
-
20794
- drawPath(parentGfx, pathDataUser3, {
20795
- fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20796
- stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20797
- strokeWidth: 0.5
20798
- });
20799
-
20800
- return task;
20801
- },
20802
- 'label': function(parentGfx, element, attrs = {}) {
20803
- return renderExternalLabel(parentGfx, element, attrs);
20804
- }
20805
- };
20806
-
20807
- // extension API, use at your own risk
20808
- this._drawPath = drawPath;
20809
-
20810
- this._renderer = renderer;
20811
- }
20812
-
20813
-
20814
- e$2(BpmnRenderer, BaseRenderer);
20815
-
20816
- BpmnRenderer.$inject = [
20817
- 'config.bpmnRenderer',
20818
- 'eventBus',
20819
- 'styles',
20820
- 'pathMap',
20821
- 'canvas',
20822
- 'textRenderer'
20823
- ];
20824
-
20825
-
20826
- /**
20827
- * @param {Element} element
20828
- *
20829
- * @return {boolean}
20830
- */
20831
- BpmnRenderer.prototype.canRender = function(element) {
20832
- return is(element, 'bpmn:BaseElement');
20833
- };
20834
-
20835
- /**
20836
- * Draw shape into parentGfx.
20837
- *
20838
- * @param {SVGElement} parentGfx
20839
- * @param {Shape} shape
20840
- * @param {Attrs} [attrs]
20841
- *
20842
- * @return {SVGElement} mainGfx
20843
- */
20844
- BpmnRenderer.prototype.drawShape = function(parentGfx, shape, attrs = {}) {
20845
- var { type } = shape;
20846
-
20847
- var handler = this._renderer(type);
20848
-
20849
- return handler(parentGfx, shape, attrs);
20850
- };
20851
-
20852
- /**
20853
- * Draw connection into parentGfx.
20854
- *
20855
- * @param {SVGElement} parentGfx
20856
- * @param {Connection} connection
20857
- * @param {Attrs} [attrs]
20858
- *
20859
- * @return {SVGElement} mainGfx
20860
- */
20861
- BpmnRenderer.prototype.drawConnection = function(parentGfx, connection, attrs = {}) {
20862
- var { type } = connection;
20863
-
20864
- var handler = this._renderer(type);
20865
-
20866
- return handler(parentGfx, connection, attrs);
20867
- };
20868
-
20869
- /**
20870
- * Get shape path.
20871
- *
20872
- * @param {Shape} shape
20873
- *
20874
- * @return {string} path
20875
- */
20876
- BpmnRenderer.prototype.getShapePath = function(shape) {
20877
- if (is(shape, 'bpmn:Event')) {
20878
- return getCirclePath(shape);
20879
- }
20880
-
20881
- if (is(shape, 'bpmn:Activity')) {
20882
- return getRoundRectPath(shape, TASK_BORDER_RADIUS);
20883
- }
20884
-
20885
- if (is(shape, 'bpmn:Gateway')) {
20886
- return getDiamondPath(shape);
20887
- }
20888
-
20889
- return getRectPath(shape);
20890
- };
20891
-
20892
- /**
20893
- * Pick attributes if they exist.
20894
- *
20895
- * @param {Object} attrs
20896
- * @param {string[]} keys
20897
- *
20898
- * @returns {Object}
20899
- */
20900
- function pickAttrs(attrs, keys = []) {
20901
- return keys.reduce((pickedAttrs, key) => {
20902
- if (attrs[ key ]) {
20903
- pickedAttrs[ key ] = attrs[ key ];
20904
- }
20905
-
20906
- return pickedAttrs;
20907
- }, {});
18583
+ var markerIds = new Ids$1();
18584
+
18585
+ var ELEMENT_LABEL_DISTANCE$1 = 10,
18586
+ INNER_OUTER_DIST = 3,
18587
+ PARTICIPANT_STROKE_WIDTH = 1.5,
18588
+ TASK_BORDER_RADIUS = 10;
18589
+
18590
+ var DEFAULT_OPACITY = 0.95,
18591
+ FULL_OPACITY = 1,
18592
+ LOW_OPACITY = 0.25;
18593
+
18594
+ /**
18595
+ * @typedef { Partial<{
18596
+ * defaultFillColor: string,
18597
+ * defaultStrokeColor: string,
18598
+ * defaultLabelColor: string
18599
+ * }> } BpmnRendererConfig
18600
+ *
18601
+ * @typedef { Partial<{
18602
+ * fill: string,
18603
+ * stroke: string,
18604
+ * width: string,
18605
+ * height: string
18606
+ * }> } Attrs
18607
+ */
18608
+
18609
+ /**
18610
+ * @typedef { import('../model/Types').Element } Element
18611
+ * @typedef { import('../model/Types').Shape } Shape
18612
+ * @typedef { import('../model/Types').Connection } Connection
18613
+ */
18614
+
18615
+ /**
18616
+ * A renderer for BPMN elements
18617
+ *
18618
+ * @param {BpmnRendererConfig} config
18619
+ * @param {import('diagram-js/lib/core/EventBus').default} eventBus
18620
+ * @param {import('diagram-js/lib/draw/Styles').default} styles
18621
+ * @param {import('./PathMap').default} pathMap
18622
+ * @param {import('diagram-js/lib/core/Canvas').default} canvas
18623
+ * @param {import('./TextRenderer').default} textRenderer
18624
+ * @param {number} [priority]
18625
+ */
18626
+ function BpmnRenderer(
18627
+ config, eventBus, styles, pathMap,
18628
+ canvas, textRenderer, priority) {
18629
+
18630
+ BaseRenderer.call(this, eventBus, priority);
18631
+
18632
+ var defaultFillColor = config && config.defaultFillColor,
18633
+ defaultStrokeColor = config && config.defaultStrokeColor,
18634
+ defaultLabelColor = config && config.defaultLabelColor;
18635
+
18636
+ function shapeStyle(attrs) {
18637
+ return styles.computeStyle(attrs, {
18638
+ strokeLinecap: 'round',
18639
+ strokeLinejoin: 'round',
18640
+ stroke: black,
18641
+ strokeWidth: 2,
18642
+ fill: 'white'
18643
+ });
18644
+ }
18645
+
18646
+ function lineStyle(attrs) {
18647
+ return styles.computeStyle(attrs, [ 'no-fill' ], {
18648
+ strokeLinecap: 'round',
18649
+ strokeLinejoin: 'round',
18650
+ stroke: black,
18651
+ strokeWidth: 2
18652
+ });
18653
+ }
18654
+
18655
+ function addMarker(id, options) {
18656
+ var {
18657
+ ref = { x: 0, y: 0 },
18658
+ scale = 1,
18659
+ element,
18660
+ parentGfx = canvas._svg
18661
+ } = options;
18662
+
18663
+ var marker = create$1('marker', {
18664
+ id: id,
18665
+ viewBox: '0 0 20 20',
18666
+ refX: ref.x,
18667
+ refY: ref.y,
18668
+ markerWidth: 20 * scale,
18669
+ markerHeight: 20 * scale,
18670
+ orient: 'auto'
18671
+ });
18672
+
18673
+ append(marker, element);
18674
+
18675
+ var defs = query(':scope > defs', parentGfx);
18676
+
18677
+ if (!defs) {
18678
+ defs = create$1('defs');
18679
+
18680
+ append(parentGfx, defs);
18681
+ }
18682
+
18683
+ append(defs, marker);
18684
+ }
18685
+
18686
+ function marker(parentGfx, type, fill, stroke) {
18687
+
18688
+
18689
+ var id = markerIds.nextPrefixed('marker-');
18690
+
18691
+ createMarker(parentGfx, id, type, fill, stroke);
18692
+
18693
+ return 'url(#' + id + ')';
18694
+ }
18695
+
18696
+ function createMarker(parentGfx, id, type, fill, stroke) {
18697
+
18698
+ if (type === 'sequenceflow-end') {
18699
+ var sequenceflowEnd = create$1('path', {
18700
+ d: 'M 1 5 L 11 10 L 1 15 Z',
18701
+ ...shapeStyle({
18702
+ fill: stroke,
18703
+ stroke: stroke,
18704
+ strokeWidth: 1
18705
+ })
18706
+ });
18707
+
18708
+ addMarker(id, {
18709
+ element: sequenceflowEnd,
18710
+ ref: { x: 11, y: 10 },
18711
+ scale: 0.5,
18712
+ parentGfx
18713
+ });
18714
+ }
18715
+
18716
+ if (type === 'messageflow-start') {
18717
+ var messageflowStart = create$1('circle', {
18718
+ cx: 6,
18719
+ cy: 6,
18720
+ r: 3.5,
18721
+ ...shapeStyle({
18722
+ fill,
18723
+ stroke: stroke,
18724
+ strokeWidth: 1,
18725
+
18726
+ // fix for safari / chrome / firefox bug not correctly
18727
+ // resetting stroke dash array
18728
+ strokeDasharray: [ 10000, 1 ]
18729
+ })
18730
+ });
18731
+
18732
+ addMarker(id, {
18733
+ element: messageflowStart,
18734
+ ref: { x: 6, y: 6 },
18735
+ parentGfx
18736
+ });
18737
+ }
18738
+
18739
+ if (type === 'messageflow-end') {
18740
+ var messageflowEnd = create$1('path', {
18741
+ d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
18742
+ ...shapeStyle({
18743
+ fill,
18744
+ stroke: stroke,
18745
+ strokeWidth: 1,
18746
+
18747
+ // fix for safari / chrome / firefox bug not correctly
18748
+ // resetting stroke dash array
18749
+ strokeDasharray: [ 10000, 1 ]
18750
+ })
18751
+ });
18752
+
18753
+ addMarker(id, {
18754
+ element: messageflowEnd,
18755
+ ref: { x: 8.5, y: 5 },
18756
+ parentGfx
18757
+ });
18758
+ }
18759
+
18760
+ if (type === 'association-start') {
18761
+ var associationStart = create$1('path', {
18762
+ d: 'M 11 5 L 1 10 L 11 15',
18763
+ ...lineStyle({
18764
+ fill: 'none',
18765
+ stroke,
18766
+ strokeWidth: 1.5,
18767
+
18768
+ // fix for safari / chrome / firefox bug not correctly
18769
+ // resetting stroke dash array
18770
+ strokeDasharray: [ 10000, 1 ]
18771
+ })
18772
+ });
18773
+
18774
+ addMarker(id, {
18775
+ element: associationStart,
18776
+ ref: { x: 1, y: 10 },
18777
+ scale: 0.5,
18778
+ parentGfx
18779
+ });
18780
+ }
18781
+
18782
+ if (type === 'association-end') {
18783
+ var associationEnd = create$1('path', {
18784
+ d: 'M 1 5 L 11 10 L 1 15',
18785
+ ...lineStyle({
18786
+ fill: 'none',
18787
+ stroke,
18788
+ strokeWidth: 1.5,
18789
+
18790
+ // fix for safari / chrome / firefox bug not correctly
18791
+ // resetting stroke dash array
18792
+ strokeDasharray: [ 10000, 1 ]
18793
+ })
18794
+ });
18795
+
18796
+ addMarker(id, {
18797
+ element: associationEnd,
18798
+ ref: { x: 11, y: 10 },
18799
+ scale: 0.5,
18800
+ parentGfx
18801
+ });
18802
+ }
18803
+
18804
+ if (type === 'conditional-flow-marker') {
18805
+ var conditionalFlowMarker = create$1('path', {
18806
+ d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
18807
+ ...shapeStyle({
18808
+ fill,
18809
+ stroke: stroke
18810
+ })
18811
+ });
18812
+
18813
+ addMarker(id, {
18814
+ element: conditionalFlowMarker,
18815
+ ref: { x: -1, y: 10 },
18816
+ scale: 0.5,
18817
+ parentGfx
18818
+ });
18819
+ }
18820
+
18821
+ if (type === 'conditional-default-flow-marker') {
18822
+ var defaultFlowMarker = create$1('path', {
18823
+ d: 'M 6 4 L 10 16',
18824
+ ...shapeStyle({
18825
+ stroke: stroke,
18826
+ fill: 'none'
18827
+ })
18828
+ });
18829
+
18830
+ addMarker(id, {
18831
+ element: defaultFlowMarker,
18832
+ ref: { x: 0, y: 10 },
18833
+ scale: 0.5,
18834
+ parentGfx
18835
+ });
18836
+ }
18837
+ }
18838
+
18839
+ function drawCircle(parentGfx, width, height, offset, attrs = {}) {
18840
+
18841
+ if (isObject(offset)) {
18842
+ attrs = offset;
18843
+ offset = 0;
18844
+ }
18845
+
18846
+ offset = offset || 0;
18847
+
18848
+ attrs = shapeStyle(attrs);
18849
+
18850
+ var cx = width / 2,
18851
+ cy = height / 2;
18852
+
18853
+ var circle = create$1('circle', {
18854
+ cx: cx,
18855
+ cy: cy,
18856
+ r: Math.round((width + height) / 4 - offset),
18857
+ ...attrs
18858
+ });
18859
+
18860
+ append(parentGfx, circle);
18861
+
18862
+ return circle;
18863
+ }
18864
+
18865
+ function drawRect(parentGfx, width, height, r, offset, attrs) {
18866
+
18867
+ if (isObject(offset)) {
18868
+ attrs = offset;
18869
+ offset = 0;
18870
+ }
18871
+
18872
+ offset = offset || 0;
18873
+
18874
+ attrs = shapeStyle(attrs);
18875
+
18876
+ var rect = create$1('rect', {
18877
+ x: offset,
18878
+ y: offset,
18879
+ width: width - offset * 2,
18880
+ height: height - offset * 2,
18881
+ rx: r,
18882
+ ry: r,
18883
+ ...attrs
18884
+ });
18885
+
18886
+ append(parentGfx, rect);
18887
+
18888
+ return rect;
18889
+ }
18890
+
18891
+ function drawDiamond(parentGfx, width, height, attrs) {
18892
+
18893
+ var x_2 = width / 2;
18894
+ var y_2 = height / 2;
18895
+
18896
+ var points = [
18897
+ { x: x_2, y: 0 },
18898
+ { x: width, y: y_2 },
18899
+ { x: x_2, y: height },
18900
+ { x: 0, y: y_2 }
18901
+ ];
18902
+
18903
+ var pointsString = points.map(function(point) {
18904
+ return point.x + ',' + point.y;
18905
+ }).join(' ');
18906
+
18907
+ attrs = shapeStyle(attrs);
18908
+
18909
+ var polygon = create$1('polygon', {
18910
+ ...attrs,
18911
+ points: pointsString
18912
+ });
18913
+
18914
+ append(parentGfx, polygon);
18915
+
18916
+ return polygon;
18917
+ }
18918
+
18919
+ /**
18920
+ * @param {SVGElement} parentGfx
18921
+ * @param {Point[]} waypoints
18922
+ * @param {any} attrs
18923
+ * @param {number} [radius]
18924
+ *
18925
+ * @return {SVGElement}
18926
+ */
18927
+ function drawLine(parentGfx, waypoints, attrs, radius) {
18928
+ attrs = lineStyle(attrs);
18929
+
18930
+ var line = createLine(waypoints, attrs, radius);
18931
+
18932
+ append(parentGfx, line);
18933
+
18934
+ return line;
18935
+ }
18936
+
18937
+ /**
18938
+ * @param {SVGElement} parentGfx
18939
+ * @param {Point[]} waypoints
18940
+ * @param {any} attrs
18941
+ *
18942
+ * @return {SVGElement}
18943
+ */
18944
+ function drawConnectionSegments(parentGfx, waypoints, attrs) {
18945
+ return drawLine(parentGfx, waypoints, attrs, 5);
18946
+ }
18947
+
18948
+ function drawPath(parentGfx, d, attrs) {
18949
+ attrs = lineStyle(attrs);
18950
+
18951
+ var path = create$1('path', {
18952
+ ...attrs,
18953
+ d
18954
+ });
18955
+
18956
+ append(parentGfx, path);
18957
+
18958
+ return path;
18959
+ }
18960
+
18961
+ function drawMarker(type, parentGfx, path, attrs) {
18962
+ return drawPath(parentGfx, path, assign$1({ 'data-marker': type }, attrs));
18963
+ }
18964
+
18965
+ function renderer(type) {
18966
+ return handlers[type];
18967
+ }
18968
+
18969
+ function as(type) {
18970
+ return function(parentGfx, element, attrs) {
18971
+ return renderer(type)(parentGfx, element, attrs);
18972
+ };
18973
+ }
18974
+
18975
+ var eventIconRenderers = {
18976
+ 'bpmn:MessageEventDefinition': function(parentGfx, element, attrs = {}, isThrowing) {
18977
+ var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
18978
+ xScaleFactor: 0.9,
18979
+ yScaleFactor: 0.9,
18980
+ containerWidth: attrs.width || element.width,
18981
+ containerHeight: attrs.height || element.height,
18982
+ position: {
18983
+ mx: 0.235,
18984
+ my: 0.315
18985
+ }
18986
+ });
18987
+
18988
+ var fill = isThrowing
18989
+ ? getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
18990
+ : getFillColor(element, defaultFillColor, attrs.fill);
18991
+
18992
+ var stroke = isThrowing
18993
+ ? getFillColor(element, defaultFillColor, attrs.fill)
18994
+ : getStrokeColor$1(element, defaultStrokeColor, attrs.stroke);
18995
+
18996
+ var messagePath = drawPath(parentGfx, pathData, {
18997
+ fill,
18998
+ stroke,
18999
+ strokeWidth: 1
19000
+ });
19001
+
19002
+ return messagePath;
19003
+ },
19004
+ 'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) {
19005
+ var baseWidth = attrs.width || element.width;
19006
+ var baseHeight = attrs.height || element.height;
19007
+
19008
+ // use a lighter stroke for event suprocess icons
19009
+ var strokeWidth = attrs.width ? 1 : 2;
19010
+
19011
+ var circle = drawCircle(parentGfx, baseWidth, baseHeight, 0.2 * baseHeight, {
19012
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
19013
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19014
+ strokeWidth: strokeWidth
19015
+ });
19016
+
19017
+ var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
19018
+ xScaleFactor: 0.75,
19019
+ yScaleFactor: 0.75,
19020
+ containerWidth: baseWidth,
19021
+ containerHeight: baseHeight,
19022
+ position: {
19023
+ mx: 0.5,
19024
+ my: 0.5
19025
+ }
19026
+ });
19027
+
19028
+ drawPath(parentGfx, pathData, {
19029
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19030
+ strokeWidth: strokeWidth
19031
+ });
19032
+
19033
+ for (var i = 0; i < 12; i++) {
19034
+ var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
19035
+ xScaleFactor: 0.75,
19036
+ yScaleFactor: 0.75,
19037
+ containerWidth: baseWidth,
19038
+ containerHeight: baseHeight,
19039
+ position: {
19040
+ mx: 0.5,
19041
+ my: 0.5
19042
+ }
19043
+ });
19044
+
19045
+ var width = baseWidth / 2,
19046
+ height = baseHeight / 2;
19047
+
19048
+ drawPath(parentGfx, linePathData, {
19049
+ strokeWidth: 1,
19050
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19051
+ transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')'
19052
+ });
19053
+ }
19054
+
19055
+ return circle;
19056
+ },
19057
+ 'bpmn:EscalationEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
19058
+ var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
19059
+ xScaleFactor: 1,
19060
+ yScaleFactor: 1,
19061
+ containerWidth: attrs.width || event.width,
19062
+ containerHeight: attrs.height || event.height,
19063
+ position: {
19064
+ mx: 0.5,
19065
+ my: 0.2
19066
+ }
19067
+ });
19068
+
19069
+ var fill = isThrowing
19070
+ ? getStrokeColor$1(event, defaultStrokeColor, attrs.stroke)
19071
+ : getFillColor(event, defaultFillColor, attrs.fill);
19072
+
19073
+ return drawPath(parentGfx, pathData, {
19074
+ fill,
19075
+ stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19076
+ strokeWidth: 1
19077
+ });
19078
+ },
19079
+ 'bpmn:ConditionalEventDefinition': function(parentGfx, event, attrs = {}) {
19080
+ var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
19081
+ xScaleFactor: 1,
19082
+ yScaleFactor: 1,
19083
+ containerWidth: attrs.width || event.width,
19084
+ containerHeight: attrs.height || event.height,
19085
+ position: {
19086
+ mx: 0.5,
19087
+ my: 0.222
19088
+ }
19089
+ });
19090
+
19091
+ return drawPath(parentGfx, pathData, {
19092
+ fill: getFillColor(event, defaultFillColor, attrs.fill),
19093
+ stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19094
+ strokeWidth: 1
19095
+ });
19096
+ },
19097
+ 'bpmn:LinkEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
19098
+ var pathData = pathMap.getScaledPath('EVENT_LINK', {
19099
+ xScaleFactor: 1,
19100
+ yScaleFactor: 1,
19101
+ containerWidth: event.width,
19102
+ containerHeight: event.height,
19103
+ position: {
19104
+ mx: 0.57,
19105
+ my: 0.263
19106
+ }
19107
+ });
19108
+
19109
+ var fill = isThrowing
19110
+ ? getStrokeColor$1(event, defaultStrokeColor, attrs.stroke)
19111
+ : getFillColor(event, defaultFillColor, attrs.fill);
19112
+
19113
+ return drawPath(parentGfx, pathData, {
19114
+ fill,
19115
+ stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19116
+ strokeWidth: 1
19117
+ });
19118
+ },
19119
+ 'bpmn:ErrorEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
19120
+ var pathData = pathMap.getScaledPath('EVENT_ERROR', {
19121
+ xScaleFactor: 1.1,
19122
+ yScaleFactor: 1.1,
19123
+ containerWidth: attrs.width || event.width,
19124
+ containerHeight: attrs.height || event.height,
19125
+ position: {
19126
+ mx: 0.2,
19127
+ my: 0.722
19128
+ }
19129
+ });
19130
+
19131
+ var fill = isThrowing
19132
+ ? getStrokeColor$1(event, defaultStrokeColor, attrs.stroke)
19133
+ : getFillColor(event, defaultFillColor, attrs.fill);
19134
+
19135
+ return drawPath(parentGfx, pathData, {
19136
+ fill,
19137
+ stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19138
+ strokeWidth: 1
19139
+ });
19140
+ },
19141
+ 'bpmn:CancelEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
19142
+ var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
19143
+ xScaleFactor: 1.0,
19144
+ yScaleFactor: 1.0,
19145
+ containerWidth: event.width,
19146
+ containerHeight: event.height,
19147
+ position: {
19148
+ mx: 0.638,
19149
+ my: -0.055
19150
+ }
19151
+ });
19152
+
19153
+ var fill = isThrowing ? getStrokeColor$1(event, defaultStrokeColor, attrs.stroke) : 'none';
19154
+
19155
+ var path = drawPath(parentGfx, pathData, {
19156
+ fill,
19157
+ stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19158
+ strokeWidth: 1
19159
+ });
19160
+
19161
+ rotate(path, 45);
19162
+
19163
+ return path;
19164
+ },
19165
+ 'bpmn:CompensateEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
19166
+ var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
19167
+ xScaleFactor: 1,
19168
+ yScaleFactor: 1,
19169
+ containerWidth: attrs.width || event.width,
19170
+ containerHeight: attrs.height || event.height,
19171
+ position: {
19172
+ mx: 0.22,
19173
+ my: 0.5
19174
+ }
19175
+ });
19176
+
19177
+ var fill = isThrowing
19178
+ ? getStrokeColor$1(event, defaultStrokeColor, attrs.stroke)
19179
+ : getFillColor(event, defaultFillColor, attrs.fill);
19180
+
19181
+ return drawPath(parentGfx, pathData, {
19182
+ fill,
19183
+ stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19184
+ strokeWidth: 1
19185
+ });
19186
+ },
19187
+ 'bpmn:SignalEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
19188
+ var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
19189
+ xScaleFactor: 0.9,
19190
+ yScaleFactor: 0.9,
19191
+ containerWidth: attrs.width || event.width,
19192
+ containerHeight: attrs.height || event.height,
19193
+ position: {
19194
+ mx: 0.5,
19195
+ my: 0.2
19196
+ }
19197
+ });
19198
+
19199
+ var fill = isThrowing
19200
+ ? getStrokeColor$1(event, defaultStrokeColor, attrs.stroke)
19201
+ : getFillColor(event, defaultFillColor, attrs.fill);
19202
+
19203
+ return drawPath(parentGfx, pathData, {
19204
+ strokeWidth: 1,
19205
+ fill,
19206
+ stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke)
19207
+ });
19208
+ },
19209
+ 'bpmn:MultipleEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
19210
+ var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
19211
+ xScaleFactor: 1.1,
19212
+ yScaleFactor: 1.1,
19213
+ containerWidth: attrs.width || event.width,
19214
+ containerHeight: attrs.height || event.height,
19215
+ position: {
19216
+ mx: 0.211,
19217
+ my: 0.36
19218
+ }
19219
+ });
19220
+
19221
+ var fill = isThrowing
19222
+ ? getStrokeColor$1(event, defaultStrokeColor, attrs.stroke)
19223
+ : getFillColor(event, defaultFillColor, attrs.fill);
19224
+
19225
+ return drawPath(parentGfx, pathData, {
19226
+ fill,
19227
+ stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19228
+ strokeWidth: 1
19229
+ });
19230
+ },
19231
+ 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event, attrs = {}) {
19232
+ var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
19233
+ xScaleFactor: 1.2,
19234
+ yScaleFactor: 1.2,
19235
+ containerWidth: attrs.width || event.width,
19236
+ containerHeight: attrs.height || event.height,
19237
+ position: {
19238
+ mx: 0.458,
19239
+ my: 0.194
19240
+ }
19241
+ });
19242
+
19243
+ return drawPath(parentGfx, pathData, {
19244
+ fill: getFillColor(event, defaultFillColor, attrs.fill),
19245
+ stroke: getStrokeColor$1(event, defaultStrokeColor, attrs.stroke),
19246
+ strokeWidth: 1
19247
+ });
19248
+ },
19249
+ 'bpmn:TerminateEventDefinition': function(parentGfx, element, attrs = {}) {
19250
+ var circle = drawCircle(parentGfx, element.width, element.height, 8, {
19251
+ fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19252
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19253
+ strokeWidth: 4
19254
+ });
19255
+
19256
+ return circle;
19257
+ }
19258
+ };
19259
+
19260
+ function renderEventIcon(element, parentGfx, attrs = {}, proxyElement) {
19261
+ var semantic = getBusinessObject(element),
19262
+ isThrowing = isThrowEvent(semantic);
19263
+
19264
+ var nodeElement = proxyElement || element;
19265
+
19266
+ if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
19267
+ if (semantic.get('parallelMultiple')) {
19268
+ return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19269
+ }
19270
+ else {
19271
+ return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19272
+ }
19273
+ }
19274
+
19275
+ if (isTypedEvent(semantic, 'bpmn:MessageEventDefinition')) {
19276
+ return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19277
+ }
19278
+
19279
+ if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
19280
+ return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19281
+ }
19282
+
19283
+ if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
19284
+ return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19285
+ }
19286
+
19287
+ if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
19288
+ return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19289
+ }
19290
+
19291
+ if (isTypedEvent(semantic, 'bpmn:EscalationEventDefinition')) {
19292
+ return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19293
+ }
19294
+
19295
+ if (isTypedEvent(semantic, 'bpmn:LinkEventDefinition')) {
19296
+ return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19297
+ }
19298
+
19299
+ if (isTypedEvent(semantic, 'bpmn:ErrorEventDefinition')) {
19300
+ return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19301
+ }
19302
+
19303
+ if (isTypedEvent(semantic, 'bpmn:CancelEventDefinition')) {
19304
+ return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19305
+ }
19306
+
19307
+ if (isTypedEvent(semantic, 'bpmn:CompensateEventDefinition')) {
19308
+ return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19309
+ }
19310
+
19311
+ if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
19312
+ return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
19313
+ }
19314
+
19315
+ return null;
19316
+ }
19317
+
19318
+ var taskMarkerRenderers = {
19319
+ 'ParticipantMultiplicityMarker': function(parentGfx, element, attrs = {}) {
19320
+ var width = getWidth(element, attrs),
19321
+ height = getHeight(element, attrs);
19322
+
19323
+ var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
19324
+ xScaleFactor: 1,
19325
+ yScaleFactor: 1,
19326
+ containerWidth: width,
19327
+ containerHeight: height,
19328
+ position: {
19329
+ mx: ((width / 2 - 6) / width),
19330
+ my: (height - 15) / height
19331
+ }
19332
+ });
19333
+
19334
+ drawMarker('participant-multiplicity', parentGfx, markerPath, {
19335
+ strokeWidth: 2,
19336
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
19337
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19338
+ });
19339
+ },
19340
+ 'SubProcessMarker': function(parentGfx, element, attrs = {}) {
19341
+ var markerRect = drawRect(parentGfx, 14, 14, 0, {
19342
+ strokeWidth: 1,
19343
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
19344
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19345
+ });
19346
+
19347
+ translate$1(markerRect, element.width / 2 - 7.5, element.height - 20);
19348
+
19349
+ var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
19350
+ xScaleFactor: 1.5,
19351
+ yScaleFactor: 1.5,
19352
+ containerWidth: element.width,
19353
+ containerHeight: element.height,
19354
+ position: {
19355
+ mx: (element.width / 2 - 7.5) / element.width,
19356
+ my: (element.height - 20) / element.height
19357
+ }
19358
+ });
19359
+
19360
+ drawMarker('sub-process', parentGfx, markerPath, {
19361
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
19362
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19363
+ });
19364
+ },
19365
+ 'ParallelMarker': function(parentGfx, element, attrs) {
19366
+ var width = getWidth(element, attrs),
19367
+ height = getHeight(element, attrs);
19368
+
19369
+ var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
19370
+ xScaleFactor: 1,
19371
+ yScaleFactor: 1,
19372
+ containerWidth: width,
19373
+ containerHeight: height,
19374
+ position: {
19375
+ mx: ((width / 2 + attrs.parallel) / width),
19376
+ my: (height - 20) / height
19377
+ }
19378
+ });
19379
+
19380
+ drawMarker('parallel', parentGfx, markerPath, {
19381
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
19382
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19383
+ });
19384
+ },
19385
+ 'SequentialMarker': function(parentGfx, element, attrs) {
19386
+ var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
19387
+ xScaleFactor: 1,
19388
+ yScaleFactor: 1,
19389
+ containerWidth: element.width,
19390
+ containerHeight: element.height,
19391
+ position: {
19392
+ mx: ((element.width / 2 + attrs.seq) / element.width),
19393
+ my: (element.height - 19) / element.height
19394
+ }
19395
+ });
19396
+
19397
+ drawMarker('sequential', parentGfx, markerPath, {
19398
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
19399
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19400
+ });
19401
+ },
19402
+ 'CompensationMarker': function(parentGfx, element, attrs) {
19403
+ var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
19404
+ xScaleFactor: 1,
19405
+ yScaleFactor: 1,
19406
+ containerWidth: element.width,
19407
+ containerHeight: element.height,
19408
+ position: {
19409
+ mx: ((element.width / 2 + attrs.compensation) / element.width),
19410
+ my: (element.height - 13) / element.height
19411
+ }
19412
+ });
19413
+
19414
+ drawMarker('compensation', parentGfx, markerMath, {
19415
+ strokeWidth: 1,
19416
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
19417
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19418
+ });
19419
+ },
19420
+ 'LoopMarker': function(parentGfx, element, attrs) {
19421
+ var width = getWidth(element, attrs),
19422
+ height = getHeight(element, attrs);
19423
+
19424
+ var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
19425
+ xScaleFactor: 1,
19426
+ yScaleFactor: 1,
19427
+ containerWidth: width,
19428
+ containerHeight: height,
19429
+ position: {
19430
+ mx: ((width / 2 + attrs.loop) / width),
19431
+ my: (height - 7) / height
19432
+ }
19433
+ });
19434
+
19435
+ drawMarker('loop', parentGfx, markerPath, {
19436
+ strokeWidth: 1.5,
19437
+ fill: 'none',
19438
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19439
+ strokeMiterlimit: 0.5
19440
+ });
19441
+ },
19442
+ 'AdhocMarker': function(parentGfx, element, attrs) {
19443
+ var width = getWidth(element, attrs),
19444
+ height = getHeight(element, attrs);
19445
+
19446
+ var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
19447
+ xScaleFactor: 1,
19448
+ yScaleFactor: 1,
19449
+ containerWidth: width,
19450
+ containerHeight: height,
19451
+ position: {
19452
+ mx: ((width / 2 + attrs.adhoc) / width),
19453
+ my: (height - 15) / height
19454
+ }
19455
+ });
19456
+
19457
+ drawMarker('adhoc', parentGfx, markerPath, {
19458
+ strokeWidth: 1,
19459
+ fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19460
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19461
+ });
19462
+ }
19463
+ };
19464
+
19465
+ function renderTaskMarker(type, parentGfx, element, attrs) {
19466
+ taskMarkerRenderers[ type ](parentGfx, element, attrs);
19467
+ }
19468
+
19469
+ function renderTaskMarkers(parentGfx, element, taskMarkers = [], attrs = {}) {
19470
+ attrs = {
19471
+ fill: attrs.fill,
19472
+ stroke: attrs.stroke,
19473
+ width: getWidth(element, attrs),
19474
+ height: getHeight(element, attrs)
19475
+ };
19476
+
19477
+ var semantic = getBusinessObject(element);
19478
+
19479
+ var subprocess = taskMarkers.includes('SubProcessMarker');
19480
+
19481
+ if (subprocess) {
19482
+ attrs = {
19483
+ ...attrs,
19484
+ seq: -21,
19485
+ parallel: -22,
19486
+ compensation: -25,
19487
+ loop: -18,
19488
+ adhoc: 10
19489
+ };
19490
+ } else {
19491
+ attrs = {
19492
+ ...attrs,
19493
+ seq: -5,
19494
+ parallel: -6,
19495
+ compensation: -7,
19496
+ loop: 0,
19497
+ adhoc: -8
19498
+ };
19499
+ }
19500
+
19501
+ if (semantic.get('isForCompensation')) {
19502
+ taskMarkers.push('CompensationMarker');
19503
+ }
19504
+
19505
+ if (is(semantic, 'bpmn:AdHocSubProcess')) {
19506
+ taskMarkers.push('AdhocMarker');
19507
+
19508
+ if (!subprocess) {
19509
+ assign$1(attrs, { compensation: attrs.compensation - 18 });
19510
+ }
19511
+ }
19512
+
19513
+ var loopCharacteristics = semantic.get('loopCharacteristics'),
19514
+ isSequential = loopCharacteristics && loopCharacteristics.get('isSequential');
19515
+
19516
+ if (loopCharacteristics) {
19517
+
19518
+ assign$1(attrs, {
19519
+ compensation: attrs.compensation - 18,
19520
+ });
19521
+
19522
+ if (taskMarkers.includes('AdhocMarker')) {
19523
+ assign$1(attrs, {
19524
+ seq: -23,
19525
+ loop: -18,
19526
+ parallel: -24
19527
+ });
19528
+ }
19529
+
19530
+ if (isSequential === undefined) {
19531
+ taskMarkers.push('LoopMarker');
19532
+ }
19533
+
19534
+ if (isSequential === false) {
19535
+ taskMarkers.push('ParallelMarker');
19536
+ }
19537
+
19538
+ if (isSequential === true) {
19539
+ taskMarkers.push('SequentialMarker');
19540
+ }
19541
+ }
19542
+
19543
+ if (taskMarkers.includes('CompensationMarker') && taskMarkers.length === 1) {
19544
+ assign$1(attrs, {
19545
+ compensation: -8
19546
+ });
19547
+ }
19548
+
19549
+ forEach$1(taskMarkers, function(marker) {
19550
+ renderTaskMarker(marker, parentGfx, element, attrs);
19551
+ });
19552
+ }
19553
+
19554
+ function renderLabel(parentGfx, label, attrs = {}) {
19555
+ attrs = assign$1({
19556
+ size: {
19557
+ width: 100
19558
+ }
19559
+ }, attrs);
19560
+
19561
+ var text = textRenderer.createText(label || '', attrs);
19562
+
19563
+ classes(text).add('djs-label');
19564
+
19565
+ append(parentGfx, text);
19566
+
19567
+ return text;
19568
+ }
19569
+
19570
+ function renderEmbeddedLabel(parentGfx, element, align, attrs = {}) {
19571
+ var semantic = getBusinessObject(element);
19572
+
19573
+ var box = getBounds$1({
19574
+ x: element.x,
19575
+ y: element.y,
19576
+ width: element.width,
19577
+ height: element.height
19578
+ }, attrs);
19579
+
19580
+ return renderLabel(parentGfx, semantic.name, {
19581
+ align,
19582
+ box,
19583
+ padding: 7,
19584
+ style: {
19585
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
19586
+ }
19587
+ });
19588
+ }
19589
+
19590
+ function renderExternalLabel(parentGfx, element, attrs = {}) {
19591
+ var box = {
19592
+ width: 90,
19593
+ height: 30,
19594
+ x: element.width / 2 + element.x,
19595
+ y: element.height / 2 + element.y
19596
+ };
19597
+
19598
+ return renderLabel(parentGfx, getLabel(element), {
19599
+ box: box,
19600
+ fitBox: true,
19601
+ style: assign$1(
19602
+ {},
19603
+ textRenderer.getExternalStyle(),
19604
+ {
19605
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
19606
+ }
19607
+ )
19608
+ });
19609
+ }
19610
+
19611
+ function renderLaneLabel(parentGfx, text, element, attrs = {}) {
19612
+ var isHorizontalLane = isHorizontal$3(element);
19613
+
19614
+ var textBox = renderLabel(parentGfx, text, {
19615
+ box: {
19616
+ height: 30,
19617
+ width: isHorizontalLane ? getHeight(element, attrs) : getWidth(element, attrs),
19618
+ },
19619
+ align: 'center-middle',
19620
+ style: {
19621
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
19622
+ }
19623
+ });
19624
+
19625
+ if (isHorizontalLane) {
19626
+ var top = -1 * getHeight(element, attrs);
19627
+ transform(textBox, 0, -top, 270);
19628
+ }
19629
+ }
19630
+
19631
+ function renderActivity(parentGfx, element, attrs = {}) {
19632
+ var {
19633
+ width,
19634
+ height
19635
+ } = getBounds$1(element, attrs);
19636
+
19637
+ return drawRect(parentGfx, width, height, TASK_BORDER_RADIUS, {
19638
+ ...attrs,
19639
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
19640
+ fillOpacity: DEFAULT_OPACITY,
19641
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19642
+ });
19643
+ }
19644
+
19645
+ function renderAssociation(parentGfx, element, attrs = {}) {
19646
+ var semantic = getBusinessObject(element);
19647
+
19648
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
19649
+ stroke = getStrokeColor$1(element, defaultStrokeColor, attrs.stroke);
19650
+
19651
+ if (semantic.get('associationDirection') === 'One' ||
19652
+ semantic.get('associationDirection') === 'Both') {
19653
+ attrs.markerEnd = marker(parentGfx, 'association-end', fill, stroke);
19654
+ }
19655
+
19656
+ if (semantic.get('associationDirection') === 'Both') {
19657
+ attrs.markerStart = marker(parentGfx, 'association-start', fill, stroke);
19658
+ }
19659
+
19660
+ attrs = pickAttrs(attrs, [
19661
+ 'markerStart',
19662
+ 'markerEnd'
19663
+ ]);
19664
+
19665
+ return drawConnectionSegments(parentGfx, element.waypoints, {
19666
+ ...attrs,
19667
+ stroke,
19668
+ strokeDasharray: '0, 5'
19669
+ });
19670
+ }
19671
+
19672
+ function renderDataObject(parentGfx, element, attrs = {}) {
19673
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
19674
+ stroke = getStrokeColor$1(element, defaultStrokeColor, attrs.stroke);
19675
+
19676
+ var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
19677
+ xScaleFactor: 1,
19678
+ yScaleFactor: 1,
19679
+ containerWidth: element.width,
19680
+ containerHeight: element.height,
19681
+ position: {
19682
+ mx: 0.474,
19683
+ my: 0.296
19684
+ }
19685
+ });
19686
+
19687
+ var dataObject = drawPath(parentGfx, pathData, {
19688
+ fill,
19689
+ fillOpacity: DEFAULT_OPACITY,
19690
+ stroke
19691
+ });
19692
+
19693
+ var semantic = getBusinessObject(element);
19694
+
19695
+ if (isCollection(semantic)) {
19696
+ var collectionPathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
19697
+ xScaleFactor: 1,
19698
+ yScaleFactor: 1,
19699
+ containerWidth: element.width,
19700
+ containerHeight: element.height,
19701
+ position: {
19702
+ mx: 0.33,
19703
+ my: (element.height - 18) / element.height
19704
+ }
19705
+ });
19706
+
19707
+ drawPath(parentGfx, collectionPathData, {
19708
+ strokeWidth: 2,
19709
+ fill,
19710
+ stroke
19711
+ });
19712
+ }
19713
+
19714
+ return dataObject;
19715
+ }
19716
+
19717
+ function renderEvent(parentGfx, element, attrs = {}) {
19718
+ return drawCircle(parentGfx, element.width, element.height, {
19719
+ fillOpacity: DEFAULT_OPACITY,
19720
+ ...attrs,
19721
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
19722
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19723
+ });
19724
+ }
19725
+
19726
+ function renderGateway(parentGfx, element, attrs = {}) {
19727
+ return drawDiamond(parentGfx, element.width, element.height, {
19728
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
19729
+ fillOpacity: DEFAULT_OPACITY,
19730
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19731
+ });
19732
+ }
19733
+
19734
+ function renderLane(parentGfx, element, attrs = {}) {
19735
+ var lane = drawRect(parentGfx, getWidth(element, attrs), getHeight(element, attrs), 0, {
19736
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
19737
+ fillOpacity: attrs.fillOpacity || DEFAULT_OPACITY,
19738
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19739
+ strokeWidth: 1.5
19740
+ });
19741
+
19742
+ var semantic = getBusinessObject(element);
19743
+
19744
+ if (is(semantic, 'bpmn:Lane')) {
19745
+ var text = semantic.get('name');
19746
+
19747
+ renderLaneLabel(parentGfx, text, element, attrs);
19748
+ }
19749
+
19750
+ return lane;
19751
+ }
19752
+
19753
+ function renderSubProcess(parentGfx, element, attrs = {}) {
19754
+ var activity = renderActivity(parentGfx, element, attrs);
19755
+
19756
+ var expanded = isExpanded(element);
19757
+
19758
+ if (isEventSubProcess(element)) {
19759
+ attr(activity, {
19760
+ strokeDasharray: '0, 5.5',
19761
+ strokeWidth: 2.5
19762
+ });
19763
+
19764
+ if (!expanded) {
19765
+ var flowElements = getBusinessObject(element).flowElements || [];
19766
+ var startEvents = flowElements.filter(e => is(e, 'bpmn:StartEvent'));
19767
+
19768
+ if (startEvents.length === 1) {
19769
+ renderEventSubProcessIcon(startEvents[0], parentGfx, attrs, element);
19770
+ }
19771
+ }
19772
+ }
19773
+
19774
+ renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle', attrs);
19775
+
19776
+ if (expanded) {
19777
+ renderTaskMarkers(parentGfx, element, undefined, attrs);
19778
+ } else {
19779
+ renderTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ], attrs);
19780
+ }
19781
+
19782
+ return activity;
19783
+ }
19784
+
19785
+ function renderEventSubProcessIcon(startEvent, parentGfx, attrs, proxyElement) {
19786
+ var iconSize = 22;
19787
+
19788
+ // match the colors of the enclosing subprocess
19789
+ var proxyAttrs = {
19790
+ fill: getFillColor(proxyElement, defaultFillColor, attrs.fill),
19791
+ stroke: getStrokeColor$1(proxyElement, defaultStrokeColor, attrs.stroke),
19792
+ width: iconSize,
19793
+ height: iconSize
19794
+ };
19795
+
19796
+ var interrupting = getBusinessObject(startEvent).isInterrupting;
19797
+ var strokeDasharray = interrupting ? 0 : 3;
19798
+
19799
+ // better visibility for non-interrupting events
19800
+ var strokeWidth = interrupting ? 1 : 1.2;
19801
+
19802
+ // make the icon look larger by drawing a smaller circle
19803
+ var circleSize = 20;
19804
+ var shift = (iconSize - circleSize) / 2;
19805
+ var transform = 'translate(' + shift + ',' + shift + ')';
19806
+
19807
+ drawCircle(parentGfx, circleSize, circleSize, {
19808
+ fill: proxyAttrs.fill,
19809
+ stroke: proxyAttrs.stroke,
19810
+ strokeWidth,
19811
+ strokeDasharray,
19812
+ transform
19813
+ });
19814
+
19815
+ renderEventIcon(startEvent, parentGfx, proxyAttrs, proxyElement);
19816
+ }
19817
+
19818
+ function renderTask(parentGfx, element, attrs = {}) {
19819
+ var activity = renderActivity(parentGfx, element, attrs);
19820
+
19821
+ renderEmbeddedLabel(parentGfx, element, 'center-middle', attrs);
19822
+
19823
+ renderTaskMarkers(parentGfx, element, undefined, attrs);
19824
+
19825
+ return activity;
19826
+ }
19827
+
19828
+ var handlers = this.handlers = {
19829
+ 'bpmn:AdHocSubProcess': function(parentGfx, element, attrs = {}) {
19830
+ if (isExpanded(element)) {
19831
+ attrs = pickAttrs(attrs, [
19832
+ 'fill',
19833
+ 'stroke',
19834
+ 'width',
19835
+ 'height'
19836
+ ]);
19837
+ } else {
19838
+ attrs = pickAttrs(attrs, [
19839
+ 'fill',
19840
+ 'stroke'
19841
+ ]);
19842
+ }
19843
+
19844
+ return renderSubProcess(parentGfx, element, attrs);
19845
+ },
19846
+ 'bpmn:Association': function(parentGfx, element, attrs = {}) {
19847
+ attrs = pickAttrs(attrs, [
19848
+ 'fill',
19849
+ 'stroke'
19850
+ ]);
19851
+
19852
+ return renderAssociation(parentGfx, element, attrs);
19853
+ },
19854
+ 'bpmn:BoundaryEvent': function(parentGfx, element, attrs = {}) {
19855
+ var { renderIcon = true } = attrs;
19856
+
19857
+ attrs = pickAttrs(attrs, [
19858
+ 'fill',
19859
+ 'stroke'
19860
+ ]);
19861
+
19862
+ var semantic = getBusinessObject(element),
19863
+ cancelActivity = semantic.get('cancelActivity');
19864
+
19865
+ attrs = {
19866
+ strokeWidth: 1.5,
19867
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
19868
+ fillOpacity: FULL_OPACITY,
19869
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19870
+ };
19871
+
19872
+ if (!cancelActivity) {
19873
+ attrs.strokeDasharray = '6';
19874
+ }
19875
+
19876
+ var event = renderEvent(parentGfx, element, attrs);
19877
+
19878
+ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
19879
+ ...attrs,
19880
+ fill: 'none'
19881
+ });
19882
+
19883
+ if (renderIcon) {
19884
+ renderEventIcon(element, parentGfx, attrs);
19885
+ }
19886
+
19887
+ return event;
19888
+ },
19889
+ 'bpmn:BusinessRuleTask': function(parentGfx, element, attrs = {}) {
19890
+ attrs = pickAttrs(attrs, [
19891
+ 'fill',
19892
+ 'stroke'
19893
+ ]);
19894
+
19895
+ var task = renderTask(parentGfx, element, attrs);
19896
+
19897
+ var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
19898
+ abspos: {
19899
+ x: 8,
19900
+ y: 8
19901
+ }
19902
+ });
19903
+
19904
+ var businessPath = drawPath(parentGfx, headerData);
19905
+
19906
+ attr(businessPath, {
19907
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
19908
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19909
+ strokeWidth: 1
19910
+ });
19911
+
19912
+ var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
19913
+ abspos: {
19914
+ x: 8,
19915
+ y: 8
19916
+ }
19917
+ });
19918
+
19919
+ var businessHeaderPath = drawPath(parentGfx, headerPathData);
19920
+
19921
+ attr(businessHeaderPath, {
19922
+ fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19923
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19924
+ strokeWidth: 1
19925
+ });
19926
+
19927
+ return task;
19928
+ },
19929
+ 'bpmn:CallActivity': function(parentGfx, element, attrs = {}) {
19930
+ attrs = pickAttrs(attrs, [
19931
+ 'fill',
19932
+ 'stroke'
19933
+ ]);
19934
+
19935
+ return renderSubProcess(parentGfx, element, {
19936
+ strokeWidth: 5,
19937
+ ...attrs
19938
+ });
19939
+ },
19940
+ 'bpmn:ComplexGateway': function(parentGfx, element, attrs = {}) {
19941
+ attrs = pickAttrs(attrs, [
19942
+ 'fill',
19943
+ 'stroke'
19944
+ ]);
19945
+
19946
+ var gateway = renderGateway(parentGfx, element, attrs);
19947
+
19948
+ var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
19949
+ xScaleFactor: 0.5,
19950
+ yScaleFactor:0.5,
19951
+ containerWidth: element.width,
19952
+ containerHeight: element.height,
19953
+ position: {
19954
+ mx: 0.46,
19955
+ my: 0.26
19956
+ }
19957
+ });
19958
+
19959
+ drawPath(parentGfx, pathData, {
19960
+ fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19961
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19962
+ strokeWidth: 1
19963
+ });
19964
+
19965
+ return gateway;
19966
+ },
19967
+ 'bpmn:DataInput': function(parentGfx, element, attrs = {}) {
19968
+ attrs = pickAttrs(attrs, [
19969
+ 'fill',
19970
+ 'stroke'
19971
+ ]);
19972
+
19973
+ var arrowPathData = pathMap.getRawPath('DATA_ARROW');
19974
+
19975
+ var dataObject = renderDataObject(parentGfx, element, attrs);
19976
+
19977
+ drawPath(parentGfx, arrowPathData, {
19978
+ fill: 'none',
19979
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19980
+ strokeWidth: 1
19981
+ });
19982
+
19983
+ return dataObject;
19984
+ },
19985
+ 'bpmn:DataInputAssociation': function(parentGfx, element, attrs = {}) {
19986
+ attrs = pickAttrs(attrs, [
19987
+ 'fill',
19988
+ 'stroke'
19989
+ ]);
19990
+
19991
+ return renderAssociation(parentGfx, element, {
19992
+ ...attrs,
19993
+ markerEnd: marker(parentGfx, 'association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor$1(element, defaultStrokeColor, attrs.stroke))
19994
+ });
19995
+ },
19996
+ 'bpmn:DataObject': function(parentGfx, element, attrs = {}) {
19997
+ attrs = pickAttrs(attrs, [
19998
+ 'fill',
19999
+ 'stroke'
20000
+ ]);
20001
+
20002
+ return renderDataObject(parentGfx, element, attrs);
20003
+ },
20004
+ 'bpmn:DataObjectReference': as('bpmn:DataObject'),
20005
+ 'bpmn:DataOutput': function(parentGfx, element, attrs = {}) {
20006
+ attrs = pickAttrs(attrs, [
20007
+ 'fill',
20008
+ 'stroke'
20009
+ ]);
20010
+
20011
+ var arrowPathData = pathMap.getRawPath('DATA_ARROW');
20012
+
20013
+ var dataObject = renderDataObject(parentGfx, element, attrs);
20014
+
20015
+ drawPath(parentGfx, arrowPathData, {
20016
+ strokeWidth: 1,
20017
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
20018
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
20019
+ });
20020
+
20021
+ return dataObject;
20022
+ },
20023
+ 'bpmn:DataOutputAssociation': function(parentGfx, element, attrs = {}) {
20024
+ attrs = pickAttrs(attrs, [
20025
+ 'fill',
20026
+ 'stroke'
20027
+ ]);
20028
+
20029
+ return renderAssociation(parentGfx, element, {
20030
+ ...attrs,
20031
+ markerEnd: marker(parentGfx, 'association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor$1(element, defaultStrokeColor, attrs.stroke))
20032
+ });
20033
+ },
20034
+ 'bpmn:DataStoreReference': function(parentGfx, element, attrs = {}) {
20035
+ attrs = pickAttrs(attrs, [
20036
+ 'fill',
20037
+ 'stroke'
20038
+ ]);
20039
+
20040
+ var dataStorePath = pathMap.getScaledPath('DATA_STORE', {
20041
+ xScaleFactor: 1,
20042
+ yScaleFactor: 1,
20043
+ containerWidth: element.width,
20044
+ containerHeight: element.height,
20045
+ position: {
20046
+ mx: 0,
20047
+ my: 0.133
20048
+ }
20049
+ });
20050
+
20051
+ return drawPath(parentGfx, dataStorePath, {
20052
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
20053
+ fillOpacity: DEFAULT_OPACITY,
20054
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20055
+ strokeWidth: 2
20056
+ });
20057
+ },
20058
+ 'bpmn:EndEvent': function(parentGfx, element, attrs = {}) {
20059
+ var { renderIcon = true } = attrs;
20060
+
20061
+ attrs = pickAttrs(attrs, [
20062
+ 'fill',
20063
+ 'stroke'
20064
+ ]);
20065
+
20066
+ var event = renderEvent(parentGfx, element, {
20067
+ ...attrs,
20068
+ strokeWidth: 4
20069
+ });
20070
+
20071
+ if (renderIcon) {
20072
+ renderEventIcon(element, parentGfx, attrs);
20073
+ }
20074
+
20075
+ return event;
20076
+ },
20077
+ 'bpmn:EventBasedGateway': function(parentGfx, element, attrs = {}) {
20078
+ attrs = pickAttrs(attrs, [
20079
+ 'fill',
20080
+ 'stroke'
20081
+ ]);
20082
+
20083
+ var semantic = getBusinessObject(element);
20084
+
20085
+ var diamond = renderGateway(parentGfx, element, attrs);
20086
+
20087
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
20088
+ fill: getFillColor(element, 'none', attrs.fill),
20089
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20090
+ strokeWidth: 1
20091
+ });
20092
+
20093
+ var type = semantic.get('eventGatewayType'),
20094
+ instantiate = !!semantic.get('instantiate');
20095
+
20096
+ function drawEvent() {
20097
+
20098
+ var pathData = pathMap.getScaledPath('GATEWAY_EVENT_BASED', {
20099
+ xScaleFactor: 0.18,
20100
+ yScaleFactor: 0.18,
20101
+ containerWidth: element.width,
20102
+ containerHeight: element.height,
20103
+ position: {
20104
+ mx: 0.36,
20105
+ my: 0.44
20106
+ }
20107
+ });
20108
+
20109
+ drawPath(parentGfx, pathData, {
20110
+ fill: 'none',
20111
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20112
+ strokeWidth: 2
20113
+ });
20114
+ }
20115
+
20116
+ if (type === 'Parallel') {
20117
+ var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
20118
+ xScaleFactor: 0.4,
20119
+ yScaleFactor: 0.4,
20120
+ containerWidth: element.width,
20121
+ containerHeight: element.height,
20122
+ position: {
20123
+ mx: 0.474,
20124
+ my: 0.296
20125
+ }
20126
+ });
20127
+
20128
+ drawPath(parentGfx, pathData, {
20129
+ fill: 'none',
20130
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20131
+ strokeWidth: 1
20132
+ });
20133
+ } else if (type === 'Exclusive') {
20134
+ if (!instantiate) {
20135
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
20136
+ fill: 'none',
20137
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20138
+ strokeWidth: 1
20139
+ });
20140
+ }
20141
+
20142
+ drawEvent();
20143
+ }
20144
+
20145
+
20146
+ return diamond;
20147
+ },
20148
+ 'bpmn:ExclusiveGateway': function(parentGfx, element, attrs = {}) {
20149
+ attrs = pickAttrs(attrs, [
20150
+ 'fill',
20151
+ 'stroke'
20152
+ ]);
20153
+
20154
+ var gateway = renderGateway(parentGfx, element, attrs);
20155
+
20156
+ var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
20157
+ xScaleFactor: 0.4,
20158
+ yScaleFactor: 0.4,
20159
+ containerWidth: element.width,
20160
+ containerHeight: element.height,
20161
+ position: {
20162
+ mx: 0.32,
20163
+ my: 0.3
20164
+ }
20165
+ });
20166
+
20167
+ var di = getDi(element);
20168
+
20169
+ if (di.get('isMarkerVisible')) {
20170
+ drawPath(parentGfx, pathData, {
20171
+ fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20172
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20173
+ strokeWidth: 1
20174
+ });
20175
+ }
20176
+
20177
+ return gateway;
20178
+ },
20179
+ 'bpmn:Gateway': function(parentGfx, element, attrs = {}) {
20180
+ attrs = pickAttrs(attrs, [
20181
+ 'fill',
20182
+ 'stroke'
20183
+ ]);
20184
+
20185
+ return renderGateway(parentGfx, element, attrs);
20186
+ },
20187
+ 'bpmn:Group': function(parentGfx, element, attrs = {}) {
20188
+ attrs = pickAttrs(attrs, [
20189
+ 'fill',
20190
+ 'stroke',
20191
+ 'width',
20192
+ 'height'
20193
+ ]);
20194
+
20195
+ return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
20196
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20197
+ strokeWidth: 1.5,
20198
+ strokeDasharray: '10, 6, 0, 6',
20199
+ fill: 'none',
20200
+ pointerEvents: 'none',
20201
+ width: getWidth(element, attrs),
20202
+ height: getHeight(element, attrs)
20203
+ });
20204
+ },
20205
+ 'bpmn:InclusiveGateway': function(parentGfx, element, attrs = {}) {
20206
+ attrs = pickAttrs(attrs, [
20207
+ 'fill',
20208
+ 'stroke'
20209
+ ]);
20210
+
20211
+ var gateway = renderGateway(parentGfx, element, attrs);
20212
+
20213
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
20214
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
20215
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20216
+ strokeWidth: 2.5
20217
+ });
20218
+
20219
+ return gateway;
20220
+ },
20221
+ 'bpmn:IntermediateEvent': function(parentGfx, element, attrs = {}) {
20222
+ var { renderIcon = true } = attrs;
20223
+
20224
+ attrs = pickAttrs(attrs, [
20225
+ 'fill',
20226
+ 'stroke'
20227
+ ]);
20228
+
20229
+ var outer = renderEvent(parentGfx, element, {
20230
+ ...attrs,
20231
+ strokeWidth: 1.5
20232
+ });
20233
+
20234
+ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
20235
+ fill: 'none',
20236
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20237
+ strokeWidth: 1.5
20238
+ });
20239
+
20240
+ if (renderIcon) {
20241
+ renderEventIcon(element, parentGfx, attrs);
20242
+ }
20243
+
20244
+ return outer;
20245
+ },
20246
+ 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
20247
+ 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
20248
+ 'bpmn:Lane': function(parentGfx, element, attrs = {}) {
20249
+ attrs = pickAttrs(attrs, [
20250
+ 'fill',
20251
+ 'stroke',
20252
+ 'width',
20253
+ 'height'
20254
+ ]);
20255
+
20256
+ return renderLane(parentGfx, element, {
20257
+ ...attrs,
20258
+ fillOpacity: LOW_OPACITY
20259
+ });
20260
+ },
20261
+ 'bpmn:ManualTask': function(parentGfx, element, attrs = {}) {
20262
+ attrs = pickAttrs(attrs, [
20263
+ 'fill',
20264
+ 'stroke'
20265
+ ]);
20266
+
20267
+ var task = renderTask(parentGfx, element, attrs);
20268
+
20269
+ var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
20270
+ abspos: {
20271
+ x: 17,
20272
+ y: 15
20273
+ }
20274
+ });
20275
+
20276
+ drawPath(parentGfx, pathData, {
20277
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
20278
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20279
+ strokeWidth: 0.5
20280
+ });
20281
+
20282
+ return task;
20283
+ },
20284
+ 'bpmn:MessageFlow': function(parentGfx, element, attrs = {}) {
20285
+ attrs = pickAttrs(attrs, [
20286
+ 'fill',
20287
+ 'stroke'
20288
+ ]);
20289
+
20290
+ var semantic = getBusinessObject(element),
20291
+ di = getDi(element);
20292
+
20293
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
20294
+ stroke = getStrokeColor$1(element, defaultStrokeColor, attrs.stroke);
20295
+
20296
+ var path = drawConnectionSegments(parentGfx, element.waypoints, {
20297
+ markerEnd: marker(parentGfx, 'messageflow-end', fill, stroke),
20298
+ markerStart: marker(parentGfx, 'messageflow-start', fill, stroke),
20299
+ stroke,
20300
+ strokeDasharray: '10, 11',
20301
+ strokeWidth: 1.5
20302
+ });
20303
+
20304
+ if (semantic.get('messageRef')) {
20305
+ var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
20306
+
20307
+ var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', {
20308
+ abspos: {
20309
+ x: midPoint.x,
20310
+ y: midPoint.y
20311
+ }
20312
+ });
20313
+
20314
+ var messageAttrs = {
20315
+ strokeWidth: 1
20316
+ };
20317
+
20318
+ if (di.get('messageVisibleKind') === 'initiating') {
20319
+ messageAttrs.fill = fill;
20320
+ messageAttrs.stroke = stroke;
20321
+ } else {
20322
+ messageAttrs.fill = stroke;
20323
+ messageAttrs.stroke = fill;
20324
+ }
20325
+
20326
+ var message = drawPath(parentGfx, markerPathData, messageAttrs);
20327
+
20328
+ var messageRef = semantic.get('messageRef'),
20329
+ name = messageRef.get('name');
20330
+
20331
+ var label = renderLabel(parentGfx, name, {
20332
+ align: 'center-top',
20333
+ fitBox: true,
20334
+ style: {
20335
+ fill: stroke
20336
+ }
20337
+ });
20338
+
20339
+ var messageBounds = message.getBBox(),
20340
+ labelBounds = label.getBBox();
20341
+
20342
+ var translateX = midPoint.x - labelBounds.width / 2,
20343
+ translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE$1;
20344
+
20345
+ transform(label, translateX, translateY, 0);
20346
+ }
20347
+
20348
+ return path;
20349
+ },
20350
+ 'bpmn:ParallelGateway': function(parentGfx, element, attrs = {}) {
20351
+ attrs = pickAttrs(attrs, [
20352
+ 'fill',
20353
+ 'stroke'
20354
+ ]);
20355
+
20356
+ var diamond = renderGateway(parentGfx, element, attrs);
20357
+
20358
+ var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
20359
+ xScaleFactor: 0.6,
20360
+ yScaleFactor: 0.6,
20361
+ containerWidth: element.width,
20362
+ containerHeight: element.height,
20363
+ position: {
20364
+ mx: 0.46,
20365
+ my: 0.2
20366
+ }
20367
+ });
20368
+
20369
+ drawPath(parentGfx, pathData, {
20370
+ fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20371
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20372
+ strokeWidth: 1
20373
+ });
20374
+
20375
+ return diamond;
20376
+ },
20377
+ 'bpmn:Participant': function(parentGfx, element, attrs = {}) {
20378
+ attrs = pickAttrs(attrs, [
20379
+ 'fill',
20380
+ 'stroke',
20381
+ 'width',
20382
+ 'height'
20383
+ ]);
20384
+
20385
+ var participant = renderLane(parentGfx, element, attrs);
20386
+
20387
+ var expandedParticipant = isExpanded(element);
20388
+ var horizontalParticipant = isHorizontal$3(element);
20389
+
20390
+ var semantic = getBusinessObject(element),
20391
+ name = semantic.get('name');
20392
+
20393
+ if (expandedParticipant) {
20394
+ var waypoints = horizontalParticipant ? [
20395
+ {
20396
+ x: 30,
20397
+ y: 0
20398
+ },
20399
+ {
20400
+ x: 30,
20401
+ y: getHeight(element, attrs)
20402
+ }
20403
+ ] : [
20404
+ {
20405
+ x: 0,
20406
+ y: 30
20407
+ },
20408
+ {
20409
+ x: getWidth(element, attrs),
20410
+ y: 30
20411
+ }
20412
+ ];
20413
+
20414
+ drawLine(parentGfx, waypoints, {
20415
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20416
+ strokeWidth: PARTICIPANT_STROKE_WIDTH
20417
+ });
20418
+
20419
+ renderLaneLabel(parentGfx, name, element, attrs);
20420
+ } else {
20421
+ var bounds = getBounds$1(element, attrs);
20422
+
20423
+ if (!horizontalParticipant) {
20424
+ bounds.height = getWidth(element, attrs);
20425
+ bounds.width = getHeight(element, attrs);
20426
+ }
20427
+
20428
+ var textBox = renderLabel(parentGfx, name, {
20429
+ box: bounds,
20430
+ align: 'center-middle',
20431
+ style: {
20432
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
20433
+ }
20434
+ });
20435
+
20436
+ if (!horizontalParticipant) {
20437
+ var top = -1 * getHeight(element, attrs);
20438
+ transform(textBox, 0, -top, 270);
20439
+ }
20440
+ }
20441
+
20442
+ if (semantic.get('participantMultiplicity')) {
20443
+ renderTaskMarker('ParticipantMultiplicityMarker', parentGfx, element, attrs);
20444
+ }
20445
+
20446
+ return participant;
20447
+ },
20448
+ 'bpmn:ReceiveTask' : function(parentGfx, element, attrs = {}) {
20449
+ attrs = pickAttrs(attrs, [
20450
+ 'fill',
20451
+ 'stroke'
20452
+ ]);
20453
+
20454
+ var semantic = getBusinessObject(element);
20455
+
20456
+ var task = renderTask(parentGfx, element, attrs);
20457
+
20458
+ var pathData;
20459
+
20460
+ if (semantic.get('instantiate')) {
20461
+ drawCircle(parentGfx, 28, 28, 20 * 0.22, {
20462
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
20463
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20464
+ strokeWidth: 1
20465
+ });
20466
+
20467
+ pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
20468
+ abspos: {
20469
+ x: 7.77,
20470
+ y: 9.52
20471
+ }
20472
+ });
20473
+ } else {
20474
+ pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
20475
+ xScaleFactor: 0.9,
20476
+ yScaleFactor: 0.9,
20477
+ containerWidth: 21,
20478
+ containerHeight: 14,
20479
+ position: {
20480
+ mx: 0.3,
20481
+ my: 0.4
20482
+ }
20483
+ });
20484
+ }
20485
+
20486
+ drawPath(parentGfx, pathData, {
20487
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
20488
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20489
+ strokeWidth: 1
20490
+ });
20491
+
20492
+ return task;
20493
+ },
20494
+ 'bpmn:ScriptTask': function(parentGfx, element, attrs = {}) {
20495
+ attrs = pickAttrs(attrs, [
20496
+ 'fill',
20497
+ 'stroke'
20498
+ ]);
20499
+
20500
+ var task = renderTask(parentGfx, element, attrs);
20501
+
20502
+ var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
20503
+ abspos: {
20504
+ x: 15,
20505
+ y: 20
20506
+ }
20507
+ });
20508
+
20509
+ drawPath(parentGfx, pathData, {
20510
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
20511
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20512
+ strokeWidth: 1
20513
+ });
20514
+
20515
+ return task;
20516
+ },
20517
+ 'bpmn:SendTask': function(parentGfx, element, attrs = {}) {
20518
+ attrs = pickAttrs(attrs, [
20519
+ 'fill',
20520
+ 'stroke'
20521
+ ]);
20522
+
20523
+ var task = renderTask(parentGfx, element, attrs);
20524
+
20525
+ var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
20526
+ xScaleFactor: 1,
20527
+ yScaleFactor: 1,
20528
+ containerWidth: 21,
20529
+ containerHeight: 14,
20530
+ position: {
20531
+ mx: 0.285,
20532
+ my: 0.357
20533
+ }
20534
+ });
20535
+
20536
+ drawPath(parentGfx, pathData, {
20537
+ fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20538
+ stroke: getFillColor(element, defaultFillColor, attrs.fill),
20539
+ strokeWidth: 1
20540
+ });
20541
+
20542
+ return task;
20543
+ },
20544
+ 'bpmn:SequenceFlow': function(parentGfx, element, attrs = {}) {
20545
+ attrs = pickAttrs(attrs, [
20546
+ 'fill',
20547
+ 'stroke'
20548
+ ]);
20549
+
20550
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
20551
+ stroke = getStrokeColor$1(element, defaultStrokeColor, attrs.stroke);
20552
+
20553
+ var connection = drawConnectionSegments(parentGfx, element.waypoints, {
20554
+ markerEnd: marker(parentGfx, 'sequenceflow-end', fill, stroke),
20555
+ stroke
20556
+ });
20557
+
20558
+ var semantic = getBusinessObject(element);
20559
+
20560
+ var { source } = element;
20561
+
20562
+ if (source) {
20563
+ var sourceSemantic = getBusinessObject(source);
20564
+
20565
+ // conditional flow marker
20566
+ if (semantic.get('conditionExpression') && is(sourceSemantic, 'bpmn:Activity')) {
20567
+ attr(connection, {
20568
+ markerStart: marker(parentGfx, 'conditional-flow-marker', fill, stroke)
20569
+ });
20570
+ }
20571
+
20572
+ // default marker
20573
+ if (sourceSemantic.get('default') && (is(sourceSemantic, 'bpmn:Gateway') || is(sourceSemantic, 'bpmn:Activity')) &&
20574
+ sourceSemantic.get('default') === semantic) {
20575
+ attr(connection, {
20576
+ markerStart: marker(parentGfx, 'conditional-default-flow-marker', fill, stroke)
20577
+ });
20578
+ }
20579
+ }
20580
+
20581
+ return connection;
20582
+ },
20583
+ 'bpmn:ServiceTask': function(parentGfx, element, attrs = {}) {
20584
+ attrs = pickAttrs(attrs, [
20585
+ 'fill',
20586
+ 'stroke'
20587
+ ]);
20588
+
20589
+ var task = renderTask(parentGfx, element, attrs);
20590
+
20591
+ drawCircle(parentGfx, 10, 10, {
20592
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
20593
+ stroke: 'none',
20594
+ transform: 'translate(6, 6)'
20595
+ });
20596
+
20597
+ var pathDataService1 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
20598
+ abspos: {
20599
+ x: 12,
20600
+ y: 18
20601
+ }
20602
+ });
20603
+
20604
+ drawPath(parentGfx, pathDataService1, {
20605
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
20606
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20607
+ strokeWidth: 1
20608
+ });
20609
+
20610
+ drawCircle(parentGfx, 10, 10, {
20611
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
20612
+ stroke: 'none',
20613
+ transform: 'translate(11, 10)'
20614
+ });
20615
+
20616
+ var pathDataService2 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
20617
+ abspos: {
20618
+ x: 17,
20619
+ y: 22
20620
+ }
20621
+ });
20622
+
20623
+ drawPath(parentGfx, pathDataService2, {
20624
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
20625
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20626
+ strokeWidth: 1
20627
+ });
20628
+
20629
+ return task;
20630
+ },
20631
+ 'bpmn:StartEvent': function(parentGfx, element, attrs = {}) {
20632
+ var { renderIcon = true } = attrs;
20633
+
20634
+ attrs = pickAttrs(attrs, [
20635
+ 'fill',
20636
+ 'stroke'
20637
+ ]);
20638
+
20639
+ var semantic = getBusinessObject(element);
20640
+
20641
+ if (!semantic.get('isInterrupting')) {
20642
+ attrs = {
20643
+ ...attrs,
20644
+ strokeDasharray: '6'
20645
+ };
20646
+ }
20647
+
20648
+ var event = renderEvent(parentGfx, element, attrs);
20649
+
20650
+ if (renderIcon) {
20651
+ renderEventIcon(element, parentGfx, attrs);
20652
+ }
20653
+
20654
+ return event;
20655
+ },
20656
+ 'bpmn:SubProcess': function(parentGfx, element, attrs = {}) {
20657
+ if (isExpanded(element)) {
20658
+ attrs = pickAttrs(attrs, [
20659
+ 'fill',
20660
+ 'stroke',
20661
+ 'width',
20662
+ 'height'
20663
+ ]);
20664
+ } else {
20665
+ attrs = pickAttrs(attrs, [
20666
+ 'fill',
20667
+ 'stroke'
20668
+ ]);
20669
+ }
20670
+
20671
+ return renderSubProcess(parentGfx, element, attrs);
20672
+ },
20673
+ 'bpmn:Task': function(parentGfx, element, attrs = {}) {
20674
+ attrs = pickAttrs(attrs, [
20675
+ 'fill',
20676
+ 'stroke'
20677
+ ]);
20678
+
20679
+ return renderTask(parentGfx, element, attrs);
20680
+ },
20681
+ 'bpmn:TextAnnotation': function(parentGfx, element, attrs = {}) {
20682
+ attrs = pickAttrs(attrs, [
20683
+ 'fill',
20684
+ 'stroke',
20685
+ 'width',
20686
+ 'height'
20687
+ ]);
20688
+
20689
+ var {
20690
+ width,
20691
+ height
20692
+ } = getBounds$1(element, attrs);
20693
+
20694
+ var textElement = drawRect(parentGfx, width, height, 0, 0, {
20695
+ fill: 'none',
20696
+ stroke: 'none'
20697
+ });
20698
+
20699
+ var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
20700
+ xScaleFactor: 1,
20701
+ yScaleFactor: 1,
20702
+ containerWidth: width,
20703
+ containerHeight: height,
20704
+ position: {
20705
+ mx: 0.0,
20706
+ my: 0.0
20707
+ }
20708
+ });
20709
+
20710
+ drawPath(parentGfx, textPathData, {
20711
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
20712
+ });
20713
+
20714
+ var semantic = getBusinessObject(element),
20715
+ text = semantic.get('text') || '';
20716
+
20717
+ renderLabel(parentGfx, text, {
20718
+ align: 'left-top',
20719
+ box: getBounds$1(element, attrs),
20720
+ padding: 7,
20721
+ style: {
20722
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
20723
+ }
20724
+ });
20725
+
20726
+ return textElement;
20727
+ },
20728
+ 'bpmn:Transaction': function(parentGfx, element, attrs = {}) {
20729
+ if (isExpanded(element)) {
20730
+ attrs = pickAttrs(attrs, [
20731
+ 'fill',
20732
+ 'stroke',
20733
+ 'width',
20734
+ 'height'
20735
+ ]);
20736
+ } else {
20737
+ attrs = pickAttrs(attrs, [
20738
+ 'fill',
20739
+ 'stroke'
20740
+ ]);
20741
+ }
20742
+
20743
+ var outer = renderSubProcess(parentGfx, element, {
20744
+ strokeWidth: 1.5,
20745
+ ...attrs
20746
+ });
20747
+
20748
+ var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
20749
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20750
+ strokeWidth: 1.5
20751
+ });
20752
+
20753
+ var expanded = isExpanded(element);
20754
+
20755
+ if (!expanded) {
20756
+ attrs = {};
20757
+ }
20758
+
20759
+ drawRect(
20760
+ parentGfx,
20761
+ getWidth(element, attrs),
20762
+ getHeight(element, attrs),
20763
+ TASK_BORDER_RADIUS - INNER_OUTER_DIST,
20764
+ INNER_OUTER_DIST,
20765
+ innerAttrs
20766
+ );
20767
+
20768
+ return outer;
20769
+ },
20770
+ 'bpmn:UserTask': function(parentGfx, element, attrs = {}) {
20771
+ attrs = pickAttrs(attrs, [
20772
+ 'fill',
20773
+ 'stroke'
20774
+ ]);
20775
+
20776
+ var task = renderTask(parentGfx, element, attrs);
20777
+
20778
+ var x = 15;
20779
+ var y = 12;
20780
+
20781
+ var pathDataUser1 = pathMap.getScaledPath('TASK_TYPE_USER_1', {
20782
+ abspos: {
20783
+ x: x,
20784
+ y: y
20785
+ }
20786
+ });
20787
+
20788
+ drawPath(parentGfx, pathDataUser1, {
20789
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
20790
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20791
+ strokeWidth: 0.5
20792
+ });
20793
+
20794
+ var pathDataUser2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
20795
+ abspos: {
20796
+ x: x,
20797
+ y: y
20798
+ }
20799
+ });
20800
+
20801
+ drawPath(parentGfx, pathDataUser2, {
20802
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
20803
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20804
+ strokeWidth: 0.5
20805
+ });
20806
+
20807
+ var pathDataUser3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
20808
+ abspos: {
20809
+ x: x,
20810
+ y: y
20811
+ }
20812
+ });
20813
+
20814
+ drawPath(parentGfx, pathDataUser3, {
20815
+ fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20816
+ stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
20817
+ strokeWidth: 0.5
20818
+ });
20819
+
20820
+ return task;
20821
+ },
20822
+ 'label': function(parentGfx, element, attrs = {}) {
20823
+ return renderExternalLabel(parentGfx, element, attrs);
20824
+ }
20825
+ };
20826
+
20827
+ // extension API, use at your own risk
20828
+ this._drawPath = drawPath;
20829
+
20830
+ this._renderer = renderer;
20831
+ }
20832
+
20833
+
20834
+ e$2(BpmnRenderer, BaseRenderer);
20835
+
20836
+ BpmnRenderer.$inject = [
20837
+ 'config.bpmnRenderer',
20838
+ 'eventBus',
20839
+ 'styles',
20840
+ 'pathMap',
20841
+ 'canvas',
20842
+ 'textRenderer'
20843
+ ];
20844
+
20845
+
20846
+ /**
20847
+ * @param {Element} element
20848
+ *
20849
+ * @return {boolean}
20850
+ */
20851
+ BpmnRenderer.prototype.canRender = function(element) {
20852
+ return is(element, 'bpmn:BaseElement');
20853
+ };
20854
+
20855
+ /**
20856
+ * Draw shape into parentGfx.
20857
+ *
20858
+ * @param {SVGElement} parentGfx
20859
+ * @param {Shape} shape
20860
+ * @param {Attrs} [attrs]
20861
+ *
20862
+ * @return {SVGElement} mainGfx
20863
+ */
20864
+ BpmnRenderer.prototype.drawShape = function(parentGfx, shape, attrs = {}) {
20865
+ var { type } = shape;
20866
+
20867
+ var handler = this._renderer(type);
20868
+
20869
+ return handler(parentGfx, shape, attrs);
20870
+ };
20871
+
20872
+ /**
20873
+ * Draw connection into parentGfx.
20874
+ *
20875
+ * @param {SVGElement} parentGfx
20876
+ * @param {Connection} connection
20877
+ * @param {Attrs} [attrs]
20878
+ *
20879
+ * @return {SVGElement} mainGfx
20880
+ */
20881
+ BpmnRenderer.prototype.drawConnection = function(parentGfx, connection, attrs = {}) {
20882
+ var { type } = connection;
20883
+
20884
+ var handler = this._renderer(type);
20885
+
20886
+ return handler(parentGfx, connection, attrs);
20887
+ };
20888
+
20889
+ /**
20890
+ * Get shape path.
20891
+ *
20892
+ * @param {Shape} shape
20893
+ *
20894
+ * @return {string} path
20895
+ */
20896
+ BpmnRenderer.prototype.getShapePath = function(shape) {
20897
+ if (is(shape, 'bpmn:Event')) {
20898
+ return getCirclePath(shape);
20899
+ }
20900
+
20901
+ if (is(shape, 'bpmn:Activity')) {
20902
+ return getRoundRectPath(shape, TASK_BORDER_RADIUS);
20903
+ }
20904
+
20905
+ if (is(shape, 'bpmn:Gateway')) {
20906
+ return getDiamondPath(shape);
20907
+ }
20908
+
20909
+ return getRectPath(shape);
20910
+ };
20911
+
20912
+ /**
20913
+ * Pick attributes if they exist.
20914
+ *
20915
+ * @param {Object} attrs
20916
+ * @param {string[]} keys
20917
+ *
20918
+ * @returns {Object}
20919
+ */
20920
+ function pickAttrs(attrs, keys = []) {
20921
+ return keys.reduce((pickedAttrs, key) => {
20922
+ if (attrs[ key ]) {
20923
+ pickedAttrs[ key ] = attrs[ key ];
20924
+ }
20925
+
20926
+ return pickedAttrs;
20927
+ }, {});
20908
20928
  }
20909
20929
 
20910
20930
  /**