@validationcloud/fractal-ui 1.76.0 → 1.78.0
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/README.md +22 -0
- package/dist/charts.d.ts +2 -0
- package/dist/charts.js +29 -20
- package/dist/components/dropdown-menu/dropdown-menu.js +34 -26
- package/dist/components/echarts-renderer/geo/africa-countries.json.d.ts +2463 -0
- package/dist/components/echarts-renderer/geo/africa-countries.json.js +9 -0
- package/dist/components/echarts-renderer/geo/americas-countries.json.d.ts +4160 -0
- package/dist/components/echarts-renderer/geo/americas-countries.json.js +9 -0
- package/dist/components/echarts-renderer/geo/asia-countries.json.d.ts +4275 -0
- package/dist/components/echarts-renderer/geo/asia-countries.json.js +9 -0
- package/dist/components/echarts-renderer/geo/europe-countries.json.d.ts +2407 -0
- package/dist/components/echarts-renderer/geo/europe-countries.json.js +9 -0
- package/dist/components/echarts-renderer/geo/us-states.json.d.ts +1338 -0
- package/dist/components/echarts-renderer/geo/us-states.json.js +9 -0
- package/dist/components/echarts-renderer/geo/world-continents.json.d.ts +10639 -0
- package/dist/components/echarts-renderer/geo/world-continents.json.js +9 -0
- package/dist/components/echarts-renderer/geo/world-countries.json.d.ts +14549 -0
- package/dist/components/echarts-renderer/geo/world-countries.json.js +9 -0
- package/dist/components/echarts-renderer/geo/world-regions.json.d.ts +10621 -0
- package/dist/components/echarts-renderer/geo/world-regions.json.js +9 -0
- package/dist/components/echarts-renderer/map-centers.d.ts +2 -0
- package/dist/components/echarts-renderer/map-centers.js +13 -0
- package/dist/components/echarts-renderer/map-style.d.ts +12 -0
- package/dist/components/echarts-renderer/map-style.js +12 -0
- package/dist/components/echarts-renderer/natural-earth-projection.d.ts +29 -0
- package/dist/components/echarts-renderer/natural-earth-projection.js +64 -0
- package/dist/components/echarts-renderer/register-map.d.ts +24 -0
- package/dist/components/echarts-renderer/register-map.js +62 -0
- package/dist/components/echarts-renderer/use-chart-instance.js +38 -36
- package/dist/components/icon/icon-ids.d.ts +1 -1
- package/dist/components/mount-svg-sprite/mount-svg-sprite.js +1 -1
- package/dist/hooks/use-scroll-to-bottom.d.ts +4 -3
- package/dist/lib/render-chart-to-image.js +72 -43
- package/dist/maps.json +438 -0
- package/package.json +19 -4
|
@@ -1,56 +1,58 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useRef as
|
|
2
|
+
import { useRef as f, useState as T, useEffect as I, useCallback as S } from "react";
|
|
3
3
|
import { calculateTitleLayout as m } from "./calculate-title-layout.js";
|
|
4
4
|
import { replaceFormatterTokens as O } from "./formatters/replace-formatter-tokens.js";
|
|
5
5
|
import { mergeThemeGraphicIntoOptions as R } from "./merge-theme-graphic-into-options.js";
|
|
6
|
+
import { getRequiredMapName as j, registerMapAsync as x } from "./register-map.js";
|
|
6
7
|
import { sanitizeChartOptions as w } from "./sanitize-chart-options.js";
|
|
7
8
|
const W = /* @__PURE__ */ new Set();
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
y.current =
|
|
11
|
-
const s =
|
|
9
|
+
function B({ options: i, theme: t }) {
|
|
10
|
+
const e = f(null), o = f(null), y = f(i), C = f(t?.config), z = f(t?.config.graphic), [b, v] = T(!1);
|
|
11
|
+
y.current = i, C.current = t?.config, z.current = t?.config.graphic, I(() => {
|
|
12
|
+
const s = e.current;
|
|
12
13
|
if (!s) return;
|
|
13
|
-
let r = !0,
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
const p =
|
|
18
|
-
|
|
14
|
+
let r = !0, n;
|
|
15
|
+
const d = new ResizeObserver((c) => {
|
|
16
|
+
const u = c[0], a = o.current;
|
|
17
|
+
if (!u || !a) return;
|
|
18
|
+
const p = u.contentRect.width, g = w(y.current), l = O(g), h = m(l, p, C.current);
|
|
19
|
+
a.setOption(R(h, z.current), {
|
|
19
20
|
replaceMerge: ["graphic"]
|
|
20
|
-
}),
|
|
21
|
+
}), a.resize();
|
|
21
22
|
});
|
|
22
|
-
return
|
|
23
|
+
return d.observe(s), (async () => {
|
|
23
24
|
try {
|
|
24
|
-
const
|
|
25
|
-
if (!r || !
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const c = await import("echarts");
|
|
26
|
+
if (!r || !e.current) return;
|
|
27
|
+
const u = j(i);
|
|
28
|
+
if (u && await x(c, u), t && !W.has(t.name)) {
|
|
29
|
+
const { graphic: F, ...M } = t.config;
|
|
30
|
+
c.registerTheme(t.name, M), W.add(t.name);
|
|
29
31
|
}
|
|
30
|
-
const a =
|
|
31
|
-
a && a.dispose(),
|
|
32
|
+
const a = c.getInstanceByDom(e.current);
|
|
33
|
+
a && a.dispose(), n = c.init(e.current, t?.name, {
|
|
32
34
|
renderer: "svg"
|
|
33
|
-
}),
|
|
34
|
-
const
|
|
35
|
-
|
|
35
|
+
}), o.current = n;
|
|
36
|
+
const p = e.current.clientWidth, g = w(i), l = O(g), h = m(l, p, t?.config);
|
|
37
|
+
n.setOption(R(h, t?.config.graphic), {
|
|
36
38
|
replaceMerge: ["graphic"]
|
|
37
|
-
}),
|
|
38
|
-
} catch (
|
|
39
|
-
console.error("Failed to load echarts",
|
|
39
|
+
}), n.resize(), v(!0);
|
|
40
|
+
} catch (c) {
|
|
41
|
+
console.error("Failed to load echarts", c);
|
|
40
42
|
}
|
|
41
43
|
})(), () => {
|
|
42
|
-
r = !1,
|
|
44
|
+
r = !1, d.disconnect(), n && n.dispose(), o.current = null, v(!1);
|
|
43
45
|
};
|
|
44
|
-
}, [t,
|
|
45
|
-
if (!b || !
|
|
46
|
-
const s =
|
|
47
|
-
|
|
46
|
+
}, [t, i]), I(() => {
|
|
47
|
+
if (!b || !o.current || !e.current) return;
|
|
48
|
+
const s = e.current.clientWidth, r = w(i), n = O(r), d = m(n, s, t?.config);
|
|
49
|
+
o.current.setOption(R(d, t?.config.graphic), {
|
|
48
50
|
replaceMerge: ["graphic"]
|
|
49
51
|
});
|
|
50
|
-
}, [b,
|
|
52
|
+
}, [b, i, t?.config, t?.config.graphic]);
|
|
51
53
|
const k = S(async () => {
|
|
52
|
-
if (!
|
|
53
|
-
const s =
|
|
54
|
+
if (!o.current) return;
|
|
55
|
+
const s = o.current.getDataURL({
|
|
54
56
|
type: "png",
|
|
55
57
|
pixelRatio: 2,
|
|
56
58
|
backgroundColor: "#fff"
|
|
@@ -58,10 +60,10 @@ function L({ options: o, theme: t }) {
|
|
|
58
60
|
r.download = `chart-${(/* @__PURE__ */ new Date()).toISOString()}.png`, r.href = s, document.body.appendChild(r), r.click(), document.body.removeChild(r);
|
|
59
61
|
}, []);
|
|
60
62
|
return {
|
|
61
|
-
containerRef:
|
|
63
|
+
containerRef: e,
|
|
62
64
|
downloadChart: k
|
|
63
65
|
};
|
|
64
66
|
}
|
|
65
67
|
export {
|
|
66
|
-
|
|
68
|
+
B as useChartInstance
|
|
67
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const iconIds: readonly ["arrow-narrow", "arrow", "banknote", "bar-chart", "billing", "bracket", "check", "chevron-vertical", "chevron", "circle-fill", "circle-stroke", "clock", "close", "cog", "collapse", "copy", "documents", "download", "edit", "enter", "exclamation", "expand", "faucet", "fire", "key", "filter", "help-center", "home", "info", "intercom", "link", "logout", "menu", "more", "minus", "node", "patch", "pin", "plus", "processing", "radio-empty", "radio-full", "resize", "search", "share", "sparkles", "step-indicator", "subgraphs", "sync-problem", "trash", "thumb", "unpin", "user", "wallet", "wallet-connected", "wallet-disconnected", "wrench"];
|
|
1
|
+
export declare const iconIds: readonly ["arrow-narrow", "arrow", "banknote", "bar-chart", "billing", "bracket", "check", "chevron-vertical", "chevron", "circle-fill", "circle-stroke", "clock", "close", "cog", "collapse", "copy", "documents", "download", "edit", "enter", "exclamation", "expand", "faucet", "fire", "key", "filter", "help-center", "home", "info", "intercom", "link", "logout", "menu", "more", "minus", "node", "patch", "pin", "plus", "processing", "radio-empty", "radio-full", "resize", "search", "share", "sparkles", "step-indicator", "subgraphs", "sync-problem", "team", "trash", "thumb", "unpin", "user", "wallet", "wallet-connected", "wallet-disconnected", "wrench"];
|