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.

53 lines (52 loc) 1.63 kB
import { jsxs as I, jsx as r } from "react/jsx-runtime"; import { useState as d, useEffect as f } from "react"; import { connect as b } from "react-redux"; import { Container as F, Icon as E } from "semantic-ui-react"; import { applyFilter as S } from "../reducers/data.js"; const A = (t) => { const { editing: l = !1, "data-group": e, onApply: a, "data-app": m = "csv", "data-label": g = "Apply", filters: i, initialFilters: u, apply: n } = t, [s, o] = d(!1), [p, y] = d(u); return console.log(n), f(() => { Object.keys(p).forEach((c) => { p[c].length != i[c].filter((h) => h != Number.MIN_SAFE_INTEGER).length && o(!0); }), y(i); }, [i]), f(() => { n != null && o(!1); }, [n]), /* @__PURE__ */ I( F, { fluid: !0, className: `data-filters-apply ignore ${s ? "" : "disabled"} ${l ? "editing" : ""}`, onClick: () => { s && a({ app: m, group: e }); }, children: [ /* @__PURE__ */ r("span", { children: g }), /* @__PURE__ */ r("span", { children: /* @__PURE__ */ r(E, { name: "chevron circle right", className: "custom-apply-icon" }) }) ] } ); }, N = (t, l) => { const { "data-group": e, "data-app": a = "csv" } = l; return { apply: t.getIn(["data", "filters-settings", a, e, "apply"]), filters: t.getIn(["data", "filters", a, e]) ? t.getIn(["data", "filters", a, e]).toJS() : {}, initialFilters: t.getIn(["data", "filters", "initial", a, e]) ? t.getIn(["data", "filters", "initial", a, e]).toJS() : {} }; }, x = { onApply: S }, T = b(N, x)(A); export { T as default };