@burdenoff/microfe-bigconsole 2026.1119.1 → 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 (31) hide show
  1. package/dist/bigconsole/asof/AsOfBanner.js +28 -14
  2. package/dist/bigconsole/asof/AsOfControl.js +84 -16
  3. package/dist/bigconsole/asof/AsOfProvider.d.ts +7 -0
  4. package/dist/bigconsole/asof/AsOfProvider.js +74 -52
  5. package/dist/bigconsole/asof/index.d.ts +1 -1
  6. package/dist/bigconsole/asof/index.js +4 -4
  7. package/dist/bigconsole/compare/compareEngine.d.ts +104 -0
  8. package/dist/bigconsole/compare/compareEngine.js +172 -0
  9. package/dist/bigconsole/compare/compareParam.d.ts +9 -0
  10. package/dist/bigconsole/compare/compareParam.js +13 -0
  11. package/dist/bigconsole/compare/compareSide.d.ts +5 -0
  12. package/dist/bigconsole/compare/compareSide.js +39 -0
  13. package/dist/bigconsole/compare/index.d.ts +3 -0
  14. package/dist/bigconsole/components/widgets/WidgetCompareView.d.ts +12 -0
  15. package/dist/bigconsole/components/widgets/WidgetCompareView.js +215 -0
  16. package/dist/bigconsole/components/widgets/WidgetWrapper.js +371 -322
  17. package/dist/bigconsole/components/widgets/metric-card/MetricCardWidget.js +47 -148
  18. package/dist/bigconsole/components/widgets/metric-card/metricData.d.ts +23 -0
  19. package/dist/bigconsole/components/widgets/metric-card/metricData.js +105 -0
  20. package/dist/bigconsole/components/widgets/table/TableCell.d.ts +2 -1
  21. package/dist/bigconsole/components/widgets/table/TableCell.js +1 -1
  22. package/dist/bigconsole/components/widgets/table/TableWidget.js +142 -168
  23. package/dist/bigconsole/components/widgets/table/tableRows.d.ts +17 -0
  24. package/dist/bigconsole/components/widgets/table/tableRows.js +35 -0
  25. package/dist/bigconsole/hooks/index.d.ts +1 -0
  26. package/dist/bigconsole/hooks/index.js +25 -24
  27. package/dist/bigconsole/hooks/useWidgetCompareData.d.ts +8 -0
  28. package/dist/bigconsole/hooks/useWidgetCompareData.js +24 -0
  29. package/dist/bigconsole/utils/widgetDisplayData.d.ts +10 -0
  30. package/dist/bigconsole/utils/widgetDisplayData.js +8 -1
  31. package/package.json +1 -1
@@ -9,11 +9,12 @@ import { resolveRowClassName as ne } from "../utils/conditionalFormat.js";
9
9
  import "../../../contexts/index.js";
10
10
  import "../../../store/index.js";
11
11
  import "../../../hooks/index.js";
12
- import { memo as o, useCallback as s, useEffect as re, useMemo as c, useRef as ie, useState as l } from "react";
13
- import { useI18n as ae } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
12
+ import { buildCellFormats as re, normalizeTableRows as ie } from "./tableRows.js";
13
+ import { memo as o, useCallback as s, useEffect as ae, useMemo as c, useRef as oe, useState as l } from "react";
14
+ import { useI18n as se } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
14
15
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
15
16
  // src/bigconsole/components/widgets/table/TableWidget.tsx
