@burdenoff/microfe-bigconsole 2026.1118.10 → 2026.1119.2

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.
Files changed (51) hide show
  1. package/dist/bigconsole/asof/AsOfBanner.d.ts +3 -0
  2. package/dist/bigconsole/asof/AsOfBanner.js +52 -0
  3. package/dist/bigconsole/asof/AsOfControl.d.ts +4 -0
  4. package/dist/bigconsole/asof/AsOfControl.js +164 -0
  5. package/dist/bigconsole/asof/AsOfProvider.d.ts +31 -0
  6. package/dist/bigconsole/asof/AsOfProvider.js +98 -0
  7. package/dist/bigconsole/asof/asOfMessage.d.ts +12 -0
  8. package/dist/bigconsole/asof/asOfMessage.js +12 -0
  9. package/dist/bigconsole/asof/asOfParam.d.ts +48 -0
  10. package/dist/bigconsole/asof/asOfParam.js +34 -0
  11. package/dist/bigconsole/asof/index.d.ts +7 -0
  12. package/dist/bigconsole/asof/index.js +6 -0
  13. package/dist/bigconsole/compare/compareEngine.d.ts +104 -0
  14. package/dist/bigconsole/compare/compareEngine.js +172 -0
  15. package/dist/bigconsole/compare/compareParam.d.ts +9 -0
  16. package/dist/bigconsole/compare/compareParam.js +13 -0
  17. package/dist/bigconsole/compare/compareSide.d.ts +5 -0
  18. package/dist/bigconsole/compare/compareSide.js +39 -0
  19. package/dist/bigconsole/compare/index.d.ts +3 -0
  20. package/dist/bigconsole/components/dashboard/DashboardCanvas.js +142 -138
  21. package/dist/bigconsole/components/dashboard/DashboardToolbar.js +97 -92
  22. package/dist/bigconsole/components/dashboard/ShareDialog/ShareDialog.js +78 -74
  23. package/dist/bigconsole/components/widgets/WidgetCompareView.d.ts +12 -0
  24. package/dist/bigconsole/components/widgets/WidgetCompareView.js +215 -0
  25. package/dist/bigconsole/components/widgets/WidgetMenu.js +98 -96
  26. package/dist/bigconsole/components/widgets/WidgetWrapper.js +399 -311
  27. package/dist/bigconsole/components/widgets/metric-card/MetricCardWidget.js +47 -148
  28. package/dist/bigconsole/components/widgets/metric-card/metricData.d.ts +23 -0
  29. package/dist/bigconsole/components/widgets/metric-card/metricData.js +105 -0
  30. package/dist/bigconsole/components/widgets/table/TableCell.d.ts +2 -1
  31. package/dist/bigconsole/components/widgets/table/TableCell.js +1 -1
  32. package/dist/bigconsole/components/widgets/table/TableWidget.js +142 -168
  33. package/dist/bigconsole/components/widgets/table/tableRows.d.ts +17 -0
  34. package/dist/bigconsole/components/widgets/table/tableRows.js +35 -0
  35. package/dist/bigconsole/hooks/index.d.ts +1 -0
  36. package/dist/bigconsole/hooks/index.js +25 -24
  37. package/dist/bigconsole/hooks/useFilterFieldValues.js +52 -22
  38. package/dist/bigconsole/hooks/useWidgetCompareData.d.ts +8 -0
  39. package/dist/bigconsole/hooks/useWidgetCompareData.js +24 -0
  40. package/dist/bigconsole/hooks/useWidgetData.d.ts +7 -0
  41. package/dist/bigconsole/hooks/useWidgetData.js +53 -43
  42. package/dist/bigconsole/pages/DashboardViewPage.d.ts +7 -1
  43. package/dist/bigconsole/pages/DashboardViewPage.js +300 -278
  44. package/dist/bigconsole/pages/index.d.ts +1 -1
  45. package/dist/bigconsole/types/index.d.ts +13 -0
  46. package/dist/bigconsole/utils/widgetDisplayData.d.ts +16 -0
  47. package/dist/bigconsole/utils/widgetDisplayData.js +12 -1
  48. package/dist/generated/wspace-operations.d.ts +47 -0
  49. package/dist/generated/wspace-operations.js +261 -16
  50. package/dist/generated/wspace-types.d.ts +78 -0
  51. package/package.json +1 -1
@@ -1,204 +1,103 @@
1
1
  import { TrendIndicator as e } from "./TrendIndicator.js";
