react-semaphor 0.1.165 → 0.1.167
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-Bp5qe0eo.js +26 -0
- package/dist/chunks/{dashboard-controls-BA7vyPHM.js → dashboard-controls-ominVbei.js} +273 -298
- package/dist/chunks/{dashboard-json-C8YFsFVt.js → dashboard-json-C4i7Yq69.js} +1 -1
- package/dist/chunks/{dashboard-json-B4UTFvyR.js → dashboard-json-Dx_6Ejec.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-BMBiT_V_.js → edit-dashboard-visual-C8JlV4-w.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-DKqjPVRM.js → edit-dashboard-visual-Cd-a5PlC.js} +2 -2
- package/dist/chunks/{editor-action-buttons-De18jUjn.js → editor-action-buttons-BbqakkOy.js} +2 -2
- package/dist/chunks/{editor-action-buttons-xrbSWcSm.js → editor-action-buttons-DgLZlX3X.js} +1 -1
- package/dist/chunks/{index-5dE6RqWv.js → index-DK6LMjBA.js} +15724 -15488
- package/dist/chunks/{index-odiH0LJA.js → index-o_l1PmNv.js} +193 -193
- package/dist/chunks/{resource-management-panel-CjWRsuif.js → resource-management-panel-Bcr9R2mo.js} +128 -128
- package/dist/chunks/{resource-management-panel-CK-wL4Jy.js → resource-management-panel-C-ijbO2j.js} +1 -1
- package/dist/chunks/schedule-dashboard-DwdOvSX8.js +416 -0
- package/dist/chunks/schedule-dashboard-_UAuGQ_4.js +6 -0
- package/dist/chunks/{use-role-aware-display-preferences-Bj_-I3oD.js → use-role-aware-display-preferences-Bg5K1xOj.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-Cm7hg_Us.js → use-role-aware-display-preferences-D-icyP5A.js} +1 -1
- package/dist/chunks/{use-visual-utils-Du173Ucu.js → use-visual-utils--qc4n_jK.js} +1 -1
- package/dist/chunks/{use-visual-utils-DwnVUHSd.js → use-visual-utils-BwfHhd-4.js} +10 -10
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +58 -58
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/dashboard.d.ts +5 -0
- package/dist/types/main.d.ts +5 -0
- package/dist/types/surfboard.d.ts +5 -0
- package/dist/types/types.d.ts +5 -0
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-CEnWdjuE.js +0 -26
- package/dist/chunks/dashboard-export-dialog-9nJsWzgJ.js +0 -6
- package/dist/chunks/dashboard-export-dialog-CEVJnrSj.js +0 -602
package/dist/chunks/{resource-management-panel-CK-wL4Jy.js → resource-management-panel-C-ijbO2j.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-o_l1PmNv.js"),c=require("react"),de=require("./use-visual-utils--qc4n_jK.js"),pe=require("./use-role-aware-display-preferences-Bg5K1xOj.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
import { jsx as e, jsxs as a, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { l as _, aF as $, aG as q, aH as K, aI as X, aJ as Y, aK as T, aL as G, aM as J, aN as E, aO as Q, B as I, L as H, n as k, q as Z, u as g, aB as ee, o as R, aP as ae, aQ as O, t as y, R as se, aR as te, c as w, aS as B, aT as P, aU as L, aV as U, aW as z, m as de, aX as le, aY as ne, aZ as re, a_ as oe, a$ as ie, b0 as ce, b1 as he, b2 as ue, b3 as me, b4 as ve, b5 as pe, b6 as be, a5 as fe, K as ge, b7 as Ce, b8 as De } from "./index-DK6LMjBA.js";
|
|
3
|
+
import { E as xe, V as Ae, a as Se, b as Ne, S as j, c as ye } from "./editor-action-buttons-BbqakkOy.js";
|
|
4
|
+
import we, { useState as D, useContext as Ie, useEffect as ke } from "react";
|
|
5
|
+
import { a as W } from "./use-visual-utils-BwfHhd-4.js";
|
|
6
|
+
/**
|
|
7
|
+
* @license lucide-react v0.453.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
const Fe = _("CirclePlus", [
|
|
13
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
14
|
+
["path", { d: "M8 12h8", key: "1wcyev" }],
|
|
15
|
+
["path", { d: "M12 8v8", key: "napkw2" }]
|
|
16
|
+
]);
|
|
17
|
+
function Ve({
|
|
18
|
+
open: l,
|
|
19
|
+
onOpenChange: n,
|
|
20
|
+
isLibraryVisual: s,
|
|
21
|
+
currentVisualName: t,
|
|
22
|
+
isSaving: r = !1,
|
|
23
|
+
onConfirm: u
|
|
24
|
+
}) {
|
|
25
|
+
const [i, d] = D(
|
|
26
|
+
s && t ? `Copy of ${t}` : t || ""
|
|
27
|
+
), [c, v] = D(""), [b, C] = D(!s), [f, x] = D(!0);
|
|
28
|
+
we.useEffect(() => {
|
|
29
|
+
l && (d(
|
|
30
|
+
s && t ? `Copy of ${t}` : t || ""
|
|
31
|
+
), v(""), C(!s), x(!0));
|
|
32
|
+
}, [l, s, t]);
|
|
33
|
+
const S = () => {
|
|
34
|
+
i.trim() && (!b && !f || u({
|
|
35
|
+
name: i.trim(),
|
|
36
|
+
description: c.trim() || void 0,
|
|
37
|
+
saveToLibrary: b,
|
|
38
|
+
saveToCurrentDashboard: f
|
|
39
|
+
}));
|
|
40
|
+
}, A = i.trim() && (b || f);
|
|
41
|
+
return /* @__PURE__ */ e($, { open: l, onOpenChange: n, children: /* @__PURE__ */ a(q, { className: "sm:max-w-[425px]", children: [
|
|
42
|
+
/* @__PURE__ */ a(K, { children: [
|
|
43
|
+
/* @__PURE__ */ e(X, { children: "Save Visual As" }),
|
|
44
|
+
/* @__PURE__ */ e(Y, { children: s ? "Create a copy of this visual with a new name" : "Save this visual to make it reusable" })
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ a("div", { className: "grid gap-4 py-4", children: [
|
|
47
|
+
/* @__PURE__ */ a("div", { className: "grid gap-2", children: [
|
|
48
|
+
/* @__PURE__ */ e(T, { htmlFor: "name", children: "Name" }),
|
|
49
|
+
/* @__PURE__ */ e(
|
|
50
|
+
G,
|
|
51
|
+
{
|
|
52
|
+
id: "name",
|
|
53
|
+
value: i,
|
|
54
|
+
onChange: (m) => d(m.target.value),
|
|
55
|
+
placeholder: "Enter visual name",
|
|
56
|
+
disabled: r
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] }),
|
|
60
|
+
/* @__PURE__ */ a("div", { className: "grid gap-2", children: [
|
|
61
|
+
/* @__PURE__ */ e(T, { htmlFor: "description", children: "Description (optional)" }),
|
|
62
|
+
/* @__PURE__ */ e(
|
|
63
|
+
J,
|
|
64
|
+
{
|
|
65
|
+
id: "description",
|
|
66
|
+
value: c,
|
|
67
|
+
onChange: (m) => v(m.target.value),
|
|
68
|
+
placeholder: "Enter visual description",
|
|
69
|
+
rows: 3,
|
|
70
|
+
disabled: r
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
75
|
+
/* @__PURE__ */ e(T, { children: "Save to:" }),
|
|
76
|
+
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
77
|
+
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
78
|
+
/* @__PURE__ */ e(
|
|
79
|
+
E,
|
|
80
|
+
{
|
|
81
|
+
id: "save-to-dashboard",
|
|
82
|
+
checked: f,
|
|
83
|
+
onCheckedChange: (m) => x(!!m),
|
|
84
|
+
disabled: r
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ a(
|
|
88
|
+
"label",
|
|
89
|
+
{
|
|
90
|
+
htmlFor: "save-to-dashboard",
|
|
91
|
+
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
92
|
+
children: [
|
|
93
|
+
"Current Dashboard",
|
|
94
|
+
/* @__PURE__ */ e("span", { className: "ml-2 text-xs text-muted-foreground", children: s ? "(add copy to this dashboard)" : "(keep as local visual)" })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
100
|
+
/* @__PURE__ */ e(
|
|
101
|
+
E,
|
|
102
|
+
{
|
|
103
|
+
id: "save-to-library",
|
|
104
|
+
checked: b,
|
|
105
|
+
onCheckedChange: (m) => C(!!m),
|
|
106
|
+
disabled: r
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
/* @__PURE__ */ a(
|
|
110
|
+
"label",
|
|
111
|
+
{
|
|
112
|
+
htmlFor: "save-to-library",
|
|
113
|
+
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
114
|
+
children: [
|
|
115
|
+
"Visual Library",
|
|
116
|
+
/* @__PURE__ */ e("span", { className: "ml-2 text-xs text-muted-foreground", children: s ? "(save as new reusable visual)" : "(make available to all dashboards)" })
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
] })
|
|
121
|
+
] }),
|
|
122
|
+
!b && !f && /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: "Please select at least one destination" })
|
|
123
|
+
] })
|
|
124
|
+
] }),
|
|
125
|
+
/* @__PURE__ */ a(Q, { children: [
|
|
126
|
+
/* @__PURE__ */ e(
|
|
127
|
+
I,
|
|
128
|
+
{
|
|
129
|
+
variant: "outline",
|
|
130
|
+
onClick: () => n(!1),
|
|
131
|
+
disabled: r,
|
|
132
|
+
children: "Cancel"
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ a(I, { onClick: S, disabled: !A || r, children: [
|
|
136
|
+
r && /* @__PURE__ */ e(H, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
137
|
+
r ? "Saving..." : "Save"
|
|
138
|
+
] })
|
|
139
|
+
] })
|
|
140
|
+
] }) });
|
|
141
|
+
}
|
|
142
|
+
function Me() {
|
|
143
|
+
const [l, n] = D(!1), [s, t] = D(!1), [r, u] = D(null), i = k((o) => o.frame), d = k((o) => o.card), c = Z(), v = g((o) => o.selectedSheetId), b = g(
|
|
144
|
+
(o) => o.actions.setIsDashboardPanelOpen
|
|
145
|
+
), { getUpdatedFrame: C } = W(), { selectVisual: f } = ee(), { addFrame: x, setSelectedFrameId: S, setIsVisualEditing: A } = R(), m = !!(i != null && i.visualId), V = (() => {
|
|
146
|
+
var o, p;
|
|
147
|
+
return ((o = i == null ? void 0 : i.cards) == null ? void 0 : o.length) === 1 && ((p = i.cards[0]) != null && p.title) ? i.cards[0].title : c != null && c.title ? c.title : (d == null ? void 0 : d.title) || "Untitled Visual";
|
|
148
|
+
})(), h = ae((o) => {
|
|
149
|
+
if (o != null && o.id) {
|
|
150
|
+
if (f(o), s && r && v) {
|
|
151
|
+
const p = {
|
|
152
|
+
...r,
|
|
153
|
+
id: O(),
|
|
154
|
+
visualId: o.id
|
|
155
|
+
// Link to the newly created library visual
|
|
156
|
+
};
|
|
157
|
+
x(v, p, "end"), S(p.id), t(!1), u(null), A(!1);
|
|
158
|
+
}
|
|
159
|
+
b(!0), n(!1);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return {
|
|
163
|
+
saveAsDialogOpen: l,
|
|
164
|
+
setSaveAsDialogOpen: n,
|
|
165
|
+
handleSaveAs: async (o) => {
|
|
166
|
+
if (!v) {
|
|
167
|
+
y.error("No sheet selected");
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const p = C(), M = p.cards.length === 1 ? {
|
|
171
|
+
...p,
|
|
172
|
+
cards: p.cards.map((N) => ({
|
|
173
|
+
...N,
|
|
174
|
+
title: o.name
|
|
175
|
+
// Use visual name as card title
|
|
176
|
+
}))
|
|
177
|
+
} : p;
|
|
178
|
+
if (o.saveToLibrary) {
|
|
179
|
+
t(o.saveToCurrentDashboard), u(M);
|
|
180
|
+
const N = {
|
|
181
|
+
title: o.name,
|
|
182
|
+
description: o.description,
|
|
183
|
+
frameObject: M,
|
|
184
|
+
// Card title synced for single-card frames
|
|
185
|
+
isPrivate: !1
|
|
186
|
+
};
|
|
187
|
+
h.mutate(N);
|
|
188
|
+
} else if (o.saveToCurrentDashboard) {
|
|
189
|
+
const N = {
|
|
190
|
+
...M,
|
|
191
|
+
// Card title already synced
|
|
192
|
+
id: O(),
|
|
193
|
+
visualId: void 0
|
|
194
|
+
// Explicitly no visualId for local visuals
|
|
195
|
+
};
|
|
196
|
+
x(v, N, "end"), S(N.id), y.success("Visual saved to dashboard"), n(!1), A(!1);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
isLibraryVisual: m,
|
|
200
|
+
currentVisualName: V,
|
|
201
|
+
isSaving: h.isPending
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function ze({
|
|
205
|
+
className: l
|
|
206
|
+
}) {
|
|
207
|
+
const n = k((h) => h.frame), s = k((h) => h.card), t = se((h) => h.selectedVisual), r = g((h) => h.selectedFrameId), u = g((h) => h.selectedSheetId), { setIsVisualEditing: i } = R(), d = !!(n != null && n.visualId || t != null && t.id), c = !!(n != null && n.visualId && r), v = d && !c, {
|
|
208
|
+
saveAsDialogOpen: b,
|
|
209
|
+
setSaveAsDialogOpen: C,
|
|
210
|
+
handleSaveAs: f,
|
|
211
|
+
isLibraryVisual: x,
|
|
212
|
+
currentVisualName: S,
|
|
213
|
+
isSaving: A
|
|
214
|
+
} = Me(), { handleAddLibraryVisual: m } = W(), V = async () => {
|
|
215
|
+
if (!u) {
|
|
216
|
+
y.error("No dashboard sheet selected");
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (!t) {
|
|
220
|
+
y.error("No visual selected");
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const h = await m(t);
|
|
224
|
+
h.success ? (y.success("Visual added to dashboard"), i(!1)) : y.error(h.error || "Failed to add visual to dashboard");
|
|
225
|
+
};
|
|
226
|
+
return /* @__PURE__ */ a(F, { children: [
|
|
227
|
+
!d && /* @__PURE__ */ e(xe, { className: l, variant: "default" }),
|
|
228
|
+
d && /* @__PURE__ */ a(F, { children: [
|
|
229
|
+
c && /* @__PURE__ */ e(Ae, { className: l }),
|
|
230
|
+
v && u && s && (s.sql || te(s.config)) && /* @__PURE__ */ a(
|
|
231
|
+
I,
|
|
232
|
+
{
|
|
233
|
+
onClick: V,
|
|
234
|
+
className: w(l),
|
|
235
|
+
size: "sm",
|
|
236
|
+
variant: "outline",
|
|
237
|
+
children: [
|
|
238
|
+
/* @__PURE__ */ e(Fe, { className: "mr-2 size-4 font-bold" }),
|
|
239
|
+
"Add to Dashboard"
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
),
|
|
243
|
+
v && /* @__PURE__ */ e(Se, { className: l, variant: "default" }),
|
|
244
|
+
c && /* @__PURE__ */ e(Ne, { className: l }),
|
|
245
|
+
/* @__PURE__ */ a(B, { modal: !1, children: [
|
|
246
|
+
/* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ e(
|
|
247
|
+
I,
|
|
248
|
+
{
|
|
249
|
+
variant: "outline",
|
|
250
|
+
size: "sm",
|
|
251
|
+
className: w(l, "w-8 p-0"),
|
|
252
|
+
children: /* @__PURE__ */ e(L, { className: "h-4 w-4" })
|
|
253
|
+
}
|
|
254
|
+
) }),
|
|
255
|
+
/* @__PURE__ */ e(U, { align: "end", children: /* @__PURE__ */ a(
|
|
256
|
+
z,
|
|
257
|
+
{
|
|
258
|
+
onClick: (h) => {
|
|
259
|
+
h.stopPropagation(), C(!0);
|
|
260
|
+
},
|
|
261
|
+
children: [
|
|
262
|
+
/* @__PURE__ */ e(j, { className: "mr-2 h-4 w-4" }),
|
|
263
|
+
"Save As..."
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
) })
|
|
267
|
+
] })
|
|
268
|
+
] }),
|
|
269
|
+
!d && /* @__PURE__ */ a(B, { modal: !1, children: [
|
|
270
|
+
/* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ e(
|
|
271
|
+
I,
|
|
272
|
+
{
|
|
273
|
+
variant: "outline",
|
|
274
|
+
size: "sm",
|
|
275
|
+
className: w(l, "w-8 p-0"),
|
|
276
|
+
children: /* @__PURE__ */ e(L, { className: "h-4 w-4" })
|
|
277
|
+
}
|
|
278
|
+
) }),
|
|
279
|
+
/* @__PURE__ */ e(U, { align: "end", children: /* @__PURE__ */ a(z, { onClick: () => C(!0), children: [
|
|
280
|
+
/* @__PURE__ */ e(j, { className: "mr-2 h-4 w-4" }),
|
|
281
|
+
"Save As..."
|
|
282
|
+
] }) })
|
|
283
|
+
] }),
|
|
284
|
+
/* @__PURE__ */ e(ye, { className: l }),
|
|
285
|
+
/* @__PURE__ */ e(
|
|
286
|
+
Ve,
|
|
287
|
+
{
|
|
288
|
+
open: b,
|
|
289
|
+
onOpenChange: (h) => {
|
|
290
|
+
A || C(h);
|
|
291
|
+
},
|
|
292
|
+
isLibraryVisual: x,
|
|
293
|
+
currentVisualName: S,
|
|
294
|
+
isSaving: A,
|
|
295
|
+
onConfirm: f
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
] });
|
|
299
|
+
}
|
|
300
|
+
function je({
|
|
301
|
+
className: l,
|
|
302
|
+
//labelClassName,
|
|
303
|
+
switchClassName: n
|
|
304
|
+
}) {
|
|
305
|
+
const s = k((d) => d.isDevMode), t = g((d) => d.isVisualEditing), { setIsDevMode: r } = de(), { config: u } = Ie(le).tokenProps, i = (u == null ? void 0 : u.showAdvancedMode) !== !1;
|
|
306
|
+
return !t || !i ? null : /* @__PURE__ */ a("div", { className: w("flex items-center space-x-2", l), children: [
|
|
307
|
+
/* @__PURE__ */ e(
|
|
308
|
+
ne,
|
|
309
|
+
{
|
|
310
|
+
className: w("", n),
|
|
311
|
+
checked: s,
|
|
312
|
+
onCheckedChange: () => r(!s),
|
|
313
|
+
id: "advanced-mode",
|
|
314
|
+
icon: /* @__PURE__ */ e(re, { className: "h-4 w-4" }),
|
|
315
|
+
tooltip: s ? "Standard Mode" : "Advanced Mode"
|
|
316
|
+
}
|
|
317
|
+
),
|
|
318
|
+
/* @__PURE__ */ e("label", { htmlFor: "advanced-mode", className: "sr-only", children: "Advanced Mode" })
|
|
319
|
+
] });
|
|
320
|
+
}
|
|
321
|
+
function He({
|
|
322
|
+
open: l,
|
|
323
|
+
onOpenChange: n,
|
|
324
|
+
onSave: s,
|
|
325
|
+
onDiscard: t,
|
|
326
|
+
isSaving: r
|
|
327
|
+
}) {
|
|
328
|
+
return /* @__PURE__ */ e(oe, { open: l, onOpenChange: (i) => {
|
|
329
|
+
!i && r || n(i);
|
|
330
|
+
}, children: /* @__PURE__ */ a(ie, { className: "max-w-md", children: [
|
|
331
|
+
/* @__PURE__ */ a(ce, { children: [
|
|
332
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-3", children: [
|
|
333
|
+
/* @__PURE__ */ e("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-amber-100", children: /* @__PURE__ */ e(he, { className: "h-5 w-5 text-amber-600" }) }),
|
|
334
|
+
/* @__PURE__ */ e(ue, { className: "text-xl", children: "Unsaved Changes" })
|
|
335
|
+
] }),
|
|
336
|
+
/* @__PURE__ */ e(me, { className: "pt-2 text-base leading-relaxed", children: "You have unsaved changes to this dashboard. What would you like to do?" })
|
|
337
|
+
] }),
|
|
338
|
+
/* @__PURE__ */ a(ve, { className: "flex-col gap-2 sm:flex-row sm:gap-2", children: [
|
|
339
|
+
/* @__PURE__ */ e(
|
|
340
|
+
pe,
|
|
341
|
+
{
|
|
342
|
+
disabled: r,
|
|
343
|
+
className: "order-1 m-0 border-border/50 sm:order-1",
|
|
344
|
+
children: "Cancel"
|
|
345
|
+
}
|
|
346
|
+
),
|
|
347
|
+
/* @__PURE__ */ e(
|
|
348
|
+
"button",
|
|
349
|
+
{
|
|
350
|
+
onClick: t,
|
|
351
|
+
disabled: r,
|
|
352
|
+
className: "order-2 rounded-md border border-destructive/20 bg-destructive/10 px-4 py-2 text-sm font-medium text-destructive transition-colors hover:bg-destructive/20 disabled:pointer-events-none disabled:opacity-50 sm:order-2",
|
|
353
|
+
children: "Discard"
|
|
354
|
+
}
|
|
355
|
+
),
|
|
356
|
+
/* @__PURE__ */ e(
|
|
357
|
+
be,
|
|
358
|
+
{
|
|
359
|
+
onClick: s,
|
|
360
|
+
disabled: r,
|
|
361
|
+
className: "order-3 m-0 bg-primary text-primary-foreground hover:bg-primary/90 sm:order-3",
|
|
362
|
+
children: r ? /* @__PURE__ */ a(F, { children: [
|
|
363
|
+
/* @__PURE__ */ e(H, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
364
|
+
"Saving..."
|
|
365
|
+
] }) : "Save & Close"
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
] })
|
|
369
|
+
] }) });
|
|
370
|
+
}
|
|
371
|
+
function Re(l, n, s, t) {
|
|
372
|
+
ke(() => {
|
|
373
|
+
l && !s && n && t(fe(n));
|
|
374
|
+
}, [l, s, n, t]);
|
|
375
|
+
}
|
|
376
|
+
function We({
|
|
377
|
+
triggerButtonClassName: l
|
|
378
|
+
}) {
|
|
379
|
+
const [n, s] = D(!1), t = g((d) => {
|
|
380
|
+
var c;
|
|
381
|
+
return (c = d.dashboard) == null ? void 0 : c.id;
|
|
382
|
+
}), r = g((d) => {
|
|
383
|
+
var c;
|
|
384
|
+
return (c = d.dashboard) == null ? void 0 : c.title;
|
|
385
|
+
}), u = g((d) => {
|
|
386
|
+
var c;
|
|
387
|
+
return (c = d.dashboard) == null ? void 0 : c.sheets;
|
|
388
|
+
}), i = g((d) => d.selectedSheetId);
|
|
389
|
+
return u == null || u.find((d) => d.id === i), t ? /* @__PURE__ */ a(F, { children: [
|
|
390
|
+
/* @__PURE__ */ e(
|
|
391
|
+
ge,
|
|
392
|
+
{
|
|
393
|
+
tooltip: "Schedule Dashboard",
|
|
394
|
+
className: w("h-7 p-2", l),
|
|
395
|
+
onClick: () => s(!0),
|
|
396
|
+
children: /* @__PURE__ */ e(Ce, { className: "size-4" })
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
/* @__PURE__ */ e(
|
|
400
|
+
De,
|
|
401
|
+
{
|
|
402
|
+
open: n,
|
|
403
|
+
onOpenChange: s,
|
|
404
|
+
dashboardId: t,
|
|
405
|
+
dashboardName: r
|
|
406
|
+
}
|
|
407
|
+
)
|
|
408
|
+
] }) : null;
|
|
409
|
+
}
|
|
410
|
+
export {
|
|
411
|
+
je as A,
|
|
412
|
+
We as S,
|
|
413
|
+
He as U,
|
|
414
|
+
ze as V,
|
|
415
|
+
Re as u
|
|
416
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),e=require("./index-o_l1PmNv.js"),C=require("./editor-action-buttons-DgLZlX3X.js"),x=require("react"),y=require("./use-visual-utils--qc4n_jK.js");/**
|
|
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 I=e.createLucideIcon("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);function k({open:r,onOpenChange:d,isLibraryVisual:a,currentVisualName:t,isSaving:o=!1,onConfirm:h}){const[i,n]=x.useState(a&&t?`Copy of ${t}`:t||""),[c,v]=x.useState(""),[b,j]=x.useState(!a),[g,f]=x.useState(!0);x.useEffect(()=>{r&&(n(a&&t?`Copy of ${t}`:t||""),v(""),j(!a),f(!0))},[r,a,t]);const S=()=>{i.trim()&&(!b&&!g||h({name:i.trim(),description:c.trim()||void 0,saveToLibrary:b,saveToCurrentDashboard:g}))},D=i.trim()&&(b||g);return s.jsx(e.Dialog,{open:r,onOpenChange:d,children:s.jsxs(e.DialogContent,{className:"sm:max-w-[425px]",children:[s.jsxs(e.DialogHeader,{children:[s.jsx(e.DialogTitle,{children:"Save Visual As"}),s.jsx(e.DialogDescription,{children:a?"Create a copy of this visual with a new name":"Save this visual to make it reusable"})]}),s.jsxs("div",{className:"grid gap-4 py-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(e.Label,{htmlFor:"name",children:"Name"}),s.jsx(e.Input,{id:"name",value:i,onChange:m=>n(m.target.value),placeholder:"Enter visual name",disabled:o})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(e.Label,{htmlFor:"description",children:"Description (optional)"}),s.jsx(e.Textarea,{id:"description",value:c,onChange:m=>v(m.target.value),placeholder:"Enter visual description",rows:3,disabled:o})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx(e.Label,{children:"Save to:"}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(e.Checkbox,{id:"save-to-dashboard",checked:g,onCheckedChange:m=>f(!!m),disabled:o}),s.jsxs("label",{htmlFor:"save-to-dashboard",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:["Current Dashboard",s.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:a?"(add copy to this dashboard)":"(keep as local visual)"})]})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(e.Checkbox,{id:"save-to-library",checked:b,onCheckedChange:m=>j(!!m),disabled:o}),s.jsxs("label",{htmlFor:"save-to-library",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:["Visual Library",s.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:a?"(save as new reusable visual)":"(make available to all dashboards)"})]})]})]}),!b&&!g&&s.jsx("p",{className:"text-sm text-destructive",children:"Please select at least one destination"})]})]}),s.jsxs(e.DialogFooter,{children:[s.jsx(e.Button,{variant:"outline",onClick:()=>d(!1),disabled:o,children:"Cancel"}),s.jsxs(e.Button,{onClick:S,disabled:!D||o,children:[o&&s.jsx(e.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),o?"Saving...":"Save"]})]})]})})}function F(){const[r,d]=x.useState(!1),[a,t]=x.useState(!1),[o,h]=x.useState(null),i=e.useEditorStore(l=>l.frame),n=e.useEditorStore(l=>l.card),c=e.useSelectedVisual(),v=e.useDashboardStore(l=>l.selectedSheetId),b=e.useDashboardStore(l=>l.actions.setIsDashboardPanelOpen),{getUpdatedFrame:j}=y.useVisualUtils(),{selectVisual:g}=e.useManagementActions(),{addFrame:f,setSelectedFrameId:S,setIsVisualEditing:D}=e.useDashboardActions(),m=!!(i!=null&&i.visualId),w=(()=>{var l,p;return((l=i==null?void 0:i.cards)==null?void 0:l.length)===1&&((p=i.cards[0])!=null&&p.title)?i.cards[0].title:c!=null&&c.title?c.title:(n==null?void 0:n.title)||"Untitled Visual"})(),u=e.useCreateVisualWithFrame(l=>{if(l!=null&&l.id){if(g(l),a&&o&&v){const p={...o,id:e.v4(),visualId:l.id};f(v,p,"end"),S(p.id),t(!1),h(null),D(!1)}b(!0),d(!1)}});return{saveAsDialogOpen:r,setSaveAsDialogOpen:d,handleSaveAs:async l=>{if(!v){e.ue.error("No sheet selected");return}const p=j(),N=p.cards.length===1?{...p,cards:p.cards.map(A=>({...A,title:l.name}))}:p;if(l.saveToLibrary){t(l.saveToCurrentDashboard),h(N);const A={title:l.name,description:l.description,frameObject:N,isPrivate:!1};u.mutate(A)}else if(l.saveToCurrentDashboard){const A={...N,id:e.v4(),visualId:void 0};f(v,A,"end"),S(A.id),e.ue.success("Visual saved to dashboard"),d(!1),D(!1)}},isLibraryVisual:m,currentVisualName:w,isSaving:u.isPending}}function M({className:r}){const d=e.useEditorStore(u=>u.frame),a=e.useEditorStore(u=>u.card),t=e.useManagementStore(u=>u.selectedVisual),o=e.useDashboardStore(u=>u.selectedFrameId),h=e.useDashboardStore(u=>u.selectedSheetId),{setIsVisualEditing:i}=e.useDashboardActions(),n=!!(d!=null&&d.visualId||t!=null&&t.id),c=!!(d!=null&&d.visualId&&o),v=n&&!c,{saveAsDialogOpen:b,setSaveAsDialogOpen:j,handleSaveAs:g,isLibraryVisual:f,currentVisualName:S,isSaving:D}=F(),{handleAddLibraryVisual:m}=y.useVisualUtils(),w=async()=>{if(!h){e.ue.error("No dashboard sheet selected");return}if(!t){e.ue.error("No visual selected");return}const u=await m(t);u.success?(e.ue.success("Visual added to dashboard"),i(!1)):e.ue.error(u.error||"Failed to add visual to dashboard")};return s.jsxs(s.Fragment,{children:[!n&&s.jsx(C.EditorAcceptButton,{className:r,variant:"default"}),n&&s.jsxs(s.Fragment,{children:[c&&s.jsx(C.VisualApplyLocalButton,{className:r}),v&&h&&a&&(a.sql||e.hasValidCardConfig(a.config))&&s.jsxs(e.Button,{onClick:w,className:e.cn(r),size:"sm",variant:"outline",children:[s.jsx(I,{className:"mr-2 size-4 font-bold"}),"Add to Dashboard"]}),v&&s.jsx(C.VisualSaveButton,{className:r,variant:"default"}),c&&s.jsx(C.VisualSaveAndApplyButton,{className:r}),s.jsxs(e.DropdownMenu,{modal:!1,children:[s.jsx(e.DropdownMenuTrigger,{asChild:!0,children:s.jsx(e.Button,{variant:"outline",size:"sm",className:e.cn(r,"w-8 p-0"),children:s.jsx(e.EllipsisVertical,{className:"h-4 w-4"})})}),s.jsx(e.DropdownMenuContent,{align:"end",children:s.jsxs(e.DropdownMenuItem,{onClick:u=>{u.stopPropagation(),j(!0)},children:[s.jsx(C.Save,{className:"mr-2 h-4 w-4"}),"Save As..."]})})]})]}),!n&&s.jsxs(e.DropdownMenu,{modal:!1,children:[s.jsx(e.DropdownMenuTrigger,{asChild:!0,children:s.jsx(e.Button,{variant:"outline",size:"sm",className:e.cn(r,"w-8 p-0"),children:s.jsx(e.EllipsisVertical,{className:"h-4 w-4"})})}),s.jsx(e.DropdownMenuContent,{align:"end",children:s.jsxs(e.DropdownMenuItem,{onClick:()=>j(!0),children:[s.jsx(C.Save,{className:"mr-2 h-4 w-4"}),"Save As..."]})})]}),s.jsx(C.EditorCancelButton,{className:r}),s.jsx(k,{open:b,onOpenChange:u=>{D||j(u)},isLibraryVisual:f,currentVisualName:S,isSaving:D,onConfirm:g})]})}function V({className:r,switchClassName:d}){const a=e.useEditorStore(n=>n.isDevMode),t=e.useDashboardStore(n=>n.isVisualEditing),{setIsDevMode:o}=e.useEditorActions(),{config:h}=x.useContext(e.SemaphorContext).tokenProps,i=(h==null?void 0:h.showAdvancedMode)!==!1;return!t||!i?null:s.jsxs("div",{className:e.cn("flex items-center space-x-2",r),children:[s.jsx(e.DevModeSwitch,{className:e.cn("",d),checked:a,onCheckedChange:()=>o(!a),id:"advanced-mode",icon:s.jsx(e.CodeXml,{className:"h-4 w-4"}),tooltip:a?"Standard Mode":"Advanced Mode"}),s.jsx("label",{htmlFor:"advanced-mode",className:"sr-only",children:"Advanced Mode"})]})}function E({open:r,onOpenChange:d,onSave:a,onDiscard:t,isSaving:o}){const h=i=>{!i&&o||d(i)};return s.jsx(e.AlertDialog,{open:r,onOpenChange:h,children:s.jsxs(e.AlertDialogContent,{className:"max-w-md",children:[s.jsxs(e.AlertDialogHeader,{children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-100",children:s.jsx(e.TriangleAlert,{className:"h-5 w-5 text-amber-600"})}),s.jsx(e.AlertDialogTitle,{className:"text-xl",children:"Unsaved Changes"})]}),s.jsx(e.AlertDialogDescription,{className:"pt-2 text-base leading-relaxed",children:"You have unsaved changes to this dashboard. What would you like to do?"})]}),s.jsxs(e.AlertDialogFooter,{className:"flex-col gap-2 sm:flex-row sm:gap-2",children:[s.jsx(e.AlertDialogCancel,{disabled:o,className:"order-1 m-0 border-border/50 sm:order-1",children:"Cancel"}),s.jsx("button",{onClick:t,disabled:o,className:"order-2 rounded-md border border-destructive/20 bg-destructive/10 px-4 py-2 text-sm font-medium text-destructive transition-colors hover:bg-destructive/20 disabled:pointer-events-none disabled:opacity-50 sm:order-2",children:"Discard"}),s.jsx(e.AlertDialogAction,{onClick:a,disabled:o,className:"order-3 m-0 bg-primary text-primary-foreground hover:bg-primary/90 sm:order-3",children:o?s.jsxs(s.Fragment,{children:[s.jsx(e.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save & Close"})]})]})})}function T(r,d,a,t){x.useEffect(()=>{r&&!a&&d&&t(e.cloneDeep(d))},[r,a,d,t])}function B({triggerButtonClassName:r}){const[d,a]=x.useState(!1),t=e.useDashboardStore(n=>{var c;return(c=n.dashboard)==null?void 0:c.id}),o=e.useDashboardStore(n=>{var c;return(c=n.dashboard)==null?void 0:c.title}),h=e.useDashboardStore(n=>{var c;return(c=n.dashboard)==null?void 0:c.sheets}),i=e.useDashboardStore(n=>n.selectedSheetId);return h==null||h.find(n=>n.id===i),t?s.jsxs(s.Fragment,{children:[s.jsx(e.IconButton,{tooltip:"Schedule Dashboard",className:e.cn("h-7 p-2",r),onClick:()=>a(!0),children:s.jsx(e.Clock,{className:"size-4"})}),s.jsx(e.EmailScheduleDialog,{open:d,onOpenChange:a,dashboardId:t,dashboardName:o})]}):null}exports.AdvancedModeToggle=V;exports.ScheduleDashboard=B;exports.UnsavedChangesAlert=E;exports.VisualEditingControls=M;exports.usePristineSnapshotInitializer=T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const a=require("./index-
|
|
1
|
+
"use strict";const a=require("./index-o_l1PmNv.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,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-DK6LMjBA.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 o=require("./index-
|
|
1
|
+
"use strict";const o=require("./index-o_l1PmNv.js"),b=require("react");function _(e){const a=e.toUpperCase().indexOf("WHERE"),r=e.toUpperCase().indexOf("GROUP BY"),t=e.toUpperCase().indexOf("LIMIT"),d=e.toUpperCase().indexOf("ORDER BY");let c=e.length;if(d!==-1&&(c=d),t!==-1&&t<c&&(c=t),a!==-1){const n=e.substring(0,a),s=e.substring(a);return`${n} {{ filters | where }} AND ${s.substring(6)}`}else if(r!==-1){const n=e.substring(0,r),s=e.substring(r);return`${n} {{ filters | where }} ${s}`}else{const n=e.substring(0,c),s=e.substring(c);return console.log("beforeClause",n),console.log("afterClause",s),s?`${n} {{ filters | where }} ${s}`:`${n.replace(/;$/,"")} {{ filters | where }}`}}function B(e){const[a,r]=b.useState(null),[t,d]=b.useState(null),c=o.useEnsureReactGlobals();return b.useEffect(()=>{if(!e||e.trim()===""){r(null),d(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 m=await import(l);if(typeof m.useChartStore!="function")throw new Error("useChartStore is not a function");r(()=>m.useChartStore),d(null)}catch(s){const l=s instanceof Error?s.message:"Unknown error";console.error("Failed to load remote chart store:",l),d(l),r(null)}})()},[e,c]),a}function H(e,a){if(e.length===0)return"";if(a){const r=e.find(t=>t.id===a);if(r){const t=r.tabTitle;if(t=="All__Header")return e[0].id;if(t&&t.endsWith("__Header")){const c=t.split("__")[0],n=e.find(s=>s.tabTitle===c);return n?n.id:e[0].id}return a}}return e[0].id}async function j(e,a,r,t){if(!a||!r)throw new Error("Missing auth token or visual ID");const d=["resource-by-id","visual",r],c=t.getQueryData(d);if(c)return console.log("Using cached visual data for:",r),{data:c,fromCache:!0};console.log("Fetching visual data from network for:",r);const n=o.ue.loading("Loading visual...",{position:"top-center"});try{const s=await fetch(`${e}/management/v1/visuals/${r}`,{headers:{Authorization:`Bearer ${a}`}});if(!s.ok)throw new Error("Failed to load visual");const l=await s.json();return t.setQueryData(d,l),o.ue.dismiss(n),{data:l,fromCache:!1}}catch(s){throw o.ue.dismiss(n),s}}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 Q(e,a){var c,n;const r=(e==null?void 0:e.frameObject)??((c=e==null?void 0:e.visual)==null?void 0:c.frameObject);if(!r)return!1;const t=T(r);if(!(t!=null&&t.cards)||t.cards.length===0)return!1;const d=(n=t.cards)==null?void 0:n.find(s=>s.id===t.activeCardId);return d?(o.setupEditorWithCard({...a,frame:t,card:d,visualId:(e==null?void 0:e.id)||t.visualId}),!0):!1}function G(){var g;const{setCardSql:e}=o.useEditorActions(),a=o.useEditorStore(i=>i.frame),r=o.useEditorStore(i=>i.card),t=B(((g=r.customCardPreferences)==null?void 0:g.url)||""),d=o.useEditorStore(i=>i.selectedSchemaName),c=o.useEditorStore(i=>i.selectedDatamodelId),n=o.useEditorStore(i=>i.selectedDatabaseName),s=o.useEditorStore(i=>i.selectedTableName),l=o.useEditorStore(i=>i.selectedConnectionId),m=o.useEditorStore(i=>i.isShowingVisual),f=r.sql;return{getUpdatedFrame:b.useCallback(()=>{var E;let i=f;f&&!f.includes("{{")&&(i=_(f),e(i));const C=(E=t==null?void 0:t.getState())==null?void 0:E.settings,U={...r,dataSource:r.dataSource||{mode:"directSource"},lastSelectedSchema:d,lastSelectedDatamodelId:c,lastSelectedDatabase:n,lastSelectedTable:s,connectionId:l,sql:i,customCfg:m?r.customCfg:null,preferences:r.preferences,...C&&{customCardPreferences:{...r.customCardPreferences,settings:C}}},w=a.cards.map(S=>S.id===r.id?U:S);return{...a,cards:w,activeCardId:H(w,a.activeCardId)}},[r,a,m,d,c,n,s,l,e,t,f])}}function z(){const{authToken:e,tokenProps:a}=o.useSemaphorContext(),r=o.useQueryClient(),t=o.useSelectedVisual(),{selectVisual:d}=o.useManagementActions(),{setFrame:c,setCard:n,setIsDevMode:s,setActiveTabCardId:l,updateDataSource:m,setQueryResultColumns:f,setSelectedConnectionId:V,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:U,setFilterValues:w,setApplyFilters:E}=o.useEditorActions(),{setIsDashboardEditing:S,setIsVisualEditing:$,setSelectedFrameId:v,clearSelectedFrameId:A,addFrame:N,setIsDashboardPanelOpen:R}=o.useDashboardActions(),I=o.useDashboardStore(u=>u.selectedSheetId),D=o.useDashboardStore(u=>u.selectedFrameId),O=o.useDashboardStore(u=>u.dashboard),x=o.useDashboardStore(u=>u.filterValues),y=o.useVisualById((t==null?void 0:t.id)||"",{enabled:!!(t!=null&&t.id)&&!!(e!=null&&e.accessToken)}),M=b.useCallback(async u=>{try{d(u),A();const{data:p,fromCache:h}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,r);if(!Q(p,{setFrame:c,setCard:n,setIsDevMode:s,setActiveTabCardId:l,updateDataSource:m,setQueryResultColumns:f,setSelectedConnectionId:V,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:U,setFilterValues:w,setApplyFilters:E,setIsDashboardEditing:S,setIsVisualEditing:$,dashboard:O,selectedSheetId:I,selectedFrameId:D,filterValues:x}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:h}}catch(p){return console.error("Error editing visual:",p),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,r,d,c,n,S,$,s,l,m,f,V,g,i,C,U,w,E,A,O,I,D,x]),k=b.useCallback(async u=>{var p;try{if(d(u),!I)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:h,fromCache:W}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,r),L=(h==null?void 0:h.frameObject)??((p=h==null?void 0:h.visual)==null?void 0:p.frameObject);if(!L)return{success:!1,error:"Visual has no frame data"};const F=T(L);if(!(F!=null&&F.cards)||F.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...o.cloneFrameWithNewIds(F),visualId:u.id};return N(I,P,"end"),S(!0),v(P.id),R(!1),{success:!0,fromCache:W}}catch(h){return console.error("Error adding visual:",h),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,r,d,I,N,S,v,R]);return{visual:y.data,isLoading:y.isLoading,isError:y.isError,error:y.error,handleEditLibraryVisual:M,handleAddLibraryVisual:k,getUpdatedFrame:G().getUpdatedFrame,refetch:y.refetch}}exports.useRemoteChartStore=B;exports.useVisualUtils=z;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { az as z, aA as G, p as Y, q as J, aB as K, m as _, o as X, u as U, aC as Z, aD as q, t as v, aE as ee, n as h } from "./index-DK6LMjBA.js";
|
|
2
2
|
import { useState as T, useEffect as te, useCallback as V } from "react";
|
|
3
3
|
function re(e) {
|
|
4
4
|
const o = e.toUpperCase().indexOf("WHERE"), r = e.toUpperCase().indexOf("GROUP BY"), t = e.toUpperCase().indexOf("LIMIT"), i = e.toUpperCase().indexOf("ORDER BY");
|
|
@@ -207,7 +207,7 @@ function de() {
|
|
|
207
207
|
clearSelectedFrameId: O,
|
|
208
208
|
addFrame: x,
|
|
209
209
|
setIsDashboardPanelOpen: R
|
|
210
|
-
} = X(), I = U((l) => l.selectedSheetId), W = U((l) => l.selectedFrameId), D = U((l) => l.dashboard), B = U((l) => l.filterValues),
|
|
210
|
+
} = X(), I = U((l) => l.selectedSheetId), W = U((l) => l.selectedFrameId), D = U((l) => l.dashboard), B = U((l) => l.filterValues), E = Z((t == null ? void 0 : t.id) || "", {
|
|
211
211
|
enabled: !!(t != null && t.id) && !!(e != null && e.accessToken)
|
|
212
212
|
}), Q = V(
|
|
213
213
|
async (l) => {
|
|
@@ -289,11 +289,11 @@ function de() {
|
|
|
289
289
|
), P = (f == null ? void 0 : f.frameObject) ?? ((g = f == null ? void 0 : f.visual) == null ? void 0 : g.frameObject);
|
|
290
290
|
if (!P)
|
|
291
291
|
return { success: !1, error: "Visual has no frame data" };
|
|
292
|
-
const
|
|
293
|
-
if (!(
|
|
292
|
+
const y = H(P);
|
|
293
|
+
if (!(y != null && y.cards) || y.cards.length === 0)
|
|
294
294
|
return { success: !1, error: "Visual frame is malformed" };
|
|
295
295
|
const j = {
|
|
296
|
-
...q(
|
|
296
|
+
...q(y),
|
|
297
297
|
visualId: l.id
|
|
298
298
|
// Link this frame to the library visual
|
|
299
299
|
};
|
|
@@ -315,14 +315,14 @@ function de() {
|
|
|
315
315
|
]
|
|
316
316
|
);
|
|
317
317
|
return {
|
|
318
|
-
visual:
|
|
319
|
-
isLoading:
|
|
320
|
-
isError:
|
|
321
|
-
error:
|
|
318
|
+
visual: E.data,
|
|
319
|
+
isLoading: E.isLoading,
|
|
320
|
+
isError: E.isError,
|
|
321
|
+
error: E.error,
|
|
322
322
|
handleEditLibraryVisual: Q,
|
|
323
323
|
handleAddLibraryVisual: k,
|
|
324
324
|
getUpdatedFrame: ne().getUpdatedFrame,
|
|
325
|
-
refetch:
|
|
325
|
+
refetch: E.refetch
|
|
326
326
|
};
|
|
327
327
|
}
|
|
328
328
|
export {
|
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-o_l1PmNv.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,6 @@
|
|
|
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-o_l1PmNv.js"),j=require("./types/index.cjs"),a=require("react/jsx-runtime"),g=require("react"),E=require("./chunks/resource-management-panel-C-ijbO2j.js"),h=require("./chunks/schedule-dashboard-_UAuGQ_4.js");require("react-dom");function M(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(o,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return o.default=r,Object.freeze(o)}const m=M(g);/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const P=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 N(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 d;return(d=n.dashboard)==null?void 0:d.sheets}),{card:s,frame:i}=g.useMemo(()=>{const n=o==null?void 0:o.flatMap(t=>t.frames),d=n==null?void 0:n.flatMap(t=>t==null?void 0:t.cards),C=d==null?void 0:d.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:d})=>a.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:d,customerFacingMessage:"Error creating visual. Please try again."}),children:a.jsx(e.DashboardCard,{card:s,frame:i})})})}function k({name:r,items:o,value:s,onChange:i,isLoading:n,isError:d,refetch:C,className:f,icon:t,showNone:p=!1}){const u=m.useRef(null),[b,x]=m.useState(!1),[y,v]=m.useState("100%"),D=p?[...o||[],{id:"none",name:"None"}]:o;m.useLayoutEffect(()=>{u.current&&v(u.current.offsetWidth)},[]);function T(){var l;return n?"Loading...":d?"Error":s?(l=o==null?void 0:o.find(
|
|
6
|
+
*/const P=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 N(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 d;return(d=n.dashboard)==null?void 0:d.sheets}),{card:s,frame:i}=g.useMemo(()=>{const n=o==null?void 0:o.flatMap(t=>t.frames),d=n==null?void 0:n.flatMap(t=>t==null?void 0:t.cards),C=d==null?void 0:d.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:d})=>a.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:d,customerFacingMessage:"Error creating visual. Please try again."}),children:a.jsx(e.DashboardCard,{card:s,frame:i})})})}function k({name:r,items:o,value:s,onChange:i,isLoading:n,isError:d,refetch:C,className:f,icon:t,showNone:p=!1}){const u=m.useRef(null),[b,x]=m.useState(!1),[y,v]=m.useState("100%"),D=p?[...o||[],{id:"none",name:"None"}]:o;m.useLayoutEffect(()=>{u.current&&v(u.current.offsetWidth)},[]);function T(){var l;return n?"Loading...":d?"Error":s?(l=o==null?void 0:o.find(c=>c.id===s))==null?void 0:l.name:`Select ${r}`}function S(l,c){i(c),x(!1)}return a.jsxs(e.Popover,{open:b,onOpenChange:x,children:[a.jsx(e.PopoverTrigger,{asChild:!0,children:a.jsxs(e.Button,{ref:u,variant:"outline",role:"combobox","aria-expanded":b,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:T()})]}),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(P,{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(l=>a.jsx(e.CommandItem,{className:"overflow-x-auto",value:l.name,onSelect:c=>S(c,l.id),children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(e.Check,{className:e.cn("size-4",s===l.id?"opacity-100":"opacity-0")}),a.jsx("div",{title:l.name,children:l.name})]})},l.id))})]})]})})]})}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=j.EMPTY_SELECTION;exports.ResourceManagementPanel=E.ResourceManagementPanel;exports.AdvancedModeToggle=h.AdvancedModeToggle;exports.ScheduleDashboard=h.ScheduleDashboard;exports.UnsavedChangesAlert=h.UnsavedChangesAlert;exports.VisualEditingControls=h.VisualEditingControls;exports.usePristineSnapshotInitializer=h.usePristineSnapshotInitializer;exports.Combobox=k;exports.Visual=N;
|