Skip to content

Commit

Permalink
chore(build): code updated to correspond latest codelyzer rules
Browse files Browse the repository at this point in the history
  • Loading branch information
valorkin committed Apr 27, 2016
1 parent 2392510 commit da131ea
Show file tree
Hide file tree
Showing 96 changed files with 337 additions and 322 deletions.
10 changes: 5 additions & 5 deletions components/accordion.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Accordion} from './accordion/accordion.component';
import {AccordionPanel} from './accordion/accordion-group.component';
import {AccordionComponent} from './accordion/accordion.component';
import {AccordionPanelComponent} from './accordion/accordion-group.component';

export {Accordion} from './accordion/accordion.component';
export {AccordionPanel} from './accordion/accordion-group.component';
export const ACCORDION_DIRECTIVES:Array<any> = [Accordion, AccordionPanel];
export {AccordionComponent} from './accordion/accordion.component';
export {AccordionPanelComponent} from './accordion/accordion-group.component';
export const ACCORDION_DIRECTIVES:Array<any> = [AccordionComponent, AccordionPanelComponent];
12 changes: 6 additions & 6 deletions components/accordion/accordion-group.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import {
Component, OnInit, OnDestroy, Input, HostBinding, Inject
} from 'angular2/core';
import {NgClass} from 'angular2/common';
import {Collapse} from '../collapse';
import {Accordion} from './accordion.component';
import {CollapseDirective} from '../collapse';
import {AccordionComponent} from './accordion.component';

