@esfaenza/forms-and-validations 11.2.148 → 11.2.149-beta2

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.
@@ -9,6 +9,7 @@ import { MatInputModule } from '@angular/material/input';
9
9
  import { MatChipsModule } from '@angular/material/chips';
10
10
  import { MatIconModule } from '@angular/material/icon';
11
11
  import { MatCheckboxModule } from '@angular/material/checkbox';
12
+ import { InputTextModule } from 'primeng/inputtext';
12
13
  import { LocalizationService, LocalizationModule } from '@esfaenza/localizations';
13
14
  import { CurrencyMaskModule } from '@esfaenza/ngx-currency-mask';
14
15
  import { AngularMultiSelectModule } from 'angular2-multiselect-dropdown';
@@ -502,11 +503,11 @@ class ValidationSelectComponent extends BaseValidation {
502
503
  /**
503
504
  * valore del campo vuoto della select
504
505
  */
505
- this.emptyFieldValue = "-2";
506
+ this.emptyFieldValue = "-2000";
506
507
  /**
507
508
  * Valore del placeholder
508
509
  */
509
- this.placeHolderValue = "-1";
510
+ this.placeHolderValue = "-1000";
510
511
  /**
511
512
  * Per i componenti non obbligatori indica se fornire un "valore vuoto"
512
513
  */
@@ -1722,6 +1723,10 @@ class BaseFormControl {
1722
1723
  /** Cache delle proprietà scritte tipo --> {prop} */
1723
1724
  this.BindProperties = [];
1724
1725
  this.destroyed$ = new Subject();
1726
+ /**
1727
+ * Variabile per tenere in memoria il fatto che il componente è forzato a invalido o no
1728
+ */
1729
+ this._forceInvalid = false;
1725
1730
  if (ngControl == null) {
1726
1731
  if (!this.handleNullNgControl())
1727
1732
  console.error("ngControl nullo per qualche motivo! Il 90% delle funzionalità di questo input saranno disabilitate");
@@ -1780,19 +1785,6 @@ class BaseFormControl {
1780
1785
  this.LabelColWidth = parseInt(ratio[0]);
1781
1786
  this.InputColWidth = parseInt(ratio[1]);
1782
1787
  }
1783
- /**
1784
- * Query sull'elemento 'validationControl' che funziona in ambiente statico
1785
- *
1786
- * @param {NgModel} comp Elemento HTML marcato con "#validationControl"
1787
- */
1788
- set _validationControl(comp) { this.registerValComp(comp); }
1789
- /**
1790
- * Query sull'elemento 'validationControl' che funziona in ambiente dinamico
1791
- *
1792
- * @param {NgModel} comp Elemento HTML marcato con "#validationControl"
1793
- */
1794
- set validationControl_static(comp) { this.registerValComp(comp); }
1795
- ;
1796
1788
  /**
1797
1789
  * Effettua il Bind/Parse delle varie **Source** unendo le informazioni specificate in **Display**
1798
1790
  *
@@ -1877,7 +1869,7 @@ class BaseFormControl {
1877
1869
  ngOnInit() {
1878
1870
  // A volte nell'ngOnInit non ci passa quindi lo metto sia qui sia nell'afterviewinit, penso che valga per i componenti di terze parti
1879
1871
  // che si collegano per i cazzi loro al form ecc, quindi la parte sopra non serve... BOH
1880
- this.checkRequiredValidator();
1872
+ this.doCheckRequiredValidator();
1881
1873
  //Il nome non c'è se metto standalone : true (CHE NON é DA METTERE)
1882
1874
  //Dato che anche il controllo esterno viene considerato come componente del form, non posso basarmi solo sul nome ma devo aggiungere un tag. In questo caso "_internal"
1883
1875
  // ATTENZIONE: QUALSIASI SIA IL MOTIVO, SE STO COSO VIENE SPOSTATO DALL ngOnInit NON FUNZIONA PIU NULLA
@@ -1895,6 +1887,7 @@ class BaseFormControl {
1895
1887
  let origFunc = this.Form.onSubmit;
1896
1888
  var formOutsideRef = this.Form;
1897
1889
  this.Form.onSubmit = (ev) => {
1890
+ this.submitted = true;
1898
1891
  this.cdr.markForCheck();
1899
1892
  return origFunc.apply(formOutsideRef);
1900
1893
  };
@@ -1902,11 +1895,14 @@ class BaseFormControl {
1902
1895
  if (this.SetValidationSubject) {
1903
1896
  this.SetValidationSubject.pipe(takeUntil(this.destroyed$)).subscribe(v => {
1904
1897
  if (v.fieldName + "_internal" == this.GeneratedName) {
1898
+ // Bisogna farlo su entrambi i Control per portare il ".valid" nel punto giusto
1899
+ // e per avere gli stili sull'input
1905
1900
  let control = this.Form.getControl(this.validationControl);
1906
1901
  control.setErrors({ forcedtoinvalid: true });
1907
1902
  control.markAsTouched();
1908
1903
  this.ngControl.control.setErrors({ forcedtoinvalid: true });
1909
1904
  this.ngControl.control.markAsTouched();
1905
+ this.cdr.markForCheck();
1910
1906
  }
1911
1907
  });
1912
1908
  }
@@ -1922,17 +1918,17 @@ class BaseFormControl {
1922
1918
  this.destroyed$.complete();
1923
1919
  }
1924
1920
  /** Elabora i validatori iniettati e capisce se il valore è obbligatorio o meno */
1925
- checkRequiredValidator() {
1926
- // controllo se è settato un required per decidere in maniera condizionale se utilizzare il validatore required nel componente interno
1921
+ doCheckRequiredValidator() {
1922
+ // Controllo se è settato un required per decidere in maniera condizionale se utilizzare il validatore required nel componente interno
1927
1923
  // 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
1928
- if (this._validators && this._validators.some(elem => elem instanceof RequiredValidator && elem.required))
1924
+ if (this._validators && this.Validation && this._validators.some(elem => elem instanceof RequiredValidator && elem.required))
1929
1925
  this.Required = true;
1930
1926
  }
1931
1927
  /** @ignore */
1932
1928
  ngAfterViewInit() {
1933
1929
  if (!this.ngControl)
1934
1930
  return;
1935
- this.checkRequiredValidator();
1931
+ this.doCheckRequiredValidator();
1936
1932
  }
1937
1933
  /** Helper che collega la funzione di reset del controllo form al controllo di validazione sottostante */
1938
1934
  bindResetFunction() {
@@ -1960,7 +1956,7 @@ class BaseFormControl {
1960
1956
  if (this.Model)
1961
1957
  this.onNotNullValueSet();
1962
1958
  // markForCheck non va bene in quanto arrivano possibilmente 2 update su un solo ciclo di stack
1963
- // setTime*ut che wrappa tutto non va bene sennò spamma delle change detection a suon di interval che rallentano tantissimo l'app
1959
+ // setTimeout che wrappa tutto non va bene sennò spamma delle change detection a suon di interval che rallentano tantissimo l'app
1964
1960
  this.cdr.detectChanges();
1965
1961
  }
1966
1962
  /** @ignore */
@@ -1971,17 +1967,15 @@ class BaseFormControl {
1971
1967
  registerOnTouched(fn) {
1972
1968
  this.onTouched = fn;
1973
1969
  }
1974
- /**
1975
- * Registra internamente il componente di validazione, ne imposta i validatori e collega il Form, se presente
1976
- *
1977
- * @param {NgModel} comp Elemento HTML marcato con "#validationControl"
1978
- */
1979
- registerValComp(comp) {
1980
- if (comp) {
1970
+ set baseInput(comp) { this.doRegisterBaseInput(comp); }
1971
+ set baseInput_static(comp) { this.doRegisterBaseInput(comp); }
1972
+ ;
1973
+ doRegisterBaseInput(baseInput) {
1974
+ if (baseInput) {
1981
1975
  // È 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)
1982
1976
  if (this.validationControl && this.Form)
1983
1977
  this.Form.removeControl(this.validationControl);
1984
- this.validationControl = comp;
1978
+ this.validationControl = baseInput;
1985
1979
  //Questa serve per passare avanti i validatori
1986
1980
  if (this.UseUserValidators)
1987
1981
  this.validationControl.control.setValidators(this._validators);
@@ -1992,10 +1986,11 @@ class BaseFormControl {
1992
1986
  }
1993
1987
  if (this.ngControl)
1994
1988
  this.bindResetFunction();
1995
- //I val-roba questo lo fanno automaticamente dentro... gli altri no (es. semplice input checkbox)
1996
- this.updateValidityForNativeInput();
1989
+ // I val-roba questo lo fanno automaticamente dentro... gli altri no (es. semplice input checkbox)
1990
+ this.doUpdateValidityForNativeInput();
1997
1991
  }
1998
1992
  }
1993
+ //#endregion
1999
1994
  registerForm(ngForm) {
2000
1995
  this.Form = ngForm;
2001
1996
  this.Form.addControl(this.validationControl);
@@ -2006,9 +2001,8 @@ class BaseFormControl {
2006
2001
  *
2007
2002
  * @param {boolean} forcedValue Forza l'aggiornamento anche se non è un input nativo (input nativo = checkbox, ad esempio)
2008
2003
  */
2009
- updateValidityForNativeInput(forcedValue = false) {
2010
- if (forcedValue || this.nativeInput)
2011
- this.validationControl.control.updateValueAndValidity();
2004
+ doUpdateValidityForNativeInput(forcedValue = false) {
2005
+ this.validationControl.control.updateValueAndValidity();
2012
2006
  }
2013
2007
  /**
2014
2008
  * @ignore
@@ -2056,6 +2050,64 @@ class BaseFormControl {
2056
2050
  if (this.FAV_DEBUG_MODE)
2057
2051
  console.log("@forms-and-validations: " + message);
2058
2052
  }
2053
+ /**
2054
+ * Imposta il componente come "submitted" scatenandone le validazioni ed eventualmente la visualizzazione del tooltip di errore
2055
+ *
2056
+ * @param {boolean} val **true** se si vuole impostare questo controllo come submitted, **false** altrimenti
2057
+ */
2058
+ set submitted(val) {
2059
+ this._submitted = val;
2060
+ if (!this.validationControl)
2061
+ return;
2062
+ if (val) {
2063
+ this.validationControl.control.markAsTouched();
2064
+ this.validationControl.control.markAsDirty();
2065
+ }
2066
+ if (this.validationControl.control.status === "INVALID" && val) { /*this.showTooltipWithMessage();*/ }
2067
+ else { /*this.tooltip.hide();*/ }
2068
+ }
2069
+ /**
2070
+ * Imposta il componente come "invalid" a prescindere dai validatori
2071
+ */
2072
+ set forceInvalid(val) {
2073
+ this._forceInvalid = val;
2074
+ if (val)
2075
+ setTimeout(() => {
2076
+ this.validationControl.control.setErrors({ forcedtoinvalid: true });
2077
+ this.validationControl.control.markAsTouched();
2078
+ this.validationControl.control.markAsDirty();
2079
+ this.cdr.detectChanges();
2080
+ });
2081
+ else
2082
+ setTimeout(() => {
2083
+ this.validationControl.control.setErrors({ forcedtoinvalid: null });
2084
+ this.validationControl.control.updateValueAndValidity();
2085
+ });
2086
+ }
2087
+ /**
2088
+ * @ignore
2089
+ */
2090
+ setDisabledState(isDisabled) {
2091
+ isDisabled ? this.validationControl.control.disable() : this.validationControl.control.enable();
2092
+ this.Readonly = isDisabled;
2093
+ }
2094
+ /**
2095
+ * Registra il Subject per ricevere le richieste di Focus dall'esterno
2096
+ */
2097
+ registerFocusRequest() {
2098
+ if (!this.FocusSubject)
2099
+ return;
2100
+ this.observable = this.FocusSubject.subscribe(t => {
2101
+ this.htmlInput.nativeElement.focus();
2102
+ });
2103
+ }
2104
+ /**
2105
+ * Deregistra il Subject delle richieste di focus
2106
+ */
2107
+ deregisterFocusRequest() {
2108
+ if (this.observable)
2109
+ this.observable.unsubscribe();
2110
+ }
2059
2111
  }
2060
2112
  BaseFormControl.decorators = [
2061
2113
  { type: Directive }
@@ -2098,11 +2150,14 @@ BaseFormControl.propDecorators = {
2098
2150
  Display: [{ type: Input }],
2099
2151
  Readonly: [{ type: Input }],
2100
2152
  LabelInputRatio: [{ type: Input }],
2101
- _validationControl: [{ type: ViewChild, args: ["validationControl", { static: false },] }],
2102
- validationControl_static: [{ type: ViewChild, args: ["validationControl", { static: true },] }],
2153
+ htmlInput: [{ type: ViewChild, args: ['htmlInput', { static: false },] }],
2103
2154
  inputChange: [{ type: Output }],
2104
2155
  inputFocus: [{ type: Output }],
2105
- inputFinalized: [{ type: Output }]
2156
+ inputFinalized: [{ type: Output }],
2157
+ baseInput: [{ type: ViewChild, args: ["baseInput", { static: false },] }],
2158
+ baseInput_static: [{ type: ViewChild, args: ["baseInput", { static: true },] }],
2159
+ submitted: [{ type: Input, args: ["submitted",] }],
2160
+ forceInvalid: [{ type: Input }]
2106
2161
  };
2107
2162
 
2108
2163
  /**
@@ -2916,7 +2971,7 @@ FormDateComponent.propDecorators = {
2916
2971
 
2917
2972
  // Angular
2918
2973
  /** Semplice componente di Input testuale, con eventuale prefisso/suffisso */
2919
- class FormInputComponent extends BaseFormControl {
2974
+ class FormInputComponentOLD extends BaseFormControl {
2920
2975
  /** @ignore Costruttore */
2921
2976
  constructor(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY, FAV_DEBUG_MODE) {
2922
2977
  super(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY, FAV_DEBUG_MODE);
@@ -2930,6 +2985,7 @@ class FormInputComponent extends BaseFormControl {
2930
2985
  this.HasSuffix = false;
2931
2986
  /** Indica la presenza o meno di un prefisso, si basa sulla "truthiness" della proiezione **prefix** */
2932
2987
  this.HasPrefix = false;
2988
+ this.ShowPassword = false;
2933
2989
  }
2934
2990
  /** @ignore */
2935
2991
  writeValue(obj) {
@@ -2943,15 +2999,37 @@ class FormInputComponent extends BaseFormControl {
2943
2999
  }
2944
3000
  /** @ignore */
2945
3001
  onNotNullValueSet() { }
3002
+ onShowHidePassword(event) {
3003
+ this.Password = !this.Password;
3004
+ this.ShowPassword = !this.ShowPassword;
3005
+ event.preventDefault();
3006
+ }
3007
+ /**
3008
+ * @ignore
3009
+ */
3010
+ ngOnInit() {
3011
+ super.ngOnInit();
3012
+ this.registerFocusRequest();
3013
+ // Controllo se è settato un required per decidere in maniera condizionale se utilizzare il validatore required nel componente interno
3014
+ if (this._validators && this.Validation && this._validators.some(elem => elem instanceof RequiredValidator))
3015
+ this.Required = true;
3016
+ }
3017
+ /**
3018
+ * @ignore
3019
+ */
3020
+ ngOnDestroy() {
3021
+ super.ngOnDestroy();
3022
+ this.deregisterFocusRequest();
3023
+ }
2946
3024
  }
2947
- FormInputComponent.decorators = [
3025
+ FormInputComponentOLD.decorators = [
2948
3026
  { type: Component, args: [{
2949
- selector: "form-input",
2950
- 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\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\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 <val-input [FocusSubject]=\"FocusSubject\" [SetValidationSubject]=\"SetValidationSubject\" [FieldAppearence]=\"FieldAppearence\"\r\n [noValidate]=\"!Validation\"\r\n [Frozen]=\"Frozen\"\r\n [submitted]=\"Form?.submitted\"\r\n [readonly]=\"Readonly\"\r\n [forceInvalid]=\"ForcedError\" \r\n [FloatingLabel]=\"FloatingLabel\"\r\n type=\"text\"\r\n [(ngModel)]=\"Model\"\r\n [id]=\"GeneratedName\"\r\n name=\"{{GeneratedName}}\"\r\n autocomplete=\"off\"\r\n #validationControl=\"ngModel\"\r\n (inputChange)=\"changed();\"\r\n (inputFocus)=\"focused($event);\"\r\n (inputFinalized)=\"finalized()\"\r\n [placeholder]=\"Placeholder\"\r\n [validationFailed]=\"FailedValidationMessage\"\r\n [Password]=\"Password\">\r\n <ng-container *ngIf=\"HasSuffix\">\r\n <ng-template #suffix_internal>\r\n <button type=\"button\" 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-template>\r\n </ng-container>\r\n <ng-container *ngIf=\"HasPrefix\">\r\n <ng-template #prefix_internal>\r\n <button type=\"button\" 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-template>\r\n </ng-container>\r\n </val-input>\r\n</ng-template>",
3027
+ selector: "form-input-old",
3028
+ 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>",
2951
3029
  changeDetection: ChangeDetectionStrategy.OnPush
2952
3030
  },] }
2953
3031
  ];
2954
- FormInputComponent.ctorParameters = () => [
3032
+ FormInputComponentOLD.ctorParameters = () => [
2955
3033
  { type: ChangeDetectorRef },
2956
3034
  { type: NgControl, decorators: [{ type: Optional }, { type: Self }] },
2957
3035
  { type: Array, decorators: [{ type: Optional }, { type: Inject, args: [NG_VALIDATORS,] }] },
@@ -2960,7 +3038,7 @@ FormInputComponent.ctorParameters = () => [
2960
3038
  { type: String, decorators: [{ type: Optional }, { type: Inject, args: [ACO_CUSTOMKEY,] }] },
2961
3039
  { type: Boolean, decorators: [{ type: Optional }, { type: Inject, args: [FAV_DEBUG_MODE,] }] }
2962
3040
  ];
2963
- FormInputComponent.propDecorators = {
3041
+ FormInputComponentOLD.propDecorators = {
2964
3042
  Password: [{ type: Input }],
2965
3043
  onSuffixAction: [{ type: Output }],
2966
3044
  onPrefixAction: [{ type: Output }],
@@ -3008,7 +3086,7 @@ class FormSelectComponent extends BaseFormControl {
3008
3086
  *
3009
3087
  * Si consiglia di mantenere il default
3010
3088
  */
3011
- this.EmptyFieldValue = '-2';
3089
+ this.EmptyFieldValue = '-2000';
3012
3090
  /** Se **true** rimuove il simbolino di validazione (croce rossa o tick verde) */
3013
3091
  this.ShowValidationSymbol = true;
3014
3092
  /** Template per la visualizzazione delle opzioni */
@@ -3635,6 +3713,64 @@ FormTimeComponent.propDecorators = {
3635
3713
  InOutFormat: [{ type: Input }]
3636
3714
  };
3637
3715
 
3716
+ // Angular
3717
+ class FormInputComponent extends BaseFormControl {
3718
+ constructor(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY, FAV_DEBUG_MODE) {
3719
+ super(cdr, ngControl, _validators, ac, AppContext, ACO_CUSTOMKEY, FAV_DEBUG_MODE);
3720
+ this.Password = false;
3721
+ this.onSuffixAction = new EventEmitter();
3722
+ this.onPrefixAction = new EventEmitter();
3723
+ this.HasSuffix = false;
3724
+ this.HasPrefix = false;
3725
+ }
3726
+ ngOnInit() {
3727
+ super.ngOnInit();
3728
+ this.registerFocusRequest();
3729
+ }
3730
+ ngOnDestroy() {
3731
+ super.ngOnDestroy();
3732
+ this.deregisterFocusRequest();
3733
+ }
3734
+ writeValue(obj) {
3735
+ this.EvaluatedModel = (obj === null || obj === void 0 ? void 0 : obj.toString()) || "";
3736
+ super.writeValue(obj);
3737
+ }
3738
+ ngAfterContentInit() {
3739
+ this.HasSuffix = !!this.suffix && !this.Password;
3740
+ this.HasPrefix = !!this.prefix;
3741
+ }
3742
+ onNotNullValueSet() { }
3743
+ onBlur() {
3744
+ var _a, _b;
3745
+ this.validationControl.control.markAsDirty();
3746
+ this.inputFinalized.emit((_b = (_a = this.ngControl) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.toString());
3747
+ }
3748
+ }
3749
+ FormInputComponent.decorators = [
3750
+ { type: Component, args: [{
3751
+ selector: "form-input",
3752
+ 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 <span [class.p-float-label]=\"FloatingLabel && (!HasPrefix && !HasSuffix)\" \r\n [class.p-input-icon-right]=\"Password || HasSuffix\"\r\n [class.p-input-icon-left]=\"HasPrefix\">\r\n <!--Prefisso-->\r\n <ng-container *ngIf=\"HasPrefix\">\r\n <i (click)=\"onPrefixAction.emit(); $event.stopPropagation(); $event.preventDefault();\" style=\"cursor: pointer;\">\r\n <ng-container *ngTemplateOutlet=\"prefix\"></ng-container>\r\n </i>\r\n </ng-container>\r\n <!--Input-->\r\n <input pInputText #baseInput=\"ngModel\" #htmlInput\r\n name=\"{{GeneratedName}}\" id=\"{{GeneratedName}}\"\r\n [type]=\"Password ? 'password' : 'text'\"\r\n triggers=\"\"\r\n placement=\"top\"\r\n autocomplete=\"off\"\r\n [class.app-margin-left-25]=\"HasPrefix\"\r\n [(ngModel)]=\"Model\"\r\n style=\"box-shadow: unset\"\r\n [readonly]=\"Frozen\"\r\n [disabled]=\"Readonly\"\r\n [placeholder]=\"FloatingLabel ? '' : Placeholder\"\r\n (focus)=\"focused($event);\"\r\n (ngModelChange)=\"changed()\"\r\n (keyup)=\"($event.keyCode == 13 || $event.keyCode == 27) && onBlur();\"\r\n (blur)=\"onBlur();\"\r\n >\r\n <label *ngIf=\"Placeholder && FloatingLabel\" htmlFor=\"{{GeneratedName}}\">\r\n {{Placeholder}}\r\n </label>\r\n <!--Password-->\r\n <i *ngIf=\"Password && htmlInput.type == 'password'\" class=\"fa fas fa-eye\" style=\"cursor: pointer;\" (click)=\"htmlInput.type = 'text'\"></i>\r\n <i *ngIf=\"Password && htmlInput.type == 'text'\" class=\"fa fas fa-eye-slash\" style=\"cursor: pointer;\" (click)=\"htmlInput.type = 'password'\"></i>\r\n <!--Suffisso-->\r\n <ng-container *ngIf=\"HasSuffix\">\r\n <i (click)=\"onSuffixAction.emit(); $event.stopPropagation(); $event.preventDefault();\" style=\"cursor: pointer;\">\r\n <ng-container *ngTemplateOutlet=\"suffix\"></ng-container>\r\n </i>\r\n </ng-container>\r\n </span>\r\n</ng-template>",
3753
+ changeDetection: ChangeDetectionStrategy.OnPush,
3754
+ styles: [".p-inputtext{width:100%}.p-input-icon-left,.p-input-icon-right{display:block!important}"]
3755
+ },] }
3756
+ ];
3757
+ FormInputComponent.ctorParameters = () => [
3758
+ { type: ChangeDetectorRef },
3759
+ { type: NgControl, decorators: [{ type: Optional }, { type: Self }] },
3760
+ { type: Array, decorators: [{ type: Optional }, { type: Inject, args: [NG_VALIDATORS,] }] },
3761
+ { type: AccessControlService, decorators: [{ type: Optional }] },
3762
+ { type: ComponentContext, decorators: [{ type: Optional }] },
3763
+ { type: String, decorators: [{ type: Optional }, { type: Inject, args: [ACO_CUSTOMKEY,] }] },
3764
+ { type: Boolean, decorators: [{ type: Optional }, { type: Inject, args: [FAV_DEBUG_MODE,] }] }
3765
+ ];
3766
+ FormInputComponent.propDecorators = {
3767
+ Password: [{ type: Input }],
3768
+ onSuffixAction: [{ type: Output }],
3769
+ onPrefixAction: [{ type: Output }],
3770
+ suffix: [{ type: ContentChild, args: ["suffix", { static: false },] }],
3771
+ prefix: [{ type: ContentChild, args: ["prefix", { static: false },] }]
3772
+ };
3773
+
3638
3774
  // Angular
3639
3775
  /**
3640
3776
  * Formato in display (modalità lunga, con ore, minuti e secondi) delle date per tutti i componenti che utilizzino input data.
@@ -3663,6 +3799,7 @@ const COMPONENTS = [
3663
3799
  FormCheckboxComponent,
3664
3800
  FormDateComponent,
3665
3801
  FormEmptyComponent,
3802
+ FormInputComponentOLD,
3666
3803
  FormInputComponent,
3667
3804
  FormSelectComponent,
3668
3805
  FormTextareaComponent,
@@ -3696,7 +3833,8 @@ const MODULES = [
3696
3833
  CurrencyMaskModule,
3697
3834
  MatAutocompleteModule,
3698
3835
  NgxMatDatetimePickerModule,
3699
- NgxMatTimepickerModule
3836
+ NgxMatTimepickerModule,
3837
+ InputTextModule
3700
3838
  ];
3701
3839
  /**
3702
3840
  * Moduli utilizzati dalla libreria e che devono essere esposti all'esterno
@@ -3735,5 +3873,5 @@ FormsAndValidationsModule.decorators = [
3735
3873
  * Generated bundle index. Do not edit.
3736
3874
  */
3737
3875
 
3738
- export { ACO_CUSTOMKEY, AppFile, BaseFormControl, ChangeEvent, FAV_DEBUG_MODE, FAV_LOCALE, FAV_SLIDER_MODE, FormAdaptiveComponent, FormAutocompleteComponent, FormCheckboxComponent, FormDateComponent, FormDateTimeComponent, FormEmptyComponent, FormErrorComponent, FormFileComponent, FormInfoComponent, FormInputComponent, FormSelectComponent, FormTemplateComponent, FormTextareaComponent, FormTimeComponent, FormsAndValidationsModule, FormsAndValidationsModuleConfig, NgxExpandedDayJsDateAdapter, ValidationAutocompleteComponent, ValidationAutocompleteMultiComponent, ValidationCurrencyComponent, ValidationDateComponent, ValidationDateTimeComponent, ValidationInputComponent, ValidationSelectComponent, ValidationTextAreaComponent, BaseValidation as ɵa, BaseValidationLoc as ɵb, CustomRequiredDirective as ɵc, FormSelectComponentLoc as ɵd, FormAdaptiveComponentLoc as ɵe, FormMultiSelectComponent as ɵf, FormMultiSelectComponentLoc as ɵg, FormFileComponentLoc as ɵh, FormAutocompleteComponentLoc as ɵi };
3876
+ export { ACO_CUSTOMKEY, AppFile, BaseFormControl, ChangeEvent, FAV_DEBUG_MODE, FAV_LOCALE, FAV_SLIDER_MODE, FormAdaptiveComponent, FormAutocompleteComponent, FormCheckboxComponent, FormDateComponent, FormDateTimeComponent, FormEmptyComponent, FormErrorComponent, FormFileComponent, FormInfoComponent, FormInputComponentOLD, FormSelectComponent, FormTemplateComponent, FormTextareaComponent, FormTimeComponent, FormsAndValidationsModule, FormsAndValidationsModuleConfig, NgxExpandedDayJsDateAdapter, ValidationAutocompleteComponent, ValidationAutocompleteMultiComponent, ValidationCurrencyComponent, ValidationDateComponent, ValidationDateTimeComponent, ValidationInputComponent, ValidationSelectComponent, ValidationTextAreaComponent, BaseValidation as ɵa, BaseValidationLoc as ɵb, CustomRequiredDirective as ɵc, FormInputComponent as ɵd, FormSelectComponentLoc as ɵe, FormAdaptiveComponentLoc as ɵf, FormMultiSelectComponent as ɵg, FormMultiSelectComponentLoc as ɵh, FormFileComponentLoc as ɵi, FormAutocompleteComponentLoc as ɵj };
3739
3877
  //# sourceMappingURL=esfaenza-forms-and-validations.js.map