Merge branch 'fix-broken-item-mapper-pagination_contribute-7.6' into fix-broken-item-mapper-pagination_contribute-main

# 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
This commit is contained in:
Alexandre Vryghem
2024-04-18 21:28:53 +02:00
25 changed files with 100 additions and 113 deletions

View File

@@ -27,12 +27,10 @@ import { PaginatedList } from '../../core/data/paginated-list.model';
import { RemoteData } from '../../core/data/remote-data';
import { PaginationService } from '../../core/pagination/pagination.service';
import { PaginationRouteParams } from '../../core/pagination/pagination-route-params.interface';
import { PageInfo } from '../../core/shared/page-info.model';
import { ViewMode } from '../../core/shared/view-mode.model';
import { hasValue } from '../empty.util';
import { HostWindowService } from '../host-window.service';
import { ListableObject } from '../object-collection/shared/listable-object.model';
import { HostWindowState } from '../search/host-window.reducer';
import { PaginationComponentOptions } from './pagination-component-options.model';
/**
@@ -57,11 +55,6 @@ export class PaginationComponent implements OnDestroy, OnInit {
*/
@Input() collectionSize: number;
/**
* Page state of a Remote paginated objects.
*/
@Input() pageInfoState: Observable<PageInfo> = undefined;
/**
* Configuration for the NgbPagination component.
*/
@@ -151,18 +144,13 @@ export class PaginationComponent implements OnDestroy, OnInit {
/**
* Current page.
*/
public currentPage$;
public currentPage$: Observable<number>;
/**
* Current page in the state of a Remote paginated objects.
*/
public currentPageState: number = undefined;
/**
* An observable of HostWindowState type
*/
public hostWindow: Observable<HostWindowState>;
/**
* ID for the pagination instance. This ID is used in the routing to retrieve the pagination options.
* This ID needs to be unique between different pagination components when more than one will be displayed on the same page.
@@ -252,7 +240,7 @@ export class PaginationComponent implements OnDestroy, OnInit {
map((currentPagination) => currentPagination.pageSize),
);
let sortOptions;
let sortOptions: SortOptions;
if (this.sortOptions) {
sortOptions = this.sortOptions;
} else {
@@ -266,16 +254,6 @@ export class PaginationComponent implements OnDestroy, OnInit {
);
}
/**
* @param cdRef
* ChangeDetectorRef is a singleton service provided by Angular.
* @param route
* Route is a singleton service provided by Angular.
* @param router
* Router is a singleton service provided by Angular.
* @param hostWindowService
* the HostWindowService singleton.
*/
constructor(private cdRef: ChangeDetectorRef,
private paginationService: PaginationService,
public hostWindowService: HostWindowService) {
@@ -314,17 +292,6 @@ export class PaginationComponent implements OnDestroy, OnInit {
this.emitPaginationChange();
}
/**
* Method to change the route to the given sort field
*
* @param sortField
* The sort field being navigated to.
*/
public doSortFieldChange(field: string) {
this.updateParams({ page: 1, sortField: field });
this.emitPaginationChange();
}
/**
* Method to emit a general pagination change event
*/
@@ -348,10 +315,10 @@ export class PaginationComponent implements OnDestroy, OnInit {
if (collectionSize) {
showingDetails = this.paginationService.getCurrentPagination(this.id, this.paginationOptions).pipe(
map((currentPaginationOptions) => {
let lastItem;
let lastItem: number;
const pageMax = currentPaginationOptions.pageSize * currentPaginationOptions.currentPage;
const firstItem = currentPaginationOptions.pageSize * (currentPaginationOptions.currentPage - 1) + 1;
const firstItem: number = currentPaginationOptions.pageSize * (currentPaginationOptions.currentPage - 1) + 1;
if (collectionSize > pageMax) {
lastItem = pageMax;
} else {