bpmn-js 9.3.1 → 9.4.1

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 (46) hide show
  1. package/CHANGELOG.md +817 -0
  2. package/dist/bpmn-modeler.development.js +3424 -3165
  3. package/dist/bpmn-modeler.production.min.js +8 -8
  4. package/dist/bpmn-navigated-viewer.development.js +357 -283
  5. package/dist/bpmn-navigated-viewer.production.min.js +6 -6
  6. package/dist/bpmn-viewer.development.js +323 -269
  7. package/dist/bpmn-viewer.production.min.js +6 -6
  8. package/lib/draw/BpmnRenderUtil.js +25 -25
  9. package/lib/draw/BpmnRenderer.js +4 -4
  10. package/lib/draw/PathMap.js +42 -42
  11. package/lib/features/align-elements/index.js +1 -1
  12. package/lib/features/copy-paste/BpmnCopyPaste.js +75 -69
  13. package/lib/features/copy-paste/ModdleCopy.js +26 -13
  14. package/lib/features/drilldown/DrilldownOverlayBehavior.js +2 -2
  15. package/lib/features/drilldown/SubprocessCompatibility.js +1 -1
  16. package/lib/features/drilldown/index.js +1 -1
  17. package/lib/features/grid-snapping/behavior/{AutoPlaceBehavior.js → GridSnappingAutoPlaceBehavior.js} +2 -2
  18. package/lib/features/grid-snapping/behavior/{LayoutConnectionBehavior.js → GridSnappingLayoutConnectionBehavior.js} +4 -4
  19. package/lib/features/grid-snapping/behavior/{CreateParticipantBehavior.js → GridSnappingParticipantBehavior.js} +2 -2
  20. package/lib/features/grid-snapping/behavior/index.js +7 -7
  21. package/lib/features/keyboard/BpmnKeyboardBindings.js +7 -7
  22. package/lib/features/label-editing/LabelEditingProvider.js +1 -23
  23. package/lib/features/modeling/ElementFactory.js +18 -8
  24. package/lib/features/modeling/behavior/BoundaryEventBehavior.js +1 -16
  25. package/lib/features/modeling/behavior/DropOnFlowBehavior.js +1 -1
  26. package/lib/features/modeling/behavior/GroupBehavior.js +205 -93
  27. package/lib/features/modeling/behavior/ReplaceElementBehaviour.js +8 -4
  28. package/lib/features/modeling/behavior/ResizeBehavior.js +2 -0
  29. package/lib/features/modeling/behavior/RootElementReferenceBehavior.js +7 -8
  30. package/lib/features/modeling/behavior/SpaceToolBehavior.js +5 -0
  31. package/lib/features/modeling/behavior/SubProcessPlaneBehavior.js +9 -0
  32. package/lib/features/modeling/behavior/index.js +1 -1
  33. package/lib/features/modeling/behavior/util/CategoryUtil.js +66 -13
  34. package/lib/features/modeling/behavior/util/LayoutUtil.js +6 -6
  35. package/lib/features/modeling/cmd/SetColorHandler.js +10 -3
  36. package/lib/features/modeling/cmd/UpdateModdlePropertiesHandler.js +4 -1
  37. package/lib/features/ordering/BpmnOrderingProvider.js +3 -1
  38. package/lib/features/replace/BpmnReplace.js +12 -0
  39. package/lib/features/search/index.js +1 -1
  40. package/lib/import/BpmnImporter.js +0 -5
  41. package/lib/util/CompatibilityUtil.js +1 -0
  42. package/package.json +21 -24
  43. package/test/helper/index.js +26 -1
  44. package/.babelrc +0 -3
  45. package/lib/features/distribute-elements/dist/distribute-horizontally-tool.svg +0 -1
  46. package/lib/features/distribute-elements/dist/distribute-vertically-tool.svg +0 -1
@@ -9,7 +9,7 @@ import DrilldownOverlayBehavior from './DrilldownOverlayBehavior';
9
9
 
