@formio/js 5.2.1-rc.6 → 5.2.1-rc.8

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.4 | (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.4/LICENSE */
22
22
 
23
- /*! formiojs v5.2.1-rc.6 | https://unpkg.com/formiojs@5.2.1-rc.6/LICENSE.txt */
23
+ /*! formiojs v5.2.1-rc.8 | https://unpkg.com/formiojs@5.2.1-rc.8/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.2.1-rc.6';
421
+ Formio.version = '5.2.1-rc.8';
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.2.1-rc.6';
14
+ sdk_1.Formio.version = '5.2.1-rc.8';
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) {
@@ -351,6 +351,11 @@ class Webform extends NestedDataComponent_1.default {
351
351
  get shadowRoot() {
352
352
  return this.options.shadowRoot;
353
353
  }
354
+ // Webforms have no default value setting, so this should be always false
355
+ // I does not affect setting default value to nested forms
356
+ get shouldAddDefaultValue() {
357
+ return false;
358
+ }
354
359
  get componentsMap() {
355
360
  return this.childComponentsMap || {};
356
361
  }
@@ -83,8 +83,16 @@ class WebformBuilder extends Component_1.default {
83
83
  }
84
84
  this.groupOrder = this.groupOrder
85
85
  .filter(group => group && !group.ignore)
86
- .sort((a, b) => a.weight - b.weight)
87
- .map(group => group.key);
86
+ .sort((a, b) => a.weight - b.weight);
87
+ const defaultOpenedGroup = this.groupOrder.find(x => x.key !== 'basic' && x.default);
88
+ if (defaultOpenedGroup) {
89
+ this.groupOrder.forEach(x => {
90
+ if ('default' in x && x.key !== defaultOpenedGroup.key) {
91
+ x.default = false;
92
+ }
93
+ });
94
+ }
95
+ this.groupOrder = this.groupOrder.map(group => group.key);
88
96
  for (const type in Components_1.default.components) {
89
97
  const component = Components_1.default.components[type];
90
98
  if (component.builderInfo && component.builderInfo.schema) {
@@ -1100,7 +1108,7 @@ class WebformBuilder extends Component_1.default {
1100
1108
  const newComp = parentComponent.addComponent(defaultValueComponent.component, defaultValueComponent.data, sibling);
1101
1109
  lodash_1.default.pull(newComp.validators, 'required');
1102
1110
  parentComponent.tabs[tabIndex].splice(index, 1, newComp);
1103
- newComp.checkValidity = () => true;
1111
+ newComp.processOwnValidation = true;
1104
1112
  newComp.build(defaultValueComponent.element);
1105
1113
  if (this.preview && !this.preview.defaultChanged) {
1106
1114
  const defaultValue = lodash_1.default.get(this.preview._data, this.editForm._data.key);
package/lib/cjs/Wizard.js CHANGED
@@ -821,6 +821,11 @@ class Wizard extends Webform_1.default {
821
821
  }
822
822
  }
823
823
  setValue(submission, flags = {}, ignoreEstablishment) {
824
+ if (!submission || !submission.data) {
825
+ submission = {
826
+ data: {},
827
+ };
828
+ }
824
829
  const changed = this.getPages({ all: true }).reduce((changed, page) => {
825
830
  return this.setNestedValue(page, submission.data, flags, changed) || changed;
826
831
  }, false);
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.2.1-rc.6';
17
+ static version = '5.2.1-rc.8';
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.2.1-rc.6';
7
+ FormioCore.version = '5.2.1-rc.8';
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) {
@@ -323,6 +323,11 @@ export default class Webform extends NestedDataComponent {
323
323
  get shadowRoot() {
324
324
  return this.options.shadowRoot;
325
325
  }
326
+ // Webforms have no default value setting, so this should be always false
327
+ // I does not affect setting default value to nested forms
328
+ get shouldAddDefaultValue() {
329
+ return false;
330
+ }
326
331
  get componentsMap() {
327
332
  return this.childComponentsMap || {};
328
333
  }
@@ -63,8 +63,16 @@ export default class WebformBuilder extends Component {
63
63
  }
64
64
  this.groupOrder = this.groupOrder
65
65
  .filter(group => group && !group.ignore)
66
- .sort((a, b) => a.weight - b.weight)
67
- .map(group => group.key);
66
+ .sort((a, b) => a.weight - b.weight);
67
+ const defaultOpenedGroup = this.groupOrder.find(x => x.key !== 'basic' && x.default);
68
+ if (defaultOpenedGroup) {
69
+ this.groupOrder.forEach(x => {
70
+ if ('default' in x && x.key !== defaultOpenedGroup.key) {
71
+ x.default = false;
72
+ }
73
+ });
74
+ }
75
+ this.groupOrder = this.groupOrder.map(group => group.key);
68
76
  for (const type in Components.components) {
69
77
  const component = Components.components[type];
70
78
  if (component.builderInfo && component.builderInfo.schema) {
@@ -1084,7 +1092,7 @@ export default class WebformBuilder extends Component {
1084
1092
  const newComp = parentComponent.addComponent(defaultValueComponent.component, defaultValueComponent.data, sibling);
1085
1093
  _.pull(newComp.validators, 'required');
1086
1094
  parentComponent.tabs[tabIndex].splice(index, 1, newComp);
1087
- newComp.checkValidity = () => true;
1095
+ newComp.processOwnValidation = true;
1088
1096
  newComp.build(defaultValueComponent.element);
1089
1097
  if (this.preview && !this.preview.defaultChanged) {
1090
1098
  const defaultValue = _.get(this.preview._data, this.editForm._data.key);
package/lib/mjs/Wizard.js CHANGED
@@ -810,6 +810,11 @@ export default class Wizard extends Webform {
810
810
  }
811
811
  }
812
812
  setValue(submission, flags = {}, ignoreEstablishment) {
813
+ if (!submission || !submission.data) {
814
+ submission = {
815
+ data: {},
816
+ };
817
+ }
813
818
  const changed = this.getPages({ all: true }).reduce((changed, page) => {
814
819
  return this.setNestedValue(page, submission.data, flags, changed) || changed;
815
820
  }, false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.2.1-rc.6",
3
+ "version": "5.2.1-rc.8",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -79,8 +79,8 @@
79
79
  },
80
80
  "homepage": "https://github.com/formio/formio.js#readme",
81
81
  "dependencies": {
82
- "@formio/bootstrap": "3.1.2-rc.2",
83
- "@formio/core": "2.5.1-rc.6",
82
+ "@formio/bootstrap": "3.1.2-rc.3",
83
+ "@formio/core": "2.5.1-rc.7",
84
84
  "@formio/text-mask-addons": "^3.8.0-formio.4",
85
85
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
86
86
  "abortcontroller-polyfill": "^1.7.5",