bpmn-js 8.8.0 → 9.0.0-subprocesses.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 (53) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/assets/bpmn-js.css +58 -0
  3. package/dist/assets/diagram-js.css +1 -0
  4. package/dist/bpmn-modeler.development.js +1489 -827
  5. package/dist/bpmn-modeler.production.min.js +7 -6
  6. package/dist/bpmn-navigated-viewer.development.js +20890 -19973
  7. package/dist/bpmn-navigated-viewer.production.min.js +22 -20
  8. package/dist/bpmn-viewer.development.js +20091 -19174
  9. package/dist/bpmn-viewer.production.min.js +22 -20
  10. package/lib/BaseViewer.js +0 -13
  11. package/lib/Viewer.js +3 -1
  12. package/lib/draw/BpmnRenderUtil.js +6 -4
  13. package/lib/draw/BpmnRenderer.js +367 -296
  14. package/lib/features/context-pad/ContextPadProvider.js +1 -1
  15. package/lib/features/copy-paste/BpmnCopyPaste.js +13 -13
  16. package/lib/features/copy-paste/ModdleCopy.js +19 -2
  17. package/lib/features/di-ordering/BpmnDiOrdering.js +2 -3
  18. package/lib/features/label-editing/LabelEditingPreview.js +3 -3
  19. package/lib/features/label-editing/cmd/UpdateLabelHandler.js +2 -1
  20. package/lib/features/modeling/BpmnFactory.js +8 -8
  21. package/lib/features/modeling/BpmnUpdater.js +35 -27
  22. package/lib/features/modeling/ElementFactory.js +60 -37
  23. package/lib/features/modeling/behavior/DataStoreBehavior.js +3 -1
  24. package/lib/features/modeling/behavior/IsHorizontalFix.js +7 -4
  25. package/lib/features/modeling/behavior/LabelBehavior.js +8 -7
  26. package/lib/features/modeling/behavior/ResizeBehavior.js +129 -3
  27. package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js +6 -6
  28. package/lib/features/modeling/behavior/util/ResizeUtil.js +1 -132
  29. package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +8 -6
  30. package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +19 -12
  31. package/lib/features/modeling/cmd/UpdateSemanticParentHandler.js +5 -3
  32. package/lib/features/palette/PaletteProvider.js +3 -1
  33. package/lib/features/popup-menu/ReplaceMenuProvider.js +5 -5
  34. package/lib/features/popup-menu/util/TypeUtil.js +1 -1
  35. package/lib/features/replace/BpmnReplace.js +29 -29
  36. package/lib/features/subprocess-navigation/SubprocessCentering.js +55 -0
  37. package/lib/features/subprocess-navigation/SubprocessCompatibility.js +135 -0
  38. package/lib/features/subprocess-navigation/SubprocessElements.js +55 -0
  39. package/lib/features/subprocess-navigation/SubprocessFlows.js +109 -0
  40. package/lib/features/subprocess-navigation/SubprocessOverlays.js +104 -0
  41. package/lib/features/subprocess-navigation/index.js +18 -0
  42. package/lib/import/BpmnImporter.js +76 -22
  43. package/lib/import/BpmnTreeWalker.js +19 -17
  44. package/lib/import/Importer.js +17 -6
  45. package/lib/util/CompatibilityUtil.js +21 -1
  46. package/lib/util/DiUtil.js +10 -3
  47. package/lib/util/LabelUtil.js +2 -3
  48. package/lib/util/ModelUtil.js +11 -0
  49. package/package.json +2 -2
  50. package/test/helper/index.js +6 -1
  51. package/test/matchers/BoundsMatchers.js +10 -10
  52. package/test/matchers/ConnectionMatchers.js +5 -5
  53. package/test/util/MockEvents.js +10 -2
@@ -197,7 +197,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
197
197
  }
198
198
 
199
199
 
200
- if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(businessObject)) {
200
+ if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) {
201
201
 
202
202
  var childLanes = getChildLanes(element);
203
203
 
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  getBusinessObject,
3
+ getDi,
3
4
  is
4
5
  } from '../../util/ModelUtil';
5
6
 
@@ -45,23 +46,13 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
45
46
  element = context.element;
46
47
 
