@formio/js 5.1.0-dev.6068.894e88e → 5.1.0-dev.6068.aa2e893

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,9 +163,18 @@ declare class Component extends Element {
163
163
  */
164
164
  info: any;
165
165
  get componentsMap(): object;
166
+ /**
167
+ * Returns if the parent should conditionally clear.
168
+ *
169
+ * @returns {boolean} - If the parent should conditionally clear.
170
+ */
166
171
  parentShouldConditionallyClear(): boolean;
167
172
  parentConditionallyHidden(): boolean;
168
- parentHidden(): boolean;
173
+ /**
174
+ * Returns true if any of the parents default their component "hidden" property to true.
175
+ * @returns {boolean} - If any parent defaults the hidden property to true.
176
+ */
177
+ anyParentDefaultsHidden(): boolean;
169
178
  set data(value: any);
170
179
  get data(): any;
171
180
  mergeSchema(component?: {}): any;
@@ -229,9 +238,21 @@ declare class Component extends Element {
229
238
  get visible(): boolean;
230
239
  get logicallyHidden(): any;
231
240
  _logicallyHidden: any;
241
+ /**
242
+ * Determines if the component should clear its value when the root form is pristine.
243
+ * @returns {boolean} - If the component should clear its value when the root form is pristine.
244
+ */
232
245
  shouldConditionallyClearOnPristine(): boolean;
246
+ /**
247
+ * Returns if the component should clear its value when conditionally hidden.
248
+ * @returns {boolean} - If the component should clear its value when conditionally hidden.
249
+ */
233
250
  shouldConditionallyClear(): boolean;
234
251
  _conditionallyClear: boolean | undefined;
252
+ /**
253
+ * Returns if the component is conditionally hidden.
254
+ * @returns {boolean} - If the component is conditionally hidden.
255
+ */
235
256
  conditionallyHidden(): boolean;
236
257
  _conditionallyHidden: boolean | undefined;
237
258
  set currentForm(instance: any);
@@ -458,6 +458,11 @@ class Component extends Element_1.default {
458
458
  var _a;
459
459
  return ((_a = this.root) === null || _a === void 0 ? void 0 : _a.childComponentsMap) || {};
460
460
  }
461
+ /**
462
+ * Returns if the parent should conditionally clear.
463
+ *
464
+ * @returns {boolean} - If the parent should conditionally clear.
465
+ */
461
466
  parentShouldConditionallyClear() {
462
467
  let currentParent = this.parent;
463
468
  while (currentParent) {
@@ -479,7 +484,11 @@ class Component extends Element_1.default {
479
484
  }
480
485
  return false;
481
486
  }
482
- parentHidden() {
487
+ /**
488
+ * Returns true if any of the parents default their component "hidden" property to true.
489
+ * @returns {boolean} - If any parent defaults the hidden property to true.
490
+ */
491
+ anyParentDefaultsHidden() {
483
492
  let currentParent = this.parent;
484
493
  while (currentParent) {
485
494
  if (currentParent.component.hidden) {
@@ -700,9 +709,19 @@ class Component extends Element_1.default {
700
709
  }
701
710
  return this._logicallyHidden;
702
711
  }
712
+ /**
713
+ * Determines if the component should clear its value when the root form is pristine.
714
+ * @returns {boolean} - If the component should clear its value when the root form is pristine.
715
+ */
703
716
  shouldConditionallyClearOnPristine() {
704
- return !this.parentHidden();
717
+ // If the form is pristine, we should NOT clear the value of a conditionally hidden child component
718
+ // of a layout component that defaults to hidden using the "hidden" component property.
719
+ return !this.anyParentDefaultsHidden();
705
720
  }
721
+ /**
722
+ * Returns if the component should clear its value when conditionally hidden.
723
+ * @returns {boolean} - If the component should clear its value when conditionally hidden.
724
+ */
706
725
  shouldConditionallyClear() {
707
726
  // Skip if this component has clearOnHide set to false.
708
727
  if (this.component.clearOnHide === false) {
@@ -724,6 +743,10 @@ class Component extends Element_1.default {
724
743
  this._conditionallyClear = this.hasSetValue ? false : this.parentShouldConditionallyClear();
725
744
  return this._conditionallyClear;
726
745
  }
746
+ /**
747
+ * Returns if the component is conditionally hidden.
748
+ * @returns {boolean} - If the component is conditionally hidden.
749
+ */
727
750
  conditionallyHidden() {
728
751
  // If it is logically hidden, then it is conditionally hidden.
729
752
  if (this.logicallyHidden) {
@@ -163,9 +163,18 @@ declare class Component extends Element {
163
163
  */
164
164
  info: any;
165
165
  get componentsMap(): object;
166
+ /**
167
+ * Returns if the parent should conditionally clear.
168
+ *
169
+ * @returns {boolean} - If the parent should conditionally clear.
170
+ */
166
171
  parentShouldConditionallyClear(): boolean;
167
172
  parentConditionallyHidden(): boolean;
168
- parentHidden(): boolean;
173
+ /**
174
+ * Returns true if any of the parents default their component "hidden" property to true.
175
+ * @returns {boolean} - If any parent defaults the hidden property to true.
176
+ */
177
+ anyParentDefaultsHidden(): boolean;
169
178
  set data(value: any);
170
179
  get data(): any;
171
180
  mergeSchema(component?: {}): any;
@@ -229,9 +238,21 @@ declare class Component extends Element {
229
238
  get visible(): boolean;
230
239
  get logicallyHidden(): any;
231
240
  _logicallyHidden: any;
241
+ /**
242
+ * Determines if the component should clear its value when the root form is pristine.
243
+ * @returns {boolean} - If the component should clear its value when the root form is pristine.
244
+ */
232
245
  shouldConditionallyClearOnPristine(): boolean;
246
+ /**
247
+ * Returns if the component should clear its value when conditionally hidden.
248
+ * @returns {boolean} - If the component should clear its value when conditionally hidden.
249
+ */
233
250
  shouldConditionallyClear(): boolean;
234
251
  _conditionallyClear: boolean | undefined;
252
+ /**
253
+ * Returns if the component is conditionally hidden.
254
+ * @returns {boolean} - If the component is conditionally hidden.
255
+ */
235
256
  conditionallyHidden(): boolean;
236
257
  _conditionallyHidden: boolean | undefined;
237
258
  set currentForm(instance: any);
@@ -422,6 +422,11 @@ export default class Component extends Element {
422
422
  get componentsMap() {
423
423
  return this.root?.childComponentsMap || {};
424
424
  }
425
+ /**
426
+ * Returns if the parent should conditionally clear.
427
+ *
428
+ * @returns {boolean} - If the parent should conditionally clear.
429
+ */
425
430
  parentShouldConditionallyClear() {
426
431
  let currentParent = this.parent;
427
432
  while (currentParent) {
@@ -443,7 +448,11 @@ export default class Component extends Element {
443
448
  }
444
449
  return false;
445
450
  }
446
- parentHidden() {
451
+ /**
452
+ * Returns true if any of the parents default their component "hidden" property to true.
453
+ * @returns {boolean} - If any parent defaults the hidden property to true.
454
+ */
455
+ anyParentDefaultsHidden() {
447
456
  let currentParent = this.parent;
448
457
  while (currentParent) {
449
458
  if (currentParent.component.hidden) {
@@ -664,9 +673,19 @@ export default class Component extends Element {
664
673
  }
665
674
  return this._logicallyHidden;
666
675
  }
676
+ /**
677
+ * Determines if the component should clear its value when the root form is pristine.
678
+ * @returns {boolean} - If the component should clear its value when the root form is pristine.
679
+ */
667
680
  shouldConditionallyClearOnPristine() {
668
- return !this.parentHidden();
681
+ // If the form is pristine, we should NOT clear the value of a conditionally hidden child component
682
+ // of a layout component that defaults to hidden using the "hidden" component property.
683
+ return !this.anyParentDefaultsHidden();
669
684
  }
685
+ /**
686
+ * Returns if the component should clear its value when conditionally hidden.
687
+ * @returns {boolean} - If the component should clear its value when conditionally hidden.
688
+ */
670
689
  shouldConditionallyClear() {
671
690
  // Skip if this component has clearOnHide set to false.
672
691
  if (this.component.clearOnHide === false) {
@@ -688,6 +707,10 @@ export default class Component extends Element {
688
707
  this._conditionallyClear = this.hasSetValue ? false : this.parentShouldConditionallyClear();
689
708
  return this._conditionallyClear;
690
709
  }
710
+ /**
711
+ * Returns if the component is conditionally hidden.
712
+ * @returns {boolean} - If the component is conditionally hidden.
713
+ */
691
714
  conditionallyHidden() {
692
715
  // If it is logically hidden, then it is conditionally hidden.
693
716
  if (this.logicallyHidden) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.6068.894e88e",
3
+ "version": "5.1.0-dev.6068.aa2e893",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {