@burdenoff/microfe-bigconsole 2026.1103.10 → 2026.1104.1
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/embed/widgets/HeatmapEmbed.js +6 -3
- package/dist/bigconsole/components/widgets/chart/ChartConfig.js +130 -121
- package/dist/bigconsole/components/widgets/chart/ReferenceLinesEditor.d.ts +8 -0
- package/dist/bigconsole/components/widgets/chart/ReferenceLinesEditor.js +159 -0
- package/dist/bigconsole/components/widgets/chart/charts/referenceElements.d.ts +2 -1
- package/dist/bigconsole/components/widgets/chart/charts/referenceElements.js +8 -4
- package/dist/bigconsole/components/widgets/chart/referenceLineDraft.d.ts +29 -0
- package/dist/bigconsole/components/widgets/chart/referenceLineDraft.js +58 -0
- package/dist/bigconsole/components/widgets/heatmap/HeatmapWidget.d.ts +5 -0
- package/dist/bigconsole/components/widgets/heatmap/HeatmapWidget.js +81 -58
- package/dist/bigconsole/pages/InsightsPage.js +1 -1
- package/dist/bigconsole/pages/WidgetDemoPage.js +1 -1
- package/package.json +1 -1
|
@@ -23,9 +23,12 @@ function f({ widget: f }) {
|
|
|
23
23
|
}, [f.data]);
|
|
24
24
|
return /* @__PURE__ */ l(o, {
|
|
25
25
|
title: f.title,
|
|
26
|
-
children: /* @__PURE__ */ l(
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
children: /* @__PURE__ */ l("div", {
|
|
27
|
+
className: "h-full p-3",
|
|
28
|
+
children: /* @__PURE__ */ l(s, {
|
|
29
|
+
widget: p,
|
|
30
|
+
data: m
|
|
31
|
+
})
|
|
29
32
|
})
|
|
30
33
|
});
|
|
31
34
|
}
|
|
@@ -1,253 +1,262 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { normalizeReferenceLines as e, toReferenceLinesConfig as t } from "./referenceLineDraft.js";
|
|
2
|
+
import { ReferenceLinesEditor as n } from "./ReferenceLinesEditor.js";
|
|
3
|
+
import { memo as r, useCallback as i, useMemo as a } from "react";
|
|
4
|
+
import { useI18n as o } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
5
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
4
6
|
//#region src/bigconsole/components/widgets/chart/ChartConfig.tsx
|
|
5
|
-
var
|
|
6
|
-
let { t:
|
|
7
|
+
var u = r(function({ config: r, onChange: u }) {
|
|
8
|
+
let { t: d } = o(), f = a(() => [
|
|
7
9
|
{
|
|
8
10
|
value: "line",
|
|
9
|
-
label:
|
|
11
|
+
label: d("bigconsole.widget.config.chart.type.line", "Line Chart")
|
|
10
12
|
},
|
|
11
13
|
{
|
|
12
14
|
value: "bar",
|
|
13
|
-
label:
|
|
15
|
+
label: d("bigconsole.widget.config.chart.type.bar", "Bar Chart")
|
|
14
16
|
},
|
|
15
17
|
{
|
|
16
18
|
value: "area",
|
|
17
|
-
label:
|
|
19
|
+
label: d("bigconsole.widget.config.chart.type.area", "Area Chart")
|
|
18
20
|
},
|
|
19
21
|
{
|
|
20
22
|
value: "pie",
|
|
21
|
-
label:
|
|
23
|
+
label: d("bigconsole.widget.config.chart.type.pie", "Pie Chart")
|
|
22
24
|
},
|
|
23
25
|
{
|
|
24
26
|
value: "funnel",
|
|
25
|
-
label:
|
|
27
|
+
label: d("bigconsole.widget.config.chart.type.funnel", "Funnel Chart")
|
|
26
28
|
}
|
|
27
|
-
], [
|
|
29
|
+
], [d]), p = a(() => [
|
|
28
30
|
{
|
|
29
31
|
value: "monotone",
|
|
30
|
-
label:
|
|
32
|
+
label: d("bigconsole.widget.config.chart.curve.smooth", "Smooth")
|
|
31
33
|
},
|
|
32
34
|
{
|
|
33
35
|
value: "linear",
|
|
34
|
-
label:
|
|
36
|
+
label: d("bigconsole.widget.config.chart.curve.linear", "Linear")
|
|
35
37
|
},
|
|
36
38
|
{
|
|
37
39
|
value: "step",
|
|
38
|
-
label:
|
|
40
|
+
label: d("bigconsole.widget.config.chart.curve.step", "Step")
|
|
39
41
|
},
|
|
40
42
|
{
|
|
41
43
|
value: "natural",
|
|
42
|
-
label:
|
|
44
|
+
label: d("bigconsole.widget.config.chart.curve.natural", "Natural")
|
|
43
45
|
}
|
|
44
|
-
], [
|
|
46
|
+
], [d]), m = a(() => [
|
|
45
47
|
{
|
|
46
48
|
value: "top",
|
|
47
|
-
label:
|
|
49
|
+
label: d("bigconsole.widget.config.chart.legendPosition.top", "Top")
|
|
48
50
|
},
|
|
49
51
|
{
|
|
50
52
|
value: "bottom",
|
|
51
|
-
label:
|
|
53
|
+
label: d("bigconsole.widget.config.chart.legendPosition.bottom", "Bottom")
|
|
52
54
|
},
|
|
53
55
|
{
|
|
54
56
|
value: "left",
|
|
55
|
-
label:
|
|
57
|
+
label: d("bigconsole.widget.config.chart.legendPosition.left", "Left")
|
|
56
58
|
},
|
|
57
59
|
{
|
|
58
60
|
value: "right",
|
|
59
|
-
label:
|
|
61
|
+
label: d("bigconsole.widget.config.chart.legendPosition.right", "Right")
|
|
60
62
|
}
|
|
61
|
-
], [
|
|
62
|
-
|
|
63
|
-
...
|
|
64
|
-
[
|
|
63
|
+
], [d]), h = i((e, t) => {
|
|
64
|
+
u({
|
|
65
|
+
...r,
|
|
66
|
+
[e]: t
|
|
65
67
|
});
|
|
66
|
-
}, [
|
|
67
|
-
return /* @__PURE__ */
|
|
68
|
+
}, [r, u]), g = r.chartType === "pie" || r.chartType === "funnel", _ = a(() => e(r.referenceLines), [r.referenceLines]);
|
|
69
|
+
return /* @__PURE__ */ l("div", {
|
|
68
70
|
className: "min-w-0 space-y-form-gap",
|
|
69
71
|
children: [
|
|
70
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
71
73
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
72
|
-
children:
|
|
73
|
-
}), /* @__PURE__ */
|
|
74
|
-
value:
|
|
75
|
-
onChange: (e) =>
|
|
74
|
+
children: d("bigconsole.widget.config.chart.chartTypeLabel", "Chart Type")
|
|
75
|
+
}), /* @__PURE__ */ c("select", {
|
|
76
|
+
value: r.chartType || "line",
|
|
77
|
+
onChange: (e) => h("chartType", e.target.value),
|
|
76
78
|
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 ",
|
|
77
|
-
children:
|
|
79
|
+
children: f.map((e) => /* @__PURE__ */ c("option", {
|
|
78
80
|
value: e.value,
|
|
79
81
|
children: e.label
|
|
80
82
|
}, e.value))
|
|
81
83
|
})] }),
|
|
82
|
-
!
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
+
!g && /* @__PURE__ */ l(s, { children: [
|
|
85
|
+
/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
84
86
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
85
|
-
children:
|
|
86
|
-
}), /* @__PURE__ */
|
|
87
|
+
children: d("bigconsole.widget.config.chart.xAxisFieldLabel", "X-Axis Field")
|
|
88
|
+
}), /* @__PURE__ */ c("input", {
|
|
87
89
|
type: "text",
|
|
88
|
-
value:
|
|
89
|
-
onChange: (e) =>
|
|
90
|
-
placeholder:
|
|
90
|
+
value: r.xAxisField || "",
|
|
91
|
+
onChange: (e) => h("xAxisField", e.target.value),
|
|
92
|
+
placeholder: d("bigconsole.widget.config.chart.xAxisFieldPlaceholder", "e.g., date, category"),
|
|
91
93
|
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 "
|
|
92
94
|
})] }),
|
|
93
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ l("div", {
|
|
94
96
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
|
|
95
|
-
children: [/* @__PURE__ */
|
|
97
|
+
children: [/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
96
98
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
97
|
-
children:
|
|
98
|
-
}), /* @__PURE__ */
|
|
99
|
+
children: d("bigconsole.widget.config.chart.xAxisLabelLabel", "X-Axis Label")
|
|
100
|
+
}), /* @__PURE__ */ c("input", {
|
|
99
101
|
type: "text",
|
|
100
|
-
value:
|
|
101
|
-
onChange: (e) =>
|
|
102
|
-
placeholder:
|
|
102
|
+
value: r.xAxisLabel || "",
|
|
103
|
+
onChange: (e) => h("xAxisLabel", e.target.value),
|
|
104
|
+
placeholder: d("bigconsole.widget.config.chart.optionalPlaceholder", "Optional"),
|
|
103
105
|
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 "
|
|
104
|
-
})] }), /* @__PURE__ */
|
|
106
|
+
})] }), /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
105
107
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
106
|
-
children:
|
|
107
|
-
}), /* @__PURE__ */
|
|
108
|
+
children: d("bigconsole.widget.config.chart.yAxisLabelLabel", "Y-Axis Label")
|
|
109
|
+
}), /* @__PURE__ */ c("input", {
|
|
108
110
|
type: "text",
|
|
109
|
-
value:
|
|
110
|
-
onChange: (e) =>
|
|
111
|
-
placeholder:
|
|
111
|
+
value: r.yAxisLabel || "",
|
|
112
|
+
onChange: (e) => h("yAxisLabel", e.target.value),
|
|
113
|
+
placeholder: d("bigconsole.widget.config.chart.optionalPlaceholder", "Optional"),
|
|
112
114
|
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 "
|
|
113
115
|
})] })]
|
|
114
116
|
}),
|
|
115
|
-
(
|
|
117
|
+
(r.chartType === "line" || r.chartType === "area") && /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
116
118
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
117
|
-
children:
|
|
118
|
-
}), /* @__PURE__ */
|
|
119
|
-
value:
|
|
120
|
-
onChange: (e) =>
|
|
119
|
+
children: d("bigconsole.widget.config.chart.curveTypeLabel", "Curve Type")
|
|
120
|
+
}), /* @__PURE__ */ c("select", {
|
|
121
|
+
value: r.curveType || "monotone",
|
|
122
|
+
onChange: (e) => h("curveType", e.target.value),
|
|
121
123
|
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 ",
|
|
122
|
-
children:
|
|
124
|
+
children: p.map((e) => /* @__PURE__ */ c("option", {
|
|
123
125
|
value: e.value,
|
|
124
126
|
children: e.label
|
|
125
127
|
}, e.value))
|
|
126
128
|
})] })
|
|
127
129
|
] }),
|
|
128
|
-
|
|
130
|
+
g && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ l("div", {
|
|
129
131
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
|
|
130
|
-
children: [/* @__PURE__ */
|
|
132
|
+
children: [/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
131
133
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
132
|
-
children:
|
|
133
|
-
}), /* @__PURE__ */
|
|
134
|
+
children: d("bigconsole.widget.config.chart.valueFieldLabel", "Value Field")
|
|
135
|
+
}), /* @__PURE__ */ c("input", {
|
|
134
136
|
type: "text",
|
|
135
|
-
value:
|
|
136
|
-
onChange: (e) =>
|
|
137
|
-
placeholder:
|
|
137
|
+
value: r.valueField || "",
|
|
138
|
+
onChange: (e) => h("valueField", e.target.value),
|
|
139
|
+
placeholder: d("bigconsole.widget.config.chart.valueFieldPlaceholder", "e.g., value"),
|
|
138
140
|
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 "
|
|
139
|
-
})] }), /* @__PURE__ */
|
|
141
|
+
})] }), /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
140
142
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
141
|
-
children:
|
|
142
|
-
}), /* @__PURE__ */
|
|
143
|
+
children: d("bigconsole.widget.config.chart.labelFieldLabel", "Label Field")
|
|
144
|
+
}), /* @__PURE__ */ c("input", {
|
|
143
145
|
type: "text",
|
|
144
|
-
value:
|
|
145
|
-
onChange: (e) =>
|
|
146
|
-
placeholder:
|
|
146
|
+
value: r.labelField || "",
|
|
147
|
+
onChange: (e) => h("labelField", e.target.value),
|
|
148
|
+
placeholder: d("bigconsole.widget.config.chart.labelFieldPlaceholder", "e.g., name"),
|
|
147
149
|
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 "
|
|
148
150
|
})] })]
|
|
149
|
-
}),
|
|
151
|
+
}), r.chartType === "pie" && /* @__PURE__ */ l("label", {
|
|
150
152
|
className: "flex items-center gap-3",
|
|
151
|
-
children: [/* @__PURE__ */
|
|
153
|
+
children: [/* @__PURE__ */ c("input", {
|
|
152
154
|
type: "checkbox",
|
|
153
|
-
checked:
|
|
154
|
-
onChange: (e) =>
|
|
155
|
+
checked: r.showAsDonut === !0,
|
|
156
|
+
onChange: (e) => h("showAsDonut", e.target.checked),
|
|
155
157
|
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 "
|
|
156
|
-
}), /* @__PURE__ */
|
|
158
|
+
}), /* @__PURE__ */ c("span", {
|
|
157
159
|
className: "text-sm text-text-primary",
|
|
158
|
-
children:
|
|
160
|
+
children: d("bigconsole.widget.config.chart.showAsDonut", "Show as Donut")
|
|
159
161
|
})]
|
|
160
162
|
})] }),
|
|
161
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
162
164
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
163
|
-
children:
|
|
164
|
-
}), /* @__PURE__ */
|
|
165
|
-
value:
|
|
166
|
-
onChange: (e) =>
|
|
165
|
+
children: d("bigconsole.widget.config.chart.legendPositionLabel", "Legend Position")
|
|
166
|
+
}), /* @__PURE__ */ c("select", {
|
|
167
|
+
value: r.legendPosition || "bottom",
|
|
168
|
+
onChange: (e) => h("legendPosition", e.target.value),
|
|
167
169
|
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 ",
|
|
168
|
-
children:
|
|
170
|
+
children: m.map((e) => /* @__PURE__ */ c("option", {
|
|
169
171
|
value: e.value,
|
|
170
172
|
children: e.label
|
|
171
173
|
}, e.value))
|
|
172
174
|
})] }),
|
|
173
|
-
!
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
+
!g && /* @__PURE__ */ l("div", { children: [
|
|
176
|
+
/* @__PURE__ */ c("label", {
|
|
175
177
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
176
|
-
children:
|
|
178
|
+
children: d("bigconsole.widget.config.chart.fieldsToDisplayLabel", "Fields to Display")
|
|
177
179
|
}),
|
|
178
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ c("p", {
|
|
179
181
|
className: "text-xs text-text-secondary mb-2",
|
|
180
|
-
children:
|
|
182
|
+
children: d("bigconsole.widget.config.chart.fieldsToDisplayHelp", "Select which numeric fields to show as chart series. Leave empty to show all.")
|
|
181
183
|
}),
|
|
182
|
-
/* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ c("input", {
|
|
183
185
|
type: "text",
|
|
184
|
-
value:
|
|
186
|
+
value: r.selectedFields?.join(", ") || "",
|
|
185
187
|
onChange: (e) => {
|
|
186
188
|
let t = e.target.value.trim(), n = t ? t.split(",").map((e) => e.trim()).filter(Boolean) : [];
|
|
187
|
-
|
|
189
|
+
h("selectedFields", n.length > 0 ? n : void 0);
|
|
188
190
|
},
|
|
189
|
-
placeholder:
|
|
191
|
+
placeholder: d("bigconsole.widget.config.chart.fieldsToDisplayPlaceholder", "e.g., revenue, orders, users (comma-separated)"),
|
|
190
192
|
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 "
|
|
191
193
|
}),
|
|
192
|
-
/* @__PURE__ */
|
|
194
|
+
/* @__PURE__ */ c("p", {
|
|
193
195
|
className: "text-xs text-text-muted mt-1",
|
|
194
|
-
children:
|
|
196
|
+
children: d("bigconsole.widget.config.chart.fieldsToDisplayHint", "Enter field names separated by commas")
|
|
195
197
|
})
|
|
196
198
|
] }),
|
|
197
|
-
/* @__PURE__ */
|
|
199
|
+
!g && /* @__PURE__ */ c("div", {
|
|
200
|
+
className: "border-t border-[var(--color-border-subtle)] pt-form-gap",
|
|
201
|
+
children: /* @__PURE__ */ c(n, {
|
|
202
|
+
lines: _,
|
|
203
|
+
onChange: (e) => h("referenceLines", t(e))
|
|
204
|
+
})
|
|
205
|
+
}),
|
|
206
|
+
/* @__PURE__ */ l("div", {
|
|
198
207
|
role: "group",
|
|
199
208
|
"aria-label": "Display options",
|
|
200
209
|
className: "space-y-3 border-t border-[var(--color-border-subtle)] pt-form-gap",
|
|
201
210
|
children: [
|
|
202
|
-
/* @__PURE__ */
|
|
211
|
+
/* @__PURE__ */ c("p", {
|
|
203
212
|
className: "text-xs font-bold uppercase tracking-wider text-text-secondary",
|
|
204
213
|
children: "Display options"
|
|
205
214
|
}),
|
|
206
|
-
/* @__PURE__ */
|
|
215
|
+
/* @__PURE__ */ l("label", {
|
|
207
216
|
className: "flex items-center gap-3",
|
|
208
|
-
children: [/* @__PURE__ */
|
|
217
|
+
children: [/* @__PURE__ */ c("input", {
|
|
209
218
|
type: "checkbox",
|
|
210
|
-
checked:
|
|
211
|
-
onChange: (e) =>
|
|
219
|
+
checked: r.showGrid !== !1,
|
|
220
|
+
onChange: (e) => h("showGrid", e.target.checked),
|
|
212
221
|
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 "
|
|
213
|
-
}), /* @__PURE__ */
|
|
222
|
+
}), /* @__PURE__ */ c("span", {
|
|
214
223
|
className: "text-sm text-text-primary",
|
|
215
|
-
children:
|
|
224
|
+
children: d("bigconsole.widget.config.chart.showGrid", "Show Grid")
|
|
216
225
|
})]
|
|
217
226
|
}),
|
|
218
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ l("label", {
|
|
219
228
|
className: "flex items-center gap-3",
|
|
220
|
-
children: [/* @__PURE__ */
|
|
229
|
+
children: [/* @__PURE__ */ c("input", {
|
|
221
230
|
type: "checkbox",
|
|
222
|
-
checked:
|
|
223
|
-
onChange: (e) =>
|
|
231
|
+
checked: r.showLegend !== !1,
|
|
232
|
+
onChange: (e) => h("showLegend", e.target.checked),
|
|
224
233
|
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 "
|
|
225
|
-
}), /* @__PURE__ */
|
|
234
|
+
}), /* @__PURE__ */ c("span", {
|
|
226
235
|
className: "text-sm text-text-primary",
|
|
227
|
-
children:
|
|
236
|
+
children: d("bigconsole.widget.config.chart.showLegend", "Show Legend")
|
|
228
237
|
})]
|
|
229
238
|
}),
|
|
230
|
-
!
|
|
239
|
+
!g && /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ l("label", {
|
|
231
240
|
className: "flex items-center gap-3",
|
|
232
|
-
children: [/* @__PURE__ */
|
|
241
|
+
children: [/* @__PURE__ */ c("input", {
|
|
233
242
|
type: "checkbox",
|
|
234
|
-
checked:
|
|
235
|
-
onChange: (e) =>
|
|
243
|
+
checked: r.showDataPoints === !0,
|
|
244
|
+
onChange: (e) => h("showDataPoints", e.target.checked),
|
|
236
245
|
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 "
|
|
237
|
-
}), /* @__PURE__ */
|
|
246
|
+
}), /* @__PURE__ */ c("span", {
|
|
238
247
|
className: "text-sm text-text-primary",
|
|
239
|
-
children:
|
|
248
|
+
children: d("bigconsole.widget.config.chart.showDataPoints", "Show Data Points")
|
|
240
249
|
})]
|
|
241
|
-
}), (
|
|
250
|
+
}), (r.chartType === "bar" || r.chartType === "area") && /* @__PURE__ */ l("label", {
|
|
242
251
|
className: "flex items-center gap-3",
|
|
243
|
-
children: [/* @__PURE__ */
|
|
252
|
+
children: [/* @__PURE__ */ c("input", {
|
|
244
253
|
type: "checkbox",
|
|
245
|
-
checked:
|
|
246
|
-
onChange: (e) =>
|
|
254
|
+
checked: r.stacked === !0,
|
|
255
|
+
onChange: (e) => h("stacked", e.target.checked),
|
|
247
256
|
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 "
|
|
248
|
-
}), /* @__PURE__ */
|
|
257
|
+
}), /* @__PURE__ */ c("span", {
|
|
249
258
|
className: "text-sm text-text-primary",
|
|
250
|
-
children:
|
|
259
|
+
children: d("bigconsole.widget.config.chart.stacked", "Stacked")
|
|
251
260
|
})]
|
|
252
261
|
})] })
|
|
253
262
|
]
|
|
@@ -256,4 +265,4 @@ var s = e(function({ config: e, onChange: s }) {
|
|
|
256
265
|
});
|
|
257
266
|
});
|
|
258
267
|
//#endregion
|
|
259
|
-
export {
|
|
268
|
+
export { u as ChartConfig, u as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ChartReferenceLine } from '../../../types';
|
|
3
|
+
export interface ReferenceLinesEditorProps {
|
|
4
|
+
lines: ChartReferenceLine[];
|
|
5
|
+
onChange: (lines: ChartReferenceLine[]) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ReferenceLinesEditor: FC<ReferenceLinesEditorProps>;
|
|
8
|
+
export default ReferenceLinesEditor;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { REFERENCE_LINE_INTENTS as e, addReferenceLine as t, parseReferenceValue as n, removeReferenceLine as r, updateReferenceLine as i } from "./referenceLineDraft.js";
|
|
2
|
+
import { memo as a, useCallback as o, useEffect as s, useState as c } from "react";
|
|
3
|
+
import { useI18n as l } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
4
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
5
|
+
//#region src/bigconsole/components/widgets/chart/ReferenceLinesEditor.tsx
|
|
6
|
+
var f = "w-full min-w-0 px-3 py-2 text-sm text-text-primary bg-bg-surface border border-border-default rounded-md focus:outline-none focus:ring-2 focus:ring-action-primary-bg";
|
|
7
|
+
function p({ id: e, value: t, onCommit: r, allowEmpty: i, placeholder: a }) {
|
|
8
|
+
let [o, l] = c(t === void 0 ? "" : String(t));
|
|
9
|
+
return s(() => {
|
|
10
|
+
l((e) => n(e) === (t ?? null) ? e : t === void 0 ? "" : String(t));
|
|
11
|
+
}, [t]), /* @__PURE__ */ u("input", {
|
|
12
|
+
id: e,
|
|
13
|
+
type: "number",
|
|
14
|
+
inputMode: "decimal",
|
|
15
|
+
step: "any",
|
|
16
|
+
value: o,
|
|
17
|
+
placeholder: a,
|
|
18
|
+
onChange: (e) => {
|
|
19
|
+
l(e.target.value);
|
|
20
|
+
let t = n(e.target.value);
|
|
21
|
+
t === null ? i && e.target.value.trim() === "" && r(void 0) : r(t);
|
|
22
|
+
},
|
|
23
|
+
onBlur: () => l(t === void 0 ? "" : String(t)),
|
|
24
|
+
className: f
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
var m = a(function({ lines: n, onChange: a }) {
|
|
28
|
+
let { t: s } = l(), c = o((e) => ({
|
|
29
|
+
danger: s("bigconsole.widget.config.chart.referenceLines.color.danger", "Red (danger)"),
|
|
30
|
+
warning: s("bigconsole.widget.config.chart.referenceLines.color.warning", "Amber (warning)"),
|
|
31
|
+
success: s("bigconsole.widget.config.chart.referenceLines.color.success", "Green (success)"),
|
|
32
|
+
info: s("bigconsole.widget.config.chart.referenceLines.color.info", "Blue (info)"),
|
|
33
|
+
neutral: s("bigconsole.widget.config.chart.referenceLines.color.neutral", "Grey (neutral)")
|
|
34
|
+
})[e], [s]), m = (e, t) => a(i(n, e, t)), h = n.length >= 10;
|
|
35
|
+
return /* @__PURE__ */ d("div", {
|
|
36
|
+
className: "min-w-0 space-y-3",
|
|
37
|
+
"data-testid": "chart-reference-lines",
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
|
|
40
|
+
className: "block text-sm font-medium text-text-primary",
|
|
41
|
+
children: s("bigconsole.widget.config.chart.referenceLines.title", "Reference lines")
|
|
42
|
+
}), /* @__PURE__ */ u("p", {
|
|
43
|
+
className: "text-xs text-text-secondary",
|
|
44
|
+
children: s("bigconsole.widget.config.chart.referenceLines.help", "Draw a target, limit or threshold across the chart. Add an upper value to shade a band.")
|
|
45
|
+
})] }),
|
|
46
|
+
n.map((t, i) => {
|
|
47
|
+
let o = `chart-ref-line-${i}`, l = i + 1;
|
|
48
|
+
return /* @__PURE__ */ d("fieldset", {
|
|
49
|
+
className: "min-w-0 space-y-2 rounded-md border border-[var(--color-border-subtle)] p-3",
|
|
50
|
+
"data-testid": o,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ d("legend", {
|
|
53
|
+
className: "px-1 text-xs font-medium text-text-secondary",
|
|
54
|
+
children: [s("bigconsole.widget.config.chart.referenceLines.itemLegend", "Line {{number}}", { number: l }), t.axis === "x" ? ` · ${s("bigconsole.widget.config.chart.referenceLines.xAxis", "X axis")}` : ""]
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ d("div", {
|
|
57
|
+
className: "grid grid-cols-1 gap-2 sm:grid-cols-2",
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ d("div", {
|
|
60
|
+
className: "min-w-0",
|
|
61
|
+
children: [/* @__PURE__ */ u("label", {
|
|
62
|
+
htmlFor: `${o}-value`,
|
|
63
|
+
className: "mb-1 block text-xs font-medium text-text-primary",
|
|
64
|
+
children: s("bigconsole.widget.config.chart.referenceLines.value", "Value")
|
|
65
|
+
}), /* @__PURE__ */ u(p, {
|
|
66
|
+
id: `${o}-value`,
|
|
67
|
+
value: t.value,
|
|
68
|
+
onCommit: (e) => e !== void 0 && m(i, { value: e })
|
|
69
|
+
})]
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ d("div", {
|
|
72
|
+
className: "min-w-0",
|
|
73
|
+
children: [/* @__PURE__ */ u("label", {
|
|
74
|
+
htmlFor: `${o}-value2`,
|
|
75
|
+
className: "mb-1 block text-xs font-medium text-text-primary",
|
|
76
|
+
children: s("bigconsole.widget.config.chart.referenceLines.value2", "Band upper value")
|
|
77
|
+
}), /* @__PURE__ */ u(p, {
|
|
78
|
+
id: `${o}-value2`,
|
|
79
|
+
value: t.value2,
|
|
80
|
+
allowEmpty: !0,
|
|
81
|
+
placeholder: s("bigconsole.widget.config.chart.optionalPlaceholder", "Optional"),
|
|
82
|
+
onCommit: (e) => m(i, { value2: e })
|
|
83
|
+
})]
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ d("div", {
|
|
86
|
+
className: "min-w-0",
|
|
87
|
+
children: [/* @__PURE__ */ u("label", {
|
|
88
|
+
htmlFor: `${o}-label`,
|
|
89
|
+
className: "mb-1 block text-xs font-medium text-text-primary",
|
|
90
|
+
children: s("bigconsole.widget.config.chart.referenceLines.label", "Label")
|
|
91
|
+
}), /* @__PURE__ */ u("input", {
|
|
92
|
+
id: `${o}-label`,
|
|
93
|
+
type: "text",
|
|
94
|
+
value: t.label ?? "",
|
|
95
|
+
placeholder: s("bigconsole.widget.config.chart.referenceLines.labelPlaceholder", "e.g., 2% control limit"),
|
|
96
|
+
onChange: (e) => m(i, { label: e.target.value === "" ? void 0 : e.target.value }),
|
|
97
|
+
className: f
|
|
98
|
+
})]
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ d("div", {
|
|
101
|
+
className: "min-w-0",
|
|
102
|
+
children: [/* @__PURE__ */ u("label", {
|
|
103
|
+
htmlFor: `${o}-color`,
|
|
104
|
+
className: "mb-1 block text-xs font-medium text-text-primary",
|
|
105
|
+
children: s("bigconsole.widget.config.chart.referenceLines.color", "Color")
|
|
106
|
+
}), /* @__PURE__ */ u("select", {
|
|
107
|
+
id: `${o}-color`,
|
|
108
|
+
value: t.color ?? "danger",
|
|
109
|
+
onChange: (e) => m(i, { color: e.target.value }),
|
|
110
|
+
className: f,
|
|
111
|
+
children: e.map((e) => /* @__PURE__ */ u("option", {
|
|
112
|
+
value: e,
|
|
113
|
+
children: c(e)
|
|
114
|
+
}, e))
|
|
115
|
+
})]
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
}),
|
|
119
|
+
/* @__PURE__ */ d("div", {
|
|
120
|
+
className: "flex flex-wrap items-center justify-between gap-2",
|
|
121
|
+
children: [/* @__PURE__ */ d("label", {
|
|
122
|
+
className: "flex items-center gap-2",
|
|
123
|
+
children: [/* @__PURE__ */ u("input", {
|
|
124
|
+
type: "checkbox",
|
|
125
|
+
checked: t.dashed !== !1,
|
|
126
|
+
disabled: t.value2 !== void 0,
|
|
127
|
+
onChange: (e) => m(i, { dashed: e.target.checked }),
|
|
128
|
+
className: "h-4 w-4 rounded border-border-default bg-bg-surface text-action-primary-bg focus:ring-action-primary-bg"
|
|
129
|
+
}), /* @__PURE__ */ u("span", {
|
|
130
|
+
className: "text-sm text-text-primary",
|
|
131
|
+
children: s("bigconsole.widget.config.chart.referenceLines.dashed", "Dashed")
|
|
132
|
+
})]
|
|
133
|
+
}), /* @__PURE__ */ u("button", {
|
|
134
|
+
type: "button",
|
|
135
|
+
onClick: () => a(r(n, i)),
|
|
136
|
+
className: "min-h-control-md rounded-button px-2 text-sm font-medium text-[var(--color-status-error-text)] hover:bg-status-error-bg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
137
|
+
"aria-label": s("bigconsole.widget.config.chart.referenceLines.removeAria", "Remove line {{number}}", { number: l }),
|
|
138
|
+
children: s("bigconsole.widget.config.chart.referenceLines.remove", "Remove")
|
|
139
|
+
})]
|
|
140
|
+
})
|
|
141
|
+
]
|
|
142
|
+
}, o);
|
|
143
|
+
}),
|
|
144
|
+
/* @__PURE__ */ u("button", {
|
|
145
|
+
type: "button",
|
|
146
|
+
disabled: h,
|
|
147
|
+
onClick: () => a(t(n)),
|
|
148
|
+
className: "inline-flex min-h-control-md items-center rounded-button border border-border-default px-3 text-sm font-medium text-text-primary hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
149
|
+
children: s("bigconsole.widget.config.chart.referenceLines.add", "+ Add reference line")
|
|
150
|
+
}),
|
|
151
|
+
h && /* @__PURE__ */ u("p", {
|
|
152
|
+
className: "text-xs text-text-secondary",
|
|
153
|
+
children: s("bigconsole.widget.config.chart.referenceLines.limit", "A chart can have up to {{limit}} reference lines.", { limit: 10 })
|
|
154
|
+
})
|
|
155
|
+
]
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
//#endregion
|
|
159
|
+
export { m as ReferenceLinesEditor, m as default };
|
|
@@ -10,7 +10,8 @@ export interface ReferenceLineConfig {
|
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Build reference line/band elements for a cartesian chart.
|
|
13
|
-
* `
|
|
13
|
+
* `yAxisId` lets dual-axis charts target the correct axis (defaults to the
|
|
14
|
+
* default axis, id 0).
|
|
14
15
|
*/
|
|
15
16
|
export declare function buildReferenceElements(referenceLines: ReferenceLineConfig[] | undefined, opts?: {
|
|
16
17
|
yAxisId?: string | number;
|
|
@@ -4,7 +4,7 @@ import { ReferenceArea as n, ReferenceLine as r } from "recharts";
|
|
|
4
4
|
//#region src/bigconsole/components/widgets/chart/charts/referenceElements.tsx
|
|
5
5
|
function i(i, a) {
|
|
6
6
|
return i?.length ? i.map((i, o) => {
|
|
7
|
-
let s = e(i.color ?? "danger"), c = (i.axis ?? "y") === "y", l = a?.yAxisId;
|
|
7
|
+
let s = e(i.color ?? "danger"), c = (i.axis ?? "y") === "y", l = a?.yAxisId ?? 0;
|
|
8
8
|
if (i.value2 != null) {
|
|
9
9
|
let e = Math.min(i.value, i.value2), r = Math.max(i.value, i.value2);
|
|
10
10
|
return /* @__PURE__ */ t(n, {
|
|
@@ -15,7 +15,9 @@ function i(i, a) {
|
|
|
15
15
|
x1: e,
|
|
16
16
|
x2: r
|
|
17
17
|
},
|
|
18
|
-
|
|
18
|
+
xAxisId: 0,
|
|
19
|
+
yAxisId: l,
|
|
20
|
+
ifOverflow: "extendDomain",
|
|
19
21
|
fill: s,
|
|
20
22
|
fillOpacity: .1,
|
|
21
23
|
stroke: s,
|
|
@@ -30,7 +32,9 @@ function i(i, a) {
|
|
|
30
32
|
}
|
|
31
33
|
return /* @__PURE__ */ t(r, {
|
|
32
34
|
...c ? { y: i.value } : { x: i.value },
|
|
33
|
-
|
|
35
|
+
xAxisId: 0,
|
|
36
|
+
yAxisId: l,
|
|
37
|
+
ifOverflow: "extendDomain",
|
|
34
38
|
stroke: s,
|
|
35
39
|
strokeWidth: 1.5,
|
|
36
40
|
strokeDasharray: i.dashed === !1 ? void 0 : "6 4",
|
|
@@ -38,7 +42,7 @@ function i(i, a) {
|
|
|
38
42
|
value: i.label,
|
|
39
43
|
fill: s,
|
|
40
44
|
fontSize: 11,
|
|
41
|
-
position: "
|
|
45
|
+
position: "insideTopRight"
|
|
42
46
|
} : void 0
|
|
43
47
|
}, `ref-line-${o}`);
|
|
44
48
|
}) : [];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ChartReferenceLine } from '../../../types';
|
|
2
|
+
import { SemanticIntent } from '../utils/conditionalFormat';
|
|
3
|
+
/** Same cap the embed renderer applies when it reads `referenceLines`. */
|
|
4
|
+
export declare const REFERENCE_LINE_LIMIT = 10;
|
|
5
|
+
/** Colours offered in the editor, in the order they are listed. */
|
|
6
|
+
export declare const REFERENCE_LINE_INTENTS: readonly SemanticIntent[];
|
|
7
|
+
/**
|
|
8
|
+
* Read `config.referenceLines` defensively: stored widget config is untyped
|
|
9
|
+
* JSON, so anything that is not an object with a finite `value` is dropped and
|
|
10
|
+
* unknown keys are not carried forward.
|
|
11
|
+
*/
|
|
12
|
+
export declare function normalizeReferenceLines(raw: unknown): ChartReferenceLine[];
|
|
13
|
+
/**
|
|
14
|
+
* Parse a number typed into the editor. Blank or non-numeric input returns
|
|
15
|
+
* `null` so the caller keeps the last valid value instead of storing NaN,
|
|
16
|
+
* which the chart would silently fail to draw.
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseReferenceValue(text: string): number | null;
|
|
19
|
+
/** Append a horizontal dashed threshold line, unless the list is full. */
|
|
20
|
+
export declare function addReferenceLine(lines: readonly ChartReferenceLine[], value?: number): ChartReferenceLine[];
|
|
21
|
+
/**
|
|
22
|
+
* Apply a partial edit to one line. A patch key set to `undefined` removes
|
|
23
|
+
* that key (e.g. clearing a label or the band's upper value); keys the patch
|
|
24
|
+
* does not mention are kept as they were.
|
|
25
|
+
*/
|
|
26
|
+
export declare function updateReferenceLine(lines: readonly ChartReferenceLine[], index: number, patch: Partial<ChartReferenceLine>): ChartReferenceLine[];
|
|
27
|
+
export declare function removeReferenceLine(lines: readonly ChartReferenceLine[], index: number): ChartReferenceLine[];
|
|
28
|
+
/** The value to store on the widget config: omit the key when the list is empty. */
|
|
29
|
+
export declare function toReferenceLinesConfig(lines: readonly ChartReferenceLine[]): ChartReferenceLine[] | undefined;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var e = [
|
|
2
|
+
"danger",
|
|
3
|
+
"warning",
|
|
4
|
+
"success",
|
|
5
|
+
"info",
|
|
6
|
+
"neutral"
|
|
7
|
+
];
|
|
8
|
+
function t(t) {
|
|
9
|
+
return typeof t == "string" && e.includes(t);
|
|
10
|
+
}
|
|
11
|
+
function n(e) {
|
|
12
|
+
return typeof e == "number" && Number.isFinite(e) ? e : void 0;
|
|
13
|
+
}
|
|
14
|
+
function r(e) {
|
|
15
|
+
if (!Array.isArray(e)) return [];
|
|
16
|
+
let r = [];
|
|
17
|
+
for (let i of e) {
|
|
18
|
+
if (r.length >= 10) break;
|
|
19
|
+
if (!i || typeof i != "object") continue;
|
|
20
|
+
let e = i, a = n(e.value);
|
|
21
|
+
if (a === void 0) continue;
|
|
22
|
+
let o = { value: a };
|
|
23
|
+
(e.axis === "x" || e.axis === "y") && (o.axis = e.axis);
|
|
24
|
+
let s = n(e.value2);
|
|
25
|
+
s !== void 0 && (o.value2 = s), typeof e.label == "string" && e.label !== "" && (o.label = e.label), t(e.color) && (o.color = e.color), typeof e.dashed == "boolean" && (o.dashed = e.dashed), r.push(o);
|
|
26
|
+
}
|
|
27
|
+
return r;
|
|
28
|
+
}
|
|
29
|
+
function i(e) {
|
|
30
|
+
let t = e.trim();
|
|
31
|
+
if (t === "") return null;
|
|
32
|
+
let n = Number(t);
|
|
33
|
+
return Number.isFinite(n) ? n : null;
|
|
34
|
+
}
|
|
35
|
+
function a(e, t = 0) {
|
|
36
|
+
return e.length >= 10 ? [...e] : [...e, {
|
|
37
|
+
axis: "y",
|
|
38
|
+
value: t,
|
|
39
|
+
color: "danger",
|
|
40
|
+
dashed: !0
|
|
41
|
+
}];
|
|
42
|
+
}
|
|
43
|
+
function o(e, t, n) {
|
|
44
|
+
return e.map((e, r) => {
|
|
45
|
+
if (r !== t) return e;
|
|
46
|
+
let i = { ...e };
|
|
47
|
+
for (let [e, t] of Object.entries(n)) t === void 0 ? delete i[e] : i[e] = t;
|
|
48
|
+
return i;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function s(e, t) {
|
|
52
|
+
return e.filter((e, n) => n !== t);
|
|
53
|
+
}
|
|
54
|
+
function c(e) {
|
|
55
|
+
return e.length > 0 ? [...e] : void 0;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { e as REFERENCE_LINE_INTENTS, a as addReferenceLine, r as normalizeReferenceLines, i as parseReferenceValue, s as removeReferenceLine, c as toReferenceLinesConfig, o as updateReferenceLine };
|
|
@@ -32,5 +32,10 @@ declare const COLOR_RAMPS: {
|
|
|
32
32
|
readonly red: readonly ["bg-status-error-bg/10", "bg-status-error-bg/30", "bg-status-error-bg/50", "bg-status-error-bg/70", "bg-status-error-bg/90"];
|
|
33
33
|
};
|
|
34
34
|
export type HeatmapColorScheme = keyof typeof COLOR_RAMPS;
|
|
35
|
+
/**
|
|
36
|
+
* Whether a scroll container still has content below its visible area. The
|
|
37
|
+
* 1px slack absorbs the fractional scroll offsets browsers report at the end.
|
|
38
|
+
*/
|
|
39
|
+
export declare function hasMoreBelow(scrollTop: number, clientHeight: number, scrollHeight: number): boolean;
|
|
35
40
|
export declare const HeatmapWidget: FC<HeatmapWidgetProps>;
|
|
36
41
|
export default HeatmapWidget;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { memo as e, useCallback as t,
|
|
2
|
-
import { jsx as
|
|
1
|
+
import { memo as e, useCallback as t, useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
|
|
2
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
3
3
|
//#region src/bigconsole/components/widgets/heatmap/HeatmapWidget.tsx
|
|
4
|
-
var
|
|
4
|
+
var c = {
|
|
5
5
|
blue: [
|
|
6
6
|
"bg-action-primary-bg/10",
|
|
7
7
|
"bg-action-primary-bg/30",
|
|
@@ -24,87 +24,110 @@ var a = {
|
|
|
24
24
|
"bg-status-error-bg/90"
|
|
25
25
|
]
|
|
26
26
|
};
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function l(e) {
|
|
28
|
+
return c[e ?? "blue"] ?? c.blue;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function u(e, t, n) {
|
|
31
|
+
return e + t < n - 1;
|
|
32
|
+
}
|
|
33
|
+
function d(e, t, n, r = "blue") {
|
|
31
34
|
let i = Math.max(0, Math.min(1, (e - t) / (n - t || 1)));
|
|
32
|
-
return
|
|
35
|
+
return l(r)[i < .2 ? 0 : i < .4 ? 1 : i < .6 ? 2 : i < .8 ? 3 : 4];
|
|
33
36
|
}
|
|
34
|
-
var
|
|
35
|
-
let
|
|
37
|
+
var f = e(function({ widget: e, data: c, onClick: f }) {
|
|
38
|
+
let p = e.config, m = r(() => {
|
|
36
39
|
let e = /* @__PURE__ */ new Map();
|
|
37
|
-
return
|
|
40
|
+
return c?.cells && Array.isArray(c.cells) && c.cells.forEach((t) => {
|
|
38
41
|
e.set(`${t.row}:${t.column}`, t.value);
|
|
39
42
|
}), e;
|
|
40
|
-
}, [
|
|
41
|
-
if (!
|
|
43
|
+
}, [c?.cells]), { minValue: h, maxValue: g } = r(() => {
|
|
44
|
+
if (!c?.cells || !Array.isArray(c.cells) || !c.cells.length) return {
|
|
42
45
|
minValue: 0,
|
|
43
46
|
maxValue: 100
|
|
44
47
|
};
|
|
45
|
-
let e =
|
|
48
|
+
let e = c.cells.map((e) => e.value);
|
|
46
49
|
return {
|
|
47
|
-
minValue:
|
|
48
|
-
maxValue:
|
|
50
|
+
minValue: c.minValue ?? Math.min(...e),
|
|
51
|
+
maxValue: c.maxValue ?? Math.max(...e)
|
|
49
52
|
};
|
|
50
|
-
}, [
|
|
51
|
-
|
|
53
|
+
}, [c]), _ = t((t, n, r) => {
|
|
54
|
+
f && e.drilldowns?.length && f({
|
|
52
55
|
row: t,
|
|
53
56
|
column: n,
|
|
54
57
|
value: r
|
|
55
58
|
});
|
|
56
|
-
}, [
|
|
57
|
-
return
|
|
59
|
+
}, [f, e.drilldowns]), v = !!(f && e.drilldowns?.length), y = i(null), [b, x] = a(!1), [S, C] = a(!1);
|
|
60
|
+
return n(() => {
|
|
61
|
+
let e = y.current;
|
|
62
|
+
if (!e) return;
|
|
63
|
+
let t = () => {
|
|
64
|
+
C(e.scrollHeight > e.clientHeight + 1), x(u(e.scrollTop, e.clientHeight, e.scrollHeight));
|
|
65
|
+
};
|
|
66
|
+
t(), e.addEventListener("scroll", t, { passive: !0 });
|
|
67
|
+
let n = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
|
|
68
|
+
n?.observe(e);
|
|
69
|
+
let r = e.firstElementChild;
|
|
70
|
+
return r && n?.observe(r), () => {
|
|
71
|
+
e.removeEventListener("scroll", t), n?.disconnect();
|
|
72
|
+
};
|
|
73
|
+
}, [Array.isArray(c?.rows) ? c.rows.length : 0]), !c || !Array.isArray(c.rows) || !Array.isArray(c.columns) || !c.rows.length || !c.columns.length ? /* @__PURE__ */ o("div", {
|
|
58
74
|
className: "flex items-center justify-center h-full text-text-secondary text-sm",
|
|
59
75
|
children: "No heatmap data available"
|
|
60
|
-
}) : /* @__PURE__ */
|
|
61
|
-
className: "flex
|
|
62
|
-
children: [/* @__PURE__ */
|
|
63
|
-
className: "min-h-0 flex-1
|
|
64
|
-
children: /* @__PURE__ */
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
}) : /* @__PURE__ */ s("div", {
|
|
77
|
+
className: "flex h-full min-h-0 flex-col gap-2",
|
|
78
|
+
children: [/* @__PURE__ */ s("div", {
|
|
79
|
+
className: "relative min-h-0 flex-1",
|
|
80
|
+
children: [/* @__PURE__ */ o("div", {
|
|
81
|
+
ref: y,
|
|
82
|
+
className: "h-full overflow-auto focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-action-primary-bg",
|
|
83
|
+
tabIndex: S ? 0 : void 0,
|
|
84
|
+
role: S ? "region" : void 0,
|
|
85
|
+
"aria-label": S ? `${e.title || "Heatmap"}: scroll for more rows` : void 0,
|
|
86
|
+
children: /* @__PURE__ */ s("table", {
|
|
87
|
+
className: "h-full w-full border-separate border-spacing-0.5",
|
|
88
|
+
children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ s("tr", { children: [/* @__PURE__ */ o("th", { className: "sticky top-0 z-[1] bg-bg-surface px-2 py-1 text-xs text-text-secondary text-left" }), c.columns.map((e) => /* @__PURE__ */ o("th", {
|
|
89
|
+
scope: "col",
|
|
90
|
+
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]",
|
|
91
|
+
children: e
|
|
92
|
+
}, e))] }) }), /* @__PURE__ */ o("tbody", { children: c.rows.map((e) => /* @__PURE__ */ s("tr", { children: [/* @__PURE__ */ o("th", {
|
|
93
|
+
scope: "row",
|
|
94
|
+
className: "px-2 py-0.5 text-xs font-medium text-text-secondary text-left whitespace-nowrap",
|
|
95
|
+
children: e
|
|
96
|
+
}), c.columns.map((t) => {
|
|
97
|
+
let n = m.get(`${e}:${t}`) ?? 0;
|
|
98
|
+
return /* @__PURE__ */ o("td", {
|
|
81
99
|
className: `
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
100
|
+
h-6 rounded px-2 py-0.5 text-center text-xs align-middle
|
|
101
|
+
${d(n, h, g, p?.colorScheme)}
|
|
102
|
+
${v ? "cursor-pointer hover:ring-2 hover:ring-inset hover:ring-action-primary-bg" : ""}
|
|
103
|
+
transition-all
|
|
104
|
+
`,
|
|
105
|
+
onClick: () => _(e, t, n),
|
|
87
106
|
title: `${e} / ${t}: ${n}`,
|
|
88
|
-
children:
|
|
107
|
+
children: p?.showValues !== !1 && /* @__PURE__ */ o("span", {
|
|
89
108
|
className: "text-xs font-medium text-text-primary",
|
|
90
|
-
children: typeof n == "number" ? n.toFixed(
|
|
109
|
+
children: typeof n == "number" ? n.toFixed(p?.decimals || 0) : n
|
|
91
110
|
})
|
|
92
|
-
})
|
|
93
|
-
},
|
|
94
|
-
})
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
|
|
111
|
+
}, t);
|
|
112
|
+
})] }, e)) })]
|
|
113
|
+
})
|
|
114
|
+
}), b && /* @__PURE__ */ o("div", {
|
|
115
|
+
"aria-hidden": "true",
|
|
116
|
+
"data-testid": "heatmap-more-below",
|
|
117
|
+
className: "pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-gradient-to-t from-bg-surface to-bg-surface/0"
|
|
118
|
+
})]
|
|
119
|
+
}), p?.showLegend !== !1 && /* @__PURE__ */ s("div", {
|
|
120
|
+
className: "flex shrink-0 items-center justify-center gap-2",
|
|
98
121
|
children: [
|
|
99
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ o("span", {
|
|
100
123
|
className: "text-xs text-text-secondary",
|
|
101
124
|
children: "Low"
|
|
102
125
|
}),
|
|
103
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ o("div", {
|
|
104
127
|
className: "flex gap-0.5",
|
|
105
|
-
children:
|
|
128
|
+
children: l(p?.colorScheme).map((e) => /* @__PURE__ */ o("div", { className: `w-6 h-4 rounded ${e}` }, e))
|
|
106
129
|
}),
|
|
107
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ o("span", {
|
|
108
131
|
className: "text-xs text-text-secondary",
|
|
109
132
|
children: "High"
|
|
110
133
|
})
|
|
@@ -113,4 +136,4 @@ var c = e(function({ widget: e, data: a, onClick: c }) {
|
|
|
113
136
|
});
|
|
114
137
|
});
|
|
115
138
|
//#endregion
|
|
116
|
-
export {
|
|
139
|
+
export { f as HeatmapWidget, f as default, u as hasMoreBelow };
|
|
@@ -1152,7 +1152,7 @@ var P = l(function() {
|
|
|
1152
1152
|
className: "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg-surface",
|
|
1153
1153
|
style: T,
|
|
1154
1154
|
"data-testid": "insights-earlier-versions-toggle",
|
|
1155
|
-
children: W ? l("bigconsole.insights.generations.hideEarlier", "Hide earlier versions") : l("bigconsole.insights.generations.showEarlier", "Show {{count}} earlier
|
|
1155
|
+
children: W ? l("bigconsole.insights.generations.hideEarlier", "Hide earlier versions") : mt.length === 1 ? l("bigconsole.insights.generations.showEarlierOne", "Show 1 earlier version") : l("bigconsole.insights.generations.showEarlier", "Show {{count}} earlier versions", { count: mt.length })
|
|
1156
1156
|
})
|
|
1157
1157
|
]
|
|
1158
1158
|
})
|
|
@@ -93,7 +93,7 @@ var v = [
|
|
|
93
93
|
children: s("bigconsole.widgetDemo.header.title", "Widget Demo")
|
|
94
94
|
}), /* @__PURE__ */ h("p", {
|
|
95
95
|
className: "mt-1 text-sm text-text-secondary",
|
|
96
|
-
children: s("bigconsole.widgetDemo.header.
|
|
96
|
+
children: s("bigconsole.widgetDemo.header.subtitleCount", "All {{count}} widget types - connect a DataSink for real data", { count: o.length })
|
|
97
97
|
})]
|
|
98
98
|
}), /* @__PURE__ */ g("div", {
|
|
99
99
|
className: "flex flex-wrap items-center gap-control-gap",
|