@processmaker/screen-builder 2.62.0 → 2.64.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/screen-builder",
3
- "version": "2.62.0",
3
+ "version": "2.64.0",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -39,7 +39,7 @@
39
39
  "@cypress/code-coverage": "^3.8.1",
40
40
  "@fortawesome/fontawesome-free": "^5.6.1",
41
41
  "@panter/vue-i18next": "^0.15.2",
42
- "@processmaker/vue-form-elements": "0.42.0",
42
+ "@processmaker/vue-form-elements": "0.43.0",
43
43
  "@processmaker/vue-multiselect": "^2.2.0",
44
44
  "@vue/cli-plugin-babel": "^3.6.0",
45
45
  "@vue/cli-plugin-e2e-cypress": "^4.0.3",
@@ -88,7 +88,7 @@
88
88
  },
89
89
  "peerDependencies": {
90
90
  "@panter/vue-i18next": "^0.15.0",
91
- "@processmaker/vue-form-elements": "0.42.0",
91
+ "@processmaker/vue-form-elements": "0.43.0",
92
92
  "i18next": "^15.0.8",
93
93
  "vue": "^2.6.12",
94
94
  "vuex": "^3.1.1"
package/src/.DS_Store CHANGED
Binary file
package/src/App.vue CHANGED
@@ -400,6 +400,10 @@ export default {
400
400
  return warnings;
401
401
  },
402
402
  },
