@processmaker/screen-builder 2.98.3 → 2.99.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.98.3",
3
+ "version": "2.99.0",
4
4
  "scripts": {
5
5
  "dev": "VITE_COVERAGE=true vite",
6
6
  "build": "vite build",
@@ -13,6 +13,7 @@
13
13
  @upload-start="start"
14
14
  @file-removed="removed"
15
15
  @file-success="fileUploaded"
16
+ @file-error="fileError"
16
17
  @file-added="addFile"
17
18
  :class="{'was-validated': required}"
18
19
  >
@@ -503,6 +504,24 @@ export default {
503
504
  e.target.click();
504
505
  }
505
506
  },
507
+ fileError(rootFile, file, messages, chunk)
508
+ {
509
+ let displayMessage = '';
510
+ try {
511
+ const messagesArray = JSON.parse(messages);
512
+ displayMessage = messagesArray.join(', ');
513
+ }
514
+ catch (e) {
515
+ displayMessage = messages;
516
+ }
517
+
518
+ if (displayMessage.length > 0) {
519
+ window.ProcessMaker.alert(`${this.$t('File Upload Error:')} ${displayMessage}`, 'danger');
520
+ }
521
+
522
+ window.onbeforeunload = function() {};
523
+ this.$emit('file-error', messages);
524
+ },
506
525
  fileUploaded(rootFile, file, message) {
507
526
  this.uploading = false;
508
527
  let name = file.name;
@@ -516,8 +516,6 @@ export default {
516
516
  this.loadTask();
517
517
  } else if (this.parentRequest && ['COMPLETED', 'CLOSED'].includes(this.task.process_request.status)) {
518
518
  this.$emit('completed', this.getAllowedRequestId());
519
- } else if (!this.taskPreview) {
520
- this.emitClosedEvent();
521
519
  }
522
520
  });
523
521
  },
@@ -827,8 +825,11 @@ export default {
827
825
  * @param {Object} redirectData - The redirect data object.
828
826
  */
829
827
  isSameUser(currentTask, redirectData) {
830
- return (currentTask.user?.id === redirectData.params[0].userId)
831
- && (currentTask.elementDestination?.type === 'taskSource');
828
+ const userIdMatch = currentTask.user?.id === redirectData.params[0].userId;
829
+ const typeMatch = currentTask.elementDestination?.type === null
830
+ || currentTask.elementDestination?.type === 'taskSource';
831
+
832
+ return userIdMatch && typeMatch;
832
833
  },
833
834
 
834
835
  /**
@@ -838,6 +839,17 @@ export default {
838
839
  * @param {Object} data - The event data containing the process update information.
839
840
  */
840
841
  handleProcessUpdated(data) {
842
+ const elementDestinationValue = this.task.elementDestination?.value;
843
+
844
+ if (
845
+ elementDestinationValue &&
846
+ data?.params[0]?.tokenId === this.taskId &&
847
+ data?.params[0]?.requestStatus === 'ACTIVE'
848
+ ) {
849
+ window.location.href = elementDestinationValue;
850
+ return;
851
+ }
852
+
841
853
  if (
842
854
  ['ACTIVITY_ACTIVATED', 'ACTIVITY_COMPLETED'].includes(data.event)
843
855
  && data.elementType === 'task'