bpmn-js 16.2.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.
- package/dist/bpmn-modeler.development.js +253 -18
- package/dist/bpmn-modeler.production.min.js +2 -2
- package/dist/bpmn-navigated-viewer.development.js +2 -2
- package/dist/bpmn-navigated-viewer.production.min.js +1 -1
- package/dist/bpmn-viewer.development.js +2 -2
- package/dist/bpmn-viewer.production.min.js +1 -1
- package/lib/features/modeling/behavior/CompensateBoundaryEventBehavior.d.ts +17 -0
- package/lib/features/modeling/behavior/CompensateBoundaryEventBehavior.js +220 -0
- package/lib/features/modeling/behavior/ReplaceConnectionBehavior.js +5 -7
- package/lib/features/modeling/behavior/index.js +3 -0
- package/lib/features/replace/BpmnReplace.js +4 -0
- package/lib/features/rules/BpmnRules.d.ts +10 -1
- package/lib/features/rules/BpmnRules.js +26 -9
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* bpmn-js - bpmn-modeler v16.
|
|
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:
|
|
11
|
+
* Date: 2024-01-05
|
|
12
12
|
*/
|
|
13
13
|
(function (global, factory) {
|
|
14
14
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -37314,6 +37314,220 @@
|
|
|
37314
37314
|
|
|
37315
37315
|
e$2(BoundaryEventBehavior, CommandInterceptor);
|
|
37316
37316
|
|
|
37317
|
+
/**
|
|
37318
|
+
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
37319
|
+
* @typedef {import('../lib/features/modeling/Modeling').default} Modeling
|
|
37320
|
+
*/
|
|
37321
|
+
|
|
37322
|
+
/**
|
|
37323
|
+
* Behavior ensuring that only a single compensation activity is connected to a
|
|
37324
|
+
* compensation boundary event when connecting, reconnecting or replacing shapes.
|
|
37325
|
+
*
|
|
37326
|
+
* @param {import('diagram-js/lib/core/EventBus').default} eventBus
|
|
37327
|
+
* @param {import('../Modeling').default} modeling
|
|
37328
|
+
* @param {import('../../rules/BpmnRules').default} bpmnRules
|
|
37329
|
+
*/
|
|
37330
|
+
function CompensateBoundaryEventBehavior(eventBus, modeling, bpmnRules) {
|
|
37331
|
+
|
|
37332
|
+
CommandInterceptor.call(this, eventBus);
|
|
37333
|
+
|
|
37334
|
+
this.preExecute('shape.replace', handleReplacement, true);
|
|
37335
|
+
this.postExecuted('shape.replace', handleReplacementPostExecuted, true);
|
|
37336
|
+
this.preExecute('connection.create', handleNewConnection, true);
|
|
37337
|
+
this.postExecuted('connection.delete', handleConnectionRemoval, true);
|
|
37338
|
+
this.postExecuted('connection.reconnect', handleReconnection, true);
|
|
37339
|
+
this.postExecuted('element.updateProperties', handlePropertiesUpdate, true);
|
|
37340
|
+
|
|
37341
|
+
/**
|
|
37342
|
+
* Given a connection from boundary event is removed, remove the `isForCompensation` property.
|
|
37343
|
+
*/
|
|
37344
|
+
function handleConnectionRemoval(context) {
|
|
37345
|
+
const source = context.source,
|
|
37346
|
+
target = context.target;
|
|
37347
|
+
|
|
37348
|
+
if (isCompensationBoundaryEvent(source) && isForCompensation$1(target)) {
|
|
37349
|
+
removeIsForCompensationProperty(target);
|
|
37350
|
+
}
|
|
37351
|
+
}
|
|
37352
|
+
|
|
37353
|
+
/**
|
|
37354
|
+
* Add `isForCompensation` property and make sure only a single compensation activity is connected.
|
|
37355
|
+
*/
|
|
37356
|
+
function handleNewConnection(context) {
|
|
37357
|
+
const connection = context.connection,
|
|
37358
|
+
source = context.source,
|
|
37359
|
+
target = context.target;
|
|
37360
|
+
|
|
37361
|
+
if (isCompensationBoundaryEvent(source) && isForCompensationAllowed(target)) {
|
|
37362
|
+
addIsForCompensationProperty(target);
|
|
37363
|
+
removeExistingAssociations(source, [ connection ]);
|
|
37364
|
+
}
|
|
37365
|
+
}
|
|
37366
|
+
|
|
37367
|
+
function handleReconnection(context) {
|
|
37368
|
+
const newTarget = context.newTarget,
|
|
37369
|
+
oldSource = context.oldSource,
|
|
37370
|
+
oldTarget = context.oldTarget;
|
|
37371
|
+
|
|
37372
|
+
// target changes
|
|
37373
|
+
if (oldTarget !== newTarget) {
|
|
37374
|
+
const source = oldSource;
|
|
37375
|
+
|
|
37376
|
+
// oldTarget perspective
|
|
37377
|
+
if (isForCompensation$1(oldTarget)) {
|
|
37378
|
+
removeIsForCompensationProperty(oldTarget);
|
|
37379
|
+
}
|
|
37380
|
+
|
|
37381
|
+
// newTarget perspective
|
|
37382
|
+
if (isCompensationBoundaryEvent(source) && isForCompensationAllowed(newTarget)) {
|
|
37383
|
+
addIsForCompensationProperty(newTarget);
|
|
37384
|
+
}
|
|
37385
|
+
}
|
|
37386
|
+
}
|
|
37387
|
+
|
|
37388
|
+
function handlePropertiesUpdate(context) {
|
|
37389
|
+
const { element } = context;
|
|
37390
|
+
|
|
37391
|
+
if (isForCompensation$1(element)) {
|
|
37392
|
+
removeDisallowedConnections(element);
|
|
37393
|
+
removeAttachments(element);
|
|
37394
|
+
} else if (isForCompensationAllowed(element)) {
|
|
37395
|
+
removeIncomingCompensationAssociations(element);
|
|
37396
|
+
}
|
|
37397
|
+
}
|
|
37398
|
+
|
|
37399
|
+
/**
|
|
37400
|
+
* When replacing a boundary event, make sure the compensation activity is connected,
|
|
37401
|
+
* and remove the potential candidates for connection replacement to have a single compensation activity.
|
|
37402
|
+
*/
|
|
37403
|
+
function handleReplacement(context) {
|
|
37404
|
+
const { targetElement } = context.hints || {},
|
|
37405
|
+
{ oldShape } = context;
|
|
37406
|
+
|
|
37407
|
+
// from compensate boundary event
|
|
37408
|
+
if (isCompensationBoundaryEvent(context.oldShape) &&
|
|
37409
|
+
targetElement.eventDefinitionType !== 'bpmn:CompensateEventDefinition' ||
|
|
37410
|
+
targetElement.type !== 'bpmn:BoundaryEvent'
|
|
37411
|
+
) {
|
|
37412
|
+
const targetConnection = oldShape.outgoing.find(
|
|
37413
|
+
({ target }) => isForCompensation$1(target)
|
|
37414
|
+
);
|
|
37415
|
+
|
|
37416
|
+
if (targetConnection && targetConnection.target) {
|
|
37417
|
+
context._connectionTarget = targetConnection.target;
|
|
37418
|
+
}
|
|
37419
|
+
}
|
|
37420
|
+
|
|
37421
|
+
// to compensate boundary event
|
|
37422
|
+
else if (
|
|
37423
|
+
!isCompensationBoundaryEvent(context.oldShape) &&
|
|
37424
|
+
targetElement.eventDefinitionType === 'bpmn:CompensateEventDefinition' &&
|
|
37425
|
+
targetElement.type === 'bpmn:BoundaryEvent'
|
|
37426
|
+
) {
|
|
37427
|
+
const targetConnection = oldShape.outgoing.find(
|
|
37428
|
+
({ target }) => isForCompensationAllowed(target)
|
|
37429
|
+
);
|
|
37430
|
+
|
|
37431
|
+
if (targetConnection && targetConnection.target) {
|
|
37432
|
+
context._connectionTarget = targetConnection.target;
|
|
37433
|
+
}
|
|
37434
|
+
|
|
37435
|
+
removeOutgoingSequenceFlows(oldShape);
|
|
37436
|
+
}
|
|
37437
|
+
}
|
|
37438
|
+
|
|
37439
|
+
function handleReplacementPostExecuted(context) {
|
|
37440
|
+
const { _connectionTarget: target, newShape } = context;
|
|
37441
|
+
|
|
37442
|
+
if (target) {
|
|
37443
|
+
modeling.connect(newShape, target);
|
|
37444
|
+
}
|
|
37445
|
+
}
|
|
37446
|
+
|
|
37447
|
+
function addIsForCompensationProperty(target) {
|
|
37448
|
+
modeling.updateProperties(target, { isForCompensation: true });
|
|
37449
|
+
}
|
|
37450
|
+
|
|
37451
|
+
function removeIsForCompensationProperty(target) {
|
|
37452
|
+
modeling.updateProperties(target, { isForCompensation: undefined });
|
|
37453
|
+
}
|
|
37454
|
+
|
|
37455
|
+
function removeDisallowedConnections(element) {
|
|
37456
|
+
|
|
37457
|
+
for (const connection of element.incoming) {
|
|
37458
|
+
if (!bpmnRules.canConnect(connection.source, element)) {
|
|
37459
|
+
modeling.removeConnection(connection);
|
|
37460
|
+
}
|
|
37461
|
+
}
|
|
37462
|
+
|
|
37463
|
+
for (const connection of element.outgoing) {
|
|
37464
|
+
if (!bpmnRules.canConnect(element, connection.target)) {
|
|
37465
|
+
modeling.removeConnection(connection);
|
|
37466
|
+
}
|
|
37467
|
+
}
|
|
37468
|
+
}
|
|
37469
|
+
|
|
37470
|
+
function removeExistingAssociations(boundaryEvent, ignoredAssociations) {
|
|
37471
|
+
const associations = boundaryEvent.outgoing.filter(connection => is$1(connection, 'bpmn:Association'));
|
|
37472
|
+
const associationsToRemove = associations.filter(association => {
|
|
37473
|
+
return isForCompensation$1(association.target) && !ignoredAssociations.includes(association);
|
|
37474
|
+
});
|
|
37475
|
+
|
|
37476
|
+
// remove existing associations
|
|
37477
|
+
associationsToRemove.forEach(association => modeling.removeConnection(association));
|
|
37478
|
+
}
|
|
37479
|
+
|
|
37480
|
+
function removeAttachments(element) {
|
|
37481
|
+
const attachments = element.attachers.slice();
|
|
37482
|
+
|
|
37483
|
+
if (!attachments.length) {
|
|
37484
|
+
return;
|
|
37485
|
+
}
|
|
37486
|
+
|
|
37487
|
+
modeling.removeElements(attachments);
|
|
37488
|
+
}
|
|
37489
|
+
|
|
37490
|
+
function removeIncomingCompensationAssociations(element) {
|
|
37491
|
+
const compensationAssociations = element.incoming.filter(
|
|
37492
|
+
connection => isCompensationBoundaryEvent(connection.source)
|
|
37493
|
+
);
|
|
37494
|
+
|
|
37495
|
+
modeling.removeElements(compensationAssociations);
|
|
37496
|
+
}
|
|
37497
|
+
|
|
37498
|
+
function removeOutgoingSequenceFlows(element) {
|
|
37499
|
+
const sequenceFlows = element.outgoing.filter(
|
|
37500
|
+
connection => is$1(connection, 'bpmn:SequenceFlow')
|
|
37501
|
+
);
|
|
37502
|
+
|
|
37503
|
+
modeling.removeElements(sequenceFlows);
|
|
37504
|
+
}
|
|
37505
|
+
}
|
|
37506
|
+
|
|
37507
|
+
e$2(CompensateBoundaryEventBehavior, CommandInterceptor);
|
|
37508
|
+
|
|
37509
|
+
CompensateBoundaryEventBehavior.$inject = [
|
|
37510
|
+
'eventBus',
|
|
37511
|
+
'modeling',
|
|
37512
|
+
'bpmnRules'
|
|
37513
|
+
];
|
|
37514
|
+
|
|
37515
|
+
// helpers //////////
|
|
37516
|
+
|
|
37517
|
+
function isForCompensation$1(element) {
|
|
37518
|
+
const bo = getBusinessObject(element);
|
|
37519
|
+
return bo && bo.get('isForCompensation');
|
|
37520
|
+
}
|
|
37521
|
+
|
|
37522
|
+
function isCompensationBoundaryEvent(element) {
|
|
37523
|
+
return element && is$1(element, 'bpmn:BoundaryEvent') &&
|
|
37524
|
+
hasEventDefinition$2(element, 'bpmn:CompensateEventDefinition');
|
|
37525
|
+
}
|
|
37526
|
+
|
|
37527
|
+
function isForCompensationAllowed(element) {
|
|
37528
|
+
return element && is$1(element, 'bpmn:Activity') && !isEventSubProcess(element);
|
|
37529
|
+
}
|
|
37530
|
+
|
|
37317
37531
|
/**
|
|
37318
37532
|
* @typedef {import('didi').Injector} Injector
|
|
37319
37533
|
*/
|
|
@@ -41180,11 +41394,6 @@
|
|
|
41180
41394
|
}
|
|
41181
41395
|
}
|
|
41182
41396
|
|
|
41183
|
-
if (is$1(connection, 'bpmn:Association') && !bpmnRules.canConnectAssociation(source, target)) {
|
|
41184
|
-
remove = true;
|
|
41185
|
-
}
|
|
41186
|
-
|
|
41187
|
-
|
|
41188
41397
|
// remove invalid connection,
|
|
41189
41398
|
// unless it has been removed already
|
|
41190
41399
|
if (remove) {
|
|
@@ -41218,11 +41427,14 @@
|
|
|
41218
41427
|
|
|
41219
41428
|
replacement = modeling.connect(source, target, {
|
|
41220
41429
|
type: allowed.type,
|
|
41430
|
+
associationDirection: allowed.associationDirection,
|
|
41221
41431
|
waypoints: connection.waypoints.slice()
|
|
41222
41432
|
});
|
|
41223
41433
|
|
|
41224
|
-
// remove old connection
|
|
41225
|
-
|
|
41434
|
+
// remove old connection unless it's already removed
|
|
41435
|
+
if (connection.parent) {
|
|
41436
|
+
modeling.removeConnection(connection);
|
|
41437
|
+
}
|
|
41226
41438
|
|
|
41227
41439
|
// replace connection in context to reconnect end/start
|
|
41228
41440
|
context.connection = replacement;
|
|
@@ -43114,6 +43326,7 @@
|
|
|
43114
43326
|
'associationBehavior',
|
|
43115
43327
|
'attachEventBehavior',
|
|
43116
43328
|
'boundaryEventBehavior',
|
|
43329
|
+
'compensateBoundaryEventBehaviour',
|
|
43117
43330
|
'createBehavior',
|
|
43118
43331
|
'createDataObjectBehavior',
|
|
43119
43332
|
'createParticipantBehavior',
|
|
@@ -43153,6 +43366,7 @@
|
|
|
43153
43366
|
associationBehavior: [ 'type', AssociationBehavior ],
|
|
43154
43367
|
attachEventBehavior: [ 'type', AttachEventBehavior ],
|
|
43155
43368
|
boundaryEventBehavior: [ 'type', BoundaryEventBehavior ],
|
|
43369
|
+
compensateBoundaryEventBehaviour: [ 'type', CompensateBoundaryEventBehavior ],
|
|
43156
43370
|
createBehavior: [ 'type', CreateBehavior ],
|
|
43157
43371
|
createDataObjectBehavior: [ 'type', CreateDataObjectBehavior ],
|
|
43158
43372
|
createParticipantBehavior: [ 'type', CreateParticipantBehavior ],
|
|
@@ -43223,7 +43437,7 @@
|
|
|
43223
43437
|
* @typedef {import('diagram-js/lib/util/Types').Rect} Rect
|
|
43224
43438
|
*
|
|
43225
43439
|
* @typedef { {
|
|
43226
|
-
* associationDirection?:
|
|
43440
|
+
* associationDirection?: 'None' | 'One' | 'Both';
|
|
43227
43441
|
* type: string;
|
|
43228
43442
|
* } | boolean | null } CanConnectResult
|
|
43229
43443
|
*
|
|
@@ -43377,6 +43591,8 @@
|
|
|
43377
43591
|
|
|
43378
43592
|
BpmnRules.prototype.canConnectAssociation = canConnectAssociation;
|
|
43379
43593
|
|
|
43594
|
+
BpmnRules.prototype.canConnectCompensationAssociation = canConnectCompensationAssociation;
|
|
43595
|
+
|
|
43380
43596
|
BpmnRules.prototype.canMove = canMove;
|
|
43381
43597
|
|
|
43382
43598
|
BpmnRules.prototype.canAttach = canAttach;
|
|
@@ -43723,7 +43939,7 @@
|
|
|
43723
43939
|
return connectDataAssociation;
|
|
43724
43940
|
}
|
|
43725
43941
|
|
|
43726
|
-
if (
|
|
43942
|
+
if (canConnectCompensationAssociation(source, target)) {
|
|
43727
43943
|
return {
|
|
43728
43944
|
type: 'bpmn:Association',
|
|
43729
43945
|
associationDirection: 'One'
|
|
@@ -43731,9 +43947,9 @@
|
|
|
43731
43947
|
}
|
|
43732
43948
|
|
|
43733
43949
|
if (canConnectAssociation(source, target)) {
|
|
43734
|
-
|
|
43735
43950
|
return {
|
|
43736
|
-
type: 'bpmn:Association'
|
|
43951
|
+
type: 'bpmn:Association',
|
|
43952
|
+
associationDirection: 'None'
|
|
43737
43953
|
};
|
|
43738
43954
|
}
|
|
43739
43955
|
|
|
@@ -44200,11 +44416,6 @@
|
|
|
44200
44416
|
*/
|
|
44201
44417
|
function canConnectAssociation(source, target) {
|
|
44202
44418
|
|
|
44203
|
-
// compensation boundary events are exception
|
|
44204
|
-
if (isCompensationBoundary(source) && isForCompensation(target)) {
|
|
44205
|
-
return true;
|
|
44206
|
-
}
|
|
44207
|
-
|
|
44208
44419
|
// don't connect parent <-> child
|
|
44209
44420
|
if (isParent(target, source) || isParent(source, target)) {
|
|
44210
44421
|
return false;
|
|
@@ -44220,6 +44431,22 @@
|
|
|
44220
44431
|
return !!canConnectDataAssociation(source, target);
|
|
44221
44432
|
}
|
|
44222
44433
|
|
|
44434
|
+
/**
|
|
44435
|
+
* @param {Element} source
|
|
44436
|
+
* @param {Element} target
|
|
44437
|
+
*
|
|
44438
|
+
* @return {boolean}
|
|
44439
|
+
*/
|
|
44440
|
+
function canConnectCompensationAssociation(source, target) {
|
|
44441
|
+
return (
|
|
44442
|
+
isSameScope(source, target) &&
|
|
44443
|
+
isCompensationBoundary(source) &&
|
|
44444
|
+
is$1(target, 'bpmn:Activity') &&
|
|
44445
|
+
!isHostOfElement(target, source) &&
|
|
44446
|
+
!isEventSubProcess(target)
|
|
44447
|
+
);
|
|
44448
|
+
}
|
|
44449
|
+
|
|
44223
44450
|
/**
|
|
44224
44451
|
* @param {Element} source
|
|
44225
44452
|
* @param {Element} target
|
|
@@ -44346,6 +44573,10 @@
|
|
|
44346
44573
|
return getParent(element, 'bpmn:Process') || getParent(element, 'bpmn:Collaboration');
|
|
44347
44574
|
}
|
|
44348
44575
|
|
|
44576
|
+
function isHostOfElement(potentialHost, element) {
|
|
44577
|
+
return potentialHost.attachers.includes(element);
|
|
44578
|
+
}
|
|
44579
|
+
|
|
44349
44580
|
var RulesModule = {
|
|
44350
44581
|
__depends__: [
|
|
44351
44582
|
RulesModule$1
|
|
@@ -46620,6 +46851,10 @@
|
|
|
46620
46851
|
return false;
|
|
46621
46852
|
}
|
|
46622
46853
|
|
|
46854
|
+
if (propertyName === 'isForCompensation') {
|
|
46855
|
+
return !isEventSubProcess(newBusinessObject);
|
|
46856
|
+
}
|
|
46857
|
+
|
|
46623
46858
|
return true;
|
|
46624
46859
|
});
|
|
46625
46860
|
|