@formio/js 5.2.0-rc.9 → 5.2.1-dev.6186.ffe4f6c

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 (81) hide show
  1. package/Changelog.md +6945 -0
  2. package/dist/formio.builder.css +15 -17
  3. package/dist/formio.builder.min.css +1 -1
  4. package/dist/formio.embed.js +1 -1
  5. package/dist/formio.embed.min.js +1 -1
  6. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  7. package/dist/formio.form.css +15 -17
  8. package/dist/formio.form.js +44 -55
  9. package/dist/formio.form.min.css +1 -1
  10. package/dist/formio.form.min.js +1 -1
  11. package/dist/formio.form.min.js.LICENSE.txt +3 -3
  12. package/dist/formio.full.css +15 -17
  13. package/dist/formio.full.js +46 -57
  14. package/dist/formio.full.min.css +1 -1
  15. package/dist/formio.full.min.js +1 -1
  16. package/dist/formio.full.min.js.LICENSE.txt +3 -3
  17. package/dist/formio.js +19 -30
  18. package/dist/formio.min.js +1 -1
  19. package/dist/formio.min.js.LICENSE.txt +1 -1
  20. package/dist/formio.utils.js +18 -29
  21. package/dist/formio.utils.min.js +1 -1
  22. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  23. package/lib/cjs/Embed.js +1 -1
  24. package/lib/cjs/Formio.js +1 -1
  25. package/lib/cjs/PDFBuilder.js +8 -6
  26. package/lib/cjs/Webform.js +3 -2
  27. package/lib/cjs/WebformBuilder.js +18 -11
  28. package/lib/cjs/Wizard.d.ts +1 -2
  29. package/lib/cjs/Wizard.js +17 -23
  30. package/lib/cjs/components/Components.js +7 -1
  31. package/lib/cjs/components/_classes/component/Component.d.ts +23 -2
  32. package/lib/cjs/components/_classes/component/Component.js +61 -35
  33. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +1 -0
  34. package/lib/cjs/components/_classes/nested/NestedComponent.js +11 -3
  35. package/lib/cjs/components/file/File.d.ts +1 -1
  36. package/lib/cjs/components/file/File.js +6 -1
  37. package/lib/cjs/components/form/Form.d.ts +0 -2
  38. package/lib/cjs/components/form/Form.js +12 -20
  39. package/lib/cjs/components/select/Select.d.ts +1 -1
  40. package/lib/cjs/components/select/Select.js +17 -26
  41. package/lib/cjs/components/tags/Tags.d.ts +1 -1
  42. package/lib/cjs/components/tags/Tags.js +2 -2
  43. package/lib/cjs/formio.form.js +1 -0
  44. package/lib/cjs/utils/ChoicesWrapper.d.ts +4 -25
  45. package/lib/cjs/utils/ChoicesWrapper.js +47 -124
  46. package/lib/cjs/utils/formUtils.d.ts +3 -3
  47. package/lib/cjs/utils/index.d.ts +5 -5
  48. package/lib/cjs/utils/utils.d.ts +4 -4
  49. package/lib/cjs/utils/utils.js +2 -2
  50. package/lib/cjs/widgets/CalendarWidget.d.ts +1 -1
  51. package/lib/cjs/widgets/CalendarWidget.js +1 -1
  52. package/lib/mjs/Embed.js +1 -1
  53. package/lib/mjs/Formio.js +1 -1
  54. package/lib/mjs/PDFBuilder.js +8 -6
  55. package/lib/mjs/Webform.js +2 -2
  56. package/lib/mjs/WebformBuilder.js +19 -12
  57. package/lib/mjs/Wizard.d.ts +1 -2
  58. package/lib/mjs/Wizard.js +16 -22
  59. package/lib/mjs/components/Components.js +7 -1
  60. package/lib/mjs/components/_classes/component/Component.d.ts +23 -2
  61. package/lib/mjs/components/_classes/component/Component.js +61 -35
  62. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +1 -0
  63. package/lib/mjs/components/_classes/nested/NestedComponent.js +11 -3
  64. package/lib/mjs/components/file/File.d.ts +1 -1
  65. package/lib/mjs/components/file/File.js +6 -1
  66. package/lib/mjs/components/form/Form.d.ts +0 -2
  67. package/lib/mjs/components/form/Form.js +12 -20
  68. package/lib/mjs/components/select/Select.d.ts +1 -1
  69. package/lib/mjs/components/select/Select.js +17 -25
  70. package/lib/mjs/components/tags/Tags.d.ts +1 -1
  71. package/lib/mjs/components/tags/Tags.js +2 -2
  72. package/lib/mjs/formio.form.js +1 -0
  73. package/lib/mjs/utils/ChoicesWrapper.d.ts +4 -25
  74. package/lib/mjs/utils/ChoicesWrapper.js +26 -119
  75. package/lib/mjs/utils/formUtils.d.ts +3 -3
  76. package/lib/mjs/utils/index.d.ts +5 -5
  77. package/lib/mjs/utils/utils.d.ts +4 -4
  78. package/lib/mjs/utils/utils.js +2 -2
  79. package/lib/mjs/widgets/CalendarWidget.d.ts +1 -1
  80. package/lib/mjs/widgets/CalendarWidget.js +1 -1
  81. package/package.json +5 -5
