camunda-bpmn-js 5.1.0 → 5.2.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/assets/diagram-js.css +1 -1
- package/dist/base-modeler.development.js +63 -16
- package/dist/base-modeler.production.min.js +5 -5
- package/dist/base-navigated-viewer.development.js +9 -2
- package/dist/base-navigated-viewer.production.min.js +1 -1
- package/dist/base-viewer.development.js +1 -1
- package/dist/base-viewer.production.min.js +1 -1
- package/dist/camunda-cloud-modeler.development.js +1487 -1423
- package/dist/camunda-cloud-modeler.production.min.js +5 -5
- package/dist/camunda-cloud-navigated-viewer.development.js +9 -2
- package/dist/camunda-cloud-navigated-viewer.production.min.js +1 -1
- package/dist/camunda-cloud-viewer.development.js +1 -1
- package/dist/camunda-cloud-viewer.production.min.js +1 -1
- package/dist/camunda-platform-modeler.development.js +1064 -1017
- package/dist/camunda-platform-modeler.production.min.js +5 -5
- package/dist/camunda-platform-navigated-viewer.development.js +9 -2
- package/dist/camunda-platform-navigated-viewer.production.min.js +1 -1
- package/dist/camunda-platform-viewer.development.js +1 -1
- package/dist/camunda-platform-viewer.production.min.js +1 -1
- package/package.json +5 -5
|
@@ -2755,7 +2755,7 @@
|
|
|
2755
2755
|
* @return {string}
|
|
2756
2756
|
*/
|
|
2757
2757
|
function componentsToPath(elements) {
|
|
2758
|
-
return elements.flat().join(',').replace(/,?([A-z]),?/g, '$1');
|
|
2758
|
+
return elements.flat().join(',').replace(/,?([A-Za-z]),?/g, '$1');
|
|
2759
2759
|
}
|
|
2760
2760
|
|
|
2761
2761
|
/**
|
|
@@ -25387,7 +25387,7 @@
|
|
|
25387
25387
|
* `keyboard.bind=true|false` configuration option.
|
|
25388
25388
|
*
|
|
25389
25389
|
* @param {Object} config
|
|
25390
|
-
* @param {
|
|
25390
|
+
* @param {boolean} [config.bind]
|
|
25391
25391
|
* @param {EventBus} eventBus
|
|
25392
25392
|
*/
|
|
25393
25393
|
function Keyboard(config, eventBus) {
|
|
@@ -25463,10 +25463,17 @@
|
|
|
25463
25463
|
/**
|
|
25464
25464
|
* Bind keyboard events to the given DOM node.
|
|
25465
25465
|
*
|
|
25466
|
+
* @overlord
|
|
25467
|
+
* @deprecated No longer in use since version 15.0.0.
|
|
25468
|
+
*
|
|
25466
25469
|
* @param {EventTarget} node
|
|
25467
25470
|
*/
|
|
25471
|
+
/**
|
|
25472
|
+
* Bind keyboard events to the canvas node.
|
|
25473
|
+
*/
|
|
25468
25474
|
Keyboard.prototype.bind = function(node) {
|
|
25469
25475
|
|
|
25476
|
+
// legacy <node> argument provided
|
|
25470
25477
|
if (node) {
|
|
25471
25478
|
console.error('unsupported argument <node>', new Error(compatMessage));
|
|
25472
25479
|
}
|
|
@@ -27770,7 +27777,7 @@
|
|
|
27770
27777
|
return originalEntries;
|
|
27771
27778
|
}
|
|
27772
27779
|
|
|
27773
|
-
if (!value) {
|
|
27780
|
+
if (!value.trim()) {
|
|
27774
27781
|
return originalEntries.filter(({ rank = 0 }) => rank >= 0);
|
|
27775
27782
|
}
|
|
27776
27783
|
|
|
@@ -28647,6 +28654,12 @@
|
|
|
28647
28654
|
keys
|
|
28648
28655
|
} = options;
|
|
28649
28656
|
|
|
28657
|
+
pattern = pattern.trim().toLowerCase();
|
|
28658
|
+
|
|
28659
|
+
if (!pattern) {
|
|
28660
|
+
throw new Error('<pattern> must not be empty');
|
|
28661
|
+
}
|
|
28662
|
+
|
|
28650
28663
|
const words = pattern.trim().toLowerCase().split(/\s+/);
|
|
28651
28664
|
|
|
28652
28665
|
return items.flatMap((item) => {
|
|
@@ -28774,22 +28787,33 @@
|
|
|
28774
28787
|
}
|
|
28775
28788
|
|
|
28776
28789
|
/**
|
|
28777
|
-
* Score a token
|
|
28790
|
+
* Score a token based on its characteristics
|
|
28791
|
+
* and the length of the matched content.
|
|
28778
28792
|
*
|
|
28779
28793
|
* @param { Token } token
|
|
28780
28794
|
*
|
|
28781
28795
|
* @returns { number }
|
|
28782
28796
|
*/
|
|
28783
28797
|
function scoreToken(token) {
|
|
28798
|
+
const modifier = Math.log(token.value.length);
|
|
28799
|
+
|
|
28784
28800
|
if (!token.match) {
|
|
28785
|
-
return 0;
|
|
28801
|
+
return -0.07 * modifier;
|
|
28786
28802
|
}
|
|
28787
28803
|
|
|
28788
|
-
return
|
|
28789
|
-
|
|
28790
|
-
|
|
28791
|
-
|
|
28792
|
-
|
|
28804
|
+
return (
|
|
28805
|
+
token.start
|
|
28806
|
+
? (
|
|
28807
|
+
token.end
|
|
28808
|
+
? 131.9
|
|
28809
|
+
: 7.87
|
|
28810
|
+
)
|
|
28811
|
+
: (
|
|
28812
|
+
token.wordStart
|
|
28813
|
+
? 2.19
|
|
28814
|
+
: 1
|
|
28815
|
+
)
|
|
28816
|
+
) * modifier;
|
|
28793
28817
|
}
|
|
28794
28818
|
|
|
28795
28819
|
/**
|
|
@@ -28828,7 +28852,12 @@
|
|
|
28828
28852
|
const tokens = [];
|
|
28829
28853
|
const matchedWords = {};
|
|
28830
28854
|
|
|
28831
|
-
const
|
|
28855
|
+
const wordsEscaped = words.map(escapeRegexp);
|
|
28856
|
+
|
|
28857
|
+
const regexpString = [
|
|
28858
|
+
`(?<all>${wordsEscaped.join('\\s+')})`,
|
|
28859
|
+
...wordsEscaped
|
|
28860
|
+
].join('|');
|
|
28832
28861
|
|
|
28833
28862
|
const regexp = new RegExp(regexpString, 'ig');
|
|
28834
28863
|
|
|
@@ -28839,6 +28868,17 @@
|
|
|
28839
28868
|
|
|
28840
28869
|
const [ value ] = match;
|
|
28841
28870
|
|
|
28871
|
+
const startIndex = match.index;
|
|
28872
|
+
const endIndex = match.index + value.length;
|
|
28873
|
+
|
|
28874
|
+
const start = startIndex === 0;
|
|
28875
|
+
const end = endIndex === string.length;
|
|
28876
|
+
|
|
28877
|
+
const all = !!match.groups.all;
|
|
28878
|
+
|
|
28879
|
+
const wordStart = start || /\s/.test(string.charAt(startIndex - 1));
|
|
28880
|
+
const wordEnd = end || /\s/.test(string.charAt(endIndex + 1));
|
|
28881
|
+
|
|
28842
28882
|
if (match.index > lastIndex) {
|
|
28843
28883
|
|
|
28844
28884
|
// add previous token (NO match)
|
|
@@ -28853,11 +28893,18 @@
|
|
|
28853
28893
|
value,
|
|
28854
28894
|
index: match.index,
|
|
28855
28895
|
match: true,
|
|
28856
|
-
wordStart
|
|
28857
|
-
|
|
28896
|
+
wordStart,
|
|
28897
|
+
wordEnd,
|
|
28898
|
+
start,
|
|
28899
|
+
end,
|
|
28900
|
+
all
|
|
28858
28901
|
});
|
|
28859
28902
|
|
|
28860
|
-
|
|
28903
|
+
const newMatchedWords = all ? words : [ value ];
|
|
28904
|
+
|
|
28905
|
+
for (const word of newMatchedWords) {
|
|
28906
|
+
matchedWords[word.toLowerCase()] = true;
|
|
28907
|
+
}
|
|
28861
28908
|
|
|
28862
28909
|
lastIndex = match.index + value.length;
|
|
28863
28910
|
}
|
|
@@ -65058,7 +65105,7 @@
|
|
|
65058
65105
|
this._clearResults();
|
|
65059
65106
|
|
|
65060
65107
|
// do not search on empty query
|
|
65061
|
-
if (!pattern
|
|
65108
|
+
if (!pattern.trim()) {
|
|
65062
65109
|
return;
|
|
65063
65110
|
}
|
|
65064
65111
|
|
|
@@ -104358,7 +104405,7 @@
|
|
|
104358
104405
|
this._tooltipConfig = tooltipConfig;
|
|
104359
104406
|
this._feelPopupContainer = feelPopupContainer;
|
|
104360
104407
|
this._getFeelPopupLinks = getFeelPopupLinks;
|
|
104361
|
-
this._container = domify$1('<div style="height: 100%" class="bio-properties-panel-container"></div>');
|
|
104408
|
+
this._container = domify$1('<div style="height: 100%" tabindex="-1" class="bio-properties-panel-container"></div>');
|
|
104362
104409
|
var commandStack = injector.get('commandStack', false);
|
|
104363
104410
|
commandStack && setupKeyboard(this._container, eventBus, commandStack);
|
|
104364
104411
|
eventBus.on('diagram.init', () => {
|
|
@@ -115970,1035 +116017,1035 @@
|
|
|
115970
116017
|
Modeler$1.prototype._extensionModules
|
|
115971
116018
|
);
|
|
115972
116019
|
|
|
115973
|
-
const WILDCARD = '*';
|
|
115974
|
-
|
|
115975
|
-
|
|
115976
|
-
class CopyPasteBehavior {
|
|
115977
|
-
constructor(eventBus) {
|
|
115978
|
-
eventBus.on('moddleCopy.canCopyProperty', (context) => {
|
|
115979
|
-
const {
|
|
115980
|
-
parent,
|
|
115981
|
-
property
|
|
115982
|
-
} = context;
|
|
115983
|
-
|
|
115984
|
-
return this.canCopyProperty(property, parent);
|
|
115985
|
-
});
|
|
115986
|
-
}
|
|
115987
|
-
|
|
115988
|
-
/**
|
|
115989
|
-
* Check wether to disallow copying property.
|
|
115990
|
-
*/
|
|
115991
|
-
canCopyProperty(property, parent) {
|
|
115992
|
-
|
|
115993
|
-
// (1) check wether property is allowed in parent
|
|
115994
|
-
if (isObject$1(property) && !isAllowedInParent(property, parent)) {
|
|
115995
|
-
|
|
115996
|
-
return false;
|
|
115997
|
-
}
|
|
115998
|
-
|
|
115999
|
-
// (2) check more complex scenarios
|
|
116000
|
-
if (is$5(property, 'camunda:InputOutput') && !this.canHostInputOutput(parent)) {
|
|
116001
|
-
return false;
|
|
116002
|
-
}
|
|
116003
|
-
|
|
116004
|
-
if (isAny$1(property, [ 'camunda:Connector', 'camunda:Field' ]) && !this.canHostConnector(parent)) {
|
|
116005
|
-
return false;
|
|
116006
|
-
}
|
|
116007
|
-
|
|
116008
|
-
if (is$5(property, 'camunda:In') && !this.canHostIn(parent)) {
|
|
116009
|
-
return false;
|
|
116010
|
-
}
|
|
116011
|
-
}
|
|
116012
|
-
|
|
116013
|
-
canHostInputOutput(parent) {
|
|
116014
|
-
|
|
116015
|
-
// allowed in camunda:Connector
|
|
116016
|
-
const connector = getParent(parent, 'camunda:Connector');
|
|
116017
|
-
|
|
116018
|
-
if (connector) {
|
|
116019
|
-
return true;
|
|
116020
|
-
}
|
|
116021
|
-
|
|
116022
|
-
// special rules inside bpmn:FlowNode
|
|
116023
|
-
const flowNode = getParent(parent, 'bpmn:FlowNode');
|
|
116024
|
-
|
|
116025
|
-
if (!flowNode) {
|
|
116026
|
-
return false;
|
|
116027
|
-
}
|
|
116028
|
-
|
|
116029
|
-
if (isAny$1(flowNode, [ 'bpmn:StartEvent', 'bpmn:Gateway', 'bpmn:BoundaryEvent' ])) {
|
|
116030
|
-
return false;
|
|
116031
|
-
}
|
|
116032
|
-
|
|
116033
|
-
if (is$5(flowNode, 'bpmn:SubProcess') && flowNode.get('triggeredByEvent')) {
|
|
116034
|
-
return false;
|
|
116035
|
-
}
|
|
116036
|
-
|
|
116037
|
-
return true;
|
|
116038
|
-
}
|
|
116039
|
-
|
|
116040
|
-
canHostConnector(parent) {
|
|
116041
|
-
const serviceTaskLike = getParent(parent, 'camunda:ServiceTaskLike');
|
|
116042
|
-
|
|
116043
|
-
if (is$5(serviceTaskLike, 'bpmn:MessageEventDefinition')) {
|
|
116044
|
-
|
|
116045
|
-
// only allow on throw and end events
|
|
116046
|
-
return (
|
|
116047
|
-
getParent(parent, 'bpmn:IntermediateThrowEvent')
|
|
116048
|
-
|| getParent(parent, 'bpmn:EndEvent')
|
|
116049
|
-
);
|
|
116050
|
-
}
|
|
116051
|
-
|
|
116052
|
-
return true;
|
|
116053
|
-
}
|
|
116054
|
-
|
|
116055
|
-
canHostIn(parent) {
|
|
116056
|
-
const callActivity = getParent(parent, 'bpmn:CallActivity');
|
|
116057
|
-
|
|
116058
|
-
if (callActivity) {
|
|
116059
|
-
return true;
|
|
116060
|
-
}
|
|
116061
|
-
|
|
116062
|
-
const signalEventDefinition = getParent(parent, 'bpmn:SignalEventDefinition');
|
|
116063
|
-
|
|
116064
|
-
if (signalEventDefinition) {
|
|
116065
|
-
|
|
116066
|
-
// only allow on throw and end events
|
|
116067
|
-
return (
|
|
116068
|
-
getParent(parent, 'bpmn:IntermediateThrowEvent')
|
|
116069
|
-
|| getParent(parent, 'bpmn:EndEvent')
|
|
116070
|
-
);
|
|
116071
|
-
}
|
|
116072
|
-
|
|
116073
|
-
return true;
|
|
116074
|
-
}
|
|
116075
|
-
}
|
|
116076
|
-
|
|
116077
|
-
CopyPasteBehavior.$inject = [ 'eventBus' ];
|
|
116078
|
-
|
|
116079
|
-
|
|
116080
|
-
// helpers //////////
|
|
116081
|
-
|
|
116082
|
-
function getParent(element, type) {
|
|
116083
|
-
if (!type) {
|
|
116084
|
-
return element.$parent;
|
|
116085
|
-
}
|
|
116086
|
-
|
|
116087
|
-
if (is$5(element, type)) {
|
|
116088
|
-
return element;
|
|
116089
|
-
}
|
|
116090
|
-
|
|
116091
|
-
if (!element.$parent) {
|
|
116092
|
-
return;
|
|
116093
|
-
}
|
|
116094
|
-
|
|
116095
|
-
return getParent(element.$parent, type);
|
|
116096
|
-
}
|
|
116097
|
-
|
|
116098
|
-
function isAllowedInParent(property, parent) {
|
|
116099
|
-
|
|
116100
|
-
// (1) find property descriptor
|
|
116101
|
-
var descriptor = property.$type && property.$model.getTypeDescriptor(property.$type);
|
|
116102
|
-
|
|
116103
|
-
var allowedIn = descriptor && descriptor.meta && descriptor.meta.allowedIn;
|
|
116104
|
-
|
|
116105
|
-
if (!allowedIn || isWildcard(allowedIn)) {
|
|
116106
|
-
return true;
|
|
116107
|
-
}
|
|
116108
|
-
|
|
116109
|
-
// (2) check wether property has parent of allowed type
|
|
116110
|
-
return some$1(allowedIn, function(type) {
|
|
116111
|
-
return getParent(parent, type);
|
|
116112
|
-
});
|
|
116113
|
-
}
|
|
116114
|
-
|
|
116115
|
-
function isWildcard(allowedIn) {
|
|
116116
|
-
return allowedIn.includes(WILDCARD);
|
|
116117
|
-
}
|
|
116118
|
-
|
|
116119
|
-
const LOW_PRIORITY$3 = 500;
|
|
116120
|
-
|
|
116121
|
-
|
|
116122
|
-
/**
|
|
116123
|
-
* Add referenced root elements (bpmn:Error) if they don't exist.
|
|
116124
|
-
* Copy referenced root elements on copy & paste.
|
|
116125
|
-
*/
|
|
116126
|
-
class CopyPasteRootElementBehavior extends CommandInterceptor$1 {
|
|
116127
|
-
constructor(bpmnFactory, bpmnjs, eventBus, moddleCopy) {
|
|
116128
|
-
super(eventBus);
|
|
116129
|
-
|
|
116130
|
-
function hasRootElement(rootElement) {
|
|
116131
|
-
const definitions = bpmnjs.getDefinitions(),
|
|
116132
|
-
rootElements = definitions.get('rootElements');
|
|
116133
|
-
|
|
116134
|
-
return !!find$2(rootElements, matchPattern({ id: rootElement.get('id') }));
|
|
116135
|
-
}
|
|
116136
|
-
|
|
116137
|
-
// create shape
|
|
116138
|
-
this.executed('shape.create', (context) => {
|
|
116139
|
-
const { shape } = context;
|
|
116140
|
-
|
|
116141
|
-
const businessObject = getBusinessObject$1(shape);
|
|
116142
|
-
|
|
116143
|
-
if (!canHaveNestedRootElementReference(businessObject)) {
|
|
116144
|
-
return;
|
|
116145
|
-
}
|
|
116146
|
-
|
|
116147
|
-
const referencedRootElements = getRootElements(businessObject, getReferencingElement(shape)),
|
|
116148
|
-
rootElements = bpmnjs.getDefinitions().get('rootElements');
|
|
116149
|
-
|
|
116150
|
-
context.addedRootElements = [];
|
|
116151
|
-
|
|
116152
|
-
referencedRootElements.forEach((reference) => {
|
|
116153
|
-
const { referencedElement } = reference;
|
|
116154
|
-
|
|
116155
|
-
if (referencedElement && !hasRootElement(referencedElement)) {
|
|
116156
|
-
|
|
116157
|
-
// add root element
|
|
116158
|
-
add$2(rootElements, referencedElement);
|
|
116159
|
-
|
|
116160
|
-
context.addedRootElements.push(referencedElement);
|
|
116161
|
-
}
|
|
116162
|
-
});
|
|
116163
|
-
}, true);
|
|
116164
|
-
|
|
116165
|
-
this.reverted('shape.create', (context) => {
|
|
116166
|
-
const { addedRootElements } = context;
|
|
116167
|
-
|
|
116168
|
-
if (!addedRootElements) {
|
|
116169
|
-
return;
|
|
116170
|
-
}
|
|
116171
|
-
|
|
116172
|
-
const rootElements = bpmnjs.getDefinitions().get('rootElements');
|
|
116173
|
-
|
|
116174
|
-
// remove root elements
|
|
116175
|
-
addedRootElements.forEach((addedRootElement) => {
|
|
116176
|
-
remove$2(rootElements, addedRootElement);
|
|
116177
|
-
});
|
|
116178
|
-
}, true);
|
|
116179
|
-
|
|
116180
|
-
eventBus.on('copyPaste.copyElement', function(context) {
|
|
116181
|
-
const {
|
|
116182
|
-
descriptor,
|
|
116183
|
-
element
|
|
116184
|
-
} = context;
|
|
116185
|
-
|
|
116186
|
-
const businessObject = getBusinessObject$1(element);
|
|
116187
|
-
|
|
116188
|
-
if (element.labelTarget || !canHaveNestedRootElementReference(businessObject)) {
|
|
116189
|
-
return;
|
|
116190
|
-
}
|
|
116191
|
-
|
|
116192
|
-
const rootElements = getRootElements(businessObject, getReferencingElement(element));
|
|
116193
|
-
|
|
116194
|
-
if (rootElements) {
|
|
116195
|
-
descriptor.referencedRootElements = rootElements;
|
|
116196
|
-
}
|
|
116197
|
-
});
|
|
116198
|
-
|
|
116199
|
-
eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$3, (context) => {
|
|
116200
|
-
const { descriptor } = context;
|
|
116201
|
-
|
|
116202
|
-
const {
|
|
116203
|
-
businessObject,
|
|
116204
|
-
referencedRootElements
|
|
116205
|
-
} = descriptor;
|
|
116206
|
-
|
|
116207
|
-
if (!referencedRootElements) {
|
|
116208
|
-
return;
|
|
116209
|
-
}
|
|
116210
|
-
|
|
116211
|
-
referencedRootElements.forEach((reference) => {
|
|
116212
|
-
let {
|
|
116213
|
-
idx,
|
|
116214
|
-
referencedElement
|
|
116215
|
-
} = reference;
|
|
116216
|
-
|
|
116217
|
-
if (!referencedElement) {
|
|
116218
|
-
return;
|
|
116219
|
-
}
|
|
116220
|
-
|
|
116221
|
-
if (!hasRootElement(referencedElement)) {
|
|
116222
|
-
referencedElement = moddleCopy.copyElement(
|
|
116223
|
-
referencedElement,
|
|
116224
|
-
bpmnFactory.create(referencedElement.$type)
|
|
116225
|
-
);
|
|
116226
|
-
}
|
|
116227
|
-
|
|
116228
|
-
setRootElement(businessObject, referencedElement, idx);
|
|
116229
|
-
});
|
|
116230
|
-
|
|
116231
|
-
delete descriptor.referencedRootElements;
|
|
116232
|
-
});
|
|
116233
|
-
}
|
|
116234
|
-
}
|
|
116235
|
-
|
|
116236
|
-
CopyPasteRootElementBehavior.$inject = [
|
|
116237
|
-
'bpmnFactory',
|
|
116238
|
-
'bpmnjs',
|
|
116239
|
-
'eventBus',
|
|
116240
|
-
'moddleCopy'
|
|
116241
|
-
];
|
|
116242
|
-
|
|
116243
|
-
|
|
116244
|
-
// helpers //////////
|
|
116245
|
-
|
|
116246
|
-
function getReferencingElement(element) {
|
|
116247
|
-
if (is$5(element, 'bpmn:ServiceTask')) {
|
|
116248
|
-
return 'camunda:ErrorEventDefinition';
|
|
116249
|
-
}
|
|
116250
|
-
}
|
|
116251
|
-
|
|
116252
|
-
function getRootElementReferencePropertyName(bo) {
|
|
116253
|
-
if (is$5(bo, 'camunda:ErrorEventDefinition')) {
|
|
116254
|
-
return 'errorRef';
|
|
116255
|
-
}
|
|
116256
|
-
}
|
|
116257
|
-
|
|
116258
|
-
function canHaveNestedRootElementReference(businessObject) {
|
|
116259
|
-
return is$5(businessObject, 'bpmn:ServiceTask') && businessObject.get('type') === 'external';
|
|
116260
|
-
}
|
|
116261
|
-
|
|
116262
|
-
/**
|
|
116263
|
-
* Retrieves a list of to-be copied references for the extension elements
|
|
116264
|
-
* of a given element in the following form.
|
|
116265
|
-
*
|
|
116266
|
-
* [
|
|
116267
|
-
* {
|
|
116268
|
-
* idx: 0, // position of extension in the list of extension elements
|
|
116269
|
-
* referencedElement: {ModdleElement} // reference to root element
|
|
116270
|
-
* }
|
|
116271
|
-
* ]
|
|
116272
|
-
*
|
|
116273
|
-
*
|
|
116274
|
-
* @param {ModdleElement} businessObject
|
|
116275
|
-
* @param {String} extensionElementType
|
|
116276
|
-
*
|
|
116277
|
-
* @returns {Array}
|
|
116278
|
-
*/
|
|
116279
|
-
function getRootElements(businessObject, extensionElementType) {
|
|
116280
|
-
const extensionElements = businessObject.get('extensionElements');
|
|
116281
|
-
|
|
116282
|
-
if (!extensionElements) {
|
|
116283
|
-
return [];
|
|
116284
|
-
}
|
|
116285
|
-
|
|
116286
|
-
return extensionElements
|
|
116287
|
-
.get('values')
|
|
116288
|
-
.filter((element) => is$5(element, extensionElementType))
|
|
116289
|
-
.reduce((result, element) => {
|
|
116290
|
-
const referencedElement = element.get(getRootElementReferencePropertyName(element));
|
|
116291
|
-
|
|
116292
|
-
if (referencedElement) {
|
|
116293
|
-
result.push({
|
|
116294
|
-
idx: getExtensionElementId(businessObject, element),
|
|
116295
|
-
referencedElement
|
|
116296
|
-
});
|
|
116297
|
-
}
|
|
116298
|
-
|
|
116299
|
-
return result;
|
|
116300
|
-
}, []);
|
|
116301
|
-
}
|
|
116302
|
-
|
|
116303
|
-
function setRootElement(businessObject, rootElement, index) {
|
|
116304
|
-
const extensionElement = businessObject.get('extensionElements').get('values')[ index ];
|
|
116305
|
-
|
|
116306
|
-
extensionElement.set(getRootElementReferencePropertyName(extensionElement), rootElement);
|
|
116307
|
-
}
|
|
116308
|
-
|
|
116309
|
-
function getExtensionElementId(businessObject, extensionElement) {
|
|
116310
|
-
const extensionElements = businessObject.get('extensionElements');
|
|
116311
|
-
|
|
116312
|
-
if (!extensionElements) {
|
|
116313
|
-
return -1;
|
|
116314
|
-
}
|
|
116315
|
-
|
|
116316
|
-
return extensionElements.get('values').indexOf(extensionElement);
|
|
116317
|
-
}
|
|
116318
|
-
|
|
116319
|
-
/**
|
|
116320
|
-
* Get extension elements of business object. Optionally filter by type.
|
|
116321
|
-
*
|
|
116322
|
-
* @param {djs.model.Base|ModdleElement} element
|
|
116323
|
-
* @param {String} [type=undefined]
|
|
116324
|
-
* @returns {Array<ModdleElement>}
|
|
116325
|
-
*/
|
|
116326
|
-
function getExtensionElementsList(element, type = undefined) {
|
|
116327
|
-
const businessObject = getBusinessObject$1(element),
|
|
116328
|
-
extensionElements = businessObject.get('extensionElements');
|
|
116329
|
-
|
|
116330
|
-
if (!extensionElements) {
|
|
116331
|
-
return [];
|
|
116332
|
-
}
|
|
116333
|
-
|
|
116334
|
-
const values = extensionElements.get('values');
|
|
116335
|
-
|
|
116336
|
-
if (!values || !values.length) {
|
|
116337
|
-
return [];
|
|
116338
|
-
}
|
|
116339
|
-
|
|
116340
|
-
if (type) {
|
|
116341
|
-
return values.filter(value => is$5(value, type));
|
|
116342
|
-
}
|
|
116343
|
-
|
|
116344
|
-
return values;
|
|
116345
|
-
}
|
|
116346
|
-
|
|
116347
|
-
/**
|
|
116348
|
-
* Remove one or more extension elements. Remove bpmn:ExtensionElements afterwards if it's empty.
|
|
116349
|
-
*
|
|
116350
|
-
* @param {ModdleElement} element
|
|
116351
|
-
* @param {ModdleElement} businessObject
|
|
116352
|
-
* @param {ModdleElement|Array<ModdleElement>} extensionElementsToRemove
|
|
116353
|
-
* @param {CommandStack} commandStack
|
|
116354
|
-
*/
|
|
116355
|
-
function removeExtensionElements(element, businessObject, extensionElementsToRemove, commandStack) {
|
|
116356
|
-
if (!isArray$4(extensionElementsToRemove)) {
|
|
116357
|
-
extensionElementsToRemove = [ extensionElementsToRemove ];
|
|
116358
|
-
}
|
|
116359
|
-
|
|
116360
|
-
const extensionElements = businessObject.get('extensionElements'),
|
|
116361
|
-
values = extensionElements.get('values').filter(value => !extensionElementsToRemove.includes(value));
|
|
116362
|
-
|
|
116363
|
-
commandStack.execute('element.updateModdleProperties', {
|
|
116364
|
-
element,
|
|
116365
|
-
moddleElement: extensionElements,
|
|
116366
|
-
properties: {
|
|
116367
|
-
values
|
|
116368
|
-
}
|
|
116369
|
-
});
|
|
116370
|
-
}
|
|
116371
|
-
|
|
116372
|
-
const HIGH_PRIORITY$3 = 5000;
|
|
116373
|
-
|
|
116374
|
-
|
|
116375
|
-
/**
|
|
116376
|
-
* Camunda BPMN specific behavior ensuring camunda:ErrorEventDefinition extension elements are removed
|
|
116377
|
-
* if type of e.g. bpmn:ServiceTask is set to something other than external.
|
|
116378
|
-
*/
|
|
116379
|
-
class DeleteErrorEventDefinitionBehavior extends CommandInterceptor$1 {
|
|
116380
|
-
constructor(commandStack, eventBus) {
|
|
116381
|
-
super(eventBus);
|
|
116382
|
-
|
|
116383
|
-
this.postExecute([
|
|
116384
|
-
'element.updateProperties',
|
|
116385
|
-
'element.updateModdleProperties'
|
|
116386
|
-
], HIGH_PRIORITY$3, function(context) {
|
|
116387
|
-
const {
|
|
116388
|
-
element,
|
|
116389
|
-
moddleElement,
|
|
116390
|
-
properties
|
|
116391
|
-
} = context;
|
|
116392
|
-
|
|
116393
|
-
const businessObject = moddleElement || getBusinessObject$1(element);
|
|
116394
|
-
|
|
116395
|
-
if (is$5(element, 'camunda:ExternalCapable')
|
|
116396
|
-
&& is$5(businessObject, 'camunda:ExternalCapable')
|
|
116397
|
-
&& properties[ 'camunda:type' ] !== 'external'
|
|
116398
|
-
) {
|
|
116399
|
-
const errorEventDefinitions = getExtensionElementsList(businessObject, 'camunda:ErrorEventDefinition');
|
|
116400
|
-
|
|
116401
|
-
if (errorEventDefinitions.length) {
|
|
116402
|
-
removeExtensionElements(element, businessObject, errorEventDefinitions, commandStack);
|
|
116403
|
-
}
|
|
116404
|
-
}
|
|
116405
|
-
}, true);
|
|
116406
|
-
|
|
116407
|
-
}
|
|
116020
|
+
const WILDCARD = '*';
|
|
116021
|
+
|
|
116022
|
+
|
|
116023
|
+
class CopyPasteBehavior {
|
|
116024
|
+
constructor(eventBus) {
|
|
116025
|
+
eventBus.on('moddleCopy.canCopyProperty', (context) => {
|
|
116026
|
+
const {
|
|
116027
|
+
parent,
|
|
116028
|
+
property
|
|
116029
|
+
} = context;
|
|
116030
|
+
|
|
116031
|
+
return this.canCopyProperty(property, parent);
|
|
116032
|
+
});
|
|
116033
|
+
}
|
|
116034
|
+
|
|
116035
|
+
/**
|
|
116036
|
+
* Check wether to disallow copying property.
|
|
116037
|
+
*/
|
|
116038
|
+
canCopyProperty(property, parent) {
|
|
116039
|
+
|
|
116040
|
+
// (1) check wether property is allowed in parent
|
|
116041
|
+
if (isObject$1(property) && !isAllowedInParent(property, parent)) {
|
|
116042
|
+
|
|
116043
|
+
return false;
|
|
116044
|
+
}
|
|
116045
|
+
|
|
116046
|
+
// (2) check more complex scenarios
|
|
116047
|
+
if (is$5(property, 'camunda:InputOutput') && !this.canHostInputOutput(parent)) {
|
|
116048
|
+
return false;
|
|
116049
|
+
}
|
|
116050
|
+
|
|
116051
|
+
if (isAny$1(property, [ 'camunda:Connector', 'camunda:Field' ]) && !this.canHostConnector(parent)) {
|
|
116052
|
+
return false;
|
|
116053
|
+
}
|
|
116054
|
+
|
|
116055
|
+
if (is$5(property, 'camunda:In') && !this.canHostIn(parent)) {
|
|
116056
|
+
return false;
|
|
116057
|
+
}
|
|
116058
|
+
}
|
|
116059
|
+
|
|
116060
|
+
canHostInputOutput(parent) {
|
|
116061
|
+
|
|
116062
|
+
// allowed in camunda:Connector
|
|
116063
|
+
const connector = getParent(parent, 'camunda:Connector');
|
|
116064
|
+
|
|
116065
|
+
if (connector) {
|
|
116066
|
+
return true;
|
|
116067
|
+
}
|
|
116068
|
+
|
|
116069
|
+
// special rules inside bpmn:FlowNode
|
|
116070
|
+
const flowNode = getParent(parent, 'bpmn:FlowNode');
|
|
116071
|
+
|
|
116072
|
+
if (!flowNode) {
|
|
116073
|
+
return false;
|
|
116074
|
+
}
|
|
116075
|
+
|
|
116076
|
+
if (isAny$1(flowNode, [ 'bpmn:StartEvent', 'bpmn:Gateway', 'bpmn:BoundaryEvent' ])) {
|
|
116077
|
+
return false;
|
|
116078
|
+
}
|
|
116079
|
+
|
|
116080
|
+
if (is$5(flowNode, 'bpmn:SubProcess') && flowNode.get('triggeredByEvent')) {
|
|
116081
|
+
return false;
|
|
116082
|
+
}
|
|
116083
|
+
|
|
116084
|
+
return true;
|
|
116085
|
+
}
|
|
116086
|
+
|
|
116087
|
+
canHostConnector(parent) {
|
|
116088
|
+
const serviceTaskLike = getParent(parent, 'camunda:ServiceTaskLike');
|
|
116089
|
+
|
|
116090
|
+
if (is$5(serviceTaskLike, 'bpmn:MessageEventDefinition')) {
|
|
116091
|
+
|
|
116092
|
+
// only allow on throw and end events
|
|
116093
|
+
return (
|
|
116094
|
+
getParent(parent, 'bpmn:IntermediateThrowEvent')
|
|
116095
|
+
|| getParent(parent, 'bpmn:EndEvent')
|
|
116096
|
+
);
|
|
116097
|
+
}
|
|
116098
|
+
|
|
116099
|
+
return true;
|
|
116100
|
+
}
|
|
116101
|
+
|
|
116102
|
+
canHostIn(parent) {
|
|
116103
|
+
const callActivity = getParent(parent, 'bpmn:CallActivity');
|
|
116104
|
+
|
|
116105
|
+
if (callActivity) {
|
|
116106
|
+
return true;
|
|
116107
|
+
}
|
|
116108
|
+
|
|
116109
|
+
const signalEventDefinition = getParent(parent, 'bpmn:SignalEventDefinition');
|
|
116110
|
+
|
|
116111
|
+
if (signalEventDefinition) {
|
|
116112
|
+
|
|
116113
|
+
// only allow on throw and end events
|
|
116114
|
+
return (
|
|
116115
|
+
getParent(parent, 'bpmn:IntermediateThrowEvent')
|
|
116116
|
+
|| getParent(parent, 'bpmn:EndEvent')
|
|
116117
|
+
);
|
|
116118
|
+
}
|
|
116119
|
+
|
|
116120
|
+
return true;
|
|
116121
|
+
}
|
|
116122
|
+
}
|
|
116123
|
+
|
|
116124
|
+
CopyPasteBehavior.$inject = [ 'eventBus' ];
|
|
116125
|
+
|
|
116126
|
+
|
|
116127
|
+
// helpers //////////
|
|
116128
|
+
|
|
116129
|
+
function getParent(element, type) {
|
|
116130
|
+
if (!type) {
|
|
116131
|
+
return element.$parent;
|
|
116132
|
+
}
|
|
116133
|
+
|
|
116134
|
+
if (is$5(element, type)) {
|
|
116135
|
+
return element;
|
|
116136
|
+
}
|
|
116137
|
+
|
|
116138
|
+
if (!element.$parent) {
|
|
116139
|
+
return;
|
|
116140
|
+
}
|
|
116141
|
+
|
|
116142
|
+
return getParent(element.$parent, type);
|
|
116143
|
+
}
|
|
116144
|
+
|
|
116145
|
+
function isAllowedInParent(property, parent) {
|
|
116146
|
+
|
|
116147
|
+
// (1) find property descriptor
|
|
116148
|
+
var descriptor = property.$type && property.$model.getTypeDescriptor(property.$type);
|
|
116149
|
+
|
|
116150
|
+
var allowedIn = descriptor && descriptor.meta && descriptor.meta.allowedIn;
|
|
116151
|
+
|
|
116152
|
+
if (!allowedIn || isWildcard(allowedIn)) {
|
|
116153
|
+
return true;
|
|
116154
|
+
}
|
|
116155
|
+
|
|
116156
|
+
// (2) check wether property has parent of allowed type
|
|
116157
|
+
return some$1(allowedIn, function(type) {
|
|
116158
|
+
return getParent(parent, type);
|
|
116159
|
+
});
|
|
116160
|
+
}
|
|
116161
|
+
|
|
116162
|
+
function isWildcard(allowedIn) {
|
|
116163
|
+
return allowedIn.includes(WILDCARD);
|
|
116408
116164
|
}
|
|
116409
116165
|
|
|
116410
|
-
|
|
116411
|
-
|
|
116412
|
-
|
|
116413
|
-
|
|
116414
|
-
|
|
116415
|
-
|
|
116416
|
-
|
|
116417
|
-
|
|
116418
|
-
|
|
116419
|
-
|
|
116420
|
-
|
|
116421
|
-
|
|
116422
|
-
|
|
116423
|
-
|
|
116424
|
-
|
|
116425
|
-
|
|
116426
|
-
|
|
116427
|
-
|
|
116428
|
-
|
|
116429
|
-
|
|
116430
|
-
|
|
116431
|
-
|
|
116432
|
-
|
|
116433
|
-
|
|
116434
|
-
|
|
116435
|
-
|
|
116436
|
-
|
|
116437
|
-
|
|
116438
|
-
|
|
116439
|
-
|
|
116440
|
-
|
|
116441
|
-
|
|
116442
|
-
|
|
116443
|
-
|
|
116444
|
-
|
|
116445
|
-
|
|
116446
|
-
|
|
116447
|
-
|
|
116448
|
-
|
|
116166
|
+
const LOW_PRIORITY$3 = 500;
|
|
116167
|
+
|
|
116168
|
+
|
|
116169
|
+
/**
|
|
116170
|
+
* Add referenced root elements (bpmn:Error) if they don't exist.
|
|
116171
|
+
* Copy referenced root elements on copy & paste.
|
|
116172
|
+
*/
|
|
116173
|
+
class CopyPasteRootElementBehavior extends CommandInterceptor$1 {
|
|
116174
|
+
constructor(bpmnFactory, bpmnjs, eventBus, moddleCopy) {
|
|
116175
|
+
super(eventBus);
|
|
116176
|
+
|
|
116177
|
+
function hasRootElement(rootElement) {
|
|
116178
|
+
const definitions = bpmnjs.getDefinitions(),
|
|
116179
|
+
rootElements = definitions.get('rootElements');
|
|
116180
|
+
|
|
116181
|
+
return !!find$2(rootElements, matchPattern({ id: rootElement.get('id') }));
|
|
116182
|
+
}
|
|
116183
|
+
|
|
116184
|
+
// create shape
|
|
116185
|
+
this.executed('shape.create', (context) => {
|
|
116186
|
+
const { shape } = context;
|
|
116187
|
+
|
|
116188
|
+
const businessObject = getBusinessObject$1(shape);
|
|
116189
|
+
|
|
116190
|
+
if (!canHaveNestedRootElementReference(businessObject)) {
|
|
116191
|
+
return;
|
|
116192
|
+
}
|
|
116193
|
+
|
|
116194
|
+
const referencedRootElements = getRootElements(businessObject, getReferencingElement(shape)),
|
|
116195
|
+
rootElements = bpmnjs.getDefinitions().get('rootElements');
|
|
116196
|
+
|
|
116197
|
+
context.addedRootElements = [];
|
|
116198
|
+
|
|
116199
|
+
referencedRootElements.forEach((reference) => {
|
|
116200
|
+
const { referencedElement } = reference;
|
|
116201
|
+
|
|
116202
|
+
if (referencedElement && !hasRootElement(referencedElement)) {
|
|
116203
|
+
|
|
116204
|
+
// add root element
|
|
116205
|
+
add$2(rootElements, referencedElement);
|
|
116206
|
+
|
|
116207
|
+
context.addedRootElements.push(referencedElement);
|
|
116208
|
+
}
|
|
116209
|
+
});
|
|
116210
|
+
}, true);
|
|
116211
|
+
|
|
116212
|
+
this.reverted('shape.create', (context) => {
|
|
116213
|
+
const { addedRootElements } = context;
|
|
116214
|
+
|
|
116215
|
+
if (!addedRootElements) {
|
|
116216
|
+
return;
|
|
116217
|
+
}
|
|
116218
|
+
|
|
116219
|
+
const rootElements = bpmnjs.getDefinitions().get('rootElements');
|
|
116220
|
+
|
|
116221
|
+
// remove root elements
|
|
116222
|
+
addedRootElements.forEach((addedRootElement) => {
|
|
116223
|
+
remove$2(rootElements, addedRootElement);
|
|
116224
|
+
});
|
|
116225
|
+
}, true);
|
|
116226
|
+
|
|
116227
|
+
eventBus.on('copyPaste.copyElement', function(context) {
|
|
116228
|
+
const {
|
|
116229
|
+
descriptor,
|
|
116230
|
+
element
|
|
116231
|
+
} = context;
|
|
116232
|
+
|
|
116233
|
+
const businessObject = getBusinessObject$1(element);
|
|
116234
|
+
|
|
116235
|
+
if (element.labelTarget || !canHaveNestedRootElementReference(businessObject)) {
|
|
116236
|
+
return;
|
|
116237
|
+
}
|
|
116238
|
+
|
|
116239
|
+
const rootElements = getRootElements(businessObject, getReferencingElement(element));
|
|
116240
|
+
|
|
116241
|
+
if (rootElements) {
|
|
116242
|
+
descriptor.referencedRootElements = rootElements;
|
|
116243
|
+
}
|
|
116244
|
+
});
|
|
116245
|
+
|
|
116246
|
+
eventBus.on('copyPaste.pasteElement', LOW_PRIORITY$3, (context) => {
|
|
116247
|
+
const { descriptor } = context;
|
|
116248
|
+
|
|
116249
|
+
const {
|
|
116250
|
+
businessObject,
|
|
116251
|
+
referencedRootElements
|
|
116252
|
+
} = descriptor;
|
|
116253
|
+
|
|
116254
|
+
if (!referencedRootElements) {
|
|
116255
|
+
return;
|
|
116256
|
+
}
|
|
116257
|
+
|
|
116258
|
+
referencedRootElements.forEach((reference) => {
|
|
116259
|
+
let {
|
|
116260
|
+
idx,
|
|
116261
|
+
referencedElement
|
|
116262
|
+
} = reference;
|
|
116263
|
+
|
|
116264
|
+
if (!referencedElement) {
|
|
116265
|
+
return;
|
|
116266
|
+
}
|
|
116267
|
+
|
|
116268
|
+
if (!hasRootElement(referencedElement)) {
|
|
116269
|
+
referencedElement = moddleCopy.copyElement(
|
|
116270
|
+
referencedElement,
|
|
116271
|
+
bpmnFactory.create(referencedElement.$type)
|
|
116272
|
+
);
|
|
116273
|
+
}
|
|
116274
|
+
|
|
116275
|
+
setRootElement(businessObject, referencedElement, idx);
|
|
116276
|
+
});
|
|
116277
|
+
|
|
116278
|
+
delete descriptor.referencedRootElements;
|
|
116279
|
+
});
|
|
116280
|
+
}
|
|
116281
|
+
}
|
|
116282
|
+
|
|
116283
|
+
CopyPasteRootElementBehavior.$inject = [
|
|
116284
|
+
'bpmnFactory',
|
|
116285
|
+
'bpmnjs',
|
|
116286
|
+
'eventBus',
|
|
116287
|
+
'moddleCopy'
|
|
116288
|
+
];
|
|
116289
|
+
|
|
116290
|
+
|
|
116291
|
+
// helpers //////////
|
|
116292
|
+
|
|
116293
|
+
function getReferencingElement(element) {
|
|
116294
|
+
if (is$5(element, 'bpmn:ServiceTask')) {
|
|
116295
|
+
return 'camunda:ErrorEventDefinition';
|
|
116296
|
+
}
|
|
116297
|
+
}
|
|
116298
|
+
|
|
116299
|
+
function getRootElementReferencePropertyName(bo) {
|
|
116300
|
+
if (is$5(bo, 'camunda:ErrorEventDefinition')) {
|
|
116301
|
+
return 'errorRef';
|
|
116302
|
+
}
|
|
116303
|
+
}
|
|
116304
|
+
|
|
116305
|
+
function canHaveNestedRootElementReference(businessObject) {
|
|
116306
|
+
return is$5(businessObject, 'bpmn:ServiceTask') && businessObject.get('type') === 'external';
|
|
116307
|
+
}
|
|
116308
|
+
|
|
116309
|
+
/**
|
|
116310
|
+
* Retrieves a list of to-be copied references for the extension elements
|
|
116311
|
+
* of a given element in the following form.
|
|
116312
|
+
*
|
|
116313
|
+
* [
|
|
116314
|
+
* {
|
|
116315
|
+
* idx: 0, // position of extension in the list of extension elements
|
|
116316
|
+
* referencedElement: {ModdleElement} // reference to root element
|
|
116317
|
+
* }
|
|
116318
|
+
* ]
|
|
116319
|
+
*
|
|
116320
|
+
*
|
|
116321
|
+
* @param {ModdleElement} businessObject
|
|
116322
|
+
* @param {String} extensionElementType
|
|
116323
|
+
*
|
|
116324
|
+
* @returns {Array}
|
|
116325
|
+
*/
|
|
116326
|
+
function getRootElements(businessObject, extensionElementType) {
|
|
116327
|
+
const extensionElements = businessObject.get('extensionElements');
|
|
116328
|
+
|
|
116329
|
+
if (!extensionElements) {
|
|
116330
|
+
return [];
|
|
116331
|
+
}
|
|
116332
|
+
|
|
116333
|
+
return extensionElements
|
|
116334
|
+
.get('values')
|
|
116335
|
+
.filter((element) => is$5(element, extensionElementType))
|
|
116336
|
+
.reduce((result, element) => {
|
|
116337
|
+
const referencedElement = element.get(getRootElementReferencePropertyName(element));
|
|
116338
|
+
|
|
116339
|
+
if (referencedElement) {
|
|
116340
|
+
result.push({
|
|
116341
|
+
idx: getExtensionElementId(businessObject, element),
|
|
116342
|
+
referencedElement
|
|
116343
|
+
});
|
|
116344
|
+
}
|
|
116345
|
+
|
|
116346
|
+
return result;
|
|
116347
|
+
}, []);
|
|
116348
|
+
}
|
|
116349
|
+
|
|
116350
|
+
function setRootElement(businessObject, rootElement, index) {
|
|
116351
|
+
const extensionElement = businessObject.get('extensionElements').get('values')[ index ];
|
|
116352
|
+
|
|
116353
|
+
extensionElement.set(getRootElementReferencePropertyName(extensionElement), rootElement);
|
|
116354
|
+
}
|
|
116355
|
+
|
|
116356
|
+
function getExtensionElementId(businessObject, extensionElement) {
|
|
116357
|
+
const extensionElements = businessObject.get('extensionElements');
|
|
116358
|
+
|
|
116359
|
+
if (!extensionElements) {
|
|
116360
|
+
return -1;
|
|
116361
|
+
}
|
|
116362
|
+
|
|
116363
|
+
return extensionElements.get('values').indexOf(extensionElement);
|
|
116449
116364
|
}
|
|
116450
116365
|
|
|
116451
|
-
|
|
116452
|
-
|
|
116453
|
-
|
|
116454
|
-
|
|
116455
|
-
]
|
|
116456
|
-
|
|
116457
|
-
|
|
116458
|
-
|
|
116459
|
-
|
|
116460
|
-
|
|
116461
|
-
|
|
116462
|
-
|
|
116463
|
-
|
|
116464
|
-
|
|
116465
|
-
|
|
116466
|
-
|
|
116467
|
-
|
|
116468
|
-
|
|
116469
|
-
|
|
116470
|
-
|
|
116471
|
-
|
|
116472
|
-
|
|
116473
|
-
|
|
116474
|
-
|
|
116475
|
-
|
|
116476
|
-
|
|
116477
|
-
|
|
116478
|
-
|
|
116479
|
-
|
|
116480
|
-
|
|
116481
|
-
|
|
116482
|
-
|
|
116483
|
-
|
|
116484
|
-
|
|
116485
|
-
|
|
116486
|
-
|
|
116487
|
-
|
|
116488
|
-
|
|
116489
|
-
|
|
116490
|
-
|
|
116491
|
-
|
|
116492
|
-
|
|
116493
|
-
|
|
116494
|
-
|
|
116495
|
-
|
|
116496
|
-
|
|
116497
|
-
|
|
116498
|
-
|
|
116499
|
-
|
|
116500
|
-
|
|
116501
|
-
}
|
|
116366
|
+
/**
|
|
116367
|
+
* Get extension elements of business object. Optionally filter by type.
|
|
116368
|
+
*
|
|
116369
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
116370
|
+
* @param {String} [type=undefined]
|
|
116371
|
+
* @returns {Array<ModdleElement>}
|
|
116372
|
+
*/
|
|
116373
|
+
function getExtensionElementsList(element, type = undefined) {
|
|
116374
|
+
const businessObject = getBusinessObject$1(element),
|
|
116375
|
+
extensionElements = businessObject.get('extensionElements');
|
|
116376
|
+
|
|
116377
|
+
if (!extensionElements) {
|
|
116378
|
+
return [];
|
|
116379
|
+
}
|
|
116380
|
+
|
|
116381
|
+
const values = extensionElements.get('values');
|
|
116382
|
+
|
|
116383
|
+
if (!values || !values.length) {
|
|
116384
|
+
return [];
|
|
116385
|
+
}
|
|
116386
|
+
|
|
116387
|
+
if (type) {
|
|
116388
|
+
return values.filter(value => is$5(value, type));
|
|
116389
|
+
}
|
|
116390
|
+
|
|
116391
|
+
return values;
|
|
116392
|
+
}
|
|
116393
|
+
|
|
116394
|
+
/**
|
|
116395
|
+
* Remove one or more extension elements. Remove bpmn:ExtensionElements afterwards if it's empty.
|
|
116396
|
+
*
|
|
116397
|
+
* @param {ModdleElement} element
|
|
116398
|
+
* @param {ModdleElement} businessObject
|
|
116399
|
+
* @param {ModdleElement|Array<ModdleElement>} extensionElementsToRemove
|
|
116400
|
+
* @param {CommandStack} commandStack
|
|
116401
|
+
*/
|
|
116402
|
+
function removeExtensionElements(element, businessObject, extensionElementsToRemove, commandStack) {
|
|
116403
|
+
if (!isArray$4(extensionElementsToRemove)) {
|
|
116404
|
+
extensionElementsToRemove = [ extensionElementsToRemove ];
|
|
116405
|
+
}
|
|
116406
|
+
|
|
116407
|
+
const extensionElements = businessObject.get('extensionElements'),
|
|
116408
|
+
values = extensionElements.get('values').filter(value => !extensionElementsToRemove.includes(value));
|
|
116409
|
+
|
|
116410
|
+
commandStack.execute('element.updateModdleProperties', {
|
|
116411
|
+
element,
|
|
116412
|
+
moddleElement: extensionElements,
|
|
116413
|
+
properties: {
|
|
116414
|
+
values
|
|
116415
|
+
}
|
|
116416
|
+
});
|
|
116502
116417
|
}
|
|
116503
116418
|
|
|
116504
|
-
|
|
116505
|
-
|
|
116506
|
-
|
|
116419
|
+
const HIGH_PRIORITY$3 = 5000;
|
|
116420
|
+
|
|
116421
|
+
|
|
116422
|
+
/**
|
|
116423
|
+
* Camunda BPMN specific behavior ensuring camunda:ErrorEventDefinition extension elements are removed
|
|
116424
|
+
* if type of e.g. bpmn:ServiceTask is set to something other than external.
|
|
116425
|
+
*/
|
|
116426
|
+
class DeleteErrorEventDefinitionBehavior extends CommandInterceptor$1 {
|
|
116427
|
+
constructor(commandStack, eventBus) {
|
|
116428
|
+
super(eventBus);
|
|
116429
|
+
|
|
116430
|
+
this.postExecute([
|
|
116431
|
+
'element.updateProperties',
|
|
116432
|
+
'element.updateModdleProperties'
|
|
116433
|
+
], HIGH_PRIORITY$3, function(context) {
|
|
116434
|
+
const {
|
|
116435
|
+
element,
|
|
116436
|
+
moddleElement,
|
|
116437
|
+
properties
|
|
116438
|
+
} = context;
|
|
116439
|
+
|
|
116440
|
+
const businessObject = moddleElement || getBusinessObject$1(element);
|
|
116441
|
+
|
|
116442
|
+
if (is$5(element, 'camunda:ExternalCapable')
|
|
116443
|
+
&& is$5(businessObject, 'camunda:ExternalCapable')
|
|
116444
|
+
&& properties[ 'camunda:type' ] !== 'external'
|
|
116445
|
+
) {
|
|
116446
|
+
const errorEventDefinitions = getExtensionElementsList(businessObject, 'camunda:ErrorEventDefinition');
|
|
116447
|
+
|
|
116448
|
+
if (errorEventDefinitions.length) {
|
|
116449
|
+
removeExtensionElements(element, businessObject, errorEventDefinitions, commandStack);
|
|
116450
|
+
}
|
|
116451
|
+
}
|
|
116452
|
+
}, true);
|
|
116453
|
+
|
|
116454
|
+
}
|
|
116455
|
+
}
|
|
116456
|
+
|
|
116457
|
+
DeleteErrorEventDefinitionBehavior.$inject = [
|
|
116458
|
+
'commandStack',
|
|
116459
|
+
'eventBus'
|
|
116507
116460
|
];
|
|
116508
116461
|
|
|
116509
|
-
|
|
116510
|
-
|
|
116511
|
-
|
|
116512
|
-
|
|
116513
|
-
|
|
116514
|
-
|
|
116515
|
-
|
|
116516
|
-
|
|
116517
|
-
|
|
116518
|
-
|
|
116519
|
-
|
|
116520
|
-
|
|
116521
|
-
|
|
116522
|
-
|
|
116523
|
-
|
|
116524
|
-
|
|
116525
|
-
|
|
116526
|
-
|
|
116527
|
-
|
|
116528
|
-
|
|
116529
|
-
|
|
116530
|
-
|
|
116531
|
-
|
|
116532
|
-
|
|
116533
|
-
|
|
116534
|
-
|
|
116535
|
-
|
|
116536
|
-
|
|
116537
|
-
|
|
116538
|
-
|
|
116539
|
-
|
|
116540
|
-
|
|
116541
|
-
|
|
116542
|
-
|
|
116543
|
-
|
|
116544
|
-
|
|
116545
|
-
|
|
116546
|
-
|
|
116547
|
-
|
|
116548
|
-
|
|
116549
|
-
|
|
116550
|
-
this.postExecuted([ 'shape.create','shape.move' ], (context) => {
|
|
116551
|
-
const {
|
|
116552
|
-
shape,
|
|
116553
|
-
parent,
|
|
116554
|
-
newParent = parent
|
|
116555
|
-
} = context;
|
|
116556
|
-
|
|
116557
|
-
const businessObject = getBusinessObject$1(shape);
|
|
116558
|
-
|
|
116559
|
-
if (is$5(shape, 'bpmn:StartEvent') && isDefined(businessObject.get('camunda:initiator'))) {
|
|
116560
|
-
if ((is$5(newParent || parent, 'bpmn:SubProcess'))) {
|
|
116561
|
-
modeling.updateProperties(shape, { 'camunda:initiator': undefined });
|
|
116562
|
-
}
|
|
116563
|
-
}
|
|
116564
|
-
}, true);
|
|
116565
|
-
}
|
|
116566
|
-
}
|
|
116567
|
-
|
|
116568
|
-
RemoveInitiatorBehaviour.$inject = [
|
|
116569
|
-
'eventBus',
|
|
116570
|
-
'modeling'
|
|
116462
|
+
const LOW_PRIORITY$2 = 250;
|
|
116463
|
+
|
|
116464
|
+
/**
|
|
116465
|
+
* Camunda-specific behavior ensuring `isExecutable` is kept after deleting
|
|
116466
|
+
* the last participant.
|
|
116467
|
+
*/
|
|
116468
|
+
class DeleteParticipantBehaviour extends CommandInterceptor$1 {
|
|
116469
|
+
constructor(eventBus, canvas, modeling) {
|
|
116470
|
+
super(eventBus);
|
|
116471
|
+
|
|
116472
|
+
this.postExecuted('shape.delete', LOW_PRIORITY$2, function(context) {
|
|
116473
|
+
const {
|
|
116474
|
+
collaborationRoot,
|
|
116475
|
+
shape
|
|
116476
|
+
} = context;
|
|
116477
|
+
|
|
116478
|
+
const newRoot = canvas.getRootElement();
|
|
116479
|
+
|
|
116480
|
+
if (is$5(shape, 'bpmn:Participant') &&
|
|
116481
|
+
collaborationRoot &&
|
|
116482
|
+
!collaborationRoot.businessObject.get('participants').length &&
|
|
116483
|
+
is$5(newRoot, 'bpmn:Process')) {
|
|
116484
|
+
|
|
116485
|
+
const oldProcessBusinessObject = shape.businessObject.get('processRef');
|
|
116486
|
+
|
|
116487
|
+
if (!oldProcessBusinessObject) {
|
|
116488
|
+
return;
|
|
116489
|
+
}
|
|
116490
|
+
|
|
116491
|
+
modeling.updateProperties(newRoot, { isExecutable: oldProcessBusinessObject.get('isExecutable') });
|
|
116492
|
+
}
|
|
116493
|
+
|
|
116494
|
+
}, true);
|
|
116495
|
+
}
|
|
116496
|
+
}
|
|
116497
|
+
|
|
116498
|
+
DeleteParticipantBehaviour.$inject = [
|
|
116499
|
+
'eventBus',
|
|
116500
|
+
'canvas',
|
|
116501
|
+
'modeling'
|
|
116571
116502
|
];
|
|
116572
116503
|
|
|
116573
|
-
|
|
116574
|
-
|
|
116575
|
-
|
|
116576
|
-
|
|
116577
|
-
|
|
116578
|
-
|
|
116579
|
-
|
|
116580
|
-
|
|
116581
|
-
|
|
116582
|
-
|
|
116583
|
-
|
|
116584
|
-
|
|
116585
|
-
|
|
116586
|
-
|
|
116587
|
-
|
|
116588
|
-
|
|
116589
|
-
|
|
116590
|
-
|
|
116591
|
-
|
|
116592
|
-
|
|
116593
|
-
|
|
116594
|
-
|
|
116595
|
-
|
|
116596
|
-
|
|
116597
|
-
|
|
116598
|
-
|
|
116599
|
-
|
|
116600
|
-
|
|
116601
|
-
|
|
116602
|
-
|
|
116603
|
-
|
|
116604
|
-
|
|
116605
|
-
|
|
116606
|
-
|
|
116607
|
-
|
|
116608
|
-
|
|
116609
|
-
|
|
116610
|
-
|
|
116611
|
-
|
|
116612
|
-
|
|
116613
|
-
|
|
116614
|
-
|
|
116615
|
-
|
|
116616
|
-
|
|
116617
|
-
|
|
116618
|
-
|
|
116619
|
-
|
|
116620
|
-
|
|
116621
|
-
|
|
116622
|
-
|
|
116623
|
-
|
|
116624
|
-
|
|
116625
|
-
|
|
116626
|
-
|
|
116627
|
-
|
|
116504
|
+
const HIGH_PRIORITY$2 = 5000;
|
|
116505
|
+
|
|
116506
|
+
|
|
116507
|
+
/**
|
|
116508
|
+
* Camunda BPMN specific behavior ensuring camunda:FailedJobRetryTimeCycle is
|
|
116509
|
+
* removed when both camunda:asyncAfter and camunda:asyncBefore set to false.
|
|
116510
|
+
* Doesn't apply if element has bpmn:TimerEventDefinition.
|
|
116511
|
+
*/
|
|
116512
|
+
class DeleteRetryTimeCycleBehavior extends CommandInterceptor$1 {
|
|
116513
|
+
constructor(commandStack, eventBus) {
|
|
116514
|
+
super(eventBus);
|
|
116515
|
+
|
|
116516
|
+
this.postExecute([
|
|
116517
|
+
'element.updateProperties',
|
|
116518
|
+
'element.updateModdleProperties'
|
|
116519
|
+
], HIGH_PRIORITY$2, function(context) {
|
|
116520
|
+
const {
|
|
116521
|
+
element,
|
|
116522
|
+
moddleElement,
|
|
116523
|
+
properties = {}
|
|
116524
|
+
} = context;
|
|
116525
|
+
|
|
116526
|
+
const asyncAfter = properties[ 'camunda:asyncAfter' ],
|
|
116527
|
+
asyncBefore = properties[ 'camunda:asyncBefore' ];
|
|
116528
|
+
|
|
116529
|
+
const businessObject = moddleElement || getBusinessObject$1(element);
|
|
116530
|
+
|
|
116531
|
+
const failedJobRetryTimeCycle = getFailedJobRetryTimeCycle(element);
|
|
116532
|
+
|
|
116533
|
+
if (
|
|
116534
|
+
!is$5(element, 'camunda:AsyncCapable')
|
|
116535
|
+
|| !is$5(businessObject, 'camunda:AsyncCapable')
|
|
116536
|
+
|| (asyncAfter !== false && asyncBefore !== false)
|
|
116537
|
+
|| !failedJobRetryTimeCycle
|
|
116538
|
+
|| getTimerEventDefinition(element)
|
|
116539
|
+
|| isAsyncBefore$1(businessObject)
|
|
116540
|
+
|| isAsyncAfter$1(businessObject)
|
|
116541
|
+
) {
|
|
116542
|
+
return;
|
|
116543
|
+
}
|
|
116544
|
+
|
|
116545
|
+
removeExtensionElements(element, businessObject, failedJobRetryTimeCycle, commandStack);
|
|
116546
|
+
}, true);
|
|
116547
|
+
|
|
116548
|
+
}
|
|
116549
|
+
}
|
|
116550
|
+
|
|
116551
|
+
DeleteRetryTimeCycleBehavior.$inject = [
|
|
116552
|
+
'commandStack',
|
|
116553
|
+
'eventBus'
|
|
116554
|
+
];
|
|
116555
|
+
|
|
116556
|
+
|
|
116557
|
+
// helpers //////////
|
|
116558
|
+
|
|
116559
|
+
function isAsyncBefore$1(businessObject) {
|
|
116560
|
+
return !!(businessObject.get('camunda:asyncBefore') || businessObject.get('camunda:async'));
|
|
116561
|
+
}
|
|
116562
|
+
|
|
116563
|
+
function isAsyncAfter$1(businessObject) {
|
|
116564
|
+
return !!businessObject.get('camunda:asyncAfter');
|
|
116565
|
+
}
|
|
116566
|
+
|
|
116567
|
+
function getFailedJobRetryTimeCycle(element) {
|
|
116568
|
+
return getExtensionElementsList(element, 'camunda:FailedJobRetryTimeCycle')[ 0 ];
|
|
116569
|
+
}
|
|
116570
|
+
|
|
116571
|
+
function getTimerEventDefinition(element) {
|
|
116572
|
+
return getEventDefinition$1(element, 'bpmn:TimerEventDefinition');
|
|
116573
|
+
}
|
|
116574
|
+
|
|
116575
|
+
function getEventDefinition$1(element, type) {
|
|
116576
|
+
const businessObject = getBusinessObject$1(element);
|
|
116577
|
+
|
|
116578
|
+
const eventDefinitions = businessObject.get('eventDefinitions');
|
|
116579
|
+
|
|
116580
|
+
if (!eventDefinitions || !eventDefinitions.length) {
|
|
116581
|
+
return;
|
|
116582
|
+
}
|
|
116583
|
+
|
|
116584
|
+
return eventDefinitions.find((eventDefinition) => {
|
|
116585
|
+
return is$5(eventDefinition, type);
|
|
116586
|
+
});
|
|
116628
116587
|
}
|
|
116629
116588
|
|
|
116630
|
-
|
|
116631
|
-
|
|
116632
|
-
|
|
116633
|
-
|
|
116634
|
-
|
|
116589
|
+
/**
|
|
116590
|
+
* Camunda BPMN specific behavior ensuring camunda:initiator property is removed
|
|
116591
|
+
* when start event is created in or moved to sub process.
|
|
116592
|
+
*/
|
|
116593
|
+
class RemoveInitiatorBehaviour extends CommandInterceptor$1 {
|
|
116594
|
+
constructor(eventBus, modeling) {
|
|
116595
|
+
super(eventBus);
|
|
116596
|
+
|
|
116597
|
+
this.postExecuted([ 'shape.create','shape.move' ], (context) => {
|
|
116598
|
+
const {
|
|
116599
|
+
shape,
|
|
116600
|
+
parent,
|
|
116601
|
+
newParent = parent
|
|
116602
|
+
} = context;
|
|
116603
|
+
|
|
116604
|
+
const businessObject = getBusinessObject$1(shape);
|
|
116605
|
+
|
|
116606
|
+
if (is$5(shape, 'bpmn:StartEvent') && isDefined(businessObject.get('camunda:initiator'))) {
|
|
116607
|
+
if ((is$5(newParent || parent, 'bpmn:SubProcess'))) {
|
|
116608
|
+
modeling.updateProperties(shape, { 'camunda:initiator': undefined });
|
|
116609
|
+
}
|
|
116610
|
+
}
|
|
116611
|
+
}, true);
|
|
116612
|
+
}
|
|
116613
|
+
}
|
|
116614
|
+
|
|
116615
|
+
RemoveInitiatorBehaviour.$inject = [
|
|
116616
|
+
'eventBus',
|
|
116617
|
+
'modeling'
|
|
116635
116618
|
];
|
|
116636
116619
|
|
|
116637
|
-
|
|
116638
|
-
|
|
116639
|
-
|
|
116640
|
-
|
|
116641
|
-
|
|
116642
|
-
|
|
116643
|
-
|
|
116644
|
-
|
|
116645
|
-
|
|
116646
|
-
|
|
116647
|
-
|
|
116648
|
-
|
|
116649
|
-
|
|
116650
|
-
|
|
116651
|
-
|
|
116652
|
-
const
|
|
116653
|
-
|
|
116654
|
-
|
|
116655
|
-
|
|
116656
|
-
|
|
116657
|
-
|
|
116658
|
-
|
|
116659
|
-
|
|
116660
|
-
|
|
116661
|
-
|
|
116662
|
-
|
|
116663
|
-
|
|
116664
|
-
|
|
116665
|
-
|
|
116666
|
-
|
|
116667
|
-
|
|
116668
|
-
|
|
116669
|
-
|
|
116670
|
-
|
|
116671
|
-
|
|
116672
|
-
|
|
116673
|
-
|
|
116674
|
-
|
|
116675
|
-
|
|
116676
|
-
|
|
116677
|
-
|
|
116678
|
-
|
|
116679
|
-
|
|
116680
|
-
|
|
116681
|
-
|
|
116620
|
+
/**
|
|
116621
|
+
* Camunda BPMN specific behavior ensuring camunda:variableEvents property is
|
|
116622
|
+
* removed when start event is moved out of event sub process.
|
|
116623
|
+
*/
|
|
116624
|
+
class RemoveVariableEventBehaviour extends CommandInterceptor$1 {
|
|
116625
|
+
constructor(bpmnFactory, eventBus, moddleCopy, modeling) {
|
|
116626
|
+
super(eventBus);
|
|
116627
|
+
|
|
116628
|
+
this.postExecuted([ 'shape.create', 'shape.move' ], (context) => {
|
|
116629
|
+
const {
|
|
116630
|
+
parent,
|
|
116631
|
+
newParent = parent,
|
|
116632
|
+
shape
|
|
116633
|
+
} = context;
|
|
116634
|
+
|
|
116635
|
+
const newParentBusinessObject = getBusinessObject$1(newParent),
|
|
116636
|
+
shapeBusinessObject = getBusinessObject$1(shape);
|
|
116637
|
+
|
|
116638
|
+
if (is$5(shape, 'bpmn:StartEvent')) {
|
|
116639
|
+
|
|
116640
|
+
if (!(is$5(newParent, 'bpmn:SubProcess') && newParentBusinessObject.get('triggeredByEvent'))) {
|
|
116641
|
+
const eventDefinitions = shapeBusinessObject.get('eventDefinitions').slice();
|
|
116642
|
+
|
|
116643
|
+
const update = eventDefinitions.reduce((update, eventDefinition, index) => {
|
|
116644
|
+
if (!is$5(eventDefinition, 'bpmn:ConditionalEventDefinition')) {
|
|
116645
|
+
return;
|
|
116646
|
+
}
|
|
116647
|
+
|
|
116648
|
+
if (eventDefinition.get('camunda:variableEvents')) {
|
|
116649
|
+
const conditionalEventDefinition = bpmnFactory.create('bpmn:ConditionalEventDefinition');
|
|
116650
|
+
|
|
116651
|
+
moddleCopy.copyElement(eventDefinition, conditionalEventDefinition);
|
|
116652
|
+
|
|
116653
|
+
conditionalEventDefinition.$parent = eventDefinition.$parent;
|
|
116654
|
+
|
|
116655
|
+
// remove camunda:variableEvents property
|
|
116656
|
+
conditionalEventDefinition.variableEvents = undefined;
|
|
116657
|
+
|
|
116658
|
+
eventDefinitions[ index ] = conditionalEventDefinition;
|
|
116659
|
+
|
|
116660
|
+
return true;
|
|
116661
|
+
}
|
|
116662
|
+
|
|
116663
|
+
return update;
|
|
116664
|
+
}, false);
|
|
116665
|
+
|
|
116666
|
+
if (update) {
|
|
116667
|
+
modeling.updateProperties(shape, {
|
|
116668
|
+
eventDefinitions: eventDefinitions
|
|
116669
|
+
});
|
|
116670
|
+
}
|
|
116671
|
+
}
|
|
116672
|
+
}
|
|
116673
|
+
}, true);
|
|
116674
|
+
}
|
|
116675
|
+
}
|
|
116676
|
+
|
|
116677
|
+
RemoveVariableEventBehaviour.$inject = [
|
|
116678
|
+
'bpmnFactory',
|
|
116679
|
+
'eventBus',
|
|
116680
|
+
'moddleCopy',
|
|
116681
|
+
'modeling'
|
|
116682
116682
|
];
|
|
116683
116683
|
|
|
116684
|
-
|
|
116685
|
-
|
|
116686
|
-
|
|
116687
|
-
|
|
116688
|
-
|
|
116689
|
-
|
|
116690
|
-
|
|
116691
|
-
|
|
116692
|
-
|
|
116693
|
-
|
|
116694
|
-
|
|
116695
|
-
|
|
116696
|
-
|
|
116697
|
-
|
|
116698
|
-
|
|
116699
|
-
|
|
116700
|
-
|
|
116701
|
-
|
|
116702
|
-
|
|
116703
|
-
|
|
116704
|
-
|
|
116705
|
-
|
|
116706
|
-
|
|
116707
|
-
|
|
116708
|
-
|
|
116709
|
-
|
|
116710
|
-
|
|
116711
|
-
|
|
116712
|
-
|
|
116713
|
-
|
|
116714
|
-
|
|
116715
|
-
|
|
116716
|
-
|
|
116717
|
-
|
|
116718
|
-
|
|
116719
|
-
|
|
116720
|
-
|
|
116721
|
-
|
|
116722
|
-
|
|
116723
|
-
|
|
116724
|
-
|
|
116725
|
-
|
|
116726
|
-
|
|
116727
|
-
|
|
116728
|
-
|
|
116729
|
-
|
|
116730
|
-
|
|
116731
|
-
|
|
116732
|
-
|
|
116733
|
-
|
|
116734
|
-
|
|
116735
|
-
|
|
116736
|
-
|
|
116737
|
-
|
|
116738
|
-
|
|
116684
|
+
const HIGH_PRIORITY$1 = 5000;
|
|
116685
|
+
|
|
116686
|
+
|
|
116687
|
+
/**
|
|
116688
|
+
* Camunda BPMN specific behavior ensuring camunda:exclusive is set to true if
|
|
116689
|
+
* camunda:asyncBefore or camunda:asyncAfter is set to false.
|
|
116690
|
+
*/
|
|
116691
|
+
class UpdateCamundaExclusiveBehavior extends CommandInterceptor$1 {
|
|
116692
|
+
constructor(eventBus) {
|
|
116693
|
+
super(eventBus);
|
|
116694
|
+
|
|
116695
|
+
this.preExecute([
|
|
116696
|
+
'element.updateProperties',
|
|
116697
|
+
'element.updateModdleProperties',
|
|
116698
|
+
], HIGH_PRIORITY$1, function(context) {
|
|
116699
|
+
const {
|
|
116700
|
+
element,
|
|
116701
|
+
moddleElement,
|
|
116702
|
+
properties = {}
|
|
116703
|
+
} = context;
|
|
116704
|
+
|
|
116705
|
+
const businessObject = moddleElement || getBusinessObject$1(element);
|
|
116706
|
+
|
|
116707
|
+
const asyncAfter = properties[ 'camunda:asyncAfter' ],
|
|
116708
|
+
asyncBefore = properties[ 'camunda:asyncBefore' ];
|
|
116709
|
+
|
|
116710
|
+
if (!is$5(element, 'camunda:AsyncCapable')
|
|
116711
|
+
|| !is$5(businessObject, 'camunda:AsyncCapable')
|
|
116712
|
+
|| (asyncAfter !== false && asyncBefore !== false)
|
|
116713
|
+
|| isExclusive(businessObject)
|
|
116714
|
+
|| (isAsyncAfter(businessObject) && asyncAfter !== false)
|
|
116715
|
+
|| (isAsyncBefore(businessObject) && asyncBefore !== false)
|
|
116716
|
+
|| (asyncAfter === true || asyncBefore === true)
|
|
116717
|
+
) {
|
|
116718
|
+
return;
|
|
116719
|
+
}
|
|
116720
|
+
|
|
116721
|
+
properties[ 'camunda:exclusive' ] = true;
|
|
116722
|
+
}, true);
|
|
116723
|
+
|
|
116724
|
+
}
|
|
116725
|
+
}
|
|
116726
|
+
|
|
116727
|
+
UpdateCamundaExclusiveBehavior.$inject = [
|
|
116728
|
+
'eventBus'
|
|
116729
|
+
];
|
|
116730
|
+
|
|
116731
|
+
|
|
116732
|
+
// helpers //////////
|
|
116733
|
+
|
|
116734
|
+
function isAsyncBefore(businessObject) {
|
|
116735
|
+
return !!(businessObject.get('camunda:asyncBefore') || businessObject.get('camunda:async'));
|
|
116736
|
+
}
|
|
116737
|
+
|
|
116738
|
+
function isAsyncAfter(businessObject) {
|
|
116739
|
+
return !!businessObject.get('camunda:asyncAfter');
|
|
116740
|
+
}
|
|
116741
|
+
|
|
116742
|
+
function isExclusive(businessObject) {
|
|
116743
|
+
return !!businessObject.get('camunda:exclusive');
|
|
116739
116744
|
}
|
|
116740
116745
|
|
|
116741
|
-
|
|
116742
|
-
'
|
|
116743
|
-
|
|
116744
|
-
|
|
116745
|
-
|
|
116746
|
-
|
|
116747
|
-
|
|
116748
|
-
|
|
116749
|
-
|
|
116750
|
-
|
|
116751
|
-
|
|
116752
|
-
|
|
116753
|
-
|
|
116754
|
-
constructor(eventBus) {
|
|
116755
|
-
super(eventBus);
|
|
116756
|
-
|
|
116757
|
-
this.preExecute([
|
|
116758
|
-
'element.updateProperties',
|
|
116759
|
-
'element.updateModdleProperties'
|
|
116760
|
-
], HIGH_PRIORITY, function(context) {
|
|
116761
|
-
const {
|
|
116762
|
-
element,
|
|
116763
|
-
moddleElement,
|
|
116764
|
-
properties
|
|
116765
|
-
} = context;
|
|
116766
|
-
|
|
116767
|
-
const businessObject = moddleElement || getBusinessObject$1(element);
|
|
116768
|
-
|
|
116769
|
-
if (
|
|
116770
|
-
is$5(element, 'camunda:DmnCapable')
|
|
116771
|
-
&& is$5(businessObject, 'camunda:DmnCapable')
|
|
116772
|
-
&& has$2(properties, 'camunda:resultVariable')
|
|
116773
|
-
&& isEmpty(properties[ 'camunda:resultVariable' ])
|
|
116774
|
-
) {
|
|
116775
|
-
properties[ 'camunda:mapDecisionResult' ] = undefined;
|
|
116776
|
-
}
|
|
116777
|
-
}, true);
|
|
116778
|
-
|
|
116779
|
-
}
|
|
116746
|
+
function getInputParameters$1(inputOutput) {
|
|
116747
|
+
return inputOutput.get('inputParameters');
|
|
116748
|
+
}
|
|
116749
|
+
|
|
116750
|
+
function getOutputParameters$1(inputOutput) {
|
|
116751
|
+
return inputOutput.get('outputParameters');
|
|
116752
|
+
}
|
|
116753
|
+
|
|
116754
|
+
function isInputOutputEmpty(inputOutput) {
|
|
116755
|
+
const inputParameters = getInputParameters$1(inputOutput);
|
|
116756
|
+
const outputParameters = getOutputParameters$1(inputOutput);
|
|
116757
|
+
|
|
116758
|
+
return !inputParameters.length && !outputParameters.length;
|
|
116780
116759
|
}
|
|
116781
116760
|
|
|
116782
|
-
|
|
116783
|
-
|
|
116761
|
+
const LOW_PRIORITY$1 = 250;
|
|
116762
|
+
|
|
116763
|
+
|
|
116764
|
+
/**
|
|
116765
|
+
* Camunda BPMN specific behavior ensuring empty camunda:InputOutput is removed.
|
|
116766
|
+
*/
|
|
116767
|
+
class UpdateInputOutputBehavior extends CommandInterceptor$1 {
|
|
116768
|
+
constructor(commandStack, eventBus) {
|
|
116769
|
+
super(eventBus);
|
|
116770
|
+
|
|
116771
|
+
this.postExecuted('element.updateModdleProperties', LOW_PRIORITY$1, function(context) {
|
|
116772
|
+
const {
|
|
116773
|
+
element,
|
|
116774
|
+
moddleElement
|
|
116775
|
+
} = context;
|
|
116776
|
+
|
|
116777
|
+
if (!is$5(moddleElement, 'camunda:InputOutput')) {
|
|
116778
|
+
return;
|
|
116779
|
+
}
|
|
116780
|
+
|
|
116781
|
+
if (isInputOutputEmpty(moddleElement)) {
|
|
116782
|
+
removeExtensionElements(element, getBusinessObject$1(element), moddleElement, commandStack);
|
|
116783
|
+
}
|
|
116784
|
+
}, true);
|
|
116785
|
+
}
|
|
116786
|
+
}
|
|
116787
|
+
|
|
116788
|
+
UpdateInputOutputBehavior.$inject = [
|
|
116789
|
+
'commandStack',
|
|
116790
|
+
'eventBus'
|
|
116784
116791
|
];
|
|
116785
116792
|
|
|
116786
|
-
|
|
116787
|
-
|
|
116788
|
-
|
|
116789
|
-
|
|
116793
|
+
const HIGH_PRIORITY = 5000;
|
|
116794
|
+
|
|
116795
|
+
|
|
116796
|
+
/**
|
|
116797
|
+
* Camunda BPMN specific camunda:resultVariable behavior ensuring
|
|
116798
|
+
* camunda:mapDecisionResult is removed when camunda:resultVariable is removed.
|
|
116799
|
+
*/
|
|
116800
|
+
class UpdateResultVariableBehavior extends CommandInterceptor$1 {
|
|
116801
|
+
constructor(eventBus) {
|
|
116802
|
+
super(eventBus);
|
|
116803
|
+
|
|
116804
|
+
this.preExecute([
|
|
116805
|
+
'element.updateProperties',
|
|
116806
|
+
'element.updateModdleProperties'
|
|
116807
|
+
], HIGH_PRIORITY, function(context) {
|
|
116808
|
+
const {
|
|
116809
|
+
element,
|
|
116810
|
+
moddleElement,
|
|
116811
|
+
properties
|
|
116812
|
+
} = context;
|
|
116813
|
+
|
|
116814
|
+
const businessObject = moddleElement || getBusinessObject$1(element);
|
|
116815
|
+
|
|
116816
|
+
if (
|
|
116817
|
+
is$5(element, 'camunda:DmnCapable')
|
|
116818
|
+
&& is$5(businessObject, 'camunda:DmnCapable')
|
|
116819
|
+
&& has$2(properties, 'camunda:resultVariable')
|
|
116820
|
+
&& isEmpty(properties[ 'camunda:resultVariable' ])
|
|
116821
|
+
) {
|
|
116822
|
+
properties[ 'camunda:mapDecisionResult' ] = undefined;
|
|
116823
|
+
}
|
|
116824
|
+
}, true);
|
|
116825
|
+
|
|
116826
|
+
}
|
|
116827
|
+
}
|
|
116828
|
+
|
|
116829
|
+
UpdateResultVariableBehavior.$inject = [
|
|
116830
|
+
'eventBus'
|
|
116831
|
+
];
|
|
116832
|
+
|
|
116833
|
+
// helpers //////////
|
|
116834
|
+
|
|
116835
|
+
function isEmpty(value) {
|
|
116836
|
+
return value == undefined || value === '';
|
|
116790
116837
|
}
|
|
116791
116838
|
|
|
116792
|
-
/**
|
|
116793
|
-
* Camunda BPMN specific user task forms behavior.
|
|
116794
|
-
*/
|
|
116795
|
-
let UserTaskFormsBehavior$1 = class UserTaskFormsBehavior extends CommandInterceptor$1 {
|
|
116796
|
-
constructor(eventBus) {
|
|
116797
|
-
super(eventBus);
|
|
116798
|
-
|
|
116799
|
-
/**
|
|
116800
|
-
* Ensure that only one of the following options is configured:
|
|
116801
|
-
*
|
|
116802
|
-
* 1. embedded, external or Camunda forms using camunda:formKey
|
|
116803
|
-
* 2. Camunda forms using camunda:formRef
|
|
116804
|
-
*/
|
|
116805
|
-
this.preExecute([
|
|
116806
|
-
'element.updateProperties',
|
|
116807
|
-
'element.updateModdleProperties'
|
|
116808
|
-
], function(context) {
|
|
116809
|
-
const {
|
|
116810
|
-
element,
|
|
116811
|
-
moddleElement,
|
|
116812
|
-
properties
|
|
116813
|
-
} = context;
|
|
116814
|
-
|
|
116815
|
-
const businessObject = moddleElement || getBusinessObject$1(element);
|
|
116816
|
-
|
|
116817
|
-
if (has$2(properties, 'camunda:formKey')) {
|
|
116818
|
-
Object.assign(properties, {
|
|
116819
|
-
'camunda:formRef': undefined,
|
|
116820
|
-
'camunda:formRefBinding': undefined,
|
|
116821
|
-
'camunda:formRefVersion': undefined
|
|
116822
|
-
});
|
|
116823
|
-
} else if (has$2(properties, 'camunda:formRef')) {
|
|
116824
|
-
Object.assign(properties, {
|
|
116825
|
-
'camunda:formKey': undefined
|
|
116826
|
-
});
|
|
116827
|
-
|
|
116828
|
-
if (isUndefined$4(properties[ 'camunda:formRef' ])) {
|
|
116829
|
-
Object.assign(properties, {
|
|
116830
|
-
'camunda:formRefBinding': undefined,
|
|
116831
|
-
'camunda:formRefVersion': undefined
|
|
116832
|
-
});
|
|
116833
|
-
}
|
|
116834
|
-
|
|
116835
|
-
if (!has$2(properties, 'camunda:formRefBinding') && isUndefined$4(businessObject.get('camunda:formRefBinding'))) {
|
|
116836
|
-
Object.assign(properties, {
|
|
116837
|
-
'camunda:formRefBinding': 'latest'
|
|
116838
|
-
});
|
|
116839
|
-
}
|
|
116840
|
-
}
|
|
116841
|
-
|
|
116842
|
-
if (has$2(properties, 'camunda:formRefBinding') && properties[ 'camunda:formRefBinding' ] !== 'version') {
|
|
116843
|
-
Object.assign(properties, {
|
|
116844
|
-
'camunda:formRefVersion': undefined
|
|
116845
|
-
});
|
|
116846
|
-
}
|
|
116847
|
-
}, true);
|
|
116848
|
-
|
|
116849
|
-
}
|
|
116850
|
-
};
|
|
116851
|
-
|
|
116839
|
+
/**
|
|
116840
|
+
* Camunda BPMN specific user task forms behavior.
|
|
116841
|
+
*/
|
|
116842
|
+
let UserTaskFormsBehavior$1 = class UserTaskFormsBehavior extends CommandInterceptor$1 {
|
|
116843
|
+
constructor(eventBus) {
|
|
116844
|
+
super(eventBus);
|
|
116845
|
+
|
|
116846
|
+
/**
|
|
116847
|
+
* Ensure that only one of the following options is configured:
|
|
116848
|
+
*
|
|
116849
|
+
* 1. embedded, external or Camunda forms using camunda:formKey
|
|
116850
|
+
* 2. Camunda forms using camunda:formRef
|
|
116851
|
+
*/
|
|
116852
|
+
this.preExecute([
|
|
116853
|
+
'element.updateProperties',
|
|
116854
|
+
'element.updateModdleProperties'
|
|
116855
|
+
], function(context) {
|
|
116856
|
+
const {
|
|
116857
|
+
element,
|
|
116858
|
+
moddleElement,
|
|
116859
|
+
properties
|
|
116860
|
+
} = context;
|
|
116861
|
+
|
|
116862
|
+
const businessObject = moddleElement || getBusinessObject$1(element);
|
|
116863
|
+
|
|
116864
|
+
if (has$2(properties, 'camunda:formKey')) {
|
|
116865
|
+
Object.assign(properties, {
|
|
116866
|
+
'camunda:formRef': undefined,
|
|
116867
|
+
'camunda:formRefBinding': undefined,
|
|
116868
|
+
'camunda:formRefVersion': undefined
|
|
116869
|
+
});
|
|
116870
|
+
} else if (has$2(properties, 'camunda:formRef')) {
|
|
116871
|
+
Object.assign(properties, {
|
|
116872
|
+
'camunda:formKey': undefined
|
|
116873
|
+
});
|
|
116874
|
+
|
|
116875
|
+
if (isUndefined$4(properties[ 'camunda:formRef' ])) {
|
|
116876
|
+
Object.assign(properties, {
|
|
116877
|
+
'camunda:formRefBinding': undefined,
|
|
116878
|
+
'camunda:formRefVersion': undefined
|
|
116879
|
+
});
|
|
116880
|
+
}
|
|
116881
|
+
|
|
116882
|
+
if (!has$2(properties, 'camunda:formRefBinding') && isUndefined$4(businessObject.get('camunda:formRefBinding'))) {
|
|
116883
|
+
Object.assign(properties, {
|
|
116884
|
+
'camunda:formRefBinding': 'latest'
|
|
116885
|
+
});
|
|
116886
|
+
}
|
|
116887
|
+
}
|
|
116888
|
+
|
|
116889
|
+
if (has$2(properties, 'camunda:formRefBinding') && properties[ 'camunda:formRefBinding' ] !== 'version') {
|
|
116890
|
+
Object.assign(properties, {
|
|
116891
|
+
'camunda:formRefVersion': undefined
|
|
116892
|
+
});
|
|
116893
|
+
}
|
|
116894
|
+
}, true);
|
|
116895
|
+
|
|
116896
|
+
}
|
|
116897
|
+
};
|
|
116898
|
+
|
|
116852
116899
|
UserTaskFormsBehavior$1.$inject = [ 'eventBus' ];
|
|
116853
116900
|
|
|
116854
|
-
/**
|
|
116855
|
-
* Camunda BPMN specific user task generated forms behavior.
|
|
116856
|
-
*
|
|
116857
|
-
* 1. Removes camunda:FormField#values if camunda:FormField#type is changed to something other than enum.
|
|
116858
|
-
* 2. Updates camunda:FormData#businessKey if camunda:FormField#id is changed.
|
|
116859
|
-
* 3. Removes camunda:FormData#businessKey if camunda:FormField is removed.
|
|
116860
|
-
*/
|
|
116861
|
-
class UserTaskFormsBehavior extends CommandInterceptor$1 {
|
|
116862
|
-
constructor(eventBus, modeling) {
|
|
116863
|
-
super(eventBus);
|
|
116864
|
-
|
|
116865
|
-
/**
|
|
116866
|
-
* Remove camunda:FormField#values if camunda:FormField#type is changed to
|
|
116867
|
-
* something other than enum.
|
|
116868
|
-
*/
|
|
116869
|
-
this.preExecute('element.updateModdleProperties', function(context) {
|
|
116870
|
-
const {
|
|
116871
|
-
moddleElement,
|
|
116872
|
-
properties
|
|
116873
|
-
} = context;
|
|
116874
|
-
|
|
116875
|
-
if (!is$5(moddleElement, 'camunda:FormField')) {
|
|
116876
|
-
return;
|
|
116877
|
-
}
|
|
116878
|
-
|
|
116879
|
-
if (
|
|
116880
|
-
('type' in properties && properties[ 'type' ] !== 'enum')
|
|
116881
|
-
|| 'camunda:type' in properties && properties[ 'camunda:type' ] !== 'enum'
|
|
116882
|
-
) {
|
|
116883
|
-
properties[ 'camunda:values' ] = undefined;
|
|
116884
|
-
}
|
|
116885
|
-
}, true);
|
|
116886
|
-
|
|
116887
|
-
/**
|
|
116888
|
-
* Update camunda:FormData#businessKey if camunda:FormField#id is changed.
|
|
116889
|
-
*/
|
|
116890
|
-
this.preExecute('element.updateModdleProperties', function(context) {
|
|
116891
|
-
const {
|
|
116892
|
-
element,
|
|
116893
|
-
moddleElement,
|
|
116894
|
-
properties
|
|
116895
|
-
} = context;
|
|
116896
|
-
|
|
116897
|
-
if (!is$5(moddleElement, 'camunda:FormField')
|
|
116898
|
-
|| (!has$2(properties, 'id') && !has$2(properties, 'camunda:id'))
|
|
116899
|
-
) {
|
|
116900
|
-
return;
|
|
116901
|
-
}
|
|
116902
|
-
|
|
116903
|
-
const formData = getFormData(element);
|
|
116904
|
-
|
|
116905
|
-
const businessKey = formData.get('camunda:businessKey');
|
|
116906
|
-
|
|
116907
|
-
if (!businessKey) {
|
|
116908
|
-
return;
|
|
116909
|
-
}
|
|
116910
|
-
|
|
116911
|
-
if (isBusinessKey(moddleElement, formData)) {
|
|
116912
|
-
modeling.updateModdleProperties(element, formData, {
|
|
116913
|
-
'camunda:businessKey': has$2(properties, 'id') ? properties.id : properties[ 'camunda:id' ]
|
|
116914
|
-
});
|
|
116915
|
-
}
|
|
116916
|
-
}, true);
|
|
116917
|
-
|
|
116918
|
-
/**
|
|
116919
|
-
* Remove camunda:FormData#businessKey if camunda:FormField is removed.
|
|
116920
|
-
*/
|
|
116921
|
-
this.postExecute('element.updateModdleProperties', function(context) {
|
|
116922
|
-
const {
|
|
116923
|
-
element,
|
|
116924
|
-
moddleElement,
|
|
116925
|
-
properties
|
|
116926
|
-
} = context;
|
|
116927
|
-
|
|
116928
|
-
if (!is$5(moddleElement, 'camunda:FormData') || !has$2(properties, 'fields')) {
|
|
116929
|
-
return;
|
|
116930
|
-
}
|
|
116931
|
-
|
|
116932
|
-
const businessKey = moddleElement.get('camunda:businessKey');
|
|
116933
|
-
|
|
116934
|
-
if (!businessKey) {
|
|
116935
|
-
return;
|
|
116936
|
-
}
|
|
116937
|
-
|
|
116938
|
-
const fieldWithBusinessKey = moddleElement.get('fields').find(field => {
|
|
116939
|
-
return field.get('camunda:id') === businessKey;
|
|
116940
|
-
});
|
|
116941
|
-
|
|
116942
|
-
if (!fieldWithBusinessKey) {
|
|
116943
|
-
modeling.updateModdleProperties(element, moddleElement, {
|
|
116944
|
-
'camunda:businessKey': undefined
|
|
116945
|
-
});
|
|
116946
|
-
}
|
|
116947
|
-
}, true);
|
|
116948
|
-
}
|
|
116949
|
-
}
|
|
116950
|
-
|
|
116951
|
-
|
|
116952
|
-
UserTaskFormsBehavior.$inject = [ 'eventBus', 'modeling' ];
|
|
116953
|
-
|
|
116954
|
-
// helpers //////////
|
|
116955
|
-
|
|
116956
|
-
function isBusinessKey(formField, formData) {
|
|
116957
|
-
return formField.get('camunda:id') === formData.get('camunda:businessKey');
|
|
116958
|
-
}
|
|
116959
|
-
|
|
116960
|
-
function getFormData(element) {
|
|
116961
|
-
const businessObject = getBusinessObject$1(element),
|
|
116962
|
-
extensionElements = businessObject.get('extensionElements');
|
|
116963
|
-
|
|
116964
|
-
if (!extensionElements) {
|
|
116965
|
-
return;
|
|
116966
|
-
}
|
|
116967
|
-
|
|
116968
|
-
const values = extensionElements.get('values');
|
|
116969
|
-
|
|
116970
|
-
return values.find((value) => {
|
|
116971
|
-
return is$5(value, 'camunda:FormData');
|
|
116972
|
-
});
|
|
116901
|
+
/**
|
|
116902
|
+
* Camunda BPMN specific user task generated forms behavior.
|
|
116903
|
+
*
|
|
116904
|
+
* 1. Removes camunda:FormField#values if camunda:FormField#type is changed to something other than enum.
|
|
116905
|
+
* 2. Updates camunda:FormData#businessKey if camunda:FormField#id is changed.
|
|
116906
|
+
* 3. Removes camunda:FormData#businessKey if camunda:FormField is removed.
|
|
116907
|
+
*/
|
|
116908
|
+
class UserTaskFormsBehavior extends CommandInterceptor$1 {
|
|
116909
|
+
constructor(eventBus, modeling) {
|
|
116910
|
+
super(eventBus);
|
|
116911
|
+
|
|
116912
|
+
/**
|
|
116913
|
+
* Remove camunda:FormField#values if camunda:FormField#type is changed to
|
|
116914
|
+
* something other than enum.
|
|
116915
|
+
*/
|
|
116916
|
+
this.preExecute('element.updateModdleProperties', function(context) {
|
|
116917
|
+
const {
|
|
116918
|
+
moddleElement,
|
|
116919
|
+
properties
|
|
116920
|
+
} = context;
|
|
116921
|
+
|
|
116922
|
+
if (!is$5(moddleElement, 'camunda:FormField')) {
|
|
116923
|
+
return;
|
|
116924
|
+
}
|
|
116925
|
+
|
|
116926
|
+
if (
|
|
116927
|
+
('type' in properties && properties[ 'type' ] !== 'enum')
|
|
116928
|
+
|| 'camunda:type' in properties && properties[ 'camunda:type' ] !== 'enum'
|
|
116929
|
+
) {
|
|
116930
|
+
properties[ 'camunda:values' ] = undefined;
|
|
116931
|
+
}
|
|
116932
|
+
}, true);
|
|
116933
|
+
|
|
116934
|
+
/**
|
|
116935
|
+
* Update camunda:FormData#businessKey if camunda:FormField#id is changed.
|
|
116936
|
+
*/
|
|
116937
|
+
this.preExecute('element.updateModdleProperties', function(context) {
|
|
116938
|
+
const {
|
|
116939
|
+
element,
|
|
116940
|
+
moddleElement,
|
|
116941
|
+
properties
|
|
116942
|
+
} = context;
|
|
116943
|
+
|
|
116944
|
+
if (!is$5(moddleElement, 'camunda:FormField')
|
|
116945
|
+
|| (!has$2(properties, 'id') && !has$2(properties, 'camunda:id'))
|
|
116946
|
+
) {
|
|
116947
|
+
return;
|
|
116948
|
+
}
|
|
116949
|
+
|
|
116950
|
+
const formData = getFormData(element);
|
|
116951
|
+
|
|
116952
|
+
const businessKey = formData.get('camunda:businessKey');
|
|
116953
|
+
|
|
116954
|
+
if (!businessKey) {
|
|
116955
|
+
return;
|
|
116956
|
+
}
|
|
116957
|
+
|
|
116958
|
+
if (isBusinessKey(moddleElement, formData)) {
|
|
116959
|
+
modeling.updateModdleProperties(element, formData, {
|
|
116960
|
+
'camunda:businessKey': has$2(properties, 'id') ? properties.id : properties[ 'camunda:id' ]
|
|
116961
|
+
});
|
|
116962
|
+
}
|
|
116963
|
+
}, true);
|
|
116964
|
+
|
|
116965
|
+
/**
|
|
116966
|
+
* Remove camunda:FormData#businessKey if camunda:FormField is removed.
|
|
116967
|
+
*/
|
|
116968
|
+
this.postExecute('element.updateModdleProperties', function(context) {
|
|
116969
|
+
const {
|
|
116970
|
+
element,
|
|
116971
|
+
moddleElement,
|
|
116972
|
+
properties
|
|
116973
|
+
} = context;
|
|
116974
|
+
|
|
116975
|
+
if (!is$5(moddleElement, 'camunda:FormData') || !has$2(properties, 'fields')) {
|
|
116976
|
+
return;
|
|
116977
|
+
}
|
|
116978
|
+
|
|
116979
|
+
const businessKey = moddleElement.get('camunda:businessKey');
|
|
116980
|
+
|
|
116981
|
+
if (!businessKey) {
|
|
116982
|
+
return;
|
|
116983
|
+
}
|
|
116984
|
+
|
|
116985
|
+
const fieldWithBusinessKey = moddleElement.get('fields').find(field => {
|
|
116986
|
+
return field.get('camunda:id') === businessKey;
|
|
116987
|
+
});
|
|
116988
|
+
|
|
116989
|
+
if (!fieldWithBusinessKey) {
|
|
116990
|
+
modeling.updateModdleProperties(element, moddleElement, {
|
|
116991
|
+
'camunda:businessKey': undefined
|
|
116992
|
+
});
|
|
116993
|
+
}
|
|
116994
|
+
}, true);
|
|
116995
|
+
}
|
|
116996
|
+
}
|
|
116997
|
+
|
|
116998
|
+
|
|
116999
|
+
UserTaskFormsBehavior.$inject = [ 'eventBus', 'modeling' ];
|
|
117000
|
+
|
|
117001
|
+
// helpers //////////
|
|
117002
|
+
|
|
117003
|
+
function isBusinessKey(formField, formData) {
|
|
117004
|
+
return formField.get('camunda:id') === formData.get('camunda:businessKey');
|
|
117005
|
+
}
|
|
117006
|
+
|
|
117007
|
+
function getFormData(element) {
|
|
117008
|
+
const businessObject = getBusinessObject$1(element),
|
|
117009
|
+
extensionElements = businessObject.get('extensionElements');
|
|
117010
|
+
|
|
117011
|
+
if (!extensionElements) {
|
|
117012
|
+
return;
|
|
117013
|
+
}
|
|
117014
|
+
|
|
117015
|
+
const values = extensionElements.get('values');
|
|
117016
|
+
|
|
117017
|
+
return values.find((value) => {
|
|
117018
|
+
return is$5(value, 'camunda:FormData');
|
|
117019
|
+
});
|
|
116973
117020
|
}
|
|
116974
117021
|
|
|
116975
|
-
var behaviorsModule = {
|
|
116976
|
-
__init__: [
|
|
116977
|
-
'copyPasteBehavior',
|
|
116978
|
-
'copyPasteRootElementBehavior',
|
|
116979
|
-
'deleteErrorEventDefinitionBehavior',
|
|
116980
|
-
'deleteParticipantBehaviour',
|
|
116981
|
-
'deleteRetryTimeCycleBehavior',
|
|
116982
|
-
'removeInitiatorBehaviour',
|
|
116983
|
-
'removeVariableEventBehaviour',
|
|
116984
|
-
'updateCamundaExclusiveBehavior',
|
|
116985
|
-
'updateResultVariableBehavior',
|
|
116986
|
-
'updateInputOutputBehavior',
|
|
116987
|
-
'userTaskFormsBehavior',
|
|
116988
|
-
'userTaskGeneratedFormsBehavior'
|
|
116989
|
-
],
|
|
116990
|
-
copyPasteBehavior: [ 'type', CopyPasteBehavior ],
|
|
116991
|
-
copyPasteRootElementBehavior: [ 'type', CopyPasteRootElementBehavior ],
|
|
116992
|
-
deleteErrorEventDefinitionBehavior: [ 'type', DeleteErrorEventDefinitionBehavior ],
|
|
116993
|
-
deleteParticipantBehaviour: [ 'type', DeleteParticipantBehaviour ],
|
|
116994
|
-
deleteRetryTimeCycleBehavior: [ 'type', DeleteRetryTimeCycleBehavior ],
|
|
116995
|
-
removeInitiatorBehaviour: [ 'type', RemoveInitiatorBehaviour ],
|
|
116996
|
-
removeVariableEventBehaviour: [ 'type', RemoveVariableEventBehaviour ],
|
|
116997
|
-
updateCamundaExclusiveBehavior: [ 'type', UpdateCamundaExclusiveBehavior ],
|
|
116998
|
-
updateResultVariableBehavior: [ 'type', UpdateResultVariableBehavior ],
|
|
116999
|
-
updateInputOutputBehavior: [ 'type', UpdateInputOutputBehavior ],
|
|
117000
|
-
userTaskFormsBehavior: [ 'type', UserTaskFormsBehavior$1 ],
|
|
117001
|
-
userTaskGeneratedFormsBehavior: [ 'type', UserTaskFormsBehavior ]
|
|
117022
|
+
var behaviorsModule = {
|
|
117023
|
+
__init__: [
|
|
117024
|
+
'copyPasteBehavior',
|
|
117025
|
+
'copyPasteRootElementBehavior',
|
|
117026
|
+
'deleteErrorEventDefinitionBehavior',
|
|
117027
|
+
'deleteParticipantBehaviour',
|
|
117028
|
+
'deleteRetryTimeCycleBehavior',
|
|
117029
|
+
'removeInitiatorBehaviour',
|
|
117030
|
+
'removeVariableEventBehaviour',
|
|
117031
|
+
'updateCamundaExclusiveBehavior',
|
|
117032
|
+
'updateResultVariableBehavior',
|
|
117033
|
+
'updateInputOutputBehavior',
|
|
117034
|
+
'userTaskFormsBehavior',
|
|
117035
|
+
'userTaskGeneratedFormsBehavior'
|
|
117036
|
+
],
|
|
117037
|
+
copyPasteBehavior: [ 'type', CopyPasteBehavior ],
|
|
117038
|
+
copyPasteRootElementBehavior: [ 'type', CopyPasteRootElementBehavior ],
|
|
117039
|
+
deleteErrorEventDefinitionBehavior: [ 'type', DeleteErrorEventDefinitionBehavior ],
|
|
117040
|
+
deleteParticipantBehaviour: [ 'type', DeleteParticipantBehaviour ],
|
|
117041
|
+
deleteRetryTimeCycleBehavior: [ 'type', DeleteRetryTimeCycleBehavior ],
|
|
117042
|
+
removeInitiatorBehaviour: [ 'type', RemoveInitiatorBehaviour ],
|
|
117043
|
+
removeVariableEventBehaviour: [ 'type', RemoveVariableEventBehaviour ],
|
|
117044
|
+
updateCamundaExclusiveBehavior: [ 'type', UpdateCamundaExclusiveBehavior ],
|
|
117045
|
+
updateResultVariableBehavior: [ 'type', UpdateResultVariableBehavior ],
|
|
117046
|
+
updateInputOutputBehavior: [ 'type', UpdateInputOutputBehavior ],
|
|
117047
|
+
userTaskFormsBehavior: [ 'type', UserTaskFormsBehavior$1 ],
|
|
117048
|
+
userTaskGeneratedFormsBehavior: [ 'type', UserTaskFormsBehavior ]
|
|
117002
117049
|
};
|
|
117003
117050
|
|
|
117004
117051
|
/**
|