update minimal pagination
This commit is contained in:
parent
36b003914e
commit
b8ff72ff4e
65
dist/remote/Pagination.js
vendored
65
dist/remote/Pagination.js
vendored
@ -122,39 +122,39 @@ function ue({
|
||||
level: D = "full",
|
||||
...v
|
||||
}) {
|
||||
const { React: n, Button: $, HStack: E, IconButton: y, Input: q, Text: c } = T(), { useCallback: S, useEffect: W, useMemo: J, useRef: Q, useState: L } = n, A = ae(D), f = U[A], r = A === "simple", k = A === "minimal", z = Number(d), Y = Number.isFinite(z) && z > 0 ? z : 10, M = Number(e), B = Number.isFinite(M) && M > 0 ? M : 0, j = Number(g), i = Number.isFinite(j) && j > 0 ? Math.ceil(j) : Math.ceil(B / Y), s = H(t, i), [w, m] = L(
|
||||
const { React: n, Button: $, HStack: E, IconButton: y, Input: q, Text: c } = T(), { useCallback: k, useEffect: W, useMemo: J, useRef: Q, useState: L } = n, A = ae(D), f = U[A], r = A === "simple", _ = A === "minimal", z = Number(d), Y = Number.isFinite(z) && z > 0 ? z : 10, M = Number(e), B = Number.isFinite(M) && M > 0 ? M : 0, j = Number(g), i = Number.isFinite(j) && j > 0 ? Math.ceil(j) : Math.ceil(B / Y), s = H(t, i), [w, m] = L(
|
||||
r ? "" : u(s)
|
||||
), [C, P] = L(!1), [h, p] = L(null), _ = Q(null), l = h ?? s, G = B > 0, Z = J(() => r || i <= 0 ? [] : Array.from(
|
||||
), [C, P] = L(!1), [h, p] = L(null), x = Q(null), l = h ?? s, G = B > 0, Z = J(() => r || i <= 0 ? [] : Array.from(
|
||||
new Set(
|
||||
f.getPageNumbers({
|
||||
currentPage: s,
|
||||
totalPages: i
|
||||
})
|
||||
)
|
||||
).filter((o) => o >= 1 && o <= i).sort((o, a) => o - a), [f, r, s, i]), I = S(() => {
|
||||
).filter((o) => o >= 1 && o <= i).sort((o, a) => o - a), [f, r, s, i]), I = k(() => {
|
||||
m(r ? "" : u(s)), P(!1), p(null);
|
||||
}, [r, s]), x = S(
|
||||
}, [r, s]), S = k(
|
||||
(o) => {
|
||||
const a = H(o, i);
|
||||
P(!1), m(r ? "" : u(s)), p(null), a !== s && b?.(a);
|
||||
},
|
||||
[r, b, s, i]
|
||||
), N = S(() => {
|
||||
), N = k(() => {
|
||||
if (!w) {
|
||||
I(), _.current?.blur();
|
||||
I(), x.current?.blur();
|
||||
return;
|
||||
}
|
||||
const o = parseInt(V(w), 10);
|
||||
if (Number.isNaN(o)) {
|
||||
I(), _.current?.blur();
|
||||
I(), x.current?.blur();
|
||||
return;
|
||||
}
|
||||
const a = H(o, i);
|
||||
if (r) {
|
||||
P(!1), m(""), a !== s ? (p(a), b?.(a)) : p(null), _.current?.blur();
|
||||
P(!1), m(""), a !== s ? (p(a), b?.(a)) : p(null), x.current?.blur();
|
||||
return;
|
||||
}
|
||||
a !== s ? (p(a), m(u(a)), b?.(a)) : (m(u(s)), P(!1), p(null)), _.current?.blur();
|
||||
a !== s ? (p(a), m(u(a)), b?.(a)) : (m(u(s)), P(!1), p(null)), x.current?.blur();
|
||||
}, [
|
||||
w,
|
||||
r,
|
||||
@ -162,9 +162,9 @@ function ue({
|
||||
I,
|
||||
s,
|
||||
i
|
||||
]), ee = S(() => {
|
||||
]), ee = k(() => {
|
||||
p(null), m(""), P(!0);
|
||||
}, []), te = S((o) => {
|
||||
}, []), te = k((o) => {
|
||||
const a = o.target.value, re = V(a).replace(/\D/g, "");
|
||||
m(u(re));
|
||||
}, []);
|
||||
@ -179,7 +179,7 @@ function ue({
|
||||
}
|
||||
C || m(u(s));
|
||||
}, [C, r, h, s]), W(() => {
|
||||
r && C && _.current?.focus();
|
||||
r && C && x.current?.focus();
|
||||
}, [C, r]), W(() => {
|
||||
if (!C || !w || !r && h !== null) return;
|
||||
const o = setTimeout(() => {
|
||||
@ -188,7 +188,7 @@ function ue({
|
||||
return () => clearTimeout(o);
|
||||
}, [N, w, C, r, h]), i <= 0) return null;
|
||||
const F = () => n.createElement(q, {
|
||||
ref: _,
|
||||
ref: x,
|
||||
type: "text",
|
||||
inputMode: "numeric",
|
||||
placeholder: "صفحه",
|
||||
@ -210,10 +210,11 @@ function ue({
|
||||
},
|
||||
textAlign: "center",
|
||||
color: "#1D2939",
|
||||
fontSize: k ? "sm" : void 0,
|
||||
fontWeight: k ? "700" : void 0,
|
||||
h: k ? "30px" : void 0,
|
||||
minH: k ? "30px" : void 0,
|
||||
fontSize: _ ? "sm" : void 0,
|
||||
fontWeight: _ ? "700" : void 0,
|
||||
_placeholder: _ ? { fontWeight: "400" } : void 0,
|
||||
h: _ ? "28px" : void 0,
|
||||
minH: _ ? "28px" : void 0,
|
||||
px: 1,
|
||||
minW: 0,
|
||||
dir: "ltr"
|
||||
@ -226,12 +227,12 @@ function ue({
|
||||
bg: a ? "#4B49AC" : "#e6e6f1",
|
||||
color: a ? "#e6e6f1" : "#4B49AC",
|
||||
_hover: { bg: a ? "#4B49AC" : "#cbcbe8" },
|
||||
onClick: r && a ? ee : () => x(o),
|
||||
onClick: r && a ? ee : () => S(o),
|
||||
variant: "soft"
|
||||
},
|
||||
u(o)
|
||||
), ne = r && i > 1 && l !== 1, oe = r && i > 1 && l !== i;
|
||||
return k ? n.createElement(
|
||||
return _ ? n.createElement(
|
||||
E,
|
||||
{
|
||||
justifyContent: "space-between",
|
||||
@ -250,14 +251,14 @@ function ue({
|
||||
{ spacing: 2, alignItems: "center", justifyContent: "center" },
|
||||
n.createElement(y, {
|
||||
size: "sm",
|
||||
w: "28px",
|
||||
h: "28px",
|
||||
minW: "28px",
|
||||
minH: "28px",
|
||||
w: "24px",
|
||||
h: "24px",
|
||||
minW: "24px",
|
||||
minH: "24px",
|
||||
bg: "#e6e6f1",
|
||||
color: "#4B49AC",
|
||||
_hover: { bg: "#cbcbe8" },
|
||||
onClick: () => x(l - 1),
|
||||
onClick: () => S(l - 1),
|
||||
isDisabled: l === 1,
|
||||
icon: n.createElement(K, { width: "16", height: "16" }),
|
||||
"aria-label": "صفحه قبلی"
|
||||
@ -277,21 +278,21 @@ function ue({
|
||||
cursor: i > 0 ? "pointer" : "default",
|
||||
whiteSpace: "nowrap",
|
||||
onClick: () => {
|
||||
i > 0 && x(i);
|
||||
i > 0 && S(i);
|
||||
}
|
||||
},
|
||||
u(i)
|
||||
),
|
||||
n.createElement(y, {
|
||||
size: "sm",
|
||||
w: "28px",
|
||||
h: "28px",
|
||||
minW: "28px",
|
||||
minH: "28px",
|
||||
w: "24px",
|
||||
h: "24px",
|
||||
minW: "24px",
|
||||
minH: "24px",
|
||||
bg: "#e6e6f1",
|
||||
color: "#4B49AC",
|
||||
_hover: { bg: "#cbcbe8" },
|
||||
onClick: () => x(l + 1),
|
||||
onClick: () => S(l + 1),
|
||||
isDisabled: l === i,
|
||||
icon: n.createElement(O, { width: "16", height: "16" }),
|
||||
"aria-label": "صفحه بعدی"
|
||||
@ -345,7 +346,7 @@ function ue({
|
||||
bg: "#e6e6f1",
|
||||
color: "#4B49AC",
|
||||
_hover: { bg: "#cbcbe8" },
|
||||
onClick: () => x(l - 1),
|
||||
onClick: () => S(l - 1),
|
||||
isDisabled: l === 1,
|
||||
icon: n.createElement(K),
|
||||
"aria-label": "صفحه قبلی"
|
||||
@ -373,7 +374,7 @@ function ue({
|
||||
bg: "#e6e6f1",
|
||||
color: "#4B49AC",
|
||||
_hover: { bg: "#cbcbe8" },
|
||||
onClick: () => x(l + 1),
|
||||
onClick: () => S(l + 1),
|
||||
isDisabled: l === i,
|
||||
icon: n.createElement(O),
|
||||
"aria-label": "صفحه بعدی"
|
||||
|
||||
@ -392,8 +392,9 @@ function RemotePagination({
|
||||
color: "#1D2939",
|
||||
fontSize: isMinimal ? "sm" : undefined,
|
||||
fontWeight: isMinimal ? "700" : undefined,
|
||||
h: isMinimal ? "30px" : undefined,
|
||||
minH: isMinimal ? "30px" : undefined,
|
||||
_placeholder: isMinimal ? { fontWeight: "400" } : undefined,
|
||||
h: isMinimal ? "28px" : undefined,
|
||||
minH: isMinimal ? "28px" : undefined,
|
||||
px: 1,
|
||||
minW: 0,
|
||||
dir: "ltr",
|
||||
@ -440,10 +441,10 @@ function RemotePagination({
|
||||
{ spacing: 2, alignItems: "center", justifyContent: "center" },
|
||||
React.createElement(IconButton, {
|
||||
size: "sm",
|
||||
w: "28px",
|
||||
h: "28px",
|
||||
minW: "28px",
|
||||
minH: "28px",
|
||||
w: "24px",
|
||||
h: "24px",
|
||||
minW: "24px",
|
||||
minH: "24px",
|
||||
bg: "#e6e6f1",
|
||||
color: "#4B49AC",
|
||||
_hover: { bg: "#cbcbe8" },
|
||||
@ -476,10 +477,10 @@ function RemotePagination({
|
||||
),
|
||||
React.createElement(IconButton, {
|
||||
size: "sm",
|
||||
w: "28px",
|
||||
h: "28px",
|
||||
minW: "28px",
|
||||
minH: "28px",
|
||||
w: "24px",
|
||||
h: "24px",
|
||||
minW: "24px",
|
||||
minH: "24px",
|
||||
bg: "#e6e6f1",
|
||||
color: "#4B49AC",
|
||||
_hover: { bg: "#cbcbe8" },
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user