cmmn-js-properties-panel-flowable 1.1.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 (72) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +112 -0
  3. package/dist/assets/cmmn-js-properties-panel.css +495 -0
  4. package/index.js +1 -0
  5. package/lib/PropertiesActivator.js +67 -0
  6. package/lib/PropertiesPanel.js +1264 -0
  7. package/lib/Utils.js +126 -0
  8. package/lib/cmd/MultiCommandHandler.js +32 -0
  9. package/lib/cmd/UpdateBusinessObjectHandler.js +100 -0
  10. package/lib/cmd/UpdateBusinessObjectListHandler.js +108 -0
  11. package/lib/cmd/index.js +25 -0
  12. package/lib/factory/CheckboxEntryFactory.js +68 -0
  13. package/lib/factory/EntryFactory.js +199 -0
  14. package/lib/factory/EntryFieldDescription.js +73 -0
  15. package/lib/factory/LabelFactory.js +38 -0
  16. package/lib/factory/SelectEntryFactory.js +75 -0
  17. package/lib/factory/TextBoxEntryFactory.js +42 -0
  18. package/lib/factory/TextInputEntryFactory.js +73 -0
  19. package/lib/factory/ValidationAwareTextInput.js +66 -0
  20. package/lib/helper/CmdHelper.js +76 -0
  21. package/lib/helper/CmmnElementHelper.js +232 -0
  22. package/lib/helper/ElementHelper.js +23 -0
  23. package/lib/helper/ExtensionElementsHelper.js +39 -0
  24. package/lib/helper/ListenerHelper.js +28 -0
  25. package/lib/index.js +13 -0
  26. package/lib/provider/cmmn/CmmnPropertiesProvider.js +183 -0
  27. package/lib/provider/cmmn/index.js +7 -0
  28. package/lib/provider/cmmn/parts/CallableProps.js +169 -0
  29. package/lib/provider/cmmn/parts/CaseProps.js +66 -0
  30. package/lib/provider/cmmn/parts/DefinitionDocumentationProps.js +24 -0
  31. package/lib/provider/cmmn/parts/DefinitionIdProps.js +22 -0
  32. package/lib/provider/cmmn/parts/DefinitionNameProps.js +43 -0
  33. package/lib/provider/cmmn/parts/DocumentationProps.js +21 -0
  34. package/lib/provider/cmmn/parts/IdProps.js +14 -0
  35. package/lib/provider/cmmn/parts/IfPartProps.js +110 -0
  36. package/lib/provider/cmmn/parts/NameProps.js +90 -0
  37. package/lib/provider/cmmn/parts/OnPartProps.js +61 -0
  38. package/lib/provider/cmmn/parts/PlanItemControlProps.js +214 -0
  39. package/lib/provider/cmmn/parts/implementation/ConditionProp.js +81 -0
  40. package/lib/provider/cmmn/parts/implementation/DocumentationProp.js +91 -0
  41. package/lib/provider/cmmn/parts/implementation/IdProp.js +42 -0
  42. package/lib/provider/cmmn/parts/implementation/NameProp.js +38 -0
  43. package/lib/provider/cmmn/parts/implementation/RuleProp.js +96 -0
  44. package/lib/provider/cmmn/parts/implementation/TransitionProp.js +81 -0
  45. package/lib/provider/flowable/FlowablePropertiesProvider.js +393 -0
  46. package/lib/provider/flowable/index.js +7 -0
  47. package/lib/provider/flowable/parts/CallableExtensionProps.js +250 -0
  48. package/lib/provider/flowable/parts/CaseExecutionListenerProps.js +31 -0
  49. package/lib/provider/flowable/parts/HistoryTimeToLiveProps.js +19 -0
  50. package/lib/provider/flowable/parts/HumanTaskProps.js +76 -0
  51. package/lib/provider/flowable/parts/ListenerDetailProps.js +32 -0
  52. package/lib/provider/flowable/parts/ListenerFieldInjectionProps.js +13 -0
  53. package/lib/provider/flowable/parts/RepeatOnStandardEventProps.js +144 -0
  54. package/lib/provider/flowable/parts/TaskListenerProps.js +27 -0
  55. package/lib/provider/flowable/parts/VariableListenerProps.js +27 -0
  56. package/lib/provider/flowable/parts/VariableMappingProps.js +361 -0
  57. package/lib/provider/flowable/parts/implementation/BusinessKeyProp.js +109 -0
  58. package/lib/provider/flowable/parts/implementation/ExtensionElements.js +248 -0
  59. package/lib/provider/flowable/parts/implementation/FieldInjection.js +281 -0
  60. package/lib/provider/flowable/parts/implementation/HistoryTimeToLiveProp.js +37 -0
  61. package/lib/provider/flowable/parts/implementation/ListenerDelegateProp.js +159 -0
  62. package/lib/provider/flowable/parts/implementation/ListenerElements.js +132 -0
  63. package/lib/provider/flowable/parts/implementation/ListenerEventTypeProp.js +118 -0
  64. package/lib/provider/flowable/parts/implementation/ScriptProp.js +161 -0
  65. package/package.json +72 -0
  66. package/styles/_mixins.less +79 -0
  67. package/styles/_variables.less +19 -0
  68. package/styles/config.json +46 -0
  69. package/styles/groups.less +71 -0
  70. package/styles/header.less +35 -0
  71. package/styles/properties.less +328 -0
  72. package/styles/tabs.less +90 -0
