mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 06:53:03 +00:00
56434: Docs for all entity-list-element and entity-page-fields components
This commit is contained in:
@@ -17,8 +17,18 @@ import { isNotEmpty } from '../../../../shared/empty.util';
|
||||
styleUrls: ['./journal-issue-page-fields.component.scss'],
|
||||
templateUrl: './journal-issue-page-fields.component.html'
|
||||
})
|
||||
/**
|
||||
* The component for displaying metadata and relations of an item with entity type Journal Issue
|
||||
*/
|
||||
export class JournalIssuePageFieldsComponent extends EntityPageFieldsComponent {
|
||||
/**
|
||||
* The volumes related to this journal issue
|
||||
*/
|
||||
volumes$: Observable<Item[]>;
|
||||
|
||||
/**
|
||||
* The publications related to this journal issue
|
||||
*/
|
||||
publications$: Observable<Item[]>;
|
||||
|
||||
constructor(
|
||||
|
@@ -17,6 +17,9 @@ import { isNotEmpty } from '../../../../shared/empty.util';
|
||||
styleUrls: ['./journal-volume-page-fields.component.scss'],
|
||||
templateUrl: './journal-volume-page-fields.component.html'
|
||||
})
|
||||
/**
|
||||
* The component for displaying metadata and relations of an item with entity type Journal Volume
|
||||
*/
|
||||
export class JournalVolumePageFieldsComponent extends EntityPageFieldsComponent {
|
||||
journals$: Observable<Item[]>;
|
||||
issues$: Observable<Item[]>;
|
||||
|
@@ -17,7 +17,13 @@ import { isNotEmpty } from '../../../../shared/empty.util';
|
||||
styleUrls: ['./journal-page-fields.component.scss'],
|
||||
templateUrl: './journal-page-fields.component.html'
|
||||
})
|
||||
/**
|
||||
* The component for displaying metadata and relations of an item with entity type Journal
|
||||
*/
|
||||
export class JournalPageFieldsComponent extends EntityPageFieldsComponent {
|
||||
/**
|
||||
* The volumes related to this journal
|
||||
*/
|
||||
volumes$: Observable<Item[]>;
|
||||
|
||||
constructor(
|
||||
|
@@ -17,6 +17,9 @@ import { isNotEmpty } from '../../../../shared/empty.util';
|
||||
styleUrls: ['./orgunit-page-fields.component.scss'],
|
||||
templateUrl: './orgunit-page-fields.component.html'
|
||||
})
|
||||
/**
|
||||
* The component for displaying metadata and relations of an item with entity type Organisation Unit
|
||||
*/
|
||||
export class OrgUnitPageFieldsComponent extends EntityPageFieldsComponent implements OnInit {
|
||||
|
||||
people$: Observable<Item[]>;
|
||||
|
@@ -18,6 +18,9 @@ import { isNotEmpty } from '../../../../shared/empty.util';
|
||||
styleUrls: ['./person-page-fields.component.scss'],
|
||||
templateUrl: './person-page-fields.component.html'
|
||||
})
|
||||
/**
|
||||
* The component for displaying metadata and relations of an item with entity type Person
|
||||
*/
|
||||
export class PersonPageFieldsComponent extends EntityPageFieldsComponent {
|
||||
publications$: Observable<Item[]>;
|
||||
projects$: Observable<Item[]>;
|
||||
|
@@ -17,6 +17,9 @@ import { isNotEmpty } from '../../../../shared/empty.util';
|
||||
styleUrls: ['./project-page-fields.component.scss'],
|
||||
templateUrl: './project-page-fields.component.html'
|
||||
})
|
||||
/**
|
||||
* The component for displaying metadata and relations of an item with entity type Project
|
||||
*/
|
||||
export class ProjectPageFieldsComponent extends EntityPageFieldsComponent implements OnInit {
|
||||
people$: Observable<Item[]>;
|
||||
publications$: Observable<Item[]>;
|
||||
|
@@ -28,6 +28,11 @@ const compareArraysUsing = <T>(mapFn: (t: T) => any) =>
|
||||
const compareArraysUsingIds = <T extends { id: string }>() =>
|
||||
compareArraysUsing((t: T) => hasValue(t) ? t.id : undefined);
|
||||
|
||||
/**
|
||||
* Fetch the relationships which match the type label given
|
||||
* @param {string} label Type label
|
||||
* @returns {(source: Observable<[Relationship[] , RelationshipType[]]>) => Observable<Relationship[]>}
|
||||
*/
|
||||
export const filterRelationsByTypeLabel = (label: string) =>
|
||||
(source: Observable<[Relationship[], RelationshipType[]]>): Observable<Relationship[]> =>
|
||||
source.pipe(
|
||||
@@ -40,6 +45,12 @@ export const filterRelationsByTypeLabel = (label: string) =>
|
||||
distinctUntilChanged(compareArraysUsingIds())
|
||||
);
|
||||
|
||||
/**
|
||||
* Operator for turning a list of relationships into a list of the relevant items
|
||||
* @param {string} thisId The item's id of which the relations belong to
|
||||
* @param {ItemDataService} ids The ItemDataService to fetch items from the REST API
|
||||
* @returns {(source: Observable<Relationship[]>) => Observable<Item[]>}
|
||||
*/
|
||||
export const relationsToItems = (thisId: string, ids: ItemDataService) =>
|
||||
(source: Observable<Relationship[]>): Observable<Item[]> =>
|
||||
source.pipe(
|
||||
@@ -65,7 +76,13 @@ export const relationsToItems = (thisId: string, ids: ItemDataService) =>
|
||||
selector: 'ds-entity-page-fields',
|
||||
template: ''
|
||||
})
|
||||
/**
|
||||
* A generic component for displaying metadata and relations of an item
|
||||
*/
|
||||
export class EntityPageFieldsComponent implements OnInit {
|
||||
/**
|
||||
* Resolved relationships and types together in one observable
|
||||
*/
|
||||
resolvedRelsAndTypes$: Observable<[Relationship[], RelationshipType[]]>
|
||||
|
||||
constructor(
|
||||
|
@@ -12,6 +12,10 @@ import { SetViewMode } from '../../view-mode';
|
||||
templateUrl: './entity-list-element.component.html'
|
||||
})
|
||||
|
||||
/**
|
||||
* The component used to list entities depending on type
|
||||
* Uses entity-type-switcher to determine which components to use for displaying the list
|
||||
*/
|
||||
@renderElementsFor(Item, SetViewMode.List)
|
||||
export class EntityListElementComponent extends AbstractListableElementComponent<Item> {
|
||||
ElementViewMode = viewMode.ElementViewMode;
|
||||
|
@@ -8,6 +8,9 @@ import { ItemSearchResult } from '../../../object-collection/shared/item-search-
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
|
||||
// TODO lot of overlap with SearchResultListElementComponent => refactor!
|
||||
/**
|
||||
* A generic component for displaying entity list elements
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-entity-search-result',
|
||||
template: ''
|
||||
@@ -33,6 +36,11 @@ export class EntitySearchResultComponent {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the values of metadata by keys
|
||||
* @param {string[]} keys List of metadata keys to get values for
|
||||
* @returns {string[]} List of metadata values
|
||||
*/
|
||||
getValues(keys: string[]): string[] {
|
||||
const results: string[] = new Array<string>();
|
||||
this.searchResult.hitHighlights.forEach(
|
||||
@@ -52,6 +60,11 @@ export class EntitySearchResultComponent {
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first value of a metadatum by key
|
||||
* @param {string} key Metadatum key
|
||||
* @returns {string} Metadatum value
|
||||
*/
|
||||
getFirstValue(key: string): string {
|
||||
let result: string;
|
||||
this.searchResult.hitHighlights.some(
|
||||
@@ -68,6 +81,10 @@ export class EntitySearchResultComponent {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not the item's values are collapsed
|
||||
* @returns {Observable<boolean>}
|
||||
*/
|
||||
isCollapsed(): Observable<boolean> {
|
||||
return this.truncatableService.isCollapsed(this.item.id);
|
||||
}
|
||||
|
@@ -9,6 +9,8 @@ import { EntitySearchResultComponent } from '../entity-search-result-component';
|
||||
styleUrls: ['./journal-issue-list-element.component.scss'],
|
||||
templateUrl: './journal-issue-list-element.component.html'
|
||||
})
|
||||
|
||||
/**
|
||||
* The component for displaying a list element for an item with entity type Journal Issue
|
||||
*/
|
||||
export class JournalIssueListElementComponent extends EntitySearchResultComponent {
|
||||
}
|
||||
|
@@ -9,6 +9,8 @@ import { EntitySearchResultComponent } from '../entity-search-result-component';
|
||||
styleUrls: ['./journal-volume-list-element.component.scss'],
|
||||
templateUrl: './journal-volume-list-element.component.html'
|
||||
})
|
||||
|
||||
/**
|
||||
* The component for displaying a list element for an item with entity type Journal Volume
|
||||
*/
|
||||
export class JournalVolumeListElementComponent extends EntitySearchResultComponent {
|
||||
}
|
||||
|
@@ -9,6 +9,8 @@ import { EntitySearchResultComponent } from '../entity-search-result-component';
|
||||
styleUrls: ['./journal-list-element.component.scss'],
|
||||
templateUrl: './journal-list-element.component.html'
|
||||
})
|
||||
|
||||
/**
|
||||
* The component for displaying a list element for an item with entity type Journal
|
||||
*/
|
||||
export class JournalListElementComponent extends EntitySearchResultComponent {
|
||||
}
|
||||
|
@@ -9,6 +9,8 @@ import { EntitySearchResultComponent } from '../entity-search-result-component';
|
||||
styleUrls: ['./orgunit-list-element.component.scss'],
|
||||
templateUrl: './orgunit-list-element.component.html'
|
||||
})
|
||||
|
||||
/**
|
||||
* The component for displaying a list element for an item with entity type Organisation Unit
|
||||
*/
|
||||
export class OrgUnitListElementComponent extends EntitySearchResultComponent {
|
||||
}
|
||||
|
@@ -9,6 +9,8 @@ import { EntitySearchResultComponent } from '../entity-search-result-component';
|
||||
styleUrls: ['./person-list-element.component.scss'],
|
||||
templateUrl: './person-list-element.component.html'
|
||||
})
|
||||
|
||||
/**
|
||||
* The component for displaying a list element for an item with entity type Person
|
||||
*/
|
||||
export class PersonListElementComponent extends EntitySearchResultComponent {
|
||||
}
|
||||
|
@@ -9,6 +9,8 @@ import { EntitySearchResultComponent } from '../entity-search-result-component';
|
||||
styleUrls: ['./project-list-element.component.scss'],
|
||||
templateUrl: './project-list-element.component.html'
|
||||
})
|
||||
|
||||
/**
|
||||
* The component for displaying a list element for an item with entity type Project
|
||||
*/
|
||||
export class ProjectListElementComponent extends EntitySearchResultComponent {
|
||||
}
|
||||
|
@@ -10,6 +10,8 @@ import { EntitySearchResultComponent } from '../entity-search-result-component';
|
||||
styleUrls: ['./publication-list-element.component.scss'],
|
||||
templateUrl: './publication-list-element.component.html'
|
||||
})
|
||||
|
||||
/**
|
||||
* The component for displaying a list element for an item with entity type Publication
|
||||
*/
|
||||
export class PublicationListElementComponent extends EntitySearchResultComponent {
|
||||
}
|
||||
|
Reference in New Issue
Block a user