2
2
  import { ComparisonBadge as t } from "./ComparisonBadge.js";
3
3
  import { SparklineChart as n } from "./SparklineChart.js";
4
- import { firstObjectRow as r, inferValueField as i, unwrapRows as a } from "../utils/inferFields.js";
4
+ import { formatValue as r, normalizeMetricData as i, resolveFormat as a } from "./metricData.js";
5
5
  import { conditionalStyleToClassName as o, resolveConditionalStyle as s } from "../utils/conditionalFormat.js";
6
6
  import { clampProgressWidth as c, getTargetProgress as l } from "../utils/targetProgress.js";
7
7
  import { memo as u, useCallback as d, useMemo as f } from "react";
8
8
  import { jsx as p, jsxs as m } from "react/jsx-runtime";
9
9
  // src/bigconsole/components/widgets/metric-card/MetricCardWidget.tsx
10
10
  function h(e) {
11
- return e !== void 0 && /^[a-z]{3}$/i.test(e) ? e.toUpperCase() : void 0;
12
- }
13
- function g(e, t) {
14
- let n = e?.format, r = n !== void 0 && n !== "auto" ? n === "currency" || n === "percentage" || n === "compact" ? n : "number" : t?.isCurrency === !0 ? "currency" : "number";
15
- return {
16
- style: r,
17
- currency: h(t?.unit) ?? "USD",
18
- unitSuffix: r === "currency" || e?.suffix ? void 0 : t?.unit
19
- };
20
- }
21
- function _(e, t, n) {
22
- if (typeof e == "string") return e;
23
- 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;
24
- switch (o) {
25
- case "currency":
26
- c = new Intl.NumberFormat("en-US", {
27
- style: "currency",
28
- currency: n.currency,
29
- minimumFractionDigits: s ?? 0,
30
- maximumFractionDigits: s ?? 2
31
- }).format(e);
32
- break;
33
- case "percentage":
34
- c = `${(e * 100).toFixed(s ?? 1)}%`;
35
- break;
36
- case "compact":
37
- c = new Intl.NumberFormat("en-US", {
38
- notation: "compact",
39
- minimumFractionDigits: s,
40
- maximumFractionDigits: s ?? 1
41
- }).format(e);
42
- break;
43
- default: c = new Intl.NumberFormat("en-US", {
44
- minimumFractionDigits: s,
45
- maximumFractionDigits: s ?? 2
46
- }).format(e);
47
- }
48
- return r && (c = `${r}${c}`), i && (c = `${c}${i}`), n.unitSuffix && !c.endsWith(n.unitSuffix) && (c = `${c} ${n.unitSuffix}`), c;
49
- }
50
- function v(e) {
51
11
  return e === void 0 || e === 0 ? "flat" : e > 0 ? "up" : "down";
52
12
  }
