@burdenoff/microfe-bigconsole 2026.619.1 → 2026.624.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.
@@ -1,38 +1,55 @@
1
1
  import { useIsWidgetSelected as e, useWidgetStore as t, useWidgetUIState as n } from "../../store/widgetStore.js";
2
2
  import { useDashboardStore as r, useGlobalFilterValues as i } from "../../store/dashboardStore.js";
3
3
  import "../../store/index.js";
4
- import a from "../../hooks/useWidgetData.js";
5
- import { getWidgetDefinition as o } from "./WidgetRegistry.js";
4
+ import { GetDashboardDocument as a } from "../../../generated/wspace-operations.js";
5
+ import o from "../../hooks/useWidgetData.js";
6
+ import { getWidgetDefinition as s } from "./WidgetRegistry.js";
6
7
  import { formatTimeUntilRefresh as ee, useWidgetAutoRefresh as te } from "../../hooks/useAutoRefresh.js";
7
8
  import ne from "../../hooks/useWidgetComments.js";
8
9
  import re from "../../hooks/useWidgetExport.js";
9
10
  import ie from "../../hooks/useDrilldown.js";
10
11
  import "../../hooks/index.js";
11
12
  import ae from "./WidgetHeader.js";
12
- import s from "./states/LoadingState.js";
13
+ import c from "./states/LoadingState.js";
13
14
  import oe from "./states/ErrorState.js";
14
- import c from "./states/EmptyState.js";
15
+ import l from "./states/EmptyState.js";
15
16
  import se from "./WidgetErrorBoundary.js";
16
17
  import { hasCustomIframeConfig as ce, hasRenderableCustomConfig as le } from "./custom/config.js";
17
18
  import ue from "../../renderers/factory/WidgetRendererFactory.js";
18
19
  import de from "./widget-actions/WidgetActions.js";
19
20
  import "./widget-actions/index.js";
20
- import { Suspense as l, lazy as u, memo as d, useCallback as f, useEffect as fe, useMemo as p, useRef as m, useState as h } from "react";
21
- import { jsx as g, jsxs as pe } from "react/jsx-runtime";
21
+ import { Suspense as u, lazy as d, memo as f, useCallback as p, useEffect as fe, useMemo as m, useRef as h, useState as g } from "react";
22
+ import { useApolloClient as pe } from "@apollo/client/react";
23
+ import { jsx as _, jsxs as me } from "react/jsx-runtime";
22
24
  //#region src/bigconsole/components/widgets/WidgetWrapper.tsx
