bpmn-js 9.0.0-subprocesses.3 → 9.0.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 (44) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/assets/bpmn-js.css +44 -7
  3. package/dist/assets/diagram-js.css +1 -1
  4. package/dist/bpmn-modeler.development.js +2424 -1130
  5. package/dist/bpmn-modeler.production.min.js +8 -8
  6. package/dist/bpmn-navigated-viewer.development.js +990 -317
  7. package/dist/bpmn-navigated-viewer.production.min.js +6 -6
  8. package/dist/bpmn-viewer.development.js +989 -316
  9. package/dist/bpmn-viewer.production.min.js +6 -6
  10. package/lib/BaseViewer.js +1 -1
  11. package/lib/draw/BpmnRenderer.js +8 -7
  12. package/lib/features/auto-resize/BpmnAutoResizeProvider.js +6 -0
  13. package/lib/features/copy-paste/BpmnCopyPaste.js +1 -0
  14. package/lib/features/di-ordering/BpmnDiOrdering.js +15 -11
  15. package/lib/features/drilldown/DrilldownBreadcrumbs.js +122 -0
  16. package/lib/features/drilldown/DrilldownCentering.js +87 -10
  17. package/lib/features/drilldown/DrilldownOverlayBehavior.js +181 -0
  18. package/lib/features/drilldown/SubprocessCompatibility.js +15 -7
  19. package/lib/features/drilldown/index.js +7 -4
  20. package/lib/features/label-editing/LabelEditingProvider.js +1 -1
  21. package/lib/features/label-editing/cmd/UpdateLabelHandler.js +29 -2
  22. package/lib/features/modeling/BpmnFactory.js +5 -1
  23. package/lib/features/modeling/BpmnUpdater.js +43 -1
  24. package/lib/features/modeling/ElementFactory.js +4 -0
  25. package/lib/features/modeling/behavior/CreateParticipantBehavior.js +59 -84
  26. package/lib/features/modeling/behavior/DropOnFlowBehavior.js +2 -2
  27. package/lib/features/modeling/behavior/GroupBehavior.js +6 -18
  28. package/lib/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.js +34 -0
  29. package/lib/features/modeling/behavior/SubProcessPlaneBehavior.js +557 -0
  30. package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.js +74 -0
  31. package/lib/features/modeling/behavior/UnclaimIdBehavior.js +3 -1
  32. package/lib/features/modeling/behavior/index.js +27 -18
  33. package/lib/features/modeling/cmd/SetColorHandler.js +23 -6
  34. package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +4 -2
  35. package/lib/features/modeling/util/ModelingUtil.js +2 -20
  36. package/lib/features/ordering/BpmnOrderingProvider.js +3 -3
  37. package/lib/features/palette/PaletteProvider.js +1 -1
  38. package/lib/features/popup-menu/ReplaceMenuProvider.js +1 -1
  39. package/lib/import/BpmnImporter.js +15 -9
  40. package/lib/import/Importer.js +130 -10
  41. package/lib/util/DrilldownUtil.js +66 -0
  42. package/lib/util/ModelUtil.js +19 -0
  43. package/package.json +2 -2
  44. package/lib/features/drilldown/DrilldownOverlays.js +0 -110
@@ -3,9 +3,7 @@ import AppendBehavior from './AppendBehavior';
3
3
  import AssociationBehavior from './AssociationBehavior';
4
4
  import AttachEventBehavior from './AttachEventBehavior';
5
5
  import BoundaryEventBehavior from './BoundaryEventBehavior';
6
- import RootElementReferenceBehavior from './RootElementReferenceBehavior';
7
6
  import CreateBehavior from './CreateBehavior';
8
- import FixHoverBehavior from './FixHoverBehavior';
9
7
  import CreateDataObjectBehavior from './CreateDataObjectBehavior';
10
8
  import CreateParticipantBehavior from './CreateParticipantBehavior';
11
9
  import DataInputAssociationBehavior from './DataInputAssociationBehavior';
@@ -14,24 +12,29 @@ import DeleteLaneBehavior from './DeleteLaneBehavior';
14
12
  import DetachEventBehavior from './DetachEventBehavior';
