@ngx-formly/core 6.1.4 → 6.1.5
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.field.mjs +2 -2
- package/esm2020/lib/extensions/field-expression/field-expression.mjs +25 -18
- package/esm2020/lib/extensions/field-form/field-form.mjs +4 -1
- package/esm2020/lib/utils.mjs +1 -1
- package/fesm2015/ngx-formly-core.mjs +28 -18
- package/fesm2015/ngx-formly-core.mjs.map +1 -1
- package/fesm2020/ngx-formly-core.mjs +28 -18
- package/fesm2020/ngx-formly-core.mjs.map +1 -1
- package/lib/utils.d.ts +1 -1
- package/package.json +1 -1
|
@@ -892,7 +892,7 @@ class FormlyField {
|
|
|
892
892
|
}
|
|
893
893
|
const subscribes = [
|
|
894
894
|
observeDeep(field, ['props'], () => field.options.detectChanges(field)),
|
|
895
|
-
observeDeep(field
|
|
895
|
+
observeDeep(field, ['options', 'formState'], () => field.options.detectChanges(field)),
|
|
896
896
|
];
|
|
897
897
|
for (const key of Object.keys(field._expressions || {})) {
|
|
898
898
|
const expressionObserver = observe(field, ['_expressions', key], ({ currentValue, previousValue }) => {
|
|
@@ -1685,28 +1685,35 @@ class FieldExpressionExtension {
|
|
|
1685
1685
|
}
|
|
1686
1686
|
}
|
|
1687
1687
|
evalExpr(field, prop, value) {
|
|
1688
|
-
try {
|
|
1689
|
-
let target = field;
|
|
1690
|
-
const paths = this._evalExpressionPath(field, prop);
|
|
1691
|
-
const lastIndex = paths.length - 1;
|
|
1692
|
-
for (let i = 0; i < lastIndex; i++) {
|
|
1693
|
-
target = target[paths[i]];
|
|
1694
|
-
}
|
|
1695
|
-
target[paths[lastIndex]] = value;
|
|
1696
|
-
}
|
|
1697
|
-
catch (error) {
|
|
1698
|
-
error.message = `[Formly Error] [Expression "${prop}"] ${error.message}`;
|
|
1699
|
-
throw error;
|
|
1700
|
-
}
|
|
1701
|
-
if (['templateOptions.disabled', 'props.disabled'].includes(prop) && hasKey(field)) {
|
|
1702
|
-
this.changeDisabledState(field, value);
|
|
1703
|
-
}
|
|
1704
1688
|
if (prop.indexOf('model.') === 0) {
|
|
1705
|
-
const key = prop.replace(/^model\./, ''),
|
|
1689
|
+
const key = prop.replace(/^model\./, ''), parent = field.fieldGroup ? field : field.parent;
|
|
1690
|
+
let control = field?.key === key ? field.formControl : field.form.get(key);
|
|
1691
|
+
if (!control && field.get(key)) {
|
|
1692
|
+
control = field.get(key).formControl;
|
|
1693
|
+
}
|
|
1694
|
+
assignFieldValue({ key, parent, model: field.model }, value);
|
|
1706
1695
|
if (control && !(isNil(control.value) && isNil(value)) && control.value !== value) {
|
|
1707
1696
|
control.patchValue(value);
|
|
1708
1697
|
}
|
|
1709
1698
|
}
|
|
1699
|
+
else {
|
|
1700
|
+
try {
|
|
1701
|
+
let target = field;
|
|
1702
|
+
const paths = this._evalExpressionPath(field, prop);
|
|
1703
|
+
const lastIndex = paths.length - 1;
|
|
1704
|
+
for (let i = 0; i < lastIndex; i++) {
|
|
1705
|
+
target = target[paths[i]];
|
|
1706
|
+
}
|
|
1707
|
+
target[paths[lastIndex]] = value;
|
|
1708
|
+
}
|
|
1709
|
+
catch (error) {
|
|
1710
|
+
error.message = `[Formly Error] [Expression "${prop}"] ${error.message}`;
|
|
1711
|
+
throw error;
|
|
1712
|
+
}
|
|
1713
|
+
if (['templateOptions.disabled', 'props.disabled'].includes(prop) && hasKey(field)) {
|
|
1714
|
+
this.changeDisabledState(field, value);
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1710
1717
|
this.emitExpressionChanges(field, prop, value);
|
|
1711
1718
|
}
|
|
1712
1719
|
emitExpressionChanges(field, property, value) {
|
|
@@ -1919,6 +1926,9 @@ class FieldFormExtension {
|
|
|
1919
1926
|
}
|
|
1920
1927
|
addFormControl(field) {
|
|
1921
1928
|
let control = findControl(field);
|
|
1929
|
+
if (field.fieldArray) {
|
|
1930
|
+
return;
|
|
1931
|
+
}
|
|
1922
1932
|
if (!control) {
|
|
1923
1933
|
const controlOptions = { updateOn: field.modelOptions.updateOn };
|
|
1924
1934
|
if (field.fieldGroup) {
|