@devgateway/dvz-ui-react 1.9.4 → 1.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/common.css +1 -1
- package/dist/cjs/embeddable/chart/LineLayer.js +1 -1
- package/dist/cjs/embeddable/chart/Tooltip.js +1 -1
- package/dist/cjs/embeddable/common/ChartTooltip.js +1 -1
- package/dist/cjs/embeddable/map/map.js +4 -4
- package/dist/cjs/styles.css +1 -1
- package/dist/esm/common.css +1 -1
- package/dist/esm/embeddable/chart/LineLayer.js +55 -51
- package/dist/esm/embeddable/chart/Tooltip.js +83 -51
- package/dist/esm/embeddable/common/ChartTooltip.js +28 -27
- package/dist/esm/embeddable/map/map.js +121 -116
- package/dist/esm/styles.css +1 -1
- package/dist/types/embeddable/chart/Tooltip.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,60 +1,92 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import "react";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const
|
|
8
|
-
if (!r ||
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as E, useLayoutEffect as A } from "react";
|
|
3
|
+
import F from "react-markdown";
|
|
4
|
+
import R from "remark-gfm";
|
|
5
|
+
import T from "rehype-raw";
|
|
6
|
+
import w from "string-template";
|
|
7
|
+
const _ = /(\+?\%)[\(]([A-z0-9,.,-]+)\)/gi, x = /(\+?\#)[\(]([A-z0-9,.,-]+)\)/gi, L = /(\+?\#C)[\(]([A-z0-9,.,-]+)\)/gi, f = 8, h = (r, t, n, i = 0) => r < f ? f - r : t > n - f ? n - f - t - i : 0, y = (r) => {
|
|
8
|
+
if (!r || typeof window > "u")
|
|
9
|
+
return;
|
|
10
|
+
r.style.transform = "";
|
|
11
|
+
const t = r.getBoundingClientRect(), { innerWidth: n, innerHeight: i } = window, e = n < 768 ? 12 : 40, s = h(t.left, t.right, n, e), l = h(t.top, t.bottom, i);
|
|
12
|
+
(s || l) && (r.style.transform = `translate(${Math.round(s)}px, ${Math.round(l)}px)`);
|
|
13
|
+
}, N = 6, M = 60, I = (r = []) => {
|
|
14
|
+
const t = E(null);
|
|
15
|
+
return A(() => {
|
|
16
|
+
const n = t.current;
|
|
17
|
+
if (!n || typeof window > "u" || !window.requestAnimationFrame) {
|
|
18
|
+
y(n);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
let i = null;
|
|
22
|
+
const e = () => {
|
|
23
|
+
i != null && window.cancelAnimationFrame(i);
|
|
24
|
+
let l = null, o = 0;
|
|
25
|
+
const c = (a) => {
|
|
26
|
+
y(n), o = n.style.transform === l ? o + 1 : 0, l = n.style.transform, i = o >= N || a >= M ? null : window.requestAnimationFrame(() => c(a + 1));
|
|
27
|
+
};
|
|
28
|
+
c(0);
|
|
29
|
+
};
|
|
30
|
+
e();
|
|
31
|
+
const s = typeof ResizeObserver < "u" ? new ResizeObserver(e) : null;
|
|
32
|
+
return s == null || s.observe(n), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
33
|
+
i != null && window.cancelAnimationFrame(i), s == null || s.disconnect(), window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
34
|
+
};
|
|
35
|
+
}, r), t;
|
|
36
|
+
}, p = (r, t, n, i, e, s) => {
|
|
37
|
+
if (!e || !e.formatNumber)
|
|
38
|
+
return t;
|
|
39
|
+
let l, o = t;
|
|
40
|
+
for (; (l = r.exec(t)) !== null; ) {
|
|
41
|
+
const c = l[2], a = l[1], g = ((d, v = 2) => e.formatNumber(i ? d / 100 : d, {
|
|
42
|
+
maximumFractionDigits: v,
|
|
14
43
|
...n,
|
|
15
|
-
signDisplay:
|
|
16
|
-
})).apply(void 0,
|
|
17
|
-
|
|
44
|
+
signDisplay: a && a.startsWith("+") ? "never" : "auto"
|
|
45
|
+
})).apply(void 0, c.split(","));
|
|
46
|
+
o = o.replaceAll(l[0], g);
|
|
18
47
|
}
|
|
19
|
-
return
|
|
20
|
-
},
|
|
21
|
-
if (!
|
|
48
|
+
return o;
|
|
49
|
+
}, S = (r, t, n, i) => {
|
|
50
|
+
if (!r || !t)
|
|
22
51
|
return "";
|
|
23
|
-
|
|
24
|
-
let
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
52
|
+
t.field && t[`_${t.field}`] && (t._value = t[`_${t.field}`]), !t.field && t.category && (t.field = t.category);
|
|
53
|
+
let e = i ? w(r, t) : w(r, t).replace(/(?:\r\n|\r|\n)/g, "<br>");
|
|
54
|
+
return e = p(_, e, { style: "percent" }, !0, n), e = p(x, e, { style: "decimal" }, !1, n), e = p(
|
|
55
|
+
L,
|
|
56
|
+
e,
|
|
28
57
|
{ notation: "compact" },
|
|
29
58
|
!1,
|
|
30
59
|
n
|
|
31
|
-
),
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
), e;
|
|
61
|
+
}, B = ({ tooltip: r, d: t, intl: n, tooltipEnableMarkdown: i }) => {
|
|
62
|
+
let e = "";
|
|
63
|
+
if (t && r) {
|
|
64
|
+
const l = t.datum || t.point || t, { data: o } = l || {};
|
|
65
|
+
if (o) {
|
|
66
|
+
const c = t.value || (t.datum ? t.datum.value : null) || (t.point ? t.point.data.y : null);
|
|
67
|
+
let a;
|
|
68
|
+
o.variables ? a = typeof o.variables[t.id] == "object" ? o.variables[t.id] : o.variables : a = o;
|
|
69
|
+
const m = {
|
|
70
|
+
field: t.point ? t.point.serieId : t.id || "",
|
|
71
|
+
...a,
|
|
72
|
+
value: c
|
|
73
|
+
};
|
|
74
|
+
o.measureFieldName && o.variables && (m.populationValue = o.variables[o.measureFieldName + "Population"]), e = S(r, m, n, i);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const s = I([e, i]);
|
|
78
|
+
return e ? i ? /* @__PURE__ */ u("div", { ref: s, className: "chart tooltip", children: /* @__PURE__ */ u(
|
|
79
|
+
F,
|
|
80
|
+
{
|
|
81
|
+
children: e,
|
|
82
|
+
remarkPlugins: [R],
|
|
83
|
+
rehypePlugins: [T]
|
|
84
|
+
}
|
|
85
|
+
) }) : /* @__PURE__ */ u("div", { ref: s, className: "chart tooltip", children: /* @__PURE__ */ u("div", { dangerouslySetInnerHTML: { __html: e } }) }) : /* @__PURE__ */ u("div", {});
|
|
56
86
|
};
|
|
57
87
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
88
|
+
y as clampTooltipToViewport,
|
|
89
|
+
B as default,
|
|
90
|
+
S as formatContent,
|
|
91
|
+
I as useClampTooltipToViewport
|
|
60
92
|
};
|
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
import g from "react-markdown";
|
|
4
|
+
import y from "remark-gfm";
|
|
5
|
+
import x from "rehype-raw";
|
|
6
|
+
import v from "string-template";
|
|
7
|
+
import { useClampTooltipToViewport as F } from "../chart/Tooltip.js";
|
|
8
|
+
const N = /(\+?\%)[\(]([A-z0-9,.,-]+)\)/gi, A = /(\+?\#)[\(]([A-z0-9,.,-]+)\)/gi, C = /(\+?\#C)[\(]([A-z0-9,.,-]+)\)/gi, u = (n, t, a, i, e, r) => {
|
|
9
|
+
let s, o = t;
|
|
10
|
+
for (; (s = n.exec(t)) !== null; ) {
|
|
11
|
+
const m = s[2], p = s[1], d = ((f, h = 2) => e.formatNumber(i ? f / 100 : f, {
|
|
12
|
+
maximumFractionDigits: h,
|
|
12
13
|
...a,
|
|
13
|
-
signDisplay:
|
|
14
|
-
})).apply(void 0,
|
|
15
|
-
|
|
14
|
+
signDisplay: p && p.startsWith("+") ? "never" : "auto"
|
|
15
|
+
})).apply(void 0, m.split(","));
|
|
16
|
+
o = o.replaceAll(s[0], d);
|
|
16
17
|
}
|
|
17
|
-
return
|
|
18
|
-
},
|
|
19
|
-
let e =
|
|
20
|
-
return e =
|
|
21
|
-
},
|
|
22
|
-
const { color: e, data: r } = t.datum || t.point || t,
|
|
18
|
+
return o;
|
|
19
|
+
}, T = (n, t, a, i) => {
|
|
20
|
+
let e = i ? v(n, t) : v(n, t).replace(/(?:\r\n|\r|\n)/g, "<br>");
|
|
21
|
+
return e = u(N, e, { style: "percent" }, !0, a), e = u(A, e, { style: "decimal" }, !1, a), e = u(C, e, { notation: "compact" }, !1, a), e;
|
|
22
|
+
}, V = ({ tooltip: n, d: t, intl: a, tooltipEnableMarkdown: i }) => {
|
|
23
|
+
const { color: e, data: r } = t.datum || t.point || t, s = t.value || (t.datum ? t.datum.value : null) || (t.point ? t.point.data.y : null);
|
|
24
|
+
let o = "";
|
|
23
25
|
if (r) {
|
|
24
|
-
const
|
|
25
|
-
r.measureFieldName && (c.populationValue = r.variables[r.measureFieldName + "Population"]);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
return /* @__PURE__ */ m("div", {});
|
|
26
|
+
const p = r.variables ? r.variables[t.id] || r.variables : r, c = { field: t.point ? t.point.serieId : t.id, ...p, value: s };
|
|
27
|
+
r.measureFieldName && (c.populationValue = r.variables[r.measureFieldName + "Population"]), o = T(n, c, a, i);
|
|
28
|
+
}
|
|
29
|
+
const m = F([o, i]);
|
|
30
|
+
return r ? i ? /* @__PURE__ */ l("div", { ref: m, className: "chart tooltip", children: /* @__PURE__ */ l(g, { children: o, remarkPlugins: [y], rehypePlugins: [x] }) }) : /* @__PURE__ */ l("div", { ref: m, className: "chart tooltip", children: /* @__PURE__ */ l("div", { dangerouslySetInnerHTML: { __html: o } }) }) : /* @__PURE__ */ l("div", {});
|
|
30
31
|
};
|
|
31
32
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
V as default,
|
|
34
|
+
T as formatContent
|
|
34
35
|
};
|