@ztwoint/z-ui 0.1.121 → 0.1.123
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/components/chart-card/builders/bar-chart-builder.d.ts +1 -1
- package/dist/components/chart-card/builders/bar-chart-builder.js +78 -31
- package/dist/components/chart-card/builders/chart-builder-factory.d.ts +1 -1
- package/dist/components/chart-card/builders/chart-builder-factory.js +15 -15
- package/dist/components/chart-card/builders/line-chart-builder.d.ts +1 -1
- package/dist/components/chart-card/builders/line-chart-builder.js +85 -38
- package/dist/components/chart-card/builders/pie-chart-builder.d.ts +1 -1
- package/dist/components/chart-card/builders/pie-chart-builder.js +37 -34
- package/dist/components/chart-card/chart-card.config.types.d.ts +27 -0
- package/dist/components/chart-card/chart-card.d.ts +1 -1
- package/dist/components/chart-card/chart-card.js +25 -23
- package/dist/components/chart-card/chart-card.types.d.ts +2 -0
- package/dist/components/chart-card/config/defaults.d.ts +28 -0
- package/dist/components/chart-card/config/defaults.js +105 -88
- package/dist/components/table/components/cell/avatar-cell.js +13 -6
- package/dist/components/table/table-provider.js +7 -0
- package/dist/components/table-card/table-card.js +52 -45
- package/dist/components/z2map/components/index.d.ts +5 -0
- package/dist/components/z2map/components/map-controls.d.ts +12 -0
- package/dist/components/z2map/components/map-controls.js +29 -0
- package/dist/components/z2map/components/map-empty-state.d.ts +2 -0
- package/dist/components/z2map/components/map-empty-state.js +10 -0
- package/dist/components/z2map/components/map-loading-state.d.ts +8 -0
- package/dist/components/z2map/components/map-loading-state.js +45 -0
- package/dist/components/z2map/components/map-pin-content.d.ts +8 -0
- package/dist/components/z2map/components/map-pin-content.js +27 -0
- package/dist/components/z2map/components/map-pin.d.ts +19 -0
- package/dist/components/z2map/components/map-pin.js +116 -0
- package/dist/components/z2map/components/map-style-control.d.ts +8 -0
- package/dist/components/z2map/components/map-style-control.js +45 -0
- package/dist/components/z2map/components/map-zoom-control.d.ts +8 -0
- package/dist/components/z2map/components/map-zoom-control.js +49 -0
- package/dist/components/z2map/index.d.ts +9 -0
- package/dist/components/z2map/map.constants.d.ts +47 -0
- package/dist/components/z2map/map.constants.js +40 -0
- package/dist/components/z2map/map.d.ts +4 -0
- package/dist/components/z2map/map.hook.d.ts +33 -0
- package/dist/components/z2map/map.hook.js +99 -0
- package/dist/components/z2map/map.js +161 -0
- package/dist/components/z2map/map.type.d.ts +45 -0
- package/dist/components/z2map/map.utils.d.ts +10 -0
- package/dist/components/z2map/map.utils.js +37 -0
- package/dist/css/node_modules/mapbox-gl/dist/mapbox-gl.css +1 -0
- package/dist/css/styles/tailwind.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +128 -112
- package/dist/node_modules/@vis.gl/react-mapbox/dist/components/attribution-control.js +12 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/components/fullscreen-control.js +12 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/components/geolocate-control.js +30 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/components/map.js +54 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/components/marker.js +56 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/components/navigation-control.js +12 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/components/popup.js +35 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/components/scale-control.js +14 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/components/use-control.js +14 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/components/use-map.js +6 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/mapbox/create-ref.js +77 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/mapbox/mapbox.js +315 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/mapbox/proxy-transform.js +35 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/utils/apply-react-style.js +13 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/utils/compare-class-names.js +16 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/utils/deep-equal.js +33 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/utils/set-globals.js +18 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/utils/style-utils.js +25 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/utils/transform.js +40 -0
- package/dist/node_modules/@vis.gl/react-mapbox/dist/utils/use-isomorphic-layout-effect.js +5 -0
- package/dist/routes/map.d.ts +2 -0
- package/dist/types/components/chart-card/builders/bar-chart-builder.d.ts +1 -1
- package/dist/types/components/chart-card/builders/chart-builder-factory.d.ts +1 -1
- package/dist/types/components/chart-card/builders/line-chart-builder.d.ts +1 -1
- package/dist/types/components/chart-card/builders/pie-chart-builder.d.ts +1 -1
- package/dist/types/components/chart-card/chart-card.config.types.d.ts +27 -0
- package/dist/types/components/chart-card/chart-card.d.ts +1 -1
- package/dist/types/components/chart-card/chart-card.types.d.ts +2 -0
- package/dist/types/components/chart-card/config/defaults.d.ts +28 -0
- package/dist/types/components/z2map/components/index.d.ts +5 -0
- package/dist/types/components/z2map/components/map-controls.d.ts +12 -0
- package/dist/types/components/z2map/components/map-empty-state.d.ts +2 -0
- package/dist/types/components/z2map/components/map-loading-state.d.ts +8 -0
- package/dist/types/components/z2map/components/map-pin-content.d.ts +8 -0
- package/dist/types/components/z2map/components/map-pin.d.ts +19 -0
- package/dist/types/components/z2map/components/map-style-control.d.ts +8 -0
- package/dist/types/components/z2map/components/map-zoom-control.d.ts +8 -0
- package/dist/types/components/z2map/index.d.ts +9 -0
- package/dist/types/components/z2map/map.constants.d.ts +47 -0
- package/dist/types/components/z2map/map.d.ts +5 -0
- package/dist/types/components/z2map/map.hook.d.ts +33 -0
- package/dist/types/components/z2map/map.type.d.ts +45 -0
- package/dist/types/components/z2map/map.utils.d.ts +10 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/routes/map.d.ts +2 -0
- package/package.json +6 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { EChartsOption } from 'echarts';
|
|
2
2
|
import { BarChartConfig, ChartData } from '../chart-card.config.types';
|
|
3
|
-
export declare function buildBarChartOptions(config: BarChartConfig, data: ChartData): EChartsOption;
|
|
3
|
+
export declare function buildBarChartOptions(config: BarChartConfig, data: ChartData, scrollable?: boolean, scrollableLegend?: boolean): EChartsOption;
|
|
@@ -1,43 +1,90 @@
|
|
|
1
|
-
import { buildYAxisConfig as
|
|
2
|
-
import { getThemePalette as
|
|
3
|
-
function
|
|
4
|
-
var
|
|
5
|
-
const
|
|
1
|
+
import { buildYAxisConfig as B, buildXAxisConfig as T, buildGridConfig as I, buildLegendConfig as V, buildTooltipConfig as L, buildTitleConfig as P } from "../config/defaults.js";
|
|
2
|
+
import { getThemePalette as W } from "../config/colors.js";
|
|
3
|
+
function G(t, d, o, u) {
|
|
4
|
+
var h, f, m, g, v, x, C, S, y, w, A, k, D, M, z;
|
|
5
|
+
const a = W("bar", t.theme), r = d.series.map((H) => H.name), i = !!t.name, e = r.length > 1, n = ((f = (h = t.options) == null ? void 0 : h.legend) == null ? void 0 : f.position) ?? "top";
|
|
6
6
|
return {
|
|
7
|
-
color:
|
|
8
|
-
title:
|
|
9
|
-
tooltip:
|
|
10
|
-
legend:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
color: a,
|
|
8
|
+
title: i ? P(t.name, (m = t.options) == null ? void 0 : m.title) : void 0,
|
|
9
|
+
tooltip: L((g = t.options) == null ? void 0 : g.tooltip),
|
|
10
|
+
legend: e ? V(r, i, {
|
|
11
|
+
...(v = t.options) == null ? void 0 : v.legend,
|
|
12
|
+
scrollable: u || ((C = (x = t.options) == null ? void 0 : x.legend) == null ? void 0 : C.scrollable)
|
|
13
|
+
}) : void 0,
|
|
14
|
+
grid: I(i, e, n, (S = t.options) == null ? void 0 : S.grid),
|
|
15
|
+
xAxis: T(d.labels, !0, (y = t.options) == null ? void 0 : y.xAxis),
|
|
16
|
+
yAxis: B((w = t.options) == null ? void 0 : w.yAxis),
|
|
17
|
+
series: X(t, d),
|
|
18
|
+
animation: ((k = (A = t.options) == null ? void 0 : A.animation) == null ? void 0 : k.enabled) ?? !0,
|
|
19
|
+
animationDuration: ((M = (D = t.options) == null ? void 0 : D.animation) == null ? void 0 : M.duration) ?? 1e3,
|
|
20
|
+
...o ? Y((z = t.options) == null ? void 0 : z.scrollable) : {}
|
|
17
21
|
};
|
|
18
22
|
}
|
|
19
|
-
function
|
|
20
|
-
var
|
|
21
|
-
const
|
|
22
|
-
return
|
|
23
|
-
const
|
|
24
|
-
...
|
|
25
|
-
...
|
|
26
|
-
},
|
|
27
|
-
name:
|
|
23
|
+
function X(t, d) {
|
|
24
|
+
var i, e;
|
|
25
|
+
const u = t.theme === "stacked" && d.series.length > 1 ? "total" : void 0, a = ((i = t.options) == null ? void 0 : i.seriesStyles) ?? {}, r = ((e = t.options) == null ? void 0 : e.defaultSeriesStyle) ?? {};
|
|
26
|
+
return d.series.map((n) => {
|
|
27
|
+
const h = {
|
|
28
|
+
...r,
|
|
29
|
+
...a[n.name] ?? {}
|
|
30
|
+
}, f = h.barWidth ?? 40, m = {
|
|
31
|
+
name: n.name,
|
|
28
32
|
type: "bar",
|
|
29
|
-
stack:
|
|
33
|
+
stack: u,
|
|
30
34
|
emphasis: {
|
|
31
35
|
focus: "series"
|
|
32
36
|
},
|
|
33
|
-
barMaxWidth:
|
|
34
|
-
data:
|
|
37
|
+
barMaxWidth: f,
|
|
38
|
+
data: n.values
|
|
35
39
|
};
|
|
36
|
-
return
|
|
37
|
-
color:
|
|
38
|
-
}),
|
|
40
|
+
return h.color && (m.itemStyle = {
|
|
41
|
+
color: h.color
|
|
42
|
+
}), m;
|
|
39
43
|
});
|
|
40
44
|
}
|
|
45
|
+
function Y(t) {
|
|
46
|
+
const d = [], o = (t == null ? void 0 : t.type) ?? "both", u = (t == null ? void 0 : t.start) ?? 0, a = (t == null ? void 0 : t.end) ?? 20, r = (t == null ? void 0 : t.height) ?? 20, i = (t == null ? void 0 : t.width) ?? 20, e = (t == null ? void 0 : t.position) ?? "bottom", n = (t == null ? void 0 : t.showDetail) ?? !1, h = (t == null ? void 0 : t.showDataShadow) ?? !1, f = (t == null ? void 0 : t.realtime) ?? !0, m = (t == null ? void 0 : t.filterMode) ?? "filter", g = (t == null ? void 0 : t.xAxisIndex) ?? [0];
|
|
47
|
+
return (o === "slider" || o === "both") && d.push({
|
|
48
|
+
type: "slider",
|
|
49
|
+
show: !0,
|
|
50
|
+
xAxisIndex: g,
|
|
51
|
+
start: u,
|
|
52
|
+
end: a,
|
|
53
|
+
height: e === "bottom" ? r : void 0,
|
|
54
|
+
width: e === "right" ? i : void 0,
|
|
55
|
+
bottom: e === "bottom" ? 10 : void 0,
|
|
56
|
+
top: e === "top" ? 10 : void 0,
|
|
57
|
+
right: e === "right" ? 10 : void 0,
|
|
58
|
+
left: e === "left" ? 10 : void 0,
|
|
59
|
+
showDetail: n,
|
|
60
|
+
showDataShadow: h,
|
|
61
|
+
realtime: f,
|
|
62
|
+
filterMode: m,
|
|
63
|
+
handleIcon: "M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z",
|
|
64
|
+
handleSize: "80%",
|
|
65
|
+
handleStyle: {
|
|
66
|
+
color: "#fff",
|
|
67
|
+
shadowBlur: 3,
|
|
68
|
+
shadowColor: "rgba(0, 0, 0, 0.6)",
|
|
69
|
+
shadowOffsetX: 2,
|
|
70
|
+
shadowOffsetY: 2
|
|
71
|
+
},
|
|
72
|
+
textStyle: {
|
|
73
|
+
color: "#333"
|
|
74
|
+
},
|
|
75
|
+
borderColor: "#90979c",
|
|
76
|
+
fillerColor: "rgba(144, 151, 156, 0.2)",
|
|
77
|
+
backgroundColor: "rgba(17, 17, 17, 0.1)",
|
|
78
|
+
selectedDataBackgroundColor: "rgba(0, 0, 0, 0.3)",
|
|
79
|
+
moveHandleColor: "#fff",
|
|
80
|
+
moveHandleSize: 7
|
|
81
|
+
}), (o === "inside" || o === "both") && d.push({
|
|
82
|
+
type: "inside",
|
|
83
|
+
xAxisIndex: g,
|
|
84
|
+
start: u,
|
|
85
|
+
end: a
|
|
86
|
+
}), { dataZoom: d };
|
|
87
|
+
}
|
|
41
88
|
export {
|
|
42
|
-
|
|
89
|
+
G as buildBarChartOptions
|
|
43
90
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EChartsOption } from 'echarts';
|
|
2
2
|
import { ChartConfig, ChartData, ChartType } from '../chart-card.config.types';
|
|
3
|
-
export declare function buildChartOptions(config: ChartConfig, data: ChartData): EChartsOption;
|
|
3
|
+
export declare function buildChartOptions(config: ChartConfig, data: ChartData, scrollable?: boolean, scrollableLegend?: boolean): EChartsOption;
|
|
4
4
|
export declare function isChartTypeSupported(type: string): type is ChartType;
|
|
5
5
|
export declare const registeredChartTypes: readonly ChartType[];
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { buildBarChartOptions as
|
|
2
|
-
import { buildLineChartOptions as
|
|
3
|
-
import { buildPieChartOptions as
|
|
4
|
-
const
|
|
5
|
-
line:
|
|
6
|
-
bar:
|
|
7
|
-
pie:
|
|
1
|
+
import { buildBarChartOptions as p } from "./bar-chart-builder.js";
|
|
2
|
+
import { buildLineChartOptions as n } from "./line-chart-builder.js";
|
|
3
|
+
import { buildPieChartOptions as a } from "./pie-chart-builder.js";
|
|
4
|
+
const s = {
|
|
5
|
+
line: n,
|
|
6
|
+
bar: p,
|
|
7
|
+
pie: a
|
|
8
8
|
};
|
|
9
|
-
function
|
|
10
|
-
const t =
|
|
9
|
+
function h(r, i, e, o) {
|
|
10
|
+
const t = s[r.type];
|
|
11
11
|
if (!t)
|
|
12
12
|
throw new Error(`Unsupported chart type: ${r.type}`);
|
|
13
|
-
return t(r, i);
|
|
13
|
+
return t(r, i, e, o);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function l(r) {
|
|
16
16
|
return r === "line" || r === "bar" || r === "pie";
|
|
17
17
|
}
|
|
18
|
-
const
|
|
18
|
+
const m = ["line", "bar", "pie"];
|
|
19
19
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
h as buildChartOptions,
|
|
21
|
+
l as isChartTypeSupported,
|
|
22
|
+
m as registeredChartTypes
|
|
23
23
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { EChartsOption } from 'echarts';
|
|
2
2
|
import { ChartData, LineChartConfig } from '../chart-card.config.types';
|
|
3
|
-
export declare function buildLineChartOptions(config: LineChartConfig, data: ChartData): EChartsOption;
|
|
3
|
+
export declare function buildLineChartOptions(config: LineChartConfig, data: ChartData, scrollable?: boolean, scrollableLegend?: boolean): EChartsOption;
|
|
@@ -1,53 +1,100 @@
|
|
|
1
|
-
import { buildYAxisConfig as
|
|
2
|
-
import { getThemePalette as
|
|
3
|
-
function
|
|
4
|
-
var
|
|
5
|
-
const
|
|
1
|
+
import { buildYAxisConfig as B, buildXAxisConfig as I, buildGridConfig as L, buildLegendConfig as V, buildTooltipConfig as k, buildTitleConfig as P } from "../config/defaults.js";
|
|
2
|
+
import { getThemePalette as W } from "../config/colors.js";
|
|
3
|
+
function G(t, o, d, y) {
|
|
4
|
+
var S, r, u, g, n, w, v, x, C, A, s, z, D, H, M;
|
|
5
|
+
const f = W("line", t.theme), m = o.series.map((T) => T.name), h = !!t.name, e = m.length > 1, i = ((r = (S = t.options) == null ? void 0 : S.legend) == null ? void 0 : r.position) ?? "top";
|
|
6
6
|
return {
|
|
7
|
-
color:
|
|
8
|
-
title:
|
|
9
|
-
tooltip:
|
|
10
|
-
legend:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
color: f,
|
|
8
|
+
title: h ? P(t.name, (u = t.options) == null ? void 0 : u.title) : void 0,
|
|
9
|
+
tooltip: k((g = t.options) == null ? void 0 : g.tooltip),
|
|
10
|
+
legend: e ? V(m, h, {
|
|
11
|
+
...(n = t.options) == null ? void 0 : n.legend,
|
|
12
|
+
scrollable: y || ((v = (w = t.options) == null ? void 0 : w.legend) == null ? void 0 : v.scrollable)
|
|
13
|
+
}) : void 0,
|
|
14
|
+
grid: L(h, e, i, (x = t.options) == null ? void 0 : x.grid),
|
|
15
|
+
xAxis: I(o.labels, !1, (C = t.options) == null ? void 0 : C.xAxis),
|
|
16
|
+
yAxis: B((A = t.options) == null ? void 0 : A.yAxis),
|
|
17
|
+
series: X(t, o),
|
|
18
|
+
animation: ((z = (s = t.options) == null ? void 0 : s.animation) == null ? void 0 : z.enabled) ?? !0,
|
|
19
|
+
animationDuration: ((H = (D = t.options) == null ? void 0 : D.animation) == null ? void 0 : H.duration) ?? 1e3,
|
|
20
|
+
...d ? Y((M = t.options) == null ? void 0 : M.scrollable) : {}
|
|
17
21
|
};
|
|
18
22
|
}
|
|
19
|
-
function
|
|
20
|
-
var
|
|
21
|
-
const
|
|
22
|
-
return
|
|
23
|
-
const
|
|
24
|
-
...
|
|
25
|
-
...
|
|
26
|
-
},
|
|
27
|
-
name:
|
|
23
|
+
function X(t, o) {
|
|
24
|
+
var m, h;
|
|
25
|
+
const d = t.theme === "smooth", y = ((m = t.options) == null ? void 0 : m.seriesStyles) ?? {}, f = ((h = t.options) == null ? void 0 : h.defaultSeriesStyle) ?? {};
|
|
26
|
+
return o.series.map((e) => {
|
|
27
|
+
const i = {
|
|
28
|
+
...f,
|
|
29
|
+
...y[e.name] ?? {}
|
|
30
|
+
}, a = i.smooth ?? d, S = i.lineWidth ?? 2, r = i.pointSize ?? (o.labels.length <= 12 ? 4 : 0), u = i.areaStyle ?? !1, g = i.opacity ?? 0.15, n = {
|
|
31
|
+
name: e.name,
|
|
28
32
|
type: "line",
|
|
29
|
-
smooth:
|
|
33
|
+
smooth: a,
|
|
30
34
|
symbol: "circle",
|
|
31
|
-
symbolSize:
|
|
32
|
-
showSymbol:
|
|
35
|
+
symbolSize: r,
|
|
36
|
+
showSymbol: o.labels.length <= 12,
|
|
33
37
|
emphasis: {
|
|
34
38
|
focus: "series"
|
|
35
39
|
},
|
|
36
40
|
lineStyle: {
|
|
37
|
-
width:
|
|
41
|
+
width: S
|
|
38
42
|
},
|
|
39
|
-
data:
|
|
43
|
+
data: e.values
|
|
40
44
|
};
|
|
41
|
-
return
|
|
42
|
-
color:
|
|
43
|
-
},
|
|
44
|
-
...
|
|
45
|
-
color:
|
|
46
|
-
}), u && (
|
|
47
|
-
opacity:
|
|
48
|
-
}),
|
|
45
|
+
return i.color && (n.itemStyle = {
|
|
46
|
+
color: i.color
|
|
47
|
+
}, n.lineStyle = {
|
|
48
|
+
...n.lineStyle,
|
|
49
|
+
color: i.color
|
|
50
|
+
}), u && (n.areaStyle = {
|
|
51
|
+
opacity: g
|
|
52
|
+
}), n;
|
|
49
53
|
});
|
|
50
54
|
}
|
|
55
|
+
function Y(t) {
|
|
56
|
+
const o = [], d = (t == null ? void 0 : t.type) ?? "both", y = (t == null ? void 0 : t.start) ?? 0, f = (t == null ? void 0 : t.end) ?? 20, m = (t == null ? void 0 : t.height) ?? 20, h = (t == null ? void 0 : t.width) ?? 20, e = (t == null ? void 0 : t.position) ?? "bottom", i = (t == null ? void 0 : t.showDetail) ?? !1, a = (t == null ? void 0 : t.showDataShadow) ?? !1, S = (t == null ? void 0 : t.realtime) ?? !0, r = (t == null ? void 0 : t.filterMode) ?? "filter", u = (t == null ? void 0 : t.xAxisIndex) ?? [0];
|
|
57
|
+
return (d === "slider" || d === "both") && o.push({
|
|
58
|
+
type: "slider",
|
|
59
|
+
show: !0,
|
|
60
|
+
xAxisIndex: u,
|
|
61
|
+
start: y,
|
|
62
|
+
end: f,
|
|
63
|
+
height: e === "bottom" ? m : void 0,
|
|
64
|
+
width: e === "right" ? h : void 0,
|
|
65
|
+
bottom: e === "bottom" ? 10 : void 0,
|
|
66
|
+
top: e === "top" ? 10 : void 0,
|
|
67
|
+
right: e === "right" ? 10 : void 0,
|
|
68
|
+
left: e === "left" ? 10 : void 0,
|
|
69
|
+
showDetail: i,
|
|
70
|
+
showDataShadow: a,
|
|
71
|
+
realtime: S,
|
|
72
|
+
filterMode: r,
|
|
73
|
+
handleIcon: "M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z",
|
|
74
|
+
handleSize: "80%",
|
|
75
|
+
handleStyle: {
|
|
76
|
+
color: "#fff",
|
|
77
|
+
shadowBlur: 3,
|
|
78
|
+
shadowColor: "rgba(0, 0, 0, 0.6)",
|
|
79
|
+
shadowOffsetX: 2,
|
|
80
|
+
shadowOffsetY: 2
|
|
81
|
+
},
|
|
82
|
+
textStyle: {
|
|
83
|
+
color: "#333"
|
|
84
|
+
},
|
|
85
|
+
borderColor: "#90979c",
|
|
86
|
+
fillerColor: "rgba(144, 151, 156, 0.2)",
|
|
87
|
+
backgroundColor: "rgba(17, 17, 17, 0.1)",
|
|
88
|
+
selectedDataBackgroundColor: "rgba(0, 0, 0, 0.3)",
|
|
89
|
+
moveHandleColor: "#fff",
|
|
90
|
+
moveHandleSize: 7
|
|
91
|
+
}), (d === "inside" || d === "both") && o.push({
|
|
92
|
+
type: "inside",
|
|
93
|
+
xAxisIndex: u,
|
|
94
|
+
start: y,
|
|
95
|
+
end: f
|
|
96
|
+
}), { dataZoom: o };
|
|
97
|
+
}
|
|
51
98
|
export {
|
|
52
|
-
|
|
99
|
+
G as buildLineChartOptions
|
|
53
100
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { EChartsOption } from 'echarts';
|
|
2
2
|
import { ChartData, PieChartConfig } from '../chart-card.config.types';
|
|
3
|
-
export declare function buildPieChartOptions(config: PieChartConfig, data: ChartData): EChartsOption;
|
|
3
|
+
export declare function buildPieChartOptions(config: PieChartConfig, data: ChartData, _scrollable?: boolean, scrollableLegend?: boolean): EChartsOption;
|
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
import { buildLegendConfig as O, buildTooltipConfig as P, buildTitleConfig as T } from "../config/defaults.js";
|
|
2
2
|
import { getThemePalette as D } from "../config/colors.js";
|
|
3
|
-
function j(e,
|
|
4
|
-
var
|
|
5
|
-
const
|
|
3
|
+
function j(e, s, w, u) {
|
|
4
|
+
var p, l, c, b, h, o, a, r, d;
|
|
5
|
+
const m = D("pie", e.theme), t = s.series.map((f) => f.name), n = !!e.name, S = t.length > 1;
|
|
6
6
|
return {
|
|
7
|
-
color:
|
|
8
|
-
title:
|
|
9
|
-
tooltip: P({ ...(
|
|
10
|
-
legend:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
color: m,
|
|
8
|
+
title: n ? T(e.name, (p = e.options) == null ? void 0 : p.title) : void 0,
|
|
9
|
+
tooltip: P({ ...(l = e.options) == null ? void 0 : l.tooltip, trigger: "item" }),
|
|
10
|
+
legend: S ? O(t, n, {
|
|
11
|
+
...(c = e.options) == null ? void 0 : c.legend,
|
|
12
|
+
scrollable: u || ((h = (b = e.options) == null ? void 0 : b.legend) == null ? void 0 : h.scrollable)
|
|
13
|
+
}) : void 0,
|
|
14
|
+
series: v(e, s),
|
|
15
|
+
animation: ((a = (o = e.options) == null ? void 0 : o.animation) == null ? void 0 : a.enabled) ?? !0,
|
|
16
|
+
animationDuration: ((d = (r = e.options) == null ? void 0 : r.animation) == null ? void 0 : d.duration) ?? 1e3
|
|
14
17
|
};
|
|
15
18
|
}
|
|
16
|
-
function v(e,
|
|
17
|
-
var
|
|
18
|
-
const
|
|
19
|
-
name:
|
|
20
|
-
value:
|
|
21
|
-
}))) ?? [],
|
|
22
|
-
name: ((R =
|
|
19
|
+
function v(e, s) {
|
|
20
|
+
var r, d, f, g, R;
|
|
21
|
+
const w = e.theme === "donut", u = ((r = e.options) == null ? void 0 : r.seriesStyles) ?? {}, m = ((d = e.options) == null ? void 0 : d.defaultSeriesStyle) ?? {}, t = ((f = e.options) == null ? void 0 : f.pie) ?? {}, n = ((g = s.series[0]) == null ? void 0 : g.values.map((y, i) => ({
|
|
22
|
+
name: s.labels[i],
|
|
23
|
+
value: y
|
|
24
|
+
}))) ?? [], S = w ? ["40%", "70%"] : ["0%", "70%"], L = t.radius ?? S, p = t.center ?? ["50%", "50%"], l = t.labelPosition ?? "outside", c = t.labelRotate ?? !1, b = t.showLabel ?? !0, h = t.showLabelLine ?? !0, o = {
|
|
25
|
+
name: ((R = s.series[0]) == null ? void 0 : R.name) ?? "Data",
|
|
23
26
|
type: "pie",
|
|
24
|
-
radius:
|
|
25
|
-
center:
|
|
26
|
-
data:
|
|
27
|
+
radius: L,
|
|
28
|
+
center: p,
|
|
29
|
+
data: n,
|
|
27
30
|
emphasis: {
|
|
28
31
|
focus: "self",
|
|
29
32
|
itemStyle: {
|
|
@@ -33,15 +36,15 @@ function v(e, o) {
|
|
|
33
36
|
}
|
|
34
37
|
},
|
|
35
38
|
label: {
|
|
36
|
-
show:
|
|
37
|
-
position:
|
|
38
|
-
rotate:
|
|
39
|
+
show: b,
|
|
40
|
+
position: l,
|
|
41
|
+
rotate: c,
|
|
39
42
|
formatter: "{b}: {c} ({d}%)",
|
|
40
43
|
fontSize: 12,
|
|
41
44
|
fontFamily: "Inter Variable, sans-serif"
|
|
42
45
|
},
|
|
43
46
|
labelLine: {
|
|
44
|
-
show:
|
|
47
|
+
show: h && l === "outside",
|
|
45
48
|
length: 10,
|
|
46
49
|
length2: 5
|
|
47
50
|
},
|
|
@@ -50,21 +53,21 @@ function v(e, o) {
|
|
|
50
53
|
borderWidth: 2
|
|
51
54
|
}
|
|
52
55
|
};
|
|
53
|
-
if (Object.keys(
|
|
54
|
-
const
|
|
55
|
-
...
|
|
56
|
-
...
|
|
56
|
+
if (Object.keys(u).length > 0) {
|
|
57
|
+
const y = n.map((i) => ({
|
|
58
|
+
...m,
|
|
59
|
+
...u[i.name] ?? {}
|
|
57
60
|
}).color).filter(Boolean);
|
|
58
|
-
if (
|
|
61
|
+
if (y.length > 0) {
|
|
59
62
|
const i = D("pie", e.theme);
|
|
60
|
-
|
|
61
|
-
...
|
|
62
|
-
color: (
|
|
63
|
+
o.itemStyle = {
|
|
64
|
+
...o.itemStyle,
|
|
65
|
+
color: (C) => y[C.dataIndex] || i[C.dataIndex % i.length]
|
|
63
66
|
};
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
|
-
const
|
|
67
|
-
return
|
|
69
|
+
const a = m.pieRadius;
|
|
70
|
+
return a && (o.radius = a), [o];
|
|
68
71
|
}
|
|
69
72
|
export {
|
|
70
73
|
j as buildPieChartOptions
|
|
@@ -29,6 +29,18 @@ export interface ChartOptions {
|
|
|
29
29
|
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
30
30
|
align?: 'left' | 'center' | 'right';
|
|
31
31
|
orient?: 'horizontal' | 'vertical';
|
|
32
|
+
scrollable?: boolean;
|
|
33
|
+
pageButtonItemGap?: number;
|
|
34
|
+
pageButtonGap?: number;
|
|
35
|
+
pageButtonPosition?: 'start' | 'end';
|
|
36
|
+
pageFormatter?: string;
|
|
37
|
+
pageIconColor?: string;
|
|
38
|
+
pageIconInactiveColor?: string;
|
|
39
|
+
pageIconSize?: number;
|
|
40
|
+
pageTextStyle?: {
|
|
41
|
+
color?: string;
|
|
42
|
+
fontSize?: number;
|
|
43
|
+
};
|
|
32
44
|
};
|
|
33
45
|
tooltip?: {
|
|
34
46
|
show?: boolean;
|
|
@@ -67,6 +79,21 @@ export interface ChartOptions {
|
|
|
67
79
|
showLabel?: boolean;
|
|
68
80
|
showLabelLine?: boolean;
|
|
69
81
|
};
|
|
82
|
+
scrollable?: {
|
|
83
|
+
enabled?: boolean;
|
|
84
|
+
type?: 'slider' | 'inside' | 'both';
|
|
85
|
+
start?: number;
|
|
86
|
+
end?: number;
|
|
87
|
+
height?: number;
|
|
88
|
+
width?: number;
|
|
89
|
+
position?: 'bottom' | 'top' | 'left' | 'right';
|
|
90
|
+
showDetail?: boolean;
|
|
91
|
+
showDataShadow?: boolean;
|
|
92
|
+
realtime?: boolean;
|
|
93
|
+
filterMode?: 'filter' | 'empty' | 'none';
|
|
94
|
+
xAxisIndex?: number[];
|
|
95
|
+
yAxisIndex?: number[];
|
|
96
|
+
};
|
|
70
97
|
}
|
|
71
98
|
interface BaseChartConfig {
|
|
72
99
|
name: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ChartCardProps } from './chart-card.types';
|
|
2
|
-
export declare function ChartCard({ config, data, loading, error, className, style, chartProps, }: ChartCardProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function ChartCard({ config, data, loading, error, className, style, chartProps, scrollable, scrollableLegend, }: ChartCardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,42 +1,44 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { validateChartConfig as
|
|
5
|
-
import { buildChartOptions as
|
|
6
|
-
import { Chart as
|
|
7
|
-
import { LoadingState as
|
|
8
|
-
function
|
|
2
|
+
import * as p from "react";
|
|
3
|
+
import { cn as w } from "../../lib/utils.js";
|
|
4
|
+
import { validateChartConfig as S, validateChartData as E } from "./validators/config-validator.js";
|
|
5
|
+
import { buildChartOptions as O } from "./builders/chart-builder-factory.js";
|
|
6
|
+
import { Chart as R } from "../chart/chart.js";
|
|
7
|
+
import { LoadingState as V, ErrorState as l, EmptyState as $ } from "./chart-card-states.js";
|
|
8
|
+
function D({
|
|
9
9
|
config: t,
|
|
10
10
|
data: n,
|
|
11
11
|
loading: u = !1,
|
|
12
12
|
error: m,
|
|
13
13
|
className: f,
|
|
14
14
|
style: g,
|
|
15
|
-
chartProps: e
|
|
15
|
+
chartProps: e,
|
|
16
|
+
scrollable: b = !1,
|
|
17
|
+
scrollableLegend: c = !1
|
|
16
18
|
}) {
|
|
17
|
-
const r = t.height ?? 400,
|
|
19
|
+
const r = t.height ?? 400, y = p.useMemo(() => {
|
|
18
20
|
if (!e)
|
|
19
21
|
return {};
|
|
20
|
-
const { className: s, style: i, ...
|
|
21
|
-
return
|
|
22
|
-
}, [e]),
|
|
22
|
+
const { className: s, style: i, ...v } = e;
|
|
23
|
+
return v;
|
|
24
|
+
}, [e]), C = e == null ? void 0 : e.className, N = e == null ? void 0 : e.style;
|
|
23
25
|
if (u)
|
|
24
|
-
return /* @__PURE__ */ a(
|
|
26
|
+
return /* @__PURE__ */ a(V, { height: r });
|
|
25
27
|
if (m)
|
|
26
28
|
return /* @__PURE__ */ a(l, { height: r, message: m });
|
|
27
|
-
const o =
|
|
29
|
+
const o = S(t);
|
|
28
30
|
if (!o.valid)
|
|
29
31
|
return /* @__PURE__ */ a(l, { height: r, message: o.error || "Invalid configuration" });
|
|
30
|
-
const d =
|
|
32
|
+
const d = E(n);
|
|
31
33
|
if (!d.valid)
|
|
32
34
|
return /* @__PURE__ */ a(l, { height: r, message: d.error ?? "Invalid data" });
|
|
33
35
|
if (!n.series.some(
|
|
34
36
|
(s) => s.values.some((i) => typeof i == "number" && !Number.isNaN(i) && i !== 0)
|
|
35
37
|
))
|
|
36
|
-
return /* @__PURE__ */ a(
|
|
38
|
+
return /* @__PURE__ */ a($, { height: r });
|
|
37
39
|
let h;
|
|
38
40
|
try {
|
|
39
|
-
h =
|
|
41
|
+
h = O(t, n, b, c);
|
|
40
42
|
} catch (s) {
|
|
41
43
|
const i = s instanceof Error ? s.message : "Failed to build chart";
|
|
42
44
|
return /* @__PURE__ */ a(l, { height: r, message: i });
|
|
@@ -44,7 +46,7 @@ function j({
|
|
|
44
46
|
return /* @__PURE__ */ a(
|
|
45
47
|
"div",
|
|
46
48
|
{
|
|
47
|
-
className:
|
|
49
|
+
className: w(
|
|
48
50
|
"w-full rounded-lg bg-background-neutral-default border border-neutral-150 p-4",
|
|
49
51
|
f
|
|
50
52
|
),
|
|
@@ -52,21 +54,21 @@ function j({
|
|
|
52
54
|
role: "img",
|
|
53
55
|
"aria-label": t.ariaLabel || `${t.type} chart${t.name ? `: ${t.name}` : ""}`,
|
|
54
56
|
children: /* @__PURE__ */ a(
|
|
55
|
-
|
|
57
|
+
R,
|
|
56
58
|
{
|
|
57
59
|
option: h,
|
|
58
|
-
className:
|
|
60
|
+
className: C,
|
|
59
61
|
style: {
|
|
60
62
|
height: r,
|
|
61
63
|
width: t.width || "100%",
|
|
62
|
-
...
|
|
64
|
+
...N
|
|
63
65
|
},
|
|
64
|
-
...
|
|
66
|
+
...y
|
|
65
67
|
}
|
|
66
68
|
)
|
|
67
69
|
}
|
|
68
70
|
);
|
|
69
71
|
}
|
|
70
72
|
export {
|
|
71
|
-
|
|
73
|
+
D as ChartCard
|
|
72
74
|
};
|
|
@@ -44,6 +44,34 @@ export declare function buildLegendConfig(data: string[], hasTitle?: boolean, op
|
|
|
44
44
|
};
|
|
45
45
|
itemWidth: number;
|
|
46
46
|
itemHeight: number;
|
|
47
|
+
} | {
|
|
48
|
+
type: string;
|
|
49
|
+
pageButtonItemGap: number;
|
|
50
|
+
pageButtonGap: number;
|
|
51
|
+
pageButtonPosition: "end" | "start";
|
|
52
|
+
pageFormatter: string;
|
|
53
|
+
pageIconColor: string;
|
|
54
|
+
pageIconInactiveColor: string;
|
|
55
|
+
pageIconSize: number;
|
|
56
|
+
pageTextStyle: {
|
|
57
|
+
color: string;
|
|
58
|
+
fontSize: number;
|
|
59
|
+
};
|
|
60
|
+
data: string[];
|
|
61
|
+
top: string | number;
|
|
62
|
+
bottom: string | number | undefined;
|
|
63
|
+
left: string | number;
|
|
64
|
+
right: string | number | undefined;
|
|
65
|
+
orient: "horizontal" | "vertical";
|
|
66
|
+
itemGap: number;
|
|
67
|
+
padding: number[];
|
|
68
|
+
textStyle: {
|
|
69
|
+
fontSize: number;
|
|
70
|
+
fontFamily: string;
|
|
71
|
+
color: "#000000";
|
|
72
|
+
};
|
|
73
|
+
itemWidth: number;
|
|
74
|
+
itemHeight: number;
|
|
47
75
|
} | undefined;
|
|
48
76
|
export declare function buildAxisLabelConfig(rotate?: number): {
|
|
49
77
|
rotate?: number | undefined;
|