bpmn-js 11.1.1 → 11.2.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 (44) hide show
  1. package/README.md +0 -8
  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/bpmn-modeler.development.js +2520 -1152
  12. package/dist/bpmn-modeler.production.min.js +44 -42
  13. package/dist/bpmn-navigated-viewer.development.js +295 -212
  14. package/dist/bpmn-navigated-viewer.production.min.js +6 -6
  15. package/dist/bpmn-viewer.development.js +295 -212
  16. package/dist/bpmn-viewer.production.min.js +6 -6
  17. package/lib/Modeler.js +2 -0
  18. package/lib/draw/BpmnRenderer.js +185 -196
  19. package/lib/features/align-elements/dist/align-bottom-tool.svg +1 -0
  20. package/lib/features/align-elements/dist/align-horizontal-center-tool.svg +1 -0
  21. package/lib/features/align-elements/dist/align-left-tool.svg +1 -0
  22. package/lib/features/align-elements/dist/align-right-tool.svg +1 -0
  23. package/lib/features/align-elements/dist/align-tool.svg +1 -0
  24. package/lib/features/align-elements/dist/align-top-tool.svg +1 -0
  25. package/lib/features/align-elements/dist/align-vertical-center-tool.svg +1 -0
  26. package/lib/features/context-pad/ContextPadProvider.js +0 -1
  27. package/lib/features/create-append-anything/AppendContextPadProvider.js +77 -0
  28. package/lib/features/create-append-anything/AppendMenuProvider.js +175 -0
  29. package/lib/features/create-append-anything/AppendRules.js +83 -0
  30. package/lib/features/create-append-anything/CreateAppendEditorActions.js +51 -0
  31. package/lib/features/create-append-anything/CreateAppendKeyboardBindings.js +97 -0
  32. package/lib/features/create-append-anything/CreateMenuProvider.js +112 -0
  33. package/lib/features/create-append-anything/CreatePaletteProvider.js +77 -0
  34. package/lib/features/create-append-anything/index.js +37 -0
  35. package/lib/features/create-append-anything/util/OptionsUtil.js +612 -0
  36. package/lib/features/editor-actions/BpmnEditorActions.js +0 -1
  37. package/lib/features/modeling/ElementFactory.js +11 -0
  38. package/lib/features/palette/dist/create.svg +1 -0
  39. package/lib/features/popup-menu/ReplaceMenuProvider.js +7 -2
  40. package/lib/features/popup-menu/index.js +6 -3
  41. package/lib/icons/Icons.js +11 -0
  42. package/lib/icons/resources/append.svg +3 -0
  43. package/lib/icons/resources/create.svg +3 -0
  44. package/package.json +18 -5
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v11.1.1
2
+ * bpmn-js - bpmn-modeler v11.2.0
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2023-01-06
11
+ * Date: 2023-02-03
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -2574,34 +2574,128 @@
2574
2574
  */
2575
2575
  BaseRenderer.prototype.getConnectionPath = function() {};
2576
2576
 
2577
+ /**
2578
+ * @param { [ string, ...any[] ][] } elements
2579
+ *
2580
+ * @return { string }
2581
+ */
2577
2582
  function componentsToPath(elements) {
2578
- return elements.join(',').replace(/,?([A-z]),?/g, '$1');
2583
+ return elements.flat().join(',').replace(/,?([A-z]),?/g, '$1');
2584
+ }
2585
+
2586
+ function move(point) {
2587
+ return [ 'M', point.x, point.y ];
2588
+ }
2589
+
2590
+ function lineTo(point) {
2591
+ return [ 'L', point.x, point.y ];
2592
+ }
2593
+
2594
+ function curveTo(p1, p2, p3) {
2595
+ return [ 'C', p1.x, p1.y, p2.x, p2.y, p3.x, p3.y ];
2579
2596
  }
2580
2597
 
