react-semaphor 0.1.220 → 0.1.221
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-fhZIf1Z0.js → dashboard-controls-D4TgRVta.js} +138 -138
- package/dist/chunks/{dashboard-controls-DfbaI6XZ.js → dashboard-controls-DqH7I5tb.js} +3 -3
- package/dist/chunks/{dashboard-json-DooCuhHo.js → dashboard-json-BvfBCrZp.js} +1 -1
- package/dist/chunks/{dashboard-json-Bt-kpD9y.js → dashboard-json-CbrkiALU.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-B3eWK66q.js → dashboard-summary-settings-dialog-Bhw7wO4D.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-CWmq1rnL.js → dashboard-summary-settings-dialog-CYdhHdYZ.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-C7sag6Jo.js → edit-dashboard-visual-DlPHT7nF.js} +4498 -4339
- package/dist/chunks/edit-dashboard-visual-DqXYRuqI.js +164 -0
- package/dist/chunks/editor-action-buttons-BMYQu_sk.js +405 -0
- package/dist/chunks/editor-action-buttons-VdYqRxoT.js +21 -0
- package/dist/chunks/{index-BMkn4K4E.js → index-C-8cXK5u.js} +16180 -16181
- package/dist/chunks/{index-C_RTjAMW.js → index-CaMze_Fv.js} +187 -187
- package/dist/chunks/{notification-bell-DHK6s4Om.js → notification-bell-DPnoYeUV.js} +85 -85
- package/dist/chunks/{notification-bell-DSShVmWj.js → notification-bell-RPOLOaxy.js} +2 -2
- package/dist/chunks/{resource-management-panel-QdAeim78.js → resource-management-panel-BA9mZ15S.js} +1 -1
- package/dist/chunks/{resource-management-panel-LBCXiHZk.js → resource-management-panel-DvAjwK0C.js} +3 -3
- package/dist/chunks/{use-role-aware-display-preferences-Db1iLmPN.js → use-role-aware-display-preferences-CdXcQxZk.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-CqF1BR5w.js → use-role-aware-display-preferences-DwKQjD_K.js} +1 -1
- package/dist/chunks/{use-visual-utils-AXuCdndV.js → use-visual-utils-BGLcxXJt.js} +1 -1
- package/dist/chunks/{use-visual-utils-CKt4UblS.js → use-visual-utils-RZ4Nj11p.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/edit-dashboard-visual-Blkn0D44.js +0 -164
- package/dist/chunks/editor-action-buttons-yJEX8W7R.js +0 -21
- package/dist/chunks/editor-action-buttons-z7gf6nE6.js +0 -404
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import { bS as T, a1 as i, bT as B, bU as te, bV as se, bW as re, bX as le, bY as oe, u as F, ah as ne, bZ as ie, b_ as de, b$ as ue, c0 as ce, c as S, c1 as pe, c2 as me, Y as q, B as I, E as ye, U as V, Z as U, V as K, c3 as j, H as O, c4 as H, X, I as C } from "./index-C-8cXK5u.js";
|
|
2
|
+
import { jsx as y, jsxs as f, Fragment as x } from "react/jsx-runtime";
|
|
3
|
+
import { u as be, a as z } from "./use-visual-utils-RZ4Nj11p.js";
|
|
4
|
+
import { useMemo as k, useState as G } from "react";
|
|
5
|
+
/**
|
|
6
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the ISC license.
|
|
9
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/
|
|
11
|
+
const Ie = T("CircleX", [
|
|
12
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
13
|
+
["path", { d: "m15 9-6 6", key: "1uzhvr" }],
|
|
14
|
+
["path", { d: "m9 9 6 6", key: "z0biqf" }]
|
|
15
|
+
]);
|
|
16
|
+
/**
|
|
17
|
+
* @license lucide-react v0.453.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/
|
|
22
|
+
const he = T("Library", [
|
|
23
|
+
["path", { d: "m16 6 4 14", key: "ji33uf" }],
|
|
24
|
+
["path", { d: "M12 6v14", key: "1n7gus" }],
|
|
25
|
+
["path", { d: "M8 8v12", key: "1gg7y9" }],
|
|
26
|
+
["path", { d: "M4 4v16", key: "6qkkli" }]
|
|
27
|
+
]);
|
|
28
|
+
/**
|
|
29
|
+
* @license lucide-react v0.453.0 - ISC
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the ISC license.
|
|
32
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/
|
|
34
|
+
const fe = T("Link2", [
|
|
35
|
+
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
36
|
+
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
37
|
+
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
38
|
+
]);
|
|
39
|
+
/**
|
|
40
|
+
* @license lucide-react v0.453.0 - ISC
|
|
41
|
+
*
|
|
42
|
+
* This source code is licensed under the ISC license.
|
|
43
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
44
|
+
*/
|
|
45
|
+
const Y = T("Save", [
|
|
46
|
+
[
|
|
47
|
+
"path",
|
|
48
|
+
{
|
|
49
|
+
d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
|
|
50
|
+
key: "1c8476"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
|
|
54
|
+
["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
|
|
55
|
+
]);
|
|
56
|
+
function Z() {
|
|
57
|
+
var e, m;
|
|
58
|
+
const r = i((p) => p.card), d = i((p) => p.frame), l = k(
|
|
59
|
+
() => B(d, r),
|
|
60
|
+
[d, r]
|
|
61
|
+
), { manifest: c } = te(
|
|
62
|
+
((e = l == null ? void 0 : l.customCardPreferences) == null ? void 0 : e.url) || ""
|
|
63
|
+
), t = k(
|
|
64
|
+
() => {
|
|
65
|
+
var p;
|
|
66
|
+
return (p = c == null ? void 0 : c.visuals) == null ? void 0 : p.find(
|
|
67
|
+
(u) => {
|
|
68
|
+
var n;
|
|
69
|
+
return u.name === ((n = l == null ? void 0 : l.customCardPreferences) == null ? void 0 : n.componentName);
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
},
|
|
73
|
+
[c, (m = l == null ? void 0 : l.customCardPreferences) == null ? void 0 : m.componentName]
|
|
74
|
+
), s = se(l, t), o = k(
|
|
75
|
+
() => re({
|
|
76
|
+
frame: d,
|
|
77
|
+
configCard: l,
|
|
78
|
+
isMultiInputVisual: s === "multiple"
|
|
79
|
+
}),
|
|
80
|
+
[d, l, s]
|
|
81
|
+
), a = k(() => {
|
|
82
|
+
const p = o.findIndex(
|
|
83
|
+
(u) => (u == null ? void 0 : u.id) === r.id
|
|
84
|
+
);
|
|
85
|
+
return p < 0 ? -1 : le(r, p);
|
|
86
|
+
}, [o, r]);
|
|
87
|
+
return k(() => !l || s !== "multiple" || a < 0 ? r.type : oe(
|
|
88
|
+
r,
|
|
89
|
+
a,
|
|
90
|
+
t == null ? void 0 : t.slots
|
|
91
|
+
) ?? r.type, [l, s, a, r, t == null ? void 0 : t.slots]);
|
|
92
|
+
}
|
|
93
|
+
function Ne({
|
|
94
|
+
type: r,
|
|
95
|
+
isLinked: d,
|
|
96
|
+
className: l,
|
|
97
|
+
showLabel: c = !1
|
|
98
|
+
}) {
|
|
99
|
+
const t = F((v) => v.selectedFrameId), s = ne((v) => v.selectedVisual), o = i((v) => v.frame);
|
|
100
|
+
let a;
|
|
101
|
+
if (r)
|
|
102
|
+
a = r;
|
|
103
|
+
else if (d !== void 0)
|
|
104
|
+
a = d ? "linked" : "library";
|
|
105
|
+
else if (!!!(o != null && o.visualId || s != null && s.id) && t)
|
|
106
|
+
a = "local";
|
|
107
|
+
else if (s && !t)
|
|
108
|
+
a = "library";
|
|
109
|
+
else if (o != null && o.visualId && t)
|
|
110
|
+
a = "linked";
|
|
111
|
+
else if (s != null && s.id && t)
|
|
112
|
+
a = "library";
|
|
113
|
+
else
|
|
114
|
+
return null;
|
|
115
|
+
if (a === "local")
|
|
116
|
+
return null;
|
|
117
|
+
const e = {
|
|
118
|
+
linked: "border-purple-200/70 bg-gradient-to-r from-purple-50/50 to-purple-100/30 text-purple-900 shadow-sm hover:from-purple-100/60 hover:to-purple-100/50 hover:shadow-md dark:border-purple-800/50 dark:from-purple-950/40 dark:to-purple-900/30 dark:text-purple-100 dark:hover:from-purple-950/60 dark:hover:to-purple-900/50",
|
|
119
|
+
library: "border-blue-200/70 bg-gradient-to-r from-blue-50/50 to-blue-100/30 text-blue-900 shadow-sm hover:from-blue-100/60 hover:to-blue-100/50 hover:shadow-md dark:border-blue-800/50 dark:from-blue-950/40 dark:to-blue-900/30 dark:text-blue-100 dark:hover:from-blue-950/60 dark:hover:to-blue-900/50"
|
|
120
|
+
}, m = {
|
|
121
|
+
linked: "Linked to library: Changes made here update the library visual and all linked instances.",
|
|
122
|
+
library: "Library visual: Share and reuse this visual across multiple dashboards."
|
|
123
|
+
}, p = {
|
|
124
|
+
linked: "border-purple-200 bg-purple-50 text-purple-900 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-100",
|
|
125
|
+
library: "border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-100"
|
|
126
|
+
}, u = {
|
|
127
|
+
linked: "fill-purple-50 dark:fill-purple-950",
|
|
128
|
+
library: "fill-blue-50 dark:fill-blue-950"
|
|
129
|
+
}, n = {
|
|
130
|
+
linked: /* @__PURE__ */ y(fe, { className: "h-3.5 w-3.5" }),
|
|
131
|
+
library: /* @__PURE__ */ y(he, { className: "h-3.5 w-3.5" })
|
|
132
|
+
}, b = {
|
|
133
|
+
linked: "Linked",
|
|
134
|
+
library: "Library"
|
|
135
|
+
};
|
|
136
|
+
return /* @__PURE__ */ y(ie, { children: /* @__PURE__ */ f(de, { delayDuration: 300, children: [
|
|
137
|
+
/* @__PURE__ */ y(ue, { asChild: !0, children: /* @__PURE__ */ f(
|
|
138
|
+
ce,
|
|
139
|
+
{
|
|
140
|
+
variant: "outline",
|
|
141
|
+
className: S(
|
|
142
|
+
"cursor-help select-none transition-all",
|
|
143
|
+
e[a],
|
|
144
|
+
l
|
|
145
|
+
),
|
|
146
|
+
children: [
|
|
147
|
+
n[a],
|
|
148
|
+
c && /* @__PURE__ */ y("span", { className: "ml-1 text-xs font-medium leading-none", children: b[a] })
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
) }),
|
|
152
|
+
/* @__PURE__ */ f(
|
|
153
|
+
pe,
|
|
154
|
+
{
|
|
155
|
+
side: "bottom",
|
|
156
|
+
className: S("max-w-xs", p[a]),
|
|
157
|
+
children: [
|
|
158
|
+
/* @__PURE__ */ y(me, { className: u[a] }),
|
|
159
|
+
/* @__PURE__ */ y("p", { children: m[a] })
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
] }) });
|
|
164
|
+
}
|
|
165
|
+
function ve(r, d) {
|
|
166
|
+
return {
|
|
167
|
+
...r,
|
|
168
|
+
sql: "",
|
|
169
|
+
python: "",
|
|
170
|
+
config: void 0,
|
|
171
|
+
customCfg: "",
|
|
172
|
+
preferences: {},
|
|
173
|
+
interactionConfig: void 0,
|
|
174
|
+
linkedInteractionTargetOverrides: void 0,
|
|
175
|
+
customCardPreferences: d ? r.customCardPreferences : void 0,
|
|
176
|
+
type: d ? r.type : "bar"
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function qe({
|
|
180
|
+
className: r,
|
|
181
|
+
variant: d = "outline"
|
|
182
|
+
}) {
|
|
183
|
+
var a;
|
|
184
|
+
const { setCardSql: l } = q();
|
|
185
|
+
i((e) => e.frame);
|
|
186
|
+
const c = i((e) => e.card);
|
|
187
|
+
be(
|
|
188
|
+
((a = c.customCardPreferences) == null ? void 0 : a.url) || ""
|
|
189
|
+
), i(
|
|
190
|
+
(e) => e.selectedSchemaName
|
|
191
|
+
), i(
|
|
192
|
+
(e) => e.selectedDatamodelId
|
|
193
|
+
), i(
|
|
194
|
+
(e) => e.selectedDatabaseName
|
|
195
|
+
), i((e) => e.selectedTableName), i(
|
|
196
|
+
(e) => e.selectedConnectionId
|
|
197
|
+
), i((e) => e.isShowingVisual), c.sql;
|
|
198
|
+
const t = i((e) => e.onSave), { getUpdatedFrame: s } = z();
|
|
199
|
+
function o() {
|
|
200
|
+
const e = s();
|
|
201
|
+
t == null || t(e);
|
|
202
|
+
}
|
|
203
|
+
return /* @__PURE__ */ f(
|
|
204
|
+
I,
|
|
205
|
+
{
|
|
206
|
+
onClick: o,
|
|
207
|
+
className: S("h-8", r),
|
|
208
|
+
size: "sm",
|
|
209
|
+
variant: d,
|
|
210
|
+
children: [
|
|
211
|
+
/* @__PURE__ */ y(ye, { className: "mr-2 size-4 font-bold" }),
|
|
212
|
+
"Accept"
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
function xe({
|
|
218
|
+
className: r,
|
|
219
|
+
variant: d = "default"
|
|
220
|
+
}) {
|
|
221
|
+
const l = V(), [c, t] = G(!1), s = F(
|
|
222
|
+
(n) => n.actions.setIsDashboardPanelOpen
|
|
223
|
+
), { setIsVisualEditing: o } = U(), { getUpdatedFrame: a } = z(), e = K(), m = i((n) => n.frame), p = j();
|
|
224
|
+
return /* @__PURE__ */ f(
|
|
225
|
+
I,
|
|
226
|
+
{
|
|
227
|
+
onClick: () => {
|
|
228
|
+
const n = a(), b = (m == null ? void 0 : m.visualId) || (e == null ? void 0 : e.id);
|
|
229
|
+
if (!b) {
|
|
230
|
+
C.error("No visual to save");
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
t(!0), p.mutate(
|
|
234
|
+
{
|
|
235
|
+
visualId: b,
|
|
236
|
+
data: {
|
|
237
|
+
frameObject: n
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
onSuccess: () => {
|
|
242
|
+
t(!1), s(!0), C.success("Visual updated successfully"), l.invalidateQueries({
|
|
243
|
+
queryKey: ["resource-by-id", "visual", b],
|
|
244
|
+
exact: !0
|
|
245
|
+
});
|
|
246
|
+
},
|
|
247
|
+
onError: () => {
|
|
248
|
+
t(!1), C.error("Failed to update visual");
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
},
|
|
253
|
+
className: S("h-8", r),
|
|
254
|
+
size: "sm",
|
|
255
|
+
variant: d,
|
|
256
|
+
children: [
|
|
257
|
+
c && /* @__PURE__ */ f(x, { children: [
|
|
258
|
+
/* @__PURE__ */ y(O, { className: "mr-2 size-4 animate-spin font-bold" }),
|
|
259
|
+
" Saving"
|
|
260
|
+
] }),
|
|
261
|
+
!c && /* @__PURE__ */ f(x, { children: [
|
|
262
|
+
/* @__PURE__ */ y(Y, { className: "mr-2 size-4 font-bold" }),
|
|
263
|
+
"Save to Library"
|
|
264
|
+
] })
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
function Te({
|
|
270
|
+
className: r
|
|
271
|
+
}) {
|
|
272
|
+
const d = V(), [l, c] = G(!1), t = K(), s = i((n) => n.frame), o = F((n) => n.selectedSheetId), { updateFrame: a, setIsVisualEditing: e } = U(), { getUpdatedFrame: m } = z(), p = j();
|
|
273
|
+
return /* @__PURE__ */ y(
|
|
274
|
+
I,
|
|
275
|
+
{
|
|
276
|
+
onClick: async () => {
|
|
277
|
+
if (!o) {
|
|
278
|
+
C.error("No sheet selected");
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const n = (s == null ? void 0 : s.visualId) || (t == null ? void 0 : t.id);
|
|
282
|
+
if (!n) {
|
|
283
|
+
C.error("No visual to update");
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
c(!0);
|
|
287
|
+
try {
|
|
288
|
+
const b = m();
|
|
289
|
+
await p.mutateAsync({
|
|
290
|
+
visualId: n,
|
|
291
|
+
data: {
|
|
292
|
+
frameObject: b
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
const v = {
|
|
296
|
+
...b,
|
|
297
|
+
visualId: n
|
|
298
|
+
// Keep the link to library visual
|
|
299
|
+
};
|
|
300
|
+
a(o, v), d.invalidateQueries({ queryKey: ["visuals"] }), d.invalidateQueries({ queryKey: ["visual", n] }), C.success("Saved to library and applied locally"), setTimeout(() => {
|
|
301
|
+
e(!1);
|
|
302
|
+
}, 300);
|
|
303
|
+
} catch (b) {
|
|
304
|
+
console.error("Failed to save and apply:", b), C.error("Failed to save and apply changes");
|
|
305
|
+
} finally {
|
|
306
|
+
c(!1);
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
className: S("h-8", r),
|
|
310
|
+
size: "sm",
|
|
311
|
+
variant: "default",
|
|
312
|
+
disabled: l,
|
|
313
|
+
children: l ? /* @__PURE__ */ f(x, { children: [
|
|
314
|
+
/* @__PURE__ */ y(O, { className: "mr-2 size-4 animate-spin font-bold" }),
|
|
315
|
+
" Saving..."
|
|
316
|
+
] }) : /* @__PURE__ */ f(x, { children: [
|
|
317
|
+
/* @__PURE__ */ y(Y, { className: "mr-2 size-4 font-bold" }),
|
|
318
|
+
"Save & Apply"
|
|
319
|
+
] })
|
|
320
|
+
}
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
function Ve({ className: r }) {
|
|
324
|
+
const { setTempQueryData: d, setSqlGen: l } = q(), c = V(), t = i((u) => u.tempQueryData), s = i((u) => u.onClose), o = i((u) => u.card), a = Z(), e = k(() => a !== o.type ? { ...o, type: a } : o, [o, a]), { queryKey: m } = H(e);
|
|
325
|
+
function p() {
|
|
326
|
+
if (t) {
|
|
327
|
+
const { queryKey: u, queryData: n } = t;
|
|
328
|
+
u && n && c.setQueryData(u, n);
|
|
329
|
+
}
|
|
330
|
+
l({}), s == null || s();
|
|
331
|
+
}
|
|
332
|
+
return /* @__PURE__ */ f(
|
|
333
|
+
I,
|
|
334
|
+
{
|
|
335
|
+
onClick: p,
|
|
336
|
+
className: S("h-8", r),
|
|
337
|
+
size: "sm",
|
|
338
|
+
variant: "outline",
|
|
339
|
+
children: [
|
|
340
|
+
/* @__PURE__ */ y(X, { className: "mr-2 size-4" }),
|
|
341
|
+
"Close"
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
function De({
|
|
347
|
+
label: r = "Clear",
|
|
348
|
+
variant: d = "secondary",
|
|
349
|
+
className: l
|
|
350
|
+
} = {}) {
|
|
351
|
+
const { setTempQueryData: c } = q(), t = V(), s = i((g) => g.tempQueryData), o = i((g) => g.card), a = Z(), e = k(() => a !== o.type ? { ...o, type: a } : o, [o, a]), { queryKey: m } = H(e), {
|
|
352
|
+
setCardSql: p,
|
|
353
|
+
setSqlGen: u,
|
|
354
|
+
setCardPython: n,
|
|
355
|
+
setCardCustomCfg: b,
|
|
356
|
+
setCardPreferences: v,
|
|
357
|
+
clearQueryConfig: R,
|
|
358
|
+
setCardConfig: W,
|
|
359
|
+
setCardType: _,
|
|
360
|
+
setFrame: $,
|
|
361
|
+
setCard: J,
|
|
362
|
+
setActiveTabCardId: ee
|
|
363
|
+
} = q();
|
|
364
|
+
function ae() {
|
|
365
|
+
var P, E, Q, w;
|
|
366
|
+
const g = t.getQueryData(m);
|
|
367
|
+
s != null && s.queryData || c({
|
|
368
|
+
queryKey: m,
|
|
369
|
+
queryData: g
|
|
370
|
+
}), t.setQueryData(m, null), t.removeQueries({ queryKey: m, exact: !0 }), p(""), u({}), R(), W(void 0), n(""), b(""), v({});
|
|
371
|
+
const D = i.getState().frame, A = i.getState().card, h = B(D, A), M = ((P = h == null ? void 0 : h.customCardPreferences) == null ? void 0 : P.visualType) === "multiple" || !!((E = h == null ? void 0 : h.customCardPreferences) != null && E.dataInputCardIds) || (((Q = h == null ? void 0 : h.customCardPreferences) == null ? void 0 : Q.minInputs) || 0) > 1 || (((w = h == null ? void 0 : h.customCardPreferences) == null ? void 0 : w.maxInputs) || 0) > 1, N = ve(A, M);
|
|
372
|
+
$({
|
|
373
|
+
...D,
|
|
374
|
+
cards: D.cards.map(
|
|
375
|
+
(L) => L.id === N.id ? N : L
|
|
376
|
+
)
|
|
377
|
+
}), ee(N.id), J(N), M || _("bar");
|
|
378
|
+
}
|
|
379
|
+
return /* @__PURE__ */ f(
|
|
380
|
+
I,
|
|
381
|
+
{
|
|
382
|
+
onClick: ae,
|
|
383
|
+
className: S("h-8", l),
|
|
384
|
+
size: "sm",
|
|
385
|
+
variant: d,
|
|
386
|
+
children: [
|
|
387
|
+
/* @__PURE__ */ y(X, { className: "mr-2 size-3.5" }),
|
|
388
|
+
r
|
|
389
|
+
]
|
|
390
|
+
}
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
export {
|
|
394
|
+
Ie as C,
|
|
395
|
+
qe as E,
|
|
396
|
+
he as L,
|
|
397
|
+
Y as S,
|
|
398
|
+
Ne as V,
|
|
399
|
+
xe as a,
|
|
400
|
+
Te as b,
|
|
401
|
+
fe as c,
|
|
402
|
+
Ve as d,
|
|
403
|
+
De as e,
|
|
404
|
+
Z as u
|
|
405
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";const e=require("./index-CaMze_Fv.js"),a=require("react/jsx-runtime"),k=require("./use-visual-utils-BGLcxXJt.js"),v=require("react");/**
|
|
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 U=e.createLucideIcon("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
|
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
|
+
*/const M=e.createLucideIcon("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
|
|
12
|
+
* @license lucide-react v0.453.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const F=e.createLucideIcon("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
|
|
17
|
+
* @license lucide-react v0.453.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const g=e.createLucideIcon("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);function E(){var t,y;const u=e.useEditorStore(m=>m.card),c=e.useEditorStore(m=>m.frame),i=v.useMemo(()=>e.findCustomVisualConfigCard(c,u),[c,u]),{manifest:p}=e.useCustomVisual(((t=i==null?void 0:i.customCardPreferences)==null?void 0:t.url)||""),s=v.useMemo(()=>{var m;return(m=p==null?void 0:p.visuals)==null?void 0:m.find(d=>{var l;return d.name===((l=i==null?void 0:i.customCardPreferences)==null?void 0:l.componentName)})},[p,(y=i==null?void 0:i.customCardPreferences)==null?void 0:y.componentName]),o=e.resolveMultiInputType(i,s),n=v.useMemo(()=>e.getCustomVisualInputCards({frame:c,configCard:i,isMultiInputVisual:o==="multiple"}),[c,i,o]),r=v.useMemo(()=>{const m=n.findIndex(d=>(d==null?void 0:d.id)===u.id);return m<0?-1:e.getSlotIndexForCard(u,m)},[n,u]);return v.useMemo(()=>!i||o!=="multiple"||r<0?u.type:e.getEffectiveCardTypeForSlot(u,r,s==null?void 0:s.slots)??u.type,[i,o,r,u,s==null?void 0:s.slots])}function K({type:u,isLinked:c,className:i,showLabel:p=!1}){const s=e.useDashboardStore(f=>f.selectedFrameId),o=e.useManagementStore(f=>f.selectedVisual),n=e.useEditorStore(f=>f.frame);let r;if(u)r=u;else if(c!==void 0)r=c?"linked":"library";else if(!!!(n!=null&&n.visualId||o!=null&&o.id)&&s)r="local";else if(o&&!s)r="library";else if(n!=null&&n.visualId&&s)r="linked";else if(o!=null&&o.id&&s)r="library";else return null;if(r==="local")return null;const t={linked:"border-purple-200/70 bg-gradient-to-r from-purple-50/50 to-purple-100/30 text-purple-900 shadow-sm hover:from-purple-100/60 hover:to-purple-100/50 hover:shadow-md dark:border-purple-800/50 dark:from-purple-950/40 dark:to-purple-900/30 dark:text-purple-100 dark:hover:from-purple-950/60 dark:hover:to-purple-900/50",library:"border-blue-200/70 bg-gradient-to-r from-blue-50/50 to-blue-100/30 text-blue-900 shadow-sm hover:from-blue-100/60 hover:to-blue-100/50 hover:shadow-md dark:border-blue-800/50 dark:from-blue-950/40 dark:to-blue-900/30 dark:text-blue-100 dark:hover:from-blue-950/60 dark:hover:to-blue-900/50"},y={linked:"Linked to library: Changes made here update the library visual and all linked instances.",library:"Library visual: Share and reuse this visual across multiple dashboards."},m={linked:"border-purple-200 bg-purple-50 text-purple-900 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-100",library:"border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-100"},d={linked:"fill-purple-50 dark:fill-purple-950",library:"fill-blue-50 dark:fill-blue-950"},l={linked:a.jsx(F,{className:"h-3.5 w-3.5"}),library:a.jsx(M,{className:"h-3.5 w-3.5"})},h={linked:"Linked",library:"Library"};return a.jsx(e.TooltipProvider,{children:a.jsxs(e.Tooltip,{delayDuration:300,children:[a.jsx(e.TooltipTrigger,{asChild:!0,children:a.jsxs(e.Badge,{variant:"outline",className:e.cn("cursor-help select-none transition-all",t[r],i),children:[l[r],p&&a.jsx("span",{className:"ml-1 text-xs font-medium leading-none",children:h[r]})]})}),a.jsxs(e.TooltipContent,{side:"bottom",className:e.cn("max-w-xs",m[r]),children:[a.jsx(e.TooltipArrow,{className:d[r]}),a.jsx("p",{children:y[r]})]})]})})}function O(u,c){return{...u,sql:"",python:"",config:void 0,customCfg:"",preferences:{},interactionConfig:void 0,linkedInteractionTargetOverrides:void 0,customCardPreferences:c?u.customCardPreferences:void 0,type:c?u.type:"bar"}}function X({className:u,variant:c="outline"}){var r;const{setCardSql:i}=e.useEditorActions();e.useEditorStore(t=>t.frame);const p=e.useEditorStore(t=>t.card);k.useRemoteChartStore(((r=p.customCardPreferences)==null?void 0:r.url)||""),e.useEditorStore(t=>t.selectedSchemaName),e.useEditorStore(t=>t.selectedDatamodelId),e.useEditorStore(t=>t.selectedDatabaseName),e.useEditorStore(t=>t.selectedTableName),e.useEditorStore(t=>t.selectedConnectionId),e.useEditorStore(t=>t.isShowingVisual),p.sql;const s=e.useEditorStore(t=>t.onSave),{getUpdatedFrame:o}=k.useVisualUtils();function n(){const t=o();s==null||s(t)}return a.jsxs(e.Button,{onClick:n,className:e.cn("h-8",u),size:"sm",variant:c,children:[a.jsx(e.Check,{className:"mr-2 size-4 font-bold"}),"Accept"]})}function H({className:u,variant:c="default"}){const i=e.useQueryClient(),[p,s]=v.useState(!1),o=e.useDashboardStore(l=>l.actions.setIsDashboardPanelOpen),{setIsVisualEditing:n}=e.useDashboardActions(),{getUpdatedFrame:r}=k.useVisualUtils(),t=e.useSelectedVisual(),y=e.useEditorStore(l=>l.frame),m=e.useUpdateVisualMutation(),d=()=>{const l=r(),h=(y==null?void 0:y.visualId)||(t==null?void 0:t.id);if(!h){e.ue.error("No visual to save");return}s(!0),m.mutate({visualId:h,data:{frameObject:l}},{onSuccess:()=>{s(!1),o(!0),e.ue.success("Visual updated successfully"),i.invalidateQueries({queryKey:["resource-by-id","visual",h],exact:!0})},onError:()=>{s(!1),e.ue.error("Failed to update visual")}})};return a.jsxs(e.Button,{onClick:d,className:e.cn("h-8",u),size:"sm",variant:c,children:[p&&a.jsxs(a.Fragment,{children:[a.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving"]}),!p&&a.jsxs(a.Fragment,{children:[a.jsx(g,{className:"mr-2 size-4 font-bold"}),"Save to Library"]})]})}function R({className:u}){const c=e.useQueryClient(),[i,p]=v.useState(!1),s=e.useSelectedVisual(),o=e.useEditorStore(l=>l.frame),n=e.useDashboardStore(l=>l.selectedSheetId),{updateFrame:r,setIsVisualEditing:t}=e.useDashboardActions(),{getUpdatedFrame:y}=k.useVisualUtils(),m=e.useUpdateVisualMutation(),d=async()=>{if(!n){e.ue.error("No sheet selected");return}const l=(o==null?void 0:o.visualId)||(s==null?void 0:s.id);if(!l){e.ue.error("No visual to update");return}p(!0);try{const h=y();await m.mutateAsync({visualId:l,data:{frameObject:h}});const f={...h,visualId:l};r(n,f),c.invalidateQueries({queryKey:["visuals"]}),c.invalidateQueries({queryKey:["visual",l]}),e.ue.success("Saved to library and applied locally"),setTimeout(()=>{t(!1)},300)}catch(h){console.error("Failed to save and apply:",h),e.ue.error("Failed to save and apply changes")}finally{p(!1)}};return a.jsx(e.Button,{onClick:d,className:e.cn("h-8",u),size:"sm",variant:"default",disabled:i,children:i?a.jsxs(a.Fragment,{children:[a.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving..."]}):a.jsxs(a.Fragment,{children:[a.jsx(g,{className:"mr-2 size-4 font-bold"}),"Save & Apply"]})})}function G({className:u}){const{setTempQueryData:c,setSqlGen:i}=e.useEditorActions(),p=e.useQueryClient(),s=e.useEditorStore(d=>d.tempQueryData),o=e.useEditorStore(d=>d.onClose),n=e.useEditorStore(d=>d.card),r=E(),t=v.useMemo(()=>r!==n.type?{...n,type:r}:n,[n,r]),{queryKey:y}=e.useDashboardCardQuery(t);function m(){if(s){const{queryKey:d,queryData:l}=s;d&&l&&p.setQueryData(d,l)}i({}),o==null||o()}return a.jsxs(e.Button,{onClick:m,className:e.cn("h-8",u),size:"sm",variant:"outline",children:[a.jsx(e.X,{className:"mr-2 size-4"}),"Close"]})}function J({label:u="Clear",variant:c="secondary",className:i}={}){const{setTempQueryData:p}=e.useEditorActions(),s=e.useQueryClient(),o=e.useEditorStore(S=>S.tempQueryData),n=e.useEditorStore(S=>S.card),r=E(),t=v.useMemo(()=>r!==n.type?{...n,type:r}:n,[n,r]),{queryKey:y}=e.useDashboardCardQuery(t),{setCardSql:m,setSqlGen:d,setCardPython:l,setCardCustomCfg:h,setCardPreferences:f,clearQueryConfig:A,setCardConfig:B,setCardType:Q,setFrame:L,setCard:z,setActiveTabCardId:P}=e.useEditorActions();function w(){var q,N,V,T;const S=s.getQueryData(y);o!=null&&o.queryData||p({queryKey:y,queryData:S}),s.setQueryData(y,null),s.removeQueries({queryKey:y,exact:!0}),m(""),d({}),A(),B(void 0),l(""),h(""),f({});const x=e.useEditorStore.getState().frame,I=e.useEditorStore.getState().card,b=e.findCustomVisualConfigCard(x,I),j=((q=b==null?void 0:b.customCardPreferences)==null?void 0:q.visualType)==="multiple"||!!((N=b==null?void 0:b.customCardPreferences)!=null&&N.dataInputCardIds)||(((V=b==null?void 0:b.customCardPreferences)==null?void 0:V.minInputs)||0)>1||(((T=b==null?void 0:b.customCardPreferences)==null?void 0:T.maxInputs)||0)>1,C=O(I,j);L({...x,cards:x.cards.map(D=>D.id===C.id?C:D)}),P(C.id),z(C),j||Q("bar")}return a.jsxs(e.Button,{onClick:w,className:e.cn("h-8",i),size:"sm",variant:c,children:[a.jsx(e.X,{className:"mr-2 size-3.5"}),u]})}exports.CircleX=U;exports.EditorAcceptButton=X;exports.EditorCancelButton=G;exports.EditorClearButton=J;exports.Library=M;exports.Link2=F;exports.Save=g;exports.VisualBadge=K;exports.VisualSaveAndApplyButton=R;exports.VisualSaveButton=H;exports.useEffectiveEditorCardType=E;
|