Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 2x 2x 2x 2x 2x 1x 2x 5x 3x | import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
import { FilterNavigation } from 'ish-core/models/filter-navigation/filter-navigation.model';
import { URLFormParams } from 'ish-core/utils/url-form-params';
@Component({
selector: 'ish-filter-navigation-badges',
templateUrl: './filter-navigation-badges.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class FilterNavigationBadgesComponent implements OnChanges {
@Input({ required: true }) filterNavigation: FilterNavigation;
@Output() applyFilter = new EventEmitter<{ searchParameter: URLFormParams }>();
@Output() clearFilters = new EventEmitter<void>();
selected: { searchParameter: URLFormParams; displayName: string; filterName: string }[];
ngOnChanges() {
this.selected = this.filterNavigation?.filter?.reduce(
(acc, filterElement) => [
...acc,
...filterElement.facets
.filter(facet => facet.selected)
.map(({ searchParameter, displayName }) => ({
filterName: filterElement.name,
displayName,
searchParameter,
})),
],
[]
);
}
apply(searchParameter: URLFormParams) {
this.applyFilter.emit({ searchParameter });
}
clear() {
this.clearFilters.emit();
}
}
|