pm-controls
Version:
ProModel Controls
58 lines (50 loc) • 1.52 kB
text/typescript
import { Component,
Input,
Output,
ElementRef,
EventEmitter,
HostBinding,
SimpleChanges,
ViewChild } from '@angular/core';
({
selector: 'pm-text-box',
//templateUrl: './app/controls/components/boxes/text-box/text-box.html',
templateUrl: './text-box.html',
})
export class TextBoxComponent {
() Text: string;
() Watermark: string;
() TextBoxClass: string = "text-box-input";
('style.width')
() Width: string;
('style.max-width')
() MaxWidth: string;
() IsDisabled: boolean;
() IsReadOnly: boolean;
() TextChange: EventEmitter<string> = new EventEmitter<string>();
() BlurChange: EventEmitter<any> = new EventEmitter<any>();
() FocusChange: EventEmitter<any> = new EventEmitter<any>();
() KeyUp: EventEmitter<any> = new EventEmitter<any>();
() KeyDown: EventEmitter<any> = new EventEmitter<any>();
('input') textBox: ElementRef;
constructor() { }
onChange(newValue) {
this.Text = newValue;
this.TextChange.emit(this.Text);
}
onBlur(value) {
this.BlurChange.emit(value);
}
onFocus(value) {
this.FocusChange.emit(value);
}
onKeyUp(event: any) {
this.KeyUp.emit(event);
}
onKeyDown(event: any) {
this.KeyDown.emit(event);
}
public Focus() {
this.textBox.nativeElement.focus();
}
}