camunda-bpmn-js 0.13.0-drilldown.0 → 0.13.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.
Files changed (76) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/dist/assets/base-navigated-viewer.css +2 -0
  3. package/dist/assets/base-viewer.css +2 -0
  4. package/dist/assets/bpmn-js.css +7 -4
  5. package/dist/assets/camunda-cloud-modeler.css +2 -1
  6. package/dist/assets/camunda-cloud-navigated-viewer.css +1 -0
  7. package/dist/assets/camunda-cloud-viewer.css +1 -0
  8. package/dist/assets/camunda-platform-navigated-viewer.css +1 -0
  9. package/dist/assets/camunda-platform-viewer.css +1 -0
  10. package/dist/assets/element-templates.css +4 -0
  11. package/dist/assets/properties-panel.css +901 -877
  12. package/dist/base-modeler.development.js +1949 -3883
  13. package/dist/base-modeler.production.min.js +4 -4
  14. package/dist/base-navigated-viewer.development.js +22218 -0
  15. package/dist/base-navigated-viewer.production.min.js +2 -0
  16. package/dist/base-viewer.development.js +21227 -0
  17. package/dist/base-viewer.production.min.js +2 -0
  18. package/dist/camunda-cloud-modeler.development.js +8579 -5480
  19. package/dist/camunda-cloud-modeler.production.min.js +4 -4
  20. package/dist/camunda-cloud-navigated-viewer.development.js +23041 -0
  21. package/dist/camunda-cloud-navigated-viewer.production.min.js +2 -0
  22. package/dist/camunda-cloud-viewer.development.js +22050 -0
  23. package/dist/camunda-cloud-viewer.production.min.js +2 -0
  24. package/dist/camunda-platform-modeler.development.js +6777 -8719
  25. package/dist/camunda-platform-modeler.production.min.js +4 -4
  26. package/dist/camunda-platform-navigated-viewer.development.js +23413 -0
  27. package/dist/camunda-platform-navigated-viewer.production.min.js +2 -0
  28. package/dist/camunda-platform-viewer.development.js +22422 -0
  29. package/dist/camunda-platform-viewer.production.min.js +2 -0
  30. package/lib/base/NavigatedViewer.js +3 -0
  31. package/lib/base/Viewer.js +3 -0
  32. package/lib/camunda-cloud/ElementTemplatesValidator.js +1 -0
  33. package/lib/camunda-cloud/Modeler.js +8 -7
  34. package/lib/camunda-cloud/NavigatedViewer.js +34 -0
  35. package/lib/camunda-cloud/Viewer.js +34 -0
  36. package/lib/camunda-cloud/util/commonModules.js +14 -0
  37. package/lib/camunda-platform/Modeler.js +5 -5
  38. package/lib/camunda-platform/NavigatedViewer.js +25 -0
  39. package/lib/camunda-platform/Viewer.js +24 -0
  40. package/lib/camunda-platform/util/commonModules.js +7 -0
  41. package/lib/util/ExtensionElementsUtil.js +59 -0
  42. package/package.json +33 -15
  43. package/styles/base-navigated-viewer.css +2 -0
  44. package/styles/base-viewer.css +2 -0
  45. package/styles/camunda-cloud-modeler.css +2 -1
  46. package/styles/camunda-cloud-navigated-viewer.css +1 -0
  47. package/styles/camunda-cloud-viewer.css +1 -0
  48. package/styles/camunda-platform-navigated-viewer.css +1 -0
  49. package/styles/camunda-platform-viewer.css +1 -0
  50. package/util/index.js +39 -0
  51. package/dist/assets/bpmn-js-properties-panel.css +0 -778
  52. package/lib/camunda-cloud/features/modeling/behavior/CleanUpAssignmentDefinitionBehavior.js +0 -78
  53. package/lib/camunda-cloud/features/modeling/behavior/CleanUpBusinessRuleTaskBehavior.js +0 -112
  54. package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeBoundaryEventBehavior.js +0 -76
  55. package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeCallActivityBehavior.js +0 -74
  56. package/lib/camunda-cloud/features/modeling/behavior/FormDefinitionBehavior.js +0 -138
  57. package/lib/camunda-cloud/features/modeling/behavior/UpdatePropagateAllChildVariablesBehavior.js +0 -109
  58. package/lib/camunda-cloud/features/modeling/behavior/index.js +0 -24
  59. package/lib/camunda-cloud/features/modeling/index.js +0 -7
  60. package/lib/camunda-cloud/helper/CalledElementHelper.js +0 -72
  61. package/lib/camunda-cloud/helper/ElementHelper.js +0 -18
  62. package/lib/camunda-cloud/helper/ExtensionElementsHelper.js +0 -17
  63. package/lib/camunda-cloud/helper/FormsHelper.js +0 -84
  64. package/lib/camunda-cloud/helper/InputOutputHelper.js +0 -138
  65. package/lib/camunda-cloud/helper/Utils.js +0 -10
  66. package/lib/camunda-cloud/helper/ZeebeServiceTaskHelper.js +0 -41
  67. package/lib/camunda-platform/features/modeling/behavior/DeleteErrorEventDefinitionBehavior.js +0 -67
  68. package/lib/camunda-platform/features/modeling/behavior/DeleteRetryTimeCycleBehavior.js +0 -84
  69. package/lib/camunda-platform/features/modeling/behavior/UpdateCamundaExclusiveBehavior.js +0 -65
  70. package/lib/camunda-platform/features/modeling/behavior/UpdateInputOutputBehavior.js +0 -54
  71. package/lib/camunda-platform/features/modeling/behavior/UpdateResultVariableBehavior.js +0 -51
  72. package/lib/camunda-platform/features/modeling/behavior/UserTaskFormsBehavior.js +0 -70
  73. package/lib/camunda-platform/features/modeling/behavior/UserTaskGeneratedFormsBehavior.js +0 -117
  74. package/lib/camunda-platform/features/modeling/behavior/index.js +0 -26
  75. package/lib/camunda-platform/features/modeling/index.js +0 -7
  76. package/lib/camunda-platform/helper/InputOutputHelper.js +0 -29
