@esfaenza/forms-and-validations 11.2.158 → 11.2.159-beta10
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/esfaenza-forms-and-validations.umd.js +22 -5
- package/bundles/esfaenza-forms-and-validations.umd.js.map +1 -1
- package/esm2015/lib/forms/base-form-control.js +22 -6
- package/esm2015/lib/forms/form-autocomplete/form-autocomplete.component.js +2 -1
- package/fesm2015/esfaenza-forms-and-validations.js +22 -5
- package/fesm2015/esfaenza-forms-and-validations.js.map +1 -1
- package/package.json +1 -1
|
@@ -2112,8 +2112,13 @@
|
|
|
2112
2112
|
});
|
|
2113
2113
|
}
|
|
2114
2114
|
// Escludo tutti i validatori che in realtà sono componenti
|
|
2115
|
-
if (this._validators)
|
|
2116
|
-
this.
|
|
2115
|
+
if (this._validators) {
|
|
2116
|
+
var validatorsToSet = this._validators.filter(function (v) { return !v.ngOnInit; });
|
|
2117
|
+
this.ngControl.control.setValidators(validatorsToSet);
|
|
2118
|
+
//#DEBUG
|
|
2119
|
+
console.log("Validatori impostati a livello di base form per il controllo: " + ngControl.name);
|
|
2120
|
+
console.log(validatorsToSet);
|
|
2121
|
+
}
|
|
2117
2122
|
this.ngControl.control.updateValueAndValidity();
|
|
2118
2123
|
}
|
|
2119
2124
|
}
|
|
@@ -2307,8 +2312,12 @@
|
|
|
2307
2312
|
BaseFormControl.prototype.checkRequiredValidator = function () {
|
|
2308
2313
|
// controllo se è settato un required per decidere in maniera condizionale se utilizzare il validatore required nel componente interno
|
|
2309
2314
|
// Lo faccio qui e non in un eventuale ngOnInit o costruttore perché ngOnInit non sempre viene chiamato e da costruttore il validatore non ha ancora il valore giusto
|
|
2310
|
-
if (this._validators && this._validators.some(function (elem) { return elem instanceof forms.RequiredValidator && (elem.required === true || elem.required === null || elem.required === undefined); }))
|
|
2315
|
+
if (this._validators && this._validators.some(function (elem) { return elem instanceof forms.RequiredValidator && (elem.required === true || elem.required === null || elem.required === undefined); })) {
|
|
2316
|
+
//#DEBUG
|
|
2317
|
+
console.log("Controllo impostato required: " + this.ngControl.name + " a causa dei seguenti validatori");
|
|
2318
|
+
console.log(this._validators.filter(function (elem) { return elem instanceof forms.RequiredValidator && (elem.required === true || elem.required === null || elem.required === undefined); }));
|
|
2311
2319
|
this.Required = true;
|
|
2320
|
+
}
|
|
2312
2321
|
};
|
|
2313
2322
|
/** @ignore */
|
|
2314
2323
|
BaseFormControl.prototype.ngAfterViewInit = function () {
|
|
@@ -2359,14 +2368,21 @@
|
|
|
2359
2368
|
* @param {NgModel} comp Elemento HTML marcato con "#validationControl"
|
|
2360
2369
|
*/
|
|
2361
2370
|
BaseFormControl.prototype.registerValComp = function (comp) {
|
|
2371
|
+
var _a;
|
|
2362
2372
|
if (comp) {
|
|
2363
2373
|
// È arrivato un nuovo validationContorl (succede solo nel form-select quando cambia la source da 0 elementi / null ad N elementi, quindi al massimo una volta)
|
|
2364
2374
|
if (this.validationControl && this.Form)
|
|
2365
2375
|
this.Form.removeControl(this.validationControl);
|
|
2366
2376
|
this.validationControl = comp;
|
|
2367
2377
|
//Questa serve per passare avanti i validatori
|
|
2368
|
-
if (this.UseUserValidators)
|
|
2369
|
-
this.
|
|
2378
|
+
if (this.UseUserValidators) {
|
|
2379
|
+
var validatorsToSet = ((_a = this._validators) === null || _a === void 0 ? void 0 : _a.filter(function (v) { return !v.ngOnInit; })) || null;
|
|
2380
|
+
//#DEBUG
|
|
2381
|
+
console.log("Validatori impostati a livello di base form per il validation control: " + this.validationControl.name);
|
|
2382
|
+
console.log(validatorsToSet);
|
|
2383
|
+
if (((validatorsToSet === null || validatorsToSet === void 0 ? void 0 : validatorsToSet.length) || 0) > 0)
|
|
2384
|
+
this.validationControl.control.setValidators(validatorsToSet);
|
|
2385
|
+
}
|
|
2370
2386
|
//Se sono staccato dal Form (vuol dire che sono ad esempio dentro un ng-template) aggiungo il controllo al Form passato come input (context del template)
|
|
2371
2387
|
if (this.Form && !this.formHasBeenBound) {
|
|
2372
2388
|
this.Form.addControl(this.validationControl);
|
|
@@ -3879,6 +3895,7 @@
|
|
|
3879
3895
|
setTimeout(function () {
|
|
3880
3896
|
_this.Model = val ? val.description : value;
|
|
3881
3897
|
_this.EvaluatedModel = _this.Model;
|
|
3898
|
+
_this.ngControl.control.updateValueAndValidity({ emitEvent: false });
|
|
3882
3899
|
});
|
|
3883
3900
|
};
|
|
3884
3901
|
/**
|