react-semaphor 0.1.239 → 0.1.241
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.
- package/dist/chunks/{dashboard-controls-DIFPVHkq.js → dashboard-controls-Bbjg39W1.js} +1 -1
- package/dist/chunks/{dashboard-controls-m-rn9O15.js → dashboard-controls-CydTgB8b.js} +5 -5
- package/dist/chunks/{dashboard-json-CJ1HKDT6.js → dashboard-json-BqhlPxCk.js} +1 -1
- package/dist/chunks/{dashboard-json-HWBQuWn2.js → dashboard-json-Dh0BCAEU.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-DlwLS77e.js → dashboard-summary-settings-dialog-DMGeFM9N.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-DvLyjGhq.js → dashboard-summary-settings-dialog-DXEx7VYT.js} +1 -1
- package/dist/chunks/date-formatter-BeFtqSQ2.js +1978 -0
- package/dist/chunks/date-formatter-CZ8p6ngp.js +1 -0
- package/dist/chunks/{edit-dashboard-visual-BVlA_vRb.js → edit-dashboard-visual-BSHC5QiP.js} +3332 -3316
- package/dist/chunks/{edit-dashboard-visual-B5jatJ2M.js → edit-dashboard-visual-DcLZThas.js} +12 -12
- package/dist/chunks/{editor-action-buttons-Bq-ENC_B.js → editor-action-buttons-C_zLw3Aj.js} +1 -1
- package/dist/chunks/{editor-action-buttons-d64iA8wP.js → editor-action-buttons-lDMI1SQ2.js} +2 -2
- package/dist/chunks/{index-0u2X3G_x.js → index-C1qXov_Z.js} +29107 -28684
- package/dist/chunks/index-CYQV2kbT.js +1103 -0
- package/dist/chunks/{notification-bell-Cu4JA2Rs.js → notification-bell-CfYK7Cx6.js} +1 -1
- package/dist/chunks/{notification-bell-DpxVIL-E.js → notification-bell-CuEbhFaL.js} +18 -18
- package/dist/chunks/{resource-management-panel-CJXupZdG.js → resource-management-panel-G3XJbfPx.js} +2 -2
- package/dist/chunks/{resource-management-panel-JiF_3jpj.js → resource-management-panel-xwPhr6Lm.js} +1 -1
- package/dist/chunks/{use-visual-utils-yUJHf_h7.js → use-visual-utils-Cdm8jbGc.js} +1 -1
- package/dist/chunks/{use-visual-utils-C8_xz-xH.js → use-visual-utils-Du-m-SYb.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/format-utils/index.cjs +5 -5
- package/dist/format-utils/index.js +171 -305
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/dashboard.d.ts +54 -0
- package/dist/types/format-utils.d.ts +5 -0
- package/dist/types/main.d.ts +50 -4
- package/dist/types/shared.d.ts +49 -0
- package/dist/types/surfboard.d.ts +54 -0
- package/dist/types/types.d.ts +54 -0
- package/package.json +1 -1
- package/dist/chunks/date-formatter-Sz6QDaM8.js +0 -1
- package/dist/chunks/date-formatter-Y8Za1ib3.js +0 -1813
- package/dist/chunks/index-CyHBRhlz.js +0 -1103
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const f=require("react"),t=require("./index-
|
|
1
|
+
"use strict";const f=require("react"),t=require("./index-CYQV2kbT.js"),e=require("react/jsx-runtime"),A=require("./editor-action-buttons-C_zLw3Aj.js"),U=require("./use-visual-utils-Cdm8jbGc.js"),I=require("./date-formatter-CZ8p6ngp.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Z, { useState as D, useRef as M, useCallback as
|
|
2
|
-
import { bK as te, b as O, aw as I, bH as B, bD as q, bE as $, ax as W, bC as ae, e as se, f as re, g as ne, h as oe, i as ie, L as _, cu as le, cA as ce, v as de, B as T, w as j, U as P, J as ue, u as F, K as me, N as Q, cB as he, cC as H, x as R, a9 as pe, c as
|
|
1
|
+
import Z, { useState as D, useRef as M, useCallback as U, useEffect as L, useContext as ee } from "react";
|
|
2
|
+
import { bK as te, b as O, aw as I, bH as B, bD as q, bE as $, ax as W, bC as ae, e as se, f as re, g as ne, h as oe, i as ie, L as _, cu as le, cA as ce, v as de, B as T, w as j, U as P, J as ue, u as F, K as me, N as Q, cB as he, cC as H, x as R, a9 as pe, c as k, c0 as fe, c1 as ge, a3 as ve, c3 as be, c4 as V, s as xe, c8 as we, b$ as ye, M as Ce, cD as Ne, cE as Ae, cF as De, ch as Ee, ci as Se, cj as Le, cG as Te, ck as Ie, cl as ke, cm as Ue, cn as Fe, co as Ve, am as Me, bJ as Pe, X as Re, cH as ze, cI as Oe, cJ as Be, bF as G, a5 as $e, az as je, P as _e, k as He, cK as Ge, l as Xe } from "./index-C1qXov_Z.js";
|
|
3
3
|
import { jsx as t, jsxs as n, Fragment as z } from "react/jsx-runtime";
|
|
4
|
-
import { V as Je, E as Ke, a as qe, b as We, L as Qe, c as Ye, d as Ze, C as et } from "./editor-action-buttons-
|
|
5
|
-
import { a as Y } from "./use-visual-utils-
|
|
6
|
-
import {
|
|
4
|
+
import { V as Je, E as Ke, a as qe, b as We, L as Qe, c as Ye, d as Ze, C as et } from "./editor-action-buttons-lDMI1SQ2.js";
|
|
5
|
+
import { a as Y } from "./use-visual-utils-Du-m-SYb.js";
|
|
6
|
+
import { k as X } from "./date-formatter-BeFtqSQ2.js";
|
|
7
7
|
/**
|
|
8
8
|
* @license lucide-react v0.453.0 - ISC
|
|
9
9
|
*
|
|
@@ -23,7 +23,7 @@ function ot(e) {
|
|
|
23
23
|
function bt() {
|
|
24
24
|
const { authToken: e, tokenProps: a } = O(), m = I((h) => h.activeExports), [c, d] = D(
|
|
25
25
|
typeof document < "u" ? !document.hidden : !0
|
|
26
|
-
), u = M(null), o = M(!1), l = M(void 0), f = a == null ? void 0 : a.apiServiceUrl, i = e == null ? void 0 : e.accessToken, g =
|
|
26
|
+
), u = M(null), o = M(!1), l = M(void 0), f = a == null ? void 0 : a.apiServiceUrl, i = e == null ? void 0 : e.accessToken, g = U(() => {
|
|
27
27
|
const h = I.getState().activeExports;
|
|
28
28
|
return Array.from(h.values()).filter(
|
|
29
29
|
(b) => B(b.status)
|
|
@@ -38,7 +38,7 @@ function bt() {
|
|
|
38
38
|
document.removeEventListener("visibilitychange", h);
|
|
39
39
|
};
|
|
40
40
|
}, []);
|
|
41
|
-
const x =
|
|
41
|
+
const x = U(async () => {
|
|
42
42
|
if (!f || !i) {
|
|
43
43
|
o.current = !1;
|
|
44
44
|
return;
|
|
@@ -386,21 +386,21 @@ function wt({
|
|
|
386
386
|
!x && /* @__PURE__ */ t(
|
|
387
387
|
Ke,
|
|
388
388
|
{
|
|
389
|
-
className:
|
|
389
|
+
className: k(e, "rounded-none border-0"),
|
|
390
390
|
variant: "default"
|
|
391
391
|
}
|
|
392
392
|
),
|
|
393
393
|
x && b && /* @__PURE__ */ t(
|
|
394
394
|
qe,
|
|
395
395
|
{
|
|
396
|
-
className:
|
|
396
|
+
className: k(e, "rounded-none border-0"),
|
|
397
397
|
variant: "default"
|
|
398
398
|
}
|
|
399
399
|
),
|
|
400
400
|
x && h && /* @__PURE__ */ t(
|
|
401
401
|
We,
|
|
402
402
|
{
|
|
403
|
-
className:
|
|
403
|
+
className: k(e, "rounded-none border-0")
|
|
404
404
|
}
|
|
405
405
|
),
|
|
406
406
|
/* @__PURE__ */ n(fe, { modal: !1, children: [
|
|
@@ -409,7 +409,7 @@ function wt({
|
|
|
409
409
|
{
|
|
410
410
|
variant: "default",
|
|
411
411
|
size: "sm",
|
|
412
|
-
className:
|
|
412
|
+
className: k(
|
|
413
413
|
e,
|
|
414
414
|
"w-8 rounded-none border-0 border-l border-primary-foreground/30 px-2"
|
|
415
415
|
),
|
|
@@ -492,11 +492,11 @@ function yt({
|
|
|
492
492
|
switchClassName: a
|
|
493
493
|
}) {
|
|
494
494
|
const m = P((l) => l.isDevMode), c = F((l) => l.isVisualEditing), { setIsDevMode: d } = Ce(), { config: u } = ee(Ne).tokenProps, o = (u == null ? void 0 : u.showAdvancedMode) !== !1;
|
|
495
|
-
return !c || !o ? null : /* @__PURE__ */ n("div", { className:
|
|
495
|
+
return !c || !o ? null : /* @__PURE__ */ n("div", { className: k("flex items-center space-x-2", e), children: [
|
|
496
496
|
/* @__PURE__ */ t(
|
|
497
497
|
Ae,
|
|
498
498
|
{
|
|
499
|
-
className:
|
|
499
|
+
className: k("", a),
|
|
500
500
|
checked: m,
|
|
501
501
|
onCheckedChange: () => d(!m),
|
|
502
502
|
id: "advanced-mode",
|
|
@@ -527,9 +527,9 @@ function Ct({
|
|
|
527
527
|
/* @__PURE__ */ t("div", { className: "flex h-9 w-9 items-center justify-center rounded-full bg-amber-50 ring-1 ring-amber-200/70", children: /* @__PURE__ */ t(Te, { className: "h-[18px] w-[18px] text-amber-600" }) }),
|
|
528
528
|
/* @__PURE__ */ t(Ie, { className: "text-lg font-semibold tracking-tight", children: u })
|
|
529
529
|
] }),
|
|
530
|
-
/* @__PURE__ */ t(
|
|
530
|
+
/* @__PURE__ */ t(ke, { className: "text-sm leading-6 text-muted-foreground", children: o })
|
|
531
531
|
] }),
|
|
532
|
-
/* @__PURE__ */ n(
|
|
532
|
+
/* @__PURE__ */ n(Ue, { className: "mt-2 flex-col gap-1.5 sm:flex-row sm:justify-end", children: [
|
|
533
533
|
/* @__PURE__ */ t(
|
|
534
534
|
Fe,
|
|
535
535
|
{
|
|
@@ -663,7 +663,7 @@ function ut() {
|
|
|
663
663
|
(p, y) => y.startedAt.getTime() - p.startedAt.getTime()
|
|
664
664
|
), x = g.some(
|
|
665
665
|
(p) => p.status === "completed" || p.status === "failed"
|
|
666
|
-
), h =
|
|
666
|
+
), h = U(async () => {
|
|
667
667
|
const p = a == null ? void 0 : a.apiServiceUrl, y = e == null ? void 0 : e.accessToken;
|
|
668
668
|
if (!(!p || !y)) {
|
|
669
669
|
l(!0);
|
|
@@ -708,7 +708,7 @@ function ut() {
|
|
|
708
708
|
e == null ? void 0 : e.accessToken,
|
|
709
709
|
a == null ? void 0 : a.apiServiceUrl,
|
|
710
710
|
u
|
|
711
|
-
]), b =
|
|
711
|
+
]), b = U(async () => {
|
|
712
712
|
const p = a == null ? void 0 : a.apiServiceUrl, y = e == null ? void 0 : e.accessToken;
|
|
713
713
|
if (!p || !y) {
|
|
714
714
|
c();
|
|
@@ -732,7 +732,7 @@ function ut() {
|
|
|
732
732
|
e == null ? void 0 : e.accessToken,
|
|
733
733
|
c,
|
|
734
734
|
d
|
|
735
|
-
]), N =
|
|
735
|
+
]), N = U(
|
|
736
736
|
async (p) => {
|
|
737
737
|
const y = a == null ? void 0 : a.apiServiceUrl, A = e == null ? void 0 : e.accessToken;
|
|
738
738
|
if (y && A)
|
package/dist/chunks/{resource-management-panel-CJXupZdG.js → resource-management-panel-G3XJbfPx.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as r, Fragment as le } from "react/jsx-runtime";
|
|
2
|
-
import { bK as Pe, u as re, U as je, K as ce, bZ as Fe, b_ as ze, c as J, B as P, b$ as ie, c0 as Be, c1 as He, c2 as Ke, c3 as _e, c4 as Z, w as oe, c5 as $e, c6 as qe, c7 as Ge, c8 as ge, c9 as ue, ca as We, cb as Ye, cc as xe, cd as De, ce as we, cf as Ze, af as Ne, ab as ve, cg as ye, ch as Ce, ci as Se, cj as Ee, ck as Ve, cl as Le, cm as Ae, cn as Oe, co as Re, cp as Je, cq as he, cr as Qe, a9 as te, b as Xe, cs as Te, ct as ke, e as et, f as tt, g as rt, h as nt, i as ot, L as be, cu as de, v as st, cv as at, cw as it, cx as dt, bR as lt, bS as ct, bT as ut, bV as ht, cy as mt, cz as pt } from "./index-
|
|
2
|
+
import { bK as Pe, u as re, U as je, K as ce, bZ as Fe, b_ as ze, c as J, B as P, b$ as ie, c0 as Be, c1 as He, c2 as Ke, c3 as _e, c4 as Z, w as oe, c5 as $e, c6 as qe, c7 as Ge, c8 as ge, c9 as ue, ca as We, cb as Ye, cc as xe, cd as De, ce as we, cf as Ze, af as Ne, ab as ve, cg as ye, ch as Ce, ci as Se, cj as Ee, ck as Ve, cl as Le, cm as Ae, cn as Oe, co as Re, cp as Je, cq as he, cr as Qe, a9 as te, b as Xe, cs as Te, ct as ke, e as et, f as tt, g as rt, h as nt, i as ot, L as be, cu as de, v as st, cv as at, cw as it, cx as dt, bR as lt, bS as ct, bT as ut, bV as ht, cy as mt, cz as pt } from "./index-C1qXov_Z.js";
|
|
3
3
|
import ft, { useRef as gt, useEffect as ne, useState as x } from "react";
|
|
4
|
-
import { a as Ue } from "./use-visual-utils-
|
|
4
|
+
import { a as Ue } from "./use-visual-utils-Du-m-SYb.js";
|
|
5
5
|
/**
|
|
6
6
|
* @license lucide-react v0.453.0 - ISC
|
|
7
7
|
*
|
package/dist/chunks/{resource-management-panel-JiF_3jpj.js → resource-management-panel-xwPhr6Lm.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-CYQV2kbT.js"),h=require("react"),re=require("./use-visual-utils-Cdm8jbGc.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const a=require("./index-
|
|
1
|
+
"use strict";const a=require("./index-CYQV2kbT.js"),g=require("react");function H(e){const n=e.toUpperCase().indexOf("WHERE"),t=e.toUpperCase().indexOf("GROUP BY"),r=e.toUpperCase().indexOf("LIMIT"),s=e.toUpperCase().indexOf("ORDER BY");let c=e.length;if(s!==-1&&(c=s),r!==-1&&r<c&&(c=r),n!==-1){const d=e.substring(0,n),o=e.substring(n);return`${d} {{ filters | where }} AND ${o.substring(6)}`}else if(t!==-1){const d=e.substring(0,t),o=e.substring(t);return`${d} {{ filters | where }} ${o}`}else{const d=e.substring(0,c),o=e.substring(c);return console.log("beforeClause",d),console.log("afterClause",o),o?`${d} {{ filters | where }} ${o}`:`${d.replace(/;$/,"")} {{ filters | where }}`}}function k(e){const[n,t]=g.useState(null),[r,s]=g.useState(null),c=a.useEnsureReactGlobals();return g.useEffect(()=>{if(!e||e.trim()===""){t(null),s(null);return}if(!c)return;(async()=>{try{if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new Error(`Invalid URL format: ${e}`);try{new URL(e)}catch{throw new Error(`Invalid URL: ${e}`)}const l=`${e.endsWith("/")?e:`${e}/`}index.js`;try{if(!(await fetch(l,{method:"HEAD"})).ok)throw new Error(`Module not found at ${l}`)}catch{}const h=await import(l);if(typeof h.useChartStore!="function")throw new Error("useChartStore is not a function");t(()=>h.useChartStore),s(null)}catch(o){const l=o instanceof Error?o.message:"Unknown error";console.error("Failed to load remote chart store:",l),s(l),t(null)}})()},[e,c]),n}function Q(e,n){if(e.length===0)return"";const t=e.find(r=>{var s,c;return((s=r.customCardPreferences)==null?void 0:s.visualType)==="multiple"||!!((c=r.customCardPreferences)!=null&&c.dataInputCardIds)});if(t)return t.id;if(n){const r=e.find(s=>s.id===n);if(r){const s=r.tabTitle;if(s=="All__Header")return e[0].id;if(s&&s.endsWith("__Header")){const d=s.split("__")[0],o=e.find(l=>l.tabTitle===d);return o?o.id:e[0].id}return n}}return e[0].id}const z=e=>{if(!e||!("detailTableBackup"in e))return e;const{detailTableBackup:n,...t}=e;return t};async function W(e,n,t,r){if(!n||!t)throw new Error("Missing auth token or visual ID");const s=["resource-by-id","visual",t],c=r.getQueryData(s);if(c)return console.log("Using cached visual data for:",t),{data:c,fromCache:!0};console.log("Fetching visual data from network for:",t);const d=a.ue.loading("Loading visual...",{position:"top-center"});try{const o=await fetch(`${e}/management/v1/visuals/${t}`,{headers:{Authorization:`Bearer ${n}`}});if(!o.ok)throw new Error("Failed to load visual");const l=await o.json();return r.setQueryData(s,l),a.ue.dismiss(d),{data:l,fromCache:!1}}catch(o){throw a.ue.dismiss(d),o}}function L(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function G(e,n){var c,d;const t=(e==null?void 0:e.frameObject)??((c=e==null?void 0:e.visual)==null?void 0:c.frameObject);if(!t)return!1;const r=L(t);if(!(r!=null&&r.cards)||r.cards.length===0)return!1;const s=(d=r.cards)==null?void 0:d.find(o=>o.id===r.activeCardId);return s?(a.setupEditorWithCard({...n,frame:r,card:s,visualId:(e==null?void 0:e.id)||r.visualId}),!0):!1}function Y(){var C;const{setCardSql:e}=a.useEditorActions(),n=a.useEditorStore(i=>i.frame),t=a.useEditorStore(i=>i.card),r=a.useEditorStore(i=>i.isDevMode),s=k(((C=t.customCardPreferences)==null?void 0:C.url)||""),c=a.useEditorStore(i=>i.selectedSchemaName),d=a.useEditorStore(i=>i.selectedDatamodelId),o=a.useEditorStore(i=>i.selectedDatabaseName),l=a.useEditorStore(i=>i.selectedTableName),h=a.useEditorStore(i=>i.selectedConnectionId),m=a.useEditorStore(i=>i.isShowingVisual),p=t.sql;return{getUpdatedFrame:g.useCallback(()=>{var I;let i=p;p&&!p.includes("{{")&&(i=H(p),e(i));const E=(I=s==null?void 0:s.getState())==null?void 0:I.settings,v={...t,dataSource:t.dataSource||{mode:"directSource"},lastSelectedSchema:c,lastSelectedDatamodelId:d,lastSelectedDatabase:o,lastSelectedTable:l,connectionId:h,sql:r?i:void 0,python:r?t.python:void 0,config:r?void 0:z(t.config),customCfg:m?t.customCfg:null,preferences:t.preferences,...E&&{customCardPreferences:{...t.customCardPreferences,settings:E}}},w=n.cards.map(S=>S.id===t.id?v:S);return{...n,cards:w,activeCardId:Q(w,n.activeCardId)}},[t,n,r,m,c,d,o,l,h,e,s,p])}}function J(){const{authToken:e,tokenProps:n}=a.useSemaphorContext(),t=a.useQueryClient(),r=a.useSelectedVisual(),{selectVisual:s}=a.useManagementActions(),{setFrame:c,setCard:d,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:p,setSelectedConnectionId:D,setSelectedDatabaseName:C,setSelectedSchemaName:i,setSelectedTableName:E,setSelectedDatamodelId:v,setFilterValues:w,setApplyFilters:I}=a.useEditorActions(),{setIsDashboardEditing:S,setIsVisualEditing:V,setSelectedFrameId:$,clearSelectedFrameId:A,addFrame:R,setIsDashboardPanelOpen:N}=a.useDashboardActions(),y=a.useDashboardStore(u=>u.selectedSheetId),O=a.useDashboardStore(u=>u.selectedFrameId),T=a.useDashboardStore(u=>u.dashboard),x=a.useDashboardStore(u=>u.filterValues),F=a.useVisualById((r==null?void 0:r.id)||"",{enabled:!!(r!=null&&r.id)&&!!(e!=null&&e.accessToken)}),j=g.useCallback(async u=>{try{s(u),A();const{data:b,fromCache:f}=await W(n.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t);if(!G(b,{setFrame:c,setCard:d,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:p,setSelectedConnectionId:D,setSelectedDatabaseName:C,setSelectedSchemaName:i,setSelectedTableName:E,setSelectedDatamodelId:v,setFilterValues:w,setApplyFilters:I,setIsDashboardEditing:S,setIsVisualEditing:V,dashboard:T,selectedSheetId:y,selectedFrameId:O,filterValues:x}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:f}}catch(b){return console.error("Error editing visual:",b),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,n.apiServiceUrl,t,s,c,d,S,V,o,l,h,m,p,D,C,i,E,v,w,I,A,T,y,O,x]),_=g.useCallback(async u=>{var b;try{if(s(u),!y)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:f,fromCache:B}=await W(n.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t),M=(f==null?void 0:f.frameObject)??((b=f==null?void 0:f.visual)==null?void 0:b.frameObject);if(!M)return{success:!1,error:"Visual has no frame data"};const U=L(M);if(!(U!=null&&U.cards)||U.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...a.cloneLinkedFrameWithSourceMapping(U),visualId:u.id};return R(y,P,"end"),S(!0),$(P.id),N(!1),{success:!0,fromCache:B}}catch(f){return console.error("Error adding visual:",f),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,n.apiServiceUrl,t,s,y,R,S,$,N]);return{visual:F.data,isLoading:F.isLoading,isError:F.isError,error:F.error,handleEditLibraryVisual:j,handleAddLibraryVisual:_,getUpdatedFrame:Y().getUpdatedFrame,refetch:F.refetch}}exports.useRemoteChartStore=k;exports.useVisualUtils=J;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as z, b as J, H as K, J as Y, K as X, M as H, N as Z, u as v, O as q, Q as ee, x as V, T as te, U as f } from "./index-
|
|
1
|
+
import { G as z, b as J, H as K, J as Y, K as X, M as H, N as Z, u as v, O as q, Q as ee, x as V, T as te, U as f } from "./index-C1qXov_Z.js";
|
|
2
2
|
import { useState as j, useEffect as re, useCallback as D } from "react";
|
|
3
3
|
function se(e) {
|
|
4
4
|
const a = e.toUpperCase().indexOf("WHERE"), t = e.toUpperCase().indexOf("GROUP BY"), r = e.toUpperCase().indexOf("LIMIT"), s = e.toUpperCase().indexOf("ORDER BY");
|
package/dist/dashboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-CYQV2kbT.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
|
package/dist/dashboard/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`)||
|
|
3
|
-
`}=e;return r.map(
|
|
4
|
-
`,includeHeaders:
|
|
5
|
-
`){return
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../chunks/date-formatter-CZ8p6ngp.js");function H(r,e,n,t){const s=r instanceof Date?r.toISOString():String(r),u=(t==null?void 0:t.browserTimezone)||n,o=(t==null?void 0:t.isSqlCard)??!1;if(e!=null&&e.useRelativeTime)return l.formatRelativeTime(s,(e==null?void 0:e.sourceTimezone)||"auto");const i=e!=null&&e.useCustomFormat&&(e!=null&&e.customFormat)?e.customFormat:(e==null?void 0:e.format)||"MM/dd/yyyy";return l.formatDate(s,i,e!=null&&e.timezone&&(e==null?void 0:e.timezone)!=="auto"?e.timezone:o?u:n,(e==null?void 0:e.sourceTimezone)||"auto")}function h(r,e,n){if(r==null)return"";if(!n.useFormattedValues||!e)return String(r);switch(e.type){case"number":return typeof r=="number"?l.formatNumberWithColumnSettings(r,e.numberFormat,n.locale):String(r);case"date":return H(r,e.dateFormat,n.timezone,{browserTimezone:n.browserTimezone,isSqlCard:n.isSqlCard});case"progress":return typeof r=="number"?`${r}%`:String(r);case"badge":case"link":case"text":case"none":default:return String(r)}}function T(r,e){return e.visibleColumns.map(n=>{const t=r[n],s=e.columnSettings[n];return h(t,s,{useFormattedValues:e.useFormattedValues,timezone:e.timezone,locale:e.locale})})}function m(r,e=","){if(r==null)return"";const n=String(r);return n.includes(e)||n.includes('"')||n.includes(`
|
|
2
|
+
`)||n.includes("\r")?`"${n.replace(/"/g,'""')}"`:n}function f(r,e=","){return r.map(n=>m(n,e)).join(e)}function d(r,e={}){const{delimiter:n=",",lineEnding:t=`
|
|
3
|
+
`}=e;return r.map(s=>f(s,n)).join(t)}function N(r,e={}){if(r.length===0)return"";const{delimiter:n=",",lineEnding:t=`
|
|
4
|
+
`,includeHeaders:s=!0,columns:u}=e,o=u||Object.keys(r[0]),i=[];s&&i.push(o);for(const c of r){const p=o.map(b=>{const a=c[b];return a==null?"":String(a)});i.push(p)}return d(i,{delimiter:n,lineEnding:t})}function y(r,e){const n=[];e.includeHeaders&&n.push(f(e.visibleColumns,e.delimiter));for(const t of r){const s=T(t,e);n.push(s.map(u=>m(u,e.delimiter)).join(e.delimiter))}return n}function v(r,e,n=`
|
|
5
|
+
`){return y(r,e).join(n)}function j(r,e,n){return r==null?"":n.useFormattedValues?typeof r=="number"&&(e==null?void 0:e.type)==="number"?l.formatNumberWithColumnSettings(r,e.numberFormat,n.locale):typeof r=="number"?r.toLocaleString(n.locale):String(r):String(r)}function V(r,e,n){var s,u;const t=[];if(r.isSubtotal&&!r.isGrandTotal){const o=e.groupByColumns.findIndex(i=>i.alias===r.subtotalLevel);e.groupByColumns.forEach((i,c)=>{var p,b,a,S;if(c===o){const A=(b=(p=e.rowAggregates)==null?void 0:p.find(E=>E.groupLevel===r.subtotalLevel))==null?void 0:b.label,L=(S=(a=r.subtotalContext)==null?void 0:a.groupByValues)==null?void 0:S[i.alias];t.push(A??`Subtotal (${L??"Total"})`)}else c<o?t.push(String(r[i.alias]??"")):t.push("")})}else if(r.isGrandTotal){const o=(u=(s=e.rowAggregates)==null?void 0:s.find(i=>i.groupLevel==="ALL"))==null?void 0:u.label;t.push(o||"Grand Total"),e.groupByColumns.slice(1).forEach(()=>t.push(""))}else e.groupByColumns.forEach(o=>{t.push(String(r[o.alias]??""))});return e.pivotSchema.filter(o=>o.isMetricColumn).forEach(o=>{const i=r[o.alias],c=n.columnSettings[o.alias];t.push(j(i,c,n))}),t}function C(r){const e=r.groupByColumns.map(t=>t.label||t.name),n=r.pivotSchema.filter(t=>t.isMetricColumn).map(t=>t.displayLabel||t.metricLabel||t.metricName||t.alias);return[...e,...n]}function P(r,e,n){const t=[];if(n.includeHeaders){const s=C(e);t.push(f(s,n.delimiter))}for(const s of r){const u=V(s,e,n);t.push(u.map(o=>m(o,n.delimiter)).join(n.delimiter))}return t}function w(r,e,n){for(const t of r){if(t.level<n){e[t.level].push(t.name);for(let s=1;s<t.colspan;s++)e[t.level].push("")}t.children?w(t.children,e,n):t.columnKey&&e[n].push(t.name)}}function z(r){const e=r.pivotByColumns.length,n=r.groupByColumns.length,t=Array.from({length:e+1},()=>[]);for(let s=0;s<e;s++)t[s].push(...Array(n).fill(""));if(t[e].push(...r.groupByColumns.map(s=>s.label||s.name)),w(r.columnHeadersTree,t,e),r.showRowTotals){for(let s=0;s<e;s++)t[s].push("");t[e].push("Total")}return t}function B(r,e,n){if(r==null)return"";if(!n.useFormattedValues)return String(r);const t=n.columnSettings[e];return typeof r=="number"&&(t==null?void 0:t.type)==="number"?l.formatNumberWithColumnSettings(r,t.numberFormat,n.locale):typeof r=="number"?r.toLocaleString(n.locale):String(r)}function R(r,e,n){const t=[];r.fieldValues.forEach((u,o)=>{r.isSubtotal&&o===0?t.push(`${u} Total`):r.isSubtotal?t.push(""):t.push(String(u??""))});let s=0;return e.columnHeaders.forEach(u=>{var c;const o=(c=r.cells[u])==null?void 0:c.value,i=B(o,u,n);t.push(i),e.showRowTotals&&typeof o=="number"&&(s+=o)}),e.showRowTotals&&t.push(s.toLocaleString(n.locale)),t}function D(r,e,n){const t=[];if(n.includeHeaders){const s=z(e);for(const u of s)t.push(f(u,n.delimiter))}for(const s of r){const u=R(s,e,n);t.push(u.map(o=>m(o,n.delimiter)).join(n.delimiter))}return t}exports.formatCurrency=l.formatCurrency;exports.formatDate=l.formatDate;exports.formatNumber=l.formatNumber;exports.formatNumberCustom=l.formatNumberCustom;exports.formatNumberWithColumnSettings=l.formatNumberWithColumnSettings;exports.formatPercent=l.formatPercent;exports.formatRelativeTime=l.formatRelativeTime;exports.formatScientific=l.formatScientific;exports.getTimezoneAbbreviation=l.getTimezoneAbbreviation;exports.getTimezoneName=l.getTimezoneName;exports.parseWithSourceTimezone=l.parseWithSourceTimezone;exports.resolveTimezone=l.resolveTimezone;exports.arrayToCSV=d;exports.arrayToCSVRow=f;exports.escapeCSVValue=m;exports.formatAggregateRow=V;exports.formatAggregateTableForCSV=P;exports.formatCellValue=h;exports.formatPivotDataRow=R;exports.formatPivotTableForCSV=D;exports.formatRowForExport=T;exports.formatTableForCSV=y;exports.generateAggregateHeaders=C;exports.generatePivotHeaders=z;exports.generateTableCSV=v;exports.objectsToCSV=N;
|