@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.
42 lines (41 loc) • 1.57 kB
JavaScript
import { jsxs as f, jsx as o } from "react/jsx-runtime";
import g from "react";
import { connect as F } from "react-redux";
import { Container as I, Icon as h } from "semantic-ui-react";
import { cleanFilter as N } from "../reducers/data.js";
const b = (t) => {
const {
appliedFilters: r,
initialFilters: e,
"data-group": n,
onClean: c,
"data-app": d = "csv",
"data-reset-label": u = "Reset All Filters"
} = t, m = g.useMemo(() => Object.keys(e).some((i) => {
const a = e[i], l = (r[i] || []).filter((s) => s !== Number.MIN_SAFE_INTEGER);
if (l.length === 0)
return !1;
if (a.length === 1 && a[0] === Number.MIN_SAFE_INTEGER && l.length > 0)
return !0;
const p = a.length !== l.length && !a.every((s) => l.includes(s));
return console.log("res", p), p;
}), [e, r]);
return /* @__PURE__ */ f(I, { fluid: !0, className: `data-filters-reset ignore ${m ? "" : "disabled"}`, onClick: (i) => c({ app: d, group: n }), children: [
/* @__PURE__ */ o("span", { children: u }),
/* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(h, { name: "undo alternate", className: "custom-undo-icon" }) })
] });
}, C = (t, r) => {
const {
"data-group": e,
"data-app": n = "csv"
} = r;
return {
appliedFilters: t.getIn(["data", "filters", n, e]) ? t.getIn(["data", "filters", n, e]).toJS() : {},
initialFilters: t.getIn(["data", "filters", "initial", n, e]) ? t.getIn(["data", "filters", "initial", n, e]).toJS() : {}
};
}, E = {
onClean: N
}, v = F(C, E)(b);
export {
v as default
};