56434: docs for entity-type-switcher

This commit is contained in:
Kristof De Langhe
2018-10-24 11:58:10 +02:00
parent 29e60f2b7f
commit 7914e1cfb1

View File

@@ -13,9 +13,23 @@ export const ITEM: InjectionToken<string> = new InjectionToken<string>('item');
styleUrls: ['./entity-type-switcher.component.scss'], styleUrls: ['./entity-type-switcher.component.scss'],
templateUrl: './entity-type-switcher.component.html' templateUrl: './entity-type-switcher.component.html'
}) })
/**
* Component for determining what component to use depending on the item's relationship type (relationship.type)
*/
export class EntityTypeSwitcherComponent implements OnInit { export class EntityTypeSwitcherComponent implements OnInit {
/**
* The item to determine the component for
*/
@Input() object: Item | SearchResult<Item>; @Input() object: Item | SearchResult<Item>;
/**
* The preferred view-mode to display
*/
@Input() viewMode: ElementViewMode; @Input() viewMode: ElementViewMode;
/**
* The object injector used to inject the item into the child component
*/
objectInjector: Injector; objectInjector: Injector;
constructor(private injector: Injector) { constructor(private injector: Injector) {
@@ -29,6 +43,10 @@ export class EntityTypeSwitcherComponent implements OnInit {
} }
/**
* Fetch the component depending on the item's relationship type
* @returns {string}
*/
getComponent(): string { getComponent(): string {
let item: Item; let item: Item;
if (hasValue((this.object as any).dspaceObject)) { if (hasValue((this.object as any).dspaceObject)) {