@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.
124 lines (123 loc) • 3.52 kB
JavaScript
import { jsx as t, jsxs as M } from "react/jsx-runtime";
import { useState as h, useRef as y, useEffect as S } from "react";
import { connect as k } from "react-redux";
import { parse as n, compareJsonProps as D, decode as I } from "../utils/parseUtils.js";
import N from "./Map.js";
import R from "./BaseLayer.js";
import T from "./DataLayer.js";
import U from "./LatLongLayer.js";
import Z from "./ZoomControl.js";
import q from "./ProjectedContainer.js";
import A from "./Legends.js";
import B from "./FlowLayer.js";
import { SettingProvider as F, SettingsConsumer as J } from "@devgateway/wp-react-lib";
const V = (p) => {
const {
unique: r,
editing: a,
"data-group": i,
"data-layers": f = "[]",
"data-height": u = 400,
"data-width": g = 1e3,
"data-back-ground-color": w = "#88e8dc",
"data-map-position": P = "{}",
"data-projection": z = "geoMercator",
"data-zoom-enabled": C = !0,
"data-rotation-enabled": b = !1,
intl: s
} = p, [m, L] = h(n(f), []), E = y(null), d = y(null), [c, j] = h(null);
S(() => {
const o = n(f);
D(m, o) || L(o);
}, [f]);
const v = (o) => {
const e = m.slice(), l = e.find((x) => x.id == o);
l && (l.visible = !l.visible), L(e);
};
return /* @__PURE__ */ t("div", { ref: E, className: "d3map-container", children: /* @__PURE__ */ t(F, { locale: s.locale, changeUUID: r, children: /* @__PURE__ */ t(J, { children: /* @__PURE__ */ M(
q,
{
backgroundColor: I(w),
height: u,
width: g,
projectionName: z,
editing: a,
initialPosition: n(P, a),
children: [
/* @__PURE__ */ t(N, { rotationEnabled: n(b, a), children: m && m.filter((o) => o.visible != !1).map((o, e) => {
if (o.type === "base")
return /* @__PURE__ */ t(
R,
{
transform: c,
intl: s,
zoom: d,
unique: r,
...o
},
e
);
if (o.type === "data")
return /* @__PURE__ */ t(
T,
{
onLayerCreated: (l) => {
},
transform: c,
intl: s,
group: i,
zoom: d,
unique: r,
...o,
settings: p.wordress
},
e
);
if (o.type === "flow")
return /* @__PURE__ */ t(
B,
{
transform: c,
intl: s,
group: i,
zoom: d,
unique: r,
...o
},
e
);
if (o.type === "dataPoints")
return /* @__PURE__ */ t(
U,
{
transform: c,
intl: s,
group: i,
zoom: d,
unique: r,
...o
},
e
);
}) }),
/* @__PURE__ */ t(A, { patternsData: null, layers: m, group: i, onItemClick: v }),
/* @__PURE__ */ t(
Z,
{
rootationEmabled: n(b, a),
zoomEnabled: n(C, a),
onZoomed: j,
width: g,
height: u,
ref: d,
group: i,
editing: a
}
)
]
}
) }) }) });
}, W = (p, r) => ({}), G = {}, no = k(W, G)(V);
export {
no as default
};