@processmaker/screen-builder 3.1.1 → 3.2.1
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 +57 -47
- package/dist/vue-form-builder.es.js.map +1 -1
- package/dist/vue-form-builder.umd.js +42 -42
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/inspector/collection-data-source.vue +153 -155
- package/src/components/inspector/column-setup.vue +2 -3
- package/src/components/inspector/options-list.vue +32 -17
- package/src/components/screen-renderer.vue +1 -0
- package/src/components/task.vue +6 -1
- package/src/components/vue-form-builder.vue +1 -1
- package/src/components/vue-form-renderer.vue +2 -0
- package/src/form-builder-controls.js +1 -0
- package/src/mixins/extensions/PageNavigate.js +1 -0
package/package.json
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<div>
|
|
2
3
|
<div>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<pmql-input
|
|
4
|
+
<label for="collectionsource">{{ $t("Source of Record List") }}</label>
|
|
5
|
+
<b-form-select
|
|
6
|
+
id="collectionsource"
|
|
7
|
+
v-model="sourceOptions"
|
|
8
|
+
:options="sourceDisplayOptions"
|
|
9
|
+
data-cy="inspector-collection-data-source"
|
|
10
|
+
@change="displayOptionChange"
|
|
11
|
+
/>
|
|
12
|
+
<small class="mt-3 form-text text-muted">
|
|
13
|
+
{{ $t("A record list can display the data of a defined variable or a collection") }}
|
|
14
|
+
</small>
|
|
15
|
+
</div>
|
|
16
|
+
<div v-if="sourceOptions === 'Collection'" class="mt-2">
|
|
17
|
+
<CollectionRecordsList
|
|
18
|
+
v-model="collectionFields"
|
|
19
|
+
:record-pmql="pmql"
|
|
20
|
+
@change="collectionChanged"
|
|
21
|
+
/>
|
|
22
|
+
<pmql-input
|
|
24
23
|
v-model="pmql"
|
|
25
24
|
:search-type="'collections_w_mustaches'"
|
|
26
25
|
class="mt-3 mb-1"
|
|
@@ -31,172 +30,171 @@
|
|
|
31
30
|
:placeholder="$t('PMQL')"
|
|
32
31
|
>
|
|
33
32
|
</pmql-input>
|
|
34
|
-
<small class="mt-3 form-text text-muted">
|
|
35
|
-
$t("Leave this field empty to show all the records of the collection")
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
<small class="mt-3 form-text text-muted">
|
|
34
|
+
{{ $t("Leave this field empty to show all the records of the collection") }}
|
|
35
|
+
</small>
|
|
36
|
+
<label for="data-selection" class="mt-3">{{ $t("Data Selection") }}</label>
|
|
37
|
+
<b-form-select
|
|
38
|
+
id="data-selection"
|
|
39
|
+
v-model="dataSelectionOptions"
|
|
40
|
+
:options="dataSelectionDisplayOptions"
|
|
41
|
+
data-cy="inspector-collection-data-selection"
|
|
42
|
+
/>
|
|
43
|
+
<small class="mt-3 form-text text-muted">
|
|
44
|
+
{{ $t("The user can select specific data to be stored into a variable") }}
|
|
45
|
+
</small>
|
|
46
|
+
<div v-if="dataSelectionOptions === 'single-field'" class="mt-3">
|
|
47
|
+
<label for="single-columns">{{ $t("Column") }}</label>
|
|
39
48
|
<b-form-select
|
|
40
|
-
id="data-selection"
|
|
41
|
-
v-model="dataSelectionOptions"
|
|
42
|
-
:options="dataSelectionDisplayOptions"
|
|
43
|
-
data-cy="inspector-collection-data-selection"
|
|
44
|
-
/>
|
|
45
|
-
<small class="mt-3 form-text text-muted">{{
|
|
46
|
-
$t("The user can select specific data to be stored into a variable")
|
|
47
|
-
}}</small>
|
|
48
|
-
|
|
49
|
-
<div class="mt-3" v-if="dataSelectionOptions === 'single-field'">
|
|
50
|
-
<label id="single-columns">{{ $t('Column') }}</label>
|
|
51
|
-
<b-form-select
|
|
52
49
|
id="single-columns"
|
|
53
50
|
v-model="singleField"
|
|
54
51
|
:options="singleFieldOptions"
|
|
55
52
|
data-cy="inspector-collection-single-field"
|
|
56
53
|
>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</div>
|
|
54
|
+
<option disabled value="">{{ $t("Select a column") }}</option>
|
|
55
|
+
</b-form-select>
|
|
60
56
|
</div>
|
|
61
57
|
</div>
|
|
62
|
-
</
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
<script>
|
|
61
|
+
import { cloneDeep } from "lodash";
|
|
62
|
+
import CollectionRecordsList from "./collection-records-list.vue";
|
|
67
63
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
sourceDisplayOptions: [
|
|
64
|
+
const CONFIG_FIELDS = [
|
|
65
|
+
"collectionFields",
|
|
66
|
+
"collectionFieldsColumns",
|
|
67
|
+
"pmql",
|
|
68
|
+
"sourceOptions",
|
|
69
|
+
"variableStore",
|
|
70
|
+
"dataSelectionOptions",
|
|
71
|
+
"singleField"
|
|
72
|
+
];
|
|
73
|
+
export default {
|
|
74
|
+
components: {
|
|
75
|
+
CollectionRecordsList
|
|
76
|
+
},
|
|
77
|
+
props: ["value", "screenType"],
|
|
78
|
+
data() {
|
|
79
|
+
return {
|
|
80
|
+
fields: [],
|
|
81
|
+
sourceOptions: "Variable",
|
|
82
|
+
submitCollectionCheck: true,
|
|
83
|
+
collectionFields: [],
|
|
84
|
+
collectionFieldsColumns: [],
|
|
85
|
+
variableStore: null,
|
|
86
|
+
pmql: null,
|
|
87
|
+
sourceDisplayOptions: [
|
|
93
88
|
{
|
|
94
|
-
text: this.$t(
|
|
95
|
-
value:
|
|
89
|
+
text: this.$t("Variable"),
|
|
90
|
+
value: "Variable"
|
|
96
91
|
},
|
|
97
92
|
{
|
|
98
|
-
text: this.$t(
|
|
99
|
-
value:
|
|
100
|
-
}
|
|
93
|
+
text: this.$t("Collection"),
|
|
94
|
+
value: "Collection"
|
|
95
|
+
}
|
|
101
96
|
],
|
|
102
97
|
dataSelectionDisplayOptions: [
|
|
103
98
|
{
|
|
104
|
-
text: this.$t(
|
|
105
|
-
value:
|
|
99
|
+
text: this.$t("Do not allow selection"),
|
|
100
|
+
value: "no-selection"
|
|
106
101
|
},
|
|
107
102
|
{
|
|
108
|
-
text: this.$t(
|
|
109
|
-
value:
|
|
103
|
+
text: this.$t("Single field of record"),
|
|
104
|
+
value: "single-field"
|
|
110
105
|
},
|
|
111
106
|
{
|
|
112
|
-
text: this.$t(
|
|
113
|
-
value:
|
|
107
|
+
text: this.$t("Single record"),
|
|
108
|
+
value: "single-record"
|
|
114
109
|
},
|
|
115
110
|
{
|
|
116
|
-
text: this.$t(
|
|
117
|
-
value:
|
|
118
|
-
}
|
|
111
|
+
text: this.$t("Multiple records"),
|
|
112
|
+
value: "multiple-records"
|
|
113
|
+
}
|
|
119
114
|
],
|
|
120
|
-
dataSelectionOptions: "no-selection",
|
|
115
|
+
dataSelectionOptions: "no-selection",
|
|
121
116
|
collectionColumns: [],
|
|
122
117
|
singleFieldOptions: [],
|
|
123
118
|
singleField: null
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
this.$root.$emit("collection-changed", true);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
getCollectionColumns(records) {
|
|
143
|
-
const [firstRecord] = records?.dataRecordList || [];
|
|
144
|
-
|
|
145
|
-
if (firstRecord?.data) {
|
|
146
|
-
const dataObject = firstRecord.data;
|
|
147
|
-
|
|
148
|
-
for (const [key, value] of Object.entries(dataObject)) {
|
|
149
|
-
this.singleFieldOptions.push({ text: key, value: key });
|
|
150
|
-
}
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
computed: {
|
|
122
|
+
options() {
|
|
123
|
+
return Object.fromEntries(
|
|
124
|
+
CONFIG_FIELDS.map((field) => [field, this[field]])
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
watch: {
|
|
129
|
+
value: {
|
|
130
|
+
handler(value) {
|
|
131
|
+
if (!value) {
|
|
132
|
+
return;
|
|
151
133
|
}
|
|
134
|
+
CONFIG_FIELDS.forEach((field) => (this[field] = value[field]));
|
|
152
135
|
},
|
|
136
|
+
immediate: true
|
|
153
137
|
},
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
CONFIG_FIELDS.map((field) => [field, this[field]])
|
|
158
|
-
);
|
|
138
|
+
sourceOptions: {
|
|
139
|
+
handler(changeOption) {
|
|
140
|
+
this.$root.$emit("record-list-option", changeOption);
|
|
159
141
|
}
|
|
160
142
|
},
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
CONFIG_FIELDS.forEach((field) => (this[field] = value[field]));
|
|
168
|
-
},
|
|
169
|
-
immediate: true
|
|
170
|
-
},
|
|
171
|
-
sourceOptions: {
|
|
172
|
-
handler(changeOption) {
|
|
173
|
-
this.$root.$emit("record-list-option", changeOption);
|
|
174
|
-
}
|
|
143
|
+
collectionFields: {
|
|
144
|
+
handler(collectionFieldsData) {
|
|
145
|
+
this.getCollectionColumns(collectionFieldsData);
|
|
146
|
+
this.$root.$emit("record-list-collection", collectionFieldsData);
|
|
175
147
|
},
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
148
|
+
deep: true
|
|
149
|
+
},
|
|
150
|
+
pmql: {
|
|
151
|
+
handler(newPmql) {
|
|
152
|
+
this.$root.$emit("change-pmql", newPmql);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
submitCollectionCheck(newValue) {
|
|
156
|
+
this.submitCollectionCheck = newValue;
|
|
157
|
+
},
|
|
158
|
+
options: {
|
|
159
|
+
handler() {
|
|
160
|
+
this.$emit("input", this.options);
|
|
182
161
|
},
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
162
|
+
deep: true
|
|
163
|
+
},
|
|
164
|
+
dataSelectionOptions() {
|
|
165
|
+
this.singleField = null;
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
mounted() {
|
|
169
|
+
this.$root.$emit("record-list-option", this.sourceOptions);
|
|
170
|
+
},
|
|
171
|
+
methods: {
|
|
172
|
+
displayOptionChange() {
|
|
173
|
+
this.collectionFields = [];
|
|
174
|
+
this.collectionFieldsColumns = [];
|
|
175
|
+
this.pmql = null;
|
|
176
|
+
this.$root.$emit("collection-changed", true);
|
|
177
|
+
},
|
|
178
|
+
collectionChanged(data) {
|
|
179
|
+
if (Array.isArray(data)) {
|
|
180
|
+
const [firstItem] = data;
|
|
181
|
+
const collectionId = firstItem?.collection_id;
|
|
182
|
+
if (collectionId !== this.collectionFields.collectionId) {
|
|
183
|
+
this.$root.$emit("collection-changed", true);
|
|
186
184
|
}
|
|
187
|
-
},
|
|
188
|
-
submitCollectionCheck(newValue) {
|
|
189
|
-
this.submitCollectionCheck = newValue;
|
|
190
|
-
},
|
|
191
|
-
options: {
|
|
192
|
-
handler() {
|
|
193
|
-
this.$emit("input", this.options);
|
|
194
|
-
},
|
|
195
|
-
deep: true
|
|
196
|
-
},
|
|
197
|
-
dataSelectionOptions() {
|
|
198
|
-
this.singleField = null;
|
|
199
185
|
}
|
|
200
186
|
},
|
|
201
|
-
|
|
202
|
-
|
|
187
|
+
getCollectionColumns(records) {
|
|
188
|
+
const [firstRecord] = records?.dataRecordList || [];
|
|
189
|
+
|
|
190
|
+
if (firstRecord?.data) {
|
|
191
|
+
const dataObject = firstRecord.data;
|
|
192
|
+
|
|
193
|
+
for (const [key] of Object.entries(dataObject)) {
|
|
194
|
+
this.singleFieldOptions.push({ text: key, value: key });
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
</script>
|
|
@@ -360,10 +360,9 @@ export default {
|
|
|
360
360
|
mounted() {
|
|
361
361
|
this.initData();
|
|
362
362
|
this.$root.$on("record-list-option", (val) => {
|
|
363
|
-
this.$nextTick(()=>{
|
|
364
|
-
this.isCollection =
|
|
363
|
+
this.$nextTick(() => {
|
|
364
|
+
this.isCollection = val === "Collection";
|
|
365
365
|
});
|
|
366
|
-
|
|
367
366
|
});
|
|
368
367
|
this.$root.$on("record-list-collection", (collectionData) => {
|
|
369
368
|
this.getCollectionColumns(collectionData);
|
|
@@ -430,7 +430,7 @@ export default {
|
|
|
430
430
|
return this.value || 'content';
|
|
431
431
|
},
|
|
432
432
|
ariaLabelField() {
|
|
433
|
-
return this.
|
|
433
|
+
return this.ariaLabel || 'ariaLabel';
|
|
434
434
|
},
|
|
435
435
|
currentItemToDelete() {
|
|
436
436
|
if (this.removeIndex !== null
|
|
@@ -487,7 +487,7 @@ export default {
|
|
|
487
487
|
this.selectedEndPoint = this.options.selectedEndPoint,
|
|
488
488
|
this.key = this.options.key;
|
|
489
489
|
this.value = this.options.value;
|
|
490
|
-
this.optionAriaLabel = this.options.
|
|
490
|
+
this.optionAriaLabel = this.options.ariaLabel;
|
|
491
491
|
this.pmqlQuery = this.options.pmqlQuery;
|
|
492
492
|
this.defaultOptionKey= this.options.defaultOptionKey;
|
|
493
493
|
this.selectedOptions = this.options.selectedOptions;
|
|
@@ -549,12 +549,19 @@ export default {
|
|
|
549
549
|
}
|
|
550
550
|
this.optionsList = [];
|
|
551
551
|
const that = this;
|
|
552
|
-
jsonList.forEach
|
|
553
|
-
that.
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
552
|
+
jsonList.forEach((item) => {
|
|
553
|
+
if (that.renderAs === "checkbox") {
|
|
554
|
+
that.optionsList.push({
|
|
555
|
+
[that.keyField]: item[that.keyField],
|
|
556
|
+
[that.valueField]: item[that.valueField],
|
|
557
|
+
[that.ariaLabelField]: item[that.ariaLabelField]
|
|
558
|
+
});
|
|
559
|
+
} else {
|
|
560
|
+
that.optionsList.push({
|
|
561
|
+
[that.keyField]: item[that.keyField],
|
|
562
|
+
[that.valueField]: item[that.valueField]
|
|
563
|
+
});
|
|
564
|
+
}
|
|
558
565
|
});
|
|
559
566
|
this.jsonError = '';
|
|
560
567
|
},
|
|
@@ -582,7 +589,9 @@ export default {
|
|
|
582
589
|
this.editIndex = index;
|
|
583
590
|
this.optionContent = this.optionsList[index][this.valueField];
|
|
584
591
|
this.optionValue = this.optionsList[index][this.keyField];
|
|
585
|
-
this.
|
|
592
|
+
if (this.renderAs === "checkbox") {
|
|
593
|
+
this.optionAriaLabel = this.optionsList[index][this.ariaLabelField];
|
|
594
|
+
}
|
|
586
595
|
this.optionError = '';
|
|
587
596
|
},
|
|
588
597
|
showAddOption() {
|
|
@@ -602,22 +611,28 @@ export default {
|
|
|
602
611
|
this.optionError = 'An item with the same key already exists';
|
|
603
612
|
return;
|
|
604
613
|
}
|
|
605
|
-
this.
|
|
606
|
-
{
|
|
614
|
+
if (this.renderAs === "checkbox") {
|
|
615
|
+
this.optionsList.push({
|
|
607
616
|
[this.valueField]: this.optionContent,
|
|
608
617
|
[this.keyField]: this.optionValue,
|
|
609
|
-
[this.ariaLabelField]: this.optionAriaLabel
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
618
|
+
[this.ariaLabelField]: this.optionAriaLabel
|
|
619
|
+
});
|
|
620
|
+
} else {
|
|
621
|
+
this.optionsList.push({
|
|
622
|
+
[this.valueField]: this.optionContent,
|
|
623
|
+
[this.keyField]: this.optionValue
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
} else {
|
|
614
627
|
if (this.optionsList.find((item, index) => { return item[that.keyField] === this.optionValue && index !== this.editIndex ; })) {
|
|
615
628
|
this.optionError = 'An item with the same key already exists';
|
|
616
629
|
return;
|
|
617
630
|
}
|
|
618
631
|
this.optionsList[this.editIndex][this.keyField] = this.optionValue;
|
|
619
632
|
this.optionsList[this.editIndex][this.valueField] = this.optionContent;
|
|
620
|
-
this.
|
|
633
|
+
if (this.renderAs === "checkbox") {
|
|
634
|
+
this.optionsList[this.editIndex][this.ariaLabelField] = this.optionAriaLabel;
|
|
635
|
+
}
|
|
621
636
|
}
|
|
622
637
|
|
|
623
638
|
this.jsonData = JSON.stringify(this.optionsList);
|
package/src/components/task.vue
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
:key="refreshScreen"
|
|
33
33
|
:loop-context="loopContext"
|
|
34
34
|
:taskdraft="this.task"
|
|
35
|
+
@update-page-task="pageUpdate"
|
|
35
36
|
@update="onUpdate"
|
|
36
37
|
@after-submit="afterSubmit"
|
|
37
38
|
@submit="submit"
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
:watchers="screen.watchers"
|
|
51
52
|
:data="requestData"
|
|
52
53
|
:type="screen.type"
|
|
54
|
+
@update-page-task="pageUpdate"
|
|
53
55
|
@update="onUpdate"
|
|
54
56
|
@after-submit="afterSubmit"
|
|
55
57
|
@submit="submit"
|
|
@@ -107,7 +109,7 @@ export default {
|
|
|
107
109
|
alwaysAllowEditing: { type: Boolean, default: false },
|
|
108
110
|
disableInterstitial: { type: Boolean, default: false },
|
|
109
111
|
waitLoadingListeners: { type: Boolean, default: false },
|
|
110
|
-
isWebEntry: { type: Boolean, default: false }
|
|
112
|
+
isWebEntry: { type: Boolean, default: false }
|
|
111
113
|
},
|
|
112
114
|
data() {
|
|
113
115
|
return {
|
|
@@ -365,6 +367,9 @@ export default {
|
|
|
365
367
|
this.hasErrors = false;
|
|
366
368
|
}
|
|
367
369
|
},
|
|
370
|
+
pageUpdate() {
|
|
371
|
+
this.$emit("updated-page-core");
|
|
372
|
+
},
|
|
368
373
|
resetScreenState() {
|
|
369
374
|
this.loadingButton = false;
|
|
370
375
|
this.disabled = false;
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
class="p-0"
|
|
20
20
|
:loop-context="loopContext"
|
|
21
21
|
:taskdraft="taskdraft"
|
|
22
|
+
@updatePage="setCurrentPage"
|
|
22
23
|
@after-submit="afterSubmit"
|
|
23
24
|
@submit="submit"
|
|
24
25
|
/>
|
|
@@ -361,6 +362,7 @@ export default {
|
|
|
361
362
|
return this.$refs.renderer.getCurrentPage();
|
|
362
363
|
},
|
|
363
364
|
setCurrentPage(page) {
|
|
365
|
+
this.$emit("update-page-task");
|
|
364
366
|
this.$refs.renderer.setCurrentPage(page);
|
|
365
367
|
},
|
|
366
368
|
onContainerObserver(entries) {
|