!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.VuePagination=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o\n <<\n\n\n\n
  • \n<\n
  • \n\n
  • \n{{page}}\n
  • \n\n
  • \n>\n
  • \n\n
  • \n>>\n
  • \n\n\n

    {{count}}

    \n\n'},{}],2:[function(require,module,exports){function range(start,count){return Array.apply(0,Array(count)).map(function(element,index){return index+start})}exports.install=function(Vue){Vue.component("pagination",{template:require("./src/template.html"),data:function(){return{page:1}},props:{"for":{type:String,required:!0},records:{type:Number,required:!0},perPage:{type:Number,required:!1,"default":25},chunk:{type:Number,required:!1,"default":10},countText:{type:String,required:!1,"default":"{count} records"}},computed:{pages:function(){return this.records?range(this.paginationStart,this.pagesInCurrentChunk):[]},totalPages:function(){return this.records?Math.ceil(this.records/this.perPage):1},totalChunks:function(){return Math.ceil(this.totalPages/this.chunk)},currentChunk:function(){return Math.ceil(this.page/this.chunk)},paginationStart:function(){return(this.currentChunk-1)*this.chunk+1},count:function(){return this.countText.replace("{count}",this.records)},pagesInCurrentChunk:function(){return this.paginationStart+this.chunk<=this.totalPages?this.chunk:this.totalPages-this.paginationStart+1}},methods:{setPage:function(page){return this.allowedPage(page)?(this.page=page,this.$dispatch("vue-pagination::"+this["for"],page),!0):!1},next:function(){return this.setPage(this.page+1)},prev:function(){return this.setPage(this.page-1)},nextChunk:function(){return this.setChunk(1)},prevChunk:function(){return this.setChunk(-1)},setChunk:function(direction){this.setPage((this.currentChunk-1+direction)*this.chunk+1)},allowedPage:function(page){return page>=1&&page<=this.totalPages},allowedChunk:function(direction){return 1==direction&&this.currentChunk1},isActive:function(page){return this.page==page}}})}},{"./src/template.html":1}]},{},[2])(2)});