ngx-admin/src/app/@theme/theme.module.ts

88 lines
2 KiB
TypeScript
Raw Normal View History

import { ModuleWithProviders, NgModule } from '@angular/core';
2017-04-13 14:24:23 +03:00
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import {
NgaActionsModule,
2017-04-13 14:24:23 +03:00
NgaCardModule,
NgaLayoutModule,
NgaMenuModule,
2017-04-13 14:24:23 +03:00
NgaRouteTabsetModule,
NgaSearchModule,
2017-04-13 14:24:23 +03:00
NgaSidebarModule,
NgaTabsetModule,
NgaThemeModule,
NgaUserModule,
} from '@akveo/nga-theme';
2017-04-13 14:24:23 +03:00
import {
FooterComponent,
HeaderComponent,
SearchInputComponent,
ThemeSettingsComponent,
TinyMCEComponent,
} from './components';
import { CapitalizePipe, PluralPipe, RoundPipe } from './pipes';
import {
OneColumnLayoutComponent,
SampleLayoutComponent,
ThreeColumnsLayoutComponent,
TwoColumnsLayoutComponent,
} from './layouts';
import { DEFAULT_THEME } from './styles/theme.default';
import { COSMIC_THEME } from './styles/theme.cosmic';
2017-04-13 14:24:23 +03:00
const BASE_MODULES = [CommonModule, FormsModule, ReactiveFormsModule];
2017-04-13 14:24:23 +03:00
const NGA_MODULES = [
NgaCardModule,
NgaLayoutModule,
NgaTabsetModule,
NgaRouteTabsetModule,
NgaMenuModule,
NgaUserModule,
NgaActionsModule,
NgaSearchModule,
NgaSidebarModule,
2017-04-13 14:24:23 +03:00
];
const COMPONENTS = [
2017-04-28 15:14:05 +03:00
HeaderComponent,
FooterComponent,
SearchInputComponent,
ThemeSettingsComponent,
TinyMCEComponent,
OneColumnLayoutComponent,
SampleLayoutComponent,
ThreeColumnsLayoutComponent,
TwoColumnsLayoutComponent,
2017-04-13 14:24:23 +03:00
];
const PIPES = [CapitalizePipe, PluralPipe, RoundPipe];
const NGA_THEME_PROVIDERS = [
...NgaThemeModule.forRoot(
{
2017-08-01 15:42:06 +03:00
name: 'default',
},
[DEFAULT_THEME, COSMIC_THEME],
).providers,
...NgaSidebarModule.forRoot().providers,
...NgaSidebarModule.forRoot().providers,
...NgaMenuModule.forRoot().providers,
];
2017-04-13 14:24:23 +03:00
@NgModule({
imports: [...BASE_MODULES, ...NGA_MODULES],
exports: [...BASE_MODULES, ...NGA_MODULES, ...COMPONENTS, ...PIPES],
declarations: [...COMPONENTS, ...PIPES],
2017-04-13 14:24:23 +03:00
})
export class ThemeModule {
static forRoot(): ModuleWithProviders {
return <ModuleWithProviders>{
ngModule: ThemeModule,
providers: [...NGA_THEME_PROVIDERS],
};
}
2017-04-13 14:24:23 +03:00
}