@formio/js 5.0.0-rc.98 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) 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 +15 -25
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +1 -9
  7. package/dist/formio.full.js +16 -26
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +1 -9
  10. package/dist/formio.js +4 -4
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.min.js.LICENSE.txt +1 -1
  13. package/dist/formio.utils.js +16 -16
  14. package/dist/formio.utils.min.js +1 -1
  15. package/dist/formio.utils.min.js.LICENSE.txt +5 -3
  16. package/lib/cjs/WebformBuilder.js +18 -6
  17. package/lib/cjs/Wizard.d.ts +0 -1
  18. package/lib/cjs/Wizard.js +16 -23
  19. package/lib/cjs/components/_classes/component/Component.js +8 -7
  20. package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
  21. package/lib/cjs/components/form/Form.js +1 -1
  22. package/lib/cjs/components/html/HTML.js +1 -1
  23. package/lib/cjs/components/selectboxes/SelectBoxes.js +8 -0
  24. package/lib/cjs/utils/i18n.js +5 -0
  25. package/lib/mjs/WebformBuilder.js +18 -6
  26. package/lib/mjs/Wizard.d.ts +0 -1
  27. package/lib/mjs/Wizard.js +15 -22
  28. package/lib/mjs/components/_classes/component/Component.js +8 -7
  29. package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
  30. package/lib/mjs/components/form/Form.js +1 -1
  31. package/lib/mjs/components/html/HTML.js +1 -1
  32. package/lib/mjs/components/selectboxes/SelectBoxes.js +8 -0
  33. package/lib/mjs/utils/i18n.js +4 -0
  34. package/package.json +3 -3
@@ -1,9 +1,9 @@
1
1
  /*!
2
2
  * dist/inputmask
3
3
  * https://github.com/RobinHerbots/Inputmask
4
- * Copyright (c) 2010 - 2023 Robin Herbots
4
+ * Copyright (c) 2010 - 2024 Robin Herbots
5
5
  * Licensed under the MIT license
6
- * Version: 5.0.8
6
+ * Version: 5.0.9
7
7
  */
8
8
 
9
9
  /*!
@@ -20,7 +20,9 @@
20
20
 
21
21
  /*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
22
22
 
23
- /*! formiojs v5.0.0-rc.98 | https://unpkg.com/formiojs@5.0.0-rc.98/LICENSE.txt */
23
+ /*! formiojs v5.0.0 | https://unpkg.com/formiojs@5.0.0/LICENSE.txt */
24
+
25
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
24
26
 
