bpmn-js 16.3.0 → 16.3.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v16.3.0
2
+ * bpmn-js - bpmn-modeler v16.3.1
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2023-12-22
11
+ * Date: 2024-01-05
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -37320,7 +37320,8 @@
37320
37320
  */
37321
37321
 
37322
37322
  /**
37323
- *
37323
+ * Behavior ensuring that only a single compensation activity is connected to a
37324
+ * compensation boundary event when connecting, reconnecting or replacing shapes.
37324
37325
  *
37325
37326
  * @param {import('diagram-js/lib/core/EventBus').default} eventBus
37326
37327
  * @param {import('../Modeling').default} modeling
@@ -37338,7 +37339,7 @@
37338
37339
  this.postExecuted('element.updateProperties', handlePropertiesUpdate, true);
37339
37340
 
37340
37341
  /**
37341
- * Given a connection from boundary event is removed, remove the forCompensation property.
37342
+ * Given a connection from boundary event is removed, remove the `isForCompensation` property.
37342
37343
  */
37343
37344
  function handleConnectionRemoval(context) {
37344
37345
  const source = context.source,
@@ -37350,15 +37351,16 @@
37350
37351
  }
37351
37352
 
37352
37353
  /**
37353
- * Add forCompensation property and make sure only a single compensation activity is connected.
37354
+ * Add `isForCompensation` property and make sure only a single compensation activity is connected.
37354
37355
  */
37355
37356
  function handleNewConnection(context) {
37356
- const source = context.source,
37357
+ const connection = context.connection,
37358
+ source = context.source,
37357
37359
  target = context.target;
37358
37360
 
37359
- if (isCompensationBoundaryEvent(source) && canBeForCompensation(target)) {
37361
+ if (isCompensationBoundaryEvent(source) && isForCompensationAllowed(target)) {
37360
37362
  addIsForCompensationProperty(target);
37361
- removeExistingAssociation(source);
37363
+ removeExistingAssociations(source, [ connection ]);
37362
37364
  }
37363
37365
  }
37364
37366
 
@@ -37377,7 +37379,7 @@
37377
37379
  }
37378
37380
 
37379
37381
  // newTarget perspective
37380
- if (isCompensationBoundaryEvent(source) && canBeForCompensation(newTarget)) {
37382
+ if (isCompensationBoundaryEvent(source) && isForCompensationAllowed(newTarget)) {
37381
37383
  addIsForCompensationProperty(newTarget);
37382
37384
  }
37383
37385
  }
@@ -37387,9 +37389,9 @@
37387
37389
  const { element } = context;
37388
37390
 
37389
37391
  if (isForCompensation$1(element)) {
37390
- removeIllegalConnections(element);
37392
+ removeDisallowedConnections(element);
37391
37393
  removeAttachments(element);
37392
- } else if (canBeForCompensation(element)) {
37394
+ } else if (isForCompensationAllowed(element)) {
37393
37395
  removeIncomingCompensationAssociations(element);
37394
37396
  }
37395
37397
  }
@@ -37423,7 +37425,7 @@
37423
37425
  targetElement.type === 'bpmn:BoundaryEvent'
37424
37426
  ) {
37425
37427
  const targetConnection = oldShape.outgoing.find(
37426
- ({ target }) => canBeForCompensation(target)
37428
+ ({ target }) => isForCompensationAllowed(target)
37427
37429
  );
37428
37430
 
37429
37431
  if (targetConnection && targetConnection.target) {
@@ -37450,7 +37452,7 @@
37450
37452
  modeling.updateProperties(target, { isForCompensation: undefined });
37451
37453
  }
37452
37454
 
37453
- function removeIllegalConnections(element) {
37455
+ function removeDisallowedConnections(element) {
37454
37456
 
37455
37457
  for (const connection of element.incoming) {
37456
37458
  if (!bpmnRules.canConnect(connection.source, element)) {
@@ -37465,9 +37467,11 @@
37465
37467
  }
37466
37468
  }
37467
37469
 
37468
- function removeExistingAssociation(boundaryEvent) {
37470
+ function removeExistingAssociations(boundaryEvent, ignoredAssociations) {
37469
37471
  const associations = boundaryEvent.outgoing.filter(connection => is$1(connection, 'bpmn:Association'));
37470
- const associationsToRemove = associations.filter(association => isForCompensation$1(association.target));
37472
+ const associationsToRemove = associations.filter(association => {
37473
+ return isForCompensation$1(association.target) && !ignoredAssociations.includes(association);
37474
+ });
37471
37475
 
37472
37476
  // remove existing associations
37473
37477
  associationsToRemove.forEach(association => modeling.removeConnection(association));
@@ -37520,7 +37524,7 @@
37520
37524
  hasEventDefinition$2(element, 'bpmn:CompensateEventDefinition');
37521
37525
  }
37522
37526
 
37523
- function canBeForCompensation(element) {
37527
+ function isForCompensationAllowed(element) {
37524
37528
  return element && is$1(element, 'bpmn:Activity') && !isEventSubProcess(element);
37525
37529
  }
37526
37530