@esfaenza/forms-and-validations 11.2.147 → 11.2.149-beta1
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 +144 -39
- 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 +94 -11
- package/esm2015/lib/forms/form-input/form-input.component.js +8 -2
- package/esm2015/lib/forms/form-select/form-select.component.js +2 -2
- package/esm2015/lib/validations/base-validation.js +15 -5
- package/esm2015/lib/validations/validation-autocomplete/validation-autocomplete.component.js +6 -5
- package/esm2015/lib/validations/validation-autocomplete-multi/validation-autocomplete-multi.component.js +6 -5
- package/esm2015/lib/validations/validation-currency/validation-currency.component.js +2 -2
- package/esm2015/lib/validations/validation-date/validation-date.component.js +3 -4
- package/esm2015/lib/validations/validation-datetime/validation-datetime.component.js +3 -4
- package/esm2015/lib/validations/validation-input/validation-input.component.js +3 -4
- package/esm2015/lib/validations/validation-select/validation-select.component.js +5 -6
- package/esm2015/lib/validations/validation-text-area/validation-text-area.component.js +2 -2
- package/fesm2015/esfaenza-forms-and-validations.js +133 -38
- package/fesm2015/esfaenza-forms-and-validations.js.map +1 -1
- package/lib/forms/base-form-control.d.ts +47 -8
- package/lib/forms/form-input/form-input.component.d.ts +2 -0
- package/lib/validations/base-validation.d.ts +12 -1
- package/lib/validations/validation-autocomplete/validation-autocomplete.component.d.ts +2 -2
- package/lib/validations/validation-autocomplete-multi/validation-autocomplete-multi.component.d.ts +2 -2
- package/lib/validations/validation-date/validation-date.component.d.ts +0 -1
- package/lib/validations/validation-datetime/validation-datetime.component.d.ts +0 -1
- package/lib/validations/validation-input/validation-input.component.d.ts +0 -1
- package/lib/validations/validation-select/validation-select.component.d.ts +0 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Injectable, Inject, InjectionToken, Directive, Input, EventEmitter, ViewChild, Output, Optional, Component, ViewEncapsulation, ChangeDetectionStrategy, forwardRef, Injector,
|
|
1
|
+
import { Injectable, Inject, InjectionToken, Directive, Input, EventEmitter, ChangeDetectorRef, ViewChild, Output, Optional, Component, ViewEncapsulation, ChangeDetectionStrategy, forwardRef, Injector, ContentChild, Self, Host, NgModule } from '@angular/core';
|
|
2
2
|
import { MAT_DATE_LOCALE } from '@angular/material/core';
|
|
3
3
|
import { DayJsDateAdapter, MatDayjsDateModule } from '@esfaenza/material-dayjs-adapter';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
@@ -176,7 +176,9 @@ CustomRequiredDirective.propDecorators = {
|
|
|
176
176
|
* Nota bene: I tooltip rallentano tantissimo la pagina perché il tizio che ha fatto ngx bootstrap non è capace
|
|
177
177
|
*/
|
|
178
178
|
class BaseValidation {
|
|
179
|
-
|
|
179
|
+
/** @ignore Constructor */
|
|
180
|
+
constructor(cdr) {
|
|
181
|
+
this.cdr = cdr;
|
|
180
182
|
/**
|
|
181
183
|
* Variabile per tenere in memoria il fatto che il componente è forzato a invalido o no
|
|
182
184
|
*/
|
|
@@ -314,6 +316,7 @@ class BaseValidation {
|
|
|
314
316
|
this.baseInput.control.setErrors({ forcedtoinvalid: true });
|
|
315
317
|
this.baseInput.control.markAsTouched();
|
|
316
318
|
this.baseInput.control.markAsDirty();
|
|
319
|
+
this.cdr.detectChanges();
|
|
317
320
|
});
|
|
318
321
|
else
|
|
319
322
|
setTimeout(() => {
|
|
@@ -347,8 +350,12 @@ class BaseValidation {
|
|
|
347
350
|
* Helper che calcola il messaggio da mostrare nel tooltip che andrà ad aprire
|
|
348
351
|
*/
|
|
349
352
|
showTooltipWithMessage(messageOverride = null) {
|
|
350
|
-
|
|
351
|
-
if (this.
|
|
353
|
+
// Aggiorno il messaggio di validazione solo se il valore è diverso dall'ultimo valore ricevuto
|
|
354
|
+
if (this.valueOnLastValidation != this.baseInput.value) {
|
|
355
|
+
this.validationFailedBind = messageOverride || this.validationFailed || (this.InferErrorMessages ? this.inferMessage() : "");
|
|
356
|
+
this.valueOnLastValidation = this.baseInput.value;
|
|
357
|
+
}
|
|
358
|
+
if (this.validationFailedBind)
|
|
352
359
|
this.tooltip.show();
|
|
353
360
|
}
|
|
354
361
|
/**
|
|
@@ -425,6 +432,9 @@ class BaseValidation {
|
|
|
425
432
|
BaseValidation.decorators = [
|
|
426
433
|
{ type: Directive }
|
|
427
434
|
];
|
|
435
|
+
BaseValidation.ctorParameters = () => [
|
|
436
|
+
{ type: ChangeDetectorRef }
|
|
437
|
+
];
|
|
428
438
|
BaseValidation.propDecorators = {
|
|
429
439
|
tooltip: [{ type: ViewChild, args: [TooltipDirective, { static: false },] }],
|
|
430
440
|
tooltip_static: [{ type: ViewChild, args: [TooltipDirective, { static: true },] }],
|
|
@@ -484,20 +494,19 @@ class ValidationSelectComponent extends BaseValidation {
|
|
|
484
494
|
* @ignore
|
|
485
495
|
*/
|
|
486
496
|
constructor(_validators, _asyncValidators, injector, cdr, lc) {
|
|
487
|
-
super();
|
|
497
|
+
super(cdr);
|
|
488
498
|
this._validators = _validators;
|
|
489
499
|
this._asyncValidators = _asyncValidators;
|
|
490
500
|
this.injector = injector;
|
|
491
|
-
this.cdr = cdr;
|
|
492
501
|
this.lc = lc;
|
|
493
502
|
/**
|
|
494
503
|
* valore del campo vuoto della select
|
|
495
504
|
*/
|
|
496
|
-
this.emptyFieldValue = "-
|
|
505
|
+
this.emptyFieldValue = "-2000";
|
|
497
506
|
/**
|
|
498
507
|
* Valore del placeholder
|
|
499
508
|
*/
|
|
500
|
-
this.placeHolderValue = "-
|
|
509
|
+
this.placeHolderValue = "-1000";
|
|
501
510
|
/**
|
|
502
511
|
* Per i componenti non obbligatori indica se fornire un "valore vuoto"
|
|
503
512
|
*/
|
|
@@ -608,7 +617,7 @@ class ValidationSelectComponent extends BaseValidation {
|
|
|
608
617
|
ValidationSelectComponent.decorators = [
|
|
609
618
|
{ type: Component, args: [{
|
|
610
619
|
selector: "val-select",
|
|
611
|
-
template: "<mat-form-field appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <select matNativeControl\r\n #baseInput=\"ngModel\"\r\n #htmlInput\r\n name=\"val-select\"\r\n class=\"form-control\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n id=\"{{id}}\"\r\n [customRequired]=\"required ? 'true' : 'false'\"\r\n [CustomNullValues]=\"[placeHolderValue,emptyFieldValue]\"\r\n [(ngModel)]=\"value\"\r\n [tooltip]=\"tolTemplate\"\r\n [class.checking-combo]=\"!noValidate\"\r\n [class.app-option-placeholder]=\"baseInput.value === placeHolderValue\"\r\n [class.no-bg-img]=\"!showValidationSymbol\"\r\n [disabled]=\"readonly\"\r\n (click)=\"onFocus($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (blur)=\"closeTooltip(); onBlur.emit(true);\"\r\n (ngModelChange)=\"onModelChange($event); onFinalize()\">\r\n\r\n <option *ngIf=\"placeholder\" [value]=\"placeHolderValue\" disabled selected hidden>{{placeholder}}</option>\r\n <option *ngIf=\"required == false && emptyValue\" [value]=\"emptyFieldValue\"></option>\r\n <ng-content></ng-content>\r\n </select>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{
|
|
620
|
+
template: "<mat-form-field appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <select matNativeControl\r\n #baseInput=\"ngModel\"\r\n #htmlInput\r\n name=\"val-select\"\r\n class=\"form-control\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n id=\"{{id}}\"\r\n [customRequired]=\"required ? 'true' : 'false'\"\r\n [CustomNullValues]=\"[placeHolderValue,emptyFieldValue]\"\r\n [(ngModel)]=\"value\"\r\n [tooltip]=\"tolTemplate\"\r\n [class.checking-combo]=\"!noValidate\"\r\n [class.app-option-placeholder]=\"baseInput.value === placeHolderValue\"\r\n [class.no-bg-img]=\"!showValidationSymbol\"\r\n [disabled]=\"readonly\"\r\n (click)=\"onFocus($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (blur)=\"closeTooltip(); onBlur.emit(true);\"\r\n (ngModelChange)=\"onModelChange($event); onFinalize()\">\r\n\r\n <option *ngIf=\"placeholder\" [value]=\"placeHolderValue\" disabled selected hidden>{{placeholder}}</option>\r\n <option *ngIf=\"required == false && emptyValue\" [value]=\"emptyFieldValue\"></option>\r\n <ng-content></ng-content>\r\n </select>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailedBind}}</span>\r\n </div>\r\n</ng-template>",
|
|
612
621
|
encapsulation: ViewEncapsulation.None,
|
|
613
622
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
614
623
|
providers: [
|
|
@@ -647,8 +656,7 @@ class ValidationDateComponent extends BaseValidation {
|
|
|
647
656
|
* @ignore
|
|
648
657
|
*/
|
|
649
658
|
constructor(cdr, _validators, _asyncValidators, injector, lc, dateExts) {
|
|
650
|
-
super();
|
|
651
|
-
this.cdr = cdr;
|
|
659
|
+
super(cdr);
|
|
652
660
|
this._validators = _validators;
|
|
653
661
|
this._asyncValidators = _asyncValidators;
|
|
654
662
|
this.injector = injector;
|
|
@@ -778,7 +786,7 @@ class ValidationDateComponent extends BaseValidation {
|
|
|
778
786
|
ValidationDateComponent.decorators = [
|
|
779
787
|
{ type: Component, args: [{
|
|
780
788
|
selector: "val-date",
|
|
781
|
-
template: "<mat-form-field appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"placeholder && FloatingLabel\">{{placeholder}}</mat-label>\r\n <input matInput\r\n [matDatepicker]=\"datepicker\"\r\n #baseInput=\"ngModel\"\r\n #htmlInput\r\n type=\"text\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n name=\"val-date\"\r\n class=\"form-control {{class}}\"\r\n autocomplete=\"{{autocomplete}}\"\r\n id=\"{{id}}\"\r\n (click)=\"onFocus($event)\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate\"\r\n [tooltip]=\"tolTemplate\"\r\n [placeholder]=\"placeholder ? (FloatingLabel ? undefined : placeholder) : _format\"\r\n [disabled]=\"readonly || disabled\"\r\n [isDisabled]=\"readonly || disabled\"\r\n (dateChange)=\"outputValue($event); onFinalize();\"\r\n (keyup)=\"($event.keyCode == 13 || $event.keyCode == 27) && onFinalize();\"\r\n (blur)=\"closeTooltip();\"\r\n />\r\n <mat-datepicker-toggle matSuffix [for]=\"datepicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #datepicker></mat-datepicker>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{
|
|
789
|
+
template: "<mat-form-field appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"placeholder && FloatingLabel\">{{placeholder}}</mat-label>\r\n <input matInput\r\n [matDatepicker]=\"datepicker\"\r\n #baseInput=\"ngModel\"\r\n #htmlInput\r\n type=\"text\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n name=\"val-date\"\r\n class=\"form-control {{class}}\"\r\n autocomplete=\"{{autocomplete}}\"\r\n id=\"{{id}}\"\r\n (click)=\"onFocus($event)\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate\"\r\n [tooltip]=\"tolTemplate\"\r\n [placeholder]=\"placeholder ? (FloatingLabel ? undefined : placeholder) : _format\"\r\n [disabled]=\"readonly || disabled\"\r\n [isDisabled]=\"readonly || disabled\"\r\n (dateChange)=\"outputValue($event); onFinalize();\"\r\n (keyup)=\"($event.keyCode == 13 || $event.keyCode == 27) && onFinalize();\"\r\n (blur)=\"closeTooltip();\"\r\n />\r\n <mat-datepicker-toggle matSuffix [for]=\"datepicker\"></mat-datepicker-toggle>\r\n <mat-datepicker #datepicker></mat-datepicker>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailedBind}}</span>\r\n </div>\r\n</ng-template>",
|
|
782
790
|
encapsulation: ViewEncapsulation.None,
|
|
783
791
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
784
792
|
providers: [
|
|
@@ -813,8 +821,7 @@ class ValidationInputComponent extends BaseValidation {
|
|
|
813
821
|
* @ignore
|
|
814
822
|
*/
|
|
815
823
|
constructor(cdr, _validators, _asyncValidators, injector, lc) {
|
|
816
|
-
super();
|
|
817
|
-
this.cdr = cdr;
|
|
824
|
+
super(cdr);
|
|
818
825
|
this._validators = _validators;
|
|
819
826
|
this._asyncValidators = _asyncValidators;
|
|
820
827
|
this.injector = injector;
|
|
@@ -961,7 +968,7 @@ class ValidationInputComponent extends BaseValidation {
|
|
|
961
968
|
ValidationInputComponent.decorators = [
|
|
962
969
|
{ type: Component, args: [{
|
|
963
970
|
selector: "val-input",
|
|
964
|
-
template: "<mat-form-field floatLabel=\"never\" appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label [class.app-margin-left-25]=\"HasPrefix\" *ngIf=\"placeholder && FloatingLabel\">{{placeholder}}</mat-label>\r\n <ng-container *ngIf=\"HasPrefix\">\r\n <ng-container *ngTemplateOutlet=\"prefix_internal\"></ng-container>\r\n </ng-container>\r\n\r\n <!-- Bisogna fixare un po' l'uso di readonly, disabled, frozen cazzi e mazzi -->\r\n <input matInput\r\n #baseInput='ngModel'\r\n #htmlInput\r\n type=\"{{type}}\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n autocomplete=\"{{autocomplete}}\"\r\n name=\"val-input\"\r\n class=\"form-control {{class}}\"\r\n id=\"{{id}}\"\r\n [class.app-margin-left-25]=\"HasPrefix\"\r\n [class.mat-input-with-suffix]=\"HasSuffix || Password || showWarning\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate && !showWarning\"\r\n [tooltip]=\"tolTemplate\"\r\n [readonly]=\"Frozen\"\r\n [disabled]=\"readonly || disabled\"\r\n [placeholder]=\"FloatingLabel ? undefined : placeholder\"\r\n (ngModelChange)=\"onModelChange($event)\"\r\n (click)=\"onFocus($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (keyup)=\"($event.keyCode == 13 || $event.keyCode == 27) && onFinalize();\"\r\n (blur)=\"closeTooltip(); onFinalize();\"\r\n >\r\n <ng-container *ngIf=\"HasSuffix || Password || showWarning\">\r\n <ng-container *ngIf=\"!Password && !showWarning\">\r\n <ng-container *ngTemplateOutlet=\"suffix_internal\"></ng-container>\r\n </ng-container>\r\n\r\n <span class=\"form-input-suffix\" *ngIf=\"Password || showWarning\">\r\n <ng-container *ngIf=\"Password\" matSuffix>\r\n <a *ngIf=\"passShown\" class=\"fa fa-eye-slash app-fs-16 app-pointer\" (click)=\"type = 'password'; passShown = !passShown; $event.preventDefault()\"></a>\r\n <a *ngIf=\"!passShown\" class=\"fa fa-eye app-fs-16 app-pointer\" (click)=\"type = 'text'; passShown = !passShown; $event.preventDefault()\"></a>\r\n </ng-container>\r\n <ng-container *ngIf=\"showWarning\" matSuffix>\r\n <span title=\"{{warningTitle}}\" class=\"{{warningClass}} text-warning app-fs-16\"></span>\r\n </ng-container>\r\n </span>\r\n </ng-container>\r\n</mat-form-field>\r\n\r\n<!-- Questo compoennte nascosto serve solamente per assicurarsi che angular carichi gli stili dei mat-button che altrimenti non caricherebbe... dunno why -->\r\n<div hidden><mat-datepicker-toggle></mat-datepicker-toggle></div>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{
|
|
971
|
+
template: "<mat-form-field floatLabel=\"never\" appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label [class.app-margin-left-25]=\"HasPrefix\" *ngIf=\"placeholder && FloatingLabel\">{{placeholder}}</mat-label>\r\n <ng-container *ngIf=\"HasPrefix\">\r\n <ng-container *ngTemplateOutlet=\"prefix_internal\"></ng-container>\r\n </ng-container>\r\n\r\n <!-- Bisogna fixare un po' l'uso di readonly, disabled, frozen cazzi e mazzi -->\r\n <input matInput\r\n #baseInput='ngModel'\r\n #htmlInput\r\n type=\"{{type}}\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n autocomplete=\"{{autocomplete}}\"\r\n name=\"val-input\"\r\n class=\"form-control {{class}}\"\r\n id=\"{{id}}\"\r\n [class.app-margin-left-25]=\"HasPrefix\"\r\n [class.mat-input-with-suffix]=\"HasSuffix || Password || showWarning\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate && !showWarning\"\r\n [tooltip]=\"tolTemplate\"\r\n [readonly]=\"Frozen\"\r\n [disabled]=\"readonly || disabled\"\r\n [placeholder]=\"FloatingLabel ? undefined : placeholder\"\r\n (ngModelChange)=\"onModelChange($event)\"\r\n (click)=\"onFocus($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (keyup)=\"($event.keyCode == 13 || $event.keyCode == 27) && onFinalize();\"\r\n (blur)=\"closeTooltip(); onFinalize();\"\r\n >\r\n <ng-container *ngIf=\"HasSuffix || Password || showWarning\">\r\n <ng-container *ngIf=\"!Password && !showWarning\">\r\n <ng-container *ngTemplateOutlet=\"suffix_internal\"></ng-container>\r\n </ng-container>\r\n\r\n <span class=\"form-input-suffix\" *ngIf=\"Password || showWarning\">\r\n <ng-container *ngIf=\"Password\" matSuffix>\r\n <a *ngIf=\"passShown\" class=\"fa fa-eye-slash app-fs-16 app-pointer\" (click)=\"type = 'password'; passShown = !passShown; $event.preventDefault()\"></a>\r\n <a *ngIf=\"!passShown\" class=\"fa fa-eye app-fs-16 app-pointer\" (click)=\"type = 'text'; passShown = !passShown; $event.preventDefault()\"></a>\r\n </ng-container>\r\n <ng-container *ngIf=\"showWarning\" matSuffix>\r\n <span title=\"{{warningTitle}}\" class=\"{{warningClass}} text-warning app-fs-16\"></span>\r\n </ng-container>\r\n </span>\r\n </ng-container>\r\n</mat-form-field>\r\n\r\n<!-- Questo compoennte nascosto serve solamente per assicurarsi che angular carichi gli stili dei mat-button che altrimenti non caricherebbe... dunno why -->\r\n<div hidden><mat-datepicker-toggle></mat-datepicker-toggle></div>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailedBind}}</span>\r\n </div>\r\n</ng-template>",
|
|
965
972
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
966
973
|
providers: [
|
|
967
974
|
{ provide: LocalizationService, useClass: BaseValidationLoc },
|
|
@@ -1023,7 +1030,7 @@ class ValidationCurrencyComponent extends ValidationInputComponent {
|
|
|
1023
1030
|
ValidationCurrencyComponent.decorators = [
|
|
1024
1031
|
{ type: Component, args: [{
|
|
1025
1032
|
selector: "val-currency",
|
|
1026
|
-
template: "<mat-form-field appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"placeholder && FloatingLabel\">{{placeholder}}</mat-label>\r\n <input #baseInput='ngModel'\r\n #htmlInput\r\n currencyMask\r\n matInput\r\n [readonly]=\"readonly\"\r\n [options]='CurrencyOptions'\r\n [(ngModel)]=\"value\"\r\n name=\"val-input\"\r\n id=\"{{id}}\"\r\n [placeholder]=\"FloatingLabel ? undefined : placeholder\"\r\n (click)=\"onFocus($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (keyup)=\"($event.keyCode == 13 || $event.keyCode == 27) && onFinalize();\"\r\n (blur)=\"closeTooltip(); onFinalize();\"\r\n class=\"form-control {{class}}\"\r\n [class.checking-field]=\"!noValidate\"\r\n (ngModelChange)=\"onModelChange($event)\"\r\n type=\"{{type}}\"\r\n [tooltip]=\"tolTemplate\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n autocomplete=\"{{autocomplete}}\" />\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div>\r\n <span class=\"close-button pull-right\" (click)=\"closeTooltip()\" aria-label=\"Close\">\r\n <span aria-hidden=\"true\">×</span>\r\n </span>\r\n <span>{{
|
|
1033
|
+
template: "<mat-form-field appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"placeholder && FloatingLabel\">{{placeholder}}</mat-label>\r\n <input #baseInput='ngModel'\r\n #htmlInput\r\n currencyMask\r\n matInput\r\n [readonly]=\"readonly\"\r\n [options]='CurrencyOptions'\r\n [(ngModel)]=\"value\"\r\n name=\"val-input\"\r\n id=\"{{id}}\"\r\n [placeholder]=\"FloatingLabel ? undefined : placeholder\"\r\n (click)=\"onFocus($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (keyup)=\"($event.keyCode == 13 || $event.keyCode == 27) && onFinalize();\"\r\n (blur)=\"closeTooltip(); onFinalize();\"\r\n class=\"form-control {{class}}\"\r\n [class.checking-field]=\"!noValidate\"\r\n (ngModelChange)=\"onModelChange($event)\"\r\n type=\"{{type}}\"\r\n [tooltip]=\"tolTemplate\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n autocomplete=\"{{autocomplete}}\" />\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div>\r\n <span class=\"close-button pull-right\" (click)=\"closeTooltip()\" aria-label=\"Close\">\r\n <span aria-hidden=\"true\">×</span>\r\n </span>\r\n <span>{{validationFailedBind}}</span>\r\n </div>\r\n</ng-template>",
|
|
1027
1034
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1028
1035
|
providers: [
|
|
1029
1036
|
{ provide: LocalizationService, useClass: BaseValidationLoc },
|
|
@@ -1082,7 +1089,7 @@ class ValidationTextAreaComponent extends ValidationInputComponent {
|
|
|
1082
1089
|
ValidationTextAreaComponent.decorators = [
|
|
1083
1090
|
{ type: Component, args: [{
|
|
1084
1091
|
selector: "val-textarea",
|
|
1085
|
-
template: "<mat-form-field appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-full-height mat-no-border-top mat-height-auto\">\r\n <mat-label *ngIf=\"placeholder && FloatingLabel\">{{placeholder}}</mat-label>\r\n <textarea matInput\r\n #baseInput=\"ngModel\"\r\n #htmlInput\r\n [(ngModel)]=\"value\"\r\n name=\"val-textarea\"\r\n triggers=\"\"\r\n class=\"app-no-resize form-control {{class}}\"\r\n id=\"{{id}}\"\r\n [class.checking-field]=\"!noValidate\"\r\n rows=\"{{rows}}\"\r\n [tooltip]=\"tolTemplate\"\r\n [placeholder]=\"FloatingLabel ? undefined : placeholder\"\r\n placement=\"top\"\r\n (click)=\"onFocus($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (keyup)=\"($event.keyCode == 13 || $event.keyCode == 27) && onFinalize();\"\r\n (blur)=\"closeTooltip(); onFinalize();\"\r\n (ngModelChange)=\"onModelChange($event)\">\r\n </textarea>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{
|
|
1092
|
+
template: "<mat-form-field appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-full-height mat-no-border-top mat-height-auto\">\r\n <mat-label *ngIf=\"placeholder && FloatingLabel\">{{placeholder}}</mat-label>\r\n <textarea matInput\r\n #baseInput=\"ngModel\"\r\n #htmlInput\r\n [(ngModel)]=\"value\"\r\n name=\"val-textarea\"\r\n triggers=\"\"\r\n class=\"app-no-resize form-control {{class}}\"\r\n id=\"{{id}}\"\r\n [class.checking-field]=\"!noValidate\"\r\n rows=\"{{rows}}\"\r\n [tooltip]=\"tolTemplate\"\r\n [placeholder]=\"FloatingLabel ? undefined : placeholder\"\r\n placement=\"top\"\r\n (click)=\"onFocus($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (keyup)=\"($event.keyCode == 13 || $event.keyCode == 27) && onFinalize();\"\r\n (blur)=\"closeTooltip(); onFinalize();\"\r\n (ngModelChange)=\"onModelChange($event)\">\r\n </textarea>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailedBind}}</span>\r\n </div>\r\n</ng-template>",
|
|
1086
1093
|
providers: [
|
|
1087
1094
|
{ provide: LocalizationService, useClass: BaseValidationLoc },
|
|
1088
1095
|
{
|
|
@@ -1116,8 +1123,7 @@ class ValidationDateTimeComponent extends BaseValidation {
|
|
|
1116
1123
|
* @ignore
|
|
1117
1124
|
*/
|
|
1118
1125
|
constructor(cdr, _validators, _asyncValidators, injector, lc, dateExts) {
|
|
1119
|
-
super();
|
|
1120
|
-
this.cdr = cdr;
|
|
1126
|
+
super(cdr);
|
|
1121
1127
|
this._validators = _validators;
|
|
1122
1128
|
this._asyncValidators = _asyncValidators;
|
|
1123
1129
|
this.injector = injector;
|
|
@@ -1275,7 +1281,7 @@ class ValidationDateTimeComponent extends BaseValidation {
|
|
|
1275
1281
|
ValidationDateTimeComponent.decorators = [
|
|
1276
1282
|
{ type: Component, args: [{
|
|
1277
1283
|
selector: "val-datetime",
|
|
1278
|
-
template: "<mat-form-field appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"placeholder && FloatingLabel\">{{placeholder}}</mat-label>\r\n\r\n <input matInput \r\n [ngxMatDatetimePicker]=\"datepicker\" \r\n #baseInput=\"ngModel\"\r\n #htmlInput\r\n type=\"text\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n name=\"val-date\"\r\n id=\"{{id}}\"\r\n (click)=\"onFocus($event)\"\r\n class=\"form-control {{class}}\"\r\n autocomplete=\"{{autocomplete}}\"\r\n [placeholder]=\"FloatingLabel ? undefined : placeholder\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate\"\r\n [tooltip]=\"tolTemplate\"\r\n [placeholder]=\"placeholder ? '' : _format\"\r\n [disabled]=\"readonly || disabled\"\r\n [isDisabled]=\"readonly || disabled\"\r\n (dateChange)=\"outputValue($event); onFinalize();\"\r\n (keyup)=\"($event.keyCode == 13 || $event.keyCode == 27) && onFinalize();\"\r\n (blur)=\"closeTooltip();\"\r\n />\r\n\r\n <mat-datepicker-toggle matSuffix [for]=\"datepicker\"></mat-datepicker-toggle>\r\n\r\n <ngx-mat-datetime-picker #datepicker \r\n [showSpinners]=\"showSpinners\" \r\n [showSeconds]=\"showSeconds\" \r\n [stepHour]=\"stepHour\" \r\n [stepMinute]=\"stepMinute\" \r\n [stepSecond]=\"stepSecond\" \r\n [touchUi]=\"false\" \r\n [color]=\"'primary'\">\r\n </ngx-mat-datetime-picker>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{
|
|
1284
|
+
template: "<mat-form-field appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"placeholder && FloatingLabel\">{{placeholder}}</mat-label>\r\n\r\n <input matInput \r\n [ngxMatDatetimePicker]=\"datepicker\" \r\n #baseInput=\"ngModel\"\r\n #htmlInput\r\n type=\"text\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n name=\"val-date\"\r\n id=\"{{id}}\"\r\n (click)=\"onFocus($event)\"\r\n class=\"form-control {{class}}\"\r\n autocomplete=\"{{autocomplete}}\"\r\n [placeholder]=\"FloatingLabel ? undefined : placeholder\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate\"\r\n [tooltip]=\"tolTemplate\"\r\n [placeholder]=\"placeholder ? '' : _format\"\r\n [disabled]=\"readonly || disabled\"\r\n [isDisabled]=\"readonly || disabled\"\r\n (dateChange)=\"outputValue($event); onFinalize();\"\r\n (keyup)=\"($event.keyCode == 13 || $event.keyCode == 27) && onFinalize();\"\r\n (blur)=\"closeTooltip();\"\r\n />\r\n\r\n <mat-datepicker-toggle matSuffix [for]=\"datepicker\"></mat-datepicker-toggle>\r\n\r\n <ngx-mat-datetime-picker #datepicker \r\n [showSpinners]=\"showSpinners\" \r\n [showSeconds]=\"showSeconds\" \r\n [stepHour]=\"stepHour\" \r\n [stepMinute]=\"stepMinute\" \r\n [stepSecond]=\"stepSecond\" \r\n [touchUi]=\"false\" \r\n [color]=\"'primary'\">\r\n </ngx-mat-datetime-picker>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailedBind}}</span>\r\n </div>\r\n</ng-template>",
|
|
1279
1285
|
encapsulation: ViewEncapsulation.None,
|
|
1280
1286
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1281
1287
|
providers: [
|
|
@@ -1307,8 +1313,8 @@ ValidationDateTimeComponent.propDecorators = {
|
|
|
1307
1313
|
*/
|
|
1308
1314
|
class ValidationAutocompleteComponent extends BaseValidation {
|
|
1309
1315
|
/** @ignore */
|
|
1310
|
-
constructor(_validators, _asyncValidators, injector, lc) {
|
|
1311
|
-
super();
|
|
1316
|
+
constructor(cdr, _validators, _asyncValidators, injector, lc) {
|
|
1317
|
+
super(cdr);
|
|
1312
1318
|
this._validators = _validators;
|
|
1313
1319
|
this._asyncValidators = _asyncValidators;
|
|
1314
1320
|
this.injector = injector;
|
|
@@ -1398,7 +1404,7 @@ class ValidationAutocompleteComponent extends BaseValidation {
|
|
|
1398
1404
|
ValidationAutocompleteComponent.decorators = [
|
|
1399
1405
|
{ type: Component, args: [{
|
|
1400
1406
|
selector: "val-autocomplete",
|
|
1401
|
-
template: "<!-- Val-Model: {{value}} -->\r\n<mat-form-field appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <input matInput\r\n #htmlInput\r\n #baseInput='ngModel'\r\n type=\"text\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n placeholder=\"{{placeholder}}\"\r\n [matAutocomplete]=\"auto\"\r\n name=\"val-input\"\r\n id=\"{{id}}\"\r\n class=\"form-control {{class}}\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate\"\r\n [tooltip]=\"tolTemplate\"\r\n [disabled]=\"readonly || disabled\"\r\n (ngModelChange)=\"onModelChange($event)\"\r\n (click)=\"onFocus($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (keyup)=\"($event.keyCode == 13 || $event.keyCode == 27) && onFinalize();\"\r\n (blur)=\"closeTooltip(); onFinalize();\">\r\n\r\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of FilteredSource\" [value]=\"option.id\">\r\n {{option.description}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{
|
|
1407
|
+
template: "<!-- Val-Model: {{value}} -->\r\n<mat-form-field appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top mat-height-fixed\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <input matInput\r\n #htmlInput\r\n #baseInput='ngModel'\r\n type=\"text\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n placeholder=\"{{placeholder}}\"\r\n [matAutocomplete]=\"auto\"\r\n name=\"val-input\"\r\n id=\"{{id}}\"\r\n class=\"form-control {{class}}\"\r\n [(ngModel)]=\"value\"\r\n [class.checking-field]=\"!noValidate\"\r\n [tooltip]=\"tolTemplate\"\r\n [disabled]=\"readonly || disabled\"\r\n (ngModelChange)=\"onModelChange($event)\"\r\n (click)=\"onFocus($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (keyup)=\"($event.keyCode == 13 || $event.keyCode == 27) && onFinalize();\"\r\n (blur)=\"closeTooltip(); onFinalize();\">\r\n\r\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of FilteredSource\" [value]=\"option.id\">\r\n {{option.description}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailedBind}}</span>\r\n </div>\r\n</ng-template>",
|
|
1402
1408
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1403
1409
|
providers: [
|
|
1404
1410
|
{ provide: LocalizationService, useClass: BaseValidationLoc },
|
|
@@ -1413,6 +1419,7 @@ ValidationAutocompleteComponent.decorators = [
|
|
|
1413
1419
|
},] }
|
|
1414
1420
|
];
|
|
1415
1421
|
ValidationAutocompleteComponent.ctorParameters = () => [
|
|
1422
|
+
{ type: ChangeDetectorRef },
|
|
1416
1423
|
{ type: Array, decorators: [{ type: Optional }, { type: Inject, args: [NG_VALIDATORS,] }] },
|
|
1417
1424
|
{ type: Array, decorators: [{ type: Optional }, { type: Inject, args: [NG_ASYNC_VALIDATORS,] }] },
|
|
1418
1425
|
{ type: Injector },
|
|
@@ -1431,8 +1438,8 @@ ValidationAutocompleteComponent.propDecorators = {
|
|
|
1431
1438
|
*/
|
|
1432
1439
|
class ValidationAutocompleteMultiComponent extends BaseValidation {
|
|
1433
1440
|
/** @ignore */
|
|
1434
|
-
constructor(_validators, _asyncValidators, injector, lc) {
|
|
1435
|
-
super();
|
|
1441
|
+
constructor(cdr, _validators, _asyncValidators, injector, lc) {
|
|
1442
|
+
super(cdr);
|
|
1436
1443
|
this._validators = _validators;
|
|
1437
1444
|
this._asyncValidators = _asyncValidators;
|
|
1438
1445
|
this.injector = injector;
|
|
@@ -1574,7 +1581,7 @@ class ValidationAutocompleteMultiComponent extends BaseValidation {
|
|
|
1574
1581
|
ValidationAutocompleteMultiComponent.decorators = [
|
|
1575
1582
|
{ type: Component, args: [{
|
|
1576
1583
|
selector: "val-autocomplete-multi",
|
|
1577
|
-
template: "<mat-form-field appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <mat-chip-list #chipList>\r\n <ng-container *ngIf=\"selectData.length < ChipThreshold\" >\r\n <mat-chip *ngFor=\"let select of selectData\" class=\"cardinal-colors\" (click)=\"!(readonly || disabled) && removeChip(select)\">\r\n {{ select.description }}\r\n <mat-icon class=\"mat-chip-remove\">cancel</mat-icon>\r\n </mat-chip>\r\n </ng-container>\r\n\r\n <mat-chip *ngIf=\"selectData.length >= ChipThreshold\" class=\"cardinal-colors\" (click)=\"!(readonly || disabled) && removeChip(null)\">\r\n {{ selectData.length }} {{ 'Elements selected' | localize: lc }}\r\n <mat-icon class=\"mat-chip-remove\">cancel</mat-icon>\r\n </mat-chip>\r\n\r\n <input matInput\r\n [matChipInputFor]=\"chipList\"\r\n #htmlInput\r\n #baseInput='ngModel'\r\n type=\"text\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n [placeholder]=\"placeholder\"\r\n [matAutocomplete]=\"auto\"\r\n name=\"val-input\"\r\n id=\"{{id}}\"\r\n [(ngModel)]=\"value\"\r\n [tooltip]=\"tolTemplate\"\r\n [disabled]=\"readonly || disabled\"\r\n (ngModelChange)=\"onModelChange($event)\"\r\n (click)=\"onFocus($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (blur)=\"closeTooltip();\">\r\n </mat-chip-list>\r\n\r\n <mat-autocomplete #auto=\"matAutocomplete\" [displayWith]=\"displayFn\">\r\n <mat-option *ngFor=\"let data of FilteredSource\">\r\n <div (click)=\"toggleSelection(data); !HideChoicesOnSelection && $event.stopPropagation()\">\r\n <mat-checkbox [checked]=\"data.selected\" (change)=\"toggleSelection(data);\" (click)=\"!HideChoicesOnSelection && $event.stopPropagation()\">\r\n {{ data.description }}\r\n </mat-checkbox>\r\n </div>\r\n </mat-option>\r\n </mat-autocomplete>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{
|
|
1584
|
+
template: "<mat-form-field appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top\" [style.width.px]=\"widthPx\">\r\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\r\n <mat-chip-list #chipList>\r\n <ng-container *ngIf=\"selectData.length < ChipThreshold\" >\r\n <mat-chip *ngFor=\"let select of selectData\" class=\"cardinal-colors\" (click)=\"!(readonly || disabled) && removeChip(select)\">\r\n {{ select.description }}\r\n <mat-icon class=\"mat-chip-remove\">cancel</mat-icon>\r\n </mat-chip>\r\n </ng-container>\r\n\r\n <mat-chip *ngIf=\"selectData.length >= ChipThreshold\" class=\"cardinal-colors\" (click)=\"!(readonly || disabled) && removeChip(null)\">\r\n {{ selectData.length }} {{ 'Elements selected' | localize: lc }}\r\n <mat-icon class=\"mat-chip-remove\">cancel</mat-icon>\r\n </mat-chip>\r\n\r\n <input matInput\r\n [matChipInputFor]=\"chipList\"\r\n #htmlInput\r\n #baseInput='ngModel'\r\n type=\"text\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n [placeholder]=\"placeholder\"\r\n [matAutocomplete]=\"auto\"\r\n name=\"val-input\"\r\n id=\"{{id}}\"\r\n [(ngModel)]=\"value\"\r\n [tooltip]=\"tolTemplate\"\r\n [disabled]=\"readonly || disabled\"\r\n (ngModelChange)=\"onModelChange($event)\"\r\n (click)=\"onFocus($event)\"\r\n (focus)=\"checkTooltip();\"\r\n (blur)=\"closeTooltip();\">\r\n </mat-chip-list>\r\n\r\n <mat-autocomplete #auto=\"matAutocomplete\" [displayWith]=\"displayFn\">\r\n <mat-option *ngFor=\"let data of FilteredSource\">\r\n <div (click)=\"toggleSelection(data); !HideChoicesOnSelection && $event.stopPropagation()\">\r\n <mat-checkbox [checked]=\"data.selected\" (change)=\"toggleSelection(data);\" (click)=\"!HideChoicesOnSelection && $event.stopPropagation()\">\r\n {{ data.description }}\r\n </mat-checkbox>\r\n </div>\r\n </mat-option>\r\n </mat-autocomplete>\r\n</mat-form-field>\r\n\r\n<ng-template #tolTemplate>\r\n <div (click)=\"closeTooltip()\">\r\n <span>{{validationFailedBind}}</span>\r\n </div>\r\n</ng-template>",
|
|
1578
1585
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1579
1586
|
providers: [
|
|
1580
1587
|
{ provide: LocalizationService, useClass: BaseValidationLoc },
|
|
@@ -1589,6 +1596,7 @@ ValidationAutocompleteMultiComponent.decorators = [
|
|
|
1589
1596
|
},] }
|
|
1590
1597
|
];
|
|
1591
1598
|
ValidationAutocompleteMultiComponent.ctorParameters = () => [
|
|
1599
|
+
{ type: ChangeDetectorRef },
|
|
1592
1600
|
{ type: Array, decorators: [{ type: Optional }, { type: Inject, args: [NG_VALIDATORS,] }] },
|
|
1593
1601
|
{ type: Array, decorators: [{ type: Optional }, { type: Inject, args: [NG_ASYNC_VALIDATORS,] }] },
|
|
1594
1602
|
{ type: Injector },
|
|
@@ -1713,6 +1721,11 @@ class BaseFormControl {
|
|
|
1713
1721
|
this.BindCheckingGroups = [];
|
|
1714
1722
|
/** Cache delle proprietà scritte tipo --> {prop} */
|
|
1715
1723
|
this.BindProperties = [];
|
|
1724
|
+
this.destroyed$ = new Subject();
|
|
1725
|
+
/**
|
|
1726
|
+
* Variabile per tenere in memoria il fatto che il componente è forzato a invalido o no
|
|
1727
|
+
*/
|
|
1728
|
+
this._forceInvalid = false;
|
|
1716
1729
|
if (ngControl == null) {
|
|
1717
1730
|
if (!this.handleNullNgControl())
|
|
1718
1731
|
console.error("ngControl nullo per qualche motivo! Il 90% delle funzionalità di questo input saranno disabilitate");
|
|
@@ -1772,17 +1785,17 @@ class BaseFormControl {
|
|
|
1772
1785
|
this.InputColWidth = parseInt(ratio[1]);
|
|
1773
1786
|
}
|
|
1774
1787
|
/**
|
|
1775
|
-
* Query sull'elemento '
|
|
1788
|
+
* Query sull'elemento 'baseInput' che funziona in ambiente statico
|
|
1776
1789
|
*
|
|
1777
|
-
* @param {NgModel} comp Elemento HTML marcato con "#
|
|
1790
|
+
* @param {NgModel} comp Elemento HTML marcato con "#baseInput"
|
|
1778
1791
|
*/
|
|
1779
|
-
set
|
|
1792
|
+
set baseInput(comp) { this.registerBaseInput(comp); }
|
|
1780
1793
|
/**
|
|
1781
|
-
* Query sull'elemento '
|
|
1794
|
+
* Query sull'elemento 'baseInput' che funziona in ambiente dinamico
|
|
1782
1795
|
*
|
|
1783
|
-
* @param {NgModel} comp Elemento HTML marcato con "#
|
|
1796
|
+
* @param {NgModel} comp Elemento HTML marcato con "#baseInput"
|
|
1784
1797
|
*/
|
|
1785
|
-
set
|
|
1798
|
+
set baseInput_static(comp) { this.registerBaseInput(comp); }
|
|
1786
1799
|
;
|
|
1787
1800
|
/**
|
|
1788
1801
|
* Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
|
|
@@ -1890,6 +1903,20 @@ class BaseFormControl {
|
|
|
1890
1903
|
return origFunc.apply(formOutsideRef);
|
|
1891
1904
|
};
|
|
1892
1905
|
}
|
|
1906
|
+
if (this.SetValidationSubject) {
|
|
1907
|
+
this.SetValidationSubject.pipe(takeUntil(this.destroyed$)).subscribe(v => {
|
|
1908
|
+
if (v.fieldName + "_internal" == this.GeneratedName) {
|
|
1909
|
+
// Bisogna farlo su entrambi i Control per portare il ".valid" nel punto giusto
|
|
1910
|
+
// e per avere gli stili sull'input
|
|
1911
|
+
let control = this.Form.getControl(this.validationControl);
|
|
1912
|
+
control.setErrors({ forcedtoinvalid: true });
|
|
1913
|
+
control.markAsTouched();
|
|
1914
|
+
this.ngControl.control.setErrors({ forcedtoinvalid: true });
|
|
1915
|
+
this.ngControl.control.markAsTouched();
|
|
1916
|
+
this.cdr.markForCheck();
|
|
1917
|
+
}
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1893
1920
|
}
|
|
1894
1921
|
/**
|
|
1895
1922
|
* Se sono in modalità detatched devo rimuovere manualmente questo controllo quando entro nella dispose, altrimenti se poi ne andassi a riaggiungere
|
|
@@ -1898,6 +1925,8 @@ class BaseFormControl {
|
|
|
1898
1925
|
ngOnDestroy() {
|
|
1899
1926
|
if (this.Form && this.validationControl && !!this.Form.getControl(this.validationControl))
|
|
1900
1927
|
this.Form.removeControl(this.validationControl);
|
|
1928
|
+
this.destroyed$.next();
|
|
1929
|
+
this.destroyed$.complete();
|
|
1901
1930
|
}
|
|
1902
1931
|
/** Elabora i validatori iniettati e capisce se il valore è obbligatorio o meno */
|
|
1903
1932
|
checkRequiredValidator() {
|
|
@@ -1954,7 +1983,7 @@ class BaseFormControl {
|
|
|
1954
1983
|
*
|
|
1955
1984
|
* @param {NgModel} comp Elemento HTML marcato con "#validationControl"
|
|
1956
1985
|
*/
|
|
1957
|
-
|
|
1986
|
+
registerBaseInput(comp) {
|
|
1958
1987
|
if (comp) {
|
|
1959
1988
|
// È 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)
|
|
1960
1989
|
if (this.validationControl && this.Form)
|
|
@@ -2034,6 +2063,63 @@ class BaseFormControl {
|
|
|
2034
2063
|
if (this.FAV_DEBUG_MODE)
|
|
2035
2064
|
console.log("@forms-and-validations: " + message);
|
|
2036
2065
|
}
|
|
2066
|
+
/**
|
|
2067
|
+
* Imposta il componente come "submitted" scatenandone le validazioni ed eventualmente la visualizzazione del tooltip di errore
|
|
2068
|
+
*
|
|
2069
|
+
* @param {boolean} val **true** se si vuole impostare questo controllo come submitted, **false** altrimenti
|
|
2070
|
+
*/
|
|
2071
|
+
set submitted(val) {
|
|
2072
|
+
this._submitted = val;
|
|
2073
|
+
if (!this.baseInput)
|
|
2074
|
+
return;
|
|
2075
|
+
if (val) {
|
|
2076
|
+
this.baseInput.control.markAsTouched();
|
|
2077
|
+
}
|
|
2078
|
+
if (this.baseInput.control.status === "INVALID" && val) { /*this.showTooltipWithMessage();*/ }
|
|
2079
|
+
else { /*this.tooltip.hide();*/ }
|
|
2080
|
+
}
|
|
2081
|
+
/**
|
|
2082
|
+
* Imposta il componente come "invalid" a prescindere dai validatori
|
|
2083
|
+
*/
|
|
2084
|
+
set forceInvalid(val) {
|
|
2085
|
+
this._forceInvalid = val;
|
|
2086
|
+
if (val)
|
|
2087
|
+
setTimeout(() => {
|
|
2088
|
+
this.baseInput.control.setErrors({ forcedtoinvalid: true });
|
|
2089
|
+
this.baseInput.control.markAsTouched();
|
|
2090
|
+
this.baseInput.control.markAsDirty();
|
|
2091
|
+
this.cdr.detectChanges();
|
|
2092
|
+
});
|
|
2093
|
+
else
|
|
2094
|
+
setTimeout(() => {
|
|
2095
|
+
this.baseInput.control.setErrors({ forcedtoinvalid: null });
|
|
2096
|
+
this.baseInput.control.updateValueAndValidity();
|
|
2097
|
+
});
|
|
2098
|
+
}
|
|
2099
|
+
/**
|
|
2100
|
+
* @ignore
|
|
2101
|
+
*/
|
|
2102
|
+
setDisabledState(isDisabled) {
|
|
2103
|
+
isDisabled ? this.baseInput.control.disable() : this.baseInput.control.enable();
|
|
2104
|
+
this.Readonly = isDisabled;
|
|
2105
|
+
}
|
|
2106
|
+
/**
|
|
2107
|
+
* Registra il Subject per ricevere le richieste di Focus dall'esterno
|
|
2108
|
+
*/
|
|
2109
|
+
registerFocusRequest() {
|
|
2110
|
+
if (!this.FocusSubject)
|
|
2111
|
+
return;
|
|
2112
|
+
this.observable = this.FocusSubject.subscribe(t => {
|
|
2113
|
+
this.htmlInput.nativeElement.focus();
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
2116
|
+
/**
|
|
2117
|
+
* Deregistra il Subject delle richieste di focus
|
|
2118
|
+
*/
|
|
2119
|
+
deregisterFocusRequest() {
|
|
2120
|
+
if (this.observable)
|
|
2121
|
+
this.observable.unsubscribe();
|
|
2122
|
+
}
|
|
2037
2123
|
}
|
|
2038
2124
|
BaseFormControl.decorators = [
|
|
2039
2125
|
{ type: Directive }
|
|
@@ -2076,11 +2162,14 @@ BaseFormControl.propDecorators = {
|
|
|
2076
2162
|
Display: [{ type: Input }],
|
|
2077
2163
|
Readonly: [{ type: Input }],
|
|
2078
2164
|
LabelInputRatio: [{ type: Input }],
|
|
2079
|
-
|
|
2080
|
-
|
|
2165
|
+
htmlInput: [{ type: ViewChild, args: ['htmlInput', { static: false },] }],
|
|
2166
|
+
baseInput: [{ type: ViewChild, args: ["baseInput", { static: false },] }],
|
|
2167
|
+
baseInput_static: [{ type: ViewChild, args: ["baseInput", { static: true },] }],
|
|
2081
2168
|
inputChange: [{ type: Output }],
|
|
2082
2169
|
inputFocus: [{ type: Output }],
|
|
2083
|
-
inputFinalized: [{ type: Output }]
|
|
2170
|
+
inputFinalized: [{ type: Output }],
|
|
2171
|
+
submitted: [{ type: Input, args: ["submitted",] }],
|
|
2172
|
+
forceInvalid: [{ type: Input }]
|
|
2084
2173
|
};
|
|
2085
2174
|
|
|
2086
2175
|
/**
|
|
@@ -2908,6 +2997,7 @@ class FormInputComponent extends BaseFormControl {
|
|
|
2908
2997
|
this.HasSuffix = false;
|
|
2909
2998
|
/** Indica la presenza o meno di un prefisso, si basa sulla "truthiness" della proiezione **prefix** */
|
|
2910
2999
|
this.HasPrefix = false;
|
|
3000
|
+
this.ShowPassword = false;
|
|
2911
3001
|
}
|
|
2912
3002
|
/** @ignore */
|
|
2913
3003
|
writeValue(obj) {
|
|
@@ -2921,11 +3011,16 @@ class FormInputComponent extends BaseFormControl {
|
|
|
2921
3011
|
}
|
|
2922
3012
|
/** @ignore */
|
|
2923
3013
|
onNotNullValueSet() { }
|
|
3014
|
+
onShowHidePassword(event) {
|
|
3015
|
+
this.Password = !this.Password;
|
|
3016
|
+
this.ShowPassword = !this.ShowPassword;
|
|
3017
|
+
event.preventDefault();
|
|
3018
|
+
}
|
|
2924
3019
|
}
|
|
2925
3020
|
FormInputComponent.decorators = [
|
|
2926
3021
|
{ type: Component, args: [{
|
|
2927
3022
|
selector: "form-input",
|
|
2928
|
-
template: "<!-- Uguale in tutti i componenti --------------------------------------------------------------------------->\r\n<ng-container *ngIf=\"!FormLayout && (!DisplayMode || (DisplayLayout != 'hidden' && DisplayCondition))\">\r\n <ng-container *ngIf=\"DisplayMode && !DisplayModeTemplate\">\r\n <ng-container *ngIf=\"DisplayLayout == 'form'\">{{ EvaluatedModel }}</ng-container>\r\n <div *ngIf=\"DisplayLayout == 'inline'\" class=\"app-inline\">{{ EvaluatedModel }}</div>\r\n </ng-container>\r\n <ng-container *ngIf=\"DisplayMode && DisplayModeTemplate\"><ng-container *ngTemplateOutlet=\"DisplayModeTemplate, context: { $implicit: EvaluatedModel }\"></ng-container></ng-container>\r\n <div [hidden]=\"DisplayMode\"><ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container></div>\r\n</ng-container>\r\n\r\n<div *ngIf=\"FormLayout && (!DisplayMode || (DisplayLayout != 'hidden' && DisplayCondition))\" class=\"{{FormGroupClass + (Last ? ' app-margin-bottom-0 app-margin-right-0 ' : '') + (DisplayLayout == 'inline' && DisplayMode ? (' app-inline-block ' + (!Last ? 'app-margin-right-10' : '')) : ' form-group row')}}\">\r\n
|
|
3023
|
+
template: "<!-- Uguale in tutti i componenti --------------------------------------------------------------------------->\r\n<ng-container *ngIf=\"!FormLayout && (!DisplayMode || (DisplayLayout != 'hidden' && DisplayCondition))\">\r\n <ng-container *ngIf=\"DisplayMode && !DisplayModeTemplate\">\r\n <ng-container *ngIf=\"DisplayLayout == 'form'\">{{ EvaluatedModel }}</ng-container>\r\n <div *ngIf=\"DisplayLayout == 'inline'\" class=\"app-inline\">{{ EvaluatedModel }}</div>\r\n </ng-container>\r\n <ng-container *ngIf=\"DisplayMode && DisplayModeTemplate\"><ng-container *ngTemplateOutlet=\"DisplayModeTemplate, context: { $implicit: EvaluatedModel }\"></ng-container></ng-container>\r\n <div [hidden]=\"DisplayMode\"><ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container></div>\r\n</ng-container>\r\n\r\n<div *ngIf=\"FormLayout && (!DisplayMode || (DisplayLayout != 'hidden' && DisplayCondition))\" class=\"{{FormGroupClass + (Last ? ' app-margin-bottom-0 app-margin-right-0 ' : '') + (DisplayLayout == 'inline' && DisplayMode ? (' app-inline-block ' + (!Last ? 'app-margin-right-10' : '')) : ' form-group row')}}\">\r\n <label class=\"col-md-{{(DisplayMode && DisplayLayout == 'inline' ? 'none app-bold app-margin-bottom-0' : LabelColWidth) + (DisplayMode ? ' app-bold' : ' m-t-5') }}\">{{Label}}{{Required && !DisplayMode ? '*' : ''}}{{Label ? \":\" : \"\"}}</label>\r\n <span *ngIf=\"DisplayMode && DisplayLayout == 'inline' && InlineSeparator != ''\">{{InlineSeparator}}</span>\r\n <div class=\"col-md-{{DisplayMode && DisplayLayout == 'inline' ? 'none app-inline-block' : InputColWidth}}\">\r\n <ng-container *ngIf=\"DisplayMode && !DisplayModeTemplate\">{{ EvaluatedModel }}</ng-container>\r\n <ng-container *ngIf=\"DisplayMode && DisplayModeTemplate\"><ng-container *ngTemplateOutlet=\"DisplayModeTemplate, context: { $implicit: EvaluatedModel }\"></ng-container></ng-container>\r\n <div [hidden]=\"DisplayMode\"><ng-container *ngTemplateOutlet=\"controlTemplate\"></ng-container></div>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n</div>\r\n<!----------------------------------------------------------------------------------------------------------->\r\n\r\n<ng-template #controlTemplate>\r\n <mat-form-field floatLabel=\"never\" appearance=\"{{FieldAppearence}}\" class=\"mat-full-width mat-no-border-top mat-height-fixed\">\r\n <mat-label [class.app-margin-left-25]=\"HasPrefix\" *ngIf=\"Placeholder && FloatingLabel\">{{Placeholder}}</mat-label>\r\n <!--Prefisso-->\r\n <ng-container *ngIf=\"HasPrefix\">\r\n <button type=\"button\"\r\n class=\"mat-button mat-icon-button mat-button-base mat-icon-button-override mat-icon-button-override-prefix\"\r\n matPrefix (click)=\"onPrefixAction.emit(); $event.stopPropagation(); $event.preventDefault();\">\r\n <ng-container *ngTemplateOutlet=\"prefix\"></ng-container>\r\n </button>\r\n </ng-container>\r\n <!--Input-->\r\n <input matInput\r\n #baseInput=\"ngModel\"\r\n #htmlInput\r\n [type]=\"Password ? 'password' : 'text'\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n autocomplete=\"off\"\r\n name=\"base-input\"\r\n class=\"form-control\"\r\n id=\"{{GeneratedName}}\"\r\n [class.app-margin-left-25]=\"HasPrefix\"\r\n [class.mat-input-with-suffix]=\"HasSuffix || Password\"\r\n [(ngModel)]=\"Model\"\r\n [class.checking-field]=\"!Validation\"\r\n [readonly]=\"Frozen\"\r\n [disabled]=\"Readonly\"\r\n [placeholder]=\"FloatingLabel ? undefined : Placeholder\"\r\n (focus)=\"focused($event);\"\r\n (ngModelChange)=\"changed()\"\r\n (keyup)=\"($event.keyCode == 13 || $event.keyCode == 27) && finalized();\"\r\n (blur)=\"finalized();\"\r\n >\r\n <ng-container *ngIf=\"HasSuffix || Password\">\r\n <ng-container *ngIf=\"!Password\">\r\n <button type=\"button\"\r\n class=\"mat-button mat-icon-button mat-button-base mat-icon-button-override mat-icon-button-override-suffix\"\r\n matSuffix (click)=\"onSuffixAction.emit(); $event.stopPropagation(); $event.preventDefault();\">\r\n <ng-container *ngTemplateOutlet=\"suffix\"></ng-container>\r\n </button>\r\n </ng-container>\r\n <!--Password-->\r\n <span class=\"form-input-suffix\" *ngIf=\"Password\">\r\n <ng-container *ngIf=\"Password\" matSuffix>\r\n <a *ngIf=\"ShowPassword\" class=\"fa fa-eye-slash app-fs-16 app-pointer\" (click)=\"onShowHidePassword($event)\"></a>\r\n <a *ngIf=\"!ShowPassword\" class=\"fa fa-eye app-fs-16 app-pointer\" (click)=\"onShowHidePassword($event)\"></a>\r\n </ng-container>\r\n </span>\r\n </ng-container>\r\n </mat-form-field>\r\n</ng-template>",
|
|
2929
3024
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
2930
3025
|
},] }
|
|
2931
3026
|
];
|
|
@@ -2986,7 +3081,7 @@ class FormSelectComponent extends BaseFormControl {
|
|
|
2986
3081
|
*
|
|
2987
3082
|
* Si consiglia di mantenere il default
|
|
2988
3083
|
*/
|
|
2989
|
-
this.EmptyFieldValue = '-
|
|
3084
|
+
this.EmptyFieldValue = '-2000';
|
|
2990
3085
|
/** Se **true** rimuove il simbolino di validazione (croce rossa o tick verde) */
|
|
2991
3086
|
this.ShowValidationSymbol = true;
|
|
2992
3087
|
/** Template per la visualizzazione delle opzioni */
|