mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 10:34:15 +00:00
#150 Feedback fixes
This commit is contained in:
@@ -77,10 +77,15 @@ export class SearchPageComponent implements OnInit, OnDestroy {
|
||||
let pageSizeOptions: number[] = [5, 10, 20, 40, 60, 80, 100];
|
||||
|
||||
if (isNotEmpty(params.view) && params.view === ViewMode.Grid) {
|
||||
pageSize = 12;
|
||||
pageSizeOptions = [12, 24, 36, 48 , 50, 62, 74, 84];
|
||||
// pageSize = 9;
|
||||
// pageSizeOptions = [9, 18, 27, 36 , 45, 54, 63, 72];
|
||||
if (pageSizeOptions.indexOf(pageSize) === -1) {
|
||||
pageSize = 12;
|
||||
}
|
||||
}
|
||||
if (isNotEmpty(params.view) && params.view === ViewMode.List) {
|
||||
if (pageSizeOptions.indexOf(pageSize) === -1) {
|
||||
pageSize = 10;
|
||||
}
|
||||
}
|
||||
|
||||
const sortDirection = +params.sortDirection || this.searchOptions.sort.direction;
|
||||
|
@@ -1,14 +1,14 @@
|
||||
<ds-pagination
|
||||
[paginationOptions]="config"
|
||||
[pageInfoState]="pageInfo"
|
||||
[collectionSize]="(pageInfo | async)?.totalElements"
|
||||
[collectionSize]="pageInfo?.totalElements"
|
||||
[sortOptions]="sortConfig"
|
||||
[hideGear]="hideGear"
|
||||
[hidePagerWhenSinglePage]="hidePagerWhenSinglePage"
|
||||
(pageChange)="onPageChange($event)"
|
||||
(pageSizeChange)="onPageSizeChange($event)"
|
||||
(sortDirectionChange)="onSortDirectionChange($event)"
|
||||
(sortFieldChange)="onSortDirectionChange($event)"
|
||||
(sortFieldChange)="onSortFieldChange($event)"
|
||||
(paginationChange)="onPaginationChange($event)">
|
||||
<div class="row mt-2" *ngIf="objects?.hasSucceeded" @fadeIn>
|
||||
<div class="col-lg-4 col-sm-6 col-xs-12 "
|
||||
|
@@ -1,12 +1,10 @@
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
Component, EventEmitter,
|
||||
Input,
|
||||
ViewEncapsulation,
|
||||
ChangeDetectionStrategy,
|
||||
OnInit,
|
||||
Output, SimpleChanges, OnChanges, ChangeDetectorRef, DoCheck
|
||||
Output,
|
||||
ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { RemoteData } from '../../core/data/remote-data';
|
||||
import { PageInfo } from '../../core/shared/page-info.model';
|
||||
@@ -16,6 +14,7 @@ import { PaginationComponentOptions } from '../pagination/pagination-component-o
|
||||
import { SortOptions, SortDirection } from '../../core/cache/models/sort-options.model';
|
||||
import { fadeIn } from '../animations/fade';
|
||||
import { ListableObject } from '../object-collection/shared/listable-object.model';
|
||||
import { hasValue } from '../empty.util';
|
||||
|
||||
@Component({
|
||||
changeDetection: ChangeDetectionStrategy.Default,
|
||||
@@ -26,14 +25,35 @@ import { ListableObject } from '../object-collection/shared/listable-object.mode
|
||||
animations: [fadeIn]
|
||||
})
|
||||
|
||||
export class ObjectGridComponent implements OnChanges, OnInit {
|
||||
export class ObjectGridComponent {
|
||||
|
||||
@Input() objects: RemoteData<ListableObject[]>;
|
||||
@Input() config: PaginationComponentOptions;
|
||||
@Input() sortConfig: SortOptions;
|
||||
@Input() hideGear = false;
|
||||
@Input() hidePagerWhenSinglePage = true;
|
||||
pageInfo: Observable<PageInfo>;
|
||||
private _objects: RemoteData<ListableObject[]>;
|
||||
pageInfo: PageInfo;
|
||||
@Input() set objects(objects: RemoteData<ListableObject[]>) {
|
||||
this._objects = objects;
|
||||
if (hasValue(objects)) {
|
||||
this.pageInfo = objects.pageInfo;
|
||||
}
|
||||
}
|
||||
get objects() {
|
||||
return this._objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* An event fired when the page is changed.
|
||||
* Event's payload equals to the newly selected page.
|
||||
*/
|
||||
@Output() change: EventEmitter<{
|
||||
pagination: PaginationComponentOptions,
|
||||
sort: SortOptions
|
||||
}> = new EventEmitter<{
|
||||
pagination: PaginationComponentOptions,
|
||||
sort: SortOptions
|
||||
}>();
|
||||
|
||||
/**
|
||||
* An event fired when the page is changed.
|
||||
@@ -61,26 +81,6 @@ export class ObjectGridComponent implements OnChanges, OnInit {
|
||||
*/
|
||||
@Output() sortFieldChange: EventEmitter<string> = new EventEmitter<string>();
|
||||
data: any = {};
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
if (changes.objects && !changes.objects.isFirstChange()) {
|
||||
// this.pageInfo = this.objects.pageInfo;
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
// this.pageInfo = this.objects.pageInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param route
|
||||
* Route is a singleton service provided by Angular.
|
||||
* @param router
|
||||
* Router is a singleton service provided by Angular.
|
||||
*/
|
||||
constructor(private cdRef: ChangeDetectorRef) {
|
||||
}
|
||||
|
||||
onPageChange(event) {
|
||||
this.pageChange.emit(event);
|
||||
}
|
||||
|
Reference in New Issue
Block a user