@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.
@@ -421,27 +421,6 @@
421
421
  * @return {?}
422
422
  */function () { return fns.splice(fns.indexOf(setFn), 1); });
423
423
  }
424
- /**
425
- * @param {?} form
426
- * @param {?} action
427
- * @return {?}
428
- */
429
- function reduceFormUpdateValidityCalls(form, action) {
430
- /** @type {?} */
431
- var updateValidity = form._updateTreeValidity.bind(form);
432
- /** @type {?} */
433
- var updateValidityArgs = { called: false, emitEvent: false };
434
- form._updateTreeValidity = ( /**
435
- * @param {?=} __0
436
- * @return {?}
437
- */function (_a) {
438
- var emitEvent = (_a === void 0 ? { emitEvent: true } : _a).emitEvent;
439
- return updateValidityArgs = { called: true, emitEvent: emitEvent || updateValidityArgs.emitEvent };
440
- });
441
- action();
442
- updateValidityArgs.called && updateValidity({ emitEvent: updateValidityArgs.emitEvent });
443
- form._updateTreeValidity = updateValidity;
444
- }
445
424
 
446
425
  /**
447
426
  * @fileoverview added by tsickle
@@ -816,7 +795,6 @@
816
795
  * @return {?}
817
796
  */
818
797
  function (formControl, fieldGroup, model, options) {
819
- var _this = this;
820
798
  if (fieldGroup === void 0) {
821
799
  fieldGroup = [];
822
800
  }
@@ -825,9 +803,7 @@
825
803
  }
826
804
  /** @type {?} */
827
805
  var field = { fieldGroup: fieldGroup, model: model, formControl: formControl, options: this._setOptions(options) };
828
- reduceFormUpdateValidityCalls(formControl, ( /**
829
- * @return {?}
830
- */function () { return _this._buildForm(field); }));
806
+ this._buildForm(field);
831
807
  field.options._checkField(field, true);
832
808
  };
833
809
  /**
@@ -1101,15 +1077,24 @@
1101
1077
  }
1102
1078
  /**
1103
1079
  * @param {?} c
1080
+ * @param {?=} onlySelf
1104
1081
  * @return {?}
1105
1082
  */
1106
- function updateValidity(c) {
1083
+ function updateValidity(c, onlySelf) {
1084
+ if (onlySelf === void 0) {
1085
+ onlySelf = false;
1086
+ }
1107
1087
  /** @type {?} */
1108
1088
  var status = c.status;
1109
- c.updateValueAndValidity({ emitEvent: false });
1089
+ /** @type {?} */
1090
+ var value = c.value;
1091
+ c.updateValueAndValidity({ emitEvent: false, onlySelf: onlySelf });
1110
1092
  if (status !== c.status) {
1111
1093
  (( /** @type {?} */(c.statusChanges))).emit(c.status);
1112
1094
  }
1095
+ if (value !== c.value) {
1096
+ (( /** @type {?} */(c.valueChanges))).emit(c.value);
1097
+ }
1113
1098
  }
1114
1099
  /**
1115
1100
  * @param {?} form
@@ -2719,9 +2704,7 @@
2719
2704
  */function (f, ignoreCache) {
2720
2705
  if (!checkLocked) {
2721
2706
  checkLocked = true;
2722
- reduceFormUpdateValidityCalls(f.formControl, ( /**
2723
- * @return {?}
2724
- */function () { return _this.checkField(f, ignoreCache); }));
2707
+ _this.checkField(f, ignoreCache);
2725
2708
  checkLocked = false;
2726
2709
  }
2727
2710
  });
@@ -3499,22 +3482,7 @@
3499
3482
  if (field.parent) {
3500
3483
  return;
3501
3484
  }
3502
- /** @type {?} */
3503
- var fieldsToUpdate = this.setValidators(field);
3504
- if (fieldsToUpdate.length === 0) {
3505
- return;
3506
- }
3507
- if (fieldsToUpdate.length === 1) {
3508
- /** @type {?} */
3509
- var control = fieldsToUpdate[0].formControl;
3510
- while (control) {
3511
- (( /** @type {?} */(control)))._updateTreeValidity({ onlySelf: true });
3512
- control = control.parent;
3513
- }
3514
- }
3515
- else {
3516
- (( /** @type {?} */(field.formControl)))._updateTreeValidity();
3517
- }
3485
+ this.setValidators(field);
3518
3486
  };
3519
3487
  /**
3520
3488
  * @private
@@ -3565,7 +3533,11 @@
3565
3533
  function (field) {
3566
3534
  var _this = this;
3567
3535
  /** @type {?} */
3568
- var updateValidity$$1 = false;
3536
+ var markForCheck = false;
3537
+ (field.fieldGroup || []).forEach(( /**
3538
+ * @param {?} f
3539
+ * @return {?}
3540
+ */function (f) { return _this.setValidators(f) && (markForCheck = true); }));
3569
3541
  if (field.key || !field.parent || (!field.key && !field.fieldGroup)) {
3570
3542
  var c_1 = field.formControl;
3571
3543
  /** @type {?} */
@@ -3573,21 +3545,11 @@
3573
3545
  if (field.key && c_1) {
3574
3546
  if (disabled && c_1.enabled) {
3575
3547
  c_1.disable({ emitEvent: false, onlySelf: true });
3576
- if (!c_1.parent) {
3577
- updateValidity(c_1);
3578
- }
3579
- else {
3580
- updateValidity$$1 = true;
3581
- }
3548
+ markForCheck = true;
3582
3549
  }
3583
3550
  if (!disabled && c_1.disabled) {
3584
3551
  c_1.enable({ emitEvent: false, onlySelf: true });
3585
- if (!c_1.parent) {
3586
- updateValidity(c_1);
3587
- }
3588
- else {
3589
- updateValidity$$1 = true;
3590
- }
3552
+ markForCheck = true;
3591
3553
  }
3592
3554
  }
3593
3555
  if (c_1 && (null === c_1.validator || null === c_1.asyncValidator)) {
@@ -3605,27 +3567,13 @@
3605
3567
  var v = forms.Validators.composeAsync(_this.mergeValidators(field, '_asyncValidators'));
3606
3568
  return v ? v(c_1) : rxjs.of(null);
3607
3569
  }));
3608
- if (!c_1.parent) {
3609
- updateValidity(c_1);
3610
- }
3611
- else {
3612
- updateValidity$$1 = true;
3613
- }
3570
+ markForCheck = true;
3614
3571
  }
3615
- }
3616
- /** @type {?} */
3617
- var fieldsToUpdate = updateValidity$$1 ? [field] : [];
3618
- (field.fieldGroup || []).forEach(( /**
3619
- * @param {?} f
3620
- * @return {?}
3621
- */function (f) {
3622
- /** @type {?} */
3623
- var childrenToUpdate = _this.setValidators(f);
3624
- if (!updateValidity$$1) {
3625
- fieldsToUpdate.push.apply(fieldsToUpdate, __spread(childrenToUpdate));
3572
+ if (markForCheck) {
3573
+ updateValidity(c_1, true);
3626
3574
  }
3627
- }));
3628
- return fieldsToUpdate;
3575
+ }
3576
+ return markForCheck;
3629
3577
  };
3630
3578
  /**
3631
3579
  * @private