@formio/js 5.0.0-bb.dev.3 → 5.0.0-bb.dev.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) 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 +12 -12
  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 +1 -1
  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/Form.js +0 -15
  15. package/lib/cjs/components/_classes/component/Component.js +10 -4
  16. package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +8 -0
  17. package/lib/cjs/components/_classes/nested/NestedComponent.js +2 -2
  18. package/lib/cjs/components/datagrid/DataGrid.js +2 -1
  19. package/lib/cjs/components/datagrid/fixtures/comp-with-allow-calculate-override.js +1 -1
  20. package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
  21. package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
  22. package/lib/cjs/components/datagrid/fixtures/two-comp-with-allow-calculate-override.d.ts +53 -0
  23. package/lib/cjs/components/datagrid/fixtures/two-comp-with-allow-calculate-override.js +104 -0
  24. package/lib/cjs/components/editgrid/EditGrid.js +7 -4
  25. package/lib/cjs/components/editgrid/fixtures/formsWithEditGridAndConditions.d.ts +910 -0
  26. package/lib/cjs/components/editgrid/fixtures/formsWithEditGridAndConditions.js +923 -0
  27. package/lib/cjs/components/html/HTML.d.ts +1 -0
  28. package/lib/cjs/components/html/HTML.js +9 -0
  29. package/lib/cjs/components/recaptcha/ReCaptcha.js +3 -3
  30. package/lib/cjs/formio.form.js +14 -0
  31. package/lib/cjs/translations/en.d.ts +2 -0
  32. package/lib/cjs/translations/en.js +2 -0
  33. package/lib/cjs/validator/Validator.js +1 -1
  34. package/lib/mjs/Form.js +0 -15
  35. package/lib/mjs/components/_classes/component/Component.js +10 -4
  36. package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +8 -0
  37. package/lib/mjs/components/_classes/nested/NestedComponent.js +2 -2
  38. package/lib/mjs/components/datagrid/DataGrid.js +2 -1
  39. package/lib/mjs/components/datagrid/fixtures/comp-with-allow-calculate-override.js +1 -1
  40. package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
  41. package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
  42. package/lib/mjs/components/datagrid/fixtures/two-comp-with-allow-calculate-override.d.ts +53 -0
  43. package/lib/mjs/components/datagrid/fixtures/two-comp-with-allow-calculate-override.js +102 -0
  44. package/lib/mjs/components/editgrid/EditGrid.js +7 -4
  45. package/lib/mjs/components/editgrid/fixtures/formsWithEditGridAndConditions.d.ts +910 -0
  46. package/lib/mjs/components/editgrid/fixtures/formsWithEditGridAndConditions.js +921 -0
  47. package/lib/mjs/components/html/HTML.d.ts +1 -0
  48. package/lib/mjs/components/html/HTML.js +8 -0
  49. package/lib/mjs/components/recaptcha/ReCaptcha.js +3 -3
  50. package/lib/mjs/formio.form.js +14 -0
  51. package/lib/mjs/translations/en.d.ts +2 -0
  52. package/lib/mjs/translations/en.js +2 -0
  53. package/lib/mjs/validator/Validator.js +1 -1
  54. package/package.json +2 -2
@@ -14,5 +14,6 @@ export default class HTMLComponent extends Component {
14
14
  checkRefreshOn(changed: any): void;
15
15
  renderContent(): any;
16
16
  render(): any;
17
+ get dataReady(): any;
17
18
  }
18
19
  import Component from '../_classes/component/Component';
@@ -80,8 +80,16 @@ export default class HTMLComponent extends Component {
80
80
  render() {
81
81
  return super.render(this.renderContent());
82
82
  }
83
+ get dataReady() {
84
+ return this.root?.submissionReady || Promise.resolve();
85
+ }
83
86
  attach(element) {
84
87
  this.loadRefs(element, { html: 'single' });
88
+ this.dataReady.then(() => {
89
+ if (this.element) {
90
+ this.setContent(this.elemet, this.content);
91
+ }
92
+ });
85
93
  return super.attach(element);
86
94
  }
87
95
  }
