ngc-pagination
Advanced tools
Comparing version 0.1.4 to 0.2.4
@@ -66,2 +66,3 @@ import { BehaviorSubject } from 'rxjs/BehaviorSubject'; | ||
} | ||
else { | ||
@@ -106,3 +107,3 @@ this.buttonsDisabled = false; | ||
private createPagination() { | ||
this.config.getValue().totalPages = this.config.getValue().totalItens < this.config.getValue().itensPerPage ? 1 : Math.round(this.config.getValue().totalItens / this.config.getValue().itensPerPage); | ||
this.config.getValue().totalPages = this.config.getValue().totalItens < this.config.getValue().itensPerPage ? 1 : Math.ceil(this.config.getValue().totalItens / this.config.getValue().itensPerPage); | ||
this.config.getValue().pagination = []; | ||
@@ -116,10 +117,10 @@ | ||
private createExibition() { | ||
let start = Math.floor((this.config.getValue().currentPage-1) - this.config.getValue().range/2 < 0 ? 0 : this.config.getValue().currentPage-this.config.getValue().range/2); | ||
let end = Math.floor(this.config.getValue().currentPage < this.config.getValue().range/2 ? this.config.getValue().range : (this.config.getValue().currentPage) + this.config.getValue().range/2); | ||
let start = Math.ceil((this.config.getValue().currentPage-1) - this.config.getValue().range/2 < 0 ? 0 : (this.config.getValue().currentPage - 1) -this.config.getValue().range/2); | ||
let end = Math.ceil(this.config.getValue().currentPage <= this.config.getValue().range/2 ? this.config.getValue().range+1 : (this.config.getValue().currentPage) + (this.config.getValue().range/2)); | ||
let diff = end - this.config.getValue().pagination.length; | ||
if (diff > 0) { | ||
let startCount = this.config.getValue().pagination.length - this.config.getValue().range -1; | ||
start = startCount < 0 ? 0 : startCount; | ||
end -= diff; | ||
start -= diff; | ||
} | ||
@@ -126,0 +127,0 @@ |
{ | ||
"name": "ngc-pagination", | ||
"version": "0.1.4", | ||
"version": "0.2.4", | ||
"description": "Simple pagination for Angular v4+", | ||
@@ -5,0 +5,0 @@ "scripts": { |
# ngc-pagination | ||
Simple pagination for Angular v2+ | ||
Simple pagination for Angular v4+ | ||
@@ -5,0 +5,0 @@ ![](http://g.recordit.co/hMI2hoTtG7.gif) |
15453
199