@formio/js 5.0.0-dev.5734.79d4f47 → 5.0.0-dev.5740.c7c00bc

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.
package/lib/cjs/Form.d.ts CHANGED
@@ -398,10 +398,10 @@ export default class Form extends Element {
398
398
  getFormInitOptions(url: string, form: import('@formio/core').Form): object;
399
399
  /**
400
400
  * Sets the form to the JSON schema of a form.
401
- * @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
401
+ * @param {import('@formio/core').Form | string} formParam - The form JSON to set this form to.
402
402
  * @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
403
403
  */
404
- setForm(formParam: import('@formio/core').Form): Promise<Webform | Wizard | PDF>;
404
+ setForm(formParam: import('@formio/core').Form | string): Promise<Webform | Wizard | PDF>;
405
405
  _form: any;
406
406
  getSubmission(formio: any, opts: any): any;
407
407
  /**
package/lib/cjs/Form.js CHANGED
@@ -195,7 +195,7 @@ class Form extends Element_1.default {
195
195
  }
196
196
  /**
197
197
  * Sets the form to the JSON schema of a form.
198
- * @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
198
+ * @param {import('@formio/core').Form | string} formParam - The form JSON to set this form to.
199
199
  * @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
200
200
  */
201
201
  setForm(formParam) {
@@ -222,8 +222,14 @@ class Form extends Element_1.default {
222
222
  }
223
223
  this.loading = false;
224
224
  this.instance = this.instance || this.create(form.display);
225
- const options = this.getFormInitOptions(formParam, form);
226
- this.instance.setUrl(formParam, options);
225
+ // If we're in builder mode, instance.setUrl is not a function, so just manually set the URL.
226
+ if (this.instance.setUrl) {
227
+ const options = this.getFormInitOptions(formParam, form);
228
+ this.instance.setUrl(formParam, options);
229
+ }
230
+ else {
231
+ this.instance.url = formParam;
232
+ }
227
233
  this.instance.nosubmit = false;
228
234
  this._form = this.instance.form = form;
229
235
  if (submission) {
@@ -826,7 +826,6 @@ class Webform extends NestedDataComponent_1.default {
826
826
  if (!submission || !submission.data) {
827
827
  submission = {
828
828
  data: {},
829
- metadata: submission.metadata,
830
829
  };
831
830
  }
832
831
  // Metadata needs to be available before setValue
@@ -685,7 +685,7 @@ class NestedComponent extends Field_1.default {
685
685
  validationProcessor({ scope, data, row, instance, component }, flags) {
686
686
  const { dirty } = flags;
687
687
  if (this.root.hasExtraPages && this.page !== this.root.page) {
688
- instance = this.getComponentById(component.id);
688
+ instance = this.getComponent(component.path);
689
689
  }
690
690
  if (!instance) {
691
691
  return;
@@ -241,7 +241,7 @@ class DataMapComponent extends DataGrid_1.default {
241
241
  delete dataValue[key];
242
242
  const comp = components[this.valueKey];
243
243
  comp.component.key = newKey;
244
- comp.path = Components_1.default.calculateComponentPath(comp);
244
+ comp.path = Components_1.default.getComponentPath(comp);
245
245
  key = newKey;
246
246
  });
247
247
  const valueComponent = lodash_1.default.clone(this.component.valueComponent);
package/lib/mjs/Form.d.ts CHANGED
@@ -398,10 +398,10 @@ export default class Form extends Element {
398
398
  getFormInitOptions(url: string, form: import('@formio/core').Form): object;
399
399
  /**
400
400
  * Sets the form to the JSON schema of a form.
401
- * @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
401
+ * @param {import('@formio/core').Form | string} formParam - The form JSON to set this form to.
402
402
  * @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
403
403
  */
404
- setForm(formParam: import('@formio/core').Form): Promise<Webform | Wizard | PDF>;
404
+ setForm(formParam: import('@formio/core').Form | string): Promise<Webform | Wizard | PDF>;
405
405
  _form: any;
406
406
  getSubmission(formio: any, opts: any): any;
407
407
  /**
package/lib/mjs/Form.js CHANGED
@@ -264,7 +264,7 @@ export default class Form extends Element {
264
264
  }
265
265
  /**
266
266
  * Sets the form to the JSON schema of a form.
267
- * @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
267
+ * @param {import('@formio/core').Form | string} formParam - The form JSON to set this form to.
268
268
  * @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
269
269
  */
270
270
  setForm(formParam) {
@@ -291,8 +291,14 @@ export default class Form extends Element {
291
291
  }
292
292
  this.loading = false;
293
293
  this.instance = this.instance || this.create(form.display);
294
- const options = this.getFormInitOptions(formParam, form);
295
- this.instance.setUrl(formParam, options);
294
+ // If we're in builder mode, instance.setUrl is not a function, so just manually set the URL.
295
+ if (this.instance.setUrl) {
296
+ const options = this.getFormInitOptions(formParam, form);
297
+ this.instance.setUrl(formParam, options);
298
+ }
299
+ else {
300
+ this.instance.url = formParam;
301
+ }
296
302
  this.instance.nosubmit = false;
297
303
  this._form = this.instance.form = form;
298
304
  if (submission) {
@@ -830,7 +830,6 @@ export default class Webform extends NestedDataComponent {
830
830
  if (!submission || !submission.data) {
831
831
  submission = {
832
832
  data: {},
833
- metadata: submission.metadata,
834
833
  };
835
834
  }
836
835
  // Metadata needs to be available before setValue
@@ -681,7 +681,7 @@ export default class NestedComponent extends Field {
681
681
  validationProcessor({ scope, data, row, instance, component }, flags) {
682
682
  const { dirty } = flags;
683
683
  if (this.root.hasExtraPages && this.page !== this.root.page) {
684
- instance = this.getComponentById(component.id);
684
+ instance = this.getComponent(component.path);
685
685
  }
686
686
  if (!instance) {
687
687
  return;
@@ -236,7 +236,7 @@ export default class DataMapComponent extends DataGridComponent {
236
236
  delete dataValue[key];
237
237
  const comp = components[this.valueKey];
238
238
  comp.component.key = newKey;
239
- comp.path = Components.calculateComponentPath(comp);
239
+ comp.path = Components.getComponentPath(comp);
240
240
  key = newKey;
241
241
  });
242
242
  const valueComponent = _.clone(this.component.valueComponent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5734.79d4f47",
3
+ "version": "5.0.0-dev.5740.c7c00bc",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {