@formio/js 5.1.0-dev.6043.03460d9 → 5.1.0-dev.6044.20a9acc

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.
@@ -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;
@@ -351,17 +351,11 @@ class Component extends Element_1.default {
351
351
  this._path = '';
352
352
  // Needs for Nextgen Rules Engine
353
353
  this.resetCaches();
354
- /**
355
- * Determines if this component is conditionally hidden. Should generally not be set outside of conditional logic pipeline.
356
- * This is necessary because of clearOnHide behavior that only clears when conditionally hidden - we need to track
357
- * conditionallyHidden separately from "regular" visibility.
358
- */
359
- this.checkConditionallyHidden(null, data);
360
354
  /**
361
355
  * Determines if this component is visible, or not.
362
356
  */
363
357
  this._parentVisible = this.options.hasOwnProperty('parentVisible') ? this.options.parentVisible : true;
364
- this._visible = this._parentVisible && (this.hasCondition() ? !this._conditionallyHidden : !this.component.hidden);
358
+ this._visible = this._parentVisible && (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
365
359
  this._parentDisabled = false;
366
360
  /**
367
361
  * The reference attribute name for this component
@@ -430,7 +424,7 @@ class Component extends Element_1.default {
430
424
  if (this.allowData && this.key) {
431
425
  this.options.name += `[${this.key}]`;
432
426
  // If component is visible or not set to clear on hide, set the default value.
433
- if (!(this.conditionallyHidden && this.component.clearOnHide)) {
427
+ if (!(this.conditionallyHidden() && this.component.clearOnHide)) {
434
428
  if (!this.hasValue()) {
435
429
  if (this.shouldAddDefaultValue) {
436
430
  this.dataValue = this.defaultValue;
@@ -464,17 +458,15 @@ class Component extends Element_1.default {
464
458
  var _a;
465
459
  return ((_a = this.root) === null || _a === void 0 ? void 0 : _a.childComponentsMap) || {};
466
460
  }
467
- get parentConditionallyHidden() {
468
- let parentHidden = false;
461
+ parentConditionallyHidden() {
469
462
  let currentParent = this.parent;
470
463
  while (currentParent) {
471
- parentHidden = parentHidden || currentParent._conditionallyHidden;
472
- if (parentHidden) {
473
- break;
464
+ if (currentParent.conditionallyHidden(true)) {
465
+ return true;
474
466
  }
475
467
  currentParent = currentParent.parent;
476
468
  }
477
- return parentHidden;
469
+ return false;
478
470
  }
479
471
  get data() {
480
472
  return this._data;
@@ -516,8 +508,7 @@ class Component extends Element_1.default {
516
508
  init() {
517
509
  var _a;
518
510
  this.disabled = this.shouldDisabled;
519
- this.checkConditionallyHidden();
520
- this._visible = (this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden);
511
+ this._visible = (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
521
512
  if ((_a = this.component.addons) === null || _a === void 0 ? void 0 : _a.length) {
522
513
  this.component.addons.forEach((addon) => this.createAddon(addon));
523
514
  }
@@ -682,23 +673,17 @@ class Component extends Element_1.default {
682
673
  }
683
674
  return this._visible && this._parentVisible;
684
675
  }
685
- get conditionallyHidden() {
686
- return this._conditionallyHidden || this.parentConditionallyHidden;
676
+ get logicallyHidden() {
677
+ if (this._logicallyHidden && !this.component.hidden) {
678
+ this._logicallyHidden = false;
679
+ }
680
+ return this._logicallyHidden;
687
681
  }
688
- /**
689
- * Evaluates whether the component is conditionally hidden (as opposed to intentionally hidden, e.g. via the `hidden` component schema property).
690
- * @param {object} data - The data object to evaluate the condition against.
691
- * @param {object} row - The row object to evaluate the condition against.
692
- * @returns {boolean} - Whether the component is conditionally hidden.
693
- */
694
- checkConditionallyHidden(data = null, row = null) {
695
- this._conditionallyHidden = false;
682
+ conditionallyHidden(skipParent = false) {
696
683
  if (!this.hasCondition()) {
697
- this._conditionallyHidden = this.parentConditionallyHidden;
698
- return this._conditionallyHidden;
684
+ return this.logicallyHidden || (skipParent ? false : this.parentConditionallyHidden());
699
685
  }
700
- this._conditionallyHidden = !this.conditionallyVisible(data, row) || this.parentConditionallyHidden;
701
- return this._conditionallyHidden;
686
+ return !this.conditionallyVisible() || this.logicallyHidden || (skipParent ? false : this.parentConditionallyHidden());
702
687
  }
703
688
  get currentForm() {
704
689
  return this._currentForm;
@@ -1866,7 +1851,7 @@ class Component extends Element_1.default {
1866
1851
  rebuild() {
1867
1852
  this.destroy();
1868
1853
  this.init();
1869
- this.visible = this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden;
1854
+ this.visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
1870
1855
  return this.redraw();
1871
1856
  }
1872
1857
  /**
@@ -1964,18 +1949,12 @@ class Component extends Element_1.default {
1964
1949
  if (!this.builderMode & !this.previewMode && this.fieldLogic(data, row)) {
1965
1950
  this.redraw();
1966
1951
  }
1967
- // Check advanced conditions (and cache the result)
1968
- const shouldClear = this.checkConditionallyHidden(data, row);
1969
1952
  // Check visibility
1970
- const visible = (this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden);
1953
+ const visible = (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
1971
1954
  if (this.visible !== visible) {
1972
1955
  this.visible = visible;
1973
1956
  }
1974
- // Wait for visibility to update for nested components, so the component state is up-to-date when
1975
- // calling clearOnHide
1976
- if (shouldClear) {
1977
- this.clearOnHide();
1978
- }
1957
+ this.clearOnHide();
1979
1958
  return visible;
1980
1959
  }
1981
1960
  /**
@@ -2084,9 +2063,9 @@ class Component extends Element_1.default {
2084
2063
  if (!lodash_1.default.isEqual(lodash_1.default.get(this.component, property), lodash_1.default.get(newComponent, property))) {
2085
2064
  // Advanced Logic can modify the component's hidden property; because we track conditionally hidden state
2086
2065
  // separately from the component's hidden property, and technically this Advanced Logic conditionally hides
2087
- // a component, we need to set _conditionallyHidden to the new value
2066
+ // a component, we need to set a temporary variable to the new value
2088
2067
  if (property === 'hidden') {
2089
- this._conditionallyHidden = newComponent.hidden;
2068
+ this._logicallyHidden = newComponent.hidden;
2090
2069
  }
2091
2070
  changed = true;
2092
2071
  }
@@ -2101,7 +2080,7 @@ class Component extends Element_1.default {
2101
2080
  component: newComponent,
2102
2081
  result,
2103
2082
  });
2104
- if (!lodash_1.default.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden)) {
2083
+ if (!lodash_1.default.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden())) {
2105
2084
  this.setValue(newValue);
2106
2085
  if (this.viewOnly) {
2107
2086
  this.dataValue = newValue;
@@ -2134,7 +2113,7 @@ class Component extends Element_1.default {
2134
2113
  component: newComponent,
2135
2114
  result,
2136
2115
  }, 'value');
2137
- if (!lodash_1.default.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden)) {
2116
+ if (!lodash_1.default.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden())) {
2138
2117
  this.setValue(newValue);
2139
2118
  if (this.viewOnly) {
2140
2119
  this.dataValue = newValue;
@@ -2245,7 +2224,7 @@ class Component extends Element_1.default {
2245
2224
  this.component.clearOnHide !== false &&
2246
2225
  !this.options.readOnly &&
2247
2226
  !this.options.showHiddenFields) {
2248
- if (this.conditionallyHidden) {
2227
+ if (this.conditionallyHidden()) {
2249
2228
  this.deleteValue();
2250
2229
  }
2251
2230
  else if (!this.hasValue() && this.shouldAddDefaultValue) {
@@ -2504,16 +2483,9 @@ class Component extends Element_1.default {
2504
2483
  */
2505
2484
  get dataValue() {
2506
2485
  if (!this.key) {
2507
- return this.emptyValue;
2508
- }
2509
- if (!this.hasValue() && this.shouldAddDefaultValue) {
2510
- const empty = this.component.multiple ? [] : this.emptyValue;
2511
- if (!this.rootPristine) {
2512
- this.dataValue = empty;
2513
- }
2514
- return empty;
2486
+ return this.component.multiple ? [] : this.emptyValue;
2515
2487
  }
2516
- return lodash_1.default.get(this._data, this.key);
2488
+ return lodash_1.default.get(this._data, this.key, this.component.multiple ? [] : this.emptyValue);
2517
2489
  }
2518
2490
  /**
2519
2491
  * Sets the static value of this component.
@@ -2841,7 +2813,7 @@ class Component extends Element_1.default {
2841
2813
  // If no calculated value or
2842
2814
  // hidden and set to clearOnHide (Don't calculate a value for a hidden field set to clear when hidden)
2843
2815
  const { clearOnHide } = this.component;
2844
- const shouldBeCleared = this.conditionallyHidden && clearOnHide;
2816
+ const shouldBeCleared = this.conditionallyHidden() && clearOnHide;
2845
2817
  const allowOverride = lodash_1.default.get(this.component, 'allowCalculateOverride', false);
2846
2818
  if (shouldBeCleared) {
2847
2819
  // remove calculated value so that the value is recalculated once component becomes visible
@@ -3491,7 +3463,7 @@ class Component extends Element_1.default {
3491
3463
  // If component definition changed, replace it.
3492
3464
  if (!lodash_1.default.isEqual(this.component, newComponent)) {
3493
3465
  this.component = newComponent;
3494
- const visible = this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden;
3466
+ const visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
3495
3467
  const disabled = this.shouldDisabled;
3496
3468
  // Change states which won't be recalculated during redrawing
3497
3469
  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;
@@ -448,7 +448,7 @@ class FormComponent extends Component_1.default {
448
448
  loadSubForm(fromAttach, beforeSubmit) {
449
449
  var _a, _b, _c, _d, _e;
450
450
  const loadHiddenForm = beforeSubmit && !this.component.clearOnHide;
451
- if (this.builderMode || (this.conditionallyHidden && !loadHiddenForm) || (this.isSubFormLazyLoad() && !fromAttach)) {
451
+ if (this.builderMode || (this.conditionallyHidden() && !loadHiddenForm) || (this.isSubFormLazyLoad() && !fromAttach)) {
452
452
  return Promise.resolve();
453
453
  }
454
454
  if (this.hasLoadedForm && !this.isRevisionChanged &&
@@ -520,7 +520,7 @@ class FormComponent extends Component_1.default {
520
520
  * @returns {*|boolean} - TRUE if the subform should be submitted, FALSE if it should not.
521
521
  */
522
522
  get shouldSubmit() {
523
- return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && (!this.conditionallyHidden || !this.component.clearOnHide);
523
+ return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && (!this.conditionallyHidden() || !this.component.clearOnHide);
524
524
  }
525
525
  /**
526
526
  * 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;
@@ -365,7 +365,7 @@ class RadioComponent extends ListComponent_1.default {
365
365
  const value = this.dataValue;
366
366
  this.refs.wrapper.forEach((wrapper, index) => {
367
367
  const input = this.refs.input[index];
368
- const checked = (input.type === 'checkbox') ? value[input.value] || input.checked : (input.value.toString() === value.toString());
368
+ const checked = (value === undefined || value === null) ? false : (input.type === 'checkbox') ? value[input.value] || input.checked : (input.value.toString() === value.toString());
369
369
  if (checked) {
370
370
  //add class to container when selected
371
371
  this.addClass(wrapper, this.optionSelectedClass);
@@ -1459,7 +1459,7 @@ class SelectComponent extends ListComponent_1.default {
1459
1459
  asString(value, options = {}) {
1460
1460
  var _a;
1461
1461
  value = value !== null && value !== void 0 ? value : this.getValue();
1462
- if (options.modalPreview || this.inDataTable || options.email) {
1462
+ if (options.modalPreview || this.inDataTable) {
1463
1463
  if (this.inDataTable) {
1464
1464
  value = this.undoValueTyping(value);
1465
1465
  }
@@ -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;
@@ -316,17 +316,11 @@ export default class Component extends Element {
316
316
  this._path = '';
317
317
  // Needs for Nextgen Rules Engine
318
318
  this.resetCaches();
319
- /**
320
- * Determines if this component is conditionally hidden. Should generally not be set outside of conditional logic pipeline.
321
- * This is necessary because of clearOnHide behavior that only clears when conditionally hidden - we need to track
322
- * conditionallyHidden separately from "regular" visibility.
323
- */
324
- this.checkConditionallyHidden(null, data);
325
319
  /**
326
320
  * Determines if this component is visible, or not.
327
321
  */
328
322
  this._parentVisible = this.options.hasOwnProperty('parentVisible') ? this.options.parentVisible : true;
329
- this._visible = this._parentVisible && (this.hasCondition() ? !this._conditionallyHidden : !this.component.hidden);
323
+ this._visible = this._parentVisible && (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
330
324
  this._parentDisabled = false;
331
325
  /**
332
326
  * The reference attribute name for this component
@@ -395,7 +389,7 @@ export default class Component extends Element {
395
389
  if (this.allowData && this.key) {
396
390
  this.options.name += `[${this.key}]`;
397
391
  // If component is visible or not set to clear on hide, set the default value.
398
- if (!(this.conditionallyHidden && this.component.clearOnHide)) {
392
+ if (!(this.conditionallyHidden() && this.component.clearOnHide)) {
399
393
  if (!this.hasValue()) {
400
394
  if (this.shouldAddDefaultValue) {
401
395
  this.dataValue = this.defaultValue;
@@ -428,17 +422,15 @@ export default class Component extends Element {
428
422
  get componentsMap() {
429
423
  return this.root?.childComponentsMap || {};
430
424
  }
431
- get parentConditionallyHidden() {
432
- let parentHidden = false;
425
+ parentConditionallyHidden() {
433
426
  let currentParent = this.parent;
434
427
  while (currentParent) {
435
- parentHidden = parentHidden || currentParent._conditionallyHidden;
436
- if (parentHidden) {
437
- break;
428
+ if (currentParent.conditionallyHidden(true)) {
429
+ return true;
438
430
  }
439
431
  currentParent = currentParent.parent;
440
432
  }
441
- return parentHidden;
433
+ return false;
442
434
  }
443
435
  get data() {
444
436
  return this._data;
@@ -479,8 +471,7 @@ export default class Component extends Element {
479
471
  }
480
472
  init() {
481
473
  this.disabled = this.shouldDisabled;
482
- this.checkConditionallyHidden();
483
- this._visible = (this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden);
474
+ this._visible = (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
484
475
  if (this.component.addons?.length) {
485
476
  this.component.addons.forEach((addon) => this.createAddon(addon));
486
477
  }
@@ -646,23 +637,17 @@ export default class Component extends Element {
646
637
  }
647
638
  return this._visible && this._parentVisible;
648
639
  }
649
- get conditionallyHidden() {
650
- return this._conditionallyHidden || this.parentConditionallyHidden;
640
+ get logicallyHidden() {
641
+ if (this._logicallyHidden && !this.component.hidden) {
642
+ this._logicallyHidden = false;
643
+ }
644
+ return this._logicallyHidden;
651
645
  }
652
- /**
653
- * Evaluates whether the component is conditionally hidden (as opposed to intentionally hidden, e.g. via the `hidden` component schema property).
654
- * @param {object} data - The data object to evaluate the condition against.
655
- * @param {object} row - The row object to evaluate the condition against.
656
- * @returns {boolean} - Whether the component is conditionally hidden.
657
- */
658
- checkConditionallyHidden(data = null, row = null) {
659
- this._conditionallyHidden = false;
646
+ conditionallyHidden(skipParent = false) {
660
647
  if (!this.hasCondition()) {
661
- this._conditionallyHidden = this.parentConditionallyHidden;
662
- return this._conditionallyHidden;
648
+ return this.logicallyHidden || (skipParent ? false : this.parentConditionallyHidden());
663
649
  }
664
- this._conditionallyHidden = !this.conditionallyVisible(data, row) || this.parentConditionallyHidden;
665
- return this._conditionallyHidden;
650
+ return !this.conditionallyVisible() || this.logicallyHidden || (skipParent ? false : this.parentConditionallyHidden());
666
651
  }
667
652
  get currentForm() {
668
653
  return this._currentForm;
@@ -1832,7 +1817,7 @@ export default class Component extends Element {
1832
1817
  rebuild() {
1833
1818
  this.destroy();
1834
1819
  this.init();
1835
- this.visible = this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden;
1820
+ this.visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
1836
1821
  return this.redraw();
1837
1822
  }
1838
1823
  /**
@@ -1930,18 +1915,12 @@ export default class Component extends Element {
1930
1915
  if (!this.builderMode & !this.previewMode && this.fieldLogic(data, row)) {
1931
1916
  this.redraw();
1932
1917
  }
1933
- // Check advanced conditions (and cache the result)
1934
- const shouldClear = this.checkConditionallyHidden(data, row);
1935
1918
  // Check visibility
1936
- const visible = (this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden);
1919
+ const visible = (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
1937
1920
  if (this.visible !== visible) {
1938
1921
  this.visible = visible;
1939
1922
  }
1940
- // Wait for visibility to update for nested components, so the component state is up-to-date when
1941
- // calling clearOnHide
1942
- if (shouldClear) {
1943
- this.clearOnHide();
1944
- }
1923
+ this.clearOnHide();
1945
1924
  return visible;
1946
1925
  }
1947
1926
  /**
@@ -2050,9 +2029,9 @@ export default class Component extends Element {
2050
2029
  if (!_.isEqual(_.get(this.component, property), _.get(newComponent, property))) {
2051
2030
  // Advanced Logic can modify the component's hidden property; because we track conditionally hidden state
2052
2031
  // separately from the component's hidden property, and technically this Advanced Logic conditionally hides
2053
- // a component, we need to set _conditionallyHidden to the new value
2032
+ // a component, we need to set a temporary variable to the new value
2054
2033
  if (property === 'hidden') {
2055
- this._conditionallyHidden = newComponent.hidden;
2034
+ this._logicallyHidden = newComponent.hidden;
2056
2035
  }
2057
2036
  changed = true;
2058
2037
  }
@@ -2067,7 +2046,7 @@ export default class Component extends Element {
2067
2046
  component: newComponent,
2068
2047
  result,
2069
2048
  });
2070
- if (!_.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden)) {
2049
+ if (!_.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden())) {
2071
2050
  this.setValue(newValue);
2072
2051
  if (this.viewOnly) {
2073
2052
  this.dataValue = newValue;
@@ -2100,7 +2079,7 @@ export default class Component extends Element {
2100
2079
  component: newComponent,
2101
2080
  result,
2102
2081
  }, 'value');
2103
- if (!_.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden)) {
2082
+ if (!_.isEqual(oldValue, newValue) && !(this.component.clearOnHide && this.conditionallyHidden())) {
2104
2083
  this.setValue(newValue);
2105
2084
  if (this.viewOnly) {
2106
2085
  this.dataValue = newValue;
@@ -2211,7 +2190,7 @@ export default class Component extends Element {
2211
2190
  this.component.clearOnHide !== false &&
2212
2191
  !this.options.readOnly &&
2213
2192
  !this.options.showHiddenFields) {
2214
- if (this.conditionallyHidden) {
2193
+ if (this.conditionallyHidden()) {
2215
2194
  this.deleteValue();
2216
2195
  }
2217
2196
  else if (!this.hasValue() && this.shouldAddDefaultValue) {
@@ -2473,16 +2452,9 @@ export default class Component extends Element {
2473
2452
  */
2474
2453
  get dataValue() {
2475
2454
  if (!this.key) {
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;
2455
+ return this.component.multiple ? [] : this.emptyValue;
2484
2456
  }
2485
- return _.get(this._data, this.key);
2457
+ return _.get(this._data, this.key, this.component.multiple ? [] : this.emptyValue);
2486
2458
  }
2487
2459
  /**
2488
2460
  * Sets the static value of this component.
@@ -2809,7 +2781,7 @@ export default class Component extends Element {
2809
2781
  // If no calculated value or
2810
2782
  // hidden and set to clearOnHide (Don't calculate a value for a hidden field set to clear when hidden)
2811
2783
  const { clearOnHide } = this.component;
2812
- const shouldBeCleared = this.conditionallyHidden && clearOnHide;
2784
+ const shouldBeCleared = this.conditionallyHidden() && clearOnHide;
2813
2785
  const allowOverride = _.get(this.component, 'allowCalculateOverride', false);
2814
2786
  if (shouldBeCleared) {
2815
2787
  // remove calculated value so that the value is recalculated once component becomes visible
@@ -3454,7 +3426,7 @@ export default class Component extends Element {
3454
3426
  // If component definition changed, replace it.
3455
3427
  if (!_.isEqual(this.component, newComponent)) {
3456
3428
  this.component = newComponent;
3457
- const visible = this.hasCondition() ? !this.conditionallyHidden : !this.component.hidden;
3429
+ const visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
3458
3430
  const disabled = this.shouldDisabled;
3459
3431
  // Change states which won't be recalculated during redrawing
3460
3432
  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;
@@ -441,7 +441,7 @@ export default class FormComponent extends Component {
441
441
  */
442
442
  loadSubForm(fromAttach, beforeSubmit) {
443
443
  const loadHiddenForm = beforeSubmit && !this.component.clearOnHide;
444
- if (this.builderMode || (this.conditionallyHidden && !loadHiddenForm) || (this.isSubFormLazyLoad() && !fromAttach)) {
444
+ if (this.builderMode || (this.conditionallyHidden() && !loadHiddenForm) || (this.isSubFormLazyLoad() && !fromAttach)) {
445
445
  return Promise.resolve();
446
446
  }
447
447
  if (this.hasLoadedForm && !this.isRevisionChanged &&
@@ -513,7 +513,7 @@ export default class FormComponent extends Component {
513
513
  * @returns {*|boolean} - TRUE if the subform should be submitted, FALSE if it should not.
514
514
  */
515
515
  get shouldSubmit() {
516
- return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && (!this.conditionallyHidden || !this.component.clearOnHide);
516
+ return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && (!this.conditionallyHidden() || !this.component.clearOnHide);
517
517
  }
518
518
  /**
519
519
  * Returns the data for the subform.
@@ -53,7 +53,7 @@ export default class HTMLComponent extends Component {
53
53
  super.checkRefreshOn(changed);
54
54
  let visible;
55
55
  if (this.hasCondition()) {
56
- visible = !this.checkConditionallyHidden();
56
+ visible = !this.conditionallyHidden();
57
57
  }
58
58
  else {
59
59
  visible = !this.component.hidden;
@@ -365,7 +365,7 @@ export default class RadioComponent extends ListComponent {
365
365
  const value = this.dataValue;
366
366
  this.refs.wrapper.forEach((wrapper, index) => {
367
367
  const input = this.refs.input[index];
368
- const checked = (input.type === 'checkbox') ? value[input.value] || input.checked : (input.value.toString() === value.toString());
368
+ const checked = (value === undefined || value === null) ? false : (input.type === 'checkbox') ? value[input.value] || input.checked : (input.value.toString() === value.toString());
369
369
  if (checked) {
370
370
  //add class to container when selected
371
371
  this.addClass(wrapper, this.optionSelectedClass);
@@ -1487,7 +1487,7 @@ export default class SelectComponent extends ListComponent {
1487
1487
  }
1488
1488
  asString(value, options = {}) {
1489
1489
  value = value ?? this.getValue();
1490
- if (options.modalPreview || this.inDataTable || options.email) {
1490
+ if (options.modalPreview || this.inDataTable) {
1491
1491
  if (this.inDataTable) {
1492
1492
  value = this.undoValueTyping(value);
1493
1493
  }