@burdenoff/microfe-bigconsole 2026.1118.10 → 2026.1119.1

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 (30) hide show
  1. package/dist/bigconsole/asof/AsOfBanner.d.ts +3 -0
  2. package/dist/bigconsole/asof/AsOfBanner.js +38 -0
  3. package/dist/bigconsole/asof/AsOfControl.d.ts +4 -0
  4. package/dist/bigconsole/asof/AsOfControl.js +96 -0
  5. package/dist/bigconsole/asof/AsOfProvider.d.ts +24 -0
  6. package/dist/bigconsole/asof/AsOfProvider.js +76 -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/components/dashboard/DashboardCanvas.js +142 -138
  14. package/dist/bigconsole/components/dashboard/DashboardToolbar.js +97 -92
  15. package/dist/bigconsole/components/dashboard/ShareDialog/ShareDialog.js +78 -74
  16. package/dist/bigconsole/components/widgets/WidgetMenu.js +98 -96
  17. package/dist/bigconsole/components/widgets/WidgetWrapper.js +345 -306
  18. package/dist/bigconsole/hooks/useFilterFieldValues.js +52 -22
  19. package/dist/bigconsole/hooks/useWidgetData.d.ts +7 -0
  20. package/dist/bigconsole/hooks/useWidgetData.js +53 -43
  21. package/dist/bigconsole/pages/DashboardViewPage.d.ts +7 -1
  22. package/dist/bigconsole/pages/DashboardViewPage.js +300 -278
  23. package/dist/bigconsole/pages/index.d.ts +1 -1
  24. package/dist/bigconsole/types/index.d.ts +13 -0
  25. package/dist/bigconsole/utils/widgetDisplayData.d.ts +6 -0
  26. package/dist/bigconsole/utils/widgetDisplayData.js +4 -0
  27. package/dist/generated/wspace-operations.d.ts +47 -0
  28. package/dist/generated/wspace-operations.js +261 -16
  29. package/dist/generated/wspace-types.d.ts +78 -0
  30. package/package.json +1 -1
@@ -1,36 +1,66 @@
1
1
  import { useWidgetStore as e } from "../store/widgetStore.js";
2
- import { GetWidgetDocument as t } from "../../generated/wspace-operations.js";
2
+ import { GetWidgetDataAsOfDocument as t, GetWidgetDocument as n } from "../../generated/wspace-operations.js";
3
+ import "../asof/index.js";
4
+ import { useAsOf as r } from "../asof/AsOfProvider.js";
3
5
  import "../store/index.js";
4
- import { distinctFieldValues as n } from "../utils/globalFilterMatching.js";
5
- import { useCallback as r, useMemo as i, useState as a } from "react";
6
- import { useApolloClient as o } from "@apollo/client/react";
6
+ import { distinctFieldValues as i } from "../utils/globalFilterMatching.js";
7
+ import { useCallback as a, useEffect as o, useMemo as s, useState as c } from "react";
8
+ import { useApolloClient as l } from "@apollo/client/react";
7
9
  // src/bigconsole/hooks/useFilterFieldValues.ts
