react-semaphor 0.1.179 → 0.1.180
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-CeT5saB7.js → dashboard-controls-Baw7eUyM.js} +3 -3
- package/dist/chunks/{dashboard-controls-O2Vl2SaH.js → dashboard-controls-CS3pAVZi.js} +339 -337
- package/dist/chunks/{dashboard-json--jGkpREU.js → dashboard-json-ClalWYi4.js} +1 -1
- package/dist/chunks/{dashboard-json-d1qZ8OYo.js → dashboard-json-Cz4bNnCC.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-ViDNkE8Q.js → edit-dashboard-visual-BMElXt-n.js} +30 -35
- package/dist/chunks/{edit-dashboard-visual-BsP87bZV.js → edit-dashboard-visual-DFJ5FJ7y.js} +11 -22
- package/dist/chunks/editor-action-buttons-DVWnnC_r.js +11 -0
- package/dist/chunks/{editor-action-buttons-F4_UU-Mk.js → editor-action-buttons-MtNYw1Bb.js} +57 -45
- package/dist/chunks/{index-v6ayK5K2.js → index-CAeKp6K8.js} +22589 -22037
- package/dist/chunks/{index-CFWw2cJ5.js → index-CfPKTeUk.js} +232 -227
- package/dist/chunks/notification-bell-2dZI5OV0.js +21 -0
- package/dist/chunks/notification-bell-YZ8VqdwA.js +870 -0
- package/dist/chunks/{resource-management-panel-Cn1aOr6L.js → resource-management-panel-Buhi-kvP.js} +1 -1
- package/dist/chunks/{resource-management-panel-CApVr9Vd.js → resource-management-panel-pxL28GXq.js} +133 -133
- package/dist/chunks/{use-role-aware-display-preferences-C-N0-Iik.js → use-role-aware-display-preferences-B_i2f9tn.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-Bxp6i8c7.js → use-role-aware-display-preferences-JljRcjrP.js} +1 -1
- package/dist/chunks/{use-visual-utils-D9lMGeVv.js → use-visual-utils-D3HjbsKO.js} +38 -38
- package/dist/chunks/{use-visual-utils-D19qzwzI.js → use-visual-utils-DPEHcmFT.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -6
- package/dist/index.js +133 -126
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/main.d.ts +262 -0
- package/package.json +1 -1
- package/dist/chunks/editor-action-buttons-DseT424l.js +0 -6
- package/dist/chunks/schedule-dashboard-B4KUKLfW.js +0 -416
- package/dist/chunks/schedule-dashboard-vvFw8B1E.js +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as m, e as t, g as D, f as U, h as b, i as u, j as E, k as g } from "./index-
|
|
1
|
+
import { b as m, e as t, g as D, f as U, h as b, i as u, j as E, k as g } from "./index-CAeKp6K8.js";
|
|
2
2
|
import { useMemo as i } from "react";
|
|
3
3
|
function S() {
|
|
4
4
|
const { displayPreferences: n, shouldShowElement: c } = m(), { currentUser: a, userContext: s } = t(), r = i(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const a=require("./index-
|
|
1
|
+
"use strict";const a=require("./index-CfPKTeUk.js"),n=require("react");function f(){const{displayPreferences:c,shouldShowElement:o}=a.useDisplayPreferences(),{currentUser:e,userContext:s}=a.useCurrentUserInfo(),i=n.useMemo(()=>a.getRoleBasedDisplayOverrides(e),[e]),t=n.useMemo(()=>r=>i&&i[r]!==void 0&&i[r]===!1?!1:o(r),[i,o,c]),p=n.useMemo(()=>{var r,d,l,u,h;return{canEdit:((r=s==null?void 0:s.permissions)==null?void 0:r.canEdit)??a.canUserEdit(e),canUseFilters:((d=s==null?void 0:s.permissions)==null?void 0:d.canEdit)??a.canUserUseFilters(e),canManageDashboards:((l=s==null?void 0:s.permissions)==null?void 0:l.canCreateDashboard)??a.canUserManageDashboards(e),canCreateDashboards:((u=s==null?void 0:s.permissions)==null?void 0:u.canCreateDashboard)??a.canUserCreateDashboards(e),canAccessVisuals:((h=s==null?void 0:s.permissions)==null?void 0:h.canEdit)??a.canUserAccessVisuals(e)}},[e,s]);return{displayPreferences:c,shouldShowElement:t,permissions:p,currentUser:e}}exports.useRoleAwareDisplayPreferences=f;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState as T, useEffect as re, useCallback as
|
|
1
|
+
import { aM as G, aN as Y, aH as J, aI as K, aO as X, av as Q, as as Z, u as v, aP as q, aQ as ee, aL as V, aR as te, au as f } from "./index-CAeKp6K8.js";
|
|
2
|
+
import { useState as T, useEffect as re, useCallback as N } from "react";
|
|
3
3
|
function se(e) {
|
|
4
4
|
const o = e.toUpperCase().indexOf("WHERE"), t = e.toUpperCase().indexOf("GROUP BY"), r = e.toUpperCase().indexOf("LIMIT"), n = e.toUpperCase().indexOf("ORDER BY");
|
|
5
5
|
let i = e.length;
|
|
@@ -75,7 +75,7 @@ function ae(e, o) {
|
|
|
75
75
|
}
|
|
76
76
|
return e[0].id;
|
|
77
77
|
}
|
|
78
|
-
async function
|
|
78
|
+
async function H(e, o, t, r) {
|
|
79
79
|
if (!o || !t)
|
|
80
80
|
throw new Error("Missing auth token or visual ID");
|
|
81
81
|
const n = ["resource-by-id", "visual", t], i = r.getQueryData(n);
|
|
@@ -102,7 +102,7 @@ async function _(e, o, t, r) {
|
|
|
102
102
|
throw V.dismiss(c), s;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function _(e) {
|
|
106
106
|
if (typeof e == "string")
|
|
107
107
|
return JSON.parse(e);
|
|
108
108
|
if (typeof e == "object")
|
|
@@ -114,7 +114,7 @@ function ne(e, o) {
|
|
|
114
114
|
const t = (e == null ? void 0 : e.frameObject) ?? ((i = e == null ? void 0 : e.visual) == null ? void 0 : i.frameObject);
|
|
115
115
|
if (!t)
|
|
116
116
|
return !1;
|
|
117
|
-
const r =
|
|
117
|
+
const r = _(t);
|
|
118
118
|
if (!(r != null && r.cards) || r.cards.length === 0)
|
|
119
119
|
return !1;
|
|
120
120
|
const n = (c = r.cards) == null ? void 0 : c.find(
|
|
@@ -129,7 +129,7 @@ function ne(e, o) {
|
|
|
129
129
|
}
|
|
130
130
|
function ce() {
|
|
131
131
|
var S;
|
|
132
|
-
const { setCardSql: e } =
|
|
132
|
+
const { setCardSql: e } = Q(), o = f((a) => a.frame), t = f((a) => a.card), r = f((a) => a.isDevMode), n = oe(
|
|
133
133
|
((S = t.customCardPreferences) == null ? void 0 : S.url) || ""
|
|
134
134
|
), i = f(
|
|
135
135
|
(a) => a.selectedSchemaName
|
|
@@ -140,7 +140,7 @@ function ce() {
|
|
|
140
140
|
), d = f((a) => a.selectedTableName), m = f(
|
|
141
141
|
(a) => a.selectedConnectionId
|
|
142
142
|
), h = f((a) => a.isShowingVisual), p = t.sql;
|
|
143
|
-
return { getUpdatedFrame:
|
|
143
|
+
return { getUpdatedFrame: N(() => {
|
|
144
144
|
var I;
|
|
145
145
|
let a = p;
|
|
146
146
|
p && !p.includes("{{") && (a = se(p), e(a));
|
|
@@ -205,20 +205,20 @@ function le() {
|
|
|
205
205
|
setSelectedDatamodelId: U,
|
|
206
206
|
setFilterValues: C,
|
|
207
207
|
setApplyFilters: I
|
|
208
|
-
} =
|
|
208
|
+
} = Q(), {
|
|
209
209
|
setIsDashboardEditing: g,
|
|
210
|
-
setIsVisualEditing:
|
|
211
|
-
setSelectedFrameId:
|
|
212
|
-
clearSelectedFrameId:
|
|
213
|
-
addFrame:
|
|
214
|
-
setIsDashboardPanelOpen:
|
|
215
|
-
} = Z(), y = v((l) => l.selectedSheetId),
|
|
210
|
+
setIsVisualEditing: O,
|
|
211
|
+
setSelectedFrameId: A,
|
|
212
|
+
clearSelectedFrameId: D,
|
|
213
|
+
addFrame: R,
|
|
214
|
+
setIsDashboardPanelOpen: x
|
|
215
|
+
} = Z(), y = v((l) => l.selectedSheetId), M = v((l) => l.selectedFrameId), W = v((l) => l.dashboard), L = v((l) => l.filterValues), E = q((r == null ? void 0 : r.id) || "", {
|
|
216
216
|
enabled: !!(r != null && r.id) && !!(e != null && e.accessToken)
|
|
217
|
-
}),
|
|
217
|
+
}), k = N(
|
|
218
218
|
async (l) => {
|
|
219
219
|
try {
|
|
220
|
-
n(l),
|
|
221
|
-
const { data: b, fromCache: u } = await
|
|
220
|
+
n(l), D();
|
|
221
|
+
const { data: b, fromCache: u } = await H(
|
|
222
222
|
o.apiServiceUrl,
|
|
223
223
|
(e == null ? void 0 : e.accessToken) || "",
|
|
224
224
|
l.id,
|
|
@@ -240,11 +240,11 @@ function le() {
|
|
|
240
240
|
setFilterValues: C,
|
|
241
241
|
setApplyFilters: I,
|
|
242
242
|
setIsDashboardEditing: g,
|
|
243
|
-
setIsVisualEditing:
|
|
244
|
-
dashboard:
|
|
243
|
+
setIsVisualEditing: O,
|
|
244
|
+
dashboard: W,
|
|
245
245
|
selectedSheetId: y,
|
|
246
|
-
selectedFrameId:
|
|
247
|
-
filterValues:
|
|
246
|
+
selectedFrameId: M,
|
|
247
|
+
filterValues: L
|
|
248
248
|
}))
|
|
249
249
|
throw new Error("Failed to setup editor with visual data");
|
|
250
250
|
return { success: !0, fromCache: u };
|
|
@@ -260,7 +260,7 @@ function le() {
|
|
|
260
260
|
i,
|
|
261
261
|
c,
|
|
262
262
|
g,
|
|
263
|
-
|
|
263
|
+
O,
|
|
264
264
|
s,
|
|
265
265
|
d,
|
|
266
266
|
m,
|
|
@@ -273,13 +273,13 @@ function le() {
|
|
|
273
273
|
U,
|
|
274
274
|
C,
|
|
275
275
|
I,
|
|
276
|
-
|
|
277
|
-
M,
|
|
278
|
-
y,
|
|
276
|
+
D,
|
|
279
277
|
W,
|
|
280
|
-
|
|
278
|
+
y,
|
|
279
|
+
M,
|
|
280
|
+
L
|
|
281
281
|
]
|
|
282
|
-
),
|
|
282
|
+
), z = N(
|
|
283
283
|
async (l) => {
|
|
284
284
|
var b;
|
|
285
285
|
try {
|
|
@@ -288,23 +288,23 @@ function le() {
|
|
|
288
288
|
success: !1,
|
|
289
289
|
error: "No sheet selected. Please select a sheet first."
|
|
290
290
|
};
|
|
291
|
-
const { data: u, fromCache:
|
|
291
|
+
const { data: u, fromCache: P } = await H(
|
|
292
292
|
o.apiServiceUrl,
|
|
293
293
|
(e == null ? void 0 : e.accessToken) || "",
|
|
294
294
|
l.id,
|
|
295
295
|
t
|
|
296
|
-
),
|
|
297
|
-
if (!
|
|
296
|
+
), j = (u == null ? void 0 : u.frameObject) ?? ((b = u == null ? void 0 : u.visual) == null ? void 0 : b.frameObject);
|
|
297
|
+
if (!j)
|
|
298
298
|
return { success: !1, error: "Visual has no frame data" };
|
|
299
|
-
const F =
|
|
299
|
+
const F = _(j);
|
|
300
300
|
if (!(F != null && F.cards) || F.cards.length === 0)
|
|
301
301
|
return { success: !1, error: "Visual frame is malformed" };
|
|
302
|
-
const
|
|
302
|
+
const B = {
|
|
303
303
|
...ee(F),
|
|
304
304
|
visualId: l.id
|
|
305
305
|
// Link this frame to the library visual
|
|
306
306
|
};
|
|
307
|
-
return
|
|
307
|
+
return R(y, B, "end"), g(!0), A(B.id), x(!1), { success: !0, fromCache: P };
|
|
308
308
|
} catch (u) {
|
|
309
309
|
return console.error("Error adding visual:", u), { success: !1, error: "Failed to add visual to dashboard" };
|
|
310
310
|
}
|
|
@@ -315,10 +315,10 @@ function le() {
|
|
|
315
315
|
t,
|
|
316
316
|
n,
|
|
317
317
|
y,
|
|
318
|
-
|
|
318
|
+
R,
|
|
319
319
|
g,
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
A,
|
|
321
|
+
x
|
|
322
322
|
]
|
|
323
323
|
);
|
|
324
324
|
return {
|
|
@@ -326,8 +326,8 @@ function le() {
|
|
|
326
326
|
isLoading: E.isLoading,
|
|
327
327
|
isError: E.isError,
|
|
328
328
|
error: E.error,
|
|
329
|
-
handleEditLibraryVisual:
|
|
330
|
-
handleAddLibraryVisual:
|
|
329
|
+
handleEditLibraryVisual: k,
|
|
330
|
+
handleAddLibraryVisual: z,
|
|
331
331
|
getUpdatedFrame: ce().getUpdatedFrame,
|
|
332
332
|
refetch: E.refetch
|
|
333
333
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("./index-
|
|
1
|
+
"use strict";const s=require("./index-CfPKTeUk.js"),g=require("react");function H(e){const a=e.toUpperCase().indexOf("WHERE"),t=e.toUpperCase().indexOf("GROUP BY"),r=e.toUpperCase().indexOf("LIMIT"),c=e.toUpperCase().indexOf("ORDER BY");let d=e.length;if(c!==-1&&(d=c),r!==-1&&r<d&&(d=r),a!==-1){const i=e.substring(0,a),o=e.substring(a);return`${i} {{ filters | where }} AND ${o.substring(6)}`}else if(t!==-1){const i=e.substring(0,t),o=e.substring(t);return`${i} {{ filters | where }} ${o}`}else{const i=e.substring(0,d),o=e.substring(d);return console.log("beforeClause",i),console.log("afterClause",o),o?`${i} {{ filters | where }} ${o}`:`${i.replace(/;$/,"")} {{ filters | where }}`}}function B(e){const[a,t]=g.useState(null),[r,c]=g.useState(null),d=s.useEnsureReactGlobals();return g.useEffect(()=>{if(!e||e.trim()===""){t(null),c(null);return}if(!d)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),c(null)}catch(o){const l=o instanceof Error?o.message:"Unknown error";console.error("Failed to load remote chart store:",l),c(l),t(null)}})()},[e,d]),a}function Q(e,a){if(e.length===0)return"";if(a){const t=e.find(r=>r.id===a);if(t){const r=t.tabTitle;if(r=="All__Header")return e[0].id;if(r&&r.endsWith("__Header")){const d=r.split("__")[0],i=e.find(o=>o.tabTitle===d);return i?i.id:e[0].id}return a}}return e[0].id}async function j(e,a,t,r){if(!a||!t)throw new Error("Missing auth token or visual ID");const c=["resource-by-id","visual",t],d=r.getQueryData(c);if(d)return console.log("Using cached visual data for:",t),{data:d,fromCache:!0};console.log("Fetching visual data from network for:",t);const i=s.ue.loading("Loading visual...",{position:"top-center"});try{const o=await fetch(`${e}/management/v1/visuals/${t}`,{headers:{Authorization:`Bearer ${a}`}});if(!o.ok)throw new Error("Failed to load visual");const l=await o.json();return r.setQueryData(c,l),s.ue.dismiss(i),{data:l,fromCache:!1}}catch(o){throw s.ue.dismiss(i),o}}function T(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function z(e,a){var d,i;const t=(e==null?void 0:e.frameObject)??((d=e==null?void 0:e.visual)==null?void 0:d.frameObject);if(!t)return!1;const r=T(t);if(!(r!=null&&r.cards)||r.cards.length===0)return!1;const c=(i=r.cards)==null?void 0:i.find(o=>o.id===r.activeCardId);return c?(s.setupEditorWithCard({...a,frame:r,card:c,visualId:(e==null?void 0:e.id)||r.visualId}),!0):!1}function G(){var C;const{setCardSql:e}=s.useEditorActions(),a=s.useEditorStore(n=>n.frame),t=s.useEditorStore(n=>n.card),r=s.useEditorStore(n=>n.isDevMode),c=B(((C=t.customCardPreferences)==null?void 0:C.url)||""),d=s.useEditorStore(n=>n.selectedSchemaName),i=s.useEditorStore(n=>n.selectedDatamodelId),o=s.useEditorStore(n=>n.selectedDatabaseName),l=s.useEditorStore(n=>n.selectedTableName),h=s.useEditorStore(n=>n.selectedConnectionId),m=s.useEditorStore(n=>n.isShowingVisual),S=t.sql;return{getUpdatedFrame:g.useCallback(()=>{var I;let n=S;S&&!S.includes("{{")&&(n=H(S),e(n));const w=(I=c==null?void 0:c.getState())==null?void 0:I.settings,v={...t,dataSource:t.dataSource||{mode:"directSource"},lastSelectedSchema:d,lastSelectedDatamodelId:i,lastSelectedDatabase:o,lastSelectedTable:l,connectionId:h,sql:r?n:void 0,python:r?t.python:void 0,config:r?void 0:t.config,customCfg:m?t.customCfg:null,preferences:t.preferences,...w&&{customCardPreferences:{...t.customCardPreferences,settings:w}}},E=a.cards.map(p=>p.id===t.id?v:p);return{...a,cards:E,activeCardId:Q(E,a.activeCardId)}},[t,a,r,m,d,i,o,l,h,e,c,S])}}function Y(){const{authToken:e,tokenProps:a}=s.useSemaphorContext(),t=s.useQueryClient(),r=s.useSelectedVisual(),{selectVisual:c}=s.useManagementActions(),{setFrame:d,setCard:i,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:S,setSelectedConnectionId:V,setSelectedDatabaseName:C,setSelectedSchemaName:n,setSelectedTableName:w,setSelectedDatamodelId:v,setFilterValues:E,setApplyFilters:I}=s.useEditorActions(),{setIsDashboardEditing:p,setIsVisualEditing:$,setSelectedFrameId:D,clearSelectedFrameId:A,addFrame:N,setIsDashboardPanelOpen:R}=s.useDashboardActions(),y=s.useDashboardStore(u=>u.selectedSheetId),O=s.useDashboardStore(u=>u.selectedFrameId),x=s.useDashboardStore(u=>u.dashboard),W=s.useDashboardStore(u=>u.filterValues),F=s.useVisualById((r==null?void 0:r.id)||"",{enabled:!!(r!=null&&r.id)&&!!(e!=null&&e.accessToken)}),k=g.useCallback(async u=>{try{c(u),A();const{data:b,fromCache:f}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t);if(!z(b,{setFrame:d,setCard:i,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:S,setSelectedConnectionId:V,setSelectedDatabaseName:C,setSelectedSchemaName:n,setSelectedTableName:w,setSelectedDatamodelId:v,setFilterValues:E,setApplyFilters:I,setIsDashboardEditing:p,setIsVisualEditing:$,dashboard:x,selectedSheetId:y,selectedFrameId:O,filterValues:W}))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,a.apiServiceUrl,t,c,d,i,p,$,o,l,h,m,S,V,C,n,w,v,E,I,A,x,y,O,W]),_=g.useCallback(async u=>{var b;try{if(c(u),!y)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:f,fromCache:M}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t),L=(f==null?void 0:f.frameObject)??((b=f==null?void 0:f.visual)==null?void 0:b.frameObject);if(!L)return{success:!1,error:"Visual has no frame data"};const U=T(L);if(!(U!=null&&U.cards)||U.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...s.cloneFrameWithNewIds(U),visualId:u.id};return N(y,P,"end"),p(!0),D(P.id),R(!1),{success:!0,fromCache:M}}catch(f){return console.error("Error adding visual:",f),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,t,c,y,N,p,D,R]);return{visual:F.data,isLoading:F.isLoading,isError:F.isError,error:F.error,handleEditLibraryVisual:k,handleAddLibraryVisual:_,getUpdatedFrame:G().getUpdatedFrame,refetch:F.refetch}}exports.useRemoteChartStore=B;exports.useVisualUtils=Y;
|
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-CfPKTeUk.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
|
package/dist/dashboard/index.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-
|
|
2
|
-
* @license lucide-react v0.453.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const M=e.createLucideIcon("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);function _(r){const{displayPreferences:o,...s}=r,i={...s,id:r.dashboardId};return a.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:a.jsxs(e.SemaphorContextProvider,{dashboardProps:i,children:[a.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:r.cardId}),a.jsx(e.UXProvider,{children:a.jsx(e.DisplayPreferencesProvider,{displayPreferences:o,children:a.jsx(e.Container,{type:"visual",...i,children:a.jsx(A,{cardId:r.cardId})})})})]})})}function A({cardId:r}){const o=e.useDashboardStore(n=>{var l;return(l=n.dashboard)==null?void 0:l.sheets}),{card:s,frame:i}=b.useMemo(()=>{const n=o==null?void 0:o.flatMap(t=>t.frames),l=n==null?void 0:n.flatMap(t=>t==null?void 0:t.cards),C=l==null?void 0:l.find(t=>(t==null?void 0:t.id)===r),f=n==null?void 0:n.find(t=>{var p;return(p=t==null?void 0:t.cards)==null?void 0:p.find(u=>(u==null?void 0:u.id)===r)});return{card:C,frame:f}},[o,r]);return!s||!i?a.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${r}`}):a.jsx("main",{className:"flex h-full grow flex-col",children:a.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:l})=>a.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:l,customerFacingMessage:"Error creating visual. Please try again."}),children:a.jsx(e.DashboardCard,{card:s,frame:i})})})}function N({name:r,items:o,value:s,onChange:i,isLoading:n,isError:l,refetch:C,className:f,icon:t,showNone:p=!1}){const u=m.useRef(null),[x,g]=m.useState(!1),[y,T]=m.useState("100%"),D=p?[...o||[],{id:"none",name:"None"}]:o;m.useLayoutEffect(()=>{u.current&&T(u.current.offsetWidth)},[]);function E(){var d;return n?"Loading...":l?"Error":s?(d=o==null?void 0:o.find(c=>c.id===s))==null?void 0:d.name:`Select ${r}`}function S(d,c){i(c),g(!1)}return a.jsxs(e.Popover,{open:x,onOpenChange:g,children:[a.jsx(e.PopoverTrigger,{asChild:!0,children:a.jsxs(e.Button,{ref:u,variant:"outline",role:"combobox","aria-expanded":x,className:e.cn("flex h-9 w-full justify-between",f),children:[a.jsxs("div",{className:"flex items-center gap-2",children:[t&&a.jsx("div",{className:"mr-2",children:t}),a.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:E()})]}),a.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),a.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:y},children:a.jsxs(e.Command,{children:[a.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[a.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),a.jsx(e.IconButton,{className:"h-7",onClick:C,children:a.jsx(M,{className:e.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),a.jsxs(e.CommandList,{children:[a.jsxs(e.CommandEmpty,{children:["No ",r==null?void 0:r.toLowerCase()," found."]}),a.jsx(e.CommandGroup,{children:D==null?void 0:D.map(d=>a.jsx(e.CommandItem,{className:"overflow-x-auto",value:d.name,onSelect:c=>S(c,d.id),children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(e.Check,{className:e.cn("size-4",s===d.id?"opacity-100":"opacity-0")}),a.jsx("div",{title:d.name,children:d.name})]})},d.id))})]})]})})]})}function w(r,o){b.useEffect(()=>(r&&o&&(window.__SEMAPHOR_PRINT_STATE__={...o}),()=>{r&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[r,o])}exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.Surfboard=e.DashboardPlus;exports.cloneDeep=e.cloneDeep;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createSqlGenConfig=e.createSqlGenConfig;exports.downloadPdf=e.downloadPdf;exports.emitDashboardLoad=e.emitDashboardLoad;exports.emitDashboardUnload=e.emitDashboardUnload;exports.fmt=e.fmt;exports.getColumnDataType=e.getColumnDataType;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedField=e.isCalculatedField;exports.isCalculatedMetric=e.isCalculatedMetric;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.useCard=e.useCard;exports.useCurrentActiveCard=e.useCurrentActiveCard;exports.useCurrentCardConfig=e.useCurrentCardConfig;exports.useCurrentSheetActiveCards=e.useCurrentSheetActiveCards;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardStore=e.useDashboardStore;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=v.EMPTY_SELECTION;exports.ResourceManagementPanel=j.ResourceManagementPanel;exports.AdvancedModeToggle=h.AdvancedModeToggle;exports.ScheduleDashboard=h.ScheduleDashboard;exports.UnsavedChangesAlert=h.UnsavedChangesAlert;exports.VisualEditingControls=h.VisualEditingControls;exports.usePristineSnapshotInitializer=h.usePristineSnapshotInitializer;exports.Combobox=N;exports.Visual=_;exports.useExposePrintState=w;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-CfPKTeUk.js"),v=require("./types/index.cjs"),o=require("react/jsx-runtime"),f=require("react"),P=require("./chunks/resource-management-panel-Buhi-kvP.js"),i=require("./chunks/notification-bell-2dZI5OV0.js");require("react-dom");function j(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const l=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(r,s,l.get?l:{enumerable:!0,get:()=>t[s]})}}return r.default=t,Object.freeze(r)}const x=j(f);function N(t){const{displayPreferences:r,...s}=t,l={...s,id:t.dashboardId};return o.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:o.jsxs(e.SemaphorContextProvider,{dashboardProps:l,children:[o.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:t.cardId}),o.jsx(e.UXProvider,{children:o.jsx(e.DisplayPreferencesProvider,{displayPreferences:r,children:o.jsx(e.Container,{type:"visual",...l,children:o.jsx(A,{cardId:t.cardId})})})})]})})}function A({cardId:t}){const r=e.useDashboardStore(n=>{var u;return(u=n.dashboard)==null?void 0:u.sheets}),{card:s,frame:l}=f.useMemo(()=>{const n=r==null?void 0:r.flatMap(a=>a.frames),u=n==null?void 0:n.flatMap(a=>a==null?void 0:a.cards),m=u==null?void 0:u.find(a=>(a==null?void 0:a.id)===t),E=n==null?void 0:n.find(a=>{var h;return(h=a==null?void 0:a.cards)==null?void 0:h.find(c=>(c==null?void 0:c.id)===t)});return{card:m,frame:E}},[r,t]);return!s||!l?o.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${t}`}):o.jsx("main",{className:"flex h-full grow flex-col",children:o.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:u})=>o.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:u,customerFacingMessage:"Error creating visual. Please try again."}),children:o.jsx(e.DashboardCard,{card:s,frame:l})})})}function _({name:t,items:r,value:s,onChange:l,isLoading:n,isError:u,refetch:m,className:E,icon:a,showNone:h=!1}){const c=x.useRef(null),[g,D]=x.useState(!1),[b,S]=x.useState("100%"),C=h?[...r||[],{id:"none",name:"None"}]:r;x.useLayoutEffect(()=>{c.current&&S(c.current.offsetWidth)},[]);function T(){var d;return n?"Loading...":u?"Error":s?(d=r==null?void 0:r.find(p=>p.id===s))==null?void 0:d.name:`Select ${t}`}function y(d,p){l(p),D(!1)}return o.jsxs(e.Popover,{open:g,onOpenChange:D,children:[o.jsx(e.PopoverTrigger,{asChild:!0,children:o.jsxs(e.Button,{ref:c,variant:"outline",role:"combobox","aria-expanded":g,className:e.cn("flex h-9 w-full justify-between",E),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[a&&o.jsx("div",{className:"mr-2",children:a}),o.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:T()})]}),o.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),o.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:b},children:o.jsxs(e.Command,{children:[o.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[o.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),o.jsx(e.IconButton,{className:"h-7",onClick:m,children:o.jsx(i.RefreshCw,{className:e.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),o.jsxs(e.CommandList,{children:[o.jsxs(e.CommandEmpty,{children:["No ",t==null?void 0:t.toLowerCase()," found."]}),o.jsx(e.CommandGroup,{children:C==null?void 0:C.map(d=>o.jsx(e.CommandItem,{className:"overflow-x-auto",value:d.name,onSelect:p=>y(p,d.id),children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(e.Check,{className:e.cn("size-4",s===d.id?"opacity-100":"opacity-0")}),o.jsx("div",{title:d.name,children:d.name})]})},d.id))})]})]})})]})}function M(t,r){f.useEffect(()=>(t&&r&&(window.__SEMAPHOR_PRINT_STATE__={...r}),()=>{t&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[t,r])}exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.ExportError=e.ExportError;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.Surfboard=e.DashboardPlus;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createExport=e.createExport;exports.createSqlGenConfig=e.createSqlGenConfig;exports.downloadPdf=e.downloadPdf;exports.emitDashboardLoad=e.emitDashboardLoad;exports.emitDashboardUnload=e.emitDashboardUnload;exports.fmt=e.fmt;exports.formatFileSize=e.formatFileSize;exports.getColumnDataType=e.getColumnDataType;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedField=e.isCalculatedField;exports.isCalculatedMetric=e.isCalculatedMetric;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.useActiveExports=e.useActiveExports;exports.useCard=e.useCard;exports.useCurrentActiveCard=e.useCurrentActiveCard;exports.useCurrentCardConfig=e.useCurrentCardConfig;exports.useCurrentSheetActiveCards=e.useCurrentSheetActiveCards;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardStore=e.useDashboardStore;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=v.EMPTY_SELECTION;exports.ResourceManagementPanel=P.ResourceManagementPanel;exports.AdvancedModeToggle=i.AdvancedModeToggle;exports.ExportNotificationItem=i.ExportNotificationItem;exports.ExportNotificationList=i.ExportNotificationList;exports.NotificationBell=i.NotificationBell;exports.ScheduleDashboard=i.ScheduleDashboard;exports.UnsavedChangesAlert=i.UnsavedChangesAlert;exports.VisualEditingControls=i.VisualEditingControls;exports.useExportPolling=i.useExportPolling;exports.useExportRecovery=i.useExportRecovery;exports.usePristineSnapshotInitializer=i.usePristineSnapshotInitializer;exports.Combobox=_;exports.Visual=N;exports.useExposePrintState=M;
|