@ngx-formly/core 6.1.7 → 6.1.8

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.
@@ -237,8 +237,17 @@ function observe(o, paths, setFn) {
237
237
  }
238
238
  }
239
239
  return {
240
- setValue(value) {
241
- state.value = value;
240
+ setValue(currentValue) {
241
+ if (currentValue === state.value) {
242
+ return;
243
+ }
244
+ const previousValue = state.value;
245
+ state.value = currentValue;
246
+ state.onChange.forEach((changeFn) => {
247
+ if (changeFn !== setFn) {
248
+ changeFn({ previousValue, currentValue, firstChange: false });
249
+ }
250
+ });
242
251
  },
243
252
  unsubscribe() {
244
253
  state.onChange = state.onChange.filter((changeFn) => changeFn !== setFn);
@@ -917,7 +926,7 @@ class FormlyField {
917
926
  expressionObserver.unsubscribe();
918
927
  });
919
928
  }
920
- for (const path of [['template'], ['fieldGroupClassName'], ['validation', 'show']]) {
929
+ for (const path of [['focus'], ['template'], ['fieldGroupClassName'], ['validation', 'show']]) {
921
930
  const fieldObserver = observe(field, path, ({ firstChange }) => !firstChange && field.options.detectChanges(field));
922
931
  subscribes.push(() => fieldObserver.unsubscribe());
923
932
  }
@@ -1279,6 +1288,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1279
1288
  }] } });
1280
1289
 
1281
1290
  class FieldType {
1291
+ constructor() {
1292
+ this.field = {};
1293
+ }
1282
1294
  set controls(controls) {
1283
1295
  const f = this.field;
1284
1296
  f._localFields = controls
@@ -1315,7 +1327,7 @@ class FieldType {
1315
1327
  return this.field.id;
1316
1328
  }
1317
1329
  get formState() {
1318
- return this.options.formState || {};
1330
+ return this.options?.formState || {};
1319
1331
  }
1320
1332
  }
1321
1333
  FieldType.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FieldType, deps: [], target: i0.ɵɵFactoryTarget.Directive });