import { Component, EventEmitter, Input, Output, OnInit, OnDestroy } from '@angular/core'
import { Options, Mixins } from 'lib/keyboard'
import { ENTER } from 'lib/keys.js'
const template = `
`
class Parent {}
Parent.prototype = Mixins
@Component({
selector: 'numeric-keyboard',
template: template,
styleUrls: [ './keyboard.component.styl' ]
})
export class NumericKeyboard extends Parent implements OnInit, OnDestroy {
@Input() layout: string | { key: number | string }[][] = Options.layout
@Input() entertext: string = Options.entertext
@Output() press = new EventEmitter()
@Output() enterpress = new EventEmitter()
public kp: any
public ks: any
ngOnInit() {
Mixins.init.call(this, {
layout: this.layout,
entertext: this.entertext
})
}
ngOnDestroy() {
Mixins.destroy.call(this)
}
dispatch(event: string, payload?: number | string) {
switch (event) {
case 'press':
this.press.emit(payload)
break
case 'enterpress':
this.enterpress.emit()
break
}
}
}