@devgateway/dvz-ui-react 1.7.6 → 1.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),r=require("react"),d=require("react-redux"),i=require("semantic-ui-react"),I=require("react-intl"),R=p=>{const{"data-group":c,"data-page-label":f="Page","data-of-label":h="of"}=p,m=d.useDispatch(),t=d.useSelector(e=>e.getIn(["data","postsPagination",c])),n=d.useSelector(e=>e.getIn(["data","posts",c])),l=t&&(t!=null&&t.totalPages)?t.totalPages:1,[s,g]=r.useState((n==null?void 0:n.page)??1),[x,j]=r.useState([]),P=r.useRef(null),b=()=>{const e=[];for(let o=1;o<=l;o++)e.push({key:o,text:o,value:o});j(e)},u=e=>{if(e===s||e<1||e>l)return;g(e),m({type:"SET_POSTS_FILTER",group:c,...n,page:e});const o=document.getElementById(`filtered-posts-${c}`);if(o){const v=o.getBoundingClientRect().top+window.scrollY-50;window.scrollTo({top:v,behavior:"smooth"})}};return r.useEffect(()=>{b()},[t]),r.useEffect(()=>{const e=(n==null?void 0:n.page)??1;e!==s&&g(e)},[n==null?void 0:n.page]),a.jsx("div",{ref:P,children:a.jsxs(i.Container,{fluid:!0,className:"posts-pagination",children:[a.jsxs("div",{className:"posts-pagination-dropdown",children:[a.jsx("span",{children:f}),a.jsx(i.Dropdown,{options:x,placeholder:"Select Item",selection:!0,compact:!0,value:s,onChange:(e,o)=>u(Number(o.value))}),a.jsx("div",{children:a.jsxs("span",{children:[h," ",t&&(t==null?void 0:t.totalPages)]})})]}),a.jsxs("div",{children:[a.jsx(i.Icon,{size:"large",style:{cursor:"pointer"},onClick:()=>u(s-1),name:"angle left",disabled:s===1}),a.jsx(i.Icon,{size:"large",style:{cursor:"pointer"},onClick:()=>u(s+1),name:"angle right",disabled:s===l})]})]})})},S=I.injectIntl(r.memo(R));exports.default=S;
|
|
@@ -1,61 +1,64 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useDispatch as
|
|
4
|
-
import { Container as
|
|
5
|
-
import { injectIntl as
|
|
6
|
-
const
|
|
1
|
+
import { jsx as r, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import y, { useState as g, useRef as R, useEffect as p } from "react";
|
|
3
|
+
import { useDispatch as E, useSelector as u } from "react-redux";
|
|
4
|
+
import { Container as S, Dropdown as T, Icon as m } from "semantic-ui-react";
|
|
5
|
+
import { injectIntl as j } from "react-intl";
|
|
6
|
+
const k = (f) => {
|
|
7
7
|
const {
|
|
8
|
-
"data-group": i
|
|
9
|
-
|
|
8
|
+
"data-group": i,
|
|
9
|
+
"data-page-label": h = "Page",
|
|
10
|
+
"data-of-label": P = "of"
|
|
11
|
+
} = f, b = E(), t = u((e) => e.getIn(["data", "postsPagination", i])), o = u((e) => e.getIn(["data", "posts", i])), s = t && (t != null && t.totalPages) ? t.totalPages : 1, [a, d] = g((o == null ? void 0 : o.page) ?? 1), [v, w] = g([]), C = R(null), I = () => {
|
|
10
12
|
const e = [];
|
|
11
|
-
for (let
|
|
12
|
-
e.push({ key:
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
if (e === a || e < 1 || e >
|
|
16
|
-
d(e),
|
|
13
|
+
for (let n = 1; n <= s; n++)
|
|
14
|
+
e.push({ key: n, text: n, value: n });
|
|
15
|
+
w(e);
|
|
16
|
+
}, c = (e) => {
|
|
17
|
+
if (e === a || e < 1 || e > s) return;
|
|
18
|
+
d(e), b({
|
|
17
19
|
type: "SET_POSTS_FILTER",
|
|
18
20
|
group: i,
|
|
19
|
-
...
|
|
21
|
+
...o,
|
|
20
22
|
page: e
|
|
21
23
|
});
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
const
|
|
25
|
-
window.scrollTo({ top:
|
|
24
|
+
const n = document.getElementById(`filtered-posts-${i}`);
|
|
25
|
+
if (n) {
|
|
26
|
+
const x = n.getBoundingClientRect().top + window.scrollY - 50;
|
|
27
|
+
window.scrollTo({ top: x, behavior: "smooth" });
|
|
26
28
|
}
|
|
27
29
|
};
|
|
28
30
|
return p(() => {
|
|
29
|
-
|
|
31
|
+
I();
|
|
30
32
|
}, [t]), p(() => {
|
|
31
|
-
const e = (
|
|
33
|
+
const e = (o == null ? void 0 : o.page) ?? 1;
|
|
32
34
|
e !== a && d(e);
|
|
33
|
-
}, [
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */ r("span", { children:
|
|
35
|
+
}, [o == null ? void 0 : o.page]), /* @__PURE__ */ r("div", { ref: C, children: /* @__PURE__ */ l(S, { fluid: !0, className: "posts-pagination", children: [
|
|
36
|
+
/* @__PURE__ */ l("div", { className: "posts-pagination-dropdown", children: [
|
|
37
|
+
/* @__PURE__ */ r("span", { children: h }),
|
|
36
38
|
/* @__PURE__ */ r(
|
|
37
|
-
|
|
39
|
+
T,
|
|
38
40
|
{
|
|
39
|
-
options:
|
|
41
|
+
options: v,
|
|
40
42
|
placeholder: "Select Item",
|
|
41
43
|
selection: !0,
|
|
42
44
|
compact: !0,
|
|
43
45
|
value: a,
|
|
44
|
-
onChange: (e,
|
|
46
|
+
onChange: (e, n) => c(Number(n.value))
|
|
45
47
|
}
|
|
46
48
|
),
|
|
47
|
-
/* @__PURE__ */ r("div", { children: /* @__PURE__ */
|
|
48
|
-
|
|
49
|
+
/* @__PURE__ */ r("div", { children: /* @__PURE__ */ l("span", { children: [
|
|
50
|
+
P,
|
|
51
|
+
" ",
|
|
49
52
|
t && (t == null ? void 0 : t.totalPages)
|
|
50
53
|
] }) })
|
|
51
54
|
] }),
|
|
52
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ l("div", { children: [
|
|
53
56
|
/* @__PURE__ */ r(
|
|
54
57
|
m,
|
|
55
58
|
{
|
|
56
59
|
size: "large",
|
|
57
60
|
style: { cursor: "pointer" },
|
|
58
|
-
onClick: () =>
|
|
61
|
+
onClick: () => c(a - 1),
|
|
59
62
|
name: "angle left",
|
|
60
63
|
disabled: a === 1
|
|
61
64
|
}
|
|
@@ -65,14 +68,14 @@ const T = (f) => {
|
|
|
65
68
|
{
|
|
66
69
|
size: "large",
|
|
67
70
|
style: { cursor: "pointer" },
|
|
68
|
-
onClick: () =>
|
|
71
|
+
onClick: () => c(a + 1),
|
|
69
72
|
name: "angle right",
|
|
70
|
-
disabled: a ===
|
|
73
|
+
disabled: a === s
|
|
71
74
|
}
|
|
72
75
|
)
|
|
73
76
|
] })
|
|
74
77
|
] }) });
|
|
75
|
-
},
|
|
78
|
+
}, D = j(y.memo(k));
|
|
76
79
|
export {
|
|
77
|
-
|
|
80
|
+
D as default
|
|
78
81
|
};
|
|
@@ -3,6 +3,8 @@ import { WrappedComponentProps } from 'react-intl';
|
|
|
3
3
|
interface PostsPaginationProps extends WrappedComponentProps {
|
|
4
4
|
"data-group": string;
|
|
5
5
|
"data-number-of-items-per-page": number;
|
|
6
|
+
"data-page-label"?: string;
|
|
7
|
+
"data-of-label"?: string;
|
|
6
8
|
}
|
|
7
9
|
declare const _default: React.FC<import('react-intl').WithIntlProps<PostsPaginationProps>> & {
|
|
8
10
|
WrappedComponent: React.ComponentType<PostsPaginationProps>;
|