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