camunda-bpmn-js 0.11.3 → 0.12.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 +25 -0
- package/dist/assets/properties-panel.css +780 -0
- package/dist/base-modeler.development.js +383 -104
- package/dist/base-modeler.production.min.js +3 -3
- package/dist/camunda-cloud-modeler.development.js +952 -609
- package/dist/camunda-cloud-modeler.production.min.js +3 -3
- package/dist/camunda-platform-modeler.development.js +561 -374
- package/dist/camunda-platform-modeler.production.min.js +3 -3
- 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 +3 -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 +6 -6
package/lib/camunda-cloud/features/modeling/behavior/UpdatePropagateAllChildVariablesBehavior.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
getBusinessObject
|
|
2
|
+
getBusinessObject,
|
|
3
|
+
is
|
|
3
4
|
} from 'bpmn-js/lib/util/ModelUtil';
|
|
4
5
|
|
|
5
|
-
import inherits from 'inherits';
|
|
6
|
-
|
|
7
|
-
import { is } from 'bpmn-js/lib/util/ModelUtil';
|
|
8
|
-
|
|
9
6
|
import {
|
|
10
7
|
getCalledElement,
|
|
11
8
|
isPropagateAllChildVariables
|
|
@@ -14,148 +11,99 @@ import {
|
|
|
14
11
|
import {
|
|
15
12
|
getInputParameters,
|
|
16
13
|
getOutputParameters,
|
|
17
|
-
|
|
14
|
+
getIoMapping
|
|
18
15
|
} from '../../../helper/InputOutputHelper';
|
|
19
16
|
|
|
20
17
|
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
21
18
|
|
|
22
|
-
const HIGH_PRIORITY =
|
|
19
|
+
const HIGH_PRIORITY = 5000;
|
|
23
20
|
|
|
24
21
|
|
|
25
22
|
/**
|
|
26
|
-
*
|
|
27
|
-
* when there are outputParameters present or (2) to adding outputParameters when
|
|
28
|
-
* propagateAllChildVariables is set to true.
|
|
29
|
-
* It will ensure that the propagateAllChildVariables attribute on calledElement
|
|
30
|
-
* extensionElements for callActivities is always consistent with outputParameter mappings
|
|
23
|
+
* Zeebe BPMN behavior for updating zeebe:propagateAllChildVariables.
|
|
31
24
|
*/
|
|
32
|
-
export default
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (!is(element, 'bpmn:CallActivity') ||
|
|
52
|
-
!properties ||
|
|
53
|
-
!!properties.propagateAllChildVariables === false) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// (2) Check whether we have outputParameters
|
|
58
|
-
const outputParameters = getOutputParameters(element),
|
|
59
|
-
inputParameters = getInputParameters(element);
|
|
60
|
-
|
|
61
|
-
if (!outputParameters ||
|
|
62
|
-
outputParameters.length === 0) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// (3) Store old outputParameters and remove them
|
|
67
|
-
context.oldOutputParameters = outputParameters;
|
|
68
|
-
|
|
69
|
-
const inputOutput = getInputOutput(element);
|
|
70
|
-
inputOutput.outputParameters = [];
|
|
71
|
-
|
|
72
|
-
// (4) if we also have no inputParameters, store IOMapping and remove it
|
|
73
|
-
if (!inputParameters || inputParameters.length === 0) {
|
|
74
|
-
const extensionElements = getBusinessObject(element).extensionElements;
|
|
75
|
-
context.oldExtensionElements = extensionElements.values;
|
|
76
|
-
|
|
77
|
-
extensionElements.values = extensionElements.values.filter(ele => ele.$type !== 'zeebe:IoMapping');
|
|
78
|
-
}
|
|
79
|
-
}, true);
|
|
80
|
-
|
|
81
|
-
// Revert behavior when toggling propagateAllChildVariables //////////////////
|
|
82
|
-
this.reverted('properties-panel.update-businessobject', HIGH_PRIORITY, function(context) {
|
|
83
|
-
const {
|
|
84
|
-
element,
|
|
85
|
-
oldOutputParameters,
|
|
86
|
-
oldExtensionElements
|
|
87
|
-
} = context;
|
|
88
|
-
|
|
89
|
-
// (1) Only intercept the revert, if the behavior became active
|
|
90
|
-
if (oldOutputParameters) {
|
|
91
|
-
|
|
92
|
-
// (2) If we removed the IOMapping, bring it back first
|
|
93
|
-
if (oldExtensionElements) {
|
|
94
|
-
const extensionElements = getBusinessObject(element).extensionElements;
|
|
95
|
-
|
|
96
|
-
extensionElements.values = oldExtensionElements;
|
|
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;
|
|
97
44
|
}
|
|
98
45
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
inputOutput.outputParameters = oldOutputParameters;
|
|
102
|
-
}
|
|
103
|
-
}, true);
|
|
104
|
-
|
|
46
|
+
const inputParameters = getInputParameters(element),
|
|
47
|
+
outputParameters = getOutputParameters(element);
|
|
105
48
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
*/
|
|
110
|
-
this.executed('properties-panel.update-businessobject-list' , HIGH_PRIORITY, function(context) {
|
|
111
|
-
const {
|
|
112
|
-
element,
|
|
113
|
-
objectsToAdd
|
|
114
|
-
} = context;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// (1) Exit if we are not in a CallActivity, not adding an OutputParameter or not
|
|
118
|
-
// having set propagateAllChildVariables to false
|
|
119
|
-
if (!is(element, 'bpmn:CallActivity') ||
|
|
120
|
-
!objectsToAdd ||
|
|
121
|
-
objectsToAdd.length === 0 ||
|
|
122
|
-
objectsToAdd.filter(obj => is(obj, 'zeebe:Output')).length === 0 ||
|
|
123
|
-
isPropagateAllChildVariables(element) === false) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
49
|
+
if (!outputParameters || !outputParameters.length) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
126
52
|
|
|
127
|
-
|
|
128
|
-
const bo = getBusinessObject(element),
|
|
129
|
-
calledElement = getCalledElement(bo);
|
|
53
|
+
const ioMapping = getIoMapping(element);
|
|
130
54
|
|
|
131
|
-
|
|
55
|
+
modeling.updateModdleProperties(element, ioMapping, {
|
|
56
|
+
'zeebe:outputParameters': []
|
|
57
|
+
});
|
|
132
58
|
|
|
133
|
-
|
|
134
|
-
|
|
59
|
+
if (!inputParameters || !inputParameters.length) {
|
|
60
|
+
const businessObject = getBusinessObject(element),
|
|
61
|
+
extensionElements = businessObject.get('extensionElements');
|
|
135
62
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
element,
|
|
140
|
-
oldPropagateAllChildVariables
|
|
141
|
-
} = context;
|
|
63
|
+
const values = extensionElements.get('values').filter((element) => {
|
|
64
|
+
return !is(element, 'zeebe:IoMapping');
|
|
65
|
+
});
|
|
142
66
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
+
}
|
|
147
94
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}, true);
|
|
95
|
+
const businessObject = getBusinessObject(element),
|
|
96
|
+
calledElement = getCalledElement(businessObject);
|
|
151
97
|
|
|
98
|
+
modeling.updateModdleProperties(element, calledElement, {
|
|
99
|
+
'zeebe:propagateAllChildVariables': false
|
|
100
|
+
});
|
|
101
|
+
}, true);
|
|
152
102
|
|
|
103
|
+
}
|
|
153
104
|
}
|
|
154
105
|
|
|
155
|
-
|
|
156
106
|
UpdatePropagateAllChildVariablesBehavior.$inject = [
|
|
157
|
-
'eventBus'
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
inherits(UpdatePropagateAllChildVariablesBehavior, CommandInterceptor);
|
|
107
|
+
'eventBus',
|
|
108
|
+
'modeling'
|
|
109
|
+
];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import CleanUpBusinessRuleTaskBehavior from './CleanUpBusinessRuleTaskBehavior';
|
|
1
2
|
import CreateZeebeBoundaryEventBehavior from './CreateZeebeBoundaryEventBehavior';
|
|
2
3
|
import CreateZeebeCallActivityBehavior from './CreateZeebeCallActivityBehavior';
|
|
3
4
|
import UpdatePropagateAllChildVariablesBehavior from './UpdatePropagateAllChildVariablesBehavior';
|
|
@@ -6,11 +7,13 @@ import FormDefinitionBehavior from './FormDefinitionBehavior';
|
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
__init__: [
|
|
10
|
+
'cleanUpBusinessRuleTaskBehavior',
|
|
9
11
|
'createZeebeBoundaryEventBehavior',
|
|
10
12
|
'createZeebeCallActivityBehavior',
|
|
11
13
|
'updatePropagateAllChildVariablesBehavior',
|
|
12
14
|
'formDefinitionBehavior'
|
|
13
15
|
],
|
|
16
|
+
cleanUpBusinessRuleTaskBehavior: [ 'type', CleanUpBusinessRuleTaskBehavior ],
|
|
14
17
|
createZeebeBoundaryEventBehavior: [ 'type', CreateZeebeBoundaryEventBehavior ],
|
|
15
18
|
createZeebeCallActivityBehavior: [ 'type', CreateZeebeCallActivityBehavior ],
|
|
16
19
|
updatePropagateAllChildVariablesBehavior: [ 'type', UpdatePropagateAllChildVariablesBehavior ],
|
|
@@ -15,11 +15,12 @@ import entryFieldDescription from 'bpmn-js-properties-panel/lib/factory/EntryFie
|
|
|
15
15
|
import {
|
|
16
16
|
areOutputParametersSupported,
|
|
17
17
|
areInputParametersSupported,
|
|
18
|
-
|
|
18
|
+
createIoMapping,
|
|
19
19
|
createElement as createParameter,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
getIoMapping,
|
|
21
|
+
isInputOutputSupported,
|
|
22
|
+
getInputParameters,
|
|
23
|
+
getOutputParameters
|
|
23
24
|
} from '../../../../helper/InputOutputHelper';
|
|
24
25
|
|
|
25
26
|
import InputOutputParameter from './InputOutputParameter';
|
|
@@ -130,12 +131,12 @@ function getParametersHeadingEntry(element, bpmnFactory, options) {
|
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
// Get the IOMapping
|
|
133
|
-
let inputOutput =
|
|
134
|
+
let inputOutput = getIoMapping(element);
|
|
134
135
|
|
|
135
136
|
if (!inputOutput) {
|
|
136
137
|
const parent = extensionElements;
|
|
137
138
|
|
|
138
|
-
inputOutput =
|
|
139
|
+
inputOutput = createIoMapping(parent, bpmnFactory, {
|
|
139
140
|
inputParameters: [],
|
|
140
141
|
outputParameters: []
|
|
141
142
|
});
|
|
@@ -190,7 +191,7 @@ function getParametersHeadingEntry(element, bpmnFactory, options) {
|
|
|
190
191
|
function getIOMappingEntries(element, bpmnFactory, translate, options) {
|
|
191
192
|
|
|
192
193
|
// Get the IOMapping and determine whether we are dealing with input or output parameters
|
|
193
|
-
const inputOutput =
|
|
194
|
+
const inputOutput = getIoMapping(element),
|
|
194
195
|
params = determineParamGetFunc(options.prop)(element, false);
|
|
195
196
|
|
|
196
197
|
if (!params.length) {
|
|
@@ -258,3 +259,16 @@ function getIOMappingEntries(element, bpmnFactory, translate, options) {
|
|
|
258
259
|
});
|
|
259
260
|
}
|
|
260
261
|
}
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
// helpers //////////
|
|
265
|
+
|
|
266
|
+
function determineParamGetFunc(property) {
|
|
267
|
+
if (property == 'inputParameters') {
|
|
268
|
+
return getInputParameters;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (property == 'outputParameters') {
|
|
272
|
+
return getOutputParameters;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
getBoundaryAttachment as isBoundaryAttachment
|
|
23
23
|
} from 'bpmn-js/lib/features/snapping/BpmnSnappingUtil';
|
|
24
24
|
|
|
25
|
-
const HIGH_PRIORITY =
|
|
25
|
+
const HIGH_PRIORITY = 5000;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Zeebe rule provider that allows to create boundary events with catch events
|
|
@@ -1,70 +1,72 @@
|
|
|
1
|
-
import {
|
|
2
|
-
has
|
|
3
|
-
} from 'min-dash';
|
|
1
|
+
import { has } from 'min-dash';
|
|
4
2
|
|
|
5
|
-
import {
|
|
6
|
-
getOutputParameters
|
|
7
|
-
} from './InputOutputHelper';
|
|
3
|
+
import { getOutputParameters } from './InputOutputHelper';
|
|
8
4
|
|
|
9
|
-
import {
|
|
10
|
-
getExtensionElements
|
|
11
|
-
} from 'bpmn-js-properties-panel/lib/helper/ExtensionElementsHelper';
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
getBusinessObject
|
|
15
|
-
} from 'bpmn-js/lib/util/ModelUtil';
|
|
5
|
+
import { getExtensionElements } from 'bpmn-js-properties-panel/lib/helper/ExtensionElementsHelper';
|
|
16
6
|
|
|
17
7
|
import {
|
|
8
|
+
getBusinessObject,
|
|
18
9
|
is
|
|
19
10
|
} from 'bpmn-js/lib/util/ModelUtil';
|
|
20
11
|
|
|
12
|
+
|
|
21
13
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
+
|
|
28
25
|
const outputParameters = getOutputParameters(element);
|
|
29
26
|
|
|
30
27
|
if (outputParameters) {
|
|
31
|
-
return
|
|
28
|
+
return !outputParameters.length;
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
* Get zeebe:CalledElement of an element.
|
|
34
|
+
*
|
|
35
|
+
* @param {djs.model.Base|ModdleElement} element
|
|
36
|
+
*
|
|
37
|
+
* @returns {ModdleElement}
|
|
38
|
+
*/
|
|
41
39
|
export function getCalledElement(element) {
|
|
42
40
|
const calledElements = getCalledElements(element);
|
|
43
|
-
|
|
41
|
+
|
|
42
|
+
return calledElements[ 0 ];
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
export function getCalledElements(element) {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
return
|
|
46
|
+
const businessObject = getBusinessObject(element);
|
|
47
|
+
|
|
48
|
+
return getExtensionElements(businessObject, 'zeebe:CalledElement');
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
59
|
export function isPropagateAllChildVariables(element) {
|
|
60
60
|
if (!is(element, 'bpmn:CallActivity')) {
|
|
61
|
-
return
|
|
61
|
+
return;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
const
|
|
65
|
-
calledElement = getCalledElement(
|
|
64
|
+
const businessObject = getBusinessObject(element),
|
|
65
|
+
calledElement = getCalledElement(businessObject);
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
calledElement.get('propagateAllChildVariables')
|
|
69
|
-
|
|
67
|
+
if (calledElement && has(calledElement, 'propagateAllChildVariables')) {
|
|
68
|
+
return calledElement.get('propagateAllChildVariables');
|
|
69
|
+
} else {
|
|
70
|
+
return getPropagateAllChildVariablesDefault(element);
|
|
71
|
+
}
|
|
70
72
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getExtensionElements
|
|
3
|
-
} from 'bpmn-js-properties-panel/lib/helper/ExtensionElementsHelper';
|
|
1
|
+
import { getExtensionElements } from 'bpmn-js-properties-panel/lib/helper/ExtensionElementsHelper';
|
|
4
2
|
|
|
5
3
|
import elementHelper from 'bpmn-js-properties-panel/lib/helper/ElementHelper';
|
|
6
4
|
|
|
@@ -9,47 +7,12 @@ import {
|
|
|
9
7
|
is
|
|
10
8
|
} from 'bpmn-js/lib/util/ModelUtil';
|
|
11
9
|
|
|
12
|
-
import {
|
|
13
|
-
nextId
|
|
14
|
-
} from 'bpmn-js-properties-panel/lib/Utils';
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
find
|
|
18
|
-
} from 'min-dash';
|
|
19
|
-
|
|
20
|
-
const USER_TASK_FORM_PREFIX = 'userTaskForm_';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export function getUserTaskForm(element, parent) {
|
|
10
|
+
import { nextId } from 'bpmn-js-properties-panel/lib/Utils';
|
|
24
11
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// (1) get form definition from user task
|
|
28
|
-
const formDefinition = getFormDefinition(element);
|
|
29
|
-
|
|
30
|
-
if (!formDefinition) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
12
|
+
import { find } from 'min-dash';
|
|
33
13
|
|
|
34
|
-
|
|
14
|
+
const USER_TASK_FORM_PREFIX = 'UserTaskForm_';
|
|
35
15
|
|
|
36
|
-
// (2) retrieve user task form via form key
|
|
37
|
-
const userTaskForm = findUserTaskForm(formKey, rootElement);
|
|
38
|
-
|
|
39
|
-
return userTaskForm;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function getFormDefinition(element) {
|
|
43
|
-
const businessObject = getBusinessObject(element);
|
|
44
|
-
|
|
45
|
-
const formDefinitions = getExtensionElements(businessObject, 'zeebe:FormDefinition');
|
|
46
|
-
|
|
47
|
-
return formDefinitions[0];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function createFormKey(formId) {
|
|
51
|
-
return 'camunda-forms:bpmn:' + formId;
|
|
52
|
-
}
|
|
53
16
|
|
|
54
17
|
export function createFormDefinition(properties, extensionElements, bpmnFactory) {
|
|
55
18
|
return elementHelper.createElement(
|
|
@@ -60,6 +23,14 @@ export function createFormDefinition(properties, extensionElements, bpmnFactory)
|
|
|
60
23
|
);
|
|
61
24
|
}
|
|
62
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
|
+
|
|
63
34
|
export function createUserTaskForm(properties, extensionElements, bpmnFactory) {
|
|
64
35
|
return elementHelper.createElement(
|
|
65
36
|
'zeebe:UserTaskForm',
|
|
@@ -69,19 +40,22 @@ export function createUserTaskForm(properties, extensionElements, bpmnFactory) {
|
|
|
69
40
|
);
|
|
70
41
|
}
|
|
71
42
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
43
|
+
function findUserTaskForm(formKey, rootElement) {
|
|
44
|
+
const userTaskForms = getExtensionElements(rootElement, 'zeebe:UserTaskForm');
|
|
75
45
|
|
|
46
|
+
return find(userTaskForms, function(userTaskForm) {
|
|
47
|
+
const id = userTaskForm.get('zeebe:id');
|
|
76
48
|
|
|
77
|
-
|
|
49
|
+
return createFormKey(id) === formKey;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
78
52
|
|
|
79
|
-
function
|
|
80
|
-
const
|
|
53
|
+
export function getFormDefinition(element) {
|
|
54
|
+
const businessObject = getBusinessObject(element);
|
|
81
55
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
56
|
+
const formDefinitions = getExtensionElements(businessObject, 'zeebe:FormDefinition');
|
|
57
|
+
|
|
58
|
+
return formDefinitions[ 0 ];
|
|
85
59
|
}
|
|
86
60
|
|
|
87
61
|
function getRootElement(element) {
|
|
@@ -93,4 +67,18 @@ function getRootElement(element) {
|
|
|
93
67
|
}
|
|
94
68
|
|
|
95
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);
|
|
96
84
|
}
|