camunda-bpmn-js 0.13.0-alpha.8 → 0.13.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.
- package/CHANGELOG.md +13 -0
- package/dist/assets/base-navigated-viewer.css +2 -0
- package/dist/assets/base-viewer.css +2 -0
- package/dist/assets/camunda-cloud-navigated-viewer.css +1 -0
- package/dist/assets/camunda-cloud-viewer.css +1 -0
- package/dist/assets/camunda-platform-navigated-viewer.css +1 -0
- package/dist/assets/camunda-platform-viewer.css +1 -0
- package/dist/assets/properties-panel.css +900 -901
- package/dist/base-navigated-viewer.development.js +22218 -0
- package/dist/base-navigated-viewer.production.min.js +2 -0
- package/dist/base-viewer.development.js +21227 -0
- package/dist/base-viewer.production.min.js +2 -0
- package/dist/camunda-cloud-modeler.development.js +1249 -944
- package/dist/camunda-cloud-modeler.production.min.js +4 -4
- package/dist/camunda-cloud-navigated-viewer.development.js +23041 -0
- package/dist/camunda-cloud-navigated-viewer.production.min.js +2 -0
- package/dist/camunda-cloud-viewer.development.js +22050 -0
- package/dist/camunda-cloud-viewer.production.min.js +2 -0
- package/dist/camunda-platform-modeler.development.js +1464 -1381
- package/dist/camunda-platform-modeler.production.min.js +4 -4
- package/dist/camunda-platform-navigated-viewer.development.js +23413 -0
- package/dist/camunda-platform-navigated-viewer.production.min.js +2 -0
- package/dist/camunda-platform-viewer.development.js +22422 -0
- package/dist/camunda-platform-viewer.production.min.js +2 -0
- package/lib/base/NavigatedViewer.js +3 -0
- package/lib/base/Viewer.js +3 -0
- package/lib/camunda-cloud/Modeler.js +7 -11
- package/lib/camunda-cloud/NavigatedViewer.js +34 -0
- package/lib/camunda-cloud/Viewer.js +34 -0
- package/lib/camunda-cloud/util/commonModules.js +14 -0
- package/lib/camunda-platform/Modeler.js +5 -5
- package/lib/camunda-platform/NavigatedViewer.js +25 -0
- package/lib/camunda-platform/Viewer.js +24 -0
- package/lib/camunda-platform/util/commonModules.js +7 -0
- package/package.json +9 -4
- package/styles/base-navigated-viewer.css +2 -0
- package/styles/base-viewer.css +2 -0
- package/styles/camunda-cloud-navigated-viewer.css +1 -0
- package/styles/camunda-cloud-viewer.css +1 -0
- package/styles/camunda-platform-navigated-viewer.css +1 -0
- package/styles/camunda-platform-viewer.css +1 -0
- package/util/index.js +39 -0
- package/lib/camunda-cloud/features/modeling/behavior/CleanUpBusinessRuleTaskBehavior.js +0 -115
- package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeBoundaryEventBehavior.js +0 -76
- package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeCallActivityBehavior.js +0 -86
- package/lib/camunda-cloud/features/modeling/behavior/FormDefinitionBehavior.js +0 -138
- package/lib/camunda-cloud/features/modeling/behavior/RemoveAssignmentDefinitionBehavior.js +0 -51
- package/lib/camunda-cloud/features/modeling/behavior/UpdatePropagateAllChildVariablesBehavior.js +0 -136
- package/lib/camunda-cloud/features/modeling/behavior/index.js +0 -24
- package/lib/camunda-cloud/features/modeling/index.js +0 -7
- package/lib/camunda-cloud/helper/CalledElementHelper.js +0 -72
- package/lib/camunda-cloud/helper/ElementHelper.js +0 -18
- package/lib/camunda-cloud/helper/FormsHelper.js +0 -84
- package/lib/camunda-cloud/helper/InputOutputHelper.js +0 -138
- package/lib/camunda-cloud/helper/Utils.js +0 -10
- package/lib/camunda-cloud/helper/ZeebeServiceTaskHelper.js +0 -41
- package/lib/camunda-platform/features/modeling/behavior/DeleteErrorEventDefinitionBehavior.js +0 -54
- package/lib/camunda-platform/features/modeling/behavior/DeleteRetryTimeCycleBehavior.js +0 -96
- package/lib/camunda-platform/features/modeling/behavior/UpdateCamundaExclusiveBehavior.js +0 -68
- package/lib/camunda-platform/features/modeling/behavior/UpdateInputOutputBehavior.js +0 -44
- package/lib/camunda-platform/features/modeling/behavior/UpdateResultVariableBehavior.js +0 -54
- package/lib/camunda-platform/features/modeling/behavior/UserTaskFormsBehavior.js +0 -71
- package/lib/camunda-platform/features/modeling/behavior/UserTaskGeneratedFormsBehavior.js +0 -116
- package/lib/camunda-platform/features/modeling/behavior/index.js +0 -26
- package/lib/camunda-platform/features/modeling/index.js +0 -7
- package/lib/camunda-platform/helper/InputOutputHelper.js +0 -29
|
@@ -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
|
-
}
|
package/lib/camunda-platform/features/modeling/behavior/DeleteErrorEventDefinitionBehavior.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
getBusinessObject,
|
|
5
|
-
is
|
|
6
|
-
} from 'bpmn-js/lib/util/ModelUtil';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
getExtensionElementsList,
|
|
10
|
-
removeExtensionElements
|
|
11
|
-
} from '../../../../util/ExtensionElementsUtil';
|
|
12
|
-
|
|
13
|
-
const HIGH_PRIORITY = 5000;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
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.
|
|
19
|
-
*/
|
|
20
|
-
export default class DeleteErrorEventDefinitionBehavior extends CommandInterceptor {
|
|
21
|
-
constructor(commandStack, eventBus) {
|
|
22
|
-
super(eventBus);
|
|
23
|
-
|
|
24
|
-
this.postExecute([
|
|
25
|
-
'element.updateProperties',
|
|
26
|
-
'element.updateModdleProperties'
|
|
27
|
-
], HIGH_PRIORITY, function(context) {
|
|
28
|
-
const {
|
|
29
|
-
element,
|
|
30
|
-
moddleElement,
|
|
31
|
-
properties
|
|
32
|
-
} = context;
|
|
33
|
-
|
|
34
|
-
const businessObject = moddleElement || getBusinessObject(element);
|
|
35
|
-
|
|
36
|
-
if (is(element, 'camunda:ExternalCapable')
|
|
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
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}, true);
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
DeleteErrorEventDefinitionBehavior.$inject = [
|
|
52
|
-
'commandStack',
|
|
53
|
-
'eventBus'
|
|
54
|
-
];
|
|
@@ -1,96 +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
|
-
import {
|
|
9
|
-
getExtensionElementsList,
|
|
10
|
-
removeExtensionElements
|
|
11
|
-
} from '../../../../util/ExtensionElementsUtil';
|
|
12
|
-
|
|
13
|
-
const HIGH_PRIORITY = 5000;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
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.
|
|
20
|
-
*/
|
|
21
|
-
export default class DeleteRetryTimeCycleBehavior extends CommandInterceptor {
|
|
22
|
-
constructor(commandStack, eventBus) {
|
|
23
|
-
super(eventBus);
|
|
24
|
-
|
|
25
|
-
this.postExecute([
|
|
26
|
-
'element.updateProperties',
|
|
27
|
-
'element.updateModdleProperties'
|
|
28
|
-
], HIGH_PRIORITY, function(context) {
|
|
29
|
-
const {
|
|
30
|
-
element,
|
|
31
|
-
moddleElement,
|
|
32
|
-
properties = {}
|
|
33
|
-
} = context;
|
|
34
|
-
|
|
35
|
-
const asyncAfter = properties[ 'camunda:asyncAfter' ],
|
|
36
|
-
asyncBefore = properties[ 'camunda:asyncBefore' ];
|
|
37
|
-
|
|
38
|
-
const businessObject = moddleElement || getBusinessObject(element);
|
|
39
|
-
|
|
40
|
-
const failedJobRetryTimeCycle = getFailedJobRetryTimeCycle(element);
|
|
41
|
-
|
|
42
|
-
if (
|
|
43
|
-
!is(element, 'camunda:AsyncCapable')
|
|
44
|
-
|| !is(businessObject, 'camunda:AsyncCapable')
|
|
45
|
-
|| (asyncAfter !== false && asyncBefore !== false)
|
|
46
|
-
|| !failedJobRetryTimeCycle
|
|
47
|
-
|| getTimerEventDefinition(element)
|
|
48
|
-
|| isAsyncBefore(businessObject)
|
|
49
|
-
|| isAsyncAfter(businessObject)
|
|
50
|
-
) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
removeExtensionElements(element, businessObject, failedJobRetryTimeCycle, commandStack);
|
|
55
|
-
}, true);
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
DeleteRetryTimeCycleBehavior.$inject = [
|
|
61
|
-
'commandStack',
|
|
62
|
-
'eventBus'
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// helpers //////////
|
|
67
|
-
|
|
68
|
-
function isAsyncBefore(businessObject) {
|
|
69
|
-
return !!(businessObject.get('camunda:asyncBefore') || businessObject.get('camunda:async'));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function isAsyncAfter(businessObject) {
|
|
73
|
-
return !!businessObject.get('camunda:asyncAfter');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function getFailedJobRetryTimeCycle(element) {
|
|
77
|
-
return getExtensionElementsList(element, 'camunda:FailedJobRetryTimeCycle')[ 0 ];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function getTimerEventDefinition(element) {
|
|
81
|
-
return getEventDefinition(element, 'bpmn:TimerEventDefinition');
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function getEventDefinition(element, type) {
|
|
85
|
-
const businessObject = getBusinessObject(element);
|
|
86
|
-
|
|
87
|
-
const eventDefinitions = businessObject.get('eventDefinitions');
|
|
88
|
-
|
|
89
|
-
if (!eventDefinitions || !eventDefinitions.length) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return eventDefinitions.find((eventDefinition) => {
|
|
94
|
-
return is(eventDefinition, type);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
@@ -1,68 +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 behavior ensuring camunda:exclusive is set to true if
|
|
13
|
-
* camunda:asyncBefore or camunda:asyncAfter is set to false.
|
|
14
|
-
*/
|
|
15
|
-
export default class UpdateCamundaExclusiveBehavior extends CommandInterceptor {
|
|
16
|
-
constructor(eventBus) {
|
|
17
|
-
super(eventBus);
|
|
18
|
-
|
|
19
|
-
this.preExecute([
|
|
20
|
-
'element.updateProperties',
|
|
21
|
-
'element.updateModdleProperties',
|
|
22
|
-
], HIGH_PRIORITY, function(context) {
|
|
23
|
-
const {
|
|
24
|
-
element,
|
|
25
|
-
moddleElement,
|
|
26
|
-
properties = {}
|
|
27
|
-
} = context;
|
|
28
|
-
|
|
29
|
-
const businessObject = moddleElement || getBusinessObject(element);
|
|
30
|
-
|
|
31
|
-
const asyncAfter = properties[ 'camunda:asyncAfter' ],
|
|
32
|
-
asyncBefore = properties[ 'camunda:asyncBefore' ];
|
|
33
|
-
|
|
34
|
-
if (!is(element, 'camunda:AsyncCapable')
|
|
35
|
-
|| !is(businessObject, 'camunda:AsyncCapable')
|
|
36
|
-
|| (asyncAfter !== false && asyncBefore !== false)
|
|
37
|
-
|| isExclusive(businessObject)
|
|
38
|
-
|| (isAsyncAfter(businessObject) && asyncAfter !== false)
|
|
39
|
-
|| (isAsyncBefore(businessObject) && asyncBefore !== false)
|
|
40
|
-
|| (asyncAfter === true || asyncBefore === true)
|
|
41
|
-
) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
properties[ 'camunda:exclusive' ] = true;
|
|
46
|
-
}, true);
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
UpdateCamundaExclusiveBehavior.$inject = [
|
|
52
|
-
'eventBus'
|
|
53
|
-
];
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// helpers //////////
|
|
57
|
-
|
|
58
|
-
function isAsyncBefore(businessObject) {
|
|
59
|
-
return !!(businessObject.get('camunda:asyncBefore') || businessObject.get('camunda:async'));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function isAsyncAfter(businessObject) {
|
|
63
|
-
return !!businessObject.get('camunda:asyncAfter');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function isExclusive(businessObject) {
|
|
67
|
-
return !!businessObject.get('camunda:exclusive');
|
|
68
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getBusinessObject,
|
|
3
|
-
is
|
|
4
|
-
} from 'bpmn-js/lib/util/ModelUtil';
|
|
5
|
-
|
|
6
|
-
import { isInputOutputEmpty } from '../../../helper/InputOutputHelper';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
removeExtensionElements
|
|
10
|
-
} from '../../../../util/ExtensionElementsUtil';
|
|
11
|
-
|
|
12
|
-
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
13
|
-
|
|
14
|
-
const LOW_PRIORITY = 250;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Camunda BPMN specific behavior ensuring empty camunda:InputOutput is removed.
|
|
19
|
-
*/
|
|
20
|
-
export default class UpdateInputOutputBehavior extends CommandInterceptor {
|
|
21
|
-
constructor(commandStack, eventBus) {
|
|
22
|
-
super(eventBus);
|
|
23
|
-
|
|
24
|
-
this.postExecuted('element.updateModdleProperties', LOW_PRIORITY, function(context) {
|
|
25
|
-
const {
|
|
26
|
-
element,
|
|
27
|
-
moddleElement
|
|
28
|
-
} = context;
|
|
29
|
-
|
|
30
|
-
if (!is(moddleElement, 'camunda:InputOutput')) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (isInputOutputEmpty(moddleElement)) {
|
|
35
|
-
removeExtensionElements(element, getBusinessObject(element), moddleElement, commandStack);
|
|
36
|
-
}
|
|
37
|
-
}, true);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
UpdateInputOutputBehavior.$inject = [
|
|
42
|
-
'commandStack',
|
|
43
|
-
'eventBus'
|
|
44
|
-
];
|
|
@@ -1,54 +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
|
-
import { has } from 'min-dash';
|
|
9
|
-
|
|
10
|
-
const HIGH_PRIORITY = 5000;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Camunda BPMN specific camunda:resultVariable behavior ensuring
|
|
15
|
-
* camunda:mapDecisionResult is removed when camunda:resultVariable is removed.
|
|
16
|
-
*/
|
|
17
|
-
export default class UpdateResultVariableBehavior extends CommandInterceptor {
|
|
18
|
-
constructor(eventBus) {
|
|
19
|
-
super(eventBus);
|
|
20
|
-
|
|
21
|
-
this.preExecute([
|
|
22
|
-
'element.updateProperties',
|
|
23
|
-
'element.updateModdleProperties'
|
|
24
|
-
], HIGH_PRIORITY, function(context) {
|
|
25
|
-
const {
|
|
26
|
-
element,
|
|
27
|
-
moddleElement,
|
|
28
|
-
properties
|
|
29
|
-
} = context;
|
|
30
|
-
|
|
31
|
-
const businessObject = moddleElement || getBusinessObject(element);
|
|
32
|
-
|
|
33
|
-
if (
|
|
34
|
-
is(element, 'camunda:DmnCapable')
|
|
35
|
-
&& is(businessObject, 'camunda:DmnCapable')
|
|
36
|
-
&& has(properties, 'camunda:resultVariable')
|
|
37
|
-
&& isEmpty(properties[ 'camunda:resultVariable' ])
|
|
38
|
-
) {
|
|
39
|
-
properties[ 'camunda:mapDecisionResult' ] = undefined;
|
|
40
|
-
}
|
|
41
|
-
}, true);
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
UpdateResultVariableBehavior.$inject = [
|
|
47
|
-
'eventBus'
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
// helpers //////////
|
|
51
|
-
|
|
52
|
-
function isEmpty(value) {
|
|
53
|
-
return value == undefined || value === '';
|
|
54
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { getBusinessObject } from 'bpmn-js/lib/util/ModelUtil';
|
|
2
|
-
|
|
3
|
-
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
has,
|
|
7
|
-
isUndefined
|
|
8
|
-
} from 'min-dash';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Camunda BPMN specific user task forms behavior.
|
|
13
|
-
*/
|
|
14
|
-
export default class UserTaskFormsBehavior extends CommandInterceptor {
|
|
15
|
-
constructor(eventBus) {
|
|
16
|
-
super(eventBus);
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Ensure that only one of the following options is configured:
|
|
20
|
-
*
|
|
21
|
-
* 1. embedded, external or Camunda forms using camunda:formKey
|
|
22
|
-
* 2. Camunda forms using camunda:formRef
|
|
23
|
-
*/
|
|
24
|
-
this.preExecute([
|
|
25
|
-
'element.updateProperties',
|
|
26
|
-
'element.updateModdleProperties'
|
|
27
|
-
], function(context) {
|
|
28
|
-
const {
|
|
29
|
-
element,
|
|
30
|
-
moddleElement,
|
|
31
|
-
properties
|
|
32
|
-
} = context;
|
|
33
|
-
|
|
34
|
-
const businessObject = moddleElement || getBusinessObject(element);
|
|
35
|
-
|
|
36
|
-
if (has(properties, 'camunda:formKey')) {
|
|
37
|
-
Object.assign(properties, {
|
|
38
|
-
'camunda:formRef': undefined,
|
|
39
|
-
'camunda:formRefBinding': undefined,
|
|
40
|
-
'camunda:formRefVersion': undefined
|
|
41
|
-
});
|
|
42
|
-
} else if (has(properties, 'camunda:formRef')) {
|
|
43
|
-
Object.assign(properties, {
|
|
44
|
-
'camunda:formKey': undefined
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
if (isUndefined(properties[ 'camunda:formRef' ])) {
|
|
48
|
-
Object.assign(properties, {
|
|
49
|
-
'camunda:formRefBinding': undefined,
|
|
50
|
-
'camunda:formRefVersion': undefined
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (!has(properties, 'camunda:formRefBinding') && isUndefined(businessObject.get('camunda:formRefBinding'))) {
|
|
55
|
-
Object.assign(properties, {
|
|
56
|
-
'camunda:formRefBinding': 'latest'
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (has(properties, 'camunda:formRefBinding') && properties[ 'camunda:formRefBinding' ] !== 'version') {
|
|
62
|
-
Object.assign(properties, {
|
|
63
|
-
'camunda:formRefVersion': undefined
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}, true);
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
UserTaskFormsBehavior.$inject = [ 'eventBus' ];
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
2
|
-
|
|
3
|
-
import { getBusinessObject, is } from 'bpmn-js/lib/util/ModelUtil';
|
|
4
|
-
|
|
5
|
-
import { has } from 'min-dash';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Camunda BPMN specific user task generated forms behavior.
|
|
10
|
-
*
|
|
11
|
-
* 1. Removes camunda:FormField#values if camunda:FormField#type is changed to something other than enum.
|
|
12
|
-
* 2. Updates camunda:FormData#businessKey if camunda:FormField#id is changed.
|
|
13
|
-
* 3. Removes camunda:FormData#businessKey if camunda:FormField is removed.
|
|
14
|
-
*/
|
|
15
|
-
export default class UserTaskFormsBehavior extends CommandInterceptor {
|
|
16
|
-
constructor(eventBus, modeling) {
|
|
17
|
-
super(eventBus);
|
|
18
|
-
|
|
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 {
|
|
25
|
-
moddleElement,
|
|
26
|
-
properties
|
|
27
|
-
} = context;
|
|
28
|
-
|
|
29
|
-
if (!is(moddleElement, 'camunda:FormField')) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if ('camunda:type' in properties && properties[ 'camunda:type' ] !== 'enum') {
|
|
34
|
-
properties[ 'camunda:values' ] = undefined;
|
|
35
|
-
}
|
|
36
|
-
}, true);
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Update camunda:FormData#businessKey if camunda:FormField#id is changed.
|
|
40
|
-
*/
|
|
41
|
-
this.preExecute('element.updateModdleProperties', function(context) {
|
|
42
|
-
const {
|
|
43
|
-
element,
|
|
44
|
-
moddleElement,
|
|
45
|
-
properties
|
|
46
|
-
} = context;
|
|
47
|
-
|
|
48
|
-
if (!is(moddleElement, 'camunda:FormField') || !has(properties, 'camunda:id')) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const formData = getFormData(element);
|
|
53
|
-
|
|
54
|
-
if (isBusinessKey(moddleElement, formData)) {
|
|
55
|
-
modeling.updateModdleProperties(element, formData, {
|
|
56
|
-
'camunda:businessKey': properties[ 'camunda:id' ]
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}, true);
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Remove camunda:FormData#businessKey if camunda:FormField is removed.
|
|
63
|
-
*/
|
|
64
|
-
this.postExecute('element.updateModdleProperties', function(context) {
|
|
65
|
-
const {
|
|
66
|
-
element,
|
|
67
|
-
moddleElement,
|
|
68
|
-
properties
|
|
69
|
-
} = context;
|
|
70
|
-
|
|
71
|
-
if (!is(moddleElement, 'camunda:FormData') || !has(properties, 'fields')) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const businessKey = moddleElement.get('camunda:businessKey');
|
|
76
|
-
|
|
77
|
-
if (!businessKey) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const fieldWithBusinessKey = moddleElement.get('fields').find(field => {
|
|
82
|
-
return field.get('camunda:id') === businessKey;
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
if (!fieldWithBusinessKey) {
|
|
86
|
-
modeling.updateModdleProperties(element, moddleElement, {
|
|
87
|
-
'camunda:businessKey': undefined
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
}, true);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
UserTaskFormsBehavior.$inject = [ 'eventBus', 'modeling' ];
|
|
96
|
-
|
|
97
|
-
// helpers //////////
|
|
98
|
-
|
|
99
|
-
function isBusinessKey(formField, formData) {
|
|
100
|
-
return formField.get('camunda:id') === formData.get('camunda:businessKey');
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function getFormData(element) {
|
|
104
|
-
const businessObject = getBusinessObject(element),
|
|
105
|
-
extensionElements = businessObject.get('extensionElements');
|
|
106
|
-
|
|
107
|
-
if (!extensionElements) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const values = extensionElements.get('values');
|
|
112
|
-
|
|
113
|
-
return values.find((value) => {
|
|
114
|
-
return is(value, 'camunda:FormData');
|
|
115
|
-
});
|
|
116
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import DeleteErrorEventDefinitionBehavior from './DeleteErrorEventDefinitionBehavior';
|
|
2
|
-
import DeleteRetryTimeCycleBehavior from './DeleteRetryTimeCycleBehavior';
|
|
3
|
-
import UpdateCamundaExclusiveBehavior from './UpdateCamundaExclusiveBehavior';
|
|
4
|
-
import UpdateInputOutputBehavior from './UpdateInputOutputBehavior';
|
|
5
|
-
import UpdateResultVariableBehavior from './UpdateResultVariableBehavior';
|
|
6
|
-
import UserTaskFormsBehavior from './UserTaskFormsBehavior';
|
|
7
|
-
import UserTaskGeneratedFormsBehavior from './UserTaskGeneratedFormsBehavior';
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
__init__: [
|
|
11
|
-
'deleteErrorEventDefinitionBehavior',
|
|
12
|
-
'deleteRetryTimeCycleBehavior',
|
|
13
|
-
'updateCamundaExclusiveBehavior',
|
|
14
|
-
'updateResultVariableBehavior',
|
|
15
|
-
'updateInputOutputBehavior',
|
|
16
|
-
'userTaskFormsBehavior',
|
|
17
|
-
'userTaskGeneratedFormsBehavior'
|
|
18
|
-
],
|
|
19
|
-
deleteErrorEventDefinitionBehavior: [ 'type', DeleteErrorEventDefinitionBehavior ],
|
|
20
|
-
deleteRetryTimeCycleBehavior: [ 'type', DeleteRetryTimeCycleBehavior ],
|
|
21
|
-
updateCamundaExclusiveBehavior: [ 'type', UpdateCamundaExclusiveBehavior ],
|
|
22
|
-
updateResultVariableBehavior: [ 'type', UpdateResultVariableBehavior ],
|
|
23
|
-
updateInputOutputBehavior: [ 'type', UpdateInputOutputBehavior ],
|
|
24
|
-
userTaskFormsBehavior: [ 'type', UserTaskFormsBehavior ],
|
|
25
|
-
userTaskGeneratedFormsBehavior: [ 'type', UserTaskGeneratedFormsBehavior ]
|
|
26
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
}
|