bpmn-js 16.3.2 → 16.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/bpmn-modeler.development.js +686 -378
  2. package/dist/bpmn-modeler.production.min.js +26 -26
  3. package/dist/bpmn-navigated-viewer.development.js +3 -3
  4. package/dist/bpmn-navigated-viewer.production.min.js +2 -2
  5. package/dist/bpmn-viewer.development.js +3 -3
  6. package/dist/bpmn-viewer.production.min.js +2 -2
  7. package/lib/draw/BpmnRenderer.js +1 -1
  8. package/lib/features/context-pad/ContextPadProvider.js +7 -13
  9. package/lib/features/modeling/BpmnUpdater.js +3 -1
  10. package/lib/features/modeling/ElementFactory.js +14 -1
  11. package/lib/features/modeling/behavior/DeleteLaneBehavior.js +52 -7
  12. package/lib/features/modeling/behavior/FixHoverBehavior.js +2 -4
  13. package/lib/features/modeling/behavior/ResizeBehavior.d.ts +10 -0
  14. package/lib/features/modeling/behavior/ResizeBehavior.js +262 -210
  15. package/lib/features/modeling/behavior/SpaceToolBehavior.js +207 -139
  16. package/lib/features/modeling/behavior/TextAnnotationBehavior.d.ts +6 -0
  17. package/lib/features/modeling/behavior/TextAnnotationBehavior.js +43 -0
  18. package/lib/features/modeling/behavior/index.js +3 -0
  19. package/lib/features/modeling/cmd/AddLaneHandler.js +93 -10
  20. package/lib/features/modeling/util/LaneUtil.js +30 -4
  21. package/lib/features/ordering/BpmnOrderingProvider.js +9 -2
  22. package/lib/features/palette/PaletteProvider.js +2 -9
  23. package/lib/features/replace/BpmnReplace.js +4 -0
  24. package/lib/features/rules/BpmnRules.js +2 -2
  25. package/lib/features/space-tool/BpmnSpaceTool.js +8 -3
  26. package/lib/model/Types.d.ts +1 -0
  27. package/lib/model/Types.ts +1 -0
  28. package/package.json +2 -2
@@ -720,7 +720,7 @@ export default function BpmnRenderer(
720
720
  });
721
721
 
722
722
  return drawPath(parentGfx, pathData, {
723
- fill: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
723
+ fill: getFillColor(event, defaultFillColor, attrs.fill),
724
724
  stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
725
725
  strokeWidth: 1
726
726
  });
