@formio/js 5.3.4 → 5.3.6

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.
@@ -20,7 +20,7 @@
20
20
 
21
21
  /*! @license DOMPurify 3.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.0/LICENSE */
22
22
 
23
- /*! formiojs v5.3.4 | https://unpkg.com/formiojs@5.3.4/LICENSE.txt */
23
+ /*! formiojs v5.3.6 | https://unpkg.com/formiojs@5.3.6/LICENSE.txt */
24
24
 
25
25
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
26
26
 
package/lib/cjs/Embed.js CHANGED
@@ -481,7 +481,7 @@ Formio.formioReady = new Promise((ready, reject) => {
481
481
  _a._formioReady = ready;
482
482
  _a._formioReadyReject = reject;
483
483
  });
484
- Formio.version = '5.3.4';
484
+ Formio.version = '5.3.6';
485
485
  // Create a report.
486
486
  Formio.Report = {
487
487
  create: (element, submission, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
package/lib/cjs/Formio.js CHANGED
@@ -11,7 +11,7 @@ const CDN_1 = __importDefault(require("./CDN"));
11
11
  const providers_1 = __importDefault(require("./providers"));
12
12
  sdk_1.Formio.cdn = new CDN_1.default();
13
13
  sdk_1.Formio.Providers = providers_1.default;
14
- sdk_1.Formio.version = '5.3.4';
14
+ sdk_1.Formio.version = '5.3.6';
15
15
  CDN_1.default.defaultCDN = sdk_1.Formio.version.includes('rc')
16
16
  ? 'https://cdn.test-form.io'
17
17
  : 'https://cdn.form.io';
@@ -69,15 +69,9 @@ class Components {
69
69
  comp = new Component_1.default(component, options, data);
70
70
  }
71
71
  if (comp.path) {
72
- let currentRoot = comp.root;
73
- let prevRootId = null;
74
- while (currentRoot && currentRoot.id !== prevRootId) {
75
- if (currentRoot.childComponentsMap) {
76
- currentRoot.childComponentsMap[comp.path] = comp;
77
- }
78
- prevRootId = currentRoot.id;
79
- currentRoot = currentRoot.root;
80
- }
72
+ comp.eachRootChildComponentsMap((map) => {
73
+ map[comp.path] = comp;
74
+ });
81
75
  }
82
76
  // Reset the componentMatches on the root element if any new component is created.
83
77
  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
  *
@@ -430,6 +430,24 @@ class Component extends Element_1.default {
430
430
  var _a;
431
431
  return ((_a = this.root) === null || _a === void 0 ? void 0 : _a.childComponentsMap) || {};
432
432
  }
433
+ /**
434
+ * Walks this component's root chain, invoking `fn` with each ancestor root's
435
+ * `childComponentsMap`. Component registration is propagated up the wizard /
436
+ * nested-form chain at create time, so any code that mutates a registration
437
+ * (creation, removal, path-driven re-key) must update every map in the chain.
438
+ * @param {(map: object) => void} fn - Called once per root that exposes a `childComponentsMap`.
439
+ */
440
+ eachRootChildComponentsMap(fn) {
441
+ let currentRoot = this.root;
442
+ let prevRootId = null;
443
+ while (currentRoot && currentRoot.id !== prevRootId) {
444
+ if (currentRoot.childComponentsMap) {
445
+ fn(currentRoot.childComponentsMap);
446
+ }
447
+ prevRootId = currentRoot.id;
448
+ currentRoot = currentRoot.root;
449
+ }
450
+ }
433
451
  /**
434
452
  * Returns if the parent should conditionally clear.
435
453
  *
@@ -557,19 +557,14 @@ class NestedComponent extends Field_1.default {
557
557
  * @param {boolean} [all] - If set to TRUE will cascade remove all components.
558
558
  */
559
559
  removeComponent(component, components, all = false) {
560
- var _a;
561
560
  components = components || this.components;
562
561
  component.destroy(all);
563
562
  lodash_1.default.remove(components, { id: component.id });
564
- let currentRoot = component.root;
565
- let prevRootId = null;
566
- while (currentRoot && currentRoot.id !== prevRootId) {
567
- if ((_a = currentRoot.childComponentsMap) === null || _a === void 0 ? void 0 : _a[component.path]) {
568
- delete currentRoot.childComponentsMap[component.path];
563
+ component.eachRootChildComponentsMap((map) => {
564
+ if (map[component.path]) {
565
+ delete map[component.path];
569
566
  }
570
- prevRootId = currentRoot.id;
571
- currentRoot = currentRoot.root;
572
- }
567
+ });
573
568
  }
574
569
  /**
575
570
  * Removes a component provided the API key of that component.
@@ -456,8 +456,16 @@ class DataGridComponent extends NestedArrayComponent_1.default {
456
456
  updateComponentsRowIndex(components, rowIndex) {
457
457
  components.forEach((component, colIndex) => {
458
458
  var _a;
459
- if (this.componentsMap[component.paths.dataPath]) {
460
- delete this.componentsMap[component.paths.dataPath];
459
+ // The rowIndex setter cascades into descendants and regenerates their
460
+ // paths, but does not re-key them in componentsMap. Collect the slot
461
+ // and every descendant up front so we can re-key them after paths
462
+ // regenerate. Required for nested-form / sub-wizard scenarios where
463
+ // the outer wizard validates against its own componentsMap copy.
464
+ const entries = [{ instance: component, oldPath: component.paths.dataPath }];
465
+ if (typeof component.everyComponent === 'function') {
466
+ component.everyComponent((descendant) => {
467
+ entries.push({ instance: descendant, oldPath: descendant.paths.dataPath });
468
+ });
461
469
  }
462
470
  if ((_a = component.options) === null || _a === void 0 ? void 0 : _a.name) {
463
471
  const newName = `[${this.key}][${rowIndex}]`;
@@ -465,7 +473,14 @@ class DataGridComponent extends NestedArrayComponent_1.default {
465
473
  }
466
474
  component.rowIndex = rowIndex;
467
475
  component.row = `${rowIndex}-${colIndex}`;
468
- this.componentsMap[component.paths.dataPath] = component;
476
+ entries.forEach(({ instance, oldPath }) => {
477
+ instance.eachRootChildComponentsMap((map) => {
478
+ if (map[oldPath] === instance) {
479
+ delete map[oldPath];
480
+ }
481
+ map[instance.paths.dataPath] = instance;
482
+ });
483
+ });
469
484
  });
470
485
  }
471
486
  updateRowsComponents(rowIndex) {
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "type": "commonjs",
3
- "version": "5.3.4"
3
+ "version": "5.3.6"
4
4
  }
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.3.4';
17
+ static version = '5.3.6';
18
18
  static setLicense(license, norecurse = false) {
19
19
  Formio.license = license;
20
20
  if (!norecurse && Formio.FormioClass) {
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.3.4';
7
+ FormioCore.version = '5.3.6';
8
8
  CDN.defaultCDN = FormioCore.version.includes('rc')
9
9
  ? 'https://cdn.test-form.io'
10
10
  : 'https://cdn.form.io';
@@ -66,15 +66,9 @@ export default class Components {
66
66
  comp = new Component(component, options, data);
67
67
  }
68
68
  if (comp.path) {
69
- let currentRoot = comp.root;
70
- let prevRootId = null;
71
- while (currentRoot && currentRoot.id !== prevRootId) {
72
- if (currentRoot.childComponentsMap) {
73
- currentRoot.childComponentsMap[comp.path] = comp;
74
- }
75
- prevRootId = currentRoot.id;
76
- currentRoot = currentRoot.root;
77
- }
69
+ comp.eachRootChildComponentsMap((map) => {
70
+ map[comp.path] = comp;
71
+ });
78
72
  }
79
73
  // Reset the componentMatches on the root element if any new component is created.
80
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
  *
@@ -426,6 +426,24 @@ export default class Component extends Element {
426
426
  get componentsMap() {
427
427
  return this.root?.childComponentsMap || {};
428
428
  }
429
+ /**
430
+ * Walks this component's root chain, invoking `fn` with each ancestor root's
431
+ * `childComponentsMap`. Component registration is propagated up the wizard /
432
+ * nested-form chain at create time, so any code that mutates a registration
433
+ * (creation, removal, path-driven re-key) must update every map in the chain.
434
+ * @param {(map: object) => void} fn - Called once per root that exposes a `childComponentsMap`.
435
+ */
436
+ eachRootChildComponentsMap(fn) {
437
+ let currentRoot = this.root;
438
+ let prevRootId = null;
439
+ while (currentRoot && currentRoot.id !== prevRootId) {
440
+ if (currentRoot.childComponentsMap) {
441
+ fn(currentRoot.childComponentsMap);
442
+ }
443
+ prevRootId = currentRoot.id;
444
+ currentRoot = currentRoot.root;
445
+ }
446
+ }
429
447
  /**
430
448
  * Returns if the parent should conditionally clear.
431
449
  *
@@ -556,15 +556,11 @@ export default class NestedComponent extends Field {
556
556
  components = components || this.components;
557
557
  component.destroy(all);
558
558
  _.remove(components, { id: component.id });
559
- let currentRoot = component.root;
560
- let prevRootId = null;
561
- while (currentRoot && currentRoot.id !== prevRootId) {
562
- if (currentRoot.childComponentsMap?.[component.path]) {
563
- delete currentRoot.childComponentsMap[component.path];
559
+ component.eachRootChildComponentsMap((map) => {
560
+ if (map[component.path]) {
561
+ delete map[component.path];
564
562
  }
565
- prevRootId = currentRoot.id;
566
- currentRoot = currentRoot.root;
567
- }
563
+ });
568
564
  }
569
565
  /**
570
566
  * Removes a component provided the API key of that component.
@@ -450,8 +450,16 @@ export default class DataGridComponent extends NestedArrayComponent {
450
450
  }
451
451
  updateComponentsRowIndex(components, rowIndex) {
452
452
  components.forEach((component, colIndex) => {
453
- if (this.componentsMap[component.paths.dataPath]) {
454
- delete this.componentsMap[component.paths.dataPath];
453
+ // The rowIndex setter cascades into descendants and regenerates their
454
+ // paths, but does not re-key them in componentsMap. Collect the slot
455
+ // and every descendant up front so we can re-key them after paths
456
+ // regenerate. Required for nested-form / sub-wizard scenarios where
457
+ // the outer wizard validates against its own componentsMap copy.
458
+ const entries = [{ instance: component, oldPath: component.paths.dataPath }];
459
+ if (typeof component.everyComponent === 'function') {
460
+ component.everyComponent((descendant) => {
461
+ entries.push({ instance: descendant, oldPath: descendant.paths.dataPath });
462
+ });
455
463
  }
456
464
  if (component.options?.name) {
457
465
  const newName = `[${this.key}][${rowIndex}]`;
@@ -459,7 +467,14 @@ export default class DataGridComponent extends NestedArrayComponent {
459
467
  }
460
468
  component.rowIndex = rowIndex;
461
469
  component.row = `${rowIndex}-${colIndex}`;
462
- this.componentsMap[component.paths.dataPath] = component;
470
+ entries.forEach(({ instance, oldPath }) => {
471
+ instance.eachRootChildComponentsMap((map) => {
472
+ if (map[oldPath] === instance) {
473
+ delete map[oldPath];
474
+ }
475
+ map[instance.paths.dataPath] = instance;
476
+ });
477
+ });
463
478
  });
464
479
  }
465
480
  updateRowsComponents(rowIndex) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "5.3.4"
3
+ "version": "5.3.6"
4
4
 
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.3.4",
3
+ "version": "5.3.6",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -89,7 +89,7 @@
89
89
  "uuid": "^9.0.0",
90
90
  "vanilla-picker": "^2.12.3",
91
91
  "@formio/bootstrap": "^3.2.2",
92
- "@formio/core": "^2.6.4"
92
+ "@formio/core": "^2.6.6"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@types/node": "^22.15.19",