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.
- package/CHANGELOG.md +15 -1
- package/dist/assets/bpmn-js.css +58 -0
- package/dist/assets/diagram-js.css +1 -0
- package/dist/bpmn-modeler.development.js +1489 -827
- package/dist/bpmn-modeler.production.min.js +7 -6
- package/dist/bpmn-navigated-viewer.development.js +20890 -19973
- package/dist/bpmn-navigated-viewer.production.min.js +22 -20
- package/dist/bpmn-viewer.development.js +20091 -19174
- package/dist/bpmn-viewer.production.min.js +22 -20
- package/lib/BaseViewer.js +0 -13
- package/lib/Viewer.js +3 -1
- package/lib/draw/BpmnRenderUtil.js +6 -4
- package/lib/draw/BpmnRenderer.js +367 -296
- package/lib/features/context-pad/ContextPadProvider.js +1 -1
- package/lib/features/copy-paste/BpmnCopyPaste.js +13 -13
- package/lib/features/copy-paste/ModdleCopy.js +19 -2
- package/lib/features/di-ordering/BpmnDiOrdering.js +2 -3
- package/lib/features/label-editing/LabelEditingPreview.js +3 -3
- package/lib/features/label-editing/cmd/UpdateLabelHandler.js +2 -1
- package/lib/features/modeling/BpmnFactory.js +8 -8
- package/lib/features/modeling/BpmnUpdater.js +35 -27
- package/lib/features/modeling/ElementFactory.js +60 -37
- package/lib/features/modeling/behavior/DataStoreBehavior.js +3 -1
- package/lib/features/modeling/behavior/IsHorizontalFix.js +7 -4
- package/lib/features/modeling/behavior/LabelBehavior.js +8 -7
- package/lib/features/modeling/behavior/ResizeBehavior.js +129 -3
- package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js +6 -6
- package/lib/features/modeling/behavior/util/ResizeUtil.js +1 -132
- package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +8 -6
- package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +19 -12
- package/lib/features/modeling/cmd/UpdateSemanticParentHandler.js +5 -3
- package/lib/features/palette/PaletteProvider.js +3 -1
- package/lib/features/popup-menu/ReplaceMenuProvider.js +5 -5
- package/lib/features/popup-menu/util/TypeUtil.js +1 -1
- package/lib/features/replace/BpmnReplace.js +29 -29
- package/lib/features/subprocess-navigation/SubprocessCentering.js +55 -0
- package/lib/features/subprocess-navigation/SubprocessCompatibility.js +135 -0
- package/lib/features/subprocess-navigation/SubprocessElements.js +55 -0
- package/lib/features/subprocess-navigation/SubprocessFlows.js +109 -0
- package/lib/features/subprocess-navigation/SubprocessOverlays.js +104 -0
- package/lib/features/subprocess-navigation/index.js +18 -0
- package/lib/import/BpmnImporter.js +76 -22
- package/lib/import/BpmnTreeWalker.js +19 -17
- package/lib/import/Importer.js +17 -6
- package/lib/util/CompatibilityUtil.js +21 -1
- package/lib/util/DiUtil.js +10 -3
- package/lib/util/LabelUtil.js +2 -3
- package/lib/util/ModelUtil.js +11 -0
- package/package.json +2 -2
- package/test/helper/index.js +6 -1
- package/test/matchers/BoundsMatchers.js +10 -10
- package/test/matchers/ConnectionMatchers.js +5 -5
- package/test/util/MockEvents.js +10 -2
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
} from '../util/LabelUtil';
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
|
+
asBounds,
|
|
14
|
+
asTRBL,
|
|
13
15
|
getMid
|
|
14
16
|
} from 'diagram-js/lib/layout/LayoutUtil';
|
|
15
17
|
|
|
@@ -26,17 +28,18 @@ import {
|
|
|
26
28
|
} from './Util';
|
|
27
29
|
|
|
28
30
|
|
|
29
|
-
function elementData(semantic, attrs) {
|
|
31
|
+
function elementData(semantic, di, attrs) {
|
|
30
32
|
return assign({
|
|
31
33
|
id: semantic.id,
|
|
32
34
|
type: semantic.$type,
|
|
33
|
-
businessObject: semantic
|
|
35
|
+
businessObject: semantic,
|
|
36
|
+
di: di
|
|
34
37
|
}, attrs);
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
function getWaypoints(
|
|
40
|
+
function getWaypoints(di, source, target) {
|
|
38
41
|
|
|
39
|
-
var waypoints =
|
|
42
|
+
var waypoints = di.waypoint;
|
|
40
43
|
|
|
41
44
|
if (!waypoints || waypoints.length < 2) {
|
|
42
45
|
return [ getMid(source), getMid(target) ];
|
|
@@ -47,6 +50,32 @@ function getWaypoints(bo, source, target) {
|
|
|
47
50
|
});
|
|
48
51
|
}
|
|
49
52
|
|
|
53
|
+
var PLANE_PADDING = 50;
|
|
54
|
+
|
|
55
|
+
function getPlaneBounds(plane) {
|
|
56
|
+
var planeTrbl = {
|
|
57
|
+
top: Infinity,
|
|
58
|
+
right: -Infinity,
|
|
59
|
+
bottom: -Infinity,
|
|
60
|
+
left: Infinity
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
plane.planeElement.forEach(function(element) {
|
|
64
|
+
if (!element.bounds) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var trbl = asTRBL(element.bounds);
|
|
69
|
+
|
|
70
|
+
planeTrbl.top = Math.min(trbl.top, planeTrbl.top);
|
|
71
|
+
planeTrbl.left = Math.min(trbl.left, planeTrbl.left);
|
|
72
|
+
planeTrbl.right = Math.max(trbl.right, planeTrbl.right);
|
|
73
|
+
planeTrbl.bottom = Math.max(trbl.bottom, planeTrbl.bottom);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
return asBounds(planeTrbl);
|
|
77
|
+
}
|
|
78
|
+
|
|
50
79
|
function notYetDrawn(translate, semantic, refSemantic, property) {
|
|
51
80
|
return new Error(translate('element {element} referenced by {referenced}#{property} not yet drawn', {
|
|
52
81
|
element: elementToString(refSemantic),
|
|
@@ -92,10 +121,8 @@ BpmnImporter.$inject = [
|
|
|
92
121
|
* Add bpmn element (semantic) to the canvas onto the
|
|
93
122
|
* specified parent shape.
|
|
94
123
|
*/
|
|
95
|
-
BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|
96
|
-
|
|
97
|
-
var di = semantic.di,
|
|
98
|
-
element,
|
|
124
|
+
BpmnImporter.prototype.add = function(semantic, di, parentElement) {
|
|
125
|
+
var element,
|
|
99
126
|
translate = this._translate,
|
|
100
127
|
hidden;
|
|
101
128
|
|
|
@@ -106,22 +133,49 @@ BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|
|
106
133
|
// invisible root element (process or collaboration)
|
|
107
134
|
if (is(di, 'bpmndi:BPMNPlane')) {
|
|
108
135
|
|
|
109
|
-
|
|
110
|
-
|
|
136
|
+
if (is(semantic, 'bpmn:SubProcess')) {
|
|
137
|
+
var plane = this._canvas.createPlane(semantic.id, element);
|
|
138
|
+
|
|
139
|
+
// Get size of expanded element
|
|
140
|
+
var bounds = getPlaneBounds(di);
|
|
141
|
+
|
|
142
|
+
var primary = this._elementRegistry.get(semantic.id);
|
|
143
|
+
element = this._elementFactory.createShape(elementData(semantic, di, {
|
|
144
|
+
collapsed: false,
|
|
145
|
+
hidden: false,
|
|
146
|
+
x: bounds.x - PLANE_PADDING,
|
|
147
|
+
y: bounds.y - PLANE_PADDING,
|
|
148
|
+
width: bounds.width + PLANE_PADDING * 2,
|
|
149
|
+
height: bounds.height + PLANE_PADDING * 2,
|
|
150
|
+
isFrame: true
|
|
151
|
+
}));
|
|
111
152
|
|
|
112
|
-
|
|
153
|
+
element.id = element.id + '_secondary';
|
|
154
|
+
element.isSecondary = true;
|
|
155
|
+
element.primaryShape = primary;
|
|
156
|
+
|
|
157
|
+
this._canvas.addShape(element, plane.rootElement);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
|
|
161
|
+
// add a virtual element (not being drawn)
|
|
162
|
+
element = this._elementFactory.createRoot(elementData(semantic, di));
|
|
163
|
+
|
|
164
|
+
this._canvas.createPlane(semantic.id, element);
|
|
165
|
+
}
|
|
113
166
|
}
|
|
114
167
|
|
|
115
168
|
// SHAPE
|
|
116
169
|
else if (is(di, 'bpmndi:BPMNShape')) {
|
|
117
170
|
|
|
118
|
-
var collapsed = !isExpanded(semantic),
|
|
171
|
+
var collapsed = !isExpanded(semantic, di),
|
|
119
172
|
isFrame = isFrameElement(semantic);
|
|
173
|
+
|
|
120
174
|
hidden = parentElement && (parentElement.hidden || parentElement.collapsed);
|
|
121
175
|
|
|
122
|
-
|
|
176
|
+
bounds = di.bounds;
|
|
123
177
|
|
|
124
|
-
element = this._elementFactory.createShape(elementData(semantic, {
|
|
178
|
+
element = this._elementFactory.createShape(elementData(semantic, di, {
|
|
125
179
|
collapsed: collapsed,
|
|
126
180
|
hidden: hidden,
|
|
127
181
|
x: Math.round(bounds.x),
|
|
@@ -144,7 +198,7 @@ BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|
|
144
198
|
|
|
145
199
|
// check whether data store is inside our outside of its semantic parent
|
|
146
200
|
if (!isPointInsideBBox(parentElement, getMid(bounds))) {
|
|
147
|
-
parentElement = this._canvas.
|
|
201
|
+
parentElement = this._canvas.findPlane(parentElement).rootElement;
|
|
148
202
|
}
|
|
149
203
|
}
|
|
150
204
|
|
|
@@ -159,11 +213,11 @@ BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|
|
159
213
|
|
|
160
214
|
hidden = parentElement && (parentElement.hidden || parentElement.collapsed);
|
|
161
215
|
|
|
162
|
-
element = this._elementFactory.createConnection(elementData(semantic, {
|
|
216
|
+
element = this._elementFactory.createConnection(elementData(semantic, di, {
|
|
163
217
|
hidden: hidden,
|
|
164
218
|
source: source,
|
|
165
219
|
target: target,
|
|
166
|
-
waypoints: getWaypoints(
|
|
220
|
+
waypoints: getWaypoints(di, source, target)
|
|
167
221
|
}));
|
|
168
222
|
|
|
169
223
|
if (is(semantic, 'bpmn:DataAssociation')) {
|
|
@@ -172,7 +226,7 @@ BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|
|
172
226
|
// are rendered correctly across different "hacks" people
|
|
173
227
|
// love to model such as cross participant / sub process
|
|
174
228
|
// associations
|
|
175
|
-
parentElement =
|
|
229
|
+
parentElement = this._canvas.findPlane(parentElement).rootElement;
|
|
176
230
|
}
|
|
177
231
|
|
|
178
232
|
// insert sequence flows behind other flow nodes (cf. #727)
|
|
@@ -190,7 +244,7 @@ BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|
|
190
244
|
|
|
191
245
|
// (optional) LABEL
|
|
192
246
|
if (isLabelExternal(semantic) && getLabel(element)) {
|
|
193
|
-
this.addLabel(semantic, element);
|
|
247
|
+
this.addLabel(semantic, di, element);
|
|
194
248
|
}
|
|
195
249
|
|
|
196
250
|
|
|
@@ -239,12 +293,12 @@ BpmnImporter.prototype._attachBoundary = function(boundarySemantic, boundaryElem
|
|
|
239
293
|
/**
|
|
240
294
|
* add label for an element
|
|
241
295
|
*/
|
|
242
|
-
BpmnImporter.prototype.addLabel = function(semantic, element) {
|
|
296
|
+
BpmnImporter.prototype.addLabel = function(semantic, di, element) {
|
|
243
297
|
var bounds,
|
|
244
298
|
text,
|
|
245
299
|
label;
|
|
246
300
|
|
|
247
|
-
bounds = getExternalLabelBounds(
|
|
301
|
+
bounds = getExternalLabelBounds(di, element);
|
|
248
302
|
|
|
249
303
|
text = getLabel(element);
|
|
250
304
|
|
|
@@ -254,7 +308,7 @@ BpmnImporter.prototype.addLabel = function(semantic, element) {
|
|
|
254
308
|
bounds = this._textRenderer.getExternalLabelBounds(bounds, text);
|
|
255
309
|
}
|
|
256
310
|
|
|
257
|
-
label = this._elementFactory.createLabel(elementData(semantic, {
|
|
311
|
+
label = this._elementFactory.createLabel(elementData(semantic, di, {
|
|
258
312
|
id: semantic.id + '_label',
|
|
259
313
|
labelTarget: element,
|
|
260
314
|
type: 'label',
|
|
@@ -4,16 +4,14 @@ import {
|
|
|
4
4
|
forEach
|
|
5
5
|
} from 'min-dash';
|
|
6
6
|
|
|
7
|
-
import Refs from 'object-refs';
|
|
8
|
-
|
|
9
7
|
import {
|
|
10
8
|
elementToString
|
|
11
9
|
} from './Util';
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
import {
|
|
12
|
+
ensureCompatDiRef
|
|
13
|
+
} from '../util/CompatibilityUtil';
|
|
14
|
+
|
|
17
15
|
|
|
18
16
|
/**
|
|
19
17
|
* Returns true if an element has the given meta-model type
|
|
@@ -48,6 +46,8 @@ export default function BpmnTreeWalker(handler, translate) {
|
|
|
48
46
|
// prerequisites are drawn
|
|
49
47
|
var deferred = [];
|
|
50
48
|
|
|
49
|
+
var diMap = {};
|
|
50
|
+
|
|
51
51
|
// Helpers //////////////////////
|
|
52
52
|
|
|
53
53
|
function contextual(fn, ctx) {
|
|
@@ -76,17 +76,17 @@ export default function BpmnTreeWalker(handler, translate) {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
// call handler
|
|
79
|
-
return handler.element(element, ctx);
|
|
79
|
+
return handler.element(element, diMap[element.id], ctx);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
function visitRoot(element, diagram) {
|
|
83
|
-
return handler.root(element, diagram);
|
|
83
|
+
return handler.root(element, diMap[element.id], diagram);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
function visitIfDi(element, ctx) {
|
|
87
87
|
|
|
88
88
|
try {
|
|
89
|
-
var gfx = element.
|
|
89
|
+
var gfx = diMap[element.id] && visit(element, ctx);
|
|
90
90
|
|
|
91
91
|
handled(element);
|
|
92
92
|
|
|
@@ -109,7 +109,7 @@ export default function BpmnTreeWalker(handler, translate) {
|
|
|
109
109
|
var bpmnElement = di.bpmnElement;
|
|
110
110
|
|
|
111
111
|
if (bpmnElement) {
|
|
112
|
-
if (bpmnElement.
|
|
112
|
+
if (diMap[bpmnElement.id]) {
|
|
113
113
|
logError(
|
|
114
114
|
translate('multiple DI elements defined for {element}', {
|
|
115
115
|
element: elementToString(bpmnElement)
|
|
@@ -117,8 +117,9 @@ export default function BpmnTreeWalker(handler, translate) {
|
|
|
117
117
|
{ element: bpmnElement }
|
|
118
118
|
);
|
|
119
119
|
} else {
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
diMap[bpmnElement.id] = di;
|
|
121
|
+
|
|
122
|
+
ensureCompatDiRef(bpmnElement);
|
|
122
123
|
}
|
|
123
124
|
} else {
|
|
124
125
|
logError(
|
|
@@ -175,6 +176,7 @@ export default function BpmnTreeWalker(handler, translate) {
|
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
// load DI from selected diagram only
|
|
179
|
+
diMap = {};
|
|
178
180
|
handleDiagram(diagram);
|
|
179
181
|
|
|
180
182
|
|
|
@@ -214,7 +216,7 @@ export default function BpmnTreeWalker(handler, translate) {
|
|
|
214
216
|
|
|
215
217
|
var ctx = visitRoot(rootElement, plane);
|
|
216
218
|
|
|
217
|
-
if (is(rootElement, 'bpmn:Process')) {
|
|
219
|
+
if (is(rootElement, 'bpmn:Process') || is(rootElement, 'bpmn:SubProcess')) {
|
|
218
220
|
handleProcess(rootElement, ctx);
|
|
219
221
|
} else if (is(rootElement, 'bpmn:Collaboration')) {
|
|
220
222
|
handleCollaboration(rootElement, ctx);
|
|
@@ -427,15 +429,15 @@ export default function BpmnTreeWalker(handler, translate) {
|
|
|
427
429
|
}
|
|
428
430
|
}
|
|
429
431
|
|
|
430
|
-
function handleCollaboration(collaboration) {
|
|
432
|
+
function handleCollaboration(collaboration, context) {
|
|
431
433
|
|
|
432
|
-
forEach(collaboration.participants, contextual(handleParticipant));
|
|
434
|
+
forEach(collaboration.participants, contextual(handleParticipant, context));
|
|
433
435
|
|
|
434
|
-
handleArtifacts(collaboration.artifacts);
|
|
436
|
+
handleArtifacts(collaboration.artifacts, context);
|
|
435
437
|
|
|
436
438
|
// handle message flows latest in the process
|
|
437
439
|
deferred.push(function() {
|
|
438
|
-
handleMessageFlows(collaboration.messageFlows);
|
|
440
|
+
handleMessageFlows(collaboration.messageFlows, context);
|
|
439
441
|
});
|
|
440
442
|
}
|
|
441
443
|
|
package/lib/import/Importer.js
CHANGED
|
@@ -33,7 +33,8 @@ export function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
|
|
|
33
33
|
|
|
34
34
|
var importer,
|
|
35
35
|
eventBus,
|
|
36
|
-
translate
|
|
36
|
+
translate,
|
|
37
|
+
canvas;
|
|
37
38
|
|
|
38
39
|
var error,
|
|
39
40
|
warnings = [];
|
|
@@ -49,12 +50,12 @@ export function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
|
|
|
49
50
|
|
|
50
51
|
var visitor = {
|
|
51
52
|
|
|
52
|
-
root: function(element) {
|
|
53
|
-
return importer.add(element);
|
|
53
|
+
root: function(element, di) {
|
|
54
|
+
return importer.add(element, di);
|
|
54
55
|
},
|
|
55
56
|
|
|
56
|
-
element: function(element, parentShape) {
|
|
57
|
-
return importer.add(element, parentShape);
|
|
57
|
+
element: function(element, di, parentShape) {
|
|
58
|
+
return importer.add(element, di, parentShape);
|
|
58
59
|
},
|
|
59
60
|
|
|
60
61
|
error: function(message, context) {
|
|
@@ -66,7 +67,16 @@ export function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
|
|
|
66
67
|
|
|
67
68
|
// traverse BPMN 2.0 document model,
|
|
68
69
|
// starting at definitions
|
|
69
|
-
|
|
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
|
+
|
|
78
|
+
var mainDiagram = bpmnDiagram || definitions.diagrams[0];
|
|
79
|
+
canvas.setActivePlane(mainDiagram.plane.bpmnElement.id);
|
|
70
80
|
}
|
|
71
81
|
|
|
72
82
|
return new Promise(function(resolve, reject) {
|
|
@@ -74,6 +84,7 @@ export function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
|
|
|
74
84
|
importer = diagram.get('bpmnImporter');
|
|
75
85
|
eventBus = diagram.get('eventBus');
|
|
76
86
|
translate = diagram.get('translate');
|
|
87
|
+
canvas = diagram.get('canvas');
|
|
77
88
|
|
|
78
89
|
eventBus.fire('import.render.start', { definitions: definitions });
|
|
79
90
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
has,
|
|
3
|
+
isFunction
|
|
4
|
+
} from 'min-dash';
|
|
2
5
|
|
|
3
6
|
// TODO(nikku): remove with future bpmn-js version
|
|
4
7
|
|
|
@@ -51,3 +54,20 @@ export function wrapForCompatibility(api) {
|
|
|
51
54
|
}
|
|
52
55
|
};
|
|
53
56
|
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// TODO(nikku): remove with future bpmn-js version
|
|
60
|
+
|
|
61
|
+
var DI_ERROR_MESSAGE = 'Tried to access di from the businessObject. The di is available through the diagram element only. For more information, see https://github.com/bpmn-io/bpmn-js/issues/1472';
|
|
62
|
+
|
|
63
|
+
export function ensureCompatDiRef(businessObject) {
|
|
64
|
+
|
|
65
|
+
// bpmnElement can have multiple independent DIs
|
|
66
|
+
if (!has(businessObject, 'di')) {
|
|
67
|
+
Object.defineProperty(businessObject, 'di', {
|
|
68
|
+
get: function() {
|
|
69
|
+
throw new Error(DI_ERROR_MESSAGE);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
package/lib/util/DiUtil.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
is,
|
|
3
|
-
getBusinessObject
|
|
3
|
+
getBusinessObject,
|
|
4
|
+
getDi
|
|
4
5
|
} from './ModelUtil';
|
|
5
6
|
|
|
6
7
|
import {
|
|
@@ -8,14 +9,20 @@ import {
|
|
|
8
9
|
} from 'min-dash';
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
export function isExpanded(element) {
|
|
12
|
+
export function isExpanded(element, di) {
|
|
12
13
|
|
|
13
14
|
if (is(element, 'bpmn:CallActivity')) {
|
|
14
15
|
return false;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
if (is(element, 'bpmn:SubProcess')) {
|
|
18
|
-
|
|
19
|
+
di = di || getDi(element);
|
|
20
|
+
|
|
21
|
+
if (di && is(di, 'bpmndi:BPMNPlane')) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return di && !!di.isExpanded;
|
|
19
26
|
}
|
|
20
27
|
|
|
21
28
|
if (is(element, 'bpmn:Participant')) {
|
package/lib/util/LabelUtil.js
CHANGED
|
@@ -116,15 +116,14 @@ export function getExternalLabelMid(element) {
|
|
|
116
116
|
* Returns the bounds of an elements label, parsed from the elements DI or
|
|
117
117
|
* generated from its bounds.
|
|
118
118
|
*
|
|
119
|
-
* @param {
|
|
119
|
+
* @param {BpmndDi} di
|
|
120
120
|
* @param {djs.model.Base} element
|
|
121
121
|
*/
|
|
122
|
-
export function getExternalLabelBounds(
|
|
122
|
+
export function getExternalLabelBounds(di, element) {
|
|
123
123
|
|
|
124
124
|
var mid,
|
|
125
125
|
size,
|
|
126
126
|
bounds,
|
|
127
|
-
di = semantic.di,
|
|
128
127
|
label = di.label;
|
|
129
128
|
|
|
130
129
|
if (label && label.bounds) {
|
package/lib/util/ModelUtil.js
CHANGED
|
@@ -22,4 +22,15 @@ export function is(element, type) {
|
|
|
22
22
|
*/
|
|
23
23
|
export function getBusinessObject(element) {
|
|
24
24
|
return (element && element.businessObject) || element;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Return the di object for a given element.
|
|
29
|
+
*
|
|
30
|
+
* @param {djs.model.Base} element
|
|
31
|
+
*
|
|
32
|
+
* @return {ModdleElement}
|
|
33
|
+
*/
|
|
34
|
+
export function getDi(element) {
|
|
35
|
+
return element && element.di;
|
|
25
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmn-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0-subprocesses.1",
|
|
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.
|
|
103
|
+
"diagram-js": "^7.6.0",
|
|
104
104
|
"diagram-js-direct-editing": "^1.6.3",
|
|
105
105
|
"ids": "^1.0.0",
|
|
106
106
|
"inherits": "^2.0.4",
|
package/test/helper/index.js
CHANGED
|
@@ -256,7 +256,12 @@ export function createViewer(container, viewerInstance, xml, diagramId) {
|
|
|
256
256
|
|
|
257
257
|
clearBpmnJS();
|
|
258
258
|
|
|
259
|
-
var viewer = new viewerInstance({
|
|
259
|
+
var viewer = new viewerInstance({
|
|
260
|
+
container: container,
|
|
261
|
+
canvas: {
|
|
262
|
+
deferUpdate: false
|
|
263
|
+
}
|
|
264
|
+
});
|
|
260
265
|
|
|
261
266
|
setBpmnJS(viewer);
|
|
262
267
|
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from 'min-dash';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
getDi
|
|
7
7
|
} from 'lib/util/ModelUtil';
|
|
8
8
|
|
|
9
9
|
var BOUNDS_ATTRS = [ 'x', 'y', 'width', 'height' ],
|
|
@@ -82,11 +82,11 @@ export default function(chai, utils) {
|
|
|
82
82
|
Assertion.addMethod('diBounds', function(exp) {
|
|
83
83
|
var obj = this._obj;
|
|
84
84
|
|
|
85
|
-
var
|
|
85
|
+
var di = getDi(obj);
|
|
86
86
|
|
|
87
|
-
expect(
|
|
87
|
+
expect(di).to.exist;
|
|
88
88
|
|
|
89
|
-
assertBounds(this,
|
|
89
|
+
assertBounds(this, di.id, getBounds(di), getBounds(exp));
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
/**
|
|
@@ -125,11 +125,11 @@ export default function(chai, utils) {
|
|
|
125
125
|
|
|
126
126
|
var obj = this._obj;
|
|
127
127
|
|
|
128
|
-
var
|
|
128
|
+
var di = getDi(obj);
|
|
129
129
|
|
|
130
|
-
expect(
|
|
130
|
+
expect(di).to.exist;
|
|
131
131
|
|
|
132
|
-
assertDimensions(this,
|
|
132
|
+
assertDimensions(this, di.id, getDimensions(di), getDimensions(exp));
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
|
|
@@ -169,11 +169,11 @@ export default function(chai, utils) {
|
|
|
169
169
|
|
|
170
170
|
var obj = this._obj;
|
|
171
171
|
|
|
172
|
-
var
|
|
172
|
+
var di = getDi(obj);
|
|
173
173
|
|
|
174
|
-
expect(
|
|
174
|
+
expect(di).to.exist;
|
|
175
175
|
|
|
176
|
-
assertPosition(this,
|
|
176
|
+
assertPosition(this, di.id, getPosition(di), getPosition(exp));
|
|
177
177
|
});
|
|
178
178
|
|
|
179
179
|
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from 'min-dash';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
getDi
|
|
7
7
|
} from 'lib/util/ModelUtil';
|
|
8
8
|
|
|
9
9
|
var POSITION_ATTRS = [ 'x', 'y' ];
|
|
@@ -61,13 +61,13 @@ export default function(chai, utils) {
|
|
|
61
61
|
Assertion.addMethod('diWaypoints', function(exp) {
|
|
62
62
|
var obj = this._obj;
|
|
63
63
|
|
|
64
|
-
var
|
|
64
|
+
var di = getDi(obj);
|
|
65
65
|
|
|
66
|
-
expect(
|
|
66
|
+
expect(di).to.exist;
|
|
67
67
|
|
|
68
|
-
expect(
|
|
68
|
+
expect(di).to.have.property('waypoint');
|
|
69
69
|
|
|
70
|
-
assertWaypoints(this,
|
|
70
|
+
assertWaypoints(this, di + '#waypoint', getPoints(di.waypoint), getPoints(exp));
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
|
package/test/util/MockEvents.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
* specified canvas local coordinates.
|
|
14
14
|
*
|
|
15
15
|
* @param {Point} point of the event local the canvas (closure)
|
|
16
|
-
* @param {Object} data
|
|
16
|
+
* @param {Object} [data]
|
|
17
17
|
*
|
|
18
18
|
* @return {Event} event, scoped to the given canvas
|
|
19
19
|
*/
|
|
@@ -34,7 +34,15 @@ export function createCanvasEvent(position, data) {
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Create an Event
|
|
39
|
+
*
|
|
40
|
+
* @param {Element} target
|
|
41
|
+
* @param { { x: number, y: number } } position
|
|
42
|
+
* @param {any} [data]
|
|
43
|
+
*
|
|
44
|
+
* @return {Event}
|
|
45
|
+
*/
|
|
38
46
|
export function createEvent(target, position, data) {
|
|
39
47
|
|
|
40
48
|
return getBpmnJS().invoke(function(eventBus) {
|