Skip to content

Commit fccf341

Browse files
committed
style: fix box ts errors
1 parent 992f98d commit fccf341

File tree

4 files changed

+27
-70
lines changed

4 files changed

+27
-70
lines changed

library/angular-admin-lte/src/lib/box/box.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div *ngIf="!removed" [mkColor]="boxColor" mkColorProperty="border-color" mkColorPrefix="box" [ngClass]="styleClass" [class.collapsed-box]="isCollapsed && !isCollaping" [class.box-solid]="isSolid" [mkCollapseAnimation]="remove" (mkCollapseAnimation.done)="removedDone($event)">
1+
<div *ngIf="!removed" [mkColor]="boxColor" mkColorProperty="border-color" mkColorPrefix="box" [ngClass]="styleClass" [class.collapsed-box]="isCollapsed && !isCollapsing" [class.box-solid]="isSolid" [mkCollapseAnimation]="remove" (mkCollapseAnimation.done)="removedDone($event)">
22
<div *ngIf="header || boxHeaderDirective" [ngClass]="headerStyleClass" [mkColor]="boxColor" [mkColorCondition]="isSolid" mkColorProperty="background-color" [class.with-border]="headerBorder">
33
<h3 class="box-title" [mkFontColor]="headerColor">
44
{{header}}

library/angular-admin-lte/src/lib/box/box.component.ts

Lines changed: 25 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
ChangeDetectionStrategy,
44
ChangeDetectorRef,
55
Component,
6-
ContentChild,
6+
ContentChild, ElementRef,
77
EventEmitter,
88
Input,
99
NgZone,
@@ -14,73 +14,60 @@ import {
1414
} from '@angular/core';
1515

1616
import {AnimationEvent} from '../animations/animations.interface';
17-
1817
import {BoxContentDirective, BoxFooterDirective, BoxHeaderDirective, BoxToolsDirective} from './box.directive';
19-
2018
import {removeListeners} from '../helpers';
2119

