Skip to content

Commit fd7fb5d

Browse files
authored
Merge pull request DSpace#3236 from 4Science/task/main/CST-15589
2 parents 7a24bf2 + 56ba23f commit fd7fb5d

2 files changed

Lines changed: 21 additions & 4 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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ export class SearchRangeFilterComponent extends SearchFacetFilterComponent imple
9191
*/
9292
range: [number | undefined, number | undefined];
9393

94+
/**
95+
* The range currently selected by the slider
96+
*/
97+
sliderRange: [number | undefined, number | undefined];
98+
9499
/**
95100
* Whether the sider is being controlled by the keyboard.
96101
* Supresses any changes until the key is released.
@@ -145,6 +150,15 @@ export class SearchRangeFilterComponent extends SearchFacetFilterComponent imple
145150
};
146151
}
147152

153+
/**
154+
* Updates the sliderRange property with the current slider range.
155+
* This method is called whenever the slider value changes, but it does not immediately apply the changes.
156+
* @param range - The current range selected by the slider
157+
*/
158+
onSliderChange(range: [number | undefined, number | undefined]): void {
159+
this.sliderRange = range;
160+
}
161+
148162
/**
149163
* Submits new custom range values to the range filter from the widget
150164
*/
@@ -182,5 +196,4 @@ export class SearchRangeFilterComponent extends SearchFacetFilterComponent imple
182196
shouldShowSlider(): boolean {
183197
return isPlatformBrowser(this.platformId);
184198
}
185-
186199
}

0 commit comments

Comments
 (0)