53
- function y(e, t) {
13
+ function g(e, t) {
54
14
  return e === "flat" ? "muted" : (t ? e === "up" : e === "down") ? "success" : "error";
55
15
  }
56
- var b = u(function({ widget: u, data: h, onClick: b, onDrilldown: x }) {
57
- let S = u.config, C = f(() => {
58
- if (!h) return;
59
- let e = (e, t) => t.split(".").reduce((e, t) => e && typeof e == "object" ? e[t] : void 0, e);
60
- if (typeof h == "number" || typeof h == "string") return { value: h };
61
- let t = S?.valueField;
62
- if (t && typeof h == "object") {
63
- let n = h, r = e(n, t);
64
- if (r !== void 0) {
65
- let t = S?.previousValueField, i = t ? e(n, t) : void 0, a = i !== void 0 && i !== 0 && Number.isFinite(i) && typeof r == "number" ? (r - i) / i * 100 : void 0, o = h.changePercent, s = i === void 0 ? {} : {
66
- previousValue: i,
67
- changePercent: a ?? (Number.isFinite(o) ? o : void 0)
68
- };
69
- return {
70
- ...h,
71
- value: r,
72
- ...s
73
- };
74
- }
75
- }
76
- if (typeof h == "object" && "value" in h && h.value !== void 0) return h;
77
- let n = [
78
- "value",
79
- "total",
80
- "amount",
81
- "count",
82
- "sum",
83
- "totalSales",
84
- "totalRevenue",
85
- "totalOrders"
86
- ];
87
- for (let e of n) if (typeof h == "object" && e in h) {
88
- let t = h[e];
89
- if (typeof t == "number" || typeof t == "string") return { value: t };
90
- }
91
- if (typeof h == "object" && "summary" in h) {
92
- let e = h.summary;
93
- if (e && typeof e == "object") {
94
- for (let t of n) if (t in e) {
95
- let n = e[t];
96
- if (typeof n == "number" || typeof n == "string") return { value: n };
97
- }
98
- }
99
- }
100
- if (typeof h == "number" || typeof h == "string") return { value: h };
101
- let o = r(h);
102
- if (o) {
103
- let t = S?.valueField;
104
- if (t) {
105
- let n = a(h) ?? [o];
106
- for (let r of n) if (r && typeof r == "object") {
107
- let n = e(r, t);
108
- if (typeof n == "number" || typeof n == "string") return { value: n };
109
- }
110
- return;
111
- }
112
- let n = i(o);
113
- if (n) {
114
- let e = o[n];
115
- if (typeof e == "number" || typeof e == "string") return { value: e };
116
- }
117
- }
118
- }, [h, S]), w = f(() => C?.trend || v(C?.changePercent), [C?.trend, C?.changePercent]), T = C?.trend !== void 0 || C?.changePercent !== void 0, E = S?.positiveIsGood ?? !0, D = f(() => g(S, C), [S, C]), O = f(() => C?.value === void 0 || C?.value === null ? "—" : _(C.value, S, D), [
119
- C?.value,
120
- S,
121
- D
122
- ]), k = f(() => l(C?.value, C?.target), [C?.value, C?.target]), A = f(() => y(w, E), [w, E]), j = f(() => {
123
- let e = s(C?.value, S?.conditionalRules);
16
+ var _ = u(function({ widget: u, data: _, onClick: v, onDrilldown: y }) {
17
+ let b = u.config, x = f(() => i(_, b), [_, b]), S = f(() => x?.trend || h(x?.changePercent), [x?.trend, x?.changePercent]), C = x?.trend !== void 0 || x?.changePercent !== void 0, w = b?.positiveIsGood ?? !0, T = f(() => a(b, x), [b, x]), E = f(() => x?.value === void 0 || x?.value === null ? "—" : r(x.value, b, T), [
18
+ x?.value,
19
+ b,
20
+ T
21
+ ]), D = f(() => l(x?.value, x?.target), [x?.value, x?.target]), O = f(() => g(S, w), [S, w]), k = f(() => {
22
+ let e = s(x?.value, b?.conditionalRules);
124
23
  return o(e);
125
- }, [C?.value, S?.conditionalRules]), M = d(() => {
126
- x ? x({
127
- value: C?.value,
128
- changePercent: C?.changePercent,
129
- trend: w,
130
- target: C?.target
131
- }) : b && u.drilldowns?.length && b();
24
+ }, [x?.value, b?.conditionalRules]), A = d(() => {
25
+ y ? y({
26
+ value: x?.value,
27
+ changePercent: x?.changePercent,
28
+ trend: S,
29
+ target: x?.target
30
+ }) : v && u.drilldowns?.length && v();
132
31
  }, [
133
- b,
134
- x,
32
+ v,
33
+ y,
135
34
  u.drilldowns,
136
- C,
137
- w
138
- ]), N = !!(x || b && u.drilldowns?.length);
35
+ x,
36
+ S
37
+ ]), j = !!(y || v && u.drilldowns?.length);
139
38
  return /* @__PURE__ */ m("div", {
140
39
  className: `
141
40
  flex min-w-0 flex-col h-full p-4
142
- ${N ? "cursor-pointer hover:bg-bg-sunken/50 transition-colors" : ""}
41
+ ${j ? "cursor-pointer hover:bg-bg-sunken/50 transition-colors" : ""}
143
42
  `,
144
43
  style: { containerType: "inline-size" },
145
- onClick: M,
146
- role: N ? "button" : void 0,
147
- tabIndex: N ? 0 : void 0,
44
+ onClick: A,
45
+ role: j ? "button" : void 0,
46
+ tabIndex: j ? 0 : void 0,
148
47
  onKeyDown: (e) => {
149
- N && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), M());
48
+ j && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), A());
150
49
  },
151
50
  children: [
152
- S?.subtitle && /* @__PURE__ */ p("p", {
51
+ b?.subtitle && /* @__PURE__ */ p("p", {
153
52
  className: "text-xs text-text-secondary mb-1 truncate",
154
- children: S.subtitle
53
+ children: b.subtitle
155
54
  }),
156
55
  /* @__PURE__ */ m("div", {
157
56
  className: "flex min-w-0 flex-wrap items-baseline gap-2 mb-2",
158
57
  children: [/* @__PURE__ */ p("span", {
159
- className: `min-w-0 max-w-full [overflow-wrap:anywhere] font-semibold tracking-tight ${j || "text-text-primary"}`,
58
+ className: `min-w-0 max-w-full [overflow-wrap:anywhere] font-semibold tracking-tight ${k || "text-text-primary"}`,
160
59
  style: { fontSize: "clamp(1rem, 12cqi, 1.875rem)" },
161
- title: O,
162
- children: O
163
- }), S?.showTrend !== !1 && T && /* @__PURE__ */ p(e, {
164
- direction: w,
60
+ title: E,
61
+ children: E
62
+ }), b?.showTrend !== !1 && C && /* @__PURE__ */ p(e, {
63
+ direction: S,
165
64
  size: "md",
166
- positiveIsGood: E
65
+ positiveIsGood: w
167
66
  })]
168
67
  }),
169
- S?.showComparison !== !1 && C?.changePercent !== void 0 && /* @__PURE__ */ p("div", {
68
+ b?.showComparison !== !1 && x?.changePercent !== void 0 && /* @__PURE__ */ p("div", {
170
69
  className: "mb-3",
171
70
  children: /* @__PURE__ */ p(t, {
172
- value: C.changePercent,
173
- label: S?.comparisonLabel,
174
- positiveIsGood: E,
71
+ value: x.changePercent,
72
+ label: b?.comparisonLabel,
73
+ positiveIsGood: w,
175
74
  size: "sm"
176
75
  })
177
76
  }),
178
- k !== null && C?.target !== void 0 && /* @__PURE__ */ m("div", {
77
+ D !== null && x?.target !== void 0 && /* @__PURE__ */ m("div", {
179
78
  className: "mb-3",
180
79
  children: [/* @__PURE__ */ m("div", {
181
80
  className: "flex justify-between text-xs text-text-secondary mb-1",
182
- children: [/* @__PURE__ */ m("span", { children: ["Target: ", _(C.target, S, D)] }), /* @__PURE__ */ m("span", { children: [k.toFixed(0), "%"] })]
81
+ children: [/* @__PURE__ */ m("span", { children: ["Target: ", r(x.target, b, T)] }), /* @__PURE__ */ m("span", { children: [D.toFixed(0), "%"] })]
183
82
  }), /* @__PURE__ */ p("div", {
184
83
  className: "h-1.5 bg-bg-sunken rounded-full overflow-hidden",
185
84
  children: /* @__PURE__ */ p("div", {
186
- className: `h-full rounded-full transition-all ${k >= 100 ? "bg-status-success-bg" : "bg-action-primary-bg"}`,
187
- style: { width: `${c(k)}%` }
85
+ className: `h-full rounded-full transition-all ${D >= 100 ? "bg-status-success-bg" : "bg-action-primary-bg"}`,
86
+ style: { width: `${c(D)}%` }
188
87
  })
189
88
  })]
190
89
  }),
191
- S?.showSparkline !== !1 && C?.sparklineData?.length ? /* @__PURE__ */ p("div", {
90
+ b?.showSparkline !== !1 && x?.sparklineData?.length ? /* @__PURE__ */ p("div", {
192
91
  className: "mt-auto pt-2",
193
92
  children: /* @__PURE__ */ p(n, {
194
- data: C.sparklineData,
93
+ data: x.sparklineData,
195
94
  width: 120,
196
95
  height: 32,
197
- color: A,
96
+ color: O,
198
97
  showFill: !0
199
98
  })
200
99
  }) : null,
201
- N && /* @__PURE__ */ p("div", {
100
+ j && /* @__PURE__ */ p("div", {
202
101
  className: "mt-auto pt-2 flex items-center justify-end",
203
102
  children: /* @__PURE__ */ m("span", {
204
103
  className: "text-xs text-text-secondary flex items-center gap-1",
@@ -219,4 +118,4 @@ var b = u(function({ widget: u, data: h, onClick: b, onDrilldown: x }) {
219
118
  ]
220
119
  });
221
120
  });
222
- export { b as MetricCardWidget, b as default };
121
+ export { _ as MetricCardWidget, _ as default };
@@ -0,0 +1,23 @@
1
+ import { MetricCardConfig } from '../../../types';
2
+ import { MetricCardData } from './MetricCardWidget';
3
+ export interface ResolvedFormat {
4
+ style: 'currency' | 'percentage' | 'compact' | 'number';
5
+ currency: string;
6
+ /** Payload unit rendered as a trailing label; undefined when the style or config already covers it. */
7
+ unitSuffix?: string;
8
+ }
9
+ /**
10
+ * Decide the numeric style, honouring the payload without ever overriding the user.
11
+ *
12
+ * `MetricCardData` documents `unit` and `isCurrency`, but nothing read them — a
13
+ * parser emitting `{value: 482350.75, unit: "USD", isCurrency: true}` rendered a
14
+ * bare "482,350.75". They cannot simply take precedence though: WidgetRegistry
15
+ * seeds `format` onto every card, so a persisted `'number'` is indistinguishable
16
+ * from a deliberate choice. `'auto'` is the sentinel that defers to the payload.
17
+ */
18
+ export declare function resolveFormat(config?: MetricCardConfig, data?: MetricCardData): ResolvedFormat;
19
+ /**
20
+ * Format a number based on configuration
21
+ */
22
+ export declare function formatValue(value: number | string, config: MetricCardConfig | undefined, resolved: ResolvedFormat): string;
23
+ export declare function normalizeMetricData(rawData: MetricCardData | undefined, config: MetricCardConfig | undefined): MetricCardData | undefined;
@@ -0,0 +1,105 @@
1
+ import { firstObjectRow as e, inferValueField as t, unwrapRows as n } from "../utils/inferFields.js";
2
+ // src/bigconsole/components/widgets/metric-card/metricData.ts
3
+ function r(e) {
4
+ return e !== void 0 && /^[a-z]{3}$/i.test(e) ? e.toUpperCase() : void 0;
5
+ }
6
+ function i(e, t) {
7
+ let n = e?.format, i = n !== void 0 && n !== "auto" ? n === "currency" || n === "percentage" || n === "compact" ? n : "number" : t?.isCurrency === !0 ? "currency" : "number";
8
+ return {
9
+ style: i,
10
+ currency: r(t?.unit) ?? "USD",
11
+ unitSuffix: i === "currency" || e?.suffix ? void 0 : t?.unit
12
+ };
13
+ }
14
+ function a(e, t, n) {
15
+ if (typeof e == "string") return e;
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
+ switch (o) {
18
+ case "currency":
19
+ c = new Intl.NumberFormat("en-US", {
20
+ style: "currency",
21
+ currency: n.currency,
22
+ minimumFractionDigits: s ?? 0,
23
+ maximumFractionDigits: s ?? 2
24
+ }).format(e);
25
+ break;
26
+ case "percentage":
27
+ c = `${(e * 100).toFixed(s ?? 1)}%`;
28
+ break;
29
+ case "compact":
30
+ c = new Intl.NumberFormat("en-US", {
31
+ notation: "compact",
32
+ minimumFractionDigits: s,
33
+ maximumFractionDigits: s ?? 1
34
+ }).format(e);
35
+ break;
36
+ default: c = new Intl.NumberFormat("en-US", {
37
+ minimumFractionDigits: s,
38
+ maximumFractionDigits: s ?? 2
39
+ }).format(e);
40
+ }
41
+ return r && (c = `${r}${c}`), i && (c = `${c}${i}`), n.unitSuffix && !c.endsWith(n.unitSuffix) && (c = `${c} ${n.unitSuffix}`), c;
42
+ }
43
+ function o(r, i) {
44
+ if (!r) return;
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
+ }
104
+ }
105
+ export { a as formatValue, o as normalizeMetricData, i as resolveFormat };
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import { FC, ReactNode } from 'react';
2
2
  import { ColumnDefinition } from './TableHeader';
3
3
  import { ConditionalRule } from '../utils/conditionalFormat';
4
4
  /** In-cell mini-chart kinds. */
@@ -36,5 +36,6 @@ export interface TableCellProps {
36
36
  /** Click handler */
37
37
  onClick?: () => void;
38
38
  }
39
+ export declare function formatValue(value: unknown, format?: CellFormatConfig): ReactNode;
39
40
  export declare const TableCell: FC<TableCellProps>;
40
41
  export default TableCell;
@@ -113,4 +113,4 @@ var d = o(function({ value: o, column: d, format: f, rowData: p, conditionalRule
113
113
  })]
114
114
  });
115
115
  });
116
- export { d as TableCell, d as default };
116
+ export { d as TableCell, d as default, u as formatValue };