shikeying
2023-03-17 8c1a723d62a6aa5d6266ca613ae4eb77c789db06
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
'use strict';
 
var entryFactory = require('../../../../factory/EntryFactory'),
    cmdHelper = require('../../../../helper/CmdHelper');
 
var is = require('bpmn-js/lib/util/ModelUtil').is,
    isEventSubProcess = require('bpmn-js/lib/util/DiUtil').isEventSubProcess;
 
module.exports = function(group, element, bpmnFactory, conditionalEventDefinition, elementRegistry, translate) {
 
  var getValue = function(modelProperty) {
    return function(element) {
      var modelPropertyValue = conditionalEventDefinition.get('camunda:' + modelProperty);
      var value = {};
 
      value[modelProperty] = modelPropertyValue;
      return value;
    };
  };
 
  var setValue = function(modelProperty) {
    return function(element, values) {
      var props = {};
 
      props['camunda:' + modelProperty] = values[modelProperty] || undefined;
 
      return cmdHelper.updateBusinessObject(element, conditionalEventDefinition, props);
    };
  };
 
  group.entries.push(entryFactory.textField({
    id: 'variableName',
    label: translate('Variable Name'),
    modelProperty : 'variableName',
 
    get: getValue('variableName'),
    set: setValue('variableName')
  }));
 
  var isConditionalStartEvent =
    is(element, 'bpmn:StartEvent') && !isEventSubProcess(element.parent);
 
  if (!isConditionalStartEvent) {
    group.entries.push(entryFactory.textField({
      id: 'variableEvent',
      label: translate('Variable Event'),
      description: translate('Specify more than one variable change event as a comma separated list.'),
      modelProperty : 'variableEvent',
 
      get: getValue('variableEvent'),
      set: setValue('variableEvent')
    }));
  }
};