@burdenoff/microfe-bigconsole 2026.1119.6 → 2026.1119.8
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/ChartEmbed.js +70 -66
- package/dist/bigconsole/components/insights/GeneratedFormattingReview.d.ts +21 -0
- package/dist/bigconsole/components/insights/GeneratedFormattingReview.js +90 -44
- package/dist/bigconsole/components/settings/WidgetCatalogSection.d.ts +3 -0
- package/dist/bigconsole/components/settings/WidgetCatalogSection.js +207 -0
- package/dist/bigconsole/components/widgets/chart/ChartWidget.js +1 -0
- package/dist/bigconsole/components/widgets/chart/ReferenceLinesEditor.js +5 -1
- package/dist/bigconsole/components/widgets/chart/charts/AreaChart.js +4 -1
- package/dist/bigconsole/components/widgets/chart/charts/BarChart.js +53 -45
- package/dist/bigconsole/components/widgets/chart/charts/ComboChart.js +5 -1
- package/dist/bigconsole/components/widgets/chart/charts/LineChart.js +4 -1
- package/dist/bigconsole/components/widgets/chart/charts/referenceElements.d.ts +13 -11
- package/dist/bigconsole/components/widgets/chart/charts/referenceElements.js +58 -29
- package/dist/bigconsole/components/widgets/chart/charts/types.d.ts +8 -1
- package/dist/bigconsole/components/widgets/chart/referenceLineDraft.js +26 -23
- package/dist/bigconsole/components/widgets/utils/conditionalFormat.d.ts +41 -0
- package/dist/bigconsole/components/widgets/utils/conditionalFormat.js +80 -44
- package/dist/bigconsole/constants/backendErrors.js +2 -0
- package/dist/bigconsole/hooks/useWidgetTypeCatalog.d.ts +14 -0
- package/dist/bigconsole/hooks/useWidgetTypeCatalog.js +79 -0
- package/dist/bigconsole/pages/InsightsPage.js +458 -451
- package/dist/bigconsole/pages/SettingsPage.js +198 -196
- package/dist/bigconsole/types/index.d.ts +8 -0
- package/dist/bigconsole/utils/pipelineExecutionTimeline.d.ts +13 -1
- package/dist/bigconsole/utils/pipelineExecutionTimeline.js +26 -3
- package/dist/bigconsole/utils/widgetCatalog.d.ts +42 -0
- package/dist/bigconsole/utils/widgetCatalog.js +15 -0
- package/dist/constants/permissions.d.ts +2 -1
- package/dist/constants/permissions.js +1 -0
- package/dist/generated/global-operations.d.ts +45 -6
- package/dist/generated/global-types.d.ts +5839 -804
- package/dist/generated/wspace-operations.d.ts +85 -0
- package/dist/generated/wspace-operations.js +329 -30
- package/dist/generated/wspace-types.d.ts +1339 -6
- package/package.json +1 -1
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { BIGCONSOLE_PERMISSIONS as e } from "../../../constants/permissions.js";
|
|
2
|
+
import { useBigConsole as t } from "../../context/BigConsoleContext.js";
|
|
3
|
+
import "../../context/index.js";
|
|
4
|
+
import { useWidgetTypeCatalog as n } from "../../hooks/useWidgetTypeCatalog.js";
|
|
5
|
+
import { resolveBackendErrorMessage as r } from "../../utils/backendError.js";
|
|
6
|
+
import { isWidgetCatalogRowMuted as i, sortWidgetCatalogRows as a, widgetCatalogAction as o, widgetCatalogRowKey as s } from "../../utils/widgetCatalog.js";
|
|
7
|
+
import { useCallback as c, useMemo as l, useState as u } from "react";
|
|
8
|
+
import { usePermissions as d } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
9
|
+
import { Blocks as f, ExternalLink as p } from "lucide-react";
|
|
10
|
+
import { useI18n as m } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
11
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
12
|
+
// src/bigconsole/components/settings/WidgetCatalogSection.tsx
|
|
13
|
+
var _ = "px-3 py-2 text-left align-middle text-body-sm", v = "px-3 py-2 text-left text-body-sm font-medium text-text-secondary", y = "rounded-button border border-border px-3 py-1 text-body-sm text-text-primary hover:border-action-primary-bg disabled:cursor-not-allowed disabled:opacity-60", b = () => {
|
|
14
|
+
let { hasPermission: t, isLoading: n } = d();
|
|
15
|
+
return n || !t(e.WIDGET_MANAGE_TYPES) ? null : /* @__PURE__ */ h(x, {});
|
|
16
|
+
}, x = () => {
|
|
17
|
+
let { t: e } = m(), { workspaceId: d, basePath: b } = t(), x = n(d, !0), [S, C] = u(null), w = l(() => a(x.rows), [x.rows]), T = `${b}/store${typeof window > "u" ? "" : window.location.search}`, { install: E, uninstall: D } = x, O = c(async (t, n) => {
|
|
18
|
+
C(null);
|
|
19
|
+
let i = n === "install" ? await E(t) : await D(t);
|
|
20
|
+
i && C(r(e, i));
|
|
21
|
+
}, [
|
|
22
|
+
E,
|
|
23
|
+
D,
|
|
24
|
+
e
|
|
25
|
+
]), k = (t) => {
|
|
26
|
+
switch (t) {
|
|
27
|
+
case "AVAILABLE": return e("bigconsole.settings.widgetCatalog.status.available", "Available");
|
|
28
|
+
case "DEPRECATED": return e("bigconsole.settings.widgetCatalog.status.deprecated", "Deprecated");
|
|
29
|
+
case "DISABLED": return e("bigconsole.settings.widgetCatalog.status.disabled", "Disabled");
|
|
30
|
+
default: return t;
|
|
31
|
+
}
|
|
32
|
+
}, A = (t) => t === "STORE" ? e("bigconsole.settings.widgetCatalog.source.store", "Store") : e("bigconsole.settings.widgetCatalog.source.custom", "Custom"), j = (t) => {
|
|
33
|
+
let n = o(t), r = x.pendingKey === s(t), i = x.pendingKey !== null;
|
|
34
|
+
if (n === "store") return /* @__PURE__ */ g("a", {
|
|
35
|
+
href: T,
|
|
36
|
+
target: "_blank",
|
|
37
|
+
rel: "noopener noreferrer",
|
|
38
|
+
className: "inline-flex items-center gap-1 text-body-sm text-text-link hover:underline",
|
|
39
|
+
children: [t.installedInWorkspace ? e("bigconsole.settings.widgetCatalog.actions.manageInStore", "Manage in Store") : e("bigconsole.settings.widgetCatalog.actions.getFromStore", "Get from Store"), /* @__PURE__ */ h(p, {
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
size: 12
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
if (n === "none") return /* @__PURE__ */ h("span", {
|
|
45
|
+
className: "text-body-sm text-text-muted",
|
|
46
|
+
children: e("bigconsole.settings.widgetCatalog.actions.unavailable", "Not installable")
|
|
47
|
+
});
|
|
48
|
+
let a = n === "install" ? r ? e("bigconsole.settings.widgetCatalog.actions.installing", "Installing…") : e("bigconsole.settings.widgetCatalog.actions.install", "Install") : r ? e("bigconsole.settings.widgetCatalog.actions.uninstalling", "Uninstalling…") : e("bigconsole.settings.widgetCatalog.actions.uninstall", "Uninstall");
|
|
49
|
+
return /* @__PURE__ */ h("button", {
|
|
50
|
+
type: "button",
|
|
51
|
+
className: y,
|
|
52
|
+
disabled: i,
|
|
53
|
+
"aria-busy": r,
|
|
54
|
+
"aria-label": `${a} ${t.name} ${t.widgetVersion}`,
|
|
55
|
+
onClick: () => void O(t, n),
|
|
56
|
+
children: a
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
return /* @__PURE__ */ g("section", {
|
|
60
|
+
"aria-labelledby": "bigconsole-widget-catalog-title",
|
|
61
|
+
"data-testid": "bigconsole-widget-catalog",
|
|
62
|
+
className: "mb-[var(--space-sectionGap)] rounded-card border border-border-seam bg-bg-surface p-[var(--space-cardPadding)] shadow-pop",
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ g("div", {
|
|
65
|
+
className: "mb-4 flex flex-wrap items-start justify-between gap-form-gap",
|
|
66
|
+
children: [/* @__PURE__ */ g("div", {
|
|
67
|
+
className: "flex items-start gap-[var(--space-iconGap)]",
|
|
68
|
+
children: [/* @__PURE__ */ h(f, {
|
|
69
|
+
"aria-hidden": "true",
|
|
70
|
+
size: 20,
|
|
71
|
+
className: "mt-0.5 text-text-primary"
|
|
72
|
+
}), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("h2", {
|
|
73
|
+
id: "bigconsole-widget-catalog-title",
|
|
74
|
+
className: "text-body-md font-semibold text-text-primary",
|
|
75
|
+
children: e("bigconsole.settings.widgetCatalog.title", "Widget catalog")
|
|
76
|
+
}), /* @__PURE__ */ h("p", {
|
|
77
|
+
className: "mt-1 text-body-sm text-text-muted",
|
|
78
|
+
children: e("bigconsole.settings.widgetCatalog.subtitle", "Custom and Store widget types registered for BigConsole. Installed types appear in this workspace’s widget palette.")
|
|
79
|
+
})] })]
|
|
80
|
+
}), /* @__PURE__ */ g("a", {
|
|
81
|
+
href: T,
|
|
82
|
+
target: "_blank",
|
|
83
|
+
rel: "noopener noreferrer",
|
|
84
|
+
className: "inline-flex items-center gap-1 text-body-sm text-text-link hover:underline",
|
|
85
|
+
children: [e("bigconsole.settings.widgetCatalog.browseStore", "Browse widget store"), /* @__PURE__ */ h(p, {
|
|
86
|
+
"aria-hidden": "true",
|
|
87
|
+
size: 12
|
|
88
|
+
})]
|
|
89
|
+
})]
|
|
90
|
+
}),
|
|
91
|
+
S && /* @__PURE__ */ h("p", {
|
|
92
|
+
role: "alert",
|
|
93
|
+
className: "mb-form-gap text-body-sm text-status-error-text",
|
|
94
|
+
children: S
|
|
95
|
+
}),
|
|
96
|
+
x.loadError ? /* @__PURE__ */ g("div", {
|
|
97
|
+
role: "alert",
|
|
98
|
+
className: "flex flex-wrap items-center gap-form-gap text-body-sm text-status-error-text",
|
|
99
|
+
children: [/* @__PURE__ */ g("span", { children: [
|
|
100
|
+
e("bigconsole.settings.widgetCatalog.loadFailed", "The widget catalog could not be loaded."),
|
|
101
|
+
" ",
|
|
102
|
+
r(e, x.loadError)
|
|
103
|
+
] }), /* @__PURE__ */ h("button", {
|
|
104
|
+
type: "button",
|
|
105
|
+
className: y,
|
|
106
|
+
onClick: () => void x.reload(),
|
|
107
|
+
children: e("bigconsole.settings.widgetCatalog.retry", "Retry")
|
|
108
|
+
})]
|
|
109
|
+
}) : x.loading && w.length === 0 ? /* @__PURE__ */ h("p", {
|
|
110
|
+
role: "status",
|
|
111
|
+
className: "text-body-sm text-text-muted",
|
|
112
|
+
children: e("bigconsole.settings.widgetCatalog.loading", "Loading widget types…")
|
|
113
|
+
}) : w.length === 0 ? /* @__PURE__ */ h("p", {
|
|
114
|
+
className: "text-body-sm text-text-muted",
|
|
115
|
+
children: e("bigconsole.settings.widgetCatalog.empty", "No custom or Store widget types are registered yet. Browse the widget store to add one.")
|
|
116
|
+
}) : /* @__PURE__ */ h("div", {
|
|
117
|
+
className: "overflow-x-auto",
|
|
118
|
+
children: /* @__PURE__ */ g("table", {
|
|
119
|
+
className: "w-full min-w-[640px] border-collapse",
|
|
120
|
+
children: [/* @__PURE__ */ h("thead", { children: /* @__PURE__ */ g("tr", {
|
|
121
|
+
className: "border-b border-border-seam",
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ h("th", {
|
|
124
|
+
scope: "col",
|
|
125
|
+
className: v,
|
|
126
|
+
children: e("bigconsole.settings.widgetCatalog.columns.name", "Name")
|
|
127
|
+
}),
|
|
128
|
+
/* @__PURE__ */ h("th", {
|
|
129
|
+
scope: "col",
|
|
130
|
+
className: v,
|
|
131
|
+
children: e("bigconsole.settings.widgetCatalog.columns.category", "Category")
|
|
132
|
+
}),
|
|
133
|
+
/* @__PURE__ */ h("th", {
|
|
134
|
+
scope: "col",
|
|
135
|
+
className: v,
|
|
136
|
+
children: e("bigconsole.settings.widgetCatalog.columns.version", "Version")
|
|
137
|
+
}),
|
|
138
|
+
/* @__PURE__ */ h("th", {
|
|
139
|
+
scope: "col",
|
|
140
|
+
className: v,
|
|
141
|
+
children: e("bigconsole.settings.widgetCatalog.columns.source", "Source")
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ h("th", {
|
|
144
|
+
scope: "col",
|
|
145
|
+
className: v,
|
|
146
|
+
children: e("bigconsole.settings.widgetCatalog.columns.status", "Status")
|
|
147
|
+
}),
|
|
148
|
+
/* @__PURE__ */ h("th", {
|
|
149
|
+
scope: "col",
|
|
150
|
+
className: v,
|
|
151
|
+
children: /* @__PURE__ */ h("span", {
|
|
152
|
+
className: "sr-only",
|
|
153
|
+
children: e("bigconsole.settings.widgetCatalog.columns.action", "Action")
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
]
|
|
157
|
+
}) }), /* @__PURE__ */ h("tbody", { children: w.map((t) => {
|
|
158
|
+
let n = i(t);
|
|
159
|
+
return /* @__PURE__ */ g("tr", {
|
|
160
|
+
"data-status": t.status,
|
|
161
|
+
className: `border-b border-border-seam last:border-b-0 ${n ? "opacity-60" : ""}`,
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ g("td", {
|
|
164
|
+
className: _,
|
|
165
|
+
children: [/* @__PURE__ */ h("div", {
|
|
166
|
+
className: "font-medium text-text-primary",
|
|
167
|
+
children: t.name
|
|
168
|
+
}), t.author && /* @__PURE__ */ h("div", {
|
|
169
|
+
className: "text-xs text-text-muted",
|
|
170
|
+
children: e("bigconsole.settings.widgetCatalog.byAuthor", "by {{author}}", { author: t.author })
|
|
171
|
+
})]
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ h("td", {
|
|
174
|
+
className: `${_} text-text-secondary`,
|
|
175
|
+
children: t.category ?? e("bigconsole.settings.widgetCatalog.uncategorized", "Uncategorized")
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ h("td", {
|
|
178
|
+
className: `${_} text-text-secondary`,
|
|
179
|
+
children: t.widgetVersion
|
|
180
|
+
}),
|
|
181
|
+
/* @__PURE__ */ h("td", {
|
|
182
|
+
className: `${_} text-text-secondary`,
|
|
183
|
+
children: A(t.publishType)
|
|
184
|
+
}),
|
|
185
|
+
/* @__PURE__ */ g("td", {
|
|
186
|
+
className: _,
|
|
187
|
+
children: [/* @__PURE__ */ h("span", {
|
|
188
|
+
className: "text-text-secondary",
|
|
189
|
+
children: k(t.status)
|
|
190
|
+
}), t.installedInWorkspace && /* @__PURE__ */ h("span", {
|
|
191
|
+
className: "ml-2 rounded-pill bg-status-success-bg px-2 py-0.5 text-xs text-status-success-text",
|
|
192
|
+
children: e("bigconsole.settings.widgetCatalog.installed", "Installed")
|
|
193
|
+
})]
|
|
194
|
+
}),
|
|
195
|
+
/* @__PURE__ */ h("td", {
|
|
196
|
+
className: `${_} text-right`,
|
|
197
|
+
children: j(t)
|
|
198
|
+
})
|
|
199
|
+
]
|
|
200
|
+
}, s(t));
|
|
201
|
+
}) })]
|
|
202
|
+
})
|
|
203
|
+
})
|
|
204
|
+
]
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
export { b as WidgetCatalogSection, b as default };
|
|
@@ -51,7 +51,11 @@ var m = a(function({ lines: n, onChange: a }) {
|
|
|
51
51
|
children: [
|
|
52
52
|
/* @__PURE__ */ d("legend", {
|
|
53
53
|
className: "px-1 text-xs font-medium text-text-secondary",
|
|
54
|
-
children: [
|
|
54
|
+
children: [
|
|
55
|
+
s("bigconsole.widget.config.chart.referenceLines.itemLegend", "Line {{number}}", { number: l }),
|
|
56
|
+
t.axis === "x" ? ` · ${s("bigconsole.widget.config.chart.referenceLines.xAxis", "X axis")}` : "",
|
|
57
|
+
t.relativeTo ? ` · ${t.relativeTo.mode === "percentChange" ? s("bigconsole.widget.config.chart.referenceLines.relativePercent", "% from {{field}}", { field: t.relativeTo.field }) : s("bigconsole.widget.config.chart.referenceLines.relativeDifference", "Difference from {{field}}", { field: t.relativeTo.field })}` : ""
|
|
58
|
+
]
|
|
55
59
|
}),
|
|
56
60
|
/* @__PURE__ */ d("div", {
|
|
57
61
|
className: "grid grid-cols-1 gap-2 sm:grid-cols-2",
|
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import { numericSeriesKeys as e } from "./numericSeries.js";
|
|
2
2
|
import { ChartTooltip as t } from "../ChartTooltip.js";
|
|
3
3
|
import { buildReferenceElements as n } from "./referenceElements.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { resolveBarFill as r } from "../../utils/conditionalFormat.js";
|
|
5
|
+
import { memo as i, useMemo as a } from "react";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
import { Bar as c, BarChart as l, CartesianGrid as u, Cell as d, Legend as f, ResponsiveContainer as p, Tooltip as m, XAxis as h, YAxis as g } from "recharts";
|
|
7
8
|
// src/bigconsole/components/widgets/chart/charts/BarChart.tsx
|
|
8
|
-
var
|
|
9
|
+
var _ = [
|
|
9
10
|
"var(--color-chart-1)",
|
|
10
11
|
"var(--color-chart-2)",
|
|
11
12
|
"var(--color-chart-3)",
|
|
12
13
|
"var(--color-chart-4)",
|
|
13
14
|
"var(--color-chart-5)"
|
|
14
|
-
],
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
]),
|
|
15
|
+
], v = i(function({ data: i = [], config: v, hiddenSeries: y = [], onDataClick: b }) {
|
|
16
|
+
let x = a(() => e(i, v.xAxisKey, v.selectedFields), [
|
|
17
|
+
i,
|
|
18
|
+
v.xAxisKey,
|
|
19
|
+
v.selectedFields
|
|
20
|
+
]), S = (e) => typeof e == "number" ? new Intl.NumberFormat("en-US", {
|
|
20
21
|
notation: e >= 1e4 ? "compact" : "standard",
|
|
21
22
|
maximumFractionDigits: 2
|
|
22
23
|
}).format(e) : String(e);
|
|
23
|
-
return
|
|
24
|
+
return i?.length ? /* @__PURE__ */ o(p, {
|
|
24
25
|
width: "100%",
|
|
25
26
|
height: "100%",
|
|
26
|
-
children: /* @__PURE__ */
|
|
27
|
-
data:
|
|
27
|
+
children: /* @__PURE__ */ s(l, {
|
|
28
|
+
data: i,
|
|
28
29
|
margin: {
|
|
29
30
|
top: 10,
|
|
30
31
|
right: 10,
|
|
@@ -32,78 +33,85 @@ var h = [
|
|
|
32
33
|
bottom: 0
|
|
33
34
|
},
|
|
34
35
|
onClick: (e) => {
|
|
35
|
-
e?.activePayload?.[0] &&
|
|
36
|
+
e?.activePayload?.[0] && b && b(e.activePayload[0].payload, e.activeTooltipIndex || 0);
|
|
36
37
|
},
|
|
37
38
|
children: [
|
|
38
|
-
|
|
39
|
+
v.showGrid !== !1 && /* @__PURE__ */ o(u, {
|
|
39
40
|
strokeDasharray: "3 3",
|
|
40
41
|
stroke: "var(--color-border-default)",
|
|
41
42
|
opacity: .5,
|
|
42
43
|
vertical: !1
|
|
43
44
|
}),
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
dataKey:
|
|
45
|
+
/* @__PURE__ */ o(h, {
|
|
46
|
+
dataKey: v.xAxisKey || "name",
|
|
46
47
|
tick: {
|
|
47
48
|
fill: "var(--color-text-secondary)",
|
|
48
49
|
fontSize: 12
|
|
49
50
|
},
|
|
50
51
|
tickLine: { stroke: "var(--color-border-default)" },
|
|
51
52
|
axisLine: { stroke: "var(--color-border-default)" },
|
|
52
|
-
label:
|
|
53
|
-
value:
|
|
53
|
+
label: v.xAxisLabel ? {
|
|
54
|
+
value: v.xAxisLabel,
|
|
54
55
|
position: "insideBottom",
|
|
55
56
|
offset: -5,
|
|
56
57
|
fill: "var(--color-text-secondary)"
|
|
57
58
|
} : void 0
|
|
58
59
|
}),
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ o(g, {
|
|
60
61
|
tick: {
|
|
61
62
|
fill: "var(--color-text-secondary)",
|
|
62
63
|
fontSize: 12
|
|
63
64
|
},
|
|
64
65
|
tickLine: { stroke: "var(--color-border-default)" },
|
|
65
66
|
axisLine: { stroke: "var(--color-border-default)" },
|
|
66
|
-
tickFormatter:
|
|
67
|
-
scale:
|
|
68
|
-
domain:
|
|
69
|
-
allowDataOverflow:
|
|
70
|
-
label:
|
|
71
|
-
value:
|
|
67
|
+
tickFormatter: S,
|
|
68
|
+
scale: v.logScale ? "log" : "auto",
|
|
69
|
+
domain: v.logScale ? ["auto", "auto"] : void 0,
|
|
70
|
+
allowDataOverflow: v.logScale || void 0,
|
|
71
|
+
label: v.yAxisLabel ? {
|
|
72
|
+
value: v.yAxisLabel,
|
|
72
73
|
angle: -90,
|
|
73
74
|
position: "insideLeft",
|
|
74
75
|
fill: "var(--color-text-secondary)"
|
|
75
76
|
} : void 0
|
|
76
77
|
}),
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
content: /* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ o(m, {
|
|
79
|
+
content: /* @__PURE__ */ o(t, { valueFormatter: S }),
|
|
79
80
|
cursor: {
|
|
80
81
|
fill: "var(--color-bg-muted)",
|
|
81
82
|
opacity: .5
|
|
82
83
|
}
|
|
83
84
|
}),
|
|
84
|
-
|
|
85
|
+
v.showLegend !== !1 && /* @__PURE__ */ o(f, {
|
|
85
86
|
wrapperStyle: { paddingTop: 20 },
|
|
86
|
-
formatter: (e) => /* @__PURE__ */
|
|
87
|
+
formatter: (e) => /* @__PURE__ */ o("span", {
|
|
87
88
|
style: { color: "var(--color-text-primary)" },
|
|
88
89
|
children: e
|
|
89
90
|
})
|
|
90
91
|
}),
|
|
91
|
-
n(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
92
|
+
n(v.referenceLines, {
|
|
93
|
+
data: i,
|
|
94
|
+
xAxisKey: v.xAxisKey || "name"
|
|
95
|
+
}),
|
|
96
|
+
x.map((e, t) => {
|
|
97
|
+
let n = v.colors?.[t] || _[t % _.length];
|
|
98
|
+
return /* @__PURE__ */ o(c, {
|
|
99
|
+
dataKey: e,
|
|
100
|
+
name: v.seriesNames?.[e] || e,
|
|
101
|
+
fill: n,
|
|
102
|
+
radius: [
|
|
103
|
+
4,
|
|
104
|
+
4,
|
|
105
|
+
0,
|
|
106
|
+
0
|
|
107
|
+
],
|
|
108
|
+
hide: y.includes(e),
|
|
109
|
+
stackId: v.stacked ? "stack" : void 0,
|
|
110
|
+
children: v.conditionalRules?.length ? i.map((t, i) => /* @__PURE__ */ o(d, { fill: r(t, e, v.conditionalRules) ?? n }, `${e}-${i}`)) : null
|
|
111
|
+
}, e);
|
|
112
|
+
})
|
|
105
113
|
]
|
|
106
114
|
})
|
|
107
115
|
}) : null;
|
|
108
116
|
});
|
|
109
|
-
export {
|
|
117
|
+
export { v as BarChart, v as default };
|
|
@@ -121,7 +121,11 @@ var g = [
|
|
|
121
121
|
stackId: _.stacked ? "stack" : void 0
|
|
122
122
|
}, e.field);
|
|
123
123
|
}),
|
|
124
|
-
n(_.referenceLines, {
|
|
124
|
+
n(_.referenceLines, {
|
|
125
|
+
yAxisId: "left",
|
|
126
|
+
data: r,
|
|
127
|
+
xAxisKey: _.xAxisKey || "name"
|
|
128
|
+
})
|
|
125
129
|
]
|
|
126
130
|
})
|
|
127
131
|
}) : null;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { ChartData, ReferenceLineConfig } from './types';
|
|
3
|
+
export type { ReferenceLineConfig };
|
|
4
|
+
export interface ReferenceElementOptions {
|
|
5
|
+
/** Axis id for dual-axis charts (defaults to the default axis, id 0). */
|
|
6
|
+
yAxisId?: string | number;
|
|
7
|
+
/**
|
|
8
|
+
* Category rows and their x key. A line drawn `relativeTo` a field needs
|
|
9
|
+
* them to place one marker per category; without them it is not drawn,
|
|
10
|
+
* never drawn at its raw value as if it were absolute (BOFF-10145).
|
|
11
|
+
*/
|
|
12
|
+
data?: readonly ChartData[];
|
|
13
|
+
xAxisKey?: string;
|
|
10
14
|
}
|
|
11
15
|
/**
|
|
12
16
|
* Build reference line/band elements for a cartesian chart.
|
|
13
17
|
* `yAxisId` lets dual-axis charts target the correct axis (defaults to the
|
|
14
18
|
* default axis, id 0).
|
|
15
19
|
*/
|
|
16
|
-
export declare function buildReferenceElements(referenceLines: ReferenceLineConfig[] | undefined, opts?:
|
|
17
|
-
yAxisId?: string | number;
|
|
18
|
-
}): ReactElement[];
|
|
20
|
+
export declare function buildReferenceElements(referenceLines: ReferenceLineConfig[] | undefined, opts?: ReferenceElementOptions): ReactElement[];
|
|
@@ -1,50 +1,79 @@
|
|
|
1
|
-
import { intentToCssVar as e } from "../../utils/conditionalFormat.js";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { ReferenceArea as
|
|
1
|
+
import { intentToCssVar as e, relativeThreshold as t } from "../../utils/conditionalFormat.js";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { ReferenceArea as r, ReferenceDot as i, ReferenceLine as a } from "recharts";
|
|
4
4
|
// src/bigconsole/components/widgets/chart/charts/referenceElements.tsx
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
function o(e, r, a, o, s) {
|
|
6
|
+
let c = e.relativeTo, l = s?.xAxisKey;
|
|
7
|
+
if (!c || !s?.data || !l || (e.axis ?? "y") !== "y" || e.value2 != null) return [];
|
|
8
|
+
let u = [];
|
|
9
|
+
return s.data.forEach((s, d) => {
|
|
10
|
+
let f = s[l], p = t(s[c.field], e.value, c.mode);
|
|
11
|
+
f !== void 0 && p != null && u.push(/* @__PURE__ */ n(i, {
|
|
12
|
+
x: f,
|
|
13
|
+
y: p,
|
|
14
|
+
r: 5,
|
|
15
|
+
xAxisId: o.xAxisId,
|
|
16
|
+
yAxisId: o.yAxisId,
|
|
17
|
+
ifOverflow: "extendDomain",
|
|
18
|
+
fill: a,
|
|
19
|
+
stroke: "var(--color-bg-surface)",
|
|
20
|
+
strokeWidth: 1.5,
|
|
21
|
+
label: e.label && u.length === 0 ? {
|
|
22
|
+
value: e.label,
|
|
23
|
+
fill: a,
|
|
24
|
+
fontSize: 11,
|
|
25
|
+
position: "top"
|
|
26
|
+
} : void 0
|
|
27
|
+
}, `ref-rel-${r}-${d}`));
|
|
28
|
+
}), u;
|
|
29
|
+
}
|
|
30
|
+
function s(t, i) {
|
|
31
|
+
return t?.length ? t.flatMap((t, s) => {
|
|
32
|
+
let c = e(t.color ?? "danger"), l = (t.axis ?? "y") === "y", u = i?.yAxisId ?? 0;
|
|
33
|
+
if (t.relativeTo) return o(t, s, c, {
|
|
34
|
+
xAxisId: 0,
|
|
35
|
+
yAxisId: u
|
|
36
|
+
}, i);
|
|
37
|
+
if (t.value2 != null) {
|
|
38
|
+
let e = Math.min(t.value, t.value2), i = Math.max(t.value, t.value2);
|
|
39
|
+
return /* @__PURE__ */ n(r, {
|
|
40
|
+
...l ? {
|
|
12
41
|
y1: e,
|
|
13
|
-
y2:
|
|
42
|
+
y2: i
|
|
14
43
|
} : {
|
|
15
44
|
x1: e,
|
|
16
|
-
x2:
|
|
45
|
+
x2: i
|
|
17
46
|
},
|
|
18
47
|
xAxisId: 0,
|
|
19
|
-
yAxisId:
|
|
48
|
+
yAxisId: u,
|
|
20
49
|
ifOverflow: "extendDomain",
|
|
21
|
-
fill:
|
|
50
|
+
fill: c,
|
|
22
51
|
fillOpacity: .1,
|
|
23
|
-
stroke:
|
|
52
|
+
stroke: c,
|
|
24
53
|
strokeOpacity: .3,
|
|
25
|
-
label:
|
|
26
|
-
value:
|
|
27
|
-
fill:
|
|
54
|
+
label: t.label ? {
|
|
55
|
+
value: t.label,
|
|
56
|
+
fill: c,
|
|
28
57
|
fontSize: 11,
|
|
29
58
|
position: "insideTopLeft"
|
|
30
59
|
} : void 0
|
|
31
|
-
}, `ref-band-${
|
|
60
|
+
}, `ref-band-${s}`);
|
|
32
61
|
}
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
...
|
|
62
|
+
return /* @__PURE__ */ n(a, {
|
|
63
|
+
...l ? { y: t.value } : { x: t.value },
|
|
35
64
|
xAxisId: 0,
|
|
36
|
-
yAxisId:
|
|
65
|
+
yAxisId: u,
|
|
37
66
|
ifOverflow: "extendDomain",
|
|
38
|
-
stroke:
|
|
67
|
+
stroke: c,
|
|
39
68
|
strokeWidth: 1.5,
|
|
40
|
-
strokeDasharray:
|
|
41
|
-
label:
|
|
42
|
-
value:
|
|
43
|
-
fill:
|
|
69
|
+
strokeDasharray: t.dashed === !1 ? void 0 : "6 4",
|
|
70
|
+
label: t.label ? {
|
|
71
|
+
value: t.label,
|
|
72
|
+
fill: c,
|
|
44
73
|
fontSize: 11,
|
|
45
74
|
position: "insideTopRight"
|
|
46
75
|
} : void 0
|
|
47
|
-
}, `ref-line-${
|
|
76
|
+
}, `ref-line-${s}`);
|
|
48
77
|
}) : [];
|
|
49
78
|
}
|
|
50
|
-
export {
|
|
79
|
+
export { s as buildReferenceElements };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SemanticIntent } from '../../utils/conditionalFormat';
|
|
1
|
+
import { ConditionalComparison, ConditionalRule, SemanticIntent } from '../../utils/conditionalFormat';
|
|
2
2
|
/**
|
|
3
3
|
* Chart Types
|
|
4
4
|
*
|
|
@@ -13,6 +13,11 @@ export interface ReferenceLineConfig {
|
|
|
13
13
|
label?: string;
|
|
14
14
|
color?: SemanticIntent;
|
|
15
15
|
dashed?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Draw the threshold per category, `value` away from that row's field
|
|
18
|
+
* (e.g. 10% above `budget`), instead of at the absolute `value` (BOFF-10145).
|
|
19
|
+
*/
|
|
20
|
+
relativeTo?: ConditionalComparison;
|
|
16
21
|
}
|
|
17
22
|
/** Per-series descriptor for combo / dual-axis charts. */
|
|
18
23
|
export interface SeriesConfig {
|
|
@@ -63,6 +68,8 @@ export interface ChartConfig {
|
|
|
63
68
|
paddingAngle?: number;
|
|
64
69
|
/** Reference / threshold lines & bands */
|
|
65
70
|
referenceLines?: ReferenceLineConfig[];
|
|
71
|
+
/** Rules that recolour matching bars (bar charts, BOFF-10145) */
|
|
72
|
+
conditionalRules?: ConditionalRule[];
|
|
66
73
|
/** Per-series config for combo / dual-axis charts */
|
|
67
74
|
series?: SeriesConfig[];
|
|
68
75
|
/** Enable a secondary (right) Y-axis */
|