3 import { is } from 'bpmn-js/lib/util/ModelUtil';
5 import assign from 'lodash.assign';
7 var entryFactory = require('bpmn-js-properties-panel/lib/factory/EntryFactory'),
8 cmdHelper = require('bpmn-js-properties-panel/lib/helper/CmdHelper');
10 export default function(element, bpmnFactory, options, translate) {
11 var getBusinessObject = options.getBusinessObject,
12 hideResultVariable = options.hideResultVariable,
13 id = options.id || 'resultVariable';
15 var resultVariableEntry = entryFactory.textField({
17 label: translate('Result Variable'),
18 modelProperty: 'resultVariable',
20 get: function(element) {
21 var bo = getBusinessObject(element);
22 return { resultVariable: bo.get('camunda:resultVariable') };
25 set: function(element, values) {
26 var bo = getBusinessObject(element);
28 var resultVariable = values.resultVariable || undefined;
31 'camunda:resultVariable': resultVariable
34 if (is(bo, 'camunda:DmnCapable') && !resultVariable) {
36 { 'camunda:mapDecisionResult': 'resultList' },
41 return cmdHelper.updateBusinessObject(element, bo, props);
45 if (typeof hideResultVariable === 'function') {
46 return hideResultVariable.apply(resultVariableEntry, arguments);
51 return [resultVariableEntry];