semaphor 0.0.128 → 0.0.130
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-BMLlOkS9.js +1539 -0
- package/dist/chunks/dashboard-controls-BdQcYRkf.js +26 -0
- package/dist/chunks/dashboard-export-dialog-BpNaUA5x.js +6 -0
- package/dist/chunks/dashboard-export-dialog-CbMcLZvW.js +602 -0
- package/dist/chunks/dashboard-json-DD-d9gYu.js +66 -0
- package/dist/chunks/dashboard-json-DgQozDAv.js +1 -0
- package/dist/chunks/edit-dashboard-visual-CR3NqJ7m.js +200 -0
- package/dist/chunks/edit-dashboard-visual-CRMhXxdG.js +15517 -0
- package/dist/chunks/editor-action-buttons-CNQtSzD5.js +270 -0
- package/dist/chunks/editor-action-buttons-DYrSZQhJ.js +6 -0
- package/dist/chunks/index-CReqnEJI.js +1081 -0
- package/dist/chunks/{index-nm88dVBB.js → index-QdSI9E0a.js} +89207 -74907
- package/dist/chunks/resource-management-panel-CBXn6QHi.js +895 -0
- package/dist/chunks/resource-management-panel-CXSx9QhW.js +6 -0
- package/dist/chunks/use-click-outside-B9T3lmcw.js +1 -0
- package/dist/chunks/use-click-outside-CMeO_QFI.js +16 -0
- package/dist/chunks/use-visual-utils-BDuNB0Iz.js +1 -0
- package/dist/chunks/use-visual-utils-BnCl386t.js +331 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +6 -1
- package/dist/index.js +194 -111
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +4 -4
- package/dist/types/dashboard.d.ts +524 -18
- package/dist/types/main.d.ts +948 -105
- package/dist/types/surfboard.d.ts +524 -18
- package/dist/types/types.d.ts +524 -18
- package/package.json +11 -7
- package/dist/chunks/dashboard-plus-DuenxiNV.js +0 -335
- package/dist/chunks/dashboard-plus-vO1PNFhv.js +0 -22561
- package/dist/chunks/index-BRkgsUH0.js +0 -985
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
import { jsx as e, jsxs as a, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { b as J, as as W, at as $, au as H, av as _, aw as K, ax as A, ay as Q, az as Z, aA as T, aB as X, B as P, L as V, f as E, i as ee, u as b, ao as ae, g as Y, aC as se, aD as O, l as v, aE as te, aF as re, c as I, aG as B, aH as L, aI as z, aJ as U, aK as G, e as oe, aL as le, aM as ne, aN as de, aO as ie, aP as ce, aQ as he, aR as ue, aS as me, aT as pe, aU as fe, aV as ve, aW as ge, T as be, I as Ce, aX as we, aY as xe, an as De, aZ as ye, a_ as R, a$ as Ne, b0 as Se, b1 as Ae, b2 as Pe, b3 as Fe, b4 as ke, W as Ie } from "./index-QdSI9E0a.js";
|
|
3
|
+
import { E as Ee, V as Me, a as Te, b as Ve, S as j, c as Oe } from "./editor-action-buttons-CNQtSzD5.js";
|
|
4
|
+
import Be, { useState as C, useContext as Le, useEffect as ze } from "react";
|
|
5
|
+
import { a as q } from "./use-visual-utils-BnCl386t.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 Ue = J("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 Ge({
|
|
18
|
+
open: c,
|
|
19
|
+
onOpenChange: i,
|
|
20
|
+
isLibraryVisual: r,
|
|
21
|
+
currentVisualName: o,
|
|
22
|
+
isSaving: d = !1,
|
|
23
|
+
onConfirm: m
|
|
24
|
+
}) {
|
|
25
|
+
const [s, l] = C(
|
|
26
|
+
r && o ? `Copy of ${o}` : o || ""
|
|
27
|
+
), [n, f] = C(""), [g, w] = C(!r), [p, N] = C(!0);
|
|
28
|
+
Be.useEffect(() => {
|
|
29
|
+
c && (l(
|
|
30
|
+
r && o ? `Copy of ${o}` : o || ""
|
|
31
|
+
), f(""), w(!r), N(!0));
|
|
32
|
+
}, [c, r, o]);
|
|
33
|
+
const x = () => {
|
|
34
|
+
s.trim() && (!g && !p || m({
|
|
35
|
+
name: s.trim(),
|
|
36
|
+
description: n.trim() || void 0,
|
|
37
|
+
saveToLibrary: g,
|
|
38
|
+
saveToCurrentDashboard: p
|
|
39
|
+
}));
|
|
40
|
+
}, D = s.trim() && (g || p);
|
|
41
|
+
return /* @__PURE__ */ e(W, { open: c, onOpenChange: i, children: /* @__PURE__ */ a($, { className: "sm:max-w-[425px]", children: [
|
|
42
|
+
/* @__PURE__ */ a(H, { children: [
|
|
43
|
+
/* @__PURE__ */ e(_, { children: "Save Visual As" }),
|
|
44
|
+
/* @__PURE__ */ e(K, { children: r ? "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(A, { htmlFor: "name", children: "Name" }),
|
|
49
|
+
/* @__PURE__ */ e(
|
|
50
|
+
Q,
|
|
51
|
+
{
|
|
52
|
+
id: "name",
|
|
53
|
+
value: s,
|
|
54
|
+
onChange: (t) => l(t.target.value),
|
|
55
|
+
placeholder: "Enter visual name",
|
|
56
|
+
disabled: d
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] }),
|
|
60
|
+
/* @__PURE__ */ a("div", { className: "grid gap-2", children: [
|
|
61
|
+
/* @__PURE__ */ e(A, { htmlFor: "description", children: "Description (optional)" }),
|
|
62
|
+
/* @__PURE__ */ e(
|
|
63
|
+
Z,
|
|
64
|
+
{
|
|
65
|
+
id: "description",
|
|
66
|
+
value: n,
|
|
67
|
+
onChange: (t) => f(t.target.value),
|
|
68
|
+
placeholder: "Enter visual description",
|
|
69
|
+
rows: 3,
|
|
70
|
+
disabled: d
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
75
|
+
/* @__PURE__ */ e(A, { 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
|
+
T,
|
|
80
|
+
{
|
|
81
|
+
id: "save-to-dashboard",
|
|
82
|
+
checked: p,
|
|
83
|
+
onCheckedChange: (t) => N(!!t),
|
|
84
|
+
disabled: d
|
|
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: r ? "(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
|
+
T,
|
|
102
|
+
{
|
|
103
|
+
id: "save-to-library",
|
|
104
|
+
checked: g,
|
|
105
|
+
onCheckedChange: (t) => w(!!t),
|
|
106
|
+
disabled: d
|
|
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: r ? "(save as new reusable visual)" : "(make available to all dashboards)" })
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
] })
|
|
121
|
+
] }),
|
|
122
|
+
!g && !p && /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: "Please select at least one destination" })
|
|
123
|
+
] })
|
|
124
|
+
] }),
|
|
125
|
+
/* @__PURE__ */ a(X, { children: [
|
|
126
|
+
/* @__PURE__ */ e(
|
|
127
|
+
P,
|
|
128
|
+
{
|
|
129
|
+
variant: "outline",
|
|
130
|
+
onClick: () => i(!1),
|
|
131
|
+
disabled: d,
|
|
132
|
+
children: "Cancel"
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ a(P, { onClick: x, disabled: !D || d, children: [
|
|
136
|
+
d && /* @__PURE__ */ e(V, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
137
|
+
d ? "Saving..." : "Save"
|
|
138
|
+
] })
|
|
139
|
+
] })
|
|
140
|
+
] }) });
|
|
141
|
+
}
|
|
142
|
+
function Re() {
|
|
143
|
+
const [c, i] = C(!1), [r, o] = C(!1), [d, m] = C(null), s = E((u) => u.frame), l = E((u) => u.card), n = ee(), f = b((u) => u.selectedSheetId), g = b(
|
|
144
|
+
(u) => u.actions.setIsDashboardPanelOpen
|
|
145
|
+
), { getUpdatedFrame: w } = q(), { selectVisual: p } = ae(), { addFrame: N, setSelectedFrameId: x, setIsVisualEditing: D } = Y(), t = !!(s != null && s.visualId), S = (() => {
|
|
146
|
+
var u, y;
|
|
147
|
+
return ((u = s == null ? void 0 : s.cards) == null ? void 0 : u.length) === 1 && ((y = s.cards[0]) != null && y.title) ? s.cards[0].title : n != null && n.title ? n.title : (l == null ? void 0 : l.title) || "Untitled Visual";
|
|
148
|
+
})(), h = se((u) => {
|
|
149
|
+
if (u != null && u.id) {
|
|
150
|
+
if (p(u), r && d && f) {
|
|
151
|
+
const y = {
|
|
152
|
+
...d,
|
|
153
|
+
id: O(),
|
|
154
|
+
visualId: u.id
|
|
155
|
+
// Link to the newly created library visual
|
|
156
|
+
};
|
|
157
|
+
N(f, y, "end"), x(y.id), o(!1), m(null), D(!1);
|
|
158
|
+
}
|
|
159
|
+
g(!0), i(!1);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return {
|
|
163
|
+
saveAsDialogOpen: c,
|
|
164
|
+
setSaveAsDialogOpen: i,
|
|
165
|
+
handleSaveAs: async (u) => {
|
|
166
|
+
if (!f) {
|
|
167
|
+
v.error("No sheet selected");
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const y = w(), M = y.cards.length === 1 ? {
|
|
171
|
+
...y,
|
|
172
|
+
cards: y.cards.map((k) => ({
|
|
173
|
+
...k,
|
|
174
|
+
title: u.name
|
|
175
|
+
// Use visual name as card title
|
|
176
|
+
}))
|
|
177
|
+
} : y;
|
|
178
|
+
if (u.saveToLibrary) {
|
|
179
|
+
o(u.saveToCurrentDashboard), m(M);
|
|
180
|
+
const k = {
|
|
181
|
+
title: u.name,
|
|
182
|
+
description: u.description,
|
|
183
|
+
frameObject: M,
|
|
184
|
+
// Card title synced for single-card frames
|
|
185
|
+
isPrivate: !1
|
|
186
|
+
};
|
|
187
|
+
h.mutate(k);
|
|
188
|
+
} else if (u.saveToCurrentDashboard) {
|
|
189
|
+
const k = {
|
|
190
|
+
...M,
|
|
191
|
+
// Card title already synced
|
|
192
|
+
id: O(),
|
|
193
|
+
visualId: void 0
|
|
194
|
+
// Explicitly no visualId for local visuals
|
|
195
|
+
};
|
|
196
|
+
N(f, k, "end"), x(k.id), v.success("Visual saved to dashboard"), i(!1), D(!1);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
isLibraryVisual: t,
|
|
200
|
+
currentVisualName: S,
|
|
201
|
+
isSaving: h.isPending
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function Ye({
|
|
205
|
+
className: c
|
|
206
|
+
}) {
|
|
207
|
+
const i = E((h) => h.frame), r = E((h) => h.card), o = te((h) => h.selectedVisual), d = b((h) => h.selectedFrameId), m = b((h) => h.selectedSheetId), { setIsVisualEditing: s } = Y(), l = !!(i != null && i.visualId || o != null && o.id), n = !!(i != null && i.visualId && d), f = l && !n, {
|
|
208
|
+
saveAsDialogOpen: g,
|
|
209
|
+
setSaveAsDialogOpen: w,
|
|
210
|
+
handleSaveAs: p,
|
|
211
|
+
isLibraryVisual: N,
|
|
212
|
+
currentVisualName: x,
|
|
213
|
+
isSaving: D
|
|
214
|
+
} = Re(), { handleAddLibraryVisual: t } = q(), S = async () => {
|
|
215
|
+
if (!m) {
|
|
216
|
+
v.error("No dashboard sheet selected");
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (!o) {
|
|
220
|
+
v.error("No visual selected");
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const h = await t(o);
|
|
224
|
+
h.success ? (v.success("Visual added to dashboard"), s(!1)) : v.error(h.error || "Failed to add visual to dashboard");
|
|
225
|
+
};
|
|
226
|
+
return /* @__PURE__ */ a(F, { children: [
|
|
227
|
+
!l && /* @__PURE__ */ e(Ee, { className: c, variant: "default" }),
|
|
228
|
+
l && /* @__PURE__ */ a(F, { children: [
|
|
229
|
+
n && /* @__PURE__ */ e(Me, { className: c }),
|
|
230
|
+
f && m && r && (r.sql || re(r.config)) && /* @__PURE__ */ a(
|
|
231
|
+
P,
|
|
232
|
+
{
|
|
233
|
+
onClick: S,
|
|
234
|
+
className: I(c),
|
|
235
|
+
size: "sm",
|
|
236
|
+
variant: "outline",
|
|
237
|
+
children: [
|
|
238
|
+
/* @__PURE__ */ e(Ue, { className: "mr-2 size-4 font-bold" }),
|
|
239
|
+
"Add to Dashboard"
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
),
|
|
243
|
+
f && /* @__PURE__ */ e(Te, { className: c, variant: "default" }),
|
|
244
|
+
n && /* @__PURE__ */ e(Ve, { className: c }),
|
|
245
|
+
/* @__PURE__ */ a(B, { modal: !1, children: [
|
|
246
|
+
/* @__PURE__ */ e(L, { asChild: !0, children: /* @__PURE__ */ e(
|
|
247
|
+
P,
|
|
248
|
+
{
|
|
249
|
+
variant: "outline",
|
|
250
|
+
size: "sm",
|
|
251
|
+
className: I(c, "w-8 p-0"),
|
|
252
|
+
children: /* @__PURE__ */ e(z, { className: "h-4 w-4" })
|
|
253
|
+
}
|
|
254
|
+
) }),
|
|
255
|
+
/* @__PURE__ */ e(U, { align: "end", children: /* @__PURE__ */ a(
|
|
256
|
+
G,
|
|
257
|
+
{
|
|
258
|
+
onClick: (h) => {
|
|
259
|
+
h.stopPropagation(), w(!0);
|
|
260
|
+
},
|
|
261
|
+
children: [
|
|
262
|
+
/* @__PURE__ */ e(j, { className: "mr-2 h-4 w-4" }),
|
|
263
|
+
"Save As..."
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
) })
|
|
267
|
+
] })
|
|
268
|
+
] }),
|
|
269
|
+
!l && /* @__PURE__ */ a(B, { modal: !1, children: [
|
|
270
|
+
/* @__PURE__ */ e(L, { asChild: !0, children: /* @__PURE__ */ e(
|
|
271
|
+
P,
|
|
272
|
+
{
|
|
273
|
+
variant: "outline",
|
|
274
|
+
size: "sm",
|
|
275
|
+
className: I(c, "w-8 p-0"),
|
|
276
|
+
children: /* @__PURE__ */ e(z, { className: "h-4 w-4" })
|
|
277
|
+
}
|
|
278
|
+
) }),
|
|
279
|
+
/* @__PURE__ */ e(U, { align: "end", children: /* @__PURE__ */ a(G, { onClick: () => w(!0), children: [
|
|
280
|
+
/* @__PURE__ */ e(j, { className: "mr-2 h-4 w-4" }),
|
|
281
|
+
"Save As..."
|
|
282
|
+
] }) })
|
|
283
|
+
] }),
|
|
284
|
+
/* @__PURE__ */ e(Oe, { className: c }),
|
|
285
|
+
/* @__PURE__ */ e(
|
|
286
|
+
Ge,
|
|
287
|
+
{
|
|
288
|
+
open: g,
|
|
289
|
+
onOpenChange: (h) => {
|
|
290
|
+
D || w(h);
|
|
291
|
+
},
|
|
292
|
+
isLibraryVisual: N,
|
|
293
|
+
currentVisualName: x,
|
|
294
|
+
isSaving: D,
|
|
295
|
+
onConfirm: p
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
] });
|
|
299
|
+
}
|
|
300
|
+
function qe({
|
|
301
|
+
className: c,
|
|
302
|
+
//labelClassName,
|
|
303
|
+
switchClassName: i
|
|
304
|
+
}) {
|
|
305
|
+
const r = E((l) => l.isDevMode), o = b((l) => l.isVisualEditing), { setIsDevMode: d } = oe(), { config: m } = Le(le).tokenProps, s = (m == null ? void 0 : m.showAdvancedMode) !== !1;
|
|
306
|
+
return !o || !s ? null : /* @__PURE__ */ a("div", { className: I("flex items-center space-x-2", c), children: [
|
|
307
|
+
/* @__PURE__ */ e(
|
|
308
|
+
ne,
|
|
309
|
+
{
|
|
310
|
+
className: I("", i),
|
|
311
|
+
checked: r,
|
|
312
|
+
onCheckedChange: () => d(!r),
|
|
313
|
+
id: "advanced-mode",
|
|
314
|
+
icon: /* @__PURE__ */ e(de, { className: "h-4 w-4" }),
|
|
315
|
+
tooltip: r ? "Standard Mode" : "Advanced Mode"
|
|
316
|
+
}
|
|
317
|
+
),
|
|
318
|
+
/* @__PURE__ */ e("label", { htmlFor: "advanced-mode", className: "sr-only", children: "Advanced Mode" })
|
|
319
|
+
] });
|
|
320
|
+
}
|
|
321
|
+
function Je({
|
|
322
|
+
open: c,
|
|
323
|
+
onOpenChange: i,
|
|
324
|
+
onSave: r,
|
|
325
|
+
onDiscard: o,
|
|
326
|
+
isSaving: d
|
|
327
|
+
}) {
|
|
328
|
+
return /* @__PURE__ */ e(ie, { open: c, onOpenChange: (s) => {
|
|
329
|
+
!s && d || i(s);
|
|
330
|
+
}, children: /* @__PURE__ */ a(ce, { className: "max-w-md", children: [
|
|
331
|
+
/* @__PURE__ */ a(he, { 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(ue, { className: "h-5 w-5 text-amber-600" }) }),
|
|
334
|
+
/* @__PURE__ */ e(me, { className: "text-xl", children: "Unsaved Changes" })
|
|
335
|
+
] }),
|
|
336
|
+
/* @__PURE__ */ e(pe, { 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(fe, { className: "flex-col gap-2 sm:flex-row sm:gap-2", children: [
|
|
339
|
+
/* @__PURE__ */ e(
|
|
340
|
+
ve,
|
|
341
|
+
{
|
|
342
|
+
disabled: d,
|
|
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: o,
|
|
351
|
+
disabled: d,
|
|
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
|
+
ge,
|
|
358
|
+
{
|
|
359
|
+
onClick: r,
|
|
360
|
+
disabled: d,
|
|
361
|
+
className: "order-3 m-0 bg-primary text-primary-foreground hover:bg-primary/90 sm:order-3",
|
|
362
|
+
children: d ? /* @__PURE__ */ a(F, { children: [
|
|
363
|
+
/* @__PURE__ */ e(V, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
364
|
+
"Saving..."
|
|
365
|
+
] }) : "Save & Close"
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
] })
|
|
369
|
+
] }) });
|
|
370
|
+
}
|
|
371
|
+
function Qe(c, i, r, o) {
|
|
372
|
+
ze(() => {
|
|
373
|
+
c && !r && i && o(be(i));
|
|
374
|
+
}, [c, r, i, o]);
|
|
375
|
+
}
|
|
376
|
+
function Ze({
|
|
377
|
+
triggerButtonClassName: c
|
|
378
|
+
}) {
|
|
379
|
+
const [i, r] = C(!1), o = b((l) => {
|
|
380
|
+
var n;
|
|
381
|
+
return (n = l.dashboard) == null ? void 0 : n.id;
|
|
382
|
+
}), d = b((l) => {
|
|
383
|
+
var n;
|
|
384
|
+
return (n = l.dashboard) == null ? void 0 : n.title;
|
|
385
|
+
}), m = b((l) => {
|
|
386
|
+
var n;
|
|
387
|
+
return (n = l.dashboard) == null ? void 0 : n.sheets;
|
|
388
|
+
}), s = b((l) => l.selectedSheetId);
|
|
389
|
+
return m == null || m.find((l) => l.id === s), o ? /* @__PURE__ */ a(F, { children: [
|
|
390
|
+
/* @__PURE__ */ e(
|
|
391
|
+
Ce,
|
|
392
|
+
{
|
|
393
|
+
tooltip: "Schedule Dashboard",
|
|
394
|
+
className: I("h-7 p-2", c),
|
|
395
|
+
onClick: () => r(!0),
|
|
396
|
+
children: /* @__PURE__ */ e(we, { className: "size-4" })
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
/* @__PURE__ */ e(
|
|
400
|
+
xe,
|
|
401
|
+
{
|
|
402
|
+
open: i,
|
|
403
|
+
onOpenChange: r,
|
|
404
|
+
dashboardId: o,
|
|
405
|
+
dashboardName: d
|
|
406
|
+
}
|
|
407
|
+
)
|
|
408
|
+
] }) : null;
|
|
409
|
+
}
|
|
410
|
+
function ea({
|
|
411
|
+
open: c,
|
|
412
|
+
onOpenChange: i
|
|
413
|
+
}) {
|
|
414
|
+
const [r, o] = C(!1), [d, m] = C(!1), [s, l] = C({
|
|
415
|
+
sheetSelection: "current",
|
|
416
|
+
protectPdf: !1,
|
|
417
|
+
password: ""
|
|
418
|
+
}), n = b((t) => {
|
|
419
|
+
var S;
|
|
420
|
+
return (S = t.dashboard) == null ? void 0 : S.sheets;
|
|
421
|
+
}), f = b((t) => t.selectedSheetId), { authToken: g, tokenProps: w } = De(), p = n == null ? void 0 : n.find((t) => t.id === f), N = ((n == null ? void 0 : n.length) || 0) > 1, x = () => {
|
|
422
|
+
l({
|
|
423
|
+
sheetSelection: "current",
|
|
424
|
+
protectPdf: !1,
|
|
425
|
+
password: ""
|
|
426
|
+
}), o(!1), i(!1);
|
|
427
|
+
};
|
|
428
|
+
async function D() {
|
|
429
|
+
if (s.protectPdf && !s.password) {
|
|
430
|
+
v.error("Please enter a password to protect the PDF");
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
m(!0);
|
|
434
|
+
const t = s.sheetSelection === "all" ? "Generating PDF for all sheets... This may take a while." : s.protectPdf ? "Generating protected PDF... may take up to 60 seconds" : "Generating PDF... may take up to 60 seconds", S = v.loading(t);
|
|
435
|
+
try {
|
|
436
|
+
await Ie(
|
|
437
|
+
w.apiServiceUrl,
|
|
438
|
+
g,
|
|
439
|
+
s.protectPdf ? s.password : void 0,
|
|
440
|
+
s.sheetSelection
|
|
441
|
+
), v.dismiss(S);
|
|
442
|
+
const h = s.sheetSelection === "all" ? "All sheets PDF downloaded successfully!" : s.protectPdf ? "Protected PDF downloaded successfully!" : "PDF downloaded successfully!";
|
|
443
|
+
v.success(h, {
|
|
444
|
+
duration: 2e3
|
|
445
|
+
}), x();
|
|
446
|
+
} catch (h) {
|
|
447
|
+
v.dismiss(S), v.error("Failed to download PDF", {
|
|
448
|
+
description: "Please try again or contact support.",
|
|
449
|
+
richColors: !0
|
|
450
|
+
}), console.error("PDF download error:", h);
|
|
451
|
+
} finally {
|
|
452
|
+
m(!1);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
return /* @__PURE__ */ e(
|
|
456
|
+
W,
|
|
457
|
+
{
|
|
458
|
+
open: c,
|
|
459
|
+
onOpenChange: (t) => {
|
|
460
|
+
if (!t) {
|
|
461
|
+
x();
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
i(!0);
|
|
465
|
+
},
|
|
466
|
+
children: /* @__PURE__ */ a($, { className: "sm:max-w-[425px]", children: [
|
|
467
|
+
/* @__PURE__ */ a(H, { children: [
|
|
468
|
+
/* @__PURE__ */ e(_, { children: "Export Dashboard" }),
|
|
469
|
+
/* @__PURE__ */ e(K, { children: "Export your dashboard as a PDF document." })
|
|
470
|
+
] }),
|
|
471
|
+
/* @__PURE__ */ a("div", { className: "space-y-4 py-4", children: [
|
|
472
|
+
N && /* @__PURE__ */ a(F, { children: [
|
|
473
|
+
/* @__PURE__ */ a("div", { className: "space-y-3", children: [
|
|
474
|
+
/* @__PURE__ */ e(A, { children: "Export Scope" }),
|
|
475
|
+
/* @__PURE__ */ a(
|
|
476
|
+
ye,
|
|
477
|
+
{
|
|
478
|
+
value: s.sheetSelection,
|
|
479
|
+
onValueChange: (t) => l({
|
|
480
|
+
...s,
|
|
481
|
+
sheetSelection: t
|
|
482
|
+
}),
|
|
483
|
+
children: [
|
|
484
|
+
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
485
|
+
/* @__PURE__ */ e(R, { value: "current", id: "scope-current" }),
|
|
486
|
+
/* @__PURE__ */ a(
|
|
487
|
+
A,
|
|
488
|
+
{
|
|
489
|
+
htmlFor: "scope-current",
|
|
490
|
+
className: "cursor-pointer font-normal",
|
|
491
|
+
children: [
|
|
492
|
+
"This sheet (",
|
|
493
|
+
(p == null ? void 0 : p.title) || "Current",
|
|
494
|
+
")"
|
|
495
|
+
]
|
|
496
|
+
}
|
|
497
|
+
)
|
|
498
|
+
] }),
|
|
499
|
+
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
500
|
+
/* @__PURE__ */ e(R, { value: "all", id: "scope-all" }),
|
|
501
|
+
/* @__PURE__ */ a(
|
|
502
|
+
A,
|
|
503
|
+
{
|
|
504
|
+
htmlFor: "scope-all",
|
|
505
|
+
className: "cursor-pointer font-normal",
|
|
506
|
+
children: [
|
|
507
|
+
"All sheets (",
|
|
508
|
+
n == null ? void 0 : n.length,
|
|
509
|
+
" sheets)"
|
|
510
|
+
]
|
|
511
|
+
}
|
|
512
|
+
)
|
|
513
|
+
] })
|
|
514
|
+
]
|
|
515
|
+
}
|
|
516
|
+
)
|
|
517
|
+
] }),
|
|
518
|
+
/* @__PURE__ */ e(Ne, {})
|
|
519
|
+
] }),
|
|
520
|
+
/* @__PURE__ */ a("div", { className: "space-y-3", children: [
|
|
521
|
+
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
522
|
+
/* @__PURE__ */ e(
|
|
523
|
+
T,
|
|
524
|
+
{
|
|
525
|
+
id: "protect-pdf",
|
|
526
|
+
checked: s.protectPdf,
|
|
527
|
+
onCheckedChange: (t) => {
|
|
528
|
+
l({
|
|
529
|
+
...s,
|
|
530
|
+
protectPdf: t,
|
|
531
|
+
password: t ? s.password : ""
|
|
532
|
+
}), t || o(!1);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
),
|
|
536
|
+
/* @__PURE__ */ a(
|
|
537
|
+
A,
|
|
538
|
+
{
|
|
539
|
+
htmlFor: "protect-pdf",
|
|
540
|
+
className: "flex cursor-pointer items-center text-sm font-normal",
|
|
541
|
+
children: [
|
|
542
|
+
/* @__PURE__ */ e(Se, { className: "mr-2 h-3.5 w-3.5" }),
|
|
543
|
+
"Password protect PDF"
|
|
544
|
+
]
|
|
545
|
+
}
|
|
546
|
+
)
|
|
547
|
+
] }),
|
|
548
|
+
s.protectPdf && /* @__PURE__ */ a("div", { className: "ml-6 space-y-2", children: [
|
|
549
|
+
/* @__PURE__ */ e(A, { htmlFor: "pdf-password", className: "text-sm", children: "Password" }),
|
|
550
|
+
/* @__PURE__ */ a("div", { className: "relative", children: [
|
|
551
|
+
/* @__PURE__ */ e(
|
|
552
|
+
Ae,
|
|
553
|
+
{
|
|
554
|
+
id: "pdf-password",
|
|
555
|
+
type: r ? "text" : "password",
|
|
556
|
+
value: s.password,
|
|
557
|
+
onChange: (t) => l({ ...s, password: t.target.value }),
|
|
558
|
+
placeholder: "Enter password",
|
|
559
|
+
className: "pr-10",
|
|
560
|
+
onKeyDown: (t) => {
|
|
561
|
+
t.key === "Enter" && s.password && D();
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
),
|
|
565
|
+
/* @__PURE__ */ e(
|
|
566
|
+
P,
|
|
567
|
+
{
|
|
568
|
+
type: "button",
|
|
569
|
+
variant: "ghost",
|
|
570
|
+
size: "sm",
|
|
571
|
+
className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
|
|
572
|
+
onClick: () => o(!r),
|
|
573
|
+
children: r ? /* @__PURE__ */ e(Pe, { className: "h-4 w-4 text-muted-foreground" }) : /* @__PURE__ */ e(Fe, { className: "h-4 w-4 text-muted-foreground" })
|
|
574
|
+
}
|
|
575
|
+
)
|
|
576
|
+
] }),
|
|
577
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: "Recipients will need this password to open the PDF" })
|
|
578
|
+
] })
|
|
579
|
+
] })
|
|
580
|
+
] }),
|
|
581
|
+
/* @__PURE__ */ a(X, { children: [
|
|
582
|
+
/* @__PURE__ */ e(P, { variant: "outline", onClick: x, disabled: d, children: "Cancel" }),
|
|
583
|
+
/* @__PURE__ */ e(P, { onClick: D, disabled: d, children: d ? /* @__PURE__ */ a(F, { children: [
|
|
584
|
+
/* @__PURE__ */ e(V, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
585
|
+
"Exporting..."
|
|
586
|
+
] }) : /* @__PURE__ */ a(F, { children: [
|
|
587
|
+
/* @__PURE__ */ e(ke, { className: "mr-2 h-4 w-4" }),
|
|
588
|
+
"Export"
|
|
589
|
+
] }) })
|
|
590
|
+
] })
|
|
591
|
+
] })
|
|
592
|
+
}
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
export {
|
|
596
|
+
qe as A,
|
|
597
|
+
ea as D,
|
|
598
|
+
Ze as S,
|
|
599
|
+
Je as U,
|
|
600
|
+
Ye as V,
|
|
601
|
+
Qe as u
|
|
602
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsxs as o, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { u as s, c as l, B as h, X as d, d as c } from "./index-QdSI9E0a.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import "react-dom";
|
|
5
|
+
function N() {
|
|
6
|
+
const e = s((a) => a.dashboard), t = s((a) => a.actions.setDashboard), n = s(
|
|
7
|
+
(a) => a.showDashboardJSON
|
|
8
|
+
), i = s(
|
|
9
|
+
(a) => a.actions.setShowDashboardJSON
|
|
10
|
+
);
|
|
11
|
+
return /* @__PURE__ */ o(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
className: l("relative p-2", {
|
|
15
|
+
hidden: !n
|
|
16
|
+
}),
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ o(
|
|
19
|
+
h,
|
|
20
|
+
{
|
|
21
|
+
variant: "secondary",
|
|
22
|
+
size: "sm",
|
|
23
|
+
className: "absolute right-2 top-2 z-10 h-8",
|
|
24
|
+
onClick: () => i(!1),
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ r(d, { className: "mr-2 h-4 w-4" }),
|
|
27
|
+
"Close"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
/* @__PURE__ */ r(
|
|
32
|
+
c,
|
|
33
|
+
{
|
|
34
|
+
onChange: (a) => {
|
|
35
|
+
if (a)
|
|
36
|
+
try {
|
|
37
|
+
JSON.parse(a), t(JSON.parse(a));
|
|
38
|
+
} catch {
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
defaultLanguage: "json",
|
|
42
|
+
className: "h-[550px] overflow-y-auto",
|
|
43
|
+
value: JSON.stringify(e, null, 2),
|
|
44
|
+
options: {
|
|
45
|
+
minimap: {
|
|
46
|
+
enabled: !1
|
|
47
|
+
},
|
|
48
|
+
// lineNumbers: 'off',
|
|
49
|
+
glyphMargin: !1,
|
|
50
|
+
wordWrap: "on",
|
|
51
|
+
scrollbar: {
|
|
52
|
+
verticalScrollbarSize: 0,
|
|
53
|
+
horizontalScrollbarSize: 0
|
|
54
|
+
},
|
|
55
|
+
fontSize: 12,
|
|
56
|
+
renderLineHighlight: "none"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
N as default
|
|
66
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),a=require("./index-CReqnEJI.js");require("react");require("react-dom");function i(){const o=a.useDashboardStore(e=>e.dashboard),r=a.useDashboardStore(e=>e.actions.setDashboard),t=a.useDashboardStore(e=>e.showDashboardJSON),n=a.useDashboardStore(e=>e.actions.setShowDashboardJSON);return s.jsxs("div",{className:a.cn("relative p-2",{hidden:!t}),children:[s.jsxs(a.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>n(!1),children:[s.jsx(a.X,{className:"mr-2 h-4 w-4"}),"Close"]}),s.jsx(a.de,{onChange:e=>{if(e)try{JSON.parse(e),r(JSON.parse(e))}catch{}},defaultLanguage:"json",className:"h-[550px] overflow-y-auto",value:JSON.stringify(o,null,2),options:{minimap:{enabled:!1},glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})]})}exports.default=i;
|