Skip to content
Snippets Groups Projects
Commit ce0c897c authored by Abdelmoez GUETAT's avatar Abdelmoez GUETAT Committed by Makhtar DIAGNE
Browse files

VitamUIInput : fix autofocus, remove AfterViewInit function & upgrade ui-frontend-common to 0.0.13

parent b8bf63bd
No related branches found
No related tags found
1 merge request!1Feature/design/1
......@@ -4,13 +4,10 @@
<span *ngIf="required" class="required-marker">*</span>
</label>
<input *ngIf="type !== 'number'" [type]="type" [required]="required" [disabled]="disabled" [autofocus]="autofocus"
<input #vitamUIInput [type]="type" [required]="required" [disabled]="disabled" [autofocus]="autofocus"
[attr.maxlength]="maxlength" (blur)="onBlur()" (focus)="onFocus()" [(ngModel)]="value"
(ngModelChange)="onTextChange($event)" #input>
(ngModelChange)="onValueChange($event)">
<input *ngIf="type === 'number'" type="number" [required]="required" [disabled]="disabled" [autofocus]="autofocus"
[attr.maxlength]="maxlength" (blur)="onBlur()" (focus)="onFocus()" [(ngModel)]="value"
(ngModelChange)="onNumberChange($event)" #input>
<mat-spinner diameter="25" color="accent"></mat-spinner>
</div>
......
......@@ -69,7 +69,7 @@ export class VitamUIInputComponent implements ControlValueAccessor, OnInit {
set disabled(value: boolean) { this._disabled = coerceBooleanProperty(value); }
// tslint:disable-next-line:variable-name
private _disabled = false;
@ViewChild('input', { static: false }) private input: ElementRef;
@ViewChild('vitamUIInput', { static: false }) private input: ElementRef;
@HostBinding('class.vitamui-focused') focused = false;
@HostBinding('class.vitamui-float') labelFloat = false;
......@@ -111,6 +111,14 @@ export class VitamUIInputComponent implements ControlValueAccessor, OnInit {
this.onChange(value);
}
onValueChange(value: string) {
if(this.type === 'number') {
this.onNumberChange(Number(value));
}else {
this.onTextChange(value);
}
}
onFocus() {
this.focused = true;
this.onTouched();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment