pagy 8.5.0 → 8.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22f1b2cf0e1e346db403793430d8067eb38c6e381f04c828831b0afd76a86e29
4
- data.tar.gz: fa0a2b31ff82d9ca4245bbcacb55809699cd2dceb541688b470bfd4c52d4f086
3
+ metadata.gz: 64310e33e814b9dad81f04eceaaee4d661f338c100585530d57fd9ba36a74459
4
+ data.tar.gz: d354a97e8cfa8238522be0fd9c1625e054857c6191053e782babbf292b00e2ee
5
5
  SHA512:
6
- metadata.gz: 88b6c59981420ec7b53ff817dc6b2e24e30cd88fcaa621cd2659fc6b11706e21f429895c0a0ba82cbf97183bf6ad725145fb38259ec4d435bef8838ff1a64584
7
- data.tar.gz: 43361f5bec90b80ed51939da57825903df31f0c4fcfe8e1db0523ba1f4bb36d69e39f467a649c1617f15b18ca2dafb3d4d078a11635925482e09aa6c5501f61d
6
+ metadata.gz: 27299eba491feb5030f93186ea78c04c4203674bf5256596f195307ac5dd1e965e49f28b01883029b7e3e19e8509b58402e5aaeb21687f9f22b1e53d6be56ec9
7
+ data.tar.gz: 9e067d7d31f2395939b03f5536c8128e089a59e8d811bfe4513752878b0c8cf4ec338f2907638cf694c9e0719237e7adbdc1c0768d9b50b6861004376bac5eca
data/apps/calendar.ru CHANGED
@@ -15,7 +15,7 @@
15
15
  # DOC
16
16
  # https://ddnexus.github.io/pagy/playground/#5-calendar-app
17
17
 
18
- VERSION = '8.5.0'
18
+ VERSION = '8.6.1'
19
19
 
20
20
  # Gemfile
21
21
  require 'bundler/inline'
data/apps/demo.ru CHANGED
@@ -18,7 +18,7 @@
18
18
  # DOC
19
19
  # https://ddnexus.github.io/pagy/playground/#3-demo-app
20
20
 
21
- VERSION = '8.5.0'
21
+ VERSION = '8.6.1'
22
22
 
23
23
  require 'bundler/inline'
24
24
  require 'bundler'
@@ -44,7 +44,6 @@ end
44
44
  require 'pagy/extras/items'
45
45
  require 'pagy/extras/trim'
46
46
  Pagy::DEFAULT[:trim_extra] = false # opt-in trim
47
- Pagy::DEFAULT[:size] = [1, 4, 4, 1] # old size default
48
47
 
49
48
  # sinatra setup
50
49
  require 'sinatra/base'
@@ -381,18 +380,18 @@ for details</p>
381
380
  <%= html = send(:"pagy#{prefix}_nav", @pagy, id: 'simple-nav', aria_label: 'Pages simple-nav', size: 5) %>
382
381
  <%= highlight(html) %>
383
382
 
384
- <h2>pagy<%= prefix %>_nav <span class="notes">Classic nav <code>size: [1,4,4,1]</code></span></h2>
383
+ <h2>pagy<%= prefix %>_nav <span class="notes">Classic nav <code>size: 7</code></span></h2>
385
384
  <%= html = send(:"pagy#{prefix}_nav", @pagy, id: 'nav', aria_label: 'Pages nav') %>
386
385
  <%= highlight(html) %>
387
386
 
388
- <h2>pagy<%= prefix %>_nav_js <span class="notes">Classic nav <code>size: [1,4,4,1]</code></span></h2>
387
+ <h2>pagy<%= prefix %>_nav_js <span class="notes">Classic nav <code>size: 7</code></span></h2>
389
388
  <%= html = send(:"pagy#{prefix}_nav_js", @pagy, id: 'nav-js', aria_label: 'Pages nav_js') %>
390
389
  <%= highlight(html) %>
391
390
 
392
391
  <h2>pagy<%= prefix %>_nav_js <span class="notes">Responsive <code>steps: {...}</code> (Resize the window to see)</span></h2>
393
392
  <%= html = send(:"pagy#{prefix}_nav_js", @pagy, id: 'nav-js-responsive',
394
393
  aria_label: 'Pages nav_js_responsive',
395
- steps: { 0 => [1,1,1,1], 500 => [1,3,3,1], 750 => [1,5,5,1], 1000 => [2,6,6,2] }) %>
394
+ steps: { 0 => 5, 500 => 7, 750 => 9, 1000 => 11 }) %>
396
395
  <%= highlight(html) %>
397
396
 
398
397
  <h2>pagy<%= prefix %>_combo_nav_js</h2>
data/apps/rails.ru CHANGED
@@ -15,7 +15,7 @@
15
15
  # DOC
16
16
  # https://ddnexus.github.io/pagy/playground/#2-rails-app
17
17
 
18
- VERSION = '8.5.0'
18
+ VERSION = '8.6.1'
19
19
 
20
20
  # Gemfile
21
21
  require 'bundler/inline'
@@ -63,7 +63,6 @@ end
63
63
  require 'pagy/extras/pagy'
64
64
  require 'pagy/extras/items'
65
65
  require 'pagy/extras/overflow'
66
- Pagy::DEFAULT[:size] = [1, 4, 4, 1]
67
66
  Pagy::DEFAULT[:items] = 10
68
67
  Pagy::DEFAULT[:overflow] = :empty_page
69
68
  Pagy::DEFAULT.freeze
data/apps/repro.ru CHANGED
@@ -15,7 +15,7 @@
15
15
  # DOC
16
16
  # https://ddnexus.github.io/pagy/playground/#1-repro-app
17
17
 
18
- VERSION = '8.5.0'
18
+ VERSION = '8.6.1'
19
19
 
