Fix tslint and related errors.
This commit is contained in:
@@ -25,7 +25,7 @@ let keyActionType = {
|
|||||||
abstract class KeyAction extends Serializable<KeyAction> {
|
abstract class KeyAction extends Serializable<KeyAction> {
|
||||||
assertKeyActionType(jsObject: any) {
|
assertKeyActionType(jsObject: any) {
|
||||||
let keyActionClassname = this.constructor.name;
|
let keyActionClassname = this.constructor.name;
|
||||||
let keyActionTypeString = keyActionType[keyActionClassname]
|
let keyActionTypeString = keyActionType[keyActionClassname];
|
||||||
if (jsObject.keyActionType !== keyActionTypeString) {
|
if (jsObject.keyActionType !== keyActionTypeString) {
|
||||||
throw `Invalid ${keyActionClassname}.keyActionType: ${jsObject.keyActionType}`;
|
throw `Invalid ${keyActionClassname}.keyActionType: ${jsObject.keyActionType}`;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "typings install",
|
"postinstall": "typings install",
|
||||||
"lint": "tslint **/*.ts",
|
"lint": "tslint 'src/**/*.ts' 'config-serializer/**/*.ts'",
|
||||||
"typings": "typings",
|
"typings": "typings",
|
||||||
"webpack": "webpack",
|
"webpack": "webpack",
|
||||||
"webpack-dev-server": "webpack-dev-server"
|
"webpack-dev-server": "webpack-dev-server"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { Component, OnInit, Input } from 'angular2/core';
|
|||||||
:host {
|
:host {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
`],
|
`]
|
||||||
})
|
})
|
||||||
export class KeyboardButtonComponent implements OnInit {
|
export class KeyboardButtonComponent implements OnInit {
|
||||||
@Input() id: string;
|
@Input() id: string;
|
||||||
|
|||||||
@@ -7,7 +7,11 @@ import {Module, ModuleComponent} from './module';
|
|||||||
selector: 'keyboard',
|
selector: 'keyboard',
|
||||||
template:
|
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:
|
styles:
|
||||||
[`
|
[`
|
||||||
@@ -31,7 +35,7 @@ export class KeyboardComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private loadKeyboardModules(): void {
|
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));
|
this.modules = svg.g[0].g.map(obj => new Module(obj, svg.g[0].$.fill));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,26 +30,24 @@ export class ModuleComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.getButtonGroups().forEach(buttonGroup => {
|
this.getButtonGroups().forEach(buttonGroup => {
|
||||||
this.dcl.loadIntoLocation(KeyboardButtonGroupComponent, this.elementRef, "row").then((bttnComponentRef: ComponentRef) => {
|
this.dcl.loadIntoLocation(KeyboardButtonGroupComponent, this.elementRef, 'row')
|
||||||
var group: KeyboardButtonGroupComponent = bttnComponentRef.instance;
|
.then((bttnComponentRef: ComponentRef) => {
|
||||||
group.keyboardButtons = buttonGroup;
|
let group: KeyboardButtonGroupComponent = bttnComponentRef.instance;
|
||||||
// console.log(keyboardButtonComponent);
|
group.keyboardButtons = buttonGroup;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private getButtonGroups(): KeyboardButton[][] {
|
private getButtonGroups(): KeyboardButton[][] {
|
||||||
var buttonGroups: KeyboardButton[][] = [];
|
let buttonGroups: KeyboardButton[][] = [];
|
||||||
var buttonGroup: KeyboardButton[] = [];
|
let buttonGroup: KeyboardButton[] = [];
|
||||||
this.keyboardButtons.forEach((keyboardButton, index) => {
|
this.keyboardButtons.forEach(keyboardButton => {
|
||||||
if (buttonGroup.length > 0 && buttonGroup[buttonGroup.length - 1].y !== keyboardButton.y) {
|
if (buttonGroup.length > 0 && buttonGroup[buttonGroup.length - 1].y !== keyboardButton.y) {
|
||||||
buttonGroups.push(buttonGroup);
|
buttonGroups.push(buttonGroup);
|
||||||
buttonGroup = [];
|
buttonGroup = [];
|
||||||
}
|
}
|
||||||
buttonGroup.push(keyboardButton);
|
buttonGroup.push(keyboardButton);
|
||||||
});
|
});
|
||||||
//console.log(buttonGroups, buttonGroup, this.keyboardButtons);
|
|
||||||
return buttonGroups;
|
return buttonGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export class Module {
|
|||||||
private keyboardButtons: KeyboardButton[];
|
private keyboardButtons: KeyboardButton[];
|
||||||
|
|
||||||
constructor(obj: { rect: any[], path: any[] }, fill?: string) {
|
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.keyboardButtons.forEach(keyboardButton => keyboardButton.fill = fill ? fill : 'black');
|
||||||
this.case = obj.path[0].$;
|
this.case = obj.path[0].$;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ export class DataProviderService {
|
|||||||
|
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
|
|
||||||
getBaseLayer(): any {
|
getBaseLayer(): any {
|
||||||
return require('xml!../../images/base-layer.svg').svg;
|
return require('xml!../../images/base-layer.svg').svg;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user