camunda-bpmn-js 0.13.0-alpha.0 → 0.13.0-alpha.3

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 (39) hide show
  1. package/CHANGELOG.md +24 -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/assets/diagram-js.css +80 -78
  7. package/dist/assets/element-templates.css +3 -3
  8. package/dist/assets/properties-panel.css +5 -17
  9. package/dist/base-modeler.development.js +6632 -6025
  10. package/dist/base-modeler.production.min.js +4 -4
  11. package/dist/camunda-cloud-modeler.development.js +44091 -39170
  12. package/dist/camunda-cloud-modeler.production.min.js +4 -4
  13. package/dist/camunda-platform-modeler.development.js +21448 -21032
  14. package/dist/camunda-platform-modeler.production.min.js +4 -4
  15. package/lib/base/Modeler.js +0 -6
  16. package/lib/camunda-cloud/ElementTemplatesValidator.js +1 -0
  17. package/lib/camunda-cloud/Modeler.js +14 -1
  18. package/lib/camunda-cloud/features/drilldown/index.js +3 -0
  19. package/lib/camunda-cloud/features/modeling/behavior/CleanUpBusinessRuleTaskBehavior.js +60 -57
  20. package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeCallActivityBehavior.js +1 -1
  21. package/lib/camunda-cloud/features/modeling/behavior/RemoveAssignmentDefinitionBehavior.js +51 -0
  22. package/lib/camunda-cloud/features/modeling/behavior/UpdatePropagateAllChildVariablesBehavior.js +60 -33
  23. package/lib/camunda-cloud/features/modeling/behavior/index.js +8 -8
  24. package/lib/camunda-cloud/helper/CalledElementHelper.js +5 -5
  25. package/lib/camunda-cloud/helper/FormsHelper.js +4 -4
  26. package/lib/camunda-cloud/helper/Utils.js +1 -1
  27. package/lib/camunda-platform/features/modeling/behavior/DeleteErrorEventDefinitionBehavior.js +23 -36
  28. package/lib/camunda-platform/features/modeling/behavior/DeleteRetryTimeCycleBehavior.js +33 -21
  29. package/lib/camunda-platform/features/modeling/behavior/UpdateCamundaExclusiveBehavior.js +14 -11
  30. package/lib/camunda-platform/features/modeling/behavior/UpdateInputOutputBehavior.js +20 -30
  31. package/lib/camunda-platform/features/modeling/behavior/UpdateResultVariableBehavior.js +15 -12
  32. package/lib/camunda-platform/features/modeling/behavior/UserTaskFormsBehavior.js +9 -8
  33. package/lib/camunda-platform/features/modeling/behavior/UserTaskGeneratedFormsBehavior.js +32 -33
  34. package/lib/util/ExtensionElementsUtil.js +59 -0
  35. package/package.json +12 -13
  36. package/styles/base-modeler.css +1 -0
  37. package/styles/camunda-cloud-modeler.css +2 -1
  38. package/lib/camunda-cloud/features/modeling/behavior/CleanUpAssignmentDefinitionBehavior.js +0 -78
  39. package/lib/camunda-cloud/helper/ExtensionElementsHelper.js +0 -17
