@formio/js 5.1.0-rc.17 → 5.1.0-rc.19

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 (50) 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 +4 -4
  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 +6 -6
  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 +2 -2
  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/Embed.js +1 -1
  15. package/lib/cjs/Formio.js +1 -1
  16. package/lib/cjs/PDFBuilder.js +2 -2
  17. package/lib/cjs/WebformBuilder.d.ts +1 -0
  18. package/lib/cjs/WebformBuilder.js +14 -3
  19. package/lib/cjs/components/_classes/nested/fixtures/comp4.d.ts +11 -1
  20. package/lib/cjs/components/_classes/nested/fixtures/comp4.js +1 -1
  21. package/lib/cjs/components/datetime/fixtures/index.d.ts +1 -1
  22. package/lib/cjs/components/datetime/fixtures/index.js +1 -3
  23. package/lib/cjs/components/editgrid/fixtures/index.d.ts +1 -1
  24. package/lib/cjs/components/editgrid/fixtures/index.js +1 -5
  25. package/lib/cjs/components/form/Form.d.ts +4 -2
  26. package/lib/cjs/components/form/Form.js +12 -7
  27. package/lib/cjs/components/selectboxes/fixtures/index.d.ts +2 -1
  28. package/lib/cjs/components/selectboxes/fixtures/index.js +3 -1
  29. package/lib/cjs/components/tags/fixtures/index.d.ts +1 -1
  30. package/lib/cjs/components/tags/fixtures/index.js +1 -5
  31. package/lib/cjs/utils/formUtils.d.ts +2 -2
  32. package/lib/mjs/Embed.js +1 -1
  33. package/lib/mjs/Formio.js +1 -1
  34. package/lib/mjs/PDFBuilder.js +2 -2
  35. package/lib/mjs/WebformBuilder.d.ts +1 -0
  36. package/lib/mjs/WebformBuilder.js +13 -2
  37. package/lib/mjs/components/_classes/nested/fixtures/comp4.d.ts +11 -1
  38. package/lib/mjs/components/_classes/nested/fixtures/comp4.js +1 -1
  39. package/lib/mjs/components/datetime/fixtures/index.d.ts +1 -1
  40. package/lib/mjs/components/datetime/fixtures/index.js +1 -2
  41. package/lib/mjs/components/editgrid/fixtures/index.d.ts +1 -1
  42. package/lib/mjs/components/editgrid/fixtures/index.js +1 -3
  43. package/lib/mjs/components/form/Form.d.ts +4 -2
  44. package/lib/mjs/components/form/Form.js +12 -7
  45. package/lib/mjs/components/selectboxes/fixtures/index.d.ts +2 -1
  46. package/lib/mjs/components/selectboxes/fixtures/index.js +2 -1
  47. package/lib/mjs/components/tags/fixtures/index.d.ts +1 -1
  48. package/lib/mjs/components/tags/fixtures/index.js +1 -3
  49. package/lib/mjs/utils/formUtils.d.ts +2 -2
  50. package/package.json +3 -3
