@burdenoff/microfe-bigconsole 2026.1115.2 → 2026.1115.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/builder/inspector/AppearanceSection.js +11 -5
- package/dist/bigconsole/components/widgets/chart/ChartConfig.d.ts +5 -0
- package/dist/bigconsole/components/widgets/chart/ChartConfig.js +110 -104
- package/dist/bigconsole/components/widgets/chart/ChartWidget.js +137 -130
- package/dist/bigconsole/components/widgets/chart/charts/funnelData.d.ts +16 -0
- package/dist/bigconsole/components/widgets/chart/charts/funnelData.js +12 -1
- package/dist/bigconsole/components/widgets/heatmap/HeatmapWidget.js +55 -54
- package/dist/bigconsole/components/widgets/heatmap/heatmapData.d.ts +10 -0
- package/dist/bigconsole/components/widgets/heatmap/heatmapData.js +95 -0
- package/package.json +1 -1
|
@@ -17,11 +17,17 @@ function p(e) {
|
|
|
17
17
|
return e;
|
|
18
18
|
}
|
|
19
19
|
function m(e) {
|
|
20
|
+
return /* @__PURE__ */ f(r, {
|
|
21
|
+
...e,
|
|
22
|
+
fixedChartType: "funnel"
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function h(e) {
|
|
20
26
|
switch (e) {
|
|
21
27
|
case "metric_card": return p(t);
|
|
22
28
|
case "kpi_card_comparison": return p(n);
|
|
23
|
-
case "chart":
|
|
24
|
-
case "funnel_chart": return p(
|
|
29
|
+
case "chart": return p(r);
|
|
30
|
+
case "funnel_chart": return p(m);
|
|
25
31
|
case "table":
|
|
26
32
|
case "pivot_table": return p(i);
|
|
27
33
|
case "gauge": return p(a);
|
|
@@ -31,8 +37,8 @@ function m(e) {
|
|
|
31
37
|
default: return null;
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
|
-
var
|
|
35
|
-
let { t: i } = d(), a =
|
|
40
|
+
var g = u(function({ widgetType: t, config: n, onChange: r }) {
|
|
41
|
+
let { t: i } = d(), a = h(t);
|
|
36
42
|
return [
|
|
37
43
|
"map",
|
|
38
44
|
"waterfall",
|
|
@@ -67,4 +73,4 @@ var h = u(function({ widgetType: t, config: n, onChange: r }) {
|
|
|
67
73
|
})
|
|
68
74
|
});
|
|
69
75
|
});
|
|
70
|
-
export {
|
|
76
|
+
export { g as AppearanceSection };
|
|
@@ -5,6 +5,11 @@ export interface ChartConfigProps {
|
|
|
5
5
|
config: ConfigType;
|
|
6
6
|
/** Callback when config changes */
|
|
7
7
|
onChange: (config: ConfigType) => void;
|
|
8
|
+
/**
|
|
9
|
+
* A widget type that IS one chart type (the Funnel Chart widget) passes it here: the
|
|
10
|
+
* Chart Type picker is not offered and the settings follow that type (BOFF-10138).
|
|
11
|
+
*/
|
|
12
|
+
fixedChartType?: ConfigType['chartType'];
|
|
8
13
|
}
|
|
9
14
|
export declare const ChartConfig: FC<ChartConfigProps>;
|
|
10
15
|
export default ChartConfig;
|
|
@@ -4,225 +4,231 @@ import { memo as r, useCallback as i, useMemo as a } from "react";
|
|
|
4
4
|
import { useI18n as o } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
5
5
|
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
6
|
// src/bigconsole/components/widgets/chart/ChartConfig.tsx
|
|
7
|
-
var u = r(function({ config: r, onChange: u }) {
|
|
8
|
-
let { t:
|
|
7
|
+
var u = r(function({ config: r, onChange: u, fixedChartType: d }) {
|
|
8
|
+
let { t: f } = o(), p = a(() => d ? {
|
|
9
|
+
...r,
|
|
10
|
+
chartType: d
|
|
11
|
+
} : r, [r, d]), m = a(() => [
|
|
9
12
|
{
|
|
10
13
|
value: "line",
|
|
11
|
-
label:
|
|
14
|
+
label: f("bigconsole.widget.config.chart.type.line", "Line Chart")
|
|
12
15
|
},
|
|
13
16
|
{
|
|
14
17
|
value: "bar",
|
|
15
|
-
label:
|
|
18
|
+
label: f("bigconsole.widget.config.chart.type.bar", "Bar Chart")
|
|
16
19
|
},
|
|
17
20
|
{
|
|
18
21
|
value: "area",
|
|
19
|
-
label:
|
|
22
|
+
label: f("bigconsole.widget.config.chart.type.area", "Area Chart")
|
|
20
23
|
},
|
|
21
24
|
{
|
|
22
25
|
value: "pie",
|
|
23
|
-
label:
|
|
26
|
+
label: f("bigconsole.widget.config.chart.type.pie", "Pie Chart")
|
|
24
27
|
},
|
|
25
28
|
{
|
|
26
29
|
value: "funnel",
|
|
27
|
-
label:
|
|
30
|
+
label: f("bigconsole.widget.config.chart.type.funnel", "Funnel Chart")
|
|
28
31
|
}
|
|
29
|
-
], [
|
|
32
|
+
], [f]), h = a(() => [
|
|
30
33
|
{
|
|
31
34
|
value: "monotone",
|
|
32
|
-
label:
|
|
35
|
+
label: f("bigconsole.widget.config.chart.curve.smooth", "Smooth")
|
|
33
36
|
},
|
|
34
37
|
{
|
|
35
38
|
value: "linear",
|
|
36
|
-
label:
|
|
39
|
+
label: f("bigconsole.widget.config.chart.curve.linear", "Linear")
|
|
37
40
|
},
|
|
38
41
|
{
|
|
39
42
|
value: "step",
|
|
40
|
-
label:
|
|
43
|
+
label: f("bigconsole.widget.config.chart.curve.step", "Step")
|
|
41
44
|
},
|
|
42
45
|
{
|
|
43
46
|
value: "natural",
|
|
44
|
-
label:
|
|
47
|
+
label: f("bigconsole.widget.config.chart.curve.natural", "Natural")
|
|
45
48
|
}
|
|
46
|
-
], [
|
|
49
|
+
], [f]), g = a(() => [
|
|
47
50
|
{
|
|
48
51
|
value: "top",
|
|
49
|
-
label:
|
|
52
|
+
label: f("bigconsole.widget.config.chart.legendPosition.top", "Top")
|
|
50
53
|
},
|
|
51
54
|
{
|
|
52
55
|
value: "bottom",
|
|
53
|
-
label:
|
|
56
|
+
label: f("bigconsole.widget.config.chart.legendPosition.bottom", "Bottom")
|
|
54
57
|
},
|
|
55
58
|
{
|
|
56
59
|
value: "left",
|
|
57
|
-
label:
|
|
60
|
+
label: f("bigconsole.widget.config.chart.legendPosition.left", "Left")
|
|
58
61
|
},
|
|
59
62
|
{
|
|
60
63
|
value: "right",
|
|
61
|
-
label:
|
|
64
|
+
label: f("bigconsole.widget.config.chart.legendPosition.right", "Right")
|
|
62
65
|
}
|
|
63
|
-
], [
|
|
66
|
+
], [f]), _ = i((e, t) => {
|
|
64
67
|
u({
|
|
65
|
-
...
|
|
68
|
+
...p,
|
|
66
69
|
[e]: t
|
|
67
70
|
});
|
|
68
|
-
}, [
|
|
71
|
+
}, [p, u]), v = p.chartType === "pie" || p.chartType === "funnel", y = a(() => t(p.referenceLines), [p.referenceLines]);
|
|
69
72
|
return /* @__PURE__ */ l("div", {
|
|
70
73
|
className: "min-w-0 space-y-form-gap",
|
|
71
74
|
children: [
|
|
72
|
-
/* @__PURE__ */ l("div", {
|
|
73
|
-
|
|
74
|
-
children:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
children: e
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
75
|
+
/* @__PURE__ */ l("div", {
|
|
76
|
+
hidden: d !== void 0,
|
|
77
|
+
children: [/* @__PURE__ */ c("label", {
|
|
78
|
+
className: "block text-sm font-medium text-text-primary mb-1",
|
|
79
|
+
children: f("bigconsole.widget.config.chart.chartTypeLabel", "Chart Type")
|
|
80
|
+
}), /* @__PURE__ */ c("select", {
|
|
81
|
+
value: p.chartType || "line",
|
|
82
|
+
onChange: (e) => _("chartType", e.target.value),
|
|
83
|
+
className: "\n w-full px-3 py-2\n text-sm text-text-primary\n bg-bg-surface\n border border-border-default\n rounded-md\n focus:outline-none focus:ring-2 focus:ring-action-primary-bg\n ",
|
|
84
|
+
children: m.map((e) => /* @__PURE__ */ c("option", {
|
|
85
|
+
value: e.value,
|
|
86
|
+
children: e.label
|
|
87
|
+
}, e.value))
|
|
88
|
+
})]
|
|
89
|
+
}),
|
|
90
|
+
!v && /* @__PURE__ */ l(s, { children: [
|
|
85
91
|
/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
86
92
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
87
|
-
children:
|
|
93
|
+
children: f("bigconsole.widget.config.chart.xAxisFieldLabel", "X-Axis Field")
|
|
88
94
|
}), /* @__PURE__ */ c("input", {
|
|
89
95
|
type: "text",
|
|
90
|
-
value:
|
|
91
|
-
onChange: (e) =>
|
|
92
|
-
placeholder:
|
|
96
|
+
value: p.xAxisField || "",
|
|
97
|
+
onChange: (e) => _("xAxisField", e.target.value),
|
|
98
|
+
placeholder: f("bigconsole.widget.config.chart.xAxisFieldPlaceholder", "e.g., date, category"),
|
|
93
99
|
className: "\n w-full px-3 py-2\n text-sm text-text-primary\n bg-bg-surface\n border border-border-default\n rounded-md\n focus:outline-none focus:ring-2 focus:ring-action-primary-bg\n "
|
|
94
100
|
})] }),
|
|
95
101
|
/* @__PURE__ */ l("div", {
|
|
96
102
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
|
|
97
103
|
children: [/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
98
104
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
99
|
-
children:
|
|
105
|
+
children: f("bigconsole.widget.config.chart.xAxisLabelLabel", "X-Axis Label")
|
|
100
106
|
}), /* @__PURE__ */ c("input", {
|
|
101
107
|
type: "text",
|
|
102
|
-
value:
|
|
103
|
-
onChange: (e) =>
|
|
104
|
-
placeholder:
|
|
108
|
+
value: p.xAxisLabel || "",
|
|
109
|
+
onChange: (e) => _("xAxisLabel", e.target.value),
|
|
110
|
+
placeholder: f("bigconsole.widget.config.chart.optionalPlaceholder", "Optional"),
|
|
105
111
|
className: "\n w-full px-3 py-2\n text-sm text-text-primary\n bg-bg-surface\n border border-border-default\n rounded-md\n focus:outline-none focus:ring-2 focus:ring-action-primary-bg\n "
|
|
106
112
|
})] }), /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
107
113
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
108
|
-
children:
|
|
114
|
+
children: f("bigconsole.widget.config.chart.yAxisLabelLabel", "Y-Axis Label")
|
|
109
115
|
}), /* @__PURE__ */ c("input", {
|
|
110
116
|
type: "text",
|
|
111
|
-
value:
|
|
112
|
-
onChange: (e) =>
|
|
113
|
-
placeholder:
|
|
117
|
+
value: p.yAxisLabel || "",
|
|
118
|
+
onChange: (e) => _("yAxisLabel", e.target.value),
|
|
119
|
+
placeholder: f("bigconsole.widget.config.chart.optionalPlaceholder", "Optional"),
|
|
114
120
|
className: "\n w-full px-3 py-2\n text-sm text-text-primary\n bg-bg-surface\n border border-border-default\n rounded-md\n focus:outline-none focus:ring-2 focus:ring-action-primary-bg\n "
|
|
115
121
|
})] })]
|
|
116
122
|
}),
|
|
117
|
-
!
|
|
123
|
+
!v && /* @__PURE__ */ l("div", {
|
|
118
124
|
className: "grid grid-cols-2 gap-3",
|
|
119
125
|
children: [/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
120
126
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
121
|
-
children:
|
|
127
|
+
children: f("bigconsole.widget.config.chart.yMinLabel", "Y-Axis Min")
|
|
122
128
|
}), /* @__PURE__ */ c("input", {
|
|
123
129
|
type: "number",
|
|
124
|
-
value:
|
|
125
|
-
onChange: (e) =>
|
|
126
|
-
placeholder:
|
|
130
|
+
value: p.yMin ?? "",
|
|
131
|
+
onChange: (e) => _("yMin", e.target.value === "" ? void 0 : Number(e.target.value)),
|
|
132
|
+
placeholder: f("bigconsole.widget.config.chart.autoPlaceholder", "Auto"),
|
|
127
133
|
className: "\n w-full px-3 py-2\n text-sm text-text-primary\n bg-bg-surface\n border border-border-default\n rounded-md\n focus:outline-none focus:ring-2 focus:ring-action-primary-bg\n "
|
|
128
134
|
})] }), /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
129
135
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
130
|
-
children:
|
|
136
|
+
children: f("bigconsole.widget.config.chart.yMaxLabel", "Y-Axis Max")
|
|
131
137
|
}), /* @__PURE__ */ c("input", {
|
|
132
138
|
type: "number",
|
|
133
|
-
value:
|
|
134
|
-
onChange: (e) =>
|
|
135
|
-
placeholder:
|
|
139
|
+
value: p.yMax ?? "",
|
|
140
|
+
onChange: (e) => _("yMax", e.target.value === "" ? void 0 : Number(e.target.value)),
|
|
141
|
+
placeholder: f("bigconsole.widget.config.chart.autoPlaceholder", "Auto"),
|
|
136
142
|
className: "\n w-full px-3 py-2\n text-sm text-text-primary\n bg-bg-surface\n border border-border-default\n rounded-md\n focus:outline-none focus:ring-2 focus:ring-action-primary-bg\n "
|
|
137
143
|
})] })]
|
|
138
144
|
}),
|
|
139
|
-
(
|
|
145
|
+
(p.chartType === "line" || p.chartType === "area") && /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
140
146
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
141
|
-
children:
|
|
147
|
+
children: f("bigconsole.widget.config.chart.curveTypeLabel", "Curve Type")
|
|
142
148
|
}), /* @__PURE__ */ c("select", {
|
|
143
|
-
value:
|
|
144
|
-
onChange: (e) =>
|
|
149
|
+
value: p.curveType || "monotone",
|
|
150
|
+
onChange: (e) => _("curveType", e.target.value),
|
|
145
151
|
className: "\n w-full px-3 py-2\n text-sm text-text-primary\n bg-bg-surface\n border border-border-default\n rounded-md\n focus:outline-none focus:ring-2 focus:ring-action-primary-bg\n ",
|
|
146
|
-
children:
|
|
152
|
+
children: h.map((e) => /* @__PURE__ */ c("option", {
|
|
147
153
|
value: e.value,
|
|
148
154
|
children: e.label
|
|
149
155
|
}, e.value))
|
|
150
156
|
})] })
|
|
151
157
|
] }),
|
|
152
|
-
|
|
158
|
+
v && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ l("div", {
|
|
153
159
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
|
|
154
160
|
children: [/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
155
161
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
156
|
-
children:
|
|
162
|
+
children: f("bigconsole.widget.config.chart.valueFieldLabel", "Value Field")
|
|
157
163
|
}), /* @__PURE__ */ c("input", {
|
|
158
164
|
type: "text",
|
|
159
|
-
value:
|
|
160
|
-
onChange: (e) =>
|
|
161
|
-
placeholder:
|
|
165
|
+
value: p.valueField || "",
|
|
166
|
+
onChange: (e) => _("valueField", e.target.value),
|
|
167
|
+
placeholder: f("bigconsole.widget.config.chart.valueFieldPlaceholder", "e.g., value"),
|
|
162
168
|
className: "\n w-full px-3 py-2\n text-sm text-text-primary\n bg-bg-surface\n border border-border-default\n rounded-md\n focus:outline-none focus:ring-2 focus:ring-action-primary-bg\n "
|
|
163
169
|
})] }), /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
164
170
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
165
|
-
children:
|
|
171
|
+
children: f("bigconsole.widget.config.chart.labelFieldLabel", "Label Field")
|
|
166
172
|
}), /* @__PURE__ */ c("input", {
|
|
167
173
|
type: "text",
|
|
168
|
-
value:
|
|
169
|
-
onChange: (e) =>
|
|
170
|
-
placeholder:
|
|
174
|
+
value: p.labelField || "",
|
|
175
|
+
onChange: (e) => _("labelField", e.target.value),
|
|
176
|
+
placeholder: f("bigconsole.widget.config.chart.labelFieldPlaceholder", "e.g., name"),
|
|
171
177
|
className: "\n w-full px-3 py-2\n text-sm text-text-primary\n bg-bg-surface\n border border-border-default\n rounded-md\n focus:outline-none focus:ring-2 focus:ring-action-primary-bg\n "
|
|
172
178
|
})] })]
|
|
173
|
-
}),
|
|
179
|
+
}), p.chartType === "pie" && /* @__PURE__ */ l("label", {
|
|
174
180
|
className: "flex items-center gap-3",
|
|
175
181
|
children: [/* @__PURE__ */ c("input", {
|
|
176
182
|
type: "checkbox",
|
|
177
|
-
checked:
|
|
178
|
-
onChange: (e) =>
|
|
183
|
+
checked: p.showAsDonut === !0,
|
|
184
|
+
onChange: (e) => _("showAsDonut", e.target.checked),
|
|
179
185
|
className: "\n w-4 h-4\n text-action-primary-bg\n bg-bg-surface\n border-border-default\n rounded\n focus:ring-action-primary-bg\n "
|
|
180
186
|
}), /* @__PURE__ */ c("span", {
|
|
181
187
|
className: "text-sm text-text-primary",
|
|
182
|
-
children:
|
|
188
|
+
children: f("bigconsole.widget.config.chart.showAsDonut", "Show as Donut")
|
|
183
189
|
})]
|
|
184
190
|
})] }),
|
|
185
191
|
/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
186
192
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
187
|
-
children:
|
|
193
|
+
children: f("bigconsole.widget.config.chart.legendPositionLabel", "Legend Position")
|
|
188
194
|
}), /* @__PURE__ */ c("select", {
|
|
189
|
-
value:
|
|
190
|
-
onChange: (e) =>
|
|
195
|
+
value: p.legendPosition || "bottom",
|
|
196
|
+
onChange: (e) => _("legendPosition", e.target.value),
|
|
191
197
|
className: "\n w-full px-3 py-2\n text-sm text-text-primary\n bg-bg-surface\n border border-border-default\n rounded-md\n focus:outline-none focus:ring-2 focus:ring-action-primary-bg\n ",
|
|
192
|
-
children:
|
|
198
|
+
children: g.map((e) => /* @__PURE__ */ c("option", {
|
|
193
199
|
value: e.value,
|
|
194
200
|
children: e.label
|
|
195
201
|
}, e.value))
|
|
196
202
|
})] }),
|
|
197
|
-
!
|
|
203
|
+
!v && /* @__PURE__ */ l("div", { children: [
|
|
198
204
|
/* @__PURE__ */ c("label", {
|
|
199
205
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
200
|
-
children:
|
|
206
|
+
children: f("bigconsole.widget.config.chart.fieldsToDisplayLabel", "Fields to Display")
|
|
201
207
|
}),
|
|
202
208
|
/* @__PURE__ */ c("p", {
|
|
203
209
|
className: "text-xs text-text-secondary mb-2",
|
|
204
|
-
children:
|
|
210
|
+
children: f("bigconsole.widget.config.chart.fieldsToDisplayHelp", "Select which numeric fields to show as chart series. Leave empty to show all.")
|
|
205
211
|
}),
|
|
206
212
|
/* @__PURE__ */ c("input", {
|
|
207
213
|
type: "text",
|
|
208
|
-
value:
|
|
214
|
+
value: p.selectedFields?.join(", ") || "",
|
|
209
215
|
onChange: (e) => {
|
|
210
216
|
let t = e.target.value.trim(), n = t ? t.split(",").map((e) => e.trim()).filter(Boolean) : [];
|
|
211
|
-
|
|
217
|
+
_("selectedFields", n.length > 0 ? n : void 0);
|
|
212
218
|
},
|
|
213
|
-
placeholder:
|
|
219
|
+
placeholder: f("bigconsole.widget.config.chart.fieldsToDisplayPlaceholder", "e.g., revenue, orders, users (comma-separated)"),
|
|
214
220
|
className: "\n w-full px-3 py-2\n text-sm text-text-primary\n bg-bg-surface\n border border-border-default\n rounded-md\n focus:outline-none focus:ring-2 focus:ring-action-primary-bg\n "
|
|
215
221
|
}),
|
|
216
222
|
/* @__PURE__ */ c("p", {
|
|
217
223
|
className: "text-xs text-text-muted mt-1",
|
|
218
|
-
children:
|
|
224
|
+
children: f("bigconsole.widget.config.chart.fieldsToDisplayHint", "Enter field names separated by commas")
|
|
219
225
|
})
|
|
220
226
|
] }),
|
|
221
|
-
!
|
|
227
|
+
!v && /* @__PURE__ */ c("div", {
|
|
222
228
|
className: "border-t border-[var(--color-border-subtle)] pt-form-gap",
|
|
223
229
|
children: /* @__PURE__ */ c(e, {
|
|
224
|
-
lines:
|
|
225
|
-
onChange: (e) =>
|
|
230
|
+
lines: y,
|
|
231
|
+
onChange: (e) => _("referenceLines", n(e))
|
|
226
232
|
})
|
|
227
233
|
}),
|
|
228
234
|
/* @__PURE__ */ l("div", {
|
|
@@ -238,61 +244,61 @@ var u = r(function({ config: r, onChange: u }) {
|
|
|
238
244
|
className: "flex items-center gap-3",
|
|
239
245
|
children: [/* @__PURE__ */ c("input", {
|
|
240
246
|
type: "checkbox",
|
|
241
|
-
checked:
|
|
242
|
-
onChange: (e) =>
|
|
247
|
+
checked: p.showGrid !== !1,
|
|
248
|
+
onChange: (e) => _("showGrid", e.target.checked),
|
|
243
249
|
className: "\n w-4 h-4\n text-action-primary-bg\n bg-bg-surface\n border-border-default\n rounded\n focus:ring-action-primary-bg\n "
|
|
244
250
|
}), /* @__PURE__ */ c("span", {
|
|
245
251
|
className: "text-sm text-text-primary",
|
|
246
|
-
children:
|
|
252
|
+
children: f("bigconsole.widget.config.chart.showGrid", "Show Grid")
|
|
247
253
|
})]
|
|
248
254
|
}),
|
|
249
255
|
/* @__PURE__ */ l("label", {
|
|
250
256
|
className: "flex items-center gap-3",
|
|
251
257
|
children: [/* @__PURE__ */ c("input", {
|
|
252
258
|
type: "checkbox",
|
|
253
|
-
checked:
|
|
254
|
-
onChange: (e) =>
|
|
259
|
+
checked: p.showLegend !== !1,
|
|
260
|
+
onChange: (e) => _("showLegend", e.target.checked),
|
|
255
261
|
className: "\n w-4 h-4\n text-action-primary-bg\n bg-bg-surface\n border-border-default\n rounded\n focus:ring-action-primary-bg\n "
|
|
256
262
|
}), /* @__PURE__ */ c("span", {
|
|
257
263
|
className: "text-sm text-text-primary",
|
|
258
|
-
children:
|
|
264
|
+
children: f("bigconsole.widget.config.chart.showLegend", "Show Legend")
|
|
259
265
|
})]
|
|
260
266
|
}),
|
|
261
|
-
!
|
|
267
|
+
!v && /* @__PURE__ */ l(s, { children: [
|
|
262
268
|
/* @__PURE__ */ l("label", {
|
|
263
269
|
className: "flex items-center gap-3",
|
|
264
270
|
children: [/* @__PURE__ */ c("input", {
|
|
265
271
|
type: "checkbox",
|
|
266
|
-
checked:
|
|
267
|
-
onChange: (e) =>
|
|
272
|
+
checked: p.showDataPoints === !0,
|
|
273
|
+
onChange: (e) => _("showDataPoints", e.target.checked),
|
|
268
274
|
className: "\n w-4 h-4\n text-action-primary-bg\n bg-bg-surface\n border-border-default\n rounded\n focus:ring-action-primary-bg\n "
|
|
269
275
|
}), /* @__PURE__ */ c("span", {
|
|
270
276
|
className: "text-sm text-text-primary",
|
|
271
|
-
children:
|
|
277
|
+
children: f("bigconsole.widget.config.chart.showDataPoints", "Show Data Points")
|
|
272
278
|
})]
|
|
273
279
|
}),
|
|
274
|
-
(
|
|
280
|
+
(p.chartType === "line" || p.chartType === "area" || p.chartType === "bar") && /* @__PURE__ */ l("label", {
|
|
275
281
|
className: "flex items-center gap-3",
|
|
276
282
|
children: [/* @__PURE__ */ c("input", {
|
|
277
283
|
type: "checkbox",
|
|
278
|
-
checked:
|
|
279
|
-
onChange: (e) =>
|
|
284
|
+
checked: p.startAtZero === !0,
|
|
285
|
+
onChange: (e) => _("startAtZero", e.target.checked),
|
|
280
286
|
className: "\n w-4 h-4\n text-action-primary-bg\n bg-bg-surface\n border-border-default\n rounded\n focus:ring-action-primary-bg\n "
|
|
281
287
|
}), /* @__PURE__ */ c("span", {
|
|
282
288
|
className: "text-sm text-text-primary",
|
|
283
|
-
children:
|
|
289
|
+
children: f("bigconsole.widget.config.chart.startAtZero", "Y-axis: start at zero")
|
|
284
290
|
})]
|
|
285
291
|
}),
|
|
286
|
-
(
|
|
292
|
+
(p.chartType === "bar" || p.chartType === "area") && /* @__PURE__ */ l("label", {
|
|
287
293
|
className: "flex items-center gap-3",
|
|
288
294
|
children: [/* @__PURE__ */ c("input", {
|
|
289
295
|
type: "checkbox",
|
|
290
|
-
checked:
|
|
291
|
-
onChange: (e) =>
|
|
296
|
+
checked: p.stacked === !0,
|
|
297
|
+
onChange: (e) => _("stacked", e.target.checked),
|
|
292
298
|
className: "\n w-4 h-4\n text-action-primary-bg\n bg-bg-surface\n border-border-default\n rounded\n focus:ring-action-primary-bg\n "
|
|
293
299
|
}), /* @__PURE__ */ c("span", {
|
|
294
300
|
className: "text-sm text-text-primary",
|
|
295
|
-
children:
|
|
301
|
+
children: f("bigconsole.widget.config.chart.stacked", "Stacked")
|
|
296
302
|
})]
|
|
297
303
|
})
|
|
298
304
|
] })
|
|
@@ -5,18 +5,19 @@ import { BarChart as a } from "./charts/BarChart.js";
|
|
|
5
5
|
import { AreaChart as o } from "./charts/AreaChart.js";
|
|
6
6
|
import { PieChart as s } from "./charts/PieChart.js";
|
|
7
7
|
import { FunnelChart as c } from "./charts/FunnelChart.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { funnelFields as l } from "./charts/funnelData.js";
|
|
9
|
+
import { ComboChart as u } from "./charts/ComboChart.js";
|
|
10
|
+
import { WaterfallChart as d } from "./charts/WaterfallChart.js";
|
|
11
|
+
import { ScatterChart as f } from "./charts/ScatterChart.js";
|
|
12
|
+
import { ChartLegend as p } from "./ChartLegend.js";
|
|
12
13
|
import "../../../contexts/index.js";
|
|
13
|
-
import { WidgetEmptyState as
|
|
14
|
-
import { classifyChartData as
|
|
15
|
-
import { memo as
|
|
16
|
-
import { useI18n as
|
|
17
|
-
import { jsx as
|
|
14
|
+
import { WidgetEmptyState as m } from "../states/EmptyState.js";
|
|
15
|
+
import { classifyChartData as h } from "./chartRows.js";
|
|
16
|
+
import { memo as g, useCallback as _, useMemo as v, useState as y } from "react";
|
|
17
|
+
import { useI18n as b } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
18
|
+
import { jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
18
19
|
// src/bigconsole/components/widgets/chart/ChartWidget.tsx
|
|
19
|
-
var
|
|
20
|
+
var C = [], w = {
|
|
20
21
|
number: {
|
|
21
22
|
key: "bigconsole.widget.chart.unsupported.number",
|
|
22
23
|
fallback: "This data is a single value."
|
|
@@ -33,156 +34,162 @@ var S = [], C = {
|
|
|
33
34
|
key: "bigconsole.widget.chart.unsupported.values",
|
|
34
35
|
fallback: "This data is a list of values without field names."
|
|
35
36
|
}
|
|
36
|
-
},
|
|
37
|
+
}, T = [
|
|
37
38
|
"var(--color-chart-1)",
|
|
38
39
|
"var(--color-chart-2)",
|
|
39
40
|
"var(--color-chart-3)",
|
|
40
41
|
"var(--color-chart-4)",
|
|
41
42
|
"var(--color-chart-5)"
|
|
42
|
-
],
|
|
43
|
-
let { t:
|
|
44
|
-
sourceField:
|
|
43
|
+
], E = g(function({ widget: g, data: E = [], onClick: D, onDrilldown: O }) {
|
|
44
|
+
let { t: k } = b(), A = g.config, [j, M] = y([]), N = v(() => h(E), [E]), P = N.kind === "rows" ? N.rows : C, { handleDataClick: F, enabled: I } = t(g.id, A?.crossFilterMappings || [{
|
|
45
|
+
sourceField: A?.labelField || "name",
|
|
45
46
|
targetFilterId: "category"
|
|
46
|
-
}]), { clearAllCrossFilters:
|
|
47
|
-
type:
|
|
48
|
-
xAxisKey:
|
|
49
|
-
xAxisLabel:
|
|
50
|
-
yAxisLabel:
|
|
51
|
-
showGrid:
|
|
52
|
-
showLegend:
|
|
53
|
-
legendPosition:
|
|
54
|
-
showDots:
|
|
55
|
-
curveType:
|
|
56
|
-
colors:
|
|
57
|
-
seriesNames:
|
|
58
|
-
stacked:
|
|
59
|
-
isDonut:
|
|
60
|
-
innerRadius:
|
|
61
|
-
outerRadius:
|
|
62
|
-
referenceLines:
|
|
63
|
-
series:
|
|
64
|
-
selectedFields:
|
|
65
|
-
dualAxis:
|
|
66
|
-
yAxisRightLabel:
|
|
67
|
-
logScale:
|
|
68
|
-
startAtZero:
|
|
69
|
-
yMin:
|
|
70
|
-
yMax:
|
|
71
|
-
valueField:
|
|
72
|
-
labelField:
|
|
73
|
-
showTotal:
|
|
74
|
-
totalLabel:
|
|
75
|
-
xField:
|
|
76
|
-
yField:
|
|
77
|
-
sizeField:
|
|
78
|
-
colorField:
|
|
79
|
-
}), [
|
|
47
|
+
}]), { clearAllCrossFilters: L, hasCrossFilters: R } = e(), z = v(() => ({
|
|
48
|
+
type: g.type === "funnel_chart" ? "funnel" : A?.chartType?.toLowerCase() || "line",
|
|
49
|
+
xAxisKey: A?.xAxisField || A?.labelField || "name",
|
|
50
|
+
xAxisLabel: A?.xAxisLabel,
|
|
51
|
+
yAxisLabel: A?.yAxisLabel,
|
|
52
|
+
showGrid: A?.showGrid,
|
|
53
|
+
showLegend: A?.showLegend,
|
|
54
|
+
legendPosition: A?.legendPosition,
|
|
55
|
+
showDots: A?.showDataPoints,
|
|
56
|
+
curveType: A?.curveType,
|
|
57
|
+
colors: A?.colors,
|
|
58
|
+
seriesNames: A?.seriesLabels,
|
|
59
|
+
stacked: A?.stacked,
|
|
60
|
+
isDonut: A?.showAsDonut,
|
|
61
|
+
innerRadius: A?.innerRadius,
|
|
62
|
+
outerRadius: A?.outerRadius,
|
|
63
|
+
referenceLines: A?.referenceLines,
|
|
64
|
+
series: A?.series,
|
|
65
|
+
selectedFields: A?.selectedFields,
|
|
66
|
+
dualAxis: A?.dualAxis,
|
|
67
|
+
yAxisRightLabel: A?.yAxisRightLabel,
|
|
68
|
+
logScale: A?.logScale,
|
|
69
|
+
startAtZero: A?.startAtZero,
|
|
70
|
+
yMin: A?.yMin,
|
|
71
|
+
yMax: A?.yMax,
|
|
72
|
+
valueField: A?.valueField,
|
|
73
|
+
labelField: A?.labelField,
|
|
74
|
+
showTotal: A?.showTotal,
|
|
75
|
+
totalLabel: A?.totalLabel,
|
|
76
|
+
xField: A?.xField,
|
|
77
|
+
yField: A?.yField,
|
|
78
|
+
sizeField: A?.sizeField,
|
|
79
|
+
colorField: A?.colorField
|
|
80
|
+
}), [A, g.type]), B = z.type !== "funnel" && (z.type === "combo" || z.dualAxis === !0 || z.series?.some((e) => e.axis === "right" || e.type === "bar") && z.series?.some((e) => e.type === "line") || !1), V = v(() => !P.length || z.type === "pie" || z.type === "funnel" || z.type === "scatter" || z.type === "waterfall" ? [] : (B && z.selectedFields !== void 0 ? n(P, z).map((e) => e.field) : r(P, z.xAxisKey, z.selectedFields)).map((e, t) => ({
|
|
80
81
|
dataKey: e,
|
|
81
|
-
name:
|
|
82
|
-
color:
|
|
83
|
-
hidden:
|
|
82
|
+
name: z.seriesNames?.[e] || e,
|
|
83
|
+
color: z.colors?.[t] || T[t % T.length],
|
|
84
|
+
hidden: j.includes(e)
|
|
84
85
|
})), [
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
]),
|
|
91
|
-
|
|
92
|
-
}, []),
|
|
93
|
-
if (
|
|
94
|
-
let t = e[
|
|
95
|
-
|
|
86
|
+
P,
|
|
87
|
+
z,
|
|
88
|
+
j,
|
|
89
|
+
A?.selectedFields,
|
|
90
|
+
B
|
|
91
|
+
]), H = _((e) => {
|
|
92
|
+
M((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
93
|
+
}, []), U = _((e, t) => {
|
|
94
|
+
if (I) {
|
|
95
|
+
let t = e[A?.labelField || "name"];
|
|
96
|
+
F(e, t);
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
+
O ? O(e) : D && g.drilldowns?.length && D(e, t);
|
|
98
99
|
}, [
|
|
99
|
-
E,
|
|
100
100
|
D,
|
|
101
|
-
|
|
101
|
+
O,
|
|
102
|
+
g.drilldowns,
|
|
103
|
+
I,
|
|
102
104
|
F,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
onDataClick: H
|
|
105
|
+
A?.labelField
|
|
106
|
+
]), W = () => {
|
|
107
|
+
if (B) return /* @__PURE__ */ x(u, {
|
|
108
|
+
data: P,
|
|
109
|
+
config: z,
|
|
110
|
+
hiddenSeries: j,
|
|
111
|
+
onDataClick: U
|
|
111
112
|
});
|
|
112
|
-
switch (
|
|
113
|
-
case "waterfall": return /* @__PURE__ */
|
|
114
|
-
data:
|
|
115
|
-
config:
|
|
116
|
-
onDataClick:
|
|
117
|
-
});
|
|
118
|
-
case "scatter": return /* @__PURE__ */ b(d, {
|
|
119
|
-
data: N,
|
|
120
|
-
config: R,
|
|
121
|
-
onDataClick: H
|
|
113
|
+
switch (z.type) {
|
|
114
|
+
case "waterfall": return /* @__PURE__ */ x(d, {
|
|
115
|
+
data: P,
|
|
116
|
+
config: z,
|
|
117
|
+
onDataClick: U
|
|
122
118
|
});
|
|
123
|
-
case "
|
|
124
|
-
data:
|
|
125
|
-
config:
|
|
126
|
-
|
|
127
|
-
onDataClick: H
|
|
119
|
+
case "scatter": return /* @__PURE__ */ x(f, {
|
|
120
|
+
data: P,
|
|
121
|
+
config: z,
|
|
122
|
+
onDataClick: U
|
|
128
123
|
});
|
|
129
|
-
case "
|
|
130
|
-
data:
|
|
131
|
-
config:
|
|
132
|
-
hiddenSeries:
|
|
133
|
-
onDataClick:
|
|
124
|
+
case "bar": return /* @__PURE__ */ x(a, {
|
|
125
|
+
data: P,
|
|
126
|
+
config: z,
|
|
127
|
+
hiddenSeries: j,
|
|
128
|
+
onDataClick: U
|
|
134
129
|
});
|
|
135
|
-
case "
|
|
136
|
-
data:
|
|
137
|
-
config:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
onDataClick: H
|
|
130
|
+
case "area": return /* @__PURE__ */ x(o, {
|
|
131
|
+
data: P,
|
|
132
|
+
config: z,
|
|
133
|
+
hiddenSeries: j,
|
|
134
|
+
onDataClick: U
|
|
141
135
|
});
|
|
142
|
-
case "
|
|
143
|
-
data:
|
|
144
|
-
config:
|
|
145
|
-
dataKey:
|
|
146
|
-
nameKey:
|
|
147
|
-
onDataClick:
|
|
136
|
+
case "pie": return /* @__PURE__ */ x(s, {
|
|
137
|
+
data: P,
|
|
138
|
+
config: z,
|
|
139
|
+
dataKey: A?.valueField || "value",
|
|
140
|
+
nameKey: A?.labelField || "name",
|
|
141
|
+
onDataClick: U
|
|
148
142
|
});
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
143
|
+
case "funnel": {
|
|
144
|
+
let e = l(P, {
|
|
145
|
+
valueField: A?.valueField,
|
|
146
|
+
labelField: A?.labelField
|
|
147
|
+
});
|
|
148
|
+
return /* @__PURE__ */ x(c, {
|
|
149
|
+
data: P,
|
|
150
|
+
config: z,
|
|
151
|
+
dataKey: e.valueField,
|
|
152
|
+
nameKey: e.labelField,
|
|
153
|
+
onDataClick: U
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
default: return /* @__PURE__ */ x(i, {
|
|
157
|
+
data: P,
|
|
158
|
+
config: z,
|
|
159
|
+
hiddenSeries: j,
|
|
160
|
+
onDataClick: U
|
|
154
161
|
});
|
|
155
162
|
}
|
|
156
163
|
};
|
|
157
|
-
if (
|
|
164
|
+
if (N.kind === "empty") return /* @__PURE__ */ x(m, {
|
|
158
165
|
widgetType: "chart",
|
|
159
166
|
hasDataSource: !0
|
|
160
167
|
});
|
|
161
|
-
if (
|
|
162
|
-
let e =
|
|
163
|
-
return /* @__PURE__ */
|
|
168
|
+
if (N.kind === "unsupported") {
|
|
169
|
+
let e = w[N.shape];
|
|
170
|
+
return /* @__PURE__ */ x(m, {
|
|
164
171
|
widgetType: "chart",
|
|
165
172
|
hasDataSource: !0,
|
|
166
|
-
message: `${
|
|
173
|
+
message: `${k(e.key, e.fallback)} ${k("bigconsole.widget.chart.unsupported.hint", "A chart needs a list of rows. Pick a parser that returns rows, or use a Metric Card for one number.")}`
|
|
167
174
|
});
|
|
168
175
|
}
|
|
169
|
-
return /* @__PURE__ */
|
|
176
|
+
return /* @__PURE__ */ S("div", {
|
|
170
177
|
className: "flex flex-col h-full p-4",
|
|
171
178
|
children: [
|
|
172
|
-
|
|
179
|
+
R && /* @__PURE__ */ x("div", {
|
|
173
180
|
className: "flex items-center gap-2 mb-2 -mt-1",
|
|
174
|
-
children: /* @__PURE__ */
|
|
181
|
+
children: /* @__PURE__ */ S("button", {
|
|
175
182
|
type: "button",
|
|
176
183
|
onClick: (e) => {
|
|
177
|
-
e.stopPropagation(),
|
|
184
|
+
e.stopPropagation(), L();
|
|
178
185
|
},
|
|
179
186
|
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 ",
|
|
180
|
-
children: [/* @__PURE__ */
|
|
187
|
+
children: [/* @__PURE__ */ x("svg", {
|
|
181
188
|
className: "w-3.5 h-3.5",
|
|
182
189
|
fill: "none",
|
|
183
190
|
stroke: "currentColor",
|
|
184
191
|
viewBox: "0 0 24 24",
|
|
185
|
-
children: /* @__PURE__ */
|
|
192
|
+
children: /* @__PURE__ */ x("path", {
|
|
186
193
|
strokeLinecap: "round",
|
|
187
194
|
strokeLinejoin: "round",
|
|
188
195
|
strokeWidth: 2,
|
|
@@ -191,21 +198,21 @@ var S = [], C = {
|
|
|
191
198
|
}), "Clear Filter"]
|
|
192
199
|
})
|
|
193
200
|
}),
|
|
194
|
-
|
|
195
|
-
items:
|
|
201
|
+
z.legendPosition === "top" && V.length > 0 && /* @__PURE__ */ x(p, {
|
|
202
|
+
items: V,
|
|
196
203
|
position: "top",
|
|
197
|
-
onItemClick:
|
|
204
|
+
onItemClick: H
|
|
198
205
|
}),
|
|
199
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ x("div", {
|
|
200
207
|
className: "flex-1 min-h-0",
|
|
201
|
-
children:
|
|
208
|
+
children: W()
|
|
202
209
|
}),
|
|
203
|
-
|
|
204
|
-
items:
|
|
210
|
+
z.legendPosition === "bottom" && V.length > 0 && /* @__PURE__ */ x(p, {
|
|
211
|
+
items: V,
|
|
205
212
|
position: "bottom",
|
|
206
|
-
onItemClick:
|
|
213
|
+
onItemClick: H
|
|
207
214
|
})
|
|
208
215
|
]
|
|
209
216
|
});
|
|
210
217
|
});
|
|
211
|
-
export {
|
|
218
|
+
export { E as ChartWidget, E as default };
|
|
@@ -6,3 +6,19 @@ export declare function funnelStages(data: ChartData[], valueField: string, labe
|
|
|
6
6
|
label: string;
|
|
7
7
|
conversion: number | undefined;
|
|
8
8
|
}[] | null;
|
|
9
|
+
/**
|
|
10
|
+
* The value and label fields a funnel should read (BOFF-10138).
|
|
11
|
+
*
|
|
12
|
+
* The configured fields win when every row holds them. Otherwise `value` / `name` (the
|
|
13
|
+
* historical defaults), then the first field every row holds: a count that is not itself a
|
|
14
|
+
* rate (`count`, not `conversionRate`) and a non-empty label (`stage`). Generated consoles
|
|
15
|
+
* send stage rows such as `{ stage, count, conversionRate }` with no field mapping, which
|
|
16
|
+
* left the funnel saying its rows had no label or value.
|
|
17
|
+
*/
|
|
18
|
+
export declare function funnelFields(rows: ChartData[], configured?: {
|
|
19
|
+
valueField?: string;
|
|
20
|
+
labelField?: string;
|
|
21
|
+
}): {
|
|
22
|
+
valueField: string;
|
|
23
|
+
labelField: string;
|
|
24
|
+
};
|
|
@@ -13,4 +13,15 @@ function e(e, t, n) {
|
|
|
13
13
|
};
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
var t = (e) => typeof e == "number" && Number.isFinite(e) && e >= 0, n = (e) => (typeof e == "string" || typeof e == "number") && String(e).trim() !== "", r = /rate|percent|pct|ratio|conversion/i;
|
|
17
|
+
function i(e, t, n) {
|
|
18
|
+
return !!t && e.length > 0 && e.every((e) => n(e?.[t]));
|
|
19
|
+
}
|
|
20
|
+
function a(e, a = {}) {
|
|
21
|
+
let o = e.length > 0 ? Object.keys(e[0] ?? {}) : [], s = [a.valueField, "value"].find((n) => i(e, n, t)) ?? o.find((n) => !r.test(n) && i(e, n, t)) ?? a.valueField ?? "value";
|
|
22
|
+
return {
|
|
23
|
+
valueField: s,
|
|
24
|
+
labelField: [a.labelField, "name"].find((t) => i(e, t, n)) ?? o.find((t) => t !== s && i(e, t, (e) => typeof e == "string" && e.trim() !== "")) ?? a.labelField ?? "name"
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export { a as funnelFields, e as funnelStages };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { toHeatmapData as e } from "./heatmapData.js";
|
|
2
|
+
import { memo as t, useCallback as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
3
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
3
4
|
// src/bigconsole/components/widgets/heatmap/HeatmapWidget.tsx
|
|
4
|
-
var
|
|
5
|
+
var l = {
|
|
5
6
|
blue: [
|
|
6
7
|
"bg-action-primary-bg/10",
|
|
7
8
|
"bg-action-primary-bg/30",
|
|
@@ -24,59 +25,59 @@ var c = {
|
|
|
24
25
|
"bg-status-error-bg/90"
|
|
25
26
|
]
|
|
26
27
|
};
|
|
27
|
-
function
|
|
28
|
-
return
|
|
28
|
+
function u(e) {
|
|
29
|
+
return l[e ?? "blue"] ?? l.blue;
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
+
function d(e, t) {
|
|
31
32
|
return t.onDrilldown ? (t.onDrilldown({
|
|
32
33
|
row: e.row,
|
|
33
34
|
column: e.column,
|
|
34
35
|
value: e.value
|
|
35
36
|
}), !0) : t.onClick && t.hasLegacyDrilldowns ? (t.onClick(e), !0) : !1;
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
+
function f(e, t, n) {
|
|
38
39
|
return e + t < n - 1;
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
+
function p(e, t, n, r = "blue") {
|
|
41
42
|
let i = Math.max(0, Math.min(1, (e - t) / (n - t || 1)));
|
|
42
|
-
return
|
|
43
|
+
return u(r)[i < .2 ? 0 : i < .4 ? 1 : i < .6 ? 2 : i < .8 ? 3 : 4];
|
|
43
44
|
}
|
|
44
|
-
var
|
|
45
|
-
let
|
|
45
|
+
var m = t(function({ widget: t, data: l, onClick: m, onDrilldown: h }) {
|
|
46
|
+
let g = t.config, _ = i(() => e(l, g ?? {}), [l, g]), v = i(() => {
|
|
46
47
|
let e = /* @__PURE__ */ new Map();
|
|
47
|
-
return
|
|
48
|
+
return _?.cells && Array.isArray(_.cells) && _.cells.forEach((t) => {
|
|
48
49
|
e.set(`${t.row}:${t.column}`, t.value);
|
|
49
50
|
}), e;
|
|
50
|
-
}, [
|
|
51
|
-
if (!
|
|
51
|
+
}, [_?.cells]), { minValue: y, maxValue: b } = i(() => {
|
|
52
|
+
if (!_?.cells || !Array.isArray(_.cells) || !_.cells.length) return {
|
|
52
53
|
minValue: 0,
|
|
53
54
|
maxValue: 100
|
|
54
55
|
};
|
|
55
|
-
let e =
|
|
56
|
+
let e = _.cells.map((e) => e.value);
|
|
56
57
|
return {
|
|
57
|
-
minValue:
|
|
58
|
-
maxValue:
|
|
58
|
+
minValue: _.minValue ?? Math.min(...e),
|
|
59
|
+
maxValue: _.maxValue ?? Math.max(...e)
|
|
59
60
|
};
|
|
60
|
-
}, [
|
|
61
|
-
|
|
62
|
-
row:
|
|
61
|
+
}, [_]), x = !!(m && t.drilldowns?.length), S = n((e, n, r) => {
|
|
62
|
+
d({
|
|
63
|
+
row: e,
|
|
63
64
|
column: n,
|
|
64
65
|
value: r
|
|
65
66
|
}, {
|
|
66
|
-
onDrilldown:
|
|
67
|
-
onClick:
|
|
68
|
-
hasLegacyDrilldowns: !!
|
|
67
|
+
onDrilldown: h,
|
|
68
|
+
onClick: m,
|
|
69
|
+
hasLegacyDrilldowns: !!t.drilldowns?.length
|
|
69
70
|
});
|
|
70
71
|
}, [
|
|
72
|
+
h,
|
|
71
73
|
m,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
let e = S.current;
|
|
74
|
+
t.drilldowns
|
|
75
|
+
]), C = !!h || x, w = a(null), [T, E] = o(!1), [D, O] = o(!1), k = Array.isArray(_?.rows) ? _.rows.length : 0;
|
|
76
|
+
return r(() => {
|
|
77
|
+
let e = w.current;
|
|
77
78
|
if (!e) return;
|
|
78
79
|
let t = () => {
|
|
79
|
-
|
|
80
|
+
O(e.scrollHeight > e.clientHeight + 1), E(f(e.scrollTop, e.clientHeight, e.scrollHeight));
|
|
80
81
|
};
|
|
81
82
|
t(), e.addEventListener("scroll", t, { passive: !0 });
|
|
82
83
|
let n = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
|
|
@@ -85,64 +86,64 @@ var p = e(function({ widget: e, data: c, onClick: p, onDrilldown: m }) {
|
|
|
85
86
|
return r && n?.observe(r), () => {
|
|
86
87
|
e.removeEventListener("scroll", t), n?.disconnect();
|
|
87
88
|
};
|
|
88
|
-
}, [
|
|
89
|
+
}, [k]), !_ || !Array.isArray(_.rows) || !Array.isArray(_.columns) || !_.rows.length || !_.columns.length ? /* @__PURE__ */ s("div", {
|
|
89
90
|
className: "flex items-center justify-center h-full text-text-secondary text-sm",
|
|
90
91
|
children: "No heatmap data available"
|
|
91
|
-
}) : /* @__PURE__ */
|
|
92
|
+
}) : /* @__PURE__ */ c("div", {
|
|
92
93
|
className: "flex h-full min-h-0 flex-col gap-2",
|
|
93
|
-
children: [/* @__PURE__ */
|
|
94
|
+
children: [/* @__PURE__ */ c("div", {
|
|
94
95
|
className: "relative min-h-0 flex-1",
|
|
95
|
-
children: [/* @__PURE__ */
|
|
96
|
-
ref:
|
|
96
|
+
children: [/* @__PURE__ */ s("div", {
|
|
97
|
+
ref: w,
|
|
97
98
|
className: "h-full overflow-auto focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-action-primary-bg",
|
|
98
|
-
tabIndex:
|
|
99
|
-
role:
|
|
100
|
-
"aria-label":
|
|
101
|
-
children: /* @__PURE__ */
|
|
99
|
+
tabIndex: D ? 0 : void 0,
|
|
100
|
+
role: D ? "region" : void 0,
|
|
101
|
+
"aria-label": D ? `${t.title || "Heatmap"}: scroll for more rows` : void 0,
|
|
102
|
+
children: /* @__PURE__ */ c("table", {
|
|
102
103
|
className: "h-full w-full border-separate border-spacing-0.5",
|
|
103
|
-
children: [/* @__PURE__ */
|
|
104
|
+
children: [/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ c("tr", { children: [/* @__PURE__ */ s("th", { className: "sticky top-0 z-[1] bg-bg-surface px-2 py-1 text-xs text-text-secondary text-left" }), _.columns.map((e) => /* @__PURE__ */ s("th", {
|
|
104
105
|
scope: "col",
|
|
105
106
|
className: "sticky top-0 z-[1] bg-bg-surface px-2 py-1 text-xs font-medium text-text-secondary text-center min-w-[60px]",
|
|
106
107
|
children: e
|
|
107
|
-
}, e))] }) }), /* @__PURE__ */
|
|
108
|
+
}, e))] }) }), /* @__PURE__ */ s("tbody", { children: _.rows.map((e) => /* @__PURE__ */ c("tr", { children: [/* @__PURE__ */ s("th", {
|
|
108
109
|
scope: "row",
|
|
109
110
|
className: "px-2 py-0.5 text-xs font-medium text-text-secondary text-left whitespace-nowrap",
|
|
110
111
|
children: e
|
|
111
|
-
}),
|
|
112
|
-
let n =
|
|
113
|
-
return /* @__PURE__ */
|
|
112
|
+
}), _.columns.map((t) => {
|
|
113
|
+
let n = v.get(`${e}:${t}`) ?? 0, r = p(n, y, b, g?.colorScheme);
|
|
114
|
+
return /* @__PURE__ */ s("td", {
|
|
114
115
|
className: `
|
|
115
116
|
h-6 rounded px-2 py-0.5 text-center text-xs align-middle
|
|
116
117
|
${r}
|
|
117
|
-
${
|
|
118
|
+
${C ? "cursor-pointer hover:ring-2 hover:ring-inset hover:ring-action-primary-bg" : ""}
|
|
118
119
|
transition-all
|
|
119
120
|
`,
|
|
120
|
-
onClick: () =>
|
|
121
|
+
onClick: () => S(e, t, n),
|
|
121
122
|
title: `${e} / ${t}: ${n}`,
|
|
122
|
-
children:
|
|
123
|
+
children: g?.showValues !== !1 && /* @__PURE__ */ s("span", {
|
|
123
124
|
className: "text-xs font-medium text-text-primary",
|
|
124
|
-
children: typeof n == "number" ? n.toFixed(
|
|
125
|
+
children: typeof n == "number" ? n.toFixed(g?.decimals || 0) : n
|
|
125
126
|
})
|
|
126
127
|
}, t);
|
|
127
128
|
})] }, e)) })]
|
|
128
129
|
})
|
|
129
|
-
}),
|
|
130
|
+
}), T && /* @__PURE__ */ s("div", {
|
|
130
131
|
"aria-hidden": "true",
|
|
131
132
|
"data-testid": "heatmap-more-below",
|
|
132
133
|
className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-bg-surface to-bg-surface/0"
|
|
133
134
|
})]
|
|
134
|
-
}),
|
|
135
|
+
}), g?.showLegend !== !1 && /* @__PURE__ */ c("div", {
|
|
135
136
|
className: "flex shrink-0 items-center justify-center gap-2",
|
|
136
137
|
children: [
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ s("span", {
|
|
138
139
|
className: "text-xs text-text-secondary",
|
|
139
140
|
children: "Low"
|
|
140
141
|
}),
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ s("div", {
|
|
142
143
|
className: "flex gap-0.5",
|
|
143
|
-
children:
|
|
144
|
+
children: u(g?.colorScheme).map((e) => /* @__PURE__ */ s("div", { className: `w-6 h-4 rounded ${e}` }, e))
|
|
144
145
|
}),
|
|
145
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ s("span", {
|
|
146
147
|
className: "text-xs text-text-secondary",
|
|
147
148
|
children: "High"
|
|
148
149
|
})
|
|
@@ -150,4 +151,4 @@ var p = e(function({ widget: e, data: c, onClick: p, onDrilldown: m }) {
|
|
|
150
151
|
})]
|
|
151
152
|
});
|
|
152
153
|
});
|
|
153
|
-
export {
|
|
154
|
+
export { m as HeatmapWidget, m as default, d as dispatchHeatmapCellClick, f as hasMoreBelow };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HeatmapData } from './HeatmapWidget';
|
|
2
|
+
export interface HeatmapFieldConfig {
|
|
3
|
+
/** Column field (x axis). */
|
|
4
|
+
xAxisField?: string;
|
|
5
|
+
/** Row field (y axis). */
|
|
6
|
+
yAxisField?: string;
|
|
7
|
+
valueField?: string;
|
|
8
|
+
}
|
|
9
|
+
/** The grid to draw, or null when the data cannot make one. */
|
|
10
|
+
export declare function toHeatmapData(data: unknown, config?: HeatmapFieldConfig): HeatmapData | null;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// src/bigconsole/components/widgets/heatmap/heatmapData.ts
|
|
2
|
+
var e = (e) => typeof e == "object" && !!e && !Array.isArray(e), t = (e) => {
|
|
3
|
+
if (typeof e == "number") return Number.isFinite(e) ? e : void 0;
|
|
4
|
+
if (typeof e == "string" && e.trim() !== "") {
|
|
5
|
+
let t = Number(e);
|
|
6
|
+
return Number.isFinite(t) ? t : void 0;
|
|
7
|
+
}
|
|
8
|
+
}, n = (e) => typeof e == "string" && e.trim() !== "" && t(e) === void 0 || typeof e == "boolean";
|
|
9
|
+
function r(t) {
|
|
10
|
+
return e(t) && Array.isArray(t.rows) && Array.isArray(t.columns) && Array.isArray(t.cells);
|
|
11
|
+
}
|
|
12
|
+
function i(e, t, n) {
|
|
13
|
+
if (t) return e.some((e) => n(e[t])) ? t : void 0;
|
|
14
|
+
}
|
|
15
|
+
function a(e, t, n) {
|
|
16
|
+
for (let r of e) for (let [e, i] of Object.entries(r)) if (!n.includes(e) && t(i)) return e;
|
|
17
|
+
}
|
|
18
|
+
function o(e) {
|
|
19
|
+
return [...new Set(e)];
|
|
20
|
+
}
|
|
21
|
+
function s(e) {
|
|
22
|
+
if (e.length === 0) return null;
|
|
23
|
+
let t = /* @__PURE__ */ new Map();
|
|
24
|
+
for (let n of e) {
|
|
25
|
+
let e = `${n.row}\u0000${n.column}`, r = t.get(e);
|
|
26
|
+
t.set(e, r ? {
|
|
27
|
+
...r,
|
|
28
|
+
value: r.value + n.value
|
|
29
|
+
} : n);
|
|
30
|
+
}
|
|
31
|
+
let n = [...t.values()];
|
|
32
|
+
return {
|
|
33
|
+
rows: o(n.map((e) => e.row)),
|
|
34
|
+
columns: o(n.map((e) => e.column)),
|
|
35
|
+
cells: n
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function c(e, r) {
|
|
39
|
+
let o = i(e, r.valueField, (e) => t(e) !== void 0) ?? a(e, (e) => typeof e == "number" && Number.isFinite(e), []);
|
|
40
|
+
if (!o) return null;
|
|
41
|
+
let c = i(e, r.yAxisField, n) ?? a(e, n, [o]);
|
|
42
|
+
if (!c) return null;
|
|
43
|
+
let l = i(e, r.xAxisField, n) ?? a(e, n, [o, c]), u = [];
|
|
44
|
+
for (let r of e) {
|
|
45
|
+
let e = t(r[o]);
|
|
46
|
+
if (e === void 0 || !n(r[c])) continue;
|
|
47
|
+
let i = l && n(r[l]) ? String(r[l]) : o;
|
|
48
|
+
(!l || n(r[l])) && u.push({
|
|
49
|
+
row: String(r[c]),
|
|
50
|
+
column: i,
|
|
51
|
+
value: e
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return s(u);
|
|
55
|
+
}
|
|
56
|
+
function l(n) {
|
|
57
|
+
let r = Object.entries(n);
|
|
58
|
+
if (r.length === 0 || !r.every(([, t]) => e(t))) return null;
|
|
59
|
+
let i = [];
|
|
60
|
+
for (let [e, n] of r) for (let [r, a] of Object.entries(n)) {
|
|
61
|
+
let n = t(a);
|
|
62
|
+
n !== void 0 && i.push({
|
|
63
|
+
row: e,
|
|
64
|
+
column: r,
|
|
65
|
+
value: n
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return s(i);
|
|
69
|
+
}
|
|
70
|
+
function u(t) {
|
|
71
|
+
for (let n of [
|
|
72
|
+
"data",
|
|
73
|
+
"items",
|
|
74
|
+
"records",
|
|
75
|
+
"results",
|
|
76
|
+
"values"
|
|
77
|
+
]) {
|
|
78
|
+
let r = t[n];
|
|
79
|
+
if (Array.isArray(r) && r.length > 0 && r.every(e)) return r;
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
function d(t, n = {}) {
|
|
84
|
+
if (r(t)) return t;
|
|
85
|
+
if (Array.isArray(t)) {
|
|
86
|
+
let r = t.filter(e);
|
|
87
|
+
return r.length > 0 ? c(r, n) : null;
|
|
88
|
+
}
|
|
89
|
+
if (e(t)) {
|
|
90
|
+
let e = u(t);
|
|
91
|
+
return e ? c(e, n) : l(t);
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
export { d as toHeatmapData };
|