@burdenoff/microfe-bigconsole 2026.1118.6 → 2026.1118.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.
@@ -9,12 +9,13 @@ import ae from "../../hooks/useWidgetComments.js";
9
9
  import oe from "../../hooks/useWidgetExport.js";
10
10
  import se from "../../hooks/useDrilldown.js";
11
11
  import { getWidgetDefinition as ce } from "./WidgetRegistry.js";
12
- import { resolveTextData as i } from "./text-widget/textData.js";
13
- import { WidgetHeader as le } from "./WidgetHeader.js";
14
- import { useBigConsoleSettings as ue } from "../../hooks/useBigConsoleSettings.js";
15
- import { WidgetLoadingState as de } from "./states/LoadingState.js";
12
+ import { resolveTextData as le } from "./text-widget/textData.js";
13
+ import { WidgetHeader as ue } from "./WidgetHeader.js";
14
+ import { WidgetMenu as i } from "./WidgetMenu.js";
15
+ import { useBigConsoleSettings as de } from "../../hooks/useBigConsoleSettings.js";
16
+ import { WidgetLoadingState as a } from "./states/LoadingState.js";
16
17
  import { WidgetErrorState as fe } from "./states/ErrorState.js";
17
- import { WidgetEmptyState as a } from "./states/EmptyState.js";
18
+ import { WidgetEmptyState as o } from "./states/EmptyState.js";
18
19
  import { WidgetErrorBoundary as pe } from "./WidgetErrorBoundary.js";
19
20
  import { hasCustomIframeConfig as me, hasRenderableCustomConfig as he } from "./custom/config.js";
20
21
  import { getBindingForWidget as ge } from "../../utils/widgetBinding.js";
@@ -28,31 +29,31 @@ import { WidgetRendererFactory as De } from "../../renderers/factory/WidgetRende
28
29
  import { WidgetActions as Oe } from "./widget-actions/WidgetActions.js";
29
30
  import "./widget-actions/index.js";
30
31
  import { dashboardSuggestAnchorProps as ke } from "../../proactive/entities.js";
31
- import { Suspense as o, lazy as s, memo as c, useCallback as l, useEffect as Ae, useMemo as u, useRef as d, useState as f } from "react";
32
+ import { Suspense as s, lazy as c, memo as l, useCallback as u, useEffect as Ae, useMemo as d, useRef as f, useState as p } from "react";
32
33
  import { useI18n as je } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
33
34
  import { useQuery as Me } from "@apollo/client/react";
34
- import { jsx as p, jsxs as Ne } from "react/jsx-runtime";
35
+ import { jsx as m, jsxs as Ne } from "react/jsx-runtime";
35
36
  // src/bigconsole/components/widgets/WidgetWrapper.tsx
