@formio/js 5.1.0-rc.21 → 5.1.0-rc.23

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 (40) 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 +54 -32
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +2 -2
  7. package/dist/formio.full.js +55 -33
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +2 -2
  10. package/dist/formio.js +3 -3
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.min.js.LICENSE.txt +2 -2
  13. package/dist/formio.utils.js +1 -1
  14. package/dist/formio.utils.min.js +1 -1
  15. package/dist/formio.utils.min.js.LICENSE.txt +2 -2
  16. package/lib/cjs/Embed.js +1 -1
  17. package/lib/cjs/Formio.js +1 -1
  18. package/lib/cjs/WebformBuilder.js +1 -1
  19. package/lib/cjs/components/_classes/component/Component.d.ts +4 -15
  20. package/lib/cjs/components/_classes/component/Component.js +35 -57
  21. package/lib/cjs/components/_classes/nested/NestedComponent.js +3 -7
  22. package/lib/cjs/components/datamap/DataMap.js +2 -6
  23. package/lib/cjs/components/editgrid/EditGrid.js +0 -4
  24. package/lib/cjs/components/form/Form.js +7 -11
  25. package/lib/cjs/components/html/HTML.js +1 -2
  26. package/lib/cjs/components/radio/Radio.js +1 -1
  27. package/lib/cjs/components/tabs/Tabs.js +1 -0
  28. package/lib/mjs/Embed.js +1 -1
  29. package/lib/mjs/Formio.js +1 -1
  30. package/lib/mjs/WebformBuilder.js +1 -1
  31. package/lib/mjs/components/_classes/component/Component.d.ts +4 -15
  32. package/lib/mjs/components/_classes/component/Component.js +35 -57
  33. package/lib/mjs/components/_classes/nested/NestedComponent.js +3 -7
  34. package/lib/mjs/components/datamap/DataMap.js +2 -6
  35. package/lib/mjs/components/editgrid/EditGrid.js +0 -4
  36. package/lib/mjs/components/form/Form.js +7 -11
  37. package/lib/mjs/components/html/HTML.js +1 -2
  38. package/lib/mjs/components/radio/Radio.js +1 -1
  39. package/lib/mjs/components/tabs/Tabs.js +1 -0
  40. package/package.json +3 -3
@@ -18,9 +18,9 @@
18
18
  * MIT licensed
19
19
  */
20
20
 
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 */
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.1.0-rc.21 | https://unpkg.com/formiojs@5.1.0-rc.21/LICENSE.txt */
23
+ /*! formiojs v5.1.0-rc.23 | https://unpkg.com/formiojs@5.1.0-rc.23/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.21';
421
+ Formio.version = '5.1.0-rc.23';
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.21';
14
+ sdk_1.Formio.version = '5.1.0-rc.23';
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) {
@@ -1634,7 +1634,7 @@ class WebformBuilder extends Component_1.default {
1634
1634
  info.type);
1635
1635
  }
1636
1636
  hasEditTabs(type) {
1637
- const editTabs = (0, formUtils_1.getComponent)(Components_1.default.components[type].editForm().components, 'tabs', true).components;
1637
+ const editTabs = (0, formUtils_1.getComponent)(Components_1.default.components[type === 'custom' ? 'unknown' : type].editForm().components, 'tabs', true).components;
1638
1638
  const hiddenEditTabs = lodash_1.default.filter(lodash_1.default.get(this.options, `editForm.${type}`, []), 'ignore');
1639
1639
  return lodash_1.default.intersectionBy(editTabs, hiddenEditTabs, 'key').length !== editTabs.length;
1640
1640
  }
@@ -119,13 +119,6 @@ declare class Component extends Element {
119
119
  */
120
120
  paths: import('@formio/core').ComponentPaths;
121
121
  _path: string;
122
- /**
123
- * Determines if this component is conditionally hidden. Should generally not be set outside of conditional logic pipeline.
124
- * This is necessary because of clearOnHide behavior that only clears when conditionally hidden - we need to track
125
- * conditionallyHidden separately from "regular" visibility.
126
- */
127
- _parentConditionallyHidden: any;
128
- _conditionallyHidden: any;
129
122
  /**
130
123
  * Determines if this component is visible, or not.
131
124
  */
