@ngx-formly/core 5.10.30 → 5.10.31

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.
@@ -102,6 +102,20 @@
102
102
  * @fileoverview added by tsickle
103
103
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
104
104
  */
105
+ /**
106
+ * @param {?} form
107
+ * @param {?} callback
108
+ * @return {?}
109
+ */
110
+ function disableTreeValidityCall(form, callback) {
111
+ /** @type {?} */
112
+ var _updateTreeValidity = form._updateTreeValidity.bind(form);
113
+ form._updateTreeValidity = ( /**
114
+ * @return {?}
115
+ */function () { });
116
+ callback();
117
+ form._updateTreeValidity = _updateTreeValidity;
118
+ }
105
119
  /**
106
120
  * @param {?} formId
107
121
  * @param {?} field
@@ -795,6 +809,7 @@
795
809
  * @return {?}
796
810
  */
797
811
  function (formControl, fieldGroup, model, options) {
812
+ var _this = this;
798
813
  if (fieldGroup === void 0) {
799
814
  fieldGroup = [];
800
815
  }
@@ -803,7 +818,9 @@
803
818
  }
804
819
  /** @type {?} */
805
820
  var field = { fieldGroup: fieldGroup, model: model, formControl: formControl, options: this._setOptions(options) };
806
- this._buildForm(field);
821
+ disableTreeValidityCall(formControl, ( /**
822
+ * @return {?}
823
+ */function () { return _this._buildForm(field); }));
807
824
  field.options._checkField(field, true);
808
825
  };
809
826
  /**
@@ -1894,16 +1911,11 @@
1894
1911
  */
1895
1912
  var FormlyAttributes = /** @class */ (function () {
1896
1913
  function FormlyAttributes(renderer, elementRef, _document) {
1914
+ var _this = this;
1897
1915
  this.renderer = renderer;
1898
1916
  this.elementRef = elementRef;
1899
1917
  this.uiAttributesCache = {};
1900
- this.uiAttributes = __spread(FORMLY_VALIDATORS, [
1901
- 'tabindex',
1902
- 'placeholder',
1903
- 'readonly',
1904
- 'disabled',
1905
- 'step',
1906
- ]);
1918
+ this.uiAttributes = null;
1907
1919
  /**
1908
1920
  * HostBinding doesn't register listeners conditionally which may produce some perf issues.
1909
1921
  *
@@ -1911,12 +1923,23 @@
1911
1923
  */
1912
1924
  this.uiEvents = {
1913
1925
  listeners: [],
1914
- events: [
1915
- 'click',
1916
- 'keyup',
1917
- 'keydown',
1918
- 'keypress',
1919
- ],
1926
+ events: ['click', 'keyup', 'keydown', 'keypress', 'focus', 'blur', 'change'],
1927
+ callback: ( /**
1928
+ * @param {?} eventName
1929
+ * @param {?} $event
1930
+ * @return {?}
1931
+ */function (eventName, $event) {
1932
+ switch (eventName) {
1933
+ case 'focus':
1934
+ return _this.onFocus($event);
1935
+ case 'blur':
1936
+ return _this.onBlur($event);
1937
+ case 'change':
1938
+ return _this.onChange($event);
1939
+ default:
1940
+ return _this.to[eventName](_this.field, $event);
1941
+ }
1942
+ }),
1920
1943
  };
1921
1944
  this.document = _document;
1922
1945
  }
@@ -1955,11 +1978,11 @@
1955
1978
  * @param {?} eventName
1956
1979
  * @return {?}
1957
1980
  */function (eventName) {
1958
- if (_this.to && _this.to[eventName]) {
1981
+ if ((_this.to && _this.to[eventName]) || ['focus', 'blur', 'change'].indexOf(eventName) !== -1) {
1959
1982
  _this.uiEvents.listeners.push(_this.renderer.listen(_this.elementRef.nativeElement, eventName, ( /**
1960
1983
  * @param {?} e
1961
1984
  * @return {?}
1962
- */function (e) { return _this.to[eventName](_this.field, e); })));
1985
+ */function (e) { return _this.uiEvents.callback(eventName, e); })));
1963
1986
  }
1964
1987
  }));
1965
1988
  if (this.to && this.to.attributes) {
@@ -2031,6 +2054,14 @@
2031
2054
  */
2032
2055
  function () {
2033
2056
  var _this = this;
2057
+ if (!this.uiAttributes) {
2058
+ /** @type {?} */
2059
+ var element_1 = ( /** @type {?} */(this.elementRef.nativeElement));
2060
+ this.uiAttributes = __spread(FORMLY_VALIDATORS, ['tabindex', 'placeholder', 'readonly', 'disabled', 'step']).filter(( /**
2061
+ * @param {?} attr
2062
+ * @return {?}
2063
+ */function (attr) { return !element_1.hasAttribute || !element_1.hasAttribute(attr); }));
2064
+ }
2034
2065
  this.uiAttributes.forEach(( /**
2035
2066
  * @param {?} attr
2036
2067
  * @return {?}
@@ -2207,11 +2238,6 @@
2207
2238
  FormlyAttributes.decorators = [
2208
2239
  { type: i0.Directive, args: [{
2209
2240
  selector: '[formlyAttributes]',
2210
- host: {
2211
- '(focus)': 'onFocus($event)',
2212
- '(blur)': 'onBlur($event)',
2213
- '(change)': 'onChange($event)',
2214
- },
2215
2241
  },] }
2216
2242
  ];
2217
2243
  /** @nocollapse */