403
+ created() {
404
+ this.updateDataInput = debounce(this.updateDataInput, 1000);
405
+ this.updateDataPreview = debounce(this.updateDataPreview, 1000);
406
+ },
403
407
  mounted() {
404
408
  this.countElements = debounce(this.countElements, 2000);
405
409
  if (globalObject.ProcessMaker && globalObject.ProcessMaker.user && globalObject.ProcessMaker.user.lang) {
@@ -422,10 +426,9 @@ export default {
422
426
  },
423
427
  methods: {
424
428
  ...mapMutations("globalErrorsModule", { setStoreMode: "setMode" }),
425
- // eslint-disable-next-line func-names
426
- updateDataInput: debounce(function () {
429
+ updateDataInput() {
427
430
  this.updateDataInputNow();
428
- }, 1000),
431
+ },
429
432
  updateDataInputNow() {
430
433
  if (this.previewInputValid) {
431
434
  // Copy data over
@@ -433,10 +436,9 @@ export default {
433
436
  this.updateDataPreview();
434
437
  }
435
438
  },
436
- // eslint-disable-next-line func-names
437
- updateDataPreview: debounce(function () {
439
+ updateDataPreview() {
438
440
  this.previewDataStringify = JSON.stringify(this.previewData, null, 2);
439
- }, 1000),
441
+ },
440
442
  monacoMounted(editor) {
441
443
  this.editor = editor;
442
444
  this.editor.updateOptions({ readOnly: true });
@@ -45,6 +45,11 @@ export default {
45
45
  // Not somewhere we can download anything (like web entry start event)
46
46
  return;
47
47
  }
48
+
49
+ if (this.collection && this.value) {
50
+ // eslint-disable-next-line vue/no-mutating-props
51
+ this.value.file_name = this.value.name;
52
+ }
48
53
  this.setFilesInfo();
49
54
  },
50
55
  watch: {
@@ -114,6 +119,9 @@ export default {
114
119
 
115
120
  if (_.has(window, 'PM4ConfigOverrides.useDefaultUrlDownload') && window.PM4ConfigOverrides.useDefaultUrlDownload) {
116
121
  // Use default endpoint when coming from a package.
122
+ if (this.requestId) {
123
+ return `requests/${this.requestId}/files/${file.id}/contents`;
124
+ }
117
125
  return `../files/${file.id}/contents`;
118
126
  }
119
127
 
@@ -202,10 +210,7 @@ export default {
202
210
  if (fileInfo) {
203
211
  this.filesInfo.push(fileInfo);
204
212
  } else {
205
- window.ProcessMaker.alert(
206
- this.$t('File ID does not exist'),
207
- 'danger'
208
- );
213
+ console.log(this.$t('File ID does not exist'));
209
214
  }
210
215
  });
211
216
  },
@@ -111,6 +111,12 @@ export default {
111
111
  this.setPrefix();
112
112
  if (this.$refs['uploader']) {
113
113
  this.$refs['uploader'].$forceUpdate();
114
+ // Re-upload stored files;
115
+ // Files disappear when navigating between pages with the Page Navigation component
116
+ if (this.files.length > 0) {
117
+ this.$refs.uploader.uploader.addFiles(this.files);
118
+ this.uploading = false;
119
+ }
114
120
  }
115
121
 
116
122
  this.disabled = _.get(window, 'ProcessMaker.isSelfService', false);
@@ -288,6 +294,7 @@ export default {
288
294
  files: [],
289
295
  nativeFiles: {},
290
296
  uploading: false,
297
+ invalidFile: false,
291
298
  };
292
299
  },
293
300
  methods: {
@@ -450,6 +457,14 @@ export default {
450
457
  file.ignored = true;
451
458
  return false;
452
459
  }
460
+ if (file.fileType === undefined) {
461
+ const existingFile = this.files.find(el => {
462
+ if (el.name === file.name) {
463
+ return el.fileType;
464
+ }
465
+ });
466
+ file.fileType = existingFile.fileType;
467
+ }
453
468
 
454
469
  if (this.filesAccept) {
455
470
  file.ignored = true;
@@ -457,6 +472,8 @@ export default {
457
472
  file.ignored = false;
458
473
  }
459
474
  if (file.ignored) {
475
+ this.invalidFile = true;
476
+ this.uploading = false;
460
477
  window.ProcessMaker.alert(this.$t('File not allowed.'), 'danger');
461
478
  return false;
462
479
  }
@@ -493,6 +510,9 @@ export default {
493
510
  id,
494
511
  file_name: name,
495
512
  mime_type: rootFile.fileType,
513
+ // additional properties needed when re-uploading files to the uploader component
514
+ name: name,
515
+ fileType: rootFile.fileType,
496
516
  };
497
517
 
498
518
  this.$set(this.nativeFiles, id, rootFile);
@@ -521,6 +541,11 @@ export default {
521
541
  return null;
522
542
  },
523
543
  start() {
544
+ // Prevent the upload from being started when the file is invalid.
545
+ if (this.invalidFile) {
546
+ return;
547
+ }
548
+
524
549
  this.uploading = true;
525
550
  if (this.parentRecordList(this) === null) {
526
551
  this.row_id = null;
@@ -230,7 +230,7 @@ export default {
230
230
  }
231
231
  },
232
232
  loadTask() {
233
- const url = `/${this.taskId}?include=data,user,requestor,processRequest,component,screen,requestData,bpmnTagName,interstitial,definition,nested`;
233
+ const url = `/${this.taskId}?include=data,user,requestor,processRequest,component,screen,requestData,bpmnTagName,interstitial,definition,nested,userRequestPermission`;
234
234
  // For Vocabularies
235
235
  if (window.ProcessMaker && window.ProcessMaker.packages && window.ProcessMaker.packages.includes('package-vocabularies')) {
236
236
  window.ProcessMaker.VocabulariesSchemaUrl = `vocabularies/task_schema/${this.taskId}`;
@@ -326,7 +326,7 @@ export default {
326
326
  this.taskId = task.id;
327
327
  this.nodeId = task.element_id;
328
328
  } else if (this.parentRequest && ['COMPLETED', 'CLOSED'].includes(this.task.process_request.status)) {
329
- this.$emit('completed', this.parentRequest);
329
+ this.$emit('completed', this.getAllowedRequestId());
330
330
  }
331
331
  });
332
332
  },
@@ -379,10 +379,20 @@ export default {
379
379
  // This may no longer be needed
380
380
  },
381
381
  processCompleted() {
382
+ let requestId;
382
383
  if (this.parentRequest) {
383
- this.$emit('completed', this.parentRequest);
384
+ requestId = this.getAllowedRequestId();
385
+ this.$emit('completed', requestId);
384
386
  }
385
- this.$emit('completed', this.requestId);
387
+ if (requestId !== this.requestId) {
388
+ this.$emit('completed', this.requestId);
389
+ }
390
+ },
391
+ getAllowedRequestId() {
392
+ const permissions = this.task.user_request_permission || [];
393
+ const permission = permissions.find(item => item.process_request_id === this.parentRequest)
394
+ const allowed = permission && permission.allowed;
395
+ return allowed ? this.parentRequest : this.requestId
386
396
  },
387
397
  processUpdated: _.debounce(function(data) {
388
398
  if (
@@ -145,7 +145,6 @@ export default {
145
145
  },
146
146
  async submitForm() {
147
147
  await this.validateNow(findRootScreen(this));
148
- console.log(this.valid__, this.message__);
149
148
  if (!this.valid__) {
150
149
  window.ProcessMaker.alert(this.message__, "danger");
151
150
  // if the form is not valid the data is not emitted
@@ -31,12 +31,16 @@ function countErrors(obj) {
31
31
  return errors;
32
32
  }
33
33
 
34
- const updateValidationRules = async (screen, commit) => {
35
- const rootScreen = findRootScreen(screen);
36
- if (rootScreen !== screen) {
37
- // refresh nested screen validation rules
38
- await screen.loadValidationRules();
39
- }
34
+ const updateValidationRules = async (screens, commit) => {
35
+ const rootScreen = findRootScreen(screens[0]);
36
+ const awaitLoad = [];
37
+ screens.forEach((screen) => {
38
+ if (rootScreen !== screen) {
39
+ // refresh nested screen validation rules
40
+ awaitLoad.push(screen.loadValidationRules());
41
+ }
42
+ });
43
+ await Promise.all(awaitLoad);
40
44
  try {
41
45
  await rootScreen.loadValidationRules();
42
46
  } catch (error) {
@@ -67,7 +71,15 @@ const updateValidationRules = async (screen, commit) => {
67
71
  }
68
72
  };
69
73
 
70
- const updateValidationRulesDebounced = debounce(updateValidationRules, 1000);
74
+ const updateValidationRulesDebounced = debounce(updateValidationRules, 500);
75
+
76
+ const screensToValidate = [];
77
+ const queueUpdateValidationRules = (mainScreen, commit) => {
78
+ if (!screensToValidate.includes(mainScreen)) {
79
+ screensToValidate.push(mainScreen);
80
+ }
81
+ updateValidationRulesDebounced(screensToValidate, commit);
82
+ };
71
83
 
72
84
  const globalErrorsModule = {
73
85
  namespaced,
@@ -100,14 +112,14 @@ const globalErrorsModule = {
100
112
  },
101
113
  actions: {
102
114
  validate({ commit }, mainScreen) {
103
- updateValidationRulesDebounced(mainScreen, commit);
115
+ queueUpdateValidationRules(mainScreen, commit);
104
116
  },
105
117
  async validateNow({ commit }, mainScreen) {
106
- await updateValidationRules(mainScreen, commit);
118
+ await updateValidationRules([mainScreen], commit);
107
119
  },
108
120
  close({ commit }) {
109
121
  commit("basic", { key: "valid", value: true });
110
- },
122
+ }
111
123
  }
112
124
  };
113
125