@esfaenza/forms-and-validations 15.2.55 → 15.2.56

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.
@@ -3831,6 +3831,7 @@ class FormAutocompleteComponent extends BaseFormControl {
3831
3831
  return;
3832
3832
  }
3833
3833
  if (!event || event.length < this.MinChars) {
3834
+ this.log("search event ignored: " + event);
3834
3835
  this.FilteredBoundSource = [];
3835
3836
  this.cdr.markForCheck();
3836
3837
  return;
@@ -3838,8 +3839,11 @@ class FormAutocompleteComponent extends BaseFormControl {
3838
3839
  if (!this.SearchFunction && (!this.Source || this.Source.length == 0))
3839
3840
  throw "Impossibile filtrare gli elementi senza una funzione di ricerca che restituisca una lista di { id: string, description: string }";
3840
3841
  if (this.SearchFunction) {
3842
+ this.log("filtersource enqueue");
3841
3843
  this.throttla("filtersource", () => {
3844
+ this.log("filtersource fire");
3842
3845
  this.doSearchProtected(event, false, this.SearchFunctionContext, (t) => {
3846
+ this.log("filtersource received API response");
3843
3847
  this.Source = t;
3844
3848
  this.tryBindSourceDisplay();
3845
3849
  // In questo caso è già filtrata dalla SearchFunction
@@ -3851,6 +3855,7 @@ class FormAutocompleteComponent extends BaseFormControl {
3851
3855
  }
3852
3856
  else {
3853
3857
  this.throttla("filtersource", () => {
3858
+ this.log("filtersource fire");
3854
3859
  // In questo caso devo filtrare io in memoria
3855
3860
  this.FilteredBoundSource = this.BoundSource.filter(t => (this.CaseSensitive && t.description.includes(event)) || (!this.CaseSensitive && t.description.toLowerCase().includes(event.toLowerCase())));
3856
3861
  this.removeFilteredSourceOnDescriptionSelection();
@@ -3867,9 +3872,12 @@ class FormAutocompleteComponent extends BaseFormControl {
3867
3872
  this.timer = null;
3868
3873
  }, 3000);
3869
3874
  }
3870
- if (this.callsDoneThisThreeSeconds >= this.maxCallsPerSecond)
3875
+ if (this.callsDoneThisThreeSeconds >= this.maxCallsPerSecond) {
3876
+ this.log("Ignoring excessive calls");
3871
3877
  return;
3878
+ }
3872
3879
  this.callsDoneThisThreeSeconds++;
3880
+ this.log("Search function being called...");
3873
3881
  this.SearchFunction(search, byid, context).subscribe(t => {
3874
3882
  onRes(t);
3875
3883
  });