vue-sliding-pagination
Advanced tools
Comparing version 1.0.0-beta-2 to 1.0.0-beta-3
@@ -1,1 +0,1 @@ | ||
window.VueSlidingPagination=function(n){function e(t){if(i[t])return i[t].exports;var a=i[t]={i:t,l:!1,exports:{}};return n[t].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var i={};return e.m=n,e.c=i,e.d=function(n,i,t){e.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:t})},e.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(i,"a",i),i},e.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},e.p="",e(e.s=3)}([function(n,e){n.exports=function(n,e,i,t,a,r){var s,o=n=n||{},l=typeof n.default;"object"!==l&&"function"!==l||(s=n,o=n.default);var g="function"==typeof o?o.options:o;e&&(g.render=e.render,g.staticRenderFns=e.staticRenderFns,g._compiled=!0),i&&(g.functional=!0),a&&(g._scopeId=a);var u;if(r?(u=function(n){n=n||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,n||"undefined"==typeof __VUE_SSR_CONTEXT__||(n=__VUE_SSR_CONTEXT__),t&&t.call(this,n),n&&n._registeredComponents&&n._registeredComponents.add(r)},g._ssrRegister=u):t&&(u=t),u){var c=g.functional,d=c?g.render:g.beforeCreate;c?(g._injectStyles=u,g.render=function(n,e){return u.call(e),d(n,e)}):g.beforeCreate=d?[].concat(d,u):[u]}return{esModule:s,exports:o,options:g}}},function(n,e,i){"use strict";function t(n,e){var i=[];if("number"!=typeof n||"number"!=typeof e)return i;if(n>e){var t=n;n=e,e=t}for(var a=n;a<=e;a++)i.push(a);return i}var a=i(10);e.a={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 %current% 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:a.a},computed:{isSliding:function(){return this.total>this.nonSlidingSize},hasBeginningGap:function(){return!!this.isSliding&&this.current>this.beginningPages[this.beginningPages.length-1]+this.slidingWindowHalf},hasEndingGap:function(){return!!this.isSliding&&this.current<this.endingPages[0]-this.slidingWindowHalf},beginningPages:function(){return t(1,this.isSliding?this.slidingEndingSize:this.total)},endingPages:function(){return this.isSliding?t(this.total-this.slidingEndingSize+1,this.total):[]},slidingWindowHalf:function(){var n=this.slidingWindowSize/2;return this.slidingEndingSize%2==0?Math.ceil(n):Math.floor(n)},slidingWindowPages:function(){var n=[];if(!this.isSliding)return n;if(this.current<=this.slidingEndingSize+this.slidingWindowHalf)n=t(this.slidingEndingSize+1,this.slidingEndingSize+this.slidingWindowSize);else if(this.current>=this.endingPages[0]-this.slidingWindowHalf)n=t(this.total-this.slidingEndingSize-this.slidingWindowSize+1,this.total-this.slidingEndingSize);else{var e=0;this.slidingWindowSize%2==0&&(e=1),n=t(this.current-Math.floor(this.slidingWindowHalf/2)-e,this.current+Math.ceil(this.slidingWindowHalf/2))}return n},showPreviousPageAction:function(){return this.total>this.nonSlidingSize},showNextPageAction:function(){return this.total>this.nonSlidingSize}},methods:{replaceLabelVars:function(n,e){return n.replace("%current%",this.current).replace("%total%",this.total).replace("%page%",e)},isCurrentPage:function(n){return this.current===n},currentPageLabel:function(n){return this.replaceLabelVars(this.ariaCurrentPageLabel,n)},goToPage:function(n){this.$emit("page-change",n)},goToPageLabel:function(n){return this.replaceLabelVars(this.ariaGotoPageLabel,n)},pageLabel:function(n){return this.isCurrentPage(n)?this.currentPageLabel(n):this.goToPageLabel(n)}}}},function(n,e,i){"use strict";e.a={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)}}}},function(n,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=i(4);e.default={install:function(n,e){n.component("SlidingPagination",t.a)}}},function(n,e,i){"use strict";function t(n){s||i(5)}var a=i(1),r=i(12),s=!1,o=i(0),l=t,g=o(a.a,r.a,!1,l,null,null);g.options.__file="src/SlidingPagination.vue",e.a=g.exports},function(n,e,i){var t=i(6);"string"==typeof t&&(t=[[n.i,t,""]]),t.locals&&(n.exports=t.locals);i(8)("6a470eb6",t,!1,{})},function(n,e,i){e=n.exports=i(7)(!1),e.push([n.i,"\n.c-sliding-pagination {\n pointer-events: all;\n}\n.c-sliding-pagination__list {\n display: inline;\n margin: 0;\n padding: 0;\n}\n.c-sliding-pagination__list-element {\n display: inline-block;\n background: #246068;\n color: #fff;\n padding: .6em;\n border-radius: .2em;\n margin: 0;\n margin-right: .2em;\n margin-bottom: 1em;\n -webkit-transition-duration: 300ms;\n transition-duration: 300ms;\n -webkit-transition-property: background, color;\n transition-property: background, color;\n}\n.c-sliding-pagination__list-element:hover {\n -webkit-transition-duration: 300ms;\n transition-duration: 300ms;\n -webkit-transition-property: background, color;\n transition-property: background, color;\n color: #e9e9e9;\n background: #69969c;\n}\n.c-sliding-pagination__list-element:last-of-type {\n margin-right: 0;\n}\n.c-sliding-pagination__list-element--active {\n background: #69969c;\n color: #e9e9e9;\n}\n.c-sliding-pagination__list-element--active:hover {\n color: #fff;\n background: #246068;\n cursor: default;\n}\n.c-sliding-pagination__list-element--disabled {\n background: none;\n color: inherit;\n cursor: not-allowed;\n}\n.c-sliding-pagination__page {\n color: inherit;\n padding: 0;\n margin: 0;\n text-decoration: none;\n}\n.c-sliding-pagination__page[disabled] {\n pointer-events: none;\n cursor: not-allowed;\n}\n",""])},function(n,e){function i(n,e){var i=n[1]||"",a=n[3];if(!a)return i;if(e&&"function"==typeof btoa){var r=t(a);return[i].concat(a.sources.map(function(n){return"/*# sourceURL="+a.sourceRoot+n+" */"})).concat([r]).join("\n")}return[i].join("\n")}function t(n){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */"}n.exports=function(n){var e=[];return e.toString=function(){return this.map(function(e){var t=i(e,n);return e[2]?"@media "+e[2]+"{"+t+"}":t}).join("")},e.i=function(n,i){"string"==typeof n&&(n=[[null,n,""]]);for(var t={},a=0;a<this.length;a++){var r=this[a][0];"number"==typeof r&&(t[r]=!0)}for(a=0;a<n.length;a++){var s=n[a];"number"==typeof s[0]&&t[s[0]]||(i&&!s[2]?s[2]=i:i&&(s[2]="("+s[2]+") and ("+i+")"),e.push(s))}},e}},function(n,e,i){function t(n){for(var e=0;e<n.length;e++){var i=n[e],t=u[i.id];if(t){t.refs++;for(var a=0;a<t.parts.length;a++)t.parts[a](i.parts[a]);for(;a<i.parts.length;a++)t.parts.push(r(i.parts[a]));t.parts.length>i.parts.length&&(t.parts.length=i.parts.length)}else{for(var s=[],a=0;a<i.parts.length;a++)s.push(r(i.parts[a]));u[i.id]={id:i.id,refs:1,parts:s}}}}function a(){var n=document.createElement("style");return n.type="text/css",c.appendChild(n),n}function r(n){var e,i,t=document.querySelector("style["+m+'~="'+n.id+'"]');if(t){if(f)return h;t.parentNode.removeChild(t)}if(v){var r=p++;t=d||(d=a()),e=s.bind(null,t,r,!1),i=s.bind(null,t,r,!0)}else t=a(),e=o.bind(null,t),i=function(){t.parentNode.removeChild(t)};return e(n),function(t){if(t){if(t.css===n.css&&t.media===n.media&&t.sourceMap===n.sourceMap)return;e(n=t)}else i()}}function s(n,e,i,t){var a=i?"":t.css;if(n.styleSheet)n.styleSheet.cssText=b(e,a);else{var r=document.createTextNode(a),s=n.childNodes;s[e]&&n.removeChild(s[e]),s.length?n.insertBefore(r,s[e]):n.appendChild(r)}}function o(n,e){var i=e.css,t=e.media,a=e.sourceMap;if(t&&n.setAttribute("media",t),_.ssrId&&n.setAttribute(m,e.id),a&&(i+="\n/*# sourceURL="+a.sources[0]+" */",i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),n.styleSheet)n.styleSheet.cssText=i;else{for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(document.createTextNode(i))}}var l="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!l)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var g=i(9),u={},c=l&&(document.head||document.getElementsByTagName("head")[0]),d=null,p=0,f=!1,h=function(){},_=null,m="data-vue-ssr-id",v="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());n.exports=function(n,e,i,a){f=i,_=a||{};var r=g(n,e);return t(r),function(e){for(var i=[],a=0;a<r.length;a++){var s=r[a],o=u[s.id];o.refs--,i.push(o)}e?(r=g(n,e),t(r)):r=[];for(var a=0;a<i.length;a++){var o=i[a];if(0===o.refs){for(var l=0;l<o.parts.length;l++)o.parts[l]();delete u[o.id]}}}};var b=function(){var n=[];return function(e,i){return n[e]=i,n.filter(Boolean).join("\n")}}()},function(n,e){n.exports=function(n,e){for(var i=[],t={},a=0;a<e.length;a++){var r=e[a],s=r[0],o=r[1],l=r[2],g=r[3],u={id:n+":"+a,css:o,media:l,sourceMap:g};t[s]?t[s].parts.push(u):i.push(t[s]={id:s,parts:[u]})}return i}},function(n,e,i){"use strict";var t=i(2),a=i(11),r=i(0),s=r(t.a,a.a,!1,null,null,null);s.options.__file="src/SlidingPaginationDefaultPage.vue",e.a=s.exports},function(n,e,i){"use strict";var t=function(){var n=this,e=n.$createElement;return(n._self._c||e)("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":n.ariaPageLabel},on:{click:function(e){e.stopPropagation(),e.preventDefault(),n.goToPage(n.page)}}},[n._v("\n "+n._s(n.page)+"\n")])},a=[];t._withStripped=!0;var r={render:t,staticRenderFns:a};e.a=r},function(n,e,i){"use strict";var t=function(){var n=this,e=n.$createElement,i=n._self._c||e;return i("nav",{staticClass:"c-sliding-pagination",attrs:{"aria-label":n.ariaPaginationLabel}},[i("ul",{staticClass:"c-sliding-pagination__list"},[n.showPreviousPageAction?i("li",{staticClass:"c-sliding-pagination__list-element",class:1==n.current?"c-sliding-pagination__list-element--disabled":""},[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":n.ariaPreviousPageLabel,disabled:1==n.current},on:{click:function(e){e.preventDefault(),e.stopPropagation(),n.goToPage(n.current-1)}}},[n._t("previous-page",[n._v("«")])],2)]):n._e(),n._l(n.beginningPages,function(e){return i("li",{key:e,staticClass:"c-sliding-pagination__list-element",class:n.isCurrentPage(e)?"c-sliding-pagination__list-element--active":""},[i(n.pageComponent,{tag:"component",attrs:{"is-current":n.isCurrentPage(e),"aria-page-label":n.pageLabel(e),page:e},on:{"page-click":function(i){n.goToPage(e)}}})],1)}),n.hasBeginningGap?i("li",{staticClass:"c-sliding-pagination__list-element c-sliding-pagination__list-element--disabled",attrs:{"aria-hidden":"true"}},[n._t("gap-left",[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#",disabled:""}},[n._v("\n …\n ")])])],2):n._e(),n._l(n.slidingWindowPages,function(e){return i("li",{key:e,staticClass:"c-sliding-pagination__list-element",class:n.isCurrentPage(e)?"c-sliding-pagination__list-element--active":""},[i(n.pageComponent,{tag:"component",attrs:{"is-current":n.isCurrentPage(e),"aria-page-label":n.pageLabel(e),page:e},on:{"page-click":function(i){n.goToPage(e)}}})],1)}),n.hasEndingGap?i("li",{staticClass:"c-sliding-pagination__list-element c-sliding-pagination__list-element--disabled",attrs:{"aria-hidden":"true"}},[n._t("gap-right",[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#",disabled:""}},[n._v("\n …\n ")])])],2):n._e(),n._l(n.endingPages,function(e){return i("li",{key:e,staticClass:"c-sliding-pagination__list-element",class:n.isCurrentPage(e)?"c-sliding-pagination__list-element--active":""},[i(n.pageComponent,{tag:"component",attrs:{"is-current":n.isCurrentPage(e),"aria-page-label":n.pageLabel(e),page:e},on:{"page-click":function(i){n.goToPage(e)}}})],1)}),n.showNextPageAction?i("li",{staticClass:"c-sliding-pagination__list-element",class:n.current==n.total?"c-sliding-pagination__list-element--disabled":""},[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":n.ariaNextPageLabel,disabled:n.current==n.total},on:{click:function(e){e.preventDefault(),e.stopPropagation(),n.goToPage(n.current+1)}}},[n._t("next-page",[n._v("»")])],2)]):n._e()],2)])},a=[];t._withStripped=!0;var r={render:t,staticRenderFns:a};e.a=r}]); | ||
window.VueSlidingPagination=function(n){function e(t){if(i[t])return i[t].exports;var a=i[t]={i:t,l:!1,exports:{}};return n[t].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var i={};return e.m=n,e.c=i,e.d=function(n,i,t){e.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:t})},e.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(i,"a",i),i},e.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},e.p="",e(e.s=3)}([function(n,e){n.exports=function(n,e,i,t,a,r){var s,o=n=n||{},l=typeof n.default;"object"!==l&&"function"!==l||(s=n,o=n.default);var g="function"==typeof o?o.options:o;e&&(g.render=e.render,g.staticRenderFns=e.staticRenderFns,g._compiled=!0),i&&(g.functional=!0),a&&(g._scopeId=a);var u;if(r?(u=function(n){n=n||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,n||"undefined"==typeof __VUE_SSR_CONTEXT__||(n=__VUE_SSR_CONTEXT__),t&&t.call(this,n),n&&n._registeredComponents&&n._registeredComponents.add(r)},g._ssrRegister=u):t&&(u=t),u){var c=g.functional,d=c?g.render:g.beforeCreate;c?(g._injectStyles=u,g.render=function(n,e){return u.call(e),d(n,e)}):g.beforeCreate=d?[].concat(d,u):[u]}return{esModule:s,exports:o,options:g}}},function(n,e,i){"use strict";function t(n,e){var i=[];if("number"!=typeof n||"number"!=typeof e)return i;if(n>e){var t=n;n=e,e=t}for(var a=n;a<=e;a++)i.push(a);return i}var a=i(10);e.a={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:a.a},computed:{isSliding:function(){return this.total>this.nonSlidingSize},hasBeginningGap:function(){return!!this.isSliding&&this.current>this.beginningPages[this.beginningPages.length-1]+this.slidingWindowHalf},hasEndingGap:function(){return!!this.isSliding&&this.current<this.endingPages[0]-this.slidingWindowHalf},beginningPages:function(){return t(1,this.isSliding?this.slidingEndingSize:this.total)},endingPages:function(){return this.isSliding?t(this.total-this.slidingEndingSize+1,this.total):[]},slidingWindowHalf:function(){var n=this.slidingWindowSize/2;return this.slidingEndingSize%2==0?Math.ceil(n):Math.floor(n)},slidingWindowPages:function(){var n=[];if(!this.isSliding)return n;if(this.current<=this.slidingEndingSize+this.slidingWindowHalf)n=t(this.slidingEndingSize+1,this.slidingEndingSize+this.slidingWindowSize);else if(this.current>=this.endingPages[0]-this.slidingWindowHalf)n=t(this.total-this.slidingEndingSize-this.slidingWindowSize+1,this.total-this.slidingEndingSize);else{var e=0;this.slidingWindowSize%2==0&&(e=1),n=t(this.current-Math.floor(this.slidingWindowHalf/2)-e,this.current+Math.ceil(this.slidingWindowHalf/2))}return n},showPreviousPageAction:function(){return this.total>this.nonSlidingSize},showNextPageAction:function(){return this.total>this.nonSlidingSize}},methods:{replaceLabelVars:function(n,e){return n.replace("%total%",this.total).replace("%page%",e)},isCurrentPage:function(n){return this.current===n},currentPageLabel:function(n){return this.replaceLabelVars(this.ariaCurrentPageLabel,n)},goToPage:function(n){this.$emit("page-change",n)},goToPageLabel:function(n){return this.replaceLabelVars(this.ariaGotoPageLabel,n)},pageLabel:function(n){return this.isCurrentPage(n)?this.currentPageLabel(n):this.goToPageLabel(n)}}}},function(n,e,i){"use strict";e.a={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)}}}},function(n,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=i(4);e.default={install:function(n,e){n.component("SlidingPagination",t.a)}}},function(n,e,i){"use strict";function t(n){s||i(5)}var a=i(1),r=i(12),s=!1,o=i(0),l=t,g=o(a.a,r.a,!1,l,null,null);g.options.__file="src/SlidingPagination.vue",e.a=g.exports},function(n,e,i){var t=i(6);"string"==typeof t&&(t=[[n.i,t,""]]),t.locals&&(n.exports=t.locals);i(8)("6a470eb6",t,!1,{})},function(n,e,i){e=n.exports=i(7)(!1),e.push([n.i,"\n.c-sliding-pagination {\n pointer-events: all;\n}\n.c-sliding-pagination__list {\n display: inline;\n margin: 0;\n padding: 0;\n}\n.c-sliding-pagination__list-element {\n display: inline-block;\n background: #246068;\n color: #fff;\n padding: .6em;\n border-radius: .2em;\n margin: 0;\n margin-right: .2em;\n margin-bottom: 1em;\n -webkit-transition-duration: 300ms;\n transition-duration: 300ms;\n -webkit-transition-property: background, color;\n transition-property: background, color;\n}\n.c-sliding-pagination__list-element:hover {\n -webkit-transition-duration: 300ms;\n transition-duration: 300ms;\n -webkit-transition-property: background, color;\n transition-property: background, color;\n color: #e9e9e9;\n background: #69969c;\n}\n.c-sliding-pagination__list-element:last-of-type {\n margin-right: 0;\n}\n.c-sliding-pagination__list-element--active {\n background: #69969c;\n color: #e9e9e9;\n}\n.c-sliding-pagination__list-element--active:hover {\n color: #fff;\n background: #246068;\n cursor: default;\n}\n.c-sliding-pagination__list-element--disabled {\n background: none;\n color: inherit;\n cursor: not-allowed;\n}\n.c-sliding-pagination__page {\n color: inherit;\n padding: 0;\n margin: 0;\n text-decoration: none;\n}\n.c-sliding-pagination__page[disabled] {\n pointer-events: none;\n cursor: not-allowed;\n}\n",""])},function(n,e){function i(n,e){var i=n[1]||"",a=n[3];if(!a)return i;if(e&&"function"==typeof btoa){var r=t(a);return[i].concat(a.sources.map(function(n){return"/*# sourceURL="+a.sourceRoot+n+" */"})).concat([r]).join("\n")}return[i].join("\n")}function t(n){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */"}n.exports=function(n){var e=[];return e.toString=function(){return this.map(function(e){var t=i(e,n);return e[2]?"@media "+e[2]+"{"+t+"}":t}).join("")},e.i=function(n,i){"string"==typeof n&&(n=[[null,n,""]]);for(var t={},a=0;a<this.length;a++){var r=this[a][0];"number"==typeof r&&(t[r]=!0)}for(a=0;a<n.length;a++){var s=n[a];"number"==typeof s[0]&&t[s[0]]||(i&&!s[2]?s[2]=i:i&&(s[2]="("+s[2]+") and ("+i+")"),e.push(s))}},e}},function(n,e,i){function t(n){for(var e=0;e<n.length;e++){var i=n[e],t=u[i.id];if(t){t.refs++;for(var a=0;a<t.parts.length;a++)t.parts[a](i.parts[a]);for(;a<i.parts.length;a++)t.parts.push(r(i.parts[a]));t.parts.length>i.parts.length&&(t.parts.length=i.parts.length)}else{for(var s=[],a=0;a<i.parts.length;a++)s.push(r(i.parts[a]));u[i.id]={id:i.id,refs:1,parts:s}}}}function a(){var n=document.createElement("style");return n.type="text/css",c.appendChild(n),n}function r(n){var e,i,t=document.querySelector("style["+m+'~="'+n.id+'"]');if(t){if(f)return h;t.parentNode.removeChild(t)}if(v){var r=p++;t=d||(d=a()),e=s.bind(null,t,r,!1),i=s.bind(null,t,r,!0)}else t=a(),e=o.bind(null,t),i=function(){t.parentNode.removeChild(t)};return e(n),function(t){if(t){if(t.css===n.css&&t.media===n.media&&t.sourceMap===n.sourceMap)return;e(n=t)}else i()}}function s(n,e,i,t){var a=i?"":t.css;if(n.styleSheet)n.styleSheet.cssText=b(e,a);else{var r=document.createTextNode(a),s=n.childNodes;s[e]&&n.removeChild(s[e]),s.length?n.insertBefore(r,s[e]):n.appendChild(r)}}function o(n,e){var i=e.css,t=e.media,a=e.sourceMap;if(t&&n.setAttribute("media",t),_.ssrId&&n.setAttribute(m,e.id),a&&(i+="\n/*# sourceURL="+a.sources[0]+" */",i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),n.styleSheet)n.styleSheet.cssText=i;else{for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(document.createTextNode(i))}}var l="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!l)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var g=i(9),u={},c=l&&(document.head||document.getElementsByTagName("head")[0]),d=null,p=0,f=!1,h=function(){},_=null,m="data-vue-ssr-id",v="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());n.exports=function(n,e,i,a){f=i,_=a||{};var r=g(n,e);return t(r),function(e){for(var i=[],a=0;a<r.length;a++){var s=r[a],o=u[s.id];o.refs--,i.push(o)}e?(r=g(n,e),t(r)):r=[];for(var a=0;a<i.length;a++){var o=i[a];if(0===o.refs){for(var l=0;l<o.parts.length;l++)o.parts[l]();delete u[o.id]}}}};var b=function(){var n=[];return function(e,i){return n[e]=i,n.filter(Boolean).join("\n")}}()},function(n,e){n.exports=function(n,e){for(var i=[],t={},a=0;a<e.length;a++){var r=e[a],s=r[0],o=r[1],l=r[2],g=r[3],u={id:n+":"+a,css:o,media:l,sourceMap:g};t[s]?t[s].parts.push(u):i.push(t[s]={id:s,parts:[u]})}return i}},function(n,e,i){"use strict";var t=i(2),a=i(11),r=i(0),s=r(t.a,a.a,!1,null,null,null);s.options.__file="src/SlidingPaginationDefaultPage.vue",e.a=s.exports},function(n,e,i){"use strict";var t=function(){var n=this,e=n.$createElement;return(n._self._c||e)("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":n.ariaPageLabel},on:{click:function(e){e.stopPropagation(),e.preventDefault(),n.goToPage(n.page)}}},[n._v("\n "+n._s(n.page)+"\n")])},a=[];t._withStripped=!0;var r={render:t,staticRenderFns:a};e.a=r},function(n,e,i){"use strict";var t=function(){var n=this,e=n.$createElement,i=n._self._c||e;return i("nav",{staticClass:"c-sliding-pagination",attrs:{"aria-label":n.ariaPaginationLabel}},[i("ul",{staticClass:"c-sliding-pagination__list"},[n.showPreviousPageAction?i("li",{staticClass:"c-sliding-pagination__list-element",class:1==n.current?"c-sliding-pagination__list-element--disabled":""},[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":n.ariaPreviousPageLabel,disabled:1==n.current},on:{click:function(e){e.preventDefault(),e.stopPropagation(),n.goToPage(n.current-1)}}},[n._t("previous-page",[n._v("«")])],2)]):n._e(),n._l(n.beginningPages,function(e){return i("li",{key:e,staticClass:"c-sliding-pagination__list-element",class:n.isCurrentPage(e)?"c-sliding-pagination__list-element--active":""},[i(n.pageComponent,{tag:"component",attrs:{"is-current":n.isCurrentPage(e),"aria-page-label":n.pageLabel(e),page:e},on:{"page-click":function(i){n.goToPage(e)}}})],1)}),n.hasBeginningGap?i("li",{staticClass:"c-sliding-pagination__list-element c-sliding-pagination__list-element--disabled",attrs:{"aria-hidden":"true"}},[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#",disabled:""}},[n._t("gap-left",[n._v("…")])],2)]):n._e(),n._l(n.slidingWindowPages,function(e){return i("li",{key:e,staticClass:"c-sliding-pagination__list-element",class:n.isCurrentPage(e)?"c-sliding-pagination__list-element--active":""},[i(n.pageComponent,{tag:"component",attrs:{"is-current":n.isCurrentPage(e),"aria-page-label":n.pageLabel(e),page:e},on:{"page-click":function(i){n.goToPage(e)}}})],1)}),n.hasEndingGap?i("li",{staticClass:"c-sliding-pagination__list-element c-sliding-pagination__list-element--disabled",attrs:{"aria-hidden":"true"}},[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#",disabled:""}},[n._t("gap-right",[n._v("…")])],2)]):n._e(),n._l(n.endingPages,function(e){return i("li",{key:e,staticClass:"c-sliding-pagination__list-element",class:n.isCurrentPage(e)?"c-sliding-pagination__list-element--active":""},[i(n.pageComponent,{tag:"component",attrs:{"is-current":n.isCurrentPage(e),"aria-page-label":n.pageLabel(e),page:e},on:{"page-click":function(i){n.goToPage(e)}}})],1)}),n.showNextPageAction?i("li",{staticClass:"c-sliding-pagination__list-element",class:n.current==n.total?"c-sliding-pagination__list-element--disabled":""},[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":n.ariaNextPageLabel,disabled:n.current==n.total},on:{click:function(e){e.preventDefault(),e.stopPropagation(),n.goToPage(n.current+1)}}},[n._t("next-page",[n._v("»")])],2)]):n._e()],2)])},a=[];t._withStripped=!0;var r={render:t,staticRenderFns:a};e.a=r}]); |
@@ -1,1 +0,1 @@ | ||
!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("vue-sliding-pagination",[],e):"object"==typeof exports?exports["vue-sliding-pagination"]=e():n["vue-sliding-pagination"]=e()}("undefined"!=typeof self?self:this,function(){return function(n){function e(t){if(i[t])return i[t].exports;var a=i[t]={i:t,l:!1,exports:{}};return n[t].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var i={};return e.m=n,e.c=i,e.d=function(n,i,t){e.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:t})},e.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(i,"a",i),i},e.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},e.p="",e(e.s=3)}([function(n,e){n.exports=function(n,e,i,t,a,r){var o,s=n=n||{},l=typeof n.default;"object"!==l&&"function"!==l||(o=n,s=n.default);var g="function"==typeof s?s.options:s;e&&(g.render=e.render,g.staticRenderFns=e.staticRenderFns,g._compiled=!0),i&&(g.functional=!0),a&&(g._scopeId=a);var u;if(r?(u=function(n){n=n||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,n||"undefined"==typeof __VUE_SSR_CONTEXT__||(n=__VUE_SSR_CONTEXT__),t&&t.call(this,n),n&&n._registeredComponents&&n._registeredComponents.add(r)},g._ssrRegister=u):t&&(u=t),u){var c=g.functional,d=c?g.render:g.beforeCreate;c?(g._injectStyles=u,g.render=function(n,e){return u.call(e),d(n,e)}):g.beforeCreate=d?[].concat(d,u):[u]}return{esModule:o,exports:s,options:g}}},function(n,e,i){"use strict";function t(n,e){var i=[];if("number"!=typeof n||"number"!=typeof e)return i;if(n>e){var t=n;n=e,e=t}for(var a=n;a<=e;a++)i.push(a);return i}e.b=t;var a=i(9);e.a={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 %current% 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:a.a},computed:{isSliding:function(){return this.total>this.nonSlidingSize},hasBeginningGap:function(){return!!this.isSliding&&this.current>this.beginningPages[this.beginningPages.length-1]+this.slidingWindowHalf},hasEndingGap:function(){return!!this.isSliding&&this.current<this.endingPages[0]-this.slidingWindowHalf},beginningPages:function(){return t(1,this.isSliding?this.slidingEndingSize:this.total)},endingPages:function(){return this.isSliding?t(this.total-this.slidingEndingSize+1,this.total):[]},slidingWindowHalf:function(){var n=this.slidingWindowSize/2;return this.slidingEndingSize%2==0?Math.ceil(n):Math.floor(n)},slidingWindowPages:function(){var n=[];if(!this.isSliding)return n;if(this.current<=this.slidingEndingSize+this.slidingWindowHalf)n=t(this.slidingEndingSize+1,this.slidingEndingSize+this.slidingWindowSize);else if(this.current>=this.endingPages[0]-this.slidingWindowHalf)n=t(this.total-this.slidingEndingSize-this.slidingWindowSize+1,this.total-this.slidingEndingSize);else{var e=0;this.slidingWindowSize%2==0&&(e=1),n=t(this.current-Math.floor(this.slidingWindowHalf/2)-e,this.current+Math.ceil(this.slidingWindowHalf/2))}return n},showPreviousPageAction:function(){return this.total>this.nonSlidingSize},showNextPageAction:function(){return this.total>this.nonSlidingSize}},methods:{replaceLabelVars:function(n,e){return n.replace("%current%",this.current).replace("%total%",this.total).replace("%page%",e)},isCurrentPage:function(n){return this.current===n},currentPageLabel:function(n){return this.replaceLabelVars(this.ariaCurrentPageLabel,n)},goToPage:function(n){this.$emit("page-change",n)},goToPageLabel:function(n){return this.replaceLabelVars(this.ariaGotoPageLabel,n)},pageLabel:function(n){return this.isCurrentPage(n)?this.currentPageLabel(n):this.goToPageLabel(n)}}}},function(n,e,i){"use strict";e.a={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)}}}},function(n,e,i){"use strict";function t(n){o||i(4)}Object.defineProperty(e,"__esModule",{value:!0});var a=i(1);i.d(e,"range",function(){return a.b});var r=i(11),o=!1,s=i(0),l=t,g=s(a.a,r.a,!1,l,null,null);g.options.__file="src/SlidingPagination.vue",e.default=g.exports},function(n,e,i){var t=i(5);"string"==typeof t&&(t=[[n.i,t,""]]),t.locals&&(n.exports=t.locals);i(7)("6a470eb6",t,!1,{})},function(n,e,i){e=n.exports=i(6)(!1),e.push([n.i,"\n.c-sliding-pagination {\n pointer-events: all;\n}\n.c-sliding-pagination__list {\n display: inline;\n margin: 0;\n padding: 0;\n}\n.c-sliding-pagination__list-element {\n display: inline-block;\n background: #246068;\n color: #fff;\n padding: .6em;\n border-radius: .2em;\n margin: 0;\n margin-right: .2em;\n margin-bottom: 1em;\n -webkit-transition-duration: 300ms;\n transition-duration: 300ms;\n -webkit-transition-property: background, color;\n transition-property: background, color;\n}\n.c-sliding-pagination__list-element:hover {\n -webkit-transition-duration: 300ms;\n transition-duration: 300ms;\n -webkit-transition-property: background, color;\n transition-property: background, color;\n color: #e9e9e9;\n background: #69969c;\n}\n.c-sliding-pagination__list-element:last-of-type {\n margin-right: 0;\n}\n.c-sliding-pagination__list-element--active {\n background: #69969c;\n color: #e9e9e9;\n}\n.c-sliding-pagination__list-element--active:hover {\n color: #fff;\n background: #246068;\n cursor: default;\n}\n.c-sliding-pagination__list-element--disabled {\n background: none;\n color: inherit;\n cursor: not-allowed;\n}\n.c-sliding-pagination__page {\n color: inherit;\n padding: 0;\n margin: 0;\n text-decoration: none;\n}\n.c-sliding-pagination__page[disabled] {\n pointer-events: none;\n cursor: not-allowed;\n}\n",""])},function(n,e){function i(n,e){var i=n[1]||"",a=n[3];if(!a)return i;if(e&&"function"==typeof btoa){var r=t(a);return[i].concat(a.sources.map(function(n){return"/*# sourceURL="+a.sourceRoot+n+" */"})).concat([r]).join("\n")}return[i].join("\n")}function t(n){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */"}n.exports=function(n){var e=[];return e.toString=function(){return this.map(function(e){var t=i(e,n);return e[2]?"@media "+e[2]+"{"+t+"}":t}).join("")},e.i=function(n,i){"string"==typeof n&&(n=[[null,n,""]]);for(var t={},a=0;a<this.length;a++){var r=this[a][0];"number"==typeof r&&(t[r]=!0)}for(a=0;a<n.length;a++){var o=n[a];"number"==typeof o[0]&&t[o[0]]||(i&&!o[2]?o[2]=i:i&&(o[2]="("+o[2]+") and ("+i+")"),e.push(o))}},e}},function(n,e,i){function t(n){for(var e=0;e<n.length;e++){var i=n[e],t=u[i.id];if(t){t.refs++;for(var a=0;a<t.parts.length;a++)t.parts[a](i.parts[a]);for(;a<i.parts.length;a++)t.parts.push(r(i.parts[a]));t.parts.length>i.parts.length&&(t.parts.length=i.parts.length)}else{for(var o=[],a=0;a<i.parts.length;a++)o.push(r(i.parts[a]));u[i.id]={id:i.id,refs:1,parts:o}}}}function a(){var n=document.createElement("style");return n.type="text/css",c.appendChild(n),n}function r(n){var e,i,t=document.querySelector("style["+v+'~="'+n.id+'"]');if(t){if(f)return h;t.parentNode.removeChild(t)}if(b){var r=p++;t=d||(d=a()),e=o.bind(null,t,r,!1),i=o.bind(null,t,r,!0)}else t=a(),e=s.bind(null,t),i=function(){t.parentNode.removeChild(t)};return e(n),function(t){if(t){if(t.css===n.css&&t.media===n.media&&t.sourceMap===n.sourceMap)return;e(n=t)}else i()}}function o(n,e,i,t){var a=i?"":t.css;if(n.styleSheet)n.styleSheet.cssText=m(e,a);else{var r=document.createTextNode(a),o=n.childNodes;o[e]&&n.removeChild(o[e]),o.length?n.insertBefore(r,o[e]):n.appendChild(r)}}function s(n,e){var i=e.css,t=e.media,a=e.sourceMap;if(t&&n.setAttribute("media",t),_.ssrId&&n.setAttribute(v,e.id),a&&(i+="\n/*# sourceURL="+a.sources[0]+" */",i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),n.styleSheet)n.styleSheet.cssText=i;else{for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(document.createTextNode(i))}}var l="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!l)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var g=i(8),u={},c=l&&(document.head||document.getElementsByTagName("head")[0]),d=null,p=0,f=!1,h=function(){},_=null,v="data-vue-ssr-id",b="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());n.exports=function(n,e,i,a){f=i,_=a||{};var r=g(n,e);return t(r),function(e){for(var i=[],a=0;a<r.length;a++){var o=r[a],s=u[o.id];s.refs--,i.push(s)}e?(r=g(n,e),t(r)):r=[];for(var a=0;a<i.length;a++){var s=i[a];if(0===s.refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete u[s.id]}}}};var m=function(){var n=[];return function(e,i){return n[e]=i,n.filter(Boolean).join("\n")}}()},function(n,e){n.exports=function(n,e){for(var i=[],t={},a=0;a<e.length;a++){var r=e[a],o=r[0],s=r[1],l=r[2],g=r[3],u={id:n+":"+a,css:s,media:l,sourceMap:g};t[o]?t[o].parts.push(u):i.push(t[o]={id:o,parts:[u]})}return i}},function(n,e,i){"use strict";var t=i(2),a=i(10),r=i(0),o=r(t.a,a.a,!1,null,null,null);o.options.__file="src/SlidingPaginationDefaultPage.vue",e.a=o.exports},function(n,e,i){"use strict";var t=function(){var n=this,e=n.$createElement;return(n._self._c||e)("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":n.ariaPageLabel},on:{click:function(e){e.stopPropagation(),e.preventDefault(),n.goToPage(n.page)}}},[n._v("\n "+n._s(n.page)+"\n")])},a=[];t._withStripped=!0;var r={render:t,staticRenderFns:a};e.a=r},function(n,e,i){"use strict";var t=function(){var n=this,e=n.$createElement,i=n._self._c||e;return i("nav",{staticClass:"c-sliding-pagination",attrs:{"aria-label":n.ariaPaginationLabel}},[i("ul",{staticClass:"c-sliding-pagination__list"},[n.showPreviousPageAction?i("li",{staticClass:"c-sliding-pagination__list-element",class:1==n.current?"c-sliding-pagination__list-element--disabled":""},[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":n.ariaPreviousPageLabel,disabled:1==n.current},on:{click:function(e){e.preventDefault(),e.stopPropagation(),n.goToPage(n.current-1)}}},[n._t("previous-page",[n._v("«")])],2)]):n._e(),n._l(n.beginningPages,function(e){return i("li",{key:e,staticClass:"c-sliding-pagination__list-element",class:n.isCurrentPage(e)?"c-sliding-pagination__list-element--active":""},[i(n.pageComponent,{tag:"component",attrs:{"is-current":n.isCurrentPage(e),"aria-page-label":n.pageLabel(e),page:e},on:{"page-click":function(i){n.goToPage(e)}}})],1)}),n.hasBeginningGap?i("li",{staticClass:"c-sliding-pagination__list-element c-sliding-pagination__list-element--disabled",attrs:{"aria-hidden":"true"}},[n._t("gap-left",[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#",disabled:""}},[n._v("\n …\n ")])])],2):n._e(),n._l(n.slidingWindowPages,function(e){return i("li",{key:e,staticClass:"c-sliding-pagination__list-element",class:n.isCurrentPage(e)?"c-sliding-pagination__list-element--active":""},[i(n.pageComponent,{tag:"component",attrs:{"is-current":n.isCurrentPage(e),"aria-page-label":n.pageLabel(e),page:e},on:{"page-click":function(i){n.goToPage(e)}}})],1)}),n.hasEndingGap?i("li",{staticClass:"c-sliding-pagination__list-element c-sliding-pagination__list-element--disabled",attrs:{"aria-hidden":"true"}},[n._t("gap-right",[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#",disabled:""}},[n._v("\n …\n ")])])],2):n._e(),n._l(n.endingPages,function(e){return i("li",{key:e,staticClass:"c-sliding-pagination__list-element",class:n.isCurrentPage(e)?"c-sliding-pagination__list-element--active":""},[i(n.pageComponent,{tag:"component",attrs:{"is-current":n.isCurrentPage(e),"aria-page-label":n.pageLabel(e),page:e},on:{"page-click":function(i){n.goToPage(e)}}})],1)}),n.showNextPageAction?i("li",{staticClass:"c-sliding-pagination__list-element",class:n.current==n.total?"c-sliding-pagination__list-element--disabled":""},[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":n.ariaNextPageLabel,disabled:n.current==n.total},on:{click:function(e){e.preventDefault(),e.stopPropagation(),n.goToPage(n.current+1)}}},[n._t("next-page",[n._v("»")])],2)]):n._e()],2)])},a=[];t._withStripped=!0;var r={render:t,staticRenderFns:a};e.a=r}])}); | ||
!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("vue-sliding-pagination",[],e):"object"==typeof exports?exports["vue-sliding-pagination"]=e():n["vue-sliding-pagination"]=e()}("undefined"!=typeof self?self:this,function(){return function(n){function e(t){if(i[t])return i[t].exports;var a=i[t]={i:t,l:!1,exports:{}};return n[t].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var i={};return e.m=n,e.c=i,e.d=function(n,i,t){e.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:t})},e.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(i,"a",i),i},e.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},e.p="",e(e.s=3)}([function(n,e){n.exports=function(n,e,i,t,a,r){var o,s=n=n||{},l=typeof n.default;"object"!==l&&"function"!==l||(o=n,s=n.default);var g="function"==typeof s?s.options:s;e&&(g.render=e.render,g.staticRenderFns=e.staticRenderFns,g._compiled=!0),i&&(g.functional=!0),a&&(g._scopeId=a);var u;if(r?(u=function(n){n=n||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,n||"undefined"==typeof __VUE_SSR_CONTEXT__||(n=__VUE_SSR_CONTEXT__),t&&t.call(this,n),n&&n._registeredComponents&&n._registeredComponents.add(r)},g._ssrRegister=u):t&&(u=t),u){var c=g.functional,d=c?g.render:g.beforeCreate;c?(g._injectStyles=u,g.render=function(n,e){return u.call(e),d(n,e)}):g.beforeCreate=d?[].concat(d,u):[u]}return{esModule:o,exports:s,options:g}}},function(n,e,i){"use strict";function t(n,e){var i=[];if("number"!=typeof n||"number"!=typeof e)return i;if(n>e){var t=n;n=e,e=t}for(var a=n;a<=e;a++)i.push(a);return i}e.b=t;var a=i(9);e.a={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:a.a},computed:{isSliding:function(){return this.total>this.nonSlidingSize},hasBeginningGap:function(){return!!this.isSliding&&this.current>this.beginningPages[this.beginningPages.length-1]+this.slidingWindowHalf},hasEndingGap:function(){return!!this.isSliding&&this.current<this.endingPages[0]-this.slidingWindowHalf},beginningPages:function(){return t(1,this.isSliding?this.slidingEndingSize:this.total)},endingPages:function(){return this.isSliding?t(this.total-this.slidingEndingSize+1,this.total):[]},slidingWindowHalf:function(){var n=this.slidingWindowSize/2;return this.slidingEndingSize%2==0?Math.ceil(n):Math.floor(n)},slidingWindowPages:function(){var n=[];if(!this.isSliding)return n;if(this.current<=this.slidingEndingSize+this.slidingWindowHalf)n=t(this.slidingEndingSize+1,this.slidingEndingSize+this.slidingWindowSize);else if(this.current>=this.endingPages[0]-this.slidingWindowHalf)n=t(this.total-this.slidingEndingSize-this.slidingWindowSize+1,this.total-this.slidingEndingSize);else{var e=0;this.slidingWindowSize%2==0&&(e=1),n=t(this.current-Math.floor(this.slidingWindowHalf/2)-e,this.current+Math.ceil(this.slidingWindowHalf/2))}return n},showPreviousPageAction:function(){return this.total>this.nonSlidingSize},showNextPageAction:function(){return this.total>this.nonSlidingSize}},methods:{replaceLabelVars:function(n,e){return n.replace("%total%",this.total).replace("%page%",e)},isCurrentPage:function(n){return this.current===n},currentPageLabel:function(n){return this.replaceLabelVars(this.ariaCurrentPageLabel,n)},goToPage:function(n){this.$emit("page-change",n)},goToPageLabel:function(n){return this.replaceLabelVars(this.ariaGotoPageLabel,n)},pageLabel:function(n){return this.isCurrentPage(n)?this.currentPageLabel(n):this.goToPageLabel(n)}}}},function(n,e,i){"use strict";e.a={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)}}}},function(n,e,i){"use strict";function t(n){o||i(4)}Object.defineProperty(e,"__esModule",{value:!0});var a=i(1);i.d(e,"range",function(){return a.b});var r=i(11),o=!1,s=i(0),l=t,g=s(a.a,r.a,!1,l,null,null);g.options.__file="src/SlidingPagination.vue",e.default=g.exports},function(n,e,i){var t=i(5);"string"==typeof t&&(t=[[n.i,t,""]]),t.locals&&(n.exports=t.locals);i(7)("6a470eb6",t,!1,{})},function(n,e,i){e=n.exports=i(6)(!1),e.push([n.i,"\n.c-sliding-pagination {\n pointer-events: all;\n}\n.c-sliding-pagination__list {\n display: inline;\n margin: 0;\n padding: 0;\n}\n.c-sliding-pagination__list-element {\n display: inline-block;\n background: #246068;\n color: #fff;\n padding: .6em;\n border-radius: .2em;\n margin: 0;\n margin-right: .2em;\n margin-bottom: 1em;\n -webkit-transition-duration: 300ms;\n transition-duration: 300ms;\n -webkit-transition-property: background, color;\n transition-property: background, color;\n}\n.c-sliding-pagination__list-element:hover {\n -webkit-transition-duration: 300ms;\n transition-duration: 300ms;\n -webkit-transition-property: background, color;\n transition-property: background, color;\n color: #e9e9e9;\n background: #69969c;\n}\n.c-sliding-pagination__list-element:last-of-type {\n margin-right: 0;\n}\n.c-sliding-pagination__list-element--active {\n background: #69969c;\n color: #e9e9e9;\n}\n.c-sliding-pagination__list-element--active:hover {\n color: #fff;\n background: #246068;\n cursor: default;\n}\n.c-sliding-pagination__list-element--disabled {\n background: none;\n color: inherit;\n cursor: not-allowed;\n}\n.c-sliding-pagination__page {\n color: inherit;\n padding: 0;\n margin: 0;\n text-decoration: none;\n}\n.c-sliding-pagination__page[disabled] {\n pointer-events: none;\n cursor: not-allowed;\n}\n",""])},function(n,e){function i(n,e){var i=n[1]||"",a=n[3];if(!a)return i;if(e&&"function"==typeof btoa){var r=t(a);return[i].concat(a.sources.map(function(n){return"/*# sourceURL="+a.sourceRoot+n+" */"})).concat([r]).join("\n")}return[i].join("\n")}function t(n){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */"}n.exports=function(n){var e=[];return e.toString=function(){return this.map(function(e){var t=i(e,n);return e[2]?"@media "+e[2]+"{"+t+"}":t}).join("")},e.i=function(n,i){"string"==typeof n&&(n=[[null,n,""]]);for(var t={},a=0;a<this.length;a++){var r=this[a][0];"number"==typeof r&&(t[r]=!0)}for(a=0;a<n.length;a++){var o=n[a];"number"==typeof o[0]&&t[o[0]]||(i&&!o[2]?o[2]=i:i&&(o[2]="("+o[2]+") and ("+i+")"),e.push(o))}},e}},function(n,e,i){function t(n){for(var e=0;e<n.length;e++){var i=n[e],t=u[i.id];if(t){t.refs++;for(var a=0;a<t.parts.length;a++)t.parts[a](i.parts[a]);for(;a<i.parts.length;a++)t.parts.push(r(i.parts[a]));t.parts.length>i.parts.length&&(t.parts.length=i.parts.length)}else{for(var o=[],a=0;a<i.parts.length;a++)o.push(r(i.parts[a]));u[i.id]={id:i.id,refs:1,parts:o}}}}function a(){var n=document.createElement("style");return n.type="text/css",c.appendChild(n),n}function r(n){var e,i,t=document.querySelector("style["+v+'~="'+n.id+'"]');if(t){if(f)return h;t.parentNode.removeChild(t)}if(b){var r=p++;t=d||(d=a()),e=o.bind(null,t,r,!1),i=o.bind(null,t,r,!0)}else t=a(),e=s.bind(null,t),i=function(){t.parentNode.removeChild(t)};return e(n),function(t){if(t){if(t.css===n.css&&t.media===n.media&&t.sourceMap===n.sourceMap)return;e(n=t)}else i()}}function o(n,e,i,t){var a=i?"":t.css;if(n.styleSheet)n.styleSheet.cssText=m(e,a);else{var r=document.createTextNode(a),o=n.childNodes;o[e]&&n.removeChild(o[e]),o.length?n.insertBefore(r,o[e]):n.appendChild(r)}}function s(n,e){var i=e.css,t=e.media,a=e.sourceMap;if(t&&n.setAttribute("media",t),_.ssrId&&n.setAttribute(v,e.id),a&&(i+="\n/*# sourceURL="+a.sources[0]+" */",i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),n.styleSheet)n.styleSheet.cssText=i;else{for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(document.createTextNode(i))}}var l="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!l)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var g=i(8),u={},c=l&&(document.head||document.getElementsByTagName("head")[0]),d=null,p=0,f=!1,h=function(){},_=null,v="data-vue-ssr-id",b="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());n.exports=function(n,e,i,a){f=i,_=a||{};var r=g(n,e);return t(r),function(e){for(var i=[],a=0;a<r.length;a++){var o=r[a],s=u[o.id];s.refs--,i.push(s)}e?(r=g(n,e),t(r)):r=[];for(var a=0;a<i.length;a++){var s=i[a];if(0===s.refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete u[s.id]}}}};var m=function(){var n=[];return function(e,i){return n[e]=i,n.filter(Boolean).join("\n")}}()},function(n,e){n.exports=function(n,e){for(var i=[],t={},a=0;a<e.length;a++){var r=e[a],o=r[0],s=r[1],l=r[2],g=r[3],u={id:n+":"+a,css:s,media:l,sourceMap:g};t[o]?t[o].parts.push(u):i.push(t[o]={id:o,parts:[u]})}return i}},function(n,e,i){"use strict";var t=i(2),a=i(10),r=i(0),o=r(t.a,a.a,!1,null,null,null);o.options.__file="src/SlidingPaginationDefaultPage.vue",e.a=o.exports},function(n,e,i){"use strict";var t=function(){var n=this,e=n.$createElement;return(n._self._c||e)("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":n.ariaPageLabel},on:{click:function(e){e.stopPropagation(),e.preventDefault(),n.goToPage(n.page)}}},[n._v("\n "+n._s(n.page)+"\n")])},a=[];t._withStripped=!0;var r={render:t,staticRenderFns:a};e.a=r},function(n,e,i){"use strict";var t=function(){var n=this,e=n.$createElement,i=n._self._c||e;return i("nav",{staticClass:"c-sliding-pagination",attrs:{"aria-label":n.ariaPaginationLabel}},[i("ul",{staticClass:"c-sliding-pagination__list"},[n.showPreviousPageAction?i("li",{staticClass:"c-sliding-pagination__list-element",class:1==n.current?"c-sliding-pagination__list-element--disabled":""},[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":n.ariaPreviousPageLabel,disabled:1==n.current},on:{click:function(e){e.preventDefault(),e.stopPropagation(),n.goToPage(n.current-1)}}},[n._t("previous-page",[n._v("«")])],2)]):n._e(),n._l(n.beginningPages,function(e){return i("li",{key:e,staticClass:"c-sliding-pagination__list-element",class:n.isCurrentPage(e)?"c-sliding-pagination__list-element--active":""},[i(n.pageComponent,{tag:"component",attrs:{"is-current":n.isCurrentPage(e),"aria-page-label":n.pageLabel(e),page:e},on:{"page-click":function(i){n.goToPage(e)}}})],1)}),n.hasBeginningGap?i("li",{staticClass:"c-sliding-pagination__list-element c-sliding-pagination__list-element--disabled",attrs:{"aria-hidden":"true"}},[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#",disabled:""}},[n._t("gap-left",[n._v("…")])],2)]):n._e(),n._l(n.slidingWindowPages,function(e){return i("li",{key:e,staticClass:"c-sliding-pagination__list-element",class:n.isCurrentPage(e)?"c-sliding-pagination__list-element--active":""},[i(n.pageComponent,{tag:"component",attrs:{"is-current":n.isCurrentPage(e),"aria-page-label":n.pageLabel(e),page:e},on:{"page-click":function(i){n.goToPage(e)}}})],1)}),n.hasEndingGap?i("li",{staticClass:"c-sliding-pagination__list-element c-sliding-pagination__list-element--disabled",attrs:{"aria-hidden":"true"}},[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#",disabled:""}},[n._t("gap-right",[n._v("…")])],2)]):n._e(),n._l(n.endingPages,function(e){return i("li",{key:e,staticClass:"c-sliding-pagination__list-element",class:n.isCurrentPage(e)?"c-sliding-pagination__list-element--active":""},[i(n.pageComponent,{tag:"component",attrs:{"is-current":n.isCurrentPage(e),"aria-page-label":n.pageLabel(e),page:e},on:{"page-click":function(i){n.goToPage(e)}}})],1)}),n.showNextPageAction?i("li",{staticClass:"c-sliding-pagination__list-element",class:n.current==n.total?"c-sliding-pagination__list-element--disabled":""},[i("a",{staticClass:"c-sliding-pagination__page",attrs:{href:"#","aria-label":n.ariaNextPageLabel,disabled:n.current==n.total},on:{click:function(e){e.preventDefault(),e.stopPropagation(),n.goToPage(n.current+1)}}},[n._t("next-page",[n._v("»")])],2)]):n._e()],2)])},a=[];t._withStripped=!0;var r={render:t,staticRenderFns:a};e.a=r}])}); |
{ | ||
"name": "vue-sliding-pagination", | ||
"version": "1.0.0-beta-2", | ||
"version": "1.0.0-beta-3", | ||
"description": "Sliding pagination component", | ||
@@ -5,0 +5,0 @@ "author": "eFrane <efrane@meanderingsoul.com>", |
181
README.md
[TODO:] [Insert] [a crapton] [of badges] [here] [because] [javascript] | ||
# vue-sliding-pagination | ||
# Sliding Pagination for Vue | ||
Pagination component with a sliding window. | ||
> ARIA-friendly pagination component with a sliding window. | ||
## Installation | ||
### Node | ||
`npm install vue-sliding-pagination --save` | ||
or, for the fäncÿ people, | ||
`yarn add vue-sliding-pagination` | ||
### Browser | ||
Currently, no browser build is available. | ||
## Usage | ||
Basic usage of the pagination component only requires the current page, | ||
the total number of pages and a handler which is called on page change. | ||
The pagination component **does not handle page changes by itself**, instead | ||
you are required to provide a page change handler which should contain | ||
all your page changing logic (e.g. a vuex store dispatch) and eventually | ||
change the current page to the passed one. In later releases, a v-model | ||
approach to `currentPage` may be offered, but was opted against for the time | ||
being. | ||
Thus, to get a paginator with default settings (please consult the options listing | ||
below for details), the following markup and script sections provide a starting | ||
point: | ||
```html | ||
<sliding-pagination | ||
:current="currentPage" | ||
:total="totalPages" | ||
@page-change="pageChangeHandler" | ||
></sliding-pagination> | ||
``` | ||
```js | ||
// in component or vue instance | ||
data() { | ||
return { | ||
// ... | ||
currentPage: 1, | ||
totalPages: 10 | ||
} | ||
}, | ||
methods: { | ||
// ... | ||
pageChangeHandler(selectedPage) { | ||
this.currentPage = selectedPage | ||
} | ||
} | ||
``` | ||
## Options | ||
| name | type | default | description | | ||
|-----------------------|:------:|-------------------------------------------|---------------------------------------------------------------| | ||
| ariaPaginationLabel | String | `'Pagination navigation'` | ARIA label for the whole <nav> area | | ||
| ariaGotoPageLabel | String | `'Go to page %page% of %total%'` | ARIA label for a page link that is not the current page | | ||
| ariaPreviousPageLabel | String | `'Go to previous page'` | ARIA label for the previous page action | | ||
| ariaNextPageLabel | String | `'Go to next page'` | ARIA label for the next page action | | ||
| ariaCurrentPageLabel | String | `'Page %current of %total, current page'` | ARIA label for the current page | | ||
| current | Number | - | Integer representing the current page | | ||
| total | Number | - | Integer representing the total number of pages | | ||
| slidingEndingSize | Number | `2` | Number of always listed pages on the beginning and end | | ||
| slidingWindowSize | Number | `3` | Number of pages in the sliding window | | ||
| nonSlidingSize | Number | `9` | Number of pages before the paginator switches to sliding mode | | ||
| pageComponent | String | `'sliding-pagination-default-page'` | Component name (must be registered) for the page elements | | ||
## Customization | ||
The component offers severals customization options. | ||
### ARIA labels | ||
All ARIA labels can be altered and localized. | ||
The labels `ariaGoToPageLabel` and `ariaCurrentPageLabel` support | ||
the following template variables: | ||
| Variable | Type | Description | | ||
|-----------|:------:|---------------------------| | ||
| `%total%` | Number | The total number of pages | | ||
| `%page%` | Number | The page under the cursor | | ||
### Intervals | ||
The number of pages shown on the beginning and ending of the pager | ||
as well as the number of pages in the pagination window can be changed | ||
dynamically. The break-point from normal to sliding-window pagination | ||
can also be adjusted. **Please bear in mind that none of these intervals | ||
and none of the calculations they are used in make any assertions on | ||
obviously impossible configurations!** | ||
_What are obviously impossible configurations?_ | ||
Glad you're asking! For one, the rule of thumb should be | ||
`2 * slidingEndingSize + slidingWindowSize <= total`. | ||
However, as there is a fallback coated as `nonSlidingSize` you can work around | ||
this "limitation" with some ingenouity on your part. Basically, don't do stupid things | ||
that disregards principles of natural numbers. | ||
### Page navigation | ||
The content of the previous and next page elements are customizable via the | ||
slots `previous-page` and `next-page`. By default, these only contain | ||
the "pretend arrows" aka « and ». The contents of these slots | ||
are **only intended for visual use**. Screenreader users are presented | ||
the `ariaPreviousPageLabel` and `ariaNextPageLabel` instead. | ||
### Gaps | ||
Depending on the current page, there may be a gap between the sliding window and the | ||
beginning and ending pages. The gap content defaults to … but can be | ||
customized **for visual use** under the same conditions as the page navigation with | ||
the slots `gap-left` and `gap-right`. | ||
### Page component | ||
Since actual pages are the most active element of the whole pagination deal, | ||
they have been implemented with the `<component :is="paginationComponent">` pattern. | ||
The `SlidingPaginationDefaultPage` component offers guidance into how a basic | ||
component representation page elements should look like. It's unit test can | ||
be used as a basis for unit testing custom page components. | ||
The page component receives the following props: | ||
| name | type | description | | ||
|---------------|:-------:|------------------------------| | ||
| ariaPageLabel | String | The computed ARIA page label | | ||
| isCurrent | Boolean | Is the page the current page | | ||
| page | Number | The page number to display | | ||
It is by no means required to implement all properties of the default page. | ||
A custom paginatino components can usually just be implemented as render | ||
functions, e.g. | ||
```js | ||
Vue.component('ExamplePageComponent', { | ||
props: { | ||
page: { | ||
type: Number, | ||
required: true | ||
} | ||
}, | ||
render (h) { | ||
return h('a', { class: 'page-component' }, this.page) | ||
} | ||
}) | ||
``` | ||
```html | ||
<sliding-pagination | ||
... | ||
pagination-component="example-page-component" | ||
></sliding-pagination> | ||
``` | ||
_Please keep in mind that the above example is absurdly simple for demonstration purposes | ||
and breaks the ARIA compatibility of the whole pagination component._ | ||
## Contributing | ||
Please do. Please be kind to each other. That's all. | ||
## License | ||
@@ -19,6 +180,16 @@ | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of this | ||
software and associated documentation files (the "Software"), to deal in the Software | ||
without restriction, including without limitation the rights to use, copy, modify, merge, | ||
publish, distribute, sublicense, and/or sell copies of the Software, and to permit | ||
persons to whom the Software is furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
The above copyright notice and this permission notice shall be included in all copies or | ||
substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE | ||
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
DEALINGS IN THE SOFTWARE. |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
38101
195
2