@ngx-formly/core 6.3.9 → 6.3.11
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/esm2020/lib/components/formly.form.mjs +4 -5
- package/esm2020/lib/extensions/field-expression/field-expression.mjs +4 -4
- package/esm2020/lib/models/fieldconfig.cache.mjs +1 -1
- package/esm2020/lib/services/formly.builder.mjs +3 -3
- package/esm2020/lib/templates/field-array.type.mjs +2 -2
- package/esm2020/lib/utils.mjs +2 -2
- package/fesm2015/ngx-formly-core.mjs +10 -10
- package/fesm2015/ngx-formly-core.mjs.map +1 -1
- package/fesm2020/ngx-formly-core.mjs +9 -10
- package/fesm2020/ngx-formly-core.mjs.map +1 -1
- package/lib/models/fieldconfig.cache.d.ts +4 -1
- package/package.json +1 -1
|
@@ -133,7 +133,7 @@ function clone(value) {
|
|
|
133
133
|
isObservable(value) ||
|
|
134
134
|
value instanceof TemplateRef ||
|
|
135
135
|
/* instanceof SafeHtmlImpl */ value.changingThisBreaksApplicationSecurity ||
|
|
136
|
-
['RegExp', 'FileList', 'File', 'Blob'].indexOf(value.constructor
|
|
136
|
+
['RegExp', 'FileList', 'File', 'Blob'].indexOf(value.constructor?.name) !== -1) {
|
|
137
137
|
return value;
|
|
138
138
|
}
|
|
139
139
|
if (value instanceof Set) {
|
|
@@ -569,7 +569,7 @@ class FormlyFormBuilder {
|
|
|
569
569
|
if (field.parent && isHiddenField(field)) {
|
|
570
570
|
// when hide is used in expression set defaul value will not be set until detect hide changes
|
|
571
571
|
// which causes default value not set on new item is added
|
|
572
|
-
options._hiddenFieldsForCheck?.push(field);
|
|
572
|
+
options._hiddenFieldsForCheck?.push({ field, default: false });
|
|
573
573
|
}
|
|
574
574
|
options.checkExpressions?.(field, true);
|
|
575
575
|
options._detectChanges?.(field);
|
|
@@ -1114,16 +1114,15 @@ class FormlyForm {
|
|
|
1114
1114
|
}
|
|
1115
1115
|
});
|
|
1116
1116
|
}
|
|
1117
|
-
let fieldChangesDetection = [
|
|
1117
|
+
let fieldChangesDetection = [
|
|
1118
|
+
observeDeep(this.field.options, ['formState'], () => this.field.options.detectChanges(this.field)),
|
|
1119
|
+
];
|
|
1118
1120
|
const valueChanges = this.field.options.fieldChanges
|
|
1119
1121
|
.pipe(filter(({ field, type }) => hasKey(field) && type === 'valueChanges'), switchMap(() => (isNoopNgZone(this.ngZone) ? of(null) : this.ngZone.onStable.asObservable().pipe(take(1)))))
|
|
1120
1122
|
.subscribe(() => this.ngZone.runGuarded(() => {
|
|
1121
1123
|
// runGuarded is used to keep in sync the expression changes
|
|
1122
1124
|
// https://github.com/ngx-formly/ngx-formly/issues/2095
|
|
1123
1125
|
this.checkExpressionChange();
|
|
1124
|
-
if (this.field.options) {
|
|
1125
|
-
fieldChangesDetection.push(observeDeep(this.field.options, ['formState'], () => this.field.options.detectChanges(this.field)));
|
|
1126
|
-
}
|
|
1127
1126
|
this.modelChange.emit((this._modelChangeValue = clone(this.model)));
|
|
1128
1127
|
}));
|
|
1129
1128
|
return () => {
|
|
@@ -1555,7 +1554,7 @@ class FieldArrayType extends FieldType {
|
|
|
1555
1554
|
}
|
|
1556
1555
|
f.fieldGroup?.forEach((c) => this.markFieldForCheck(c));
|
|
1557
1556
|
if (f.hide === false) {
|
|
1558
|
-
this.options._hiddenFieldsForCheck.push(f);
|
|
1557
|
+
this.options._hiddenFieldsForCheck.push({ field: f });
|
|
1559
1558
|
}
|
|
1560
1559
|
}
|
|
1561
1560
|
}
|
|
@@ -1641,7 +1640,7 @@ class FieldExpressionExtension {
|
|
|
1641
1640
|
defineHiddenProp(field, '_hide', !!currentValue);
|
|
1642
1641
|
if (!firstChange || (firstChange && currentValue === true)) {
|
|
1643
1642
|
field.props.hidden = currentValue;
|
|
1644
|
-
field.options._hiddenFieldsForCheck.push(field);
|
|
1643
|
+
field.options._hiddenFieldsForCheck.push({ field });
|
|
1645
1644
|
}
|
|
1646
1645
|
});
|
|
1647
1646
|
if (field.hideExpression) {
|
|
@@ -1687,8 +1686,8 @@ class FieldExpressionExtension {
|
|
|
1687
1686
|
const fieldChanged = this.checkExpressions(f, ignoreCache);
|
|
1688
1687
|
const options = field.options;
|
|
1689
1688
|
options._hiddenFieldsForCheck
|
|
1690
|
-
.sort((f) => (f.hide ? -1 : 1))
|
|
1691
|
-
.forEach((f) => this.changeHideState(f, f.hide, !ignoreCache));
|
|
1689
|
+
.sort((f) => (f.field.hide ? -1 : 1))
|
|
1690
|
+
.forEach((f) => this.changeHideState(f.field, f.field.hide ?? f.default, !ignoreCache));
|
|
1692
1691
|
options._hiddenFieldsForCheck = [];
|
|
1693
1692
|
if (fieldChanged) {
|
|
1694
1693
|
this.checkExpressions(field);
|