refactor: don't export all modules everywhere

This commit is contained in:
Dmitry Nehaychik 2019-06-12 10:38:33 +03:00
parent df489ad17e
commit c31ff67052
17 changed files with 218 additions and 263 deletions

14
package-lock.json generated
View file

@ -1666,14 +1666,6 @@
"intersection-observer": "0.5.0"
}
},
"@ng-bootstrap/ng-bootstrap": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-4.0.0.tgz",
"integrity": "sha512-jWVHRDUYppOSvzclP9d3lVWGUO+y0X9W6jdfyYehDkJCY0MFgtwefLYMtQ/NJ4niPzm2d/zZn+Bte48iIn0nKw==",
"requires": {
"tslib": "^1.9.0"
}
},
"@ngtools/webpack": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-8.0.2.tgz",
@ -16862,9 +16854,9 @@
}
},
"tsutils": {
"version": "2.21.2",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.21.2.tgz",
"integrity": "sha512-iaIuyjIUeFLdD39MYdzqBuY7Zv6+uGxSwRH4mf+HuzsnznjFz0R2tGrAe0/JvtNh91WrN8UN/DZRFTZNDuVekA==",
"version": "2.29.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz",
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
"dev": true,
"requires": {
"tslib": "^1.8.1"

View file

@ -45,7 +45,6 @@
"@nebular/eva-icons": "^4.0.0",
"@nebular/security": "4.0.0",
"@nebular/theme": "4.0.0",
"@ng-bootstrap/ng-bootstrap": "^4.0.0",
"@swimlane/ngx-charts": "^10.0.0",
"angular-tree-component": "7.2.0",
"angular2-chartjs": "0.4.1",
@ -79,8 +78,8 @@
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.800.2",
"@angular/compiler-cli": "^8.0.0",
"@angular/cli": "^8.0.2",
"@angular/compiler-cli": "^8.0.0",
"@angular/language-service": "8.0.0",
"@compodoc/compodoc": "1.0.1",
"@fortawesome/fontawesome-free": "^5.2.0",
@ -106,7 +105,7 @@
"rimraf": "2.6.1",
"stylelint": "7.13.0",
"ts-node": "3.2.2",
"tslint": "5.7.0",
"tslint": "^5.7.0",
"tslint-language-service": "^0.9.9",
"typescript": "3.4.5"
}

View file

@ -1,42 +1,17 @@
import { ModuleWithProviders, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import {
NbActionsModule,
NbCardModule,
NbLayoutModule,
NbMenuModule,
NbRouteTabsetModule,
NbSearchModule,
NbSidebarModule,
NbTabsetModule,
NbThemeModule,
NbUserModule,
NbCheckboxModule,
NbPopoverModule,
NbContextMenuModule,
NbProgressBarModule,
NbCalendarModule,
NbCalendarRangeModule,
NbStepperModule,
NbButtonModule,
NbInputModule,
NbAccordionModule,
NbDatepickerModule,
NbDialogModule,
NbWindowModule,
NbListModule,
NbToastrModule,
NbAlertModule,
NbSpinnerModule,
NbRadioModule,
NbSelectModule,
NbChatModule,
NbTooltipModule,
NbCalendarKitModule,
NbIconModule,
NbThemeModule,
} from '@nebular/theme';
import { NbEvaIconsModule } from '@nebular/eva-icons';
import { NbSecurityModule } from '@nebular/security';
@ -53,7 +28,6 @@ import {
RoundPipe,
TimingPipe,
NumberWithCommasPipe,
EvaIconsPipe,
} from './pipes';
import {
OneColumnLayoutComponent,
@ -64,46 +38,20 @@ import { DEFAULT_THEME } from './styles/theme.default';
import { COSMIC_THEME } from './styles/theme.cosmic';
import { CORPORATE_THEME } from './styles/theme.corporate';
const BASE_MODULES = [CommonModule, FormsModule, ReactiveFormsModule];
const NB_MODULES = [
NbCardModule,
NbLayoutModule,
NbTabsetModule,
NbRouteTabsetModule,
NbMenuModule,
NbUserModule,
NbActionsModule,
NbSearchModule,
NbSidebarModule,
NbCheckboxModule,
NbPopoverModule,
NbContextMenuModule,
NgbModule,
NbSecurityModule, // *nbIsGranted directive,
NbProgressBarModule,
NbCalendarModule,
NbCalendarRangeModule,
NbStepperModule,
NbSecurityModule,
NbButtonModule,
NbListModule,
NbToastrModule,
NbInputModule,
NbAccordionModule,
NbDatepickerModule,
NbDialogModule,
NbWindowModule,
NbAlertModule,
NbSpinnerModule,
NbRadioModule,
NbSelectModule,
NbChatModule,
NbTooltipModule,
NbCalendarKitModule,
NbIconModule,
NbEvaIconsModule,
];
const COMPONENTS = [
HeaderComponent,
FooterComponent,
@ -113,44 +61,31 @@ const COMPONENTS = [
ThreeColumnsLayoutComponent,
TwoColumnsLayoutComponent,
];
const PIPES = [
CapitalizePipe,
PluralPipe,
RoundPipe,
TimingPipe,
NumberWithCommasPipe,
EvaIconsPipe,
];
const NB_THEME_PROVIDERS = [
...NbThemeModule.forRoot(
{
name: 'default',
},
[ DEFAULT_THEME, COSMIC_THEME, CORPORATE_THEME ],
).providers,
...NbSidebarModule.forRoot().providers,
...NbMenuModule.forRoot().providers,
...NbDatepickerModule.forRoot().providers,
...NbDialogModule.forRoot().providers,
...NbWindowModule.forRoot().providers,
...NbToastrModule.forRoot().providers,
...NbChatModule.forRoot({
messageGoogleMapKey: 'AIzaSyA_wNuCzia92MAmdLRzmqitRGvCF7wCZPY',
}).providers,
];
@NgModule({
imports: [...BASE_MODULES, ...NB_MODULES],
exports: [...BASE_MODULES, ...NB_MODULES, ...COMPONENTS, ...PIPES],
imports: [CommonModule, ...NB_MODULES],
exports: [CommonModule, ...PIPES, ...COMPONENTS],
declarations: [...COMPONENTS, ...PIPES],
})
export class ThemeModule {
static forRoot(): ModuleWithProviders {
return <ModuleWithProviders>{
ngModule: ThemeModule,
providers: [...NB_THEME_PROVIDERS],
providers: [
...NbThemeModule.forRoot(
{
name: 'default',
},
[ DEFAULT_THEME, COSMIC_THEME, CORPORATE_THEME ],
).providers,
],
};
}
}

View file

@ -10,7 +10,9 @@ import {
} from '@nebular/auth';
const routes: Routes = [
{ path: 'pages', loadChildren: () => import('app/pages/pages.module')
{
path: 'pages',
loadChildren: () => import('app/pages/pages.module')
.then(m => m.PagesModule),
},
{

View file

@ -9,11 +9,18 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { CoreModule } from './@core/core.module';
import { ThemeModule } from './@theme/theme.module';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { ThemeModule } from './@theme/theme.module';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import {
NbChatModule,
NbDatepickerModule,
NbDialogModule,
NbMenuModule,
NbSidebarModule,
NbToastrModule,
NbWindowModule,
} from '@nebular/theme';
@NgModule({
declarations: [AppComponent],
@ -23,8 +30,17 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
HttpClientModule,
AppRoutingModule,
NgbModule.forRoot(),
ThemeModule.forRoot(),
NbSidebarModule.forRoot(),
NbMenuModule.forRoot(),
NbDatepickerModule.forRoot(),
NbDialogModule.forRoot(),
NbWindowModule.forRoot(),
NbToastrModule.forRoot(),
NbChatModule.forRoot({
messageGoogleMapKey: 'AIzaSyA_wNuCzia92MAmdLRzmqitRGvCF7wCZPY',
}),
CoreModule.forRoot(),
],
bootstrap: [AppComponent],

View file

@ -1,5 +1,5 @@
import { NgModule } from '@angular/core';
import { NbActionsModule, NbButtonModule, NbCardModule, NbTabsetModule, NbUserModule } from '@nebular/theme';
import { NgxEchartsModule } from 'ngx-echarts';
import { ThemeModule } from '../../@theme/theme.module';
@ -20,10 +20,17 @@ import { SolarComponent } from './solar/solar.component';
import { PlayerComponent } from './rooms/player/player.component';
import { TrafficComponent } from './traffic/traffic.component';
import { TrafficChartComponent } from './traffic/traffic-chart.component';
import { FormsModule } from '@angular/forms';
@NgModule({
imports: [
FormsModule,
ThemeModule,
NbCardModule,
NbUserModule,
NbButtonModule,
NbTabsetModule,
NbActionsModule,
NgxEchartsModule,
],
declarations: [

View file

@ -1,4 +1,5 @@
import { NgModule } from '@angular/core';
import { NbButtonModule, NbCardModule, NbProgressBarModule, NbTabsetModule, NbUserModule } from '@nebular/theme';
import { NgxEchartsModule } from 'ngx-echarts';
import { NgxChartsModule } from '@swimlane/ngx-charts';
@ -49,7 +50,12 @@ import { EarningLiveUpdateChartComponent } from './earning-card/front-side/earni
@NgModule({
imports: [
ThemeModule,
NbCardModule,
NbUserModule,
NbButtonModule,
NbTabsetModule,
ChartModule,
NbProgressBarModule,
NgxEchartsModule,
NgxChartsModule,
LeafletModule,

View file

@ -1,5 +1,5 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { RouterModule, Routes } from '@angular/router';
import { FormsComponent } from './forms.component';
import { FormInputsComponent } from './form-inputs/form-inputs.component';
@ -7,32 +7,34 @@ import { FormLayoutsComponent } from './form-layouts/form-layouts.component';
import { DatepickerComponent } from './datepicker/datepicker.component';
import { ButtonsComponent } from './buttons/buttons.component';
const routes: Routes = [{
path: '',
component: FormsComponent,
children: [
{
path: 'inputs',
component: FormInputsComponent,
},
{
path: 'layouts',
component: FormLayoutsComponent,
},
{
path: 'layouts',
component: FormLayoutsComponent,
},
{
path: 'buttons',
component: ButtonsComponent,
},
{
path: 'datepicker',
component: DatepickerComponent,
},
],
}];
const routes: Routes = [
{
path: '',
component: FormsComponent,
children: [
{
path: 'inputs',
component: FormInputsComponent,
},
{
path: 'layouts',
component: FormLayoutsComponent,
},
{
path: 'layouts',
component: FormLayoutsComponent,
},
{
path: 'buttons',
component: ButtonsComponent,
},
{
path: 'datepicker',
component: DatepickerComponent,
},
],
},
];
@NgModule({
imports: [
@ -43,12 +45,5 @@ const routes: Routes = [{
],
})
export class FormsRoutingModule {
}
export const routedComponents = [
FormsComponent,
FormInputsComponent,
FormLayoutsComponent,
DatepickerComponent,
];

View file

@ -1,17 +1,26 @@
import { NgModule } from '@angular/core';
import { ThemeModule } from '../../@theme/theme.module';
import { FormsRoutingModule, routedComponents } from './forms-routing.module';
import { FormsRoutingModule } from './forms-routing.module';
import { ButtonsModule } from './buttons/buttons.module';
import { FormsComponent } from './forms.component';
import { FormInputsComponent } from './form-inputs/form-inputs.component';
import { FormLayoutsComponent } from './form-layouts/form-layouts.component';
import { DatepickerComponent } from './datepicker/datepicker.component';
import { NbInputModule } from '@nebular/theme';
@NgModule({
imports: [
ThemeModule,
NbInputModule,
FormsRoutingModule,
ButtonsModule,
],
declarations: [
...routedComponents,
FormsComponent,
FormInputsComponent,
FormLayoutsComponent,
DatepickerComponent,
],
})
export class FormsModule { }

View file

@ -1,9 +1,17 @@
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import {
NbAccordionModule,
NbButtonModule,
NbCardModule,
NbListModule,
NbRouteTabsetModule,
NbStepperModule,
NbTabsetModule, NbUserModule,
} from '@nebular/theme';
import { ThemeModule } from '../../@theme/theme.module';
import { LayoutRoutingModule } from './layout-routing.module';
// components
import { LayoutComponent } from './layout.component';
import { Tab1Component, Tab2Component, TabsComponent } from './tabs/tabs.component';
import { StepperComponent } from './stepper/stepper.component';
@ -12,40 +20,37 @@ import { InfiniteListComponent } from './infinite-list/infinite-list.component';
import { NewsPostComponent } from './infinite-list/news-post/news-post.component';
import { NewsPostPlaceholderComponent } from './infinite-list/news-post-placeholder/news-post-placeholder.component';
import { AccordionComponent } from './accordion/accordion.component';
// service
import { NewsService } from './services/news.service';
const COMPONENTS = [
LayoutComponent,
TabsComponent,
Tab1Component,
Tab2Component,
StepperComponent,
ListComponent,
NewsPostPlaceholderComponent,
InfiniteListComponent,
NewsPostComponent,
AccordionComponent,
];
const SERVICES = [
NewsService,
];
const MODULES = [
ThemeModule,
LayoutRoutingModule,
];
@NgModule({
imports: [
...MODULES,
FormsModule,
ReactiveFormsModule,
ThemeModule,
NbTabsetModule,
NbRouteTabsetModule,
NbStepperModule,
NbCardModule,
NbButtonModule,
NbListModule,
NbAccordionModule,
NbUserModule,
LayoutRoutingModule,
],
declarations: [
...COMPONENTS,
LayoutComponent,
TabsComponent,
Tab1Component,
Tab2Component,
StepperComponent,
ListComponent,
NewsPostPlaceholderComponent,
InfiniteListComponent,
NewsPostComponent,
AccordionComponent,
],
providers: [
...SERVICES,
NewsService,
],
})
export class LayoutModule { }

View file

@ -1,27 +1,10 @@
@import '../../../@theme/styles/themes';
@import '../../../../../node_modules/bootstrap/scss/mixins/breakpoints';
@import '../../../../../node_modules/@nebular/theme/styles/global/breakpoints';
@include nb-install-component() {
nb-tabset {
height: 100%;
display: flex;
flex-direction: column;
}
nb-tab {
padding: nb-theme(padding);
}
::ng-deep ngx-tab1, ::ng-deep ngx-tab2 {
display: block;
padding: nb-theme(padding);
}
@include media-breakpoint-down(xs) {
nb-tabset ::ng-deepul {
font-size: 1rem;
padding: 0 0.25rem;
}
}
nb-tabset {
height: 100%;
display: flex;
flex-direction: column;
}
::ng-deep ngx-tab1, ::ng-deep ngx-tab2 {
display: block;
padding: 1rem 2rem;
}

View file

@ -32,11 +32,11 @@ export class TabsComponent {
tabs: any[] = [
{
title: 'Route tab #1',
route: '/pages/extra-components/tabs/tab1',
route: '/pages/layout/tabs/tab1',
},
{
title: 'Route tab #2',
route: '/pages/extra-components/tabs/tab2',
route: '/pages/layout/tabs/tab2',
},
];

View file

@ -1,25 +1,25 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { RouterModule, Routes } from '@angular/router';
import { MiscellaneousComponent } from './miscellaneous.component';
import { NotFoundComponent } from './not-found/not-found.component';
const routes: Routes = [{
path: '',
component: MiscellaneousComponent,
children: [{
path: '404',
component: NotFoundComponent,
}],
}];
const routes: Routes = [
{
path: '',
component: MiscellaneousComponent,
children: [
{
path: '404',
component: NotFoundComponent,
},
],
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class MiscellaneousRoutingModule { }
export const routedComponents = [
MiscellaneousComponent,
NotFoundComponent,
];
export class MiscellaneousRoutingModule {
}

View file

@ -1,14 +1,20 @@
import { NgModule } from '@angular/core';
import { NbCardModule } from '@nebular/theme';
import { ThemeModule } from '../../@theme/theme.module';
import { MiscellaneousRoutingModule, routedComponents } from './miscellaneous-routing.module';
import { MiscellaneousRoutingModule } from './miscellaneous-routing.module';
import { MiscellaneousComponent } from './miscellaneous.component';
import { NotFoundComponent } from './not-found/not-found.component';
@NgModule({
imports: [
ThemeModule,
NbCardModule,
MiscellaneousRoutingModule,
],
declarations: [
...routedComponents,
MiscellaneousComponent,
NotFoundComponent,
],
})
export class MiscellaneousModule { }

View file

@ -38,6 +38,7 @@ export const MENU_ITEMS: NbMenuItem[] = [
},
{
title: 'Tabs',
pathMatch: 'prefix',
link: '/pages/layout/tabs',
},
],

View file

@ -23,60 +23,61 @@ const routes: Routes = [{
loadChildren: () => import('./layout/layout.module')
.then(m => m.LayoutModule),
},
{
path: 'forms',
loadChildren: () => import('./forms/forms.module')
.then(m => m.FormsModule),
},
{
path: 'ui-features',
loadChildren: () => import('./ui-features/ui-features.module')
.then(m => m.UiFeaturesModule),
},
{
path: 'modal-overlays',
loadChildren: () => import('./modal-overlays/modal-overlays.module')
.then(m => m.ModalOverlaysModule),
},
{
path: 'extra-components',
loadChildren: () => import('./extra-components/extra-components.module')
.then(m => m.ExtraComponentsModule),
},
{
path: 'maps',
loadChildren: () => import('./maps/maps.module')
.then(m => m.MapsModule),
},
{
path: 'charts',
loadChildren: () => import('./charts/charts.module')
.then(m => m.ChartsModule),
},
{
path: 'editors',
loadChildren: () => import('./editors/editors.module')
.then(m => m.EditorsModule),
},
{
path: 'tables',
loadChildren: () => import('./tables/tables.module')
.then(m => m.TablesModule),
},
{
path: 'miscellaneous',
loadChildren: () => import('./miscellaneous/miscellaneous.module')
.then(m => m.MiscellaneousModule),
},
{
path: '',
redirectTo: 'dashboard',
pathMatch: 'full',
},
// {
// path: 'forms',
// loadChildren: () => import('./forms/forms.module')
// .then(m => m.FormsModule),
// },
// {
// path: 'ui-features',
// loadChildren: () => import('./ui-features/ui-features.module')
// .then(m => m.UiFeaturesModule),
// },
// {
// path: 'modal-overlays',
// loadChildren: () => import('./modal-overlays/modal-overlays.module')
// .then(m => m.ModalOverlaysModule),
// },
// {
// path: 'extra-components',
// loadChildren: () => import('./extra-components/extra-components.module')
// .then(m => m.ExtraComponentsModule),
// },
// {
// path: 'maps',
// loadChildren: () => import('./maps/maps.module')
// .then(m => m.MapsModule),
// },
// {
// path: 'charts',
// loadChildren: () => import('./charts/charts.module')
// .then(m => m.ChartsModule),
// },
// {
// path: 'editors',
// loadChildren: () => import('./editors/editors.module')
// .then(m => m.EditorsModule),
// },
// {
// path: 'tables',
// loadChildren: () => import('./tables/tables.module')
// .then(m => m.TablesModule),
// },
// {
// path: 'miscellaneous',
// loadChildren: () => import('./miscellaneous/miscellaneous.module')
// .then(m => m.MiscellaneousModule),
// },
// {
// path: '',
// redirectTo: 'dashboard',
// pathMatch: 'full',
// },
{
path: '**',
component: NotFoundComponent,
}],
},
],
}];
@NgModule({

View file

@ -1,26 +1,24 @@
import { NgModule } from '@angular/core';
import { NbMenuModule } from '@nebular/theme';
import { ThemeModule } from '../@theme/theme.module';
import { PagesComponent } from './pages.component';
import { DashboardModule } from './dashboard/dashboard.module';
import { ECommerceModule } from './e-commerce/e-commerce.module';
import { PagesRoutingModule } from './pages-routing.module';
import { ThemeModule } from '../@theme/theme.module';
import { MiscellaneousModule } from './miscellaneous/miscellaneous.module';
const PAGES_COMPONENTS = [
PagesComponent,
];
@NgModule({
imports: [
PagesRoutingModule,
ThemeModule,
NbMenuModule,
DashboardModule,
ECommerceModule,
MiscellaneousModule,
],
declarations: [
...PAGES_COMPONENTS,
PagesComponent,
],
})
export class PagesModule {