ng2-pagination
Advanced tools
Comparing version 0.3.5 to 0.4.0
@@ -0,5 +1,11 @@ | ||
# 0.4.0 (2016-09-09) | ||
* Update codebase to **Angular 2 rc.6**. Breaking change: now using NgModules, see readme for new usage guide. | ||
* Fix PaginatePipe bug when itemsPerPage is passed as a string ([#61](https://github.com/michaelbromley/ng2-pagination/pull/61)) | ||
* Fix change detection issue when correcting out-of-bounds currentPage value ([#48](https://github.com/michaelbromley/ng2-pagination/issues/48)), [#69](https://github.com/michaelbromley/ng2-pagination/issues/69) | ||
* (build) Update karma-webpack, prune test output. | ||
# 0.3.5 (2016-07-14) | ||
* Update codebase to **Angular 2 rc.4**. | ||
* Fix default template showing up when using custom templates (#45) | ||
* Fix buggy autoHide behaviour (#57) | ||
* Fix default template showing up when using custom templates ([#45](https://github.com/michaelbromley/ng2-pagination/issues/45)) | ||
* Fix buggy autoHide behaviour ([#57](https://github.com/michaelbromley/ng2-pagination/issues/57)) | ||
@@ -6,0 +12,0 @@ # 0.3.4 (2016-06-16) |
@@ -175,3 +175,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
if (!serverSideMode && collection instanceof Array) { | ||
perPage = perPage || LARGE_NUMBER; | ||
perPage = +perPage || LARGE_NUMBER; | ||
start = (instance.currentPage - 1) * perPage; | ||
@@ -407,8 +407,14 @@ end = start + perPage; | ||
PaginationControlsCmp.prototype.updatePageLinks = function () { | ||
var _this = this; | ||
var inst = this.service.getInstance(this.id); | ||
this.pages = this.createPageArray(inst.currentPage, inst.itemsPerPage, inst.totalItems, this.maxSize); | ||
var correctedCurrentPage = this.outOfBoundCorrection(inst); | ||
if (correctedCurrentPage !== inst.currentPage) { | ||
this.setCurrent(correctedCurrentPage); | ||
setTimeout(function () { | ||
_this.setCurrent(correctedCurrentPage); | ||
_this.pages = _this.createPageArray(inst.currentPage, inst.itemsPerPage, inst.totalItems, _this.maxSize); | ||
}); | ||
} | ||
else { | ||
this.pages = this.createPageArray(inst.currentPage, inst.itemsPerPage, inst.totalItems, this.maxSize); | ||
} | ||
}; | ||
@@ -528,26 +534,45 @@ /** | ||
}); | ||
System.register("ng2-pagination", ["paginate-pipe", "pagination-service", "pagination-controls-cmp"], function(exports_5, context_5) { | ||
System.register("ng2-pagination", ['@angular/core', '@angular/common', "paginate-pipe", "pagination-service", "pagination-controls-cmp"], function(exports_5, context_5) { | ||
"use strict"; | ||
var __moduleName = context_5 && context_5.id; | ||
var core_4, common_1, paginate_pipe_1, pagination_service_3, pagination_controls_cmp_1; | ||
var Ng2PaginationModule; | ||
return { | ||
setters:[ | ||
function (core_4_1) { | ||
core_4 = core_4_1; | ||
}, | ||
function (common_1_1) { | ||
common_1 = common_1_1; | ||
}, | ||
function (paginate_pipe_1_1) { | ||
exports_5({ | ||
"PaginatePipe": paginate_pipe_1_1["PaginatePipe"] | ||
}); | ||
paginate_pipe_1 = paginate_pipe_1_1; | ||
}, | ||
function (pagination_service_3_1) { | ||
exports_5({ | ||
"PaginationService": pagination_service_3_1["PaginationService"], | ||
"IPaginationInstance": pagination_service_3_1["IPaginationInstance"] | ||
}); | ||
pagination_service_3 = pagination_service_3_1; | ||
}, | ||
function (pagination_controls_cmp_1_1) { | ||
exports_5({ | ||
"PaginationControlsCmp": pagination_controls_cmp_1_1["PaginationControlsCmp"] | ||
}); | ||
pagination_controls_cmp_1 = pagination_controls_cmp_1_1; | ||
}], | ||
execute: function() { | ||
Ng2PaginationModule = (function () { | ||
function Ng2PaginationModule() { | ||
} | ||
Ng2PaginationModule = __decorate([ | ||
core_4.NgModule({ | ||
imports: [common_1.CommonModule], | ||
declarations: [ | ||
paginate_pipe_1.PaginatePipe, | ||
pagination_controls_cmp_1.PaginationControlsCmp | ||
], | ||
providers: [pagination_service_3.PaginationService], | ||
exports: [paginate_pipe_1.PaginatePipe, pagination_controls_cmp_1.PaginationControlsCmp] | ||
}), | ||
__metadata('design:paramtypes', []) | ||
], Ng2PaginationModule); | ||
return Ng2PaginationModule; | ||
}()); | ||
exports_5("Ng2PaginationModule", Ng2PaginationModule); | ||
} | ||
} | ||
}); |
@@ -1,3 +0,3 @@ | ||
export { PaginatePipe } from './paginate-pipe'; | ||
export { PaginationService, IPaginationInstance } from './pagination-service'; | ||
export { PaginationControlsCmp } from './pagination-controls-cmp'; | ||
export { IPaginationInstance } from './pagination-service'; | ||
export declare class Ng2PaginationModule { | ||
} |
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
var core_1 = require('@angular/core'); | ||
var common_1 = require('@angular/common'); | ||
var paginate_pipe_1 = require('./paginate-pipe'); | ||
exports.PaginatePipe = paginate_pipe_1.PaginatePipe; | ||
var pagination_service_1 = require('./pagination-service'); | ||
exports.PaginationService = pagination_service_1.PaginationService; | ||
var pagination_controls_cmp_1 = require('./pagination-controls-cmp'); | ||
exports.PaginationControlsCmp = pagination_controls_cmp_1.PaginationControlsCmp; | ||
var Ng2PaginationModule = (function () { | ||
function Ng2PaginationModule() { | ||
} | ||
Ng2PaginationModule = __decorate([ | ||
core_1.NgModule({ | ||
imports: [common_1.CommonModule], | ||
declarations: [ | ||
paginate_pipe_1.PaginatePipe, | ||
pagination_controls_cmp_1.PaginationControlsCmp | ||
], | ||
providers: [pagination_service_1.PaginationService], | ||
exports: [paginate_pipe_1.PaginatePipe, pagination_controls_cmp_1.PaginationControlsCmp] | ||
}), | ||
__metadata('design:paramtypes', []) | ||
], Ng2PaginationModule); | ||
return Ng2PaginationModule; | ||
}()); | ||
exports.Ng2PaginationModule = Ng2PaginationModule; |
@@ -45,3 +45,3 @@ "use strict"; | ||
if (!serverSideMode && collection instanceof Array) { | ||
perPage = perPage || LARGE_NUMBER; | ||
perPage = +perPage || LARGE_NUMBER; | ||
start = (instance.currentPage - 1) * perPage; | ||
@@ -48,0 +48,0 @@ end = start + perPage; |
@@ -126,8 +126,14 @@ "use strict"; | ||
PaginationControlsCmp.prototype.updatePageLinks = function () { | ||
var _this = this; | ||
var inst = this.service.getInstance(this.id); | ||
this.pages = this.createPageArray(inst.currentPage, inst.itemsPerPage, inst.totalItems, this.maxSize); | ||
var correctedCurrentPage = this.outOfBoundCorrection(inst); | ||
if (correctedCurrentPage !== inst.currentPage) { | ||
this.setCurrent(correctedCurrentPage); | ||
setTimeout(function () { | ||
_this.setCurrent(correctedCurrentPage); | ||
_this.pages = _this.createPageArray(inst.currentPage, inst.itemsPerPage, inst.totalItems, _this.maxSize); | ||
}); | ||
} | ||
else { | ||
this.pages = this.createPageArray(inst.currentPage, inst.itemsPerPage, inst.totalItems, this.maxSize); | ||
} | ||
}; | ||
@@ -134,0 +140,0 @@ /** |
{ | ||
"name": "ng2-pagination", | ||
"version": "0.3.5", | ||
"version": "0.4.0", | ||
"description": "Pagination for Angular 2", | ||
@@ -36,7 +36,8 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@angular/common": "2.0.0-rc.4", | ||
"@angular/compiler": "2.0.0-rc.4", | ||
"@angular/core": "2.0.0-rc.4", | ||
"@angular/platform-browser": "2.0.0-rc.4", | ||
"@angular/platform-browser-dynamic": "2.0.0-rc.4", | ||
"@angular/common": "2.0.0-rc.6", | ||
"@angular/compiler": "2.0.0-rc.6", | ||
"@angular/core": "2.0.0-rc.6", | ||
"@angular/forms": "2.0.0-rc.6", | ||
"@angular/platform-browser": "2.0.0-rc.6", | ||
"@angular/platform-browser-dynamic": "2.0.0-rc.6", | ||
"bulma": "^0.0.14", | ||
@@ -50,12 +51,12 @@ "core-js": "^2.4.0", | ||
"jasmine-core": "^2.4.1", | ||
"karma": "^0.13.15", | ||
"karma-chrome-launcher": "^0.2.2", | ||
"karma-jasmine": "^0.3.6", | ||
"karma-phantomjs-launcher": "^1.0.0", | ||
"karma-webpack": "^1.7.0", | ||
"karma": "1.2.0", | ||
"karma-chrome-launcher": "2.0.0", | ||
"karma-jasmine": "1.0.2", | ||
"karma-phantomjs-launcher": "1.0.2", | ||
"karma-webpack": "^1.8.0", | ||
"node-sass": "^3.6.0", | ||
"phantomjs-prebuilt": "^2.1.7", | ||
"raw-loader": "^0.5.1", | ||
"reflect-metadata": "0.1.2", | ||
"rxjs": "5.0.0-beta.6", | ||
"reflect-metadata": "0.1.3", | ||
"rxjs": "5.0.0-beta.11", | ||
"sass-loader": "^3.1.2", | ||
@@ -67,5 +68,5 @@ "style-loader": "^0.13.1", | ||
"webpack": "^1.12.9", | ||
"zone.js": "0.6.12" | ||
"zone.js": "0.6.17" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -21,4 +21,3 @@ # Angular2 Pagination [![Build Status](https://travis-ci.org/michaelbromley/ng2-pagination.svg?branch=master)](https://travis-ci.org/michaelbromley/ng2-pagination) | ||
Angular 2 is not yet stable, and API changes are ongoing. Therefore, if encountering errors using this | ||
lib, ensure your version of Angular is compatible. The current version used to develop this lib is angular2 **2.0.0-rc.4 +**. | ||
This library is built to work with **Angular 2 rc.6**. | ||
If you need to support a previous version of Angular 2 for now, please see the changelog for advice on which version to use. | ||
@@ -39,4 +38,19 @@ | ||
```TypeScript | ||
// app.module.ts | ||
import {NgModule} from '@angular/core'; | ||
import {BrowserModule} from '@angular/platform-browser'; | ||
import {Ng2PaginationModule} from 'ng2-pagination'; // <-- import the module | ||
imort {MyComponent} from './my.component'; | ||
@NgModule({ | ||
imports: [BrowserModule, Ng2PaginationModule], // <-- include it in your app module | ||
declarations: [MyComponent], | ||
bootstrap: [MyComponent] | ||
}) | ||
export class MyAppModule {} | ||
``` | ||
```TypeScript | ||
// my.component.ts | ||
import {Component} from '@angular/core'; | ||
import {PaginatePipe, PaginationControlsCmp, PaginationService} from 'ng2-pagination'; | ||
@@ -51,11 +65,6 @@ @Component({ | ||
<pagination-controls (pageChange)="p = $event"></pagination-controls> | ||
`, | ||
directives: [PaginationControlsCmp], | ||
pipes: [PaginatePipe], | ||
providers: [PaginationService] | ||
` | ||
}) | ||
export class MyComponent { | ||
public collection: any[] = someArrayOfThings; | ||
} | ||
@@ -174,3 +183,3 @@ ``` | ||
The key thing to note here is `#p` - this provides a local variable, `p`, which can be used in the | ||
The key thing to note here is `#pagination` - this provides a local variable, `pagination`, which can be used in the | ||
template to access the class' API methods and properties, which are explained below: | ||
@@ -187,3 +196,4 @@ | ||
* **`isFirstPage()`** [`() => boolean`] Returns true if the current page is the first page. | ||
* **`isLastPage()`** [`() => boolean`] Returns true if the current page is the last page/ | ||
* **`isLastPage()`** [`() => boolean`] Returns true if the current page is the last page | ||
* **`getLastPage()`** [`() => number`] Returns the page number of the last page. | ||
@@ -202,9 +212,4 @@ ## Build | ||
## Dart Version | ||
For Dart users, there is a Dart port available here: https://github.com/laagland/ng2-dart-pagination. Note that this | ||
version was written and is maintained by a different author and may not be up-to-date with this repo. | ||
## License | ||
MIT |
75769
1290
210
31