/* tslint:disable:component-selector-name */
@Component({
selector: 'accordion-group, accordion-panel',
directives: [Collapse, NgClass],
directives: [CollapseDirective, NgClass],
template: `
<div class="panel" [ngClass]="panelClass">
<div class="panel-heading" (click)="toggleOpen($event)">
Expand All @@ -27,7 +27,7 @@ import {Accordion} from './accordion.component';
</div>
`
})
export class AccordionPanel implements OnInit, OnDestroy {
export class AccordionPanelComponent implements OnInit, OnDestroy {
@Input() public heading:string;
@Input() public panelClass:string;
@Input() public isDisabled:boolean;
Expand All @@ -46,9 +46,9 @@ export class AccordionPanel implements OnInit, OnDestroy {
}

private _isOpen:boolean;
private accordion:Accordion;
private accordion:AccordionComponent;

public constructor(@Inject(Accordion) accordion:Accordion) {
public constructor(@Inject(AccordionComponent) accordion:AccordionComponent) {
this.accordion = accordion;
}

Expand Down
14 changes: 7 additions & 7 deletions components/accordion/accordion.component.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
import {Component, Input, HostBinding} from 'angular2/core';
import {AccordionPanel} from './accordion-group.component';
import {AccordionPanelComponent} from './accordion-group.component';

// todo: support template url
@Component({
selector: 'accordion',
template: `<ng-content></ng-content>`
})
export class Accordion {
export class AccordionComponent {
@Input() public closeOthers:boolean;

/* tslint:disable:no-unused-variable */
@HostBinding('class.panel-group')
private addClass:boolean = true;
/* tslint:enable:no-unused-variable */

private groups:Array<AccordionPanel> = [];
private groups:Array<AccordionPanelComponent> = [];

public closeOtherPanels(openGroup:AccordionPanel):void {
public closeOtherPanels(openGroup:AccordionPanelComponent):void {
if (!this.closeOthers) {
return;
}

this.groups.forEach((group:AccordionPanel) => {
this.groups.forEach((group:AccordionPanelComponent) => {
if (group !== openGroup) {
group.isOpen = false;
}
});
}

public addGroup(group:AccordionPanel):void {
public addGroup(group:AccordionPanelComponent):void {
this.groups.push(group);
}

public removeGroup(group:AccordionPanel):void {
public removeGroup(group:AccordionPanelComponent):void {
let index = this.groups.indexOf(group);
if (index !== -1) {
this.groups.splice(index, 1);
Expand Down
4 changes: 2 additions & 2 deletions components/accordion/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ACCORDION_DIRECTIVES } from 'ng2-bootstrap/components/accordion';
selector: 'accordion',
template: `<ng-content></ng-content>`
})
export class Accordion {
export class AccordionComponent {
@Input() public closeOthers:boolean;

@HostBinding('class.panel-group')
Expand All @@ -24,7 +24,7 @@ export class Accordion {
selector: 'accordion-group',
directives: [Collapse, NgClass]
})
export class AccordionGroup implements OnInit, OnDestroy {
export class AccordionGroupComponent implements OnInit, OnDestroy {
@Input() public heading:string;
@Input() public panelClass:string;
@Input() public isDisabled:boolean;
Expand Down
2 changes: 1 addition & 1 deletion components/alert.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {Alert} from './alert/alert.component';
export {AlertComponent} from './alert/alert.component';
6 changes: 3 additions & 3 deletions components/alert/alert.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {it, inject, beforeEachProviders} from 'angular2/testing';
import {Alert} from './alert.component';
import {AlertComponent} from './alert.component';

describe('Alert', () => {
beforeEachProviders(() => [
Alert
AlertComponent
]);

it('should have default type', inject([Alert], (alert:Alert) => {
it('should have default type', inject([AlertComponent], (alert:AlertComponent) => {
expect(alert.type)
.toEqual('warning');
}));
Expand Down
4 changes: 2 additions & 2 deletions components/alert/alert.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ const ALERT_TEMPLATE = `
directives: [NgIf, NgClass],
template: ALERT_TEMPLATE
})
export class Alert implements OnInit {
export class AlertComponent implements OnInit {
@Input() public type:string = 'warning';
@Input() public dismissible:boolean;
@Input() public dismissOnTimeout:number;

@Output() public close:EventEmitter<Alert> = new EventEmitter(false);
@Output() public close:EventEmitter<AlertComponent> = new EventEmitter(false);

private closed:boolean;
private classes:Array<string> = [];
Expand Down
6 changes: 4 additions & 2 deletions components/alert/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
### Usage
```typescript
import { Alert } from 'ng2-bootstrap/ng2-bootstrap';
import { AlertComponent } from 'ng2-bootstrap/ng2-bootstrap';
// or
import { AlertComponent } from 'ng2-bootstrap/components/alert';
```

### Annotations
Expand All @@ -11,7 +13,7 @@ import { Alert } from 'ng2-bootstrap/ng2-bootstrap';
directives: [NgIf, NgClass],
template: ALERT_TEMPLATE
})
export class Alert implements OnInit {
export class AlertComponent implements OnInit {
@Input() public type:string = 'warning';
@Input() public dismissible:boolean;
@Input() public dismissOnTimeout:number;
Expand Down
10 changes: 5 additions & 5 deletions components/buttons.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ButtonCheckbox} from './buttons/button-checkbox.component';
import {ButtonRadio} from './buttons/button-radio.component';
import {ButtonCheckboxDirective} from './buttons/button-checkbox.directive.ts';
import {ButtonRadioDirective} from './buttons/button-radio.directive.ts';

export {ButtonCheckbox} from './buttons/button-checkbox.component';
export {ButtonRadio} from './buttons/button-radio.component';
export const BUTTON_DIRECTIVES:Array<any> = [ButtonCheckbox, ButtonRadio];
export {ButtonCheckboxDirective} from './buttons/button-checkbox.directive.ts';
export {ButtonRadioDirective} from './buttons/button-radio.directive.ts';
export const BUTTON_DIRECTIVES:Array<any> = [ButtonCheckboxDirective, ButtonRadioDirective];
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
import {ControlValueAccessor, NgModel} from 'angular2/common';

@Directive({selector: '[btnCheckbox][ngModel]'})
export class ButtonCheckbox implements ControlValueAccessor, OnInit {
export class ButtonCheckboxDirective implements ControlValueAccessor, OnInit {
public cd:NgModel;
@Input() public btnCheckboxTrue:any;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
import {ControlValueAccessor, NgModel} from 'angular2/common';

@Directive({selector: '[btnRadio][ngModel]'})
export class ButtonRadio implements ControlValueAccessor, OnInit {
export class ButtonRadioDirective implements ControlValueAccessor, OnInit {
public cd:NgModel;
public el:ElementRef;

Expand Down
6 changes: 3 additions & 3 deletions components/buttons/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
```typescript
import {BUTTON_DIRECTIVES} from 'ng2-bootstrap/ng2-bootstrap';
// or
import { ButtonRadio, ButtonCheckbox } from 'ng2-bootstrap/ng2-bootstrap';
import { ButtonRadioComponent, ButtonCheckboxComponent } from 'ng2-bootstrap/ng2-bootstrap';
```
### Annotations
```typescript
// component ButtonRadio
@Directive({ selector: '[btnRadio][ngModel]' })
export class ButtonRadio implements ControlValueAccessor, OnInit {
export class ButtonRadioComponent implements ControlValueAccessor, OnInit {
@Input() public btnRadio:string;
@Input() public uncheckable:boolean;

Expand All @@ -20,7 +20,7 @@ export class ButtonRadio implements ControlValueAccessor, OnInit {
}
// component ButtonCheckbox
@Directive({ selector: '[btnCheckbox][ngModel]' })
export class ButtonCheckbox implements ControlValueAccessor, OnInit {
export class ButtonCheckboxComponent implements ControlValueAccessor, OnInit {
@Input() private btnCheckboxTrue:any;
@Input() private btnCheckboxFalse:any;

Expand Down
10 changes: 5 additions & 5 deletions components/carousel.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Slide} from './carousel/slide.component';
import {Carousel} from './carousel/carousel.component';
import {SlideComponent} from './carousel/slide.component';
import {CarouselComponent} from './carousel/carousel.component';

export {Slide} from './carousel/slide.component';
export {Carousel} from './carousel/carousel.component';
export const CAROUSEL_DIRECTIVES:Array<any> = [Carousel, Slide];
export {SlideComponent} from './carousel/slide.component';
export {CarouselComponent} from './carousel/carousel.component';
export const CAROUSEL_DIRECTIVES:Array<any> = [CarouselComponent, SlideComponent];
16 changes: 8 additions & 8 deletions components/carousel/carousel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import {Component, OnDestroy, Input} from 'angular2/core';
import {NgFor} from 'angular2/common';
import {Ng2BootstrapConfig, Ng2BootstrapTheme} from '../ng2-bootstrap-config';
import {Slide} from './slide.component';
import {SlideComponent} from './slide.component';

export enum Direction {UNKNOWN, NEXT, PREV}

Expand Down Expand Up @@ -43,7 +43,7 @@ const NAVIGATION:any = {
</div>
`
})
export class Carousel implements OnDestroy {
export class CarouselComponent implements OnDestroy {
@Input() public noWrap:boolean;
@Input() public noPause:boolean;
@Input() public noTransition:boolean;
Expand All @@ -58,18 +58,18 @@ export class Carousel implements OnDestroy {
this.restartTimer();
}

private slides:Array<Slide> = [];
private slides:Array<SlideComponent> = [];
private currentInterval:any;
private isPlaying:boolean;
private destroyed:boolean = false;
private currentSlide:Slide;
private currentSlide:SlideComponent;
private _interval:number;

public ngOnDestroy():void {
this.destroyed = true;
}

public select(nextSlide:Slide, direction:Direction = Direction.UNKNOWN):void {
public select(nextSlide:SlideComponent, direction:Direction = Direction.UNKNOWN):void {
let nextIndex = nextSlide.index;
if (direction === Direction.UNKNOWN) {
direction = nextIndex > this.getCurrentIndex()
Expand Down Expand Up @@ -122,7 +122,7 @@ export class Carousel implements OnDestroy {
return this.select(this.getSlideByIndex(newIndex), Direction.PREV);
}

public addSlide(slide:Slide):void {
public addSlide(slide:SlideComponent):void {
slide.index = this.slides.length;
this.slides.push(slide);
if (this.slides.length === 1 || slide.active) {
Expand All @@ -135,7 +135,7 @@ export class Carousel implements OnDestroy {
}
}

public removeSlide(slide:Slide):void {
public removeSlide(slide:SlideComponent):void {
this.slides.splice(slide.index, 1);

if (this.slides.length === 0) {
Expand All @@ -148,7 +148,7 @@ export class Carousel implements OnDestroy {
}
}

private goNext(slide:Slide, direction:Direction):void {
private goNext(slide:SlideComponent, direction:Direction):void {
if (this.destroyed) {
return;
}
Expand Down
6 changes: 4 additions & 2 deletions components/carousel/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
### Usage
```typescript
import { CAROUSEL_DIRECTIVES } from 'ng2-bootstrap/ng2-bootstrap';
// or
import { CAROUSEL_DIRECTIVES } from 'ng2-bootstrap/components/carousel';
```

### Annotations
Expand All @@ -10,7 +12,7 @@ import { CAROUSEL_DIRECTIVES } from 'ng2-bootstrap/ng2-bootstrap';
selector: 'carousel',
directives: [NgFor]
})
export class Carousel implements OnDestroy {
export class CarouselComponent implements OnDestroy {
@Input() private noWrap:boolean;
@Input() private noPause:boolean;
@Input() private noTransition:boolean;
Expand All @@ -23,7 +25,7 @@ export class Carousel implements OnDestroy {
selector: 'slide',
directives: [NgClass]
})
export class Slide implements OnInit, OnDestroy {
export class SlideComponent implements OnInit, OnDestroy {
@Input() public index:number;
@Input() public direction:Direction;

Expand Down
8 changes: 4 additions & 4 deletions components/carousel/slide.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Component, OnInit, OnDestroy, Input, HostBinding} from 'angular2/core';
import {Carousel, Direction} from './carousel.component';
import {CarouselComponent, Direction} from './carousel.component';

@Component({
selector: 'slide',
Expand All @@ -9,7 +9,7 @@ import {Carousel, Direction} from './carousel.component';
</div>
`
})
export class Slide implements OnInit, OnDestroy {
export class SlideComponent implements OnInit, OnDestroy {
@Input() public index:number;
@Input() public direction:Direction;

Expand All @@ -20,9 +20,9 @@ export class Slide implements OnInit, OnDestroy {
@HostBinding('class.carousel-item')
public addClass:boolean = true;

private carousel:Carousel;
private carousel:CarouselComponent;

public constructor(carousel:Carousel) {
public constructor(carousel:CarouselComponent) {
this.carousel = carousel;
}

Expand Down
2 changes: 1 addition & 1 deletion components/collapse.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {Collapse} from './collapse/collapse.component';
export {CollapseDirective} from './collapse/collapse.directive';
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {AnimationBuilder} from 'angular2/src/animate/animation_builder';
// TODO: remove ElementRef
// TODO: add on change
@Directive({selector: '[collapse]'})
export class Collapse implements OnInit {
export class CollapseDirective implements OnInit {
private animation:any;

// style
Expand Down
6 changes: 4 additions & 2 deletions components/collapse/readme.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
### Usage
```typescript
import { Collapse } from 'ng2-bootstrap/ng2-bootstrap';
import { CollapseDirective } from 'ng2-bootstrap/ng2-bootstrap';
// or
import { CollapseDirective } from 'ng2-bootstrap/components/collapse';
```

### Annotations
```typescript
// class Collapse
@Directive({ selector: '[collapse]' })
export class Collapse {
export class CollapseDirective {
@Input() public set collapse(value:boolean) {}
}
```
Expand Down
2 changes: 1 addition & 1 deletion components/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface KeyAttribute {
selector: '[ngTransclude]',
properties: ['ngTransclude']
})
export class NgTransclude {
export class NgTranscludeDirective {
public viewRef:ViewContainerRef;

private _ngTransclude:TemplateRef;
Expand Down
Loading

0 comments on commit da131ea

Please sign in to comment.