fix(frontend/patents): update year-range display live while dragging, keep request on release
LocationBasedServices/smartguide/pipeline/pr-dev There was a failure building this commit
LocationBasedServices/smartguide/pipeline/pr-dev There was a failure building this commit
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
[max]="maxYear"
|
||||
[value]="selectedStartYear"
|
||||
[style.z-index]="selectedStartYear >= selectedEndYear - 5 ? 4 : 2"
|
||||
(input)="onStartYearDrag($event)"
|
||||
(change)="onStartYearInput($event)"
|
||||
aria-label="Startjahr" />
|
||||
<input
|
||||
@@ -64,6 +65,7 @@
|
||||
[min]="minYear"
|
||||
[max]="maxYear"
|
||||
[value]="selectedEndYear"
|
||||
(input)="onEndYearDrag($event)"
|
||||
(change)="onEndYearInput($event)"
|
||||
aria-label="Endjahr" />
|
||||
</div>
|
||||
|
||||
@@ -121,6 +121,19 @@ export class PatentsComponent implements OnInit {
|
||||
return this.selectedStartYear !== this.minYear || this.selectedEndYear !== this.maxYear;
|
||||
}
|
||||
|
||||
// Fired continuously while dragging: only updates the displayed value/handle
|
||||
// position, no HTTP request yet.
|
||||
onStartYearDrag(event: Event): void {
|
||||
const input = event.target as HTMLInputElement;
|
||||
this.selectedStartYear = Math.min(parseInt(input.value, 10), this.selectedEndYear);
|
||||
}
|
||||
|
||||
onEndYearDrag(event: Event): void {
|
||||
const input = event.target as HTMLInputElement;
|
||||
this.selectedEndYear = Math.max(parseInt(input.value, 10), this.selectedStartYear);
|
||||
}
|
||||
|
||||
// Fired once on release: commits the value and triggers the search request.
|
||||
onStartYearInput(event: Event): void {
|
||||
const input = event.target as HTMLInputElement;
|
||||
this.selectedStartYear = Math.min(parseInt(input.value, 10), this.selectedEndYear);
|
||||
|
||||
Reference in New Issue
Block a user