camunda-bpmn-js 0.11.4 → 0.12.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/CHANGELOG.md +22 -5
- package/dist/base-modeler.development.js +89 -1060
- package/dist/base-modeler.production.min.js +3 -3
- package/dist/camunda-cloud-modeler.development.js +734 -1570
- package/dist/camunda-cloud-modeler.production.min.js +3 -3
- package/dist/camunda-platform-modeler.development.js +291 -1354
- package/dist/camunda-platform-modeler.production.min.js +3 -3
- package/lib/camunda-cloud/features/modeling/behavior/CleanUpAssignmentDefinitionBehavior.js +78 -0
- package/lib/camunda-cloud/features/modeling/behavior/CleanUpBusinessRuleTaskBehavior.js +112 -0
- package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeBoundaryEventBehavior.js +51 -55
- package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeCallActivityBehavior.js +56 -59
- package/lib/camunda-cloud/features/modeling/behavior/FormDefinitionBehavior.js +69 -127
- package/lib/camunda-cloud/features/modeling/behavior/UpdatePropagateAllChildVariablesBehavior.js +76 -128
- package/lib/camunda-cloud/features/modeling/behavior/index.js +6 -0
- package/lib/camunda-cloud/features/properties-provider/parts/implementation/InputOutput.js +21 -7
- package/lib/camunda-cloud/features/rules/BpmnRules.js +1 -1
- package/lib/camunda-cloud/helper/CalledElementHelper.js +43 -41
- package/lib/camunda-cloud/helper/FormsHelper.js +38 -50
- package/lib/camunda-cloud/helper/InputOutputHelper.js +92 -106
- package/lib/camunda-platform/features/modeling/behavior/DeleteErrorEventDefinitionBehavior.js +24 -47
- package/lib/camunda-platform/features/modeling/behavior/DeleteRetryTimeCycleBehavior.js +39 -81
- package/lib/camunda-platform/features/modeling/behavior/UpdateCamundaExclusiveBehavior.js +31 -65
- package/lib/camunda-platform/features/modeling/behavior/UpdateInputOutputBehavior.js +42 -76
- package/lib/camunda-platform/features/modeling/behavior/UpdateResultVariableBehavior.js +21 -26
- package/lib/camunda-platform/features/modeling/behavior/UserTaskFormsBehavior.js +16 -10
- package/lib/camunda-platform/helper/InputOutputHelper.js +29 -0
- package/package.json +5 -5
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
is
|
|
3
|
+
} from 'bpmn-js/lib/util/ModelUtil';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
getBusinessObject
|
|
7
|
+
} from 'bpmn-js/lib/util/ModelUtil';
|
|
8
|
+
|
|
9
|
+
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
10
|
+
|
|
11
|
+
const HIGH_PRIORITY = 5000;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Zeebe BPMN behavior for ensuring that there are not empty (ie. without properties)
|
|
16
|
+
* zeebe:assignmentDefinitions after modeling operations. Will also remove related
|
|
17
|
+
* extensionElements, if they remain empty afterwards (could be a seperate
|
|
18
|
+
* behavior in the future, if needed)
|
|
19
|
+
*/
|
|
20
|
+
export default class CleanUpBusinessRuleTaskBehavior extends CommandInterceptor {
|
|
21
|
+
constructor(eventBus, modeling) {
|
|
22
|
+
super(eventBus);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Remove zeebe:assignmentDefinition when it has no defined properties left after the operation
|
|
26
|
+
*/
|
|
27
|
+
this.postExecuted([
|
|
28
|
+
'properties-panel.update-businessobject',
|
|
29
|
+
'element.updateModdleProperties'
|
|
30
|
+
] , HIGH_PRIORITY, function(context) {
|
|
31
|
+
const {
|
|
32
|
+
element,
|
|
33
|
+
businessObject,
|
|
34
|
+
moddleElement
|
|
35
|
+
} = context;
|
|
36
|
+
|
|
37
|
+
// (1) harmonize property names from commands
|
|
38
|
+
const assignmentDefintion = businessObject || moddleElement;
|
|
39
|
+
|
|
40
|
+
if (
|
|
41
|
+
is(element, 'bpmn:UserTask')
|
|
42
|
+
&& assignmentDefintion
|
|
43
|
+
&& is(assignmentDefintion, 'zeebe:AssignmentDefinition')
|
|
44
|
+
&& assignmentDefintion.assignee === undefined
|
|
45
|
+
&& assignmentDefintion.candidateGroups === undefined
|
|
46
|
+
) {
|
|
47
|
+
const extensionElements = getBusinessObject(element).extensionElements;
|
|
48
|
+
|
|
49
|
+
// (2) remove zeebe:assignmentDefintion
|
|
50
|
+
removeFromExtensionElements(element, extensionElements, modeling,
|
|
51
|
+
(ele) => !is(ele, 'zeebe:AssignmentDefinition'));
|
|
52
|
+
|
|
53
|
+
// (3) if extensionElements are empty afterwards, remove them as well
|
|
54
|
+
if (extensionElements.values.length === 0) {
|
|
55
|
+
modeling.updateModdleProperties(element, getBusinessObject(element),
|
|
56
|
+
{ extensionElements: undefined });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, true);
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
CleanUpBusinessRuleTaskBehavior.$inject = [
|
|
65
|
+
'eventBus',
|
|
66
|
+
'modeling'
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
// helper ////////////////////
|
|
71
|
+
|
|
72
|
+
function removeFromExtensionElements(element, extensionElements, modeling, filterFun) {
|
|
73
|
+
const values = extensionElements.get('values').filter(filterFun);
|
|
74
|
+
|
|
75
|
+
modeling.updateModdleProperties(element, extensionElements, {
|
|
76
|
+
values
|
|
77
|
+
});
|
|
78
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
is
|
|
3
|
+
} from 'bpmn-js/lib/util/ModelUtil';
|
|
4
|
+
|
|
5
|
+
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
6
|
+
|
|
7
|
+
const HIGH_PRIORITY = 5000;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Zeebe BPMN behavior for ensuring that a BusinessRuleTask:
|
|
12
|
+
* 1) Either has a taskDefinition ExtensionElement OR
|
|
13
|
+
* 2) Or has a calledDecision ExtensionElement
|
|
14
|
+
* 2.1) If it has a calledDecision ExtensionElement, it shall not have taskHeaders
|
|
15
|
+
*/
|
|
16
|
+
export default class CleanUpBusinessRuleTaskBehavior extends CommandInterceptor {
|
|
17
|
+
constructor(eventBus, modeling) {
|
|
18
|
+
super(eventBus);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Remove zeebe:calledDecision when zeebe:taskDefinition is added
|
|
22
|
+
*/
|
|
23
|
+
this.postExecute([
|
|
24
|
+
'properties-panel.update-businessobject-list',
|
|
25
|
+
'element.updateModdleProperties'
|
|
26
|
+
] , HIGH_PRIORITY, function(context) {
|
|
27
|
+
const {
|
|
28
|
+
element,
|
|
29
|
+
currentObject,
|
|
30
|
+
objectsToAdd,
|
|
31
|
+
moddleElement,
|
|
32
|
+
properties
|
|
33
|
+
} = context;
|
|
34
|
+
|
|
35
|
+
// (1) map properties from both commands
|
|
36
|
+
const extensionElement = currentObject || moddleElement,
|
|
37
|
+
newValues = objectsToAdd || (properties && properties.values);
|
|
38
|
+
|
|
39
|
+
// (2) check conditions and potentially update
|
|
40
|
+
if (
|
|
41
|
+
is(element, 'bpmn:BusinessRuleTask')
|
|
42
|
+
&& extensionElement
|
|
43
|
+
&& is(extensionElement, 'bpmn:ExtensionElements')
|
|
44
|
+
&& extensionElement.get('values').some((ele) => is(ele, 'zeebe:CalledDecision'))
|
|
45
|
+
&& newValues
|
|
46
|
+
&& newValues.some((ele) => is(ele, 'zeebe:TaskDefinition'))
|
|
47
|
+
) {
|
|
48
|
+
removeCalledDecision(element, extensionElement, modeling);
|
|
49
|
+
}
|
|
50
|
+
}, true);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Remove zeebe:taskDefinition and zeebe:taskHeaders when zeebe:calledDecision
|
|
54
|
+
*/
|
|
55
|
+
this.postExecute([
|
|
56
|
+
'properties-panel.update-businessobject-list',
|
|
57
|
+
'element.updateModdleProperties'
|
|
58
|
+
] , HIGH_PRIORITY, function(context) {
|
|
59
|
+
const {
|
|
60
|
+
element,
|
|
61
|
+
currentObject,
|
|
62
|
+
objectsToAdd,
|
|
63
|
+
moddleElement,
|
|
64
|
+
properties
|
|
65
|
+
} = context;
|
|
66
|
+
|
|
67
|
+
// (1) map properties from both commands
|
|
68
|
+
const extensionElement = currentObject || moddleElement,
|
|
69
|
+
newValues = objectsToAdd || (properties && properties.values);
|
|
70
|
+
|
|
71
|
+
// (2) check conditions and potentially update
|
|
72
|
+
if (
|
|
73
|
+
is(element, 'bpmn:BusinessRuleTask')
|
|
74
|
+
&& extensionElement
|
|
75
|
+
&& is(extensionElement, 'bpmn:ExtensionElements')
|
|
76
|
+
&& extensionElement.get('values').some(
|
|
77
|
+
(ele) => is(ele, 'zeebe:TaskDefinition') || is(ele, 'zeebe:TaskHeaders'))
|
|
78
|
+
&& newValues
|
|
79
|
+
&& newValues.some((ele) => is(ele, 'zeebe:CalledDecision'))
|
|
80
|
+
) {
|
|
81
|
+
removeTaskDefintionAndHeaders(element, extensionElement, modeling);
|
|
82
|
+
}
|
|
83
|
+
}, true);
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
CleanUpBusinessRuleTaskBehavior.$inject = [
|
|
89
|
+
'eventBus',
|
|
90
|
+
'modeling'
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
// helper ////////////////////
|
|
95
|
+
|
|
96
|
+
function removeFromExtensionElements(element, extensionElements, modeling, filterFun) {
|
|
97
|
+
const values = extensionElements.get('values').filter(filterFun);
|
|
98
|
+
|
|
99
|
+
modeling.updateModdleProperties(element, extensionElements, {
|
|
100
|
+
values
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function removeCalledDecision(element, extensionElements, modeling) {
|
|
105
|
+
removeFromExtensionElements(element, extensionElements, modeling,
|
|
106
|
+
(ele) => !is(ele, 'zeebe:CalledDecision'));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function removeTaskDefintionAndHeaders(element, extensionElements, modeling) {
|
|
110
|
+
removeFromExtensionElements(element, extensionElements, modeling,
|
|
111
|
+
(ele) => !is(ele, 'zeebe:TaskDefinition') && !is(ele, 'zeebe:TaskHeaders'));
|
|
112
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import inherits from 'inherits';
|
|
2
|
-
|
|
3
1
|
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
4
2
|
|
|
5
3
|
import {
|
|
@@ -7,74 +5,72 @@ import {
|
|
|
7
5
|
is
|
|
8
6
|
} from 'bpmn-js/lib/util/ModelUtil';
|
|
9
7
|
|
|
10
|
-
const HIGH_PRIORITY =
|
|
8
|
+
const HIGH_PRIORITY = 5000;
|
|
9
|
+
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
|
-
* BPMN specific
|
|
12
|
+
* Zeebe BPMN specific behavior for creating boundary events.
|
|
14
13
|
*/
|
|
15
|
-
export default
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
cancelActivity: true
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
let newBusinessObject,
|
|
37
|
-
hostBusinessObject,
|
|
38
|
-
boundaryEvent,
|
|
39
|
-
eventDefinitions;
|
|
14
|
+
export default class CreateZeebeBoundaryEventBehavior extends CommandInterceptor {
|
|
15
|
+
constructor(bpmnFactory, elementFactory, eventBus) {
|
|
16
|
+
super(eventBus);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Replace intermediate catch event with boundary event when attaching it to a shape.
|
|
20
|
+
*/
|
|
21
|
+
this.preExecute('shape.create', HIGH_PRIORITY, function(context) {
|
|
22
|
+
const {
|
|
23
|
+
shape,
|
|
24
|
+
host
|
|
25
|
+
} = context;
|
|
26
|
+
|
|
27
|
+
const businessObject = getBusinessObject(shape);
|
|
28
|
+
|
|
29
|
+
let attrs = {
|
|
30
|
+
cancelActivity: true
|
|
31
|
+
};
|
|
40
32
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
let newBusinessObject,
|
|
34
|
+
hostBusinessObject,
|
|
35
|
+
boundaryEvent,
|
|
36
|
+
eventDefinitions;
|
|
44
37
|
|
|
45
|
-
|
|
38
|
+
if (!host || !is(shape, 'bpmn:IntermediateCatchEvent')) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
46
41
|
|
|
47
|
-
|
|
48
|
-
attachedToRef: hostBusinessObject,
|
|
49
|
-
...attrs
|
|
50
|
-
};
|
|
42
|
+
hostBusinessObject = getBusinessObject(host);
|
|
51
43
|
|
|
52
|
-
|
|
44
|
+
attrs = {
|
|
45
|
+
...attrs,
|
|
46
|
+
attachedToRef: hostBusinessObject
|
|
47
|
+
};
|
|
53
48
|
|
|
54
|
-
|
|
49
|
+
eventDefinitions = businessObject.eventDefinitions;
|
|
55
50
|
|
|
56
|
-
|
|
57
|
-
type: 'bpmn:BoundaryEvent',
|
|
58
|
-
businessObject: newBusinessObject,
|
|
59
|
-
};
|
|
51
|
+
newBusinessObject = bpmnFactory.create('bpmn:BoundaryEvent', attrs);
|
|
60
52
|
|
|
61
|
-
if (eventDefinitions && eventDefinitions[0]) {
|
|
62
53
|
boundaryEvent = {
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
type: 'bpmn:BoundaryEvent',
|
|
55
|
+
businessObject: newBusinessObject,
|
|
65
56
|
};
|
|
66
|
-
}
|
|
67
57
|
|
|
68
|
-
|
|
58
|
+
if (eventDefinitions && eventDefinitions[0]) {
|
|
59
|
+
boundaryEvent = {
|
|
60
|
+
...boundaryEvent,
|
|
61
|
+
eventDefinitionType: eventDefinitions[0].$type
|
|
62
|
+
};
|
|
63
|
+
}
|
|
69
64
|
|
|
70
|
-
|
|
71
|
-
}
|
|
65
|
+
context.shape = elementFactory.createShape(boundaryEvent);
|
|
72
66
|
|
|
67
|
+
}, true);
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
}
|
|
73
71
|
|
|
74
72
|
CreateZeebeBoundaryEventBehavior.$inject = [
|
|
75
|
-
'
|
|
73
|
+
'bpmnFactory',
|
|
76
74
|
'elementFactory',
|
|
77
|
-
'
|
|
78
|
-
];
|
|
79
|
-
|
|
80
|
-
inherits(CreateZeebeBoundaryEventBehavior, CommandInterceptor);
|
|
75
|
+
'eventBus'
|
|
76
|
+
];
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
has
|
|
5
|
-
} from 'min-dash';
|
|
1
|
+
import { has } from 'min-dash';
|
|
6
2
|
|
|
7
3
|
import elementHelper from 'bpmn-js-properties-panel/lib/helper/ElementHelper';
|
|
8
4
|
|
|
9
|
-
import {
|
|
10
|
-
getCalledElement
|
|
11
|
-
} from '../../../helper/CalledElementHelper';
|
|
5
|
+
import { getCalledElement } from '../../../helper/CalledElementHelper';
|
|
12
6
|
|
|
13
7
|
import {
|
|
14
8
|
getBusinessObject,
|
|
@@ -17,61 +11,64 @@ import {
|
|
|
17
11
|
|
|
18
12
|
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
19
13
|
|
|
20
|
-
const HIGH_PRIORITY =
|
|
14
|
+
const HIGH_PRIORITY = 5000;
|
|
15
|
+
|
|
21
16
|
|
|
22
17
|
/**
|
|
23
|
-
* BPMN specific
|
|
18
|
+
* Zeebe BPMN specific behavior for creating call activities.
|
|
24
19
|
*/
|
|
25
|
-
export default
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
20
|
+
export default class CreateZeebeCallActivityBehavior extends CommandInterceptor {
|
|
21
|
+
constructor(bpmnFactory, eventBus, modeling) {
|
|
22
|
+
super(eventBus);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Add zeebe:CalledElement extension element with zeebe:propagateAllChildVariables attribute = false
|
|
26
|
+
* when creating bpmn:CallActivity.
|
|
27
|
+
*/
|
|
28
|
+
this.postExecuted('shape.create', HIGH_PRIORITY, function(context) {
|
|
29
|
+
const { shape } = context;
|
|
30
|
+
|
|
31
|
+
if (!is(shape, 'bpmn:CallActivity')) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const businessObject = getBusinessObject(shape);
|
|
36
|
+
|
|
37
|
+
let calledElement = getCalledElement(businessObject);
|
|
38
|
+
|
|
39
|
+
if (!calledElement) {
|
|
40
|
+
calledElement = bpmnFactory.create('zeebe:CalledElement', {
|
|
41
|
+
propagateAllChildVariables: false
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
let extensionElements = businessObject.get('extensionElements');
|
|
45
|
+
|
|
46
|
+
if (!extensionElements) {
|
|
47
|
+
extensionElements = elementHelper.createElement('bpmn:ExtensionElements', { values: [] }, businessObject, bpmnFactory);
|
|
48
|
+
|
|
49
|
+
modeling.updateProperties(shape, { extensionElements });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
modeling.updateModdleProperties(shape, extensionElements, {
|
|
53
|
+
values: [
|
|
54
|
+
...(extensionElements.values || []),
|
|
55
|
+
calledElement
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
} else if (!has(calledElement, 'propagateAllChildVariables')) {
|
|
59
|
+
|
|
60
|
+
// if zeebe:CalledElement exist set zeebe:propagateAllChildVariables to false
|
|
61
|
+
modeling.updateModdleProperties(shape, calledElement, {
|
|
62
|
+
propagateAllChildVariables: false
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}, true);
|
|
66
|
+
|
|
67
|
+
}
|
|
69
68
|
}
|
|
70
69
|
|
|
71
|
-
|
|
72
70
|
CreateZeebeCallActivityBehavior.$inject = [
|
|
71
|
+
'bpmnFactory',
|
|
73
72
|
'eventBus',
|
|
74
|
-
'
|
|
75
|
-
];
|
|
76
|
-
|
|
77
|
-
inherits(CreateZeebeCallActivityBehavior, CommandInterceptor);
|
|
73
|
+
'modeling'
|
|
74
|
+
];
|