bpmn-js 16.3.2 → 16.5.0
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/dist/bpmn-modeler.development.js +686 -378
- package/dist/bpmn-modeler.production.min.js +26 -26
- package/dist/bpmn-navigated-viewer.development.js +3 -3
- package/dist/bpmn-navigated-viewer.production.min.js +2 -2
- package/dist/bpmn-viewer.development.js +3 -3
- package/dist/bpmn-viewer.production.min.js +2 -2
- package/lib/draw/BpmnRenderer.js +1 -1
- package/lib/features/context-pad/ContextPadProvider.js +7 -13
- package/lib/features/modeling/BpmnUpdater.js +3 -1
- package/lib/features/modeling/ElementFactory.js +14 -1
- package/lib/features/modeling/behavior/DeleteLaneBehavior.js +52 -7
- package/lib/features/modeling/behavior/FixHoverBehavior.js +2 -4
- package/lib/features/modeling/behavior/ResizeBehavior.d.ts +10 -0
- package/lib/features/modeling/behavior/ResizeBehavior.js +262 -210
- package/lib/features/modeling/behavior/SpaceToolBehavior.js +207 -139
- package/lib/features/modeling/behavior/TextAnnotationBehavior.d.ts +6 -0
- package/lib/features/modeling/behavior/TextAnnotationBehavior.js +43 -0
- package/lib/features/modeling/behavior/index.js +3 -0
- package/lib/features/modeling/cmd/AddLaneHandler.js +93 -10
- package/lib/features/modeling/util/LaneUtil.js +30 -4
- package/lib/features/ordering/BpmnOrderingProvider.js +9 -2
- package/lib/features/palette/PaletteProvider.js +2 -9
- package/lib/features/replace/BpmnReplace.js +4 -0
- package/lib/features/rules/BpmnRules.js +2 -2
- package/lib/features/space-tool/BpmnSpaceTool.js +8 -3
- package/lib/model/Types.d.ts +1 -0
- package/lib/model/Types.ts +1 -0
- package/package.json +2 -2
|
@@ -1,139 +1,207 @@
|
|
|
1
|
-
import { forEach } from 'min-dash';
|
|
2
|
-
|
|
3
|
-
import { is } from '../../../util/ModelUtil';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (is(shape, 'bpmn:SubProcess') && isExpanded(shape)) {
|
|
52
|
-
minDimensions[ id ] = SUB_PROCESS_MIN_DIMENSIONS;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (is(shape, 'bpmn:TextAnnotation')) {
|
|
56
|
-
minDimensions[ id ] = TEXT_ANNOTATION_MIN_DIMENSIONS;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (is(shape, 'bpmn:Group')) {
|
|
60
|
-
minDimensions[ id ] = GROUP_MIN_DIMENSIONS;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
return minDimensions;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
SpaceToolBehavior.$inject = [ 'eventBus' ];
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
// helpers //////////
|
|
72
|
-
function
|
|
73
|
-
return axis === 'x';
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Get minimum
|
|
78
|
-
*
|
|
79
|
-
* @param {Shape} participant
|
|
80
|
-
* @param {
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
1
|
+
import { forEach } from 'min-dash';
|
|
2
|
+
|
|
3
|
+
import { is } from '../../../util/ModelUtil';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
isExpanded,
|
|
7
|
+
isHorizontal
|
|
8
|
+
} from '../../../util/DiUtil';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
GROUP_MIN_DIMENSIONS,
|
|
12
|
+
LANE_MIN_DIMENSIONS,
|
|
13
|
+
VERTICAL_LANE_MIN_DIMENSIONS,
|
|
14
|
+
PARTICIPANT_MIN_DIMENSIONS,
|
|
15
|
+
VERTICAL_PARTICIPANT_MIN_DIMENSIONS,
|
|
16
|
+
SUB_PROCESS_MIN_DIMENSIONS,
|
|
17
|
+
TEXT_ANNOTATION_MIN_DIMENSIONS
|
|
18
|
+
} from './ResizeBehavior';
|
|
19
|
+
|
|
20
|
+
import { getChildLanes } from '../util/LaneUtil';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
24
|
+
*
|
|
25
|
+
* @typedef {import('../../../model/Types').Shape} Shape
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
var max = Math.max;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {EventBus} eventBus
|
|
32
|
+
*/
|
|
33
|
+
export default function SpaceToolBehavior(eventBus) {
|
|
34
|
+
eventBus.on('spaceTool.getMinDimensions', function(context) {
|
|
35
|
+
var shapes = context.shapes,
|
|
36
|
+
axis = context.axis,
|
|
37
|
+
start = context.start,
|
|
38
|
+
minDimensions = {};
|
|
39
|
+
|
|
40
|
+
forEach(shapes, function(shape) {
|
|
41
|
+
var id = shape.id;
|
|
42
|
+
|
|
43
|
+
if (is(shape, 'bpmn:Participant')) {
|
|
44
|
+
minDimensions[ id ] = getParticipantMinDimensions(shape, axis, start);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (is(shape, 'bpmn:Lane')) {
|
|
48
|
+
minDimensions[ id ] = isHorizontal(shape) ? LANE_MIN_DIMENSIONS : VERTICAL_LANE_MIN_DIMENSIONS;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (is(shape, 'bpmn:SubProcess') && isExpanded(shape)) {
|
|
52
|
+
minDimensions[ id ] = SUB_PROCESS_MIN_DIMENSIONS;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (is(shape, 'bpmn:TextAnnotation')) {
|
|
56
|
+
minDimensions[ id ] = TEXT_ANNOTATION_MIN_DIMENSIONS;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (is(shape, 'bpmn:Group')) {
|
|
60
|
+
minDimensions[ id ] = GROUP_MIN_DIMENSIONS;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
return minDimensions;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
SpaceToolBehavior.$inject = [ 'eventBus' ];
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
// helpers //////////
|
|
72
|
+
function isHorizontalAxis(axis) {
|
|
73
|
+
return axis === 'x';
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Get minimum dimensions for participant taking lanes into account.
|
|
78
|
+
*
|
|
79
|
+
* @param {Shape} participant
|
|
80
|
+
* @param {Axis} axis
|
|
81
|
+
* @param {number} start
|
|
82
|
+
*
|
|
83
|
+
* @return {number}
|
|
84
|
+
*/
|
|
85
|
+
function getParticipantMinDimensions(participant, axis, start) {
|
|
86
|
+
var isHorizontalLane = isHorizontal(participant);
|
|
87
|
+
|
|
88
|
+
if (!hasChildLanes(participant)) {
|
|
89
|
+
return isHorizontalLane ? PARTICIPANT_MIN_DIMENSIONS : VERTICAL_PARTICIPANT_MIN_DIMENSIONS;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
var isHorizontalResize = isHorizontalAxis(axis);
|
|
93
|
+
var minDimensions = {};
|
|
94
|
+
|
|
95
|
+
if (isHorizontalResize) {
|
|
96
|
+
if (isHorizontalLane) {
|
|
97
|
+
minDimensions = PARTICIPANT_MIN_DIMENSIONS;
|
|
98
|
+
} else {
|
|
99
|
+
minDimensions = {
|
|
100
|
+
width: getParticipantMinWidth(participant, start, isHorizontalResize),
|
|
101
|
+
height: VERTICAL_PARTICIPANT_MIN_DIMENSIONS.height
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
} else {
|
|
106
|
+
if (isHorizontalLane) {
|
|
107
|
+
minDimensions = {
|
|
108
|
+
width: PARTICIPANT_MIN_DIMENSIONS.width,
|
|
109
|
+
height: getParticipantMinHeight(participant, start, isHorizontalResize)
|
|
110
|
+
};
|
|
111
|
+
} else {
|
|
112
|
+
minDimensions = VERTICAL_PARTICIPANT_MIN_DIMENSIONS;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return minDimensions;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Get minimum height for participant taking lanes into account.
|
|
121
|
+
*
|
|
122
|
+
* @param {Shape} participant
|
|
123
|
+
* @param {number} start
|
|
124
|
+
* @param {boolean} isHorizontalResize
|
|
125
|
+
*
|
|
126
|
+
* @return {number}
|
|
127
|
+
*/
|
|
128
|
+
function getParticipantMinHeight(participant, start, isHorizontalResize) {
|
|
129
|
+
var lanesMinHeight;
|
|
130
|
+
lanesMinHeight = getLanesMinHeight(participant, start, isHorizontalResize);
|
|
131
|
+
return max(PARTICIPANT_MIN_DIMENSIONS.height, lanesMinHeight);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Get minimum width for participant taking lanes into account.
|
|
136
|
+
*
|
|
137
|
+
* @param {Shape} participant
|
|
138
|
+
* @param {number} start
|
|
139
|
+
* @param {boolean} isHorizontalResize
|
|
140
|
+
*
|
|
141
|
+
* @return {number}
|
|
142
|
+
*/
|
|
143
|
+
function getParticipantMinWidth(participant, start, isHorizontalResize) {
|
|
144
|
+
var lanesMinWidth;
|
|
145
|
+
lanesMinWidth = getLanesMinWidth(participant, start, isHorizontalResize);
|
|
146
|
+
return max(VERTICAL_PARTICIPANT_MIN_DIMENSIONS.width, lanesMinWidth);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function hasChildLanes(element) {
|
|
150
|
+
return !!getChildLanes(element).length;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function getLanesMinHeight(participant, resizeStart, isHorizontalResize) {
|
|
154
|
+
var lanes = getChildLanes(participant),
|
|
155
|
+
resizedLane;
|
|
156
|
+
|
|
157
|
+
// find the nested lane which is currently resized
|
|
158
|
+
resizedLane = findResizedLane(lanes, resizeStart, isHorizontalResize);
|
|
159
|
+
|
|
160
|
+
// resized lane cannot shrink below the minimum height
|
|
161
|
+
// but remaining lanes' dimensions are kept intact
|
|
162
|
+
return participant.height - resizedLane.height + LANE_MIN_DIMENSIONS.height;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function getLanesMinWidth(participant, resizeStart, isHorizontalResize) {
|
|
166
|
+
var lanes = getChildLanes(participant),
|
|
167
|
+
resizedLane;
|
|
168
|
+
|
|
169
|
+
// find the nested lane which is currently resized
|
|
170
|
+
resizedLane = findResizedLane(lanes, resizeStart, isHorizontalResize);
|
|
171
|
+
|
|
172
|
+
// resized lane cannot shrink below the minimum width
|
|
173
|
+
// but remaining lanes' dimensions are kept intact
|
|
174
|
+
return participant.width - resizedLane.width + VERTICAL_LANE_MIN_DIMENSIONS.width;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Find nested lane which is currently resized.
|
|
179
|
+
*
|
|
180
|
+
* @param {Shape[]} lanes
|
|
181
|
+
* @param {number} resizeStart
|
|
182
|
+
* @param {boolean} isHorizontalResize
|
|
183
|
+
*
|
|
184
|
+
* @return {Shape}
|
|
185
|
+
*/
|
|
186
|
+
function findResizedLane(lanes, resizeStart, isHorizontalResize) {
|
|
187
|
+
var i, lane, childLanes;
|
|
188
|
+
|
|
189
|
+
for (i = 0; i < lanes.length; i++) {
|
|
190
|
+
lane = lanes[i];
|
|
191
|
+
|
|
192
|
+
// resizing current lane or a lane nested
|
|
193
|
+
if (!isHorizontalResize && resizeStart >= lane.y && resizeStart <= lane.y + lane.height ||
|
|
194
|
+
isHorizontalResize && resizeStart >= lane.x && resizeStart <= lane.x + lane.width) {
|
|
195
|
+
|
|
196
|
+
childLanes = getChildLanes(lane);
|
|
197
|
+
|
|
198
|
+
// a nested lane is resized
|
|
199
|
+
if (childLanes.length) {
|
|
200
|
+
return findResizedLane(childLanes, resizeStart, isHorizontalResize);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// current lane is the resized one
|
|
204
|
+
return lane;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import inherits from 'inherits-browser';
|
|
2
|
+
|
|
3
|
+
import { is } from '../../../util/ModelUtil';
|
|
4
|
+
|
|
5
|
+
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export default function TextAnnotationBehavior(eventBus) {
|
|
12
|
+
|
|
13
|
+
CommandInterceptor.call(this, eventBus);
|
|
14
|
+
|
|
15
|
+
// On Append, TextAnnotations will be created on the Root.
|
|
16
|
+
// The default for connections will create the connection in the parent of
|
|
17
|
+
// the source element, so we overwrite the parent here.
|
|
18
|
+
this.preExecute('connection.create', function(context) {
|
|
19
|
+
const { target } = context;
|
|
20
|
+
|
|
21
|
+
if (!is(target, 'bpmn:TextAnnotation')) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
context.parent = target.parent;
|
|
26
|
+
}, true);
|
|
27
|
+
|
|
28
|
+
this.preExecute([ 'shape.create', 'shape.resize', 'elements.move' ], function(context) {
|
|
29
|
+
const shapes = context.shapes || [ context.shape ];
|
|
30
|
+
|
|
31
|
+
if (shapes.length === 1 && is(shapes[0], 'bpmn:TextAnnotation')) {
|
|
32
|
+
context.hints = context.hints || {};
|
|
33
|
+
|
|
34
|
+
context.hints.autoResize = false;
|
|
35
|
+
}
|
|
36
|
+
}, true);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
inherits(TextAnnotationBehavior, CommandInterceptor);
|
|
40
|
+
|
|
41
|
+
TextAnnotationBehavior.$inject = [
|
|
42
|
+
'eventBus'
|
|
43
|
+
];
|
|
@@ -32,6 +32,7 @@ import RootElementReferenceBehavior from './RootElementReferenceBehavior';
|
|
|
32
32
|
import SpaceToolBehavior from './SpaceToolBehavior';
|
|
33
33
|
import SubProcessPlaneBehavior from './SubProcessPlaneBehavior';
|
|
34
34
|
import SubProcessStartEventBehavior from './SubProcessStartEventBehavior';
|
|
35
|
+
import TextAnnotationBehavior from './TextAnnotationBehavior';
|
|
35
36
|
import ToggleCollapseConnectionBehaviour from './ToggleCollapseConnectionBehaviour';
|
|
36
37
|
import ToggleElementCollapseBehaviour from './ToggleElementCollapseBehaviour';
|
|
37
38
|
import UnclaimIdBehavior from './UnclaimIdBehavior';
|
|
@@ -77,6 +78,7 @@ export default {
|
|
|
77
78
|
'spaceToolBehavior',
|
|
78
79
|
'subProcessPlaneBehavior',
|
|
79
80
|
'subProcessStartEventBehavior',
|
|
81
|
+
'textAnnotationBehavior',
|
|
80
82
|
'toggleCollapseConnectionBehaviour',
|
|
81
83
|
'toggleElementCollapseBehaviour',
|
|
82
84
|
'unclaimIdBehavior',
|
|
@@ -117,6 +119,7 @@ export default {
|
|
|
117
119
|
spaceToolBehavior: [ 'type', SpaceToolBehavior ],
|
|
118
120
|
subProcessPlaneBehavior: [ 'type', SubProcessPlaneBehavior ],
|
|
119
121
|
subProcessStartEventBehavior: [ 'type', SubProcessStartEventBehavior ],
|
|
122
|
+
textAnnotationBehavior: [ 'type', TextAnnotationBehavior ],
|
|
120
123
|
toggleCollapseConnectionBehaviour: [ 'type', ToggleCollapseConnectionBehaviour ],
|
|
121
124
|
toggleElementCollapseBehaviour : [ 'type', ToggleElementCollapseBehaviour ],
|
|
122
125
|
unclaimIdBehavior: [ 'type', UnclaimIdBehavior ],
|
|
@@ -12,6 +12,10 @@ import {
|
|
|
12
12
|
LANE_INDENTATION
|
|
13
13
|
} from '../util/LaneUtil';
|
|
14
14
|
|
|
15
|
+
import {
|
|
16
|
+
isHorizontal
|
|
17
|
+
} from '../../../util/DiUtil';
|
|
18
|
+
|
|
15
19
|
/**
|
|
16
20
|
* @typedef {import('diagram-js/lib/command/CommandHandler').default} CommandHandler
|
|
17
21
|
*
|
|
@@ -54,14 +58,47 @@ AddLaneHandler.prototype.preExecute = function(context) {
|
|
|
54
58
|
|
|
55
59
|
var existingChildLanes = getChildLanes(laneParent);
|
|
56
60
|
|
|
61
|
+
var isHorizontalLane = isHorizontal(shape);
|
|
62
|
+
|
|
63
|
+
// never mix up horizontal/vertical lanes
|
|
64
|
+
if (isHorizontalLane) {
|
|
65
|
+
if (location === 'left') {
|
|
66
|
+
location = 'top';
|
|
67
|
+
} else
|
|
68
|
+
if (location === 'right') {
|
|
69
|
+
location = 'bottom';
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
if (location === 'top') {
|
|
73
|
+
location = 'left';
|
|
74
|
+
} else
|
|
75
|
+
if (location === 'bottom') {
|
|
76
|
+
location = 'right';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
57
80
|
// (0) add a lane if we currently got none and are adding to root
|
|
58
81
|
if (!existingChildLanes.length) {
|
|
59
|
-
|
|
82
|
+
var siblingPosition = isHorizontalLane ? {
|
|
60
83
|
x: shape.x + LANE_INDENTATION,
|
|
61
84
|
y: shape.y,
|
|
62
85
|
width: shape.width - LANE_INDENTATION,
|
|
63
86
|
height: shape.height
|
|
64
|
-
}
|
|
87
|
+
} : {
|
|
88
|
+
x: shape.x,
|
|
89
|
+
y: shape.y + LANE_INDENTATION,
|
|
90
|
+
width: shape.width,
|
|
91
|
+
height: shape.height - LANE_INDENTATION
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
modeling.createShape(
|
|
95
|
+
{
|
|
96
|
+
type: 'bpmn:Lane',
|
|
97
|
+
isHorizontal: isHorizontalLane
|
|
98
|
+
},
|
|
99
|
+
siblingPosition,
|
|
100
|
+
laneParent
|
|
101
|
+
);
|
|
65
102
|
}
|
|
66
103
|
|
|
67
104
|
// (1) collect affected elements to create necessary space
|
|
@@ -84,26 +121,72 @@ AddLaneHandler.prototype.preExecute = function(context) {
|
|
|
84
121
|
});
|
|
85
122
|
});
|
|
86
123
|
|
|
87
|
-
var offset
|
|
88
|
-
lanePosition
|
|
89
|
-
spacePos
|
|
90
|
-
direction
|
|
124
|
+
var offset,
|
|
125
|
+
lanePosition,
|
|
126
|
+
spacePos,
|
|
127
|
+
direction,
|
|
128
|
+
axis;
|
|
129
|
+
|
|
130
|
+
if (location === 'top') {
|
|
131
|
+
offset = -120;
|
|
132
|
+
lanePosition = shape.y;
|
|
133
|
+
spacePos = lanePosition + 10;
|
|
134
|
+
direction = 'n';
|
|
135
|
+
axis = 'y';
|
|
136
|
+
} else
|
|
137
|
+
if (location === 'left') {
|
|
138
|
+
offset = -120;
|
|
139
|
+
lanePosition = shape.x;
|
|
140
|
+
spacePos = lanePosition + 10;
|
|
141
|
+
direction = 'w';
|
|
142
|
+
axis = 'x';
|
|
143
|
+
} else
|
|
144
|
+
if (location === 'bottom') {
|
|
145
|
+
offset = 120;
|
|
146
|
+
lanePosition = shape.y + shape.height;
|
|
147
|
+
spacePos = lanePosition - 10;
|
|
148
|
+
direction = 's';
|
|
149
|
+
axis = 'y';
|
|
150
|
+
} else
|
|
151
|
+
if (location === 'right') {
|
|
152
|
+
offset = 120;
|
|
153
|
+
lanePosition = shape.x + shape.width;
|
|
154
|
+
spacePos = lanePosition - 10;
|
|
155
|
+
direction = 'e';
|
|
156
|
+
axis = 'x';
|
|
157
|
+
}
|
|
91
158
|
|
|
92
|
-
var adjustments = spaceTool.calculateAdjustments(allAffected,
|
|
159
|
+
var adjustments = spaceTool.calculateAdjustments(allAffected, axis, offset, spacePos);
|
|
160
|
+
|
|
161
|
+
var delta = isHorizontalLane ? { x: 0, y: offset } : { x: offset, y: 0 };
|
|
93
162
|
|
|
94
163
|
spaceTool.makeSpace(
|
|
95
164
|
adjustments.movingShapes,
|
|
96
165
|
adjustments.resizingShapes,
|
|
97
|
-
|
|
166
|
+
delta,
|
|
98
167
|
direction,
|
|
99
168
|
spacePos
|
|
100
169
|
);
|
|
101
170
|
|
|
102
171
|
// (2) create new lane at open space
|
|
103
|
-
|
|
172
|
+
var newLanePosition = isHorizontalLane ? {
|
|
104
173
|
x: shape.x + (isRoot ? LANE_INDENTATION : 0),
|
|
105
174
|
y: lanePosition - (location === 'top' ? 120 : 0),
|
|
106
175
|
width: shape.width - (isRoot ? LANE_INDENTATION : 0),
|
|
107
176
|
height: 120
|
|
108
|
-
}
|
|
177
|
+
} : {
|
|
178
|
+
x: lanePosition - (location === 'left' ? 120 : 0),
|
|
179
|
+
y: shape.y + (isRoot ? LANE_INDENTATION : 0),
|
|
180
|
+
width: 120,
|
|
181
|
+
height: shape.height - (isRoot ? LANE_INDENTATION : 0)
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
context.newLane = modeling.createShape(
|
|
185
|
+
{
|
|
186
|
+
type: 'bpmn:Lane',
|
|
187
|
+
isHorizontal: isHorizontalLane
|
|
188
|
+
},
|
|
189
|
+
newLanePosition,
|
|
190
|
+
laneParent
|
|
191
|
+
);
|
|
109
192
|
};
|
|
@@ -4,6 +4,10 @@ import {
|
|
|
4
4
|
getParent
|
|
5
5
|
} from './ModelingUtil';
|
|
6
6
|
|
|
7
|
+
import {
|
|
8
|
+
isHorizontal
|
|
9
|
+
} from '../../../util/DiUtil';
|
|
10
|
+
|
|
7
11
|
import {
|
|
8
12
|
asTRBL
|
|
9
13
|
} from 'diagram-js/lib/layout/LayoutUtil';
|
|
@@ -111,16 +115,18 @@ export function computeLanesResize(shape, newBounds) {
|
|
|
111
115
|
trblResize = getTRBLResize(shape, newBounds),
|
|
112
116
|
resizeNeeded = [];
|
|
113
117
|
|
|
118
|
+
var isHorizontalLane = isHorizontal(shape);
|
|
119
|
+
|
|
114
120
|
allLanes.forEach(function(other) {
|
|
115
121
|
|
|
116
122
|
if (other === shape) {
|
|
117
123
|
return;
|
|
118
124
|
}
|
|
119
125
|
|
|
120
|
-
var topResize = 0,
|
|
121
|
-
rightResize = trblResize.right,
|
|
122
|
-
bottomResize = 0,
|
|
123
|
-
leftResize = trblResize.left;
|
|
126
|
+
var topResize = isHorizontalLane ? 0 : trblResize.top,
|
|
127
|
+
rightResize = isHorizontalLane ? trblResize.right : 0,
|
|
128
|
+
bottomResize = isHorizontalLane ? 0 : trblResize.bottom,
|
|
129
|
+
leftResize = isHorizontalLane ? trblResize.left : 0;
|
|
124
130
|
|
|
125
131
|
var otherTrbl = asTRBL(other);
|
|
126
132
|
|
|
@@ -134,6 +140,16 @@ export function computeLanesResize(shape, newBounds) {
|
|
|
134
140
|
}
|
|
135
141
|
}
|
|
136
142
|
|
|
143
|
+
if (trblResize.left) {
|
|
144
|
+
if (abs(otherTrbl.right - shapeTrbl.left) < 10) {
|
|
145
|
+
rightResize = shapeNewTrbl.left - otherTrbl.right;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (abs(otherTrbl.left - shapeTrbl.left) < 5) {
|
|
149
|
+
leftResize = shapeNewTrbl.left - otherTrbl.left;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
137
153
|
if (trblResize.bottom) {
|
|
138
154
|
if (abs(otherTrbl.top - shapeTrbl.bottom) < 10) {
|
|
139
155
|
topResize = shapeNewTrbl.bottom - otherTrbl.top;
|
|
@@ -144,6 +160,16 @@ export function computeLanesResize(shape, newBounds) {
|
|
|
144
160
|
}
|
|
145
161
|
}
|
|
146
162
|
|
|
163
|
+
if (trblResize.right) {
|
|
164
|
+
if (abs(otherTrbl.left - shapeTrbl.right) < 10) {
|
|
165
|
+
leftResize = shapeNewTrbl.right - otherTrbl.left;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (abs(otherTrbl.right - shapeTrbl.right) < 5) {
|
|
169
|
+
rightResize = shapeNewTrbl.right - otherTrbl.right;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
147
173
|
if (topResize || rightResize || bottomResize || leftResize) {
|
|
148
174
|
|
|
149
175
|
resizeNeeded.push({
|
|
@@ -3,6 +3,7 @@ import inherits from 'inherits-browser';
|
|
|
3
3
|
import OrderingProvider from 'diagram-js/lib/features/ordering/OrderingProvider';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
+
is,
|
|
6
7
|
isAny
|
|
7
8
|
} from '../modeling/util/ModelingUtil';
|
|
8
9
|
|
|
@@ -54,6 +55,12 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) {
|
|
|
54
55
|
]
|
|
55
56
|
}
|
|
56
57
|
},
|
|
58
|
+
{
|
|
59
|
+
type: 'bpmn:TextAnnotation',
|
|
60
|
+
order: {
|
|
61
|
+
level: 9
|
|
62
|
+
}
|
|
63
|
+
},
|
|
57
64
|
{
|
|
58
65
|
type: 'bpmn:MessageFlow', order: {
|
|
59
66
|
level: 9,
|
|
@@ -136,8 +143,8 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) {
|
|
|
136
143
|
|
|
137
144
|
this.getOrdering = function(element, newParent) {
|
|
138
145
|
|
|
139
|
-
// render labels always on top
|
|
140
|
-
if (element.labelTarget) {
|
|
146
|
+
// render labels and text annotations always on top
|
|
147
|
+
if (element.labelTarget || is(element, 'bpmn:TextAnnotation')) {
|
|
141
148
|
return {
|
|
142
149
|
parent: canvas.findRoot(newParent) || canvas.getRootElement(),
|
|
143
150
|
index: -1
|