20
20
  require 'bundler/inline'
21
21
  require 'bundler'
@@ -34,7 +34,6 @@ require 'pagy/extras/pagy'
34
34
  require 'pagy/extras/items'
35
35
  require 'pagy/extras/overflow'
36
36
  Pagy::DEFAULT[:overflow] = :empty_page
37
- Pagy::DEFAULT[:size] = [1, 4, 4, 1]
38
37
  Pagy::DEFAULT.freeze
39
38
 
40
39
  require 'sinatra/base'
Binary file
Binary file
Binary file
data/bin/pagy CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- VERSION = '8.5.0'
4
+ VERSION = '8.6.1'
5
5
  APPS = %w[repro rails demo calendar].freeze
6
6
  LINUX = RbConfig::CONFIG['host_os'].include?('linux')
7
7
  HOST = '0.0.0.0'
data/config/pagy.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Pagy initializer file (8.5.0)
3
+ # Pagy initializer file (8.6.1)
4
4
  # Customize only what you really need and notice that the core Pagy works also without any of the following lines.
5
5
  # Should you just cherry pick part of this file, please maintain the require-order of the extras
6
6
 
@@ -11,7 +11,8 @@
11
11
  # Pagy.new|Pagy::Countless.new|Pagy::Calendar::*.new or any of the #pagy* controller methods
12
12
  # Here are the few that make more sense as DEFAULTs:
13
13
  # Pagy::DEFAULT[:items] = 20 # default
14
- # Pagy::DEFAULT[:size] = [1,4,4,1] # default in pagy < 7.0
14
+ # Pagy::DEFAULT[:size] = 7 # default
15
+ # Pagy::DEFAULT[:ends] = true # default
15
16
  # Pagy::DEFAULT[:page_param] = :page # default
16
17
  # Pagy::DEFAULT[:count_args] = [] # example for non AR ORMs
17
18
 
@@ -20,6 +21,13 @@
20
21
  # See https://ddnexus.github.io/pagy/categories/extra
21
22
 
22
23
 
24
+ # Legacy Compatibility Extras
25
+
26
+ # Size extra: Enable the Array type for the `:size` variable (e.g. `size: [1,4,4,1]`)
27
+ # See https://ddnexus.github.io/pagy/docs/extras/size
28
+ # require 'pagy/extras/size' # must be required before the other extras
29
+
30
+
23
31
  # Backend Extras
24
32
 
25
33
  # Arel extra: For better performance utilizing grouped ActiveRecord collections:
@@ -33,21 +41,12 @@
33
41
  # Calendar extra: Add pagination filtering by calendar time unit (year, quarter, month, week, day)
34
42
  # See https://ddnexus.github.io/pagy/docs/extras/calendar
35
43
  # require 'pagy/extras/calendar'
36
- # Default for each unit
37
- # Pagy::Calendar::Year::DEFAULT[:order] = :asc # Time direction of pagination
38
- # Pagy::Calendar::Year::DEFAULT[:format] = '%Y' # strftime format
39
- #
40
- # Pagy::Calendar::Quarter::DEFAULT[:order] = :asc # Time direction of pagination
41
- # Pagy::Calendar::Quarter::DEFAULT[:format] = '%Y-Q%q' # strftime format
42
- #
43
- # Pagy::Calendar::Month::DEFAULT[:order] = :asc # Time direction of pagination
44
- # Pagy::Calendar::Month::DEFAULT[:format] = '%Y-%m' # strftime format
45
- #
46
- # Pagy::Calendar::Week::DEFAULT[:order] = :asc # Time direction of pagination
47
- # Pagy::Calendar::Week::DEFAULT[:format] = '%Y-%W' # strftime format
48
- #
49
- # Pagy::Calendar::Day::DEFAULT[:order] = :asc # Time direction of pagination
50
- # Pagy::Calendar::Day::DEFAULT[:format] = '%Y-%m-%d' # strftime format
44
+ # Default for each calendar unit class in IRB:
45
+ # >> Pagy::Calendar::Year::DEFAULT
46
+ # >> Pagy::Calendar::Quarter::DEFAULT
47
+ # >> Pagy::Calendar::Month::DEFAULT
48
+ # >> Pagy::Calendar::Week::DEFAULT
49
+ # >> Pagy::Calendar::Day::DEFAULT
51
50
  #
52
51
  # Uncomment the following lines, if you need calendar localization without using the I18n extra
53
52
  # module LocalizePagyCalendar
@@ -125,7 +124,7 @@
125
124
 
126
125
  # Multi size var used by the *_nav_js helpers
127
126
  # See https://ddnexus.github.io/pagy/docs/extras/pagy#steps
128
- # Pagy::DEFAULT[:steps] = { 0 => [2,3,3,2], 540 => [3,5,5,3], 720 => [5,7,7,5] } # example
127
+ # Pagy::DEFAULT[:steps] = { 0 => 5, 540 => 7, 720 => 9 } # example
129
128
 
130
129
 
131
130
  # Feature Extras
@@ -167,7 +166,6 @@
167
166
  # set to false only if you want to make :jsonapi an opt-in variable
168
167
  # Pagy::DEFAULT[:jsonapi] = false # default true
169
168
 
170
-
171
169
  # Rails
172
170
  # Enable the .js file required by the helpers that use javascript
173
171
  # (pagy*_nav_js, pagy*_combo_nav_js, and pagy_items_selector_js)
