@processmaker/screen-builder 3.8.42 → 3.8.44
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 +2004 -1967
- package/dist/vue-form-builder.es.js.map +1 -1
- package/dist/vue-form-builder.umd.js +32 -32
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/package.json +7 -2
- package/src/components/inspector/collection-data-source.vue +21 -15
- package/src/components/inspector/collection-records-list.vue +6 -9
- package/src/components/renderer/collection-record-mode.js +6 -0
- package/src/components/renderer/form-collection-record-control.vue +9 -2
- package/src/components/task.vue +60 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@processmaker/screen-builder",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.44",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "VITE_COVERAGE=true vite",
|
|
6
6
|
"build": "vite build",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
63
63
|
"@panter/vue-i18next": "^0.15.2",
|
|
64
64
|
"@processmaker/vue-form-elements": "0.65.11",
|
|
65
|
-
"@processmaker/vue-multiselect": "2.3.
|
|
65
|
+
"@processmaker/vue-multiselect": "2.3.3",
|
|
66
66
|
"@storybook/addon-essentials": "^7.6.13",
|
|
67
67
|
"@storybook/addon-interactions": "^7.6.13",
|
|
68
68
|
"@storybook/addon-links": "^7.6.13",
|
|
@@ -154,5 +154,10 @@
|
|
|
154
154
|
".js",
|
|
155
155
|
".vue"
|
|
156
156
|
]
|
|
157
|
+
},
|
|
158
|
+
"processmaker": {
|
|
159
|
+
"downstream": [
|
|
160
|
+
"modeler"
|
|
161
|
+
]
|
|
157
162
|
}
|
|
158
163
|
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<CollectionRecordsList
|
|
18
18
|
v-model="collectionFields"
|
|
19
19
|
:record-pmql="pmql"
|
|
20
|
-
@
|
|
20
|
+
@collection-id-changed="collectionIdChanged"
|
|
21
21
|
/>
|
|
22
22
|
<pmql-input
|
|
23
23
|
v-model="pmql"
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
v-model="dataSelectionOptions"
|
|
40
40
|
:options="dataSelectionDisplayOptions"
|
|
41
41
|
data-cy="inspector-collection-data-selection"
|
|
42
|
+
@change="dataSelectionChanged"
|
|
42
43
|
/>
|
|
43
44
|
<small class="mt-3 form-text text-muted">
|
|
44
45
|
{{ $t("The user can select specific data to be stored into a variable") }}
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
<label for="single-columns">{{ $t("Column") }}</label>
|
|
48
49
|
<b-form-select
|
|
49
50
|
id="single-columns"
|
|
50
|
-
v-model="
|
|
51
|
+
v-model="normalizedSingleField"
|
|
51
52
|
:options="singleFieldOptions"
|
|
52
53
|
data-cy="inspector-collection-single-field"
|
|
53
54
|
>
|
|
@@ -58,9 +59,11 @@
|
|
|
58
59
|
</div>
|
|
59
60
|
</template>
|
|
60
61
|
<script>
|
|
61
|
-
import { cloneDeep } from "lodash";
|
|
62
62
|
import CollectionRecordsList from "./collection-records-list.vue";
|
|
63
|
-
import {
|
|
63
|
+
import {
|
|
64
|
+
getCollectionFieldOptions,
|
|
65
|
+
normalizeCollectionFieldPath
|
|
66
|
+
} from "../../collectionFieldUtils";
|
|
64
67
|
|
|
65
68
|
const CONFIG_FIELDS = [
|
|
66
69
|
"collectionFields",
|
|
@@ -124,6 +127,14 @@ export default {
|
|
|
124
127
|
return Object.fromEntries(
|
|
125
128
|
CONFIG_FIELDS.map((field) => [field, this[field]])
|
|
126
129
|
);
|
|
130
|
+
},
|
|
131
|
+
normalizedSingleField: {
|
|
132
|
+
get() {
|
|
133
|
+
return normalizeCollectionFieldPath(this.singleField);
|
|
134
|
+
},
|
|
135
|
+
set(value) {
|
|
136
|
+
this.singleField = value;
|
|
137
|
+
}
|
|
127
138
|
}
|
|
128
139
|
},
|
|
129
140
|
watch: {
|
|
@@ -133,6 +144,7 @@ export default {
|
|
|
133
144
|
return;
|
|
134
145
|
}
|
|
135
146
|
CONFIG_FIELDS.forEach((field) => (this[field] = value[field]));
|
|
147
|
+
this.getCollectionColumns(this.collectionFields);
|
|
136
148
|
},
|
|
137
149
|
immediate: true
|
|
138
150
|
},
|
|
@@ -161,9 +173,6 @@ export default {
|
|
|
161
173
|
this.$emit("input", this.options);
|
|
162
174
|
},
|
|
163
175
|
deep: true
|
|
164
|
-
},
|
|
165
|
-
dataSelectionOptions() {
|
|
166
|
-
this.singleField = null;
|
|
167
176
|
}
|
|
168
177
|
},
|
|
169
178
|
mounted() {
|
|
@@ -176,14 +185,11 @@ export default {
|
|
|
176
185
|
this.pmql = null;
|
|
177
186
|
this.$root.$emit("collection-changed", true);
|
|
178
187
|
},
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
this.$root.$emit("collection-changed", true);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
188
|
+
collectionIdChanged() {
|
|
189
|
+
this.$root.$emit("collection-changed", true);
|
|
190
|
+
},
|
|
191
|
+
dataSelectionChanged() {
|
|
192
|
+
this.singleField = null;
|
|
187
193
|
},
|
|
188
194
|
getCollectionColumns(records) {
|
|
189
195
|
this.singleFieldOptions = getCollectionFieldOptions(records);
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
v-model="collectionId"
|
|
9
9
|
:options="collections"
|
|
10
10
|
data-cy="inspector-collection"
|
|
11
|
+
@change="onCollectionIdChange"
|
|
11
12
|
/>
|
|
12
13
|
<b-form-text class="mt-2">
|
|
13
14
|
{{ $t("Collection Record Control is not available for Anonymous Web Entry") }}
|
|
@@ -29,8 +30,6 @@
|
|
|
29
30
|
|
|
30
31
|
<script>
|
|
31
32
|
import { debounce } from "lodash";
|
|
32
|
-
import MustacheHelper from "./mustache-helper.vue";
|
|
33
|
-
import ScreenVariableSelector from "../screen-variable-selector.vue";
|
|
34
33
|
|
|
35
34
|
const CONFIG_FIELDS = [
|
|
36
35
|
"collectionId",
|
|
@@ -40,10 +39,6 @@ const CONFIG_FIELDS = [
|
|
|
40
39
|
];
|
|
41
40
|
|
|
42
41
|
export default {
|
|
43
|
-
components: {
|
|
44
|
-
MustacheHelper,
|
|
45
|
-
ScreenVariableSelector
|
|
46
|
-
},
|
|
47
42
|
props: ["value"],
|
|
48
43
|
data() {
|
|
49
44
|
return {
|
|
@@ -111,13 +106,15 @@ export default {
|
|
|
111
106
|
});
|
|
112
107
|
},
|
|
113
108
|
methods: {
|
|
114
|
-
|
|
109
|
+
onCollectionIdChange(collectionId) {
|
|
110
|
+
this.$emit("collection-id-changed", collectionId);
|
|
111
|
+
},
|
|
112
|
+
loadCollectionRecords() {
|
|
115
113
|
this.$dataProvider
|
|
116
114
|
.getCollectionRecordsList(this.collectionId)
|
|
117
115
|
.then((response) => {
|
|
118
116
|
this.dataRecordList = response.data;
|
|
119
117
|
});
|
|
120
|
-
this.$emit('change', this.dataRecordList);
|
|
121
118
|
},
|
|
122
119
|
getCollections() {
|
|
123
120
|
this.$dataProvider.getCollections().then((response) => {
|
|
@@ -158,7 +155,7 @@ export default {
|
|
|
158
155
|
value: field.field
|
|
159
156
|
}));
|
|
160
157
|
|
|
161
|
-
this.
|
|
158
|
+
this.loadCollectionRecords();
|
|
162
159
|
});
|
|
163
160
|
},
|
|
164
161
|
onNLQConversion(pmql) {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import _ from "lodash";
|
|
18
18
|
import VueFormRenderer from "../vue-form-renderer.vue";
|
|
19
19
|
import CollectionRecordsList from "../inspector/collection-records-list.vue";
|
|
20
|
+
import resolveCollectionMode from "./collection-record-mode";
|
|
20
21
|
|
|
21
22
|
const globalObject = typeof window === "undefined" ? global : window;
|
|
22
23
|
|
|
@@ -120,7 +121,7 @@ export default {
|
|
|
120
121
|
this.loadRecordCollection(
|
|
121
122
|
this.collection.collectionId,
|
|
122
123
|
record,
|
|
123
|
-
this.
|
|
124
|
+
this.getCollectionMode()
|
|
124
125
|
);
|
|
125
126
|
} else {
|
|
126
127
|
if (this.isMustache(record)) {
|
|
@@ -154,7 +155,7 @@ export default {
|
|
|
154
155
|
this.hasMustache = true;
|
|
155
156
|
}
|
|
156
157
|
|
|
157
|
-
const collectionMode = this.
|
|
158
|
+
const collectionMode = this.getCollectionMode();
|
|
158
159
|
|
|
159
160
|
this.loadRecordCollection(
|
|
160
161
|
this.collection.collectionId,
|
|
@@ -164,6 +165,12 @@ export default {
|
|
|
164
165
|
}
|
|
165
166
|
},
|
|
166
167
|
methods: {
|
|
168
|
+
getCollectionMode() {
|
|
169
|
+
return resolveCollectionMode(
|
|
170
|
+
this.collectionmode,
|
|
171
|
+
this.defaultCollectionMode
|
|
172
|
+
);
|
|
173
|
+
},
|
|
167
174
|
isSubmitButton(item) {
|
|
168
175
|
return (
|
|
169
176
|
item.config &&
|
package/src/components/task.vue
CHANGED
|
@@ -534,39 +534,47 @@ export default {
|
|
|
534
534
|
// If the task has not an origin source it should re redirected top the tasks List as default.
|
|
535
535
|
return document.referrer || '/tasks';
|
|
536
536
|
},
|
|
537
|
-
loadNextAssignedTask(requestId = null) {
|
|
537
|
+
loadNextAssignedTask(requestId = null, taskId = null) {
|
|
538
538
|
if (!requestId) {
|
|
539
539
|
requestId = this.requestId;
|
|
540
540
|
}
|
|
541
541
|
if (!this.userId) {
|
|
542
|
-
return;
|
|
542
|
+
return false;
|
|
543
543
|
}
|
|
544
544
|
const timestamp = !window.Cypress ? `&t=${Date.now()}` : "";
|
|
545
|
-
const
|
|
545
|
+
const taskIdFilter = taskId ? `&task_id=${encodeURIComponent(taskId)}` : "";
|
|
546
|
+
const url = `?user_id=${this.userId}&status=ACTIVE&process_request_id=${requestId}&include_sub_tasks=1${taskIdFilter}${timestamp}`;
|
|
546
547
|
return this.$dataProvider
|
|
547
548
|
.getTasks(url).then((response) => {
|
|
548
549
|
this.$emit("load-data-task", response);
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
550
|
+
const tasks = response.data.data;
|
|
551
|
+
const task = taskId
|
|
552
|
+
? tasks.find(({ id }) => String(id) === String(taskId))
|
|
553
|
+
: tasks[0];
|
|
554
|
+
if (task) {
|
|
555
|
+
const requiresWebEntryFallback = this.isWebEntry
|
|
556
|
+
&& task.web_entry_available === false;
|
|
557
|
+
if (task.process_request_id !== this.requestId || requiresWebEntryFallback) {
|
|
558
|
+
// Cross-request transitions and non-Web Entry tasks require a hard redirect.
|
|
553
559
|
if (this.redirecting === task.process_request_id) {
|
|
554
|
-
return;
|
|
560
|
+
return true;
|
|
555
561
|
}
|
|
556
562
|
this.unsubscribeSocketListeners();
|
|
557
563
|
this.redirecting = task.process_request_id;
|
|
558
|
-
|
|
559
|
-
|
|
564
|
+
// Screen Builder uses Vue 2, where emitted events have no runtime emits contract.
|
|
565
|
+
this.$emit('redirect', this.isWebEntry ? task : task.id, true); // NOSONAR
|
|
566
|
+
return true;
|
|
560
567
|
} else {
|
|
561
568
|
this.emitIfTaskCompleted(requestId);
|
|
562
569
|
}
|
|
563
570
|
this.taskId = task.id;
|
|
564
571
|
this.nodeId = task.element_id;
|
|
565
572
|
this.loadTask();
|
|
566
|
-
} else if (this.parentRequest && ['COMPLETED', 'CLOSED'].includes(this.task.process_request.status)) {
|
|
573
|
+
} else if (!taskId && this.parentRequest && ['COMPLETED', 'CLOSED'].includes(this.task.process_request.status)) {
|
|
567
574
|
this.$emit('completed', this.getAllowedRequestId());
|
|
568
575
|
}
|
|
569
576
|
this.disabled = false;
|
|
577
|
+
return Boolean(task);
|
|
570
578
|
});
|
|
571
579
|
},
|
|
572
580
|
emitIfTaskCompleted(requestId) {
|
|
@@ -641,24 +649,27 @@ export default {
|
|
|
641
649
|
* @param {Function} apiCall - The API call to be made.
|
|
642
650
|
* @param {number} retries - The number of retry attempts.
|
|
643
651
|
* @param {number} delay - The delay between retries in milliseconds.
|
|
652
|
+
* @param {Function} shouldRetry - Determines whether a successful response should be retried.
|
|
644
653
|
* @returns {Promise} - The response from the API call.
|
|
645
654
|
*/
|
|
646
655
|
// eslint-disable-next-line consistent-return
|
|
647
|
-
async retryApiCall(apiCall, retries = 3, delay = 1000) {
|
|
656
|
+
async retryApiCall(apiCall, retries = 3, delay = 1000, shouldRetry = () => false) {
|
|
648
657
|
for (let attempt = 0; attempt < retries; attempt++) {
|
|
649
658
|
try {
|
|
650
659
|
// eslint-disable-next-line no-await-in-loop
|
|
651
660
|
const response = await apiCall();
|
|
652
|
-
|
|
661
|
+
if (!shouldRetry(response) || attempt === retries - 1) {
|
|
662
|
+
return response;
|
|
663
|
+
}
|
|
653
664
|
} catch (error) {
|
|
654
665
|
if (attempt === retries - 1) {
|
|
655
666
|
throw error;
|
|
656
667
|
}
|
|
657
|
-
// eslint-disable-next-line no-await-in-loop
|
|
658
|
-
await new Promise((resolve) => {
|
|
659
|
-
setTimeout(resolve, delay);
|
|
660
|
-
});
|
|
661
668
|
}
|
|
669
|
+
// eslint-disable-next-line no-await-in-loop
|
|
670
|
+
await new Promise((resolve) => {
|
|
671
|
+
setTimeout(resolve, delay);
|
|
672
|
+
});
|
|
662
673
|
}
|
|
663
674
|
},
|
|
664
675
|
/**
|
|
@@ -919,6 +930,31 @@ export default {
|
|
|
919
930
|
}
|
|
920
931
|
},
|
|
921
932
|
|
|
933
|
+
async handleWebEntryTaskRedirect(data, tokenId) {
|
|
934
|
+
let taskHandled = false;
|
|
935
|
+
try {
|
|
936
|
+
taskHandled = await this.retryApiCall(
|
|
937
|
+
() => this.loadNextAssignedTask(this.requestId, tokenId),
|
|
938
|
+
3,
|
|
939
|
+
1000,
|
|
940
|
+
(handled) => handled !== true
|
|
941
|
+
);
|
|
942
|
+
} catch (error) {
|
|
943
|
+
taskHandled = false;
|
|
944
|
+
} finally {
|
|
945
|
+
if (!taskHandled) {
|
|
946
|
+
this.loadingTask = false;
|
|
947
|
+
this.disabled = false;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
if (!taskHandled) {
|
|
952
|
+
const fallbackUrl = data?.params?.[0]?.payloadUrl
|
|
953
|
+
|| (tokenId ? `/tasks/${tokenId}/edit` : `/requests/${this.requestId}`);
|
|
954
|
+
window.location.href = fallbackUrl;
|
|
955
|
+
}
|
|
956
|
+
},
|
|
957
|
+
|
|
922
958
|
/**
|
|
923
959
|
* Handles the 'redirectToTask' event by loading the specified task.
|
|
924
960
|
* Updates the current task ID and reloads the task data.
|
|
@@ -947,6 +983,13 @@ export default {
|
|
|
947
983
|
window.location.href = await this.getDestinationUrl();
|
|
948
984
|
return;
|
|
949
985
|
}
|
|
986
|
+
|
|
987
|
+
// Web Entry needs the complete task to preserve the target request context.
|
|
988
|
+
if (this.isWebEntry) {
|
|
989
|
+
await this.handleWebEntryTaskRedirect(data, tokenId);
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
|
|
950
993
|
this.nodeId = nodeId;
|
|
951
994
|
this.taskId = tokenId;
|
|
952
995
|
|