vue-sliding-pagination
Advanced tools
Comparing version 1.0.6 to 1.1.0
@@ -1,1 +0,1 @@ | ||
!function(i){var e={};function t(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return i[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}t.m=i,t.c=e,t.d=function(i,e,n){t.o(i,e)||Object.defineProperty(i,e,{enumerable:!0,get:n})},t.r=function(i){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},t.t=function(i,e){if(1&e&&(i=t(i)),8&e)return i;if(4&e&&"object"==typeof i&&i&&i.__esModule)return i;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:i}),2&e&&"string"!=typeof i)for(var a in i)t.d(n,a,function(e){return i[e]}.bind(null,a));return n},t.n=function(i){var e=i&&i.__esModule?function(){return i.default}:function(){return i};return t.d(e,"a",e),e},t.o=function(i,e){return Object.prototype.hasOwnProperty.call(i,e)},t.p="",t(t.s=2)}([function(i,e,t){},function(i,e,t){"use strict";var n=t(0);t.n(n).a},function(i,e,t){"use strict";t.r(e);var n=function(){var i=this,e=i.$createElement,t=i._self._c||e;return t("nav",{staticClass:"c-sliding-pagination",attrs:{"aria-label":i.ariaPaginationLabel}},[t("ul",{staticClass:"c-sliding-pagination__list"},[i.showPreviousPageAction?t("li",{staticClass:"c-sliding-pagination__list-element",class:1==i.current?"c-sliding-pagination__list-element--disabled":""},[t("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":i.ariaPreviousPageLabel,disabled:1==i.current},on:{click:function(e){return e.preventDefault(),e.stopPropagation(),i.goToPage(i.current-1)}}},[i._t("previous-page",[i._v("«")])],2)]):i._e(),i._l(i.beginningPages,(function(e){return t("li",{key:e,staticClass:"c-sliding-pagination__list-element",class:i.isCurrentPage(e)?"c-sliding-pagination__list-element--active":""},[t(i.pageComponent,{tag:"component",attrs:{"is-current":i.isCurrentPage(e),"aria-page-label":i.pageLabel(e),page:e},on:{"page-click":function(t){return i.goToPage(e)}}})],1)})),i.hasBeginningGap?t("li",{staticClass:"c-sliding-pagination__list-element c-sliding-pagination__list-element--disabled",attrs:{"aria-hidden":"true"}},[t("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#",disabled:""}},[i._t("gap-left",[i._v("…")])],2)]):i._e(),i._l(i.slidingWindowPages,(function(e){return t("li",{key:e,staticClass:"c-sliding-pagination__list-element",class:i.isCurrentPage(e)?"c-sliding-pagination__list-element--active":""},[t(i.pageComponent,{tag:"component",attrs:{"is-current":i.isCurrentPage(e),"aria-page-label":i.pageLabel(e),page:e},on:{"page-click":function(t){return i.goToPage(e)}}})],1)})),i.hasEndingGap?t("li",{staticClass:"c-sliding-pagination__list-element c-sliding-pagination__list-element--disabled",attrs:{"aria-hidden":"true"}},[t("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#",disabled:""}},[i._t("gap-right",[i._v("…")])],2)]):i._e(),i._l(i.endingPages,(function(e){return t("li",{key:e,staticClass:"c-sliding-pagination__list-element",class:i.isCurrentPage(e)?"c-sliding-pagination__list-element--active":""},[t(i.pageComponent,{tag:"component",attrs:{"is-current":i.isCurrentPage(e),"aria-page-label":i.pageLabel(e),page:e},on:{"page-click":function(t){return i.goToPage(e)}}})],1)})),i.showNextPageAction?t("li",{staticClass:"c-sliding-pagination__list-element",class:i.current==i.total?"c-sliding-pagination__list-element--disabled":""},[t("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":i.ariaNextPageLabel,disabled:i.current==i.total},on:{click:function(e){return e.preventDefault(),e.stopPropagation(),i.goToPage(i.current+1)}}},[i._t("next-page",[i._v("»")])],2)]):i._e()],2)])};n._withStripped=!0;var a=function(){var i=this,e=i.$createElement;return(i._self._c||e)("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":i.ariaPageLabel},on:{click:function(e){return e.stopPropagation(),e.preventDefault(),i.goToPage(i.page)}}},[i._v("\n "+i._s(i.page)+"\n")])};function r(i,e,t,n,a,r,s,o){var l,g="function"==typeof i?i.options:i;if(e&&(g.render=e,g.staticRenderFns=t,g._compiled=!0),n&&(g.functional=!0),r&&(g._scopeId="data-v-"+r),s?(l=function(i){(i=i||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(i=__VUE_SSR_CONTEXT__),a&&a.call(this,i),i&&i._registeredComponents&&i._registeredComponents.add(s)},g._ssrRegister=l):a&&(l=o?function(){a.call(this,this.$root.$options.shadowRoot)}:a),l)if(g.functional){g._injectStyles=l;var u=g.render;g.render=function(i,e){return l.call(e),u(i,e)}}else{var c=g.beforeCreate;g.beforeCreate=c?[].concat(c,l):[l]}return{exports:i,options:g}}a._withStripped=!0;var s=r({name:"SlidingPaginationDefaultPage",props:{ariaPageLabel:{type:String,required:!0},isCurrent:{type:Boolean,required:!0},page:{type:Number,required:!0}},computed:{currentClass:function(){return this.isCurrent?"c-sliding-pagination__page--current":""}},methods:{goToPage:function(){this.$emit("page-click",this.page)}}},a,[],!1,null,null,null);s.options.__file="src/SlidingPaginationDefaultPage.vue";var o=s.exports;function l(i,e){var t=[];if("number"!=typeof i||"number"!=typeof e)return t;if(i>e){var n=i;i=e,e=n}for(var a=i;a<=e;a++)t.push(a);return t}var g={name:"SlidingPagination",props:{ariaPaginationLabel:{type:String,required:!1,default:"Pagination Navigation"},ariaGotoPageLabel:{type:String,required:!1,default:"Go to page %page% of %total%"},ariaPreviousPageLabel:{type:String,required:!1,default:"Go to previous page"},ariaNextPageLabel:{type:String,required:!1,default:"Go to next page"},ariaCurrentPageLabel:{type:String,required:!1,default:"Page %page% of %total%, current page"},current:{required:!0,type:Number},total:{required:!0,type:Number},slidingEndingSize:{required:!1,type:Number,default:2},slidingWindowSize:{required:!1,type:Number,default:3},nonSlidingSize:{required:!1,type:Number,default:9},pageComponent:{required:!1,type:String,default:"sliding-pagination-default-page"}},components:{SlidingPaginationDefaultPage:o},computed:{isSliding:function(){return this.total>this.nonSlidingSize},hasBeginningGap:function(){return!!this.isSliding&&this.lastBeginningPage+1!==this.firstWindowPage},hasEndingGap:function(){return!!this.isSliding&&this.lastWindowPage+1!==this.firstEndingPage},beginningPages:function(){return l(1,this.isSliding?this.slidingEndingSize:this.total)},lastBeginningPage:function(){return this.beginningPages[this.beginningPages.length-1]},endingPages:function(){return this.isSliding?l(this.total-this.slidingEndingSize+1,this.total):[]},firstEndingPage:function(){return this.endingPages[0]},slidingWindowHalf:function(){var i=this.slidingWindowSize/2;return this.slidingWindowSize%2==1&&(i-=.5),i},slidingWindowPages:function(){if(!this.isSliding)return[];var i=this.lastBeginningPage+this.slidingWindowHalf,e=this.firstEndingPage-this.slidingWindowHalf;if(this.current<=i)return l(this.lastBeginningPage+1,this.lastBeginningPage+this.slidingWindowSize);if(this.current>i&&this.current<e){var t=this.slidingWindowHalf;return this.slidingWindowSize%2==0&&(t/=2),l(-this.slidingWindowHalf+this.current,t+this.current)}return l(this.firstEndingPage-this.slidingWindowSize,this.firstEndingPage-1)},firstWindowPage:function(){return this.slidingWindowPages[0]},lastWindowPage:function(){return this.slidingWindowPages[this.slidingWindowPages.length-1]},showPreviousPageAction:function(){return this.total>this.nonSlidingSize},showNextPageAction:function(){return this.total>this.nonSlidingSize}},methods:{replaceLabelVars:function(i,e){return i.replace("%total%",this.total).replace("%page%",e)},isCurrentPage:function(i){return this.current===i},currentPageLabel:function(i){return this.replaceLabelVars(this.ariaCurrentPageLabel,i)},goToPage:function(i){this.$emit("page-change",i)},goToPageLabel:function(i){return this.replaceLabelVars(this.ariaGotoPageLabel,i)},pageLabel:function(i){return this.isCurrentPage(i)?this.currentPageLabel(i):this.goToPageLabel(i)}}},u=(t(1),r(g,n,[],!1,null,null,null));u.options.__file="src/SlidingPagination.vue";var c=u.exports;e.default={install:function(i,e){i.component("SlidingPagination",c)}}}]); | ||
!function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){},function(e){e.exports=JSON.parse('{"componentClass":"c-sliding-pagination","list":"c-sliding-pagination__list","element":"c-sliding-pagination__list-element","elementDisabled":"c-sliding-pagination__list-element--disabled","elementActive":"c-sliding-pagination__list-element--active","page":"c-sliding-pagination__page"}')},function(e,t,n){"use strict";var i=n(0);n.n(i).a},function(e,t,n){"use strict";n.r(t);var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("nav",{class:e.classMap.component,attrs:{"aria-label":e.ariaPaginationLabel}},[n("ul",{class:e.classMap.list},[e.showPreviousPageAction?n("li",{class:[e.classMap.element,1==e.current?e.classMap.elementDisabled:""]},[n("a",{class:e.classMap.page,attrs:{href:"#","aria-label":e.ariaPreviousPageLabel,disabled:1==e.current},on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.goToPage(e.current-1)}}},[e._t("previous-page",[e._v("«")])],2)]):e._e(),e._l(e.beginningPages,(function(t){return n("li",{key:t,class:[e.classMap.element,e.isCurrentPage(t)?e.classMap.elementActive:""]},[n(e.pageComponent,{tag:"component",attrs:{"is-current":e.isCurrentPage(t),"aria-page-label":e.pageLabel(t),page:t,"page-class":e.classMap.page},on:{"page-click":function(n){return e.goToPage(t)}}})],1)})),e.hasBeginningGap?n("li",{class:[e.classMap.element,e.classMap.elementDisabled],attrs:{"aria-hidden":"true"}},[n("a",{class:e.classMap.page,attrs:{href:"#",disabled:""}},[e._t("gap-left",[e._v("…")])],2)]):e._e(),e._l(e.slidingWindowPages,(function(t){return n("li",{key:t,class:[e.classMap.element,e.isCurrentPage(t)?e.classMap.elementActive:""]},[n(e.pageComponent,{tag:"component",attrs:{"is-current":e.isCurrentPage(t),"aria-page-label":e.pageLabel(t),page:t,"page-class":e.classMap.page},on:{"page-click":function(n){return e.goToPage(t)}}})],1)})),e.hasEndingGap?n("li",{class:[e.classMap.element,e.classMap.elementDisabled],attrs:{"aria-hidden":"true"}},[n("a",{class:e.classMap.page,attrs:{href:"#",disabled:""}},[e._t("gap-right",[e._v("…")])],2)]):e._e(),e._l(e.endingPages,(function(t){return n("li",{key:t,class:[e.classMap.element,e.isCurrentPage(t)?e.classMap.elementActive:""]},[n(e.pageComponent,{tag:"component",attrs:{"is-current":e.isCurrentPage(t),"aria-page-label":e.pageLabel(t),page:t,"page-class":e.classMap.page},on:{"page-click":function(n){return e.goToPage(t)}}})],1)})),e.showNextPageAction?n("li",{staticClass:"c-sliding-pagination__list-element",class:[e.classMap.element,e.current==e.total?e.classMap.elementDisabled:""]},[n("a",{class:e.classMap.page,attrs:{href:"#","aria-label":e.ariaNextPageLabel,disabled:e.current==e.total},on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.goToPage(e.current+1)}}},[e._t("next-page",[e._v("»")])],2)]):e._e()],2)])};i._withStripped=!0;var a=function(){var e=this,t=e.$createElement;return(e._self._c||t)("a",{class:e.pageClass,attrs:{href:"#","aria-label":e.ariaPageLabel},on:{click:function(t){return t.stopPropagation(),t.preventDefault(),e.goToPage(e.page)}}},[e._v("\n "+e._s(e.page)+"\n")])};function r(e,t,n,i,a,r,s,l){var o,g="function"==typeof e?e.options:e;if(t&&(g.render=t,g.staticRenderFns=n,g._compiled=!0),i&&(g.functional=!0),r&&(g._scopeId="data-v-"+r),s?(o=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),a&&a.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(s)},g._ssrRegister=o):a&&(o=l?function(){a.call(this,this.$root.$options.shadowRoot)}:a),o)if(g.functional){g._injectStyles=o;var u=g.render;g.render=function(e,t){return o.call(t),u(e,t)}}else{var c=g.beforeCreate;g.beforeCreate=c?[].concat(c,o):[o]}return{exports:e,options:g}}a._withStripped=!0;var s=r({name:"SlidingPaginationDefaultPage",props:{ariaPageLabel:{type:String,required:!0},isCurrent:{type:Boolean,required:!0},page:{type:Number,required:!0},pageClass:{type:String,required:!0}},computed:{currentClass:function(){return this.isCurrent?"c-sliding-pagination__page--current":""}},methods:{goToPage:function(){this.$emit("page-click",this.page)}}},a,[],!1,null,null,null);s.options.__file="src/SlidingPaginationDefaultPage.vue";var l=s.exports,o=n(1);function g(e,t){var n=[];if("number"!=typeof e||"number"!=typeof t)return n;if(e>t){var i=e;e=t,t=i}for(var a=e;a<=t;a++)n.push(a);return n}var u={name:"SlidingPagination",props:{ariaPaginationLabel:{type:String,required:!1,default:"Pagination Navigation"},ariaGotoPageLabel:{type:String,required:!1,default:"Go to page %page% of %total%"},ariaPreviousPageLabel:{type:String,required:!1,default:"Go to previous page"},ariaNextPageLabel:{type:String,required:!1,default:"Go to next page"},ariaCurrentPageLabel:{type:String,required:!1,default:"Page %page% of %total%, current page"},classMap:{type:Object,required:!1,default:function(){return o}},current:{required:!0,type:Number},total:{required:!0,type:Number},slidingEndingSize:{required:!1,type:Number,default:2},slidingWindowSize:{required:!1,type:Number,default:3},nonSlidingSize:{required:!1,type:Number,default:9},pageComponent:{required:!1,type:String,default:"sliding-pagination-default-page"}},components:{SlidingPaginationDefaultPage:l},computed:{isSliding:function(){return this.total>this.nonSlidingSize},hasBeginningGap:function(){return!!this.isSliding&&this.lastBeginningPage+1!==this.firstWindowPage},hasEndingGap:function(){return!!this.isSliding&&this.lastWindowPage+1!==this.firstEndingPage},beginningPages:function(){return g(1,this.isSliding?this.slidingEndingSize:this.total)},lastBeginningPage:function(){return this.beginningPages[this.beginningPages.length-1]},endingPages:function(){return this.isSliding?g(this.total-this.slidingEndingSize+1,this.total):[]},firstEndingPage:function(){return this.endingPages[0]},slidingWindowHalf:function(){var e=this.slidingWindowSize/2;return this.slidingWindowSize%2==1&&(e-=.5),e},slidingWindowPages:function(){if(!this.isSliding)return[];var e=this.lastBeginningPage+this.slidingWindowHalf,t=this.firstEndingPage-this.slidingWindowHalf;if(this.current<=e)return g(this.lastBeginningPage+1,this.lastBeginningPage+this.slidingWindowSize);if(this.current>e&&this.current<t){var n=this.slidingWindowHalf;return this.slidingWindowSize%2==0&&(n/=2),g(-this.slidingWindowHalf+this.current,n+this.current)}return g(this.firstEndingPage-this.slidingWindowSize,this.firstEndingPage-1)},firstWindowPage:function(){return this.slidingWindowPages[0]},lastWindowPage:function(){return this.slidingWindowPages[this.slidingWindowPages.length-1]},showPreviousPageAction:function(){return this.total>this.nonSlidingSize},showNextPageAction:function(){return this.total>this.nonSlidingSize}},methods:{replaceLabelVars:function(e,t){return e.replace("%total%",this.total).replace("%page%",t)},isCurrentPage:function(e){return this.current===e},currentPageLabel:function(e){return this.replaceLabelVars(this.ariaCurrentPageLabel,e)},goToPage:function(e){this.$emit("page-change",e)},goToPageLabel:function(e){return this.replaceLabelVars(this.ariaGotoPageLabel,e)},pageLabel:function(e){return this.isCurrentPage(e)?this.currentPageLabel(e):this.goToPageLabel(e)}}},c=(n(2),r(u,i,[],!1,null,null,null));c.options.__file="src/SlidingPagination.vue";var p=c.exports;t.default={install:function(e,t){e.component("SlidingPagination",p)}}}]); |
@@ -1,1 +0,1 @@ | ||
!function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define("vue-sliding-pagination",[],i):"object"==typeof exports?exports["vue-sliding-pagination"]=i():e["vue-sliding-pagination"]=i()}(window,(function(){return function(e){var i={};function t(n){if(i[n])return i[n].exports;var a=i[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}return t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,i){if(1&i&&(e=t(e)),8&i)return e;if(4&i&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&i&&"string"!=typeof e)for(var a in e)t.d(n,a,function(i){return e[i]}.bind(null,a));return n},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,i){return Object.prototype.hasOwnProperty.call(e,i)},t.p="",t(t.s=2)}([function(e,i,t){},function(e,i,t){"use strict";var n=t(0);t.n(n).a},function(e,i,t){"use strict";t.r(i),t.d(i,"range",(function(){return l}));var n=function(){var e=this,i=e.$createElement,t=e._self._c||i;return t("nav",{staticClass:"c-sliding-pagination",attrs:{"aria-label":e.ariaPaginationLabel}},[t("ul",{staticClass:"c-sliding-pagination__list"},[e.showPreviousPageAction?t("li",{staticClass:"c-sliding-pagination__list-element",class:1==e.current?"c-sliding-pagination__list-element--disabled":""},[t("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":e.ariaPreviousPageLabel,disabled:1==e.current},on:{click:function(i){return i.preventDefault(),i.stopPropagation(),e.goToPage(e.current-1)}}},[e._t("previous-page",[e._v("«")])],2)]):e._e(),e._l(e.beginningPages,(function(i){return t("li",{key:i,staticClass:"c-sliding-pagination__list-element",class:e.isCurrentPage(i)?"c-sliding-pagination__list-element--active":""},[t(e.pageComponent,{tag:"component",attrs:{"is-current":e.isCurrentPage(i),"aria-page-label":e.pageLabel(i),page:i},on:{"page-click":function(t){return e.goToPage(i)}}})],1)})),e.hasBeginningGap?t("li",{staticClass:"c-sliding-pagination__list-element c-sliding-pagination__list-element--disabled",attrs:{"aria-hidden":"true"}},[t("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#",disabled:""}},[e._t("gap-left",[e._v("…")])],2)]):e._e(),e._l(e.slidingWindowPages,(function(i){return t("li",{key:i,staticClass:"c-sliding-pagination__list-element",class:e.isCurrentPage(i)?"c-sliding-pagination__list-element--active":""},[t(e.pageComponent,{tag:"component",attrs:{"is-current":e.isCurrentPage(i),"aria-page-label":e.pageLabel(i),page:i},on:{"page-click":function(t){return e.goToPage(i)}}})],1)})),e.hasEndingGap?t("li",{staticClass:"c-sliding-pagination__list-element c-sliding-pagination__list-element--disabled",attrs:{"aria-hidden":"true"}},[t("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#",disabled:""}},[e._t("gap-right",[e._v("…")])],2)]):e._e(),e._l(e.endingPages,(function(i){return t("li",{key:i,staticClass:"c-sliding-pagination__list-element",class:e.isCurrentPage(i)?"c-sliding-pagination__list-element--active":""},[t(e.pageComponent,{tag:"component",attrs:{"is-current":e.isCurrentPage(i),"aria-page-label":e.pageLabel(i),page:i},on:{"page-click":function(t){return e.goToPage(i)}}})],1)})),e.showNextPageAction?t("li",{staticClass:"c-sliding-pagination__list-element",class:e.current==e.total?"c-sliding-pagination__list-element--disabled":""},[t("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":e.ariaNextPageLabel,disabled:e.current==e.total},on:{click:function(i){return i.preventDefault(),i.stopPropagation(),e.goToPage(e.current+1)}}},[e._t("next-page",[e._v("»")])],2)]):e._e()],2)])};n._withStripped=!0;var a=function(){var e=this,i=e.$createElement;return(e._self._c||i)("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":e.ariaPageLabel},on:{click:function(i){return i.stopPropagation(),i.preventDefault(),e.goToPage(e.page)}}},[e._v("\n "+e._s(e.page)+"\n")])};function r(e,i,t,n,a,r,s,o){var l,g="function"==typeof e?e.options:e;if(i&&(g.render=i,g.staticRenderFns=t,g._compiled=!0),n&&(g.functional=!0),r&&(g._scopeId="data-v-"+r),s?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),a&&a.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(s)},g._ssrRegister=l):a&&(l=o?function(){a.call(this,this.$root.$options.shadowRoot)}:a),l)if(g.functional){g._injectStyles=l;var u=g.render;g.render=function(e,i){return l.call(i),u(e,i)}}else{var d=g.beforeCreate;g.beforeCreate=d?[].concat(d,l):[l]}return{exports:e,options:g}}a._withStripped=!0;var s=r({name:"SlidingPaginationDefaultPage",props:{ariaPageLabel:{type:String,required:!0},isCurrent:{type:Boolean,required:!0},page:{type:Number,required:!0}},computed:{currentClass:function(){return this.isCurrent?"c-sliding-pagination__page--current":""}},methods:{goToPage:function(){this.$emit("page-click",this.page)}}},a,[],!1,null,null,null);s.options.__file="src/SlidingPaginationDefaultPage.vue";var o=s.exports;function l(e,i){var t=[];if("number"!=typeof e||"number"!=typeof i)return t;if(e>i){var n=e;e=i,i=n}for(var a=e;a<=i;a++)t.push(a);return t}var g={name:"SlidingPagination",props:{ariaPaginationLabel:{type:String,required:!1,default:"Pagination Navigation"},ariaGotoPageLabel:{type:String,required:!1,default:"Go to page %page% of %total%"},ariaPreviousPageLabel:{type:String,required:!1,default:"Go to previous page"},ariaNextPageLabel:{type:String,required:!1,default:"Go to next page"},ariaCurrentPageLabel:{type:String,required:!1,default:"Page %page% of %total%, current page"},current:{required:!0,type:Number},total:{required:!0,type:Number},slidingEndingSize:{required:!1,type:Number,default:2},slidingWindowSize:{required:!1,type:Number,default:3},nonSlidingSize:{required:!1,type:Number,default:9},pageComponent:{required:!1,type:String,default:"sliding-pagination-default-page"}},components:{SlidingPaginationDefaultPage:o},computed:{isSliding:function(){return this.total>this.nonSlidingSize},hasBeginningGap:function(){return!!this.isSliding&&this.lastBeginningPage+1!==this.firstWindowPage},hasEndingGap:function(){return!!this.isSliding&&this.lastWindowPage+1!==this.firstEndingPage},beginningPages:function(){return l(1,this.isSliding?this.slidingEndingSize:this.total)},lastBeginningPage:function(){return this.beginningPages[this.beginningPages.length-1]},endingPages:function(){return this.isSliding?l(this.total-this.slidingEndingSize+1,this.total):[]},firstEndingPage:function(){return this.endingPages[0]},slidingWindowHalf:function(){var e=this.slidingWindowSize/2;return this.slidingWindowSize%2==1&&(e-=.5),e},slidingWindowPages:function(){if(!this.isSliding)return[];var e=this.lastBeginningPage+this.slidingWindowHalf,i=this.firstEndingPage-this.slidingWindowHalf;if(this.current<=e)return l(this.lastBeginningPage+1,this.lastBeginningPage+this.slidingWindowSize);if(this.current>e&&this.current<i){var t=this.slidingWindowHalf;return this.slidingWindowSize%2==0&&(t/=2),l(-this.slidingWindowHalf+this.current,t+this.current)}return l(this.firstEndingPage-this.slidingWindowSize,this.firstEndingPage-1)},firstWindowPage:function(){return this.slidingWindowPages[0]},lastWindowPage:function(){return this.slidingWindowPages[this.slidingWindowPages.length-1]},showPreviousPageAction:function(){return this.total>this.nonSlidingSize},showNextPageAction:function(){return this.total>this.nonSlidingSize}},methods:{replaceLabelVars:function(e,i){return e.replace("%total%",this.total).replace("%page%",i)},isCurrentPage:function(e){return this.current===e},currentPageLabel:function(e){return this.replaceLabelVars(this.ariaCurrentPageLabel,e)},goToPage:function(e){this.$emit("page-change",e)},goToPageLabel:function(e){return this.replaceLabelVars(this.ariaGotoPageLabel,e)},pageLabel:function(e){return this.isCurrentPage(e)?this.currentPageLabel(e):this.goToPageLabel(e)}}},u=(t(1),r(g,n,[],!1,null,null,null));u.options.__file="src/SlidingPagination.vue";i.default=u.exports}])})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("vue-sliding-pagination",[],t):"object"==typeof exports?exports["vue-sliding-pagination"]=t():e["vue-sliding-pagination"]=t()}(window,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){},function(e){e.exports=JSON.parse('{"componentClass":"c-sliding-pagination","list":"c-sliding-pagination__list","element":"c-sliding-pagination__list-element","elementDisabled":"c-sliding-pagination__list-element--disabled","elementActive":"c-sliding-pagination__list-element--active","page":"c-sliding-pagination__page"}')},function(e,t,n){"use strict";var i=n(0);n.n(i).a},function(e,t,n){"use strict";n.r(t),n.d(t,"range",(function(){return g}));var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("nav",{class:e.classMap.component,attrs:{"aria-label":e.ariaPaginationLabel}},[n("ul",{class:e.classMap.list},[e.showPreviousPageAction?n("li",{class:[e.classMap.element,1==e.current?e.classMap.elementDisabled:""]},[n("a",{class:e.classMap.page,attrs:{href:"#","aria-label":e.ariaPreviousPageLabel,disabled:1==e.current},on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.goToPage(e.current-1)}}},[e._t("previous-page",[e._v("«")])],2)]):e._e(),e._l(e.beginningPages,(function(t){return n("li",{key:t,class:[e.classMap.element,e.isCurrentPage(t)?e.classMap.elementActive:""]},[n(e.pageComponent,{tag:"component",attrs:{"is-current":e.isCurrentPage(t),"aria-page-label":e.pageLabel(t),page:t,"page-class":e.classMap.page},on:{"page-click":function(n){return e.goToPage(t)}}})],1)})),e.hasBeginningGap?n("li",{class:[e.classMap.element,e.classMap.elementDisabled],attrs:{"aria-hidden":"true"}},[n("a",{class:e.classMap.page,attrs:{href:"#",disabled:""}},[e._t("gap-left",[e._v("…")])],2)]):e._e(),e._l(e.slidingWindowPages,(function(t){return n("li",{key:t,class:[e.classMap.element,e.isCurrentPage(t)?e.classMap.elementActive:""]},[n(e.pageComponent,{tag:"component",attrs:{"is-current":e.isCurrentPage(t),"aria-page-label":e.pageLabel(t),page:t,"page-class":e.classMap.page},on:{"page-click":function(n){return e.goToPage(t)}}})],1)})),e.hasEndingGap?n("li",{class:[e.classMap.element,e.classMap.elementDisabled],attrs:{"aria-hidden":"true"}},[n("a",{class:e.classMap.page,attrs:{href:"#",disabled:""}},[e._t("gap-right",[e._v("…")])],2)]):e._e(),e._l(e.endingPages,(function(t){return n("li",{key:t,class:[e.classMap.element,e.isCurrentPage(t)?e.classMap.elementActive:""]},[n(e.pageComponent,{tag:"component",attrs:{"is-current":e.isCurrentPage(t),"aria-page-label":e.pageLabel(t),page:t,"page-class":e.classMap.page},on:{"page-click":function(n){return e.goToPage(t)}}})],1)})),e.showNextPageAction?n("li",{staticClass:"c-sliding-pagination__list-element",class:[e.classMap.element,e.current==e.total?e.classMap.elementDisabled:""]},[n("a",{class:e.classMap.page,attrs:{href:"#","aria-label":e.ariaNextPageLabel,disabled:e.current==e.total},on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.goToPage(e.current+1)}}},[e._t("next-page",[e._v("»")])],2)]):e._e()],2)])};i._withStripped=!0;var a=function(){var e=this,t=e.$createElement;return(e._self._c||t)("a",{class:e.pageClass,attrs:{href:"#","aria-label":e.ariaPageLabel},on:{click:function(t){return t.stopPropagation(),t.preventDefault(),e.goToPage(e.page)}}},[e._v("\n "+e._s(e.page)+"\n")])};function r(e,t,n,i,a,r,s,l){var o,g="function"==typeof e?e.options:e;if(t&&(g.render=t,g.staticRenderFns=n,g._compiled=!0),i&&(g.functional=!0),r&&(g._scopeId="data-v-"+r),s?(o=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),a&&a.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(s)},g._ssrRegister=o):a&&(o=l?function(){a.call(this,this.$root.$options.shadowRoot)}:a),o)if(g.functional){g._injectStyles=o;var u=g.render;g.render=function(e,t){return o.call(t),u(e,t)}}else{var c=g.beforeCreate;g.beforeCreate=c?[].concat(c,o):[o]}return{exports:e,options:g}}a._withStripped=!0;var s=r({name:"SlidingPaginationDefaultPage",props:{ariaPageLabel:{type:String,required:!0},isCurrent:{type:Boolean,required:!0},page:{type:Number,required:!0},pageClass:{type:String,required:!0}},computed:{currentClass:function(){return this.isCurrent?"c-sliding-pagination__page--current":""}},methods:{goToPage:function(){this.$emit("page-click",this.page)}}},a,[],!1,null,null,null);s.options.__file="src/SlidingPaginationDefaultPage.vue";var l=s.exports,o=n(1);function g(e,t){var n=[];if("number"!=typeof e||"number"!=typeof t)return n;if(e>t){var i=e;e=t,t=i}for(var a=e;a<=t;a++)n.push(a);return n}var u={name:"SlidingPagination",props:{ariaPaginationLabel:{type:String,required:!1,default:"Pagination Navigation"},ariaGotoPageLabel:{type:String,required:!1,default:"Go to page %page% of %total%"},ariaPreviousPageLabel:{type:String,required:!1,default:"Go to previous page"},ariaNextPageLabel:{type:String,required:!1,default:"Go to next page"},ariaCurrentPageLabel:{type:String,required:!1,default:"Page %page% of %total%, current page"},classMap:{type:Object,required:!1,default:function(){return o}},current:{required:!0,type:Number},total:{required:!0,type:Number},slidingEndingSize:{required:!1,type:Number,default:2},slidingWindowSize:{required:!1,type:Number,default:3},nonSlidingSize:{required:!1,type:Number,default:9},pageComponent:{required:!1,type:String,default:"sliding-pagination-default-page"}},components:{SlidingPaginationDefaultPage:l},computed:{isSliding:function(){return this.total>this.nonSlidingSize},hasBeginningGap:function(){return!!this.isSliding&&this.lastBeginningPage+1!==this.firstWindowPage},hasEndingGap:function(){return!!this.isSliding&&this.lastWindowPage+1!==this.firstEndingPage},beginningPages:function(){return g(1,this.isSliding?this.slidingEndingSize:this.total)},lastBeginningPage:function(){return this.beginningPages[this.beginningPages.length-1]},endingPages:function(){return this.isSliding?g(this.total-this.slidingEndingSize+1,this.total):[]},firstEndingPage:function(){return this.endingPages[0]},slidingWindowHalf:function(){var e=this.slidingWindowSize/2;return this.slidingWindowSize%2==1&&(e-=.5),e},slidingWindowPages:function(){if(!this.isSliding)return[];var e=this.lastBeginningPage+this.slidingWindowHalf,t=this.firstEndingPage-this.slidingWindowHalf;if(this.current<=e)return g(this.lastBeginningPage+1,this.lastBeginningPage+this.slidingWindowSize);if(this.current>e&&this.current<t){var n=this.slidingWindowHalf;return this.slidingWindowSize%2==0&&(n/=2),g(-this.slidingWindowHalf+this.current,n+this.current)}return g(this.firstEndingPage-this.slidingWindowSize,this.firstEndingPage-1)},firstWindowPage:function(){return this.slidingWindowPages[0]},lastWindowPage:function(){return this.slidingWindowPages[this.slidingWindowPages.length-1]},showPreviousPageAction:function(){return this.total>this.nonSlidingSize},showNextPageAction:function(){return this.total>this.nonSlidingSize}},methods:{replaceLabelVars:function(e,t){return e.replace("%total%",this.total).replace("%page%",t)},isCurrentPage:function(e){return this.current===e},currentPageLabel:function(e){return this.replaceLabelVars(this.ariaCurrentPageLabel,e)},goToPage:function(e){this.$emit("page-change",e)},goToPageLabel:function(e){return this.replaceLabelVars(this.ariaGotoPageLabel,e)},pageLabel:function(e){return this.isCurrentPage(e)?this.currentPageLabel(e):this.goToPageLabel(e)}}},c=(n(2),r(u,i,[],!1,null,null,null));c.options.__file="src/SlidingPagination.vue";t.default=c.exports}])})); |
@@ -64,2 +64,3 @@ # Guide | ||
| ariaCurrentPageLabel | String | `'Page %current of %total, current page'` | ARIA label for the current page | | ||
| classMap | Object | [default class map](#class-map) | CSS classes used by the components | ||
| current | Number | - | Integer representing the current page | | ||
@@ -205,1 +206,10 @@ | total | Number | - | Integer representing the total number of pages | | ||
``` | ||
#### Class Map | ||
If you need to adjust the class names inside the component, you can pass an object to reconfigure the `classMap` | ||
used to determine any CSS class inside the component. | ||
Here are the defaults: | ||
<<< @/src/defaultClassMap.json |
{ | ||
"name": "vue-sliding-pagination", | ||
"version": "1.0.6", | ||
"version": "1.1.0", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35965
12