@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.
102 lines (101 loc) • 3.57 kB
JavaScript
import { jsxs as s, jsx as n } from "react/jsx-runtime";
import u from "react";
class D extends u.Component {
constructor(l) {
super(l);
}
formatNumber(l) {
const { intl: m, format: a } = this.props;
return m.formatNumber(a.style === "percent" ? l / 100 : l, {
style: a.style,
notation: a.notation,
maximumFractionDigits: a.maximumFractionDigits,
minimuFractionDigits: 0,
currency: a.currency
});
}
render() {
const {
filteredBreaks: l,
formattedLegendTitle: m,
showLegendLabels: a,
symbols: c,
legendFontSize: d,
legendFontWeight: h,
autoGenerateBreaks: i,
intl: b,
numberFormat: x,
mapNoDataColor: p,
showNoDataLegendItem: o,
noDataText: g
} = this.props, t = {
fontSize: d + "px",
fontWeight: h
};
return /* @__PURE__ */ s("div", { className: "legend-container", children: [
/* @__PURE__ */ s("div", { className: "legend-title-container", children: [
/* @__PURE__ */ n("span", { className: "legend-title", children: l && l.length > 0 ? m : "" }),
l.length > 0 && /* @__PURE__ */ n("span", { className: "vertical-spacer", children: "|" })
] }),
/* @__PURE__ */ n("div", { className: "legend", children: /* @__PURE__ */ s("ul", { className: "legend-items-container", children: [
l && l.map((e, r) => /* @__PURE__ */ s("li", { className: "legend-item", children: [
/* @__PURE__ */ n(
"span",
{
className: "symbol",
style: { backgroundColor: e.color }
}
),
a && !i && /* @__PURE__ */ n("span", { className: "legend-label", style: t, children: e.label }),
(!a || i) && e.min != null && e.max != null && /* @__PURE__ */ s("span", { className: "legend-label", style: t, children: [
this.formatNumber(e.min),
" -",
" ",
this.formatNumber(e.max)
] }),
(!a || i) && e.min == null && e.max != null && /* @__PURE__ */ s("span", { className: "legend-label", style: t, children: [
" ",
"< ",
this.formatNumber(e.max)
] }),
(!a || i) && e.min != null && e.max == null && /* @__PURE__ */ s("span", { className: "legend-label", style: t, children: [
" ",
"> ",
this.formatNumber(e.min),
" "
] })
] }, "lg" + r)),
console.log("showNoDataLegendItem", o),
o && /* @__PURE__ */ s("li", { className: "legend-item", children: [
/* @__PURE__ */ n(
"span",
{
className: "symbol",
style: { backgroundColor: p }
}
),
/* @__PURE__ */ n("span", { className: "legend-label", style: t, children: g })
] }),
c && c.map((e, r) => /* @__PURE__ */ s("li", { className: "legend-item", children: [
/* @__PURE__ */ n("span", { className: "vertical-spacer", children: "|" }),
e.image && /* @__PURE__ */ n(
"img",
{
style: {
width: "40px",
height: "40px",
marginTop: "-8px",
marginRight: "-4px"
},
src: "/" + e.image
}
),
/* @__PURE__ */ n("span", { className: "legend-label", style: t, children: e.label ? e.label : "" })
] }, "k" + r))
] }) })
] });
}
}
export {
D as default
};