camunda-bpmn-js 0.13.0-alpha.1 → 0.13.0-alpha.4

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/assets/base-modeler.css +1 -0
  3. package/dist/assets/bpmn-js-properties-panel.css +778 -0
  4. package/dist/assets/bpmn-js.css +116 -0
  5. package/dist/assets/camunda-cloud-modeler.css +2 -1
  6. package/dist/base-modeler.development.js +22251 -21746
  7. package/dist/base-modeler.production.min.js +4 -4
  8. package/dist/camunda-cloud-modeler.development.js +30353 -26018
  9. package/dist/camunda-cloud-modeler.production.min.js +4 -4
  10. package/dist/camunda-platform-modeler.development.js +28818 -28649
  11. package/dist/camunda-platform-modeler.production.min.js +4 -4
  12. package/lib/base/Modeler.js +0 -6
  13. package/lib/camunda-cloud/ElementTemplatesValidator.js +1 -0
  14. package/lib/camunda-cloud/Modeler.js +8 -0
  15. package/lib/camunda-cloud/features/drilldown/index.js +3 -0
  16. package/lib/camunda-cloud/features/modeling/behavior/CleanUpBusinessRuleTaskBehavior.js +60 -57
  17. package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeCallActivityBehavior.js +1 -1
  18. package/lib/camunda-cloud/features/modeling/behavior/RemoveAssignmentDefinitionBehavior.js +51 -0
  19. package/lib/camunda-cloud/features/modeling/behavior/UpdatePropagateAllChildVariablesBehavior.js +60 -33
  20. package/lib/camunda-cloud/features/modeling/behavior/index.js +8 -8
  21. package/lib/camunda-cloud/helper/CalledElementHelper.js +5 -5
  22. package/lib/camunda-cloud/helper/FormsHelper.js +4 -4
  23. package/lib/camunda-platform/features/modeling/behavior/DeleteErrorEventDefinitionBehavior.js +23 -36
  24. package/lib/camunda-platform/features/modeling/behavior/DeleteRetryTimeCycleBehavior.js +33 -21
  25. package/lib/camunda-platform/features/modeling/behavior/UpdateCamundaExclusiveBehavior.js +14 -11
  26. package/lib/camunda-platform/features/modeling/behavior/UpdateInputOutputBehavior.js +20 -30
  27. package/lib/camunda-platform/features/modeling/behavior/UpdateResultVariableBehavior.js +15 -12
  28. package/lib/camunda-platform/features/modeling/behavior/UserTaskFormsBehavior.js +9 -8
  29. package/lib/camunda-platform/features/modeling/behavior/UserTaskGeneratedFormsBehavior.js +32 -33
  30. package/lib/util/ExtensionElementsUtil.js +59 -0
  31. package/package.json +15 -11
  32. package/styles/base-modeler.css +1 -0
  33. package/styles/camunda-cloud-modeler.css +2 -1
  34. package/lib/camunda-cloud/features/modeling/behavior/CleanUpAssignmentDefinitionBehavior.js +0 -78
  35. package/lib/camunda-cloud/helper/ExtensionElementsHelper.js +0 -17
@@ -9,10 +9,6 @@ import alignToOriginModule from '@bpmn-io/align-to-origin';
9
9
 
10
10
  import executableFixModule from 'bpmn-js-executable-fix';
11
11
 
