add option to skip search
This commit is contained in:
parent
c0b445b06e
commit
25d66040d0
@ -4,6 +4,7 @@ import { IListable } from '../listing';
|
||||
|
||||
@Injectable()
|
||||
export class SearchService<T extends IListable> {
|
||||
skip = false;
|
||||
private readonly _query$ = new BehaviorSubject('');
|
||||
readonly valueChanges$ = this._query$.asObservable();
|
||||
|
||||
@ -17,7 +18,7 @@ export class SearchService<T extends IListable> {
|
||||
|
||||
searchIn(entities: T[]): T[] {
|
||||
const searchValue = this.searchValue.toLowerCase();
|
||||
if (!searchValue) {
|
||||
if (!searchValue || this.skip) {
|
||||
return entities;
|
||||
}
|
||||
return entities.filter(entity => entity.searchKey?.includes(searchValue));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user