@formio/js 5.1.0-rc.24 → 5.1.0-rc.26

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 (62) hide show
  1. package/dist/formio.embed.js +1 -1
  2. package/dist/formio.embed.min.js +1 -1
  3. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  4. package/dist/formio.form.js +12 -12
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  7. package/dist/formio.full.js +16 -16
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  10. package/dist/formio.js +2 -2
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.min.js.LICENSE.txt +1 -1
  13. package/dist/formio.utils.js +1 -1
  14. package/dist/formio.utils.min.js +1 -1
  15. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  16. package/lib/cjs/Embed.js +1 -1
  17. package/lib/cjs/Formio.js +1 -1
  18. package/lib/cjs/WebformBuilder.js +4 -0
  19. package/lib/cjs/Wizard.d.ts +1 -0
  20. package/lib/cjs/Wizard.js +23 -3
  21. package/lib/cjs/components/_classes/component/Component.d.ts +11 -1
  22. package/lib/cjs/components/_classes/component/Component.js +37 -11
  23. package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +0 -1
  24. package/lib/cjs/components/_classes/nested/NestedComponent.js +8 -12
  25. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +0 -2
  26. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +0 -11
  27. package/lib/cjs/components/address/Address.d.ts +9 -0
  28. package/lib/cjs/components/address/Address.js +18 -8
  29. package/lib/cjs/components/address/editForm/Address.edit.provider.js +8 -8
  30. package/lib/cjs/components/datagrid/DataGrid.js +0 -3
  31. package/lib/cjs/components/editgrid/EditGrid.js +0 -8
  32. package/lib/cjs/components/file/editForm/File.edit.file.d.ts +13 -0
  33. package/lib/cjs/components/file/editForm/File.edit.file.js +1 -0
  34. package/lib/cjs/components/form/Form.js +4 -0
  35. package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -1
  36. package/lib/cjs/components/selectboxes/SelectBoxes.js +3 -0
  37. package/lib/cjs/utils/utils.d.ts +0 -8
  38. package/lib/cjs/utils/utils.js +1 -22
  39. package/lib/mjs/Embed.js +1 -1
  40. package/lib/mjs/Formio.js +1 -1
  41. package/lib/mjs/WebformBuilder.js +4 -0
  42. package/lib/mjs/Wizard.d.ts +1 -0
  43. package/lib/mjs/Wizard.js +22 -2
  44. package/lib/mjs/components/_classes/component/Component.d.ts +11 -1
  45. package/lib/mjs/components/_classes/component/Component.js +38 -12
  46. package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +0 -1
  47. package/lib/mjs/components/_classes/nested/NestedComponent.js +8 -12
  48. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +0 -2
  49. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +0 -11
  50. package/lib/mjs/components/address/Address.d.ts +9 -0
  51. package/lib/mjs/components/address/Address.js +18 -8
  52. package/lib/mjs/components/address/editForm/Address.edit.provider.js +8 -8
  53. package/lib/mjs/components/datagrid/DataGrid.js +0 -3
  54. package/lib/mjs/components/editgrid/EditGrid.js +0 -7
  55. package/lib/mjs/components/file/editForm/File.edit.file.d.ts +13 -0
  56. package/lib/mjs/components/file/editForm/File.edit.file.js +1 -0
  57. package/lib/mjs/components/form/Form.js +4 -0
  58. package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -1
  59. package/lib/mjs/components/selectboxes/SelectBoxes.js +3 -0
  60. package/lib/mjs/utils/utils.d.ts +0 -8
  61. package/lib/mjs/utils/utils.js +0 -20
  62. package/package.json +2 -2
@@ -19,7 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.uniqueKey = exports.iterateKey = exports.delay = exports.fieldData = exports.getCurrencyAffixes = exports.getNumberDecimalLimit = exports.getNumberSeparators = exports.matchInputMask = exports.unmaskValue = exports.getInputMask = exports.convertFormatToMask = exports.convertFormatToMoment = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.momentDate = exports.loadZones = exports.shouldLoadZones = exports.zonesLoaded = exports.offsetDate = exports.currentTimezone = exports.isValidDate = exports.getDateSetting = exports.guid = exports.uniqueName = exports.convertStringToHTMLElement = exports.unescapeHTML = exports.removeHTML = exports.setActionProperty = exports.checkTrigger = exports.checkCondition = exports.checkJsonConditional = exports.checkCustomConditional = exports.getComponentActualValue = exports.checkSimpleConditional = exports.checkCalculated = exports.isMongoId = exports.boolValue = exports.getScriptPlugin = exports.getElementRect = exports.getPropertyValue = exports.getRandomComponentId = exports.evaluate = exports.moment = exports.ConditionOperators = exports.jsonLogic = void 0;
22
- exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload = exports.withSwitch = void 0;
22
+ exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload = exports.withSwitch = void 0;
23
23
  const lodash_1 = __importDefault(require("lodash"));
