Bug #403 Textfield ha dejado de mostrar los errores

This commit is contained in:
gerard 2018-07-13 15:54:04 +02:00
parent 13e9b53a73
commit 2737bc0b0b
3 changed files with 8 additions and 2 deletions

View File

@ -49,7 +49,7 @@ vn-textfield {
label { label {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
padding: 4px; padding: 4px 0!important;
pointer-events: none; pointer-events: none;
color: $secondary-font-color; color: $secondary-font-color;
transition-duration: .2s; transition-duration: .2s;
@ -72,6 +72,7 @@ vn-textfield {
color: inherit; color: inherit;
padding: 4px; padding: 4px;
box-sizing: border-box; box-sizing: border-box;
border-bottom: 0!important;
&[type=number] { &[type=number] {
-moz-appearance: textfield; -moz-appearance: textfield;
@ -122,7 +123,6 @@ vn-textfield {
& > span.mdl-textfield__error { & > span.mdl-textfield__error {
visibility: visible; visibility: visible;
margin-top: 9px;
} }
& > label { & > label {
color: #d50000; color: #d50000;

View File

@ -4,6 +4,7 @@
<div class="leftIcons"></div> <div class="leftIcons"></div>
<div class="infix"> <div class="infix">
<input <input
class="mdl-textfield__input"
type="{{$ctrl.type}}" type="{{$ctrl.type}}"
name="{{$ctrl.name}}" name="{{$ctrl.name}}"
ng-model="$ctrl.value" ng-model="$ctrl.value"

View File

@ -44,6 +44,7 @@ export default class Textfield extends Input {
if (this.hasValue) this.element.classList.add('not-empty'); if (this.hasValue) this.element.classList.add('not-empty');
else this.element.classList.remove('not-empty'); else this.element.classList.remove('not-empty');
this.mdlUpdate();
} }
get value() { get value() {
return this._value; return this._value;
@ -57,6 +58,10 @@ export default class Textfield extends Input {
set vnTabIndex(value) { set vnTabIndex(value) {
this.input.tabindex = value; this.input.tabindex = value;
} }
mdlUpdate() {
let mdlElement = this.element.firstChild.MaterialTextfield;
if (mdlElement) mdlElement.updateClasses_();
}
clear() { clear() {
this.value = null; this.value = null;
this.input.focus(); this.input.focus();