@processmaker/screen-builder 2.99.3 → 2.99.5-patch.tce

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.99.3",
3
+ "version": "2.99.5-patch.tce",
4
4
  "scripts": {
5
5
  "dev": "VITE_COVERAGE=true vite",
6
6
  "build": "vite build",
@@ -56,7 +56,7 @@
56
56
  "@fortawesome/fontawesome-free": "^5.6.1",
57
57
  "@originjs/vite-plugin-commonjs": "^1.0.3",
58
58
  "@panter/vue-i18next": "^0.15.2",
59
- "@processmaker/vue-form-elements": "0.60.0",
59
+ "@processmaker/vue-form-elements": "0.60.1",
60
60
  "@processmaker/vue-multiselect": "2.3.0",
61
61
  "@storybook/addon-essentials": "^7.6.13",
62
62
  "@storybook/addon-interactions": "^7.6.13",
@@ -115,7 +115,7 @@
115
115
  },
116
116
  "peerDependencies": {
117
117
  "@panter/vue-i18next": "^0.15.0",
118
- "@processmaker/vue-form-elements": "0.60.0",
118
+ "@processmaker/vue-form-elements": "0.60.1",
119
119
  "i18next": "^15.0.8",
120
120
  "vue": "^2.6.12",
121
121
  "vuex": "^3.1.1"
@@ -99,6 +99,10 @@ export default {
99
99
  this.removeDefaultClasses();
100
100
  },
101
101
  mounted() {
102
+ if (this.value) {
103
+ this.fetchFiles();
104
+ }
105
+
102
106
  this.$root.$on('set-upload-data-name',
103
107
  (recordList, index, id) => this.listenRecordList(recordList, index, id));
104
108
 
@@ -461,6 +465,19 @@ export default {
461
465
  this.prefix = parent.loopContext + '.';
462
466
  }
463
467
  },
468
+ validateFile(file, acceptFiles){
469
+ const extensions = acceptFiles.filter(item => item.startsWith('.'));
470
+ const mimeTypes = acceptFiles.filter(item => !item.startsWith('.'));
471
+ const fileExtension = '.' + file.name.split('.').pop().toLowerCase();
472
+ const fileType = file.fileType;
473
+ const isExtensionValid = extensions.includes(fileExtension);
474
+ const isMimeTypeValid = mimeTypes.includes(fileType);
475
+
476
+ if (!isExtensionValid && !isMimeTypeValid) {
477
+ return false;
478
+ }
479
+ return true;
480
+ },
464
481
  addFile(file) {
465
482
  if (this.disabled) {
466
483
  file.ignored = true;
@@ -477,7 +494,7 @@ export default {
477
494
 
478
495
  if (this.filesAccept) {
479
496
  file.ignored = true;
480
- if (this.filesAccept.indexOf(file.fileType) !== -1) {
497
+ if (this.validateFile(file, this.filesAccept)) {
481
498
  file.ignored = false;
482
499
  }
483
500
  if (file.ignored) {
@@ -516,6 +533,10 @@ export default {
516
533
  }
517
534
 
518
535
  if (displayMessage.length > 0) {
536
+ const data = JSON.parse(displayMessage);
537
+ if (data.message) {
538
+ displayMessage = data.message;
539
+ }
519
540
  window.ProcessMaker.alert(`${this.$t('File Upload Error:')} ${displayMessage}`, 'danger');
520
541
  }
521
542
 
@@ -608,6 +629,28 @@ export default {
608
629
  : null;
609
630
  }
610
631
  },
632
+ async fetchFiles() {
633
+ const fileIds = Array.isArray(this.value) ? this.value : [this.value];
634
+
635
+ const fetchPromises = fileIds.map(async (file) => {
636
+ const id = file?.file ?? file;
637
+ const endpoint = `files/${id}`;
638
+ try {
639
+ const response = await ProcessMaker.apiClient.get(endpoint);
640
+ if (response?.data) {
641
+ const fileExists = this.files.some(existingFile => existingFile.id === response.data.id);
642
+ // Check if the file already exists in the list before adding it.
643
+ if (!fileExists) {
644
+ this.files.push(response.data);
645
+ }
646
+ }
647
+ } catch (error) {
648
+ console.error(`Failed to fetch file ${id}`, error);
649
+ }
650
+ });
651
+
652
+ return await Promise.all(fetchPromises);
653
+ },
611
654
  },
612
655
  };
613
656
  </script>
@@ -865,6 +865,7 @@ export default {
865
865
 
866
866
  if (
867
867
  elementDestinationValue &&
868
+ elementDestinationValue !== 'taskSource' &&
868
869
  data?.params[0]?.tokenId === this.taskId &&
869
870
  data?.params[0]?.requestStatus === 'ACTIVE'
870
871
  ) {
@@ -96,8 +96,8 @@ export const keyNameProperty = {
96
96
  config: {
97
97
  label: 'Variable Name',
98
98
  name: 'Variable Name',
99
- // Update tests/e2e/specs/Builder.spec.js when changing this
100
- validation: 'regex:/^([a-zA-Z]([a-zA-Z0-9_]?)+\\.?)+(?<!\\.)$/|required|not_in:' + javascriptReservedKeywords,
99
+ // Update tests/e2e/specs/Builder.spec.js when changing dot_notation
100
+ validation: 'dot_notation|required|not_in:' + javascriptReservedKeywords,
101
101
  helper: 'A variable name is a symbolic name to reference information.',
102
102
  },
103
103
  };