@@ -20,7 +20,7 @@
20
20
 
21
21
  /*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
22
22
 
23
- /*! formiojs v5.2.0-rc.9 | https://unpkg.com/formiojs@5.2.0-rc.9/LICENSE.txt */
23
+ /*! formiojs v5.2.1-rc.5 | https://unpkg.com/formiojs@5.2.1-rc.5/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
@@ -418,7 +418,7 @@ Formio.formioReady = new Promise((ready, reject) => {
418
418
  _a._formioReady = ready;
419
419
  _a._formioReadyReject = reject;
420
420
  });
421
- Formio.version = '5.2.0-rc.9';
421
+ Formio.version = '5.2.1-rc.5';
422
422
  // Create a report.
423
423
  Formio.Report = {
424
424
  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.2.0-rc.9';
14
+ sdk_1.Formio.version = '5.2.1-rc.5';
15
15
  CDN_1.default.defaultCDN = sdk_1.Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
16
16
  const isNil = (val) => val === null || val === undefined;
17
17
  sdk_1.Formio.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
@@ -454,18 +454,20 @@ class PDFBuilder extends WebformBuilder_1.default {
454
454
  const repeatablePathsComps = this.findComponentsWithRepeatablePaths();
455
455
  // update elements which path was duplicated if any pathes have been changed
456
456
  if (!lodash_1.default.isEqual(this.repeatablePathsComps, repeatablePathsComps)) {
457
- (0, utils_1.eachComponent)(this.webform.getComponents(), (comp) => {
458
- if (this.repeatablePathsComps.includes(comp.component)) {
459
- this.webform.postMessage({ name: 'updateElement', data: comp.component });
460
- }
461
- });
457
+ if (!lodash_1.default.isEmpty(this.repeatablePathsComps)) {
458
+ (0, utils_1.eachComponent)(this.webform.getComponents(), (comp) => {
459
+ if (this.repeatablePathsComps.includes(comp.component)) {
460
+ this.webform.postMessage({ name: 'updateElement', data: comp.component });
461
+ }
462
+ });
463
+ }
462
464
  this.repeatablePathsComps = repeatablePathsComps;
463
465
  }
464
466
  if (!repeatablePathsComps.length) {
465
467
  return;
466
468
  }
467
469
  (0, utils_1.eachComponent)(this.webform.getComponents(), (comp) => {
468
- if (this.repeatablePathsComps.includes(comp)) {
470
+ if (this.repeatablePathsComps.includes(comp.component)) {
469
471
  this.webform.postMessage({
470
472
  name: 'showBuilderErrors',
471
473
  data: {
@@ -740,7 +740,8 @@ class Webform extends NestedDataComponent_1.default {
740
740
  this.emit(restoreDraft ? "restoreDraftError" : "saveDraftError", errDetails || errorMessage);
741
741
  }
742
742
  saveDraft() {
743
- if (!this.draftEnabled) {
743
+ var _a;
744
+ if (!this.draftEnabled || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.component.reference) === false) {
744
745
  return;
745
746
  }
746
747
  if (!this.formio) {
@@ -1113,7 +1114,7 @@ class Webform extends NestedDataComponent_1.default {
1113
1114
  const componentErrors = {};
1114
1115
  errors.forEach((err) => {
1115
1116
  var _a, _b;
1116
- const path = err.path || ((_a = err.context) === null || _a === void 0 ? void 0 : _a.path) || ((_b = err.component) === null || _b === void 0 ? void 0 : _b.key);
1117
+ const path = (0, utils_1.getStringFromComponentPath)(err.path) || ((_a = err.context) === null || _a === void 0 ? void 0 : _a.path) || ((_b = err.component) === null || _b === void 0 ? void 0 : _b.key);
1117
1118
  if (!componentErrors[path]) {
1118
1119
  componentErrors[path] = [];
1119
1120
  }
@@ -1132,15 +1132,18 @@ class WebformBuilder extends Component_1.default {
1132
1132
  (0, utils_1.eachComponent)(this.form.components, (comp, path, components, parent, paths) => {
1133
1133
  var _a, _b;
1134
1134
  const isRadioCheckbox = comp.type === 'checkbox' && comp.inputType === 'radio';
1135
- if (keys.has(paths.dataPath)) {
1136
- const onlyRadioCheckboxes = ((_a = repeatablePaths[paths.dataPath]) === null || _a === void 0 ? void 0 : _a.onlyRadioCheckboxes) === false ? false : isRadioCheckbox;
1137
- repeatablePaths[paths.dataPath] = {
1138
- comps: [...(((_b = repeatablePaths[paths.dataPath]) === null || _b === void 0 ? void 0 : _b.comps) || []), keys.get(paths.dataPath), comp],
1139
- onlyRadioCheckboxes,
1140
- };
1141
- }
1142
- else {
1143
- keys.set(paths.dataPath, comp);
1135
+ const isLayout = (0, utils_1.componentInfo)(comp).layout;
1136
+ if (!isLayout) {
1137
+ if (keys.has(paths.dataPath)) {
1138
+ const onlyRadioCheckboxes = ((_a = repeatablePaths[paths.dataPath]) === null || _a === void 0 ? void 0 : _a.onlyRadioCheckboxes) === false ? false : isRadioCheckbox;
1139
+ repeatablePaths[paths.dataPath] = {
1140
+ comps: [...(((_b = repeatablePaths[paths.dataPath]) === null || _b === void 0 ? void 0 : _b.comps) || []), keys.get(paths.dataPath), comp],
1141
+ onlyRadioCheckboxes,
1142
+ };
1143
+ }
1144
+ else {
1145
+ keys.set(paths.dataPath, comp);
1146
+ }
1144
1147
  }
1145
1148
  }, true);
1146
1149
  const componentsWithRepeatablePaths = [];
@@ -1160,6 +1163,9 @@ class WebformBuilder extends Component_1.default {
1160
1163
  comp.setCustomValidity(this.t('apiKey', { key: comp.key }));
1161
1164
  hasInvalidComponents = true;
1162
1165
  }
1166
+ else {
1167
+ comp.setCustomValidity();
1168
+ }
1163
1169
  });
1164
1170
  this.emit('builderFormValidityChange', hasInvalidComponents);
1165
1171
  }
@@ -1279,7 +1285,8 @@ class WebformBuilder extends Component_1.default {
1279
1285
  helplinks: this.helplinks,
1280
1286
  }));
1281
1287
  this.editForm.attach(this.componentEdit.querySelector(`[${this._referenceAttributeName}="editForm"]`));
1282
- this.updateComponent((_a = this.editForm.submission.data) !== null && _a !== void 0 ? _a : component);
1288
+ const editFormData = (_a = this.editForm.submission) === null || _a === void 0 ? void 0 : _a.data;
1289
+ this.updateComponent((editFormData === null || editFormData === void 0 ? void 0 : editFormData.componentJson) || editFormData || component);
1283
1290
  this.attachEditComponentControls(component, parent, isNew, original, ComponentClass);
1284
1291
  });
1285
1292
  });
@@ -1646,7 +1653,7 @@ class WebformBuilder extends Component_1.default {
1646
1653
  }
1647
1654
  hasEditTabs(type) {
1648
1655
  // If the component type does not exist then it has no edit tabs
1649
- if (!Components_1.default.components[type]) {
1656
+ if (!Components_1.default.components[type === 'custom' ? 'unknown' : type]) {
1650
1657
  return false;
1651
1658
  }
1652
1659
  const editTabs = (0, utils_1.getComponent)(Components_1.default.components[type === 'custom' ? 'unknown' : type].editForm().components, 'tabs', true).components;
@@ -6,7 +6,6 @@ declare class Wizard extends Webform {
6
6
  originalComponents: any[];
7
7
  page: number;
8
8
  currentPanel: any;
9
- currentPanels: any[] | null;
10
9
  currentNextPage: number;
11
10
  _seenPages: number[];
12
11
  subWizards: any[];
@@ -17,7 +16,7 @@ declare class Wizard extends Webform {
17
16
  originalOptions: any;
18
17
  isLastPage(): any;
19
18
  getPages(args?: {}): any[];
20
- get hasExtraPages(): boolean;
19
+ get hasSubWizards(): boolean;
21
20
  get localData(): any;
22
21
  get wizardKey(): string;
23
22
  set wizard(form: object);
package/lib/cjs/Wizard.js CHANGED
@@ -34,7 +34,6 @@ class Wizard extends Webform_1.default {
34
34
  this.originalComponents = [];
35
35
  this.page = 0;
36
36
  this.currentPanel = null;
37
- this.currentPanels = null;
38
37
  this.currentNextPage = 0;
39
38
  this._seenPages = [0];
40
39
  this.subWizards = [];
@@ -53,12 +52,12 @@ class Wizard extends Webform_1.default {
53
52
  }
54
53
  getPages(args = {}) {
55
54
  const { all = false } = args;
56
- const pages = this.hasExtraPages ? this.components : this.pages;
55
+ const pages = this.hasSubWizards ? this.components : this.pages;
57
56
  const filteredPages = pages
58
57
  .filter(all ? lodash_1.default.identity : (p, index) => this._seenPages.includes(index));
59
58
  return filteredPages;
60
59
  }
61
- get hasExtraPages() {
60
+ get hasSubWizards() {
62
61
  return !lodash_1.default.isEmpty(this.subWizards);
63
62
  }
64
63
  get data() {
@@ -187,9 +186,9 @@ class Wizard extends Webform_1.default {
187
186
  }
188
187
  render() {
189
188
  const ctx = this.renderContext;
190
- if (this.component.key) {
191
- ctx.panels.map(panel => {
192
- if (panel.key === this.component.key) {
189
+ if (this.component.id) {
190
+ ctx.panels.forEach(panel => {
191
+ if (panel.id === this.component.id) {
193
192
  this.currentPanel = panel;
194
193
  ctx.wizardPageTooltip = this.getFormattedTooltip(panel.tooltip);
195
194
  }
@@ -587,7 +586,7 @@ class Wizard extends Webform_1.default {
587
586
  this.pageFieldLogic(num);
588
587
  this.getNextPage();
589
588
  let parentNum = num;
590
- if (this.hasExtraPages) {
589
+ if (this.hasSubWizards) {
591
590
  const pageFromPages = this.pages[num];
592
591
  const pageFromComponents = this.components[num];
593
592
  if (!pageFromComponents || (pageFromPages === null || pageFromPages === void 0 ? void 0 : pageFromPages.id) !== pageFromComponents.id) {
@@ -873,7 +872,7 @@ class Wizard extends Webform_1.default {
873
872
  }
874
873
  }
875
874
  onChange(flags, changed, modified, changes) {
876
- var _a, _b;
875
+ var _a;
877
876
  super.onChange(flags, changed, modified, changes);
878
877
  // The onChange loop doesn't need all components for wizards
879
878
  const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
@@ -881,23 +880,18 @@ class Wizard extends Webform_1.default {
881
880
  this.showErrors(errors, true, true);
882
881
  }
883
882
  // If the pages change, need to redraw the header.
884
- let currentPanels;
885
- let panels;
883
+ const currentPanels = this.pages;
884
+ // calling this.establishPages() updates/mutates this.pages to be the current pages
885
+ this.establishPages();
886
+ const newPanels = this.pages;
886
887
  const currentNextPage = this.currentNextPage;
887
- if (this.hasExtraPages) {
888
- currentPanels = this.pages.map(page => page.component.key);
889
- this.establishPages();
890
- panels = this.pages.map(page => page.component.key);
891
- }
892
- else {
893
- currentPanels = this.currentPanels || this.pages.map(page => page.component.key);
894
- panels = this.establishPages().map(panel => panel.key);
895
- this.currentPanels = panels;
896
- if (((_a = this.currentPanel) === null || _a === void 0 ? void 0 : _a.key) && ((_b = this.currentPanels) === null || _b === void 0 ? void 0 : _b.length)) {
897
- this.setPage(this.currentPanels.findIndex(panel => panel === this.currentPanel.key));
898
- }
888
+ const panelsUpdated = !lodash_1.default.isEqual(newPanels, currentPanels);
889
+ if (((_a = this.currentPanel) === null || _a === void 0 ? void 0 : _a.id) && this.pages.length && (!this.hasSubWizards || (this.hasSubWizards && panelsUpdated))) {
890
+ const newIndex = this.pages.findIndex(page => page.id === this.currentPanel.id);
891
+ if (newIndex !== -1)
892
+ this.setPage(newIndex);
899
893
  }
900
- if (!lodash_1.default.isEqual(panels, currentPanels) || (flags && flags.fromSubmission)) {
894
+ if (panelsUpdated || (flags && flags.fromSubmission)) {
901
895
  this.redrawHeader();
902
896
  }
903
897
  // If the next page changes, then make sure to redraw navigation.
@@ -57,7 +57,7 @@ class Components {
57
57
  // eslint-disable-next-line new-cap
58
58
  comp = new Components.components['datagrid'](component, options, data);
59
59
  }
60
- else if (component.tree) {
60
+ else if (component.tree || (component.input && Array.isArray(component.components))) {
61
61
  // eslint-disable-next-line new-cap
62
62
  comp = new Components.components['nesteddata'](component, options, data);
63
63
  }
@@ -75,6 +75,12 @@ class Components {
75
75
  if (comp.path) {
76
76
  comp.componentsMap[comp.path] = comp;
77
77
  }
78
+ // Reset the componentMatches on the root element if any new component is created.
79
+ let parent = comp.parent;
80
+ while (parent) {
81
+ parent.componentMatches = {};
82
+ parent = parent.parent;
83
+ }
78
84
  return comp;
79
85
  }
80
86
  }
@@ -165,10 +165,16 @@ declare class Component extends Element {
165
165
  get componentsMap(): object;
166
166
  /**
167
167
  * Returns if the parent should conditionally clear.
168
+ *
168
169
  * @returns {boolean} - If the parent should conditionally clear.
169
170
  */