25
27
  /**
26
28
  * @license
@@ -913,13 +913,16 @@ class WebformBuilder extends Component_1.default {
913
913
  keyboardActionsEnabled = keyboardActionsEnabled === 'true';
914
914
  }
915
915
  this.keyboardActionsEnabled = keyboardActionsEnabled;
916
- const isSubmitButton = (comp) => {
917
- return (comp.type === 'button') && ((comp.action === 'submit') || !comp.action);
918
- };
919
- const isShowSubmitButton = !this.options.noDefaultSubmitButton
920
- && (!form.components.length || !form.components.find(comp => isSubmitButton(comp)));
916
+ const { display, noAddSubmitButton, noDefaultSubmitButton } = this.options;
917
+ const { _id, components } = form;
918
+ const isSubmitButton = ({ type, action }) => type === 'button' && (action === 'submit' || !action);
919
+ const hasSubmitButton = components.some(isSubmitButton);
920
+ // Add submit button if form display was switched from wizard
921
+ // Don't add if there is noAddSubmitButton flag passed, or the form has id, or the form has a submit button already
922
+ const shouldAddSubmitButton = (display === 'wizard' && !hasSubmitButton) ||
923
+ (!noAddSubmitButton && !_id && !hasSubmitButton);
921
924
  // Ensure there is at least a submit button.
922
- if (isShowSubmitButton) {
925
+ if (!noDefaultSubmitButton && shouldAddSubmitButton) {
923
926
  form.components.push({
924
927
  type: 'button',
925
928
  label: 'Submit',
@@ -1068,6 +1071,7 @@ class WebformBuilder extends Component_1.default {
1068
1071
  'conditional',
1069
1072
  'customConditional',
1070
1073
  'id',
1074
+ 'logic',
1071
1075
  'fields.day.required',
1072
1076
  'fields.month.required',
1073
1077
  'fields.year.required',
@@ -1093,6 +1097,12 @@ class WebformBuilder extends Component_1.default {
1093
1097
  parentComponent.tabs[tabIndex].splice(index, 1, newComp);
1094
1098
  newComp.checkValidity = () => true;
1095
1099
  newComp.build(defaultValueComponent.element);
1100
+ if (this.preview && !this.preview.defaultChanged) {
1101
+ const defaultValue = lodash_1.default.get(this.preview._data, this.editForm._data.key);
1102
+ if (lodash_1.default.isObject(defaultValue) && !lodash_1.default.isArray(defaultValue)) {
1103
+ this.editForm._data.defaultValue = defaultValue;
1104
+ }
1105
+ }
1096
1106
  }
1097
1107
  }
1098
1108
  else {
@@ -1103,6 +1113,7 @@ class WebformBuilder extends Component_1.default {
1103
1113
  path.unshift(component.key);
1104
1114
  dataPath = (0, utils_1.getStringFromComponentPath)(path);
1105
1115
  }
1116
+ this.preview.defaultChanged = true;
1106
1117
  lodash_1.default.set(this.preview._data, dataPath, changed.value);
1107
1118
  lodash_1.default.set(this.webform._data, dataPath, changed.value);
1108
1119
  }
@@ -1187,6 +1198,7 @@ class WebformBuilder extends Component_1.default {
1187
1198
  }
1188
1199
  const rebuild = parentComponent.rebuild() || Promise.resolve();
1189
1200
  return rebuild.then(() => {
1201
+ parentComponent.resetValue();
1190
1202
  const schema = parentContainer ? parentContainer[index] : (comp ? comp.schema : []);
1191
1203
  this.emitSaveComponentEvent(schema, originalComp, parentComponent.schema, path, index, isNew, originalComponentSchema);
1192
1204
  this.emit('change', this.form);
@@ -105,7 +105,6 @@ declare class Wizard extends Webform {
105
105
  pageId(page: any): any;
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
- showErrors(errors: any, triggerEvent: any): void | any[];
109
108
  focusOnComponent(key: any): void | Promise<void>;
110
109
  }
111
110
  declare namespace Wizard {
package/lib/cjs/Wizard.js CHANGED
@@ -602,7 +602,10 @@ class Wizard extends Webform_1.default {
602
602
  }
603
603
  this.redraw().then(() => {
604
604
  this.checkData(this.submission.data);
605
- this.validateCurrentPage();
605
+ const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
606
+ if (this.alert) {
607
+ this.showErrors(errors, true, true);
608
+ }
606
609
  });
607
610
  return Promise.resolve();
608
611
  }
@@ -699,9 +702,11 @@ class Wizard extends Webform_1.default {
699
702
  });
700
703
  });
701
704
  }
702
- // Validate the form, before go to the next page
703
- const errors = this.validateCurrentPage({ dirty: true });
704
- if (errors.length === 0) {
705
+ // Validate the form before going to the next page
706
+ const currentPageErrors = this.validateCurrentPage({ dirty: true });
707
+ const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : currentPageErrors;
708
+ // allow going to the next page if the current page is valid, even if there are form level errors
709
+ if (currentPageErrors.length === 0) {
705
710
  this.checkData(this.submission.data);
706
711
  return this.beforePage(true).then(() => {
707
712
  return this.setPage(this.getNextPage()).then(() => {
@@ -716,13 +721,14 @@ class Wizard extends Webform_1.default {
716
721
  else {
717
722
  this.currentPage.components.forEach((comp) => comp.setPristine(false));
718
723
  this.scrollIntoView(this.element, true);
719
- return Promise.reject(super.showErrors(errors, true));
724
+ return Promise.reject(this.showErrors(errors, true));
720
725
  }
721
726
  }
722
727
  validateCurrentPage(flags = {}) {
723
- var _a;
728
+ var _a, _b;
729
+ const components = (_a = this.currentPage) === null || _a === void 0 ? void 0 : _a.components.map((component) => component.component);
724
730
  // Accessing the parent ensures the right instance (whether it's the parent Wizard or a nested Wizard) performs its validation
725
- return (_a = this.currentPage) === null || _a === void 0 ? void 0 : _a.parent.validateComponents(this.currentPage.component.components, this.currentPage.parent.data, flags);
731
+ return (_b = this.currentPage) === null || _b === void 0 ? void 0 : _b.parent.validateComponents(components, this.currentPage.parent.data, flags);
726
732
  }
727
733
  emitPrevPage() {
728
734
  this.emit('prevPage', { page: this.page, submission: this.submission });
@@ -864,7 +870,8 @@ class Wizard extends Webform_1.default {
864
870
  onChange(flags, changed, modified, changes) {
865
871
  var _a, _b;
866
872
  super.onChange(flags, changed, modified, changes);
867
- const errors = this.validate(this.localData, { dirty: false });
873
+ // The onChange loop doesn't need all components for wizards
874
+ const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
868
875
  if (this.alert) {
869
876
  this.showErrors(errors, true, true);
870
877
  }
@@ -919,21 +926,7 @@ class Wizard extends Webform_1.default {
919
926
  return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, currentPageOnly, childErrors) && check, true);
920
927
  }
921
928
  get errors() {
922
- if (!this.isLastPage()) {
923
- return this.currentPage.errors;
924
- }
925
- return super.errors;
926
- }
927
- showErrors(errors, triggerEvent) {
928
- if (this.hasExtraPages) {
929
- this.subWizards.forEach((subWizard) => {
930
- if (Array.isArray(subWizard.errors)) {
931
- errors = [...errors, ...subWizard.errors];
932
- }
933
- });
934
- }
935
- ;
936
- return super.showErrors(errors, triggerEvent);
929
+ return !this.isLastPage() && !this.submitted ? this.currentPage.errors : super.errors;
937
930
  }
938
931
  focusOnComponent(key) {
939
932
  const component = this.getComponent(key);
@@ -3224,12 +3224,6 @@ class Component extends Element_1.default {
3224
3224
  return (this.component.protected || !this.component.persistent || (this.component.persistent === 'client-only'));
3225
3225
  }
3226
3226
  shouldSkipValidation(data, row, flags = {}) {
3227
- const { validateWhenHidden = false } = this.component || {};
3228
- const forceValidOnHidden = (!this.visible || !this.checkCondition(row, data)) && !validateWhenHidden;
3229
- if (forceValidOnHidden) {
3230
- // If this component is forced valid when it is hidden, then we also need to reset the errors for this component.
3231
- this._errors = [];
3232
- }
3233
3227
  const rules = [
3234
3228
  // Do not validate if the flags say not too.
3235
3229
  () => flags.noValidate,
@@ -3240,7 +3234,14 @@ class Component extends Element_1.default {
3240
3234
  // Check to see if we are editing and if so, check component persistence.
3241
3235
  () => this.isValueHidden(),
3242
3236
  // Force valid if component is hidden.
3243
- () => forceValidOnHidden
3237
+ () => {
3238
+ if (!this.component.validateWhenHidden && (!this.visible || !this.checkCondition(row, data))) {
3239
+ // If this component is forced valid when it is hidden, then we also need to reset the errors for this component.
3240
+ this._errors = [];
3241
+ return true;
3242
+ }
3243
+ return false;
3244
+ }
3244
3245
  ];
3245
3246
  return rules.some(pred => pred());
3246
3247
  }
@@ -27,7 +27,7 @@ exports.default = [
27
27
  weight: 100,
28
28
  type: 'checkbox',
29
29
  label: 'Validate When Hidden',
30
- tooltip: 'Validates the component when it is hidden/conditionally hidden. Vaildation errors are displayed in the error alert on the form submission.',
30
+ tooltip: 'Validates the component when it is hidden/conditionally hidden. Vaildation errors are displayed in the error alert on the form submission. Use caution when enabling this setting, as it can cause a hidden component to be invalid with no way for the form user to correct it.',
31
31
  key: 'validateWhenHidden',
32
32
  input: true
33
33
  },
@@ -476,7 +476,7 @@ class FormComponent extends Component_1.default {
476
476
  checkComponentValidity(data, dirty, row, options, errors = []) {
477
477
  options = options || {};
478
478
  const silentCheck = options.silentCheck || false;
479
- if (this.subForm && !this.isNestedWizard) {
479
+ if (this.subForm) {
480
480
  return this.subForm.checkValidity(this.subFormData, dirty, null, silentCheck, errors);
481
481
  }
482
482
  return super.checkComponentValidity(data, dirty, row, options, errors);
@@ -10,7 +10,7 @@ class HTMLComponent extends Component_1.default {
10
10
  return Component_1.default.schema({
11
11
  label: 'HTML',
12
12
  type: 'htmlelement',
13
- tag: 'p',
13
+ tag: 'div',
14
14
  attrs: [],
15
15
  content: '',
16
16
  input: false,
@@ -139,6 +139,14 @@ class SelectBoxesComponent extends Radio_1.default {
139
139
  checkedValues.forEach((value) => selectData.push(this.templateData[value]));
140
140
  lodash_1.default.set(submission.metadata.selectData, this.path, selectData);
141
141
  }
142
+ // Ensure that for dataSrc == 'values' that there are not any other superfluous values.
143
+ if (this.component.dataSrc === 'values') {
144
+ for (const key in value) {
145
+ if (!this.component.values.find((val) => val.value === key)) {
146
+ delete value[key];
147
+ }
148
+ }
149
+ }
142
150
  return value;
143
151
  }
144
152
  /**
@@ -79,7 +79,12 @@ class I18n {
79
79
  this.languages[language] = strings;
80
80
  }
81
81
  t(text, ...args) {
82
+ var _a;
82
83
  if (this.currentLanguage[text]) {
84
+ const customTranslationFieldName = (_a = args[0]) === null || _a === void 0 ? void 0 : _a.field;
85
+ if (customTranslationFieldName && this.currentLanguage[customTranslationFieldName]) {
86
+ args[0].field = this.currentLanguage[customTranslationFieldName];
87
+ }
83
88
  return utils_1.Evaluator.interpolateString(this.currentLanguage[text], ...args);
84
89
  }
85
90
  return utils_1.Evaluator.interpolateString(text, ...args);
@@ -897,13 +897,16 @@ export default class WebformBuilder extends Component {
897
897
  keyboardActionsEnabled = keyboardActionsEnabled === 'true';
898
898
  }
899
899
  this.keyboardActionsEnabled = keyboardActionsEnabled;
900
- const isSubmitButton = (comp) => {
901
- return (comp.type === 'button') && ((comp.action === 'submit') || !comp.action);
902
- };
903
- const isShowSubmitButton = !this.options.noDefaultSubmitButton
904
- && (!form.components.length || !form.components.find(comp => isSubmitButton(comp)));
900
+ const { display, noAddSubmitButton, noDefaultSubmitButton } = this.options;
901
+ const { _id, components } = form;
902
+ const isSubmitButton = ({ type, action }) => type === 'button' && (action === 'submit' || !action);
903
+ const hasSubmitButton = components.some(isSubmitButton);
904
+ // Add submit button if form display was switched from wizard
905
+ // Don't add if there is noAddSubmitButton flag passed, or the form has id, or the form has a submit button already
906
+ const shouldAddSubmitButton = (display === 'wizard' && !hasSubmitButton) ||
907
+ (!noAddSubmitButton && !_id && !hasSubmitButton);
905
908
  // Ensure there is at least a submit button.
906
- if (isShowSubmitButton) {
909
+ if (!noDefaultSubmitButton && shouldAddSubmitButton) {
907
910
  form.components.push({
908
911
  type: 'button',
909
912
  label: 'Submit',
@@ -1052,6 +1055,7 @@ export default class WebformBuilder extends Component {
1052
1055
  'conditional',
1053
1056
  'customConditional',
1054
1057
  'id',
1058
+ 'logic',
1055
1059
  'fields.day.required',
1056
1060
  'fields.month.required',
1057
1061
  'fields.year.required',
@@ -1077,6 +1081,12 @@ export default class WebformBuilder extends Component {
1077
1081
  parentComponent.tabs[tabIndex].splice(index, 1, newComp);
1078
1082
  newComp.checkValidity = () => true;
1079
1083
  newComp.build(defaultValueComponent.element);
1084
+ if (this.preview && !this.preview.defaultChanged) {
1085
+ const defaultValue = _.get(this.preview._data, this.editForm._data.key);
1086
+ if (_.isObject(defaultValue) && !_.isArray(defaultValue)) {
1087
+ this.editForm._data.defaultValue = defaultValue;
1088
+ }
1089
+ }
1080
1090
  }
1081
1091
  }
1082
1092
  else {
@@ -1087,6 +1097,7 @@ export default class WebformBuilder extends Component {
1087
1097
  path.unshift(component.key);
1088
1098
  dataPath = getStringFromComponentPath(path);
1089
1099
  }
1100
+ this.preview.defaultChanged = true;
1090
1101
  _.set(this.preview._data, dataPath, changed.value);
1091
1102
  _.set(this.webform._data, dataPath, changed.value);
1092
1103
  }
@@ -1171,6 +1182,7 @@ export default class WebformBuilder extends Component {
1171
1182
  }
1172
1183
  const rebuild = parentComponent.rebuild() || Promise.resolve();
1173
1184
  return rebuild.then(() => {
1185
+ parentComponent.resetValue();
1174
1186
  const schema = parentContainer ? parentContainer[index] : (comp ? comp.schema : []);
1175
1187
  this.emitSaveComponentEvent(schema, originalComp, parentComponent.schema, path, index, isNew, originalComponentSchema);
1176
1188
  this.emit('change', this.form);
@@ -105,7 +105,6 @@ declare class Wizard extends Webform {
105
105
  pageId(page: any): any;
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
- showErrors(errors: any, triggerEvent: any): void | any[];
109
108
  focusOnComponent(key: any): void | Promise<void>;
110
109
  }
111
110
  declare namespace Wizard {
package/lib/mjs/Wizard.js CHANGED
@@ -594,7 +594,10 @@ export default class Wizard extends Webform {
594
594
  }
595
595
  this.redraw().then(() => {
596
596
  this.checkData(this.submission.data);
597
- this.validateCurrentPage();
597
+ const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
598
+ if (this.alert) {
599
+ this.showErrors(errors, true, true);
600
+ }
598
601
  });
599
602
  return Promise.resolve();
600
603
  }
@@ -689,9 +692,11 @@ export default class Wizard extends Webform {
689
692
  });
690
693
  });
691
694
  }
692
- // Validate the form, before go to the next page
693
- const errors = this.validateCurrentPage({ dirty: true });
694
- if (errors.length === 0) {
695
+ // Validate the form before going to the next page
696
+ const currentPageErrors = this.validateCurrentPage({ dirty: true });
697
+ const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : currentPageErrors;
698
+ // allow going to the next page if the current page is valid, even if there are form level errors
699
+ if (currentPageErrors.length === 0) {
695
700
  this.checkData(this.submission.data);
696
701
  return this.beforePage(true).then(() => {
697
702
  return this.setPage(this.getNextPage()).then(() => {
@@ -706,12 +711,13 @@ export default class Wizard extends Webform {
706
711
  else {
707
712
  this.currentPage.components.forEach((comp) => comp.setPristine(false));
708
713
  this.scrollIntoView(this.element, true);
709
- return Promise.reject(super.showErrors(errors, true));
714
+ return Promise.reject(this.showErrors(errors, true));
710
715
  }
711
716
  }
712
717
  validateCurrentPage(flags = {}) {
718
+ const components = this.currentPage?.components.map((component) => component.component);
713
719
  // Accessing the parent ensures the right instance (whether it's the parent Wizard or a nested Wizard) performs its validation
714
- return this.currentPage?.parent.validateComponents(this.currentPage.component.components, this.currentPage.parent.data, flags);
720
+ return this.currentPage?.parent.validateComponents(components, this.currentPage.parent.data, flags);
715
721
  }
716
722
  emitPrevPage() {
717
723
  this.emit('prevPage', { page: this.page, submission: this.submission });
@@ -852,7 +858,8 @@ export default class Wizard extends Webform {
852
858
  }
853
859
  onChange(flags, changed, modified, changes) {
854
860
  super.onChange(flags, changed, modified, changes);
855
- const errors = this.validate(this.localData, { dirty: false });
861
+ // The onChange loop doesn't need all components for wizards
862
+ const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
856
863
  if (this.alert) {
857
864
  this.showErrors(errors, true, true);
858
865
  }
@@ -906,21 +913,7 @@ export default class Wizard extends Webform {
906
913
  return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, currentPageOnly, childErrors) && check, true);
907
914
  }
908
915
  get errors() {
909
- if (!this.isLastPage()) {
910
- return this.currentPage.errors;
911
- }
912
- return super.errors;
913
- }
914
- showErrors(errors, triggerEvent) {
915
- if (this.hasExtraPages) {
916
- this.subWizards.forEach((subWizard) => {
917
- if (Array.isArray(subWizard.errors)) {
918
- errors = [...errors, ...subWizard.errors];
919
- }
920
- });
921
- }
922
- ;
923
- return super.showErrors(errors, triggerEvent);
916
+ return !this.isLastPage() && !this.submitted ? this.currentPage.errors : super.errors;
924
917
  }
925
918
  focusOnComponent(key) {
926
919
  const component = this.getComponent(key);
@@ -3189,12 +3189,6 @@ export default class Component extends Element {
3189
3189
  return (this.component.protected || !this.component.persistent || (this.component.persistent === 'client-only'));
3190
3190
  }
3191
3191
  shouldSkipValidation(data, row, flags = {}) {
3192
- const { validateWhenHidden = false } = this.component || {};
3193
- const forceValidOnHidden = (!this.visible || !this.checkCondition(row, data)) && !validateWhenHidden;
3194
- if (forceValidOnHidden) {
3195
- // If this component is forced valid when it is hidden, then we also need to reset the errors for this component.
3196
- this._errors = [];
3197
- }
3198
3192
  const rules = [
3199
3193
  // Do not validate if the flags say not too.
3200
3194
  () => flags.noValidate,
@@ -3205,7 +3199,14 @@ export default class Component extends Element {
3205
3199
  // Check to see if we are editing and if so, check component persistence.
3206
3200
  () => this.isValueHidden(),
3207
3201
  // Force valid if component is hidden.
3208
- () => forceValidOnHidden
3202
+ () => {
3203
+ if (!this.component.validateWhenHidden && (!this.visible || !this.checkCondition(row, data))) {
3204
+ // If this component is forced valid when it is hidden, then we also need to reset the errors for this component.
3205
+ this._errors = [];
3206
+ return true;
3207
+ }
3208
+ return false;
3209
+ }
3209
3210
  ];
3210
3211
  return rules.some(pred => pred());
3211
3212
  }
@@ -22,7 +22,7 @@ export default [
22
22
  weight: 100,
23
23
  type: 'checkbox',
24
24
  label: 'Validate When Hidden',
25
- tooltip: 'Validates the component when it is hidden/conditionally hidden. Vaildation errors are displayed in the error alert on the form submission.',
25
+ tooltip: 'Validates the component when it is hidden/conditionally hidden. Vaildation errors are displayed in the error alert on the form submission. Use caution when enabling this setting, as it can cause a hidden component to be invalid with no way for the form user to correct it.',
26
26
  key: 'validateWhenHidden',
27
27
  input: true
28
28
  },
@@ -470,7 +470,7 @@ export default class FormComponent extends Component {
470
470
  checkComponentValidity(data, dirty, row, options, errors = []) {
471
471
  options = options || {};
472
472
  const silentCheck = options.silentCheck || false;
473
- if (this.subForm && !this.isNestedWizard) {
473
+ if (this.subForm) {
474
474
  return this.subForm.checkValidity(this.subFormData, dirty, null, silentCheck, errors);
475
475
  }
476
476
  return super.checkComponentValidity(data, dirty, row, options, errors);
@@ -5,7 +5,7 @@ export default class HTMLComponent extends Component {
5
5
  return Component.schema({
6
6
  label: 'HTML',
7
7
  type: 'htmlelement',
8
- tag: 'p',
8
+ tag: 'div',
9
9
  attrs: [],
10
10
  content: '',
11
11
  input: false,
@@ -141,6 +141,14 @@ export default class SelectBoxesComponent extends RadioComponent {
141
141
  checkedValues.forEach((value) => selectData.push(this.templateData[value]));
142
142
  _.set(submission.metadata.selectData, this.path, selectData);
143
143
  }
144
+ // Ensure that for dataSrc == 'values' that there are not any other superfluous values.
145
+ if (this.component.dataSrc === 'values') {
146
+ for (const key in value) {
147
+ if (!this.component.values.find((val) => val.value === key)) {
148
+ delete value[key];
149
+ }
150
+ }
151
+ }
144
152
  return value;
145
153
  }
146
154
  /**
@@ -74,6 +74,10 @@ export class I18n {
74
74
  }
75
75
  t(text, ...args) {
76
76
  if (this.currentLanguage[text]) {
77
+ const customTranslationFieldName = args[0]?.field;
78
+ if (customTranslationFieldName && this.currentLanguage[customTranslationFieldName]) {
79
+ args[0].field = this.currentLanguage[customTranslationFieldName];
80
+ }
77
81
  return Evaluator.interpolateString(this.currentLanguage[text], ...args);
78
82
  }
79
83
  return Evaluator.interpolateString(text, ...args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.98",
3
+ "version": "5.0.0",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -79,9 +79,9 @@
79
79
  },
80
80
  "homepage": "https://github.com/formio/formio.js#readme",
81
81
  "dependencies": {
82
- "@formio/bootstrap": "3.0.0-rc.41",
82
+ "@formio/bootstrap": "3.0.0",
83
83
  "@formio/choices.js": "^10.2.1",
84
- "@formio/core": "2.3.0-rc.21",
84
+ "@formio/core": "2.3.0",
85
85
  "@formio/text-mask-addons": "^3.8.0-formio.3",
86
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
87
87
  "abortcontroller-polyfill": "^1.7.5",