openaire-library/searchPages/searchUtils/no-load-paging.component.ts

39 lines
1.5 KiB
TypeScript

import {Component, Input, Output, EventEmitter} from '@angular/core';
@Component({
selector: 'no-load-paging',
template: `
<div class="paging-hr searchPaging uk-margin-small-bottom">
<div class="uk-panel uk-margin-small-top uk-grid uk-flex uk-flex-middle">
<div class="uk-width-1-1@s uk-width-1-2@m uk-text-uppercase" *ngIf="type && totalResults">
{{totalResults | number}}
<span class="uk-text-muted uk-text-uppercase"> {{type}}, page </span>
{{page}}
<span class="uk-text-muted uk-text-uppercase"> of </span>
{{paging.getTotalPages()}}
</div>
<div class="float-children-right-at-medium margin-small-top-at-small uk-width-expand">
<paging-no-load #paging [currentPage]="page"
customClasses="uk-margin-remove-bottom"
[totalResults]="totalResults" [size]="pageSize"
(pageChange)="updatePage($event)">
</paging-no-load>
</div>
</div>
</div>
`
})
export class NoLoadPagingComponent {
@Input() type: string;
@Input() page: number = 1;
@Input() pageSize: number = 10;
@Input() totalResults: number;
@Output() pageChange: EventEmitter<any> = new EventEmitter<any>();
public updatePage(event) {
this.pageChange.emit({
value: event.value
});
}
}