From f24e5dbb82069a0d4ccc6a9823ef712c3138b28b Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Tue, 25 Jun 2024 00:21:16 +0300 Subject: [PATCH] RED-8748 - added hidden property to filter model --- .../filter-card/filter-card.component.html | 28 ++++++++++--------- src/lib/filtering/filter.service.ts | 5 ++++ src/lib/filtering/models/filter.model.ts | 1 + src/lib/filtering/models/filter.ts | 2 ++ 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/lib/filtering/filter-card/filter-card.component.html b/src/lib/filtering/filter-card/filter-card.component.html index 127487e..7655694 100644 --- a/src/lib/filtering/filter-card/filter-card.component.html +++ b/src/lib/filtering/filter-card/filter-card.component.html @@ -110,19 +110,21 @@ @if (filter.children?.length && filter.expanded) {
@for (child of filter.children; track child) { -
- - - - -
+ @if (!child.hidden) { +
+ + + + +
+ } }
} diff --git a/src/lib/filtering/filter.service.ts b/src/lib/filtering/filter.service.ts index 7215aac..079cff4 100644 --- a/src/lib/filtering/filter.service.ts +++ b/src/lib/filtering/filter.service.ts @@ -41,6 +41,11 @@ export class FilterService { this.showResetFilters$ = this._showResetFilters$; } + get noAnnotationsFilterChecked() { + const filterGroup = this.filterGroups.find(g => g.slug === 'primaryFilters'); + return !!filterGroup?.filters[0]?.children.find(f => f.id === 'no-annotations-filter' && f.checked); + } + get filterGroups(): IFilterGroup[] { return Object.values(this.#filterGroups$.getValue()); } diff --git a/src/lib/filtering/models/filter.model.ts b/src/lib/filtering/models/filter.model.ts index b5fd02b..ac065b8 100644 --- a/src/lib/filtering/models/filter.model.ts +++ b/src/lib/filtering/models/filter.model.ts @@ -10,5 +10,6 @@ export interface IFilter { readonly required?: boolean; readonly disabled?: boolean; readonly helpModeKey?: string; + readonly hidden?: boolean; readonly metadata?: Record; } diff --git a/src/lib/filtering/models/filter.ts b/src/lib/filtering/models/filter.ts index 83f7775..9b591f4 100644 --- a/src/lib/filtering/models/filter.ts +++ b/src/lib/filtering/models/filter.ts @@ -10,6 +10,7 @@ export class Filter implements IFilter, IListable { readonly checker?: (obj?: unknown) => boolean; readonly skipTranslation?: boolean; readonly metadata?: Record; + readonly hidden?: boolean; checked: boolean; matches?: number; @@ -25,6 +26,7 @@ export class Filter implements IFilter, IListable { this.required = !!filter.required; this.skipTranslation = !!filter.skipTranslation; this.metadata = filter.metadata; + this.hidden = !!filter.hidden; } get searchKey(): string {