mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 14:03:06 +00:00
Finalise menu refactor, add typedocs and tests
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { MenuItemType } from './menu-item-type.model';
|
||||
import { AltmetricMenuItemModel } from './menu-item/models/altmetric.model';
|
||||
import { ExternalLinkMenuItemModel } from './menu-item/models/external-link.model';
|
||||
import { LinkMenuItemModel } from './menu-item/models/link.model';
|
||||
@@ -14,26 +13,6 @@ export type MenuItemModels =
|
||||
| SearchMenuItemModel
|
||||
| TextMenuItemModel;
|
||||
|
||||
function itemModelFactory(type: MenuItemType): MenuItemModels {
|
||||
switch (type) {
|
||||
case MenuItemType.TEXT:
|
||||
return new TextMenuItemModel();
|
||||
case MenuItemType.LINK:
|
||||
return new LinkMenuItemModel();
|
||||
case MenuItemType.ALTMETRIC:
|
||||
return new AltmetricMenuItemModel();
|
||||
case MenuItemType.SEARCH:
|
||||
return new SearchMenuItemModel();
|
||||
case MenuItemType.ONCLICK:
|
||||
return new OnClickMenuItemModel();
|
||||
case MenuItemType.EXTERNAL:
|
||||
return new ExternalLinkMenuItemModel();
|
||||
default: {
|
||||
throw new Error(`No such menu item type: ${type}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface MenuSection {
|
||||
/**
|
||||
* The identifier for this section
|
||||
@@ -80,5 +59,9 @@ export interface MenuSection {
|
||||
*/
|
||||
icon?: string;
|
||||
|
||||
/**
|
||||
* When true, the current section will be assumed to be a parent section with children
|
||||
* This section will not be rendered when it has no visible children
|
||||
*/
|
||||
alwaysRenderExpandable?: boolean;
|
||||
}
|
||||
|
Reference in New Issue
Block a user