UNPKG

@devgateway/dvz-ui-react

Version:

A modular, embeddable React component library for data visualization and UI, built with TypeScript. Provides reusable components for charts, maps, dashboards, and more, with built-in support for internationalization and Redux integration.

70 lines (69 loc) 2.04 kB
import { jsxs as a, jsx as r } from "react/jsx-runtime"; import P, { useState as c, useEffect as v } from "react"; import { useDispatch as C, useSelector as x } from "react-redux"; import { Container as I, Dropdown as y, Icon as d } from "semantic-ui-react"; import { injectIntl as b } from "react-intl"; const j = (u) => { const { "data-group": l } = u, p = C(), e = x((t) => t.getIn(["data", "postsPagination", l])), s = e && (e != null && e.totalPages) ? e.totalPages : 1, [o, g] = c(1), [m, f] = c([]), h = () => { const t = []; for (let n = 1; n <= s; n++) t.push({ key: n, text: n, value: n }); f(t); }, i = (t) => { t !== o && (t < 1 || t > s || (g(t), p({ type: "SET_POSTS_FILTER", group: l, ...e, page: t }))); }; return v(() => { h(); }, [e == null ? void 0 : e.totalPages]), /* @__PURE__ */ a(I, { fluid: !0, className: "posts-pagination", children: [ /* @__PURE__ */ a("div", { className: "posts-pagination-dropdown", children: [ /* @__PURE__ */ r("span", { children: "Page" }), /* @__PURE__ */ r( y, { options: m, placeholder: "Select Item", selection: !0, compact: !0, value: o, onChange: (t, n) => i(Number(n.value)) } ), /* @__PURE__ */ r("div", { children: /* @__PURE__ */ a("span", { children: [ "of ", e && (e == null ? void 0 : e.totalPages) ] }) }) ] }), /* @__PURE__ */ a("div", { children: [ /* @__PURE__ */ r( d, { size: "large", style: { cursor: "pointer" }, onClick: () => i(o - 1), name: "angle left", disabled: o === 1 } ), /* @__PURE__ */ r( d, { size: "large", style: { cursor: "pointer" }, onClick: () => i(o + 1), name: "angle right", disabled: o === s } ) ] }) ] }); }, w = b(P.memo(j)); export { w as default };