Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support modeling of collapsed subprocesses #1553

Merged
merged 13 commits into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/features/auto-resize/BpmnAutoResizeProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ BpmnAutoResizeProvider.$inject = [
*/
BpmnAutoResizeProvider.prototype.canResize = function(elements, target) {

// do not resize plane elements:
// root elements, collapsed sub-processes
if (is(target.di, 'bpmndi:BPMNPlane')) {
return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do have test to verify this, correct? I.e. creating or moving elements on a root element?

}

if (!is(target, 'bpmn:Participant') && !is(target, 'bpmn:Lane') && !(is(target, 'bpmn:SubProcess'))) {
return false;
}
Expand Down
26 changes: 15 additions & 11 deletions lib/features/di-ordering/BpmnDiOrdering.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { getDi } from '../../util/ModelUtil';

import {
filter,
forEach,
map
} from 'min-dash';

Expand All @@ -15,21 +16,24 @@ export default function BpmnDiOrdering(eventBus, canvas) {
eventBus.on('saveXML.start', HIGH_PRIORITY, orderDi);

function orderDi() {
var root = canvas.getRootElement(),
rootDi = getDi(root),
elements,
diElements;
var rootElements = canvas.getRootElements();

elements = selfAndAllChildren([ root ], false);
forEach(rootElements, function(root) {
var rootDi = getDi(root),
elements,
diElements;

// only bpmndi:Shape and bpmndi:Edge can be direct children of bpmndi:Plane
elements = filter(elements, function(element) {
return element !== root && !element.labelTarget;
});
elements = selfAndAllChildren([ root ], false);

// only bpmndi:Shape and bpmndi:Edge can be direct children of bpmndi:Plane
elements = filter(elements, function(element) {
return element !== root && !element.labelTarget;
});

diElements = map(elements, getDi);
diElements = map(elements, getDi);

rootDi.set('planeElement', diElements);
rootDi.set('planeElement', diElements);
});
}
}

Expand Down
15 changes: 9 additions & 6 deletions lib/features/drilldown/SubprocessCompatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ SubprocessCompatibility.prototype.createNewDiagrams = function(plane) {

var newDiagrams = [];

// create new planes for all collapsed subprocesses, even when they are empty
collapsedElements.forEach(function(element) {
if (!self._processToDiagramMap[element.id]) {
var diagram = self.createDiagram(element);
self._processToDiagramMap[element.id] = diagram;
newDiagrams.push(diagram);
}
});

elementsToMove.forEach(function(element) {
var diElement = element.diElement;
var parent = element.parent;
Expand All @@ -98,12 +107,6 @@ SubprocessCompatibility.prototype.createNewDiagrams = function(plane) {
}

var diagram = self._processToDiagramMap[parent.id];
if (!diagram) {
diagram = self.createDiagram(parent);
self._processToDiagramMap[parent.id] = diagram;
newDiagrams.push(diagram);
}

self.moveToDiPlane(diElement, diagram.plane);
});

Expand Down
Loading