camunda-bpmn-js 0.13.0-drilldown.0 → 0.13.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 +92 -0
- package/dist/assets/base-navigated-viewer.css +2 -0
- package/dist/assets/base-viewer.css +2 -0
- package/dist/assets/bpmn-js.css +7 -4
- package/dist/assets/camunda-cloud-modeler.css +2 -1
- package/dist/assets/camunda-cloud-navigated-viewer.css +1 -0
- package/dist/assets/camunda-cloud-viewer.css +1 -0
- package/dist/assets/camunda-platform-navigated-viewer.css +1 -0
- package/dist/assets/camunda-platform-viewer.css +1 -0
- package/dist/assets/element-templates.css +4 -0
- package/dist/assets/properties-panel.css +901 -877
- package/dist/base-modeler.development.js +1949 -3883
- package/dist/base-modeler.production.min.js +4 -4
- package/dist/base-navigated-viewer.development.js +22218 -0
- package/dist/base-navigated-viewer.production.min.js +2 -0
- package/dist/base-viewer.development.js +21227 -0
- package/dist/base-viewer.production.min.js +2 -0
- package/dist/camunda-cloud-modeler.development.js +8579 -5480
- package/dist/camunda-cloud-modeler.production.min.js +4 -4
- package/dist/camunda-cloud-navigated-viewer.development.js +23041 -0
- package/dist/camunda-cloud-navigated-viewer.production.min.js +2 -0
- package/dist/camunda-cloud-viewer.development.js +22050 -0
- package/dist/camunda-cloud-viewer.production.min.js +2 -0
- package/dist/camunda-platform-modeler.development.js +6777 -8719
- package/dist/camunda-platform-modeler.production.min.js +4 -4
- package/dist/camunda-platform-navigated-viewer.development.js +23413 -0
- package/dist/camunda-platform-navigated-viewer.production.min.js +2 -0
- package/dist/camunda-platform-viewer.development.js +22422 -0
- package/dist/camunda-platform-viewer.production.min.js +2 -0
- package/lib/base/NavigatedViewer.js +3 -0
- package/lib/base/Viewer.js +3 -0
- package/lib/camunda-cloud/ElementTemplatesValidator.js +1 -0
- package/lib/camunda-cloud/Modeler.js +8 -7
- package/lib/camunda-cloud/NavigatedViewer.js +34 -0
- package/lib/camunda-cloud/Viewer.js +34 -0
- package/lib/camunda-cloud/util/commonModules.js +14 -0
- package/lib/camunda-platform/Modeler.js +5 -5
- package/lib/camunda-platform/NavigatedViewer.js +25 -0
- package/lib/camunda-platform/Viewer.js +24 -0
- package/lib/camunda-platform/util/commonModules.js +7 -0
- package/lib/util/ExtensionElementsUtil.js +59 -0
- package/package.json +33 -15
- package/styles/base-navigated-viewer.css +2 -0
- package/styles/base-viewer.css +2 -0
- package/styles/camunda-cloud-modeler.css +2 -1
- package/styles/camunda-cloud-navigated-viewer.css +1 -0
- package/styles/camunda-cloud-viewer.css +1 -0
- package/styles/camunda-platform-navigated-viewer.css +1 -0
- package/styles/camunda-platform-viewer.css +1 -0
- package/util/index.js +39 -0
- package/dist/assets/bpmn-js-properties-panel.css +0 -778
- package/lib/camunda-cloud/features/modeling/behavior/CleanUpAssignmentDefinitionBehavior.js +0 -78
- package/lib/camunda-cloud/features/modeling/behavior/CleanUpBusinessRuleTaskBehavior.js +0 -112
- package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeBoundaryEventBehavior.js +0 -76
- package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeCallActivityBehavior.js +0 -74
- package/lib/camunda-cloud/features/modeling/behavior/FormDefinitionBehavior.js +0 -138
- package/lib/camunda-cloud/features/modeling/behavior/UpdatePropagateAllChildVariablesBehavior.js +0 -109
- package/lib/camunda-cloud/features/modeling/behavior/index.js +0 -24
- package/lib/camunda-cloud/features/modeling/index.js +0 -7
- package/lib/camunda-cloud/helper/CalledElementHelper.js +0 -72
- package/lib/camunda-cloud/helper/ElementHelper.js +0 -18
- package/lib/camunda-cloud/helper/ExtensionElementsHelper.js +0 -17
- package/lib/camunda-cloud/helper/FormsHelper.js +0 -84
- package/lib/camunda-cloud/helper/InputOutputHelper.js +0 -138
- package/lib/camunda-cloud/helper/Utils.js +0 -10
- package/lib/camunda-cloud/helper/ZeebeServiceTaskHelper.js +0 -41
- package/lib/camunda-platform/features/modeling/behavior/DeleteErrorEventDefinitionBehavior.js +0 -67
- package/lib/camunda-platform/features/modeling/behavior/DeleteRetryTimeCycleBehavior.js +0 -84
- package/lib/camunda-platform/features/modeling/behavior/UpdateCamundaExclusiveBehavior.js +0 -65
- package/lib/camunda-platform/features/modeling/behavior/UpdateInputOutputBehavior.js +0 -54
- package/lib/camunda-platform/features/modeling/behavior/UpdateResultVariableBehavior.js +0 -51
- package/lib/camunda-platform/features/modeling/behavior/UserTaskFormsBehavior.js +0 -70
- package/lib/camunda-platform/features/modeling/behavior/UserTaskGeneratedFormsBehavior.js +0 -117
- package/lib/camunda-platform/features/modeling/behavior/index.js +0 -26
- package/lib/camunda-platform/features/modeling/index.js +0 -7
- package/lib/camunda-platform/helper/InputOutputHelper.js +0 -29
|
@@ -1,78 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
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,76 +0,0 @@
|
|
|
1
|
-
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
getBusinessObject,
|
|
5
|
-
is
|
|
6
|
-
} from 'bpmn-js/lib/util/ModelUtil';
|
|
7
|
-
|
|
8
|
-
const HIGH_PRIORITY = 5000;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Zeebe BPMN specific behavior for creating boundary events.
|
|
13
|
-
*/
|
|
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
|
-
};
|
|
32
|
-
|
|
33
|
-
let newBusinessObject,
|
|
34
|
-
hostBusinessObject,
|
|
35
|
-
boundaryEvent,
|
|
36
|
-
eventDefinitions;
|
|
37
|
-
|
|
38
|
-
if (!host || !is(shape, 'bpmn:IntermediateCatchEvent')) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
hostBusinessObject = getBusinessObject(host);
|
|
43
|
-
|
|
44
|
-
attrs = {
|
|
45
|
-
...attrs,
|
|
46
|
-
attachedToRef: hostBusinessObject
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
eventDefinitions = businessObject.eventDefinitions;
|
|
50
|
-
|
|
51
|
-
newBusinessObject = bpmnFactory.create('bpmn:BoundaryEvent', attrs);
|
|
52
|
-
|
|
53
|
-
boundaryEvent = {
|
|
54
|
-
type: 'bpmn:BoundaryEvent',
|
|
55
|
-
businessObject: newBusinessObject,
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
if (eventDefinitions && eventDefinitions[0]) {
|
|
59
|
-
boundaryEvent = {
|
|
60
|
-
...boundaryEvent,
|
|
61
|
-
eventDefinitionType: eventDefinitions[0].$type
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
context.shape = elementFactory.createShape(boundaryEvent);
|
|
66
|
-
|
|
67
|
-
}, true);
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
CreateZeebeBoundaryEventBehavior.$inject = [
|
|
73
|
-
'bpmnFactory',
|
|
74
|
-
'elementFactory',
|
|
75
|
-
'eventBus'
|
|
76
|
-
];
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { has } from 'min-dash';
|
|
2
|
-
|
|
3
|
-
import { createElement } from '../../../helper/ElementHelper';
|
|
4
|
-
|
|
5
|
-
import { getCalledElement } from '../../../helper/CalledElementHelper';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
getBusinessObject,
|
|
9
|
-
is
|
|
10
|
-
} from 'bpmn-js/lib/util/ModelUtil';
|
|
11
|
-
|
|
12
|
-
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
13
|
-
|
|
14
|
-
const HIGH_PRIORITY = 5000;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Zeebe BPMN specific behavior for creating call activities.
|
|
19
|
-
*/
|
|
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 = 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
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
CreateZeebeCallActivityBehavior.$inject = [
|
|
71
|
-
'bpmnFactory',
|
|
72
|
-
'eventBus',
|
|
73
|
-
'modeling'
|
|
74
|
-
];
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
3
|
-
|
|
4
|
-
import { createElement } from '../../../helper/ElementHelper';
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
getBusinessObject,
|
|
8
|
-
is
|
|
9
|
-
} from 'bpmn-js/lib/util/ModelUtil';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
createFormDefinition,
|
|
13
|
-
createFormId,
|
|
14
|
-
createFormKey,
|
|
15
|
-
createUserTaskForm,
|
|
16
|
-
getFormDefinition,
|
|
17
|
-
getUserTaskForm
|
|
18
|
-
} from '../../../helper/FormsHelper';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Zeebe BPMN specific form definition behavior.
|
|
23
|
-
*/
|
|
24
|
-
export default class FormDefinitionBehavior extends CommandInterceptor {
|
|
25
|
-
constructor(bpmnFactory, eventBus, modeling) {
|
|
26
|
-
super(eventBus);
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Remove zeebe:UserTaskForm on user task removed.
|
|
30
|
-
*/
|
|
31
|
-
this.postExecute('shape.delete', function(context) {
|
|
32
|
-
const {
|
|
33
|
-
oldParent,
|
|
34
|
-
shape
|
|
35
|
-
} = context;
|
|
36
|
-
|
|
37
|
-
const rootElement = getRootElement(oldParent);
|
|
38
|
-
|
|
39
|
-
const userTaskForm = getUserTaskForm(shape, rootElement);
|
|
40
|
-
|
|
41
|
-
if (!is(shape, 'bpmn:UserTask') || !userTaskForm) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const rootExtensionElements = rootElement.get('extensionElements');
|
|
46
|
-
|
|
47
|
-
const values = rootExtensionElements.get('values').filter((element) => {
|
|
48
|
-
return element !== userTaskForm;
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
modeling.updateModdleProperties(shape, rootExtensionElements, { values });
|
|
52
|
-
}, true);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Create new zeebe:FormDefinition and zeebe:UserTaskForm on user task created.
|
|
57
|
-
*/
|
|
58
|
-
this.postExecute('shape.create', function(context) {
|
|
59
|
-
const { shape } = context;
|
|
60
|
-
|
|
61
|
-
const oldFormDefinition = getFormDefinition(shape);
|
|
62
|
-
|
|
63
|
-
if (!is(shape, 'bpmn:UserTask') || !oldFormDefinition) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const oldUserTaskForm = getUserTaskForm(shape);
|
|
68
|
-
|
|
69
|
-
const rootElement = getRootElement(shape);
|
|
70
|
-
|
|
71
|
-
const businessObject = getBusinessObject(shape);
|
|
72
|
-
|
|
73
|
-
const extensionElements = businessObject.get('extensionElements');
|
|
74
|
-
|
|
75
|
-
let rootExtensionElements = rootElement.get('extensionElements');
|
|
76
|
-
|
|
77
|
-
// (1) ensure extension elements exists
|
|
78
|
-
if (!rootExtensionElements) {
|
|
79
|
-
rootExtensionElements = createElement('bpmn:ExtensionElements', { values: [] }, rootElement, bpmnFactory);
|
|
80
|
-
|
|
81
|
-
modeling.updateModdleProperties(shape, rootElement, { extensionElements: rootExtensionElements });
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// (2) remove existing form definition
|
|
85
|
-
let values = extensionElements.get('values').filter((element) => {
|
|
86
|
-
return element !== oldFormDefinition;
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
// (3) create new form definition
|
|
90
|
-
const formId = createFormId();
|
|
91
|
-
|
|
92
|
-
const newFormDefinition = createFormDefinition({ formKey: createFormKey(formId) }, extensionElements, bpmnFactory);
|
|
93
|
-
|
|
94
|
-
values = [
|
|
95
|
-
...values,
|
|
96
|
-
newFormDefinition
|
|
97
|
-
];
|
|
98
|
-
|
|
99
|
-
modeling.updateModdleProperties(shape, extensionElements, {
|
|
100
|
-
values
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
// (4) create new user task form
|
|
104
|
-
const userTaskForm = createUserTaskForm({
|
|
105
|
-
id: formId,
|
|
106
|
-
body: oldUserTaskForm ? oldUserTaskForm.get('body') : ''
|
|
107
|
-
}, rootExtensionElements, bpmnFactory);
|
|
108
|
-
|
|
109
|
-
modeling.updateModdleProperties(shape, rootExtensionElements, {
|
|
110
|
-
values: [
|
|
111
|
-
...(rootExtensionElements.get('values') || []),
|
|
112
|
-
userTaskForm
|
|
113
|
-
]
|
|
114
|
-
});
|
|
115
|
-
}, true);
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
FormDefinitionBehavior.$inject = [
|
|
121
|
-
'bpmnFactory',
|
|
122
|
-
'eventBus',
|
|
123
|
-
'modeling'
|
|
124
|
-
];
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
// helpers //////////////
|
|
128
|
-
|
|
129
|
-
function getRootElement(element) {
|
|
130
|
-
var businessObject = getBusinessObject(element),
|
|
131
|
-
parent = businessObject;
|
|
132
|
-
|
|
133
|
-
while (parent.$parent && !is(parent, 'bpmn:Process')) {
|
|
134
|
-
parent = parent.$parent;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return parent;
|
|
138
|
-
}
|
package/lib/camunda-cloud/features/modeling/behavior/UpdatePropagateAllChildVariablesBehavior.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getBusinessObject,
|
|
3
|
-
is
|
|
4
|
-
} from 'bpmn-js/lib/util/ModelUtil';
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
getCalledElement,
|
|
8
|
-
isPropagateAllChildVariables
|
|
9
|
-
} from '../../../helper/CalledElementHelper';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
getInputParameters,
|
|
13
|
-
getOutputParameters,
|
|
14
|
-
getIoMapping
|
|
15
|
-
} from '../../../helper/InputOutputHelper';
|
|
16
|
-
|
|
17
|
-
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
18
|
-
|
|
19
|
-
const HIGH_PRIORITY = 5000;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Zeebe BPMN behavior for updating zeebe:propagateAllChildVariables.
|
|
24
|
-
*/
|
|
25
|
-
export default class UpdatePropagateAllChildVariablesBehavior extends CommandInterceptor {
|
|
26
|
-
constructor(eventBus, modeling) {
|
|
27
|
-
super(eventBus);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Remove zeebe:OutputParameters when zeebe:propagateAllChildVariables is set to true.
|
|
31
|
-
*/
|
|
32
|
-
this.postExecute('properties-panel.update-businessobject' , HIGH_PRIORITY, function(context) {
|
|
33
|
-
const {
|
|
34
|
-
element,
|
|
35
|
-
properties
|
|
36
|
-
} = context;
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
!is(element, 'bpmn:CallActivity')
|
|
40
|
-
|| !properties
|
|
41
|
-
|| !!properties.propagateAllChildVariables === false
|
|
42
|
-
) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const inputParameters = getInputParameters(element),
|
|
47
|
-
outputParameters = getOutputParameters(element);
|
|
48
|
-
|
|
49
|
-
if (!outputParameters || !outputParameters.length) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const ioMapping = getIoMapping(element);
|
|
54
|
-
|
|
55
|
-
modeling.updateModdleProperties(element, ioMapping, {
|
|
56
|
-
'zeebe:outputParameters': []
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
if (!inputParameters || !inputParameters.length) {
|
|
60
|
-
const businessObject = getBusinessObject(element),
|
|
61
|
-
extensionElements = businessObject.get('extensionElements');
|
|
62
|
-
|
|
63
|
-
const values = extensionElements.get('values').filter((element) => {
|
|
64
|
-
return !is(element, 'zeebe:IoMapping');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
modeling.updateModdleProperties(element, extensionElements, {
|
|
68
|
-
values
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}, true);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Set zeebe:propagateAllChildVariables to false on zeebe:Output added.
|
|
76
|
-
*/
|
|
77
|
-
this.postExecute('properties-panel.update-businessobject-list' , HIGH_PRIORITY, function(context) {
|
|
78
|
-
const {
|
|
79
|
-
currentObject,
|
|
80
|
-
element,
|
|
81
|
-
objectsToAdd,
|
|
82
|
-
propertyName
|
|
83
|
-
} = context;
|
|
84
|
-
|
|
85
|
-
if (!is(element, 'bpmn:CallActivity')
|
|
86
|
-
|| !is(currentObject, 'zeebe:IoMapping')
|
|
87
|
-
|| (propertyName !== 'outputParameters' && propertyName !== 'zeebe:outputParameters')
|
|
88
|
-
|| !objectsToAdd
|
|
89
|
-
|| !objectsToAdd.length
|
|
90
|
-
|| !objectsToAdd.find((object) => is(object, 'zeebe:Output'))
|
|
91
|
-
|| !isPropagateAllChildVariables(element)) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const businessObject = getBusinessObject(element),
|
|
96
|
-
calledElement = getCalledElement(businessObject);
|
|
97
|
-
|
|
98
|
-
modeling.updateModdleProperties(element, calledElement, {
|
|
99
|
-
'zeebe:propagateAllChildVariables': false
|
|
100
|
-
});
|
|
101
|
-
}, true);
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
UpdatePropagateAllChildVariablesBehavior.$inject = [
|
|
107
|
-
'eventBus',
|
|
108
|
-
'modeling'
|
|
109
|
-
];
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import CleanUpAssignmentDefinitionBehavior from './CleanUpAssignmentDefinitionBehavior';
|
|
2
|
-
import CleanUpBusinessRuleTaskBehavior from './CleanUpBusinessRuleTaskBehavior';
|
|
3
|
-
import CreateZeebeBoundaryEventBehavior from './CreateZeebeBoundaryEventBehavior';
|
|
4
|
-
import CreateZeebeCallActivityBehavior from './CreateZeebeCallActivityBehavior';
|
|
5
|
-
import UpdatePropagateAllChildVariablesBehavior from './UpdatePropagateAllChildVariablesBehavior';
|
|
6
|
-
import FormDefinitionBehavior from './FormDefinitionBehavior';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
__init__: [
|
|
11
|
-
'cleanUpAssignmentDefinitionBehavior',
|
|
12
|
-
'cleanUpBusinessRuleTaskBehavior',
|
|
13
|
-
'createZeebeBoundaryEventBehavior',
|
|
14
|
-
'createZeebeCallActivityBehavior',
|
|
15
|
-
'updatePropagateAllChildVariablesBehavior',
|
|
16
|
-
'formDefinitionBehavior'
|
|
17
|
-
],
|
|
18
|
-
cleanUpAssignmentDefinitionBehavior: [ 'type', CleanUpAssignmentDefinitionBehavior ],
|
|
19
|
-
cleanUpBusinessRuleTaskBehavior: [ 'type', CleanUpBusinessRuleTaskBehavior ],
|
|
20
|
-
createZeebeBoundaryEventBehavior: [ 'type', CreateZeebeBoundaryEventBehavior ],
|
|
21
|
-
createZeebeCallActivityBehavior: [ 'type', CreateZeebeCallActivityBehavior ],
|
|
22
|
-
updatePropagateAllChildVariablesBehavior: [ 'type', UpdatePropagateAllChildVariablesBehavior ],
|
|
23
|
-
formDefinitionBehavior: [ 'type', FormDefinitionBehavior ]
|
|
24
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { has } from 'min-dash';
|
|
2
|
-
|
|
3
|
-
import { getOutputParameters } from './InputOutputHelper';
|
|
4
|
-
|
|
5
|
-
import { getExtensionElements } from './ExtensionElementsHelper';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
getBusinessObject,
|
|
9
|
-
is
|
|
10
|
-
} from 'bpmn-js/lib/util/ModelUtil';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Get default value for zeebe:propagateAllChildVariables.
|
|
15
|
-
*
|
|
16
|
-
* @param {djs.model.Base|ModdleElement} element
|
|
17
|
-
*
|
|
18
|
-
* @returns {boolean}
|
|
19
|
-
*/
|
|
20
|
-
function getPropagateAllChildVariablesDefault(element) {
|
|
21
|
-
if (!is(element, 'bpmn:CallActivity')) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const outputParameters = getOutputParameters(element);
|
|
26
|
-
|
|
27
|
-
if (outputParameters) {
|
|
28
|
-
return !outputParameters.length;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Get zeebe:CalledElement of an element.
|
|
34
|
-
*
|
|
35
|
-
* @param {djs.model.Base|ModdleElement} element
|
|
36
|
-
*
|
|
37
|
-
* @returns {ModdleElement}
|
|
38
|
-
*/
|
|
39
|
-
export function getCalledElement(element) {
|
|
40
|
-
const calledElements = getCalledElements(element);
|
|
41
|
-
|
|
42
|
-
return calledElements[ 0 ];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function getCalledElements(element) {
|
|
46
|
-
const businessObject = getBusinessObject(element);
|
|
47
|
-
|
|
48
|
-
return getExtensionElements(businessObject, 'zeebe:CalledElement');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Check whether zeebe:propagateAllChildVariables is set on an element.
|
|
53
|
-
* Fall back to default if zeebe:propagateAllChildVariables not set.
|
|
54
|
-
*
|
|
55
|
-
* @param {djs.model.Base|ModdleElement} element
|
|
56
|
-
*
|
|
57
|
-
* @returns {boolean}
|
|
58
|
-
*/
|
|
59
|
-
export function isPropagateAllChildVariables(element) {
|
|
60
|
-
if (!is(element, 'bpmn:CallActivity')) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const businessObject = getBusinessObject(element),
|
|
65
|
-
calledElement = getCalledElement(businessObject);
|
|
66
|
-
|
|
67
|
-
if (calledElement && has(calledElement, 'propagateAllChildVariables')) {
|
|
68
|
-
return calledElement.get('propagateAllChildVariables');
|
|
69
|
-
} else {
|
|
70
|
-
return getPropagateAllChildVariablesDefault(element);
|
|
71
|
-
}
|
|
72
|
-
}
|