@processmaker/screen-builder 3.8.25 → 3.8.27
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 +805 -793
- package/dist/vue-form-builder.es.js.map +1 -1
- package/dist/vue-form-builder.umd.js +39 -39
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/inspector/options-list.vue +33 -2
- package/src/components/task.vue +40 -30
package/package.json
CHANGED
|
@@ -341,6 +341,9 @@ export default {
|
|
|
341
341
|
},
|
|
342
342
|
],
|
|
343
343
|
valueTypeReturned: '',
|
|
344
|
+
assetType: null,
|
|
345
|
+
assetTypeResolved: false,
|
|
346
|
+
screenId: null,
|
|
344
347
|
};
|
|
345
348
|
},
|
|
346
349
|
watch: {
|
|
@@ -504,9 +507,37 @@ export default {
|
|
|
504
507
|
monacoMounted(editor) {
|
|
505
508
|
editor.getAction('editor.action.formatDocument').run();
|
|
506
509
|
},
|
|
507
|
-
|
|
510
|
+
resolveAssetType() {
|
|
511
|
+
if (this.assetTypeResolved) {
|
|
512
|
+
return Promise.resolve(this.assetType);
|
|
513
|
+
}
|
|
514
|
+
const match = window.location.pathname.match(/screen-builder\/(\d+)\/edit/);
|
|
515
|
+
if (!match) {
|
|
516
|
+
this.assetTypeResolved = true;
|
|
517
|
+
return Promise.resolve(this.assetType);
|
|
518
|
+
}
|
|
519
|
+
this.screenId = match[1];
|
|
520
|
+
return this.$dataProvider
|
|
521
|
+
.get(`/screens/${this.screenId}`)
|
|
522
|
+
.then(response => {
|
|
523
|
+
this.assetType = response.data.asset_type || null;
|
|
524
|
+
this.assetTypeResolved = true;
|
|
525
|
+
return this.assetType;
|
|
526
|
+
})
|
|
527
|
+
.catch(() => {
|
|
528
|
+
this.assetTypeResolved = true;
|
|
529
|
+
return this.assetType;
|
|
530
|
+
});
|
|
531
|
+
},
|
|
532
|
+
async getDataSourceList() {
|
|
533
|
+
await this.resolveAssetType();
|
|
534
|
+
const params = {};
|
|
535
|
+
if (this.assetType) {
|
|
536
|
+
// For PM Block screens, expose both regular and PM Block connectors.
|
|
537
|
+
params.asset_type = this.assetType === 'PM_BLOCK' ? 'all' : this.assetType;
|
|
538
|
+
}
|
|
508
539
|
this.$dataProvider
|
|
509
|
-
.get('/data_sources')
|
|
540
|
+
.get('/data_sources', { params })
|
|
510
541
|
.then(response => {
|
|
511
542
|
let jsonData = response.data.data;
|
|
512
543
|
// Map the data sources response to value/text items list
|
package/src/components/task.vue
CHANGED
|
@@ -912,43 +912,53 @@ export default {
|
|
|
912
912
|
* @param {Object} data - The event data containing the tokenId of the task.
|
|
913
913
|
*/
|
|
914
914
|
async handleRedirectToTask(data) {
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
//
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
915
|
+
const tokenId = data?.params[0]?.tokenId;
|
|
916
|
+
const newTaskUserId = data?.params[0]?.userId; // User assigned to the new task (from the backend)
|
|
917
|
+
const nodeId = data?.params[0]?.nodeId;
|
|
918
|
+
// Current user: prop > window.ProcessMaker.user > task assignee (when viewing assigned task)
|
|
919
|
+
const currentUserId = this.userId ?? window.ProcessMaker?.user?.id ?? this.task?.user?.id;
|
|
920
|
+
const elementDestType = this.task?.elementDestination?.type;
|
|
921
|
+
const userCanClaim = data?.params?.[0]?.userCanClaim;
|
|
922
|
+
// Redirect if the new task is assigned to the current user, or if it is taskSource
|
|
923
|
+
const isNewTaskForCurrentUser = tokenId && (newTaskUserId === currentUserId || (newTaskUserId == null && (elementDestType === 'displayNextAssignedTask' || elementDestType === 'taskSource')));
|
|
924
|
+
const isTaskSource = elementDestType === 'taskSource';
|
|
925
|
+
// Redirect when task is unclaimed and user can claim it (pool tasks)
|
|
926
|
+
const isUnclaimedAndClaimable = newTaskUserId === null && userCanClaim === true;
|
|
927
|
+
const shouldHandle = isNewTaskForCurrentUser || isTaskSource || isUnclaimedAndClaimable;
|
|
928
|
+
|
|
929
|
+
if (shouldHandle) {
|
|
930
|
+
this.loadingTask = true;
|
|
931
|
+
// Check if interstitial tasks are allowed for this task.
|
|
932
|
+
if (this.task && !(this.task.allow_interstitial || this.isSameUser(data))) {
|
|
933
|
+
window.location.href = await this.getDestinationUrl();
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
this.nodeId = nodeId;
|
|
937
|
+
this.taskId = tokenId;
|
|
938
|
+
|
|
939
|
+
// Force a redirect to ensure the correct task is loaded immediately for ConversationalForm.
|
|
940
|
+
if (this.renderComponent === "ConversationalForm") {
|
|
941
|
+
window.location.href = `/tasks/${this.taskId}/edit`;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
this.reload();
|
|
935
945
|
}
|
|
936
|
-
|
|
937
|
-
this.reload();
|
|
938
|
-
}
|
|
939
946
|
},
|
|
940
947
|
|
|
941
948
|
/**
|
|
942
|
-
* Checks if the
|
|
943
|
-
*
|
|
949
|
+
* Checks if the redirect applies to the current user.
|
|
950
|
+
* - userId of event = user assigned to the new task
|
|
951
|
+
* - It is considered a match if: new task assigned to the current user, or taskSource/displayNextAssignedTask with user null
|
|
944
952
|
*
|
|
945
|
-
* @param {Object} currentTask - The current task object.
|
|
946
953
|
* @param {Object} redirectData - The redirect data object.
|
|
947
954
|
*/
|
|
948
|
-
isSameUser(
|
|
949
|
-
const
|
|
950
|
-
const
|
|
951
|
-
|
|
955
|
+
isSameUser(redirectData) {
|
|
956
|
+
const newTaskUserId = redirectData?.params?.[0]?.userId;
|
|
957
|
+
const currentUserId = this.userId ?? window.ProcessMaker?.user?.id ?? this.task?.user?.id;
|
|
958
|
+
const elementDestType = this.task?.elementDestination?.type;
|
|
959
|
+
const userIdMatch = newTaskUserId === currentUserId
|
|
960
|
+
|| (newTaskUserId == null && (elementDestType === 'displayNextAssignedTask' || elementDestType === 'taskSource'));
|
|
961
|
+
const typeMatch = elementDestType === null || elementDestType === 'taskSource' || elementDestType === 'displayNextAssignedTask';
|
|
952
962
|
|
|
953
963
|
return userIdMatch && typeMatch;
|
|
954
964
|
},
|