2581
- function toSVGPoints(points) {
2582
- var result = '';
2598
+ function drawPath(waypoints, cornerRadius) {
2599
+ const pointCount = waypoints.length;
2583
2600
 
2584
- for (var i = 0, p; (p = points[i]); i++) {
2585
- result += p.x + ',' + p.y + ' ';
2601
+ const path = [ move(waypoints[0]) ];
2602
+
2603
+ for (let i = 1; i < pointCount; i++) {
2604
+
2605
+ const pointBefore = waypoints[i - 1];
2606
+ const point = waypoints[i];
2607
+ const pointAfter = waypoints[i + 1];
2608
+
2609
+ if (!pointAfter || !cornerRadius) {
2610
+ path.push(lineTo(point));
2611
+
2612
+ continue;
2613
+ }
2614
+
2615
+ const effectiveRadius = Math.min(
2616
+ cornerRadius,
2617
+ vectorLength$1(point.x - pointBefore.x, point.y - pointBefore.y),
2618
+ vectorLength$1(pointAfter.x - point.x, pointAfter.y - point.y)
2619
+ );
2620
+
2621
+ if (!effectiveRadius) {
2622
+ path.push(lineTo(point));
2623
+
2624
+ continue;
2625
+ }
2626
+
2627
+ const beforePoint = getPointAtLength(point, pointBefore, effectiveRadius);
2628
+ const beforePoint2 = getPointAtLength(point, pointBefore, effectiveRadius * .5);
2629
+
2630
+ const afterPoint = getPointAtLength(point, pointAfter, effectiveRadius);
2631
+ const afterPoint2 = getPointAtLength(point, pointAfter, effectiveRadius * .5);
2632
+
2633
+ path.push(lineTo(beforePoint));
2634
+ path.push(curveTo(beforePoint2, afterPoint2, afterPoint));
2586
2635
  }
2587
2636
 
2588
- return result;
2637
+ return path;
2589
2638
  }
2590
2639
 
2591
- function createLine(points, attrs) {
2640
+ function getPointAtLength(start, end, length) {
2592
2641
 
2593
- var line = create$1('polyline');
2594
- attr(line, { points: toSVGPoints(points) });
2642
+ const deltaX = end.x - start.x;
2643
+ const deltaY = end.y - start.y;
2595
2644
 
2596
- if (attrs) {
2597
- attr(line, attrs);
2645
+ const totalLength = vectorLength$1(deltaX, deltaY);
2646
+
2647
+ const percent = length / totalLength;
2648
+
2649
+ return {
2650
+ x: start.x + deltaX * percent,
2651
+ y: start.y + deltaY * percent
2652
+ };
2653
+ }
2654
+
2655
+ function vectorLength$1(x, y) {
2656
+ return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
2657
+ }
2658
+
2659
+ /**
2660
+ * @param { { x: number, y: number }[] } points
2661
+ * @param { any } [attrs]
2662
+ * @param { number } [radius]
2663
+ *
2664
+ * @return {SVGElement}
2665
+ */
2666
+ function createLine(points, attrs, radius) {
2667
+
2668
+ if (isNumber(attrs)) {
2669
+ radius = attrs;
2670
+ attrs = null;
2598
2671
  }
2599
2672
 
2600
- return line;
2673
+ if (!attrs) {
2674
+ attrs = {};
2675
+ }
2676
+
2677
+ const line = create$1('path', attrs);
2678
+
2679
+ if (isNumber(radius)) {
2680
+ line.dataset.cornerRadius = String(radius);
2681
+ }
2682
+
2683
+ return updateLine(line, points);
2601
2684
  }
2602
2685
 
2686
+ /**
2687
+ * @param { SVGElement } gfx
2688
+ * @param { { x: number, y: number }[]} points
2689
+ *
2690
+ * @return {SVGElement}
2691
+ */
2603
2692
  function updateLine(gfx, points) {
2604
- attr(gfx, { points: toSVGPoints(points) });
2693
+
2694
+ const cornerRadius = parseInt(gfx.dataset.cornerRadius, 10) || 0;
2695
+
2696
+ attr(gfx, {
2697
+ d: componentsToPath(drawPath(points, cornerRadius))
2698
+ });
2605
2699
 
2606
2700
  return gfx;
2607
2701
  }
@@ -3262,65 +3356,42 @@
3262
3356
  /**
3263
3357
  * Check whether two points are horizontally or vertically aligned.
3264
3358
  *
3265
- * @param {Array<Point>|Point}
3266
- * @param {Point}
3359
+ * @param {Point[]|Point} a
3360
+ * @param {Point} [b]
3267
3361
  *
3268
- * @return {string|boolean}
3362
+ * @return {'h'|'v'|false} axis or false
3269
3363
  */
3270
3364
  function pointsAligned(a, b) {
3271
- var points;
3272
-
3273
- if (isArray$3(a)) {
3274
- points = a;
3275
- } else {
3276
- points = [ a, b ];
3277
- }
3365
+ var points = Array.from(arguments).flat();
3278
3366
 
3279
- if (pointsAlignedHorizontally(points)) {
3280
- return 'h';
3281
- }
3367
+ const axisMap = {
3368
+ 'x': 'v',
3369
+ 'y': 'h'
3370
+ };
3282
3371
 
3283
- if (pointsAlignedVertically(points)) {
3284
- return 'v';
3372
+ for (const [ axis, orientation ] of Object.entries(axisMap)) {
3373
+ if (pointsAlignedOnAxis(axis, points)) {
3374
+ return orientation;
3375
+ }
3285
3376
  }
3286
3377
 
3287
3378
  return false;
3288
3379
  }
3289
3380
 
3290
- function pointsAlignedHorizontally(a, b) {
3291
- var points;
3292
-
3293
- if (isArray$3(a)) {
3294
- points = a;
3295
- } else {
3296
- points = [ a, b ];
3297
- }
3298
-
3299
- var firstPoint = points.slice().shift();
3300
-
3301
- return every(points, function(point) {
3302
- return Math.abs(firstPoint.y - point.y) <= ALIGNED_THRESHOLD;
3303
- });
3304
- }
3305
-
3306
- function pointsAlignedVertically(a, b) {
3307
- var points;
3308
-
3309
- if (isArray$3(a)) {
3310
- points = a;
3311
- } else {
3312
- points = [ a, b ];
3313
- }
3314
-
3315
- var firstPoint = points.slice().shift();
3381
+ /**
3382
+ * @param { 'x' | 'y' } axis
3383
+ * @param { Point[] } points
3384
+ *
3385
+ * @return {boolean}
3386
+ */
3387
+ function pointsAlignedOnAxis(axis, points) {
3388
+ const referencePoint = points[0];
3316
3389
 
3317
3390
  return every(points, function(point) {
3318
- return Math.abs(firstPoint.x - point.x) <= ALIGNED_THRESHOLD;
3391
+ return Math.abs(referencePoint[axis] - point[axis]) <= ALIGNED_THRESHOLD;
3319
3392
  });
3320
3393
  }
3321
3394
 
3322
-
3323
-
3324
3395
  /**
3325
3396
  * Returns true if the point p is inside the rectangle rect
3326
3397
  *
@@ -4423,7 +4494,7 @@
4423
4494
  * @return {Point}
4424
4495
  */
4425
4496
  function getMid(element) {
4426
- if (isConnection$f(element)) {
4497
+ if (isConnection$g(element)) {
4427
4498
  return getConnectionMid(element);
4428
4499
  }
4429
4500
 
@@ -4563,7 +4634,7 @@
4563
4634
  return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
4564
4635
  }
4565
4636
 
4566
- function isConnection$f(element) {
4637
+ function isConnection$g(element) {
4567
4638
  return !!element.waypoints;
4568
4639
  }
4569
4640
 
@@ -17023,7 +17094,7 @@
17023
17094
  return element && !!getBusinessObject(element).triggeredByEvent;
17024
17095
  }
17025
17096
 
17026
- function hasEventDefinition$2(element, eventType) {
17097
+ function hasEventDefinition$3(element, eventType) {
17027
17098
  var bo = getBusinessObject(element),
17028
17099
  hasEventDefinition = false;
17029
17100
 
@@ -17039,15 +17110,15 @@
17039
17110
  }
17040
17111
 
17041
17112
  function hasErrorEventDefinition(element) {
17042
- return hasEventDefinition$2(element, 'bpmn:ErrorEventDefinition');
17113
+ return hasEventDefinition$3(element, 'bpmn:ErrorEventDefinition');
17043
17114
  }
17044
17115
 
17045
17116
  function hasEscalationEventDefinition(element) {
17046
- return hasEventDefinition$2(element, 'bpmn:EscalationEventDefinition');
17117
+ return hasEventDefinition$3(element, 'bpmn:EscalationEventDefinition');
17047
17118
  }
17048
17119
 
17049
17120
  function hasCompensateEventDefinition(element) {
17050
- return hasEventDefinition$2(element, 'bpmn:CompensateEventDefinition');
17121
+ return hasEventDefinition$3(element, 'bpmn:CompensateEventDefinition');
17051
17122
  }
17052
17123
 
17053
17124
  function getLabelAttr(semantic) {
@@ -17282,33 +17353,33 @@
17282
17353
 
17283
17354
  var markers = {};
17284
17355
 
17285
- var computeStyle = styles.computeStyle;
17286
-
17287
- function addMarker(id, options) {
17288
- var attrs = assign$1({
17289
- fill: black,
17290
- strokeWidth: 1,
17356
+ function shapeStyle(attrs) {
17357
+ return styles.computeStyle(attrs, {
17291
17358
  strokeLinecap: 'round',
17292
- strokeDasharray: 'none'
17293
- }, options.attrs);
17294
-
17295
- var ref = options.ref || { x: 0, y: 0 };
17296
-
17297
- var scale = options.scale || 1;
17298
-
17299
- // fix for safari / chrome / firefox bug not correctly
17300
- // resetting stroke dash array
17301
- if (attrs.strokeDasharray === 'none') {
17302
- attrs.strokeDasharray = [ 10000, 1 ];
17303
- }
17304
-
17305
- var marker = create$1('marker');
17359
+ strokeLinejoin: 'round',
17360
+ stroke: black,
17361
+ strokeWidth: 2,
17362
+ fill: 'white'
17363
+ });
17364
+ }
17306
17365
 
17307
- attr(options.element, attrs);
17366
+ function lineStyle(attrs) {
17367
+ return styles.computeStyle(attrs, [ 'no-fill' ], {
17368
+ strokeLinecap: 'round',
17369
+ strokeLinejoin: 'round',
17370
+ stroke: black,
17371
+ strokeWidth: 2
17372
+ });
17373
+ }
17308
17374
 
17309
- append(marker, options.element);
17375
+ function addMarker(id, options) {
17376
+ var {
17377
+ ref = { x: 0, y: 0 },
17378
+ scale = 1,
17379
+ element
17380
+ } = options;
17310
17381
 
17311
- attr(marker, {
17382
+ var marker = create$1('marker', {
17312
17383
  id: id,
17313
17384
  viewBox: '0 0 20 20',
17314
17385
  refX: ref.x,
@@ -17318,6 +17389,8 @@
17318
17389
  orient: 'auto'
17319
17390
  });
17320
17391
 
17392
+ append(marker, element);
17393
+
17321
17394
  var defs = query('defs', canvas._svg);
17322
17395
 
17323
17396
  if (!defs) {
@@ -17350,105 +17423,116 @@
17350
17423
  function createMarker(id, type, fill, stroke) {
17351
17424
 
17352
17425
  if (type === 'sequenceflow-end') {
17353
- var sequenceflowEnd = create$1('path');
17354
- attr(sequenceflowEnd, { d: 'M 1 5 L 11 10 L 1 15 Z' });
17426
+ var sequenceflowEnd = create$1('path', {
17427
+ d: 'M 1 5 L 11 10 L 1 15 Z',
17428
+ ...shapeStyle({
17429
+ fill: stroke,
17430
+ stroke: stroke,
17431
+ strokeWidth: 1
17432
+ })
17433
+ });
17355
17434
 
17356
17435
  addMarker(id, {
17357
17436
  element: sequenceflowEnd,
17358
17437
  ref: { x: 11, y: 10 },
17359
- scale: 0.5,
17360
- attrs: {
17361
- fill: stroke,
17362
- stroke: stroke
17363
- }
17438
+ scale: 0.5
17364
17439
  });
17365
17440
  }
17366
17441
 
17367
17442
  if (type === 'messageflow-start') {
17368
- var messageflowStart = create$1('circle');
17369
- attr(messageflowStart, { cx: 6, cy: 6, r: 3.5 });
17443
+ var messageflowStart = create$1('circle', {
17444
+ cx: 6,
17445
+ cy: 6,
17446
+ r: 3.5,
17447
+ ...shapeStyle({
17448
+ fill: fill,
17449
+ stroke: stroke,
17450
+ strokeWidth: 1
17451
+ })
17452
+ });
17370
17453
 
17371
17454
  addMarker(id, {
17372
17455
  element: messageflowStart,
17373
- attrs: {
17374
- fill: fill,
17375
- stroke: stroke
17376
- },
17377
17456
  ref: { x: 6, y: 6 }
17378
17457
  });
17379
17458
  }
17380
17459
 
17381
17460
  if (type === 'messageflow-end') {
17382
- var messageflowEnd = create$1('path');
17383
- attr(messageflowEnd, { d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z' });
17461
+ var messageflowEnd = create$1('path', {
17462
+ d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
17463
+ ...shapeStyle({
17464
+ fill: fill,
17465
+ stroke: stroke,
17466
+ strokeWidth: 1
17467
+ })
17468
+ });
17384
17469
 
17385
17470
  addMarker(id, {
17386
17471
  element: messageflowEnd,
17387
- attrs: {
17388
- fill: fill,
17389
- stroke: stroke,
17390
- strokeLinecap: 'butt'
17391
- },
17392
17472
  ref: { x: 8.5, y: 5 }
17393
17473
  });
17394
17474
  }
17395
17475
 
17396
17476
  if (type === 'association-start') {
17397
- var associationStart = create$1('path');
17398
- attr(associationStart, { d: 'M 11 5 L 1 10 L 11 15' });
17399
-
17400
- addMarker(id, {
17401
- element: associationStart,
17402
- attrs: {
17477
+ var associationStart = create$1('path', {
17478
+ d: 'M 11 5 L 1 10 L 11 15',
17479
+ ...lineStyle({
17403
17480
  fill: 'none',
17404
17481
  stroke: stroke,
17405
17482
  strokeWidth: 1.5
17406
- },
17483
+ })
17484
+ });
17485
+
17486
+ addMarker(id, {
17487
+ element: associationStart,
17407
17488
  ref: { x: 1, y: 10 },
17408
17489
  scale: 0.5
17409
17490
  });
17410
17491
  }
17411
17492
 
17412
17493
  if (type === 'association-end') {
17413
- var associationEnd = create$1('path');
17414
- attr(associationEnd, { d: 'M 1 5 L 11 10 L 1 15' });
17415
-
17416
- addMarker(id, {
17417
- element: associationEnd,
17418
- attrs: {
17494
+ var associationEnd = create$1('path', {
17495
+ d: 'M 1 5 L 11 10 L 1 15',
17496
+ ...lineStyle({
17419
17497
  fill: 'none',
17420
17498
  stroke: stroke,
17421
17499
  strokeWidth: 1.5
17422
- },
17423
- ref: { x: 12, y: 10 },
17500
+ })
17501
+ });
17502
+
17503
+ addMarker(id, {
17504
+ element: associationEnd,
17505
+ ref: { x: 11, y: 10 },
17424
17506
  scale: 0.5
17425
17507
  });
17426
17508
  }
17427
17509
 
17428
17510
  if (type === 'conditional-flow-marker') {
17429
- var conditionalflowMarker = create$1('path');
17430
- attr(conditionalflowMarker, { d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z' });
17431
-
17432
- addMarker(id, {
17433
- element: conditionalflowMarker,
17434
- attrs: {
17511
+ var conditionalFlowMarker = create$1('path', {
17512
+ d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
17513
+ ...shapeStyle({
17435
17514
  fill: fill,
17436
17515
  stroke: stroke
17437
- },
17516
+ })
17517
+ });
17518
+
17519
+ addMarker(id, {
17520
+ element: conditionalFlowMarker,
17438
17521
  ref: { x: -1, y: 10 },
17439
17522
  scale: 0.5
17440
17523
  });
17441
17524
  }
17442
17525
 
17443
17526
  if (type === 'conditional-default-flow-marker') {
17444
- var conditionaldefaultflowMarker = create$1('path');
17445
- attr(conditionaldefaultflowMarker, { d: 'M 6 4 L 10 16' });
17527
+ var defaultFlowMarker = create$1('path', {
17528
+ d: 'M 6 4 L 10 16',
17529
+ ...shapeStyle({
17530
+ stroke: stroke
17531
+ })
17532
+ });
17446
17533
 
17447
17534
  addMarker(id, {
17448
- element: conditionaldefaultflowMarker,
17449
- attrs: {
17450
- stroke: stroke
17451
- },
17535
+ element: defaultFlowMarker,
17452
17536
  ref: { x: 0, y: 10 },
17453
17537
  scale: 0.5
17454
17538
  });
@@ -17464,11 +17548,7 @@
17464
17548
 
17465
17549
  offset = offset || 0;
17466
17550
 
17467
- attrs = computeStyle(attrs, {
17468
- stroke: black,
17469
- strokeWidth: 2,
17470
- fill: 'white'
17471
- });
17551
+ attrs = shapeStyle(attrs);
17472
17552
 
17473
17553
  if (attrs.fill === 'none') {
17474
17554
  delete attrs.fillOpacity;
@@ -17477,13 +17557,12 @@
17477
17557
  var cx = width / 2,
17478
17558
  cy = height / 2;
17479
17559
 
17480
- var circle = create$1('circle');
17481
- attr(circle, {
17560
+ var circle = create$1('circle', {
17482
17561
  cx: cx,
17483
17562
  cy: cy,
17484
- r: Math.round((width + height) / 4 - offset)
17563
+ r: Math.round((width + height) / 4 - offset),
17564
+ ...attrs
17485
17565
  });
17486
- attr(circle, attrs);
17487
17566
 
17488
17567
  append(parentGfx, circle);
17489
17568
 
@@ -17499,22 +17578,17 @@
17499
17578
 
17500
17579
  offset = offset || 0;
17501
17580
 
17502
- attrs = computeStyle(attrs, {
17503
- stroke: black,
17504
- strokeWidth: 2,
17505
- fill: 'white'
17506
- });
17581
+ attrs = shapeStyle(attrs);
17507
17582
 
17508
- var rect = create$1('rect');
17509
- attr(rect, {
17583
+ var rect = create$1('rect', {
17510
17584
  x: offset,
17511
17585
  y: offset,
17512
17586
  width: width - offset * 2,
17513
17587
  height: height - offset * 2,
17514
17588
  rx: r,
17515
- ry: r
17589
+ ry: r,
17590
+ ...attrs
17516
17591
  });
17517
- attr(rect, attrs);
17518
17592
 
17519
17593
  append(parentGfx, rect);
17520
17594
 
@@ -17526,53 +17600,66 @@
17526
17600
  var x_2 = width / 2;
17527
17601
  var y_2 = height / 2;
17528
17602
 
17529
- var points = [ { x: x_2, y: 0 }, { x: width, y: y_2 }, { x: x_2, y: height }, { x: 0, y: y_2 } ];
17603
+ var points = [
17604
+ { x: x_2, y: 0 },
17605
+ { x: width, y: y_2 },
17606
+ { x: x_2, y: height },
17607
+ { x: 0, y: y_2 }
17608
+ ];
17530
17609
 
17531
17610
  var pointsString = points.map(function(point) {
17532
17611
  return point.x + ',' + point.y;
17533
17612
  }).join(' ');
17534
17613
 
17535
- attrs = computeStyle(attrs, {
17536
- stroke: black,
17537
- strokeWidth: 2,
17538
- fill: 'white'
17539
- });
17614
+ attrs = shapeStyle(attrs);
17540
17615
 
17541
- var polygon = create$1('polygon');
17542
- attr(polygon, {
17616
+ var polygon = create$1('polygon', {
17617
+ ...attrs,
17543
17618
  points: pointsString
17544
17619
  });
17545
- attr(polygon, attrs);
17546
17620
 
17547
17621
  append(parentGfx, polygon);
17548
17622
 
17549
17623
  return polygon;
17550
17624
  }
17551
17625
 
17552
- function drawLine(parentGfx, waypoints, attrs) {
17553
- attrs = computeStyle(attrs, [ 'no-fill' ], {
17554
- stroke: black,
17555
- strokeWidth: 2,
17556
- fill: 'none'
17557
- });
17626
+ /**
17627
+ * @param {SVGElement} parentGfx
17628
+ * @param {Point[]} waypoints
17629
+ * @param {any} attrs
17630
+ * @param {number} [radius]
17631
+ *
17632
+ * @return {SVGElement}
17633
+ */
17634
+ function drawLine(parentGfx, waypoints, attrs, radius) {
17635
+ attrs = lineStyle(attrs);
17558
17636
 
17559
- var line = createLine(waypoints, attrs);
17637
+ var line = createLine(waypoints, attrs, radius);
17560
17638
 
17561
17639
  append(parentGfx, line);
17562
17640
 
17563
17641
  return line;
17564
17642
  }
17565
17643
 
17644
+ /**
17645
+ * @param {SVGElement} parentGfx
17646
+ * @param {Point[]} waypoints
17647
+ * @param {any} attrs
17648
+ *
17649
+ * @return {SVGElement}
17650
+ */
17651
+ function drawConnectionSegments(parentGfx, waypoints, attrs) {
17652
+ return drawLine(parentGfx, waypoints, attrs, 5);
17653
+ }
17654
+
17566
17655
  function drawPath(parentGfx, d, attrs) {
17567
17656
 
17568
- attrs = computeStyle(attrs, [ 'no-fill' ], {
17569
- strokeWidth: 2,
17570
- stroke: black
17571
- });
17657
+ attrs = lineStyle(attrs);
17572
17658
 
17573
- var path = create$1('path');
17574
- attr(path, { d: d });
17575
- attr(path, attrs);
17659
+ var path = create$1('path', {
17660
+ ...attrs,
17661
+ d
17662
+ });
17576
17663
 
17577
17664
  append(parentGfx, path);
17578
17665
 
@@ -17673,7 +17760,7 @@
17673
17760
  return renderLabel(parentGfx, semantic.name, {
17674
17761
  box: element,
17675
17762
  align: align,
17676
- padding: 5,
17763
+ padding: 7,
17677
17764
  style: {
17678
17765
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
17679
17766
  }
@@ -17719,16 +17806,6 @@
17719
17806
  transform(textBox, 0, -top, 270);
17720
17807
  }
17721
17808
 
17722
- function createPathFromConnection(connection) {
17723
- var waypoints = connection.waypoints;
17724
-
17725
- var pathData = 'm ' + waypoints[0].x + ',' + waypoints[0].y;
17726
- for (var i = 1; i < waypoints.length; i++) {
17727
- pathData += 'L' + waypoints[i].x + ',' + waypoints[i].y + ' ';
17728
- }
17729
- return pathData;
17730
- }
17731
-
17732
17809
  var handlers = this.handlers = {
17733
17810
  'bpmn:Event': function(parentGfx, element, attrs) {
17734
17811
 
@@ -17749,7 +17826,6 @@
17749
17826
  if (!semantic.isInterrupting) {
17750
17827
  attrs = {
17751
17828
  strokeDasharray: '6',
17752
- strokeLinecap: 'round',
17753
17829
  fill: getFillColor(element, defaultFillColor),
17754
17830
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17755
17831
  };
@@ -17804,7 +17880,6 @@
17804
17880
 
17805
17881
  drawPath(parentGfx, pathData, {
17806
17882
  strokeWidth: 2,
17807
- strokeLinecap: 'square',
17808
17883
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17809
17884
  });
17810
17885
 
@@ -17826,7 +17901,6 @@
17826
17901
 
17827
17902
  drawPath(parentGfx, linePathData, {
17828
17903
  strokeWidth: 1,
17829
- strokeLinecap: 'square',
17830
17904
  transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')',
17831
17905
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17832
17906
  });
@@ -18034,14 +18108,14 @@
18034
18108
  },
18035
18109
  'bpmn:IntermediateEvent': function(parentGfx, element) {
18036
18110
  var outer = renderer('bpmn:Event')(parentGfx, element, {
18037
- strokeWidth: 1,
18111
+ strokeWidth: 1.5,
18038
18112
  fill: getFillColor(element, defaultFillColor),
18039
18113
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18040
18114
  });
18041
18115
 
18042
18116
  /* inner */
18043
18117
  drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
18044
- strokeWidth: 1,
18118
+ strokeWidth: 1.5,
18045
18119
  fill: getFillColor(element, 'none'),
18046
18120
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18047
18121
  });
@@ -18294,10 +18368,11 @@
18294
18368
  return task;
18295
18369
  },
18296
18370
  'bpmn:SubProcess': function(parentGfx, element, attrs) {
18297
- attrs = assign$1({
18371
+ attrs = {
18298
18372
  fill: getFillColor(element, defaultFillColor),
18299
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18300
- }, attrs);
18373
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18374
+ ...attrs
18375
+ };
18301
18376
 
18302
18377
  var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
18303
18378
 
@@ -18305,7 +18380,8 @@
18305
18380
 
18306
18381
  if (isEventSubProcess(element)) {
18307
18382
  attr(rect, {
18308
- strokeDasharray: '1,2'
18383
+ strokeDasharray: '0, 5.5',
18384
+ strokeWidth: 2.5
18309
18385
  });
18310
18386
  }
18311
18387
 
@@ -18323,13 +18399,14 @@
18323
18399
  return renderer('bpmn:SubProcess')(parentGfx, element);
18324
18400
  },
18325
18401
  'bpmn:Transaction': function(parentGfx, element) {
18326
- var outer = renderer('bpmn:SubProcess')(parentGfx, element);
18402
+ var outer = renderer('bpmn:SubProcess')(parentGfx, element, { strokeWidth: 1.5 });
18327
18403
 
18328
18404
  var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
18329
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18405
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18406
+ strokeWidth: 1.5
18330
18407
  });
18331
18408
 
18332
- /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 2, INNER_OUTER_DIST, innerAttrs);
18409
+ /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 3, INNER_OUTER_DIST, innerAttrs);
18333
18410
 
18334
18411
  return outer;
18335
18412
  },
@@ -18340,10 +18417,13 @@
18340
18417
  },
18341
18418
  'bpmn:Participant': function(parentGfx, element) {
18342
18419
 
18420
+ var strokeWidth = 1.5;
18421
+
18343
18422
  var attrs = {
18344
18423
  fillOpacity: DEFAULT_FILL_OPACITY,
18345
18424
  fill: getFillColor(element, defaultFillColor),
18346
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18425
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18426
+ strokeWidth
18347
18427
  };
18348
18428
 
18349
18429
  var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);
@@ -18355,13 +18435,14 @@
18355
18435
  { x: 30, y: 0 },
18356
18436
  { x: 30, y: element.height }
18357
18437
  ], {
18358
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18438
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18439
+ strokeWidth
18359
18440
  });
18360
18441
  var text = getSemantic(element).name;
18361
18442
  renderLaneLabel(parentGfx, text, element);
18362
18443
  } else {
18363
18444
 
18364
- // Collapsed pool draw text inline
18445
+ // collapsed pool draw text inline
18365
18446
  var text2 = getSemantic(element).name;
18366
18447
  renderLabel(parentGfx, text2, {
18367
18448
  box: element, align: 'center-middle',
@@ -18380,11 +18461,13 @@
18380
18461
  return lane;
18381
18462
  },
18382
18463
  'bpmn:Lane': function(parentGfx, element, attrs) {
18383
- var rect = drawRect(parentGfx, element.width, element.height, 0, assign$1({
18464
+ var rect = drawRect(parentGfx, element.width, element.height, 0, {
18384
18465
  fill: getFillColor(element, defaultFillColor),
18385
18466
  fillOpacity: HIGH_FILL_OPACITY,
18386
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18387
- }, attrs));
18467
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18468
+ strokeWidth: 1.5,
18469
+ ...attrs
18470
+ });
18388
18471
 
18389
18472
  var semantic = getSemantic(element);
18390
18473
 
@@ -18503,13 +18586,11 @@
18503
18586
  }
18504
18587
  });
18505
18588
 
18506
- var attrs = {
18589
+ /* event path */ drawPath(parentGfx, pathData, {
18507
18590
  strokeWidth: 2,
18508
18591
  fill: getFillColor(element, 'none'),
18509
18592
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18510
- };
18511
-
18512
- /* event path */ drawPath(parentGfx, pathData, attrs);
18593
+ });
18513
18594
  }
18514
18595
 
18515
18596
  if (type === 'Parallel') {
@@ -18525,16 +18606,14 @@
18525
18606
  }
18526
18607
  });
18527
18608
 
18528
- var parallelPath = drawPath(parentGfx, pathData);
18529
- attr(parallelPath, {
18609
+ drawPath(parentGfx, pathData, {
18530
18610
  strokeWidth: 1,
18531
18611
  fill: 'none'
18532
18612
  });
18533
18613
  } else if (type === 'Exclusive') {
18534
18614
 
18535
18615
  if (!instantiate) {
18536
- var innerCircle = drawCircle(parentGfx, element.width, element.height, element.height * 0.26);
18537
- attr(innerCircle, {
18616
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
18538
18617
  strokeWidth: 1,
18539
18618
  fill: 'none',
18540
18619
  stroke: getStrokeColor$1(element, defaultStrokeColor)
@@ -18548,27 +18627,20 @@
18548
18627
  return diamond;
18549
18628
  },
18550
18629
  'bpmn:Gateway': function(parentGfx, element) {
18551
- var attrs = {
18630
+ return drawDiamond(parentGfx, element.width, element.height, {
18552
18631
  fill: getFillColor(element, defaultFillColor),
18553
18632
  fillOpacity: DEFAULT_FILL_OPACITY,
18554
18633
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18555
- };
18556
-
18557
- return drawDiamond(parentGfx, element.width, element.height, attrs);
18634
+ });
18558
18635
  },
18559
18636
  'bpmn:SequenceFlow': function(parentGfx, element) {
18560
- var pathData = createPathFromConnection(element);
18561
-
18562
18637
  var fill = getFillColor(element, defaultFillColor),
18563
18638
  stroke = getStrokeColor$1(element, defaultStrokeColor);
18564
18639
 
18565
- var attrs = {
18566
- strokeLinejoin: 'round',
18640
+ var path = drawConnectionSegments(parentGfx, element.waypoints, {
18567
18641
  markerEnd: marker('sequenceflow-end', fill, stroke),
18568
18642
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18569
- };
18570
-
18571
- var path = drawPath(parentGfx, pathData, attrs);
18643
+ });
18572
18644
 
18573
18645
  var sequenceFlow = getSemantic(element);
18574
18646
 
@@ -18602,12 +18674,11 @@
18602
18674
  var fill = getFillColor(element, defaultFillColor),
18603
18675
  stroke = getStrokeColor$1(element, defaultStrokeColor);
18604
18676
 
18605
- attrs = assign$1({
18606
- strokeDasharray: '0.5, 5',
18607
- strokeLinecap: 'round',
18608
- strokeLinejoin: 'round',
18609
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18610
- }, attrs || {});
18677
+ attrs = {
18678
+ strokeDasharray: '0, 5',
18679
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18680
+ ...attrs
18681
+ };
18611
18682
 
18612
18683
  if (semantic.associationDirection === 'One' ||
18613
18684
  semantic.associationDirection === 'Both') {
@@ -18618,7 +18689,7 @@
18618
18689
  attrs.markerStart = marker('association-start', fill, stroke);
18619
18690
  }
18620
18691
 
18621
- return drawLine(parentGfx, element.waypoints, attrs);
18692
+ return drawConnectionSegments(parentGfx, element.waypoints, attrs);
18622
18693
  },
18623
18694
  'bpmn:DataInputAssociation': function(parentGfx, element) {
18624
18695
  var fill = getFillColor(element, defaultFillColor),
@@ -18644,19 +18715,13 @@
18644
18715
  var fill = getFillColor(element, defaultFillColor),
18645
18716
  stroke = getStrokeColor$1(element, defaultStrokeColor);
18646
18717
 
18647
- var pathData = createPathFromConnection(element);
18648
-
18649
- var attrs = {
18718
+ var path = drawConnectionSegments(parentGfx, element.waypoints, {
18650
18719
  markerEnd: marker('messageflow-end', fill, stroke),
18651
18720
  markerStart: marker('messageflow-start', fill, stroke),
18652
- strokeDasharray: '10, 12',
18653
- strokeLinecap: 'round',
18654
- strokeLinejoin: 'round',
18655
- strokeWidth: '1.5px',
18721
+ strokeDasharray: '10, 11',
18722
+ strokeWidth: 1.5,
18656
18723
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18657
- };
18658
-
18659
- var path = drawPath(parentGfx, pathData, attrs);
18724
+ });
18660
18725
 
18661
18726
  if (semantic.messageRef) {
18662
18727
  var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
@@ -18779,25 +18844,26 @@
18779
18844
  cancel = semantic.cancelActivity;
18780
18845
 
18781
18846
  var attrs = {
18782
- strokeWidth: 1,
18847
+ strokeWidth: 1.5,
18783
18848
  fill: getFillColor(element, defaultFillColor),
18784
18849
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18785
18850
  };
18786
18851
 
18787
18852
  if (!cancel) {
18788
18853
  attrs.strokeDasharray = '6';
18789
- attrs.strokeLinecap = 'round';
18790
18854
  }
18791
18855
 
18792
18856
  // apply fillOpacity
18793
- var outerAttrs = assign$1({}, attrs, {
18857
+ var outerAttrs = {
18858
+ ...attrs,
18794
18859
  fillOpacity: 1
18795
- });
18860
+ };
18796
18861
 
18797
18862
  // apply no-fill
18798
- var innerAttrs = assign$1({}, attrs, {
18863
+ var innerAttrs = {
18864
+ ...attrs,
18799
18865
  fill: 'none'
18800
- });
18866
+ };
18801
18867
 
18802
18868
  var outer = renderer('bpmn:Event')(parentGfx, element, outerAttrs);
18803
18869
 
@@ -18808,27 +18874,22 @@
18808
18874
  return outer;
18809
18875
  },
18810
18876
  'bpmn:Group': function(parentGfx, element) {
18811
-
18812
- var group = drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
18877
+ return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
18813
18878
  stroke: getStrokeColor$1(element, defaultStrokeColor),
18814
- strokeWidth: 1,
18815
- strokeDasharray: '8,3,1,3',
18879
+ strokeWidth: 1.5,
18880
+ strokeDasharray: '10,6,0,6',
18816
18881
  fill: 'none',
18817
18882
  pointerEvents: 'none'
18818
18883
  });
18819
-
18820
- return group;
18821
18884
  },
18822
18885
  'label': function(parentGfx, element) {
18823
18886
  return renderExternalLabel(parentGfx, element);
18824
18887
  },
18825
18888
  'bpmn:TextAnnotation': function(parentGfx, element) {
18826
- var style = {
18889
+ var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, {
18827
18890
  'fill': 'none',
18828
18891
  'stroke': 'none'
18829
- };
18830
-
18831
- var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, style);
18892
+ });
18832
18893
 
18833
18894
  var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
18834
18895
  xScaleFactor: 1,
@@ -18849,7 +18910,7 @@
18849
18910
  renderLabel(parentGfx, text, {
18850
18911
  box: element,
18851
18912
  align: 'left-top',
18852
- padding: 5,
18913
+ padding: 7,
18853
18914
  style: {
18854
18915
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
18855
18916
  }
@@ -18967,10 +19028,9 @@
18967
19028
  });
18968
19029
 
18969
19030
  drawMarker('loop', parentGfx, markerPath, {
18970
- strokeWidth: 1,
19031
+ strokeWidth: 1.5,
18971
19032
  fill: getFillColor(element, defaultFillColor),
18972
19033
  stroke: getStrokeColor$1(element, defaultStrokeColor),
18973
- strokeLinecap: 'round',
18974
19034
  strokeMiterlimit: 0.5
18975
19035
  });
18976
19036
  },
@@ -20684,7 +20744,7 @@
20684
20744
  return isPrimaryButton(event) || isAuxiliaryButton(event);
20685
20745
  }
20686
20746
 
20687
- var LOW_PRIORITY$q = 500;
20747
+ var LOW_PRIORITY$r = 500;
20688
20748
 
20689
20749
 
20690
20750
  /**
@@ -20879,7 +20939,7 @@
20879
20939
  eventBus.on([
20880
20940
  'shape.changed',
20881
20941
  'connection.changed'
20882
- ], LOW_PRIORITY$q, function(event) {
20942
+ ], LOW_PRIORITY$r, function(event) {
20883
20943
 
20884
20944
  var element = event.element,
20885
20945
  gfx = event.gfx;
@@ -20887,7 +20947,7 @@
20887
20947
  eventBus.fire('interactionEvents.updateHit', { element: element, gfx: gfx });
20888
20948
  });
20889
20949
 
20890
- eventBus.on('interactionEvents.createHit', LOW_PRIORITY$q, function(event) {
20950
+ eventBus.on('interactionEvents.createHit', LOW_PRIORITY$r, function(event) {
20891
20951
  var element = event.element,
20892
20952
  gfx = event.gfx;
20893
20953
 
@@ -21164,7 +21224,7 @@
21164
21224
  interactionEvents: [ 'type', InteractionEvents ]
21165
21225
  };
21166
21226
 
21167
- var LOW_PRIORITY$p = 500;
21227
+ var LOW_PRIORITY$q = 500;
21168
21228
 
21169
21229
 
21170
21230
  /**
@@ -21191,7 +21251,7 @@
21191
21251
  attr(outline, assign$1({
21192
21252
  x: 10,
21193
21253
  y: 10,
21194
- rx: 3,
21254
+ rx: 4,
21195
21255
  width: 100,
21196
21256
  height: 100
21197
21257
  }, OUTLINE_STYLE));
@@ -21203,7 +21263,7 @@
21203
21263
 
21204
21264
  // A low priortity is necessary, because outlines of labels have to be updated
21205
21265
  // after the label bounds have been updated in the renderer.
21206
- eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$p, function(event) {
21266
+ eventBus.on([ 'shape.added', 'shape.changed' ], LOW_PRIORITY$q, function(event) {
21207
21267
  var element = event.element,
21208
21268
  gfx = event.gfx;
21209
21269
 
@@ -21649,7 +21709,7 @@
21649
21709
  // document wide unique overlay ids
21650
21710
  var ids$1 = new IdGenerator('ov');
21651
21711
 
21652
- var LOW_PRIORITY$o = 500;
21712
+ var LOW_PRIORITY$p = 500;
21653
21713
 
21654
21714
 
21655
21715
  /**
@@ -22221,7 +22281,7 @@
22221
22281
 
22222
22282
  // move integration
22223
22283
 
22224
- eventBus.on('element.changed', LOW_PRIORITY$o, function(e) {
22284
+ eventBus.on('element.changed', LOW_PRIORITY$p, function(e) {
22225
22285
  var element = e.element;
22226
22286
 
22227
22287
  var container = self._getOverlayContainer(element, true);
@@ -23181,7 +23241,7 @@
23181
23241
  return true;
23182
23242
  }
23183
23243
 
23184
- var LOW_PRIORITY$n = 250;
23244
+ var LOW_PRIORITY$o = 250;
23185
23245
  var ARROW_DOWN_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>';
23186
23246
 
23187
23247
  var EMPTY_MARKER = 'bjs-drilldown-empty';
@@ -23198,7 +23258,7 @@
23198
23258
 
23199
23259
  var self = this;
23200
23260
 
23201
- this.executed('shape.toggleCollapse', LOW_PRIORITY$n, function(context) {
23261
+ this.executed('shape.toggleCollapse', LOW_PRIORITY$o, function(context) {
23202
23262
  var shape = context.shape;
23203
23263
 
23204
23264
  // Add overlay to the collapsed shape
@@ -23210,7 +23270,7 @@
23210
23270
  }, true);
23211
23271
 
23212
23272
 
23213
- this.reverted('shape.toggleCollapse', LOW_PRIORITY$n, function(context) {
23273
+ this.reverted('shape.toggleCollapse', LOW_PRIORITY$o, function(context) {
23214
23274
  var shape = context.shape;
23215
23275
 
23216
23276
  // Add overlay to the collapsed shape
@@ -23222,7 +23282,7 @@
23222
23282
  }, true);
23223
23283
 
23224
23284
 
23225
- this.executed([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$n,
23285
+ this.executed([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$o,
23226
23286
  function(context) {
23227
23287
  var oldParent = context.oldParent,
23228
23288
  newParent = context.newParent || context.parent,
@@ -23239,7 +23299,7 @@
23239
23299
  }, true);
23240
23300
 
23241
23301
 
23242
- this.reverted([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$n,
23302
+ this.reverted([ 'shape.create', 'shape.move', 'shape.delete' ], LOW_PRIORITY$o,
23243
23303
  function(context) {
23244
23304
  var oldParent = context.oldParent,
23245
23305
  newParent = context.newParent || context.parent,
@@ -23688,7 +23748,7 @@
23688
23748
  return target && (matches(target, 'input, textarea') || target.contentEditable === 'true');
23689
23749
  }
23690
23750
 
23691
- var LOW_PRIORITY$m = 500;
23751
+ var LOW_PRIORITY$n = 500;
23692
23752
 
23693
23753
 
23694
23754
  /**
@@ -23704,7 +23764,7 @@
23704
23764
 
23705
23765
  var self = this;
23706
23766
 
23707
- eventBus.on('editorActions.init', LOW_PRIORITY$m, function(event) {
23767
+ eventBus.on('editorActions.init', LOW_PRIORITY$n, function(event) {
23708
23768
 
23709
23769
  var editorActions = event.editorActions;
23710
23770
 
@@ -28159,7 +28219,7 @@
28159
28219
  * @param {boolean} selected
28160
28220
  * @param {function} onMouseEnter
28161
28221
  * @param {function} onMouseLeave
28162
- * @param {function} onClick
28222
+ * @param {function} onAction
28163
28223
  */
28164
28224
  function PopupMenuItem(props) {
28165
28225
  const {
@@ -28167,7 +28227,7 @@
28167
28227
  selected,
28168
28228
  onMouseEnter,
28169
28229
  onMouseLeave,
28170
- onClick
28230
+ onAction
28171
28231
  } = props;
28172
28232
 
28173
28233
  return m$1`
@@ -28175,16 +28235,18 @@
28175
28235
  class=${ clsx('entry', { selected }) }
28176
28236
  data-id=${ entry.id }
28177
28237
  title=${ entry.title || entry.label }
28178
- onClick=${ onClick }
28238
+ onClick=${ onAction }
28179
28239
  onMouseEnter=${ onMouseEnter }
28180
28240
  onMouseLeave=${ onMouseLeave }
28241
+ onDragStart=${ (event) => onAction(event, entry, 'dragstart') }
28242
+ draggable=${ true }
28181
28243
  >
28182
28244
  <div class="djs-popup-entry-content">
28183
28245
  <span
28184
28246
  class=${ clsx('djs-popup-entry-name', entry.className) }
28185
28247
  >
28186
28248
  ${ entry.imageUrl ? m$1`
28187
- <img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
28249
+ <img class="djs-popup-entry-icon" src=${ entry.imageUrl } alt="" />
28188
28250
  ` : null }
28189
28251
 
28190
28252
  ${ entry.label ? m$1`
@@ -28227,7 +28289,7 @@
28227
28289
  * @param {Array} entries
28228
28290
  * @param {Object} selectedEntry
28229
28291
  * @param {function} setSelectedEntry
28230
- * @param {function} onClick
28292
+ * @param {function} onAction
28231
28293
  * @param {Object} resultsRef
28232
28294
  */
28233
28295
 
@@ -28235,8 +28297,8 @@
28235
28297
  const {
28236
28298
  selectedEntry,
28237
28299
  setSelectedEntry,
28238
- onClick,
28239
- entries
28300
+ entries,
28301
+ ...restProps
28240
28302
  } = props;
28241
28303
 
28242
28304
  const resultsRef = _();
@@ -28273,7 +28335,7 @@
28273
28335
  selected=${ entry === selectedEntry }
28274
28336
  onMouseEnter=${ () => setSelectedEntry(entry) }
28275
28337
  onMouseLeave=${ () => setSelectedEntry(null) }
28276
- onClick=${ onClick }
28338
+ ...${ restProps }
28277
28339
  />
28278
28340
  `) }
28279
28341
  </ul>
@@ -28398,7 +28460,8 @@
28398
28460
 
28399
28461
  const search = [
28400
28462
  entry.description || '',
28401
- entry.label || ''
28463
+ entry.label || '',
28464
+ entry.search || ''
28402
28465
  ]
28403
28466
  .join('---')
28404
28467
  .toLowerCase();
@@ -28508,7 +28571,7 @@
28508
28571
  onMouseLeave=${ () => setSelectedEntry(null) }
28509
28572
  >
28510
28573
  ${ entry.imageUrl ? m$1`
28511
- <img class="djs-popup-entry-icon" src=${ entry.imageUrl } />
28574
+ <img class="djs-popup-entry-icon" src=${ entry.imageUrl } alt="" />
28512
28575
  ` : null }
28513
28576
 
28514
28577
  ${ entry.label ? m$1`
@@ -28537,7 +28600,7 @@
28537
28600
  entries=${ entries }
28538
28601
  selectedEntry=${ selectedEntry }
28539
28602
  setSelectedEntry=${ setSelectedEntry }
28540
- onClick=${ onSelect }
28603
+ onAction=${ onSelect }
28541
28604
  />
28542
28605
  </div>
28543
28606
  ${ entries.length === 0 && m$1`
@@ -28702,17 +28765,13 @@
28702
28765
  options
28703
28766
  } = this._current;
28704
28767
 
28705
- const entriesArray = [
28706
- ...Object.entries(entries).map(
28707
- ([ key, value ]) => ({ id: key, ...value })
28708
- )
28709
- ];
28768
+ const entriesArray = Object.entries(entries).map(
28769
+ ([ key, value ]) => ({ id: key, ...value })
28770
+ );
28710
28771
 
28711
- const headerEntriesArray = [
28712
- ...Object.entries(headerEntries).map(
28713
- ([ key, value ]) => ({ id: key, ...value })
28714
- )
28715
- ];
28772
+ const headerEntriesArray = Object.entries(headerEntries).map(
28773
+ ([ key, value ]) => ({ id: key, ...value })
28774
+ );
28716
28775
 
28717
28776
  const position = _position && (
28718
28777
  (container) => this._ensureVisible(container, _position)
@@ -28721,7 +28780,7 @@
28721
28780
  const scale = this._updateScale(this._current.container);
28722
28781
 
28723
28782
  const onClose = result => this.close(result);
28724
- const onSelect = (event, entry) => this.trigger(event, entry);
28783
+ const onSelect = (event, entry, action) => this.trigger(event, entry, action);
28725
28784
 
28726
28785
  P(
28727
28786
  m$1`
@@ -29118,10 +29177,11 @@
29118
29177
  *
29119
29178
  * @param {Object} event
29120
29179
  * @param {Object} entry
29180
+ * @param {string} [action='click'] the action to trigger
29121
29181
  *
29122
29182
  * @return the result of the action callback, if any
29123
29183
  */
29124
- PopupMenu.prototype.trigger = function(event, entry) {
29184
+ PopupMenu.prototype.trigger = function(event, entry, action = 'click') {
29125
29185
 
29126
29186
  // silence other actions
29127
29187
  event.preventDefault();
@@ -29133,8 +29193,16 @@
29133
29193
  entry = this._getEntry(entryId);
29134
29194
  }
29135
29195
 
29136
- if (entry.action) {
29137
- return entry.action.call(null, event, entry);
29196
+ const handler = entry.action;
29197
+
29198
+ if (isFunction(handler)) {
29199
+ if (action === 'click') {
29200
+ return handler(event, entry);
29201
+ }
29202
+ } else {
29203
+ if (handler[action]) {
29204
+ return handler[action](event, entry);
29205
+ }
29138
29206
  }
29139
29207
  };
29140
29208
 
@@ -29178,14 +29246,14 @@
29178
29246
 
29179
29247
  var ICONS$1 = icons$1;
29180
29248
 
29181
- var LOW_PRIORITY$l = 900;
29249
+ var LOW_PRIORITY$m = 900;
29182
29250
 
29183
29251
  /**
29184
29252
  * A provider for align elements context pad button
29185
29253
  */
29186
29254
  function AlignElementsContextPadProvider(contextPad, popupMenu, translate, canvas) {
29187
29255
 
29188
- contextPad.registerProvider(LOW_PRIORITY$l, this);
29256
+ contextPad.registerProvider(LOW_PRIORITY$m, this);
29189
29257
 
29190
29258
  this._contextPad = contextPad;
29191
29259
  this._popupMenu = popupMenu;
@@ -29739,7 +29807,7 @@
29739
29807
  return true;
29740
29808
  }
29741
29809
 
29742
- var LOW_PRIORITY$k = 100;
29810
+ var LOW_PRIORITY$l = 100;
29743
29811
 
29744
29812
 
29745
29813
  /**
@@ -29751,7 +29819,7 @@
29751
29819
  */
29752
29820
  function AutoPlace$1(eventBus, modeling, canvas) {
29753
29821
 
29754
- eventBus.on('autoPlace', LOW_PRIORITY$k, function(context) {
29822
+ eventBus.on('autoPlace', LOW_PRIORITY$l, function(context) {
29755
29823
  var shape = context.shape,
29756
29824
  source = context.source;
29757
29825
 
@@ -29969,7 +30037,7 @@
29969
30037
  y: sourceTrbl.top - 50 - element.height / 2
29970
30038
  };
29971
30039
 
29972
- if (isConnection$e(source)) {
30040
+ if (isConnection$f(source)) {
29973
30041
  position = getMid(source);
29974
30042
  position.x += 100;
29975
30043
  position.y -= 50;
@@ -30008,7 +30076,7 @@
30008
30076
  return findFreePosition(source, element, position, generateGetNextPosition(nextPositionDirection));
30009
30077
  }
30010
30078
 
30011
- function isConnection$e(element) {
30079
+ function isConnection$f(element) {
30012
30080
  return !!element.waypoints;
30013
30081
  }
30014
30082
 
@@ -31434,7 +31502,7 @@
31434
31502
  * Returns the length of a vector
31435
31503
  *
31436
31504
  * @param {Vector}
31437
- * @return {Float}
31505
+ * @return {number}
31438
31506
  */
31439
31507
  function vectorLength(v) {
31440
31508
  return Math.sqrt(Math.pow(v.x, 2) + Math.pow(v.y, 2));
@@ -31445,7 +31513,7 @@
31445
31513
  * Calculates the angle between a line a the yAxis
31446
31514
  *
31447
31515
  * @param {Array}
31448
- * @return {Float}
31516
+ * @return {number}
31449
31517
  */
31450
31518
  function getAngle(line) {
31451
31519
 
@@ -31459,7 +31527,7 @@
31459
31527
  * Rotates a vector by a given angle
31460
31528
  *
31461
31529
  * @param {Vector}
31462
- * @param {Float} Angle in radians
31530
+ * @param {number} Angle in radians
31463
31531
  * @return {Vector}
31464
31532
  */
31465
31533
  function rotateVector(vector, angle) {
@@ -31477,7 +31545,7 @@
31477
31545
  * @param {Vector}
31478
31546
  * @param {Vector}
31479
31547
  * @param {Vector}
31480
- * @return {Float}
31548
+ * @return {number}
31481
31549
  */
31482
31550
  function solveLambaSystem(a, b, c) {
31483
31551
 
@@ -31499,7 +31567,7 @@
31499
31567
  * Position of perpendicular foot
31500
31568
  *
31501
31569
  * @param {Point}
31502
- * @param [ {Point}, {Point} ] line defined through two points
31570
+ * @param {[ Point, Point ]} line defined through two points
31503
31571
  * @return {Point} the perpendicular foot position
31504
31572
  */
31505
31573
  function perpendicularFoot(point, line) {
@@ -31519,9 +31587,10 @@
31519
31587
  /**
31520
31588
  * Calculates the distance between a point and a line
31521
31589
  *
31522
- * @param {Point}
31523
- * @param [ {Point}, {Point} ] line defined through two points
31524
- * @return {Float} distance
31590
+ * @param { Point }
31591
+ * @param { [ Point, Point ] } line defined through two points
31592
+ *
31593
+ * @return { number } distance
31525
31594
  */
31526
31595
  function getDistancePointLine(point, line) {
31527
31596
 
@@ -31542,7 +31611,8 @@
31542
31611
  *
31543
31612
  * @param {Point}
31544
31613
  * @param {Point}
31545
- * @return {Float} distance
31614
+ *
31615
+ * @return {number} distance
31546
31616
  */
31547
31617
  function getDistancePointPoint(point1, point2) {
31548
31618
 
@@ -33248,7 +33318,7 @@
33248
33318
  hoverMid = hover && getSnapPoint(hover, event);
33249
33319
 
33250
33320
  // only snap on connections, elements can have multiple connect endpoints
33251
- if (!isConnection$d(hover) || !hoverMid || !hoverMid.x || !hoverMid.y) {
33321
+ if (!isConnection$e(hover) || !hoverMid || !hoverMid.x || !hoverMid.y) {
33252
33322
  return;
33253
33323
  }
33254
33324
 
@@ -33303,7 +33373,7 @@
33303
33373
 
33304
33374
  // helpers //////////////////////
33305
33375
 
33306
- function isConnection$d(element) {
33376
+ function isConnection$e(element) {
33307
33377
  return element && !!element.waypoints;
33308
33378
  }
33309
33379
 
@@ -33461,7 +33531,7 @@
33461
33531
  }
33462
33532
 
33463
33533
  var HIGH_PRIORITY$h = 1100,
33464
- LOW_PRIORITY$j = 900;
33534
+ LOW_PRIORITY$k = 900;
33465
33535
 
33466
33536
  var MARKER_OK$3 = 'connect-ok',
33467
33537
  MARKER_NOT_OK$3 = 'connect-not-ok';
@@ -33505,7 +33575,7 @@
33505
33575
  });
33506
33576
  });
33507
33577
 
33508
- eventBus.on('connect.hover', LOW_PRIORITY$j, function(event) {
33578
+ eventBus.on('connect.hover', LOW_PRIORITY$k, function(event) {
33509
33579
  var context = event.context,
33510
33580
  hover = event.hover,
33511
33581
  canExecute = context.canExecute;
@@ -33772,18 +33842,12 @@
33772
33842
  * @returns {SVGElement}
33773
33843
  */
33774
33844
  ConnectionPreview.prototype.createNoopConnection = function(start, end) {
33775
- var connection = create$1('polyline');
33776
-
33777
- attr(connection, {
33845
+ return createLine([ start, end ], {
33778
33846
  'stroke': '#333',
33779
33847
  'strokeDasharray': [ 1 ],
33780
33848
  'strokeWidth': 2,
33781
33849
  'pointer-events': 'none'
33782
33850
  });
33783
-
33784
- attr(connection, { 'points': [ start.x, start.y, end.x, end.y ] });
33785
-
33786
- return connection;
33787
33851
  };
33788
33852
 
33789
33853
  // helpers //////////
@@ -34490,6 +34554,7 @@
34490
34554
  'path',
34491
34555
  'polygon',
34492
34556
  'polyline',
34557
+ 'path',
34493
34558
  'rect'
34494
34559
  ];
34495
34560
 
@@ -34764,7 +34829,7 @@
34764
34829
  });
34765
34830
 
34766
34831
  var shape = find(elements, function(element) {
34767
- return !isConnection$c(element);
34832
+ return !isConnection$d(element);
34768
34833
  });
34769
34834
 
34770
34835
  var attach = false,
@@ -34919,7 +34984,7 @@
34919
34984
 
34920
34985
  // update shape
34921
34986
  shape = find(elements, function(element) {
34922
- return !isConnection$c(element);
34987
+ return !isConnection$d(element);
34923
34988
  });
34924
34989
  }
34925
34990
 
@@ -34960,7 +35025,7 @@
34960
35025
  }
34961
35026
 
34962
35027
  var shape = find(elements, function(element) {
34963
- return !isConnection$c(element);
35028
+ return !isConnection$d(element);
34964
35029
  });
34965
35030
 
34966
35031
  if (!shape) {
@@ -34994,7 +35059,7 @@
34994
35059
 
34995
35060
  // center elements around cursor
34996
35061
  forEach$1(elements, function(element) {
34997
- if (isConnection$c(element)) {
35062
+ if (isConnection$d(element)) {
34998
35063
  element.waypoints = map$1(element.waypoints, function(waypoint) {
34999
35064
  return {
35000
35065
  x: waypoint.x - bbox.x - bbox.width / 2,
@@ -35056,19 +35121,19 @@
35056
35121
  }
35057
35122
  }
35058
35123
 
35059
- function isConnection$c(element) {
35124
+ function isConnection$d(element) {
35060
35125
  return !!element.waypoints;
35061
35126
  }
35062
35127
 
35063
35128
  function isSingleShape(elements) {
35064
- return elements && elements.length === 1 && !isConnection$c(elements[0]);
35129
+ return elements && elements.length === 1 && !isConnection$d(elements[0]);
35065
35130
  }
35066
35131
 
35067
35132
  function isLabel$5(element) {
35068
35133
  return !!element.labelTarget;
35069
35134
  }
35070
35135
 
35071
- var LOW_PRIORITY$i = 750;
35136
+ var LOW_PRIORITY$j = 750;
35072
35137
 
35073
35138
 
35074
35139
  function CreatePreview(
@@ -35113,7 +35178,7 @@
35113
35178
  return dragGroup;
35114
35179
  }
35115
35180
 
35116
- eventBus.on('create.move', LOW_PRIORITY$i, function(event) {
35181
+ eventBus.on('create.move', LOW_PRIORITY$j, function(event) {
35117
35182
 
35118
35183
  var hover = event.hover,
35119
35184
  context = event.context,
@@ -35378,7 +35443,7 @@
35378
35443
  }
35379
35444
 
35380
35445
  // connections (priority = 3)
35381
- if (isConnection$b(element)) {
35446
+ if (isConnection$c(element)) {
35382
35447
  descriptor.priority = 3;
35383
35448
 
35384
35449
  descriptor.source = element.source.id;
@@ -35521,7 +35586,7 @@
35521
35586
 
35522
35587
  // center elements around cursor
35523
35588
  forEach$1(elements, function(element) {
35524
- if (isConnection$b(element)) {
35589
+ if (isConnection$c(element)) {
35525
35590
  element.waypoints = map$1(element.waypoints, function(waypoint) {
35526
35591
  return {
35527
35592
  x: waypoint.x - bbox.x - bbox.width / 2,
@@ -35574,7 +35639,7 @@
35574
35639
 
35575
35640
  var element;
35576
35641
 
35577
- if (isConnection$b(attrs)) {
35642
+ if (isConnection$c(attrs)) {
35578
35643
  attrs.source = cache[ descriptor.source ];
35579
35644
  attrs.target = cache[ descriptor.target ];
35580
35645
 
@@ -35640,7 +35705,7 @@
35640
35705
  source,
35641
35706
  target;
35642
35707
 
35643
- if (isConnection$b(element)) {
35708
+ if (isConnection$c(element)) {
35644
35709
  source = find(elements, matchPattern({ id: element.source.id }));
35645
35710
  target = find(elements, matchPattern({ id: element.target.id }));
35646
35711
 
@@ -35837,7 +35902,7 @@
35837
35902
  return !!element.host;
35838
35903
  }
35839
35904
 
35840
- function isConnection$b(element) {
35905
+ function isConnection$c(element) {
35841
35906
  return !!element.waypoints;
35842
35907
  }
35843
35908
 
@@ -35895,7 +35960,7 @@
35895
35960
  });
35896
35961
  }
35897
35962
 
35898
- var LOW_PRIORITY$h = 750;
35963
+ var LOW_PRIORITY$i = 750;
35899
35964
 
35900
35965
 
35901
35966
  function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
@@ -35906,7 +35971,7 @@
35906
35971
  return moddleCopy.copyElement(bo, targetBo, null, clone);
35907
35972
  }
35908
35973
 
35909
- eventBus.on('copyPaste.copyElement', LOW_PRIORITY$h, function(context) {
35974
+ eventBus.on('copyPaste.copyElement', LOW_PRIORITY$i, function(context) {
35910
35975
  var descriptor = context.descriptor,
35911
35976
  element = context.element,
35912
35977
  businessObject = getBusinessObject(element);
@@ -36003,7 +36068,7 @@
36003
36068
 
36004
36069
  // copy + paste processRef with participant
36005
36070
 
36006
- eventBus.on('copyPaste.copyElement', LOW_PRIORITY$h, function(context) {
36071
+ eventBus.on('copyPaste.copyElement', LOW_PRIORITY$i, function(context) {
36007
36072
  var descriptor = context.descriptor,
36008
36073
  element = context.element;
36009
36074
 
@@ -36029,7 +36094,7 @@
36029
36094
 
36030
36095
  // resolve references
36031
36096
 
36032
- eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$h, function(context) {
36097
+ eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$i, function(context) {
36033
36098
  var cache = context.cache,
36034
36099
  descriptor = context.descriptor;
36035
36100
 
@@ -36540,7 +36605,7 @@
36540
36605
 
36541
36606
  // copying event definitions, unless we replace
36542
36607
  if (propertyName === 'eventDefinitions') {
36543
- return hasEventDefinition$1(element, target.eventDefinitionType);
36608
+ return hasEventDefinition$2(element, target.eventDefinitionType);
36544
36609
  }
36545
36610
 
36546
36611
  // retain loop characteristics if the target element
@@ -36577,7 +36642,7 @@
36577
36642
  // only initialize with new eventDefinition
36578
36643
  // if we did not set an event definition yet,
36579
36644
  // i.e. because we copied it
36580
- if (!hasEventDefinition$1(newBusinessObject, target.eventDefinitionType)) {
36645
+ if (!hasEventDefinition$2(newBusinessObject, target.eventDefinitionType)) {
36581
36646
  newElement.eventDefinitionType = target.eventDefinitionType;
36582
36647
  newElement.eventDefinitionAttrs = target.eventDefinitionAttrs;
36583
36648
  }
@@ -36707,7 +36772,7 @@
36707
36772
  return is$1(bo, 'bpmn:SubProcess');
36708
36773
  }
36709
36774
 
36710
- function hasEventDefinition$1(element, type) {
36775
+ function hasEventDefinition$2(element, type) {
36711
36776
 
36712
36777
  var bo = getBusinessObject(element);
36713
36778
 
@@ -37075,7 +37140,7 @@
37075
37140
  }
37076
37141
  ];
37077
37142
 
37078
- var GATEWAY = [
37143
+ var GATEWAY$1 = [
37079
37144
  {
37080
37145
  label: 'Exclusive Gateway',
37081
37146
  actionName: 'replace-with-exclusive-gateway',
@@ -37208,7 +37273,7 @@
37208
37273
 
37209
37274
  var EVENT_SUB_PROCESS = TRANSACTION;
37210
37275
 
37211
- var TASK = [
37276
+ var TASK$1 = [
37212
37277
  {
37213
37278
  label: 'Task',
37214
37279
  actionName: 'replace-with-task',
@@ -37582,7 +37647,7 @@
37582
37647
  }
37583
37648
  ];
37584
37649
 
37585
- var PARTICIPANT = [
37650
+ var PARTICIPANT$1 = [
37586
37651
  {
37587
37652
  label: 'Expanded Pool',
37588
37653
  actionName: 'replace-with-expanded-pool',
@@ -37691,7 +37756,7 @@
37691
37756
  // expanded/collapsed pools
37692
37757
  if (is$1(businessObject, 'bpmn:Participant')) {
37693
37758
 
37694
- entries = filter(PARTICIPANT, function(entry) {
37759
+ entries = filter(PARTICIPANT$1, function(entry) {
37695
37760
  return isExpanded(element) !== entry.target.isExpanded;
37696
37761
  });
37697
37762
 
@@ -37774,7 +37839,7 @@
37774
37839
  // gateways
37775
37840
  if (is$1(businessObject, 'bpmn:Gateway')) {
37776
37841
 
37777
- entries = filter(GATEWAY, differentType);
37842
+ entries = filter(GATEWAY$1, differentType);
37778
37843
 
37779
37844
  return this._createEntries(element, entries);
37780
37845
  }
@@ -37806,7 +37871,7 @@
37806
37871
  // collapsed ad hoc sub processes
37807
37872
  if (is$1(businessObject, 'bpmn:AdHocSubProcess') && !isExpanded(element)) {
37808
37873
 
37809
- entries = filter(TASK, function(entry) {
37874
+ entries = filter(TASK$1, function(entry) {
37810
37875
 
37811
37876
  var target = entry.target;
37812
37877
 
@@ -37827,7 +37892,7 @@
37827
37892
 
37828
37893
  // flow nodes
37829
37894
  if (is$1(businessObject, 'bpmn:FlowNode')) {
37830
- entries = filter(TASK, differentType);
37895
+ entries = filter(TASK$1, differentType);
37831
37896
 
37832
37897
  // collapsed SubProcess can not be replaced with itself
37833
37898
  if (is$1(businessObject, 'bpmn:SubProcess') && !isExpanded(element)) {
@@ -38097,6 +38162,12 @@
38097
38162
  var self = this;
38098
38163
  var translate = this._translate;
38099
38164
 
38165
+ var dataObject = element.businessObject.dataObjectRef;
38166
+
38167
+ if (!dataObject) {
38168
+ return [];
38169
+ }
38170
+
38100
38171
  function toggleIsCollection(event, entry) {
38101
38172
  self._modeling.updateModdleProperties(
38102
38173
  element,
@@ -38104,8 +38175,7 @@
38104
38175
  { isCollection: !entry.active });
38105
38176
  }
38106
38177
 
38107
- var dataObject = element.businessObject.dataObjectRef,
38108
- isCollection = dataObject.isCollection;
38178
+ var isCollection = dataObject.isCollection;
38109
38179
 
38110
38180
  var dataObjectEntries = [
38111
38181
  {
@@ -38201,9 +38271,12 @@
38201
38271
  var PopupMenuModule = {
38202
38272
  __depends__: [
38203
38273
  PopupMenuModule$1,
38204
- ReplaceModule
38274
+ ReplaceModule,
38275
+ AutoPlaceModule
38276
+ ],
38277
+ __init__: [
38278
+ 'replaceMenuProvider'
38205
38279
  ],
38206
- __init__: [ 'replaceMenuProvider' ],
38207
38280
  replaceMenuProvider: [ 'type', ReplaceMenuProvider ]
38208
38281
  };
38209
38282
 
@@ -38646,433 +38719,2175 @@
38646
38719
  });
38647
38720
  }
38648
38721
 
38649
- return actions;
38722
+ return actions;
38723
+ };
38724
+
38725
+ /**
38726
+ * @param {djs.model.Base[]} elements
38727
+ * @return {boolean}
38728
+ */
38729
+ ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
38730
+
38731
+ var baseAllowed = this._rules.allowed('elements.delete', {
38732
+ elements: elements
38733
+ });
38734
+
38735
+ if (isArray$3(baseAllowed)) {
38736
+ return every(baseAllowed, function(element) {
38737
+ return includes$7(baseAllowed, element);
38738
+ });
38739
+ }
38740
+
38741
+ return baseAllowed;
38742
+ };
38743
+
38744
+ ContextPadProvider.prototype.getContextPadEntries = function(element) {
38745
+ var contextPad = this._contextPad,
38746
+ modeling = this._modeling,
38747
+
38748
+ elementFactory = this._elementFactory,
38749
+ connect = this._connect,
38750
+ create = this._create,
38751
+ popupMenu = this._popupMenu,
38752
+ rules = this._rules,
38753
+ autoPlace = this._autoPlace,
38754
+ translate = this._translate;
38755
+
38756
+ var actions = {};
38757
+
38758
+ if (element.type === 'label') {
38759
+ return actions;
38760
+ }
38761
+
38762
+ var businessObject = element.businessObject;
38763
+
38764
+ function startConnect(event, element) {
38765
+ connect.start(event, element);
38766
+ }
38767
+
38768
+ function removeElement(e, element) {
38769
+ modeling.removeElements([ element ]);
38770
+ }
38771
+
38772
+ function getReplaceMenuPosition(element) {
38773
+
38774
+ var Y_OFFSET = 5;
38775
+
38776
+ var pad = contextPad.getPad(element).html;
38777
+
38778
+ var padRect = pad.getBoundingClientRect();
38779
+
38780
+ var pos = {
38781
+ x: padRect.left,
38782
+ y: padRect.bottom + Y_OFFSET
38783
+ };
38784
+
38785
+ return pos;
38786
+ }
38787
+
38788
+ /**
38789
+ * Create an append action
38790
+ *
38791
+ * @param {string} type
38792
+ * @param {string} className
38793
+ * @param {string} [title]
38794
+ * @param {Object} [options]
38795
+ *
38796
+ * @return {Object} descriptor
38797
+ */
38798
+ function appendAction(type, className, title, options) {
38799
+
38800
+ if (typeof title !== 'string') {
38801
+ options = title;
38802
+ title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') });
38803
+ }
38804
+
38805
+ function appendStart(event, element) {
38806
+
38807
+ var shape = elementFactory.createShape(assign$1({ type: type }, options));
38808
+ create.start(event, shape, {
38809
+ source: element
38810
+ });
38811
+ }
38812
+
38813
+
38814
+ var append = autoPlace ? function(event, element) {
38815
+ var shape = elementFactory.createShape(assign$1({ type: type }, options));
38816
+
38817
+ autoPlace.append(element, shape);
38818
+ } : appendStart;
38819
+
38820
+
38821
+ return {
38822
+ group: 'model',
38823
+ className: className,
38824
+ title: title,
38825
+ action: {
38826
+ dragstart: appendStart,
38827
+ click: append
38828
+ }
38829
+ };
38830
+ }
38831
+
38832
+ function splitLaneHandler(count) {
38833
+
38834
+ return function(event, element) {
38835
+
38836
+ // actual split
38837
+ modeling.splitLane(element, count);
38838
+
38839
+ // refresh context pad after split to
38840
+ // get rid of split icons
38841
+ contextPad.open(element, true);
38842
+ };
38843
+ }
38844
+
38845
+
38846
+ if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) {
38847
+
38848
+ var childLanes = getChildLanes(element);
38849
+
38850
+ assign$1(actions, {
38851
+ 'lane-insert-above': {
38852
+ group: 'lane-insert-above',
38853
+ className: 'bpmn-icon-lane-insert-above',
38854
+ title: translate('Add Lane above'),
38855
+ action: {
38856
+ click: function(event, element) {
38857
+ modeling.addLane(element, 'top');
38858
+ }
38859
+ }
38860
+ }
38861
+ });
38862
+
38863
+ if (childLanes.length < 2) {
38864
+
38865
+ if (element.height >= 120) {
38866
+ assign$1(actions, {
38867
+ 'lane-divide-two': {
38868
+ group: 'lane-divide',
38869
+ className: 'bpmn-icon-lane-divide-two',
38870
+ title: translate('Divide into two Lanes'),
38871
+ action: {
38872
+ click: splitLaneHandler(2)
38873
+ }
38874
+ }
38875
+ });
38876
+ }
38877
+
38878
+ if (element.height >= 180) {
38879
+ assign$1(actions, {
38880
+ 'lane-divide-three': {
38881
+ group: 'lane-divide',
38882
+ className: 'bpmn-icon-lane-divide-three',
38883
+ title: translate('Divide into three Lanes'),
38884
+ action: {
38885
+ click: splitLaneHandler(3)
38886
+ }
38887
+ }
38888
+ });
38889
+ }
38890
+ }
38891
+
38892
+ assign$1(actions, {
38893
+ 'lane-insert-below': {
38894
+ group: 'lane-insert-below',
38895
+ className: 'bpmn-icon-lane-insert-below',
38896
+ title: translate('Add Lane below'),
38897
+ action: {
38898
+ click: function(event, element) {
38899
+ modeling.addLane(element, 'bottom');
38900
+ }
38901
+ }
38902
+ }
38903
+ });
38904
+
38905
+ }
38906
+
38907
+ if (is$1(businessObject, 'bpmn:FlowNode')) {
38908
+
38909
+ if (is$1(businessObject, 'bpmn:EventBasedGateway')) {
38910
+
38911
+ assign$1(actions, {
38912
+ 'append.receive-task': appendAction(
38913
+ 'bpmn:ReceiveTask',
38914
+ 'bpmn-icon-receive-task',
38915
+ translate('Append ReceiveTask')
38916
+ ),
38917
+ 'append.message-intermediate-event': appendAction(
38918
+ 'bpmn:IntermediateCatchEvent',
38919
+ 'bpmn-icon-intermediate-event-catch-message',
38920
+ translate('Append MessageIntermediateCatchEvent'),
38921
+ { eventDefinitionType: 'bpmn:MessageEventDefinition' }
38922
+ ),
38923
+ 'append.timer-intermediate-event': appendAction(
38924
+ 'bpmn:IntermediateCatchEvent',
38925
+ 'bpmn-icon-intermediate-event-catch-timer',
38926
+ translate('Append TimerIntermediateCatchEvent'),
38927
+ { eventDefinitionType: 'bpmn:TimerEventDefinition' }
38928
+ ),
38929
+ 'append.condition-intermediate-event': appendAction(
38930
+ 'bpmn:IntermediateCatchEvent',
38931
+ 'bpmn-icon-intermediate-event-catch-condition',
38932
+ translate('Append ConditionIntermediateCatchEvent'),
38933
+ { eventDefinitionType: 'bpmn:ConditionalEventDefinition' }
38934
+ ),
38935
+ 'append.signal-intermediate-event': appendAction(
38936
+ 'bpmn:IntermediateCatchEvent',
38937
+ 'bpmn-icon-intermediate-event-catch-signal',
38938
+ translate('Append SignalIntermediateCatchEvent'),
38939
+ { eventDefinitionType: 'bpmn:SignalEventDefinition' }
38940
+ )
38941
+ });
38942
+ } else
38943
+
38944
+ if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
38945
+
38946
+ assign$1(actions, {
38947
+ 'append.compensation-activity':
38948
+ appendAction(
38949
+ 'bpmn:Task',
38950
+ 'bpmn-icon-task',
38951
+ translate('Append compensation activity'),
38952
+ {
38953
+ isForCompensation: true
38954
+ }
38955
+ )
38956
+ });
38957
+ } else
38958
+
38959
+ if (!is$1(businessObject, 'bpmn:EndEvent') &&
38960
+ !businessObject.isForCompensation &&
38961
+ !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
38962
+ !isEventSubProcess(businessObject)) {
38963
+
38964
+ assign$1(actions, {
38965
+ 'append.end-event': appendAction(
38966
+ 'bpmn:EndEvent',
38967
+ 'bpmn-icon-end-event-none',
38968
+ translate('Append EndEvent')
38969
+ ),
38970
+ 'append.gateway': appendAction(
38971
+ 'bpmn:ExclusiveGateway',
38972
+ 'bpmn-icon-gateway-none',
38973
+ translate('Append Gateway')
38974
+ ),
38975
+ 'append.append-task': appendAction(
38976
+ 'bpmn:Task',
38977
+ 'bpmn-icon-task',
38978
+ translate('Append Task')
38979
+ ),
38980
+ 'append.intermediate-event': appendAction(
38981
+ 'bpmn:IntermediateThrowEvent',
38982
+ 'bpmn-icon-intermediate-event-none',
38983
+ translate('Append Intermediate/Boundary Event')
38984
+ )
38985
+ });
38986
+ }
38987
+ }
38988
+
38989
+ if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
38990
+
38991
+ // Replace menu entry
38992
+ assign$1(actions, {
38993
+ 'replace': {
38994
+ group: 'edit',
38995
+ className: 'bpmn-icon-screw-wrench',
38996
+ title: translate('Change type'),
38997
+ action: {
38998
+ click: function(event, element) {
38999
+
39000
+ var position = assign$1(getReplaceMenuPosition(element), {
39001
+ cursor: { x: event.x, y: event.y }
39002
+ });
39003
+
39004
+ popupMenu.open(element, 'bpmn-replace', position, {
39005
+ title: translate('Change element'),
39006
+ width: 300,
39007
+ search: true
39008
+ });
39009
+ }
39010
+ }
39011
+ }
39012
+ });
39013
+ }
39014
+
39015
+ if (is$1(businessObject, 'bpmn:SequenceFlow')) {
39016
+ assign$1(actions, {
39017
+ 'append.text-annotation': appendAction(
39018
+ 'bpmn:TextAnnotation',
39019
+ 'bpmn-icon-text-annotation'
39020
+ )
39021
+ });
39022
+ }
39023
+
39024
+ if (
39025
+ isAny(businessObject, [
39026
+ 'bpmn:FlowNode',
39027
+ 'bpmn:InteractionNode',
39028
+ 'bpmn:DataObjectReference',
39029
+ 'bpmn:DataStoreReference',
39030
+ ])
39031
+ ) {
39032
+ assign$1(actions, {
39033
+ 'append.text-annotation': appendAction(
39034
+ 'bpmn:TextAnnotation',
39035
+ 'bpmn-icon-text-annotation'
39036
+ ),
39037
+
39038
+ 'connect': {
39039
+ group: 'connect',
39040
+ className: 'bpmn-icon-connection-multi',
39041
+ title: translate(
39042
+ 'Connect using ' +
39043
+ (businessObject.isForCompensation
39044
+ ? ''
39045
+ : 'Sequence/MessageFlow or ') +
39046
+ 'Association'
39047
+ ),
39048
+ action: {
39049
+ click: startConnect,
39050
+ dragstart: startConnect,
39051
+ },
39052
+ },
39053
+ });
39054
+ }
39055
+
39056
+ if (is$1(businessObject, 'bpmn:TextAnnotation')) {
39057
+ assign$1(actions, {
39058
+ 'connect': {
39059
+ group: 'connect',
39060
+ className: 'bpmn-icon-connection-multi',
39061
+ title: translate('Connect using Association'),
39062
+ action: {
39063
+ click: startConnect,
39064
+ dragstart: startConnect,
39065
+ },
39066
+ },
39067
+ });
39068
+ }
39069
+
39070
+ if (isAny(businessObject, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
39071
+ assign$1(actions, {
39072
+ 'connect': {
39073
+ group: 'connect',
39074
+ className: 'bpmn-icon-connection-multi',
39075
+ title: translate('Connect using DataInputAssociation'),
39076
+ action: {
39077
+ click: startConnect,
39078
+ dragstart: startConnect
39079
+ }
39080
+ }
39081
+ });
39082
+ }
39083
+
39084
+ if (is$1(businessObject, 'bpmn:Group')) {
39085
+ assign$1(actions, {
39086
+ 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation')
39087
+ });
39088
+ }
39089
+
39090
+ // delete element entry, only show if allowed by rules
39091
+ var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });
39092
+
39093
+ if (isArray$3(deleteAllowed)) {
39094
+
39095
+ // was the element returned as a deletion candidate?
39096
+ deleteAllowed = deleteAllowed[0] === element;
39097
+ }
39098
+
39099
+ if (deleteAllowed) {
39100
+ assign$1(actions, {
39101
+ 'delete': {
39102
+ group: 'edit',
39103
+ className: 'bpmn-icon-trash',
39104
+ title: translate('Remove'),
39105
+ action: {
39106
+ click: removeElement
39107
+ }
39108
+ }
39109
+ });
39110
+ }
39111
+
39112
+ return actions;
39113
+ };
39114
+
39115
+
39116
+ // helpers /////////
39117
+
39118
+ function isEventType(eventBo, type, definition) {
39119
+
39120
+ var isType = eventBo.$instanceOf(type);
39121
+ var isDefinition = false;
39122
+
39123
+ var definitions = eventBo.eventDefinitions || [];
39124
+ forEach$1(definitions, function(def) {
39125
+ if (def.$type === definition) {
39126
+ isDefinition = true;
39127
+ }
39128
+ });
39129
+
39130
+ return isType && isDefinition;
39131
+ }
39132
+
39133
+ function includes$7(array, item) {
39134
+ return array.indexOf(item) !== -1;
39135
+ }
39136
+
39137
+ var ContextPadModule = {
39138
+ __depends__: [
39139
+ DirectEditingModule,
39140
+ ContextPadModule$1,
39141
+ SelectionModule,
39142
+ ConnectModule,
39143
+ CreateModule,
39144
+ PopupMenuModule
39145
+ ],
39146
+ __init__: [ 'contextPadProvider' ],
39147
+ contextPadProvider: [ 'type', ContextPadProvider ]
39148
+ };
39149
+
39150
+ var TOGGLE_SELECTOR = '.djs-palette-toggle',
39151
+ ENTRY_SELECTOR = '.entry',
39152
+ ELEMENT_SELECTOR = TOGGLE_SELECTOR + ', ' + ENTRY_SELECTOR;
39153
+
39154
+ var PALETTE_PREFIX = 'djs-palette-',
39155
+ PALETTE_SHOWN_CLS = 'shown',
39156
+ PALETTE_OPEN_CLS = 'open',
39157
+ PALETTE_TWO_COLUMN_CLS = 'two-column';
39158
+
39159
+ var DEFAULT_PRIORITY = 1000;
39160
+
39161
+
39162
+ /**
39163
+ * A palette containing modeling elements.
39164
+ */
39165
+ function Palette(eventBus, canvas) {
39166
+
39167
+ this._eventBus = eventBus;
39168
+ this._canvas = canvas;
39169
+
39170
+ var self = this;
39171
+
39172
+ eventBus.on('tool-manager.update', function(event) {
39173
+ var tool = event.tool;
39174
+
39175
+ self.updateToolHighlight(tool);
39176
+ });
39177
+
39178
+ eventBus.on('i18n.changed', function() {
39179
+ self._update();
39180
+ });
39181
+
39182
+ eventBus.on('diagram.init', function() {
39183
+
39184
+ self._diagramInitialized = true;
39185
+
39186
+ self._rebuild();
39187
+ });
39188
+ }
39189
+
39190
+ Palette.$inject = [ 'eventBus', 'canvas' ];
39191
+
39192
+
39193
+ /**
39194
+ * Register a provider with the palette
39195
+ *
39196
+ * @param {number} [priority=1000]
39197
+ * @param {PaletteProvider} provider
39198
+ *
39199
+ * @example
39200
+ * const paletteProvider = {
39201
+ * getPaletteEntries: function() {
39202
+ * return function(entries) {
39203
+ * return {
39204
+ * ...entries,
39205
+ * 'entry-1': {
39206
+ * label: 'My Entry',
39207
+ * action: function() { alert("I have been clicked!"); }
39208
+ * }
39209
+ * };
39210
+ * }
39211
+ * }
39212
+ * };
39213
+ *
39214
+ * palette.registerProvider(800, paletteProvider);
39215
+ */
39216
+ Palette.prototype.registerProvider = function(priority, provider) {
39217
+ if (!provider) {
39218
+ provider = priority;
39219
+ priority = DEFAULT_PRIORITY;
39220
+ }
39221
+
39222
+ this._eventBus.on('palette.getProviders', priority, function(event) {
39223
+ event.providers.push(provider);
39224
+ });
39225
+
39226
+ this._rebuild();
39227
+ };
39228
+
39229
+
39230
+ /**
39231
+ * Returns the palette entries
39232
+ *
39233
+ * @return {Object<string, PaletteEntryDescriptor>} map of entries
39234
+ */
39235
+ Palette.prototype.getEntries = function() {
39236
+ var providers = this._getProviders();
39237
+
39238
+ return providers.reduce(addPaletteEntries, {});
39239
+ };
39240
+
39241
+ Palette.prototype._rebuild = function() {
39242
+
39243
+ if (!this._diagramInitialized) {
39244
+ return;
39245
+ }
39246
+
39247
+ var providers = this._getProviders();
39248
+
39249
+ if (!providers.length) {
39250
+ return;
39251
+ }
39252
+
39253
+ if (!this._container) {
39254
+ this._init();
39255
+ }
39256
+
39257
+ this._update();
39258
+ };
39259
+
39260
+ /**
39261
+ * Initialize
39262
+ */
39263
+ Palette.prototype._init = function() {
39264
+
39265
+ var self = this;
39266
+
39267
+ var eventBus = this._eventBus;
39268
+
39269
+ var parentContainer = this._getParentContainer();
39270
+
39271
+ var container = this._container = domify$1(Palette.HTML_MARKUP);
39272
+
39273
+ parentContainer.appendChild(container);
39274
+ classes$1(parentContainer).add(PALETTE_PREFIX + PALETTE_SHOWN_CLS);
39275
+
39276
+ delegate.bind(container, ELEMENT_SELECTOR, 'click', function(event) {
39277
+
39278
+ var target = event.delegateTarget;
39279
+
39280
+ if (matches(target, TOGGLE_SELECTOR)) {
39281
+ return self.toggle();
39282
+ }
39283
+
39284
+ self.trigger('click', event);
39285
+ });
39286
+
39287
+ // prevent drag propagation
39288
+ event.bind(container, 'mousedown', function(event) {
39289
+ event.stopPropagation();
39290
+ });
39291
+
39292
+ // prevent drag propagation
39293
+ delegate.bind(container, ENTRY_SELECTOR, 'dragstart', function(event) {
39294
+ self.trigger('dragstart', event);
39295
+ });
39296
+
39297
+ eventBus.on('canvas.resized', this._layoutChanged, this);
39298
+
39299
+ eventBus.fire('palette.create', {
39300
+ container: container
39301
+ });
39302
+ };
39303
+
39304
+ Palette.prototype._getProviders = function(id) {
39305
+
39306
+ var event = this._eventBus.createEvent({
39307
+ type: 'palette.getProviders',
39308
+ providers: []
39309
+ });
39310
+
39311
+ this._eventBus.fire(event);
39312
+
39313
+ return event.providers;
39314
+ };
39315
+
39316
+ /**
39317
+ * Update palette state.
39318
+ *
39319
+ * @param {Object} [state] { open, twoColumn }
39320
+ */
39321
+ Palette.prototype._toggleState = function(state) {
39322
+
39323
+ state = state || {};
39324
+
39325
+ var parent = this._getParentContainer(),
39326
+ container = this._container;
39327
+
39328
+ var eventBus = this._eventBus;
39329
+
39330
+ var twoColumn;
39331
+
39332
+ var cls = classes$1(container),
39333
+ parentCls = classes$1(parent);
39334
+
39335
+ if ('twoColumn' in state) {
39336
+ twoColumn = state.twoColumn;
39337
+ } else {
39338
+ twoColumn = this._needsCollapse(parent.clientHeight, this._entries || {});
39339
+ }
39340
+
39341
+ // always update two column
39342
+ cls.toggle(PALETTE_TWO_COLUMN_CLS, twoColumn);
39343
+ parentCls.toggle(PALETTE_PREFIX + PALETTE_TWO_COLUMN_CLS, twoColumn);
39344
+
39345
+ if ('open' in state) {
39346
+ cls.toggle(PALETTE_OPEN_CLS, state.open);
39347
+ parentCls.toggle(PALETTE_PREFIX + PALETTE_OPEN_CLS, state.open);
39348
+ }
39349
+
39350
+ eventBus.fire('palette.changed', {
39351
+ twoColumn: twoColumn,
39352
+ open: this.isOpen()
39353
+ });
39354
+ };
39355
+
39356
+ Palette.prototype._update = function() {
39357
+
39358
+ var entriesContainer = query('.djs-palette-entries', this._container),
39359
+ entries = this._entries = this.getEntries();
39360
+
39361
+ clear$1(entriesContainer);
39362
+
39363
+ forEach$1(entries, function(entry, id) {
39364
+
39365
+ var grouping = entry.group || 'default';
39366
+
39367
+ var container = query('[data-group=' + cssEscape(grouping) + ']', entriesContainer);
39368
+ if (!container) {
39369
+ container = domify$1('<div class="group"></div>');
39370
+ attr$1(container, 'data-group', grouping);
39371
+
39372
+ entriesContainer.appendChild(container);
39373
+ }
39374
+
39375
+ var html = entry.html || (
39376
+ entry.separator ?
39377
+ '<hr class="separator" />' :
39378
+ '<div class="entry" draggable="true"></div>');
39379
+
39380
+
39381
+ var control = domify$1(html);
39382
+ container.appendChild(control);
39383
+
39384
+ if (!entry.separator) {
39385
+ attr$1(control, 'data-action', id);
39386
+
39387
+ if (entry.title) {
39388
+ attr$1(control, 'title', entry.title);
39389
+ }
39390
+
39391
+ if (entry.className) {
39392
+ addClasses(control, entry.className);
39393
+ }
39394
+
39395
+ if (entry.imageUrl) {
39396
+ var image = domify$1('<img>');
39397
+ attr$1(image, 'src', entry.imageUrl);
39398
+
39399
+ control.appendChild(image);
39400
+ }
39401
+ }
39402
+ });
39403
+
39404
+ // open after update
39405
+ this.open();
39406
+ };
39407
+
39408
+
39409
+ /**
39410
+ * Trigger an action available on the palette
39411
+ *
39412
+ * @param {string} action
39413
+ * @param {Event} event
39414
+ */
39415
+ Palette.prototype.trigger = function(action, event, autoActivate) {
39416
+ var entry,
39417
+ originalEvent,
39418
+ button = event.delegateTarget || event.target;
39419
+
39420
+ if (!button) {
39421
+ return event.preventDefault();
39422
+ }
39423
+
39424
+ entry = attr$1(button, 'data-action');
39425
+ originalEvent = event.originalEvent || event;
39426
+
39427
+ return this.triggerEntry(entry, action, originalEvent, autoActivate);
39428
+ };
39429
+
39430
+ Palette.prototype.triggerEntry = function(entryId, action, event, autoActivate) {
39431
+ var entries = this._entries,
39432
+ entry,
39433
+ handler;
39434
+
39435
+ entry = entries[entryId];
39436
+
39437
+ // when user clicks on the palette and not on an action
39438
+ if (!entry) {
39439
+ return;
39440
+ }
39441
+
39442
+ handler = entry.action;
39443
+
39444
+ // simple action (via callback function)
39445
+ if (isFunction(handler)) {
39446
+ if (action === 'click') {
39447
+ return handler(event, autoActivate);
39448
+ }
39449
+ } else {
39450
+ if (handler[action]) {
39451
+ return handler[action](event, autoActivate);
39452
+ }
39453
+ }
39454
+
39455
+ // silence other actions
39456
+ event.preventDefault();
39457
+ };
39458
+
39459
+ Palette.prototype._layoutChanged = function() {
39460
+ this._toggleState({});
39461
+ };
39462
+
39463
+ /**
39464
+ * Do we need to collapse to two columns?
39465
+ *
39466
+ * @param {number} availableHeight
39467
+ * @param {Object} entries
39468
+ *
39469
+ * @return {boolean}
39470
+ */
39471
+ Palette.prototype._needsCollapse = function(availableHeight, entries) {
39472
+
39473
+ // top margin + bottom toggle + bottom margin
39474
+ // implementors must override this method if they
39475
+ // change the palette styles
39476
+ var margin = 20 + 10 + 20;
39477
+
39478
+ var entriesHeight = Object.keys(entries).length * 46;
39479
+
39480
+ return availableHeight < entriesHeight + margin;
39481
+ };
39482
+
39483
+ /**
39484
+ * Close the palette
39485
+ */
39486
+ Palette.prototype.close = function() {
39487
+
39488
+ this._toggleState({
39489
+ open: false,
39490
+ twoColumn: false
39491
+ });
39492
+ };
39493
+
39494
+
39495
+ /**
39496
+ * Open the palette
39497
+ */
39498
+ Palette.prototype.open = function() {
39499
+ this._toggleState({ open: true });
39500
+ };
39501
+
39502
+
39503
+ Palette.prototype.toggle = function(open) {
39504
+ if (this.isOpen()) {
39505
+ this.close();
39506
+ } else {
39507
+ this.open();
39508
+ }
39509
+ };
39510
+
39511
+ Palette.prototype.isActiveTool = function(tool) {
39512
+ return tool && this._activeTool === tool;
39513
+ };
39514
+
39515
+ Palette.prototype.updateToolHighlight = function(name) {
39516
+ var entriesContainer,
39517
+ toolsContainer;
39518
+
39519
+ if (!this._toolsContainer) {
39520
+ entriesContainer = query('.djs-palette-entries', this._container);
39521
+
39522
+ this._toolsContainer = query('[data-group=tools]', entriesContainer);
39523
+ }
39524
+
39525
+ toolsContainer = this._toolsContainer;
39526
+
39527
+ forEach$1(toolsContainer.children, function(tool) {
39528
+ var actionName = tool.getAttribute('data-action');
39529
+
39530
+ if (!actionName) {
39531
+ return;
39532
+ }
39533
+
39534
+ var toolClasses = classes$1(tool);
39535
+
39536
+ actionName = actionName.replace('-tool', '');
39537
+
39538
+ if (toolClasses.contains('entry') && actionName === name) {
39539
+ toolClasses.add('highlighted-entry');
39540
+ } else {
39541
+ toolClasses.remove('highlighted-entry');
39542
+ }
39543
+ });
39544
+ };
39545
+
39546
+
39547
+ /**
39548
+ * Return true if the palette is opened.
39549
+ *
39550
+ * @example
39551
+ *
39552
+ * palette.open();
39553
+ *
39554
+ * if (palette.isOpen()) {
39555
+ * // yes, we are open
39556
+ * }
39557
+ *
39558
+ * @return {boolean} true if palette is opened
39559
+ */
39560
+ Palette.prototype.isOpen = function() {
39561
+ return classes$1(this._container).has(PALETTE_OPEN_CLS);
39562
+ };
39563
+
39564
+ /**
39565
+ * Get container the palette lives in.
39566
+ *
39567
+ * @return {Element}
39568
+ */
39569
+ Palette.prototype._getParentContainer = function() {
39570
+ return this._canvas.getContainer();
39571
+ };
39572
+
39573
+
39574
+ /* markup definition */
39575
+
39576
+ Palette.HTML_MARKUP =
39577
+ '<div class="djs-palette">' +
39578
+ '<div class="djs-palette-entries"></div>' +
39579
+ '<div class="djs-palette-toggle"></div>' +
39580
+ '</div>';
39581
+
39582
+
39583
+ // helpers //////////////////////
39584
+
39585
+ function addClasses(element, classNames) {
39586
+
39587
+ var classes = classes$1(element);
39588
+
39589
+ var actualClassNames = isArray$3(classNames) ? classNames : classNames.split(/\s+/g);
39590
+ actualClassNames.forEach(function(cls) {
39591
+ classes.add(cls);
39592
+ });
39593
+ }
39594
+
39595
+ function addPaletteEntries(entries, provider) {
39596
+
39597
+ var entriesOrUpdater = provider.getPaletteEntries();
39598
+
39599
+ if (isFunction(entriesOrUpdater)) {
39600
+ return entriesOrUpdater(entries);
39601
+ }
39602
+
39603
+ forEach$1(entriesOrUpdater, function(entry, id) {
39604
+ entries[id] = entry;
39605
+ });
39606
+
39607
+ return entries;
39608
+ }
39609
+
39610
+ var PaletteModule$1 = {
39611
+ __init__: [ 'palette' ],
39612
+ palette: [ 'type', Palette ]
39613
+ };
39614
+
39615
+ var EVENT_GROUP = {
39616
+ id: 'events',
39617
+ name: 'Events'
39618
+ };
39619
+
39620
+ var TASK_GROUP = {
39621
+ id: 'tasks',
39622
+ name: 'Tasks'
39623
+ };
39624
+
39625
+ var DATA_GROUP = {
39626
+ id: 'data',
39627
+ name: 'Data'
39628
+ };
39629
+
39630
+ var PARTICIPANT_GROUP = {
39631
+ id: 'participants',
39632
+ name: 'Participants'
39633
+ };
39634
+
39635
+ var SUBPROCESS_GROUP = {
39636
+ id: 'subprocess',
39637
+ name: 'Sub Processes'
39638
+ };
39639
+
39640
+ var GATEWAY_GROUP = {
39641
+ id: 'gateways',
39642
+ name: 'Gateways'
39643
+ };
39644
+
39645
+ var NONE_EVENTS = [
39646
+ {
39647
+ label: 'Start Event',
39648
+ actionName: 'none-start-event',
39649
+ className: 'bpmn-icon-start-event-none',
39650
+ target: {
39651
+ type: 'bpmn:StartEvent'
39652
+ }
39653
+ },
39654
+ {
39655
+ label: 'Intermediate Throw Event',
39656
+ actionName: 'none-intermediate-throwing',
39657
+ className: 'bpmn-icon-intermediate-event-none',
39658
+ target: {
39659
+ type: 'bpmn:IntermediateThrowEvent'
39660
+ }
39661
+ },
39662
+ {
39663
+ label: 'Boundary Event',
39664
+ actionName: 'none-boundary-event',
39665
+ className: 'bpmn-icon-intermediate-event-none',
39666
+ target: {
39667
+ type: 'bpmn:BoundaryEvent'
39668
+ }
39669
+ },
39670
+ {
39671
+ label: 'End Event',
39672
+ actionName: 'none-end-event',
39673
+ className: 'bpmn-icon-end-event-none',
39674
+ target: {
39675
+ type: 'bpmn:EndEvent'
39676
+ }
39677
+ }
39678
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39679
+
39680
+ var TYPED_START_EVENTS = [
39681
+ {
39682
+ label: 'Message Start Event',
39683
+ actionName: 'message-start',
39684
+ className: 'bpmn-icon-start-event-message',
39685
+ target: {
39686
+ type: 'bpmn:StartEvent',
39687
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39688
+ }
39689
+ },
39690
+ {
39691
+ label: 'Timer Start Event',
39692
+ actionName: 'timer-start',
39693
+ className: 'bpmn-icon-start-event-timer',
39694
+ target: {
39695
+ type: 'bpmn:StartEvent',
39696
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
39697
+ }
39698
+ },
39699
+ {
39700
+ label: 'Conditional Start Event',
39701
+ actionName: 'conditional-start',
39702
+ className: 'bpmn-icon-start-event-condition',
39703
+ target: {
39704
+ type: 'bpmn:StartEvent',
39705
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
39706
+ }
39707
+ },
39708
+ {
39709
+ label: 'Signal Start Event',
39710
+ actionName: 'signal-start',
39711
+ className: 'bpmn-icon-start-event-signal',
39712
+ target: {
39713
+ type: 'bpmn:StartEvent',
39714
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39715
+ }
39716
+ }
39717
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39718
+
39719
+ var TYPED_INTERMEDIATE_EVENT = [
39720
+ {
39721
+ label: 'Message Intermediate Catch Event',
39722
+ actionName: 'message-intermediate-catch',
39723
+ className: 'bpmn-icon-intermediate-event-catch-message',
39724
+ target: {
39725
+ type: 'bpmn:IntermediateCatchEvent',
39726
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39727
+ }
39728
+ },
39729
+ {
39730
+ label: 'Message Intermediate Throw Event',
39731
+ actionName: 'message-intermediate-throw',
39732
+ className: 'bpmn-icon-intermediate-event-throw-message',
39733
+ target: {
39734
+ type: 'bpmn:IntermediateThrowEvent',
39735
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39736
+ }
39737
+ },
39738
+ {
39739
+ label: 'Timer Intermediate Catch Event',
39740
+ actionName: 'timer-intermediate-catch',
39741
+ className: 'bpmn-icon-intermediate-event-catch-timer',
39742
+ target: {
39743
+ type: 'bpmn:IntermediateCatchEvent',
39744
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
39745
+ }
39746
+ },
39747
+ {
39748
+ label: 'Escalation Intermediate Throw Event',
39749
+ actionName: 'escalation-intermediate-throw',
39750
+ className: 'bpmn-icon-intermediate-event-throw-escalation',
39751
+ target: {
39752
+ type: 'bpmn:IntermediateThrowEvent',
39753
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
39754
+ }
39755
+ },
39756
+ {
39757
+ label: 'Conditional Intermediate Catch Event',
39758
+ actionName: 'conditional-intermediate-catch',
39759
+ className: 'bpmn-icon-intermediate-event-catch-condition',
39760
+ target: {
39761
+ type: 'bpmn:IntermediateCatchEvent',
39762
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
39763
+ }
39764
+ },
39765
+ {
39766
+ label: 'Link Intermediate Catch Event',
39767
+ actionName: 'link-intermediate-catch',
39768
+ className: 'bpmn-icon-intermediate-event-catch-link',
39769
+ target: {
39770
+ type: 'bpmn:IntermediateCatchEvent',
39771
+ eventDefinitionType: 'bpmn:LinkEventDefinition',
39772
+ eventDefinitionAttrs: {
39773
+ name: ''
39774
+ }
39775
+ }
39776
+ },
39777
+ {
39778
+ label: 'Link Intermediate Throw Event',
39779
+ actionName: 'link-intermediate-throw',
39780
+ className: 'bpmn-icon-intermediate-event-throw-link',
39781
+ target: {
39782
+ type: 'bpmn:IntermediateThrowEvent',
39783
+ eventDefinitionType: 'bpmn:LinkEventDefinition',
39784
+ eventDefinitionAttrs: {
39785
+ name: ''
39786
+ }
39787
+ }
39788
+ },
39789
+ {
39790
+ label: 'Compensation Intermediate Throw Event',
39791
+ actionName: 'compensation-intermediate-throw',
39792
+ className: 'bpmn-icon-intermediate-event-throw-compensation',
39793
+ target: {
39794
+ type: 'bpmn:IntermediateThrowEvent',
39795
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
39796
+ }
39797
+ },
39798
+ {
39799
+ label: 'Signal Intermediate Catch Event',
39800
+ actionName: 'signal-intermediate-catch',
39801
+ className: 'bpmn-icon-intermediate-event-catch-signal',
39802
+ target: {
39803
+ type: 'bpmn:IntermediateCatchEvent',
39804
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39805
+ }
39806
+ },
39807
+ {
39808
+ label: 'Signal Intermediate Throw Event',
39809
+ actionName: 'signal-intermediate-throw',
39810
+ className: 'bpmn-icon-intermediate-event-throw-signal',
39811
+ target: {
39812
+ type: 'bpmn:IntermediateThrowEvent',
39813
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39814
+ }
39815
+ }
39816
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39817
+
39818
+ var TYPED_BOUNDARY_EVENT = [
39819
+ {
39820
+ label: 'Message Boundary Event',
39821
+ actionName: 'message-boundary',
39822
+ className: 'bpmn-icon-intermediate-event-catch-message',
39823
+ target: {
39824
+ type: 'bpmn:BoundaryEvent',
39825
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39826
+ }
39827
+ },
39828
+ {
39829
+ label: 'Timer Boundary Event',
39830
+ actionName: 'timer-boundary',
39831
+ className: 'bpmn-icon-intermediate-event-catch-timer',
39832
+ target: {
39833
+ type: 'bpmn:BoundaryEvent',
39834
+ eventDefinitionType: 'bpmn:TimerEventDefinition'
39835
+ }
39836
+ },
39837
+ {
39838
+ label: 'Escalation Boundary Event',
39839
+ actionName: 'escalation-boundary',
39840
+ className: 'bpmn-icon-intermediate-event-catch-escalation',
39841
+ target: {
39842
+ type: 'bpmn:BoundaryEvent',
39843
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
39844
+ }
39845
+ },
39846
+ {
39847
+ label: 'Conditional Boundary Event',
39848
+ actionName: 'conditional-boundary',
39849
+ className: 'bpmn-icon-intermediate-event-catch-condition',
39850
+ target: {
39851
+ type: 'bpmn:BoundaryEvent',
39852
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition'
39853
+ }
39854
+ },
39855
+ {
39856
+ label: 'Error Boundary Event',
39857
+ actionName: 'error-boundary',
39858
+ className: 'bpmn-icon-intermediate-event-catch-error',
39859
+ target: {
39860
+ type: 'bpmn:BoundaryEvent',
39861
+ eventDefinitionType: 'bpmn:ErrorEventDefinition'
39862
+ }
39863
+ },
39864
+ {
39865
+ label: 'Cancel Boundary Event',
39866
+ actionName: 'cancel-boundary',
39867
+ className: 'bpmn-icon-intermediate-event-catch-cancel',
39868
+ target: {
39869
+ type: 'bpmn:BoundaryEvent',
39870
+ eventDefinitionType: 'bpmn:CancelEventDefinition'
39871
+ }
39872
+ },
39873
+ {
39874
+ label: 'Signal Boundary Event',
39875
+ actionName: 'signal-boundary',
39876
+ className: 'bpmn-icon-intermediate-event-catch-signal',
39877
+ target: {
39878
+ type: 'bpmn:BoundaryEvent',
39879
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39880
+ }
39881
+ },
39882
+ {
39883
+ label: 'Compensation Boundary Event',
39884
+ actionName: 'compensation-boundary',
39885
+ className: 'bpmn-icon-intermediate-event-catch-compensation',
39886
+ target: {
39887
+ type: 'bpmn:BoundaryEvent',
39888
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
39889
+ }
39890
+ },
39891
+ {
39892
+ label: 'Message Boundary Event (non-interrupting)',
39893
+ actionName: 'non-interrupting-message-boundary',
39894
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-message',
39895
+ target: {
39896
+ type: 'bpmn:BoundaryEvent',
39897
+ eventDefinitionType: 'bpmn:MessageEventDefinition',
39898
+ cancelActivity: false
39899
+ }
39900
+ },
39901
+ {
39902
+ label: 'Timer Boundary Event (non-interrupting)',
39903
+ actionName: 'non-interrupting-timer-boundary',
39904
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-timer',
39905
+ target: {
39906
+ type: 'bpmn:BoundaryEvent',
39907
+ eventDefinitionType: 'bpmn:TimerEventDefinition',
39908
+ cancelActivity: false
39909
+ }
39910
+ },
39911
+ {
39912
+ label: 'Escalation Boundary Event (non-interrupting)',
39913
+ actionName: 'non-interrupting-escalation-boundary',
39914
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-escalation',
39915
+ target: {
39916
+ type: 'bpmn:BoundaryEvent',
39917
+ eventDefinitionType: 'bpmn:EscalationEventDefinition',
39918
+ cancelActivity: false
39919
+ }
39920
+ },
39921
+ {
39922
+ label: 'Conditional Boundary Event (non-interrupting)',
39923
+ actionName: 'non-interrupting-conditional-boundary',
39924
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-condition',
39925
+ target: {
39926
+ type: 'bpmn:BoundaryEvent',
39927
+ eventDefinitionType: 'bpmn:ConditionalEventDefinition',
39928
+ cancelActivity: false
39929
+ }
39930
+ },
39931
+ {
39932
+ label: 'Signal Boundary Event (non-interrupting)',
39933
+ actionName: 'non-interrupting-signal-boundary',
39934
+ className: 'bpmn-icon-intermediate-event-catch-non-interrupting-signal',
39935
+ target: {
39936
+ type: 'bpmn:BoundaryEvent',
39937
+ eventDefinitionType: 'bpmn:SignalEventDefinition',
39938
+ cancelActivity: false
39939
+ }
39940
+ }
39941
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
39942
+
39943
+ var TYPED_END_EVENT = [
39944
+ {
39945
+ label: 'Message End Event',
39946
+ actionName: 'message-end',
39947
+ className: 'bpmn-icon-end-event-message',
39948
+ target: {
39949
+ type: 'bpmn:EndEvent',
39950
+ eventDefinitionType: 'bpmn:MessageEventDefinition'
39951
+ }
39952
+ },
39953
+ {
39954
+ label: 'Escalation End Event',
39955
+ actionName: 'escalation-end',
39956
+ className: 'bpmn-icon-end-event-escalation',
39957
+ target: {
39958
+ type: 'bpmn:EndEvent',
39959
+ eventDefinitionType: 'bpmn:EscalationEventDefinition'
39960
+ }
39961
+ },
39962
+ {
39963
+ label: 'Error End Event',
39964
+ actionName: 'error-end',
39965
+ className: 'bpmn-icon-end-event-error',
39966
+ target: {
39967
+ type: 'bpmn:EndEvent',
39968
+ eventDefinitionType: 'bpmn:ErrorEventDefinition'
39969
+ }
39970
+ },
39971
+ {
39972
+ label: 'Cancel End Event',
39973
+ actionName: 'cancel-end',
39974
+ className: 'bpmn-icon-end-event-cancel',
39975
+ target: {
39976
+ type: 'bpmn:EndEvent',
39977
+ eventDefinitionType: 'bpmn:CancelEventDefinition'
39978
+ }
39979
+ },
39980
+ {
39981
+ label: 'Compensation End Event',
39982
+ actionName: 'compensation-end',
39983
+ className: 'bpmn-icon-end-event-compensation',
39984
+ target: {
39985
+ type: 'bpmn:EndEvent',
39986
+ eventDefinitionType: 'bpmn:CompensateEventDefinition'
39987
+ }
39988
+ },
39989
+ {
39990
+ label: 'Signal End Event',
39991
+ actionName: 'signal-end',
39992
+ className: 'bpmn-icon-end-event-signal',
39993
+ target: {
39994
+ type: 'bpmn:EndEvent',
39995
+ eventDefinitionType: 'bpmn:SignalEventDefinition'
39996
+ }
39997
+ },
39998
+ {
39999
+ label: 'Terminate End Event',
40000
+ actionName: 'terminate-end',
40001
+ className: 'bpmn-icon-end-event-terminate',
40002
+ target: {
40003
+ type: 'bpmn:EndEvent',
40004
+ eventDefinitionType: 'bpmn:TerminateEventDefinition'
40005
+ }
40006
+ }
40007
+ ].map(option => ({ ...option, group: EVENT_GROUP }));
40008
+
40009
+ var GATEWAY = [
40010
+ {
40011
+ label: 'Exclusive Gateway',
40012
+ actionName: 'exclusive-gateway',
40013
+ className: 'bpmn-icon-gateway-xor',
40014
+ target: {
40015
+ type: 'bpmn:ExclusiveGateway'
40016
+ }
40017
+ },
40018
+ {
40019
+ label: 'Parallel Gateway',
40020
+ actionName: 'parallel-gateway',
40021
+ className: 'bpmn-icon-gateway-parallel',
40022
+ target: {
40023
+ type: 'bpmn:ParallelGateway'
40024
+ }
40025
+ },
40026
+ {
40027
+ label: 'Inclusive Gateway',
40028
+ search: 'or',
40029
+ actionName: 'inclusive-gateway',
40030
+ className: 'bpmn-icon-gateway-or',
40031
+ target: {
40032
+ type: 'bpmn:InclusiveGateway'
40033
+ }
40034
+ },
40035
+ {
40036
+ label: 'Complex Gateway',
40037
+ actionName: 'complex-gateway',
40038
+ className: 'bpmn-icon-gateway-complex',
40039
+ target: {
40040
+ type: 'bpmn:ComplexGateway'
40041
+ }
40042
+ },
40043
+ {
40044
+ label: 'Event based Gateway',
40045
+ actionName: 'event-based-gateway',
40046
+ className: 'bpmn-icon-gateway-eventbased',
40047
+ target: {
40048
+ type: 'bpmn:EventBasedGateway',
40049
+ instantiate: false,
40050
+ eventGatewayType: 'Exclusive'
40051
+ }
40052
+ }
40053
+ ].map(option => ({ ...option, group: GATEWAY_GROUP }));
40054
+
40055
+ var SUBPROCESS = [
40056
+ {
40057
+ label: 'Transaction',
40058
+ actionName: 'transaction',
40059
+ className: 'bpmn-icon-transaction',
40060
+ target: {
40061
+ type: 'bpmn:Transaction',
40062
+ isExpanded: true
40063
+ }
40064
+ },
40065
+ {
40066
+ label: 'Event Sub Process',
40067
+ search: 'subprocess',
40068
+ actionName: 'event-subprocess',
40069
+ className: 'bpmn-icon-event-subprocess-expanded',
40070
+ target: {
40071
+ type: 'bpmn:SubProcess',
40072
+ triggeredByEvent: true,
40073
+ isExpanded: true
40074
+ }
40075
+ },
40076
+ {
40077
+ label: 'Sub Process (collapsed)',
40078
+ search: 'subprocess',
40079
+ actionName: 'collapsed-subprocess',
40080
+ className: 'bpmn-icon-subprocess-collapsed',
40081
+ target: {
40082
+ type: 'bpmn:SubProcess',
40083
+ isExpanded: false
40084
+ }
40085
+ },
40086
+ {
40087
+ label: 'Sub Process (expanded)',
40088
+ search: 'subprocess',
40089
+ actionName: 'expanded-subprocess',
40090
+ className: 'bpmn-icon-subprocess-collapsed',
40091
+ target: {
40092
+ type: 'bpmn:SubProcess',
40093
+ isExpanded: true
40094
+ }
40095
+ }
40096
+ ].map(option => ({ ...option, group: SUBPROCESS_GROUP }));
40097
+
40098
+ var TASK = [
40099
+ {
40100
+ label: 'Task',
40101
+ actionName: 'task',
40102
+ className: 'bpmn-icon-task',
40103
+ target: {
40104
+ type: 'bpmn:Task'
40105
+ }
40106
+ },
40107
+ {
40108
+ label: 'Send Task',
40109
+ actionName: 'send-task',
40110
+ className: 'bpmn-icon-send',
40111
+ target: {
40112
+ type: 'bpmn:SendTask'
40113
+ }
40114
+ },
40115
+ {
40116
+ label: 'Receive Task',
40117
+ actionName: 'receive-task',
40118
+ className: 'bpmn-icon-receive',
40119
+ target: {
40120
+ type: 'bpmn:ReceiveTask'
40121
+ }
40122
+ },
40123
+ {
40124
+ label: 'User Task',
40125
+ actionName: 'user-task',
40126
+ className: 'bpmn-icon-user',
40127
+ target: {
40128
+ type: 'bpmn:UserTask'
40129
+ }
40130
+ },
40131
+ {
40132
+ label: 'Manual Task',
40133
+ actionName: 'manual-task',
40134
+ className: 'bpmn-icon-manual',
40135
+ target: {
40136
+ type: 'bpmn:ManualTask'
40137
+ }
40138
+ },
40139
+ {
40140
+ label: 'Business Rule Task',
40141
+ actionName: 'rule-task',
40142
+ className: 'bpmn-icon-business-rule',
40143
+ target: {
40144
+ type: 'bpmn:BusinessRuleTask'
40145
+ }
40146
+ },
40147
+ {
40148
+ label: 'Service Task',
40149
+ actionName: 'service-task',
40150
+ className: 'bpmn-icon-service',
40151
+ target: {
40152
+ type: 'bpmn:ServiceTask'
40153
+ }
40154
+ },
40155
+ {
40156
+ label: 'Script Task',
40157
+ actionName: 'script-task',
40158
+ className: 'bpmn-icon-script',
40159
+ target: {
40160
+ type: 'bpmn:ScriptTask'
40161
+ }
40162
+ },
40163
+ {
40164
+ label: 'Call Activity',
40165
+ actionName: 'call-activity',
40166
+ className: 'bpmn-icon-call-activity',
40167
+ target: {
40168
+ type: 'bpmn:CallActivity'
40169
+ }
40170
+ }
40171
+ ].map(option => ({ ...option, group: TASK_GROUP }));
40172
+
40173
+ var DATA_OBJECTS = [
40174
+ {
40175
+ label: 'Data Store Reference',
40176
+ actionName: 'data-store-reference',
40177
+ className: 'bpmn-icon-data-store',
40178
+ target: {
40179
+ type: 'bpmn:DataStoreReference'
40180
+ }
40181
+ },
40182
+ {
40183
+ label: 'Data Object Reference',
40184
+ actionName: 'data-object-reference',
40185
+ className: 'bpmn-icon-data-object',
40186
+ target: {
40187
+ type: 'bpmn:DataObjectReference'
40188
+ }
40189
+ }
40190
+ ].map(option => ({ ...option, group: DATA_GROUP }));
40191
+
40192
+ var PARTICIPANT = [
40193
+ {
40194
+ label: 'Expanded Pool',
40195
+ search: 'Participant',
40196
+ actionName: 'expanded-pool',
40197
+ className: 'bpmn-icon-participant',
40198
+ target: {
40199
+ type: 'bpmn:Participant',
40200
+ isExpanded: true
40201
+ }
40202
+ },
40203
+ {
40204
+ label: 'Empty Pool',
40205
+ search: 'Collapsed Participant',
40206
+ actionName: 'collapsed-pool',
40207
+ className: 'bpmn-icon-lane',
40208
+ target: {
40209
+ type: 'bpmn:Participant',
40210
+ isExpanded: false
40211
+ }
40212
+ }
40213
+ ].map(option => ({ ...option, group: PARTICIPANT_GROUP }));
40214
+
40215
+ var CREATE_OPTIONS = [
40216
+ ...GATEWAY,
40217
+ ...TASK,
40218
+ ...SUBPROCESS,
40219
+ ...NONE_EVENTS,
40220
+ ...TYPED_START_EVENTS,
40221
+ ...TYPED_INTERMEDIATE_EVENT,
40222
+ ...TYPED_END_EVENT,
40223
+ ...TYPED_BOUNDARY_EVENT,
40224
+ ...DATA_OBJECTS,
40225
+ ...PARTICIPANT
40226
+ ];
40227
+
40228
+ /**
40229
+ * This module is a create menu provider for the popup menu.
40230
+ */
40231
+ function CreateMenuProvider(
40232
+ elementFactory, popupMenu, create,
40233
+ autoPlace, mouse, translate
40234
+ ) {
40235
+ this._elementFactory = elementFactory;
40236
+ this._popupMenu = popupMenu;
40237
+ this._create = create;
40238
+ this._autoPlace = autoPlace;
40239
+ this._mouse = mouse;
40240
+ this._translate = translate;
40241
+
40242
+ this.register();
40243
+ }
40244
+
40245
+ CreateMenuProvider.$inject = [
40246
+ 'elementFactory',
40247
+ 'popupMenu',
40248
+ 'create',
40249
+ 'autoPlace',
40250
+ 'mouse',
40251
+ 'translate'
40252
+ ];
40253
+
40254
+ /**
40255
+ * Register create menu provider in the popup menu
40256
+ */
40257
+ CreateMenuProvider.prototype.register = function() {
40258
+ this._popupMenu.registerProvider('bpmn-create', this);
40259
+ };
40260
+
40261
+ /**
40262
+ * Get all entries
40263
+ *
40264
+ * @param {djs.model.Base} element
40265
+ *
40266
+ * @return {Array<Object>} a list of menu entry items
40267
+ */
40268
+ CreateMenuProvider.prototype.getPopupMenuEntries = function() {
40269
+
40270
+ const entries = {};
40271
+
40272
+ // map options to menu entries
40273
+ CREATE_OPTIONS.forEach(option => {
40274
+ const {
40275
+ actionName,
40276
+ className,
40277
+ label,
40278
+ target,
40279
+ description,
40280
+ group,
40281
+ search
40282
+ } = option;
40283
+
40284
+ const targetAction = this._createEntryAction(target);
40285
+
40286
+ entries[`create-${actionName}`] = {
40287
+ label: label && this._translate(label),
40288
+ className,
40289
+ description,
40290
+ group: group && {
40291
+ ...group,
40292
+ name: this._translate(group.name)
40293
+ },
40294
+ search,
40295
+ action: {
40296
+ click: targetAction,
40297
+ dragstart: targetAction
40298
+ }
40299
+ };
40300
+ });
40301
+
40302
+ return entries;
40303
+ };
40304
+
40305
+ /**
40306
+ * Create an action for a given target
40307
+ *
40308
+ * @param {Object} target
40309
+ * @returns {Object}
40310
+ */
40311
+ CreateMenuProvider.prototype._createEntryAction = function(target) {
40312
+
40313
+ const create = this._create;
40314
+ const mouse = this._mouse;
40315
+ const popupMenu = this._popupMenu;
40316
+ const elementFactory = this._elementFactory;
40317
+
40318
+ let newElement;
40319
+
40320
+ return (event) => {
40321
+ popupMenu.close();
40322
+
40323
+ // create the new element
40324
+ if (target.type === 'bpmn:Participant') {
40325
+ newElement = elementFactory.createParticipantShape(target);
40326
+ } else {
40327
+ newElement = elementFactory.create('shape', target);
40328
+ }
40329
+
40330
+ // use last mouse event if triggered via keyboard
40331
+ if (event instanceof KeyboardEvent) {
40332
+ event = mouse.getLastMoveEvent();
40333
+ }
40334
+
40335
+ return create.start(event, newElement);
40336
+ };
40337
+ };
40338
+
40339
+ /**
40340
+ * To change the icons, modify the SVGs in `./resources`, execute `npx svgo -f resources --datauri enc -o dist`,
40341
+ * and then replace respective icons with the optimized data URIs in `./dist`.
40342
+ */
40343
+ 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';
40344
+ 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';
40345
+
40346
+ /**
40347
+ * A palette provider for the create elements menu.
40348
+ */
40349
+ function CreatePaletteProvider(palette, translate, popupMenu, canvas, mouse) {
40350
+
40351
+ this._translate = translate;
40352
+ this._popupMenu = popupMenu;
40353
+ this._canvas = canvas;
40354
+ this._mouse = mouse;
40355
+
40356
+ palette.registerProvider(800,this);
40357
+ }
40358
+
40359
+ CreatePaletteProvider.$inject = [
40360
+ 'palette',
40361
+ 'translate',
40362
+ 'popupMenu',
40363
+ 'canvas',
40364
+ 'mouse'
40365
+ ];
40366
+
40367
+
40368
+ CreatePaletteProvider.prototype.getPaletteEntries = function(element) {
40369
+ const actions = {},
40370
+ translate = this._translate,
40371
+ popupMenu = this._popupMenu,
40372
+ canvas = this._canvas,
40373
+ mouse = this._mouse;
40374
+
40375
+ const getPosition = (event) => {
40376
+ const X_OFFSET = 35;
40377
+ const Y_OFFSET = 10;
40378
+
40379
+ if (event instanceof KeyboardEvent) {
40380
+ event = mouse.getLastMoveEvent();
40381
+ return { x: event.x, y: event.y };
40382
+ }
40383
+
40384
+ const target = event && event.target || query('.djs-palette [data-action="create"]');
40385
+ const targetPosition = target.getBoundingClientRect();
40386
+
40387
+ return target && {
40388
+ x: targetPosition.left + targetPosition.width / 2 + X_OFFSET,
40389
+ y: targetPosition.top + targetPosition.height / 2 + Y_OFFSET
40390
+ };
40391
+ };
40392
+
40393
+ assign$1(actions, {
40394
+ 'create': {
40395
+ group: 'create',
40396
+ imageUrl: createIcon,
40397
+ title: translate('Create element'),
40398
+ action: {
40399
+ click: function(event) {
40400
+ const position = getPosition(event);
40401
+
40402
+ const element = canvas.getRootElement();
40403
+
40404
+ popupMenu.open(element, 'bpmn-create', position, {
40405
+ title: translate('Create element'),
40406
+ width: 300,
40407
+ search: true
40408
+ });
40409
+ }
40410
+ }
40411
+ },
40412
+ });
40413
+
40414
+ return actions;
40415
+ };
40416
+
40417
+ /**
40418
+ * Registers and executes BPMN specific editor actions.
40419
+ *
40420
+ * @param {Injector} injector
40421
+ */
40422
+ function CreateAppendEditorActions(injector) {
40423
+ this._injector = injector;
40424
+
40425
+ this.registerActions();
40426
+ }
40427
+
40428
+ CreateAppendEditorActions.$inject = [
40429
+ 'injector'
40430
+ ];
40431
+
40432
+ /**
40433
+ * Register actions.
40434
+ *
40435
+ * @param {Injector} injector
40436
+ */
40437
+ CreateAppendEditorActions.prototype.registerActions = function() {
40438
+ var editorActions = this._injector.get('editorActions', false);
40439
+ var selection = this._injector.get('selection', false);
40440
+ var contextPad = this._injector.get('contextPad', false);
40441
+ var palette = this._injector.get('palette', false);
40442
+
40443
+ const actions = {};
40444
+
40445
+ // append
40446
+ if (selection && contextPad) {
40447
+ assign$1(actions, {
40448
+ 'appendElement': function(event) {
40449
+ contextPad.triggerEntry('append', 'click', event);
40450
+ } }
40451
+ );
40452
+ }
40453
+
40454
+ // create
40455
+ if (palette) {
40456
+ assign$1(actions, {
40457
+ 'createElement': function(event) {
40458
+ palette.triggerEntry('create', 'click', event);
40459
+ } }
40460
+ );
40461
+ }
40462
+
40463
+ editorActions && editorActions.register(actions);
40464
+
38650
40465
  };
38651
40466
 
38652
40467
  /**
38653
- * @param {djs.model.Base[]} elements
38654
- * @return {boolean}
40468
+ * BPMN 2.0 specific keyboard bindings.
40469
+ *
40470
+ * @param {Injector} injector
38655
40471
  */
38656
- ContextPadProvider.prototype._isDeleteAllowed = function(elements) {
40472
+ function CreateAppendKeyboardBindings(injector) {
38657
40473
 
38658
- var baseAllowed = this._rules.allowed('elements.delete', {
38659
- elements: elements
38660
- });
40474
+ this._injector = injector;
40475
+ this._keyboard = this._injector.get('keyboard', false);
40476
+ this._editorActions = this._injector.get('editorActions', false);
40477
+ this._selection = this._injector.get('selection', false);
38661
40478
 
38662
- if (isArray$3(baseAllowed)) {
38663
- return every(baseAllowed, function(element) {
38664
- return includes$7(baseAllowed, element);
38665
- });
40479
+ if (this._keyboard) {
40480
+ this._injector.invoke(KeyboardBindings, this);
38666
40481
  }
40482
+ }
38667
40483
 
38668
- return baseAllowed;
38669
- };
40484
+ e$3(CreateAppendKeyboardBindings, KeyboardBindings);
38670
40485
 
38671
- ContextPadProvider.prototype.getContextPadEntries = function(element) {
38672
- var contextPad = this._contextPad,
38673
- modeling = this._modeling,
40486
+ CreateAppendKeyboardBindings.$inject = [
40487
+ 'injector'
40488
+ ];
38674
40489
 
38675
- elementFactory = this._elementFactory,
38676
- connect = this._connect,
38677
- create = this._create,
38678
- popupMenu = this._popupMenu,
38679
- rules = this._rules,
38680
- autoPlace = this._autoPlace,
38681
- translate = this._translate;
38682
40490
 
38683
- var actions = {};
40491
+ /**
40492
+ * Register available keyboard bindings.
40493
+ *
40494
+ * @param {Keyboard} keyboard
40495
+ * @param {EditorActions} editorActions
40496
+ */
40497
+ CreateAppendKeyboardBindings.prototype.registerBindings = function() {
38684
40498
 
38685
- if (element.type === 'label') {
38686
- return actions;
38687
- }
40499
+ var keyboard = this._keyboard;
40500
+ var editorActions = this._editorActions;
40501
+ var selection = this._selection;
38688
40502
 
38689
- var businessObject = element.businessObject;
40503
+ // inherit default bindings
40504
+ KeyboardBindings.prototype.registerBindings.call(this, keyboard, editorActions);
38690
40505
 
38691
- function startConnect(event, element) {
38692
- connect.start(event, element);
38693
- }
40506
+ /**
40507
+ * Add keyboard binding if respective editor action
40508
+ * is registered.
40509
+ *
40510
+ * @param {string} action name
40511
+ * @param {Function} fn that implements the key binding
40512
+ */
40513
+ function addListener(action, fn) {
38694
40514
 
38695
- function removeElement(e, element) {
38696
- modeling.removeElements([ element ]);
40515
+ if (editorActions && editorActions.isRegistered(action)) {
40516
+ keyboard && keyboard.addListener(fn);
40517
+ }
38697
40518
  }
38698
40519
 
38699
- function getReplaceMenuPosition(element) {
40520
+ // activate append/create element
40521
+ // A
40522
+ addListener('appendElement', function(context) {
38700
40523
 
38701
- var Y_OFFSET = 5;
40524
+ var event = context.keyEvent;
38702
40525
 
38703
- var pad = contextPad.getPad(element).html;
40526
+ if (keyboard && keyboard.hasModifier(event)) {
40527
+ return;
40528
+ }
38704
40529
 
38705
- var padRect = pad.getBoundingClientRect();
40530
+ if (keyboard && keyboard.isKey([ 'a', 'A' ], event)) {
38706
40531
 
38707
- var pos = {
38708
- x: padRect.left,
38709
- y: padRect.bottom + Y_OFFSET
38710
- };
40532
+ if (selection && selection.get().length == 1) {
40533
+ editorActions && editorActions.trigger('appendElement', event);
40534
+ } else {
40535
+ editorActions && editorActions.trigger('createElement', event);
40536
+ }
38711
40537
 
38712
- return pos;
38713
- }
40538
+ return true;
40539
+ }
40540
+ });
38714
40541
 
40542
+ // N
40543
+ addListener('createElement', function(context) {
38715
40544
 
38716
- /**
38717
- * Create an append action
38718
- *
38719
- * @param {string} type
38720
- * @param {string} className
38721
- * @param {string} [title]
38722
- * @param {Object} [options]
38723
- *
38724
- * @return {Object} descriptor
38725
- */
38726
- function appendAction(type, className, title, options) {
40545
+ var event = context.keyEvent;
38727
40546
 
38728
- if (typeof title !== 'string') {
38729
- options = title;
38730
- title = translate('Append {type}', { type: type.replace(/^bpmn:/, '') });
40547
+ if (keyboard && keyboard.hasModifier(event)) {
40548
+ return;
38731
40549
  }
38732
40550
 
38733
- function appendStart(event, element) {
40551
+ if (keyboard && keyboard.isKey([ 'n', 'N' ], event)) {
40552
+ editorActions && editorActions.trigger('createElement', event);
38734
40553
 
38735
- var shape = elementFactory.createShape(assign$1({ type: type }, options));
38736
- create.start(event, shape, {
38737
- source: element
38738
- });
40554
+ return true;
38739
40555
  }
40556
+ });
38740
40557
 
40558
+ };
38741
40559
 
38742
- var append = autoPlace ? function(event, element) {
38743
- var shape = elementFactory.createShape(assign$1({ type: type }, options));
40560
+ /**
40561
+ * This module is an append menu provider for the popup menu.
40562
+ */
40563
+ function AppendMenuProvider(
40564
+ elementFactory,
40565
+ popupMenu,
40566
+ create,
40567
+ autoPlace,
40568
+ rules,
40569
+ mouse
40570
+ ) {
40571
+ this._elementFactory = elementFactory;
40572
+ this._popupMenu = popupMenu;
40573
+ this._create = create;
40574
+ this._autoPlace = autoPlace;
40575
+ this._rules = rules;
40576
+ this._create = create;
40577
+ this._mouse = mouse;
38744
40578
 
38745
- autoPlace.append(element, shape);
38746
- } : appendStart;
40579
+ this.register();
40580
+ }
40581
+
40582
+ AppendMenuProvider.$inject = [
40583
+ 'elementFactory',
40584
+ 'popupMenu',
40585
+ 'create',
40586
+ 'autoPlace',
40587
+ 'rules',
40588
+ 'mouse'
40589
+ ];
38747
40590
 
40591
+ /**
40592
+ * Register append menu provider in the popup menu
40593
+ */
40594
+ AppendMenuProvider.prototype.register = function() {
40595
+ this._popupMenu.registerProvider('bpmn-append', this);
40596
+ };
38748
40597
 
38749
- return {
38750
- group: 'model',
38751
- className: className,
38752
- title: title,
38753
- action: {
38754
- dragstart: appendStart,
38755
- click: append
38756
- }
38757
- };
40598
+ /**
40599
+ * Get all entries from createOptions for the given element.
40600
+ *
40601
+ * @param {djs.model.Base} element
40602
+ *
40603
+ * @return {Array<Object>} a list of menu entry items
40604
+ */
40605
+ AppendMenuProvider.prototype.getPopupMenuEntries = function(element) {
40606
+ const rules = this._rules;
40607
+ const entries = {};
40608
+
40609
+ if (!rules.allowed('shape.append', { element: element })) {
40610
+ return [];
38758
40611
  }
38759
40612
 
38760
- function splitLaneHandler(count) {
40613
+ // filter out elements with no incoming connections
40614
+ const appendOptions = this._filterEntries(CREATE_OPTIONS);
38761
40615
 
38762
- return function(event, element) {
40616
+ // map options to menu entries
40617
+ appendOptions.forEach(option => {
40618
+ const {
40619
+ actionName,
40620
+ className,
40621
+ label,
40622
+ target,
40623
+ description,
40624
+ group,
40625
+ search
40626
+ } = option;
40627
+
40628
+ entries[`append-${actionName}`] = {
40629
+ label,
40630
+ className,
40631
+ description,
40632
+ group,
40633
+ search,
40634
+ action: this._createEntryAction(element, target)
40635
+ };
40636
+ });
38763
40637
 
38764
- // actual split
38765
- modeling.splitLane(element, count);
40638
+ return entries;
40639
+ };
38766
40640
 
38767
- // refresh context pad after split to
38768
- // get rid of split icons
38769
- contextPad.open(element, true);
38770
- };
38771
- }
40641
+ /**
40642
+ * Filter out entries from the options.
40643
+ *
40644
+ * @param {Array<Object>} entries
40645
+ *
40646
+ * @return {Array<Object>} filtered entries
40647
+ */
40648
+ AppendMenuProvider.prototype._filterEntries = function(entries) {
40649
+ return entries.filter(option => {
38772
40650
 
40651
+ const target = option.target;
40652
+ const {
40653
+ type,
40654
+ eventDefinitionType
40655
+ } = target;
40656
+
40657
+ if ([
40658
+ 'bpmn:StartEvent',
40659
+ 'bpmn:Participant'
40660
+ ].includes(type)) {
40661
+ return false;
40662
+ }
38773
40663
 
38774
- if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) {
40664
+ if (type === 'bpmn:BoundaryEvent' && isUndefined$2(eventDefinitionType)) {
40665
+ return false;
40666
+ }
38775
40667
 
38776
- var childLanes = getChildLanes(element);
40668
+ return true;
40669
+ });
40670
+ };
38777
40671
 
38778
- assign$1(actions, {
38779
- 'lane-insert-above': {
38780
- group: 'lane-insert-above',
38781
- className: 'bpmn-icon-lane-insert-above',
38782
- title: translate('Add Lane above'),
38783
- action: {
38784
- click: function(event, element) {
38785
- modeling.addLane(element, 'top');
38786
- }
38787
- }
38788
- }
38789
- });
40672
+ /**
40673
+ * Create an action for a given target.
40674
+ *
40675
+ * @param {djs.model.Base} element
40676
+ * @param {Object} target
40677
+ *
40678
+ * @return {Object}
40679
+ */
40680
+ AppendMenuProvider.prototype._createEntryAction = function(element, target) {
40681
+ const elementFactory = this._elementFactory;
40682
+ const autoPlace = this._autoPlace;
40683
+ const create = this._create;
40684
+ const mouse = this._mouse;
38790
40685
 
38791
- if (childLanes.length < 2) {
38792
40686
 
38793
- if (element.height >= 120) {
38794
- assign$1(actions, {
38795
- 'lane-divide-two': {
38796
- group: 'lane-divide',
38797
- className: 'bpmn-icon-lane-divide-two',
38798
- title: translate('Divide into two Lanes'),
38799
- action: {
38800
- click: splitLaneHandler(2)
38801
- }
38802
- }
38803
- });
38804
- }
40687
+ const autoPlaceElement = () => {
40688
+ const newElement = elementFactory.create('shape', target);
40689
+ autoPlace.append(element, newElement);
40690
+ };
38805
40691
 
38806
- if (element.height >= 180) {
38807
- assign$1(actions, {
38808
- 'lane-divide-three': {
38809
- group: 'lane-divide',
38810
- className: 'bpmn-icon-lane-divide-three',
38811
- title: translate('Divide into three Lanes'),
38812
- action: {
38813
- click: splitLaneHandler(3)
38814
- }
38815
- }
38816
- });
38817
- }
40692
+ const manualPlaceElement = (event) => {
40693
+ const newElement = elementFactory.create('shape', target);
40694
+
40695
+ if (event instanceof KeyboardEvent) {
40696
+ event = mouse.getLastMoveEvent();
38818
40697
  }
38819
40698
 
38820
- assign$1(actions, {
38821
- 'lane-insert-below': {
38822
- group: 'lane-insert-below',
38823
- className: 'bpmn-icon-lane-insert-below',
38824
- title: translate('Add Lane below'),
38825
- action: {
38826
- click: function(event, element) {
38827
- modeling.addLane(element, 'bottom');
38828
- }
38829
- }
38830
- }
38831
- });
40699
+ return create.start(event, newElement);
40700
+ };
40701
+
40702
+ return {
40703
+ click: this._canAutoPlaceElement(target) ? autoPlaceElement : manualPlaceElement,
40704
+ dragstart: manualPlaceElement
40705
+ };
40706
+ };
40707
+
40708
+ /**
40709
+ * Check if the element should be auto placed.
40710
+ *
40711
+ * @param {Object} target
40712
+ *
40713
+ * @return {Boolean}
40714
+ */
40715
+ AppendMenuProvider.prototype._canAutoPlaceElement = (target) => {
40716
+ const { type } = target;
38832
40717
 
40718
+ if (type === 'bpmn:BoundaryEvent') {
40719
+ return false;
38833
40720
  }
38834
40721
 
38835
- if (is$1(businessObject, 'bpmn:FlowNode')) {
40722
+ if (type === 'bpmn:SubProcess' && target.triggeredByEvent) {
40723
+ return false;
40724
+ }
38836
40725
 
38837
- if (is$1(businessObject, 'bpmn:EventBasedGateway')) {
40726
+ if (type === 'bpmn:IntermediateCatchEvent' && target.eventDefinitionType === 'bpmn:LinkEventDefinition') {
40727
+ return false;
40728
+ }
38838
40729
 
38839
- assign$1(actions, {
38840
- 'append.receive-task': appendAction(
38841
- 'bpmn:ReceiveTask',
38842
- 'bpmn-icon-receive-task',
38843
- translate('Append ReceiveTask')
38844
- ),
38845
- 'append.message-intermediate-event': appendAction(
38846
- 'bpmn:IntermediateCatchEvent',
38847
- 'bpmn-icon-intermediate-event-catch-message',
38848
- translate('Append MessageIntermediateCatchEvent'),
38849
- { eventDefinitionType: 'bpmn:MessageEventDefinition' }
38850
- ),
38851
- 'append.timer-intermediate-event': appendAction(
38852
- 'bpmn:IntermediateCatchEvent',
38853
- 'bpmn-icon-intermediate-event-catch-timer',
38854
- translate('Append TimerIntermediateCatchEvent'),
38855
- { eventDefinitionType: 'bpmn:TimerEventDefinition' }
38856
- ),
38857
- 'append.condition-intermediate-event': appendAction(
38858
- 'bpmn:IntermediateCatchEvent',
38859
- 'bpmn-icon-intermediate-event-catch-condition',
38860
- translate('Append ConditionIntermediateCatchEvent'),
38861
- { eventDefinitionType: 'bpmn:ConditionalEventDefinition' }
38862
- ),
38863
- 'append.signal-intermediate-event': appendAction(
38864
- 'bpmn:IntermediateCatchEvent',
38865
- 'bpmn-icon-intermediate-event-catch-signal',
38866
- translate('Append SignalIntermediateCatchEvent'),
38867
- { eventDefinitionType: 'bpmn:SignalEventDefinition' }
38868
- )
38869
- });
38870
- } else
40730
+ return true;
40731
+ };
38871
40732
 
38872
- if (isEventType(businessObject, 'bpmn:BoundaryEvent', 'bpmn:CompensateEventDefinition')) {
40733
+ var LOW_PRIORITY$h = 900;
38873
40734
 
38874
- assign$1(actions, {
38875
- 'append.compensation-activity':
38876
- appendAction(
38877
- 'bpmn:Task',
38878
- 'bpmn-icon-task',
38879
- translate('Append compensation activity'),
38880
- {
38881
- isForCompensation: true
38882
- }
38883
- )
38884
- });
38885
- } else
40735
+ /**
40736
+ * A provider for align elements context pad button
40737
+ */
40738
+ function AppendContextPadProvider(contextPad, popupMenu, translate, canvas) {
40739
+ contextPad.registerProvider(LOW_PRIORITY$h, this);
38886
40740
 
38887
- if (!is$1(businessObject, 'bpmn:EndEvent') &&
38888
- !businessObject.isForCompensation &&
38889
- !isEventType(businessObject, 'bpmn:IntermediateThrowEvent', 'bpmn:LinkEventDefinition') &&
38890
- !isEventSubProcess(businessObject)) {
40741
+ this._contextPad = contextPad;
40742
+ this._popupMenu = popupMenu;
40743
+ this._translate = translate;
40744
+ this._canvas = canvas;
40745
+ }
38891
40746
 
38892
- assign$1(actions, {
38893
- 'append.end-event': appendAction(
38894
- 'bpmn:EndEvent',
38895
- 'bpmn-icon-end-event-none',
38896
- translate('Append EndEvent')
38897
- ),
38898
- 'append.gateway': appendAction(
38899
- 'bpmn:ExclusiveGateway',
38900
- 'bpmn-icon-gateway-none',
38901
- translate('Append Gateway')
38902
- ),
38903
- 'append.append-task': appendAction(
38904
- 'bpmn:Task',
38905
- 'bpmn-icon-task',
38906
- translate('Append Task')
38907
- ),
38908
- 'append.intermediate-event': appendAction(
38909
- 'bpmn:IntermediateThrowEvent',
38910
- 'bpmn-icon-intermediate-event-none',
38911
- translate('Append Intermediate/Boundary Event')
38912
- )
38913
- });
38914
- }
38915
- }
40747
+ AppendContextPadProvider.$inject = [
40748
+ 'contextPad',
40749
+ 'popupMenu',
40750
+ 'translate',
40751
+ 'canvas'
40752
+ ];
38916
40753
 
38917
- if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
40754
+ AppendContextPadProvider.prototype.getContextPadEntries = function(element) {
40755
+ const popupMenu = this._popupMenu;
40756
+ const translate = this._translate;
40757
+ const getAppendMenuPosition = this._getAppendMenuPosition.bind(this);
40758
+
40759
+ if (!popupMenu.isEmpty(element, 'bpmn-append')) {
38918
40760
 
38919
40761
  // Replace menu entry
38920
- assign$1(actions, {
38921
- 'replace': {
38922
- group: 'edit',
38923
- className: 'bpmn-icon-screw-wrench',
38924
- title: translate('Change type'),
40762
+ return {
40763
+ 'append': {
40764
+ group: 'model',
40765
+ imageUrl: appendIcon,
40766
+ title: translate('Append element'),
38925
40767
  action: {
38926
40768
  click: function(event, element) {
38927
40769
 
38928
- var position = assign$1(getReplaceMenuPosition(element), {
40770
+ var position = assign$1(getAppendMenuPosition(element), {
38929
40771
  cursor: { x: event.x, y: event.y }
38930
40772
  });
38931
40773
 
38932
- popupMenu.open(element, 'bpmn-replace', position, {
38933
- title: translate('Change element'),
40774
+ popupMenu.open(element, 'bpmn-append', position, {
40775
+ title: translate('Append element'),
38934
40776
  width: 300,
38935
40777
  search: true
38936
40778
  });
38937
40779
  }
38938
40780
  }
38939
40781
  }
38940
- });
40782
+ };
38941
40783
  }
40784
+ };
38942
40785
 
38943
- if (is$1(businessObject, 'bpmn:SequenceFlow')) {
38944
- assign$1(actions, {
38945
- 'append.text-annotation': appendAction(
38946
- 'bpmn:TextAnnotation',
38947
- 'bpmn-icon-text-annotation'
38948
- )
38949
- });
38950
- }
40786
+ AppendContextPadProvider.prototype._getAppendMenuPosition = function(element) {
40787
+ const contextPad = this._contextPad;
38951
40788
 
38952
- if (
38953
- isAny(businessObject, [
38954
- 'bpmn:FlowNode',
38955
- 'bpmn:InteractionNode',
38956
- 'bpmn:DataObjectReference',
38957
- 'bpmn:DataStoreReference',
38958
- ])
38959
- ) {
38960
- assign$1(actions, {
38961
- 'append.text-annotation': appendAction(
38962
- 'bpmn:TextAnnotation',
38963
- 'bpmn-icon-text-annotation'
38964
- ),
40789
+ const X_OFFSET = 5;
38965
40790
 
38966
- 'connect': {
38967
- group: 'connect',
38968
- className: 'bpmn-icon-connection-multi',
38969
- title: translate(
38970
- 'Connect using ' +
38971
- (businessObject.isForCompensation
38972
- ? ''
38973
- : 'Sequence/MessageFlow or ') +
38974
- 'Association'
38975
- ),
38976
- action: {
38977
- click: startConnect,
38978
- dragstart: startConnect,
38979
- },
38980
- },
38981
- });
38982
- }
40791
+ const pad = contextPad.getPad(element).html;
38983
40792
 
38984
- if (is$1(businessObject, 'bpmn:TextAnnotation')) {
38985
- assign$1(actions, {
38986
- 'connect': {
38987
- group: 'connect',
38988
- className: 'bpmn-icon-connection-multi',
38989
- title: translate('Connect using Association'),
38990
- action: {
38991
- click: startConnect,
38992
- dragstart: startConnect,
38993
- },
38994
- },
38995
- });
38996
- }
40793
+ const padRect = pad.getBoundingClientRect();
38997
40794
 
38998
- if (isAny(businessObject, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ])) {
38999
- assign$1(actions, {
39000
- 'connect': {
39001
- group: 'connect',
39002
- className: 'bpmn-icon-connection-multi',
39003
- title: translate('Connect using DataInputAssociation'),
39004
- action: {
39005
- click: startConnect,
39006
- dragstart: startConnect
39007
- }
39008
- }
39009
- });
39010
- }
40795
+ const pos = {
40796
+ x: padRect.right + X_OFFSET,
40797
+ y: padRect.top
40798
+ };
39011
40799
 
39012
- if (is$1(businessObject, 'bpmn:Group')) {
39013
- assign$1(actions, {
39014
- 'append.text-annotation': appendAction('bpmn:TextAnnotation', 'bpmn-icon-text-annotation')
39015
- });
39016
- }
40800
+ return pos;
40801
+ };
39017
40802
 
39018
- // delete element entry, only show if allowed by rules
39019
- var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });
40803
+ /**
40804
+ * Append anything modeling rules
40805
+ */
40806
+ function AppendRules(eventBus) {
40807
+ RuleProvider.call(this, eventBus);
40808
+ }
39020
40809
 
39021
- if (isArray$3(deleteAllowed)) {
40810
+ e$3(AppendRules, RuleProvider);
39022
40811
 
39023
- // was the element returned as a deletion candidate?
39024
- deleteAllowed = deleteAllowed[0] === element;
39025
- }
40812
+ AppendRules.$inject = [
40813
+ 'eventBus'
40814
+ ];
39026
40815
 
39027
- if (deleteAllowed) {
39028
- assign$1(actions, {
39029
- 'delete': {
39030
- group: 'edit',
39031
- className: 'bpmn-icon-trash',
39032
- title: translate('Remove'),
39033
- action: {
39034
- click: removeElement
39035
- }
39036
- }
39037
- });
39038
- }
40816
+ AppendRules.prototype.init = function() {
40817
+ this.addRule('shape.append', function(context) {
39039
40818
 
39040
- return actions;
39041
- };
40819
+ var source = context.element;
39042
40820
 
40821
+ const businessObject = getBusinessObject(source);
39043
40822
 
39044
- // helpers /////////
40823
+ if (isLabel$6(source)) {
40824
+ return false;
40825
+ }
39045
40826
 
39046
- function isEventType(eventBo, type, definition) {
40827
+ if (isAny(source, [
40828
+ 'bpmn:EndEvent',
40829
+ 'bpmn:Group',
40830
+ 'bpmn:TextAnnotation',
40831
+ 'bpmn:Lane',
40832
+ 'bpmn:Participant',
40833
+ 'bpmn:DataStoreReference',
40834
+ 'bpmn:DataObjectReference'
40835
+ ])) {
40836
+ return false;
40837
+ }
39047
40838
 
39048
- var isType = eventBo.$instanceOf(type);
39049
- var isDefinition = false;
40839
+ if (isConnection$b(source)) {
40840
+ return false;
40841
+ }
39050
40842
 
39051
- var definitions = eventBo.eventDefinitions || [];
39052
- forEach$1(definitions, function(def) {
39053
- if (def.$type === definition) {
39054
- isDefinition = true;
40843
+ if (is$1(source, 'bpmn:IntermediateThrowEvent') && hasEventDefinition$1(source, 'bpmn:LinkEventDefinition')) {
40844
+ return false;
40845
+ }
40846
+
40847
+ if (is$1(source, 'bpmn:SubProcess') && businessObject.triggeredByEvent) {
40848
+ return false;
39055
40849
  }
39056
40850
  });
39057
40851
 
39058
- return isType && isDefinition;
40852
+ };
40853
+
40854
+
40855
+ // helpers //////////////
40856
+ function hasEventDefinition$1(element, eventDefinition) {
40857
+ var bo = getBusinessObject(element);
40858
+
40859
+ return !!find(bo.eventDefinitions || [], function(definition) {
40860
+ return is$1(definition, eventDefinition);
40861
+ });
39059
40862
  }
39060
40863
 
39061
- function includes$7(array, item) {
39062
- return array.indexOf(item) !== -1;
40864
+ function isConnection$b(element) {
40865
+ return element.waypoints;
39063
40866
  }
39064
40867
 
39065
- var ContextPadModule = {
40868
+ var CreateAppendAnythingModule = {
39066
40869
  __depends__: [
39067
- DirectEditingModule,
39068
- ContextPadModule$1,
39069
- SelectionModule,
39070
- ConnectModule,
39071
- CreateModule,
39072
- PopupMenuModule
40870
+ PaletteModule$1,
40871
+ PopupMenuModule$1,
40872
+ AutoPlaceModule$1,
40873
+ ContextPadModule$1
39073
40874
  ],
39074
- __init__: [ 'contextPadProvider' ],
39075
- contextPadProvider: [ 'type', ContextPadProvider ]
40875
+ __init__: [
40876
+ 'createMenuProvider',
40877
+ 'createPaletteProvider',
40878
+ 'createAppendEditorActions',
40879
+ 'createAppendKeyboardBindings',
40880
+ 'appendMenuProvider',
40881
+ 'appendContextPadProvider',
40882
+ 'appendRules'
40883
+ ],
40884
+ createMenuProvider: [ 'type', CreateMenuProvider ],
40885
+ createPaletteProvider: [ 'type', CreatePaletteProvider ],
40886
+ createAppendEditorActions: [ 'type', CreateAppendEditorActions ],
40887
+ createAppendKeyboardBindings: [ 'type', CreateAppendKeyboardBindings ],
40888
+ appendMenuProvider: [ 'type', AppendMenuProvider ],
40889
+ appendContextPadProvider: [ 'type', AppendContextPadProvider ],
40890
+ appendRules: [ 'type', AppendRules ]
39076
40891
  };
39077
40892
 
39078
40893
  var AXIS_DIMENSIONS = {
@@ -46525,7 +48340,7 @@
46525
48340
  }
46526
48341
 
46527
48342
  return some(types, function(type) {
46528
- return hasEventDefinition$2(element, type);
48343
+ return hasEventDefinition$3(element, type);
46529
48344
  });
46530
48345
  }
46531
48346
 
@@ -52483,6 +54298,16 @@
52483
54298
  di.isMarkerVisible = true;
52484
54299
  }
52485
54300
 
54301
+ if (isDefined(attrs.triggeredByEvent)) {
54302
+ businessObject.triggeredByEvent = attrs.triggeredByEvent;
54303
+ delete attrs.triggeredByEvent;
54304
+ }
54305
+
54306
+ if (isDefined(attrs.cancelActivity)) {
54307
+ businessObject.cancelActivity = attrs.cancelActivity;
54308
+ delete attrs.cancelActivity;
54309
+ }
54310
+
52486
54311
  var eventDefinitions,
52487
54312
  newEventDefinition;
52488
54313
 
@@ -52672,22 +54497,22 @@
52672
54497
  y: 0
52673
54498
  };
52674
54499
 
52675
- if (alignment.left) {
54500
+ if (isDefined(alignment.left)) {
52676
54501
  delta.x = alignment.left - element.x;
52677
54502
 
52678
- } else if (alignment.right) {
54503
+ } else if (isDefined(alignment.right)) {
52679
54504
  delta.x = (alignment.right - element.width) - element.x;
52680
54505
 
52681
- } else if (alignment.center) {
54506
+ } else if (isDefined(alignment.center)) {
52682
54507
  delta.x = (alignment.center - Math.round(element.width / 2)) - element.x;
52683
54508
 
52684
- } else if (alignment.top) {
54509
+ } else if (isDefined(alignment.top)) {
52685
54510
  delta.y = alignment.top - element.y;
52686
54511
 
52687
- } else if (alignment.bottom) {
54512
+ } else if (isDefined(alignment.bottom)) {
52688
54513
  delta.y = (alignment.bottom - element.height) - element.y;
52689
54514
 
52690
- } else if (alignment.middle) {
54515
+ } else if (isDefined(alignment.middle)) {
52691
54516
  delta.y = (alignment.middle - Math.round(element.height / 2)) - element.y;
52692
54517
  }
52693
54518
 
@@ -58101,464 +59926,6 @@
58101
59926
  movePreview: [ 'type', MovePreview ]
58102
59927
  };
58103
59928
 
58104
- var TOGGLE_SELECTOR = '.djs-palette-toggle',
58105
- ENTRY_SELECTOR = '.entry',
58106
- ELEMENT_SELECTOR = TOGGLE_SELECTOR + ', ' + ENTRY_SELECTOR;
58107
-
58108
- var PALETTE_PREFIX = 'djs-palette-',
58109
- PALETTE_SHOWN_CLS = 'shown',
58110
- PALETTE_OPEN_CLS = 'open',
58111
- PALETTE_TWO_COLUMN_CLS = 'two-column';
58112
-
58113
- var DEFAULT_PRIORITY = 1000;
58114
-
58115
-
58116
- /**
58117
- * A palette containing modeling elements.
58118
- */
58119
- function Palette(eventBus, canvas) {
58120
-
58121
- this._eventBus = eventBus;
58122
- this._canvas = canvas;
58123
-
58124
- var self = this;
58125
-
58126
- eventBus.on('tool-manager.update', function(event) {
58127
- var tool = event.tool;
58128
-
58129
- self.updateToolHighlight(tool);
58130
- });
58131
-
58132
- eventBus.on('i18n.changed', function() {
58133
- self._update();
58134
- });
58135
-
58136
- eventBus.on('diagram.init', function() {
58137
-
58138
- self._diagramInitialized = true;
58139
-
58140
- self._rebuild();
58141
- });
58142
- }
58143
-
58144
- Palette.$inject = [ 'eventBus', 'canvas' ];
58145
-
58146
-
58147
- /**
58148
- * Register a provider with the palette
58149
- *
58150
- * @param {number} [priority=1000]
58151
- * @param {PaletteProvider} provider
58152
- *
58153
- * @example
58154
- * const paletteProvider = {
58155
- * getPaletteEntries: function() {
58156
- * return function(entries) {
58157
- * return {
58158
- * ...entries,
58159
- * 'entry-1': {
58160
- * label: 'My Entry',
58161
- * action: function() { alert("I have been clicked!"); }
58162
- * }
58163
- * };
58164
- * }
58165
- * }
58166
- * };
58167
- *
58168
- * palette.registerProvider(800, paletteProvider);
58169
- */
58170
- Palette.prototype.registerProvider = function(priority, provider) {
58171
- if (!provider) {
58172
- provider = priority;
58173
- priority = DEFAULT_PRIORITY;
58174
- }
58175
-
58176
- this._eventBus.on('palette.getProviders', priority, function(event) {
58177
- event.providers.push(provider);
58178
- });
58179
-
58180
- this._rebuild();
58181
- };
58182
-
58183
-
58184
- /**
58185
- * Returns the palette entries
58186
- *
58187
- * @return {Object<string, PaletteEntryDescriptor>} map of entries
58188
- */
58189
- Palette.prototype.getEntries = function() {
58190
- var providers = this._getProviders();
58191
-
58192
- return providers.reduce(addPaletteEntries, {});
58193
- };
58194
-
58195
- Palette.prototype._rebuild = function() {
58196
-
58197
- if (!this._diagramInitialized) {
58198
- return;
58199
- }
58200
-
58201
- var providers = this._getProviders();
58202
-
58203
- if (!providers.length) {
58204
- return;
58205
- }
58206
-
58207
- if (!this._container) {
58208
- this._init();
58209
- }
58210
-
58211
- this._update();
58212
- };
58213
-
58214
- /**
58215
- * Initialize
58216
- */
58217
- Palette.prototype._init = function() {
58218
-
58219
- var self = this;
58220
-
58221
- var eventBus = this._eventBus;
58222
-
58223
- var parentContainer = this._getParentContainer();
58224
-
58225
- var container = this._container = domify$1(Palette.HTML_MARKUP);
58226
-
58227
- parentContainer.appendChild(container);
58228
- classes$1(parentContainer).add(PALETTE_PREFIX + PALETTE_SHOWN_CLS);
58229
-
58230
- delegate.bind(container, ELEMENT_SELECTOR, 'click', function(event) {
58231
-
58232
- var target = event.delegateTarget;
58233
-
58234
- if (matches(target, TOGGLE_SELECTOR)) {
58235
- return self.toggle();
58236
- }
58237
-
58238
- self.trigger('click', event);
58239
- });
58240
-
58241
- // prevent drag propagation
58242
- event.bind(container, 'mousedown', function(event) {
58243
- event.stopPropagation();
58244
- });
58245
-
58246
- // prevent drag propagation
58247
- delegate.bind(container, ENTRY_SELECTOR, 'dragstart', function(event) {
58248
- self.trigger('dragstart', event);
58249
- });
58250
-
58251
- eventBus.on('canvas.resized', this._layoutChanged, this);
58252
-
58253
- eventBus.fire('palette.create', {
58254
- container: container
58255
- });
58256
- };
58257
-
58258
- Palette.prototype._getProviders = function(id) {
58259
-
58260
- var event = this._eventBus.createEvent({
58261
- type: 'palette.getProviders',
58262
- providers: []
58263
- });
58264
-
58265
- this._eventBus.fire(event);
58266
-
58267
- return event.providers;
58268
- };
58269
-
58270
- /**
58271
- * Update palette state.
58272
- *
58273
- * @param {Object} [state] { open, twoColumn }
58274
- */
58275
- Palette.prototype._toggleState = function(state) {
58276
-
58277
- state = state || {};
58278
-
58279
- var parent = this._getParentContainer(),
58280
- container = this._container;
58281
-
58282
- var eventBus = this._eventBus;
58283
-
58284
- var twoColumn;
58285
-
58286
- var cls = classes$1(container),
58287
- parentCls = classes$1(parent);
58288
-
58289
- if ('twoColumn' in state) {
58290
- twoColumn = state.twoColumn;
58291
- } else {
58292
- twoColumn = this._needsCollapse(parent.clientHeight, this._entries || {});
58293
- }
58294
-
58295
- // always update two column
58296
- cls.toggle(PALETTE_TWO_COLUMN_CLS, twoColumn);
58297
- parentCls.toggle(PALETTE_PREFIX + PALETTE_TWO_COLUMN_CLS, twoColumn);
58298
-
58299
- if ('open' in state) {
58300
- cls.toggle(PALETTE_OPEN_CLS, state.open);
58301
- parentCls.toggle(PALETTE_PREFIX + PALETTE_OPEN_CLS, state.open);
58302
- }
58303
-
58304
- eventBus.fire('palette.changed', {
58305
- twoColumn: twoColumn,
58306
- open: this.isOpen()
58307
- });
58308
- };
58309
-
58310
- Palette.prototype._update = function() {
58311
-
58312
- var entriesContainer = query('.djs-palette-entries', this._container),
58313
- entries = this._entries = this.getEntries();
58314
-
58315
- clear$1(entriesContainer);
58316
-
58317
- forEach$1(entries, function(entry, id) {
58318
-
58319
- var grouping = entry.group || 'default';
58320
-
58321
- var container = query('[data-group=' + cssEscape(grouping) + ']', entriesContainer);
58322
- if (!container) {
58323
- container = domify$1('<div class="group"></div>');
58324
- attr$1(container, 'data-group', grouping);
58325
-
58326
- entriesContainer.appendChild(container);
58327
- }
58328
-
58329
- var html = entry.html || (
58330
- entry.separator ?
58331
- '<hr class="separator" />' :
58332
- '<div class="entry" draggable="true"></div>');
58333
-
58334
-
58335
- var control = domify$1(html);
58336
- container.appendChild(control);
58337
-
58338
- if (!entry.separator) {
58339
- attr$1(control, 'data-action', id);
58340
-
58341
- if (entry.title) {
58342
- attr$1(control, 'title', entry.title);
58343
- }
58344
-
58345
- if (entry.className) {
58346
- addClasses(control, entry.className);
58347
- }
58348
-
58349
- if (entry.imageUrl) {
58350
- var image = domify$1('<img>');
58351
- attr$1(image, 'src', entry.imageUrl);
58352
-
58353
- control.appendChild(image);
58354
- }
58355
- }
58356
- });
58357
-
58358
- // open after update
58359
- this.open();
58360
- };
58361
-
58362
-
58363
- /**
58364
- * Trigger an action available on the palette
58365
- *
58366
- * @param {string} action
58367
- * @param {Event} event
58368
- */
58369
- Palette.prototype.trigger = function(action, event, autoActivate) {
58370
- var entries = this._entries,
58371
- entry,
58372
- handler,
58373
- originalEvent,
58374
- button = event.delegateTarget || event.target;
58375
-
58376
- if (!button) {
58377
- return event.preventDefault();
58378
- }
58379
-
58380
- entry = entries[attr$1(button, 'data-action')];
58381
-
58382
- // when user clicks on the palette and not on an action
58383
- if (!entry) {
58384
- return;
58385
- }
58386
-
58387
- handler = entry.action;
58388
-
58389
- originalEvent = event.originalEvent || event;
58390
-
58391
- // simple action (via callback function)
58392
- if (isFunction(handler)) {
58393
- if (action === 'click') {
58394
- handler(originalEvent, autoActivate);
58395
- }
58396
- } else {
58397
- if (handler[action]) {
58398
- handler[action](originalEvent, autoActivate);
58399
- }
58400
- }
58401
-
58402
- // silence other actions
58403
- event.preventDefault();
58404
- };
58405
-
58406
- Palette.prototype._layoutChanged = function() {
58407
- this._toggleState({});
58408
- };
58409
-
58410
- /**
58411
- * Do we need to collapse to two columns?
58412
- *
58413
- * @param {number} availableHeight
58414
- * @param {Object} entries
58415
- *
58416
- * @return {boolean}
58417
- */
58418
- Palette.prototype._needsCollapse = function(availableHeight, entries) {
58419
-
58420
- // top margin + bottom toggle + bottom margin
58421
- // implementors must override this method if they
58422
- // change the palette styles
58423
- var margin = 20 + 10 + 20;
58424
-
58425
- var entriesHeight = Object.keys(entries).length * 46;
58426
-
58427
- return availableHeight < entriesHeight + margin;
58428
- };
58429
-
58430
- /**
58431
- * Close the palette
58432
- */
58433
- Palette.prototype.close = function() {
58434
-
58435
- this._toggleState({
58436
- open: false,
58437
- twoColumn: false
58438
- });
58439
- };
58440
-
58441
-
58442
- /**
58443
- * Open the palette
58444
- */
58445
- Palette.prototype.open = function() {
58446
- this._toggleState({ open: true });
58447
- };
58448
-
58449
-
58450
- Palette.prototype.toggle = function(open) {
58451
- if (this.isOpen()) {
58452
- this.close();
58453
- } else {
58454
- this.open();
58455
- }
58456
- };
58457
-
58458
- Palette.prototype.isActiveTool = function(tool) {
58459
- return tool && this._activeTool === tool;
58460
- };
58461
-
58462
- Palette.prototype.updateToolHighlight = function(name) {
58463
- var entriesContainer,
58464
- toolsContainer;
58465
-
58466
- if (!this._toolsContainer) {
58467
- entriesContainer = query('.djs-palette-entries', this._container);
58468
-
58469
- this._toolsContainer = query('[data-group=tools]', entriesContainer);
58470
- }
58471
-
58472
- toolsContainer = this._toolsContainer;
58473
-
58474
- forEach$1(toolsContainer.children, function(tool) {
58475
- var actionName = tool.getAttribute('data-action');
58476
-
58477
- if (!actionName) {
58478
- return;
58479
- }
58480
-
58481
- var toolClasses = classes$1(tool);
58482
-
58483
- actionName = actionName.replace('-tool', '');
58484
-
58485
- if (toolClasses.contains('entry') && actionName === name) {
58486
- toolClasses.add('highlighted-entry');
58487
- } else {
58488
- toolClasses.remove('highlighted-entry');
58489
- }
58490
- });
58491
- };
58492
-
58493
-
58494
- /**
58495
- * Return true if the palette is opened.
58496
- *
58497
- * @example
58498
- *
58499
- * palette.open();
58500
- *
58501
- * if (palette.isOpen()) {
58502
- * // yes, we are open
58503
- * }
58504
- *
58505
- * @return {boolean} true if palette is opened
58506
- */
58507
- Palette.prototype.isOpen = function() {
58508
- return classes$1(this._container).has(PALETTE_OPEN_CLS);
58509
- };
58510
-
58511
- /**
58512
- * Get container the palette lives in.
58513
- *
58514
- * @return {Element}
58515
- */
58516
- Palette.prototype._getParentContainer = function() {
58517
- return this._canvas.getContainer();
58518
- };
58519
-
58520
-
58521
- /* markup definition */
58522
-
58523
- Palette.HTML_MARKUP =
58524
- '<div class="djs-palette">' +
58525
- '<div class="djs-palette-entries"></div>' +
58526
- '<div class="djs-palette-toggle"></div>' +
58527
- '</div>';
58528
-
58529
-
58530
- // helpers //////////////////////
58531
-
58532
- function addClasses(element, classNames) {
58533
-
58534
- var classes = classes$1(element);
58535
-
58536
- var actualClassNames = isArray$3(classNames) ? classNames : classNames.split(/\s+/g);
58537
- actualClassNames.forEach(function(cls) {
58538
- classes.add(cls);
58539
- });
58540
- }
58541
-
58542
- function addPaletteEntries(entries, provider) {
58543
-
58544
- var entriesOrUpdater = provider.getPaletteEntries();
58545
-
58546
- if (isFunction(entriesOrUpdater)) {
58547
- return entriesOrUpdater(entries);
58548
- }
58549
-
58550
- forEach$1(entriesOrUpdater, function(entry, id) {
58551
- entries[id] = entry;
58552
- });
58553
-
58554
- return entries;
58555
- }
58556
-
58557
- var PaletteModule$1 = {
58558
- __init__: [ 'palette' ],
58559
- palette: [ 'type', Palette ]
58560
- };
58561
-
58562
59929
  var LASSO_TOOL_CURSOR = 'crosshair';
58563
59930
 
58564
59931
 
@@ -61339,6 +62706,7 @@
61339
62706
  ContextPadModule,
61340
62707
  CopyPasteModule,
61341
62708
  CreateModule,
62709
+ CreateAppendAnythingModule,
61342
62710
  DistributeElementsModule,
61343
62711
  EditorActionsModule,
61344
62712
  GridSnappingModule,