camunda-bpmn-js 0.13.0-alpha.8 → 0.13.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/CHANGELOG.md +13 -0
- package/dist/assets/base-navigated-viewer.css +2 -0
- package/dist/assets/base-viewer.css +2 -0
- 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/properties-panel.css +900 -901
- 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 +1249 -944
- 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 +1464 -1381
- 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/Modeler.js +7 -11
- 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/package.json +9 -4
- package/styles/base-navigated-viewer.css +2 -0
- package/styles/base-viewer.css +2 -0
- 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/lib/camunda-cloud/features/modeling/behavior/CleanUpBusinessRuleTaskBehavior.js +0 -115
- package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeBoundaryEventBehavior.js +0 -76
- package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeCallActivityBehavior.js +0 -86
- package/lib/camunda-cloud/features/modeling/behavior/FormDefinitionBehavior.js +0 -138
- package/lib/camunda-cloud/features/modeling/behavior/RemoveAssignmentDefinitionBehavior.js +0 -51
- package/lib/camunda-cloud/features/modeling/behavior/UpdatePropagateAllChildVariablesBehavior.js +0 -136
- 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/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 -54
- package/lib/camunda-platform/features/modeling/behavior/DeleteRetryTimeCycleBehavior.js +0 -96
- package/lib/camunda-platform/features/modeling/behavior/UpdateCamundaExclusiveBehavior.js +0 -68
- package/lib/camunda-platform/features/modeling/behavior/UpdateInputOutputBehavior.js +0 -44
- package/lib/camunda-platform/features/modeling/behavior/UpdateResultVariableBehavior.js +0 -54
- package/lib/camunda-platform/features/modeling/behavior/UserTaskFormsBehavior.js +0 -71
- package/lib/camunda-platform/features/modeling/behavior/UserTaskGeneratedFormsBehavior.js +0 -116
- 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,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
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { is } from 'bpmn-js/lib/util/ModelUtil';
|
|
2
|
-
|
|
3
|
-
import { getBusinessObject } from 'bpmn-js/lib/util/ModelUtil';
|
|
4
|
-
|
|
5
|
-
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
6
|
-
|
|
7
|
-
import { isUndefined } from 'min-dash';
|
|
8
|
-
|
|
9
|
-
import { removeExtensionElements } from '../../../../util/ExtensionElementsUtil';
|
|
10
|
-
|
|
11
|
-
const HIGH_PRIORITY = 5000;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Zeebe BPMN behavior removing zeebe:AssignmentDefinition elements without
|
|
16
|
-
* zeebe:assignee and zeebe:candidateGroups.
|
|
17
|
-
*/
|
|
18
|
-
export default class CleanUpBusinessRuleTaskBehavior extends CommandInterceptor {
|
|
19
|
-
constructor(commandStack, eventBus) {
|
|
20
|
-
super(eventBus);
|
|
21
|
-
|
|
22
|
-
this.postExecuted('element.updateModdleProperties' , HIGH_PRIORITY, function(context) {
|
|
23
|
-
const {
|
|
24
|
-
element,
|
|
25
|
-
moddleElement
|
|
26
|
-
} = context;
|
|
27
|
-
|
|
28
|
-
if (!is(moddleElement, 'zeebe:AssignmentDefinition')) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const assignmentDefinition = moddleElement;
|
|
33
|
-
|
|
34
|
-
if (
|
|
35
|
-
is(element, 'bpmn:UserTask')
|
|
36
|
-
&& isUndefined(assignmentDefinition.get('zeebe:assignee'))
|
|
37
|
-
&& isUndefined(assignmentDefinition.get('zeebe:candidateGroups'))
|
|
38
|
-
) {
|
|
39
|
-
const businessObject = getBusinessObject(element);
|
|
40
|
-
|
|
41
|
-
removeExtensionElements(element, businessObject, assignmentDefinition, commandStack);
|
|
42
|
-
}
|
|
43
|
-
}, true);
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
CleanUpBusinessRuleTaskBehavior.$inject = [
|
|
49
|
-
'commandStack',
|
|
50
|
-
'eventBus'
|
|
51
|
-
];
|
package/lib/camunda-cloud/features/modeling/behavior/UpdatePropagateAllChildVariablesBehavior.js
DELETED
|
@@ -1,136 +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
|
-
import {
|
|
9
|
-
getCalledElement,
|
|
10
|
-
isPropagateAllChildVariables
|
|
11
|
-
} from '../../../helper/CalledElementHelper';
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
getInputParameters,
|
|
15
|
-
getOutputParameters,
|
|
16
|
-
getIoMapping
|
|
17
|
-
} from '../../../helper/InputOutputHelper';
|
|
18
|
-
|
|
19
|
-
import {
|
|
20
|
-
removeExtensionElements
|
|
21
|
-
} from '../../../../util/ExtensionElementsUtil';
|
|
22
|
-
|
|
23
|
-
const HIGH_PRIORITY = 5000;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Zeebe BPMN behavior for updating bpmn:CallActivity elements
|
|
28
|
-
* ensuring that only one of the following is true:
|
|
29
|
-
*
|
|
30
|
-
* (1) zeebe:propagateAllChildVariables of zeebe:CalledElement is set to true
|
|
31
|
-
* (2) zeebe:IoMapping extension element has zeebe:Output elements
|
|
32
|
-
*/
|
|
33
|
-
export default class UpdatePropagateAllChildVariablesBehavior extends CommandInterceptor {
|
|
34
|
-
constructor(commandStack, eventBus, modeling) {
|
|
35
|
-
super(eventBus);
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Remove zeebe:Output elements if zeebe:propagateAllChildVariables is set to true.
|
|
39
|
-
* Remove zeebe:IoMapping extension element if empty.
|
|
40
|
-
*/
|
|
41
|
-
this.postExecute('element.updateModdleProperties' , HIGH_PRIORITY, function(context) {
|
|
42
|
-
const {
|
|
43
|
-
element,
|
|
44
|
-
moddleElement,
|
|
45
|
-
properties = {}
|
|
46
|
-
} = context;
|
|
47
|
-
|
|
48
|
-
const propagateAllChildVariables = properties.propagateAllChildVariables || properties[ 'zeebe:propagateAllChildVariables' ];
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
!is(element, 'bpmn:CallActivity')
|
|
52
|
-
|| !is(moddleElement, 'zeebe:CalledElement')
|
|
53
|
-
|| !propagateAllChildVariables
|
|
54
|
-
) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const inputParameters = getInputParameters(element),
|
|
59
|
-
outputParameters = getOutputParameters(element);
|
|
60
|
-
|
|
61
|
-
if (!outputParameters || !outputParameters.length) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const ioMapping = getIoMapping(element);
|
|
66
|
-
|
|
67
|
-
modeling.updateModdleProperties(element, ioMapping, {
|
|
68
|
-
'zeebe:outputParameters': []
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
if (!inputParameters || !inputParameters.length) {
|
|
72
|
-
removeExtensionElements(element, getBusinessObject(element), ioMapping, commandStack);
|
|
73
|
-
}
|
|
74
|
-
}, true);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Set zeebe:propagateAllChildVariables of zeebe:CalledElement to false if
|
|
79
|
-
* zeebe:Output or zeebe:IoMapping with zeebe:Output is added.
|
|
80
|
-
*/
|
|
81
|
-
this.preExecute('element.updateModdleProperties' , HIGH_PRIORITY, function(context) {
|
|
82
|
-
const {
|
|
83
|
-
element,
|
|
84
|
-
moddleElement,
|
|
85
|
-
properties
|
|
86
|
-
} = context;
|
|
87
|
-
|
|
88
|
-
if (
|
|
89
|
-
!is(element, 'bpmn:CallActivity')
|
|
90
|
-
|| !isPropagateAllChildVariables(element)
|
|
91
|
-
) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const businessObject = getBusinessObject(element),
|
|
96
|
-
calledElement = getCalledElement(businessObject);
|
|
97
|
-
|
|
98
|
-
// (1) zeebe:IoMapping extension element with zeebe:Output added
|
|
99
|
-
if (
|
|
100
|
-
is(moddleElement, 'bpmn:ExtensionElements')
|
|
101
|
-
&& properties.values
|
|
102
|
-
) {
|
|
103
|
-
const ioMapping = properties.values.find((value) => is(value, 'zeebe:IoMapping'));
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
ioMapping
|
|
107
|
-
&& ioMapping.get('outputParameters').length
|
|
108
|
-
&& !getIoMapping(element)
|
|
109
|
-
) {
|
|
110
|
-
modeling.updateModdleProperties(element, calledElement, {
|
|
111
|
-
'zeebe:propagateAllChildVariables': false
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// (2) zeebe:Output added
|
|
117
|
-
if (is(moddleElement, 'zeebe:IoMapping')) {
|
|
118
|
-
const outputParameters = properties.outputParameters || properties[ 'zeebe:outputParameters' ];
|
|
119
|
-
|
|
120
|
-
if (outputParameters && outputParameters.length) {
|
|
121
|
-
modeling.updateModdleProperties(element, calledElement, {
|
|
122
|
-
'zeebe:propagateAllChildVariables': false
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
}, true);
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
UpdatePropagateAllChildVariablesBehavior.$inject = [
|
|
133
|
-
'commandStack',
|
|
134
|
-
'eventBus',
|
|
135
|
-
'modeling'
|
|
136
|
-
];
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import CleanUpBusinessRuleTaskBehavior from './CleanUpBusinessRuleTaskBehavior';
|
|
2
|
-
import CreateZeebeBoundaryEventBehavior from './CreateZeebeBoundaryEventBehavior';
|
|
3
|
-
import CreateZeebeCallActivityBehavior from './CreateZeebeCallActivityBehavior';
|
|
4
|
-
import FormDefinitionBehavior from './FormDefinitionBehavior';
|
|
5
|
-
import RemoveAssignmentDefinitionBehavior from './RemoveAssignmentDefinitionBehavior';
|
|
6
|
-
import UpdatePropagateAllChildVariablesBehavior from './UpdatePropagateAllChildVariablesBehavior';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
__init__: [
|
|
11
|
-
'cleanUpBusinessRuleTaskBehavior',
|
|
12
|
-
'createZeebeBoundaryEventBehavior',
|
|
13
|
-
'createZeebeCallActivityBehavior',
|
|
14
|
-
'formDefinitionBehavior',
|
|
15
|
-
'removeAssignmentDefinitionBehavior',
|
|
16
|
-
'updatePropagateAllChildVariablesBehavior'
|
|
17
|
-
],
|
|
18
|
-
cleanUpBusinessRuleTaskBehavior: [ 'type', CleanUpBusinessRuleTaskBehavior ],
|
|
19
|
-
createZeebeBoundaryEventBehavior: [ 'type', CreateZeebeBoundaryEventBehavior ],
|
|
20
|
-
createZeebeCallActivityBehavior: [ 'type', CreateZeebeCallActivityBehavior ],
|
|
21
|
-
formDefinitionBehavior: [ 'type', FormDefinitionBehavior ],
|
|
22
|
-
removeAssignmentDefinitionBehavior: [ 'type', RemoveAssignmentDefinitionBehavior ],
|
|
23
|
-
updatePropagateAllChildVariablesBehavior: [ 'type', UpdatePropagateAllChildVariablesBehavior ]
|
|
24
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { has } from 'min-dash';
|
|
2
|
-
|
|
3
|
-
import { getOutputParameters } from './InputOutputHelper';
|
|
4
|
-
|
|
5
|
-
import { getExtensionElementsList } from '../../util/ExtensionElementsUtil';
|
|
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 false;
|
|
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 getExtensionElementsList(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 false;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const businessObject = getBusinessObject(element),
|
|
65
|
-
calledElement = getCalledElement(businessObject);
|
|
66
|
-
|
|
67
|
-
if (calledElement && has(calledElement, 'propagateAllChildVariables')) {
|
|
68
|
-
return calledElement.get('propagateAllChildVariables') || false;
|
|
69
|
-
} else {
|
|
70
|
-
return getPropagateAllChildVariablesDefault(element);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates a new element and set the parent to it
|
|
3
|
-
*
|
|
4
|
-
* @method ElementHelper#createElement
|
|
5
|
-
*
|
|
6
|
-
* @param {String} elementType of the new element
|
|
7
|
-
* @param {Object} properties of the new element in key-value pairs
|
|
8
|
-
* @param {moddle.object} parent of the new element
|
|
9
|
-
* @param {BpmnFactory} factory which creates the new element
|
|
10
|
-
*
|
|
11
|
-
* @returns {djs.model.Base} element which is created
|
|
12
|
-
*/
|
|
13
|
-
export function createElement(elementType, properties, parent, factory) {
|
|
14
|
-
var element = factory.create(elementType, properties);
|
|
15
|
-
element.$parent = parent;
|
|
16
|
-
|
|
17
|
-
return element;
|
|
18
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { getExtensionElementsList } from '../../util/ExtensionElementsUtil';
|
|
2
|
-
|
|
3
|
-
import { createElement } from './ElementHelper';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
getBusinessObject,
|
|
7
|
-
is
|
|
8
|
-
} from 'bpmn-js/lib/util/ModelUtil';
|
|
9
|
-
|
|
10
|
-
import { nextId } from './Utils';
|
|
11
|
-
|
|
12
|
-
import { find } from 'min-dash';
|
|
13
|
-
|
|
14
|
-
const USER_TASK_FORM_PREFIX = 'UserTaskForm_';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export function createFormDefinition(properties, extensionElements, bpmnFactory) {
|
|
18
|
-
return createElement(
|
|
19
|
-
'zeebe:FormDefinition',
|
|
20
|
-
properties,
|
|
21
|
-
extensionElements,
|
|
22
|
-
bpmnFactory
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function createFormId() {
|
|
27
|
-
return nextId(USER_TASK_FORM_PREFIX);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function createFormKey(formId) {
|
|
31
|
-
return `camunda-forms:bpmn:${ formId }`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function createUserTaskForm(properties, extensionElements, bpmnFactory) {
|
|
35
|
-
return createElement(
|
|
36
|
-
'zeebe:UserTaskForm',
|
|
37
|
-
properties,
|
|
38
|
-
extensionElements,
|
|
39
|
-
bpmnFactory
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function findUserTaskForm(formKey, rootElement) {
|
|
44
|
-
const userTaskForms = getExtensionElementsList(rootElement, 'zeebe:UserTaskForm');
|
|
45
|
-
|
|
46
|
-
return find(userTaskForms, (userTaskForm) => {
|
|
47
|
-
const id = userTaskForm.get('zeebe:id');
|
|
48
|
-
|
|
49
|
-
return createFormKey(id) === formKey;
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function getFormDefinition(element) {
|
|
54
|
-
const businessObject = getBusinessObject(element);
|
|
55
|
-
|
|
56
|
-
const formDefinitions = getExtensionElementsList(businessObject, 'zeebe:FormDefinition');
|
|
57
|
-
|
|
58
|
-
return formDefinitions[ 0 ];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function getRootElement(element) {
|
|
62
|
-
var businessObject = getBusinessObject(element),
|
|
63
|
-
parent = businessObject;
|
|
64
|
-
|
|
65
|
-
while (parent.$parent && !is(parent, 'bpmn:Process')) {
|
|
66
|
-
parent = parent.$parent;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return parent;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function getUserTaskForm(element, parent) {
|
|
73
|
-
const rootElement = parent || getRootElement(element);
|
|
74
|
-
|
|
75
|
-
const formDefinition = getFormDefinition(element);
|
|
76
|
-
|
|
77
|
-
if (!formDefinition) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const formKey = formDefinition.get('zeebe:formKey');
|
|
82
|
-
|
|
83
|
-
return findUserTaskForm(formKey, rootElement);
|
|
84
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getBusinessObject,
|
|
3
|
-
is
|
|
4
|
-
} from 'bpmn-js/lib/util/ModelUtil';
|
|
5
|
-
|
|
6
|
-
import { isAny } from 'bpmn-js/lib/features/modeling/util/ModelingUtil';
|
|
7
|
-
|
|
8
|
-
import { createElement } from './ElementHelper';
|
|
9
|
-
|
|
10
|
-
import { isZeebeServiceTask } from './ZeebeServiceTaskHelper';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Get zeebe:IoMapping from an element.
|
|
15
|
-
*
|
|
16
|
-
* @param {djs.model.Base|ModdleElement} element
|
|
17
|
-
*
|
|
18
|
-
* @return {ModdleElement}
|
|
19
|
-
*/
|
|
20
|
-
export function getIoMapping(element) {
|
|
21
|
-
const businessObject = getBusinessObject(element);
|
|
22
|
-
|
|
23
|
-
const extensionElements = businessObject.get('extensionElements');
|
|
24
|
-
|
|
25
|
-
if (!extensionElements) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return extensionElements.get('values').find((value) => {
|
|
30
|
-
return is(value, 'zeebe:IoMapping');
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Get zeebe:InputParameters from an element.
|
|
36
|
-
*
|
|
37
|
-
* @param {djs.model.Base|ModdleElement} element
|
|
38
|
-
*
|
|
39
|
-
* @return {Array<ModdleElement>}
|
|
40
|
-
*/
|
|
41
|
-
export function getInputParameters(element) {
|
|
42
|
-
const ioMapping = getIoMapping(element);
|
|
43
|
-
|
|
44
|
-
if (ioMapping) {
|
|
45
|
-
return ioMapping.get('zeebe:inputParameters');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return [];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Get zeebe:OutputParameters from an element.
|
|
53
|
-
*
|
|
54
|
-
* @param {djs.model.Base|ModdleElement} element
|
|
55
|
-
*
|
|
56
|
-
* @return {Array<ModdleElement>}
|
|
57
|
-
*/
|
|
58
|
-
export function getOutputParameters(element) {
|
|
59
|
-
const ioMapping = getIoMapping(element);
|
|
60
|
-
|
|
61
|
-
if (ioMapping) {
|
|
62
|
-
return ioMapping.get('zeebe:outputParameters');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return [];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Get zeebe:Input at index.
|
|
70
|
-
*
|
|
71
|
-
* @param {djs.model.Base|ModdleElement} element
|
|
72
|
-
* @param {number} index
|
|
73
|
-
*
|
|
74
|
-
* @return {ModdleElement}
|
|
75
|
-
*/
|
|
76
|
-
export function getInputParameter(element, index) {
|
|
77
|
-
return getInputParameters(element)[ index ];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Get zeebe:Output at index.
|
|
82
|
-
*
|
|
83
|
-
* @param {djs.model.Base|ModdleElement} element
|
|
84
|
-
* @param {number} index
|
|
85
|
-
*
|
|
86
|
-
* @return {ModdleElement}
|
|
87
|
-
*/
|
|
88
|
-
export function getOutputParameter(element, index) {
|
|
89
|
-
return getOutputParameters(element)[ index ];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Check whether element supports zeebe:Input or zeebe:Output.
|
|
94
|
-
*
|
|
95
|
-
* @param {djs.model.Base|ModdleElement} element
|
|
96
|
-
*
|
|
97
|
-
* @return {boolean}
|
|
98
|
-
*/
|
|
99
|
-
export function isInputOutputSupported(element) {
|
|
100
|
-
return areInputParametersSupported(element) || areOutputParametersSupported(element);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Check whether element supports zeebe:Input.
|
|
105
|
-
*
|
|
106
|
-
* @param {djs.model.Base|ModdleElement} element
|
|
107
|
-
*
|
|
108
|
-
* @return {boolean}
|
|
109
|
-
*/
|
|
110
|
-
export function areInputParametersSupported(element) {
|
|
111
|
-
return isAny(element, [
|
|
112
|
-
'bpmn:CallActivity',
|
|
113
|
-
'bpmn:SubProcess',
|
|
114
|
-
'bpmn:UserTask'
|
|
115
|
-
]) || isZeebeServiceTask(element);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Check whether element supports zeebe:Output.
|
|
120
|
-
*
|
|
121
|
-
* @param {djs.model.Base|ModdleElement} element
|
|
122
|
-
*
|
|
123
|
-
* @return {boolean}
|
|
124
|
-
*/
|
|
125
|
-
export function areOutputParametersSupported(element) {
|
|
126
|
-
return isAny(element, [
|
|
127
|
-
'bpmn:CallActivity',
|
|
128
|
-
'bpmn:Event',
|
|
129
|
-
'bpmn:ReceiveTask',
|
|
130
|
-
'bpmn:SubProcess',
|
|
131
|
-
'bpmn:UserTask',
|
|
132
|
-
'zeebe:ZeebeServiceTask'
|
|
133
|
-
]);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export function createIoMapping(parent, bpmnFactory, properties) {
|
|
137
|
-
return createElement('zeebe:IoMapping', properties, parent, bpmnFactory);
|
|
138
|
-
}
|