[Library | Trunk]: Paging bold numbers

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60278 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-01-22 14:36:06 +00:00
parent 3be32603df
commit 3ac191b39c
5 changed files with 68 additions and 65 deletions

View File

@ -174,11 +174,11 @@
<div class="uk-panel uk-margin-small-top uk-grid uk-flex uk-flex-middle"> <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" <div class="uk-width-1-1@s uk-width-1-2@m uk-text-uppercase"
*ngIf="openaireResultsNum > 0"> *ngIf="openaireResultsNum > 0">
{{openaireResultsNum|number}} <span class="uk-text-bold">{{openaireResultsNum|number}}</span>
<span class="uk-text-muted uk-text-uppercase"> projects, page </span> <span class="uk-text-muted uk-text-uppercase"> projects, page </span>
{{openaireResultsPage | number}} <span class="uk-text-bold">{{openaireResultsPage | number}}</span>
<span class="uk-text-muted uk-text-uppercase"> of </span> <span class="uk-text-muted uk-text-uppercase"> of </span>
{{(totalPages(openaireResultsNum)|number)}} <span class="uk-text-bold">{{(totalPages(openaireResultsNum)|number)}}</span>
</div> </div>
<div class="float-children-right-at-medium margin-small-top-at-small uk-width-expand uk-padding-remove-left"> <div class="float-children-right-at-medium margin-small-top-at-small uk-width-expand uk-padding-remove-left">
<paging-no-load class="uk-float-right" [currentPage]="openaireResultsPage" <paging-no-load class="uk-float-right" [currentPage]="openaireResultsPage"

View File

@ -198,11 +198,11 @@
<div class="uk-panel uk-margin-small-top uk-grid uk-flex uk-flex-middle"> <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" <div class="uk-width-1-1@s uk-width-1-2@m uk-text-uppercase"
*ngIf="openaireResultsNum > 0"> *ngIf="openaireResultsNum > 0">
{{openaireResultsNum|number}} <span class="uk-text-bold">{{openaireResultsNum|number}}</span>
<span class="uk-text-muted uk-text-uppercase"> research outcomes, page </span> <span class="uk-text-muted uk-text-uppercase"> research outcomes, page </span>
{{openaireResultsPage | number}} <span class="uk-text-bold">{{openaireResultsPage | number}}</span>
<span class="uk-text-muted uk-text-uppercase"> of </span> <span class="uk-text-muted uk-text-uppercase"> of </span>
{{(countTotalPages(openaireResultsNum)|number)}} <span class="uk-text-bold">{{(countTotalPages(openaireResultsNum)|number)}}</span>
</div> </div>
<div class="float-children-right-at-medium margin-small-top-at-small uk-width-expand uk-padding-remove-left" *ngIf=" openaireResultsStatus != errorCodes.LOADING"> <div class="float-children-right-at-medium margin-small-top-at-small uk-width-expand uk-padding-remove-left" *ngIf=" openaireResultsStatus != errorCodes.LOADING">
<paging-no-load class="uk-float-right" [currentPage]="openaireResultsPage" <paging-no-load class="uk-float-right" [currentPage]="openaireResultsPage"

View File

@ -5,12 +5,12 @@ import {Component, Input, Output, EventEmitter} from '@angular/core';
template: ` template: `
<div class="paging-hr searchPaging uk-margin-small-bottom"> <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-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"> <div class="uk-width-1-1@s uk-width-1-2@m uk-text-uppercase" *ngIf="type && totalResults">
{{totalResults | number}} <span class="uk-text-bold">{{totalResults | number}}</span>
<span class="uk-text-muted uk-text-uppercase"> {{type}}, page </span> <span class="uk-text-muted uk-text-uppercase"> {{type}}, page </span>
{{page}} <span class="uk-text-bold">{{page}}</span>
<span class="uk-text-muted uk-text-uppercase"> of </span> <span class="uk-text-muted uk-text-uppercase"> of </span>
{{paging.getTotalPages()}} <span class="uk-text-bold">{{paging.getTotalPages()}}</span>
</div> </div>
<div class="float-children-right-at-medium margin-small-top-at-small uk-width-expand"> <div class="float-children-right-at-medium margin-small-top-at-small uk-width-expand">
<paging-no-load #paging [currentPage]="page" <paging-no-load #paging [currentPage]="page"

