bpmn-js 8.9.0 → 9.0.0-alpha.2

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 (55) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/assets/bpmn-js.css +113 -0
  3. package/dist/bpmn-modeler.development.js +2600 -991
  4. package/dist/bpmn-modeler.production.min.js +9 -8
  5. package/dist/bpmn-navigated-viewer.development.js +21240 -19985
  6. package/dist/bpmn-navigated-viewer.production.min.js +22 -20
  7. package/dist/bpmn-viewer.development.js +20441 -19186
  8. package/dist/bpmn-viewer.production.min.js +22 -20
  9. package/lib/BaseViewer.js +1 -14
  10. package/lib/Viewer.js +3 -1
  11. package/lib/draw/BpmnRenderUtil.js +6 -4
  12. package/lib/features/auto-resize/BpmnAutoResizeProvider.js +6 -0
  13. package/lib/features/context-pad/ContextPadProvider.js +1 -1
  14. package/lib/features/copy-paste/BpmnCopyPaste.js +14 -13
  15. package/lib/features/di-ordering/BpmnDiOrdering.js +16 -13
  16. package/lib/features/drilldown/DrilldownBreadcrumbs.js +122 -0
  17. package/lib/features/drilldown/DrilldownCentering.js +118 -0
  18. package/lib/features/drilldown/DrilldownOverlayBehavior.js +181 -0
  19. package/lib/features/drilldown/SubprocessCompatibility.js +196 -0
  20. package/lib/features/drilldown/index.js +17 -0
  21. package/lib/features/label-editing/LabelEditingPreview.js +3 -3
  22. package/lib/features/label-editing/cmd/UpdateLabelHandler.js +31 -3
  23. package/lib/features/modeling/BpmnFactory.js +11 -8
  24. package/lib/features/modeling/BpmnUpdater.js +35 -27
  25. package/lib/features/modeling/ElementFactory.js +64 -37
  26. package/lib/features/modeling/behavior/CreateParticipantBehavior.js +59 -84
  27. package/lib/features/modeling/behavior/DataStoreBehavior.js +3 -1
  28. package/lib/features/modeling/behavior/IsHorizontalFix.js +7 -4
  29. package/lib/features/modeling/behavior/LabelBehavior.js +8 -7
  30. package/lib/features/modeling/behavior/SubProcessPlaneBehavior.js +550 -0
  31. package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.js +74 -0
  32. package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js +6 -6
  33. package/lib/features/modeling/behavior/UnclaimIdBehavior.js +3 -1
  34. package/lib/features/modeling/behavior/index.js +6 -0
  35. package/lib/features/modeling/cmd/SetColorHandler.js +4 -1
  36. package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +12 -8
  37. package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +19 -12
  38. package/lib/features/modeling/cmd/UpdateSemanticParentHandler.js +5 -3
  39. package/lib/features/modeling/util/ModelingUtil.js +2 -20
  40. package/lib/features/ordering/BpmnOrderingProvider.js +1 -1
  41. package/lib/features/palette/PaletteProvider.js +3 -1
  42. package/lib/features/popup-menu/ReplaceMenuProvider.js +6 -6
  43. package/lib/features/popup-menu/util/TypeUtil.js +1 -1
  44. package/lib/features/replace/BpmnReplace.js +29 -29
  45. package/lib/import/BpmnImporter.js +33 -22
  46. package/lib/import/BpmnTreeWalker.js +19 -17
  47. package/lib/import/Importer.js +137 -6
  48. package/lib/util/CompatibilityUtil.js +21 -1
  49. package/lib/util/DiUtil.js +10 -3
  50. package/lib/util/DrilldownUtil.js +66 -0
  51. package/lib/util/LabelUtil.js +2 -3
  52. package/lib/util/ModelUtil.js +30 -0
  53. package/package.json +2 -2
  54. package/test/matchers/BoundsMatchers.js +10 -10
  55. package/test/matchers/ConnectionMatchers.js +5 -5
