diff --git a/README.md b/README.md index 4fed8ae..c57c506 100644 --- a/README.md +++ b/README.md @@ -278,7 +278,7 @@ Here's an example: :classes="{ 'ul': 'simple-links-container', '.next > a': 'next-link', - '.prev > a': 'prev-link' + '.prev > a': ['prev-link', 'another-class'] // multiple classes }" > ``` diff --git a/dist/vue-paginate.js b/dist/vue-paginate.js index 9422883..7169c52 100644 --- a/dist/vue-paginate.js +++ b/dist/vue-paginate.js @@ -1,5 +1,5 @@ /** - * vue-paginate v3.2.1 + * vue-paginate v3.2.2 * (c) 2016 Taha Shashtari * @license MIT */ @@ -5689,7 +5689,12 @@ linksContainer.classList.add(classes['ul']) } linksContainer.querySelectorAll(selector).forEach(function (node) { - node.classList.add(classes[selector]) + var selectorValue = classes[selector] + if (Array.isArray(selectorValue)) { + selectorValue.forEach(function (c) { return node.classList.add(c); }) + } else { + node.classList.add(selectorValue) + } }) }) } diff --git a/dist/vue-paginate.min.js b/dist/vue-paginate.min.js index f145c0a..5edae6c 100644 --- a/dist/vue-paginate.min.js +++ b/dist/vue-paginate.min.js @@ -1,7 +1,7 @@ /** - * vue-paginate v3.2.1 + * vue-paginate v3.2.2 * (c) 2016 Taha Shashtari * @license MIT */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VuePaginate=e()}(this,function(){"use strict";function t(t){return null==t?"":"object"==typeof t?JSON.stringify(t,null,2):String(t)}function e(t){var e=parseFloat(t,10);return e||0===e?e:t}function n(t,e){for(var n=Object.create(null),r=t.split(","),i=0;i-1)return t.splice(n,1)}}function i(t,e){return mn.call(t,e)}function o(t){return"string"==typeof t||"number"==typeof t}function a(t){var e=Object.create(null);return function(n){var r=e[n];return r||(e[n]=t(n))}}function s(t,e){function n(n){var r=arguments.length;return r?r>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n}function c(t,e){e=e||0;for(var n=t.length-e,r=new Array(n);n--;)r[n]=t[n+e];return r}function u(t,e){for(var n in e)t[n]=e[n];return t}function l(t){return null!==t&&"object"==typeof t}function f(t){return Cn.call(t)===$n}function d(t){for(var e={},n=0;n=0&&Vn[n].id>t.id;)n--;Vn.splice(Math.max(n,qn)+1,0,t)}else Vn.push(t);Hn||(Hn=!0,Mn(k))}}function O(t){Wn.clear(),A(t,Wn)}function A(t,e){var n,r,i=Array.isArray(t);if((i||l(t))&&Object.isExtensible(t)){if(t.__ob__){var o=t.__ob__.dep.id;if(e.has(o))return;e.add(o)}if(i)for(n=t.length;n--;)A(t[n],e);else for(r=Object.keys(t),n=r.length;n--;)A(t[r[n]],e)}}function P(t,e){t.__proto__=e}function S(t,e,n){for(var r=0,i=n.length;r1?c(n):n;for(var r=c(arguments,1),i=0,o=n.length;i-1?xr[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:xr[t]=/HTMLUnknownElement/.test(e.toString())}function Zt(t){if("string"==typeof t){if(t=document.querySelector(t),!t)return document.createElement("div")}return t}function Qt(t,e){var n=document.createElement(t);return"select"!==t?n:(e.data&&e.data.attrs&&"multiple"in e.data.attrs&&n.setAttribute("multiple","multiple"),n)}function Xt(t,e){return document.createElementNS(wr[t],e)}function Yt(t){return document.createTextNode(t)}function te(t){return document.createComment(t)}function ee(t,e,n){t.insertBefore(e,n)}function ne(t,e){t.removeChild(e)}function re(t,e){t.appendChild(e)}function ie(t){return t.parentNode}function oe(t){return t.nextSibling}function ae(t){return t.tagName}function se(t,e){t.textContent=e}function ce(t){return t.childNodes}function ue(t,e,n){t.setAttribute(e,n)}function le(t,e){var n=t.data.ref;if(n){var i=t.context,o=t.child||t.elm,a=i.$refs;e?Array.isArray(a[n])?r(a[n],o):a[n]===o&&(a[n]=void 0):t.data.refInFor?Array.isArray(a[n])?a[n].push(o):a[n]=[o]:a[n]=o}}function fe(t){return null==t}function de(t){return null!=t}function pe(t,e){return t.key===e.key&&t.tag===e.tag&&t.isComment===e.isComment&&!t.data==!e.data}function he(t,e,n){var r,i,o={};for(r=e;r<=n;++r)i=t[r].key,de(i)&&(o[i]=r);return o}function ve(t){function e(t){return new tr($.tagName(t).toLowerCase(),{},[],void 0,t)}function n(t,e){function n(){0===--n.listeners&&r(t)}return n.listeners=e,n}function r(t){var e=$.parentNode(t);e&&$.removeChild(e,t)}function i(t,e,n){var r,i=t.data;if(t.isRootInsert=!n,de(i)&&(de(r=i.hook)&&de(r=r.init)&&r(t),de(r=t.child)))return u(t,e),t.elm;var o=t.children,s=t.tag;return de(s)?(t.elm=t.ns?$.createElementNS(t.ns,s):$.createElement(s,t),l(t),a(t,o,e),de(i)&&c(t,e)):t.isComment?t.elm=$.createComment(t.text):t.elm=$.createTextNode(t.text),t.elm}function a(t,e,n){if(Array.isArray(e))for(var r=0;rh?(u=fe(n[y+1])?null:n[y+1].elm,f(t,u,n,d,y,r)):d>y&&p(t,e,l,h)}function m(t,e,n,r){if(t!==e){if(e.isStatic&&t.isStatic&&e.key===t.key&&(e.isCloned||e.isOnce))return void(e.elm=t.elm);var i,o=e.data,a=de(o);a&&de(i=o.hook)&&de(i=i.prepatch)&&i(t,e);var c=e.elm=t.elm,u=t.children,l=e.children;if(a&&s(e)){for(i=0;i-1?e.split(/\s+/).forEach(function(e){return t.classList.add(e)}):t.classList.add(e);else{var n=" "+t.getAttribute("class")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function Ae(t,e){if(e&&e.trim())if(t.classList)e.indexOf(" ")>-1?e.split(/\s+/).forEach(function(e){return t.classList.remove(e)}):t.classList.remove(e);else{for(var n=" "+t.getAttribute("class")+" ",r=" "+e+" ";n.indexOf(r)>=0;)n=n.replace(r," ");t.setAttribute("class",n.trim())}}function Pe(t){Jr(function(){Jr(t)})}function Se(t,e){(t._transitionClasses||(t._transitionClasses=[])).push(e),Oe(t,e)}function je(t,e){t._transitionClasses&&r(t._transitionClasses,e),Ae(t,e)}function Te(t,e,n){var r=Ee(t,e),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===Fr?Kr:Gr,c=0,u=function(){t.removeEventListener(s,l),n()},l=function(e){e.target===t&&++c>=a&&u()};setTimeout(function(){c0&&(n=Fr,l=a,f=o.length):e===qr?u>0&&(n=qr,l=u,f=c.length):(l=Math.max(a,u),n=l>0?a>u?Fr:qr:null,f=n?n===Fr?o.length:c.length:0);var d=n===Fr&&Zr.test(r[zr+"Property"]);return{type:n,timeout:l,propCount:f,hasTransform:d}}function Le(t,e){for(;t.length1,P=e._enterCb=Be(function(){O&&je(e,w),P.cancelled?(O&&je(e,b),x&&x(e)):k&&k(e),e._enterCb=null});t.data.show||W(t.data.hook||(t.data.hook={}),"insert",function(){var n=e.parentNode,r=n&&n._pending&&n._pending[t.key];r&&r.tag===t.tag&&r.elm._leaveCb&&r.elm._leaveCb(),$&&$(e,P)},"transition-insert"),C&&C(e),O&&(Se(e,b),Se(e,w),Pe(function(){je(e,b),P.cancelled||A||Te(e,i,P)})),t.data.show&&$&&$(e,P),O||A||P()}}}function Me(t,e){function n(){m.cancelled||(t.data.show||((r.parentNode._pending||(r.parentNode._pending={}))[t.key]=t),u&&u(r),h&&(Se(r,s),Se(r,c),Pe(function(){je(r,s),m.cancelled||v||Te(r,a,m)})),l&&l(r,m),h||v||m())}var r=t.elm;r._enterCb&&(r._enterCb.cancelled=!0,r._enterCb());var i=Ie(t.data.transition);if(!i)return e();if(!r._leaveCb&&1===r.nodeType){var o=i.css,a=i.type,s=i.leaveClass,c=i.leaveActiveClass,u=i.beforeLeave,l=i.leave,f=i.afterLeave,d=i.leaveCancelled,p=i.delayLeave,h=o!==!1&&!Tn,v=l&&(l._length||l.length)>1,m=r._leaveCb=Be(function(){r.parentNode&&r.parentNode._pending&&(r.parentNode._pending[t.key]=null),h&&je(r,c),m.cancelled?(h&&je(r,s),d&&d(r)):(e(),f&&f(r)),r._leaveCb=null});p?p(n):n()}}function Ie(t){if(t){if("object"==typeof t){var e={};return t.css!==!1&&u(e,Qr(t.name||"v")),u(e,t),e}return"string"==typeof t?Qr(t):void 0}}function Be(t){var e=!1;return function(){e||(e=!0,t())}}function Ue(t,e,n){var r=e.value,i=t.multiple;if(!i||Array.isArray(r)){for(var o,a,s=0,c=t.options.length;s-1,a.selected!==o&&(a.selected=o);else if(v(Re(a),r))return void(t.selectedIndex!==s&&(t.selectedIndex=s));i||(t.selectedIndex=-1)}}function Ve(t,e){for(var n=0,r=e.length;n0&&(t.currentPage-=1)}}},i={on:{click:function(e){e.preventDefault(),t.currentPage=n?"disabled":""]},a={class:["prev",t.currentPage<=0?"disabled":""]},s=e("li",a,[e("a",r,t.simple.prev)]),c=e("li",o,[e("a",i,t.simple.next)]);return[s,c]}function nn(t,e){return t.filter(function(t){return"paginate"===t.$vnode.componentOptions.tag}).find(function(t){return t.name===e})}function rn(t){return Array.apply(null,{length:t}).map(function(t,e){return e})}function on(t,e){var n=[];return t===fi?n.push("left-arrow"):t===di?n.push("right-arrow"):t===pi?n.push("ellipses"):n.push("number"),t===e&&n.push("active"),n}function an(t,e,n){var r=Math.floor(n/e);return t===di||t===pi?(r+1)*e:t===fi?(r-1)*e:t}function sn(t,e){Object.keys(e).forEach(function(n){"ul"===n&&t.classList.add(e.ul),t.querySelectorAll(n).forEach(function(t){t.classList.add(e[n])})})}function cn(t){return void 0===t&&(t=[]),t.reduce(function(t,e){return t[e]={list:[],page:0},t},{})}var un,ln=function(){},fn="undefined"!=typeof console;ln=function(t,e,n){void 0===n&&(n="error"),fn&&console[n]("[vue-paginate]: "+t+" "+(e?pn(un(e)):""))},un=function(t){if(t.$root===t)return"root instance";var e=t._isVue?t.$options.name||t.$options._componentTag:t.name;return(e?"component <"+e+">":"anonymous component")+(t._isVue&&t.$options.__file?" at "+t.$options.__file:"")};var dn,pn=function(t){return"anonymous component"===t&&(t+=' - use the "name" option for better debugging messages.'),"\n(found in "+t+")"},hn={name:"paginate",props:{name:{type:String,required:!0},list:{type:Array,required:!0},per:{type:Number,default:3,validator:function(t){return t>0}},tag:{type:String,default:"ul"},class:{type:String}},data:function(){return{}},computed:{currentPage:{get:function(){if(this.$parent.paginate[this.name])return this.$parent.paginate[this.name].page},set:function(t){this.$parent.paginate[this.name].page=t}}},mounted:function(){return this.per<=0&&ln(' 'per' prop can't be 0 or less.",this.$parent),this.$parent.paginate[this.name]?void this.paginateList():void ln("'"+this.name+"' is not registered in 'paginate' array.",this.$parent)},watch:{currentPage:function(){this.paginateList()},list:function(){this.currentPage=0,this.paginateList()},per:function(){this.currentPage=0,this.paginateList()}},methods:{paginateList:function(){var t=this.currentPage*this.per,e=this.list.slice(t,t+this.per);this.$parent.paginate[this.name].list=e}},render:function(t){var e=this.class?this.class:"";return t(this.tag,{class:e},this.$slots.default)}},vn=n("slot,component",!0),mn=Object.prototype.hasOwnProperty,gn=/-(\w)/g,yn=a(function(t){return t.replace(gn,function(t,e){return e?e.toUpperCase():""})}),_n=a(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}),bn=/([^-])([A-Z])/g,wn=a(function(t){return t.replace(bn,"$1-$2").replace(bn,"$1-$2").toLowerCase()}),Cn=Object.prototype.toString,$n="[object Object]",kn=function(){return!1},xn={optionMergeStrategies:Object.create(null),silent:!1,devtools:!1,errorHandler:null,ignoredElements:null,keyCodes:Object.create(null),isReservedTag:kn,isUnknownElement:kn,getTagNamespace:p,mustUseProp:kn,_assetTypes:["component","directive","filter"],_lifecycleHooks:["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated"],_maxUpdateCount:100,_isServer:!1},On=/[^\w.$]/,An="__proto__"in{},Pn="undefined"!=typeof window&&"[object Object]"!==Object.prototype.toString.call(window),Sn=Pn&&window.navigator.userAgent.toLowerCase(),jn=Sn&&/msie|trident/.test(Sn),Tn=Sn&&Sn.indexOf("msie 9.0")>0,En=Sn&&Sn.indexOf("edge/")>0,Ln=Sn&&Sn.indexOf("android")>0,Dn=Sn&&/iphone|ipad|ipod|ios/.test(Sn),Nn=Pn&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__,Mn=function(){function t(){r=!1;var t=n.slice(0);n.length=0;for(var e=0;e,height,hidden,high,href,hreflang,http-equiv,icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,type,usemap,value,width,wrap"),"http://www.w3.org/1999/xlink"),yr=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},_r=function(t){return yr(t)?t.slice(6,t.length):""},br=function(t){return null==t||t===!1},wr={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML",xhtml:"http://www.w3.org/1999/xhtm"},Cr=n("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template"),$r=(n("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr",!0),n("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source",!0),n("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track",!0),n("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font,font-face,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0)),kr=function(t){return Cr(t)||$r(t)},xr=Object.create(null),Or=Object.freeze({createElement:Qt,createElementNS:Xt,createTextNode:Yt,createComment:te,insertBefore:ee,removeChild:ne,appendChild:re,parentNode:ie,nextSibling:oe,tagName:ae,setTextContent:se,childNodes:ce,setAttribute:ue}),Ar={create:function(t,e){le(e)},update:function(t,e){t.data.ref!==e.data.ref&&(le(t,!0),le(e))},destroy:function(t){le(t,!0)}},Pr=new tr("",{},[]),Sr=["create","update","remove","destroy"],jr={create:me,update:me,destroy:function(t){me(t,Pr)}},Tr=Object.create(null),Er=[Ar,jr],Lr={create:be,update:be},Dr={create:Ce,update:Ce},Nr={create:$e,update:$e},Mr={create:ke,update:ke},Ir=/^--/,Br=function(t,e,n){Ir.test(e)?t.style.setProperty(e,n):t.style[Vr(e)]=n},Ur=["Webkit","Moz","ms"],Vr=a(function(t){if(pr=pr||document.createElement("div"),t=yn(t),"filter"!==t&&t in pr.style)return t;for(var e=t.charAt(0).toUpperCase()+t.slice(1),n=0;n=this.limit&&t.unshift(fi),this.lastPage-this.limit>this._currentChunkIndex()&&t.push(pi),t},hi.prototype._buildSecondHalf=function(){var t=[this.lastPage];return this._currentChunkIndex()+this.limit 'simple' and 'limit' props can't be used at the same time. In this case, 'simple' will take precedence, and 'limit' will be ignored.",this.$parent,"warn"),this.simple&&!this.simple.next&&ln(' 'simple' prop doesn't contain 'next' value.",this.$parent),this.simple&&!this.simple.prev&&ln(' 'simple' prop doesn't contain 'prev' value.",this.$parent),li.nextTick(function(){t.updateListOfPages()})},watch:{"$parent.paginate":{handler:function(){this.updateListOfPages()},deep:!0},currentPage:function(t,e){this.$emit("change",t+1,e+1)}},methods:{updateListOfPages:function(){var t=nn(this.$parent.$children,this.for);if(!t)return void ln(' can\'t be used without its companion ',this.$parent);var e=Math.ceil(t.list.length/t.per);this.listOfPages=rn(e)}},render:function(t){var e=this,n=this.simple?en(this,t):this.limit>0?tn(this,t):Ye(this,t),r=t("ul",{class:["paginate-links",this.for]},n);return this.classes&&li.nextTick(function(){sn(r.elm,e.classes)}),r}},mi={};return mi.install=function(t){t.mixin({created:function(){"undefined"!==this.paginate&&this.paginate instanceof Array&&(this.paginate=cn(this.paginate))},methods:{paginated:function(t){return this.paginate&&this.paginate[t]?this.paginate[t].list:void ln("'"+t+"' is not registered in 'paginate' array.",this)}}}),t.component("paginate",hn),t.component("paginate-links",vi)},"undefined"!=typeof window&&window.Vue&&window.Vue.use(mi),mi}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VuePaginate=e()}(this,function(){"use strict";function t(t){return null==t?"":"object"==typeof t?JSON.stringify(t,null,2):String(t)}function e(t){var e=parseFloat(t,10);return e||0===e?e:t}function n(t,e){for(var n=Object.create(null),r=t.split(","),i=0;i-1)return t.splice(n,1)}}function i(t,e){return mn.call(t,e)}function o(t){return"string"==typeof t||"number"==typeof t}function a(t){var e=Object.create(null);return function(n){var r=e[n];return r||(e[n]=t(n))}}function s(t,e){function n(n){var r=arguments.length;return r?r>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n}function c(t,e){e=e||0;for(var n=t.length-e,r=new Array(n);n--;)r[n]=t[n+e];return r}function u(t,e){for(var n in e)t[n]=e[n];return t}function l(t){return null!==t&&"object"==typeof t}function f(t){return Cn.call(t)===$n}function d(t){for(var e={},n=0;n=0&&Vn[n].id>t.id;)n--;Vn.splice(Math.max(n,qn)+1,0,t)}else Vn.push(t);Hn||(Hn=!0,Mn(k))}}function A(t){Wn.clear(),O(t,Wn)}function O(t,e){var n,r,i=Array.isArray(t);if((i||l(t))&&Object.isExtensible(t)){if(t.__ob__){var o=t.__ob__.dep.id;if(e.has(o))return;e.add(o)}if(i)for(n=t.length;n--;)O(t[n],e);else for(r=Object.keys(t),n=r.length;n--;)O(t[r[n]],e)}}function P(t,e){t.__proto__=e}function S(t,e,n){for(var r=0,i=n.length;r1?c(n):n;for(var r=c(arguments,1),i=0,o=n.length;i-1?xr[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:xr[t]=/HTMLUnknownElement/.test(e.toString())}function Zt(t){if("string"==typeof t){if(t=document.querySelector(t),!t)return document.createElement("div")}return t}function Qt(t,e){var n=document.createElement(t);return"select"!==t?n:(e.data&&e.data.attrs&&"multiple"in e.data.attrs&&n.setAttribute("multiple","multiple"),n)}function Xt(t,e){return document.createElementNS(wr[t],e)}function Yt(t){return document.createTextNode(t)}function te(t){return document.createComment(t)}function ee(t,e,n){t.insertBefore(e,n)}function ne(t,e){t.removeChild(e)}function re(t,e){t.appendChild(e)}function ie(t){return t.parentNode}function oe(t){return t.nextSibling}function ae(t){return t.tagName}function se(t,e){t.textContent=e}function ce(t){return t.childNodes}function ue(t,e,n){t.setAttribute(e,n)}function le(t,e){var n=t.data.ref;if(n){var i=t.context,o=t.child||t.elm,a=i.$refs;e?Array.isArray(a[n])?r(a[n],o):a[n]===o&&(a[n]=void 0):t.data.refInFor?Array.isArray(a[n])?a[n].push(o):a[n]=[o]:a[n]=o}}function fe(t){return null==t}function de(t){return null!=t}function pe(t,e){return t.key===e.key&&t.tag===e.tag&&t.isComment===e.isComment&&!t.data==!e.data}function he(t,e,n){var r,i,o={};for(r=e;r<=n;++r)i=t[r].key,de(i)&&(o[i]=r);return o}function ve(t){function e(t){return new tr($.tagName(t).toLowerCase(),{},[],void 0,t)}function n(t,e){function n(){0===--n.listeners&&r(t)}return n.listeners=e,n}function r(t){var e=$.parentNode(t);e&&$.removeChild(e,t)}function i(t,e,n){var r,i=t.data;if(t.isRootInsert=!n,de(i)&&(de(r=i.hook)&&de(r=r.init)&&r(t),de(r=t.child)))return u(t,e),t.elm;var o=t.children,s=t.tag;return de(s)?(t.elm=t.ns?$.createElementNS(t.ns,s):$.createElement(s,t),l(t),a(t,o,e),de(i)&&c(t,e)):t.isComment?t.elm=$.createComment(t.text):t.elm=$.createTextNode(t.text),t.elm}function a(t,e,n){if(Array.isArray(e))for(var r=0;rh?(u=fe(n[y+1])?null:n[y+1].elm,f(t,u,n,d,y,r)):d>y&&p(t,e,l,h)}function m(t,e,n,r){if(t!==e){if(e.isStatic&&t.isStatic&&e.key===t.key&&(e.isCloned||e.isOnce))return void(e.elm=t.elm);var i,o=e.data,a=de(o);a&&de(i=o.hook)&&de(i=i.prepatch)&&i(t,e);var c=e.elm=t.elm,u=t.children,l=e.children;if(a&&s(e)){for(i=0;i-1?e.split(/\s+/).forEach(function(e){return t.classList.add(e)}):t.classList.add(e);else{var n=" "+t.getAttribute("class")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function Oe(t,e){if(e&&e.trim())if(t.classList)e.indexOf(" ")>-1?e.split(/\s+/).forEach(function(e){return t.classList.remove(e)}):t.classList.remove(e);else{for(var n=" "+t.getAttribute("class")+" ",r=" "+e+" ";n.indexOf(r)>=0;)n=n.replace(r," ");t.setAttribute("class",n.trim())}}function Pe(t){Jr(function(){Jr(t)})}function Se(t,e){(t._transitionClasses||(t._transitionClasses=[])).push(e),Ae(t,e)}function je(t,e){t._transitionClasses&&r(t._transitionClasses,e),Oe(t,e)}function Te(t,e,n){var r=Ee(t,e),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===Fr?Kr:Gr,c=0,u=function(){t.removeEventListener(s,l),n()},l=function(e){e.target===t&&++c>=a&&u()};setTimeout(function(){c0&&(n=Fr,l=a,f=o.length):e===qr?u>0&&(n=qr,l=u,f=c.length):(l=Math.max(a,u),n=l>0?a>u?Fr:qr:null,f=n?n===Fr?o.length:c.length:0);var d=n===Fr&&Zr.test(r[zr+"Property"]);return{type:n,timeout:l,propCount:f,hasTransform:d}}function Le(t,e){for(;t.length1,P=e._enterCb=Be(function(){A&&je(e,w),P.cancelled?(A&&je(e,b),x&&x(e)):k&&k(e),e._enterCb=null});t.data.show||W(t.data.hook||(t.data.hook={}),"insert",function(){var n=e.parentNode,r=n&&n._pending&&n._pending[t.key];r&&r.tag===t.tag&&r.elm._leaveCb&&r.elm._leaveCb(),$&&$(e,P)},"transition-insert"),C&&C(e),A&&(Se(e,b),Se(e,w),Pe(function(){je(e,b),P.cancelled||O||Te(e,i,P)})),t.data.show&&$&&$(e,P),A||O||P()}}}function Me(t,e){function n(){m.cancelled||(t.data.show||((r.parentNode._pending||(r.parentNode._pending={}))[t.key]=t),u&&u(r),h&&(Se(r,s),Se(r,c),Pe(function(){je(r,s),m.cancelled||v||Te(r,a,m)})),l&&l(r,m),h||v||m())}var r=t.elm;r._enterCb&&(r._enterCb.cancelled=!0,r._enterCb());var i=Ie(t.data.transition);if(!i)return e();if(!r._leaveCb&&1===r.nodeType){var o=i.css,a=i.type,s=i.leaveClass,c=i.leaveActiveClass,u=i.beforeLeave,l=i.leave,f=i.afterLeave,d=i.leaveCancelled,p=i.delayLeave,h=o!==!1&&!Tn,v=l&&(l._length||l.length)>1,m=r._leaveCb=Be(function(){r.parentNode&&r.parentNode._pending&&(r.parentNode._pending[t.key]=null),h&&je(r,c),m.cancelled?(h&&je(r,s),d&&d(r)):(e(),f&&f(r)),r._leaveCb=null});p?p(n):n()}}function Ie(t){if(t){if("object"==typeof t){var e={};return t.css!==!1&&u(e,Qr(t.name||"v")),u(e,t),e}return"string"==typeof t?Qr(t):void 0}}function Be(t){var e=!1;return function(){e||(e=!0,t())}}function Ue(t,e,n){var r=e.value,i=t.multiple;if(!i||Array.isArray(r)){for(var o,a,s=0,c=t.options.length;s-1,a.selected!==o&&(a.selected=o);else if(v(Re(a),r))return void(t.selectedIndex!==s&&(t.selectedIndex=s));i||(t.selectedIndex=-1)}}function Ve(t,e){for(var n=0,r=e.length;n0&&(t.currentPage-=1)}}},i={on:{click:function(e){e.preventDefault(),t.currentPage=n?"disabled":""]},a={class:["prev",t.currentPage<=0?"disabled":""]},s=e("li",a,[e("a",r,t.simple.prev)]),c=e("li",o,[e("a",i,t.simple.next)]);return[s,c]}function nn(t,e){return t.filter(function(t){return"paginate"===t.$vnode.componentOptions.tag}).find(function(t){return t.name===e})}function rn(t){return Array.apply(null,{length:t}).map(function(t,e){return e})}function on(t,e){var n=[];return t===fi?n.push("left-arrow"):t===di?n.push("right-arrow"):t===pi?n.push("ellipses"):n.push("number"),t===e&&n.push("active"),n}function an(t,e,n){var r=Math.floor(n/e);return t===di||t===pi?(r+1)*e:t===fi?(r-1)*e:t}function sn(t,e){Object.keys(e).forEach(function(n){"ul"===n&&t.classList.add(e.ul),t.querySelectorAll(n).forEach(function(t){var r=e[n];Array.isArray(r)?r.forEach(function(e){return t.classList.add(e)}):t.classList.add(r)})})}function cn(t){return void 0===t&&(t=[]),t.reduce(function(t,e){return t[e]={list:[],page:0},t},{})}var un,ln=function(){},fn="undefined"!=typeof console;ln=function(t,e,n){void 0===n&&(n="error"),fn&&console[n]("[vue-paginate]: "+t+" "+(e?pn(un(e)):""))},un=function(t){if(t.$root===t)return"root instance";var e=t._isVue?t.$options.name||t.$options._componentTag:t.name;return(e?"component <"+e+">":"anonymous component")+(t._isVue&&t.$options.__file?" at "+t.$options.__file:"")};var dn,pn=function(t){return"anonymous component"===t&&(t+=' - use the "name" option for better debugging messages.'),"\n(found in "+t+")"},hn={name:"paginate",props:{name:{type:String,required:!0},list:{type:Array,required:!0},per:{type:Number,default:3,validator:function(t){return t>0}},tag:{type:String,default:"ul"},class:{type:String}},data:function(){return{}},computed:{currentPage:{get:function(){if(this.$parent.paginate[this.name])return this.$parent.paginate[this.name].page},set:function(t){this.$parent.paginate[this.name].page=t}}},mounted:function(){return this.per<=0&&ln(' 'per' prop can't be 0 or less.",this.$parent),this.$parent.paginate[this.name]?void this.paginateList():void ln("'"+this.name+"' is not registered in 'paginate' array.",this.$parent)},watch:{currentPage:function(){this.paginateList()},list:function(){this.currentPage=0,this.paginateList()},per:function(){this.currentPage=0,this.paginateList()}},methods:{paginateList:function(){var t=this.currentPage*this.per,e=this.list.slice(t,t+this.per);this.$parent.paginate[this.name].list=e}},render:function(t){var e=this.class?this.class:"";return t(this.tag,{class:e},this.$slots.default)}},vn=n("slot,component",!0),mn=Object.prototype.hasOwnProperty,gn=/-(\w)/g,yn=a(function(t){return t.replace(gn,function(t,e){return e?e.toUpperCase():""})}),_n=a(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}),bn=/([^-])([A-Z])/g,wn=a(function(t){return t.replace(bn,"$1-$2").replace(bn,"$1-$2").toLowerCase()}),Cn=Object.prototype.toString,$n="[object Object]",kn=function(){return!1},xn={optionMergeStrategies:Object.create(null),silent:!1,devtools:!1,errorHandler:null,ignoredElements:null,keyCodes:Object.create(null),isReservedTag:kn,isUnknownElement:kn,getTagNamespace:p,mustUseProp:kn,_assetTypes:["component","directive","filter"],_lifecycleHooks:["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated"],_maxUpdateCount:100,_isServer:!1},An=/[^\w.$]/,On="__proto__"in{},Pn="undefined"!=typeof window&&"[object Object]"!==Object.prototype.toString.call(window),Sn=Pn&&window.navigator.userAgent.toLowerCase(),jn=Sn&&/msie|trident/.test(Sn),Tn=Sn&&Sn.indexOf("msie 9.0")>0,En=Sn&&Sn.indexOf("edge/")>0,Ln=Sn&&Sn.indexOf("android")>0,Dn=Sn&&/iphone|ipad|ipod|ios/.test(Sn),Nn=Pn&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__,Mn=function(){function t(){r=!1;var t=n.slice(0);n.length=0;for(var e=0;e,height,hidden,high,href,hreflang,http-equiv,icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,type,usemap,value,width,wrap"),"http://www.w3.org/1999/xlink"),yr=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},_r=function(t){return yr(t)?t.slice(6,t.length):""},br=function(t){return null==t||t===!1},wr={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML",xhtml:"http://www.w3.org/1999/xhtm"},Cr=n("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template"),$r=(n("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr",!0),n("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source",!0),n("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track",!0),n("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font,font-face,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0)),kr=function(t){return Cr(t)||$r(t)},xr=Object.create(null),Ar=Object.freeze({createElement:Qt,createElementNS:Xt,createTextNode:Yt,createComment:te,insertBefore:ee,removeChild:ne,appendChild:re,parentNode:ie,nextSibling:oe,tagName:ae,setTextContent:se,childNodes:ce,setAttribute:ue}),Or={create:function(t,e){le(e)},update:function(t,e){t.data.ref!==e.data.ref&&(le(t,!0),le(e))},destroy:function(t){le(t,!0)}},Pr=new tr("",{},[]),Sr=["create","update","remove","destroy"],jr={create:me,update:me,destroy:function(t){me(t,Pr)}},Tr=Object.create(null),Er=[Or,jr],Lr={create:be,update:be},Dr={create:Ce,update:Ce},Nr={create:$e,update:$e},Mr={create:ke,update:ke},Ir=/^--/,Br=function(t,e,n){Ir.test(e)?t.style.setProperty(e,n):t.style[Vr(e)]=n},Ur=["Webkit","Moz","ms"],Vr=a(function(t){if(pr=pr||document.createElement("div"),t=yn(t),"filter"!==t&&t in pr.style)return t;for(var e=t.charAt(0).toUpperCase()+t.slice(1),n=0;n=this.limit&&t.unshift(fi),this.lastPage-this.limit>this._currentChunkIndex()&&t.push(pi),t},hi.prototype._buildSecondHalf=function(){var t=[this.lastPage];return this._currentChunkIndex()+this.limit 'simple' and 'limit' props can't be used at the same time. In this case, 'simple' will take precedence, and 'limit' will be ignored.",this.$parent,"warn"),this.simple&&!this.simple.next&&ln(' 'simple' prop doesn't contain 'next' value.",this.$parent),this.simple&&!this.simple.prev&&ln(' 'simple' prop doesn't contain 'prev' value.",this.$parent),li.nextTick(function(){t.updateListOfPages()})},watch:{"$parent.paginate":{handler:function(){this.updateListOfPages()},deep:!0},currentPage:function(t,e){this.$emit("change",t+1,e+1)}},methods:{updateListOfPages:function(){var t=nn(this.$parent.$children,this.for);if(!t)return void ln(' can\'t be used without its companion ',this.$parent);var e=Math.ceil(t.list.length/t.per);this.listOfPages=rn(e)}},render:function(t){var e=this,n=this.simple?en(this,t):this.limit>0?tn(this,t):Ye(this,t),r=t("ul",{class:["paginate-links",this.for]},n);return this.classes&&li.nextTick(function(){sn(r.elm,e.classes)}),r}},mi={};return mi.install=function(t){t.mixin({created:function(){"undefined"!==this.paginate&&this.paginate instanceof Array&&(this.paginate=cn(this.paginate))},methods:{paginated:function(t){return this.paginate&&this.paginate[t]?this.paginate[t].list:void ln("'"+t+"' is not registered in 'paginate' array.",this)}}}),t.component("paginate",hn),t.component("paginate-links",vi)},"undefined"!=typeof window&&window.Vue&&window.Vue.use(mi),mi}); \ No newline at end of file diff --git a/package.json b/package.json index 845ec18..c0ddab9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-paginate", - "version": "3.2.1", + "version": "3.2.2", "description": "A simple vue.js plugin to paginate data", "main": "dist/vue-paginate.js", "scripts": { diff --git a/src/components/PaginateLinks.js b/src/components/PaginateLinks.js index 1848f0c..161064b 100644 --- a/src/components/PaginateLinks.js +++ b/src/components/PaginateLinks.js @@ -213,7 +213,12 @@ function addAdditionalClasses (linksContainer, classes) { linksContainer.classList.add(classes['ul']) } linksContainer.querySelectorAll(selector).forEach(node => { - node.classList.add(classes[selector]) + const selectorValue = classes[selector] + if (Array.isArray(selectorValue)) { + selectorValue.forEach(c => node.classList.add(c)) + } else { + node.classList.add(selectorValue) + } }) }) }