lib/javascripts/pagy.js in pagy-5.7.6 vs lib/javascripts/pagy.js in pagy-5.8.0
- old
+ new
@@ -1 +1 @@
-!function(){function n(n){if(Array.isArray(n))return n}function t(n){if(Symbol.iterator in Object(n)||"[object Arguments]"===Object.prototype.toString.call(n))return Array.from(n)}function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function r(r,i){return n(r)||t(r)||e()}var i={version:"5.7.6",init:function(r){var a,o=(r instanceof Element?r:document).querySelectorAll("[data-pagy-json]"),c=!0,u=!1,l=void 0;try{for(var f,s=o[Symbol.iterator]();!(c=(f=s.next()).done);c=!0){var p=f.value;try{var v=p.getAttribute("data-pagy-json"),g=n(a=JSON.parse(v))||t(a)||e(),y=g[0],d=g.slice(1);"nav"===y?i.initNav(p,d):"combo"===y?i.initCombo(p,d):"selector"===y?i.initSelector(p,d):i.initWarn(p,'Illegal PagyJSON keyword: expected "nav"|"combo"|"selector", got "'.concat(y,'"'))}catch(n){i.initWarn(p,n)}}}catch(n){u=!0,l=n}finally{try{c||null==s.return||s.return()}finally{if(u)throw l}}},initWarn:function(n,t){console.warn("Pagy.init() skipped element: %o\n%s",n,t)},initNav:function(n,t){var e,a=r(t),o=a[0],c=a[1],u=a[2],l=a[3],f=null!==(e=n.parentElement)&&void 0!==e?e:n,s=Object.keys(c).map((function(n){return parseInt(n)})).sort((function(n,t){return t-n})),p=-1,v=function(n,t,e){return n.replace(/__pagy_page__/g,t).replace(/__pagy_label__/g,e)};(n.pagyRender=function(){var t=s.find((function(n){return n<f.clientWidth}))||0;if(t!==p){var e,r=o.before,a=c[t.toString()],g=null!==(e=null==u?void 0:u[t.toString()])&&void 0!==e?e:a.map((function(n){return n.toString()}));for(var y in a){var d=a[y],_=g[y];r+="string"==typeof l&&1===d?i.trim(v(o.link,d.toString(),_),l):"number"==typeof d?v(o.link,d.toString(),_):"gap"===d?o.gap:v(o.active,d,_)}r+=o.after,n.innerHTML="",n.insertAdjacentHTML("afterbegin",r),p=t}})(),n.classList.contains("pagy-rjs")&&i.rjsObserver.observe(f)},rjsObserver:new ResizeObserver((function(n){n.forEach((function(n){return n.target.querySelectorAll(".pagy-rjs").forEach((function(n){return n.pagyRender()}))}))})),initCombo:function(n,t){var e=r(t),a=e[0],o=e[1];i.initInput(n,(function(n){return[n,a.replace(/__pagy_page__/,n)]}),o)},initSelector:function(n,t){var e=r(t),a=e[0],o=e[1],c=e[2];i.initInput(n,(function(n){var t=Math.max(Math.ceil(a/parseInt(n)),1).toString();return[t,o.replace(/__pagy_page__/,t).replace(/__pagy_items__/,n)]}),c)},initInput:function(n,t,e){var a=n.querySelector("input"),o=a.value,c=function(){if(a.value!==o){var c=r([a.min,a.value,a.max].map((function(n){return parseInt(n)||0}))),u=c[0],l=c[1],f=c[2];if(l<u||l>f)return a.value=o,void a.select();var s=r(t(a.value)),p=s[0],v=s[1];"string"==typeof e&&"1"===p&&(v=i.trim(v,e)),n.insertAdjacentHTML("afterbegin",v),n.querySelector("a").click()}};["change","focus"].forEach((function(n){return a.addEventListener(n,a.select)})),a.addEventListener("focusout",c),a.addEventListener("keypress",(function(n){"Enter"===n.key&&c()}))},trim:function(n,t){return n.replace(new RegExp("[?&]".concat(t,"=1\\b(?!&)|\\b").concat(t,"=1&")),"")}},a=i;window.Pagy=a}();
+!function(){function t(t){if(Array.isArray(t))return t}function n(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function r(r,i){return t(r)||n(r)||e()}var i={version:"5.8.0",init:function(r){var a,o=(r instanceof Element?r:document).querySelectorAll("[data-pagy]"),c=!0,u=!1,l=void 0;try{for(var f,p=o[Symbol.iterator]();!(c=(f=p.next()).done);c=!0){var s=f.value;try{var v=t(a=JSON.parse(atob(s.getAttribute("data-pagy"))))||n(a)||e(),g=v[0],y=v.slice(1);"nav"===g?i.initNav(s,y):"combo"===g?i.initCombo(s,y):"selector"===g?i.initSelector(s,y):i.initWarn(s,'Illegal PagyJSON keyword: expected "nav"|"combo"|"selector", got "'.concat(g,'"'))}catch(t){i.initWarn(s,t)}}}catch(t){u=!0,l=t}finally{try{c||null==p.return||p.return()}finally{if(u)throw l}}},initWarn:function(t,n){console.warn("Pagy.init() skipped element: %o\n%s",t,n)},initNav:function(t,n){var e,a=r(n),o=a[0],c=a[1],u=a[2],l=a[3],f=null!==(e=t.parentElement)&&void 0!==e?e:t,p=Object.keys(c).map((function(t){return parseInt(t)})).sort((function(t,n){return n-t})),s=-1,v=function(t,n,e){return t.replace(/__pagy_page__/g,n).replace(/__pagy_label__/g,e)};(t.pagyRender=function(){var n=p.find((function(t){return t<f.clientWidth}))||0;if(n!==s){var e,r=o.before,a=c[n.toString()],g=null!==(e=null==u?void 0:u[n.toString()])&&void 0!==e?e:a.map((function(t){return t.toString()}));for(var y in a){var d=a[y],_=g[y];r+="string"==typeof l&&1===d?i.trim(v(o.link,d.toString(),_),l):"number"==typeof d?v(o.link,d.toString(),_):"gap"===d?o.gap:v(o.active,d,_)}r+=o.after,t.innerHTML="",t.insertAdjacentHTML("afterbegin",r),s=n}})(),t.classList.contains("pagy-rjs")&&i.rjsObserver.observe(f)},rjsObserver:new ResizeObserver((function(t){t.forEach((function(t){return t.target.querySelectorAll(".pagy-rjs").forEach((function(t){return t.pagyRender()}))}))})),initCombo:function(t,n){var e=r(n),a=e[0],o=e[1];i.initInput(t,(function(t){return[t,a.replace(/__pagy_page__/,t)]}),o)},initSelector:function(t,n){var e=r(n),a=e[0],o=e[1],c=e[2];i.initInput(t,(function(t){var n=Math.max(Math.ceil(a/parseInt(t)),1).toString();return[n,o.replace(/__pagy_page__/,n).replace(/__pagy_items__/,t)]}),c)},initInput:function(t,n,e){var a=t.querySelector("input"),o=a.value,c=function(){if(a.value!==o){var c=r([a.min,a.value,a.max].map((function(t){return parseInt(t)||0}))),u=c[0],l=c[1],f=c[2];if(l<u||l>f)return a.value=o,void a.select();var p=r(n(a.value)),s=p[0],v=p[1];"string"==typeof e&&"1"===s&&(v=i.trim(v,e)),t.insertAdjacentHTML("afterbegin",v),t.querySelector("a").click()}};["change","focus"].forEach((function(t){return a.addEventListener(t,a.select)})),a.addEventListener("focusout",c),a.addEventListener("keypress",(function(t){"Enter"===t.key&&c()}))},trim:function(t,n){return t.replace(new RegExp("[?&]".concat(n,"=1\\b(?!&)|\\b").concat(n,"=1&")),"")}},a=i;window.Pagy=a}();
\ No newline at end of file