@processmaker/modeler 1.18.6 → 1.19.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.
- package/dist/modeler.common.js +280 -76
- package/dist/modeler.common.js.map +1 -1
- package/dist/modeler.umd.js +280 -76
- package/dist/modeler.umd.js.map +1 -1
- package/dist/modeler.umd.min.js +2 -2
- package/dist/modeler.umd.min.js.map +1 -1
- package/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/components/crown/utils.js +122 -0
- package/src/components/nodes/dataInputAssociation/dataInputAssociation.vue +4 -1
- package/src/components/nodes/subProcess/SubProcessFormSelect.vue +48 -5
- package/src/setup/globals.js +6 -1
package/package-lock.json
CHANGED
package/package.json
CHANGED
|
@@ -99,3 +99,125 @@ export function removeSourceDefault(node) {
|
|
|
99
99
|
node.definition.sourceRef.set('default', null);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
+
|
|
103
|
+
export function getOrFindDataInput(moddle, task, sourceNode) {
|
|
104
|
+
if (sourceNode.$type !== 'bpmn:DataObjectReference' && sourceNode.$type !== 'bpmn:DataStoreReference') {
|
|
105
|
+
throw 'Source node must be a DataObjectReference or bpmn:DataStoreReference, got ' + sourceNode.$type;
|
|
106
|
+
}
|
|
107
|
+
const sourceNodeId = sourceNode.id;
|
|
108
|
+
const dataInputId = `data_input_${sourceNodeId}`;
|
|
109
|
+
// Check if ioSpecification exists
|
|
110
|
+
if (!task.definition.ioSpecification) {
|
|
111
|
+
task.definition.set('ioSpecification', moddle.create('bpmn:InputOutputSpecification', {
|
|
112
|
+
dataInputs: [],
|
|
113
|
+
dataOutputs: [],
|
|
114
|
+
inputSets: [],
|
|
115
|
+
outputSets: [],
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
// Check if dataInput exists
|
|
119
|
+
if (!task.definition.ioSpecification.dataInputs) {
|
|
120
|
+
task.definition.ioSpecification.set('dataInputs', []);
|
|
121
|
+
}
|
|
122
|
+
let dataInput = task.definition.ioSpecification.dataInputs.find(input => input.id === dataInputId);
|
|
123
|
+
if (!dataInput) {
|
|
124
|
+
task.definition.ioSpecification.dataInputs.push(moddle.create('bpmn:DataInput', {
|
|
125
|
+
id: dataInputId,
|
|
126
|
+
isCollection: 'false',
|
|
127
|
+
name: sourceNode.name,
|
|
128
|
+
}));
|
|
129
|
+
task.definition.ioSpecification.set('dataInputs', task.definition.ioSpecification.dataInputs);
|
|
130
|
+
}
|
|
131
|
+
dataInput = task.definition.ioSpecification.dataInputs.find(input => input.id === dataInputId);
|
|
132
|
+
// Check if outputSet exists
|
|
133
|
+
if (!task.definition.ioSpecification.outputSets) {
|
|
134
|
+
task.definition.ioSpecification.set('outputSets', [
|
|
135
|
+
moddle.create('bpmn:OutputSet', {
|
|
136
|
+
dataInputRefs: [],
|
|
137
|
+
}),
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
let outputSet = task.definition.ioSpecification.outputSets[0];
|
|
141
|
+
if (!outputSet) {
|
|
142
|
+
task.definition.ioSpecification.set('outputSets', [
|
|
143
|
+
moddle.create('bpmn:OutputSet', {
|
|
144
|
+
dataInputRefs: [],
|
|
145
|
+
}),
|
|
146
|
+
]);
|
|
147
|
+
}
|
|
148
|
+
outputSet = task.definition.ioSpecification.outputSets[0];
|
|
149
|
+
// Check if inputSet exists
|
|
150
|
+
if (!task.definition.ioSpecification.inputSets) {
|
|
151
|
+
task.definition.ioSpecification.set('inputSets', [
|
|
152
|
+
moddle.create('bpmn:InputSet', {
|
|
153
|
+
dataInputRefs: [],
|
|
154
|
+
}),
|
|
155
|
+
]);
|
|
156
|
+
}
|
|
157
|
+
let inputSet = task.definition.ioSpecification.inputSets[0];
|
|
158
|
+
if (!inputSet) {
|
|
159
|
+
task.definition.ioSpecification.set('inputSets', [
|
|
160
|
+
moddle.create('bpmn:InputSet', {
|
|
161
|
+
dataInputRefs: [],
|
|
162
|
+
}),
|
|
163
|
+
]);
|
|
164
|
+
}
|
|
165
|
+
inputSet = task.definition.ioSpecification.inputSets[0];
|
|
166
|
+
// Check if dataInputRef exists
|
|
167
|
+
const dataInputRef = inputSet.dataInputRefs.find(ref => ref.id === dataInputId);
|
|
168
|
+
if (!dataInputRef) {
|
|
169
|
+
inputSet.dataInputRefs.push(dataInput);
|
|
170
|
+
}
|
|
171
|
+
return dataInput;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
export function removeDataInput(task, sourceNode) {
|
|
176
|
+
if (sourceNode.$type !== 'bpmn:DataObjectReference' && sourceNode.$type !== 'bpmn:DataStoreReference') {
|
|
177
|
+
throw 'Source node must be a DataObjectReference or bpmn:DataStoreReference, got ' + sourceNode.$type;
|
|
178
|
+
}
|
|
179
|
+
const sourceNodeId = sourceNode.id;
|
|
180
|
+
const dataInputId = `data_input_${sourceNodeId}`;
|
|
181
|
+
// Check if ioSpecification exists
|
|
182
|
+
if (!task.definition.ioSpecification) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
// Check if dataInput exists
|
|
186
|
+
if (!task.definition.ioSpecification.dataInputs) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
let dataInput = task.definition.ioSpecification.dataInputs.find(input => input.id === dataInputId);
|
|
190
|
+
if (!dataInput) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
// remove dataInput from dataInputs
|
|
194
|
+
pull(task.definition.ioSpecification.dataInputs, dataInput);
|
|
195
|
+
// Check if inputSet exists
|
|
196
|
+
if (!task.definition.ioSpecification.inputSets) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
let inputSet = task.definition.ioSpecification.inputSets[0];
|
|
200
|
+
if (!inputSet) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
// Check if dataInputRef exists
|
|
204
|
+
const dataInputRef = inputSet.dataInputRefs.find(ref => ref.id === dataInputId);
|
|
205
|
+
if (dataInputRef) {
|
|
206
|
+
pull(inputSet.dataInputRefs, dataInputRef);
|
|
207
|
+
}
|
|
208
|
+
// Remove inputSets if it is empty (without any dataInputRefs)
|
|
209
|
+
if (inputSet.dataInputRefs.length === 0) {
|
|
210
|
+
delete task.definition.ioSpecification.inputSets;
|
|
211
|
+
}
|
|
212
|
+
// Remove outputSets if it is empty (without any dataOutputRefs)
|
|
213
|
+
if (task.definition.ioSpecification.outputSets) {
|
|
214
|
+
let outputSet = task.definition.ioSpecification.outputSets[0];
|
|
215
|
+
if (outputSet && (!outputSet.dataOutputRefs || outputSet.dataOutputRefs.length === 0)) {
|
|
216
|
+
delete task.definition.ioSpecification.outputSets;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// Remove ioSpecification if it is empty (without outputSets and inputSets)
|
|
220
|
+
if (!task.definition.ioSpecification.inputSets && !task.definition.ioSpecification.outputSets) {
|
|
221
|
+
delete task.definition.ioSpecification;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -21,6 +21,7 @@ import linkConfig from '@/mixins/linkConfig';
|
|
|
21
21
|
import get from 'lodash/get';
|
|
22
22
|
import associationHead from '!!url-loader!@/assets/association-head.svg';
|
|
23
23
|
import CrownConfig from '@/components/crown/crownConfig/crownConfig';
|
|
24
|
+
import { getOrFindDataInput, removeDataInput } from '@/components/crown/utils';
|
|
24
25
|
import { pull } from 'lodash';
|
|
25
26
|
|
|
26
27
|
export default {
|
|
@@ -99,8 +100,9 @@ export default {
|
|
|
99
100
|
},
|
|
100
101
|
updateDefinitionLinks() {
|
|
101
102
|
const targetShape = this.shape.getTargetElement();
|
|
103
|
+
const dataInput = getOrFindDataInput(this.moddle, targetShape.component.node, this.sourceNode.definition);
|
|
104
|
+
this.node.definition.set('targetRef', dataInput);
|
|
102
105
|
this.node.definition.set('sourceRef', [this.sourceNode.definition]);
|
|
103
|
-
this.node.definition.set('targetRef', null);
|
|
104
106
|
targetShape.component.node.definition.set('dataInputAssociations', [this.node.definition]);
|
|
105
107
|
},
|
|
106
108
|
},
|
|
@@ -127,6 +129,7 @@ export default {
|
|
|
127
129
|
this.shape.component = this;
|
|
128
130
|
},
|
|
129
131
|
destroyed() {
|
|
132
|
+
removeDataInput(this.targetNode, this.sourceNode.definition);
|
|
130
133
|
pull(this.targetNode.definition.get('dataInputAssociations'), this.node.definition);
|
|
131
134
|
},
|
|
132
135
|
};
|
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
optionContent="name"
|
|
13
13
|
class="p-0 mb-2"
|
|
14
14
|
validation="required"
|
|
15
|
-
@
|
|
15
|
+
@search-change="searchChange"
|
|
16
|
+
:searchable="true"
|
|
17
|
+
:internal-search="false"
|
|
18
|
+
:preserve-search="true"
|
|
19
|
+
:clear-on-select="false"
|
|
16
20
|
/>
|
|
17
21
|
|
|
18
22
|
<form-multi-select
|
|
@@ -41,7 +45,6 @@
|
|
|
41
45
|
</template>
|
|
42
46
|
|
|
43
47
|
<script>
|
|
44
|
-
import store from '@/store';
|
|
45
48
|
import uniqBy from 'lodash/uniqBy';
|
|
46
49
|
|
|
47
50
|
export default {
|
|
@@ -52,13 +55,19 @@ export default {
|
|
|
52
55
|
config: {},
|
|
53
56
|
name: '',
|
|
54
57
|
loading: false ,
|
|
58
|
+
processes: [],
|
|
59
|
+
selectedProcessInfo: null,
|
|
55
60
|
};
|
|
56
61
|
},
|
|
57
62
|
inheritAttrs: false,
|
|
58
63
|
props: ['value'],
|
|
59
64
|
computed: {
|
|
60
65
|
processList() {
|
|
61
|
-
|
|
66
|
+
const list = this.filterValidProcesses(this.processes) || [];
|
|
67
|
+
if (this.selectedProcessInfo && !list.find(p => p.id === this.selectedProcessInfo.id)) {
|
|
68
|
+
list.push(this.selectedProcessInfo);
|
|
69
|
+
}
|
|
70
|
+
return list;
|
|
62
71
|
},
|
|
63
72
|
startEventList() {
|
|
64
73
|
if (!this.selectedProcess) { return []; }
|
|
@@ -84,11 +93,15 @@ export default {
|
|
|
84
93
|
value: {
|
|
85
94
|
handler() {
|
|
86
95
|
this.config = JSON.parse(this.value);
|
|
96
|
+
this.loadSelectedProcessInfo();
|
|
87
97
|
},
|
|
88
98
|
immediate: true,
|
|
89
99
|
},
|
|
90
100
|
},
|
|
91
101
|
methods: {
|
|
102
|
+
searchChange(filter) {
|
|
103
|
+
this.loadProcesses(filter);
|
|
104
|
+
},
|
|
92
105
|
filterValidProcesses(processes) {
|
|
93
106
|
return processes.filter(process => {
|
|
94
107
|
return process.category.is_system == false
|
|
@@ -151,8 +164,38 @@ export default {
|
|
|
151
164
|
containsMultipleProcesses(process) {
|
|
152
165
|
return uniqBy(process.events, 'ownerProcessId').length > 1;
|
|
153
166
|
},
|
|
154
|
-
loadProcesses() {
|
|
155
|
-
|
|
167
|
+
loadProcesses(filter) {
|
|
168
|
+
this.loading = true;
|
|
169
|
+
|
|
170
|
+
const params = {
|
|
171
|
+
order_direction: 'asc',
|
|
172
|
+
per_page: 20,
|
|
173
|
+
status: 'all',
|
|
174
|
+
include: 'events,category',
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
if (filter) {
|
|
178
|
+
params.filter = filter;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
window.ProcessMaker.apiClient.get('processes', {
|
|
182
|
+
params,
|
|
183
|
+
}).then(response => {
|
|
184
|
+
this.loading = false;
|
|
185
|
+
this.processes = response.data.data;
|
|
186
|
+
})
|
|
187
|
+
.catch(() => {
|
|
188
|
+
this.loading = false;
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
loadSelectedProcessInfo() {
|
|
192
|
+
if (this.config.processId) {
|
|
193
|
+
window.ProcessMaker.apiClient.get('processes/' + this.config.processId, { params: {
|
|
194
|
+
include: 'events,category',
|
|
195
|
+
} }).then(response => {
|
|
196
|
+
this.selectedProcessInfo = response.data;
|
|
197
|
+
});
|
|
198
|
+
}
|
|
156
199
|
},
|
|
157
200
|
},
|
|
158
201
|
created() {
|
package/src/setup/globals.js
CHANGED
|
@@ -19,8 +19,13 @@ mock.onGet(/\/processes\/\d+/).reply((config) => {
|
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
const regex = /processes\/(\d+)/g;
|
|
23
|
+
const matches = regex.exec(config.url);
|
|
24
|
+
const requestedId = matches[1];
|
|
25
|
+
const process = mockProcesses.data.find(p => p.id === parseInt(requestedId));
|
|
26
|
+
|
|
22
27
|
return new Promise((resolve) => {
|
|
23
|
-
setTimeout(() => resolve([200, { svg: mockProcessSvg }]), 1000);
|
|
28
|
+
setTimeout(() => resolve([200, { svg: mockProcessSvg, ...process }]), 1000);
|
|
24
29
|
});
|
|
25
30
|
});
|
|
26
31
|
|