mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
#966 Hide No Search Results on Input Reset (X-Icon)
This commit is contained in:
@@ -9,8 +9,8 @@ import { BehaviorSubject, Observable, of, Subject } from 'rxjs';
|
||||
import {
|
||||
catchError,
|
||||
debounceTime,
|
||||
delay,
|
||||
distinctUntilChanged,
|
||||
filter,
|
||||
map,
|
||||
shareReplay,
|
||||
switchMap,
|
||||
@@ -90,6 +90,7 @@ export abstract class CustomerSearch implements OnInit, OnDestroy {
|
||||
ngOnInit() {
|
||||
this.initAvailableFilters();
|
||||
this.initAutocomplete();
|
||||
this.initStatusRefreshOnReset();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
@@ -133,6 +134,17 @@ export abstract class CustomerSearch implements OnInit, OnDestroy {
|
||||
);
|
||||
}
|
||||
|
||||
private initStatusRefreshOnReset() {
|
||||
this.queryFilter$
|
||||
.pipe(
|
||||
map((fltr) => fltr.query),
|
||||
distinctUntilChanged(),
|
||||
takeUntil(this.destroy$),
|
||||
filter((qs) => !qs || !qs.length)
|
||||
)
|
||||
.subscribe(() => this.searchState$.next('init'));
|
||||
}
|
||||
|
||||
setQueryParams(queryParams: Params) {
|
||||
this.setQuery(queryParams.query);
|
||||
}
|
||||
@@ -272,6 +284,7 @@ export abstract class CustomerSearch implements OnInit, OnDestroy {
|
||||
|
||||
patchQueryFilter(filter: Partial<QueryFilter>) {
|
||||
const current = this.queryFilter;
|
||||
|
||||
const next = { ...current, ...filter };
|
||||
// TODO Check ob QueryFilter geändert wurde, falls gleich kein next Aufruf
|
||||
let hasChanges = false;
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
} from '@angular/core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { EnvironmentService } from '@core/environment';
|
||||
import { CrmCustomerService } from '@domain/crm';
|
||||
import { AutocompleteDTO } from '@swagger/crm';
|
||||
import { UiSearchboxAutocompleteComponent } from '@ui/searchbox';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
@@ -38,8 +37,7 @@ export class CustomerSearchboxComponent implements OnInit, OnDestroy {
|
||||
constructor(
|
||||
public search: CustomerSearch,
|
||||
private environmentService: EnvironmentService,
|
||||
private cdr: ChangeDetectorRef,
|
||||
private crmCustomerService: CrmCustomerService
|
||||
private cdr: ChangeDetectorRef
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
Reference in New Issue
Block a user