@@ -0,0 +1,550 @@
1
+ import inherits from 'inherits';
2
+
3
+ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
4
+
5
+ import { find } from 'min-dash';
6
+ import { isExpanded } from '../../../util/DiUtil';
7
+ import { getBusinessObject, getDi, is } from '../../../util/ModelUtil';
8
+ import { getMid } from 'diagram-js/lib/layout/LayoutUtil';
9
+ import { getBBox } from 'diagram-js/lib/util/Elements';
10
+ import {
11
+ getPlaneIdFromShape,
12
+ getShapeIdFromPlane,
13
+ isPlane,
14
+ toPlaneId
15
+ } from '../../../util/DrilldownUtil';
16
+
17
+
18
+ var LOW_PRIORITY = 400;
19
+ var HIGH_PRIORITY = 600;
20
+
21
+ var DEFAULT_POSITION = {
22
+ x: 180,
23
+ y: 160
24
+ };
25
+
26
+
27
+ /**
28
+ * Creates bpmndi:BPMNPlane elements and canvas planes when collapsed subprocesses are created.
29
+ *
30
+ *
31
+ * @param {Canvas} canvas
32
+ * @param {EventBus} eventBus
33
+ * @param {Modeling} modeling
34
+ * @param {ElementFactory} elementFactory
35
+ * @param {BpmnFactory} bpmnFactory
36
+ * @param {Bpmnjs} bpmnjs
37
+ * @param {ElementRegistry} elementRegistry
38
+ */
39
+ export default function SubProcessPlaneBehavior(
40
+ canvas, eventBus, modeling,
41
+ elementFactory, bpmnFactory, bpmnjs, elementRegistry) {
42
+
43
+ CommandInterceptor.call(this, eventBus);
44
+
45
+ this._canvas = canvas;
46
+ this._eventBus = eventBus;
47
+ this._modeling = modeling;
48
+ this._elementFactory = elementFactory;
49
+ this._bpmnFactory = bpmnFactory;
50
+ this._bpmnjs = bpmnjs;
51
+ this._elementRegistry = elementRegistry;
52
+
53
+ var self = this;
54
+
55
+ function isCollapsedSubProcess(element) {
56
+ return is(element, 'bpmn:SubProcess') && !isExpanded(element);
57
+ }
58
+
59
+ function createRoot(context) {
60
+ var shape = context.shape,
61
+ rootElement = context.newRootElement;
62
+
63
+ var businessObject = getBusinessObject(shape);
64
+
65
+ rootElement = self._addDiagram(rootElement || businessObject);
66
+
67
+ context.newRootElement = canvas.addRootElement(rootElement);
68
+ }
69
+
70
+ function removeRoot(context) {
71
+ var shape = context.shape;
72
+
73
+ var businessObject = getBusinessObject(shape);
74
+ self._removeDiagram(businessObject);
75
+
76
+ var rootElement = context.newRootElement = elementRegistry.get(getPlaneIdFromShape(businessObject));
77
+
78
+ canvas.removeRootElement(rootElement);
79
+ }
80
+
81
+ // add plane elements for newly created sub-processes
82
+ // this ensures we can actually drill down into the element
83
+ this.executed('shape.create', function(context) {
84
+ var shape = context.shape;
85
+ if (!isCollapsedSubProcess(shape)) {
86
+ return;
87
+ }
88
+
89
+ createRoot(context);
90
+ }, true);
91
+
92
+
93
+ this.postExecuted('shape.create', function(context) {
94
+ var shape = context.shape,
95
+ rootElement = context.newRootElement;
96
+
97
+ if (!rootElement || !shape.children) {
98
+ return;
99
+ }
100
+
101
+ self._showRecursively(shape.children);
102
+
103
+ self._moveChildrenToShape(shape, rootElement);
104
+ }, true);
105
+
106
+
107
+ this.reverted('shape.create', function(context) {
108
+ var shape = context.shape;
109
+ if (!isCollapsedSubProcess(shape)) {
110
+ return;
111
+ }
112
+
113
+ removeRoot(context);
114
+ }, true);
115
+
116
+
117
+ this.preExecuted('shape.delete', function(context) {
118
+ var shape = context.shape;
119
+ if (!isCollapsedSubProcess(shape)) {
120
+ return;
121
+ }
122
+
123
+ var attachedRoot = elementRegistry.get(getPlaneIdFromShape(shape));
124
+
125
+ if (!attachedRoot) {
126
+ return;
127
+ }
128
+
129
+ modeling.removeElements(attachedRoot.children.slice());
130
+ }, true);
131
+
132
+
133
+ this.executed('shape.delete', function(context) {
134
+ var shape = context.shape;
135
+ if (!isCollapsedSubProcess(shape)) {
136
+ return;
137
+ }
138
+ removeRoot(context);
139
+ }, true);
140
+
141
+
142
+ this.reverted('shape.delete', function(context) {
143
+ var shape = context.shape;
144
+ if (!isCollapsedSubProcess(shape)) {
145
+ return;
146
+ }
147
+
148
+ createRoot(context);
149
+ }, true);
150
+
151
+
152
+ this.preExecuted('shape.replace', function(context) {
153
+ var oldShape = context.oldShape;
154
+ var newShape = context.newShape;
155
+
156
+ if (!isCollapsedSubProcess(oldShape) || !isCollapsedSubProcess(newShape)) {
157
+ return;
158
+ }
159
+
160
+ // old plane could have content,
161
+ // we remove it so it is not recursively deleted from 'shape.delete'
162
+ context.oldRoot = canvas.removeRootElement(getPlaneIdFromShape(oldShape));
163
+ }, true);
164
+
165
+
166
+ this.postExecuted('shape.replace', function(context) {
167
+ var newShape = context.newShape,
168
+ source = context.oldRoot,
169
+ target = canvas.findRoot(getPlaneIdFromShape(newShape));
170
+
171
+ if (!source || !target) {
172
+ return;
173
+ }
174
+ var elements = source.children;
175
+
176
+ modeling.moveElements(elements, { x: 0, y: 0 }, target);
177
+ }, true);
178
+
179
+
180
+ // rename primary elements when the secondary element changes
181
+ // this ensures rootElement.id = element.id + '_plane'
182
+ this.executed('element.updateProperties', function(context) {
183
+ var shape = context.element;
184
+
185
+ if (!is(shape, 'bpmn:SubProcess')) {
186
+ return;
187
+ }
188
+
189
+ var properties = context.properties;
190
+ var oldProperties = context.oldProperties;
191
+
192
+ var oldId = oldProperties.id,
193
+ newId = properties.id;
194
+
195
+ if (oldId === newId) {
196
+ return;
197
+ }
198
+
199
+ if (isPlane(shape)) {
200
+ elementRegistry.updateId(shape, toPlaneId(newId));
201
+ elementRegistry.updateId(oldId, newId);
202
+
203
+ return;
204
+ }
205
+
206
+ var planeElement = elementRegistry.get(toPlaneId(oldId));
207
+
208
+ if (!planeElement) {
209
+ return;
210
+ }
211
+
212
+ elementRegistry.updateId(toPlaneId(oldId), toPlaneId(newId));
213
+ }, true);
214
+
215
+
216
+ this.reverted('element.updateProperties', function(context) {
217
+ var shape = context.element;
218
+
219
+ if (!isCollapsedSubProcess(shape)) {
220
+ return;
221
+ }
222
+
223
+ var properties = context.properties;
224
+ var oldProperties = context.oldProperties;
225
+
226
+ var oldId = oldProperties.id,
227
+ newId = properties.id;
228
+
229
+ if (oldId === newId) {
230
+ return;
231
+ }
232
+
233
+ var planeElement = elementRegistry.get(toPlaneId(newId));
234
+
235
+ if (!planeElement) {
236
+ return;
237
+ }
238
+
239
+ elementRegistry.updateId(planeElement, toPlaneId(oldId));
240
+ }, true);
241
+
242
+ // re-throw element.changed to re-render primary shape if associated plane has
243
+ // changed (e.g. bpmn:name property has changed)
244
+ eventBus.on('element.changed', function(context) {
245
+ var element = context.element;
246
+
247
+ if (!isPlane(element)) {
248
+ return;
249
+ }
250
+
251
+ var plane = element;
252
+
253
+ var primaryShape = elementRegistry.get(getShapeIdFromPlane(plane));
254
+
255
+ // do not re-throw if no associated primary shape (e.g. bpmn:Process)
256
+ if (!primaryShape || primaryShape === plane) {
257
+ return;
258
+ }
259
+
260
+ eventBus.fire('element.changed', { element: primaryShape });
261
+ });
262
+
263
+
264
+ // create/remove plane for the subprocess
265
+ this.executed('shape.toggleCollapse', LOW_PRIORITY, function(context) {
266
+ var shape = context.shape;
267
+
268
+ if (!is(shape, 'bpmn:SubProcess')) {
269
+ return;
270
+ }
271
+
272
+ if (!isExpanded(shape)) {
273
+ createRoot(context);
274
+ self._showRecursively(shape.children);
275
+ } else {
276
+ removeRoot(context);
277
+ }
278
+
279
+ }, true);
280
+
281
+
282
+ // create/remove plane for the subprocess
283
+ this.reverted('shape.toggleCollapse', LOW_PRIORITY, function(context) {
284
+ var shape = context.shape;
285
+
286
+ if (!is(shape, 'bpmn:SubProcess')) {
287
+ return;
288
+ }
289
+
290
+ if (!isExpanded(shape)) {
291
+ createRoot(context);
292
+ self._showRecursively(shape.children);
293
+ } else {
294
+ removeRoot(context);
295
+ }
296
+
297
+ }, true);
298
+
299
+ // move elements between planes
300
+ this.postExecuted('shape.toggleCollapse', HIGH_PRIORITY, function(context) {
301
+ var shape = context.shape;
302
+
303
+ if (!is(shape, 'bpmn:SubProcess')) {
304
+ return;
305
+ }
306
+
307
+ var rootElement = context.newRootElement;
308
+
309
+ if (!rootElement) {
310
+ return;
311
+ }
312
+
313
+ if (!isExpanded(shape)) {
314
+
315
+ // collapsed
316
+ self._moveChildrenToShape(shape, rootElement);
317
+
318
+ } else {
319
+ self._moveChildrenToShape(rootElement, shape);
320
+ }
321
+ }, true);
322
+
323
+
324
+ // copy-paste ///////////
325
+
326
+ // add elements in plane to tree
327
+ eventBus.on('copyPaste.createTree', function(context) {
328
+ var element = context.element,
329
+ children = context.children;
330
+
331
+ if (!isCollapsedSubProcess(element)) {
332
+ return;
333
+ }
334
+
335
+ var id = getPlaneIdFromShape(element);
336
+ var parent = elementRegistry.get(id);
337
+
338
+ if (parent) {
339
+
340
+ // do not copy invisible root element
341
+ children.push.apply(children, parent.children);
342
+ }
343
+ });
344
+
345
+ // set plane children as direct children of collapsed shape
346
+ eventBus.on('copyPaste.copyElement', function(context) {
347
+ var descriptor = context.descriptor,
348
+ element = context.element,
349
+ elements = context.elements;
350
+
351
+ var parent = element.parent;
352
+
353
+ var isPlane = is(getDi(parent), 'bpmndi:BPMNPlane');
354
+ if (!isPlane) {
355
+ return;
356
+ }
357
+
358
+ var parentId = getShapeIdFromPlane(parent);
359
+
360
+ var referencedShape = find(elements, function(element) {
361
+ return element.id === parentId;
362
+ });
363
+
364
+ if (!referencedShape) {
365
+ return;
366
+ }
367
+
368
+ descriptor.parent = referencedShape.id;
369
+ });
370
+
371
+ // hide children during pasting
372
+ eventBus.on('copyPaste.pasteElement', function(context) {
373
+ var descriptor = context.descriptor;
374
+
375
+ if (!descriptor.parent) {
376
+ return;
377
+ }
378
+
379
+ if (isCollapsedSubProcess(descriptor.parent) || descriptor.parent.hidden) {
380
+ descriptor.hidden = true;
381
+ }
382
+ });
383
+
384
+ }
385
+
386
+ inherits(SubProcessPlaneBehavior, CommandInterceptor);
387
+
388
+ /**
389
+ * Moves the child elements from source to target.
390
+ *
391
+ * If the target is a plane, the children are moved to the top left corner.
392
+ * Otherwise, the center of the target is used.
393
+ *
394
+ * @param {Object|djs.model.Base} source
395
+ * @param {Object|djs.model.Base} target
396
+ */
397
+ SubProcessPlaneBehavior.prototype._moveChildrenToShape = function(source, target) {
398
+ var modeling = this._modeling;
399
+
400
+ var children = source.children;
401
+ var offset;
402
+
403
+ if (!children) {
404
+ return;
405
+ }
406
+
407
+ // only change plane if there are no visible children, but don't move them
408
+ var visibleChildren = children.filter(function(child) {
409
+ return !child.hidden;
410
+ });
411
+
412
+ if (!visibleChildren.length) {
413
+ modeling.moveElements(children, { x: 0, y: 0 }, target, { autoResize: false });
414
+ return;
415
+ }
416
+
417
+ var childrenBounds = getBBox(visibleChildren);
418
+
419
+ // target is a plane
420
+ if (!target.x) {
421
+ offset = {
422
+ x: DEFAULT_POSITION.x - childrenBounds.x,
423
+ y: DEFAULT_POSITION.y - childrenBounds.y
424
+ };
425
+ }
426
+
427
+ // source is a plane
428
+ else {
429
+
430
+ // move relative to the center of the shape
431
+ var targetMid = getMid(target);
432
+ var childrenMid = getMid(childrenBounds);
433
+
434
+ offset = {
435
+ x: targetMid.x - childrenMid.x,
436
+ y: targetMid.y - childrenMid.y
437
+ };
438
+ }
439
+
440
+ modeling.moveElements(children, offset, target, { autoResize: false });
441
+ };
442
+
443
+ /**
444
+ * Sets `hidden` property on all children of the given shape.
445
+ *
446
+ * @param {Array} elements
447
+ * @param {Boolean} [hidden]
448
+ * @returns {Array} all child elements
449
+ */
450
+ SubProcessPlaneBehavior.prototype._showRecursively = function(elements, hidden) {
451
+ var self = this;
452
+
453
+ var result = [];
454
+ elements.forEach(function(element) {
455
+ element.hidden = !!hidden;
456
+
457
+ result = result.concat(element);
458
+
459
+ if (element.children) {
460
+ result = result.concat(
461
+ self._showRecursively(element.children, element.collapsed || hidden)
462
+ );
463
+ }
464
+ });
465
+
466
+ return result;
467
+ };
468
+
469
+ /**
470
+ * Adds a given rootElement to the bpmnDi diagrams.
471
+ *
472
+ * @param {Object} rootElement
473
+ * @returns {Object} planeElement
474
+ */
475
+ SubProcessPlaneBehavior.prototype._addDiagram = function(planeElement) {
476
+ var bpmnjs = this._bpmnjs;
477
+ var diagrams = bpmnjs.getDefinitions().diagrams;
478
+
479
+ if (!planeElement.businessObject) {
480
+ planeElement = this._createNewDiagram(planeElement);
481
+ }
482
+
483
+ diagrams.push(planeElement.di.$parent);
484
+
485
+ return planeElement;
486
+ };
487
+
488
+
489
+ /**
490
+ * Creates a new plane element for the given sub process.
491
+ *
492
+ * @param {Object} bpmnElement
493
+ *
494
+ * @return {Object} new diagram element
495
+ */
496
+ SubProcessPlaneBehavior.prototype._createNewDiagram = function(bpmnElement) {
497
+ var bpmnFactory = this._bpmnFactory;
498
+ var elementFactory = this._elementFactory;
499
+
500
+ var diPlane = bpmnFactory.create('bpmndi:BPMNPlane', {
501
+ bpmnElement: bpmnElement
502
+ });
503
+ var diDiagram = bpmnFactory.create('bpmndi:BPMNDiagram', {
504
+ plane: diPlane
505
+ });
506
+ diPlane.$parent = diDiagram;
507
+
508
+ // add a virtual element (not being drawn),
509
+ // a copy cat of our BpmnImporter code
510
+ var planeElement = elementFactory.createRoot({
511
+ id: getPlaneIdFromShape(bpmnElement),
512
+ type: bpmnElement.$type,
513
+ di: diPlane,
514
+ businessObject: bpmnElement,
515
+ collapsed: true
516
+ });
517
+
518
+ return planeElement;
519
+ };
520
+
521
+ /**
522
+ * Removes the diagram for a given root element
523
+ *
524
+ * @param {Object} rootElement
525
+ * @returns {Object} removed bpmndi:BPMNDiagram
526
+ */
527
+ SubProcessPlaneBehavior.prototype._removeDiagram = function(rootElement) {
528
+ var bpmnjs = this._bpmnjs;
529
+
530
+ var diagrams = bpmnjs.getDefinitions().diagrams;
531
+
532
+ var removedDiagram = find(diagrams, function(diagram) {
533
+ return diagram.plane.bpmnElement.id === rootElement.id;
534
+ });
535
+
536
+ diagrams.splice(diagrams.indexOf(removedDiagram), 1);
537
+
538
+ return removedDiagram;
539
+ };
540
+
541
+
542
+ SubProcessPlaneBehavior.$inject = [
543
+ 'canvas',
544
+ 'eventBus',
545
+ 'modeling',
546
+ 'elementFactory',
547
+ 'bpmnFactory',
548
+ 'bpmnjs',
549
+ 'elementRegistry'
550
+ ];
@@ -0,0 +1,74 @@
1
+
2
+ import inherits from 'inherits';
3
+
4
+ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
5
+
6
+ import {
7
+ forEach
8
+ } from 'min-dash';
9
+
10
+ import { getMid } from 'diagram-js/lib/layout/LayoutUtil';
11
+ import { selfAndAllChildren } from 'diagram-js/lib/util/Elements';
12
+
13
+ import { isExpanded } from '../../../util/DiUtil';
14
+
15
+
16
+ export default function ToggleCollapseConnectionBehaviour(
17
+ eventBus, modeling
18
+ ) {
19
+
20
+ CommandInterceptor.call(this, eventBus);
21
+
22
+ this.postExecuted('shape.toggleCollapse', 1500, function(context) {
23
+
24
+ // var shape = context.shape;
25
+ var shape = context.shape;
26
+
27
+ // only change connections when collapsing
28
+ if (isExpanded(shape)) {
29
+ return;
30
+ }
31
+
32
+ var allChildren = selfAndAllChildren(shape);
33
+
34
+ allChildren.forEach(function(child) {
35
+
36
+ // Ensure that the connection array is not modified during iteration
37
+ var incomingConnections = child.incoming.slice(),
38
+ outgoingConnections = child.outgoing.slice();
39
+
40
+ forEach(incomingConnections, function(c) {
41
+ handleConnection(c, true);
42
+ });
43
+
44
+ forEach(outgoingConnections, function(c) {
45
+ handleConnection(c, false);
46
+ });
47
+ });
48
+
49
+
50
+ function handleConnection(c, incoming) {
51
+ if (allChildren.includes(c.source) && allChildren.includes(c.target)) {
52
+ return;
53
+ }
54
+
55
+ if (incoming) {
56
+ modeling.reconnectEnd(c, shape, getMid(shape));
57
+ } else {
58
+ modeling.reconnectStart(c, shape, getMid(shape));
59
+ }
60
+
61
+ }
62
+
63
+ }, true);
64
+
65
+ }
66
+
67
+ inherits(ToggleCollapseConnectionBehaviour, CommandInterceptor);
68
+
69
+ ToggleCollapseConnectionBehaviour.$inject = [
70
+ 'eventBus',
71
+ 'modeling',
72
+ ];
73
+
74
+
@@ -3,7 +3,7 @@ import inherits from 'inherits';
3
3
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
4
4
 
