@formio/js 5.1.0-rc.5 → 5.1.0-rc.7

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.
@@ -20,7 +20,7 @@
20
20
 
21
21
  /*! @license DOMPurify 3.2.3 | (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.3/LICENSE */
22
22
 
23
- /*! formiojs v5.1.0-rc.5 | https://unpkg.com/formiojs@5.1.0-rc.5/LICENSE.txt */
23
+ /*! formiojs v5.1.0-rc.7 | https://unpkg.com/formiojs@5.1.0-rc.7/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/Wizard.js CHANGED
@@ -667,7 +667,7 @@ class Wizard extends Webform_1.default {
667
667
  return this.page - 1;
668
668
  }
669
669
  beforeSubmit() {
670
- const pages = this.getPages();
670
+ const pages = this.getPages({ all: true });
671
671
  return Promise.all(pages.map((page) => {
672
672
  page.options.beforeSubmit = true;
673
673
  return page.beforeSubmit();
@@ -218,7 +218,7 @@ class AddressComponent extends Container_1.default {
218
218
  super.dataValue = value;
219
219
  }
220
220
  get dataValue() {
221
- const resultValue = lodash_1.default.get(this._data, this.component.path);
221
+ const resultValue = lodash_1.default.get(this._data, this.path);
222
222
  if (!lodash_1.default.isArray(resultValue) && this.component.multiple) {
223
223
  return [resultValue];
224
224
  }
@@ -0,0 +1,46 @@
1
+ declare namespace _default {
2
+ let type: string;
3
+ let display: string;
4
+ let title: string;
5
+ let name: string;
6
+ let path: string;
7
+ let components: ({
8
+ label: string;
9
+ tableView: boolean;
10
+ multiple: boolean;
11
+ provider: string;
12
+ validateWhenHidden: boolean;
13
+ key: string;
14
+ providerOptions: {
15
+ params: {
16
+ autocompleteOptions: {};
17
+ };
18
+ };
19
+ type: string;
20
+ input: boolean;
21
+ components: {
22
+ label: string;
23
+ tableView: boolean;
24
+ key: string;
25
+ type: string;
26
+ input: boolean;
27
+ customConditional: string;
28
+ }[];
29
+ defaultValue: {}[];
30
+ disableOnInvalid?: undefined;
31
+ } | {
32
+ type: string;
33
+ label: string;
34
+ key: string;
35
+ disableOnInvalid: boolean;
36
+ input: boolean;
37
+ tableView: boolean;
38
+ multiple?: undefined;
39
+ provider?: undefined;
40
+ validateWhenHidden?: undefined;
41
+ providerOptions?: undefined;
42
+ components?: undefined;
43
+ defaultValue?: undefined;
44
+ })[];
45
+ }
46
+ export default _default;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ type: 'form',
5
+ display: 'form',
6
+ title: 'FIO-9527',
7
+ name: 'fio9527',
8
+ path: 'fio9527',
9
+ components: [
10
+ {
11
+ label: 'Address',
12
+ tableView: false,
13
+ multiple: true,
14
+ provider: 'nominatim',
15
+ validateWhenHidden: false,
16
+ key: 'address',
17
+ providerOptions: {
18
+ params: {
19
+ autocompleteOptions: {}
20
+ }
21
+ },
22
+ type: 'address',
23
+ input: true,
24
+ components: [
25
+ {
26
+ label: 'Address 1',
27
+ tableView: false,
28
+ key: 'address1',
29
+ type: 'textfield',
30
+ input: true,
31
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
32
+ },
33
+ {
34
+ label: 'Address 2',
35
+ tableView: false,
36
+ key: 'address2',
37
+ type: 'textfield',
38
+ input: true,
39
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
40
+ },
41
+ {
42
+ label: 'City',
43
+ tableView: false,
44
+ key: 'city',
45
+ type: 'textfield',
46
+ input: true,
47
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
48
+ },
49
+ {
50
+ label: 'State',
51
+ tableView: false,
52
+ key: 'state',
53
+ type: 'textfield',
54
+ input: true,
55
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
56
+ },
57
+ {
58
+ label: 'Country',
59
+ tableView: false,
60
+ key: 'country',
61
+ type: 'textfield',
62
+ input: true,
63
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
64
+ },
65
+ {
66
+ label: 'Zip Code',
67
+ tableView: false,
68
+ key: 'zip',
69
+ type: 'textfield',
70
+ input: true,
71
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
72
+ }
73
+ ],
74
+ defaultValue: [
75
+ {}
76
+ ]
77
+ },
78
+ {
79
+ type: 'button',
80
+ label: 'Submit',
81
+ key: 'submit',
82
+ disableOnInvalid: true,
83
+ input: true,
84
+ tableView: false
85
+ }
86
+ ]
87
+ };
@@ -2,4 +2,5 @@ import comp1 from './comp1';
2
2
  import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
- export { comp1, comp2, comp3, comp4 };
5
+ import comp5 from './comp5';
6
+ export { comp1, comp2, comp3, comp4, comp5 };
@@ -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.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = 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"));
@@ -12,3 +12,5 @@ const comp3_1 = __importDefault(require("./comp3"));
12
12
  exports.comp3 = comp3_1.default;
13
13
  const comp4_1 = __importDefault(require("./comp4"));
14
14
  exports.comp4 = comp4_1.default;
15
+ const comp5_1 = __importDefault(require("./comp5"));
16
+ exports.comp5 = comp5_1.default;
@@ -144,6 +144,8 @@ class FormComponent extends Component_1.default {
144
144
  options.events = this.createEmitter();
145
145
  // Make sure to not show the submit button in wizards in the nested forms.
146
146
  lodash_1.default.set(options, 'buttonSettings.showSubmit', false);
147
+ // Set the parent option to the subform so those references are stable when the subform is created
148
+ options.parent = this;
147
149
  if (!this.options) {
148
150
  return options;
149
151
  }
@@ -393,12 +395,11 @@ class FormComponent extends Component_1.default {
393
395
  return (new Form_1.default(form, this.getSubOptions())).ready.then((instance) => {
394
396
  this.subForm = instance;
395
397
  this.subForm.currentForm = this;
398
+ this.subForm.parentVisible = this.visible;
396
399
  const componentsMap = this.componentsMap;
397
400
  const formComponentsMap = this.subForm.componentsMap;
398
401
  lodash_1.default.assign(componentsMap, formComponentsMap);
399
402
  this.component.components = this.subForm.components.map((comp) => comp.component);
400
- this.subForm.parent = this;
401
- this.subForm.parentVisible = this.visible;
402
403
  this.subForm.on('change', () => {
403
404
  if (this.subForm) {
404
405
  this.dataValue = this.subForm.getValue();
@@ -582,11 +583,21 @@ class FormComponent extends Component_1.default {
582
583
  this.dataValue = submission;
583
584
  return Promise.resolve(this.dataValue);
584
585
  }
585
- return this.submitSubForm(false)
586
- .then(() => {
587
- return this.dataValue;
588
- })
589
- .then(() => super.beforeSubmit());
586
+ if (this.isSubFormLazyLoad() && !this.subFormLoading) {
587
+ return this.createSubForm(true)
588
+ .then(this.submitSubForm(false))
589
+ .then(() => {
590
+ return this.dataValue;
591
+ })
592
+ .then(() => super.beforeSubmit());
593
+ }
594
+ else {
595
+ return this.submitSubForm(false)
596
+ .then(() => {
597
+ return this.dataValue;
598
+ })
599
+ .then(() => super.beforeSubmit());
600
+ }
590
601
  }
591
602
  isSubFormLazyLoad() {
592
603
  var _a, _b;
package/lib/mjs/Wizard.js CHANGED
@@ -657,7 +657,7 @@ export default class Wizard extends Webform {
657
657
  return this.page - 1;
658
658
  }
659
659
  beforeSubmit() {
660
- const pages = this.getPages();
660
+ const pages = this.getPages({ all: true });
661
661
  return Promise.all(pages.map((page) => {
662
662
  page.options.beforeSubmit = true;
663
663
  return page.beforeSubmit();
@@ -214,7 +214,7 @@ export default class AddressComponent extends ContainerComponent {
214
214
  super.dataValue = value;
215
215
  }
216
216
  get dataValue() {
217
- const resultValue = _.get(this._data, this.component.path);
217
+ const resultValue = _.get(this._data, this.path);
218
218
  if (!_.isArray(resultValue) && this.component.multiple) {
219
219
  return [resultValue];
220
220
  }
@@ -0,0 +1,46 @@
1
+ declare namespace _default {
2
+ let type: string;
3
+ let display: string;
4
+ let title: string;
5
+ let name: string;
6
+ let path: string;
7
+ let components: ({
8
+ label: string;
9
+ tableView: boolean;
10
+ multiple: boolean;
11
+ provider: string;
12
+ validateWhenHidden: boolean;
13
+ key: string;
14
+ providerOptions: {
15
+ params: {
16
+ autocompleteOptions: {};
17
+ };
18
+ };
19
+ type: string;
20
+ input: boolean;
21
+ components: {
22
+ label: string;
23
+ tableView: boolean;
24
+ key: string;
25
+ type: string;
26
+ input: boolean;
27
+ customConditional: string;
28
+ }[];
29
+ defaultValue: {}[];
30
+ disableOnInvalid?: undefined;
31
+ } | {
32
+ type: string;
33
+ label: string;
34
+ key: string;
35
+ disableOnInvalid: boolean;
36
+ input: boolean;
37
+ tableView: boolean;
38
+ multiple?: undefined;
39
+ provider?: undefined;
40
+ validateWhenHidden?: undefined;
41
+ providerOptions?: undefined;
42
+ components?: undefined;
43
+ defaultValue?: undefined;
44
+ })[];
45
+ }
46
+ export default _default;
@@ -0,0 +1,85 @@
1
+ export default {
2
+ type: 'form',
3
+ display: 'form',
4
+ title: 'FIO-9527',
5
+ name: 'fio9527',
6
+ path: 'fio9527',
7
+ components: [
8
+ {
9
+ label: 'Address',
10
+ tableView: false,
11
+ multiple: true,
12
+ provider: 'nominatim',
13
+ validateWhenHidden: false,
14
+ key: 'address',
15
+ providerOptions: {
16
+ params: {
17
+ autocompleteOptions: {}
18
+ }
19
+ },
20
+ type: 'address',
21
+ input: true,
22
+ components: [
23
+ {
24
+ label: 'Address 1',
25
+ tableView: false,
26
+ key: 'address1',
27
+ type: 'textfield',
28
+ input: true,
29
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
30
+ },
31
+ {
32
+ label: 'Address 2',
33
+ tableView: false,
34
+ key: 'address2',
35
+ type: 'textfield',
36
+ input: true,
37
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
38
+ },
39
+ {
40
+ label: 'City',
41
+ tableView: false,
42
+ key: 'city',
43
+ type: 'textfield',
44
+ input: true,
45
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
46
+ },
47
+ {
48
+ label: 'State',
49
+ tableView: false,
50
+ key: 'state',
51
+ type: 'textfield',
52
+ input: true,
53
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
54
+ },
55
+ {
56
+ label: 'Country',
57
+ tableView: false,
58
+ key: 'country',
59
+ type: 'textfield',
60
+ input: true,
61
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
62
+ },
63
+ {
64
+ label: 'Zip Code',
65
+ tableView: false,
66
+ key: 'zip',
67
+ type: 'textfield',
68
+ input: true,
69
+ customConditional: "show = _.get(instance, 'parent.manualMode', false);"
70
+ }
71
+ ],
72
+ defaultValue: [
73
+ {}
74
+ ]
75
+ },
76
+ {
77
+ type: 'button',
78
+ label: 'Submit',
79
+ key: 'submit',
80
+ disableOnInvalid: true,
81
+ input: true,
82
+ tableView: false
83
+ }
84
+ ]
85
+ };
@@ -2,4 +2,5 @@ import comp1 from './comp1';
2
2
  import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
- export { comp1, comp2, comp3, comp4 };
5
+ import comp5 from './comp5';
6
+ export { comp1, comp2, comp3, comp4, comp5 };
@@ -2,4 +2,5 @@ import comp1 from './comp1';
2
2
  import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
- export { comp1, comp2, comp3, comp4 };
5
+ import comp5 from './comp5';
6
+ export { comp1, comp2, comp3, comp4, comp5 };
@@ -138,6 +138,8 @@ export default class FormComponent extends Component {
138
138
  options.events = this.createEmitter();
139
139
  // Make sure to not show the submit button in wizards in the nested forms.
140
140
  _.set(options, 'buttonSettings.showSubmit', false);
141
+ // Set the parent option to the subform so those references are stable when the subform is created
142
+ options.parent = this;
141
143
  if (!this.options) {
142
144
  return options;
143
145
  }
@@ -389,12 +391,11 @@ export default class FormComponent extends Component {
389
391
  return (new Form(form, this.getSubOptions())).ready.then((instance) => {
390
392
  this.subForm = instance;
391
393
  this.subForm.currentForm = this;
394
+ this.subForm.parentVisible = this.visible;
392
395
  const componentsMap = this.componentsMap;
393
396
  const formComponentsMap = this.subForm.componentsMap;
394
397
  _.assign(componentsMap, formComponentsMap);
395
398
  this.component.components = this.subForm.components.map((comp) => comp.component);
396
- this.subForm.parent = this;
397
- this.subForm.parentVisible = this.visible;
398
399
  this.subForm.on('change', () => {
399
400
  if (this.subForm) {
400
401
  this.dataValue = this.subForm.getValue();
@@ -576,11 +577,21 @@ export default class FormComponent extends Component {
576
577
  this.dataValue = submission;
577
578
  return Promise.resolve(this.dataValue);
578
579
  }
579
- return this.submitSubForm(false)
580
- .then(() => {
581
- return this.dataValue;
582
- })
583
- .then(() => super.beforeSubmit());
580
+ if (this.isSubFormLazyLoad() && !this.subFormLoading) {
581
+ return this.createSubForm(true)
582
+ .then(this.submitSubForm(false))
583
+ .then(() => {
584
+ return this.dataValue;
585
+ })
586
+ .then(() => super.beforeSubmit());
587
+ }
588
+ else {
589
+ return this.submitSubForm(false)
590
+ .then(() => {
591
+ return this.dataValue;
592
+ })
593
+ .then(() => super.beforeSubmit());
594
+ }
584
595
  }
585
596
  isSubFormLazyLoad() {
586
597
  return this.root?._form?.display === 'wizard' && this.component.lazyLoad;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-rc.5",
3
+ "version": "5.1.0-rc.7",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -81,7 +81,7 @@
81
81
  "dependencies": {
82
82
  "@formio/bootstrap": "3.1.0-rc.1",
83
83
  "@formio/choices.js": "^10.2.1",
84
- "@formio/core": "2.4.0-rc.4",
84
+ "@formio/core": "2.4.0-rc.5",
85
85
  "@formio/text-mask-addons": "^3.8.0-formio.4",
86
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
87
87
  "abortcontroller-polyfill": "^1.7.5",