@formio/js 5.0.0-dev.5720.e861c22 → 5.0.0-dev.5721.5aa8849

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 (58) hide show
  1. package/Changelog.md +12 -0
  2. package/dist/formio.form.js +30 -20
  3. package/dist/formio.form.min.js +1 -1
  4. package/dist/formio.full.js +33 -23
  5. package/dist/formio.full.min.js +1 -1
  6. package/dist/formio.utils.js +12 -2
  7. package/dist/formio.utils.min.js +1 -1
  8. package/lib/cjs/Form.d.ts +2 -2
  9. package/lib/cjs/Form.js +9 -3
  10. package/lib/cjs/PDF.js +1 -1
  11. package/lib/cjs/Webform.js +0 -1
  12. package/lib/cjs/WebformBuilder.js +2 -1
  13. package/lib/cjs/components/_classes/nested/NestedComponent.js +2 -1
  14. package/lib/cjs/components/datagrid/DataGrid.d.ts +0 -1
  15. package/lib/cjs/components/datagrid/DataGrid.js +0 -8
  16. package/lib/cjs/components/datamap/DataMap.js +1 -1
  17. package/lib/cjs/components/day/Day.d.ts +2 -2
  18. package/lib/cjs/components/day/Day.js +3 -3
  19. package/lib/cjs/components/editgrid/EditGrid.js +1 -5
  20. package/lib/cjs/components/file/File.js +4 -0
  21. package/lib/cjs/components/form/editForm/Form.edit.form.js +1 -1
  22. package/lib/cjs/components/radio/Radio.js +0 -10
  23. package/lib/cjs/components/select/Select.d.ts +38 -0
  24. package/lib/cjs/components/select/Select.js +11 -1
  25. package/lib/cjs/components/select/fixtures/comp25.d.ts +44 -0
  26. package/lib/cjs/components/select/fixtures/comp25.js +59 -0
  27. package/lib/cjs/components/select/fixtures/index.d.ts +2 -1
  28. package/lib/cjs/components/select/fixtures/index.js +3 -1
  29. package/lib/cjs/components/time/Time.form.js +2 -2
  30. package/lib/cjs/templates/Templates.js +1 -1
  31. package/lib/cjs/translations/en.d.ts +1 -0
  32. package/lib/cjs/translations/en.js +1 -0
  33. package/lib/mjs/Form.d.ts +2 -2
  34. package/lib/mjs/Form.js +9 -3
  35. package/lib/mjs/PDF.js +1 -1
  36. package/lib/mjs/Webform.js +0 -1
  37. package/lib/mjs/WebformBuilder.js +2 -1
  38. package/lib/mjs/components/_classes/nested/NestedComponent.js +2 -1
  39. package/lib/mjs/components/datagrid/DataGrid.d.ts +0 -1
  40. package/lib/mjs/components/datagrid/DataGrid.js +0 -8
  41. package/lib/mjs/components/datamap/DataMap.js +1 -1
  42. package/lib/mjs/components/day/Day.d.ts +2 -2
  43. package/lib/mjs/components/day/Day.js +3 -3
  44. package/lib/mjs/components/editgrid/EditGrid.js +1 -5
  45. package/lib/mjs/components/file/File.js +4 -0
  46. package/lib/mjs/components/form/editForm/Form.edit.form.js +1 -1
  47. package/lib/mjs/components/radio/Radio.js +0 -10
  48. package/lib/mjs/components/select/Select.d.ts +38 -0
  49. package/lib/mjs/components/select/Select.js +14 -2
  50. package/lib/mjs/components/select/fixtures/comp25.d.ts +44 -0
  51. package/lib/mjs/components/select/fixtures/comp25.js +57 -0
  52. package/lib/mjs/components/select/fixtures/index.d.ts +2 -1
  53. package/lib/mjs/components/select/fixtures/index.js +2 -1
  54. package/lib/mjs/components/time/Time.form.js +2 -2
  55. package/lib/mjs/templates/Templates.js +1 -1
  56. package/lib/mjs/translations/en.d.ts +1 -0
  57. package/lib/mjs/translations/en.js +1 -0
  58. package/package.json +3 -3
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) {
package/lib/cjs/PDF.js CHANGED
@@ -70,7 +70,7 @@ class PDF extends Webform_1.default {
70
70
  super.destroy(all);
71
71
  }
72
72
  rebuild() {
73
- if (this.attached && this.builderMode && this.component.components) {
73
+ if (this.builderMode && this.component.components) {
74
74
  this.destroyComponents();
75
75
  this.addComponents();
76
76
  return Promise.resolve();
@@ -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
@@ -208,7 +208,8 @@ class WebformBuilder extends Component_1.default {
208
208
  params: {
209
209
  type: 'resource',
210
210
  limit: 1000000,
211
- select: '_id,title,name,components'
211
+ select: '_id,title,name,components',
212
+ 'tags__ne': 'noBuilderResource'
212
213
  }
213
214
  };
214
215
  if (this.options && this.options.resourceTag) {
@@ -497,6 +497,7 @@ class NestedComponent extends Field_1.default {
497
497
  header: 'single',
498
498
  collapsed: this.collapsed,
499
499
  [this.nestedKey]: 'single',
500
+ messageContainer: 'single-scope',
500
501
  });
501
502
  let childPromise = Promise.resolve();
502
503
  if (this.refs[this.nestedKey]) {
@@ -684,7 +685,7 @@ class NestedComponent extends Field_1.default {
684
685
  validationProcessor({ scope, data, row, instance, component }, flags) {
685
686
  const { dirty } = flags;
686
687
  if (this.root.hasExtraPages && this.page !== this.root.page) {
687
- instance = this.getComponentById(component.id);
688
+ instance = this.getComponent(component.path);
688
689
  }
689
690
  if (!instance) {
690
691
  return;
@@ -59,7 +59,6 @@ export default class DataGridComponent extends NestedArrayComponent {
59
59
  getRows(): {}[];
60
60
  getColumns(): any[];
61
61
  hasHeader(): any;
62
- loadRefs(element: any, refs: any): void;
63
62
  dragula: any;
64
63
  getComponentsContainer(): any;
65
64
  /**
@@ -263,13 +263,6 @@ class DataGridComponent extends NestedArrayComponent_1.default {
263
263
  return hasHeader || ((col.label || col.title) && !col.hideLabel);
264
264
  }, false);
265
265
  }
266
- loadRefs(element, refs) {
267
- super.loadRefs(element, refs);
268
- if (refs['messageContainer'] === 'single') {
269
- const container = lodash_1.default.last(element.querySelectorAll(`[${this._referenceAttributeName}=messageContainer]`));
270
- this.refs['messageContainer'] = container || this.refs['messageContainer'];
271
- }
272
- }
273
266
  attach(element) {
274
267
  this.loadRefs(element, {
275
268
  [`${this.datagridKey}-row`]: 'multiple',
@@ -278,7 +271,6 @@ class DataGridComponent extends NestedArrayComponent_1.default {
278
271
  [`${this.datagridKey}-removeRow`]: 'multiple',
279
272
  [`${this.datagridKey}-group-header`]: 'multiple',
280
273
  [this.datagridKey]: 'multiple',
281
- 'messageContainer': 'single'
282
274
  });
283
275
  if (this.allowReorder) {
284
276
  this.refs[`${this.datagridKey}-row`].forEach((row, index) => {
@@ -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);
@@ -17,9 +17,9 @@ export default class DayComponent extends Field {
17
17
  constructor(component: any, options: any, data: any);
18
18
  /**
19
19
  * The empty value for day component.
20
- * @returns {'00/00/0000'} - The empty value of the day component.
20
+ * @returns {''} - The empty value of the day component.
21
21
  */
22
- get emptyValue(): "00/00/0000";
22
+ get emptyValue(): "";
23
23
  get valueMask(): RegExp;
24
24
  get dayRequired(): any;
25
25
  get showDay(): boolean;
@@ -64,10 +64,10 @@ class DayComponent extends Field_1.default {
64
64
  }
65
65
  /**
66
66
  * The empty value for day component.
67
- * @returns {'00/00/0000'} - The empty value of the day component.
67
+ * @returns {''} - The empty value of the day component.
68
68
  */
69
69
  get emptyValue() {
70
- return '00/00/0000';
70
+ return '';
71
71
  }
72
72
  get valueMask() {
73
73
  return /^\d{2}\/\d{2}\/\d{4}$/;
@@ -363,7 +363,7 @@ class DayComponent extends Field_1.default {
363
363
  setValueAt(index, value) {
364
364
  // temporary solution to avoid input reset
365
365
  // on invalid date.
366
- if (!value || value === 'Invalid date') {
366
+ if (value === 'Invalid date') {
367
367
  return null;
368
368
  }
369
369
  const parts = value.split('/');
@@ -490,11 +490,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
490
490
  else {
491
491
  this.removeClass(this.refs.component, `formio-component-${this.component.type}-row-open`);
492
492
  }
493
- const superAttach = super.attach(element);
494
- this.loadRefs(element, {
495
- messageContainer: 'single-scope',
496
- });
497
- return superAttach;
493
+ return super.attach(element);
498
494
  }
499
495
  flattenRowDataValue(dataValue) {
500
496
  const flattened = {};
@@ -935,6 +935,10 @@ class FileComponent extends Field_1.default {
935
935
  : response.type === 'abort'
936
936
  ? this.t('Request was aborted')
937
937
  : response.toString();
938
+ this.emit('fileUploadError', {
939
+ fileToSync,
940
+ response,
941
+ });
938
942
  }
939
943
  finally {
940
944
  delete fileToSync.progress;
@@ -47,7 +47,7 @@ exports.default = [
47
47
  },
48
48
  searchField: 'title__regex',
49
49
  template: '<span>{{ item._vid }}</span>',
50
- valueProperty: '_id',
50
+ valueProperty: 'revisionId',
51
51
  authenticate: true,
52
52
  label: 'Form Revision',
53
53
  key: 'revision',
@@ -264,16 +264,6 @@ class RadioComponent extends ListComponent_1.default {
264
264
  if (method.toUpperCase() === 'GET') {
265
265
  body = null;
266
266
  }
267
- const limit = this.component.limit || 100;
268
- const skip = this.isScrollLoading ? this.selectOptions.length : 0;
269
- // Allow for url interpolation.
270
- url = this.interpolate(this.sanitize(url, this.shouldSanitizeValue), {
271
- formioBase: Formio_1.Formio.getBaseUrl(),
272
- search,
273
- limit,
274
- skip,
275
- page: Math.abs(Math.floor(skip / limit))
276
- });
277
267
  // Set ignoreCache if it is
278
268
  options.ignoreCache = this.component.ignoreCache;
279
269
  // Make the request.
@@ -9,9 +9,47 @@ export default class SelectComponent extends ListComponent {
9
9
  };
10
10
  static get serverConditionSettings(): {
11
11
  valueComponent(classComp: any): any;
12
+ dataTypeOperators: {
13
+ number: string[];
14
+ };
15
+ dataTypeValueComponents: {
16
+ number: {
17
+ lessThan: () => {
18
+ type: string;
19
+ };
20
+ greaterThan: () => {
21
+ type: string;
22
+ };
23
+ lessThanOrEqual: () => {
24
+ type: string;
25
+ };
26
+ greaterThanOrEqual: () => {
27
+ type: string;
28
+ };
29
+ };
30
+ };
12
31
  };
13
32
  static get conditionOperatorsSettings(): {
14
33
  valueComponent(classComp: any): any;
34
+ dataTypeOperators: {
35
+ number: string[];
36
+ };
37
+ dataTypeValueComponents: {
38
+ number: {
39
+ lessThan: () => {
40
+ type: string;
41
+ };
42
+ greaterThan: () => {
43
+ type: string;
44
+ };
45
+ lessThanOrEqual: () => {
46
+ type: string;
47
+ };
48
+ greaterThanOrEqual: () => {
49
+ type: string;
50
+ };
51
+ };
52
+ };
15
53
  };
16
54
  static savedValueTypes(schema: any): any[];
17
55
  templateData: {} | undefined;
@@ -62,6 +62,7 @@ class SelectComponent extends ListComponent_1.default {
62
62
  return SelectComponent.conditionOperatorsSettings;
63
63
  }
64
64
  static get conditionOperatorsSettings() {
65
+ const numberType = () => ({ type: 'number' });
65
66
  return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { valueComponent(classComp) {
66
67
  const valueComp = Object.assign(Object.assign({}, classComp), { type: 'select' });
67
68
  if ((0, utils_1.isSelectResourceWithObjectValue)(classComp)) {
@@ -76,6 +77,15 @@ class SelectComponent extends ListComponent_1.default {
76
77
  `;
77
78
  }
78
79
  return valueComp;
80
+ }, dataTypeOperators: {
81
+ number: ['lessThan', 'greaterThan', 'lessThanOrEqual', 'greaterThanOrEqual'],
82
+ }, dataTypeValueComponents: {
83
+ number: {
84
+ lessThan: numberType,
85
+ greaterThan: numberType,
86
+ lessThanOrEqual: numberType,
87
+ greaterThanOrEqual: numberType,
88
+ },
79
89
  } });
80
90
  }
81
91
  static savedValueTypes(schema) {
@@ -526,7 +536,7 @@ class SelectComponent extends ListComponent_1.default {
526
536
  skip,
527
537
  };
528
538
  // Allow for url interpolation.
529
- url = this.interpolate(this.sanitize(url, this.shouldSanitizeValue), {
539
+ url = this.interpolate(url, {
530
540
  formioBase: Formio_1.Formio.getBaseUrl(),
531
541
  search,
532
542
  limit,
@@ -0,0 +1,44 @@
1
+ declare namespace _default {
2
+ let title: string;
3
+ let name: string;
4
+ let path: string;
5
+ let type: string;
6
+ let display: string;
7
+ let components: ({
8
+ label: string;
9
+ widget: string;
10
+ tableView: boolean;
11
+ data: {
12
+ values: {
13
+ label: string;
14
+ value: string;
15
+ }[];
16
+ };
17
+ dataType: string;
18
+ key: string;
19
+ type: string;
20
+ input: boolean;
21
+ applyMaskOn?: undefined;
22
+ conditional?: undefined;
23
+ } | {
24
+ label: string;
25
+ applyMaskOn: string;
26
+ tableView: boolean;
27
+ key: string;
28
+ type: string;
29
+ input: boolean;
30
+ conditional: {
31
+ show: boolean;
32
+ conjunction: string;
33
+ conditions: {
34
+ component: string;
35
+ operator: string;
36
+ value: number;
37
+ }[];
38
+ };
39
+ widget?: undefined;
40
+ data?: undefined;
41
+ dataType?: undefined;
42
+ })[];
43
+ }
44
+ export default _default;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ title: 'FIO-8072',
5
+ name: 'fio8072',
6
+ path: 'fio8072',
7
+ type: 'form',
8
+ display: 'form',
9
+ components: [
10
+ {
11
+ label: 'Select',
12
+ widget: 'choicesjs',
13
+ tableView: true,
14
+ data: {
15
+ values: [
16
+ {
17
+ label: 'A',
18
+ value: '1',
19
+ },
20
+ {
21
+ label: 'B',
22
+ value: '2',
23
+ },
24
+ {
25
+ label: 'C',
26
+ value: '10',
27
+ },
28
+ {
29
+ label: 'D',
30
+ value: '1d',
31
+ },
32
+ ],
33
+ },
34
+ dataType: 'number',
35
+ key: 'select',
36
+ type: 'select',
37
+ input: true,
38
+ },
39
+ {
40
+ label: 'Text Field',
41
+ applyMaskOn: 'change',
42
+ tableView: true,
43
+ key: 'textField',
44
+ type: 'textfield',
45
+ input: true,
46
+ conditional: {
47
+ show: true,
48
+ conjunction: 'all',
49
+ conditions: [
50
+ {
51
+ component: 'select',
52
+ operator: 'lessThan',
53
+ value: 5,
54
+ },
55
+ ],
56
+ },
57
+ },
58
+ ],
59
+ };
@@ -21,5 +21,6 @@ import comp21 from './comp21';
21
21
  import comp22 from './comp22';
22
22
  import comp23 from './comp23';
23
23
  import comp24 from './comp24';
24
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24 };
24
+ import comp25 from './comp25';
25
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24, comp25 };
25
26
  export { multiSelect, multiSelectOptions } from "./comp3";
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.comp24 = exports.comp23 = exports.comp22 = exports.comp21 = exports.comp20 = exports.comp19 = exports.comp18 = exports.comp17 = exports.comp16 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp2 = exports.comp1 = exports.multiSelectOptions = exports.multiSelect = void 0;
6
+ exports.comp25 = exports.comp24 = exports.comp23 = exports.comp22 = exports.comp21 = exports.comp20 = exports.comp19 = exports.comp18 = exports.comp17 = exports.comp16 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp2 = exports.comp1 = exports.multiSelectOptions = exports.multiSelect = void 0;
7
7
  const comp1_1 = __importDefault(require("./comp1"));
8
8
  exports.comp1 = comp1_1.default;
9
9
  const comp2_1 = __importDefault(require("./comp2"));
@@ -53,3 +53,5 @@ const comp23_1 = __importDefault(require("./comp23"));
53
53
  exports.comp23 = comp23_1.default;
54
54
  const comp24_1 = __importDefault(require("./comp24"));
55
55
  exports.comp24 = comp24_1.default;
56
+ const comp25_1 = __importDefault(require("./comp25"));
57
+ exports.comp25 = comp25_1.default;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const Component_form_1 = __importDefault(require("../_classes/component/Component.form"));
6
+ const Components_1 = __importDefault(require("../Components"));
7
7
  const Time_edit_data_1 = __importDefault(require("./editForm/Time.edit.data"));
8
8
  const Time_edit_display_1 = __importDefault(require("./editForm/Time.edit.display"));
9
9
  /**
@@ -12,7 +12,7 @@ const Time_edit_display_1 = __importDefault(require("./editForm/Time.edit.displa
12
12
  * @returns {import('@formio/core').Component[]} - The edit form components.
13
13
  */
14
14
  function default_1(...extend) {
15
- return (0, Component_form_1.default)([
15
+ return Components_1.default.baseEditForm([
16
16
  {
17
17
  key: 'data',
18
18
  components: Time_edit_data_1.default,
@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const index_1 = __importDefault(require("./index"));
7
7
  const experimental_1 = require("@formio/core/experimental");
8
8
  experimental_1.Template.addTemplates(index_1.default);
9
- experimental_1.Template.defaultTemplates = index_1.default.bootstrap;
9
+ experimental_1.Template.defaultTemplates = experimental_1.Template.templates.bootstrap;
10
10
  exports.default = experimental_1.Template;
@@ -75,6 +75,7 @@ declare namespace _default {
75
75
  let typeRemaining: string;
76
76
  let typeCount: string;
77
77
  let requiredDayField: string;
78
+ let requiredDayEmpty: string;
78
79
  let requiredMonthField: string;
79
80
  let requiredYearField: string;
80
81
  }
@@ -77,6 +77,7 @@ exports.default = {
77
77
  typeRemaining: '{{ remaining }} {{ type }} remaining.',
78
78
  typeCount: '{{ count }} {{ type }}',
79
79
  requiredDayField: '{{ field }} is required',
80
+ requiredDayEmpty: '{{ field }} is required',
80
81
  requiredMonthField: '{{ field }} is required',
81
82
  requiredYearField: '{{ field }} is required'
82
83
  };
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) {
package/lib/mjs/PDF.js CHANGED
@@ -65,7 +65,7 @@ export default class PDF extends Webform {
65
65
  super.destroy(all);
66
66
  }
67
67
  rebuild() {
68
- if (this.attached && this.builderMode && this.component.components) {
68
+ if (this.builderMode && this.component.components) {
69
69
  this.destroyComponents();
70
70
  this.addComponents();
71
71
  return Promise.resolve();
@@ -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
@@ -187,7 +187,8 @@ export default class WebformBuilder extends Component {
187
187
  params: {
188
188
  type: 'resource',
189
189
  limit: 1000000,
190
- select: '_id,title,name,components'
190
+ select: '_id,title,name,components',
191
+ 'tags__ne': 'noBuilderResource'
191
192
  }
192
193
  };
193
194
  if (this.options && this.options.resourceTag) {
@@ -493,6 +493,7 @@ export default class NestedComponent extends Field {
493
493
  header: 'single',
494
494
  collapsed: this.collapsed,
495
495
  [this.nestedKey]: 'single',
496
+ messageContainer: 'single-scope',
496
497
  });
497
498
  let childPromise = Promise.resolve();
498
499
  if (this.refs[this.nestedKey]) {
@@ -680,7 +681,7 @@ export default class NestedComponent extends Field {
680
681
  validationProcessor({ scope, data, row, instance, component }, flags) {
681
682
  const { dirty } = flags;
682
683
  if (this.root.hasExtraPages && this.page !== this.root.page) {
683
- instance = this.getComponentById(component.id);
684
+ instance = this.getComponent(component.path);
684
685
  }
685
686
  if (!instance) {
686
687
  return;
@@ -59,7 +59,6 @@ export default class DataGridComponent extends NestedArrayComponent {
59
59
  getRows(): {}[];
60
60
  getColumns(): any[];
61
61
  hasHeader(): any;
62
- loadRefs(element: any, refs: any): void;
63
62
  dragula: any;
64
63
  getComponentsContainer(): any;
65
64
  /**
@@ -260,13 +260,6 @@ export default class DataGridComponent extends NestedArrayComponent {
260
260
  return hasHeader || ((col.label || col.title) && !col.hideLabel);
261
261
  }, false);
262
262
  }
263
- loadRefs(element, refs) {
264
- super.loadRefs(element, refs);
265
- if (refs['messageContainer'] === 'single') {
266
- const container = _.last(element.querySelectorAll(`[${this._referenceAttributeName}=messageContainer]`));
267
- this.refs['messageContainer'] = container || this.refs['messageContainer'];
268
- }
269
- }
270
263
  attach(element) {
271
264
  this.loadRefs(element, {
272
265
  [`${this.datagridKey}-row`]: 'multiple',
@@ -275,7 +268,6 @@ export default class DataGridComponent extends NestedArrayComponent {
275
268
  [`${this.datagridKey}-removeRow`]: 'multiple',
276
269
  [`${this.datagridKey}-group-header`]: 'multiple',
277
270
  [this.datagridKey]: 'multiple',
278
- 'messageContainer': 'single'
279
271
  });
280
272
  if (this.allowReorder) {
281
273
  this.refs[`${this.datagridKey}-row`].forEach((row, index) => {
@@ -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);
@@ -17,9 +17,9 @@ export default class DayComponent extends Field {
17
17
  constructor(component: any, options: any, data: any);
18
18
  /**
19
19
  * The empty value for day component.
20
- * @returns {'00/00/0000'} - The empty value of the day component.
20
+ * @returns {''} - The empty value of the day component.
21
21
  */
22
- get emptyValue(): "00/00/0000";
22
+ get emptyValue(): "";
23
23
  get valueMask(): RegExp;
24
24
  get dayRequired(): any;
25
25
  get showDay(): boolean;
@@ -62,10 +62,10 @@ export default class DayComponent extends Field {
62
62
  }
63
63
  /**
64
64
  * The empty value for day component.
65
- * @returns {'00/00/0000'} - The empty value of the day component.
65
+ * @returns {''} - The empty value of the day component.
66
66
  */
67
67
  get emptyValue() {
68
- return '00/00/0000';
68
+ return '';
69
69
  }
70
70
  get valueMask() {
71
71
  return /^\d{2}\/\d{2}\/\d{4}$/;
@@ -361,7 +361,7 @@ export default class DayComponent extends Field {
361
361
  setValueAt(index, value) {
362
362
  // temporary solution to avoid input reset
363
363
  // on invalid date.
364
- if (!value || value === 'Invalid date') {
364
+ if (value === 'Invalid date') {
365
365
  return null;
366
366
  }
367
367
  const parts = value.split('/');