camunda-bpmn-js 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +3 -5
  2. package/dist/assets/bpmn-font/css/bpmn-codes.css +6 -6
  3. package/dist/assets/bpmn-font/css/bpmn-embedded.css +18 -13
  4. package/dist/assets/bpmn-font/css/bpmn.css +14 -15
  5. package/dist/assets/bpmn-font/font/bpmn.eot +0 -0
  6. package/dist/assets/bpmn-font/font/bpmn.svg +12 -12
  7. package/dist/assets/bpmn-font/font/bpmn.ttf +0 -0
  8. package/dist/assets/bpmn-font/font/bpmn.woff +0 -0
  9. package/dist/assets/bpmn-font/font/bpmn.woff2 +0 -0
  10. package/dist/assets/diagram-js.css +6 -3
  11. package/dist/assets/properties-panel.css +4 -0
  12. package/dist/base-modeler.development.js +2587 -1172
  13. package/dist/base-modeler.production.min.js +39 -39
  14. package/dist/base-navigated-viewer.development.js +324 -219
  15. package/dist/base-navigated-viewer.production.min.js +2 -2
  16. package/dist/base-viewer.development.js +324 -219
  17. package/dist/base-viewer.production.min.js +2 -2
  18. package/dist/camunda-cloud-modeler.development.js +2613 -1185
  19. package/dist/camunda-cloud-modeler.production.min.js +39 -39
  20. package/dist/camunda-cloud-navigated-viewer.development.js +324 -219
  21. package/dist/camunda-cloud-navigated-viewer.production.min.js +2 -2
  22. package/dist/camunda-cloud-viewer.development.js +324 -219
  23. package/dist/camunda-cloud-viewer.production.min.js +2 -2
  24. package/dist/camunda-platform-modeler.development.js +2597 -1183
  25. package/dist/camunda-platform-modeler.production.min.js +39 -39
  26. package/dist/camunda-platform-navigated-viewer.development.js +324 -219
  27. package/dist/camunda-platform-navigated-viewer.production.min.js +2 -2
  28. package/dist/camunda-platform-viewer.development.js +324 -219
  29. package/dist/camunda-platform-viewer.production.min.js +2 -2
  30. package/lib/camunda-cloud/Modeler.js +12 -0
  31. package/package.json +20 -7
  32. package/dist/assets/bpmn-font/bpmn-codes.css +0 -108
  33. package/dist/assets/bpmn-font/bpmn-embedded.css +0 -161
  34. package/dist/assets/bpmn-font/bpmn.css +0 -164
  35. package/dist/assets/bpmn-font/bpmn.eot +0 -0
  36. package/dist/assets/bpmn-font/bpmn.svg +0 -224
  37. package/dist/assets/bpmn-font/bpmn.ttf +0 -0
  38. package/dist/assets/bpmn-font/bpmn.woff +0 -0
  39. package/dist/assets/bpmn-font/bpmn.woff2 +0 -0
@@ -1291,9 +1291,13 @@
1291
1291
 
1292
1292
  var componentEvent = {};
1293
1293
 
1294
- var bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent',
1295
- unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
1296
- prefix$6 = bind$1 !== 'addEventListener' ? 'on' : '';
1294
+ var bind$1, unbind$1, prefix$6;
1295
+
1296
+ function detect () {
1297
+ bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent';
1298
+ unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent';
1299
+ prefix$6 = bind$1 !== 'addEventListener' ? 'on' : '';
1300
+ }
1297
1301
 
1298
1302
  /**
1299
1303
  * Bind `el` event `type` to `fn`.
@@ -1307,6 +1311,7 @@
1307
1311
  */
1308
1312
 
1309
1313
  var bind_1 = componentEvent.bind = function(el, type, fn, capture){
1314
+ if (!bind$1) detect();
1310
1315
  el[bind$1](prefix$6 + type, fn, capture || false);
1311
1316
  return fn;
1312
1317
  };
@@ -1323,6 +1328,7 @@
1323
1328
  */
1324
1329
 
1325
1330
  var unbind_1 = componentEvent.unbind = function(el, type, fn, capture){
1331
+ if (!unbind$1) detect();
1326
1332
  el[unbind$1](prefix$6 + type, fn, capture || false);
1327
1333
  return fn;
1328
1334
  };
@@ -2755,34 +2761,128 @@
2755
2761
  */
2756
2762
  BaseRenderer.prototype.getConnectionPath = function() {};
2757
2763
 
2764
+ /**
2765
+ * @param { [ string, ...any[] ][] } elements
2766
+ *
2767
+ * @return { string }
2768
+ */
2758
2769
  function componentsToPath(elements) {
2759
- return elements.join(',').replace(/,?([A-z]),?/g, '$1');
2770
+ return elements.flat().join(',').replace(/,?([A-z]),?/g, '$1');
2760
2771
  }
2761
2772
 
