@esfaenza/forms-and-validations 11.2.60 → 11.2.63
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 +37 -6
- package/bundles/esfaenza-forms-and-validations.umd.js.map +1 -1
- package/esfaenza-forms-and-validations.metadata.json +1 -1
- package/esm2015/lib/forms/base-form-control.js +3 -2
- package/esm2015/lib/forms/form-select/form-select.component.js +29 -5
- package/esm2015/lib/forms/form-template/form-template.component.js +7 -2
- package/fesm2015/esfaenza-forms-and-validations.js +36 -6
- package/fesm2015/esfaenza-forms-and-validations.js.map +1 -1
- package/lib/forms/form-select/form-select.component.d.ts +1 -0
- package/lib/forms/form-template/form-template.component.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1912,7 +1912,8 @@
|
|
|
1912
1912
|
v._createValidator();
|
|
1913
1913
|
});
|
|
1914
1914
|
}
|
|
1915
|
-
|
|
1915
|
+
if (this._validators)
|
|
1916
|
+
this.ngControl.control.setValidators(this._validators);
|
|
1916
1917
|
this.ngControl.control.updateValueAndValidity();
|
|
1917
1918
|
}
|
|
1918
1919
|
}
|
|
@@ -2797,6 +2798,10 @@
|
|
|
2797
2798
|
* Mostra un testo a sinistra dell'input, **FormLayout** permettendo
|
|
2798
2799
|
*/
|
|
2799
2800
|
this.Label = "";
|
|
2801
|
+
/**
|
|
2802
|
+
* Eventuali classi extra da applicare alla Label, di default c'è solo un leggero margin top
|
|
2803
|
+
*/
|
|
2804
|
+
this.LabelClass = "m-t-5";
|
|
2800
2805
|
/**
|
|
2801
2806
|
* Utilizza o meno il Layout di un form (Label con input di fianco), se false mostra solo l'input
|
|
2802
2807
|
*/
|
|
@@ -2835,13 +2840,14 @@
|
|
|
2835
2840
|
FormTemplateComponent.decorators = [
|
|
2836
2841
|
{ type: core.Component, args: [{
|
|
2837
2842
|
selector: "form-template",
|
|
2838
|
-
template: "<ng-container *ngIf=\"!FormLayout\">\r\n <ng-content></ng-content>\r\n</ng-container>\r\n\r\n<div *ngIf=\"FormLayout\" class=\"form-group row {{FormGroupClass}}\" [class.app-margin-bottom-0]=\"Last\">\r\n <label class=\"col-md-{{LabelColWidth}}
|
|
2843
|
+
template: "<ng-container *ngIf=\"!FormLayout\">\r\n <ng-content></ng-content>\r\n</ng-container>\r\n\r\n<div *ngIf=\"FormLayout\" class=\"form-group row {{FormGroupClass}}\" [class.app-margin-bottom-0]=\"Last\">\r\n <label class=\"col-md-{{LabelColWidth}} {{LabelClass}}\">{{Label}}{{Required ? '*' : ''}}<span *ngIf=\"Label\">:</span></label>\r\n <div class=\"col-md-{{InputColWidth}}\">\r\n <ng-content></ng-content>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>",
|
|
2839
2844
|
changeDetection: core.ChangeDetectionStrategy.OnPush
|
|
2840
2845
|
},] }
|
|
2841
2846
|
];
|
|
2842
2847
|
FormTemplateComponent.propDecorators = {
|
|
2843
2848
|
Required: [{ type: core.Input }],
|
|
2844
2849
|
Label: [{ type: core.Input }],
|
|
2850
|
+
LabelClass: [{ type: core.Input }],
|
|
2845
2851
|
FormLayout: [{ type: core.Input }],
|
|
2846
2852
|
LabelColWidth: [{ type: core.Input }],
|
|
2847
2853
|
InputColWidth: [{ type: core.Input }],
|
|
@@ -3193,14 +3199,39 @@
|
|
|
3193
3199
|
* Ovviamente lo faccio solo quando ho una SelectLabel, altrimenti non ho problemi di floattamenti
|
|
3194
3200
|
*/
|
|
3195
3201
|
if (!this.SourceFirstBind && this.SelectLabel) {
|
|
3196
|
-
this.
|
|
3197
|
-
|
|
3202
|
+
this.detatchPreviousAndRetatchNext(function (afterStuff) {
|
|
3203
|
+
_this.BoundSource = null;
|
|
3204
|
+
setTimeout(function () {
|
|
3205
|
+
_this.tryBindSourceDisplay();
|
|
3206
|
+
_this.cdr.detectChanges();
|
|
3207
|
+
setTimeout(function () { afterStuff(); });
|
|
3208
|
+
});
|
|
3209
|
+
});
|
|
3198
3210
|
}
|
|
3199
3211
|
else
|
|
3200
|
-
this.
|
|
3212
|
+
this.detatchPreviousAndRetatchNext(function (afterStuff) {
|
|
3213
|
+
_this.tryBindSourceDisplay();
|
|
3214
|
+
_this.cdr.detectChanges();
|
|
3215
|
+
setTimeout(function () { afterStuff(); });
|
|
3216
|
+
});
|
|
3201
3217
|
this.cdr.markForCheck();
|
|
3202
3218
|
}
|
|
3203
3219
|
};
|
|
3220
|
+
FormSelectComponent.prototype.detatchPreviousAndRetatchNext = function (doStuff) {
|
|
3221
|
+
var _this = this;
|
|
3222
|
+
this.Form.removeControl(this.validationControl);
|
|
3223
|
+
setTimeout(function () {
|
|
3224
|
+
doStuff(function () {
|
|
3225
|
+
if (_this.validationControl)
|
|
3226
|
+
_this.Form.addControl(_this.validationControl);
|
|
3227
|
+
else if (_this.validationControl) {
|
|
3228
|
+
_this.Form.addControl(_this.validationControl);
|
|
3229
|
+
}
|
|
3230
|
+
else
|
|
3231
|
+
console.error("Impossibile aggiungere il componente di validaazione per " + _this.GeneratedName + ", le validazioni potrebbero funzionare in maniera erratica");
|
|
3232
|
+
});
|
|
3233
|
+
});
|
|
3234
|
+
};
|
|
3204
3235
|
/**
|
|
3205
3236
|
* @ignore
|
|
3206
3237
|
*/
|
|
@@ -3211,7 +3242,7 @@
|
|
|
3211
3242
|
{ type: core.Component, args: [{
|
|
3212
3243
|
selector: "form-select",
|
|
3213
3244
|
providers: [{ provide: localizations.LocalizationService, useClass: FormSelectComponentLoc }],
|
|
3214
|
-
template: "<ng-container *ngIf=\"!FormLayout\">\r\n <ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container>\r\n</ng-container>\r\n\r\n<div *ngIf=\"FormLayout && BoundSource\" class=\"form-group row {{FormGroupClass}}\" [class.app-margin-bottom-0]=\"Last\">\r\n <label class=\"col-md-{{LabelColWidth}} m-t-5\">{{Label}}{{Required ? '*' : ''}}:</label>\r\n <div class=\"col-md-{{InputColWidth}}\">\r\n <ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>\r\n\r\n<ng-template #controlTemplate>\r\n\r\n <!-- Select vuota per quando non ho Sorgenti dati da cui selezionare. Uguale identica alla piena ma senza option\r\n Purtroppo devono essere due componenti distinti perch\u00E9 una select una volta creata non riesce pi\u00F9 ad adattarsi ai cambi di options -->\r\n <val-select *ngIf=\"!BoundSource || BoundSource.length == 0\"\r\n [FocusSubject]=\"FocusSubject\" [FieldAppearence]=\"FieldAppearence\"\r\n [required]=\"Required ? 'required' : null\"\r\n [noValidate]=\"!Validation\"\r\n [readonly]=\"Readonly\"\r\n [forceInvalid]=\"ForcedError\"\r\n [label]=\"SelectLabel\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [placeholder]=\"Required ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('Select' | localize : lc) + '...')) : Placeholder\"\r\n [placeHolderValue]=\"PlaceholderValue\"\r\n [submitted]=\"Form?.submitted\"\r\n [emptyFieldValue]=\"Required || Placeholder || SelectLabel ? EmptyFieldValue : ''\"\r\n [(ngModel)]=\"Model\"\r\n [showValidationSymbol]=\"ShowValidationSymbol\"\r\n [id]=\"GeneratedName\"\r\n name=\"{{GeneratedName}}\"\r\n (inputChange)=\"Model = $event == EmptyFieldValue ? (Required? PlaceholderValue : '') : $event; changed();\"\r\n (inputFocus)=\"focused($event);\"\r\n #validationControl=\"ngModel\">\r\n </val-select>\r\n\r\n <!-- Select vera e propria per quando arrivano i dati -->\r\n <val-select *ngIf=\"BoundSource && BoundSource.length > 0\"\r\n [FocusSubject]=\"FocusSubject\" [FieldAppearence]=\"FieldAppearence\"\r\n [required]=\"Required ? 'required' : null\"\r\n [noValidate]=\"!Validation\"\r\n [readonly]=\"Readonly\"\r\n [forceInvalid]=\"ForcedError\"\r\n [label]=\"SelectLabel\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [showValidationSymbol]=\"ShowValidationSymbol\"\r\n [placeholder]=\"Required ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('Select' | localize : lc) + '...')) : Placeholder\"\r\n [placeHolderValue]=\"PlaceholderValue\"\r\n [submitted]=\"Form?.submitted\"\r\n [emptyFieldValue]=\"Required || Placeholder || SelectLabel ? EmptyFieldValue : ''\"\r\n [(ngModel)]=\"Model\"\r\n [id]=\"GeneratedName\"\r\n name=\"{{GeneratedName}}\"\r\n (inputChange)=\"Model = $event == EmptyFieldValue ? (Required? PlaceholderValue : '') : $event; changed();\"\r\n (inputFocus)=\"focused($event);\"\r\n (inputFinalized)=\"finalized()\"\r\n #validationControl=\"ngModel\">\r\n <option *ngFor=\"let obj of BoundSource\" [value]=\"obj.id\">{{obj.description}}</option>\r\n </val-select>\r\n</ng-template>",
|
|
3245
|
+
template: "<ng-container *ngIf=\"!FormLayout\">\r\n <ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container>\r\n</ng-container>\r\n\r\n<div *ngIf=\"FormLayout && BoundSource\" class=\"form-group row {{FormGroupClass}}\" [class.app-margin-bottom-0]=\"Last\">\r\n <label class=\"col-md-{{LabelColWidth}} m-t-5\">{{Label}}{{Required ? '*' : ''}}:</label>\r\n <div class=\"col-md-{{InputColWidth}}\">\r\n <ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>\r\n\r\n<ng-template #controlTemplate>\r\n\r\n <!-- Select vuota per quando non ho Sorgenti dati da cui selezionare. Uguale identica alla piena ma senza option\r\n Purtroppo devono essere due componenti distinti perch\u00E9 una select una volta creata non riesce pi\u00F9 ad adattarsi ai cambi di options -->\r\n <val-select *ngIf=\"!BoundSource || BoundSource.length == 0\"\r\n [FocusSubject]=\"FocusSubject\" [FieldAppearence]=\"FieldAppearence\"\r\n [required]=\"Required ? 'required' : null\"\r\n [noValidate]=\"!Validation\"\r\n [readonly]=\"Readonly\"\r\n [forceInvalid]=\"ForcedError\"\r\n [label]=\"SelectLabel\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [placeholder]=\"Required ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('Select' | localize : lc) + '...')) : Placeholder\"\r\n [placeHolderValue]=\"PlaceholderValue\"\r\n [submitted]=\"Form?.submitted\"\r\n [emptyFieldValue]=\"Required || Placeholder || SelectLabel ? EmptyFieldValue : ''\"\r\n [(ngModel)]=\"Model\"\r\n [showValidationSymbol]=\"ShowValidationSymbol\"\r\n [id]=\"GeneratedName\"\r\n name=\"{{GeneratedName}}_zero\"\r\n (inputChange)=\"Model = $event == EmptyFieldValue ? (Required? PlaceholderValue : '') : $event; changed();\"\r\n (inputFocus)=\"focused($event);\"\r\n #validationControl=\"ngModel\">\r\n </val-select>\r\n\r\n <!-- Select vera e propria per quando arrivano i dati -->\r\n <val-select *ngIf=\"BoundSource && BoundSource.length > 0\"\r\n [FocusSubject]=\"FocusSubject\" [FieldAppearence]=\"FieldAppearence\"\r\n [required]=\"Required ? 'required' : null\"\r\n [noValidate]=\"!Validation\"\r\n [readonly]=\"Readonly\"\r\n [forceInvalid]=\"ForcedError\"\r\n [label]=\"SelectLabel\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [showValidationSymbol]=\"ShowValidationSymbol\"\r\n [placeholder]=\"Required ? ((RequiredPlaceholder != null ? RequiredPlaceholder : ('Select' | localize : lc) + '...')) : Placeholder\"\r\n [placeHolderValue]=\"PlaceholderValue\"\r\n [submitted]=\"Form?.submitted\"\r\n [emptyFieldValue]=\"Required || Placeholder || SelectLabel ? EmptyFieldValue : ''\"\r\n [(ngModel)]=\"Model\"\r\n [id]=\"GeneratedName\"\r\n name=\"{{GeneratedName}}_filled\"\r\n (inputChange)=\"Model = $event == EmptyFieldValue ? (Required? PlaceholderValue : '') : $event; changed();\"\r\n (inputFocus)=\"focused($event);\"\r\n (inputFinalized)=\"finalized()\"\r\n #validationControl=\"ngModel\">\r\n <option *ngFor=\"let obj of BoundSource\" [value]=\"obj.id\">{{obj.description}}</option>\r\n </val-select>\r\n</ng-template>",
|
|
3215
3246
|
changeDetection: core.ChangeDetectionStrategy.OnPush
|
|
3216
3247
|
},] }
|
|
3217
3248
|
];
|