camunda-bpmn-js 0.11.5 → 0.13.0-alpha.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/assets/base-modeler.css +1 -1
  3. package/dist/assets/camunda-platform-modeler.css +2 -1
  4. package/dist/assets/diagram-js.css +2 -0
  5. package/dist/assets/element-templates.css +75 -0
  6. package/dist/assets/properties-panel.css +889 -0
  7. package/dist/base-modeler.development.js +8542 -12092
  8. package/dist/base-modeler.production.min.js +8 -3
  9. package/dist/camunda-cloud-modeler.development.js +12089 -14412
  10. package/dist/camunda-cloud-modeler.production.min.js +8 -3
  11. package/dist/camunda-platform-modeler.development.js +22532 -25950
  12. package/dist/camunda-platform-modeler.production.min.js +8 -3
  13. package/lib/base/Modeler.js +5 -3
  14. package/lib/camunda-cloud/Modeler.js +5 -3
  15. package/lib/camunda-cloud/features/modeling/behavior/CleanUpAssignmentDefinitionBehavior.js +78 -0
  16. package/lib/camunda-cloud/features/modeling/behavior/CleanUpBusinessRuleTaskBehavior.js +112 -0
  17. package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeBoundaryEventBehavior.js +51 -55
  18. package/lib/camunda-cloud/features/modeling/behavior/CreateZeebeCallActivityBehavior.js +57 -60
  19. package/lib/camunda-cloud/features/modeling/behavior/FormDefinitionBehavior.js +70 -128
  20. package/lib/camunda-cloud/features/modeling/behavior/UpdatePropagateAllChildVariablesBehavior.js +76 -128
  21. package/lib/camunda-cloud/features/modeling/behavior/index.js +6 -0
  22. package/lib/camunda-cloud/features/rules/BpmnRules.js +1 -1
  23. package/lib/camunda-cloud/helper/CalledElementHelper.js +43 -41
  24. package/lib/camunda-cloud/helper/ElementHelper.js +18 -0
  25. package/lib/camunda-cloud/helper/ExtensionElementsHelper.js +17 -0
  26. package/lib/camunda-cloud/helper/FormsHelper.js +41 -53
  27. package/lib/camunda-cloud/helper/InputOutputHelper.js +93 -111
  28. package/lib/camunda-cloud/helper/Utils.js +10 -0
  29. package/lib/camunda-cloud/helper/ZeebeServiceTaskHelper.js +22 -5
  30. package/lib/camunda-platform/Modeler.js +7 -3
  31. package/lib/camunda-platform/features/modeling/behavior/DeleteErrorEventDefinitionBehavior.js +24 -47
  32. package/lib/camunda-platform/features/modeling/behavior/DeleteRetryTimeCycleBehavior.js +39 -81
  33. package/lib/camunda-platform/features/modeling/behavior/UpdateCamundaExclusiveBehavior.js +31 -65
  34. package/lib/camunda-platform/features/modeling/behavior/UpdateInputOutputBehavior.js +42 -76
  35. package/lib/camunda-platform/features/modeling/behavior/UpdateResultVariableBehavior.js +21 -26
  36. package/lib/camunda-platform/features/modeling/behavior/UserTaskFormsBehavior.js +16 -10
  37. package/lib/camunda-platform/helper/InputOutputHelper.js +29 -0
  38. package/package.json +6 -5
  39. package/styles/base-modeler.css +1 -1
  40. package/styles/camunda-platform-modeler.css +2 -1
  41. package/dist/assets/bpmn-js-properties-panel.css +0 -778
  42. package/lib/camunda-cloud/features/properties-provider/ZeebePropertiesProvider.js +0 -201
  43. package/lib/camunda-cloud/features/properties-provider/index.js +0 -11
  44. package/lib/camunda-cloud/features/properties-provider/parts/CallActivityProps.js +0 -90
  45. package/lib/camunda-cloud/features/properties-provider/parts/ErrorProps.js +0 -13
  46. package/lib/camunda-cloud/features/properties-provider/parts/FormProps.js +0 -14
  47. package/lib/camunda-cloud/features/properties-provider/parts/HeadersProps.js +0 -52
  48. package/lib/camunda-cloud/features/properties-provider/parts/InputOutputProps.js +0 -8
  49. package/lib/camunda-cloud/features/properties-provider/parts/MessageProps.js +0 -51
  50. package/lib/camunda-cloud/features/properties-provider/parts/MultiInstanceProps.js +0 -25
  51. package/lib/camunda-cloud/features/properties-provider/parts/SequenceFlowProps.js +0 -149
  52. package/lib/camunda-cloud/features/properties-provider/parts/TaskDefinitionProps.js +0 -135
  53. package/lib/camunda-cloud/features/properties-provider/parts/TimerEventProps.js +0 -77
  54. package/lib/camunda-cloud/features/properties-provider/parts/implementation/ElementReferenceExtensionElementProperty.js +0 -110
  55. package/lib/camunda-cloud/features/properties-provider/parts/implementation/FormDefinition.js +0 -207
  56. package/lib/camunda-cloud/features/properties-provider/parts/implementation/Headers.js +0 -208
  57. package/lib/camunda-cloud/features/properties-provider/parts/implementation/InputOutput.js +0 -260
  58. package/lib/camunda-cloud/features/properties-provider/parts/implementation/InputOutputParameter.js +0 -147
  59. package/lib/camunda-cloud/features/properties-provider/parts/implementation/MultiInstanceLoopCharacteristics.js +0 -176
  60. package/lib/camunda-cloud/features/properties-provider/parts/implementation/OutputParameterToggle.js +0 -97
  61. package/lib/camunda-cloud/features/properties-provider/parts/implementation/TimerDurationDefinition.js +0 -69
  62. 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,260 +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
