Fixed #2735 - Slider: key support

pull/2736/head
Tuğçe Küçükoğlu 2022-06-30 09:09:41 +03:00
parent b9b78ccc81
commit e26c6728c9
1 changed files with 28 additions and 4 deletions

View File

@ -189,7 +189,6 @@ export default {
case 37: case 37:
this.decrementValue(event, index); this.decrementValue(event, index);
event.preventDefault(); event.preventDefault();
break; break;
//up and right //up and right
@ -197,14 +196,35 @@ export default {
case 39: case 39:
this.incrementValue(event, index); this.incrementValue(event, index);
event.preventDefault(); 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; break;
default: default:
break; break;
} }
}, },
decrementValue(event, index) { decrementValue(event, index, pageKey = false) {
let newValue; let newValue;
if (this.range) { if (this.range) {
if (this.step) if (this.step)
@ -215,13 +235,15 @@ export default {
else { else {
if (this.step) if (this.step)
newValue = this.modelValue - this.step; newValue = this.modelValue - this.step;
else if (!this.step && pageKey)
newValue = this.modelValue - 10;
else else
newValue = this.modelValue - 1; newValue = this.modelValue - 1;
} }
this.updateModel(event, newValue); this.updateModel(event, newValue);
event.preventDefault(); event.preventDefault();
}, },
incrementValue(event, index) { incrementValue(event, index, pageKey = false) {
let newValue; let newValue;
if (this.range) { if (this.range) {
if (this.step) if (this.step)
@ -232,6 +254,8 @@ export default {
else { else {
if (this.step) if (this.step)
newValue = this.modelValue + this.step; newValue = this.modelValue + this.step;
else if (!this.step && pageKey)
newValue = this.modelValue + 10;
else else
newValue = this.modelValue + 1; newValue = this.modelValue + 1;
} }