@formio/js 5.1.0-rc.25 → 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 (46) 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 +9 -9
  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 +11 -11
  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.min.js.LICENSE.txt +1 -1
  14. package/lib/cjs/Embed.js +1 -1
  15. package/lib/cjs/Formio.js +1 -1
  16. package/lib/cjs/Wizard.d.ts +1 -0
  17. package/lib/cjs/Wizard.js +17 -0
  18. package/lib/cjs/components/_classes/component/Component.d.ts +7 -11
  19. package/lib/cjs/components/_classes/component/Component.js +28 -26
  20. package/lib/cjs/components/_classes/nested/NestedComponent.js +8 -1
  21. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +0 -2
  22. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +0 -11
  23. package/lib/cjs/components/address/Address.d.ts +8 -0
  24. package/lib/cjs/components/address/Address.js +18 -8
  25. package/lib/cjs/components/address/editForm/Address.edit.provider.js +8 -8
  26. package/lib/cjs/components/file/editForm/File.edit.file.d.ts +13 -0
  27. package/lib/cjs/components/file/editForm/File.edit.file.js +1 -0
  28. package/lib/cjs/components/form/Form.js +4 -0
  29. package/lib/cjs/components/selectboxes/SelectBoxes.js +3 -0
  30. package/lib/mjs/Embed.js +1 -1
  31. package/lib/mjs/Formio.js +1 -1
  32. package/lib/mjs/Wizard.d.ts +1 -0
  33. package/lib/mjs/Wizard.js +17 -0
  34. package/lib/mjs/components/_classes/component/Component.d.ts +7 -11
  35. package/lib/mjs/components/_classes/component/Component.js +28 -26
  36. package/lib/mjs/components/_classes/nested/NestedComponent.js +8 -1
  37. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +0 -2
  38. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +0 -11
  39. package/lib/mjs/components/address/Address.d.ts +8 -0
  40. package/lib/mjs/components/address/Address.js +18 -8
  41. package/lib/mjs/components/address/editForm/Address.edit.provider.js +8 -8
  42. package/lib/mjs/components/file/editForm/File.edit.file.d.ts +13 -0
  43. package/lib/mjs/components/file/editForm/File.edit.file.js +1 -0
  44. package/lib/mjs/components/form/Form.js +4 -0
  45. package/lib/mjs/components/selectboxes/SelectBoxes.js +3 -0
  46. package/package.json +1 -1
@@ -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.1.0-rc.25 | https://unpkg.com/formiojs@5.1.0-rc.25/LICENSE.txt */
23
+ /*! formiojs v5.1.0-rc.26 | https://unpkg.com/formiojs@5.1.0-rc.26/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
 
@@ -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.1.0-rc.25 | https://unpkg.com/formiojs@5.1.0-rc.25/LICENSE.txt */
23
+ /*! formiojs v5.1.0-rc.26 | https://unpkg.com/formiojs@5.1.0-rc.26/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.1.0-rc.25';
421
+ Formio.version = '5.1.0-rc.26';
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.1.0-rc.25';
14
+ sdk_1.Formio.version = '5.1.0-rc.26';
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) {
@@ -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/cjs/Wizard.js CHANGED
@@ -670,6 +670,7 @@ class Wizard extends Webform_1.default {
670
670
  beforeSubmit() {
671
671
  const pages = this.getPages({ all: true });
672
672
  return Promise.all(pages.map((page) => {
673
+ this.triggerButtonCaptcha(page);
673
674
  page.options.beforeSubmit = true;
674
675
  return page.beforeSubmit();
675
676
  }));
@@ -945,6 +946,22 @@ class Wizard extends Webform_1.default {
945
946
  }
946
947
  return super.focusOnComponent(key);
947
948
  }
949
+ triggerButtonCaptcha(page) {
950
+ if (!page.components) {
951
+ return;
952
+ }
953
+ let captchaComponent;
954
+ page.eachComponent((component) => {
955
+ if (/^(re)?captcha$/.test(component.component.type) &&
956
+ component.component.eventType === 'buttonClick' &&
957
+ component.component.buttonKey === 'submit') {
958
+ captchaComponent = component;
959
+ }
960
+ });
961
+ if (captchaComponent) {
962
+ captchaComponent.verify(`submitClick`);
963
+ }
964
+ }
948
965
  }
949
966
  exports.default = Wizard;
950
967
  Wizard.setBaseUrl = Formio_1.Formio.setBaseUrl;
@@ -129,16 +129,6 @@ declare class Component extends Element {
129
129
  * The reference attribute name for this component
130
130
  */
