bpmn-js 8.8.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 +15 -1
- package/dist/assets/bpmn-js.css +58 -0
- package/dist/assets/diagram-js.css +1 -0
- package/dist/bpmn-modeler.development.js +1489 -827
- package/dist/bpmn-modeler.production.min.js +7 -6
- package/dist/bpmn-navigated-viewer.development.js +20890 -19973
- package/dist/bpmn-navigated-viewer.production.min.js +22 -20
- package/dist/bpmn-viewer.development.js +20091 -19174
- package/dist/bpmn-viewer.production.min.js +22 -20
- package/lib/BaseViewer.js +0 -13
- package/lib/Viewer.js +3 -1
- package/lib/draw/BpmnRenderUtil.js +6 -4
- package/lib/draw/BpmnRenderer.js +367 -296
- package/lib/features/context-pad/ContextPadProvider.js +1 -1
- package/lib/features/copy-paste/BpmnCopyPaste.js +13 -13
- package/lib/features/copy-paste/ModdleCopy.js +19 -2
- package/lib/features/di-ordering/BpmnDiOrdering.js +2 -3
- package/lib/features/label-editing/LabelEditingPreview.js +3 -3
- package/lib/features/label-editing/cmd/UpdateLabelHandler.js +2 -1
- package/lib/features/modeling/BpmnFactory.js +8 -8
- package/lib/features/modeling/BpmnUpdater.js +35 -27
- package/lib/features/modeling/ElementFactory.js +60 -37
- 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/ResizeBehavior.js +129 -3
- package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js +6 -6
- package/lib/features/modeling/behavior/util/ResizeUtil.js +1 -132
- package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +8 -6
- package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +19 -12
- package/lib/features/modeling/cmd/UpdateSemanticParentHandler.js +5 -3
- package/lib/features/palette/PaletteProvider.js +3 -1
- package/lib/features/popup-menu/ReplaceMenuProvider.js +5 -5
- package/lib/features/popup-menu/util/TypeUtil.js +1 -1
- package/lib/features/replace/BpmnReplace.js +29 -29
- 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 +76 -22
- package/lib/import/BpmnTreeWalker.js +19 -17
- package/lib/import/Importer.js +17 -6
- package/lib/util/CompatibilityUtil.js +21 -1
- package/lib/util/DiUtil.js +10 -3
- package/lib/util/LabelUtil.js +2 -3
- package/lib/util/ModelUtil.js +11 -0
- package/package.json +2 -2
- package/test/helper/index.js +6 -1
- package/test/matchers/BoundsMatchers.js +10 -10
- package/test/matchers/ConnectionMatchers.js +5 -5
- package/test/util/MockEvents.js +10 -2
|
@@ -197,7 +197,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
|
|
200
|
-
if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(
|
|
200
|
+
if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) {
|
|
201
201
|
|
|
202
202
|
var childLanes = getChildLanes(element);
|
|
203
203
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getBusinessObject,
|
|
3
|
+
getDi,
|
|
3
4
|
is
|
|
4
5
|
} from '../../util/ModelUtil';
|
|
5
6
|
|
|
@@ -45,23 +46,13 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
|
|
|
45
46
|
element = context.element;
|
|
46
47
|
|
|
47
48
|
var businessObject = descriptor.oldBusinessObject = getBusinessObject(element);
|
|
49
|
+
var di = descriptor.oldDi = getDi(element);
|
|
48
50
|
|
|
49
51
|
descriptor.type = element.type;
|
|
50
52
|
|
|
51
53
|
copyProperties(businessObject, descriptor, 'name');
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
// colors will be set to DI
|
|
56
|
-
copyProperties(businessObject.di, descriptor.di, [
|
|
57
|
-
'fill',
|
|
58
|
-
'stroke',
|
|
59
|
-
'background-color',
|
|
60
|
-
'border-color',
|
|
61
|
-
'color'
|
|
62
|
-
]);
|
|
63
|
-
|
|
64
|
-
copyProperties(businessObject.di, descriptor, 'isExpanded');
|
|
55
|
+
copyProperties(di, descriptor, 'isExpanded');
|
|
65
56
|
|
|
66
57
|
if (isLabel(descriptor)) {
|
|
67
58
|
return descriptor;
|
|
@@ -135,11 +126,13 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
|
|
|
135
126
|
var cache = context.cache,
|
|
136
127
|
descriptor = context.descriptor,
|
|
137
128
|
oldBusinessObject = descriptor.oldBusinessObject,
|
|
138
|
-
|
|
129
|
+
oldDi = descriptor.oldDi,
|
|
130
|
+
newBusinessObject, newDi;
|
|
139
131
|
|
|
140
132
|
// do NOT copy business object if external label
|
|
141
133
|
if (isLabel(descriptor)) {
|
|
142
134
|
descriptor.businessObject = getBusinessObject(cache[ descriptor.labelTarget ]);
|
|
135
|
+
descriptor.di = getDi(cache[ descriptor.labelTarget ]);
|
|
143
136
|
|
|
144
137
|
return;
|
|
145
138
|
}
|
|
@@ -151,6 +144,13 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
|
|
|
151
144
|
newBusinessObject
|
|
152
145
|
);
|
|
153
146
|
|
|
147
|
+
newDi = bpmnFactory.create(oldDi.$type);
|
|
148
|
+
|
|
149
|
+
descriptor.di = moddleCopy.copyElement(
|
|
150
|
+
oldDi,
|
|
151
|
+
newDi
|
|
152
|
+
);
|
|
153
|
+
|
|
154
154
|
// resolve references e.g. default sequence flow
|
|
155
155
|
resolveReferences(descriptor, cache);
|
|
156
156
|
|
|
@@ -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) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { getDi } from '../../
|
|
2
|
-
import { getBusinessObject } from '../../util/ModelUtil';
|
|
1
|
+
import { getDi } from '../../util/ModelUtil';
|
|
3
2
|
|
|
4
3
|
import {
|
|
5
4
|
filter,
|
|
@@ -17,7 +16,7 @@ export default function BpmnDiOrdering(eventBus, canvas) {
|
|
|
17
16
|
|
|
18
17
|
function orderDi() {
|
|
19
18
|
var root = canvas.getRootElement(),
|
|
20
|
-
rootDi =
|
|
19
|
+
rootDi = getDi(root),
|
|
21
20
|
elements,
|
|
22
21
|
diElements;
|
|
23
22
|
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from 'tiny-svg';
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
|
-
|
|
9
|
+
getDi,
|
|
10
10
|
is
|
|
11
11
|
} from '../../util/ModelUtil';
|
|
12
12
|
|
|
@@ -132,7 +132,7 @@ LabelEditingPreview.$inject = [
|
|
|
132
132
|
// helpers ///////////////////
|
|
133
133
|
|
|
134
134
|
function getStrokeColor(element, defaultColor) {
|
|
135
|
-
var
|
|
135
|
+
var di = getDi(element);
|
|
136
136
|
|
|
137
|
-
return
|
|
137
|
+
return di.get('stroke') || defaultColor || 'black';
|
|
138
138
|
}
|
|
@@ -67,7 +67,8 @@ export default function UpdateLabelHandler(modeling, textRenderer) {
|
|
|
67
67
|
|
|
68
68
|
modeling.createLabel(element, labelCenter, {
|
|
69
69
|
id: businessObject.id + '_label',
|
|
70
|
-
businessObject: businessObject
|
|
70
|
+
businessObject: businessObject,
|
|
71
|
+
di: element.di
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
}
|
|
@@ -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
|
};
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
18
|
getBusinessObject,
|
|
19
|
+
getDi,
|
|
19
20
|
is
|
|
20
21
|
} from '../../util/ModelUtil';
|
|
21
22
|
|
|
@@ -307,8 +308,9 @@ BpmnUpdater.prototype.updateParent = function(element, oldParent) {
|
|
|
307
308
|
var parentShape = element.parent;
|
|
308
309
|
|
|
309
310
|
var businessObject = element.businessObject,
|
|
311
|
+
di = getDi(element),
|
|
310
312
|
parentBusinessObject = parentShape && parentShape.businessObject,
|
|
311
|
-
parentDi =
|
|
313
|
+
parentDi = getDi(parentShape);
|
|
312
314
|
|
|
313
315
|
if (is(element, 'bpmn:FlowNode')) {
|
|
314
316
|
this.updateFlowNodeRefs(businessObject, parentBusinessObject, oldParent && oldParent.businessObject);
|
|
@@ -336,13 +338,13 @@ BpmnUpdater.prototype.updateParent = function(element, oldParent) {
|
|
|
336
338
|
this.updateSemanticParent(businessObject.dataObjectRef, parentBusinessObject);
|
|
337
339
|
}
|
|
338
340
|
|
|
339
|
-
this.updateDiParent(
|
|
341
|
+
this.updateDiParent(di, parentDi);
|
|
340
342
|
};
|
|
341
343
|
|
|
342
344
|
|
|
343
345
|
BpmnUpdater.prototype.updateBounds = function(shape) {
|
|
344
346
|
|
|
345
|
-
var di = shape
|
|
347
|
+
var di = getDi(shape);
|
|
346
348
|
|
|
347
349
|
var target = (shape instanceof Label) ? this._getLabel(di) : di;
|
|
348
350
|
|
|
@@ -382,14 +384,17 @@ BpmnUpdater.prototype.updateFlowNodeRefs = function(businessObject, newContainme
|
|
|
382
384
|
|
|
383
385
|
|
|
384
386
|
// update existing sourceElement and targetElement di information
|
|
385
|
-
BpmnUpdater.prototype.updateDiConnection = function(
|
|
387
|
+
BpmnUpdater.prototype.updateDiConnection = function(connection, newSource, newTarget) {
|
|
388
|
+
var connectionDi = getDi(connection),
|
|
389
|
+
newSourceDi = getDi(newSource),
|
|
390
|
+
newTargetDi = getDi(newTarget);
|
|
386
391
|
|
|
387
|
-
if (
|
|
388
|
-
|
|
392
|
+
if (connectionDi.sourceElement && connectionDi.sourceElement.bpmnElement !== getBusinessObject(newSource)) {
|
|
393
|
+
connectionDi.sourceElement = newSource && newSourceDi;
|
|
389
394
|
}
|
|
390
395
|
|
|
391
|
-
if (
|
|
392
|
-
|
|
396
|
+
if (connectionDi.targetElement && connectionDi.targetElement.bpmnElement !== getBusinessObject(newTarget)) {
|
|
397
|
+
connectionDi.targetElement = newTarget && newTargetDi;
|
|
393
398
|
}
|
|
394
399
|
|
|
395
400
|
};
|
|
@@ -614,69 +619,72 @@ BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent,
|
|
|
614
619
|
|
|
615
620
|
|
|
616
621
|
BpmnUpdater.prototype.updateConnectionWaypoints = function(connection) {
|
|
617
|
-
|
|
622
|
+
var di = getDi(connection);
|
|
623
|
+
|
|
624
|
+
di.set('waypoint', this._bpmnFactory.createDiWaypoints(connection.waypoints));
|
|
618
625
|
};
|
|
619
626
|
|
|
620
627
|
|
|
621
628
|
BpmnUpdater.prototype.updateConnection = function(context) {
|
|
622
|
-
|
|
623
629
|
var connection = context.connection,
|
|
624
630
|
businessObject = getBusinessObject(connection),
|
|
625
|
-
newSource =
|
|
626
|
-
|
|
631
|
+
newSource = connection.source,
|
|
632
|
+
newSourceBo = getBusinessObject(newSource),
|
|
633
|
+
newTarget = connection.target,
|
|
634
|
+
newTargetBo = getBusinessObject(connection.target),
|
|
627
635
|
visualParent;
|
|
628
636
|
|
|
629
637
|
if (!is(businessObject, 'bpmn:DataAssociation')) {
|
|
630
638
|
|
|
631
639
|
var inverseSet = is(businessObject, 'bpmn:SequenceFlow');
|
|
632
640
|
|
|
633
|
-
if (businessObject.sourceRef !==
|
|
641
|
+
if (businessObject.sourceRef !== newSourceBo) {
|
|
634
642
|
if (inverseSet) {
|
|
635
643
|
collectionRemove(businessObject.sourceRef && businessObject.sourceRef.get('outgoing'), businessObject);
|
|
636
644
|
|
|
637
|
-
if (
|
|
638
|
-
|
|
645
|
+
if (newSourceBo && newSourceBo.get('outgoing')) {
|
|
646
|
+
newSourceBo.get('outgoing').push(businessObject);
|
|
639
647
|
}
|
|
640
648
|
}
|
|
641
649
|
|
|
642
|
-
businessObject.sourceRef =
|
|
650
|
+
businessObject.sourceRef = newSourceBo;
|
|
643
651
|
}
|
|
644
652
|
|
|
645
|
-
if (businessObject.targetRef !==
|
|
653
|
+
if (businessObject.targetRef !== newTargetBo) {
|
|
646
654
|
if (inverseSet) {
|
|
647
655
|
collectionRemove(businessObject.targetRef && businessObject.targetRef.get('incoming'), businessObject);
|
|
648
656
|
|
|
649
|
-
if (
|
|
650
|
-
|
|
657
|
+
if (newTargetBo && newTargetBo.get('incoming')) {
|
|
658
|
+
newTargetBo.get('incoming').push(businessObject);
|
|
651
659
|
}
|
|
652
660
|
}
|
|
653
661
|
|
|
654
|
-
businessObject.targetRef =
|
|
662
|
+
businessObject.targetRef = newTargetBo;
|
|
655
663
|
}
|
|
656
664
|
} else
|
|
657
665
|
|
|
658
666
|
if (is(businessObject, 'bpmn:DataInputAssociation')) {
|
|
659
667
|
|
|
660
668
|
// handle obnoxious isMsome sourceRef
|
|
661
|
-
businessObject.get('sourceRef')[0] =
|
|
669
|
+
businessObject.get('sourceRef')[0] = newSourceBo;
|
|
662
670
|
|
|
663
|
-
visualParent = context.parent || context.newParent ||
|
|
671
|
+
visualParent = context.parent || context.newParent || newTargetBo;
|
|
664
672
|
|
|
665
|
-
this.updateSemanticParent(businessObject,
|
|
673
|
+
this.updateSemanticParent(businessObject, newTargetBo, visualParent);
|
|
666
674
|
} else
|
|
667
675
|
|
|
668
676
|
if (is(businessObject, 'bpmn:DataOutputAssociation')) {
|
|
669
|
-
visualParent = context.parent || context.newParent ||
|
|
677
|
+
visualParent = context.parent || context.newParent || newSourceBo;
|
|
670
678
|
|
|
671
|
-
this.updateSemanticParent(businessObject,
|
|
679
|
+
this.updateSemanticParent(businessObject, newSourceBo, visualParent);
|
|
672
680
|
|
|
673
681
|
// targetRef = new target
|
|
674
|
-
businessObject.targetRef =
|
|
682
|
+
businessObject.targetRef = newTargetBo;
|
|
675
683
|
}
|
|
676
684
|
|
|
677
685
|
this.updateConnectionWaypoints(connection);
|
|
678
686
|
|
|
679
|
-
this.updateDiConnection(
|
|
687
|
+
this.updateDiConnection(connection, newSource, newTarget);
|
|
680
688
|
};
|
|
681
689
|
|
|
682
690
|
|
|
@@ -6,7 +6,15 @@ import {
|
|
|
6
6
|
|
|
7
7
|
import inherits from 'inherits';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
getBusinessObject,
|
|
11
|
+
getDi,
|
|
12
|
+
is
|
|
13
|
+
} from '../../util/ModelUtil';
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
isAny
|
|
17
|
+
} from '../modeling/util/ModelingUtil';
|
|
10
18
|
|
|
11
19
|
import {
|
|
12
20
|
isExpanded
|
|
@@ -18,6 +26,10 @@ import {
|
|
|
18
26
|
DEFAULT_LABEL_SIZE
|
|
19
27
|
} from '../../util/LabelUtil';
|
|
20
28
|
|
|
29
|
+
import {
|
|
30
|
+
ensureCompatDiRef
|
|
31
|
+
} from '../../util/CompatibilityUtil';
|
|
32
|
+
|
|
21
33
|
|
|
22
34
|
/**
|
|
23
35
|
* A bpmn-aware factory for diagram-js shapes
|
|
@@ -46,7 +58,8 @@ ElementFactory.prototype.create = function(elementType, attrs) {
|
|
|
46
58
|
// we assume their businessObjects have already been created
|
|
47
59
|
// and wired via attrs
|
|
48
60
|
if (elementType === 'label') {
|
|
49
|
-
|
|
61
|
+
var di = attrs.di || this._bpmnFactory.createDiLabel();
|
|
62
|
+
return this.baseCreate(elementType, assign({ type: 'label', di: di }, DEFAULT_LABEL_SIZE, attrs));
|
|
50
63
|
}
|
|
51
64
|
|
|
52
65
|
return this.createBpmnElement(elementType, attrs);
|
|
@@ -58,7 +71,8 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
|
|
58
71
|
|
|
59
72
|
attrs = attrs || {};
|
|
60
73
|
|
|
61
|
-
var businessObject = attrs.businessObject
|
|
74
|
+
var businessObject = attrs.businessObject,
|
|
75
|
+
di = attrs.di;
|
|
62
76
|
|
|
63
77
|
if (!businessObject) {
|
|
64
78
|
if (!attrs.type) {
|
|
@@ -66,22 +80,23 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
|
|
66
80
|
}
|
|
67
81
|
|
|
68
82
|
businessObject = this._bpmnFactory.create(attrs.type);
|
|
83
|
+
|
|
84
|
+
ensureCompatDiRef(businessObject);
|
|
69
85
|
}
|
|
70
86
|
|
|
71
|
-
if (!
|
|
87
|
+
if (!isModdleDi(di)) {
|
|
88
|
+
var diAttrs = assign(
|
|
89
|
+
di || {},
|
|
90
|
+
{ id: businessObject.id + '_di' }
|
|
91
|
+
);
|
|
92
|
+
|
|
72
93
|
if (elementType === 'root') {
|
|
73
|
-
|
|
74
|
-
id: businessObject.id + '_di'
|
|
75
|
-
});
|
|
94
|
+
di = this._bpmnFactory.createDiPlane(businessObject, diAttrs);
|
|
76
95
|
} else
|
|
77
96
|
if (elementType === 'connection') {
|
|
78
|
-
|
|
79
|
-
id: businessObject.id + '_di'
|
|
80
|
-
});
|
|
97
|
+
di = this._bpmnFactory.createDiEdge(businessObject, diAttrs);
|
|
81
98
|
} else {
|
|
82
|
-
|
|
83
|
-
id: businessObject.id + '_di'
|
|
84
|
-
});
|
|
99
|
+
di = this._bpmnFactory.createDiShape(businessObject, diAttrs);
|
|
85
100
|
}
|
|
86
101
|
}
|
|
87
102
|
|
|
@@ -91,12 +106,6 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
|
|
91
106
|
}, attrs);
|
|
92
107
|
}
|
|
93
108
|
|
|
94
|
-
if (attrs.di) {
|
|
95
|
-
assign(businessObject.di, attrs.di);
|
|
96
|
-
|
|
97
|
-
delete attrs.di;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
109
|
applyAttributes(businessObject, attrs, [
|
|
101
110
|
'processRef',
|
|
102
111
|
'isInterrupting',
|
|
@@ -105,11 +114,11 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
|
|
105
114
|
]);
|
|
106
115
|
|
|
107
116
|
if (attrs.isExpanded) {
|
|
108
|
-
applyAttribute(
|
|
117
|
+
applyAttribute(di, attrs, 'isExpanded');
|
|
109
118
|
}
|
|
110
119
|
|
|
111
120
|
if (is(businessObject, 'bpmn:ExclusiveGateway')) {
|
|
112
|
-
|
|
121
|
+
di.isMarkerVisible = true;
|
|
113
122
|
}
|
|
114
123
|
|
|
115
124
|
var eventDefinitions,
|
|
@@ -131,65 +140,69 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
|
|
131
140
|
delete attrs.eventDefinitionType;
|
|
132
141
|
}
|
|
133
142
|
|
|
134
|
-
size = this.
|
|
143
|
+
size = this.getDefaultSize(businessObject, di);
|
|
135
144
|
|
|
136
145
|
attrs = assign({
|
|
137
|
-
businessObject: businessObject,
|
|
138
146
|
id: businessObject.id
|
|
139
|
-
}, size, attrs
|
|
147
|
+
}, size, attrs, {
|
|
148
|
+
businessObject: businessObject,
|
|
149
|
+
di: di
|
|
150
|
+
});
|
|
140
151
|
|
|
141
152
|
return this.baseCreate(elementType, attrs);
|
|
142
153
|
};
|
|
143
154
|
|
|
144
155
|
|
|
145
|
-
ElementFactory.prototype.
|
|
156
|
+
ElementFactory.prototype.getDefaultSize = function(element, di) {
|
|
146
157
|
|
|
147
|
-
|
|
158
|
+
var bo = getBusinessObject(element);
|
|
159
|
+
di = di || getDi(element);
|
|
148
160
|
|
|
149
|
-
|
|
161
|
+
if (is(bo, 'bpmn:SubProcess')) {
|
|
162
|
+
if (isExpanded(bo, di)) {
|
|
150
163
|
return { width: 350, height: 200 };
|
|
151
164
|
} else {
|
|
152
165
|
return { width: 100, height: 80 };
|
|
153
166
|
}
|
|
154
167
|
}
|
|
155
168
|
|
|
156
|
-
if (is(
|
|
169
|
+
if (is(bo, 'bpmn:Task')) {
|
|
157
170
|
return { width: 100, height: 80 };
|
|
158
171
|
}
|
|
159
172
|
|
|
160
|
-
if (is(
|
|
173
|
+
if (is(bo, 'bpmn:Gateway')) {
|
|
161
174
|
return { width: 50, height: 50 };
|
|
162
175
|
}
|
|
163
176
|
|
|
164
|
-
if (is(
|
|
177
|
+
if (is(bo, 'bpmn:Event')) {
|
|
165
178
|
return { width: 36, height: 36 };
|
|
166
179
|
}
|
|
167
180
|
|
|
168
|
-
if (is(
|
|
169
|
-
if (isExpanded(
|
|
181
|
+
if (is(bo, 'bpmn:Participant')) {
|
|
182
|
+
if (isExpanded(bo, di)) {
|
|
170
183
|
return { width: 600, height: 250 };
|
|
171
184
|
} else {
|
|
172
185
|
return { width: 400, height: 60 };
|
|
173
186
|
}
|
|
174
187
|
}
|
|
175
188
|
|
|
176
|
-
if (is(
|
|
189
|
+
if (is(bo, 'bpmn:Lane')) {
|
|
177
190
|
return { width: 400, height: 100 };
|
|
178
191
|
}
|
|
179
192
|
|
|
180
|
-
if (is(
|
|
193
|
+
if (is(bo, 'bpmn:DataObjectReference')) {
|
|
181
194
|
return { width: 36, height: 50 };
|
|
182
195
|
}
|
|
183
196
|
|
|
184
|
-
if (is(
|
|
197
|
+
if (is(bo, 'bpmn:DataStoreReference')) {
|
|
185
198
|
return { width: 50, height: 50 };
|
|
186
199
|
}
|
|
187
200
|
|
|
188
|
-
if (is(
|
|
201
|
+
if (is(bo, 'bpmn:TextAnnotation')) {
|
|
189
202
|
return { width: 100, height: 30 };
|
|
190
203
|
}
|
|
191
204
|
|
|
192
|
-
if (is(
|
|
205
|
+
if (is(bo, 'bpmn:Group')) {
|
|
193
206
|
return { width: 300, height: 300 };
|
|
194
207
|
}
|
|
195
208
|
|
|
@@ -252,4 +265,14 @@ function applyAttribute(element, attrs, attributeName) {
|
|
|
252
265
|
element[attributeName] = attrs[attributeName];
|
|
253
266
|
|
|
254
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
|
+
]);
|
|
255
278
|
}
|
|
@@ -4,6 +4,7 @@ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
getBusinessObject,
|
|
7
|
+
getDi,
|
|
7
8
|
is
|
|
8
9
|
} from '../../../util/ModelUtil';
|
|
9
10
|
|
|
@@ -45,8 +46,9 @@ export default function DataStoreBehavior(
|
|
|
45
46
|
|
|
46
47
|
commandStack.execute('dataStore.updateContainment', {
|
|
47
48
|
dataStoreBo: dataStoreBo,
|
|
49
|
+
dataStoreDi: getDi(dataStore),
|
|
48
50
|
newSemanticParent: newDataStoreParentBo.processRef || newDataStoreParentBo,
|
|
49
|
-
newDiParent:
|
|
51
|
+
newDiParent: getDi(newDataStoreParent)
|
|
50
52
|
});
|
|
51
53
|
}
|
|
52
54
|
}
|
|
@@ -3,7 +3,8 @@ import inherits from 'inherits';
|
|
|
3
3
|
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
getBusinessObject
|
|
6
|
+
getBusinessObject,
|
|
7
|
+
getDi
|
|
7
8
|
} from '../../../util/ModelUtil';
|
|
8
9
|
|
|
9
10
|
import {
|
|
@@ -26,12 +27,14 @@ export default function IsHorizontalFix(eventBus) {
|
|
|
26
27
|
];
|
|
27
28
|
|
|
28
29
|
this.executed([ 'shape.move', 'shape.create', 'shape.resize' ], function(event) {
|
|
29
|
-
var
|
|
30
|
+
var shape = event.context.shape,
|
|
31
|
+
bo = getBusinessObject(shape),
|
|
32
|
+
di = getDi(shape);
|
|
30
33
|
|
|
31
|
-
if (isAny(bo, elementTypesToUpdate) && !
|
|
34
|
+
if (isAny(bo, elementTypesToUpdate) && !di.get('isHorizontal')) {
|
|
32
35
|
|
|
33
36
|
// set attribute directly to avoid modeling#updateProperty side effects
|
|
34
|
-
|
|
37
|
+
di.set('isHorizontal', true);
|
|
35
38
|
}
|
|
36
39
|
});
|
|
37
40
|
|
|
@@ -6,7 +6,8 @@ import inherits from 'inherits';
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
is,
|
|
9
|
-
getBusinessObject
|
|
9
|
+
getBusinessObject,
|
|
10
|
+
getDi
|
|
10
11
|
} from '../../../util/ModelUtil';
|
|
11
12
|
|
|
12
13
|
import {
|
|
@@ -153,27 +154,27 @@ export default function LabelBehavior(
|
|
|
153
154
|
|
|
154
155
|
var context = event.context,
|
|
155
156
|
element = context.shape,
|
|
156
|
-
|
|
157
|
+
labelTarget = context.labelTarget,
|
|
157
158
|
di;
|
|
158
159
|
|
|
159
160
|
// we want to trigger on real labels only
|
|
160
|
-
if (!
|
|
161
|
+
if (!labelTarget) {
|
|
161
162
|
return;
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
// we want to trigger on BPMN elements only
|
|
165
|
-
if (!is(
|
|
166
|
+
if (!is(labelTarget, 'bpmn:BaseElement')) {
|
|
166
167
|
return;
|
|
167
168
|
}
|
|
168
169
|
|
|
169
|
-
|
|
170
|
-
di = businessObject.di;
|
|
171
|
-
|
|
170
|
+
di = getDi(labelTarget);
|
|
172
171
|
|
|
173
172
|
if (!di.label) {
|
|
174
173
|
di.label = bpmnFactory.create('bpmndi:BPMNLabel', {
|
|
175
174
|
bounds: bpmnFactory.create('dc:Bounds')
|
|
176
175
|
});
|
|
176
|
+
|
|
177
|
+
element.di = di;
|
|
177
178
|
}
|
|
178
179
|
|
|
179
180
|
assign(di.label.bounds, {
|