mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
680 Add paginationChangeEvent interface and move to PaginationComponent impl for event handling
This commit is contained in:
@@ -21,6 +21,7 @@ import { fadeIn, fadeInOut } from '../shared/animations/fade';
|
|||||||
import { hasValue, isNotEmpty } from '../shared/empty.util';
|
import { hasValue, isNotEmpty } from '../shared/empty.util';
|
||||||
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
|
||||||
import { AuthService } from '../core/auth/auth.service';
|
import { AuthService } from '../core/auth/auth.service';
|
||||||
|
import {PaginationChangeEvent} from '../shared/pagination/paginationChangeEvent.interface';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-collection-page',
|
selector: 'ds-collection-page',
|
||||||
@@ -93,9 +94,8 @@ export class CollectionPageComponent implements OnInit {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.route.queryParams.pipe(take(1)).subscribe((params) => {
|
this.route.queryParams.pipe(take(1)).subscribe((params: PaginationChangeEvent) => {
|
||||||
this.metadata.processRemoteData(this.collectionRD$);
|
this.metadata.processRemoteData(this.collectionRD$);
|
||||||
this.onPaginationChange(params);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ export class CollectionPageComponent implements OnInit {
|
|||||||
return isNotEmpty(object);
|
return isNotEmpty(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
onPaginationChange(event) {
|
onPaginationChange(event: PaginationChangeEvent) {
|
||||||
this.paginationConfig = Object.assign(new PaginationComponentOptions(), {
|
this.paginationConfig = Object.assign(new PaginationComponentOptions(), {
|
||||||
currentPage: event.pagination.currentPage || this.paginationConfig.currentPage,
|
currentPage: event.pagination.currentPage || this.paginationConfig.currentPage,
|
||||||
pageSize: event.pagination.pageSize || this.paginationConfig.pageSize,
|
pageSize: event.pagination.pageSize || this.paginationConfig.pageSize,
|
||||||
|
@@ -0,0 +1,7 @@
|
|||||||
|
import {PaginationComponentOptions} from './pagination-component-options.model';
|
||||||
|
import {SortOptions} from '../../core/cache/models/sort-options.model';
|
||||||
|
|
||||||
|
export interface PaginationChangeEvent {
|
||||||
|
pagination: PaginationComponentOptions;
|
||||||
|
sort: SortOptions;
|
||||||
|
}
|
Reference in New Issue
Block a user