camunda-bpmn-js 3.10.0 → 3.10.2
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/camunda-cloud-modeler.development.js +285 -521
- package/dist/camunda-cloud-modeler.production.min.js +3 -3
- package/dist/camunda-platform-modeler.development.js +137 -371
- package/dist/camunda-platform-modeler.production.min.js +1 -1
- package/lib/camunda-cloud/Modeler.js +0 -3
- package/package.json +4 -4
- package/lib/camunda-cloud/features/rules/BpmnRules.d.ts +0 -32
- package/lib/camunda-cloud/features/rules/BpmnRules.js +0 -161
- package/lib/camunda-cloud/features/rules/index.d.ts +0 -6
- package/lib/camunda-cloud/features/rules/index.js +0 -6
|
@@ -43395,7 +43395,7 @@
|
|
|
43395
43395
|
}
|
|
43396
43396
|
|
|
43397
43397
|
if (element.host) {
|
|
43398
|
-
return canAttach
|
|
43398
|
+
return canAttach(element, element.host, null, position);
|
|
43399
43399
|
}
|
|
43400
43400
|
|
|
43401
43401
|
return canCreate(element, target, null);
|
|
@@ -43408,7 +43408,7 @@
|
|
|
43408
43408
|
shapes = context.shapes,
|
|
43409
43409
|
position = context.position;
|
|
43410
43410
|
|
|
43411
|
-
return canAttach
|
|
43411
|
+
return canAttach(shapes, target, null, position) ||
|
|
43412
43412
|
canReplace(shapes, target, position) ||
|
|
43413
43413
|
canMove(shapes, target) ||
|
|
43414
43414
|
canInsert(shapes, target);
|
|
@@ -43425,7 +43425,7 @@
|
|
|
43425
43425
|
|
|
43426
43426
|
this.addRule('shape.attach', function(context) {
|
|
43427
43427
|
|
|
43428
|
-
return canAttach
|
|
43428
|
+
return canAttach(
|
|
43429
43429
|
context.shape,
|
|
43430
43430
|
context.target,
|
|
43431
43431
|
null,
|
|
@@ -43451,7 +43451,7 @@
|
|
|
43451
43451
|
|
|
43452
43452
|
BpmnRules.prototype.canMove = canMove;
|
|
43453
43453
|
|
|
43454
|
-
BpmnRules.prototype.canAttach = canAttach
|
|
43454
|
+
BpmnRules.prototype.canAttach = canAttach;
|
|
43455
43455
|
|
|
43456
43456
|
BpmnRules.prototype.canReplace = canReplace;
|
|
43457
43457
|
|
|
@@ -44008,7 +44008,7 @@
|
|
|
44008
44008
|
*
|
|
44009
44009
|
* @return {boolean | 'attach'}
|
|
44010
44010
|
*/
|
|
44011
|
-
function canAttach
|
|
44011
|
+
function canAttach(elements, target, source, position) {
|
|
44012
44012
|
|
|
44013
44013
|
if (!Array.isArray(elements)) {
|
|
44014
44014
|
elements = [ elements ];
|
|
@@ -44144,7 +44144,7 @@
|
|
|
44144
44144
|
});
|
|
44145
44145
|
}
|
|
44146
44146
|
|
|
44147
|
-
if (is$6(element, 'bpmn:BoundaryEvent') && canAttach
|
|
44147
|
+
if (is$6(element, 'bpmn:BoundaryEvent') && canAttach(element, target, null, position)) {
|
|
44148
44148
|
canExecute.replacements.push({
|
|
44149
44149
|
oldElementId: element.id,
|
|
44150
44150
|
newElementType: 'bpmn:BoundaryEvent'
|
|
@@ -122504,149 +122504,6 @@
|
|
|
122504
122504
|
updatePropagateAllChildVariablesBehavior: [ 'type', UpdatePropagateAllChildVariablesBehavior ]
|
|
122505
122505
|
};
|
|
122506
122506
|
|
|
122507
|
-
/**
|
|
122508
|
-
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
|
|
122509
|
-
*
|
|
122510
|
-
* @typedef {import('bpmn-js/lib/model/Types').Element} Element
|
|
122511
|
-
* @typedef {import('bpmn-js/lib/model/Types').Shape} Shape
|
|
122512
|
-
*
|
|
122513
|
-
* @typedef {import('diagram-js/lib/util/Types').Point} Point
|
|
122514
|
-
*/
|
|
122515
|
-
|
|
122516
|
-
const HIGH_PRIORITY$2 = 5000;
|
|
122517
|
-
|
|
122518
|
-
/**
|
|
122519
|
-
* Zeebe rule provider that allows to create boundary events with catch events
|
|
122520
|
-
*
|
|
122521
|
-
* See {@link CustomRules} for the default implementation
|
|
122522
|
-
* of BPMN 2.0 modeling rules provided by bpmn-js.
|
|
122523
|
-
*/
|
|
122524
|
-
class CustomRules extends BpmnRules {
|
|
122525
|
-
|
|
122526
|
-
/**
|
|
122527
|
-
* @param {EventBus} eventBus
|
|
122528
|
-
*/
|
|
122529
|
-
constructor(eventBus) {
|
|
122530
|
-
super(eventBus);
|
|
122531
|
-
}
|
|
122532
|
-
|
|
122533
|
-
init() {
|
|
122534
|
-
super.init();
|
|
122535
|
-
|
|
122536
|
-
this.addRule('shape.attach', HIGH_PRIORITY$2,(context) => {
|
|
122537
|
-
return canAttach(
|
|
122538
|
-
context.shape,
|
|
122539
|
-
context.target,
|
|
122540
|
-
null,
|
|
122541
|
-
context.position);
|
|
122542
|
-
});
|
|
122543
|
-
}
|
|
122544
|
-
}
|
|
122545
|
-
|
|
122546
|
-
CustomRules.$inject = [ 'eventBus' ];
|
|
122547
|
-
|
|
122548
|
-
/**
|
|
122549
|
-
* Zeebe-specific rule that allows attaching intermediate events.
|
|
122550
|
-
*
|
|
122551
|
-
* @param {Element} elements
|
|
122552
|
-
* @param {Shape} target
|
|
122553
|
-
* @param {Element} source
|
|
122554
|
-
* @param {Point} position
|
|
122555
|
-
*
|
|
122556
|
-
* @return {boolean|'attach'}
|
|
122557
|
-
*/
|
|
122558
|
-
function canAttach(elements, target, source, position) {
|
|
122559
|
-
function isBoundaryEvent(element) {
|
|
122560
|
-
return !isLabel$2(element) && is$6(element, 'bpmn:BoundaryEvent');
|
|
122561
|
-
}
|
|
122562
|
-
|
|
122563
|
-
/**
|
|
122564
|
-
* In Zeebe we treat IntermediateCatchEvents as boundary events too,
|
|
122565
|
-
* this must be reflected in the rules.
|
|
122566
|
-
*/
|
|
122567
|
-
function isBoundaryCandidate(element) {
|
|
122568
|
-
return isBoundaryEvent(element) || (
|
|
122569
|
-
(
|
|
122570
|
-
is$6(element, 'bpmn:IntermediateCatchEvent') ||
|
|
122571
|
-
is$6(element, 'bpmn:IntermediateThrowEvent')
|
|
122572
|
-
) && !element.parent
|
|
122573
|
-
);
|
|
122574
|
-
}
|
|
122575
|
-
|
|
122576
|
-
function isForCompensation(e) {
|
|
122577
|
-
return getBusinessObject$2(e).isForCompensation;
|
|
122578
|
-
}
|
|
122579
|
-
|
|
122580
|
-
function isReceiveTaskAfterEventBasedGateway(element) {
|
|
122581
|
-
return (
|
|
122582
|
-
is$6(element, 'bpmn:ReceiveTask') &&
|
|
122583
|
-
find$2(element.incoming, function(incoming) {
|
|
122584
|
-
return is$6(incoming.source, 'bpmn:EventBasedGateway');
|
|
122585
|
-
})
|
|
122586
|
-
);
|
|
122587
|
-
}
|
|
122588
|
-
|
|
122589
|
-
if (!Array.isArray(elements)) {
|
|
122590
|
-
elements = [ elements ];
|
|
122591
|
-
}
|
|
122592
|
-
|
|
122593
|
-
// disallow appending as boundary event
|
|
122594
|
-
if (source) {
|
|
122595
|
-
return false;
|
|
122596
|
-
}
|
|
122597
|
-
|
|
122598
|
-
// only (re-)attach one element at a time
|
|
122599
|
-
if (elements.length !== 1) {
|
|
122600
|
-
return false;
|
|
122601
|
-
}
|
|
122602
|
-
|
|
122603
|
-
const element = elements[0];
|
|
122604
|
-
|
|
122605
|
-
// do not attach labels
|
|
122606
|
-
if (isLabel$2(element)) {
|
|
122607
|
-
return false;
|
|
122608
|
-
}
|
|
122609
|
-
|
|
122610
|
-
// only handle boundary events
|
|
122611
|
-
if (!isBoundaryCandidate(element)) {
|
|
122612
|
-
return false;
|
|
122613
|
-
}
|
|
122614
|
-
|
|
122615
|
-
// allow default move operation
|
|
122616
|
-
if (!target) {
|
|
122617
|
-
return true;
|
|
122618
|
-
}
|
|
122619
|
-
|
|
122620
|
-
// disallow drop on event sub processes
|
|
122621
|
-
if (isEventSubProcess(target)) {
|
|
122622
|
-
return false;
|
|
122623
|
-
}
|
|
122624
|
-
|
|
122625
|
-
// only allow drop on non compensation activities
|
|
122626
|
-
if (!is$6(target, 'bpmn:Activity') || isForCompensation(target)) {
|
|
122627
|
-
return false;
|
|
122628
|
-
}
|
|
122629
|
-
|
|
122630
|
-
// only attach to subprocess border
|
|
122631
|
-
if (position && !getBoundaryAttachment(position, target)) {
|
|
122632
|
-
return false;
|
|
122633
|
-
}
|
|
122634
|
-
|
|
122635
|
-
// do not attach on receive tasks after event based gateways
|
|
122636
|
-
if (isReceiveTaskAfterEventBasedGateway(target)) {
|
|
122637
|
-
return false;
|
|
122638
|
-
}
|
|
122639
|
-
|
|
122640
|
-
return 'attach';
|
|
122641
|
-
}
|
|
122642
|
-
|
|
122643
|
-
CustomRules.canAttach = canAttach;
|
|
122644
|
-
|
|
122645
|
-
var rulesModule = {
|
|
122646
|
-
__init__: [ 'bpmnRules' ],
|
|
122647
|
-
bpmnRules: [ 'type', CustomRules ]
|
|
122648
|
-
};
|
|
122649
|
-
|
|
122650
122507
|
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
122651
122508
|
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
122652
122509
|
// generators (like Math.random()).
|
|
@@ -123526,11 +123383,11 @@
|
|
|
123526
123383
|
}
|
|
123527
123384
|
businessObject = eventDefinitions[0];
|
|
123528
123385
|
}
|
|
123386
|
+
if (!businessObject) {
|
|
123387
|
+
return;
|
|
123388
|
+
}
|
|
123529
123389
|
return businessObject.get('messageRef');
|
|
123530
123390
|
}
|
|
123531
|
-
function findZeebeSubscription(message) {
|
|
123532
|
-
return findExtension$1(message, 'zeebe:Subscription');
|
|
123533
|
-
}
|
|
123534
123391
|
function getDefaultValue(property) {
|
|
123535
123392
|
if (property.value !== undefined) {
|
|
123536
123393
|
return property.value;
|
|
@@ -124152,242 +124009,6 @@
|
|
|
124152
124009
|
// should never throw as templates are validated beforehand
|
|
124153
124010
|
throw unknownBindingError$1(element, property);
|
|
124154
124011
|
}
|
|
124155
|
-
function unsetProperty(commandStack, element, property) {
|
|
124156
|
-
let businessObject = getBusinessObject$2(element);
|
|
124157
|
-
const {
|
|
124158
|
-
binding
|
|
124159
|
-
} = property;
|
|
124160
|
-
const {
|
|
124161
|
-
type
|
|
124162
|
-
} = binding;
|
|
124163
|
-
let extensionElements;
|
|
124164
|
-
const commands = [];
|
|
124165
|
-
const context = {
|
|
124166
|
-
element,
|
|
124167
|
-
property
|
|
124168
|
-
};
|
|
124169
|
-
if (MESSAGE_BINDING_TYPES.includes(type)) {
|
|
124170
|
-
businessObject = findMessage(businessObject);
|
|
124171
|
-
if (!businessObject) {
|
|
124172
|
-
return;
|
|
124173
|
-
}
|
|
124174
|
-
}
|
|
124175
|
-
|
|
124176
|
-
// property
|
|
124177
|
-
if (PROPERTY_BINDING_TYPES.includes(type)) {
|
|
124178
|
-
const {
|
|
124179
|
-
name
|
|
124180
|
-
} = binding;
|
|
124181
|
-
commands.push({
|
|
124182
|
-
cmd: 'element.updateModdleProperties',
|
|
124183
|
-
context: {
|
|
124184
|
-
...context,
|
|
124185
|
-
moddleElement: businessObject,
|
|
124186
|
-
properties: {
|
|
124187
|
-
[name]: undefined
|
|
124188
|
-
}
|
|
124189
|
-
}
|
|
124190
|
-
});
|
|
124191
|
-
}
|
|
124192
|
-
if (EXTENSION_BINDING_TYPES$1.includes(type)) {
|
|
124193
|
-
extensionElements = businessObject.get('extensionElements');
|
|
124194
|
-
if (!extensionElements) return;
|
|
124195
|
-
}
|
|
124196
|
-
|
|
124197
|
-
// zeebe:taskDefinition
|
|
124198
|
-
if (TASK_DEFINITION_TYPES.includes(type)) {
|
|
124199
|
-
const oldTaskDefinition = findExtension$1(extensionElements, 'zeebe:TaskDefinition');
|
|
124200
|
-
const propertyName = getTaskDefinitionPropertyName(binding);
|
|
124201
|
-
if (oldTaskDefinition) {
|
|
124202
|
-
if (isOnlyProperty(oldTaskDefinition, propertyName)) {
|
|
124203
|
-
// remove task definition
|
|
124204
|
-
commands.push({
|
|
124205
|
-
cmd: 'element.updateModdleProperties',
|
|
124206
|
-
context: {
|
|
124207
|
-
...context,
|
|
124208
|
-
moddleElement: extensionElements,
|
|
124209
|
-
properties: {
|
|
124210
|
-
values: without(extensionElements.get('values'), oldTaskDefinition)
|
|
124211
|
-
}
|
|
124212
|
-
}
|
|
124213
|
-
});
|
|
124214
|
-
} else {
|
|
124215
|
-
// remove property
|
|
124216
|
-
commands.push({
|
|
124217
|
-
cmd: 'element.updateModdleProperties',
|
|
124218
|
-
context: {
|
|
124219
|
-
...context,
|
|
124220
|
-
moddleElement: oldTaskDefinition,
|
|
124221
|
-
properties: {
|
|
124222
|
-
[propertyName]: undefined
|
|
124223
|
-
}
|
|
124224
|
-
}
|
|
124225
|
-
});
|
|
124226
|
-
}
|
|
124227
|
-
}
|
|
124228
|
-
}
|
|
124229
|
-
|
|
124230
|
-
// zeebe:IoMapping
|
|
124231
|
-
if (IO_BINDING_TYPES$1.includes(type)) {
|
|
124232
|
-
let ioMapping = findExtension$1(extensionElements, 'zeebe:IoMapping');
|
|
124233
|
-
if (!ioMapping) return;
|
|
124234
|
-
|
|
124235
|
-
// zeebe:Input
|
|
124236
|
-
if (type === ZEBBE_INPUT_TYPE) {
|
|
124237
|
-
const oldZeebeInputParameter = findInputParameter$1(ioMapping, binding);
|
|
124238
|
-
const values = ioMapping.get('inputParameters').filter(value => value !== oldZeebeInputParameter);
|
|
124239
|
-
if (ioMapping.get('outputParameters').length == 0 && values.length == 0) {
|
|
124240
|
-
commands.push({
|
|
124241
|
-
cmd: 'element.updateModdleProperties',
|
|
124242
|
-
context: {
|
|
124243
|
-
...context,
|
|
124244
|
-
moddleElement: extensionElements,
|
|
124245
|
-
properties: {
|
|
124246
|
-
values: without(extensionElements.get('values'), ioMapping)
|
|
124247
|
-
}
|
|
124248
|
-
}
|
|
124249
|
-
});
|
|
124250
|
-
} else {
|
|
124251
|
-
commands.push({
|
|
124252
|
-
cmd: 'element.updateModdleProperties',
|
|
124253
|
-
context: {
|
|
124254
|
-
...context,
|
|
124255
|
-
moddleElement: ioMapping,
|
|
124256
|
-
properties: {
|
|
124257
|
-
inputParameters: [...values]
|
|
124258
|
-
}
|
|
124259
|
-
}
|
|
124260
|
-
});
|
|
124261
|
-
}
|
|
124262
|
-
}
|
|
124263
|
-
|
|
124264
|
-
// zeebe:Output
|
|
124265
|
-
if (type === ZEEBE_OUTPUT_TYPE) {
|
|
124266
|
-
const oldZeebeOutputParameter = findOutputParameter$1(ioMapping, binding);
|
|
124267
|
-
const values = ioMapping.get('outputParameters').filter(value => value !== oldZeebeOutputParameter);
|
|
124268
|
-
if (ioMapping.get('inputParameters').length == 0 && values.length == 0) {
|
|
124269
|
-
commands.push({
|
|
124270
|
-
cmd: 'element.updateModdleProperties',
|
|
124271
|
-
context: {
|
|
124272
|
-
...context,
|
|
124273
|
-
moddleElement: extensionElements,
|
|
124274
|
-
properties: {
|
|
124275
|
-
values: without(extensionElements.get('values'), ioMapping)
|
|
124276
|
-
}
|
|
124277
|
-
}
|
|
124278
|
-
});
|
|
124279
|
-
}
|
|
124280
|
-
commands.push({
|
|
124281
|
-
cmd: 'element.updateModdleProperties',
|
|
124282
|
-
context: {
|
|
124283
|
-
...context,
|
|
124284
|
-
moddleElement: ioMapping,
|
|
124285
|
-
properties: {
|
|
124286
|
-
'outputParameters': [...values]
|
|
124287
|
-
}
|
|
124288
|
-
}
|
|
124289
|
-
});
|
|
124290
|
-
}
|
|
124291
|
-
}
|
|
124292
|
-
|
|
124293
|
-
// zeebe:taskHeaders
|
|
124294
|
-
if (type === ZEEBE_TASK_HEADER_TYPE) {
|
|
124295
|
-
let taskHeaders = findExtension$1(extensionElements, 'zeebe:TaskHeaders');
|
|
124296
|
-
if (!taskHeaders) return;
|
|
124297
|
-
const oldTaskHeader = findTaskHeader(taskHeaders, binding);
|
|
124298
|
-
const values = taskHeaders.get('values').filter(value => value !== oldTaskHeader);
|
|
124299
|
-
if (values.length === 0) {
|
|
124300
|
-
commands.push({
|
|
124301
|
-
cmd: 'element.updateModdleProperties',
|
|
124302
|
-
context: {
|
|
124303
|
-
...context,
|
|
124304
|
-
moddleElement: extensionElements,
|
|
124305
|
-
properties: {
|
|
124306
|
-
values: without(extensionElements.get('values'), taskHeaders)
|
|
124307
|
-
}
|
|
124308
|
-
}
|
|
124309
|
-
});
|
|
124310
|
-
} else {
|
|
124311
|
-
commands.push({
|
|
124312
|
-
cmd: 'element.updateModdleProperties',
|
|
124313
|
-
context: {
|
|
124314
|
-
...context,
|
|
124315
|
-
moddleElement: taskHeaders,
|
|
124316
|
-
properties: {
|
|
124317
|
-
values: [...values]
|
|
124318
|
-
}
|
|
124319
|
-
}
|
|
124320
|
-
});
|
|
124321
|
-
}
|
|
124322
|
-
}
|
|
124323
|
-
|
|
124324
|
-
// zeebe:Property
|
|
124325
|
-
if (type === ZEEBE_PROPERTY_TYPE) {
|
|
124326
|
-
let zeebeProperties = findExtension$1(extensionElements, 'zeebe:Properties');
|
|
124327
|
-
if (!zeebeProperties) return;
|
|
124328
|
-
const oldZeebeProperty = findZeebeProperty(zeebeProperties, binding);
|
|
124329
|
-
const properties = zeebeProperties.get('properties').filter(property => property !== oldZeebeProperty);
|
|
124330
|
-
if (!properties.length) {
|
|
124331
|
-
commands.push({
|
|
124332
|
-
cmd: 'element.updateModdleProperties',
|
|
124333
|
-
context: {
|
|
124334
|
-
...context,
|
|
124335
|
-
moddleElement: extensionElements,
|
|
124336
|
-
properties: {
|
|
124337
|
-
values: without(extensionElements.get('values'), zeebeProperties)
|
|
124338
|
-
}
|
|
124339
|
-
}
|
|
124340
|
-
});
|
|
124341
|
-
} else {
|
|
124342
|
-
commands.push({
|
|
124343
|
-
cmd: 'element.updateModdleProperties',
|
|
124344
|
-
context: {
|
|
124345
|
-
...context,
|
|
124346
|
-
moddleElement: zeebeProperties,
|
|
124347
|
-
properties: {
|
|
124348
|
-
properties: [...properties]
|
|
124349
|
-
}
|
|
124350
|
-
}
|
|
124351
|
-
});
|
|
124352
|
-
}
|
|
124353
|
-
}
|
|
124354
|
-
|
|
124355
|
-
// bpmn:Message#property
|
|
124356
|
-
if (type === MESSAGE_PROPERTY_TYPE) {
|
|
124357
|
-
commands.push({
|
|
124358
|
-
cmd: 'element.updateModdleProperties',
|
|
124359
|
-
context: {
|
|
124360
|
-
...context,
|
|
124361
|
-
moddleElement: businessObject,
|
|
124362
|
-
properties: {
|
|
124363
|
-
[binding.name]: undefined
|
|
124364
|
-
}
|
|
124365
|
-
}
|
|
124366
|
-
});
|
|
124367
|
-
}
|
|
124368
|
-
|
|
124369
|
-
// bpmn:Message#zeebe:subscription#property
|
|
124370
|
-
if (type === MESSAGE_ZEEBE_SUBSCRIPTION_PROPERTY_TYPE) {
|
|
124371
|
-
const subscription = findZeebeSubscription(businessObject);
|
|
124372
|
-
if (!subscription) {
|
|
124373
|
-
return;
|
|
124374
|
-
}
|
|
124375
|
-
commands.push({
|
|
124376
|
-
cmd: 'element.updateModdleProperties',
|
|
124377
|
-
context: {
|
|
124378
|
-
...context,
|
|
124379
|
-
moddleElement: subscription,
|
|
124380
|
-
properties: {
|
|
124381
|
-
[binding.name]: undefined
|
|
124382
|
-
}
|
|
124383
|
-
}
|
|
124384
|
-
});
|
|
124385
|
-
}
|
|
124386
|
-
if (commands.length) {
|
|
124387
|
-
commandStack.execute('properties-panel.multi-command-executor', commands);
|
|
124388
|
-
return;
|
|
124389
|
-
}
|
|
124390
|
-
}
|
|
124391
124012
|
function validateProperty(value, property, translate$1 = translate) {
|
|
124392
124013
|
const {
|
|
124393
124014
|
constraints = {},
|
|
@@ -124452,14 +124073,6 @@
|
|
|
124452
124073
|
function matchesPattern$1(string, pattern) {
|
|
124453
124074
|
return new RegExp(pattern).test(string);
|
|
124454
124075
|
}
|
|
124455
|
-
function isOnlyProperty(moddleElement, propertyName) {
|
|
124456
|
-
const descriptor = moddleElement.$descriptor;
|
|
124457
|
-
return descriptor.properties.every(({
|
|
124458
|
-
name
|
|
124459
|
-
}) => {
|
|
124460
|
-
return propertyName === name || moddleElement.get(name) === undefined;
|
|
124461
|
-
});
|
|
124462
|
-
}
|
|
124463
124076
|
|
|
124464
124077
|
/**
|
|
124465
124078
|
* Based on conditions, remove properties from the template.
|
|
@@ -124538,49 +124151,7 @@
|
|
|
124538
124151
|
return true;
|
|
124539
124152
|
}
|
|
124540
124153
|
|
|
124541
|
-
|
|
124542
|
-
const modeling = injector.get('modeling'),
|
|
124543
|
-
canvas = injector.get('canvas'),
|
|
124544
|
-
bpmnjs = injector.get('bpmnjs');
|
|
124545
|
-
const element = canvas.getRootElement(),
|
|
124546
|
-
definitions = bpmnjs.getDefinitions(),
|
|
124547
|
-
rootElements = definitions.get('rootElements');
|
|
124548
|
-
const newRootElements = rootElements.filter(e => e !== rootElement);
|
|
124549
|
-
|
|
124550
|
-
// short-circuit to prevent unnecessary updates
|
|
124551
|
-
if (newRootElements.length === rootElements.length) {
|
|
124552
|
-
return;
|
|
124553
|
-
}
|
|
124554
|
-
modeling.updateModdleProperties(element, definitions, {
|
|
124555
|
-
rootElements: newRootElements
|
|
124556
|
-
});
|
|
124557
|
-
}
|
|
124558
|
-
|
|
124559
|
-
/**
|
|
124560
|
-
* Remove message from element and the diagram.
|
|
124561
|
-
*
|
|
124562
|
-
* @param {import('bpmn-js/lib/model/Types').Element} element
|
|
124563
|
-
* @param {import('didi').Injector} injector
|
|
124564
|
-
*/
|
|
124565
|
-
function removeMessage(element, injector) {
|
|
124566
|
-
const modeling = injector.get('modeling');
|
|
124567
|
-
const bo = getReferringElement(element);
|
|
124568
|
-
const message = findMessage(bo);
|
|
124569
|
-
if (!message) {
|
|
124570
|
-
return;
|
|
124571
|
-
}
|
|
124572
|
-
modeling.updateModdleProperties(element, bo, {
|
|
124573
|
-
messageRef: undefined
|
|
124574
|
-
});
|
|
124575
|
-
removeRootElement(message, injector);
|
|
124576
|
-
}
|
|
124577
|
-
function getReferringElement(element) {
|
|
124578
|
-
const bo = getBusinessObject$2(element);
|
|
124579
|
-
if (is$6(bo, 'bpmn:Event')) {
|
|
124580
|
-
return bo.get('eventDefinitions')[0];
|
|
124581
|
-
}
|
|
124582
|
-
return bo;
|
|
124583
|
-
}
|
|
124154
|
+
const HIGH_PRIORITY$2 = 2500;
|
|
124584
124155
|
|
|
124585
124156
|
/**
|
|
124586
124157
|
* Checks the conditions of an element template and sets/resets the
|
|
@@ -124596,6 +124167,20 @@
|
|
|
124596
124167
|
this._injector = injector;
|
|
124597
124168
|
this.preExecute(['element.updateProperties', 'element.updateModdleProperties'], this._saveConditionalState, true, this);
|
|
124598
124169
|
this.postExecute(['element.updateProperties', 'element.updateModdleProperties', 'propertiesPanel.zeebe.changeTemplate', 'element.move'], this._applyConditions, true, this);
|
|
124170
|
+
|
|
124171
|
+
// Apply Conditions before changing properties. This persists the template so we can check if conditions apply
|
|
124172
|
+
// after upgrading the template.
|
|
124173
|
+
this.preExecute(['propertiesPanel.zeebe.changeTemplate'], HIGH_PRIORITY$2, this._handleTemplateUpgrade, true, this);
|
|
124174
|
+
}
|
|
124175
|
+
_handleTemplateUpgrade(context) {
|
|
124176
|
+
const {
|
|
124177
|
+
element,
|
|
124178
|
+
newTemplate
|
|
124179
|
+
} = context;
|
|
124180
|
+
if (!element || !newTemplate) {
|
|
124181
|
+
return;
|
|
124182
|
+
}
|
|
124183
|
+
context.newTemplate = applyConditions(context.element, context.newTemplate);
|
|
124599
124184
|
}
|
|
124600
124185
|
_saveConditionalState(context) {
|
|
124601
124186
|
const {
|
|
@@ -124610,29 +124195,52 @@
|
|
|
124610
124195
|
_applyConditions(context) {
|
|
124611
124196
|
const {
|
|
124612
124197
|
element,
|
|
124613
|
-
|
|
124198
|
+
hints = {}
|
|
124614
124199
|
} = context;
|
|
124200
|
+
if (hints.skipConditionUpdate) {
|
|
124201
|
+
return;
|
|
124202
|
+
}
|
|
124615
124203
|
const template = this._elementTemplates.get(element);
|
|
124204
|
+
|
|
124205
|
+
// New Template is persisted before applying default values,
|
|
124206
|
+
// new conditions might apply after the defaults are present.
|
|
124207
|
+
const oldTemplate = context.oldTemplate || context.newTemplate;
|
|
124616
124208
|
if (!template || !oldTemplate || template.id !== oldTemplate.id) {
|
|
124617
124209
|
return;
|
|
124618
124210
|
}
|
|
124619
124211
|
const newTemplate = applyConditions(element, template);
|
|
124620
|
-
|
|
124621
|
-
|
|
124622
|
-
this._updateReferencedElement(element, oldTemplate, newTemplate);
|
|
124623
|
-
propertiesToAdd.forEach(property => setPropertyValue(this._bpmnFactory, this._commandStack, element, property, property.value));
|
|
124624
|
-
propertiesToRemove.forEach(property => unsetProperty(this._commandStack, element, property));
|
|
124625
|
-
}
|
|
124626
|
-
_updateReferencedElement(element, oldTemplate, newTemplate) {
|
|
124627
|
-
if (hasMessageProperties(oldTemplate) && !hasMessageProperties(newTemplate)) {
|
|
124628
|
-
removeMessage(element, this._injector);
|
|
124212
|
+
if (!hasDifferentPropertyBindings(newTemplate, oldTemplate)) {
|
|
124213
|
+
return;
|
|
124629
124214
|
}
|
|
124215
|
+
const changeContext = {
|
|
124216
|
+
element,
|
|
124217
|
+
newTemplate,
|
|
124218
|
+
oldTemplate,
|
|
124219
|
+
hints: {
|
|
124220
|
+
skipConditionUpdate: true
|
|
124221
|
+
}
|
|
124222
|
+
};
|
|
124223
|
+
this._commandStack.execute('propertiesPanel.zeebe.changeTemplate', changeContext);
|
|
124630
124224
|
}
|
|
124631
124225
|
}
|
|
124632
124226
|
ElementTemplatesConditionChecker.$inject = ['eventBus', 'elementTemplates', 'commandStack', 'bpmnFactory', 'injector'];
|
|
124633
124227
|
|
|
124634
124228
|
// helpers
|
|
124635
124229
|
|
|
124230
|
+
function hasDifferentPropertyBindings(sourceTemplate, targetTemplate) {
|
|
124231
|
+
return hasNewProperties(sourceTemplate, targetTemplate) || hasRemovedProperties(sourceTemplate, targetTemplate);
|
|
124232
|
+
}
|
|
124233
|
+
function hasNewProperties(sourceTemplate, targetTemplate) {
|
|
124234
|
+
let properties = targetTemplate.properties;
|
|
124235
|
+
return properties.some(targetProp => !sourceTemplate.properties.find(sourceProp => compareProps(sourceProp, targetProp)));
|
|
124236
|
+
}
|
|
124237
|
+
function hasRemovedProperties(oldTemplate, newTemplate) {
|
|
124238
|
+
const oldProperties = getMissingProperties(newTemplate, oldTemplate);
|
|
124239
|
+
|
|
124240
|
+
// ensure XML properties are mantained for properties with
|
|
124241
|
+
// different conditions but same bindings
|
|
124242
|
+
return oldProperties.some(property => !findPropertyWithBinding(newTemplate, property));
|
|
124243
|
+
}
|
|
124636
124244
|
function getMissingProperties(sourceTemplate, targetTemplate) {
|
|
124637
124245
|
let properties = targetTemplate.properties;
|
|
124638
124246
|
return properties.filter(targetProp => !sourceTemplate.properties.find(sourceProp => compareProps(sourceProp, targetProp)));
|
|
@@ -124643,13 +124251,6 @@
|
|
|
124643
124251
|
function findPropertyWithBinding(template, prop1) {
|
|
124644
124252
|
return template.properties.some(prop2 => areBindingsEqual(prop1.binding, prop2.binding));
|
|
124645
124253
|
}
|
|
124646
|
-
function getPropertiesToRemove(newTemplate, oldTemplate) {
|
|
124647
|
-
const oldProperties = getMissingProperties(newTemplate, oldTemplate);
|
|
124648
|
-
|
|
124649
|
-
// ensure XML properties are mantained for properties with
|
|
124650
|
-
// different conditions but same bindings
|
|
124651
|
-
return oldProperties.filter(property => !findPropertyWithBinding(newTemplate, property));
|
|
124652
|
-
}
|
|
124653
124254
|
function normalizeReplacer$1(key, value) {
|
|
124654
124255
|
if (isObject$1(value)) {
|
|
124655
124256
|
const keys = Object.keys(value).sort();
|
|
@@ -124682,9 +124283,6 @@
|
|
|
124682
124283
|
function equals(a, b) {
|
|
124683
124284
|
return JSON.stringify(a, normalizeReplacer$1) === JSON.stringify(b, normalizeReplacer$1);
|
|
124684
124285
|
}
|
|
124685
|
-
function hasMessageProperties(template) {
|
|
124686
|
-
return template.properties.some(p => MESSAGE_BINDING_TYPES.includes(p.binding.type));
|
|
124687
|
-
}
|
|
124688
124286
|
|
|
124689
124287
|
/**
|
|
124690
124288
|
* The BPMN 2.0 extension attribute name under
|
|
@@ -125464,16 +125062,87 @@
|
|
|
125464
125062
|
return !is$6(eventDefinitions[0], eventDefinition);
|
|
125465
125063
|
}
|
|
125466
125064
|
|
|
125065
|
+
function removeRootElement(rootElement, injector) {
|
|
125066
|
+
const modeling = injector.get('modeling'),
|
|
125067
|
+
canvas = injector.get('canvas'),
|
|
125068
|
+
bpmnjs = injector.get('bpmnjs');
|
|
125069
|
+
const element = canvas.getRootElement(),
|
|
125070
|
+
definitions = bpmnjs.getDefinitions(),
|
|
125071
|
+
rootElements = definitions.get('rootElements');
|
|
125072
|
+
const newRootElements = rootElements.filter(e => e !== rootElement);
|
|
125073
|
+
|
|
125074
|
+
// short-circuit to prevent unnecessary updates
|
|
125075
|
+
if (newRootElements.length === rootElements.length) {
|
|
125076
|
+
return;
|
|
125077
|
+
}
|
|
125078
|
+
modeling.updateModdleProperties(element, definitions, {
|
|
125079
|
+
rootElements: newRootElements
|
|
125080
|
+
});
|
|
125081
|
+
}
|
|
125082
|
+
|
|
125083
|
+
/**
|
|
125084
|
+
* Remove message from element and the diagram.
|
|
125085
|
+
*
|
|
125086
|
+
* @param {import('bpmn-js/lib/model/Types').Element} element
|
|
125087
|
+
* @param {import('didi').Injector} injector
|
|
125088
|
+
*/
|
|
125089
|
+
function removeMessage(element, injector) {
|
|
125090
|
+
const modeling = injector.get('modeling');
|
|
125091
|
+
const bo = getReferringElement(element);
|
|
125092
|
+
|
|
125093
|
+
// Event does not have an event definition
|
|
125094
|
+
if (!bo) {
|
|
125095
|
+
return;
|
|
125096
|
+
}
|
|
125097
|
+
const message = findMessage(bo);
|
|
125098
|
+
if (!message) {
|
|
125099
|
+
return;
|
|
125100
|
+
}
|
|
125101
|
+
modeling.updateModdleProperties(element, bo, {
|
|
125102
|
+
messageRef: undefined
|
|
125103
|
+
});
|
|
125104
|
+
removeRootElement(message, injector);
|
|
125105
|
+
}
|
|
125106
|
+
function getReferringElement(element) {
|
|
125107
|
+
const bo = getBusinessObject$2(element);
|
|
125108
|
+
if (is$6(bo, 'bpmn:Event')) {
|
|
125109
|
+
return bo.get('eventDefinitions')[0];
|
|
125110
|
+
}
|
|
125111
|
+
return bo;
|
|
125112
|
+
}
|
|
125113
|
+
|
|
125467
125114
|
/**
|
|
125468
125115
|
* Applies an element template to an element. Sets `zeebe:modelerTemplate` and
|
|
125469
125116
|
* `zeebe:modelerTemplateVersion`.
|
|
125470
125117
|
*/
|
|
125471
125118
|
let ChangeElementTemplateHandler$1 = class ChangeElementTemplateHandler {
|
|
125472
|
-
constructor(bpmnFactory, bpmnReplace, commandStack,
|
|
125119
|
+
constructor(bpmnFactory, bpmnReplace, commandStack, injector) {
|
|
125473
125120
|
this._bpmnFactory = bpmnFactory;
|
|
125474
125121
|
this._bpmnReplace = bpmnReplace;
|
|
125475
|
-
|
|
125476
|
-
|
|
125122
|
+
|
|
125123
|
+
// Wrap commandStack and modeling to add hints to all commands
|
|
125124
|
+
this._commandStackWrapper = {
|
|
125125
|
+
execute: (event, context, ...rest) => {
|
|
125126
|
+
commandStack.execute(event, {
|
|
125127
|
+
hints: {
|
|
125128
|
+
skipConditionUpdate: true
|
|
125129
|
+
},
|
|
125130
|
+
...context
|
|
125131
|
+
}, ...rest);
|
|
125132
|
+
}
|
|
125133
|
+
};
|
|
125134
|
+
this._modelingWrapper = {
|
|
125135
|
+
updateModdleProperties: (element, moddleElement, properties) => this._commandStackWrapper.execute('element.updateModdleProperties', {
|
|
125136
|
+
element,
|
|
125137
|
+
moddleElement,
|
|
125138
|
+
properties
|
|
125139
|
+
}),
|
|
125140
|
+
updateProperties: (element, properties) => this._commandStackWrapper.execute('element.updateProperties', {
|
|
125141
|
+
element,
|
|
125142
|
+
properties
|
|
125143
|
+
})
|
|
125144
|
+
};
|
|
125145
|
+
this._injector = injector;
|
|
125477
125146
|
}
|
|
125478
125147
|
|
|
125479
125148
|
/**
|
|
@@ -125498,11 +125167,8 @@
|
|
|
125498
125167
|
// update zeebe:modelerTemplateIcon
|
|
125499
125168
|
this._updateZeebeModelerTemplateIcon(element, newTemplate);
|
|
125500
125169
|
if (newTemplate) {
|
|
125501
|
-
// do not apply properties that don't meet conditions
|
|
125502
|
-
newTemplate = applyConditions(element, newTemplate);
|
|
125503
|
-
|
|
125504
125170
|
// update element type
|
|
125505
|
-
element = context.element = this._updateElementType(element, newTemplate);
|
|
125171
|
+
element = context.element = this._updateElementType(element, oldTemplate, newTemplate);
|
|
125506
125172
|
|
|
125507
125173
|
// update properties
|
|
125508
125174
|
this._updateProperties(element, oldTemplate, newTemplate);
|
|
@@ -125518,18 +125184,12 @@
|
|
|
125518
125184
|
|
|
125519
125185
|
// update zeebe:Property properties
|
|
125520
125186
|
this._updateZeebePropertyProperties(element, oldTemplate, newTemplate);
|
|
125521
|
-
|
|
125522
|
-
// update bpmn:Message properties
|
|
125523
|
-
this._updateMessageProperties(element, oldTemplate, newTemplate);
|
|
125524
|
-
|
|
125525
|
-
// update bpmn:Message zeebe:subscription properties
|
|
125526
|
-
this._updateMessageZeebeSubscriptionProperties(element, oldTemplate, newTemplate);
|
|
125527
|
-
this._updateZeebeModelerTemplateOnReferencedElement(element, oldTemplate, newTemplate);
|
|
125187
|
+
this._updateMessage(element, oldTemplate, newTemplate);
|
|
125528
125188
|
}
|
|
125529
125189
|
}
|
|
125530
125190
|
_getOrCreateExtensionElements(element, businessObject = getBusinessObject$2(element)) {
|
|
125531
125191
|
const bpmnFactory = this._bpmnFactory,
|
|
125532
|
-
modeling = this.
|
|
125192
|
+
modeling = this._modelingWrapper;
|
|
125533
125193
|
let extensionElements = businessObject.get('extensionElements');
|
|
125534
125194
|
if (!extensionElements) {
|
|
125535
125195
|
extensionElements = bpmnFactory.create('bpmn:ExtensionElements', {
|
|
@@ -125543,30 +125203,48 @@
|
|
|
125543
125203
|
return extensionElements;
|
|
125544
125204
|
}
|
|
125545
125205
|
_updateZeebeModelerTemplate(element, newTemplate) {
|
|
125546
|
-
const modeling = this.
|
|
125206
|
+
const modeling = this._modelingWrapper;
|
|
125547
125207
|
modeling.updateProperties(element, {
|
|
125548
125208
|
'zeebe:modelerTemplate': newTemplate && newTemplate.id,
|
|
125549
125209
|
'zeebe:modelerTemplateVersion': newTemplate && newTemplate.version
|
|
125550
125210
|
});
|
|
125551
125211
|
}
|
|
125552
125212
|
_updateZeebeModelerTemplateIcon(element, newTemplate) {
|
|
125553
|
-
const modeling = this.
|
|
125213
|
+
const modeling = this._modelingWrapper;
|
|
125554
125214
|
const icon = newTemplate && newTemplate.icon;
|
|
125555
125215
|
modeling.updateProperties(element, {
|
|
125556
125216
|
'zeebe:modelerTemplateIcon': icon && icon.contents
|
|
125557
125217
|
});
|
|
125558
125218
|
}
|
|
125559
125219
|
_updateProperties(element, oldTemplate, newTemplate) {
|
|
125560
|
-
const commandStack = this.
|
|
125220
|
+
const commandStack = this._commandStackWrapper;
|
|
125221
|
+
const businessObject = getBusinessObject$2(element);
|
|
125561
125222
|
const newProperties = newTemplate.properties.filter(newProperty => {
|
|
125562
125223
|
const newBinding = newProperty.binding,
|
|
125563
125224
|
newBindingType = newBinding.type;
|
|
125564
125225
|
return newBindingType === 'property';
|
|
125565
125226
|
});
|
|
125227
|
+
|
|
125228
|
+
// Remove old Properties if no new Properties specified
|
|
125229
|
+
const propertiesToRemove = oldTemplate && oldTemplate.properties.filter(oldProperty => {
|
|
125230
|
+
const oldBinding = oldProperty.binding,
|
|
125231
|
+
oldBindingType = oldBinding.type;
|
|
125232
|
+
return oldBindingType === 'property' && !newProperties.find(newProperty => newProperty.binding.name === oldProperty.binding.name);
|
|
125233
|
+
}) || [];
|
|
125234
|
+
if (propertiesToRemove.length) {
|
|
125235
|
+
const payload = propertiesToRemove.reduce((properties, property) => {
|
|
125236
|
+
properties[property.binding.name] = undefined;
|
|
125237
|
+
return properties;
|
|
125238
|
+
}, {});
|
|
125239
|
+
commandStack.execute('element.updateModdleProperties', {
|
|
125240
|
+
element,
|
|
125241
|
+
moddleElement: businessObject,
|
|
125242
|
+
properties: payload
|
|
125243
|
+
});
|
|
125244
|
+
}
|
|
125566
125245
|
if (!newProperties.length) {
|
|
125567
125246
|
return;
|
|
125568
125247
|
}
|
|
125569
|
-
const businessObject = getBusinessObject$2(element);
|
|
125570
125248
|
newProperties.forEach(newProperty => {
|
|
125571
125249
|
const oldProperty = findOldProperty$1(oldTemplate, newProperty),
|
|
125572
125250
|
newBinding = newProperty.binding,
|
|
@@ -125596,34 +125274,42 @@
|
|
|
125596
125274
|
*/
|
|
125597
125275
|
_updateZeebeTaskDefinition(element, oldTemplate, newTemplate) {
|
|
125598
125276
|
const bpmnFactory = this._bpmnFactory,
|
|
125599
|
-
commandStack = this.
|
|
125277
|
+
commandStack = this._commandStackWrapper;
|
|
125600
125278
|
const newProperties = newTemplate.properties.filter(newProperty => {
|
|
125601
125279
|
const newBinding = newProperty.binding,
|
|
125602
125280
|
newBindingType = newBinding.type;
|
|
125603
125281
|
return TASK_DEFINITION_TYPES.includes(newBindingType);
|
|
125604
125282
|
});
|
|
125283
|
+
const businessObject = this._getOrCreateExtensionElements(element);
|
|
125284
|
+
let taskDefinition = findExtension$1(businessObject, 'zeebe:TaskDefinition');
|
|
125285
|
+
|
|
125286
|
+
// (1) remove old task definition if no new properties specified
|
|
125605
125287
|
|
|
125606
|
-
// (1) do not override old task definition if no new properties specified
|
|
125607
125288
|
if (!newProperties.length) {
|
|
125289
|
+
commandStack.execute('element.updateModdleProperties', {
|
|
125290
|
+
element,
|
|
125291
|
+
moddleElement: businessObject,
|
|
125292
|
+
properties: {
|
|
125293
|
+
values: without(businessObject.get('values'), taskDefinition)
|
|
125294
|
+
}
|
|
125295
|
+
});
|
|
125608
125296
|
return;
|
|
125609
125297
|
}
|
|
125610
|
-
const businessObject = this._getOrCreateExtensionElements(element);
|
|
125611
125298
|
newProperties.forEach(newProperty => {
|
|
125612
125299
|
const oldProperty = findOldProperty$1(oldTemplate, newProperty),
|
|
125613
|
-
oldTaskDefinition = findBusinessObject(businessObject, newProperty),
|
|
125614
125300
|
newPropertyValue = getDefaultValue(newProperty),
|
|
125615
125301
|
newBinding = newProperty.binding,
|
|
125616
125302
|
propertyName = getTaskDefinitionPropertyName(newBinding);
|
|
125617
125303
|
|
|
125618
125304
|
// (2) update old task definition
|
|
125619
|
-
if (
|
|
125620
|
-
if (!shouldKeepValue(
|
|
125305
|
+
if (taskDefinition) {
|
|
125306
|
+
if (!shouldKeepValue(taskDefinition, oldProperty, newProperty)) {
|
|
125621
125307
|
const properties = {
|
|
125622
125308
|
[propertyName]: newPropertyValue
|
|
125623
125309
|
};
|
|
125624
125310
|
commandStack.execute('element.updateModdleProperties', {
|
|
125625
125311
|
element,
|
|
125626
|
-
moddleElement:
|
|
125312
|
+
moddleElement: taskDefinition,
|
|
125627
125313
|
properties
|
|
125628
125314
|
});
|
|
125629
125315
|
}
|
|
@@ -125634,17 +125320,34 @@
|
|
|
125634
125320
|
const properties = {
|
|
125635
125321
|
[propertyName]: newPropertyValue
|
|
125636
125322
|
};
|
|
125637
|
-
|
|
125638
|
-
|
|
125323
|
+
taskDefinition = createTaskDefinition(properties, bpmnFactory);
|
|
125324
|
+
taskDefinition.$parent = businessObject;
|
|
125639
125325
|
commandStack.execute('element.updateModdleProperties', {
|
|
125640
125326
|
element,
|
|
125641
125327
|
moddleElement: businessObject,
|
|
125642
125328
|
properties: {
|
|
125643
|
-
values: [...businessObject.get('values'),
|
|
125329
|
+
values: [...businessObject.get('values'), taskDefinition]
|
|
125644
125330
|
}
|
|
125645
125331
|
});
|
|
125646
125332
|
}
|
|
125647
125333
|
});
|
|
125334
|
+
|
|
125335
|
+
// (4) remove properties no longer templated
|
|
125336
|
+
const oldProperties = oldTemplate && oldTemplate.properties.filter(oldProperty => {
|
|
125337
|
+
const oldBinding = oldProperty.binding,
|
|
125338
|
+
oldBindingType = oldBinding.type;
|
|
125339
|
+
return TASK_DEFINITION_TYPES.includes(oldBindingType) && !newProperties.find(newProperty => newProperty.binding.property === oldProperty.binding.property);
|
|
125340
|
+
}) || [];
|
|
125341
|
+
oldProperties.forEach(oldProperty => {
|
|
125342
|
+
const properties = {
|
|
125343
|
+
[oldProperty.binding.property]: undefined
|
|
125344
|
+
};
|
|
125345
|
+
commandStack.execute('element.updateModdleProperties', {
|
|
125346
|
+
element,
|
|
125347
|
+
moddleElement: taskDefinition,
|
|
125348
|
+
properties
|
|
125349
|
+
});
|
|
125350
|
+
});
|
|
125648
125351
|
}
|
|
125649
125352
|
|
|
125650
125353
|
/**
|
|
@@ -125657,7 +125360,7 @@
|
|
|
125657
125360
|
*/
|
|
125658
125361
|
_updateZeebeInputOutputParameterProperties(element, oldTemplate, newTemplate) {
|
|
125659
125362
|
const bpmnFactory = this._bpmnFactory,
|
|
125660
|
-
commandStack = this.
|
|
125363
|
+
commandStack = this._commandStackWrapper;
|
|
125661
125364
|
const newProperties = newTemplate.properties.filter(newProperty => {
|
|
125662
125365
|
const newBinding = newProperty.binding,
|
|
125663
125366
|
newBindingType = newBinding.type;
|
|
@@ -125784,7 +125487,7 @@
|
|
|
125784
125487
|
*/
|
|
125785
125488
|
_updateZeebeTaskHeaderProperties(element, oldTemplate, newTemplate) {
|
|
125786
125489
|
const bpmnFactory = this._bpmnFactory,
|
|
125787
|
-
commandStack = this.
|
|
125490
|
+
commandStack = this._commandStackWrapper;
|
|
125788
125491
|
const newProperties = newTemplate.properties.filter(newProperty => {
|
|
125789
125492
|
const newBinding = newProperty.binding,
|
|
125790
125493
|
newBindingType = newBinding.type;
|
|
@@ -125874,7 +125577,7 @@
|
|
|
125874
125577
|
*/
|
|
125875
125578
|
_updateZeebePropertyProperties(element, oldTemplate, newTemplate) {
|
|
125876
125579
|
const bpmnFactory = this._bpmnFactory,
|
|
125877
|
-
commandStack = this.
|
|
125580
|
+
commandStack = this._commandStackWrapper;
|
|
125878
125581
|
const newProperties = newTemplate.properties.filter(newProperty => {
|
|
125879
125582
|
const newBinding = newProperty.binding,
|
|
125880
125583
|
newBindingType = newBinding.type;
|
|
@@ -125955,6 +125658,17 @@
|
|
|
125955
125658
|
});
|
|
125956
125659
|
}
|
|
125957
125660
|
}
|
|
125661
|
+
_updateMessage(element, oldTemplate, newTemplate) {
|
|
125662
|
+
// update bpmn:Message properties
|
|
125663
|
+
this._updateMessageProperties(element, oldTemplate, newTemplate);
|
|
125664
|
+
|
|
125665
|
+
// update bpmn:Message zeebe:subscription properties
|
|
125666
|
+
this._updateMessageZeebeSubscriptionProperties(element, oldTemplate, newTemplate);
|
|
125667
|
+
this._updateZeebeModelerTemplateOnReferencedElement(element, oldTemplate, newTemplate);
|
|
125668
|
+
if (!hasMessageProperties(newTemplate)) {
|
|
125669
|
+
removeMessage(element, this._injector);
|
|
125670
|
+
}
|
|
125671
|
+
}
|
|
125958
125672
|
|
|
125959
125673
|
/**
|
|
125960
125674
|
* Update bpmn:Message properties.
|
|
@@ -125969,10 +125683,21 @@
|
|
|
125969
125683
|
newBindingType = newBinding.type;
|
|
125970
125684
|
return newBindingType === MESSAGE_PROPERTY_TYPE;
|
|
125971
125685
|
});
|
|
125686
|
+
const removedProperties = oldTemplate && oldTemplate.properties.filter(oldProperty => {
|
|
125687
|
+
const oldBinding = oldProperty.binding,
|
|
125688
|
+
oldBindingType = oldBinding.type;
|
|
125689
|
+
return oldBindingType === MESSAGE_PROPERTY_TYPE && !newProperties.find(newProperty => newProperty.binding.name === oldProperty.binding.name);
|
|
125690
|
+
}) || [];
|
|
125691
|
+
let message = this._getMessage(element);
|
|
125692
|
+
message && removedProperties.forEach(removedProperty => {
|
|
125693
|
+
this._modelingWrapper.updateModdleProperties(element, message, {
|
|
125694
|
+
[removedProperty.binding.name]: undefined
|
|
125695
|
+
});
|
|
125696
|
+
});
|
|
125972
125697
|
if (!newProperties.length) {
|
|
125973
125698
|
return;
|
|
125974
125699
|
}
|
|
125975
|
-
|
|
125700
|
+
message = this._getOrCreateMessage(element, newTemplate);
|
|
125976
125701
|
newProperties.forEach(newProperty => {
|
|
125977
125702
|
const oldProperty = findOldProperty$1(oldTemplate, newProperty),
|
|
125978
125703
|
newBinding = newProperty.binding,
|
|
@@ -125984,7 +125709,7 @@
|
|
|
125984
125709
|
return;
|
|
125985
125710
|
}
|
|
125986
125711
|
properties[newBindingName] = newPropertyValue;
|
|
125987
|
-
this.
|
|
125712
|
+
this._modelingWrapper.updateModdleProperties(element, changedElement, properties);
|
|
125988
125713
|
});
|
|
125989
125714
|
}
|
|
125990
125715
|
|
|
@@ -126001,24 +125726,50 @@
|
|
|
126001
125726
|
newBindingType = newBinding.type;
|
|
126002
125727
|
return newBindingType === MESSAGE_ZEEBE_SUBSCRIPTION_PROPERTY_TYPE;
|
|
126003
125728
|
});
|
|
126004
|
-
|
|
125729
|
+
const removedProperties = oldTemplate && oldTemplate.properties.filter(oldProperty => {
|
|
125730
|
+
const oldBinding = oldProperty.binding,
|
|
125731
|
+
oldBindingType = oldBinding.type;
|
|
125732
|
+
return oldBindingType === MESSAGE_ZEEBE_SUBSCRIPTION_PROPERTY_TYPE && !newProperties.find(newProperty => newProperty.binding.name === oldProperty.binding.name);
|
|
125733
|
+
}) || [];
|
|
125734
|
+
if (!newProperties.length && !removedProperties.length) {
|
|
126005
125735
|
return;
|
|
126006
125736
|
}
|
|
126007
125737
|
const message = this._getOrCreateMessage(element, newTemplate);
|
|
126008
|
-
const
|
|
126009
|
-
|
|
125738
|
+
const messageExtensionElements = this._getOrCreateExtensionElements(element, message);
|
|
125739
|
+
const zeebeSubscription = this._getSubscription(element, message);
|
|
125740
|
+
const propertiesToSet = newProperties.reduce((properties, newProperty) => {
|
|
126010
125741
|
const oldProperty = findOldProperty$1(oldTemplate, newProperty),
|
|
126011
125742
|
newBinding = newProperty.binding,
|
|
126012
125743
|
newBindingName = newBinding.name,
|
|
126013
125744
|
newPropertyValue = getDefaultValue(newProperty),
|
|
126014
125745
|
changedElement = zeebeSubscription;
|
|
126015
|
-
let properties = {};
|
|
126016
125746
|
if (shouldKeepValue(changedElement, oldProperty, newProperty)) {
|
|
126017
|
-
return;
|
|
125747
|
+
return properties;
|
|
126018
125748
|
}
|
|
126019
125749
|
properties[newBindingName] = newPropertyValue;
|
|
126020
|
-
|
|
126021
|
-
});
|
|
125750
|
+
return properties;
|
|
125751
|
+
}, {});
|
|
125752
|
+
|
|
125753
|
+
// Update zeebe Subscription
|
|
125754
|
+
if (zeebeSubscription) {
|
|
125755
|
+
this._modelingWrapper.updateModdleProperties(element, zeebeSubscription, propertiesToSet);
|
|
125756
|
+
} else {
|
|
125757
|
+
// create new Subscription
|
|
125758
|
+
const newSubscription = createElement$1('zeebe:Subscription', propertiesToSet, message, this._bpmnFactory);
|
|
125759
|
+
this._modelingWrapper.updateModdleProperties(element, messageExtensionElements, {
|
|
125760
|
+
values: [...messageExtensionElements.get('values'), newSubscription]
|
|
125761
|
+
});
|
|
125762
|
+
}
|
|
125763
|
+
|
|
125764
|
+
// Remove old properties
|
|
125765
|
+
if (!oldTemplate || !zeebeSubscription) {
|
|
125766
|
+
return;
|
|
125767
|
+
}
|
|
125768
|
+
const propertiesToRemove = removedProperties.reduce((properties, removedProperty) => {
|
|
125769
|
+
properties[removedProperty.binding.name] = undefined;
|
|
125770
|
+
return properties;
|
|
125771
|
+
}, {});
|
|
125772
|
+
this._modelingWrapper.updateModdleProperties(element, zeebeSubscription, propertiesToRemove);
|
|
126022
125773
|
}
|
|
126023
125774
|
_updateZeebeModelerTemplateOnReferencedElement(element, oldTemplate, newTemplate) {
|
|
126024
125775
|
const businessObject = getBusinessObject$2(element);
|
|
@@ -126029,39 +125780,41 @@
|
|
|
126029
125780
|
if (getTemplateId$1(message) === newTemplate.id) {
|
|
126030
125781
|
return;
|
|
126031
125782
|
}
|
|
126032
|
-
this.
|
|
125783
|
+
this._modelingWrapper.updateModdleProperties(element, message, {
|
|
126033
125784
|
'zeebe:modelerTemplate': newTemplate.id
|
|
126034
125785
|
});
|
|
126035
125786
|
}
|
|
126036
|
-
|
|
125787
|
+
_getSubscription(element, bo) {
|
|
126037
125788
|
const extensionElements = this._getOrCreateExtensionElements(element, bo);
|
|
126038
|
-
const extension = findExtension$1(extensionElements,
|
|
125789
|
+
const extension = findExtension$1(extensionElements, 'zeebe:Subscription');
|
|
126039
125790
|
if (extension) {
|
|
126040
125791
|
return extension;
|
|
126041
125792
|
}
|
|
126042
|
-
const newExtension = createElement$1(type, {}, bo, this._bpmnFactory);
|
|
126043
|
-
this._modeling.updateModdleProperties(element, extensionElements, {
|
|
126044
|
-
values: [...extensionElements.get('values'), newExtension]
|
|
126045
|
-
});
|
|
126046
|
-
return newExtension;
|
|
126047
125793
|
}
|
|
126048
125794
|
_getOrCreateMessage(element, template) {
|
|
125795
|
+
return this._getMessage(element) || this._createMessage(element, template);
|
|
125796
|
+
}
|
|
125797
|
+
_createMessage(element, template) {
|
|
126049
125798
|
let bo = getBusinessObject$2(element);
|
|
126050
125799
|
if (is$6(bo, 'bpmn:Event')) {
|
|
126051
125800
|
bo = bo.get('eventDefinitions')[0];
|
|
126052
125801
|
}
|
|
126053
|
-
|
|
126054
|
-
|
|
126055
|
-
|
|
126056
|
-
|
|
126057
|
-
|
|
126058
|
-
message
|
|
126059
|
-
|
|
126060
|
-
messageRef: message
|
|
126061
|
-
});
|
|
126062
|
-
}
|
|
125802
|
+
const message = this._bpmnFactory.create('bpmn:Message', {
|
|
125803
|
+
'zeebe:modelerTemplate': template.id
|
|
125804
|
+
});
|
|
125805
|
+
message.$parent = getRoot(bo);
|
|
125806
|
+
this._modelingWrapper.updateModdleProperties(element, bo, {
|
|
125807
|
+
messageRef: message
|
|
125808
|
+
});
|
|
126063
125809
|
return message;
|
|
126064
125810
|
}
|
|
125811
|
+
_getMessage(element) {
|
|
125812
|
+
let bo = getBusinessObject$2(element);
|
|
125813
|
+
if (is$6(bo, 'bpmn:Event')) {
|
|
125814
|
+
bo = bo.get('eventDefinitions')[0];
|
|
125815
|
+
}
|
|
125816
|
+
return bo && bo.get('messageRef');
|
|
125817
|
+
}
|
|
126065
125818
|
|
|
126066
125819
|
/**
|
|
126067
125820
|
* Replaces the element with the specified elementType.
|
|
@@ -126070,12 +125823,18 @@
|
|
|
126070
125823
|
* @param {djs.model.Base} element
|
|
126071
125824
|
* @param {Object} newTemplate
|
|
126072
125825
|
*/
|
|
126073
|
-
_updateElementType(element, newTemplate) {
|
|
125826
|
+
_updateElementType(element, oldTemplate, newTemplate) {
|
|
126074
125827
|
// determine new task type
|
|
126075
125828
|
const newType = newTemplate.elementType;
|
|
126076
125829
|
if (!newType) {
|
|
126077
125830
|
return element;
|
|
126078
125831
|
}
|
|
125832
|
+
const oldType = oldTemplate && oldTemplate.elementType;
|
|
125833
|
+
|
|
125834
|
+
// Do not replace if the element type did not change
|
|
125835
|
+
if (oldType && oldType.value === newType.value && oldType.eventDefinition === newType.eventDefinition) {
|
|
125836
|
+
return element;
|
|
125837
|
+
}
|
|
126079
125838
|
const replacement = {
|
|
126080
125839
|
type: newType.value
|
|
126081
125840
|
};
|
|
@@ -126086,7 +125845,7 @@
|
|
|
126086
125845
|
return replacedElement;
|
|
126087
125846
|
}
|
|
126088
125847
|
};
|
|
126089
|
-
ChangeElementTemplateHandler$1.$inject = ['bpmnFactory', 'bpmnReplace', 'commandStack', '
|
|
125848
|
+
ChangeElementTemplateHandler$1.$inject = ['bpmnFactory', 'bpmnReplace', 'commandStack', 'injector'];
|
|
126090
125849
|
|
|
126091
125850
|
// helpers //////////
|
|
126092
125851
|
|
|
@@ -126285,6 +126044,9 @@
|
|
|
126285
126044
|
}
|
|
126286
126045
|
function getPropertyValue(element, property) {
|
|
126287
126046
|
const businessObject = getBusinessObject$2(element);
|
|
126047
|
+
if (!businessObject) {
|
|
126048
|
+
return;
|
|
126049
|
+
}
|
|
126288
126050
|
const binding = property.binding,
|
|
126289
126051
|
bindingName = binding.name,
|
|
126290
126052
|
bindingType = binding.type;
|
|
@@ -126321,6 +126083,9 @@
|
|
|
126321
126083
|
array.splice(index, 1);
|
|
126322
126084
|
return array;
|
|
126323
126085
|
}
|
|
126086
|
+
function hasMessageProperties(template) {
|
|
126087
|
+
return template.properties.some(p => MESSAGE_BINDING_TYPES.includes(p.binding.type));
|
|
126088
|
+
}
|
|
126324
126089
|
|
|
126325
126090
|
class RemoveElementTemplateHandler {
|
|
126326
126091
|
constructor(modeling, elementFactory, elementRegistry, canvas, bpmnFactory, replace, commandStack) {
|
|
@@ -148547,7 +148312,6 @@
|
|
|
148547
148312
|
Modeler.prototype._camundaCloudModules = [
|
|
148548
148313
|
...commonModules,
|
|
148549
148314
|
behaviorsModule,
|
|
148550
|
-
rulesModule,
|
|
148551
148315
|
index$1$2,
|
|
148552
148316
|
index$1$1,
|
|
148553
148317
|
index$1,
|