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

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 {