@@ -170,6 +163,7 @@ declare class Component extends Element {
170
163
  */
171
164
  info: any;
172
165
  get componentsMap(): object;
166
+ parentConditionallyHidden(): boolean;
173
167
  set data(value: any);
174
168
  get data(): any;
175
169
  mergeSchema(component?: {}): any;
@@ -231,14 +225,9 @@ declare class Component extends Element {
231
225
  * @returns {boolean} - Whether the component is visible or not.
232
226
  */
233
227
  get visible(): boolean;
234
- get conditionallyHidden(): any;
235
- /**
236
- * Evaluates whether the component is conditionally hidden (as opposed to intentionally hidden, e.g. via the `hidden` component schema property).
237
- * @param {object} data - The data object to evaluate the condition against.
238
- * @param {object} row - The row object to evaluate the condition against.
239
- * @returns {boolean} - Whether the component is conditionally hidden.
240
- */
241
- checkConditionallyHidden(data?: object, row?: object): boolean;
228
+ get logicallyHidden(): any;
229
+ _logicallyHidden: any;
230
+ conditionallyHidden(skipParent?: boolean): any;
242
231
  set currentForm(instance: any);
243
232
  get currentForm(): any;
244
233
  _currentForm: any;
@@ -341,18 +341,11 @@ class Component extends Element_1.default {
341
341
  this._path = '';
342
342
  // Needs for Nextgen Rules Engine
343
343
  this.resetCaches();
344
- /**
345
- * Determines if this component is conditionally hidden. Should generally not be set outside of conditional logic pipeline.
346
- * This is necessary because of clearOnHide behavior that only clears when conditionally hidden - we need to track
347
- * conditionallyHidden separately from "regular" visibility.
348
- */
349
- this._parentConditionallyHidden = this.options.hasOwnProperty('parentConditionallyHidden') ? this.options.parentConditionallyHidden : false;
350
- this._conditionallyHidden = this.checkConditionallyHidden(null, data) || this._parentConditionallyHidden;
351
344
  /**
352
345
  * Determines if this component is visible, or not.
353
346
  */
354
347
  this._parentVisible = this.options.hasOwnProperty('parentVisible') ? this.options.parentVisible : true;
355
- this._visible = this._parentVisible && (this.hasCondition() ? !this._conditionallyHidden : !this.component.hidden);
348
+ this._visible = this._parentVisible && (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
356
349
  this._parentDisabled = false;
357
350
  /**
358
351
  * The reference attribute name for this component
@@ -421,7 +414,7 @@ class Component extends Element_1.default {
421
414
  if (this.allowData && this.key) {
422
415
  this.options.name += `[${this.key}]`;
423
416
  // If component is visible or not set to clear on hide, set the default value.
424
- if (!(this.conditionallyHidden && this.component.clearOnHide)) {
417
+ if (!(this.conditionallyHidden() && this.component.clearOnHide)) {
425
418
  if (!this.hasValue()) {
426
419
  if (this.shouldAddDefaultValue) {
427
420
  this.dataValue = this.defaultValue;
@@ -452,6 +445,16 @@ class Component extends Element_1.default {
452
445
  var _a;
453
446
  return ((_a = this.root) === null || _a === void 0 ? void 0 : _a.childComponentsMap) || {};
454
447
  }
448
+ parentConditionallyHidden() {
449
+ let currentParent = this.parent;
450
+ while (currentParent) {
451
+ if (currentParent.conditionallyHidden(true)) {
452
+ return true;
453
+ }
454
+ currentParent = currentParent.parent;
455
+ }
456
+ return false;
457
+ }
455
458
  get data() {
456
459
  return this._data;
457
460
  }
@@ -492,8 +495,7 @@ class Component extends Element_1.default {
492
495
  init() {
493
496
  var _a;
494
497
  this.disabled = this.shouldDisabled;
495
- this._conditionallyHidden = this.checkConditionallyHidden();
496
- this._visible = (this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden);
498
+ this._visible = (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
497
499
  if ((_a = this.component.addons) === null || _a === void 0 ? void 0 : _a.length) {
498
500
  this.component.addons.forEach((addon) => this.createAddon(addon));
499
501
  }
@@ -655,20 +657,17 @@ class Component extends Element_1.default {
655
657
  }
656
658
  return this._visible && this._parentVisible;
657
659
  }
658
- get conditionallyHidden() {
659
- return this._conditionallyHidden || this._parentConditionallyHidden;
660
+ get logicallyHidden() {
661
+ if (this._logicallyHidden && !this.component.hidden) {
662
+ this._logicallyHidden = false;
663
+ }
664
+ return this._logicallyHidden;
660
665
  }
661
- /**
662
- * Evaluates whether the component is conditionally hidden (as opposed to intentionally hidden, e.g. via the `hidden` component schema property).
663
- * @param {object} data - The data object to evaluate the condition against.
664
- * @param {object} row - The row object to evaluate the condition against.
665
- * @returns {boolean} - Whether the component is conditionally hidden.
666
- */
667
- checkConditionallyHidden(data = null, row = null) {
666
+ conditionallyHidden(skipParent = false) {
668
667
  if (!this.hasCondition()) {
669
- return false;
668
+ return this.logicallyHidden || (skipParent ? false : this.parentConditionallyHidden());
670
669
  }
671
- return !this.conditionallyVisible(data, row);
670
+ return !this.conditionallyVisible() || this.logicallyHidden || (skipParent ? false : this.parentConditionallyHidden());
672
671
  }
673
672
  get currentForm() {
674
673
  return this._currentForm;
@@ -1838,7 +1837,7 @@ class Component extends Element_1.default {
1838
1837
  rebuild() {
1839
1838
  this.destroy();
1840
1839
  this.init();
1841
- this.visible = this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden;
1840
+ this.visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
1842
1841
  return this.redraw();
1843
1842
  }
1844
1843
  /**
@@ -1936,23 +1935,12 @@ class Component extends Element_1.default {
1936
1935
  if (!this.builderMode & !this.previewMode && this.fieldLogic(data, row)) {
1937
1936
  this.redraw();
1938
1937
  }
1939
- // Check advanced conditions (and cache the result)
1940
- const isConditionallyHidden = this.checkConditionallyHidden(data, row) || this._parentConditionallyHidden;
1941
- let shouldClear = false;
1942
- if (isConditionallyHidden !== this._conditionallyHidden) {
1943
- this._conditionallyHidden = isConditionallyHidden;
1944
- shouldClear = true;
1945
- }
1946
1938
  // Check visibility
1947
- const visible = (this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden);
1939
+ const visible = (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
1948
1940
  if (this.visible !== visible) {
1949
1941
  this.visible = visible;
1950
1942
  }
1951
- // Wait for visibility to update for nested components, so the component state is up-to-date when
1952
- // calling clearOnHide
1953
- if (shouldClear) {
1954
- this.clearOnHide();
1955
- }
1943
+ this.clearOnHide();
1956
1944
  return visible;
1957
1945
  }
1958
1946
  /**
@@ -2061,9 +2049,9 @@ class Component extends Element_1.default {
2061
2049
  if (!lodash_1.default.isEqual(lodash_1.default.get(this.component, property), lodash_1.default.get(newComponent, property))) {
2062
2050
  // Advanced Logic can modify the component's hidden property; because we track conditionally hidden state
2063
2051
  // separately from the component's hidden property, and technically this Advanced Logic conditionally hides
2064
- // a component, we need to set _conditionallyHidden to the new value
2052
+ // a component, we need to set a temporary variable to the new value
2065
2053
  if (property === 'hidden') {
2066
- this._conditionallyHidden = newComponent.hidden;
2054
+ this._logicallyHidden = newComponent.hidden;
2067
2055
  }
2068
2056
  changed = true;
2069
2057
  }
@@ -2078,7 +2066,7 @@ class Component extends Element_1.default {
2078
2066
  component: newComponent,
2079
2067
  result,
2080
2068
  });
2081
- if (!lodash_1.default.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden)) {
2069
+ if (!lodash_1.default.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden())) {
2082
2070
  this.setValue(newValue);
2083
2071
  if (this.viewOnly) {
2084
2072
  this.dataValue = newValue;
@@ -2111,7 +2099,7 @@ class Component extends Element_1.default {
2111
2099
  component: newComponent,
2112
2100
  result,
2113
2101
  }, 'value');
2114
- if (!lodash_1.default.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden)) {
2102
+ if (!lodash_1.default.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden())) {
2115
2103
  this.setValue(newValue);
2116
2104
  if (this.viewOnly) {
2117
2105
  this.dataValue = newValue;
@@ -2222,7 +2210,7 @@ class Component extends Element_1.default {
2222
2210
  this.component.clearOnHide !== false &&
2223
2211
  !this.options.readOnly &&
2224
2212
  !this.options.showHiddenFields) {
2225
- if (this.conditionallyHidden) {
2213
+ if (this.conditionallyHidden()) {
2226
2214
  this.deleteValue();
2227
2215
  }
2228
2216
  else if (!this.hasValue() && this.shouldAddDefaultValue) {
@@ -2471,27 +2459,17 @@ class Component extends Element_1.default {
2471
2459
  * @returns {*} - The value for this component.
2472
2460
  */
2473
2461
  get dataValue() {
2474
- if (!this.key ||
2475
- (this.conditionallyHidden && this.component.clearOnHide && !this.rootPristine)) {
2476
- return this.emptyValue;
2477
- }
2478
- if (!this.hasValue() && this.shouldAddDefaultValue) {
2479
- const empty = this.component.multiple ? [] : this.emptyValue;
2480
- if (!this.rootPristine) {
2481
- this.dataValue = empty;
2482
- }
2483
- return empty;
2462
+ if (!this.key) {
2463
+ return this.component.multiple ? [] : this.emptyValue;
2484
2464
  }
2485
- return lodash_1.default.get(this._data, this.key);
2465
+ return lodash_1.default.get(this._data, this.key, this.component.multiple ? [] : this.emptyValue);
2486
2466
  }
2487
2467
  /**
2488
2468
  * Sets the static value of this component.
2489
2469
  * @param {*} value - The value to set for this component.
2490
2470
  */
2491
2471
  set dataValue(value) {
2492
- if (!this.allowData ||
2493
- !this.key ||
2494
- (this.conditionallyHidden && this.component.clearOnHide && !this.rootPristine)) {
2472
+ if (!this.allowData || !this.key) {
2495
2473
  return;
2496
2474
  }
2497
2475
  if ((value !== null) && (value !== undefined)) {
@@ -2812,7 +2790,7 @@ class Component extends Element_1.default {
2812
2790
  // If no calculated value or
2813
2791
  // hidden and set to clearOnHide (Don't calculate a value for a hidden field set to clear when hidden)
2814
2792
  const { clearOnHide } = this.component;
2815
- const shouldBeCleared = this.conditionallyHidden && clearOnHide;
2793
+ const shouldBeCleared = this.conditionallyHidden() && clearOnHide;
2816
2794
  const allowOverride = lodash_1.default.get(this.component, 'allowCalculateOverride', false);
2817
2795
  if (shouldBeCleared) {
2818
2796
  // remove calculated value so that the value is recalculated once component becomes visible
@@ -3462,7 +3440,7 @@ class Component extends Element_1.default {
3462
3440
  // If component definition changed, replace it.
3463
3441
  if (!lodash_1.default.isEqual(this.component, newComponent)) {
3464
3442
  this.component = newComponent;
3465
- const visible = this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden;
3443
+ const visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
3466
3444
  const disabled = this.shouldDisabled;
3467
3445
  // Change states which won't be recalculated during redrawing
3468
3446
  if (this.visible !== visible) {
@@ -85,18 +85,15 @@ class NestedComponent extends Field_1.default {
85
85
  const visibilityChanged = this._visible !== value;
86
86
  this._visible = value;
87
87
  const isVisible = this.visible;
88
- const isConditionallyHidden = this.checkConditionallyHidden();
89
88
  const forceShow = this.shouldForceShow();
90
89
  const forceHide = this.shouldForceHide();
91
90
  this.components.forEach((component) => {
92
91
  // Set the parent visibility first since we may have nested components within nested components
93
92
  // and they need to be able to determine their visibility based on the parent visibility.
94
93
  component.parentVisible = isVisible;
95
- component._parentConditionallyHidden = isConditionallyHidden;
96
94
  let visible;
97
95
  if (component.hasCondition()) {
98
- component._conditionallyHidden = component.checkConditionallyHidden() || component._parentConditionallyHidden;
99
- visible = !component.conditionallyHidden;
96
+ visible = !component.conditionallyHidden();
100
97
  }
101
98
  else {
102
99
  visible = !component.component.hidden;
@@ -377,7 +374,6 @@ class NestedComponent extends Field_1.default {
377
374
  data = data || this.data;
378
375
  options.parent = this;
379
376
  options.parentVisible = this.visible;
380
- options.parentConditionallyHidden = this.conditionallyHidden;
381
377
  options.root = (options === null || options === void 0 ? void 0 : options.root) || this.root || this;
382
378
  options.localRoot = this.localRoot;
383
379
  options.skipInit = true;
@@ -636,7 +632,7 @@ class NestedComponent extends Field_1.default {
636
632
  clearOnHide(show) {
637
633
  super.clearOnHide(show);
638
634
  if (this.component.clearOnHide) {
639
- if (this.allowData && !this.hasValue() && !this.conditionallyHidden) {
635
+ if (this.allowData && !this.hasValue() && !this.conditionallyHidden()) {
640
636
  this.dataValue = this.defaultValue;
641
637
  }
642
638
  if (this.hasValue()) {
@@ -665,7 +661,7 @@ class NestedComponent extends Field_1.default {
665
661
  }
666
662
  calculateValue(data, flags, row) {
667
663
  // Do not iterate into children and calculateValues if this nested component is conditionally hidden.
668
- if (this.conditionallyHidden) {
664
+ if (this.conditionallyHidden()) {
669
665
  return false;
670
666
  }
671
667
  return this.getComponents().reduce((changed, comp) => comp.calculateValue(data, flags, row) || changed, super.calculateValue(data, flags, row));
@@ -73,14 +73,10 @@ class DataMapComponent extends DataGrid_1.default {
73
73
  return {};
74
74
  }
75
75
  get dataValue() {
76
- if (!this.key ||
77
- (this.conditionallyHidden && this.component.clearOnHide)) {
76
+ if (!this.key) {
78
77
  return this.emptyValue;
79
78
  }
80
- if (!this.hasValue() && this.shouldAddDefaultValue) {
81
- this.dataValue = this.emptyValue;
82
- }
83
- return lodash_1.default.get(this.data, this.key);
79
+ return lodash_1.default.get(this.data, this.key, this.emptyValue);
84
80
  }
85
81
  set dataValue(value) {
86
82
  super.dataValue = value;
@@ -1141,9 +1141,6 @@ class EditGridComponent extends NestedArrayComponent_1.default {
1141
1141
  }
1142
1142
  }
1143
1143
  const changed = this.hasChanged(value, this.dataValue);
1144
- if (this.parent) {
1145
- this.parent.checkComponentConditions();
1146
- }
1147
1144
  this.dataValue = value;
1148
1145
  // Refresh editRow data when data changes.
1149
1146
  this.dataValue.forEach((row, rowIndex) => {
@@ -1174,7 +1171,6 @@ class EditGridComponent extends NestedArrayComponent_1.default {
1174
1171
  this.editRows = this.editRows.slice(0, dataLength);
1175
1172
  this.openWhenEmpty();
1176
1173
  this.updateOnChange(flags, changed);
1177
- this.checkData();
1178
1174
  this.changeState(changed, flags);
1179
1175
  return changed;
1180
1176
  }
@@ -447,7 +447,7 @@ class FormComponent extends Component_1.default {
447
447
  loadSubForm(fromAttach, beforeSubmit) {
448
448
  var _a, _b, _c, _d, _e;
449
449
  const loadHiddenForm = beforeSubmit && !this.component.clearOnHide;
450
- if (this.builderMode || (this.conditionallyHidden && !loadHiddenForm) || (this.isSubFormLazyLoad() && !fromAttach)) {
450
+ if (this.builderMode || (this.conditionallyHidden() && !loadHiddenForm) || (this.isSubFormLazyLoad() && !fromAttach)) {
451
451
  return Promise.resolve();
452
452
  }
453
453
  if (this.hasLoadedForm && !this.isRevisionChanged &&
@@ -519,7 +519,7 @@ class FormComponent extends Component_1.default {
519
519
  * @returns {*|boolean} - TRUE if the subform should be submitted, FALSE if it should not.
520
520
  */
521
521
  get shouldSubmit() {
522
- return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && (!this.conditionallyHidden || !this.component.clearOnHide);
522
+ return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && (!this.conditionallyHidden() || !this.component.clearOnHide);
523
523
  }
524
524
  /**
525
525
  * Returns the data for the subform.
@@ -591,20 +591,16 @@ class FormComponent extends Component_1.default {
591
591
  return Promise.resolve(this.dataValue);
592
592
  }
593
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) {
594
+ const loadHiddenForm = !this.component.clearOnHide;
595
+ if ((this.isSubFormLazyLoad() || loadHiddenForm) && !this.subFormLoading && !this.subForm) {
596
596
  return this.createSubForm(true, true)
597
- .then(this.submitSubForm(false))
598
- .then(() => {
599
- return this.dataValue;
600
- })
597
+ .then(() => this.submitSubForm(false))
598
+ .then(() => this.dataValue)
601
599
  .then(() => super.beforeSubmit());
602
600
  }
603
601
  else {
604
602
  return this.submitSubForm(false)
605
- .then(() => {
606
- return this.dataValue;
607
- })
603
+ .then(() => this.dataValue)
608
604
  .then(() => super.beforeSubmit());
609
605
  }
610
606
  }
@@ -58,8 +58,7 @@ class HTMLComponent extends Component_1.default {
58
58
  super.checkRefreshOn(changed);
59
59
  let visible;
60
60
  if (this.hasCondition()) {
61
- this._conditionallyHidden = this.checkConditionallyHidden();
62
- visible = !this.conditionallyHidden;
61
+ visible = !this.conditionallyHidden();
63
62
  }
64
63
  else {
65
64
  visible = !this.component.hidden;
@@ -355,7 +355,7 @@ class RadioComponent extends ListComponent_1.default {
355
355
  const value = this.dataValue;
356
356
  this.refs.wrapper.forEach((wrapper, index) => {
357
357
  const input = this.refs.input[index];
358
- const checked = (input.type === 'checkbox') ? value[input.value] || input.checked : (input.value.toString() === value.toString());
358
+ const checked = (value === undefined || value === null) ? false : (input.type === 'checkbox') ? value[input.value] || input.checked : (input.value.toString() === value.toString());
359
359
  if (checked) {
360
360
  //add class to container when selected
361
361
  this.addClass(wrapper, this.optionSelectedClass);
@@ -143,6 +143,7 @@ class TabsComponent extends NestedComponent_1.default {
143
143
  this.addClass(this.refs[this.tabLinkKey][index], 'active');
144
144
  this.addClass(this.refs[this.tabLinkKey][index], 'formio-tab-link-active');
145
145
  }
146
+ this.setValue(this.data);
146
147
  this.triggerChange();
147
148
  }
148
149
  beforeFocus(component) {
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.21';
17
+ static version = '5.1.0-rc.23';
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.21';
7
+ FormioCore.version = '5.1.0-rc.23';
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) {
@@ -1637,7 +1637,7 @@ export default class WebformBuilder extends Component {
1637
1637
  info.type);
1638
1638
  }
1639
1639
  hasEditTabs(type) {
1640
- const editTabs = getComponent(Components.components[type].editForm().components, 'tabs', true).components;
1640
+ const editTabs = getComponent(Components.components[type === 'custom' ? 'unknown' : type].editForm().components, 'tabs', true).components;
1641
1641
  const hiddenEditTabs = _.filter(_.get(this.options, `editForm.${type}`, []), 'ignore');
1642
1642
  return _.intersectionBy(editTabs, hiddenEditTabs, 'key').length !== editTabs.length;
1643
1643
  }
@@ -119,13 +119,6 @@ declare class Component extends Element {
119
119
  */
120
120
  paths: import('@formio/core').ComponentPaths;
121
121
  _path: string;
122
- /**
123
- * Determines if this component is conditionally hidden. Should generally not be set outside of conditional logic pipeline.
124
- * This is necessary because of clearOnHide behavior that only clears when conditionally hidden - we need to track
125
- * conditionallyHidden separately from "regular" visibility.
126
- */
127
- _parentConditionallyHidden: any;
128
- _conditionallyHidden: any;
129
122
  /**
130
123
  * Determines if this component is visible, or not.
131
124
  */
@@ -170,6 +163,7 @@ declare class Component extends Element {
170
163
  */
171
164
  info: any;
172
165
  get componentsMap(): object;
166
+ parentConditionallyHidden(): boolean;
173
167
  set data(value: any);
174
168
  get data(): any;
175
169
  mergeSchema(component?: {}): any;
@@ -231,14 +225,9 @@ declare class Component extends Element {
231
225
  * @returns {boolean} - Whether the component is visible or not.
232
226
  */
233
227
  get visible(): boolean;
234
- get conditionallyHidden(): any;
235
- /**
236
- * Evaluates whether the component is conditionally hidden (as opposed to intentionally hidden, e.g. via the `hidden` component schema property).
237
- * @param {object} data - The data object to evaluate the condition against.
238
- * @param {object} row - The row object to evaluate the condition against.
239
- * @returns {boolean} - Whether the component is conditionally hidden.
240
- */
241
- checkConditionallyHidden(data?: object, row?: object): boolean;
228
+ get logicallyHidden(): any;
229
+ _logicallyHidden: any;
230
+ conditionallyHidden(skipParent?: boolean): any;
242
231
  set currentForm(instance: any);
243
232
  get currentForm(): any;
244
233
  _currentForm: any;