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}

View File

@@ -39,7 +39,7 @@ It is meant for text `type` inputs only, such as `"text"`, `"password"`, `"email
| `spellcheck` | `spellcheck` | If `true`, the element will have its spelling and grammar checked. Defaults to `false`. | `boolean` |
| `step` | `step` | Works with the min and max attributes to limit the increments at which a value can be set. Possible values are: `"any"` or a positive floating point number. | `string \| undefined` |
| `type` | `type` | The type of control to display. The default type is text. Possible values are: `"text"`, `"password"`, `"email"`, `"number"`, `"search"`, `"tel"`, or `"url"`. | `"date" \| "email" \| "number" \| "password" \| "search" \| "tel" \| "text" \| "url"` |
| `value` | `value` | The value of the input. | `string` |
| `value` | `value` | The value of the input. | `null \| string \| undefined` |
## Events