Commit a3236900 authored by Dmitriy Schekhovtsov's avatar Dmitriy Schekhovtsov
Browse files

fix(build): fixed tslint issues

parent 7bfbdd43
Showing with 108 additions and 92 deletions
+108 -92
......@@ -15,7 +15,7 @@
"main": "main.ts",
"test": "../../scripts/test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"prefix": "",
"mobile": false,
"styles": [
],
......
......@@ -105,10 +105,10 @@ export class DataProvider {
'Grouped results modal text': {element: (): ElementFinder => $('.card:nth-child(14)'), actualResult: 'Model: ""'}
};
public static typeaheadInputCityTexts:any = {
'California': { inputText: 'Cal', expectedResult: 'California'},
'Texas': { inputText: 'xa', expectedResult: 'Texas'},
'Florida': { inputText: 'rida', expectedResult: 'Florida'},
'Mississippi': { inputText: 'ssi', expectedResult: 'Mississippi'},
California: { inputText: 'Cal', expectedResult: 'California'},
Texas: { inputText: 'xa', expectedResult: 'Texas'},
Florida: { inputText: 'rida', expectedResult: 'Florida'},
Mississippi: { inputText: 'ssi', expectedResult: 'Mississippi'},
'New Jersey': { inputText: 'J', expectedResult: 'New Jersey'}
};
}
......@@ -2,7 +2,6 @@ import { $, browser } from 'protractor';
import { leftPanelTests } from './leftPanelTests.po';
import { DataProvider } from '../data-provider/data-provider.po';
const buttonLargeModal = $('.btn:nth-child(1)');
const buttonSmallModal = $('.btn:nth-child(3)');
const buttonChildModal = $('.btn:nth-child(5)');
......
......@@ -2,7 +2,6 @@ import { $, browser } from 'protractor';
import { leftPanelTests } from './leftPanelTests.po';
import { DataProvider } from '../data-provider/data-provider.po';
let using = require('jasmine-data-provider');
const inputStatic = $('.container-fluid>input:nth-of-type(1)');
......
......@@ -16,7 +16,9 @@ if (w && w.__theme === 'bs4') {
export class AppComponent implements AfterContentInit {
public isBs3:boolean = Ng2BootstrapConfig.theme === Ng2BootstrapTheme.BS3;
public constructor(private router:Router, componentsHelper:ComponentsHelper, vcr:ViewContainerRef) {
private router:Router;
public constructor(router:Router, componentsHelper:ComponentsHelper, vcr:ViewContainerRef) {
this.router = router;
componentsHelper.setRootViewContainerRef(vcr);
}
......
......@@ -14,7 +14,9 @@ export class MainMenuComponent {
public search:any = {};
public hash:string = '';
public constructor(private router:Router) {
private router: Router;
public constructor(router:Router) {
this.router = router;
this.routes = this.routes.filter((v:any) => v.path !== '**');
this.router.events.subscribe((event:any) => {
if (event instanceof NavigationEnd) {
......
......@@ -12,7 +12,9 @@ export class TopMenuComponent implements AfterViewInit {
private renderer:Renderer;
private document:any;
public constructor(renderer:Renderer, @Inject(DOCUMENT) document:any, private router:Router) {
private router:Router;
public constructor(renderer:Renderer, @Inject(DOCUMENT) document:any, router:Router) {
this.router = router;
this.renderer = renderer;
this.document = document;
}
......
......@@ -6,19 +6,20 @@ import * as moment from 'moment';
templateUrl: './datepicker-demo.component.html'
})
export class DatepickerDemoComponent {
public dt:Date = new Date();
public minDate:Date = void 0;
public events:any[];
public tomorrow:Date;
public afterTomorrow:Date;
public dt: Date = new Date();
public minDate: Date = void 0;
public events: any[];
public tomorrow: Date;
public afterTomorrow: Date;
public dateDisabled: {date: Date, mode: string}[];
public formats:string[] = ['DD-MM-YYYY', 'YYYY/MM/DD', 'DD.MM.YYYY', 'shortDate'];
public format:string = this.formats[0];
public dateOptions:any = {
public formats: string[] = ['DD-MM-YYYY', 'YYYY/MM/DD', 'DD.MM.YYYY',
'shortDate'];
public format: string = this.formats[0];
public dateOptions: any = {
formatYear: 'YY',
startingDay: 1
};
private opened:boolean = false;
private opened: boolean = false;
public constructor() {
(this.tomorrow = new Date()).setDate(this.tomorrow.getDate() + 1);
......@@ -31,16 +32,17 @@ export class DatepickerDemoComponent {
];
}
public getDate():number {
public getDate(): number {
return this.dt && this.dt.getTime() || new Date().getTime();
}
public today():void {
public today(): void {
this.dt = new Date();
}
public d20090824():void {
this.dt = moment('2009-08-24', 'YYYY-MM-DD').toDate();
public d20090824(): void {
this.dt = moment('2009-08-24', 'YYYY-MM-DD')
.toDate();
}
public disableTomorrow(): void {
......@@ -48,15 +50,15 @@ export class DatepickerDemoComponent {
}
// todo: implement custom class cases
public getDayClass(date:any, mode:string):string {
public getDayClass(date: any, mode: string): string {
if (mode === 'day') {
let dayToCheck = new Date(date).setHours(0, 0, 0, 0);
for (let i = 0; i < this.events.length; i++) {
let currentDay = new Date(this.events[i].date).setHours(0, 0, 0, 0);
for (let event of this.events) {
let currentDay = new Date(event.date).setHours(0, 0, 0, 0);
if (dayToCheck === currentDay) {
return this.events[i].status;
return event.status;
}
}
}
......@@ -64,20 +66,20 @@ export class DatepickerDemoComponent {
return '';
}
public disabled(date:Date, mode:string):boolean {
public disabled(date: Date, mode: string): boolean {
return ( mode === 'day' && ( date.getDay() === 0 || date.getDay() === 6 ) );
}
public open():void {
public open(): void {
this.opened = !this.opened;
}
public clear():void {
public clear(): void {
this.dt = void 0;
this.dateDisabled = undefined;
}
public toggleMin():void {
public toggleMin(): void {
this.dt = new Date(this.minDate.valueOf());
}
}
......@@ -14,10 +14,10 @@ export class PaginationDemoComponent {
public setPage(pageNo:number):void {
this.currentPage = pageNo;
};
}
public pageChanged(event:any):void {
console.log('Page changed to: ' + event.page);
console.log('Number items per page: ' + event.itemsPerPage);
};
}
}
......@@ -44,7 +44,7 @@ export class ProgressbarDemoComponent {
this.showWarning = (type === 'danger' || type === 'warning');
this.dynamic = value;
this.type = type;
};
}
public randomStacked(): void {
let types = ['success', 'info', 'warning', 'danger'];
......@@ -62,5 +62,5 @@ export class ProgressbarDemoComponent {
type: types[index]
});
}
};
}
}
......@@ -17,13 +17,13 @@ export class TabsDemoComponent {
setTimeout(function ():void {
alert('You\'ve selected the alert tab!');
});
};
}
public setActiveTab(index:number):void {
this.tabs[index].active = true;
};
}
public removeTabHandler(/*tab:any*/):void {
console.log('Remove Tab handler');
};
}
}
......@@ -18,20 +18,20 @@ export class TimepickerDemoComponent {
public toggleMode():void {
this.ismeridian = !this.ismeridian;
};
}
public update():void {
let d = new Date();
d.setHours(14);
d.setMinutes(0);
this.mytime = d;
};
}
public changed():void {
console.log('Time changed to: ' + this.mytime);
};
}
public clear():void {
this.mytime = void 0;
};
}
}
......@@ -13,7 +13,7 @@
<link href="https://fonts.googleapis.com/css?family=Roboto:400,300,700" rel="stylesheet" type="text/css">
<!--link to bootstrap.css v4.0.0-alpha-->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" rel="stylesheet">
<!--<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">-->
<link rel="stylesheet" href="assets/css/glyphicons.css">
<link rel="stylesheet" href="assets/css/style.css">
......
......@@ -16,7 +16,7 @@
<!--<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">-->
<!--link to bootstrap.css-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/style.css">
<link rel="stylesheet" href="assets/css/prettify-angulario.css">
</head>
......
......@@ -17,7 +17,7 @@
"build": "ngm build -p src",
"start": "ng serve --aot",
"generate-bs4": "node scripts/generate-bs4.js",
"pretest": "run-s build link",
"pretest": "run-s link build link",
"test": "ng test -sr",
"test-coverage": "ng test -sr -cc",
"pree2e": "webdriver-manager update",
......
......@@ -7,8 +7,8 @@ const files = {
const toReplace = [
{
from: '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">',
to: '<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" rel="stylesheet">'
from: '<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">',
to: '<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" rel="stylesheet">'
}, {
from: '<script src="assets/js/prettify.min.js"></script>',
to: '<script src="assets/js/prettify.min.js"></script>\r\n <!-- Enable bootstrap 4 theme -->\r\n <script>window.__theme = \'bs4\';</script>'
......
......@@ -11,7 +11,6 @@ const ALERT_TEMPLATE = `
</div>
`;
// TODO: templateUrl
@Component({
selector: 'alert',
template: ALERT_TEMPLATE
......@@ -26,7 +25,9 @@ export class AlertComponent implements OnInit {
public closed: boolean;
protected classes:string[] = [];
public constructor(public config: AlertConfig) {
public config: AlertConfig;
public constructor(config: AlertConfig) {
this.config = config;
this.configureOptions();
}
......
......@@ -8,6 +8,7 @@ import { ControlValueAccessor, NgModel } from '@angular/forms';
@Directive({selector: '[btnCheckbox][ngModel]'})
export class ButtonCheckboxDirective implements ControlValueAccessor, OnInit {
public cd:NgModel;
public el: ElementRef;
@Input() public btnCheckboxTrue:any;
@Input() public btnCheckboxFalse:any;
......@@ -29,7 +30,8 @@ export class ButtonCheckboxDirective implements ControlValueAccessor, OnInit {
this.cd.viewToModelUpdate(this.value);
}
public constructor(@Self() cd:NgModel, protected el: ElementRef) {
public constructor(@Self() cd:NgModel, el: ElementRef) {
this.el = el;
this.cd = cd;
// hack !
cd.valueAccessor = this;
......
......@@ -21,6 +21,8 @@ export class ButtonRadioDirective implements ControlValueAccessor, OnInit {
@Input() public uncheckable:boolean;
@Input() public value:any;
protected el: ElementRef;
@HostBinding('class.active')
public get isActive(): boolean {
return this.btnRadio === this.value;
......@@ -42,7 +44,8 @@ export class ButtonRadioDirective implements ControlValueAccessor, OnInit {
this.onChange(this.value);
}
public constructor( protected el: ElementRef) {
public constructor(el: ElementRef) {
this.el = el;
}
public ngOnInit(): void {
......
import { Component, EventEmitter, Input, Output, Self, ViewChild } from '@angular/core';
import {
Component, EventEmitter, Input, Output, Self, ViewChild
} from '@angular/core';
import { DatePickerInnerComponent } from './datepicker-inner.component';
import { ControlValueAccessor, NgModel } from '@angular/forms';
import { DatepickerConfig } from './datepicker.config';
......@@ -40,45 +42,51 @@ import { DatepickerConfig } from './datepicker.config';
})
/* tslint:enable:component-selector-name component-selector-type */
export class DatePickerComponent implements ControlValueAccessor {
@Input() public datepickerMode:string;
@Input() public initDate:Date;
@Input() public minDate:Date;
@Input() public maxDate:Date;
@Input() public minMode:string;
@Input() public maxMode:string;
@Input() public showWeeks:boolean;
@Input() public formatDay:string;
@Input() public formatMonth:string;
@Input() public formatYear:string;
@Input() public formatDayHeader:string;
@Input() public formatDayTitle:string;
@Input() public formatMonthTitle:string;
@Input() public startingDay:number;
@Input() public yearRange:number;
@Input() public onlyCurrentMonth:boolean;
@Input() public shortcutPropagation:boolean;
@Input() public customClass:{date:Date, mode:string, clazz:string}[];
@Input() public datepickerMode: string;
@Input() public initDate: Date;
@Input() public minDate: Date;
@Input() public maxDate: Date;
@Input() public minMode: string;
@Input() public maxMode: string;
@Input() public showWeeks: boolean;
@Input() public formatDay: string;
@Input() public formatMonth: string;
@Input() public formatYear: string;
@Input() public formatDayHeader: string;
@Input() public formatDayTitle: string;
@Input() public formatMonthTitle: string;
@Input() public startingDay: number;
@Input() public yearRange: number;
@Input() public onlyCurrentMonth: boolean;
@Input() public shortcutPropagation: boolean;
@Input() public customClass: {date: Date, mode: string, clazz: string}[];
@Input() public monthColLimit: number;
@Input() public yearColLimit: number;
@Input() public dateDisabled:{date:Date, mode:string}[];
@Input() public dateDisabled: {date: Date, mode: string}[];
@Output() public selectionDone:EventEmitter<Date> = new EventEmitter<Date>(undefined);
@Input()
public get activeDate(): Date {
return this._activeDate || this._now;
}
@ViewChild(DatePickerInnerComponent) public _datePicker: DatePickerInnerComponent;
public set activeDate(value: Date) {
this._activeDate = value;
}
@Output() public selectionDone: EventEmitter<Date> = new EventEmitter<Date>(undefined);
public onChange:any = Function.prototype;
public onTouched:any = Function.prototype;
@ViewChild(DatePickerInnerComponent) public _datePicker: DatePickerInnerComponent;
public cd:NgModel;
protected _now:Date = new Date();
protected _activeDate:Date;
public onChange: any = Function.prototype;
public onTouched: any = Function.prototype;
@Input()
public get activeDate():Date {
return this._activeDate || this._now;
}
public cd: NgModel;
protected _now: Date = new Date();
protected _activeDate: Date;
protected config: DatepickerConfig;
public constructor(@Self() cd:NgModel, protected config: DatepickerConfig) {
public constructor(@Self() cd: NgModel, config: DatepickerConfig) {
this.config = config;
this.cd = cd;
// hack
cd.valueAccessor = this;
......@@ -89,20 +97,16 @@ export class DatePickerComponent implements ControlValueAccessor {
Object.assign(this, this.config);
}
public set activeDate(value:Date) {
this._activeDate = value;
}
public onUpdate(event:any):void {
public onUpdate(event: any): void {
this.cd.viewToModelUpdate(event);
}
public onSelectionDone(event:Date):void {
public onSelectionDone(event: Date): void {
this.selectionDone.emit(event);
}
// todo: support null value
public writeValue(value:any):void {
public writeValue(value: any): void {
if (this._datePicker.compare(value, this._activeDate) === 0) {
return;
}
......@@ -115,11 +119,11 @@ export class DatePickerComponent implements ControlValueAccessor {
this.activeDate = value ? new Date(value) : void 0;
}
public registerOnChange(fn:(_:any) => {}):void {
public registerOnChange(fn: (_: any) => {}): void {
this.onChange = fn;
}
public registerOnTouched(fn:() => {}):void {
public registerOnTouched(fn: () => {}): void {
this.onTouched = fn;
}
}
Markdown is supported
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