ultimate-pagination
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -150,4 +150,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
return { | ||
type: ultimate_pagination_constants_1.ITEM_TYPES.PREVIOS_PAGE_LINK, | ||
key: ultimate_pagination_constants_1.ITEM_KEYS.PREVIOS_PAGE_LINK, | ||
type: ultimate_pagination_constants_1.ITEM_TYPES.PREVIOUS_PAGE_LINK, | ||
key: ultimate_pagination_constants_1.ITEM_KEYS.PREVIOUS_PAGE_LINK, | ||
value: Math.max(1, currentPage - 1), | ||
@@ -197,3 +197,3 @@ isActive: currentPage === 1 | ||
FIRST_PAGE_LINK: 'FIRST_PAGE_LINK', | ||
PREVIOS_PAGE_LINK: 'PREVIOS_PAGE_LINK', | ||
PREVIOUS_PAGE_LINK: 'PREVIOUS_PAGE_LINK', | ||
NEXT_PAGE_LINK: 'NEXT_PAGE_LINK', | ||
@@ -206,3 +206,3 @@ LAST_PAGE_LINK: 'LAST_PAGE_LINK' | ||
FIRST_PAGE_LINK: -3, | ||
PREVIOS_PAGE_LINK: -4, | ||
PREVIOUS_PAGE_LINK: -4, | ||
NEXT_PAGE_LINK: -5, | ||
@@ -209,0 +209,0 @@ LAST_PAGE_LINK: -6 |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ultimatePagination=t():e.ultimatePagination=t()}(this,function(){return function(e){function t(r){if(a[r])return a[r].exports;var n=a[r]={exports:{},id:r,loaded:!1};return e[r].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var a={};return t.m=e,t.c=a,t.p="",t(0)}([function(e,t,a){"use strict";function r(e){var t=e.currentPage,a=e.totalPages,r=[],i=E.createPageFunctionFactory(e),u=Math.max(2,Math.max(t-1,3)-Math.max(0,t+3-a)),P=Math.min(a-1,Math.min(t+1,a-2)+Math.max(0,4-t)),I=n.createRange(u,P).map(i);return r.push(E.createFirstPageLink(e)),r.push(E.createPreviousPageLink(e)),r.push(i(1)),u>3?r.push(E.createFirstEllipsis(u-1)):2!==u&&r.push(i(2)),r.push.apply(r,I),a-2>P?r.push(E.createSecondEllipsis(P+1)):P!==a-1&&r.push(i(a-1)),a>1&&r.push(i(a)),r.push(E.createNextPageLink(e)),r.push(E.createLastPageLink(e)),r}var n=a(3),E=a(2);t.getPaginationModel=r;var i=a(1);t.ITEM_TYPES=i.ITEM_TYPES,t.ITEM_KEYS=i.ITEM_KEYS},function(e,t){"use strict";t.ITEM_TYPES={PAGE:"PAGE",ELLIPSIS:"ELLIPSIS",FIRST_PAGE_LINK:"FIRST_PAGE_LINK",PREVIOS_PAGE_LINK:"PREVIOS_PAGE_LINK",NEXT_PAGE_LINK:"NEXT_PAGE_LINK",LAST_PAGE_LINK:"LAST_PAGE_LINK"},t.ITEM_KEYS={FIRST_ELLIPSIS:-1,SECOND_ELLISPIS:-2,FIRST_PAGE_LINK:-3,PREVIOS_PAGE_LINK:-4,NEXT_PAGE_LINK:-5,LAST_PAGE_LINK:-6}},function(e,t,a){"use strict";var r=a(1);t.createFirstEllipsis=function(e){return{type:r.ITEM_TYPES.ELLIPSIS,key:r.ITEM_KEYS.FIRST_ELLIPSIS,value:e,isActive:!1}},t.createSecondEllipsis=function(e){return{type:r.ITEM_TYPES.ELLIPSIS,key:r.ITEM_KEYS.SECOND_ELLISPIS,value:e,isActive:!1}},t.createFirstPageLink=function(e){var t=e.currentPage;return{type:r.ITEM_TYPES.FIRST_PAGE_LINK,key:r.ITEM_KEYS.FIRST_PAGE_LINK,value:1,isActive:1===t}},t.createPreviousPageLink=function(e){var t=e.currentPage;return{type:r.ITEM_TYPES.PREVIOS_PAGE_LINK,key:r.ITEM_KEYS.PREVIOS_PAGE_LINK,value:Math.max(1,t-1),isActive:1===t}},t.createNextPageLink=function(e){var t=e.currentPage,a=e.totalPages;return{type:r.ITEM_TYPES.NEXT_PAGE_LINK,key:r.ITEM_KEYS.NEXT_PAGE_LINK,value:Math.min(a,t+1),isActive:t===a}},t.createLastPageLink=function(e){var t=e.currentPage,a=e.totalPages;return{type:r.ITEM_TYPES.LAST_PAGE_LINK,key:r.ITEM_KEYS.LAST_PAGE_LINK,value:a,isActive:t===a}},t.createPageFunctionFactory=function(e){var t=e.currentPage;return function(e){return{type:r.ITEM_TYPES.PAGE,key:e,value:e,isActive:e===t}}}},function(e,t){"use strict";function a(e,t){for(var a=[],r=e;t>=r;r++)a.push(r);return a}t.createRange=a}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ultimatePagination=t():e.ultimatePagination=t()}(this,function(){return function(e){function t(r){if(a[r])return a[r].exports;var n=a[r]={exports:{},id:r,loaded:!1};return e[r].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var a={};return t.m=e,t.c=a,t.p="",t(0)}([function(e,t,a){"use strict";function r(e){var t=e.currentPage,a=e.totalPages,r=[],i=E.createPageFunctionFactory(e),u=Math.max(2,Math.max(t-1,3)-Math.max(0,t+3-a)),P=Math.min(a-1,Math.min(t+1,a-2)+Math.max(0,4-t)),I=n.createRange(u,P).map(i);return r.push(E.createFirstPageLink(e)),r.push(E.createPreviousPageLink(e)),r.push(i(1)),u>3?r.push(E.createFirstEllipsis(u-1)):2!==u&&r.push(i(2)),r.push.apply(r,I),P<a-2?r.push(E.createSecondEllipsis(P+1)):P!==a-1&&r.push(i(a-1)),a>1&&r.push(i(a)),r.push(E.createNextPageLink(e)),r.push(E.createLastPageLink(e)),r}var n=a(3),E=a(2);t.getPaginationModel=r;var i=a(1);t.ITEM_TYPES=i.ITEM_TYPES,t.ITEM_KEYS=i.ITEM_KEYS},function(e,t){"use strict";t.ITEM_TYPES={PAGE:"PAGE",ELLIPSIS:"ELLIPSIS",FIRST_PAGE_LINK:"FIRST_PAGE_LINK",PREVIOUS_PAGE_LINK:"PREVIOUS_PAGE_LINK",NEXT_PAGE_LINK:"NEXT_PAGE_LINK",LAST_PAGE_LINK:"LAST_PAGE_LINK"},t.ITEM_KEYS={FIRST_ELLIPSIS:-1,SECOND_ELLISPIS:-2,FIRST_PAGE_LINK:-3,PREVIOUS_PAGE_LINK:-4,NEXT_PAGE_LINK:-5,LAST_PAGE_LINK:-6}},function(e,t,a){"use strict";var r=a(1);t.createFirstEllipsis=function(e){return{type:r.ITEM_TYPES.ELLIPSIS,key:r.ITEM_KEYS.FIRST_ELLIPSIS,value:e,isActive:!1}},t.createSecondEllipsis=function(e){return{type:r.ITEM_TYPES.ELLIPSIS,key:r.ITEM_KEYS.SECOND_ELLISPIS,value:e,isActive:!1}},t.createFirstPageLink=function(e){var t=e.currentPage;return{type:r.ITEM_TYPES.FIRST_PAGE_LINK,key:r.ITEM_KEYS.FIRST_PAGE_LINK,value:1,isActive:1===t}},t.createPreviousPageLink=function(e){var t=e.currentPage;return{type:r.ITEM_TYPES.PREVIOUS_PAGE_LINK,key:r.ITEM_KEYS.PREVIOUS_PAGE_LINK,value:Math.max(1,t-1),isActive:1===t}},t.createNextPageLink=function(e){var t=e.currentPage,a=e.totalPages;return{type:r.ITEM_TYPES.NEXT_PAGE_LINK,key:r.ITEM_KEYS.NEXT_PAGE_LINK,value:Math.min(a,t+1),isActive:t===a}},t.createLastPageLink=function(e){var t=e.currentPage,a=e.totalPages;return{type:r.ITEM_TYPES.LAST_PAGE_LINK,key:r.ITEM_KEYS.LAST_PAGE_LINK,value:a,isActive:t===a}},t.createPageFunctionFactory=function(e){var t=e.currentPage;return function(e){return{type:r.ITEM_TYPES.PAGE,key:e,value:e,isActive:e===t}}}},function(e,t){"use strict";function a(e,t){for(var a=[],r=e;r<=t;r++)a.push(r);return a}t.createRange=a}])}); | ||
//# sourceMappingURL=ultimate-pagination.min.js.map |
export declare type PageItemType = 'PAGE'; | ||
export declare type EllipsisItemType = 'ELLIPSIS'; | ||
export declare type FirstPageLinkItemType = 'FIRST_PAGE_LINK'; | ||
export declare type PreviousPageLinkItemType = 'PREVIOS_PAGE_LINK'; | ||
export declare type PreviousPageLinkItemType = 'PREVIOUS_PAGE_LINK'; | ||
export declare type NextPageLinkItemType = 'NEXT_PAGE_LINK'; | ||
@@ -12,3 +12,3 @@ export declare type LastPageLinkItemType = 'LAST_PAGE_LINK'; | ||
FIRST_PAGE_LINK: FirstPageLinkItemType; | ||
PREVIOS_PAGE_LINK: PreviousPageLinkItemType; | ||
PREVIOUS_PAGE_LINK: PreviousPageLinkItemType; | ||
NEXT_PAGE_LINK: NextPageLinkItemType; | ||
@@ -21,3 +21,3 @@ LAST_PAGE_LINK: LastPageLinkItemType; | ||
FIRST_PAGE_LINK: number; | ||
PREVIOS_PAGE_LINK: number; | ||
PREVIOUS_PAGE_LINK: number; | ||
NEXT_PAGE_LINK: number; | ||
@@ -24,0 +24,0 @@ LAST_PAGE_LINK: number; |
@@ -6,3 +6,3 @@ "use strict"; | ||
FIRST_PAGE_LINK: 'FIRST_PAGE_LINK', | ||
PREVIOS_PAGE_LINK: 'PREVIOS_PAGE_LINK', | ||
PREVIOUS_PAGE_LINK: 'PREVIOUS_PAGE_LINK', | ||
NEXT_PAGE_LINK: 'NEXT_PAGE_LINK', | ||
@@ -15,3 +15,3 @@ LAST_PAGE_LINK: 'LAST_PAGE_LINK' | ||
FIRST_PAGE_LINK: -3, | ||
PREVIOS_PAGE_LINK: -4, | ||
PREVIOUS_PAGE_LINK: -4, | ||
NEXT_PAGE_LINK: -5, | ||
@@ -18,0 +18,0 @@ LAST_PAGE_LINK: -6 |
@@ -31,4 +31,4 @@ "use strict"; | ||
return { | ||
type: ultimate_pagination_constants_1.ITEM_TYPES.PREVIOS_PAGE_LINK, | ||
key: ultimate_pagination_constants_1.ITEM_KEYS.PREVIOS_PAGE_LINK, | ||
type: ultimate_pagination_constants_1.ITEM_TYPES.PREVIOUS_PAGE_LINK, | ||
key: ultimate_pagination_constants_1.ITEM_KEYS.PREVIOUS_PAGE_LINK, | ||
value: Math.max(1, currentPage - 1), | ||
@@ -35,0 +35,0 @@ isActive: currentPage === 1 |
{ | ||
"name": "ultimate-pagination", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "Universal pagination model generation algorithm that can be used to build a UI component", | ||
@@ -22,4 +22,11 @@ "keywords": [ | ||
"build:umd.min": "webpack --output-filename ultimate-pagination.min.js -p", | ||
"test": "karma start" | ||
"test": "karma start", | ||
"lint": "tslint src/* test/*", | ||
"validate": "npm-run-all --parallel test lint" | ||
}, | ||
"config": { | ||
"ghooks": { | ||
"pre-commit": "npm run validate" | ||
} | ||
}, | ||
"repository": { | ||
@@ -36,2 +43,3 @@ "type": "git", | ||
"devDependencies": { | ||
"ghooks": "^1.3.1", | ||
"jasmine-core": "^2.4.1", | ||
@@ -42,6 +50,7 @@ "karma": "^0.13.22", | ||
"karma-webpack": "^1.7.0", | ||
"npm-run-all": "^1.8.0", | ||
"npm-run-all": "^2.3.0", | ||
"phantomjs-prebuilt": "^2.1.7", | ||
"source-map-loader": "^0.1.5", | ||
"ts-loader": "^0.8.2", | ||
"tslint": "^3.13.0", | ||
"typescript": "^1.8.10", | ||
@@ -48,0 +57,0 @@ "webpack": "^1.13.0" |
@@ -5,3 +5,3 @@ [![ultimate-pagination logo](https://raw.githubusercontent.com/ultimate-pagination/logo/master/ultimate-pagination-250x250.png)](https://github.com/ultimate-pagination/ultimate-pagination) | ||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] | ||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]](travis-url) | ||
@@ -38,3 +38,3 @@ Universal pagination model generation algorithm that can be used to build a UI component for any JavaScript based platform/framework. The idea behind this module is to move the logic of creating pagination out of the component and place it in a separate module. It allows reusing the same code across different frameworks like Angular, Angular2, React, Ember, etc. Also, the same code can be used to generate pagination on server-side JavaScript frameworks. | ||
var paginationModel = ultimatePagination.getPaginationModel({ | ||
currentPage: 5, | ||
currentPage: 5, | ||
totalPages: 10 | ||
@@ -55,4 +55,4 @@ }); | ||
{ | ||
type: ITEM_TYPES.PREVIOS_PAGE_LINK, | ||
key: ITEM_KEYS.PREVIOS_PAGE_LINK, | ||
type: ITEM_TYPES.PREVIOUS_PAGE_LINK, | ||
key: ITEM_KEYS.PREVIOUS_PAGE_LINK, | ||
value: 4, | ||
@@ -130,3 +130,3 @@ isActive: false | ||
- `FIRST_PAGE_LINK` - a link to the first page | ||
- `PREVIOS_PAGE_LINK` - a link to the previous page | ||
- `PREVIOUS_PAGE_LINK` - a link to the previous page | ||
- `NEXT_PAGE_LINK` - a link to the next page | ||
@@ -138,1 +138,3 @@ - `LAST_PAGE_LINK` - a link to the last page | ||
[npm-image]: https://img.shields.io/npm/v/ultimate-pagination.svg | ||
[travis-image]: https://travis-ci.org/ultimate-pagination/ultimate-pagination.svg?branch=master | ||
[travis-url]: https://travis-ci.org/ultimate-pagination/ultimate-pagination |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
63092
136
13