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.
Files changed (27) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/assets/properties-panel.css +780 -0
  3. package/dist/base-modeler.development.js +383 -104
  4. package/dist/base-modeler.production.min.js +3 -3
  5. package/dist/camunda-cloud-modeler.development.js +952 -609
  6. package/dist/camunda-cloud-modeler.production.min.js +3 -3
  7. package/dist/camunda-platform-modeler.development.js +561 -374
  8. package/dist/camunda-platform-modeler.production.min.js +3 -3
  9. package/lib/camunda-cloud/features/modeling/behavior/CleanUpBusinessRuleTaskBehavior.js +112 -0
  10. package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeBoundaryEventBehavior.js +51 -55
  11. package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeCallActivityBehavior.js +56 -59
  12. package/lib/camunda-cloud/features/modeling/behavior/FormDefinitionBehavior.js +69 -127
  13. package/lib/camunda-cloud/features/modeling/behavior/UpdatePropagateAllChildVariablesBehavior.js +76 -128
  14. package/lib/camunda-cloud/features/modeling/behavior/index.js +3 -0
  15. package/lib/camunda-cloud/features/properties-provider/parts/implementation/InputOutput.js +21 -7
  16. package/lib/camunda-cloud/features/rules/BpmnRules.js +1 -1
  17. package/lib/camunda-cloud/helper/CalledElementHelper.js +43 -41
  18. package/lib/camunda-cloud/helper/FormsHelper.js +38 -50
  19. package/lib/camunda-cloud/helper/InputOutputHelper.js +92 -106
  20. package/lib/camunda-platform/features/modeling/behavior/DeleteErrorEventDefinitionBehavior.js +24 -47
  21. package/lib/camunda-platform/features/modeling/behavior/DeleteRetryTimeCycleBehavior.js +39 -81
  22. package/lib/camunda-platform/features/modeling/behavior/UpdateCamundaExclusiveBehavior.js +31 -65
  23. package/lib/camunda-platform/features/modeling/behavior/UpdateInputOutputBehavior.js +42 -76
  24. package/lib/camunda-platform/features/modeling/behavior/UpdateResultVariableBehavior.js +21 -26
  25. package/lib/camunda-platform/features/modeling/behavior/UserTaskFormsBehavior.js +16 -10
  26. package/lib/camunda-platform/helper/InputOutputHelper.js +29 -0
  27. package/package.json +6 -6
@@ -1,88 +1,54 @@
1
- import inherits from 'inherits';
1
+ import { getBusinessObject } from 'bpmn-js/lib/util/ModelUtil';
2
2
 
3
3
  import {
4
- getBusinessObject,
5
- is
6
- } from 'bpmn-js/lib/util/ModelUtil';
4
+ getInputOutput,
5
+ isInputOutputEmpty
6
+ } from '../../../helper/InputOutputHelper';
7
7
 
8
8
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
9
9
 
10
10
  /**
11
- * Camunda BPMN specific `camunda:inputOutput` behavior.
11
+ * Camunda BPMN specific camunda:InputOutput behavior.
12
12
  */
13
- export default function UpdateInputOutputBehavior(eventBus, modeling) {
14
-
15
- CommandInterceptor.call(this, eventBus);
16
-
17
- this.postExecute([
18
- 'element.updateProperties',
19
- 'element.updateModdleProperties',
20
- 'properties-panel.update-businessobject-list'
21
- ], function(context) {
22
- const {
23
- element,
24
- oldProperties,
25
- propertyName
26
- } = context;
27
-
28
- const businessObject = getBusinessObject(element);
29
- const inputOutput = getInputOutput(businessObject);
30
- const extensionElements = businessObject.get('extensionElements');
31
-
32
- // do not apply if inputOutput got recently added
33
- if (!oldProperties && propertyName === 'values') {
34
- return;
35
- }
36
-
37
- // remove camunda:inputOutput if there are no input/output parameters anymore
38
- if (inputOutput && isEmpty(inputOutput)) {
39
- const filtered = extensionElements.values.filter(function(element) {
40
- return element !== inputOutput;
41
- });
42
-
43
- modeling.updateModdleProperties(element, extensionElements, {
44
- values: filtered
45
- });
46
- }
47
- }, true);
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
+ }
48
49
  }
49
50
 