@@ -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.17 | https://unpkg.com/formiojs@5.1.0-rc.17/LICENSE.txt */
23
+ /*! formiojs v5.1.0-rc.19 | https://unpkg.com/formiojs@5.1.0-rc.19/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
 
@@ -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.17 | https://unpkg.com/formiojs@5.1.0-rc.17/LICENSE.txt */
23
+ /*! formiojs v5.1.0-rc.19 | https://unpkg.com/formiojs@5.1.0-rc.19/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/Embed.js CHANGED
@@ -418,7 +418,7 @@ Formio.formioReady = new Promise((ready, reject) => {
418
418
  _a._formioReady = ready;
419
419
  _a._formioReadyReject = reject;
420
420
  });
421
- Formio.version = '5.1.0-rc.17';
421
+ Formio.version = '5.1.0-rc.19';
422
422
  // Create a report.
423
423
  Formio.Report = {
424
424
  create: (element, submission, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
package/lib/cjs/Formio.js CHANGED
@@ -11,7 +11,7 @@ const CDN_1 = __importDefault(require("./CDN"));
11
11
  const providers_1 = __importDefault(require("./providers"));
12
12
  sdk_1.Formio.cdn = new CDN_1.default();
13
13
  sdk_1.Formio.Providers = providers_1.default;
14
- sdk_1.Formio.version = '5.1.0-rc.17';
14
+ sdk_1.Formio.version = '5.1.0-rc.19';
15
15
  CDN_1.default.defaultCDN = sdk_1.Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
16
16
  const isNil = (val) => val === null || val === undefined;
17
17
  sdk_1.Formio.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
@@ -300,7 +300,7 @@ class PDFBuilder extends WebformBuilder_1.default {
300
300
  height: schema.height,
301
301
  width: schema.width
302
302
  };
303
- if (!this.options.noNewEdit && !component.component.noNewEdit) {
303
+ if (!this.options.noNewEdit && !component.component.noNewEdit && this.hasEditTabs(component.type)) {
304
304
  this.editComponent(component.component, this.getParentContainer(component), isNew);
305
305
  }
306
306
  this.emit('updateComponent', component.component);
@@ -324,7 +324,7 @@ class PDFBuilder extends WebformBuilder_1.default {
324
324
  });
325
325
  this.webform.on('iframe-componentClick', schema => {
326
326
  const component = this.webform.getComponentById(schema.id);
327
- if (component) {
327
+ if (component && this.hasEditTabs(component.type)) {
328
328
  this.editComponent(component.component, this.getParentContainer(component));
329
329
  }
330
330
  }, true);
@@ -123,6 +123,7 @@ export default class WebformBuilder extends Component {
123
123
  addBuilderGroup(name: any, group: any): void;
124
124
  updateBuilderGroup(name: any, group: any): void;
125
125
  generateKey(info: any): any;
126
+ hasEditTabs(type: any): boolean;
126
127
  }
127
128
  import Component from './components/_classes/component/Component';
128
129
  import Webform from './Webform';
@@ -123,7 +123,7 @@ class WebformBuilder extends Component_1.default {
123
123
  }
124
124
  this.options.hooks = this.options.hooks || {};
125
125
  this.options.hooks.renderComponent = (html, { component, self }) => {
126
- var _a, _b;
126
+ var _a, _b, _c;
127
127
  if (self.type === 'form' && !self.key) {
128
128
  const template = this.hook('renderComponentFormTemplate', html.replace('formio-component-form', ''));
129
129
  // The main webform shouldn't have this class as it adds extra styles.
@@ -136,7 +136,9 @@ class WebformBuilder extends Component_1.default {
136
136
  html,
137
137
  disableBuilderActions: (_a = self === null || self === void 0 ? void 0 : self.component) === null || _a === void 0 ? void 0 : _a.disableBuilderActions,
138
138
  childComponent: component,
139
- design: (_b = self === null || self === void 0 ? void 0 : self.options) === null || _b === void 0 ? void 0 : _b.design
139
+ design: (_b = self === null || self === void 0 ? void 0 : self.options) === null || _b === void 0 ? void 0 : _b.design,
140
+ editJson: (_c = self === null || self === void 0 ? void 0 : self.options) === null || _c === void 0 ? void 0 : _c.editJson,
141
+ editComponent: this.hasEditTabs(component.type)
140
142
  });
141
143
  };
142
144
  this.options.hooks.renderComponents = (html, { components, self }) => {
@@ -867,7 +869,11 @@ class WebformBuilder extends Component_1.default {
867
869
  parent.addChildComponent(info, element, target, source, sibling);
868
870
  }
869
871
  const componentInDataGrid = parent.type === 'datagrid';
870
- if (isNew && !this.options.noNewEdit && !info.noNewEdit && !(this.options.design && info.type === 'reviewpage')) {
872
+ if (isNew
873
+ && !this.options.noNewEdit
874
+ && !info.noNewEdit
875
+ && this.hasEditTabs(info.type)
876
+ && !(this.options.design && info.type === 'reviewpage')) {
871
877
  this.editComponent(info, target, isNew, null, null, { inDataGrid: componentInDataGrid });
872
878
  }
873
879
  // Only rebuild the parts needing to be rebuilt.
@@ -1627,5 +1633,10 @@ class WebformBuilder extends Component_1.default {
1627
1633
  info.placeholder ||
1628
1634
  info.type);
1629
1635
  }
1636
+ hasEditTabs(type) {
1637
+ const editTabs = (0, formUtils_1.getComponent)(Components_1.default.components[type].editForm().components, 'tabs', true).components;
1638
+ const hiddenEditTabs = lodash_1.default.filter(lodash_1.default.get(this.options, `editForm.${type}`, []), 'ignore');
1639
+ return lodash_1.default.intersectionBy(editTabs, hiddenEditTabs, 'key').length !== editTabs.length;
1640
+ }
1630
1641
  }
1631
1642
  exports.default = WebformBuilder;
@@ -1,4 +1,14 @@
1
1
  declare namespace _default {
2
- let components: any[];
2
+ let components: {
3
+ label: string;
4
+ inputType: string;
5
+ tableView: boolean;
6
+ defaultValue: boolean;
7
+ key: string;
8
+ type: string;
9
+ name: string;
10
+ value: string;
11
+ input: boolean;
12
+ }[];
3
13
  }
4
14
  export default _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 comp2_1 = __importDefault(require("../checkbox/comp2"));
6
+ const comp2_1 = __importDefault(require("../../../checkbox/fixtures/comp2"));
7
7
  exports.default = {
8
8
  components: [
9
9
  Object.assign({}, comp2_1.default),
@@ -11,4 +11,4 @@ import comp11 from './comp11';
11
11
  import comp12 from './comp12';
12
12
  import comp13 from './comp13';
13
13
  import requiredFieldLogicComp from './requiredFieldLogicComp';
14
- export { comp1, comp2, comp3, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, requiredFieldLogicComp };
14
+ export { comp1, comp2, comp3, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, requiredFieldLogicComp };
@@ -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.requiredFieldLogicComp = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.requiredFieldLogicComp = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = 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"));
@@ -28,7 +28,5 @@ const comp12_1 = __importDefault(require("./comp12"));
28
28
  exports.comp12 = comp12_1.default;
29
29
  const comp13_1 = __importDefault(require("./comp13"));
30
30
  exports.comp13 = comp13_1.default;
31
- const comp14_1 = __importDefault(require("./comp14"));
32
- exports.comp14 = comp14_1.default;
33
31
  const requiredFieldLogicComp_1 = __importDefault(require("./requiredFieldLogicComp"));
34
32
  exports.requiredFieldLogicComp = requiredFieldLogicComp_1.default;
@@ -20,4 +20,4 @@ import comp20 from './comp20';
20
20
  import compOpenWhenEmpty from './comp-openWhenEmpty';
21
21
  import withOpenWhenEmptyAndConditions from './comp-with-conditions-and-openWhenEmpty';
22
22
  import compWithCustomDefaultValue from './comp-with-custom-default-value';
23
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
23
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp18, comp19, comp20, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue };
@@ -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.compTestEvents = exports.compWithCustomDefaultValue = exports.withOpenWhenEmptyAndConditions = exports.compOpenWhenEmpty = 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.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.compWithCustomDefaultValue = exports.withOpenWhenEmptyAndConditions = exports.compOpenWhenEmpty = exports.comp20 = exports.comp19 = exports.comp18 = 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.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"));
@@ -36,8 +36,6 @@ const comp15_1 = __importDefault(require("./comp15"));
36
36
  exports.comp15 = comp15_1.default;
37
37
  const comp16_1 = __importDefault(require("./comp16"));
38
38
  exports.comp16 = comp16_1.default;
39
- const comp17_1 = __importDefault(require("./comp17"));
40
- exports.comp17 = comp17_1.default;
41
39
  const comp18_1 = __importDefault(require("./comp18"));
42
40
  exports.comp18 = comp18_1.default;
43
41
  const comp19_1 = __importDefault(require("./comp19"));
@@ -50,5 +48,3 @@ const comp_openWhenEmpty_1 = __importDefault(require("./comp-openWhenEmpty"));
50
48
  exports.compOpenWhenEmpty = comp_openWhenEmpty_1.default;
51
49
  const comp_with_custom_default_value_1 = __importDefault(require("./comp-with-custom-default-value"));
52
50
  exports.compWithCustomDefaultValue = comp_with_custom_default_value_1.default;
53
- const comp_test_events_1 = __importDefault(require("./comp-test-events"));
54
- exports.compTestEvents = comp_test_events_1.default;
@@ -45,16 +45,18 @@ export default class FormComponent extends Component {
45
45
  /**
46
46
  * Create a subform instance.
47
47
  * @param {boolean} [fromAttach] - This function is being called from an `attach` method.
48
+ * @param {boolean} [beforeSubmit] - This function is being called from a `beforeSubmit` method.
48
49
  * @returns {*} - The subform instance.
49
50
  */