@@ -0,0 +1,110 @@
1
+ 'use strict';
2
+
3
+ var cmdHelper = require('../../../helper/CmdHelper');
4
+ var ConditionProp = require('./implementation/ConditionProp');
5
+
6
+ var CmmnElementHelper = require('../../../helper/CmmnElementHelper'),
7
+ isCriterion = CmmnElementHelper.isCriterion,
8
+ isItemCapable = CmmnElementHelper.isItemCapable;
9
+
10
+ var ModelUtil = require('cmmn-js/lib/util/ModelUtil'),
11
+ isCasePlanModel = ModelUtil.isCasePlanModel,
12
+ getBusinessObject = ModelUtil.getBusinessObject;
13
+
14
+ var getParent = require('cmmn-js/lib/features/modeling/util/ModelingUtil').getParent;
15
+
16
+ module.exports = function(group, element, cmmnFactory, elementRegistry, itemRegistry, translate) {
17
+
18
+ function getIfPart(bo) {
19
+ return bo && bo.get('ifPart');
20
+ }
21
+
22
+ function getIfPartCondition(bo) {
23
+ var ifPart = getIfPart(bo);
24
+ return ifPart && ifPart.get('condition');
25
+ }
26
+
27
+
28
+ if (!isCriterion(element)) {
29
+ return;
30
+ }
31
+
32
+
33
+ group.entries = group.entries.concat(ConditionProp(element, cmmnFactory, translate, {
34
+
35
+ id: 'ifPartCondition',
36
+ label: translate('If Part Condition'),
37
+ reference: 'sentryRef',
38
+
39
+ getCondition: function(element, node, bo) {
40
+ return getIfPartCondition(bo);
41
+ },
42
+
43
+ createdCondition: function(condition, element, node, bo) {
44
+ var cmds = [],
45
+ ifPart = getIfPart(bo);
46
+
47
+ if (!bo) {
48
+
49
+ // criterion without referencing a sentry
50
+ bo = cmmnFactory.create('cmmn:Sentry');
51
+
52
+ var container = getSentryParent(element.host),
53
+ criterion = getBusinessObject(element);
54
+ if (container) {
55
+ cmds.push(
56
+ cmdHelper.updateProperties(criterion, { sentryRef: bo }, element),
57
+ cmdHelper.updateSemanticParent(bo, container, 'sentries', element)
58
+ );
59
+ }
60
+
61
+ }
62
+
63
+ if (!ifPart) {
64
+ ifPart = cmmnFactory.create('cmmn:IfPart');
65
+ cmds.push(
66
+ cmdHelper.updateProperties(bo, { ifPart: ifPart }, element),
67
+ cmdHelper.updateSemanticParent(ifPart, bo, null, element)
68
+ );
69
+ }
70
+
71
+ cmds.push(
72
+ cmdHelper.updateProperties(ifPart, { condition: condition }, element),
73
+ cmdHelper.updateSemanticParent(condition, ifPart, null, element)
74
+ );
75
+
76
+ return cmds;
77
+ },
78
+
79
+ removedCondition: function(condition, element, node, bo) {
80
+ var cmds = [],
81
+ ifPart = getIfPart(bo);
82
+
83
+ if (ifPart) {
84
+ cmds.push(
85
+ cmdHelper.updateProperties(ifPart, { condition: undefined }, element),
86
+ cmdHelper.updateProperties(bo, { ifPart: undefined }, element),
87
+ cmdHelper.updateSemanticParent(ifPart, null, null, element)
88
+ );
89
+ }
90
+
91
+ return cmds;
92
+ }
93
+
94
+ }));
95
+
96
+ };
97
+
98
+
99
+ function getSentryParent(host) {
100
+
101
+ if (isCasePlanModel(host)) {
102
+ return getBusinessObject(host);
103
+ }
104
+
105
+ if (isItemCapable(host)) {
106
+ var bo = getBusinessObject(host);
107
+ return getParent(bo, 'cmmn:PlanFragment');
108
+ }
109
+
110
+ }
@@ -0,0 +1,90 @@
1
+ 'use strict';
2
+
3
+ var cmdHelper = require('../../../helper/CmdHelper');
4
+
5
+ var NameProp = require('./implementation/NameProp');
6
+
7
+ var ModelUtil = require('cmmn-js/lib/util/ModelUtil'),
8
+ getName = ModelUtil.getName;
9
+
10
+ var isLabel = require('cmmn-js/lib/features/modeling/util/ModelingUtil').isLabel;
11
+
12
+ var CmmnElementHelper = require('../../../helper/CmmnElementHelper'),
13
+ isOnPartConnection = CmmnElementHelper.isOnPartConnection,
14
+ isCMMNEdge = CmmnElementHelper.isCMMNEdge,
15
+ isDiscretionaryConnection = CmmnElementHelper.isDiscretionaryConnection,
16
+ isAssociationConnection = CmmnElementHelper.isAssociationConnection,
17
+ isCriterion = CmmnElementHelper.isCriterion,
18
+ isTextAnnotation = CmmnElementHelper.isTextAnnotation,
19
+ isItemCapable = CmmnElementHelper.isItemCapable,
20
+ getOutgoingOnParts = CmmnElementHelper.getOutgoingOnParts;
21
+
22
+
23
+ module.exports = function(group, element, cmmnFactory, elementRegistry, itemRegistry, cmmnRules, translate) {
24
+
25
+ if (isCriterion(element)) {
26
+ return;
27
+ }
28
+
29
+ if (isCMMNEdge(element) &&
30
+ (isDiscretionaryConnection(element) ||
31
+ isAssociationConnection(element))) {
32
+ return;
33
+ }
34
+
35
+
36
+ var setter;
37
+ if (isOnPartConnection(element)) {
38
+ setter = function(element, values, node, bo) {
39
+
40
+ var connection = !isLabel(element) ? element : element.labelTarget,
41
+ source = connection.source,
42
+ changed = getOutgoingOnParts(source, bo) || [],
43
+ name = values.name || undefined;
44
+
45
+ if (changed.indexOf(element) === -1) {
46
+ changed.push(element);
47
+ }
48
+
49
+ return cmdHelper.updateProperties(bo, { name: name }, changed);
50
+
51
+ };
52
+ }
53
+
54
+
55
+ // name
56
+ group.entries = group.entries.concat(NameProp(element, translate, {
57
+
58
+ modelProperty: isTextAnnotation(element) ? 'text' : undefined,
59
+ reference: isCMMNEdge(element) ? 'cmmnElementRef' : undefined,
60
+
61
+ get: function(element, node, bo) {
62
+
63
+ if (isTextAnnotation(bo)) {
64
+ return {
65
+ text: bo.text
66
+ };
67
+ }
68
+
69
+ return {
70
+ name: getName(bo)
71
+ };
72
+ },
73
+
74
+ set: setter,
75
+
76
+ validate: function(element, values, node, bo) {
77
+
78
+ var result = {};
79
+
80
+ if (isItemCapable(bo) && getName(bo) && !bo.name) {
81
+ result = { name: { warning: translate('Definition name is used') } };
82
+ }
83
+
84
+ return result;
85
+
86
+ }
87
+
88
+ }));
89
+
90
+ };
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+
3
+ var cmdHelper = require('../../../helper/CmdHelper'),
4
+ entryFactory = require('../../../factory/EntryFactory');
5
+
6
+ var TransitionProp = require('./implementation/TransitionProp');
7
+
8
+ var CmmnElementHelper = require('../../../helper/CmmnElementHelper'),
9
+ isOnPartConnection = CmmnElementHelper.isOnPartConnection,
10
+ getOutgoingOnParts = CmmnElementHelper.getOutgoingOnParts;
11
+
12
+ var isLabel = require('cmmn-js/lib/features/modeling/util/ModelingUtil').isLabel;
13
+
14
+ module.exports = function(group, element, cmmnFactory, elementRegistry, itemRegistry, translate) {
15
+
16
+
17
+ if (!isOnPartConnection(element)) {
18
+ return;
19
+ }
20
+
21
+
22
+ // standard event
23
+ group.entries = group.entries.concat(TransitionProp(element, translate, {
24
+
25
+ id: 'onPartStandardEvent',
26
+ label: translate('Standard Event'),
27
+ reference: 'cmmnElementRef',
28
+ modelProperty: 'standardEvent',
29
+
30
+ set: function(element, values, node, bo) {
31
+
32
+ var connection = !isLabel(element) ? element : element.labelTarget,
33
+ source = connection.source,
34
+ changed = getOutgoingOnParts(source, bo) || [],
35
+ standardEvent = values.standardEvent || undefined;
36
+
37
+ if (changed.indexOf(element) === -1) {
38
+ changed.push(element);
39
+ }
40
+
41
+ return cmdHelper.updateProperties(bo, { standardEvent: standardEvent }, changed);
42
+
43
+ },
44
+
45
+ validate: function(element, values, node, bo) {
46
+ return bo && !bo.get('standardEvent') ? { standardEvent: translate('Must provide a standard event') } : {};
47
+ }
48
+
49
+ }));
50
+
51
+
52
+ // is standard event visible
53
+ group.entries.push(entryFactory.checkbox({
54
+
55
+ id: 'onPartIsStandardEventVisible',
56
+ label: translate('Show Standard Event'),
57
+ modelProperty: 'isStandardEventVisible'
58
+
59
+ }));
60
+
61
+ };
@@ -0,0 +1,214 @@
1
+ 'use strict';
2
+
3
+ var RuleProp = require('./implementation/RuleProp');
4
+
5
+ var cmdHelper = require('../../../helper/CmdHelper');
6
+
7
+ var ModelUtil = require('cmmn-js/lib/util/ModelUtil'),
8
+ getBusinessObject = ModelUtil.getBusinessObject,
9
+ isCasePlanModel = ModelUtil.isCasePlanModel,
10
+ getDefinition = ModelUtil.getDefinition;
11
+
12
+ var CmmnElementHelper = require('../../../helper/CmmnElementHelper'),
13
+ isTask = CmmnElementHelper.isTask,
14
+ isStage = CmmnElementHelper.isStage,
15
+ isMilestone = CmmnElementHelper.isMilestone;
16
+
17
+ module.exports = function(group, element, cmmnFactory, elementRegistry, itemRegistry, cmmnRules, translate, options) {
18
+
19
+
20
+ function getItemControl(element) {
21
+ var bo = getBusinessObject(element);
22
+ return bo && bo.get(itemControlProp);
23
+ }
24
+
25
+ function getDefaultControl(element) {
26
+ var bo = getDefinition(element);
27
+ return bo && bo.get(defaultControlProp);
28
+ }
29
+
30
+ function hasItemControl(element) {
31
+ var bo = getBusinessObject(element);
32
+ return !!(bo && bo.get(itemControlProp));
33
+ }
34
+
35
+ function hasDefaultControl(element) {
36
+ var bo = getDefinition(element);
37
+ return !!(bo && bo.get(defaultControlProp));
38
+ }
39
+
40
+ function isPlanItemControlAvailable(element, isDefaultControl) {
41
+ return isDefaultControl ? hasDefaultControl(element) : hasItemControl(element);
42
+ }
43
+
44
+
45
+
46
+ function validateRule(prop) {
47
+
48
+ return function(element, values, node, definition) {
49
+ var itemControl = getItemControl(element),
50
+ itemRule = itemControl && itemControl.get(prop),
51
+ defaultControl = getDefaultControl(definition),
52
+ defaultRule = defaultControl && defaultControl.get(prop),
53
+ result = {};
54
+
55
+ if (itemRule && defaultRule) {
56
+ result[prop] = { warning: translate('Rule is overwritten by item control') };
57
+ }
58
+
59
+ return result;
60
+ };
61
+
62
+ }
63
+
64
+
65
+ if (isCasePlanModel(element) ||
66
+ (!isTask(element) &&
67
+ !isStage(element) &&
68
+ !isMilestone(element))) {
69
+ return;
70
+ }
71
+
72
+
73
+ options = options || {};
74
+
75
+ var defaultControlProp = 'defaultControl',
76
+ itemControlProp = 'itemControl',
77
+ manualActivationRuleProp = 'manualActivationRule',
78
+ requiredRuleProp = 'requiredRule',
79
+ repetitionRuleProp = 'repetitionRule';
80
+
81
+ var isDefaultControl = options.isDefaultControl,
82
+ idPrefix = (isDefaultControl ? 'default' : 'item') + 'Control',
83
+ reference = isDefaultControl ? 'definitionRef' : undefined,
84
+ controlRef = isDefaultControl ? defaultControlProp : itemControlProp;
85
+
86
+
87
+ group.entries.push({
88
+
89
+ id: idPrefix + 'ControlAction',
90
+ html: '<div class="cpp-row cpp-action">' +
91
+ '<div data-show="canBeAdded">' +
92
+ '<label>Add ' + (isDefaultControl ? 'Default' : 'Item') + ' Control</label>' +
93
+ '<button class="add" data-action="add"><span>+</span></button>' +
94
+ '</div>' +
95
+ '<div data-show="canBeRemoved">' +
96
+ '<label>Remove ' + (isDefaultControl ? 'Default' : 'Item') + ' Control</label>' +
97
+ '<button class="clear" data-action="remove"><span>x</span></button>' +
98
+ '</div>' +
99
+ '</div>',
100
+
101
+ canBeAdded: function(element) {
102
+ return !isPlanItemControlAvailable(element, isDefaultControl);
103
+ },
104
+ canBeRemoved: function(element) {
105
+ return isPlanItemControlAvailable(element, isDefaultControl);
106
+ },
107
+ add: function() {
108
+ this.__action = 'add';
109
+ return { force: true };
110
+ },
111
+ remove: function() {
112
+ this.__action = 'remove';
113
+ return { force: true };
114
+ },
115
+ set: function(element) {
116
+
117
+ var action = this.__action;
118
+ delete this.__action;
119
+
120
+ var bo = isDefaultControl ? getDefinition(element) : getBusinessObject(element),
121
+ cmds = [],
122
+ update = {},
123
+ parent,
124
+ control;
125
+
126
+
127
+ if (action === 'add') {
128
+ control = cmmnFactory.create('cmmn:PlanItemControl');
129
+ update[controlRef] = control;
130
+ parent = bo;
131
+ }
132
+ else if (action === 'remove') {
133
+ control = isDefaultControl ? getDefaultControl(element) : getItemControl(element);
134
+ update[controlRef] = undefined;
135
+ parent = undefined;
136
+ }
137
+
138
+ cmds.push(
139
+ cmdHelper.updateProperties(bo, update, itemRegistry.getShapes(bo)),
140
+ cmdHelper.updateSemanticParent(control, parent, null, element)
141
+ );
142
+
143
+ return cmds;
144
+ }
145
+
146
+ });
147
+
148
+
149
+ // manual activation rule
150
+ if (cmmnRules.canSetManualActivationRule(element)) {
151
+
152
+ group.entries = group.entries.concat(RuleProp(element, cmmnFactory, itemRegistry, translate, {
153
+
154
+ id: idPrefix + 'ManualActivationRule',
155
+ label: translate('Manual Activation Rule'),
156
+ reference: reference,
157
+ controlRef: controlRef,
158
+ ruleType: 'cmmn:ManualActivationRule',
159
+ ruleRef: manualActivationRuleProp,
160
+ modelProperty: manualActivationRuleProp,
161
+ validate: isDefaultControl ? validateRule(manualActivationRuleProp) : undefined,
162
+ disabled: function(element) {
163
+ return !isPlanItemControlAvailable(element, isDefaultControl);
164
+ }
165
+
166
+ }));
167
+
168
+ }
169
+
170
+
171
+ // required rule
172
+ if (cmmnRules.canSetRequiredRule(element)) {
173
+
174
+ group.entries = group.entries.concat(RuleProp(element, cmmnFactory, itemRegistry, translate, {
175
+
176
+ id: idPrefix + 'RequiredRule',
177
+ label: translate('Required Rule'),
178
+ reference: reference,
179
+ controlRef: controlRef,
180
+ ruleType: 'cmmn:RequiredRule',
181
+ ruleRef: requiredRuleProp,
182
+ modelProperty: requiredRuleProp,
183
+ validate: isDefaultControl ? validateRule(requiredRuleProp) : undefined,
184
+ disabled: function(element) {
185
+ return !isPlanItemControlAvailable(element, isDefaultControl);
186
+ }
187
+
188
+ }));
189
+
190
+ }
191
+
192
+
193
+ // repetition rule
194
+ if (cmmnRules.canSetRepetitionRule(element)) {
195
+
196
+ group.entries = group.entries.concat(RuleProp(element, cmmnFactory, itemRegistry, translate, {
197
+
198
+ id: idPrefix + 'RepetitionRule',
199
+ label: translate('Repetition Rule'),
200
+ reference: reference,
201
+ controlRef: controlRef,
202
+ ruleType: 'cmmn:RepetitionRule',
203
+ ruleRef: repetitionRuleProp,
204
+ modelProperty: repetitionRuleProp,
205
+ validate: isDefaultControl ? validateRule(repetitionRuleProp) : undefined,
206
+ disabled: function(element) {
207
+ return !isPlanItemControlAvailable(element, isDefaultControl);
208
+ }
209
+
210
+ }));
211
+
212
+ }
213
+
214
+ };
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ var cmdHelper = require('../../../../helper/CmdHelper'),
4
+ entryFactory = require('../../../../factory/EntryFactory');
5
+
6
+ var noop = function() {};
7
+ var noopEmptyList = function() { return []; };
8
+
9
+ module.exports = function(element, cmmnFactory, translate, options) {
10
+
11
+ options = options || {};
12
+
13
+ var id = options.id,
14
+ label = options.label,
15
+ reference = options.reference,
16
+ modelProperty = options.modelProperty || 'body',
17
+ getCondition = options.getCondition || noop,
18
+ createdCondition = options.createdCondition || noopEmptyList,
19
+ removedCondition = options.removedCondition || noopEmptyList;
20
+
21
+
22
+ var conditionEntry = entryFactory.textField({
23
+
24
+ id: id || 'condition',
25
+ label: label || translate('Condition'),
26
+ modelProperty: modelProperty,
27
+ reference: reference,
28
+
29
+ get: function(element, node, bo) {
30
+
31
+ var condition = getCondition(element, node, bo),
32
+ value = {};
33
+
34
+ value[modelProperty] = (condition && condition.get('body')) || undefined;
35
+
36
+ return value;
37
+
38
+ },
39
+
40
+ set: function(element, values, node, bo) {
41
+
42
+ var condition = getCondition(element, node, bo),
43
+ body = values[modelProperty] || undefined,
44
+ value = { body : body },
45
+ cmds = [];
46
+
47
+ if (body) {
48
+
49
+ if (!condition) {
50
+ condition = cmmnFactory.create('cmmn:Expression', value);
51
+ cmds.push(createdCondition(condition, element, node, bo));
52
+ }
53
+ else {
54
+ cmds.push(cmdHelper.updateProperties(condition, value, element));
55
+ }
56
+
57
+ }
58
+ else {
59
+
60
+ if (condition) {
61
+ cmds.push(
62
+ cmdHelper.updateProperties(condition, value, element),
63
+ cmdHelper.updateSemanticParent(condition, null, null, element),
64
+ removedCondition(condition, element, node, bo)
65
+ );
66
+ }
67
+
68
+ }
69
+
70
+ return cmds;
71
+
72
+ },
73
+
74
+ validate: options.validate,
75
+ disabled: options.disabled
76
+
77
+ });
78
+
79
+ return [ conditionEntry ];
80
+
81
+ };
@@ -0,0 +1,91 @@
1
+ 'use strict';
2
+
3
+ var forEach = require('lodash/forEach');
4
+
5
+ var entryFactory = require('../../../../factory/EntryFactory'),
6
+ cmdHelper = require('../../../../helper/CmdHelper');
7
+
8
+ var CmmnElementHelper = require('../../../../helper/CmmnElementHelper'),
9
+ isCMMNDiagram = CmmnElementHelper.isCMMNDiagram;
10
+
11
+
12
+ module.exports = function(element, cmmnFactory, translate, options) {
13
+
14
+ options = options || {};
15
+
16
+ var containment = 'documentation';
17
+
18
+ function getDocumentations(bo) {
19
+ return bo.get(containment);
20
+ }
21
+
22
+ function getDocumentation(bo) {
23
+ var documentations = getDocumentations(bo);
24
+ return documentations.length > 0 ? documentations[0] : undefined;
25
+ }
26
+
27
+ // Documentation
28
+ var entry = entryFactory.textBox({
29
+
30
+ id: options.id || 'documentation',
31
+ label: options.label || translate('Documentation'),
32
+ modelProperty: 'documentation',
33
+ reference: options.reference,
34
+
35
+ get: function(element, node, bo) {
36
+
37
+ var documentation,
38
+ text;
39
+
40
+ if (isCMMNDiagram(bo)) {
41
+ text = bo.documentation;
42
+ }
43
+ else {
44
+ documentation = getDocumentation(bo);
45
+ text = documentation && documentation.text;
46
+ }
47
+
48
+ return {
49
+ documentation: text
50
+ };
51
+
52
+ },
53
+
54
+ set: function(element, values, node, bo) {
55
+
56
+ var isRoot = isCMMNDiagram(bo),
57
+ documentation = !isRoot && getDocumentation(bo),
58
+ text = values.documentation || undefined,
59
+ value = {};
60
+
61
+ value[isRoot ? 'documentation' : 'text'] = text;
62
+
63
+ if (isRoot) {
64
+ return cmdHelper.updateProperties(bo, value, element);
65
+ }
66
+
67
+ if (documentation && !text) {
68
+
69
+ var cmds = [];
70
+
71
+ forEach(getDocumentations(bo), function(doc) {
72
+ cmds.push(cmdHelper.updateSemanticParent(doc, null, containment, element));
73
+ });
74
+
75
+ return cmds;
76
+ }
77
+
78
+ if (!documentation && text) {
79
+ documentation = cmmnFactory.create('cmmn:Documentation', value);
80
+ return cmdHelper.updateSemanticParent(documentation, bo, containment, element);
81
+ }
82
+
83
+ return cmdHelper.updateProperties(documentation, value, element);
84
+ }
85
+
86
+ });
87
+
88
+ return [ entry ];
89
+
90
+ };
91
+
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ var entryFactory = require('../../../../factory/EntryFactory'),
4
+ isIdValid = require('../../../../Utils').isIdValid,
5
+ getBusinessObject = require('cmmn-js/lib/util/ModelUtil').getBusinessObject;
6
+
7
+ module.exports = function(element, translate, options) {
8
+
9
+ options = options || {};
10
+
11
+ var id = options.id,
12
+ reference = options.reference,
13
+ label = options.label;
14
+
15
+ // Id
16
+ var idEntry = entryFactory.validationAwareTextField({
17
+
18
+ id: id || 'id',
19
+ label: label || translate('Id'),
20
+ modelProperty: 'id',
21
+ reference: reference,
22
+
23
+ get: options.get,
24
+
25
+ set: options.set,
26
+
27
+ validate: function(element, values) {
28
+ var idValue = values.id,
29
+ bo = getBusinessObject(element);
30
+
31
+ bo = (reference && reference === '$parent') ? bo.$parent : bo.get(reference) || bo;
32
+
33
+ var idError = isIdValid(bo, idValue, translate);
34
+
35
+ return idError ? { id: idError } : {};
36
+ }
37
+
38
+ });
39
+
40
+ return [ idEntry ];
41
+
42
+ };