@ngx-formly/core 5.10.31 → 5.11.0

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.
@@ -127,8 +127,12 @@
127
127
  return field.id;
128
128
  /** @type {?} */
129
129
  var type = field.type;
130
- if (!type && field.template)
130
+ if (!type && field.template) {
131
131
  type = 'template';
132
+ }
133
+ if (isFunction(type)) {
134
+ type = (( /** @type {?} */(type))).prototype.constructor.name;
135
+ }
132
136
  return [formId, type, field.key, index].join('_');
133
137
  }
134
138
  /**
@@ -2153,6 +2157,24 @@
2153
2157
  this.to.blur(this.field, $event);
2154
2158
  }
2155
2159
  };
2160
+ // handle custom `change` event, for regular ones rely on DOM listener
2161
+ // handle custom `change` event, for regular ones rely on DOM listener
2162
+ /**
2163
+ * @param {?} $event
2164
+ * @return {?}
2165
+ */
2166
+ FormlyAttributes.prototype.onHostChange =
2167
+ // handle custom `change` event, for regular ones rely on DOM listener
2168
+ /**
2169
+ * @param {?} $event
2170
+ * @return {?}
2171
+ */
2172
+ function ($event) {
2173
+ if ($event instanceof Event) {
2174
+ return;
2175
+ }
2176
+ this.onChange($event);
2177
+ };
2156
2178
  /**
2157
2179
  * @param {?} $event
2158
2180
  * @return {?}
@@ -2238,6 +2260,9 @@
2238
2260
  FormlyAttributes.decorators = [
2239
2261
  { type: i0.Directive, args: [{
2240
2262
  selector: '[formlyAttributes]',
2263
+ host: {
2264
+ '(change)': 'onHostChange($event)',
2265
+ },
2241
2266
  },] }
2242
2267
  ];
2243
2268
  /** @nocollapse */
@@ -2309,7 +2334,7 @@
2309
2334
  Object.defineProperty(FieldType.prototype, "formControl", {
2310
2335
  get: /**
2311
2336
  * @return {?}
2312
- */ function () { return this.field.formControl; },
2337
+ */ function () { return ( /** @type {?} */(this.field.formControl)); },
2313
2338
  enumerable: true,
2314
2339
  configurable: true
2315
2340
  });
@@ -2388,15 +2413,6 @@
2388
2413
  }
2389
2414
  return _this;
2390
2415
  }
2391
- Object.defineProperty(FieldArrayType.prototype, "formControl", {
2392
- get: /**
2393
- * @return {?}
2394
- */ function () {
2395
- return ( /** @type {?} */(this.field.formControl));
2396
- },
2397
- enumerable: true,
2398
- configurable: true
2399
- });
2400
2416
  /**
2401
2417
  * @param {?} field
2402
2418
  * @return {?}
@@ -3549,26 +3565,33 @@
3549
3565
  /**
3550
3566
  * @private
3551
3567
  * @param {?} field
3568
+ * @param {?=} disabled
3552
3569
  * @return {?}
3553
3570
  */
3554
3571
  FieldFormExtension.prototype.setValidators = /**
3555
3572
  * @private
3556
3573
  * @param {?} field
3574
+ * @param {?=} disabled
3557
3575
  * @return {?}
3558
3576
  */
3559
- function (field) {
3577
+ function (field, disabled) {
3560
3578
  var _this = this;
3579
+ if (disabled === void 0) {
3580
+ disabled = false;
3581
+ }
3561
3582
  /** @type {?} */
3562
3583
  var markForCheck = false;
3584
+ if (disabled === false && field.key && field.templateOptions && field.templateOptions.disabled) {
3585
+ disabled = true;
3586
+ }
3563
3587
  (field.fieldGroup || []).forEach(( /**
3564
3588
  * @param {?} f
3565
3589
  * @return {?}
3566
- */function (f) { return _this.setValidators(f) && (markForCheck = true); }));
3590
+ */function (f) { return _this.setValidators(f, disabled) && (markForCheck = true); }));
3567
3591
  if (field.key || !field.parent || (!field.key && !field.fieldGroup)) {
3568
3592
  var c_1 = field.formControl;
3569
- /** @type {?} */
3570
- var disabled = field.templateOptions ? field.templateOptions.disabled : false;
3571
- if (field.key && c_1) {
3593
+ field.templateOptions = field.templateOptions || {};
3594
+ if (field.key && c_1 && c_1 instanceof forms.FormControl) {
3572
3595
  if (disabled && c_1.enabled) {
3573
3596
  c_1.disable({ emitEvent: false, onlySelf: true });
3574
3597
  markForCheck = true;