camunda-bpmn-js 3.12.0 → 3.12.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.
@@ -37483,7 +37483,8 @@
37483
37483
  */
37484
37484
 
37485
37485
  /**
37486
- *
37486
+ * Behavior ensuring that only a single compensation activity is connected to a
37487
+ * compensation boundary event when connecting, reconnecting or replacing shapes.
37487
37488
  *
37488
37489
  * @param {import('diagram-js/lib/core/EventBus').default} eventBus
37489
37490
  * @param {import('../Modeling').default} modeling
@@ -37501,7 +37502,7 @@
37501
37502
  this.postExecuted('element.updateProperties', handlePropertiesUpdate, true);
37502
37503
 
37503
37504
  /**
37504
- * Given a connection from boundary event is removed, remove the forCompensation property.
37505
+ * Given a connection from boundary event is removed, remove the `isForCompensation` property.
37505
37506
  */
37506
37507
  function handleConnectionRemoval(context) {
37507
37508
  const source = context.source,
@@ -37513,15 +37514,16 @@
37513
37514
  }
37514
37515
 
37515
37516
  /**
37516
- * Add forCompensation property and make sure only a single compensation activity is connected.
37517
+ * Add `isForCompensation` property and make sure only a single compensation activity is connected.
37517
37518
  */
37518
37519
  function handleNewConnection(context) {
37519
- const source = context.source,
37520
+ const connection = context.connection,
37521
+ source = context.source,
37520
37522
  target = context.target;
37521
37523
 
37522
- if (isCompensationBoundaryEvent(source) && canBeForCompensation(target)) {
37524
+ if (isCompensationBoundaryEvent(source) && isForCompensationAllowed(target)) {
37523
37525
  addIsForCompensationProperty(target);
37524
- removeExistingAssociation(source);
37526
+ removeExistingAssociations(source, [ connection ]);
37525
37527
  }
37526
37528
  }
37527
37529
 
@@ -37540,7 +37542,7 @@
37540
37542
  }
37541
37543
 
37542
37544
  // newTarget perspective
37543
- if (isCompensationBoundaryEvent(source) && canBeForCompensation(newTarget)) {
37545
+ if (isCompensationBoundaryEvent(source) && isForCompensationAllowed(newTarget)) {
37544
37546
  addIsForCompensationProperty(newTarget);
37545
37547
  }
37546
37548
  }
@@ -37550,9 +37552,9 @@
37550
37552
  const { element } = context;
37551
37553
 
37552
37554
  if (isForCompensation$1(element)) {
37553
- removeIllegalConnections(element);
37555
+ removeDisallowedConnections(element);
37554
37556
  removeAttachments(element);
37555
- } else if (canBeForCompensation(element)) {
37557
+ } else if (isForCompensationAllowed(element)) {
37556
37558
  removeIncomingCompensationAssociations(element);
37557
37559
  }
37558
37560
  }
@@ -37586,7 +37588,7 @@
37586
37588
  targetElement.type === 'bpmn:BoundaryEvent'
