mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-12 12:33:07 +00:00
[CST-9636] Provide possibility to paginate a full list of elements
This commit is contained in:
@@ -16,6 +16,28 @@
|
|||||||
(prev)="goPrev()"
|
(prev)="goPrev()"
|
||||||
(next)="goNext()">
|
(next)="goNext()">
|
||||||
<ul *ngIf="objects?.hasSucceeded" class="list-unstyled" [ngClass]="{'ml-4': selectable}">
|
<ul *ngIf="objects?.hasSucceeded" class="list-unstyled" [ngClass]="{'ml-4': selectable}">
|
||||||
|
<ng-container *ngIf="listToPaginate">
|
||||||
|
<li *ngFor='let object of objects?.payload?.page | paginate: { itemsPerPage: config.pageSize,
|
||||||
|
currentPage: config.currentPage, totalItems: objects?.payload?.page.length }; let i = index; let last = last ' class="mt-4 mb-4 d-flex" [class.border-bottom]="hasBorder && !last" [attr.data-test]="'list-object' | dsBrowserOnly">
|
||||||
|
<ds-selectable-list-item-control *ngIf="selectable" [index]="i"
|
||||||
|
[object]="object"
|
||||||
|
[selectionConfig]="selectionConfig"
|
||||||
|
(deselectObject)="deselectObject.emit($event)"
|
||||||
|
(selectObject)="selectObject.emit($event)"></ds-selectable-list-item-control>
|
||||||
|
<ds-importable-list-item-control *ngIf="importable" [object]="object"
|
||||||
|
[importConfig]="importConfig"
|
||||||
|
(importObject)="importObject.emit($event)"></ds-importable-list-item-control>
|
||||||
|
<ds-listable-object-component-loader [context]="context"
|
||||||
|
[linkType]="linkType"
|
||||||
|
[listID]="selectionConfig?.listId"
|
||||||
|
[index]="i"
|
||||||
|
[object]="object"
|
||||||
|
[showThumbnails]="showThumbnails"
|
||||||
|
[viewMode]="viewMode"
|
||||||
|
(contentChange)="contentChange.emit($event)"></ds-listable-object-component-loader>
|
||||||
|
</li>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="!listToPaginate">
|
||||||
<li *ngFor="let object of objects?.payload?.page; let i = index; let last = last" class="mt-4 mb-4 d-flex" [class.border-bottom]="hasBorder && !last" [attr.data-test]="'list-object' | dsBrowserOnly">
|
<li *ngFor="let object of objects?.payload?.page; let i = index; let last = last" class="mt-4 mb-4 d-flex" [class.border-bottom]="hasBorder && !last" [attr.data-test]="'list-object' | dsBrowserOnly">
|
||||||
<ds-selectable-list-item-control *ngIf="selectable" [index]="i"
|
<ds-selectable-list-item-control *ngIf="selectable" [index]="i"
|
||||||
[object]="object"
|
[object]="object"
|
||||||
@@ -34,5 +56,6 @@
|
|||||||
[viewMode]="viewMode"
|
[viewMode]="viewMode"
|
||||||
(contentChange)="contentChange.emit($event)"></ds-listable-object-component-loader>
|
(contentChange)="contentChange.emit($event)"></ds-listable-object-component-loader>
|
||||||
</li>
|
</li>
|
||||||
|
</ng-container>
|
||||||
</ul>
|
</ul>
|
||||||
</ds-pagination>
|
</ds-pagination>
|
||||||
|
@@ -76,6 +76,11 @@ export class ObjectListComponent {
|
|||||||
*/
|
*/
|
||||||
@Input() importConfig: { buttonLabel: string };
|
@Input() importConfig: { buttonLabel: string };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true the object list provided needs to be paginated using the `paginate` pipe
|
||||||
|
*/
|
||||||
|
@Input() listToPaginate = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the pagination should be rendered as simple previous and next buttons instead of the normal pagination
|
* Whether or not the pagination should be rendered as simple previous and next buttons instead of the normal pagination
|
||||||
*/
|
*/
|
||||||
|
@@ -44,6 +44,11 @@ export class ThemedObjectListComponent extends ThemedComponent<ObjectListCompone
|
|||||||
*/
|
*/
|
||||||
@Input() hidePagerWhenSinglePage: boolean;
|
@Input() hidePagerWhenSinglePage: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true the object list provided needs to be paginated using the `paginate` pipe
|
||||||
|
*/
|
||||||
|
@Input() listToPaginate: boolean;
|
||||||
|
|
||||||
@Input() selectable: boolean;
|
@Input() selectable: boolean;
|
||||||
|
|
||||||
@Input() selectionConfig: { repeatable: boolean, listId: string };
|
@Input() selectionConfig: { repeatable: boolean, listId: string };
|
||||||
@@ -160,6 +165,7 @@ w /**
|
|||||||
'hidePaginationDetail',
|
'hidePaginationDetail',
|
||||||
'importable',
|
'importable',
|
||||||
'importConfig',
|
'importConfig',
|
||||||
|
'listToPaginate',
|
||||||
'showPaginator',
|
'showPaginator',
|
||||||
'showThumbnails',
|
'showThumbnails',
|
||||||
'contentChange',
|
'contentChange',
|
||||||
|
@@ -39,12 +39,12 @@
|
|||||||
<div *ngIf="!showPaginator" class="d-flex justify-content-between">
|
<div *ngIf="!showPaginator" class="d-flex justify-content-between">
|
||||||
<button id="nav-prev" type="button" class="btn btn-outline-primary float-left"
|
<button id="nav-prev" type="button" class="btn btn-outline-primary float-left"
|
||||||
(click)="goPrev()"
|
(click)="goPrev()"
|
||||||
[disabled]="objects?.payload?.currentPage <= 1">
|
[disabled]="(objects?.payload?.currentPage <= 1) && (paginationOptions?.currentPage <= 1)">
|
||||||
<i class="fas fa-angle-left"></i> {{'pagination.previous.button' |translate}}
|
<i class="fas fa-angle-left"></i> {{'pagination.previous.button' |translate}}
|
||||||
</button>
|
</button>
|
||||||
<button id="nav-next" type="button" class="btn btn-outline-primary float-right"
|
<button id="nav-next" type="button" class="btn btn-outline-primary float-right"
|
||||||
(click)="goNext()"
|
(click)="goNext()"
|
||||||
[disabled]="objects?.payload?.currentPage >= objects?.payload?.totalPages">
|
[disabled]="(objects?.payload?.currentPage >= objects?.payload?.totalPages) || (paginationOptions?.currentPage >= objects?.payload?.totalPages)">
|
||||||
<span [ngbTooltip]="objects?.payload?.currentPage >= objects?.payload?.totalPages ? ('pagination.next.button.disabled.tooltip' |translate) : null">
|
<span [ngbTooltip]="objects?.payload?.currentPage >= objects?.payload?.totalPages ? ('pagination.next.button.disabled.tooltip' |translate) : null">
|
||||||
<i class="fas fa-angle-right"></i> {{'pagination.next.button' |translate}}
|
<i class="fas fa-angle-right"></i> {{'pagination.next.button' |translate}}
|
||||||
</span>
|
</span>
|
||||||
|
@@ -272,6 +272,7 @@ import {
|
|||||||
ThemedItemPageTitleFieldComponent
|
ThemedItemPageTitleFieldComponent
|
||||||
} from '../item-page/simple/field-components/specific-field/title/themed-item-page-field.component';
|
} from '../item-page/simple/field-components/specific-field/title/themed-item-page-field.component';
|
||||||
import { BitstreamListItemComponent } from './object-list/bitstream-list-item/bitstream-list-item.component';
|
import { BitstreamListItemComponent } from './object-list/bitstream-list-item/bitstream-list-item.component';
|
||||||
|
import { NgxPaginationModule } from 'ngx-pagination';
|
||||||
|
|
||||||
const MODULES = [
|
const MODULES = [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
@@ -286,7 +287,8 @@ const MODULES = [
|
|||||||
RouterModule,
|
RouterModule,
|
||||||
DragDropModule,
|
DragDropModule,
|
||||||
GoogleRecaptchaModule,
|
GoogleRecaptchaModule,
|
||||||
MenuModule
|
MenuModule,
|
||||||
|
NgxPaginationModule
|
||||||
];
|
];
|
||||||
|
|
||||||
const ROOT_MODULES = [
|
const ROOT_MODULES = [
|
||||||
|
Reference in New Issue
Block a user