@formio/js 5.1.0-rc.22 → 5.1.0-rc.24

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 (34) 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 +10 -21
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +1 -3
  7. package/dist/formio.full.js +10 -21
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +1 -3
  10. package/dist/formio.js +14 -14
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.min.js.LICENSE.txt +1 -1
  13. package/dist/formio.utils.js +2 -13
  14. package/dist/formio.utils.min.js +1 -1
  15. package/dist/formio.utils.min.js.LICENSE.txt +1 -3
  16. package/lib/cjs/Embed.js +1 -1
  17. package/lib/cjs/Formio.js +1 -1
  18. package/lib/cjs/components/_classes/component/Component.d.ts +4 -10
  19. package/lib/cjs/components/_classes/component/Component.js +27 -55
  20. package/lib/cjs/components/_classes/nested/NestedComponent.js +3 -4
  21. package/lib/cjs/components/datamap/DataMap.js +2 -6
  22. package/lib/cjs/components/form/Form.js +2 -2
  23. package/lib/cjs/components/html/HTML.js +1 -1
  24. package/lib/cjs/components/radio/Radio.js +1 -1
  25. package/lib/mjs/Embed.js +1 -1
  26. package/lib/mjs/Formio.js +1 -1
  27. package/lib/mjs/components/_classes/component/Component.d.ts +4 -10
  28. package/lib/mjs/components/_classes/component/Component.js +27 -55
  29. package/lib/mjs/components/_classes/nested/NestedComponent.js +3 -4
  30. package/lib/mjs/components/datamap/DataMap.js +2 -6
  31. package/lib/mjs/components/form/Form.js +2 -2
  32. package/lib/mjs/components/html/HTML.js +1 -1
  33. package/lib/mjs/components/radio/Radio.js +1 -1
  34. package/package.json +2 -2
@@ -18,11 +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 */
22
-
23
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 */
24
22
 
25
- /*! formiojs v5.1.0-rc.22 | https://unpkg.com/formiojs@5.1.0-rc.22/LICENSE.txt */
23
+ /*! formiojs v5.1.0-rc.24 | https://unpkg.com/formiojs@5.1.0-rc.24/LICENSE.txt */
26
24
 
