Skip to content

Commit

Permalink
Merge pull request DSpace#3097 from tdonohue/port_3061_to_main
Browse files Browse the repository at this point in the history
[Port main] Hide search text field when number of facet values is less than the maximum
  • Loading branch information
tdonohue authored May 31, 2024
2 parents b9a1045 + bb341a3 commit b0a8a50
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
(submitSuggestion)="onSubmit($event)"
(clickSuggestion)="onClick($event)"
(findSuggestions)="findSuggestions($event)"
*ngIf="(isAvailableForShowSearchText | async) === false"
ngDefaultControl></ds-filter-input-suggestions>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
*/
isLastPage$: BehaviorSubject<boolean> = new BehaviorSubject(false);

/**
* Emits true if show the search text
*/
isAvailableForShowSearchText: BehaviorSubject<boolean> = new BehaviorSubject(false);
/**
* The value of the input field that is used to query for possible values for this filter
*/
Expand Down Expand Up @@ -289,6 +293,8 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
getFirstSucceededRemoteDataPayload(),
tap((facetValues: FacetValues) => {
this.isLastPage$.next(hasNoValue(facetValues?.next));
const hasLimitFacets = facetValues?.page?.length < facetValues?.facetLimit;
this.isAvailableForShowSearchText.next(hasLimitFacets && hasNoValue(facetValues?.next));
}),
)),
map((newFacetValues: FacetValues) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
(submitSuggestion)="onSubmit($event)"
(clickSuggestion)="onClick($event)"
(findSuggestions)="findSuggestions($event)"
*ngIf="(isAvailableForShowSearchText | async) === false"
ngDefaultControl
></ds-filter-input-suggestions>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
(submitSuggestion)="onSubmit($event)"
(clickSuggestion)="onClick($event)"
(findSuggestions)="findSuggestions($event)"
*ngIf="(isAvailableForShowSearchText | async) === false"
ngDefaultControl></ds-filter-input-suggestions>
</div>

0 comments on commit b0a8a50

Please sign in to comment.