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$7 = bind$1 !== 'addEventListener' ? 'on' : '';
1294
+ var bind$1, unbind$1, prefix$7;
1295
+
1296
+ function detect () {
1297
+ bind$1 = window.addEventListener ? 'addEventListener' : 'attachEvent';
1298
+ unbind$1 = window.removeEventListener ? 'removeEventListener' : 'detachEvent';
1299
+ prefix$7 = 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$7 + 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$7 + 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',
@@ -37828,17 +37911,17 @@
37828
37911
  START_EVENT_SUB_PROCESS: START_EVENT_SUB_PROCESS,
37829
37912
  INTERMEDIATE_EVENT: INTERMEDIATE_EVENT,
37830
37913
  END_EVENT: END_EVENT,
37831
- GATEWAY: GATEWAY,
37914
+ GATEWAY: GATEWAY$1,
37832
37915
  SUBPROCESS_EXPANDED: SUBPROCESS_EXPANDED,
37833
37916
  TRANSACTION: TRANSACTION,
37834
37917
  EVENT_SUB_PROCESS: EVENT_SUB_PROCESS,
37835
- TASK: TASK,
37918
+ TASK: TASK$1,
37836
37919
  DATA_OBJECT_REFERENCE: DATA_OBJECT_REFERENCE,
37837
37920
  DATA_STORE_REFERENCE: DATA_STORE_REFERENCE,
37838
37921
  BOUNDARY_EVENT: BOUNDARY_EVENT,
37839
37922
  EVENT_SUB_PROCESS_START_EVENT: EVENT_SUB_PROCESS_START_EVENT,
37840
37923
  SEQUENCE_FLOW: SEQUENCE_FLOW,
37841
- PARTICIPANT: PARTICIPANT
37924
+ PARTICIPANT: PARTICIPANT$1
37842
37925
  });
37843
37926
 
37844
37927
  /**
@@ -37919,7 +38002,7 @@
37919
38002
  // expanded/collapsed pools
37920
38003
  if (is$5(businessObject, 'bpmn:Participant')) {
37921
38004
 
37922
- entries = filter(PARTICIPANT, function(entry) {
38005
+ entries = filter(PARTICIPANT$1, function(entry) {
37923
38006
  return isExpanded(element) !== entry.target.isExpanded;
37924
38007
  });
37925
38008
 
@@ -38002,7 +38085,7 @@
38002
38085
  // gateways
38003
38086
  if (is$5(businessObject, 'bpmn:Gateway')) {
38004
38087
 
38005
- entries = filter(GATEWAY, differentType);
38088
+ entries = filter(GATEWAY$1, differentType);
38006
38089
 
38007
38090
  return this._createEntries(element, entries);
38008
38091
  }
@@ -38034,7 +38117,7 @@
38034
38117
  // collapsed ad hoc sub processes
38035
38118
  if (is$5(businessObject, 'bpmn:AdHocSubProcess') && !isExpanded(element)) {
38036
38119
 
38037
- entries = filter(TASK, function(entry) {
38120
+ entries = filter(TASK$1, function(entry) {
38038
38121
 
38039
38122
  var target = entry.target;
38040
38123
 
@@ -38055,7 +38138,7 @@
38055
38138
 
38056
38139
  // flow nodes
38057
38140
  if (is$5(businessObject, 'bpmn:FlowNode')) {
38058
- entries = filter(TASK, differentType);
38141
+ entries = filter(TASK$1, differentType);
38059
38142
 
38060
38143
  // collapsed SubProcess can not be replaced with itself
38061
38144
  if (is$5(businessObject, 'bpmn:SubProcess') && !isExpanded(element)) {
@@ -38325,6 +38408,12 @@
38325
38408
  var self = this;
38326
38409
  var translate = this._translate;
38327
38410
 
38411
+ var dataObject = element.businessObject.dataObjectRef;
38412
+
38413
+ if (!dataObject) {
38414
+ return [];
38415
+ }
38416
+
38328
38417
  function toggleIsCollection(event, entry) {
38329
38418
  self._modeling.updateModdleProperties(
38330
38419
  element,
@@ -38332,8 +38421,7 @@
38332
38421
  { isCollection: !entry.active });
38333
38422
  }
38334
38423
 
38335
- var dataObject = element.businessObject.dataObjectRef,
38336
- isCollection = dataObject.isCollection;
38424
+ var isCollection = dataObject.isCollection;
38337
38425
 
38338
38426
  var dataObjectEntries = [
38339
38427
  {
@@ -38429,9 +38517,12 @@
38429
38517
  var PopupMenuModule = {
38430
38518
  __depends__: [
38431
38519
  PopupMenuModule$1,
38432
- ReplaceModule
38520
+ ReplaceModule,
38521
+ AutoPlaceModule
38522
+ ],
38523
+ __init__: [
38524
+ 'replaceMenuProvider'
38433
38525
  ],
38434
- __init__: [ 'replaceMenuProvider' ],
38435
38526
  replaceMenuProvider: [ 'type', ReplaceMenuProvider ]
38436
38527
  };
38437
38528
 
@@ -38874,433 +38965,2181 @@
38874
38965
  });
38875
38966
  }
38876
38967
 
38877
- return actions;
38968
+ return actions;
38969
+ };
38970
+
38971
+ /**
38972
+ * @param {djs.model.Base[]} elements
38973
+ * @return {boolean}
38974
+ */
38975
+ ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
38976
+
38977
+ var baseAllowed = this._rules.allowed('elements.delete', {
38978
+ elements: elements
38979
+ });
38980
+
38981
+ if (isArray$3(baseAllowed)) {
38982
+ return every(baseAllowed, function(element) {
38983
+ return includes$7(baseAllowed, element);
38984
+ });
38985
+ }
38986
+
38987
+ return baseAllowed;
38988
+ };
38989
+
38990
+ ContextPadProvider.prototype.getContextPadEntries = function(element) {
38991
+ var contextPad = this._contextPad,
38992
+ modeling = this._modeling,
38993
+
38994
+ elementFactory = this._elementFactory,
38995
+ connect = this._connect,
38996
+ create = this._create,
38997
+ popupMenu = this._popupMenu,
38998
+ rules = this._rules,
38999
+ autoPlace = this._autoPlace,
39000
+ translate = this._translate;
39001
+
39002
+ var actions = {};
39003
+
39004
+ if (element.type === 'label') {
39005
+ return actions;
39006
+ }
39007
+
39008
+ var businessObject = element.businessObject;
39009
+
39010
+ function startConnect(event, element) {
39011
+ connect.start(event, element);
39012
+ }
39013
+
39014
+ function removeElement(e, element) {
39015
+ modeling.removeElements([ element ]);
39016
+ }
39017
+
39018
+ function getReplaceMenuPosition(element) {
39019
+
39020
+ var Y_OFFSET = 5;
39021
+
39022
+ var pad = contextPad.getPad(element).html;
39023
+
39024
+ var padRect = pad.getBoundingClientRect();
39025
+
39026
+ var pos = {
39027
+ x: padRect.left,
39028
+ y: padRect.bottom + Y_OFFSET
39029
+ };
39030
+
39031
+ return pos;
39032
+ }
39033
+
39034
+ /**
39035
+ * Create an append action
39036
+ *
39037
+ * @param {string} type
39038
+ * @param {string} className
39039
+ * @param {string} [title]
39040
+ * @param {Object} [options]
39041
+ *
39042
+ * @return {Object} descriptor
39043
+ */
39044
+ function appendAction(type, className, title, options) {
39045
+
39046
+ if (typeof title !== 'string') {
39047
+ options = title;
39048
+ title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') });
39049
+ }
39050
+
39051
+ function appendStart(event, element) {
39052
+
39053
+ var shape = elementFactory.createShape(assign$1({ type: type }, options));
39054
+ create.start(event, shape, {
39055
+ source: element
39056
+ });
39057
+ }
39058
+
39059
+
39060
+ var append = autoPlace ? function(event, element) {
39061
+ var shape = elementFactory.createShape(assign$1({ type: type }, options));
39062
+
39063
+ autoPlace.append(element, shape);
39064
+ } : appendStart;
39065
+
39066
+
39067
+ return {
39068
+ group: 'model',
39069
+ className: className,
39070
+ title: title,
39071
+ action: {
39072
+ dragstart: appendStart,
39073
+ click: append
39074
+ }
39075
+ };
39076
+ }
39077
+
39078
+ function splitLaneHandler(count) {
39079
+
39080
+ return function(event, element) {
39081
+
39082
+ // actual split
39083
+ modeling.splitLane(element, count);
39084
+
39085
+ // refresh context pad after split to
39086
+ // get rid of split icons
39087
+ contextPad.open(element, true);
39088
+ };
39089
+ }
39090
+
39091
+
39092
+ if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) {
39093
+
39094
+ var childLanes = getChildLanes(element);
39095
+
39096
+ assign$1(actions, {
39097
+ 'lane-insert-above': {
39098
+ group: 'lane-insert-above',
39099
+ className: 'bpmn-icon-lane-insert-above',
39100
+ title: translate('Add Lane above'),
39101
+ action: {
39102
+ click: function(event, element) {
39103
+ modeling.addLane(element, 'top');
39104
+ }
39105
+ }
39106
+ }
39107
+ });
39108
+
39109
+ if (childLanes.length < 2) {
39110
+
39111
+ if (element.height >= 120) {
39112
+ assign$1(actions, {
39113
+ 'lane-divide-two': {
39114
+ group: 'lane-divide',
39115
+ className: 'bpmn-icon-lane-divide-two',
39116
+ title: translate('Divide into two Lanes'),
39117
+ action: {
39118
+ click: splitLaneHandler(2)
39119
+ }
39120
+ }
39121
+ });
39122
+ }
39123
+
39124
+ if (element.height >= 180) {
39125
+ assign$1(actions, {
39126
+ 'lane-divide-three': {
39127
+ group: 'lane-divide',
39128
+ className: 'bpmn-icon-lane-divide-three',
39129
+ title: translate('Divide into three Lanes'),
39130
+ action: {
39131
+ click: splitLaneHandler(3)
39132
+ }
39133
+ }
39134
+ });
39135
+ }
39136
+ }
39137
+
39138
+ assign$1(actions, {
39139
+ 'lane-insert-below': {
39140
+ group: 'lane-insert-below',
39141
+ className: 'bpmn-icon-lane-insert-below',
39142
+ title: translate('Add Lane below'),
39143
+ action: {
39144
+ click: function(event, element) {
39145
+ modeling.addLane(element, 'bottom');
39146
+ }
39147
+ }
39148
+ }
39149
+ });
39150
+
39151
+ }
39152
+
39153
+ if (is$5(businessObject, 'bpmn:FlowNode')) {
39154
+
39155
+ if (is$5(businessObject, 'bpmn:EventBasedGateway')) {
39156
+
39157
+ assign$1(actions, {
39158
+ 'append.receive-task': appendAction(
39159
+ 'bpmn:ReceiveTask',
39160
+ 'bpmn-icon-receive-task',
39161
+ translate('Append ReceiveTask')
39162
+ ),
39163
+ 'append.message-intermediate-event': appendAction(
39164
+ 'bpmn:IntermediateCatchEvent',
39165
+ 'bpmn-icon-intermediate-event-catch-message',
39166
+ translate('Append MessageIntermediateCatchEvent'),
39167
+ { eventDefinitionType: 'bpmn:MessageEventDefinition' }
39168
+ ),
39169
+ 'append.timer-intermediate-event': appendAction(
39170
+ 'bpmn:IntermediateCatchEvent',
39171
+ 'bpmn-icon-intermediate-event-catch-timer',
39172
+ translate('Append TimerIntermediateCatchEvent'),
39173
+ { eventDefinitionType: 'bpmn:TimerEventDefinition' }
39174
+ ),
39175
+ 'append.condition-intermediate-event': appendAction(
39176
+ 'bpmn:IntermediateCatchEvent',
39177
+ 'bpmn-icon-intermediate-event-catch-condition',
39178
+ translate('Append ConditionIntermediateCatchEvent'),
39179
+ { eventDefinitionType: 'bpmn:ConditionalEventDefinition' }
39180
+ ),
39181
+ 'append.signal-intermediate-event': appendAction(
39182
+ 'bpmn:IntermediateCatchEvent',
39183
+ 'bpmn-icon-intermediate-event-catch-signal',
39184
+ translate('Append SignalIntermediateCatchEvent'),
39185
+ { eventDefinitionType: 'bpmn:SignalEventDefinition' }
39186
+ )
39187
+ });
39188
+ } else
39189
+
39190
+ if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
39191
+
39192
+ assign$1(actions, {
39193
+ 'append.compensation-activity':
39194
+ appendAction(
39195
+ 'bpmn:Task',
39196
+ 'bpmn-icon-task',
39197
+ translate('Append compensation activity'),
39198
+ {
39199
+ isForCompensation: true
39200
+ }
39201
+ )
39202
+ });
39203
+ } else
39204
+
39205
+ if (!is$5(businessObject, 'bpmn:EndEvent') &&
39206
+ !businessObject.isForCompensation &&
39207
+ !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
39208
+ !isEventSubProcess(businessObject)) {
39209
+
39210
+ assign$1(actions, {
39211
+ 'append.end-event': appendAction(
39212
+ 'bpmn:EndEvent',
39213
+ 'bpmn-icon-end-event-none',
39214
+ translate('Append EndEvent')
39215
+ ),
39216
+ 'append.gateway': appendAction(
39217
+ 'bpmn:ExclusiveGateway',
39218
+ 'bpmn-icon-gateway-none',
39219
+ translate('Append Gateway')
39220
+ ),
39221
+ 'append.append-task': appendAction(
39222
+ 'bpmn:Task',
39223
+ 'bpmn-icon-task',
39224
+ translate('Append Task')
39225
+ ),
39226
+ 'append.intermediate-event': appendAction(
39227
+ 'bpmn:IntermediateThrowEvent',
39228
+ 'bpmn-icon-intermediate-event-none',
39229
+ translate('Append Intermediate/Boundary Event')
39230
+ )
39231
+ });
39232
+ }
39233
+ }
39234
+
39235
+ if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
39236
+
39237
+ // Replace menu entry
39238
+ assign$1(actions, {
39239
+ 'replace': {
39240
+ group: 'edit',
39241
+ className: 'bpmn-icon-screw-wrench',
39242
+ title: translate('Change type'),
39243
+ action: {
39244
+ click: function(event, element) {
39245
+
39246
+ var position = assign$1(getReplaceMenuPosition(element), {
39247
+ cursor: { x: event.x, y: event.y }
39248
+ });
39249
+
39250
+ popupMenu.open(element, 'bpmn-replace', position, {
39251
+ title: translate('Change element'),
39252
+ width: 300,
39253
+ search: true
39254
+ });
39255
+ }
39256
+ }
39257
+ }
39258
+ });
39259
+ }
39260
+
39261
+ if (is$5(businessObject, 'bpmn:SequenceFlow')) {
39262
+ assign$1(actions, {
39263
+ 'append.text-annotation': appendAction(
39264
+ 'bpmn:TextAnnotation',
39265
+ 'bpmn-icon-text-annotation'
39266
+ )
39267
+ });
39268
+ }
39269
+
39270
+ if (
39271
+ isAny(businessObject, [
39272
+ 'bpmn:FlowNode',
39273
+ 'bpmn:InteractionNode',
39274
+ 'bpmn:DataObjectReference',
39275
+ 'bpmn:DataStoreReference',
39276
+ ])
39277
+ ) {
39278
+ assign$1(actions, {
39279
+ 'append.text-annotation': appendAction(
39280
+ 'bpmn:TextAnnotation',
39281
+ 'bpmn-icon-text-annotation'
39282
+ ),
39283
+
39284
+ 'connect': {
39285
+ group: 'connect',
39286
+ className: 'bpmn-icon-connection-multi',
39287
+ title: translate(
39288
+ 'Connect using ' +
39289
+ (businessObject.isForCompensation
39290
+ ? ''
39291
+ : 'Sequence/MessageFlow or ') +
39292
+ 'Association'
39293
+ ),
39294
+ action: {
39295
+ click: startConnect,
39296
+ dragstart: startConnect,
39297
+ },
39298
+ },
39299
+ });
39300
+ }
39301
+
39302
+ if (is$5(businessObject, 'bpmn:TextAnnotation')) {
39303
+ assign$1(actions, {
39304
+ 'connect': {
39305
+ group: 'connect',
39306
+ className: 'bpmn-icon-connection-multi',
39307
+ title: translate('Connect using Association'),
39308
+ action: {
39309
+ click: startConnect,
39310
+ dragstart: startConnect,
39311
+ },
39312
+ },
39313
+ });
39314
+ }
39315
+
39316
+ if (isAny(businessObject, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
39317
+ assign$1(actions, {
39318
+ 'connect': {
39319
+ group: 'connect',
39320
+ className: 'bpmn-icon-connection-multi',
39321
+ title: translate('Connect using DataInputAssociation'),
39322
+ action: {
39323
+ click: startConnect,
39324
+ dragstart: startConnect
39325
+ }
39326
+ }
39327
+ });
39328
+ }
39329
+
39330
+ if (is$5(businessObject, 'bpmn:Group')) {
39331
+ assign$1(actions, {
39332
+ 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation')
39333
+ });
39334
+ }
39335
+
39336
+ // delete element entry, only show if allowed by rules
39337
+ var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });
39338
+
39339
+ if (isArray$3(deleteAllowed)) {
39340
+
39341
+ // was the element returned as a deletion candidate?
39342
+ deleteAllowed = deleteAllowed[0] === element;
39343
+ }
39344
+
39345
+ if (deleteAllowed) {
39346
+ assign$1(actions, {
39347
+ 'delete': {
39348
+ group: 'edit',
39349
+ className: 'bpmn-icon-trash',
39350
+ title: translate('Remove'),
39351
+ action: {
39352
+ click: removeElement
39353
+ }
39354
+ }
39355
+ });
39356
+ }
39357
+
39358
+ return actions;
39359
+ };
39360
+
39361
+
39362
+ // helpers /////////
39363
+
39364
+ function isEventType(eventBo, type, definition) {
39365
+
39366
+ var isType = eventBo.$instanceOf(type);
39367
+ var isDefinition = false;
39368
+
39369
+ var definitions = eventBo.eventDefinitions || [];
39370
+ forEach$1(definitions, function(def) {
39371
+ if (def.$type === definition) {
39372
+ isDefinition = true;
39373
+ }
39374
+ });
39375
+
39376
+ return isType && isDefinition;
39377
+ }
39378
+
39379
+ function includes$7(array, item) {
39380
+ return array.indexOf(item) !== -1;
39381
+ }
39382
+
39383
+ var ContextPadModule = {
39384
+ __depends__: [
39385
+ DirectEditingModule,
39386
+ ContextPadModule$1,
39387
+ SelectionModule,
39388
+ ConnectModule,
39389
+ CreateModule,
39390
+ PopupMenuModule
39391
+ ],
39392
+ __init__: [ 'contextPadProvider' ],
39393
+ contextPadProvider: [ 'type', ContextPadProvider ]
39394
+ };
39395
+
39396
+ var TOGGLE_SELECTOR = '.djs-palette-toggle',
39397
+ ENTRY_SELECTOR = '.entry',
39398
+ ELEMENT_SELECTOR = TOGGLE_SELECTOR + ', ' + ENTRY_SELECTOR;
39399
+
39400
+ var PALETTE_PREFIX = 'djs-palette-',
39401
+ PALETTE_SHOWN_CLS = 'shown',
39402
+ PALETTE_OPEN_CLS = 'open',
39403
+ PALETTE_TWO_COLUMN_CLS = 'two-column';
39404
+
39405
+ var DEFAULT_PRIORITY$1 = 1000;
39406
+
39407
+
39408
+ /**
39409
+ * A palette containing modeling elements.
39410
+ */
39411
+ function Palette(eventBus, canvas) {
39412
+
39413
+ this._eventBus = eventBus;
39414
+ this._canvas = canvas;
39415
+
39416
+ var self = this;
39417
+
39418
+ eventBus.on('tool-manager.update', function(event) {
39419
+ var tool = event.tool;
39420
+
39421
+ self.updateToolHighlight(tool);
39422
+ });
39423
+
39424
+ eventBus.on('i18n.changed', function() {
39425
+ self._update();
39426
+ });
39427
+
39428
+ eventBus.on('diagram.init', function() {
39429
+
39430
+ self._diagramInitialized = true;
39431
+
39432
+ self._rebuild();
39433
+ });
39434
+ }
39435
+
39436
+ Palette.$inject = [ 'eventBus', 'canvas' ];
39437
+
39438
+
39439
+ /**
39440
+ * Register a provider with the palette
39441
+ *
39442
+ * @param {number} [priority=1000]
39443
+ * @param {PaletteProvider} provider
39444
+ *
39445
+ * @example
39446
+ * const paletteProvider = {
39447
+ * getPaletteEntries: function() {
39448
+ * return function(entries) {
39449
+ * return {
39450
+ * ...entries,
39451
+ * 'entry-1': {
39452
+ * label: 'My Entry',
39453
+ * action: function() { alert("I have been clicked!"); }
39454
+ * }
39455
+ * };
39456
+ * }
39457
+ * }
39458
+ * };
39459
+ *
39460
+ * palette.registerProvider(800, paletteProvider);
39461
+ */
39462
+ Palette.prototype.registerProvider = function(priority, provider) {
39463
+ if (!provider) {
39464
+ provider = priority;
39465
+ priority = DEFAULT_PRIORITY$1;
39466
+ }
39467
+
39468
+ this._eventBus.on('palette.getProviders', priority, function(event) {
39469
+ event.providers.push(provider);
39470
+ });
39471
+
39472
+ this._rebuild();
39473
+ };
39474
+
39475
+
39476
+ /**
39477
+ * Returns the palette entries
39478
+ *
39479
+ * @return {Object<string, PaletteEntryDescriptor>} map of entries
39480
+ */
39481
+ Palette.prototype.getEntries = function() {
39482
+ var providers = this._getProviders();
39483
+
39484
+ return providers.reduce(addPaletteEntries, {});
39485
+ };
39486
+
39487
+ Palette.prototype._rebuild = function() {
39488
+
39489
+ if (!this._diagramInitialized) {
39490
+ return;
39491
+ }
39492
+
39493
+ var providers = this._getProviders();
39494
+
39495
+ if (!providers.length) {
39496
+ return;
39497
+ }
39498
+
39499
+ if (!this._container) {
39500
+ this._init();
39501
+ }
39502
+
39503
+ this._update();
39504
+ };
39505
+
39506
+ /**
39507
+ * Initialize
39508
+ */
39509
+ Palette.prototype._init = function() {
39510
+
39511
+ var self = this;
39512
+
39513
+ var eventBus = this._eventBus;
39514
+
39515
+ var parentContainer = this._getParentContainer();
39516
+
39517
+ var container = this._container = domify$1(Palette.HTML_MARKUP);
39518
+
39519
+ parentContainer.appendChild(container);
39520
+ classes$1(parentContainer).add(PALETTE_PREFIX + PALETTE_SHOWN_CLS);
39521
+
39522
+ delegate.bind(container, ELEMENT_SELECTOR, 'click', function(event) {
39523
+
39524
+ var target = event.delegateTarget;
39525
+
39526
+ if (matches(target, TOGGLE_SELECTOR)) {
39527
+ return self.toggle();
39528
+ }
39529
+
39530
+ self.trigger('click', event);
39531
+ });
39532
+
39533
+ // prevent drag propagation
39534
+ event.bind(container, 'mousedown', function(event) {
39535
+ event.stopPropagation();
39536
+ });
39537
+
39538
+ // prevent drag propagation
39539
+ delegate.bind(container, ENTRY_SELECTOR, 'dragstart', function(event) {
39540
+ self.trigger('dragstart', event);
39541
+ });
39542
+
39543
+ eventBus.on('canvas.resized', this._layoutChanged, this);
39544
+
39545
+ eventBus.fire('palette.create', {
39546
+ container: container
39547
+ });
39548
+ };
39549
+
39550
+ Palette.prototype._getProviders = function(id) {
39551
+
39552
+ var event = this._eventBus.createEvent({
39553
+ type: 'palette.getProviders',
39554
+ providers: []
39555
+ });
39556
+
39557
+ this._eventBus.fire(event);
39558
+
39559
+ return event.providers;
39560
+ };
39561
+
39562
+ /**
39563
+ * Update palette state.
39564
+ *
39565
+ * @param {Object} [state] { open, twoColumn }
39566
+ */
39567
+ Palette.prototype._toggleState = function(state) {
39568
+
39569
+ state = state || {};
39570
+
39571
+ var parent = this._getParentContainer(),
39572
+ container = this._container;
39573
+
39574
+ var eventBus = this._eventBus;
39575
+
39576
+ var twoColumn;
39577
+
39578
+ var cls = classes$1(container),
39579
+ parentCls = classes$1(parent);
39580
+
39581
+ if ('twoColumn' in state) {
39582
+ twoColumn = state.twoColumn;
39583
+ } else {
39584
+ twoColumn = this._needsCollapse(parent.clientHeight, this._entries || {});
39585
+ }
39586
+
39587
+ // always update two column
39588
+ cls.toggle(PALETTE_TWO_COLUMN_CLS, twoColumn);
39589
+ parentCls.toggle(PALETTE_PREFIX + PALETTE_TWO_COLUMN_CLS, twoColumn);
39590
+
39591
+ if ('open' in state) {
39592
+ cls.toggle(PALETTE_OPEN_CLS, state.open);
39593
+ parentCls.toggle(PALETTE_PREFIX + PALETTE_OPEN_CLS, state.open);
39594
+ }
39595
+
39596
+ eventBus.fire('palette.changed', {
39597
+ twoColumn: twoColumn,
39598
+ open: this.isOpen()
39599
+ });
39600
+ };
39601
+
39602
+ Palette.prototype._update = function() {
39603
+
39604
+ var entriesContainer = query('.djs-palette-entries', this._container),
39605
+ entries = this._entries = this.getEntries();
39606
+
39607
+ clear$1(entriesContainer);
39608
+
39609
+ forEach$1(entries, function(entry, id) {
39610
+
39611
+ var grouping = entry.group || 'default';
39612
+
39613
+ var container = query('[data-group=' + cssEscape(grouping) + ']', entriesContainer);
39614
+ if (!container) {
39615
+ container = domify$1('<div class="group"></div>');
39616
+ attr$1(container, 'data-group', grouping);
39617
+
39618
+ entriesContainer.appendChild(container);
39619
+ }
39620
+
39621
+ var html = entry.html || (
39622
+ entry.separator ?
39623
+ '<hr class="separator" />' :
39624
+ '<div class="entry" draggable="true"></div>');
39625
+
39626
+
39627
+ var control = domify$1(html);
39628
+ container.appendChild(control);
39629
+
39630
+ if (!entry.separator) {
39631
+ attr$1(control, 'data-action', id);
39632
+
39633
+ if (entry.title) {
39634
+ attr$1(control, 'title', entry.title);
39635
+ }
39636
+
39637
+ if (entry.className) {
39638
+ addClasses(control, entry.className);
39639
+ }
39640
+
39641
+ if (entry.imageUrl) {
39642
+ var image = domify$1('<img>');
39643
+ attr$1(image, 'src', entry.imageUrl);
39644
+
39645
+ control.appendChild(image);
39646
+ }
39647
+ }
39648
+ });
39649
+
39650
+ // open after update
39651
+ this.open();
39652
+ };
39653
+
39654
+
39655
+ /**
39656
+ * Trigger an action available on the palette
39657
+ *
39658
+ * @param {string} action
39659
+ * @param {Event} event
39660
+ */
39661
+ Palette.prototype.trigger = function(action, event, autoActivate) {
39662
+ var entry,
39663
+ originalEvent,
39664
+ button = event.delegateTarget || event.target;
39665
+
39666
+ if (!button) {
39667
+ return event.preventDefault();
39668
+ }
39669
+
39670
+ entry = attr$1(button, 'data-action');
39671
+ originalEvent = event.originalEvent || event;
39672
+
39673
+ return this.triggerEntry(entry, action, originalEvent, autoActivate);
39674
+ };
39675
+
39676
+ Palette.prototype.triggerEntry = function(entryId, action, event, autoActivate) {
39677
+ var entries = this._entries,
39678
+ entry,
39679
+ handler;
39680
+
39681
+ entry = entries[entryId];
39682
+
39683
+ // when user clicks on the palette and not on an action
39684
+ if (!entry) {
39685
+ return;
39686
+ }
39687
+
39688
+ handler = entry.action;
39689
+
39690
+ // simple action (via callback function)
39691
+ if (isFunction(handler)) {
39692
+ if (action === 'click') {
39693
+ return handler(event, autoActivate);
39694
+ }
39695
+ } else {
39696
+ if (handler[action]) {
39697
+ return handler[action](event, autoActivate);
39698
+ }
39699
+ }
39700
+
39701
+ // silence other actions
39702
+ event.preventDefault();
39703
+ };
39704
+
39705
+ Palette.prototype._layoutChanged = function() {
39706
+ this._toggleState({});
39707
+ };
39708
+
39709
+ /**
39710
+ * Do we need to collapse to two columns?
39711
+ *
39712
+ * @param {number} availableHeight
39713
+ * @param {Object} entries
39714
+ *
39715
+ * @return {boolean}
39716
+ */
39717
+ Palette.prototype._needsCollapse = function(availableHeight, entries) {
39718
+
39719
+ // top margin + bottom toggle + bottom margin
39720
+ // implementors must override this method if they
39721
+ // change the palette styles
39722
+ var margin = 20 + 10 + 20;
39723
+
39724
+ var entriesHeight = Object.keys(entries).length * 46;
39725
+
39726
+ return availableHeight < entriesHeight + margin;
39727
+ };
39728
+
39729
+ /**
39730
+ * Close the palette
39731
+ */
39732
+ Palette.prototype.close = function() {
39733
+
39734
+ this._toggleState({
39735
+ open: false,
39736
+ twoColumn: false
39737
+ });
39738
+ };
39739
+
39740
+
39741
+ /**
39742
+ * Open the palette
39743
+ */
39744
+ Palette.prototype.open = function() {
39745
+ this._toggleState({ open: true });
39746
+ };
39747
+
39748
+
39749
+ Palette.prototype.toggle = function(open) {
39750
+ if (this.isOpen()) {
39751
+ this.close();
39752
+ } else {
39753
+ this.open();
39754
+ }
39755
+ };
39756
+
39757
+ Palette.prototype.isActiveTool = function(tool) {
39758
+ return tool && this._activeTool === tool;
39759
+ };
39760
+
39761
+ Palette.prototype.updateToolHighlight = function(name) {
39762
+ var entriesContainer,
39763
+ toolsContainer;
39764
+
39765
+ if (!this._toolsContainer) {
39766
+ entriesContainer = query('.djs-palette-entries', this._container);
39767
+
39768
+ this._toolsContainer = query('[data-group=tools]', entriesContainer);
39769
+ }
39770
+
39771
+ toolsContainer = this._toolsContainer;
39772
+
39773
+ forEach$1(toolsContainer.children, function(tool) {
39774
+ var actionName = tool.getAttribute('data-action');
39775
+
39776
+ if (!actionName) {
39777
+ return;
39778
+ }
39779
+
39780
+ var toolClasses = classes$1(tool);
39781
+
39782
+ actionName = actionName.replace('-tool', '');
39783
+
39784
+ if (toolClasses.contains('entry') && actionName === name) {
39785
+ toolClasses.add('highlighted-entry');
39786
+ } else {
39787
+ toolClasses.remove('highlighted-entry');
39788
+ }
39789
+ });
39790
+ };
39791
+
39792
+
39793
+ /**
39794
+ * Return true if the palette is opened.
39795
+ *
39796
+ * @example
39797
+ *
39798
+ * palette.open();
39799
+ *
39800
+ * if (palette.isOpen()) {
39801
+ * // yes, we are open
39802
+ * }
39803
+ *
39804
+ * @return {boolean} true if palette is opened
39805
+ */
39806
+ Palette.prototype.isOpen = function() {
39807
+ return classes$1(this._container).has(PALETTE_OPEN_CLS);
39808
+ };
39809
+
39810
+ /**
39811
+ * Get container the palette lives in.
39812
+ *
39813
+ * @return {Element}
39814
+ */
39815
+ Palette.prototype._getParentContainer = function() {
39816
+ return this._canvas.getContainer();
39817
+ };
39818
+
39819
+
39820
+ /* markup definition */
39821
+
39822
+ Palette.HTML_MARKUP =
39823
+ '<div class="djs-palette">' +
39824
+ '<div class="djs-palette-entries"></div>' +
39825
+ '<div class="djs-palette-toggle"></div>' +
39826
+ '</div>';
39827
+
39828
+
39829
+ // helpers //////////////////////
39830
+
39831
+ function addClasses(element, classNames) {
39832
+
39833
+ var classes = classes$1(element);
39834
+
39835
+ var actualClassNames = isArray$3(classNames) ? classNames : classNames.split(/\s+/g);
39836
+ actualClassNames.forEach(function(cls) {
39837
+ classes.add(cls);
39838
+ });
39839
+ }
39840
+
39841
+ function addPaletteEntries(entries, provider) {
39842
+
39843
+ var entriesOrUpdater = provider.getPaletteEntries();
39844
+
39845
+ if (isFunction(entriesOrUpdater)) {
39846
+ return entriesOrUpdater(entries);
39847
+ }
39848
+
39849
+ forEach$1(entriesOrUpdater, function(entry, id) {
39850
+ entries[id] = entry;
39851
+ });
39852
+
39853
+ return entries;
39854
+ }
39855
+
39856
+ var PaletteModule$1 = {
39857
+ __init__: [ 'palette' ],
39858
+ palette: [ 'type', Palette ]
39859
+ };
39860
+
39861
+ var EVENT_GROUP = {
39862
+ id: 'events',
39863
+ name: 'Events'
39864
+ };
39865
+
39866
+ var TASK_GROUP = {
39867
+ id: 'tasks',
39868
+ name: 'Tasks'
39869
+ };
39870
+
39871
+ var DATA_GROUP = {
39872
+ id: 'data',
39873
+ name: 'Data'
39874
+ };
39875
+
39876
+ var PARTICIPANT_GROUP = {
39877
+ id: 'participants',
39878
+ name: 'Participants'
39879
+ };
39880
+
39881
+ var SUBPROCESS_GROUP = {
39882
+ id: 'subprocess',
39883
+ name: 'Sub Processes'
39884
+ };
39885
+
39886
+ var GATEWAY_GROUP = {
39887
+ id: 'gateways',
39888
+ name: 'Gateways'
39889
+ };
39890
+
39891
+ var NONE_EVENTS = [
39892
+ {
39893
+ label: 'Start Event',
39894
+ actionName: 'none-start-event',
39895
+ className: 'bpmn-icon-start-event-none',
39896
+ target: {
39897
+ type: 'bpmn:StartEvent'
39898
+ }
39899
+ },
39900
+ {
39901
+ label: 'Intermediate Throw Event',
39902
+ actionName: 'none-intermediate-throwing',
39903
+ className: 'bpmn-icon-intermediate-event-none',
39904
+ target: {
39905
+ type: 'bpmn:IntermediateThrowEvent'
39906
+ }
39907
+ },
39908
+ {
39909
+ label: 'Boundary Event',
39910
+ actionName: 'none-boundary-event',
39911
+ className: 'bpmn-icon-intermediate-event-none',
39912
+ target: {
39913
+ type: 'bpmn:BoundaryEvent'
39914
+ }
39915
+ },
39916
+ {
39917
+ label: 'End Event',
39918
+ actionName: 'none-end-event',
39919
+ className: 'bpmn-icon-end-event-none',
39920
+ target: {
39921
+ type: 'bpmn:EndEvent'
39922
+ }
39923
+ }
39924
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39925
+
39926
+ var TYPED_START_EVENTS = [
39927
+ {
39928
+ label: 'Message Start Event',
39929
+ actionName: 'message-start',
39930
+ className: 'bpmn-icon-start-event-message',
39931
+ target: {
39932
+ type: 'bpmn:StartEvent',
39933
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39934
+ }
39935
+ },
39936
+ {
39937
+ label: 'Timer Start Event',
39938
+ actionName: 'timer-start',
39939
+ className: 'bpmn-icon-start-event-timer',
39940
+ target: {
39941
+ type: 'bpmn:StartEvent',
39942
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
39943
+ }
39944
+ },
39945
+ {
39946
+ label: 'Conditional Start Event',
39947
+ actionName: 'conditional-start',
39948
+ className: 'bpmn-icon-start-event-condition',
39949
+ target: {
39950
+ type: 'bpmn:StartEvent',
39951
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
39952
+ }
39953
+ },
39954
+ {
39955
+ label: 'Signal Start Event',
39956
+ actionName: 'signal-start',
39957
+ className: 'bpmn-icon-start-event-signal',
39958
+ target: {
39959
+ type: 'bpmn:StartEvent',
39960
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39961
+ }
39962
+ }
39963
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39964
+
39965
+ var TYPED_INTERMEDIATE_EVENT = [
39966
+ {
39967
+ label: 'Message Intermediate Catch Event',
39968
+ actionName: 'message-intermediate-catch',
39969
+ className: 'bpmn-icon-intermediate-event-catch-message',
39970
+ target: {
39971
+ type: 'bpmn:IntermediateCatchEvent',
39972
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39973
+ }
39974
+ },
39975
+ {
39976
+ label: 'Message Intermediate Throw Event',
39977
+ actionName: 'message-intermediate-throw',
39978
+ className: 'bpmn-icon-intermediate-event-throw-message',
39979
+ target: {
39980
+ type: 'bpmn:IntermediateThrowEvent',
39981
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39982
+ }
39983
+ },
39984
+ {
39985
+ label: 'Timer Intermediate Catch Event',
39986
+ actionName: 'timer-intermediate-catch',
39987
+ className: 'bpmn-icon-intermediate-event-catch-timer',
39988
+ target: {
39989
+ type: 'bpmn:IntermediateCatchEvent',
39990
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
39991
+ }
39992
+ },
39993
+ {
39994
+ label: 'Escalation Intermediate Throw Event',
39995
+ actionName: 'escalation-intermediate-throw',
39996
+ className: 'bpmn-icon-intermediate-event-throw-escalation',
39997
+ target: {
39998
+ type: 'bpmn:IntermediateThrowEvent',
39999
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
40000
+ }
40001
+ },
40002
+ {
40003
+ label: 'Conditional Intermediate Catch Event',
40004
+ actionName: 'conditional-intermediate-catch',
40005
+ className: 'bpmn-icon-intermediate-event-catch-condition',
40006
+ target: {
40007
+ type: 'bpmn:IntermediateCatchEvent',
40008
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
40009
+ }
40010
+ },
40011
+ {
40012
+ label: 'Link Intermediate Catch Event',
40013
+ actionName: 'link-intermediate-catch',
40014
+ className: 'bpmn-icon-intermediate-event-catch-link',
40015
+ target: {
40016
+ type: 'bpmn:IntermediateCatchEvent',
40017
+ eventDefinitionType: 'bpmn:LinkEventDefinition',
40018
+ eventDefinitionAttrs: {
40019
+ name: ''
40020
+ }
40021
+ }
40022
+ },
40023
+ {
40024
+ label: 'Link Intermediate Throw Event',
40025
+ actionName: 'link-intermediate-throw',
40026
+ className: 'bpmn-icon-intermediate-event-throw-link',
40027
+ target: {
40028
+ type: 'bpmn:IntermediateThrowEvent',
40029
+ eventDefinitionType: 'bpmn:LinkEventDefinition',
40030
+ eventDefinitionAttrs: {
40031
+ name: ''
40032
+ }
40033
+ }
40034
+ },
40035
+ {
40036
+ label: 'Compensation Intermediate Throw Event',
40037
+ actionName: 'compensation-intermediate-throw',
40038
+ className: 'bpmn-icon-intermediate-event-throw-compensation',
40039
+ target: {
40040
+ type: 'bpmn:IntermediateThrowEvent',
40041
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
40042
+ }
40043
+ },
40044
+ {
40045
+ label: 'Signal Intermediate Catch Event',
40046
+ actionName: 'signal-intermediate-catch',
40047
+ className: 'bpmn-icon-intermediate-event-catch-signal',
40048
+ target: {
40049
+ type: 'bpmn:IntermediateCatchEvent',
40050
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
40051
+ }
40052
+ },
40053
+ {
40054
+ label: 'Signal Intermediate Throw Event',
40055
+ actionName: 'signal-intermediate-throw',
40056
+ className: 'bpmn-icon-intermediate-event-throw-signal',
40057
+ target: {
40058
+ type: 'bpmn:IntermediateThrowEvent',
40059
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
40060
+ }
40061
+ }
40062
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
40063
+
40064
+ var TYPED_BOUNDARY_EVENT = [
40065
+ {
40066
+ label: 'Message Boundary Event',
40067
+ actionName: 'message-boundary',
40068
+ className: 'bpmn-icon-intermediate-event-catch-message',
40069
+ target: {
40070
+ type: 'bpmn:BoundaryEvent',
40071
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
40072
+ }
40073
+ },
40074
+ {
40075
+ label: 'Timer Boundary Event',
40076
+ actionName: 'timer-boundary',
40077
+ className: 'bpmn-icon-intermediate-event-catch-timer',
40078
+ target: {
40079
+ type: 'bpmn:BoundaryEvent',
40080
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
40081
+ }
40082
+ },
40083
+ {
40084
+ label: 'Escalation Boundary Event',
40085
+ actionName: 'escalation-boundary',
40086
+ className: 'bpmn-icon-intermediate-event-catch-escalation',
40087
+ target: {
40088
+ type: 'bpmn:BoundaryEvent',
40089
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
40090
+ }
40091
+ },
40092
+ {
40093
+ label: 'Conditional Boundary Event',
40094
+ actionName: 'conditional-boundary',
40095
+ className: 'bpmn-icon-intermediate-event-catch-condition',
40096
+ target: {
40097
+ type: 'bpmn:BoundaryEvent',
40098
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
40099
+ }
40100
+ },
40101
+ {
40102
+ label: 'Error Boundary Event',
40103
+ actionName: 'error-boundary',
40104
+ className: 'bpmn-icon-intermediate-event-catch-error',
40105
+ target: {
40106
+ type: 'bpmn:BoundaryEvent',
40107
+ eventDefinitionType: 'bpmn:ErrorEventDefinition'
40108
+ }
40109
+ },
40110
+ {
40111
+ label: 'Cancel Boundary Event',
40112
+ actionName: 'cancel-boundary',
40113
+ className: 'bpmn-icon-intermediate-event-catch-cancel',
40114
+ target: {
40115
+ type: 'bpmn:BoundaryEvent',
40116
+ eventDefinitionType: 'bpmn:CancelEventDefinition'
40117
+ }
40118
+ },
40119
+ {
40120
+ label: 'Signal Boundary Event',
40121
+ actionName: 'signal-boundary',
40122
+ className: 'bpmn-icon-intermediate-event-catch-signal',
40123
+ target: {
40124
+ type: 'bpmn:BoundaryEvent',
40125
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
40126
+ }
40127
+ },
40128
+ {
40129
+ label: 'Compensation Boundary Event',
40130
+ actionName: 'compensation-boundary',
40131
+ className: 'bpmn-icon-intermediate-event-catch-compensation',
40132
+ target: {
40133
+ type: 'bpmn:BoundaryEvent',
40134
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
40135
+ }
40136
+ },
40137
+ {
40138
+ label: 'Message Boundary Event (non-interrupting)',
40139
+ actionName: 'non-interrupting-message-boundary',
40140
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-message',
40141
+ target: {
40142
+ type: 'bpmn:BoundaryEvent',
40143
+ eventDefinitionType: 'bpmn:MessageEventDefinition',
40144
+ cancelActivity: false
40145
+ }
40146
+ },
40147
+ {
40148
+ label: 'Timer Boundary Event (non-interrupting)',
40149
+ actionName: 'non-interrupting-timer-boundary',
40150
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-timer',
40151
+ target: {
40152
+ type: 'bpmn:BoundaryEvent',
40153
+ eventDefinitionType: 'bpmn:TimerEventDefinition',
40154
+ cancelActivity: false
40155
+ }
40156
+ },
40157
+ {
40158
+ label: 'Escalation Boundary Event (non-interrupting)',
40159
+ actionName: 'non-interrupting-escalation-boundary',
40160
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-escalation',
40161
+ target: {
40162
+ type: 'bpmn:BoundaryEvent',
40163
+ eventDefinitionType: 'bpmn:EscalationEventDefinition',
40164
+ cancelActivity: false
40165
+ }
40166
+ },
40167
+ {
40168
+ label: 'Conditional Boundary Event (non-interrupting)',
40169
+ actionName: 'non-interrupting-conditional-boundary',
40170
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-condition',
40171
+ target: {
40172
+ type: 'bpmn:BoundaryEvent',
40173
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition',
40174
+ cancelActivity: false
40175
+ }
40176
+ },
40177
+ {
40178
+ label: 'Signal Boundary Event (non-interrupting)',
40179
+ actionName: 'non-interrupting-signal-boundary',
40180
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-signal',
40181
+ target: {
40182
+ type: 'bpmn:BoundaryEvent',
40183
+ eventDefinitionType: 'bpmn:SignalEventDefinition',
40184
+ cancelActivity: false
40185
+ }
40186
+ }
40187
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
40188
+
40189
+ var TYPED_END_EVENT = [
40190
+ {
40191
+ label: 'Message End Event',
40192
+ actionName: 'message-end',
40193
+ className: 'bpmn-icon-end-event-message',
40194
+ target: {
40195
+ type: 'bpmn:EndEvent',
40196
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
40197
+ }
40198
+ },
40199
+ {
40200
+ label: 'Escalation End Event',
40201
+ actionName: 'escalation-end',
40202
+ className: 'bpmn-icon-end-event-escalation',
40203
+ target: {
40204
+ type: 'bpmn:EndEvent',
40205
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
40206
+ }
40207
+ },
40208
+ {
40209
+ label: 'Error End Event',
40210
+ actionName: 'error-end',
40211
+ className: 'bpmn-icon-end-event-error',
40212
+ target: {
40213
+ type: 'bpmn:EndEvent',
40214
+ eventDefinitionType: 'bpmn:ErrorEventDefinition'
40215
+ }
40216
+ },
40217
+ {
40218
+ label: 'Cancel End Event',
40219
+ actionName: 'cancel-end',
40220
+ className: 'bpmn-icon-end-event-cancel',
40221
+ target: {
40222
+ type: 'bpmn:EndEvent',
40223
+ eventDefinitionType: 'bpmn:CancelEventDefinition'
40224
+ }
40225
+ },
40226
+ {
40227
+ label: 'Compensation End Event',
40228
+ actionName: 'compensation-end',
40229
+ className: 'bpmn-icon-end-event-compensation',
40230
+ target: {
40231
+ type: 'bpmn:EndEvent',
40232
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
40233
+ }
40234
+ },
40235
+ {
40236
+ label: 'Signal End Event',
40237
+ actionName: 'signal-end',
40238
+ className: 'bpmn-icon-end-event-signal',
40239
+ target: {
40240
+ type: 'bpmn:EndEvent',
40241
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
40242
+ }
40243
+ },
40244
+ {
40245
+ label: 'Terminate End Event',
40246
+ actionName: 'terminate-end',
40247
+ className: 'bpmn-icon-end-event-terminate',
40248
+ target: {
40249
+ type: 'bpmn:EndEvent',
40250
+ eventDefinitionType: 'bpmn:TerminateEventDefinition'
40251
+ }
40252
+ }
40253
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
40254
+
40255
+ var GATEWAY = [
40256
+ {
40257
+ label: 'Exclusive Gateway',
40258
+ actionName: 'exclusive-gateway',
40259
+ className: 'bpmn-icon-gateway-xor',
40260
+ target: {
40261
+ type: 'bpmn:ExclusiveGateway'
40262
+ }
40263
+ },
40264
+ {
40265
+ label: 'Parallel Gateway',
40266
+ actionName: 'parallel-gateway',
40267
+ className: 'bpmn-icon-gateway-parallel',
40268
+ target: {
40269
+ type: 'bpmn:ParallelGateway'
40270
+ }
40271
+ },
40272
+ {
40273
+ label: 'Inclusive Gateway',
40274
+ search: 'or',
40275
+ actionName: 'inclusive-gateway',
40276
+ className: 'bpmn-icon-gateway-or',
40277
+ target: {
40278
+ type: 'bpmn:InclusiveGateway'
40279
+ },
40280
+ rank: -1
40281
+ },
40282
+ {
40283
+ label: 'Complex Gateway',
40284
+ actionName: 'complex-gateway',
40285
+ className: 'bpmn-icon-gateway-complex',
40286
+ target: {
40287
+ type: 'bpmn:ComplexGateway'
40288
+ },
40289
+ rank: -1
40290
+ },
40291
+ {
40292
+ label: 'Event based Gateway',
40293
+ actionName: 'event-based-gateway',
40294
+ className: 'bpmn-icon-gateway-eventbased',
40295
+ target: {
40296
+ type: 'bpmn:EventBasedGateway',
40297
+ instantiate: false,
40298
+ eventGatewayType: 'Exclusive'
40299
+ }
40300
+ }
40301
+ ].map(option => ({ ...option, group: GATEWAY_GROUP }));
40302
+
40303
+ var SUBPROCESS = [
40304
+ {
40305
+ label: 'Transaction',
40306
+ actionName: 'transaction',
40307
+ className: 'bpmn-icon-transaction',
40308
+ target: {
40309
+ type: 'bpmn:Transaction',
40310
+ isExpanded: true
40311
+ }
40312
+ },
40313
+ {
40314
+ label: 'Event Sub Process',
40315
+ search: 'subprocess',
40316
+ actionName: 'event-subprocess',
40317
+ className: 'bpmn-icon-event-subprocess-expanded',
40318
+ target: {
40319
+ type: 'bpmn:SubProcess',
40320
+ triggeredByEvent: true,
40321
+ isExpanded: true
40322
+ }
40323
+ },
40324
+ {
40325
+ label: 'Sub Process (collapsed)',
40326
+ search: 'subprocess',
40327
+ actionName: 'collapsed-subprocess',
40328
+ className: 'bpmn-icon-subprocess-collapsed',
40329
+ target: {
40330
+ type: 'bpmn:SubProcess',
40331
+ isExpanded: false
40332
+ }
40333
+ },
40334
+ {
40335
+ label: 'Sub Process (expanded)',
40336
+ search: 'subprocess',
40337
+ actionName: 'expanded-subprocess',
40338
+ className: 'bpmn-icon-subprocess-collapsed',
40339
+ target: {
40340
+ type: 'bpmn:SubProcess',
40341
+ isExpanded: true
40342
+ }
40343
+ }
40344
+ ].map(option => ({ ...option, group: SUBPROCESS_GROUP }));
40345
+
40346
+ var TASK = [
40347
+ {
40348
+ label: 'Task',
40349
+ actionName: 'task',
40350
+ className: 'bpmn-icon-task',
40351
+ target: {
40352
+ type: 'bpmn:Task'
40353
+ }
40354
+ },
40355
+ {
40356
+ label: 'User Task',
40357
+ actionName: 'user-task',
40358
+ className: 'bpmn-icon-user',
40359
+ target: {
40360
+ type: 'bpmn:UserTask'
40361
+ }
40362
+ },
40363
+ {
40364
+ label: 'Service Task',
40365
+ actionName: 'service-task',
40366
+ className: 'bpmn-icon-service',
40367
+ target: {
40368
+ type: 'bpmn:ServiceTask'
40369
+ }
40370
+ },
40371
+ {
40372
+ label: 'Send Task',
40373
+ actionName: 'send-task',
40374
+ className: 'bpmn-icon-send',
40375
+ target: {
40376
+ type: 'bpmn:SendTask'
40377
+ },
40378
+ rank: -1
40379
+ },
40380
+ {
40381
+ label: 'Receive Task',
40382
+ actionName: 'receive-task',
40383
+ className: 'bpmn-icon-receive',
40384
+ target: {
40385
+ type: 'bpmn:ReceiveTask'
40386
+ },
40387
+ rank: -1
40388
+ },
40389
+ {
40390
+ label: 'Manual Task',
40391
+ actionName: 'manual-task',
40392
+ className: 'bpmn-icon-manual',
40393
+ target: {
40394
+ type: 'bpmn:ManualTask'
40395
+ },
40396
+ rank: -1
40397
+ },
40398
+ {
40399
+ label: 'Business Rule Task',
40400
+ actionName: 'rule-task',
40401
+ className: 'bpmn-icon-business-rule',
40402
+ target: {
40403
+ type: 'bpmn:BusinessRuleTask'
40404
+ }
40405
+ },
40406
+ {
40407
+ label: 'Script Task',
40408
+ actionName: 'script-task',
40409
+ className: 'bpmn-icon-script',
40410
+ target: {
40411
+ type: 'bpmn:ScriptTask'
40412
+ }
40413
+ },
40414
+ {
40415
+ label: 'Call Activity',
40416
+ actionName: 'call-activity',
40417
+ className: 'bpmn-icon-call-activity',
40418
+ target: {
40419
+ type: 'bpmn:CallActivity'
40420
+ }
40421
+ }
40422
+ ].map(option => ({ ...option, group: TASK_GROUP }));
40423
+
40424
+ var DATA_OBJECTS = [
40425
+ {
40426
+ label: 'Data Store Reference',
40427
+ actionName: 'data-store-reference',
40428
+ className: 'bpmn-icon-data-store',
40429
+ target: {
40430
+ type: 'bpmn:DataStoreReference'
40431
+ }
40432
+ },
40433
+ {
40434
+ label: 'Data Object Reference',
40435
+ actionName: 'data-object-reference',
40436
+ className: 'bpmn-icon-data-object',
40437
+ target: {
40438
+ type: 'bpmn:DataObjectReference'
40439
+ }
40440
+ }
40441
+ ].map(option => ({ ...option, group: DATA_GROUP }));
40442
+
40443
+ var PARTICIPANT = [
40444
+ {
40445
+ label: 'Expanded Pool',
40446
+ search: 'Participant',
40447
+ actionName: 'expanded-pool',
40448
+ className: 'bpmn-icon-participant',
40449
+ target: {
40450
+ type: 'bpmn:Participant',
40451
+ isExpanded: true
40452
+ }
40453
+ },
40454
+ {
40455
+ label: 'Empty Pool',
40456
+ search: 'Collapsed Participant',
40457
+ actionName: 'collapsed-pool',
40458
+ className: 'bpmn-icon-lane',
40459
+ target: {
40460
+ type: 'bpmn:Participant',
40461
+ isExpanded: false
40462
+ }
40463
+ }
40464
+ ].map(option => ({ ...option, group: PARTICIPANT_GROUP }));
40465
+
40466
+ var CREATE_OPTIONS = [
40467
+ ...GATEWAY,
40468
+ ...TASK,
40469
+ ...SUBPROCESS,
40470
+ ...NONE_EVENTS,
40471
+ ...TYPED_START_EVENTS,
40472
+ ...TYPED_INTERMEDIATE_EVENT,
40473
+ ...TYPED_END_EVENT,
40474
+ ...TYPED_BOUNDARY_EVENT,
40475
+ ...DATA_OBJECTS,
40476
+ ...PARTICIPANT
40477
+ ];
40478
+
40479
+ /**
40480
+ * This module is a create menu provider for the popup menu.
40481
+ */
40482
+ function CreateMenuProvider(
40483
+ elementFactory, popupMenu, create,
40484
+ autoPlace, mouse, translate
40485
+ ) {
40486
+ this._elementFactory = elementFactory;
40487
+ this._popupMenu = popupMenu;
40488
+ this._create = create;
40489
+ this._autoPlace = autoPlace;
40490
+ this._mouse = mouse;
40491
+ this._translate = translate;
40492
+
40493
+ this.register();
40494
+ }
40495
+
40496
+ CreateMenuProvider.$inject = [
40497
+ 'elementFactory',
40498
+ 'popupMenu',
40499
+ 'create',
40500
+ 'autoPlace',
40501
+ 'mouse',
40502
+ 'translate'
40503
+ ];
40504
+
40505
+ /**
40506
+ * Register create menu provider in the popup menu
40507
+ */
40508
+ CreateMenuProvider.prototype.register = function() {
40509
+ this._popupMenu.registerProvider('bpmn-create', this);
40510
+ };
40511
+
40512
+ /**
40513
+ * Get all entries
40514
+ *
40515
+ * @param {djs.model.Base} element
40516
+ *
40517
+ * @return {Array<Object>} a list of menu entry items
40518
+ */
40519
+ CreateMenuProvider.prototype.getPopupMenuEntries = function() {
40520
+
40521
+ const entries = {};
40522
+
40523
+ // map options to menu entries
40524
+ CREATE_OPTIONS.forEach(option => {
40525
+ const {
40526
+ actionName,
40527
+ className,
40528
+ label,
40529
+ target,
40530
+ description,
40531
+ group,
40532
+ search,
40533
+ rank
40534
+ } = option;
40535
+
40536
+ const targetAction = this._createEntryAction(target);
40537
+
40538
+ entries[`create-${actionName}`] = {
40539
+ label: label && this._translate(label),
40540
+ className,
40541
+ description,
40542
+ group: group && {
40543
+ ...group,
40544
+ name: this._translate(group.name)
40545
+ },
40546
+ search,
40547
+ rank,
40548
+ action: {
40549
+ click: targetAction,
40550
+ dragstart: targetAction
40551
+ }
40552
+ };
40553
+ });
40554
+
40555
+ return entries;
40556
+ };
40557
+
40558
+ /**
40559
+ * Create an action for a given target
40560
+ *
40561
+ * @param {Object} target
40562
+ * @returns {Object}
40563
+ */
40564
+ CreateMenuProvider.prototype._createEntryAction = function(target) {
40565
+
40566
+ const create = this._create;
40567
+ const mouse = this._mouse;
40568
+ const popupMenu = this._popupMenu;
40569
+ const elementFactory = this._elementFactory;
40570
+
40571
+ let newElement;
40572
+
40573
+ return (event) => {
40574
+ popupMenu.close();
40575
+
40576
+ // create the new element
40577
+ if (target.type === 'bpmn:Participant') {
40578
+ newElement = elementFactory.createParticipantShape(target);
40579
+ } else {
40580
+ newElement = elementFactory.create('shape', target);
40581
+ }
40582
+
40583
+ // use last mouse event if triggered via keyboard
40584
+ if (event instanceof KeyboardEvent) {
40585
+ event = mouse.getLastMoveEvent();
40586
+ }
40587
+
40588
+ return create.start(event, newElement);
40589
+ };
40590
+ };
40591
+
40592
+ /**
40593
+ * To change the icons, modify the SVGs in `./resources`, execute `npx svgo -f resources --datauri enc -o dist`,
40594
+ * and then replace respective icons with the optimized data URIs in `./dist`.
40595
+ */
40596
+ 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';
40597
+ 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';
40598
+
40599
+ /**
40600
+ * A palette provider for the create elements menu.
40601
+ */
40602
+ function CreatePaletteProvider(palette, translate, popupMenu, canvas, mouse) {
40603
+ this._translate = translate;
40604
+ this._popupMenu = popupMenu;
40605
+ this._canvas = canvas;
40606
+ this._mouse = mouse;
40607
+
40608
+ palette.registerProvider(this);
40609
+ }
40610
+
40611
+ CreatePaletteProvider.$inject = [
40612
+ 'palette',
40613
+ 'translate',
40614
+ 'popupMenu',
40615
+ 'canvas',
40616
+ 'mouse'
40617
+ ];
40618
+
40619
+
40620
+ CreatePaletteProvider.prototype.getPaletteEntries = function(element) {
40621
+ const actions = {},
40622
+ translate = this._translate,
40623
+ popupMenu = this._popupMenu,
40624
+ canvas = this._canvas,
40625
+ mouse = this._mouse;
40626
+
40627
+ const getPosition = (event) => {
40628
+ const X_OFFSET = 35;
40629
+ const Y_OFFSET = 10;
40630
+
40631
+ if (event instanceof KeyboardEvent) {
40632
+ event = mouse.getLastMoveEvent();
40633
+ return { x: event.x, y: event.y };
40634
+ }
40635
+
40636
+ const target = event && event.target || query('.djs-palette [data-action="create"]');
40637
+ const targetPosition = target.getBoundingClientRect();
40638
+
40639
+ return target && {
40640
+ x: targetPosition.left + targetPosition.width / 2 + X_OFFSET,
40641
+ y: targetPosition.top + targetPosition.height / 2 + Y_OFFSET
40642
+ };
40643
+ };
40644
+
40645
+ assign$1(actions, {
40646
+ 'create': {
40647
+ group: 'create',
40648
+ imageUrl: createIcon,
40649
+ title: translate('Create element'),
40650
+ action: {
40651
+ click: function(event) {
40652
+ const position = getPosition(event);
40653
+
40654
+ const element = canvas.getRootElement();
40655
+
40656
+ popupMenu.open(element, 'bpmn-create', position, {
40657
+ title: translate('Create element'),
40658
+ width: 300,
40659
+ search: true
40660
+ });
40661
+ }
40662
+ }
40663
+ },
40664
+ });
40665
+
40666
+ return actions;
40667
+ };
40668
+
40669
+ /**
40670
+ * Registers and executes BPMN specific editor actions.
40671
+ *
40672
+ * @param {Injector} injector
40673
+ */
40674
+ function CreateAppendEditorActions(injector) {
40675
+ this._injector = injector;
40676
+
40677
+ this.registerActions();
40678
+ }
40679
+
40680
+ CreateAppendEditorActions.$inject = [
40681
+ 'injector'
40682
+ ];
40683
+
40684
+ /**
40685
+ * Register actions.
40686
+ *
40687
+ * @param {Injector} injector
40688
+ */
40689
+ CreateAppendEditorActions.prototype.registerActions = function() {
40690
+ var editorActions = this._injector.get('editorActions', false);
40691
+ var selection = this._injector.get('selection', false);
40692
+ var contextPad = this._injector.get('contextPad', false);
40693
+ var palette = this._injector.get('palette', false);
40694
+
40695
+ const actions = {};
40696
+
40697
+ // append
40698
+ if (selection && contextPad) {
40699
+ assign$1(actions, {
40700
+ 'appendElement': function(event) {
40701
+ contextPad.triggerEntry('append', 'click', event);
40702
+ } }
40703
+ );
40704
+ }
40705
+
40706
+ // create
40707
+ if (palette) {
40708
+ assign$1(actions, {
40709
+ 'createElement': function(event) {
40710
+ palette.triggerEntry('create', 'click', event);
40711
+ } }
40712
+ );
40713
+ }
40714
+
40715
+ editorActions && editorActions.register(actions);
40716
+
38878
40717
  };
38879
40718
 
38880
40719
  /**
38881
- * @param {djs.model.Base[]} elements
38882
- * @return {boolean}
40720
+ * BPMN 2.0 specific keyboard bindings.
40721
+ *
40722
+ * @param {Injector} injector
38883
40723
  */
38884
- ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
40724
+ function CreateAppendKeyboardBindings(injector) {
38885
40725
 
38886
- var baseAllowed = this._rules.allowed('elements.delete', {
38887
- elements: elements
38888
- });
40726
+ this._injector = injector;
40727
+ this._keyboard = this._injector.get('keyboard', false);
40728
+ this._editorActions = this._injector.get('editorActions', false);
40729
+ this._selection = this._injector.get('selection', false);
38889
40730
 
38890
- if (isArray$3(baseAllowed)) {
38891
- return every(baseAllowed, function(element) {
38892
- return includes$7(baseAllowed, element);
38893
- });
40731
+ if (this._keyboard) {
40732
+ this._injector.invoke(KeyboardBindings, this);
38894
40733
  }
40734
+ }
38895
40735
 
38896
- return baseAllowed;
38897
- };
40736
+ e$6(CreateAppendKeyboardBindings, KeyboardBindings);
38898
40737
 
38899
- ContextPadProvider.prototype.getContextPadEntries = function(element) {
38900
- var contextPad = this._contextPad,
38901
- modeling = this._modeling,
40738
+ CreateAppendKeyboardBindings.$inject = [
40739
+ 'injector'
40740
+ ];
38902
40741
 
38903
- elementFactory = this._elementFactory,
38904
- connect = this._connect,
38905
- create = this._create,
38906
- popupMenu = this._popupMenu,
38907
- rules = this._rules,
38908
- autoPlace = this._autoPlace,
38909
- translate = this._translate;
38910
40742
 
38911
- var actions = {};
40743
+ /**
40744
+ * Register available keyboard bindings.
40745
+ *
40746
+ * @param {Keyboard} keyboard
40747
+ * @param {EditorActions} editorActions
40748
+ */
40749
+ CreateAppendKeyboardBindings.prototype.registerBindings = function() {
38912
40750
 
38913
- if (element.type === 'label') {
38914
- return actions;
38915
- }
40751
+ var keyboard = this._keyboard;
40752
+ var editorActions = this._editorActions;
40753
+ var selection = this._selection;
38916
40754
 
38917
- var businessObject = element.businessObject;
40755
+ // inherit default bindings
40756
+ KeyboardBindings.prototype.registerBindings.call(this, keyboard, editorActions);
38918
40757
 
38919
- function startConnect(event, element) {
38920
- connect.start(event, element);
38921
- }
40758
+ /**
40759
+ * Add keyboard binding if respective editor action
40760
+ * is registered.
40761
+ *
40762
+ * @param {string} action name
40763
+ * @param {Function} fn that implements the key binding
40764
+ */
40765
+ function addListener(action, fn) {
38922
40766
 
38923
- function removeElement(e, element) {
38924
- modeling.removeElements([ element ]);
40767
+ if (editorActions && editorActions.isRegistered(action)) {
40768
+ keyboard && keyboard.addListener(fn);
40769
+ }
38925
40770
  }
38926
40771
 
38927
- function getReplaceMenuPosition(element) {
40772
+ // activate append/create element
40773
+ // A
40774
+ addListener('appendElement', function(context) {
38928
40775
 
38929
- var Y_OFFSET = 5;
40776
+ var event = context.keyEvent;
38930
40777
 
38931
- var pad = contextPad.getPad(element).html;
40778
+ if (keyboard && keyboard.hasModifier(event)) {
40779
+ return;
40780
+ }
38932
40781
 
38933
- var padRect = pad.getBoundingClientRect();
40782
+ if (keyboard && keyboard.isKey([ 'a', 'A' ], event)) {
38934
40783
 
38935
- var pos = {
38936
- x: padRect.left,
38937
- y: padRect.bottom + Y_OFFSET
38938
- };
40784
+ if (selection && selection.get().length == 1) {
40785
+ editorActions && editorActions.trigger('appendElement', event);
40786
+ } else {
40787
+ editorActions && editorActions.trigger('createElement', event);
40788
+ }
38939
40789
 
38940
- return pos;
38941
- }
40790
+ return true;
40791
+ }
40792
+ });
38942
40793
 
40794
+ // N
40795
+ addListener('createElement', function(context) {
38943
40796
 
38944
- /**
38945
- * Create an append action
38946
- *
38947
- * @param {string} type
38948
- * @param {string} className
38949
- * @param {string} [title]
38950
- * @param {Object} [options]
38951
- *
38952
- * @return {Object} descriptor
38953
- */
38954
- function appendAction(type, className, title, options) {
40797
+ var event = context.keyEvent;
38955
40798
 
38956
- if (typeof title !== 'string') {
38957
- options = title;
38958
- title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') });
40799
+ if (keyboard && keyboard.hasModifier(event)) {
40800
+ return;
38959
40801
  }
38960
40802
 
38961
- function appendStart(event, element) {
40803
+ if (keyboard && keyboard.isKey([ 'n', 'N' ], event)) {
40804
+ editorActions && editorActions.trigger('createElement', event);
38962
40805
 
38963
- var shape = elementFactory.createShape(assign$1({ type: type }, options));
38964
- create.start(event, shape, {
38965
- source: element
38966
- });
40806
+ return true;
38967
40807
  }
40808
+ });
38968
40809
 
40810
+ };
38969
40811
 
38970
- var append = autoPlace ? function(event, element) {
38971
- var shape = elementFactory.createShape(assign$1({ type: type }, options));
40812
+ /**
40813
+ * This module is an append menu provider for the popup menu.
40814
+ */
40815
+ function AppendMenuProvider(
40816
+ elementFactory,
40817
+ popupMenu,
40818
+ create,
40819
+ autoPlace,
40820
+ rules,
40821
+ mouse
40822
+ ) {
40823
+ this._elementFactory = elementFactory;
40824
+ this._popupMenu = popupMenu;
40825
+ this._create = create;
40826
+ this._autoPlace = autoPlace;
40827
+ this._rules = rules;
40828
+ this._create = create;
40829
+ this._mouse = mouse;
38972
40830
 
38973
- autoPlace.append(element, shape);
38974
- } : appendStart;
40831
+ this.register();
40832
+ }
40833
+
40834
+ AppendMenuProvider.$inject = [
40835
+ 'elementFactory',
40836
+ 'popupMenu',
40837
+ 'create',
40838
+ 'autoPlace',
40839
+ 'rules',
40840
+ 'mouse'
40841
+ ];
38975
40842
 
40843
+ /**
40844
+ * Register append menu provider in the popup menu
40845
+ */
40846
+ AppendMenuProvider.prototype.register = function() {
40847
+ this._popupMenu.registerProvider('bpmn-append', this);
40848
+ };
38976
40849
 
38977
- return {
38978
- group: 'model',
38979
- className: className,
38980
- title: title,
38981
- action: {
38982
- dragstart: appendStart,
38983
- click: append
38984
- }
38985
- };
38986
- }
40850
+ /**
40851
+ * Get all entries from createOptions for the given element.
40852
+ *
40853
+ * @param {djs.model.Base} element
40854
+ *
40855
+ * @return {Array<Object>} a list of menu entry items
40856
+ */
40857
+ AppendMenuProvider.prototype.getPopupMenuEntries = function(element) {
40858
+ const rules = this._rules;
40859
+ const entries = {};
38987
40860
 
38988
- function splitLaneHandler(count) {
40861
+ if (!rules.allowed('shape.append', { element: element })) {
40862
+ return [];
40863
+ }
38989
40864
 
38990
- return function(event, element) {
40865
+ // filter out elements with no incoming connections
40866
+ const appendOptions = this._filterEntries(CREATE_OPTIONS);
38991
40867
 
38992
- // actual split
38993
- modeling.splitLane(element, count);
40868
+ // map options to menu entries
40869
+ appendOptions.forEach(option => {
40870
+ const {
40871
+ actionName,
40872
+ className,
40873
+ label,
40874
+ target,
40875
+ description,
40876
+ group,
40877
+ search,
40878
+ rank
40879
+ } = option;
38994
40880
 
38995
- // refresh context pad after split to
38996
- // get rid of split icons
38997
- contextPad.open(element, true);
40881
+ entries[`append-${actionName}`] = {
40882
+ label,
40883
+ className,
40884
+ description,
40885
+ group,
40886
+ search,
40887
+ rank,
40888
+ action: this._createEntryAction(element, target)
38998
40889
  };
38999
- }
40890
+ });
39000
40891
 
40892
+ return entries;
40893
+ };
39001
40894
 
39002
- if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) {
40895
+ /**
40896
+ * Filter out entries from the options.
40897
+ *
40898
+ * @param {Array<Object>} entries
40899
+ *
40900
+ * @return {Array<Object>} filtered entries
40901
+ */
40902
+ AppendMenuProvider.prototype._filterEntries = function(entries) {
40903
+ return entries.filter(option => {
39003
40904
 
39004
- var childLanes = getChildLanes(element);
40905
+ const target = option.target;
40906
+ const {
40907
+ type,
40908
+ eventDefinitionType
40909
+ } = target;
40910
+
40911
+ if ([
40912
+ 'bpmn:StartEvent',
40913
+ 'bpmn:Participant'
40914
+ ].includes(type)) {
40915
+ return false;
40916
+ }
39005
40917
 
39006
- assign$1(actions, {
39007
- 'lane-insert-above': {
39008
- group: 'lane-insert-above',
39009
- className: 'bpmn-icon-lane-insert-above',
39010
- title: translate('Add Lane above'),
39011
- action: {
39012
- click: function(event, element) {
39013
- modeling.addLane(element, 'top');
39014
- }
39015
- }
39016
- }
39017
- });
40918
+ if (type === 'bpmn:BoundaryEvent' && isUndefined$2(eventDefinitionType)) {
40919
+ return false;
40920
+ }
39018
40921
 
39019
- if (childLanes.length < 2) {
40922
+ return true;
40923
+ });
40924
+ };
39020
40925
 
39021
- if (element.height >= 120) {
39022
- assign$1(actions, {
39023
- 'lane-divide-two': {
39024
- group: 'lane-divide',
39025
- className: 'bpmn-icon-lane-divide-two',
39026
- title: translate('Divide into two Lanes'),
39027
- action: {
39028
- click: splitLaneHandler(2)
39029
- }
39030
- }
39031
- });
39032
- }
40926
+ /**
40927
+ * Create an action for a given target.
40928
+ *
40929
+ * @param {djs.model.Base} element
40930
+ * @param {Object} target
40931
+ *
40932
+ * @return {Object}
40933
+ */
40934
+ AppendMenuProvider.prototype._createEntryAction = function(element, target) {
40935
+ const elementFactory = this._elementFactory;
40936
+ const autoPlace = this._autoPlace;
40937
+ const create = this._create;
40938
+ const mouse = this._mouse;
39033
40939
 
39034
- if (element.height >= 180) {
39035
- assign$1(actions, {
39036
- 'lane-divide-three': {
39037
- group: 'lane-divide',
39038
- className: 'bpmn-icon-lane-divide-three',
39039
- title: translate('Divide into three Lanes'),
39040
- action: {
39041
- click: splitLaneHandler(3)
39042
- }
39043
- }
39044
- });
39045
- }
40940
+
40941
+ const autoPlaceElement = () => {
40942
+ const newElement = elementFactory.create('shape', target);
40943
+ autoPlace.append(element, newElement);
40944
+ };
40945
+
40946
+ const manualPlaceElement = (event) => {
40947
+ const newElement = elementFactory.create('shape', target);
40948
+
40949
+ if (event instanceof KeyboardEvent) {
40950
+ event = mouse.getLastMoveEvent();
39046
40951
  }
39047
40952
 
39048
- assign$1(actions, {
39049
- 'lane-insert-below': {
39050
- group: 'lane-insert-below',
39051
- className: 'bpmn-icon-lane-insert-below',
39052
- title: translate('Add Lane below'),
39053
- action: {
39054
- click: function(event, element) {
39055
- modeling.addLane(element, 'bottom');
39056
- }
39057
- }
39058
- }
39059
- });
40953
+ return create.start(event, newElement);
40954
+ };
40955
+
40956
+ return {
40957
+ click: this._canAutoPlaceElement(target) ? autoPlaceElement : manualPlaceElement,
40958
+ dragstart: manualPlaceElement
40959
+ };
40960
+ };
40961
+
40962
+ /**
40963
+ * Check if the element should be auto placed.
40964
+ *
40965
+ * @param {Object} target
40966
+ *
40967
+ * @return {Boolean}
40968
+ */
40969
+ AppendMenuProvider.prototype._canAutoPlaceElement = (target) => {
40970
+ const { type } = target;
39060
40971
 
40972
+ if (type === 'bpmn:BoundaryEvent') {
40973
+ return false;
39061
40974
  }
39062
40975
 
39063
- if (is$5(businessObject, 'bpmn:FlowNode')) {
40976
+ if (type === 'bpmn:SubProcess' && target.triggeredByEvent) {
40977
+ return false;
40978
+ }
39064
40979
 
39065
- if (is$5(businessObject, 'bpmn:EventBasedGateway')) {
40980
+ if (type === 'bpmn:IntermediateCatchEvent' && target.eventDefinitionType === 'bpmn:LinkEventDefinition') {
40981
+ return false;
40982
+ }
39066
40983
 
39067
- assign$1(actions, {
39068
- 'append.receive-task': appendAction(
39069
- 'bpmn:ReceiveTask',
39070
- 'bpmn-icon-receive-task',
39071
- translate('Append ReceiveTask')
39072
- ),
39073
- 'append.message-intermediate-event': appendAction(
39074
- 'bpmn:IntermediateCatchEvent',
39075
- 'bpmn-icon-intermediate-event-catch-message',
39076
- translate('Append MessageIntermediateCatchEvent'),
39077
- { eventDefinitionType: 'bpmn:MessageEventDefinition' }
39078
- ),
39079
- 'append.timer-intermediate-event': appendAction(
39080
- 'bpmn:IntermediateCatchEvent',
39081
- 'bpmn-icon-intermediate-event-catch-timer',
39082
- translate('Append TimerIntermediateCatchEvent'),
39083
- { eventDefinitionType: 'bpmn:TimerEventDefinition' }
39084
- ),
39085
- 'append.condition-intermediate-event': appendAction(
39086
- 'bpmn:IntermediateCatchEvent',
39087
- 'bpmn-icon-intermediate-event-catch-condition',
39088
- translate('Append ConditionIntermediateCatchEvent'),
39089
- { eventDefinitionType: 'bpmn:ConditionalEventDefinition' }
39090
- ),
39091
- 'append.signal-intermediate-event': appendAction(
39092
- 'bpmn:IntermediateCatchEvent',
39093
- 'bpmn-icon-intermediate-event-catch-signal',
39094
- translate('Append SignalIntermediateCatchEvent'),
39095
- { eventDefinitionType: 'bpmn:SignalEventDefinition' }
39096
- )
39097
- });
39098
- } else
40984
+ return true;
40985
+ };
39099
40986
 
39100
- if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
40987
+ /**
40988
+ * A provider for align elements context pad button
40989
+ */
40990
+ function AppendContextPadProvider(contextPad, popupMenu, translate, canvas) {
40991
+ this._contextPad = contextPad;
40992
+ this._popupMenu = popupMenu;
40993
+ this._translate = translate;
40994
+ this._canvas = canvas;
39101
40995
 
39102
- assign$1(actions, {
39103
- 'append.compensation-activity':
39104
- appendAction(
39105
- 'bpmn:Task',
39106
- 'bpmn-icon-task',
39107
- translate('Append compensation activity'),
39108
- {
39109
- isForCompensation: true
39110
- }
39111
- )
39112
- });
39113
- } else
40996
+ contextPad.registerProvider(this);
40997
+ }
39114
40998
 
39115
- if (!is$5(businessObject, 'bpmn:EndEvent') &&
39116
- !businessObject.isForCompensation &&
39117
- !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
39118
- !isEventSubProcess(businessObject)) {
40999
+ AppendContextPadProvider.$inject = [
41000
+ 'contextPad',
41001
+ 'popupMenu',
41002
+ 'translate',
41003
+ 'canvas'
41004
+ ];
39119
41005
 
39120
- assign$1(actions, {
39121
- 'append.end-event': appendAction(
39122
- 'bpmn:EndEvent',
39123
- 'bpmn-icon-end-event-none',
39124
- translate('Append EndEvent')
39125
- ),
39126
- 'append.gateway': appendAction(
39127
- 'bpmn:ExclusiveGateway',
39128
- 'bpmn-icon-gateway-none',
39129
- translate('Append Gateway')
39130
- ),
39131
- 'append.append-task': appendAction(
39132
- 'bpmn:Task',
39133
- 'bpmn-icon-task',
39134
- translate('Append Task')
39135
- ),
39136
- 'append.intermediate-event': appendAction(
39137
- 'bpmn:IntermediateThrowEvent',
39138
- 'bpmn-icon-intermediate-event-none',
39139
- translate('Append Intermediate/Boundary Event')
39140
- )
39141
- });
39142
- }
39143
- }
41006
+ AppendContextPadProvider.prototype.getContextPadEntries = function(element) {
41007
+ const popupMenu = this._popupMenu;
41008
+ const translate = this._translate;
41009
+ const getAppendMenuPosition = this._getAppendMenuPosition.bind(this);
39144
41010
 
39145
- if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
41011
+ if (!popupMenu.isEmpty(element, 'bpmn-append')) {
39146
41012
 
39147
41013
  // Replace menu entry
39148
- assign$1(actions, {
39149
- 'replace': {
39150
- group: 'edit',
39151
- className: 'bpmn-icon-screw-wrench',
39152
- title: translate('Change type'),
41014
+ return {
41015
+ 'append': {
41016
+ group: 'model',
41017
+ imageUrl: appendIcon,
41018
+ title: translate('Append element'),
39153
41019
  action: {
39154
41020
  click: function(event, element) {
39155
41021
 
39156
- var position = assign$1(getReplaceMenuPosition(element), {
41022
+ var position = assign$1(getAppendMenuPosition(element), {
39157
41023
  cursor: { x: event.x, y: event.y }
39158
41024
  });
39159
41025
 
39160
- popupMenu.open(element, 'bpmn-replace', position, {
39161
- title: translate('Change element'),
41026
+ popupMenu.open(element, 'bpmn-append', position, {
41027
+ title: translate('Append element'),
39162
41028
  width: 300,
39163
41029
  search: true
39164
41030
  });
39165
41031
  }
39166
41032
  }
39167
41033
  }
39168
- });
41034
+ };
39169
41035
  }
41036
+ };
39170
41037
 
39171
- if (is$5(businessObject, 'bpmn:SequenceFlow')) {
39172
- assign$1(actions, {
39173
- 'append.text-annotation': appendAction(
39174
- 'bpmn:TextAnnotation',
39175
- 'bpmn-icon-text-annotation'
39176
- )
39177
- });
39178
- }
41038
+ AppendContextPadProvider.prototype._getAppendMenuPosition = function(element) {
41039
+ const contextPad = this._contextPad;
39179
41040
 
39180
- if (
39181
- isAny(businessObject, [
39182
- 'bpmn:FlowNode',
39183
- 'bpmn:InteractionNode',
39184
- 'bpmn:DataObjectReference',
39185
- 'bpmn:DataStoreReference',
39186
- ])
39187
- ) {
39188
- assign$1(actions, {
39189
- 'append.text-annotation': appendAction(
39190
- 'bpmn:TextAnnotation',
39191
- 'bpmn-icon-text-annotation'
39192
- ),
41041
+ const X_OFFSET = 5;
39193
41042
 
39194
- 'connect': {
39195
- group: 'connect',
39196
- className: 'bpmn-icon-connection-multi',
39197
- title: translate(
39198
- 'Connect using ' +
39199
- (businessObject.isForCompensation
39200
- ? ''
39201
- : 'Sequence/MessageFlow or ') +
39202
- 'Association'
39203
- ),
39204
- action: {
39205
- click: startConnect,
39206
- dragstart: startConnect,
39207
- },
39208
- },
39209
- });
39210
- }
41043
+ const pad = contextPad.getPad(element).html;
39211
41044
 
39212
- if (is$5(businessObject, 'bpmn:TextAnnotation')) {
39213
- assign$1(actions, {
39214
- 'connect': {
39215
- group: 'connect',
39216
- className: 'bpmn-icon-connection-multi',
39217
- title: translate('Connect using Association'),
39218
- action: {
39219
- click: startConnect,
39220
- dragstart: startConnect,
39221
- },
39222
- },
39223
- });
39224
- }
41045
+ const padRect = pad.getBoundingClientRect();
39225
41046
 
39226
- if (isAny(businessObject, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
39227
- assign$1(actions, {
39228
- 'connect': {
39229
- group: 'connect',
39230
- className: 'bpmn-icon-connection-multi',
39231
- title: translate('Connect using DataInputAssociation'),
39232
- action: {
39233
- click: startConnect,
39234
- dragstart: startConnect
39235
- }
39236
- }
39237
- });
39238
- }
41047
+ const pos = {
41048
+ x: padRect.right + X_OFFSET,
41049
+ y: padRect.top
41050
+ };
39239
41051
 
39240
- if (is$5(businessObject, 'bpmn:Group')) {
39241
- assign$1(actions, {
39242
- 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation')
39243
- });
39244
- }
41052
+ return pos;
41053
+ };
39245
41054
 
39246
- // delete element entry, only show if allowed by rules
39247
- var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });
41055
+ /**
41056
+ * Append anything modeling rules
41057
+ */
41058
+ function AppendRules(eventBus) {
41059
+ RuleProvider.call(this, eventBus);
41060
+ }
39248
41061
 
39249
- if (isArray$3(deleteAllowed)) {
41062
+ e$6(AppendRules, RuleProvider);
39250
41063
 
39251
- // was the element returned as a deletion candidate?
39252
- deleteAllowed = deleteAllowed[0] === element;
39253
- }
41064
+ AppendRules.$inject = [
41065
+ 'eventBus'
41066
+ ];
39254
41067
 
39255
- if (deleteAllowed) {
39256
- assign$1(actions, {
39257
- 'delete': {
39258
- group: 'edit',
39259
- className: 'bpmn-icon-trash',
39260
- title: translate('Remove'),
39261
- action: {
39262
- click: removeElement
39263
- }
39264
- }
39265
- });
39266
- }
41068
+ AppendRules.prototype.init = function() {
41069
+ this.addRule('shape.append', function(context) {
39267
41070
 
39268
- return actions;
39269
- };
41071
+ var source = context.element;
39270
41072
 
41073
+ const businessObject = getBusinessObject$1(source);
39271
41074
 
39272
- // helpers /////////
41075
+ if (isLabel$6(source)) {
41076
+ return false;
41077
+ }
39273
41078
 
39274
- function isEventType(eventBo, type, definition) {
41079
+ if (isAny(source, [
41080
+ 'bpmn:EndEvent',
41081
+ 'bpmn:Group',
41082
+ 'bpmn:TextAnnotation',
41083
+ 'bpmn:Lane',
41084
+ 'bpmn:Participant',
41085
+ 'bpmn:DataStoreReference',
41086
+ 'bpmn:DataObjectReference'
41087
+ ])) {
41088
+ return false;
41089
+ }
39275
41090
 
39276
- var isType = eventBo.$instanceOf(type);
39277
- var isDefinition = false;
41091
+ if (isConnection$c(source)) {
41092
+ return false;
41093
+ }
39278
41094
 
39279
- var definitions = eventBo.eventDefinitions || [];
39280
- forEach$1(definitions, function(def) {
39281
- if (def.$type === definition) {
39282
- isDefinition = true;
41095
+ if (is$5(source, 'bpmn:IntermediateThrowEvent') && hasEventDefinition$1(source, 'bpmn:LinkEventDefinition')) {
41096
+ return false;
41097
+ }
41098
+
41099
+ if (is$5(source, 'bpmn:SubProcess') && businessObject.triggeredByEvent) {
41100
+ return false;
39283
41101
  }
39284
41102
  });
39285
41103
 
39286
- return isType && isDefinition;
41104
+ };
41105
+
41106
+
41107
+ // helpers //////////////
41108
+ function hasEventDefinition$1(element, eventDefinition) {
41109
+ var bo = getBusinessObject$1(element);
41110
+
41111
+ return !!find$1(bo.eventDefinitions || [], function(definition) {
41112
+ return is$5(definition, eventDefinition);
41113
+ });
39287
41114
  }
39288
41115
 
39289
- function includes$7(array, item) {
39290
- return array.indexOf(item) !== -1;
41116
+ function isConnection$c(element) {
41117
+ return element.waypoints;
39291
41118
  }
39292
41119
 
39293
- var ContextPadModule = {
41120
+ var CreateAppendAnythingModule = {
39294
41121
  __depends__: [
39295
- DirectEditingModule,
39296
- ContextPadModule$1,
39297
- SelectionModule,
39298
- ConnectModule,
39299
- CreateModule,
39300
- PopupMenuModule
41122
+ PaletteModule$1,
41123
+ PopupMenuModule$1,
41124
+ AutoPlaceModule$1,
41125
+ ContextPadModule$1
39301
41126
  ],
39302
- __init__: [ 'contextPadProvider' ],
39303
- contextPadProvider: [ 'type', ContextPadProvider ]
41127
+ __init__: [
41128
+ 'createMenuProvider',
41129
+ 'createPaletteProvider',
41130
+ 'createAppendEditorActions',
41131
+ 'createAppendKeyboardBindings',
41132
+ 'appendMenuProvider',
41133
+ 'appendContextPadProvider',
41134
+ 'appendRules'
41135
+ ],
41136
+ createMenuProvider: [ 'type', CreateMenuProvider ],
41137
+ createPaletteProvider: [ 'type', CreatePaletteProvider ],
41138
+ createAppendEditorActions: [ 'type', CreateAppendEditorActions ],
41139
+ createAppendKeyboardBindings: [ 'type', CreateAppendKeyboardBindings ],
41140
+ appendMenuProvider: [ 'type', AppendMenuProvider ],
41141
+ appendContextPadProvider: [ 'type', AppendContextPadProvider ],
41142
+ appendRules: [ 'type', AppendRules ]
39304
41143
  };
39305
41144
 
39306
41145
  var AXIS_DIMENSIONS = {
@@ -46753,7 +48592,7 @@
46753
48592
  }
46754
48593
 
46755
48594
  return some(types, function(type) {
46756
- return hasEventDefinition$2(element, type);
48595
+ return hasEventDefinition$3(element, type);
46757
48596
  });
46758
48597
  }
46759
48598
 
@@ -52711,6 +54550,16 @@
52711
54550
  di.isMarkerVisible = true;
52712
54551
  }
52713
54552
 
54553
+ if (isDefined(attrs.triggeredByEvent)) {
54554
+ businessObject.triggeredByEvent = attrs.triggeredByEvent;
54555
+ delete attrs.triggeredByEvent;
54556
+ }
54557
+
54558
+ if (isDefined(attrs.cancelActivity)) {
54559
+ businessObject.cancelActivity = attrs.cancelActivity;
54560
+ delete attrs.cancelActivity;
54561
+ }
54562
+
52714
54563
  var eventDefinitions,
52715
54564
  newEventDefinition;
52716
54565
 
@@ -58329,471 +60178,6 @@
58329
60178
  movePreview: [ 'type', MovePreview ]
58330
60179
  };
58331
60180
 
58332
- var TOGGLE_SELECTOR = '.djs-palette-toggle',
58333
- ENTRY_SELECTOR = '.entry',
58334
- ELEMENT_SELECTOR = TOGGLE_SELECTOR + ', ' + ENTRY_SELECTOR;
58335
-
58336
- var PALETTE_PREFIX = 'djs-palette-',
58337
- PALETTE_SHOWN_CLS = 'shown',
58338
- PALETTE_OPEN_CLS = 'open',
58339
- PALETTE_TWO_COLUMN_CLS = 'two-column';
58340
-
58341
- var DEFAULT_PRIORITY$1 = 1000;
58342
-
58343
-
58344
- /**
58345
- * A palette containing modeling elements.
58346
- */
58347
- function Palette(eventBus, canvas) {
58348
-
58349
- this._eventBus = eventBus;
58350
- this._canvas = canvas;
58351
-
58352
- var self = this;
58353
-
58354
- eventBus.on('tool-manager.update', function(event) {
58355
- var tool = event.tool;
58356
-
58357
- self.updateToolHighlight(tool);
58358
- });
58359
-
58360
- eventBus.on('i18n.changed', function() {
58361
- self._update();
58362
- });
58363
-
58364
- eventBus.on('diagram.init', function() {
58365
-
58366
- self._diagramInitialized = true;
58367
-
58368
- self._rebuild();
58369
- });
58370
- }
58371
-
58372
- Palette.$inject = [ 'eventBus', 'canvas' ];
58373
-
58374
-
58375
- /**
58376
- * Register a provider with the palette
58377
- *
58378
- * @param {number} [priority=1000]
58379
- * @param {PaletteProvider} provider
58380
- *
58381
- * @example
58382
- * const paletteProvider = {
58383
- * getPaletteEntries: function() {
58384
- * return function(entries) {
58385
- * return {
58386
- * ...entries,
58387
- * 'entry-1': {
58388
- * label: 'My Entry',
58389
- * action: function() { alert("I have been clicked!"); }
58390
- * }
58391
- * };
58392
- * }
58393
- * }
58394
- * };
58395
- *
58396
- * palette.registerProvider(800, paletteProvider);
58397
- */
58398
- Palette.prototype.registerProvider = function(priority, provider) {
58399
- if (!provider) {
58400
- provider = priority;
58401
- priority = DEFAULT_PRIORITY$1;
58402
- }
58403
-
58404
- this._eventBus.on('palette.getProviders', priority, function(event) {
58405
- event.providers.push(provider);
58406
- });
58407
-
58408
- this._rebuild();
58409
- };
58410
-
58411
-
58412
- /**
58413
- * Returns the palette entries
58414
- *
58415
- * @return {Object<string, PaletteEntryDescriptor>} map of entries
58416
- */
58417
- Palette.prototype.getEntries = function() {
58418
- var providers = this._getProviders();
58419
-
58420
- return providers.reduce(addPaletteEntries, {});
58421
- };
58422
-
58423
- Palette.prototype._rebuild = function() {
58424
-
58425
- if (!this._diagramInitialized) {
58426
- return;
58427
- }
58428
-
58429
- var providers = this._getProviders();
58430
-
58431
- if (!providers.length) {
58432
- return;
58433
- }
58434
-
58435
- if (!this._container) {
58436
- this._init();
58437
- }
58438
-
58439
- this._update();
58440
- };
58441
-
58442
- /**
58443
- * Initialize
58444
- */
58445
- Palette.prototype._init = function() {
58446
-
58447
- var self = this;
58448
-
58449
- var eventBus = this._eventBus;
58450
-
58451
- var parentContainer = this._getParentContainer();
58452
-
58453
- var container = this._container = domify$1(Palette.HTML_MARKUP);
58454
-
58455
- parentContainer.appendChild(container);
58456
- classes$1(parentContainer).add(PALETTE_PREFIX + PALETTE_SHOWN_CLS);
58457
-
58458
- delegate.bind(container, ELEMENT_SELECTOR, 'click', function(event) {
58459
-
58460
- var target = event.delegateTarget;
58461
-
58462
- if (matches(target, TOGGLE_SELECTOR)) {
58463
- return self.toggle();
58464
- }
58465
-
58466
- self.trigger('click', event);
58467
- });
58468
-
58469
- // prevent drag propagation
58470
- event.bind(container, 'mousedown', function(event) {
58471
- event.stopPropagation();
58472
- });
58473
-
58474
- // prevent drag propagation
58475
- delegate.bind(container, ENTRY_SELECTOR, 'dragstart', function(event) {
58476
- self.trigger('dragstart', event);
58477
- });
58478
-
58479
- eventBus.on('canvas.resized', this._layoutChanged, this);
58480
-
58481
- eventBus.fire('palette.create', {
58482
- container: container
58483
- });
58484
- };
58485
-
58486
- Palette.prototype._getProviders = function(id) {
58487
-
58488
- var event = this._eventBus.createEvent({
58489
- type: 'palette.getProviders',
58490
- providers: []
58491
- });
58492
-
58493
- this._eventBus.fire(event);
58494
-
58495
- return event.providers;
58496
- };
58497
-
58498
- /**
58499
- * Update palette state.
58500
- *
58501
- * @param {Object} [state] { open, twoColumn }
58502
- */
58503
- Palette.prototype._toggleState = function(state) {
58504
-
58505
- state = state || {};
58506
-
58507
- var parent = this._getParentContainer(),
58508
- container = this._container;
58509
-
58510
- var eventBus = this._eventBus;
58511
-
58512
- var twoColumn;
58513
-
58514
- var cls = classes$1(container),
58515
- parentCls = classes$1(parent);
58516
-
58517
- if ('twoColumn' in state) {
58518
- twoColumn = state.twoColumn;
58519
- } else {
58520
- twoColumn = this._needsCollapse(parent.clientHeight, this._entries || {});
58521
- }
58522
-
58523
- // always update two column
58524
- cls.toggle(PALETTE_TWO_COLUMN_CLS, twoColumn);
58525
- parentCls.toggle(PALETTE_PREFIX + PALETTE_TWO_COLUMN_CLS, twoColumn);
58526
-
58527
- if ('open' in state) {
58528
- cls.toggle(PALETTE_OPEN_CLS, state.open);
58529
- parentCls.toggle(PALETTE_PREFIX + PALETTE_OPEN_CLS, state.open);
58530
- }
58531
-
58532
- eventBus.fire('palette.changed', {
58533
- twoColumn: twoColumn,
58534
- open: this.isOpen()
58535
- });
58536
- };
58537
-
58538
- Palette.prototype._update = function() {
58539
-
58540
- var entriesContainer = query('.djs-palette-entries', this._container),
58541
- entries = this._entries = this.getEntries();
58542
-
58543
- clear$1(entriesContainer);
58544
-
58545
- forEach$1(entries, function(entry, id) {
58546
-
58547
- var grouping = entry.group || 'default';
58548
-
58549
- var container = query('[data-group=' + cssEscape(grouping) + ']', entriesContainer);
58550
- if (!container) {
58551
- container = domify$1('<div class="group"></div>');
58552
- attr$1(container, 'data-group', grouping);
58553
-
58554
- entriesContainer.appendChild(container);
58555
- }
58556
-
58557
- var html = entry.html || (
58558
- entry.separator ?
58559
- '<hr class="separator" />' :
58560
- '<div class="entry" draggable="true"></div>');
58561
-
58562
-
58563
- var control = domify$1(html);
58564
- container.appendChild(control);
58565
-
58566
- if (!entry.separator) {
58567
- attr$1(control, 'data-action', id);
58568
-
58569
- if (entry.title) {
58570
- attr$1(control, 'title', entry.title);
58571
- }
58572
-
58573
- if (entry.className) {
58574
- addClasses(control, entry.className);
58575
- }
58576
-
58577
- if (entry.imageUrl) {
58578
- var image = domify$1('<img>');
58579
- attr$1(image, 'src', entry.imageUrl);
58580
-
58581
- control.appendChild(image);
58582
- }
58583
- }
58584
- });
58585
-
58586
- // open after update
58587
- this.open();
58588
- };
58589
-
58590
-
58591
- /**
58592
- * Trigger an action available on the palette
58593
- *
58594
- * @param {string} action
58595
- * @param {Event} event
58596
- */
58597
- Palette.prototype.trigger = function(action, event, autoActivate) {
58598
- var entry,
58599
- originalEvent,
58600
- button = event.delegateTarget || event.target;
58601
-
58602
- if (!button) {
58603
- return event.preventDefault();
58604
- }
58605
-
58606
- entry = attr$1(button, 'data-action');
58607
- originalEvent = event.originalEvent || event;
58608
-
58609
- return this.triggerEntry(entry, action, originalEvent, autoActivate);
58610
- };
58611
-
58612
- Palette.prototype.triggerEntry = function(entryId, action, event, autoActivate) {
58613
- var entries = this._entries,
58614
- entry,
58615
- handler;
58616
-
58617
- entry = entries[entryId];
58618
-
58619
- // when user clicks on the palette and not on an action
58620
- if (!entry) {
58621
- return;
58622
- }
58623
-
58624
- handler = entry.action;
58625
-
58626
- // simple action (via callback function)
58627
- if (isFunction(handler)) {
58628
- if (action === 'click') {
58629
- return handler(event, autoActivate);
58630
- }
58631
- } else {
58632
- if (handler[action]) {
58633
- return handler[action](event, autoActivate);
58634
- }
58635
- }
58636
-
58637
- // silence other actions
58638
- event.preventDefault();
58639
- };
58640
-
58641
- Palette.prototype._layoutChanged = function() {
58642
- this._toggleState({});
58643
- };
58644
-
58645
- /**
58646
- * Do we need to collapse to two columns?
58647
- *
58648
- * @param {number} availableHeight
58649
- * @param {Object} entries
58650
- *
58651
- * @return {boolean}
58652
- */
58653
- Palette.prototype._needsCollapse = function(availableHeight, entries) {
58654
-
58655
- // top margin + bottom toggle + bottom margin
58656
- // implementors must override this method if they
58657
- // change the palette styles
58658
- var margin = 20 + 10 + 20;
58659
-
58660
- var entriesHeight = Object.keys(entries).length * 46;
58661
-
58662
- return availableHeight < entriesHeight + margin;
58663
- };
58664
-
58665
- /**
58666
- * Close the palette
58667
- */
58668
- Palette.prototype.close = function() {
58669
-
58670
- this._toggleState({
58671
- open: false,
58672
- twoColumn: false
58673
- });
58674
- };
58675
-
58676
-
58677
- /**
58678
- * Open the palette
58679
- */
58680
- Palette.prototype.open = function() {
58681
- this._toggleState({ open: true });
58682
- };
58683
-
58684
-
58685
- Palette.prototype.toggle = function(open) {
58686
- if (this.isOpen()) {
58687
- this.close();
58688
- } else {
58689
- this.open();
58690
- }
58691
- };
58692
-
58693
- Palette.prototype.isActiveTool = function(tool) {
58694
- return tool && this._activeTool === tool;
58695
- };
58696
-
58697
- Palette.prototype.updateToolHighlight = function(name) {
58698
- var entriesContainer,
58699
- toolsContainer;
58700
-
58701
- if (!this._toolsContainer) {
58702
- entriesContainer = query('.djs-palette-entries', this._container);
58703
-
58704
- this._toolsContainer = query('[data-group=tools]', entriesContainer);
58705
- }
58706
-
58707
- toolsContainer = this._toolsContainer;
58708
-
58709
- forEach$1(toolsContainer.children, function(tool) {
58710
- var actionName = tool.getAttribute('data-action');
58711
-
58712
- if (!actionName) {
58713
- return;
58714
- }
58715
-
58716
- var toolClasses = classes$1(tool);
58717
-
58718
- actionName = actionName.replace('-tool', '');
58719
-
58720
- if (toolClasses.contains('entry') && actionName === name) {
58721
- toolClasses.add('highlighted-entry');
58722
- } else {
58723
- toolClasses.remove('highlighted-entry');
58724
- }
58725
- });
58726
- };
58727
-
58728
-
58729
- /**
58730
- * Return true if the palette is opened.
58731
- *
58732
- * @example
58733
- *
58734
- * palette.open();
58735
- *
58736
- * if (palette.isOpen()) {
58737
- * // yes, we are open
58738
- * }
58739
- *
58740
- * @return {boolean} true if palette is opened
58741
- */
58742
- Palette.prototype.isOpen = function() {
58743
- return classes$1(this._container).has(PALETTE_OPEN_CLS);
58744
- };
58745
-
58746
- /**
58747
- * Get container the palette lives in.
58748
- *
58749
- * @return {Element}
58750
- */
58751
- Palette.prototype._getParentContainer = function() {
58752
- return this._canvas.getContainer();
58753
- };
58754
-
58755
-
58756
- /* markup definition */
58757
-
58758
- Palette.HTML_MARKUP =
58759
- '<div class="djs-palette">' +
58760
- '<div class="djs-palette-entries"></div>' +
58761
- '<div class="djs-palette-toggle"></div>' +
58762
- '</div>';
58763
-
58764
-
58765
- // helpers //////////////////////
58766
-
58767
- function addClasses(element, classNames) {
58768
-
58769
- var classes = classes$1(element);
58770
-
58771
- var actualClassNames = isArray$3(classNames) ? classNames : classNames.split(/\s+/g);
58772
- actualClassNames.forEach(function(cls) {
58773
- classes.add(cls);
58774
- });
58775
- }
58776
-
58777
- function addPaletteEntries(entries, provider) {
58778
-
58779
- var entriesOrUpdater = provider.getPaletteEntries();
58780
-
58781
- if (isFunction(entriesOrUpdater)) {
58782
- return entriesOrUpdater(entries);
58783
- }
58784
-
58785
- forEach$1(entriesOrUpdater, function(entry, id) {
58786
- entries[id] = entry;
58787
- });
58788
-
58789
- return entries;
58790
- }
58791
-
58792
- var PaletteModule$1 = {
58793
- __init__: [ 'palette' ],
58794
- palette: [ 'type', Palette ]
58795
- };
58796
-
58797
60181
  var LASSO_TOOL_CURSOR = 'crosshair';
58798
60182
 
58799
60183
 
@@ -61444,6 +62828,10 @@
61444
62828
  '</bpmn:definitions>';
61445
62829
 
61446
62830
 
62831
+ /**
62832
+ * @typedef { import('didi').ModuleDeclaration } Module
62833
+ */
62834
+
61447
62835
  /**
61448
62836
  * A modeler for BPMN 2.0 diagrams.
61449
62837
  *
@@ -61513,8 +62901,8 @@
61513
62901
  * @param {string|number} [options.width] the width of the viewer
61514
62902
  * @param {string|number} [options.height] the height of the viewer
61515
62903
  * @param {Object} [options.moddleExtensions] extension packages to provide
61516
- * @param {Array<didi.Module>} [options.modules] a list of modules to override the default modules
61517
- * @param {Array<didi.Module>} [options.additionalModules] a list of modules to use with the default modules
62904
+ * @param {Module[]} [options.modules] a list of modules to override the default modules
62905
+ * @param {Module[]} [options.additionalModules] a list of modules to use with the default modules
61518
62906
  */
61519
62907
  function Modeler$2(options) {
61520
62908
  BaseModeler.call(this, options);
@@ -61574,6 +62962,7 @@
61574
62962
  ContextPadModule,
61575
62963
  CopyPasteModule,
61576
62964
  CreateModule,
62965
+ CreateAppendAnythingModule,
61577
62966
  DistributeElementsModule,
61578
62967
  EditorActionsModule,
61579
62968
  GridSnappingModule,
@@ -87216,18 +88605,26 @@
87216
88605
  return `bio-properties-panel-${id}`;
87217
88606
  }
87218
88607
 
88608
+ function resizeToContents(element) {
88609
+ element.style.height = 'auto';
88610
+
88611
+ // a 2px pixel offset is required to prevent scrollbar from
88612
+ // appearing on OS with a full length scroll bar (Windows/Linux)
88613
+ element.style.height = `${element.scrollHeight + 2}px`;
88614
+ }
87219
88615
  function TextArea(props) {
87220
88616
  const {
87221
88617
  id,
87222
88618
  label,
87223
- rows = 2,
87224
88619
  debounce,
87225
88620
  onInput,
87226
88621
  value = '',
87227
88622
  disabled,
87228
88623
  monospace,
87229
88624
  onFocus,
87230
- onBlur
88625
+ onBlur,
88626
+ autoResize,
88627
+ rows = autoResize ? 1 : 2
87231
88628
  } = props;
87232
88629
  const [localValue, setLocalValue] = l$1(value);
87233
88630
  const ref = useShowEntryEvent(id);
@@ -87238,8 +88635,12 @@
87238
88635
  }, [onInput, debounce]);
87239
88636
  const handleInput = e => {
87240
88637
  handleInputCallback(e);
88638
+ autoResize && resizeToContents(e.target);
87241
88639
  setLocalValue(e.target.value);
87242
88640
  };
88641
+ h(() => {
88642
+ autoResize && resizeToContents(ref.current);
88643
+ }, []);
87243
88644
  y(() => {
87244
88645
  if (value === localValue) {
87245
88646
  return;
@@ -87257,7 +88658,7 @@
87257
88658
  id: prefixId$2(id),
87258
88659
  name: id,
87259
88660
  spellCheck: "false",
87260
- class: classnames('bio-properties-panel-input', monospace ? 'bio-properties-panel-input-monospace' : ''),
88661
+ class: classnames('bio-properties-panel-input', monospace ? 'bio-properties-panel-input-monospace' : '', autoResize ? 'auto-resize' : ''),
87261
88662
  onInput: handleInput,
87262
88663
  onFocus: onFocus,
87263
88664
  onBlur: onBlur,
@@ -87297,7 +88698,8 @@
87297
88698
  monospace,
87298
88699
  disabled,
87299
88700
  onFocus,
87300
- onBlur
88701
+ onBlur,
88702
+ autoResize
87301
88703
  } = props;
87302
88704
  const value = getValue(element);
87303
88705
  const error = useError(id);
@@ -87314,7 +88716,8 @@
87314
88716
  rows: rows,
87315
88717
  debounce: debounce,
87316
88718
  monospace: monospace,
87317
- disabled: disabled
88719
+ disabled: disabled,
88720
+ autoResize: autoResize
87318
88721
  }, element), error && o$1("div", {
87319
88722
  class: "bio-properties-panel-error",
87320
88723
  children: error
@@ -87681,6 +89084,16 @@
87681
89084
  }
87682
89085
 
87683
89086
 
89087
+ /**
89088
+ * Get a script from the business object
89089
+ *
89090
+ * @param {MoodleElement} element
89091
+ * @returns {MoodleElement} the script object
89092
+ */
89093
+ function getScript(element) {
89094
+ return (getElements$2(element, 'zeebe:Script') || [])[0];
89095
+ }
89096
+
87684
89097
  // helpers //////////
87685
89098
 
87686
89099
  function getElements$2(element, type, property) {
@@ -88109,13 +89522,14 @@
88109
89522
 
88110
89523
  minDash$1.forEach(elements, function(element) {
88111
89524
 
88112
- var calledDecision = getCalledDecision(element);
89525
+ var baseElement = getCalledDecision(element) ||
89526
+ getScript(element);
88113
89527
 
88114
- if (!calledDecision) {
89528
+ if (!baseElement) {
88115
89529
  return;
88116
89530
  }
88117
89531
 
88118
- var resultVariable = calledDecision.resultVariable;
89532
+ var resultVariable = baseElement.resultVariable;
88119
89533
 
88120
89534
  if (resultVariable) {
88121
89535
  var newVariable = createProcessVariable$1(
@@ -92951,7 +94365,7 @@
92951
94365
  return [{
92952
94366
  id: 'name',
92953
94367
  component: Name$3,
92954
- isEdited: isEdited$1
94368
+ isEdited: isEdited$2
92955
94369
  }];
92956
94370
  }
92957
94371
  function Name$3(props) {
@@ -92977,7 +94391,8 @@
92977
94391
  },
92978
94392
  getValue: element => {
92979
94393
  return element.businessObject.name;
92980
- }
94394
+ },
94395
+ autoResize: true
92981
94396
  };
92982
94397
 
92983
94398
  // (2) text annotations
@@ -93019,7 +94434,7 @@
93019
94434
  else if (is$5(element, 'bpmn:Participant')) {
93020
94435
  options.label = translate('Participant Name');
93021
94436
  }
93022
- return TextfieldEntry(options);
94437
+ return TextAreaEntry(options);
93023
94438
  }
93024
94439
 
93025
94440
  // helpers ////////////////////////
@@ -93906,9 +95321,6 @@
93906
95321
  injector,
93907
95322
  namespace = 'camunda'
93908
95323
  }) {
93909
- if (namespace === 'zeebe' && !is$5(element, 'zeebe:PropertiesHolder')) {
93910
- return [];
93911
- }
93912
95324
  let businessObject = getRelevantBusinessObject(element);
93913
95325
 
93914
95326
  // do not offer for empty pools
@@ -93944,7 +95356,8 @@
93944
95356
  commandStack,
93945
95357
  element,
93946
95358
  namespace
93947
- })
95359
+ }),
95360
+ shouldSort: false
93948
95361
  };
93949
95362
  }
93950
95363
  function removeFactory$9({
@@ -93957,6 +95370,7 @@
93957
95370
  event.stopPropagation();
93958
95371
  const commands = [];
93959
95372
  const businessObject = getRelevantBusinessObject(element);
95373
+ const extensionElements = businessObject.get('extensionElements');
93960
95374
  const properties = getProperties(businessObject, namespace);
93961
95375
  if (!properties) {
93962
95376
  return;
@@ -93976,8 +95390,6 @@
93976
95390
 
93977
95391
  // remove camunda:Properties if there are no properties anymore
93978
95392
  if (!values.length) {
93979
- const businessObject = getBusinessObject$1(element),
93980
- extensionElements = businessObject.get('extensionElements');
93981
95393
  commands.push({
93982
95394
  cmd: 'element.updateModdleProperties',
93983
95395
  context: {
@@ -94077,10 +95489,12 @@
94077
95489
  return 'values';
94078
95490
  }
94079
95491
  function getProperties(element, namespace = 'camunda') {
94080
- return getExtensionElementsList$1(getBusinessObject$1(element), `${namespace}:Properties`)[0];
95492
+ const businessObject = getRelevantBusinessObject(element);
95493
+ return getExtensionElementsList$1(businessObject, `${namespace}:Properties`)[0];
94081
95494
  }
94082
95495
  function getPropertiesList(element, namespace = 'camunda') {
94083
- const properties = getProperties(getBusinessObject$1(element), namespace);
95496
+ const businessObject = getRelevantBusinessObject(element);
95497
+ const properties = getProperties(businessObject, namespace);
94084
95498
  return properties && properties.get(getPropertyName(namespace));
94085
95499
  }
94086
95500