50
- createSubForm(fromAttach?: boolean | undefined): any;
51
+ createSubForm(fromAttach?: boolean | undefined, beforeSubmit?: boolean | undefined): any;
51
52
  hideSubmitButton(component: any): void;
52
53
  /**
53
54
  * Load the subform.
54
55
  * @param {boolean} fromAttach - This function is being called from an `attach` method.
56
+ * @param {boolean} beforeSubmit - This function is being called from a `beforeSubmit` method.
55
57
  * @returns {Promise} - The promise that resolves when the subform is loaded.
56
58
  */
57
- loadSubForm(fromAttach: boolean): Promise<any>;
59
+ loadSubForm(fromAttach: boolean, beforeSubmit: boolean): Promise<any>;
58
60
  subFormLoading: boolean | undefined;
59
61
  checkComponentConditions(data: any, flags: any, row: any): any;
60
62
  calculateValue(data: any, flags: any, row: any): any;
@@ -380,10 +380,11 @@ class FormComponent extends Component_1.default {
380
380
  /**
381
381
  * Create a subform instance.
382
382
  * @param {boolean} [fromAttach] - This function is being called from an `attach` method.
383
+ * @param {boolean} [beforeSubmit] - This function is being called from a `beforeSubmit` method.
383
384
  * @returns {*} - The subform instance.
384
385
  */
385
- createSubForm(fromAttach) {
386
- this.subFormReady = this.loadSubForm(fromAttach).then((form) => {
386
+ createSubForm(fromAttach, beforeSubmit) {
387
+ this.subFormReady = this.loadSubForm(fromAttach, beforeSubmit).then((form) => {
387
388
  if (!form) {
388
389
  return;
389
390
  }
@@ -440,11 +441,13 @@ class FormComponent extends Component_1.default {
440
441
  /**
441
442
  * Load the subform.
442
443
  * @param {boolean} fromAttach - This function is being called from an `attach` method.
444
+ * @param {boolean} beforeSubmit - This function is being called from a `beforeSubmit` method.
443
445
  * @returns {Promise} - The promise that resolves when the subform is loaded.
444
446
  */
445
- loadSubForm(fromAttach) {
447
+ loadSubForm(fromAttach, beforeSubmit) {
446
448
  var _a, _b, _c, _d, _e;
447
- if (this.builderMode || this.conditionallyHidden || (this.isSubFormLazyLoad() && !fromAttach)) {
449
+ const loadHiddenForm = beforeSubmit && !this.component.clearOnHide;
450
+ if (this.builderMode || (this.conditionallyHidden && !loadHiddenForm) || (this.isSubFormLazyLoad() && !fromAttach)) {
448
451
  return Promise.resolve();
449
452
  }
450
453
  if (this.hasLoadedForm && !this.isRevisionChanged &&
@@ -516,7 +519,7 @@ class FormComponent extends Component_1.default {
516
519
  * @returns {*|boolean} - TRUE if the subform should be submitted, FALSE if it should not.
517
520
  */
518
521
  get shouldSubmit() {
519
- return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && !this.conditionallyHidden;
522
+ return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && (!this.conditionallyHidden || !this.component.clearOnHide);
520
523
  }
521
524
  /**
522
525
  * Returns the data for the subform.
@@ -587,8 +590,10 @@ class FormComponent extends Component_1.default {
587
590
  this.dataValue = submission;
588
591
  return Promise.resolve(this.dataValue);
589
592
  }
590
- if (this.isSubFormLazyLoad() && !this.subFormLoading) {
591
- return this.createSubForm(true)
593
+ // we need to load a hidden form (when clearOnHide is disabled) in order to get and submit (if needed) its data
594
+ const loadHiddenForm = !this.subForm && !this.component.clearOnHide;
595
+ if ((this.isSubFormLazyLoad() || loadHiddenForm) && !this.subFormLoading) {
596
+ return this.createSubForm(true, true)
592
597
  .then(this.submitSubForm(false))
593
598
  .then(() => {
594
599
  return this.dataValue;
@@ -5,4 +5,5 @@ import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
7
  import comp7 from './comp7';
8
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7 };
8
+ import comp8 from './comp8';
9
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
@@ -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.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.comp8 = exports.comp7 = exports.comp6 = 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"));
@@ -18,3 +18,5 @@ const comp6_1 = __importDefault(require("./comp6"));
18
18
  exports.comp6 = comp6_1.default;
19
19
  const comp7_1 = __importDefault(require("./comp7"));
20
20
  exports.comp7 = comp7_1.default;
21
+ const comp8_1 = __importDefault(require("./comp8"));
22
+ exports.comp8 = comp8_1.default;
@@ -4,4 +4,4 @@ import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
7
+ export { comp1, comp2, comp3, comp4, comp5, comp6 };
@@ -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.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
6
+ exports.comp6 = 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"));
@@ -16,7 +16,3 @@ const comp5_1 = __importDefault(require("./comp5"));
16
16
  exports.comp5 = comp5_1.default;
17
17
  const comp6_1 = __importDefault(require("./comp6"));
18
18
  exports.comp6 = comp6_1.default;
19
- const comp7_1 = __importDefault(require("./comp7"));
20
- exports.comp7 = comp7_1.default;
21
- const comp8_1 = __importDefault(require("./comp8"));
22
- exports.comp8 = comp8_1.default;
@@ -26,8 +26,8 @@ export const getBestMatch: typeof Utils.getBestMatch;
26
26
  export const getComponentFromPath: typeof Utils.getComponentFromPath;
27
27
  export const getComponentValue: typeof Utils.getComponentValue;
28
28
  export const findComponents: typeof Utils.findComponents;
29
- export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: any, parentPaths?: any) => Promise<void>;
30
- export const eachComponentData: (components: Component[], data: DataObject, fn: EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: any, parentPaths?: any) => void;
29
+ export const eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => Promise<void>;
30
+ export const eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => void;
31
31
  export const getComponentKey: typeof Utils.getComponentKey;
32
32
  export const getContextualRowPath: typeof Utils.getContextualRowPath;
33
33
  export const getContextualRowData: typeof Utils.getContextualRowData;
package/lib/mjs/Embed.js CHANGED
@@ -14,7 +14,7 @@ export class Formio {
14
14
  Formio._formioReady = ready;
15
15
  Formio._formioReadyReject = reject;
16
16
  });
17
- static version = '5.1.0-rc.17';
17
+ static version = '5.1.0-rc.19';
18
18
  static setLicense(license, norecurse = false) {
19
19
  Formio.license = license;
20
20
  if (!norecurse && Formio.FormioClass) {
package/lib/mjs/Formio.js CHANGED
@@ -4,7 +4,7 @@ import CDN from './CDN';
4
4
  import Providers from './providers';
5
5
  FormioCore.cdn = new CDN();
6
6
  FormioCore.Providers = Providers;
7
- FormioCore.version = '5.1.0-rc.17';
7
+ FormioCore.version = '5.1.0-rc.19';
8
8
  CDN.defaultCDN = FormioCore.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
9
9
  const isNil = (val) => val === null || val === undefined;
10
10
  FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
@@ -294,7 +294,7 @@ export default class PDFBuilder extends WebformBuilder {
294
294
  height: schema.height,
295
295
  width: schema.width
296
296
  };
297
- if (!this.options.noNewEdit && !component.component.noNewEdit) {
297
+ if (!this.options.noNewEdit && !component.component.noNewEdit && this.hasEditTabs(component.type)) {
298
298
  this.editComponent(component.component, this.getParentContainer(component), isNew);
299
299
  }
300
300
  this.emit('updateComponent', component.component);
@@ -318,7 +318,7 @@ export default class PDFBuilder extends WebformBuilder {
318
318
  });
319
319
  this.webform.on('iframe-componentClick', schema => {
320
320
  const component = this.webform.getComponentById(schema.id);
321
- if (component) {
321
+ if (component && this.hasEditTabs(component.type)) {
322
322
  this.editComponent(component.component, this.getParentContainer(component));
323
323
  }
324
324
  }, true);
@@ -123,6 +123,7 @@ export default class WebformBuilder extends Component {
123
123
  addBuilderGroup(name: any, group: any): void;
124
124
  updateBuilderGroup(name: any, group: any): void;
125
125
  generateKey(info: any): any;
126
+ hasEditTabs(type: any): boolean;
126
127
  }
127
128
  import Component from './components/_classes/component/Component';
128
129
  import Webform from './Webform';
@@ -115,7 +115,9 @@ export default class WebformBuilder extends Component {
115
115
  html,
116
116
  disableBuilderActions: self?.component?.disableBuilderActions,
117
117
  childComponent: component,
118
- design: self?.options?.design
118
+ design: self?.options?.design,
119
+ editJson: self?.options?.editJson,
120
+ editComponent: this.hasEditTabs(component.type)
119
121
  });
120
122
  };
121
123
  this.options.hooks.renderComponents = (html, { components, self }) => {
@@ -852,7 +854,11 @@ export default class WebformBuilder extends Component {
852
854
  parent.addChildComponent(info, element, target, source, sibling);
853
855
  }
854
856
  const componentInDataGrid = parent.type === 'datagrid';
855
- if (isNew && !this.options.noNewEdit && !info.noNewEdit && !(this.options.design && info.type === 'reviewpage')) {
857
+ if (isNew
858
+ && !this.options.noNewEdit
859
+ && !info.noNewEdit
860
+ && this.hasEditTabs(info.type)
861
+ && !(this.options.design && info.type === 'reviewpage')) {
856
862
  this.editComponent(info, target, isNew, null, null, { inDataGrid: componentInDataGrid });
857
863
  }
858
864
  // Only rebuild the parts needing to be rebuilt.
@@ -1630,4 +1636,9 @@ export default class WebformBuilder extends Component {
1630
1636
  info.placeholder ||
1631
1637
  info.type);
1632
1638
  }
1639
+ hasEditTabs(type) {
1640
+ const editTabs = getComponent(Components.components[type].editForm().components, 'tabs', true).components;
1641
+ const hiddenEditTabs = _.filter(_.get(this.options, `editForm.${type}`, []), 'ignore');
1642
+ return _.intersectionBy(editTabs, hiddenEditTabs, 'key').length !== editTabs.length;
1643
+ }
1633
1644
  }
@@ -1,4 +1,14 @@
1
1
  declare namespace _default {
2
- let components: any[];
2
+ let components: {
3
+ label: string;
4
+ inputType: string;
5
+ tableView: boolean;
6
+ defaultValue: boolean;
7
+ key: string;
8
+ type: string;
9
+ name: string;
10
+ value: string;
11
+ input: boolean;
12
+ }[];
3
13
  }
4
14
  export default _default;
@@ -1,4 +1,4 @@
1
- import comp from '../checkbox/comp2';
1
+ import comp from '../../../checkbox/fixtures/comp2';
2
2
  export default {
3
3
  components: [
4
4
  { ...comp },
@@ -11,4 +11,4 @@ import comp11 from './comp11';
11
11
  import comp12 from './comp12';
12
12
  import comp13 from './comp13';
13
13
  import requiredFieldLogicComp from './requiredFieldLogicComp';
14
- export { comp1, comp2, comp3, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, requiredFieldLogicComp };
14
+ export { comp1, comp2, comp3, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, requiredFieldLogicComp };
@@ -10,6 +10,5 @@ import comp10 from './comp10';
10
10
  import comp11 from './comp11';
11
11
  import comp12 from './comp12';
12
12
  import comp13 from './comp13';
13
- import comp14 from './comp14';
14
13
  import requiredFieldLogicComp from './requiredFieldLogicComp';
15
- export { comp1, comp2, comp3, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, requiredFieldLogicComp };
14
+ export { comp1, comp2, comp3, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, requiredFieldLogicComp };
@@ -20,4 +20,4 @@ import comp20 from './comp20';
20
20
  import compOpenWhenEmpty from './comp-openWhenEmpty';
21
21
  import withOpenWhenEmptyAndConditions from './comp-with-conditions-and-openWhenEmpty';
22
22
  import compWithCustomDefaultValue from './comp-with-custom-default-value';
23
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
23
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp18, comp19, comp20, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue };
@@ -14,12 +14,10 @@ import comp13 from './comp13';
14
14
  import comp14 from './comp14';
15
15
  import comp15 from './comp15';
16
16
  import comp16 from './comp16';
17
- import comp17 from './comp17';
18
17
  import comp18 from './comp18';
19
18
  import comp19 from './comp19';
20
19
  import comp20 from './comp20';
21
20
  import withOpenWhenEmptyAndConditions from './comp-with-conditions-and-openWhenEmpty';
22
21
  import compOpenWhenEmpty from './comp-openWhenEmpty';
23
22
  import compWithCustomDefaultValue from './comp-with-custom-default-value';
24
- import compTestEvents from './comp-test-events';
25
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
23
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp18, comp19, comp20, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue };
@@ -45,16 +45,18 @@ export default class FormComponent extends Component {
45
45
  /**
46
46
  * Create a subform instance.
47
47
  * @param {boolean} [fromAttach] - This function is being called from an `attach` method.
48
+ * @param {boolean} [beforeSubmit] - This function is being called from a `beforeSubmit` method.
48
49
  * @returns {*} - The subform instance.
49
50
  */
50
- createSubForm(fromAttach?: boolean | undefined): any;
51
+ createSubForm(fromAttach?: boolean | undefined, beforeSubmit?: boolean | undefined): any;
51
52
  hideSubmitButton(component: any): void;
52
53
  /**
53
54
  * Load the subform.
54
55
  * @param {boolean} fromAttach - This function is being called from an `attach` method.
56
+ * @param {boolean} beforeSubmit - This function is being called from a `beforeSubmit` method.
55
57
  * @returns {Promise} - The promise that resolves when the subform is loaded.
56
58
  */
57
- loadSubForm(fromAttach: boolean): Promise<any>;
59
+ loadSubForm(fromAttach: boolean, beforeSubmit: boolean): Promise<any>;
58
60
  subFormLoading: boolean | undefined;
59
61
  checkComponentConditions(data: any, flags: any, row: any): any;
60
62
  calculateValue(data: any, flags: any, row: any): any;
@@ -375,10 +375,11 @@ export default class FormComponent extends Component {
375
375
  /**
376
376
  * Create a subform instance.
377
377
  * @param {boolean} [fromAttach] - This function is being called from an `attach` method.
378
+ * @param {boolean} [beforeSubmit] - This function is being called from a `beforeSubmit` method.
378
379
  * @returns {*} - The subform instance.
379
380
  */
380
- createSubForm(fromAttach) {
381
- this.subFormReady = this.loadSubForm(fromAttach).then((form) => {
381
+ createSubForm(fromAttach, beforeSubmit) {
382
+ this.subFormReady = this.loadSubForm(fromAttach, beforeSubmit).then((form) => {
382
383
  if (!form) {
383
384
  return;
384
385
  }
@@ -435,10 +436,12 @@ export default class FormComponent extends Component {
435
436
  /**
436
437
  * Load the subform.
437
438
  * @param {boolean} fromAttach - This function is being called from an `attach` method.
439
+ * @param {boolean} beforeSubmit - This function is being called from a `beforeSubmit` method.
438
440
  * @returns {Promise} - The promise that resolves when the subform is loaded.
439
441
  */
440
- loadSubForm(fromAttach) {
441
- if (this.builderMode || this.conditionallyHidden || (this.isSubFormLazyLoad() && !fromAttach)) {
442
+ loadSubForm(fromAttach, beforeSubmit) {
443
+ const loadHiddenForm = beforeSubmit && !this.component.clearOnHide;
444
+ if (this.builderMode || (this.conditionallyHidden && !loadHiddenForm) || (this.isSubFormLazyLoad() && !fromAttach)) {
442
445
  return Promise.resolve();
443
446
  }
444
447
  if (this.hasLoadedForm && !this.isRevisionChanged &&
@@ -510,7 +513,7 @@ export default class FormComponent extends Component {
510
513
  * @returns {*|boolean} - TRUE if the subform should be submitted, FALSE if it should not.
511
514
  */
512
515
  get shouldSubmit() {
513
- return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && !this.conditionallyHidden;
516
+ return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && (!this.conditionallyHidden || !this.component.clearOnHide);
514
517
  }
515
518
  /**
516
519
  * Returns the data for the subform.
@@ -580,8 +583,10 @@ export default class FormComponent extends Component {
580
583
  this.dataValue = submission;
581
584
  return Promise.resolve(this.dataValue);
582
585
  }
583
- if (this.isSubFormLazyLoad() && !this.subFormLoading) {
584
- return this.createSubForm(true)
586
+ // we need to load a hidden form (when clearOnHide is disabled) in order to get and submit (if needed) its data
587
+ const loadHiddenForm = !this.subForm && !this.component.clearOnHide;
588
+ if ((this.isSubFormLazyLoad() || loadHiddenForm) && !this.subFormLoading) {
589
+ return this.createSubForm(true, true)
585
590
  .then(this.submitSubForm(false))
586
591
  .then(() => {
587
592
  return this.dataValue;
@@ -5,4 +5,5 @@ import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
7
  import comp7 from './comp7';
8
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7 };
8
+ import comp8 from './comp8';
9
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
@@ -5,4 +5,5 @@ import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
7
  import comp7 from './comp7';
8
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7 };
8
+ import comp8 from './comp8';
9
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
@@ -4,4 +4,4 @@ import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
7
+ export { comp1, comp2, comp3, comp4, comp5, comp6 };
@@ -4,6 +4,4 @@ import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
- import comp7 from './comp7';
8
- import comp8 from './comp8';
9
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8 };
7
+ export { comp1, comp2, comp3, comp4, comp5, comp6 };
@@ -26,8 +26,8 @@ export const getBestMatch: typeof Utils.getBestMatch;
26
26
  export const getComponentFromPath: typeof Utils.getComponentFromPath;
27
27
  export const getComponentValue: typeof Utils.getComponentValue;
28
28
  export const findComponents: typeof Utils.findComponents;
29
- export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: any, parentPaths?: any) => Promise<void>;
30
- export const eachComponentData: (components: Component[], data: DataObject, fn: EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: any, parentPaths?: any) => void;
29
+ export const eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => Promise<void>;
30
+ export const eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => void;
31
31
  export const getComponentKey: typeof Utils.getComponentKey;
32
32
  export const getContextualRowPath: typeof Utils.getContextualRowPath;
33
33
  export const getContextualRowData: typeof Utils.getContextualRowData;