23
- var me = u(() => import("./metric-card/index.js").then((e) => ({ default: e.MetricCardWidget }))), he = u(() => import("./chart/index.js").then((e) => ({ default: e.ChartWidget }))), ge = u(() => import("./table/index.js").then((e) => ({ default: e.TableWidget }))), _e = u(() => import("./pivot-table/index.js").then((e) => ({ default: e.PivotTableWidget }))), ve = u(() => import("./gauge/index.js").then((e) => ({ default: e.GaugeWidget }))), ye = u(() => import("./progress/index.js").then((e) => ({ default: e.ProgressWidget }))), be = u(() => import("./list/index.js").then((e) => ({ default: e.ListWidget }))), xe = u(() => import("./heatmap/index.js").then((e) => ({ default: e.HeatmapWidget }))), Se = u(() => import("./calendar/index.js").then((e) => ({ default: e.CalendarWidget }))), Ce = u(() => import("./kanban/index.js").then((e) => ({ default: e.KanbanWidget }))), we = u(() => import("./timeline/index.js").then((e) => ({ default: e.TimelineWidget }))), Te = u(() => import("./kpi-comparison/index.js").then((e) => ({ default: e.KPIComparisonWidget }))), Ee = u(() => import("./text-widget/index.js").then((e) => ({ default: e.TextWidget }))), De = u(() => import("./map-widget/index.js").then((e) => ({ default: e.MapWidget }))), Oe = u(() => import("./iframe-widget/index.js").then((e) => ({ default: e.IframeWidget }))), ke = u(() => import("./custom/index.js").then((e) => ({ default: e.CustomWidget }))), Ae = u(() => import("./adaptive-card/index.js").then((e) => ({ default: e.AdaptiveCardWidget }))), je = u(() => import("./comments/WidgetComments.js").then((e) => ({ default: e.WidgetComments })));
24
- function _(e, t) {
25
+ var he = d(() => import("./metric-card/index.js").then((e) => ({ default: e.MetricCardWidget }))), ge = d(() => import("./chart/index.js").then((e) => ({ default: e.ChartWidget }))), _e = d(() => import("./table/index.js").then((e) => ({ default: e.TableWidget }))), ve = d(() => import("./pivot-table/index.js").then((e) => ({ default: e.PivotTableWidget }))), ye = d(() => import("./gauge/index.js").then((e) => ({ default: e.GaugeWidget }))), be = d(() => import("./progress/index.js").then((e) => ({ default: e.ProgressWidget }))), xe = d(() => import("./list/index.js").then((e) => ({ default: e.ListWidget }))), Se = d(() => import("./heatmap/index.js").then((e) => ({ default: e.HeatmapWidget }))), Ce = d(() => import("./retention/index.js").then((e) => ({ default: e.RetentionWidget }))), we = d(() => import("./calendar/index.js").then((e) => ({ default: e.CalendarWidget }))), Te = d(() => import("./kanban/index.js").then((e) => ({ default: e.KanbanWidget }))), Ee = d(() => import("./timeline/index.js").then((e) => ({ default: e.TimelineWidget }))), De = d(() => import("./kpi-comparison/index.js").then((e) => ({ default: e.KPIComparisonWidget }))), Oe = d(() => import("./text-widget/index.js").then((e) => ({ default: e.TextWidget }))), ke = d(() => import("./map-widget/index.js").then((e) => ({ default: e.MapWidget }))), Ae = d(() => import("./iframe-widget/index.js").then((e) => ({ default: e.IframeWidget }))), je = d(() => import("./custom/index.js").then((e) => ({ default: e.CustomWidget }))), Me = d(() => import("./adaptive-card/index.js").then((e) => ({ default: e.AdaptiveCardWidget }))), Ne = d(() => import("./comments/WidgetComments.js").then((e) => ({ default: e.WidgetComments })));
26
+ function v(e, t) {
25
27
  if (e.widget.id !== t.widget.id || e.widget.updatedAt !== t.widget.updatedAt || e.isLoading !== t.isLoading || e.error !== t.error || (e.actions?.length ?? 0) !== (t.actions?.length ?? 0)) return !1;
26
28
  if (e.actions && t.actions) {
27
29
  for (let n = 0; n < e.actions.length; n++) if (e.actions[n]?.id !== t.actions[n]?.id) return !1;
28
30
  }
29
31
  return !(e.data !== t.data || JSON.stringify(e.filterValues) !== JSON.stringify(t.filterValues));
30
32
  }
31
- var v = d(function({ widget: u, children: d, data: _, className: v = "", isLoading: Me, error: Ne, onRefresh: y, onDrilldown: Pe, actions: b, onAction: x, filterValues: S }) {
32
- let C = r((e) => e.viewMode === "edit"), w = t((e) => e.selectWidget), T = e(u.id), E = n(u.id), D = i(), Fe = !!u.dataSinkId || !!u.datasetId || !!u.parserId, { data: O, loading: Ie } = a(u.id, {
33
- skip: !Fe,
34
- pollInterval: (u.refreshInterval ?? 0) * 1e3 || 0
35
- }), k = p(() => {
33
+ var y = f(function({ widget: d, children: f, data: v, className: y = "", isLoading: Pe, error: Fe, onRefresh: b, onDrilldown: Ie, actions: x, onAction: S, filterValues: C }) {
34
+ let w = r((e) => e.viewMode === "edit"), T = t((e) => e.selectWidget), E = e(d.id), D = n(d.id), O = i(), Le = pe(), k = d.dashboardId, A = m(() => {
35
+ if (!k) return {};
36
+ try {
37
+ let e = Le.readQuery({
38
+ query: a,
39
+ variables: { id: k }
40
+ }), t = {};
41
+ for (let n of e?.getDashboard?.globalFilters ?? []) {
42
+ let e = n.config?.field;
43
+ typeof e == "string" && e && (t[n.id] = e);
44
+ }
45
+ return t;
46
+ } catch {
47
+ return {};
48
+ }
49
+ }, [Le, k]), Re = !!d.dataSinkId || !!d.datasetId || !!d.parserId, { data: j, loading: ze } = o(d.id, {
50
+ skip: !Re,
51
+ pollInterval: (d.refreshInterval ?? 0) * 1e3 || 0
52
+ }), M = m(() => {
36
53
  if (typeof window > "u") return {};
37
54
  let e = new URLSearchParams(window.location.search), t = {};
38
55
  return e.forEach((e, n) => {
@@ -41,56 +58,56 @@ var v = d(function({ widget: u, children: d, data: _, className: v = "", isLoadi
41
58
  r.startsWith("__") || (t[r] = e);
42
59
  }
43
60
  }), t;
44
- }, []), A = p(() => {
61
+ }, []), N = m(() => {
45
62
  let e = {};
46
- return k && Object.keys(k).length > 0 && Object.assign(e, k), D && Object.keys(D).length > 0 && Object.assign(e, D), S && Object.keys(S).length > 0 && Object.assign(e, S), e;
63
+ return M && Object.keys(M).length > 0 && Object.assign(e, M), O && Object.keys(O).length > 0 && Object.assign(e, O), C && Object.keys(C).length > 0 && Object.assign(e, C), e;
47
64
  }, [
48
- k,
49
- D,
50
- S
51
- ]), j = Object.keys(A).length > 0, M = Me ?? (Ie && !O) ?? E.isLoading, N = Ne ?? E.errorMessage, Le = o(u.type), P = m(y);
65
+ M,
66
+ O,
67
+ C
68
+ ]), P = Object.keys(N).length > 0, F = Pe ?? (ze && !j) ?? D.isLoading, I = Fe ?? D.errorMessage, Be = s(d.type), L = h(b);
52
69
  fe(() => {
53
- P.current = y;
54
- }, [y]);
55
- let F = f(async () => {
56
- P.current && await P.current();
57
- }, []), { timeUntilRefresh: Re, isPaused: ze } = te({
58
- widgetId: u.id,
59
- refreshInterval: u.refreshInterval,
60
- onRefresh: F,
61
- enabled: !C && !!u.refreshInterval
62
- }), I = m(null), [L, R] = h(!1), [z, Be] = h(!1), { count: Ve } = ne(u.id, z), He = f(() => {
63
- R((e) => {
70
+ L.current = b;
71
+ }, [b]);
72
+ let Ve = p(async () => {
73
+ L.current && await L.current();
74
+ }, []), { timeUntilRefresh: He, isPaused: Ue } = te({
75
+ widgetId: d.id,
76
+ refreshInterval: d.refreshInterval,
77
+ onRefresh: Ve,
78
+ enabled: !w && !!d.refreshInterval
79
+ }), R = h(null), [z, B] = g(!1), [V, We] = g(!1), { count: Ge } = ne(d.id, V), Ke = p(() => {
80
+ B((e) => {
64
81
  let t = !e;
65
- return t && Be(!0), t;
82
+ return t && We(!0), t;
66
83
  });
67
- }, []), B = p(() => {
68
- if (_ && Array.isArray(_)) return _;
69
- let e = u.data;
84
+ }, []), H = m(() => {
85
+ if (v && Array.isArray(v)) return v;
86
+ let e = d.data;
70
87
  if (e?.processed && Array.isArray(e.processed)) return e.processed;
71
88
  if (e?.raw) {
72
89
  let t = typeof e.raw == "string" ? JSON.parse(e.raw) : e.raw;
73
90
  if (Array.isArray(t)) return t;
74
91
  }
75
92
  return null;
76
- }, [_, u]), { exportCSV: Ue, exportPNG: We } = re(u, {
77
- data: B,
78
- containerRef: I
79
- }), V = f((e) => {
93
+ }, [v, d]), { exportCSV: qe, exportPNG: Je } = re(d, {
94
+ data: H,
95
+ containerRef: R
96
+ }), U = p((e) => {
80
97
  if (e == null) return !1;
81
98
  if (Array.isArray(e)) return e.length > 0;
82
99
  if (typeof e == "object") {
83
100
  let t = e, n = Object.keys(t);
84
101
  return n.length === 0 ? !1 : n.some((e) => {
85
102
  let n = t[e];
86
- return n == null || n === "" ? !1 : Array.isArray(n) ? n.length > 0 : typeof n == "object" ? V(n) : !0;
103
+ return n == null || n === "" ? !1 : Array.isArray(n) ? n.length > 0 : typeof n == "object" ? U(n) : !0;
87
104
  });
88
105
  }
89
106
  return !0;
90
- }, []), H = f((e) => {
91
- if (!j || !e) return e;
107
+ }, []), W = p((e) => {
108
+ if (!P || !e) return e;
92
109
  let t = {}, n = {};
93
- Object.entries(A || {}).forEach(([e, r]) => {
110
+ Object.entries(N || {}).forEach(([e, r]) => {
94
111
  if (e.startsWith("ctx_")) {
95
112
  let n = e.slice(4);
96
113
  t[n] = r;
@@ -151,19 +168,29 @@ var v = d(function({ widget: u, children: d, data: _, className: v = "", isLoadi
151
168
  continue;
152
169
  }
153
170
  }
154
- let n = i(e, t);
155
- if (n !== void 0) {
156
- if (!r(n, a)) return !1;
171
+ if (typeof a == "object" && a && !Array.isArray(a)) continue;
172
+ let n = A[t];
173
+ if (n) {
174
+ let t = i(e, n);
175
+ if (t !== void 0) {
176
+ if (!r(t, a)) return !1;
177
+ continue;
178
+ }
179
+ continue;
180
+ }
181
+ let o = i(e, t);
182
+ if (o !== void 0) {
183
+ if (!r(o, a)) return !1;
157
184
  continue;
158
185
  }
159
- let o = String(a).toLowerCase();
160
- if (!Object.values(e).map((e) => String(e).toLowerCase()).some((e) => e === o || e.includes(o))) {
186
+ let s = String(a).toLowerCase();
187
+ if (!Object.values(e).map((e) => String(e).toLowerCase()).some((e) => e === s || e.includes(s))) {
161
188
  let t = Object.keys(e).map((e) => e.toLowerCase()).filter((e) => e.includes("category") || e.includes("type") || e.includes("status") || e.includes("name") || e.includes("region") || e.includes("group")), n = !1;
162
189
  for (let r of t) {
163
190
  let t = Object.keys(e).find((e) => e.toLowerCase() === r);
164
191
  if (t) {
165
192
  let r = String(e[t]).toLowerCase();
166
- if (r === o || r.includes(o)) {
193
+ if (r === s || r.includes(s)) {
167
194
  n = !0;
168
195
  break;
169
196
  }
@@ -209,123 +236,124 @@ var v = d(function({ widget: u, children: d, data: _, className: v = "", isLoadi
209
236
  }
210
237
  return e;
211
238
  }, [
212
- j,
213
- A,
214
- u.id
215
- ]), U = p(() => {
239
+ P,
240
+ N,
241
+ d.id,
242
+ A
243
+ ]), G = m(() => {
216
244
  let e = null;
217
- if (_ && V(_)) e = _;
218
- else if (O) {
219
- let t = O;
220
- if (t?.processed && V(t.processed)) e = t.processed;
245
+ if (v && U(v)) e = v;
246
+ else if (j) {
247
+ let t = j;
248
+ if (t?.processed && U(t.processed)) e = t.processed;
221
249
  else if (t?.raw) try {
222
250
  let n = typeof t.raw == "string" ? JSON.parse(t.raw) : t.raw;
223
- V(n) && (e = n);
251
+ U(n) && (e = n);
224
252
  } catch {}
225
253
  } else {
226
- let t = u.data;
227
- if (t?.processed && V(t.processed)) e = t.processed;
254
+ let t = d.data;
255
+ if (t?.processed && U(t.processed)) e = t.processed;
228
256
  else if (t?.raw) try {
229
257
  let n = typeof t.raw == "string" ? JSON.parse(t.raw) : t.raw;
230
- V(n) && (e = n);
258
+ U(n) && (e = n);
231
259
  } catch {}
232
260
  }
233
261
  if (!e) {
234
- let t = u.config?.mockData;
262
+ let t = d.config?.mockData;
235
263
  if (t) try {
236
264
  let n = typeof t == "string" ? JSON.parse(t) : t;
237
- V(n) && (e = n);
265
+ U(n) && (e = n);
238
266
  } catch {}
239
267
  }
240
268
  if (e && typeof e == "object" && !Array.isArray(e)) {
241
- let t = u.config, n = t?.dataKey ?? t?.dataPath ?? t?.seriesPath;
269
+ let t = d.config, n = t?.dataKey ?? t?.dataPath ?? t?.seriesPath;
242
270
  if (n && typeof n == "string") {
243
271
  let t = n.split(".").reduce((e, t) => e && typeof e == "object" ? e[t] : void 0, e);
244
- t != null && V(t) && (e = t);
272
+ t != null && U(t) && (e = t);
245
273
  }
246
274
  }
247
- return j && e ? H(e) : e;
275
+ return P && e ? W(e) : e;
248
276
  }, [
249
- _,
250
- u,
251
- O,
277
+ v,
278
+ d,
252
279
  j,
253
- H,
254
- A,
255
- V
256
- ]), W = p(() => U ?? null, [U]), { executeDrilldown: G, canDrilldown: K } = ie({ onDrilldown: (e, t) => {
257
- Pe?.(e);
258
- } }), q = p(() => K(u), [u, K]), J = f((e) => {
259
- if (!u.drilldown?.enabled) return;
280
+ P,
281
+ W,
282
+ N,
283
+ U
284
+ ]), K = m(() => G ?? null, [G]), { executeDrilldown: q, canDrilldown: J } = ie({ onDrilldown: (e, t) => {
285
+ Ie?.(e);
286
+ } }), Y = m(() => J(d), [d, J]), X = p((e) => {
287
+ if (!d.drilldown?.enabled) return;
260
288
  let t = {
261
289
  selectedData: e || {},
262
- globalFilters: D || {},
263
- widgetData: W || {},
290
+ globalFilters: O || {},
291
+ widgetData: K || {},
264
292
  metadata: {
265
- widgetId: u.id,
266
- widgetType: u.type,
267
- widgetTitle: u.title
293
+ widgetId: d.id,
294
+ widgetType: d.type,
295
+ widgetTitle: d.title
268
296
  },
269
- sourceDashboardId: u.dashboardId
297
+ sourceDashboardId: d.dashboardId
270
298
  };
271
- G(u.drilldown, t);
299
+ q(d.drilldown, t);
272
300
  }, [
273
- u,
274
- W,
275
- D,
276
- G
277
- ]), Y = m(null), Ge = f((e) => {
278
- Y.current = {
301
+ d,
302
+ K,
303
+ O,
304
+ q
305
+ ]), Z = h(null), Ye = p((e) => {
306
+ Z.current = {
279
307
  x: e.clientX,
280
308
  y: e.clientY
281
309
  };
282
- }, []), Ke = f((e) => {
283
- if (e.stopPropagation(), Y.current) {
284
- let t = Math.abs(e.clientX - Y.current.x), n = Math.abs(e.clientY - Y.current.y);
310
+ }, []), Xe = p((e) => {
311
+ if (e.stopPropagation(), Z.current) {
312
+ let t = Math.abs(e.clientX - Z.current.x), n = Math.abs(e.clientY - Z.current.y);
285
313
  if (t > 5 || n > 5) {
286
- Y.current = null;
314
+ Z.current = null;
287
315
  return;
288
316
  }
289
317
  }
290
- Y.current = null, C && w(u.id);
318
+ Z.current = null, w && T(d.id);
291
319
  }, [
292
- C,
293
320
  w,
294
- u.id
295
- ]), qe = f((e) => {
296
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), C && w(u.id));
321
+ T,
322
+ d.id
323
+ ]), Ze = p((e) => {
324
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), w && T(d.id));
297
325
  }, [
298
- C,
299
326
  w,
300
- u.id
301
- ]), Je = p(() => u.type === "custom" && le(u.config), [u.type, u.config]), Ye = p(() => u.type === "custom" && ce(u.config), [u.type, u.config]), X = q && !Ye, Xe = !M && !N && !W && !Je, Z = p(() => u.renderer, [u]), Q = p(() => Z && Z !== "BIGCONSOLE", [Z]), Ze = p(() => ({
302
- widgetId: u.id,
303
- data: W || {}
304
- }), [u.id, W]), $ = f((e, t) => {
305
- if (!x) return;
306
- let n = b?.find((t) => t.name === e.name);
307
- x(n || e, t);
308
- }, [x, b]), Qe = f(() => {
327
+ T,
328
+ d.id
329
+ ]), Qe = m(() => d.type === "custom" && le(d.config), [d.type, d.config]), $e = m(() => d.type === "custom" && ce(d.config), [d.type, d.config]), Q = Y && !$e, et = !F && !I && !K && !Qe, $ = m(() => d.renderer, [d]), tt = m(() => $ && $ !== "BIGCONSOLE", [$]), nt = m(() => ({
330
+ widgetId: d.id,
331
+ data: K || {}
332
+ }), [d.id, K]), rt = p((e, t) => {
333
+ if (!S) return;
334
+ let n = x?.find((t) => t.name === e.name);
335
+ S(n || e, t);
336
+ }, [S, x]), it = p(() => {
309
337
  let e = {
310
- widget: u,
338
+ widget: d,
311
339
  data: (() => {
312
- if (!W) return W;
313
- if (u.type === "table" || u.type === "pivot_table") {
314
- if (Array.isArray(W)) return W;
315
- if (W && typeof W == "object" && "rows" in W) return W.rows;
340
+ if (!K) return K;
341
+ if (d.type === "table" || d.type === "pivot_table") {
342
+ if (Array.isArray(K)) return K;
343
+ if (K && typeof K == "object" && "rows" in K) return K.rows;
316
344
  }
317
- if (u.type === "list") {
318
- if (Array.isArray(W)) return W;
319
- if (W && typeof W == "object" && "items" in W) return W.items;
345
+ if (d.type === "list") {
346
+ if (Array.isArray(K)) return K;
347
+ if (K && typeof K == "object" && "items" in K) return K.items;
320
348
  }
321
- if (u.type === "funnel_chart") {
322
- if (Array.isArray(W)) return W;
323
- if (W && typeof W == "object" && "stages" in W) return W.stages;
349
+ if (d.type === "funnel_chart") {
350
+ if (Array.isArray(K)) return K;
351
+ if (K && typeof K == "object" && "stages" in K) return K.stages;
324
352
  }
325
- if (u.type === "chart") {
326
- if (Array.isArray(W)) return W;
327
- if (W && typeof W == "object" && "datasets" in W) {
328
- let e = W;
353
+ if (d.type === "chart") {
354
+ if (Array.isArray(K)) return K;
355
+ if (K && typeof K == "object" && "datasets" in K) {
356
+ let e = K;
329
357
  if (e.labels && e.datasets) return e.labels.map((t, n) => {
330
358
  let r = { name: t };
331
359
  return e.datasets?.forEach((e) => {
@@ -334,8 +362,8 @@ var v = d(function({ widget: u, children: d, data: _, className: v = "", isLoadi
334
362
  });
335
363
  }
336
364
  }
337
- if (u.type === "text" && W && typeof W == "object" && !("content" in W)) {
338
- let e = W, t = [];
365
+ if (d.type === "text" && K && typeof K == "object" && !("content" in K)) {
366
+ let e = K, t = [];
339
367
  for (let [n, r] of Object.entries(e)) if (r && typeof r == "object" && !Array.isArray(r)) {
340
368
  t.push(`### ${n}`);
341
369
  for (let [e, n] of Object.entries(r)) t.push(`- **${e}:** ${n}`);
@@ -350,173 +378,174 @@ var v = d(function({ widget: u, children: d, data: _, className: v = "", isLoadi
350
378
  format: "markdown"
351
379
  };
352
380
  }
353
- if (u.type === "custom") {
354
- let e = u.config?.valueField;
355
- if (e && W && typeof W == "object" && !Array.isArray(W)) {
356
- let t = W;
381
+ if (d.type === "custom") {
382
+ let e = d.config?.valueField;
383
+ if (e && K && typeof K == "object" && !Array.isArray(K)) {
384
+ let t = K;
357
385
  if (e in t) return {
358
386
  value: t[e],
359
- label: u.title,
387
+ label: d.title,
360
388
  data: t
361
389
  };
362
390
  }
363
391
  }
364
- return W;
392
+ return K;
365
393
  })(),
366
- onDrilldown: q ? J : void 0
394
+ onDrilldown: Y ? X : void 0
367
395
  };
368
- if (Q) {
396
+ if (tt) {
369
397
  let e = {};
370
- if (U && typeof U == "object" && !Array.isArray(U) && Object.keys(U).length > 0 && (e = { ...U }), u.config?._internalWidgetType === "custom" && Object.keys(e).length > 0) {
371
- let t = u.config?.valueField;
398
+ if (G && typeof G == "object" && !Array.isArray(G) && Object.keys(G).length > 0 && (e = { ...G }), d.config?._internalWidgetType === "custom" && Object.keys(e).length > 0) {
399
+ let t = d.config?.valueField;
372
400
  if (t && t in e) {
373
401
  let n = e[t], r = typeof n == "number" ? n.toLocaleString() : String(n);
374
402
  e = {
375
403
  ...e,
376
404
  value: n,
377
405
  title: e.title || r,
378
- description: e.description || u.title || "",
406
+ description: e.description || d.title || "",
379
407
  text: e.text || r
380
408
  };
381
409
  }
382
410
  }
383
- return /* @__PURE__ */ g(ue, {
384
- widget: u,
411
+ return /* @__PURE__ */ _(ue, {
412
+ widget: d,
385
413
  data: e,
386
- isEditMode: C,
387
- isSelected: T,
388
- isLoading: M,
389
- error: N,
390
- onDrilldown: q ? J : void 0,
391
- onAction: $
414
+ isEditMode: w,
415
+ isSelected: E,
416
+ isLoading: F,
417
+ error: I,
418
+ onDrilldown: Y ? X : void 0,
419
+ onAction: rt
392
420
  });
393
421
  }
394
- switch (u.type?.toLowerCase() || "") {
395
- case "metric_card": return /* @__PURE__ */ g(me, { ...e });
396
- case "kpi_card_comparison": return /* @__PURE__ */ g(Te, { ...e });
422
+ switch (d.type?.toLowerCase() || "") {
423
+ case "metric_card": return /* @__PURE__ */ _(he, { ...e });
424
+ case "kpi_card_comparison": return /* @__PURE__ */ _(De, { ...e });
397
425
  case "chart":
398
- case "funnel_chart": return /* @__PURE__ */ g(he, { ...e });
399
- case "table": return /* @__PURE__ */ g(ge, { ...e });
400
- case "pivot_table": return /* @__PURE__ */ g(_e, { ...e });
401
- case "gauge": return /* @__PURE__ */ g(ve, { ...e });
402
- case "progress": return /* @__PURE__ */ g(ye, { ...e });
403
- case "list": return /* @__PURE__ */ g(be, { ...e });
404
- case "heatmap": return /* @__PURE__ */ g(xe, { ...e });
405
- case "calendar": return /* @__PURE__ */ g(Se, { ...e });
406
- case "timeline": return /* @__PURE__ */ g(we, { ...e });
407
- case "kanban": return /* @__PURE__ */ g(Ce, { ...e });
408
- case "form": return /* @__PURE__ */ g(Ae, { ...e });
409
- case "text": return /* @__PURE__ */ g(Ee, { ...e });
410
- case "iframe": return /* @__PURE__ */ g(Oe, { ...e });
411
- case "map": return /* @__PURE__ */ g(De, { ...e });
412
- case "custom": return /* @__PURE__ */ g(ke, { ...e });
413
- default: return d || /* @__PURE__ */ g(c, { widgetType: u.type });
426
+ case "funnel_chart": return /* @__PURE__ */ _(ge, { ...e });
427
+ case "table": return /* @__PURE__ */ _(_e, { ...e });
428
+ case "pivot_table": return /* @__PURE__ */ _(ve, { ...e });
429
+ case "gauge": return /* @__PURE__ */ _(ye, { ...e });
430
+ case "progress": return /* @__PURE__ */ _(be, { ...e });
431
+ case "list": return /* @__PURE__ */ _(xe, { ...e });
432
+ case "heatmap": return /* @__PURE__ */ _(Se, { ...e });
433
+ case "retention": return /* @__PURE__ */ _(Ce, { ...e });
434
+ case "calendar": return /* @__PURE__ */ _(we, { ...e });
435
+ case "timeline": return /* @__PURE__ */ _(Ee, { ...e });
436
+ case "kanban": return /* @__PURE__ */ _(Te, { ...e });
437
+ case "form": return /* @__PURE__ */ _(Me, { ...e });
438
+ case "text": return /* @__PURE__ */ _(Oe, { ...e });
439
+ case "iframe": return /* @__PURE__ */ _(Ae, { ...e });
440
+ case "map": return /* @__PURE__ */ _(ke, { ...e });
441
+ case "custom": return /* @__PURE__ */ _(je, { ...e });
442
+ default: return f || /* @__PURE__ */ _(l, { widgetType: d.type });
414
443
  }
415
444
  }, [
416
- u,
417
- W,
418
445
  d,
419
- q,
420
- J,
421
- Q,
422
- C,
423
- T,
424
- M,
425
- N,
426
- $,
427
- U
446
+ K,
447
+ f,
448
+ Y,
449
+ X,
450
+ tt,
451
+ w,
452
+ E,
453
+ F,
454
+ I,
455
+ rt,
456
+ G
428
457
  ]);
429
- return /* @__PURE__ */ pe("div", {
430
- ref: I,
458
+ return /* @__PURE__ */ me("div", {
459
+ ref: R,
431
460
  className: `
432
461
  group relative flex flex-col
433
462
  h-full w-full
434
463
  rounded-lg border
435
464
  bg-bg-surface
436
465
  transition-all duration-200
437
- ${T && C ? "border-action-primary-border ring-2 ring-action-primary-border/30" : "border-border-default hover:border-action-primary-bg"}
438
- ${C ? "cursor-pointer" : ""}
439
- ${v}
466
+ ${E && w ? "border-action-primary-border ring-2 ring-action-primary-border/30" : "border-border-default hover:border-action-primary-bg"}
467
+ ${w ? "cursor-pointer" : ""}
468
+ ${y}
440
469
  `,
441
- onMouseDown: Ge,
442
- onClick: Ke,
443
- onKeyDown: qe,
444
- tabIndex: C ? 0 : -1,
445
- role: C ? "button" : void 0,
446
- "aria-selected": T,
447
- "aria-label": `Widget: ${u.title}`,
448
- "data-widget-id": u.id,
449
- "data-widget-type": u.type,
470
+ onMouseDown: Ye,
471
+ onClick: Xe,
472
+ onKeyDown: Ze,
473
+ tabIndex: w ? 0 : -1,
474
+ role: w ? "button" : void 0,
475
+ "aria-selected": E,
476
+ "aria-label": `Widget: ${d.title}`,
477
+ "data-widget-id": d.id,
478
+ "data-widget-type": d.type,
450
479
  children: [
451
- /* @__PURE__ */ g(ae, {
452
- widget: u,
453
- definition: Le,
454
- isSelected: T,
455
- isEditMode: C,
456
- isLoading: M,
457
- timeUntilRefresh: u.refreshInterval && !ze ? ee(Re) : void 0,
458
- hasDrilldown: q,
459
- onRefresh: y,
460
- onExportCSV: B ? Ue : void 0,
461
- onExportPNG: We,
462
- onDrilldown: q ? () => J() : void 0,
463
- onToggleComments: He,
464
- commentsOpen: L,
465
- commentCount: z ? Ve : void 0
480
+ /* @__PURE__ */ _(ae, {
481
+ widget: d,
482
+ definition: Be,
483
+ isSelected: E,
484
+ isEditMode: w,
485
+ isLoading: F,
486
+ timeUntilRefresh: d.refreshInterval && !Ue ? ee(He) : void 0,
487
+ hasDrilldown: Y,
488
+ onRefresh: b,
489
+ onExportCSV: H ? qe : void 0,
490
+ onExportPNG: Je,
491
+ onDrilldown: Y ? () => X() : void 0,
492
+ onToggleComments: Ke,
493
+ commentsOpen: z,
494
+ commentCount: V ? Ge : void 0
466
495
  }),
467
- /* @__PURE__ */ g("div", {
496
+ /* @__PURE__ */ _("div", {
468
497
  className: `
469
498
  flex-1 overflow-hidden p-4 min-h-0
470
- ${X && !C ? "cursor-pointer" : ""}
499
+ ${Q && !w ? "cursor-pointer" : ""}
471
500
  `,
472
- title: X && !C ? "Click data to drill down" : void 0,
473
- children: /* @__PURE__ */ g("div", {
501
+ title: Q && !w ? "Click data to drill down" : void 0,
502
+ children: /* @__PURE__ */ _("div", {
474
503
  className: "h-full overflow-auto",
475
504
  children: (() => {
476
- if (M) return /* @__PURE__ */ g(s, {});
477
- if (N) return /* @__PURE__ */ g(oe, {
478
- error: N,
479
- onRetry: y
505
+ if (F) return /* @__PURE__ */ _(c, {});
506
+ if (I) return /* @__PURE__ */ _(oe, {
507
+ error: I,
508
+ onRetry: b
480
509
  });
481
- if (Xe && !d) return /* @__PURE__ */ g(c, {
482
- widgetType: u.type,
483
- hasDataSource: !!u.parserId || !!u.dataSinkId
510
+ if (et && !f) return /* @__PURE__ */ _(l, {
511
+ widgetType: d.type,
512
+ hasDataSource: !!d.parserId || !!d.dataSinkId
484
513
  });
485
- let e = `${u.parserId ?? ""}|${u.dataSinkId ?? ""}|${u.updatedAt ?? ""}`;
486
- return /* @__PURE__ */ g(se, {
487
- widgetId: u.id,
488
- widgetType: u.type,
489
- widgetTitle: u.title,
514
+ let e = `${d.parserId ?? ""}|${d.dataSinkId ?? ""}|${d.updatedAt ?? ""}`;
515
+ return /* @__PURE__ */ _(se, {
516
+ widgetId: d.id,
517
+ widgetType: d.type,
518
+ widgetTitle: d.title,
490
519
  resetKey: e,
491
- children: d ?? /* @__PURE__ */ g(l, {
492
- fallback: /* @__PURE__ */ g(s, {}),
493
- children: Qe()
520
+ children: f ?? /* @__PURE__ */ _(u, {
521
+ fallback: /* @__PURE__ */ _(c, {}),
522
+ children: it()
494
523
  })
495
524
  });
496
525
  })()
497
526
  })
498
527
  }),
499
- b && b.length > 0 && !M && !N && /* @__PURE__ */ g("div", {
528
+ x && x.length > 0 && !F && !I && /* @__PURE__ */ _("div", {
500
529
  className: "px-4 py-3 border-t border-border-default bg-bg-muted",
501
530
  style: { flexShrink: 0 },
502
- children: /* @__PURE__ */ g(de, {
503
- actions: b,
504
- context: Ze,
505
- onAction: x,
506
- disabled: C,
531
+ children: /* @__PURE__ */ _(de, {
532
+ actions: x,
533
+ context: nt,
534
+ onAction: S,
535
+ disabled: w,
507
536
  layout: "horizontal",
508
537
  size: "sm"
509
538
  })
510
539
  }),
511
- X && !C && /* @__PURE__ */ g("div", {
540
+ Q && !w && /* @__PURE__ */ _("div", {
512
541
  className: "\n absolute bottom-2 right-2\n opacity-0 group-hover:opacity-100\n transition-opacity duration-200\n ",
513
542
  title: "Click to drill down",
514
- children: /* @__PURE__ */ g("svg", {
543
+ children: /* @__PURE__ */ _("svg", {
515
544
  className: "w-4 h-4 text-text-secondary",
516
545
  fill: "none",
517
546
  stroke: "currentColor",
518
547
  viewBox: "0 0 24 24",
519
- children: /* @__PURE__ */ g("path", {
548
+ children: /* @__PURE__ */ _("path", {
520
549
  strokeLinecap: "round",
521
550
  strokeLinejoin: "round",
522
551
  strokeWidth: 2,
@@ -524,17 +553,17 @@ var v = d(function({ widget: u, children: d, data: _, className: v = "", isLoadi
524
553
  })
525
554
  })
526
555
  }),
527
- L && /* @__PURE__ */ g(l, {
556
+ z && /* @__PURE__ */ _(u, {
528
557
  fallback: null,
529
- children: /* @__PURE__ */ g(je, {
530
- widgetId: u.id,
531
- onClose: () => R(!1)
558
+ children: /* @__PURE__ */ _(Ne, {
559
+ widgetId: d.id,
560
+ onClose: () => B(!1)
532
561
  })
533
562
  })
534
563
  ]
535
564
  });
536
- }, _);
565
+ }, v);
537
566
  //#endregion
538
- export { v as default };
567
+ export { y as default };
539
568
 
540
569
  //# sourceMappingURL=WidgetWrapper.js.map