@@ -142,7 +142,7 @@ ContextPadProvider.prototype.getMultiElementContextPadEntries = function(element
142
142
  'delete': {
143
143
  group: 'edit',
144
144
  className: 'bpmn-icon-trash',
145
- title: this._translate('Remove'),
145
+ title: this._translate('Delete'),
146
146
  action: {
147
147
  click: function(event, elements) {
148
148
  modeling.removeElements(elements.slice());
@@ -443,7 +443,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
443
443
  'replace': {
444
444
  group: 'edit',
445
445
  className: 'bpmn-icon-screw-wrench',
446
- title: translate('Change type'),
446
+ title: translate('Change element'),
447
447
  action: {
448
448
  click: function(event, element) {
449
449
 
@@ -467,7 +467,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
467
467
  'append.text-annotation': appendAction(
468
468
  'bpmn:TextAnnotation',
469
469
  'bpmn-icon-text-annotation',
470
- translate('Append text annotation')
470
+ translate('Add text annotation')
471
471
  )
472
472
  });
473
473
  }
@@ -484,19 +484,13 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
484
484
  'append.text-annotation': appendAction(
485
485
  'bpmn:TextAnnotation',
486
486
  'bpmn-icon-text-annotation',
487
- translate('Append text annotation')
487
+ translate('Add text annotation')
488
488
  ),
489
489
 
490
490
  'connect': {
491
491
  group: 'connect',
492
492
  className: 'bpmn-icon-connection-multi',
493
- title: translate(
494
- 'Connect using ' +
495
- (businessObject.isForCompensation
496
- ? ''
497
- : 'sequence/message flow or ') +
498
- 'association'
499
- ),
493
+ title: translate('Connect to other element'),
500
494
  action: {
501
495
  click: startConnect,
502
496
  dragstart: startConnect,
@@ -538,7 +532,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
538
532
  'append.text-annotation': appendAction(
539
533
  'bpmn:TextAnnotation',
540
534
  'bpmn-icon-text-annotation',
541
- translate('Append text annotation')
535
+ translate('Add text annotation')
542
536
  )
543
537
  });
544
538
  }
@@ -557,7 +551,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
557
551
  'delete': {
558
552
  group: 'edit',
559
553
  className: 'bpmn-icon-trash',
560
- title: translate('Remove'),
554
+ title: translate('Delete'),
561
555
  action: {
562
556
  click: removeElement
563
557
  }
@@ -24,6 +24,8 @@ import {
24
24
  isLabelExternal
25
25
  } from '../../util/LabelUtil';
26
26
 
27
+ import { isPlane } from '../../util/DrilldownUtil';
28
+
27
29
  import { delta } from 'diagram-js/lib/util/PositionUtil';
28
30
 
29
31
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
@@ -303,7 +305,7 @@ export default function BpmnUpdater(
303
305
  const di = getDi(element),
304
306
  diLabel = di && di.get('label');
305
307
 
306
- if (isLabelExternal(element)) {
308
+ if (isLabelExternal(element) || isPlane(element)) {
307
309
  return;
308
310
  }
309
311
 
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  assign,
3
3
  forEach,
4
+ has,
4
5
  isDefined,
5
6
  isObject,
6
7
  omit
@@ -206,12 +207,24 @@ ElementFactory.prototype.createElement = function(elementType, attrs) {
206
207
  attrs = applyAttribute(di, attrs, 'isExpanded');
207
208
  }
208
209
 
210
+ if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ])) {
211
+ attrs = applyAttribute(di, attrs, 'isHorizontal');
212
+ }
213
+
209
214
  if (is(businessObject, 'bpmn:SubProcess')) {
210
215
  attrs.collapsed = !isExpanded(businessObject, di);
211
216
  }
212
217
 
213
218
  if (is(businessObject, 'bpmn:ExclusiveGateway')) {
214
- di.isMarkerVisible = true;
219
+ if (has(attrs, 'isMarkerVisible')) {
220
+ if (attrs.isMarkerVisible === undefined) {
221
+ di.isMarkerVisible = false;
222
+ } else {
223
+ attrs = applyAttribute(di, attrs, 'isMarkerVisible');
224
+ }
225
+ } else {
226
+ di.isMarkerVisible = true;
227
+ }
215
228
  }
216
229
 
217
230
  if (isDefined(attrs.triggeredByEvent)) {
@@ -8,6 +8,10 @@ import {
8
8
  getChildLanes
9
9
  } from '../util/LaneUtil';
10
10
 
11
+ import {
12
+ isHorizontal
13
+ } from '../../../util/DiUtil';
14
+
11
15
  import {
12
16
  eachElement
13
17
  } from 'diagram-js/lib/util/Elements';
@@ -32,18 +36,29 @@ export default function DeleteLaneBehavior(eventBus, spaceTool) {
32
36
 
33
37
 
34
38
  function compensateLaneDelete(shape, oldParent) {
39
+ var isHorizontalLane = isHorizontal(shape);
35
40
 
36
41
  var siblings = getChildLanes(oldParent);
37
42
 
38
43
  var topAffected = [];
39
44
  var bottomAffected = [];
45
+ var leftAffected = [];
46
+ var rightAffected = [];
40
47
 
41
48
  eachElement(siblings, function(element) {
42
49
 
43
- if (element.y > shape.y) {
44
- bottomAffected.push(element);
50
+ if (isHorizontalLane) {
51
+ if (element.y > shape.y) {
52
+ bottomAffected.push(element);
53
+ } else {
54
+ topAffected.push(element);
55
+ }
45
56
  } else {
46
- topAffected.push(element);
57
+ if (element.x > shape.x) {
58
+ rightAffected.push(element);
59
+ } else {
60
+ leftAffected.push(element);
61
+ }
47
62
  }
48
63
 
49
64
  return element.children;
@@ -55,14 +70,24 @@ export default function DeleteLaneBehavior(eventBus, spaceTool) {
55
70
 
56
71
  var offset;
57
72
 
58
- if (bottomAffected.length && topAffected.length) {
59
- offset = shape.height / 2;
73
+ if (isHorizontalLane) {
74
+ if (bottomAffected.length && topAffected.length) {
75
+ offset = shape.height / 2;
76
+ } else {
77
+ offset = shape.height;
78
+ }
60
79
  } else {
61
- offset = shape.height;
80
+ if (rightAffected.length && leftAffected.length) {
81
+ offset = shape.width / 2;
82
+ } else {
83
+ offset = shape.width;
84
+ }
62
85
  }
63
86
 
64
87
  var topAdjustments,
65
- bottomAdjustments;
88
+ bottomAdjustments,
89
+ leftAdjustments,
90
+ rightAdjustments;
66
91
 
67
92
  if (topAffected.length) {
68
93
  topAdjustments = spaceTool.calculateAdjustments(
@@ -83,6 +108,26 @@ export default function DeleteLaneBehavior(eventBus, spaceTool) {
83
108
  bottomAdjustments.resizingShapes,
84
109
  { x: 0, y: -offset }, 'n');
85
110
  }
111
+
112
+ if (leftAffected.length) {
113
+ leftAdjustments = spaceTool.calculateAdjustments(
114
+ leftAffected, 'x', offset, shape.x - 10);
115
+
116
+ spaceTool.makeSpace(
117
+ leftAdjustments.movingShapes,
118
+ leftAdjustments.resizingShapes,
119
+ { x: offset, y: 0 }, 'e');
120
+ }
121
+
122
+ if (rightAffected.length) {
123
+ rightAdjustments = spaceTool.calculateAdjustments(
124
+ rightAffected, 'x', -offset, shape.x + shape.width + 10);
125
+
126
+ spaceTool.makeSpace(
127
+ rightAdjustments.movingShapes,
128
+ rightAdjustments.resizingShapes,
129
+ { x: -offset, y: 0 }, 'w');
130
+ }
86
131
  }
87
132
 
88
133
 
@@ -1,8 +1,6 @@
1
1
  import { getLanesRoot } from '../util/LaneUtil';
2
2
 
3
- import { is } from '../../../util/ModelUtil';
4
-
5
- import { isAny } from '../util/ModelingUtil';
3
+ import { is, isAny } from '../../../util/ModelUtil';
6
4
 
7
5
  /**
8
6
  * @typedef {import('diagram-js/lib/core/ElementRegistry').default} ElementRegistry
@@ -48,7 +46,7 @@ export default function FixHoverBehavior(elementRegistry, eventBus, canvas) {
48
46
 
49
47
  // ensure bpmn:Group and label elements are dropped
50
48
  // always onto the root
51
- if (hover !== rootElement && (shape.labelTarget || is(shape, 'bpmn:Group'))) {
49
+ if (hover !== rootElement && (shape.labelTarget || isAny(shape, [ 'bpmn:Group', 'bpmn:TextAnnotation' ]))) {
52
50
  event.hover = rootElement;
53
51
  event.hoverGfx = elementRegistry.getGraphics(event.hover);
54
52
  }
@@ -20,11 +20,21 @@ export const GROUP_MIN_DIMENSIONS: Dimensions;
20
20
  */
21
21
  export const LANE_MIN_DIMENSIONS: Dimensions;
22
22
 
23
+ /**
24
+ * @type {Dimensions}
25
+ */
26
+ export const VERTICAL_LANE_MIN_DIMENSIONS: Dimensions;
27
+
23
28
  /**
24
29
  * @type {Dimensions}
25
30
  */
26
31
  export const PARTICIPANT_MIN_DIMENSIONS: Dimensions;
27
32
 
33
+ /**
34
+ * @type {Dimensions}
35
+ */
36
+ export const VERTICAL_PARTICIPANT_MIN_DIMENSIONS: Dimensions;
37
+
28
38
  /**
29
39
  * @type {Dimensions}
30
40
  */