@naniteninja/dashboard-components-lib 2.1.51 → 2.1.53

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.
@@ -963,6 +963,7 @@ class LibEventFormComponent extends BaseComponent {
963
963
  this.localSuggestions = [];
964
964
  this.showLocalSuggestions = false;
965
965
  this.cancelHideSuggestions = false;
966
+ this.lastSelectedAddress = null;
966
967
  }
967
968
  onDeleteConfirm() {
968
969
  this.showConfirm = false;
@@ -1011,11 +1012,13 @@ class LibEventFormComponent extends BaseComponent {
1011
1012
  }
1012
1013
  }
1013
1014
  onLocationChange(event) {
1015
+ this.lastSelectedAddress = event.address;
1014
1016
  this.form.controls.location.setValue({ coordinates: event.coordinates, address: event.address });
1015
1017
  this.form.controls.address.setValue(event.address);
1016
1018
  this.form.controls.address.setErrors(event.address && event.coordinates ? null : { invalidField: true });
1017
1019
  }
1018
1020
  onLocalSuggestionSelect(suggestion) {
1021
+ this.lastSelectedAddress = suggestion.address;
1019
1022
  this.form.controls.location.setValue({ coordinates: [suggestion.lng, suggestion.lat], address: suggestion.address });
1020
1023
  this.form.controls.address.setValue(suggestion.address);
1021
1024
  this.form.controls.address.setErrors(null);
@@ -1089,12 +1092,13 @@ class LibEventFormComponent extends BaseComponent {
1089
1092
  this.form.controls.allDay.valueChanges.pipe(takeUntil(this.componentDestroyed$)).subscribe((value) => this.handleAllDayEvents(value, true));
1090
1093
  this.form.controls.address.valueChanges
1091
1094
  .pipe(debounceTime(300), distinctUntilChanged(), switchMap((value) => {
1092
- if (!value || value.length < 3 || !this.locationSearchFn) {
1095
+ if (!value || value.length < 3 || !this.locationSearchFn || value === this.lastSelectedAddress) {
1093
1096
  this.showLocalSuggestions = false;
1094
1097
  this.localSuggestions = [];
1095
1098
  this.cdr.markForCheck();
1096
1099
  return of([]);
1097
1100
  }
1101
+ this.lastSelectedAddress = null;
1098
1102
  return this.locationSearchFn(value);
1099
1103
  }), takeUntil(this.componentDestroyed$))
1100
1104
  .subscribe((results) => {