add dynamic menu components to ENTRY_COMPONENTS

This commit is contained in:
Art Lowel
2021-01-18 13:51:13 +01:00
committed by Giuseppe Digilio
parent 0308c8bc8e
commit 8df117f8ef
3 changed files with 43 additions and 2 deletions

View File

@@ -7,6 +7,15 @@ import { AdminRoutingModule } from './admin-routing.module';
import { AdminCurationTasksComponent } from './admin-curation-tasks/admin-curation-tasks.component';
import { AdminWorkflowModuleModule } from './admin-workflow-page/admin-workflow.module';
import { AdminSearchModule } from './admin-search-page/admin-search.module';
import { AdminSidebarSectionComponent } from './admin-sidebar/admin-sidebar-section/admin-sidebar-section.component';
import { ExpandableAdminSidebarSectionComponent } from './admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component';
const ENTRY_COMPONENTS = [
// put only entry components that use custom decorator
AdminSidebarSectionComponent,
ExpandableAdminSidebarSectionComponent,
];
@NgModule({
imports: [
@@ -23,5 +32,14 @@ import { AdminSearchModule } from './admin-search-page/admin-search.module';
]
})
export class AdminModule {
/**
* NOTE: this method allows to resolve issue with components that using a custom decorator
* which are not loaded during CSR otherwise
*/
static withEntryComponents() {
return {
ngModule: AdminModule,
providers: ENTRY_COMPONENTS.map((component) => ({provide: component}))
};
}
}

View File

@@ -14,6 +14,12 @@ const effects = [
NavbarEffects
];
const ENTRY_COMPONENTS = [
// put only entry components that use custom decorator
NavbarSectionComponent,
ExpandableNavbarSectionComponent,
];
@NgModule({
imports: [
CommonModule,
@@ -44,4 +50,15 @@ const effects = [
* This module handles all components and pipes that are necessary for the horizontal navigation bar
*/
export class NavbarModule {
/**
* NOTE: this method allows to resolve issue with components that using a custom decorator
* which are not loaded during CSR otherwise
*/
static withEntryComponents() {
return {
ngModule: NavbarModule,
providers: ENTRY_COMPONENTS.map((component) => ({provide: component}))
};
}
}

View File

@@ -229,6 +229,9 @@ import { RelatedItemsComponent } from '../+item-page/simple/related-items/relate
import { TabbedRelatedEntitiesSearchComponent } from '../+item-page/simple/related-entities/tabbed-related-entities-search/tabbed-related-entities-search.component';
import { RelatedEntitiesSearchComponent } from '../+item-page/simple/related-entities/related-entities-search/related-entities-search.component';
import { ConfigurationSearchPageComponent } from '../+search-page/configuration-search-page.component';
import { LinkMenuItemComponent } from './menu/menu-item/link-menu-item.component';
import { OnClickMenuItemComponent } from './menu/menu-item/onclick-menu-item.component';
import { TextMenuItemComponent } from './menu/menu-item/text-menu-item.component';
/**
* Declaration needed to make sure all decorator functions are called in time
@@ -506,7 +509,10 @@ const ENTRY_COMPONENTS = [
ClaimedTaskActionsEditMetadataComponent,
PublicationSidebarSearchListElementComponent,
CollectionSidebarSearchListElementComponent,
CommunitySidebarSearchListElementComponent
CommunitySidebarSearchListElementComponent,
LinkMenuItemComponent,
OnClickMenuItemComponent,
TextMenuItemComponent
];
const SHARED_SEARCH_PAGE_COMPONENTS = [