@processmaker/screen-builder 2.86.0 → 2.87.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.86.0",
3
+ "version": "2.87.0",
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.52.1",
59
+ "@processmaker/vue-form-elements": "0.53.0",
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.52.1",
118
+ "@processmaker/vue-form-elements": "0.53.0",
119
119
  "i18next": "^15.0.8",
120
120
  "vue": "^2.6.12",
121
121
  "vuex": "^3.1.1"
@@ -212,7 +212,12 @@ export default {
212
212
  let { endpoint } = this;
213
213
 
214
214
  if (this.requestFiles) {
215
- this.filesInfo.push(_.get(this.requestFiles, this.fileDataName, null));
215
+ const fileInfo = this.requestFiles?.[this.fileDataName];
216
+
217
+ if (fileInfo) {
218
+ this.filesInfo.push(fileInfo);
219
+ }
220
+
216
221
  return;
217
222
  }
218
223
 
@@ -229,20 +234,36 @@ export default {
229
234
  }
230
235
  }
231
236
 
232
- this.$dataProvider.get(endpoint).then((response) => {
233
- const fileInfo = response.data.data
234
- ? _.get(response, "data.data.0", null)
235
- : _.get(response, "data", null);
236
- if (fileInfo) {
237
- if (typeof this.value === "number" && this.filesInfo.length > 0) {
238
- this.filesInfo[0] = fileInfo;
237
+ this.$dataProvider
238
+ .get(endpoint)
239
+ .then((response) => {
240
+ const fileInfo = response.data.data
241
+ ? _.get(response, "data.data.0", null)
242
+ : _.get(response, "data", null);
243
+ if (fileInfo) {
244
+ if (typeof this.value === "number" && this.filesInfo.length > 0) {
245
+ this.filesInfo[0] = fileInfo;
246
+ } else {
247
+ this.filesInfo.push(fileInfo);
248
+ }
239
249
  } else {
240
- this.filesInfo.push(fileInfo);
250
+ console.log(this.$t("File ID does not exist"));
241
251
  }
242
- } else {
243
- console.log(this.$t("File ID does not exist"));
244
- }
245
- });
252
+ })
253
+ .catch((error) => {
254
+ const alert = document.querySelector(".alert-danger");
255
+ const defaultMessage = this.$t(
256
+ "Something went wrong and the file cannot be previewed or downloaded."
257
+ );
258
+ const message = error?.response?.data?.message || defaultMessage;
259
+
260
+ if (
261
+ !alert &&
262
+ (error?.response?.status === 404 || error?.response?.data?.message)
263
+ ) {
264
+ window.ProcessMaker.alert(message, "danger");
265
+ }
266
+ });
246
267
  },
247
268
  setFilesInfoFromCollectionValue() {
248
269
  const files = this.value