2762
- function toSVGPoints(points) {
2763
- var result = '';
2773
+ function move(point) {
2774
+ return [ 'M', point.x, point.y ];
2775
+ }
2776
+
2777
+ function lineTo(point) {
2778
+ return [ 'L', point.x, point.y ];
2779
+ }
2764
2780
 
2765
- for (var i = 0, p; (p = points[i]); i++) {
2766
- result += p.x + ',' + p.y + ' ';
2781
+ function curveTo(p1, p2, p3) {
2782
+ return [ 'C', p1.x, p1.y, p2.x, p2.y, p3.x, p3.y ];
2783
+ }
2784
+
2785
+ function drawPath(waypoints, cornerRadius) {
2786
+ const pointCount = waypoints.length;
2787
+
2788
+ const path = [ move(waypoints[0]) ];
2789
+
2790
+ for (let i = 1; i < pointCount; i++) {
2791
+
2792
+ const pointBefore = waypoints[i - 1];
2793
+ const point = waypoints[i];
2794
+ const pointAfter = waypoints[i + 1];
2795
+
2796
+ if (!pointAfter || !cornerRadius) {
2797
+ path.push(lineTo(point));
2798
+
2799
+ continue;
2800
+ }
2801
+
2802
+ const effectiveRadius = Math.min(
2803
+ cornerRadius,
2804
+ vectorLength$1(point.x - pointBefore.x, point.y - pointBefore.y),
2805
+ vectorLength$1(pointAfter.x - point.x, pointAfter.y - point.y)
2806
+ );
2807
+
2808
+ if (!effectiveRadius) {
2809
+ path.push(lineTo(point));
2810
+
2811
+ continue;
2812
+ }
2813
+
2814
+ const beforePoint = getPointAtLength(point, pointBefore, effectiveRadius);
2815
+ const beforePoint2 = getPointAtLength(point, pointBefore, effectiveRadius * .5);
2816
+
2817
+ const afterPoint = getPointAtLength(point, pointAfter, effectiveRadius);
2818
+ const afterPoint2 = getPointAtLength(point, pointAfter, effectiveRadius * .5);
2819
+
2820
+ path.push(lineTo(beforePoint));
2821
+ path.push(curveTo(beforePoint2, afterPoint2, afterPoint));
2767
2822
  }
2768
2823
 
2769
- return result;
2824
+ return path;
2770
2825
  }
2771
2826
 
2772
- function createLine(points, attrs) {
2827
+ function getPointAtLength(start, end, length) {
2773
2828
 
2774
- var line = create$1('polyline');
2775
- attr(line, { points: toSVGPoints(points) });
2829
+ const deltaX = end.x - start.x;
2830
+ const deltaY = end.y - start.y;
2776
2831
 
2777
- if (attrs) {
2778
- attr(line, attrs);
2832
+ const totalLength = vectorLength$1(deltaX, deltaY);
2833
+
2834
+ const percent = length / totalLength;
2835
+
2836
+ return {
2837
+ x: start.x + deltaX * percent,
2838
+ y: start.y + deltaY * percent
2839
+ };
2840
+ }
2841
+
2842
+ function vectorLength$1(x, y) {
2843
+ return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
2844
+ }
2845
+
2846
+ /**
2847
+ * @param { { x: number, y: number }[] } points
2848
+ * @param { any } [attrs]
2849
+ * @param { number } [radius]
2850
+ *
2851
+ * @return {SVGElement}
2852
+ */
2853
+ function createLine(points, attrs, radius) {
2854
+
2855
+ if (isNumber(attrs)) {
2856
+ radius = attrs;
2857
+ attrs = null;
2779
2858
  }
2780
2859
 
2781
- return line;
2860
+ if (!attrs) {
2861
+ attrs = {};
2862
+ }
2863
+
2864
+ const line = create$1('path', attrs);
2865
+
2866
+ if (isNumber(radius)) {
2867
+ line.dataset.cornerRadius = String(radius);
2868
+ }
2869
+
2870
+ return updateLine(line, points);
2782
2871
  }
2783
2872
 
2873
+ /**
2874
+ * @param { SVGElement } gfx
2875
+ * @param { { x: number, y: number }[]} points
2876
+ *
2877
+ * @return {SVGElement}
2878
+ */
2784
2879
  function updateLine(gfx, points) {
2785
- attr(gfx, { points: toSVGPoints(points) });
2880
+
2881
+ const cornerRadius = parseInt(gfx.dataset.cornerRadius, 10) || 0;
2882
+
2883
+ attr(gfx, {
2884
+ d: componentsToPath(drawPath(points, cornerRadius))
2885
+ });
2786
2886
 
2787
2887
  return gfx;
2788
2888
  }
@@ -3443,65 +3543,42 @@
3443
3543
  /**
3444
3544
  * Check whether two points are horizontally or vertically aligned.
3445
3545
  *
3446
- * @param {Array<Point>|Point}
3447
- * @param {Point}
3546
+ * @param {Point[]|Point} a
3547
+ * @param {Point} [b]
3448
3548
  *
3449
- * @return {string|boolean}
3549
+ * @return {'h'|'v'|false} axis or false
3450
3550
  */
3451
3551
  function pointsAligned(a, b) {
3452
- var points;
3453
-
3454
- if (isArray$3(a)) {
3455
- points = a;
3456
- } else {
3457
- points = [ a, b ];
3458
- }
3552
+ var points = Array.from(arguments).flat();
3459
3553
 
3460
- if (pointsAlignedHorizontally(points)) {
3461
- return 'h';
3462
- }
3554
+ const axisMap = {
3555
+ 'x': 'v',
3556
+ 'y': 'h'
3557
+ };
3463
3558
 
3464
- if (pointsAlignedVertically(points)) {
3465
- return 'v';
3559
+ for (const [ axis, orientation ] of Object.entries(axisMap)) {
3560
+ if (pointsAlignedOnAxis(axis, points)) {
3561
+ return orientation;
3562
+ }
3466
3563
  }
3467
3564
 
3468
3565
  return false;
3469
3566
  }
3470
3567
 
3471
- function pointsAlignedHorizontally(a, b) {
3472
- var points;
3473
-
3474
- if (isArray$3(a)) {
3475
- points = a;
3476
- } else {
3477
- points = [ a, b ];
3478
- }
3479
-
3480
- var firstPoint = points.slice().shift();
3481
-
3482
- return every(points, function(point) {
3483
- return Math.abs(firstPoint.y - point.y) <= ALIGNED_THRESHOLD;
3484
- });
3485
- }
3486
-
3487
- function pointsAlignedVertically(a, b) {
3488
- var points;
3489
-
3490
- if (isArray$3(a)) {
3491
- points = a;
3492
- } else {
3493
- points = [ a, b ];
3494
- }
3495
-
3496
- var firstPoint = points.slice().shift();
3568
+ /**
3569
+ * @param { 'x' | 'y' } axis
3570
+ * @param { Point[] } points
3571
+ *
3572
+ * @return {boolean}
3573
+ */
3574
+ function pointsAlignedOnAxis(axis, points) {
3575
+ const referencePoint = points[0];
3497
3576
 
3498
3577
  return every(points, function(point) {
3499
- return Math.abs(firstPoint.x - point.x) <= ALIGNED_THRESHOLD;
3578
+ return Math.abs(referencePoint[axis] - point[axis]) <= ALIGNED_THRESHOLD;
3500
3579
  });
3501
3580
  }
3502
3581
 
3503
-
3504
-
3505
3582
  /**
3506
3583
  * Returns true if the point p is inside the rectangle rect
3507
3584
  *
@@ -4625,7 +4702,7 @@
4625
4702
  * @return {Point}
4626
4703
  */
4627
4704
  function getMid(element) {
4628
- if (isConnection$g(element)) {
4705
+ if (isConnection$h(element)) {
4629
4706
  return getConnectionMid(element);
4630
4707
  }
4631
4708
 
@@ -4765,7 +4842,7 @@
4765
4842
  return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
4766
4843
  }
4767
4844
 
4768
- function isConnection$g(element) {
4845
+ function isConnection$h(element) {
4769
4846
  return !!element.waypoints;
4770
4847
  }
4771
4848
 
@@ -16424,6 +16501,11 @@
16424
16501
  * @see http://bpmn.io/license for more information.
16425
16502
  */
16426
16503
 
16504
+
16505
+ /**
16506
+ * @typedef { import('didi').ModuleDeclaration } Module
16507
+ */
16508
+
16427
16509
  /**
16428
16510
  * A base viewer for BPMN 2.0 diagrams.
16429
16511
  *
@@ -16435,8 +16517,8 @@
16435
16517
  * @param {string|number} [options.width] the width of the viewer
16436
16518
  * @param {string|number} [options.height] the height of the viewer
16437
16519
  * @param {Object} [options.moddleExtensions] extension packages to provide
16438
- * @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
16439
- * @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
16520
+ * @param {Module[]} [options.modules] a list of modules to override the default modules
16521
+ * @param {Module[]} [options.additionalModules] a list of modules to use with the default modules
16440
16522
  */
16441
16523
  function BaseViewer(options) {
16442
16524
 
@@ -16865,7 +16947,14 @@
16865
16947
  this._definitions = definitions;
16866
16948
  };
16867
16949
 
16868
- BaseViewer.prototype.getModules = function() {
16950
+ /**
16951
+ * Return modules to instantiate with.
16952
+ *
16953
+ * @param {any} options the instance got created with
16954
+ *
16955
+ * @return {Module[]}
16956
+ */
16957
+ BaseViewer.prototype.getModules = function(options) {
16869
16958
  return this._modules;
16870
16959
  };
16871
16960
 
@@ -16971,7 +17060,7 @@
16971
17060
 
16972
17061
  BaseViewer.prototype._init = function(container, moddle, options) {
16973
17062
 
16974
- const baseModules = options.modules || this.getModules(),
17063
+ const baseModules = options.modules || this.getModules(options),
16975
17064
  additionalModules = options.additionalModules || [],
16976
17065
  staticModules = [
16977
17066
  {
@@ -17126,6 +17215,10 @@
17126
17215
 
17127
17216
  /* </project-logo> */
17128
17217
 
17218
+ /**
17219
+ * @typedef { import('didi').ModuleDeclaration } Module
17220
+ */
17221
+
17129
17222
  /**
17130
17223
  * A base modeler for BPMN 2.0 diagrams.
17131
17224
  *
@@ -17136,8 +17229,8 @@
17136
17229
  * @param {string|number} [options.width] the width of the viewer
17137
17230
  * @param {string|number} [options.height] the height of the viewer
17138
17231
  * @param {Object} [options.moddleExtensions] extension packages to provide
17139
- * @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
17140
- * @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
17232
+ * @param {Module[]} [options.modules] a list of modules to override the default modules
17233
+ * @param {Module[]} [options.additionalModules] a list of modules to use with the default modules
17141
17234
  */
17142
17235
  function BaseModeler(options) {
17143
17236
  BaseViewer.call(this, options);
@@ -17225,7 +17318,7 @@
17225
17318
  return element && !!getBusinessObject$1(element).triggeredByEvent;
17226
17319
  }
17227
17320
 
17228
- function hasEventDefinition$2(element, eventType) {
17321
+ function hasEventDefinition$3(element, eventType) {
17229
17322
  var bo = getBusinessObject$1(element),
17230
17323
  hasEventDefinition = false;
17231
17324
 
@@ -17241,15 +17334,15 @@
17241
17334
  }
17242
17335
 
17243
17336
  function hasErrorEventDefinition(element) {
17244
- return hasEventDefinition$2(element, 'bpmn:ErrorEventDefinition');
17337
+ return hasEventDefinition$3(element, 'bpmn:ErrorEventDefinition');
17245
17338
  }
17246
17339
 
17247
17340
  function hasEscalationEventDefinition(element) {
17248
- return hasEventDefinition$2(element, 'bpmn:EscalationEventDefinition');
17341
+ return hasEventDefinition$3(element, 'bpmn:EscalationEventDefinition');
17249
17342
  }
17250
17343
 
17251
17344
  function hasCompensateEventDefinition(element) {
17252
- return hasEventDefinition$2(element, 'bpmn:CompensateEventDefinition');
17345
+ return hasEventDefinition$3(element, 'bpmn:CompensateEventDefinition');
17253
17346
  }
17254
17347
 
17255
17348
  function getLabelAttr(semantic) {
@@ -17484,33 +17577,33 @@
17484
17577
 
17485
17578
  var markers = {};
17486
17579
 
17487
- var computeStyle = styles.computeStyle;
17488
-
17489
- function addMarker(id, options) {
17490
- var attrs = assign$1({
17491
- fill: black,
17492
- strokeWidth: 1,
17580
+ function shapeStyle(attrs) {
17581
+ return styles.computeStyle(attrs, {
17493
17582
  strokeLinecap: 'round',
17494
- strokeDasharray: 'none'
17495
- }, options.attrs);
17496
-
17497
- var ref = options.ref || { x: 0, y: 0 };
17498
-
17499
- var scale = options.scale || 1;
17500
-
17501
- // fix for safari / chrome / firefox bug not correctly
17502
- // resetting stroke dash array
17503
- if (attrs.strokeDasharray === 'none') {
17504
- attrs.strokeDasharray = [ 10000, 1 ];
17505
- }
17506
-
17507
- var marker = create$1('marker');
17583
+ strokeLinejoin: 'round',
17584
+ stroke: black,
17585
+ strokeWidth: 2,
17586
+ fill: 'white'
17587
+ });
17588
+ }
17508
17589
 
17509
- attr(options.element, attrs);
17590
+ function lineStyle(attrs) {
17591
+ return styles.computeStyle(attrs, [ 'no-fill' ], {
17592
+ strokeLinecap: 'round',
17593
+ strokeLinejoin: 'round',
17594
+ stroke: black,
17595
+ strokeWidth: 2
17596
+ });
17597
+ }
17510
17598
 
17511
- append(marker, options.element);
17599
+ function addMarker(id, options) {
17600
+ var {
17601
+ ref = { x: 0, y: 0 },
17602
+ scale = 1,
17603
+ element
17604
+ } = options;
17512
17605
 
17513
- attr(marker, {
17606
+ var marker = create$1('marker', {
17514
17607
  id: id,
17515
17608
  viewBox: '0 0 20 20',
17516
17609
  refX: ref.x,
@@ -17520,6 +17613,8 @@
17520
17613
  orient: 'auto'
17521
17614
  });
17522
17615
 
17616
+ append(marker, element);
17617
+
17523
17618
  var defs = query('defs', canvas._svg);
17524
17619
 
17525
17620
  if (!defs) {
@@ -17552,105 +17647,116 @@
17552
17647
  function createMarker(id, type, fill, stroke) {
17553
17648
 
17554
17649
  if (type === 'sequenceflow-end') {
17555
- var sequenceflowEnd = create$1('path');
17556
- attr(sequenceflowEnd, { d: 'M 1 5 L 11 10 L 1 15 Z' });
17650
+ var sequenceflowEnd = create$1('path', {
17651
+ d: 'M 1 5 L 11 10 L 1 15 Z',
17652
+ ...shapeStyle({
17653
+ fill: stroke,
17654
+ stroke: stroke,
17655
+ strokeWidth: 1
17656
+ })
17657
+ });
17557
17658
 
17558
17659
  addMarker(id, {
17559
17660
  element: sequenceflowEnd,
17560
17661
  ref: { x: 11, y: 10 },
17561
- scale: 0.5,
17562
- attrs: {
17563
- fill: stroke,
17564
- stroke: stroke
17565
- }
17662
+ scale: 0.5
17566
17663
  });
17567
17664
  }
17568
17665
 
17569
17666
  if (type === 'messageflow-start') {
17570
- var messageflowStart = create$1('circle');
17571
- attr(messageflowStart, { cx: 6, cy: 6, r: 3.5 });
17667
+ var messageflowStart = create$1('circle', {
17668
+ cx: 6,
17669
+ cy: 6,
17670
+ r: 3.5,
17671
+ ...shapeStyle({
17672
+ fill: fill,
17673
+ stroke: stroke,
17674
+ strokeWidth: 1
17675
+ })
17676
+ });
17572
17677
 
17573
17678
  addMarker(id, {
17574
17679
  element: messageflowStart,
17575
- attrs: {
17576
- fill: fill,
17577
- stroke: stroke
17578
- },
17579
17680
  ref: { x: 6, y: 6 }
17580
17681
  });
17581
17682
  }
17582
17683
 
17583
17684
  if (type === 'messageflow-end') {
17584
- var messageflowEnd = create$1('path');
17585
- attr(messageflowEnd, { d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z' });
17685
+ var messageflowEnd = create$1('path', {
17686
+ d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
17687
+ ...shapeStyle({
17688
+ fill: fill,
17689
+ stroke: stroke,
17690
+ strokeWidth: 1
17691
+ })
17692
+ });
17586
17693
 
17587
17694
  addMarker(id, {
17588
17695
  element: messageflowEnd,
17589
- attrs: {
17590
- fill: fill,
17591
- stroke: stroke,
17592
- strokeLinecap: 'butt'
17593
- },
17594
17696
  ref: { x: 8.5, y: 5 }
17595
17697
  });
17596
17698
  }
17597
17699
 
17598
17700
  if (type === 'association-start') {
17599
- var associationStart = create$1('path');
17600
- attr(associationStart, { d: 'M 11 5 L 1 10 L 11 15' });
17601
-
17602
- addMarker(id, {
17603
- element: associationStart,
17604
- attrs: {
17701
+ var associationStart = create$1('path', {
17702
+ d: 'M 11 5 L 1 10 L 11 15',
17703
+ ...lineStyle({
17605
17704
  fill: 'none',
17606
17705
  stroke: stroke,
17607
17706
  strokeWidth: 1.5
17608
- },
17707
+ })
17708
+ });
17709
+
17710
+ addMarker(id, {
17711
+ element: associationStart,
17609
17712
  ref: { x: 1, y: 10 },
17610
17713
  scale: 0.5
17611
17714
  });
17612
17715
  }
17613
17716
 
17614
17717
  if (type === 'association-end') {
17615
- var associationEnd = create$1('path');
17616
- attr(associationEnd, { d: 'M 1 5 L 11 10 L 1 15' });
17617
-
17618
- addMarker(id, {
17619
- element: associationEnd,
17620
- attrs: {
17718
+ var associationEnd = create$1('path', {
17719
+ d: 'M 1 5 L 11 10 L 1 15',
17720
+ ...lineStyle({
17621
17721
  fill: 'none',
17622
17722
  stroke: stroke,
17623
17723
  strokeWidth: 1.5
17624
- },
17625
- ref: { x: 12, y: 10 },
17724
+ })
17725
+ });
17726
+
17727
+ addMarker(id, {
17728
+ element: associationEnd,
17729
+ ref: { x: 11, y: 10 },
17626
17730
  scale: 0.5
17627
17731
  });
17628
17732
  }
17629
17733
 
17630
17734
  if (type === 'conditional-flow-marker') {
17631
- var conditionalflowMarker = create$1('path');
17632
- attr(conditionalflowMarker, { d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z' });
17633
-
17634
- addMarker(id, {
17635
- element: conditionalflowMarker,
17636
- attrs: {
17735
+ var conditionalFlowMarker = create$1('path', {
17736
+ d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
17737
+ ...shapeStyle({
17637
17738
  fill: fill,
17638
17739
  stroke: stroke
17639
- },
17740
+ })
17741
+ });
17742
+
17743
+ addMarker(id, {
17744
+ element: conditionalFlowMarker,
17640
17745
  ref: { x: -1, y: 10 },
17641
17746
  scale: 0.5
17642
17747
  });
17643
17748
  }
17644
17749
 
17645
17750
  if (type === 'conditional-default-flow-marker') {
17646
- var conditionaldefaultflowMarker = create$1('path');
17647
- attr(conditionaldefaultflowMarker, { d: 'M 6 4 L 10 16' });
17751
+ var defaultFlowMarker = create$1('path', {
17752
+ d: 'M 6 4 L 10 16',
17753
+ ...shapeStyle({
17754
+ stroke: stroke
17755
+ })
17756
+ });
17648
17757
 
17649
17758
  addMarker(id, {
17650
- element: conditionaldefaultflowMarker,
17651
- attrs: {
17652
- stroke: stroke
17653
- },
17759
+ element: defaultFlowMarker,
17654
17760
  ref: { x: 0, y: 10 },
17655
17761
  scale: 0.5
17656
17762
  });
@@ -17666,11 +17772,7 @@
17666
17772
 
17667
17773
  offset = offset || 0;
17668
17774
 
17669
- attrs = computeStyle(attrs, {
17670
- stroke: black,
17671
- strokeWidth: 2,
17672
- fill: 'white'
17673
- });
17775
+ attrs = shapeStyle(attrs);
17674
17776
 
17675
17777
  if (attrs.fill === 'none') {
17676
17778
  delete attrs.fillOpacity;
@@ -17679,13 +17781,12 @@
17679
17781
  var cx = width / 2,
17680
17782
  cy = height / 2;
17681
17783
 
17682
- var circle = create$1('circle');
17683
- attr(circle, {
17784
+ var circle = create$1('circle', {
17684
17785
  cx: cx,
17685
17786
  cy: cy,
17686
- r: Math.round((width + height) / 4 - offset)
17787
+ r: Math.round((width + height) / 4 - offset),
17788
+ ...attrs
17687
17789
  });
17688
- attr(circle, attrs);
17689
17790
 
17690
17791
  append(parentGfx, circle);
17691
17792
 
@@ -17701,22 +17802,17 @@
17701
17802
 
17702
17803
  offset = offset || 0;
17703
17804
 
17704
- attrs = computeStyle(attrs, {
17705
- stroke: black,
17706
- strokeWidth: 2,
17707
- fill: 'white'
17708
- });
17805
+ attrs = shapeStyle(attrs);
17709
17806
 
17710
- var rect = create$1('rect');
17711
- attr(rect, {
17807
+ var rect = create$1('rect', {
17712
17808
  x: offset,
17713
17809
  y: offset,
17714
17810
  width: width - offset * 2,
17715
17811
  height: height - offset * 2,
17716
17812
  rx: r,
17717
- ry: r
17813
+ ry: r,
17814
+ ...attrs
17718
17815
  });
17719
- attr(rect, attrs);
17720
17816
 
17721
17817
  append(parentGfx, rect);
17722
17818
 
@@ -17728,53 +17824,66 @@
17728
17824
  var x_2 = width / 2;
17729
17825
  var y_2 = height / 2;
17730
17826
 
17731
- var points = [ { x: x_2, y: 0 }, { x: width, y: y_2 }, { x: x_2, y: height }, { x: 0, y: y_2 } ];
17827
+ var points = [
17828
+ { x: x_2, y: 0 },
17829
+ { x: width, y: y_2 },
17830
+ { x: x_2, y: height },
17831
+ { x: 0, y: y_2 }
17832
+ ];
17732
17833
 
17733
17834
  var pointsString = points.map(function(point) {
17734
17835
  return point.x + ',' + point.y;
17735
17836
  }).join(' ');
17736
17837
 
17737
- attrs = computeStyle(attrs, {
17738
- stroke: black,
17739
- strokeWidth: 2,
17740
- fill: 'white'
17741
- });
17838
+ attrs = shapeStyle(attrs);
17742
17839
 
17743
- var polygon = create$1('polygon');
17744
- attr(polygon, {
17840
+ var polygon = create$1('polygon', {
17841
+ ...attrs,
17745
17842
  points: pointsString
17746
17843
  });
17747
- attr(polygon, attrs);
17748
17844
 
17749
17845
  append(parentGfx, polygon);
17750
17846
 
17751
17847
  return polygon;
17752
17848
  }
17753
17849
 
17754
- function drawLine(parentGfx, waypoints, attrs) {
17755
- attrs = computeStyle(attrs, [ 'no-fill' ], {
17756
- stroke: black,
17757
- strokeWidth: 2,
17758
- fill: 'none'
17759
- });
17850
+ /**
17851
+ * @param {SVGElement} parentGfx
17852
+ * @param {Point[]} waypoints
17853
+ * @param {any} attrs
17854
+ * @param {number} [radius]
17855
+ *
17856
+ * @return {SVGElement}
17857
+ */
17858
+ function drawLine(parentGfx, waypoints, attrs, radius) {
17859
+ attrs = lineStyle(attrs);
17760
17860
 
17761
- var line = createLine(waypoints, attrs);
17861
+ var line = createLine(waypoints, attrs, radius);
17762
17862
 
17763
17863
  append(parentGfx, line);
17764
17864
 
17765
17865
  return line;
17766
17866
  }
17767
17867
 
17868
+ /**
17869
+ * @param {SVGElement} parentGfx
17870
+ * @param {Point[]} waypoints
17871
+ * @param {any} attrs
17872
+ *
17873
+ * @return {SVGElement}
17874
+ */
17875
+ function drawConnectionSegments(parentGfx, waypoints, attrs) {
17876
+ return drawLine(parentGfx, waypoints, attrs, 5);
17877
+ }
17878
+
17768
17879
  function drawPath(parentGfx, d, attrs) {
17769
17880
 
17770
- attrs = computeStyle(attrs, [ 'no-fill' ], {
17771
- strokeWidth: 2,
17772
- stroke: black
17773
- });
17881
+ attrs = lineStyle(attrs);
17774
17882
 
17775
- var path = create$1('path');
17776
- attr(path, { d: d });
17777
- attr(path, attrs);
17883
+ var path = create$1('path', {
17884
+ ...attrs,
17885
+ d
17886
+ });
17778
17887
 
17779
17888
  append(parentGfx, path);
17780
17889
 
@@ -17875,7 +17984,7 @@
17875
17984
  return renderLabel(parentGfx, semantic.name, {
17876
17985
  box: element,
17877
17986
  align: align,
17878
- padding: 5,
17987
+ padding: 7,
17879
17988
  style: {
17880
17989
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
17881
17990
  }
@@ -17921,16 +18030,6 @@
17921
18030
  transform(textBox, 0, -top, 270);
17922
18031
  }
17923
18032
 
17924
- function createPathFromConnection(connection) {
17925
- var waypoints = connection.waypoints;
17926
-
17927
- var pathData = 'm ' + waypoints[0].x + ',' + waypoints[0].y;
17928
- for (var i = 1; i < waypoints.length; i++) {
17929
- pathData += 'L' + waypoints[i].x + ',' + waypoints[i].y + ' ';
17930
- }
17931
- return pathData;
17932
- }
17933
-
17934
18033
  var handlers = this.handlers = {
17935
18034
  'bpmn:Event': function(parentGfx, element, attrs) {
17936
18035
 
@@ -17951,7 +18050,6 @@
17951
18050
  if (!semantic.isInterrupting) {
17952
18051
  attrs = {
17953
18052
  strokeDasharray: '6',
17954
- strokeLinecap: 'round',
17955
18053
  fill: getFillColor(element, defaultFillColor),
17956
18054
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17957
18055
  };
@@ -18006,7 +18104,6 @@
18006
18104
 
18007
18105
  drawPath(parentGfx, pathData, {
18008
18106
  strokeWidth: 2,
18009
- strokeLinecap: 'square',
18010
18107
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18011
18108
  });
18012
18109
 
@@ -18028,7 +18125,6 @@
18028
18125
 
18029
18126
  drawPath(parentGfx, linePathData, {
18030
18127
  strokeWidth: 1,
18031
- strokeLinecap: 'square',
18032
18128
  transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')',
18033
18129
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18034
18130
  });
@@ -18236,14 +18332,14 @@
18236
18332
  },
18237
18333
  'bpmn:IntermediateEvent': function(parentGfx, element) {
18238
18334
  var outer = renderer('bpmn:Event')(parentGfx, element, {
18239
- strokeWidth: 1,
18335
+ strokeWidth: 1.5,
18240
18336
  fill: getFillColor(element, defaultFillColor),
18241
18337
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18242
18338
  });
18243
18339
 
18244
18340
  /* inner */
18245
18341
  drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
18246
- strokeWidth: 1,
18342
+ strokeWidth: 1.5,
18247
18343
  fill: getFillColor(element, 'none'),
18248
18344
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18249
18345
  });
@@ -18496,10 +18592,11 @@
18496
18592
  return task;
18497
18593
  },
18498
18594
  'bpmn:SubProcess': function(parentGfx, element, attrs) {
18499
- attrs = assign$1({
18595
+ attrs = {
18500
18596
  fill: getFillColor(element, defaultFillColor),
18501
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18502
- }, attrs);
18597
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18598
+ ...attrs
18599
+ };
18503
18600
 
18504
18601
  var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
18505
18602
 
@@ -18507,7 +18604,8 @@
18507
18604
 
18508
18605
  if (isEventSubProcess(element)) {
18509
18606
  attr(rect, {
18510
- strokeDasharray: '1,2'
18607
+ strokeDasharray: '0, 5.5',
18608
+ strokeWidth: 2.5
18511
18609
  });
18512
18610
  }
18513
18611
 
@@ -18525,13 +18623,14 @@
18525
18623
  return renderer('bpmn:SubProcess')(parentGfx, element);
18526
18624
  },
18527
18625
  'bpmn:Transaction': function(parentGfx, element) {
18528
- var outer = renderer('bpmn:SubProcess')(parentGfx, element);
18626
+ var outer = renderer('bpmn:SubProcess')(parentGfx, element, { strokeWidth: 1.5 });
18529
18627
 
18530
18628
  var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
18531
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18629
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18630
+ strokeWidth: 1.5
18532
18631
  });
18533
18632
 
18534
- /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 2, INNER_OUTER_DIST, innerAttrs);
18633
+ /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 3, INNER_OUTER_DIST, innerAttrs);
18535
18634
 
18536
18635
  return outer;
18537
18636
  },
@@ -18542,10 +18641,13 @@
18542
18641
  },
18543
18642
  'bpmn:Participant': function(parentGfx, element) {
18544
18643
 
18644
+ var strokeWidth = 1.5;
18645
+
18545
18646
  var attrs = {
18546
18647
  fillOpacity: DEFAULT_FILL_OPACITY,
18547
18648
  fill: getFillColor(element, defaultFillColor),
18548
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18649
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18650
+ strokeWidth
18549
18651
  };
18550
18652
 
18551
18653
  var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);
@@ -18557,13 +18659,14 @@
18557
18659
  { x: 30, y: 0 },
18558
18660
  { x: 30, y: element.height }
18559
18661
  ], {
18560
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18662
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18663
+ strokeWidth
18561
18664
  });
18562
18665
  var text = getSemantic(element).name;
18563
18666
  renderLaneLabel(parentGfx, text, element);
18564
18667
  } else {
18565
18668
 
18566
- // Collapsed pool draw text inline
18669
+ // collapsed pool draw text inline
18567
18670
  var text2 = getSemantic(element).name;
18568
18671
  renderLabel(parentGfx, text2, {
18569
18672
  box: element, align: 'center-middle',
@@ -18582,11 +18685,13 @@
18582
18685
  return lane;
18583
18686
  },
18584
18687
  'bpmn:Lane': function(parentGfx, element, attrs) {
18585
- var rect = drawRect(parentGfx, element.width, element.height, 0, assign$1({
18688
+ var rect = drawRect(parentGfx, element.width, element.height, 0, {
18586
18689
  fill: getFillColor(element, defaultFillColor),
18587
18690
  fillOpacity: HIGH_FILL_OPACITY,
18588
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18589
- }, attrs));
18691
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18692
+ strokeWidth: 1.5,
18693
+ ...attrs
18694
+ });
18590
18695
 
18591
18696
  var semantic = getSemantic(element);
18592
18697
 
@@ -18705,13 +18810,11 @@
18705
18810
  }
18706
18811
  });
18707
18812
 
18708
- var attrs = {
18813
+ /* event path */ drawPath(parentGfx, pathData, {
18709
18814
  strokeWidth: 2,
18710
18815
  fill: getFillColor(element, 'none'),
18711
18816
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18712
- };
18713
-
18714
- /* event path */ drawPath(parentGfx, pathData, attrs);
18817
+ });
18715
18818
  }
18716
18819
 
18717
18820
  if (type === 'Parallel') {
@@ -18727,16 +18830,14 @@
18727
18830
  }
18728
18831
  });
18729
18832
 
18730
- var parallelPath = drawPath(parentGfx, pathData);
18731
- attr(parallelPath, {
18833
+ drawPath(parentGfx, pathData, {
18732
18834
  strokeWidth: 1,
18733
18835
  fill: 'none'
18734
18836
  });
18735
18837
  } else if (type === 'Exclusive') {
18736
18838
 
18737
18839
  if (!instantiate) {
18738
- var innerCircle = drawCircle(parentGfx, element.width, element.height, element.height * 0.26);
18739
- attr(innerCircle, {
18840
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
18740
18841
  strokeWidth: 1,
18741
18842
  fill: 'none',
18742
18843
  stroke: getStrokeColor$1(element, defaultStrokeColor)
@@ -18750,27 +18851,20 @@
18750
18851
  return diamond;
18751
18852
  },
18752
18853
  'bpmn:Gateway': function(parentGfx, element) {
18753
- var attrs = {
18854
+ return drawDiamond(parentGfx, element.width, element.height, {
18754
18855
  fill: getFillColor(element, defaultFillColor),
18755
18856
  fillOpacity: DEFAULT_FILL_OPACITY,
18756
18857
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18757
- };
18758
-
18759
- return drawDiamond(parentGfx, element.width, element.height, attrs);
18858
+ });
18760
18859
  },
18761
18860
  'bpmn:SequenceFlow': function(parentGfx, element) {
18762
- var pathData = createPathFromConnection(element);
18763
-
18764
18861
  var fill = getFillColor(element, defaultFillColor),
18765
18862
  stroke = getStrokeColor$1(element, defaultStrokeColor);
18766
18863
 
18767
- var attrs = {
18768
- strokeLinejoin: 'round',
18864
+ var path = drawConnectionSegments(parentGfx, element.waypoints, {
18769
18865
  markerEnd: marker('sequenceflow-end', fill, stroke),
18770
18866
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18771
- };
18772
-
18773
- var path = drawPath(parentGfx, pathData, attrs);
18867
+ });
18774
18868
 
18775
18869
  var sequenceFlow = getSemantic(element);
18776
18870
 
@@ -18804,12 +18898,11 @@
18804
18898
  var fill = getFillColor(element, defaultFillColor),
18805
18899
  stroke = getStrokeColor$1(element, defaultStrokeColor);
18806
18900
 
18807
- attrs = assign$1({
18808
- strokeDasharray: '0.5, 5',
18809
- strokeLinecap: 'round',
18810
- strokeLinejoin: 'round',
18811
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18812
- }, attrs || {});
18901
+ attrs = {
18902
+ strokeDasharray: '0, 5',
18903
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18904
+ ...attrs
18905
+ };
18813
18906
 
18814
18907
  if (semantic.associationDirection === 'One' ||
18815
18908
  semantic.associationDirection === 'Both') {
@@ -18820,7 +18913,7 @@
18820
18913
  attrs.markerStart = marker('association-start', fill, stroke);
18821
18914
  }
18822
18915
 
18823
- return drawLine(parentGfx, element.waypoints, attrs);
18916
+ return drawConnectionSegments(parentGfx, element.waypoints, attrs);
18824
18917
  },
18825
18918
  'bpmn:DataInputAssociation': function(parentGfx, element) {
18826
18919
  var fill = getFillColor(element, defaultFillColor),
@@ -18846,19 +18939,13 @@
18846
18939
  var fill = getFillColor(element, defaultFillColor),
18847
18940
  stroke = getStrokeColor$1(element, defaultStrokeColor);
18848
18941
 
18849
- var pathData = createPathFromConnection(element);
18850
-
18851
- var attrs = {
18942
+ var path = drawConnectionSegments(parentGfx, element.waypoints, {
18852
18943
  markerEnd: marker('messageflow-end', fill, stroke),
18853
18944
  markerStart: marker('messageflow-start', fill, stroke),
18854
- strokeDasharray: '10, 12',
18855
- strokeLinecap: 'round',
18856
- strokeLinejoin: 'round',
18857
- strokeWidth: '1.5px',
18945
+ strokeDasharray: '10, 11',
18946
+ strokeWidth: 1.5,
18858
18947
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18859
- };
18860
-
18861
- var path = drawPath(parentGfx, pathData, attrs);
18948
+ });
18862
18949
 
18863
18950
  if (semantic.messageRef) {
18864
18951
  var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
@@ -18981,25 +19068,26 @@
18981
19068
  cancel = semantic.cancelActivity;
18982
19069
 
18983
19070
  var attrs = {
18984
- strokeWidth: 1,
19071
+ strokeWidth: 1.5,
18985
19072
  fill: getFillColor(element, defaultFillColor),
18986
19073
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18987
19074
  };
18988
19075
 
18989
19076
  if (!cancel) {
18990
19077
  attrs.strokeDasharray = '6';
18991
- attrs.strokeLinecap = 'round';
18992
19078
  }
18993
19079
 
18994
19080
  // apply fillOpacity
18995
- var outerAttrs = assign$1({}, attrs, {
19081
+ var outerAttrs = {
19082
+ ...attrs,
18996
19083
  fillOpacity: 1
18997
- });
19084
+ };
18998
19085
 
18999
19086
  // apply no-fill
19000
- var innerAttrs = assign$1({}, attrs, {
19087
+ var innerAttrs = {
19088
+ ...attrs,
19001
19089
  fill: 'none'
19002
- });
19090
+ };
19003
19091
 
19004
19092
  var outer = renderer('bpmn:Event')(parentGfx, element, outerAttrs);
19005
19093
 
@@ -19010,27 +19098,22 @@
19010
19098
  return outer;
19011
19099
  },
19012
19100
  'bpmn:Group': function(parentGfx, element) {
19013
-
19014
- var group = drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
19101
+ return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
19015
19102
  stroke: getStrokeColor$1(element, defaultStrokeColor),
19016
- strokeWidth: 1,
19017
- strokeDasharray: '8,3,1,3',
19103
+ strokeWidth: 1.5,
19104
+ strokeDasharray: '10,6,0,6',
19018
19105
  fill: 'none',
19019
19106
  pointerEvents: 'none'
19020
19107
  });
19021
-
19022
- return group;
19023
19108
  },
19024
19109
  'label': function(parentGfx, element) {
19025
19110
  return renderExternalLabel(parentGfx, element);
19026
19111
  },
19027
19112
  'bpmn:TextAnnotation': function(parentGfx, element) {
19028
- var style = {
19113
+ var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, {
19029
19114
  'fill': 'none',
19030
19115
  'stroke': 'none'
19031
- };
19032
-
19033
- var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, style);
19116
+ });
19034
19117
 
19035
19118
  var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
19036
19119
  xScaleFactor: 1,
@@ -19051,7 +19134,7 @@
19051
19134
  renderLabel(parentGfx, text, {
19052
19135
  box: element,
19053
19136
  align: 'left-top',
19054
- padding: 5,
19137
+ padding: 7,
19055
19138
  style: {
19056
19139
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
19057
19140
  }
@@ -19169,10 +19252,9 @@
19169
19252
  });
19170
19253
 
19171
19254
  drawMarker('loop', parentGfx, markerPath, {
19172
- strokeWidth: 1,
19255
+ strokeWidth: 1.5,
19173
19256
  fill: getFillColor(element, defaultFillColor),
19174
19257
  stroke: getStrokeColor$1(element, defaultStrokeColor),
19175
- strokeLinecap: 'round',
19176
19258
  strokeMiterlimit: 0.5
19177
19259
  });
19178
19260
  },
@@ -21393,7 +21475,7 @@
21393
21475
  attr(outline, assign$1({
21394
21476
  x: 10,
21395
21477
  y: 10,
21396
- rx: 3,
21478
+ rx: 4,
21397
21479
  width: 100,
21398
21480
  height: 100
21399
21481
  }, OUTLINE_STYLE));
@@ -23567,6 +23649,10 @@
23567
23649
  subprocessCompatibility: [ 'type', SubprocessCompatibility ]
23568
23650
  };
23569
23651
 
23652
+ /**
23653
+ * @typedef { import('didi').ModuleDeclaration } Module
23654
+ */
23655
+
23570
23656
  /**
23571
23657
  * A viewer for BPMN 2.0 diagrams.
23572
23658
  *
@@ -23611,8 +23697,8 @@
23611
23697
  * @param {string|number} [options.width] the width of the viewer
23612
23698
  * @param {string|number} [options.height] the height of the viewer
23613
23699
  * @param {Object} [options.moddleExtensions] extension packages to provide
23614
- * @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
23615
- * @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
23700
+ * @param {Module[]} [options.modules] a list of modules to override the default modules
23701
+ * @param {Module[]} [options.additionalModules] a list of modules to use with the default modules
23616
23702
  */
23617
23703
  function Viewer(options) {
23618
23704
  BaseViewer.call(this, options);
@@ -28568,41 +28654,21 @@
28568
28654
 
28569
28655
  const [ value, setValue ] = p$3('');
28570
28656
 
28571
- const [ entries, setEntries ] = p$3(originalEntries);
28572
- const [ selectedEntry, setSelectedEntry ] = p$3(entries[0]);
28573
-
28574
- h$2(() => {
28575
- onOpened();
28576
-
28577
- return () => {
28578
- onClosed();
28579
- };
28580
- }, []);
28581
-
28582
- const updateEntries = T$3((newEntries) => {
28583
-
28584
- // select first entry if non is selected
28585
- if (!selectedEntry || !newEntries.includes(selectedEntry)) {
28586
- setSelectedEntry(newEntries[0]);
28587
- }
28657
+ const filterEntries = T$3((originalEntries, value) => {
28588
28658
 
28589
- setEntries(newEntries);
28590
- }, [ selectedEntry, setEntries, setSelectedEntry ]);
28591
-
28592
- // filter entries on value change
28593
- h$2(() => {
28594
28659
  if (!searchable) {
28595
- return;
28660
+ return originalEntries;
28596
28661
  }
28597
28662
 
28598
28663
  const filter = entry => {
28599
28664
  if (!value) {
28600
- return true;
28665
+ return (entry.rank || 0) >= 0;
28601
28666
  }
28602
28667
 
28603
28668
  const search = [
28604
28669
  entry.description || '',
28605
- entry.label || ''
28670
+ entry.label || '',
28671
+ entry.search || ''
28606
28672
  ]
28607
28673
  .join('---')
28608
28674
  .toLowerCase();
@@ -28613,10 +28679,26 @@
28613
28679
  .every(term => search.includes(term));
28614
28680
  };
28615
28681
 
28616
- const entries = originalEntries.filter(filter);
28682
+ return originalEntries.filter(filter);
28683
+ }, [ searchable ]);
28684
+
28685
+ const [ entries, setEntries ] = p$3(filterEntries(originalEntries, value));
28686
+ const [ selectedEntry, setSelectedEntry ] = p$3(entries[0]);
28687
+
28688
+ const updateEntries = T$3((newEntries) => {
28689
+
28690
+ // select first entry if non is selected
28691
+ if (!selectedEntry || !newEntries.includes(selectedEntry)) {
28692
+ setSelectedEntry(newEntries[0]);
28693
+ }
28694
+
28695
+ setEntries(newEntries);
28696
+ }, [ selectedEntry, setEntries, setSelectedEntry ]);
28617
28697
 
28618
- updateEntries(entries);
28619
- }, [ value, originalEntries, searchable ]);
28698
+ // filter entries on value change
28699
+ h$2(() => {
28700
+ updateEntries(filterEntries(originalEntries, value));
28701
+ }, [ value, originalEntries ]);
28620
28702
 
28621
28703
  // register global <Escape> handler
28622
28704
  h$2(() => {
@@ -28662,10 +28744,6 @@
28662
28744
  return onSelect(event, selectedEntry);
28663
28745
  }
28664
28746
 
28665
- if (event.key === 'Escape') {
28666
- return onClose();
28667
- }
28668
-
28669
28747
  // ARROW_UP or SHIFT + TAB navigation
28670
28748
  if (event.key === 'ArrowUp' || (event.key === 'Tab' && event.shiftKey)) {
28671
28749
  keyboardSelect(-1);
@@ -28687,6 +28765,14 @@
28687
28765
  }
28688
28766
  }, [ setValue ]);
28689
28767
 
28768
+ h$2(() => {
28769
+ onOpened();
28770
+
28771
+ return () => {
28772
+ onClosed();
28773
+ };
28774
+ }, []);
28775
+
28690
28776
  const displayHeader = F$2(() => title || headerEntries.length > 0, [ title, headerEntries ]);
28691
28777
 
28692
28778
  return m$3`
@@ -30178,7 +30264,7 @@
30178
30264
  y: sourceTrbl.top - 50 - element.height / 2
30179
30265
  };
30180
30266
 
30181
- if (isConnection$f(source)) {
30267
+ if (isConnection$g(source)) {
30182
30268
  position = getMid(source);
30183
30269
  position.x += 100;
30184
30270
  position.y -= 50;
@@ -30217,7 +30303,7 @@
30217
30303
  return findFreePosition(source, element, position, generateGetNextPosition(nextPositionDirection));
30218
30304
  }
30219
30305
 
30220
- function isConnection$f(element) {
30306
+ function isConnection$g(element) {
30221
30307
  return !!element.waypoints;
30222
30308
  }
30223
30309
 
@@ -31643,7 +31729,7 @@
31643
31729
  * Returns the length of a vector
31644
31730
  *
31645
31731
  * @param {Vector}
31646
- * @return {Float}
31732
+ * @return {number}
31647
31733
  */
31648
31734
  function vectorLength(v) {
31649
31735
  return Math.sqrt(Math.pow(v.x, 2) + Math.pow(v.y, 2));
@@ -31654,7 +31740,7 @@
31654
31740
  * Calculates the angle between a line a the yAxis
31655
31741
  *
31656
31742
  * @param {Array}
31657
- * @return {Float}
31743
+ * @return {number}
31658
31744
  */
31659
31745
  function getAngle(line) {
31660
31746
 
@@ -31668,7 +31754,7 @@
31668
31754
  * Rotates a vector by a given angle
31669
31755
  *
31670
31756
  * @param {Vector}
31671
- * @param {Float} Angle in radians
31757
+ * @param {number} Angle in radians
31672
31758
  * @return {Vector}
31673
31759
  */
31674
31760
  function rotateVector(vector, angle) {
@@ -31686,7 +31772,7 @@
31686
31772
  * @param {Vector}
31687
31773
  * @param {Vector}
31688
31774
  * @param {Vector}
31689
- * @return {Float}
31775
+ * @return {number}
31690
31776
  */
31691
31777
  function solveLambaSystem(a, b, c) {
31692
31778
 
@@ -31708,7 +31794,7 @@
31708
31794
  * Position of perpendicular foot
31709
31795
  *
31710
31796
  * @param {Point}
31711
- * @param [ {Point}, {Point} ] line defined through two points
31797
+ * @param {[ Point, Point ]} line defined through two points
31712
31798
  * @return {Point} the perpendicular foot position
31713
31799
  */
31714
31800
  function perpendicularFoot(point, line) {
@@ -31728,9 +31814,10 @@
31728
31814
  /**
31729
31815
  * Calculates the distance between a point and a line
31730
31816
  *
31731
- * @param {Point}
31732
- * @param [ {Point}, {Point} ] line defined through two points
31733
- * @return {Float} distance
31817
+ * @param { Point }
31818
+ * @param { [ Point, Point ] } line defined through two points
31819
+ *
31820
+ * @return { number } distance
31734
31821
  */
31735
31822
  function getDistancePointLine(point, line) {
31736
31823
 
@@ -31751,7 +31838,8 @@
31751
31838
  *
31752
31839
  * @param {Point}
31753
31840
  * @param {Point}
31754
- * @return {Float} distance
31841
+ *
31842
+ * @return {number} distance
31755
31843
  */
31756
31844
  function getDistancePointPoint(point1, point2) {
31757
31845
 
@@ -33457,7 +33545,7 @@
33457
33545
  hoverMid = hover && getSnapPoint(hover, event);
33458
33546
 
33459
33547
  // only snap on connections, elements can have multiple connect endpoints
33460
- if (!isConnection$e(hover) || !hoverMid || !hoverMid.x || !hoverMid.y) {
33548
+ if (!isConnection$f(hover) || !hoverMid || !hoverMid.x || !hoverMid.y) {
33461
33549
  return;
33462
33550
  }
33463
33551
 
@@ -33512,7 +33600,7 @@
33512
33600
 
33513
33601
  // helpers //////////////////////
33514
33602
 
33515
- function isConnection$e(element) {
33603
+ function isConnection$f(element) {
33516
33604
  return element && !!element.waypoints;
33517
33605
  }
33518
33606
 
@@ -33981,18 +34069,12 @@
33981
34069
  * @returns {SVGElement}
33982
34070
  */
33983
34071
  ConnectionPreview.prototype.createNoopConnection = function(start, end) {
33984
- var connection = create$1('polyline');
33985
-
33986
- attr(connection, {
34072
+ return createLine([ start, end ], {
33987
34073
  'stroke': '#333',
33988
34074
  'strokeDasharray': [ 1 ],
33989
34075
  'strokeWidth': 2,
33990
34076
  'pointer-events': 'none'
33991
34077
  });
33992
-
33993
- attr(connection, { 'points': [ start.x, start.y, end.x, end.y ] });
33994
-
33995
- return connection;
33996
34078
  };
33997
34079
 
33998
34080
  // helpers //////////
@@ -34699,6 +34781,7 @@
34699
34781
  'path',
34700
34782
  'polygon',
34701
34783
  'polyline',
34784
+ 'path',
34702
34785
  'rect'
34703
34786
  ];
34704
34787
 
@@ -34973,7 +35056,7 @@
34973
35056
  });
34974
35057
 
34975
35058
  var shape = find$1(elements, function(element) {
34976
- return !isConnection$d(element);
35059
+ return !isConnection$e(element);
34977
35060
  });
34978
35061
 
34979
35062
  var attach = false,
@@ -35128,7 +35211,7 @@
35128
35211
 
35129
35212
  // update shape
35130
35213
  shape = find$1(elements, function(element) {
35131
- return !isConnection$d(element);
35214
+ return !isConnection$e(element);
35132
35215
  });
35133
35216
  }
35134
35217
 
@@ -35169,7 +35252,7 @@
35169
35252
  }
35170
35253
 
35171
35254
  var shape = find$1(elements, function(element) {
35172
- return !isConnection$d(element);
35255
+ return !isConnection$e(element);
35173
35256
  });
35174
35257
 
35175
35258
  if (!shape) {
@@ -35203,7 +35286,7 @@
35203
35286
 
35204
35287
  // center elements around cursor
35205
35288
  forEach$1(elements, function(element) {
35206
- if (isConnection$d(element)) {
35289
+ if (isConnection$e(element)) {
35207
35290
  element.waypoints = map$2(element.waypoints, function(waypoint) {
35208
35291
  return {
35209
35292
  x: waypoint.x - bbox.x - bbox.width / 2,
@@ -35265,12 +35348,12 @@
35265
35348
  }
35266
35349
  }
35267
35350
 
35268
- function isConnection$d(element) {
35351
+ function isConnection$e(element) {
35269
35352
  return !!element.waypoints;
35270
35353
  }
35271
35354
 
35272
35355
  function isSingleShape(elements) {
35273
- return elements && elements.length === 1 && !isConnection$d(elements[0]);
35356
+ return elements && elements.length === 1 && !isConnection$e(elements[0]);
35274
35357
  }
35275
35358
 
35276
35359
  function isLabel$5(element) {
@@ -35587,7 +35670,7 @@
35587
35670
  }
35588
35671
 
35589
35672
  // connections (priority = 3)
35590
- if (isConnection$c(element)) {
35673
+ if (isConnection$d(element)) {
35591
35674
  descriptor.priority = 3;
35592
35675
 
35593
35676
  descriptor.source = element.source.id;
@@ -35730,7 +35813,7 @@
35730
35813
 
35731
35814
  // center elements around cursor
35732
35815
  forEach$1(elements, function(element) {
35733
- if (isConnection$c(element)) {
35816
+ if (isConnection$d(element)) {
35734
35817
  element.waypoints = map$2(element.waypoints, function(waypoint) {
35735
35818
  return {
35736
35819
  x: waypoint.x - bbox.x - bbox.width / 2,
@@ -35783,7 +35866,7 @@
35783
35866
 
35784
35867
  var element;
35785
35868
 
35786
- if (isConnection$c(attrs)) {
35869
+ if (isConnection$d(attrs)) {
35787
35870
  attrs.source = cache[ descriptor.source ];
35788
35871
  attrs.target = cache[ descriptor.target ];
35789
35872
 
@@ -35849,7 +35932,7 @@
35849
35932
  source,
35850
35933
  target;
35851
35934
 
35852
- if (isConnection$c(element)) {
35935
+ if (isConnection$d(element)) {
35853
35936
  source = find$1(elements, matchPattern({ id: element.source.id }));
35854
35937
  target = find$1(elements, matchPattern({ id: element.target.id }));
35855
35938
 
@@ -36046,7 +36129,7 @@
36046
36129
  return !!element.host;
36047
36130
  }
36048
36131
 
36049
- function isConnection$c(element) {
36132
+ function isConnection$d(element) {
36050
36133
  return !!element.waypoints;
36051
36134
  }
36052
36135
 
@@ -36749,7 +36832,7 @@
36749
36832
 
36750
36833
  // copying event definitions, unless we replace
36751
36834
  if (propertyName === 'eventDefinitions') {
36752
- return hasEventDefinition$1(element, target.eventDefinitionType);
36835
+ return hasEventDefinition$2(element, target.eventDefinitionType);
36753
36836
  }
36754
36837
 
36755
36838
  // retain loop characteristics if the target element
@@ -36786,7 +36869,7 @@
36786
36869
  // only initialize with new eventDefinition
36787
36870
  // if we did not set an event definition yet,
36788
36871
  // i.e. because we copied it
36789
- if (!hasEventDefinition$1(newBusinessObject, target.eventDefinitionType)) {
36872
+ if (!hasEventDefinition$2(newBusinessObject, target.eventDefinitionType)) {
36790
36873
  newElement.eventDefinitionType = target.eventDefinitionType;
36791
36874
  newElement.eventDefinitionAttrs = target.eventDefinitionAttrs;
36792
36875
  }
@@ -36916,7 +36999,7 @@
36916
36999
  return is$5(bo, 'bpmn:SubProcess');
36917
37000
  }
36918
37001
 
36919
- function hasEventDefinition$1(element, type) {
37002
+ function hasEventDefinition$2(element, type) {
36920
37003
 
36921
37004
  var bo = getBusinessObject$1(element);
36922
37005
 
@@ -37284,7 +37367,7 @@
37284
37367
  }
37285
37368
  ];
37286
37369
 
37287
- var GATEWAY = [
37370
+ var GATEWAY$1 = [
37288
37371
  {
37289
37372
  label: 'Exclusive Gateway',
37290
37373
  actionName: 'replace-with-exclusive-gateway',
@@ -37417,7 +37500,7 @@
37417
37500
 
37418
37501
  var EVENT_SUB_PROCESS = TRANSACTION;
37419
37502
 
37420
- var TASK = [
37503
+ var TASK$1 = [
37421
37504
  {
37422
37505
  label: 'Task',
37423
37506
  actionName: 'replace-with-task',
@@ -37426,6 +37509,22 @@
37426
37509
  type: 'bpmn:Task'
37427
37510
  }
37428
37511
  },
37512
+ {
37513
+ label: 'User Task',
37514
+ actionName: 'replace-with-user-task',
37515
+ className: 'bpmn-icon-user',
37516
+ target: {
37517
+ type: 'bpmn:UserTask'
37518
+ }
37519
+ },
37520
+ {
37521
+ label: 'Service Task',
37522
+ actionName: 'replace-with-service-task',
37523
+ className: 'bpmn-icon-service',
37524
+ target: {
37525
+ type: 'bpmn:ServiceTask'
37526
+ }
37527
+ },
37429
37528
  {
37430
37529
  label: 'Send Task',
37431
37530
  actionName: 'replace-with-send-task',
@@ -37442,14 +37541,6 @@
37442
37541
  type: 'bpmn:ReceiveTask'
37443
37542
  }
37444
37543
  },
37445
- {
37446
- label: 'User Task',
37447
- actionName: 'replace-with-user-task',
37448
- className: 'bpmn-icon-user',
37449
- target: {
37450
- type: 'bpmn:UserTask'
37451
- }
37452
- },
37453
37544
  {
37454
37545
  label: 'Manual Task',
37455
37546
  actionName: 'replace-with-manual-task',
@@ -37466,14 +37557,6 @@
37466
37557
  type: 'bpmn:BusinessRuleTask'
37467
37558
  }
37468
37559
  },
37469
- {
37470
- label: 'Service Task',
37471
- actionName: 'replace-with-service-task',
37472
- className: 'bpmn-icon-service',
37473
- target: {
37474
- type: 'bpmn:ServiceTask'
37475
- }
37476
- },
37477
37560
  {
37478
37561
  label: 'Script Task',
37479
37562
  actionName: 'replace-with-script-task',
@@ -37791,7 +37874,7 @@
37791
37874
  }
37792
37875
  ];
37793
37876
 
37794
- var PARTICIPANT = [
37877
+ var PARTICIPANT$1 = [
37795
37878
  {
37796
37879
  label: 'Expanded Pool',
37797
37880
  actionName: 'replace-with-expanded-pool',
@@ -37900,7 +37983,7 @@
37900
37983
  // expanded/collapsed pools
37901
37984
  if (is$5(businessObject, 'bpmn:Participant')) {
37902
37985
 
37903
- entries = filter(PARTICIPANT, function(entry) {
37986
+ entries = filter(PARTICIPANT$1, function(entry) {
37904
37987
  return isExpanded(element) !== entry.target.isExpanded;
37905
37988
  });
37906
37989
 
@@ -37983,7 +38066,7 @@
37983
38066
  // gateways
37984
38067
  if (is$5(businessObject, 'bpmn:Gateway')) {
37985
38068
 
37986
- entries = filter(GATEWAY, differentType);
38069
+ entries = filter(GATEWAY$1, differentType);
37987
38070
 
37988
38071
  return this._createEntries(element, entries);
37989
38072
  }
@@ -38015,7 +38098,7 @@
38015
38098
  // collapsed ad hoc sub processes
38016
38099
  if (is$5(businessObject, 'bpmn:AdHocSubProcess') && !isExpanded(element)) {
38017
38100
 
38018
- entries = filter(TASK, function(entry) {
38101
+ entries = filter(TASK$1, function(entry) {
38019
38102
 
38020
38103
  var target = entry.target;
38021
38104
 
@@ -38036,7 +38119,7 @@
38036
38119
 
38037
38120
  // flow nodes
38038
38121
  if (is$5(businessObject, 'bpmn:FlowNode')) {
38039
- entries = filter(TASK, differentType);
38122
+ entries = filter(TASK$1, differentType);
38040
38123
 
38041
38124
  // collapsed SubProcess can not be replaced with itself
38042
38125
  if (is$5(businessObject, 'bpmn:SubProcess') && !isExpanded(element)) {
@@ -38306,6 +38389,12 @@
38306
38389
  var self = this;
38307
38390
  var translate = this._translate;
38308
38391
 
38392
+ var dataObject = element.businessObject.dataObjectRef;
38393
+
38394
+ if (!dataObject) {
38395
+ return [];
38396
+ }
38397
+
38309
38398
  function toggleIsCollection(event, entry) {
38310
38399
  self._modeling.updateModdleProperties(
38311
38400
  element,
@@ -38313,8 +38402,7 @@
38313
38402
  { isCollection: !entry.active });
38314
38403
  }
38315
38404
 
38316
- var dataObject = element.businessObject.dataObjectRef,
38317
- isCollection = dataObject.isCollection;
38405
+ var isCollection = dataObject.isCollection;
38318
38406
 
38319
38407
  var dataObjectEntries = [
38320
38408
  {
@@ -38410,9 +38498,12 @@
38410
38498
  var PopupMenuModule = {
38411
38499
  __depends__: [
38412
38500
  PopupMenuModule$1,
38413
- ReplaceModule
38501
+ ReplaceModule,
38502
+ AutoPlaceModule
38503
+ ],
38504
+ __init__: [
38505
+ 'replaceMenuProvider'
38414
38506
  ],
38415
- __init__: [ 'replaceMenuProvider' ],
38416
38507
  replaceMenuProvider: [ 'type', ReplaceMenuProvider ]
38417
38508
  };
38418
38509
 
@@ -38855,433 +38946,2181 @@
38855
38946
  });
38856
38947
  }
38857
38948
 
38858
- return actions;
38949
+ return actions;
38950
+ };
38951
+
38952
+ /**
38953
+ * @param {djs.model.Base[]} elements
38954
+ * @return {boolean}
38955
+ */
38956
+ ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
38957
+
38958
+ var baseAllowed = this._rules.allowed('elements.delete', {
38959
+ elements: elements
38960
+ });
38961
+
38962
+ if (isArray$3(baseAllowed)) {
38963
+ return every(baseAllowed, function(element) {
38964
+ return includes$7(baseAllowed, element);
38965
+ });
38966
+ }
38967
+
38968
+ return baseAllowed;
38969
+ };
38970
+
38971
+ ContextPadProvider.prototype.getContextPadEntries = function(element) {
38972
+ var contextPad = this._contextPad,
38973
+ modeling = this._modeling,
38974
+
38975
+ elementFactory = this._elementFactory,
38976
+ connect = this._connect,
38977
+ create = this._create,
38978
+ popupMenu = this._popupMenu,
38979
+ rules = this._rules,
38980
+ autoPlace = this._autoPlace,
38981
+ translate = this._translate;
38982
+
38983
+ var actions = {};
38984
+
38985
+ if (element.type === 'label') {
38986
+ return actions;
38987
+ }
38988
+
38989
+ var businessObject = element.businessObject;
38990
+
38991
+ function startConnect(event, element) {
38992
+ connect.start(event, element);
38993
+ }
38994
+
38995
+ function removeElement(e, element) {
38996
+ modeling.removeElements([ element ]);
38997
+ }
38998
+
38999
+ function getReplaceMenuPosition(element) {
39000
+
39001
+ var Y_OFFSET = 5;
39002
+
39003
+ var pad = contextPad.getPad(element).html;
39004
+
39005
+ var padRect = pad.getBoundingClientRect();
39006
+
39007
+ var pos = {
39008
+ x: padRect.left,
39009
+ y: padRect.bottom + Y_OFFSET
39010
+ };
39011
+
39012
+ return pos;
39013
+ }
39014
+
39015
+ /**
39016
+ * Create an append action
39017
+ *
39018
+ * @param {string} type
39019
+ * @param {string} className
39020
+ * @param {string} [title]
39021
+ * @param {Object} [options]
39022
+ *
39023
+ * @return {Object} descriptor
39024
+ */
39025
+ function appendAction(type, className, title, options) {
39026
+
39027
+ if (typeof title !== 'string') {
39028
+ options = title;
39029
+ title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') });
39030
+ }
39031
+
39032
+ function appendStart(event, element) {
39033
+
39034
+ var shape = elementFactory.createShape(assign$1({ type: type }, options));
39035
+ create.start(event, shape, {
39036
+ source: element
39037
+ });
39038
+ }
39039
+
39040
+
39041
+ var append = autoPlace ? function(event, element) {
39042
+ var shape = elementFactory.createShape(assign$1({ type: type }, options));
39043
+
39044
+ autoPlace.append(element, shape);
39045
+ } : appendStart;
39046
+
39047
+
39048
+ return {
39049
+ group: 'model',
39050
+ className: className,
39051
+ title: title,
39052
+ action: {
39053
+ dragstart: appendStart,
39054
+ click: append
39055
+ }
39056
+ };
39057
+ }
39058
+
39059
+ function splitLaneHandler(count) {
39060
+
39061
+ return function(event, element) {
39062
+
39063
+ // actual split
39064
+ modeling.splitLane(element, count);
39065
+
39066
+ // refresh context pad after split to
39067
+ // get rid of split icons
39068
+ contextPad.open(element, true);
39069
+ };
39070
+ }
39071
+
39072
+
39073
+ if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) {
39074
+
39075
+ var childLanes = getChildLanes(element);
39076
+
39077
+ assign$1(actions, {
39078
+ 'lane-insert-above': {
39079
+ group: 'lane-insert-above',
39080
+ className: 'bpmn-icon-lane-insert-above',
39081
+ title: translate('Add Lane above'),
39082
+ action: {
39083
+ click: function(event, element) {
39084
+ modeling.addLane(element, 'top');
39085
+ }
39086
+ }
39087
+ }
39088
+ });
39089
+
39090
+ if (childLanes.length < 2) {
39091
+
39092
+ if (element.height >= 120) {
39093
+ assign$1(actions, {
39094
+ 'lane-divide-two': {
39095
+ group: 'lane-divide',
39096
+ className: 'bpmn-icon-lane-divide-two',
39097
+ title: translate('Divide into two Lanes'),
39098
+ action: {
39099
+ click: splitLaneHandler(2)
39100
+ }
39101
+ }
39102
+ });
39103
+ }
39104
+
39105
+ if (element.height >= 180) {
39106
+ assign$1(actions, {
39107
+ 'lane-divide-three': {
39108
+ group: 'lane-divide',
39109
+ className: 'bpmn-icon-lane-divide-three',
39110
+ title: translate('Divide into three Lanes'),
39111
+ action: {
39112
+ click: splitLaneHandler(3)
39113
+ }
39114
+ }
39115
+ });
39116
+ }
39117
+ }
39118
+
39119
+ assign$1(actions, {
39120
+ 'lane-insert-below': {
39121
+ group: 'lane-insert-below',
39122
+ className: 'bpmn-icon-lane-insert-below',
39123
+ title: translate('Add Lane below'),
39124
+ action: {
39125
+ click: function(event, element) {
39126
+ modeling.addLane(element, 'bottom');
39127
+ }
39128
+ }
39129
+ }
39130
+ });
39131
+
39132
+ }
39133
+
39134
+ if (is$5(businessObject, 'bpmn:FlowNode')) {
39135
+
39136
+ if (is$5(businessObject, 'bpmn:EventBasedGateway')) {
39137
+
39138
+ assign$1(actions, {
39139
+ 'append.receive-task': appendAction(
39140
+ 'bpmn:ReceiveTask',
39141
+ 'bpmn-icon-receive-task',
39142
+ translate('Append ReceiveTask')
39143
+ ),
39144
+ 'append.message-intermediate-event': appendAction(
39145
+ 'bpmn:IntermediateCatchEvent',
39146
+ 'bpmn-icon-intermediate-event-catch-message',
39147
+ translate('Append MessageIntermediateCatchEvent'),
39148
+ { eventDefinitionType: 'bpmn:MessageEventDefinition' }
39149
+ ),
39150
+ 'append.timer-intermediate-event': appendAction(
39151
+ 'bpmn:IntermediateCatchEvent',
39152
+ 'bpmn-icon-intermediate-event-catch-timer',
39153
+ translate('Append TimerIntermediateCatchEvent'),
39154
+ { eventDefinitionType: 'bpmn:TimerEventDefinition' }
39155
+ ),
39156
+ 'append.condition-intermediate-event': appendAction(
39157
+ 'bpmn:IntermediateCatchEvent',
39158
+ 'bpmn-icon-intermediate-event-catch-condition',
39159
+ translate('Append ConditionIntermediateCatchEvent'),
39160
+ { eventDefinitionType: 'bpmn:ConditionalEventDefinition' }
39161
+ ),
39162
+ 'append.signal-intermediate-event': appendAction(
39163
+ 'bpmn:IntermediateCatchEvent',
39164
+ 'bpmn-icon-intermediate-event-catch-signal',
39165
+ translate('Append SignalIntermediateCatchEvent'),
39166
+ { eventDefinitionType: 'bpmn:SignalEventDefinition' }
39167
+ )
39168
+ });
39169
+ } else
39170
+
39171
+ if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
39172
+
39173
+ assign$1(actions, {
39174
+ 'append.compensation-activity':
39175
+ appendAction(
39176
+ 'bpmn:Task',
39177
+ 'bpmn-icon-task',
39178
+ translate('Append compensation activity'),
39179
+ {
39180
+ isForCompensation: true
39181
+ }
39182
+ )
39183
+ });
39184
+ } else
39185
+
39186
+ if (!is$5(businessObject, 'bpmn:EndEvent') &&
39187
+ !businessObject.isForCompensation &&
39188
+ !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
39189
+ !isEventSubProcess(businessObject)) {
39190
+
39191
+ assign$1(actions, {
39192
+ 'append.end-event': appendAction(
39193
+ 'bpmn:EndEvent',
39194
+ 'bpmn-icon-end-event-none',
39195
+ translate('Append EndEvent')
39196
+ ),
39197
+ 'append.gateway': appendAction(
39198
+ 'bpmn:ExclusiveGateway',
39199
+ 'bpmn-icon-gateway-none',
39200
+ translate('Append Gateway')
39201
+ ),
39202
+ 'append.append-task': appendAction(
39203
+ 'bpmn:Task',
39204
+ 'bpmn-icon-task',
39205
+ translate('Append Task')
39206
+ ),
39207
+ 'append.intermediate-event': appendAction(
39208
+ 'bpmn:IntermediateThrowEvent',
39209
+ 'bpmn-icon-intermediate-event-none',
39210
+ translate('Append Intermediate/Boundary Event')
39211
+ )
39212
+ });
39213
+ }
39214
+ }
39215
+
39216
+ if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
39217
+
39218
+ // Replace menu entry
39219
+ assign$1(actions, {
39220
+ 'replace': {
39221
+ group: 'edit',
39222
+ className: 'bpmn-icon-screw-wrench',
39223
+ title: translate('Change type'),
39224
+ action: {
39225
+ click: function(event, element) {
39226
+
39227
+ var position = assign$1(getReplaceMenuPosition(element), {
39228
+ cursor: { x: event.x, y: event.y }
39229
+ });
39230
+
39231
+ popupMenu.open(element, 'bpmn-replace', position, {
39232
+ title: translate('Change element'),
39233
+ width: 300,
39234
+ search: true
39235
+ });
39236
+ }
39237
+ }
39238
+ }
39239
+ });
39240
+ }
39241
+
39242
+ if (is$5(businessObject, 'bpmn:SequenceFlow')) {
39243
+ assign$1(actions, {
39244
+ 'append.text-annotation': appendAction(
39245
+ 'bpmn:TextAnnotation',
39246
+ 'bpmn-icon-text-annotation'
39247
+ )
39248
+ });
39249
+ }
39250
+
39251
+ if (
39252
+ isAny(businessObject, [
39253
+ 'bpmn:FlowNode',
39254
+ 'bpmn:InteractionNode',
39255
+ 'bpmn:DataObjectReference',
39256
+ 'bpmn:DataStoreReference',
39257
+ ])
39258
+ ) {
39259
+ assign$1(actions, {
39260
+ 'append.text-annotation': appendAction(
39261
+ 'bpmn:TextAnnotation',
39262
+ 'bpmn-icon-text-annotation'
39263
+ ),
39264
+
39265
+ 'connect': {
39266
+ group: 'connect',
39267
+ className: 'bpmn-icon-connection-multi',
39268
+ title: translate(
39269
+ 'Connect using ' +
39270
+ (businessObject.isForCompensation
39271
+ ? ''
39272
+ : 'Sequence/MessageFlow or ') +
39273
+ 'Association'
39274
+ ),
39275
+ action: {
39276
+ click: startConnect,
39277
+ dragstart: startConnect,
39278
+ },
39279
+ },
39280
+ });
39281
+ }
39282
+
39283
+ if (is$5(businessObject, 'bpmn:TextAnnotation')) {
39284
+ assign$1(actions, {
39285
+ 'connect': {
39286
+ group: 'connect',
39287
+ className: 'bpmn-icon-connection-multi',
39288
+ title: translate('Connect using Association'),
39289
+ action: {
39290
+ click: startConnect,
39291
+ dragstart: startConnect,
39292
+ },
39293
+ },
39294
+ });
39295
+ }
39296
+
39297
+ if (isAny(businessObject, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
39298
+ assign$1(actions, {
39299
+ 'connect': {
39300
+ group: 'connect',
39301
+ className: 'bpmn-icon-connection-multi',
39302
+ title: translate('Connect using DataInputAssociation'),
39303
+ action: {
39304
+ click: startConnect,
39305
+ dragstart: startConnect
39306
+ }
39307
+ }
39308
+ });
39309
+ }
39310
+
39311
+ if (is$5(businessObject, 'bpmn:Group')) {
39312
+ assign$1(actions, {
39313
+ 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation')
39314
+ });
39315
+ }
39316
+
39317
+ // delete element entry, only show if allowed by rules
39318
+ var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });
39319
+
39320
+ if (isArray$3(deleteAllowed)) {
39321
+
39322
+ // was the element returned as a deletion candidate?
39323
+ deleteAllowed = deleteAllowed[0] === element;
39324
+ }
39325
+
39326
+ if (deleteAllowed) {
39327
+ assign$1(actions, {
39328
+ 'delete': {
39329
+ group: 'edit',
39330
+ className: 'bpmn-icon-trash',
39331
+ title: translate('Remove'),
39332
+ action: {
39333
+ click: removeElement
39334
+ }
39335
+ }
39336
+ });
39337
+ }
39338
+
39339
+ return actions;
39340
+ };
39341
+
39342
+
39343
+ // helpers /////////
39344
+
39345
+ function isEventType(eventBo, type, definition) {
39346
+
39347
+ var isType = eventBo.$instanceOf(type);
39348
+ var isDefinition = false;
39349
+
39350
+ var definitions = eventBo.eventDefinitions || [];
39351
+ forEach$1(definitions, function(def) {
39352
+ if (def.$type === definition) {
39353
+ isDefinition = true;
39354
+ }
39355
+ });
39356
+
39357
+ return isType && isDefinition;
39358
+ }
39359
+
39360
+ function includes$7(array, item) {
39361
+ return array.indexOf(item) !== -1;
39362
+ }
39363
+
39364
+ var ContextPadModule = {
39365
+ __depends__: [
39366
+ DirectEditingModule,
39367
+ ContextPadModule$1,
39368
+ SelectionModule,
39369
+ ConnectModule,
39370
+ CreateModule,
39371
+ PopupMenuModule
39372
+ ],
39373
+ __init__: [ 'contextPadProvider' ],
39374
+ contextPadProvider: [ 'type', ContextPadProvider ]
39375
+ };
39376
+
39377
+ var TOGGLE_SELECTOR = '.djs-palette-toggle',
39378
+ ENTRY_SELECTOR = '.entry',
39379
+ ELEMENT_SELECTOR = TOGGLE_SELECTOR + ', ' + ENTRY_SELECTOR;
39380
+
39381
+ var PALETTE_PREFIX = 'djs-palette-',
39382
+ PALETTE_SHOWN_CLS = 'shown',
39383
+ PALETTE_OPEN_CLS = 'open',
39384
+ PALETTE_TWO_COLUMN_CLS = 'two-column';
39385
+
39386
+ var DEFAULT_PRIORITY$1 = 1000;
39387
+
39388
+
39389
+ /**
39390
+ * A palette containing modeling elements.
39391
+ */
39392
+ function Palette(eventBus, canvas) {
39393
+
39394
+ this._eventBus = eventBus;
39395
+ this._canvas = canvas;
39396
+
39397
+ var self = this;
39398
+
39399
+ eventBus.on('tool-manager.update', function(event) {
39400
+ var tool = event.tool;
39401
+
39402
+ self.updateToolHighlight(tool);
39403
+ });
39404
+
39405
+ eventBus.on('i18n.changed', function() {
39406
+ self._update();
39407
+ });
39408
+
39409
+ eventBus.on('diagram.init', function() {
39410
+
39411
+ self._diagramInitialized = true;
39412
+
39413
+ self._rebuild();
39414
+ });
39415
+ }
39416
+
39417
+ Palette.$inject = [ 'eventBus', 'canvas' ];
39418
+
39419
+
39420
+ /**
39421
+ * Register a provider with the palette
39422
+ *
39423
+ * @param {number} [priority=1000]
39424
+ * @param {PaletteProvider} provider
39425
+ *
39426
+ * @example
39427
+ * const paletteProvider = {
39428
+ * getPaletteEntries: function() {
39429
+ * return function(entries) {
39430
+ * return {
39431
+ * ...entries,
39432
+ * 'entry-1': {
39433
+ * label: 'My Entry',
39434
+ * action: function() { alert("I have been clicked!"); }
39435
+ * }
39436
+ * };
39437
+ * }
39438
+ * }
39439
+ * };
39440
+ *
39441
+ * palette.registerProvider(800, paletteProvider);
39442
+ */
39443
+ Palette.prototype.registerProvider = function(priority, provider) {
39444
+ if (!provider) {
39445
+ provider = priority;
39446
+ priority = DEFAULT_PRIORITY$1;
39447
+ }
39448
+
39449
+ this._eventBus.on('palette.getProviders', priority, function(event) {
39450
+ event.providers.push(provider);
39451
+ });
39452
+
39453
+ this._rebuild();
39454
+ };
39455
+
39456
+
39457
+ /**
39458
+ * Returns the palette entries
39459
+ *
39460
+ * @return {Object<string, PaletteEntryDescriptor>} map of entries
39461
+ */
39462
+ Palette.prototype.getEntries = function() {
39463
+ var providers = this._getProviders();
39464
+
39465
+ return providers.reduce(addPaletteEntries, {});
39466
+ };
39467
+
39468
+ Palette.prototype._rebuild = function() {
39469
+
39470
+ if (!this._diagramInitialized) {
39471
+ return;
39472
+ }
39473
+
39474
+ var providers = this._getProviders();
39475
+
39476
+ if (!providers.length) {
39477
+ return;
39478
+ }
39479
+
39480
+ if (!this._container) {
39481
+ this._init();
39482
+ }
39483
+
39484
+ this._update();
39485
+ };
39486
+
39487
+ /**
39488
+ * Initialize
39489
+ */
39490
+ Palette.prototype._init = function() {
39491
+
39492
+ var self = this;
39493
+
39494
+ var eventBus = this._eventBus;
39495
+
39496
+ var parentContainer = this._getParentContainer();
39497
+
39498
+ var container = this._container = domify$1(Palette.HTML_MARKUP);
39499
+
39500
+ parentContainer.appendChild(container);
39501
+ classes$1(parentContainer).add(PALETTE_PREFIX + PALETTE_SHOWN_CLS);
39502
+
39503
+ delegate.bind(container, ELEMENT_SELECTOR, 'click', function(event) {
39504
+
39505
+ var target = event.delegateTarget;
39506
+
39507
+ if (matches(target, TOGGLE_SELECTOR)) {
39508
+ return self.toggle();
39509
+ }
39510
+
39511
+ self.trigger('click', event);
39512
+ });
39513
+
39514
+ // prevent drag propagation
39515
+ event.bind(container, 'mousedown', function(event) {
39516
+ event.stopPropagation();
39517
+ });
39518
+
39519
+ // prevent drag propagation
39520
+ delegate.bind(container, ENTRY_SELECTOR, 'dragstart', function(event) {
39521
+ self.trigger('dragstart', event);
39522
+ });
39523
+
39524
+ eventBus.on('canvas.resized', this._layoutChanged, this);
39525
+
39526
+ eventBus.fire('palette.create', {
39527
+ container: container
39528
+ });
39529
+ };
39530
+
39531
+ Palette.prototype._getProviders = function(id) {
39532
+
39533
+ var event = this._eventBus.createEvent({
39534
+ type: 'palette.getProviders',
39535
+ providers: []
39536
+ });
39537
+
39538
+ this._eventBus.fire(event);
39539
+
39540
+ return event.providers;
39541
+ };
39542
+
39543
+ /**
39544
+ * Update palette state.
39545
+ *
39546
+ * @param {Object} [state] { open, twoColumn }
39547
+ */
39548
+ Palette.prototype._toggleState = function(state) {
39549
+
39550
+ state = state || {};
39551
+
39552
+ var parent = this._getParentContainer(),
39553
+ container = this._container;
39554
+
39555
+ var eventBus = this._eventBus;
39556
+
39557
+ var twoColumn;
39558
+
39559
+ var cls = classes$1(container),
39560
+ parentCls = classes$1(parent);
39561
+
39562
+ if ('twoColumn' in state) {
39563
+ twoColumn = state.twoColumn;
39564
+ } else {
39565
+ twoColumn = this._needsCollapse(parent.clientHeight, this._entries || {});
39566
+ }
39567
+
39568
+ // always update two column
39569
+ cls.toggle(PALETTE_TWO_COLUMN_CLS, twoColumn);
39570
+ parentCls.toggle(PALETTE_PREFIX + PALETTE_TWO_COLUMN_CLS, twoColumn);
39571
+
39572
+ if ('open' in state) {
39573
+ cls.toggle(PALETTE_OPEN_CLS, state.open);
39574
+ parentCls.toggle(PALETTE_PREFIX + PALETTE_OPEN_CLS, state.open);
39575
+ }
39576
+
39577
+ eventBus.fire('palette.changed', {
39578
+ twoColumn: twoColumn,
39579
+ open: this.isOpen()
39580
+ });
39581
+ };
39582
+
39583
+ Palette.prototype._update = function() {
39584
+
39585
+ var entriesContainer = query('.djs-palette-entries', this._container),
39586
+ entries = this._entries = this.getEntries();
39587
+
39588
+ clear$1(entriesContainer);
39589
+
39590
+ forEach$1(entries, function(entry, id) {
39591
+
39592
+ var grouping = entry.group || 'default';
39593
+
39594
+ var container = query('[data-group=' + cssEscape(grouping) + ']', entriesContainer);
39595
+ if (!container) {
39596
+ container = domify$1('<div class="group"></div>');
39597
+ attr$1(container, 'data-group', grouping);
39598
+
39599
+ entriesContainer.appendChild(container);
39600
+ }
39601
+
39602
+ var html = entry.html || (
39603
+ entry.separator ?
39604
+ '<hr class="separator" />' :
39605
+ '<div class="entry" draggable="true"></div>');
39606
+
39607
+
39608
+ var control = domify$1(html);
39609
+ container.appendChild(control);
39610
+
39611
+ if (!entry.separator) {
39612
+ attr$1(control, 'data-action', id);
39613
+
39614
+ if (entry.title) {
39615
+ attr$1(control, 'title', entry.title);
39616
+ }
39617
+
39618
+ if (entry.className) {
39619
+ addClasses(control, entry.className);
39620
+ }
39621
+
39622
+ if (entry.imageUrl) {
39623
+ var image = domify$1('<img>');
39624
+ attr$1(image, 'src', entry.imageUrl);
39625
+
39626
+ control.appendChild(image);
39627
+ }
39628
+ }
39629
+ });
39630
+
39631
+ // open after update
39632
+ this.open();
39633
+ };
39634
+
39635
+
39636
+ /**
39637
+ * Trigger an action available on the palette
39638
+ *
39639
+ * @param {string} action
39640
+ * @param {Event} event
39641
+ */
39642
+ Palette.prototype.trigger = function(action, event, autoActivate) {
39643
+ var entry,
39644
+ originalEvent,
39645
+ button = event.delegateTarget || event.target;
39646
+
39647
+ if (!button) {
39648
+ return event.preventDefault();
39649
+ }
39650
+
39651
+ entry = attr$1(button, 'data-action');
39652
+ originalEvent = event.originalEvent || event;
39653
+
39654
+ return this.triggerEntry(entry, action, originalEvent, autoActivate);
39655
+ };
39656
+
39657
+ Palette.prototype.triggerEntry = function(entryId, action, event, autoActivate) {
39658
+ var entries = this._entries,
39659
+ entry,
39660
+ handler;
39661
+
39662
+ entry = entries[entryId];
39663
+
39664
+ // when user clicks on the palette and not on an action
39665
+ if (!entry) {
39666
+ return;
39667
+ }
39668
+
39669
+ handler = entry.action;
39670
+
39671
+ // simple action (via callback function)
39672
+ if (isFunction(handler)) {
39673
+ if (action === 'click') {
39674
+ return handler(event, autoActivate);
39675
+ }
39676
+ } else {
39677
+ if (handler[action]) {
39678
+ return handler[action](event, autoActivate);
39679
+ }
39680
+ }
39681
+
39682
+ // silence other actions
39683
+ event.preventDefault();
39684
+ };
39685
+
39686
+ Palette.prototype._layoutChanged = function() {
39687
+ this._toggleState({});
39688
+ };
39689
+
39690
+ /**
39691
+ * Do we need to collapse to two columns?
39692
+ *
39693
+ * @param {number} availableHeight
39694
+ * @param {Object} entries
39695
+ *
39696
+ * @return {boolean}
39697
+ */
39698
+ Palette.prototype._needsCollapse = function(availableHeight, entries) {
39699
+
39700
+ // top margin + bottom toggle + bottom margin
39701
+ // implementors must override this method if they
39702
+ // change the palette styles
39703
+ var margin = 20 + 10 + 20;
39704
+
39705
+ var entriesHeight = Object.keys(entries).length * 46;
39706
+
39707
+ return availableHeight < entriesHeight + margin;
39708
+ };
39709
+
39710
+ /**
39711
+ * Close the palette
39712
+ */
39713
+ Palette.prototype.close = function() {
39714
+
39715
+ this._toggleState({
39716
+ open: false,
39717
+ twoColumn: false
39718
+ });
39719
+ };
39720
+
39721
+
39722
+ /**
39723
+ * Open the palette
39724
+ */
39725
+ Palette.prototype.open = function() {
39726
+ this._toggleState({ open: true });
39727
+ };
39728
+
39729
+
39730
+ Palette.prototype.toggle = function(open) {
39731
+ if (this.isOpen()) {
39732
+ this.close();
39733
+ } else {
39734
+ this.open();
39735
+ }
39736
+ };
39737
+
39738
+ Palette.prototype.isActiveTool = function(tool) {
39739
+ return tool && this._activeTool === tool;
39740
+ };
39741
+
39742
+ Palette.prototype.updateToolHighlight = function(name) {
39743
+ var entriesContainer,
39744
+ toolsContainer;
39745
+
39746
+ if (!this._toolsContainer) {
39747
+ entriesContainer = query('.djs-palette-entries', this._container);
39748
+
39749
+ this._toolsContainer = query('[data-group=tools]', entriesContainer);
39750
+ }
39751
+
39752
+ toolsContainer = this._toolsContainer;
39753
+
39754
+ forEach$1(toolsContainer.children, function(tool) {
39755
+ var actionName = tool.getAttribute('data-action');
39756
+
39757
+ if (!actionName) {
39758
+ return;
39759
+ }
39760
+
39761
+ var toolClasses = classes$1(tool);
39762
+
39763
+ actionName = actionName.replace('-tool', '');
39764
+
39765
+ if (toolClasses.contains('entry') && actionName === name) {
39766
+ toolClasses.add('highlighted-entry');
39767
+ } else {
39768
+ toolClasses.remove('highlighted-entry');
39769
+ }
39770
+ });
39771
+ };
39772
+
39773
+
39774
+ /**
39775
+ * Return true if the palette is opened.
39776
+ *
39777
+ * @example
39778
+ *
39779
+ * palette.open();
39780
+ *
39781
+ * if (palette.isOpen()) {
39782
+ * // yes, we are open
39783
+ * }
39784
+ *
39785
+ * @return {boolean} true if palette is opened
39786
+ */
39787
+ Palette.prototype.isOpen = function() {
39788
+ return classes$1(this._container).has(PALETTE_OPEN_CLS);
39789
+ };
39790
+
39791
+ /**
39792
+ * Get container the palette lives in.
39793
+ *
39794
+ * @return {Element}
39795
+ */
39796
+ Palette.prototype._getParentContainer = function() {
39797
+ return this._canvas.getContainer();
39798
+ };
39799
+
39800
+
39801
+ /* markup definition */
39802
+
39803
+ Palette.HTML_MARKUP =
39804
+ '<div class="djs-palette">' +
39805
+ '<div class="djs-palette-entries"></div>' +
39806
+ '<div class="djs-palette-toggle"></div>' +
39807
+ '</div>';
39808
+
39809
+
39810
+ // helpers //////////////////////
39811
+
39812
+ function addClasses(element, classNames) {
39813
+
39814
+ var classes = classes$1(element);
39815
+
39816
+ var actualClassNames = isArray$3(classNames) ? classNames : classNames.split(/\s+/g);
39817
+ actualClassNames.forEach(function(cls) {
39818
+ classes.add(cls);
39819
+ });
39820
+ }
39821
+
39822
+ function addPaletteEntries(entries, provider) {
39823
+
39824
+ var entriesOrUpdater = provider.getPaletteEntries();
39825
+
39826
+ if (isFunction(entriesOrUpdater)) {
39827
+ return entriesOrUpdater(entries);
39828
+ }
39829
+
39830
+ forEach$1(entriesOrUpdater, function(entry, id) {
39831
+ entries[id] = entry;
39832
+ });
39833
+
39834
+ return entries;
39835
+ }
39836
+
39837
+ var PaletteModule$1 = {
39838
+ __init__: [ 'palette' ],
39839
+ palette: [ 'type', Palette ]
39840
+ };
39841
+
39842
+ var EVENT_GROUP = {
39843
+ id: 'events',
39844
+ name: 'Events'
39845
+ };
39846
+
39847
+ var TASK_GROUP = {
39848
+ id: 'tasks',
39849
+ name: 'Tasks'
39850
+ };
39851
+
39852
+ var DATA_GROUP = {
39853
+ id: 'data',
39854
+ name: 'Data'
39855
+ };
39856
+
39857
+ var PARTICIPANT_GROUP = {
39858
+ id: 'participants',
39859
+ name: 'Participants'
39860
+ };
39861
+
39862
+ var SUBPROCESS_GROUP = {
39863
+ id: 'subprocess',
39864
+ name: 'Sub Processes'
39865
+ };
39866
+
39867
+ var GATEWAY_GROUP = {
39868
+ id: 'gateways',
39869
+ name: 'Gateways'
39870
+ };
39871
+
39872
+ var NONE_EVENTS = [
39873
+ {
39874
+ label: 'Start Event',
39875
+ actionName: 'none-start-event',
39876
+ className: 'bpmn-icon-start-event-none',
39877
+ target: {
39878
+ type: 'bpmn:StartEvent'
39879
+ }
39880
+ },
39881
+ {
39882
+ label: 'Intermediate Throw Event',
39883
+ actionName: 'none-intermediate-throwing',
39884
+ className: 'bpmn-icon-intermediate-event-none',
39885
+ target: {
39886
+ type: 'bpmn:IntermediateThrowEvent'
39887
+ }
39888
+ },
39889
+ {
39890
+ label: 'Boundary Event',
39891
+ actionName: 'none-boundary-event',
39892
+ className: 'bpmn-icon-intermediate-event-none',
39893
+ target: {
39894
+ type: 'bpmn:BoundaryEvent'
39895
+ }
39896
+ },
39897
+ {
39898
+ label: 'End Event',
39899
+ actionName: 'none-end-event',
39900
+ className: 'bpmn-icon-end-event-none',
39901
+ target: {
39902
+ type: 'bpmn:EndEvent'
39903
+ }
39904
+ }
39905
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39906
+
39907
+ var TYPED_START_EVENTS = [
39908
+ {
39909
+ label: 'Message Start Event',
39910
+ actionName: 'message-start',
39911
+ className: 'bpmn-icon-start-event-message',
39912
+ target: {
39913
+ type: 'bpmn:StartEvent',
39914
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39915
+ }
39916
+ },
39917
+ {
39918
+ label: 'Timer Start Event',
39919
+ actionName: 'timer-start',
39920
+ className: 'bpmn-icon-start-event-timer',
39921
+ target: {
39922
+ type: 'bpmn:StartEvent',
39923
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
39924
+ }
39925
+ },
39926
+ {
39927
+ label: 'Conditional Start Event',
39928
+ actionName: 'conditional-start',
39929
+ className: 'bpmn-icon-start-event-condition',
39930
+ target: {
39931
+ type: 'bpmn:StartEvent',
39932
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
39933
+ }
39934
+ },
39935
+ {
39936
+ label: 'Signal Start Event',
39937
+ actionName: 'signal-start',
39938
+ className: 'bpmn-icon-start-event-signal',
39939
+ target: {
39940
+ type: 'bpmn:StartEvent',
39941
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39942
+ }
39943
+ }
39944
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39945
+
39946
+ var TYPED_INTERMEDIATE_EVENT = [
39947
+ {
39948
+ label: 'Message Intermediate Catch Event',
39949
+ actionName: 'message-intermediate-catch',
39950
+ className: 'bpmn-icon-intermediate-event-catch-message',
39951
+ target: {
39952
+ type: 'bpmn:IntermediateCatchEvent',
39953
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39954
+ }
39955
+ },
39956
+ {
39957
+ label: 'Message Intermediate Throw Event',
39958
+ actionName: 'message-intermediate-throw',
39959
+ className: 'bpmn-icon-intermediate-event-throw-message',
39960
+ target: {
39961
+ type: 'bpmn:IntermediateThrowEvent',
39962
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39963
+ }
39964
+ },
39965
+ {
39966
+ label: 'Timer Intermediate Catch Event',
39967
+ actionName: 'timer-intermediate-catch',
39968
+ className: 'bpmn-icon-intermediate-event-catch-timer',
39969
+ target: {
39970
+ type: 'bpmn:IntermediateCatchEvent',
39971
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
39972
+ }
39973
+ },
39974
+ {
39975
+ label: 'Escalation Intermediate Throw Event',
39976
+ actionName: 'escalation-intermediate-throw',
39977
+ className: 'bpmn-icon-intermediate-event-throw-escalation',
39978
+ target: {
39979
+ type: 'bpmn:IntermediateThrowEvent',
39980
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
39981
+ }
39982
+ },
39983
+ {
39984
+ label: 'Conditional Intermediate Catch Event',
39985
+ actionName: 'conditional-intermediate-catch',
39986
+ className: 'bpmn-icon-intermediate-event-catch-condition',
39987
+ target: {
39988
+ type: 'bpmn:IntermediateCatchEvent',
39989
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
39990
+ }
39991
+ },
39992
+ {
39993
+ label: 'Link Intermediate Catch Event',
39994
+ actionName: 'link-intermediate-catch',
39995
+ className: 'bpmn-icon-intermediate-event-catch-link',
39996
+ target: {
39997
+ type: 'bpmn:IntermediateCatchEvent',
39998
+ eventDefinitionType: 'bpmn:LinkEventDefinition',
39999
+ eventDefinitionAttrs: {
40000
+ name: ''
40001
+ }
40002
+ }
40003
+ },
40004
+ {
40005
+ label: 'Link Intermediate Throw Event',
40006
+ actionName: 'link-intermediate-throw',
40007
+ className: 'bpmn-icon-intermediate-event-throw-link',
40008
+ target: {
40009
+ type: 'bpmn:IntermediateThrowEvent',
40010
+ eventDefinitionType: 'bpmn:LinkEventDefinition',
40011
+ eventDefinitionAttrs: {
40012
+ name: ''
40013
+ }
40014
+ }
40015
+ },
40016
+ {
40017
+ label: 'Compensation Intermediate Throw Event',
40018
+ actionName: 'compensation-intermediate-throw',
40019
+ className: 'bpmn-icon-intermediate-event-throw-compensation',
40020
+ target: {
40021
+ type: 'bpmn:IntermediateThrowEvent',
40022
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
40023
+ }
40024
+ },
40025
+ {
40026
+ label: 'Signal Intermediate Catch Event',
40027
+ actionName: 'signal-intermediate-catch',
40028
+ className: 'bpmn-icon-intermediate-event-catch-signal',
40029
+ target: {
40030
+ type: 'bpmn:IntermediateCatchEvent',
40031
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
40032
+ }
40033
+ },
40034
+ {
40035
+ label: 'Signal Intermediate Throw Event',
40036
+ actionName: 'signal-intermediate-throw',
40037
+ className: 'bpmn-icon-intermediate-event-throw-signal',
40038
+ target: {
40039
+ type: 'bpmn:IntermediateThrowEvent',
40040
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
40041
+ }
40042
+ }
40043
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
40044
+
40045
+ var TYPED_BOUNDARY_EVENT = [
40046
+ {
40047
+ label: 'Message Boundary Event',
40048
+ actionName: 'message-boundary',
40049
+ className: 'bpmn-icon-intermediate-event-catch-message',
40050
+ target: {
40051
+ type: 'bpmn:BoundaryEvent',
40052
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
40053
+ }
40054
+ },
40055
+ {
40056
+ label: 'Timer Boundary Event',
40057
+ actionName: 'timer-boundary',
40058
+ className: 'bpmn-icon-intermediate-event-catch-timer',
40059
+ target: {
40060
+ type: 'bpmn:BoundaryEvent',
40061
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
40062
+ }
40063
+ },
40064
+ {
40065
+ label: 'Escalation Boundary Event',
40066
+ actionName: 'escalation-boundary',
40067
+ className: 'bpmn-icon-intermediate-event-catch-escalation',
40068
+ target: {
40069
+ type: 'bpmn:BoundaryEvent',
40070
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
40071
+ }
40072
+ },
40073
+ {
40074
+ label: 'Conditional Boundary Event',
40075
+ actionName: 'conditional-boundary',
40076
+ className: 'bpmn-icon-intermediate-event-catch-condition',
40077
+ target: {
40078
+ type: 'bpmn:BoundaryEvent',
40079
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
40080
+ }
40081
+ },
40082
+ {
40083
+ label: 'Error Boundary Event',
40084
+ actionName: 'error-boundary',
40085
+ className: 'bpmn-icon-intermediate-event-catch-error',
40086
+ target: {
40087
+ type: 'bpmn:BoundaryEvent',
40088
+ eventDefinitionType: 'bpmn:ErrorEventDefinition'
40089
+ }
40090
+ },
40091
+ {
40092
+ label: 'Cancel Boundary Event',
40093
+ actionName: 'cancel-boundary',
40094
+ className: 'bpmn-icon-intermediate-event-catch-cancel',
40095
+ target: {
40096
+ type: 'bpmn:BoundaryEvent',
40097
+ eventDefinitionType: 'bpmn:CancelEventDefinition'
40098
+ }
40099
+ },
40100
+ {
40101
+ label: 'Signal Boundary Event',
40102
+ actionName: 'signal-boundary',
40103
+ className: 'bpmn-icon-intermediate-event-catch-signal',
40104
+ target: {
40105
+ type: 'bpmn:BoundaryEvent',
40106
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
40107
+ }
40108
+ },
40109
+ {
40110
+ label: 'Compensation Boundary Event',
40111
+ actionName: 'compensation-boundary',
40112
+ className: 'bpmn-icon-intermediate-event-catch-compensation',
40113
+ target: {
40114
+ type: 'bpmn:BoundaryEvent',
40115
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
40116
+ }
40117
+ },
40118
+ {
40119
+ label: 'Message Boundary Event (non-interrupting)',
40120
+ actionName: 'non-interrupting-message-boundary',
40121
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-message',
40122
+ target: {
40123
+ type: 'bpmn:BoundaryEvent',
40124
+ eventDefinitionType: 'bpmn:MessageEventDefinition',
40125
+ cancelActivity: false
40126
+ }
40127
+ },
40128
+ {
40129
+ label: 'Timer Boundary Event (non-interrupting)',
40130
+ actionName: 'non-interrupting-timer-boundary',
40131
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-timer',
40132
+ target: {
40133
+ type: 'bpmn:BoundaryEvent',
40134
+ eventDefinitionType: 'bpmn:TimerEventDefinition',
40135
+ cancelActivity: false
40136
+ }
40137
+ },
40138
+ {
40139
+ label: 'Escalation Boundary Event (non-interrupting)',
40140
+ actionName: 'non-interrupting-escalation-boundary',
40141
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-escalation',
40142
+ target: {
40143
+ type: 'bpmn:BoundaryEvent',
40144
+ eventDefinitionType: 'bpmn:EscalationEventDefinition',
40145
+ cancelActivity: false
40146
+ }
40147
+ },
40148
+ {
40149
+ label: 'Conditional Boundary Event (non-interrupting)',
40150
+ actionName: 'non-interrupting-conditional-boundary',
40151
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-condition',
40152
+ target: {
40153
+ type: 'bpmn:BoundaryEvent',
40154
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition',
40155
+ cancelActivity: false
40156
+ }
40157
+ },
40158
+ {
40159
+ label: 'Signal Boundary Event (non-interrupting)',
40160
+ actionName: 'non-interrupting-signal-boundary',
40161
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-signal',
40162
+ target: {
40163
+ type: 'bpmn:BoundaryEvent',
40164
+ eventDefinitionType: 'bpmn:SignalEventDefinition',
40165
+ cancelActivity: false
40166
+ }
40167
+ }
40168
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
40169
+
40170
+ var TYPED_END_EVENT = [
40171
+ {
40172
+ label: 'Message End Event',
40173
+ actionName: 'message-end',
40174
+ className: 'bpmn-icon-end-event-message',
40175
+ target: {
40176
+ type: 'bpmn:EndEvent',
40177
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
40178
+ }
40179
+ },
40180
+ {
40181
+ label: 'Escalation End Event',
40182
+ actionName: 'escalation-end',
40183
+ className: 'bpmn-icon-end-event-escalation',
40184
+ target: {
40185
+ type: 'bpmn:EndEvent',
40186
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
40187
+ }
40188
+ },
40189
+ {
40190
+ label: 'Error End Event',
40191
+ actionName: 'error-end',
40192
+ className: 'bpmn-icon-end-event-error',
40193
+ target: {
40194
+ type: 'bpmn:EndEvent',
40195
+ eventDefinitionType: 'bpmn:ErrorEventDefinition'
40196
+ }
40197
+ },
40198
+ {
40199
+ label: 'Cancel End Event',
40200
+ actionName: 'cancel-end',
40201
+ className: 'bpmn-icon-end-event-cancel',
40202
+ target: {
40203
+ type: 'bpmn:EndEvent',
40204
+ eventDefinitionType: 'bpmn:CancelEventDefinition'
40205
+ }
40206
+ },
40207
+ {
40208
+ label: 'Compensation End Event',
40209
+ actionName: 'compensation-end',
40210
+ className: 'bpmn-icon-end-event-compensation',
40211
+ target: {
40212
+ type: 'bpmn:EndEvent',
40213
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
40214
+ }
40215
+ },
40216
+ {
40217
+ label: 'Signal End Event',
40218
+ actionName: 'signal-end',
40219
+ className: 'bpmn-icon-end-event-signal',
40220
+ target: {
40221
+ type: 'bpmn:EndEvent',
40222
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
40223
+ }
40224
+ },
40225
+ {
40226
+ label: 'Terminate End Event',
40227
+ actionName: 'terminate-end',
40228
+ className: 'bpmn-icon-end-event-terminate',
40229
+ target: {
40230
+ type: 'bpmn:EndEvent',
40231
+ eventDefinitionType: 'bpmn:TerminateEventDefinition'
40232
+ }
40233
+ }
40234
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
40235
+
40236
+ var GATEWAY = [
40237
+ {
40238
+ label: 'Exclusive Gateway',
40239
+ actionName: 'exclusive-gateway',
40240
+ className: 'bpmn-icon-gateway-xor',
40241
+ target: {
40242
+ type: 'bpmn:ExclusiveGateway'
40243
+ }
40244
+ },
40245
+ {
40246
+ label: 'Parallel Gateway',
40247
+ actionName: 'parallel-gateway',
40248
+ className: 'bpmn-icon-gateway-parallel',
40249
+ target: {
40250
+ type: 'bpmn:ParallelGateway'
40251
+ }
40252
+ },
40253
+ {
40254
+ label: 'Inclusive Gateway',
40255
+ search: 'or',
40256
+ actionName: 'inclusive-gateway',
40257
+ className: 'bpmn-icon-gateway-or',
40258
+ target: {
40259
+ type: 'bpmn:InclusiveGateway'
40260
+ },
40261
+ rank: -1
40262
+ },
40263
+ {
40264
+ label: 'Complex Gateway',
40265
+ actionName: 'complex-gateway',
40266
+ className: 'bpmn-icon-gateway-complex',
40267
+ target: {
40268
+ type: 'bpmn:ComplexGateway'
40269
+ },
40270
+ rank: -1
40271
+ },
40272
+ {
40273
+ label: 'Event based Gateway',
40274
+ actionName: 'event-based-gateway',
40275
+ className: 'bpmn-icon-gateway-eventbased',
40276
+ target: {
40277
+ type: 'bpmn:EventBasedGateway',
40278
+ instantiate: false,
40279
+ eventGatewayType: 'Exclusive'
40280
+ }
40281
+ }
40282
+ ].map(option => ({ ...option, group: GATEWAY_GROUP }));
40283
+
40284
+ var SUBPROCESS = [
40285
+ {
40286
+ label: 'Transaction',
40287
+ actionName: 'transaction',
40288
+ className: 'bpmn-icon-transaction',
40289
+ target: {
40290
+ type: 'bpmn:Transaction',
40291
+ isExpanded: true
40292
+ }
40293
+ },
40294
+ {
40295
+ label: 'Event Sub Process',
40296
+ search: 'subprocess',
40297
+ actionName: 'event-subprocess',
40298
+ className: 'bpmn-icon-event-subprocess-expanded',
40299
+ target: {
40300
+ type: 'bpmn:SubProcess',
40301
+ triggeredByEvent: true,
40302
+ isExpanded: true
40303
+ }
40304
+ },
40305
+ {
40306
+ label: 'Sub Process (collapsed)',
40307
+ search: 'subprocess',
40308
+ actionName: 'collapsed-subprocess',
40309
+ className: 'bpmn-icon-subprocess-collapsed',
40310
+ target: {
40311
+ type: 'bpmn:SubProcess',
40312
+ isExpanded: false
40313
+ }
40314
+ },
40315
+ {
40316
+ label: 'Sub Process (expanded)',
40317
+ search: 'subprocess',
40318
+ actionName: 'expanded-subprocess',
40319
+ className: 'bpmn-icon-subprocess-collapsed',
40320
+ target: {
40321
+ type: 'bpmn:SubProcess',
40322
+ isExpanded: true
40323
+ }
40324
+ }
40325
+ ].map(option => ({ ...option, group: SUBPROCESS_GROUP }));
40326
+
40327
+ var TASK = [
40328
+ {
40329
+ label: 'Task',
40330
+ actionName: 'task',
40331
+ className: 'bpmn-icon-task',
40332
+ target: {
40333
+ type: 'bpmn:Task'
40334
+ }
40335
+ },
40336
+ {
40337
+ label: 'User Task',
40338
+ actionName: 'user-task',
40339
+ className: 'bpmn-icon-user',
40340
+ target: {
40341
+ type: 'bpmn:UserTask'
40342
+ }
40343
+ },
40344
+ {
40345
+ label: 'Service Task',
40346
+ actionName: 'service-task',
40347
+ className: 'bpmn-icon-service',
40348
+ target: {
40349
+ type: 'bpmn:ServiceTask'
40350
+ }
40351
+ },
40352
+ {
40353
+ label: 'Send Task',
40354
+ actionName: 'send-task',
40355
+ className: 'bpmn-icon-send',
40356
+ target: {
40357
+ type: 'bpmn:SendTask'
40358
+ },
40359
+ rank: -1
40360
+ },
40361
+ {
40362
+ label: 'Receive Task',
40363
+ actionName: 'receive-task',
40364
+ className: 'bpmn-icon-receive',
40365
+ target: {
40366
+ type: 'bpmn:ReceiveTask'
40367
+ },
40368
+ rank: -1
40369
+ },
40370
+ {
40371
+ label: 'Manual Task',
40372
+ actionName: 'manual-task',
40373
+ className: 'bpmn-icon-manual',
40374
+ target: {
40375
+ type: 'bpmn:ManualTask'
40376
+ },
40377
+ rank: -1
40378
+ },
40379
+ {
40380
+ label: 'Business Rule Task',
40381
+ actionName: 'rule-task',
40382
+ className: 'bpmn-icon-business-rule',
40383
+ target: {
40384
+ type: 'bpmn:BusinessRuleTask'
40385
+ }
40386
+ },
40387
+ {
40388
+ label: 'Script Task',
40389
+ actionName: 'script-task',
40390
+ className: 'bpmn-icon-script',
40391
+ target: {
40392
+ type: 'bpmn:ScriptTask'
40393
+ }
40394
+ },
40395
+ {
40396
+ label: 'Call Activity',
40397
+ actionName: 'call-activity',
40398
+ className: 'bpmn-icon-call-activity',
40399
+ target: {
40400
+ type: 'bpmn:CallActivity'
40401
+ }
40402
+ }
40403
+ ].map(option => ({ ...option, group: TASK_GROUP }));
40404
+
40405
+ var DATA_OBJECTS = [
40406
+ {
40407
+ label: 'Data Store Reference',
40408
+ actionName: 'data-store-reference',
40409
+ className: 'bpmn-icon-data-store',
40410
+ target: {
40411
+ type: 'bpmn:DataStoreReference'
40412
+ }
40413
+ },
40414
+ {
40415
+ label: 'Data Object Reference',
40416
+ actionName: 'data-object-reference',
40417
+ className: 'bpmn-icon-data-object',
40418
+ target: {
40419
+ type: 'bpmn:DataObjectReference'
40420
+ }
40421
+ }
40422
+ ].map(option => ({ ...option, group: DATA_GROUP }));
40423
+
40424
+ var PARTICIPANT = [
40425
+ {
40426
+ label: 'Expanded Pool',
40427
+ search: 'Participant',
40428
+ actionName: 'expanded-pool',
40429
+ className: 'bpmn-icon-participant',
40430
+ target: {
40431
+ type: 'bpmn:Participant',
40432
+ isExpanded: true
40433
+ }
40434
+ },
40435
+ {
40436
+ label: 'Empty Pool',
40437
+ search: 'Collapsed Participant',
40438
+ actionName: 'collapsed-pool',
40439
+ className: 'bpmn-icon-lane',
40440
+ target: {
40441
+ type: 'bpmn:Participant',
40442
+ isExpanded: false
40443
+ }
40444
+ }
40445
+ ].map(option => ({ ...option, group: PARTICIPANT_GROUP }));
40446
+
40447
+ var CREATE_OPTIONS = [
40448
+ ...GATEWAY,
40449
+ ...TASK,
40450
+ ...SUBPROCESS,
40451
+ ...NONE_EVENTS,
40452
+ ...TYPED_START_EVENTS,
40453
+ ...TYPED_INTERMEDIATE_EVENT,
40454
+ ...TYPED_END_EVENT,
40455
+ ...TYPED_BOUNDARY_EVENT,
40456
+ ...DATA_OBJECTS,
40457
+ ...PARTICIPANT
40458
+ ];
40459
+
40460
+ /**
40461
+ * This module is a create menu provider for the popup menu.
40462
+ */
40463
+ function CreateMenuProvider(
40464
+ elementFactory, popupMenu, create,
40465
+ autoPlace, mouse, translate
40466
+ ) {
40467
+ this._elementFactory = elementFactory;
40468
+ this._popupMenu = popupMenu;
40469
+ this._create = create;
40470
+ this._autoPlace = autoPlace;
40471
+ this._mouse = mouse;
40472
+ this._translate = translate;
40473
+
40474
+ this.register();
40475
+ }
40476
+
40477
+ CreateMenuProvider.$inject = [
40478
+ 'elementFactory',
40479
+ 'popupMenu',
40480
+ 'create',
40481
+ 'autoPlace',
40482
+ 'mouse',
40483
+ 'translate'
40484
+ ];
40485
+
40486
+ /**
40487
+ * Register create menu provider in the popup menu
40488
+ */
40489
+ CreateMenuProvider.prototype.register = function() {
40490
+ this._popupMenu.registerProvider('bpmn-create', this);
40491
+ };
40492
+
40493
+ /**
40494
+ * Get all entries
40495
+ *
40496
+ * @param {djs.model.Base} element
40497
+ *
40498
+ * @return {Array<Object>} a list of menu entry items
40499
+ */
40500
+ CreateMenuProvider.prototype.getPopupMenuEntries = function() {
40501
+
40502
+ const entries = {};
40503
+
40504
+ // map options to menu entries
40505
+ CREATE_OPTIONS.forEach(option => {
40506
+ const {
40507
+ actionName,
40508
+ className,
40509
+ label,
40510
+ target,
40511
+ description,
40512
+ group,
40513
+ search,
40514
+ rank
40515
+ } = option;
40516
+
40517
+ const targetAction = this._createEntryAction(target);
40518
+
40519
+ entries[`create-${actionName}`] = {
40520
+ label: label && this._translate(label),
40521
+ className,
40522
+ description,
40523
+ group: group && {
40524
+ ...group,
40525
+ name: this._translate(group.name)
40526
+ },
40527
+ search,
40528
+ rank,
40529
+ action: {
40530
+ click: targetAction,
40531
+ dragstart: targetAction
40532
+ }
40533
+ };
40534
+ });
40535
+
40536
+ return entries;
40537
+ };
40538
+
40539
+ /**
40540
+ * Create an action for a given target
40541
+ *
40542
+ * @param {Object} target
40543
+ * @returns {Object}
40544
+ */
40545
+ CreateMenuProvider.prototype._createEntryAction = function(target) {
40546
+
40547
+ const create = this._create;
40548
+ const mouse = this._mouse;
40549
+ const popupMenu = this._popupMenu;
40550
+ const elementFactory = this._elementFactory;
40551
+
40552
+ let newElement;
40553
+
40554
+ return (event) => {
40555
+ popupMenu.close();
40556
+
40557
+ // create the new element
40558
+ if (target.type === 'bpmn:Participant') {
40559
+ newElement = elementFactory.createParticipantShape(target);
40560
+ } else {
40561
+ newElement = elementFactory.create('shape', target);
40562
+ }
40563
+
40564
+ // use last mouse event if triggered via keyboard
40565
+ if (event instanceof KeyboardEvent) {
40566
+ event = mouse.getLastMoveEvent();
40567
+ }
40568
+
40569
+ return create.start(event, newElement);
40570
+ };
40571
+ };
40572
+
40573
+ /**
40574
+ * To change the icons, modify the SVGs in `./resources`, execute `npx svgo -f resources --datauri enc -o dist`,
40575
+ * and then replace respective icons with the optimized data URIs in `./dist`.
40576
+ */
40577
+ const appendIcon = 'data:image/svg+xml,%3Csvg%20width%3D%2222%22%20height%3D%2222%22%20viewBox%3D%220%200%205.82%205.82%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%3Cpath%20d%3D%22M1.3%203.4c.3%200%20.5-.2.5-.5s-.2-.4-.5-.4c-.2%200-.4.1-.4.4%200%20.3.2.5.4.5zM3%203.4c.2%200%20.4-.2.4-.5s-.2-.4-.4-.4c-.3%200-.5.1-.5.4%200%20.3.2.5.5.5zM4.6%203.4c.2%200%20.4-.2.4-.5s-.2-.4-.4-.4c-.3%200-.5.1-.5.4%200%20.3.2.5.5.5z%22%2F%3E%0A%3C%2Fsvg%3E';
40578
+ const createIcon = 'data:image/svg+xml,%3Csvg%20width%3D%2246%22%20height%3D%2246%22%20viewBox%3D%22-2%20-2%209.82%209.82%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M1.3%203.4c.3%200%20.5-.2.5-.5s-.2-.4-.5-.4c-.2%200-.4.1-.4.4%200%20.3.2.5.4.5zM3%203.4c.2%200%20.4-.2.4-.5s-.2-.4-.4-.4c-.3%200-.5.1-.5.4%200%20.3.2.5.5.5zM4.6%203.4c.2%200%20.4-.2.4-.5s-.2-.4-.4-.4c-.3%200-.5.1-.5.4%200%20.3.2.5.5.5z%22%2F%3E%0A%3C%2Fsvg%3E';
40579
+
40580
+ /**
40581
+ * A palette provider for the create elements menu.
40582
+ */
40583
+ function CreatePaletteProvider(palette, translate, popupMenu, canvas, mouse) {
40584
+ this._translate = translate;
40585
+ this._popupMenu = popupMenu;
40586
+ this._canvas = canvas;
40587
+ this._mouse = mouse;
40588
+
40589
+ palette.registerProvider(this);
40590
+ }
40591
+
40592
+ CreatePaletteProvider.$inject = [
40593
+ 'palette',
40594
+ 'translate',
40595
+ 'popupMenu',
40596
+ 'canvas',
40597
+ 'mouse'
40598
+ ];
40599
+
40600
+
40601
+ CreatePaletteProvider.prototype.getPaletteEntries = function(element) {
40602
+ const actions = {},
40603
+ translate = this._translate,
40604
+ popupMenu = this._popupMenu,
40605
+ canvas = this._canvas,
40606
+ mouse = this._mouse;
40607
+
40608
+ const getPosition = (event) => {
40609
+ const X_OFFSET = 35;
40610
+ const Y_OFFSET = 10;
40611
+
40612
+ if (event instanceof KeyboardEvent) {
40613
+ event = mouse.getLastMoveEvent();
40614
+ return { x: event.x, y: event.y };
40615
+ }
40616
+
40617
+ const target = event && event.target || query('.djs-palette [data-action="create"]');
40618
+ const targetPosition = target.getBoundingClientRect();
40619
+
40620
+ return target && {
40621
+ x: targetPosition.left + targetPosition.width / 2 + X_OFFSET,
40622
+ y: targetPosition.top + targetPosition.height / 2 + Y_OFFSET
40623
+ };
40624
+ };
40625
+
40626
+ assign$1(actions, {
40627
+ 'create': {
40628
+ group: 'create',
40629
+ imageUrl: createIcon,
40630
+ title: translate('Create element'),
40631
+ action: {
40632
+ click: function(event) {
40633
+ const position = getPosition(event);
40634
+
40635
+ const element = canvas.getRootElement();
40636
+
40637
+ popupMenu.open(element, 'bpmn-create', position, {
40638
+ title: translate('Create element'),
40639
+ width: 300,
40640
+ search: true
40641
+ });
40642
+ }
40643
+ }
40644
+ },
40645
+ });
40646
+
40647
+ return actions;
40648
+ };
40649
+
40650
+ /**
40651
+ * Registers and executes BPMN specific editor actions.
40652
+ *
40653
+ * @param {Injector} injector
40654
+ */
40655
+ function CreateAppendEditorActions(injector) {
40656
+ this._injector = injector;
40657
+
40658
+ this.registerActions();
40659
+ }
40660
+
40661
+ CreateAppendEditorActions.$inject = [
40662
+ 'injector'
40663
+ ];
40664
+
40665
+ /**
40666
+ * Register actions.
40667
+ *
40668
+ * @param {Injector} injector
40669
+ */
40670
+ CreateAppendEditorActions.prototype.registerActions = function() {
40671
+ var editorActions = this._injector.get('editorActions', false);
40672
+ var selection = this._injector.get('selection', false);
40673
+ var contextPad = this._injector.get('contextPad', false);
40674
+ var palette = this._injector.get('palette', false);
40675
+
40676
+ const actions = {};
40677
+
40678
+ // append
40679
+ if (selection && contextPad) {
40680
+ assign$1(actions, {
40681
+ 'appendElement': function(event) {
40682
+ contextPad.triggerEntry('append', 'click', event);
40683
+ } }
40684
+ );
40685
+ }
40686
+
40687
+ // create
40688
+ if (palette) {
40689
+ assign$1(actions, {
40690
+ 'createElement': function(event) {
40691
+ palette.triggerEntry('create', 'click', event);
40692
+ } }
40693
+ );
40694
+ }
40695
+
40696
+ editorActions && editorActions.register(actions);
40697
+
38859
40698
  };
38860
40699
 
38861
40700
  /**
38862
- * @param {djs.model.Base[]} elements
38863
- * @return {boolean}
40701
+ * BPMN 2.0 specific keyboard bindings.
40702
+ *
40703
+ * @param {Injector} injector
38864
40704
  */
38865
- ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
40705
+ function CreateAppendKeyboardBindings(injector) {
38866
40706
 
38867
- var baseAllowed = this._rules.allowed('elements.delete', {
38868
- elements: elements
38869
- });
40707
+ this._injector = injector;
40708
+ this._keyboard = this._injector.get('keyboard', false);
40709
+ this._editorActions = this._injector.get('editorActions', false);
40710
+ this._selection = this._injector.get('selection', false);
38870
40711
 
38871
- if (isArray$3(baseAllowed)) {
38872
- return every(baseAllowed, function(element) {
38873
- return includes$7(baseAllowed, element);
38874
- });
40712
+ if (this._keyboard) {
40713
+ this._injector.invoke(KeyboardBindings, this);
38875
40714
  }
40715
+ }
38876
40716
 
38877
- return baseAllowed;
38878
- };
40717
+ e$6(CreateAppendKeyboardBindings, KeyboardBindings);
38879
40718
 
38880
- ContextPadProvider.prototype.getContextPadEntries = function(element) {
38881
- var contextPad = this._contextPad,
38882
- modeling = this._modeling,
40719
+ CreateAppendKeyboardBindings.$inject = [
40720
+ 'injector'
40721
+ ];
38883
40722
 
38884
- elementFactory = this._elementFactory,
38885
- connect = this._connect,
38886
- create = this._create,
38887
- popupMenu = this._popupMenu,
38888
- rules = this._rules,
38889
- autoPlace = this._autoPlace,
38890
- translate = this._translate;
38891
40723
 
38892
- var actions = {};
40724
+ /**
40725
+ * Register available keyboard bindings.
40726
+ *
40727
+ * @param {Keyboard} keyboard
40728
+ * @param {EditorActions} editorActions
40729
+ */
40730
+ CreateAppendKeyboardBindings.prototype.registerBindings = function() {
38893
40731
 
38894
- if (element.type === 'label') {
38895
- return actions;
38896
- }
40732
+ var keyboard = this._keyboard;
40733
+ var editorActions = this._editorActions;
40734
+ var selection = this._selection;
38897
40735
 
38898
- var businessObject = element.businessObject;
40736
+ // inherit default bindings
40737
+ KeyboardBindings.prototype.registerBindings.call(this, keyboard, editorActions);
38899
40738
 
38900
- function startConnect(event, element) {
38901
- connect.start(event, element);
38902
- }
40739
+ /**
40740
+ * Add keyboard binding if respective editor action
40741
+ * is registered.
40742
+ *
40743
+ * @param {string} action name
40744
+ * @param {Function} fn that implements the key binding
40745
+ */
40746
+ function addListener(action, fn) {
38903
40747
 
38904
- function removeElement(e, element) {
38905
- modeling.removeElements([ element ]);
40748
+ if (editorActions && editorActions.isRegistered(action)) {
40749
+ keyboard && keyboard.addListener(fn);
40750
+ }
38906
40751
  }
38907
40752
 
38908
- function getReplaceMenuPosition(element) {
40753
+ // activate append/create element
40754
+ // A
40755
+ addListener('appendElement', function(context) {
38909
40756
 
38910
- var Y_OFFSET = 5;
40757
+ var event = context.keyEvent;
38911
40758
 
38912
- var pad = contextPad.getPad(element).html;
40759
+ if (keyboard && keyboard.hasModifier(event)) {
40760
+ return;
40761
+ }
38913
40762
 
38914
- var padRect = pad.getBoundingClientRect();
40763
+ if (keyboard && keyboard.isKey([ 'a', 'A' ], event)) {
38915
40764
 
38916
- var pos = {
38917
- x: padRect.left,
38918
- y: padRect.bottom + Y_OFFSET
38919
- };
40765
+ if (selection && selection.get().length == 1) {
40766
+ editorActions && editorActions.trigger('appendElement', event);
40767
+ } else {
40768
+ editorActions && editorActions.trigger('createElement', event);
40769
+ }
38920
40770
 
38921
- return pos;
38922
- }
40771
+ return true;
40772
+ }
40773
+ });
38923
40774
 
40775
+ // N
40776
+ addListener('createElement', function(context) {
38924
40777
 
38925
- /**
38926
- * Create an append action
38927
- *
38928
- * @param {string} type
38929
- * @param {string} className
38930
- * @param {string} [title]
38931
- * @param {Object} [options]
38932
- *
38933
- * @return {Object} descriptor
38934
- */
38935
- function appendAction(type, className, title, options) {
40778
+ var event = context.keyEvent;
38936
40779
 
38937
- if (typeof title !== 'string') {
38938
- options = title;
38939
- title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') });
40780
+ if (keyboard && keyboard.hasModifier(event)) {
40781
+ return;
38940
40782
  }
38941
40783
 
38942
- function appendStart(event, element) {
40784
+ if (keyboard && keyboard.isKey([ 'n', 'N' ], event)) {
40785
+ editorActions && editorActions.trigger('createElement', event);
38943
40786
 
38944
- var shape = elementFactory.createShape(assign$1({ type: type }, options));
38945
- create.start(event, shape, {
38946
- source: element
38947
- });
40787
+ return true;
38948
40788
  }
40789
+ });
38949
40790
 
40791
+ };
38950
40792
 
38951
- var append = autoPlace ? function(event, element) {
38952
- var shape = elementFactory.createShape(assign$1({ type: type }, options));
40793
+ /**
40794
+ * This module is an append menu provider for the popup menu.
40795
+ */
40796
+ function AppendMenuProvider(
40797
+ elementFactory,
40798
+ popupMenu,
40799
+ create,
40800
+ autoPlace,
40801
+ rules,
40802
+ mouse
40803
+ ) {
40804
+ this._elementFactory = elementFactory;
40805
+ this._popupMenu = popupMenu;
40806
+ this._create = create;
40807
+ this._autoPlace = autoPlace;
40808
+ this._rules = rules;
40809
+ this._create = create;
40810
+ this._mouse = mouse;
38953
40811
 
38954
- autoPlace.append(element, shape);
38955
- } : appendStart;
40812
+ this.register();
40813
+ }
40814
+
40815
+ AppendMenuProvider.$inject = [
40816
+ 'elementFactory',
40817
+ 'popupMenu',
40818
+ 'create',
40819
+ 'autoPlace',
40820
+ 'rules',
40821
+ 'mouse'
40822
+ ];
38956
40823
 
40824
+ /**
40825
+ * Register append menu provider in the popup menu
40826
+ */
40827
+ AppendMenuProvider.prototype.register = function() {
40828
+ this._popupMenu.registerProvider('bpmn-append', this);
40829
+ };
38957
40830
 
38958
- return {
38959
- group: 'model',
38960
- className: className,
38961
- title: title,
38962
- action: {
38963
- dragstart: appendStart,
38964
- click: append
38965
- }
38966
- };
40831
+ /**
40832
+ * Get all entries from createOptions for the given element.
40833
+ *
40834
+ * @param {djs.model.Base} element
40835
+ *
40836
+ * @return {Array<Object>} a list of menu entry items
40837
+ */
40838
+ AppendMenuProvider.prototype.getPopupMenuEntries = function(element) {
40839
+ const rules = this._rules;
40840
+ const entries = {};
40841
+
40842
+ if (!rules.allowed('shape.append', { element: element })) {
40843
+ return [];
38967
40844
  }
38968
40845
 
38969
- function splitLaneHandler(count) {
40846
+ // filter out elements with no incoming connections
40847
+ const appendOptions = this._filterEntries(CREATE_OPTIONS);
38970
40848
 
38971
- return function(event, element) {
40849
+ // map options to menu entries
40850
+ appendOptions.forEach(option => {
40851
+ const {
40852
+ actionName,
40853
+ className,
40854
+ label,
40855
+ target,
40856
+ description,
40857
+ group,
40858
+ search,
40859
+ rank
40860
+ } = option;
40861
+
40862
+ entries[`append-${actionName}`] = {
40863
+ label,
40864
+ className,
40865
+ description,
40866
+ group,
40867
+ search,
40868
+ rank,
40869
+ action: this._createEntryAction(element, target)
40870
+ };
40871
+ });
38972
40872
 
38973
- // actual split
38974
- modeling.splitLane(element, count);
40873
+ return entries;
40874
+ };
38975
40875
 
38976
- // refresh context pad after split to
38977
- // get rid of split icons
38978
- contextPad.open(element, true);
38979
- };
38980
- }
40876
+ /**
40877
+ * Filter out entries from the options.
40878
+ *
40879
+ * @param {Array<Object>} entries
40880
+ *
40881
+ * @return {Array<Object>} filtered entries
40882
+ */
40883
+ AppendMenuProvider.prototype._filterEntries = function(entries) {
40884
+ return entries.filter(option => {
38981
40885
 
40886
+ const target = option.target;
40887
+ const {
40888
+ type,
40889
+ eventDefinitionType
40890
+ } = target;
40891
+
40892
+ if ([
40893
+ 'bpmn:StartEvent',
40894
+ 'bpmn:Participant'
40895
+ ].includes(type)) {
40896
+ return false;
40897
+ }
38982
40898
 
38983
- if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) {
40899
+ if (type === 'bpmn:BoundaryEvent' && isUndefined$2(eventDefinitionType)) {
40900
+ return false;
40901
+ }
38984
40902
 
38985
- var childLanes = getChildLanes(element);
40903
+ return true;
40904
+ });
40905
+ };
38986
40906
 
38987
- assign$1(actions, {
38988
- 'lane-insert-above': {
38989
- group: 'lane-insert-above',
38990
- className: 'bpmn-icon-lane-insert-above',
38991
- title: translate('Add Lane above'),
38992
- action: {
38993
- click: function(event, element) {
38994
- modeling.addLane(element, 'top');
38995
- }
38996
- }
38997
- }
38998
- });
40907
+ /**
40908
+ * Create an action for a given target.
40909
+ *
40910
+ * @param {djs.model.Base} element
40911
+ * @param {Object} target
40912
+ *
40913
+ * @return {Object}
40914
+ */
40915
+ AppendMenuProvider.prototype._createEntryAction = function(element, target) {
40916
+ const elementFactory = this._elementFactory;
40917
+ const autoPlace = this._autoPlace;
40918
+ const create = this._create;
40919
+ const mouse = this._mouse;
38999
40920
 
39000
- if (childLanes.length < 2) {
39001
40921
 
39002
- if (element.height >= 120) {
39003
- assign$1(actions, {
39004
- 'lane-divide-two': {
39005
- group: 'lane-divide',
39006
- className: 'bpmn-icon-lane-divide-two',
39007
- title: translate('Divide into two Lanes'),
39008
- action: {
39009
- click: splitLaneHandler(2)
39010
- }
39011
- }
39012
- });
39013
- }
40922
+ const autoPlaceElement = () => {
40923
+ const newElement = elementFactory.create('shape', target);
40924
+ autoPlace.append(element, newElement);
40925
+ };
39014
40926
 
39015
- if (element.height >= 180) {
39016
- assign$1(actions, {
39017
- 'lane-divide-three': {
39018
- group: 'lane-divide',
39019
- className: 'bpmn-icon-lane-divide-three',
39020
- title: translate('Divide into three Lanes'),
39021
- action: {
39022
- click: splitLaneHandler(3)
39023
- }
39024
- }
39025
- });
39026
- }
40927
+ const manualPlaceElement = (event) => {
40928
+ const newElement = elementFactory.create('shape', target);
40929
+
40930
+ if (event instanceof KeyboardEvent) {
40931
+ event = mouse.getLastMoveEvent();
39027
40932
  }
39028
40933
 
39029
- assign$1(actions, {
39030
- 'lane-insert-below': {
39031
- group: 'lane-insert-below',
39032
- className: 'bpmn-icon-lane-insert-below',
39033
- title: translate('Add Lane below'),
39034
- action: {
39035
- click: function(event, element) {
39036
- modeling.addLane(element, 'bottom');
39037
- }
39038
- }
39039
- }
39040
- });
40934
+ return create.start(event, newElement);
40935
+ };
40936
+
40937
+ return {
40938
+ click: this._canAutoPlaceElement(target) ? autoPlaceElement : manualPlaceElement,
40939
+ dragstart: manualPlaceElement
40940
+ };
40941
+ };
40942
+
40943
+ /**
40944
+ * Check if the element should be auto placed.
40945
+ *
40946
+ * @param {Object} target
40947
+ *
40948
+ * @return {Boolean}
40949
+ */
40950
+ AppendMenuProvider.prototype._canAutoPlaceElement = (target) => {
40951
+ const { type } = target;
39041
40952
 
40953
+ if (type === 'bpmn:BoundaryEvent') {
40954
+ return false;
39042
40955
  }
39043
40956
 
39044
- if (is$5(businessObject, 'bpmn:FlowNode')) {
40957
+ if (type === 'bpmn:SubProcess' && target.triggeredByEvent) {
40958
+ return false;
40959
+ }
39045
40960
 
39046
- if (is$5(businessObject, 'bpmn:EventBasedGateway')) {
40961
+ if (type === 'bpmn:IntermediateCatchEvent' && target.eventDefinitionType === 'bpmn:LinkEventDefinition') {
40962
+ return false;
40963
+ }
39047
40964
 
39048
- assign$1(actions, {
39049
- 'append.receive-task': appendAction(
39050
- 'bpmn:ReceiveTask',
39051
- 'bpmn-icon-receive-task',
39052
- translate('Append ReceiveTask')
39053
- ),
39054
- 'append.message-intermediate-event': appendAction(
39055
- 'bpmn:IntermediateCatchEvent',
39056
- 'bpmn-icon-intermediate-event-catch-message',
39057
- translate('Append MessageIntermediateCatchEvent'),
39058
- { eventDefinitionType: 'bpmn:MessageEventDefinition' }
39059
- ),
39060
- 'append.timer-intermediate-event': appendAction(
39061
- 'bpmn:IntermediateCatchEvent',
39062
- 'bpmn-icon-intermediate-event-catch-timer',
39063
- translate('Append TimerIntermediateCatchEvent'),
39064
- { eventDefinitionType: 'bpmn:TimerEventDefinition' }
39065
- ),
39066
- 'append.condition-intermediate-event': appendAction(
39067
- 'bpmn:IntermediateCatchEvent',
39068
- 'bpmn-icon-intermediate-event-catch-condition',
39069
- translate('Append ConditionIntermediateCatchEvent'),
39070
- { eventDefinitionType: 'bpmn:ConditionalEventDefinition' }
39071
- ),
39072
- 'append.signal-intermediate-event': appendAction(
39073
- 'bpmn:IntermediateCatchEvent',
39074
- 'bpmn-icon-intermediate-event-catch-signal',
39075
- translate('Append SignalIntermediateCatchEvent'),
39076
- { eventDefinitionType: 'bpmn:SignalEventDefinition' }
39077
- )
39078
- });
39079
- } else
40965
+ return true;
40966
+ };
39080
40967
 
39081
- if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
40968
+ /**
40969
+ * A provider for align elements context pad button
40970
+ */
40971
+ function AppendContextPadProvider(contextPad, popupMenu, translate, canvas) {
40972
+ this._contextPad = contextPad;
40973
+ this._popupMenu = popupMenu;
40974
+ this._translate = translate;
40975
+ this._canvas = canvas;
39082
40976
 
39083
- assign$1(actions, {
39084
- 'append.compensation-activity':
39085
- appendAction(
39086
- 'bpmn:Task',
39087
- 'bpmn-icon-task',
39088
- translate('Append compensation activity'),
39089
- {
39090
- isForCompensation: true
39091
- }
39092
- )
39093
- });
39094
- } else
40977
+ contextPad.registerProvider(this);
40978
+ }
39095
40979
 
39096
- if (!is$5(businessObject, 'bpmn:EndEvent') &&
39097
- !businessObject.isForCompensation &&
39098
- !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
39099
- !isEventSubProcess(businessObject)) {
40980
+ AppendContextPadProvider.$inject = [
40981
+ 'contextPad',
40982
+ 'popupMenu',
40983
+ 'translate',
40984
+ 'canvas'
40985
+ ];
39100
40986
 
39101
- assign$1(actions, {
39102
- 'append.end-event': appendAction(
39103
- 'bpmn:EndEvent',
39104
- 'bpmn-icon-end-event-none',
39105
- translate('Append EndEvent')
39106
- ),
39107
- 'append.gateway': appendAction(
39108
- 'bpmn:ExclusiveGateway',
39109
- 'bpmn-icon-gateway-none',
39110
- translate('Append Gateway')
39111
- ),
39112
- 'append.append-task': appendAction(
39113
- 'bpmn:Task',
39114
- 'bpmn-icon-task',
39115
- translate('Append Task')
39116
- ),
39117
- 'append.intermediate-event': appendAction(
39118
- 'bpmn:IntermediateThrowEvent',
39119
- 'bpmn-icon-intermediate-event-none',
39120
- translate('Append Intermediate/Boundary Event')
39121
- )
39122
- });
39123
- }
39124
- }
40987
+ AppendContextPadProvider.prototype.getContextPadEntries = function(element) {
40988
+ const popupMenu = this._popupMenu;
40989
+ const translate = this._translate;
40990
+ const getAppendMenuPosition = this._getAppendMenuPosition.bind(this);
39125
40991
 
39126
- if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
40992
+ if (!popupMenu.isEmpty(element, 'bpmn-append')) {
39127
40993
 
39128
40994
  // Replace menu entry
39129
- assign$1(actions, {
39130
- 'replace': {
39131
- group: 'edit',
39132
- className: 'bpmn-icon-screw-wrench',
39133
- title: translate('Change type'),
40995
+ return {
40996
+ 'append': {
40997
+ group: 'model',
40998
+ imageUrl: appendIcon,
40999
+ title: translate('Append element'),
39134
41000
  action: {
39135
41001
  click: function(event, element) {
39136
41002
 
39137
- var position = assign$1(getReplaceMenuPosition(element), {
41003
+ var position = assign$1(getAppendMenuPosition(element), {
39138
41004
  cursor: { x: event.x, y: event.y }
39139
41005
  });
39140
41006
 
39141
- popupMenu.open(element, 'bpmn-replace', position, {
39142
- title: translate('Change element'),
41007
+ popupMenu.open(element, 'bpmn-append', position, {
41008
+ title: translate('Append element'),
39143
41009
  width: 300,
39144
41010
  search: true
39145
41011
  });
39146
41012
  }
39147
41013
  }
39148
41014
  }
39149
- });
41015
+ };
39150
41016
  }
41017
+ };
39151
41018
 
39152
- if (is$5(businessObject, 'bpmn:SequenceFlow')) {
39153
- assign$1(actions, {
39154
- 'append.text-annotation': appendAction(
39155
- 'bpmn:TextAnnotation',
39156
- 'bpmn-icon-text-annotation'
39157
- )
39158
- });
39159
- }
41019
+ AppendContextPadProvider.prototype._getAppendMenuPosition = function(element) {
41020
+ const contextPad = this._contextPad;
39160
41021
 
39161
- if (
39162
- isAny(businessObject, [
39163
- 'bpmn:FlowNode',
39164
- 'bpmn:InteractionNode',
39165
- 'bpmn:DataObjectReference',
39166
- 'bpmn:DataStoreReference',
39167
- ])
39168
- ) {
39169
- assign$1(actions, {
39170
- 'append.text-annotation': appendAction(
39171
- 'bpmn:TextAnnotation',
39172
- 'bpmn-icon-text-annotation'
39173
- ),
41022
+ const X_OFFSET = 5;
39174
41023
 
39175
- 'connect': {
39176
- group: 'connect',
39177
- className: 'bpmn-icon-connection-multi',
39178
- title: translate(
39179
- 'Connect using ' +
39180
- (businessObject.isForCompensation
39181
- ? ''
39182
- : 'Sequence/MessageFlow or ') +
39183
- 'Association'
39184
- ),
39185
- action: {
39186
- click: startConnect,
39187
- dragstart: startConnect,
39188
- },
39189
- },
39190
- });
39191
- }
41024
+ const pad = contextPad.getPad(element).html;
39192
41025
 
39193
- if (is$5(businessObject, 'bpmn:TextAnnotation')) {
39194
- assign$1(actions, {
39195
- 'connect': {
39196
- group: 'connect',
39197
- className: 'bpmn-icon-connection-multi',
39198
- title: translate('Connect using Association'),
39199
- action: {
39200
- click: startConnect,
39201
- dragstart: startConnect,
39202
- },
39203
- },
39204
- });
39205
- }
41026
+ const padRect = pad.getBoundingClientRect();
39206
41027
 
39207
- if (isAny(businessObject, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
39208
- assign$1(actions, {
39209
- 'connect': {
39210
- group: 'connect',
39211
- className: 'bpmn-icon-connection-multi',
39212
- title: translate('Connect using DataInputAssociation'),
39213
- action: {
39214
- click: startConnect,
39215
- dragstart: startConnect
39216
- }
39217
- }
39218
- });
39219
- }
41028
+ const pos = {
41029
+ x: padRect.right + X_OFFSET,
41030
+ y: padRect.top
41031
+ };
39220
41032
 
39221
- if (is$5(businessObject, 'bpmn:Group')) {
39222
- assign$1(actions, {
39223
- 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation')
39224
- });
39225
- }
41033
+ return pos;
41034
+ };
39226
41035
 
39227
- // delete element entry, only show if allowed by rules
39228
- var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });
41036
+ /**
41037
+ * Append anything modeling rules
41038
+ */
41039
+ function AppendRules(eventBus) {
41040
+ RuleProvider.call(this, eventBus);
41041
+ }
39229
41042
 
39230
- if (isArray$3(deleteAllowed)) {
41043
+ e$6(AppendRules, RuleProvider);
39231
41044
 
39232
- // was the element returned as a deletion candidate?
39233
- deleteAllowed = deleteAllowed[0] === element;
39234
- }
41045
+ AppendRules.$inject = [
41046
+ 'eventBus'
41047
+ ];
39235
41048
 
39236
- if (deleteAllowed) {
39237
- assign$1(actions, {
39238
- 'delete': {
39239
- group: 'edit',
39240
- className: 'bpmn-icon-trash',
39241
- title: translate('Remove'),
39242
- action: {
39243
- click: removeElement
39244
- }
39245
- }
39246
- });
39247
- }
41049
+ AppendRules.prototype.init = function() {
41050
+ this.addRule('shape.append', function(context) {
39248
41051
 
39249
- return actions;
39250
- };
41052
+ var source = context.element;
39251
41053
 
41054
+ const businessObject = getBusinessObject$1(source);
39252
41055
 
39253
- // helpers /////////
41056
+ if (isLabel$6(source)) {
41057
+ return false;
41058
+ }
39254
41059
 
39255
- function isEventType(eventBo, type, definition) {
41060
+ if (isAny(source, [
41061
+ 'bpmn:EndEvent',
41062
+ 'bpmn:Group',
41063
+ 'bpmn:TextAnnotation',
41064
+ 'bpmn:Lane',
41065
+ 'bpmn:Participant',
41066
+ 'bpmn:DataStoreReference',
41067
+ 'bpmn:DataObjectReference'
41068
+ ])) {
41069
+ return false;
41070
+ }
39256
41071
 
39257
- var isType = eventBo.$instanceOf(type);
39258
- var isDefinition = false;
41072
+ if (isConnection$c(source)) {
41073
+ return false;
41074
+ }
39259
41075
 
39260
- var definitions = eventBo.eventDefinitions || [];
39261
- forEach$1(definitions, function(def) {
39262
- if (def.$type === definition) {
39263
- isDefinition = true;
41076
+ if (is$5(source, 'bpmn:IntermediateThrowEvent') && hasEventDefinition$1(source, 'bpmn:LinkEventDefinition')) {
41077
+ return false;
41078
+ }
41079
+
41080
+ if (is$5(source, 'bpmn:SubProcess') && businessObject.triggeredByEvent) {
41081
+ return false;
39264
41082
  }
39265
41083
  });
39266
41084
 
39267
- return isType && isDefinition;
41085
+ };
41086
+
41087
+
41088
+ // helpers //////////////
41089
+ function hasEventDefinition$1(element, eventDefinition) {
41090
+ var bo = getBusinessObject$1(element);
41091
+
41092
+ return !!find$1(bo.eventDefinitions || [], function(definition) {
41093
+ return is$5(definition, eventDefinition);
41094
+ });
39268
41095
  }
39269
41096
 
39270
- function includes$7(array, item) {
39271
- return array.indexOf(item) !== -1;
41097
+ function isConnection$c(element) {
41098
+ return element.waypoints;
39272
41099
  }
39273
41100
 
39274
- var ContextPadModule = {
41101
+ var CreateAppendAnythingModule = {
39275
41102
  __depends__: [
39276
- DirectEditingModule,
39277
- ContextPadModule$1,
39278
- SelectionModule,
39279
- ConnectModule,
39280
- CreateModule,
39281
- PopupMenuModule
41103
+ PaletteModule$1,
41104
+ PopupMenuModule$1,
41105
+ AutoPlaceModule$1,
41106
+ ContextPadModule$1
39282
41107
  ],
39283
- __init__: [ 'contextPadProvider' ],
39284
- contextPadProvider: [ 'type', ContextPadProvider ]
41108
+ __init__: [
41109
+ 'createMenuProvider',
41110
+ 'createPaletteProvider',
41111
+ 'createAppendEditorActions',
41112
+ 'createAppendKeyboardBindings',
41113
+ 'appendMenuProvider',
41114
+ 'appendContextPadProvider',
41115
+ 'appendRules'
41116
+ ],
41117
+ createMenuProvider: [ 'type', CreateMenuProvider ],
41118
+ createPaletteProvider: [ 'type', CreatePaletteProvider ],
41119
+ createAppendEditorActions: [ 'type', CreateAppendEditorActions ],
41120
+ createAppendKeyboardBindings: [ 'type', CreateAppendKeyboardBindings ],
41121
+ appendMenuProvider: [ 'type', AppendMenuProvider ],
41122
+ appendContextPadProvider: [ 'type', AppendContextPadProvider ],
41123
+ appendRules: [ 'type', AppendRules ]
39285
41124
  };
39286
41125
 
39287
41126
  var AXIS_DIMENSIONS = {
@@ -46734,7 +48573,7 @@
46734
48573
  }
46735
48574
 
46736
48575
  return some(types, function(type) {
46737
- return hasEventDefinition$2(element, type);
48576
+ return hasEventDefinition$3(element, type);
46738
48577
  });
46739
48578
  }
46740
48579
 
@@ -52692,6 +54531,16 @@
52692
54531
  di.isMarkerVisible = true;
52693
54532
  }
52694
54533
 
54534
+ if (isDefined(attrs.triggeredByEvent)) {
54535
+ businessObject.triggeredByEvent = attrs.triggeredByEvent;
54536
+ delete attrs.triggeredByEvent;
54537
+ }
54538
+
54539
+ if (isDefined(attrs.cancelActivity)) {
54540
+ businessObject.cancelActivity = attrs.cancelActivity;
54541
+ delete attrs.cancelActivity;
54542
+ }
54543
+
52695
54544
  var eventDefinitions,
52696
54545
  newEventDefinition;
52697
54546
 
@@ -58310,471 +60159,6 @@
58310
60159
  movePreview: [ 'type', MovePreview ]
58311
60160
  };
58312
60161
 
58313
- var TOGGLE_SELECTOR = '.djs-palette-toggle',
58314
- ENTRY_SELECTOR = '.entry',
58315
- ELEMENT_SELECTOR = TOGGLE_SELECTOR + ', ' + ENTRY_SELECTOR;
58316
-
58317
- var PALETTE_PREFIX = 'djs-palette-',
58318
- PALETTE_SHOWN_CLS = 'shown',
58319
- PALETTE_OPEN_CLS = 'open',
58320
- PALETTE_TWO_COLUMN_CLS = 'two-column';
58321
-
58322
- var DEFAULT_PRIORITY$1 = 1000;
58323
-
58324
-
58325
- /**
58326
- * A palette containing modeling elements.
58327
- */
58328
- function Palette(eventBus, canvas) {
58329
-
58330
- this._eventBus = eventBus;
58331
- this._canvas = canvas;
58332
-
58333
- var self = this;
58334
-
58335
- eventBus.on('tool-manager.update', function(event) {
58336
- var tool = event.tool;
58337
-
58338
- self.updateToolHighlight(tool);
58339
- });
58340
-
58341
- eventBus.on('i18n.changed', function() {
58342
- self._update();
58343
- });
58344
-
58345
- eventBus.on('diagram.init', function() {
58346
-
58347
- self._diagramInitialized = true;
58348
-
58349
- self._rebuild();
58350
- });
58351
- }
58352
-
58353
- Palette.$inject = [ 'eventBus', 'canvas' ];
58354
-
58355
-
58356
- /**
58357
- * Register a provider with the palette
58358
- *
58359
- * @param {number} [priority=1000]
58360
- * @param {PaletteProvider} provider
58361
- *
58362
- * @example
58363
- * const paletteProvider = {
58364
- * getPaletteEntries: function() {
58365
- * return function(entries) {
58366
- * return {
58367
- * ...entries,
58368
- * 'entry-1': {
58369
- * label: 'My Entry',
58370
- * action: function() { alert("I have been clicked!"); }
58371
- * }
58372
- * };
58373
- * }
58374
- * }
58375
- * };
58376
- *
58377
- * palette.registerProvider(800, paletteProvider);
58378
- */
58379
- Palette.prototype.registerProvider = function(priority, provider) {
58380
- if (!provider) {
58381
- provider = priority;
58382
- priority = DEFAULT_PRIORITY$1;
58383
- }
58384
-
58385
- this._eventBus.on('palette.getProviders', priority, function(event) {
58386
- event.providers.push(provider);
58387
- });
58388
-
58389
- this._rebuild();
58390
- };
58391
-
58392
-
58393
- /**
58394
- * Returns the palette entries
58395
- *
58396
- * @return {Object<string, PaletteEntryDescriptor>} map of entries
58397
- */
58398
- Palette.prototype.getEntries = function() {
58399
- var providers = this._getProviders();
58400
-
58401
- return providers.reduce(addPaletteEntries, {});
58402
- };
58403
-
58404
- Palette.prototype._rebuild = function() {
58405
-
58406
- if (!this._diagramInitialized) {
58407
- return;
58408
- }
58409
-
58410
- var providers = this._getProviders();
58411
-
58412
- if (!providers.length) {
58413
- return;
58414
- }
58415
-
58416
- if (!this._container) {
58417
- this._init();
58418
- }
58419
-
58420
- this._update();
58421
- };
58422
-
58423
- /**
58424
- * Initialize
58425
- */
58426
- Palette.prototype._init = function() {
58427
-
58428
- var self = this;
58429
-
58430
- var eventBus = this._eventBus;
58431
-
58432
- var parentContainer = this._getParentContainer();
58433
-
58434
- var container = this._container = domify$1(Palette.HTML_MARKUP);
58435
-
58436
- parentContainer.appendChild(container);
58437
- classes$1(parentContainer).add(PALETTE_PREFIX + PALETTE_SHOWN_CLS);
58438
-
58439
- delegate.bind(container, ELEMENT_SELECTOR, 'click', function(event) {
58440
-
58441
- var target = event.delegateTarget;
58442
-
58443
- if (matches(target, TOGGLE_SELECTOR)) {
58444
- return self.toggle();
58445
- }
58446
-
58447
- self.trigger('click', event);
58448
- });
58449
-
58450
- // prevent drag propagation
58451
- event.bind(container, 'mousedown', function(event) {
58452
- event.stopPropagation();
58453
- });
58454
-
58455
- // prevent drag propagation
58456
- delegate.bind(container, ENTRY_SELECTOR, 'dragstart', function(event) {
58457
- self.trigger('dragstart', event);
58458
- });
58459
-
58460
- eventBus.on('canvas.resized', this._layoutChanged, this);
58461
-
58462
- eventBus.fire('palette.create', {
58463
- container: container
58464
- });
58465
- };
58466
-
58467
- Palette.prototype._getProviders = function(id) {
58468
-
58469
- var event = this._eventBus.createEvent({
58470
- type: 'palette.getProviders',
58471
- providers: []
58472
- });
58473
-
58474
- this._eventBus.fire(event);
58475
-
58476
- return event.providers;
58477
- };
58478
-
58479
- /**
58480
- * Update palette state.
58481
- *
58482
- * @param {Object} [state] { open, twoColumn }
58483
- */
58484
- Palette.prototype._toggleState = function(state) {
58485
-
58486
- state = state || {};
58487
-
58488
- var parent = this._getParentContainer(),
58489
- container = this._container;
58490
-
58491
- var eventBus = this._eventBus;
58492
-
58493
- var twoColumn;
58494
-
58495
- var cls = classes$1(container),
58496
- parentCls = classes$1(parent);
58497
-
58498
- if ('twoColumn' in state) {
58499
- twoColumn = state.twoColumn;
58500
- } else {
58501
- twoColumn = this._needsCollapse(parent.clientHeight, this._entries || {});
58502
- }
58503
-
58504
- // always update two column
58505
- cls.toggle(PALETTE_TWO_COLUMN_CLS, twoColumn);
58506
- parentCls.toggle(PALETTE_PREFIX + PALETTE_TWO_COLUMN_CLS, twoColumn);
58507
-
58508
- if ('open' in state) {
58509
- cls.toggle(PALETTE_OPEN_CLS, state.open);
58510
- parentCls.toggle(PALETTE_PREFIX + PALETTE_OPEN_CLS, state.open);
58511
- }
58512
-
58513
- eventBus.fire('palette.changed', {
58514
- twoColumn: twoColumn,
58515
- open: this.isOpen()
58516
- });
58517
- };
58518
-
58519
- Palette.prototype._update = function() {
58520
-
58521
- var entriesContainer = query('.djs-palette-entries', this._container),
58522
- entries = this._entries = this.getEntries();
58523
-
58524
- clear$1(entriesContainer);
58525
-
58526
- forEach$1(entries, function(entry, id) {
58527
-
58528
- var grouping = entry.group || 'default';
58529
-
58530
- var container = query('[data-group=' + cssEscape(grouping) + ']', entriesContainer);
58531
- if (!container) {
58532
- container = domify$1('<div class="group"></div>');
58533
- attr$1(container, 'data-group', grouping);
58534
-
58535
- entriesContainer.appendChild(container);
58536
- }
58537
-
58538
- var html = entry.html || (
58539
- entry.separator ?
58540
- '<hr class="separator" />' :
58541
- '<div class="entry" draggable="true"></div>');
58542
-
58543
-
58544
- var control = domify$1(html);
58545
- container.appendChild(control);
58546
-
58547
- if (!entry.separator) {
58548
- attr$1(control, 'data-action', id);
58549
-
58550
- if (entry.title) {
58551
- attr$1(control, 'title', entry.title);
58552
- }
58553
-
58554
- if (entry.className) {
58555
- addClasses(control, entry.className);
58556
- }
58557
-
58558
- if (entry.imageUrl) {
58559
- var image = domify$1('<img>');
58560
- attr$1(image, 'src', entry.imageUrl);
58561
-
58562
- control.appendChild(image);
58563
- }
58564
- }
58565
- });
58566
-
58567
- // open after update
58568
- this.open();
58569
- };
58570
-
58571
-
58572
- /**
58573
- * Trigger an action available on the palette
58574
- *
58575
- * @param {string} action
58576
- * @param {Event} event
58577
- */
58578
- Palette.prototype.trigger = function(action, event, autoActivate) {
58579
- var entry,
58580
- originalEvent,
58581
- button = event.delegateTarget || event.target;
58582
-
58583
- if (!button) {
58584
- return event.preventDefault();
58585
- }
58586
-
58587
- entry = attr$1(button, 'data-action');
58588
- originalEvent = event.originalEvent || event;
58589
-
58590
- return this.triggerEntry(entry, action, originalEvent, autoActivate);
58591
- };
58592
-
58593
- Palette.prototype.triggerEntry = function(entryId, action, event, autoActivate) {
58594
- var entries = this._entries,
58595
- entry,
58596
- handler;
58597
-
58598
- entry = entries[entryId];
58599
-
58600
- // when user clicks on the palette and not on an action
58601
- if (!entry) {
58602
- return;
58603
- }
58604
-
58605
- handler = entry.action;
58606
-
58607
- // simple action (via callback function)
58608
- if (isFunction(handler)) {
58609
- if (action === 'click') {
58610
- return handler(event, autoActivate);
58611
- }
58612
- } else {
58613
- if (handler[action]) {
58614
- return handler[action](event, autoActivate);
58615
- }
58616
- }
58617
-
58618
- // silence other actions
58619
- event.preventDefault();
58620
- };
58621
-
58622
- Palette.prototype._layoutChanged = function() {
58623
- this._toggleState({});
58624
- };
58625
-
58626
- /**
58627
- * Do we need to collapse to two columns?
58628
- *
58629
- * @param {number} availableHeight
58630
- * @param {Object} entries
58631
- *
58632
- * @return {boolean}
58633
- */
58634
- Palette.prototype._needsCollapse = function(availableHeight, entries) {
58635
-
58636
- // top margin + bottom toggle + bottom margin
58637
- // implementors must override this method if they
58638
- // change the palette styles
58639
- var margin = 20 + 10 + 20;
58640
-
58641
- var entriesHeight = Object.keys(entries).length * 46;
58642
-
58643
- return availableHeight < entriesHeight + margin;
58644
- };
58645
-
58646
- /**
58647
- * Close the palette
58648
- */
58649
- Palette.prototype.close = function() {
58650
-
58651
- this._toggleState({
58652
- open: false,
58653
- twoColumn: false
58654
- });
58655
- };
58656
-
58657
-
58658
- /**
58659
- * Open the palette
58660
- */
58661
- Palette.prototype.open = function() {
58662
- this._toggleState({ open: true });
58663
- };
58664
-
58665
-
58666
- Palette.prototype.toggle = function(open) {
58667
- if (this.isOpen()) {
58668
- this.close();
58669
- } else {
58670
- this.open();
58671
- }
58672
- };
58673
-
58674
- Palette.prototype.isActiveTool = function(tool) {
58675
- return tool && this._activeTool === tool;
58676
- };
58677
-
58678
- Palette.prototype.updateToolHighlight = function(name) {
58679
- var entriesContainer,
58680
- toolsContainer;
58681
-
58682
- if (!this._toolsContainer) {
58683
- entriesContainer = query('.djs-palette-entries', this._container);
58684
-
58685
- this._toolsContainer = query('[data-group=tools]', entriesContainer);
58686
- }
58687
-
58688
- toolsContainer = this._toolsContainer;
58689
-
58690
- forEach$1(toolsContainer.children, function(tool) {
58691
- var actionName = tool.getAttribute('data-action');
58692
-
58693
- if (!actionName) {
58694
- return;
58695
- }
58696
-
58697
- var toolClasses = classes$1(tool);
58698
-
58699
- actionName = actionName.replace('-tool', '');
58700
-
58701
- if (toolClasses.contains('entry') && actionName === name) {
58702
- toolClasses.add('highlighted-entry');
58703
- } else {
58704
- toolClasses.remove('highlighted-entry');
58705
- }
58706
- });
58707
- };
58708
-
58709
-
58710
- /**
58711
- * Return true if the palette is opened.
58712
- *
58713
- * @example
58714
- *
58715
- * palette.open();
58716
- *
58717
- * if (palette.isOpen()) {
58718
- * // yes, we are open
58719
- * }
58720
- *
58721
- * @return {boolean} true if palette is opened
58722
- */
58723
- Palette.prototype.isOpen = function() {
58724
- return classes$1(this._container).has(PALETTE_OPEN_CLS);
58725
- };
58726
-
58727
- /**
58728
- * Get container the palette lives in.
58729
- *
58730
- * @return {Element}
58731
- */
58732
- Palette.prototype._getParentContainer = function() {
58733
- return this._canvas.getContainer();
58734
- };
58735
-
58736
-
58737
- /* markup definition */
58738
-
58739
- Palette.HTML_MARKUP =
58740
- '<div class="djs-palette">' +
58741
- '<div class="djs-palette-entries"></div>' +
58742
- '<div class="djs-palette-toggle"></div>' +
58743
- '</div>';
58744
-
58745
-
58746
- // helpers //////////////////////
58747
-
58748
- function addClasses(element, classNames) {
58749
-
58750
- var classes = classes$1(element);
58751
-
58752
- var actualClassNames = isArray$3(classNames) ? classNames : classNames.split(/\s+/g);
58753
- actualClassNames.forEach(function(cls) {
58754
- classes.add(cls);
58755
- });
58756
- }
58757
-
58758
- function addPaletteEntries(entries, provider) {
58759
-
58760
- var entriesOrUpdater = provider.getPaletteEntries();
58761
-
58762
- if (isFunction(entriesOrUpdater)) {
58763
- return entriesOrUpdater(entries);
58764
- }
58765
-
58766
- forEach$1(entriesOrUpdater, function(entry, id) {
58767
- entries[id] = entry;
58768
- });
58769
-
58770
- return entries;
58771
- }
58772
-
58773
- var PaletteModule$1 = {
58774
- __init__: [ 'palette' ],
58775
- palette: [ 'type', Palette ]
58776
- };
58777
-
58778
60162
  var LASSO_TOOL_CURSOR = 'crosshair';
58779
60163
 
58780
60164
 
@@ -61425,6 +62809,10 @@
61425
62809
  '</bpmn:definitions>';
61426
62810
 
61427
62811
 
62812
+ /**
62813
+ * @typedef { import('didi').ModuleDeclaration } Module
62814
+ */
62815
+
61428
62816
  /**
61429
62817
  * A modeler for BPMN 2.0 diagrams.
61430
62818
  *
@@ -61494,8 +62882,8 @@
61494
62882
  * @param {string|number} [options.width] the width of the viewer
61495
62883
  * @param {string|number} [options.height] the height of the viewer
61496
62884
  * @param {Object} [options.moddleExtensions] extension packages to provide
61497
- * @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
61498
- * @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
62885
+ * @param {Module[]} [options.modules] a list of modules to override the default modules
62886
+ * @param {Module[]} [options.additionalModules] a list of modules to use with the default modules
61499
62887
  */
61500
62888
  function Modeler$1(options) {
61501
62889
  BaseModeler.call(this, options);
@@ -61555,6 +62943,7 @@
61555
62943
  ContextPadModule,
61556
62944
  CopyPasteModule,
61557
62945
  CreateModule,
62946
+ CreateAppendAnythingModule,
61558
62947
  DistributeElementsModule,
61559
62948
  EditorActionsModule,
61560
62949
  GridSnappingModule,
@@ -86522,18 +87911,26 @@
86522
87911
  return `bio-properties-panel-${id}`;
86523
87912
  }
86524
87913
 
87914
+ function resizeToContents(element) {
87915
+ element.style.height = 'auto';
87916
+
87917
+ // a 2px pixel offset is required to prevent scrollbar from
87918
+ // appearing on OS with a full length scroll bar (Windows/Linux)
87919
+ element.style.height = `${element.scrollHeight + 2}px`;
87920
+ }
86525
87921
  function TextArea(props) {
86526
87922
  const {
86527
87923
  id,
86528
87924
  label,
86529
- rows = 2,
86530
87925
  debounce,
86531
87926
  onInput,
86532
87927
  value = '',
86533
87928
  disabled,
86534
87929
  monospace,
86535
87930
  onFocus,
86536
- onBlur
87931
+ onBlur,
87932
+ autoResize,
87933
+ rows = autoResize ? 1 : 2
86537
87934
  } = props;
86538
87935
  const [localValue, setLocalValue] = l$1(value);
86539
87936
  const ref = useShowEntryEvent(id);
@@ -86544,8 +87941,12 @@
86544
87941
  }, [onInput, debounce]);
86545
87942
  const handleInput = e => {
86546
87943
  handleInputCallback(e);
87944
+ autoResize && resizeToContents(e.target);
86547
87945
  setLocalValue(e.target.value);
86548
87946
  };
87947
+ h(() => {
87948
+ autoResize && resizeToContents(ref.current);
87949
+ }, []);
86549
87950
  y(() => {
86550
87951
  if (value === localValue) {
86551
87952
  return;
@@ -86563,7 +87964,7 @@
86563
87964
  id: prefixId$2(id),
86564
87965
  name: id,
86565
87966
  spellCheck: "false",
86566
- class: classnames('bio-properties-panel-input', monospace ? 'bio-properties-panel-input-monospace' : ''),
87967
+ class: classnames('bio-properties-panel-input', monospace ? 'bio-properties-panel-input-monospace' : '', autoResize ? 'auto-resize' : ''),
86567
87968
  onInput: handleInput,
86568
87969
  onFocus: onFocus,
86569
87970
  onBlur: onBlur,
@@ -86603,7 +88004,8 @@
86603
88004
  monospace,
86604
88005
  disabled,
86605
88006
  onFocus,
86606
- onBlur
88007
+ onBlur,
88008
+ autoResize
86607
88009
  } = props;
86608
88010
  const value = getValue(element);
86609
88011
  const error = useError(id);
@@ -86620,7 +88022,8 @@
86620
88022
  rows: rows,
86621
88023
  debounce: debounce,
86622
88024
  monospace: monospace,
86623
- disabled: disabled
88025
+ disabled: disabled,
88026
+ autoResize: autoResize
86624
88027
  }, element), error && o$1("div", {
86625
88028
  class: "bio-properties-panel-error",
86626
88029
  children: error
@@ -86883,6 +88286,16 @@
86883
88286
  }
86884
88287
 
86885
88288
 
88289
+ /**
88290
+ * Get a script from the business object
88291
+ *
88292
+ * @param {MoodleElement} element
88293
+ * @returns {MoodleElement} the script object
88294
+ */
88295
+ function getScript(element) {
88296
+ return (getElements$1(element, 'zeebe:Script') || [])[0];
88297
+ }
88298
+
86886
88299
  // helpers //////////
86887
88300
 
86888
88301
  function getElements$1(element, type, property) {
@@ -87311,13 +88724,14 @@
87311
88724
 
87312
88725
  minDash$1.forEach(elements, function(element) {
87313
88726
 
87314
- var calledDecision = getCalledDecision(element);
88727
+ var baseElement = getCalledDecision(element) ||
88728
+ getScript(element);
87315
88729
 
87316
- if (!calledDecision) {
88730
+ if (!baseElement) {
87317
88731
  return;
87318
88732
  }
87319
88733
 
87320
- var resultVariable = calledDecision.resultVariable;
88734
+ var resultVariable = baseElement.resultVariable;
87321
88735
 
87322
88736
  if (resultVariable) {
87323
88737
  var newVariable = createProcessVariable$1(
@@ -91544,7 +92958,7 @@
91544
92958
  return [{
91545
92959
  id: 'name',
91546
92960
  component: Name$3,
91547
- isEdited: isEdited$1
92961
+ isEdited: isEdited$2
91548
92962
  }];
91549
92963
  }
91550
92964
  function Name$3(props) {
@@ -91570,7 +92984,8 @@
91570
92984
  },
91571
92985
  getValue: element => {
91572
92986
  return element.businessObject.name;
91573
- }
92987
+ },
92988
+ autoResize: true
91574
92989
  };
91575
92990
 
91576
92991
  // (2) text annotations
@@ -91612,7 +93027,7 @@
91612
93027
  else if (is$5(element, 'bpmn:Participant')) {
91613
93028
  options.label = translate('Participant Name');
91614
93029
  }
91615
- return TextfieldEntry(options);
93030
+ return TextAreaEntry(options);
91616
93031
  }
91617
93032
 
91618
93033
  // helpers ////////////////////////