@klippa/ngx-enhancy-forms 7.2.1 → 7.3.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.
- package/bundles/klippa-ngx-enhancy-forms.umd.js +32 -3
- package/bundles/klippa-ngx-enhancy-forms.umd.js.map +1 -1
- package/bundles/klippa-ngx-enhancy-forms.umd.min.js +2 -2
- package/bundles/klippa-ngx-enhancy-forms.umd.min.js.map +1 -1
- package/esm2015/klippa-ngx-enhancy-forms.js +1 -2
- package/esm2015/lib/elements/value-accessor-base/value-accessor-base.component.js +31 -3
- package/esm2015/public-api.js +2 -1
- package/fesm2015/klippa-ngx-enhancy-forms.js +31 -3
- package/fesm2015/klippa-ngx-enhancy-forms.js.map +1 -1
- package/klippa-ngx-enhancy-forms.d.ts +0 -1
- package/klippa-ngx-enhancy-forms.metadata.json +1 -1
- package/lib/elements/value-accessor-base/value-accessor-base.component.d.ts +4 -1
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -340,6 +340,7 @@
|
|
|
340
340
|
this.controlContainer = controlContainer;
|
|
341
341
|
this.changed = new Array();
|
|
342
342
|
this.touched = new Array();
|
|
343
|
+
this.prevValue = null;
|
|
343
344
|
this.disabled = false;
|
|
344
345
|
// we support both providing just the formControlName and the full formControl
|
|
345
346
|
this.formControlName = null;
|
|
@@ -390,6 +391,7 @@
|
|
|
390
391
|
};
|
|
391
392
|
ValueAccessorBase.prototype.writeValue = function (value) {
|
|
392
393
|
this.innerValue = value;
|
|
394
|
+
this.prevValue = value;
|
|
393
395
|
};
|
|
394
396
|
ValueAccessorBase.prototype.registerOnChange = function (fn) {
|
|
395
397
|
this.changed.push(fn);
|
|
@@ -398,8 +400,34 @@
|
|
|
398
400
|
this.touched.push(fn);
|
|
399
401
|
};
|
|
400
402
|
ValueAccessorBase.prototype.setInnerValueAndNotify = function (value) {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
+
var _this = this;
|
|
404
|
+
var actuallySetValue = function (valueToSet) {
|
|
405
|
+
_this.innerValue = valueToSet;
|
|
406
|
+
_this.prevValue = valueToSet;
|
|
407
|
+
_this.changed.forEach(function (fn) { return fn(valueToSet); });
|
|
408
|
+
};
|
|
409
|
+
if (isValueSet(this.innerValueChangeInterceptor)) {
|
|
410
|
+
this.latestInnerValueChangedInterceptorPromise = this.innerValueChangeInterceptor();
|
|
411
|
+
var myPromise_1 = this.latestInnerValueChangedInterceptorPromise;
|
|
412
|
+
this.latestInnerValueChangedInterceptorPromise.then(function () {
|
|
413
|
+
if (_this.latestInnerValueChangedInterceptorPromise === myPromise_1) {
|
|
414
|
+
actuallySetValue(value);
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
// ignore outdated promises
|
|
418
|
+
}
|
|
419
|
+
}).catch(function () {
|
|
420
|
+
if (_this.latestInnerValueChangedInterceptorPromise === myPromise_1) {
|
|
421
|
+
actuallySetValue(_this.prevValue);
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
// ignore outdated promises
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
actuallySetValue(value);
|
|
430
|
+
}
|
|
403
431
|
};
|
|
404
432
|
ValueAccessorBase.prototype.resetToNull = function () {
|
|
405
433
|
this.setInnerValueAndNotify(null);
|
|
@@ -424,6 +452,7 @@
|
|
|
424
452
|
]; };
|
|
425
453
|
ValueAccessorBase.propDecorators = {
|
|
426
454
|
disabled: [{ type: core.Input }],
|
|
455
|
+
innerValueChangeInterceptor: [{ type: core.Input }],
|
|
427
456
|
formControlName: [{ type: core.Input }],
|
|
428
457
|
formControl: [{ type: core.Input }],
|
|
429
458
|
onTouch: [{ type: core.Output }]
|
|
@@ -1854,6 +1883,7 @@
|
|
|
1854
1883
|
exports.DateTimePickerComponent = DateTimePickerComponent;
|
|
1855
1884
|
exports.EmailInputComponent = EmailInputComponent;
|
|
1856
1885
|
exports.FORM_ERROR_MESSAGES = FORM_ERROR_MESSAGES;
|
|
1886
|
+
exports.FileInputComponent = FileInputComponent;
|
|
1857
1887
|
exports.FormCaptionComponent = FormCaptionComponent;
|
|
1858
1888
|
exports.FormComponent = FormComponent;
|
|
1859
1889
|
exports.FormElementComponent = FormElementComponent;
|
|
@@ -1878,7 +1908,6 @@
|
|
|
1878
1908
|
exports.invalidFieldsSymbol = invalidFieldsSymbol;
|
|
1879
1909
|
exports.matDateFormatsFactory = matDateFormatsFactory;
|
|
1880
1910
|
exports["ɵa"] = MaterialModule;
|
|
1881
|
-
exports["ɵb"] = FileInputComponent;
|
|
1882
1911
|
|
|
1883
1912
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1884
1913
|
|