@processmaker/screen-builder 2.95.0 → 2.96.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/dist/vue-form-builder.css +1 -1
- package/dist/vue-form-builder.es.js +803 -715
- package/dist/vue-form-builder.es.js.map +1 -1
- package/dist/vue-form-builder.umd.js +29 -29
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/task.vue +150 -43
- package/src/components/vue-form-builder.vue +4 -0
package/package.json
CHANGED
package/src/components/task.vue
CHANGED
|
@@ -448,7 +448,7 @@ export default {
|
|
|
448
448
|
return `/tasks/${firstTask.id}/edit`;
|
|
449
449
|
}
|
|
450
450
|
|
|
451
|
-
return
|
|
451
|
+
return this.getSessionRedirectUrl();
|
|
452
452
|
} catch (error) {
|
|
453
453
|
console.error("Error in getDestinationUrl:", error);
|
|
454
454
|
return null;
|
|
@@ -465,7 +465,27 @@ export default {
|
|
|
465
465
|
const sessionStorageUrl = sessionStorage.getItem("elementDestinationURL");
|
|
466
466
|
return sessionStorageUrl || null;
|
|
467
467
|
},
|
|
468
|
+
/**
|
|
469
|
+
* Retrieves the URL from the session storage or the document referrer.
|
|
470
|
+
*
|
|
471
|
+
* This method is used to determine the source of the redirection when the task is claimed.
|
|
472
|
+
* It retrieves the 'sessionUrlSelfService' value from sessionStorage, and if present, removes it.
|
|
473
|
+
* If the value is not found, it returns the document referrer.
|
|
474
|
+
*
|
|
475
|
+
* @returns {string|null} - The URL from the session storage or the document referrer.
|
|
476
|
+
*/
|
|
477
|
+
getSessionRedirectUrl() {
|
|
478
|
+
const urlSelfService = sessionStorage.getItem('sessionUrlSelfService');
|
|
479
|
+
|
|
480
|
+
if (urlSelfService) {
|
|
481
|
+
// Remove 'sessionUrlSelfService' from sessionStorage after retrieving its value
|
|
482
|
+
sessionStorage.removeItem('sessionUrlSelfService');
|
|
483
|
+
// Emit the source of the redirection
|
|
484
|
+
return urlSelfService;
|
|
485
|
+
}
|
|
468
486
|
|
|
487
|
+
return document.referrer || null;
|
|
488
|
+
},
|
|
469
489
|
loadNextAssignedTask(requestId = null) {
|
|
470
490
|
if (!requestId) {
|
|
471
491
|
requestId = this.requestId;
|
|
@@ -565,9 +585,6 @@ export default {
|
|
|
565
585
|
requestId = this.getAllowedRequestId();
|
|
566
586
|
this.$emit('completed', requestId);
|
|
567
587
|
}
|
|
568
|
-
if (requestId !== this.requestId) {
|
|
569
|
-
this.processCompletedRedirect(data, this.userId, this.requestId);
|
|
570
|
-
}
|
|
571
588
|
},
|
|
572
589
|
/**
|
|
573
590
|
* Makes an API call with retry logic.
|
|
@@ -649,11 +666,11 @@ export default {
|
|
|
649
666
|
try {
|
|
650
667
|
// Verify if is not anotherProcess type
|
|
651
668
|
if (data.endEventDestination.type !== "anotherProcess") {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
669
|
+
if (data?.endEventDestination.value) {
|
|
670
|
+
window.location.href = data?.endEventDestination.value;
|
|
671
|
+
} else {
|
|
672
|
+
window.location.href = `/requests/${this.requestId}`;
|
|
673
|
+
}
|
|
657
674
|
return;
|
|
658
675
|
}
|
|
659
676
|
// Parse endEventDestination from the provided data
|
|
@@ -679,9 +696,9 @@ export default {
|
|
|
679
696
|
// Handle the first task from the response
|
|
680
697
|
const firstTask = response.data.data[0];
|
|
681
698
|
if (firstTask && firstTask.user_id === userId) {
|
|
682
|
-
this
|
|
699
|
+
this.redirectToTask(firstTask.id);
|
|
683
700
|
} else {
|
|
684
|
-
this
|
|
701
|
+
this.redirectToRequest(requestId);
|
|
685
702
|
}
|
|
686
703
|
} catch (error) {
|
|
687
704
|
console.error("Error processing completed redirect:", error);
|
|
@@ -694,47 +711,139 @@ export default {
|
|
|
694
711
|
const allowed = permission && permission.allowed;
|
|
695
712
|
return allowed ? this.parentRequest : this.requestId
|
|
696
713
|
},
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
714
|
+
redirectToTask(tokenId) {
|
|
715
|
+
this.$emit('redirect', tokenId);
|
|
716
|
+
},
|
|
717
|
+
redirectToRequest(requestId) {
|
|
718
|
+
window.location.href = `/requests/${requestId}`;
|
|
719
|
+
},
|
|
720
|
+
/**
|
|
721
|
+
* Initializes socket listeners for process updates and redirects.
|
|
722
|
+
* This method sets up listeners to handle specific events and reloads
|
|
723
|
+
* the task if necessary.
|
|
724
|
+
*/
|
|
725
|
+
initSocketListeners() {
|
|
726
|
+
this.addProcessUpdateListener();
|
|
727
|
+
this.addRedirectListener();
|
|
728
|
+
this.loadingListeners = false;
|
|
705
729
|
|
|
730
|
+
// Reload to check if there's a task waiting, in case an event was missed
|
|
731
|
+
if (!this.taskId) {
|
|
706
732
|
this.reload();
|
|
707
733
|
}
|
|
734
|
+
},
|
|
708
735
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
this.loadingListeners = false;
|
|
736
|
+
/**
|
|
737
|
+
* Adds a socket listener for process updates.
|
|
738
|
+
* Listens for specific events related to the process and triggers appropriate actions.
|
|
739
|
+
*/
|
|
740
|
+
addProcessUpdateListener() {
|
|
715
741
|
this.addSocketListener(
|
|
716
|
-
`
|
|
742
|
+
`updated-${this.requestId}`,
|
|
717
743
|
`ProcessMaker.Models.ProcessRequest.${this.requestId}`,
|
|
718
|
-
'.
|
|
719
|
-
(data) =>
|
|
720
|
-
this.processCompleted(data);
|
|
721
|
-
}
|
|
744
|
+
'.ProcessUpdated',
|
|
745
|
+
(data) => this.handleProcessUpdate(data)
|
|
722
746
|
);
|
|
747
|
+
},
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Handles process update events.
|
|
751
|
+
* Emits an error if an activity exception event is detected.
|
|
752
|
+
*
|
|
753
|
+
* @param {Object} data - The event data received from the socket listener.
|
|
754
|
+
*/
|
|
755
|
+
handleProcessUpdate(data) {
|
|
756
|
+
if (data.event === 'ACTIVITY_EXCEPTION') {
|
|
757
|
+
this.$emit('error', this.requestId);
|
|
758
|
+
window.location.href = `/requests/${this.requestId}`;
|
|
759
|
+
}
|
|
760
|
+
},
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Adds a socket listener for redirect events.
|
|
764
|
+
* Listens for specific redirect actions and handles them according to the method provided.
|
|
765
|
+
*/
|
|
766
|
+
addRedirectListener() {
|
|
723
767
|
this.addSocketListener(
|
|
724
|
-
`
|
|
768
|
+
`redirect-${this.requestId}`,
|
|
725
769
|
`ProcessMaker.Models.ProcessRequest.${this.requestId}`,
|
|
726
|
-
'.
|
|
727
|
-
(data) =>
|
|
728
|
-
this.processUpdated(data);
|
|
729
|
-
}
|
|
770
|
+
'.RedirectTo',
|
|
771
|
+
(data) => this.handleRedirect(data)
|
|
730
772
|
);
|
|
773
|
+
},
|
|
731
774
|
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
775
|
+
/**
|
|
776
|
+
* Handles redirect events based on the method provided in the event data.
|
|
777
|
+
* Calls specific handlers for different redirect methods or falls back to a default redirect.
|
|
778
|
+
*
|
|
779
|
+
* @param {Object} data - The event data received from the socket listener.
|
|
780
|
+
*/
|
|
781
|
+
handleRedirect(data) {
|
|
782
|
+
switch (data.method) {
|
|
783
|
+
case 'redirectToTask':
|
|
784
|
+
this.handleRedirectToTask(data);
|
|
785
|
+
break;
|
|
786
|
+
case 'processUpdated':
|
|
787
|
+
this.handleProcessUpdated(data);
|
|
788
|
+
break;
|
|
789
|
+
case 'processCompletedRedirect':
|
|
790
|
+
this.processCompletedRedirect(
|
|
791
|
+
data.params[0],
|
|
792
|
+
this.userId,
|
|
793
|
+
this.requestId
|
|
794
|
+
);
|
|
795
|
+
break;
|
|
796
|
+
default:
|
|
797
|
+
this.handleDefaultRedirect(data);
|
|
798
|
+
}
|
|
799
|
+
},
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Handles the 'redirectToTask' event by loading the specified task.
|
|
803
|
+
* Updates the current task ID and reloads the task data.
|
|
804
|
+
*
|
|
805
|
+
* @param {Object} data - The event data containing the tokenId of the task.
|
|
806
|
+
*/
|
|
807
|
+
handleRedirectToTask(data) {
|
|
808
|
+
|
|
809
|
+
if (data?.params[0]?.tokenId) {
|
|
810
|
+
this.loadingTask = true;
|
|
811
|
+
this.taskId = data.params[0].tokenId;
|
|
735
812
|
this.reload();
|
|
736
813
|
}
|
|
737
814
|
},
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* Handles the 'processUpdated' event by checking the event type and updating the task if necessary.
|
|
818
|
+
* Reloads the task data if the event is relevant.
|
|
819
|
+
*
|
|
820
|
+
* @param {Object} data - The event data containing the process update information.
|
|
821
|
+
*/
|
|
822
|
+
handleProcessUpdated(data) {
|
|
823
|
+
if (
|
|
824
|
+
['ACTIVITY_ACTIVATED', 'ACTIVITY_COMPLETED'].includes(data.event)
|
|
825
|
+
&& data.elementType === 'task'
|
|
826
|
+
) {
|
|
827
|
+
if (!this.task.elementDestination?.type) {
|
|
828
|
+
this.taskId = data.taskId;
|
|
829
|
+
}
|
|
830
|
+
this.reload();
|
|
831
|
+
}
|
|
832
|
+
if (data.event === 'ACTIVITY_EXCEPTION') {
|
|
833
|
+
this.$emit('error', this.requestId);
|
|
834
|
+
}
|
|
835
|
+
},
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Handles the default redirect action by logging a warning and redirecting the user to the request page.
|
|
839
|
+
*
|
|
840
|
+
* @param {Object} data - The event data that triggered the default redirect.
|
|
841
|
+
*/
|
|
842
|
+
handleDefaultRedirect(data) {
|
|
843
|
+
console.warn('redirect', data);
|
|
844
|
+
window.location.href = `/requests/${this.requestId}`;
|
|
845
|
+
},
|
|
846
|
+
|
|
738
847
|
existsEventMessage(id, data) {
|
|
739
848
|
if (sessionStorage.getItem(id)) {
|
|
740
849
|
return true;
|
|
@@ -809,8 +918,8 @@ export default {
|
|
|
809
918
|
* Checks for the presence of a URL action blocker in sessionStorage and handles it.
|
|
810
919
|
*
|
|
811
920
|
* This method retrieves the 'sessionUrlActionBlocker' value from sessionStorage,
|
|
812
|
-
* and if present, removes it and emits a 'closed' event with the task id and
|
|
813
|
-
* the source of the redirection. It returns false if the blocker was handled,
|
|
921
|
+
* and if present, removes it and emits a 'closed' event with the task id and
|
|
922
|
+
* the source of the redirection. It returns false if the blocker was handled,
|
|
814
923
|
* and true otherwise.
|
|
815
924
|
*
|
|
816
925
|
* @returns {boolean} Returns false if the 'sessionUrlActionBlocker' was found and handled, true otherwise.
|
|
@@ -839,9 +948,7 @@ export default {
|
|
|
839
948
|
this.nodeId = this.initialNodeId;
|
|
840
949
|
this.requestData = this.value;
|
|
841
950
|
this.loopContext = this.initialLoopContext;
|
|
842
|
-
|
|
843
|
-
this.loadTask();
|
|
844
|
-
}
|
|
951
|
+
this.loadTask();
|
|
845
952
|
},
|
|
846
953
|
destroyed() {
|
|
847
954
|
this.unsubscribeSocketListeners();
|
|
@@ -650,6 +650,10 @@ export default {
|
|
|
650
650
|
let filter = this.filterQuery.toLowerCase();
|
|
651
651
|
const filtered = this.controls.filter((control) => {
|
|
652
652
|
let result = control.label.toLowerCase().includes(filter);
|
|
653
|
+
if (!control.group) {
|
|
654
|
+
// If the group is not defined
|
|
655
|
+
control.group = 'Advanced';
|
|
656
|
+
}
|
|
653
657
|
if (control.group.toLowerCase().includes(filter)) {
|
|
654
658
|
result = true;
|
|
655
659
|
}
|