@burdenoff/microfe-bigconsole 2026.1012.1 → 2026.1012.3
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/bigconsole/components/dashboard/CreateDashboardDialog.js +328 -308
- package/dist/bigconsole/components/dashboard/ExportDashboardDialog.js +123 -121
- package/dist/bigconsole/components/dashboard/ImportDashboardDialog.js +241 -267
- package/dist/bigconsole/components/dashboard/TemplateLayoutPreview.js +3 -3
- package/dist/bigconsole/components/widgets/chart/ChartWidget.js +125 -129
- package/dist/bigconsole/components/widgets/chart/charts/AreaChart.js +50 -45
- package/dist/bigconsole/components/widgets/chart/charts/BarChart.js +40 -35
- package/dist/bigconsole/components/widgets/chart/charts/ComboChart.js +41 -48
- package/dist/bigconsole/components/widgets/chart/charts/LineChart.js +41 -36
- package/dist/bigconsole/components/widgets/chart/charts/numericSeries.d.ts +6 -0
- package/dist/bigconsole/components/widgets/chart/charts/numericSeries.js +26 -0
- package/dist/bigconsole/components/widgets/chart/charts/types.d.ts +2 -0
- package/dist/bigconsole/hooks/useExportDashboard.js +62 -38
- package/dist/bigconsole/hooks/useImportDashboard.d.ts +2 -12
- package/dist/bigconsole/hooks/useImportDashboard.js +95 -126
- package/package.json +1 -1
|
@@ -24,16 +24,16 @@ function i({ content: i }) {
|
|
|
24
24
|
gap: "var(--space-controlGap)"
|
|
25
25
|
},
|
|
26
26
|
children: Array.isArray(n.widgets) && n.widgets.filter(r).map((n, i) => {
|
|
27
|
-
let o = r(n.config) ? n.config : {}, s = typeof o.chartType == "string" ? a("bigconsole.dashboards.templatePreview.chartType", "{type} chart", { type: o.chartType }) : typeof
|
|
27
|
+
let o = r(n.config) ? n.config : {}, s = typeof o._internalWidgetType == "string" && o._internalWidgetType.trim() ? o._internalWidgetType : n.type, c = typeof o.chartType == "string" ? a("bigconsole.dashboards.templatePreview.chartType", "{type} chart", { type: o.chartType }) : typeof s == "string" ? s.toLowerCase().replaceAll("_", " ") : a("bigconsole.dashboards.templatePreview.widgetType", "Widget"), l = r(n.position) ? n.position : {};
|
|
28
28
|
return /* @__PURE__ */ t("div", {
|
|
29
29
|
className: "rounded-card border border-border-default bg-bg-sunken p-3",
|
|
30
|
-
style: { gridColumn: `span ${typeof
|
|
30
|
+
style: { gridColumn: `span ${typeof l.width == "number" ? Math.min(12, Math.max(1, Math.round(l.width))) : 6}` },
|
|
31
31
|
children: [/* @__PURE__ */ e("p", {
|
|
32
32
|
className: "truncate text-xs font-medium",
|
|
33
33
|
children: typeof n.title == "string" ? n.title : a("bigconsole.dashboards.templatePreview.widget", "Widget {number}", { number: i + 1 })
|
|
34
34
|
}), /* @__PURE__ */ e("p", {
|
|
35
35
|
className: "truncate text-xs text-text-muted",
|
|
36
|
-
children:
|
|
36
|
+
children: c
|
|
37
37
|
})]
|
|
38
38
|
}, i);
|
|
39
39
|
})
|
|
@@ -1,106 +1,102 @@
|
|
|
1
1
|
import { useCrossFilterContext as e, useWidgetCrossFilter as t } from "../../../contexts/CrossFilterContext.js";
|
|
2
2
|
import "../../../contexts/index.js";
|
|
3
3
|
import n from "./ChartLegend.js";
|
|
4
|
-
import r from "./charts/
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
4
|
+
import { configuredNumericSeries as r, numericSeriesKeys as i } from "./charts/numericSeries.js";
|
|
5
|
+
import a from "./charts/LineChart.js";
|
|
6
|
+
import o from "./charts/BarChart.js";
|
|
7
|
+
import s from "./charts/AreaChart.js";
|
|
8
|
+
import c from "./charts/PieChart.js";
|
|
9
|
+
import l from "./charts/FunnelChart.js";
|
|
10
|
+
import u from "./charts/ComboChart.js";
|
|
11
|
+
import d from "./charts/WaterfallChart.js";
|
|
12
|
+
import f from "./charts/ScatterChart.js";
|
|
13
|
+
import { memo as p, useCallback as m, useMemo as h, useState as g } from "react";
|
|
14
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
14
15
|
//#region src/bigconsole/components/widgets/chart/ChartWidget.tsx
|
|
15
|
-
var
|
|
16
|
+
var y = [
|
|
16
17
|
"var(--color-chart-1)",
|
|
17
18
|
"var(--color-chart-2)",
|
|
18
19
|
"var(--color-chart-3)",
|
|
19
20
|
"var(--color-chart-4)",
|
|
20
21
|
"var(--color-chart-5)"
|
|
21
|
-
],
|
|
22
|
-
let
|
|
23
|
-
sourceField:
|
|
22
|
+
], b = p(function({ widget: p, data: b = [], onClick: x, onDrilldown: S }) {
|
|
23
|
+
let C = p.config, [w, T] = g([]), { handleDataClick: E, enabled: D } = t(p.id, C?.crossFilterMappings || [{
|
|
24
|
+
sourceField: C?.labelField || "name",
|
|
24
25
|
targetFilterId: "category"
|
|
25
|
-
}]), { clearAllCrossFilters:
|
|
26
|
-
type:
|
|
27
|
-
xAxisKey:
|
|
28
|
-
xAxisLabel:
|
|
29
|
-
yAxisLabel:
|
|
30
|
-
showGrid:
|
|
31
|
-
showLegend:
|
|
32
|
-
legendPosition:
|
|
33
|
-
showDots:
|
|
34
|
-
curveType:
|
|
35
|
-
colors:
|
|
36
|
-
seriesNames:
|
|
37
|
-
stacked:
|
|
38
|
-
isDonut:
|
|
39
|
-
innerRadius:
|
|
40
|
-
outerRadius:
|
|
41
|
-
referenceLines:
|
|
42
|
-
series:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
dataKey: e,
|
|
62
|
-
name: O.seriesNames?.[e] || e,
|
|
63
|
-
color: O.colors?.[t] || _[t % _.length],
|
|
64
|
-
hidden: S.includes(e)
|
|
65
|
-
}));
|
|
66
|
-
}, [
|
|
67
|
-
v,
|
|
68
|
-
O,
|
|
69
|
-
S,
|
|
70
|
-
x?.selectedFields
|
|
71
|
-
]), A = f((e) => {
|
|
72
|
-
C((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
73
|
-
}, []), j = f((e, t) => {
|
|
74
|
-
if (T) {
|
|
75
|
-
let t = e[x?.labelField || "name"];
|
|
76
|
-
w(e, t);
|
|
77
|
-
}
|
|
78
|
-
b ? b(e) : y && d.drilldowns?.length && y(e, t);
|
|
79
|
-
}, [
|
|
80
|
-
y,
|
|
26
|
+
}]), { clearAllCrossFilters: O, hasCrossFilters: k } = e(), A = h(() => ({
|
|
27
|
+
type: C?.chartType?.toLowerCase() || "line",
|
|
28
|
+
xAxisKey: C?.xAxisField || "name",
|
|
29
|
+
xAxisLabel: C?.xAxisLabel,
|
|
30
|
+
yAxisLabel: C?.yAxisLabel,
|
|
31
|
+
showGrid: C?.showGrid,
|
|
32
|
+
showLegend: C?.showLegend,
|
|
33
|
+
legendPosition: C?.legendPosition,
|
|
34
|
+
showDots: C?.showDataPoints,
|
|
35
|
+
curveType: C?.curveType,
|
|
36
|
+
colors: C?.colors,
|
|
37
|
+
seriesNames: C?.seriesLabels,
|
|
38
|
+
stacked: C?.stacked,
|
|
39
|
+
isDonut: C?.showAsDonut,
|
|
40
|
+
innerRadius: C?.innerRadius,
|
|
41
|
+
outerRadius: C?.outerRadius,
|
|
42
|
+
referenceLines: C?.referenceLines,
|
|
43
|
+
series: C?.series,
|
|
44
|
+
selectedFields: C?.selectedFields,
|
|
45
|
+
dualAxis: C?.dualAxis,
|
|
46
|
+
yAxisRightLabel: C?.yAxisRightLabel,
|
|
47
|
+
logScale: C?.logScale,
|
|
48
|
+
valueField: C?.valueField,
|
|
49
|
+
labelField: C?.labelField,
|
|
50
|
+
showTotal: C?.showTotal,
|
|
51
|
+
totalLabel: C?.totalLabel,
|
|
52
|
+
xField: C?.xField,
|
|
53
|
+
yField: C?.yField,
|
|
54
|
+
sizeField: C?.sizeField,
|
|
55
|
+
colorField: C?.colorField
|
|
56
|
+
}), [C]), j = A.type === "combo" || A.dualAxis === !0 || A.series?.some((e) => e.axis === "right" || e.type === "bar") && A.series?.some((e) => e.type === "line") || !1, M = h(() => !b.length || A.type === "pie" || A.type === "funnel" || A.type === "scatter" || A.type === "waterfall" ? [] : (j && A.selectedFields !== void 0 ? r(b, A).map((e) => e.field) : i(b, A.xAxisKey, A.selectedFields)).map((e, t) => ({
|
|
57
|
+
dataKey: e,
|
|
58
|
+
name: A.seriesNames?.[e] || e,
|
|
59
|
+
color: A.colors?.[t] || y[t % y.length],
|
|
60
|
+
hidden: w.includes(e)
|
|
61
|
+
})), [
|
|
81
62
|
b,
|
|
82
|
-
|
|
83
|
-
T,
|
|
63
|
+
A,
|
|
84
64
|
w,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
65
|
+
C?.selectedFields,
|
|
66
|
+
j
|
|
67
|
+
]), N = m((e) => {
|
|
68
|
+
T((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
69
|
+
}, []), P = m((e, t) => {
|
|
70
|
+
if (D) {
|
|
71
|
+
let t = e[C?.labelField || "name"];
|
|
72
|
+
E(e, t);
|
|
73
|
+
}
|
|
74
|
+
S ? S(e) : x && p.drilldowns?.length && x(e, t);
|
|
75
|
+
}, [
|
|
76
|
+
x,
|
|
77
|
+
S,
|
|
78
|
+
p.drilldowns,
|
|
79
|
+
D,
|
|
80
|
+
E,
|
|
81
|
+
C?.labelField
|
|
82
|
+
]);
|
|
83
|
+
return /* @__PURE__ */ v("div", {
|
|
88
84
|
className: "flex flex-col h-full p-4",
|
|
89
85
|
children: [
|
|
90
|
-
|
|
86
|
+
k && /* @__PURE__ */ _("div", {
|
|
91
87
|
className: "flex items-center gap-2 mb-2 -mt-1",
|
|
92
|
-
children: /* @__PURE__ */
|
|
88
|
+
children: /* @__PURE__ */ v("button", {
|
|
93
89
|
type: "button",
|
|
94
90
|
onClick: (e) => {
|
|
95
|
-
e.stopPropagation(),
|
|
91
|
+
e.stopPropagation(), O();
|
|
96
92
|
},
|
|
97
93
|
className: "\n inline-flex items-center gap-1.5\n px-2.5 py-1 rounded-md\n text-xs font-medium\n bg-action-primary-bg/10 text-action-primary-text\n hover:bg-action-primary-bg/20\n transition-colors\n ",
|
|
98
|
-
children: [/* @__PURE__ */
|
|
94
|
+
children: [/* @__PURE__ */ _("svg", {
|
|
99
95
|
className: "w-3.5 h-3.5",
|
|
100
96
|
fill: "none",
|
|
101
97
|
stroke: "currentColor",
|
|
102
98
|
viewBox: "0 0 24 24",
|
|
103
|
-
children: /* @__PURE__ */
|
|
99
|
+
children: /* @__PURE__ */ _("path", {
|
|
104
100
|
strokeLinecap: "round",
|
|
105
101
|
strokeLinejoin: "round",
|
|
106
102
|
strokeWidth: 2,
|
|
@@ -109,73 +105,73 @@ var _ = [
|
|
|
109
105
|
}), "Clear Filter"]
|
|
110
106
|
})
|
|
111
107
|
}),
|
|
112
|
-
|
|
113
|
-
items:
|
|
108
|
+
A.legendPosition === "top" && M.length > 0 && /* @__PURE__ */ _(n, {
|
|
109
|
+
items: M,
|
|
114
110
|
position: "top",
|
|
115
|
-
onItemClick:
|
|
111
|
+
onItemClick: N
|
|
116
112
|
}),
|
|
117
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ _("div", {
|
|
118
114
|
className: "flex-1 min-h-0",
|
|
119
115
|
children: (() => {
|
|
120
|
-
if (
|
|
121
|
-
data:
|
|
122
|
-
config:
|
|
123
|
-
hiddenSeries:
|
|
124
|
-
onDataClick:
|
|
116
|
+
if (j) return /* @__PURE__ */ _(u, {
|
|
117
|
+
data: b,
|
|
118
|
+
config: A,
|
|
119
|
+
hiddenSeries: w,
|
|
120
|
+
onDataClick: P
|
|
125
121
|
});
|
|
126
|
-
switch (
|
|
127
|
-
case "waterfall": return /* @__PURE__ */
|
|
128
|
-
data:
|
|
129
|
-
config:
|
|
130
|
-
onDataClick:
|
|
122
|
+
switch (A.type) {
|
|
123
|
+
case "waterfall": return /* @__PURE__ */ _(d, {
|
|
124
|
+
data: b,
|
|
125
|
+
config: A,
|
|
126
|
+
onDataClick: P
|
|
131
127
|
});
|
|
132
|
-
case "scatter": return /* @__PURE__ */
|
|
133
|
-
data:
|
|
134
|
-
config:
|
|
135
|
-
onDataClick:
|
|
128
|
+
case "scatter": return /* @__PURE__ */ _(f, {
|
|
129
|
+
data: b,
|
|
130
|
+
config: A,
|
|
131
|
+
onDataClick: P
|
|
136
132
|
});
|
|
137
|
-
case "bar": return /* @__PURE__ */
|
|
138
|
-
data:
|
|
139
|
-
config:
|
|
140
|
-
hiddenSeries:
|
|
141
|
-
onDataClick:
|
|
133
|
+
case "bar": return /* @__PURE__ */ _(o, {
|
|
134
|
+
data: b,
|
|
135
|
+
config: A,
|
|
136
|
+
hiddenSeries: w,
|
|
137
|
+
onDataClick: P
|
|
142
138
|
});
|
|
143
|
-
case "area": return /* @__PURE__ */
|
|
144
|
-
data:
|
|
145
|
-
config:
|
|
146
|
-
hiddenSeries:
|
|
147
|
-
onDataClick:
|
|
139
|
+
case "area": return /* @__PURE__ */ _(s, {
|
|
140
|
+
data: b,
|
|
141
|
+
config: A,
|
|
142
|
+
hiddenSeries: w,
|
|
143
|
+
onDataClick: P
|
|
148
144
|
});
|
|
149
|
-
case "pie": return /* @__PURE__ */
|
|
150
|
-
data:
|
|
151
|
-
config:
|
|
152
|
-
dataKey:
|
|
153
|
-
nameKey:
|
|
154
|
-
onDataClick:
|
|
145
|
+
case "pie": return /* @__PURE__ */ _(c, {
|
|
146
|
+
data: b,
|
|
147
|
+
config: A,
|
|
148
|
+
dataKey: C?.valueField || "value",
|
|
149
|
+
nameKey: C?.labelField || "name",
|
|
150
|
+
onDataClick: P
|
|
155
151
|
});
|
|
156
|
-
case "funnel": return /* @__PURE__ */
|
|
157
|
-
data:
|
|
158
|
-
config:
|
|
159
|
-
dataKey:
|
|
160
|
-
nameKey:
|
|
161
|
-
onDataClick:
|
|
152
|
+
case "funnel": return /* @__PURE__ */ _(l, {
|
|
153
|
+
data: b,
|
|
154
|
+
config: A,
|
|
155
|
+
dataKey: C?.valueField || "value",
|
|
156
|
+
nameKey: C?.labelField || "name",
|
|
157
|
+
onDataClick: P
|
|
162
158
|
});
|
|
163
|
-
default: return /* @__PURE__ */
|
|
164
|
-
data:
|
|
165
|
-
config:
|
|
166
|
-
hiddenSeries:
|
|
167
|
-
onDataClick:
|
|
159
|
+
default: return /* @__PURE__ */ _(a, {
|
|
160
|
+
data: b,
|
|
161
|
+
config: A,
|
|
162
|
+
hiddenSeries: w,
|
|
163
|
+
onDataClick: P
|
|
168
164
|
});
|
|
169
165
|
}
|
|
170
166
|
})()
|
|
171
167
|
}),
|
|
172
|
-
|
|
173
|
-
items:
|
|
168
|
+
A.legendPosition === "bottom" && M.length > 0 && /* @__PURE__ */ _(n, {
|
|
169
|
+
items: M,
|
|
174
170
|
position: "bottom",
|
|
175
|
-
onItemClick:
|
|
171
|
+
onItemClick: N
|
|
176
172
|
})
|
|
177
173
|
]
|
|
178
174
|
});
|
|
179
175
|
});
|
|
180
176
|
//#endregion
|
|
181
|
-
export {
|
|
177
|
+
export { b as default };
|
|
@@ -1,25 +1,30 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { numericSeriesKeys as e } from "./numericSeries.js";
|
|
2
|
+
import t from "../ChartTooltip.js";
|
|
3
|
+
import { buildReferenceElements as n } from "./referenceElements.js";
|
|
4
|
+
import { memo as r, useMemo as i } from "react";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import { Area as s, AreaChart as c, CartesianGrid as l, Legend as u, ResponsiveContainer as d, Tooltip as f, XAxis as p, YAxis as m } from "recharts";
|
|
6
7
|
//#region src/bigconsole/components/widgets/chart/charts/AreaChart.tsx
|
|
7
|
-
var
|
|
8
|
+
var h = [
|
|
8
9
|
"var(--color-chart-1)",
|
|
9
10
|
"var(--color-chart-2)",
|
|
10
11
|
"var(--color-chart-3)",
|
|
11
12
|
"var(--color-chart-4)",
|
|
12
13
|
"var(--color-chart-5)"
|
|
13
|
-
],
|
|
14
|
-
let
|
|
14
|
+
], g = r(function({ data: r = [], config: g, hiddenSeries: _ = [], onDataClick: v }) {
|
|
15
|
+
let y = i(() => e(r, g.xAxisKey, g.selectedFields), [
|
|
16
|
+
r,
|
|
17
|
+
g.xAxisKey,
|
|
18
|
+
g.selectedFields
|
|
19
|
+
]), b = (e) => typeof e == "number" ? new Intl.NumberFormat("en-US", {
|
|
15
20
|
notation: e >= 1e4 ? "compact" : "standard",
|
|
16
21
|
maximumFractionDigits: 2
|
|
17
|
-
}).format(e) : String(e),
|
|
18
|
-
return
|
|
22
|
+
}).format(e) : String(e), x = (e) => `gradient-${e}`;
|
|
23
|
+
return r?.length ? /* @__PURE__ */ a(d, {
|
|
19
24
|
width: "100%",
|
|
20
25
|
height: "100%",
|
|
21
|
-
children: /* @__PURE__ */
|
|
22
|
-
data:
|
|
26
|
+
children: /* @__PURE__ */ o(c, {
|
|
27
|
+
data: r,
|
|
23
28
|
margin: {
|
|
24
29
|
top: 10,
|
|
25
30
|
right: 10,
|
|
@@ -27,93 +32,93 @@ var m = [
|
|
|
27
32
|
bottom: 0
|
|
28
33
|
},
|
|
29
34
|
onClick: (e) => {
|
|
30
|
-
e?.activePayload?.[0] &&
|
|
35
|
+
e?.activePayload?.[0] && v && v(e.activePayload[0].payload, e.activeTooltipIndex || 0);
|
|
31
36
|
},
|
|
32
37
|
children: [
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
let n =
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
id:
|
|
38
|
+
/* @__PURE__ */ a("defs", { children: y.map((e, t) => {
|
|
39
|
+
let n = g.colors?.[t] || h[t % h.length];
|
|
40
|
+
return /* @__PURE__ */ o("linearGradient", {
|
|
41
|
+
id: x(e),
|
|
37
42
|
x1: "0",
|
|
38
43
|
y1: "0",
|
|
39
44
|
x2: "0",
|
|
40
45
|
y2: "1",
|
|
41
|
-
children: [/* @__PURE__ */
|
|
46
|
+
children: [/* @__PURE__ */ a("stop", {
|
|
42
47
|
offset: "0%",
|
|
43
48
|
stopColor: n,
|
|
44
49
|
stopOpacity: .4
|
|
45
|
-
}), /* @__PURE__ */
|
|
50
|
+
}), /* @__PURE__ */ a("stop", {
|
|
46
51
|
offset: "95%",
|
|
47
52
|
stopColor: n,
|
|
48
53
|
stopOpacity: .05
|
|
49
54
|
})]
|
|
50
55
|
}, e);
|
|
51
56
|
}) }),
|
|
52
|
-
|
|
57
|
+
g.showGrid !== !1 && /* @__PURE__ */ a(l, {
|
|
53
58
|
strokeDasharray: "3 3",
|
|
54
59
|
stroke: "var(--color-border-default)",
|
|
55
60
|
opacity: .5
|
|
56
61
|
}),
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
dataKey:
|
|
62
|
+
/* @__PURE__ */ a(p, {
|
|
63
|
+
dataKey: g.xAxisKey || "name",
|
|
59
64
|
tick: {
|
|
60
65
|
fill: "var(--color-text-secondary)",
|
|
61
66
|
fontSize: 12
|
|
62
67
|
},
|
|
63
68
|
tickLine: { stroke: "var(--color-border-default)" },
|
|
64
69
|
axisLine: { stroke: "var(--color-border-default)" },
|
|
65
|
-
label:
|
|
66
|
-
value:
|
|
70
|
+
label: g.xAxisLabel ? {
|
|
71
|
+
value: g.xAxisLabel,
|
|
67
72
|
position: "insideBottom",
|
|
68
73
|
offset: -5,
|
|
69
74
|
fill: "var(--color-text-secondary)"
|
|
70
75
|
} : void 0
|
|
71
76
|
}),
|
|
72
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ a(m, {
|
|
73
78
|
tick: {
|
|
74
79
|
fill: "var(--color-text-secondary)",
|
|
75
80
|
fontSize: 12
|
|
76
81
|
},
|
|
77
82
|
tickLine: { stroke: "var(--color-border-default)" },
|
|
78
83
|
axisLine: { stroke: "var(--color-border-default)" },
|
|
79
|
-
tickFormatter:
|
|
80
|
-
scale:
|
|
81
|
-
domain:
|
|
82
|
-
allowDataOverflow:
|
|
83
|
-
label:
|
|
84
|
-
value:
|
|
84
|
+
tickFormatter: b,
|
|
85
|
+
scale: g.logScale ? "log" : "auto",
|
|
86
|
+
domain: g.logScale ? ["auto", "auto"] : void 0,
|
|
87
|
+
allowDataOverflow: g.logScale || void 0,
|
|
88
|
+
label: g.yAxisLabel ? {
|
|
89
|
+
value: g.yAxisLabel,
|
|
85
90
|
angle: -90,
|
|
86
91
|
position: "insideLeft",
|
|
87
92
|
fill: "var(--color-text-secondary)"
|
|
88
93
|
} : void 0
|
|
89
94
|
}),
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
content: /* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ a(f, {
|
|
96
|
+
content: /* @__PURE__ */ a(t, { valueFormatter: b }),
|
|
92
97
|
cursor: { stroke: "var(--color-border-default)" }
|
|
93
98
|
}),
|
|
94
|
-
|
|
99
|
+
g.showLegend !== !1 && /* @__PURE__ */ a(u, {
|
|
95
100
|
wrapperStyle: { paddingTop: 20 },
|
|
96
|
-
formatter: (e) => /* @__PURE__ */
|
|
101
|
+
formatter: (e) => /* @__PURE__ */ a("span", {
|
|
97
102
|
style: { color: "var(--color-text-primary)" },
|
|
98
103
|
children: e
|
|
99
104
|
})
|
|
100
105
|
}),
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
type:
|
|
106
|
+
n(g.referenceLines),
|
|
107
|
+
y.map((e, t) => /* @__PURE__ */ a(s, {
|
|
108
|
+
type: g.curveType || "monotone",
|
|
104
109
|
dataKey: e,
|
|
105
|
-
name:
|
|
106
|
-
stroke:
|
|
110
|
+
name: g.seriesNames?.[e] || e,
|
|
111
|
+
stroke: g.colors?.[t] || h[t % h.length],
|
|
107
112
|
strokeWidth: 2,
|
|
108
|
-
fill: `url(#${
|
|
109
|
-
dot:
|
|
113
|
+
fill: `url(#${x(e)})`,
|
|
114
|
+
dot: g.showDots,
|
|
110
115
|
activeDot: { r: 6 },
|
|
111
|
-
hide:
|
|
112
|
-
stackId:
|
|
116
|
+
hide: _.includes(e),
|
|
117
|
+
stackId: g.stacked ? "stack" : void 0
|
|
113
118
|
}, e))
|
|
114
119
|
]
|
|
115
120
|
})
|
|
116
121
|
}) : null;
|
|
117
122
|
});
|
|
118
123
|
//#endregion
|
|
119
|
-
export {
|
|
124
|
+
export { g as default };
|
|
@@ -1,25 +1,30 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { numericSeriesKeys as e } from "./numericSeries.js";
|
|
2
|
+
import t from "../ChartTooltip.js";
|
|
3
|
+
import { buildReferenceElements as n } from "./referenceElements.js";
|
|
4
|
+
import { memo as r, useMemo as i } from "react";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import { Bar as s, BarChart as c, CartesianGrid as l, Legend as u, ResponsiveContainer as d, Tooltip as f, XAxis as p, YAxis as m } from "recharts";
|
|
6
7
|
//#region src/bigconsole/components/widgets/chart/charts/BarChart.tsx
|
|
7
|
-
var
|
|
8
|
+
var h = [
|
|
8
9
|
"var(--color-chart-1)",
|
|
9
10
|
"var(--color-chart-2)",
|
|
10
11
|
"var(--color-chart-3)",
|
|
11
12
|
"var(--color-chart-4)",
|
|
12
13
|
"var(--color-chart-5)"
|
|
13
|
-
],
|
|
14
|
-
let
|
|
14
|
+
], g = r(function({ data: r = [], config: g, hiddenSeries: _ = [], onDataClick: v }) {
|
|
15
|
+
let y = i(() => e(r, g.xAxisKey, g.selectedFields), [
|
|
16
|
+
r,
|
|
17
|
+
g.xAxisKey,
|
|
18
|
+
g.selectedFields
|
|
19
|
+
]), b = (e) => typeof e == "number" ? new Intl.NumberFormat("en-US", {
|
|
15
20
|
notation: e >= 1e4 ? "compact" : "standard",
|
|
16
21
|
maximumFractionDigits: 2
|
|
17
22
|
}).format(e) : String(e);
|
|
18
|
-
return
|
|
23
|
+
return r?.length ? /* @__PURE__ */ a(d, {
|
|
19
24
|
width: "100%",
|
|
20
25
|
height: "100%",
|
|
21
|
-
children: /* @__PURE__ */
|
|
22
|
-
data:
|
|
26
|
+
children: /* @__PURE__ */ o(c, {
|
|
27
|
+
data: r,
|
|
23
28
|
margin: {
|
|
24
29
|
top: 10,
|
|
25
30
|
right: 10,
|
|
@@ -27,79 +32,79 @@ var m = [
|
|
|
27
32
|
bottom: 0
|
|
28
33
|
},
|
|
29
34
|
onClick: (e) => {
|
|
30
|
-
e?.activePayload?.[0] &&
|
|
35
|
+
e?.activePayload?.[0] && v && v(e.activePayload[0].payload, e.activeTooltipIndex || 0);
|
|
31
36
|
},
|
|
32
37
|
children: [
|
|
33
|
-
|
|
38
|
+
g.showGrid !== !1 && /* @__PURE__ */ a(l, {
|
|
34
39
|
strokeDasharray: "3 3",
|
|
35
40
|
stroke: "var(--color-border-default)",
|
|
36
41
|
opacity: .5,
|
|
37
42
|
vertical: !1
|
|
38
43
|
}),
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
dataKey:
|
|
44
|
+
/* @__PURE__ */ a(p, {
|
|
45
|
+
dataKey: g.xAxisKey || "name",
|
|
41
46
|
tick: {
|
|
42
47
|
fill: "var(--color-text-secondary)",
|
|
43
48
|
fontSize: 12
|
|
44
49
|
},
|
|
45
50
|
tickLine: { stroke: "var(--color-border-default)" },
|
|
46
51
|
axisLine: { stroke: "var(--color-border-default)" },
|
|
47
|
-
label:
|
|
48
|
-
value:
|
|
52
|
+
label: g.xAxisLabel ? {
|
|
53
|
+
value: g.xAxisLabel,
|
|
49
54
|
position: "insideBottom",
|
|
50
55
|
offset: -5,
|
|
51
56
|
fill: "var(--color-text-secondary)"
|
|
52
57
|
} : void 0
|
|
53
58
|
}),
|
|
54
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ a(m, {
|
|
55
60
|
tick: {
|
|
56
61
|
fill: "var(--color-text-secondary)",
|
|
57
62
|
fontSize: 12
|
|
58
63
|
},
|
|
59
64
|
tickLine: { stroke: "var(--color-border-default)" },
|
|
60
65
|
axisLine: { stroke: "var(--color-border-default)" },
|
|
61
|
-
tickFormatter:
|
|
62
|
-
scale:
|
|
63
|
-
domain:
|
|
64
|
-
allowDataOverflow:
|
|
65
|
-
label:
|
|
66
|
-
value:
|
|
66
|
+
tickFormatter: b,
|
|
67
|
+
scale: g.logScale ? "log" : "auto",
|
|
68
|
+
domain: g.logScale ? ["auto", "auto"] : void 0,
|
|
69
|
+
allowDataOverflow: g.logScale || void 0,
|
|
70
|
+
label: g.yAxisLabel ? {
|
|
71
|
+
value: g.yAxisLabel,
|
|
67
72
|
angle: -90,
|
|
68
73
|
position: "insideLeft",
|
|
69
74
|
fill: "var(--color-text-secondary)"
|
|
70
75
|
} : void 0
|
|
71
76
|
}),
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
content: /* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ a(f, {
|
|
78
|
+
content: /* @__PURE__ */ a(t, { valueFormatter: b }),
|
|
74
79
|
cursor: {
|
|
75
80
|
fill: "var(--color-bg-muted)",
|
|
76
81
|
opacity: .5
|
|
77
82
|
}
|
|
78
83
|
}),
|
|
79
|
-
|
|
84
|
+
g.showLegend !== !1 && /* @__PURE__ */ a(u, {
|
|
80
85
|
wrapperStyle: { paddingTop: 20 },
|
|
81
|
-
formatter: (e) => /* @__PURE__ */
|
|
86
|
+
formatter: (e) => /* @__PURE__ */ a("span", {
|
|
82
87
|
style: { color: "var(--color-text-primary)" },
|
|
83
88
|
children: e
|
|
84
89
|
})
|
|
85
90
|
}),
|
|
86
|
-
|
|
87
|
-
|
|
91
|
+
n(g.referenceLines),
|
|
92
|
+
y.map((e, t) => /* @__PURE__ */ a(s, {
|
|
88
93
|
dataKey: e,
|
|
89
|
-
name:
|
|
90
|
-
fill:
|
|
94
|
+
name: g.seriesNames?.[e] || e,
|
|
95
|
+
fill: g.colors?.[t] || h[t % h.length],
|
|
91
96
|
radius: [
|
|
92
97
|
4,
|
|
93
98
|
4,
|
|
94
99
|
0,
|
|
95
100
|
0
|
|
96
101
|
],
|
|
97
|
-
hide:
|
|
98
|
-
stackId:
|
|
102
|
+
hide: _.includes(e),
|
|
103
|
+
stackId: g.stacked ? "stack" : void 0
|
|
99
104
|
}, e))
|
|
100
105
|
]
|
|
101
106
|
})
|
|
102
107
|
}) : null;
|
|
103
108
|
});
|
|
104
109
|
//#endregion
|
|
105
|
-
export {
|
|
110
|
+
export { g as default };
|