@formio/js 5.4.0-api98.1 → 5.4.0

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.
Files changed (122) hide show
  1. package/dist/formio.builder.css +15 -0
  2. package/dist/formio.builder.min.css +1 -1
  3. package/dist/formio.embed.js +1 -1
  4. package/dist/formio.embed.min.js +1 -1
  5. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  6. package/dist/formio.form.css +15 -0
  7. package/dist/formio.form.js +917 -897
  8. package/dist/formio.form.min.css +1 -1
  9. package/dist/formio.form.min.js +1 -1
  10. package/dist/formio.form.min.js.LICENSE.txt +2 -2
  11. package/dist/formio.full.css +15 -0
  12. package/dist/formio.full.js +1211 -1191
  13. package/dist/formio.full.min.css +1 -1
  14. package/dist/formio.full.min.js +1 -1
  15. package/dist/formio.full.min.js.LICENSE.txt +2 -2
  16. package/dist/formio.js +832 -812
  17. package/dist/formio.min.js +1 -1
  18. package/dist/formio.min.js.LICENSE.txt +2 -2
  19. package/dist/formio.utils.js +774 -754
  20. package/dist/formio.utils.min.js +1 -1
  21. package/dist/formio.utils.min.js.LICENSE.txt +2 -2
  22. package/lib/cjs/Element.d.ts +11 -0
  23. package/lib/cjs/Element.js +24 -0
  24. package/lib/cjs/Embed.js +23 -2
  25. package/lib/cjs/Form.d.ts +1 -1
  26. package/lib/cjs/Formio.js +1 -1
  27. package/lib/cjs/PDFBuilder.js +6 -1
  28. package/lib/cjs/Webform.d.ts +1 -1
  29. package/lib/cjs/Webform.js +9 -6
  30. package/lib/cjs/WebformBuilder.js +14 -1
  31. package/lib/cjs/Wizard.js +15 -11
  32. package/lib/cjs/components/Components.d.ts +3 -0
  33. package/lib/cjs/components/Components.js +3 -1
  34. package/lib/cjs/components/_classes/component/Component.d.ts +8 -0
  35. package/lib/cjs/components/_classes/component/Component.js +121 -42
  36. package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  37. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +1 -1
  38. package/lib/cjs/components/_classes/component/editForm/utils.d.ts +1 -0
  39. package/lib/cjs/components/_classes/component/editForm/utils.js +3 -0
  40. package/lib/cjs/components/_classes/nested/NestedComponent.js +5 -7
  41. package/lib/cjs/components/address/Address.js +2 -0
  42. package/lib/cjs/components/datagrid/DataGrid.js +31 -5
  43. package/lib/cjs/components/datamap/DataMap.d.ts +1 -4
  44. package/lib/cjs/components/datamap/DataMap.js +42 -10
  45. package/lib/cjs/components/datetime/DateTime.js +11 -1
  46. package/lib/cjs/components/datetime/editForm/DateTime.edit.date.d.ts +18 -1
  47. package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +3 -0
  48. package/lib/cjs/components/datetime/editForm/DateTime.edit.time.d.ts +13 -2
  49. package/lib/cjs/components/datetime/editForm/DateTime.edit.time.js +3 -0
  50. package/lib/cjs/components/day/Day.d.ts +0 -15
  51. package/lib/cjs/components/day/Day.js +8 -17
  52. package/lib/cjs/components/editgrid/EditGrid.js +13 -3
  53. package/lib/cjs/components/file/File.js +7 -6
  54. package/lib/cjs/components/form/Form.d.ts +1 -0
  55. package/lib/cjs/components/form/Form.js +20 -8
  56. package/lib/cjs/components/number/Number.d.ts +1 -0
  57. package/lib/cjs/components/number/Number.js +18 -0
  58. package/lib/cjs/components/select/Select.js +4 -0
  59. package/lib/cjs/components/signature/Signature.js +5 -5
  60. package/lib/cjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
  61. package/lib/cjs/components/signature/editForm/Signature.edit.display.js +0 -1
  62. package/lib/cjs/components/textfield/editForm/TextField.edit.display.d.ts +0 -10
  63. package/lib/cjs/components/textfield/editForm/TextField.edit.display.js +9 -23
  64. package/lib/cjs/formio.form.js +2 -5
  65. package/lib/cjs/package.json +1 -1
  66. package/lib/cjs/providers/storage/azure.js +9 -3
  67. package/lib/cjs/utils/formUtils.d.ts +2 -2
  68. package/lib/cjs/utils/index.d.ts +3 -3
  69. package/lib/cjs/utils/utils.d.ts +1 -1
  70. package/lib/cjs/utils/utils.js +23 -6
  71. package/lib/cjs/widgets/CalendarWidget.js +1 -1
  72. package/lib/mjs/Element.d.ts +11 -0
  73. package/lib/mjs/Element.js +23 -0
  74. package/lib/mjs/Embed.js +21 -2
  75. package/lib/mjs/Form.d.ts +1 -1
  76. package/lib/mjs/Formio.js +1 -1
  77. package/lib/mjs/PDFBuilder.js +6 -1
  78. package/lib/mjs/Webform.d.ts +1 -1
  79. package/lib/mjs/Webform.js +6 -3
  80. package/lib/mjs/WebformBuilder.js +13 -1
  81. package/lib/mjs/Wizard.js +9 -10
  82. package/lib/mjs/components/Components.d.ts +3 -0
  83. package/lib/mjs/components/Components.js +3 -1
  84. package/lib/mjs/components/_classes/component/Component.d.ts +8 -0
  85. package/lib/mjs/components/_classes/component/Component.js +119 -41
  86. package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  87. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +1 -1
  88. package/lib/mjs/components/_classes/component/editForm/utils.d.ts +1 -0
  89. package/lib/mjs/components/_classes/component/editForm/utils.js +3 -0
  90. package/lib/mjs/components/_classes/nested/NestedComponent.js +5 -6
  91. package/lib/mjs/components/address/Address.js +2 -0
  92. package/lib/mjs/components/datagrid/DataGrid.js +34 -5
  93. package/lib/mjs/components/datamap/DataMap.d.ts +1 -4
  94. package/lib/mjs/components/datamap/DataMap.js +41 -10
  95. package/lib/mjs/components/datetime/DateTime.js +11 -1
  96. package/lib/mjs/components/datetime/editForm/DateTime.edit.date.d.ts +18 -1
  97. package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +3 -0
  98. package/lib/mjs/components/datetime/editForm/DateTime.edit.time.d.ts +13 -2
  99. package/lib/mjs/components/datetime/editForm/DateTime.edit.time.js +3 -0
  100. package/lib/mjs/components/day/Day.d.ts +0 -15
  101. package/lib/mjs/components/day/Day.js +8 -17
  102. package/lib/mjs/components/editgrid/EditGrid.js +12 -2
  103. package/lib/mjs/components/file/File.js +7 -6
  104. package/lib/mjs/components/form/Form.d.ts +1 -0
  105. package/lib/mjs/components/form/Form.js +18 -6
  106. package/lib/mjs/components/number/Number.d.ts +1 -0
  107. package/lib/mjs/components/number/Number.js +17 -0
  108. package/lib/mjs/components/select/Select.js +4 -0
  109. package/lib/mjs/components/signature/Signature.js +1 -1
  110. package/lib/mjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
  111. package/lib/mjs/components/signature/editForm/Signature.edit.display.js +0 -1
  112. package/lib/mjs/components/textfield/editForm/TextField.edit.display.d.ts +0 -10
  113. package/lib/mjs/components/textfield/editForm/TextField.edit.display.js +9 -23
  114. package/lib/mjs/formio.form.js +4 -7
  115. package/lib/mjs/package.json +1 -1
  116. package/lib/mjs/providers/storage/azure.js +9 -3
  117. package/lib/mjs/utils/formUtils.d.ts +2 -2
  118. package/lib/mjs/utils/index.d.ts +3 -3
  119. package/lib/mjs/utils/utils.d.ts +1 -1
  120. package/lib/mjs/utils/utils.js +22 -6
  121. package/lib/mjs/widgets/CalendarWidget.js +2 -2
  122. package/package.json +7 -6
