fix(inputs): disabled handling (#16071)

This commit is contained in:
Manu MA
2018-10-25 22:50:06 +02:00
committed by GitHub
parent 4d3ad67740
commit ef6895acbd
36 changed files with 320 additions and 231 deletions

View File

@ -1,7 +1,7 @@
import { Component, ComponentInterface, Element, Event, EventEmitter, Method, Prop, State, Watch } from '@stencil/core';
import { Color, Mode, StyleEvent, TextFieldTypes, TextInputChangeEvent } from '../../interface';
import { debounceEvent, deferEvent, renderHiddenInput } from '../../utils/helpers';
import { debounceEvent, renderHiddenInput } from '../../utils/helpers';
import { createColorClasses, hostContext } from '../../utils/theme';
@Component({
@ -173,7 +173,7 @@ export class Input implements ComponentInterface {
/**
* The value of the input.
*/
@Prop({ mutable: true }) value = '';
@Prop({ mutable: true }) value?: string | null = '';
/**
* Update the native input element when the value changes
@ -229,12 +229,11 @@ export class Input implements ComponentInterface {
if (this.clearOnEdit === undefined && this.type === 'password') {
this.clearOnEdit = true;
}
this.emitStyle();
}
componentDidLoad() {
this.ionStyle = deferEvent(this.ionStyle);
this.debounceChanged();
this.emitStyle();
this.ionInputDidLoad.emit();
}
@ -333,7 +332,8 @@ export class Input implements ComponentInterface {
}
render() {
renderHiddenInput(this.el, this.name, this.getValue(), this.disabled);
const value = this.getValue();
renderHiddenInput(this.el, this.name, value, this.disabled);
return [
<input
@ -362,7 +362,7 @@ export class Input implements ComponentInterface {
step={this.step}
size={this.size}
type={this.type}
value={this.getValue()}
value={value}
onInput={this.onInput}
onBlur={this.onBlur}
onFocus={this.onFocus}