feat(input): clearOnEdit feature. Closes #9187

This commit is contained in:
Max Lynch
2016-11-16 16:42:48 -06:00
parent 91f5087bc6
commit 9469b4ff9a
6 changed files with 143 additions and 0 deletions

View File

@ -160,6 +160,18 @@ export class TextInput extends InputBase {
this._setMode(val);
}
/**
* @input {boolean} whether to clear the input upon editing or not
*/
@Input()
get clearOnEdit() {
return this._clearOnEdit;
}
set clearOnEdit(val: any) {
super.setClearOnEdit(val);
}
/**
* @private
*/
@ -207,6 +219,11 @@ export class TextInput extends InputBase {
this._item.setElementClass('item-input', true);
this._item.registerInput(this._type);
}
// By default, password inputs clear after focus when they have content
if(this.type === 'password' && this.clearOnEdit !== false) {
this.clearOnEdit = true;
}
}
/**