24
24
  exports._ = lodash_1.default;
25
25
  const json_logic_js_1 = __importDefault(require("json-logic-js"));
@@ -1593,27 +1593,6 @@ function isPromise(value) {
1593
1593
  && Object.prototype.toString.call(value) === '[object Promise]';
1594
1594
  }
1595
1595
  exports.isPromise = isPromise;
1596
- /**
1597
- * Determines if the component has a scoping parent in tree (a component which scopes its children and manages its
1598
- * changes by itself, e.g. EditGrid)
1599
- * @param {Component} componentInstance - The component to check for the scoping parent.
1600
- * @param {boolean} firstPass - Whether it is the first pass of the function
1601
- * @returns {boolean|*} - TRUE if the component has a scoping parent; FALSE otherwise
1602
- */
1603
- function isInsideScopingComponent(componentInstance, firstPass = true) {
1604
- if (!firstPass && (componentInstance === null || componentInstance === void 0 ? void 0 : componentInstance.hasScopedChildren)) {
1605
- return true;
1606
- }
1607
- const dataParent = getDataParentComponent(componentInstance);
1608
- if (dataParent === null || dataParent === void 0 ? void 0 : dataParent.hasScopedChildren) {
1609
- return true;
1610
- }
1611
- else if (dataParent === null || dataParent === void 0 ? void 0 : dataParent.parent) {
1612
- return isInsideScopingComponent(dataParent.parent, false);
1613
- }
1614
- return false;
1615
- }
1616
- exports.isInsideScopingComponent = isInsideScopingComponent;
1617
1596
  /**
1618
1597
  * Returns all the focusable elements within the provided dom element.
1619
1598
  * @param {HTMLElement} element - The element to get the focusable elements from.
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.1.0-rc.24';
17
+ static version = '5.1.0-rc.26';
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.1.0-rc.24';
7
+ FormioCore.version = '5.1.0-rc.26';
8
8
  CDN.defaultCDN = FormioCore.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
9
9
  const isNil = (val) => val === null || val === undefined;
10
10
  FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
@@ -1637,6 +1637,10 @@ export default class WebformBuilder extends Component {
1637
1637
  info.type);
1638
1638
  }
1639
1639
  hasEditTabs(type) {
1640
+ // If the component type does not exist then it has no edit tabs
1641
+ if (!Components.components[type]) {
1642
+ return false;
1643
+ }
1640
1644
  const editTabs = getComponent(Components.components[type === 'custom' ? 'unknown' : type].editForm().components, 'tabs', true).components;
1641
1645
  const hiddenEditTabs = _.filter(_.get(this.options, `editForm.${type}`, []), 'ignore');
1642
1646
  return _.intersectionBy(editTabs, hiddenEditTabs, 'key').length !== editTabs.length;
@@ -106,6 +106,7 @@ declare class Wizard extends Webform {
106
106
  onChange(flags: any, changed: any, modified: any, changes: any): void;
107
107
  checkValidity(data: any, dirty: any, row: any, currentPageOnly: any, childErrors?: any[]): any;
108
108
  focusOnComponent(key: any): void | Promise<void>;
109
+ triggerButtonCaptcha(page: any): void;
109
110
  }
110
111
  declare namespace Wizard {
111
112
  let setBaseUrl: any;
package/lib/mjs/Wizard.js CHANGED
@@ -594,7 +594,7 @@ export default class Wizard extends Webform {
594
594
  }
595
595
  this.redraw().then(() => {
596
596
  this.checkData(this.submission.data);
597
- this.triggerCaptcha(this.currentPanel.components);
597
+ this.triggerCaptcha(this.currentPage.components);
598
598
  const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
599
599
  if (this.alert) {
600
600
  this.showErrors(errors, true, true);
@@ -660,6 +660,7 @@ export default class Wizard extends Webform {
660
660
  beforeSubmit() {
661
661
  const pages = this.getPages({ all: true });
662
662
  return Promise.all(pages.map((page) => {
663
+ this.triggerButtonCaptcha(page);
663
664
  page.options.beforeSubmit = true;
664
665
  return page.beforeSubmit();
665
666
  }));
@@ -718,7 +719,10 @@ export default class Wizard extends Webform {
718
719
  validateCurrentPage(flags = {}) {
719
720
  const components = this.currentPage?.components.map((component) => component.component);
720
721
  // Accessing the parent ensures the right instance (whether it's the parent Wizard or a nested Wizard) performs its validation
721
- return this.currentPage?.parent.validateComponents(components, this.root.data, flags);
722
+ if (this.currentPage?.parent) {
723
+ return this.currentPage?.parent.validateComponents(components, this.root.data, flags);
724
+ }
725
+ return this.currentPage?.validateComponents(components, this.root ? this.root.data : this.data, flags);
722
726
  }
723
727
  emitPrevPage() {
724
728
  this.emit('prevPage', { page: this.page, submission: this.submission });
@@ -930,6 +934,22 @@ export default class Wizard extends Webform {
930
934
  }
931
935
  return super.focusOnComponent(key);
932
936
  }
937
+ triggerButtonCaptcha(page) {
938
+ if (!page.components) {
939
+ return;
940
+ }
941
+ let captchaComponent;
942
+ page.eachComponent((component) => {
943
+ if (/^(re)?captcha$/.test(component.component.type) &&
944
+ component.component.eventType === 'buttonClick' &&
945
+ component.component.buttonKey === 'submit') {
946
+ captchaComponent = component;
947
+ }
948
+ });
949
+ if (captchaComponent) {
950
+ captchaComponent.verify(`submitClick`);
951
+ }
952
+ }
933
953
  }
934
954
  Wizard.setBaseUrl = Formio.setBaseUrl;
935
955
  Wizard.setApiUrl = Formio.setApiUrl;
@@ -778,6 +778,10 @@ declare class Component extends Element {
778
778
  * @returns {void}
779
779
  */
