Comparing version 16.3.0 to 16.3.1
@@ -0,1 +1,6 @@ | ||
/** | ||
* Behavior ensuring that only a single compensation activity is connected to a | ||
* compensation boundary event when connecting, reconnecting or replacing shapes. | ||
* | ||
*/ | ||
export default class CompensateBoundaryEventBehavior extends CommandInterceptor { | ||
@@ -2,0 +7,0 @@ /** |
@@ -14,4 +14,5 @@ import inherits from 'inherits-browser'; | ||
/** | ||
* Behavior ensuring that only a single compensation activity is connected to a | ||
* compensation boundary event when connecting, reconnecting or replacing shapes. | ||
* | ||
* | ||
* @param {import('diagram-js/lib/core/EventBus').default} eventBus | ||
@@ -33,3 +34,3 @@ * @param {import('../Modeling').default} modeling | ||
/** | ||
* Given a connection from boundary event is removed, remove the forCompensation property. | ||
* Given a connection from boundary event is removed, remove the `isForCompensation` property. | ||
*/ | ||
@@ -46,11 +47,12 @@ function handleConnectionRemoval(context) { | ||
/** | ||
* Add forCompensation property and make sure only a single compensation activity is connected. | ||
* Add `isForCompensation` property and make sure only a single compensation activity is connected. | ||
*/ | ||
function handleNewConnection(context) { | ||
const source = context.source, | ||
const connection = context.connection, | ||
source = context.source, | ||
target = context.target; | ||
if (isCompensationBoundaryEvent(source) && canBeForCompensation(target)) { | ||
if (isCompensationBoundaryEvent(source) && isForCompensationAllowed(target)) { | ||
addIsForCompensationProperty(target); | ||
removeExistingAssociation(source); | ||
removeExistingAssociations(source, [ connection ]); | ||
} | ||
@@ -74,3 +76,3 @@ } | ||
// newTarget perspective | ||
if (isCompensationBoundaryEvent(source) && canBeForCompensation(newTarget)) { | ||
if (isCompensationBoundaryEvent(source) && isForCompensationAllowed(newTarget)) { | ||
addIsForCompensationProperty(newTarget); | ||
@@ -85,5 +87,5 @@ } | ||
if (isForCompensation(element)) { | ||
removeIllegalConnections(element); | ||
removeDisallowedConnections(element); | ||
removeAttachments(element); | ||
} else if (canBeForCompensation(element)) { | ||
} else if (isForCompensationAllowed(element)) { | ||
removeIncomingCompensationAssociations(element); | ||
@@ -122,3 +124,3 @@ } | ||
const targetConnection = oldShape.outgoing.find( | ||
({ target }) => canBeForCompensation(target) | ||
({ target }) => isForCompensationAllowed(target) | ||
); | ||
@@ -150,3 +152,3 @@ | ||
function removeIllegalConnections(element) { | ||
function removeDisallowedConnections(element) { | ||
@@ -166,5 +168,7 @@ for (const connection of element.incoming) { | ||
function removeExistingAssociation(boundaryEvent) { | ||
function removeExistingAssociations(boundaryEvent, ignoredAssociations) { | ||
const associations = boundaryEvent.outgoing.filter(connection => is(connection, 'bpmn:Association')); | ||
const associationsToRemove = associations.filter(association => isForCompensation(association.target)); | ||
const associationsToRemove = associations.filter(association => { | ||
return isForCompensation(association.target) && !ignoredAssociations.includes(association); | ||
}); | ||
@@ -222,4 +226,4 @@ // remove existing associations | ||
function canBeForCompensation(element) { | ||
function isForCompensationAllowed(element) { | ||
return element && is(element, 'bpmn:Activity') && !isEventSubProcess(element); | ||
} |
{ | ||
"name": "bpmn-js", | ||
"version": "16.3.0", | ||
"version": "16.3.1", | ||
"description": "A bpmn 2.0 toolkit and web modeler", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4986537
126641