Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 8x 8x 8x 8x 8x 8x 31x 31x 10x 10x 7x | import { Component, Input } from "@angular/core"
import { parseNumberInput } from "../../util/parseNumberInput"
import { MatLabel, MatFormField } from "@angular/material/form-field"
import { MatSlider, MatSliderThumb } from "@angular/material/slider"
import { MatInput } from "@angular/material/input"
@Component({
selector: "cc-slider",
templateUrl: "./slider.component.html",
styleUrls: ["./slider.component.scss"],
standalone: true,
imports: [MatLabel, MatSlider, MatSliderThumb, MatFormField, MatInput]
})
export class SliderComponent {
@Input() value?: number
@Input() min: number
@Input() max: number
@Input() label: string
@Input() step?: number = 1
@Input() disabled?: boolean = false
@Input() onChange: (number) => void
handleSliderOnChange(value: number) {
Iif (value !== this.value) {
this.onChange(value)
}
}
handleInputOnChange($event: Event) {
const newValue = parseNumberInput($event, this.min, this.max)
if (newValue !== this.value && !Number.isNaN(newValue)) {
this.onChange(newValue)
}
}
}
|