camunda-bpmn-js 0.12.1 → 0.13.0-drilldown.0
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 +2 -1
- package/dist/assets/bpmn-js.css +113 -0
- package/dist/assets/camunda-platform-modeler.css +2 -1
- package/dist/assets/diagram-js.css +82 -78
- package/dist/assets/element-templates.css +75 -0
- package/dist/assets/properties-panel.css +115 -18
- package/dist/base-modeler.development.js +37641 -40582
- package/dist/base-modeler.production.min.js +8 -3
- package/dist/camunda-cloud-modeler.development.js +41845 -42826
- package/dist/camunda-cloud-modeler.production.min.js +8 -3
- package/dist/camunda-platform-modeler.development.js +51089 -53714
- package/dist/camunda-platform-modeler.production.min.js +8 -3
- package/lib/base/Modeler.js +5 -9
- package/lib/camunda-cloud/Modeler.js +16 -3
- package/lib/camunda-cloud/features/drilldown/index.js +3 -0
- package/lib/camunda-cloud/features/modeling/behavior/CleanUpAssignmentDefinitionBehavior.js +78 -0
- package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeCallActivityBehavior.js +2 -2
- package/lib/camunda-cloud/features/modeling/behavior/FormDefinitionBehavior.js +2 -2
- package/lib/camunda-cloud/features/modeling/behavior/index.js +3 -0
- package/lib/camunda-cloud/helper/CalledElementHelper.js +1 -1
- package/lib/camunda-cloud/helper/ElementHelper.js +18 -0
- package/lib/camunda-cloud/helper/ExtensionElementsHelper.js +17 -0
- package/lib/camunda-cloud/helper/FormsHelper.js +5 -5
- package/lib/camunda-cloud/helper/InputOutputHelper.js +2 -6
- package/lib/camunda-cloud/helper/Utils.js +10 -0
- package/lib/camunda-cloud/helper/ZeebeServiceTaskHelper.js +22 -5
- package/lib/camunda-platform/Modeler.js +7 -3
- package/package.json +11 -10
- package/styles/base-modeler.css +2 -1
- package/styles/camunda-platform-modeler.css +2 -1
- package/lib/camunda-cloud/features/properties-provider/ZeebePropertiesProvider.js +0 -201
- package/lib/camunda-cloud/features/properties-provider/index.js +0 -11
- package/lib/camunda-cloud/features/properties-provider/parts/CallActivityProps.js +0 -90
- package/lib/camunda-cloud/features/properties-provider/parts/ErrorProps.js +0 -13
- package/lib/camunda-cloud/features/properties-provider/parts/FormProps.js +0 -14
- package/lib/camunda-cloud/features/properties-provider/parts/HeadersProps.js +0 -52
- package/lib/camunda-cloud/features/properties-provider/parts/InputOutputProps.js +0 -8
- package/lib/camunda-cloud/features/properties-provider/parts/MessageProps.js +0 -51
- package/lib/camunda-cloud/features/properties-provider/parts/MultiInstanceProps.js +0 -25
- package/lib/camunda-cloud/features/properties-provider/parts/SequenceFlowProps.js +0 -149
- package/lib/camunda-cloud/features/properties-provider/parts/TaskDefinitionProps.js +0 -135
- package/lib/camunda-cloud/features/properties-provider/parts/TimerEventProps.js +0 -77
- package/lib/camunda-cloud/features/properties-provider/parts/implementation/ElementReferenceExtensionElementProperty.js +0 -110
- package/lib/camunda-cloud/features/properties-provider/parts/implementation/FormDefinition.js +0 -207
- package/lib/camunda-cloud/features/properties-provider/parts/implementation/Headers.js +0 -208
- package/lib/camunda-cloud/features/properties-provider/parts/implementation/InputOutput.js +0 -274
- package/lib/camunda-cloud/features/properties-provider/parts/implementation/InputOutputParameter.js +0 -147
- package/lib/camunda-cloud/features/properties-provider/parts/implementation/MultiInstanceLoopCharacteristics.js +0 -176
- package/lib/camunda-cloud/features/properties-provider/parts/implementation/OutputParameterToggle.js +0 -97
- package/lib/camunda-cloud/features/properties-provider/parts/implementation/TimerDurationDefinition.js +0 -69
- package/lib/camunda-cloud/features/properties-provider/parts/implementation/TimerEventDefinition.js +0 -132
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
assign,
|
|
3
|
-
find,
|
|
4
|
-
forEach
|
|
5
|
-
} from 'min-dash';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
getBusinessObject,
|
|
9
|
-
is
|
|
10
|
-
} from 'bpmn-js/lib/util/ModelUtil';
|
|
11
|
-
|
|
12
|
-
import entryFactory from 'bpmn-js-properties-panel/lib/factory/EntryFactory';
|
|
13
|
-
|
|
14
|
-
import elementHelper from 'bpmn-js-properties-panel/lib/helper/ElementHelper';
|
|
15
|
-
|
|
16
|
-
import extensionElementsHelper from 'bpmn-js-properties-panel/lib/helper/ExtensionElementsHelper';
|
|
17
|
-
|
|
18
|
-
import cmdHelper from 'bpmn-js-properties-panel/lib/helper/CmdHelper';
|
|
19
|
-
|
|
20
|
-
import utils from 'bpmn-js-properties-panel/lib/Utils';
|
|
21
|
-
|
|
22
|
-
function generatePropertyId() {
|
|
23
|
-
return utils.nextId('Header_');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Get all zeebe:header objects for a specific business object
|
|
28
|
-
*
|
|
29
|
-
* @param {ModdleElement} parent
|
|
30
|
-
*
|
|
31
|
-
* @return {Array<ModdleElement>} a list of zeebe:header objects
|
|
32
|
-
*/
|
|
33
|
-
function getPropertyValues(parent) {
|
|
34
|
-
const properties = parent && getPropertiesElement(parent);
|
|
35
|
-
if (properties && properties.values) {
|
|
36
|
-
return properties.values;
|
|
37
|
-
}
|
|
38
|
-
return [];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Get all zeebe:Header object for a specific business object
|
|
43
|
-
*
|
|
44
|
-
* @param {ModdleElement} parent
|
|
45
|
-
*
|
|
46
|
-
* @return {ModdleElement} a zeebe:Headers object
|
|
47
|
-
*/
|
|
48
|
-
function getPropertiesElement(element) {
|
|
49
|
-
if (!isExtensionElements(element)) {
|
|
50
|
-
return element.properties;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
return getPropertiesElementInsideExtensionElements(element);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Get first camunda:Properties object for a specific bpmn:ExtensionElements
|
|
59
|
-
* business object.
|
|
60
|
-
*
|
|
61
|
-
* @param {ModdleElement} extensionElements
|
|
62
|
-
*
|
|
63
|
-
* @return {ModdleElement} a camunda:Properties object
|
|
64
|
-
*/
|
|
65
|
-
function getPropertiesElementInsideExtensionElements(extensionElements) {
|
|
66
|
-
return find(extensionElements.values, elem => {
|
|
67
|
-
return is(elem, 'zeebe:TaskHeaders');
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Returns true, if the given business object is a bpmn:ExtensionElements.
|
|
73
|
-
*
|
|
74
|
-
* @param {ModdleElement} element
|
|
75
|
-
*
|
|
76
|
-
* @return {boolean} a boolean value
|
|
77
|
-
*/
|
|
78
|
-
function isExtensionElements(element) {
|
|
79
|
-
return is(element, 'bpmn:ExtensionElements');
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Create a camunda:property entry using tableEntryFactory
|
|
84
|
-
*
|
|
85
|
-
* @param {djs.model.Base} element
|
|
86
|
-
* @param {BpmnFactory} bpmnFactory
|
|
87
|
-
* @param {Function} translate
|
|
88
|
-
* @param {Object} options
|
|
89
|
-
* @param {string} options.id
|
|
90
|
-
* @param {Array<string>} options.modelProperties
|
|
91
|
-
* @param {Array<string>} options.labels
|
|
92
|
-
* @param {function} options.getParent Gets the parent business object
|
|
93
|
-
* @param {function} options.show Indicate when the entry will be shown, should return boolean
|
|
94
|
-
*
|
|
95
|
-
* @returns {Object} a tableEntry object
|
|
96
|
-
*/
|
|
97
|
-
export default function(element, bpmnFactory, translate, options) {
|
|
98
|
-
|
|
99
|
-
const getParent = options.getParent;
|
|
100
|
-
|
|
101
|
-
const modelProperties = options.modelProperties, createParent = options.createParent;
|
|
102
|
-
|
|
103
|
-
const bo = getBusinessObject(element);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
assign(options, {
|
|
107
|
-
addLabel: translate('Add Header'),
|
|
108
|
-
getElements: function(element, node) {
|
|
109
|
-
const parent = getParent(element, node, bo);
|
|
110
|
-
return getPropertyValues(parent);
|
|
111
|
-
},
|
|
112
|
-
addElement: function(element, node) {
|
|
113
|
-
const commands = [];
|
|
114
|
-
let parent = getParent(element, node, bo);
|
|
115
|
-
|
|
116
|
-
if (!parent && typeof createParent === 'function') {
|
|
117
|
-
const result = createParent(element, bo);
|
|
118
|
-
parent = result.parent;
|
|
119
|
-
commands.push(result.cmd);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
let properties = getPropertiesElement(parent);
|
|
123
|
-
if (!properties) {
|
|
124
|
-
properties = elementHelper.createElement('zeebe:TaskHeaders', {}, parent, bpmnFactory);
|
|
125
|
-
|
|
126
|
-
if (!isExtensionElements(parent)) {
|
|
127
|
-
commands.push(cmdHelper.updateBusinessObject(element, parent, { 'taskHeaders': properties }));
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
commands.push(cmdHelper.addAndRemoveElementsFromList(
|
|
131
|
-
element,
|
|
132
|
-
parent,
|
|
133
|
-
'values',
|
|
134
|
-
'extensionElements',
|
|
135
|
-
[ properties ],
|
|
136
|
-
[]
|
|
137
|
-
));
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const propertyProps = {};
|
|
142
|
-
forEach(modelProperties, prop => {
|
|
143
|
-
propertyProps[prop] = undefined;
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
// create id if necessary
|
|
147
|
-
if (modelProperties.indexOf('id') >= 0) {
|
|
148
|
-
propertyProps.id = generatePropertyId();
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const property = elementHelper.createElement('zeebe:Header', propertyProps, properties, bpmnFactory);
|
|
152
|
-
commands.push(cmdHelper.addElementsTolist(element, properties, 'values', [ property ]));
|
|
153
|
-
|
|
154
|
-
return commands;
|
|
155
|
-
},
|
|
156
|
-
updateElement: function(element, value, node, idx) {
|
|
157
|
-
const parent = getParent(element, node, bo), property = getPropertyValues(parent)[idx];
|
|
158
|
-
|
|
159
|
-
forEach(modelProperties, prop => {
|
|
160
|
-
value[prop] = value[prop] || undefined;
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
return cmdHelper.updateBusinessObject(element, property, value);
|
|
164
|
-
},
|
|
165
|
-
validate: function(element, value, node, idx) {
|
|
166
|
-
|
|
167
|
-
// validate id if necessary
|
|
168
|
-
if (modelProperties.indexOf('id') >= 0) {
|
|
169
|
-
|
|
170
|
-
const parent = getParent(element, node, bo), properties = getPropertyValues(parent), property = properties[idx];
|
|
171
|
-
|
|
172
|
-
if (property) {
|
|
173
|
-
|
|
174
|
-
// check if id is valid
|
|
175
|
-
const validationError = utils.isIdValid(property, value.id);
|
|
176
|
-
|
|
177
|
-
if (validationError) {
|
|
178
|
-
return { id: validationError };
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
removeElement: function(element, node, idx) {
|
|
184
|
-
const commands = [], parent = getParent(element, node, bo), properties = getPropertiesElement(parent), propertyValues = getPropertyValues(parent), currentProperty = propertyValues[idx];
|
|
185
|
-
|
|
186
|
-
commands.push(cmdHelper.removeElementsFromList(element, properties, 'values', null, [ currentProperty ]));
|
|
187
|
-
|
|
188
|
-
if (propertyValues.length === 1) {
|
|
189
|
-
|
|
190
|
-
// remove camunda:properties if the last existing property has been removed
|
|
191
|
-
if (!isExtensionElements(parent)) {
|
|
192
|
-
commands.push(cmdHelper.updateBusinessObject(element, parent, { headers: undefined }));
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
forEach(parent.values, value => {
|
|
196
|
-
if (is(value, 'zeebe:TaskHeaders')) {
|
|
197
|
-
commands.push(extensionElementsHelper.removeEntry(bo, element, value));
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return commands;
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
return entryFactory.table(translate, options);
|
|
208
|
-
}
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getBusinessObject
|
|
3
|
-
} from 'bpmn-js/lib/util/ModelUtil';
|
|
4
|
-
|
|
5
|
-
import elementHelper from 'bpmn-js-properties-panel/lib/helper/ElementHelper';
|
|
6
|
-
|
|
7
|
-
import extensionElementsHelper from 'bpmn-js-properties-panel/lib/helper/ExtensionElementsHelper';
|
|
8
|
-
|
|
9
|
-
import cmdHelper from 'bpmn-js-properties-panel/lib/helper/CmdHelper';
|
|
10
|
-
|
|
11
|
-
import { query as domQuery } from 'min-dom';
|
|
12
|
-
|
|
13
|
-
import entryFieldDescription from 'bpmn-js-properties-panel/lib/factory/EntryFieldDescription';
|
|
14
|
-
|
|
15
|
-
import {
|
|
16
|
-
areOutputParametersSupported,
|
|
17
|
-
areInputParametersSupported,
|
|
18
|
-
createIoMapping,
|
|
19
|
-
createElement as createParameter,
|
|
20
|
-
getIoMapping,
|
|
21
|
-
isInputOutputSupported,
|
|
22
|
-
getInputParameters,
|
|
23
|
-
getOutputParameters
|
|
24
|
-
} from '../../../../helper/InputOutputHelper';
|
|
25
|
-
|
|
26
|
-
import InputOutputParameter from './InputOutputParameter';
|
|
27
|
-
|
|
28
|
-
import OutputParameterToggle from './OutputParameterToggle';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Create an input or output mapping entry (containing multiple sub-entries).
|
|
33
|
-
* @param {Object} element - diagram-js element.
|
|
34
|
-
* @param {Object} bpmnFactory - bpmn-js bpmn-factory.
|
|
35
|
-
* @param {Function} translate - translate function.
|
|
36
|
-
* @param {Object} options - Options.
|
|
37
|
-
* @param {string} [options.type] - moddle (zeebe-bpmn-moddle) type name for the IOMapping.
|
|
38
|
-
* @param {string} [options.prop] - moddle (zeebe-bpmn-moddle) property name for the IOMapping.
|
|
39
|
-
* @param {string} [options.prefix] - prefix to be used when constructing id attribute of HTMLElements.
|
|
40
|
-
*
|
|
41
|
-
* @returns {Object} An Object containing multiple Objects in its `entries` attribute,
|
|
42
|
-
* each representing a properties-panel entry. First entry will always be a heading followed
|
|
43
|
-
* by n input / output parameter entries.
|
|
44
|
-
*/
|
|
45
|
-
export default function(element, bpmnFactory, translate, options = {}) {
|
|
46
|
-
const result = {
|
|
47
|
-
entries: []
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// Return if given moddle property is not supported for given element
|
|
51
|
-
if (!options.prop ||
|
|
52
|
-
!isInputOutputSupported(element) ||
|
|
53
|
-
(options.prop === 'inputParameters' && !areInputParametersSupported(element)) ||
|
|
54
|
-
(options.prop === 'outputParameters' && !areOutputParametersSupported(element))) {
|
|
55
|
-
return result;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Heading ///////////////////////////////////////////////////////////////
|
|
59
|
-
const heading = getParametersHeadingEntry(element, bpmnFactory, {
|
|
60
|
-
type: options.type,
|
|
61
|
-
prop: options.prop,
|
|
62
|
-
prefix: options.prefix
|
|
63
|
-
});
|
|
64
|
-
result.entries = result.entries.concat(heading);
|
|
65
|
-
|
|
66
|
-
// Toggle ///////////////////////////////////////////////////////////////////
|
|
67
|
-
const toggle = OutputParameterToggle(element, bpmnFactory, translate, {
|
|
68
|
-
prefix: options.prefix,
|
|
69
|
-
prop: options.prop
|
|
70
|
-
});
|
|
71
|
-
result.entries = result.entries.concat(toggle);
|
|
72
|
-
|
|
73
|
-
// Parameters ///////////////////////////////////////////////////////////////
|
|
74
|
-
result.entries = result.entries.concat(getIOMappingEntries(element, bpmnFactory, translate, {
|
|
75
|
-
prefix: options.prefix,
|
|
76
|
-
prop: options.prop
|
|
77
|
-
}));
|
|
78
|
-
|
|
79
|
-
return result;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Create an input or output mapping heading entry.
|
|
84
|
-
* @param {Object} element - diagram-js element.
|
|
85
|
-
* @param {Object} bpmnFactory - bpmn-js bpmn-factory.
|
|
86
|
-
* @param {Object} options - Options.
|
|
87
|
-
* @param {string} [options.type] - moddle (zeebe-bpmn-moddle) type name for the IOMapping.
|
|
88
|
-
* @param {string} [options.prop] - moddle (zeebe-bpmn-moddle) property name for the IOMapping.
|
|
89
|
-
* @param {string} [options.prefix] - prefix to be used when constructing id attribute of HTMLElements.
|
|
90
|
-
*
|
|
91
|
-
* @returns {Object} An Object representing a properties-panel heading entry.
|
|
92
|
-
*/
|
|
93
|
-
function getParametersHeadingEntry(element, bpmnFactory, options) {
|
|
94
|
-
const entry = {
|
|
95
|
-
id: `${options.prefix}-heading`,
|
|
96
|
-
cssClasses: [ 'bpp-input-output' ],
|
|
97
|
-
html: `<div class="bpp-field-wrapper">
|
|
98
|
-
<button type="button" class="bpp-input-output__add add action-button" data-action="createElement">
|
|
99
|
-
</button><input name="hidden" type="hidden">
|
|
100
|
-
</div>`,
|
|
101
|
-
createElement: function(_, entryNode) {
|
|
102
|
-
const commands = createElement();
|
|
103
|
-
|
|
104
|
-
if (commands) {
|
|
105
|
-
scheduleCommands(commands, entryNode);
|
|
106
|
-
return true;
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
set: function() {
|
|
111
|
-
const commands = entry._commands;
|
|
112
|
-
|
|
113
|
-
if (commands) {
|
|
114
|
-
delete entry._commands;
|
|
115
|
-
return commands;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
return entry;
|
|
121
|
-
|
|
122
|
-
function createElement() {
|
|
123
|
-
const commands = [],
|
|
124
|
-
bo = getBusinessObject(element);
|
|
125
|
-
|
|
126
|
-
let extensionElements = bo.get('extensionElements');
|
|
127
|
-
|
|
128
|
-
if (!extensionElements) {
|
|
129
|
-
extensionElements = elementHelper.createElement('bpmn:ExtensionElements', { values: [] }, bo, bpmnFactory);
|
|
130
|
-
commands.push(cmdHelper.updateBusinessObject(element, bo, { extensionElements: extensionElements }));
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Get the IOMapping
|
|
134
|
-
let inputOutput = getIoMapping(element);
|
|
135
|
-
|
|
136
|
-
if (!inputOutput) {
|
|
137
|
-
const parent = extensionElements;
|
|
138
|
-
|
|
139
|
-
inputOutput = createIoMapping(parent, bpmnFactory, {
|
|
140
|
-
inputParameters: [],
|
|
141
|
-
outputParameters: []
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
commands.push(cmdHelper.addAndRemoveElementsFromList(
|
|
145
|
-
element,
|
|
146
|
-
extensionElements,
|
|
147
|
-
'values',
|
|
148
|
-
'extensionElements',
|
|
149
|
-
[ inputOutput ],
|
|
150
|
-
[]
|
|
151
|
-
));
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const newElem = createParameter(options.type, inputOutput, bpmnFactory, {
|
|
155
|
-
source: '= source',
|
|
156
|
-
target: 'target'
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
commands.push(cmdHelper.addElementsTolist(element, inputOutput, options.prop, [ newElem ]));
|
|
160
|
-
|
|
161
|
-
return commands;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Schedule commands to be run with next `set` method call.
|
|
166
|
-
*
|
|
167
|
-
* @param {Array<any>} commands
|
|
168
|
-
* @param {HTMLElement} entryNode
|
|
169
|
-
*/
|
|
170
|
-
function scheduleCommands(commands, entryNode) {
|
|
171
|
-
entry._commands = commands;
|
|
172
|
-
|
|
173
|
-
// @maxtru, adapted from @barmac: hack to make properties panel call `set`
|
|
174
|
-
const input = domQuery('input[type="hidden"]', entryNode);
|
|
175
|
-
input.value = 1;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Create a list of Input or Output Mapping properties-panel entries.
|
|
182
|
-
* @param {Object} element - diagram-js element.
|
|
183
|
-
* @param {Object} bpmnFactory - bpmn-js bpmn-factory.
|
|
184
|
-
* @param {Function} translate - translate.
|
|
185
|
-
* @param {Object} options - Options.
|
|
186
|
-
* @param {string} [options.prop] - moddle (zeebe-bpmn-moddle) property name for the IOMapping.
|
|
187
|
-
* @param {string} [options.prefix] - prefix to be used when constructing id attribute of HTMLElements.
|
|
188
|
-
*
|
|
189
|
-
* @returns {Object} An Object representing a properties-panel heading entry.
|
|
190
|
-
*/
|
|
191
|
-
function getIOMappingEntries(element, bpmnFactory, translate, options) {
|
|
192
|
-
|
|
193
|
-
// Get the IOMapping and determine whether we are dealing with input or output parameters
|
|
194
|
-
const inputOutput = getIoMapping(element),
|
|
195
|
-
params = determineParamGetFunc(options.prop)(element, false);
|
|
196
|
-
|
|
197
|
-
if (!params.length) {
|
|
198
|
-
const description = entryFieldDescription(translate, translate('No Variables defined'));
|
|
199
|
-
|
|
200
|
-
return [{
|
|
201
|
-
id: `${options.prefix}-parameter-placeholder`,
|
|
202
|
-
cssClasses: [ 'bpp-input-output-placeholder' ],
|
|
203
|
-
html: description
|
|
204
|
-
}];
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const parameters = params.map(function(param, index) {
|
|
208
|
-
|
|
209
|
-
return InputOutputParameter(param, translate,
|
|
210
|
-
{
|
|
211
|
-
idPrefix: `${options.prefix}-parameter-${index}`,
|
|
212
|
-
onRemove: onRemove,
|
|
213
|
-
onToggle: onToggle,
|
|
214
|
-
prop: options.prop
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
function onRemove() {
|
|
218
|
-
let commands = [];
|
|
219
|
-
commands.push(cmdHelper.removeElementsFromList(element, inputOutput, options.prop, null, [param]));
|
|
220
|
-
|
|
221
|
-
// remove inputOutput if there are no input/output parameters anymore
|
|
222
|
-
if (inputOutput.get('inputParameters').length + inputOutput.get('outputParameters').length === 1) {
|
|
223
|
-
commands.push(extensionElementsHelper.removeEntry(getBusinessObject(element), element, inputOutput));
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
return commands;
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
// Return only the entries in a flat structure
|
|
231
|
-
const entries = parameters.flatMap(function(entry) {
|
|
232
|
-
return entry.entries;
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
return entries;
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Close remaining collapsible entries within group.
|
|
239
|
-
*
|
|
240
|
-
* @param {boolean} value
|
|
241
|
-
* @param {HTMLElement} entryNode
|
|
242
|
-
*/
|
|
243
|
-
function onToggle(value, entryNode) {
|
|
244
|
-
if (!value) {
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
const currentEntryId = entryNode.dataset.entry;
|
|
249
|
-
|
|
250
|
-
// Add closing behavior to the parameters
|
|
251
|
-
parameters.forEach(function(parameter) {
|
|
252
|
-
|
|
253
|
-
// Each parameter has 3 entries, the first one always is the collapsbile
|
|
254
|
-
if (parameter.entries[0].id === currentEntryId) {
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
parameter.setOpen(false);
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
// helpers //////////
|
|
265
|
-
|
|
266
|
-
function determineParamGetFunc(property) {
|
|
267
|
-
if (property == 'inputParameters') {
|
|
268
|
-
return getInputParameters;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
if (property == 'outputParameters') {
|
|
272
|
-
return getOutputParameters;
|
|
273
|
-
}
|
|
274
|
-
}
|
package/lib/camunda-cloud/features/properties-provider/parts/implementation/InputOutputParameter.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import cmdHelper from 'bpmn-js-properties-panel/lib/helper/CmdHelper';
|
|
2
|
-
|
|
3
|
-
import entryFactory from 'bpmn-js-properties-panel/lib/factory/EntryFactory';
|
|
4
|
-
|
|
5
|
-
import { query as domQuery } from 'min-dom';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Create an input or output mapping entry for a single input or output entry
|
|
10
|
-
* @param {Object} parameter - BusinessObject for the respective paramter (can be 'zeebe:Input' or 'zeebe:Output')
|
|
11
|
-
* @param {Function} translate - translate function.
|
|
12
|
-
* @param {Object} options - Options.
|
|
13
|
-
* @param {string} [options.idPrefix] - preFix used to construct the 'id' of the GUI entries
|
|
14
|
-
* @param {Function} [options.onToggle] - function to be called when collapsible is toggled.
|
|
15
|
-
* @param {Function} [options.onRemove] - function to be called when entry (collapsbile + source + target) is removed
|
|
16
|
-
* @param {string} [options.prop] - moddle (zeebe-bpmn-moddle) property name for the IOMapping.
|
|
17
|
-
*
|
|
18
|
-
* @returns {Object} An Object containing multiple Objects in its `entries` attribute,
|
|
19
|
-
* each representing a properties-panel entry. First entry will always be a collapsible followed
|
|
20
|
-
* by two inputs (one for source and one for target).
|
|
21
|
-
*/
|
|
22
|
-
export default function(parameter, translate, options = {}) {
|
|
23
|
-
const result = {},
|
|
24
|
-
entries = result.entries = [];
|
|
25
|
-
|
|
26
|
-
// heading ////////////////////////////////////////////////////////
|
|
27
|
-
const collapsible = entryFactory.collapsible({
|
|
28
|
-
id: `${options.idPrefix}-collapsible`,
|
|
29
|
-
cssClasses: [ 'bpp-collapsible--with-mapping' ],
|
|
30
|
-
open: false,
|
|
31
|
-
onRemove: options.onRemove,
|
|
32
|
-
onToggle: options.onToggle,
|
|
33
|
-
get: function() {
|
|
34
|
-
return {
|
|
35
|
-
title: parameter.target,
|
|
36
|
-
|
|
37
|
-
// In the heading do not show the leading `=` of the FEEL expression
|
|
38
|
-
description: getFormattedTargetValue(parameter.source)
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
const isOpen = options.isOpen || collapsible.isOpen;
|
|
44
|
-
|
|
45
|
-
result.setOpen = function(value) {
|
|
46
|
-
const entryNode = domQuery(`[data-entry="${collapsible.id}"]`);
|
|
47
|
-
collapsible.setOpen(value, entryNode);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
entries.push(collapsible);
|
|
51
|
-
|
|
52
|
-
// parameter target ////////////////////////////////////////////////////////
|
|
53
|
-
entries.push(entryFactory.validationAwareTextField(translate, {
|
|
54
|
-
id: `${options.idPrefix}-parameterTarget`,
|
|
55
|
-
label: getTargetTextInputLabel(translate, options.prop),
|
|
56
|
-
modelProperty: 'target',
|
|
57
|
-
|
|
58
|
-
getProperty: function() {
|
|
59
|
-
return parameter.target;
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
setProperty: function(element, values) {
|
|
63
|
-
return cmdHelper.updateBusinessObject(element, parameter, values);
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
validate: function(element, values) {
|
|
67
|
-
const validation = {},
|
|
68
|
-
targetValue = values.target;
|
|
69
|
-
|
|
70
|
-
if (!targetValue) {
|
|
71
|
-
validation.target = getTargetTextInputLabel(translate, options.prop) + ' ' + translate('must not be empty');
|
|
72
|
-
} else if (targetValue.indexOf(' ') >= 0) {
|
|
73
|
-
validation.target = getTargetTextInputLabel(translate, options.prop) + ' ' + translate('must not contain whitespaces');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return validation;
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
hidden: function() {
|
|
80
|
-
return !isOpen();
|
|
81
|
-
}
|
|
82
|
-
}));
|
|
83
|
-
|
|
84
|
-
// parameter source ////////////////////////////////////////////////////////
|
|
85
|
-
entries.push(entryFactory.validationAwareTextField(translate, {
|
|
86
|
-
id: `${options.idPrefix}-parameterSource`,
|
|
87
|
-
label: translate('Variable Assignment Value'),
|
|
88
|
-
modelProperty: 'source',
|
|
89
|
-
|
|
90
|
-
getProperty: function() {
|
|
91
|
-
return parameter.source;
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
setProperty: function(element, values) {
|
|
95
|
-
return cmdHelper.updateBusinessObject(element, parameter, values);
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
validate: function(element, value) {
|
|
99
|
-
const validation = {},
|
|
100
|
-
sourceValue = value.source;
|
|
101
|
-
|
|
102
|
-
if (!sourceValue) {
|
|
103
|
-
validation.source = translate('Variable Assignment Value must not be empty');
|
|
104
|
-
} else if (!sourceValue.startsWith('=')) {
|
|
105
|
-
validation.source = translate('Variable Assignment Value must be a valid FEEL expression and therefore start with \'=\'');
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return validation;
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
hidden: function() {
|
|
112
|
-
return !isOpen();
|
|
113
|
-
}
|
|
114
|
-
}));
|
|
115
|
-
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
// helper ///////////////////////
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Get label for the target input text field according to the property that is edited
|
|
124
|
-
* @param {Function} translate translate.
|
|
125
|
-
* @param {string} prop moddle (zeebe-bpmn-moddle) property name for the IOMapping.
|
|
126
|
-
*
|
|
127
|
-
* @returns {string} Label which makes sense in accordance with the provided property.
|
|
128
|
-
*/
|
|
129
|
-
function getTargetTextInputLabel(translate, prop) {
|
|
130
|
-
if (prop === 'inputParameters') {
|
|
131
|
-
return translate('Local Variable Name');
|
|
132
|
-
}
|
|
133
|
-
if (prop === 'outputParameters') {
|
|
134
|
-
return translate('Process Variable Name');
|
|
135
|
-
}
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Get formatted target value by removing first character
|
|
141
|
-
* @param {string} targetValue
|
|
142
|
-
*
|
|
143
|
-
* @returns {string} formatted target value
|
|
144
|
-
*/
|
|
145
|
-
function getFormattedTargetValue(targetValue) {
|
|
146
|
-
return targetValue.substr(1);
|
|
147
|
-
}
|