27
25
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
28
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.22';
421
+ Formio.version = '5.1.0-rc.24';
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.22';
14
+ sdk_1.Formio.version = '5.1.0-rc.24';
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) {
@@ -163,7 +163,7 @@ declare class Component extends Element {
163
163
  */
164
164
  info: any;
165
165
  get componentsMap(): object;
166
- get parentConditionallyHidden(): any;
166
+ parentConditionallyHidden(): boolean;
167
167
  set data(value: any);
168
168
  get data(): any;
169
169
  mergeSchema(component?: {}): any;
@@ -225,15 +225,9 @@ declare class Component extends Element {
225
225
  * @returns {boolean} - Whether the component is visible or not.
226
226
  */
227
227
  get visible(): boolean;
228
- get conditionallyHidden(): any;
229
- /**
230
- * Evaluates whether the component is conditionally hidden (as opposed to intentionally hidden, e.g. via the `hidden` component schema property).
231
- * @param {object} data - The data object to evaluate the condition against.
232
- * @param {object} row - The row object to evaluate the condition against.
233
- * @returns {boolean} - Whether the component is conditionally hidden.
234
- */
235
- checkConditionallyHidden(data?: object, row?: object): boolean;
236
- _conditionallyHidden: any;
228
+ get logicallyHidden(): any;
229
+ _logicallyHidden: any;
230
+ conditionallyHidden(skipParent?: boolean): any;
237
231
  set currentForm(instance: any);
238
232
  get currentForm(): any;
239
233
  _currentForm: any;
@@ -341,17 +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.checkConditionallyHidden(null, data);
350
344
  /**
351
345
  * Determines if this component is visible, or not.
352
346
  */
353
347
  this._parentVisible = this.options.hasOwnProperty('parentVisible') ? this.options.parentVisible : true;
354
- this._visible = this._parentVisible && (this.hasCondition() ? !this._conditionallyHidden : !this.component.hidden);
348
+ this._visible = this._parentVisible && (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
355
349
  this._parentDisabled = false;
356
350
  /**
357
351
  * The reference attribute name for this component
@@ -420,7 +414,7 @@ class Component extends Element_1.default {
420
414
  if (this.allowData && this.key) {
421
415
  this.options.name += `[${this.key}]`;
422
416
  // If component is visible or not set to clear on hide, set the default value.
423
- if (!(this.conditionallyHidden && this.component.clearOnHide)) {
417
+ if (!(this.conditionallyHidden() && this.component.clearOnHide)) {
424
418
  if (!this.hasValue()) {
425
419
  if (this.shouldAddDefaultValue) {
426
420
  this.dataValue = this.defaultValue;
@@ -451,17 +445,15 @@ class Component extends Element_1.default {
451
445
  var _a;
452
446
  return ((_a = this.root) === null || _a === void 0 ? void 0 : _a.childComponentsMap) || {};
453
447
  }
454
- get parentConditionallyHidden() {
455
- let parentHidden = false;
448
+ parentConditionallyHidden() {
456
449
  let currentParent = this.parent;
457
450
  while (currentParent) {
458
- parentHidden = parentHidden || currentParent._conditionallyHidden;
459
- if (parentHidden) {
460
- break;
451
+ if (currentParent.conditionallyHidden(true)) {
452
+ return true;
461
453
  }
462
454
  currentParent = currentParent.parent;
463
455
  }
464
- return parentHidden;
456
+ return false;
465
457
  }
466
458
  get data() {
467
459
  return this._data;
@@ -503,8 +495,7 @@ class Component extends Element_1.default {
503
495
  init() {
504
496
  var _a;
505
497
  this.disabled = this.shouldDisabled;
506
- this.checkConditionallyHidden();
507
- this._visible = (this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden);
498
+ this._visible = (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
508
499
  if ((_a = this.component.addons) === null || _a === void 0 ? void 0 : _a.length) {
509
500
  this.component.addons.forEach((addon) => this.createAddon(addon));
510
501
  }
@@ -666,23 +657,17 @@ class Component extends Element_1.default {
666
657
  }
667
658
  return this._visible && this._parentVisible;
668
659
  }
669
- get conditionallyHidden() {
670
- return this._conditionallyHidden || this.parentConditionallyHidden;
660
+ get logicallyHidden() {
661
+ if (this._logicallyHidden && !this.component.hidden) {
662
+ this._logicallyHidden = false;
663
+ }
664
+ return this._logicallyHidden;
671
665
  }
672
- /**
673
- * Evaluates whether the component is conditionally hidden (as opposed to intentionally hidden, e.g. via the `hidden` component schema property).
674
- * @param {object} data - The data object to evaluate the condition against.
675
- * @param {object} row - The row object to evaluate the condition against.
676
- * @returns {boolean} - Whether the component is conditionally hidden.
677
- */
678
- checkConditionallyHidden(data = null, row = null) {
679
- this._conditionallyHidden = false;
666
+ conditionallyHidden(skipParent = false) {
680
667
  if (!this.hasCondition()) {
681
- this._conditionallyHidden = this.parentConditionallyHidden;
682
- return this._conditionallyHidden;
668
+ return this.logicallyHidden || (skipParent ? false : this.parentConditionallyHidden());
683
669
  }
684
- this._conditionallyHidden = !this.conditionallyVisible(data, row) || this.parentConditionallyHidden;
685
- return this._conditionallyHidden;
670
+ return !this.conditionallyVisible() || this.logicallyHidden || (skipParent ? false : this.parentConditionallyHidden());
686
671
  }
687
672
  get currentForm() {
688
673
  return this._currentForm;
@@ -1852,7 +1837,7 @@ class Component extends Element_1.default {
1852
1837
  rebuild() {
1853
1838
  this.destroy();
1854
1839
  this.init();
1855
- this.visible = this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden;
1840
+ this.visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
1856
1841
  return this.redraw();
1857
1842
  }
1858
1843
  /**
@@ -1950,18 +1935,12 @@ class Component extends Element_1.default {
1950
1935
  if (!this.builderMode & !this.previewMode && this.fieldLogic(data, row)) {
1951
1936
  this.redraw();
1952
1937
  }
1953
- // Check advanced conditions (and cache the result)
1954
- const shouldClear = this.checkConditionallyHidden(data, row);
1955
1938
  // Check visibility
1956
- const visible = (this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden);
1939
+ const visible = (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
1957
1940
  if (this.visible !== visible) {
1958
1941
  this.visible = visible;
1959
1942
  }
1960
- // Wait for visibility to update for nested components, so the component state is up-to-date when
1961
- // calling clearOnHide
1962
- if (shouldClear) {
1963
- this.clearOnHide();
1964
- }
1943
+ this.clearOnHide();
1965
1944
  return visible;
1966
1945
  }
1967
1946
  /**
@@ -2070,9 +2049,9 @@ class Component extends Element_1.default {
2070
2049
  if (!lodash_1.default.isEqual(lodash_1.default.get(this.component, property), lodash_1.default.get(newComponent, property))) {
2071
2050
  // Advanced Logic can modify the component's hidden property; because we track conditionally hidden state
2072
2051
  // separately from the component's hidden property, and technically this Advanced Logic conditionally hides
2073
- // 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
2074
2053
  if (property === 'hidden') {
2075
- this._conditionallyHidden = newComponent.hidden;
2054
+ this._logicallyHidden = newComponent.hidden;
2076
2055
  }
2077
2056
  changed = true;
2078
2057
  }
@@ -2087,7 +2066,7 @@ class Component extends Element_1.default {
2087
2066
  component: newComponent,
2088
2067
  result,
2089
2068
  });
2090
- 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())) {
2091
2070
  this.setValue(newValue);
2092
2071
  if (this.viewOnly) {
2093
2072
  this.dataValue = newValue;
@@ -2120,7 +2099,7 @@ class Component extends Element_1.default {
2120
2099
  component: newComponent,
2121
2100
  result,
2122
2101
  }, 'value');
2123
- 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())) {
2124
2103
  this.setValue(newValue);
2125
2104
  if (this.viewOnly) {
2126
2105
  this.dataValue = newValue;
@@ -2231,7 +2210,7 @@ class Component extends Element_1.default {
2231
2210
  this.component.clearOnHide !== false &&
2232
2211
  !this.options.readOnly &&
2233
2212
  !this.options.showHiddenFields) {
2234
- if (this.conditionallyHidden) {
2213
+ if (this.conditionallyHidden()) {
2235
2214
  this.deleteValue();
2236
2215
  }
2237
2216
  else if (!this.hasValue() && this.shouldAddDefaultValue) {
@@ -2481,16 +2460,9 @@ class Component extends Element_1.default {
2481
2460
  */
2482
2461
  get dataValue() {
2483
2462
  if (!this.key) {
2484
- return this.emptyValue;
2485
- }
2486
- if (!this.hasValue() && this.shouldAddDefaultValue) {
2487
- const empty = this.component.multiple ? [] : this.emptyValue;
2488
- if (!this.rootPristine) {
2489
- this.dataValue = empty;
2490
- }
2491
- return empty;
2463
+ return this.component.multiple ? [] : this.emptyValue;
2492
2464
  }
2493
- return lodash_1.default.get(this._data, this.key);
2465
+ return lodash_1.default.get(this._data, this.key, this.component.multiple ? [] : this.emptyValue);
2494
2466
  }
2495
2467
  /**
2496
2468
  * Sets the static value of this component.
@@ -2818,7 +2790,7 @@ class Component extends Element_1.default {
2818
2790
  // If no calculated value or
2819
2791
  // hidden and set to clearOnHide (Don't calculate a value for a hidden field set to clear when hidden)
2820
2792
  const { clearOnHide } = this.component;
2821
- const shouldBeCleared = this.conditionallyHidden && clearOnHide;
2793
+ const shouldBeCleared = this.conditionallyHidden() && clearOnHide;
2822
2794
  const allowOverride = lodash_1.default.get(this.component, 'allowCalculateOverride', false);
2823
2795
  if (shouldBeCleared) {
2824
2796
  // remove calculated value so that the value is recalculated once component becomes visible
@@ -3468,7 +3440,7 @@ class Component extends Element_1.default {
3468
3440
  // If component definition changed, replace it.
3469
3441
  if (!lodash_1.default.isEqual(this.component, newComponent)) {
3470
3442
  this.component = newComponent;
3471
- const visible = this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden;
3443
+ const visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
3472
3444
  const disabled = this.shouldDisabled;
3473
3445
  // Change states which won't be recalculated during redrawing
3474
3446
  if (this.visible !== visible) {
@@ -85,7 +85,6 @@ 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
- this.checkConditionallyHidden();
89
88
  const forceShow = this.shouldForceShow();
90
89
  const forceHide = this.shouldForceHide();
91
90
  this.components.forEach((component) => {
@@ -94,7 +93,7 @@ class NestedComponent extends Field_1.default {
94
93
  component.parentVisible = isVisible;
95
94
  let visible;
96
95
  if (component.hasCondition()) {
97
- visible = !component.checkConditionallyHidden();
96
+ visible = !component.conditionallyHidden();
98
97
  }
99
98
  else {
100
99
  visible = !component.component.hidden;
@@ -633,7 +632,7 @@ class NestedComponent extends Field_1.default {
633
632
  clearOnHide(show) {
634
633
  super.clearOnHide(show);
635
634
  if (this.component.clearOnHide) {
636
- if (this.allowData && !this.hasValue() && !this.conditionallyHidden) {
635
+ if (this.allowData && !this.hasValue() && !this.conditionallyHidden()) {
637
636
  this.dataValue = this.defaultValue;
638
637
  }
639
638
  if (this.hasValue()) {
@@ -662,7 +661,7 @@ class NestedComponent extends Field_1.default {
662
661
  }
663
662
  calculateValue(data, flags, row) {
664
663
  // Do not iterate into children and calculateValues if this nested component is conditionally hidden.
665
- if (this.conditionallyHidden) {
664
+ if (this.conditionallyHidden()) {
666
665
  return false;
667
666
  }
668
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;
@@ -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.
@@ -58,7 +58,7 @@ class HTMLComponent extends Component_1.default {
58
58
  super.checkRefreshOn(changed);
59
59
  let visible;
60
60
  if (this.hasCondition()) {
61
- visible = !this.checkConditionallyHidden();
61
+ visible = !this.conditionallyHidden();
62
62
  }
63
63
  else {
64
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);
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.22';
17
+ static version = '5.1.0-rc.24';
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.22';
7
+ FormioCore.version = '5.1.0-rc.24';
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) {
@@ -163,7 +163,7 @@ declare class Component extends Element {
163
163
  */
164
164
  info: any;
165
165
  get componentsMap(): object;
166
- get parentConditionallyHidden(): any;
166
+ parentConditionallyHidden(): boolean;
167
167
  set data(value: any);
168
168
  get data(): any;
169
169
  mergeSchema(component?: {}): any;
@@ -225,15 +225,9 @@ declare class Component extends Element {
225
225
  * @returns {boolean} - Whether the component is visible or not.
226
226
  */
227
227
  get visible(): boolean;
228
- get conditionallyHidden(): any;
229
- /**
230
- * Evaluates whether the component is conditionally hidden (as opposed to intentionally hidden, e.g. via the `hidden` component schema property).
231
- * @param {object} data - The data object to evaluate the condition against.
232
- * @param {object} row - The row object to evaluate the condition against.
233
- * @returns {boolean} - Whether the component is conditionally hidden.
234
- */
235
- checkConditionallyHidden(data?: object, row?: object): boolean;
236
- _conditionallyHidden: any;
228
+ get logicallyHidden(): any;
229
+ _logicallyHidden: any;
230
+ conditionallyHidden(skipParent?: boolean): any;
237
231
  set currentForm(instance: any);
238
232
  get currentForm(): any;
239
233
  _currentForm: any;
@@ -315,17 +315,11 @@ export default class Component extends Element {
315
315
  this._path = '';
316
316
  // Needs for Nextgen Rules Engine
317
317
  this.resetCaches();
318
- /**
319
- * Determines if this component is conditionally hidden. Should generally not be set outside of conditional logic pipeline.
320
- * This is necessary because of clearOnHide behavior that only clears when conditionally hidden - we need to track
321
- * conditionallyHidden separately from "regular" visibility.
322
- */
323
- this.checkConditionallyHidden(null, data);
324
318
  /**
325
319
  * Determines if this component is visible, or not.
326
320
  */
327
321
  this._parentVisible = this.options.hasOwnProperty('parentVisible') ? this.options.parentVisible : true;
328
- this._visible = this._parentVisible && (this.hasCondition() ? !this._conditionallyHidden : !this.component.hidden);
322
+ this._visible = this._parentVisible && (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
329
323
  this._parentDisabled = false;
330
324
  /**
331
325
  * The reference attribute name for this component
@@ -394,7 +388,7 @@ export default class Component extends Element {
394
388
  if (this.allowData && this.key) {
395
389
  this.options.name += `[${this.key}]`;
396
390
  // If component is visible or not set to clear on hide, set the default value.
397
- if (!(this.conditionallyHidden && this.component.clearOnHide)) {
391
+ if (!(this.conditionallyHidden() && this.component.clearOnHide)) {
398
392
  if (!this.hasValue()) {
399
393
  if (this.shouldAddDefaultValue) {
400
394
  this.dataValue = this.defaultValue;
@@ -424,17 +418,15 @@ export default class Component extends Element {
424
418
  get componentsMap() {
425
419
  return this.root?.childComponentsMap || {};
426
420
  }
427
- get parentConditionallyHidden() {
428
- let parentHidden = false;
421
+ parentConditionallyHidden() {
429
422
  let currentParent = this.parent;
430
423
  while (currentParent) {
431
- parentHidden = parentHidden || currentParent._conditionallyHidden;
432
- if (parentHidden) {
433
- break;
424
+ if (currentParent.conditionallyHidden(true)) {
425
+ return true;
434
426
  }
435
427
  currentParent = currentParent.parent;
436
428
  }
437
- return parentHidden;
429
+ return false;
438
430
  }
439
431
  get data() {
440
432
  return this._data;
@@ -475,8 +467,7 @@ export default class Component extends Element {
475
467
  }
476
468
  init() {
477
469
  this.disabled = this.shouldDisabled;
478
- this.checkConditionallyHidden();
479
- this._visible = (this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden);
470
+ this._visible = (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
480
471
  if (this.component.addons?.length) {
481
472
  this.component.addons.forEach((addon) => this.createAddon(addon));
482
473
  }
@@ -639,23 +630,17 @@ export default class Component extends Element {
639
630
  }
640
631
  return this._visible && this._parentVisible;
641
632
  }
642
- get conditionallyHidden() {
643
- return this._conditionallyHidden || this.parentConditionallyHidden;
633
+ get logicallyHidden() {
634
+ if (this._logicallyHidden && !this.component.hidden) {
635
+ this._logicallyHidden = false;
636
+ }
637
+ return this._logicallyHidden;
644
638
  }
645
- /**
646
- * Evaluates whether the component is conditionally hidden (as opposed to intentionally hidden, e.g. via the `hidden` component schema property).
647
- * @param {object} data - The data object to evaluate the condition against.
648
- * @param {object} row - The row object to evaluate the condition against.
649
- * @returns {boolean} - Whether the component is conditionally hidden.
650
- */
651
- checkConditionallyHidden(data = null, row = null) {
652
- this._conditionallyHidden = false;
639
+ conditionallyHidden(skipParent = false) {
653
640
  if (!this.hasCondition()) {
654
- this._conditionallyHidden = this.parentConditionallyHidden;
655
- return this._conditionallyHidden;
641
+ return this.logicallyHidden || (skipParent ? false : this.parentConditionallyHidden());
656
642
  }
657
- this._conditionallyHidden = !this.conditionallyVisible(data, row) || this.parentConditionallyHidden;
658
- return this._conditionallyHidden;
643
+ return !this.conditionallyVisible() || this.logicallyHidden || (skipParent ? false : this.parentConditionallyHidden());
659
644
  }
660
645
  get currentForm() {
661
646
  return this._currentForm;
@@ -1827,7 +1812,7 @@ export default class Component extends Element {
1827
1812
  rebuild() {
1828
1813
  this.destroy();
1829
1814
  this.init();
1830
- this.visible = this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden;
1815
+ this.visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
1831
1816
  return this.redraw();
1832
1817
  }
1833
1818
  /**
@@ -1925,18 +1910,12 @@ export default class Component extends Element {
1925
1910
  if (!this.builderMode & !this.previewMode && this.fieldLogic(data, row)) {
1926
1911
  this.redraw();
1927
1912
  }
1928
- // Check advanced conditions (and cache the result)
1929
- const shouldClear = this.checkConditionallyHidden(data, row);
1930
1913
  // Check visibility
1931
- const visible = (this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden);
1914
+ const visible = (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
1932
1915
  if (this.visible !== visible) {
1933
1916
  this.visible = visible;
1934
1917
  }
1935
- // Wait for visibility to update for nested components, so the component state is up-to-date when
1936
- // calling clearOnHide
1937
- if (shouldClear) {
1938
- this.clearOnHide();
1939
- }
1918
+ this.clearOnHide();
1940
1919
  return visible;
1941
1920
  }
1942
1921
  /**
@@ -2045,9 +2024,9 @@ export default class Component extends Element {
2045
2024
  if (!_.isEqual(_.get(this.component, property), _.get(newComponent, property))) {
2046
2025
  // Advanced Logic can modify the component's hidden property; because we track conditionally hidden state
2047
2026
  // separately from the component's hidden property, and technically this Advanced Logic conditionally hides
2048
- // a component, we need to set _conditionallyHidden to the new value
2027
+ // a component, we need to set a temporary variable to the new value
2049
2028
  if (property === 'hidden') {
2050
- this._conditionallyHidden = newComponent.hidden;
2029
+ this._logicallyHidden = newComponent.hidden;
2051
2030
  }
2052
2031
  changed = true;
2053
2032
  }
@@ -2062,7 +2041,7 @@ export default class Component extends Element {
2062
2041
  component: newComponent,
2063
2042
  result,
2064
2043
  });
2065
- if (!_.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden)) {
2044
+ if (!_.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden())) {
2066
2045
  this.setValue(newValue);
2067
2046
  if (this.viewOnly) {
2068
2047
  this.dataValue = newValue;
@@ -2095,7 +2074,7 @@ export default class Component extends Element {
2095
2074
  component: newComponent,
2096
2075
  result,
2097
2076
  }, 'value');
2098
- if (!_.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden)) {
2077
+ if (!_.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden())) {
2099
2078
  this.setValue(newValue);
2100
2079
  if (this.viewOnly) {
2101
2080
  this.dataValue = newValue;
@@ -2206,7 +2185,7 @@ export default class Component extends Element {
2206
2185
  this.component.clearOnHide !== false &&
2207
2186
  !this.options.readOnly &&
2208
2187
  !this.options.showHiddenFields) {
2209
- if (this.conditionallyHidden) {
2188
+ if (this.conditionallyHidden()) {
2210
2189
  this.deleteValue();
2211
2190
  }
2212
2191
  else if (!this.hasValue() && this.shouldAddDefaultValue) {
@@ -2461,16 +2440,9 @@ export default class Component extends Element {
2461
2440
  */
2462
2441
  get dataValue() {
2463
2442
  if (!this.key) {
2464
- return this.emptyValue;
2465
- }
2466
- if (!this.hasValue() && this.shouldAddDefaultValue) {
2467
- const empty = this.component.multiple ? [] : this.emptyValue;
2468
- if (!this.rootPristine) {
2469
- this.dataValue = empty;
2470
- }
2471
- return empty;
2443
+ return this.component.multiple ? [] : this.emptyValue;
2472
2444
  }
2473
- return _.get(this._data, this.key);
2445
+ return _.get(this._data, this.key, this.component.multiple ? [] : this.emptyValue);
2474
2446
  }
2475
2447
  /**
2476
2448
  * Sets the static value of this component.
@@ -2797,7 +2769,7 @@ export default class Component extends Element {
2797
2769
  // If no calculated value or
2798
2770
  // hidden and set to clearOnHide (Don't calculate a value for a hidden field set to clear when hidden)
2799
2771
  const { clearOnHide } = this.component;
2800
- const shouldBeCleared = this.conditionallyHidden && clearOnHide;
2772
+ const shouldBeCleared = this.conditionallyHidden() && clearOnHide;
2801
2773
  const allowOverride = _.get(this.component, 'allowCalculateOverride', false);
2802
2774
  if (shouldBeCleared) {
2803
2775
  // remove calculated value so that the value is recalculated once component becomes visible
@@ -3442,7 +3414,7 @@ export default class Component extends Element {
3442
3414
  // If component definition changed, replace it.
3443
3415
  if (!_.isEqual(this.component, newComponent)) {
3444
3416
  this.component = newComponent;
3445
- const visible = this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden;
3417
+ const visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
3446
3418
  const disabled = this.shouldDisabled;
3447
3419
  // Change states which won't be recalculated during redrawing
3448
3420
  if (this.visible !== visible) {
@@ -81,7 +81,6 @@ export default class NestedComponent extends Field {
81
81
  const visibilityChanged = this._visible !== value;
82
82
  this._visible = value;
83
83
  const isVisible = this.visible;
84
- this.checkConditionallyHidden();
85
84
  const forceShow = this.shouldForceShow();
86
85
  const forceHide = this.shouldForceHide();
87
86
  this.components.forEach((component) => {
@@ -90,7 +89,7 @@ export default class NestedComponent extends Field {
90
89
  component.parentVisible = isVisible;
91
90
  let visible;
92
91
  if (component.hasCondition()) {
93
- visible = !component.checkConditionallyHidden();
92
+ visible = !component.conditionallyHidden();
94
93
  }
95
94
  else {
96
95
  visible = !component.component.hidden;
@@ -629,7 +628,7 @@ export default class NestedComponent extends Field {
629
628
  clearOnHide(show) {
630
629
  super.clearOnHide(show);
631
630
  if (this.component.clearOnHide) {
632
- if (this.allowData && !this.hasValue() && !this.conditionallyHidden) {
631
+ if (this.allowData && !this.hasValue() && !this.conditionallyHidden()) {
633
632
  this.dataValue = this.defaultValue;
634
633
  }
635
634
  if (this.hasValue()) {
@@ -658,7 +657,7 @@ export default class NestedComponent extends Field {
658
657
  }
659
658
  calculateValue(data, flags, row) {
660
659
  // Do not iterate into children and calculateValues if this nested component is conditionally hidden.
661
- if (this.conditionallyHidden) {
660
+ if (this.conditionallyHidden()) {
662
661
  return false;
663
662
  }
664
663
  return this.getComponents().reduce((changed, comp) => comp.calculateValue(data, flags, row) || changed, super.calculateValue(data, flags, row));
@@ -68,14 +68,10 @@ export default class DataMapComponent extends DataGridComponent {
68
68
  return {};
69
69
  }
70
70
  get dataValue() {
71
- if (!this.key ||
72
- (this.conditionallyHidden && this.component.clearOnHide)) {
71
+ if (!this.key) {
73
72
  return this.emptyValue;
74
73
  }
75
- if (!this.hasValue() && this.shouldAddDefaultValue) {
76
- this.dataValue = this.emptyValue;
77
- }
78
- return _.get(this.data, this.key);
74
+ return _.get(this.data, this.key, this.emptyValue);
79
75
  }
80
76
  set dataValue(value) {
81
77
  super.dataValue = value;