cmmn-js-properties-panel-flowable 2.0.0-next.3 → 2.0.0-next.4
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.
|
@@ -24,12 +24,15 @@ var ifPartProps = require('../cmmn/parts/IfPartProps'),
|
|
|
24
24
|
taskProps = require('./parts/TaskProps'),
|
|
25
25
|
eventListenerProps = require('./parts/EventListenerProps'),
|
|
26
26
|
eventRegistryProps = require('./parts/EventRegistryProps'),
|
|
27
|
+
stageOverviewProps = require('./parts/StageOverviewProps'),
|
|
28
|
+
criterionProps = require('./parts/CriterionProps'),
|
|
27
29
|
onPartProps = require('../cmmn/parts/OnPartProps'),
|
|
28
30
|
variableMapping = require('./parts/VariableMappingProps');
|
|
29
31
|
|
|
30
32
|
// plan item control properties
|
|
31
33
|
var planItemControlProps = require('../cmmn/parts/PlanItemControlProps'),
|
|
32
34
|
repeatOnStandardEventProps = require('./parts/RepeatOnStandardEventProps'),
|
|
35
|
+
repetitionRuleProps = require('./parts/RepetitionRuleProps'),
|
|
33
36
|
itemControlRuleProps = require('./parts/ItemControlRuleProps');
|
|
34
37
|
|
|
35
38
|
// definition props
|
|
@@ -97,11 +100,13 @@ function createGeneralTabGroups(element, cmmnFactory, elementRegistry, itemRegis
|
|
|
97
100
|
|
|
98
101
|
onPartProps(detailsGroup, element, cmmnFactory, elementRegistry, itemRegistry, translate);
|
|
99
102
|
ifPartProps(detailsGroup, element, cmmnFactory, elementRegistry, itemRegistry, translate);
|
|
103
|
+
criterionProps(detailsGroup, element, translate);
|
|
100
104
|
humanTaskProps(detailsGroup, element, cmmnFactory, elementRegistry, itemRegistry, translate);
|
|
101
105
|
callableProps(detailsGroup, element, cmmnFactory, elementRegistry, itemRegistry, translate);
|
|
102
106
|
callableExtensionProps(detailsGroup, element, cmmnFactory, elementRegistry, itemRegistry, translate);
|
|
103
107
|
taskProps.detailProps(detailsGroup, element, cmmnFactory, translate);
|
|
104
108
|
eventListenerProps.eventListenerProps(detailsGroup, element, translate);
|
|
109
|
+
stageOverviewProps(detailsGroup, element, translate);
|
|
105
110
|
|
|
106
111
|
|
|
107
112
|
var implementationGroup = {
|
|
@@ -161,6 +166,7 @@ function createRulesTabGroups(element, cmmnFactory, elementRegistry, itemRegistr
|
|
|
161
166
|
|
|
162
167
|
planItemControlProps(itemControlGroup, element, cmmnFactory, elementRegistry, itemRegistry, cmmnRules, translate);
|
|
163
168
|
repeatOnStandardEventProps(itemControlGroup, element, cmmnFactory, elementRegistry, itemRegistry, cmmnRules, translate);
|
|
169
|
+
repetitionRuleProps(itemControlGroup, element, itemRegistry, translate);
|
|
164
170
|
itemControlRuleProps.planItemControlRuleProps(itemControlGroup, element, cmmnFactory, translate);
|
|
165
171
|
|
|
166
172
|
|
|
@@ -176,6 +182,9 @@ function createRulesTabGroups(element, cmmnFactory, elementRegistry, itemRegistr
|
|
|
176
182
|
repeatOnStandardEventProps(defaultControlGroup, element, cmmnFactory, elementRegistry, itemRegistry, cmmnRules, translate, {
|
|
177
183
|
isDefaultControl: true
|
|
178
184
|
});
|
|
185
|
+
repetitionRuleProps(defaultControlGroup, element, itemRegistry, translate, {
|
|
186
|
+
isDefaultControl: true
|
|
187
|
+
});
|
|
179
188
|
itemControlRuleProps.planItemControlRuleProps(defaultControlGroup, element, cmmnFactory, translate, {
|
|
180
189
|
isDefaultControl: true
|
|
181
190
|
});
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var entryFactory = require('../../../factory/EntryFactory'),
|
|
4
|
+
cmdHelper = require('../../../helper/CmdHelper');
|
|
5
|
+
|
|
6
|
+
var ModelUtil = require('@jylups/cmmn-js/lib/util/ModelUtil'),
|
|
7
|
+
is = ModelUtil.is,
|
|
8
|
+
isCasePlanModel = ModelUtil.isCasePlanModel,
|
|
9
|
+
getBusinessObject = ModelUtil.getBusinessObject;
|
|
10
|
+
|
|
11
|
+
var CmmnElementHelper = require('../../../helper/CmmnElementHelper'),
|
|
12
|
+
isCriterion = CmmnElementHelper.isCriterion,
|
|
13
|
+
isStage = CmmnElementHelper.isStage;
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
function getSentry(element) {
|
|
17
|
+
var criterion = getBusinessObject(element);
|
|
18
|
+
|
|
19
|
+
return criterion && criterion.get('sentryRef');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Whether the exit criterion is on a stage or the case plan model.
|
|
24
|
+
*/
|
|
25
|
+
function isOnStage(element) {
|
|
26
|
+
return !!element.host && isStage(element.host);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function isOnCasePlanModel(element) {
|
|
30
|
+
return !!element.host && isCasePlanModel(element.host);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function selectBox(id, label, description, options, getTarget, property, translate, hideEntry) {
|
|
34
|
+
|
|
35
|
+
return entryFactory.selectBox({
|
|
36
|
+
id: id,
|
|
37
|
+
label: translate(label),
|
|
38
|
+
description: translate(description),
|
|
39
|
+
modelProperty: id,
|
|
40
|
+
selectOptions: options.map(function(option) {
|
|
41
|
+
return { name: option.name && translate(option.name), value: option.value };
|
|
42
|
+
}),
|
|
43
|
+
|
|
44
|
+
get: function(element) {
|
|
45
|
+
var target = getTarget(element),
|
|
46
|
+
values = {};
|
|
47
|
+
|
|
48
|
+
values[id] = (target && target.get(property)) || '';
|
|
49
|
+
|
|
50
|
+
return values;
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
set: function(element, values) {
|
|
54
|
+
var properties = {};
|
|
55
|
+
|
|
56
|
+
properties[property] = values[id] || undefined;
|
|
57
|
+
|
|
58
|
+
return cmdHelper.updateProperties(getTarget(element), properties, element);
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
hideEntry: hideEntry
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* What Flowable reads on the sentry of a criterion (the trigger mode) and
|
|
68
|
+
* on an exit criterion (what it does, and which instances it exits).
|
|
69
|
+
*/
|
|
70
|
+
module.exports = function(group, element, translate) {
|
|
71
|
+
|
|
72
|
+
if (!isCriterion(element)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
group.entries.push(selectBox(
|
|
77
|
+
'sentry-triggerMode',
|
|
78
|
+
'Trigger Mode',
|
|
79
|
+
'On event: the on parts must happen together, not remembered from earlier events',
|
|
80
|
+
[
|
|
81
|
+
{ name: '', value: '' },
|
|
82
|
+
{ name: 'Default', value: 'default' },
|
|
83
|
+
{ name: 'On Event', value: 'onEvent' }
|
|
84
|
+
],
|
|
85
|
+
getSentry,
|
|
86
|
+
'flowable:triggerMode',
|
|
87
|
+
translate,
|
|
88
|
+
function(element) {
|
|
89
|
+
return !getSentry(element);
|
|
90
|
+
}
|
|
91
|
+
));
|
|
92
|
+
|
|
93
|
+
if (!is(getBusinessObject(element), 'cmmn:ExitCriterion')) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// what a stage or the case plan model does when it exits
|
|
98
|
+
if (isOnStage(element)) {
|
|
99
|
+
group.entries.push(selectBox(
|
|
100
|
+
'exitCriterion-exitEventType',
|
|
101
|
+
'Exit Event Type',
|
|
102
|
+
'Exit when empty; complete or force complete the stage instead',
|
|
103
|
+
[
|
|
104
|
+
{ name: '', value: '' },
|
|
105
|
+
{ name: 'Exit', value: 'exit' },
|
|
106
|
+
{ name: 'Complete', value: 'complete' },
|
|
107
|
+
{ name: 'Force Complete', value: 'forceComplete' }
|
|
108
|
+
],
|
|
109
|
+
getBusinessObject,
|
|
110
|
+
'flowable:exitEventType',
|
|
111
|
+
translate
|
|
112
|
+
));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// which instances of a plan item exit
|
|
116
|
+
if (isOnCasePlanModel(element)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
group.entries.push(selectBox(
|
|
121
|
+
'exitCriterion-exitType',
|
|
122
|
+
'Exit Type',
|
|
123
|
+
'Which instances of the plan item exit; all when empty',
|
|
124
|
+
[
|
|
125
|
+
{ name: '', value: '' },
|
|
126
|
+
{ name: 'Default', value: 'default' },
|
|
127
|
+
{ name: 'Active Instances', value: 'activeInstances' },
|
|
128
|
+
{ name: 'Active And Enabled Instances', value: 'activeAndEnabledInstances' }
|
|
129
|
+
],
|
|
130
|
+
getBusinessObject,
|
|
131
|
+
'flowable:exitType',
|
|
132
|
+
translate
|
|
133
|
+
));
|
|
134
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var entryFactory = require('../../../factory/EntryFactory'),
|
|
4
|
+
cmdHelper = require('../../../helper/CmdHelper');
|
|
5
|
+
|
|
6
|
+
var ModelUtil = require('@jylups/cmmn-js/lib/util/ModelUtil'),
|
|
7
|
+
getBusinessObject = ModelUtil.getBusinessObject,
|
|
8
|
+
isCasePlanModel = ModelUtil.isCasePlanModel,
|
|
9
|
+
getDefinition = ModelUtil.getDefinition;
|
|
10
|
+
|
|
11
|
+
var CmmnElementHelper = require('../../../helper/CmmnElementHelper'),
|
|
12
|
+
isTask = CmmnElementHelper.isTask,
|
|
13
|
+
isStage = CmmnElementHelper.isStage,
|
|
14
|
+
isMilestone = CmmnElementHelper.isMilestone;
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var MAX_INSTANCE_COUNT = /^(unlimited|-1|[1-9]\d*)$/;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* What Flowable reads on the repetition rule of the item control or the
|
|
22
|
+
* default control: the counter variable, the maximum instance count, and
|
|
23
|
+
* the collection to repeat the plan item for each element of.
|
|
24
|
+
*/
|
|
25
|
+
module.exports = function(group, element, itemRegistry, translate, options) {
|
|
26
|
+
|
|
27
|
+
if (isCasePlanModel(element) || (!isTask(element) && !isStage(element) && !isMilestone(element))) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
options = options || {};
|
|
32
|
+
|
|
33
|
+
var isDefaultControl = options.isDefaultControl,
|
|
34
|
+
idPrefix = (isDefaultControl ? 'default' : 'item') + 'Control-repetition-';
|
|
35
|
+
|
|
36
|
+
function getRepetitionRule(element) {
|
|
37
|
+
var bo = isDefaultControl ? getDefinition(element) : getBusinessObject(element),
|
|
38
|
+
control = bo && bo.get(isDefaultControl ? 'defaultControl' : 'itemControl');
|
|
39
|
+
|
|
40
|
+
return control && control.get('repetitionRule');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function update(element, properties) {
|
|
44
|
+
var bo = getBusinessObject(element);
|
|
45
|
+
|
|
46
|
+
return cmdHelper.updateProperties(getRepetitionRule(element), properties, itemRegistry.getShapes(bo));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function hideEntry(element) {
|
|
50
|
+
return !getRepetitionRule(element);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function textField(name, label, description, validate) {
|
|
54
|
+
var id = idPrefix + name;
|
|
55
|
+
|
|
56
|
+
return entryFactory.textField({
|
|
57
|
+
id: id,
|
|
58
|
+
label: translate(label),
|
|
59
|
+
description: description && translate(description),
|
|
60
|
+
modelProperty: name,
|
|
61
|
+
|
|
62
|
+
get: function(element) {
|
|
63
|
+
var rule = getRepetitionRule(element),
|
|
64
|
+
values = {};
|
|
65
|
+
|
|
66
|
+
values[name] = (rule && rule.get('flowable:' + name)) || '';
|
|
67
|
+
|
|
68
|
+
return values;
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
set: function(element, values) {
|
|
72
|
+
var properties = {};
|
|
73
|
+
|
|
74
|
+
properties['flowable:' + name] = values[name] || undefined;
|
|
75
|
+
|
|
76
|
+
return update(element, properties);
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
validate: validate,
|
|
80
|
+
hideEntry: hideEntry
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
group.entries.push(textField('counterVariable', 'Counter Variable',
|
|
86
|
+
'Local variable with the number of the instance; repetitionCounter when empty'));
|
|
87
|
+
|
|
88
|
+
group.entries.push(entryFactory.checkbox({
|
|
89
|
+
id: idPrefix + 'ignoreCounterVariable',
|
|
90
|
+
label: translate('Ignore Counter Variable'),
|
|
91
|
+
modelProperty: 'ignoreCounterVariable',
|
|
92
|
+
|
|
93
|
+
get: function(element) {
|
|
94
|
+
var rule = getRepetitionRule(element),
|
|
95
|
+
value = rule && rule.get('flowable:ignoreCounterVariable');
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
ignoreCounterVariable: !!value && value.toLowerCase() === 'true'
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
set: function(element, values) {
|
|
103
|
+
return update(element, {
|
|
104
|
+
'flowable:ignoreCounterVariable': values.ignoreCounterVariable ? 'true' : undefined
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
hideEntry: hideEntry
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
group.entries.push(textField('maxInstanceCount', 'Max Instance Count',
|
|
112
|
+
'Instances at the same time, a number or unlimited',
|
|
113
|
+
function(element, values) {
|
|
114
|
+
var value = values.maxInstanceCount;
|
|
115
|
+
|
|
116
|
+
if (value && !MAX_INSTANCE_COUNT.test(value.trim())) {
|
|
117
|
+
return { maxInstanceCount: translate('Must be a number above 0, or unlimited') };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return {};
|
|
121
|
+
}));
|
|
122
|
+
|
|
123
|
+
group.entries.push(textField('collectionVariable', 'Collection Variable',
|
|
124
|
+
'Collection, or an expression giving one; an instance is created for each element'));
|
|
125
|
+
|
|
126
|
+
group.entries.push(textField('elementVariable', 'Element Variable',
|
|
127
|
+
'Local variable with the element of the instance'));
|
|
128
|
+
|
|
129
|
+
group.entries.push(textField('elementIndexVariable', 'Element Index Variable',
|
|
130
|
+
'Local variable with the index of the element'));
|
|
131
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var entryFactory = require('../../../factory/EntryFactory'),
|
|
4
|
+
cmdHelper = require('../../../helper/CmdHelper');
|
|
5
|
+
|
|
6
|
+
var ModelUtil = require('@jylups/cmmn-js/lib/util/ModelUtil'),
|
|
7
|
+
is = ModelUtil.is,
|
|
8
|
+
isCasePlanModel = ModelUtil.isCasePlanModel,
|
|
9
|
+
getDefinition = ModelUtil.getDefinition;
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var INTEGER = /^-?\d+$/;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
function textField(id, label, property, translate, options) {
|
|
16
|
+
|
|
17
|
+
options = options || {};
|
|
18
|
+
|
|
19
|
+
return entryFactory.textField({
|
|
20
|
+
id: id,
|
|
21
|
+
label: translate(label),
|
|
22
|
+
description: options.description && translate(options.description),
|
|
23
|
+
modelProperty: id,
|
|
24
|
+
|
|
25
|
+
get: function(element) {
|
|
26
|
+
var definition = getDefinition(element),
|
|
27
|
+
values = {};
|
|
28
|
+
|
|
29
|
+
values[id] = (definition && definition.get(property)) || '';
|
|
30
|
+
|
|
31
|
+
return values;
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
set: function(element, values) {
|
|
35
|
+
var properties = {};
|
|
36
|
+
|
|
37
|
+
properties[property] = values[id] || undefined;
|
|
38
|
+
|
|
39
|
+
return cmdHelper.updateProperties(getDefinition(element), properties, element);
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
validate: options.validate
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* What Flowable reads on stages and milestones: whether and where they are
|
|
49
|
+
* shown in the stage overview, the business status they set, the milestone
|
|
50
|
+
* variable, and the auto complete condition of a stage.
|
|
51
|
+
*/
|
|
52
|
+
module.exports = function(group, element, translate) {
|
|
53
|
+
|
|
54
|
+
var definition = getDefinition(element);
|
|
55
|
+
|
|
56
|
+
var isStage = is(definition, 'cmmn:Stage'),
|
|
57
|
+
isMilestone = is(definition, 'cmmn:Milestone');
|
|
58
|
+
|
|
59
|
+
if (!isStage && !isMilestone) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// the case plan model is not shown in the stage overview
|
|
64
|
+
if (!isCasePlanModel(element)) {
|
|
65
|
+
|
|
66
|
+
group.entries.push(textField(
|
|
67
|
+
'stageOverview-includeInStageOverview',
|
|
68
|
+
'Include In Stage Overview',
|
|
69
|
+
'flowable:includeInStageOverview',
|
|
70
|
+
translate,
|
|
71
|
+
{ description: 'Included when empty; false, or an expression' }
|
|
72
|
+
));
|
|
73
|
+
|
|
74
|
+
group.entries.push(textField(
|
|
75
|
+
'stageOverview-displayOrder',
|
|
76
|
+
'Display Order',
|
|
77
|
+
'flowable:displayOrder',
|
|
78
|
+
translate,
|
|
79
|
+
{
|
|
80
|
+
description: 'Order in the stage overview, a number',
|
|
81
|
+
validate: function(element, values) {
|
|
82
|
+
var value = values['stageOverview-displayOrder'];
|
|
83
|
+
|
|
84
|
+
if (value && !INTEGER.test(value.trim())) {
|
|
85
|
+
return { 'stageOverview-displayOrder': translate('Must be a whole number') };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return {};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
));
|
|
92
|
+
|
|
93
|
+
group.entries.push(textField(
|
|
94
|
+
'stageOverview-businessStatus',
|
|
95
|
+
'Business Status',
|
|
96
|
+
'flowable:businessStatus',
|
|
97
|
+
translate,
|
|
98
|
+
{
|
|
99
|
+
description: isStage ?
|
|
100
|
+
'Set on the case when the stage starts' :
|
|
101
|
+
'Set on the case when the milestone is reached'
|
|
102
|
+
}
|
|
103
|
+
));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (isMilestone) {
|
|
107
|
+
group.entries.push(textField(
|
|
108
|
+
'milestone-milestoneVariable',
|
|
109
|
+
'Milestone Variable',
|
|
110
|
+
'flowable:milestoneVariable',
|
|
111
|
+
translate,
|
|
112
|
+
{ description: 'Set to true when the milestone is reached' }
|
|
113
|
+
));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (isStage) {
|
|
117
|
+
group.entries.push(textField(
|
|
118
|
+
'stage-autoCompleteCondition',
|
|
119
|
+
'Auto Complete Condition',
|
|
120
|
+
'flowable:autoCompleteCondition',
|
|
121
|
+
translate,
|
|
122
|
+
{ description: 'While it holds, the stage completes once no plan item is active' }
|
|
123
|
+
));
|
|
124
|
+
}
|
|
125
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cmmn-js-properties-panel-flowable",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.4",
|
|
4
4
|
"description": "A simple properties panel for cmmn-js with flowable namespaces",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "eslint .",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"diagram-js": "^15.29.0",
|
|
34
34
|
"eslint": "^5.2.0",
|
|
35
35
|
"eslint-plugin-bpmn-io": "^0.5.3",
|
|
36
|
-
"flowable-cmmn-moddle": "^1.2.0-next.
|
|
36
|
+
"flowable-cmmn-moddle": "^1.2.0-next.9",
|
|
37
37
|
"karma": "^4.1.0",
|
|
38
38
|
"karma-chrome-launcher": "^2.2.0",
|
|
39
39
|
"karma-firefox-launcher": "^1.0.1",
|