View File

@ -43,11 +43,11 @@
<div class="uk-panel uk-margin-small-top uk-grid uk-flex uk-flex-middle"> <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" <div class="uk-width-1-1@s uk-width-1-2@m uk-text-uppercase"
*ngIf="results && searchUtils.totalResults > 0"> *ngIf="results && searchUtils.totalResults > 0">
{{searchUtils.totalResults|number}} <span class="uk-text-bold">{{searchUtils.totalResults|number}}</span>
<span class="uk-text-muted uk-text-uppercase"> {{type}}, page </span> <span class="uk-text-muted uk-text-uppercase"> {{type}}, page </span>
{{searchUtils.page | number}} <span class="uk-text-bold">{{searchUtils.page | number}}</span>
<span class="uk-text-muted uk-text-uppercase"> of </span> <span class="uk-text-muted uk-text-uppercase"> of </span>
{{(totalPages()|number)}} <span class="uk-text-bold">{{(totalPages()|number)}}</span>
</div> </div>
<div class="float-children-right-at-medium margin-small-top-at-small uk-width-expand" *ngIf=" searchUtils.status != errorCodes.LOADING"> <div class="float-children-right-at-medium margin-small-top-at-small uk-width-expand" *ngIf=" searchUtils.status != errorCodes.LOADING">
<paging-no-load [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [size]="searchUtils.size" (pageChange)="goTo($event.value)"></paging-no-load> <paging-no-load [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [size]="searchUtils.size" (pageChange)="goTo($event.value)"></paging-no-load>

View File

@ -2,26 +2,26 @@ import {Component, Input} from '@angular/core';
import {ErrorCodes} from '../../utils/properties/errorCodes'; import {ErrorCodes} from '../../utils/properties/errorCodes';
@Component({ @Component({
selector: 'search-paging', selector: 'search-paging',
template: ` template: `
<div class= "paging-hr searchPaging uk-margin-small-bottom" <div class="paging-hr searchPaging uk-margin-small-bottom"
*ngIf="(results && searchUtils.totalResults > 0) || (!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING)"> *ngIf="(results && searchUtils.totalResults > 0) || (!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING)">
<div class="uk-panel uk-margin-small-top uk-grid uk-flex uk-flex-middle"> <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" <div class="uk-width-1-1@s uk-width-1-2@m uk-text-uppercase"
*ngIf="results && searchUtils.totalResults > 0"> *ngIf="results && searchUtils.totalResults > 0">
{{searchUtils.totalResults|number}} <span class="uk-text-bold">{{searchUtils.totalResults|number}}</span>
<span class="uk-text-muted uk-text-uppercase"> {{type}}, page </span> <span class="uk-text-muted uk-text-uppercase"> {{type}}, page </span>
{{searchUtils.page | number}} <span class="uk-text-bold">{{searchUtils.page | number}}</span>
<span class="uk-text-muted uk-text-uppercase"> of </span> <span class="uk-text-muted uk-text-uppercase"> of </span>
{{(totalPages(searchUtils.totalResults)|number)}} <span class="uk-text-bold">{{(totalPages(searchUtils.totalResults)|number)}}</span>
</div> </div>
<div class="uk-width-1-1@s uk-width-1-2@m" <div class="uk-width-1-1@s uk-width-1-2@m"
*ngIf="!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING"> *ngIf="!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING">
{{oldTotalResults|number}} <span class="uk-text-bold">{{oldTotalResults|number}}</span>
<span class="uk-text-muted uk-text-uppercase"> {{type}}, page </span> <span class="uk-text-muted uk-text-uppercase"> {{type}}, page </span>
{{searchUtils.page | number}} <span class="uk-text-bold">{{searchUtils.page | number}}</span>
<span class="uk-text-muted uk-text-uppercase"> of </span> <span class="uk-text-muted uk-text-uppercase"> of </span>
{{(totalPages(oldTotalResults)|number)}} <span class="uk-text-bold">{{(totalPages(oldTotalResults)|number)}}</span>
</div> </div>
<!--div class="uk-width-1-1@s uk-width-1-2@m" *ngIf="results && searchUtils.totalResults > 0"> <!--div class="uk-width-1-1@s uk-width-1-2@m" *ngIf="results && searchUtils.totalResults > 0">
{{searchUtils.totalResults|number}} {{type}}, page {{searchUtils.page | number}} of {{(totalPages(searchUtils.totalResults)|number)}} {{searchUtils.totalResults|number}} {{type}}, page {{searchUtils.page | number}} of {{(totalPages(searchUtils.totalResults)|number)}}
@ -29,55 +29,58 @@ import {ErrorCodes} from '../../utils/properties/errorCodes';
<div class="uk-width-1-1@s uk-width-1-2@m" *ngIf="!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING"> <div class="uk-width-1-1@s uk-width-1-2@m" *ngIf="!loadPaging && oldTotalResults > 0 && searchUtils.status == errorCodes.LOADING">
{{oldTotalResults|number}} {{type}}, page {{searchUtils.page | number}} of {{(totalPages(oldTotalResults)|number)}} {{oldTotalResults|number}} {{type}}, page {{searchUtils.page | number}} of {{(totalPages(oldTotalResults)|number)}}
</div--> </div-->
<div class="float-children-right-at-medium margin-small-top-at-small uk-width-expand" *ngIf="results && searchUtils.totalResults > searchUtils.size"> <div class="float-children-right-at-medium margin-small-top-at-small uk-width-expand"
<paging [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [baseUrl]="baseUrl" *ngIf="results && searchUtils.totalResults > searchUtils.size">
[size]="searchUtils.size" [parameterNames] = "parameterNames" [parameterValues] = "parameterValues" <paging [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [baseUrl]="baseUrl"
[isDisabled]="isDisabled"> [size]="searchUtils.size" [parameterNames]="parameterNames" [parameterValues]="parameterValues"
[isDisabled]="isDisabled">
</paging> </paging>
</div> </div>
<div class="float-children-right-at-medium margin-small-top-at-small uk-width-expand" *ngIf="!loadPaging && oldTotalResults > searchUtils.size && searchUtils.status == errorCodes.LOADING"> <div class="float-children-right-at-medium margin-small-top-at-small uk-width-expand"
<paging [currentPage]="searchUtils.page" [totalResults]="oldTotalResults" [baseUrl]="baseUrl" *ngIf="!loadPaging && oldTotalResults > searchUtils.size && searchUtils.status == errorCodes.LOADING">
[size]="searchUtils.size" [parameterNames] = "parameterNames" [parameterValues] = "parameterValues" <paging [currentPage]="searchUtils.page" [totalResults]="oldTotalResults" [baseUrl]="baseUrl"
[isDisabled]="isDisabled"> [size]="searchUtils.size" [parameterNames]="parameterNames" [parameterValues]="parameterValues"
[isDisabled]="isDisabled">
</paging> </paging>
</div> </div>
</div> </div>
</div> </div>
` `
}) })
export class SearchPagingComponent { export class SearchPagingComponent {
@Input() isDisabled: boolean = false; @Input() isDisabled: boolean = false;
@Input() searchUtils; @Input() searchUtils;
@Input() results; @Input() results;
@Input() baseUrl; @Input() baseUrl;
@Input() type; @Input() type;
@Input() parameterNames:string[]; @Input() parameterNames: string[];
@Input() parameterValues:string[]; @Input() parameterValues: string[];
@Input() loadPaging: boolean = true; @Input() loadPaging: boolean = true;
@Input() oldTotalResults: number = 0; @Input() oldTotalResults: number = 0;
public totalResults: number = 0; public totalResults: number = 0;
public errorCodes:ErrorCodes = new ErrorCodes(); public errorCodes: ErrorCodes = new ErrorCodes();
// @Input() totalResults:number = 0; // @Input() totalResults:number = 0;
constructor () {} constructor() {
}
ngOnInit() {
// this.totalResults = this.searchUtils.totalResults; ngOnInit() {
// if(!this.loadPaging && this.totalResults == 0) { // this.totalResults = this.searchUtils.totalResults;
// this.totalResults = this.oldTotalResults; // if(!this.loadPaging && this.totalResults == 0) {
// } // this.totalResults = this.oldTotalResults;
// }
}
totalPages(totalResults: number): number {
let totalPages: any = totalResults / (this.searchUtils.size);
if (!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
} }
return totalPages;
totalPages(totalResults: number): number { }
let totalPages:any = totalResults/(this.searchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
return totalPages;
}
} }