@processmaker/screen-builder 2.99.4 → 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/dist/vue-form-builder.css +1 -1
- package/dist/vue-form-builder.es.js +19 -3
- package/dist/vue-form-builder.es.js.map +1 -1
- package/dist/vue-form-builder.umd.js +1 -1
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/renderer/file-upload.vue +30 -0
package/package.json
CHANGED
|
@@ -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
|
|
|
@@ -529,6 +533,10 @@ export default {
|
|
|
529
533
|
}
|
|
530
534
|
|
|
531
535
|
if (displayMessage.length > 0) {
|
|
536
|
+
const data = JSON.parse(displayMessage);
|
|
537
|
+
if (data.message) {
|
|
538
|
+
displayMessage = data.message;
|
|
539
|
+
}
|
|
532
540
|
window.ProcessMaker.alert(`${this.$t('File Upload Error:')} ${displayMessage}`, 'danger');
|
|
533
541
|
}
|
|
534
542
|
|
|
@@ -621,6 +629,28 @@ export default {
|
|
|
621
629
|
: null;
|
|
622
630
|
}
|
|
623
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
|
+
},
|
|
624
654
|
},
|
|
625
655
|
};
|
|
626
656
|
</script>
|