@@ -5,37 +5,45 @@ import {
5
5
 
6
6
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
7
7
 
8
+ import {
9
+ getExtensionElementsList,
10
+ removeExtensionElements
11
+ } from '../../../../util/ExtensionElementsUtil';
12
+
8
13
  const HIGH_PRIORITY = 5000;
9
14
 
10
15
 
11
16
  /**
12
- * Camunda BPMN specific camunda:FailedJobRetryTimeCycle behavior.
17
+ * Camunda BPMN specific behavior ensuring camunda:FailedJobRetryTimeCycle is
18
+ * removed when both camunda:asyncAfter and camunda:asyncBefore set to false.
19
+ * Doesn't apply if element has bpmn:TimerEventDefinition.
13
20
  */
14
21
  export default class DeleteRetryTimeCycleBehavior extends CommandInterceptor {
15
- constructor(eventBus, modeling) {
22
+ constructor(commandStack, eventBus) {
16
23
  super(eventBus);
17
24
 
18
- /**
19
- * Remove camunda:FailedJobRetryTimeCycle if camunda:asyncAfter or camunda:asyncBefore is set to false.
20
- */
21
25
  this.postExecute([
22
26
  'element.updateProperties',
23
- 'properties-panel.update-businessobject'
27
+ 'element.updateModdleProperties'
24
28
  ], HIGH_PRIORITY, function(context) {
25
29
  const {
26
30
  element,
27
- properties
31
+ moddleElement,
32
+ properties = {}
28
33
  } = context;
29
34
 
30
- const businessObject = getBusinessObject(element),
31
- extensionElements = businessObject.extensionElements;
35
+ const asyncAfter = properties[ 'camunda:asyncAfter' ],
36
+ asyncBefore = properties[ 'camunda:asyncBefore' ];
37
+
38
+ const businessObject = moddleElement || getBusinessObject(element);
39
+
40
+ const failedJobRetryTimeCycle = getFailedJobRetryTimeCycle(element);
32
41
 
33
42
  if (
34
43
  !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'))
44
+ || !is(businessObject, 'camunda:AsyncCapable')
45
+ || (asyncAfter !== false && asyncBefore !== false)
46
+ || !failedJobRetryTimeCycle
39
47
  || getTimerEventDefinition(element)
40
48
  || isAsyncBefore(businessObject)
41
49
  || isAsyncAfter(businessObject)
@@ -43,19 +51,15 @@ export default class DeleteRetryTimeCycleBehavior extends CommandInterceptor {
43
51
  return;
44
52
  }
45
53
 
46
- const values = extensionElements.get('values').filter((element) => {
47
- return !is(element, 'camunda:FailedJobRetryTimeCycle');
48
- });
49
-
50
- modeling.updateModdleProperties(element, extensionElements, { values });
54
+ removeExtensionElements(element, businessObject, failedJobRetryTimeCycle, commandStack);
51
55
  }, true);
52
56
 
53
57
  }
54
58
  }
55
59
 
56
60
  DeleteRetryTimeCycleBehavior.$inject = [
57
- 'eventBus',
58
- 'modeling'
61
+ 'commandStack',
62
+ 'eventBus'
59
63
  ];
60
64
 
61
65
 
@@ -69,6 +73,10 @@ function isAsyncAfter(businessObject) {
69
73
  return !!businessObject.get('camunda:asyncAfter');
70
74
  }
71
75
 
76
+ function getFailedJobRetryTimeCycle(element) {
77
+ return getExtensionElementsList(element, 'camunda:FailedJobRetryTimeCycle')[ 0 ];
78
+ }
79
+
72
80
  function getTimerEventDefinition(element) {
73
81
  return getEventDefinition(element, 'bpmn:TimerEventDefinition');
74
82
  }
@@ -76,7 +84,11 @@ function getTimerEventDefinition(element) {
76
84
  function getEventDefinition(element, type) {
77
85
  const businessObject = getBusinessObject(element);
78
86
 
79
- const eventDefinitions = businessObject.get('eventDefinitions') || [];
87
+ const eventDefinitions = businessObject.get('eventDefinitions');
88
+
89
+ if (!eventDefinitions || !eventDefinitions.length) {
90
+ return;
91
+ }
80
92
 
81
93
  return eventDefinitions.find((eventDefinition) => {
82
94
  return is(eventDefinition, type);
@@ -9,32 +9,35 @@ const HIGH_PRIORITY = 5000;
9
9
 
10
10
 
11
11
  /**
12
- * Camunda BPMN specific camunda:exclusive behavior.
12
+ * Camunda BPMN specific behavior ensuring camunda:exclusive is set to true if
13
+ * camunda:asyncBefore or camunda:asyncAfter is set to false.
13
14
  */
14
15
  export default class UpdateCamundaExclusiveBehavior extends CommandInterceptor {
15
16
  constructor(eventBus) {
16
17
  super(eventBus);
17
18
 
18
- /**
19
- * Set camunda:exclusive to true on camunda:asyncBefore or camunda:asyncAfter set to false.
20
- */
21
19
  this.preExecute([
22
20
  'element.updateProperties',
23
- 'properties-panel.update-businessobject'
21
+ 'element.updateModdleProperties',
24
22
  ], HIGH_PRIORITY, function(context) {
25
23
  const {
26
24
  element,
27
- properties
25
+ moddleElement,
26
+ properties = {}
28
27
  } = context;
29
28
 
30
- const businessObject = getBusinessObject(element);
29
+ const businessObject = moddleElement || getBusinessObject(element);
30
+
31
+ const asyncAfter = properties[ 'camunda:asyncAfter' ],
32
+ asyncBefore = properties[ 'camunda:asyncBefore' ];
31
33
 
32
34
  if (!is(element, 'camunda:AsyncCapable')
33
- || (properties[ 'camunda:asyncBefore' ] !== false && properties[ 'camunda:asyncAfter' ] !== false)
35
+ || !is(businessObject, 'camunda:AsyncCapable')
36
+ || (asyncAfter !== false && asyncBefore !== false)
34
37
  || 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
+ || (isAsyncAfter(businessObject) && asyncAfter !== false)
39
+ || (isAsyncBefore(businessObject) && asyncBefore !== false)
40
+ || (asyncAfter === true || asyncBefore === true)
38
41
  ) {
39
42
  return;
40
43
  }
@@ -1,54 +1,44 @@
1
- import { getBusinessObject } from 'bpmn-js/lib/util/ModelUtil';
1
+ import {
2
+ getBusinessObject,
3
+ is
4
+ } from 'bpmn-js/lib/util/ModelUtil';
5
+
6
+ import { isInputOutputEmpty } from '../../../helper/InputOutputHelper';
2
7
 
3
8
  import {
4
- getInputOutput,
5
- isInputOutputEmpty
6
- } from '../../../helper/InputOutputHelper';
9
+ removeExtensionElements
10
+ } from '../../../../util/ExtensionElementsUtil';
7
11
 
8
12
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
9
13
 
14
+ const LOW_PRIORITY = 250;
15
+
16
+
10
17
  /**
11
- * Camunda BPMN specific camunda:InputOutput behavior.
18
+ * Camunda BPMN specific behavior ensuring empty camunda:InputOutput is removed.
12
19
  */
13
20
  export default class UpdateInputOutputBehavior extends CommandInterceptor {
14
- constructor(eventBus, modeling) {
21
+ constructor(commandStack, eventBus) {
15
22
  super(eventBus);
16
23
 
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) {
24
+ this.postExecuted('element.updateModdleProperties', LOW_PRIORITY, function(context) {
25
25
  const {
26
26
  element,
27
- oldProperties,
28
- propertyName
27
+ moddleElement
29
28
  } = context;
30
29
 
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') {
30
+ if (!is(moddleElement, 'camunda:InputOutput')) {
37
31
  return;
38
32
  }
39
33
 
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 });
34
+ if (isInputOutputEmpty(moddleElement)) {
35
+ removeExtensionElements(element, getBusinessObject(element), moddleElement, commandStack);
46
36
  }
47
37
  }, true);
48
38
  }
49
39
  }
50
40
 
51
41
  UpdateInputOutputBehavior.$inject = [
52
- 'eventBus',
53
- 'modeling'
42
+ 'commandStack',
43
+ 'eventBus'
54
44
  ];
@@ -1,37 +1,42 @@
1
- import { is } from 'bpmn-js/lib/util/ModelUtil';
2
-
3
- import { has } from 'min-dash';
1
+ import {
2
+ getBusinessObject,
3
+ is
4
+ } from 'bpmn-js/lib/util/ModelUtil';
4
5
 
5
6
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
6
7
 
8
+ import { has } from 'min-dash';
9
+
7
10
  const HIGH_PRIORITY = 5000;
8
11
 
9
12
 
10
13
  /**
11
- * Camunda BPMN specific camunda:resultVariable behavior.
14
+ * Camunda BPMN specific camunda:resultVariable behavior ensuring
15
+ * camunda:mapDecisionResult is removed when camunda:resultVariable is removed.
12
16
  */
13
17
  export default class UpdateResultVariableBehavior extends CommandInterceptor {
14
18
  constructor(eventBus) {
15
19
  super(eventBus);
16
20
 
17
- /**
18
- * Remove camunda:mapDecisionResult on camunda:resultVariable removed.
19
- */
20
21
  this.preExecute([
21
22
  'element.updateProperties',
22
- 'properties-panel.update-businessobject'
23
+ 'element.updateModdleProperties'
23
24
  ], HIGH_PRIORITY, function(context) {
24
25
  const {
25
26
  element,
27
+ moddleElement,
26
28
  properties
27
29
  } = context;
28
30
 
31
+ const businessObject = moddleElement || getBusinessObject(element);
32
+
29
33
  if (
30
34
  is(element, 'camunda:DmnCapable')
35
+ && is(businessObject, 'camunda:DmnCapable')
31
36
  && has(properties, 'camunda:resultVariable')
32
37
  && isEmpty(properties[ 'camunda:resultVariable' ])
33
38
  ) {
34
- properties[ 'camunda:mapDecisionResult' ] = null;
39
+ properties[ 'camunda:mapDecisionResult' ] = undefined;
35
40
  }
36
41
  }, true);
37
42
 
@@ -42,10 +47,8 @@ UpdateResultVariableBehavior.$inject = [
42
47
  'eventBus'
43
48
  ];
44
49
 
45
-
46
50
  // helpers //////////
47
51
 
48
52
  function isEmpty(value) {
49
53
  return value == undefined || value === '';
50
- }
51
-
54
+ }
@@ -1,3 +1,5 @@
1
+ import { getBusinessObject } from 'bpmn-js/lib/util/ModelUtil';
2
+
1
3
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
2
4
 
3
5
  import {
@@ -21,16 +23,15 @@ export default class UserTaskFormsBehavior extends CommandInterceptor {
21
23
  */
22
24
  this.preExecute([
23
25
  'element.updateProperties',
24
- 'element.updateModdleProperties',
25
- 'properties-panel.update-businessobject'
26
+ 'element.updateModdleProperties'
26
27
  ], function(context) {
27
- const { properties } = context;
28
+ const {
29
+ element,
30
+ moddleElement,
31
+ properties
32
+ } = context;
28
33
 
29
- const businessObject = (
30
- context.moddleElement ||
31
- context.businessObject ||
32
- context.element.businessObject
33
- );
34
+ const businessObject = moddleElement || getBusinessObject(element);
34
35
 
35
36
  if (has(properties, 'camunda:formKey')) {
36
37
  Object.assign(properties, {
@@ -2,6 +2,8 @@ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
2
2
 
3
3
  import { getBusinessObject, is } from 'bpmn-js/lib/util/ModelUtil';
4
4
 
5
+ import { has } from 'min-dash';
6
+
5
7
 
6
8
  /**
7
9
  * Camunda BPMN specific user task generated forms behavior.
@@ -14,19 +16,17 @@ export default class UserTaskFormsBehavior extends CommandInterceptor {
14
16
  constructor(eventBus, modeling) {
15
17
  super(eventBus);
16
18
 
17
- this.preExecute([
18
- 'element.updateModdleProperties',
19
- 'properties-panel.update-businessobject'
20
- ], function(context) {
21
- let {
22
- businessObject,
19
+ /**
20
+ * Remove camunda:FormField#values if camunda:FormField#type is changed to
21
+ * something other than enum.
22
+ */
23
+ this.preExecute('element.updateModdleProperties', function(context) {
24
+ const {
23
25
  moddleElement,
24
26
  properties
25
27
  } = context;
26
28
 
27
- businessObject = businessObject || moddleElement;
28
-
29
- if (!is(businessObject, 'camunda:FormField')) {
29
+ if (!is(moddleElement, 'camunda:FormField')) {
30
30
  return;
31
31
  }
32
32
 
@@ -35,59 +35,58 @@ export default class UserTaskFormsBehavior extends CommandInterceptor {
35
35
  }
36
36
  }, true);
37
37
 
38
- this.preExecute([
39
- 'element.updateModdleProperties',
40
- 'properties-panel.update-businessobject'
41
- ], function(context) {
42
- let {
43
- businessObject,
38
+ /**
39
+ * Update camunda:FormData#businessKey if camunda:FormField#id is changed.
40
+ */
41
+ this.preExecute('element.updateModdleProperties', function(context) {
42
+ const {
44
43
  element,
45
44
  moddleElement,
46
45
  properties
47
46
  } = context;
48
47
 
49
- businessObject = businessObject || moddleElement;
50
-
51
- if (!is(businessObject, 'camunda:FormField')) {
48
+ if (!is(moddleElement, 'camunda:FormField') || !has(properties, 'camunda:id')) {
52
49
  return;
53
50
  }
54
51
 
55
52
  const formData = getFormData(element);
56
53
 
57
- if ('camunda:id' in properties && isBusinessKey(businessObject, formData)) {
54
+ if (isBusinessKey(moddleElement, formData)) {
58
55
  modeling.updateModdleProperties(element, formData, {
59
56
  'camunda:businessKey': properties[ 'camunda:id' ]
60
57
  });
61
58
  }
62
59
  }, true);
63
60
 
64
- this.postExecute('properties-panel.update-businessobject-list', function(context) {
61
+ /**
62
+ * Remove camunda:FormData#businessKey if camunda:FormField is removed.
63
+ */
64
+ this.postExecute('element.updateModdleProperties', function(context) {
65
65
  const {
66
- currentObject: businessObject,
67
66
  element,
68
- propertyName,
69
- objectsToRemove = []
67
+ moddleElement,
68
+ properties
70
69
  } = context;
71
70
 
72
- if (!is(businessObject, 'camunda:FormData')
73
- || propertyName !== 'fields'
74
- || !objectsToRemove.length) {
71
+ if (!is(moddleElement, 'camunda:FormData') || !has(properties, 'fields')) {
75
72
  return;
76
73
  }
77
74
 
78
- const businessKey = businessObject.get('camunda:businessKey');
75
+ const businessKey = moddleElement.get('camunda:businessKey');
79
76
 
80
77
  if (!businessKey) {
81
78
  return;
82
79
  }
83
80
 
84
- objectsToRemove.forEach((object) => {
85
- if (is(object, 'camunda:FormField') && object.get('camunda:id') === businessKey) {
86
- modeling.updateModdleProperties(element, businessObject, {
87
- 'camunda:businessKey': undefined
88
- });
89
- }
81
+ const fieldWithBusinessKey = moddleElement.get('fields').find(field => {
82
+ return field.get('camunda:id') === businessKey;
90
83
  });
84
+
85
+ if (!fieldWithBusinessKey) {
86
+ modeling.updateModdleProperties(element, moddleElement, {
87
+ 'camunda:businessKey': undefined
88
+ });
89
+ }
91
90
  }, true);
92
91
  }
93
92
  }
@@ -0,0 +1,59 @@
1
+ import {
2
+ getBusinessObject,
3
+ is
4
+ } from 'bpmn-js/lib/util/ModelUtil';
5
+
6
+ import { isArray } from 'min-dash';
7
+
8
+ /**
9
+ * Get extension elements of business object. Optionally filter by type.
10
+ *
11
+ * @param {djs.model.Base|ModdleElement} element
12
+ * @param {String} [type=undefined]
13
+ * @returns {Array<ModdleElement>}
14
+ */
15
+ export function getExtensionElementsList(element, type = undefined) {
16
+ const businessObject = getBusinessObject(element),
17
+ extensionElements = businessObject.get('extensionElements');
18
+
19
+ if (!extensionElements) {
20
+ return [];
21
+ }
22
+
23
+ const values = extensionElements.get('values');
24
+
25
+ if (!values || !values.length) {
26
+ return [];
27
+ }
28
+
29
+ if (type) {
30
+ return values.filter(value => is(value, type));
31
+ }
32
+
33
+ return values;
34
+ }
35
+
36
+ /**
37
+ * Remove one or more extension elements. Remove bpmn:ExtensionElements afterwards if it's empty.
38
+ *
39
+ * @param {ModdleElement} element
40
+ * @param {ModdleElement} businessObject
41
+ * @param {ModdleElement|Array<ModdleElement>} extensionElementsToRemove
42
+ * @param {CommandStack} commandStack
43
+ */
44
+ export function removeExtensionElements(element, businessObject, extensionElementsToRemove, commandStack) {
45
+ if (!isArray(extensionElementsToRemove)) {
46
+ extensionElementsToRemove = [ extensionElementsToRemove ];
47
+ }
48
+
49
+ const extensionElements = businessObject.get('extensionElements'),
50
+ values = extensionElements.get('values').filter(value => !extensionElementsToRemove.includes(value));
51
+
52
+ commandStack.execute('element.updateModdleProperties', {
53
+ element,
54
+ moddleElement: extensionElements,
55
+ properties: {
56
+ values
57
+ }
58
+ });
59
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camunda-bpmn-js",
3
- "version": "0.13.0-alpha.0",
3
+ "version": "0.13.0-alpha.3",
4
4
  "description": "Embeddable Camunda modeling distributions based on bpmn-js",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -40,19 +40,18 @@
40
40
  "license": "MIT",
41
41
  "dependencies": {
42
42
  "@bpmn-io/align-to-origin": "^0.7.0",
43
- "@bpmn-io/properties-panel": "~0.10.0",
44
- "bpmn-js": "^8.8.3",
43
+ "@bpmn-io/properties-panel": "^0.11.0",
44
+ "bpmn-js": "^9.0.2",
45
45
  "bpmn-js-disable-collapsed-subprocess": "^0.1.3",
46
46
  "bpmn-js-executable-fix": "^0.1.3",
47
- "bpmn-js-properties-panel": "~1.0.0-alpha.0",
48
- "bpmn-js-signavio-compat": "^1.2.3",
47
+ "bpmn-js-properties-panel": "~1.0.0-alpha.5",
49
48
  "camunda-bpmn-moddle": "^6.1.1",
50
- "diagram-js": "^7.5.0",
51
- "diagram-js-minimap": "^2.0.4",
49
+ "diagram-js": "^8.1.1",
50
+ "diagram-js-minimap": "^2.1.0",
52
51
  "diagram-js-origin": "^1.3.2",
53
52
  "inherits": "^2.0.4",
54
- "min-dash": "^3.7.0",
55
- "zeebe-bpmn-moddle": "^0.10.0"
53
+ "min-dash": "^3.8.1",
54
+ "zeebe-bpmn-moddle": "^0.11.0"
56
55
  },
57
56
  "devDependencies": {
58
57
  "@rollup/plugin-commonjs": "^17.1.0",
@@ -60,11 +59,11 @@
60
59
  "@rollup/plugin-node-resolve": "^11.1.1",
61
60
  "chai": "^4.2.0",
62
61
  "cross-env": "^7.0.3",
63
- "eslint": "^7.19.0",
64
- "eslint-plugin-bpmn-io": "^0.12.0",
62
+ "eslint": "^7.32.0",
63
+ "eslint-plugin-bpmn-io": "^0.13.0",
65
64
  "execa": "^5.0.0",
66
65
  "istanbul-instrumenter-loader": "^3.0.1",
67
- "karma": "^6.3.0",
66
+ "karma": "^6.3.14",
68
67
  "karma-chai": "^0.1.0",
69
68
  "karma-chrome-launcher": "^3.1.0",
70
69
  "karma-coverage": "^2.0.3",
@@ -76,7 +75,7 @@
76
75
  "karma-sinon-chai": "^2.0.2",
77
76
  "karma-webpack": "^5.0.0",
78
77
  "min-dom": "^3.1.3",
79
- "mocha": "^9.1.3",
78
+ "mocha": "^9.2.0",
80
79
  "mocha-test-container-support": "^0.2.0",
81
80
  "npm-run-all": "^4.1.5",
82
81
  "puppeteer": "^8.0.0",
@@ -1,4 +1,5 @@
1
1
  @import './diagram-js.css';
2
+ @import './bpmn-js.css';
2
3
  @import './bpmn-font/css/bpmn-embedded.css';
3
4
  @import './diagram-js-minimap.css';
4
5
  @import './properties-panel.css';
@@ -1 +1,2 @@
1
- @import './base-modeler.css';
1
+ @import './base-modeler.css';
2
+ @import './element-templates.css';
@@ -1,78 +0,0 @@
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,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
- }