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.
- package/CHANGELOG.md +23 -0
- package/dist/assets/base-modeler.css +1 -0
- package/dist/assets/bpmn-js-properties-panel.css +778 -0
- package/dist/assets/bpmn-js.css +116 -0
- package/dist/assets/camunda-cloud-modeler.css +2 -1
- package/dist/base-modeler.development.js +22251 -21746
- package/dist/base-modeler.production.min.js +4 -4
- package/dist/camunda-cloud-modeler.development.js +30353 -26018
- package/dist/camunda-cloud-modeler.production.min.js +4 -4
- package/dist/camunda-platform-modeler.development.js +28818 -28649
- package/dist/camunda-platform-modeler.production.min.js +4 -4
- package/lib/base/Modeler.js +0 -6
- package/lib/camunda-cloud/ElementTemplatesValidator.js +1 -0
- package/lib/camunda-cloud/Modeler.js +8 -0
- package/lib/camunda-cloud/features/drilldown/index.js +3 -0
- package/lib/camunda-cloud/features/modeling/behavior/CleanUpBusinessRuleTaskBehavior.js +60 -57
- package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeCallActivityBehavior.js +1 -1
- package/lib/camunda-cloud/features/modeling/behavior/RemoveAssignmentDefinitionBehavior.js +51 -0
- package/lib/camunda-cloud/features/modeling/behavior/UpdatePropagateAllChildVariablesBehavior.js +60 -33
- package/lib/camunda-cloud/features/modeling/behavior/index.js +8 -8
- package/lib/camunda-cloud/helper/CalledElementHelper.js +5 -5
- package/lib/camunda-cloud/helper/FormsHelper.js +4 -4
- package/lib/camunda-platform/features/modeling/behavior/DeleteErrorEventDefinitionBehavior.js +23 -36
- package/lib/camunda-platform/features/modeling/behavior/DeleteRetryTimeCycleBehavior.js +33 -21
- package/lib/camunda-platform/features/modeling/behavior/UpdateCamundaExclusiveBehavior.js +14 -11
- package/lib/camunda-platform/features/modeling/behavior/UpdateInputOutputBehavior.js +20 -30
- package/lib/camunda-platform/features/modeling/behavior/UpdateResultVariableBehavior.js +15 -12
- package/lib/camunda-platform/features/modeling/behavior/UserTaskFormsBehavior.js +9 -8
- package/lib/camunda-platform/features/modeling/behavior/UserTaskGeneratedFormsBehavior.js +32 -33
- package/lib/util/ExtensionElementsUtil.js +59 -0
- package/package.json +15 -11
- package/styles/base-modeler.css +1 -0
- package/styles/camunda-cloud-modeler.css +2 -1
- package/lib/camunda-cloud/features/modeling/behavior/CleanUpAssignmentDefinitionBehavior.js +0 -78
- 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
|
|
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(
|
|
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
|
-
'
|
|
27
|
+
'element.updateModdleProperties'
|
|
24
28
|
], HIGH_PRIORITY, function(context) {
|
|
25
29
|
const {
|
|
26
30
|
element,
|
|
27
|
-
|
|
31
|
+
moddleElement,
|
|
32
|
+
properties = {}
|
|
28
33
|
} = context;
|
|
29
34
|
|
|
30
|
-
const
|
|
31
|
-
|
|
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
|
-
|| (
|
|
36
|
-
||
|
|
37
|
-
|| !
|
|
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
|
-
|
|
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
|
-
'
|
|
58
|
-
'
|
|
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
|
|
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
|
-
'
|
|
21
|
+
'element.updateModdleProperties',
|
|
24
22
|
], HIGH_PRIORITY, function(context) {
|
|
25
23
|
const {
|
|
26
24
|
element,
|
|
27
|
-
|
|
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
|
-
|| (
|
|
35
|
+
|| !is(businessObject, 'camunda:AsyncCapable')
|
|
36
|
+
|| (asyncAfter !== false && asyncBefore !== false)
|
|
34
37
|
|| isExclusive(businessObject)
|
|
35
|
-
|| (isAsyncAfter(businessObject) &&
|
|
36
|
-
|| (isAsyncBefore(businessObject) &&
|
|
37
|
-
|| (
|
|
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 {
|
|
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
|
-
|
|
5
|
-
|
|
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
|
|
18
|
+
* Camunda BPMN specific behavior ensuring empty camunda:InputOutput is removed.
|
|
12
19
|
*/
|
|
13
20
|
export default class UpdateInputOutputBehavior extends CommandInterceptor {
|
|
14
|
-
constructor(
|
|
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
|
-
|
|
28
|
-
propertyName
|
|
27
|
+
moddleElement
|
|
29
28
|
} = context;
|
|
30
29
|
|
|
31
|
-
|
|
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 (
|
|
41
|
-
|
|
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
|
-
'
|
|
53
|
-
'
|
|
42
|
+
'commandStack',
|
|
43
|
+
'eventBus'
|
|
54
44
|
];
|
|
@@ -1,37 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
'
|
|
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' ] =
|
|
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 {
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
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 (
|
|
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
|
-
|
|
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
|
-
|
|
69
|
-
|
|
67
|
+
moddleElement,
|
|
68
|
+
properties
|
|
70
69
|
} = context;
|
|
71
70
|
|
|
72
|
-
if (!is(
|
|
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 =
|
|
75
|
+
const businessKey = moddleElement.get('camunda:businessKey');
|
|
79
76
|
|
|
80
77
|
if (!businessKey) {
|
|
81
78
|
return;
|
|
82
79
|
}
|
|
83
80
|
|
|
84
|
-
|
|
85
|
-
|
|
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.
|
|
3
|
+
"version": "0.13.0-alpha.4",
|
|
4
4
|
"description": "Embeddable Camunda modeling distributions based on bpmn-js",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"start:base": "cross-env SINGLE_START=base-modeler npm run dev",
|
|
14
14
|
"start:platform": "cross-env SINGLE_START=camunda-platform-modeler npm run dev",
|
|
15
15
|
"start:cloud": "cross-env SINGLE_START=camunda-cloud-modeler npm run dev",
|
|
16
|
-
"prepublishOnly": "run-s
|
|
16
|
+
"prepublishOnly": "run-s test:distro",
|
|
17
|
+
"prepare": "run-s distro"
|
|
17
18
|
},
|
|
18
19
|
"repository": {
|
|
19
20
|
"type": "git",
|
|
@@ -40,31 +41,30 @@
|
|
|
40
41
|
"license": "MIT",
|
|
41
42
|
"dependencies": {
|
|
42
43
|
"@bpmn-io/align-to-origin": "^0.7.0",
|
|
43
|
-
"
|
|
44
|
-
"bpmn-js": "^8.9.1",
|
|
44
|
+
"bpmn-js": "^9.0.3",
|
|
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.1",
|
|
48
|
-
"bpmn-js-signavio-compat": "^1.2.3",
|
|
49
47
|
"camunda-bpmn-moddle": "^6.1.1",
|
|
50
|
-
"diagram-js": "^
|
|
51
|
-
"diagram-js-minimap": "^2.0
|
|
48
|
+
"diagram-js": "^8.1.1",
|
|
49
|
+
"diagram-js-minimap": "^2.1.0",
|
|
52
50
|
"diagram-js-origin": "^1.3.2",
|
|
53
51
|
"inherits": "^2.0.4",
|
|
54
|
-
"min-dash": "^3.
|
|
55
|
-
"zeebe-bpmn-moddle": "^0.
|
|
52
|
+
"min-dash": "^3.8.1",
|
|
53
|
+
"zeebe-bpmn-moddle": "^0.11.0"
|
|
56
54
|
},
|
|
57
55
|
"devDependencies": {
|
|
56
|
+
"@bpmn-io/properties-panel": "^0.11.0",
|
|
58
57
|
"@rollup/plugin-commonjs": "^17.1.0",
|
|
59
58
|
"@rollup/plugin-json": "^4.1.0",
|
|
60
59
|
"@rollup/plugin-node-resolve": "^11.1.1",
|
|
60
|
+
"bpmn-js-properties-panel": "~1.0.0-alpha.5",
|
|
61
61
|
"chai": "^4.2.0",
|
|
62
62
|
"cross-env": "^7.0.3",
|
|
63
63
|
"eslint": "^7.32.0",
|
|
64
64
|
"eslint-plugin-bpmn-io": "^0.13.0",
|
|
65
65
|
"execa": "^5.0.0",
|
|
66
66
|
"istanbul-instrumenter-loader": "^3.0.1",
|
|
67
|
-
"karma": "^6.3.
|
|
67
|
+
"karma": "^6.3.16",
|
|
68
68
|
"karma-chai": "^0.1.0",
|
|
69
69
|
"karma-chrome-launcher": "^3.1.0",
|
|
70
70
|
"karma-coverage": "^2.0.3",
|
|
@@ -87,5 +87,9 @@
|
|
|
87
87
|
"sinon": "^9.2.4",
|
|
88
88
|
"sinon-chai": "^3.5.0",
|
|
89
89
|
"webpack": "^5.20.1"
|
|
90
|
+
},
|
|
91
|
+
"peerDependencies": {
|
|
92
|
+
"@bpmn-io/properties-panel": "0.11.x",
|
|
93
|
+
"bpmn-js-properties-panel": "1.0.0-alpha.5"
|
|
90
94
|
}
|
|
91
95
|
}
|
package/styles/base-modeler.css
CHANGED
|
@@ -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
|
-
}
|