37587
37589
  ) {
37588
37590
  const targetConnection = oldShape.outgoing.find(
37589
- ({ target }) => canBeForCompensation(target)
37591
+ ({ target }) => isForCompensationAllowed(target)
37590
37592
  );
37591
37593
 
37592
37594
  if (targetConnection && targetConnection.target) {
@@ -37613,7 +37615,7 @@
37613
37615
  modeling.updateProperties(target, { isForCompensation: undefined });
37614
37616
  }
37615
37617
 
37616
- function removeIllegalConnections(element) {
37618
+ function removeDisallowedConnections(element) {
37617
37619
 
37618
37620
  for (const connection of element.incoming) {
37619
37621
  if (!bpmnRules.canConnect(connection.source, element)) {
@@ -37628,9 +37630,11 @@
37628
37630
  }
37629
37631
  }
37630
37632
 
37631
- function removeExistingAssociation(boundaryEvent) {
37633
+ function removeExistingAssociations(boundaryEvent, ignoredAssociations) {
37632
37634
  const associations = boundaryEvent.outgoing.filter(connection => is$6(connection, 'bpmn:Association'));
37633
- const associationsToRemove = associations.filter(association => isForCompensation$1(association.target));
37635
+ const associationsToRemove = associations.filter(association => {
37636
+ return isForCompensation$1(association.target) && !ignoredAssociations.includes(association);
37637
+ });
37634
37638
 
37635
37639
  // remove existing associations
37636
37640
  associationsToRemove.forEach(association => modeling.removeConnection(association));
@@ -37683,7 +37687,7 @@
37683
37687
  hasEventDefinition$3(element, 'bpmn:CompensateEventDefinition');
37684
37688
  }
37685
37689
 
37686
- function canBeForCompensation(element) {
37690
+ function isForCompensationAllowed(element) {
37687
37691
  return element && is$6(element, 'bpmn:Activity') && !isEventSubProcess(element);
37688
37692
  }
37689
37693
 
@@ -149027,58 +149031,58 @@
149027
149031
  ]
149028
149032
  };
149029
149033
 
149030
- /**
149031
- * @typedef {import('bpmn-js/lib/BaseViewer').BaseViewerOptions} BaseViewerOptions
149032
- */
149033
-
149034
- /**
149035
- * @param {BaseViewerOptions} options
149036
- */
149037
- function Modeler(options = {}) {
149038
-
149039
- options = {
149040
- ...options,
149041
- moddleExtensions: {
149042
- ...commonModdleExtensions,
149043
- ...options.moddleExtensions
149044
- },
149045
- propertiesPanel: {
149046
- tooltip: TooltipProvider,
149047
- ...options.propertiesPanel
149048
- },
149049
- };
149050
-
149051
- this._addElementTemplateChooserModule(options);
149052
-
149053
- Modeler$1.call(this, options);
149054
- }
149055
-
149056
- e$8(Modeler, Modeler$1);
149057
-
149058
- Modeler.prototype._addElementTemplateChooserModule = function(options) {
149059
- const { elementTemplateChooser } = options;
149060
-
149061
- if (elementTemplateChooser !== false) {
149062
- this._modules = [ ...this._modules, index$2 ];
149063
- }
149064
- };
149065
-
149066
- Modeler.prototype._camundaCloudModules = [
149067
- ...commonModules,
149068
- behaviorsModule,
149069
- index$1$2,
149070
- index$1$1,
149071
- index$1,
149072
- index,
149073
- colorPickerModule,
149074
- ZeebeVariableResolverModule,
149075
- exampleDataPropertiesProviderModule,
149076
- index$3
149077
- ];
149078
-
149079
- Modeler.prototype._modules = [].concat(
149080
- Modeler$1.prototype._modules,
149081
- Modeler.prototype._camundaCloudModules
149034
+ /**
149035
+ * @typedef {import('bpmn-js/lib/BaseViewer').BaseViewerOptions} BaseViewerOptions
149036
+ */
149037
+
149038
+ /**
149039
+ * @param {BaseViewerOptions} options
149040
+ */
149041
+ function Modeler(options = {}) {
149042
+
149043
+ options = {
149044
+ ...options,
149045
+ moddleExtensions: {
149046
+ ...commonModdleExtensions,
149047
+ ...options.moddleExtensions
149048
+ },
149049
+ propertiesPanel: {
149050
+ tooltip: TooltipProvider,
149051
+ ...options.propertiesPanel
149052
+ },
149053
+ };
149054
+
149055
+ this._addElementTemplateChooserModule(options);
149056
+
149057
+ Modeler$1.call(this, options);
149058
+ }
149059
+
149060
+ e$8(Modeler, Modeler$1);
149061
+
149062
+ Modeler.prototype._addElementTemplateChooserModule = function(options) {
149063
+ const { elementTemplateChooser } = options;
149064
+
149065
+ if (elementTemplateChooser !== false) {
149066
+ this._modules = [ ...this._modules, index$2 ];
149067
+ }
149068
+ };
149069
+
149070
+ Modeler.prototype._camundaCloudModules = [
149071
+ ...commonModules,
149072
+ behaviorsModule,
149073
+ index$1$2,
149074
+ index$1$1,
149075
+ index$1,
149076
+ index,
149077
+ colorPickerModule,
149078
+ ZeebeVariableResolverModule,
149079
+ exampleDataPropertiesProviderModule,
149080
+ index$3
149081
+ ];
149082
+
149083
+ Modeler.prototype._modules = [].concat(
149084
+ Modeler$1.prototype._modules,
149085
+ Modeler.prototype._camundaCloudModules
149082
149086
  );
149083
149087
 
149084
149088
  return Modeler;