10
10
  export default {
11
11
  __depends__: [ OverlaysModule, ChangeSupportModule, RootElementsModule ],
12
- __init__: [ 'drilldownBreadcrumbs', 'drilldownOverlayBehavior', 'drilldownCentering', 'subprocessCompatibility'],
12
+ __init__: [ 'drilldownBreadcrumbs', 'drilldownOverlayBehavior', 'drilldownCentering', 'subprocessCompatibility' ],
13
13
  drilldownBreadcrumbs: [ 'type', DrilldownBreadcrumbs ],
14
14
  drilldownCentering: [ 'type', DrilldownCentering ],
15
15
  drilldownOverlayBehavior: [ 'type', DrilldownOverlayBehavior ],
@@ -6,7 +6,7 @@ import { is } from '../../../util/ModelUtil';
6
6
  var HIGH_PRIORITY = 2000;
7
7
 
8
8
 
9
- export default function AutoPlaceBehavior(eventBus, gridSnapping) {
9
+ export default function GridSnappingAutoPlaceBehavior(eventBus, gridSnapping) {
10
10
  eventBus.on('autoPlace', HIGH_PRIORITY, function(context) {
11
11
  var source = context.source,
12
12
  sourceMid = getMid(source),
@@ -47,7 +47,7 @@ export default function AutoPlaceBehavior(eventBus, gridSnapping) {
47
47
  });
48
48
  }
49
49
 
50
- AutoPlaceBehavior.$inject = [
50
+ GridSnappingAutoPlaceBehavior.$inject = [
51
51
  'eventBus',
52
52
  'gridSnapping'
53
53
  ];
@@ -14,7 +14,7 @@ var HIGH_PRIORITY = 3000;
14
14
  /**
15
15
  * Snaps connections with Manhattan layout.
16
16
  */
17
- export default function LayoutConnectionBehavior(eventBus, gridSnapping, modeling) {
17
+ export default function GridSnappingLayoutConnectionBehavior(eventBus, gridSnapping, modeling) {
18
18
  CommandInterceptor.call(this, eventBus);
19
19
 
20
20
  this._gridSnapping = gridSnapping;
@@ -42,13 +42,13 @@ export default function LayoutConnectionBehavior(eventBus, gridSnapping, modelin
42
42
  });
43
43
  }
44
44
 
45
- LayoutConnectionBehavior.$inject = [
45
+ GridSnappingLayoutConnectionBehavior.$inject = [
46
46
  'eventBus',
47
47
  'gridSnapping',
48
48
  'modeling'
49
49
  ];
50
50
 
51
- inherits(LayoutConnectionBehavior, CommandInterceptor);
51
+ inherits(GridSnappingLayoutConnectionBehavior, CommandInterceptor);
52
52
 
53
53
  /**
54
54
  * Snap middle segments of a given connection.
@@ -57,7 +57,7 @@ inherits(LayoutConnectionBehavior, CommandInterceptor);
57
57
  *
58
58
  * @returns {Array<Point>}
59
59
  */
60
- LayoutConnectionBehavior.prototype.snapMiddleSegments = function(waypoints) {
60
+ GridSnappingLayoutConnectionBehavior.prototype.snapMiddleSegments = function(waypoints) {
61
61
  var gridSnapping = this._gridSnapping,
62
62
  snapped;
63
63
 
@@ -3,7 +3,7 @@ import { is } from '../../../util/ModelUtil';
3
3
  var HIGHER_PRIORITY = 1750;
4
4
 
5
5
 
6
- export default function CreateParticipantBehavior(canvas, eventBus, gridSnapping) {
6
+ export default function GridSnappingParticipantBehavior(canvas, eventBus, gridSnapping) {
7
7
  eventBus.on([
8
8
  'create.start',
9
9
  'shape.move.start'
@@ -29,7 +29,7 @@ export default function CreateParticipantBehavior(canvas, eventBus, gridSnapping
29
29
  });
30
30
  }
31
31
 
32
- CreateParticipantBehavior.$inject = [
32
+ GridSnappingParticipantBehavior.$inject = [
33
33
  'canvas',
34
34
  'eventBus',
35
35
  'gridSnapping'
@@ -1,14 +1,14 @@
1
- import AutoPlaceBehavior from './AutoPlaceBehavior';
2
- import CreateParticipantBehavior from './CreateParticipantBehavior';
3
- import LayoutConnectionBehavior from './LayoutConnectionBehavior';
1
+ import GridSnappingAutoPlaceBehavior from './GridSnappingAutoPlaceBehavior';
2
+ import GridSnappingParticipantBehavior from './GridSnappingParticipantBehavior';
3
+ import GridSnappingLayoutConnectionBehavior from './GridSnappingLayoutConnectionBehavior';
4
4
 
5
5
  export default {
6
6
  __init__: [
7
7
  'gridSnappingAutoPlaceBehavior',
8
- 'gridSnappingCreateParticipantBehavior',
8
+ 'gridSnappingParticipantBehavior',
9
9
  'gridSnappingLayoutConnectionBehavior',
10
10
  ],
11
- gridSnappingAutoPlaceBehavior: [ 'type', AutoPlaceBehavior ],
12
- gridSnappingCreateParticipantBehavior: [ 'type', CreateParticipantBehavior ],
13
- gridSnappingLayoutConnectionBehavior: [ 'type', LayoutConnectionBehavior ]
11
+ gridSnappingAutoPlaceBehavior: [ 'type', GridSnappingAutoPlaceBehavior ],
12
+ gridSnappingParticipantBehavior: [ 'type', GridSnappingParticipantBehavior ],
13
+ gridSnappingLayoutConnectionBehavior: [ 'type', GridSnappingLayoutConnectionBehavior ]
14
14
  };
@@ -50,7 +50,7 @@ BpmnKeyboardBindings.prototype.registerBindings = function(keyboard, editorActio
50
50
 
51
51
  var event = context.keyEvent;
52
52
 
53
- if (keyboard.isKey(['a', 'A'], event) && keyboard.isCmd(event)) {
53
+ if (keyboard.isKey([ 'a', 'A' ], event) && keyboard.isCmd(event)) {
54
54
  editorActions.trigger('selectElements');
55
55
 
56
56
  return true;
@@ -63,7 +63,7 @@ BpmnKeyboardBindings.prototype.registerBindings = function(keyboard, editorActio
63
63
 
64
64
  var event = context.keyEvent;
65
65
 
66
- if (keyboard.isKey(['f', 'F'], event) && keyboard.isCmd(event)) {
66
+ if (keyboard.isKey([ 'f', 'F' ], event) && keyboard.isCmd(event)) {
67
67
  editorActions.trigger('find');
68
68
 
69
69
  return true;
@@ -80,7 +80,7 @@ BpmnKeyboardBindings.prototype.registerBindings = function(keyboard, editorActio
80
80
  return;
81
81
  }
82
82
 
83
- if (keyboard.isKey(['s', 'S'], event)) {
83
+ if (keyboard.isKey([ 's', 'S' ], event)) {
84
84
  editorActions.trigger('spaceTool');
85
85
 
86
86
  return true;
@@ -97,7 +97,7 @@ BpmnKeyboardBindings.prototype.registerBindings = function(keyboard, editorActio
97
97
  return;
98
98
  }
99
99
 
100
- if (keyboard.isKey(['l', 'L'], event)) {
100
+ if (keyboard.isKey([ 'l', 'L' ], event)) {
101
101
  editorActions.trigger('lassoTool');
102
102
 
103
103
  return true;
@@ -114,7 +114,7 @@ BpmnKeyboardBindings.prototype.registerBindings = function(keyboard, editorActio
114
114
  return;
115
115
  }
116
116
 
117
- if (keyboard.isKey(['h', 'H'], event)) {
117
+ if (keyboard.isKey([ 'h', 'H' ], event)) {
118
118
  editorActions.trigger('handTool');
119
119
 
120
120
  return true;
@@ -131,7 +131,7 @@ BpmnKeyboardBindings.prototype.registerBindings = function(keyboard, editorActio
131
131
  return;
132
132
  }
133
133
 
134
- if (keyboard.isKey(['c', 'C'], event)) {
134
+ if (keyboard.isKey([ 'c', 'C' ], event)) {
135
135
  editorActions.trigger('globalConnectTool');
136
136
 
137
137
  return true;
@@ -148,7 +148,7 @@ BpmnKeyboardBindings.prototype.registerBindings = function(keyboard, editorActio
148
148
  return;
149
149
  }
150
150
 
151
- if (keyboard.isKey(['e', 'E'], event)) {
151
+ if (keyboard.isKey([ 'e', 'E' ], event)) {
152
152
  editorActions.trigger('directEditing');
153
153
 
154
154
  return true;
@@ -7,14 +7,9 @@ import {
7
7
  } from './LabelUtil';
8
8
 
9
9
  import {
10
- getBusinessObject,
11
10
  is
12
11
  } from '../../util/ModelUtil';
13
12
 
14
- import {
15
- createCategoryValue
16
- } from '../modeling/behavior/util/CategoryUtil';
17
-
18
13
  import { isAny } from '../modeling/util/ModelingUtil';
19
14
  import { isExpanded } from '../../util/DiUtil';
20
15
 
@@ -267,7 +262,7 @@ LabelEditingProvider.prototype.getEditingBBox = function(element) {
267
262
 
268
263
  // internal labels for tasks and collapsed call activities,
269
264
  // sub processes and participants
270
- if (isAny(element, [ 'bpmn:Task', 'bpmn:CallActivity']) ||
265
+ if (isAny(element, [ 'bpmn:Task', 'bpmn:CallActivity' ]) ||
271
266
  isCollapsedPool(element) ||
272
267
  isCollapsedSubProcess(element)) {
273
268
 
@@ -399,23 +394,6 @@ LabelEditingProvider.prototype.update = function(
399
394
  };
400
395
  }
401
396
 
402
- if (is(element, 'bpmn:Group')) {
403
-
404
- var businessObject = getBusinessObject(element);
405
-
406
- // initialize categoryValue if not existing
407
- if (!businessObject.categoryValueRef) {
408
-
409
- var rootElement = this._canvas.getRootElement(),
410
- definitions = getBusinessObject(rootElement).$parent;
411
-
412
- var categoryValue = createCategoryValue(definitions, this._bpmnFactory);
413
-
414
- getBusinessObject(element).categoryValueRef = categoryValue;
415
- }
416
-
417
- }
418
-
419
397
  if (isEmptyText(newLabel)) {
420
398
  newLabel = null;
421
399
  }
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  assign,
3
3
  forEach,
4
- isObject
4
+ isObject,
5
+ omit
5
6
  } from 'min-dash';
6
7
 
7
8
  import inherits from 'inherits-browser';
@@ -69,7 +70,7 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
69
70
  var size,
70
71
  translate = this._translate;
71
72
 
72
- attrs = attrs || {};
73
+ attrs = assign({}, attrs || {});
73
74
 
74
75
  var businessObject = attrs.businessObject,
75
76
  di = attrs.di;
@@ -86,6 +87,7 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
86
87
 
87
88
  if (!isModdleDi(di)) {
88
89
  var diAttrs = assign(
90
+ {},
89
91
  di || {},
90
92
  { id: businessObject.id + '_di' }
91
93
  );
@@ -106,7 +108,7 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
106
108
  }, attrs);
107
109
  }
108
110
 
109
- applyAttributes(businessObject, attrs, [
111
+ attrs = applyAttributes(businessObject, attrs, [
110
112
  'processRef',
111
113
  'isInterrupting',
112
114
  'associationDirection',
@@ -114,7 +116,7 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
114
116
  ]);
115
117
 
116
118
  if (attrs.isExpanded) {
117
- applyAttribute(di, attrs, 'isExpanded');
119
+ attrs = applyAttribute(di, attrs, 'isExpanded');
118
120
  }
119
121
 
120
122
  if (is(businessObject, 'bpmn:SubProcess')) {
@@ -247,14 +249,16 @@ ElementFactory.prototype.createParticipantShape = function(attrs) {
247
249
  * @param {Base} element
248
250
  * @param {Object} attrs (in/out map of attributes)
249
251
  * @param {Array<string>} attributeNames name of attributes to apply
252
+ *
253
+ * @return {Object} changed attrs
250
254
  */
251
255
  function applyAttributes(element, attrs, attributeNames) {
252
256
 
253
257
  forEach(attributeNames, function(property) {
254
- if (attrs[property] !== undefined) {
255
- applyAttribute(element, attrs, property);
256
- }
258
+ attrs = applyAttribute(element, attrs, property);
257
259
  });
260
+
261
+ return attrs;
258
262
  }
259
263
 
260
264
  /**
@@ -264,11 +268,17 @@ function applyAttributes(element, attrs, attributeNames) {
264
268
  * @param {Base} element
265
269
  * @param {Object} attrs (in/out map of attributes)
266
270
  * @param {string} attributeName to apply
271
+ *
272
+ * @return {Object} changed attrs
267
273
  */
268
274
  function applyAttribute(element, attrs, attributeName) {
275
+ if (attrs[attributeName] === undefined) {
276
+ return attrs;
277
+ }
278
+
269
279
  element[attributeName] = attrs[attributeName];
270
280
 
271
- delete attrs[attributeName];
281
+ return omit(attrs, [ attributeName ]);
272
282
  }
273
283
 
274
284
 
@@ -9,13 +9,11 @@ import {
9
9
  forEach
10
10
  } from 'min-dash';
11
11
 
12
- var HIGH_PRIORITY = 2000;
13
-
14
12
 
15
13
  /**
16
14
  * BPMN specific boundary event behavior
17
15
  */
18
- export default function BoundaryEventBehavior(eventBus, moddle, modeling) {
16
+ export default function BoundaryEventBehavior(eventBus, modeling) {
19
17
 
20
18
  CommandInterceptor.call(this, eventBus);
21
19
 
@@ -60,23 +58,10 @@ export default function BoundaryEventBehavior(eventBus, moddle, modeling) {
60
58
  }
61
59
  });
62
60
 
63
- // copy reference to root element on replace
64
- eventBus.on('moddleCopy.canCopyProperty', HIGH_PRIORITY, function(context) {
65
- var parent = context.parent,
66
- property = context.property,
67
- propertyName = context.propertyName;
68
-
69
- var propertyDescriptor = moddle.getPropertyDescriptor(parent, propertyName);
70
-
71
- if (propertyDescriptor && propertyDescriptor.isReference && is(property, 'bpmn:RootElement')) {
72
- parent.set(propertyName, property);
73
- }
74
- });
75
61
  }
76
62
 
77
63
  BoundaryEventBehavior.$inject = [
78
64
  'eventBus',
79
- 'moddle',
80
65
  'modeling'
81
66
  ];
82
67
 
@@ -59,7 +59,7 @@ export default function DropOnFlowBehavior(eventBus, bpmnRules, modeling) {
59
59
  dockingPoint = intersection.bendpoint ? waypoints[intersection.index] : mid;
60
60
 
61
61
  // if last waypointBefore is inside shape's bounds, ignore docking point
62
- if (waypointsBefore.length === 1 || !isPointInsideBBox(shape, waypointsBefore[waypointsBefore.length-1])) {
62
+ if (waypointsBefore.length === 1 || !isPointInsideBBox(shape, waypointsBefore[waypointsBefore.length - 1])) {
63
63
  waypointsBefore.push(copy(dockingPoint));
64
64
  }
65
65