131
131
  _referenceAttributeName: string;
132
- /**
133
- * Sometimes the customDefaultValue does not set the "value" within the script, but is just a script to execute. This
134
- * flag is used to determine if the customDefaultValue should be used to set the value of the component or not based on
135
- * if there is a "value=" within the script.
136
- */
137
- shouldSetCustomDefault: any;
138
- /**
139
- * Same as customDefaultValue, but for calculateValue.
140
- */
141
- shouldSetCalculatedValue: any;
142
132
  triggerChange: (...args: any[]) => any;
143
133
  /**
144
134
  * Used to trigger a redraw event within this component.
@@ -895,7 +885,12 @@ declare class Component extends Element {
895
885
  */
896
886
  deleteValue(): void;
897
887
  getCustomDefaultValue(defaultValue: any): any;
898
- 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;
899
894
  get defaultValue(): any;
900
895
  /**
901
896
  * Get the input value of this component.
@@ -1069,6 +1064,7 @@ declare class Component extends Element {
1069
1064
  * @returns {void|boolean} - TRUE if no check should be performed on the component.
1070
1065
  */
1071
1066
  checkData(data?: any, flags?: any, row?: any): void | boolean;
1067
+ checkingData: boolean | undefined;
1072
1068
  checkModal(errors?: any[], dirty?: boolean): void;
1073
1069
  get validationValue(): any;
1074
1070
  isEmpty(value?: any): any;
