bpmn-js 9.0.0-subprocesses.3 → 9.0.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/CHANGELOG.md +56 -0
- package/dist/assets/bpmn-js.css +38 -4
- package/dist/assets/diagram-js.css +1 -1
- package/dist/bpmn-modeler.development.js +2411 -1110
- package/dist/bpmn-modeler.production.min.js +8 -8
- package/dist/bpmn-navigated-viewer.development.js +983 -315
- package/dist/bpmn-navigated-viewer.production.min.js +6 -6
- package/dist/bpmn-viewer.development.js +983 -315
- package/dist/bpmn-viewer.production.min.js +6 -6
- package/lib/BaseViewer.js +1 -1
- package/lib/draw/BpmnRenderer.js +8 -7
- package/lib/features/auto-resize/BpmnAutoResizeProvider.js +6 -0
- package/lib/features/copy-paste/BpmnCopyPaste.js +1 -0
- package/lib/features/di-ordering/BpmnDiOrdering.js +15 -11
- package/lib/features/drilldown/DrilldownBreadcrumbs.js +122 -0
- package/lib/features/drilldown/DrilldownCentering.js +87 -10
- package/lib/features/drilldown/DrilldownOverlayBehavior.js +181 -0
- package/lib/features/drilldown/SubprocessCompatibility.js +9 -6
- package/lib/features/drilldown/index.js +7 -4
- package/lib/features/label-editing/LabelEditingProvider.js +1 -1
- package/lib/features/label-editing/cmd/UpdateLabelHandler.js +29 -2
- package/lib/features/modeling/BpmnFactory.js +5 -1
- package/lib/features/modeling/BpmnUpdater.js +43 -1
- package/lib/features/modeling/ElementFactory.js +4 -0
- package/lib/features/modeling/behavior/CreateParticipantBehavior.js +59 -84
- package/lib/features/modeling/behavior/DropOnFlowBehavior.js +2 -2
- package/lib/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehavior.js +34 -0
- package/lib/features/modeling/behavior/SubProcessPlaneBehavior.js +557 -0
- package/lib/features/modeling/behavior/ToggleCollapseConnectionBehaviour.js +74 -0
- package/lib/features/modeling/behavior/UnclaimIdBehavior.js +3 -1
- package/lib/features/modeling/behavior/index.js +27 -18
- package/lib/features/modeling/cmd/SetColorHandler.js +23 -6
- package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +4 -2
- package/lib/features/modeling/util/ModelingUtil.js +2 -20
- package/lib/features/ordering/BpmnOrderingProvider.js +3 -3
- package/lib/features/palette/PaletteProvider.js +1 -1
- package/lib/features/popup-menu/ReplaceMenuProvider.js +1 -1
- package/lib/import/BpmnImporter.js +15 -9
- package/lib/import/Importer.js +130 -10
- package/lib/util/DrilldownUtil.js +66 -0
- package/lib/util/ModelUtil.js +19 -0
- package/package.json +2 -2
- package/lib/features/drilldown/DrilldownOverlays.js +0 -110
|
@@ -24,6 +24,10 @@ import {
|
|
|
24
24
|
isAny
|
|
25
25
|
} from './util/ModelingUtil';
|
|
26
26
|
|
|
27
|
+
import {
|
|
28
|
+
delta
|
|
29
|
+
} from 'diagram-js/lib/util/PositionUtil';
|
|
30
|
+
|
|
27
31
|
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
28
32
|
|
|
29
33
|
/**
|
|
@@ -344,7 +348,18 @@ BpmnUpdater.prototype.updateParent = function(element, oldParent) {
|
|
|
344
348
|
|
|
345
349
|
BpmnUpdater.prototype.updateBounds = function(shape) {
|
|
346
350
|
|
|
347
|
-
var di = getDi(shape)
|
|
351
|
+
var di = getDi(shape),
|
|
352
|
+
embeddedLabelBounds = getEmbeddedLabelBounds(shape);
|
|
353
|
+
|
|
354
|
+
// update embedded label bounds if possible
|
|
355
|
+
if (embeddedLabelBounds) {
|
|
356
|
+
var embeddedLabelBoundsDelta = delta(embeddedLabelBounds, di.get('bounds'));
|
|
357
|
+
|
|
358
|
+
assign(embeddedLabelBounds, {
|
|
359
|
+
x: shape.x + embeddedLabelBoundsDelta.x,
|
|
360
|
+
y: shape.y + embeddedLabelBoundsDelta.y
|
|
361
|
+
});
|
|
362
|
+
}
|
|
348
363
|
|
|
349
364
|
var target = (shape instanceof Label) ? this._getLabel(di) : di;
|
|
350
365
|
|
|
@@ -718,3 +733,30 @@ function ifBpmn(fn) {
|
|
|
718
733
|
}
|
|
719
734
|
};
|
|
720
735
|
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Return dc:Bounds of bpmndi:BPMNLabel if exists.
|
|
739
|
+
*
|
|
740
|
+
* @param {djs.model.shape} shape
|
|
741
|
+
*
|
|
742
|
+
* @returns {Object|undefined}
|
|
743
|
+
*/
|
|
744
|
+
function getEmbeddedLabelBounds(shape) {
|
|
745
|
+
if (!is(shape, 'bpmn:Activity')) {
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
var di = getDi(shape);
|
|
750
|
+
|
|
751
|
+
if (!di) {
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
var label = di.get('label');
|
|
756
|
+
|
|
757
|
+
if (!label) {
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
return label.get('bounds');
|
|
762
|
+
}
|
|
@@ -117,6 +117,10 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
|
|
117
117
|
applyAttribute(di, attrs, 'isExpanded');
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
if (is(businessObject, 'bpmn:SubProcess')) {
|
|
121
|
+
attrs.collapsed = !isExpanded(businessObject, di);
|
|
122
|
+
}
|
|
123
|
+
|
|
120
124
|
if (is(businessObject, 'bpmn:ExclusiveGateway')) {
|
|
121
125
|
di.isMarkerVisible = true;
|
|
122
126
|
}
|
|
@@ -2,7 +2,7 @@ import inherits from 'inherits';
|
|
|
2
2
|
|
|
3
3
|
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
4
4
|
|
|
5
|
-
import { is } from '../../../util/ModelUtil';
|
|
5
|
+
import { getBusinessObject, is } from '../../../util/ModelUtil';
|
|
6
6
|
|
|
7
7
|
import { isLabel } from '../../../util/LabelUtil';
|
|
8
8
|
|
|
@@ -88,122 +88,97 @@ export default function CreateParticipantBehavior(canvas, eventBus, modeling) {
|
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
collaboration;
|
|
94
|
-
|
|
91
|
+
// turn process into collaboration when creating first participant
|
|
92
|
+
function getOrCreateCollaboration() {
|
|
95
93
|
var rootElement = canvas.getRootElement();
|
|
96
94
|
|
|
97
95
|
if (is(rootElement, 'bpmn:Collaboration')) {
|
|
98
|
-
|
|
99
|
-
} else {
|
|
100
|
-
|
|
101
|
-
// update root element by making collaboration
|
|
102
|
-
collaboration = modeling.makeCollaboration();
|
|
103
|
-
|
|
104
|
-
// re-use process when creating first participant
|
|
105
|
-
context.process = parent;
|
|
96
|
+
return rootElement;
|
|
106
97
|
}
|
|
107
98
|
|
|
108
|
-
|
|
99
|
+
return modeling.makeCollaboration();
|
|
109
100
|
}
|
|
110
101
|
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
}, true);
|
|
120
|
-
|
|
121
|
-
this.execute('shape.create', function(context) {
|
|
122
|
-
var process = context.process,
|
|
123
|
-
shape = context.shape;
|
|
124
|
-
|
|
125
|
-
if (process) {
|
|
126
|
-
context.oldProcessRef = shape.businessObject.processRef;
|
|
127
|
-
|
|
128
|
-
// re-use process when creating first participant
|
|
129
|
-
shape.businessObject.processRef = process.businessObject;
|
|
130
|
-
}
|
|
131
|
-
}, true);
|
|
102
|
+
// when creating mutliple elements through `elements.create` parent must be set to collaboration
|
|
103
|
+
// and passed to `shape.create` as hint
|
|
104
|
+
this.preExecute('elements.create', HIGH_PRIORITY, function(context) {
|
|
105
|
+
var elements = context.elements,
|
|
106
|
+
parent = context.parent,
|
|
107
|
+
participant = findParticipant(elements),
|
|
108
|
+
hints;
|
|
132
109
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
shape = context.shape;
|
|
110
|
+
if (participant && is(parent, 'bpmn:Process')) {
|
|
111
|
+
context.parent = getOrCreateCollaboration();
|
|
136
112
|
|
|
137
|
-
|
|
113
|
+
hints = context.hints = context.hints || {};
|
|
138
114
|
|
|
139
|
-
|
|
140
|
-
|
|
115
|
+
hints.participant = participant;
|
|
116
|
+
hints.process = parent;
|
|
117
|
+
hints.processRef = getBusinessObject(participant).get('processRef');
|
|
141
118
|
}
|
|
142
119
|
}, true);
|
|
143
120
|
|
|
144
|
-
|
|
145
|
-
|
|
121
|
+
// when creating single shape through `shape.create` parent must be set to collaboration
|
|
122
|
+
// unless it was already set through `elements.create`
|
|
123
|
+
this.preExecute('shape.create', function(context) {
|
|
124
|
+
var parent = context.parent,
|
|
146
125
|
shape = context.shape;
|
|
147
126
|
|
|
148
|
-
if (
|
|
149
|
-
|
|
150
|
-
// move children from process to participant
|
|
151
|
-
var processChildren = process.children.slice();
|
|
127
|
+
if (is(shape, 'bpmn:Participant') && is(parent, 'bpmn:Process')) {
|
|
128
|
+
context.parent = getOrCreateCollaboration();
|
|
152
129
|
|
|
153
|
-
|
|
130
|
+
context.process = parent;
|
|
131
|
+
context.processRef = getBusinessObject(shape).get('processRef');
|
|
154
132
|
}
|
|
155
|
-
|
|
156
133
|
}, true);
|
|
157
134
|
|
|
158
|
-
//
|
|
159
|
-
this.
|
|
160
|
-
var
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
var hasParticipants = findParticipant(elements);
|
|
165
|
-
|
|
166
|
-
if (hasParticipants && is(parent, 'bpmn:Process')) {
|
|
167
|
-
ensureCollaboration(context);
|
|
168
|
-
|
|
169
|
-
participant = findParticipant(elements);
|
|
135
|
+
// #execute necessary because #preExecute not called on CommandStack#redo
|
|
136
|
+
this.execute('shape.create', function(context) {
|
|
137
|
+
var hints = context.hints || {},
|
|
138
|
+
process = context.process || hints.process,
|
|
139
|
+
shape = context.shape,
|
|
140
|
+
participant = hints.participant;
|
|
170
141
|
|
|
171
|
-
|
|
142
|
+
// both shape.create and elements.create must be handled
|
|
143
|
+
if (process && (!participant || shape === participant)) {
|
|
172
144
|
|
|
173
|
-
//
|
|
174
|
-
|
|
145
|
+
// monkey-patch process ref
|
|
146
|
+
getBusinessObject(shape).set('processRef', getBusinessObject(process));
|
|
175
147
|
}
|
|
176
148
|
}, true);
|
|
177
149
|
|
|
178
|
-
this.revert('
|
|
179
|
-
var
|
|
180
|
-
process = context.process,
|
|
181
|
-
|
|
150
|
+
this.revert('shape.create', function(context) {
|
|
151
|
+
var hints = context.hints || {},
|
|
152
|
+
process = context.process || hints.process,
|
|
153
|
+
processRef = context.processRef || hints.processRef,
|
|
154
|
+
shape = context.shape,
|
|
155
|
+
participant = hints.participant;
|
|
182
156
|
|
|
183
|
-
|
|
184
|
-
|
|
157
|
+
// both shape.create and elements.create must be handled
|
|
158
|
+
if (process && (!participant || shape === participant)) {
|
|
185
159
|
|
|
186
|
-
//
|
|
187
|
-
|
|
160
|
+
// monkey-patch process ref
|
|
161
|
+
getBusinessObject(shape).set('processRef', processRef);
|
|
188
162
|
}
|
|
189
163
|
}, true);
|
|
190
164
|
|
|
191
|
-
this.postExecute('
|
|
192
|
-
var
|
|
193
|
-
process = context.process,
|
|
194
|
-
|
|
165
|
+
this.postExecute('shape.create', function(context) {
|
|
166
|
+
var hints = context.hints || {},
|
|
167
|
+
process = context.process || context.hints.process,
|
|
168
|
+
shape = context.shape,
|
|
169
|
+
participant = hints.participant;
|
|
195
170
|
|
|
196
171
|
if (process) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
//
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
172
|
+
var children = process.children.slice();
|
|
173
|
+
|
|
174
|
+
// both shape.create and elements.create must be handled
|
|
175
|
+
if (!participant) {
|
|
176
|
+
modeling.moveElements(children, { x: 0, y: 0 }, shape);
|
|
177
|
+
} else if (shape === participant) {
|
|
178
|
+
modeling.moveElements(children, { x: 0, y: 0 }, participant);
|
|
179
|
+
}
|
|
203
180
|
}
|
|
204
|
-
|
|
205
181
|
}, true);
|
|
206
|
-
|
|
207
182
|
}
|
|
208
183
|
|
|
209
184
|
CreateParticipantBehavior.$inject = [
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import inherits from 'inherits';
|
|
2
|
+
|
|
3
|
+
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
4
|
+
|
|
5
|
+
import { getDi } from '../../../util/ModelUtil';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* BPMN specific behavior ensuring that bpmndi:Label's dc:Bounds are removed
|
|
9
|
+
* when shape is resized.
|
|
10
|
+
*/
|
|
11
|
+
export default function RemoveEmbeddedLabelBoundsBehavior(eventBus, modeling) {
|
|
12
|
+
CommandInterceptor.call(this, eventBus);
|
|
13
|
+
|
|
14
|
+
this.preExecute('shape.resize', function(context) {
|
|
15
|
+
var shape = context.shape;
|
|
16
|
+
|
|
17
|
+
var di = getDi(shape),
|
|
18
|
+
label = di && di.get('label'),
|
|
19
|
+
bounds = label && label.get('bounds');
|
|
20
|
+
|
|
21
|
+
if (bounds) {
|
|
22
|
+
modeling.updateModdleProperties(shape, label, {
|
|
23
|
+
bounds: undefined
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}, true);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
inherits(RemoveEmbeddedLabelBoundsBehavior, CommandInterceptor);
|
|
30
|
+
|
|
31
|
+
RemoveEmbeddedLabelBoundsBehavior.$inject = [
|
|
32
|
+
'eventBus',
|
|
33
|
+
'modeling'
|
|
34
|
+
];
|