@esfaenza/forms-and-validations 11.2.131 → 11.2.133

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.
@@ -1955,13 +1955,7 @@
1955
1955
  /** Indica se il campo è obbligatorio i opzionale */
1956
1956
  this.Required = false;
1957
1957
  /** Indica se il Form che contiene questo campo è già stato registrato */
1958
- this.formHasBennBound = false;
1959
- /**
1960
- * Indica se questo campo è staccato dal Form, ad esempio nel caso sia in un ng-template proiettato nel form.
1961
- *
1962
- * In quel caso la variabile **Form** del componente dev'essere valorizzata
1963
- */
1964
- this.detatchedFromform = false;
1958
+ this.formHasBeenBound = false;
1965
1959
  /** @ignore */
1966
1960
  this.propagateChange = function (_) { };
1967
1961
  /** @ignore */
@@ -2059,8 +2053,6 @@
2059
2053
  //.. il quale a sua volta contiene il controllo <form-*> quindi avrò il form nell'input "Form"
2060
2054
  if (ngControl._parent)
2061
2055
  this.Form = ngControl._parent;
2062
- else
2063
- this.detatchedFromform = true;
2064
2056
  //Questa serve per impostare me stesso come si deve, il validatore invece lo passo al validation-input quando viene settato il validationControl
2065
2057
  if (this.ngControl) {
2066
2058
  //Per tutti i validatori: rigenero la funzione di validazione. Per qualche motivo a volte ho validatori senza...
@@ -2227,9 +2219,9 @@
2227
2219
  this.GeneratedName = this.ngControl.name.toString() + "_internal";
2228
2220
  // ATTENZIONE: QUALSIASI SIA IL MOTIVO, SE STO COSO VIENE SPOSTATO DALL ngOnInit NON FUNZIONA PIU NULLA
2229
2221
  if (this.Form) {
2230
- if (!this.formHasBennBound && this.validationControl) {
2222
+ if (!this.formHasBeenBound && this.validationControl) {
2231
2223
  this.Form.addControl(this.validationControl);
2232
- this.formHasBennBound = true;
2224
+ this.formHasBeenBound = true;
2233
2225
  }
2234
2226
  // Quando un form viene submittato la variabile Form.submitted viene assegnata all'input [submitted] del val-control
2235
2227
  // Essendo che però la CD è OnPush per dire ad Angular che l'Input è cambiato e permettere i sideffects di assegnare [submitted]
@@ -2315,9 +2307,9 @@
2315
2307
  if (this.UseUserValidators)
2316
2308
  this.validationControl.control.setValidators(this._validators);
2317
2309
  //Se sono staccato dal Form (vuol dire che sono ad esempio dentro un ng-template) aggiungo il controllo al Form passato come input (context del template)
2318
- if (this.detatchedFromform && this.Form && !this.formHasBennBound) {
2310
+ if (this.Form && !this.formHasBeenBound) {
2319
2311
  this.Form.addControl(this.validationControl);
2320
- this.formHasBennBound = true;
2312
+ this.formHasBeenBound = true;
2321
2313
  }
2322
2314
  if (this.ngControl)
2323
2315
  this.bindResetFunction();
@@ -2328,7 +2320,7 @@
2328
2320
  BaseFormControl.prototype.registerForm = function (ngForm) {
2329
2321
  this.Form = ngForm;
2330
2322
  this.Form.addControl(this.validationControl);
2331
- this.formHasBennBound = true;
2323
+ this.formHasBeenBound = true;
2332
2324
  };
2333
2325
  /**
2334
2326
  * Aggiorna il valore e la validità dell'input sottostante. Non viene chiamato per input nativi come le checkbox
@@ -2809,7 +2801,7 @@
2809
2801
  this.FilteredBoundSource = this.BoundSource;
2810
2802
  return;
2811
2803
  }
2812
- if (!event || event.length < this.MinChars) {
2804
+ if (!event || event.value.length < this.MinChars) {
2813
2805
  this.FilteredBoundSource = [];
2814
2806
  return;
2815
2807
  }
@@ -2817,7 +2809,7 @@
2817
2809
  throw "Impossibile filtrare gli elementi senza una funzione di ricerca che restituisca una lista di { id: string, description: string }";
2818
2810
  if (this.SearchFunction) {
2819
2811
  this.throttla("filtersource", function () {
2820
- _this.SearchFunction(event, false).subscribe(function (t) {
2812
+ _this.SearchFunction(event.value, false).subscribe(function (t) {
2821
2813
  _this.Source = t;
2822
2814
  _this.tryBindSourceDisplay();
2823
2815
  // In questo caso è già filtrata dalla SearchFunction
@@ -2830,7 +2822,7 @@
2830
2822
  else {
2831
2823
  this.throttla("filtersource", function () {
2832
2824
  // In questo caso devo filtrare io in memoria
2833
- _this.FilteredBoundSource = _this.BoundSource.filter(function (t) { return (_this.CaseSensitive && t.description.includes(event)) || (!_this.CaseSensitive && t.description.toLowerCase().includes(event.toLowerCase())); });
2825
+ _this.FilteredBoundSource = _this.BoundSource.filter(function (t) { return (_this.CaseSensitive && t.description.includes(event.value)) || (!_this.CaseSensitive && t.description.toLowerCase().includes(event.value.toLowerCase())); });
2834
2826
  _this.removeFilteredSourceOnDescriptionSelection();
2835
2827
  _this.cdr.markForCheck();
2836
2828
  }, 100);