pos-gis/public/assets/js/pagination.min.js

1 line
13 KiB
JavaScript
Raw Normal View History

2024-10-07 06:13:42 +00:00
!function(a,b){function c(a){throw new Error("Pagination: "+a)}function d(a){a.dataSource||c('"dataSource" is required.'),"string"==typeof a.dataSource?void 0===a.totalNumberLocator?void 0===a.totalNumber?c('"totalNumber" is required.'):b.isNumeric(a.totalNumber)||c('"totalNumber" is incorrect. (Number)'):b.isFunction(a.totalNumberLocator)||c('"totalNumberLocator" should be a Function.'):i.isObject(a.dataSource)&&(void 0===a.locator?c('"dataSource" is an Object, please specify "locator".'):"string"==typeof a.locator||b.isFunction(a.locator)||c(a.locator+" is incorrect. (String | Function)")),void 0===a.formatResult||b.isFunction(a.formatResult)||c('"formatResult" should be a Function.')}function e(a){var c=["go","previous","next","disable","enable","refresh","show","hide","destroy"];b.each(c,(function(b,c){a.off(h+c)})),a.data("pagination",{}),b(".paginationjs",a).remove()}function f(a,b){return("object"==(b=typeof a)?null==a?"null":Object.prototype.toString.call(a).slice(8,-1):b).toLowerCase()}void 0===b&&c("Pagination requires jQuery.");var g="pagination",h="__pagination-";b.fn.pagination&&(g="pagination2"),b.fn[g]=function(f){if(void 0===f)return this;var j=b(this),k=b.extend({},b.fn[g].defaults,f),l={initialize:function(){var a=this;if(j.data("pagination")||j.data("pagination",{}),!1!==a.callHook("beforeInit")){j.data("pagination").initialized&&b(".paginationjs",j).remove(),a.disabled=!!k.disabled;var c=a.model={pageRange:k.pageRange,pageSize:k.pageSize};a.parseDataSource(k.dataSource,(function(b){a.isAsync=i.isString(b),i.isArray(b)&&(c.totalNumber=k.totalNumber=b.length),a.isDynamicTotalNumber=a.isAsync&&k.totalNumberLocator;var d=a.render(!0);k.className&&d.addClass(k.className),c.el=d,j["bottom"===k.position?"append":"prepend"](d),a.observer(),j.data("pagination").initialized=!0,a.callHook("afterInit",d)}))}},render:function(a){var c=this,d=c.model,e=d.el||b('<div class="paginationjs"></div>'),f=!0!==a;c.callHook("beforeRender",f);var g=d.pageNumber||k.pageNumber,h=k.pageRange||0,i=c.getTotalPage(),j=g-h,l=g+h;return l>i&&(l=i,j=(j=i-2*h)<1?1:j),j<=1&&(j=1,l=Math.min(2*h+1,i)),e.html(c.generateHTML({currentPage:g,pageRange:h,rangeStart:j,rangeEnd:l})),k.hideWhenLessThanOnePage&&e[i<=1?"hide":"show"](),c.callHook("afterRender",f),e},generatePageNumbersHTML:function(a){var b,c=this,d=a.currentPage,e=c.getTotalPage(),f=a.rangeStart,g=a.rangeEnd,h="",i=k.pageLink,j=k.ellipsisText,l=k.classPrefix,m=k.activeClassName,n=k.disableClassName;if(null===k.pageRange){for(b=1;b<=e;b++)h+=b==d?'<li class="'+l+"-page J-paginationjs-page "+m+'" data-num="'+b+'"><a>'+b+"</a></li>":'<li class="'+l+'-page J-paginationjs-page" data-num="'+b+'"><a href="'+i+'">'+b+"</a></li>";return h}if(f<=3)for(b=1;b<f;b++)h+=b==d?'<li class="'+l+"-page J-paginationjs-page "+m+'" data-num="'+b+'"><a>'+b+"</a></li>":'<li class="'+l+'-page J-paginationjs-page" data-num="'+b+'"><a href="'+i+'">'+b+"</a></li>";else k.showFirstOnEllipsisShow&&(h+='<li class="'+l+"-page "+l+'-first J-paginationjs-page" data-num="1"><a href="'+i+'">1</a></li>'),h+='<li class="'+l+"-ellipsis "+n+'"><a>'+j+"</a></li>";for(b=f;b<=g;b++)h+=b==d?'<li class="'+l+"-page J-paginationjs-page "+m+'" data-num="'+b+'"><a>'+b+"</a></li>":'<li class="'+l+'-page J-paginationjs-page" data-num="'+b+'"><a href="'+i+'">'+b+"</a></li>";if(g>=e-2)for(b=g+1;b<=e;b++)h+='<li class="'+l+'-page J-paginationjs-page" data-num="'+b+'"><a href="'+i+'">'+b+"</a></li>";else h+='<li class="'+l+"-ellipsis "+n+'"><a>'+j+"</a></li>",k.showLastOnEllipsisShow&&(h+='<li class="'+l+"-page "+l+'-last J-paginationjs-page" data-num="'+e+'"><a href="'+i+'">'+e+"</a></li>");return h},generateHTML:function(a){var c,d=this,e=a.currentPage,f=d.getTotalPage(),g=d.getTotalNumber(),h=k.showPrevious,i=k.showNext,j=k.showPageNumbers,l=k.showNavigator,m=k.showGoInput,n=k.showGoButton,o=k.pageLink,p=k.prevText,q=k.nextText,r=k.goButtonText,s=k.classPrefix,t=k.disableClassName,u=k.ulClassName,v="",w='<input type="text" class="J-paginationjs-go-pagenumber">',x='<input type="button" class="J-paginationjs-go-button" value="'+r+'