8
- function s(s, c) {
9
- let l = o(), u = e((e) => e.widgets), [d, f] = a(0), p = r(() => {
10
- if (!s || !c?.trim()) return [];
10
+ function u(u, d) {
11
+ let f = l(), p = e((e) => e.widgets), [m, h] = c(0), { asOf: g } = r(), _ = g ? g.toISOString() : null, v = a(() => {
12
+ if (!u || !d?.trim()) return [];
11
13
  let e = [];
12
- for (let n of u.values()) {
13
- if (n.dashboardId !== s) continue;
14
- let r;
14
+ for (let r of p.values()) {
15
+ if (r.dashboardId !== u) continue;
16
+ let i;
15
17
  try {
16
- r = l.readQuery({
18
+ i = _ ? f.readQuery({
17
19
  query: t,
18
- variables: { id: n.id }
20
+ variables: {
21
+ id: r.id,
22
+ asOf: _
23
+ }
24
+ })?.getWidget?.data : f.readQuery({
25
+ query: n,
26
+ variables: { id: r.id }
19
27
  })?.getWidget?.data;
20
28
  } catch {}
21
- let i = r ?? n.data;
22
- i && e.push(i);
29
+ let a = _ ? i : i ?? r.data;
30
+ a && e.push(a);
23
31
  }
24
- return n(e, c);
32
+ return i(e, d);
25
33
  }, [
26
- l,
34
+ f,
35
+ p,
27
36
  u,
28
- s,
29
- c
37
+ d,
38
+ _
30
39
  ]);
31
- return {
32
- values: i(() => d >= 0 ? p() : [], [p, d]),
33
- refresh: r(() => (f((e) => e + 1), p()), [p])
40
+ return o(() => {
41
+ if (!_ || !u) return;
42
+ let e = [];
43
+ for (let n of p.values()) n.dashboardId === u && e.push(f.cache.watch({
44
+ query: t,
45
+ variables: {
46
+ id: n.id,
47
+ asOf: _
48
+ },
49
+ optimistic: !1,
50
+ returnPartialData: !0,
51
+ callback: () => h((e) => e + 1)
52
+ }));
53
+ return () => {
54
+ for (let t of e) t();
55
+ };
56
+ }, [
57
+ f,
58
+ p,
59
+ u,
60
+ _
61
+ ]), {
62
+ values: s(() => m >= 0 ? v() : [], [v, m]),
63
+ refresh: a(() => (h((e) => e + 1), v()), [v])
34
64
  };
35
65
  }
36
- export { s as useFilterFieldValues };
66
+ export { u as useFilterFieldValues };
@@ -10,6 +10,11 @@ interface UseWidgetDataOptions {
10
10
  onError?: (error: Error) => void;
11
11
  /** Global filter values to apply */
12
12
  filterValues?: Record<string, unknown>;
13
+ /**
14
+ * Read the data as it was at this time (BOFF-14757). Live data is not fetched
15
+ * or polled meanwhile, and a refresh does nothing.
16
+ */
17
+ asOf?: Date | null;
13
18
  }
14
19
  interface UseWidgetDataResult {
15
20
  /** The widget with its data */
@@ -26,6 +31,8 @@ interface UseWidgetDataResult {
26
31
  refetch: () => Promise<void>;
27
32
  /** Is currently refreshing */
28
33
  isRefreshing: boolean;
34
+ /** What an as-of read used. Null for a live read. */
35
+ asOfInfo: WidgetData['asOf'] | null;
29
36
  }
30
37
  export declare function useWidgetData(widgetId: string, options?: UseWidgetDataOptions): UseWidgetDataResult;
31
38
  interface UseWidgetsDataOptions {
@@ -2,43 +2,50 @@ import { useWidgetStore as e } from "../store/widgetStore.js";
2
2
  import { useQueryLifecycle as t } from "./useQueryLifecycle.js";
3
3
  import "./useWidgetOperations.js";
4
4
  import "../store/index.js";
5
- import { GetWidgetDocument as n, RefreshWidgetDataDocument as r } from "../../generated/wspace-operations.js";
6
- import { useCallback as i, useMemo as a } from "react";
7
- import { useMutation as o, useQuery as s } from "@apollo/client/react";
5
+ import { GetWidgetDataAsOfDocument as n, GetWidgetDocument as r, RefreshWidgetDataDocument as i } from "../../generated/wspace-operations.js";
6
+ import { useCallback as a, useMemo as o } from "react";
7
+ import { useMutation as s, useQuery as c } from "@apollo/client/react";
8
8
  // src/bigconsole/hooks/useWidgetData.ts
9
- function c(c, l = {}) {
10
- let { skip: u = !1, pollInterval: d = 0, onSuccess: f, onError: p } = l, m = e((e) => e.setWidgetLoading), h = e((e) => e.setWidgetError), { data: g, dataState: _, observable: v, loading: y, error: b, refetch: x } = s(n, {
11
- variables: { id: c },
12
- skip: u || !c,
13
- pollInterval: d,
9
+ function l(l, u = {}) {
10
+ let { skip: d = !1, pollInterval: f = 0, onSuccess: p, onError: m, asOf: h = null } = u, g = h !== null, _ = e((e) => e.setWidgetLoading), v = e((e) => e.setWidgetError), { data: y, dataState: b, observable: x, loading: S, error: C, refetch: w } = c(r, {
11
+ variables: { id: l },
12
+ skip: d || !l || g,
13
+ pollInterval: f,
14
14
  fetchPolicy: "cache-and-network",
15
15
  returnPartialData: !1,
16
16
  notifyOnNetworkStatusChange: !0
17
- }), S = t(v, c, !u && !!c, {
17
+ }), { data: T, loading: E, error: D } = c(n, {
18
+ variables: {
19
+ id: l,
20
+ asOf: (h ?? /* @__PURE__ */ new Date(0)).toISOString()
21
+ },
22
+ skip: d || !l || !g,
23
+ fetchPolicy: "cache-first"
24
+ }), O = t(x, l, !d && !!l, {
18
25
  onCompleted: (e) => {
19
- m(c, !1), h(c, null);
26
+ _(l, !1), v(l, null);
20
27
  let t = e.getWidget?.data;
21
- t && f?.(t);
28
+ t && p?.(t);
22
29
  },
23
30
  onError: (e) => {
24
- m(c, !1), h(c, e.message), p && p(e);
31
+ _(l, !1), v(l, e.message), m && m(e);
25
32
  }
26
- }), [C, { loading: w }] = o(r, {
33
+ }), [k, { loading: A }] = s(i, {
27
34
  onCompleted: (e) => {
28
- if (!S()) return;
29
- m(c, !1), h(c, null);
35
+ if (!O()) return;
36
+ _(l, !1), v(l, null);
30
37
  let t = e.refreshWidgetData;
31
- t && f && f(t);
38
+ t && p && p(t);
32
39
  },
33
40
  onError: (e) => {
34
- S() && (m(c, !1), h(c, e.message), p && p(e));
41
+ O() && (_(l, !1), v(l, e.message), m && m(e));
35
42
  },
36
43
  update: (e, { data: t }) => {
37
44
  let n = t?.refreshWidgetData;
38
45
  n && e.modify({
39
46
  id: e.identify({
40
47
  __typename: "BigConsoleWidget",
41
- id: c
48
+ id: l
42
49
  }),
43
50
  fields: {
44
51
  data: () => n,
@@ -46,40 +53,43 @@ function c(c, l = {}) {
46
53
  }
47
54
  });
48
55
  }
49
- }), T = i(async () => {
50
- if (!c || !S()) return null;
51
- m(c, !0);
56
+ }), j = a(async () => {
57
+ if (!l || !O() || g) return null;
58
+ _(l, !0);
52
59
  try {
53
- return (await C({ variables: { widgetId: c } })).data?.refreshWidgetData ?? null;
60
+ return (await k({ variables: { widgetId: l } })).data?.refreshWidgetData ?? null;
54
61
  } catch {
55
62
  return null;
56
63
  }
57
64
  }, [
58
- c,
59
- C,
60
- m,
61
- S
62
- ]), E = i(async () => {
63
- if (c && S()) {
64
- m(c, !0);
65
+ l,
66
+ k,
67
+ _,
68
+ O,
69
+ g
70
+ ]), M = a(async () => {
71
+ if (l && O() && !g) {
72
+ _(l, !0);
65
73
  try {
66
- await x();
74
+ await w();
67
75
  } catch {}
68
76
  }
69
77
  }, [
70
- c,
71
- x,
72
- m,
73
- S
74
- ]), D = (!u && c && _ === "complete" ? g : void 0)?.getWidget, O = a(() => D || null, [D]), k = O?.data;
78
+ l,
79
+ w,
80
+ _,
81
+ O,
82
+ g
83
+ ]), N = (!d && l && b === "complete" ? y : void 0)?.getWidget, P = o(() => N || null, [N]), F = g ? T?.getWidget?.data : null, I = g ? F : P?.data, L = o(() => I || null, [I]), R = g ? D : C, z = o(() => R ? Error(R.message) : null, [R]);
75
84
  return {
76
- widget: O,
77
- data: a(() => k || null, [k]),
78
- loading: y,
79
- error: a(() => b ? Error(b.message) : null, [b]),
80
- refresh: T,
81
- refetch: E,
82
- isRefreshing: w
85
+ widget: g ? null : P,
86
+ data: L,
87
+ asOfInfo: L?.asOf ?? null,
88
+ loading: g ? E : S,
89
+ error: z,
90
+ refresh: j,
91
+ refetch: M,
92
+ isRefreshing: A
83
93
  };
84
94
  }
85
- export { c as default, c as useWidgetData };
95
+ export { l as default, l as useWidgetData };
@@ -1,3 +1,9 @@
1
1
  import { FC } from 'react';
2
2
  export declare const DashboardViewPage: FC;
3
- export default DashboardViewPage;
3
+ /**
4
+ * The dashboard view. The as-of provider sits outside the page body so that every
5
+ * part of the page, header and assistant tools included, can see whether a past
6
+ * time is shown (BOFF-14757).
7
+ */
8
+ declare const DashboardViewPageWithAsOf: FC;
9
+ export default DashboardViewPageWithAsOf;