Fix tslint and related errors.
This commit is contained in:
@@ -31,4 +31,4 @@ export class KeyboardButtonGroupComponent implements OnInit {
|
||||
|
||||
ngOnInit() { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import { Component, OnInit, Input } from 'angular2/core';
|
||||
:host {
|
||||
display: flex;
|
||||
}
|
||||
`],
|
||||
`]
|
||||
})
|
||||
export class KeyboardButtonComponent implements OnInit {
|
||||
@Input() id: string;
|
||||
@@ -27,4 +27,4 @@ export class KeyboardButtonComponent implements OnInit {
|
||||
|
||||
ngOnInit() { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,4 @@ export interface KeyboardButton {
|
||||
height: string;
|
||||
width: string;
|
||||
fill: string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,11 @@ import {Module, ModuleComponent} from './module';
|
||||
selector: 'keyboard',
|
||||
template:
|
||||
`
|
||||
<module *ngIf="modules.length > 0" [case]="modules[0].case" [keyboardButtons]="modules[0].keyboardButtons" [fill]="modules[0].fill"></module>
|
||||
<module *ngIf="modules.length > 0"
|
||||
[case]="modules[0].case"
|
||||
[keyboardButtons]="modules[0].keyboardButtons"
|
||||
[fill]="modules[0].fill">
|
||||
</module>
|
||||
`,
|
||||
styles:
|
||||
[`
|
||||
@@ -31,8 +35,8 @@ export class KeyboardComponent implements OnInit {
|
||||
}
|
||||
|
||||
private loadKeyboardModules(): void {
|
||||
var svg: any = this.dps.getBaseLayer();
|
||||
let svg: any = this.dps.getBaseLayer();
|
||||
this.modules = svg.g[0].g.map(obj => new Module(obj, svg.g[0].$.fill));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,27 +30,25 @@ export class ModuleComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.getButtonGroups().forEach(buttonGroup => {
|
||||
this.dcl.loadIntoLocation(KeyboardButtonGroupComponent, this.elementRef, "row").then((bttnComponentRef: ComponentRef) => {
|
||||
var group: KeyboardButtonGroupComponent = bttnComponentRef.instance;
|
||||
group.keyboardButtons = buttonGroup;
|
||||
// console.log(keyboardButtonComponent);
|
||||
});
|
||||
this.dcl.loadIntoLocation(KeyboardButtonGroupComponent, this.elementRef, 'row')
|
||||
.then((bttnComponentRef: ComponentRef) => {
|
||||
let group: KeyboardButtonGroupComponent = bttnComponentRef.instance;
|
||||
group.keyboardButtons = buttonGroup;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private getButtonGroups(): KeyboardButton[][] {
|
||||
var buttonGroups: KeyboardButton[][] = [];
|
||||
var buttonGroup: KeyboardButton[] = [];
|
||||
this.keyboardButtons.forEach((keyboardButton, index) => {
|
||||
let buttonGroups: KeyboardButton[][] = [];
|
||||
let buttonGroup: KeyboardButton[] = [];
|
||||
this.keyboardButtons.forEach(keyboardButton => {
|
||||
if (buttonGroup.length > 0 && buttonGroup[buttonGroup.length - 1].y !== keyboardButton.y) {
|
||||
buttonGroups.push(buttonGroup);
|
||||
buttonGroup = [];
|
||||
}
|
||||
buttonGroup.push(keyboardButton);
|
||||
});
|
||||
//console.log(buttonGroups, buttonGroup, this.keyboardButtons);
|
||||
return buttonGroups;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ export class Module {
|
||||
private keyboardButtons: KeyboardButton[];
|
||||
|
||||
constructor(obj: { rect: any[], path: any[] }, fill?: string) {
|
||||
this.keyboardButtons = obj.rect.map(obj => obj.$);
|
||||
this.keyboardButtons = obj.rect.map(rect => rect.$);
|
||||
this.keyboardButtons.forEach(keyboardButton => keyboardButton.fill = fill ? fill : 'black');
|
||||
this.case = obj.path[0].$;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import {Module} from './module.model';
|
||||
import {ModuleComponent} from './module.component';
|
||||
export {Module, ModuleComponent};
|
||||
export {Module, ModuleComponent};
|
||||
|
||||
Reference in New Issue
Block a user