Add filter groups option
This commit is contained in:
parent
9461df16f7
commit
defdc2af4e
@ -73,7 +73,7 @@ export class FilterService {
|
||||
this._filterGroups$.next([...this.filterGroups.filter(f => f.slug !== newGroup.slug), newGroup]);
|
||||
}
|
||||
|
||||
addFilterGroups(values: IFilterGroup[]): void {
|
||||
addFilterGroups(values: IFilterGroup[], removeOldFilters = false): void {
|
||||
const newFilters = values.map(value => {
|
||||
const oldFilters = this.getGroup(value.slug)?.filters;
|
||||
if (!oldFilters) {
|
||||
@ -84,8 +84,9 @@ export class FilterService {
|
||||
});
|
||||
|
||||
const filterSlugs = newFilters.map(f => f.slug);
|
||||
|
||||
this._filterGroups$.next([...this.filterGroups.filter(f => !filterSlugs.includes(f.slug)), ...newFilters]);
|
||||
this._filterGroups$.next(
|
||||
removeOldFilters ? newFilters : [...this.filterGroups.filter(f => !filterSlugs.includes(f.slug)), ...newFilters],
|
||||
);
|
||||
}
|
||||
|
||||
getGroup(slug: string): IFilterGroup | undefined {
|
||||
|
||||
@ -41,6 +41,10 @@ export abstract class ListingComponent<T extends IListable> extends AutoUnsubscr
|
||||
return this.entitiesService.all;
|
||||
}
|
||||
|
||||
get listingMode(): ListingMode {
|
||||
return this._listingMode$.value;
|
||||
}
|
||||
|
||||
set listingMode(listingMode: ListingMode) {
|
||||
this._listingMode$.next(listingMode);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user