mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
added selected results to lookup tab
This commit is contained in:
@@ -20,6 +20,19 @@
|
||||
</ds-dynamic-lookup-relation-search-tab>
|
||||
</ng-template>
|
||||
</ngb-tab>
|
||||
<ngb-tab title="Selection">
|
||||
<ng-template ngbTabContent>
|
||||
<ds-dynamic-lookup-relation-selection-tab
|
||||
[label]="label"
|
||||
[itemRD$]="itemRD$"
|
||||
[selection$]="selection$"
|
||||
[listId]="listId"
|
||||
[relationship]="relationship"
|
||||
[repeatable]="repeatable"
|
||||
class="d-block pt-3">
|
||||
</ds-dynamic-lookup-relation-selection-tab>
|
||||
</ng-template>
|
||||
</ngb-tab>
|
||||
</ngb-tabset>
|
||||
|
||||
</div>
|
||||
|
@@ -1,4 +1,10 @@
|
||||
<ds-search-results [searchResults]="selection$ | async"
|
||||
<ds-search-sidebar class="col-4" id="search-sidebar"
|
||||
[resultCount]=""
|
||||
[inPlaceSearch]="true" [showViewModes]="false"></ds-search-sidebar>
|
||||
<div class="col-8">
|
||||
<ds-viewable-collection [objects]="selectionRD$ | async"
|
||||
[selectable]="true"
|
||||
[selectionConfig]="{ repeatable: repeatable, listId: listId }"
|
||||
></ds-search-results>
|
||||
[config]="initialPagination"
|
||||
></ds-viewable-collection>
|
||||
</div>
|
@@ -1,9 +1,14 @@
|
||||
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../../../../../+my-dspace-page/my-dspace-page.component';
|
||||
import { SearchConfigurationService } from '../../../../../../core/shared/search/search-configuration.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { RelationshipOptions } from '../../../models/relationship-options.model';
|
||||
import { ListableObject } from '../../../../../object-collection/shared/listable-object.model';
|
||||
import { RemoteData } from '../../../../../../core/data/remote-data';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../../testing/utils';
|
||||
import { PaginationComponentOptions } from '../../../../../pagination/pagination-component-options.model';
|
||||
import { PaginatedList } from '../../../../../../core/data/paginated-list';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-dynamic-lookup-relation-selection-tab',
|
||||
@@ -24,10 +29,19 @@ export class DsDynamicLookupRelationSelectionTabComponent {
|
||||
@Input() itemRD$;
|
||||
@Input() repeatable: boolean;
|
||||
@Input() selection$: Observable<ListableObject[]>;
|
||||
@Input() selectionRD$: Observable<RemoteData<PaginatedList<ListableObject>>>;
|
||||
initialPagination = Object.assign(new PaginationComponentOptions(), {
|
||||
id: 'submission-relation-list',
|
||||
pageSize: 5
|
||||
});
|
||||
|
||||
constructor(
|
||||
|
||||
) {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.selectionRD$ = this.selection$.pipe(
|
||||
take(1),
|
||||
map((selection) => createSuccessfulRemoteDataObject(new PaginatedList({} as any, selection)))
|
||||
);
|
||||
}
|
||||
}
|
@@ -10,7 +10,7 @@
|
||||
(sortDirectionChange)="onSortDirectionChange($event)"
|
||||
(sortFieldChange)="onSortFieldChange($event)"
|
||||
(paginationChange)="onPaginationChange($event)">
|
||||
<ul *ngIf="objects?.hasSucceeded" class="list-unstyled">
|
||||
<ul *ngIf="objects?.hasSucceeded" class="list-unstyled" [ngClass]="{'ml-4': selectable}">
|
||||
<li *ngFor="let object of objects?.payload?.page; let i = index; let last = last" class="mt-4 mb-4" [class.border-bottom]="hasBorder && !last">
|
||||
<span *ngIf="selectable">
|
||||
<ng-container *ngVar="selectionService?.isObjectSelected(selectionConfig?.listId, object) | async as checked">
|
||||
|
Reference in New Issue
Block a user