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
@@ -2,7 +2,14 @@ import { is } from '../../../util/ModelUtil';
2
2
 
3
3
  import { isExpanded } from '../../../util/DiUtil';
4
4
 
5
- import { getParticipantResizeConstraints } from './util/ResizeUtil';
5
+ import {
6
+ asTRBL
7
+ } from 'diagram-js/lib/layout/LayoutUtil';
8
+
9
+ import {
10
+ collectLanes,
11
+ getLanesRoot
12
+ } from '../util/LaneUtil';
6
13
 
7
14
  var HIGH_PRIORITY = 1500;
8
15
 
@@ -14,7 +21,6 @@ export var SUB_PROCESS_MIN_DIMENSIONS = { width: 140, height: 120 };
14
21
 
15
22
  export var TEXT_ANNOTATION_MIN_DIMENSIONS = { width: 50, height: 30 };
16
23
 
17
-
18
24
  /**
19
25
  * Set minimum bounds/resize constraints on resize.
20
26
  *
@@ -45,4 +51,124 @@ export default function ResizeBehavior(eventBus) {
45
51
  });
46
52
  }
47
53
 
48
- ResizeBehavior.$inject = [ 'eventBus' ];
54
+ ResizeBehavior.$inject = [ 'eventBus' ];
55
+
56
+
57
+ var abs = Math.abs,
58
+ min = Math.min,
59
+ max = Math.max;
60
+
61
+
62
+ function addToTrbl(trbl, attr, value, choice) {
63
+ var current = trbl[attr];
64
+
65
+ // make sure to set the value if it does not exist
66
+ // or apply the correct value by comparing against
67
+ // choice(value, currentValue)
68
+ trbl[attr] = current === undefined ? value : choice(value, current);
69
+ }
70
+
71
+ function addMin(trbl, attr, value) {
72
+ return addToTrbl(trbl, attr, value, min);
73
+ }
74
+
75
+ function addMax(trbl, attr, value) {
76
+ return addToTrbl(trbl, attr, value, max);
77
+ }
78
+
79
+ var LANE_RIGHT_PADDING = 20,
80
+ LANE_LEFT_PADDING = 50,
81
+ LANE_TOP_PADDING = 20,
82
+ LANE_BOTTOM_PADDING = 20;
83
+
84
+ export function getParticipantResizeConstraints(laneShape, resizeDirection, balanced) {
85
+ var lanesRoot = getLanesRoot(laneShape);
86
+
87
+ var isFirst = true,
88
+ isLast = true;
89
+
90
+ // max top/bottom size for lanes
91
+ var allLanes = collectLanes(lanesRoot, [ lanesRoot ]);
92
+
93
+ var laneTrbl = asTRBL(laneShape);
94
+
95
+ var maxTrbl = {},
96
+ minTrbl = {};
97
+
98
+ if (/e/.test(resizeDirection)) {
99
+ minTrbl.right = laneTrbl.left + LANE_MIN_DIMENSIONS.width;
100
+ } else
101
+ if (/w/.test(resizeDirection)) {
102
+ minTrbl.left = laneTrbl.right - LANE_MIN_DIMENSIONS.width;
103
+ }
104
+
105
+ allLanes.forEach(function(other) {
106
+
107
+ var otherTrbl = asTRBL(other);
108
+
109
+ if (/n/.test(resizeDirection)) {
110
+
111
+ if (otherTrbl.top < (laneTrbl.top - 10)) {
112
+ isFirst = false;
113
+ }
114
+
115
+ // max top size (based on next element)
116
+ if (balanced && abs(laneTrbl.top - otherTrbl.bottom) < 10) {
117
+ addMax(maxTrbl, 'top', otherTrbl.top + LANE_MIN_DIMENSIONS.height);
118
+ }
119
+
120
+ // min top size (based on self or nested element)
121
+ if (abs(laneTrbl.top - otherTrbl.top) < 5) {
122
+ addMin(minTrbl, 'top', otherTrbl.bottom - LANE_MIN_DIMENSIONS.height);
123
+ }
124
+ }
125
+
126
+ if (/s/.test(resizeDirection)) {
127
+
128
+ if (otherTrbl.bottom > (laneTrbl.bottom + 10)) {
129
+ isLast = false;
130
+ }
131
+
132
+ // max bottom size (based on previous element)
133
+ if (balanced && abs(laneTrbl.bottom - otherTrbl.top) < 10) {
134
+ addMin(maxTrbl, 'bottom', otherTrbl.bottom - LANE_MIN_DIMENSIONS.height);
135
+ }
136
+
137
+ // min bottom size (based on self or nested element)
138
+ if (abs(laneTrbl.bottom - otherTrbl.bottom) < 5) {
139
+ addMax(minTrbl, 'bottom', otherTrbl.top + LANE_MIN_DIMENSIONS.height);
140
+ }
141
+ }
142
+ });
143
+
144
+ // max top/bottom/left/right size based on flow nodes
145
+ var flowElements = lanesRoot.children.filter(function(s) {
146
+ return !s.hidden && !s.waypoints && (is(s, 'bpmn:FlowElement') || is(s, 'bpmn:Artifact'));
147
+ });
148
+
149
+ flowElements.forEach(function(flowElement) {
150
+
151
+ var flowElementTrbl = asTRBL(flowElement);
152
+
153
+ if (isFirst && /n/.test(resizeDirection)) {
154
+ addMin(minTrbl, 'top', flowElementTrbl.top - LANE_TOP_PADDING);
155
+ }
156
+
157
+ if (/e/.test(resizeDirection)) {
158
+ addMax(minTrbl, 'right', flowElementTrbl.right + LANE_RIGHT_PADDING);
159
+ }
160
+
161
+ if (isLast && /s/.test(resizeDirection)) {
162
+ addMax(minTrbl, 'bottom', flowElementTrbl.bottom + LANE_BOTTOM_PADDING);
163
+ }
164
+
165
+ if (/w/.test(resizeDirection)) {
166
+ addMin(minTrbl, 'left', flowElementTrbl.left - LANE_LEFT_PADDING);
167
+ }
168
+ });
169
+
170
+ return {
171
+ min: minTrbl,
172
+ max: maxTrbl
173
+ };
174
+ }
@@ -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) {
@@ -1,132 +1 @@
1
- import { is } from '../../../../util/ModelUtil';
2
-
3
- import {
4
- asTRBL
5
- } from 'diagram-js/lib/layout/LayoutUtil';
6
-
7
- import {
8
- collectLanes,
9
- getLanesRoot
10
- } from '../../../modeling/util/LaneUtil';
11
-
12
- import { LANE_MIN_DIMENSIONS } from '../ResizeBehavior';
13
-
14
- var abs = Math.abs,
15
- min = Math.min,
16
- max = Math.max;
17
-
18
-
19
- function addToTrbl(trbl, attr, value, choice) {
20
- var current = trbl[attr];
21
-
22
- // make sure to set the value if it does not exist
23
- // or apply the correct value by comparing against
24
- // choice(value, currentValue)
25
- trbl[attr] = current === undefined ? value : choice(value, current);
26
- }
27
-
28
- function addMin(trbl, attr, value) {
29
- return addToTrbl(trbl, attr, value, min);
30
- }
31
-
32
- function addMax(trbl, attr, value) {
33
- return addToTrbl(trbl, attr, value, max);
34
- }
35
-
36
- var LANE_RIGHT_PADDING = 20,
37
- LANE_LEFT_PADDING = 50,
38
- LANE_TOP_PADDING = 20,
39
- LANE_BOTTOM_PADDING = 20;
40
-
41
-
42
- export function getParticipantResizeConstraints(laneShape, resizeDirection, balanced) {
43
- var lanesRoot = getLanesRoot(laneShape);
44
-
45
- var isFirst = true,
46
- isLast = true;
47
-
48
- // max top/bottom size for lanes
49
- var allLanes = collectLanes(lanesRoot, [ lanesRoot ]);
50
-
51
- var laneTrbl = asTRBL(laneShape);
52
-
53
- var maxTrbl = {},
54
- minTrbl = {};
55
-
56
- if (/e/.test(resizeDirection)) {
57
- minTrbl.right = laneTrbl.left + LANE_MIN_DIMENSIONS.width;
58
- } else
59
- if (/w/.test(resizeDirection)) {
60
- minTrbl.left = laneTrbl.right - LANE_MIN_DIMENSIONS.width;
61
- }
62
-
63
- allLanes.forEach(function(other) {
64
-
65
- var otherTrbl = asTRBL(other);
66
-
67
- if (/n/.test(resizeDirection)) {
68
-
69
- if (otherTrbl.top < (laneTrbl.top - 10)) {
70
- isFirst = false;
71
- }
72
-
73
- // max top size (based on next element)
74
- if (balanced && abs(laneTrbl.top - otherTrbl.bottom) < 10) {
75
- addMax(maxTrbl, 'top', otherTrbl.top + LANE_MIN_DIMENSIONS.height);
76
- }
77
-
78
- // min top size (based on self or nested element)
79
- if (abs(laneTrbl.top - otherTrbl.top) < 5) {
80
- addMin(minTrbl, 'top', otherTrbl.bottom - LANE_MIN_DIMENSIONS.height);
81
- }
82
- }
83
-
84
- if (/s/.test(resizeDirection)) {
85
-
86
- if (otherTrbl.bottom > (laneTrbl.bottom + 10)) {
87
- isLast = false;
88
- }
89
-
90
- // max bottom size (based on previous element)
91
- if (balanced && abs(laneTrbl.bottom - otherTrbl.top) < 10) {
92
- addMin(maxTrbl, 'bottom', otherTrbl.bottom - LANE_MIN_DIMENSIONS.height);
93
- }
94
-
95
- // min bottom size (based on self or nested element)
96
- if (abs(laneTrbl.bottom - otherTrbl.bottom) < 5) {
97
- addMax(minTrbl, 'bottom', otherTrbl.top + LANE_MIN_DIMENSIONS.height);
98
- }
99
- }
100
- });
101
-
102
- // max top/bottom/left/right size based on flow nodes
103
- var flowElements = lanesRoot.children.filter(function(s) {
104
- return !s.hidden && !s.waypoints && (is(s, 'bpmn:FlowElement') || is(s, 'bpmn:Artifact'));
105
- });
106
-
107
- flowElements.forEach(function(flowElement) {
108
-
109
- var flowElementTrbl = asTRBL(flowElement);
110
-
111
- if (isFirst && /n/.test(resizeDirection)) {
112
- addMin(minTrbl, 'top', flowElementTrbl.top - LANE_TOP_PADDING);
113
- }
114
-
115
- if (/e/.test(resizeDirection)) {
116
- addMax(minTrbl, 'right', flowElementTrbl.right + LANE_RIGHT_PADDING);
117
- }
118
-
119
- if (isLast && /s/.test(resizeDirection)) {
120
- addMax(minTrbl, 'bottom', flowElementTrbl.bottom + LANE_BOTTOM_PADDING);
121
- }
122
-
123
- if (/w/.test(resizeDirection)) {
124
- addMin(minTrbl, 'left', flowElementTrbl.left - LANE_LEFT_PADDING);
125
- }
126
- });
127
-
128
- return {
129
- min: minTrbl,
130
- max: maxTrbl
131
- };
132
- }
1
+ export { getParticipantResizeConstraints } from '../ResizeBehavior';
@@ -3,6 +3,8 @@ import {
3
3
  remove as collectionRemove
4
4
  } from 'diagram-js/lib/util/Collections';
5
5
 
6
+ import { getDi } from '../../../util/ModelUtil';
7
+
6
8
 
7
9
  export default function UpdateCanvasRootHandler(canvas, modeling) {
8
10
  this._canvas = canvas;
@@ -24,7 +26,7 @@ UpdateCanvasRootHandler.prototype.execute = function(context) {
24
26
  oldRoot = canvas.getRootElement(),
25
27
  oldRootBusinessObject = oldRoot.businessObject,
26
28
  bpmnDefinitions = oldRootBusinessObject.$parent,
27
- diPlane = oldRootBusinessObject.di;
29
+ diPlane = getDi(oldRoot);
28
30
 
29
31
  // (1) replace process old <> new root
30
32
  canvas.setRootElement(newRoot, true);
@@ -37,10 +39,10 @@ UpdateCanvasRootHandler.prototype.execute = function(context) {
37
39
  oldRootBusinessObject.$parent = null;
38
40
 
39
41
  // (3) wire di
40
- oldRootBusinessObject.di = null;
42
+ oldRoot.di = null;
41
43
 
42
44
  diPlane.bpmnElement = newRootBusinessObject;
43
- newRootBusinessObject.di = diPlane;
45
+ newRoot.di = diPlane;
44
46
 
45
47
  context.oldRoot = oldRoot;
46
48
 
@@ -58,7 +60,7 @@ UpdateCanvasRootHandler.prototype.revert = function(context) {
58
60
  oldRoot = context.oldRoot,
59
61
  oldRootBusinessObject = oldRoot.businessObject,
60
62
  bpmnDefinitions = newRootBusinessObject.$parent,
61
- diPlane = newRootBusinessObject.di;
63
+ diPlane = getDi(newRoot);
62
64
 
63
65
  // (1) replace process old <> new root
64
66
  canvas.setRootElement(oldRoot, true);
@@ -71,10 +73,10 @@ UpdateCanvasRootHandler.prototype.revert = function(context) {
71
73
  oldRootBusinessObject.$parent = bpmnDefinitions;
72
74
 
73
75
  // (3) wire di
74
- newRootBusinessObject.di = null;
76
+ newRoot.di = null;
75
77
 
76
78
  diPlane.bpmnElement = oldRootBusinessObject;
77
- oldRootBusinessObject.di = diPlane;
79
+ oldRoot.di = diPlane;
78
80
 
79
81
  // TODO(nikku): return changed elements?
80
82
  // return [ newRoot, oldRoot ];
@@ -6,7 +6,8 @@ import {
6
6
  } from 'min-dash';
7
7
 
8
8
  import {
9
- getBusinessObject
9
+ getBusinessObject,
10
+ getDi
10
11
  } from '../../../util/ModelUtil';
11
12
 
12
13
  var DEFAULT_FLOW = 'default',
@@ -74,7 +75,7 @@ UpdatePropertiesHandler.prototype.execute = function(context) {
74
75
 
75
76
  var businessObject = element.businessObject,
76
77
  properties = unwrapBusinessObjects(context.properties),
77
- oldProperties = context.oldProperties || getProperties(businessObject, properties);
78
+ oldProperties = context.oldProperties || getProperties(element, properties);
78
79
 
79
80
  if (isIdChange(properties, businessObject)) {
80
81
  ids.unclaim(businessObject[ID]);
@@ -97,7 +98,7 @@ UpdatePropertiesHandler.prototype.execute = function(context) {
97
98
  }
98
99
 
99
100
  // update properties
100
- setProperties(businessObject, properties);
101
+ setProperties(element, properties);
101
102
 
102
103
  // store old values
103
104
  context.oldProperties = oldProperties;
@@ -142,7 +143,7 @@ UpdatePropertiesHandler.prototype.revert = function(context) {
142
143
  ids = this._moddle.ids;
143
144
 
144
145
  // update properties
145
- setProperties(businessObject, oldProperties);
146
+ setProperties(element, oldProperties);
146
147
 
147
148
  if (isIdChange(properties, businessObject)) {
148
149
  ids.unclaim(properties[ID]);
@@ -161,16 +162,19 @@ function isIdChange(properties, businessObject) {
161
162
  }
162
163
 
163
164
 
164
- function getProperties(businessObject, properties) {
165
- var propertyNames = keys(properties);
165
+ function getProperties(element, properties) {
166
+ var propertyNames = keys(properties),
167
+ businessObject = element.businessObject,
168
+ di = getDi(element);
166
169
 
167
170
  return reduce(propertyNames, function(result, key) {
168
171
 
169
172
  // handle DI separately
170
173
  if (key !== DI) {
171
174
  result[key] = businessObject.get(key);
175
+
172
176
  } else {
173
- result[key] = getDiProperties(businessObject.di, keys(properties.di));
177
+ result[key] = getDiProperties(di, keys(properties.di));
174
178
  }
175
179
 
176
180
  return result;
@@ -180,23 +184,26 @@ function getProperties(businessObject, properties) {
180
184
 
181
185
  function getDiProperties(di, propertyNames) {
182
186
  return reduce(propertyNames, function(result, key) {
183
- result[key] = di.get(key);
187
+ result[key] = di && di.get(key);
184
188
 
185
189
  return result;
186
190
  }, {});
187
191
  }
188
192
 
189
193
 
190
- function setProperties(businessObject, properties) {
194
+ function setProperties(element, properties) {
195
+ var businessObject = element.businessObject,
196
+ di = getDi(element);
197
+
191
198
  forEach(properties, function(value, key) {
192
199
 
193
200
  if (key !== DI) {
194
201
  businessObject.set(key, value);
195
202
  } else {
196
203
 
197
- // only update, if businessObject.di exists
198
- if (businessObject.di) {
199
- setDiProperties(businessObject.di, value);
204
+ // only update, if di exists
205
+ if (di) {
206
+ setDiProperties(di, value);
200
207
  }
201
208
  }
202
209
  });
@@ -7,21 +7,23 @@ UpdateSemanticParentHandler.$inject = [ 'bpmnUpdater' ];
7
7
 
8
8
  UpdateSemanticParentHandler.prototype.execute = function(context) {
9
9
  var dataStoreBo = context.dataStoreBo,
10
+ dataStoreDi = context.dataStoreDi,
10
11
  newSemanticParent = context.newSemanticParent,
11
12
  newDiParent = context.newDiParent;
12
13
 
13
14
  context.oldSemanticParent = dataStoreBo.$parent;
14
- context.oldDiParent = dataStoreBo.di.$parent;
15
+ context.oldDiParent = dataStoreDi.$parent;
15
16
 
16
17
  // update semantic parent
17
18
  this._bpmnUpdater.updateSemanticParent(dataStoreBo, newSemanticParent);
18
19
 
19
20
  // update DI parent
20
- this._bpmnUpdater.updateDiParent(dataStoreBo.di, newDiParent);
21
+ this._bpmnUpdater.updateDiParent(dataStoreDi, newDiParent);
21
22
  };
22
23
 
23
24
  UpdateSemanticParentHandler.prototype.revert = function(context) {
24
25
  var dataStoreBo = context.dataStoreBo,
26
+ dataStoreDi = context.dataStoreDi,
25
27
  oldSemanticParent = context.oldSemanticParent,
26
28
  oldDiParent = context.oldDiParent;
27
29
 
@@ -29,6 +31,6 @@ UpdateSemanticParentHandler.prototype.revert = function(context) {
29
31
  this._bpmnUpdater.updateSemanticParent(dataStoreBo, oldSemanticParent);
30
32
 
31
33
  // update DI parent
32
- this._bpmnUpdater.updateDiParent(dataStoreBo.di, oldDiParent);
34
+ this._bpmnUpdater.updateDiParent(dataStoreDi, oldDiParent);
33
35
  };
34
36
 
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  assign
3
3
  } from 'min-dash';
4
+ import { getDi } from '../../util/ModelUtil';
4
5
 
5
6
 
6
7
  /**
@@ -52,7 +53,8 @@ PaletteProvider.prototype.getPaletteEntries = function(element) {
52
53
  var shape = elementFactory.createShape(assign({ type: type }, options));
53
54
 
54
55
  if (options) {
55
- shape.businessObject.di.isExpanded = options.isExpanded;
56
+ var di = getDi(shape);
57
+ di.isExpanded = options.isExpanded;
56
58
  }
57
59
 
58
60
  create.start(event, shape);
@@ -99,7 +99,7 @@ ReplaceMenuProvider.prototype.getEntries = function(element) {
99
99
  if (is(businessObject, 'bpmn:Participant')) {
100
100
 
101
101
  entries = filter(replaceOptions.PARTICIPANT, function(entry) {
102
- return isExpanded(businessObject) !== entry.target.isExpanded;
102
+ return isExpanded(element) !== entry.target.isExpanded;
103
103
  });
104
104
 
105
105
  return this._createEntries(element, entries);
@@ -195,7 +195,7 @@ ReplaceMenuProvider.prototype.getEntries = function(element) {
195
195
  }
196
196
 
197
197
  // expanded event sub processes
198
- if (isEventSubProcess(businessObject) && isExpanded(businessObject)) {
198
+ if (isEventSubProcess(businessObject) && isExpanded(element)) {
199
199
 
200
200
  entries = filter(replaceOptions.EVENT_SUB_PROCESS, differentType);
201
201
 
@@ -203,7 +203,7 @@ ReplaceMenuProvider.prototype.getEntries = function(element) {
203
203
  }
204
204
 
205
205
  // expanded sub processes
206
- if (is(businessObject, 'bpmn:SubProcess') && isExpanded(businessObject)) {
206
+ if (is(businessObject, 'bpmn:SubProcess') && isExpanded(element)) {
207
207
 
208
208
  entries = filter(replaceOptions.SUBPROCESS_EXPANDED, differentType);
209
209
 
@@ -211,7 +211,7 @@ ReplaceMenuProvider.prototype.getEntries = function(element) {
211
211
  }
212
212
 
213
213
  // collapsed ad hoc sub processes
214
- if (is(businessObject, 'bpmn:AdHocSubProcess') && !isExpanded(businessObject)) {
214
+ if (is(businessObject, 'bpmn:AdHocSubProcess') && !isExpanded(element)) {
215
215
 
216
216
  entries = filter(replaceOptions.TASK, function(entry) {
217
217
 
@@ -237,7 +237,7 @@ ReplaceMenuProvider.prototype.getEntries = function(element) {
237
237
  entries = filter(replaceOptions.TASK, differentType);
238
238
 
239
239
  // collapsed SubProcess can not be replaced with itself
240
- if (is(businessObject, 'bpmn:SubProcess') && !isExpanded(businessObject)) {
240
+ if (is(businessObject, 'bpmn:SubProcess') && !isExpanded(element)) {
241
241
  entries = filter(entries, function(entry) {
242
242
  return entry.label !== 'Sub Process (collapsed)';
243
243
  });
@@ -36,7 +36,7 @@ export function isDifferentType(element) {
36
36
 
37
37
  var isExpandedEqual = (
38
38
  target.isExpanded === undefined ||
39
- target.isExpanded === isExpanded(businessObject)
39
+ target.isExpanded === isExpanded(element)
40
40
  );
41
41
 
42
42
  return !isTypeEqual || !isEventDefinitionEqual || !isTriggeredByEventEqual || !isExpandedEqual;