@@ -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,17 +0,0 @@
1
- import { is } from 'bpmn-js/lib/util/ModelUtil';
2
-
3
- export function getExtensionElements(bo, type) {
4
- let elements = [];
5
- const extensionElements = bo.get('extensionElements');
6
-
7
- if (typeof extensionElements !== 'undefined') {
8
- const extensionValues = extensionElements.get('values');
9
- if (typeof extensionValues !== 'undefined') {
10
- elements = extensionValues.filter(function(value) {
11
- return is(value, type);
12
- });
13
- }
14
- }
15
-
16
- return elements;
17
- }
@@ -1,84 +0,0 @@
1
- import { getExtensionElements } from './ExtensionElementsHelper';
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 = getExtensionElements(rootElement, 'zeebe:UserTaskForm');
45
-
46
- return find(userTaskForms, function(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 = getExtensionElements(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
- }
@@ -1,10 +0,0 @@
1
- import Ids from 'ids';
2
-
3
- /**
4
- * generate a semantic id with given prefix
5
- */
6
- export function nextId(prefix) {
7
- const ids = new Ids([ 32,32,1 ]);
8
-
9
- return ids.nextPrefixed(prefix);
10
- }
@@ -1,41 +0,0 @@
1
- import {
2
- getBusinessObject,
3
- is
4
- } from 'bpmn-js/lib/util/ModelUtil';
5
-
6
- import { forEach } from 'min-dash';
7
-
8
-
9
- export function isZeebeServiceTask(element) {
10
- if (!is(element, 'zeebe:ZeebeServiceTask')) return false;
11
-
12
- if (is(element, 'bpmn:EndEvent') || is(element, 'bpmn:IntermediateThrowEvent')) {
13
- return !!getMessageEventDefinition(element);
14
- }
15
-
16
- return true;
17
- }
18
-
19
- export function isMessageEndEvent(element) {
20
- return is(element, 'bpmn:EndEvent') && !!getMessageEventDefinition(element);
21
- }
22
-
23
- export function isMessageThrowEvent(element) {
24
- return is(element, 'bpmn:IntermediateThrowEvent') && !!getMessageEventDefinition(element);
25
- }
26
-
27
- function getMessageEventDefinition(element) {
28
-
29
- var bo = getBusinessObject(element),
30
- eventDefinition = null;
31
-
32
- if (bo.eventDefinitions) {
33
- forEach(bo.eventDefinitions, function(event) {
34
- if (is(event, 'bpmn:MessageEventDefinition')) {
35
- eventDefinition = event;
36
- }
37
- });
38
- }
39
-
40
- return eventDefinition;
41
- }
@@ -1,67 +0,0 @@
1
- import {
2
- getBusinessObject,
3
- is
4
- } from 'bpmn-js/lib/util/ModelUtil';
5
-
6
- import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
7
-
8
- const HIGH_PRIORITY = 5000;
9
-
10
-
11
- /**
12
- * Camunda BPMN specific camunda:ErrorEventDefinition behavior.
13
- */
14
- export default class DeleteErrorEventDefinitionBehavior extends CommandInterceptor {
15
- constructor(eventBus, modeling) {
16
- super(eventBus);
17
-
18
- /**
19
- * Remove camunda:ErrorEventDefinitions on camunda:type set to external.
20
- */
21
- this.postExecute([
22
- 'element.updateProperties',
23
- 'properties-panel.update-businessobject'
24
- ], HIGH_PRIORITY, function(context) {
25
- const {
26
- element,
27
- oldProperties,
28
- properties
29
- } = context;
30
-
31
- const businessObject = getBusinessObject(element),
32
- extensionElements = businessObject.get('extensionElements');
33
-
34
- 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 });
43
- }
44
- }, true);
45
-
46
- }
47
- }
48
-
49
- 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
- }
@@ -1,84 +0,0 @@
1
- import {
2
- getBusinessObject,
3
- is
4
- } from 'bpmn-js/lib/util/ModelUtil';
5
-
6
- import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
7
-
8
- const HIGH_PRIORITY = 5000;
9
-
10
-
11
- /**
12
- * Camunda BPMN specific camunda:FailedJobRetryTimeCycle behavior.
13
- */
14
- export default class DeleteRetryTimeCycleBehavior extends CommandInterceptor {
15
- constructor(eventBus, modeling) {
16
- super(eventBus);
17
-
18
- /**
19
- * Remove camunda:FailedJobRetryTimeCycle if camunda:asyncAfter or camunda:asyncBefore is set to false.
20
- */
21
- this.postExecute([
22
- 'element.updateProperties',
23
- 'properties-panel.update-businessobject'
24
- ], HIGH_PRIORITY, function(context) {
25
- const {
26
- element,
27
- properties
28
- } = context;
29
-
30
- const businessObject = getBusinessObject(element),
31
- extensionElements = businessObject.extensionElements;
32
-
33
- if (
34
- !is(element, 'camunda:AsyncCapable')
35
- || (properties[ 'camunda:asyncBefore' ] !== false && properties[ 'camunda:asyncAfter' ] !== false)
36
- || !extensionElements
37
- || !extensionElements.get('values').length
38
- || !extensionElements.get('values').find((value) => is(value, 'camunda:FailedJobRetryTimeCycle'))
39
- || getTimerEventDefinition(element)
40
- || isAsyncBefore(businessObject)
41
- || isAsyncAfter(businessObject)
42
- ) {
43
- return;
44
- }
45
-
46
- const values = extensionElements.get('values').filter((element) => {
47
- return !is(element, 'camunda:FailedJobRetryTimeCycle');
48
- });
49
-
50
- modeling.updateModdleProperties(element, extensionElements, { values });
51
- }, true);
52
-
53
- }
54
- }
55
-
56
- DeleteRetryTimeCycleBehavior.$inject = [
57
- 'eventBus',
58
- 'modeling'
59
- ];
60
-
61
-
62
- // helpers //////////
63
-
64
- function isAsyncBefore(businessObject) {
65
- return !!(businessObject.get('camunda:asyncBefore') || businessObject.get('camunda:async'));
66
- }
67
-
68
- function isAsyncAfter(businessObject) {
69
- return !!businessObject.get('camunda:asyncAfter');
70
- }
71
-
72
- function getTimerEventDefinition(element) {
73
- return getEventDefinition(element, 'bpmn:TimerEventDefinition');
74
- }
75
-
76
- function getEventDefinition(element, type) {
77
- const businessObject = getBusinessObject(element);
78
-
79
- const eventDefinitions = businessObject.get('eventDefinitions') || [];
80
-
81
- return eventDefinitions.find((eventDefinition) => {
82
- return is(eventDefinition, type);
83
- });
84
- }
@@ -1,65 +0,0 @@
1
- import {
2
- getBusinessObject,
3
- is
4
- } from 'bpmn-js/lib/util/ModelUtil';
5
-
6
- import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
7
-
8
- const HIGH_PRIORITY = 5000;
9
-
10
-
11
- /**
12
- * Camunda BPMN specific camunda:exclusive behavior.
13
- */
14
- export default class UpdateCamundaExclusiveBehavior extends CommandInterceptor {
15
- constructor(eventBus) {
16
- super(eventBus);
17
-
18
- /**
19
- * Set camunda:exclusive to true on camunda:asyncBefore or camunda:asyncAfter set to false.
20
- */
21
- this.preExecute([
22
- 'element.updateProperties',
23
- 'properties-panel.update-businessobject'
24
- ], HIGH_PRIORITY, function(context) {
25
- const {
26
- element,
27
- properties
28
- } = context;
29
-
30
- const businessObject = getBusinessObject(element);
31
-
32
- if (!is(element, 'camunda:AsyncCapable')
33
- || (properties[ 'camunda:asyncBefore' ] !== false && properties[ 'camunda:asyncAfter' ] !== false)
34
- || isExclusive(businessObject)
35
- || (isAsyncAfter(businessObject) && properties[ 'camunda:asyncAfter' ] !== false)
36
- || (isAsyncBefore(businessObject) && properties[ 'camunda:asyncBefore' ] !== false)
37
- || (properties[ 'camunda:asyncBefore' ] === true || properties[ 'camunda:asyncAfter' ] === true)
38
- ) {
39
- return;
40
- }
41
-
42
- properties[ 'camunda:exclusive' ] = true;
43
- }, true);
44
-
45
- }
46
- }
47
-
48
- UpdateCamundaExclusiveBehavior.$inject = [
49
- 'eventBus'
50
- ];
51
-
52
-
53
- // helpers //////////
54
-
55
- function isAsyncBefore(businessObject) {
56
- return !!(businessObject.get('camunda:asyncBefore') || businessObject.get('camunda:async'));
57
- }
58
-
59
- function isAsyncAfter(businessObject) {
60
- return !!businessObject.get('camunda:asyncAfter');
61
- }
62
-
63
- function isExclusive(businessObject) {
64
- return !!businessObject.get('camunda:exclusive');
65
- }
@@ -1,54 +0,0 @@
1
- import { getBusinessObject } from 'bpmn-js/lib/util/ModelUtil';
2
-
3
- import {
4
- getInputOutput,
5
- isInputOutputEmpty
6
- } from '../../../helper/InputOutputHelper';
7
-
8
- import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
9
-
10
- /**
11
- * Camunda BPMN specific camunda:InputOutput behavior.
12
- */
13
- export default class UpdateInputOutputBehavior extends CommandInterceptor {
14
- constructor(eventBus, modeling) {
15
- super(eventBus);
16
-
17
- /**
18
- * Remove empty camunda:InputOutput on update.
19
- */
20
- this.postExecute([
21
- 'element.updateProperties',
22
- 'element.updateModdleProperties',
23
- 'properties-panel.update-businessobject-list'
24
- ], function(context) {
25
- const {
26
- element,
27
- oldProperties,
28
- propertyName
29
- } = context;
30
-
31
- const businessObject = getBusinessObject(element),
32
- inputOutput = getInputOutput(businessObject),
33
- extensionElements = businessObject.get('extensionElements');
34
-
35
- // do not remove newly added camunda:InputOutput
36
- if (!oldProperties && propertyName === 'values') {
37
- return;
38
- }
39
-
40
- if (inputOutput && isInputOutputEmpty(inputOutput)) {
41
- const values = extensionElements.get('values').filter(function(element) {
42
- return element !== inputOutput;
43
- });
44
-
45
- modeling.updateModdleProperties(element, extensionElements, { values });
46
- }
47
- }, true);
48
- }
49
- }
50
-
51
- UpdateInputOutputBehavior.$inject = [
52
- 'eventBus',
53
- 'modeling'
54
- ];
@@ -1,51 +0,0 @@
1
- import { is } from 'bpmn-js/lib/util/ModelUtil';
2
-
3
- import { has } from 'min-dash';
4
-
5
- import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
6
-
7
- const HIGH_PRIORITY = 5000;
8
-
9
-
10
- /**
11
- * Camunda BPMN specific camunda:resultVariable behavior.
12
- */
13
- export default class UpdateResultVariableBehavior extends CommandInterceptor {
14
- constructor(eventBus) {
15
- super(eventBus);
16
-
17
- /**
18
- * Remove camunda:mapDecisionResult on camunda:resultVariable removed.
19
- */
20
- this.preExecute([
21
- 'element.updateProperties',
22
- 'properties-panel.update-businessobject'
23
- ], HIGH_PRIORITY, function(context) {
24
- const {
25
- element,
26
- properties
27
- } = context;
28
-
29
- if (
30
- is(element, 'camunda:DmnCapable')
31
- && has(properties, 'camunda:resultVariable')
32
- && isEmpty(properties[ 'camunda:resultVariable' ])
33
- ) {
34
- properties[ 'camunda:mapDecisionResult' ] = null;
35
- }
36
- }, true);
37
-
38
- }
39
- }
40
-
41
- UpdateResultVariableBehavior.$inject = [
42
- 'eventBus'
43
- ];
44
-
45
-
46
- // helpers //////////
47
-
48
- function isEmpty(value) {
49
- return value == undefined || value === '';
50
- }
51
-