16
- function oe(e, t) {
17
+ function ce(e, t) {
17
18
  return !t.column || !t.direction ? e : [...e].sort((e, n) => {
18
19
  let r = e[t.column], i = n[t.column];
19
20
  if (r == null && i == null) return 0;
@@ -23,7 +24,7 @@ function oe(e, t) {
23
24
  return a = typeof r == "number" && typeof i == "number" ? r - i : String(r).localeCompare(String(i)), t.direction === "asc" ? a : -a;
24
25
  });
25
26
  }
26
- function f(e, t, n) {
27
+ function le(e, t, n) {
27
28
  if (!t.trim()) return e;
28
29
  let r = t.toLowerCase();
29
30
  return e.filter((e) => n.some((t) => {
@@ -31,7 +32,7 @@ function f(e, t, n) {
31
32
  return n != null && String(n).toLowerCase().includes(r);
32
33
  }));
33
34
  }
34
- function se(e, t, n) {
35
+ function f(e, t, n) {
35
36
  switch (t) {
36
37
  case "currency": return new Intl.NumberFormat("en-US", {
37
38
  style: "currency",
@@ -43,32 +44,13 @@ function se(e, t, n) {
43
44
  }
44
45
  }
45
46
  var p = o(function({ widget: o, data: p = [], onRowClick: m, onDrilldown: h }) {
46
- let { t: g } = ae(), _ = o.config, v = c(() => {
47
- if (Array.isArray(p)) return p;
48
- if (p && typeof p == "object") {
49
- for (let e of [
50
- "data",
51
- "items",
52
- "rows",
53
- "results",
54
- "records",
55
- "list",
56
- "sales",
57
- "entries",
58
- "values"
59
- ]) if (Array.isArray(p[e])) return p[e];
60
- let e = Object.values(p);
61
- for (let t of e) if (Array.isArray(t)) return t;
62
- return [p];
63
- }
64
- return [];
65
- }, [p]), { handleDataClick: y, enabled: b } = r(o.id, _?.crossFilterMappings), { clearAllCrossFilters: ce, hasCrossFilters: le } = n(), x = te(_), [S, C] = l(x), [w, ue] = l(x);
66
- (w.column !== x.column || w.direction !== x.direction) && (ue(x), C(x));
67
- let [T, de] = l(""), [E, D] = l({
47
+ let { t: g } = se(), _ = o.config, v = c(() => ie(p), [p]), { handleDataClick: y, enabled: b } = r(o.id, _?.crossFilterMappings), { clearAllCrossFilters: ue, hasCrossFilters: de } = n(), x = te(_), [S, C] = l(x), [w, fe] = l(x);
48
+ (w.column !== x.column || w.direction !== x.direction) && (fe(x), C(x));
49
+ let [T, E] = l(""), [D, O] = l({
68
50
  page: 0,
69
51
  pageSize: _?.pageSize || 10,
70
52
  totalItems: 0
71
- }), O = e(), { persistConfig: k } = a(o), [A, j] = l({}), [M, fe] = l(null), N = c(() => _?.columns?.length ? _.columns.map((e) => {
53
+ }), k = e(), { persistConfig: A } = a(o), [j, M] = l({}), [N, pe] = l(null), P = c(() => _?.columns?.length ? _.columns.map((e) => {
72
54
  if (typeof e == "string") return {
73
55
  key: e,
74
56
  header: e.charAt(0).toUpperCase() + e.slice(1).replace(/_/g, " "),
@@ -86,28 +68,28 @@ var p = o(function({ widget: o, data: p = [], onRowClick: m, onDrilldown: h }) {
86
68
  key: e,
87
69
  header: e.charAt(0).toUpperCase() + e.slice(1).replace(/_/g, " "),
88
70
  sortable: !0
89
- })) : [], [_?.columns, v]), P = c(() => {
90
- let e = N;
91
- if (M) {
92
- let t = new Map(N.map((e) => [e.key, e])), n = M.map((e) => t.get(e)).filter((e) => e !== void 0), r = N.filter((e) => !M.includes(e.key));
71
+ })) : [], [_?.columns, v]), F = c(() => {
72
+ let e = P;
73
+ if (N) {
74
+ let t = new Map(P.map((e) => [e.key, e])), n = N.map((e) => t.get(e)).filter((e) => e !== void 0), r = P.filter((e) => !N.includes(e.key));
93
75
  e = [...n, ...r];
94
76
  }
95
- return Object.keys(A).length > 0 && (e = e.map((e) => A[e.key] == null ? e : {
77
+ return Object.keys(j).length > 0 && (e = e.map((e) => j[e.key] == null ? e : {
96
78
  ...e,
97
- width: `${A[e.key]}px`
79
+ width: `${j[e.key]}px`
98
80
  })), e;
99
81
  }, [
82
+ P,
100
83
  N,
101
- M,
102
- A
103
- ]), F = s((e, t) => {
84
+ j
85
+ ]), I = s((e, t) => {
104
86
  let n = /* @__PURE__ */ new Map();
105
87
  _?.columns?.forEach((e) => {
106
88
  let t = e.key || e.field;
107
89
  t && n.set(t, e);
108
90
  });
109
- let r = N.map((e) => e.key), i = [...e.filter((e) => r.includes(e)), ...r.filter((t) => !e.includes(t))].map((e) => {
110
- let r = N.find((t) => t.key === e), i = {
91
+ let r = P.map((e) => e.key), i = [...e.filter((e) => r.includes(e)), ...r.filter((t) => !e.includes(t))].map((e) => {
92
+ let r = P.find((t) => t.key === e), i = {
111
93
  ...n.get(e) ?? {},
112
94
  key: e
113
95
  };
@@ -115,153 +97,145 @@ var p = o(function({ widget: o, data: p = [], onRowClick: m, onDrilldown: h }) {
115
97
  let a = t[e];
116
98
  return a != null && (i.width = a), i;
117
99
  });
118
- k({ columns: i });
100
+ A({ columns: i });
119
101
  }, [
120
- N,
102
+ P,
121
103
  _?.columns,
122
- k
123
- ]), pe = s((e, t) => {
124
- j((n) => ({
104
+ A
105
+ ]), L = s((e, t) => {
106
+ M((n) => ({
125
107
  ...n,
126
108
  [e]: t
127
109
  }));
128
- }, []), me = s((e, t) => {
110
+ }, []), R = s((e, t) => {
129
111
  let n = {
130
- ...A,
112
+ ...j,
131
113
  [e]: t
132
114
  };
133
- j(n);
134
- let r = M ?? N.map((e) => e.key);
135
- F(r, n);
115
+ M(n);
116
+ let r = N ?? P.map((e) => e.key);
117
+ I(r, n);
136
118
  }, [
137
- A,
138
- M,
119
+ j,
139
120
  N,
140
- F
141
- ]), I = s((e, t) => {
142
- let n = M ?? N.map((e) => e.key), r = n.indexOf(e);
121
+ P,
122
+ I
123
+ ]), z = s((e, t) => {
124
+ let n = N ?? P.map((e) => e.key), r = n.indexOf(e);
143
125
  if (r < 0 || e === t) return;
144
126
  let i = [...n];
145
127
  i.splice(r, 1);
146
128
  let a = i.indexOf(t);
147
- a < 0 || (i.splice(a, 0, e), fe(i), F(i, A));
129
+ a < 0 || (i.splice(a, 0, e), pe(i), I(i, j));
148
130
  }, [
149
- M,
150
131
  N,
151
- A,
152
- F
153
- ]), L = c(() => {
154
- let e = {};
155
- return _?.columns?.forEach((t) => {
156
- t.format && (t.key || t.field) && (e[t.key || t.field || ""] = {
157
- type: t.format,
158
- ...t.linkPattern ? { linkPattern: t.linkPattern } : {}
159
- });
160
- }), e;
161
- }, [_?.columns]), R = c(() => {
132
+ P,
133
+ j,
134
+ I
135
+ ]), B = c(() => re(_?.columns), [_?.columns]), me = c(() => {
162
136
  let e = {};
163
137
  return _?.columns?.forEach((t) => {
164
138
  let n = t.key || t.field;
165
139
  n && t.cellChart && (e[n] = t.cellChart);
166
140
  }), e;
167
- }, [_?.columns]), z = _?.conditionalRules, he = _?.rowRules, ge = c(() => {
141
+ }, [_?.columns]), he = _?.conditionalRules, ge = _?.rowRules, _e = c(() => {
168
142
  let e = {};
169
143
  return _?.columns?.forEach((t) => {
170
144
  let n = t.key || t.field;
171
145
  n && t.conditionalRules?.length && (e[n] = t.conditionalRules);
172
146
  }), e;
173
- }, [_?.columns]), B = c(() => {
147
+ }, [_?.columns]), V = c(() => {
174
148
  let e = {};
175
149
  return _?.columns?.forEach((t) => {
176
150
  let n = t.key || t.field;
177
151
  n && t.total && t.total !== "none" && (e[n] = t.total);
178
152
  }), e;
179
- }, [_?.columns]), V = _?.showTotals === !0 || Object.keys(B).length > 0, H = c(() => {
153
+ }, [_?.columns]), H = _?.showTotals === !0 || Object.keys(V).length > 0, U = c(() => {
180
154
  let e = v;
181
- return _?.showSearch !== !1 && (e = f(e, T, P)), e = oe(e, S), e;
155
+ return _?.showSearch !== !1 && (e = le(e, T, F)), e = ce(e, S), e;
182
156
  }, [
183
157
  v,
184
158
  T,
185
159
  S,
186
- P,
160
+ F,
187
161
  _?.showSearch
188
- ]), _e = c(() => {
162
+ ]), ve = c(() => {
189
163
  let e = {};
190
- for (let t of P) {
164
+ for (let t of F) {
191
165
  let n = 0;
192
- for (let e of H) {
166
+ for (let e of U) {
193
167
  let r = e[t.key];
194
168
  typeof r == "number" && Number.isFinite(r) && (n = Math.max(n, Math.abs(r)));
195
169
  }
196
170
  e[t.key] = n;
197
171
  }
198
172
  return e;
199
- }, [P, H]), ve = c(() => {
200
- if (!V) return {};
173
+ }, [F, U]), ye = c(() => {
174
+ if (!H) return {};
201
175
  let e = {};
202
- for (let t of P) {
203
- let n = B[t.key];
176
+ for (let t of F) {
177
+ let n = V[t.key];
204
178
  if (!n) {
205
179
  e[t.key] = null;
206
180
  continue;
207
181
  }
208
- let r = H.map((e) => e[t.key]).filter((e) => typeof e == "number" && Number.isFinite(e));
209
- n === "count" ? e[t.key] = H.length : r.length === 0 ? e[t.key] = null : n === "sum" ? e[t.key] = r.reduce((e, t) => e + t, 0) : n === "avg" ? e[t.key] = r.reduce((e, t) => e + t, 0) / r.length : n === "min" ? e[t.key] = Math.min(...r) : n === "max" ? e[t.key] = Math.max(...r) : e[t.key] = null;
182
+ let r = U.map((e) => e[t.key]).filter((e) => typeof e == "number" && Number.isFinite(e));
183
+ n === "count" ? e[t.key] = U.length : r.length === 0 ? e[t.key] = null : n === "sum" ? e[t.key] = r.reduce((e, t) => e + t, 0) : n === "avg" ? e[t.key] = r.reduce((e, t) => e + t, 0) / r.length : n === "min" ? e[t.key] = Math.min(...r) : n === "max" ? e[t.key] = Math.max(...r) : e[t.key] = null;
210
184
  }
211
185
  return e;
212
186
  }, [
187
+ H,
188
+ F,
213
189
  V,
214
- P,
215
- B,
216
- H
190
+ U
217
191
  ]);
218
192
  c(() => {
219
- D((e) => ({
193
+ O((e) => ({
220
194
  ...e,
221
- totalItems: H.length
195
+ totalItems: U.length
222
196
  }));
223
- }, [H.length]);
224
- let ye = c(() => {
225
- if (_?.showPagination === !1) return H;
226
- let e = E.page * E.pageSize;
227
- return H.slice(e, e + E.pageSize);
197
+ }, [U.length]);
198
+ let be = c(() => {
199
+ if (_?.showPagination === !1) return U;
200
+ let e = D.page * D.pageSize;
201
+ return U.slice(e, e + D.pageSize);
228
202
  }, [
229
- H,
230
- E,
203
+ U,
204
+ D,
231
205
  _?.showPagination
232
- ]), U = _?.virtualized === !0, W = _?.rowHeight && _.rowHeight > 0 ? _.rowHeight : 44, G = ie(null), [K, be] = l(0), [q, J] = l(0);
233
- re(() => {
234
- if (!U) return;
235
- let e = G.current;
206
+ ]), W = _?.virtualized === !0, G = _?.rowHeight && _.rowHeight > 0 ? _.rowHeight : 44, K = oe(null), [q, xe] = l(0), [J, Y] = l(0);
207
+ ae(() => {
208
+ if (!W) return;
209
+ let e = K.current;
236
210
  if (!e) return;
237
- J(e.clientHeight);
238
- let t = typeof ResizeObserver < "u" ? new ResizeObserver(() => J(e.clientHeight)) : void 0;
211
+ Y(e.clientHeight);
212
+ let t = typeof ResizeObserver < "u" ? new ResizeObserver(() => Y(e.clientHeight)) : void 0;
239
213
  return t?.observe(e), () => t?.disconnect();
240
- }, [U]);
241
- let Y = c(() => {
242
- if (!U) return null;
243
- let e = H.length, t = q > 0 ? Math.ceil(q / W) : 20, n = Math.max(0, Math.floor(K / W) - 6), r = Math.min(e, n + t + 12);
214
+ }, [W]);
215
+ let X = c(() => {
216
+ if (!W) return null;
217
+ let e = U.length, t = J > 0 ? Math.ceil(J / G) : 20, n = Math.max(0, Math.floor(q / G) - 6), r = Math.min(e, n + t + 12);
244
218
  return {
245
- rows: H.slice(n, r),
246
- topSpacer: n * W,
247
- bottomSpacer: Math.max(0, (e - r) * W),
219
+ rows: U.slice(n, r),
220
+ topSpacer: n * G,
221
+ bottomSpacer: Math.max(0, (e - r) * G),
248
222
  startIndex: n
249
223
  };
250
224
  }, [
225
+ W,
251
226
  U,
252
- H,
227
+ J,
253
228
  q,
254
- K,
255
- W
256
- ]), xe = U && Y ? Y.rows : ye, Se = U && Y ? Y.startIndex : 0, X = _?.frozenColumns && _.frozenColumns > 0 ? _.frozenColumns : 0, { displayColumns: Z, frozenLefts: Q } = c(() => {
257
- if (X <= 0) return {
258
- displayColumns: P,
229
+ G
230
+ ]), Se = W && X ? X.rows : be, Ce = W && X ? X.startIndex : 0, Z = _?.frozenColumns && _.frozenColumns > 0 ? _.frozenColumns : 0, { displayColumns: Q, frozenLefts: $ } = c(() => {
231
+ if (Z <= 0) return {
232
+ displayColumns: F,
259
233
  frozenLefts: {}
260
234
  };
261
235
  let e = {}, t = 0;
262
236
  return {
263
- displayColumns: P.map((n, r) => {
264
- if (r < X) {
237
+ displayColumns: F.map((n, r) => {
238
+ if (r < Z) {
265
239
  let r = n.width && parseInt(n.width, 10) || 160;
266
240
  return e[n.key] = t, t += r, {
267
241
  ...n,
@@ -272,7 +246,7 @@ var p = o(function({ widget: o, data: p = [], onRowClick: m, onDrilldown: h }) {
272
246
  }),
273
247
  frozenLefts: e
274
248
  };
275
- }, [P, X]), Ce = s((e) => {
249
+ }, [F, Z]), we = s((e) => {
276
250
  C((t) => {
277
251
  if (t.column !== e) return {
278
252
  column: e,
@@ -284,21 +258,21 @@ var p = o(function({ widget: o, data: p = [], onRowClick: m, onDrilldown: h }) {
284
258
  direction: n
285
259
  };
286
260
  });
287
- }, []), we = s((e) => {
288
- D((t) => ({
261
+ }, []), Te = s((e) => {
262
+ O((t) => ({
289
263
  ...t,
290
264
  page: e
291
265
  }));
292
- }, []), Te = s((e) => {
293
- D((t) => ({
266
+ }, []), Ee = s((e) => {
267
+ O((t) => ({
294
268
  ...t,
295
269
  pageSize: e,
296
270
  page: 0
297
271
  }));
298
- }, []), Ee = s((e, t) => {
272
+ }, []), De = s((e, t) => {
299
273
  let n = _?.crossFilterMappings?.length || _?.enableCrossFilter;
300
274
  if (b && n) {
301
- let t = P[0]?.key, n = t ? String(e[t]) : void 0;
275
+ let t = F[0]?.key, n = t ? String(e[t]) : void 0;
302
276
  y(e, n);
303
277
  }
304
278
  h ? h(e) : m && o.drilldowns?.length && m(e, t);
@@ -308,11 +282,11 @@ var p = o(function({ widget: o, data: p = [], onRowClick: m, onDrilldown: h }) {
308
282
  o.drilldowns,
309
283
  b,
310
284
  y,
311
- P,
285
+ F,
312
286
  _?.crossFilterMappings,
313
287
  _?.enableCrossFilter
314
- ]), $ = s(() => {
315
- let e = [P.map((e) => e.header).join(","), ...H.map((e) => P.map((t) => {
288
+ ]), Oe = s(() => {
289
+ let e = [F.map((e) => e.header).join(","), ...U.map((e) => F.map((t) => {
316
290
  let n = e[t.key];
317
291
  if (n == null) return "";
318
292
  let r = String(n);
@@ -320,19 +294,19 @@ var p = o(function({ widget: o, data: p = [], onRowClick: m, onDrilldown: h }) {
320
294
  }).join(","))].join("\n"), t = new Blob([e], { type: "text/csv" }), n = URL.createObjectURL(t), r = document.createElement("a");
321
295
  r.href = n, r.download = `${o.title || "table"}-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.csv`, r.click(), URL.revokeObjectURL(n);
322
296
  }, [
323
- P,
324
- H,
297
+ F,
298
+ U,
325
299
  o.title
326
- ]), De = _?.crossFilterMappings?.length || _?.enableCrossFilter, Oe = !!(h || m && o.drilldowns?.length || De);
300
+ ]), ke = _?.crossFilterMappings?.length || _?.enableCrossFilter, Ae = !!(h || m && o.drilldowns?.length || ke);
327
301
  return /* @__PURE__ */ d("div", {
328
302
  className: "flex flex-col h-full",
329
303
  children: [
330
- le && /* @__PURE__ */ u("div", {
304
+ de && /* @__PURE__ */ u("div", {
331
305
  className: "flex items-center gap-2 px-3 py-2 border-b border-border-default",
332
306
  children: /* @__PURE__ */ d("button", {
333
307
  type: "button",
334
308
  onClick: (e) => {
335
- e.stopPropagation(), ce();
309
+ e.stopPropagation(), ue();
336
310
  },
337
311
  className: "\n inline-flex items-center gap-1.5\n px-2.5 py-1 rounded-md\n text-xs font-medium\n bg-action-primary-bg/10 text-action-primary-text\n hover:bg-action-primary-bg/20\n transition-colors\n ",
338
312
  children: [/* @__PURE__ */ u("svg", {
@@ -369,12 +343,12 @@ var p = o(function({ widget: o, data: p = [], onRowClick: m, onDrilldown: h }) {
369
343
  placeholder: g("bigconsole.widget.table.search", "Search…"),
370
344
  "aria-label": g("bigconsole.widget.table.search", "Search…"),
371
345
  value: T,
372
- onChange: (e) => de(e.target.value),
346
+ onChange: (e) => E(e.target.value),
373
347
  className: "\n pl-10 pr-4 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 focus:border-action-primary-bg\n w-48 sm:w-64\n placeholder:text-text-muted\n "
374
348
  })]
375
349
  }), _?.showExport !== !1 && /* @__PURE__ */ d("button", {
376
350
  type: "button",
377
- onClick: $,
351
+ onClick: Oe,
378
352
  className: "\n inline-flex items-center gap-2\n px-3 py-2\n text-sm font-medium\n text-text-primary\n bg-bg-surface\n border border-border-default\n rounded-md\n hover:bg-bg-sunken\n transition-colors\n ",
379
353
  children: [/* @__PURE__ */ u("svg", {
380
354
  className: "w-4 h-4",
@@ -391,61 +365,61 @@ var p = o(function({ widget: o, data: p = [], onRowClick: m, onDrilldown: h }) {
391
365
  })]
392
366
  }),
393
367
  /* @__PURE__ */ d("div", {
394
- ref: G,
368
+ ref: K,
395
369
  className: "flex-1 overflow-auto",
396
- onScroll: U ? (e) => be(e.target.scrollTop) : void 0,
370
+ onScroll: W ? (e) => xe(e.target.scrollTop) : void 0,
397
371
  children: [/* @__PURE__ */ d("table", {
398
372
  className: "w-full",
399
373
  children: [
400
374
  /* @__PURE__ */ u(t, {
401
- columns: Z,
375
+ columns: Q,
402
376
  sortState: S,
403
- onSort: Ce,
404
- frozenLefts: X > 0 ? Q : void 0,
405
- editable: O,
406
- onColumnResize: O ? pe : void 0,
407
- onColumnResizeEnd: O ? me : void 0,
408
- onColumnReorder: O ? I : void 0
377
+ onSort: we,
378
+ frozenLefts: Z > 0 ? $ : void 0,
379
+ editable: k,
380
+ onColumnResize: k ? L : void 0,
381
+ onColumnResizeEnd: k ? R : void 0,
382
+ onColumnReorder: k ? z : void 0
409
383
  }),
410
384
  /* @__PURE__ */ d("tbody", { children: [
411
- U && Y && Y.topSpacer > 0 && /* @__PURE__ */ u("tr", {
385
+ W && X && X.topSpacer > 0 && /* @__PURE__ */ u("tr", {
412
386
  "aria-hidden": "true",
413
- style: { height: Y.topSpacer },
387
+ style: { height: X.topSpacer },
414
388
  children: /* @__PURE__ */ u("td", {
415
- colSpan: Z.length,
389
+ colSpan: Q.length,
416
390
  style: {
417
391
  padding: 0,
418
392
  border: "none"
419
393
  }
420
394
  })
421
395
  }),
422
- xe.map((e, t) => {
423
- let n = Se + t;
396
+ Se.map((e, t) => {
397
+ let n = Ce + t;
424
398
  return /* @__PURE__ */ u("tr", {
425
399
  className: `
426
- ${Oe ? "cursor-pointer hover:bg-bg-sunken/50" : ""}
400
+ ${Ae ? "cursor-pointer hover:bg-bg-sunken/50" : ""}
427
401
  ${n % 2 == 0 ? "bg-bg-surface" : "bg-bg-sunken/30"}
428
- ${ne(e, he)}
402
+ ${ne(e, ge)}
429
403
  `,
430
- style: U ? { height: W } : void 0,
431
- onClick: () => Ee(e, n),
432
- children: Z.map((t) => /* @__PURE__ */ u(i, {
404
+ style: W ? { height: G } : void 0,
405
+ onClick: () => De(e, n),
406
+ children: Q.map((t) => /* @__PURE__ */ u(i, {
433
407
  value: e[t.key],
434
408
  column: t,
435
- format: L[t.key],
409
+ format: B[t.key],
436
410
  rowData: e,
437
- conditionalRules: ge[t.key] ?? z,
438
- dataBarMax: _e[t.key],
439
- stickyLeft: Q[t.key],
440
- cellChart: R[t.key]
411
+ conditionalRules: _e[t.key] ?? he,
412
+ dataBarMax: ve[t.key],
413
+ stickyLeft: $[t.key],
414
+ cellChart: me[t.key]
441
415
  }, t.key))
442
416
  }, n);
443
417
  }),
444
- U && Y && Y.bottomSpacer > 0 && /* @__PURE__ */ u("tr", {
418
+ W && X && X.bottomSpacer > 0 && /* @__PURE__ */ u("tr", {
445
419
  "aria-hidden": "true",
446
- style: { height: Y.bottomSpacer },
420
+ style: { height: X.bottomSpacer },
447
421
  children: /* @__PURE__ */ u("td", {
448
- colSpan: Z.length,
422
+ colSpan: Q.length,
449
423
  style: {
450
424
  padding: 0,
451
425
  border: "none"
@@ -453,10 +427,10 @@ var p = o(function({ widget: o, data: p = [], onRowClick: m, onDrilldown: h }) {
453
427
  })
454
428
  })
455
429
  ] }),
456
- V && H.length > 0 && /* @__PURE__ */ u("tfoot", { children: /* @__PURE__ */ u("tr", {
430
+ H && U.length > 0 && /* @__PURE__ */ u("tfoot", { children: /* @__PURE__ */ u("tr", {
457
431
  className: "bg-bg-sunken/50 font-semibold border-t-2 border-border-default",
458
- children: Z.map((e, t) => {
459
- let n = ve[e.key], r = L[e.key], i = Q[e.key];
432
+ children: Q.map((e, t) => {
433
+ let n = ye[e.key], r = B[e.key], i = $[e.key];
460
434
  return /* @__PURE__ */ u("td", {
461
435
  className: `
462
436
  px-4 py-3 text-sm text-text-primary
@@ -465,23 +439,23 @@ var p = o(function({ widget: o, data: p = [], onRowClick: m, onDrilldown: h }) {
465
439
  ${i == null ? "" : "sticky z-10 bg-bg-sunken"}
466
440
  `,
467
441
  style: i == null ? void 0 : { left: i },
468
- children: n == null ? t === 0 ? "Total" : "" : se(n, r?.type, r?.currency)
442
+ children: n == null ? t === 0 ? "Total" : "" : f(n, r?.type, r?.currency)
469
443
  }, e.key);
470
444
  })
471
445
  }) })
472
446
  ]
473
- }), H.length === 0 && /* @__PURE__ */ u("div", {
447
+ }), U.length === 0 && /* @__PURE__ */ u("div", {
474
448
  className: "flex items-center justify-center py-12 text-text-secondary",
475
449
  children: T ? "No matching records found" : "No data available"
476
450
  })]
477
451
  }),
478
- !U && _?.showPagination !== !1 && H.length > 0 && /* @__PURE__ */ u(ee, {
452
+ !W && _?.showPagination !== !1 && U.length > 0 && /* @__PURE__ */ u(ee, {
479
453
  pagination: {
480
- ...E,
481
- totalItems: H.length
454
+ ...D,
455
+ totalItems: U.length
482
456
  },
483
- onPageChange: we,
484
- onPageSizeChange: Te
457
+ onPageChange: Te,
458
+ onPageSizeChange: Ee
485
459
  })
486
460
  ]
487
461
  });
@@ -0,0 +1,17 @@
1
+ import { TableColumnConfig } from '../../../types';
2
+ import { CellFormatConfig } from './TableCell';
3
+ /**
4
+ * The cell format of each column that sets one, keyed by the column's field. Kept apart from the
5
+ * component so the "As of" compare (BOFF-14758) formats a cell exactly as the table does.
6
+ */
7
+ export declare function buildCellFormats(columns: readonly (string | TableColumnConfig)[] | undefined): Record<string, CellFormatConfig>;
8
+ /** The header the table shows for a column: its configured label, else its field, capitalised. */
9
+ export declare function tableColumnHeader(columns: readonly (string | TableColumnConfig)[] | undefined, key: string): string;
10
+ /**
11
+ * The rows a Table widget shows, out of the data it was given: a bare array, an
12
+ * object holding one (`{ items: [...] }`), or a single object.
13
+ *
14
+ * Kept apart from the component so the "As of" compare (BOFF-14758) reads a table
15
+ * exactly the way the widget does.
16
+ */
17
+ export declare function normalizeTableRows(rawData: unknown): Record<string, unknown>[];
@@ -0,0 +1,35 @@
1
+ // src/bigconsole/components/widgets/table/tableRows.ts
2
+ function e(e) {
3
+ let t = {};
4
+ return e?.forEach((e) => {
5
+ typeof e != "string" && e.format && (e.key || e.field) && (t[e.key || e.field || ""] = {
6
+ type: e.format,
7
+ ...e.linkPattern ? { linkPattern: e.linkPattern } : {}
8
+ });
9
+ }), t;
10
+ }
11
+ function t(e, t) {
12
+ let n = e?.find((e) => typeof e == "string" ? e === t : (e.key || e.field) === t);
13
+ return n && typeof n != "string" ? n.label || n.header || t : t.charAt(0).toUpperCase() + t.slice(1).replace(/_/g, " ");
14
+ }
15
+ function n(e) {
16
+ if (Array.isArray(e)) return e;
17
+ if (e && typeof e == "object") {
18
+ for (let t of [
19
+ "data",
20
+ "items",
21
+ "rows",
22
+ "results",
23
+ "records",
24
+ "list",
25
+ "sales",
26
+ "entries",
27
+ "values"
28
+ ]) if (Array.isArray(e[t])) return e[t];
29
+ let t = Object.values(e);
30
+ for (let e of t) if (Array.isArray(e)) return e;
31
+ return [e];
32
+ }
33
+ return [];
34
+ }
35
+ export { e as buildCellFormats, n as normalizeTableRows, t as tableColumnHeader };
@@ -4,6 +4,7 @@
4
4
  * Custom React hooks for widget and dashboard functionality.
5
5
  */
6
6
  export { useWidgetData, useWidgetsData, default as useWidgetDataDefault } from './useWidgetData';
7
+ export { useWidgetCompareData } from './useWidgetCompareData';
7
8
  export { useWidgetCatalog, default as useWidgetCatalogDefault } from './useWidgetCatalog';
8
9
  export type { UseWidgetCatalogParams, UseWidgetCatalogResult } from './useWidgetCatalog';
9
10
  export { useAutoRefresh, useWidgetAutoRefresh, formatTimeUntilRefresh, default as useAutoRefreshDefault, } from './useAutoRefresh';