15
13
  import DropOnFlowBehavior from './DropOnFlowBehavior';
16
14
  import EventBasedGatewayBehavior from './EventBasedGatewayBehavior';
15
+ import FixHoverBehavior from './FixHoverBehavior';
17
16
  import GroupBehavior from './GroupBehavior';
18
17
  import ImportDockingFix from './ImportDockingFix';
19
18
  import IsHorizontalFix from './IsHorizontalFix';
20
19
  import LabelBehavior from './LabelBehavior';
21
20
  import MessageFlowBehavior from './MessageFlowBehavior';
22
21
  import ModelingFeedback from './ModelingFeedback';
23
- import ReplaceConnectionBehavior from './ReplaceConnectionBehavior';
22
+ import RemoveEmbeddedLabelBoundsBehavior from './RemoveEmbeddedLabelBoundsBehavior';
23
+ import RemoveElementBehavior from './RemoveElementBehavior';
24
24
  import RemoveParticipantBehavior from './RemoveParticipantBehavior';
25
+ import ReplaceConnectionBehavior from './ReplaceConnectionBehavior';
25
26
  import ReplaceElementBehaviour from './ReplaceElementBehaviour';
26
27
  import ResizeBehavior from './ResizeBehavior';
27
28
  import ResizeLaneBehavior from './ResizeLaneBehavior';
28
- import RemoveElementBehavior from './RemoveElementBehavior';
29
+ import RootElementReferenceBehavior from './RootElementReferenceBehavior';
29
30
  import SpaceToolBehavior from './SpaceToolBehavior';
31
+ import SubProcessPlaneBehavior from './SubProcessPlaneBehavior';
30
32
  import SubProcessStartEventBehavior from './SubProcessStartEventBehavior';
33
+ import ToggleCollapseConnectionBehaviour from './ToggleCollapseConnectionBehaviour';
31
34
  import ToggleElementCollapseBehaviour from './ToggleElementCollapseBehaviour';
32
35
  import UnclaimIdBehavior from './UnclaimIdBehavior';
33
- import UpdateFlowNodeRefsBehavior from './UpdateFlowNodeRefsBehavior';
34
36
  import UnsetDefaultFlowBehavior from './UnsetDefaultFlowBehavior';
37
+ import UpdateFlowNodeRefsBehavior from './UpdateFlowNodeRefsBehavior';
35
38
 
