bpmn-js 8.9.0 → 9.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/assets/bpmn-js.css +113 -0
- package/dist/bpmn-modeler.development.js +2600 -991
- package/dist/bpmn-modeler.production.min.js +9 -8
- package/dist/bpmn-navigated-viewer.development.js +21240 -19985
- package/dist/bpmn-navigated-viewer.production.min.js +22 -20
- package/dist/bpmn-viewer.development.js +20441 -19186
- package/dist/bpmn-viewer.production.min.js +22 -20
- package/lib/BaseViewer.js +1 -14
- package/lib/Viewer.js +3 -1
- package/lib/draw/BpmnRenderUtil.js +6 -4
- package/lib/features/auto-resize/BpmnAutoResizeProvider.js +6 -0
- package/lib/features/context-pad/ContextPadProvider.js +1 -1
- package/lib/features/copy-paste/BpmnCopyPaste.js +14 -13
- package/lib/features/di-ordering/BpmnDiOrdering.js +16 -13
- package/lib/features/drilldown/DrilldownBreadcrumbs.js +122 -0
- package/lib/features/drilldown/DrilldownCentering.js +118 -0
- package/lib/features/drilldown/DrilldownOverlayBehavior.js +181 -0
- package/lib/features/drilldown/SubprocessCompatibility.js +196 -0
- package/lib/features/drilldown/index.js +17 -0
- package/lib/features/label-editing/LabelEditingPreview.js +3 -3
- package/lib/features/label-editing/cmd/UpdateLabelHandler.js +31 -3
- package/lib/features/modeling/BpmnFactory.js +11 -8
- package/lib/features/modeling/BpmnUpdater.js +35 -27
- package/lib/features/modeling/ElementFactory.js +64 -37
- package/lib/features/modeling/behavior/CreateParticipantBehavior.js +59 -84
- 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/SubProcessPlaneBehavior.js +550 -0
- package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.js +74 -0
- package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js +6 -6
- package/lib/features/modeling/behavior/UnclaimIdBehavior.js +3 -1
- package/lib/features/modeling/behavior/index.js +6 -0
- package/lib/features/modeling/cmd/SetColorHandler.js +4 -1
- package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +12 -8
- package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +19 -12
- package/lib/features/modeling/cmd/UpdateSemanticParentHandler.js +5 -3
- package/lib/features/modeling/util/ModelingUtil.js +2 -20
- package/lib/features/ordering/BpmnOrderingProvider.js +1 -1
- package/lib/features/palette/PaletteProvider.js +3 -1
- package/lib/features/popup-menu/ReplaceMenuProvider.js +6 -6
- package/lib/features/popup-menu/util/TypeUtil.js +1 -1
- package/lib/features/replace/BpmnReplace.js +29 -29
- package/lib/import/BpmnImporter.js +33 -22
- package/lib/import/BpmnTreeWalker.js +19 -17
- package/lib/import/Importer.js +137 -6
- package/lib/util/CompatibilityUtil.js +21 -1
- package/lib/util/DiUtil.js +10 -3
- package/lib/util/DrilldownUtil.js +66 -0
- package/lib/util/LabelUtil.js +2 -3
- package/lib/util/ModelUtil.js +30 -0
- package/package.json +2 -2
- package/test/matchers/BoundsMatchers.js +10 -10
- package/test/matchers/ConnectionMatchers.js +5 -5
|
@@ -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
|
@@ -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.
|
|
@@ -33,7 +41,8 @@ export function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
|
|
|
33
41
|
|
|
34
42
|
var importer,
|
|
35
43
|
eventBus,
|
|
36
|
-
translate
|
|
44
|
+
translate,
|
|
45
|
+
canvas;
|
|
37
46
|
|
|
38
47
|
var error,
|
|
39
48
|
warnings = [];
|
|
@@ -49,12 +58,12 @@ export function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
|
|
|
49
58
|
|
|
50
59
|
var visitor = {
|
|
51
60
|
|
|
52
|
-
root: function(element) {
|
|
53
|
-
return importer.add(element);
|
|
61
|
+
root: function(element, di) {
|
|
62
|
+
return importer.add(element, di);
|
|
54
63
|
},
|
|
55
64
|
|
|
56
|
-
element: function(element, parentShape) {
|
|
57
|
-
return importer.add(element, parentShape);
|
|
65
|
+
element: function(element, di, parentShape) {
|
|
66
|
+
return importer.add(element, di, parentShape);
|
|
58
67
|
},
|
|
59
68
|
|
|
60
69
|
error: function(message, context) {
|
|
@@ -64,9 +73,29 @@ export function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
|
|
|
64
73
|
|
|
65
74
|
var walker = new BpmnTreeWalker(visitor, translate);
|
|
66
75
|
|
|
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'));
|
|
83
|
+
}
|
|
84
|
+
|
|
67
85
|
// traverse BPMN 2.0 document model,
|
|
68
86
|
// starting at definitions
|
|
69
|
-
|
|
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
|
+
);
|
|
70
99
|
}
|
|
71
100
|
|
|
72
101
|
return new Promise(function(resolve, reject) {
|
|
@@ -74,6 +103,7 @@ export function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
|
|
|
74
103
|
importer = diagram.get('bpmnImporter');
|
|
75
104
|
eventBus = diagram.get('eventBus');
|
|
76
105
|
translate = diagram.get('translate');
|
|
106
|
+
canvas = diagram.get('canvas');
|
|
77
107
|
|
|
78
108
|
eventBus.fire('import.render.start', { definitions: definitions });
|
|
79
109
|
|
|
@@ -92,3 +122,104 @@ export function importBpmnDiagram(diagram, definitions, bpmnDiagram) {
|
|
|
92
122
|
}
|
|
93
123
|
});
|
|
94
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
|
+
}
|
|
@@ -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')) {
|
|
@@ -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
|
+
}
|
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
|
@@ -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
|
*
|
|
@@ -22,4 +41,15 @@ export function is(element, type) {
|
|
|
22
41
|
*/
|
|
23
42
|
export function getBusinessObject(element) {
|
|
24
43
|
return (element && element.businessObject) || element;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Return the di object for a given element.
|
|
48
|
+
*
|
|
49
|
+
* @param {djs.model.Base} element
|
|
50
|
+
*
|
|
51
|
+
* @return {ModdleElement}
|
|
52
|
+
*/
|
|
53
|
+
export function getDi(element) {
|
|
54
|
+
return element && element.di;
|
|
25
55
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmn-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0-alpha.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": "^
|
|
103
|
+
"diagram-js": "^8.1.1",
|
|
104
104
|
"diagram-js-direct-editing": "^1.6.3",
|
|
105
105
|
"ids": "^1.0.0",
|
|
106
106
|
"inherits": "^2.0.4",
|
|
@@ -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
|
|