mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 21:48:42 +08:00
feat(input): add max, min, step as inputs and pass to native
closes #10189
This commit is contained in:

committed by
Adam Bradley

parent
4ca9f2c04d
commit
803782a95d
@ -99,6 +99,9 @@ export class TextInput extends Ion implements IonicFormInput {
|
||||
_readonly: boolean = false;
|
||||
_isTouch: boolean;
|
||||
_keyboardHeight: number;
|
||||
_min: any;
|
||||
_max: any;
|
||||
_step: any;
|
||||
_native: NativeInput;
|
||||
_nav: NavControllerBase;
|
||||
_scrollStart: any;
|
||||
@ -257,6 +260,60 @@ export class TextInput extends Ion implements IonicFormInput {
|
||||
this._clearOnEdit = isTrueProperty(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* @input {any} The minimum value, which must not be greater than its maximum (max attribute) value.
|
||||
*/
|
||||
@Input()
|
||||
get min() {
|
||||
return this._min;
|
||||
}
|
||||
set min(val: any) {
|
||||
this.setMin(this._min = val);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
setMin(val: any) {
|
||||
this._native && this._native.setMin(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* @input {any} The maximum value, which must not be less than its minimum (min attribute) value.
|
||||
*/
|
||||
@Input()
|
||||
get max() {
|
||||
return this._max;
|
||||
}
|
||||
set max(val: any) {
|
||||
this.setMax(this._max = val);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
setMax(val: any) {
|
||||
this._native && this._native.setMax(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* @input {any} Works with the min and max attributes to limit the increments at which a value can be set.
|
||||
*/
|
||||
@Input()
|
||||
get step() {
|
||||
return this._step;
|
||||
}
|
||||
set step(val: any) {
|
||||
this.setStep(this._step = val);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
setStep(val: any) {
|
||||
this._native && this._native.setStep(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@ -305,6 +362,9 @@ export class TextInput extends Ion implements IonicFormInput {
|
||||
setNativeInput(nativeInput: NativeInput) {
|
||||
this._native = nativeInput;
|
||||
nativeInput.setValue(this._value);
|
||||
nativeInput.setMin(this._min);
|
||||
nativeInput.setMax(this._max);
|
||||
nativeInput.setStep(this._step);
|
||||
nativeInput.isDisabled(this.disabled);
|
||||
|
||||
if (this._item && this._item.labelId !== null) {
|
||||
|
Reference in New Issue
Block a user