From e26c6728c93a1f83a7ebe6b6de6ccb299ff928f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Thu, 30 Jun 2022 09:09:41 +0300 Subject: [PATCH] Fixed #2735 - Slider: key support --- src/components/slider/Slider.vue | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/components/slider/Slider.vue b/src/components/slider/Slider.vue index aa76d20c4..7f12dfeeb 100755 --- a/src/components/slider/Slider.vue +++ b/src/components/slider/Slider.vue @@ -189,7 +189,6 @@ export default { case 37: this.decrementValue(event, index); event.preventDefault(); - break; //up and right @@ -197,14 +196,35 @@ export default { case 39: this.incrementValue(event, index); event.preventDefault(); - + break; + + //page down + case 34: + this.decrementValue(event, index, true); + event.preventDefault(); + break; + + //page up + case 33: + this.incrementValue(event, index, true); + event.preventDefault(); + break; + + //home + case 36: + this.updateModel(event, this.min); + break; + + //end + case 35: + this.updateModel(event, this.max); break; default: break; } }, - decrementValue(event, index) { + decrementValue(event, index, pageKey = false) { let newValue; if (this.range) { if (this.step) @@ -215,13 +235,15 @@ export default { else { if (this.step) newValue = this.modelValue - this.step; + else if (!this.step && pageKey) + newValue = this.modelValue - 10; else newValue = this.modelValue - 1; } this.updateModel(event, newValue); event.preventDefault(); }, - incrementValue(event, index) { + incrementValue(event, index, pageKey = false) { let newValue; if (this.range) { if (this.step) @@ -232,6 +254,8 @@ export default { else { if (this.step) newValue = this.modelValue + this.step; + else if (!this.step && pageKey) + newValue = this.modelValue + 10; else newValue = this.modelValue + 1; }