780
780
  setElementInvalid(element: HTMLElement, invalid: boolean): void;
781
+ /**
782
+ * Clear any conditionally hidden components for this component only.
783
+ */
784
+ clearComponentOnHide(): void;
781
785
  /**
782
786
  * Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
783
787
  */
@@ -881,7 +885,12 @@ declare class Component extends Element {
881
885
  */
882
886
  deleteValue(): void;
883
887
  getCustomDefaultValue(defaultValue: any): any;
884
- get shouldAddDefaultValue(): any;
888
+ /**
889
+ * Returns if a component has a default value set.
890
+ * @returns {boolean} - TRUE if a default value is set.
891
+ */
892
+ get hasDefaultValue(): boolean;
893
+ get shouldAddDefaultValue(): boolean;
885
894
  get defaultValue(): any;
886
895
  /**
887
896
  * Get the input value of this component.
@@ -1055,6 +1064,7 @@ declare class Component extends Element {
1055
1064
  * @returns {void|boolean} - TRUE if no check should be performed on the component.
1056
1065
  */
1057
1066
  checkData(data?: any, flags?: any, row?: any): void | boolean;
1067
+ checkingData: boolean | undefined;
1058
1068
  checkModal(errors?: any[], dirty?: boolean): void;
1059
1069
  get validationValue(): any;
1060
1070
  isEmpty(value?: any): any;
@@ -6,7 +6,7 @@ import isMobile from 'ismobilejs';
6
6
  import { processOne, processOneSync, validateProcessInfo } from '@formio/core/process';
7
7
  import { Formio } from '../../../Formio';
8
8
  import * as FormioUtils from '../../../utils/utils';
9
- import { fastCloneDeep, boolValue, isInsideScopingComponent, currentTimezone, getScriptPlugin, getContextualRowData } from '../../../utils/utils';
9
+ import { fastCloneDeep, boolValue, currentTimezone, getScriptPlugin, getContextualRowData } from '../../../utils/utils';
10
10
  import Element from '../../../Element';
11
11
  import ComponentModal from '../componentModal/ComponentModal';
12
12
  import Widgets from '../../../widgets';
@@ -1915,7 +1915,7 @@ export default class Component extends Element {
1915
1915
  if (this.visible !== visible) {
1916
1916
  this.visible = visible;
1917
1917
  }
1918
- this.clearOnHide();
1918
+ this.clearComponentOnHide();
1919
1919
  return visible;
1920
1920
  }
1921
1921
  /**
@@ -2175,16 +2175,11 @@ export default class Component extends Element {
2175
2175
  element.setAttribute('aria-invalid', invalid ? 'true' : 'false');
2176
2176
  }
2177
2177
  /**
2178
- * Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
2178
+ * Clear any conditionally hidden components for this component only.
2179
2179
  */
2180
- clearOnHide() {
2180
+ clearComponentOnHide() {
2181
2181
  // clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
2182
- if (
2183
- // if change happens inside EditGrid's row, it doesn't trigger change on the root level, so rootPristine will be true
2184
- (!this.rootPristine || this.options.server || isInsideScopingComponent(this)) &&
2185
- this.component.clearOnHide !== false &&
2186
- !this.options.readOnly &&
2187
- !this.options.showHiddenFields) {
2182
+ if (this.component.clearOnHide !== false && !this.options.readOnly && !this.options.showHiddenFields) {
2188
2183
  if (this.conditionallyHidden()) {
2189
2184
  this.deleteValue();
2190
2185
  }
@@ -2196,6 +2191,12 @@ export default class Component extends Element {
2196
2191
  }
2197
2192
  }
2198
2193
  }
2194
+ /**
2195
+ * Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
2196
+ */
2197
+ clearOnHide() {
2198
+ this.clearComponentOnHide();
2199
+ }
2199
2200
  /**
2200
2201
  * Triggers a debounced onChange event for the root component (usually Webform).
2201
2202
  * @param {...any} args - The arguments to pass to the onChange event.
@@ -2492,12 +2493,27 @@ export default class Component extends Element {
2492
2493
  }
2493
2494
  getCustomDefaultValue(defaultValue) {
2494
2495
  if (this.component.customDefaultValue && !this.options.preview) {
2495
- defaultValue = this.evaluate(this.component.customDefaultValue, { value: '' }, 'value');
2496
+ defaultValue = this.evaluate(this.component.customDefaultValue, { value: this.dataValue }, 'value');
2496
2497
  }
2497
2498
  return defaultValue;
2498
2499
  }
2500
+ /**
2501
+ * Returns if a component has a default value set.
2502
+ * @returns {boolean} - TRUE if a default value is set.
2503
+ */
2504
+ get hasDefaultValue() {
2505
+ return this.component.customDefaultValue || (this.component.hasOwnProperty('defaultValue') &&
2506
+ (this.component.defaultValue !== null) &&
2507
+ (this.component.defaultValue !== undefined));
2508
+ }
2499
2509
  get shouldAddDefaultValue() {
2500
- return !this.options.noDefaults || (this.component.defaultValue && !this.isEmpty(this.component.defaultValue)) || this.component.customDefaultValue;
2510
+ // It should add a default value if...
2511
+ // 1.) Ensure they have not set "noDefaults". If that is true, then will always return false. AND
2512
+ // 2.) The component is pristine (user has not manually modified it). AND
2513
+ // 3.) There is a default value setting present and it is not NULL or UNDEFINED.
2514
+ return !this.options.noDefaults && this.pristine && (this.hasDefaultValue ||
2515
+ // Empty strings and booleans are allowed primitives whose defaults are automatically added.
2516
+ (this.emptyValue === '' || (typeof this.emptyValue === 'boolean')));
2501
2517
  }
2502
2518
  get defaultValue() {
2503
2519
  let defaultValue = this.emptyValue;
@@ -3088,6 +3104,14 @@ export default class Component extends Element {
3088
3104
  data = data || this.rootValue;
3089
3105
  flags = flags || {};
3090
3106
  row = row || this.data;
3107
+ // Some components (for legacy reasons) have calls to "checkData" in inappropriate places such
3108
+ // as setValue. Historically, this was bypassed by a series of cached states around the data model
3109
+ // which caused its own problems. We need to ensure that premium and custom components do not fall into
3110
+ // an infinite loop by only checking this component once.
3111
+ if (this.checkingData) {
3112
+ return;
3113
+ }
3114
+ this.checkingData = true;
3091
3115
  // Needs for Nextgen Rules Engine
3092
3116
  this.resetCaches();
3093
3117
  // Do not trigger refresh if change was triggered on blur event since components with Refresh on Blur have their own listeners
@@ -3101,6 +3125,8 @@ export default class Component extends Element {
3101
3125
  if (this.id !== flags.triggeredComponentId) {
3102
3126
  this.calculateComponentValue(data, flags, row);
3103
3127
  }
3128
+ // We are done checking data.
3129
+ this.checkingData = false;
3104
3130
  }
3105
3131
  checkModal(errors = [], dirty = false) {
3106
3132
  const messages = errors.filter(error => !error.fromServer);
@@ -181,7 +181,6 @@ export default class NestedComponent extends Field {
181
181
  checkData(data: any, flags: any, row: any, components: any): true | undefined;
182
182
  checkConditions(data: any, flags: any, row: any): boolean;
183
183
  clearOnHide(show: any): void;
184
- restoreComponentsContext(): void;
185
184
  /**
186
185
  * Allow components to hook into the next page trigger to perform their own logic.
187
186
  * @param {Function} next - The callback to continue to the next page.
@@ -627,19 +627,8 @@ export default class NestedComponent extends Field {
627
627
  }
628
628
  clearOnHide(show) {
629
629
  super.clearOnHide(show);
630
- if (this.component.clearOnHide) {
631
- if (this.allowData && !this.hasValue() && !this.conditionallyHidden()) {
632
- this.dataValue = this.defaultValue;
633
- }
634
- if (this.hasValue()) {
635
- this.restoreComponentsContext();
636
- }
637
- }
638
630
  this.getComponents().forEach(component => component.clearOnHide(show));
639
631
  }
640
- restoreComponentsContext() {
641
- this.getComponents().forEach((component) => component.data = this.dataValue);
642
- }
643
632
  /**
644
633
  * Allow components to hook into the next page trigger to perform their own logic.
645
634
  * @param {Function} next - The callback to continue to the next page.
@@ -827,7 +816,7 @@ export default class NestedComponent extends Field {
827
816
  else if (value && component.hasValue(value)) {
828
817
  return component.setValue(_.get(value, component.key), flags);
829
818
  }
830
- else if ((!this.rootPristine || component.visible) && component.shouldAddDefaultValue) {
819
+ else if ((!this.rootPristine || component.visible) && (flags.resetValue || component.shouldAddDefaultValue)) {
831
820
  flags.noValidate = !flags.dirty;
832
821
  flags.resetValue = true;
833
822
  return component.setValue(component.defaultValue, flags);
@@ -837,6 +826,13 @@ export default class NestedComponent extends Field {
837
826
  if (!value) {
838
827
  return false;
839
828
  }
829
+ // If the value is equal to the empty value, then this means we need to reset the values.
830
+ if (_.isEqual(value, this.emptyValue)) {
831
+ // TO-DO: For a future major release, we need to investigate removing the need for the
832
+ // "resetValue" flag. This seems like a hack that is no longer necessary and the renderer
833
+ // may behave more deterministically without it.
834
+ flags.resetValue = true;
835
+ }
840
836
  return this.getComponents().reduce((changed, component) => {
841
837
  return this.setNestedValue(component, value, flags, changed) || changed;
842
838
  }, false);
@@ -3,11 +3,9 @@ export default class NestedDataComponent extends NestedComponent {
3
3
  hasChanged(newValue: any, oldValue: any): boolean;
4
4
  get allowData(): boolean;
5
5
  get emptyValue(): {};
6
- get shouldAddDefaultValue(): boolean;
7
6
  componentContext(): any;
8
7
  getValueAsString(value: any, options: any): string;
9
8
  getDataValueAsTable(value: any, options: any): string;
10
- everyComponent(fn: any, options?: {}): void;
11
9
  /**
12
10
  * Get the value of this component.
13
11
  * @returns {any} - Return the value of this component.
@@ -90,17 +90,6 @@ export default class NestedDataComponent extends NestedComponent {
90
90
  `);
91
91
  return result;
92
92
  }
93
- everyComponent(fn, options = {}) {
94
- if (options?.email) {
95
- if (options.fromRoot) {
96
- delete options.fromRoot;
97
- }
98
- else {
99
- return;
100
- }
101
- }
102
- return super.everyComponent(fn, options);
103
- }
104
93
  /**
105
94
  * Get the value of this component.
106
95
  * @returns {any} - Return the value of this component.
@@ -36,12 +36,21 @@ export default class AddressComponent extends ContainerComponent {
36
36
  get autocompleteMode(): boolean;
37
37
  get manualMode(): boolean;
38
38
  get manualModeEnabled(): boolean;
39
+ restoreComponentsContext(): void;
39
40
  get isMultiple(): boolean;
40
41
  set address(value: any);
41
42
  get address(): any;
42
43
  isValueInLegacyFormat(value: any): any;
43
44
  normalizeValue(value: any): any;
44
45
  get modeSwitcher(): any;
46
+ get providerOptions(): {
47
+ params: any;
48
+ url: any;
49
+ queryProperty: any;
50
+ responseProperty: any;
51
+ displayValueProperty: any;
52
+ autocompleteOptions: any;
53
+ };
45
54
  get removeValueIcon(): any;
46
55
  get searchInput(): any;
47
56
  get addRowButton(): any;
@@ -20,7 +20,6 @@ export default class AddressComponent extends ContainerComponent {
20
20
  key: 'address',
21
21
  switchToManualModeLabel: 'Can\'t find address? Switch to manual mode.',
22
22
  provider: '',
23
- providerOptions: {},
24
23
  manualModeViewString: '',
25
24
  hideLabel: false,
26
25
  disableClearIcon: false,
@@ -113,20 +112,20 @@ export default class AddressComponent extends ContainerComponent {
113
112
  NestedComponent.prototype.addComponents.call(this, this.manualMode ? this.address : {});
114
113
  }
115
114
  Field.prototype.init.call(this);
115
+ let provider = this.component.provider;
116
+ const providerOptions = this.providerOptions;
117
+ const map = this.component.map;
116
118
  if (!this.builderMode) {
117
- if (this.component.provider) {
118
- const { provider, providerOptions, } = this.component;
119
+ if (provider) {
119
120
  if (_.get(providerOptions, 'params.subscriptionKey')) {
120
121
  _.set(providerOptions, "params['subscription-key']", _.get(providerOptions, 'params.subscriptionKey'));
121
122
  _.unset(providerOptions, 'params.subscriptionKey');
122
123
  }
123
124
  this.provider = this.initializeProvider(provider, providerOptions);
124
125
  }
125
- else if (this.component.map) {
126
+ else if (map) {
126
127
  // Fallback to legacy version where Google Maps was the only provider.
127
- this.component.provider = GoogleAddressProvider.name;
128
- this.component.providerOptions = this.component.providerOptions || {};
129
- const { map, provider, providerOptions, } = this.component;
128
+ provider = this.component.provider = GoogleAddressProvider.name;
130
129
  const { key, region, } = map;
131
130
  if (key) {
132
131
  _.set(providerOptions, 'params.key', key);
@@ -258,6 +257,16 @@ export default class AddressComponent extends ContainerComponent {
258
257
  ? (this.refs[AddressComponent.modeSwitcherRef] || null)
259
258
  : null;
260
259
  }
260
+ get providerOptions() {
261
+ return {
262
+ params: { subscriptionKey: this.component.subscriptionKey, key: this.component.apiKey, ...this.component.params },
263
+ url: this.component.url,
264
+ queryProperty: this.component.queryProperty,
265
+ responseProperty: this.component.responseProperty,
266
+ displayValueProperty: this.component.displayValueProperty,
267
+ autocompleteOptions: this.component.autocompleteOptions
268
+ };
269
+ }
261
270
  get removeValueIcon() {
262
271
  return this.refs
263
272
  ? (this.refs[AddressComponent.removeValueIconRef] || null)
@@ -371,7 +380,8 @@ export default class AddressComponent extends ContainerComponent {
371
380
  const result = ((this.builderMode || this.manualMode) ? super.attach : Field.prototype.attach).call(this, element);
372
381
  if (!this.builderMode) {
373
382
  if (!this.provider && this.component.provider) {
374
- const { provider, providerOptions, } = this.component;
383
+ const provider = this.component.provider;
384
+ const providerOptions = this.providerOptions;
375
385
  this.provider = this.initializeProvider(provider, providerOptions);
376
386
  }
377
387
  }
@@ -26,7 +26,7 @@ export default [
26
26
  {
27
27
  type: 'textfield',
28
28
  input: true,
29
- key: "providerOptions.params.subscriptionKey",
29
+ key: "subscriptionKey",
30
30
  label: 'Subscription Key',
31
31
  placeholder: 'Enter Subscription Key',
32
32
  weight: 10,
@@ -41,7 +41,7 @@ export default [
41
41
  {
42
42
  type: 'textfield',
43
43
  input: true,
44
- key: 'providerOptions.url',
44
+ key: 'url',
45
45
  label: 'Url',
46
46
  placeholder: 'Enter Url',
47
47
  weight: 10,
@@ -56,7 +56,7 @@ export default [
56
56
  {
57
57
  type: 'textfield',
58
58
  input: true,
59
- key: 'providerOptions.queryProperty',
59
+ key: 'queryProperty',
60
60
  label: 'Query Property',
61
61
  defaultValue: 'query',
62
62
  placeholder: 'Enter Query Property',
@@ -69,7 +69,7 @@ export default [
69
69
  {
70
70
  type: 'textfield',
71
71
  input: true,
72
- key: 'providerOptions.responseProperty',
72
+ key: 'responseProperty',
73
73
  label: 'Response Property',
74
74
  placeholder: 'Enter Response Property',
75
75
  weight: 30,
@@ -81,7 +81,7 @@ export default [
81
81
  {
82
82
  type: 'textfield',
83
83
  input: true,
84
- key: 'providerOptions.displayValueProperty',
84
+ key: 'displayValueProperty',
85
85
  label: 'Display Value Property',
86
86
  placeholder: 'Display Value Property',
87
87
  weight: 40,
@@ -93,7 +93,7 @@ export default [
93
93
  {
94
94
  type: 'textarea',
95
95
  input: true,
96
- key: 'providerOptions.params',
96
+ key: 'params',
97
97
  label: 'Params',
98
98
  placeholder: '{ ... }',
99
99
  weight: 50,
@@ -108,7 +108,7 @@ export default [
108
108
  {
109
109
  type: 'textfield',
110
110
  input: true,
111
- key: 'providerOptions.params.key',
111
+ key: 'apiKey',
112
112
  label: 'API Key',
113
113
  placeholder: 'Enter API Key',
114
114
  weight: 10,
@@ -123,7 +123,7 @@ export default [
123
123
  {
124
124
  type: 'textarea',
125
125
  input: true,
126
- key: 'providerOptions.params.autocompleteOptions',
126
+ key: 'autocompleteOptions',
127
127
  label: 'Provider options',
128
128
  placeholder: 'Enter provider options as JSON object',
129
129
  defaultValue: {},
@@ -594,9 +594,6 @@ export default class DataGridComponent extends NestedArrayComponent {
594
594
  this.updateOnChange(flags, changed);
595
595
  return changed;
596
596
  }
597
- restoreComponentsContext() {
598
- this.rows.forEach((row, index) => _.forIn(row, (component) => component.data = this.dataValue[index]));
599
- }
600
597
  toggleGroup(element, index) {
601
598
  element.classList.toggle('collapsed');
602
599
  _.each(this.refs.chunks[index], row => {
@@ -543,13 +543,6 @@ export default class EditGridComponent extends NestedArrayComponent {
543
543
  }
544
544
  });
545
545
  }
546
- restoreComponentsContext() {
547
- this.getComponents().forEach((component) => {
548
- const rowData = this.dataValue[component.rowIndex];
549
- const editRowData = this.editRows[component.rowIndex]?.data;
550
- component.data = rowData || editRowData;
551
- });
552
- }
553
546
  flattenComponents(rowIndex) {
554
547
  const result = {};
555
548
  this.everyComponent((component) => {
@@ -16,6 +16,7 @@ declare const _default: ({
16
16
  components?: undefined;
17
17
  rows?: undefined;
18
18
  editor?: undefined;
19
+ as?: undefined;
19
20
  optionsLabelPosition?: undefined;
20
21
  inline?: undefined;
21
22
  defaultValue?: undefined;
@@ -45,6 +46,7 @@ declare const _default: ({
45
46
  components?: undefined;
46
47
  rows?: undefined;
47
48
  editor?: undefined;
49
+ as?: undefined;
48
50
  optionsLabelPosition?: undefined;
49
51
  inline?: undefined;
50
52
  defaultValue?: undefined;
@@ -91,6 +93,7 @@ declare const _default: ({
91
93
  data?: undefined;
92
94
  rows?: undefined;
93
95
  editor?: undefined;
96
+ as?: undefined;
94
97
  optionsLabelPosition?: undefined;
95
98
  inline?: undefined;
96
99
  defaultValue?: undefined;
@@ -120,6 +123,7 @@ declare const _default: ({
120
123
  components?: undefined;
121
124
  rows?: undefined;
122
125
  editor?: undefined;
126
+ as?: undefined;
123
127
  optionsLabelPosition?: undefined;
124
128
  inline?: undefined;
125
129
  defaultValue?: undefined;
@@ -149,6 +153,7 @@ declare const _default: ({
149
153
  components?: undefined;
150
154
  rows?: undefined;
151
155
  editor?: undefined;
156
+ as?: undefined;
152
157
  optionsLabelPosition?: undefined;
153
158
  inline?: undefined;
154
159
  defaultValue?: undefined;
@@ -160,6 +165,7 @@ declare const _default: ({
160
165
  tooltip: string;
161
166
  rows: number;
162
167
  editor: string;
168
+ as: string;
163
169
  input: boolean;
164
170
  weight: number;
165
171
  placeholder: string;
@@ -207,6 +213,7 @@ declare const _default: ({
207
213
  components?: undefined;
208
214
  rows?: undefined;
209
215
  editor?: undefined;
216
+ as?: undefined;
210
217
  optionsLabelPosition?: undefined;
211
218
  inline?: undefined;
212
219
  defaultValue?: undefined;
@@ -227,6 +234,7 @@ declare const _default: ({
227
234
  components?: undefined;
228
235
  rows?: undefined;
229
236
  editor?: undefined;
237
+ as?: undefined;
230
238
  optionsLabelPosition?: undefined;
231
239
  inline?: undefined;
232
240
  defaultValue?: undefined;
@@ -247,6 +255,7 @@ declare const _default: ({
247
255
  components?: undefined;
248
256
  rows?: undefined;
249
257
  editor?: undefined;
258
+ as?: undefined;
250
259
  optionsLabelPosition?: undefined;
251
260
  inline?: undefined;
252
261
  defaultValue?: undefined;
@@ -276,6 +285,7 @@ declare const _default: ({
276
285
  components?: undefined;
277
286
  rows?: undefined;
278
287
  editor?: undefined;
288
+ as?: undefined;
279
289
  optionsLabelPosition?: undefined;
280
290
  inline?: undefined;
281
291
  defaultValue?: undefined;
@@ -305,6 +315,7 @@ declare const _default: ({
305
315
  components?: undefined;
306
316
  rows?: undefined;
307
317
  editor?: undefined;
318
+ as?: undefined;
308
319
  optionsLabelPosition?: undefined;
309
320
  inline?: undefined;
310
321
  defaultValue?: undefined;
@@ -332,6 +343,7 @@ declare const _default: ({
332
343
  components?: undefined;
333
344
  rows?: undefined;
334
345
  editor?: undefined;
346
+ as?: undefined;
335
347
  } | {
336
348
  type: string;
337
349
  input: boolean;
@@ -353,6 +365,7 @@ declare const _default: ({
353
365
  tableView?: undefined;
354
366
  rows?: undefined;
355
367
  editor?: undefined;
368
+ as?: undefined;
356
369
  optionsLabelPosition?: undefined;
357
370
  inline?: undefined;
358
371
  defaultValue?: undefined;
@@ -115,6 +115,7 @@ export default [
115
115
  tooltip: 'Pass your custom xhr options(optional)',
116
116
  rows: 5,
117
117
  editor: 'ace',
118
+ as: 'json',
118
119
  input: true,
119
120
  weight: 15,
120
121
  placeholder: `{
@@ -109,6 +109,10 @@ export default class FormComponent extends Component {
109
109
  get emptyValue() {
110
110
  return { data: {} };
111
111
  }
112
+ // In order for the subform values to set properly, we must always say that nested forms have a default value.
113
+ get hasDefaultValue() {
114
+ return true;
115
+ }
112
116
  get ready() {
113
117
  return this.subFormReady || Promise.resolve();
114
118
  }