Commits

Victor Hugo Duran Santiago authored and Tim Donohue committed 906b2f5917a
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
No tags

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

Modified
97 97 /**
98 98 * Emits the current last shown page of this facet's values
99 99 */
100 100 currentPage: Observable<number>;
101 101
102 102 /**
103 103 * Emits true if the current page is also the last page available
104 104 */
105 105 isLastPage$: BehaviorSubject<boolean> = new BehaviorSubject(false);
106 106
107 + /**
108 + * Emits true if show the search text
109 + */
110 + isAvailableForShowSearchText: BehaviorSubject<boolean> = new BehaviorSubject(false);
107 111 /**
108 112 * The value of the input field that is used to query for possible values for this filter
109 113 */
110 114 filter: string;
111 115
112 116 /**
113 117 * List of subscriptions to unsubscribe from
114 118 */
115 119 protected subs: Subscription[] = [];
116 120
282 286 /**
283 287 * Retrieves all the filter value suggestion pages that need to be displayed in the facet and combines it into one
284 288 * list.
285 289 */
286 290 protected retrieveFilterValues(): Observable<FacetValues[]> {
287 291 return observableCombineLatest([this.searchOptions$, this.currentPage]).pipe(
288 292 switchMap(([options, page]: [SearchOptions, number]) => this.searchService.getFacetValuesFor(this.filterConfig, page, options).pipe(
289 293 getFirstSucceededRemoteDataPayload(),
290 294 tap((facetValues: FacetValues) => {
291 295 this.isLastPage$.next(hasNoValue(facetValues?.next));
296 + const hasLimitFacets = facetValues?.page.length < facetValues?.facetLimit;
297 + this.isAvailableForShowSearchText.next(hasLimitFacets && hasNoValue(facetValues?.next));
292 298 }),
293 299 )),
294 300 map((newFacetValues: FacetValues) => {
295 301 let filterValues: FacetValues[] = this.facetValues$.value;
296 302
297 303 if (this.collapseNextUpdate) {
298 304 this.showFirstPageOnly();
299 305 filterValues = [];
300 306 this.collapseNextUpdate = false;
301 307 }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut