openaire-library/searchPages/searchUtils/searchPaging.component.ts

36 lines
1.3 KiB
TypeScript
Raw Normal View History

import {Component, Input} from '@angular/core';
import {ErrorCodes} from '../../utils/properties/errorCodes';
@Component({
selector: 'search-paging',
template: `
<paging *ngIf="results && searchUtils.totalResults > searchUtils.size"
[currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [baseUrl]="baseUrl"
[size]="searchUtils.size" [parameterNames]="parameterNames" [parameterValues]="parameterValues"
[isDisabled]="isDisabled">
</paging>
<paging *ngIf="!loadPaging && oldTotalResults > searchUtils.size && searchUtils.status == errorCodes.LOADING"
[currentPage]="searchUtils.page" [totalResults]="oldTotalResults" [baseUrl]="baseUrl"
[size]="searchUtils.size" [parameterNames]="parameterNames" [parameterValues]="parameterValues"
[isDisabled]="isDisabled">
</paging>
`
})
export class SearchPagingComponent {
@Input() isDisabled: boolean = false;
@Input() searchUtils;
@Input() results;
@Input() baseUrl;
@Input() type;
@Input() parameterNames: string[];
@Input() parameterValues: string[];
@Input() loadPaging: boolean = true;
@Input() oldTotalResults: number = 0;
public totalResults: number = 0;
public errorCodes: ErrorCodes = new ErrorCodes();
constructor() {
}
}