170
171
  parentShouldConditionallyClear(): boolean;
171
172
  parentConditionallyHidden(): boolean;
173
+ /**
174
+ * Returns true if any of the parents default their component "hidden" property to true.
175
+ * @returns {boolean} - If any parent defaults the hidden property to true.
176
+ */
177
+ anyParentDefaultsHidden(): boolean;
172
178
  set data(value: any);
173
179
  get data(): any;
174
180
  mergeSchema(component?: {}): any;
@@ -232,8 +238,23 @@ declare class Component extends Element {
232
238
  get visible(): boolean;
233
239
  get logicallyHidden(): any;
234
240
  _logicallyHidden: any;
235
- shouldConditionallyClear(skipParent?: boolean): boolean;
236
- conditionallyHidden(skipParent?: boolean): boolean;
241
+ /**
242
+ * Determines if the component should clear its value when the root form is pristine.
243
+ * @returns {boolean} - If the component should clear its value when the root form is pristine.
244
+ */
245
+ shouldConditionallyClearOnPristine(): boolean;
246
+ /**
247
+ * Returns if the component should clear its value when conditionally hidden.
248
+ * @returns {boolean} - If the component should clear its value when conditionally hidden.
249
+ */
250
+ shouldConditionallyClear(): boolean;
251
+ _conditionallyClear: boolean | undefined;
252
+ /**
253
+ * Returns if the component is conditionally hidden.
254
+ * @returns {boolean} - If the component is conditionally hidden.
255
+ */
256
+ conditionallyHidden(): boolean;
257
+ _conditionallyHidden: boolean | undefined;
237
258
  set currentForm(instance: any);
238
259
  get currentForm(): any;
239
260
  _currentForm: any;
@@ -424,12 +424,14 @@ class Component extends Element_1.default {
424
424
  }
425
425
  /**
426
426
  * Returns if the parent should conditionally clear.
427
+ *
427
428
  * @returns {boolean} - If the parent should conditionally clear.
428
429
  */
429
430
  parentShouldConditionallyClear() {
430
431
  let currentParent = this.parent;
431
432
  while (currentParent) {
432
- if (currentParent.shouldConditionallyClear(true)) {
433
+ if ((currentParent.allowData && currentParent._conditionallyClear) ||
434
+ (!currentParent.allowData && currentParent._conditionallyHidden)) {
433
435
  return true;
434
436
  }
435
437
  currentParent = currentParent.parent;
@@ -439,7 +441,21 @@ class Component extends Element_1.default {
439
441
  parentConditionallyHidden() {
440
442
  let currentParent = this.parent;
441
443
  while (currentParent) {
442
- if (currentParent.conditionallyHidden(true)) {
444
+ if (currentParent._conditionallyHidden) {
445
+ return true;
446
+ }
447
+ currentParent = currentParent.parent;
448
+ }
449
+ return false;
450
+ }
451
+ /**
452
+ * Returns true if any of the parents default their component "hidden" property to true.
453
+ * @returns {boolean} - If any parent defaults the hidden property to true.
454
+ */
455
+ anyParentDefaultsHidden() {
456
+ let currentParent = this.parent;
457
+ while (currentParent) {
458
+ if (currentParent.component.hidden) {
443
459
  return true;
444
460
  }
445
461
  currentParent = currentParent.parent;
@@ -654,48 +670,58 @@ class Component extends Element_1.default {
654
670
  }
655
671
  return this._logicallyHidden;
656
672
  }
657
- shouldConditionallyClear(skipParent = false) {
673
+ /**
674
+ * Determines if the component should clear its value when the root form is pristine.
675
+ * @returns {boolean} - If the component should clear its value when the root form is pristine.
676
+ */
677
+ shouldConditionallyClearOnPristine() {
678
+ // If the form is pristine, we should NOT clear the value of a conditionally hidden child component
679
+ // of a layout component that defaults to hidden using the "hidden" component property.
680
+ return !this.anyParentDefaultsHidden();
681
+ }
682
+ /**
683
+ * Returns if the component should clear its value when conditionally hidden.
684
+ * @returns {boolean} - If the component should clear its value when conditionally hidden.
685
+ */
686
+ shouldConditionallyClear() {
658
687
  // Skip if this component has clearOnHide set to false.
659
688
  if (this.component.clearOnHide === false) {
660
- return false;
689
+ this._conditionallyClear = false;
690
+ return this._conditionallyClear;
661
691
  }
662
692
  // If the component is logically hidden, then it is conditionally hidden and should clear.
663
693
  if (this.logicallyHidden) {
664
- return true;
694
+ this._conditionallyClear = true;
695
+ return this._conditionallyClear;
665
696
  }
666
697
  // If we have a condition and it is not conditionally visible, the it should conditionally clear.
667
- if (this.hasCondition() && !this.conditionallyVisible()) {
668
- return true;
669
- }
670
- if (skipParent) {
671
- // Stop recurrsion for the parent checks.
672
- return false;
673
- }
674
- // If this component has a set value, then it should ONLY clear if a parent is hidden
675
- // and has the clearOnHide set to true.
676
- if (this.hasSetValue) {
677
- return this.parentShouldConditionallyClear();
698
+ if (this.hasCondition() &&
699
+ !this.conditionallyVisible() &&
700
+ (!this.rootPristine || this.shouldConditionallyClearOnPristine())) {
701
+ this._conditionallyClear = true;
702
+ return this._conditionallyClear;
678
703
  }
679
- // Clear the value if the parent is conditionally hidden.
680
- return this.parentConditionallyHidden();
704
+ this._conditionallyClear = this.hasSetValue ? false : this.parentShouldConditionallyClear();
705
+ return this._conditionallyClear;
681
706
  }
682
- conditionallyHidden(skipParent = false) {
707
+ /**
708
+ * Returns if the component is conditionally hidden.
709
+ * @returns {boolean} - If the component is conditionally hidden.
710
+ */
711
+ conditionallyHidden() {
712
+ // If it is logically hidden, then it is conditionally hidden.
683
713
  if (this.logicallyHidden) {
684
- return true;
714
+ this._conditionallyHidden = true;
715
+ return this._conditionallyHidden;
685
716
  }
686
- if (!this.hasCondition() && !skipParent) {
687
- return this.parentConditionallyHidden();
688
- }
689
- // Return if we are not conditionally visible (conditionallyHidden)
690
- if (!this.conditionallyVisible()) {
691
- return true;
692
- }
693
- if (skipParent) {
694
- // Stop recurrsion for the parent checks.
695
- return false;
717
+ // If it has a condition, and is not conditionally visible, then it is conditionally hidden.
718
+ if (this.hasCondition() && !this.conditionallyVisible()) {
719
+ this._conditionallyHidden = true;
720
+ return this._conditionallyHidden;
696
721
  }
697
- // Check the parent.
698
- return this.parentConditionallyHidden();
722
+ // It is conditionally hidden if its parent is conditionally hidden.
723
+ this._conditionallyHidden = this.parentConditionallyHidden();
724
+ return this._conditionallyHidden;
699
725
  }
700
726
  get currentForm() {
701
727
  return this._currentForm;
@@ -3163,6 +3189,9 @@ class Component extends Element_1.default {
3163
3189
  data = data || this.rootValue;
3164
3190
  flags = flags || {};
3165
3191
  row = row || this.data;
3192
+ if (flags.noCheck) {
3193
+ return true;
3194
+ }
3166
3195
  // Some components (for legacy reasons) have calls to "checkData" in inappropriate places such
3167
3196
  // as setValue. Historically, this was bypassed by a series of cached states around the data model
3168
3197
  // which caused its own problems. We need to ensure that premium and custom components do not fall into
@@ -3177,9 +3206,6 @@ class Component extends Element_1.default {
3177
3206
  if (!flags.fromBlur) {
3178
3207
  this.checkRefreshOn(flags.changes, flags);
3179
3208
  }
3180
- if (flags.noCheck) {
3181
- return true;
3182
- }
3183
3209
  this.checkComponentConditions(data, flags, row);
3184
3210
  if (this.id !== flags.triggeredComponentId) {
3185
3211
  this.calculateComponentValue(data, flags, row);
@@ -108,6 +108,7 @@ export default class NestedComponent extends Field {
108
108
  * @returns {any} - The component that is located.
109
109
  */
110
110
  getComponent(path: string): any;
111
+ componentMatches: {} | undefined;
111
112
  /**
112
113
  * Return a component provided the Id of the component.
113
114
  * @param {string} id - The Id of the component.
@@ -311,6 +311,13 @@ class NestedComponent extends Field_1.default {
311
311
  */
312
312
  getComponent(path) {
313
313
  var _a;
314
+ // If the component is found
315
+ if (!this.componentMatches) {
316
+ this.componentMatches = {};
317
+ }
318
+ if (this.componentMatches && this.componentMatches[path]) {
319
+ return this.componentMatches[path];
320
+ }
314
321
  path = utils_1.default.getStringFromComponentPath(path);
315
322
  const matches = {
316
323
  path: undefined,
@@ -336,7 +343,8 @@ class NestedComponent extends Field_1.default {
336
343
  return match;
337
344
  });
338
345
  });
339
- return (_a = utils_1.default.getBestMatch(matches)) === null || _a === void 0 ? void 0 : _a.instance;
346
+ this.componentMatches[path] = (_a = utils_1.default.getBestMatch(matches)) === null || _a === void 0 ? void 0 : _a.instance;
347
+ return this.componentMatches[path];
340
348
  }
341
349
  /**
342
350
  * Return a component provided the Id of the component.
@@ -664,7 +672,7 @@ class NestedComponent extends Field_1.default {
664
672
  validationProcessor({ scope, data, row, instance, paths }, flags) {
665
673
  var _a;
666
674
  const { dirty } = flags;
667
- if (this.root.hasExtraPages && this.page !== this.root.page) {
675
+ if (this.root && this.root.hasSubWizards && this.page !== this.root.page) {
668
676
  instance = ((_a = this.componentsMap) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(paths.dataPath))
669
677
  ? this.componentsMap[paths.dataPath]
670
678
  : this.getComponent(paths.dataPath);
@@ -813,7 +821,7 @@ class NestedComponent extends Field_1.default {
813
821
  return false;
814
822
  }
815
823
  if (component.type === 'components') {
816
- if (component.tree && component.hasValue(value)) {
824
+ if ((component.tree || component.hasInput) && component.hasValue(value)) {
817
825
  return component.setValue(lodash_1.default.get(value, component.key), flags);
818
826
  }
819
827
  return component.setValue(value, flags);
@@ -33,7 +33,7 @@ export default class FileComponent extends Field {
33
33
  get dataReady(): Promise<any>;
34
34
  loadImage(fileInfo: any): any;
35
35
  get emptyValue(): never[];
36
- getValueAsString(value: any): any;
36
+ getValueAsString(value: any, options: any): any;
37
37
  get defaultValue(): any[];
38
38
  get hasTypes(): any;
39
39
  _fileBrowseHidden: any;
@@ -114,7 +114,12 @@ class FileComponent extends Field_1.default {
114
114
  get emptyValue() {
115
115
  return [];
116
116
  }
117
- getValueAsString(value) {
117
+ getValueAsString(value, options) {
118
+ if ((options === null || options === void 0 ? void 0 : options.review) && !this.component.uploadOnly) {
119
+ return lodash_1.default.map(value, (val, index) => {
120
+ return `<a href="${val.url || '#'}" target="_blank" data-path='${this.path}' data-fileindex='${index}'>${val.originalName}</a>`;
121
+ }).join(', ');
122
+ }
118
123
  if (lodash_1.default.isArray(value)) {
119
124
  return lodash_1.default.map(value, 'originalName').join(', ');
120
125
  }
@@ -98,8 +98,6 @@ export default class FormComponent extends Component {
98
98
  * @returns {void}
99
99
  */
100
100
  onSetSubFormValue(submission: object | null | undefined, flags: object | null | undefined): void;
101
- areAllComponentsEmpty(data: any): boolean;
102
- conditionallyHidden(): boolean;
103
101
  updateSubFormVisibility(): void;
104
102
  /**
105
103
  * Determines if this form is a Nested Wizard
@@ -101,6 +101,9 @@ class FormComponent extends Component_1.default {
101
101
  }
102
102
  return this.createSubForm();
103
103
  }
104
+ shouldConditionallyClearOnPristine() {
105
+ return !this.hasSetValue && super.shouldConditionallyClearOnPristine();
106
+ }
104
107
  get dataReady() {
105
108
  return this.subFormReady || Promise.resolve();
106
109
  }
@@ -292,11 +295,13 @@ class FormComponent extends Component_1.default {
292
295
  }
293
296
  this.subForm.attach(element);
294
297
  this.valueChanged = this.hasSetValue;
295
- if (!this.valueChanged && this.dataValue.state !== 'submitted') {
296
- this.setDefaultValue();
297
- }
298
- else {
299
- this.restoreValue();
298
+ if (!this.shouldConditionallyClear()) {
299
+ if (!this.valueChanged && this.dataValue.state !== 'submitted') {
300
+ this.setDefaultValue();
301
+ }
302
+ else {
303
+ this.restoreValue();
304
+ }
300
305
  }
301
306
  }
302
307
  if (!this.builderMode && this.component.modalEdit) {
@@ -415,7 +420,7 @@ class FormComponent extends Component_1.default {
415
420
  this.component.components = (_a = this.subForm._form) === null || _a === void 0 ? void 0 : _a.components;
416
421
  this.component.display = (_b = this.subForm._form) === null || _b === void 0 ? void 0 : _b.display;
417
422
  this.subForm.on('change', () => {
418
- if (this.subForm) {
423
+ if (this.subForm && !this.shouldConditionallyClear()) {
419
424
  this.dataValue = this.subForm.getValue();
420
425
  this.triggerChange({
421
426
  noEmit: true
@@ -680,20 +685,7 @@ class FormComponent extends Component_1.default {
680
685
  this.subForm.setValue(submission, flags);
681
686
  }
682
687
  isEmpty(value = this.dataValue) {
683
- return value === null || lodash_1.default.isEqual(value, this.emptyValue) || (this.areAllComponentsEmpty(value === null || value === void 0 ? void 0 : value.data) && !(value === null || value === void 0 ? void 0 : value._id));
684
- }
685
- areAllComponentsEmpty(data) {
686
- let res = true;
687
- if (this.subForm) {
688
- this.subForm.everyComponent((comp) => {
689
- const componentValue = lodash_1.default.get(data, comp.key);
690
- res &= comp.isEmpty(componentValue);
691
- });
692
- }
693
- else {
694
- res = false;
695
- }
696
- return res;
688
+ return value === null || lodash_1.default.isEqual(value, this.emptyValue);
697
689
  }
698
690
  getValue() {
699
691
  if (this.subForm) {
@@ -89,6 +89,7 @@ export default class SelectComponent extends ListComponent {
89
89
  disableInfiniteScroll(): void;
90
90
  set serverCount(value: any);
91
91
  get serverCount(): any;
92
+ shouldResetChoicesItems(items: any): boolean;
92
93
  setItems(items: any, fromSearch: any): void;
93
94
  selectItems: any;
94
95
  set downloadedResources(value: any);
@@ -126,7 +127,6 @@ export default class SelectComponent extends ListComponent {
126
127
  get isLoadingAvailable(): any;
127
128
  onScroll(): void;
128
129
  attachRefreshOnBlur(): void;
129
- addPlaceholderItem(placeholderValue: any): void;
130
130
  update(): void;
131
131
  addCurrentChoices(values: any, items: any, keyValue: any): any;
132
132
  getValueAsString(data: any, options: any): any;