bpmn-js 9.0.0-subprocesses.0 → 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 +73 -1
- package/dist/assets/bpmn-js.css +113 -0
- package/dist/assets/diagram-js.css +82 -78
- package/dist/bpmn-modeler.development.js +3402 -2196
- package/dist/bpmn-modeler.production.min.js +9 -8
- package/dist/bpmn-navigated-viewer.development.js +21207 -20345
- package/dist/bpmn-navigated-viewer.production.min.js +22 -20
- package/dist/bpmn-viewer.development.js +20401 -19562
- package/dist/bpmn-viewer.production.min.js +22 -20
- package/lib/BaseViewer.js +1 -1
- package/lib/Modeler.js +1 -4
- package/lib/Viewer.js +2 -2
- package/lib/draw/BpmnRenderer.js +8 -7
- package/lib/draw/PathMap.js +2 -2
- package/lib/features/auto-resize/BpmnAutoResizeProvider.js +9 -6
- package/lib/features/copy-paste/BpmnCopyPaste.js +1 -0
- package/lib/features/copy-paste/ModdleCopy.js +19 -2
- package/lib/features/di-ordering/BpmnDiOrdering.js +15 -11
- package/lib/features/drilldown/DrilldownBreadcrumbs.js +122 -0
- package/lib/features/drilldown/DrilldownCentering.js +118 -0
- package/lib/features/drilldown/DrilldownOverlayBehavior.js +181 -0
- package/lib/features/drilldown/SubprocessCompatibility.js +196 -0
- package/lib/features/drilldown/index.js +17 -0
- 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 +12 -8
- package/lib/features/modeling/BpmnUpdater.js +43 -6
- package/lib/features/modeling/ElementFactory.js +31 -13
- 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/ResizeBehavior.js +129 -3
- 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/behavior/util/ResizeUtil.js +1 -132
- 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/features/replace/BpmnReplace.js +38 -16
- package/lib/import/BpmnImporter.js +19 -13
- package/lib/import/BpmnTreeWalker.js +2 -2
- package/lib/import/Importer.js +134 -14
- package/lib/util/DiUtil.js +1 -0
- package/lib/util/DrilldownUtil.js +66 -0
- package/lib/util/ModelUtil.js +19 -0
- package/package.json +2 -2
- 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
|
@@ -3,9 +3,7 @@ import AppendBehavior from './AppendBehavior';
|
|
|
3
3
|
import AssociationBehavior from './AssociationBehavior';
|
|
4
4
|
import AttachEventBehavior from './AttachEventBehavior';
|
|
5
5
|
import BoundaryEventBehavior from './BoundaryEventBehavior';
|
|
6
|
-
import RootElementReferenceBehavior from './RootElementReferenceBehavior';
|
|
7
6
|
import CreateBehavior from './CreateBehavior';
|
|
8
|
-
import FixHoverBehavior from './FixHoverBehavior';
|
|
9
7
|
import CreateDataObjectBehavior from './CreateDataObjectBehavior';
|
|
10
8
|
import CreateParticipantBehavior from './CreateParticipantBehavior';
|
|
11
9
|
import DataInputAssociationBehavior from './DataInputAssociationBehavior';
|
|
@@ -14,24 +12,29 @@ import DeleteLaneBehavior from './DeleteLaneBehavior';
|
|
|
14
12
|
import DetachEventBehavior from './DetachEventBehavior';
|
|
15
13
|
import DropOnFlowBehavior from './DropOnFlowBehavior';
|
|
16
14
|
import EventBasedGatewayBehavior from './EventBasedGatewayBehavior';
|
|
15
|
+
import FixHoverBehavior from './FixHoverBehavior';
|
|
17
16
|
import GroupBehavior from './GroupBehavior';
|
|
18
17
|
import ImportDockingFix from './ImportDockingFix';
|
|
19
18
|
import IsHorizontalFix from './IsHorizontalFix';
|
|
20
19
|
import LabelBehavior from './LabelBehavior';
|
|
21
20
|
import MessageFlowBehavior from './MessageFlowBehavior';
|
|
22
21
|
import ModelingFeedback from './ModelingFeedback';
|
|
23
|
-
import
|
|
22
|
+
import RemoveEmbeddedLabelBoundsBehavior from './RemoveEmbeddedLabelBoundsBehavior';
|
|
23
|
+
import RemoveElementBehavior from './RemoveElementBehavior';
|
|
24
24
|
import RemoveParticipantBehavior from './RemoveParticipantBehavior';
|
|
25
|
+
import ReplaceConnectionBehavior from './ReplaceConnectionBehavior';
|
|
25
26
|
import ReplaceElementBehaviour from './ReplaceElementBehaviour';
|
|
26
27
|
import ResizeBehavior from './ResizeBehavior';
|
|
27
28
|
import ResizeLaneBehavior from './ResizeLaneBehavior';
|
|
28
|
-
import
|
|
29
|
+
import RootElementReferenceBehavior from './RootElementReferenceBehavior';
|
|
29
30
|
import SpaceToolBehavior from './SpaceToolBehavior';
|
|
31
|
+
import SubProcessPlaneBehavior from './SubProcessPlaneBehavior';
|
|
30
32
|
import SubProcessStartEventBehavior from './SubProcessStartEventBehavior';
|
|
33
|
+
import ToggleCollapseConnectionBehaviour from './ToggleCollapseConnectionBehaviour';
|
|
31
34
|
import ToggleElementCollapseBehaviour from './ToggleElementCollapseBehaviour';
|
|
32
35
|
import UnclaimIdBehavior from './UnclaimIdBehavior';
|
|
33
|
-
import UpdateFlowNodeRefsBehavior from './UpdateFlowNodeRefsBehavior';
|
|
34
36
|
import UnsetDefaultFlowBehavior from './UnsetDefaultFlowBehavior';
|
|
37
|
+
import UpdateFlowNodeRefsBehavior from './UpdateFlowNodeRefsBehavior';
|
|
35
38
|
|
|
36
39
|
export default {
|
|
37
40
|
__init__: [
|
|
@@ -40,17 +43,16 @@ export default {
|
|
|
40
43
|
'associationBehavior',
|
|
41
44
|
'attachEventBehavior',
|
|
42
45
|
'boundaryEventBehavior',
|
|
43
|
-
'rootElementReferenceBehavior',
|
|
44
46
|
'createBehavior',
|
|
45
|
-
'fixHoverBehavior',
|
|
46
47
|
'createDataObjectBehavior',
|
|
47
48
|
'createParticipantBehavior',
|
|
48
|
-
'dataStoreBehavior',
|
|
49
49
|
'dataInputAssociationBehavior',
|
|
50
|
+
'dataStoreBehavior',
|
|
50
51
|
'deleteLaneBehavior',
|
|
51
52
|
'detachEventBehavior',
|
|
52
53
|
'dropOnFlowBehavior',
|
|
53
54
|
'eventBasedGatewayBehavior',
|
|
55
|
+
'fixHoverBehavior',
|
|
54
56
|
'groupBehavior',
|
|
55
57
|
'importDockingFix',
|
|
56
58
|
'isHorizontalFix',
|
|
@@ -58,26 +60,28 @@ export default {
|
|
|
58
60
|
'messageFlowBehavior',
|
|
59
61
|
'modelingFeedback',
|
|
60
62
|
'removeElementBehavior',
|
|
63
|
+
'removeEmbeddedLabelBoundsBehavior',
|
|
61
64
|
'removeParticipantBehavior',
|
|
62
65
|
'replaceConnectionBehavior',
|
|
63
66
|
'replaceElementBehaviour',
|
|
64
67
|
'resizeBehavior',
|
|
65
68
|
'resizeLaneBehavior',
|
|
66
|
-
'
|
|
69
|
+
'rootElementReferenceBehavior',
|
|
67
70
|
'spaceToolBehavior',
|
|
71
|
+
'subProcessPlaneBehavior',
|
|
68
72
|
'subProcessStartEventBehavior',
|
|
73
|
+
'toggleCollapseConnectionBehaviour',
|
|
74
|
+
'toggleElementCollapseBehaviour',
|
|
69
75
|
'unclaimIdBehavior',
|
|
70
|
-
'
|
|
71
|
-
'
|
|
76
|
+
'updateFlowNodeRefsBehavior',
|
|
77
|
+
'unsetDefaultFlowBehavior'
|
|
72
78
|
],
|
|
73
79
|
adaptiveLabelPositioningBehavior: [ 'type', AdaptiveLabelPositioningBehavior ],
|
|
74
80
|
appendBehavior: [ 'type', AppendBehavior ],
|
|
75
81
|
associationBehavior: [ 'type', AssociationBehavior ],
|
|
76
82
|
attachEventBehavior: [ 'type', AttachEventBehavior ],
|
|
77
83
|
boundaryEventBehavior: [ 'type', BoundaryEventBehavior ],
|
|
78
|
-
rootElementReferenceBehavior: [ 'type', RootElementReferenceBehavior ],
|
|
79
84
|
createBehavior: [ 'type', CreateBehavior ],
|
|
80
|
-
fixHoverBehavior: [ 'type', FixHoverBehavior ],
|
|
81
85
|
createDataObjectBehavior: [ 'type', CreateDataObjectBehavior ],
|
|
82
86
|
createParticipantBehavior: [ 'type', CreateParticipantBehavior ],
|
|
83
87
|
dataInputAssociationBehavior: [ 'type', DataInputAssociationBehavior ],
|
|
@@ -86,22 +90,27 @@ export default {
|
|
|
86
90
|
detachEventBehavior: [ 'type', DetachEventBehavior ],
|
|
87
91
|
dropOnFlowBehavior: [ 'type', DropOnFlowBehavior ],
|
|
88
92
|
eventBasedGatewayBehavior: [ 'type', EventBasedGatewayBehavior ],
|
|
93
|
+
fixHoverBehavior: [ 'type', FixHoverBehavior ],
|
|
89
94
|
groupBehavior: [ 'type', GroupBehavior ],
|
|
90
95
|
importDockingFix: [ 'type', ImportDockingFix ],
|
|
91
96
|
isHorizontalFix: [ 'type', IsHorizontalFix ],
|
|
92
97
|
labelBehavior: [ 'type', LabelBehavior ],
|
|
93
98
|
messageFlowBehavior: [ 'type', MessageFlowBehavior ],
|
|
94
99
|
modelingFeedback: [ 'type', ModelingFeedback ],
|
|
95
|
-
|
|
100
|
+
removeElementBehavior: [ 'type', RemoveElementBehavior ],
|
|
101
|
+
removeEmbeddedLabelBoundsBehavior: ['type', RemoveEmbeddedLabelBoundsBehavior ],
|
|
96
102
|
removeParticipantBehavior: [ 'type', RemoveParticipantBehavior ],
|
|
103
|
+
replaceConnectionBehavior: [ 'type', ReplaceConnectionBehavior ],
|
|
97
104
|
replaceElementBehaviour: [ 'type', ReplaceElementBehaviour ],
|
|
98
105
|
resizeBehavior: [ 'type', ResizeBehavior ],
|
|
99
106
|
resizeLaneBehavior: [ 'type', ResizeLaneBehavior ],
|
|
100
|
-
|
|
101
|
-
toggleElementCollapseBehaviour : [ 'type', ToggleElementCollapseBehaviour ],
|
|
107
|
+
rootElementReferenceBehavior: [ 'type', RootElementReferenceBehavior ],
|
|
102
108
|
spaceToolBehavior: [ 'type', SpaceToolBehavior ],
|
|
109
|
+
subProcessPlaneBehavior: [ 'type', SubProcessPlaneBehavior ],
|
|
103
110
|
subProcessStartEventBehavior: [ 'type', SubProcessStartEventBehavior ],
|
|
111
|
+
toggleCollapseConnectionBehaviour: [ 'type', ToggleCollapseConnectionBehaviour ],
|
|
112
|
+
toggleElementCollapseBehaviour : [ 'type', ToggleElementCollapseBehaviour ],
|
|
104
113
|
unclaimIdBehavior: [ 'type', UnclaimIdBehavior ],
|
|
105
|
-
|
|
106
|
-
|
|
114
|
+
unsetDefaultFlowBehavior: [ 'type', UnsetDefaultFlowBehavior ],
|
|
115
|
+
updateFlowNodeRefsBehavior: [ 'type', UpdateFlowNodeRefsBehavior ]
|
|
107
116
|
};
|
|
@@ -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';
|
|
@@ -5,6 +5,9 @@ import {
|
|
|
5
5
|
pick
|
|
6
6
|
} from 'min-dash';
|
|
7
7
|
|
|
8
|
+
import {
|
|
9
|
+
getDi
|
|
10
|
+
} from '../../../util/ModelUtil';
|
|
8
11
|
|
|
9
12
|
var DEFAULT_COLORS = {
|
|
10
13
|
fill: undefined,
|
|
@@ -63,12 +66,26 @@ SetColorHandler.prototype.postExecute = function(context) {
|
|
|
63
66
|
// TODO @barmac: remove once we drop bpmn.io properties
|
|
64
67
|
ensureLegacySupport(assignedDi);
|
|
65
68
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
if (element.labelTarget) {
|
|
70
|
+
|
|
71
|
+
// set label colors as bpmndi:BPMNLabel#color
|
|
72
|
+
self._commandStack.execute('element.updateModdleProperties', {
|
|
73
|
+
element: element,
|
|
74
|
+
moddleElement: getDi(element).label,
|
|
75
|
+
properties: {
|
|
76
|
+
color: di['background-color']
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
|
|
81
|
+
// set colors bpmndi:BPMNEdge or bpmndi:BPMNShape
|
|
82
|
+
self._commandStack.execute('element.updateProperties', {
|
|
83
|
+
element: element,
|
|
84
|
+
properties: {
|
|
85
|
+
di: assignedDi
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
72
89
|
});
|
|
73
90
|
|
|
74
91
|
};
|
|
@@ -29,7 +29,8 @@ UpdateCanvasRootHandler.prototype.execute = function(context) {
|
|
|
29
29
|
diPlane = getDi(oldRoot);
|
|
30
30
|
|
|
31
31
|
// (1) replace process old <> new root
|
|
32
|
-
canvas.setRootElement(newRoot
|
|
32
|
+
canvas.setRootElement(newRoot);
|
|
33
|
+
canvas.removeRootElement(oldRoot);
|
|
33
34
|
|
|
34
35
|
// (2) update root elements
|
|
35
36
|
collectionAdd(bpmnDefinitions.rootElements, newRootBusinessObject);
|
|
@@ -63,7 +64,8 @@ UpdateCanvasRootHandler.prototype.revert = function(context) {
|
|
|
63
64
|
diPlane = getDi(newRoot);
|
|
64
65
|
|
|
65
66
|
// (1) replace process old <> new root
|
|
66
|
-
canvas.setRootElement(oldRoot
|
|
67
|
+
canvas.setRootElement(oldRoot);
|
|
68
|
+
canvas.removeRootElement(newRoot);
|
|
67
69
|
|
|
68
70
|
// (2) update root elements
|
|
69
71
|
collectionRemove(bpmnDefinitions.rootElements, newRootBusinessObject);
|
|
@@ -1,24 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
some
|
|
3
|
-
} from 'min-dash';
|
|
4
|
-
|
|
5
|
-
import { is } from '../../../util/ModelUtil';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Return true if element has any of the given types.
|
|
10
|
-
*
|
|
11
|
-
* @param {djs.model.Base} element
|
|
12
|
-
* @param {Array<string>} types
|
|
13
|
-
*
|
|
14
|
-
* @return {boolean}
|
|
15
|
-
*/
|
|
16
|
-
export function isAny(element, types) {
|
|
17
|
-
return some(types, function(t) {
|
|
18
|
-
return is(element, t);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
1
|
+
export { is, isAny } from '../../../util/ModelUtil';
|
|
21
2
|
|
|
3
|
+
import { isAny } from '../../../util/ModelUtil';
|
|
22
4
|
|
|
23
5
|
/**
|
|
24
6
|
* Return the parent of the element with any of the given types.
|
|
@@ -42,7 +42,7 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) {
|
|
|
42
42
|
level: 9,
|
|
43
43
|
containers: [
|
|
44
44
|
'bpmn:Collaboration',
|
|
45
|
-
'bpmn:
|
|
45
|
+
'bpmn:FlowElementsContainer'
|
|
46
46
|
]
|
|
47
47
|
}
|
|
48
48
|
},
|
|
@@ -70,7 +70,7 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) {
|
|
|
70
70
|
level: 10,
|
|
71
71
|
containers: [
|
|
72
72
|
'bpmn:Collaboration',
|
|
73
|
-
'bpmn:
|
|
73
|
+
'bpmn:FlowElementsContainer'
|
|
74
74
|
]
|
|
75
75
|
}
|
|
76
76
|
},
|
|
@@ -131,7 +131,7 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) {
|
|
|
131
131
|
// render labels always on top
|
|
132
132
|
if (element.labelTarget) {
|
|
133
133
|
return {
|
|
134
|
-
parent: canvas.getRootElement(),
|
|
134
|
+
parent: canvas.findRoot(element.labelTarget) || canvas.getRootElement(),
|
|
135
135
|
index: -1
|
|
136
136
|
};
|
|
137
137
|
}
|
|
@@ -83,7 +83,7 @@ ReplaceMenuProvider.prototype.getEntries = function(element) {
|
|
|
83
83
|
return this._createEntries(element, replaceOptions.DATA_OBJECT_REFERENCE);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
if (is(businessObject, 'bpmn:DataStoreReference')) {
|
|
86
|
+
if (is(businessObject, 'bpmn:DataStoreReference') && !is(element.parent, 'bpmn:Collaboration')) {
|
|
87
87
|
return this._createEntries(element, replaceOptions.DATA_STORE_REFERENCE);
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -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);
|
|
@@ -26,6 +26,13 @@ import {
|
|
|
26
26
|
} from './Util';
|
|
27
27
|
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @param {ModdleElement} semantic
|
|
31
|
+
* @param {ModdleElement} di
|
|
32
|
+
* @param {Object} [attrs=null]
|
|
33
|
+
*
|
|
34
|
+
* @return {Object}
|
|
35
|
+
*/
|
|
29
36
|
function elementData(semantic, di, attrs) {
|
|
30
37
|
return assign({
|
|
31
38
|
id: semantic.id,
|
|
@@ -93,28 +100,26 @@ BpmnImporter.$inject = [
|
|
|
93
100
|
* Add bpmn element (semantic) to the canvas onto the
|
|
94
101
|
* specified parent shape.
|
|
95
102
|
*/
|
|
96
|
-
BpmnImporter.prototype.add = function(
|
|
103
|
+
BpmnImporter.prototype.add = function(semantic, di, parentElement) {
|
|
97
104
|
var element,
|
|
98
105
|
translate = this._translate,
|
|
99
|
-
hidden
|
|
100
|
-
semantic = context.element,
|
|
101
|
-
di = context.di;
|
|
106
|
+
hidden;
|
|
102
107
|
|
|
103
108
|
var parentIndex;
|
|
104
109
|
|
|
105
110
|
// ROOT ELEMENT
|
|
106
111
|
// handle the special case that we deal with a
|
|
107
|
-
// invisible root element (process or collaboration)
|
|
112
|
+
// invisible root element (process, subprocess or collaboration)
|
|
108
113
|
if (is(di, 'bpmndi:BPMNPlane')) {
|
|
109
114
|
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
var attrs = is(semantic, 'bpmn:SubProcess')
|
|
116
|
+
? { id: semantic.id + '_plane' }
|
|
117
|
+
: {};
|
|
112
118
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
119
|
+
// add a virtual element (not being drawn)
|
|
120
|
+
element = this._elementFactory.createRoot(elementData(semantic, di, attrs));
|
|
116
121
|
|
|
117
|
-
this._canvas.
|
|
122
|
+
this._canvas.addRootElement(element);
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
// SHAPE
|
|
@@ -122,6 +127,7 @@ BpmnImporter.prototype.add = function(context, parentElement) {
|
|
|
122
127
|
|
|
123
128
|
var collapsed = !isExpanded(semantic, di),
|
|
124
129
|
isFrame = isFrameElement(semantic);
|
|
130
|
+
|
|
125
131
|
hidden = parentElement && (parentElement.hidden || parentElement.collapsed);
|
|
126
132
|
|
|
127
133
|
var bounds = di.bounds;
|
|
@@ -149,7 +155,7 @@ BpmnImporter.prototype.add = function(context, parentElement) {
|
|
|
149
155
|
|
|
150
156
|
// check whether data store is inside our outside of its semantic parent
|
|
151
157
|
if (!isPointInsideBBox(parentElement, getMid(bounds))) {
|
|
152
|
-
parentElement = this._canvas.
|
|
158
|
+
parentElement = this._canvas.findRoot(parentElement);
|
|
153
159
|
}
|
|
154
160
|
}
|
|
155
161
|
|
|
@@ -177,7 +183,7 @@ BpmnImporter.prototype.add = function(context, parentElement) {
|
|
|
177
183
|
// are rendered correctly across different "hacks" people
|
|
178
184
|
// love to model such as cross participant / sub process
|
|
179
185
|
// associations
|
|
180
|
-
parentElement = this._canvas.
|
|
186
|
+
parentElement = this._canvas.findRoot(parentElement);
|
|
181
187
|
}
|
|
182
188
|
|
|
183
189
|
// insert sequence flows behind other flow nodes (cf. #727)
|
|
@@ -76,11 +76,11 @@ export default function BpmnTreeWalker(handler, translate) {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
// call handler
|
|
79
|
-
return handler.element(
|
|
79
|
+
return handler.element(element, diMap[element.id], ctx);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
function visitRoot(element, diagram) {
|
|
83
|
-
return handler.root(
|
|
83
|
+
return handler.root(element, diMap[element.id], diagram);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
function visitIfDi(element, ctx) {
|