@formio/js 5.1.0-dev.6040.debc859 → 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.
- package/dist/formio.form.js +8 -8
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +9 -9
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/WebformBuilder.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +4 -15
- package/lib/cjs/components/_classes/component/Component.js +35 -57
- package/lib/cjs/components/_classes/nested/NestedComponent.js +3 -7
- package/lib/cjs/components/datamap/DataMap.js +2 -6
- package/lib/cjs/components/editgrid/EditGrid.js +0 -4
- package/lib/cjs/components/form/Form.js +2 -2
- package/lib/cjs/components/html/HTML.js +1 -2
- package/lib/cjs/components/radio/Radio.js +1 -1
- package/lib/cjs/components/tabs/Tabs.js +1 -0
- package/lib/mjs/WebformBuilder.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +4 -15
- package/lib/mjs/components/_classes/component/Component.js +35 -57
- package/lib/mjs/components/_classes/nested/NestedComponent.js +3 -7
- package/lib/mjs/components/datamap/DataMap.js +2 -6
- package/lib/mjs/components/editgrid/EditGrid.js +0 -4
- package/lib/mjs/components/form/Form.js +2 -2
- package/lib/mjs/components/html/HTML.js +1 -2
- package/lib/mjs/components/radio/Radio.js +1 -1
- package/lib/mjs/components/tabs/Tabs.js +1 -0
- package/package.json +1 -1
@@ -81,18 +81,15 @@ 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
|
-
const isConditionallyHidden = this.checkConditionallyHidden();
|
85
84
|
const forceShow = this.shouldForceShow();
|
86
85
|
const forceHide = this.shouldForceHide();
|
87
86
|
this.components.forEach((component) => {
|
88
87
|
// Set the parent visibility first since we may have nested components within nested components
|
89
88
|
// and they need to be able to determine their visibility based on the parent visibility.
|
90
89
|
component.parentVisible = isVisible;
|
91
|
-
component._parentConditionallyHidden = isConditionallyHidden;
|
92
90
|
let visible;
|
93
91
|
if (component.hasCondition()) {
|
94
|
-
|
95
|
-
visible = !component.conditionallyHidden;
|
92
|
+
visible = !component.conditionallyHidden();
|
96
93
|
}
|
97
94
|
else {
|
98
95
|
visible = !component.component.hidden;
|
@@ -373,7 +370,6 @@ export default class NestedComponent extends Field {
|
|
373
370
|
data = data || this.data;
|
374
371
|
options.parent = this;
|
375
372
|
options.parentVisible = this.visible;
|
376
|
-
options.parentConditionallyHidden = this.conditionallyHidden;
|
377
373
|
options.root = options?.root || this.root || this;
|
378
374
|
options.localRoot = this.localRoot;
|
379
375
|
options.skipInit = true;
|
@@ -632,7 +628,7 @@ export default class NestedComponent extends Field {
|
|
632
628
|
clearOnHide(show) {
|
633
629
|
super.clearOnHide(show);
|
634
630
|
if (this.component.clearOnHide) {
|
635
|
-
if (this.allowData && !this.hasValue() && !this.conditionallyHidden) {
|
631
|
+
if (this.allowData && !this.hasValue() && !this.conditionallyHidden()) {
|
636
632
|
this.dataValue = this.defaultValue;
|
637
633
|
}
|
638
634
|
if (this.hasValue()) {
|
@@ -661,7 +657,7 @@ export default class NestedComponent extends Field {
|
|
661
657
|
}
|
662
658
|
calculateValue(data, flags, row) {
|
663
659
|
// Do not iterate into children and calculateValues if this nested component is conditionally hidden.
|
664
|
-
if (this.conditionallyHidden) {
|
660
|
+
if (this.conditionallyHidden()) {
|
665
661
|
return false;
|
666
662
|
}
|
667
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
|
-
|
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;
|
@@ -1150,9 +1150,6 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1150
1150
|
}
|
1151
1151
|
}
|
1152
1152
|
const changed = this.hasChanged(value, this.dataValue);
|
1153
|
-
if (this.parent) {
|
1154
|
-
this.parent.checkComponentConditions();
|
1155
|
-
}
|
1156
1153
|
this.dataValue = value;
|
1157
1154
|
// Refresh editRow data when data changes.
|
1158
1155
|
this.dataValue.forEach((row, rowIndex) => {
|
@@ -1183,7 +1180,6 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1183
1180
|
this.editRows = this.editRows.slice(0, dataLength);
|
1184
1181
|
this.openWhenEmpty();
|
1185
1182
|
this.updateOnChange(flags, changed);
|
1186
|
-
this.checkData();
|
1187
1183
|
this.changeState(changed, flags);
|
1188
1184
|
return changed;
|
1189
1185
|
}
|
@@ -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,8 +53,7 @@ export default class HTMLComponent extends Component {
|
|
53
53
|
super.checkRefreshOn(changed);
|
54
54
|
let visible;
|
55
55
|
if (this.hasCondition()) {
|
56
|
-
|
57
|
-
visible = !this.conditionallyHidden;
|
56
|
+
visible = !this.conditionallyHidden();
|
58
57
|
}
|
59
58
|
else {
|
60
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);
|
@@ -138,6 +138,7 @@ export default class TabsComponent extends NestedComponent {
|
|
138
138
|
this.addClass(this.refs[this.tabLinkKey][index], 'active');
|
139
139
|
this.addClass(this.refs[this.tabLinkKey][index], 'formio-tab-link-active');
|
140
140
|
}
|
141
|
+
this.setValue(this.data);
|
141
142
|
this.triggerChange();
|
142
143
|
}
|
143
144
|
beforeFocus(component) {
|