@formio/js 5.1.0-dev.6068.e295b11 → 5.1.0-dev.6068.fbce2f7
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.
- package/dist/formio.form.js +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +1 -1
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +26 -1
- package/lib/cjs/components/_classes/component/Component.js +28 -3
- package/lib/mjs/components/_classes/component/Component.d.ts +26 -1
- package/lib/mjs/components/_classes/component/Component.js +28 -3
- package/package.json +1 -1
@@ -163,9 +163,22 @@ 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
|
+
* This method does not need to walk up the parent tree since the variables
|
169
|
+
* _conditionallyClear and _conditionallyHidden are set on the parent component
|
170
|
+
* before the child component is determined, and the parent component also references
|
171
|
+
* its parent component.
|
172
|
+
*
|
173
|
+
* @returns {boolean} - If the parent should conditionally clear.
|
174
|
+
*/
|
166
175
|
parentShouldConditionallyClear(): boolean;
|
167
176
|
parentConditionallyHidden(): boolean;
|
168
|
-
|
177
|
+
/**
|
178
|
+
* Returns true if any of the parents default their component "hidden" property to true.
|
179
|
+
* @returns {boolean} - If any parent defaults the hidden property to true.
|
180
|
+
*/
|
181
|
+
anyParentDefaultsHidden(): boolean;
|
169
182
|
set data(value: any);
|
170
183
|
get data(): any;
|
171
184
|
mergeSchema(component?: {}): any;
|
@@ -229,9 +242,21 @@ declare class Component extends Element {
|
|
229
242
|
get visible(): boolean;
|
230
243
|
get logicallyHidden(): any;
|
231
244
|
_logicallyHidden: any;
|
245
|
+
/**
|
246
|
+
* Determines if the component should clear its value when the root form is pristine.
|
247
|
+
* @returns {boolean} - If the component should clear its value when the root form is pristine.
|
248
|
+
*/
|
232
249
|
shouldConditionallyClearOnPristine(): boolean;
|
250
|
+
/**
|
251
|
+
* Returns if the component should clear its value when conditionally hidden.
|
252
|
+
* @returns {boolean} - If the component should clear its value when conditionally hidden.
|
253
|
+
*/
|
233
254
|
shouldConditionallyClear(): boolean;
|
234
255
|
_conditionallyClear: boolean | undefined;
|
256
|
+
/**
|
257
|
+
* Returns if the component is conditionally hidden.
|
258
|
+
* @returns {boolean} - If the component is conditionally hidden.
|
259
|
+
*/
|
235
260
|
conditionallyHidden(): boolean;
|
236
261
|
_conditionallyHidden: boolean | undefined;
|
237
262
|
set currentForm(instance: any);
|
@@ -458,6 +458,15 @@ 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
|
+
* This method does not need to walk up the parent tree since the variables
|
464
|
+
* _conditionallyClear and _conditionallyHidden are set on the parent component
|
465
|
+
* before the child component is determined, and the parent component also references
|
466
|
+
* its parent component.
|
467
|
+
*
|
468
|
+
* @returns {boolean} - If the parent should conditionally clear.
|
469
|
+
*/
|
461
470
|
parentShouldConditionallyClear() {
|
462
471
|
let currentParent = this.parent;
|
463
472
|
while (currentParent) {
|
@@ -479,7 +488,11 @@ class Component extends Element_1.default {
|
|
479
488
|
}
|
480
489
|
return false;
|
481
490
|
}
|
482
|
-
|
491
|
+
/**
|
492
|
+
* Returns true if any of the parents default their component "hidden" property to true.
|
493
|
+
* @returns {boolean} - If any parent defaults the hidden property to true.
|
494
|
+
*/
|
495
|
+
anyParentDefaultsHidden() {
|
483
496
|
let currentParent = this.parent;
|
484
497
|
while (currentParent) {
|
485
498
|
if (currentParent.component.hidden) {
|
@@ -700,11 +713,19 @@ class Component extends Element_1.default {
|
|
700
713
|
}
|
701
714
|
return this._logicallyHidden;
|
702
715
|
}
|
716
|
+
/**
|
717
|
+
* Determines if the component should clear its value when the root form is pristine.
|
718
|
+
* @returns {boolean} - If the component should clear its value when the root form is pristine.
|
719
|
+
*/
|
703
720
|
shouldConditionallyClearOnPristine() {
|
704
721
|
// If the form is pristine, we should NOT clear the value of a conditionally hidden child component
|
705
|
-
// of a
|
706
|
-
return !this.
|
722
|
+
// of a layout component that defaults to hidden using the "hidden" component property.
|
723
|
+
return !this.anyParentDefaultsHidden();
|
707
724
|
}
|
725
|
+
/**
|
726
|
+
* Returns if the component should clear its value when conditionally hidden.
|
727
|
+
* @returns {boolean} - If the component should clear its value when conditionally hidden.
|
728
|
+
*/
|
708
729
|
shouldConditionallyClear() {
|
709
730
|
// Skip if this component has clearOnHide set to false.
|
710
731
|
if (this.component.clearOnHide === false) {
|
@@ -726,6 +747,10 @@ class Component extends Element_1.default {
|
|
726
747
|
this._conditionallyClear = this.hasSetValue ? false : this.parentShouldConditionallyClear();
|
727
748
|
return this._conditionallyClear;
|
728
749
|
}
|
750
|
+
/**
|
751
|
+
* Returns if the component is conditionally hidden.
|
752
|
+
* @returns {boolean} - If the component is conditionally hidden.
|
753
|
+
*/
|
729
754
|
conditionallyHidden() {
|
730
755
|
// If it is logically hidden, then it is conditionally hidden.
|
731
756
|
if (this.logicallyHidden) {
|
@@ -163,9 +163,22 @@ 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
|
+
* This method does not need to walk up the parent tree since the variables
|
169
|
+
* _conditionallyClear and _conditionallyHidden are set on the parent component
|
170
|
+
* before the child component is determined, and the parent component also references
|
171
|
+
* its parent component.
|
172
|
+
*
|
173
|
+
* @returns {boolean} - If the parent should conditionally clear.
|
174
|
+
*/
|
166
175
|
parentShouldConditionallyClear(): boolean;
|
167
176
|
parentConditionallyHidden(): boolean;
|
168
|
-
|
177
|
+
/**
|
178
|
+
* Returns true if any of the parents default their component "hidden" property to true.
|
179
|
+
* @returns {boolean} - If any parent defaults the hidden property to true.
|
180
|
+
*/
|
181
|
+
anyParentDefaultsHidden(): boolean;
|
169
182
|
set data(value: any);
|
170
183
|
get data(): any;
|
171
184
|
mergeSchema(component?: {}): any;
|
@@ -229,9 +242,21 @@ declare class Component extends Element {
|
|
229
242
|
get visible(): boolean;
|
230
243
|
get logicallyHidden(): any;
|
231
244
|
_logicallyHidden: any;
|
245
|
+
/**
|
246
|
+
* Determines if the component should clear its value when the root form is pristine.
|
247
|
+
* @returns {boolean} - If the component should clear its value when the root form is pristine.
|
248
|
+
*/
|
232
249
|
shouldConditionallyClearOnPristine(): boolean;
|
250
|
+
/**
|
251
|
+
* Returns if the component should clear its value when conditionally hidden.
|
252
|
+
* @returns {boolean} - If the component should clear its value when conditionally hidden.
|
253
|
+
*/
|
233
254
|
shouldConditionallyClear(): boolean;
|
234
255
|
_conditionallyClear: boolean | undefined;
|
256
|
+
/**
|
257
|
+
* Returns if the component is conditionally hidden.
|
258
|
+
* @returns {boolean} - If the component is conditionally hidden.
|
259
|
+
*/
|
235
260
|
conditionallyHidden(): boolean;
|
236
261
|
_conditionallyHidden: boolean | undefined;
|
237
262
|
set currentForm(instance: any);
|
@@ -422,6 +422,15 @@ 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
|
+
* This method does not need to walk up the parent tree since the variables
|
428
|
+
* _conditionallyClear and _conditionallyHidden are set on the parent component
|
429
|
+
* before the child component is determined, and the parent component also references
|
430
|
+
* its parent component.
|
431
|
+
*
|
432
|
+
* @returns {boolean} - If the parent should conditionally clear.
|
433
|
+
*/
|
425
434
|
parentShouldConditionallyClear() {
|
426
435
|
let currentParent = this.parent;
|
427
436
|
while (currentParent) {
|
@@ -443,7 +452,11 @@ export default class Component extends Element {
|
|
443
452
|
}
|
444
453
|
return false;
|
445
454
|
}
|
446
|
-
|
455
|
+
/**
|
456
|
+
* Returns true if any of the parents default their component "hidden" property to true.
|
457
|
+
* @returns {boolean} - If any parent defaults the hidden property to true.
|
458
|
+
*/
|
459
|
+
anyParentDefaultsHidden() {
|
447
460
|
let currentParent = this.parent;
|
448
461
|
while (currentParent) {
|
449
462
|
if (currentParent.component.hidden) {
|
@@ -664,11 +677,19 @@ export default class Component extends Element {
|
|
664
677
|
}
|
665
678
|
return this._logicallyHidden;
|
666
679
|
}
|
680
|
+
/**
|
681
|
+
* Determines if the component should clear its value when the root form is pristine.
|
682
|
+
* @returns {boolean} - If the component should clear its value when the root form is pristine.
|
683
|
+
*/
|
667
684
|
shouldConditionallyClearOnPristine() {
|
668
685
|
// If the form is pristine, we should NOT clear the value of a conditionally hidden child component
|
669
|
-
// of a
|
670
|
-
return !this.
|
686
|
+
// of a layout component that defaults to hidden using the "hidden" component property.
|
687
|
+
return !this.anyParentDefaultsHidden();
|
671
688
|
}
|
689
|
+
/**
|
690
|
+
* Returns if the component should clear its value when conditionally hidden.
|
691
|
+
* @returns {boolean} - If the component should clear its value when conditionally hidden.
|
692
|
+
*/
|
672
693
|
shouldConditionallyClear() {
|
673
694
|
// Skip if this component has clearOnHide set to false.
|
674
695
|
if (this.component.clearOnHide === false) {
|
@@ -690,6 +711,10 @@ export default class Component extends Element {
|
|
690
711
|
this._conditionallyClear = this.hasSetValue ? false : this.parentShouldConditionallyClear();
|
691
712
|
return this._conditionallyClear;
|
692
713
|
}
|
714
|
+
/**
|
715
|
+
* Returns if the component is conditionally hidden.
|
716
|
+
* @returns {boolean} - If the component is conditionally hidden.
|
717
|
+
*/
|
693
718
|
conditionallyHidden() {
|
694
719
|
// If it is logically hidden, then it is conditionally hidden.
|
695
720
|
if (this.logicallyHidden) {
|