react-semaphor 0.0.344 → 0.0.345

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.
@@ -17731,11 +17731,11 @@ function QZ(e) {
17731
17731
  (d) => d.sheetId === t || !d.sheetId
17732
17732
  ), a = o == null ? void 0 : o.filter(
17733
17733
  (d) => (s == null ? void 0 : s.some((p) => p.id === d.filterId)) || d.filterId.endsWith(t)
17734
- ), l = tY(e.sql, r), c = ZZ(e.python || "");
17734
+ ), l = tY(e == null ? void 0 : e.sql, r), c = ZZ((e == null ? void 0 : e.python) || "");
17735
17735
  return { queryKey: [
17736
17736
  "query",
17737
- e.id,
17738
- e.title,
17737
+ e == null ? void 0 : e.id,
17738
+ e == null ? void 0 : e.title,
17739
17739
  l,
17740
17740
  c,
17741
17741
  n || "",
@@ -17757,33 +17757,26 @@ function Sc(e, t) {
17757
17757
  return { ...Ly({
17758
17758
  queryKey: s,
17759
17759
  // ],
17760
- queryFn: () => j_(
17761
- "https://semaphor.cloud/api/v1/query",
17762
- (n == null ? void 0 : n.accessToken) || (i == null ? void 0 : i.accessToken) || "",
17763
- {
17764
- connection_id: e.connectionId,
17765
- sql: a,
17766
- python: e.python === nN ? "" : e.python,
17767
- active_filters: l,
17768
- //filterValues,
17769
- cache_config: G_()
17770
- }
17771
- ),
17760
+ queryFn: async () => {
17761
+ var p;
17762
+ return !(e != null && e.connectionId) || !((p = e == null ? void 0 : e.sql) != null && p.trim()) ? null : await j_(
17763
+ "https://semaphor.cloud/api/v1/query",
17764
+ (n == null ? void 0 : n.accessToken) || (i == null ? void 0 : i.accessToken) || "",
17765
+ {
17766
+ connection_id: e.connectionId,
17767
+ sql: a,
17768
+ python: e.python === nN ? "" : e.python,
17769
+ active_filters: l,
17770
+ //filterValues,
17771
+ cache_config: G_()
17772
+ }
17773
+ );
17774
+ },
17772
17775
  // staleTime: 1000,
17773
17776
  refetchInterval: o,
17774
17777
  placeholderData: BY,
17775
17778
  //staleTime: 60_000,
17776
- enabled: !!e.connectionId && !!e.sql && !0 && !r
17777
- //&& !isDashboardEditing,
17778
- // &&
17779
- // selectedSheetId === cardSheet?.id,
17780
- // enabled: !!interval && isDashboardEditing && !!card?.connectionId, // Only fetch if connectionId is present,
17781
- // isDashboardEditing &&
17782
- // !!card.id &&
17783
- // !!card.sql &&
17784
- // !isEditorSaveEvent &&
17785
- // // card?.data?.length === 0 &&
17786
- // !!card?.connectionId, // Only fetch if connectionId is present,
17779
+ enabled: !!(e != null && e.connectionId) && !!(e != null && e.sql) && !0 && !r
17787
17780
  }), queryKey: s };
17788
17781
  }
17789
17782
  function k5({ frame: e }) {
@@ -39811,62 +39804,65 @@ Fn.register(nl);
39811
39804
  Fn.register(Wb);
39812
39805
  Fn.register(L4);
39813
39806
  function uF({ cfg: e, onDatapointClick: t }) {
39814
- var u;
39815
- const [n, r] = Ae(""), i = ve((d) => d.selectedLensId), o = Ne(null), [s, a] = Ae(), l = ve((d) => d.themeStyle);
39807
+ var d;
39808
+ const [n, r] = Ae(""), i = ve((p) => p.selectedLensId), o = Ne(null), [s, a] = Ae(), l = ve((p) => p.themeStyle);
39816
39809
  Be(() => {
39817
39810
  if (o.current) {
39818
- const d = window.getComputedStyle(o.current);
39819
- r(d.fontFamily);
39811
+ const p = window.getComputedStyle(o.current);
39812
+ r(p.fontFamily);
39820
39813
  }
39821
39814
  }, []), Be(() => {
39822
- var m, b, v, x;
39815
+ var b, v, x, S;
39823
39816
  if (!n) return;
39824
- (b = (m = l == null ? void 0 : l.chart) == null ? void 0 : m.font) != null && b.family && (Fn.defaults.font = {
39817
+ (v = (b = l == null ? void 0 : l.chart) == null ? void 0 : b.font) != null && v.family && (Fn.defaults.font = {
39825
39818
  ...Fn.defaults.font,
39826
- ...(v = l == null ? void 0 : l.chart) == null ? void 0 : v.font,
39819
+ ...(x = l == null ? void 0 : l.chart) == null ? void 0 : x.font,
39827
39820
  family: n
39828
39821
  });
39829
- const d = {
39822
+ const p = {
39830
39823
  ...e,
39831
39824
  options: {
39832
39825
  ...e.options,
39833
39826
  responsive: !0,
39834
39827
  maintainAspectRatio: !1
39835
39828
  }
39836
- }, p = (x = o == null ? void 0 : o.current) == null ? void 0 : x.getContext("2d");
39837
- if (!p) return;
39838
- let h;
39829
+ }, h = (S = o == null ? void 0 : o.current) == null ? void 0 : S.getContext("2d");
39830
+ if (!h) return;
39831
+ let m;
39839
39832
  try {
39840
- const S = mle(d, p);
39841
- h = new Fn(p, S), a(h);
39842
- } catch (S) {
39843
- console.log("error creating chart", S);
39833
+ const _ = mle(p, h);
39834
+ m = new Fn(h, _), a(m);
39835
+ } catch (_) {
39836
+ console.log("error creating chart", _);
39844
39837
  }
39845
39838
  return () => {
39846
- h && h.destroy();
39839
+ m && m.destroy();
39847
39840
  };
39848
- }, [(u = l == null ? void 0 : l.chart) == null ? void 0 : u.font, i, n]);
39849
- function c(d) {
39850
- var h, m;
39841
+ }, [(d = l == null ? void 0 : l.chart) == null ? void 0 : d.font, i, n]);
39842
+ function c(p) {
39843
+ var m, b;
39851
39844
  if (!s) return;
39852
- const p = s == null ? void 0 : s.getElementsAtEventForMode(
39853
- d,
39845
+ const h = s == null ? void 0 : s.getElementsAtEventForMode(
39846
+ p,
39854
39847
  "nearest",
39855
39848
  { intersect: !0 },
39856
39849
  !0
39857
39850
  );
39858
- if (p && p.length > 0) {
39859
- const b = p[0].datasetIndex, v = p[0].index, x = (m = (h = p[0].element) == null ? void 0 : h.$context) == null ? void 0 : m.raw;
39860
- t == null || t(s, b, v, x);
39851
+ if (h && h.length > 0) {
39852
+ const v = h[0].datasetIndex, x = h[0].index, S = (b = (m = h[0].element) == null ? void 0 : m.$context) == null ? void 0 : b.raw;
39853
+ t == null || t(s, v, x, S);
39861
39854
  }
39862
39855
  }
39856
+ const u = e.type === "doughnut" || e.type === "pie";
39863
39857
  return (
39864
39858
  //Source: https://codepen.io/chartjs/pen/YVWZbz
39865
39859
  /* @__PURE__ */ y.jsx(
39866
39860
  "div",
39867
39861
  {
39868
39862
  onClick: c,
39869
- className: "relative h-[99%]",
39863
+ className: be("relative h-[99%]", {
39864
+ "mx-20": u
39865
+ }),
39870
39866
  children: /* @__PURE__ */ y.jsx("canvas", { ref: o })
39871
39867
  }
39872
39868
  )
@@ -61003,8 +60999,8 @@ export {
61003
60999
  LTe as aH,
61004
61000
  Sc as aI,
61005
61001
  OC as aJ,
61006
- oee as aK,
61007
- nN as aL,
61002
+ nN as aK,
61003
+ oee as aL,
61008
61004
  FTe as aM,
61009
61005
  VMe as aN,
61010
61006
  gN as aO,