mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00

# Conflicts: # src/app/access-control/bulk-access/browse/bulk-access-browse.component.html # src/app/access-control/epeople-registry/epeople-registry.component.html # src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html # src/app/access-control/group-registry/group-form/members-list/members-list.component.html # src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.html # src/app/process-page/overview/process-overview.component.html # src/app/shared/object-select/collection-select/collection-select.component.html # src/app/shared/object-select/collection-select/collection-select.component.ts # src/app/shared/object-select/item-select/item-select.component.html # src/app/shared/object-select/item-select/item-select.component.ts # src/app/shared/object-select/object-select/object-select.component.ts # src/app/shared/pagination/pagination.component.ts
60 lines
1.8 KiB
TypeScript
60 lines
1.8 KiB
TypeScript
import {
|
|
Component,
|
|
Input,
|
|
OnInit,
|
|
} from '@angular/core';
|
|
import { Observable } from 'rxjs';
|
|
import { map } from 'rxjs/operators';
|
|
|
|
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
|
import { Item } from '../../../core/shared/item.model';
|
|
import { getAllSucceededRemoteDataPayload } from '../../../core/shared/operators';
|
|
import { getItemPageRoute } from '../../../item-page/item-page-routing-paths';
|
|
import {
|
|
hasValueOperator,
|
|
isNotEmpty,
|
|
} from '../../empty.util';
|
|
import { DSpaceObjectSelect } from '../object-select.model';
|
|
import { ObjectSelectComponent } from '../object-select/object-select.component';
|
|
|
|
@Component({
|
|
selector: 'ds-item-select',
|
|
templateUrl: './item-select.component.html',
|
|
})
|
|
|
|
/**
|
|
* A component used to select items from a specific list and returning the UUIDs of the selected items
|
|
*/
|
|
export class ItemSelectComponent extends ObjectSelectComponent<Item> implements OnInit {
|
|
|
|
/**
|
|
* Whether or not to hide the collection column
|
|
*/
|
|
@Input()
|
|
hideCollection = false;
|
|
|
|
/**
|
|
* Collection of all the data that is used to display the {@link Item} in the HTML.
|
|
* By collecting this data here it doesn't need to be recalculated on evey change detection.
|
|
*/
|
|
selectItems$: Observable<DSpaceObjectSelect<Item>[]>;
|
|
|
|
ngOnInit(): void {
|
|
super.ngOnInit();
|
|
if (!isNotEmpty(this.confirmButton)) {
|
|
this.confirmButton = 'item.select.confirm';
|
|
}
|
|
this.selectItems$ = this.dsoRD$.pipe(
|
|
hasValueOperator(),
|
|
getAllSucceededRemoteDataPayload(),
|
|
map((items: PaginatedList<Item>) => items.page.map((item: Item) => Object.assign(new DSpaceObjectSelect<Item>(), {
|
|
dso: item,
|
|
canSelect$: this.canSelect(item),
|
|
selected$: this.getSelected(item.id),
|
|
route: getItemPageRoute(item),
|
|
} as DSpaceObjectSelect<Item>))),
|
|
);
|
|
}
|
|
|
|
}
|