|
| 1 | +import { NgModule } from '@angular/core'; |
| 2 | + |
| 3 | +import { JournalEntitiesModule } from '../../entity-groups/journal-entities/journal-entities.module'; |
| 4 | +import { ResearchEntitiesModule } from '../../entity-groups/research-entities/research-entities.module'; |
| 5 | +import { SearchModule } from '../../shared/search/search.module'; |
| 6 | +import { SharedModule } from '../../shared/shared.module'; |
| 7 | +import { AdminSearchPageComponent } from './admin-search-page.component'; |
| 8 | +import { CollectionAdminSearchResultGridElementComponent } from './admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component'; |
| 9 | +import { CommunityAdminSearchResultGridElementComponent } from './admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component'; |
| 10 | +import { ItemAdminSearchResultGridElementComponent } from './admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component'; |
| 11 | +import { CollectionAdminSearchResultListElementComponent } from './admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component'; |
| 12 | +import { CommunityAdminSearchResultListElementComponent } from './admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component'; |
| 13 | +import { ItemAdminSearchResultListElementComponent } from './admin-search-results/admin-search-result-list-element/item-search-result/item-admin-search-result-list-element.component'; |
| 14 | +import { ItemAdminSearchResultActionsComponent } from './admin-search-results/item-admin-search-result-actions.component'; |
| 15 | +import { ThemedAdminSearchPageComponent } from './themed-admin-search-page.component'; |
| 16 | + |
| 17 | +const ENTRY_COMPONENTS = [ |
| 18 | + // put only entry components that use custom decorator |
| 19 | + ItemAdminSearchResultListElementComponent, |
| 20 | + CommunityAdminSearchResultListElementComponent, |
| 21 | + CollectionAdminSearchResultListElementComponent, |
| 22 | + ItemAdminSearchResultGridElementComponent, |
| 23 | + CommunityAdminSearchResultGridElementComponent, |
| 24 | + CollectionAdminSearchResultGridElementComponent, |
| 25 | + ItemAdminSearchResultActionsComponent, |
| 26 | +]; |
| 27 | + |
| 28 | +@NgModule({ |
| 29 | + imports: [ |
| 30 | + SearchModule, |
| 31 | + SharedModule.withEntryComponents(), |
| 32 | + JournalEntitiesModule.withEntryComponents(), |
| 33 | + ResearchEntitiesModule.withEntryComponents(), |
| 34 | + ], |
| 35 | + declarations: [ |
| 36 | + ThemedAdminSearchPageComponent, |
| 37 | + AdminSearchPageComponent, |
| 38 | + ...ENTRY_COMPONENTS, |
| 39 | + ], |
| 40 | +}) |
| 41 | +export class AdminSearchModule { |
| 42 | + /** |
| 43 | + * NOTE: this method allows to resolve issue with components that using a custom decorator |
| 44 | + * which are not loaded during SSR otherwise |
| 45 | + */ |
| 46 | + static withEntryComponents() { |
| 47 | + return { |
| 48 | + ngModule: SharedModule, |
| 49 | + providers: ENTRY_COMPONENTS.map((component) => ({ provide: component })), |
| 50 | + }; |
| 51 | + } |
| 52 | +} |
0 commit comments