47
48
  var businessObject = descriptor.oldBusinessObject = getBusinessObject(element);
49
+ var di = descriptor.oldDi = getDi(element);
48
50
 
49
51
  descriptor.type = element.type;
50
52
 
51
53
  copyProperties(businessObject, descriptor, 'name');
52
54
 
53
- descriptor.di = {};
54
-
55
- // colors will be set to DI
56
- copyProperties(businessObject.di, descriptor.di, [
57
- 'fill',
58
- 'stroke',
59
- 'background-color',
60
- 'border-color',
61
- 'color'
62
- ]);
63
-
64
- copyProperties(businessObject.di, descriptor, 'isExpanded');
55
+ copyProperties(di, descriptor, 'isExpanded');
65
56
 
66
57
  if (isLabel(descriptor)) {
67
58
  return descriptor;
@@ -135,11 +126,13 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
135
126
  var cache = context.cache,
136
127
  descriptor = context.descriptor,
137
128
  oldBusinessObject = descriptor.oldBusinessObject,
138
- newBusinessObject;
129
+ oldDi = descriptor.oldDi,
130
+ newBusinessObject, newDi;
139
131
 
140
132
  // do NOT copy business object if external label
141
133
  if (isLabel(descriptor)) {
142
134
  descriptor.businessObject = getBusinessObject(cache[ descriptor.labelTarget ]);
135
+ descriptor.di = getDi(cache[ descriptor.labelTarget ]);
143
136
 
144
137
  return;
145
138
  }
@@ -151,6 +144,13 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
151
144
  newBusinessObject
152
145
  );
153
146
 
147
+ newDi = bpmnFactory.create(oldDi.$type);
148
+
149
+ descriptor.di = moddleCopy.copyElement(
150
+ oldDi,
151
+ newDi
152
+ );
153
+
154
154
  // resolve references e.g. default sequence flow
155
155
  resolveReferences(descriptor, cache);
156
156
 
