Skip to content

Commit 906b2f5

Browse files
VictorHugoDuranStdonohue
authored andcommitted
Fix - hide search text field in the filter section if the number of facet values does not exceed the maximum number of facet values shown
1 parent ebf9469 commit 906b2f5

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/app/shared/search/search-filters/search-filter/search-facet-filter/search-facet-filter.component.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
104104
*/
105105
isLastPage$: BehaviorSubject<boolean> = new BehaviorSubject(false);
106106

107+
/**
108+
* Emits true if show the search text
109+
*/
110+
isAvailableForShowSearchText: BehaviorSubject<boolean> = new BehaviorSubject(false);
107111
/**
108112
* The value of the input field that is used to query for possible values for this filter
109113
*/
@@ -289,6 +293,8 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
289293
getFirstSucceededRemoteDataPayload(),
290294
tap((facetValues: FacetValues) => {
291295
this.isLastPage$.next(hasNoValue(facetValues?.next));
296+
const hasLimitFacets = facetValues?.page.length < facetValues?.facetLimit;
297+
this.isAvailableForShowSearchText.next(hasLimitFacets && hasNoValue(facetValues?.next));
292298
}),
293299
)),
294300
map((newFacetValues: FacetValues) => {

src/app/shared/search/search-filters/search-filter/search-text-filter/search-text-filter.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@
2626
(submitSuggestion)="onSubmit($event)"
2727
(clickSuggestion)="onClick($event)"
2828
(findSuggestions)="findSuggestions($event)"
29+
*ngIf="!(isAvailableForShowSearchText | async)"
2930
ngDefaultControl></ds-filter-input-suggestions>
3031
</div>

0 commit comments

Comments
 (0)