@ngx-formly/core 5.10.29 → 5.10.30

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.
@@ -331,28 +331,6 @@ function wrapProperty(o, prop, setFn) {
331
331
  */
332
332
  function () { return fns.splice(fns.indexOf(setFn), 1); });
333
333
  }
334
- /**
335
- * @param {?} form
336
- * @param {?} action
337
- * @return {?}
338
- */
339
- function reduceFormUpdateValidityCalls(form, action) {
340
- /** @type {?} */
341
- var updateValidity = form._updateTreeValidity.bind(form);
342
- /** @type {?} */
343
- var updateValidityArgs = { called: false, emitEvent: false };
344
- form._updateTreeValidity = (/**
345
- * @param {?=} __0
346
- * @return {?}
347
- */
348
- function (_a) {
349
- var emitEvent = (_a === void 0 ? { emitEvent: true } : _a).emitEvent;
350
- return updateValidityArgs = { called: true, emitEvent: emitEvent || updateValidityArgs.emitEvent };
351
- });
352
- action();
353
- updateValidityArgs.called && updateValidity({ emitEvent: updateValidityArgs.emitEvent });
354
- form._updateTreeValidity = updateValidity;
355
- }
356
334
 
357
335
  /**
358
336
  * @fileoverview added by tsickle
@@ -734,17 +712,13 @@ var FormlyFormBuilder = /** @class */ (function () {
734
712
  * @return {?}
735
713
  */
736
714
  function (formControl, fieldGroup, model, options) {
737
- var _this = this;
738
715
  if (fieldGroup === void 0) { fieldGroup = []; }
739
716
  if (!this.formlyConfig.extensions.core) {
740
717
  throw new Error('NgxFormly: missing `forRoot()` call. use `forRoot()` when registering the `FormlyModule`.');
741
718
  }
742
719
  /** @type {?} */
743
720
  var field = { fieldGroup: fieldGroup, model: model, formControl: formControl, options: this._setOptions(options) };
744
- reduceFormUpdateValidityCalls(formControl, (/**
745
- * @return {?}
746
- */
747
- function () { return _this._buildForm(field); }));
721
+ this._buildForm(field);
748
722
  field.options._checkField(field, true);
749
723
  };
750
724
  /**
@@ -1028,15 +1002,22 @@ function registerControl(field, control, emitEvent) {
1028
1002
  }
1029
1003
  /**
1030
1004
  * @param {?} c
1005
+ * @param {?=} onlySelf
1031
1006
  * @return {?}
1032
1007
  */
1033
- function updateValidity(c) {
1008
+ function updateValidity(c, onlySelf) {
1009
+ if (onlySelf === void 0) { onlySelf = false; }
1034
1010
  /** @type {?} */
1035
1011
  var status = c.status;
1036
- c.updateValueAndValidity({ emitEvent: false });
1012
+ /** @type {?} */
1013
+ var value = c.value;
1014
+ c.updateValueAndValidity({ emitEvent: false, onlySelf: onlySelf });
1037
1015
  if (status !== c.status) {
1038
1016
  ((/** @type {?} */ (c.statusChanges))).emit(c.status);
1039
1017
  }
1018
+ if (value !== c.value) {
1019
+ ((/** @type {?} */ (c.valueChanges))).emit(c.value);
1020
+ }
1040
1021
  }
1041
1022
  /**
1042
1023
  * @param {?} form
@@ -2693,10 +2674,7 @@ FieldExpressionExtension = /** @class */ (function () {
2693
2674
  function (f, ignoreCache) {
2694
2675
  if (!checkLocked) {
2695
2676
  checkLocked = true;
2696
- reduceFormUpdateValidityCalls(f.formControl, (/**
2697
- * @return {?}
2698
- */
2699
- function () { return _this.checkField(f, ignoreCache); }));
2677
+ _this.checkField(f, ignoreCache);
2700
2678
  checkLocked = false;
2701
2679
  }
2702
2680
  });
@@ -3498,22 +3476,7 @@ FieldFormExtension = /** @class */ (function () {
3498
3476
  if (field.parent) {
3499
3477
  return;
3500
3478
  }
3501
- /** @type {?} */
3502
- var fieldsToUpdate = this.setValidators(field);
3503
- if (fieldsToUpdate.length === 0) {
3504
- return;
3505
- }
3506
- if (fieldsToUpdate.length === 1) {
3507
- /** @type {?} */
3508
- var control = fieldsToUpdate[0].formControl;
3509
- while (control) {
3510
- ((/** @type {?} */ (control)))._updateTreeValidity({ onlySelf: true });
3511
- control = control.parent;
3512
- }
3513
- }
3514
- else {
3515
- ((/** @type {?} */ (field.formControl)))._updateTreeValidity();
3516
- }
3479
+ this.setValidators(field);
3517
3480
  };
3518
3481
  /**
3519
3482
  * @private
@@ -3564,7 +3527,12 @@ FieldFormExtension = /** @class */ (function () {
3564
3527
  function (field) {
3565
3528
  var _this = this;
3566
3529
  /** @type {?} */
3567
- var updateValidity$$1 = false;
3530
+ var markForCheck = false;
3531
+ (field.fieldGroup || []).forEach((/**
3532
+ * @param {?} f
3533
+ * @return {?}
3534
+ */
3535
+ function (f) { return _this.setValidators(f) && (markForCheck = true); }));
3568
3536
  if (field.key || !field.parent || (!field.key && !field.fieldGroup)) {
3569
3537
  var c_1 = field.formControl;
3570
3538
  /** @type {?} */
@@ -3572,21 +3540,11 @@ FieldFormExtension = /** @class */ (function () {
3572
3540
  if (field.key && c_1) {
3573
3541
  if (disabled && c_1.enabled) {
3574
3542
  c_1.disable({ emitEvent: false, onlySelf: true });
3575
- if (!c_1.parent) {
3576
- updateValidity(c_1);
3577
- }
3578
- else {
3579
- updateValidity$$1 = true;
3580
- }
3543
+ markForCheck = true;
3581
3544
  }
3582
3545
  if (!disabled && c_1.disabled) {
3583
3546
  c_1.enable({ emitEvent: false, onlySelf: true });
3584
- if (!c_1.parent) {
3585
- updateValidity(c_1);
3586
- }
3587
- else {
3588
- updateValidity$$1 = true;
3589
- }
3547
+ markForCheck = true;
3590
3548
  }
3591
3549
  }
3592
3550
  if (c_1 && (null === c_1.validator || null === c_1.asyncValidator)) {
@@ -3606,28 +3564,13 @@ FieldFormExtension = /** @class */ (function () {
3606
3564
  var v = Validators.composeAsync(_this.mergeValidators(field, '_asyncValidators'));
3607
3565
  return v ? v(c_1) : of(null);
3608
3566
  }));
3609
- if (!c_1.parent) {
3610
- updateValidity(c_1);
3611
- }
3612
- else {
3613
- updateValidity$$1 = true;
3614
- }
3567
+ markForCheck = true;
3615
3568
  }
3616
- }
3617
- /** @type {?} */
3618
- var fieldsToUpdate = updateValidity$$1 ? [field] : [];
3619
- (field.fieldGroup || []).forEach((/**
3620
- * @param {?} f
3621
- * @return {?}
3622
- */
3623
- function (f) {
3624
- /** @type {?} */
3625
- var childrenToUpdate = _this.setValidators(f);
3626
- if (!updateValidity$$1) {
3627
- fieldsToUpdate.push.apply(fieldsToUpdate, __spread(childrenToUpdate));
3569
+ if (markForCheck) {
3570
+ updateValidity(c_1, true);
3628
3571
  }
3629
- }));
3630
- return fieldsToUpdate;
3572
+ }
3573
+ return markForCheck;
3631
3574
  };
3632
3575
  /**
3633
3576
  * @private