Skip to content

Commit 0d494ba

Browse files
committed
refactor: @coreui/angular components library
1 parent 25ff4c8 commit 0d494ba

21 files changed

+100
-68
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
33
"dest": "../../../dist/@coreui/angular",
4-
"deleteDestPath": false,
4+
"deleteDestPath": true,
55
"lib": {
6-
"entryFile": "src/public_api.ts"
6+
"entryFile": "src/public-api.ts"
77
}
8-
}
8+
}

projects/coreui/angular/ng-package.prod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
33
"dest": "../../../dist/@coreui/angular",
44
"lib": {
5-
"entryFile": "src/public_api.ts"
5+
"entryFile": "src/public-api.ts"
66
}
77
}

projects/coreui/angular/src/lib/aside/app-aside.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class AppAsideComponent implements OnInit, OnDestroy {
1414

1515
private readonly fixedClass = 'aside-menu-fixed';
1616

17-
@HostBinding('class.aside-menu') _aside = true;
17+
@HostBinding('class.aside-menu') asideMenuClass = true;
1818

1919
constructor(
2020
@Inject(DOCUMENT) private document: any,

projects/coreui/angular/src/lib/breadcrumb/app-breadcrumb.service.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ import { filter } from 'rxjs/operators';
99
)
1010
export class AppBreadcrumbService {
1111

12-
breadcrumbs: Observable<Array<Object>>;
12+
breadcrumbs: Observable<Array<any>>;
1313

14-
private _breadcrumbs: BehaviorSubject<Array<Object>>;
14+
private breadcrumbSubject: BehaviorSubject<Array<any>>;
1515

1616
constructor(private router: Router, private route: ActivatedRoute) {
1717

18-
this._breadcrumbs = new BehaviorSubject<Object[]>(new Array<Object>());
18+
this.breadcrumbSubject = new BehaviorSubject<any[]>(new Array<any>());
1919

20-
this.breadcrumbs = this._breadcrumbs.asObservable();
20+
this.breadcrumbs = this.breadcrumbSubject.asObservable();
2121

2222
this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe((event) => {
2323
const breadcrumbs = [];
24-
let currentRoute = this.route.root,
25-
url = '';
24+
let currentRoute = this.route.root;
25+
let url = '';
2626
do {
2727
const childrenRoutes = currentRoute.children;
2828
currentRoute = null;
@@ -33,14 +33,14 @@ export class AppBreadcrumbService {
3333
url += '/' + routeSnapshot.url.map(segment => segment.path).join('/');
3434
breadcrumbs.push({
3535
label: route.snapshot.data,
36-
url: url
36+
url
3737
});
3838
currentRoute = route;
3939
}
4040
});
4141
} while (currentRoute);
4242

43-
this._breadcrumbs.next(Object.assign([], breadcrumbs));
43+
this.breadcrumbSubject.next(Object.assign([], breadcrumbs));
4444

4545
return breadcrumbs;
4646
});
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { NgModule } from '@angular/core';
2+
import { AppAsideComponent } from './aside';
3+
import { AppBreadcrumbComponent, CuiBreadcrumbComponent } from './breadcrumb';
4+
import { AppFooterComponent } from './footer';
5+
import { AppHeaderComponent } from './header';
6+
import { AppSidebarComponent } from './sidebar';
7+
8+
@NgModule({
9+
declarations: [
10+
AppAsideComponent,
11+
AppBreadcrumbComponent,
12+
CuiBreadcrumbComponent,
13+
AppFooterComponent,
14+
AppHeaderComponent,
15+
AppSidebarComponent
16+
],
17+
imports: [
18+
],
19+
exports: [
20+
AppAsideComponent,
21+
AppBreadcrumbComponent,
22+
CuiBreadcrumbComponent,
23+
AppFooterComponent,
24+
AppHeaderComponent,
25+
AppSidebarComponent
26+
]
27+
})
28+
export class CoreuiModule { }

projects/coreui/angular/src/lib/footer/app-footer.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class AppFooterComponent implements OnInit, OnDestroy {
1010

1111
private readonly fixedClass = 'footer-fixed';
1212

13-
@HostBinding('class.app-footer') _footer = true;
13+
@HostBinding('class.app-footer') appFooterClass = true;
1414

1515
constructor(
1616
@Inject(DOCUMENT) private document: any,

projects/coreui/angular/src/lib/header/app-header.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export class AppHeaderComponent implements OnInit, OnDestroy {
2424

2525
private readonly fixedClass = 'header-fixed';
2626

27-
@HostBinding('class.app-header') _header = true;
28-
@HostBinding('class.navbar') _navbar = true;
27+
@HostBinding('class.app-header') appHeaderClass = true;
28+
@HostBinding('class.navbar') navbarClass = true;
2929

3030
navbarBrandImg: boolean;
3131

@@ -44,10 +44,10 @@ export class AppHeaderComponent implements OnInit, OnDestroy {
4444
this.isFixed(this.fixed);
4545
this.navbarBrandImg = Boolean(this.navbarBrand || this.navbarBrandFull || this.navbarBrandMinimized);
4646
this.navbarBrandRouterLink = this.navbarBrandRouterLink[0] ? this.navbarBrandRouterLink : this.navbarBrandHref;
47-
this.sidebarTogglerClass = this.setToggerBreakpointClass(<string>this.sidebarToggler);
48-
this.sidebarTogglerMobileClass = this.setToggerMobileBreakpointClass(<string>this.sidebarToggler);
49-
this.asideTogglerClass = this.setToggerBreakpointClass(<string>this.asideMenuToggler);
50-
this.asideTogglerMobileClass = this.setToggerMobileBreakpointClass(<string>this.asideMenuToggler);
47+
this.sidebarTogglerClass = this.setToggerBreakpointClass(this.sidebarToggler as string);
48+
this.sidebarTogglerMobileClass = this.setToggerMobileBreakpointClass(this.sidebarToggler as string);
49+
this.asideTogglerClass = this.setToggerBreakpointClass(this.asideMenuToggler as string);
50+
this.asideTogglerMobileClass = this.setToggerMobileBreakpointClass(this.asideMenuToggler as string);
5151
}
5252

5353
ngOnDestroy(): void {

projects/coreui/angular/src/lib/shared/layout/layout.directive.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { asideMenuCssClasses, sidebarCssClasses } from '../classes';
55
import { ClassToggler } from '../toggle-classes';
66

77
/**
8-
* Allows the sidebar to be toggled via click.
9-
*/
8+
* Allows the sidebar to be toggled via click.
9+
*/
1010
@Directive({
1111
selector: '[appSidebarToggler]',
1212
providers: [ClassToggler]
@@ -65,8 +65,8 @@ export class MobileSidebarToggleDirective {
6565
}
6666

6767
/**
68-
* Allows the off-canvas sidebar to be closed via click.
69-
*/
68+
* Allows the off-canvas sidebar to be closed via click.
69+
*/
7070
@Directive({
7171
selector: '[appSidebarClose]'
7272
})
@@ -110,8 +110,8 @@ export class BrandMinimizeDirective {
110110

111111

112112
/**
113-
* Allows the aside to be toggled via click.
114-
*/
113+
* Allows the aside to be toggled via click.
114+
*/
115115
@Directive({
116116
selector: '[appAsideMenuToggler]',
117117
providers: [ClassToggler]

projects/coreui/angular/src/lib/sidebar/app-sidebar-footer.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {Component, HostBinding} from '@angular/core';
66
})
77
export class AppSidebarFooterComponent {
88

9-
@HostBinding('class.sidebar-footer') _sidebarFooter = true;
9+
@HostBinding('class.sidebar-footer') sidebarFooterClass = true;
1010

1111
constructor() { }
1212
}

projects/coreui/angular/src/lib/sidebar/app-sidebar-form.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {Component, HostBinding} from '@angular/core';
66
})
77
export class AppSidebarFormComponent {
88

9-
@HostBinding('class.sidebar-form') _sidebarForm = true;
9+
@HostBinding('class.sidebar-form') sidebarFormClass = true;
1010

1111
constructor() { }
1212
}

projects/coreui/angular/src/lib/sidebar/app-sidebar-header.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {Component, HostBinding} from '@angular/core';
66
})
77
export class AppSidebarHeaderComponent {
88

9-
@HostBinding('class.sidebar-header') _sidebarHeader = true;
9+
@HostBinding('class.sidebar-header') sidebarHeaderClass = true;
1010

1111
constructor() { }
1212
}

projects/coreui/angular/src/lib/sidebar/app-sidebar-minimizer.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { AppSidebarService } from './app-sidebar.service';
99
export class AppSidebarMinimizerComponent {
1010

1111
@HostBinding('attr.role') @Input() role = 'button';
12-
@HostBinding('class.sidebar-minimizer') _minimizer = true;
12+
@HostBinding('class.sidebar-minimizer') sidebarMinimizerClass = true;
1313

1414
@HostListener('click', ['$event'])
1515
toggleOpen($event: any) {

projects/coreui/angular/src/lib/sidebar/app-sidebar-nav.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { INavData } from './app-sidebar-nav';
1010
export class AppSidebarNavComponent implements OnChanges {
1111
@Input() navItems: INavData[] = [];
1212

13-
@HostBinding('class.sidebar-nav') _sidebarBav = true;
13+
@HostBinding('class.sidebar-nav') sidebarNavClass = true;
1414
@HostBinding('attr.role') @Input() role = 'nav';
1515

1616
public navItemsArray: INavData[] = [];

projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-badge.pipe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export class AppSidebarNavBadgePipe implements PipeTransform {
77

88
transform(item: any, args?: any): any {
99
const classes = {
10-
'badge': true
10+
badge: true
1111
};
1212
const variant = `badge-${item.badge.variant}`;
1313
classes[variant] = !!item.badge.variant;

projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-divider.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {Component, Input, OnInit} from '@angular/core';
77
export class AppSidebarNavDividerComponent implements OnInit {
88
@Input() item: any;
99

10-
constructor () {}
10+
constructor() {}
1111

1212
ngOnInit() {}
1313
}

projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-items.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class AppSidebarNavItemsComponent {
5656
protected _items: INavData[];
5757

5858
@Input()
59-
set items(items: INavData[]) {
59+
set items(items: INavData[]) {
6060
this._items = [...items];
6161
}
6262
get items(): INavData[] {

projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-label.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class AppSidebarNavLabelComponent implements OnInit {
1010

1111
private classes = {
1212
'nav-label': true,
13-
'active': true
13+
active: true
1414
};
1515
private iconClasses = {};
1616

projects/coreui/angular/src/lib/sidebar/app-sidebar-nav/app-sidebar-nav-link.component.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ import {INavData} from '../app-sidebar-nav';
1717
`,
1818
providers: [ SidebarNavHelper ]
1919
})
20-
export class AppSidebarNavLinkContentComponent {
20+
export class AppSidebarNavLinkContentComponent implements OnInit, OnDestroy {
2121
@Input() item: any;
2222

2323
constructor(
2424
public helper: SidebarNavHelper
2525
) { }
26+
27+
ngOnInit() {}
28+
ngOnDestroy() {}
2629
}
2730

2831
@Component({
@@ -32,14 +35,14 @@ export class AppSidebarNavLinkContentComponent {
3235
})
3336
export class AppSidebarNavLinkComponent implements OnInit, OnDestroy {
3437

35-
protected _item: INavData;
38+
protected _Item: INavData;
3639

3740
@Input()
3841
set item(item: INavData) {
39-
this._item = JSON.parse(JSON.stringify(item));
42+
this._Item = JSON.parse(JSON.stringify(item));
4043
}
4144
get item(): INavData {
42-
return this._item;
45+
return this._Item;
4346
}
4447

4548
@Output() linkClick = new EventEmitter();
@@ -52,7 +55,7 @@ export class AppSidebarNavLinkComponent implements OnInit, OnDestroy {
5255
private navigationEndObservable: Observable<NavigationEnd>;
5356
private navSubscription: Subscription;
5457

55-
constructor (
58+
constructor(
5659
public router: Router,
5760
) {
5861
this.navigationEndObservable = router.events.pipe(

projects/coreui/angular/src/lib/sidebar/app-sidebar.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class AppSidebarComponent implements OnInit, OnDestroy {
3939
*/
4040
@Output() minimizedChange = new EventEmitter<boolean>();
4141

42-
@HostBinding('class.sidebar') _sidebar = true;
42+
@HostBinding('class.sidebar') sidebarClass = true;
4343

4444
constructor(
4545
@Inject(DOCUMENT) private document: any,

projects/coreui/angular/src/public_api.ts renamed to projects/coreui/angular/src/public-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ export * from './lib/footer/index';
88
export * from './lib/header/index';
99
export * from './lib/sidebar/index';
1010
// export * from './lib/shared/index';
11+
// export * from './lib/coreui.module';

src/polyfills.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,32 @@
1818
* BROWSER POLYFILLS
1919
*/
2020

21-
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
22-
import 'core-js/es6/symbol';
23-
import 'core-js/es6/object';
24-
import 'core-js/es6/function';
25-
import 'core-js/es6/parse-int';
26-
import 'core-js/es6/parse-float';
27-
import 'core-js/es6/number';
28-
import 'core-js/es6/math';
29-
import 'core-js/es6/string';
30-
import 'core-js/es6/date';
31-
import 'core-js/es6/array';
32-
import 'core-js/es6/regexp';
33-
import 'core-js/es6/map';
34-
import 'core-js/es6/weak-map';
35-
import 'core-js/es6/set';
36-
import 'core-js/es7/array';
37-
import 'core-js/es7/object';
21+
/** IE9, IE10 and IE11 requires all of the following polyfills. */
22+
import 'core-js/es/symbol';
23+
import 'core-js/es/object';
24+
import 'core-js/es/function';
25+
import 'core-js/es/parse-int';
26+
import 'core-js/es/parse-float';
27+
import 'core-js/es/number';
28+
import 'core-js/es/math';
29+
import 'core-js/es/string';
30+
import 'core-js/es/date';
31+
import 'core-js/es/array';
32+
import 'core-js/es/regexp';
33+
import 'core-js/es/map';
34+
import 'core-js/es/weak-map';
35+
import 'core-js/es/set';
36+
import 'core-js/es/array';
37+
import 'core-js/es/object';
3838

3939
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
4040
// import 'classlist.js'; // Run `npm install --save classlist.js`.
4141

4242
/** IE10 and IE11 requires the following for the Reflect API. */
43-
import 'core-js/es6/reflect';
43+
import 'core-js/es/reflect';
4444

4545

46-
/** Evergreen browsers require these. **/
46+
/** Evergreen browsers require these. */
4747
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
4848

4949

@@ -52,22 +52,22 @@ import 'core-js/es6/reflect';
5252
* Web Animations `@angular/platform-browser/animations`
5353
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
5454
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
55-
**/
55+
*/
5656
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
5757

5858
/**
5959
* By default, zone.js will patch all possible macroTask and DomEvents
6060
* user can disable parts of macroTask/DomEvents patch by setting following flags
6161
*/
6262

63-
(window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
64-
(window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
65-
(window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
63+
(window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
64+
(window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
65+
(window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
6666

67-
/*
68-
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
69-
* with the following flag, it will bypass `zone.js` patch for IE/Edge
70-
*/
67+
/**
68+
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
69+
* with the following flag, it will bypass `zone.js` patch for IE/Edge
70+
*/
7171
(window as any).__Zone_enable_cross_context_check = true;
7272

7373
/***************************************************************************************************

0 commit comments

Comments
 (0)