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
|
@@ -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,
|
|
@@ -68,7 +71,7 @@ SetColorHandler.prototype.postExecute = function(context) {
|
|
|
68
71
|
// set label colors as bpmndi:BPMNLabel#color
|
|
69
72
|
self._commandStack.execute('element.updateModdleProperties', {
|
|
70
73
|
element: element,
|
|
71
|
-
moddleElement: element.
|
|
74
|
+
moddleElement: getDi(element).label,
|
|
72
75
|
properties: {
|
|
73
76
|
color: di['background-color']
|
|
74
77
|
}
|
|
@@ -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,10 +26,11 @@ UpdateCanvasRootHandler.prototype.execute = function(context) {
|
|
|
24
26
|
oldRoot = canvas.getRootElement(),
|
|
25
27
|
oldRootBusinessObject = oldRoot.businessObject,
|
|
26
28
|
bpmnDefinitions = oldRootBusinessObject.$parent,
|
|
27
|
-
diPlane =
|
|
29
|
+
diPlane = getDi(oldRoot);
|
|
28
30
|
|
|
29
31
|
// (1) replace process old <> new root
|
|
30
|
-
canvas.setRootElement(newRoot
|
|
32
|
+
canvas.setRootElement(newRoot);
|
|
33
|
+
canvas.removeRootElement(oldRoot);
|
|
31
34
|
|
|
32
35
|
// (2) update root elements
|
|
33
36
|
collectionAdd(bpmnDefinitions.rootElements, newRootBusinessObject);
|
|
@@ -37,10 +40,10 @@ UpdateCanvasRootHandler.prototype.execute = function(context) {
|
|
|
37
40
|
oldRootBusinessObject.$parent = null;
|
|
38
41
|
|
|
39
42
|
// (3) wire di
|
|
40
|
-
|
|
43
|
+
oldRoot.di = null;
|
|
41
44
|
|
|
42
45
|
diPlane.bpmnElement = newRootBusinessObject;
|
|
43
|
-
|
|
46
|
+
newRoot.di = diPlane;
|
|
44
47
|
|
|
45
48
|
context.oldRoot = oldRoot;
|
|
46
49
|
|
|
@@ -58,10 +61,11 @@ UpdateCanvasRootHandler.prototype.revert = function(context) {
|
|
|
58
61
|
oldRoot = context.oldRoot,
|
|
59
62
|
oldRootBusinessObject = oldRoot.businessObject,
|
|
60
63
|
bpmnDefinitions = newRootBusinessObject.$parent,
|
|
61
|
-
diPlane =
|
|
64
|
+
diPlane = getDi(newRoot);
|
|
62
65
|
|
|
63
66
|
// (1) replace process old <> new root
|
|
64
|
-
canvas.setRootElement(oldRoot
|
|
67
|
+
canvas.setRootElement(oldRoot);
|
|
68
|
+
canvas.removeRootElement(newRoot);
|
|
65
69
|
|
|
66
70
|
// (2) update root elements
|
|
67
71
|
collectionRemove(bpmnDefinitions.rootElements, newRootBusinessObject);
|
|
@@ -71,10 +75,10 @@ UpdateCanvasRootHandler.prototype.revert = function(context) {
|
|
|
71
75
|
oldRootBusinessObject.$parent = bpmnDefinitions;
|
|
72
76
|
|
|
73
77
|
// (3) wire di
|
|
74
|
-
|
|
78
|
+
newRoot.di = null;
|
|
75
79
|
|
|
76
80
|
diPlane.bpmnElement = oldRootBusinessObject;
|
|
77
|
-
|
|
81
|
+
oldRoot.di = diPlane;
|
|
78
82
|
|
|
79
83
|
// TODO(nikku): return changed elements?
|
|
80
84
|
// 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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
|
198
|
-
if (
|
|
199
|
-
setDiProperties(
|
|
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 =
|
|
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(
|
|
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(
|
|
34
|
+
this._bpmnUpdater.updateDiParent(dataStoreDi, oldDiParent);
|
|
33
35
|
};
|
|
34
36
|
|
|
@@ -1,24 +1,6 @@
|
|
|
1
|
-
|
|
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.
|
|
@@ -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
|
}
|
|
@@ -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
|
-
|
|
56
|
+
var di = getDi(shape);
|
|
57
|
+
di.isExpanded = options.isExpanded;
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
create.start(event, shape);
|
|
@@ -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
|
|
|
@@ -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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
39
|
+
target.isExpanded === isExpanded(element)
|
|
40
40
|
);
|
|
41
41
|
|
|
42
42
|
return !isTypeEqual || !isEventDefinitionEqual || !isTriggeredByEventEqual || !isExpandedEqual;
|
|
@@ -36,6 +36,7 @@ function copyProperties(source, target, properties) {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
|
|
39
40
|
var CUSTOM_PROPERTIES = [
|
|
40
41
|
'cancelActivity',
|
|
41
42
|
'instantiate',
|
|
@@ -44,8 +45,10 @@ var CUSTOM_PROPERTIES = [
|
|
|
44
45
|
'isInterrupting'
|
|
45
46
|
];
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Check if element should be collapsed or expanded.
|
|
50
|
+
*/
|
|
51
|
+
function shouldToggleCollapsed(element, targetElement) {
|
|
49
52
|
|
|
50
53
|
var oldCollapsed = (
|
|
51
54
|
element && has(element, 'collapsed') ? element.collapsed : !isExpanded(element)
|
|
@@ -53,11 +56,11 @@ function toggeling(element, target) {
|
|
|
53
56
|
|
|
54
57
|
var targetCollapsed;
|
|
55
58
|
|
|
56
|
-
if (
|
|
59
|
+
if (targetElement && (has(targetElement, 'collapsed') || has(targetElement, 'isExpanded'))) {
|
|
57
60
|
|
|
58
61
|
// property is explicitly set so use it
|
|
59
62
|
targetCollapsed = (
|
|
60
|
-
has(
|
|
63
|
+
has(targetElement, 'collapsed') ? targetElement.collapsed : !targetElement.isExpanded
|
|
61
64
|
);
|
|
62
65
|
} else {
|
|
63
66
|
|
|
@@ -66,7 +69,6 @@ function toggeling(element, target) {
|
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
if (oldCollapsed !== targetCollapsed) {
|
|
69
|
-
element.collapsed = oldCollapsed;
|
|
70
72
|
return true;
|
|
71
73
|
}
|
|
72
74
|
|
|
@@ -74,7 +76,6 @@ function toggeling(element, target) {
|
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
|
|
77
|
-
|
|
78
79
|
/**
|
|
79
80
|
* This module takes care of replacing BPMN elements
|
|
80
81
|
*/
|
|
@@ -105,15 +106,13 @@ export default function BpmnReplace(
|
|
|
105
106
|
var type = target.type,
|
|
106
107
|
oldBusinessObject = element.businessObject;
|
|
107
108
|
|
|
108
|
-
if (isSubProcess(oldBusinessObject)) {
|
|
109
|
-
if (
|
|
110
|
-
if (toggeling(element, target)) {
|
|
109
|
+
if (isSubProcess(oldBusinessObject) && type === 'bpmn:SubProcess') {
|
|
110
|
+
if (shouldToggleCollapsed(element, target)) {
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
// expanding or collapsing process
|
|
113
|
+
modeling.toggleCollapse(element);
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
}
|
|
115
|
+
return element;
|
|
117
116
|
}
|
|
118
117
|
}
|
|
119
118
|
|
|
@@ -121,9 +120,20 @@ export default function BpmnReplace(
|
|
|
121
120
|
|
|
122
121
|
var newElement = {
|
|
123
122
|
type: type,
|
|
124
|
-
businessObject: newBusinessObject
|
|
123
|
+
businessObject: newBusinessObject,
|
|
125
124
|
};
|
|
126
125
|
|
|
126
|
+
newElement.di = {};
|
|
127
|
+
|
|
128
|
+
// colors will be set to DI
|
|
129
|
+
copyProperties(element.di, newElement.di, [
|
|
130
|
+
'fill',
|
|
131
|
+
'stroke',
|
|
132
|
+
'background-color',
|
|
133
|
+
'border-color',
|
|
134
|
+
'color'
|
|
135
|
+
]);
|
|
136
|
+
|
|
127
137
|
var elementProps = getPropertyNames(oldBusinessObject.$descriptor),
|
|
128
138
|
newElementProps = getPropertyNames(newBusinessObject.$descriptor, true),
|
|
129
139
|
copyProps = intersection(elementProps, newElementProps);
|
|
@@ -183,7 +193,7 @@ export default function BpmnReplace(
|
|
|
183
193
|
if (isSubProcess(oldBusinessObject)) {
|
|
184
194
|
|
|
185
195
|
// no toggeling, so keep old state
|
|
186
|
-
newElement.isExpanded = isExpanded(
|
|
196
|
+
newElement.isExpanded = isExpanded(element);
|
|
187
197
|
}
|
|
188
198
|
|
|
189
199
|
// else if property is explicitly set, use it
|
|
@@ -194,7 +204,7 @@ export default function BpmnReplace(
|
|
|
194
204
|
// TODO: need also to respect min/max Size
|
|
195
205
|
// copy size, from an expanded subprocess to an expanded alternative subprocess
|
|
196
206
|
// except bpmn:Task, because Task is always expanded
|
|
197
|
-
if ((isExpanded(
|
|
207
|
+
if ((isExpanded(element) && !is(oldBusinessObject, 'bpmn:Task')) && newElement.isExpanded) {
|
|
198
208
|
newElement.width = element.width;
|
|
199
209
|
newElement.height = element.height;
|
|
200
210
|
}
|
|
@@ -219,12 +229,12 @@ export default function BpmnReplace(
|
|
|
219
229
|
|
|
220
230
|
// apply same width and default height
|
|
221
231
|
newElement.width = element.width;
|
|
222
|
-
newElement.height = elementFactory.
|
|
232
|
+
newElement.height = elementFactory.getDefaultSize(newElement).height;
|
|
223
233
|
}
|
|
224
234
|
|
|
225
235
|
if (!rules.allowed('shape.resize', { shape: newBusinessObject })) {
|
|
226
|
-
newElement.height = elementFactory.
|
|
227
|
-
newElement.width = elementFactory.
|
|
236
|
+
newElement.height = elementFactory.getDefaultSize(newElement).height;
|
|
237
|
+
newElement.width = elementFactory.getDefaultSize(newElement).width;
|
|
228
238
|
}
|
|
229
239
|
|
|
230
240
|
newBusinessObject.name = oldBusinessObject.name;
|
|
@@ -262,16 +272,6 @@ export default function BpmnReplace(
|
|
|
262
272
|
newElement.x = element.x + (element.width - newElement.width) / 2;
|
|
263
273
|
}
|
|
264
274
|
|
|
265
|
-
newElement.di = {};
|
|
266
|
-
|
|
267
|
-
// colors will be set to DI
|
|
268
|
-
copyProperties(oldBusinessObject.di, newElement.di, [
|
|
269
|
-
'fill',
|
|
270
|
-
'stroke',
|
|
271
|
-
'background-color',
|
|
272
|
-
'border-color',
|
|
273
|
-
'color'
|
|
274
|
-
]);
|
|
275
275
|
|
|
276
276
|
newElement = replace.replaceElement(element, newElement, hints);
|
|
277
277
|
|
|
@@ -26,17 +26,25 @@ import {
|
|
|
26
26
|
} from './Util';
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* @param {ModdleElement} semantic
|
|
31
|
+
* @param {ModdleElement} di
|
|
32
|
+
* @param {Object} [attrs=null]
|
|
33
|
+
*
|
|
34
|
+
* @return {Object}
|
|
35
|
+
*/
|
|
36
|
+
function elementData(semantic, di, attrs) {
|
|
30
37
|
return assign({
|
|
31
38
|
id: semantic.id,
|
|
32
39
|
type: semantic.$type,
|
|
33
|
-
businessObject: semantic
|
|
40
|
+
businessObject: semantic,
|
|
41
|
+
di: di
|
|
34
42
|
}, attrs);
|
|
35
43
|
}
|
|
36
44
|
|
|
37
|
-
function getWaypoints(
|
|
45
|
+
function getWaypoints(di, source, target) {
|
|
38
46
|
|
|
39
|
-
var waypoints =
|
|
47
|
+
var waypoints = di.waypoint;
|
|
40
48
|
|
|
41
49
|
if (!waypoints || waypoints.length < 2) {
|
|
42
50
|
return [ getMid(source), getMid(target) ];
|
|
@@ -92,10 +100,8 @@ BpmnImporter.$inject = [
|
|
|
92
100
|
* Add bpmn element (semantic) to the canvas onto the
|
|
93
101
|
* specified parent shape.
|
|
94
102
|
*/
|
|
95
|
-
BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|
96
|
-
|
|
97
|
-
var di = semantic.di,
|
|
98
|
-
element,
|
|
103
|
+
BpmnImporter.prototype.add = function(semantic, di, parentElement) {
|
|
104
|
+
var element,
|
|
99
105
|
translate = this._translate,
|
|
100
106
|
hidden;
|
|
101
107
|
|
|
@@ -103,25 +109,30 @@ BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|
|
103
109
|
|
|
104
110
|
// ROOT ELEMENT
|
|
105
111
|
// handle the special case that we deal with a
|
|
106
|
-
// invisible root element (process or collaboration)
|
|
112
|
+
// invisible root element (process, subprocess or collaboration)
|
|
107
113
|
if (is(di, 'bpmndi:BPMNPlane')) {
|
|
108
114
|
|
|
115
|
+
var attrs = is(semantic, 'bpmn:SubProcess')
|
|
116
|
+
? { id: semantic.id + '_plane' }
|
|
117
|
+
: {};
|
|
118
|
+
|
|
109
119
|
// add a virtual element (not being drawn)
|
|
110
|
-
element = this._elementFactory.createRoot(elementData(semantic));
|
|
120
|
+
element = this._elementFactory.createRoot(elementData(semantic, di, attrs));
|
|
111
121
|
|
|
112
|
-
this._canvas.
|
|
122
|
+
this._canvas.addRootElement(element);
|
|
113
123
|
}
|
|
114
124
|
|
|
115
125
|
// SHAPE
|
|
116
126
|
else if (is(di, 'bpmndi:BPMNShape')) {
|
|
117
127
|
|
|
118
|
-
var collapsed = !isExpanded(semantic),
|
|
128
|
+
var collapsed = !isExpanded(semantic, di),
|
|
119
129
|
isFrame = isFrameElement(semantic);
|
|
130
|
+
|
|
120
131
|
hidden = parentElement && (parentElement.hidden || parentElement.collapsed);
|
|
121
132
|
|
|
122
|
-
var bounds =
|
|
133
|
+
var bounds = di.bounds;
|
|
123
134
|
|
|
124
|
-
element = this._elementFactory.createShape(elementData(semantic, {
|
|
135
|
+
element = this._elementFactory.createShape(elementData(semantic, di, {
|
|
125
136
|
collapsed: collapsed,
|
|
126
137
|
hidden: hidden,
|
|
127
138
|
x: Math.round(bounds.x),
|
|
@@ -144,7 +155,7 @@ BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|
|
144
155
|
|
|
145
156
|
// check whether data store is inside our outside of its semantic parent
|
|
146
157
|
if (!isPointInsideBBox(parentElement, getMid(bounds))) {
|
|
147
|
-
parentElement = this._canvas.
|
|
158
|
+
parentElement = this._canvas.findRoot(parentElement);
|
|
148
159
|
}
|
|
149
160
|
}
|
|
150
161
|
|
|
@@ -159,11 +170,11 @@ BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|
|
159
170
|
|
|
160
171
|
hidden = parentElement && (parentElement.hidden || parentElement.collapsed);
|
|
161
172
|
|
|
162
|
-
element = this._elementFactory.createConnection(elementData(semantic, {
|
|
173
|
+
element = this._elementFactory.createConnection(elementData(semantic, di, {
|
|
163
174
|
hidden: hidden,
|
|
164
175
|
source: source,
|
|
165
176
|
target: target,
|
|
166
|
-
waypoints: getWaypoints(
|
|
177
|
+
waypoints: getWaypoints(di, source, target)
|
|
167
178
|
}));
|
|
168
179
|
|
|
169
180
|
if (is(semantic, 'bpmn:DataAssociation')) {
|
|
@@ -172,7 +183,7 @@ BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|
|
172
183
|
// are rendered correctly across different "hacks" people
|
|
173
184
|
// love to model such as cross participant / sub process
|
|
174
185
|
// associations
|
|
175
|
-
parentElement =
|
|
186
|
+
parentElement = this._canvas.findRoot(parentElement);
|
|
176
187
|
}
|
|
177
188
|
|
|
178
189
|
// insert sequence flows behind other flow nodes (cf. #727)
|
|
@@ -190,7 +201,7 @@ BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|
|
190
201
|
|
|
191
202
|
// (optional) LABEL
|
|
192
203
|
if (isLabelExternal(semantic) && getLabel(element)) {
|
|
193
|
-
this.addLabel(semantic, element);
|
|
204
|
+
this.addLabel(semantic, di, element);
|
|
194
205
|
}
|
|
195
206
|
|
|
196
207
|
|
|
@@ -239,12 +250,12 @@ BpmnImporter.prototype._attachBoundary = function(boundarySemantic, boundaryElem
|
|
|
239
250
|
/**
|
|
240
251
|
* add label for an element
|
|
241
252
|
*/
|
|
242
|
-
BpmnImporter.prototype.addLabel = function(semantic, element) {
|
|
253
|
+
BpmnImporter.prototype.addLabel = function(semantic, di, element) {
|
|
243
254
|
var bounds,
|
|
244
255
|
text,
|
|
245
256
|
label;
|
|
246
257
|
|
|
247
|
-
bounds = getExternalLabelBounds(
|
|
258
|
+
bounds = getExternalLabelBounds(di, element);
|
|
248
259
|
|
|
249
260
|
text = getLabel(element);
|
|
250
261
|
|
|
@@ -254,7 +265,7 @@ BpmnImporter.prototype.addLabel = function(semantic, element) {
|
|
|
254
265
|
bounds = this._textRenderer.getExternalLabelBounds(bounds, text);
|
|
255
266
|
}
|
|
256
267
|
|
|
257
|
-
label = this._elementFactory.createLabel(elementData(semantic, {
|
|
268
|
+
label = this._elementFactory.createLabel(elementData(semantic, di, {
|
|
258
269
|
id: semantic.id + '_label',
|
|
259
270
|
labelTarget: element,
|
|
260
271
|
type: 'label',
|