@processmaker/screen-builder 3.8.40 → 3.8.41
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.es.js +5465 -5339
- package/dist/vue-form-builder.es.js.map +1 -1
- package/dist/vue-form-builder.umd.js +40 -40
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/renderer/file-download.vue +9 -0
- package/src/components/renderer/form-record-list-selection.js +219 -0
- package/src/components/renderer/form-record-list.vue +78 -64
- package/src/mixins/ScreenBase.js +25 -4
- package/src/mixins/extensions/DataManager.js +5 -2
- package/src/mixins/extensions/LoadFieldComponents.js +6 -3
package/package.json
CHANGED
|
@@ -121,6 +121,9 @@ export default {
|
|
|
121
121
|
this.setFilesInfo();
|
|
122
122
|
},
|
|
123
123
|
methods: {
|
|
124
|
+
isWebEntryTemporaryFileId(fileId) {
|
|
125
|
+
return typeof fileId === "string" && fileId.startsWith("webentry_");
|
|
126
|
+
},
|
|
124
127
|
downloadFile(file) {
|
|
125
128
|
if (this.collection) {
|
|
126
129
|
this.downloadCollectionFile(file);
|
|
@@ -209,6 +212,12 @@ export default {
|
|
|
209
212
|
const fileId = this.value
|
|
210
213
|
? this.value
|
|
211
214
|
: _.get(this.requestData, this.fileDataName, null);
|
|
215
|
+
|
|
216
|
+
if (this.isWebEntryTemporaryFileId(fileId)) {
|
|
217
|
+
this.filesInfo = [];
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
|
|
212
221
|
let { endpoint } = this;
|
|
213
222
|
|
|
214
223
|
if (this.requestFiles) {
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers for FormRecordList collection radio/checkbox selection.
|
|
3
|
+
* Kept outside the Vue SFC so unit tests can exercise production logic
|
|
4
|
+
* without mounting the heavy FormRecordList component tree.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
mapCollectionRecordData,
|
|
9
|
+
normalizeCollectionFieldPath
|
|
10
|
+
} from "../../collectionFieldUtils";
|
|
11
|
+
|
|
12
|
+
export function isSingleFieldSelectionMode(source) {
|
|
13
|
+
return (
|
|
14
|
+
source?.dataSelectionOptions === "single-field" ||
|
|
15
|
+
(source?.dataSelectionOptions == null && !!source?.singleField)
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function uniqueFieldKeys(...keys) {
|
|
20
|
+
return keys.filter(
|
|
21
|
+
(key, index, arr) => key != null && key !== "" && arr.indexOf(key) === index
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Resolve the configured singleField value from a collection row.
|
|
27
|
+
* Rows are remapped from collection field names (content) to column keys,
|
|
28
|
+
* so singleField may not match Object.keys(row) directly.
|
|
29
|
+
* Supports legacy `data.` prefixed field paths via collectionFieldUtils.
|
|
30
|
+
*/
|
|
31
|
+
export function getSingleFieldValue(selectedItem, source, fields) {
|
|
32
|
+
const rawField = source?.singleField;
|
|
33
|
+
const normalizedField = normalizeCollectionFieldPath(rawField);
|
|
34
|
+
if (!normalizedField || !selectedItem || typeof selectedItem !== "object") {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
for (const key of uniqueFieldKeys(normalizedField, rawField)) {
|
|
39
|
+
if (Object.hasOwn(selectedItem, key)) {
|
|
40
|
+
return selectedItem[key];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const optionsList = fields?.optionsList || [];
|
|
45
|
+
const byContent = optionsList.find(
|
|
46
|
+
(opt) =>
|
|
47
|
+
normalizeCollectionFieldPath(opt.content) === normalizedField ||
|
|
48
|
+
opt.content === rawField
|
|
49
|
+
);
|
|
50
|
+
if (byContent) {
|
|
51
|
+
for (const key of uniqueFieldKeys(
|
|
52
|
+
normalizeCollectionFieldPath(byContent.key),
|
|
53
|
+
byContent.key
|
|
54
|
+
)) {
|
|
55
|
+
if (Object.hasOwn(selectedItem, key)) {
|
|
56
|
+
return selectedItem[key];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const byKey = optionsList.find(
|
|
62
|
+
(opt) =>
|
|
63
|
+
normalizeCollectionFieldPath(opt.key) === normalizedField ||
|
|
64
|
+
opt.key === rawField
|
|
65
|
+
);
|
|
66
|
+
if (byKey) {
|
|
67
|
+
for (const key of uniqueFieldKeys(
|
|
68
|
+
normalizeCollectionFieldPath(byKey.key),
|
|
69
|
+
byKey.key
|
|
70
|
+
)) {
|
|
71
|
+
if (Object.hasOwn(selectedItem, key)) {
|
|
72
|
+
return selectedItem[key];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const lower = String(normalizedField).toLowerCase();
|
|
78
|
+
const matchedKey = Object.keys(selectedItem).find(
|
|
79
|
+
(key) =>
|
|
80
|
+
String(normalizeCollectionFieldPath(key)).toLowerCase() === lower
|
|
81
|
+
);
|
|
82
|
+
return matchedKey ? selectedItem[matchedKey] : undefined;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function rowMatchesSingleFieldValue(row, value, source, fields) {
|
|
86
|
+
return getSingleFieldValue(row, source, fields) === value;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Convert a b-table page-relative cell index into a global row index.
|
|
91
|
+
* @change already provides a page-relative index; do not pass a global
|
|
92
|
+
* index here or the page offset will be applied twice.
|
|
93
|
+
*/
|
|
94
|
+
export function toGlobalRowIndex(pageRelativeIndex, currentPage, perPage) {
|
|
95
|
+
return (currentPage - 1) * perPage + pageRelativeIndex;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Build the value emitted for a radio selection.
|
|
100
|
+
* Returns undefined for missing single-field values (caller should not emit).
|
|
101
|
+
*/
|
|
102
|
+
export function buildRadioSelectionValue(
|
|
103
|
+
selectedItem,
|
|
104
|
+
pageRelativeIndex,
|
|
105
|
+
currentPage,
|
|
106
|
+
perPage,
|
|
107
|
+
source,
|
|
108
|
+
fields
|
|
109
|
+
) {
|
|
110
|
+
if (isSingleFieldSelectionMode(source) && source?.singleField) {
|
|
111
|
+
return getSingleFieldValue(selectedItem, source, fields);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
...selectedItem,
|
|
116
|
+
selectedRowIndex: toGlobalRowIndex(
|
|
117
|
+
pageRelativeIndex,
|
|
118
|
+
currentPage,
|
|
119
|
+
perPage
|
|
120
|
+
)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function getCollectionRowKey(item) {
|
|
125
|
+
if (!item || typeof item !== "object") {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const entries = Object.entries(item).filter(
|
|
130
|
+
([key]) => key !== "selectedRowsIndex" && key !== "selectedRowIndex"
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
if (entries.length === 0) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
entries.sort(([keyA], [keyB]) => {
|
|
138
|
+
if (keyA > keyB) return 1;
|
|
139
|
+
if (keyA < keyB) return -1;
|
|
140
|
+
return 0;
|
|
141
|
+
});
|
|
142
|
+
return JSON.stringify(entries);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function findSingleRecordRadioMatch(value, rows) {
|
|
146
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const valueKey = getCollectionRowKey(value);
|
|
151
|
+
if (valueKey) {
|
|
152
|
+
const byContent = rows.find(
|
|
153
|
+
(row) => getCollectionRowKey(row) === valueKey
|
|
154
|
+
);
|
|
155
|
+
if (byContent) {
|
|
156
|
+
return byContent;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const idx = value.selectedRowIndex;
|
|
161
|
+
if (idx != null && idx >= 0 && idx < rows.length) {
|
|
162
|
+
return rows[idx];
|
|
163
|
+
}
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function findRadioSelectionMatch(value, rows, source, fields) {
|
|
168
|
+
if (value == null || value === "" || !Array.isArray(rows) || rows.length === 0) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (isSingleFieldSelectionMode(source) && source?.singleField) {
|
|
173
|
+
return (
|
|
174
|
+
rows.find((row) =>
|
|
175
|
+
rowMatchesSingleFieldValue(row, value, source, fields)
|
|
176
|
+
) || null
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (typeof value === "object" && !Array.isArray(value)) {
|
|
181
|
+
return findSingleRecordRadioMatch(value, rows);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Remap collection API rows from field content names to column keys using
|
|
189
|
+
* collectionFieldUtils, always preserving the configured singleField.
|
|
190
|
+
*/
|
|
191
|
+
export function remapCollectionRowData(dataObject, optionsList, singleField) {
|
|
192
|
+
const sourceData = dataObject || {};
|
|
193
|
+
const mapped = mapCollectionRecordData(sourceData, optionsList || []);
|
|
194
|
+
|
|
195
|
+
if (!singleField) {
|
|
196
|
+
return mapped;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const normalizedField = normalizeCollectionFieldPath(singleField);
|
|
200
|
+
const directSourceKey = uniqueFieldKeys(
|
|
201
|
+
singleField,
|
|
202
|
+
normalizedField,
|
|
203
|
+
`data.${normalizedField}`
|
|
204
|
+
).find((candidate) => Object.hasOwn(sourceData, candidate));
|
|
205
|
+
|
|
206
|
+
if (directSourceKey) {
|
|
207
|
+
mapped[normalizedField] = sourceData[directSourceKey];
|
|
208
|
+
return mapped;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const matchedKey = Object.keys(sourceData).find(
|
|
212
|
+
(key) => normalizeCollectionFieldPath(key) === normalizedField
|
|
213
|
+
);
|
|
214
|
+
if (matchedKey) {
|
|
215
|
+
mapped[normalizedField] = sourceData[matchedKey];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return mapped;
|
|
219
|
+
}
|
|
@@ -259,10 +259,13 @@ import VueFormRenderer from "@/components/vue-form-renderer.vue";
|
|
|
259
259
|
import mustacheEvaluation from "../../mixins/mustacheEvaluation";
|
|
260
260
|
import MustacheHelper from "../inspector/mustache-helper.vue";
|
|
261
261
|
import Mustache from "mustache";
|
|
262
|
+
import { normalizeCollectionFieldPath } from "../../collectionFieldUtils";
|
|
262
263
|
import {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
buildRadioSelectionValue,
|
|
265
|
+
findRadioSelectionMatch,
|
|
266
|
+
getCollectionRowKey,
|
|
267
|
+
remapCollectionRowData
|
|
268
|
+
} from "./form-record-list-selection";
|
|
266
269
|
|
|
267
270
|
const jsonOptionsActionsColumn = {
|
|
268
271
|
key: "__actions",
|
|
@@ -478,12 +481,15 @@ export default {
|
|
|
478
481
|
},
|
|
479
482
|
// Watch for changes in validationData to handle any Mustache variable changes
|
|
480
483
|
validationData: {
|
|
481
|
-
handler(
|
|
482
|
-
if (this.source?.sourceOptions === "Collection"
|
|
483
|
-
this.
|
|
484
|
-
|
|
485
|
-
this.
|
|
486
|
-
|
|
484
|
+
handler() {
|
|
485
|
+
if (this.source?.sourceOptions === "Collection") {
|
|
486
|
+
const pmql = this.getCollectionPmql();
|
|
487
|
+
if (pmql) {
|
|
488
|
+
this.onCollectionChange(
|
|
489
|
+
this.source?.collectionFields?.collectionId,
|
|
490
|
+
pmql
|
|
491
|
+
);
|
|
492
|
+
}
|
|
487
493
|
}
|
|
488
494
|
},
|
|
489
495
|
deep: true,
|
|
@@ -504,7 +510,10 @@ export default {
|
|
|
504
510
|
}
|
|
505
511
|
|
|
506
512
|
if(this.source?.sourceOptions === "Collection") {
|
|
507
|
-
this.onCollectionChange(
|
|
513
|
+
this.onCollectionChange(
|
|
514
|
+
this.source?.collectionFields?.collectionId,
|
|
515
|
+
this.getCollectionPmql()
|
|
516
|
+
);
|
|
508
517
|
}
|
|
509
518
|
|
|
510
519
|
this.setStyleMode(this.designerMode?.designerOptions);
|
|
@@ -580,20 +589,53 @@ export default {
|
|
|
580
589
|
}
|
|
581
590
|
},
|
|
582
591
|
componentOutput(data) {
|
|
583
|
-
|
|
592
|
+
// Avoid emitting undefined, which would leave the bound variable as null
|
|
593
|
+
// and lose the selection when submitting to the next task.
|
|
594
|
+
if (typeof data === "undefined") {
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
this.$emit("input", data);
|
|
598
|
+
// Also write directly to validationData (screen vdata). Submit reads vdata, and
|
|
599
|
+
// v-model/@input listener order can drop object selections before they sync.
|
|
600
|
+
this.persistValueToFormData(data);
|
|
584
601
|
},
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
this.componentOutput(valueOfColumn);
|
|
593
|
-
} else {
|
|
594
|
-
selectedItem = { ...selectedItem, selectedRowIndex: globalIndex};
|
|
595
|
-
this.componentOutput(selectedItem);
|
|
602
|
+
persistValueToFormData(data) {
|
|
603
|
+
if (
|
|
604
|
+
!this.name ||
|
|
605
|
+
!this.validationData ||
|
|
606
|
+
typeof this.validationData !== "object"
|
|
607
|
+
) {
|
|
608
|
+
return;
|
|
596
609
|
}
|
|
610
|
+
if (String(this.name).includes(".")) {
|
|
611
|
+
_.set(this.validationData, this.name, data);
|
|
612
|
+
const rootKey = String(this.name).split(".")[0];
|
|
613
|
+
this.$set(this.validationData, rootKey, this.validationData[rootKey]);
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
this.$set(this.validationData, this.name, data);
|
|
617
|
+
},
|
|
618
|
+
getCollectionPmql() {
|
|
619
|
+
// PMQL can live on source.pmql and/or source.collectionFields.pmql depending
|
|
620
|
+
// on how the inspector synced the config; prefer the nested copy when present.
|
|
621
|
+
const nestedPmql = this.source?.collectionFields?.pmql;
|
|
622
|
+
if (typeof nestedPmql === "string") {
|
|
623
|
+
return nestedPmql;
|
|
624
|
+
}
|
|
625
|
+
return this.source?.pmql || "";
|
|
626
|
+
},
|
|
627
|
+
onRadioChange(selectedItem, pageRelativeIndex) {
|
|
628
|
+
// b-table cell slot `index` is page-relative; convert once here.
|
|
629
|
+
this.componentOutput(
|
|
630
|
+
buildRadioSelectionValue(
|
|
631
|
+
selectedItem,
|
|
632
|
+
pageRelativeIndex,
|
|
633
|
+
this.currentPage,
|
|
634
|
+
this.perPage,
|
|
635
|
+
this.source,
|
|
636
|
+
this.fields
|
|
637
|
+
)
|
|
638
|
+
);
|
|
597
639
|
},
|
|
598
640
|
onMultipleSelectionChange(selIndex) {
|
|
599
641
|
this.collectionData.forEach((item, index) => {
|
|
@@ -732,14 +774,14 @@ export default {
|
|
|
732
774
|
.catch(() => {
|
|
733
775
|
this.collectionData = [];
|
|
734
776
|
});
|
|
735
|
-
|
|
736
|
-
this.$emit("change", this.field);
|
|
737
777
|
},
|
|
738
778
|
changeCollectionColumns(collectionFieldsColumns, columnsSelected) {
|
|
739
|
-
const optionsList = columnsSelected
|
|
779
|
+
const optionsList = columnsSelected?.optionsList || [];
|
|
780
|
+
const singleField = this.source?.singleField;
|
|
781
|
+
|
|
740
782
|
const mappedColumns = collectionFieldsColumns.map((column) => ({
|
|
741
783
|
...column,
|
|
742
|
-
data:
|
|
784
|
+
data: remapCollectionRowData(column.data, optionsList, singleField)
|
|
743
785
|
}));
|
|
744
786
|
|
|
745
787
|
this.setCollectionIntoList(mappedColumns);
|
|
@@ -813,29 +855,18 @@ export default {
|
|
|
813
855
|
// Restore selectedRow after collection data (re)loads or when value prop changes.
|
|
814
856
|
// Mirrors reapplyCollectionSelections for the single-record (radio) case.
|
|
815
857
|
restoreRadioSelection(rows) {
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
);
|
|
825
|
-
const match = rows.find(row => row[singleField] === this.value);
|
|
826
|
-
if (match) {
|
|
827
|
-
this.selectedRow = match;
|
|
828
|
-
}
|
|
829
|
-
} else if (typeof this.value === "object" && !Array.isArray(this.value)) {
|
|
830
|
-
// Regular single-record mode emits { ...item, selectedRowIndex: N }
|
|
831
|
-
const idx = this.value.selectedRowIndex;
|
|
832
|
-
if (idx != null && idx >= 0 && idx < rows.length) {
|
|
833
|
-
this.selectedRow = rows[idx];
|
|
834
|
-
}
|
|
858
|
+
const match = findRadioSelectionMatch(
|
|
859
|
+
this.value,
|
|
860
|
+
rows,
|
|
861
|
+
this.source,
|
|
862
|
+
this.fields
|
|
863
|
+
);
|
|
864
|
+
if (match) {
|
|
865
|
+
this.selectedRow = match;
|
|
835
866
|
}
|
|
836
867
|
},
|
|
837
868
|
shouldPersistCollectionSelection() {
|
|
838
|
-
const pmql = this.
|
|
869
|
+
const pmql = this.getCollectionPmql();
|
|
839
870
|
return (
|
|
840
871
|
this.source?.sourceOptions === "Collection" &&
|
|
841
872
|
this.source?.dataSelectionOptions === "multiple-records" &&
|
|
@@ -844,24 +875,7 @@ export default {
|
|
|
844
875
|
);
|
|
845
876
|
},
|
|
846
877
|
getCollectionRowKey(item) {
|
|
847
|
-
|
|
848
|
-
return null;
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
const entries = Object.entries(item).filter(
|
|
852
|
-
([key]) => key !== "selectedRowsIndex"
|
|
853
|
-
);
|
|
854
|
-
|
|
855
|
-
if (entries.length === 0) {
|
|
856
|
-
return null;
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
entries.sort(([keyA], [keyB]) => {
|
|
860
|
-
if (keyA > keyB) return 1;
|
|
861
|
-
if (keyA < keyB) return -1;
|
|
862
|
-
return 0;
|
|
863
|
-
});
|
|
864
|
-
return JSON.stringify(entries);
|
|
878
|
+
return getCollectionRowKey(item);
|
|
865
879
|
},
|
|
866
880
|
updateRowDataNamePrefix() {
|
|
867
881
|
this.setUploadDataNamePrefix(this.currentRowIndex);
|
package/src/mixins/ScreenBase.js
CHANGED
|
@@ -221,6 +221,10 @@ export default {
|
|
|
221
221
|
} else if (component === "FormLoop") {
|
|
222
222
|
value = this.emptyLoopValue(config);
|
|
223
223
|
}
|
|
224
|
+
// FormRecordList keeps the default `null` empty state (Variable and Collection).
|
|
225
|
+
// Do not initialize Variable mode as []: historical screens/tests/processes treat
|
|
226
|
+
// an untouched record list as null. Collection radio/checkbox selection also
|
|
227
|
+
// relies on null until the user selects a row.
|
|
224
228
|
return value;
|
|
225
229
|
},
|
|
226
230
|
emptyLoopValue(config) {
|
|
@@ -234,16 +238,33 @@ export default {
|
|
|
234
238
|
}
|
|
235
239
|
return loopVariable;
|
|
236
240
|
},
|
|
237
|
-
updateScreenData(safeDotName, variable) {
|
|
241
|
+
updateScreenData(safeDotName, variable, eventValue) {
|
|
238
242
|
this[`${safeDotName}_was_filled__`] = true;
|
|
239
243
|
this.blockUpdate(safeDotName, 210);
|
|
240
|
-
|
|
244
|
+
// Prefer $event from @input so we don't depend on v-model listener order.
|
|
245
|
+
// Without this, updateScreenData can run before v-model assigns and write
|
|
246
|
+
// the previous value (e.g. []/null) back into vdata, wiping the selection.
|
|
247
|
+
const hasEventValue = arguments.length >= 3;
|
|
248
|
+
const value = hasEventValue ? eventValue : this[safeDotName];
|
|
249
|
+
if (hasEventValue) {
|
|
250
|
+
this[safeDotName] = eventValue;
|
|
251
|
+
}
|
|
252
|
+
this.setValueDebounced(variable, value, this.vdata);
|
|
241
253
|
},
|
|
242
|
-
updateScreenDataNow(safeDotName, variable, setWasFilled = true) {
|
|
254
|
+
updateScreenDataNow(safeDotName, variable, setWasFilled = true, eventValue = undefined) {
|
|
243
255
|
if (setWasFilled) {
|
|
244
256
|
this[`${safeDotName}_was_filled__`] = true;
|
|
245
257
|
}
|
|
246
|
-
|
|
258
|
+
// Prefer $event from @input so we don't depend on v-model listener order.
|
|
259
|
+
// Without this, updateScreenDataNow can run before v-model assigns and write
|
|
260
|
+
// the previous value (e.g. []/null) back into vdata, wiping the selection.
|
|
261
|
+
// Use arguments.length so explicit falsy values (0, '', false, null) are kept.
|
|
262
|
+
const hasEventValue = arguments.length >= 4;
|
|
263
|
+
const value = hasEventValue ? eventValue : this[safeDotName];
|
|
264
|
+
if (hasEventValue) {
|
|
265
|
+
this[safeDotName] = eventValue;
|
|
266
|
+
}
|
|
267
|
+
this.setValue(variable, value, this.vdata);
|
|
247
268
|
this.unblockUpdate(safeDotName);
|
|
248
269
|
},
|
|
249
270
|
blockUpdate(safeDotName, time) {
|
|
@@ -8,12 +8,15 @@ export default {
|
|
|
8
8
|
const { component } = v.element;
|
|
9
9
|
const dataFormat = v.config.dataFormat || null;
|
|
10
10
|
const safeDotName = this.safeDotName(v.name);
|
|
11
|
+
// Use nullish coalescing so valid falsy values (0, '', [], false) are preserved.
|
|
12
|
+
// The previous `||` chain treated those as missing and fell back to initialValue
|
|
13
|
+
// (e.g. FormRecordList collection radio/single-field selections became null).
|
|
11
14
|
this.addData(
|
|
12
15
|
screen,
|
|
13
16
|
safeDotName,
|
|
14
17
|
`
|
|
15
|
-
this.getValue(${JSON.stringify(v.name)}, this.vdata)
|
|
16
|
-
this.getValue(${JSON.stringify(v.name)}, data)
|
|
18
|
+
this.getValue(${JSON.stringify(v.name)}, this.vdata) ??
|
|
19
|
+
this.getValue(${JSON.stringify(v.name)}, data) ??
|
|
17
20
|
this.initialValue(
|
|
18
21
|
'${component}',
|
|
19
22
|
'${dataFormat}',
|
|
@@ -50,21 +50,24 @@ export default {
|
|
|
50
50
|
// `person.content` when `person`=null
|
|
51
51
|
const safeDotName = this.safeDotName(element.config.name);
|
|
52
52
|
properties["v-model"] = safeDotName;
|
|
53
|
-
// Debounce input from FormTextArea and FormInput
|
|
53
|
+
// Debounce input from FormTextArea and FormInput.
|
|
54
|
+
// Pass $event on @input so vdata is updated with the emitted value even
|
|
55
|
+
// if this handler runs before the v-model assignment (listener order race).
|
|
56
|
+
// Keep @change without $event: change payloads are not always the field value.
|
|
54
57
|
if (
|
|
55
58
|
componentName === "FormTextArea" ||
|
|
56
59
|
componentName === "FormInput"
|
|
57
60
|
) {
|
|
58
61
|
properties[
|
|
59
62
|
"@input"
|
|
60
|
-
] = `updateScreenData('${safeDotName}', '${element.config.name}')`;
|
|
63
|
+
] = `updateScreenData('${safeDotName}', '${element.config.name}', $event)`;
|
|
61
64
|
properties[
|
|
62
65
|
"@change"
|
|
63
66
|
] = `updateScreenDataNow('${safeDotName}', '${element.config.name}')`;
|
|
64
67
|
} else {
|
|
65
68
|
properties[
|
|
66
69
|
"@input"
|
|
67
|
-
] = `updateScreenDataNow('${safeDotName}', '${element.config.name}')`;
|
|
70
|
+
] = `updateScreenDataNow('${safeDotName}', '${element.config.name}', true, $event)`;
|
|
68
71
|
properties[
|
|
69
72
|
"@change"
|
|
70
73
|
] = `updateScreenDataNow('${safeDotName}', '${element.config.name}')`;
|