@processmaker/screen-builder 2.22.0 → 2.23.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/vue-form-builder.common.js +3975 -2634
- package/dist/vue-form-builder.common.js.map +1 -1
- package/dist/vue-form-builder.umd.js +3975 -2634
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/dist/vue-form-builder.umd.min.js +18 -18
- package/dist/vue-form-builder.umd.min.js.map +1 -1
- package/package-lock.json +4 -4
- package/package.json +3 -3
- package/src/ValidationsFactory.js +45 -9
- package/src/components/renderer/form-record-list.vue +33 -6
- package/src/components/task.vue +25 -9
- package/src/main.js +11 -1
package/package-lock.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@processmaker/screen-builder",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"lockfileVersion": 1,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"dependencies": {
|
|
@@ -1738,9 +1738,9 @@
|
|
|
1738
1738
|
}
|
|
1739
1739
|
},
|
|
1740
1740
|
"@processmaker/vue-form-elements": {
|
|
1741
|
-
"version": "0.28.
|
|
1742
|
-
"resolved": "https://registry.npmjs.org/@processmaker/vue-form-elements/-/vue-form-elements-0.28.
|
|
1743
|
-
"integrity": "sha512-
|
|
1741
|
+
"version": "0.28.6",
|
|
1742
|
+
"resolved": "https://registry.npmjs.org/@processmaker/vue-form-elements/-/vue-form-elements-0.28.6.tgz",
|
|
1743
|
+
"integrity": "sha512-uxHsOkCNLJEF4mJu7dK4+qn2SL/mWDswdoV1kQjNjQkwBk10uGXDdAbtliHRbld3HDMAPUQAu69c+1fS8pDqjA==",
|
|
1744
1744
|
"dev": true,
|
|
1745
1745
|
"requires": {
|
|
1746
1746
|
"@tinymce/tinymce-vue": "2.0.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@processmaker/screen-builder",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"serve": "vue-cli-service serve",
|
|
6
6
|
"build": "vue-cli-service build",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@cypress/code-coverage": "^3.8.1",
|
|
45
45
|
"@fortawesome/fontawesome-free": "^5.6.1",
|
|
46
46
|
"@panter/vue-i18next": "^0.15.2",
|
|
47
|
-
"@processmaker/vue-form-elements": "0.28.
|
|
47
|
+
"@processmaker/vue-form-elements": "0.28.6",
|
|
48
48
|
"@processmaker/vue-multiselect": "^2.2.0",
|
|
49
49
|
"@vue/cli-plugin-babel": "^3.6.0",
|
|
50
50
|
"@vue/cli-plugin-e2e-cypress": "^4.0.3",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@panter/vue-i18next": "^0.15.0",
|
|
88
|
-
"@processmaker/vue-form-elements": "0.28.
|
|
88
|
+
"@processmaker/vue-form-elements": "0.28.6",
|
|
89
89
|
"i18next": "^15.0.8",
|
|
90
90
|
"vue": "^2.6.12",
|
|
91
91
|
"vuex": "^3.1.1"
|
|
@@ -34,7 +34,7 @@ class Validations {
|
|
|
34
34
|
isVisible() {
|
|
35
35
|
// Disable validations if field is hidden
|
|
36
36
|
let visible = true;
|
|
37
|
-
if (this.element.config.conditionalHide) {
|
|
37
|
+
if (!this.data.noData && this.element.config.conditionalHide) {
|
|
38
38
|
try {
|
|
39
39
|
visible = !!Parser.evaluate(this.element.config.conditionalHide, this.data);
|
|
40
40
|
} catch (error) {
|
|
@@ -51,7 +51,7 @@ class Validations {
|
|
|
51
51
|
class ArrayOfFieldsValidations extends Validations {
|
|
52
52
|
async addValidations(validations) {
|
|
53
53
|
for (const item of this.element) {
|
|
54
|
-
await ValidationsFactory(item, { screen: this.screen, data: this.data }).addValidations(validations);
|
|
54
|
+
await ValidationsFactory(item, { screen: this.screen, data: this.data, parentVisibilityRule: this.parentVisibilityRule }).addValidations(validations);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -81,8 +81,9 @@ class FormNestedScreenValidations extends Validations {
|
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
const definition = await this.loadScreen(this.element.config.screen);
|
|
84
|
+
let parentVisibilityRule = this.parentVisibilityRule ? this.parentVisibilityRule : this.element.config.conditionalHide;
|
|
84
85
|
if (definition && definition[0] && definition[0].items) {
|
|
85
|
-
await ValidationsFactory(definition[0].items, { screen: this.screen, data: this.data }).addValidations(validations);
|
|
86
|
+
await ValidationsFactory(definition[0].items, { screen: this.screen, data: this.data, parentVisibilityRule }).addValidations(validations);
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
|
|
@@ -112,8 +113,7 @@ class FormLoopValidations extends Validations {
|
|
|
112
113
|
set(validations, this.element.config.name, {});
|
|
113
114
|
const loopField = get(validations, this.element.config.name);
|
|
114
115
|
loopField['$each'] = {};
|
|
115
|
-
|
|
116
|
-
await ValidationsFactory(this.element.items, { screen: this.screen, data: {_parent: this.data, ...firstRow } }).addValidations(loopField['$each']);
|
|
116
|
+
await ValidationsFactory(this.element.items, { screen: this.screen, data: {_parent: this.data, noData:true }, parentVisibilityRule: this.element.config.conditionalHide }).addValidations(loopField['$each']);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -126,7 +126,7 @@ class FormMultiColumnValidations extends Validations {
|
|
|
126
126
|
if (!this.isVisible()) {
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
|
-
await ValidationsFactory(this.element.items, { screen: this.screen, data: this.data }).addValidations(validations);
|
|
129
|
+
await ValidationsFactory(this.element.items, { screen: this.screen, data: this.data, parentVisibilityRule: this.element.config.conditionalHide }).addValidations(validations);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -168,7 +168,7 @@ class FormElementValidations extends Validations {
|
|
|
168
168
|
const fieldName = this.element.config.name;
|
|
169
169
|
const validationConfig = this.element.config.validation;
|
|
170
170
|
const conditionalHide = this.element.config.conditionalHide;
|
|
171
|
-
|
|
171
|
+
const parentVisibilityRule = this.parentVisibilityRule;
|
|
172
172
|
|
|
173
173
|
set(validations, fieldName, get(validations, fieldName, {}));
|
|
174
174
|
const fieldValidation = get(validations, fieldName);
|
|
@@ -194,7 +194,25 @@ class FormElementValidations extends Validations {
|
|
|
194
194
|
}
|
|
195
195
|
fieldValidation[rule] = function(...props) {
|
|
196
196
|
const data = props[1];
|
|
197
|
-
|
|
197
|
+
let dataWithParent = this.addReferenceToParents(data);
|
|
198
|
+
const nestedDataWithParent = this.addReferenceToParents(this.findParent(data));
|
|
199
|
+
if (nestedDataWithParent) {
|
|
200
|
+
dataWithParent = Object.assign(nestedDataWithParent, dataWithParent);
|
|
201
|
+
}
|
|
202
|
+
// Check Parent Visibility
|
|
203
|
+
if (parentVisibilityRule) {
|
|
204
|
+
let isParentVisible = true;
|
|
205
|
+
try {
|
|
206
|
+
isParentVisible = !!Parser.evaluate(parentVisibilityRule, dataWithParent);
|
|
207
|
+
} catch (error) {
|
|
208
|
+
isParentVisible = false;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (!isParentVisible ) {
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// Check Field Visibility
|
|
198
216
|
let visible = true;
|
|
199
217
|
if (conditionalHide) {
|
|
200
218
|
try {
|
|
@@ -218,7 +236,25 @@ class FormElementValidations extends Validations {
|
|
|
218
236
|
}
|
|
219
237
|
fieldValidation[validationConfig] = function(...props) {
|
|
220
238
|
const data = props[1];
|
|
221
|
-
|
|
239
|
+
let dataWithParent = this.addReferenceToParents(data);
|
|
240
|
+
const nestedDataWithParent = this.addReferenceToParents(this.findParent(data));
|
|
241
|
+
if (nestedDataWithParent) {
|
|
242
|
+
dataWithParent = Object.assign(nestedDataWithParent, dataWithParent);
|
|
243
|
+
}
|
|
244
|
+
// Check Parent Visibility
|
|
245
|
+
if (parentVisibilityRule) {
|
|
246
|
+
let isParentVisible = true;
|
|
247
|
+
try {
|
|
248
|
+
isParentVisible = !!Parser.evaluate(parentVisibilityRule, dataWithParent);
|
|
249
|
+
} catch (error) {
|
|
250
|
+
isParentVisible = false;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (!isParentVisible) {
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
// Check Field Visibility
|
|
222
258
|
let visible = true;
|
|
223
259
|
if (conditionalHide) {
|
|
224
260
|
try {
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
:css="css"
|
|
25
25
|
:empty-text="$t('No Data Available')"
|
|
26
26
|
:current-page="currentPage"
|
|
27
|
+
@sort-changed="sortChanged"
|
|
28
|
+
@input="onInput"
|
|
27
29
|
data-cy="table"
|
|
28
30
|
>
|
|
29
31
|
<template #cell()="{index,field,item}">
|
|
@@ -163,7 +165,7 @@ const jsonOptionsActionsColumn = {
|
|
|
163
165
|
|
|
164
166
|
export default {
|
|
165
167
|
mixins: [mustacheEvaluation],
|
|
166
|
-
props: ['name', 'label', 'fields', 'value', 'editable', '_config', 'form', 'validationData', 'formConfig', 'formComputed', 'formWatchers'],
|
|
168
|
+
props: ['name', 'label', 'fields', 'value', 'editable', '_config', 'form', 'validationData', 'formConfig', 'formComputed', 'formWatchers', '_perPage'],
|
|
167
169
|
data() {
|
|
168
170
|
return {
|
|
169
171
|
editFormVersion: 0,
|
|
@@ -194,6 +196,11 @@ export default {
|
|
|
194
196
|
initFormValues: {},
|
|
195
197
|
};
|
|
196
198
|
},
|
|
199
|
+
mounted() {
|
|
200
|
+
if (this._perPage) {
|
|
201
|
+
this.perPage = this._perPage;
|
|
202
|
+
}
|
|
203
|
+
},
|
|
197
204
|
computed: {
|
|
198
205
|
popupConfig() {
|
|
199
206
|
const config = [];
|
|
@@ -242,6 +249,7 @@ export default {
|
|
|
242
249
|
from,
|
|
243
250
|
to: value.length,
|
|
244
251
|
data: value,
|
|
252
|
+
lastSortConfig: false,
|
|
245
253
|
};
|
|
246
254
|
return data;
|
|
247
255
|
},
|
|
@@ -260,7 +268,25 @@ export default {
|
|
|
260
268
|
return this.form && this.form === this.$parent.currentPage;
|
|
261
269
|
},
|
|
262
270
|
},
|
|
271
|
+
watch: {
|
|
272
|
+
'tableData.total': {
|
|
273
|
+
deep: true,
|
|
274
|
+
handler(total) {
|
|
275
|
+
let totalPages = Math.ceil(total / this.perPage);
|
|
276
|
+
this.currentPage = (this.currentPage > totalPages ? totalPages : this.currentPage);
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
},
|
|
263
280
|
methods: {
|
|
281
|
+
sortChanged(payload) {
|
|
282
|
+
this.lastSortConfig = payload;
|
|
283
|
+
this.tableData.data = _.orderBy(this.tableData.data, [payload.sortBy], [(payload.sortDesc ? 'desc' : 'asc')]);
|
|
284
|
+
},
|
|
285
|
+
onInput() {
|
|
286
|
+
if (this.lastSortConfig) {
|
|
287
|
+
this.tableData.data = _.orderBy(this.tableData.data, [this.lastSortConfig.sortBy], [(this.lastSortConfig.sortDesc ? 'desc' : 'asc')]);
|
|
288
|
+
}
|
|
289
|
+
},
|
|
264
290
|
emitShownEvent() {
|
|
265
291
|
window.ProcessMaker.EventBus.$emit('modal-shown');
|
|
266
292
|
},
|
|
@@ -344,7 +370,7 @@ export default {
|
|
|
344
370
|
showEditForm(index) {
|
|
345
371
|
let pageIndex = ((this.paginatorPage-1) * this.perPage) + index;
|
|
346
372
|
// Reset edit to be a copy of our data model item
|
|
347
|
-
this.editItem = JSON.parse(JSON.stringify(this.
|
|
373
|
+
this.editItem = JSON.parse(JSON.stringify(this.tableData.data[pageIndex]));
|
|
348
374
|
this.editIndex = pageIndex;
|
|
349
375
|
// rebuild the edit screen to avoid
|
|
350
376
|
this.editFormVersion++;
|
|
@@ -354,13 +380,13 @@ export default {
|
|
|
354
380
|
});
|
|
355
381
|
},
|
|
356
382
|
edit(event) {
|
|
357
|
-
if (this.$refs.editRenderer.$refs.renderer.$refs.component.$v.$invalid) {
|
|
383
|
+
if (this.$refs.editRenderer.$refs.renderer.$refs.component.$v.vdata.$invalid) {
|
|
358
384
|
event.preventDefault();
|
|
359
385
|
return;
|
|
360
386
|
}
|
|
361
387
|
|
|
362
388
|
// Edit the item in our model and emit change
|
|
363
|
-
let data = this.
|
|
389
|
+
let data = this.tableData.data ? JSON.parse(JSON.stringify(this.tableData.data)) : [];
|
|
364
390
|
data[this.editIndex] = JSON.parse(JSON.stringify(this.editItem));
|
|
365
391
|
|
|
366
392
|
// Remove the parent object
|
|
@@ -387,7 +413,7 @@ export default {
|
|
|
387
413
|
handleOk(bvModalEvt) {
|
|
388
414
|
bvModalEvt.preventDefault();
|
|
389
415
|
|
|
390
|
-
if (this.$refs.addRenderer.$refs.renderer.$refs.component.$v.$invalid) {
|
|
416
|
+
if (this.$refs.addRenderer.$refs.renderer.$refs.component.$v.vdata.$invalid) {
|
|
391
417
|
return;
|
|
392
418
|
}
|
|
393
419
|
|
|
@@ -447,7 +473,7 @@ export default {
|
|
|
447
473
|
remove() {
|
|
448
474
|
// Add the item to our model and emit change
|
|
449
475
|
// @todo Also check that value is an array type, if not, reset it to an array
|
|
450
|
-
let data = this.
|
|
476
|
+
let data = this.tableData.data ? JSON.parse(JSON.stringify(this.tableData.data)) : [];
|
|
451
477
|
let recordData = data[this.deleteIndex];
|
|
452
478
|
// Remove item from data array
|
|
453
479
|
data.splice(this.deleteIndex, 1);
|
|
@@ -464,3 +490,4 @@ export default {
|
|
|
464
490
|
max-width: 300px;
|
|
465
491
|
}
|
|
466
492
|
</style>
|
|
493
|
+
|
package/src/components/task.vue
CHANGED
|
@@ -242,6 +242,11 @@ export default {
|
|
|
242
242
|
.then((response) => {
|
|
243
243
|
this.task = response.data;
|
|
244
244
|
this.checkTaskStatus();
|
|
245
|
+
if (window.PM4ConfigOverrides.getScreenEndpoint && window.PM4ConfigOverrides.getScreenEndpoint.includes('tasks/')) {
|
|
246
|
+
const screenPath = window.PM4ConfigOverrides.getScreenEndpoint.split('/');
|
|
247
|
+
screenPath[1] = this.task.id;
|
|
248
|
+
window.PM4ConfigOverrides.getScreenEndpoint = screenPath.join('/');
|
|
249
|
+
}
|
|
245
250
|
})
|
|
246
251
|
.catch(() => {
|
|
247
252
|
this.hasErrors = true;
|
|
@@ -279,19 +284,19 @@ export default {
|
|
|
279
284
|
}
|
|
280
285
|
this.prepareTask();
|
|
281
286
|
},
|
|
282
|
-
closeTask() {
|
|
287
|
+
closeTask(parentRequestId = null) {
|
|
283
288
|
if (this.hasErrors) {
|
|
284
289
|
this.$emit('error', this.requestId);
|
|
285
290
|
return;
|
|
286
291
|
}
|
|
287
292
|
|
|
288
293
|
if (this.task.process_request.status === 'COMPLETED') {
|
|
289
|
-
this.
|
|
294
|
+
this.loadNextAssignedTask(parentRequestId);
|
|
290
295
|
|
|
291
296
|
} else if (this.task.allow_interstitial) {
|
|
292
297
|
this.task.interstitial_screen['_interstitial'] = true;
|
|
293
298
|
this.screen = this.task.interstitial_screen;
|
|
294
|
-
this.loadNextAssignedTask();
|
|
299
|
+
this.loadNextAssignedTask(parentRequestId);
|
|
295
300
|
|
|
296
301
|
} else {
|
|
297
302
|
this.$emit('closed', this.task.id);
|
|
@@ -313,11 +318,18 @@ export default {
|
|
|
313
318
|
}
|
|
314
319
|
this.unsubscribeSocketListeners();
|
|
315
320
|
this.redirecting = task.process_request_id;
|
|
316
|
-
this.$emit('redirect', task);
|
|
321
|
+
this.$emit('redirect', task.id, true);
|
|
317
322
|
return;
|
|
323
|
+
} else {
|
|
324
|
+
// Only emit completed after getting the subprocess tasks and there are no tasks and process is completed
|
|
325
|
+
if (requestId == this.task.process_request_id && this.parentRequest && this.task.process_request.status === 'COMPLETED') {
|
|
326
|
+
this.$emit('completed', this.parentRequest);
|
|
327
|
+
}
|
|
318
328
|
}
|
|
319
329
|
this.taskId = task.id;
|
|
320
330
|
this.nodeId = task.element_id;
|
|
331
|
+
} else {
|
|
332
|
+
this.$emit('completed', (this.parentRequest ? this.parentRequest : requestId));
|
|
321
333
|
}
|
|
322
334
|
});
|
|
323
335
|
},
|
|
@@ -361,9 +373,8 @@ export default {
|
|
|
361
373
|
// This may no longer be needed
|
|
362
374
|
},
|
|
363
375
|
processCompleted() {
|
|
364
|
-
if (this.parentRequest
|
|
365
|
-
|
|
366
|
-
return;
|
|
376
|
+
if (this.parentRequest) {
|
|
377
|
+
this.$emit('completed', this.parentRequest);
|
|
367
378
|
}
|
|
368
379
|
this.$emit('completed', this.requestId);
|
|
369
380
|
},
|
|
@@ -412,8 +423,13 @@ export default {
|
|
|
412
423
|
`ProcessMaker.Models.ProcessRequest.${this.parentRequest}`,
|
|
413
424
|
'.ProcessUpdated',
|
|
414
425
|
(data) => {
|
|
415
|
-
if (['
|
|
416
|
-
this.
|
|
426
|
+
if (['ACTIVITY_ACTIVATED'].includes(data.event)) {
|
|
427
|
+
this.closeTask(this.parentRequest);
|
|
428
|
+
}
|
|
429
|
+
if (['ACTIVITY_COMPLETED'].includes(data.event)) {
|
|
430
|
+
if (this.task.process_request.status === 'COMPLETED') {
|
|
431
|
+
this.processCompleted();
|
|
432
|
+
}
|
|
417
433
|
}
|
|
418
434
|
if (data.event === 'ACTIVITY_EXCEPTION') {
|
|
419
435
|
this.$emit('error', this.requestId);
|
package/src/main.js
CHANGED
|
@@ -152,7 +152,7 @@ window.ProcessMaker = {
|
|
|
152
152
|
{value: 2, content: 'John'},
|
|
153
153
|
{value: 3, content: 'Mary'},
|
|
154
154
|
{value: 4, content: 'Patricia'},
|
|
155
|
-
],
|
|
155
|
+
],
|
|
156
156
|
}});
|
|
157
157
|
break;
|
|
158
158
|
default:
|
|
@@ -201,6 +201,16 @@ window.Echo = {
|
|
|
201
201
|
}, 1000);
|
|
202
202
|
});
|
|
203
203
|
},
|
|
204
|
+
eventMocks(event, response) {
|
|
205
|
+
this.listeners.forEach((listener) => {
|
|
206
|
+
setTimeout(() => {
|
|
207
|
+
listener.callback({
|
|
208
|
+
type: event,
|
|
209
|
+
response,
|
|
210
|
+
});
|
|
211
|
+
}, 1000);
|
|
212
|
+
});
|
|
213
|
+
},
|
|
204
214
|
private() {
|
|
205
215
|
return {
|
|
206
216
|
notification(callback) {
|