5
5
  import {
6
- getBusinessObject,
6
+ getDi,
7
7
  is
8
8
  } from '../../../util/ModelUtil';
9
9
 
@@ -85,11 +85,11 @@ export default function ToggleElementCollapseBehaviour(
85
85
  hideEmptyLabels(shape.children);
86
86
 
87
87
  // remove collapsed marker
88
- getBusinessObject(shape).di.isExpanded = true;
88
+ getDi(shape).isExpanded = true;
89
89
  } else {
90
90
 
91
91
  // place collapsed marker
92
- getBusinessObject(shape).di.isExpanded = false;
92
+ getDi(shape).isExpanded = false;
93
93
  }
94
94
  });
95
95
 
@@ -101,16 +101,16 @@ export default function ToggleElementCollapseBehaviour(
101
101
 
102
102
  // revert removing/placing collapsed marker
103
103
  if (!shape.collapsed) {
104
- getBusinessObject(shape).di.isExpanded = true;
104
+ getDi(shape).isExpanded = true;
105
105
 
106
106
  } else {
107
- getBusinessObject(shape).di.isExpanded = false;
107
+ getDi(shape).isExpanded = false;
108
108
  }
109
109
  });
110
110
 
111
111
  this.postExecuted([ 'shape.toggleCollapse' ], LOW_PRIORITY, function(e) {
112
112
  var shape = e.context.shape,
113
- defaultSize = elementFactory._getDefaultSize(shape),
113
+ defaultSize = elementFactory.getDefaultSize(shape),
114
114
  newBounds;
115
115
 
116
116
  if (shape.collapsed) {
@@ -47,7 +47,9 @@ export default function UnclaimIdBehavior(canvas, injector, moddle, modeling) {
47
47
  var rootElement = canvas.getRootElement(),
48
48
  rootElementBo = rootElement.businessObject;
49
49
 
50
- moddle.ids.unclaim(rootElementBo.id);
50
+ if (is(rootElement, 'bpmn:Collaboration')) {
51
+ moddle.ids.unclaim(rootElementBo.id);
52
+ }
51
53
  });
52
54
  }
53
55
 
@@ -28,6 +28,8 @@ import ResizeLaneBehavior from './ResizeLaneBehavior';
28
28
  import RemoveElementBehavior from './RemoveElementBehavior';
29
29
  import SpaceToolBehavior from './SpaceToolBehavior';
30
30
  import SubProcessStartEventBehavior from './SubProcessStartEventBehavior';
31
+ import SubProcessPlaneBehavior from './SubProcessPlaneBehavior';
32
+ import ToggleCollapseConnectionBehaviour from './ToggleCollapseConnectionBehaviour';
31
33
  import ToggleElementCollapseBehaviour from './ToggleElementCollapseBehaviour';
32
34
  import UnclaimIdBehavior from './UnclaimIdBehavior';
33
35
  import UpdateFlowNodeRefsBehavior from './UpdateFlowNodeRefsBehavior';
@@ -63,9 +65,11 @@ export default {
63
65
  'replaceElementBehaviour',
64
66
  'resizeBehavior',
65
67
  'resizeLaneBehavior',
68
+ 'toggleCollapseConnectionBehaviour',
66
69
  'toggleElementCollapseBehaviour',
67
70
  'spaceToolBehavior',
68
71
  'subProcessStartEventBehavior',
72
+ 'subProcessPlaneBehavior',
69
73
  'unclaimIdBehavior',
70
74
  'unsetDefaultFlowBehavior',
71
75
  'updateFlowNodeRefsBehavior'
@@ -98,9 +102,11 @@ export default {
98
102
  resizeBehavior: [ 'type', ResizeBehavior ],
99
103
  resizeLaneBehavior: [ 'type', ResizeLaneBehavior ],
100
104
  removeElementBehavior: [ 'type', RemoveElementBehavior ],
105
+ toggleCollapseConnectionBehaviour: [ 'type', ToggleCollapseConnectionBehaviour ],
101
106
  toggleElementCollapseBehaviour : [ 'type', ToggleElementCollapseBehaviour ],
102
107
  spaceToolBehavior: [ 'type', SpaceToolBehavior ],
103
108
  subProcessStartEventBehavior: [ 'type', SubProcessStartEventBehavior ],
109
+ subProcessPlaneBehavior: [ 'type', SubProcessPlaneBehavior ],
104
110
  unclaimIdBehavior: [ 'type', UnclaimIdBehavior ],
105
111
  updateFlowNodeRefsBehavior: [ 'type', UpdateFlowNodeRefsBehavior ],
106
112
  unsetDefaultFlowBehavior: [ 'type', UnsetDefaultFlowBehavior ]