22-
/*
23-
*
24-
*/
20+
2521
@Component({
2622
selector: 'mk-box',
2723
templateUrl: './box.component.html',
2824
styleUrls: ['./box.component.css'],
2925
changeDetection: ChangeDetectionStrategy.OnPush
3026
})
3127
export class BoxComponent implements AfterViewInit, OnDestroy {
32-
public isCollaping: boolean;
33-
public remove = false;
34-
public removed: boolean;
35-
private listeners = [];
36-
3728
@Input() public boxColor = 'default';
3829
@Input() public buttonsStyleClass = 'btn btn-box-tool';
3930
@Input() public contentStyleClass = 'box-content-wrapper';
40-
@Input() public contentColor: string;
41-
@Input() public footer: string;
42-
@Input() public footerColor: string;
31+
@Input() public contentColor?: string;
32+
@Input() public footer?: string;
33+
@Input() public footerColor?: string;
4334
@Input() public footerStyleClass = 'box-footer';
44-
@Input() public header: string;
35+
@Input() public header?: string;
4536
@Input() public headerBorder = true;
46-
@Input() public headerColor: string;
37+
@Input() public headerColor?: string;
4738
@Input() public headerStyleClass = 'box-header';
4839
@Input() public isCollapsable = true;
4940
@Input() public isCollapsed = false;
50-
@Input() public isLoading: boolean;
41+
@Input() public isLoading = false;
5142
@Input() public isRemovable = true;
5243
@Input() public isSolid = false;
53-
@Input() public loadingColor: string;
44+
@Input() public loadingColor?: string;
5445
@Input() public loadingStyleClass = 'fa fa-refresh fa-spin';
5546
@Input() public styleClass = 'box';
5647

5748
@Output() public collapseDone = new EventEmitter();
5849
@Output() public collapseStart = new EventEmitter();
5950

60-
@ContentChild(BoxHeaderDirective, /* TODO: add static flag */ {}) public boxHeaderDirective: BoxHeaderDirective;
61-
@ContentChild(BoxFooterDirective, /* TODO: add static flag */ {}) public boxFooterDirective: BoxFooterDirective;
62-
@ContentChild(BoxContentDirective, /* TODO: add static flag */ {}) public boxContentDirective: BoxContentDirective;
63-
@ContentChild(BoxToolsDirective, /* TODO: add static flag */ {}) public boxToolsDirective: BoxToolsDirective;
51+
@ContentChild(BoxHeaderDirective) public boxHeaderDirective?: BoxHeaderDirective;
52+
@ContentChild(BoxFooterDirective) public boxFooterDirective?: BoxFooterDirective;
53+
@ContentChild(BoxContentDirective) public boxContentDirective?: BoxContentDirective;
54+
@ContentChild(BoxToolsDirective) public boxToolsDirective?: BoxToolsDirective;
55+
56+
@ViewChild('toggleButtonElement') private toggleButtonElement?: ElementRef<HTMLButtonElement>;
57+
@ViewChild('removeButtonElement') private removeButtonElement?: ElementRef<HTMLButtonElement>;
6458

65-
@ViewChild('toggleButtonElement') private toggleButtonElement;
66-
@ViewChild('removeButtonElement') private removeButtonElement;
59+
public isCollapsing = false;
60+
public remove = false;
61+
public removed = false;
62+
private listeners: (() => void)[] = [];
6763

68-
/**
69-
* @method constructor
70-
* @param changeDetectorRef [description]
71-
* @param ngZone [description]
72-
* @param renderer2 [description]
73-
*/
7464
constructor(
7565
private changeDetectorRef: ChangeDetectorRef,
7666
private ngZone: NgZone,
7767
private renderer2: Renderer2
7868
) {}
7969

80-
/**
81-
* @method ngAfterViewInit
82-
*/
83-
ngAfterViewInit() {
70+
ngAfterViewInit(): void {
8471
this.ngZone.runOutsideAngular(() => {
8572
if (this.toggleButtonElement) {
8673
this.listeners.push(this.renderer2.listen(this.toggleButtonElement.nativeElement, 'click', () => {
@@ -97,44 +84,26 @@ export class BoxComponent implements AfterViewInit, OnDestroy {
9784
});
9885
}
9986

100-
/**
101-
* @method ngOnDestroy
102-
*/
103-
ngOnDestroy() {
87+
ngOnDestroy(): void {
10488
removeListeners(this.listeners);
10589
}
10690

107-
/**
108-
* [removedDone description]
109-
* @method removedDone
110-
* @param event [description]
111-
*/
112-
public removedDone(event): void {
91+
public removedDone(event: AnimationEvent): void {
11392
if (event.toState === '1') {
11493
this.removed = true;
11594
}
11695
}
11796

118-
/**
119-
* [collapseStart description]
120-
* @method collapseStart
121-
* @param event [description]
122-
*/
12397
public onCollapseStart(event: AnimationEvent): void {
12498
if (event.fromState !== 'void') {
125-
this.isCollaping = true;
99+
this.isCollapsing = true;
126100
this.collapseStart.emit(event);
127101
}
128102
}
129103

130-
/**
131-
* [collapseDone description]
132-
* @method collapseDone
133-
* @param event [description]
134-
*/
135104
public onCollapseDone(event: AnimationEvent): void {
136105
if (event.fromState !== 'void') {
137-
this.isCollaping = false;
106+
this.isCollapsing = false;
138107
this.collapseDone.emit(event);
139108
}
140109
}

library/angular-admin-lte/src/lib/box/box.directive.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,27 @@
11
import { Directive } from '@angular/core';
22

3-
/*
4-
*
5-
*/
3+
64
@Directive({
75
/* tslint:disable-next-line:directive-selector */
86
selector: 'mk-box-content'
97
})
108
export class BoxContentDirective {}
119

1210

13-
/*
14-
*
15-
*/
1611
@Directive({
1712
/* tslint:disable-next-line:directive-selector */
1813
selector: 'mk-box-footer'
1914
})
2015
export class BoxFooterDirective {}
2116

2217

23-
/*
24-
*
25-
*/
2618
@Directive({
2719
/* tslint:disable-next-line:directive-selector */
2820
selector: 'mk-box-tools'
2921
})
3022
export class BoxToolsDirective {}
3123

3224

33-
/*
34-
*
35-
*/
3625
@Directive({
3726
/* tslint:disable-next-line:directive-selector */
3827
selector: 'mk-box-header'

library/angular-admin-lte/src/lib/box/box.module.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { CommonModule } from '@angular/common';
33

44
import { AnimationsModule } from '../animations/animations.module';
55
import { ColorModule } from '../color/color.module';
6-
76
import { BoxHeaderDirective, BoxContentDirective, BoxFooterDirective, BoxToolsDirective } from './box.directive';
87
import { BoxComponent } from './box.component';
98

0 commit comments

Comments
 (0)