mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 10:34:15 +00:00
continued refactoring listable objects
This commit is contained in:
@@ -3,7 +3,7 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
|||||||
import { MockTranslateLoader } from '../../../../shared/mocks/mock-translate-loader';
|
import { MockTranslateLoader } from '../../../../shared/mocks/mock-translate-loader';
|
||||||
import { GenericItemPageFieldComponent } from '../../field-components/specific-field/generic/generic-item-page-field.component';
|
import { GenericItemPageFieldComponent } from '../../field-components/specific-field/generic/generic-item-page-field.component';
|
||||||
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
||||||
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../../shared/items/switcher/listable-object-component-loader.component';
|
||||||
import { ItemDataService } from '../../../../core/data/item-data.service';
|
import { ItemDataService } from '../../../../core/data/item-data.service';
|
||||||
import { SearchFixedFilterService } from '../../../../+search-page/search-filters/search-filter/search-fixed-filter.service';
|
import { SearchFixedFilterService } from '../../../../+search-page/search-filters/search-filter/search-fixed-filter.service';
|
||||||
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
||||||
|
@@ -1,16 +1,14 @@
|
|||||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import {
|
|
||||||
DEFAULT_ITEM_TYPE, rendersItemType
|
|
||||||
} from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { ItemComponent } from '../shared/item.component';
|
import { ItemComponent } from '../shared/item.component';
|
||||||
import { MetadataRepresentation } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
import { MetadataRepresentation } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
||||||
import { getRelatedItemsByTypeLabel } from '../shared/item-relationships-utils';
|
import { getRelatedItemsByTypeLabel } from '../shared/item-relationships-utils';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { DEFAULT_ITEM_TYPE, listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('Publication', ViewMode.StandalonePage)
|
@listableObjectComponent('Publication', ViewMode.StandalonePage)
|
||||||
@rendersItemType(DEFAULT_ITEM_TYPE, ViewMode.StandalonePage)
|
@listableObjectComponent(DEFAULT_ITEM_TYPE, ViewMode.StandalonePage)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-publication',
|
selector: 'ds-publication',
|
||||||
styleUrls: ['./publication.component.scss'],
|
styleUrls: ['./publication.component.scss'],
|
||||||
|
@@ -7,7 +7,7 @@ import { ItemDataService } from '../../../../core/data/item-data.service';
|
|||||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||||
import { MockTranslateLoader } from '../../../../shared/mocks/mock-translate-loader';
|
import { MockTranslateLoader } from '../../../../shared/mocks/mock-translate-loader';
|
||||||
import { ChangeDetectionStrategy, DebugElement, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, DebugElement, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../../shared/items/switcher/listable-object-component-loader.component';
|
||||||
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
||||||
import { isNotEmpty } from '../../../../shared/empty.util';
|
import { isNotEmpty } from '../../../../shared/empty.util';
|
||||||
import { SearchFixedFilterService } from '../../../../+search-page/search-filters/search-filter/search-fixed-filter.service';
|
import { SearchFixedFilterService } from '../../../../+search-page/search-filters/search-filter/search-fixed-filter.service';
|
||||||
|
@@ -8,7 +8,7 @@ import { RelationshipType } from '../../../../core/shared/item-relationships/rel
|
|||||||
import { Relationship } from '../../../../core/shared/item-relationships/relationship.model';
|
import { Relationship } from '../../../../core/shared/item-relationships/relationship.model';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../core/shared/operators';
|
import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../core/shared/operators';
|
||||||
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../../shared/items/switcher/listable-object-component-loader.component';
|
||||||
import { MetadataRepresentation } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
import { MetadataRepresentation } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
||||||
import { ItemMetadataRepresentation } from '../../../../core/shared/metadata-representation/item/item-metadata-representation.model';
|
import { ItemMetadataRepresentation } from '../../../../core/shared/metadata-representation/item/item-metadata-representation.model';
|
||||||
import { MetadatumRepresentation } from '../../../../core/shared/metadata-representation/metadatum/metadatum-representation.model';
|
import { MetadatumRepresentation } from '../../../../core/shared/metadata-representation/metadatum/metadatum-representation.model';
|
||||||
|
@@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
export enum Context {
|
export enum Context {
|
||||||
Undefined = 'undefined',
|
Undefined = 'undefined',
|
||||||
SearchList = 'searchList',
|
ItemPage = 'itemPage',
|
||||||
SearchGrid = 'searchGrid',
|
Search = 'search',
|
||||||
Submission = 'submission',
|
Submission = 'submission',
|
||||||
AdminMenuList = 'adminMenuList',
|
AdminMenu = 'adminMenu',
|
||||||
SubmissionModal = 'submissionModal',
|
SubmissionModal = 'submissionModal',
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { focusShadow } from '../../../../shared/animations/focus';
|
import { focusShadow } from '../../../../shared/animations/focus';
|
||||||
import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component';
|
import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('JournalIssue', ViewMode.GridElement)
|
@listableObjectComponent('JournalIssue', ViewMode.GridElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-journal-issue-grid-element',
|
selector: 'ds-journal-issue-grid-element',
|
||||||
styleUrls: ['./journal-issue-grid-element.component.scss'],
|
styleUrls: ['./journal-issue-grid-element.component.scss'],
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { focusShadow } from '../../../../shared/animations/focus';
|
import { focusShadow } from '../../../../shared/animations/focus';
|
||||||
import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component';
|
import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('JournalVolume', ViewMode.GridElement)
|
@listableObjectComponent('JournalVolume', ViewMode.GridElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-journal-volume-grid-element',
|
selector: 'ds-journal-volume-grid-element',
|
||||||
styleUrls: ['./journal-volume-grid-element.component.scss'],
|
styleUrls: ['./journal-volume-grid-element.component.scss'],
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { focusShadow } from '../../../../shared/animations/focus';
|
import { focusShadow } from '../../../../shared/animations/focus';
|
||||||
import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component';
|
import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('Journal', ViewMode.GridElement)
|
@listableObjectComponent('Journal', ViewMode.GridElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-journal-grid-element',
|
selector: 'ds-journal-grid-element',
|
||||||
styleUrls: ['./journal-grid-element.component.scss'],
|
styleUrls: ['./journal-grid-element.component.scss'],
|
||||||
|
@@ -5,7 +5,7 @@ import { JournalIssueListElementComponent } from './journal-issue-list-element.c
|
|||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
||||||
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../../shared/items/switcher/listable-object-component-loader.component';
|
||||||
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
||||||
|
|
||||||
let journalIssueListElementComponent: JournalIssueListElementComponent;
|
let journalIssueListElementComponent: JournalIssueListElementComponent;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('JournalIssue', ViewMode.ListElement)
|
@listableObjectComponent('JournalIssue', ViewMode.ListElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-journal-issue-list-element',
|
selector: 'ds-journal-issue-list-element',
|
||||||
styleUrls: ['./journal-issue-list-element.component.scss'],
|
styleUrls: ['./journal-issue-list-element.component.scss'],
|
||||||
|
@@ -5,7 +5,7 @@ import { JournalVolumeListElementComponent } from './journal-volume-list-element
|
|||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
||||||
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../../shared/items/switcher/listable-object-component-loader.component';
|
||||||
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
||||||
|
|
||||||
let journalVolumeListElementComponent: JournalVolumeListElementComponent;
|
let journalVolumeListElementComponent: JournalVolumeListElementComponent;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('JournalVolume', ViewMode.ListElement)
|
@listableObjectComponent('JournalVolume', ViewMode.ListElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-journal-volume-list-element',
|
selector: 'ds-journal-volume-list-element',
|
||||||
styleUrls: ['./journal-volume-list-element.component.scss'],
|
styleUrls: ['./journal-volume-list-element.component.scss'],
|
||||||
|
@@ -5,7 +5,7 @@ import { JournalListElementComponent } from './journal-list-element.component';
|
|||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
||||||
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../../shared/items/switcher/listable-object-component-loader.component';
|
||||||
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
||||||
|
|
||||||
let journalListElementComponent: JournalListElementComponent;
|
let journalListElementComponent: JournalListElementComponent;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('Journal', ViewMode.ListElement)
|
@listableObjectComponent('Journal', ViewMode.ListElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-journal-list-element',
|
selector: 'ds-journal-list-element',
|
||||||
styleUrls: ['./journal-list-element.component.scss'],
|
styleUrls: ['./journal-list-element.component.scss'],
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { isNotEmpty } from '../../../../shared/empty.util';
|
import { isNotEmpty } from '../../../../shared/empty.util';
|
||||||
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
|
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
|
||||||
import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
|
import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('JournalIssue', ViewMode.StandalonePage)
|
@listableObjectComponent('JournalIssue', ViewMode.StandalonePage)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-journal-issue',
|
selector: 'ds-journal-issue',
|
||||||
styleUrls: ['./journal-issue.component.scss'],
|
styleUrls: ['./journal-issue.component.scss'],
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { isNotEmpty } from '../../../../shared/empty.util';
|
import { isNotEmpty } from '../../../../shared/empty.util';
|
||||||
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
|
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
|
||||||
import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
|
import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('JournalVolume', ViewMode.StandalonePage)
|
@listableObjectComponent('JournalVolume', ViewMode.StandalonePage)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-journal-volume',
|
selector: 'ds-journal-volume',
|
||||||
styleUrls: ['./journal-volume.component.scss'],
|
styleUrls: ['./journal-volume.component.scss'],
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { ChangeDetectionStrategy, DebugElement, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, DebugElement, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
||||||
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../../shared/items/switcher/listable-object-component-loader.component';
|
||||||
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
||||||
import { ItemDataService } from '../../../../core/data/item-data.service';
|
import { ItemDataService } from '../../../../core/data/item-data.service';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { isNotEmpty } from '../../../../shared/empty.util';
|
import { isNotEmpty } from '../../../../shared/empty.util';
|
||||||
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
|
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
|
||||||
import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
|
import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('Journal', ViewMode.StandalonePage)
|
@listableObjectComponent('Journal', ViewMode.StandalonePage)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-journal',
|
selector: 'ds-journal',
|
||||||
styleUrls: ['./journal.component.scss'],
|
styleUrls: ['./journal.component.scss'],
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { focusShadow } from '../../../../shared/animations/focus';
|
import { focusShadow } from '../../../../shared/animations/focus';
|
||||||
import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component';
|
import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('OrgUnit', ViewMode.GridElement)
|
@listableObjectComponent('OrgUnit', ViewMode.GridElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-orgunit-grid-element',
|
selector: 'ds-orgunit-grid-element',
|
||||||
styleUrls: ['./orgunit-grid-element.component.scss'],
|
styleUrls: ['./orgunit-grid-element.component.scss'],
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component';
|
import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component';
|
||||||
import { focusShadow } from '../../../../shared/animations/focus';
|
import { focusShadow } from '../../../../shared/animations/focus';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('Person', ViewMode.GridElement)
|
@listableObjectComponent('Person', ViewMode.GridElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-person-grid-element',
|
selector: 'ds-person-grid-element',
|
||||||
styleUrls: ['./person-grid-element.component.scss'],
|
styleUrls: ['./person-grid-element.component.scss'],
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { focusShadow } from '../../../../shared/animations/focus';
|
import { focusShadow } from '../../../../shared/animations/focus';
|
||||||
import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component';
|
import { TypedItemSearchResultGridElementComponent } from '../../../../shared/object-grid/item-grid-element/item-types/typed-item-search-result-grid-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('Project', ViewMode.GridElement)
|
@listableObjectComponent('Project', ViewMode.GridElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-project-grid-element',
|
selector: 'ds-project-grid-element',
|
||||||
styleUrls: ['./project-grid-element.component.scss'],
|
styleUrls: ['./project-grid-element.component.scss'],
|
||||||
|
@@ -0,0 +1,16 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
import { Context } from '../../../../core/shared/context.model';
|
||||||
|
|
||||||
|
@listableObjectComponent('OrgUnit', ViewMode.ListElement, Context.ItemPage)
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-orgunit-item-page-list-element',
|
||||||
|
templateUrl: './orgunit-item-page-list-element.component.html'
|
||||||
|
})
|
||||||
|
/**
|
||||||
|
* The component for displaying a list element for an item of the type OrgUnit
|
||||||
|
*/
|
||||||
|
export class OrgunitItemPageListElementComponent extends TypedItemSearchResultListElementComponent {
|
||||||
|
}
|
@@ -5,7 +5,7 @@ import { OrgUnitListElementComponent } from './orgunit-list-element.component';
|
|||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
||||||
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../../shared/items/switcher/listable-object-component-loader.component';
|
||||||
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
||||||
|
|
||||||
let orgUnitListElementComponent: OrgUnitListElementComponent;
|
let orgUnitListElementComponent: OrgUnitListElementComponent;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('OrgUnit', ViewMode.ListElement)
|
@listableObjectComponent('OrgUnit', ViewMode.ListElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-orgunit-list-element',
|
selector: 'ds-orgunit-list-element',
|
||||||
styleUrls: ['./orgunit-list-element.component.scss'],
|
styleUrls: ['./orgunit-list-element.component.scss'],
|
||||||
|
@@ -1,16 +0,0 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
import { MetadataRepresentationType } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
|
||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
|
||||||
|
|
||||||
@rendersItemType('OrgUnit', ViewMode.ListElement, MetadataRepresentationType.Item)
|
|
||||||
@Component({
|
|
||||||
selector: 'ds-orgunit-metadata-list-element',
|
|
||||||
templateUrl: './orgunit-metadata-list-element.component.html'
|
|
||||||
})
|
|
||||||
/**
|
|
||||||
* The component for displaying a list element for an item of the type OrgUnit
|
|
||||||
*/
|
|
||||||
export class OrgUnitMetadataListElementComponent extends TypedItemSearchResultListElementComponent {
|
|
||||||
}
|
|
@@ -0,0 +1,16 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { Context } from '../../../../core/shared/context.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
|
@listableObjectComponent('OrgUnit', ViewMode.ListElement, Context.ItemPage)
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-person-item-page-list-element',
|
||||||
|
templateUrl: './person-item-page-list-element.component.html'
|
||||||
|
})
|
||||||
|
/**
|
||||||
|
* The component for displaying a list element for an item of the type Person
|
||||||
|
*/
|
||||||
|
export class PersonItemPageListElementComponent extends TypedItemSearchResultListElementComponent {
|
||||||
|
}
|
@@ -5,7 +5,7 @@ import { PersonListElementComponent } from './person-list-element.component';
|
|||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
||||||
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../../shared/items/switcher/listable-object-component-loader.component';
|
||||||
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
||||||
|
|
||||||
let personListElementComponent: PersonListElementComponent;
|
let personListElementComponent: PersonListElementComponent;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('Person', ViewMode.ListElement)
|
@listableObjectComponent('Person', ViewMode.ListElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-person-list-element',
|
selector: 'ds-person-list-element',
|
||||||
styleUrls: ['./person-list-element.component.scss'],
|
styleUrls: ['./person-list-element.component.scss'],
|
||||||
|
@@ -1,16 +0,0 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { MetadataRepresentationType } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
|
||||||
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
|
||||||
|
|
||||||
@rendersItemType('Person', ViewMode.ListElement, MetadataRepresentationType.Item)
|
|
||||||
@Component({
|
|
||||||
selector: 'ds-person-metadata-list-element',
|
|
||||||
templateUrl: './person-metadata-list-element.component.html'
|
|
||||||
})
|
|
||||||
/**
|
|
||||||
* The component for displaying a list element for an item of the type Person
|
|
||||||
*/
|
|
||||||
export class PersonMetadataListElementComponent extends TypedItemSearchResultListElementComponent {
|
|
||||||
}
|
|
@@ -5,7 +5,7 @@ import { ProjectListElementComponent } from './project-list-element.component';
|
|||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
||||||
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../../shared/items/switcher/listable-object-component-loader.component';
|
||||||
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
||||||
|
|
||||||
let projectListElementComponent: ProjectListElementComponent;
|
let projectListElementComponent: ProjectListElementComponent;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
import { TypedItemSearchResultListElementComponent } from '../../../../shared/object-list/item-list-element/item-types/typed-item-search-result-list-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { metadataRepresentationComponent } from '../../../../shared/metadata-representation/metadata-representation.decorator';
|
||||||
|
import { MetadataRepresentationType } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
||||||
|
|
||||||
@rendersItemType('Project', ViewMode.ListElement)
|
@metadataRepresentationComponent('Project', MetadataRepresentationType.PlainText)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-project-list-element',
|
selector: 'ds-project-list-element',
|
||||||
styleUrls: ['./project-list-element.component.scss'],
|
styleUrls: ['./project-list-element.component.scss'],
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { isNotEmpty } from '../../../../shared/empty.util';
|
import { isNotEmpty } from '../../../../shared/empty.util';
|
||||||
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
|
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
|
||||||
import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
|
import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('OrgUnit', ViewMode.StandalonePage)
|
@listableObjectComponent('OrgUnit', ViewMode.StandalonePage)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-orgunit',
|
selector: 'ds-orgunit',
|
||||||
styleUrls: ['./orgunit.component.scss'],
|
styleUrls: ['./orgunit.component.scss'],
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { Observable , of as observableOf } from 'rxjs';
|
import { Observable , of as observableOf } from 'rxjs';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
import { ITEM } from '../../../../shared/items/switcher/listable-object-component-loader.component';
|
||||||
import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
|
|
||||||
import { SearchFixedFilterService } from '../../../../+search-page/search-filters/search-filter/search-fixed-filter.service';
|
import { SearchFixedFilterService } from '../../../../+search-page/search-filters/search-filter/search-fixed-filter.service';
|
||||||
import { isNotEmpty } from '../../../../shared/empty.util';
|
import { isNotEmpty } from '../../../../shared/empty.util';
|
||||||
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
|
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
|
||||||
import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
|
import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('Person', ViewMode.StandalonePage)
|
@listableObjectComponent('Person', ViewMode.StandalonePage)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-person',
|
selector: 'ds-person',
|
||||||
styleUrls: ['./person.component.scss'],
|
styleUrls: ['./person.component.scss'],
|
||||||
|
@@ -2,13 +2,13 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { MetadataRepresentation } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
import { MetadataRepresentation } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
||||||
import { rendersItemType } from '../../../../shared/items/item-type-decorator';
|
|
||||||
import { isNotEmpty } from '../../../../shared/empty.util';
|
import { isNotEmpty } from '../../../../shared/empty.util';
|
||||||
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
|
import { ItemComponent } from '../../../../+item-page/simple/item-types/shared/item.component';
|
||||||
import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
|
import { getRelatedItemsByTypeLabel } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('Project', ViewMode.StandalonePage)
|
@listableObjectComponent('Project', ViewMode.StandalonePage)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-project',
|
selector: 'ds-project',
|
||||||
styleUrls: ['./project.component.scss'],
|
styleUrls: ['./project.component.scss'],
|
||||||
|
@@ -6,8 +6,8 @@ import { OrgunitComponent } from './item-pages/orgunit/orgunit.component';
|
|||||||
import { PersonComponent } from './item-pages/person/person.component';
|
import { PersonComponent } from './item-pages/person/person.component';
|
||||||
import { ProjectComponent } from './item-pages/project/project.component';
|
import { ProjectComponent } from './item-pages/project/project.component';
|
||||||
import { OrgUnitListElementComponent } from './item-list-elements/orgunit/orgunit-list-element.component';
|
import { OrgUnitListElementComponent } from './item-list-elements/orgunit/orgunit-list-element.component';
|
||||||
import { OrgUnitMetadataListElementComponent } from './item-list-elements/orgunit/orgunit-metadata-list-element.component';
|
import { OrgunitItemPageListElementComponent } from './item-list-elements/orgunit/orgunit-item-page-list-element.component';
|
||||||
import { PersonMetadataListElementComponent } from './item-list-elements/person/person-metadata-list-element.component';
|
import { PersonItemPageListElementComponent } from './item-list-elements/person/person-item-page-list-element.component';
|
||||||
import { PersonListElementComponent } from './item-list-elements/person/person-list-element.component';
|
import { PersonListElementComponent } from './item-list-elements/person/person-list-element.component';
|
||||||
import { ProjectListElementComponent } from './item-list-elements/project/project-list-element.component';
|
import { ProjectListElementComponent } from './item-list-elements/project/project-list-element.component';
|
||||||
import { TooltipModule } from 'ngx-bootstrap';
|
import { TooltipModule } from 'ngx-bootstrap';
|
||||||
@@ -20,9 +20,9 @@ const ENTRY_COMPONENTS = [
|
|||||||
PersonComponent,
|
PersonComponent,
|
||||||
ProjectComponent,
|
ProjectComponent,
|
||||||
OrgUnitListElementComponent,
|
OrgUnitListElementComponent,
|
||||||
OrgUnitMetadataListElementComponent,
|
OrgunitItemPageListElementComponent,
|
||||||
PersonListElementComponent,
|
PersonListElementComponent,
|
||||||
PersonMetadataListElementComponent,
|
PersonItemPageListElementComponent,
|
||||||
ProjectListElementComponent,
|
ProjectListElementComponent,
|
||||||
PersonGridElementComponent,
|
PersonGridElementComponent,
|
||||||
OrgunitGridElementComponent,
|
OrgunitGridElementComponent,
|
||||||
|
@@ -1,40 +0,0 @@
|
|||||||
import { hasNoValue, hasValue } from '../empty.util';
|
|
||||||
import { ViewMode } from '../../core/shared/view-mode.model';
|
|
||||||
|
|
||||||
export const DEFAULT_ITEM_TYPE = 'Default';
|
|
||||||
export const DEFAULT_VIEW_MODE = ViewMode.ListElement;
|
|
||||||
|
|
||||||
|
|
||||||
const map = new Map();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decorator used for rendering simple item pages by type and viewMode (and optionally a representationType)
|
|
||||||
* @param type
|
|
||||||
* @param viewMode
|
|
||||||
*/
|
|
||||||
export function rendersItemType(type: string, viewMode: string) {
|
|
||||||
return function decorator(component: any) {
|
|
||||||
if (hasNoValue(map.get(viewMode))) {
|
|
||||||
map.set(viewMode, new Map());
|
|
||||||
}
|
|
||||||
if (hasValue(map.get(viewMode).get(type))) {
|
|
||||||
throw new Error(`There can't be more than one component to render Metadata of type "${type}" in view mode "${viewMode}"`);
|
|
||||||
}
|
|
||||||
map.get(viewMode).set(type, component);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the component used for rendering an item by type and viewMode (and optionally a representationType)
|
|
||||||
* @param type
|
|
||||||
* @param viewMode
|
|
||||||
*/
|
|
||||||
export function getComponentByItemType(type: string, viewMode: string) {
|
|
||||||
if (hasNoValue(map.get(viewMode))) {
|
|
||||||
viewMode = DEFAULT_VIEW_MODE;
|
|
||||||
}
|
|
||||||
if (hasNoValue(map.get(viewMode).get(type))) {
|
|
||||||
type = DEFAULT_ITEM_TYPE;
|
|
||||||
}
|
|
||||||
return map.get(viewMode).get(type);
|
|
||||||
}
|
|
@@ -1 +0,0 @@
|
|||||||
<ng-container *ngComponentOutlet="component; injector: objectInjector;"></ng-container>
|
|
@@ -1 +0,0 @@
|
|||||||
@import '../../../../styles/variables';
|
|
@@ -1,64 +0,0 @@
|
|||||||
import { Component, InjectionToken, Injector, Input, OnInit } from '@angular/core';
|
|
||||||
import { SearchResult } from '../../../+search-page/search-result.model';
|
|
||||||
import { Item } from '../../../core/shared/item.model';
|
|
||||||
import { hasValue } from '../../empty.util';
|
|
||||||
import { ItemSearchResult } from '../../object-collection/shared/item-search-result.model';
|
|
||||||
import { getComponentByItemType } from '../item-type-decorator';
|
|
||||||
import { MetadataRepresentation } from '../../../core/shared/metadata-representation/metadata-representation.model';
|
|
||||||
|
|
||||||
export const ITEM: InjectionToken<string> = new InjectionToken<string>('item');
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'ds-item-type-switcher',
|
|
||||||
styleUrls: ['./item-type-switcher.component.scss'],
|
|
||||||
templateUrl: './item-type-switcher.component.html'
|
|
||||||
})
|
|
||||||
/**
|
|
||||||
* Component for determining what component to use depending on the item's relationship type (relationship.type)
|
|
||||||
*/
|
|
||||||
export class ItemTypeSwitcherComponent implements OnInit {
|
|
||||||
/**
|
|
||||||
* The item or metadata to determine the component for
|
|
||||||
*/
|
|
||||||
@Input() object: Item | SearchResult<Item>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The preferred view-mode to display
|
|
||||||
*/
|
|
||||||
@Input() viewMode: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The object injector used to inject the item into the child component
|
|
||||||
*/
|
|
||||||
objectInjector: Injector;
|
|
||||||
|
|
||||||
component: any;
|
|
||||||
|
|
||||||
constructor(private injector: Injector) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.objectInjector = Injector.create({
|
|
||||||
providers: [{ provide: ITEM, useFactory: () => this.object, deps:[] }],
|
|
||||||
parent: this.injector
|
|
||||||
});
|
|
||||||
this.component = this.getComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch the component depending on the item's relationship type
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
private getComponent(): string {
|
|
||||||
let item: Item;
|
|
||||||
if (hasValue((this.object as any).indexableObject)) {
|
|
||||||
const searchResult = this.object as ItemSearchResult;
|
|
||||||
item = searchResult.indexableObject;
|
|
||||||
} else {
|
|
||||||
item = this.object as Item;
|
|
||||||
}
|
|
||||||
|
|
||||||
const type = item.firstMetadataValue('relationship.type');
|
|
||||||
return getComponentByItemType(type, this.viewMode);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -0,0 +1 @@
|
|||||||
|
<ng-container dsMetadataRepresentation></ng-container>
|
@@ -0,0 +1,45 @@
|
|||||||
|
import { Component, ComponentFactoryResolver, InjectionToken, Injector, Input, OnInit, ViewChild } from '@angular/core';
|
||||||
|
import { MetadataRepresentation } from '../../core/shared/metadata-representation/metadata-representation.model';
|
||||||
|
import { getMetadataRepresentationComponent } from './metadata-representation.decorator';
|
||||||
|
import { Context } from '../../core/shared/context.model';
|
||||||
|
import { GenericConstructor } from '../../core/shared/generic-constructor';
|
||||||
|
import { MetadataRepresentationListElementComponent } from '../object-list/metadata-representation-list-element/metadata-representation-list-element.component';
|
||||||
|
import { MetadataRepresentationDirective } from './metadata-representation.directive';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-metadata-representation-loader',
|
||||||
|
// styleUrls: ['./metadata-representation-loader.component.scss'],
|
||||||
|
templateUrl: './metadata-representation-loader.component.html'
|
||||||
|
})
|
||||||
|
/**
|
||||||
|
* Component for determining what component to use depending on the item's relationship type (relationship.type)
|
||||||
|
*/
|
||||||
|
export class MetadataRepresentationLoaderComponent implements OnInit {
|
||||||
|
/**
|
||||||
|
* The item or metadata to determine the component for
|
||||||
|
*/
|
||||||
|
@Input() mdRepresentation: MetadataRepresentation;
|
||||||
|
@Input() context: Context;
|
||||||
|
@ViewChild(MetadataRepresentationDirective) mdRepDirective: MetadataRepresentationDirective;
|
||||||
|
|
||||||
|
constructor(private componentFactoryResolver: ComponentFactoryResolver) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.getComponent());
|
||||||
|
|
||||||
|
const viewContainerRef = this.mdRepDirective.viewContainerRef;
|
||||||
|
viewContainerRef.clear();
|
||||||
|
|
||||||
|
const componentRef = viewContainerRef.createComponent(componentFactory);
|
||||||
|
(<MetadataRepresentationListElementComponent>componentRef.instance).metadataRepresentation = this.mdRepresentation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch the component depending on the item's relationship type
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
private getComponent(): GenericConstructor<MetadataRepresentationListElementComponent> {
|
||||||
|
return getMetadataRepresentationComponent(this.mdRepresentation.itemType, this.mdRepresentation.representationType, this.context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { MetadataRepresentationType } from '../../core/shared/metadata-representation/metadata-representation.model';
|
import { MetadataRepresentationType } from '../../core/shared/metadata-representation/metadata-representation.model';
|
||||||
import { hasNoValue, hasValue } from '../empty.util';
|
import { hasNoValue, hasValue } from '../empty.util';
|
||||||
import { Context } from '../../core/shared/context.model';
|
import { Context } from '../../core/shared/context.model';
|
||||||
import { DEFAULT_ITEM_TYPE } from '../items/item-type-decorator';
|
import { DEFAULT_ITEM_TYPE } from '../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
const map = new Map();
|
const map = new Map();
|
||||||
|
|
||||||
@@ -26,19 +26,18 @@ export function metadataRepresentationComponent(entityType: string, mdRepresenta
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getMetadataRepresentationComponent(entityType: string, mdRepresentationType: MetadataRepresentationType, context: Context = DEFAULT_CONTEXT) {
|
export function getMetadataRepresentationComponent(entityType: string, mdRepresentationType: MetadataRepresentationType, context: Context = DEFAULT_CONTEXT) {
|
||||||
if (hasNoValue(entityType) || hasNoValue(map.get(entityType))) {
|
const mapForEntity = map.get(entityType);
|
||||||
entityType = DEFAULT_ITEM_TYPE;
|
if (hasValue(mapForEntity)) {
|
||||||
|
const entityAndMDRepMap = mapForEntity.get(mdRepresentationType);
|
||||||
|
if (hasValue(entityAndMDRepMap)) {
|
||||||
|
if (hasValue(entityAndMDRepMap.get(context))) {
|
||||||
|
return entityAndMDRepMap.get(context);
|
||||||
}
|
}
|
||||||
|
if (hasValue(entityAndMDRepMap.get(DEFAULT_CONTEXT))) {
|
||||||
if (hasNoValue(map.get(entityType).get(mdRepresentationType))) {
|
return entityAndMDRepMap.get(DEFAULT_CONTEXT);
|
||||||
mdRepresentationType = DEFAULT_REPRESENTATION_TYPE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let representationComponent = map.get(entityType).get(mdRepresentationType).get(context);
|
|
||||||
|
|
||||||
if (hasNoValue(representationComponent)) {
|
|
||||||
representationComponent = map.get(entityType).get(mdRepresentationType).get(DEFAULT_REPRESENTATION_TYPE);
|
|
||||||
}
|
}
|
||||||
|
return mapForEntity.get(DEFAULT_REPRESENTATION_TYPE).get(DEFAULT_CONTEXT);
|
||||||
return representationComponent;
|
}
|
||||||
|
return map.get(DEFAULT_ITEM_TYPE).get(DEFAULT_REPRESENTATION_TYPE).get(DEFAULT_CONTEXT);
|
||||||
}
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
import { Directive, ViewContainerRef } from '@angular/core';
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: '[dsMetadataRepresentation]',
|
||||||
|
})
|
||||||
|
export class MetadataRepresentationDirective {
|
||||||
|
constructor(public viewContainerRef: ViewContainerRef) { }
|
||||||
|
}
|
@@ -1,16 +0,0 @@
|
|||||||
import { renderElementsFor } from './dso-element-decorator';
|
|
||||||
import { Item } from '../../../core/shared/item.model';
|
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
|
||||||
|
|
||||||
describe('ElementDecorator', () => {
|
|
||||||
const gridDecorator = renderElementsFor(Item, ViewMode.GridElement);
|
|
||||||
const listDecorator = renderElementsFor(Item, ViewMode.ListElement);
|
|
||||||
it('should have a decorator for both list and grid', () => {
|
|
||||||
expect(listDecorator.length).not.toBeNull();
|
|
||||||
expect(gridDecorator.length).not.toBeNull();
|
|
||||||
});
|
|
||||||
it('should have 2 separate decorators for grid and list', () => {
|
|
||||||
expect(listDecorator).not.toEqual(gridDecorator);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
@@ -1,20 +0,0 @@
|
|||||||
import { GenericConstructor } from '../../../core/shared/generic-constructor';
|
|
||||||
import { ListableObject } from './listable-object.model';
|
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
|
||||||
|
|
||||||
const dsoElementMap = new Map();
|
|
||||||
export function renderElementsFor(listable: GenericConstructor<ListableObject>, viewMode: ViewMode) {
|
|
||||||
return function decorator(objectElement: any) {
|
|
||||||
if (!objectElement) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!dsoElementMap.get(viewMode)) {
|
|
||||||
dsoElementMap.set(viewMode, new Map());
|
|
||||||
}
|
|
||||||
dsoElementMap.get(viewMode).set(listable, objectElement);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function rendersDSOType(listable: GenericConstructor<ListableObject>, viewMode: ViewMode) {
|
|
||||||
return dsoElementMap.get(viewMode).get(listable);
|
|
||||||
}
|
|
@@ -0,0 +1 @@
|
|||||||
|
<ng-container listableObjectComponentLoader></ng-container>
|
@@ -1,4 +1,4 @@
|
|||||||
import { ItemTypeSwitcherComponent } from './item-type-switcher.component';
|
import { ListableObjectComponentLoaderComponent } from './listable-object-component-loader.component';
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
@@ -33,18 +33,18 @@ const mockItemMetadataRepresentation = Object.assign(new ItemMetadataRepresentat
|
|||||||
let viewMode = ViewMode.StandalonePage;
|
let viewMode = ViewMode.StandalonePage;
|
||||||
|
|
||||||
describe('ItemTypeSwitcherComponent', () => {
|
describe('ItemTypeSwitcherComponent', () => {
|
||||||
let comp: ItemTypeSwitcherComponent;
|
let comp: ListableObjectComponentLoaderComponent;
|
||||||
let fixture: ComponentFixture<ItemTypeSwitcherComponent>;
|
let fixture: ComponentFixture<ListableObjectComponentLoaderComponent>;
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
declarations: [ ItemTypeSwitcherComponent ],
|
declarations: [ ListableObjectComponentLoaderComponent ],
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
}).compileComponents(); // compile template and css
|
}).compileComponents(); // compile template and css
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
fixture = TestBed.createComponent(ItemTypeSwitcherComponent);
|
fixture = TestBed.createComponent(ListableObjectComponentLoaderComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
comp.object = mockItem;
|
comp.object = mockItem;
|
||||||
comp.viewMode = viewMode;
|
comp.viewMode = viewMode;
|
@@ -0,0 +1,43 @@
|
|||||||
|
import { Component, InjectionToken, Injector, Input, OnInit } from '@angular/core';
|
||||||
|
import { ListableObject } from '../listable-object.model';
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { Context } from '../../../../core/shared/context.model';
|
||||||
|
import { hasValue } from '../../../empty.util';
|
||||||
|
import { getListableObjectComponent } from './listable-object.decorator';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-listable-object-component-loader',
|
||||||
|
styleUrls: ['./listable-object-component-loader.component.scss'],
|
||||||
|
templateUrl: './listable-object-component-loader.component.html'
|
||||||
|
})
|
||||||
|
/**
|
||||||
|
* Component for determining what component to use depending on the item's relationship type (relationship.type)
|
||||||
|
*/
|
||||||
|
export class ListableObjectComponentLoaderComponent implements OnInit {
|
||||||
|
/**
|
||||||
|
* The item or metadata to determine the component for
|
||||||
|
*/
|
||||||
|
@Input() object: ListableObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The preferred view-mode to display
|
||||||
|
*/
|
||||||
|
@Input() viewMode: ViewMode;
|
||||||
|
|
||||||
|
@Input() context: Context;
|
||||||
|
|
||||||
|
constructor(private injector: Injector) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch the component depending on the item's relationship type
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
private getComponent(): string {
|
||||||
|
return getListableObjectComponent(this.object, this.viewMode);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,16 @@
|
|||||||
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from './listable-object.decorator';
|
||||||
|
|
||||||
|
describe('ElementDecorator', () => {
|
||||||
|
const gridDecorator = listableObjectComponent(Item, ViewMode.GridElement);
|
||||||
|
const listDecorator = listableObjectComponent(Item, ViewMode.ListElement);
|
||||||
|
it('should have a decorator for both list and grid', () => {
|
||||||
|
expect(listDecorator.length).not.toBeNull();
|
||||||
|
expect(gridDecorator.length).not.toBeNull();
|
||||||
|
});
|
||||||
|
it('should have 2 separate decorators for grid and list', () => {
|
||||||
|
expect(listDecorator).not.toEqual(gridDecorator);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@@ -0,0 +1,50 @@
|
|||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { GenericConstructor } from '../../../../core/shared/generic-constructor';
|
||||||
|
import { ListableObject } from '../listable-object.model';
|
||||||
|
import { Context } from '../../../../core/shared/context.model';
|
||||||
|
import { hasNoValue, hasValue } from '../../../empty.util';
|
||||||
|
import { DEFAULT_CONTEXT } from '../../../metadata-representation/metadata-representation.decorator';
|
||||||
|
|
||||||
|
export const DEFAULT_ITEM_TYPE = 'Default';
|
||||||
|
export const DEFAULT_VIEW_MODE = ViewMode.ListElement;
|
||||||
|
|
||||||
|
|
||||||
|
const listElementMap = new Map();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decorator used for rendering simple item pages by type and viewMode (and optionally a representationType)
|
||||||
|
* @param type
|
||||||
|
* @param viewMode
|
||||||
|
*/
|
||||||
|
export function listableObjectComponent(objectType: GenericConstructor<ListableObject> | string, viewMode: ViewMode, context: Context = DEFAULT_CONTEXT) {
|
||||||
|
return function decorator(component: any) {
|
||||||
|
if (hasNoValue(objectType)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (hasNoValue(listElementMap.get(objectType))) {
|
||||||
|
listElementMap.set(objectType, new Map());
|
||||||
|
}
|
||||||
|
if (hasNoValue(listElementMap.get(objectType).get(viewMode))) {
|
||||||
|
listElementMap.get(objectType).set(viewMode, new Map());
|
||||||
|
}
|
||||||
|
listElementMap.get(objectType).get(viewMode).set(context, component);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function getListableObjectComponent(entityType: GenericConstructor<ListableObject> | string, viewMode: ViewMode, context: Context = DEFAULT_CONTEXT) {
|
||||||
|
const mapForType = listElementMap.get(entityType);
|
||||||
|
if (hasValue(mapForType)) {
|
||||||
|
const typeAndMDRepMap = mapForType.get(viewMode);
|
||||||
|
if (hasValue(typeAndMDRepMap)) {
|
||||||
|
if (hasValue(typeAndMDRepMap.get(context))) {
|
||||||
|
return typeAndMDRepMap.get(context);
|
||||||
|
}
|
||||||
|
if (hasValue(typeAndMDRepMap.get(DEFAULT_CONTEXT))) {
|
||||||
|
return typeAndMDRepMap.get(DEFAULT_CONTEXT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mapForType.get(DEFAULT_VIEW_MODE).get(DEFAULT_CONTEXT);
|
||||||
|
}
|
||||||
|
return listElementMap.get(DEFAULT_ITEM_TYPE).get(DEFAULT_VIEW_MODE).get(DEFAULT_CONTEXT);
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
import { Directive, ViewContainerRef } from '@angular/core';
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: '[dsListableObject]',
|
||||||
|
})
|
||||||
|
export class ListableObjectDirective {
|
||||||
|
constructor(public viewContainerRef: ViewContainerRef) { }
|
||||||
|
}
|
@@ -3,7 +3,6 @@ import { Component, Inject } from '@angular/core';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { find } from 'rxjs/operators';
|
import { find } from 'rxjs/operators';
|
||||||
|
|
||||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
import { isNotUndefined } from '../../../empty.util';
|
import { isNotUndefined } from '../../../empty.util';
|
||||||
@@ -13,6 +12,7 @@ import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.m
|
|||||||
import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/claimed-task-my-dspace-result.model';
|
import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/claimed-task-my-dspace-result.model';
|
||||||
import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component';
|
import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component';
|
||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders claimed task object for the mydspace result in the detail view.
|
* This component renders claimed task object for the mydspace result in the detail view.
|
||||||
@@ -23,8 +23,8 @@ import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspa
|
|||||||
templateUrl: './claimed-my-dspace-result-detail-element.component.html'
|
templateUrl: './claimed-my-dspace-result-detail-element.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(ClaimedTaskMyDSpaceResult, ViewMode.DetailedListElement)
|
@listableObjectComponent(ClaimedTaskMyDSpaceResult, ViewMode.DetailedListElement)
|
||||||
@renderElementsFor(ClaimedTask, ViewMode.DetailedListElement)
|
@listableObjectComponent(ClaimedTask, ViewMode.DetailedListElement)
|
||||||
export class ClaimedMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent<ClaimedTaskMyDSpaceResult, ClaimedTask> {
|
export class ClaimedMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent<ClaimedTaskMyDSpaceResult, ClaimedTask> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { ItemMyDSpaceResult } from '../../../object-collection/shared/item-my-dspace-result.model';
|
import { ItemMyDSpaceResult } from '../../../object-collection/shared/item-my-dspace-result.model';
|
||||||
import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component';
|
import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component';
|
||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders item object for the mydspace result in the detail view.
|
* This component renders item object for the mydspace result in the detail view.
|
||||||
@@ -16,7 +16,7 @@ import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspa
|
|||||||
templateUrl: './item-my-dspace-result-detail-element.component.html'
|
templateUrl: './item-my-dspace-result-detail-element.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(ItemMyDSpaceResult, ViewMode.DetailedListElement)
|
@listableObjectComponent(ItemMyDSpaceResult, ViewMode.DetailedListElement)
|
||||||
export class ItemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent<ItemMyDSpaceResult, Item> {
|
export class ItemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent<ItemMyDSpaceResult, Item> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2,7 +2,6 @@ import { Component, Inject } from '@angular/core';
|
|||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { find } from 'rxjs/operators';
|
import { find } from 'rxjs/operators';
|
||||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { isNotUndefined } from '../../../empty.util';
|
import { isNotUndefined } from '../../../empty.util';
|
||||||
import { ListableObject } from '../../../object-collection/shared/listable-object.model';
|
import { ListableObject } from '../../../object-collection/shared/listable-object.model';
|
||||||
@@ -12,6 +11,7 @@ import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail
|
|||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders pool task object for the mydspace result in the detail view.
|
* This component renders pool task object for the mydspace result in the detail view.
|
||||||
@@ -22,8 +22,8 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
|
|||||||
templateUrl: './pool-my-dspace-result-detail-element.component.html',
|
templateUrl: './pool-my-dspace-result-detail-element.component.html',
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(PoolTaskMyDSpaceResult, ViewMode.DetailedListElement)
|
@listableObjectComponent(PoolTaskMyDSpaceResult, ViewMode.DetailedListElement)
|
||||||
@renderElementsFor(PoolTask, ViewMode.DetailedListElement)
|
@listableObjectComponent(PoolTask, ViewMode.DetailedListElement)
|
||||||
export class PoolMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent<PoolTaskMyDSpaceResult, PoolTask> {
|
export class PoolMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent<PoolTaskMyDSpaceResult, PoolTask> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
|
|
||||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { ListableObject } from '../../../object-collection/shared/listable-object.model';
|
import { ListableObject } from '../../../object-collection/shared/listable-object.model';
|
||||||
@@ -12,6 +11,7 @@ import { Observable } from 'rxjs/internal/Observable';
|
|||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { find } from 'rxjs/operators';
|
import { find } from 'rxjs/operators';
|
||||||
import { isNotUndefined } from '../../../empty.util';
|
import { isNotUndefined } from '../../../empty.util';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders workflowitem object for the mydspace result in the detail view.
|
* This component renders workflowitem object for the mydspace result in the detail view.
|
||||||
@@ -22,8 +22,8 @@ import { isNotUndefined } from '../../../empty.util';
|
|||||||
templateUrl: './workflowitem-my-dspace-result-detail-element.component.html',
|
templateUrl: './workflowitem-my-dspace-result-detail-element.component.html',
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(WorkflowitemMyDSpaceResult, ViewMode.DetailedListElement)
|
@listableObjectComponent(WorkflowitemMyDSpaceResult, ViewMode.DetailedListElement)
|
||||||
@renderElementsFor(WorkflowItem, ViewMode.DetailedListElement)
|
@listableObjectComponent(WorkflowItem, ViewMode.DetailedListElement)
|
||||||
export class WorkflowitemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent<WorkflowitemMyDSpaceResult, WorkflowItem> {
|
export class WorkflowitemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent<WorkflowitemMyDSpaceResult, WorkflowItem> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -3,7 +3,6 @@ import { Component, Inject } from '@angular/core';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { find } from 'rxjs/operators';
|
import { find } from 'rxjs/operators';
|
||||||
|
|
||||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
import {
|
import {
|
||||||
WorkspaceItem
|
WorkspaceItem
|
||||||
} from '../../../../core/submission/models/workspaceitem.model';
|
} from '../../../../core/submission/models/workspaceitem.model';
|
||||||
@@ -15,6 +14,7 @@ import { ListableObject } from '../../../object-collection/shared/listable-objec
|
|||||||
import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component';
|
import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component';
|
||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders workspaceitem object for the mydspace result in the detail view.
|
* This component renders workspaceitem object for the mydspace result in the detail view.
|
||||||
@@ -25,8 +25,8 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
|
|||||||
templateUrl: './workspaceitem-my-dspace-result-detail-element.component.html',
|
templateUrl: './workspaceitem-my-dspace-result-detail-element.component.html',
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(WorkspaceitemMyDSpaceResult, ViewMode.DetailedListElement)
|
@listableObjectComponent(WorkspaceitemMyDSpaceResult, ViewMode.DetailedListElement)
|
||||||
@renderElementsFor(WorkspaceItem, ViewMode.DetailedListElement)
|
@listableObjectComponent(WorkspaceItem, ViewMode.DetailedListElement)
|
||||||
export class WorkspaceitemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent<WorkspaceitemMyDSpaceResult, WorkspaceItem> {
|
export class WorkspaceitemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent<WorkspaceitemMyDSpaceResult, WorkspaceItem> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
<ng-container *ngComponentOutlet="detailElement; injector: objectInjector;"></ng-container>
|
|
@@ -1,2 +0,0 @@
|
|||||||
@import '../../../../styles/variables';
|
|
||||||
|
|
@@ -1,44 +0,0 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
||||||
import { By } from '@angular/platform-browser';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
|
||||||
|
|
||||||
import { of as observableOf } from 'rxjs';
|
|
||||||
|
|
||||||
import { RouterStub } from '../../testing/router-stub';
|
|
||||||
import { WrapperDetailElementComponent } from './wrapper-detail-element.component';
|
|
||||||
|
|
||||||
let wrapperDetailElementComponent: WrapperDetailElementComponent;
|
|
||||||
let fixture: ComponentFixture<WrapperDetailElementComponent>;
|
|
||||||
const queryParam = 'test query';
|
|
||||||
const scopeParam = '7669c72a-3f2a-451f-a3b9-9210e7a4c02f';
|
|
||||||
const activatedRouteStub = {
|
|
||||||
queryParams: observableOf({
|
|
||||||
query: queryParam,
|
|
||||||
scope: scopeParam
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
describe('WrapperDetailElementComponent', () => {
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ WrapperDetailElementComponent ],
|
|
||||||
providers: [
|
|
||||||
{ provide: ActivatedRoute, useValue: activatedRouteStub },
|
|
||||||
{ provide: Router, useClass: RouterStub },
|
|
||||||
{ provide: 'objectElementProvider', useFactory: (WrapperDetailElementComponent)}
|
|
||||||
],
|
|
||||||
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
|
||||||
}).compileComponents(); // compile template and css
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
fixture = TestBed.createComponent(WrapperDetailElementComponent);
|
|
||||||
wrapperDetailElementComponent = fixture.componentInstance;
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should show the wrapper element containing the detail object',() => {
|
|
||||||
expect(fixture.debugElement.query(By.css('ds-workspaceitem-my-dspace-result-detail-element'))).toBeDefined();
|
|
||||||
})
|
|
||||||
});
|
|
@@ -1,56 +0,0 @@
|
|||||||
import { Component, Injector, Input, OnInit } from '@angular/core';
|
|
||||||
|
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
|
||||||
import { GenericConstructor } from '../../../core/shared/generic-constructor';
|
|
||||||
import { rendersDSOType } from '../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { ListableObject } from '../../object-collection/shared/listable-object.model';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This component renders a wrapper for an object in the detail view.
|
|
||||||
*/
|
|
||||||
@Component({
|
|
||||||
selector: 'ds-wrapper-detail-element',
|
|
||||||
styleUrls: ['./wrapper-detail-element.component.scss'],
|
|
||||||
templateUrl: './wrapper-detail-element.component.html'
|
|
||||||
})
|
|
||||||
export class WrapperDetailElementComponent implements OnInit {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The listable object.
|
|
||||||
*/
|
|
||||||
@Input() object: ListableObject;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The instance of the injector.
|
|
||||||
*/
|
|
||||||
objectInjector: Injector;
|
|
||||||
|
|
||||||
detailElement: any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize instance variables
|
|
||||||
*
|
|
||||||
* @param {Injector} injector
|
|
||||||
*/
|
|
||||||
constructor(private injector: Injector) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize injector
|
|
||||||
*/
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.objectInjector = Injector.create({
|
|
||||||
providers: [{ provide: 'objectElementProvider', useFactory: () => (this.object), deps:[] }],
|
|
||||||
parent: this.injector
|
|
||||||
});
|
|
||||||
this.detailElement = this.getDetailElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return class name for the object to inject
|
|
||||||
*/
|
|
||||||
private getDetailElement(): string {
|
|
||||||
const f: GenericConstructor<ListableObject> = this.object.constructor as GenericConstructor<ListableObject>;
|
|
||||||
return rendersDSOType(f, ViewMode.DetailedListElement);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,9 +1,9 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
|
|
||||||
import { Collection } from '../../../core/shared/collection.model';
|
import { Collection } from '../../../core/shared/collection.model';
|
||||||
import { renderElementsFor} from '../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-collection-grid-element',
|
selector: 'ds-collection-grid-element',
|
||||||
@@ -11,5 +11,5 @@ import { ViewMode } from '../../../core/shared/view-mode.model';
|
|||||||
templateUrl: './collection-grid-element.component.html'
|
templateUrl: './collection-grid-element.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(Collection, ViewMode.GridElement)
|
@listableObjectComponent(Collection, ViewMode.GridElement)
|
||||||
export class CollectionGridElementComponent extends AbstractListableElementComponent<Collection> {}
|
export class CollectionGridElementComponent extends AbstractListableElementComponent<Collection> {}
|
||||||
|
@@ -2,8 +2,8 @@ import { Component } from '@angular/core';
|
|||||||
|
|
||||||
import { Community } from '../../../core/shared/community.model';
|
import { Community } from '../../../core/shared/community.model';
|
||||||
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||||
import { renderElementsFor } from '../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-community-grid-element',
|
selector: 'ds-community-grid-element',
|
||||||
@@ -11,5 +11,5 @@ import { ViewMode } from '../../../core/shared/view-mode.model';
|
|||||||
templateUrl: './community-grid-element.component.html'
|
templateUrl: './community-grid-element.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(Community, ViewMode.GridElement)
|
@listableObjectComponent(Community, ViewMode.GridElement)
|
||||||
export class CommunityGridElementComponent extends AbstractListableElementComponent<Community> {}
|
export class CommunityGridElementComponent extends AbstractListableElementComponent<Community> {}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { Component, Input, Inject } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import { renderElementsFor} from '../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-item-grid-element',
|
selector: 'ds-item-grid-element',
|
||||||
@@ -11,5 +11,5 @@ import { ViewMode } from '../../../core/shared/view-mode.model';
|
|||||||
templateUrl: './item-grid-element.component.html'
|
templateUrl: './item-grid-element.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(Item, ViewMode.GridElement)
|
@listableObjectComponent(Item, ViewMode.GridElement)
|
||||||
export class ItemGridElementComponent extends AbstractListableElementComponent<Item> {}
|
export class ItemGridElementComponent extends AbstractListableElementComponent<Item> {}
|
||||||
|
@@ -8,7 +8,7 @@ import { PublicationGridElementComponent } from './publication-grid-element.comp
|
|||||||
import { of as observableOf } from 'rxjs/internal/observable/of';
|
import { of as observableOf } from 'rxjs/internal/observable/of';
|
||||||
import { ItemSearchResult } from '../../../../object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../../object-collection/shared/item-search-result.model';
|
||||||
import { Item } from '../../../../../core/shared/item.model';
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
import { ITEM } from '../../../../items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../../items/switcher/listable-object-component-loader.component';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../testing/utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../../testing/utils';
|
||||||
import { PaginatedList } from '../../../../../core/data/paginated-list';
|
import { PaginatedList } from '../../../../../core/data/paginated-list';
|
||||||
import { PageInfo } from '../../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../../core/shared/page-info.model';
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { TypedItemSearchResultGridElementComponent } from '../typed-item-search-result-grid-element.component';
|
import { TypedItemSearchResultGridElementComponent } from '../typed-item-search-result-grid-element.component';
|
||||||
import { DEFAULT_ITEM_TYPE, rendersItemType } from '../../../../items/item-type-decorator';
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { focusShadow } from '../../../../animations/focus';
|
import { focusShadow } from '../../../../animations/focus';
|
||||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||||
|
import { DEFAULT_ITEM_TYPE, listableObjectComponent } from '../../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('Publication', ViewMode.GridElement)
|
@listableObjectComponent('Publication', ViewMode.GridElement)
|
||||||
@rendersItemType(DEFAULT_ITEM_TYPE, ViewMode.GridElement)
|
@listableObjectComponent(DEFAULT_ITEM_TYPE, ViewMode.GridElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-publication-grid-element',
|
selector: 'ds-publication-grid-element',
|
||||||
styleUrls: ['./publication-grid-element.component.scss'],
|
styleUrls: ['./publication-grid-element.component.scss'],
|
||||||
|
@@ -6,7 +6,7 @@ import { Item } from '../../../../core/shared/item.model';
|
|||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { PaginatedList } from '../../../../core/data/paginated-list';
|
import { PaginatedList } from '../../../../core/data/paginated-list';
|
||||||
import { PageInfo } from '../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||||
import { ITEM } from '../../../items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../items/switcher/listable-object-component-loader.component';
|
||||||
import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model';
|
||||||
import { createRelationshipsObservable } from '../../../../+item-page/simple/item-types/shared/item.component.spec';
|
import { createRelationshipsObservable } from '../../../../+item-page/simple/item-types/shared/item.component.spec';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
|
@@ -3,7 +3,7 @@ import { Item } from '../../../../core/shared/item.model';
|
|||||||
import { SearchResultGridElementComponent } from '../../search-result-grid-element/search-result-grid-element.component';
|
import { SearchResultGridElementComponent } from '../../search-result-grid-element/search-result-grid-element.component';
|
||||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { ITEM } from '../../../items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../items/switcher/listable-object-component-loader.component';
|
||||||
import { hasValue } from '../../../empty.util';
|
import { hasValue } from '../../../empty.util';
|
||||||
import { MetadataMap } from '../../../../core/shared/metadata.models';
|
import { MetadataMap } from '../../../../core/shared/metadata.models';
|
||||||
|
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { renderElementsFor} from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { SearchResultGridElementComponent } from '../search-result-grid-element.component';
|
import { SearchResultGridElementComponent } from '../search-result-grid-element.component';
|
||||||
import { Collection } from '../../../../core/shared/collection.model';
|
import { Collection } from '../../../../core/shared/collection.model';
|
||||||
import { CollectionSearchResult } from '../../../object-collection/shared/collection-search-result.model';
|
import { CollectionSearchResult } from '../../../object-collection/shared/collection-search-result.model';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-collection-search-result-grid-element',
|
selector: 'ds-collection-search-result-grid-element',
|
||||||
@@ -12,5 +12,5 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
|
|||||||
templateUrl: 'collection-search-result-grid-element.component.html'
|
templateUrl: 'collection-search-result-grid-element.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(CollectionSearchResult, ViewMode.GridElement)
|
@listableObjectComponent(CollectionSearchResult, ViewMode.GridElement)
|
||||||
export class CollectionSearchResultGridElementComponent extends SearchResultGridElementComponent<CollectionSearchResult, Collection> {}
|
export class CollectionSearchResultGridElementComponent extends SearchResultGridElementComponent<CollectionSearchResult, Collection> {}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Community } from '../../../../core/shared/community.model';
|
import { Community } from '../../../../core/shared/community.model';
|
||||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { SearchResultGridElementComponent } from '../search-result-grid-element.component';
|
import { SearchResultGridElementComponent } from '../search-result-grid-element.component';
|
||||||
import { CommunitySearchResult } from '../../../object-collection/shared/community-search-result.model';
|
import { CommunitySearchResult } from '../../../object-collection/shared/community-search-result.model';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-community-search-result-grid-element',
|
selector: 'ds-community-search-result-grid-element',
|
||||||
@@ -11,7 +11,7 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
|
|||||||
templateUrl: 'community-search-result-grid-element.component.html'
|
templateUrl: 'community-search-result-grid-element.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(CommunitySearchResult, ViewMode.GridElement)
|
@listableObjectComponent(CommunitySearchResult, ViewMode.GridElement)
|
||||||
export class CommunitySearchResultGridElementComponent extends SearchResultGridElementComponent<CommunitySearchResult, Community> {
|
export class CommunitySearchResultGridElementComponent extends SearchResultGridElementComponent<CommunitySearchResult, Community> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { SearchResultGridElementComponent } from '../search-result-grid-element.component';
|
import { SearchResultGridElementComponent } from '../search-result-grid-element.component';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model';
|
||||||
import { focusShadow } from '../../../animations/focus';
|
import { focusShadow } from '../../../animations/focus';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-item-search-result-grid-element',
|
selector: 'ds-item-search-result-grid-element',
|
||||||
@@ -14,7 +14,7 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
|
|||||||
animations: [focusShadow],
|
animations: [focusShadow],
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(ItemSearchResult, ViewMode.GridElement)
|
@listableObjectComponent(ItemSearchResult, ViewMode.GridElement)
|
||||||
export class ItemSearchResultGridElementComponent extends SearchResultGridElementComponent<ItemSearchResult, Item> {
|
export class ItemSearchResultGridElementComponent extends SearchResultGridElementComponent<ItemSearchResult, Item> {
|
||||||
viewMode = ViewMode.GridElement;
|
viewMode = ViewMode.GridElement;
|
||||||
}
|
}
|
@@ -1 +0,0 @@
|
|||||||
<ng-container *ngComponentOutlet="gridElement; injector: objectInjector;"></ng-container>
|
|
@@ -1 +0,0 @@
|
|||||||
|
|
@@ -1,43 +0,0 @@
|
|||||||
import { WrapperGridElementComponent } from './wrapper-grid-element.component';
|
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
import { of as observableOf } from 'rxjs';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
|
||||||
import { RouterStub } from '../../testing/router-stub';
|
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
||||||
import { By } from '@angular/platform-browser';
|
|
||||||
|
|
||||||
let wrapperGridElementComponent: WrapperGridElementComponent;
|
|
||||||
let fixture: ComponentFixture<WrapperGridElementComponent>;
|
|
||||||
const queryParam = 'test query';
|
|
||||||
const scopeParam = '7669c72a-3f2a-451f-a3b9-9210e7a4c02f';
|
|
||||||
const activatedRouteStub = {
|
|
||||||
queryParams: observableOf({
|
|
||||||
query: queryParam,
|
|
||||||
scope: scopeParam
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
describe('WrapperGridElementComponent', () => {
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ WrapperGridElementComponent ],
|
|
||||||
providers: [
|
|
||||||
{ provide: ActivatedRoute, useValue: activatedRouteStub },
|
|
||||||
{ provide: Router, useClass: RouterStub },
|
|
||||||
{ provide: 'objectElementProvider', useFactory: (wrapperGridElementComponent)}
|
|
||||||
],
|
|
||||||
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
|
||||||
}).compileComponents(); // compile template and css
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
fixture = TestBed.createComponent(WrapperGridElementComponent);
|
|
||||||
wrapperGridElementComponent = fixture.componentInstance;
|
|
||||||
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should show the wrapper element containing the cards',() => {
|
|
||||||
expect(fixture.debugElement.query(By.css('ds-collection-grid-element'))).toBeDefined();
|
|
||||||
})
|
|
||||||
})
|
|
@@ -1,32 +0,0 @@
|
|||||||
import { Component, Injector, Input, OnInit } from '@angular/core';
|
|
||||||
import { GenericConstructor } from '../../../core/shared/generic-constructor';
|
|
||||||
import { rendersDSOType } from '../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { ListableObject } from '../../object-collection/shared/listable-object.model';
|
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'ds-wrapper-grid-element',
|
|
||||||
styleUrls: ['./wrapper-grid-element.component.scss'],
|
|
||||||
templateUrl: './wrapper-grid-element.component.html'
|
|
||||||
})
|
|
||||||
export class WrapperGridElementComponent implements OnInit {
|
|
||||||
@Input() object: ListableObject;
|
|
||||||
objectInjector: Injector;
|
|
||||||
gridElement: any;
|
|
||||||
|
|
||||||
constructor(private injector: Injector) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.objectInjector = Injector.create({
|
|
||||||
providers: [{ provide: 'objectElementProvider', useFactory: () => (this.object), deps:[] }],
|
|
||||||
parent: this.injector
|
|
||||||
});
|
|
||||||
this.gridElement = this.getGridElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
getGridElement(): string {
|
|
||||||
const f: GenericConstructor<ListableObject> = this.object.constructor as GenericConstructor<ListableObject>;
|
|
||||||
return rendersDSOType(f, ViewMode.GridElement);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,9 +1,9 @@
|
|||||||
import { Component, Input, Inject } from '@angular/core';
|
import { Component, Input, Inject } from '@angular/core';
|
||||||
|
|
||||||
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||||
import { renderElementsFor } from '../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { BrowseEntry } from '../../../core/shared/browse-entry.model';
|
import { BrowseEntry } from '../../../core/shared/browse-entry.model';
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-browse-entry-list-element',
|
selector: 'ds-browse-entry-list-element',
|
||||||
@@ -14,5 +14,5 @@ import { ViewMode } from '../../../core/shared/view-mode.model';
|
|||||||
/**
|
/**
|
||||||
* This component is automatically used to create a list view for BrowseEntry objects when used in ObjectCollectionComponent
|
* This component is automatically used to create a list view for BrowseEntry objects when used in ObjectCollectionComponent
|
||||||
*/
|
*/
|
||||||
@renderElementsFor(BrowseEntry, ViewMode.ListElement)
|
@listableObjectComponent(BrowseEntry, ViewMode.ListElement)
|
||||||
export class BrowseEntryListElementComponent extends AbstractListableElementComponent<BrowseEntry> {}
|
export class BrowseEntryListElementComponent extends AbstractListableElementComponent<BrowseEntry> {}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
|
|
||||||
import { Collection } from '../../../core/shared/collection.model';
|
import { Collection } from '../../../core/shared/collection.model';
|
||||||
import { renderElementsFor } from '../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-collection-list-element',
|
selector: 'ds-collection-list-element',
|
||||||
@@ -11,5 +11,5 @@ import { ViewMode } from '../../../core/shared/view-mode.model';
|
|||||||
templateUrl: './collection-list-element.component.html'
|
templateUrl: './collection-list-element.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(Collection, ViewMode.ListElement)
|
@listableObjectComponent(Collection, ViewMode.ListElement)
|
||||||
export class CollectionListElementComponent extends AbstractListableElementComponent<Collection> {}
|
export class CollectionListElementComponent extends AbstractListableElementComponent<Collection> {}
|
||||||
|
@@ -2,8 +2,8 @@ import { Component, Input, Inject } from '@angular/core';
|
|||||||
|
|
||||||
import { Community } from '../../../core/shared/community.model';
|
import { Community } from '../../../core/shared/community.model';
|
||||||
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||||
import { renderElementsFor } from '../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-community-list-element',
|
selector: 'ds-community-list-element',
|
||||||
@@ -11,5 +11,5 @@ import { ViewMode } from '../../../core/shared/view-mode.model';
|
|||||||
templateUrl: './community-list-element.component.html'
|
templateUrl: './community-list-element.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(Community, ViewMode.ListElement)
|
@listableObjectComponent(Community, ViewMode.ListElement)
|
||||||
export class CommunityListElementComponent extends AbstractListableElementComponent<Community> {}
|
export class CommunityListElementComponent extends AbstractListableElementComponent<Community> {}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import { renderElementsFor } from '../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-item-list-element',
|
selector: 'ds-item-list-element',
|
||||||
@@ -15,7 +15,7 @@ import { ViewMode } from '../../../core/shared/view-mode.model';
|
|||||||
* The component used to list items depending on type
|
* The component used to list items depending on type
|
||||||
* Uses item-type-switcher to determine which components to use for displaying the list
|
* Uses item-type-switcher to determine which components to use for displaying the list
|
||||||
*/
|
*/
|
||||||
@renderElementsFor(Item, ViewMode.ListElement)
|
@listableObjectComponent(Item, ViewMode.ListElement)
|
||||||
export class ItemListElementComponent extends AbstractListableElementComponent<Item> {
|
export class ItemListElementComponent extends AbstractListableElementComponent<Item> {
|
||||||
viewMode = ViewMode.ListElement;
|
viewMode = ViewMode.ListElement;
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@ import { PublicationListElementComponent } from './publication-list-element.comp
|
|||||||
import { Item } from '../../../../../core/shared/item.model';
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
import { TruncatePipe } from '../../../../utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../utils/truncate.pipe';
|
||||||
import { TruncatableService } from '../../../../truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../truncatable/truncatable.service';
|
||||||
import { ITEM } from '../../../../items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../../items/switcher/listable-object-component-loader.component';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
|
|
||||||
let publicationListElementComponent: PublicationListElementComponent;
|
let publicationListElementComponent: PublicationListElementComponent;
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { DEFAULT_ITEM_TYPE, rendersItemType } from '../../../../items/item-type-decorator';
|
|
||||||
import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component';
|
import { TypedItemSearchResultListElementComponent } from '../typed-item-search-result-list-element.component';
|
||||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||||
|
import { DEFAULT_ITEM_TYPE, listableObjectComponent } from '../../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType('Publication', ViewMode.ListElement)
|
@listableObjectComponent('Publication', ViewMode.ListElement)
|
||||||
@rendersItemType(DEFAULT_ITEM_TYPE, ViewMode.ListElement)
|
@listableObjectComponent(DEFAULT_ITEM_TYPE, ViewMode.ListElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-publication-list-element',
|
selector: 'ds-publication-list-element',
|
||||||
styleUrls: ['./publication-list-element.component.scss'],
|
styleUrls: ['./publication-list-element.component.scss'],
|
||||||
|
@@ -7,7 +7,7 @@ import { Item } from '../../../../core/shared/item.model';
|
|||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { PaginatedList } from '../../../../core/data/paginated-list';
|
import { PaginatedList } from '../../../../core/data/paginated-list';
|
||||||
import { PageInfo } from '../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||||
import { ITEM } from '../../../items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../items/switcher/listable-object-component-loader.component';
|
||||||
import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model';
|
||||||
import { createRelationshipsObservable } from '../../../../+item-page/simple/item-types/shared/item.component.spec';
|
import { createRelationshipsObservable } from '../../../../+item-page/simple/item-types/shared/item.component.spec';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { hasValue } from '../../../empty.util';
|
import { hasValue } from '../../../empty.util';
|
||||||
import { ITEM } from '../../../items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../items/switcher/listable-object-component-loader.component';
|
||||||
import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model';
|
||||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||||
import { SearchResultListElementComponent } from '../../search-result-list-element/search-result-list-element.component';
|
import { SearchResultListElementComponent } from '../../search-result-list-element/search-result-list-element.component';
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { ITEM } from '../../../items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../items/switcher/listable-object-component-loader.component';
|
||||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { ItemMetadataListElementComponent } from './item-metadata-list-element.component';
|
import { ItemMetadataListElementComponent } from './item-metadata-list-element.component';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
import { MetadataRepresentationType } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
import { MetadataRepresentationType } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { MetadataRepresentationListElementComponent } from '../metadata-representation-list-element.component';
|
import { MetadataRepresentationListElementComponent } from '../metadata-representation-list-element.component';
|
||||||
import { DEFAULT_ITEM_TYPE, rendersItemType } from '../../../items/item-type-decorator';
|
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { metadataRepresentationComponent } from '../../../metadata-representation/metadata-representation.decorator';
|
||||||
|
import { DEFAULT_ITEM_TYPE } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType(DEFAULT_ITEM_TYPE, ViewMode.MetadataField, MetadataRepresentationType.Item)
|
@metadataRepresentationComponent(DEFAULT_ITEM_TYPE, MetadataRepresentationType.Item)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-item-metadata-list-element',
|
selector: 'ds-item-metadata-list-element',
|
||||||
templateUrl: './item-metadata-list-element.component.html'
|
templateUrl: './item-metadata-list-element.component.html'
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { MetadataRepresentation } from '../../../core/shared/metadata-representation/metadata-representation.model';
|
import { MetadataRepresentation } from '../../../core/shared/metadata-representation/metadata-representation.model';
|
||||||
import { ITEM } from '../../items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../items/switcher/listable-object-component-loader.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-metadata-representation-list-element',
|
selector: 'ds-metadata-representation-list-element',
|
||||||
@@ -10,6 +10,8 @@ import { ITEM } from '../../items/switcher/item-type-switcher.component';
|
|||||||
* An abstract class for displaying a single MetadataRepresentation
|
* An abstract class for displaying a single MetadataRepresentation
|
||||||
*/
|
*/
|
||||||
export class MetadataRepresentationListElementComponent {
|
export class MetadataRepresentationListElementComponent {
|
||||||
constructor(@Inject(ITEM) public metadataRepresentation: MetadataRepresentation) {
|
metadataRepresentation: MetadataRepresentation;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|||||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { PlainTextMetadataListElementComponent } from './plain-text-metadata-list-element.component';
|
import { PlainTextMetadataListElementComponent } from './plain-text-metadata-list-element.component';
|
||||||
import { MetadatumRepresentation } from '../../../../core/shared/metadata-representation/metadatum/metadatum-representation.model';
|
import { MetadatumRepresentation } from '../../../../core/shared/metadata-representation/metadatum/metadatum-representation.model';
|
||||||
import { ITEM } from '../../../items/switcher/item-type-switcher.component';
|
import { ITEM } from '../../../items/switcher/listable-object-component-loader.component';
|
||||||
|
|
||||||
const mockMetadataRepresentation = Object.assign(new MetadatumRepresentation('type'), {
|
const mockMetadataRepresentation = Object.assign(new MetadatumRepresentation('type'), {
|
||||||
key: 'dc.contributor.author',
|
key: 'dc.contributor.author',
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
import { MetadataRepresentationType } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
import { MetadataRepresentationType } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { MetadataRepresentationListElementComponent } from '../metadata-representation-list-element.component';
|
import { MetadataRepresentationListElementComponent } from '../metadata-representation-list-element.component';
|
||||||
import { DEFAULT_ITEM_TYPE, rendersItemType } from '../../../items/item-type-decorator';
|
import { metadataRepresentationComponent } from '../../../metadata-representation/metadata-representation.decorator';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { DEFAULT_ITEM_TYPE } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@rendersItemType(DEFAULT_ITEM_TYPE, ViewMode.MetadataField, MetadataRepresentationType.PlainText)
|
@metadataRepresentationComponent(DEFAULT_ITEM_TYPE, MetadataRepresentationType.PlainText)
|
||||||
// For now, authority controlled fields are rendered the same way as plain text fields
|
// For now, authority controlled fields are rendered the same way as plain text fields
|
||||||
@rendersItemType(DEFAULT_ITEM_TYPE, ViewMode.MetadataField, MetadataRepresentationType.AuthorityControlled)
|
@metadataRepresentationComponent(DEFAULT_ITEM_TYPE, MetadataRepresentationType.AuthorityControlled)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-plain-text-metadata-list-element',
|
selector: 'ds-plain-text-metadata-list-element',
|
||||||
templateUrl: './plain-text-metadata-list-element.component.html'
|
templateUrl: './plain-text-metadata-list-element.component.html'
|
||||||
|
@@ -4,7 +4,6 @@ import { Location, LocationStrategy, PathLocationStrategy } from '@angular/commo
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { find } from 'rxjs/operators';
|
import { find } from 'rxjs/operators';
|
||||||
|
|
||||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
|
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
@@ -13,6 +12,7 @@ import { WorkflowItem } from '../../../../core/submission/models/workflowitem.mo
|
|||||||
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
|
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
|
||||||
import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/claimed-task-my-dspace-result.model';
|
import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/claimed-task-my-dspace-result.model';
|
||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders claimed task object for the mydspace result in the list view.
|
* This component renders claimed task object for the mydspace result in the list view.
|
||||||
@@ -24,8 +24,8 @@ import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspa
|
|||||||
providers: [Location, { provide: LocationStrategy, useClass: PathLocationStrategy }]
|
providers: [Location, { provide: LocationStrategy, useClass: PathLocationStrategy }]
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(ClaimedTaskMyDSpaceResult, ViewMode.ListElement)
|
@listableObjectComponent(ClaimedTaskMyDSpaceResult, ViewMode.ListElement)
|
||||||
@renderElementsFor(ClaimedTask, ViewMode.ListElement)
|
@listableObjectComponent(ClaimedTask, ViewMode.ListElement)
|
||||||
export class ClaimedMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent<ClaimedTaskMyDSpaceResult, ClaimedTask> {
|
export class ClaimedMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent<ClaimedTaskMyDSpaceResult, ClaimedTask> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
|
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { ItemMyDSpaceResult } from '../../../object-collection/shared/item-my-dspace-result.model';
|
import { ItemMyDSpaceResult } from '../../../object-collection/shared/item-my-dspace-result.model';
|
||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders item object for the mydspace result in the list view.
|
* This component renders item object for the mydspace result in the list view.
|
||||||
@@ -16,7 +16,7 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
|
|||||||
templateUrl: './item-my-dspace-result-list-element.component.html'
|
templateUrl: './item-my-dspace-result-list-element.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(ItemMyDSpaceResult, ViewMode.ListElement)
|
@listableObjectComponent(ItemMyDSpaceResult, ViewMode.ListElement)
|
||||||
export class ItemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent<ItemMyDSpaceResult, Item> {
|
export class ItemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent<ItemMyDSpaceResult, Item> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -3,7 +3,6 @@ import { Component, Inject, OnInit } from '@angular/core';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { find } from 'rxjs/operators';
|
import { find } from 'rxjs/operators';
|
||||||
|
|
||||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
|
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
@@ -13,6 +12,7 @@ import { WorkflowItem } from '../../../../core/submission/models/workflowitem.mo
|
|||||||
import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model';
|
import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model';
|
||||||
import { PoolTaskMyDSpaceResult } from '../../../object-collection/shared/pool-task-my-dspace-result.model';
|
import { PoolTaskMyDSpaceResult } from '../../../object-collection/shared/pool-task-my-dspace-result.model';
|
||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders pool task object for the mydspace result in the list view.
|
* This component renders pool task object for the mydspace result in the list view.
|
||||||
@@ -23,8 +23,8 @@ import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspa
|
|||||||
templateUrl: './pool-my-dspace-result-list-element.component.html',
|
templateUrl: './pool-my-dspace-result-list-element.component.html',
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(PoolTaskMyDSpaceResult, ViewMode.ListElement)
|
@listableObjectComponent(PoolTaskMyDSpaceResult, ViewMode.ListElement)
|
||||||
@renderElementsFor(PoolTask, ViewMode.ListElement)
|
@listableObjectComponent(PoolTask, ViewMode.ListElement)
|
||||||
export class PoolMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent<PoolTaskMyDSpaceResult, PoolTask> implements OnInit {
|
export class PoolMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent<PoolTaskMyDSpaceResult, PoolTask> implements OnInit {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -3,7 +3,6 @@ import { Component } from '@angular/core';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { find } from 'rxjs/operators';
|
import { find } from 'rxjs/operators';
|
||||||
|
|
||||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
|
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
@@ -12,6 +11,7 @@ import { WorkflowitemMyDSpaceResult } from '../../../object-collection/shared/wo
|
|||||||
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders workflowitem object for the mydspace result in the list view.
|
* This component renders workflowitem object for the mydspace result in the list view.
|
||||||
@@ -22,8 +22,8 @@ import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspa
|
|||||||
templateUrl: './workflowitem-my-dspace-result-list-element.component.html',
|
templateUrl: './workflowitem-my-dspace-result-list-element.component.html',
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(WorkflowitemMyDSpaceResult, ViewMode.ListElement)
|
@listableObjectComponent(WorkflowitemMyDSpaceResult, ViewMode.ListElement)
|
||||||
@renderElementsFor(WorkflowItem, ViewMode.ListElement)
|
@listableObjectComponent(WorkflowItem, ViewMode.ListElement)
|
||||||
export class WorkflowitemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent<WorkflowitemMyDSpaceResult, WorkflowItem> {
|
export class WorkflowitemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent<WorkflowitemMyDSpaceResult, WorkflowItem> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -3,7 +3,6 @@ import { Component } from '@angular/core';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { find } from 'rxjs/operators';
|
import { find } from 'rxjs/operators';
|
||||||
|
|
||||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
|
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
@@ -12,6 +11,7 @@ import { RemoteData } from '../../../../core/data/remote-data';
|
|||||||
import { isNotUndefined } from '../../../empty.util';
|
import { isNotUndefined } from '../../../empty.util';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders workspaceitem object for the mydspace result in the list view.
|
* This component renders workspaceitem object for the mydspace result in the list view.
|
||||||
@@ -22,7 +22,7 @@ import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspa
|
|||||||
templateUrl: './workspaceitem-my-dspace-result-list-element.component.html',
|
templateUrl: './workspaceitem-my-dspace-result-list-element.component.html',
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(WorkspaceitemMyDSpaceResult, ViewMode.ListElement)
|
@listableObjectComponent(WorkspaceitemMyDSpaceResult, ViewMode.ListElement)
|
||||||
export class WorkspaceitemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent<WorkspaceitemMyDSpaceResult, WorkspaceItem> {
|
export class WorkspaceitemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent<WorkspaceitemMyDSpaceResult, WorkspaceItem> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
|
|
||||||
import { SearchResultListElementComponent } from '../search-result-list-element.component';
|
import { SearchResultListElementComponent } from '../search-result-list-element.component';
|
||||||
import { Collection } from '../../../../core/shared/collection.model';
|
import { Collection } from '../../../../core/shared/collection.model';
|
||||||
import { CollectionSearchResult } from '../../../object-collection/shared/collection-search-result.model';
|
import { CollectionSearchResult } from '../../../object-collection/shared/collection-search-result.model';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-collection-search-result-list-element',
|
selector: 'ds-collection-search-result-list-element',
|
||||||
@@ -13,5 +13,5 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
|
|||||||
templateUrl: 'collection-search-result-list-element.component.html'
|
templateUrl: 'collection-search-result-list-element.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(CollectionSearchResult, ViewMode.ListElement)
|
@listableObjectComponent(CollectionSearchResult, ViewMode.ListElement)
|
||||||
export class CollectionSearchResultListElementComponent extends SearchResultListElementComponent<CollectionSearchResult, Collection> {}
|
export class CollectionSearchResultListElementComponent extends SearchResultListElementComponent<CollectionSearchResult, Collection> {}
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
|
|
||||||
import { SearchResultListElementComponent } from '../search-result-list-element.component';
|
import { SearchResultListElementComponent } from '../search-result-list-element.component';
|
||||||
import { Community } from '../../../../core/shared/community.model';
|
import { Community } from '../../../../core/shared/community.model';
|
||||||
import { CommunitySearchResult } from '../../../object-collection/shared/community-search-result.model';
|
import { CommunitySearchResult } from '../../../object-collection/shared/community-search-result.model';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-community-search-result-list-element',
|
selector: 'ds-community-search-result-list-element',
|
||||||
@@ -13,7 +13,7 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
|
|||||||
templateUrl: 'community-search-result-list-element.component.html'
|
templateUrl: 'community-search-result-list-element.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(CommunitySearchResult, ViewMode.ListElement)
|
@listableObjectComponent(CommunitySearchResult, ViewMode.ListElement)
|
||||||
export class CommunitySearchResultListElementComponent extends SearchResultListElementComponent<CommunitySearchResult, Community> {
|
export class CommunitySearchResultListElementComponent extends SearchResultListElementComponent<CommunitySearchResult, Community> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,10 +2,10 @@ import { Component } from '@angular/core';
|
|||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { focusBackground } from '../../../animations/focus';
|
import { focusBackground } from '../../../animations/focus';
|
||||||
|
|
||||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
|
||||||
import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model';
|
||||||
import { SearchResultListElementComponent } from '../search-result-list-element.component';
|
import { SearchResultListElementComponent } from '../search-result-list-element.component';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-item-search-result-list-element',
|
selector: 'ds-item-search-result-list-element',
|
||||||
@@ -15,7 +15,7 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
@renderElementsFor(ItemSearchResult, ViewMode.ListElement)
|
@listableObjectComponent(ItemSearchResult, ViewMode.ListElement)
|
||||||
export class ItemSearchResultListElementComponent extends SearchResultListElementComponent<ItemSearchResult, Item> {
|
export class ItemSearchResultListElementComponent extends SearchResultListElementComponent<ItemSearchResult, Item> {
|
||||||
viewMode = ViewMode.ListElement;
|
viewMode = ViewMode.ListElement;
|
||||||
|
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
<ng-container *ngComponentOutlet="listElement; injector: objectInjector;"></ng-container>
|
|
@@ -1 +0,0 @@
|
|||||||
|
|
@@ -1,35 +0,0 @@
|
|||||||
import { Component, Injector, Input, OnInit } from '@angular/core';
|
|
||||||
import { GenericConstructor } from '../../../core/shared/generic-constructor';
|
|
||||||
import { rendersDSOType } from '../../object-collection/shared/dso-element-decorator'
|
|
||||||
import { ListableObject } from '../../object-collection/shared/listable-object.model';
|
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'ds-wrapper-list-element',
|
|
||||||
styleUrls: ['./wrapper-list-element.component.scss'],
|
|
||||||
templateUrl: './wrapper-list-element.component.html'
|
|
||||||
})
|
|
||||||
export class WrapperListElementComponent implements OnInit {
|
|
||||||
@Input() object: ListableObject;
|
|
||||||
@Input() index: number;
|
|
||||||
objectInjector: Injector;
|
|
||||||
listElement: any;
|
|
||||||
|
|
||||||
constructor(private injector: Injector) {}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.objectInjector = Injector.create({
|
|
||||||
providers: [
|
|
||||||
{ provide: 'objectElementProvider', useFactory: () => (this.object), deps:[] },
|
|
||||||
{ provide: 'indexElementProvider', useFactory: () => (this.index), deps:[] }
|
|
||||||
],
|
|
||||||
parent: this.injector
|
|
||||||
});
|
|
||||||
this.listElement = this.getListElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
private getListElement(): string {
|
|
||||||
const f: GenericConstructor<ListableObject> = this.object.constructor as GenericConstructor<ListableObject>;
|
|
||||||
return rendersDSOType(f, ViewMode.ListElement);
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user