@@ -206,6 +206,7 @@ function checkSimpleConditional(component, condition, row, data, instance) {
206
206
  return true;
207
207
  }
208
208
  const conditionsResult = lodash_1.default.map(conditions, (cond) => {
209
+ var _a;
209
210
  const { value: comparedValue, operator, component: conditionComponentPath } = cond;
210
211
  if (!conditionComponentPath) {
211
212
  return true;
@@ -232,6 +233,16 @@ function checkSimpleConditional(component, condition, row, data, instance) {
232
233
  }
233
234
  else {
234
235
  const value = getComponentActualValue(conditionComponentPath, data, row);
236
+ // When inside a DataGrid/EditGrid, construct a row-indexed path so that
237
+ // operators like isEmpty can look up the correct row's component instance.
238
+ let operatorPath = conditionComponentPath;
239
+ const dataParent = getDataParentComponent(instance);
240
+ if (dataParent && !lodash_1.default.isNil(instance === null || instance === void 0 ? void 0 : instance.rowIndex)) {
241
+ const parentPath = (_a = dataParent.paths) === null || _a === void 0 ? void 0 : _a.localPath;
242
+ if (parentPath && conditionComponentPath.startsWith(`${parentPath}.`)) {
243
+ operatorPath = conditionComponentPath.replace(`${parentPath}.`, `${parentPath}[${instance.rowIndex}].`);
244
+ }
245
+ }
235
246
  const СonditionOperator = conditionOperators_1.default[operator];
236
247
  return СonditionOperator
237
248
  ? new СonditionOperator().getResult({
@@ -239,7 +250,7 @@ function checkSimpleConditional(component, condition, row, data, instance) {
239
250
  comparedValue,
240
251
  instance,
241
252
  component,
242
- path: conditionComponentPath,
253
+ path: operatorPath,
243
254
  })
244
255
  : true;
245
256
  }
@@ -292,7 +303,11 @@ exports.getComponentActualValue = getComponentActualValue;
292
303
  */
293
304
  function checkCustomConditional(component, custom, row, data, form, variable, onError, instance) {
294
305
  if (typeof custom === 'string') {
295
- custom = `var ${variable} = true; ${custom}; return ${variable};`;
306
+ custom = `
307
+ var ${variable} = true;
308
+ ${custom};
309
+ return ${variable};
310
+ `;
296
311
  }
297
312
  const value = instance && instance.evaluate
298
313
  ? instance.evaluate(custom, { row, data, form })
@@ -640,14 +655,16 @@ exports.shouldLoadZones = shouldLoadZones;
640
655
  * @param {string} timezone - The timezone to load.
641
656
  * @returns {Promise<any> | *} - Resolves when the zones for this timezone are loaded.
642
657
  */
643
- function loadZones(url, timezone) {
644
- if (timezone && !shouldLoadZones(timezone)) {
645
- // Return non-resolving promise.
646
- return new Promise(lodash_1.default.noop);
658
+ function loadZones(url, _timezone) {
659
+ if (moment_timezone_1.default.zonesLoaded) {
660
+ return Promise.resolve();
647
661
  }
648
662
  if (moment_timezone_1.default.zonesPromise) {
649
663
  return moment_timezone_1.default.zonesPromise;
650
664
  }
665
+ // Always load the full packed dataset once. The previous optimization skipped fetch when the
666
+ // display timezone matched the runtime zone, but moment-timezone still needs `tz.load()` for
667
+ // `.tz(ianaName)` and `z` formatting to work; otherwise conversions silently match server local time.
651
668
  return (moment_timezone_1.default.zonesPromise = fetch(url).then((resp) => resp.json().then((zones) => {
652
669
  moment_timezone_1.default.tz.load(zones);
653
670
  moment_timezone_1.default.zonesLoaded = true;
@@ -61,7 +61,7 @@ class CalendarWidget extends InputWidget_1.default {
61
61
  if (this.zoneLoading) {
62
62
  return true;
63
63
  }
64
- if (!(0, utils_1.zonesLoaded)() && (0, utils_1.shouldLoadZones)(timezone)) {
64
+ if (!(0, utils_1.zonesLoaded)()) {
65
65
  this.zoneLoading = true;
66
66
  (0, utils_1.loadZones)(this.timezonesUrl, timezone).then(() => {
67
67
  this.zoneLoading = false;
@@ -210,6 +210,17 @@ export default class Element {
210
210
  * @returns {this} - The instance of the element.
211
211
  */
212
212
  removeClass(element: HTMLElement, className: string): this;
213
+ /**
214
+ * Idempotently add or remove a class on a DOM element based on a boolean.
215
+ * Skips the mutation when the element is already in the desired state, so
216
+ * callers can safely invoke it on every change without triggering redundant
217
+ * CSS transitions or attribute writes.
218
+ * @param {HTMLElement} element - The DOM element to toggle the class on.
219
+ * @param {string} className - The class name to add or remove.
220
+ * @param {boolean} want - TRUE to ensure the class is present, FALSE to ensure it is absent.
221
+ * @returns {this} - The instance of the element.
222
+ */
223
+ toggleClass(element: HTMLElement, className: string, want: boolean): this;
213
224
  /**
214
225
  * Empty's an HTML DOM element.
215
226
  * @param {HTMLElement} element - The element you wish to empty.
@@ -477,6 +477,29 @@ export default class Element {
477
477
  }
478
478
  return this;
479
479
  }
480
+ /**
481
+ * Idempotently add or remove a class on a DOM element based on a boolean.
482
+ * Skips the mutation when the element is already in the desired state, so
483
+ * callers can safely invoke it on every change without triggering redundant
484
+ * CSS transitions or attribute writes.
485
+ * @param {HTMLElement} element - The DOM element to toggle the class on.
486
+ * @param {string} className - The class name to add or remove.
487
+ * @param {boolean} want - TRUE to ensure the class is present, FALSE to ensure it is absent.
488
+ * @returns {this} - The instance of the element.
489
+ */
490
+ toggleClass(element, className, want) {
491
+ if (!element || !className || !(element instanceof HTMLElement)) {
492
+ return this;
493
+ }
494
+ const has = !!element.classList?.contains(className);
495
+ if (want && !has) {
496
+ this.addClass(element, className);
497
+ }
498
+ else if (!want && has) {
499
+ this.removeClass(element, className);
500
+ }
501
+ return this;
502
+ }
480
503
  /**
481
504
  * Empty's an HTML DOM element.
482
505
  * @param {HTMLElement} element - The element you wish to empty.
package/lib/mjs/Embed.js CHANGED
@@ -14,7 +14,7 @@ export class Formio {
14
14
  Formio._formioReady = ready;
15
15
  Formio._formioReadyReject = reject;
16
16
  });
17
- static version = '5.4.0-api98.1';
17
+ static version = '5.4.0';
18
18
  static setLicense(license, norecurse = false) {
19
19
  Formio.license = license;
20
20
  if (!norecurse && Formio.FormioClass) {
@@ -340,6 +340,24 @@ export class Formio {
340
340
  };
341
341
  });
342
342
  const id = Formio.config.id || `formio-${Math.random().toString(36).substring(7)}`;
343
+ const hasQuillComponent = (components = []) => {
344
+ if (!Array.isArray(components)) {
345
+ return false;
346
+ }
347
+ return components.some((component) => {
348
+ if (!component || typeof component !== 'object') {
349
+ return false;
350
+ }
351
+ const isQuillTextarea = component.type === 'textarea' &&
352
+ component.wysiwyg === true &&
353
+ component.editor === 'quill';
354
+ return (isQuillTextarea ||
355
+ hasQuillComponent(component.components) ||
356
+ hasQuillComponent(component.columns?.flatMap((column) => column.components || [])) ||
357
+ hasQuillComponent(component.rows?.flatMap((row) => row.flatMap((cell) => cell.components || []))));
358
+ });
359
+ };
360
+ const disableShadowForQuill = hasQuillComponent(Formio.config.form?.components);
343
361
  // Create a new wrapper and add the element inside of a new wrapper.
344
362
  let wrapper = Formio.createElement('div', {
345
363
  id: `${id}-wrapper`,
@@ -348,6 +366,7 @@ export class Formio {
348
366
  // If we include the libraries, then we will attempt to run this in shadow dom.
349
367
  const useShadowDom = Formio.config.includeLibs &&
350
368
  !Formio.config.noshadow &&
369
+ !disableShadowForQuill &&
351
370
  typeof wrapper.attachShadow === 'function';
352
371
  if (useShadowDom) {
353
372
  wrapper = wrapper.attachShadow({
@@ -356,7 +375,7 @@ export class Formio {
356
375
  options.shadowRoot = wrapper;
357
376
  // Due to an issue with quill not loading styles in the shadowdom, we need to add quill styles and js to the shadowdom
358
377
  const quill = {
359
- js: `${Formio.cdn.quill}/quill.min.js`,
378
+ js: `${Formio.cdn.quill}/quill.js`,
360
379
  css: `${Formio.cdn.quill}/quill.snow.css`
361
380
  };
362
381
  await Formio.addLibrary(wrapper, quill, 'quill');
package/lib/mjs/Form.d.ts CHANGED
@@ -238,7 +238,7 @@ export type FormOptions = {
238
238
  /**
239
239
  * - The render mode for this form.
240
240
  */
241
- renderMode?: "builder" | "form" | "html" | "flat" | "pdf" | undefined;
241
+ renderMode?: "form" | "builder" | "html" | "flat" | "pdf" | undefined;
242
242
  /**
243
243
  * - Highlight any errors on the form.
244
244
  */
package/lib/mjs/Formio.js CHANGED
@@ -4,7 +4,7 @@ import CDN from './CDN';
4
4
  import Providers from './providers';
5
5
  FormioCore.cdn = new CDN();
6
6
  FormioCore.Providers = Providers;
7
- FormioCore.version = '5.4.0-api98.1';
7
+ FormioCore.version = '5.4.0';
8
8
  CDN.defaultCDN = FormioCore.version.includes('rc')
9
9
  ? 'https://cdn.test-form.io'
10
10
  : 'https://cdn.form.io';
@@ -227,7 +227,12 @@ export default class PDFBuilder extends WebformBuilder {
227
227
  nonFillableConversionUsed: autoConversionComponentsAssigned && result.data.formfields.nonFillableConversionUsed,
228
228
  });
229
229
  this.emit('pdfUploaded', result.data);
230
- this.redraw();
230
+ if (autoConversionComponentsAssigned) {
231
+ this.rebuild();
232
+ }
233
+ else {
234
+ this.redraw();
235
+ }
231
236
  })
232
237
  .catch((err) => this.setUploadError(err));
233
238
  }
@@ -259,7 +259,6 @@ declare class Webform extends NestedDataComponent {
259
259
  * @returns {Promise} - The promise that is triggered when the submission is set.
260
260
  */
261
261
  setSubmission(submission: any, flags?: any): Promise<any>;
262
- _submission: any;
263
262
  handleDraftError(errName: any, errDetails: any, restoreDraft: any): void;
264
263
  saveDraft(): void;
265
264
  /**
@@ -270,6 +269,7 @@ declare class Webform extends NestedDataComponent {
270
269
  get schema(): any;
271
270
  mergeData(_this: any, _that: any): void;
272
271
  editing: boolean | undefined;
272
+ _submission: any;
273
273
  /**
274
274
  * Build the form.
275
275
  * @returns {Promise} - The promise that is triggered when the form is built.
@@ -658,8 +658,6 @@ export default class Webform extends NestedDataComponent {
658
658
  ...resolveFlags,
659
659
  };
660
660
  }
661
- this._submission = {};
662
- this._data = {};
663
661
  this.onSetSubmission(submission, flags);
664
662
  return this.submissionReadyResolve(submission);
665
663
  }, (err) => this.submissionReadyReject(err))
@@ -1098,7 +1096,10 @@ export default class Webform extends NestedDataComponent {
1098
1096
  });
1099
1097
  }
1100
1098
  const errorsList = this.renderTemplate('errorsList', { errors: displayedErrors });
1101
- this.root?.setAlert('danger', errorsList);
1099
+ // Only paint the alert from a subform when the root won't double paint it to avoid a painful flicker
1100
+ if (this === this.root || !this.root?.submitted) {
1101
+ this.root?.setAlert('danger', errorsList);
1102
+ }
1102
1103
  if (triggerEvent) {
1103
1104
  this.emit('error', errors);
1104
1105
  }
@@ -1220,6 +1221,7 @@ export default class Webform extends NestedDataComponent {
1220
1221
  ...flags,
1221
1222
  noValidate: false,
1222
1223
  process: 'change',
1224
+ dirty: flags.dirty ?? this.submitted,
1223
1225
  })
1224
1226
  : [];
1225
1227
  value.isValid = (errors || []).filter((err) => !err.fromServer).length === 0;
@@ -1289,6 +1291,7 @@ export default class Webform extends NestedDataComponent {
1289
1291
  userAgent: navigator.userAgent,
1290
1292
  pathName: window.location.pathname,
1291
1293
  onLine: navigator.onLine,
1294
+ language: this.i18next?.originalLanguage || this.options.language || this.i18next?.language,
1292
1295
  });
1293
1296
  }
1294
1297
  submitForm(options = {}, local = false) {
@@ -364,11 +364,14 @@ export default class WebformBuilder extends Component {
364
364
  this.attachTooltip(component.refs.editComponent, this.t('Edit'));
365
365
  component.addEventListener(component.refs.editComponent, 'click', () => this.editComponent(component.schema, parent, false, false, component.component, {
366
366
  inDataGrid: component.isInDataGrid,
367
+ editComponentPath: component.path,
367
368
  }));
368
369
  }
369
370
  if (component.refs.editJson) {
370
371
  this.attachTooltip(component.refs.editJson, this.t('Edit JSON'));
371
- component.addEventListener(component.refs.editJson, 'click', () => this.editComponent(component.schema, parent, false, true, component.component));
372
+ component.addEventListener(component.refs.editJson, 'click', () => this.editComponent(component.schema, parent, false, true, component.component, {
373
+ editComponentPath: component.path,
374
+ }));
372
375
  }
373
376
  if (component.refs.removeComponent) {
374
377
  this.attachTooltip(component.refs.removeComponent, this.t('Remove'));
@@ -1081,6 +1084,14 @@ export default class WebformBuilder extends Component {
1081
1084
  _.get(this.webform, 'form.globalSettings.sanitizeConfig');
1082
1085
  // Update the preview.
1083
1086
  if (this.preview) {
1087
+ if (changed?.instance?.key === 'allowMultipleMasks' && changed?.value === false) {
1088
+ const changedComp = this.preview?.getComponent(component.key);
1089
+ if (changedComp) {
1090
+ const emptyValue = changedComp.emptyValue;
1091
+ changedComp.dataValue = emptyValue;
1092
+ component.defaultValue = emptyValue;
1093
+ }
1094
+ }
1084
1095
  this.preview.form = {
1085
1096
  components: [
1086
1097
  _.omit({ ...component }, [
@@ -1396,6 +1407,7 @@ export default class WebformBuilder extends Component {
1396
1407
  // Pass along the form being edited.
1397
1408
  editFormOptions.editForm = this.form;
1398
1409
  editFormOptions.editComponent = component;
1410
+ editFormOptions.editComponentPath = flags.editComponentPath;
1399
1411
  editFormOptions.flags = flags;
1400
1412
  this.hook('editComponentParentInstance', editFormOptions, parent);
1401
1413
  this.editForm = new Webform({
package/lib/mjs/Wizard.js CHANGED
@@ -200,7 +200,7 @@ export default class Wizard extends Webform {
200
200
  wizardNav,
201
201
  components: this.renderComponents([
202
202
  ...this.prefixComps,
203
- ...this.currentPage.components,
203
+ ...this.currentPage?.components || [],
204
204
  ...this.suffixComps,
205
205
  ]),
206
206
  }, this.builderMode ? 'builder' : 'form');
@@ -262,7 +262,7 @@ export default class Wizard extends Webform {
262
262
  this.hook('attachWebform', element, this);
263
263
  const promises = this.attachComponents(this.refs[this.wizardKey], [
264
264
  ...this.prefixComps,
265
- ...this.currentPage.components,
265
+ ...this.currentPage?.components || [],
266
266
  ...this.suffixComps,
267
267
  ]);
268
268
  this.attachNav();
@@ -289,7 +289,7 @@ export default class Wizard extends Webform {
289
289
  isBreadcrumbClickable() {
290
290
  let currentPage = null;
291
291
  this.pages.map((page) => {
292
- if (_.isEqual(this.currentPage.component, page.component)) {
292
+ if (_.isEqual(this.currentPage?.component, page.component)) {
293
293
  currentPage = page;
294
294
  }
295
295
  });
@@ -304,11 +304,11 @@ export default class Wizard extends Webform {
304
304
  isAllowPrevious() {
305
305
  let currentPage = null;
306
306
  this.pages.map((page) => {
307
- if (_.isEqual(this.currentPage.component, page.component)) {
307
+ if (_.isEqual(this.currentPage?.component, page.component)) {
308
308
  currentPage = page;
309
309
  }
310
310
  });
311
- return _.get(currentPage.component, 'allowPrevious', this.options.allowPrevious);
311
+ return _.get(currentPage?.component, 'allowPrevious', this.options.allowPrevious);
312
312
  }
313
313
  /**
314
314
  * Handles navigate on 'Enter' key event in a wizard form.
@@ -537,7 +537,7 @@ export default class Wizard extends Webform {
537
537
  const forceShow = this.shouldForceShow(item);
538
538
  const forceHide = this.shouldForceHide(item);
539
539
  let isVisible = !page
540
- ? checkCondition(item, data, data, this.component, this) && !item.hidden
540
+ ? (checkCondition(item, data, data, this.component, this) && !item.hidden)
541
541
  : page.visible;
542
542
  if (forceShow) {
543
543
  isVisible = true;
@@ -608,7 +608,7 @@ export default class Wizard extends Webform {
608
608
  }
609
609
  return this.redraw().then(() => {
610
610
  this.checkData(this.submission.data);
611
- this.triggerCaptcha(this.currentPage.components);
611
+ this.triggerCaptcha(this.currentPage?.components);
612
612
  const errors = this.submitted
613
613
  ? this.validate(this.localData, { dirty: true })
614
614
  : this.validateCurrentPage();
@@ -833,8 +833,7 @@ export default class Wizard extends Webform {
833
833
  return super.setForm(form, flags);
834
834
  }
835
835
  onSetForm(clonedForm, initialForm) {
836
- this.component.components =
837
- (this.parent ? initialForm.components : clonedForm.components) || [];
836
+ this.component.components = (this.parent ? initialForm.components : clonedForm.components) || [];
838
837
  this.setComponentSchema();
839
838
  }
840
839
  setEditMode(submission) {
@@ -947,7 +946,7 @@ export default class Wizard extends Webform {
947
946
  this.setCustomValidity('');
948
947
  return true;
949
948
  }
950
- const components = !currentPageOnly || this.isLastPage() ? this.getComponents() : this.currentPage.components;
949
+ const components = !currentPageOnly || this.isLastPage() ? this.getComponents() : this.currentPage?.components;
951
950
  return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, currentPageOnly, childErrors) && check, true);
952
951
  }
953
952
  get errors() {
@@ -2,6 +2,7 @@ export default class Components {
2
2
  static _editFormUtils: {
3
3
  sortAndFilterComponents(components: any): any;
4
4
  unifyComponents(objValue: any, srcValue: any): any;
5
+ tokenVariableDescription(): string;
5
6
  logicVariablesTable(additional: any): {
6
7
  type: string;
7
8
  tag: string;
@@ -86,6 +87,7 @@ export default class Components {
86
87
  static set EditFormUtils(value: {
87
88
  sortAndFilterComponents(components: any): any;
88
89
  unifyComponents(objValue: any, srcValue: any): any;
90
+ tokenVariableDescription(): string;
89
91
  logicVariablesTable(additional: any): {
90
92
  type: string;
91
93
  tag: string;
@@ -169,6 +171,7 @@ export default class Components {
169
171
  static get EditFormUtils(): {
170
172
  sortAndFilterComponents(components: any): any;
171
173
  unifyComponents(objValue: any, srcValue: any): any;
174
+ tokenVariableDescription(): string;
172
175
  logicVariablesTable(additional: any): {
173
176
  type: string;
174
177
  tag: string;
@@ -66,7 +66,9 @@ export default class Components {
66
66
  comp = new Component(component, options, data);
67
67
  }
68
68
  if (comp.path) {
69
- comp.componentsMap[comp.path] = comp;
69
+ comp.eachRootChildComponentsMap((map) => {
70
+ map[comp.path] = comp;
71
+ });
70
72
  }
71
73
  // Reset the componentMatches on the root element if any new component is created.
72
74
  let parent = comp.parent;
@@ -163,6 +163,14 @@ declare class Component extends Element {
163
163
  */
164
164
  info: any;
165
165
  get componentsMap(): object;
166
+ /**
167
+ * Walks this component's root chain, invoking `fn` with each ancestor root's
168
+ * `childComponentsMap`. Component registration is propagated up the wizard /
169
+ * nested-form chain at create time, so any code that mutates a registration
170
+ * (creation, removal, path-driven re-key) must update every map in the chain.
171
+ * @param {(map: object) => void} fn - Called once per root that exposes a `childComponentsMap`.
172
+ */
173
+ eachRootChildComponentsMap(fn: (map: object) => void): void;
166
174
  /**
167
175
  * Returns if the parent should conditionally clear.
168
176
  *