36
39
  export default {
37
40
  __init__: [
@@ -40,17 +43,16 @@ export default {
40
43
  'associationBehavior',
41
44
  'attachEventBehavior',
42
45
  'boundaryEventBehavior',
43
- 'rootElementReferenceBehavior',
44
46
  'createBehavior',
45
- 'fixHoverBehavior',
46
47
  'createDataObjectBehavior',
47
48
  'createParticipantBehavior',
48
- 'dataStoreBehavior',
49
49
  'dataInputAssociationBehavior',
50
+ 'dataStoreBehavior',
50
51
  'deleteLaneBehavior',
51
52
  'detachEventBehavior',
52
53
  'dropOnFlowBehavior',
53
54
  'eventBasedGatewayBehavior',
55
+ 'fixHoverBehavior',
54
56
  'groupBehavior',
55
57
  'importDockingFix',
56
58
  'isHorizontalFix',
@@ -58,26 +60,28 @@ export default {
58
60
  'messageFlowBehavior',
59
61
  'modelingFeedback',
60
62
  'removeElementBehavior',
63
+ 'removeEmbeddedLabelBoundsBehavior',
61
64
  'removeParticipantBehavior',
62
65
  'replaceConnectionBehavior',
63
66
  'replaceElementBehaviour',
64
67
  'resizeBehavior',
65
68
  'resizeLaneBehavior',
66
- 'toggleElementCollapseBehaviour',
69
+ 'rootElementReferenceBehavior',
67
70
  'spaceToolBehavior',
71
+ 'subProcessPlaneBehavior',
68
72
  'subProcessStartEventBehavior',
73
+ 'toggleCollapseConnectionBehaviour',
74
+ 'toggleElementCollapseBehaviour',
69
75
  'unclaimIdBehavior',
70
- 'unsetDefaultFlowBehavior',
71
- 'updateFlowNodeRefsBehavior'
76
+ 'updateFlowNodeRefsBehavior',
77
+ 'unsetDefaultFlowBehavior'
72
78
  ],
73
79
  adaptiveLabelPositioningBehavior: [ 'type', AdaptiveLabelPositioningBehavior ],
74
80
  appendBehavior: [ 'type', AppendBehavior ],
75
81
  associationBehavior: [ 'type', AssociationBehavior ],
76
82
  attachEventBehavior: [ 'type', AttachEventBehavior ],
77
83
  boundaryEventBehavior: [ 'type', BoundaryEventBehavior ],
78
- rootElementReferenceBehavior: [ 'type', RootElementReferenceBehavior ],
79
84
  createBehavior: [ 'type', CreateBehavior ],
80
- fixHoverBehavior: [ 'type', FixHoverBehavior ],
81
85
  createDataObjectBehavior: [ 'type', CreateDataObjectBehavior ],
82
86
  createParticipantBehavior: [ 'type', CreateParticipantBehavior ],
83
87
  dataInputAssociationBehavior: [ 'type', DataInputAssociationBehavior ],
@@ -86,22 +90,27 @@ export default {
86
90
  detachEventBehavior: [ 'type', DetachEventBehavior ],
87
91
  dropOnFlowBehavior: [ 'type', DropOnFlowBehavior ],
88
92
  eventBasedGatewayBehavior: [ 'type', EventBasedGatewayBehavior ],
93
+ fixHoverBehavior: [ 'type', FixHoverBehavior ],
89
94
  groupBehavior: [ 'type', GroupBehavior ],
90
95
  importDockingFix: [ 'type', ImportDockingFix ],
91
96
  isHorizontalFix: [ 'type', IsHorizontalFix ],
92
97
  labelBehavior: [ 'type', LabelBehavior ],
93
98
  messageFlowBehavior: [ 'type', MessageFlowBehavior ],
94
99
  modelingFeedback: [ 'type', ModelingFeedback ],
95
- replaceConnectionBehavior: [ 'type', ReplaceConnectionBehavior ],
100
+ removeElementBehavior: [ 'type', RemoveElementBehavior ],
101
+ removeEmbeddedLabelBoundsBehavior: ['type', RemoveEmbeddedLabelBoundsBehavior ],
96
102
  removeParticipantBehavior: [ 'type', RemoveParticipantBehavior ],
103
+ replaceConnectionBehavior: [ 'type', ReplaceConnectionBehavior ],
97
104
  replaceElementBehaviour: [ 'type', ReplaceElementBehaviour ],
98
105
  resizeBehavior: [ 'type', ResizeBehavior ],
99
106
  resizeLaneBehavior: [ 'type', ResizeLaneBehavior ],
100
- removeElementBehavior: [ 'type', RemoveElementBehavior ],
101
- toggleElementCollapseBehaviour : [ 'type', ToggleElementCollapseBehaviour ],
107
+ rootElementReferenceBehavior: [ 'type', RootElementReferenceBehavior ],
102
108
  spaceToolBehavior: [ 'type', SpaceToolBehavior ],
109
+ subProcessPlaneBehavior: [ 'type', SubProcessPlaneBehavior ],
103
110
  subProcessStartEventBehavior: [ 'type', SubProcessStartEventBehavior ],
111
+ toggleCollapseConnectionBehaviour: [ 'type', ToggleCollapseConnectionBehaviour ],
112
+ toggleElementCollapseBehaviour : [ 'type', ToggleElementCollapseBehaviour ],
104
113
  unclaimIdBehavior: [ 'type', UnclaimIdBehavior ],
105
- updateFlowNodeRefsBehavior: [ 'type', UpdateFlowNodeRefsBehavior ],
106
- unsetDefaultFlowBehavior: [ 'type', UnsetDefaultFlowBehavior ]
114
+ unsetDefaultFlowBehavior: [ 'type', UnsetDefaultFlowBehavior ],
115
+ updateFlowNodeRefsBehavior: [ 'type', UpdateFlowNodeRefsBehavior ]
107
116
  };
@@ -5,6 +5,9 @@ import {
5
5
  pick
6
6
  } from 'min-dash';
7
7
 
8
+ import {
9
+ getDi
10
+ } from '../../../util/ModelUtil';
8
11
 
9
12
  var DEFAULT_COLORS = {
10
13
  fill: undefined,
@@ -63,12 +66,26 @@ SetColorHandler.prototype.postExecute = function(context) {
63
66
  // TODO @barmac: remove once we drop bpmn.io properties
64
67
  ensureLegacySupport(assignedDi);
65
68
 
66
- self._commandStack.execute('element.updateProperties', {
67
- element: element,
68
- properties: {
69
- di: assignedDi
70
- }
71
- });
69
+ if (element.labelTarget) {
70
+
71
+ // set label colors as bpmndi:BPMNLabel#color
72
+ self._commandStack.execute('element.updateModdleProperties', {
73
+ element: element,
74
+ moddleElement: getDi(element).label,
75
+ properties: {
76
+ color: di['background-color']
77
+ }
78
+ });
79
+ } else {
80
+
81
+ // set colors bpmndi:BPMNEdge or bpmndi:BPMNShape
82
+ self._commandStack.execute('element.updateProperties', {
83
+ element: element,
84
+ properties: {
85
+ di: assignedDi
86
+ }
87
+ });
88
+ }
72
89
  });
73
90
 
74
91
  };
@@ -29,7 +29,8 @@ UpdateCanvasRootHandler.prototype.execute = function(context) {
29
29
  diPlane = getDi(oldRoot);
30
30
 
31
31
  // (1) replace process old <> new root
32
- canvas.setRootElement(newRoot, true);
32
+ canvas.setRootElement(newRoot);
33
+ canvas.removeRootElement(oldRoot);
33
34
 
34
35
  // (2) update root elements
35
36
  collectionAdd(bpmnDefinitions.rootElements, newRootBusinessObject);
@@ -63,7 +64,8 @@ UpdateCanvasRootHandler.prototype.revert = function(context) {
63
64
  diPlane = getDi(newRoot);
64
65
 
65
66
  // (1) replace process old <> new root
66
- canvas.setRootElement(oldRoot, true);
67
+ canvas.setRootElement(oldRoot);
68
+ canvas.removeRootElement(newRoot);
67
69
 
68
70
  // (2) update root elements
69
71
  collectionRemove(bpmnDefinitions.rootElements, newRootBusinessObject);
@@ -1,24 +1,6 @@
1
- import {
2
- some
3
- } from 'min-dash';
4
-
5
- import { is } from '../../../util/ModelUtil';
6
-
7
-
8
- /**
9
- * Return true if element has any of the given types.
10
- *
11
- * @param {djs.model.Base} element
12
- * @param {Array<string>} types
13
- *
14
- * @return {boolean}
15
- */
16
- export function isAny(element, types) {
17
- return some(types, function(t) {
18
- return is(element, t);
19
- });
20
- }
1
+ export { is, isAny } from '../../../util/ModelUtil';
21
2
 
3
+ import { isAny } from '../../../util/ModelUtil';
22
4
 
23
5
  /**
24
6
  * Return the parent of the element with any of the given types.
@@ -42,7 +42,7 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) {
42
42
  level: 9,
43
43
  containers: [
44
44
  'bpmn:Collaboration',
45
- 'bpmn:Process'
45
+ 'bpmn:FlowElementsContainer'
46
46
  ]
47
47
  }
48
48
  },
@@ -70,7 +70,7 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) {
70
70
  level: 10,
71
71
  containers: [
72
72
  'bpmn:Collaboration',
73
- 'bpmn:Process'
73
+ 'bpmn:FlowElementsContainer'
74
74
  ]
75
75
  }
76
76
  },
@@ -131,7 +131,7 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) {
131
131
  // render labels always on top
132
132
  if (element.labelTarget) {
133
133
  return {
134
- parent: canvas.getRootElement(),
134
+ parent: canvas.findRoot(element.labelTarget) || canvas.getRootElement(),
135
135
  index: -1
136
136
  };
137
137
  }
@@ -90,7 +90,7 @@ PaletteProvider.prototype.getPaletteEntries = function(element) {
90
90
 
91
91
  create.start(event, [ subProcess, startEvent ], {
92
92
  hints: {
93
- autoSelect: [ startEvent ]
93
+ autoSelect: [ subProcess ]
94
94
  }
95
95
  });
96
96
  }
@@ -83,7 +83,7 @@ ReplaceMenuProvider.prototype.getEntries = function(element) {
83
83
  return this._createEntries(element, replaceOptions.DATA_OBJECT_REFERENCE);
84
84
  }
85
85
 
86
- if (is(businessObject, 'bpmn:DataStoreReference')) {
86
+ if (is(businessObject, 'bpmn:DataStoreReference') && !is(element.parent, 'bpmn:Collaboration')) {
87
87
  return this._createEntries(element, replaceOptions.DATA_STORE_REFERENCE);
88
88
  }
89
89
 
@@ -26,6 +26,13 @@ import {
26
26
  } from './Util';
27
27
 
28
28
 
29
+ /**
30
+ * @param {ModdleElement} semantic
31
+ * @param {ModdleElement} di
32
+ * @param {Object} [attrs=null]
33
+ *
34
+ * @return {Object}
35
+ */
29
36
  function elementData(semantic, di, attrs) {
30
37
  return assign({
31
38
  id: semantic.id,
@@ -105,15 +112,14 @@ BpmnImporter.prototype.add = function(semantic, di, parentElement) {
105
112
  // invisible root element (process, subprocess or collaboration)
106
113
  if (is(di, 'bpmndi:BPMNPlane')) {
107
114
 
108
- // add a virtual element (not being drawn)
109
- element = this._elementFactory.createRoot(elementData(semantic, di));
115
+ var attrs = is(semantic, 'bpmn:SubProcess')
116
+ ? { id: semantic.id + '_plane' }
117
+ : {};
110
118
 
111
- // for subprocesses, the id is already defined on the collapsed shape
112
- if (is(semantic, 'bpmn:SubProcess')) {
113
- element.id = element.id + '_plane';
114
- }
119
+ // add a virtual element (not being drawn)
120
+ element = this._elementFactory.createRoot(elementData(semantic, di, attrs));
115
121
 
116
- this._canvas.createPlane(semantic.id, element);
122
+ this._canvas.addRootElement(element);
117
123
  }
118
124
 
119
125
  // SHAPE
@@ -149,7 +155,7 @@ BpmnImporter.prototype.add = function(semantic, di, parentElement) {
149
155
 
150
156
  // check whether data store is inside our outside of its semantic parent
151
157
  if (!isPointInsideBBox(parentElement, getMid(bounds))) {
152
- parentElement = this._canvas.findPlane(parentElement).rootElement;
158
+ parentElement = this._canvas.findRoot(parentElement);
153
159
  }
154
160
  }
155
161
 
@@ -177,7 +183,7 @@ BpmnImporter.prototype.add = function(semantic, di, parentElement) {
177
183
  // are rendered correctly across different "hacks" people
178
184
  // love to model such as cross participant / sub process
179
185
  // associations
180
- parentElement = this._canvas.findPlane(parentElement).rootElement;
186
+ parentElement = this._canvas.findRoot(parentElement);
181
187
  }
182
188
 
183
189
  // insert sequence flows behind other flow nodes (cf. #727)
@@ -1,5 +1,13 @@
1
+ import {
2
+ find,
3
+ forEach,
4
+ map
5
+ } from 'min-dash';
6
+
1
7
  import BpmnTreeWalker from './BpmnTreeWalker';
2
8
 
9
+ import { is } from '../util/ModelUtil';
10
+
3
11
 
4
12
  /**
5
13
  * The importBpmnDiagram result.
@@ -65,18 +73,29 @@ export function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
65
73
 
66
74
  var walker = new BpmnTreeWalker(visitor, translate);
67
75
 
68
- // traverse BPMN 2.0 document model,
69
- // starting at definitions
70
- if (!bpmnDiagram && definitions.diagrams) {
71
- for (var i = 0; i < definitions.diagrams.length; i++) {
72
- walker.handleDefinitions(definitions, definitions.diagrams[i]);
73
- }
74
- } else {
75
- walker.handleDefinitions(definitions, bpmnDiagram);
76
+
77
+ bpmnDiagram = bpmnDiagram || (definitions.diagrams && definitions.diagrams[0]);
78
+
79
+ var diagramsToImport = getDiagramsToImport(definitions, bpmnDiagram);
80
+
81
+ if (!diagramsToImport) {
82
+ throw new Error(translate('no diagram to display'));
76
83
  }
77
84
 
78
- var mainDiagram = bpmnDiagram || definitions.diagrams[0];
79
- canvas.setActivePlane(mainDiagram.plane.bpmnElement.id);
85
+ // traverse BPMN 2.0 document model,
86
+ // starting at definitions
87
+ forEach(diagramsToImport, function(diagram) {
88
+ walker.handleDefinitions(definitions, diagram);
89
+ });
90
+
91
+ var rootId = bpmnDiagram.plane.bpmnElement.id;
92
+
93
+ // we do need to account for different ways we create root elements
94
+ // each nested imported <root> do have the `_plane` suffix, while
95
+ // the root <root> is found under the business object ID
96
+ canvas.setRootElement(
97
+ canvas.findRoot(rootId + '_plane') || canvas.findRoot(rootId)
98
+ );
80
99
  }
81
100
 
82
101
  return new Promise(function(resolve, reject) {
@@ -103,3 +122,104 @@ export function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
103
122
  }
104
123
  });
105
124
  }
125
+
126
+ /**
127
+ * Returns all diagrams in the same hirarchy as the requested diagram.
128
+ * Includes all parent and sub process diagrams.
129
+ *
130
+ * @param {Array} definitions
131
+ * @param {Object} bpmnDiagram
132
+ *
133
+ * @returns {Array<Object>}
134
+ */
135
+ function getDiagramsToImport(definitions, bpmnDiagram) {
136
+ if (!bpmnDiagram) {
137
+ return;
138
+ }
139
+
140
+ var bpmnElement = bpmnDiagram.plane.bpmnElement,
141
+ rootElement = bpmnElement;
142
+
143
+ if (!is(bpmnElement, 'bpmn:Process') && !is(bpmnElement, 'bpmn:Collaboration')) {
144
+ rootElement = findRootProcess(bpmnElement);
145
+ }
146
+
147
+ // in case the process is part of a collaboration, the plane references the
148
+ // collaboration, not the process
149
+ var collaboration;
150
+
151
+ if (is(rootElement, 'bpmn:Collaboration')) {
152
+ collaboration = rootElement;
153
+ } else {
154
+ collaboration = find(definitions.rootElements, function(element) {
155
+ if (!is(element, 'bpmn:Collaboration')) {
156
+ return;
157
+ }
158
+
159
+ return find(element.participants, function(participant) {
160
+ return participant.processRef === rootElement;
161
+ });
162
+ });
163
+ }
164
+
165
+ var rootElements = [ rootElement ];
166
+
167
+ // all collaboration processes can contain sub-diagrams
168
+ if (collaboration) {
169
+ rootElements = map(collaboration.participants, function(participant) {
170
+ return participant.processRef;
171
+ });
172
+
173
+ rootElements.push(collaboration);
174
+ }
175
+
176
+ var allChildren = selfAndAllFlowElements(rootElements);
177
+
178
+ // if we have multiple diagrams referencing the same element, we
179
+ // use the first in the file
180
+ var diagramsToImport = [ bpmnDiagram ];
181
+ var handledElements = [ bpmnElement ];
182
+
183
+ forEach(definitions.diagrams, function(diagram) {
184
+ var businessObject = diagram.plane.bpmnElement;
185
+
186
+ if (
187
+ allChildren.indexOf(businessObject) !== -1 &&
188
+ handledElements.indexOf(businessObject) === -1
189
+ ) {
190
+ diagramsToImport.push(diagram);
191
+ handledElements.push(businessObject);
192
+ }
193
+ });
194
+
195
+
196
+ return diagramsToImport;
197
+ }
198
+
199
+ function selfAndAllFlowElements(elements) {
200
+ var result = [];
201
+
202
+ forEach(elements, function(element) {
203
+ if (!element) {
204
+ return;
205
+ }
206
+
207
+ result.push(element);
208
+
209
+ result = result.concat(selfAndAllFlowElements(element.flowElements));
210
+ });
211
+
212
+ return result;
213
+ }
214
+
215
+ function findRootProcess(element) {
216
+ var parent = element;
217
+
218
+ while (parent) {
219
+ if (is(parent, 'bpmn:Process')) {
220
+ return parent;
221
+ }
222
+
223
+ parent = parent.$parent;
224
+ }
225
+ }
@@ -0,0 +1,66 @@
1
+ import { getDi, is } from './ModelUtil';
2
+
3
+
4
+ export var planeSuffix = '_plane';
5
+
6
+ /**
7
+ * Get primary shape ID for a plane.
8
+ *
9
+ * @param {djs.model.Base|ModdleElement} element
10
+ *
11
+ * @returns {String}
12
+ */
13
+ export function getShapeIdFromPlane(element) {
14
+ var id = element.id;
15
+
16
+ return removePlaneSuffix(id);
17
+ }
18
+
19
+ /**
20
+ * Get plane ID for a primary shape.
21
+ *
22
+ * @param {djs.model.Base|ModdleElement} element
23
+ *
24
+ * @returns {String}
25
+ */
26
+ export function getPlaneIdFromShape(element) {
27
+ var id = element.id;
28
+
29
+ if (is(element, 'bpmn:SubProcess')) {
30
+ return addPlaneSuffix(id);
31
+ }
32
+
33
+ return id;
34
+ }
35
+
36
+ /**
37
+ * Get plane ID for primary shape ID.
38
+ *
39
+ * @param {String} id
40
+ *
41
+ * @returns {String}
42
+ */
43
+ export function toPlaneId(id) {
44
+ return addPlaneSuffix(id);
45
+ }
46
+
47
+ /**
48
+ * Check wether element is plane.
49
+ *
50
+ * @param {djs.model.Base|ModdleElement} element
51
+ *
52
+ * @returns {Boolean}
53
+ */
54
+ export function isPlane(element) {
55
+ var di = getDi(element);
56
+
57
+ return is(di, 'bpmndi:BPMNPlane');
58
+ }
59
+
60
+ function addPlaneSuffix(id) {
61
+ return id + planeSuffix;
62
+ }
63
+
64
+ function removePlaneSuffix(id) {
65
+ return id.replace(new RegExp(planeSuffix + '$'), '');
66
+ }
@@ -1,3 +1,8 @@
1
+ import {
2
+ some
3
+ } from 'min-dash';
4
+
5
+
1
6
  /**
2
7
  * Is an element of the given BPMN type?
3
8
  *
@@ -13,6 +18,20 @@ export function is(element, type) {
13
18
  }
14
19
 
15
20
 
21
+ /**
22
+ * Return true if element has any of the given types.
23
+ *
24
+ * @param {djs.model.Base} element
25
+ * @param {Array<string>} types
26
+ *
27
+ * @return {boolean}
28
+ */
29
+ export function isAny(element, types) {
30
+ return some(types, function(t) {
31
+ return is(element, t);
32
+ });
33
+ }
34
+
16
35
  /**
17
36
  * Return the business object for a given element.
18
37
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmn-js",
3
- "version": "9.0.0-subprocesses.3",
3
+ "version": "9.0.2",
4
4
  "description": "A bpmn 2.0 toolkit and web modeler",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -100,7 +100,7 @@
100
100
  "dependencies": {
101
101
  "bpmn-moddle": "^7.1.2",
102
102
  "css.escape": "^1.5.1",
103
- "diagram-js": "^7.8.1",
103
+ "diagram-js": "^8.1.2",
104
104
  "diagram-js-direct-editing": "^1.6.3",
105
105
  "ids": "^1.0.0",
106
106
  "inherits": "^2.0.4",