pagy 8.4.0 → 8.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/apps/calendar.ru +1 -1
- data/apps/demo.ru +1 -1
- data/apps/rails.ru +1 -1
- data/apps/repro.ru +1 -1
- data/bin/pagy +8 -5
- data/config/pagy.rb +3 -3
- data/javascripts/pagy-dev.js +99 -109
- data/javascripts/pagy-module.js +95 -107
- data/javascripts/pagy.js +1 -1
- data/lib/pagy/backend.rb +1 -1
- data/lib/pagy/extras/pagy.rb +1 -1
- data/lib/pagy/extras/trim.rb +1 -1
- data/lib/pagy/frontend.rb +1 -1
- data/lib/pagy.rb +1 -1
- data/pkg/pagy-8.4.2.gem +0 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d283e0b1a2f28d6e05156089b3284b22c3e488626d5501093fdee506260a9825
|
4
|
+
data.tar.gz: c426766d510f8f229da57fedf0866b9ce9c2b213467a6548fbc760568b3ba973
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7009de54deb7819bee599dc5a621f15e12c5de9a1e56c68a4136fb486d5214201f0ad626ec3bf979f3ba0eaadf267f902cc90da67214768a591b53b597ab931
|
7
|
+
data.tar.gz: fbfc64b79436c808b218166d0efd5448f0ec8d66446091dc6d5a9e70872ae37868dabb92d67224224d2fa41e7c0f87ad294c6bfd67c34c97c492e947a480a562
|
data/apps/calendar.ru
CHANGED
data/apps/demo.ru
CHANGED
data/apps/rails.ru
CHANGED
data/apps/repro.ru
CHANGED
data/bin/pagy
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
VERSION = '8.4.
|
4
|
+
VERSION = '8.4.2'
|
5
5
|
APPS = %w[repro rails demo calendar].freeze
|
6
|
+
LINUX = RbConfig::CONFIG['host_os'].include?('linux')
|
6
7
|
|
7
8
|
require_relative '../lib/optimist'
|
8
9
|
opts = Optimist.options do
|
@@ -28,9 +29,11 @@ opts = Optimist.options do
|
|
28
29
|
opt :host, 'Host', default: '0.0.0.0', short: :o
|
29
30
|
opt :port, 'Port', default: 8000
|
30
31
|
opt :install, 'Install bundle for users', default: true
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
if LINUX
|
33
|
+
text 'Rerun options'
|
34
|
+
opt :rerun, 'Enable rerun for development', default: true
|
35
|
+
opt :clear, 'Clear screen before each rerun'
|
36
|
+
end
|
34
37
|
text 'Other options'
|
35
38
|
opt :quiet, 'Quiet mode for development'
|
36
39
|
version VERSION
|
@@ -48,7 +51,7 @@ Bundler.configure
|
|
48
51
|
gemfile(opts[:install]) do
|
49
52
|
source 'https://rubygems.org'
|
50
53
|
gem 'rackup'
|
51
|
-
gem 'rerun'
|
54
|
+
gem 'rerun' if LINUX
|
52
55
|
end
|
53
56
|
|
54
57
|
path = ->(app) { File.expand_path("../apps/#{app}.ru", __dir__) }
|
data/config/pagy.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Pagy initializer file (8.4.
|
3
|
+
# Pagy initializer file (8.4.2)
|
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
|
|
@@ -90,8 +90,8 @@
|
|
90
90
|
|
91
91
|
# Metadata extra: Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc.
|
92
92
|
# See https://ddnexus.github.io/pagy/docs/extras/metadata
|
93
|
-
# you must require the
|
94
|
-
# require 'pagy/extras/
|
93
|
+
# you must require the JS Tools internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels
|
94
|
+
# require 'pagy/extras/js_tools'
|
95
95
|
# require 'pagy/extras/metadata'
|
96
96
|
# For performance reasons, you should explicitly set ONLY the metadata you use in the frontend
|
97
97
|
# Pagy::DEFAULT[:metadata] = %i[scaffold_url page prev next last] # example
|
data/javascripts/pagy-dev.js
CHANGED
@@ -1,114 +1,104 @@
|
|
1
|
-
|
1
|
+
// pagy.ts
|
2
2
|
window.Pagy = (() => {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
const
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
filled = tokens.gap;
|
28
|
-
}
|
29
|
-
else { // active page
|
30
|
-
filled = fillIn(tokens.current, item, label);
|
31
|
-
}
|
32
|
-
html += (typeof trimParam === "string" && item == 1) ? trim(filled, trimParam) : filled;
|
33
|
-
}
|
34
|
-
html += tokens.after; // eslint-disable-line align-assignments/align-assignments
|
35
|
-
el.innerHTML = "";
|
36
|
-
el.insertAdjacentHTML("afterbegin", html);
|
37
|
-
lastWidth = width;
|
38
|
-
})();
|
39
|
-
if (el.classList.contains("pagy-rjs")) {
|
40
|
-
rjsObserver.observe(container);
|
3
|
+
const rjsObserver = new ResizeObserver((entries) => entries.forEach((e) => e.target.querySelectorAll(".pagy-rjs").forEach((el) => el.pagyRender())));
|
4
|
+
const initNav = (el, [tokens, sequels, labelSequels, trimParam]) => {
|
5
|
+
const container = el.parentElement ?? el;
|
6
|
+
const widths = Object.keys(sequels).map((w) => parseInt(w)).sort((a, b) => b - a);
|
7
|
+
let lastWidth = -1;
|
8
|
+
const fillIn = (a, page, label) => a.replace(/__pagy_page__/g, page).replace(/__pagy_label__/g, label);
|
9
|
+
(el.pagyRender = function() {
|
10
|
+
const width = widths.find((w) => w < container.clientWidth) || 0;
|
11
|
+
if (width === lastWidth) {
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
let html = tokens.before;
|
15
|
+
const series = sequels[width.toString()];
|
16
|
+
const labels = labelSequels?.[width.toString()] ?? series.map((l) => l.toString());
|
17
|
+
for (const i in series) {
|
18
|
+
const item = series[i];
|
19
|
+
const label = labels[i];
|
20
|
+
let filled;
|
21
|
+
if (typeof item === "number") {
|
22
|
+
filled = fillIn(tokens.a, item.toString(), label);
|
23
|
+
} else if (item === "gap") {
|
24
|
+
filled = tokens.gap;
|
25
|
+
} else {
|
26
|
+
filled = fillIn(tokens.current, item, label);
|
41
27
|
}
|
28
|
+
html += typeof trimParam === "string" && item == 1 ? trim(filled, trimParam) : filled;
|
29
|
+
}
|
30
|
+
html += tokens.after;
|
31
|
+
el.innerHTML = "";
|
32
|
+
el.insertAdjacentHTML("afterbegin", html);
|
33
|
+
lastWidth = width;
|
34
|
+
})();
|
35
|
+
if (el.classList.contains("pagy-rjs")) {
|
36
|
+
rjsObserver.observe(container);
|
37
|
+
}
|
38
|
+
};
|
39
|
+
const initCombo = (el, [url_token, trimParam]) => initInput(el, (inputValue) => [inputValue, url_token.replace(/__pagy_page__/, inputValue)], trimParam);
|
40
|
+
const initSelector = (el, [from, url_token, trimParam]) => {
|
41
|
+
initInput(el, (inputValue) => {
|
42
|
+
const page = Math.max(Math.ceil(from / parseInt(inputValue)), 1).toString();
|
43
|
+
const url = url_token.replace(/__pagy_page__/, page).replace(/__pagy_items__/, inputValue);
|
44
|
+
return [page, url];
|
45
|
+
}, trimParam);
|
46
|
+
};
|
47
|
+
const initInput = (el, getVars, trimParam) => {
|
48
|
+
const input = el.querySelector("input");
|
49
|
+
const link = el.querySelector("a");
|
50
|
+
const initial = input.value;
|
51
|
+
const action = function() {
|
52
|
+
if (input.value === initial) {
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
const [min, val, max] = [input.min, input.value, input.max].map((n) => parseInt(n) || 0);
|
56
|
+
if (val < min || val > max) {
|
57
|
+
input.value = initial;
|
58
|
+
input.select();
|
59
|
+
return;
|
60
|
+
}
|
61
|
+
let [page, url] = getVars(input.value);
|
62
|
+
if (typeof trimParam === "string" && page === "1") {
|
63
|
+
url = trim(url, trimParam);
|
64
|
+
}
|
65
|
+
link.href = url;
|
66
|
+
link.click();
|
42
67
|
};
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
link.href = url;
|
73
|
-
link.click();
|
74
|
-
};
|
75
|
-
["change", "focus"].forEach(e => input.addEventListener(e, input.select)); // auto-select
|
76
|
-
input.addEventListener("focusout", action); // trigger action
|
77
|
-
input.addEventListener("keypress", e => { if (e.key === "Enter") {
|
78
|
-
action();
|
79
|
-
} }); // trigger action
|
80
|
-
};
|
81
|
-
// Trim the ${page-param}=1 params in links
|
82
|
-
const trim = (a, param) => a.replace(new RegExp(`[?&]${param}=1\\b(?!&)|\\b${param}=1&`), "");
|
83
|
-
// Public interface
|
84
|
-
return {
|
85
|
-
version: "8.4.0",
|
86
|
-
// Scan for elements with a "data-pagy" attribute and call their init functions with the decoded args
|
87
|
-
init(arg) {
|
88
|
-
const target = arg instanceof Element ? arg : document;
|
89
|
-
const elements = target.querySelectorAll("[data-pagy]");
|
90
|
-
for (const el of elements) {
|
91
|
-
try {
|
92
|
-
const uint8array = Uint8Array.from(atob(el.getAttribute("data-pagy")), c => c.charCodeAt(0));
|
93
|
-
const [keyword, ...args] = JSON.parse((new TextDecoder()).decode(uint8array)); // base64-utf8 -> JSON -> Array
|
94
|
-
if (keyword === "nav") {
|
95
|
-
initNav(el, args);
|
96
|
-
}
|
97
|
-
else if (keyword === "combo") {
|
98
|
-
initCombo(el, args);
|
99
|
-
}
|
100
|
-
else if (keyword === "selector") {
|
101
|
-
initSelector(el, args);
|
102
|
-
}
|
103
|
-
else {
|
104
|
-
console.warn("Skipped Pagy.init() for: %o\nUnknown keyword '%s'", el, keyword);
|
105
|
-
}
|
106
|
-
}
|
107
|
-
catch (err) {
|
108
|
-
console.warn("Skipped Pagy.init() for: %o\n%s", el, err);
|
109
|
-
}
|
110
|
-
}
|
68
|
+
["change", "focus"].forEach((e) => input.addEventListener(e, input.select));
|
69
|
+
input.addEventListener("focusout", action);
|
70
|
+
input.addEventListener("keypress", (e) => {
|
71
|
+
if (e.key === "Enter") {
|
72
|
+
action();
|
73
|
+
}
|
74
|
+
});
|
75
|
+
};
|
76
|
+
const trim = (a, param) => a.replace(new RegExp(`[?&]${param}=1\\b(?!&)|\\b${param}=1&`), "");
|
77
|
+
return {
|
78
|
+
version: "8.4.2",
|
79
|
+
init(arg) {
|
80
|
+
const target = arg instanceof Element ? arg : document;
|
81
|
+
const elements = target.querySelectorAll("[data-pagy]");
|
82
|
+
for (const el of elements) {
|
83
|
+
try {
|
84
|
+
const uint8array = Uint8Array.from(atob(el.getAttribute("data-pagy")), (c) => c.charCodeAt(0));
|
85
|
+
const [keyword, ...args] = JSON.parse(new TextDecoder().decode(uint8array));
|
86
|
+
if (keyword === "nav") {
|
87
|
+
initNav(el, args);
|
88
|
+
} else if (keyword === "combo") {
|
89
|
+
initCombo(el, args);
|
90
|
+
} else if (keyword === "selector") {
|
91
|
+
initSelector(el, args);
|
92
|
+
} else {
|
93
|
+
console.warn("Skipped Pagy.init() for: %o\nUnknown keyword '%s'", el, keyword);
|
94
|
+
}
|
95
|
+
} catch (err) {
|
96
|
+
console.warn("Skipped Pagy.init() for: %o\n%s", el, err);
|
111
97
|
}
|
112
|
-
|
98
|
+
}
|
99
|
+
}
|
100
|
+
};
|
113
101
|
})();
|
114
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFneS5qcyIsInNvdXJjZVJvb3QiOiIi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yA9IHNlcXVlbHNbd2lkdGgudG9TdHJpbmcoKV07XG4gICAgICAgICAgICBjb25zdCBsYWJlbHMgPSBsYWJlbFNlcXVlbHM/Llt3aWR0aC50b1N0cmluZygpXSA/PyBzZXJpZXMubWFwKGwgPT4gbC50b1N0cmluZygpKTtcbiAgICAgICAgICAgIGZvciAoY29uc3QgaSBpbiBzZXJpZXMpIHtcbiAgICAgICAgICAgICAgICBjb25zdCBpdGVtID0gc2VyaWVzW2ldO1xuICAgICAgICAgICAgICAgIGNvbnN0IGxhYmVsID0gbGFiZWxzW2ldO1xuICAgICAgICAgICAgICAgIGxldCBmaWxsZWQ7XG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBpdGVtID09PSBcIm51bWJlclwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGZpbGxlZCA9IGZpbGxJbih0b2tlbnMuYSwgaXRlbS50b1N0cmluZygpLCBsYWJlbCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpdGVtID09PSBcImdhcFwiKSB7XG4gICAgICAgICAgICAgICAgICAgIGZpbGxlZCA9IHRva2Vucy5nYXA7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHsgLy8gYWN0aXZlIHBhZ2VcbiAgICAgICAgICAgICAgICAgICAgZmlsbGVkID0gZmlsbEluKHRva2Vucy5jdXJyZW50LCBpdGVtLCBsYWJlbCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGh0bWwgKz0gKHR5cGVvZiB0cmltUGFyYW0gPT09IFwic3RyaW5nXCIgJiYgaXRlbSA9PSAxKSA/IHRyaW0oZmlsbGVkLCB0cmltUGFyYW0pIDogZmlsbGVkO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaHRtbCArPSB0b2tlbnMuYWZ0ZXI7ICAgLy8gZXNsaW50LWRpc2FibGUtbGluZSBhbGlnbi1hc3NpZ25tZW50cy9hbGlnbi1hc3NpZ25tZW50c1xuICAgICAgICAgICAgZWwuaW5uZX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sbCB0aGVpciBpbml0IGZ1bmN0aW9ucyB3aXRoIHRoZSBkZWNvZGVkIGFyZ3NcbiAgICAgICAgaW5pdChhcmc/OkVsZW1lbnQgfCBuZXZlcikge1xuICAgICAgICAgICAgY29uc3QgdGFyZ2V0ID0gYXJnIGluc3RhbmNlb2YgRWxlbWVudCA/IGFyZyA6IGRvY3VtZW50O1xuICAgICAgICAgICAgY29uc3QgZWxlbWVudHMgPSB0YXJnZXQucXVlcnlTZWxlY3RvckFsbChcIltkYXRhLXBhZ3ldXCIpO1xuICAgICAgICAgICAgZm9yIChjb25zdCBlbCBvZiBlbGVtZW50cykge1xuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQ4YXJyYXkgPSBVaW50OEFycmF5LmZyb20oYXRvYihlbC5nZXRBdHRyaWJ1dGUoXCJkYXRhLXBhZ3lcIikgYXMgc3RyaW5nKSwgYyA9PiBjLmNoYXJDb2RlQXQoMCkpO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBba2V5d29yZCwgLi4uYXJnc10gPSBKU09OLnBhcnNlKChuZXcgVGV4dERlY29kZXIoKSkuZGVjb2RlKHVpbnQ4YXJyYXkpKTsgLy8gYmFzZTY0LXV0ZjggLT4gSlNPTiAtPiBBcnJheVxuICAgICAgICAgICAgICAgICAgICBpZiAoa2V5d29yZCA9PT0gXCJuYXZcIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5pdE5hdihlbCBhcyBOYXZFbGVtZW50LCBhcmdzIGFzIE5hdkFyZ3MpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGtleXdvcmQgPT09IFwiY29tYm9cIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5pdENvbWJvKGVsLCBhcmdzIGFzIENvbWJvQXJncyk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoa2V5d29yZCA9PT0gXCJzZWxlY3RvclwiKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbml0U2VsZWN0b3IoZWwsIGFyZ3MgYXMgU2VsZWN0b3JBcmdzKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihcIlNraXBwZWQgUGFneS5pbml0KCkgZm9yOiAlb1xcblVua25vd24ga2V5d29yZCAnJXMnXCIsIGVsLCBrZXl3b3JkKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGVycikgeyBjb25zb2xlLndhcm4oXCJTa2lwcGVkIFBhZ3kuaW5pdCgpIGZvcjogJW9cXG4lc1wiLCBlbCwgZXJyKSB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9O1xufSkoKTtcbiJdfQ==
|
102
|
+
|
103
|
+
//# debugId=22425B3DDA38810464756e2164756e21
|
104
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsicGFneS50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsKICAgICJ0eXBlIE5hdkFyZ3MgPSByZWFkb25seSBbVG9rZW5zLCBTZXF1ZWxzLCBudWxsIHwgTGFiZWxTZXF1ZWxzLCBzdHJpbmc/XVxudHlwZSBDb21ib0FyZ3MgPSByZWFkb25seSBbc3RyaW5nLCBzdHJpbmc/XVxudHlwZSBTZWxlY3RvckFyZ3MgPSByZWFkb25seSBbbnVtYmVyLCBzdHJpbmcsIHN0cmluZz9dXG5cbmludGVyZmFjZSBUb2tlbnMge1xuICAgIHJlYWRvbmx5IGJlZm9yZTpzdHJpbmdcbiAgICByZWFkb25seSBhOnN0cmluZ1xuICAgIHJlYWRvbmx5IGN1cnJlbnQ6c3RyaW5nXG4gICAgcmVhZG9ubHkgZ2FwOnN0cmluZ1xuICAgIHJlYWRvbmx5IGFmdGVyOnN0cmluZ1xufVxuXG5pbnRlcmZhY2UgU2VxdWVscyB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KGlucHV0LnZhbHVlID09PSBpbml0aWFsKSB7IHJldHVybiB9ICAvLyBub3QgY2hhbmdlZFxuICAgICAgICAgICAgY29uc3QgW21pbiwgdmFsLCBtYXhdID0gW2lucHV0Lm1pbiwgaW5wdXQudmFsdWUsIGlucHV0Lm1heF0ubWFwKG4gPT4gcGFyc2VJbnQobikgfHwgMCk7XG4gICAgICAgICAgICBpZiAodmFsIDwgbWluIHx8IHZhbCA+IG1heCkgeyAgLy8gcmVzZXQgaW52YWxpZC9vdXQtb2YtcmFuZ2VcbiAgICAgICAgICAgICAgICBpbnB1dC52YWx1ZSA9IGluaXRpYWw7XG4gICAgICAgICAgICAgICAgaW5wdXQuc2VsZWN0KCk7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbGV0IFtwYWdlLCB1cmxdID0gZ2V0VmFycyhpbnB1dC52YWx1ZSk7ICAgLy8gZXNsaW50LWRpc2FibGUtbGluZSBwcmVmZXItY29uc3RcbiAgICAgICAgICAgIGlmICh0eXBlb2YgdHJpbVBhcmFtID09PSBcInN0cmluZ1wiICYmIHBhZ2UgPT09IFwiMVwiKSB7IHVybCA9IHRyaW0odXJsLCB0cmltUGFyYW0pIH1cbiAgICAgICAgICAgIGxpbmsuaHJlZiA9IHVybDtcbiAgICAgICAgICAgIGxpbmsuY2xpY2soKTtcbiAgICAgICAgfTtcbiAgICAgICAgW1wiY2hhbmdlXCIsIFwiZm9jdXNcIl0uZm9yRWFjaChlID0+IGlucHV0LmFkZEV2ZW50TGlzdGVuZXIoZSwgaW5wdXQuc2VsZWN0KSk7ICAgICAgICAvLyBhdXRvLXNlbGVjdFxuICAgICAgICBpbnB1dC5hZGRFdmVudExpc3RlbmVyKFwiZm9jdXNvdXRcIiwgYWN0aW9uKTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB0cmlnZ2VyIGFjdGlvblxuICAgICAgICBpbnB1dC5hZGRFdmVudExpc3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XJDb2RlQXQoMCkpO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBba2V5d29yZCwgLi4uYXJnc10gPSBKU09OLnBhcnNlKChuZXcgVGV4dERlY29kZXIoKSkuZGVjb2RlKHVpbnQ4YXJyYXkpKTsgLy8gYmFzZTY0LXV0ZjggLT4gSlNPTiAtPiBBcnJheVxuICAgICAgICAgICAgICAgICAgICBpZiAoa2V5d29yZCA9PT0gXCJuYXZcIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5pdE5hdihlbCBhcyBOYXZFbGVtZW50LCBhcmdzIGFzIE5hdkFyZ3MpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGtleXdvcmQgPT09IFwiY29tYm9cIikge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5pdENvbWJvKGVsLCBhcmdzIGFzIENvbWJvQXJncyk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoa2V5d29yZCA9PT0gXCJzZWxlY3RvclwiKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbml0U2VsZWN0b3IoZWwsIGFyZ3MgYXMgU2VsZWN0b3JBcmdzKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihcIlNraXBwZWQgUGFneS5pbml0KCkgZm9yOiAlb1xcblVua25vd24ga2V5d29yZCAnJXMnXCIsIGVsLCBrZXl3b3JkKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGVycikgeyBjb25zb2xlLndhcm4oXCJTa2lwcGVkIFBhZ3kuaW5pdCgpIGZvcjogJW9cXG4lc1wiLCBlbCwgZXJyKSB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9O1xufSkoKTtcblxuZXhwb3J0IGRlZmF1bHQgUGFneTtcbiIKICBdLAogICJtYXBwaW5ncyI6ICI7QUFrQkEsSUFBTSxRQ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FxQixXQUFXLEtBQUssS0FBSyxHQUFHLGFBQWEsV0FBVyxDQUFXLEdBQUcsT0FBSyxFQUFFLFdBQVcsQ0FBQyxDQUFDO0FBQzdHLGlCQUFPLFlBQVksUUFBUSxLQUFLLE1BQU8sSUFBSSxZQUFZLEVBQUcsT0FBTyxVQUFVLENBQUM7QUFDNUUsY0FBSSxZQUFZLE9BQU87QUFDbkIsb0JBQVEsSUFBa0IsSUFBZTtBQUFBLFVBQzdDLFdBQVcsWUFBWSxTQUFTO0FBQzVCLHNCQUFVLElBQUksSUFBaUI7QUFBQSxVQUNuQyxXQUFXLFlBQVksWUFBWTtBQUMvQix5QkFBYSxJQUFJLElBQW9CO0FBQUEsVUFDekMsT0FBTztBQUNILG9CQUFRLEtBQUsscURBQXFELElBQUksT0FBTztBQUFBO0FBQUEsaUJBRTVFLEtBQVA7QUFBYyxrQkFBUSxLQUFLLG1DQUFtQyxJQUFJLEdBQUc7QUFBQTtBQUFBLE1BQzNFO0FBQUE7QUFBQSxFQUVSO0FBQUEsR0FDRDsiLAogICJkZWJ1Z0lkIjogIjIyNDI1QjNEREEzODgxMDQ2NDc1NmUyMTY0NzU2ZTIxIiwKICAibmFtZXMiOiBbXQp9
|
data/javascripts/pagy-module.js
CHANGED
@@ -1,113 +1,101 @@
|
|
1
1
|
const Pagy = (() => {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
filled = tokens.gap;
|
27
|
-
}
|
28
|
-
else { // active page
|
29
|
-
filled = fillIn(tokens.current, item, label);
|
30
|
-
}
|
31
|
-
html += (typeof trimParam === "string" && item == 1) ? trim(filled, trimParam) : filled;
|
32
|
-
}
|
33
|
-
html += tokens.after; // eslint-disable-line align-assignments/align-assignments
|
34
|
-
el.innerHTML = "";
|
35
|
-
el.insertAdjacentHTML("afterbegin", html);
|
36
|
-
lastWidth = width;
|
37
|
-
})();
|
38
|
-
if (el.classList.contains("pagy-rjs")) {
|
39
|
-
rjsObserver.observe(container);
|
2
|
+
const rjsObserver = new ResizeObserver((entries) => entries.forEach((e) => e.target.querySelectorAll(".pagy-rjs").forEach((el) => el.pagyRender())));
|
3
|
+
const initNav = (el, [tokens, sequels, labelSequels, trimParam]) => {
|
4
|
+
const container = el.parentElement ?? el;
|
5
|
+
const widths = Object.keys(sequels).map((w) => parseInt(w)).sort((a, b) => b - a);
|
6
|
+
let lastWidth = -1;
|
7
|
+
const fillIn = (a, page, label) => a.replace(/__pagy_page__/g, page).replace(/__pagy_label__/g, label);
|
8
|
+
(el.pagyRender = function() {
|
9
|
+
const width = widths.find((w) => w < container.clientWidth) || 0;
|
10
|
+
if (width === lastWidth) {
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
let html = tokens.before;
|
14
|
+
const series = sequels[width.toString()];
|
15
|
+
const labels = labelSequels?.[width.toString()] ?? series.map((l) => l.toString());
|
16
|
+
for (const i in series) {
|
17
|
+
const item = series[i];
|
18
|
+
const label = labels[i];
|
19
|
+
let filled;
|
20
|
+
if (typeof item === "number") {
|
21
|
+
filled = fillIn(tokens.a, item.toString(), label);
|
22
|
+
} else if (item === "gap") {
|
23
|
+
filled = tokens.gap;
|
24
|
+
} else {
|
25
|
+
filled = fillIn(tokens.current, item, label);
|
40
26
|
}
|
27
|
+
html += typeof trimParam === "string" && item == 1 ? trim(filled, trimParam) : filled;
|
28
|
+
}
|
29
|
+
html += tokens.after;
|
30
|
+
el.innerHTML = "";
|
31
|
+
el.insertAdjacentHTML("afterbegin", html);
|
32
|
+
lastWidth = width;
|
33
|
+
})();
|
34
|
+
if (el.classList.contains("pagy-rjs")) {
|
35
|
+
rjsObserver.observe(container);
|
36
|
+
}
|
37
|
+
};
|
38
|
+
const initCombo = (el, [url_token, trimParam]) => initInput(el, (inputValue) => [inputValue, url_token.replace(/__pagy_page__/, inputValue)], trimParam);
|
39
|
+
const initSelector = (el, [from, url_token, trimParam]) => {
|
40
|
+
initInput(el, (inputValue) => {
|
41
|
+
const page = Math.max(Math.ceil(from / parseInt(inputValue)), 1).toString();
|
42
|
+
const url = url_token.replace(/__pagy_page__/, page).replace(/__pagy_items__/, inputValue);
|
43
|
+
return [page, url];
|
44
|
+
}, trimParam);
|
45
|
+
};
|
46
|
+
const initInput = (el, getVars, trimParam) => {
|
47
|
+
const input = el.querySelector("input");
|
48
|
+
const link = el.querySelector("a");
|
49
|
+
const initial = input.value;
|
50
|
+
const action = function() {
|
51
|
+
if (input.value === initial) {
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
const [min, val, max] = [input.min, input.value, input.max].map((n) => parseInt(n) || 0);
|
55
|
+
if (val < min || val > max) {
|
56
|
+
input.value = initial;
|
57
|
+
input.select();
|
58
|
+
return;
|
59
|
+
}
|
60
|
+
let [page, url] = getVars(input.value);
|
61
|
+
if (typeof trimParam === "string" && page === "1") {
|
62
|
+
url = trim(url, trimParam);
|
63
|
+
}
|
64
|
+
link.href = url;
|
65
|
+
link.click();
|
41
66
|
};
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
link.href = url;
|
72
|
-
link.click();
|
73
|
-
};
|
74
|
-
["change", "focus"].forEach(e => input.addEventListener(e, input.select)); // auto-select
|
75
|
-
input.addEventListener("focusout", action); // trigger action
|
76
|
-
input.addEventListener("keypress", e => { if (e.key === "Enter") {
|
77
|
-
action();
|
78
|
-
} }); // trigger action
|
79
|
-
};
|
80
|
-
// Trim the ${page-param}=1 params in links
|
81
|
-
const trim = (a, param) => a.replace(new RegExp(`[?&]${param}=1\\b(?!&)|\\b${param}=1&`), "");
|
82
|
-
// Public interface
|
83
|
-
return {
|
84
|
-
version: "8.4.0",
|
85
|
-
// Scan for elements with a "data-pagy" attribute and call their init functions with the decoded args
|
86
|
-
init(arg) {
|
87
|
-
const target = arg instanceof Element ? arg : document;
|
88
|
-
const elements = target.querySelectorAll("[data-pagy]");
|
89
|
-
for (const el of elements) {
|
90
|
-
try {
|
91
|
-
const uint8array = Uint8Array.from(atob(el.getAttribute("data-pagy")), c => c.charCodeAt(0));
|
92
|
-
const [keyword, ...args] = JSON.parse((new TextDecoder()).decode(uint8array)); // base64-utf8 -> JSON -> Array
|
93
|
-
if (keyword === "nav") {
|
94
|
-
initNav(el, args);
|
95
|
-
}
|
96
|
-
else if (keyword === "combo") {
|
97
|
-
initCombo(el, args);
|
98
|
-
}
|
99
|
-
else if (keyword === "selector") {
|
100
|
-
initSelector(el, args);
|
101
|
-
}
|
102
|
-
else {
|
103
|
-
console.warn("Skipped Pagy.init() for: %o\nUnknown keyword '%s'", el, keyword);
|
104
|
-
}
|
105
|
-
}
|
106
|
-
catch (err) {
|
107
|
-
console.warn("Skipped Pagy.init() for: %o\n%s", el, err);
|
108
|
-
}
|
109
|
-
}
|
67
|
+
["change", "focus"].forEach((e) => input.addEventListener(e, input.select));
|
68
|
+
input.addEventListener("focusout", action);
|
69
|
+
input.addEventListener("keypress", (e) => {
|
70
|
+
if (e.key === "Enter") {
|
71
|
+
action();
|
72
|
+
}
|
73
|
+
});
|
74
|
+
};
|
75
|
+
const trim = (a, param) => a.replace(new RegExp(`[?&]${param}=1\\b(?!&)|\\b${param}=1&`), "");
|
76
|
+
return {
|
77
|
+
version: "8.4.2",
|
78
|
+
init(arg) {
|
79
|
+
const target = arg instanceof Element ? arg : document;
|
80
|
+
const elements = target.querySelectorAll("[data-pagy]");
|
81
|
+
for (const el of elements) {
|
82
|
+
try {
|
83
|
+
const uint8array = Uint8Array.from(atob(el.getAttribute("data-pagy")), (c) => c.charCodeAt(0));
|
84
|
+
const [keyword, ...args] = JSON.parse(new TextDecoder().decode(uint8array));
|
85
|
+
if (keyword === "nav") {
|
86
|
+
initNav(el, args);
|
87
|
+
} else if (keyword === "combo") {
|
88
|
+
initCombo(el, args);
|
89
|
+
} else if (keyword === "selector") {
|
90
|
+
initSelector(el, args);
|
91
|
+
} else {
|
92
|
+
console.warn("Skipped Pagy.init() for: %o\nUnknown keyword '%s'", el, keyword);
|
93
|
+
}
|
94
|
+
} catch (err) {
|
95
|
+
console.warn("Skipped Pagy.init() for: %o\n%s", el, err);
|
110
96
|
}
|
111
|
-
|
97
|
+
}
|
98
|
+
}
|
99
|
+
};
|
112
100
|
})();
|
113
101
|
export default Pagy;
|
data/javascripts/pagy.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
window.Pagy=(()=>{const x=new ResizeObserver((B)=>B.forEach((D)=>D.target.querySelectorAll(".pagy-rjs").forEach((E)=>E.pagyRender()))),A=(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,Q)=>H.replace(/__pagy_page__/g,M).replace(/__pagy_label__/g,Q);if((B.pagyRender=function(){const H=K.find((R)=>R<F.clientWidth)||0;if(H===L)return;let M=D.before;const Q=E[H.toString()],Y=z?.[H.toString()]??Q.map((R)=>R.toString());for(let R in Q){const U=Q[R],j=Y[R];let X;if(typeof U==="number")X=T(D.a,U.toString(),j);else if(U==="gap")X=D.gap;else X=T(D.current,U,j);M+=typeof G==="string"&&U==1?$(X,G):X}M+=D.after,B.innerHTML="",B.insertAdjacentHTML("afterbegin",M),L=H})(),B.classList.contains("pagy-rjs"))x.observe(F)},C=(B,[D,E])=>Z(B,(z)=>[z,D.replace(/__pagy_page__/,z)],E),J=(B,[D,E,z])=>{Z(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)},Z=(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((Y)=>parseInt(Y)||0);if(T<L||T>H){z.value=F,z.select();return}let[M,Q]=D(z.value);if(typeof E==="string"&&M==="1")Q=$(Q,E);G.href=Q,G.click()};["change","focus"].forEach((L)=>z.addEventListener(L,z.select)),z.addEventListener("focusout",K),z.addEventListener("keypress",(L)=>{if(L.key==="Enter")K()})},$=(B,D)=>B.replace(new RegExp(`[?&]${D}=1\\b(?!&)|\\b${D}=1&`),"");return{version:"8.4.2",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")A(z,K);else if(F==="combo")C(z,K);else if(F==="selector")J(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)}}}})();
|
data/lib/pagy/backend.rb
CHANGED
@@ -38,7 +38,7 @@ class Pagy
|
|
38
38
|
# Sub-method called only by #pagy: here for easy customization of record-extraction by overriding
|
39
39
|
# You may need to override this method for collections without offset|limit
|
40
40
|
def pagy_get_items(collection, pagy)
|
41
|
-
collection.offset(pagy.offset).limit(pagy.
|
41
|
+
collection.offset(pagy.offset).limit(pagy.items)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
data/lib/pagy/extras/pagy.rb
CHANGED
@@ -63,7 +63,7 @@ class Pagy # :nodoc:
|
|
63
63
|
end
|
64
64
|
|
65
65
|
# Return the enabled/disabled next page anchor tag
|
66
|
-
def pagy_next_a(pagy, text: pagy_t('pagy.next'), aria_label: pagy_t('pagy.aria_label.
|
66
|
+
def pagy_next_a(pagy, text: pagy_t('pagy.next'), aria_label: pagy_t('pagy.aria_label.next'))
|
67
67
|
a = pagy_anchor(pagy)
|
68
68
|
next_a(pagy, a, text:, aria_label:)
|
69
69
|
end
|
data/lib/pagy/extras/trim.rb
CHANGED
@@ -9,7 +9,7 @@ class Pagy # :nodoc:
|
|
9
9
|
# Override the original pagy_a_proc.
|
10
10
|
# Call the pagy_trim method for page 1 if the trim_extra is enabled
|
11
11
|
def pagy_anchor(pagy)
|
12
|
-
a_proc = super
|
12
|
+
a_proc = super
|
13
13
|
return a_proc unless pagy.vars[:trim_extra]
|
14
14
|
|
15
15
|
lambda do |page, text = pagy.label_for(page), **opts|
|
data/lib/pagy/frontend.rb
CHANGED
data/lib/pagy.rb
CHANGED
data/pkg/pagy-8.4.2.gem
ADDED
Binary file
|
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.4.
|
4
|
+
version: 8.4.2
|
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-
|
11
|
+
date: 2024-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Agnostic pagination in plain ruby. It does it all. Better.
|
14
14
|
email:
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- locales/zh-CN.yml
|
106
106
|
- locales/zh-HK.yml
|
107
107
|
- locales/zh-TW.yml
|
108
|
+
- pkg/pagy-8.4.2.gem
|
108
109
|
- stylesheets/pagy.css
|
109
110
|
- stylesheets/pagy.scss
|
110
111
|
- stylesheets/pagy.tailwind.css
|
@@ -138,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
139
|
- !ruby/object:Gem::Version
|
139
140
|
version: '0'
|
140
141
|
requirements: []
|
141
|
-
rubygems_version: 3.5.
|
142
|
+
rubygems_version: 3.5.11
|
142
143
|
signing_key:
|
143
144
|
specification_version: 4
|
144
145
|
summary: The best pagination ruby gem
|