@@ -351,22 +351,6 @@ class Component extends Element_1.default {
351
351
  * The reference attribute name for this component
352
352
  */
353
353
  this._referenceAttributeName = 'ref';
354
- /**
355
- * Sometimes the customDefaultValue does not set the "value" within the script, but is just a script to execute. This
356
- * flag is used to determine if the customDefaultValue should be used to set the value of the component or not based on
357
- * if there is a "value=" within the script.
358
- */
359
- this.shouldSetCustomDefault = true;
360
- if (this.component.customDefaultValue && (typeof this.component.customDefaultValue === 'string')) {
361
- this.shouldSetCustomDefault = this.component.customDefaultValue.match(/value\s*=/);
362
- }
363
- /**
364
- * Same as customDefaultValue, but for calculateValue.
365
- */
366
- this.shouldSetCalculatedValue = true;
367
- if (this.component.calculateValue && (typeof this.component.calculateValue === 'string')) {
368
- this.shouldSetCalculatedValue = this.component.calculateValue.match(/value\s*=/);
369
- }
370
354
  /**
371
355
  * Used to trigger a new change in this component.
372
356
  * @type {Function} - Call to trigger a change in this component.
@@ -2529,15 +2513,27 @@ class Component extends Element_1.default {
2529
2513
  }
2530
2514
  getCustomDefaultValue(defaultValue) {
2531
2515
  if (this.component.customDefaultValue && !this.options.preview) {
2532
- const customDefaultValue = this.evaluate(this.component.customDefaultValue, { value: '' }, 'value');
2533
- if (this.shouldSetCustomDefault) {
2534
- defaultValue = customDefaultValue;
2535
- }
2516
+ defaultValue = this.evaluate(this.component.customDefaultValue, { value: this.dataValue }, 'value');
2536
2517
  }
2537
2518
  return defaultValue;
2538
2519
  }
2520
+ /**
2521
+ * Returns if a component has a default value set.
2522
+ * @returns {boolean} - TRUE if a default value is set.
2523
+ */
2524
+ get hasDefaultValue() {
2525
+ return this.component.customDefaultValue || (this.component.hasOwnProperty('defaultValue') &&
2526
+ (this.component.defaultValue !== null) &&
2527
+ (this.component.defaultValue !== undefined));
2528
+ }
2539
2529
  get shouldAddDefaultValue() {
2540
- return !this.options.noDefaults || (this.component.defaultValue && !this.isEmpty(this.component.defaultValue)) || this.component.customDefaultValue;
2530
+ // It should add a default value if...
2531
+ // 1.) Ensure they have not set "noDefaults". If that is true, then will always return false. AND
2532
+ // 2.) The component is pristine (user has not manually modified it). AND
2533
+ // 3.) There is a default value setting present and it is not NULL or UNDEFINED.
2534
+ return !this.options.noDefaults && this.pristine && (this.hasDefaultValue ||
2535
+ // Empty strings and booleans are allowed primitives whose defaults are automatically added.
2536
+ (this.emptyValue === '' || (typeof this.emptyValue === 'boolean')));
2541
2537
  }
2542
2538
  get defaultValue() {
2543
2539
  let defaultValue = this.emptyValue;
@@ -2792,7 +2788,7 @@ class Component extends Element_1.default {
2792
2788
  }
2793
2789
  doValueCalculation(dataValue, data, row) {
2794
2790
  var _a;
2795
- const calculatedValue = this.evaluate(this.component.calculateValue, {
2791
+ return this.evaluate(this.component.calculateValue, {
2796
2792
  value: dataValue,
2797
2793
  data,
2798
2794
  row: row || this.data,
@@ -2800,10 +2796,6 @@ class Component extends Element_1.default {
2800
2796
  data: this.rootValue
2801
2797
  }
2802
2798
  }, 'value');
2803
- if (this.shouldSetCalculatedValue) {
2804
- return calculatedValue;
2805
- }
2806
- return dataValue;
2807
2799
  }
2808
2800
  /* eslint-disable max-statements */
2809
2801
  calculateComponentValue(data, flags, row) {
@@ -3136,6 +3128,14 @@ class Component extends Element_1.default {
3136
3128
  data = data || this.rootValue;
3137
3129
  flags = flags || {};
3138
3130
  row = row || this.data;
3131
+ // Some components (for legacy reasons) have calls to "checkData" in inappropriate places such
3132
+ // as setValue. Historically, this was bypassed by a series of cached states around the data model
3133
+ // which caused its own problems. We need to ensure that premium and custom components do not fall into
3134
+ // an infinite loop by only checking this component once.
3135
+ if (this.checkingData) {
3136
+ return;
3137
+ }
3138
+ this.checkingData = true;
3139
3139
  // Needs for Nextgen Rules Engine
3140
3140
  this.resetCaches();
3141
3141
  // Do not trigger refresh if change was triggered on blur event since components with Refresh on Blur have their own listeners
@@ -3149,6 +3149,8 @@ class Component extends Element_1.default {
3149
3149
  if (this.id !== flags.triggeredComponentId) {
3150
3150
  this.calculateComponentValue(data, flags, row);
3151
3151
  }
3152
+ // We are done checking data.
3153
+ this.checkingData = false;
3152
3154
  }
3153
3155
  checkModal(errors = [], dirty = false) {
3154
3156
  const messages = errors.filter(error => !error.fromServer);
@@ -821,7 +821,7 @@ class NestedComponent extends Field_1.default {
821
821
  else if (value && component.hasValue(value)) {
822
822
  return component.setValue(lodash_1.default.get(value, component.key), flags);
823
823
  }
824
- else if ((!this.rootPristine || component.visible) && component.shouldAddDefaultValue) {
824
+ else if ((!this.rootPristine || component.visible) && (flags.resetValue || component.shouldAddDefaultValue)) {
825
825
  flags.noValidate = !flags.dirty;
826
826
  flags.resetValue = true;
827
827
  return component.setValue(component.defaultValue, flags);
@@ -831,6 +831,13 @@ class NestedComponent extends Field_1.default {
831
831
  if (!value) {
832
832
  return false;
833
833
  }
834
+ // If the value is equal to the empty value, then this means we need to reset the values.
835
+ if (lodash_1.default.isEqual(value, this.emptyValue)) {
836
+ // TO-DO: For a future major release, we need to investigate removing the need for the
837
+ // "resetValue" flag. This seems like a hack that is no longer necessary and the renderer
838
+ // may behave more deterministically without it.
839
+ flags.resetValue = true;
840
+ }
834
841
  return this.getComponents().reduce((changed, component) => {
835
842
  return this.setNestedValue(component, value, flags, changed) || changed;
836
843
  }, 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.
@@ -88,17 +88,6 @@ class NestedDataComponent extends NestedComponent_1.default {
88
88
  `);
89
89
  return result;
90
90
  }
91
- everyComponent(fn, options = {}) {
92
- if (options === null || options === void 0 ? void 0 : options.email) {
93
- if (options.fromRoot) {
94
- delete options.fromRoot;
95
- }
96
- else {
97
- return;
98
- }
99
- }
100
- return super.everyComponent(fn, options);
101
- }
102
91
  /**
103
92
  * Get the value of this component.
104
93
  * @returns {any} - Return the value of this component.
@@ -43,6 +43,14 @@ export default class AddressComponent extends ContainerComponent {
43
43
  isValueInLegacyFormat(value: any): any;
44
44
  normalizeValue(value: any): any;
45
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
+ };
46
54
  get removeValueIcon(): any;
47
55
  get searchInput(): any;
48
56
  get addRowButton(): any;
@@ -26,7 +26,6 @@ class AddressComponent extends Container_1.default {
26
26
  key: 'address',
27
27
  switchToManualModeLabel: 'Can\'t find address? Switch to manual mode.',
28
28
  provider: '',
29
- providerOptions: {},
30
29
  manualModeViewString: '',
31
30
  hideLabel: false,
32
31
  disableClearIcon: false,
@@ -116,20 +115,20 @@ class AddressComponent extends Container_1.default {
116
115
  NestedComponent_1.default.prototype.addComponents.call(this, this.manualMode ? this.address : {});
117
116
  }
118
117
  Field_1.default.prototype.init.call(this);
118
+ let provider = this.component.provider;
119
+ const providerOptions = this.providerOptions;
120
+ const map = this.component.map;
119
121
  if (!this.builderMode) {
120
- if (this.component.provider) {
121
- const { provider, providerOptions, } = this.component;
122
+ if (provider) {
122
123
  if (lodash_1.default.get(providerOptions, 'params.subscriptionKey')) {
123
124
  lodash_1.default.set(providerOptions, "params['subscription-key']", lodash_1.default.get(providerOptions, 'params.subscriptionKey'));
124
125
  lodash_1.default.unset(providerOptions, 'params.subscriptionKey');
125
126
  }
126
127
  this.provider = this.initializeProvider(provider, providerOptions);
127
128
  }
128
- else if (this.component.map) {
129
+ else if (map) {
129
130
  // Fallback to legacy version where Google Maps was the only provider.
130
- this.component.provider = GoogleAddressProvider_1.GoogleAddressProvider.name;
131
- this.component.providerOptions = this.component.providerOptions || {};
132
- const { map, provider, providerOptions, } = this.component;
131
+ provider = this.component.provider = GoogleAddressProvider_1.GoogleAddressProvider.name;
133
132
  const { key, region, } = map;
134
133
  if (key) {
135
134
  lodash_1.default.set(providerOptions, 'params.key', key);
@@ -262,6 +261,16 @@ class AddressComponent extends Container_1.default {
262
261
  ? (this.refs[AddressComponent.modeSwitcherRef] || null)
263
262
  : null;
264
263
  }
264
+ get providerOptions() {
265
+ return {
266
+ params: Object.assign({ subscriptionKey: this.component.subscriptionKey, key: this.component.apiKey }, this.component.params),
267
+ url: this.component.url,
268
+ queryProperty: this.component.queryProperty,
269
+ responseProperty: this.component.responseProperty,
270
+ displayValueProperty: this.component.displayValueProperty,
271
+ autocompleteOptions: this.component.autocompleteOptions
272
+ };
273
+ }
265
274
  get removeValueIcon() {
266
275
  return this.refs
267
276
  ? (this.refs[AddressComponent.removeValueIconRef] || null)
@@ -375,7 +384,8 @@ class AddressComponent extends Container_1.default {
375
384
  const result = ((this.builderMode || this.manualMode) ? super.attach : Field_1.default.prototype.attach).call(this, element);
376
385
  if (!this.builderMode) {
377
386
  if (!this.provider && this.component.provider) {
378
- const { provider, providerOptions, } = this.component;
387
+ const provider = this.component.provider;
388
+ const providerOptions = this.providerOptions;
379
389
  this.provider = this.initializeProvider(provider, providerOptions);
380
390
  }
381
391
  }
@@ -31,7 +31,7 @@ exports.default = [
31
31
  {
32
32
  type: 'textfield',
33
33
  input: true,
34
- key: "providerOptions.params.subscriptionKey",
34
+ key: "subscriptionKey",
35
35
  label: 'Subscription Key',
36
36
  placeholder: 'Enter Subscription Key',
37
37
  weight: 10,
@@ -46,7 +46,7 @@ exports.default = [
46
46
  {
47
47
  type: 'textfield',
48
48
  input: true,
49
- key: 'providerOptions.url',
49
+ key: 'url',
50
50
  label: 'Url',
51
51
  placeholder: 'Enter Url',
52
52
  weight: 10,
@@ -61,7 +61,7 @@ exports.default = [
61
61
  {
62
62
  type: 'textfield',
63
63
  input: true,
64
- key: 'providerOptions.queryProperty',
64
+ key: 'queryProperty',
65
65
  label: 'Query Property',
66
66
  defaultValue: 'query',
67
67
  placeholder: 'Enter Query Property',
@@ -74,7 +74,7 @@ exports.default = [
74
74
  {
75
75
  type: 'textfield',
76
76
  input: true,
77
- key: 'providerOptions.responseProperty',
77
+ key: 'responseProperty',
78
78
  label: 'Response Property',
79
79
  placeholder: 'Enter Response Property',
80
80
  weight: 30,
@@ -86,7 +86,7 @@ exports.default = [
86
86
  {
87
87
  type: 'textfield',
88
88
  input: true,
89
- key: 'providerOptions.displayValueProperty',
89
+ key: 'displayValueProperty',
90
90
  label: 'Display Value Property',
91
91
  placeholder: 'Display Value Property',
92
92
  weight: 40,
@@ -98,7 +98,7 @@ exports.default = [
98
98
  {
99
99
  type: 'textarea',
100
100
  input: true,
101
- key: 'providerOptions.params',
101
+ key: 'params',
102
102
  label: 'Params',
103
103
  placeholder: '{ ... }',
104
104
  weight: 50,
@@ -113,7 +113,7 @@ exports.default = [
113
113
  {
114
114
  type: 'textfield',
115
115
  input: true,
116
- key: 'providerOptions.params.key',
116
+ key: 'apiKey',
117
117
  label: 'API Key',
118
118
  placeholder: 'Enter API Key',
119
119
  weight: 10,
@@ -128,7 +128,7 @@ exports.default = [
128
128
  {
129
129
  type: 'textarea',
130
130
  input: true,
131
- key: 'providerOptions.params.autocompleteOptions',
131
+ key: 'autocompleteOptions',
132
132
  label: 'Provider options',
133
133
  placeholder: 'Enter provider options as JSON object',
134
134
  defaultValue: {},
@@ -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;
@@ -120,6 +120,7 @@ exports.default = [
120
120
  tooltip: 'Pass your custom xhr options(optional)',
121
121
  rows: 5,
122
122
  editor: 'ace',
123
+ as: 'json',
123
124
  input: true,
124
125
  weight: 15,
125
126
  placeholder: `{
@@ -114,6 +114,10 @@ class FormComponent extends Component_1.default {
114
114
  get emptyValue() {
115
115
  return { data: {} };
116
116
  }
117
+ // In order for the subform values to set properly, we must always say that nested forms have a default value.
118
+ get hasDefaultValue() {
119
+ return true;
120
+ }
117
121
  get ready() {
118
122
  return this.subFormReady || Promise.resolve();
119
123
  }
@@ -64,6 +64,9 @@ class SelectBoxesComponent extends Radio_1.default {
64
64
  info.attr.class = 'form-check-input';
65
65
  return info;
66
66
  }
67
+ get hasDefaultValue() {
68
+ return true;
69
+ }
67
70
  get emptyValue() {
68
71
  return this.component.values.reduce((prev, value) => {
69
72
  if (value.value) {
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.25';
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.25';
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) {
@@ -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
@@ -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
  }));
@@ -933,6 +934,22 @@ export default class Wizard extends Webform {
933
934
  }
934
935
  return super.focusOnComponent(key);
935
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
+ }
936
953
  }
937
954
  Wizard.setBaseUrl = Formio.setBaseUrl;
938
955
  Wizard.setApiUrl = Formio.setApiUrl;
@@ -129,16 +129,6 @@ declare class Component extends Element {
129
129
  * The reference attribute name for this component
130
130
  */
131
131
  _referenceAttributeName: string;
132
- /**
133
- * Sometimes the customDefaultValue does not set the "value" within the script, but is just a script to execute. This
134
- * flag is used to determine if the customDefaultValue should be used to set the value of the component or not based on
135
- * if there is a "value=" within the script.
136
- */
137
- shouldSetCustomDefault: any;
138
- /**
139
- * Same as customDefaultValue, but for calculateValue.
140
- */
141
- shouldSetCalculatedValue: any;
142
132
  triggerChange: (...args: any[]) => any;
143
133
  /**
144
134
  * Used to trigger a redraw event within this component.
@@ -895,7 +885,12 @@ declare class Component extends Element {
895
885
  */
896
886
  deleteValue(): void;
897
887
  getCustomDefaultValue(defaultValue: any): any;
898
- 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;
899
894
  get defaultValue(): any;
900
895
  /**
901
896
  * Get the input value of this component.
@@ -1069,6 +1064,7 @@ declare class Component extends Element {
1069
1064
  * @returns {void|boolean} - TRUE if no check should be performed on the component.
1070
1065
  */
1071
1066
  checkData(data?: any, flags?: any, row?: any): void | boolean;
1067
+ checkingData: boolean | undefined;
1072
1068
  checkModal(errors?: any[], dirty?: boolean): void;
1073
1069
  get validationValue(): any;
1074
1070
  isEmpty(value?: any): any;