@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 s=require("react/jsx-runtime"),r=require("react"),d=require("react-redux"),i=require("semantic-ui-react"),v=require("react-intl"),I=p=>{const{"data-group":c}=p,f=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,[a,g]=r.useState((n==null?void 0:n.page)??1),[h,m]=r.useState([]),x=r.useRef(null),j=()=>{const e=[];for(let o=1;o<=l;o++)e.push({key:o,text:o,value:o});m(e)},u=e=>{if(e===a||e<1||e>l)return;g(e),f({type:"SET_POSTS_FILTER",group:c,...n,page:e});const o=document.getElementById(`filtered-posts-${c}`);if(o){const P=o.getBoundingClientRect().top+window.scrollY-50;window.scrollTo({top:P,behavior:"smooth"})}};return r.useEffect(()=>{j()},[t]),r.useEffect(()=>{const e=(n==null?void 0:n.page)??1;e!==a&&g(e)},[n==null?void 0:n.page]),s.jsx("div",{ref:x,children:s.jsxs(i.Container,{fluid:!0,className:"posts-pagination",children:[s.jsxs("div",{className:"posts-pagination-dropdown",children:[s.jsx("span",{children:"Page"}),s.jsx(i.Dropdown,{options:h,placeholder:"Select Item",selection:!0,compact:!0,value:a,onChange:(e,o)=>u(Number(o.value))}),s.jsx("div",{children:s.jsxs("span",{children:["of ",t&&(t==null?void 0:t.totalPages)]})})]}),s.jsxs("div",{children:[s.jsx(i.Icon,{size:"large",style:{cursor:"pointer"},onClick:()=>u(a-1),name:"angle left",disabled:a===1}),s.jsx(i.Icon,{size:"large",style:{cursor:"pointer"},onClick:()=>u(a+1),name:"angle right",disabled:a===l})]})]})})},R=v.injectIntl(r.memo(I));exports.default=R;
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 s } from "react/jsx-runtime";
2
- import x, { useState as g, useRef as y, useEffect as p } from "react";
3
- import { useDispatch as R, useSelector as u } from "react-redux";
4
- import { Container as b, Dropdown as E, Icon as m } from "semantic-ui-react";
5
- import { injectIntl as S } from "react-intl";
6
- const T = (f) => {
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
- } = f, h = R(), t = u((e) => e.getIn(["data", "postsPagination", i])), n = u((e) => e.getIn(["data", "posts", i])), c = t && (t != null && t.totalPages) ? t.totalPages : 1, [a, d] = g((n == null ? void 0 : n.page) ?? 1), [P, v] = g([]), w = y(null), C = () => {
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 o = 1; o <= c; o++)
12
- e.push({ key: o, text: o, value: o });
13
- v(e);
14
- }, l = (e) => {
15
- if (e === a || e < 1 || e > c) return;
16
- d(e), h({
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
- ...n,
21
+ ...o,
20
22
  page: e
21
23
  });
22
- const o = document.getElementById(`filtered-posts-${i}`);
23
- if (o) {
24
- const I = o.getBoundingClientRect().top + window.scrollY - 50;
25
- window.scrollTo({ top: I, behavior: "smooth" });
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
- C();
31
+ I();
30
32
  }, [t]), p(() => {
31
- const e = (n == null ? void 0 : n.page) ?? 1;
33
+ const e = (o == null ? void 0 : o.page) ?? 1;
32
34
  e !== a && d(e);
33
- }, [n == null ? void 0 : n.page]), /* @__PURE__ */ r("div", { ref: w, children: /* @__PURE__ */ s(b, { fluid: !0, className: "posts-pagination", children: [
34
- /* @__PURE__ */ s("div", { className: "posts-pagination-dropdown", children: [
35
- /* @__PURE__ */ r("span", { children: "Page" }),
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
- E,
39
+ T,
38
40
  {
39
- options: P,
41
+ options: v,
40
42
  placeholder: "Select Item",
41
43
  selection: !0,
42
44
  compact: !0,
43
45
  value: a,
44
- onChange: (e, o) => l(Number(o.value))
46
+ onChange: (e, n) => c(Number(n.value))
45
47
  }
46
48
  ),
47
- /* @__PURE__ */ r("div", { children: /* @__PURE__ */ s("span", { children: [
48
- "of ",
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__ */ s("div", { children: [
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: () => l(a - 1),
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: () => l(a + 1),
71
+ onClick: () => c(a + 1),
69
72
  name: "angle right",
70
- disabled: a === c
73
+ disabled: a === s
71
74
  }
72
75
  )
73
76
  ] })
74
77
  ] }) });
75
- }, B = S(x.memo(T));
78
+ }, D = j(y.memo(k));
76
79
  export {
77
- B as default
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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.7.6",
3
+ "version": "1.7.7",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",