@@ -121,17 +121,17 @@ export default class ReCaptchaComponent extends Component {
121
121
  }
122
122
  const componentData = row[this.component.key];
123
123
  if (!componentData || !componentData.token) {
124
- this.setCustomValidity('ReCAPTCHA: Token is not specified in submission');
124
+ this.setCustomValidity(this.t('reCaptchaTokenNotSpecifiedError'));
125
125
  return Promise.resolve(false);
126
126
  }
127
127
  if (!componentData.success) {
128
- this.setCustomValidity('ReCAPTCHA: Token validation error');
128
+ this.setCustomValidity(this.t('reCaptchaTokenValidationError'));
129
129
  return Promise.resolve(false);
130
130
  }
131
131
  return this.hook('validateReCaptcha', componentData.token, () => Promise.resolve(true))
132
132
  .then((success) => success)
133
133
  .catch((err) => {
134
- this.setCustomValidity(err.message || err);
134
+ this.setCustomValidity(this.t(err.message || err));
135
135
  return false;
136
136
  });
137
137
  }
@@ -143,5 +143,19 @@ export function useModule(defaultFn = null) {
143
143
  * Formio.plugins([plugin1, plugin2, etc], options);
144
144
  */
145
145
  Formio.use = useModule();
146
+ // Allow simple embedding.
147
+ Formio.embedForm = (embed) => Form.embed(embed);
148
+ /**
149
+ * Factory that creates a new form based on the form parameters.
150
+ *
151
+ * @param element {HMTLElement} - The HTML Element to add this form to.
152
+ * @param form {string|Object} - The src of the form, or a form object.
153
+ * @param options {Object} - The options to create this form.
154
+ *
155
+ * @return {Promise} - When the form is instance is ready.
156
+ */
157
+ Formio.createForm = (...args) => {
158
+ return (new Form(...args)).ready;
159
+ };
146
160
  // Export the components.
147
161
  export { Components, Displays, Providers, Rules, Widgets, Templates, Conjunctions, Operators, QuickRules, Transformers, ValueSources, Utils, Form, Formio, Licenses, EventEmitter };
@@ -62,5 +62,7 @@ declare namespace _default {
62
62
  const previousButtonAriaLabel: string;
63
63
  const nextButtonAriaLabel: string;
64
64
  const submitButtonAriaLabel: string;
65
+ const reCaptchaTokenValidationError: string;
66
+ const reCaptchaTokenNotSpecifiedError: string;
65
67
  }
66
68
  export default _default;
@@ -62,4 +62,6 @@ export default {
62
62
  previousButtonAriaLabel: 'Previous button. Click to go back to the previous tab',
63
63
  nextButtonAriaLabel: 'Next button. Click to go to the next tab',
64
64
  submitButtonAriaLabel: 'Submit Form button. Click to submit the form',
65
+ reCaptchaTokenValidationError: 'ReCAPTCHA: Token validation error',
66
+ reCaptchaTokenNotSpecifiedError: 'ReCAPTCHA: Token is not specified in submission',
65
67
  };
@@ -853,7 +853,7 @@ class ValidationChecker {
853
853
  }
854
854
  validate(component, validatorName, value, data, index, row, async, conditionallyVisible, validationObj) {
855
855
  // Skip validation for conditionally hidden components
856
- if (!conditionallyVisible) {
856
+ if (!conditionallyVisible && !_.get(component.component, 'validateWhenHidden', false)) {
857
857
  return false;
858
858
  }
859
859
  const validator = this.validators[validatorName];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-bb.dev.3",
3
+ "version": "5.0.0-bb.dev.6",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -79,7 +79,7 @@
79
79
  "dependencies": {
80
80
  "@formio/bootstrap": "^3.0.0-rc.20",
81
81
  "@formio/choices.js": "^10.2.0",
82
- "@formio/core": "1.3.0-rc.16",
82
+ "@formio/core": "2.0.0-dev.4",
83
83
  "@formio/text-mask-addons": "^3.8.0-formio.2",
84
84
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
85
85
  "abortcontroller-polyfill": "^1.7.5",