@burdenoff/microfe-bigconsole 2026.1119.2 → 2026.1119.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/widgets/FilterNotAppliedNotice.d.ts +15 -0
- package/dist/bigconsole/components/widgets/FilterNotAppliedNotice.js +62 -0
- package/dist/bigconsole/components/widgets/WidgetWrapper.js +353 -351
- package/dist/bigconsole/components/widgets/chart/ChartWidget.js +131 -126
- package/dist/bigconsole/components/widgets/chart/chartRows.d.ts +16 -0
- package/dist/bigconsole/components/widgets/chart/chartRows.js +33 -1
- package/dist/bigconsole/components/widgets/metric-card/MetricCardWidget.d.ts +2 -20
- package/dist/bigconsole/components/widgets/metric-card/MetricCardWidget.js +4 -3
- package/dist/bigconsole/components/widgets/metric-card/metricCardData.d.ts +48 -0
- package/dist/bigconsole/components/widgets/metric-card/metricCardData.js +96 -0
- package/dist/bigconsole/components/widgets/metric-card/metricData.d.ts +9 -2
- package/dist/bigconsole/components/widgets/metric-card/metricData.js +10 -69
- package/dist/bigconsole/utils/applyGlobalFilters.d.ts +3 -1
- package/dist/bigconsole/utils/applyGlobalFilters.js +53 -4
- package/dist/bigconsole/utils/globalFilterMatching.d.ts +21 -3
- package/dist/bigconsole/utils/globalFilterMatching.js +14 -9
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveMetricCardData as e } from "./metricCardData.js";
|
|
2
2
|
// src/bigconsole/components/widgets/metric-card/metricData.ts
|
|
3
|
-
function
|
|
3
|
+
function t(e) {
|
|
4
4
|
return e !== void 0 && /^[a-z]{3}$/i.test(e) ? e.toUpperCase() : void 0;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
let
|
|
6
|
+
function n(e, n) {
|
|
7
|
+
let r = e?.format, i = r !== void 0 && r !== "auto" ? r === "currency" || r === "percentage" || r === "compact" ? r : "number" : n?.isCurrency === !0 ? "currency" : "number";
|
|
8
8
|
return {
|
|
9
9
|
style: i,
|
|
10
|
-
currency:
|
|
11
|
-
unitSuffix: i === "currency" || e?.suffix ? void 0 :
|
|
10
|
+
currency: t(n?.unit) ?? "USD",
|
|
11
|
+
unitSuffix: i === "currency" || e?.suffix ? void 0 : n?.unit
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function r(e, t, n) {
|
|
15
15
|
if (typeof e == "string") return e;
|
|
16
16
|
let { prefix: r, suffix: i, decimalPlaces: a } = t || {}, o = n.style, s = typeof a == "number" && Number.isFinite(a) ? Math.min(Math.max(Math.trunc(a), 0), 20) : void 0, c;
|
|
17
17
|
switch (o) {
|
|
@@ -40,66 +40,7 @@ function a(e, t, n) {
|
|
|
40
40
|
}
|
|
41
41
|
return r && (c = `${r}${c}`), i && (c = `${c}${i}`), n.unitSuffix && !c.endsWith(n.unitSuffix) && (c = `${c} ${n.unitSuffix}`), c;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
let a = (e, t) => t.split(".").reduce((e, t) => e && typeof e == "object" ? e[t] : void 0, e);
|
|
46
|
-
if (typeof r == "number" || typeof r == "string") return { value: r };
|
|
47
|
-
let o = i?.valueField;
|
|
48
|
-
if (o && typeof r == "object") {
|
|
49
|
-
let e = r, t = a(e, o);
|
|
50
|
-
if (t !== void 0) {
|
|
51
|
-
let n = i?.previousValueField, o = n ? a(e, n) : void 0, s = o !== void 0 && o !== 0 && Number.isFinite(o) && typeof t == "number" ? (t - o) / o * 100 : void 0, c = r.changePercent, l = o === void 0 ? {} : {
|
|
52
|
-
previousValue: o,
|
|
53
|
-
changePercent: s ?? (Number.isFinite(c) ? c : void 0)
|
|
54
|
-
};
|
|
55
|
-
return {
|
|
56
|
-
...r,
|
|
57
|
-
value: t,
|
|
58
|
-
...l
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (typeof r == "object" && "value" in r && r.value !== void 0) return r;
|
|
63
|
-
let s = [
|
|
64
|
-
"value",
|
|
65
|
-
"total",
|
|
66
|
-
"amount",
|
|
67
|
-
"count",
|
|
68
|
-
"sum",
|
|
69
|
-
"totalSales",
|
|
70
|
-
"totalRevenue",
|
|
71
|
-
"totalOrders"
|
|
72
|
-
];
|
|
73
|
-
for (let e of s) if (typeof r == "object" && e in r) {
|
|
74
|
-
let t = r[e];
|
|
75
|
-
if (typeof t == "number" || typeof t == "string") return { value: t };
|
|
76
|
-
}
|
|
77
|
-
if (typeof r == "object" && "summary" in r) {
|
|
78
|
-
let e = r.summary;
|
|
79
|
-
if (e && typeof e == "object") {
|
|
80
|
-
for (let t of s) if (t in e) {
|
|
81
|
-
let n = e[t];
|
|
82
|
-
if (typeof n == "number" || typeof n == "string") return { value: n };
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (typeof r == "number" || typeof r == "string") return { value: r };
|
|
87
|
-
let c = e(r);
|
|
88
|
-
if (c) {
|
|
89
|
-
let e = i?.valueField;
|
|
90
|
-
if (e) {
|
|
91
|
-
let t = n(r) ?? [c];
|
|
92
|
-
for (let n of t) if (n && typeof n == "object") {
|
|
93
|
-
let t = a(n, e);
|
|
94
|
-
if (typeof t == "number" || typeof t == "string") return { value: t };
|
|
95
|
-
}
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
let o = t(c);
|
|
99
|
-
if (o) {
|
|
100
|
-
let e = c[o];
|
|
101
|
-
if (typeof e == "number" || typeof e == "string") return { value: e };
|
|
102
|
-
}
|
|
103
|
-
}
|
|
43
|
+
function i(t, n) {
|
|
44
|
+
return e(t, n).data;
|
|
104
45
|
}
|
|
105
|
-
export {
|
|
46
|
+
export { r as formatValue, i as normalizeMetricData, n as resolveFormat };
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
* filter either narrows the rows a widget renders or is reported as not
|
|
8
8
|
* applicable. Envelopes keep every other property (e.g. retention `periods`,
|
|
9
9
|
* chart axes), so derived values such as retention averages are recomputed by
|
|
10
|
-
* the renderer from the narrowed rows.
|
|
10
|
+
* the renderer from the narrowed rows. A heatmap's axes are the exception:
|
|
11
|
+
* labels whose cells were all filtered out are dropped (see
|
|
12
|
+
* `narrowHeatmapEnvelope`), because the renderer draws every axis label.
|
|
11
13
|
*/
|
|
12
14
|
export interface ApplyGlobalFiltersOptions {
|
|
13
15
|
/** Merged filter values keyed by filter id, `ctx_<field>` (drilldown) or a field name. */
|
|
@@ -80,11 +80,60 @@ function f(e, n) {
|
|
|
80
80
|
if (typeof e != "object") return e;
|
|
81
81
|
let o = e, s = t(o, n.widgetType);
|
|
82
82
|
if (!s) return e;
|
|
83
|
-
let c = o[s].filter(a)
|
|
84
|
-
return {
|
|
83
|
+
let c = o[s], l = c.filter(a), u = {
|
|
85
84
|
...o,
|
|
86
|
-
[s]:
|
|
87
|
-
...s === "rows" ? { totalRows:
|
|
85
|
+
[s]: l,
|
|
86
|
+
...s === "rows" ? { totalRows: l.length } : {}
|
|
88
87
|
};
|
|
88
|
+
return s === "cells" && l.length < c.length ? g(u, c, l) : u;
|
|
89
|
+
}
|
|
90
|
+
function p(e) {
|
|
91
|
+
return Array.isArray(e) && e.every((e) => typeof e == "string");
|
|
92
|
+
}
|
|
93
|
+
function m(e) {
|
|
94
|
+
let t;
|
|
95
|
+
for (let n of e) {
|
|
96
|
+
if (typeof n != "object" || !n) continue;
|
|
97
|
+
let e = l(n.value);
|
|
98
|
+
e !== void 0 && (t = t ? {
|
|
99
|
+
min: Math.min(t.min, e),
|
|
100
|
+
max: Math.max(t.max, e)
|
|
101
|
+
} : {
|
|
102
|
+
min: e,
|
|
103
|
+
max: e
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return t;
|
|
107
|
+
}
|
|
108
|
+
function h(e, t) {
|
|
109
|
+
let n = /* @__PURE__ */ new Set();
|
|
110
|
+
for (let r of e) {
|
|
111
|
+
if (typeof r != "object" || !r) continue;
|
|
112
|
+
let e = r[t];
|
|
113
|
+
e != null && n.add(String(e));
|
|
114
|
+
}
|
|
115
|
+
return n;
|
|
116
|
+
}
|
|
117
|
+
function g(e, t, n) {
|
|
118
|
+
let r = { ...e };
|
|
119
|
+
for (let [i, a] of [["rows", "row"], ["columns", "column"]]) {
|
|
120
|
+
let o = e[i];
|
|
121
|
+
if (!p(o)) continue;
|
|
122
|
+
let s = h(t, a), c = h(n, a);
|
|
123
|
+
r[i] = o.filter((e) => !s.has(e) || c.has(e));
|
|
124
|
+
}
|
|
125
|
+
let i = m(t);
|
|
126
|
+
if (!i) return r;
|
|
127
|
+
let a = m(n), o = [[
|
|
128
|
+
"minValue",
|
|
129
|
+
i.min,
|
|
130
|
+
a?.min
|
|
131
|
+
], [
|
|
132
|
+
"maxValue",
|
|
133
|
+
i.max,
|
|
134
|
+
a?.max
|
|
135
|
+
]];
|
|
136
|
+
for (let [t, n, i] of o) l(e[t]) === n && (i === void 0 ? delete r[t] : r[t] = i);
|
|
137
|
+
return r;
|
|
89
138
|
}
|
|
90
139
|
export { f as applyGlobalFilters };
|
|
@@ -43,14 +43,32 @@ export interface InapplicableFilter {
|
|
|
43
43
|
filterId: string;
|
|
44
44
|
name: string;
|
|
45
45
|
field: string;
|
|
46
|
+
/**
|
|
47
|
+
* Why the filter cannot narrow the widget:
|
|
48
|
+
* - `missingField`: no row carries the field (or the data has no rows).
|
|
49
|
+
* - `precomputedValue`: the rows carry the field, but the value the widget
|
|
50
|
+
* shows is a precomputed figure beside them (a metric card's `total`), so
|
|
51
|
+
* narrowing the rows does not change it.
|
|
52
|
+
*/
|
|
53
|
+
reason: 'missingField' | 'precomputedValue';
|
|
54
|
+
}
|
|
55
|
+
export interface FindInapplicableFiltersOptions {
|
|
56
|
+
/**
|
|
57
|
+
* True when the widget shows a single precomputed value rather than a value
|
|
58
|
+
* derived from the rows (see `resolveMetricCardData`). Every active filter is
|
|
59
|
+
* then reported, because none can change that value.
|
|
60
|
+
*/
|
|
61
|
+
precomputedValue?: boolean;
|
|
46
62
|
}
|
|
47
63
|
/**
|
|
48
64
|
* Active filters that cannot narrow this widget's data: either the data has
|
|
49
65
|
* object rows but none carries the filter's configured field, or the data has
|
|
50
|
-
* no rows at all (e.g. a single-value metric card)
|
|
51
|
-
*
|
|
66
|
+
* no rows at all (e.g. a single-value metric card), or the widget shows a
|
|
67
|
+
* precomputed value the rows do not feed (`options.precomputedValue`). Pass
|
|
68
|
+
* the same subtree that is filtered (after dataKey/dataPath resolution).
|
|
69
|
+
* Absent data reports nothing.
|
|
52
70
|
*/
|
|
53
|
-
export declare function findInapplicableFilters(data: unknown, filterMeta: Record<string, FilterMeta>, filterValues: Record<string, unknown>, widgetType?: string): InapplicableFilter[];
|
|
71
|
+
export declare function findInapplicableFilters(data: unknown, filterMeta: Record<string, FilterMeta>, filterValues: Record<string, unknown>, widgetType?: string, options?: FindInapplicableFiltersOptions): InapplicableFilter[];
|
|
54
72
|
/**
|
|
55
73
|
* Category options for a filter. Configured labels always win for the values
|
|
56
74
|
* they cover. With `optionsFromField`, data-derived values lead and configured
|
|
@@ -105,15 +105,20 @@ function d(e, t) {
|
|
|
105
105
|
label: e
|
|
106
106
|
}));
|
|
107
107
|
}
|
|
108
|
-
function f(e, t, r, i) {
|
|
109
|
-
if (e == null || l(e, i)) return [];
|
|
110
|
-
let
|
|
111
|
-
for (let [e, n] of Object.entries(t))
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
108
|
+
function f(e, t, r, i, a = {}) {
|
|
109
|
+
if (e == null || !a.precomputedValue && l(e, i)) return [];
|
|
110
|
+
let c = u(e, i).filter(n), d = [];
|
|
111
|
+
for (let [e, n] of Object.entries(t)) {
|
|
112
|
+
if (o(r[e])) continue;
|
|
113
|
+
let t = c.some((e) => s(e, n.field) !== void 0);
|
|
114
|
+
(!t || a.precomputedValue) && d.push({
|
|
115
|
+
filterId: e,
|
|
116
|
+
name: n.name,
|
|
117
|
+
field: n.field,
|
|
118
|
+
reason: t || a.precomputedValue && c.length === 0 ? "precomputedValue" : "missingField"
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return d;
|
|
117
122
|
}
|
|
118
123
|
function p(e, t, r) {
|
|
119
124
|
let i = (Array.isArray(e) ? e : []).filter(n).map((e) => ({
|