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