50
-
51
51
  UpdateInputOutputBehavior.$inject = [
52
52
  'eventBus',
53
53
  'modeling'
54
- ];
55
-
56
- inherits(UpdateInputOutputBehavior, CommandInterceptor);
57
-
58
-
59
- // helper //////////////////
60
-
61
- function getInputParameters(inputOutput) {
62
- return inputOutput.get('inputParameters');
63
- }
64
-
65
- function getOutputParameters(inputOutput) {
66
- return inputOutput.get('outputParameters');
67
- }
68
-
69
- function getInputOutput(businessObject) {
70
- const extensionElements = businessObject.get('extensionElements');
71
-
72
- if (!extensionElements) {
73
- return;
74
- }
75
-
76
- const values = extensionElements.get('values');
77
-
78
- return values.find((value) => {
79
- return is(value, 'camunda:InputOutput');
80
- });
81
- }
82
-
83
- function isEmpty(inputOutput) {
84
- const inputParameters = getInputParameters(inputOutput);
85
- const outputParameters = getOutputParameters(inputOutput);
86
-
87
- return inputParameters.length === 0 && outputParameters.length === 0;
88
- }
54
+ ];
@@ -1,12 +1,6 @@
1
- import inherits from 'inherits';
1
+ import { is } from 'bpmn-js/lib/util/ModelUtil';
2
2
 
3
- import {
4
- is
5
- } from 'bpmn-js/lib/util/ModelUtil';
6
-
7
- import {
8
- has
9
- } from 'min-dash';
3
+ import { has } from 'min-dash';
10
4
 
11
5
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
12
6
 
@@ -14,41 +8,42 @@ const HIGH_PRIORITY = 5000;
14
8
 
15
9
 
16
10
  /**
17
- * Camunda BPMN specific `camunda:resultVariable` behavior.
18
- *
19
- * When `camunda:resultVariable` is removed from a service task like element
20
- * `camunda:mapDecisionResult` for the element will be cleaned up.
11
+ * Camunda BPMN specific camunda:resultVariable behavior.
21
12
  */
22
- export default function UpdateResultVariableBehavior(eventBus) {
23
-
24
- CommandInterceptor.call(this, eventBus);
25
-
26
- this.preExecute([ 'properties-panel.update-businessobject', 'element.updateProperties' ],
27
- HIGH_PRIORITY, function(context) {
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) {
28
24
  const {
29
25
  element,
30
26
  properties
31
27
  } = context;
32
28
 
33
29
  if (
34
- is(element, 'camunda:DmnCapable') &&
35
- has(properties, 'camunda:resultVariable') &&
36
- isEmpty(properties['camunda:resultVariable'])
30
+ is(element, 'camunda:DmnCapable')
31
+ && has(properties, 'camunda:resultVariable')
32
+ && isEmpty(properties[ 'camunda:resultVariable' ])
37
33
  ) {
38
- properties['camunda:mapDecisionResult'] = null;
34
+ properties[ 'camunda:mapDecisionResult' ] = null;
39
35
  }
40
36
  }, true);
41
- }
42
37
 
38
+ }
39
+ }
43
40
 
44
41
  UpdateResultVariableBehavior.$inject = [
45
42
  'eventBus'
46
43
  ];
47
44
 
48
- inherits(UpdateResultVariableBehavior, CommandInterceptor);
49
-
50
45
 
51
- // helper //////////////////
46
+ // helpers //////////
52
47
 
