camunda-bpmn-js 0.12.1 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/camunda-cloud-modeler.development.js +88 -17
- package/dist/camunda-cloud-modeler.production.min.js +1 -1
- package/lib/camunda-cloud/features/modeling/behavior/CleanUpAssignmentDefinitionBehavior.js +78 -0
- package/lib/camunda-cloud/features/modeling/behavior/index.js +3 -0
- package/package.json +1 -1
- package/dist/assets/properties-panel.css +0 -780
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
is
|
|
3
|
+
} from 'bpmn-js/lib/util/ModelUtil';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
getBusinessObject
|
|
7
|
+
} from 'bpmn-js/lib/util/ModelUtil';
|
|
8
|
+
|
|
9
|
+
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
10
|
+
|
|
11
|
+
const HIGH_PRIORITY = 5000;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Zeebe BPMN behavior for ensuring that there are not empty (ie. without properties)
|
|
16
|
+
* zeebe:assignmentDefinitions after modeling operations. Will also remove related
|
|
17
|
+
* extensionElements, if they remain empty afterwards (could be a seperate
|
|
18
|
+
* behavior in the future, if needed)
|
|
19
|
+
*/
|
|
20
|
+
export default class CleanUpBusinessRuleTaskBehavior extends CommandInterceptor {
|
|
21
|
+
constructor(eventBus, modeling) {
|
|
22
|
+
super(eventBus);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Remove zeebe:assignmentDefinition when it has no defined properties left after the operation
|
|
26
|
+
*/
|
|
27
|
+
this.postExecuted([
|
|
28
|
+
'properties-panel.update-businessobject',
|
|
29
|
+
'element.updateModdleProperties'
|
|
30
|
+
] , HIGH_PRIORITY, function(context) {
|
|
31
|
+
const {
|
|
32
|
+
element,
|
|
33
|
+
businessObject,
|
|
34
|
+
moddleElement
|
|
35
|
+
} = context;
|
|
36
|
+
|
|
37
|
+
// (1) harmonize property names from commands
|
|
38
|
+
const assignmentDefintion = businessObject || moddleElement;
|
|
39
|
+
|
|
40
|
+
if (
|
|
41
|
+
is(element, 'bpmn:UserTask')
|
|
42
|
+
&& assignmentDefintion
|
|
43
|
+
&& is(assignmentDefintion, 'zeebe:AssignmentDefinition')
|
|
44
|
+
&& assignmentDefintion.assignee === undefined
|
|
45
|
+
&& assignmentDefintion.candidateGroups === undefined
|
|
46
|
+
) {
|
|
47
|
+
const extensionElements = getBusinessObject(element).extensionElements;
|
|
48
|
+
|
|
49
|
+
// (2) remove zeebe:assignmentDefintion
|
|
50
|
+
removeFromExtensionElements(element, extensionElements, modeling,
|
|
51
|
+
(ele) => !is(ele, 'zeebe:AssignmentDefinition'));
|
|
52
|
+
|
|
53
|
+
// (3) if extensionElements are empty afterwards, remove them as well
|
|
54
|
+
if (extensionElements.values.length === 0) {
|
|
55
|
+
modeling.updateModdleProperties(element, getBusinessObject(element),
|
|
56
|
+
{ extensionElements: undefined });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, true);
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
CleanUpBusinessRuleTaskBehavior.$inject = [
|
|
65
|
+
'eventBus',
|
|
66
|
+
'modeling'
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
// helper ////////////////////
|
|
71
|
+
|
|
72
|
+
function removeFromExtensionElements(element, extensionElements, modeling, filterFun) {
|
|
73
|
+
const values = extensionElements.get('values').filter(filterFun);
|
|
74
|
+
|
|
75
|
+
modeling.updateModdleProperties(element, extensionElements, {
|
|
76
|
+
values
|
|
77
|
+
});
|
|
78
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import CleanUpAssignmentDefinitionBehavior from './CleanUpAssignmentDefinitionBehavior';
|
|
1
2
|
import CleanUpBusinessRuleTaskBehavior from './CleanUpBusinessRuleTaskBehavior';
|
|
2
3
|
import CreateZeebeBoundaryEventBehavior from './CreateZeebeBoundaryEventBehavior';
|
|
3
4
|
import CreateZeebeCallActivityBehavior from './CreateZeebeCallActivityBehavior';
|
|
@@ -7,12 +8,14 @@ import FormDefinitionBehavior from './FormDefinitionBehavior';
|
|
|
7
8
|
|
|
8
9
|
export default {
|
|
9
10
|
__init__: [
|
|
11
|
+
'cleanUpAssignmentDefinitionBehavior',
|
|
10
12
|
'cleanUpBusinessRuleTaskBehavior',
|
|
11
13
|
'createZeebeBoundaryEventBehavior',
|
|
12
14
|
'createZeebeCallActivityBehavior',
|
|
13
15
|
'updatePropagateAllChildVariablesBehavior',
|
|
14
16
|
'formDefinitionBehavior'
|
|
15
17
|
],
|
|
18
|
+
cleanUpAssignmentDefinitionBehavior: [ 'type', CleanUpAssignmentDefinitionBehavior ],
|
|
16
19
|
cleanUpBusinessRuleTaskBehavior: [ 'type', CleanUpBusinessRuleTaskBehavior ],
|
|
17
20
|
createZeebeBoundaryEventBehavior: [ 'type', CreateZeebeBoundaryEventBehavior ],
|
|
18
21
|
createZeebeCallActivityBehavior: [ 'type', CreateZeebeCallActivityBehavior ],
|