@ngx-formly/core 5.10.26 → 5.10.27

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.
@@ -1007,13 +1007,18 @@
1007
1007
  emitEvent = false;
1008
1008
  }
1009
1009
  /** @type {?} */
1010
- var form = ( /** @type {?} */(field.formControl.parent));
1010
+ var control = field.formControl;
1011
+ /** @type {?} */
1012
+ var fieldIndex = control['_fields'] ? control['_fields'].indexOf(field) : -1;
1013
+ if (fieldIndex !== -1) {
1014
+ control['_fields'].splice(fieldIndex, 1);
1015
+ }
1016
+ /** @type {?} */
1017
+ var form = ( /** @type {?} */(control.parent));
1011
1018
  if (!form) {
1012
1019
  return;
1013
1020
  }
1014
1021
  /** @type {?} */
1015
- var control = field.formControl;
1016
- /** @type {?} */
1017
1022
  var opts = { emitEvent: emitEvent };
1018
1023
  if (form instanceof forms.FormArray) {
1019
1024
  /** @type {?} */
@@ -1192,6 +1197,8 @@
1192
1197
  */
1193
1198
  function clearControl(form) {
1194
1199
  form['_fields'] && delete form['_fields'];
1200
+ form.setValidators(null);
1201
+ form.setAsyncValidators(null);
1195
1202
  if (form instanceof forms.FormGroup || form instanceof forms.FormArray) {
1196
1203
  Object.keys(form.controls)
1197
1204
  .forEach(( /**
@@ -3083,6 +3090,17 @@
3083
3090
  */
3084
3091
  function (field, hide, resetOnHide) {
3085
3092
  var _this = this;
3093
+ if (field.fieldGroup) {
3094
+ field.fieldGroup
3095
+ .filter(( /**
3096
+ * @param {?} f
3097
+ * @return {?}
3098
+ */function (f) { return !f.hideExpression; }))
3099
+ .forEach(( /**
3100
+ * @param {?} f
3101
+ * @return {?}
3102
+ */function (f) { return _this.toggleFormControl(f, hide, resetOnHide); }));
3103
+ }
3086
3104
  if (field.formControl && field.key) {
3087
3105
  defineHiddenProp(field, '_hide', !!(hide || field.hide));
3088
3106
  /** @type {?} */
@@ -3115,17 +3133,6 @@
3115
3133
  }
3116
3134
  }
3117
3135
  }
3118
- if (field.fieldGroup) {
3119
- field.fieldGroup
3120
- .filter(( /**
3121
- * @param {?} f
3122
- * @return {?}
3123
- */function (f) { return !f.hideExpression; }))
3124
- .forEach(( /**
3125
- * @param {?} f
3126
- * @return {?}
3127
- */function (f) { return _this.toggleFormControl(f, hide, resetOnHide); }));
3128
- }
3129
3136
  if (field.options.fieldChanges) {
3130
3137
  field.options.fieldChanges.next(( /** @type {?} */({ field: field, type: 'hidden', value: hide })));
3131
3138
  }