@processmaker/screen-builder 3.8.39 → 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.
@@ -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
- this.setValueDebounced(variable, this[safeDotName], this.vdata);
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
- this.setValue(variable, this[safeDotName], this.vdata);
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}')`;