feat(rules): add lane rules
This commit is contained in:
parent
fefc748a9a
commit
0831cae843
|
@ -5,7 +5,7 @@ var find = require('lodash/collection/find'),
|
|||
forEach = require('lodash/collection/forEach'),
|
||||
inherits = require('inherits');
|
||||
|
||||
var getParents = require('../modeling/ModelingUtil').getParents,
|
||||
var getParents = require('../modeling/util/ModelingUtil').getParents,
|
||||
is = require('../../util/ModelUtil').is,
|
||||
getBusinessObject = require('../../util/ModelUtil').getBusinessObject,
|
||||
isExpanded = require('../../util/DiUtil').isExpanded,
|
||||
|
@ -332,6 +332,7 @@ function canDrop(element, target, position) {
|
|||
|
||||
if (is(element, 'bpmn:Artifact')) {
|
||||
return is(target, 'bpmn:Collaboration') ||
|
||||
is(target, 'bpmn:Lane') ||
|
||||
is(target, 'bpmn:Participant') ||
|
||||
is(target, 'bpmn:Process');
|
||||
}
|
||||
|
@ -347,6 +348,10 @@ function isBoundaryEvent(element) {
|
|||
return !isLabel(element) && is(element, 'bpmn:BoundaryEvent');
|
||||
}
|
||||
|
||||
function isLane(element) {
|
||||
return is(element, 'bpmn:Lane');
|
||||
}
|
||||
|
||||
/**
|
||||
* We treat IntermediateThrowEvents as boundary events during create,
|
||||
* this must be reflected in the rules.
|
||||
|
@ -486,6 +491,11 @@ function canMove(elements, target) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// do not move selection containing lanes
|
||||
if (any(elements, isLane)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// allow default move check to start move operation
|
||||
if (!target) {
|
||||
return true;
|
||||
|
|
|
@ -961,7 +961,7 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
});
|
||||
|
||||
|
||||
describe('should move', function() {
|
||||
describe('should not allow move', function() {
|
||||
|
||||
it('Lane -> Participant', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
||||
|
||||
|
@ -973,11 +973,11 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
var canMove = bpmnRules.canMove([ laneElement ], participantElement);
|
||||
|
||||
// then
|
||||
expect(canMove).to.be.true;
|
||||
expect(canMove).to.be.false;
|
||||
}));
|
||||
|
||||
|
||||
it('[not] Lane -> SubProcess', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
||||
it('Lane -> SubProcess', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
||||
|
||||
// given
|
||||
var subProcessElement = elementRegistry.get('SubProcess'),
|
||||
|
|
Loading…
Reference in New Issue