53
48
  function isEmpty(value) {
54
49
  return value == undefined || value === '';
@@ -1,18 +1,24 @@
1
1
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
2
2
 
3
- import { isUndefined } from 'min-dash';
3
+ import {
4
+ has,
5
+ isUndefined
6
+ } from 'min-dash';
4
7
 
5
8
 
6
9
  /**
7
- * Camunda BPMN specific user task forms behavior ensuring that only one of the following options is configured:
8
- *
9
- * 1. embedded, external or Camunda forms using camunda:formKey
10
- * 2. Camunda forms using camunda:formRef
10
+ * Camunda BPMN specific user task forms behavior.
11
11
  */
12
12
  export default class UserTaskFormsBehavior extends CommandInterceptor {
13
13
  constructor(eventBus) {
14
14
  super(eventBus);
15
15
 
16
+ /**
17
+ * Ensure that only one of the following options is configured:
18
+ *
19
+ * 1. embedded, external or Camunda forms using camunda:formKey
20
+ * 2. Camunda forms using camunda:formRef
21
+ */
16
22
  this.preExecute([
17
23
  'element.updateProperties',
18
24
  'element.updateModdleProperties',
@@ -26,13 +32,13 @@ export default class UserTaskFormsBehavior extends CommandInterceptor {
26
32
  context.element.businessObject
27
33
  );
28
34
 
29
- if ('camunda:formKey' in properties) {
35
+ if (has(properties, 'camunda:formKey')) {
30
36
  Object.assign(properties, {
31
37
  'camunda:formRef': undefined,
32
38
  'camunda:formRefBinding': undefined,
33
39
  'camunda:formRefVersion': undefined
34
40
  });
35
- } else if ('camunda:formRef' in properties) {
41
+ } else if (has(properties, 'camunda:formRef')) {
36
42
  Object.assign(properties, {
37
43
  'camunda:formKey': undefined
38
44
  });
@@ -44,21 +50,21 @@ export default class UserTaskFormsBehavior extends CommandInterceptor {
44
50
  });
45
51
  }
46
52
 
47
- if (!('camunda:formRefBinding' in properties) && isUndefined(businessObject.get('camunda:formRefBinding'))) {
53
+ if (!has(properties, 'camunda:formRefBinding') && isUndefined(businessObject.get('camunda:formRefBinding'))) {
48
54
  Object.assign(properties, {
49
55
  'camunda:formRefBinding': 'latest'
50
56
  });
51
57
  }
52
58
  }
53
59
 
54
- if ('camunda:formRefBinding' in properties && properties[ 'camunda:formRefBinding' ] !== 'version') {
60
+ if (has(properties, 'camunda:formRefBinding') && properties[ 'camunda:formRefBinding' ] !== 'version') {
55
61
  Object.assign(properties, {
56
62
  'camunda:formRefVersion': undefined
57
63
  });
58
64
  }
59
65
  }, true);
66
+
60
67
  }
61
68
  }
62
69
 
63
-
64
70
  UserTaskFormsBehavior.$inject = [ 'eventBus' ];
@@ -0,0 +1,29 @@
1
+ import { is } from 'bpmn-js/lib/util/ModelUtil';
2
+
3
+
4
+ export function getInputOutput(businessObject) {
5
+ const extensionElements = businessObject.get('extensionElements');
6
+
7
+ if (!extensionElements) {
8
+ return;
9
+ }
10
+
11
+ return extensionElements.get('values').find((value) => {
12
+ return is(value, 'camunda:InputOutput');
13
+ });
14
+ }
15
+
16
+ export function getInputParameters(inputOutput) {
17
+ return inputOutput.get('inputParameters');
18
+ }
19
+
20
+ export function getOutputParameters(inputOutput) {
21
+ return inputOutput.get('outputParameters');
22
+ }
23
+
24
+ export function isInputOutputEmpty(inputOutput) {
25
+ const inputParameters = getInputParameters(inputOutput);
26
+ const outputParameters = getOutputParameters(inputOutput);
27
+
28
+ return !inputParameters.length && !outputParameters.length;
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camunda-bpmn-js",
3
- "version": "0.11.3",
3
+ "version": "0.12.1",
4
4
  "description": "Embeddable Camunda modeling distributions based on bpmn-js",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -40,18 +40,18 @@
40
40
  "license": "MIT",
41
41
  "dependencies": {
42
42
  "@bpmn-io/align-to-origin": "^0.7.0",
43
- "bpmn-js": "^8.7.3",
43
+ "bpmn-js": "^8.8.2",
44
44
  "bpmn-js-disable-collapsed-subprocess": "^0.1.3",
45
45
  "bpmn-js-executable-fix": "^0.1.3",
46
- "bpmn-js-properties-panel": "^0.45.0",
46
+ "bpmn-js-properties-panel": "^0.46.0",
47
47
  "bpmn-js-signavio-compat": "^1.2.3",
48
48
  "camunda-bpmn-moddle": "^6.1.1",
49
- "diagram-js": "^7.3.0",
49
+ "diagram-js": "^7.5.0",
50
50
  "diagram-js-minimap": "^2.0.4",
51
51
  "diagram-js-origin": "^1.3.2",
52
52
  "inherits": "^2.0.4",
53
53
  "min-dash": "^3.7.0",
54
- "zeebe-bpmn-moddle": "^0.8.0"
54
+ "zeebe-bpmn-moddle": "^0.10.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@rollup/plugin-commonjs": "^17.1.0",
@@ -75,7 +75,7 @@
75
75
  "karma-sinon-chai": "^2.0.2",
76
76
  "karma-webpack": "^5.0.0",
77
77
  "min-dom": "^3.1.3",
78
- "mocha": "^8.2.1",
78
+ "mocha": "^9.1.3",
79
79
  "mocha-test-container-support": "^0.2.0",
80
80
  "npm-run-all": "^4.1.5",
81
81
  "puppeteer": "^8.0.0",