bpmn-js 8.7.3 → 8.8.3
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 +22 -1
- package/dist/assets/diagram-js.css +2 -0
- package/dist/bpmn-modeler.development.js +407 -127
- package/dist/bpmn-modeler.production.min.js +8 -8
- package/dist/bpmn-navigated-viewer.development.js +326 -62
- package/dist/bpmn-navigated-viewer.production.min.js +5 -5
- package/dist/bpmn-viewer.development.js +299 -58
- package/dist/bpmn-viewer.production.min.js +5 -5
- package/lib/draw/PathMap.js +2 -2
- package/lib/features/copy-paste/ModdleCopy.js +19 -2
- package/lib/features/modeling/behavior/DropOnFlowBehavior.js +2 -2
- package/lib/features/modeling/behavior/ResizeBehavior.js +129 -3
- package/lib/features/modeling/behavior/util/ResizeUtil.js +1 -132
- package/package.json +2 -2
- package/test/util/MockEvents.js +10 -2
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) {
|
|
@@ -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) {
|
|
@@ -59,12 +59,12 @@ export default function DropOnFlowBehavior(eventBus, bpmnRules, modeling) {
|
|
|
59
59
|
dockingPoint = intersection.bendpoint ? waypoints[intersection.index] : mid;
|
|
60
60
|
|
|
61
61
|
// if last waypointBefore is inside shape's bounds, ignore docking point
|
|
62
|
-
if (!isPointInsideBBox(shape, waypointsBefore[waypointsBefore.length-1])) {
|
|
62
|
+
if (waypointsBefore.length === 1 || !isPointInsideBBox(shape, waypointsBefore[waypointsBefore.length-1])) {
|
|
63
63
|
waypointsBefore.push(copy(dockingPoint));
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
// if first waypointAfter is inside shape's bounds, ignore docking point
|
|
67
|
-
if (!isPointInsideBBox(shape, waypointsAfter[0])) {
|
|
67
|
+
if (waypointsAfter.length === 1 || !isPointInsideBBox(shape, waypointsAfter[0])) {
|
|
68
68
|
waypointsAfter.unshift(copy(dockingPoint));
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -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';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmn-js",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.8.3",
|
|
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.3
|
|
103
|
+
"diagram-js": "^7.6.3",
|
|
104
104
|
"diagram-js-direct-editing": "^1.6.3",
|
|
105
105
|
"ids": "^1.0.0",
|
|
106
106
|
"inherits": "^2.0.4",
|
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) {
|