From 27fdc9a8939b1605c58f710e63d6a2cebd58e50e Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Tue, 7 Aug 2018 02:33:21 +0200 Subject: [PATCH] fix(range): value changes when using keyboard fixes #15065 --- core/src/components.d.ts | 5 +++-- core/src/components/range/range.scss | 2 ++ core/src/components/range/range.tsx | 8 ++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/core/src/components.d.ts b/core/src/components.d.ts index da5ed3d3d4..dff7b1edc3 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -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 { diff --git a/core/src/components/range/range.scss b/core/src/components/range/range.scss index 8f3e99ee54..be02520e48 100644 --- a/core/src/components/range/range.scss +++ b/core/src/components/range/range.scss @@ -12,6 +12,8 @@ flex: 1; align-items: center; + + user-select: none; } ::slotted(ion-label) { diff --git a/core/src/components/range/range.tsx b/core/src/components/range/range.tsx index 1280a25126..fc983e5089 100644 --- a/core/src/components/range/range.tsx +++ b/core/src/components/range/range.tsx @@ -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 {