@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.
47 lines (46 loc) • 1.61 kB
JavaScript
import { jsxs as c, jsx as r } from "react/jsx-runtime";
import { useEffect as f } from "react";
import { Container as d } from "semantic-ui-react";
import { setMeasures as h, cleanMeasures as g } from "../reducers/data.js";
import { useAppDispatch as x, useAppSelector as C } from "../../redux/hooks.js";
const E = (m) => {
const {
parent: N,
editing: S = !1,
unique: b,
"data-label": t,
"data-group": p,
"data-app": s,
"data-measures-groups": n
} = m;
let e;
const i = x(), u = C((a) => a.getIn(["data", "measures", s, p])), l = {
onReset: g,
onChange: h
};
if (n instanceof String || typeof n == "string" ? e = JSON.parse(decodeURIComponent(n)) : e = n, f(() => {
e && e[s] && e[s].forEach((a) => {
a.defaultSelected && i(l.onChange({ app: s, group: p, mGroup: a }));
});
}, []), e && e[s]) {
const a = e[s];
return /* @__PURE__ */ c(d, { className: "measures group", fluid: !0, children: [
t && /* @__PURE__ */ r("span", { children: t }),
a.map((o) => /* @__PURE__ */ c("div", { className: "inputs lists", onClick: (y) => i(l.onChange({ app: s, group: p, mGroup: o })), children: [
/* @__PURE__ */ r(
"input",
{
readOnly: !0,
checked: !!(u && u.idx == o.idx),
type: "radio"
}
),
/* @__PURE__ */ r("span", { children: o.label })
] }, o.idx))
] });
} else
return /* @__PURE__ */ r(d, { className: "measures group", fluid: !0, children: t && /* @__PURE__ */ r("span", { children: t }) });
};
export {
E as default
};