lib/features/src/reports/meta-store/report-meta-store.module.ts
Static forChild | |||||||||
forChild(stores?: Type
|
|||||||||
Parameters :
|
import {
NgModule,
ModuleWithProviders,
Type
} from '@angular/core'
import { RouterModule } from '@angular/router'
import {
BaseMetaStoreModule,
MetaAction,
MetaStoreModule,
provideItemRepresentation,
provideMainMenuEntry,
SharedModule,
TranslationsModule,
PathAction
} from '@rcc/common'
import {
Report,
ReportConfig,
ReportStore,
} from '@rcc/core'
import { ReportMetaStore } from './report-meta-store.service'
import {
REPORT_STORES,
REPORT_META_ACTIONS,
ReportHomePath
} from './report-meta-store.commons'
import { ReportMetaStorePage } from './overview-page/overview-page.component'
import en from './i18n/en.json'
import de from './i18n/de.json'
const routes = [
{ path: ReportHomePath, component: ReportMetaStorePage },
]
const metaStoreConfig = {
itemClass: Report,
serviceClass: ReportMetaStore
}
export class MenuEntryReportMetaStore {}
const menuEntry: PathAction = {
position: -3,
path: ReportHomePath,
label: 'REPORT_META_STORE.MENU_ENTRY',
icon: 'report',
}
@NgModule({
imports: [
SharedModule,
RouterModule.forChild(routes),
MetaStoreModule.forChild(metaStoreConfig),
TranslationsModule.forChild("REPORT_META_STORE", {en,de}),
],
declarations: [
ReportMetaStorePage,
],
providers:[
ReportMetaStore,
provideMainMenuEntry(menuEntry),
],
exports: [
ReportMetaStorePage,
MetaStoreModule //this is important so anything importing ReportMetaStoreModule can use the componets of MetaStoreModule too
]
})
export class ReportMetaStoreModule extends BaseMetaStoreModule {
static forChild(
stores? : Type<ReportStore>[],
metaActions? : MetaAction<ReportConfig, Report, ReportStore>[]
): ModuleWithProviders<ReportMetaStoreModule> {
const mwp = BaseMetaStoreModule.getModuleWithProviders<ReportMetaStoreModule>(this, stores, metaActions, REPORT_STORES, REPORT_META_ACTIONS)
return mwp
}
}