Skip to content

Commit fd2bc90

Browse files
authored
Merge pull request DSpace#3245 from alanorth/backport-3236-to-dspace-7_x
[Port dspace-7_x] DSpace#3094 - Update date slider to prevent automatic page reloads
2 parents d5a375e + 288c758 commit fd2bc90

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{{'search.filters.filter.' + filterConfig.name + '.min.label' | translate}}
99
</span>
1010
<input type="text" [(ngModel)]="range[0]" [name]="filterConfig.paramName + '.min'"
11-
class="form-control" (blur)="onSubmit()"
11+
class="form-control"
1212
[attr.aria-label]="minLabel"
1313
[placeholder]="minLabel"
1414
/>
@@ -20,7 +20,7 @@
2020
{{'search.filters.filter.' + filterConfig.name + '.max.label' | translate}}
2121
</span>
2222
<input type="text" [(ngModel)]="range[1]" [name]="filterConfig.paramName + '.max'"
23-
class="form-control" (blur)="onSubmit()"
23+
class="form-control"
2424
[attr.aria-label]="maxLabel"
2525
[placeholder]="maxLabel"
2626
/>
@@ -33,7 +33,8 @@
3333

3434
<ng-container *ngIf="shouldShowSlider()">
3535
<nouislider [connect]="true" [config]="config" [min]="min" [max]="max" [step]="1"
36-
[dsDebounce]="250" (onDebounce)="onSubmit()"
36+
[dsDebounce]="250"
37+
(change)="onSliderChange($event)"
3738
(keydown)="startKeyboardControl()" (keyup)="stopKeyboardControl()"
3839
[(ngModel)]="range" ngDefaultControl>
3940
</nouislider>
@@ -43,5 +44,8 @@
4344
<ds-search-facet-range-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-range-option>
4445
</div>
4546
</ng-container>
47+
<button (click)="onSubmit()" class="btn btn-primary">
48+
{{'search.filters.search.submit' | translate}}
49+
</button>
4650
</div>
4751
</div>

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ export class SearchRangeFilterComponent extends SearchFacetFilterComponent imple
8181
*/
8282
range;
8383

84+
/**
85+
* The range currently selected by the slider
86+
*/
87+
sliderRange: [number | undefined, number | undefined];
88+
8489
/**
8590
* Subscription to unsubscribe from
8691
*/
@@ -138,6 +143,15 @@ export class SearchRangeFilterComponent extends SearchFacetFilterComponent imple
138143
};
139144
}
140145

146+
/**
147+
* Updates the sliderRange property with the current slider range.
148+
* This method is called whenever the slider value changes, but it does not immediately apply the changes.
149+
* @param range - The current range selected by the slider
150+
*/
151+
onSliderChange(range: [number | undefined, number | undefined]): void {
152+
this.sliderRange = range;
153+
}
154+
141155
/**
142156
* Submits new custom range values to the range filter from the widget
143157
*/

0 commit comments

Comments
 (0)