fix(range): value changes when using keyboard

fixes #15065
This commit is contained in:
Manu Mtz.-Almeida
2018-08-07 02:33:21 +02:00
parent f49fa4a815
commit 27fdc9a893
3 changed files with 9 additions and 6 deletions

View File

@ -41,6 +41,7 @@ import {
PickerOptions,
PopoverOptions,
RangeInputChangeEvent,
RangeValue,
RouteID,
RouterDirection,
RouterEventDetail,
@ -1798,7 +1799,7 @@ declare global {
/**
* the value of the range.
*/
'value': any;
'value': RangeValue;
}
interface IonRefresherContent {
@ -5356,7 +5357,7 @@ declare global {
/**
* the value of the range.
*/
'value'?: any;
'value'?: RangeValue;
}
export interface IonRefresherContentAttributes extends HTMLAttributes {

View File

@ -12,6 +12,8 @@
flex: 1;
align-items: center;
user-select: none;
}
::slotted(ion-label) {

View File

@ -1,10 +1,10 @@
import { Component, Element, Event, EventEmitter, Listen, Prop, QueueApi, State, Watch } from '@stencil/core';
import { BaseInput, Color, Gesture, GestureDetail, Mode, RangeInputChangeEvent, StyleEvent } from '../../interface';
import { BaseInput, Color, Gesture, GestureDetail, Mode, RangeInputChangeEvent, RangeValue, StyleEvent } from '../../interface';
import { clamp, debounceEvent, deferEvent } from '../../utils/helpers';
import { createColorClasses, hostContext } from '../../utils/theme';
import { Knob, RangeEventDetail, RangeValue } from './range-interface';
import { Knob, RangeEventDetail } from './range-interface';
@Component({
tag: 'ion-range',
@ -106,8 +106,7 @@ export class Range implements BaseInput {
/**
* the value of the range.
*/
@Prop({ mutable: true })
value: any = 0;
@Prop({ mutable: true }) value: RangeValue = 0;
@Watch('value')
protected valueChanged(value: RangeValue) {
if (!this.noUpdate) {
@ -172,6 +171,7 @@ export class Range implements BaseInput {
} else {
this.ratioB += step;
}
this.updateValue();
}
private getValue(): RangeValue {