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
|
@@ -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
|
+
];
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
import inherits from 'inherits';
|
|
3
|
-
|
|
4
2
|
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
5
3
|
|
|
6
4
|
import elementHelper from 'bpmn-js-properties-panel/lib/helper/ElementHelper';
|
|
@@ -10,11 +8,6 @@ import {
|
|
|
10
8
|
is
|
|
11
9
|
} from 'bpmn-js/lib/util/ModelUtil';
|
|
12
10
|
|
|
13
|
-
import {
|
|
14
|
-
remove as collectionRemove,
|
|
15
|
-
add as collectionAdd
|
|
16
|
-
} from 'diagram-js/lib/util/Collections';
|
|
17
|
-
|
|
18
11
|
import {
|
|
19
12
|
createFormDefinition,
|
|
20
13
|
createFormId,
|
|
@@ -26,161 +19,110 @@ import {
|
|
|
26
19
|
|
|
27
20
|
|
|
28
21
|
/**
|
|
29
|
-
* Zeebe specific form definition behavior.
|
|
22
|
+
* Zeebe BPMN specific form definition behavior.
|
|
30
23
|
*/
|
|
31
|
-
export default
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
CommandInterceptor.call(this, eventBus);
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* ensures a zeebe:userTaskForm is cleaned up when user task got removed
|
|
38
|
-
*/
|
|
39
|
-
this.executed('shape.delete', function(context) {
|
|
40
|
-
const {
|
|
41
|
-
shape,
|
|
42
|
-
oldParent
|
|
43
|
-
} = context;
|
|
44
|
-
|
|
45
|
-
const rootElement = getRootElement(oldParent);
|
|
24
|
+
export default class FormDefinitionBehavior extends CommandInterceptor {
|
|
25
|
+
constructor(bpmnFactory, eventBus, modeling) {
|
|
26
|
+
super(eventBus);
|
|
46
27
|
|
|
47
|
-
|
|
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;
|
|
48
36
|
|
|
49
|
-
|
|
37
|
+
const rootElement = getRootElement(oldParent);
|
|
50
38
|
|
|
51
|
-
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
39
|
+
const userTaskForm = getUserTaskForm(shape, rootElement);
|
|
54
40
|
|
|
55
|
-
|
|
41
|
+
if (!is(shape, 'bpmn:UserTask') || !userTaskForm) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
56
44
|
|
|
57
|
-
|
|
58
|
-
}, true);
|
|
45
|
+
const rootExtensionElements = rootElement.get('extensionElements');
|
|
59
46
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
oldParent
|
|
64
|
-
} = context;
|
|
47
|
+
const values = rootExtensionElements.get('values').filter((element) => {
|
|
48
|
+
return element !== userTaskForm;
|
|
49
|
+
});
|
|
65
50
|
|
|
66
|
-
|
|
51
|
+
modeling.updateModdleProperties(shape, rootExtensionElements, { values });
|
|
52
|
+
}, true);
|
|
67
53
|
|
|
68
|
-
const rootExtensionElements = rootElement.get('extensionElements');
|
|
69
54
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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;
|
|
73
60
|
|
|
74
|
-
|
|
75
|
-
}, true);
|
|
61
|
+
const oldFormDefinition = getFormDefinition(shape);
|
|
76
62
|
|
|
63
|
+
if (!is(shape, 'bpmn:UserTask') || !oldFormDefinition) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
77
66
|
|
|
78
|
-
|
|
79
|
-
* create fresh new copied form definition + user task form
|
|
80
|
-
*/
|
|
81
|
-
this.executed('shape.create', function(context) {
|
|
82
|
-
const {
|
|
83
|
-
shape,
|
|
84
|
-
} = context;
|
|
67
|
+
const oldUserTaskForm = getUserTaskForm(shape);
|
|
85
68
|
|
|
86
|
-
|
|
69
|
+
const rootElement = getRootElement(shape);
|
|
87
70
|
|
|
88
|
-
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
71
|
+
const businessObject = getBusinessObject(shape);
|
|
91
72
|
|
|
92
|
-
|
|
73
|
+
const extensionElements = businessObject.get('extensionElements');
|
|
93
74
|
|
|
94
|
-
|
|
75
|
+
let rootExtensionElements = rootElement.get('extensionElements');
|
|
95
76
|
|
|
96
|
-
|
|
77
|
+
// (1) ensure extension elements exists
|
|
78
|
+
if (!rootExtensionElements) {
|
|
79
|
+
rootExtensionElements = elementHelper.createElement('bpmn:ExtensionElements', { values: [] }, rootElement, bpmnFactory);
|
|
97
80
|
|
|
98
|
-
|
|
81
|
+
modeling.updateModdleProperties(shape, rootElement, { extensionElements: rootExtensionElements });
|
|
82
|
+
}
|
|
99
83
|
|
|
100
|
-
|
|
84
|
+
// (2) remove existing form definition
|
|
85
|
+
let values = extensionElements.get('values').filter((element) => {
|
|
86
|
+
return element !== oldFormDefinition;
|
|
87
|
+
});
|
|
101
88
|
|
|
102
|
-
|
|
103
|
-
|
|
89
|
+
// (3) create new form definition
|
|
90
|
+
const formId = createFormId();
|
|
104
91
|
|
|
105
|
-
|
|
106
|
-
'bpmn:ExtensionElements',
|
|
107
|
-
{ values: [] },
|
|
108
|
-
rootElement,
|
|
109
|
-
bpmnFactory
|
|
110
|
-
);
|
|
92
|
+
const newFormDefinition = createFormDefinition({ formKey: createFormKey(formId) }, extensionElements, bpmnFactory);
|
|
111
93
|
|
|
112
|
-
|
|
113
|
-
|
|
94
|
+
values = [
|
|
95
|
+
...values,
|
|
96
|
+
newFormDefinition
|
|
97
|
+
];
|
|
114
98
|
|
|
115
|
-
|
|
116
|
-
|
|
99
|
+
modeling.updateModdleProperties(shape, extensionElements, {
|
|
100
|
+
values
|
|
101
|
+
});
|
|
117
102
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const formId = createFormId();
|
|
121
|
-
|
|
122
|
-
// (3) create new form definition
|
|
123
|
-
const formDefinition = createFormDefinition(
|
|
124
|
-
{
|
|
125
|
-
formKey: createFormKey(formId)
|
|
126
|
-
},
|
|
127
|
-
extensionElements,
|
|
128
|
-
bpmnFactory
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
collectionAdd(extensionElements.get('values'), formDefinition);
|
|
132
|
-
|
|
133
|
-
// (4) create new user task form
|
|
134
|
-
const userTaskForm = createUserTaskForm(
|
|
135
|
-
{
|
|
103
|
+
// (4) create new user task form
|
|
104
|
+
const userTaskForm = createUserTaskForm({
|
|
136
105
|
id: formId,
|
|
137
106
|
body: oldUserTaskForm ? oldUserTaskForm.get('body') : ''
|
|
138
|
-
},
|
|
139
|
-
rootExtensionElements,
|
|
140
|
-
bpmnFactory
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
collectionAdd(rootExtensionElements.get('values'), userTaskForm);
|
|
144
|
-
}, true);
|
|
107
|
+
}, rootExtensionElements, bpmnFactory);
|
|
145
108
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
const extensionElements = businessObject.get('extensionElements');
|
|
155
|
-
|
|
156
|
-
const formDefinition = getFormDefinition(shape);
|
|
157
|
-
|
|
158
|
-
const userTaskForm = getUserTaskForm(shape);
|
|
159
|
-
|
|
160
|
-
const rootElement = getRootElement(shape);
|
|
161
|
-
|
|
162
|
-
const rootExtensionElements = rootElement.get('extensionElements');
|
|
163
|
-
|
|
164
|
-
if (!is(shape, 'bpmn:UserTask') || !userTaskForm) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// we need to cover the old form definition to make <redo> possible
|
|
169
|
-
collectionRemove(extensionElements.get('values'), formDefinition);
|
|
170
|
-
collectionAdd(extensionElements.get('values'), oldFormDefinition);
|
|
171
|
-
|
|
172
|
-
collectionRemove(rootExtensionElements.get('values'), userTaskForm);
|
|
173
|
-
}, true);
|
|
109
|
+
modeling.updateModdleProperties(shape, rootExtensionElements, {
|
|
110
|
+
values: [
|
|
111
|
+
...(rootExtensionElements.get('values') || []),
|
|
112
|
+
userTaskForm
|
|
113
|
+
]
|
|
114
|
+
});
|
|
115
|
+
}, true);
|
|
174
116
|
|
|
117
|
+
}
|
|
175
118
|
}
|
|
176
119
|
|
|
177
120
|
FormDefinitionBehavior.$inject = [
|
|
121
|
+
'bpmnFactory',
|
|
178
122
|
'eventBus',
|
|
179
|
-
'
|
|
123
|
+
'modeling'
|
|
180
124
|
];
|
|
181
125
|
|
|
182
|
-
inherits(FormDefinitionBehavior, CommandInterceptor);
|
|
183
|
-
|
|
184
126
|
|
|
185
127
|
// helpers //////////////
|
|
186
128
|
|