fix(sl-range): add value change handler (#572)

context-menu
Denis Korablev 2021-10-19 17:48:39 +04:00 zatwierdzone przez GitHub
rodzic 72f2cbe9e8
commit 25aa8318d9
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 11 dodań i 0 usunięć

Wyświetl plik

@ -138,6 +138,17 @@ export default class SlRange extends LitElement {
emit(this, 'sl-blur');
}
@watch('value', { waitUntilFirstUpdate: true })
handleValueChange() {
this.value = Number(this.value);
if (this.input) {
this.invalid = !this.input.checkValidity();
}
requestAnimationFrame(() => this.syncRange());
}
@watch('disabled')
handleDisabledChange() {
// Disabled form controls are always valid, so we need to recheck validity when the state changes