@formio/js 5.0.0-dev.5902.bf899bf → 5.0.0-dev.5905.7719f60
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 +7 -7
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +7 -7
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +0 -15
- package/lib/cjs/components/_classes/component/Component.js +16 -50
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +2 -2
- package/lib/cjs/components/_classes/nested/NestedComponent.js +7 -16
- package/lib/cjs/components/datamap/DataMap.js +1 -1
- package/lib/cjs/components/editgrid/EditGrid.js +5 -2
- package/lib/cjs/components/form/Form.js +4 -4
- package/lib/cjs/components/html/HTML.js +3 -15
- package/lib/mjs/components/_classes/component/Component.d.ts +0 -15
- package/lib/mjs/components/_classes/component/Component.js +16 -50
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +2 -2
- package/lib/mjs/components/_classes/nested/NestedComponent.js +7 -16
- package/lib/mjs/components/datamap/DataMap.js +1 -1
- package/lib/mjs/components/editgrid/EditGrid.js +5 -2
- package/lib/mjs/components/form/Form.js +4 -4
- package/lib/mjs/components/html/HTML.js +3 -15
- package/package.json +1 -1
|
@@ -80,26 +80,17 @@ export default class NestedComponent extends Field {
|
|
|
80
80
|
const visibilityChanged = this._visible !== value;
|
|
81
81
|
this._visible = value;
|
|
82
82
|
const isVisible = this.visible;
|
|
83
|
-
const isConditionallyHidden = this.checkConditionallyHidden();
|
|
84
83
|
const forceShow = this.shouldForceShow();
|
|
85
84
|
const forceHide = this.shouldForceHide();
|
|
86
|
-
this.components.forEach(
|
|
85
|
+
this.components.forEach(component => {
|
|
87
86
|
// Set the parent visibility first since we may have nested components within nested components
|
|
88
87
|
// and they need to be able to determine their visibility based on the parent visibility.
|
|
89
88
|
component.parentVisible = isVisible;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (component.hasCondition()) {
|
|
93
|
-
component._conditionallyHidden = component.checkConditionallyHidden() || component._parentConditionallyHidden;
|
|
94
|
-
visible = !component.conditionallyHidden;
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
visible = !component.component.hidden;
|
|
98
|
-
}
|
|
99
|
-
if (forceShow || visible) {
|
|
89
|
+
const conditionallyVisible = component.conditionallyVisible();
|
|
90
|
+
if (forceShow || conditionallyVisible) {
|
|
100
91
|
component.visible = true;
|
|
101
92
|
}
|
|
102
|
-
else if (forceHide || !isVisible || !
|
|
93
|
+
else if (forceHide || !isVisible || !conditionallyVisible) {
|
|
103
94
|
component.visible = false;
|
|
104
95
|
}
|
|
105
96
|
// If hiding a nested component, clear all errors below.
|
|
@@ -108,6 +99,7 @@ export default class NestedComponent extends Field {
|
|
|
108
99
|
}
|
|
109
100
|
});
|
|
110
101
|
if (visibilityChanged) {
|
|
102
|
+
this.clearOnHide();
|
|
111
103
|
this.redraw();
|
|
112
104
|
}
|
|
113
105
|
}
|
|
@@ -388,7 +380,6 @@ export default class NestedComponent extends Field {
|
|
|
388
380
|
data = data || this.data;
|
|
389
381
|
options.parent = this;
|
|
390
382
|
options.parentVisible = this.visible;
|
|
391
|
-
options.parentConditionallyHidden = this.conditionallyHidden;
|
|
392
383
|
options.root = options?.root || this.root || this;
|
|
393
384
|
options.localRoot = this.localRoot;
|
|
394
385
|
options.skipInit = true;
|
|
@@ -647,7 +638,7 @@ export default class NestedComponent extends Field {
|
|
|
647
638
|
clearOnHide(show) {
|
|
648
639
|
super.clearOnHide(show);
|
|
649
640
|
if (this.component.clearOnHide) {
|
|
650
|
-
if (this.allowData && !this.hasValue() && !this.
|
|
641
|
+
if (this.allowData && !this.hasValue() && !(this.options.server && !this.visible)) {
|
|
651
642
|
this.dataValue = this.defaultValue;
|
|
652
643
|
}
|
|
653
644
|
if (this.hasValue()) {
|
|
@@ -676,7 +667,7 @@ export default class NestedComponent extends Field {
|
|
|
676
667
|
}
|
|
677
668
|
calculateValue(data, flags, row) {
|
|
678
669
|
// Do not iterate into children and calculateValues if this nested component is conditionally hidden.
|
|
679
|
-
if (this.
|
|
670
|
+
if (!this.conditionallyVisible()) {
|
|
680
671
|
return false;
|
|
681
672
|
}
|
|
682
673
|
return this.getComponents().reduce((changed, comp) => comp.calculateValue(data, flags, row) || changed, super.calculateValue(data, flags, row));
|
|
@@ -70,7 +70,7 @@ export default class DataMapComponent extends DataGridComponent {
|
|
|
70
70
|
}
|
|
71
71
|
get dataValue() {
|
|
72
72
|
if (!this.key ||
|
|
73
|
-
(this.
|
|
73
|
+
(!this.visible && this.component.clearOnHide)) {
|
|
74
74
|
return this.emptyValue;
|
|
75
75
|
}
|
|
76
76
|
if (!this.hasValue() && this.shouldAddDefaultValue) {
|
|
@@ -1139,7 +1139,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
1139
1139
|
}
|
|
1140
1140
|
}
|
|
1141
1141
|
const changed = this.hasChanged(value, this.dataValue);
|
|
1142
|
-
if (this.parent) {
|
|
1142
|
+
if (this.parent && !this.options.server) {
|
|
1143
1143
|
this.parent.checkComponentConditions();
|
|
1144
1144
|
}
|
|
1145
1145
|
this.dataValue = value;
|
|
@@ -1172,7 +1172,10 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
1172
1172
|
this.editRows = this.editRows.slice(0, dataLength);
|
|
1173
1173
|
this.openWhenEmpty();
|
|
1174
1174
|
this.updateOnChange(flags, changed);
|
|
1175
|
-
|
|
1175
|
+
// do not call checkData with server option, it is called when change is triggered in updateOnChange
|
|
1176
|
+
if (!this.options.server) {
|
|
1177
|
+
this.checkData();
|
|
1178
|
+
}
|
|
1176
1179
|
this.changeState(changed, flags);
|
|
1177
1180
|
return changed;
|
|
1178
1181
|
}
|
|
@@ -417,10 +417,10 @@ export default class FormComponent extends Component {
|
|
|
417
417
|
return this.subFormReady;
|
|
418
418
|
}
|
|
419
419
|
hideSubmitButton(component) {
|
|
420
|
-
const isSubmitButton = component.type === 'button' &&
|
|
420
|
+
const isSubmitButton = (component.type === 'button') &&
|
|
421
|
+
((component.action === 'submit') || !component.action);
|
|
421
422
|
if (isSubmitButton) {
|
|
422
423
|
component.hidden = true;
|
|
423
|
-
component.customConditional = 'show = false';
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
/**
|
|
@@ -429,7 +429,7 @@ export default class FormComponent extends Component {
|
|
|
429
429
|
* @returns {Promise} - The promise that resolves when the subform is loaded.
|
|
430
430
|
*/
|
|
431
431
|
loadSubForm(fromAttach) {
|
|
432
|
-
if (this.builderMode || this.
|
|
432
|
+
if (this.builderMode || this.isHidden() || (this.isSubFormLazyLoad() && !fromAttach)) {
|
|
433
433
|
return Promise.resolve();
|
|
434
434
|
}
|
|
435
435
|
if (this.hasLoadedForm && !this.isRevisionChanged &&
|
|
@@ -512,7 +512,7 @@ export default class FormComponent extends Component {
|
|
|
512
512
|
* @returns {*|boolean} - TRUE if the subform should be submitted, FALSE if it should not.
|
|
513
513
|
*/
|
|
514
514
|
get shouldSubmit() {
|
|
515
|
-
return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && !this.
|
|
515
|
+
return this.subFormReady && (!this.component.hasOwnProperty('reference') || this.component.reference) && !this.isHidden();
|
|
516
516
|
}
|
|
517
517
|
/**
|
|
518
518
|
* Returns the data for the subform.
|
|
@@ -51,21 +51,9 @@ export default class HTMLComponent extends Component {
|
|
|
51
51
|
}
|
|
52
52
|
checkRefreshOn(changed) {
|
|
53
53
|
super.checkRefreshOn(changed);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
this.
|
|
57
|
-
visible = !this.conditionallyHidden;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
visible = !this.component.hidden;
|
|
61
|
-
}
|
|
62
|
-
const shouldSetContent = !this.builderMode
|
|
63
|
-
&& this.component.refreshOnChange
|
|
64
|
-
&& this.element
|
|
65
|
-
&& !_.isUndefined(changed)
|
|
66
|
-
&& ((_.isBoolean(changed) && changed) || !_.isEmpty(changed))
|
|
67
|
-
&& visible;
|
|
68
|
-
if (shouldSetContent) {
|
|
54
|
+
if (!this.builderMode && this.component.refreshOnChange && this.element &&
|
|
55
|
+
!_.isUndefined(changed) && ((_.isBoolean(changed) && changed) || !_.isEmpty(changed)) &&
|
|
56
|
+
this.conditionallyVisible(this.data, this.row)) {
|
|
69
57
|
this.setContent(this.element, this.renderContent());
|
|
70
58
|
}
|
|
71
59
|
}
|