@burdenoff/microfe-bigconsole 2026.1119.7 → 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/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/pages/InsightsPage.js +458 -451
- 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/generated/global-operations.d.ts +45 -6
- package/dist/generated/global-types.d.ts +5839 -804
- package/dist/generated/wspace-operations.d.ts +30 -0
- package/dist/generated/wspace-operations.js +28 -0
- package/dist/generated/wspace-types.d.ts +1339 -6
- package/package.json +1 -1
|
@@ -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 */
|
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
import { parseComparison as e } from "../utils/conditionalFormat.js";
|
|
2
|
+
var t = [
|
|
2
3
|
"danger",
|
|
3
4
|
"warning",
|
|
4
5
|
"success",
|
|
5
6
|
"info",
|
|
6
7
|
"neutral"
|
|
7
8
|
];
|
|
8
|
-
function t(t) {
|
|
9
|
-
return typeof t == "string" && e.includes(t);
|
|
10
|
-
}
|
|
11
9
|
function n(e) {
|
|
12
|
-
return typeof e == "
|
|
10
|
+
return typeof e == "string" && t.includes(e);
|
|
13
11
|
}
|
|
14
12
|
function r(e) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
s
|
|
13
|
+
return typeof e == "number" && Number.isFinite(e) ? e : void 0;
|
|
14
|
+
}
|
|
15
|
+
function i(t) {
|
|
16
|
+
if (!Array.isArray(t)) return [];
|
|
17
|
+
let i = [];
|
|
18
|
+
for (let a of t) {
|
|
19
|
+
if (i.length >= 10) break;
|
|
20
|
+
if (!a || typeof a != "object") continue;
|
|
21
|
+
let t = a, o = r(t.value);
|
|
22
|
+
if (o === void 0) continue;
|
|
23
|
+
let s = e(t.relativeTo);
|
|
24
|
+
if (s === null) continue;
|
|
25
|
+
let c = { value: o };
|
|
26
|
+
(t.axis === "x" || t.axis === "y") && (c.axis = t.axis);
|
|
27
|
+
let l = r(t.value2);
|
|
28
|
+
l !== void 0 && (c.value2 = l), typeof t.label == "string" && t.label !== "" && (c.label = t.label), n(t.color) && (c.color = t.color), typeof t.dashed == "boolean" && (c.dashed = t.dashed), s && (c.relativeTo = s), i.push(c);
|
|
26
29
|
}
|
|
27
|
-
return
|
|
30
|
+
return i;
|
|
28
31
|
}
|
|
29
|
-
function
|
|
32
|
+
function a(e) {
|
|
30
33
|
let t = e.trim();
|
|
31
34
|
if (t === "") return null;
|
|
32
35
|
let n = Number(t);
|
|
33
36
|
return Number.isFinite(n) ? n : null;
|
|
34
37
|
}
|
|
35
|
-
function
|
|
38
|
+
function o(e, t = 0) {
|
|
36
39
|
return e.length >= 10 ? [...e] : [...e, {
|
|
37
40
|
axis: "y",
|
|
38
41
|
value: t,
|
|
@@ -40,7 +43,7 @@ function a(e, t = 0) {
|
|
|
40
43
|
dashed: !0
|
|
41
44
|
}];
|
|
42
45
|
}
|
|
43
|
-
function
|
|
46
|
+
function s(e, t, n) {
|
|
44
47
|
return e.map((e, r) => {
|
|
45
48
|
if (r !== t) return e;
|
|
46
49
|
let i = { ...e };
|
|
@@ -48,10 +51,10 @@ function o(e, t, n) {
|
|
|
48
51
|
return i;
|
|
49
52
|
});
|
|
50
53
|
}
|
|
51
|
-
function
|
|
54
|
+
function c(e, t) {
|
|
52
55
|
return e.filter((e, n) => n !== t);
|
|
53
56
|
}
|
|
54
|
-
function
|
|
57
|
+
function l(e) {
|
|
55
58
|
return e.length > 0 ? [...e] : void 0;
|
|
56
59
|
}
|
|
57
|
-
export {
|
|
60
|
+
export { t as REFERENCE_LINE_INTENTS, o as addReferenceLine, i as normalizeReferenceLines, a as parseReferenceValue, c as removeReferenceLine, l as toReferenceLinesConfig, s as updateReferenceLine };
|
|
@@ -31,6 +31,19 @@ export interface ConditionalStyle {
|
|
|
31
31
|
/** Color intent for the data bar (defaults to `info`). */
|
|
32
32
|
dataBarColor?: SemanticIntent;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* How a derived rule compares its field with a base field on the same row
|
|
36
|
+
* (BOFF-10145). `percentChange` is (field - base) / |base| × 100, so
|
|
37
|
+
* "over budget by more than 10%" is `{field: 'actual', compareTo: {field:
|
|
38
|
+
* 'budget', mode: 'percentChange'}, operator: 'gt', value: 10}`;
|
|
39
|
+
* `difference` is field - base.
|
|
40
|
+
*/
|
|
41
|
+
export type ComparisonMode = 'percentChange' | 'difference';
|
|
42
|
+
export interface ConditionalComparison {
|
|
43
|
+
/** Sibling row key holding the base value (e.g. `budget`). */
|
|
44
|
+
field: string;
|
|
45
|
+
mode: ComparisonMode;
|
|
46
|
+
}
|
|
34
47
|
export interface ConditionalRule {
|
|
35
48
|
/** Optional stable id (UI keying). */
|
|
36
49
|
id?: string;
|
|
@@ -52,9 +65,31 @@ export interface ConditionalRule {
|
|
|
52
65
|
valueType?: 'constant' | 'field';
|
|
53
66
|
/** Sibling row key supplying the operand when `valueType === 'field'`. */
|
|
54
67
|
fieldRef?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Test a value derived from `field` and another row field instead of the raw
|
|
70
|
+
* `field` value. Only numeric operators match a derived value.
|
|
71
|
+
*/
|
|
72
|
+
compareTo?: ConditionalComparison;
|
|
55
73
|
/** Styling applied when the rule matches. */
|
|
56
74
|
style: ConditionalStyle;
|
|
57
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* The derived value a comparison yields, or null when either side is missing,
|
|
78
|
+
* non-numeric, or the percentage base is zero (a change from 0 has no percent).
|
|
79
|
+
*/
|
|
80
|
+
export declare function deriveComparison(value: unknown, base: unknown, mode: ComparisonMode): number | null;
|
|
81
|
+
/**
|
|
82
|
+
* Read a stored `{field, mode}` comparison. Returns `undefined` when absent and
|
|
83
|
+
* `null` when malformed, so a caller can drop the rule or line instead of
|
|
84
|
+
* treating a relative threshold as an absolute one.
|
|
85
|
+
*/
|
|
86
|
+
export declare function parseComparison(value: unknown): ConditionalComparison | null | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* The value a relative threshold resolves to for one row: `value`% above the
|
|
89
|
+
* base (`percentChange`) or `value` above it (`difference`). The percentage is
|
|
90
|
+
* taken of |base| to match `deriveComparison`. Null when the base is missing.
|
|
91
|
+
*/
|
|
92
|
+
export declare function relativeThreshold(base: unknown, value: number, mode: ComparisonMode): number | null;
|
|
58
93
|
/** Evaluate a single rule against a candidate value. */
|
|
59
94
|
export declare function evaluateRule(rawValue: unknown, rule: ConditionalRule, rowData?: Record<string, unknown>): boolean;
|
|
60
95
|
/**
|
|
@@ -63,6 +98,12 @@ export declare function evaluateRule(rawValue: unknown, rule: ConditionalRule, r
|
|
|
63
98
|
* general to specific. Returns `undefined` when nothing matches.
|
|
64
99
|
*/
|
|
65
100
|
export declare function resolveConditionalStyle(rawValue: unknown, rules: ConditionalRule[] | undefined, rowData?: Record<string, unknown>): ConditionalStyle | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Fill for one bar of a series (BOFF-10145). A rule applies to the bar of the
|
|
103
|
+
* series it names (`field`), or to every series' own value when it names none.
|
|
104
|
+
* Returns `undefined` when nothing matches, so the series colour is kept.
|
|
105
|
+
*/
|
|
106
|
+
export declare function resolveBarFill(row: Record<string, unknown>, seriesKey: string, rules: ConditionalRule[] | undefined): string | undefined;
|
|
66
107
|
/** CSS variable for a semantic intent's solid color (charts/SVG). */
|
|
67
108
|
export declare function intentToCssVar(intent: SemanticIntent): string;
|
|
68
109
|
/** Build the Tailwind className fragment for a resolved style (DOM cells). */
|