12
- import signavioCompatModule from 'bpmn-js-signavio-compat';
13
-
14
- import disableCollapsedSubprocessModule from 'bpmn-js-disable-collapsed-subprocess';
15
-
16
12
  import {
17
13
  BpmnPropertiesPanelModule as propertiesPanelModule,
18
14
  BpmnPropertiesProviderModule as bpmnPropertiesProviderModule
@@ -41,8 +37,6 @@ Modeler.prototype._injectOriginModule = function(options) {
41
37
  Modeler.prototype._extensionModules = [
42
38
  minimapModule,
43
39
  executableFixModule,
44
- signavioCompatModule,
45
- disableCollapsedSubprocessModule,
46
40
  propertiesPanelModule,
47
41
  bpmnPropertiesProviderModule
48
42
  ];
@@ -0,0 +1 @@
1
+ export { CloudElementTemplatesValidator } from 'bpmn-js-properties-panel';
@@ -2,18 +2,23 @@ import inherits from 'inherits';
2
2
 
3
3
  import BaseModeler from '../base/Modeler';
4
4
 
5
+ import disableCollapsedSubprocessModule from 'bpmn-js-disable-collapsed-subprocess';
6
+
5
7
  import modelingModule from './features/modeling';
6
8
 
7
9
  import paletteModule from './features/palette';
8
10
 
9
11
  import contextPadModule from './features/context-pad';
10
12
 
13
+ import drilldownModule from './features/drilldown';
14
+
11
15
  import popupMenuModule from './features/popup-menu';
12
16
 
13
17
  import rulesModule from './features/rules';
14
18
 
15
19
  import {
16
20
  ZeebePropertiesProviderModule as zeebePropertiesProviderModule,
21
+ CloudElementTemplatesPropertiesProviderModule as cloudElementTemplatesPropertiesProvider,
17
22
  ZeebeDescriptionProvider
18
23
  } from 'bpmn-js-properties-panel';
19
24
 
@@ -48,10 +53,13 @@ inherits(Modeler, BaseModeler);
48
53
  Modeler.prototype._camundaCloudModules = [
49
54
  modelingModule,
50
55
  contextPadModule,
56
+ disableCollapsedSubprocessModule,
57
+ drilldownModule,
51
58
  paletteModule,
52
59
  popupMenuModule,
53
60
  rulesModule,
54
61
  zeebePropertiesProviderModule,
62
+ cloudElementTemplatesPropertiesProvider,
55
63
  zeebeModdleExtension
56
64
  ];
57
65
 
@@ -0,0 +1,3 @@
1
+ export default {
2
+ drilldownOverlayBehavior: [ 'value', null ],
3
+ };
@@ -1,84 +1,87 @@
1
1
  import {
2
+ getBusinessObject,
2
3
  is
3
4
  } from 'bpmn-js/lib/util/ModelUtil';
4
5
 
5
6
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
6
7
 
8
+ import { without } from 'min-dash';
9
+
10
+ import { getExtensionElementsList } from '../../../../util/ExtensionElementsUtil';
11
+
7
12
  const HIGH_PRIORITY = 5000;
8
13
 
9
14
 
10
15
  /**
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
16
+ * Zeebe BPMN behavior ensuring that bpmn:BusinessRuleTask only has one of the following:
17
+ *
18
+ * (1) zeebe:CalledDecision
19
+ * (2) zeebe:TaskDefinition and zeebe:TaskHeaders
15
20
  */
16
21
  export default class CleanUpBusinessRuleTaskBehavior extends CommandInterceptor {
17
- constructor(eventBus, modeling) {
22
+ constructor(commandStack, eventBus) {
18
23
  super(eventBus);
19
24
 
20
25
  /**
21
- * Remove zeebe:calledDecision when zeebe:taskDefinition is added
26
+ * Remove zeebe:CalledDecision if zeebe:TaskDefinition is about to be added.
22
27
  */
23
- this.postExecute([
24
- 'properties-panel.update-businessobject-list',
25
- 'element.updateModdleProperties'
26
- ] , HIGH_PRIORITY, function(context) {
28
+ this.preExecute('element.updateModdleProperties' , HIGH_PRIORITY, function(context) {
27
29
  const {
28
30
  element,
29
- currentObject,
30
- objectsToAdd,
31
31
  moddleElement,
32
32
  properties
33
33
  } = context;
34
34
 
35
- // (1) map properties from both commands
36
- const extensionElement = currentObject || moddleElement,
37
- newValues = objectsToAdd || (properties && properties.values);
35
+ if (
36
+ !is(element, 'bpmn:BusinessRuleTask')
37
+ || !is(moddleElement, 'bpmn:ExtensionElements')
38
+ || !properties.values
39
+ ) {
40
+ return;
41
+ }
42
+
43
+ const calledDecision = getCalledDecision(element),
44
+ taskDefinition = getTaskDefinition(element);
38
45
 
39
- // (2) check conditions and potentially update
40
46
  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
+ calledDecision
48
+ && !taskDefinition
49
+ && properties.values.find(value => is(value, 'zeebe:CalledDecision'))
50
+ && properties.values.find(value => is(value, 'zeebe:TaskDefinition'))
47
51
  ) {
48
- removeCalledDecision(element, extensionElement, modeling);
52
+ properties.values = without(properties.values, calledDecision);
49
53
  }
50
54
  }, true);
51
55
 
52
56
  /**
53
- * Remove zeebe:taskDefinition and zeebe:taskHeaders when zeebe:calledDecision
57
+ * Remove zeebe:TaskDefinition and zeebe:TaskHeaders if zeebe:CalledDecision is about to be added.
54
58
  */
55
- this.postExecute([
56
- 'properties-panel.update-businessobject-list',
57
- 'element.updateModdleProperties'
58
- ] , HIGH_PRIORITY, function(context) {
59
+ this.preExecute('element.updateModdleProperties', HIGH_PRIORITY, function(context) {
59
60
  const {
60
61
  element,
61
- currentObject,
62
- objectsToAdd,
63
62
  moddleElement,
64
63
  properties
65
64
  } = context;
66
65
 
67
- // (1) map properties from both commands
68
- const extensionElement = currentObject || moddleElement,
69
- newValues = objectsToAdd || (properties && properties.values);
66
+ if (
67
+ !is(element, 'bpmn:BusinessRuleTask')
68
+ || !is(moddleElement, 'bpmn:ExtensionElements')
69
+ || !properties.values
70
+ ) {
71
+ return;
72
+ }
73
+
74
+ const calledDecision = getCalledDecision(element),
75
+ taskDefinition = getTaskDefinition(element),
76
+ taskHeaders = getTaskHeaders(element);
70
77
 
71
- // (2) check conditions and potentially update
72
78
  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'))
79
+ !calledDecision
80
+ && (taskDefinition || taskHeaders)
81
+ && properties.values.find(value => is(value, 'zeebe:CalledDecision'))
82
+ && properties.values.find(value => is(value, 'zeebe:TaskDefinition') || is(value, 'zeebe:TaskHeaders'))
80
83
  ) {
81
- removeTaskDefintionAndHeaders(element, extensionElement, modeling);
84
+ properties.values = without(properties.values, (value) => value === taskDefinition || value === taskHeaders);
82
85
  }
83
86
  }, true);
84
87
 
@@ -86,27 +89,27 @@ export default class CleanUpBusinessRuleTaskBehavior extends CommandInterceptor
86
89
  }
87
90
 
88
91
  CleanUpBusinessRuleTaskBehavior.$inject = [
89
- 'eventBus',
90
- 'modeling'
92
+ 'commandStack',
93
+ 'eventBus'
91
94
  ];
92
95
 
93
96
 
94
- // helper ////////////////////
97
+ // helpers //////////
95
98
 
96
- function removeFromExtensionElements(element, extensionElements, modeling, filterFun) {
97
- const values = extensionElements.get('values').filter(filterFun);
99
+ function getCalledDecision(element) {
100
+ const businessObject = getBusinessObject(element);
98
101
 
99
- modeling.updateModdleProperties(element, extensionElements, {
100
- values
101
- });
102
+ return getExtensionElementsList(businessObject, 'zeebe:CalledDecision')[ 0 ];
102
103
  }
103
104
 
104
- function removeCalledDecision(element, extensionElements, modeling) {
105
- removeFromExtensionElements(element, extensionElements, modeling,
106
- (ele) => !is(ele, 'zeebe:CalledDecision'));
107
- }
105
+ function getTaskDefinition(element) {
106
+ const businessObject = getBusinessObject(element);
108
107
 
109
- function removeTaskDefintionAndHeaders(element, extensionElements, modeling) {
110
- removeFromExtensionElements(element, extensionElements, modeling,
111
- (ele) => !is(ele, 'zeebe:TaskDefinition') && !is(ele, 'zeebe:TaskHeaders'));
108
+ return getExtensionElementsList(businessObject, 'zeebe:TaskDefinition')[ 0 ];
112
109
  }
110
+
111
+ function getTaskHeaders(element) {
112
+ const businessObject = getBusinessObject(element);
113
+
114
+ return getExtensionElementsList(businessObject, 'zeebe:TaskHeaders')[ 0 ];
115
+ }
@@ -57,7 +57,7 @@ export default class CreateZeebeCallActivityBehavior extends CommandInterceptor
57
57
  });
58
58
  } else if (!has(calledElement, 'propagateAllChildVariables')) {
59
59
 
60
- // if zeebe:CalledElement exist set zeebe:propagateAllChildVariables to false
60
+ // set zeebe:propagateAllChildVariables to false if zeebe:CalledElement exists
61
61
  modeling.updateModdleProperties(shape, calledElement, {
62
62
  propagateAllChildVariables: false
63
63
  });
@@ -0,0 +1,51 @@
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
+ ];
@@ -1,3 +1,5 @@
1
+ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
2
+
1
3
  import {
2
4
  getBusinessObject,
3
5
  is
@@ -14,31 +16,41 @@ import {
14
16
  getIoMapping
15
17
  } from '../../../helper/InputOutputHelper';
16
18
 
17
- import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
19
+ import {
20
+ removeExtensionElements
21
+ } from '../../../../util/ExtensionElementsUtil';
18
22
 
19
23
  const HIGH_PRIORITY = 5000;
20
24
 
21
25
 
22
26
  /**
23
- * Zeebe BPMN behavior for updating zeebe:propagateAllChildVariables.
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
24
32
  */
25
33
  export default class UpdatePropagateAllChildVariablesBehavior extends CommandInterceptor {
26
- constructor(eventBus, modeling) {
34
+ constructor(commandStack, eventBus, modeling) {
27
35
  super(eventBus);
28
36
 
29
37
  /**
30
- * Remove zeebe:OutputParameters when zeebe:propagateAllChildVariables is set to true.
38
+ * Remove zeebe:Output elements if zeebe:propagateAllChildVariables is set to true.
39
+ * Remove zeebe:IoMapping extension element if empty.
31
40
  */
32
- this.postExecute('properties-panel.update-businessobject' , HIGH_PRIORITY, function(context) {
41
+ this.postExecute('element.updateModdleProperties' , HIGH_PRIORITY, function(context) {
33
42
  const {
34
43
  element,
35
- properties
44
+ moddleElement,
45
+ properties = {}
36
46
  } = context;
37
47
 
48
+ const propagateAllChildVariables = properties.propagateAllChildVariables || properties[ 'zeebe:propagateAllChildVariables' ];
49
+
38
50
  if (
39
51
  !is(element, 'bpmn:CallActivity')
40
- || !properties
41
- || !!properties.propagateAllChildVariables === false
52
+ || !is(moddleElement, 'zeebe:CalledElement')
53
+ || !propagateAllChildVariables
42
54
  ) {
43
55
  return;
44
56
  }
@@ -57,53 +69,68 @@ export default class UpdatePropagateAllChildVariablesBehavior extends CommandInt
57
69
  });
58
70
 
59
71
  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
- });
72
+ removeExtensionElements(element, getBusinessObject(element), ioMapping, commandStack);
70
73
  }
71
74
  }, true);
72
75
 
73
76
 
74
77
  /**
75
- * Set zeebe:propagateAllChildVariables to false on zeebe:Output added.
78
+ * Set zeebe:propagateAllChildVariables of zeebe:CalledElement to false if
79
+ * zeebe:Output or zeebe:IoMapping with zeebe:Output is added.
76
80
  */
77
- this.postExecute('properties-panel.update-businessobject-list' , HIGH_PRIORITY, function(context) {
81
+ this.preExecute('element.updateModdleProperties' , HIGH_PRIORITY, function(context) {
78
82
  const {
79
- currentObject,
80
83
  element,
81
- objectsToAdd,
82
- propertyName
84
+ moddleElement,
85
+ properties
83
86
  } = context;
84
87
 
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)) {
88
+ if (
89
+ !is(element, 'bpmn:CallActivity')
90
+ || !isPropagateAllChildVariables(element)
91
+ ) {
92
92
  return;
93
93
  }
94
94
 
95
95
  const businessObject = getBusinessObject(element),
96
96
  calledElement = getCalledElement(businessObject);
97
97
 
98
- modeling.updateModdleProperties(element, calledElement, {
99
- 'zeebe:propagateAllChildVariables': false
100
- });
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
+
101
127
  }, true);
102
128
 
103
129
  }
104
130
  }
105
131
 
106
132
  UpdatePropagateAllChildVariablesBehavior.$inject = [
133
+ 'commandStack',
107
134
  'eventBus',
108
135
  'modeling'
109
136
  ];
@@ -1,24 +1,24 @@
1
- import CleanUpAssignmentDefinitionBehavior from './CleanUpAssignmentDefinitionBehavior';
2
1
  import CleanUpBusinessRuleTaskBehavior from './CleanUpBusinessRuleTaskBehavior';
3
2
  import CreateZeebeBoundaryEventBehavior from './CreateZeebeBoundaryEventBehavior';
4
3
  import CreateZeebeCallActivityBehavior from './CreateZeebeCallActivityBehavior';
5
- import UpdatePropagateAllChildVariablesBehavior from './UpdatePropagateAllChildVariablesBehavior';
6
4
  import FormDefinitionBehavior from './FormDefinitionBehavior';
5
+ import RemoveAssignmentDefinitionBehavior from './RemoveAssignmentDefinitionBehavior';
6
+ import UpdatePropagateAllChildVariablesBehavior from './UpdatePropagateAllChildVariablesBehavior';
7
7
 
8
8
 
9
9
  export default {
10
10
  __init__: [
11
- 'cleanUpAssignmentDefinitionBehavior',
12
11
  'cleanUpBusinessRuleTaskBehavior',
13
12
  'createZeebeBoundaryEventBehavior',
14
13
  'createZeebeCallActivityBehavior',
15
- 'updatePropagateAllChildVariablesBehavior',
16
- 'formDefinitionBehavior'
14
+ 'formDefinitionBehavior',
15
+ 'removeAssignmentDefinitionBehavior',
16
+ 'updatePropagateAllChildVariablesBehavior'
17
17
  ],
18
- cleanUpAssignmentDefinitionBehavior: [ 'type', CleanUpAssignmentDefinitionBehavior ],
19
18
  cleanUpBusinessRuleTaskBehavior: [ 'type', CleanUpBusinessRuleTaskBehavior ],
20
19
  createZeebeBoundaryEventBehavior: [ 'type', CreateZeebeBoundaryEventBehavior ],
21
20
  createZeebeCallActivityBehavior: [ 'type', CreateZeebeCallActivityBehavior ],
22
- updatePropagateAllChildVariablesBehavior: [ 'type', UpdatePropagateAllChildVariablesBehavior ],
23
- formDefinitionBehavior: [ 'type', FormDefinitionBehavior ]
21
+ formDefinitionBehavior: [ 'type', FormDefinitionBehavior ],
22
+ removeAssignmentDefinitionBehavior: [ 'type', RemoveAssignmentDefinitionBehavior ],
23
+ updatePropagateAllChildVariablesBehavior: [ 'type', UpdatePropagateAllChildVariablesBehavior ]
24
24
  };
@@ -2,7 +2,7 @@ import { has } from 'min-dash';
2
2
 
3
3
  import { getOutputParameters } from './InputOutputHelper';
4
4
 
5
- import { getExtensionElements } from './ExtensionElementsHelper';
5
+ import { getExtensionElementsList } from '../../util/ExtensionElementsUtil';
6
6
 
7
7
  import {
8
8
  getBusinessObject,
@@ -19,7 +19,7 @@ import {
19
19
  */
20
20
  function getPropagateAllChildVariablesDefault(element) {
21
21
  if (!is(element, 'bpmn:CallActivity')) {
22
- return;
22
+ return false;
23
23
  }
24
24
 
25
25
  const outputParameters = getOutputParameters(element);
@@ -45,7 +45,7 @@ export function getCalledElement(element) {
45
45
  export function getCalledElements(element) {
46
46
  const businessObject = getBusinessObject(element);
47
47
 
48
- return getExtensionElements(businessObject, 'zeebe:CalledElement');
48
+ return getExtensionElementsList(businessObject, 'zeebe:CalledElement');
49
49
  }
50
50
 
51
51
  /**
@@ -58,14 +58,14 @@ export function getCalledElements(element) {
58
58
  */
59
59
  export function isPropagateAllChildVariables(element) {
60
60
  if (!is(element, 'bpmn:CallActivity')) {
61
- return;
61
+ return false;
62
62
  }
63
63
 
64
64
  const businessObject = getBusinessObject(element),
65
65
  calledElement = getCalledElement(businessObject);
66
66
 
67
67
  if (calledElement && has(calledElement, 'propagateAllChildVariables')) {
68
- return calledElement.get('propagateAllChildVariables');
68
+ return calledElement.get('propagateAllChildVariables') || false;
69
69
  } else {
70
70
  return getPropagateAllChildVariablesDefault(element);
71
71
  }
@@ -1,4 +1,4 @@
1
- import { getExtensionElements } from './ExtensionElementsHelper';
1
+ import { getExtensionElementsList } from '../../util/ExtensionElementsUtil';
2
2
 
3
3
  import { createElement } from './ElementHelper';
4
4
 
@@ -41,9 +41,9 @@ export function createUserTaskForm(properties, extensionElements, bpmnFactory) {
41
41
  }
42
42
 
43
43
  function findUserTaskForm(formKey, rootElement) {
44
- const userTaskForms = getExtensionElements(rootElement, 'zeebe:UserTaskForm');
44
+ const userTaskForms = getExtensionElementsList(rootElement, 'zeebe:UserTaskForm');
45
45
 
46
- return find(userTaskForms, function(userTaskForm) {
46
+ return find(userTaskForms, (userTaskForm) => {
47
47
  const id = userTaskForm.get('zeebe:id');
48
48
 
49
49
  return createFormKey(id) === formKey;
@@ -53,7 +53,7 @@ function findUserTaskForm(formKey, rootElement) {
53
53
  export function getFormDefinition(element) {
54
54
  const businessObject = getBusinessObject(element);
55
55
 
56
- const formDefinitions = getExtensionElements(businessObject, 'zeebe:FormDefinition');
56
+ const formDefinitions = getExtensionElementsList(businessObject, 'zeebe:FormDefinition');
57
57
 
58
58
  return formDefinitions[ 0 ];
59
59
  }
@@ -1,45 +1,47 @@
1
+ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
2
+
1
3
  import {
2
4
  getBusinessObject,
3
5
  is
4
6
  } from 'bpmn-js/lib/util/ModelUtil';
5
7
 
6
- import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
8
+ import {
9
+ getExtensionElementsList,
10
+ removeExtensionElements
11
+ } from '../../../../util/ExtensionElementsUtil';
7
12
 
8
13
  const HIGH_PRIORITY = 5000;
9
14
 
10
15
 
11
16
  /**
12
- * Camunda BPMN specific camunda:ErrorEventDefinition behavior.
17
+ * Camunda BPMN specific behavior ensuring camunda:ErrorEventDefinition extension elements are removed
18
+ * if type of e.g. bpmn:ServiceTask is set to something other than external.
13
19
  */
14
20
  export default class DeleteErrorEventDefinitionBehavior extends CommandInterceptor {
15
- constructor(eventBus, modeling) {
21
+ constructor(commandStack, eventBus) {
16
22
  super(eventBus);
17
23
 
18
- /**
19
- * Remove camunda:ErrorEventDefinitions on camunda:type set to external.
20
- */
21
24
  this.postExecute([
22
25
  'element.updateProperties',
23
- 'properties-panel.update-businessobject'
26
+ 'element.updateModdleProperties'
24
27
  ], HIGH_PRIORITY, function(context) {
25
28
  const {
26
29
  element,
27
- oldProperties,
30
+ moddleElement,
28
31
  properties
29
32
  } = context;
30
33
 
31
- const businessObject = getBusinessObject(element),
32
- extensionElements = businessObject.get('extensionElements');
34
+ const businessObject = moddleElement || getBusinessObject(element);
33
35
 
34
36
  if (is(element, 'camunda:ExternalCapable')
35
- && extensionElements
36
- && externalTypeChanged(oldProperties, properties)) {
37
-
38
- const values = extensionElements.get('values').filter((element) => {
39
- return !is(element, 'camunda:ErrorEventDefinition');
40
- });
41
-
42
- modeling.updateModdleProperties(element, extensionElements, { values });
37
+ && is(businessObject, 'camunda:ExternalCapable')
38
+ && properties[ 'camunda:type' ] !== 'external'
39
+ ) {
40
+ const errorEventDefinitions = getExtensionElementsList(businessObject, 'camunda:ErrorEventDefinition');
41
+
42
+ if (errorEventDefinitions.length) {
43
+ removeExtensionElements(element, businessObject, errorEventDefinitions, commandStack);
44
+ }
43
45
  }
44
46
  }, true);
45
47
 
@@ -47,21 +49,6 @@ export default class DeleteErrorEventDefinitionBehavior extends CommandIntercept
47
49
  }
48
50
 
49
51
  DeleteErrorEventDefinitionBehavior.$inject = [
50
- 'eventBus',
51
- 'modeling'
52
- ];
53
-
54
-
55
- // helpers //////////
56
-
57
- function externalTypeChanged(oldProperties, updatesProperties) {
58
- const {
59
- 'camunda:type': oldType
60
- } = oldProperties;
61
-
62
- const {
63
- 'camunda:type': newType
64
- } = updatesProperties;
65
-
66
- return oldType === 'external' && newType !== 'external';
67
- }
52
+ 'commandStack',
53
+ 'eventBus'
54
+ ];