bpmn-js 9.0.0-subprocesses.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 +17 -1
- package/dist/assets/bpmn-js.css +58 -0
- package/dist/assets/diagram-js.css +1 -0
- package/dist/bpmn-modeler.development.js +1756 -1632
- package/dist/bpmn-modeler.production.min.js +8 -7
- package/dist/bpmn-navigated-viewer.development.js +20855 -20345
- package/dist/bpmn-navigated-viewer.production.min.js +22 -20
- package/dist/bpmn-viewer.development.js +20049 -19562
- package/dist/bpmn-viewer.production.min.js +22 -20
- package/lib/Modeler.js +1 -4
- package/lib/Viewer.js +2 -2
- package/lib/draw/BpmnRenderer.js +367 -296
- package/lib/draw/PathMap.js +2 -2
- package/lib/features/auto-resize/BpmnAutoResizeProvider.js +3 -6
- package/lib/features/copy-paste/ModdleCopy.js +19 -2
- package/lib/features/modeling/BpmnFactory.js +8 -8
- package/lib/features/modeling/BpmnUpdater.js +0 -5
- package/lib/features/modeling/ElementFactory.js +27 -13
- package/lib/features/modeling/behavior/ResizeBehavior.js +129 -3
- package/lib/features/modeling/behavior/util/ResizeUtil.js +1 -132
- package/lib/features/replace/BpmnReplace.js +38 -16
- 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 +59 -10
- package/lib/import/BpmnTreeWalker.js +2 -2
- package/lib/import/Importer.js +4 -4
- package/lib/util/DiUtil.js +1 -0
- package/package.json +2 -2
- package/test/helper/index.js +6 -1
- package/test/util/MockEvents.js +10 -2
- package/lib/features/collapsed-subprocesses/DeleteBehaviour.js +0 -65
- package/lib/features/collapsed-subprocesses/ToggleCollapseBehaviour.js +0 -133
- package/lib/features/collapsed-subprocesses/diagramFactory.js +0 -56
- package/lib/features/collapsed-subprocesses/index.js +0 -12
- package/lib/features/collapsed-subprocesses-navigation/CollapsedSubprocessNavigation.js +0 -198
- package/lib/features/collapsed-subprocesses-navigation/index.js +0 -7
package/lib/draw/PathMap.js
CHANGED
|
@@ -444,8 +444,8 @@ export default function PathMap() {
|
|
|
444
444
|
|
|
445
445
|
// helpers //////////////////////
|
|
446
446
|
|
|
447
|
-
// copied from https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js
|
|
448
|
-
var tokenRegex = /\{([^}]+)\}/g,
|
|
447
|
+
// copied and adjusted from https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js
|
|
448
|
+
var tokenRegex = /\{([^{}]+)\}/g,
|
|
449
449
|
objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g; // matches .xxxxx or ["xxxxx"] to run over object properties
|
|
450
450
|
|
|
451
451
|
function replacer(all, key, obj) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { is } from '../../util/ModelUtil';
|
|
2
2
|
|
|
3
3
|
import inherits from 'inherits';
|
|
4
4
|
|
|
@@ -32,11 +32,8 @@ BpmnAutoResizeProvider.$inject = [
|
|
|
32
32
|
* @return {boolean}
|
|
33
33
|
*/
|
|
34
34
|
BpmnAutoResizeProvider.prototype.canResize = function(elements, target) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
!is(target, 'bpmn:Lane') &&
|
|
38
|
-
(!is(target, 'bpmn:SubProcess') || is(getDi(target), 'bpmndi:BPMNPlane'))
|
|
39
|
-
) {
|
|
35
|
+
|
|
36
|
+
if (!is(target, 'bpmn:Participant') && !is(target, 'bpmn:Lane') && !(is(target, 'bpmn:SubProcess'))) {
|
|
40
37
|
return false;
|
|
41
38
|
}
|
|
42
39
|
|
|
@@ -215,11 +215,16 @@ ModdleCopy.prototype.copyProperty = function(property, parent, propertyName) {
|
|
|
215
215
|
|
|
216
216
|
var propertyDescriptor = this._moddle.getPropertyDescriptor(parent, propertyName);
|
|
217
217
|
|
|
218
|
-
// do NOT copy
|
|
219
|
-
if (propertyDescriptor.
|
|
218
|
+
// do NOT copy references
|
|
219
|
+
if (propertyDescriptor.isReference) {
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
// copy id
|
|
224
|
+
if (propertyDescriptor.isId) {
|
|
225
|
+
return this._copyId(property, parent);
|
|
226
|
+
}
|
|
227
|
+
|
|
223
228
|
// copy arrays
|
|
224
229
|
if (isArray(property)) {
|
|
225
230
|
return reduce(property, function(childProperties, childProperty) {
|
|
@@ -258,6 +263,18 @@ ModdleCopy.prototype.copyProperty = function(property, parent, propertyName) {
|
|
|
258
263
|
return property;
|
|
259
264
|
};
|
|
260
265
|
|
|
266
|
+
ModdleCopy.prototype._copyId = function(id, element) {
|
|
267
|
+
|
|
268
|
+
// disallow if already taken
|
|
269
|
+
if (this._moddle.ids.assigned(id)) {
|
|
270
|
+
return;
|
|
271
|
+
} else {
|
|
272
|
+
|
|
273
|
+
this._moddle.ids.claim(id, element);
|
|
274
|
+
return id;
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
261
278
|
// helpers //////////
|
|
262
279
|
|
|
263
280
|
export function getPropertyNames(descriptor, keepDefaultProperties) {
|
|
@@ -83,11 +83,10 @@ BpmnFactory.prototype.createDiLabel = function() {
|
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
|
|
86
|
-
BpmnFactory.prototype.createDiShape = function(semantic,
|
|
87
|
-
|
|
86
|
+
BpmnFactory.prototype.createDiShape = function(semantic, attrs) {
|
|
88
87
|
return this.create('bpmndi:BPMNShape', assign({
|
|
89
88
|
bpmnElement: semantic,
|
|
90
|
-
bounds: this.createDiBounds(
|
|
89
|
+
bounds: this.createDiBounds()
|
|
91
90
|
}, attrs));
|
|
92
91
|
};
|
|
93
92
|
|
|
@@ -110,14 +109,15 @@ BpmnFactory.prototype.createDiWaypoint = function(point) {
|
|
|
110
109
|
};
|
|
111
110
|
|
|
112
111
|
|
|
113
|
-
BpmnFactory.prototype.createDiEdge = function(semantic,
|
|
112
|
+
BpmnFactory.prototype.createDiEdge = function(semantic, attrs) {
|
|
114
113
|
return this.create('bpmndi:BPMNEdge', assign({
|
|
115
|
-
bpmnElement: semantic
|
|
114
|
+
bpmnElement: semantic,
|
|
115
|
+
waypoints: this.createDiWaypoints([])
|
|
116
116
|
}, attrs));
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
-
BpmnFactory.prototype.createDiPlane = function(semantic) {
|
|
120
|
-
return this.create('bpmndi:BPMNPlane', {
|
|
119
|
+
BpmnFactory.prototype.createDiPlane = function(semantic, attrs) {
|
|
120
|
+
return this.create('bpmndi:BPMNPlane', assign({
|
|
121
121
|
bpmnElement: semantic
|
|
122
|
-
});
|
|
122
|
+
}, attrs));
|
|
123
123
|
};
|
|
@@ -410,11 +410,6 @@ BpmnUpdater.prototype.updateDiParent = function(di, parentDi) {
|
|
|
410
410
|
return;
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
-
// Cover the case where di.$parent === undefined and parentDi === null
|
|
414
|
-
if (!parentDi && !di.$parent) {
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
413
|
var planeElements = (parentDi || di.$parent).get('planeElement');
|
|
419
414
|
|
|
420
415
|
if (parentDi) {
|
|
@@ -12,6 +12,10 @@ import {
|
|
|
12
12
|
is
|
|
13
13
|
} from '../../util/ModelUtil';
|
|
14
14
|
|
|
15
|
+
import {
|
|
16
|
+
isAny
|
|
17
|
+
} from '../modeling/util/ModelingUtil';
|
|
18
|
+
|
|
15
19
|
import {
|
|
16
20
|
isExpanded
|
|
17
21
|
} from '../../util/DiUtil';
|
|
@@ -80,20 +84,19 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
|
|
80
84
|
ensureCompatDiRef(businessObject);
|
|
81
85
|
}
|
|
82
86
|
|
|
83
|
-
if (!di) {
|
|
87
|
+
if (!isModdleDi(di)) {
|
|
88
|
+
var diAttrs = assign(
|
|
89
|
+
di || {},
|
|
90
|
+
{ id: businessObject.id + '_di' }
|
|
91
|
+
);
|
|
92
|
+
|
|
84
93
|
if (elementType === 'root') {
|
|
85
|
-
di = this._bpmnFactory.createDiPlane(businessObject,
|
|
86
|
-
id: businessObject.id + '_di'
|
|
87
|
-
});
|
|
94
|
+
di = this._bpmnFactory.createDiPlane(businessObject, diAttrs);
|
|
88
95
|
} else
|
|
89
96
|
if (elementType === 'connection') {
|
|
90
|
-
di = this._bpmnFactory.createDiEdge(businessObject,
|
|
91
|
-
id: businessObject.id + '_di'
|
|
92
|
-
});
|
|
97
|
+
di = this._bpmnFactory.createDiEdge(businessObject, diAttrs);
|
|
93
98
|
} else {
|
|
94
|
-
di = this._bpmnFactory.createDiShape(businessObject,
|
|
95
|
-
id: businessObject.id + '_di'
|
|
96
|
-
});
|
|
99
|
+
di = this._bpmnFactory.createDiShape(businessObject, diAttrs);
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
|
|
@@ -140,10 +143,11 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
|
|
140
143
|
size = this.getDefaultSize(businessObject, di);
|
|
141
144
|
|
|
142
145
|
attrs = assign({
|
|
143
|
-
businessObject: businessObject,
|
|
144
|
-
di: di,
|
|
145
146
|
id: businessObject.id
|
|
146
|
-
}, size, attrs
|
|
147
|
+
}, size, attrs, {
|
|
148
|
+
businessObject: businessObject,
|
|
149
|
+
di: di
|
|
150
|
+
});
|
|
147
151
|
|
|
148
152
|
return this.baseCreate(elementType, attrs);
|
|
149
153
|
};
|
|
@@ -261,4 +265,14 @@ function applyAttribute(element, attrs, attributeName) {
|
|
|
261
265
|
element[attributeName] = attrs[attributeName];
|
|
262
266
|
|
|
263
267
|
delete attrs[attributeName];
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
function isModdleDi(element) {
|
|
272
|
+
return isAny(element, [
|
|
273
|
+
'bpmndi:BPMNShape',
|
|
274
|
+
'bpmndi:BPMNEdge',
|
|
275
|
+
'bpmndi:BPMNDiagram',
|
|
276
|
+
'bpmndi:BPMNPlane',
|
|
277
|
+
]);
|
|
264
278
|
}
|
|
@@ -2,7 +2,14 @@ import { is } from '../../../util/ModelUtil';
|
|
|
2
2
|
|
|
3
3
|
import { isExpanded } from '../../../util/DiUtil';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
asTRBL
|
|
7
|
+
} from 'diagram-js/lib/layout/LayoutUtil';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
collectLanes,
|
|
11
|
+
getLanesRoot
|
|
12
|
+
} from '../util/LaneUtil';
|
|
6
13
|
|
|
7
14
|
var HIGH_PRIORITY = 1500;
|
|
8
15
|
|
|
@@ -14,7 +21,6 @@ export var SUB_PROCESS_MIN_DIMENSIONS = { width: 140, height: 120 };
|
|
|
14
21
|
|
|
15
22
|
export var TEXT_ANNOTATION_MIN_DIMENSIONS = { width: 50, height: 30 };
|
|
16
23
|
|
|
17
|
-
|
|
18
24
|
/**
|
|
19
25
|
* Set minimum bounds/resize constraints on resize.
|
|
20
26
|
*
|
|
@@ -45,4 +51,124 @@ export default function ResizeBehavior(eventBus) {
|
|
|
45
51
|
});
|
|
46
52
|
}
|
|
47
53
|
|
|
48
|
-
ResizeBehavior.$inject = [ 'eventBus' ];
|
|
54
|
+
ResizeBehavior.$inject = [ 'eventBus' ];
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
var abs = Math.abs,
|
|
58
|
+
min = Math.min,
|
|
59
|
+
max = Math.max;
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
function addToTrbl(trbl, attr, value, choice) {
|
|
63
|
+
var current = trbl[attr];
|
|
64
|
+
|
|
65
|
+
// make sure to set the value if it does not exist
|
|
66
|
+
// or apply the correct value by comparing against
|
|
67
|
+
// choice(value, currentValue)
|
|
68
|
+
trbl[attr] = current === undefined ? value : choice(value, current);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function addMin(trbl, attr, value) {
|
|
72
|
+
return addToTrbl(trbl, attr, value, min);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function addMax(trbl, attr, value) {
|
|
76
|
+
return addToTrbl(trbl, attr, value, max);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
var LANE_RIGHT_PADDING = 20,
|
|
80
|
+
LANE_LEFT_PADDING = 50,
|
|
81
|
+
LANE_TOP_PADDING = 20,
|
|
82
|
+
LANE_BOTTOM_PADDING = 20;
|
|
83
|
+
|
|
84
|
+
export function getParticipantResizeConstraints(laneShape, resizeDirection, balanced) {
|
|
85
|
+
var lanesRoot = getLanesRoot(laneShape);
|
|
86
|
+
|
|
87
|
+
var isFirst = true,
|
|
88
|
+
isLast = true;
|
|
89
|
+
|
|
90
|
+
// max top/bottom size for lanes
|
|
91
|
+
var allLanes = collectLanes(lanesRoot, [ lanesRoot ]);
|
|
92
|
+
|
|
93
|
+
var laneTrbl = asTRBL(laneShape);
|
|
94
|
+
|
|
95
|
+
var maxTrbl = {},
|
|
96
|
+
minTrbl = {};
|
|
97
|
+
|
|
98
|
+
if (/e/.test(resizeDirection)) {
|
|
99
|
+
minTrbl.right = laneTrbl.left + LANE_MIN_DIMENSIONS.width;
|
|
100
|
+
} else
|
|
101
|
+
if (/w/.test(resizeDirection)) {
|
|
102
|
+
minTrbl.left = laneTrbl.right - LANE_MIN_DIMENSIONS.width;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
allLanes.forEach(function(other) {
|
|
106
|
+
|
|
107
|
+
var otherTrbl = asTRBL(other);
|
|
108
|
+
|
|
109
|
+
if (/n/.test(resizeDirection)) {
|
|
110
|
+
|
|
111
|
+
if (otherTrbl.top < (laneTrbl.top - 10)) {
|
|
112
|
+
isFirst = false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// max top size (based on next element)
|
|
116
|
+
if (balanced && abs(laneTrbl.top - otherTrbl.bottom) < 10) {
|
|
117
|
+
addMax(maxTrbl, 'top', otherTrbl.top + LANE_MIN_DIMENSIONS.height);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// min top size (based on self or nested element)
|
|
121
|
+
if (abs(laneTrbl.top - otherTrbl.top) < 5) {
|
|
122
|
+
addMin(minTrbl, 'top', otherTrbl.bottom - LANE_MIN_DIMENSIONS.height);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (/s/.test(resizeDirection)) {
|
|
127
|
+
|
|
128
|
+
if (otherTrbl.bottom > (laneTrbl.bottom + 10)) {
|
|
129
|
+
isLast = false;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// max bottom size (based on previous element)
|
|
133
|
+
if (balanced && abs(laneTrbl.bottom - otherTrbl.top) < 10) {
|
|
134
|
+
addMin(maxTrbl, 'bottom', otherTrbl.bottom - LANE_MIN_DIMENSIONS.height);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// min bottom size (based on self or nested element)
|
|
138
|
+
if (abs(laneTrbl.bottom - otherTrbl.bottom) < 5) {
|
|
139
|
+
addMax(minTrbl, 'bottom', otherTrbl.top + LANE_MIN_DIMENSIONS.height);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// max top/bottom/left/right size based on flow nodes
|
|
145
|
+
var flowElements = lanesRoot.children.filter(function(s) {
|
|
146
|
+
return !s.hidden && !s.waypoints && (is(s, 'bpmn:FlowElement') || is(s, 'bpmn:Artifact'));
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
flowElements.forEach(function(flowElement) {
|
|
150
|
+
|
|
151
|
+
var flowElementTrbl = asTRBL(flowElement);
|
|
152
|
+
|
|
153
|
+
if (isFirst && /n/.test(resizeDirection)) {
|
|
154
|
+
addMin(minTrbl, 'top', flowElementTrbl.top - LANE_TOP_PADDING);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (/e/.test(resizeDirection)) {
|
|
158
|
+
addMax(minTrbl, 'right', flowElementTrbl.right + LANE_RIGHT_PADDING);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (isLast && /s/.test(resizeDirection)) {
|
|
162
|
+
addMax(minTrbl, 'bottom', flowElementTrbl.bottom + LANE_BOTTOM_PADDING);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (/w/.test(resizeDirection)) {
|
|
166
|
+
addMin(minTrbl, 'left', flowElementTrbl.left - LANE_LEFT_PADDING);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
min: minTrbl,
|
|
172
|
+
max: maxTrbl
|
|
173
|
+
};
|
|
174
|
+
}
|
|
@@ -1,132 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
asTRBL
|
|
5
|
-
} from 'diagram-js/lib/layout/LayoutUtil';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
collectLanes,
|
|
9
|
-
getLanesRoot
|
|
10
|
-
} from '../../../modeling/util/LaneUtil';
|
|
11
|
-
|
|
12
|
-
import { LANE_MIN_DIMENSIONS } from '../ResizeBehavior';
|
|
13
|
-
|
|
14
|
-
var abs = Math.abs,
|
|
15
|
-
min = Math.min,
|
|
16
|
-
max = Math.max;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function addToTrbl(trbl, attr, value, choice) {
|
|
20
|
-
var current = trbl[attr];
|
|
21
|
-
|
|
22
|
-
// make sure to set the value if it does not exist
|
|
23
|
-
// or apply the correct value by comparing against
|
|
24
|
-
// choice(value, currentValue)
|
|
25
|
-
trbl[attr] = current === undefined ? value : choice(value, current);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function addMin(trbl, attr, value) {
|
|
29
|
-
return addToTrbl(trbl, attr, value, min);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function addMax(trbl, attr, value) {
|
|
33
|
-
return addToTrbl(trbl, attr, value, max);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var LANE_RIGHT_PADDING = 20,
|
|
37
|
-
LANE_LEFT_PADDING = 50,
|
|
38
|
-
LANE_TOP_PADDING = 20,
|
|
39
|
-
LANE_BOTTOM_PADDING = 20;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
export function getParticipantResizeConstraints(laneShape, resizeDirection, balanced) {
|
|
43
|
-
var lanesRoot = getLanesRoot(laneShape);
|
|
44
|
-
|
|
45
|
-
var isFirst = true,
|
|
46
|
-
isLast = true;
|
|
47
|
-
|
|
48
|
-
// max top/bottom size for lanes
|
|
49
|
-
var allLanes = collectLanes(lanesRoot, [ lanesRoot ]);
|
|
50
|
-
|
|
51
|
-
var laneTrbl = asTRBL(laneShape);
|
|
52
|
-
|
|
53
|
-
var maxTrbl = {},
|
|
54
|
-
minTrbl = {};
|
|
55
|
-
|
|
56
|
-
if (/e/.test(resizeDirection)) {
|
|
57
|
-
minTrbl.right = laneTrbl.left + LANE_MIN_DIMENSIONS.width;
|
|
58
|
-
} else
|
|
59
|
-
if (/w/.test(resizeDirection)) {
|
|
60
|
-
minTrbl.left = laneTrbl.right - LANE_MIN_DIMENSIONS.width;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
allLanes.forEach(function(other) {
|
|
64
|
-
|
|
65
|
-
var otherTrbl = asTRBL(other);
|
|
66
|
-
|
|
67
|
-
if (/n/.test(resizeDirection)) {
|
|
68
|
-
|
|
69
|
-
if (otherTrbl.top < (laneTrbl.top - 10)) {
|
|
70
|
-
isFirst = false;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// max top size (based on next element)
|
|
74
|
-
if (balanced && abs(laneTrbl.top - otherTrbl.bottom) < 10) {
|
|
75
|
-
addMax(maxTrbl, 'top', otherTrbl.top + LANE_MIN_DIMENSIONS.height);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// min top size (based on self or nested element)
|
|
79
|
-
if (abs(laneTrbl.top - otherTrbl.top) < 5) {
|
|
80
|
-
addMin(minTrbl, 'top', otherTrbl.bottom - LANE_MIN_DIMENSIONS.height);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (/s/.test(resizeDirection)) {
|
|
85
|
-
|
|
86
|
-
if (otherTrbl.bottom > (laneTrbl.bottom + 10)) {
|
|
87
|
-
isLast = false;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// max bottom size (based on previous element)
|
|
91
|
-
if (balanced && abs(laneTrbl.bottom - otherTrbl.top) < 10) {
|
|
92
|
-
addMin(maxTrbl, 'bottom', otherTrbl.bottom - LANE_MIN_DIMENSIONS.height);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// min bottom size (based on self or nested element)
|
|
96
|
-
if (abs(laneTrbl.bottom - otherTrbl.bottom) < 5) {
|
|
97
|
-
addMax(minTrbl, 'bottom', otherTrbl.top + LANE_MIN_DIMENSIONS.height);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
// max top/bottom/left/right size based on flow nodes
|
|
103
|
-
var flowElements = lanesRoot.children.filter(function(s) {
|
|
104
|
-
return !s.hidden && !s.waypoints && (is(s, 'bpmn:FlowElement') || is(s, 'bpmn:Artifact'));
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
flowElements.forEach(function(flowElement) {
|
|
108
|
-
|
|
109
|
-
var flowElementTrbl = asTRBL(flowElement);
|
|
110
|
-
|
|
111
|
-
if (isFirst && /n/.test(resizeDirection)) {
|
|
112
|
-
addMin(minTrbl, 'top', flowElementTrbl.top - LANE_TOP_PADDING);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (/e/.test(resizeDirection)) {
|
|
116
|
-
addMax(minTrbl, 'right', flowElementTrbl.right + LANE_RIGHT_PADDING);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (isLast && /s/.test(resizeDirection)) {
|
|
120
|
-
addMax(minTrbl, 'bottom', flowElementTrbl.bottom + LANE_BOTTOM_PADDING);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (/w/.test(resizeDirection)) {
|
|
124
|
-
addMin(minTrbl, 'left', flowElementTrbl.left - LANE_LEFT_PADDING);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
return {
|
|
129
|
-
min: minTrbl,
|
|
130
|
-
max: maxTrbl
|
|
131
|
-
};
|
|
132
|
-
}
|
|
1
|
+
export { getParticipantResizeConstraints } from '../ResizeBehavior';
|
|
@@ -2,13 +2,15 @@ import {
|
|
|
2
2
|
pick,
|
|
3
3
|
assign,
|
|
4
4
|
filter,
|
|
5
|
+
forEach,
|
|
6
|
+
isArray,
|
|
7
|
+
isUndefined,
|
|
5
8
|
has
|
|
6
9
|
} from 'min-dash';
|
|
7
10
|
|
|
8
11
|
import {
|
|
9
12
|
is,
|
|
10
|
-
getBusinessObject
|
|
11
|
-
getDi
|
|
13
|
+
getBusinessObject
|
|
12
14
|
} from '../../util/ModelUtil';
|
|
13
15
|
|
|
14
16
|
import {
|
|
@@ -22,6 +24,18 @@ import {
|
|
|
22
24
|
|
|
23
25
|
import { getPropertyNames } from '../copy-paste/ModdleCopy';
|
|
24
26
|
|
|
27
|
+
function copyProperties(source, target, properties) {
|
|
28
|
+
if (!isArray(properties)) {
|
|
29
|
+
properties = [ properties ];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
forEach(properties, function(property) {
|
|
33
|
+
if (!isUndefined(source[property])) {
|
|
34
|
+
target[property] = source[property];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
25
39
|
|
|
26
40
|
var CUSTOM_PROPERTIES = [
|
|
27
41
|
'cancelActivity',
|
|
@@ -31,8 +45,10 @@ var CUSTOM_PROPERTIES = [
|
|
|
31
45
|
'isInterrupting'
|
|
32
46
|
];
|
|
33
47
|
|
|
34
|
-
|
|
35
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Check if element should be collapsed or expanded.
|
|
50
|
+
*/
|
|
51
|
+
function shouldToggleCollapsed(element, targetElement) {
|
|
36
52
|
|
|
37
53
|
var oldCollapsed = (
|
|
38
54
|
element && has(element, 'collapsed') ? element.collapsed : !isExpanded(element)
|
|
@@ -40,11 +56,11 @@ function toggeling(element, target) {
|
|
|
40
56
|
|
|
41
57
|
var targetCollapsed;
|
|
42
58
|
|
|
43
|
-
if (
|
|
59
|
+
if (targetElement && (has(targetElement, 'collapsed') || has(targetElement, 'isExpanded'))) {
|
|
44
60
|
|
|
45
61
|
// property is explicitly set so use it
|
|
46
62
|
targetCollapsed = (
|
|
47
|
-
has(
|
|
63
|
+
has(targetElement, 'collapsed') ? targetElement.collapsed : !targetElement.isExpanded
|
|
48
64
|
);
|
|
49
65
|
} else {
|
|
50
66
|
|
|
@@ -53,7 +69,6 @@ function toggeling(element, target) {
|
|
|
53
69
|
}
|
|
54
70
|
|
|
55
71
|
if (oldCollapsed !== targetCollapsed) {
|
|
56
|
-
element.collapsed = oldCollapsed;
|
|
57
72
|
return true;
|
|
58
73
|
}
|
|
59
74
|
|
|
@@ -61,7 +76,6 @@ function toggeling(element, target) {
|
|
|
61
76
|
}
|
|
62
77
|
|
|
63
78
|
|
|
64
|
-
|
|
65
79
|
/**
|
|
66
80
|
* This module takes care of replacing BPMN elements
|
|
67
81
|
*/
|
|
@@ -92,15 +106,13 @@ export default function BpmnReplace(
|
|
|
92
106
|
var type = target.type,
|
|
93
107
|
oldBusinessObject = element.businessObject;
|
|
94
108
|
|
|
95
|
-
if (isSubProcess(oldBusinessObject)) {
|
|
96
|
-
if (
|
|
97
|
-
if (toggeling(element, target)) {
|
|
109
|
+
if (isSubProcess(oldBusinessObject) && type === 'bpmn:SubProcess') {
|
|
110
|
+
if (shouldToggleCollapsed(element, target)) {
|
|
98
111
|
|
|
99
|
-
|
|
100
|
-
|
|
112
|
+
// expanding or collapsing process
|
|
113
|
+
modeling.toggleCollapse(element);
|
|
101
114
|
|
|
102
|
-
|
|
103
|
-
}
|
|
115
|
+
return element;
|
|
104
116
|
}
|
|
105
117
|
}
|
|
106
118
|
|
|
@@ -109,9 +121,19 @@ export default function BpmnReplace(
|
|
|
109
121
|
var newElement = {
|
|
110
122
|
type: type,
|
|
111
123
|
businessObject: newBusinessObject,
|
|
112
|
-
di: getDi(element)
|
|
113
124
|
};
|
|
114
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
|
+
|
|
115
137
|
var elementProps = getPropertyNames(oldBusinessObject.$descriptor),
|
|
116
138
|
newElementProps = getPropertyNames(newBusinessObject.$descriptor, true),
|
|
117
139
|
copyProps = intersection(elementProps, newElementProps);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var defaultPosition = { x: 100, y: 50 };
|
|
2
|
+
|
|
3
|
+
export default function SubprocessCentering(eventBus, canvas) {
|
|
4
|
+
var currentPlane = 'base';
|
|
5
|
+
var positionMap = {};
|
|
6
|
+
|
|
7
|
+
eventBus.on('plane.set', function(event) {
|
|
8
|
+
|
|
9
|
+
var currentViewbox = canvas.viewbox();
|
|
10
|
+
positionMap[currentPlane] = {
|
|
11
|
+
x: currentViewbox.x,
|
|
12
|
+
y: currentViewbox.y,
|
|
13
|
+
zoom: currentViewbox.scale
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
var planeId = event.plane.name;
|
|
17
|
+
var storedViewbox = positionMap[planeId];
|
|
18
|
+
|
|
19
|
+
if (!storedViewbox) {
|
|
20
|
+
if (!event.plane.rootElement.isImplicit) {
|
|
21
|
+
storedViewbox = {
|
|
22
|
+
x: 0,
|
|
23
|
+
y: 0,
|
|
24
|
+
zoom: 1
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
var currentBoundingBox = canvas.getActiveLayer().getBBox();
|
|
29
|
+
storedViewbox = {
|
|
30
|
+
x: currentBoundingBox.x - defaultPosition.x,
|
|
31
|
+
y: currentBoundingBox.y - defaultPosition.y,
|
|
32
|
+
zoom: 1
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var dx = (currentViewbox.x - storedViewbox.x) * currentViewbox.scale,
|
|
38
|
+
dy = (currentViewbox.y - storedViewbox.y) * currentViewbox.scale;
|
|
39
|
+
|
|
40
|
+
if (dx !== 0 || dy !== 0) {
|
|
41
|
+
canvas.scroll({
|
|
42
|
+
dx: dx,
|
|
43
|
+
dy: dy
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (storedViewbox.zoom !== currentViewbox.scale) {
|
|
48
|
+
canvas.zoom(storedViewbox.zoom, { x: 0, y: 0 });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
currentPlane = planeId;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
SubprocessCentering.$inject = [ 'eventBus', 'canvas' ];
|