@@ -215,11 +215,16 @@ ModdleCopy.prototype.copyProperty = function(property, parent, propertyName) {
215
215
 
216
216
  var propertyDescriptor = this._moddle.getPropertyDescriptor(parent, propertyName);
217
217
 
218
- // do NOT copy Ids and references
219
- if (propertyDescriptor.isId || propertyDescriptor.isReference) {
218
+ // do NOT copy references
219
+ if (propertyDescriptor.isReference) {
220
220
  return;
221
221
  }
222
222
 
223
+ // copy id
224
+ if (propertyDescriptor.isId) {
225
+ return this._copyId(property, parent);
226
+ }
227
+
223
228
  // copy arrays
224
229
  if (isArray(property)) {
225
230
  return reduce(property, function(childProperties, childProperty) {
@@ -258,6 +263,18 @@ ModdleCopy.prototype.copyProperty = function(property, parent, propertyName) {
258
263
  return property;
259
264
  };
260
265
 
266
+ ModdleCopy.prototype._copyId = function(id, element) {
267
+
268
+ // disallow if already taken
269
+ if (this._moddle.ids.assigned(id)) {
270
+ return;
271
+ } else {
272
+
273
+ this._moddle.ids.claim(id, element);
274
+ return id;
275
+ }
276
+ };
277
+
261
278
  // helpers //////////
262
279
 
263
280
  export function getPropertyNames(descriptor, keepDefaultProperties) {
@@ -1,5 +1,4 @@
1
- import { getDi } from '../../draw/BpmnRenderUtil';
2
- import { getBusinessObject } from '../../util/ModelUtil';
1
+ import { getDi } from '../../util/ModelUtil';
3
2
 
4
3
  import {
5
4
  filter,
@@ -17,7 +16,7 @@ export default function BpmnDiOrdering(eventBus, canvas) {
17
16
 
18
17
  function orderDi() {
19
18
  var root = canvas.getRootElement(),
20
- rootDi = getBusinessObject(root).di,
19
+ rootDi = getDi(root),
21
20
  elements,
22
21
  diElements;
23
22
 
@@ -6,7 +6,7 @@ import {
6
6
  } from 'tiny-svg';
7
7
 
8
8
  import {
9
- getBusinessObject,
9
+ getDi,
10
10
  is
11
11
  } from '../../util/ModelUtil';
12
12
 
@@ -132,7 +132,7 @@ LabelEditingPreview.$inject = [
132
132
  // helpers ///////////////////
133
133
 
134
134
  function getStrokeColor(element, defaultColor) {
135
- var bo = getBusinessObject(element);
135
+ var di = getDi(element);
136
136
 
137
- return bo.di.get('stroke') || defaultColor || 'black';
137
+ return di.get('stroke') || defaultColor || 'black';
138
138
  }
@@ -67,7 +67,8 @@ export default function UpdateLabelHandler(modeling, textRenderer) {
67
67
 
68
68
  modeling.createLabel(element, labelCenter, {
69
69
  id: businessObject.id + '_label',
70
- businessObject: businessObject
70
+ businessObject: businessObject,
71
+ di: element.di
71
72
  });
72
73
  }
73
74
  }
@@ -83,11 +83,10 @@ BpmnFactory.prototype.createDiLabel = function() {
83
83
  };
84
84
 
85
85
 
86
- BpmnFactory.prototype.createDiShape = function(semantic, bounds, attrs) {
87
-
86
+ BpmnFactory.prototype.createDiShape = function(semantic, attrs) {
88
87
  return this.create('bpmndi:BPMNShape', assign({
89
88
  bpmnElement: semantic,
90
- bounds: this.createDiBounds(bounds)
89
+ bounds: this.createDiBounds()
91
90
  }, attrs));
92
91
  };
93
92
 
@@ -110,14 +109,15 @@ BpmnFactory.prototype.createDiWaypoint = function(point) {
110
109
  };
111
110
 
112
111
 
113
- BpmnFactory.prototype.createDiEdge = function(semantic, waypoints, attrs) {
112
+ BpmnFactory.prototype.createDiEdge = function(semantic, attrs) {
114
113
  return this.create('bpmndi:BPMNEdge', assign({
115
- bpmnElement: semantic
114
+ bpmnElement: semantic,
115
+ waypoints: this.createDiWaypoints([])
116
116
  }, attrs));
117
117
  };
118
118
 
119
- BpmnFactory.prototype.createDiPlane = function(semantic) {
120
- return this.create('bpmndi:BPMNPlane', {
119
+ BpmnFactory.prototype.createDiPlane = function(semantic, attrs) {
120
+ return this.create('bpmndi:BPMNPlane', assign({
121
121
  bpmnElement: semantic
122
- });
122
+ }, attrs));
123
123
  };
@@ -16,6 +16,7 @@ import {
16
16
 
17
17
  import {
18
18
  getBusinessObject,
19
+ getDi,
19
20
  is
20
21
  } from '../../util/ModelUtil';
21
22
 
@@ -307,8 +308,9 @@ BpmnUpdater.prototype.updateParent = function(element, oldParent) {
307
308
  var parentShape = element.parent;
308
309
 
309
310
  var businessObject = element.businessObject,
311
+ di = getDi(element),
310
312
  parentBusinessObject = parentShape && parentShape.businessObject,
311
- parentDi = parentBusinessObject && parentBusinessObject.di;
313
+ parentDi = getDi(parentShape);
312
314
 
313
315
  if (is(element, 'bpmn:FlowNode')) {
314
316
  this.updateFlowNodeRefs(businessObject, parentBusinessObject, oldParent && oldParent.businessObject);
@@ -336,13 +338,13 @@ BpmnUpdater.prototype.updateParent = function(element, oldParent) {
336
338
  this.updateSemanticParent(businessObject.dataObjectRef, parentBusinessObject);
337
339
  }
338
340
 
339
- this.updateDiParent(businessObject.di, parentDi);
341
+ this.updateDiParent(di, parentDi);
340
342
  };
341
343
 
342
344
 
343
345
  BpmnUpdater.prototype.updateBounds = function(shape) {
344
346
 
345
- var di = shape.businessObject.di;
347
+ var di = getDi(shape);
346
348
 
347
349
  var target = (shape instanceof Label) ? this._getLabel(di) : di;
348
350
 
@@ -382,14 +384,17 @@ BpmnUpdater.prototype.updateFlowNodeRefs = function(businessObject, newContainme
382
384
 
383
385
 
384
386
  // update existing sourceElement and targetElement di information
385
- BpmnUpdater.prototype.updateDiConnection = function(di, newSource, newTarget) {
387
+ BpmnUpdater.prototype.updateDiConnection = function(connection, newSource, newTarget) {
388
+ var connectionDi = getDi(connection),
389
+ newSourceDi = getDi(newSource),
390
+ newTargetDi = getDi(newTarget);
386
391
 
387
- if (di.sourceElement && di.sourceElement.bpmnElement !== newSource) {
388
- di.sourceElement = newSource && newSource.di;
392
+ if (connectionDi.sourceElement && connectionDi.sourceElement.bpmnElement !== getBusinessObject(newSource)) {
393
+ connectionDi.sourceElement = newSource && newSourceDi;
389
394
  }
390
395
 
391
- if (di.targetElement && di.targetElement.bpmnElement !== newTarget) {
392
- di.targetElement = newTarget && newTarget.di;
396
+ if (connectionDi.targetElement && connectionDi.targetElement.bpmnElement !== getBusinessObject(newTarget)) {
397
+ connectionDi.targetElement = newTarget && newTargetDi;
393
398
  }
394
399
 
395
400
  };
@@ -614,69 +619,72 @@ BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent,
614
619
 
615
620
 
616
621
  BpmnUpdater.prototype.updateConnectionWaypoints = function(connection) {
617
- connection.businessObject.di.set('waypoint', this._bpmnFactory.createDiWaypoints(connection.waypoints));
622
+ var di = getDi(connection);
623
+
624
+ di.set('waypoint', this._bpmnFactory.createDiWaypoints(connection.waypoints));
618
625
  };
619
626
 
620
627
 
621
628
  BpmnUpdater.prototype.updateConnection = function(context) {
622
-
623
629
  var connection = context.connection,
624
630
  businessObject = getBusinessObject(connection),
625
- newSource = getBusinessObject(connection.source),
626
- newTarget = getBusinessObject(connection.target),
631
+ newSource = connection.source,
632
+ newSourceBo = getBusinessObject(newSource),
633
+ newTarget = connection.target,
634
+ newTargetBo = getBusinessObject(connection.target),
627
635
  visualParent;
628
636
 
629
637
  if (!is(businessObject, 'bpmn:DataAssociation')) {
630
638
 
631
639
  var inverseSet = is(businessObject, 'bpmn:SequenceFlow');
632
640
 
633
- if (businessObject.sourceRef !== newSource) {
641
+ if (businessObject.sourceRef !== newSourceBo) {
634
642
  if (inverseSet) {
635
643
  collectionRemove(businessObject.sourceRef && businessObject.sourceRef.get('outgoing'), businessObject);
636
644
 
637
- if (newSource && newSource.get('outgoing')) {
638
- newSource.get('outgoing').push(businessObject);
645
+ if (newSourceBo && newSourceBo.get('outgoing')) {
646
+ newSourceBo.get('outgoing').push(businessObject);
639
647
  }
640
648
  }
641
649
 
642
- businessObject.sourceRef = newSource;
650
+ businessObject.sourceRef = newSourceBo;
643
651
  }
644
652
 
645
- if (businessObject.targetRef !== newTarget) {
653
+ if (businessObject.targetRef !== newTargetBo) {
646
654
  if (inverseSet) {
647
655
  collectionRemove(businessObject.targetRef && businessObject.targetRef.get('incoming'), businessObject);
648
656
 
649
- if (newTarget && newTarget.get('incoming')) {
650
- newTarget.get('incoming').push(businessObject);
657
+ if (newTargetBo && newTargetBo.get('incoming')) {
658
+ newTargetBo.get('incoming').push(businessObject);
651
659
  }
652
660
  }
653
661
 
654
- businessObject.targetRef = newTarget;
662
+ businessObject.targetRef = newTargetBo;
655
663
  }
656
664
  } else
657
665
 
658
666
  if (is(businessObject, 'bpmn:DataInputAssociation')) {
659
667
 
660
668
  // handle obnoxious isMsome sourceRef
661
- businessObject.get('sourceRef')[0] = newSource;
669
+ businessObject.get('sourceRef')[0] = newSourceBo;
662
670
 
663
- visualParent = context.parent || context.newParent || newTarget;
671
+ visualParent = context.parent || context.newParent || newTargetBo;
664
672
 
665
- this.updateSemanticParent(businessObject, newTarget, visualParent);
673
+ this.updateSemanticParent(businessObject, newTargetBo, visualParent);
666
674
  } else
667
675
 
668
676
  if (is(businessObject, 'bpmn:DataOutputAssociation')) {
669
- visualParent = context.parent || context.newParent || newSource;
677
+ visualParent = context.parent || context.newParent || newSourceBo;
670
678
 
671
- this.updateSemanticParent(businessObject, newSource, visualParent);
679
+ this.updateSemanticParent(businessObject, newSourceBo, visualParent);
672
680
 
673
681
  // targetRef = new target
674
- businessObject.targetRef = newTarget;
682
+ businessObject.targetRef = newTargetBo;
675
683
  }
676
684
 
677
685
  this.updateConnectionWaypoints(connection);
678
686
 
679
- this.updateDiConnection(businessObject.di, newSource, newTarget);
687
+ this.updateDiConnection(connection, newSource, newTarget);
680
688
  };
681
689
 
682
690
 
@@ -6,7 +6,15 @@ import {
6
6
 
7
7
  import inherits from 'inherits';
8
8
 
9
- import { is } from '../../util/ModelUtil';
9
+ import {
10
+ getBusinessObject,
11
+ getDi,
12
+ is
13
+ } from '../../util/ModelUtil';
14
+
15
+ import {
16
+ isAny
17
+ } from '../modeling/util/ModelingUtil';
10
18
 
11
19
  import {
12
20
  isExpanded
@@ -18,6 +26,10 @@ import {
18
26
  DEFAULT_LABEL_SIZE
19
27
  } from '../../util/LabelUtil';
20
28
 
29
+ import {
30
+ ensureCompatDiRef
31
+ } from '../../util/CompatibilityUtil';
32
+
21
33
 
22
34
  /**
23
35
  * A bpmn-aware factory for diagram-js shapes
@@ -46,7 +58,8 @@ ElementFactory.prototype.create = function(elementType, attrs) {
46
58
  // we assume their businessObjects have already been created
47
59
  // and wired via attrs
48
60
  if (elementType === 'label') {
49
- return this.baseCreate(elementType, assign({ type: 'label' }, DEFAULT_LABEL_SIZE, attrs));
61
+ var di = attrs.di || this._bpmnFactory.createDiLabel();
62
+ return this.baseCreate(elementType, assign({ type: 'label', di: di }, DEFAULT_LABEL_SIZE, attrs));
50
63
  }
51
64
 
52
65
  return this.createBpmnElement(elementType, attrs);
@@ -58,7 +71,8 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
58
71
 
59
72
  attrs = attrs || {};
60
73
 
61
- var businessObject = attrs.businessObject;
74
+ var businessObject = attrs.businessObject,
75
+ di = attrs.di;
62
76
 
63
77
  if (!businessObject) {
64
78
  if (!attrs.type) {
@@ -66,22 +80,23 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
66
80
  }
67
81
 
68
82
  businessObject = this._bpmnFactory.create(attrs.type);
83
+
84
+ ensureCompatDiRef(businessObject);
69
85
  }
70
86
 
71
- if (!businessObject.di) {
87
+ if (!isModdleDi(di)) {
88
+ var diAttrs = assign(
89
+ di || {},
90
+ { id: businessObject.id + '_di' }
91
+ );
92
+
72
93
  if (elementType === 'root') {
73
- businessObject.di = this._bpmnFactory.createDiPlane(businessObject, [], {
74
- id: businessObject.id + '_di'
75
- });
94
+ di = this._bpmnFactory.createDiPlane(businessObject, diAttrs);
76
95
  } else
77
96
  if (elementType === 'connection') {
78
- businessObject.di = this._bpmnFactory.createDiEdge(businessObject, [], {
79
- id: businessObject.id + '_di'
80
- });
97
+ di = this._bpmnFactory.createDiEdge(businessObject, diAttrs);
81
98
  } else {
82
- businessObject.di = this._bpmnFactory.createDiShape(businessObject, {}, {
83
- id: businessObject.id + '_di'
84
- });
99
+ di = this._bpmnFactory.createDiShape(businessObject, diAttrs);
85
100
  }
86
101
  }
87
102
 
@@ -91,12 +106,6 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
91
106
  }, attrs);
92
107
  }
93
108
 
94
- if (attrs.di) {
95
- assign(businessObject.di, attrs.di);
96
-
97
- delete attrs.di;
98
- }
99
-
100
109
  applyAttributes(businessObject, attrs, [
101
110
  'processRef',
102
111
  'isInterrupting',
@@ -105,11 +114,11 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
105
114
  ]);
106
115
 
107
116
  if (attrs.isExpanded) {
108
- applyAttribute(businessObject.di, attrs, 'isExpanded');
117
+ applyAttribute(di, attrs, 'isExpanded');
109
118
  }
110
119
 
111
120
  if (is(businessObject, 'bpmn:ExclusiveGateway')) {
112
- businessObject.di.isMarkerVisible = true;
121
+ di.isMarkerVisible = true;
113
122
  }
114
123
 
115
124
  var eventDefinitions,
@@ -131,65 +140,69 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
131
140
  delete attrs.eventDefinitionType;
132
141
  }
133
142
 
134
- size = this._getDefaultSize(businessObject);
143
+ size = this.getDefaultSize(businessObject, di);
135
144
 
136
145
  attrs = assign({
137
- businessObject: businessObject,
138
146
  id: businessObject.id
139
- }, size, attrs);
147
+ }, size, attrs, {
148
+ businessObject: businessObject,
149
+ di: di
150
+ });
140
151
 
141
152
  return this.baseCreate(elementType, attrs);
142
153
  };
143
154
 
144
155
 
145
- ElementFactory.prototype._getDefaultSize = function(semantic) {
156
+ ElementFactory.prototype.getDefaultSize = function(element, di) {
146
157
 
147
- if (is(semantic, 'bpmn:SubProcess')) {
158
+ var bo = getBusinessObject(element);
159
+ di = di || getDi(element);
148
160
 
149
- if (isExpanded(semantic)) {
161
+ if (is(bo, 'bpmn:SubProcess')) {
162
+ if (isExpanded(bo, di)) {
150
163
  return { width: 350, height: 200 };
151
164
  } else {
152
165
  return { width: 100, height: 80 };
153
166
  }
154
167
  }
155
168
 
156
- if (is(semantic, 'bpmn:Task')) {
169
+ if (is(bo, 'bpmn:Task')) {
157
170
  return { width: 100, height: 80 };
158
171
  }
159
172
 
160
- if (is(semantic, 'bpmn:Gateway')) {
173
+ if (is(bo, 'bpmn:Gateway')) {
161
174
  return { width: 50, height: 50 };
162
175
  }
163
176
 
164
- if (is(semantic, 'bpmn:Event')) {
177
+ if (is(bo, 'bpmn:Event')) {
165
178
  return { width: 36, height: 36 };
166
179
  }
167
180
 
168
- if (is(semantic, 'bpmn:Participant')) {
169
- if (isExpanded(semantic)) {
181
+ if (is(bo, 'bpmn:Participant')) {
182
+ if (isExpanded(bo, di)) {
170
183
  return { width: 600, height: 250 };
171
184
  } else {
172
185
  return { width: 400, height: 60 };
173
186
  }
174
187
  }
175
188
 
176
- if (is(semantic, 'bpmn:Lane')) {
189
+ if (is(bo, 'bpmn:Lane')) {
177
190
  return { width: 400, height: 100 };
178
191
  }
179
192
 
180
- if (is(semantic, 'bpmn:DataObjectReference')) {
193
+ if (is(bo, 'bpmn:DataObjectReference')) {
181
194
  return { width: 36, height: 50 };
182
195
  }
183
196
 
184
- if (is(semantic, 'bpmn:DataStoreReference')) {
197
+ if (is(bo, 'bpmn:DataStoreReference')) {
185
198
  return { width: 50, height: 50 };
186
199
  }
187
200
 
188
- if (is(semantic, 'bpmn:TextAnnotation')) {
201
+ if (is(bo, 'bpmn:TextAnnotation')) {
189
202
  return { width: 100, height: 30 };
190
203
  }
191
204
 
192
- if (is(semantic, 'bpmn:Group')) {
205
+ if (is(bo, 'bpmn:Group')) {
193
206
  return { width: 300, height: 300 };
194
207
  }
195
208
 
@@ -252,4 +265,14 @@ function applyAttribute(element, attrs, attributeName) {
252
265
  element[attributeName] = attrs[attributeName];
253
266
 
254
267
  delete attrs[attributeName];
268
+ }
269
+
270
+
271
+ function isModdleDi(element) {
272
+ return isAny(element, [
273
+ 'bpmndi:BPMNShape',
274
+ 'bpmndi:BPMNEdge',
275
+ 'bpmndi:BPMNDiagram',
276
+ 'bpmndi:BPMNPlane',
277
+ ]);
255
278
  }
@@ -4,6 +4,7 @@ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
4
4
 
5
5
  import {
6
6
  getBusinessObject,
7
+ getDi,
7
8
  is
8
9
  } from '../../../util/ModelUtil';
9
10
 
@@ -45,8 +46,9 @@ export default function DataStoreBehavior(
45
46
 
46
47
  commandStack.execute('dataStore.updateContainment', {
47
48
  dataStoreBo: dataStoreBo,
49
+ dataStoreDi: getDi(dataStore),
48
50
  newSemanticParent: newDataStoreParentBo.processRef || newDataStoreParentBo,
49
- newDiParent: newDataStoreParentBo.di
51
+ newDiParent: getDi(newDataStoreParent)
50
52
  });
51
53
  }
52
54
  }
@@ -3,7 +3,8 @@ import inherits from 'inherits';
3
3
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
4
4
 
5
5
  import {
6
- getBusinessObject
6
+ getBusinessObject,
7
+ getDi
7
8
  } from '../../../util/ModelUtil';
8
9
 
9
10
  import {
@@ -26,12 +27,14 @@ export default function IsHorizontalFix(eventBus) {
26
27
  ];
27
28
 
28
29
  this.executed([ 'shape.move', 'shape.create', 'shape.resize' ], function(event) {
29
- var bo = getBusinessObject(event.context.shape);
30
+ var shape = event.context.shape,
31
+ bo = getBusinessObject(shape),
32
+ di = getDi(shape);
30
33
 
31
- if (isAny(bo, elementTypesToUpdate) && !bo.di.get('isHorizontal')) {
34
+ if (isAny(bo, elementTypesToUpdate) && !di.get('isHorizontal')) {
32
35
 
33
36
  // set attribute directly to avoid modeling#updateProperty side effects
34
- bo.di.set('isHorizontal', true);
37
+ di.set('isHorizontal', true);
35
38
  }
36
39
  });
37
40
 
@@ -6,7 +6,8 @@ import inherits from 'inherits';
6
6
 
7
7
  import {
8
8
  is,
9
- getBusinessObject
9
+ getBusinessObject,
10
+ getDi
10
11
  } from '../../../util/ModelUtil';
11
12
 
12
13
  import {
@@ -153,27 +154,27 @@ export default function LabelBehavior(
153
154
 
154
155
  var context = event.context,
155
156
  element = context.shape,
156
- businessObject,
157
+ labelTarget = context.labelTarget,
157
158
  di;
158
159
 
159
160
  // we want to trigger on real labels only
160
- if (!element.labelTarget) {
161
+ if (!labelTarget) {
161
162
  return;
162
163
  }
163
164
 
164
165
  // we want to trigger on BPMN elements only
165
- if (!is(element.labelTarget || element, 'bpmn:BaseElement')) {
166
+ if (!is(labelTarget, 'bpmn:BaseElement')) {
166
167
  return;
167
168
  }
168
169
 
169
- businessObject = element.businessObject,
170
- di = businessObject.di;
171
-
170
+ di = getDi(labelTarget);
172
171
 
173
172
  if (!di.label) {
174
173
  di.label = bpmnFactory.create('bpmndi:BPMNLabel', {
175
174
  bounds: bpmnFactory.create('dc:Bounds')
176
175
  });
176
+
177
+ element.di = di;
177
178
  }
178
179
 
179
180
  assign(di.label.bounds, {