- determineParamGetFunc,
21
- getInputOutput,
22
- isInputOutputSupported
23
- } from '../../../../helper/InputOutputHelper';
24
-
25
- import InputOutputParameter from './InputOutputParameter';
26
-
27
- import OutputParameterToggle from './OutputParameterToggle';
28
-
29
-
30
- /**
31
- * Create an input or output mapping entry (containing multiple sub-entries).
32
- * @param {Object} element - diagram-js element.
33
- * @param {Object} bpmnFactory - bpmn-js bpmn-factory.
34
- * @param {Function} translate - translate function.
35
- * @param {Object} options - Options.
36
- * @param {string} [options.type] - moddle (zeebe-bpmn-moddle) type name for the IOMapping.
37
- * @param {string} [options.prop] - moddle (zeebe-bpmn-moddle) property name for the IOMapping.
38
- * @param {string} [options.prefix] - prefix to be used when constructing id attribute of HTMLElements.
39
- *
40
- * @returns {Object} An Object containing multiple Objects in its `entries` attribute,
41
- * each representing a properties-panel entry. First entry will always be a heading followed
42
- * by n input / output parameter entries.
43
- */
44
- export default function(element, bpmnFactory, translate, options = {}) {
45
- const result = {
46
- entries: []
47
- };
48
-
49
- // Return if given moddle property is not supported for given element
50
- if (!options.prop ||
51
- !isInputOutputSupported(element) ||
52
- (options.prop === 'inputParameters' && !areInputParametersSupported(element)) ||
53
- (options.prop === 'outputParameters' && !areOutputParametersSupported(element))) {
54
- return result;
55
- }
56
-
57
- // Heading ///////////////////////////////////////////////////////////////
58
- const heading = getParametersHeadingEntry(element, bpmnFactory, {
59
- type: options.type,
60
- prop: options.prop,
61
- prefix: options.prefix
62
- });
63
- result.entries = result.entries.concat(heading);
64
-
65
- // Toggle ///////////////////////////////////////////////////////////////////
66
- const toggle = OutputParameterToggle(element, bpmnFactory, translate, {
67
- prefix: options.prefix,
68
- prop: options.prop
69
- });
70
- result.entries = result.entries.concat(toggle);
71
-
72
- // Parameters ///////////////////////////////////////////////////////////////
73
- result.entries = result.entries.concat(getIOMappingEntries(element, bpmnFactory, translate, {
74
- prefix: options.prefix,
75
- prop: options.prop
76
- }));
77
-
78
- return result;
79
- }
80
-
81
- /**
82
- * Create an input or output mapping heading entry.
83
- * @param {Object} element - diagram-js element.
84
- * @param {Object} bpmnFactory - bpmn-js bpmn-factory.
85
- * @param {Object} options - Options.
86
- * @param {string} [options.type] - moddle (zeebe-bpmn-moddle) type name for the IOMapping.
87
- * @param {string} [options.prop] - moddle (zeebe-bpmn-moddle) property name for the IOMapping.
88
- * @param {string} [options.prefix] - prefix to be used when constructing id attribute of HTMLElements.
89
- *
90
- * @returns {Object} An Object representing a properties-panel heading entry.
91
- */
92
- function getParametersHeadingEntry(element, bpmnFactory, options) {
93
- const entry = {
94
- id: `${options.prefix}-heading`,
95
- cssClasses: [ 'bpp-input-output' ],
96
- html: `<div class="bpp-field-wrapper">
97
- <button type="button" class="bpp-input-output__add add action-button" data-action="createElement">
98
- </button><input name="hidden" type="hidden">
99
- </div>`,
100
- createElement: function(_, entryNode) {
101
- const commands = createElement();
102
-
103
- if (commands) {
104
- scheduleCommands(commands, entryNode);
105
- return true;
106
- }
107
- },
108
-
109
- set: function() {
110
- const commands = entry._commands;
111
-
112
- if (commands) {
113
- delete entry._commands;
114
- return commands;
115
- }
116
- }
117
- };
118
-
119
- return entry;
120
-
121
- function createElement() {
122
- const commands = [],
123
- bo = getBusinessObject(element);
124
-
125
- let extensionElements = bo.get('extensionElements');
126
-
127
- if (!extensionElements) {
128
- extensionElements = elementHelper.createElement('bpmn:ExtensionElements', { values: [] }, bo, bpmnFactory);
129
- commands.push(cmdHelper.updateBusinessObject(element, bo, { extensionElements: extensionElements }));
130
- }
131
-
132
- // Get the IOMapping
133
- let inputOutput = getInputOutput(element);
134
-
135
- if (!inputOutput) {
136
- const parent = extensionElements;
137
-
138
- inputOutput = createIOMapping(parent, bpmnFactory, {
139
- inputParameters: [],
140
- outputParameters: []
141
- });
142
-
143
- commands.push(cmdHelper.addAndRemoveElementsFromList(
144
- element,
145
- extensionElements,
146
- 'values',
147
- 'extensionElements',
148
- [ inputOutput ],
149
- []
150
- ));
151
- }
152
-
153
- const newElem = createParameter(options.type, inputOutput, bpmnFactory, {
154
- source: '= source',
155
- target: 'target'
156
- });
157
-
158
- commands.push(cmdHelper.addElementsTolist(element, inputOutput, options.prop, [ newElem ]));
159
-
160
- return commands;
161
- }
162
-
163
- /**
164
- * Schedule commands to be run with next `set` method call.
165
- *
166
- * @param {Array<any>} commands
167
- * @param {HTMLElement} entryNode
168
- */
169
- function scheduleCommands(commands, entryNode) {
170
- entry._commands = commands;
171
-
172
- // @maxtru, adapted from @barmac: hack to make properties panel call `set`
173
- const input = domQuery('input[type="hidden"]', entryNode);
174
- input.value = 1;
175
- }
176
-
177
- }
178
-
179
- /**
180
- * Create a list of Input or Output Mapping properties-panel entries.
181
- * @param {Object} element - diagram-js element.
182
- * @param {Object} bpmnFactory - bpmn-js bpmn-factory.
183
- * @param {Function} translate - translate.
184
- * @param {Object} options - Options.
185
- * @param {string} [options.prop] - moddle (zeebe-bpmn-moddle) property name for the IOMapping.
186
- * @param {string} [options.prefix] - prefix to be used when constructing id attribute of HTMLElements.
187
- *
188
- * @returns {Object} An Object representing a properties-panel heading entry.
189
- */
190
- function getIOMappingEntries(element, bpmnFactory, translate, options) {
191
-
192
- // Get the IOMapping and determine whether we are dealing with input or output parameters
193
- const inputOutput = getInputOutput(element, false),
194
- params = determineParamGetFunc(options.prop)(element, false);
195
-
196
- if (!params.length) {
197
- const description = entryFieldDescription(translate, translate('No Variables defined'));
198
-
199
- return [{
200
- id: `${options.prefix}-parameter-placeholder`,
201
- cssClasses: [ 'bpp-input-output-placeholder' ],
202
- html: description
203
- }];
204
- }
205
-
206
- const parameters = params.map(function(param, index) {
207
-
208
- return InputOutputParameter(param, translate,
209
- {
210
- idPrefix: `${options.prefix}-parameter-${index}`,
211
- onRemove: onRemove,
212
- onToggle: onToggle,
213
- prop: options.prop
214
- });
215
-
216
- function onRemove() {
217
- let commands = [];
218
- commands.push(cmdHelper.removeElementsFromList(element, inputOutput, options.prop, null, [param]));
219
-
220
- // remove inputOutput if there are no input/output parameters anymore
221
- if (inputOutput.get('inputParameters').length + inputOutput.get('outputParameters').length === 1) {
222
- commands.push(extensionElementsHelper.removeEntry(getBusinessObject(element), element, inputOutput));
223
- }
224
-
225
- return commands;
226
- }
227
- });
228
-
229
- // Return only the entries in a flat structure
230
- const entries = parameters.flatMap(function(entry) {
231
- return entry.entries;
232
- });
233
-
234
- return entries;
235
-
236
- /**
237
- * Close remaining collapsible entries within group.
238
- *
239
- * @param {boolean} value
240
- * @param {HTMLElement} entryNode
241
- */
242
- function onToggle(value, entryNode) {
243
- if (!value) {
244
- return;
245
- }
246
-
247
- const currentEntryId = entryNode.dataset.entry;
248
-
249
- // Add closing behavior to the parameters
250
- parameters.forEach(function(parameter) {
251
-
252
- // Each parameter has 3 entries, the first one always is the collapsbile
253
- if (parameter.entries[0].id === currentEntryId) {
254
- return;
255
- }
256
-
257
- parameter.setOpen(false);
258
- });
259
- }
260
- }
@@ -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
- }