36
- var Pe = s(() => import("../reconcile/KpiReconcileDialog.js").then((e) => ({ default: e.KpiReconcileDialog }))), Fe = s(() => import("./metric-card/index.js").then((e) => ({ default: e.MetricCardWidget }))), Ie = s(() => import("./chart/index.js").then((e) => ({ default: e.ChartWidget }))), Le = s(() => import("./table/index.js").then((e) => ({ default: e.TableWidget }))), Re = s(() => import("./pivot-table/index.js").then((e) => ({ default: e.PivotTableWidget }))), ze = s(() => import("./gauge/index.js").then((e) => ({ default: e.GaugeWidget }))), Be = s(() => import("./progress/index.js").then((e) => ({ default: e.ProgressWidget }))), Ve = s(() => import("./list/index.js").then((e) => ({ default: e.ListWidget }))), He = s(() => import("./heatmap/index.js").then((e) => ({ default: e.HeatmapWidget }))), Ue = s(() => import("./retention/index.js").then((e) => ({ default: e.RetentionWidget }))), We = s(() => import("./calendar/index.js").then((e) => ({ default: e.CalendarWidget }))), Ge = s(() => import("./kanban/index.js").then((e) => ({ default: e.KanbanWidget }))), Ke = s(() => import("./timeline/index.js").then((e) => ({ default: e.TimelineWidget }))), qe = s(() => import("./kpi-comparison/index.js").then((e) => ({ default: e.KPIComparisonWidget }))), Je = s(() => import("./text-widget/index.js").then((e) => ({ default: e.TextWidget }))), Ye = s(() => import("./map-widget/index.js").then((e) => ({ default: e.MapWidget }))), Xe = s(() => import("./iframe-widget/index.js").then((e) => ({ default: e.IframeWidget }))), Ze = s(() => import("./custom/index.js").then((e) => ({ default: e.CustomWidget })));
37
- s(() => import("./adaptive-card/index.js").then((e) => ({ default: e.AdaptiveCardWidget })));
38
- var Qe = s(() => import("./form/index.js").then((e) => ({ default: e.FormWidget }))), $e = s(() => import("./advanced/AdvancedWidgets.js").then((e) => ({ default: e.SankeyWidget }))), et = s(() => import("./advanced/AdvancedWidgets.js").then((e) => ({ default: e.BoxPlotWidget }))), tt = s(() => import("./advanced/AdvancedWidgets.js").then((e) => ({ default: e.WaterfallWidget }))), nt = s(() => import("./comments/WidgetComments.js").then((e) => ({ default: e.WidgetComments }))), rt = /* @__PURE__ */ new Set([
37
+ var Pe = c(() => import("../reconcile/KpiReconcileDialog.js").then((e) => ({ default: e.KpiReconcileDialog }))), Fe = c(() => import("./metric-card/index.js").then((e) => ({ default: e.MetricCardWidget }))), Ie = c(() => import("./chart/index.js").then((e) => ({ default: e.ChartWidget }))), Le = c(() => import("./table/index.js").then((e) => ({ default: e.TableWidget }))), Re = c(() => import("./pivot-table/index.js").then((e) => ({ default: e.PivotTableWidget }))), ze = c(() => import("./gauge/index.js").then((e) => ({ default: e.GaugeWidget }))), Be = c(() => import("./progress/index.js").then((e) => ({ default: e.ProgressWidget }))), Ve = c(() => import("./list/index.js").then((e) => ({ default: e.ListWidget }))), He = c(() => import("./heatmap/index.js").then((e) => ({ default: e.HeatmapWidget }))), Ue = c(() => import("./retention/index.js").then((e) => ({ default: e.RetentionWidget }))), We = c(() => import("./calendar/index.js").then((e) => ({ default: e.CalendarWidget }))), Ge = c(() => import("./kanban/index.js").then((e) => ({ default: e.KanbanWidget }))), Ke = c(() => import("./timeline/index.js").then((e) => ({ default: e.TimelineWidget }))), qe = c(() => import("./kpi-comparison/index.js").then((e) => ({ default: e.KPIComparisonWidget }))), Je = c(() => import("./text-widget/index.js").then((e) => ({ default: e.TextWidget }))), Ye = c(() => import("./map-widget/index.js").then((e) => ({ default: e.MapWidget }))), Xe = c(() => import("./iframe-widget/index.js").then((e) => ({ default: e.IframeWidget }))), Ze = c(() => import("./custom/index.js").then((e) => ({ default: e.CustomWidget })));
38
+ c(() => import("./adaptive-card/index.js").then((e) => ({ default: e.AdaptiveCardWidget })));
39
+ var Qe = c(() => import("./form/index.js").then((e) => ({ default: e.FormWidget }))), $e = c(() => import("./advanced/AdvancedWidgets.js").then((e) => ({ default: e.SankeyWidget }))), et = c(() => import("./advanced/AdvancedWidgets.js").then((e) => ({ default: e.BoxPlotWidget }))), tt = c(() => import("./advanced/AdvancedWidgets.js").then((e) => ({ default: e.WaterfallWidget }))), nt = c(() => import("./comments/WidgetComments.js").then((e) => ({ default: e.WidgetComments }))), rt = /* @__PURE__ */ new Set([
39
40
  "text",
40
41
  "iframe",
41
42
  "form",
42
43
  "adaptive_card"
43
44
  ]);
44
- function m(e, t) {
45
+ function h(e, t) {
45
46
  return e.previewOnly === t.previewOnly && e.widget.id === t.widget.id && e.widget.updatedAt === t.widget.updatedAt && e.isLoading === t.isLoading && e.error === t.error && e.actions === t.actions && e.data === t.data && JSON.stringify(e.filterValues) === JSON.stringify(t.filterValues) && e.narrativeOpen === t.narrativeOpen && e.narrativePanel === t.narrativePanel;
46
47
  }
47
- var h = c(function({ widget: s, children: c, data: m, className: h = "", isLoading: it, error: g, onRefresh: _, onDrilldown: at, actions: v, onAction: y, filterValues: b, onToggleNarrative: ot, narrativeOpen: st = !1, narrativePanel: ct, previewOnly: x = !1 }) {
48
- let S = ue(), lt = r((e) => e.viewMode === "edit"), C = !x && lt, w = t((e) => e.selectWidget), T = e(s.id), E = n(s.id), D = ee(), { t: ut } = je(), O = s.dashboardId, { data: dt } = Me(ne, {
49
- variables: { id: O ?? "" },
50
- skip: !O,
48
+ var it = l(function({ widget: i, children: c, data: l, className: h = "", isLoading: it, error: g, onRefresh: _, onDrilldown: v, actions: y, onAction: b, filterValues: x, onToggleNarrative: at, narrativeOpen: ot = !1, narrativePanel: st, previewOnly: S = !1 }) {
49
+ let C = de(), ct = r((e) => e.viewMode === "edit"), w = !S && ct, T = t((e) => e.selectWidget), E = e(i.id), D = n(i.id), O = ee(), { t: lt } = je(), k = i.dashboardId, { data: ut } = Me(ne, {
50
+ variables: { id: k ?? "" },
51
+ skip: !k,
51
52
  fetchPolicy: "cache-only"
52
- }), k = dt?.getDashboard?.globalFilters, A = u(() => _e(k), [k]), j = u(() => Object.fromEntries(Object.entries(A).map(([e, t]) => [e, t.field])), [A]), M = u(() => ge(s), [s]), { hasDataSource: N, allowSamples: P, mockSource: F } = Te(s, M), { data: I, loading: ft, error: pt } = te(s.id, {
53
- skip: x || !N,
54
- pollInterval: (s.refreshInterval ?? 0) * 1e3 || 0
55
- }), L = u(() => {
53
+ }), A = ut?.getDashboard?.globalFilters, j = d(() => _e(A), [A]), M = d(() => Object.fromEntries(Object.entries(j).map(([e, t]) => [e, t.field])), [j]), N = d(() => ge(i), [i]), { hasDataSource: P, allowSamples: F, mockSource: I } = Te(i, N), { data: L, loading: dt, error: ft } = te(i.id, {
54
+ skip: S || !P,
55
+ pollInterval: (i.refreshInterval ?? 0) * 1e3 || 0
56
+ }), R = d(() => {
56
57
  if (typeof window > "u") return {};
57
58
  let e = new URLSearchParams(window.location.search), t = {};
58
59
  return e.forEach((e, n) => {
@@ -61,101 +62,101 @@ var h = c(function({ widget: s, children: c, data: m, className: h = "", isLoadi
61
62
  r.startsWith("__") || (t[r] = e);
62
63
  }
63
64
  }), t;
64
- }, []), R = u(() => {
65
+ }, []), z = d(() => {
65
66
  let e = {};
66
- return L && Object.keys(L).length > 0 && Object.assign(e, L), D && Object.keys(D).length > 0 && Object.assign(e, D), b && Object.keys(b).length > 0 && Object.assign(e, b), e;
67
+ return R && Object.keys(R).length > 0 && Object.assign(e, R), O && Object.keys(O).length > 0 && Object.assign(e, O), x && Object.keys(x).length > 0 && Object.assign(e, x), e;
67
68
  }, [
68
- L,
69
- D,
70
- b
71
- ]), z = Object.keys(R).length > 0, B = it ?? (ft && !I) ?? E.isLoading, V = g ?? pt?.message ?? E.errorMessage, mt = ce(s.type), H = d(_);
69
+ R,
70
+ O,
71
+ x
72
+ ]), B = Object.keys(z).length > 0, V = it ?? (dt && !L) ?? D.isLoading, H = g ?? ft?.message ?? D.errorMessage, pt = ce(i.type), U = f(_);
72
73
  Ae(() => {
73
- H.current = _;
74
+ U.current = _;
74
75
  }, [_]);
75
- let ht = l(async () => {
76
- H.current && await H.current();
77
- }, []), { timeUntilRefresh: gt, isPaused: _t } = ie({
78
- widgetId: s.id,
79
- refreshInterval: s.refreshInterval,
80
- onRefresh: ht,
81
- enabled: !x && !C && !!s.refreshInterval
82
- }), U = d(null), [W, vt] = f(!1), [yt, bt] = f(!1), { count: xt } = ae(s.id, yt), St = l(() => {
76
+ let mt = u(async () => {
77
+ U.current && await U.current();
78
+ }, []), { timeUntilRefresh: ht, isPaused: gt } = ie({
79
+ widgetId: i.id,
80
+ refreshInterval: i.refreshInterval,
81
+ onRefresh: mt,
82
+ enabled: !S && !w && !!i.refreshInterval
83
+ }), W = f(null), [_t, vt] = p(!1), [yt, bt] = p(!1), { count: xt } = ae(i.id, yt), St = u(() => {
83
84
  bt(!0), vt((e) => !e);
84
- }, []), G = u(() => we({
85
- explicit: m,
86
- fetched: I,
87
- persisted: s.data,
88
- config: s.config,
89
- allowSamples: P,
90
- mockSource: F,
91
- widgetType: s.type
85
+ }, []), G = d(() => we({
86
+ explicit: l,
87
+ fetched: L,
88
+ persisted: i.data,
89
+ config: i.config,
90
+ allowSamples: F,
91
+ mockSource: I,
92
+ widgetType: i.type
92
93
  }), [
93
- m,
94
- I,
95
- s,
96
- P,
97
- F
98
- ]), K = u(() => {
94
+ l,
95
+ L,
96
+ i,
97
+ F,
98
+ I
99
+ ]), K = d(() => {
99
100
  let e = G.data;
100
101
  if (e && typeof e == "object" && !Array.isArray(e)) {
101
- let t = s.config, n = t?.dataKey ?? t?.dataPath ?? t?.seriesPath;
102
+ let t = i.config, n = t?.dataKey ?? t?.dataPath ?? t?.seriesPath;
102
103
  if (n && typeof n == "string") {
103
104
  let t = n.split(".").reduce((e, t) => e && typeof e == "object" ? e[t] : void 0, e);
104
105
  t != null && Ce(t) && (e = t);
105
106
  }
106
107
  }
107
108
  return e;
108
- }, [G, s.config]), q = u(() => z ? ye(K, {
109
- filterValues: R,
110
- filterFieldMap: j,
111
- widgetType: s.type
109
+ }, [G, i.config]), q = d(() => B ? ye(K, {
110
+ filterValues: z,
111
+ filterFieldMap: M,
112
+ widgetType: i.type
112
113
  }) : K, [
113
114
  K,
115
+ B,
114
116
  z,
115
- R,
116
- j,
117
- s.type
118
- ]), Ct = q !== null && G.isSample, wt = u(() => rt.has(s.type) ? [] : ve(K, A, R, s.type), [
117
+ M,
118
+ i.type
119
+ ]), Ct = q !== null && G.isSample, wt = d(() => rt.has(i.type) ? [] : ve(K, j, z, i.type), [
119
120
  K,
120
- A,
121
- R,
122
- s.type
123
- ]), Tt = u(() => Ee(q, s.type), [q, s.type]), Et = u(() => {
124
- let e = s.config;
121
+ j,
122
+ z,
123
+ i.type
124
+ ]), Tt = d(() => Ee(q, i.type), [q, i.type]), Et = d(() => {
125
+ let e = i.config;
125
126
  return be(q, {
126
127
  xAxisKey: typeof e?.xAxisKey == "string" ? e.xAxisKey : void 0,
127
128
  selectedFields: Array.isArray(e?.selectedFields) ? e.selectedFields.filter((e) => typeof e == "string") : void 0
128
129
  });
129
- }, [q, s.config]), [Dt, Ot] = f(!1), [kt, At] = f(!1), jt = Se(s.type, x), { exportCSV: Mt, exportPNG: Nt } = oe(s, {
130
+ }, [q, i.config]), [Dt, Ot] = p(!1), [kt, At] = p(!1), jt = Se(i.type, S), { exportCSV: Mt, exportPNG: Nt } = oe(i, {
130
131
  data: Tt,
131
- containerRef: U
132
+ containerRef: W
132
133
  }), { executeDrilldown: Pt, canDrilldown: Ft } = se({ onDrilldown: (e, t) => {
133
- at?.(e);
134
- } }), J = u(() => Ft(s), [s, Ft]), It = l((e) => {
135
- if (!s.drilldown?.enabled) return;
134
+ v?.(e);
135
+ } }), J = d(() => Ft(i), [i, Ft]), It = u((e) => {
136
+ if (!i.drilldown?.enabled) return;
136
137
  let t = {
137
138
  selectedData: e || {},
138
- globalFilters: D || {},
139
+ globalFilters: O || {},
139
140
  widgetData: q || {},
140
141
  metadata: {
141
- widgetId: s.id,
142
- widgetType: s.type,
143
- widgetTitle: s.title
142
+ widgetId: i.id,
143
+ widgetType: i.type,
144
+ widgetTitle: i.title
144
145
  },
145
- sourceDashboardId: s.dashboardId
146
+ sourceDashboardId: i.dashboardId
146
147
  };
147
- Pt(s.drilldown, t);
148
+ Pt(i.drilldown, t);
148
149
  }, [
149
- s,
150
+ i,
150
151
  q,
151
- D,
152
+ O,
152
153
  Pt
153
- ]), Y = J && !C ? It : void 0, X = d(null), Lt = l((e) => {
154
+ ]), Y = J && !w ? It : void 0, X = f(null), Lt = u((e) => {
154
155
  X.current = {
155
156
  x: e.clientX,
156
157
  y: e.clientY
157
158
  };
158
- }, []), Rt = l((e) => {
159
+ }, []), Rt = u((e) => {
159
160
  if (e.stopPropagation(), X.current) {
160
161
  let t = Math.abs(e.clientX - X.current.x), n = Math.abs(e.clientY - X.current.y);
161
162
  if (t > 5 || n > 5) {
@@ -163,44 +164,44 @@ var h = c(function({ widget: s, children: c, data: m, className: h = "", isLoadi
163
164
  return;
164
165
  }
165
166
  }
166
- X.current = null, C && w(s.id);
167
+ X.current = null, w && T(i.id);
167
168
  }, [
168
- C,
169
169
  w,
170
- s.id
171
- ]), zt = l((e) => {
172
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), C && w(s.id));
170
+ T,
171
+ i.id
172
+ ]), zt = u((e) => {
173
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), w && T(i.id));
173
174
  }, [
174
- C,
175
175
  w,
176
- s.id
177
- ]), Bt = u(() => s.type === "custom" && he(s.config), [s.type, s.config]), Vt = u(() => s.type === "custom" && me(s.config), [s.type, s.config]), Z = J && !Vt, Ht = u(() => s.type === "text" && i(s.config, q).hasContent, [
178
- s.type,
179
- s.config,
176
+ T,
177
+ i.id
178
+ ]), Bt = d(() => i.type === "custom" && he(i.config), [i.type, i.config]), Vt = d(() => i.type === "custom" && me(i.config), [i.type, i.config]), Z = J && !Vt, Ht = d(() => i.type === "text" && le(i.config, q).hasContent, [
179
+ i.type,
180
+ i.config,
180
181
  q
181
- ]), Ut = !B && !V && !q && !Bt && !Ht, Q = u(() => s.renderer, [s]), Wt = u(() => Q && Q !== "BIGCONSOLE", [Q]), Gt = u(() => ({
182
- widgetId: s.id,
182
+ ]), Ut = !V && !H && !q && !Bt && !Ht, Q = d(() => i.renderer, [i]), Wt = d(() => Q && Q !== "BIGCONSOLE", [Q]), Gt = d(() => ({
183
+ widgetId: i.id,
183
184
  data: q || {}
184
- }), [s.id, q]), $ = l((e, t) => {
185
- if (!y) return;
186
- let n = v?.find((t) => t.name === e.name);
187
- y(n || e, t);
188
- }, [y, v]), Kt = l(() => {
185
+ }), [i.id, q]), $ = u((e, t) => {
186
+ if (!b) return;
187
+ let n = y?.find((t) => t.name === e.name);
188
+ b(n || e, t);
189
+ }, [b, y]), Kt = u(() => {
189
190
  let e = (() => {
190
191
  if (!q) return q;
191
- if (s.type === "pivot_table") {
192
+ if (i.type === "pivot_table") {
192
193
  if (Array.isArray(q)) return q;
193
194
  if (q && typeof q == "object" && "rows" in q) return q.rows;
194
195
  }
195
- if (s.type === "list") {
196
+ if (i.type === "list") {
196
197
  if (Array.isArray(q)) return q;
197
198
  if (q && typeof q == "object" && "items" in q) return q.items;
198
199
  }
199
- if (s.type === "funnel_chart") {
200
+ if (i.type === "funnel_chart") {
200
201
  if (Array.isArray(q)) return q;
201
202
  if (q && typeof q == "object" && "stages" in q) return q.stages;
202
203
  }
203
- if (s.type === "chart") {
204
+ if (i.type === "chart") {
204
205
  if (Array.isArray(q)) return q;
205
206
  if (q && typeof q == "object" && "datasets" in q) {
206
207
  let e = q;
@@ -212,269 +213,269 @@ var h = c(function({ widget: s, children: c, data: m, className: h = "", isLoadi
212
213
  });
213
214
  }
214
215
  }
215
- if (s.type === "text") {
216
- let e = i(s.config, q);
216
+ if (i.type === "text") {
217
+ let e = le(i.config, q);
217
218
  return {
218
219
  content: e.content,
219
220
  format: e.format,
220
221
  alignment: e.alignment
221
222
  };
222
223
  }
223
- if (s.type === "custom") {
224
- let e = s.config?.valueField;
224
+ if (i.type === "custom") {
225
+ let e = i.config?.valueField;
225
226
  if (e && q && typeof q == "object" && !Array.isArray(q)) {
226
227
  let t = q;
227
228
  if (e in t) return {
228
229
  value: t[e],
229
- label: s.title,
230
+ label: i.title,
230
231
  data: t
231
232
  };
232
233
  }
233
234
  }
234
235
  return q;
235
236
  })(), t = {
236
- widget: s,
237
+ widget: i,
237
238
  onDrilldown: Y
238
239
  };
239
240
  if (Wt) {
240
241
  let e = {};
241
- if (q && typeof q == "object" && !Array.isArray(q) && Object.keys(q).length > 0 && (e = { ...q }), s.config?._internalWidgetType === "custom" && Object.keys(e).length > 0) {
242
- let t = s.config?.valueField;
242
+ if (q && typeof q == "object" && !Array.isArray(q) && Object.keys(q).length > 0 && (e = { ...q }), i.config?._internalWidgetType === "custom" && Object.keys(e).length > 0) {
243
+ let t = i.config?.valueField;
243
244
  if (t && t in e) {
244
245
  let n = e[t], r = typeof n == "number" ? n.toLocaleString() : String(n);
245
246
  e = {
246
247
  ...e,
247
248
  value: n,
248
249
  title: e.title || r,
249
- description: e.description || s.title || "",
250
+ description: e.description || i.title || "",
250
251
  text: e.text || r
251
252
  };
252
253
  }
253
254
  }
254
- return /* @__PURE__ */ p(De, {
255
- widget: s,
255
+ return /* @__PURE__ */ m(De, {
256
+ widget: i,
256
257
  data: e,
257
- isEditMode: C,
258
- isSelected: T,
259
- isLoading: B,
260
- error: V,
258
+ isEditMode: w,
259
+ isSelected: E,
260
+ isLoading: V,
261
+ error: H,
261
262
  onDrilldown: Y,
262
263
  onAction: $
263
264
  });
264
265
  }
265
- switch (s.type?.toLowerCase() || "") {
266
- case "metric_card": return /* @__PURE__ */ p(Fe, {
266
+ switch (i.type?.toLowerCase() || "") {
267
+ case "metric_card": return /* @__PURE__ */ m(Fe, {
267
268
  ...t,
268
269
  data: e
269
270
  });
270
- case "kpi_card_comparison": return /* @__PURE__ */ p(qe, {
271
+ case "kpi_card_comparison": return /* @__PURE__ */ m(qe, {
271
272
  ...t,
272
273
  data: e
273
274
  });
274
275
  case "chart":
275
- case "funnel_chart": return /* @__PURE__ */ p(Ie, {
276
+ case "funnel_chart": return /* @__PURE__ */ m(Ie, {
276
277
  ...t,
277
278
  data: e
278
279
  });
279
- case "waterfall": return /* @__PURE__ */ p(tt, {
280
+ case "waterfall": return /* @__PURE__ */ m(tt, {
280
281
  ...t,
281
282
  data: e
282
283
  });
283
- case "sankey": return /* @__PURE__ */ p($e, {
284
+ case "sankey": return /* @__PURE__ */ m($e, {
284
285
  ...t,
285
286
  data: e
286
287
  });
287
- case "box_plot": return /* @__PURE__ */ p(et, {
288
+ case "box_plot": return /* @__PURE__ */ m(et, {
288
289
  ...t,
289
290
  data: e
290
291
  });
291
- case "table": return /* @__PURE__ */ p(Le, {
292
+ case "table": return /* @__PURE__ */ m(Le, {
292
293
  ...t,
293
294
  data: e
294
295
  });
295
- case "pivot_table": return /* @__PURE__ */ p(Re, {
296
+ case "pivot_table": return /* @__PURE__ */ m(Re, {
296
297
  ...t,
297
298
  data: e
298
299
  });
299
- case "gauge": return /* @__PURE__ */ p(ze, {
300
+ case "gauge": return /* @__PURE__ */ m(ze, {
300
301
  ...t,
301
302
  data: e
302
303
  });
303
- case "progress": return /* @__PURE__ */ p(Be, {
304
+ case "progress": return /* @__PURE__ */ m(Be, {
304
305
  ...t,
305
306
  data: e
306
307
  });
307
- case "list": return /* @__PURE__ */ p(Ve, {
308
+ case "list": return /* @__PURE__ */ m(Ve, {
308
309
  ...t,
309
310
  data: e
310
311
  });
311
- case "heatmap": return /* @__PURE__ */ p(He, {
312
+ case "heatmap": return /* @__PURE__ */ m(He, {
312
313
  ...t,
313
314
  data: e
314
315
  });
315
- case "retention": return /* @__PURE__ */ p(Ue, {
316
+ case "retention": return /* @__PURE__ */ m(Ue, {
316
317
  ...t,
317
318
  data: e
318
319
  });
319
- case "calendar": return /* @__PURE__ */ p(We, {
320
+ case "calendar": return /* @__PURE__ */ m(We, {
320
321
  ...t,
321
322
  data: e
322
323
  });
323
- case "timeline": return /* @__PURE__ */ p(Ke, {
324
+ case "timeline": return /* @__PURE__ */ m(Ke, {
324
325
  ...t,
325
326
  data: e
326
327
  });
327
- case "kanban": return /* @__PURE__ */ p(Ge, {
328
+ case "kanban": return /* @__PURE__ */ m(Ge, {
328
329
  ...t,
329
330
  data: e
330
331
  });
331
- case "form": return /* @__PURE__ */ p(Qe, {
332
+ case "form": return /* @__PURE__ */ m(Qe, {
332
333
  ...t,
333
334
  data: e
334
335
  });
335
- case "text": return /* @__PURE__ */ p(Je, {
336
+ case "text": return /* @__PURE__ */ m(Je, {
336
337
  ...t,
337
338
  data: e
338
339
  });
339
- case "iframe": return /* @__PURE__ */ p(Xe, {
340
+ case "iframe": return /* @__PURE__ */ m(Xe, {
340
341
  ...t,
341
342
  data: e
342
343
  });
343
- case "map": return /* @__PURE__ */ p(Ye, {
344
+ case "map": return /* @__PURE__ */ m(Ye, {
344
345
  ...t,
345
346
  data: e
346
347
  });
347
- case "custom": return /* @__PURE__ */ p(Ze, {
348
+ case "custom": return /* @__PURE__ */ m(Ze, {
348
349
  ...t,
349
350
  data: e
350
351
  });
351
- default: return c || /* @__PURE__ */ p(a, { widgetType: s.type });
352
+ default: return c || /* @__PURE__ */ m(o, { widgetType: i.type });
352
353
  }
353
354
  }, [
354
- s,
355
+ i,
355
356
  q,
356
357
  c,
357
358
  Y,
358
359
  Wt,
359
- C,
360
- T,
361
- B,
360
+ w,
361
+ E,
362
362
  V,
363
+ H,
363
364
  $
364
365
  ]), qt = () => {
365
- if (B) return /* @__PURE__ */ p(de, {});
366
- if (V) return /* @__PURE__ */ p(fe, {
367
- error: V,
366
+ if (V) return /* @__PURE__ */ m(a, {});
367
+ if (H) return /* @__PURE__ */ m(fe, {
368
+ error: H,
368
369
  onRetry: _
369
370
  });
370
- if (Ut && !c) return /* @__PURE__ */ p(a, {
371
- widgetType: s.type,
372
- hideEditHint: x,
373
- hasDataSource: N,
374
- compact: (s.position?.height ?? s.positionHeight ?? 4) <= 2,
375
- templateSlot: typeof s.metadata?.templateDataSinkSlot == "string" ? s.metadata.templateDataSinkSlot : null
371
+ if (Ut && !c) return /* @__PURE__ */ m(o, {
372
+ widgetType: i.type,
373
+ hideEditHint: S,
374
+ hasDataSource: P,
375
+ compact: (i.position?.height ?? i.positionHeight ?? 4) <= 2,
376
+ templateSlot: typeof i.metadata?.templateDataSinkSlot == "string" ? i.metadata.templateDataSinkSlot : null
376
377
  });
377
- let e = `${M.source.kind}|${M.source.ref ?? ""}|${M.parserId ?? ""}|${s.updatedAt ?? ""}`;
378
- return /* @__PURE__ */ p(pe, {
379
- widgetId: s.id,
380
- widgetType: s.type,
381
- widgetTitle: s.title,
378
+ let e = `${N.source.kind}|${N.source.ref ?? ""}|${N.parserId ?? ""}|${i.updatedAt ?? ""}`;
379
+ return /* @__PURE__ */ m(pe, {
380
+ widgetId: i.id,
381
+ widgetType: i.type,
382
+ widgetTitle: i.title,
382
383
  resetKey: e,
383
- children: c ?? /* @__PURE__ */ p(o, {
384
- fallback: /* @__PURE__ */ p(de, {}),
384
+ children: c ?? /* @__PURE__ */ m(s, {
385
+ fallback: /* @__PURE__ */ m(a, {}),
385
386
  children: Kt()
386
387
  })
387
388
  });
388
389
  };
389
390
  return /* @__PURE__ */ Ne("div", {
390
- ref: U,
391
- ...x ? {} : ke(s.dashboardId, s.id),
391
+ ref: W,
392
+ ...S ? {} : ke(i.dashboardId, i.id),
392
393
  className: `
393
394
  group relative flex flex-col
394
395
  h-full w-full min-w-0
395
396
  rounded-card border
396
397
  bg-bg-surface
397
398
  shadow-[var(--shadow-elevation-1)]
398
- ${S.animationsEnabled ? "motion-safe:transition-[box-shadow,border-color] motion-safe:duration-200" : ""}
399
- ${T && C ? "border-[var(--color-action-primary-border)] ring-2 ring-[var(--color-action-primary-border)]/30 shadow-[var(--shadow-elevation-2)]" : S.showWidgetBorders ? "border-[var(--color-border-subtle)] hover:border-action-primary-bg hover:shadow-[var(--shadow-elevation-2)]" : "border-transparent"}
400
- ${C ? "cursor-pointer" : ""}
399
+ ${C.animationsEnabled ? "motion-safe:transition-[box-shadow,border-color] motion-safe:duration-200" : ""}
400
+ ${E && w ? "border-[var(--color-action-primary-border)] ring-2 ring-[var(--color-action-primary-border)]/30 shadow-[var(--shadow-elevation-2)]" : C.showWidgetBorders ? "border-[var(--color-border-subtle)] hover:border-action-primary-bg hover:shadow-[var(--shadow-elevation-2)]" : "border-transparent"}
401
+ ${w ? "cursor-pointer" : ""}
401
402
  ${h}
402
403
  `,
403
404
  onMouseDown: Lt,
404
405
  onClick: Rt,
405
406
  onKeyDown: zt,
406
- tabIndex: C ? 0 : -1,
407
- role: C ? "button" : void 0,
408
- "aria-selected": T,
409
- "aria-label": `Widget: ${s.title}`,
410
- "data-widget-id": s.id,
411
- "data-widget-type": s.type,
407
+ tabIndex: w ? 0 : -1,
408
+ role: w ? "button" : void 0,
409
+ "aria-selected": E,
410
+ "aria-label": `Widget: ${i.title}`,
411
+ "data-widget-id": i.id,
412
+ "data-widget-type": i.type,
412
413
  children: [
413
- /* @__PURE__ */ p(le, {
414
- widget: s,
415
- previewOnly: x,
416
- definition: mt,
417
- isSelected: T,
418
- isEditMode: C,
419
- isLoading: B,
414
+ /* @__PURE__ */ m(ue, {
415
+ widget: i,
416
+ previewOnly: S,
417
+ definition: pt,
418
+ isSelected: E,
419
+ isEditMode: w,
420
+ isLoading: V,
420
421
  isSampleData: Ct,
421
- timeUntilRefresh: s.refreshInterval && !_t ? re(gt) : void 0,
422
+ timeUntilRefresh: i.refreshInterval && !gt ? re(ht) : void 0,
422
423
  hasDrilldown: J,
423
424
  onRefresh: _,
424
425
  onExportCSV: Tt ? Mt : void 0,
425
426
  onExportPNG: Nt,
426
427
  onDrilldown: Y ? () => Y() : void 0,
427
- onToggleComments: x ? void 0 : St,
428
- commentsOpen: W,
428
+ onToggleComments: S ? void 0 : St,
429
+ commentsOpen: _t,
429
430
  commentCount: yt ? xt : void 0,
430
- onExplain: x ? void 0 : ot,
431
- explainOpen: st,
431
+ onExplain: S ? void 0 : at,
432
+ explainOpen: ot,
432
433
  onSpotOutliers: Et.length > 0 ? () => Ot(!0) : void 0,
433
434
  onReconcile: jt ? () => At(!0) : void 0
434
435
  }),
435
- st && ct,
436
- wt.length > 0 && /* @__PURE__ */ p("div", {
436
+ ot && st,
437
+ wt.length > 0 && /* @__PURE__ */ m("div", {
437
438
  role: "status",
438
439
  "data-testid": "widget-filter-not-applicable",
439
440
  className: "mx-3 mt-2 rounded bg-status-warning-bg-subtle px-2 py-1 text-xs text-status-warning-text",
440
- children: wt.map((e) => ut("bigconsole.widget.filterNotApplicable", "Filter '{{name}}' does not apply to this widget (no field '{{field}}')", {
441
+ children: wt.map((e) => lt("bigconsole.widget.filterNotApplicable", "Filter '{{name}}' does not apply to this widget (no field '{{field}}')", {
441
442
  name: e.name,
442
443
  field: e.field
443
444
  })).join(" ")
444
445
  }),
445
- /* @__PURE__ */ p("div", {
446
+ /* @__PURE__ */ m("div", {
446
447
  className: `
447
448
  flex-1 overflow-hidden min-h-0 min-w-0
448
- ${S.compactMode ? "p-2" : "p-3 sm:p-4"}
449
- ${Z && !C ? "cursor-pointer" : ""}
449
+ ${C.compactMode ? "p-2" : "p-3 sm:p-4"}
450
+ ${Z && !w ? "cursor-pointer" : ""}
450
451
  `,
451
- title: Z && !C ? "Click data to drill down" : void 0,
452
- children: /* @__PURE__ */ p("div", {
452
+ title: Z && !w ? "Click data to drill down" : void 0,
453
+ children: /* @__PURE__ */ m("div", {
453
454
  className: "h-full min-w-0 overflow-auto",
454
455
  children: qt()
455
456
  })
456
457
  }),
457
- v && v.length > 0 && !B && !V && /* @__PURE__ */ p("div", {
458
+ y && y.length > 0 && !V && !H && /* @__PURE__ */ m("div", {
458
459
  className: "min-w-0 border-t border-[var(--color-border-subtle)] bg-bg-sunken px-3 py-2 sm:px-4",
459
460
  style: { flexShrink: 0 },
460
- children: /* @__PURE__ */ p(Oe, {
461
- actions: v,
461
+ children: /* @__PURE__ */ m(Oe, {
462
+ actions: y,
462
463
  context: Gt,
463
- onAction: y,
464
- disabled: C,
464
+ onAction: b,
465
+ disabled: w,
465
466
  layout: "horizontal",
466
467
  size: "sm"
467
468
  })
468
469
  }),
469
- Z && !C && /* @__PURE__ */ p("div", {
470
+ Z && !w && /* @__PURE__ */ m("div", {
470
471
  className: "\n absolute bottom-2 right-2\n opacity-0 group-hover:opacity-100\n transition-opacity duration-200\n ",
471
472
  title: "Click to drill down",
472
- children: /* @__PURE__ */ p("svg", {
473
+ children: /* @__PURE__ */ m("svg", {
473
474
  className: "w-4 h-4 text-text-secondary",
474
475
  fill: "none",
475
476
  stroke: "currentColor",
476
477
  viewBox: "0 0 24 24",
477
- children: /* @__PURE__ */ p("path", {
478
+ children: /* @__PURE__ */ m("path", {
478
479
  strokeLinecap: "round",
479
480
  strokeLinejoin: "round",
480
481
  strokeWidth: 2,
@@ -482,37 +483,48 @@ var h = c(function({ widget: s, children: c, data: m, className: h = "", isLoadi
482
483
  })
483
484
  })
484
485
  }),
485
- W && /* @__PURE__ */ p(o, {
486
+ _t && /* @__PURE__ */ m(s, {
486
487
  fallback: null,
487
- children: /* @__PURE__ */ p(nt, {
488
- widgetId: s.id,
488
+ children: /* @__PURE__ */ m(nt, {
489
+ widgetId: i.id,
489
490
  onClose: () => vt(!1)
490
491
  })
491
492
  }),
492
- /* @__PURE__ */ p(xe, {
493
+ /* @__PURE__ */ m(xe, {
493
494
  open: Dt,
494
495
  onClose: () => Ot(!1),
495
- widgetTitle: s.title,
496
+ widgetTitle: i.title,
496
497
  series: Et
497
498
  }),
498
- kt && /* @__PURE__ */ p(o, {
499
+ kt && /* @__PURE__ */ m(s, {
499
500
  fallback: null,
500
- children: /* @__PURE__ */ p(Pe, {
501
+ children: /* @__PURE__ */ m(Pe, {
501
502
  open: kt,
502
503
  onClose: () => At(!1),
503
- widget: s
504
+ widget: i
504
505
  })
505
506
  })
506
507
  ]
507
508
  });
508
- }, m), it = s(() => import("../explore/SavedQueryWidget.js").then((e) => ({ default: e.SavedQueryWidget }))), g = (e) => e.widget.savedQueryId ? /* @__PURE__ */ p(o, {
509
- fallback: /* @__PURE__ */ p("span", {
509
+ }, h), g = c(() => import("../explore/SavedQueryWidget.js").then((e) => ({ default: e.SavedQueryWidget })));
510
+ function _({ widget: e }) {
511
+ return r((e) => e.viewMode === "edit") ? /* @__PURE__ */ m("div", {
512
+ className: "float-right ml-2",
513
+ children: /* @__PURE__ */ m(i, {
514
+ widget: e,
515
+ isEditMode: !0
516
+ })
517
+ }) : null;
518
+ }
519
+ var v = (e) => e.widget.savedQueryId ? /* @__PURE__ */ m(s, {
520
+ fallback: /* @__PURE__ */ m("span", {
510
521
  role: "status",
511
522
  children: "Loading widget…"
512
523
  }),
513
- children: /* @__PURE__ */ p(it, {
524
+ children: /* @__PURE__ */ m(g, {
514
525
  id: e.widget.id,
515
- title: e.widget.title
526
+ title: e.widget.title,
527
+ controls: e.previewOnly ? void 0 : /* @__PURE__ */ m(_, { widget: e.widget })
516
528
  })
517
- }) : /* @__PURE__ */ p(h, { ...e });
518
- export { g as WidgetWrapper, g as default };
529
+ }) : /* @__PURE__ */ m(it, { ...e });
530
+ export { v as WidgetWrapper, v as default };