@@ -73,7 +73,7 @@ const Pagy = (() => {
73
73
  };
74
74
  const trim = (a, param) => a.replace(new RegExp(`[?&]${param}=1\\b(?!&)|\\b${param}=1&`), "");
75
75
  return {
76
- version: "8.5.0",
76
+ version: "8.6.1",
77
77
  init(arg) {
78
78
  const target = arg instanceof Element ? arg : document;
79
79
  const elements = target.querySelectorAll("[data-pagy]");
data/javascripts/pagy.js CHANGED
@@ -1,4 +1,4 @@
1
- window.Pagy=(()=>{const j=new ResizeObserver((B)=>B.forEach((D)=>D.target.querySelectorAll(".pagy-rjs").forEach((E)=>E.pagyRender()))),x=(B,[D,E,z,G])=>{const F=B.parentElement??B,K=Object.keys(E).map((H)=>parseInt(H)).sort((H,M)=>M-H);let L=-1;const T=(H,M,R)=>H.replace(/__pagy_page__/g,M).replace(/__pagy_label__/g,R);if((B.pagyRender=function(){const H=K.find((Q)=>Q<F.clientWidth)||0;if(H===L)return;let M=D.before;const R=E[H.toString()],X=z?.[H.toString()]??R.map((Q)=>Q.toString());R.forEach((Q,J)=>{const $=X[J];let U;if(typeof Q==="number")U=T(D.a,Q.toString(),$);else if(Q==="gap")U=D.gap;else U=T(D.current,Q,$);M+=typeof G==="string"&&Q==1?Z(U,G):U}),M+=D.after,B.innerHTML="",B.insertAdjacentHTML("afterbegin",M),L=H})(),B.classList.contains("pagy-rjs"))j.observe(F)},A=(B,[D,E])=>Y(B,(z)=>[z,D.replace(/__pagy_page__/,z)],E),C=(B,[D,E,z])=>{Y(B,(G)=>{const F=Math.max(Math.ceil(D/parseInt(G)),1).toString(),K=E.replace(/__pagy_page__/,F).replace(/__pagy_items__/,G);return[F,K]},z)},Y=(B,D,E)=>{const z=B.querySelector("input"),G=B.querySelector("a"),F=z.value,K=function(){if(z.value===F)return;const[L,T,H]=[z.min,z.value,z.max].map((X)=>parseInt(X)||0);if(T<L||T>H){z.value=F,z.select();return}let[M,R]=D(z.value);if(typeof E==="string"&&M==="1")R=Z(R,E);G.href=R,G.click()};["change","focus"].forEach((L)=>z.addEventListener(L,()=>z.select())),z.addEventListener("focusout",K),z.addEventListener("keypress",(L)=>{if(L.key==="Enter")K()})},Z=(B,D)=>B.replace(new RegExp(`[?&]${D}=1\\b(?!&)|\\b${D}=1&`),"");return{version:"8.5.0",init(B){const E=(B instanceof Element?B:document).querySelectorAll("[data-pagy]");for(let z of E)try{const G=Uint8Array.from(atob(z.getAttribute("data-pagy")),(L)=>L.charCodeAt(0)),[F,...K]=JSON.parse((new TextDecoder()).decode(G));if(F==="nav")x(z,K);else if(F==="combo")A(z,K);else if(F==="selector")C(z,K);else console.warn("Skipped Pagy.init() for: %o\nUnknown keyword '%s'",z,F)}catch(G){console.warn("Skipped Pagy.init() for: %o\n%s",z,G)}}}})();
1
+ window.Pagy=(()=>{const j=new ResizeObserver((B)=>B.forEach((D)=>D.target.querySelectorAll(".pagy-rjs").forEach((E)=>E.pagyRender()))),x=(B,[D,E,z,G])=>{const F=B.parentElement??B,K=Object.keys(E).map((H)=>parseInt(H)).sort((H,M)=>M-H);let L=-1;const T=(H,M,R)=>H.replace(/__pagy_page__/g,M).replace(/__pagy_label__/g,R);if((B.pagyRender=function(){const H=K.find((Q)=>Q<F.clientWidth)||0;if(H===L)return;let M=D.before;const R=E[H.toString()],X=z?.[H.toString()]??R.map((Q)=>Q.toString());R.forEach((Q,J)=>{const $=X[J];let U;if(typeof Q==="number")U=T(D.a,Q.toString(),$);else if(Q==="gap")U=D.gap;else U=T(D.current,Q,$);M+=typeof G==="string"&&Q==1?Z(U,G):U}),M+=D.after,B.innerHTML="",B.insertAdjacentHTML("afterbegin",M),L=H})(),B.classList.contains("pagy-rjs"))j.observe(F)},A=(B,[D,E])=>Y(B,(z)=>[z,D.replace(/__pagy_page__/,z)],E),C=(B,[D,E,z])=>{Y(B,(G)=>{const F=Math.max(Math.ceil(D/parseInt(G)),1).toString(),K=E.replace(/__pagy_page__/,F).replace(/__pagy_items__/,G);return[F,K]},z)},Y=(B,D,E)=>{const z=B.querySelector("input"),G=B.querySelector("a"),F=z.value,K=function(){if(z.value===F)return;const[L,T,H]=[z.min,z.value,z.max].map((X)=>parseInt(X)||0);if(T<L||T>H){z.value=F,z.select();return}let[M,R]=D(z.value);if(typeof E==="string"&&M==="1")R=Z(R,E);G.href=R,G.click()};["change","focus"].forEach((L)=>z.addEventListener(L,()=>z.select())),z.addEventListener("focusout",K),z.addEventListener("keypress",(L)=>{if(L.key==="Enter")K()})},Z=(B,D)=>B.replace(new RegExp(`[?&]${D}=1\\b(?!&)|\\b${D}=1&`),"");return{version:"8.6.1",init(B){const E=(B instanceof Element?B:document).querySelectorAll("[data-pagy]");for(let z of E)try{const G=Uint8Array.from(atob(z.getAttribute("data-pagy")),(L)=>L.charCodeAt(0)),[F,...K]=JSON.parse((new TextDecoder()).decode(G));if(F==="nav")x(z,K);else if(F==="combo")A(z,K);else if(F==="selector")C(z,K);else console.warn("Skipped Pagy.init() for: %o\nUnknown keyword '%s'",z,F)}catch(G){console.warn("Skipped Pagy.init() for: %o\n%s",z,G)}}}})();
2
2
 
3
- //# debugId=20862703AA72E11D64756e2164756e21
3
+ //# debugId=EB723B90BB158B5C64756e2164756e21
4
4
  //# sourceMappingURL=pagy.min.js.map
@@ -1,4 +1,4 @@
1
- window.Pagy=(()=>{const j=new ResizeObserver((B)=>B.forEach((D)=>D.target.querySelectorAll(".pagy-rjs").forEach((E)=>E.pagyRender()))),x=(B,[D,E,z,G])=>{const F=B.parentElement??B,K=Object.keys(E).map((H)=>parseInt(H)).sort((H,M)=>M-H);let L=-1;const T=(H,M,R)=>H.replace(/__pagy_page__/g,M).replace(/__pagy_label__/g,R);if((B.pagyRender=function(){const H=K.find((Q)=>Q<F.clientWidth)||0;if(H===L)return;let M=D.before;const R=E[H.toString()],X=z?.[H.toString()]??R.map((Q)=>Q.toString());R.forEach((Q,J)=>{const $=X[J];let U;if(typeof Q==="number")U=T(D.a,Q.toString(),$);else if(Q==="gap")U=D.gap;else U=T(D.current,Q,$);M+=typeof G==="string"&&Q==1?Z(U,G):U}),M+=D.after,B.innerHTML="",B.insertAdjacentHTML("afterbegin",M),L=H})(),B.classList.contains("pagy-rjs"))j.observe(F)},A=(B,[D,E])=>Y(B,(z)=>[z,D.replace(/__pagy_page__/,z)],E),C=(B,[D,E,z])=>{Y(B,(G)=>{const F=Math.max(Math.ceil(D/parseInt(G)),1).toString(),K=E.replace(/__pagy_page__/,F).replace(/__pagy_items__/,G);return[F,K]},z)},Y=(B,D,E)=>{const z=B.querySelector("input"),G=B.querySelector("a"),F=z.value,K=function(){if(z.value===F)return;const[L,T,H]=[z.min,z.value,z.max].map((X)=>parseInt(X)||0);if(T<L||T>H){z.value=F,z.select();return}let[M,R]=D(z.value);if(typeof E==="string"&&M==="1")R=Z(R,E);G.href=R,G.click()};["change","focus"].forEach((L)=>z.addEventListener(L,()=>z.select())),z.addEventListener("focusout",K),z.addEventListener("keypress",(L)=>{if(L.key==="Enter")K()})},Z=(B,D)=>B.replace(new RegExp(`[?&]${D}=1\\b(?!&)|\\b${D}=1&`),"");return{version:"8.5.0",init(B){const E=(B instanceof Element?B:document).querySelectorAll("[data-pagy]");for(let z of E)try{const G=Uint8Array.from(atob(z.getAttribute("data-pagy")),(L)=>L.charCodeAt(0)),[F,...K]=JSON.parse((new TextDecoder()).decode(G));if(F==="nav")x(z,K);else if(F==="combo")A(z,K);else if(F==="selector")C(z,K);else console.warn("Skipped Pagy.init() for: %o\nUnknown keyword '%s'",z,F)}catch(G){console.warn("Skipped Pagy.init() for: %o\n%s",z,G)}}}})();
1
+ window.Pagy=(()=>{const j=new ResizeObserver((B)=>B.forEach((D)=>D.target.querySelectorAll(".pagy-rjs").forEach((E)=>E.pagyRender()))),x=(B,[D,E,z,G])=>{const F=B.parentElement??B,K=Object.keys(E).map((H)=>parseInt(H)).sort((H,M)=>M-H);let L=-1;const T=(H,M,R)=>H.replace(/__pagy_page__/g,M).replace(/__pagy_label__/g,R);if((B.pagyRender=function(){const H=K.find((Q)=>Q<F.clientWidth)||0;if(H===L)return;let M=D.before;const R=E[H.toString()],X=z?.[H.toString()]??R.map((Q)=>Q.toString());R.forEach((Q,J)=>{const $=X[J];let U;if(typeof Q==="number")U=T(D.a,Q.toString(),$);else if(Q==="gap")U=D.gap;else U=T(D.current,Q,$);M+=typeof G==="string"&&Q==1?Z(U,G):U}),M+=D.after,B.innerHTML="",B.insertAdjacentHTML("afterbegin",M),L=H})(),B.classList.contains("pagy-rjs"))j.observe(F)},A=(B,[D,E])=>Y(B,(z)=>[z,D.replace(/__pagy_page__/,z)],E),C=(B,[D,E,z])=>{Y(B,(G)=>{const F=Math.max(Math.ceil(D/parseInt(G)),1).toString(),K=E.replace(/__pagy_page__/,F).replace(/__pagy_items__/,G);return[F,K]},z)},Y=(B,D,E)=>{const z=B.querySelector("input"),G=B.querySelector("a"),F=z.value,K=function(){if(z.value===F)return;const[L,T,H]=[z.min,z.value,z.max].map((X)=>parseInt(X)||0);if(T<L||T>H){z.value=F,z.select();return}let[M,R]=D(z.value);if(typeof E==="string"&&M==="1")R=Z(R,E);G.href=R,G.click()};["change","focus"].forEach((L)=>z.addEventListener(L,()=>z.select())),z.addEventListener("focusout",K),z.addEventListener("keypress",(L)=>{if(L.key==="Enter")K()})},Z=(B,D)=>B.replace(new RegExp(`[?&]${D}=1\\b(?!&)|\\b${D}=1&`),"");return{version:"8.6.1",init(B){const E=(B instanceof Element?B:document).querySelectorAll("[data-pagy]");for(let z of E)try{const G=Uint8Array.from(atob(z.getAttribute("data-pagy")),(L)=>L.charCodeAt(0)),[F,...K]=JSON.parse((new TextDecoder()).decode(G));if(F==="nav")x(z,K);else if(F==="combo")A(z,K);else if(F==="selector")C(z,K);else console.warn("Skipped Pagy.init() for: %o\nUnknown keyword '%s'",z,F)}catch(G){console.warn("Skipped Pagy.init() for: %o\n%s",z,G)}}}})();
2
2
 
3
- //# debugId=20862703AA72E11D64756e2164756e21
3
+ //# debugId=EB723B90BB158B5C64756e2164756e21
4
4
  //# sourceMappingURL=pagy.min.js.map
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/pagy.ts"],
4
4
  "sourcesContent": [
5
- "type NavArgs = readonly [Tokens, Sequels, null | LabelSequels, string?]\ntype ComboArgs = readonly [string, string?]\ntype SelectorArgs = readonly [number, string, string?]\ntype JsonArgs = ['nav', NavArgs] | ['combo', ComboArgs] | ['selector', SelectorArgs]\n\ninterface Tokens {\n readonly before:string\n readonly a:string\n readonly current:string\n readonly gap:string\n readonly after:string\n}\ninterface Sequels {readonly [width:string]:(string | number)[]}\ninterface LabelSequels {readonly [width:string]:string[]}\ninterface NavElement extends Element {pagyRender():void}\n\nconst Pagy = (() => {\n // The observer instance for responsive navs\n const rjsObserver = new ResizeObserver(\n entries => entries.forEach(e => e.target.querySelectorAll<NavElement>(\".pagy-rjs\")\n .forEach(el => el.pagyRender())));\n // Init the *_nav_js helpers\n const initNav = (el:NavElement, [tokens, sequels, labelSequels, trimParam]:NavArgs) => {\n const container = el.parentElement ?? el;\n const widths = Object.keys(sequels).map(w => parseInt(w)).sort((a, b) => b - a);\n let lastWidth = -1;\n const fillIn = (a:string, page:string, label:string):string =>\n a.replace(/__pagy_page__/g, page).replace(/__pagy_label__/g, label);\n (el.pagyRender = function () {\n const width = widths.find(w => w < container.clientWidth) || 0;\n if (width === lastWidth) { return } // no change: abort\n let html = tokens.before; // already trimmed in html\n const series = sequels[width.toString()];\n const labels = labelSequels?.[width.toString()] ?? series.map(l => l.toString());\n series.forEach((item, i) => {\n const label = labels[i];\n let filled;\n if (typeof item === \"number\") {\n filled = fillIn(tokens.a, item.toString(), label);\n } else if (item === \"gap\") {\n filled = tokens.gap;\n } else { // active page\n filled = fillIn(tokens.current, item, label);\n }\n html += (typeof trimParam === \"string\" && item == 1) ? trim(filled, trimParam) : filled;\n });\n html += tokens.after;\n el.innerHTML = \"\";\n el.insertAdjacentHTML(\"afterbegin\", html);\n lastWidth = width;\n })();\n if (el.classList.contains(\"pagy-rjs\")) { rjsObserver.observe(container) }\n };\n\n // Init the *_combo_nav_js helpers\n const initCombo = (el:Element, [url_token, trimParam]:ComboArgs) =>\n initInput(el, inputValue => [inputValue, url_token.replace(/__pagy_page__/, inputValue)], trimParam);\n\n // Init the items_selector_js helper\n const initSelector = (el:Element, [from, url_token, trimParam]:SelectorArgs) => {\n initInput(el, inputValue => {\n const page = Math.max(Math.ceil(from / parseInt(inputValue)), 1).toString();\n const url = url_token.replace(/__pagy_page__/, page).replace(/__pagy_items__/, inputValue);\n return [page, url];\n }, trimParam);\n };\n\n // Init the input element\n const initInput = (el:Element, getVars:(v:string) => [string, string], trimParam?:string) => {\n const input = el.querySelector(\"input\") as HTMLInputElement;\n const link = el.querySelector(\"a\") as HTMLAnchorElement;\n const initial = input.value;\n const action = function () {\n if (input.value === initial) { return } // not changed\n const [min, val, max] = [input.min, input.value, input.max].map(n => parseInt(n) || 0);\n if (val < min || val > max) { // reset invalid/out-of-range\n input.value = initial;\n input.select();\n return;\n }\n let [page, url] = getVars(input.value); // eslint-disable-line prefer-const\n if (typeof trimParam === \"string\" && page === \"1\") { url = trim(url, trimParam) }\n link.href = url;\n link.click();\n };\n [\"change\", \"focus\"].forEach(e => input.addEventListener(e, () => input.select())); // auto-select\n input.addEventListener(\"focusout\", action); // trigger action\n input.addEventListener(\"keypress\", e => { if (e.key === \"Enter\") { action() } }); // trigger action\n };\n\n // Trim the ${page-param}=1 params in links\n const trim = (a:string, param:string) =>\n a.replace(new RegExp(`[?&]${param}=1\\\\b(?!&)|\\\\b${param}=1&`), \"\");\n\n // Public interface\n return {\n version: \"8.5.0\",\n\n // Scan for elements with a \"data-pagy\" attribute and call their init functions with the decoded args\n init(arg?:Element) {\n const target = arg instanceof Element ? arg : document;\n const elements = target.querySelectorAll(\"[data-pagy]\");\n for (const el of elements) {\n try {\n const uint8array = Uint8Array.from(atob(el.getAttribute(\"data-pagy\") as string), c => c.charCodeAt(0));\n const [keyword, ...args] = JSON.parse((new TextDecoder()).decode(uint8array)) as JsonArgs; // base64-utf8 -> JSON -> Array\n if (keyword === \"nav\") {\n initNav(el as NavElement, args as unknown as NavArgs);\n } else if (keyword === \"combo\") {\n initCombo(el, args as unknown as ComboArgs);\n } else if (keyword === \"selector\") {\n initSelector(el, args as unknown as SelectorArgs);\n } else {\n console.warn(\"Skipped Pagy.init() for: %o\\nUnknown keyword '%s'\", el, keyword);\n }\n } catch (err) { console.warn(\"Skipped Pagy.init() for: %o\\n%s\", el, err) }\n }\n }\n };\n})();\n\nexport default Pagy;\n"
5
+ "type NavArgs = readonly [Tokens, Sequels, null | LabelSequels, string?]\ntype ComboArgs = readonly [string, string?]\ntype SelectorArgs = readonly [number, string, string?]\ntype JsonArgs = ['nav', NavArgs] | ['combo', ComboArgs] | ['selector', SelectorArgs]\n\ninterface Tokens {\n readonly before:string\n readonly a:string\n readonly current:string\n readonly gap:string\n readonly after:string\n}\ninterface Sequels {readonly [width:string]:(string | number)[]}\ninterface LabelSequels {readonly [width:string]:string[]}\ninterface NavElement extends Element {pagyRender():void}\n\nconst Pagy = (() => {\n // The observer instance for responsive navs\n const rjsObserver = new ResizeObserver(\n entries => entries.forEach(e => e.target.querySelectorAll<NavElement>(\".pagy-rjs\")\n .forEach(el => el.pagyRender())));\n // Init the *_nav_js helpers\n const initNav = (el:NavElement, [tokens, sequels, labelSequels, trimParam]:NavArgs) => {\n const container = el.parentElement ?? el;\n const widths = Object.keys(sequels).map(w => parseInt(w)).sort((a, b) => b - a);\n let lastWidth = -1;\n const fillIn = (a:string, page:string, label:string):string =>\n a.replace(/__pagy_page__/g, page).replace(/__pagy_label__/g, label);\n (el.pagyRender = function () {\n const width = widths.find(w => w < container.clientWidth) || 0;\n if (width === lastWidth) { return } // no change: abort\n let html = tokens.before; // already trimmed in html\n const series = sequels[width.toString()];\n const labels = labelSequels?.[width.toString()] ?? series.map(l => l.toString());\n series.forEach((item, i) => {\n const label = labels[i];\n let filled;\n if (typeof item === \"number\") {\n filled = fillIn(tokens.a, item.toString(), label);\n } else if (item === \"gap\") {\n filled = tokens.gap;\n } else { // active page\n filled = fillIn(tokens.current, item, label);\n }\n html += (typeof trimParam === \"string\" && item == 1) ? trim(filled, trimParam) : filled;\n });\n html += tokens.after;\n el.innerHTML = \"\";\n el.insertAdjacentHTML(\"afterbegin\", html);\n lastWidth = width;\n })();\n if (el.classList.contains(\"pagy-rjs\")) { rjsObserver.observe(container) }\n };\n\n // Init the *_combo_nav_js helpers\n const initCombo = (el:Element, [url_token, trimParam]:ComboArgs) =>\n initInput(el, inputValue => [inputValue, url_token.replace(/__pagy_page__/, inputValue)], trimParam);\n\n // Init the items_selector_js helper\n const initSelector = (el:Element, [from, url_token, trimParam]:SelectorArgs) => {\n initInput(el, inputValue => {\n const page = Math.max(Math.ceil(from / parseInt(inputValue)), 1).toString();\n const url = url_token.replace(/__pagy_page__/, page).replace(/__pagy_items__/, inputValue);\n return [page, url];\n }, trimParam);\n };\n\n // Init the input element\n const initInput = (el:Element, getVars:(v:string) => [string, string], trimParam?:string) => {\n const input = el.querySelector(\"input\") as HTMLInputElement;\n const link = el.querySelector(\"a\") as HTMLAnchorElement;\n const initial = input.value;\n const action = function () {\n if (input.value === initial) { return } // not changed\n const [min, val, max] = [input.min, input.value, input.max].map(n => parseInt(n) || 0);\n if (val < min || val > max) { // reset invalid/out-of-range\n input.value = initial;\n input.select();\n return;\n }\n let [page, url] = getVars(input.value); // eslint-disable-line prefer-const\n if (typeof trimParam === \"string\" && page === \"1\") { url = trim(url, trimParam) }\n link.href = url;\n link.click();\n };\n [\"change\", \"focus\"].forEach(e => input.addEventListener(e, () => input.select())); // auto-select\n input.addEventListener(\"focusout\", action); // trigger action\n input.addEventListener(\"keypress\", e => { if (e.key === \"Enter\") { action() } }); // trigger action\n };\n\n // Trim the ${page-param}=1 params in links\n const trim = (a:string, param:string) =>\n a.replace(new RegExp(`[?&]${param}=1\\\\b(?!&)|\\\\b${param}=1&`), \"\");\n\n // Public interface\n return {\n version: \"8.6.1\",\n\n // Scan for elements with a \"data-pagy\" attribute and call their init functions with the decoded args\n init(arg?:Element) {\n const target = arg instanceof Element ? arg : document;\n const elements = target.querySelectorAll(\"[data-pagy]\");\n for (const el of elements) {\n try {\n const uint8array = Uint8Array.from(atob(el.getAttribute(\"data-pagy\") as string), c => c.charCodeAt(0));\n const [keyword, ...args] = JSON.parse((new TextDecoder()).decode(uint8array)) as JsonArgs; // base64-utf8 -> JSON -> Array\n if (keyword === \"nav\") {\n initNav(el as NavElement, args as unknown as NavArgs);\n } else if (keyword === \"combo\") {\n initCombo(el, args as unknown as ComboArgs);\n } else if (keyword === \"selector\") {\n initSelector(el, args as unknown as SelectorArgs);\n } else {\n console.warn(\"Skipped Pagy.init() for: %o\\nUnknown keyword '%s'\", el, keyword);\n }\n } catch (err) { console.warn(\"Skipped Pagy.init() for: %o\\n%s\", el, err) }\n }\n }\n };\n})();\n\nexport default Pagy;\n"
6
6
  ],
7
7
  "mappings": "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",
8
- "debugId": "20862703AA72E11D64756e2164756e21",
8
+ "debugId": "EB723B90BB158B5C64756e2164756e21",
9
9
  "names": []
10
10
  }
data/javascripts/pagy.mjs CHANGED
@@ -73,7 +73,7 @@ const Pagy = (() => {
73
73
  };
74
74
  const trim = (a, param) => a.replace(new RegExp(`[?&]${param}=1\\b(?!&)|\\b${param}=1&`), "");
75
75
  return {
76
- version: "8.5.0",
76
+ version: "8.6.1",
77
77
  init(arg) {
78
78
  const target = arg instanceof Element ? arg : document;
79
79
  const elements = target.querySelectorAll("[data-pagy]");
@@ -6,6 +6,7 @@ class Pagy # :nodoc:
6
6
  # Day unit subclass
7
7
  class Day < Unit
8
8
  DEFAULT = { size: 31, # rubocop:disable Style/MutableConstant
9
+ ends: false,
9
10
  order: :asc,
10
11
  format: '%d' }
11
12
 
@@ -6,6 +6,7 @@ class Pagy # :nodoc:
6
6
  # Month unit subclass
7
7
  class Month < Unit
8
8
  DEFAULT = { size: 12, # rubocop:disable Style/MutableConstant
9
+ ends: false,
9
10
  order: :asc,
10
11
  format: '%b' }
11
12
 
@@ -6,6 +6,7 @@ class Pagy # :nodoc:
6
6
  # Quarter unit subclass
7
7
  class Quarter < Unit
8
8
  DEFAULT = { size: 4, # rubocop:disable Style/MutableConstant
9
+ ends: false,
9
10
  order: :asc,
10
11
  format: 'Q%q' } # '%q' token
11
12
 
@@ -6,6 +6,7 @@ class Pagy # :nodoc:
6
6
  # Year unit subclass
7
7
  class Year < Unit
8
8
  DEFAULT = { size: 10, # rubocop:disable Style/MutableConstant
9
+ ends: false,
9
10
  order: :asc,
10
11
  format: '%Y' }
11
12
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  require_relative '../pagy'
5
5
 
6
- class Pagy
6
+ class Pagy # :nodoc:
7
7
  # No need to know the count to paginate
8
8
  class Countless < Pagy
9
9
  # Merge and validate the options, do some simple arithmetic and set a few instance variables
@@ -29,11 +29,14 @@ class Pagy
29
29
  @next = @page == @last ? (1 if @vars[:cycle]) : @page + 1
30
30
  self
31
31
  end
32
+ end
32
33
 
34
+ module SeriesOverride # :nodoc:
33
35
  # Override the original series.
34
36
  # Return nil if :countless_minimal is enabled
35
37
  def series(*, **)
36
38
  super unless @vars[:countless_minimal]
37
39
  end
38
40
  end
41
+ prepend SeriesOverride
39
42
  end
@@ -0,0 +1,40 @@
1
+ # See the Pagy documentation: https://ddnexus.github.io/pagy/docs/extras/size
2
+ # frozen_string_literal: true
3
+
4
+ class Pagy # :nodoc:
5
+ # Implement the legacy bar using the array size.
6
+ # Unless you have very specific requirements, use the faster and better looking default bar.
7
+ module SizeExtra
8
+ # Setup @items based on the :gearbox_items variable
9
+ def series(size: @vars[:size], **_)
10
+ return super unless size.is_a?(Array)
11
+ return [] if size == []
12
+ raise VariableError.new(self, :size, 'to be an Array of 4 Integers or []', size) \
13
+ unless size.is_a?(Array) && size.size == 4 && size.all? { |num| !num.negative? rescue false } # rubocop:disable Style/RescueModifier
14
+
15
+ [].tap do |series|
16
+ # This algorithm is up to ~5x faster and ~2.3x lighter than the previous one (pagy < 4.3)
17
+ # However the behavior of the legacy nav bar was taken straight from WillPaginate and Kaminari:
18
+ # it's ill-concieved and complicates the experience of devs and users.
19
+ left_gap_start = 1 + size[0]
20
+ left_gap_end = @page - size[1] - 1
21
+ right_gap_start = @page + size[2] + 1
22
+ right_gap_end = @last - size[3]
23
+ left_gap_end = right_gap_end if left_gap_end > right_gap_end
24
+ right_gap_start = left_gap_start if left_gap_start > right_gap_start
25
+ start = 1
26
+ if (left_gap_end - left_gap_start).positive?
27
+ series.push(*start...left_gap_start, :gap)
28
+ start = left_gap_end + 1
29
+ end
30
+ if (right_gap_end - right_gap_start).positive?
31
+ series.push(*start...right_gap_start, :gap)
32
+ start = right_gap_end + 1
33
+ end
34
+ series.push(*start..@last)
35
+ series[series.index(@page)] = @page.to_s
36
+ end
37
+ end
38
+ end
39
+ prepend SizeExtra
40
+ end
data/lib/pagy.rb CHANGED
@@ -5,7 +5,7 @@ require 'pathname'
5
5
 
6
6
  # Core class
7
7
  class Pagy
8
- VERSION = '8.5.0'
8
+ VERSION = '8.6.1'
9
9
 
10
10
  # Gem root pathname to get the path of Pagy files stylesheets, javascripts, apps, locales, etc.
11
11
  def self.root
@@ -17,6 +17,7 @@ class Pagy
17
17
  items: 20,
18
18
  outset: 0,
19
19
  size: 7,
20
+ ends: true,
20
21
  count_args: [:all], # AR friendly
21
22
  page_param: :page }
22
23
 
@@ -39,46 +40,35 @@ class Pagy
39
40
  @next = @page == @last ? (1 if @vars[:cycle]) : @page + 1
40
41
  end
41
42
 
42
- # Return the array of page numbers and :gap items e.g. [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
43
+ # Return the array of page numbers and :gap items e.g. [1, :gap, 8, "9", 10, :gap, 36]
43
44
  def series(size: @vars[:size], **_)
44
- series = []
45
- if size.is_a?(Array) && size.size == 4 && size.all? { |num| !num.negative? rescue false } # rubocop:disable Style/RescueModifier
46
- # This algorithm is up to ~5x faster and ~2.3x lighter than the previous one (pagy < 4.3)
47
- left_gap_start = 1 + size[0]
48
- left_gap_end = @page - size[1] - 1
49
- right_gap_start = @page + size[2] + 1
50
- right_gap_end = @last - size[3]
51
- left_gap_end = right_gap_end if left_gap_end > right_gap_end
52
- right_gap_start = left_gap_start if left_gap_start > right_gap_start
53
- start = 1
54
- if (left_gap_end - left_gap_start).positive?
55
- series.push(*start...left_gap_start, :gap)
56
- start = left_gap_end + 1
45
+ raise VariableError.new(self, :size, 'to be an Integer >= 0', size) \
46
+ unless size.is_a?(Integer)
47
+ return [] if size.zero?
48
+
49
+ [].tap do |series|
50
+ if size >= @last
51
+ series.push(*1..@last)
52
+ else
53
+ left = ((size - 1) / 2.0).floor # left half might be 1 page shorter for even size
54
+ start = if @page <= left # beginning pages
55
+ 1
56
+ elsif @page > @last - (size - left) # end pages
57
+ @last - size + 1
58
+ else # intermediate pages
59
+ @page - left
60
+ end
61
+ series.push(*start...start + size)
62
+ # Insert first and last ends plus gaps when needed
63
+ if vars[:ends] && size >= 7
64
+ series[0] = 1 unless series[0] == 1
65
+ series[1] = :gap unless series[1] == 2
66
+ series[-2] = :gap unless series[-2] == @last - 1
67
+ series[-1] = @last unless series[-1] == @last
68
+ end
57
69
  end
58
- if (right_gap_end - right_gap_start).positive?
59
- series.push(*start...right_gap_start, :gap)
60
- start = right_gap_end + 1
61
- end
62
- series.push(*start..@last)
63
- elsif size.is_a?(Integer) && size.positive? # only central series
64
- # The simplest and fastest algorithm
65
- size = @last if size > @last # reduce the max size to @last
66
- left = ((size - 1) / 2.0).floor # left half might be 1 page shorter for even size
67
- start = if @page <= left # beginning pages
68
- 1
69
- elsif @page > @last - (size - left) # end pages
70
- @last - size + 1
71
- else # intermediate pages
72
- @page - left
73
- end
74
- series = (start..start + size - 1).to_a
75
- else
76
- return [] if size.empty?
77
-
78
- raise VariableError.new(self, :size, 'to be a single positive Integer or an Array of 4', size)
70
+ series[series.index(@page)] = @page.to_s
79
71
  end
80
- series[series.index(@page)] = @page.to_s
81
- series
82
72
  end
83
73
 
84
74
  # Label for any page. Allow the customization of the output (overridden by the calendar extra)
@@ -124,6 +114,7 @@ class Pagy
124
114
  end
125
115
  end
126
116
 
117
+ require_relative 'pagy/extras/size' # will be opt in in v9.0
127
118
  require_relative 'pagy/backend'
128
119
  require_relative 'pagy/frontend'
129
120
  require_relative 'pagy/exceptions'
data/locales/ar.yml CHANGED
@@ -2,14 +2,12 @@
2
2
  ar:
3
3
  pagy:
4
4
  aria_label:
5
- # please add a comment in the https://github.com/ddnexus/pagy/issues/577
6
- # posting the translation of the following "Page"/"Pages" with the plurals for this locale
7
- nav: "Pages"
8
- # zero: ""
9
- # two: ""
10
- # few: ""
11
- # many: ""
12
- # other: ""
5
+ nav:
6
+ zero: "لا يوجد صفحات"
7
+ one: "صفحة"
8
+ two: "صفحتين"
9
+ few: "صفحات"
10
+ many: "صفحات"
13
11
  prev: "السابق"
14
12
  next: "التالي"
15
13
  prev: "&lt;"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagy
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.5.0
4
+ version: 8.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domizio Demichelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-25 00:00:00.000000000 Z
11
+ date: 2024-06-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Agnostic pagination in plain ruby. It does it all. Better.
14
14
  email:
@@ -70,6 +70,7 @@ files:
70
70
  - lib/pagy/extras/pagy.rb
71
71
  - lib/pagy/extras/searchkick.rb
72
72
  - lib/pagy/extras/semantic.rb
73
+ - lib/pagy/extras/size.rb
73
74
  - lib/pagy/extras/standalone.rb
74
75
  - lib/pagy/extras/trim.rb
75
76
  - lib/pagy/extras/uikit.rb