react-semaphor 0.0.187 → 0.0.189
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-plus-oU5pW6Vn.js → dashboard-plus-APOZUf3E.js} +937 -953
- package/dist/chunks/dashboard-plus-Fr6lttGN.js +210 -0
- package/dist/chunks/{index-W8jYjb9k.js → index-CENzhsPS.js} +8111 -8067
- package/dist/chunks/{index-WpPvkxrt.js → index-mAJnugBi.js} +85 -85
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/main.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chunks/dashboard-plus-bTqRuJOc.js +0 -210
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as E, b as k, j as e, Q as
|
|
2
|
-
import me, { useState as T, useEffect as
|
|
1
|
+
import { P as E, b as k, j as e, Q as xs, R as ps, U as w, V as Ks, W as fs, X as gs, Y as js, Z as bs, _ as B, $ as ae, a0 as Us, J as Gs, O as Ee, a1 as qa, a2 as Va, a3 as Ra, a4 as _a, a5 as Ha, a6 as Ba, a7 as As, a8 as _e, a9 as Pe, aa as We, T as ys, e as Js, g as vs, ab as Oe, ac as Me, f as Y, ad as Te, ae as Ae, af as He, ag as Le, ah as X, ai as Ns, G as i, aj as Ke, ak as Ue, al as $a, am as Ge, w as Qs, v as Ws, t as he, an as Pa, r as Ka, N as Ys, s as Ua, ao as Ga, B as Ja, ap as Xs, aq as Qa, L as Be, S as Cs, z as Wa, n as Es, ar as cs, A as ds, u as es, as as Ce, at as ze, au as Zs, av as ea, aw as sa, ax as aa, ay as ta, az as Ya, aA as Xa, aB as na, aC as Za, aD as et, aE as st, aF as at, aG as tt, aH as hs, aI as nt, aJ as Re, aK as ms, aL as Fe, aM as us, aN as Ls, aO as rt, aP as lt, aQ as it, aR as ot, aS as ct, aT as rs, aU as dt, aV as Ds, aW as ht, aX as Is, aY as mt, aZ as ut, a_ as xt, a$ as ra, l as pt, C as ft, E as qs, d as gt, h as jt, i as bt, o as yt, b0 as vt, m as Nt, H as Ct, b1 as St, b2 as kt, b3 as wt, b4 as ls, b5 as zt, b6 as is, b7 as Vs, K as Ft, b8 as Ss, b9 as Ot, ba as la, bb as Ye, bc as ia, bd as Mt, be as Tt, bf as At, bg as Et, bh as Lt, bi as Dt, bj as Se, bk as V, bl as R, bm as ks, bn as _, bo as Rs, bp as It, bq as qt, br as Vt, bs as Rt, bt as _s, bu as _t, bv as Ht, bw as Bt, bx as $t, by as Pt, bz as Kt } from "./index-CENzhsPS.js";
|
|
2
|
+
import me, { useState as T, useEffect as P, useMemo as Ut, useRef as $e } from "react";
|
|
3
3
|
/**
|
|
4
4
|
* @license lucide-react v0.379.0 - ISC
|
|
5
5
|
*
|
|
@@ -31,7 +31,7 @@ const Jt = E("AreaChart", [
|
|
|
31
31
|
* This source code is licensed under the ISC license.
|
|
32
32
|
* See the LICENSE file in the root directory of this source tree.
|
|
33
33
|
*/
|
|
34
|
-
const
|
|
34
|
+
const ws = E("BarChart4", [
|
|
35
35
|
["path", { d: "M3 3v18h18", key: "1s2lah" }],
|
|
36
36
|
["path", { d: "M13 17V9", key: "1fwyjl" }],
|
|
37
37
|
["path", { d: "M18 17V5", key: "sfb6ij" }],
|
|
@@ -155,7 +155,7 @@ const sn = E("Key", [
|
|
|
155
155
|
* This source code is licensed under the ISC license.
|
|
156
156
|
* See the LICENSE file in the root directory of this source tree.
|
|
157
157
|
*/
|
|
158
|
-
const
|
|
158
|
+
const zs = E("LineChart", [
|
|
159
159
|
["path", { d: "M3 3v18h18", key: "1s2lah" }],
|
|
160
160
|
["path", { d: "m19 9-5 5-4-4-3 3", key: "2osh9i" }]
|
|
161
161
|
]);
|
|
@@ -204,7 +204,7 @@ const nn = E("ListX", [
|
|
|
204
204
|
* This source code is licensed under the ISC license.
|
|
205
205
|
* See the LICENSE file in the root directory of this source tree.
|
|
206
206
|
*/
|
|
207
|
-
const
|
|
207
|
+
const rn = E("MessageSquareMore", [
|
|
208
208
|
["path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z", key: "1lielz" }],
|
|
209
209
|
["path", { d: "M8 10h.01", key: "19clt8" }],
|
|
210
210
|
["path", { d: "M12 10h.01", key: "1nrarc" }],
|
|
@@ -216,7 +216,7 @@ const ln = E("MessageSquareMore", [
|
|
|
216
216
|
* This source code is licensed under the ISC license.
|
|
217
217
|
* See the LICENSE file in the root directory of this source tree.
|
|
218
218
|
*/
|
|
219
|
-
const
|
|
219
|
+
const ln = E("Network", [
|
|
220
220
|
["rect", { x: "16", y: "16", width: "6", height: "6", rx: "1", key: "4q2zg0" }],
|
|
221
221
|
["rect", { x: "2", y: "16", width: "6", height: "6", rx: "1", key: "8cvhb9" }],
|
|
222
222
|
["rect", { x: "9", y: "2", width: "6", height: "6", rx: "1", key: "1egb70" }],
|
|
@@ -388,37 +388,37 @@ const gn = E("User", [
|
|
|
388
388
|
["circle", { cx: "12", cy: "7", r: "4", key: "17ys0d" }]
|
|
389
389
|
]);
|
|
390
390
|
function jn() {
|
|
391
|
-
const [s, n] = T(""), [a, t] = T(!1), [
|
|
392
|
-
function
|
|
393
|
-
const
|
|
391
|
+
const [s, n] = T(""), [a, t] = T(!1), [o, c] = T(!1), r = k((d) => d.dashboard);
|
|
392
|
+
function l() {
|
|
393
|
+
const d = Gs(r), f = Ee(r.id), m = JSON.parse(localStorage.getItem(f) || "[]");
|
|
394
394
|
if (m.some(
|
|
395
|
-
(
|
|
395
|
+
(S) => S.name === s
|
|
396
396
|
)) {
|
|
397
397
|
t(!0);
|
|
398
398
|
return;
|
|
399
399
|
}
|
|
400
400
|
m.push({
|
|
401
401
|
name: s,
|
|
402
|
-
template:
|
|
403
|
-
}), localStorage.setItem(
|
|
402
|
+
template: d
|
|
403
|
+
}), localStorage.setItem(f, JSON.stringify(m)), c(!1);
|
|
404
404
|
}
|
|
405
|
-
return /* @__PURE__ */ e.jsxs(
|
|
406
|
-
/* @__PURE__ */ e.jsx(
|
|
407
|
-
|
|
405
|
+
return /* @__PURE__ */ e.jsxs(xs, { open: o, onOpenChange: c, children: [
|
|
406
|
+
/* @__PURE__ */ e.jsx(ps, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
407
|
+
w,
|
|
408
408
|
{
|
|
409
409
|
variant: "outline",
|
|
410
410
|
className: "h-7 p-2",
|
|
411
411
|
size: "sm",
|
|
412
412
|
children: [
|
|
413
|
-
/* @__PURE__ */ e.jsx(
|
|
413
|
+
/* @__PURE__ */ e.jsx(Ks, { className: " mr-2 h-4 w-4", strokeWidth: 1.5 }),
|
|
414
414
|
"Add Lens"
|
|
415
415
|
]
|
|
416
416
|
}
|
|
417
417
|
) }),
|
|
418
|
-
/* @__PURE__ */ e.jsxs(
|
|
419
|
-
/* @__PURE__ */ e.jsxs(
|
|
420
|
-
/* @__PURE__ */ e.jsx(
|
|
421
|
-
/* @__PURE__ */ e.jsx(
|
|
418
|
+
/* @__PURE__ */ e.jsxs(fs, { className: "sm:max-w-[425px]", children: [
|
|
419
|
+
/* @__PURE__ */ e.jsxs(gs, { children: [
|
|
420
|
+
/* @__PURE__ */ e.jsx(js, { children: "Add a Lens" }),
|
|
421
|
+
/* @__PURE__ */ e.jsx(bs, { children: "Lenses are private by default and are only visible to you." })
|
|
422
422
|
] }),
|
|
423
423
|
/* @__PURE__ */ e.jsx("div", { className: "grid gap-4 py-4", children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-8 items-center gap-4", children: [
|
|
424
424
|
/* @__PURE__ */ e.jsx(B, { className: "text-right", children: "Name" }),
|
|
@@ -426,8 +426,8 @@ function jn() {
|
|
|
426
426
|
ae,
|
|
427
427
|
{
|
|
428
428
|
value: s,
|
|
429
|
-
onChange: (
|
|
430
|
-
a && t(!1), n(
|
|
429
|
+
onChange: (d) => {
|
|
430
|
+
a && t(!1), n(d.target.value);
|
|
431
431
|
},
|
|
432
432
|
id: "name",
|
|
433
433
|
className: "col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
|
|
@@ -436,12 +436,12 @@ function jn() {
|
|
|
436
436
|
] }) }),
|
|
437
437
|
a && /* @__PURE__ */ e.jsx("p", { className: "text-sm", children: "The bookmark name already exists. Use a differnet name." }),
|
|
438
438
|
/* @__PURE__ */ e.jsx(Us, { children: /* @__PURE__ */ e.jsx(
|
|
439
|
-
|
|
439
|
+
w,
|
|
440
440
|
{
|
|
441
441
|
variant: "outline",
|
|
442
442
|
type: "submit",
|
|
443
443
|
disabled: !s,
|
|
444
|
-
onClick:
|
|
444
|
+
onClick: l,
|
|
445
445
|
children: "Save"
|
|
446
446
|
}
|
|
447
447
|
) })
|
|
@@ -449,33 +449,33 @@ function jn() {
|
|
|
449
449
|
] });
|
|
450
450
|
}
|
|
451
451
|
function bn() {
|
|
452
|
-
const [s, n] = T(!1), [a, t] = T(""),
|
|
453
|
-
(
|
|
452
|
+
const [s, n] = T(!1), [a, t] = T(""), o = k((h) => h.dashboard), c = k((h) => h.bookmarkKey), [r, l] = T([]), d = k((h) => h.actions.setDashboard), f = k(
|
|
453
|
+
(h) => h.actions.setFilterValues
|
|
454
454
|
), m = k(
|
|
455
|
-
(
|
|
455
|
+
(h) => h.actions.setBookmarkKey
|
|
456
456
|
);
|
|
457
|
-
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
const
|
|
461
|
-
(
|
|
457
|
+
P(() => {
|
|
458
|
+
const h = Ee(o.id), x = JSON.parse(localStorage.getItem(h) || "[]");
|
|
459
|
+
l(x);
|
|
460
|
+
const g = x.find(
|
|
461
|
+
(z) => z.default
|
|
462
462
|
);
|
|
463
|
-
|
|
464
|
-
}, [s,
|
|
465
|
-
function u(
|
|
466
|
-
if (
|
|
463
|
+
g && g.name === c && t(g.name);
|
|
464
|
+
}, [s, o, c]);
|
|
465
|
+
function u(h) {
|
|
466
|
+
if (h === a)
|
|
467
467
|
return;
|
|
468
|
-
const x =
|
|
469
|
-
|
|
468
|
+
const x = r.find((z) => z.name === h), g = x == null ? void 0 : x.template;
|
|
469
|
+
g && (d(g), f(x.filterValues || []), m(h === "Original" ? "" : h)), t(h);
|
|
470
470
|
}
|
|
471
|
-
function
|
|
472
|
-
const x = Ee(
|
|
473
|
-
(b) => b.name !==
|
|
471
|
+
function S(h) {
|
|
472
|
+
const x = Ee(o.id), z = JSON.parse(localStorage.getItem(x) || "[]").filter(
|
|
473
|
+
(b) => b.name !== h
|
|
474
474
|
);
|
|
475
|
-
localStorage.setItem(x, JSON.stringify(
|
|
475
|
+
localStorage.setItem(x, JSON.stringify(z)), l(z);
|
|
476
476
|
}
|
|
477
|
-
return /* @__PURE__ */ e.jsxs(
|
|
478
|
-
/* @__PURE__ */ e.jsx(
|
|
477
|
+
return /* @__PURE__ */ e.jsxs(qa, { open: s, onOpenChange: n, children: [
|
|
478
|
+
/* @__PURE__ */ e.jsx(Va, { asChild: !0, children: /* @__PURE__ */ e.jsx(w, { variant: "outline", className: "h-7 p-2", children: /* @__PURE__ */ e.jsx(Xt, { className: "h-4 w-4", strokeWidth: 1.5 }) }) }),
|
|
479
479
|
/* @__PURE__ */ e.jsxs(Ra, { className: "w-56", children: [
|
|
480
480
|
/* @__PURE__ */ e.jsx(_a, { children: "Lenses" }),
|
|
481
481
|
/* @__PURE__ */ e.jsx(Ha, {}),
|
|
@@ -485,20 +485,20 @@ function bn() {
|
|
|
485
485
|
value: a,
|
|
486
486
|
onValueChange: u,
|
|
487
487
|
children: [
|
|
488
|
-
/* @__PURE__ */ e.jsx(
|
|
489
|
-
|
|
490
|
-
|
|
488
|
+
/* @__PURE__ */ e.jsx(As, { value: "Original", children: "Original" }),
|
|
489
|
+
r.filter((h) => h.name != "Original").map((h, x) => /* @__PURE__ */ e.jsxs(
|
|
490
|
+
As,
|
|
491
491
|
{
|
|
492
492
|
className: "xbg-red-100 flex justify-between",
|
|
493
|
-
value:
|
|
494
|
-
defaultChecked:
|
|
493
|
+
value: h.name,
|
|
494
|
+
defaultChecked: h.name === c,
|
|
495
495
|
children: [
|
|
496
|
-
/* @__PURE__ */ e.jsx("p", { children:
|
|
496
|
+
/* @__PURE__ */ e.jsx("p", { children: h.name }),
|
|
497
497
|
/* @__PURE__ */ e.jsx(
|
|
498
498
|
_e,
|
|
499
499
|
{
|
|
500
|
-
onClick: (
|
|
501
|
-
|
|
500
|
+
onClick: (g) => {
|
|
501
|
+
g.preventDefault(), S(h.name);
|
|
502
502
|
},
|
|
503
503
|
className: "h-3 w-3 hover:cursor-pointer",
|
|
504
504
|
strokeWidth: 1.5
|
|
@@ -515,33 +515,33 @@ function bn() {
|
|
|
515
515
|
] });
|
|
516
516
|
}
|
|
517
517
|
function yn() {
|
|
518
|
-
const [s, n] = T(!1), a = k((
|
|
519
|
-
|
|
518
|
+
const [s, n] = T(!1), a = k((c) => c.dashboard), t = k((c) => c.bookmarkKey);
|
|
519
|
+
P(() => {
|
|
520
520
|
if (!t) {
|
|
521
521
|
n(!1);
|
|
522
522
|
return;
|
|
523
523
|
}
|
|
524
|
-
const
|
|
525
|
-
localStorage.getItem(
|
|
524
|
+
const c = Ee(a.id), l = JSON.parse(
|
|
525
|
+
localStorage.getItem(c) || "[]"
|
|
526
526
|
).find(
|
|
527
|
-
(
|
|
527
|
+
(d) => d.name === t
|
|
528
528
|
);
|
|
529
|
-
n(
|
|
529
|
+
n(l ? l.default : !1);
|
|
530
530
|
}, [t, a.id]);
|
|
531
|
-
function
|
|
532
|
-
if (n(
|
|
531
|
+
function o(c) {
|
|
532
|
+
if (n(c), !t)
|
|
533
533
|
return;
|
|
534
|
-
const
|
|
535
|
-
localStorage.getItem(
|
|
536
|
-
).map((
|
|
537
|
-
console.log(
|
|
534
|
+
const r = Ee(a.id), d = JSON.parse(
|
|
535
|
+
localStorage.getItem(r) || "[]"
|
|
536
|
+
).map((f) => (f.name === t ? f.default = c : f.default = !1, f));
|
|
537
|
+
console.log(d), localStorage.setItem(r, JSON.stringify(d));
|
|
538
538
|
}
|
|
539
539
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
540
540
|
/* @__PURE__ */ e.jsx(
|
|
541
|
-
|
|
541
|
+
Pe,
|
|
542
542
|
{
|
|
543
543
|
checked: s,
|
|
544
|
-
onCheckedChange:
|
|
544
|
+
onCheckedChange: o,
|
|
545
545
|
id: "terms"
|
|
546
546
|
}
|
|
547
547
|
),
|
|
@@ -560,16 +560,16 @@ function vn() {
|
|
|
560
560
|
k((b) => b.selectedSheetId);
|
|
561
561
|
const a = k(
|
|
562
562
|
(b) => b.isDashboardEditing
|
|
563
|
-
), t = k((b) => b.filterValues),
|
|
563
|
+
), t = k((b) => b.filterValues), o = k((b) => b.isVisualEditing), c = k((b) => b.showFilters);
|
|
564
564
|
k(
|
|
565
565
|
(b) => b.showDashboardJSON
|
|
566
566
|
);
|
|
567
|
-
const
|
|
567
|
+
const r = k((b) => b.onSaveFunction), l = k(
|
|
568
568
|
(b) => b.actions.setShowFilters
|
|
569
|
-
), { addFrame:
|
|
569
|
+
), { addFrame: d, setSelectedFrameId: f } = k(
|
|
570
570
|
(b) => b.actions
|
|
571
|
-
), { getSelectedSheet: m, setIsDashboardEditing: u, setShowDashboardJSON:
|
|
572
|
-
if (!a || !
|
|
571
|
+
), { getSelectedSheet: m, setIsDashboardEditing: u, setShowDashboardJSON: S } = k((b) => b.actions), h = m(), x = () => {
|
|
572
|
+
if (!a || !h)
|
|
573
573
|
return;
|
|
574
574
|
const b = {
|
|
575
575
|
id: We(),
|
|
@@ -591,34 +591,34 @@ function vn() {
|
|
|
591
591
|
cards: [b],
|
|
592
592
|
activeCardId: b.id
|
|
593
593
|
};
|
|
594
|
-
h
|
|
595
|
-
},
|
|
594
|
+
d(h.id, L), f(L.id);
|
|
595
|
+
}, g = () => {
|
|
596
596
|
u(!0);
|
|
597
597
|
};
|
|
598
|
-
function
|
|
598
|
+
function z() {
|
|
599
599
|
if (!s || s === "")
|
|
600
600
|
return;
|
|
601
|
-
const b = Gs(n), L = Ee(n.id),
|
|
601
|
+
const b = Gs(n), L = Ee(n.id), N = JSON.parse(localStorage.getItem(L) || "[]"), O = N.findIndex(
|
|
602
602
|
(j) => j.name === s
|
|
603
603
|
);
|
|
604
|
-
O !== -1 ?
|
|
604
|
+
O !== -1 ? N[O] = {
|
|
605
605
|
name: s,
|
|
606
606
|
template: b,
|
|
607
|
-
default:
|
|
607
|
+
default: N[O].default,
|
|
608
608
|
filterValues: t
|
|
609
|
-
} :
|
|
609
|
+
} : N.push({
|
|
610
610
|
name: s,
|
|
611
611
|
template: b,
|
|
612
612
|
filterValues: t
|
|
613
|
-
}), localStorage.setItem(L, JSON.stringify(
|
|
613
|
+
}), localStorage.setItem(L, JSON.stringify(N)), r == null || r(b);
|
|
614
614
|
}
|
|
615
|
-
return
|
|
615
|
+
return o ? null : /* @__PURE__ */ e.jsxs(
|
|
616
616
|
"div",
|
|
617
617
|
{
|
|
618
618
|
className: "flex items-center justify-between gap-2 border-b bg-muted/50 px-2 py-2",
|
|
619
619
|
role: "dashboard-controls",
|
|
620
620
|
children: [
|
|
621
|
-
!
|
|
621
|
+
!o && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
622
622
|
/* @__PURE__ */ e.jsx(B, { children: s }),
|
|
623
623
|
!!s && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
624
624
|
/* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground", children: "|" }),
|
|
@@ -626,10 +626,10 @@ function vn() {
|
|
|
626
626
|
] })
|
|
627
627
|
] }),
|
|
628
628
|
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
|
|
629
|
-
a && !
|
|
630
|
-
!
|
|
631
|
-
a && !
|
|
632
|
-
|
|
629
|
+
a && !o && /* @__PURE__ */ e.jsx(jn, {}),
|
|
630
|
+
!o && /* @__PURE__ */ e.jsx(bn, {}),
|
|
631
|
+
a && !o && /* @__PURE__ */ e.jsxs(
|
|
632
|
+
w,
|
|
633
633
|
{
|
|
634
634
|
variant: "outline",
|
|
635
635
|
className: "h-7 p-2",
|
|
@@ -637,56 +637,56 @@ function vn() {
|
|
|
637
637
|
disabled: !a,
|
|
638
638
|
onClick: x,
|
|
639
639
|
children: [
|
|
640
|
-
/* @__PURE__ */ e.jsx(
|
|
640
|
+
/* @__PURE__ */ e.jsx(Ks, { className: "mr-2 h-4 w-4", strokeWidth: 1.5 }),
|
|
641
641
|
"Add Frame"
|
|
642
642
|
]
|
|
643
643
|
}
|
|
644
644
|
),
|
|
645
645
|
!a && /* @__PURE__ */ e.jsx(
|
|
646
|
-
|
|
646
|
+
w,
|
|
647
647
|
{
|
|
648
648
|
variant: "outline",
|
|
649
649
|
className: "h-7 p-2",
|
|
650
|
-
onClick:
|
|
650
|
+
onClick: g,
|
|
651
651
|
size: "sm",
|
|
652
652
|
children: /* @__PURE__ */ e.jsx(da, { className: "h-4 w-4", strokeWidth: 1.5 })
|
|
653
653
|
}
|
|
654
654
|
),
|
|
655
|
-
a && !
|
|
656
|
-
|
|
655
|
+
a && !o && /* @__PURE__ */ e.jsx(
|
|
656
|
+
w,
|
|
657
657
|
{
|
|
658
658
|
variant: "outline",
|
|
659
659
|
role: "close",
|
|
660
660
|
className: "h-7 p-2",
|
|
661
661
|
onClick: () => {
|
|
662
|
-
u(!1),
|
|
662
|
+
u(!1), S(!1);
|
|
663
663
|
},
|
|
664
664
|
size: "sm",
|
|
665
665
|
children: /* @__PURE__ */ e.jsx(_e, { className: "h-4 w-4", strokeWidth: 1.5 })
|
|
666
666
|
}
|
|
667
667
|
),
|
|
668
|
-
a && !
|
|
669
|
-
|
|
668
|
+
a && !o && /* @__PURE__ */ e.jsx(
|
|
669
|
+
w,
|
|
670
670
|
{
|
|
671
671
|
className: "h-7 p-2",
|
|
672
672
|
variant: "outline",
|
|
673
|
-
onClick:
|
|
673
|
+
onClick: z,
|
|
674
674
|
size: "sm",
|
|
675
675
|
children: /* @__PURE__ */ e.jsx(dn, { className: "h-4 w-4", strokeWidth: 1.5 })
|
|
676
676
|
}
|
|
677
677
|
),
|
|
678
|
-
!
|
|
679
|
-
|
|
678
|
+
!c && !o && a && /* @__PURE__ */ e.jsx(
|
|
679
|
+
w,
|
|
680
680
|
{
|
|
681
681
|
className: "h-7 p-2",
|
|
682
682
|
variant: "outline",
|
|
683
|
-
onClick: () =>
|
|
683
|
+
onClick: () => l(!0),
|
|
684
684
|
size: "sm",
|
|
685
685
|
children: /* @__PURE__ */ e.jsx(oa, { className: "h-4 w-4", strokeWidth: 1.5 })
|
|
686
686
|
}
|
|
687
687
|
),
|
|
688
|
-
!
|
|
689
|
-
!
|
|
688
|
+
!o && a && !1,
|
|
689
|
+
!o && !1
|
|
690
690
|
] })
|
|
691
691
|
]
|
|
692
692
|
}
|
|
@@ -697,68 +697,68 @@ function Qe({
|
|
|
697
697
|
items: n,
|
|
698
698
|
value: a,
|
|
699
699
|
isLoading: t,
|
|
700
|
-
isError:
|
|
701
|
-
connectionTooltip:
|
|
702
|
-
onChange:
|
|
703
|
-
className:
|
|
704
|
-
showIcon:
|
|
705
|
-
disabled:
|
|
700
|
+
isError: o,
|
|
701
|
+
connectionTooltip: c,
|
|
702
|
+
onChange: r,
|
|
703
|
+
className: l,
|
|
704
|
+
showIcon: d = !0,
|
|
705
|
+
disabled: f = !1
|
|
706
706
|
}) {
|
|
707
|
-
const m = t ? "Loading..." :
|
|
707
|
+
const m = t ? "Loading..." : o ? "Error" : a;
|
|
708
708
|
function u() {
|
|
709
709
|
if (s === "Connection")
|
|
710
710
|
return /* @__PURE__ */ e.jsx(cn, { className: "size-4 rotate-90" });
|
|
711
711
|
if (s === "Database")
|
|
712
712
|
return /* @__PURE__ */ e.jsx(Wt, { className: "size-4" });
|
|
713
713
|
if (s === "Schema")
|
|
714
|
-
return /* @__PURE__ */ e.jsx(
|
|
714
|
+
return /* @__PURE__ */ e.jsx(ln, { className: "size-4" });
|
|
715
715
|
if (s === "Table")
|
|
716
|
-
return /* @__PURE__ */ e.jsx(
|
|
716
|
+
return /* @__PURE__ */ e.jsx(Ns, { className: "size-4" });
|
|
717
717
|
}
|
|
718
718
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
719
|
-
|
|
719
|
+
d && /* @__PURE__ */ e.jsx("div", { className: "shrink-0", children: c ? /* @__PURE__ */ e.jsxs(ys, { children: [
|
|
720
720
|
/* @__PURE__ */ e.jsx(Js, { children: u() }),
|
|
721
|
-
/* @__PURE__ */ e.jsx(
|
|
721
|
+
/* @__PURE__ */ e.jsx(vs, { className: "text-xs", align: "start", children: c })
|
|
722
722
|
] }) : u() }),
|
|
723
|
-
/* @__PURE__ */ e.jsxs(Oe, { disabled:
|
|
723
|
+
/* @__PURE__ */ e.jsxs(Oe, { disabled: f, value: m, onValueChange: r, children: [
|
|
724
724
|
/* @__PURE__ */ e.jsx(
|
|
725
725
|
Me,
|
|
726
726
|
{
|
|
727
|
-
className:
|
|
727
|
+
className: Y(
|
|
728
728
|
"h-9 w-full focus:ring-1 focus:ring-offset-0",
|
|
729
|
-
|
|
729
|
+
l
|
|
730
730
|
),
|
|
731
731
|
children: /* @__PURE__ */ e.jsx(
|
|
732
732
|
Te,
|
|
733
733
|
{
|
|
734
|
-
placeholder: t ? "Loading..." :
|
|
734
|
+
placeholder: t ? "Loading..." : o ? "Error" : `Select ${s}`
|
|
735
735
|
}
|
|
736
736
|
)
|
|
737
737
|
}
|
|
738
738
|
),
|
|
739
739
|
/* @__PURE__ */ e.jsx(Ae, { children: /* @__PURE__ */ e.jsxs(He, { children: [
|
|
740
740
|
t ? /* @__PURE__ */ e.jsx(Le, { children: "Loading..." }) : /* @__PURE__ */ e.jsx(Le, { children: s }),
|
|
741
|
-
/* @__PURE__ */ e.jsx(e.Fragment, { children: n && n.map((
|
|
742
|
-
(t ||
|
|
741
|
+
/* @__PURE__ */ e.jsx(e.Fragment, { children: n && n.map((S, h) => /* @__PURE__ */ e.jsx(X, { value: S.id, children: S.name }, h)) }),
|
|
742
|
+
(t || o) && /* @__PURE__ */ e.jsx(X, { value: m, children: m })
|
|
743
743
|
] }) })
|
|
744
744
|
] })
|
|
745
745
|
] });
|
|
746
746
|
}
|
|
747
747
|
function Nn({ column: s }) {
|
|
748
|
-
const [n, a] = T(!1), t =
|
|
748
|
+
const [n, a] = T(!1), t = i((m) => m.selectedTableName), o = i(
|
|
749
749
|
(m) => m.selectedSchemaName
|
|
750
|
-
),
|
|
751
|
-
function
|
|
752
|
-
const
|
|
753
|
-
|
|
754
|
-
const
|
|
755
|
-
|
|
756
|
-
he(
|
|
750
|
+
), c = i((m) => m.sqlGen), r = i((m) => m.actions.setSqlGen), l = i((m) => m.actions.setCardSql), d = i((m) => m.actions.setRunSql);
|
|
751
|
+
function f(m, u) {
|
|
752
|
+
const S = Qs(m, c, u);
|
|
753
|
+
r(S);
|
|
754
|
+
const h = Ws(
|
|
755
|
+
S,
|
|
756
|
+
he(o || ""),
|
|
757
757
|
he(t)
|
|
758
758
|
);
|
|
759
|
-
|
|
759
|
+
h && (l(h), d(!0)), a(!1);
|
|
760
760
|
}
|
|
761
|
-
return /* @__PURE__ */ e.jsxs(
|
|
761
|
+
return /* @__PURE__ */ e.jsxs(Ke, { open: n, onOpenChange: a, children: [
|
|
762
762
|
/* @__PURE__ */ e.jsx(Ue, { asChild: !0, children: /* @__PURE__ */ e.jsx($a, { className: "h-4 w-4 cursor-pointer text-foreground/40" }) }),
|
|
763
763
|
/* @__PURE__ */ e.jsx(
|
|
764
764
|
Ge,
|
|
@@ -769,7 +769,7 @@ function Nn({ column: s }) {
|
|
|
769
769
|
/* @__PURE__ */ e.jsx(
|
|
770
770
|
"li",
|
|
771
771
|
{
|
|
772
|
-
onClick: () =>
|
|
772
|
+
onClick: () => f(s, "COUNT"),
|
|
773
773
|
className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
|
|
774
774
|
children: "Count"
|
|
775
775
|
}
|
|
@@ -777,7 +777,7 @@ function Nn({ column: s }) {
|
|
|
777
777
|
/* @__PURE__ */ e.jsx(
|
|
778
778
|
"li",
|
|
779
779
|
{
|
|
780
|
-
onClick: () =>
|
|
780
|
+
onClick: () => f(s, "AVG"),
|
|
781
781
|
className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
|
|
782
782
|
children: "Avg"
|
|
783
783
|
}
|
|
@@ -785,7 +785,7 @@ function Nn({ column: s }) {
|
|
|
785
785
|
/* @__PURE__ */ e.jsx(
|
|
786
786
|
"li",
|
|
787
787
|
{
|
|
788
|
-
onClick: () =>
|
|
788
|
+
onClick: () => f(s, "SUM"),
|
|
789
789
|
className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
|
|
790
790
|
children: "Sum"
|
|
791
791
|
}
|
|
@@ -793,7 +793,7 @@ function Nn({ column: s }) {
|
|
|
793
793
|
/* @__PURE__ */ e.jsx(
|
|
794
794
|
"li",
|
|
795
795
|
{
|
|
796
|
-
onClick: () =>
|
|
796
|
+
onClick: () => f(s, "MAX"),
|
|
797
797
|
className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
|
|
798
798
|
children: "Max"
|
|
799
799
|
}
|
|
@@ -801,7 +801,7 @@ function Nn({ column: s }) {
|
|
|
801
801
|
/* @__PURE__ */ e.jsx(
|
|
802
802
|
"li",
|
|
803
803
|
{
|
|
804
|
-
onClick: () =>
|
|
804
|
+
onClick: () => f(s, "MIN"),
|
|
805
805
|
className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
|
|
806
806
|
children: "Min"
|
|
807
807
|
}
|
|
@@ -812,15 +812,15 @@ function Nn({ column: s }) {
|
|
|
812
812
|
] });
|
|
813
813
|
}
|
|
814
814
|
function ua({ column: s }) {
|
|
815
|
-
return /* @__PURE__ */ e.jsxs(
|
|
816
|
-
/* @__PURE__ */ e.jsx(
|
|
815
|
+
return /* @__PURE__ */ e.jsxs(ys, { children: [
|
|
816
|
+
/* @__PURE__ */ e.jsx(Pa, { asChild: !0, children: Ka.includes(s.data_type.toLowerCase()) ? (
|
|
817
817
|
// <span className=" font-thin">T</span>
|
|
818
818
|
/* @__PURE__ */ e.jsx(fn, { className: "size-3" })
|
|
819
819
|
) : Ys.includes(s.data_type.toLowerCase()) ? (
|
|
820
820
|
//
|
|
821
821
|
/* @__PURE__ */ e.jsx(en, { className: "size-3" })
|
|
822
822
|
) : Ua.includes(s.data_type.toLowerCase()) ? /* @__PURE__ */ e.jsx(Ga, { className: "size-3" }) : Ja.includes(s.data_type.toLowerCase()) ? /* @__PURE__ */ e.jsx(pn, { className: "size-3" }) : /* @__PURE__ */ e.jsx(hn, { className: "size-3" }) }),
|
|
823
|
-
/* @__PURE__ */ e.jsx(
|
|
823
|
+
/* @__PURE__ */ e.jsx(vs, { children: /* @__PURE__ */ e.jsx("p", { className: "font-mono text-xs", children: s.data_type }) })
|
|
824
824
|
] });
|
|
825
825
|
}
|
|
826
826
|
function Cn({
|
|
@@ -829,64 +829,66 @@ function Cn({
|
|
|
829
829
|
columns: a,
|
|
830
830
|
status: t
|
|
831
831
|
}) {
|
|
832
|
-
const
|
|
832
|
+
const o = i((j) => j.sqlGen), c = i(
|
|
833
833
|
(j) => j.selectedConnectionId
|
|
834
|
-
),
|
|
834
|
+
), r = i(
|
|
835
835
|
(j) => j.selectedDatabaseName
|
|
836
|
-
),
|
|
836
|
+
), l = i(
|
|
837
837
|
(j) => j.selectedSchemaName
|
|
838
|
-
),
|
|
838
|
+
), d = i((j) => j.selectedTableName), f = k(
|
|
839
839
|
(j) => j.dashboard.aiScopeTables
|
|
840
|
-
), { setAIScopeTables: m } = k((j) => j.actions), u =
|
|
840
|
+
), { setAIScopeTables: m } = k((j) => j.actions), u = i((j) => j.actions.setRunSql), S = i((j) => j.actions.setSqlGen), h = i(
|
|
841
841
|
(j) => j.actions.setIsShowingVisual
|
|
842
|
-
), x =
|
|
843
|
-
function
|
|
844
|
-
const F = Qs(j,
|
|
845
|
-
|
|
842
|
+
), x = i((j) => j.actions.setCardSql), { connectionType: g } = xa();
|
|
843
|
+
function z(j) {
|
|
844
|
+
const F = Qs(j, o);
|
|
845
|
+
S(F);
|
|
846
846
|
const A = Ws(F, he(s), he(n));
|
|
847
847
|
A && (x(A), u(!0));
|
|
848
848
|
}
|
|
849
849
|
function b() {
|
|
850
|
-
return (
|
|
851
|
-
(j) => j.connectinonId ===
|
|
850
|
+
return (f == null ? void 0 : f.find(
|
|
851
|
+
(j) => j.connectinonId === c && j.tableName === d
|
|
852
852
|
)) !== void 0;
|
|
853
853
|
}
|
|
854
854
|
function L(j) {
|
|
855
|
-
if (j === !0 &&
|
|
855
|
+
if (j === !0 && d && c) {
|
|
856
856
|
const F = {
|
|
857
|
-
connectinonId:
|
|
858
|
-
connectionType:
|
|
859
|
-
databaseName:
|
|
860
|
-
schemaName:
|
|
861
|
-
tableName:
|
|
862
|
-
},
|
|
863
|
-
(
|
|
864
|
-
(D) => D.connectinonId ===
|
|
857
|
+
connectinonId: c,
|
|
858
|
+
connectionType: g,
|
|
859
|
+
databaseName: r,
|
|
860
|
+
schemaName: l,
|
|
861
|
+
tableName: d
|
|
862
|
+
}, q = [...f || [], F].filter(
|
|
863
|
+
(K, $, G) => G.findIndex(
|
|
864
|
+
(D) => D.connectinonId === K.connectinonId && D.tableName === K.tableName
|
|
865
865
|
) === $
|
|
866
866
|
);
|
|
867
|
-
m(
|
|
867
|
+
m(q), cs.success(`Added '${d}' to AI Scope`, {
|
|
868
868
|
position: "top-right",
|
|
869
869
|
duration: 2500,
|
|
870
870
|
richColors: !0
|
|
871
871
|
});
|
|
872
872
|
} else {
|
|
873
|
-
const F = (
|
|
874
|
-
(A) => A.connectinonId !==
|
|
873
|
+
const F = (f || []).filter(
|
|
874
|
+
(A) => A.connectinonId !== c && A.tableName !== d
|
|
875
875
|
);
|
|
876
|
-
m(F),
|
|
876
|
+
m(F), cs(`Removed '${d}' from AI Scope`, {
|
|
877
877
|
position: "top-right",
|
|
878
878
|
duration: 2e3,
|
|
879
879
|
richColors: !0
|
|
880
880
|
});
|
|
881
881
|
}
|
|
882
882
|
}
|
|
883
|
-
function
|
|
884
|
-
let F =
|
|
885
|
-
((
|
|
883
|
+
function N() {
|
|
884
|
+
let F = ds(s, n);
|
|
885
|
+
((K) => K.charAt(0) === K.charAt(0).toUpperCase())(n) && (F = `"${n}"`), h(!1);
|
|
886
|
+
const q = g === "MSSQL" ? `SELECT top 10 * FROM ${F}` : `SELECT * FROM ${F} LIMIT 10`;
|
|
887
|
+
x(q), u(!0);
|
|
886
888
|
}
|
|
887
889
|
function O() {
|
|
888
|
-
let F =
|
|
889
|
-
((
|
|
890
|
+
let F = ds(s, n);
|
|
891
|
+
((q) => q.charAt(0) === q.charAt(0).toUpperCase())(n) && (F = `"${n}"`), h(!1), x(`SELECT COUNT(*) as count FROM ${F}`), u(!0);
|
|
890
892
|
}
|
|
891
893
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex grow flex-col space-y-4 px-4", children: [
|
|
892
894
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center gap-1", children: [
|
|
@@ -901,7 +903,7 @@ function Cn({
|
|
|
901
903
|
children: /* @__PURE__ */ e.jsx(
|
|
902
904
|
Qa,
|
|
903
905
|
{
|
|
904
|
-
className:
|
|
906
|
+
className: Y("size-4", {
|
|
905
907
|
"text-primary": b(),
|
|
906
908
|
"text-muted-foreground": !b()
|
|
907
909
|
})
|
|
@@ -910,10 +912,10 @@ function Cn({
|
|
|
910
912
|
}
|
|
911
913
|
),
|
|
912
914
|
/* @__PURE__ */ e.jsxs(
|
|
913
|
-
|
|
915
|
+
w,
|
|
914
916
|
{
|
|
915
917
|
disabled: t !== "Success",
|
|
916
|
-
onClick:
|
|
918
|
+
onClick: N,
|
|
917
919
|
size: "sm",
|
|
918
920
|
variant: "secondary",
|
|
919
921
|
className: "flex",
|
|
@@ -924,7 +926,7 @@ function Cn({
|
|
|
924
926
|
}
|
|
925
927
|
),
|
|
926
928
|
/* @__PURE__ */ e.jsxs(
|
|
927
|
-
|
|
929
|
+
w,
|
|
928
930
|
{
|
|
929
931
|
disabled: t !== "Success",
|
|
930
932
|
onClick: O,
|
|
@@ -939,18 +941,18 @@ function Cn({
|
|
|
939
941
|
)
|
|
940
942
|
] }),
|
|
941
943
|
/* @__PURE__ */ e.jsxs(
|
|
942
|
-
|
|
944
|
+
Cs,
|
|
943
945
|
{
|
|
944
946
|
className: "flex-1 basis-0 overflow-y-auto border-b border-t border-muted py-3",
|
|
945
947
|
children: [
|
|
946
948
|
a == null ? void 0 : a.map((j) => /* @__PURE__ */ e.jsxs(
|
|
947
949
|
"div",
|
|
948
950
|
{
|
|
949
|
-
onClick: () =>
|
|
950
|
-
className:
|
|
951
|
+
onClick: () => z(j),
|
|
952
|
+
className: Y(
|
|
951
953
|
"mx-3 flex cursor-pointer items-center justify-between rounded px-2 py-[6px] text-sm transition-colors hover:bg-muted/50",
|
|
952
954
|
{
|
|
953
|
-
"bg-muted": Wa(j,
|
|
955
|
+
"bg-muted": Wa(j, o)
|
|
954
956
|
}
|
|
955
957
|
),
|
|
956
958
|
children: [
|
|
@@ -970,46 +972,46 @@ function Cn({
|
|
|
970
972
|
},
|
|
971
973
|
j.column_name
|
|
972
974
|
)),
|
|
973
|
-
/* @__PURE__ */ e.jsx(
|
|
974
|
-
/* @__PURE__ */ e.jsx(
|
|
975
|
+
/* @__PURE__ */ e.jsx(Es, { orientation: "vertical" }),
|
|
976
|
+
/* @__PURE__ */ e.jsx(Es, { orientation: "horizontal" })
|
|
975
977
|
]
|
|
976
978
|
}
|
|
977
979
|
)
|
|
978
980
|
] });
|
|
979
981
|
}
|
|
980
982
|
function xa(s, n) {
|
|
981
|
-
var ss, ve, Je,
|
|
983
|
+
var ss, ve, Je, qe;
|
|
982
984
|
let a = Ut(() => [], []);
|
|
983
|
-
const t = es().authToken || s,
|
|
984
|
-
(
|
|
985
|
-
),
|
|
986
|
-
(
|
|
987
|
-
),
|
|
988
|
-
(
|
|
989
|
-
),
|
|
990
|
-
(
|
|
991
|
-
),
|
|
992
|
-
(
|
|
993
|
-
), m =
|
|
994
|
-
(
|
|
995
|
-
), u =
|
|
996
|
-
(
|
|
997
|
-
),
|
|
998
|
-
(
|
|
999
|
-
),
|
|
1000
|
-
function x(
|
|
1001
|
-
return
|
|
985
|
+
const t = es().authToken || s, o = i(
|
|
986
|
+
(C) => C.selectedConnectionId
|
|
987
|
+
), c = i(
|
|
988
|
+
(C) => C.selectedDatabaseName
|
|
989
|
+
), r = i(
|
|
990
|
+
(C) => C.selectedSchemaName
|
|
991
|
+
), l = i((C) => C.selectedTableName), d = i(
|
|
992
|
+
(C) => C.actions.setCurrentColumns
|
|
993
|
+
), f = i(
|
|
994
|
+
(C) => C.actions.setSelectedConnectionId
|
|
995
|
+
), m = i(
|
|
996
|
+
(C) => C.actions.setSelectedDatabaseName
|
|
997
|
+
), u = i(
|
|
998
|
+
(C) => C.actions.setSelectedSchemaName
|
|
999
|
+
), S = i(
|
|
1000
|
+
(C) => C.actions.setSelectedTableName
|
|
1001
|
+
), h = i((C) => C.actions.setCardSql);
|
|
1002
|
+
function x(C) {
|
|
1003
|
+
return o && c && r && c !== "NA" ? !0 : o && C === "API" ? !1 : !!(o && C === "S3");
|
|
1002
1004
|
}
|
|
1003
|
-
function
|
|
1004
|
-
return !!(
|
|
1005
|
+
function g(C) {
|
|
1006
|
+
return !!(o && c && c !== "NA" && r && l || o && (C === "S3" || C === "API"));
|
|
1005
1007
|
}
|
|
1006
|
-
function
|
|
1007
|
-
return
|
|
1008
|
+
function z(C) {
|
|
1009
|
+
return o && C ? !(C === "API" || C === "S3") : !1;
|
|
1008
1010
|
}
|
|
1009
1011
|
const {
|
|
1010
1012
|
data: b,
|
|
1011
1013
|
isLoading: L,
|
|
1012
|
-
isError:
|
|
1014
|
+
isError: N
|
|
1013
1015
|
} = Ce({
|
|
1014
1016
|
queryKey: ["connections"],
|
|
1015
1017
|
queryFn: () => ze(
|
|
@@ -1019,44 +1021,44 @@ function xa(s, n) {
|
|
|
1019
1021
|
enabled: !!(t != null && t.accessToken)
|
|
1020
1022
|
// Only fetch if authToken is present
|
|
1021
1023
|
}), O = b == null ? void 0 : b.connections.find(
|
|
1022
|
-
(
|
|
1024
|
+
(C) => C.id === o
|
|
1023
1025
|
), j = O == null ? void 0 : O.type, F = (O == null ? void 0 : O.type) === "API" || (O == null ? void 0 : O.type) === "S3", {
|
|
1024
1026
|
data: A,
|
|
1025
|
-
isLoading:
|
|
1026
|
-
isFetching:
|
|
1027
|
+
isLoading: q,
|
|
1028
|
+
isFetching: K,
|
|
1027
1029
|
isError: $,
|
|
1028
|
-
refetch:
|
|
1030
|
+
refetch: G
|
|
1029
1031
|
} = Ce({
|
|
1030
|
-
queryKey: ["databases",
|
|
1032
|
+
queryKey: ["databases", o],
|
|
1031
1033
|
queryFn: () => ze(
|
|
1032
1034
|
"https://semaphor.cloud/api/v1/databases",
|
|
1033
1035
|
(t == null ? void 0 : t.accessToken) || "",
|
|
1034
1036
|
{
|
|
1035
|
-
connection_id:
|
|
1037
|
+
connection_id: o
|
|
1036
1038
|
}
|
|
1037
1039
|
),
|
|
1038
|
-
enabled:
|
|
1040
|
+
enabled: z(j)
|
|
1039
1041
|
// !!selectedConnectionId && !isNonDbConnection, //currentConnection?.type !== 'API', // Only fetch if connectionId is present
|
|
1040
1042
|
}), {
|
|
1041
1043
|
data: D,
|
|
1042
1044
|
isLoading: te,
|
|
1043
|
-
isFetching:
|
|
1045
|
+
isFetching: Q,
|
|
1044
1046
|
isError: ee,
|
|
1045
1047
|
refetch: Z
|
|
1046
1048
|
} = Ce({
|
|
1047
|
-
queryKey: ["schemas",
|
|
1049
|
+
queryKey: ["schemas", o, c],
|
|
1048
1050
|
queryFn: () => ze(
|
|
1049
1051
|
"https://semaphor.cloud/api/v1/schemas",
|
|
1050
1052
|
(t == null ? void 0 : t.accessToken) || "",
|
|
1051
1053
|
{
|
|
1052
|
-
connection_id:
|
|
1053
|
-
database_name:
|
|
1054
|
+
connection_id: o,
|
|
1055
|
+
database_name: c
|
|
1054
1056
|
}
|
|
1055
1057
|
),
|
|
1056
|
-
enabled: !!
|
|
1058
|
+
enabled: !!o && !!c && !F && c !== "NA"
|
|
1057
1059
|
//currentConnection?.type !== 'API', // Only fetch if connectionId and database is present
|
|
1058
1060
|
}), {
|
|
1059
|
-
data:
|
|
1061
|
+
data: J,
|
|
1060
1062
|
isLoading: I,
|
|
1061
1063
|
isFetching: y,
|
|
1062
1064
|
isError: v,
|
|
@@ -1064,17 +1066,17 @@ function xa(s, n) {
|
|
|
1064
1066
|
} = Ce({
|
|
1065
1067
|
queryKey: [
|
|
1066
1068
|
"tables",
|
|
1067
|
-
i,
|
|
1068
1069
|
o,
|
|
1069
|
-
|
|
1070
|
+
c,
|
|
1071
|
+
r
|
|
1070
1072
|
],
|
|
1071
1073
|
queryFn: () => ze(
|
|
1072
1074
|
"https://semaphor.cloud/api/v1/tables",
|
|
1073
1075
|
(t == null ? void 0 : t.accessToken) || "",
|
|
1074
1076
|
{
|
|
1075
|
-
connection_id:
|
|
1076
|
-
database_name:
|
|
1077
|
-
schema_name:
|
|
1077
|
+
connection_id: o,
|
|
1078
|
+
database_name: c,
|
|
1079
|
+
schema_name: r
|
|
1078
1080
|
}
|
|
1079
1081
|
),
|
|
1080
1082
|
enabled: x(j)
|
|
@@ -1086,22 +1088,22 @@ function xa(s, n) {
|
|
|
1086
1088
|
} = Ce({
|
|
1087
1089
|
queryKey: [
|
|
1088
1090
|
"columns",
|
|
1089
|
-
i,
|
|
1090
1091
|
o,
|
|
1091
|
-
|
|
1092
|
-
|
|
1092
|
+
c,
|
|
1093
|
+
r,
|
|
1094
|
+
l
|
|
1093
1095
|
],
|
|
1094
1096
|
queryFn: () => ze(
|
|
1095
1097
|
"https://semaphor.cloud/api/v1/columns",
|
|
1096
1098
|
(t == null ? void 0 : t.accessToken) || "",
|
|
1097
1099
|
{
|
|
1098
|
-
connection_id:
|
|
1099
|
-
database_name:
|
|
1100
|
-
schema_name:
|
|
1101
|
-
table_name:
|
|
1100
|
+
connection_id: o,
|
|
1101
|
+
database_name: c,
|
|
1102
|
+
schema_name: r,
|
|
1103
|
+
table_name: l
|
|
1102
1104
|
}
|
|
1103
1105
|
),
|
|
1104
|
-
enabled:
|
|
1106
|
+
enabled: g(j)
|
|
1105
1107
|
// (!!selectedConnectionId &&
|
|
1106
1108
|
// !!selectedDatabaseName &&
|
|
1107
1109
|
// !!selectedSchemaName &&
|
|
@@ -1110,56 +1112,56 @@ function xa(s, n) {
|
|
|
1110
1112
|
//currentConnection?.type === 'API',
|
|
1111
1113
|
// && currentConnection?.type !== 'API', // Only fetch if connectionId, database, and table is present
|
|
1112
1114
|
});
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
}, [H,
|
|
1115
|
+
P(() => {
|
|
1116
|
+
d(a);
|
|
1117
|
+
}, [H, d, a]), P(() => {
|
|
1116
1118
|
}, [
|
|
1117
1119
|
F,
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
+
h,
|
|
1121
|
+
S,
|
|
1120
1122
|
u,
|
|
1121
1123
|
m,
|
|
1122
1124
|
O
|
|
1123
1125
|
]);
|
|
1124
|
-
const je = (O == null ? void 0 : O.type) === "API" ? (ss = O == null ? void 0 : O.type) == null ? void 0 : ss.toLowerCase() :
|
|
1125
|
-
function xe(
|
|
1126
|
-
u(
|
|
1126
|
+
const je = (O == null ? void 0 : O.type) === "API" ? (ss = O == null ? void 0 : O.type) == null ? void 0 : ss.toLowerCase() : l || "", be = F ? "" : r || "";
|
|
1127
|
+
function xe(C) {
|
|
1128
|
+
u(C), S("");
|
|
1127
1129
|
}
|
|
1128
|
-
function
|
|
1129
|
-
m(
|
|
1130
|
+
function U(C) {
|
|
1131
|
+
m(C), u(""), S("");
|
|
1130
1132
|
}
|
|
1131
|
-
function ne(
|
|
1132
|
-
|
|
1133
|
+
function ne(C) {
|
|
1134
|
+
f(C);
|
|
1133
1135
|
}
|
|
1134
|
-
A && ((ve = A == null ? void 0 : A.databases) == null ? void 0 : ve.length) > 0, D && ((Je = D == null ? void 0 : D.schemas) == null ? void 0 : Je.length) > 0, H && ((
|
|
1135
|
-
...
|
|
1136
|
-
data_type:
|
|
1137
|
-
}))), $ && (a = []), (ge ||
|
|
1138
|
-
const
|
|
1139
|
-
(
|
|
1140
|
-
id:
|
|
1141
|
-
name:
|
|
1142
|
-
type:
|
|
1136
|
+
A && ((ve = A == null ? void 0 : A.databases) == null ? void 0 : ve.length) > 0, D && ((Je = D == null ? void 0 : D.schemas) == null ? void 0 : Je.length) > 0, H && ((qe = H == null ? void 0 : H.columns) == null ? void 0 : qe.length) > 0 && (a = H.columns.map((C) => ({
|
|
1137
|
+
...C,
|
|
1138
|
+
data_type: C.data_type.toLowerCase()
|
|
1139
|
+
}))), $ && (a = []), (ge || N) && (a = []);
|
|
1140
|
+
const re = b == null ? void 0 : b.connections.map(
|
|
1141
|
+
(C) => ({
|
|
1142
|
+
id: C.id,
|
|
1143
|
+
name: C.name,
|
|
1144
|
+
type: C.type
|
|
1143
1145
|
})
|
|
1144
|
-
), ye = A == null ? void 0 : A.databases.map((
|
|
1145
|
-
id:
|
|
1146
|
-
name:
|
|
1147
|
-
})),
|
|
1148
|
-
id:
|
|
1149
|
-
name:
|
|
1150
|
-
})), Ie =
|
|
1151
|
-
id:
|
|
1152
|
-
name:
|
|
1146
|
+
), ye = A == null ? void 0 : A.databases.map((C) => ({
|
|
1147
|
+
id: C.database_name,
|
|
1148
|
+
name: C.database_name
|
|
1149
|
+
})), le = D == null ? void 0 : D.schemas.map((C) => ({
|
|
1150
|
+
id: C.schema_name,
|
|
1151
|
+
name: C.schema_name
|
|
1152
|
+
})), Ie = J == null ? void 0 : J.tables.map((C) => ({
|
|
1153
|
+
id: C.table_name,
|
|
1154
|
+
name: C.table_name
|
|
1153
1155
|
}));
|
|
1154
1156
|
return {
|
|
1155
|
-
connectionItems:
|
|
1157
|
+
connectionItems: re,
|
|
1156
1158
|
isConnectionsLoading: L,
|
|
1157
|
-
isConnectionsError:
|
|
1159
|
+
isConnectionsError: N,
|
|
1158
1160
|
databaseItems: ye,
|
|
1159
|
-
isDatabasesLoadingOrFetching:
|
|
1161
|
+
isDatabasesLoadingOrFetching: q || K,
|
|
1160
1162
|
isDatabaseError: $,
|
|
1161
|
-
schemaItems:
|
|
1162
|
-
isSchemaLoadingOrFetching: te ||
|
|
1163
|
+
schemaItems: le,
|
|
1164
|
+
isSchemaLoadingOrFetching: te || Q,
|
|
1163
1165
|
isSchemaError: ee,
|
|
1164
1166
|
tableItems: Ie,
|
|
1165
1167
|
isTableLoadingOrFetching: I || y,
|
|
@@ -1172,51 +1174,51 @@ function xa(s, n) {
|
|
|
1172
1174
|
tableName: je,
|
|
1173
1175
|
schemaName: be,
|
|
1174
1176
|
handleConnectionChange: ne,
|
|
1175
|
-
handleDatabaseChange:
|
|
1177
|
+
handleDatabaseChange: U,
|
|
1176
1178
|
handleSchemaChange: xe
|
|
1177
1179
|
};
|
|
1178
1180
|
}
|
|
1179
1181
|
function pa({
|
|
1180
1182
|
ColumnsComponent: s
|
|
1181
1183
|
}) {
|
|
1182
|
-
var
|
|
1183
|
-
const n =
|
|
1184
|
+
var J;
|
|
1185
|
+
const n = i(
|
|
1184
1186
|
(I) => I.selectedConnectionId
|
|
1185
|
-
), a =
|
|
1187
|
+
), a = i(
|
|
1186
1188
|
(I) => I.selectedDatabaseName
|
|
1187
|
-
), t =
|
|
1189
|
+
), t = i(
|
|
1188
1190
|
(I) => I.selectedSchemaName
|
|
1189
|
-
),
|
|
1191
|
+
), o = i((I) => I.selectedTableName), c = i(
|
|
1190
1192
|
(I) => I.actions.setSelectedTableName
|
|
1191
1193
|
), {
|
|
1192
|
-
connectionItems:
|
|
1193
|
-
schemaItems:
|
|
1194
|
-
databaseItems:
|
|
1195
|
-
tableItems:
|
|
1194
|
+
connectionItems: r,
|
|
1195
|
+
schemaItems: l,
|
|
1196
|
+
databaseItems: d,
|
|
1197
|
+
tableItems: f,
|
|
1196
1198
|
columns: m,
|
|
1197
1199
|
isConnectionsLoading: u,
|
|
1198
|
-
isConnectionsError:
|
|
1199
|
-
isDatabasesLoadingOrFetching:
|
|
1200
|
+
isConnectionsError: S,
|
|
1201
|
+
isDatabasesLoadingOrFetching: h,
|
|
1200
1202
|
isDatabaseError: x,
|
|
1201
|
-
isSchemaLoadingOrFetching:
|
|
1202
|
-
isSchemaError:
|
|
1203
|
+
isSchemaLoadingOrFetching: g,
|
|
1204
|
+
isSchemaError: z,
|
|
1203
1205
|
isColumnsError: b,
|
|
1204
1206
|
isColumnsLoadingOrFetching: L,
|
|
1205
|
-
isTableLoadingOrFetching:
|
|
1207
|
+
isTableLoadingOrFetching: N,
|
|
1206
1208
|
isTableError: O,
|
|
1207
1209
|
connectionType: j,
|
|
1208
1210
|
isNonDbConnection: F,
|
|
1209
1211
|
handleConnectionChange: A,
|
|
1210
|
-
handleDatabaseChange:
|
|
1211
|
-
handleSchemaChange:
|
|
1212
|
+
handleDatabaseChange: q,
|
|
1213
|
+
handleSchemaChange: K,
|
|
1212
1214
|
tableName: $,
|
|
1213
|
-
schemaName:
|
|
1215
|
+
schemaName: G
|
|
1214
1216
|
} = xa();
|
|
1215
1217
|
function D() {
|
|
1216
|
-
return s ? s(
|
|
1218
|
+
return s ? s(G, $, m) : /* @__PURE__ */ e.jsx(
|
|
1217
1219
|
Cn,
|
|
1218
1220
|
{
|
|
1219
|
-
schemaName:
|
|
1221
|
+
schemaName: G,
|
|
1220
1222
|
tableName: $,
|
|
1221
1223
|
columns: m,
|
|
1222
1224
|
status: L ? "Loading..." : b ? "Error" : "Success"
|
|
@@ -1226,14 +1228,14 @@ function pa({
|
|
|
1226
1228
|
function te() {
|
|
1227
1229
|
window.location.href = "mailto:support@semaphor.cloud?subject=Help&body=I need help with...";
|
|
1228
1230
|
}
|
|
1229
|
-
function
|
|
1231
|
+
function Q() {
|
|
1230
1232
|
return j === "S3" || j === "API" ? null : /* @__PURE__ */ e.jsx(
|
|
1231
1233
|
Qe,
|
|
1232
1234
|
{
|
|
1233
|
-
onChange:
|
|
1235
|
+
onChange: q,
|
|
1234
1236
|
isError: x,
|
|
1235
|
-
isLoading:
|
|
1236
|
-
items:
|
|
1237
|
+
isLoading: h,
|
|
1238
|
+
items: d,
|
|
1237
1239
|
value: a || "",
|
|
1238
1240
|
title: "Database"
|
|
1239
1241
|
}
|
|
@@ -1243,10 +1245,10 @@ function pa({
|
|
|
1243
1245
|
return j === "S3" || j === "API" ? null : /* @__PURE__ */ e.jsx(
|
|
1244
1246
|
Qe,
|
|
1245
1247
|
{
|
|
1246
|
-
onChange:
|
|
1247
|
-
isError:
|
|
1248
|
-
isLoading:
|
|
1249
|
-
items:
|
|
1248
|
+
onChange: K,
|
|
1249
|
+
isError: z,
|
|
1250
|
+
isLoading: g,
|
|
1251
|
+
items: l,
|
|
1250
1252
|
value: t || "",
|
|
1251
1253
|
title: "Schema"
|
|
1252
1254
|
}
|
|
@@ -1256,11 +1258,11 @@ function pa({
|
|
|
1256
1258
|
return j === "API" ? null : /* @__PURE__ */ e.jsx(
|
|
1257
1259
|
Qe,
|
|
1258
1260
|
{
|
|
1259
|
-
onChange:
|
|
1261
|
+
onChange: c,
|
|
1260
1262
|
isError: O,
|
|
1261
|
-
items:
|
|
1262
|
-
isLoading:
|
|
1263
|
-
value:
|
|
1263
|
+
items: f,
|
|
1264
|
+
isLoading: N,
|
|
1265
|
+
value: o || "",
|
|
1264
1266
|
title: "Table"
|
|
1265
1267
|
}
|
|
1266
1268
|
);
|
|
@@ -1270,31 +1272,31 @@ function pa({
|
|
|
1270
1272
|
/* @__PURE__ */ e.jsx(
|
|
1271
1273
|
Qe,
|
|
1272
1274
|
{
|
|
1273
|
-
items:
|
|
1275
|
+
items: r,
|
|
1274
1276
|
title: "Connection",
|
|
1275
1277
|
value: n || "",
|
|
1276
1278
|
onChange: A,
|
|
1277
1279
|
isLoading: u,
|
|
1278
|
-
isError:
|
|
1279
|
-
connectionTooltip: ((
|
|
1280
|
+
isError: S,
|
|
1281
|
+
connectionTooltip: ((J = r == null ? void 0 : r.find(
|
|
1280
1282
|
(I) => I.id === n
|
|
1281
|
-
)) == null ? void 0 :
|
|
1283
|
+
)) == null ? void 0 : J.type) || ""
|
|
1282
1284
|
}
|
|
1283
1285
|
),
|
|
1284
|
-
|
|
1286
|
+
Q(),
|
|
1285
1287
|
ee(),
|
|
1286
1288
|
Z()
|
|
1287
1289
|
] }),
|
|
1288
1290
|
D(),
|
|
1289
1291
|
/* @__PURE__ */ e.jsx("div", { className: "flex items-end justify-center gap-2 px-6 py-4", children: /* @__PURE__ */ e.jsxs(
|
|
1290
|
-
|
|
1292
|
+
w,
|
|
1291
1293
|
{
|
|
1292
1294
|
onClick: te,
|
|
1293
1295
|
size: "sm",
|
|
1294
1296
|
variant: "secondary",
|
|
1295
1297
|
className: "w-full",
|
|
1296
1298
|
children: [
|
|
1297
|
-
/* @__PURE__ */ e.jsx(
|
|
1299
|
+
/* @__PURE__ */ e.jsx(rn, { className: "mr-2 size-4" }),
|
|
1298
1300
|
"Help"
|
|
1299
1301
|
]
|
|
1300
1302
|
}
|
|
@@ -1302,19 +1304,19 @@ function pa({
|
|
|
1302
1304
|
] });
|
|
1303
1305
|
}
|
|
1304
1306
|
function Sn(s) {
|
|
1305
|
-
const n = s.toUpperCase().indexOf("WHERE"), a = s.toUpperCase().indexOf("GROUP BY"), t = s.toUpperCase().indexOf("LIMIT"),
|
|
1306
|
-
let
|
|
1307
|
-
if (
|
|
1308
|
-
const
|
|
1309
|
-
return `${
|
|
1307
|
+
const n = s.toUpperCase().indexOf("WHERE"), a = s.toUpperCase().indexOf("GROUP BY"), t = s.toUpperCase().indexOf("LIMIT"), o = s.toUpperCase().indexOf("ORDER BY");
|
|
1308
|
+
let c = s.length;
|
|
1309
|
+
if (o !== -1 && (c = o), t !== -1 && t < c && (c = t), n !== -1) {
|
|
1310
|
+
const r = s.substring(0, n), l = s.substring(n);
|
|
1311
|
+
return `${r} {{ filters | where }} AND ${l.substring(
|
|
1310
1312
|
6
|
|
1311
1313
|
)}`;
|
|
1312
1314
|
} else if (a !== -1) {
|
|
1313
|
-
const
|
|
1314
|
-
return `${
|
|
1315
|
+
const r = s.substring(0, a), l = s.substring(a);
|
|
1316
|
+
return `${r} {{ filters | where }} ${l}`;
|
|
1315
1317
|
} else {
|
|
1316
|
-
const
|
|
1317
|
-
return `${
|
|
1318
|
+
const r = s.substring(0, c), l = s.substring(c);
|
|
1319
|
+
return `${r} {{ filters | where }} ${l}`;
|
|
1318
1320
|
}
|
|
1319
1321
|
}
|
|
1320
1322
|
function kn({
|
|
@@ -1324,10 +1326,10 @@ function kn({
|
|
|
1324
1326
|
setTriggerAIRun: t
|
|
1325
1327
|
}) {
|
|
1326
1328
|
return /* @__PURE__ */ e.jsxs(Zs, { openDelay: 0, children: [
|
|
1327
|
-
/* @__PURE__ */ e.jsx(ea, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
1329
|
+
/* @__PURE__ */ e.jsx(ea, { asChild: !0, children: /* @__PURE__ */ e.jsx(w, { variant: "link", className: " p-0 h-5", children: /* @__PURE__ */ e.jsx(Qt, { className: "h-4 w-4 text-red-500" }) }) }),
|
|
1328
1330
|
/* @__PURE__ */ e.jsx(sa, { align: "start", className: " min-w-fit max-w-[500px]", children: /* @__PURE__ */ e.jsx("div", { className: "flex justify-between space-x-4", children: /* @__PURE__ */ e.jsxs("div", { className: "grow space-y-1 flex flex-col ", children: [
|
|
1329
1331
|
/* @__PURE__ */ e.jsxs(
|
|
1330
|
-
|
|
1332
|
+
w,
|
|
1331
1333
|
{
|
|
1332
1334
|
onClick: () => {
|
|
1333
1335
|
n(!0), a(s), t(!0);
|
|
@@ -1340,7 +1342,7 @@ function kn({
|
|
|
1340
1342
|
]
|
|
1341
1343
|
}
|
|
1342
1344
|
),
|
|
1343
|
-
/* @__PURE__ */ e.jsx(
|
|
1345
|
+
/* @__PURE__ */ e.jsx(Cs, { className: " min-h-0 max-h-[250px] overflow-scroll ", children: /* @__PURE__ */ e.jsx("p", { className: " overflow-auto text-sm leading-relaxed font-mono ", children: s }) })
|
|
1344
1346
|
] }) }) })
|
|
1345
1347
|
] });
|
|
1346
1348
|
}
|
|
@@ -1350,29 +1352,29 @@ function wn({
|
|
|
1350
1352
|
checked: a
|
|
1351
1353
|
}) {
|
|
1352
1354
|
return /* @__PURE__ */ e.jsxs("div", { className: "xbg-red-100 ml-6 flex items-center gap-2", children: [
|
|
1353
|
-
/* @__PURE__ */ e.jsx(
|
|
1355
|
+
/* @__PURE__ */ e.jsx(Pe, { checked: a, onCheckedChange: n }),
|
|
1354
1356
|
/* @__PURE__ */ e.jsx("label", { className: "text-xs leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: s })
|
|
1355
1357
|
] });
|
|
1356
1358
|
}
|
|
1357
1359
|
function zn() {
|
|
1358
|
-
const { authToken: s } = es(), n = $e(null), a =
|
|
1360
|
+
const { authToken: s } = es(), n = $e(null), a = i((l) => l.applyFilters), [t, o] = T(""), c = i((l) => l.filterValues), r = i((l) => l.card.sql);
|
|
1359
1361
|
return /* @__PURE__ */ e.jsxs(
|
|
1360
1362
|
Zs,
|
|
1361
1363
|
{
|
|
1362
1364
|
openDelay: 0,
|
|
1363
|
-
onOpenChange: async (
|
|
1364
|
-
if (!
|
|
1365
|
+
onOpenChange: async (l) => {
|
|
1366
|
+
if (!l)
|
|
1365
1367
|
return;
|
|
1366
1368
|
console.log("onOpenChange");
|
|
1367
|
-
const
|
|
1369
|
+
const d = await aa(
|
|
1368
1370
|
"https://semaphor.cloud/api/v1/filter-sql",
|
|
1369
1371
|
(s == null ? void 0 : s.accessToken) || "",
|
|
1370
1372
|
{
|
|
1371
|
-
sql:
|
|
1372
|
-
active_filters:
|
|
1373
|
+
sql: r,
|
|
1374
|
+
active_filters: c
|
|
1373
1375
|
}
|
|
1374
1376
|
);
|
|
1375
|
-
console.log(
|
|
1377
|
+
console.log(d), d.sql ? (console.log(d.records), o(d.sql)) : o("Error");
|
|
1376
1378
|
},
|
|
1377
1379
|
children: [
|
|
1378
1380
|
/* @__PURE__ */ e.jsx(ea, { asChild: !0, children: a && /* @__PURE__ */ e.jsx("p", { className: "p-0 text-xs hover:cursor-pointer", children: "| Filter Query" }) }),
|
|
@@ -1448,30 +1450,30 @@ function On({
|
|
|
1448
1450
|
setOpen: n,
|
|
1449
1451
|
userInput: a,
|
|
1450
1452
|
setUserInput: t,
|
|
1451
|
-
triggerAIRun:
|
|
1452
|
-
setTriggerAIRun:
|
|
1453
|
+
triggerAIRun: o,
|
|
1454
|
+
setTriggerAIRun: c
|
|
1453
1455
|
}) {
|
|
1454
|
-
const
|
|
1456
|
+
const r = $e(null), l = $e(null), { authToken: d } = es(), [f, m] = T(!1), u = i((y) => y.actions.setCardSql), S = k((y) => y.dashboard.baseQueries), h = i((y) => y.actions.setRunSql), x = i((y) => y.actions.setCardType), [g, z] = T([]), b = i((y) => y.currentColumns), L = i((y) => y.card.sql), N = i((y) => y.selectedTableName), O = `
|
|
1455
1457
|
${a}
|
|
1456
1458
|
|
|
1457
|
-
Database Query Dialect: ${
|
|
1458
|
-
Table Name: ${
|
|
1459
|
+
Database Query Dialect: ${N === "api" || N === "s3" ? "DuckDb" : ""}
|
|
1460
|
+
Table Name: ${N}
|
|
1459
1461
|
Table Columns: ${b == null ? void 0 : b.map((y) => `${y.column_name} | ${y.data_type}`).join(", ")}
|
|
1460
1462
|
User SQL: ${L}
|
|
1461
|
-
${
|
|
1462
|
-
Visual Query Syntax: ${Fn}`, { data: F, isLoading: A, isFetching:
|
|
1463
|
+
${S && `Base Queries: ${JSON.stringify(S)} `}`, j = ` When the user asks for a specific chart please use the following query structure to generate the chart query. Do not make up the column names. Use only the table columns provided above for the query. Replace x-axis, y-axis, and lables with the appropriate column names.
|
|
1464
|
+
Visual Query Syntax: ${Fn}`, { data: F, isLoading: A, isFetching: q, isError: K, refetch: $ } = Ce({
|
|
1463
1465
|
queryKey: ["ai-query"],
|
|
1464
1466
|
queryFn: () => ze(
|
|
1465
1467
|
"https://semaphor.cloud/api/v1/ai",
|
|
1466
|
-
(
|
|
1468
|
+
(d == null ? void 0 : d.accessToken) || "",
|
|
1467
1469
|
{
|
|
1468
|
-
user_content: `userContent: ${O} ${
|
|
1470
|
+
user_content: `userContent: ${O} ${f ? j : ""}`
|
|
1469
1471
|
}
|
|
1470
1472
|
),
|
|
1471
1473
|
enabled: !1
|
|
1472
1474
|
// Do not run by default.
|
|
1473
1475
|
});
|
|
1474
|
-
function
|
|
1476
|
+
function G(y) {
|
|
1475
1477
|
if (y.toLowerCase().includes("bar"))
|
|
1476
1478
|
x("bar");
|
|
1477
1479
|
else if (y.toLowerCase().includes("line"))
|
|
@@ -1492,24 +1494,24 @@ function On({
|
|
|
1492
1494
|
return x("bar"), !1;
|
|
1493
1495
|
return !0;
|
|
1494
1496
|
}
|
|
1495
|
-
|
|
1496
|
-
F &&
|
|
1497
|
-
}, [F]),
|
|
1497
|
+
P(() => {
|
|
1498
|
+
F && z((y) => [...y, { role: "ai", content: F.response }]);
|
|
1499
|
+
}, [F]), P(() => {
|
|
1498
1500
|
const y = setTimeout(() => {
|
|
1499
1501
|
var v;
|
|
1500
|
-
|
|
1501
|
-
top:
|
|
1502
|
+
l.current && (l.current.scroll({
|
|
1503
|
+
top: l.current.scrollHeight,
|
|
1502
1504
|
behavior: "smooth"
|
|
1503
|
-
}), (v =
|
|
1505
|
+
}), (v = r.current) == null || v.focus());
|
|
1504
1506
|
}, 100);
|
|
1505
1507
|
return () => clearTimeout(y);
|
|
1506
|
-
}, [
|
|
1508
|
+
}, [g]);
|
|
1507
1509
|
function D() {
|
|
1508
|
-
a && (
|
|
1510
|
+
a && (z((y) => [...y, { role: "user", content: a }]), G(a) && m(!0), t(""), $());
|
|
1509
1511
|
}
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
}, [
|
|
1512
|
+
P(() => {
|
|
1513
|
+
o && (D(), c(!1));
|
|
1514
|
+
}, [o, c]);
|
|
1513
1515
|
const te = {
|
|
1514
1516
|
//seleect a darker color
|
|
1515
1517
|
// color: '#000',
|
|
@@ -1518,7 +1520,7 @@ function On({
|
|
|
1518
1520
|
fontSize: 15,
|
|
1519
1521
|
// padding: '5px',
|
|
1520
1522
|
width: "100%"
|
|
1521
|
-
},
|
|
1523
|
+
}, Q = {
|
|
1522
1524
|
// background: '#f6f8fa',
|
|
1523
1525
|
// color: '#000',
|
|
1524
1526
|
fontFamily: "monospace",
|
|
@@ -1539,16 +1541,16 @@ function On({
|
|
|
1539
1541
|
// Override how paragraphs are rendered
|
|
1540
1542
|
p: ({ node: y, ...v }) => /* @__PURE__ */ e.jsx("p", { style: te, ...v }),
|
|
1541
1543
|
code: ({ node: y, ...v }) => /* @__PURE__ */ e.jsx("code", { className: "rounded-sm bg-muted px-2 py-1 text-sm", ...v }),
|
|
1542
|
-
pre: ({ node: y, ...v }) => /* @__PURE__ */ e.jsxs("pre", { className: "space-y-2 rounded-sm bg-muted/50 p-3", style:
|
|
1544
|
+
pre: ({ node: y, ...v }) => /* @__PURE__ */ e.jsxs("pre", { className: "space-y-2 rounded-sm bg-muted/50 p-3", style: Q, children: [
|
|
1543
1545
|
/* @__PURE__ */ e.jsx("code", { className: "whitespace-normal text-sm", children: v.children }),
|
|
1544
1546
|
/* @__PURE__ */ e.jsxs("div", { className: "flex justify-start gap-2", children: [
|
|
1545
|
-
/* @__PURE__ */ e.jsx(
|
|
1547
|
+
/* @__PURE__ */ e.jsx(w, { onClick: J, size: "sm", variant: "outline", children: /* @__PURE__ */ e.jsx(ta, {}) }),
|
|
1546
1548
|
/* @__PURE__ */ e.jsx(
|
|
1547
|
-
|
|
1549
|
+
w,
|
|
1548
1550
|
{
|
|
1549
1551
|
onClick: (M) => {
|
|
1550
|
-
const H =
|
|
1551
|
-
H && (n(!1), u(H),
|
|
1552
|
+
const H = J(M);
|
|
1553
|
+
H && (n(!1), u(H), h(!0));
|
|
1552
1554
|
},
|
|
1553
1555
|
size: "sm",
|
|
1554
1556
|
variant: "outline",
|
|
@@ -1560,7 +1562,7 @@ function On({
|
|
|
1560
1562
|
li: ({ node: y, ...v }) => /* @__PURE__ */ e.jsx("li", { style: ee, ...v })
|
|
1561
1563
|
// You can add more overrides for other elements like h1, h2, etc.
|
|
1562
1564
|
};
|
|
1563
|
-
function
|
|
1565
|
+
function J(y) {
|
|
1564
1566
|
const v = y.currentTarget.closest("pre");
|
|
1565
1567
|
if (!v)
|
|
1566
1568
|
return;
|
|
@@ -1568,7 +1570,7 @@ function On({
|
|
|
1568
1570
|
return navigator.clipboard.writeText(M).then(() => console.log("Text copied to clipboard")).catch((H) => console.error("Error in copying text: ", H)), M;
|
|
1569
1571
|
}
|
|
1570
1572
|
function I() {
|
|
1571
|
-
return
|
|
1573
|
+
return g == null ? void 0 : g.map((y, v) => y.role === "user" ? /* @__PURE__ */ e.jsxs(
|
|
1572
1574
|
"div",
|
|
1573
1575
|
{
|
|
1574
1576
|
className: "flex items-start rounded-md bg-muted p-3 text-sm",
|
|
@@ -1588,9 +1590,9 @@ function On({
|
|
|
1588
1590
|
v
|
|
1589
1591
|
) : /* @__PURE__ */ e.jsx("div", {}, v));
|
|
1590
1592
|
}
|
|
1591
|
-
return /* @__PURE__ */ e.jsxs(
|
|
1592
|
-
/* @__PURE__ */ e.jsx(
|
|
1593
|
-
|
|
1593
|
+
return /* @__PURE__ */ e.jsxs(xs, { open: s, onOpenChange: n, children: [
|
|
1594
|
+
/* @__PURE__ */ e.jsx(ps, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
1595
|
+
w,
|
|
1594
1596
|
{
|
|
1595
1597
|
size: "sm",
|
|
1596
1598
|
className: "w-full justify-start border font-normal text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0",
|
|
@@ -1599,18 +1601,18 @@ function On({
|
|
|
1599
1601
|
}
|
|
1600
1602
|
) }),
|
|
1601
1603
|
/* @__PURE__ */ e.jsxs(
|
|
1602
|
-
|
|
1604
|
+
fs,
|
|
1603
1605
|
{
|
|
1604
1606
|
className: "flex flex-col justify-between overflow-auto sm:max-w-[425px] md:max-h-[625px] md:min-w-[625px]",
|
|
1605
1607
|
children: [
|
|
1606
|
-
/* @__PURE__ */ e.jsxs(
|
|
1607
|
-
/* @__PURE__ */ e.jsx(
|
|
1608
|
-
/* @__PURE__ */ e.jsx(
|
|
1608
|
+
/* @__PURE__ */ e.jsxs(gs, { children: [
|
|
1609
|
+
/* @__PURE__ */ e.jsx(js, { children: "Assistant" }),
|
|
1610
|
+
/* @__PURE__ */ e.jsx(bs, { children: "What can I help you with?" })
|
|
1609
1611
|
] }),
|
|
1610
1612
|
/* @__PURE__ */ e.jsx(
|
|
1611
1613
|
"div",
|
|
1612
1614
|
{
|
|
1613
|
-
ref:
|
|
1615
|
+
ref: l,
|
|
1614
1616
|
className: "h-[625px] w-full overflow-auto border-t border-t-muted",
|
|
1615
1617
|
children: /* @__PURE__ */ e.jsx("div", { className: "space-y-4 py-2 pr-3", role: "messages", children: I() })
|
|
1616
1618
|
}
|
|
@@ -1623,7 +1625,7 @@ function On({
|
|
|
1623
1625
|
na,
|
|
1624
1626
|
{
|
|
1625
1627
|
autoFocus: !0,
|
|
1626
|
-
ref:
|
|
1628
|
+
ref: r,
|
|
1627
1629
|
onKeyDown: (y) => {
|
|
1628
1630
|
y.key === "Enter" && !y.shiftKey && (y.preventDefault(), t(""), D());
|
|
1629
1631
|
},
|
|
@@ -1632,23 +1634,23 @@ function On({
|
|
|
1632
1634
|
const v = y.target, M = v.value.length;
|
|
1633
1635
|
v.setSelectionRange(M, M);
|
|
1634
1636
|
},
|
|
1635
|
-
className:
|
|
1637
|
+
className: Y(
|
|
1636
1638
|
"max-h-10 min-h-7 resize-none border-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
|
|
1637
1639
|
),
|
|
1638
|
-
disabled: A ||
|
|
1640
|
+
disabled: A || q,
|
|
1639
1641
|
value: a,
|
|
1640
1642
|
onChange: (y) => t(y.target.value)
|
|
1641
1643
|
}
|
|
1642
1644
|
),
|
|
1643
1645
|
" ",
|
|
1644
1646
|
/* @__PURE__ */ e.jsx(
|
|
1645
|
-
|
|
1647
|
+
w,
|
|
1646
1648
|
{
|
|
1647
1649
|
className: "h-8",
|
|
1648
1650
|
size: "sm",
|
|
1649
1651
|
variant: "ghost",
|
|
1650
1652
|
onClick: D,
|
|
1651
|
-
children: !A && !
|
|
1653
|
+
children: !A && !q ? /* @__PURE__ */ e.jsx(Za, {}) : /* @__PURE__ */ e.jsx(Be, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" })
|
|
1652
1654
|
}
|
|
1653
1655
|
)
|
|
1654
1656
|
] })
|
|
@@ -1669,20 +1671,20 @@ var fa = {
|
|
|
1669
1671
|
function Tn(s, n) {
|
|
1670
1672
|
if (s == null)
|
|
1671
1673
|
return {};
|
|
1672
|
-
var a = An(s, n), t,
|
|
1674
|
+
var a = An(s, n), t, o;
|
|
1673
1675
|
if (Object.getOwnPropertySymbols) {
|
|
1674
|
-
var
|
|
1675
|
-
for (
|
|
1676
|
-
t = o
|
|
1676
|
+
var c = Object.getOwnPropertySymbols(s);
|
|
1677
|
+
for (o = 0; o < c.length; o++)
|
|
1678
|
+
t = c[o], !(n.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(s, t) && (a[t] = s[t]);
|
|
1677
1679
|
}
|
|
1678
1680
|
return a;
|
|
1679
1681
|
}
|
|
1680
1682
|
function An(s, n) {
|
|
1681
1683
|
if (s == null)
|
|
1682
1684
|
return {};
|
|
1683
|
-
var a = {}, t = Object.keys(s),
|
|
1684
|
-
for (
|
|
1685
|
-
|
|
1685
|
+
var a = {}, t = Object.keys(s), o, c;
|
|
1686
|
+
for (c = 0; c < t.length; c++)
|
|
1687
|
+
o = t[c], !(n.indexOf(o) >= 0) && (a[o] = s[o]);
|
|
1686
1688
|
return a;
|
|
1687
1689
|
}
|
|
1688
1690
|
function Xe() {
|
|
@@ -1699,8 +1701,8 @@ function Bs(s, n) {
|
|
|
1699
1701
|
var a = Object.keys(s);
|
|
1700
1702
|
if (Object.getOwnPropertySymbols) {
|
|
1701
1703
|
var t = Object.getOwnPropertySymbols(s);
|
|
1702
|
-
n && (t = t.filter(function(
|
|
1703
|
-
return Object.getOwnPropertyDescriptor(s,
|
|
1704
|
+
n && (t = t.filter(function(o) {
|
|
1705
|
+
return Object.getOwnPropertyDescriptor(s, o).enumerable;
|
|
1704
1706
|
})), a.push.apply(a, t);
|
|
1705
1707
|
}
|
|
1706
1708
|
return a;
|
|
@@ -1749,124 +1751,127 @@ function In(s) {
|
|
|
1749
1751
|
var n = (a) => {
|
|
1750
1752
|
var {
|
|
1751
1753
|
attr: t,
|
|
1752
|
-
size:
|
|
1753
|
-
title:
|
|
1754
|
-
} = s,
|
|
1755
|
-
return a.className && (
|
|
1754
|
+
size: o,
|
|
1755
|
+
title: c
|
|
1756
|
+
} = s, r = Tn(s, Mn), l = o || a.size || "1em", d;
|
|
1757
|
+
return a.className && (d = a.className), s.className && (d = (d ? d + " " : "") + s.className), /* @__PURE__ */ me.createElement("svg", Xe({
|
|
1756
1758
|
stroke: "currentColor",
|
|
1757
1759
|
fill: "currentColor",
|
|
1758
1760
|
strokeWidth: "0"
|
|
1759
|
-
}, a.attr, t,
|
|
1760
|
-
className:
|
|
1761
|
+
}, a.attr, t, r, {
|
|
1762
|
+
className: d,
|
|
1761
1763
|
style: Ze(Ze({
|
|
1762
1764
|
color: s.color || a.color
|
|
1763
1765
|
}, a.style), s.style),
|
|
1764
|
-
height:
|
|
1765
|
-
width:
|
|
1766
|
+
height: l,
|
|
1767
|
+
width: l,
|
|
1766
1768
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1767
|
-
}),
|
|
1769
|
+
}), c && /* @__PURE__ */ me.createElement("title", null, c), s.children);
|
|
1768
1770
|
};
|
|
1769
1771
|
return Hs !== void 0 ? /* @__PURE__ */ me.createElement(Hs.Consumer, null, (a) => n(a)) : n(fa);
|
|
1770
1772
|
}
|
|
1771
|
-
function
|
|
1773
|
+
function qn(s) {
|
|
1772
1774
|
return fe({ tag: "svg", attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z" }, child: [] }] })(s);
|
|
1773
1775
|
}
|
|
1774
|
-
function
|
|
1775
|
-
const { theme: s } = at(), n = $e(), a = $e(), [t,
|
|
1776
|
+
function Vn() {
|
|
1777
|
+
const { theme: s } = at(), n = $e(), a = $e(), [t, o] = T(!1), [c, r] = T(!1), [l, d] = T(!1), [f, m] = T(""), [u, S] = T(!1), { authToken: h } = es();
|
|
1776
1778
|
k((p) => p.selectedSheetId);
|
|
1777
|
-
const x = k((p) => p.dashboard.baseQueries),
|
|
1779
|
+
const x = k((p) => p.dashboard.baseQueries), g = i((p) => p.card), z = k((p) => p.theme), b = i((p) => p.isShowingVisual), L = i(
|
|
1778
1780
|
(p) => p.selectedConnectionId
|
|
1779
|
-
),
|
|
1781
|
+
), N = i(
|
|
1780
1782
|
(p) => p.selectedDatabaseName
|
|
1781
|
-
), O =
|
|
1783
|
+
), O = i(
|
|
1782
1784
|
(p) => p.selectedSchemaName
|
|
1783
1785
|
);
|
|
1784
1786
|
k(
|
|
1785
1787
|
(p) => p.actions.updateFrameCard
|
|
1786
1788
|
);
|
|
1787
|
-
const j =
|
|
1789
|
+
const j = i((p) => p.selectedTableName), F = i((p) => p.card.sql), A = i((p) => p.card.python), q = tt(F, x), K = i((p) => p.selectedConnectionId), $ = i((p) => p.frame), G = i((p) => p.filterValues), D = i((p) => p.applyFilters), {
|
|
1788
1790
|
setCardCustomCfg: te,
|
|
1789
|
-
setQueryResultColumns:
|
|
1791
|
+
setQueryResultColumns: Q,
|
|
1790
1792
|
setFilterValues: ee,
|
|
1791
1793
|
setCardSql: Z,
|
|
1792
|
-
setCardPython:
|
|
1794
|
+
setCardPython: J,
|
|
1793
1795
|
setQueryError: I,
|
|
1794
1796
|
setPythonStdOut: y,
|
|
1795
1797
|
setCardPreferences: v
|
|
1796
|
-
} =
|
|
1798
|
+
} = i((p) => p.actions), M = i((p) => p.onSave), H = i(
|
|
1797
1799
|
(p) => p.actions.setApplyFilters
|
|
1798
|
-
), ue =
|
|
1800
|
+
), ue = i((p) => p.onClose), se = i((p) => p.actions.setCardData), ge = i((p) => p.actions.setSqlGen), je = i((p) => p.runSql), be = i((p) => p.actions.setRunSql), xe = i(
|
|
1799
1801
|
(p) => p.actions.setIsSqlRunning
|
|
1800
1802
|
), {
|
|
1801
|
-
data:
|
|
1803
|
+
data: U,
|
|
1802
1804
|
isLoading: ne,
|
|
1803
|
-
isFetching:
|
|
1805
|
+
isFetching: re,
|
|
1804
1806
|
isSuccess: ye,
|
|
1805
|
-
isError:
|
|
1807
|
+
isError: le,
|
|
1806
1808
|
error: Ie,
|
|
1807
1809
|
status: ss,
|
|
1808
1810
|
refetch: ve
|
|
1809
1811
|
} = Ce({
|
|
1810
|
-
queryKey: [
|
|
1812
|
+
queryKey: [q, A],
|
|
1811
1813
|
queryFn: () => aa(
|
|
1812
1814
|
"https://semaphor.cloud/api/v1/query",
|
|
1813
|
-
(
|
|
1815
|
+
(h == null ? void 0 : h.accessToken) || "",
|
|
1814
1816
|
{
|
|
1815
|
-
connection_id:
|
|
1816
|
-
sql:
|
|
1817
|
+
connection_id: K,
|
|
1818
|
+
sql: q,
|
|
1817
1819
|
python: A === Ls ? "" : A,
|
|
1818
|
-
active_filters: D ?
|
|
1820
|
+
active_filters: D ? G : []
|
|
1819
1821
|
}
|
|
1820
1822
|
),
|
|
1821
1823
|
enabled: !1,
|
|
1822
1824
|
retry: !1
|
|
1823
1825
|
});
|
|
1824
|
-
|
|
1825
|
-
if (
|
|
1826
|
-
|
|
1827
|
-
|
|
1826
|
+
P(() => {
|
|
1827
|
+
if (U && (se(U.records), U.rowLimitExceeded && cs.error("Row limit (10,000) exceeded. Refine your query.", {
|
|
1828
|
+
position: "top-center",
|
|
1829
|
+
richColors: !0
|
|
1830
|
+
}), y((U == null ? void 0 : U.output) || ""), U.records.length > 0)) {
|
|
1831
|
+
const { dimensionKeys: p } = hs(U.records);
|
|
1832
|
+
Q(p);
|
|
1828
1833
|
}
|
|
1829
|
-
}, [
|
|
1834
|
+
}, [U, se, Q, y]), P(() => {
|
|
1830
1835
|
je && (ve(), be(!1));
|
|
1831
|
-
}, [je, ve, be]),
|
|
1832
|
-
(ne ||
|
|
1836
|
+
}, [je, ve, be]), P(() => {
|
|
1837
|
+
(ne || re) && xe(!0), (le || ye) && xe(!1), le ? (I(Ie.message), se([]), Q([]), y("")) : I("");
|
|
1833
1838
|
}, [
|
|
1834
1839
|
ne,
|
|
1835
|
-
le,
|
|
1836
|
-
G,
|
|
1837
|
-
y,
|
|
1838
1840
|
re,
|
|
1841
|
+
U,
|
|
1842
|
+
y,
|
|
1843
|
+
le,
|
|
1839
1844
|
ye,
|
|
1840
1845
|
xe,
|
|
1841
1846
|
se,
|
|
1842
|
-
|
|
1847
|
+
Q,
|
|
1843
1848
|
I,
|
|
1844
1849
|
Ie
|
|
1845
1850
|
]);
|
|
1846
1851
|
function Je() {
|
|
1847
1852
|
Z(""), se([]), ge({}), te(""), v({});
|
|
1848
1853
|
}
|
|
1849
|
-
const
|
|
1854
|
+
const qe = (p) => {
|
|
1850
1855
|
a.current = p;
|
|
1851
1856
|
};
|
|
1852
|
-
function
|
|
1857
|
+
function C() {
|
|
1853
1858
|
let p = F;
|
|
1854
1859
|
F && !F.includes("{{") && (p = Sn(F), Z(p));
|
|
1855
1860
|
const ie = {
|
|
1856
|
-
...
|
|
1861
|
+
...g,
|
|
1857
1862
|
lastSelectedSchema: O,
|
|
1858
|
-
lastSelectedDatabase:
|
|
1863
|
+
lastSelectedDatabase: N,
|
|
1859
1864
|
lastSelectedTable: j,
|
|
1860
1865
|
connectionId: L,
|
|
1861
|
-
type: b ?
|
|
1866
|
+
type: b ? g.type : "table",
|
|
1862
1867
|
sql: p,
|
|
1863
|
-
customCfg: b ?
|
|
1864
|
-
},
|
|
1865
|
-
(Ne) => Ne.id ===
|
|
1868
|
+
customCfg: b ? g.customCfg : null
|
|
1869
|
+
}, Ve = $.cards.map(
|
|
1870
|
+
(Ne) => Ne.id === g.id ? ie : Ne
|
|
1866
1871
|
);
|
|
1867
1872
|
M == null || M({
|
|
1868
1873
|
...$,
|
|
1869
|
-
cards:
|
|
1874
|
+
cards: Ve
|
|
1870
1875
|
});
|
|
1871
1876
|
}
|
|
1872
1877
|
function Fa() {
|
|
@@ -1879,19 +1884,19 @@ function qn() {
|
|
|
1879
1884
|
return Ma(ie);
|
|
1880
1885
|
}
|
|
1881
1886
|
function Ma(p) {
|
|
1882
|
-
const [ie,
|
|
1887
|
+
const [ie, Ve, Ne] = p.split(" "), W = parseFloat(ie), Ea = parseFloat(Ve), La = parseFloat(Ne), Da = Ea / 100, Ts = La / 100, pe = (1 - Math.abs(2 * Ts - 1)) * Da, ke = pe * (1 - Math.abs(W / 60 % 2 - 1)), as = Ts - pe / 2;
|
|
1883
1888
|
let oe = 0, ce = 0, de = 0;
|
|
1884
|
-
0 <=
|
|
1889
|
+
0 <= W && W < 60 ? (oe = pe, ce = ke, de = 0) : 60 <= W && W < 120 ? (oe = ke, ce = pe, de = 0) : 120 <= W && W < 180 ? (oe = 0, ce = pe, de = ke) : 180 <= W && W < 240 ? (oe = 0, ce = ke, de = pe) : 240 <= W && W < 300 ? (oe = ke, ce = 0, de = pe) : 300 <= W && W < 360 && (oe = pe, ce = 0, de = ke), oe = Math.round((oe + as) * 255), ce = Math.round((ce + as) * 255), de = Math.round((de + as) * 255);
|
|
1885
1890
|
const ts = (Ia) => {
|
|
1886
1891
|
const ns = Ia.toString(16);
|
|
1887
1892
|
return ns.length == 1 ? "0" + ns : ns;
|
|
1888
1893
|
};
|
|
1889
1894
|
return `#${ts(oe)}${ts(ce)}${ts(de)}`;
|
|
1890
1895
|
}
|
|
1891
|
-
|
|
1896
|
+
P(() => {
|
|
1892
1897
|
const p = n.current, ie = a.current;
|
|
1893
1898
|
if (p) {
|
|
1894
|
-
const
|
|
1899
|
+
const Ve = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", Ne = z === "system" ? Ve : z;
|
|
1895
1900
|
p.editor.defineTheme("default", {
|
|
1896
1901
|
// base: theme === 'light' ? 'hc-light' : 'vs-dark',
|
|
1897
1902
|
base: Ne === "light" ? "vs" : "vs-dark",
|
|
@@ -1910,13 +1915,13 @@ function qn() {
|
|
|
1910
1915
|
}
|
|
1911
1916
|
), () => {
|
|
1912
1917
|
};
|
|
1913
|
-
}, [s,
|
|
1914
|
-
function
|
|
1918
|
+
}, [s, z, n.current]);
|
|
1919
|
+
function Ms(p) {
|
|
1915
1920
|
n.current = p;
|
|
1916
1921
|
}
|
|
1917
1922
|
function Ta() {
|
|
1918
1923
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
1919
|
-
|
|
1924
|
+
c && /* @__PURE__ */ e.jsx(
|
|
1920
1925
|
"div",
|
|
1921
1926
|
{
|
|
1922
1927
|
className: "xbg-yellow-100 relative flex w-1/3 min-w-0 grow overflow-hidden border-l p-1 text-xs",
|
|
@@ -1932,10 +1937,10 @@ function qn() {
|
|
|
1932
1937
|
}
|
|
1933
1938
|
),
|
|
1934
1939
|
/* @__PURE__ */ e.jsx(zn, {}),
|
|
1935
|
-
|
|
1940
|
+
G && c && /* @__PURE__ */ e.jsx(
|
|
1936
1941
|
_e,
|
|
1937
1942
|
{
|
|
1938
|
-
onClick: () =>
|
|
1943
|
+
onClick: () => r(!1),
|
|
1939
1944
|
className: "bg-background/50 text-foreground/50 hover:cursor-pointer hover:text-foreground"
|
|
1940
1945
|
}
|
|
1941
1946
|
)
|
|
@@ -1953,7 +1958,7 @@ function qn() {
|
|
|
1953
1958
|
},
|
|
1954
1959
|
defaultLanguage: "json",
|
|
1955
1960
|
className: "mt-1 min-h-[220px]",
|
|
1956
|
-
value: JSON.stringify(
|
|
1961
|
+
value: JSON.stringify(G, null, 2),
|
|
1957
1962
|
options: {
|
|
1958
1963
|
readOnly: !0,
|
|
1959
1964
|
minimap: {
|
|
@@ -1974,11 +1979,11 @@ function qn() {
|
|
|
1974
1979
|
] })
|
|
1975
1980
|
}
|
|
1976
1981
|
),
|
|
1977
|
-
|
|
1982
|
+
G && !c && /* @__PURE__ */ e.jsx(
|
|
1978
1983
|
oa,
|
|
1979
1984
|
{
|
|
1980
|
-
onClick: () =>
|
|
1981
|
-
className:
|
|
1985
|
+
onClick: () => r(!0),
|
|
1986
|
+
className: Y(
|
|
1982
1987
|
"absolute bottom-4 right-6 h-3 w-3 text-foreground/50 hover:cursor-pointer hover:text-foreground",
|
|
1983
1988
|
{
|
|
1984
1989
|
"font-bold text-red-800": D
|
|
@@ -1990,7 +1995,7 @@ function qn() {
|
|
|
1990
1995
|
}
|
|
1991
1996
|
function Aa() {
|
|
1992
1997
|
return /* @__PURE__ */ e.jsxs(
|
|
1993
|
-
|
|
1998
|
+
ms,
|
|
1994
1999
|
{
|
|
1995
2000
|
className: "flex grow pb-1",
|
|
1996
2001
|
direction: "vertical",
|
|
@@ -2032,8 +2037,8 @@ function qn() {
|
|
|
2032
2037
|
},
|
|
2033
2038
|
defaultLanguage: "sql",
|
|
2034
2039
|
defaultValue: "SELECT * FROM table",
|
|
2035
|
-
beforeMount:
|
|
2036
|
-
onMount:
|
|
2040
|
+
beforeMount: Ms,
|
|
2041
|
+
onMount: qe
|
|
2037
2042
|
}
|
|
2038
2043
|
)
|
|
2039
2044
|
}
|
|
@@ -2043,7 +2048,7 @@ function qn() {
|
|
|
2043
2048
|
}
|
|
2044
2049
|
),
|
|
2045
2050
|
t && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
2046
|
-
/* @__PURE__ */ e.jsx(
|
|
2051
|
+
/* @__PURE__ */ e.jsx(us, { withHandle: !0, className: "border" }),
|
|
2047
2052
|
/* @__PURE__ */ e.jsxs(
|
|
2048
2053
|
Fe,
|
|
2049
2054
|
{
|
|
@@ -2063,7 +2068,7 @@ function qn() {
|
|
|
2063
2068
|
className: "pt-3",
|
|
2064
2069
|
theme: "default",
|
|
2065
2070
|
onChange: (p) => {
|
|
2066
|
-
|
|
2071
|
+
J(p && p.trim() || "");
|
|
2067
2072
|
},
|
|
2068
2073
|
value: A || Ls,
|
|
2069
2074
|
options: {
|
|
@@ -2079,8 +2084,8 @@ function qn() {
|
|
|
2079
2084
|
renderLineHighlight: "none"
|
|
2080
2085
|
},
|
|
2081
2086
|
defaultLanguage: "python",
|
|
2082
|
-
beforeMount:
|
|
2083
|
-
onMount:
|
|
2087
|
+
beforeMount: Ms,
|
|
2088
|
+
onMount: qe
|
|
2084
2089
|
}
|
|
2085
2090
|
)
|
|
2086
2091
|
}
|
|
@@ -2121,10 +2126,10 @@ function qn() {
|
|
|
2121
2126
|
children: [
|
|
2122
2127
|
/* @__PURE__ */ e.jsxs("div", { className: "flex grow items-center gap-2", children: [
|
|
2123
2128
|
/* @__PURE__ */ e.jsxs(
|
|
2124
|
-
|
|
2129
|
+
w,
|
|
2125
2130
|
{
|
|
2126
2131
|
title: "Shift + Enter",
|
|
2127
|
-
disabled: ne ||
|
|
2132
|
+
disabled: ne || re,
|
|
2128
2133
|
onClick: () => {
|
|
2129
2134
|
ve();
|
|
2130
2135
|
},
|
|
@@ -2132,22 +2137,22 @@ function qn() {
|
|
|
2132
2137
|
size: "sm",
|
|
2133
2138
|
variant: "outline",
|
|
2134
2139
|
children: [
|
|
2135
|
-
ne ||
|
|
2140
|
+
ne || re ? /* @__PURE__ */ e.jsx(Be, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx(on, { className: "mr-2 h-4 w-4" }),
|
|
2136
2141
|
"Run"
|
|
2137
2142
|
]
|
|
2138
2143
|
}
|
|
2139
2144
|
),
|
|
2140
|
-
|
|
2145
|
+
le && /* @__PURE__ */ e.jsx(
|
|
2141
2146
|
kn,
|
|
2142
2147
|
{
|
|
2143
2148
|
error: Ie.message,
|
|
2144
|
-
setShowAIDialog:
|
|
2145
|
-
setTriggerAIRun:
|
|
2149
|
+
setShowAIDialog: d,
|
|
2150
|
+
setTriggerAIRun: S,
|
|
2146
2151
|
setUserInputforAI: m
|
|
2147
2152
|
}
|
|
2148
2153
|
),
|
|
2149
2154
|
/* @__PURE__ */ e.jsxs(
|
|
2150
|
-
|
|
2155
|
+
w,
|
|
2151
2156
|
{
|
|
2152
2157
|
onClick: Je,
|
|
2153
2158
|
className: "",
|
|
@@ -2163,30 +2168,30 @@ function qn() {
|
|
|
2163
2168
|
Xs,
|
|
2164
2169
|
{
|
|
2165
2170
|
pressed: t,
|
|
2166
|
-
onPressedChange: (p) =>
|
|
2171
|
+
onPressedChange: (p) => o(p),
|
|
2167
2172
|
className: "",
|
|
2168
2173
|
size: "sm",
|
|
2169
2174
|
variant: "outline",
|
|
2170
|
-
children: /* @__PURE__ */ e.jsx(
|
|
2175
|
+
children: /* @__PURE__ */ e.jsx(qn, { className: "size-4 text-foreground/70" })
|
|
2171
2176
|
}
|
|
2172
2177
|
),
|
|
2173
2178
|
/* @__PURE__ */ e.jsx(
|
|
2174
2179
|
On,
|
|
2175
2180
|
{
|
|
2176
|
-
open:
|
|
2177
|
-
setOpen:
|
|
2178
|
-
userInput:
|
|
2181
|
+
open: l,
|
|
2182
|
+
setOpen: d,
|
|
2183
|
+
userInput: f,
|
|
2179
2184
|
triggerAIRun: u,
|
|
2180
|
-
setTriggerAIRun:
|
|
2185
|
+
setTriggerAIRun: S,
|
|
2181
2186
|
setUserInput: (p) => m(p)
|
|
2182
2187
|
}
|
|
2183
2188
|
)
|
|
2184
2189
|
] }),
|
|
2185
2190
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-end gap-2", children: [
|
|
2186
2191
|
/* @__PURE__ */ e.jsxs(
|
|
2187
|
-
|
|
2192
|
+
w,
|
|
2188
2193
|
{
|
|
2189
|
-
onClick:
|
|
2194
|
+
onClick: C,
|
|
2190
2195
|
size: "sm",
|
|
2191
2196
|
variant: "outline",
|
|
2192
2197
|
children: [
|
|
@@ -2196,7 +2201,7 @@ function qn() {
|
|
|
2196
2201
|
}
|
|
2197
2202
|
),
|
|
2198
2203
|
/* @__PURE__ */ e.jsxs(
|
|
2199
|
-
|
|
2204
|
+
w,
|
|
2200
2205
|
{
|
|
2201
2206
|
onClick: Fa,
|
|
2202
2207
|
className: "w-full",
|
|
@@ -2218,27 +2223,27 @@ function qn() {
|
|
|
2218
2223
|
);
|
|
2219
2224
|
}
|
|
2220
2225
|
function Rn({ data: s }) {
|
|
2221
|
-
var
|
|
2222
|
-
const [n, a] = me.useState([]),
|
|
2226
|
+
var r;
|
|
2227
|
+
const [n, a] = me.useState([]), o = Object.keys(s[0]).map((l) => ({
|
|
2223
2228
|
// header: key,
|
|
2224
|
-
accessorKey:
|
|
2225
|
-
header: ({ column:
|
|
2226
|
-
const
|
|
2229
|
+
accessorKey: l,
|
|
2230
|
+
header: ({ column: d }) => {
|
|
2231
|
+
const f = d.getIsSorted();
|
|
2227
2232
|
return /* @__PURE__ */ e.jsx("div", { className: "flex gap-2", children: /* @__PURE__ */ e.jsxs(
|
|
2228
2233
|
"div",
|
|
2229
2234
|
{
|
|
2230
2235
|
className: "flex cursor-pointer items-center",
|
|
2231
|
-
onClick: () =>
|
|
2236
|
+
onClick: () => d.toggleSorting(d.getIsSorted() === "asc"),
|
|
2232
2237
|
children: [
|
|
2233
|
-
|
|
2234
|
-
|
|
2238
|
+
l,
|
|
2239
|
+
f === "asc" ? /* @__PURE__ */ e.jsx(rt, { className: "ml-2 h-5 w-5" }) : f === "desc" ? /* @__PURE__ */ e.jsx(lt, { className: "ml-2 h-5 w-5" }) : null
|
|
2235
2240
|
]
|
|
2236
2241
|
}
|
|
2237
2242
|
) });
|
|
2238
2243
|
}
|
|
2239
|
-
})),
|
|
2244
|
+
})), c = it({
|
|
2240
2245
|
data: s,
|
|
2241
|
-
columns:
|
|
2246
|
+
columns: o,
|
|
2242
2247
|
getCoreRowModel: mt(),
|
|
2243
2248
|
getPaginationRowModel: ut(),
|
|
2244
2249
|
onSortingChange: a,
|
|
@@ -2249,19 +2254,19 @@ function Rn({ data: s }) {
|
|
|
2249
2254
|
}
|
|
2250
2255
|
});
|
|
2251
2256
|
return /* @__PURE__ */ e.jsxs(ot, { children: [
|
|
2252
|
-
/* @__PURE__ */ e.jsx(ct, { children:
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
) },
|
|
2256
|
-
/* @__PURE__ */ e.jsx(ht, { children: (
|
|
2257
|
-
|
|
2257
|
+
/* @__PURE__ */ e.jsx(ct, { children: c.getHeaderGroups().map((l) => /* @__PURE__ */ e.jsx(rs, { children: l.headers.map((d) => /* @__PURE__ */ e.jsx(dt, { className: "sticky top-0 bg-muted", children: d.isPlaceholder ? null : Ds(
|
|
2258
|
+
d.column.columnDef.header,
|
|
2259
|
+
d.getContext()
|
|
2260
|
+
) }, d.id)) }, l.id)) }),
|
|
2261
|
+
/* @__PURE__ */ e.jsx(ht, { children: (r = c.getRowModel().rows) != null && r.length ? c.getRowModel().rows.map((l) => /* @__PURE__ */ e.jsx(
|
|
2262
|
+
rs,
|
|
2258
2263
|
{
|
|
2259
2264
|
className: "whitespace-nowrap py-2",
|
|
2260
|
-
"data-state":
|
|
2261
|
-
children:
|
|
2265
|
+
"data-state": l.getIsSelected() && "selected",
|
|
2266
|
+
children: l.getVisibleCells().map((d) => /* @__PURE__ */ e.jsx(Is, { children: Ds(d.column.columnDef.cell, d.getContext()) }, d.id))
|
|
2262
2267
|
},
|
|
2263
|
-
|
|
2264
|
-
)) : /* @__PURE__ */ e.jsx(
|
|
2268
|
+
l.id
|
|
2269
|
+
)) : /* @__PURE__ */ e.jsx(rs, { children: /* @__PURE__ */ e.jsx(Is, { colSpan: o.length, className: "h-24 text-center", children: "No results." }) }) })
|
|
2265
2270
|
] });
|
|
2266
2271
|
}
|
|
2267
2272
|
function ja({
|
|
@@ -2269,10 +2274,10 @@ function ja({
|
|
|
2269
2274
|
className: s,
|
|
2270
2275
|
...n
|
|
2271
2276
|
}) {
|
|
2272
|
-
var
|
|
2277
|
+
var r;
|
|
2273
2278
|
me.useState(0);
|
|
2274
|
-
const a = k((
|
|
2275
|
-
if (
|
|
2279
|
+
const a = k((l) => l.themeStyle), t = i((l) => l.card), o = i((l) => l.actions.setCard);
|
|
2280
|
+
if (P(() => {
|
|
2276
2281
|
}, [
|
|
2277
2282
|
t.data,
|
|
2278
2283
|
t.type,
|
|
@@ -2282,8 +2287,8 @@ function ja({
|
|
|
2282
2287
|
t.preferences
|
|
2283
2288
|
]), !t.id)
|
|
2284
2289
|
return null;
|
|
2285
|
-
let
|
|
2286
|
-
return t.data && t.data.length > 0 && (
|
|
2290
|
+
let c;
|
|
2291
|
+
return t.data && t.data.length > 0 && (c = ra({
|
|
2287
2292
|
data: t.data,
|
|
2288
2293
|
cardType: t.type,
|
|
2289
2294
|
cfg: t.cfg,
|
|
@@ -2293,24 +2298,24 @@ function ja({
|
|
|
2293
2298
|
pt,
|
|
2294
2299
|
{
|
|
2295
2300
|
role: "editor-visual-card",
|
|
2296
|
-
className:
|
|
2301
|
+
className: Y("relative flex h-full flex-col rounded-none", s),
|
|
2297
2302
|
...n,
|
|
2298
2303
|
children: [
|
|
2299
2304
|
/* @__PURE__ */ e.jsxs(ft, { className: "py-4", children: [
|
|
2300
2305
|
/* @__PURE__ */ e.jsx(
|
|
2301
|
-
|
|
2306
|
+
qs,
|
|
2302
2307
|
{
|
|
2303
2308
|
text: t.title,
|
|
2304
|
-
onSave: (
|
|
2309
|
+
onSave: (l) => o({ ...t, title: l }),
|
|
2305
2310
|
children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e.jsx(gt, { className: "text-base", children: t.title }) })
|
|
2306
2311
|
},
|
|
2307
2312
|
t.title
|
|
2308
2313
|
),
|
|
2309
2314
|
/* @__PURE__ */ e.jsx(
|
|
2310
|
-
|
|
2315
|
+
qs,
|
|
2311
2316
|
{
|
|
2312
2317
|
text: t.description || "",
|
|
2313
|
-
onSave: (
|
|
2318
|
+
onSave: (l) => o({ ...t, description: l }),
|
|
2314
2319
|
children: /* @__PURE__ */ e.jsxs(jt, { children: [
|
|
2315
2320
|
" ",
|
|
2316
2321
|
t.description
|
|
@@ -2320,13 +2325,13 @@ function ja({
|
|
|
2320
2325
|
)
|
|
2321
2326
|
] }),
|
|
2322
2327
|
/* @__PURE__ */ e.jsxs(bt, { className: "flex grow flex-col pb-3", children: [
|
|
2323
|
-
t.type !== "table" &&
|
|
2328
|
+
t.type !== "table" && c && // <ChartJsVisual key={visualKey} cfg={cfg} />
|
|
2324
2329
|
/* @__PURE__ */ e.jsx(
|
|
2325
2330
|
yt,
|
|
2326
2331
|
{
|
|
2327
|
-
cfg:
|
|
2332
|
+
cfg: c
|
|
2328
2333
|
},
|
|
2329
|
-
JSON.stringify(
|
|
2334
|
+
JSON.stringify(c) + JSON.stringify(t.preferences) + ((r = t == null ? void 0 : t.preferences) == null ? void 0 : r.customVisualCode)
|
|
2330
2335
|
),
|
|
2331
2336
|
t.type === "table" && t.data && t.data.length > 0 && // All of the below css classes are #IMPORTANT for the table to scroll properly
|
|
2332
2337
|
/* @__PURE__ */ e.jsx(vt, { className: "flex min-h-0 flex-1 grow basis-0", children: /* @__PURE__ */ e.jsx(Nt, { card: t, data: t == null ? void 0 : t.data }) })
|
|
@@ -2336,60 +2341,60 @@ function ja({
|
|
|
2336
2341
|
);
|
|
2337
2342
|
}
|
|
2338
2343
|
function _n() {
|
|
2339
|
-
const [s, n] = T(!1), [a, t] = T(""), [
|
|
2340
|
-
(
|
|
2341
|
-
), { setCardCustomCfg:
|
|
2342
|
-
function x(
|
|
2344
|
+
const [s, n] = T(!1), [a, t] = T(""), [o, c] = T(""), [r, l] = T(""), [d, f] = T(""), m = i((N) => N.card), u = i(
|
|
2345
|
+
(N) => N.card.customCfg
|
|
2346
|
+
), { setCardCustomCfg: S, setCustomVisualCode: h } = Ct();
|
|
2347
|
+
function x(N) {
|
|
2343
2348
|
var F, A;
|
|
2344
2349
|
const O = {
|
|
2345
|
-
...
|
|
2350
|
+
...N,
|
|
2346
2351
|
data: {
|
|
2347
|
-
...
|
|
2348
|
-
datasets: (A = (F =
|
|
2349
|
-
...
|
|
2352
|
+
...N == null ? void 0 : N.data,
|
|
2353
|
+
datasets: (A = (F = N == null ? void 0 : N.data) == null ? void 0 : F.datasets) == null ? void 0 : A.map((q) => ({
|
|
2354
|
+
...q,
|
|
2350
2355
|
data: []
|
|
2351
2356
|
}))
|
|
2352
2357
|
}
|
|
2353
2358
|
};
|
|
2354
2359
|
return JSON.stringify(O, null, 1);
|
|
2355
2360
|
}
|
|
2356
|
-
function
|
|
2361
|
+
function g() {
|
|
2357
2362
|
var O, j;
|
|
2358
2363
|
if (!m.data || m.data.length === 0)
|
|
2359
2364
|
return;
|
|
2360
|
-
const
|
|
2365
|
+
const N = ra({
|
|
2361
2366
|
data: m.data,
|
|
2362
2367
|
cardType: m.type,
|
|
2363
2368
|
cfg: m.cfg,
|
|
2364
2369
|
preferences: m.preferences
|
|
2365
2370
|
});
|
|
2366
|
-
|
|
2371
|
+
N && (t(JSON.stringify(N, null, 1)), (O = m == null ? void 0 : m.preferences) != null && O.customVisualCode && l((j = m == null ? void 0 : m.preferences) == null ? void 0 : j.customVisualCode), u && c(JSON.stringify(u, null, 1)));
|
|
2367
2372
|
}
|
|
2368
|
-
function
|
|
2369
|
-
if (
|
|
2373
|
+
function z() {
|
|
2374
|
+
if (r && h(r), !!o)
|
|
2370
2375
|
try {
|
|
2371
|
-
const
|
|
2372
|
-
return
|
|
2373
|
-
} catch (
|
|
2374
|
-
console.log(
|
|
2376
|
+
const N = JSON.parse(o);
|
|
2377
|
+
return N ? (S(N), f(""), c(""), N) : void 0;
|
|
2378
|
+
} catch (N) {
|
|
2379
|
+
console.log(N), f("Invalid JSON");
|
|
2375
2380
|
}
|
|
2376
2381
|
}
|
|
2377
2382
|
function b() {
|
|
2378
|
-
|
|
2383
|
+
c(""), S(null);
|
|
2379
2384
|
}
|
|
2380
2385
|
function L() {
|
|
2381
|
-
let
|
|
2386
|
+
let N;
|
|
2382
2387
|
if (u) {
|
|
2383
|
-
const O =
|
|
2384
|
-
return
|
|
2388
|
+
const O = Vs.cloneDeep(m.cfg), j = Vs.merge(O, u);
|
|
2389
|
+
return N = x(j), N;
|
|
2385
2390
|
}
|
|
2386
|
-
return a ? (
|
|
2391
|
+
return a ? (N = x(JSON.parse(a)), N) : "";
|
|
2387
2392
|
}
|
|
2388
|
-
return /* @__PURE__ */ e.jsxs(
|
|
2389
|
-
/* @__PURE__ */ e.jsx(
|
|
2390
|
-
|
|
2393
|
+
return /* @__PURE__ */ e.jsxs(xs, { open: s, onOpenChange: n, children: [
|
|
2394
|
+
/* @__PURE__ */ e.jsx(ps, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
2395
|
+
w,
|
|
2391
2396
|
{
|
|
2392
|
-
onClick:
|
|
2397
|
+
onClick: g,
|
|
2393
2398
|
className: ` ${u && "border-foreground/50 dark:border-foreground/70"}`,
|
|
2394
2399
|
size: "sm",
|
|
2395
2400
|
variant: "outline",
|
|
@@ -2397,14 +2402,14 @@ function _n() {
|
|
|
2397
2402
|
}
|
|
2398
2403
|
) }),
|
|
2399
2404
|
/* @__PURE__ */ e.jsxs(
|
|
2400
|
-
|
|
2405
|
+
fs,
|
|
2401
2406
|
{
|
|
2402
2407
|
className: "max-h-[70vh] min-h-[70vh] overflow-auto sm:min-w-[900px] lg:min-w-[1200px]",
|
|
2403
2408
|
children: [
|
|
2404
|
-
/* @__PURE__ */ e.jsxs(
|
|
2409
|
+
/* @__PURE__ */ e.jsxs(gs, { className: "", children: [
|
|
2405
2410
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2406
|
-
/* @__PURE__ */ e.jsx(
|
|
2407
|
-
/* @__PURE__ */ e.jsxs(
|
|
2411
|
+
/* @__PURE__ */ e.jsx(js, { children: "Customize Card" }),
|
|
2412
|
+
/* @__PURE__ */ e.jsxs(ys, { children: [
|
|
2408
2413
|
/* @__PURE__ */ e.jsx(Js, { children: /* @__PURE__ */ e.jsx(
|
|
2409
2414
|
sn,
|
|
2410
2415
|
{
|
|
@@ -2414,10 +2419,10 @@ function _n() {
|
|
|
2414
2419
|
className: "size-3 cursor-pointer text-muted-foreground/70 transition-colors hover:text-muted-foreground"
|
|
2415
2420
|
}
|
|
2416
2421
|
) }),
|
|
2417
|
-
/* @__PURE__ */ e.jsx(
|
|
2422
|
+
/* @__PURE__ */ e.jsx(vs, { side: "right", align: "center", children: /* @__PURE__ */ e.jsx("p", { className: "text-xs", children: "Copy Card ID" }) })
|
|
2418
2423
|
] })
|
|
2419
2424
|
] }),
|
|
2420
|
-
/* @__PURE__ */ e.jsxs(
|
|
2425
|
+
/* @__PURE__ */ e.jsxs(bs, { children: [
|
|
2421
2426
|
"See the configuration options and documentation",
|
|
2422
2427
|
/* @__PURE__ */ e.jsx(
|
|
2423
2428
|
"a",
|
|
@@ -2434,12 +2439,12 @@ function _n() {
|
|
|
2434
2439
|
/* @__PURE__ */ e.jsx(ja, { className: "w-1/2 rounded shadow-none" }),
|
|
2435
2440
|
/* @__PURE__ */ e.jsxs(kt, { defaultValue: "custom-config", className: "flex w-1/2 flex-col", children: [
|
|
2436
2441
|
/* @__PURE__ */ e.jsxs(wt, { className: "justify-start rounded-sm rounded-b-none border border-b-0", children: [
|
|
2437
|
-
/* @__PURE__ */ e.jsxs(
|
|
2442
|
+
/* @__PURE__ */ e.jsxs(ls, { value: "custom-config", children: [
|
|
2438
2443
|
u && /* @__PURE__ */ e.jsx(zt, { className: "mr-1 h-5 w-5 text-green-600" }),
|
|
2439
2444
|
u ? "Custom Config" : "Default Config"
|
|
2440
2445
|
] }),
|
|
2441
|
-
/* @__PURE__ */ e.jsx(
|
|
2442
|
-
/* @__PURE__ */ e.jsx(
|
|
2446
|
+
/* @__PURE__ */ e.jsx(ls, { className: "", value: "output", children: "Output" }),
|
|
2447
|
+
/* @__PURE__ */ e.jsx(ls, { className: "", value: "custom-code", children: "Custom Code" })
|
|
2443
2448
|
] }),
|
|
2444
2449
|
/* @__PURE__ */ e.jsx(
|
|
2445
2450
|
is,
|
|
@@ -2480,7 +2485,7 @@ function _n() {
|
|
|
2480
2485
|
},
|
|
2481
2486
|
defaultLanguage: "json",
|
|
2482
2487
|
value: L(),
|
|
2483
|
-
onChange: (
|
|
2488
|
+
onChange: (N) => c(N)
|
|
2484
2489
|
}
|
|
2485
2490
|
)
|
|
2486
2491
|
}
|
|
@@ -2508,8 +2513,8 @@ function _n() {
|
|
|
2508
2513
|
renderLineHighlight: "none"
|
|
2509
2514
|
},
|
|
2510
2515
|
defaultLanguage: "javascript",
|
|
2511
|
-
value:
|
|
2512
|
-
onChange: (
|
|
2516
|
+
value: r,
|
|
2517
|
+
onChange: (N) => l(N || "")
|
|
2513
2518
|
}
|
|
2514
2519
|
)
|
|
2515
2520
|
}
|
|
@@ -2517,9 +2522,9 @@ function _n() {
|
|
|
2517
2522
|
] })
|
|
2518
2523
|
] }),
|
|
2519
2524
|
/* @__PURE__ */ e.jsxs(Us, { className: "flex items-center", children: [
|
|
2520
|
-
/* @__PURE__ */ e.jsx(B, { className: "mr-2 text-red-500", children:
|
|
2525
|
+
/* @__PURE__ */ e.jsx(B, { className: "mr-2 text-red-500", children: d }),
|
|
2521
2526
|
/* @__PURE__ */ e.jsx(
|
|
2522
|
-
|
|
2527
|
+
w,
|
|
2523
2528
|
{
|
|
2524
2529
|
disabled: !u,
|
|
2525
2530
|
onClick: b,
|
|
@@ -2527,8 +2532,8 @@ function _n() {
|
|
|
2527
2532
|
children: "Reset"
|
|
2528
2533
|
}
|
|
2529
2534
|
),
|
|
2530
|
-
/* @__PURE__ */ e.jsx(
|
|
2531
|
-
/* @__PURE__ */ e.jsx(
|
|
2535
|
+
/* @__PURE__ */ e.jsx(w, { onClick: z, variant: "outline", children: "Apply" }),
|
|
2536
|
+
/* @__PURE__ */ e.jsx(w, { onClick: () => n(!1), variant: "outline", children: "Close" })
|
|
2532
2537
|
] })
|
|
2533
2538
|
]
|
|
2534
2539
|
}
|
|
@@ -2557,36 +2562,34 @@ function ka(s) {
|
|
|
2557
2562
|
return fe({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M217 25v14h78V25h-78zm0 32v46h14V71h50v32h14V57h-78zm32 32v14h14V89h-14zm-64 32v46h30v-46h-30zm48 0v14h46v-14h-46zm64 0v46h30v-46h-30zm-64 32v14h46v-14h-46zm-80 32v46h62v-46h-62zm80 0v14h46v-14h-46zm64 0v46h62v-46h-62zm-64 32v14h46v-14h-46zm-112 32v46h94v-46h-94zm112 0v14h46v-14h-46zm64 0v46h94v-46h-94zm-64 32v14h46v-14h-46zM89 313v46h126v-46H89zm144 0v14h46v-14h-46zm64 0v46h126v-46H297zm-64 32v14h46v-14h-46zM57 377v46h158v-46H57zm176 0v14h46v-14h-46zm64 0v46h158v-46H297zm-64 32v14h46v-14h-46zM25 441v46h190v-46H25zm208 0v14h46v-14h-46zm64 0v46h190v-46H297zm-64 32v14h46v-14h-46z" }, child: [] }] })(s);
|
|
2558
2563
|
}
|
|
2559
2564
|
function Hn() {
|
|
2560
|
-
const [s, n] = T(!1), a =
|
|
2561
|
-
(
|
|
2562
|
-
), o = r(
|
|
2563
|
-
(c) => c.actions.setCardCustomCfg
|
|
2565
|
+
const [s, n] = T(!1), a = i((d) => d.card.type), { setCardType: t, setCardPreferences: o, setChartOrientation: c } = i((d) => d.actions), r = i(
|
|
2566
|
+
(d) => d.actions.setCardCustomCfg
|
|
2564
2567
|
);
|
|
2565
|
-
function l(
|
|
2566
|
-
|
|
2568
|
+
function l(d) {
|
|
2569
|
+
r(null), o({}), t(d), n(!1);
|
|
2567
2570
|
}
|
|
2568
|
-
return /* @__PURE__ */ e.jsxs(
|
|
2569
|
-
/* @__PURE__ */ e.jsx(Ue, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
2571
|
+
return /* @__PURE__ */ e.jsxs(Ke, { open: s, onOpenChange: n, children: [
|
|
2572
|
+
/* @__PURE__ */ e.jsx(Ue, { asChild: !0, children: /* @__PURE__ */ e.jsx(w, { size: "sm", variant: "outline", children: /* @__PURE__ */ e.jsx(Bn, { className: "h-4 w-4", chartType: a }) }) }),
|
|
2570
2573
|
/* @__PURE__ */ e.jsx(Ge, { className: "w-50", children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 place-items-center", children: [
|
|
2571
2574
|
/* @__PURE__ */ e.jsx(
|
|
2572
|
-
|
|
2575
|
+
w,
|
|
2573
2576
|
{
|
|
2574
2577
|
onClick: () => l("bar"),
|
|
2575
2578
|
className: "font-normal",
|
|
2576
2579
|
variant: "ghost",
|
|
2577
|
-
children: /* @__PURE__ */ e.jsx(
|
|
2580
|
+
children: /* @__PURE__ */ e.jsx(ws, { className: "size-5" })
|
|
2578
2581
|
}
|
|
2579
2582
|
),
|
|
2580
2583
|
/* @__PURE__ */ e.jsx(
|
|
2581
|
-
|
|
2584
|
+
w,
|
|
2582
2585
|
{
|
|
2583
2586
|
onClick: () => l("line"),
|
|
2584
2587
|
variant: "ghost",
|
|
2585
|
-
children: /* @__PURE__ */ e.jsx(
|
|
2588
|
+
children: /* @__PURE__ */ e.jsx(zs, { className: "size-5" })
|
|
2586
2589
|
}
|
|
2587
2590
|
),
|
|
2588
2591
|
/* @__PURE__ */ e.jsx(
|
|
2589
|
-
|
|
2592
|
+
w,
|
|
2590
2593
|
{
|
|
2591
2594
|
onClick: () => l("stackedBar"),
|
|
2592
2595
|
variant: "ghost",
|
|
@@ -2594,7 +2597,7 @@ function Hn() {
|
|
|
2594
2597
|
}
|
|
2595
2598
|
),
|
|
2596
2599
|
/* @__PURE__ */ e.jsx(
|
|
2597
|
-
|
|
2600
|
+
w,
|
|
2598
2601
|
{
|
|
2599
2602
|
onClick: () => l("scatter"),
|
|
2600
2603
|
variant: "ghost",
|
|
@@ -2602,7 +2605,7 @@ function Hn() {
|
|
|
2602
2605
|
}
|
|
2603
2606
|
),
|
|
2604
2607
|
/* @__PURE__ */ e.jsx(
|
|
2605
|
-
|
|
2608
|
+
w,
|
|
2606
2609
|
{
|
|
2607
2610
|
onClick: () => l("bubble"),
|
|
2608
2611
|
variant: "ghost",
|
|
@@ -2610,7 +2613,7 @@ function Hn() {
|
|
|
2610
2613
|
}
|
|
2611
2614
|
),
|
|
2612
2615
|
/* @__PURE__ */ e.jsx(
|
|
2613
|
-
|
|
2616
|
+
w,
|
|
2614
2617
|
{
|
|
2615
2618
|
onClick: () => l("pie"),
|
|
2616
2619
|
variant: "ghost",
|
|
@@ -2618,7 +2621,7 @@ function Hn() {
|
|
|
2618
2621
|
}
|
|
2619
2622
|
),
|
|
2620
2623
|
/* @__PURE__ */ e.jsx(
|
|
2621
|
-
|
|
2624
|
+
w,
|
|
2622
2625
|
{
|
|
2623
2626
|
onClick: () => l("doughnut"),
|
|
2624
2627
|
variant: "ghost",
|
|
@@ -2626,7 +2629,7 @@ function Hn() {
|
|
|
2626
2629
|
}
|
|
2627
2630
|
),
|
|
2628
2631
|
/* @__PURE__ */ e.jsx(
|
|
2629
|
-
|
|
2632
|
+
w,
|
|
2630
2633
|
{
|
|
2631
2634
|
onClick: () => l("radar"),
|
|
2632
2635
|
variant: "ghost",
|
|
@@ -2640,7 +2643,7 @@ function Hn() {
|
|
|
2640
2643
|
}
|
|
2641
2644
|
),
|
|
2642
2645
|
/* @__PURE__ */ e.jsx(
|
|
2643
|
-
|
|
2646
|
+
w,
|
|
2644
2647
|
{
|
|
2645
2648
|
onClick: () => l("polarArea"),
|
|
2646
2649
|
variant: "ghost",
|
|
@@ -2648,7 +2651,7 @@ function Hn() {
|
|
|
2648
2651
|
}
|
|
2649
2652
|
),
|
|
2650
2653
|
/* @__PURE__ */ e.jsx(
|
|
2651
|
-
|
|
2654
|
+
w,
|
|
2652
2655
|
{
|
|
2653
2656
|
onClick: () => l("pyramid"),
|
|
2654
2657
|
variant: "ghost",
|
|
@@ -2656,7 +2659,7 @@ function Hn() {
|
|
|
2656
2659
|
}
|
|
2657
2660
|
),
|
|
2658
2661
|
/* @__PURE__ */ e.jsx(
|
|
2659
|
-
|
|
2662
|
+
w,
|
|
2660
2663
|
{
|
|
2661
2664
|
onClick: () => l("range"),
|
|
2662
2665
|
variant: "ghost",
|
|
@@ -2664,15 +2667,15 @@ function Hn() {
|
|
|
2664
2667
|
}
|
|
2665
2668
|
),
|
|
2666
2669
|
/* @__PURE__ */ e.jsx(
|
|
2667
|
-
|
|
2670
|
+
w,
|
|
2668
2671
|
{
|
|
2669
2672
|
onClick: () => l("table"),
|
|
2670
2673
|
variant: "ghost",
|
|
2671
|
-
children: /* @__PURE__ */ e.jsx(
|
|
2674
|
+
children: /* @__PURE__ */ e.jsx(Ns, { className: "size-5" })
|
|
2672
2675
|
}
|
|
2673
2676
|
),
|
|
2674
2677
|
/* @__PURE__ */ e.jsx(
|
|
2675
|
-
|
|
2678
|
+
w,
|
|
2676
2679
|
{
|
|
2677
2680
|
onClick: () => l("kpi"),
|
|
2678
2681
|
variant: "ghost",
|
|
@@ -2685,9 +2688,9 @@ function Hn() {
|
|
|
2685
2688
|
function Bn({ chartType: s, className: n }) {
|
|
2686
2689
|
switch (s) {
|
|
2687
2690
|
case "bar":
|
|
2688
|
-
return /* @__PURE__ */ e.jsx(ks, { className: n });
|
|
2689
|
-
case "line":
|
|
2690
2691
|
return /* @__PURE__ */ e.jsx(ws, { className: n });
|
|
2692
|
+
case "line":
|
|
2693
|
+
return /* @__PURE__ */ e.jsx(zs, { className: n });
|
|
2691
2694
|
case "pie":
|
|
2692
2695
|
return /* @__PURE__ */ e.jsx(ha, { className: n });
|
|
2693
2696
|
case "radar":
|
|
@@ -2709,17 +2712,17 @@ function Bn({ chartType: s, className: n }) {
|
|
|
2709
2712
|
case "kpi":
|
|
2710
2713
|
return /* @__PURE__ */ e.jsx(Sa, { className: n });
|
|
2711
2714
|
default:
|
|
2712
|
-
return /* @__PURE__ */ e.jsx(
|
|
2715
|
+
return /* @__PURE__ */ e.jsx(Ns, { className: n });
|
|
2713
2716
|
}
|
|
2714
2717
|
}
|
|
2715
2718
|
function $n() {
|
|
2716
|
-
const s =
|
|
2719
|
+
const s = i(
|
|
2717
2720
|
(a) => a.card.refreshInterval
|
|
2718
|
-
), n =
|
|
2721
|
+
), n = i(
|
|
2719
2722
|
(a) => a.actions.setCardRefreshInterval
|
|
2720
2723
|
);
|
|
2721
|
-
return /* @__PURE__ */ e.jsxs(
|
|
2722
|
-
/* @__PURE__ */ e.jsx(Ue, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
2724
|
+
return /* @__PURE__ */ e.jsxs(Ke, { children: [
|
|
2725
|
+
/* @__PURE__ */ e.jsx(Ue, { asChild: !0, children: /* @__PURE__ */ e.jsx(w, { size: "sm", variant: "outline", children: /* @__PURE__ */ e.jsx(Gt, { className: "w-4 h-4" }) }) }),
|
|
2723
2726
|
/* @__PURE__ */ e.jsx(Ge, { className: "w-[200px]", children: /* @__PURE__ */ e.jsx("div", { className: "grid gap-4", children: /* @__PURE__ */ e.jsx("div", { className: "grid gap-2", children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-5 items-center gap-1", children: [
|
|
2724
2727
|
/* @__PURE__ */ e.jsx(B, { className: "col-span-3", htmlFor: "width", children: "Refresh Every" }),
|
|
2725
2728
|
/* @__PURE__ */ e.jsx(
|
|
@@ -2736,9 +2739,9 @@ function $n() {
|
|
|
2736
2739
|
] });
|
|
2737
2740
|
}
|
|
2738
2741
|
function $s() {
|
|
2739
|
-
|
|
2740
|
-
const s =
|
|
2741
|
-
return
|
|
2742
|
+
i((r) => r.frame);
|
|
2743
|
+
const s = i((r) => r.card), n = i((r) => r.card.data), a = i((r) => r.isShowingVisual), t = i((r) => r.isSqlRunning), o = i((r) => r.queryError), c = i((r) => r.pythonStdOut);
|
|
2744
|
+
return i((r) => r.onSave), i((r) => r.onClose), i((r) => r.actions.setCardSql), i((r) => r.actions.setCardType), i((r) => r.actions.setSqlGen), s ? /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full flex-col pt-3", children: [
|
|
2742
2745
|
t && /* @__PURE__ */ e.jsx(Be, { className: "absolute bottom-0 left-0 right-0 top-0 z-10 m-auto h-10 w-10 animate-spin text-foreground/10" }),
|
|
2743
2746
|
/* @__PURE__ */ e.jsxs("div", { className: "mb-0 flex min-h-10 items-center justify-end gap-2 px-6", children: [
|
|
2744
2747
|
a && /* @__PURE__ */ e.jsxs("div", { className: "flex grow items-center gap-2", children: [
|
|
@@ -2746,17 +2749,17 @@ function $s() {
|
|
|
2746
2749
|
s.type !== "table" && /* @__PURE__ */ e.jsx(_n, {}),
|
|
2747
2750
|
/* @__PURE__ */ e.jsx($n, {})
|
|
2748
2751
|
] }),
|
|
2749
|
-
/* @__PURE__ */ e.jsx(
|
|
2752
|
+
/* @__PURE__ */ e.jsx(Kn, {})
|
|
2750
2753
|
] }),
|
|
2751
2754
|
a ? s.type === "kpi" ? /* @__PURE__ */ e.jsx("div", { className: "flex grow items-center justify-center", children: /* @__PURE__ */ e.jsx("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e.jsx(Ft, { isLoading: t, card: s }) }) }) : /* @__PURE__ */ e.jsx(ja, { className: "grow border-none shadow-none" }) : /* @__PURE__ */ e.jsxs("div", { className: "flex min-h-0 w-full flex-1 grow basis-0 px-6", children: [
|
|
2752
|
-
|
|
2755
|
+
c && /* @__PURE__ */ e.jsx(Pn, {}),
|
|
2753
2756
|
s.data && s.data.length > 0 && /* @__PURE__ */ e.jsx(Rn, { data: n || [] }),
|
|
2754
|
-
|
|
2757
|
+
o && /* @__PURE__ */ e.jsx("span", { className: "font-mono text-sm", children: o })
|
|
2755
2758
|
] })
|
|
2756
2759
|
] }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: "No Active Card" });
|
|
2757
2760
|
}
|
|
2758
|
-
function
|
|
2759
|
-
const s =
|
|
2761
|
+
function Pn() {
|
|
2762
|
+
const s = i((a) => a.pythonStdOut);
|
|
2760
2763
|
if (!s)
|
|
2761
2764
|
return null;
|
|
2762
2765
|
const n = s.replace(/\n/g, "<br>");
|
|
@@ -2769,11 +2772,11 @@ function Kn() {
|
|
|
2769
2772
|
className: "bg-muted p-2 font-mono text-sm"
|
|
2770
2773
|
}
|
|
2771
2774
|
),
|
|
2772
|
-
/* @__PURE__ */ e.jsx(
|
|
2775
|
+
/* @__PURE__ */ e.jsx(Ss, { className: "mb-2" })
|
|
2773
2776
|
] });
|
|
2774
2777
|
}
|
|
2775
|
-
function
|
|
2776
|
-
const s =
|
|
2778
|
+
function Kn() {
|
|
2779
|
+
const s = i((a) => a.isShowingVisual), n = i(
|
|
2777
2780
|
(a) => a.actions.setIsShowingVisual
|
|
2778
2781
|
);
|
|
2779
2782
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
@@ -2791,23 +2794,23 @@ function Pn() {
|
|
|
2791
2794
|
}
|
|
2792
2795
|
function De() {
|
|
2793
2796
|
const [s, n] = T([]);
|
|
2794
|
-
|
|
2797
|
+
i(
|
|
2795
2798
|
(m) => m.card.cfg
|
|
2796
2799
|
);
|
|
2797
|
-
const a =
|
|
2800
|
+
const a = i((m) => m.card.preferences), { setCardCfg: t, setFilterOnClickColumnIndex: o, setCardPreferences: c } = i((m) => m.actions), r = i(
|
|
2798
2801
|
(m) => m.queryResultColumns
|
|
2799
2802
|
);
|
|
2800
|
-
|
|
2803
|
+
i(
|
|
2801
2804
|
(m) => {
|
|
2802
2805
|
var u;
|
|
2803
2806
|
return (u = m.card.preferences) == null ? void 0 : u.filterOnClickColumnIndex;
|
|
2804
2807
|
}
|
|
2805
|
-
),
|
|
2806
|
-
|
|
2807
|
-
}, [
|
|
2808
|
-
function
|
|
2809
|
-
var
|
|
2810
|
-
u ? a != null && a.onClickFilter && ((
|
|
2808
|
+
), P(() => {
|
|
2809
|
+
r && n(new Array(r.length).fill(!1));
|
|
2810
|
+
}, [r]);
|
|
2811
|
+
function l(m, u) {
|
|
2812
|
+
var S, h;
|
|
2813
|
+
u ? a != null && a.onClickFilter && ((S = a == null ? void 0 : a.onClickFilter) == null ? void 0 : S.length) > 0 ? c({
|
|
2811
2814
|
...a,
|
|
2812
2815
|
onClickFilter: [
|
|
2813
2816
|
...a.onClickFilter,
|
|
@@ -2816,7 +2819,7 @@ function De() {
|
|
|
2816
2819
|
expression: ""
|
|
2817
2820
|
}
|
|
2818
2821
|
]
|
|
2819
|
-
}) :
|
|
2822
|
+
}) : c({
|
|
2820
2823
|
...a,
|
|
2821
2824
|
onClickFilter: [
|
|
2822
2825
|
{
|
|
@@ -2824,43 +2827,43 @@ function De() {
|
|
|
2824
2827
|
expression: ""
|
|
2825
2828
|
}
|
|
2826
2829
|
]
|
|
2827
|
-
}) : (
|
|
2830
|
+
}) : (c({
|
|
2828
2831
|
...a,
|
|
2829
|
-
onClickFilter: (
|
|
2832
|
+
onClickFilter: (h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.filter(
|
|
2830
2833
|
(x) => x.columnIndex !== m
|
|
2831
2834
|
)
|
|
2832
2835
|
}), n((x) => {
|
|
2833
|
-
const
|
|
2834
|
-
return
|
|
2836
|
+
const g = [...x];
|
|
2837
|
+
return g[m] = !1, g;
|
|
2835
2838
|
}));
|
|
2836
2839
|
}
|
|
2837
|
-
function
|
|
2838
|
-
var
|
|
2839
|
-
const
|
|
2840
|
+
function d(m, u) {
|
|
2841
|
+
var h;
|
|
2842
|
+
const S = (h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.map((x) => x.columnIndex === m ? {
|
|
2840
2843
|
...x,
|
|
2841
2844
|
expression: u.target.value
|
|
2842
2845
|
} : x);
|
|
2843
|
-
|
|
2846
|
+
c({
|
|
2844
2847
|
...a,
|
|
2845
|
-
onClickFilter:
|
|
2848
|
+
onClickFilter: S
|
|
2846
2849
|
});
|
|
2847
2850
|
}
|
|
2848
|
-
function
|
|
2849
|
-
var u,
|
|
2850
|
-
if (s != null && s[m] || (
|
|
2851
|
+
function f(m) {
|
|
2852
|
+
var u, S, h, x;
|
|
2853
|
+
if (s != null && s[m] || (S = (u = a == null ? void 0 : a.onClickFilter) == null ? void 0 : u.find((g) => g.columnIndex === m)) != null && S.expression)
|
|
2851
2854
|
return /* @__PURE__ */ e.jsx(
|
|
2852
2855
|
ae,
|
|
2853
2856
|
{
|
|
2854
|
-
value: (x = (
|
|
2855
|
-
onChange: (
|
|
2857
|
+
value: (x = (h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.find((g) => g.columnIndex === m)) == null ? void 0 : x.expression,
|
|
2858
|
+
onChange: (g) => d(m, g),
|
|
2856
2859
|
type: "text",
|
|
2857
2860
|
className: " h-9 w-full focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0 font-mono text-xs",
|
|
2858
2861
|
placeholder: "Expression"
|
|
2859
2862
|
}
|
|
2860
2863
|
);
|
|
2861
2864
|
}
|
|
2862
|
-
return /* @__PURE__ */ e.jsx(e.Fragment, { children:
|
|
2863
|
-
var
|
|
2865
|
+
return /* @__PURE__ */ e.jsx(e.Fragment, { children: r == null ? void 0 : r.map((m, u) => {
|
|
2866
|
+
var S, h;
|
|
2864
2867
|
return /* @__PURE__ */ e.jsx(
|
|
2865
2868
|
"div",
|
|
2866
2869
|
{
|
|
@@ -2868,12 +2871,12 @@ function De() {
|
|
|
2868
2871
|
children: /* @__PURE__ */ e.jsxs("div", { className: " grow", children: [
|
|
2869
2872
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center py-2 space-x-2", children: [
|
|
2870
2873
|
/* @__PURE__ */ e.jsx(
|
|
2871
|
-
|
|
2874
|
+
Pe,
|
|
2872
2875
|
{
|
|
2873
|
-
checked: !!((
|
|
2876
|
+
checked: !!((S = a == null ? void 0 : a.onClickFilter) != null && S.find(
|
|
2874
2877
|
(x) => x.columnIndex === u
|
|
2875
2878
|
)),
|
|
2876
|
-
onCheckedChange: (x) =>
|
|
2879
|
+
onCheckedChange: (x) => l(u, x)
|
|
2877
2880
|
}
|
|
2878
2881
|
),
|
|
2879
2882
|
/* @__PURE__ */ e.jsx(
|
|
@@ -2883,61 +2886,42 @@ function De() {
|
|
|
2883
2886
|
children: m
|
|
2884
2887
|
}
|
|
2885
2888
|
),
|
|
2886
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex gap-2 items-center ", children: ((
|
|
2889
|
+
/* @__PURE__ */ e.jsx("div", { className: "flex gap-2 items-center ", children: ((h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.find(
|
|
2887
2890
|
(x) => x.columnIndex === u
|
|
2888
2891
|
)) && /* @__PURE__ */ e.jsx(
|
|
2889
2892
|
da,
|
|
2890
2893
|
{
|
|
2891
2894
|
onClick: () => {
|
|
2892
2895
|
n((x) => {
|
|
2893
|
-
const
|
|
2894
|
-
return
|
|
2896
|
+
const g = [...x];
|
|
2897
|
+
return g[u] = !x[u], g;
|
|
2895
2898
|
});
|
|
2896
2899
|
},
|
|
2897
2900
|
className: " invisible group-hover:visible size-3 text-gray-400 cursor-pointer"
|
|
2898
2901
|
}
|
|
2899
2902
|
) })
|
|
2900
2903
|
] }),
|
|
2901
|
-
|
|
2904
|
+
f(u)
|
|
2902
2905
|
] })
|
|
2903
2906
|
},
|
|
2904
2907
|
m
|
|
2905
2908
|
);
|
|
2906
2909
|
}) });
|
|
2907
2910
|
}
|
|
2908
|
-
function
|
|
2909
|
-
var
|
|
2910
|
-
const s =
|
|
2911
|
-
(
|
|
2912
|
-
), { setCardCfg: a, setCardPreferences: t } =
|
|
2913
|
-
|
|
2914
|
-
)
|
|
2915
|
-
|
|
2916
|
-
function i(h) {
|
|
2917
|
-
var u, N, d, x, f, w;
|
|
2918
|
-
let g = {};
|
|
2919
|
-
(u = s == null ? void 0 : s.chartOptions) != null && u.scales && (g = {
|
|
2920
|
-
x: (d = (N = s == null ? void 0 : s.chartOptions) == null ? void 0 : N.scales) == null ? void 0 : d.y,
|
|
2921
|
-
y: (f = (x = s == null ? void 0 : s.chartOptions) == null ? void 0 : x.scales) == null ? void 0 : f.x
|
|
2922
|
-
});
|
|
2923
|
-
const m = {
|
|
2924
|
-
...s,
|
|
2925
|
-
chartOptions: {
|
|
2926
|
-
...s == null ? void 0 : s.chartOptions,
|
|
2927
|
-
scales: {
|
|
2928
|
-
...(w = s == null ? void 0 : s.chartOptions) == null ? void 0 : w.scales,
|
|
2929
|
-
...g
|
|
2930
|
-
},
|
|
2931
|
-
indexAxis: h
|
|
2932
|
-
}
|
|
2933
|
-
};
|
|
2934
|
-
t(m);
|
|
2911
|
+
function Fs() {
|
|
2912
|
+
var r, l, d;
|
|
2913
|
+
const s = i((f) => f.card.preferences), n = i(
|
|
2914
|
+
(f) => f.card.cfg
|
|
2915
|
+
), { setCardCfg: a, setCardPreferences: t, setChartOrientation: o } = i((f) => f.actions);
|
|
2916
|
+
(r = n == null ? void 0 : n.options) != null && r.indexAxis;
|
|
2917
|
+
function c(f) {
|
|
2918
|
+
o(f);
|
|
2935
2919
|
}
|
|
2936
2920
|
return /* @__PURE__ */ e.jsxs(
|
|
2937
|
-
|
|
2921
|
+
la,
|
|
2938
2922
|
{
|
|
2939
|
-
value: ((l = s == null ? void 0 : s.chartOptions) == null ? void 0 : l.indexAxis) || ((
|
|
2940
|
-
onValueChange:
|
|
2923
|
+
value: ((l = s == null ? void 0 : s.chartOptions) == null ? void 0 : l.indexAxis) || ((d = n == null ? void 0 : n.options) == null ? void 0 : d.indexAxis) || "x",
|
|
2924
|
+
onValueChange: c,
|
|
2941
2925
|
className: "flex gap-3",
|
|
2942
2926
|
defaultValue: "x",
|
|
2943
2927
|
children: [
|
|
@@ -2954,43 +2938,43 @@ function zs() {
|
|
|
2954
2938
|
);
|
|
2955
2939
|
}
|
|
2956
2940
|
const we = "focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0";
|
|
2957
|
-
function
|
|
2958
|
-
var t,
|
|
2941
|
+
function Ps(s, n) {
|
|
2942
|
+
var t, o, c;
|
|
2959
2943
|
const a = ia(s, n);
|
|
2960
|
-
return ((
|
|
2944
|
+
return ((c = (o = (t = s == null ? void 0 : s.chartOptions) == null ? void 0 : t.scales) == null ? void 0 : o[a]) == null ? void 0 : c.type) || "linear";
|
|
2961
2945
|
}
|
|
2962
2946
|
function wa() {
|
|
2963
|
-
var
|
|
2964
|
-
const [s, n] = T(!1), a =
|
|
2947
|
+
var Q, ee, Z, J, I, y;
|
|
2948
|
+
const [s, n] = T(!1), a = i((v) => {
|
|
2965
2949
|
var M;
|
|
2966
2950
|
return (M = v.card) == null ? void 0 : M.preferences;
|
|
2967
|
-
}), t =
|
|
2951
|
+
}), t = i((v) => {
|
|
2968
2952
|
var M;
|
|
2969
2953
|
return (M = v.card) == null ? void 0 : M.cfg;
|
|
2970
|
-
}),
|
|
2971
|
-
|
|
2972
|
-
), [
|
|
2973
|
-
((Z = (ee = (
|
|
2974
|
-
), [
|
|
2975
|
-
((y = (I = (
|
|
2976
|
-
), [u,
|
|
2954
|
+
}), o = ia(a, t), [c, r] = T(
|
|
2955
|
+
Ps(a)
|
|
2956
|
+
), [l, d] = T(
|
|
2957
|
+
((Z = (ee = (Q = a == null ? void 0 : a.chartOptions) == null ? void 0 : Q.scales) == null ? void 0 : ee[o]) == null ? void 0 : Z.min) || ""
|
|
2958
|
+
), [f, m] = T(
|
|
2959
|
+
((y = (I = (J = a == null ? void 0 : a.chartOptions) == null ? void 0 : J.scales) == null ? void 0 : I[o]) == null ? void 0 : y.max) || ""
|
|
2960
|
+
), [u, S] = T(l || f ? "custom" : "auto"), [h, x] = T(""), [g, z] = T(0), [b, L] = T(""), [N, O] = T(""), [j, F] = T(""), A = i(
|
|
2977
2961
|
(v) => v.actions.setCardPreferences
|
|
2978
|
-
),
|
|
2962
|
+
), q = i((v) => {
|
|
2979
2963
|
var M;
|
|
2980
2964
|
return (M = v.card) == null ? void 0 : M.type;
|
|
2981
|
-
}),
|
|
2982
|
-
|
|
2983
|
-
var v, M, H, ue, se, ge, je, be, xe,
|
|
2984
|
-
|
|
2985
|
-
((H = (M = (v = a == null ? void 0 : a.chartOptions) == null ? void 0 : v.scales) == null ? void 0 : M[
|
|
2986
|
-
), m(((ge = (se = (ue = a == null ? void 0 : a.chartOptions) == null ? void 0 : ue.scales) == null ? void 0 : se[
|
|
2987
|
-
((
|
|
2988
|
-
),
|
|
2989
|
-
}, [s, a,
|
|
2965
|
+
}), K = ["pie", "doughnut", "polarArea"].includes(q);
|
|
2966
|
+
P(() => {
|
|
2967
|
+
var v, M, H, ue, se, ge, je, be, xe, U, ne, re, ye, le;
|
|
2968
|
+
r(Ps(a)), d(
|
|
2969
|
+
((H = (M = (v = a == null ? void 0 : a.chartOptions) == null ? void 0 : v.scales) == null ? void 0 : M[o]) == null ? void 0 : H.min) === 0 ? 0 : ""
|
|
2970
|
+
), m(((ge = (se = (ue = a == null ? void 0 : a.chartOptions) == null ? void 0 : ue.scales) == null ? void 0 : se[o]) == null ? void 0 : ge.max) || ""), x(
|
|
2971
|
+
((U = (xe = (be = (je = a == null ? void 0 : a.chartOptions) == null ? void 0 : je.scales) == null ? void 0 : be[o]) == null ? void 0 : xe.ticks) == null ? void 0 : U.stepSize) || ""
|
|
2972
|
+
), z(((ne = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ne.decimalPlaces) || 0), L(((re = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : re.suffix) || ""), O(((ye = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ye.currency) || ""), F(((le = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : le.locale) || "");
|
|
2973
|
+
}, [s, a, o]);
|
|
2990
2974
|
function $(v, M) {
|
|
2991
2975
|
return M === "" || /^[0-9\b]+$/.test(M) ? Number(M) : Number(v);
|
|
2992
2976
|
}
|
|
2993
|
-
function
|
|
2977
|
+
function G() {
|
|
2994
2978
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
2995
2979
|
/* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-6 items-center gap-2", children: [
|
|
2996
2980
|
/* @__PURE__ */ e.jsx(
|
|
@@ -3011,7 +2995,7 @@ function wa() {
|
|
|
3011
2995
|
/* @__PURE__ */ e.jsx(
|
|
3012
2996
|
ae,
|
|
3013
2997
|
{
|
|
3014
|
-
value:
|
|
2998
|
+
value: N,
|
|
3015
2999
|
placeholder: "USD",
|
|
3016
3000
|
onChange: (v) => O(v.target.value),
|
|
3017
3001
|
id: "currency",
|
|
@@ -3034,8 +3018,8 @@ function wa() {
|
|
|
3034
3018
|
/* @__PURE__ */ e.jsx(
|
|
3035
3019
|
ae,
|
|
3036
3020
|
{
|
|
3037
|
-
value:
|
|
3038
|
-
onChange: (v) =>
|
|
3021
|
+
value: g,
|
|
3022
|
+
onChange: (v) => z(Number(v.target.value)),
|
|
3039
3023
|
id: "format",
|
|
3040
3024
|
className: `col-span-6 h-8 w-full tracking-wide ${we}`
|
|
3041
3025
|
}
|
|
@@ -3051,15 +3035,15 @@ function wa() {
|
|
|
3051
3035
|
ae,
|
|
3052
3036
|
{
|
|
3053
3037
|
id: "min",
|
|
3054
|
-
value:
|
|
3055
|
-
onChange: (v) =>
|
|
3038
|
+
value: l,
|
|
3039
|
+
onChange: (v) => d((M) => $(M, v.target.value)),
|
|
3056
3040
|
className: `col-span-1 h-8 w-full ${we}`
|
|
3057
3041
|
}
|
|
3058
3042
|
),
|
|
3059
3043
|
/* @__PURE__ */ e.jsx(
|
|
3060
3044
|
ae,
|
|
3061
3045
|
{
|
|
3062
|
-
value:
|
|
3046
|
+
value: f,
|
|
3063
3047
|
onChange: (v) => m((M) => $(M, v.target.value)),
|
|
3064
3048
|
id: "max",
|
|
3065
3049
|
className: `col-span-1 h-8 w-full ${we}`
|
|
@@ -3071,7 +3055,7 @@ function wa() {
|
|
|
3071
3055
|
/* @__PURE__ */ e.jsx(
|
|
3072
3056
|
ae,
|
|
3073
3057
|
{
|
|
3074
|
-
value:
|
|
3058
|
+
value: h,
|
|
3075
3059
|
onChange: (v) => x((M) => $(M, v.target.value)),
|
|
3076
3060
|
id: "step-size",
|
|
3077
3061
|
className: `col-span-1 h-8 w-full ${we}`
|
|
@@ -3084,10 +3068,10 @@ function wa() {
|
|
|
3084
3068
|
var H;
|
|
3085
3069
|
let v = {};
|
|
3086
3070
|
u === "custom" && (v = {
|
|
3087
|
-
min:
|
|
3088
|
-
max:
|
|
3071
|
+
min: l,
|
|
3072
|
+
max: f,
|
|
3089
3073
|
ticks: {
|
|
3090
|
-
stepSize:
|
|
3074
|
+
stepSize: h
|
|
3091
3075
|
}
|
|
3092
3076
|
});
|
|
3093
3077
|
const M = {
|
|
@@ -3096,23 +3080,23 @@ function wa() {
|
|
|
3096
3080
|
...a == null ? void 0 : a.chartOptions,
|
|
3097
3081
|
scales: {
|
|
3098
3082
|
...(H = a == null ? void 0 : a.chartOptions) == null ? void 0 : H.scales,
|
|
3099
|
-
[
|
|
3083
|
+
[o]: {
|
|
3100
3084
|
// ...cardPreferences?.chartOptions?.scales?.[axis],
|
|
3101
|
-
type:
|
|
3102
|
-
...
|
|
3085
|
+
type: c,
|
|
3086
|
+
...c === "linear" ? v : {}
|
|
3103
3087
|
}
|
|
3104
3088
|
}
|
|
3105
3089
|
},
|
|
3106
3090
|
numberAxisFormat: {
|
|
3107
|
-
decimalPlaces:
|
|
3091
|
+
decimalPlaces: g,
|
|
3108
3092
|
suffix: b,
|
|
3109
|
-
currency:
|
|
3093
|
+
currency: N,
|
|
3110
3094
|
locale: j
|
|
3111
3095
|
}
|
|
3112
3096
|
};
|
|
3113
|
-
A(M);
|
|
3097
|
+
console.log(M), A(M);
|
|
3114
3098
|
}
|
|
3115
|
-
return /* @__PURE__ */ e.jsxs(
|
|
3099
|
+
return /* @__PURE__ */ e.jsxs(Ke, { onOpenChange: (v) => n(v), children: [
|
|
3116
3100
|
/* @__PURE__ */ e.jsx(Ue, { asChild: !0, children: /* @__PURE__ */ e.jsx(Mt, { className: "size-4 cursor-pointer text-muted-foreground hover:text-foreground" }) }),
|
|
3117
3101
|
/* @__PURE__ */ e.jsx(Ge, { align: "center", className: "max-w-65", children: /* @__PURE__ */ e.jsxs("div", { className: "grid gap-4", children: [
|
|
3118
3102
|
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
@@ -3125,9 +3109,9 @@ function wa() {
|
|
|
3125
3109
|
/* @__PURE__ */ e.jsxs(
|
|
3126
3110
|
Oe,
|
|
3127
3111
|
{
|
|
3128
|
-
disabled:
|
|
3129
|
-
value:
|
|
3130
|
-
onValueChange: (v) =>
|
|
3112
|
+
disabled: K,
|
|
3113
|
+
value: c,
|
|
3114
|
+
onValueChange: (v) => r(v),
|
|
3131
3115
|
children: [
|
|
3132
3116
|
/* @__PURE__ */ e.jsx(Me, { className: "col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(Te, {}) }),
|
|
3133
3117
|
/* @__PURE__ */ e.jsx(Ae, { id: "type", children: /* @__PURE__ */ e.jsxs(He, { children: [
|
|
@@ -3139,15 +3123,15 @@ function wa() {
|
|
|
3139
3123
|
}
|
|
3140
3124
|
)
|
|
3141
3125
|
] }),
|
|
3142
|
-
|
|
3126
|
+
c == "linear" && /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 items-center gap-2 py-1", children: [
|
|
3143
3127
|
/* @__PURE__ */ e.jsx(B, { htmlFor: "scale-option", children: "Setup" }),
|
|
3144
3128
|
/* @__PURE__ */ e.jsxs(
|
|
3145
|
-
|
|
3129
|
+
la,
|
|
3146
3130
|
{
|
|
3147
|
-
disabled:
|
|
3131
|
+
disabled: K,
|
|
3148
3132
|
id: "scale-option",
|
|
3149
3133
|
value: u,
|
|
3150
|
-
onValueChange: (v) =>
|
|
3134
|
+
onValueChange: (v) => S(v),
|
|
3151
3135
|
className: "col-span-2 flex gap-3",
|
|
3152
3136
|
defaultValue: "x",
|
|
3153
3137
|
children: [
|
|
@@ -3163,11 +3147,11 @@ function wa() {
|
|
|
3163
3147
|
}
|
|
3164
3148
|
)
|
|
3165
3149
|
] }),
|
|
3166
|
-
u === "custom" &&
|
|
3167
|
-
|
|
3150
|
+
u === "custom" && c == "linear" && D(),
|
|
3151
|
+
G(),
|
|
3168
3152
|
/* @__PURE__ */ e.jsx(Tt, {}),
|
|
3169
3153
|
/* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3", children: /* @__PURE__ */ e.jsx(
|
|
3170
|
-
|
|
3154
|
+
w,
|
|
3171
3155
|
{
|
|
3172
3156
|
onClick: te,
|
|
3173
3157
|
variant: "secondary",
|
|
@@ -3180,56 +3164,56 @@ function wa() {
|
|
|
3180
3164
|
] });
|
|
3181
3165
|
}
|
|
3182
3166
|
function Un({ idx: s }) {
|
|
3183
|
-
var
|
|
3184
|
-
const n =
|
|
3185
|
-
var
|
|
3186
|
-
return (
|
|
3187
|
-
}), a =
|
|
3188
|
-
(
|
|
3189
|
-
var
|
|
3190
|
-
return (
|
|
3167
|
+
var l;
|
|
3168
|
+
const n = i((d) => {
|
|
3169
|
+
var f;
|
|
3170
|
+
return (f = d.card) == null ? void 0 : f.preferences;
|
|
3171
|
+
}), a = i(
|
|
3172
|
+
(d) => {
|
|
3173
|
+
var f;
|
|
3174
|
+
return (f = d.card.preferences) == null ? void 0 : f.datasetOptions;
|
|
3191
3175
|
}
|
|
3192
|
-
), t =
|
|
3193
|
-
(
|
|
3194
|
-
),
|
|
3195
|
-
function
|
|
3196
|
-
(
|
|
3176
|
+
), t = i(
|
|
3177
|
+
(d) => d.actions.setCardPreferences
|
|
3178
|
+
), o = (l = n == null ? void 0 : n.chartOptions) == null ? void 0 : l.indexAxis, c = a == null ? void 0 : a.find((d) => d.idx === s);
|
|
3179
|
+
function r(d, f) {
|
|
3180
|
+
(d === "end" || d === "start") && Et(Lt());
|
|
3197
3181
|
const m = {
|
|
3198
|
-
display:
|
|
3199
|
-
align:
|
|
3200
|
-
anchor:
|
|
3182
|
+
display: d !== "none",
|
|
3183
|
+
align: d,
|
|
3184
|
+
anchor: d,
|
|
3201
3185
|
clamp: !0
|
|
3202
3186
|
};
|
|
3203
|
-
if (!
|
|
3187
|
+
if (!c)
|
|
3204
3188
|
t({
|
|
3205
3189
|
...n,
|
|
3206
3190
|
datasetOptions: [
|
|
3207
3191
|
...a || [],
|
|
3208
3192
|
{
|
|
3209
|
-
idx:
|
|
3193
|
+
idx: f,
|
|
3210
3194
|
datalabels: m
|
|
3211
3195
|
}
|
|
3212
3196
|
]
|
|
3213
3197
|
});
|
|
3214
3198
|
else {
|
|
3215
|
-
const u = { ...
|
|
3199
|
+
const u = { ...c };
|
|
3216
3200
|
u.datalabels = m;
|
|
3217
|
-
const
|
|
3218
|
-
(
|
|
3201
|
+
const S = a == null ? void 0 : a.map(
|
|
3202
|
+
(h) => h.idx === f ? u : h
|
|
3219
3203
|
);
|
|
3220
3204
|
t({
|
|
3221
3205
|
...n,
|
|
3222
|
-
datasetOptions:
|
|
3206
|
+
datasetOptions: S
|
|
3223
3207
|
});
|
|
3224
3208
|
}
|
|
3225
3209
|
}
|
|
3226
|
-
return /* @__PURE__ */ e.jsxs(
|
|
3210
|
+
return /* @__PURE__ */ e.jsxs(Ke, { children: [
|
|
3227
3211
|
/* @__PURE__ */ e.jsx(Ue, { children: /* @__PURE__ */ e.jsx(xn, { className: "invisible size-4 rotate-[135deg] cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible" }) }),
|
|
3228
3212
|
/* @__PURE__ */ e.jsx(Ge, { className: "w-fit p-1", children: /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
|
|
3229
3213
|
/* @__PURE__ */ e.jsx(
|
|
3230
|
-
|
|
3214
|
+
w,
|
|
3231
3215
|
{
|
|
3232
|
-
onClick: () =>
|
|
3216
|
+
onClick: () => r("none", s),
|
|
3233
3217
|
size: "sm",
|
|
3234
3218
|
variant: "secondary",
|
|
3235
3219
|
className: "h-7 p-1 text-xs font-normal",
|
|
@@ -3237,51 +3221,51 @@ function Un({ idx: s }) {
|
|
|
3237
3221
|
}
|
|
3238
3222
|
),
|
|
3239
3223
|
/* @__PURE__ */ e.jsx(
|
|
3240
|
-
|
|
3224
|
+
w,
|
|
3241
3225
|
{
|
|
3242
|
-
onClick: () =>
|
|
3226
|
+
onClick: () => r("start", s),
|
|
3243
3227
|
size: "sm",
|
|
3244
3228
|
variant: "secondary",
|
|
3245
3229
|
className: "h-7 p-1 text-xs font-normal",
|
|
3246
3230
|
children: /* @__PURE__ */ e.jsx(
|
|
3247
3231
|
an,
|
|
3248
3232
|
{
|
|
3249
|
-
className:
|
|
3250
|
-
"rotate-90":
|
|
3233
|
+
className: Y("h-4 w-4", {
|
|
3234
|
+
"rotate-90": o === "y"
|
|
3251
3235
|
})
|
|
3252
3236
|
}
|
|
3253
3237
|
)
|
|
3254
3238
|
}
|
|
3255
3239
|
),
|
|
3256
3240
|
/* @__PURE__ */ e.jsx(
|
|
3257
|
-
|
|
3241
|
+
w,
|
|
3258
3242
|
{
|
|
3259
|
-
onClick: () =>
|
|
3243
|
+
onClick: () => r("center", s),
|
|
3260
3244
|
size: "sm",
|
|
3261
3245
|
variant: "secondary",
|
|
3262
3246
|
className: "h-7 p-1 text-xs font-normal",
|
|
3263
3247
|
children: /* @__PURE__ */ e.jsx(
|
|
3264
3248
|
nn,
|
|
3265
3249
|
{
|
|
3266
|
-
className:
|
|
3267
|
-
"rotate-90":
|
|
3250
|
+
className: Y("h-4 w-4", {
|
|
3251
|
+
"rotate-90": o === "y"
|
|
3268
3252
|
})
|
|
3269
3253
|
}
|
|
3270
3254
|
)
|
|
3271
3255
|
}
|
|
3272
3256
|
),
|
|
3273
3257
|
/* @__PURE__ */ e.jsx(
|
|
3274
|
-
|
|
3258
|
+
w,
|
|
3275
3259
|
{
|
|
3276
|
-
onClick: () =>
|
|
3260
|
+
onClick: () => r("end", s),
|
|
3277
3261
|
size: "sm",
|
|
3278
3262
|
variant: "secondary",
|
|
3279
3263
|
className: "h-7 p-1 text-xs font-normal",
|
|
3280
3264
|
children: /* @__PURE__ */ e.jsx(
|
|
3281
3265
|
tn,
|
|
3282
3266
|
{
|
|
3283
|
-
className:
|
|
3284
|
-
"rotate-90":
|
|
3267
|
+
className: Y("h-4 w-4", {
|
|
3268
|
+
"rotate-90": o === "y"
|
|
3285
3269
|
})
|
|
3286
3270
|
}
|
|
3287
3271
|
)
|
|
@@ -3291,72 +3275,72 @@ function Un({ idx: s }) {
|
|
|
3291
3275
|
] });
|
|
3292
3276
|
}
|
|
3293
3277
|
function za() {
|
|
3294
|
-
const s =
|
|
3295
|
-
(
|
|
3296
|
-
var
|
|
3297
|
-
return (u = (m = (
|
|
3278
|
+
const s = i((d) => d.card), n = i(
|
|
3279
|
+
(d) => {
|
|
3280
|
+
var f, m, u;
|
|
3281
|
+
return (u = (m = (f = d == null ? void 0 : d.card) == null ? void 0 : f.preferences) == null ? void 0 : m.chartOptions) == null ? void 0 : u.indexAxis;
|
|
3298
3282
|
}
|
|
3299
3283
|
), a = n === "y" ? "Y axis" : "X axis", t = n === "y" ? "X axis" : "Y axis", {
|
|
3300
|
-
keys:
|
|
3301
|
-
metricKeys:
|
|
3302
|
-
dimensionKeys:
|
|
3303
|
-
} =
|
|
3304
|
-
let
|
|
3284
|
+
keys: o,
|
|
3285
|
+
metricKeys: c,
|
|
3286
|
+
dimensionKeys: r
|
|
3287
|
+
} = hs(s.data || []);
|
|
3288
|
+
let l = c;
|
|
3305
3289
|
if (s.type === "stackedBar") {
|
|
3306
|
-
const
|
|
3290
|
+
const d = Dt({
|
|
3307
3291
|
dataArray: s.data || [],
|
|
3308
|
-
groupKey:
|
|
3309
|
-
pivotKey:
|
|
3310
|
-
valueKey:
|
|
3311
|
-
}), { metricKeys:
|
|
3312
|
-
|
|
3292
|
+
groupKey: r[0],
|
|
3293
|
+
pivotKey: r[1],
|
|
3294
|
+
valueKey: l[0]
|
|
3295
|
+
}), { metricKeys: f } = hs(d);
|
|
3296
|
+
l = f;
|
|
3313
3297
|
}
|
|
3314
|
-
return
|
|
3298
|
+
return o.length === 0 ? null : /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
|
|
3315
3299
|
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
3316
3300
|
/* @__PURE__ */ e.jsx(B, { children: a }),
|
|
3317
|
-
/* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: /* @__PURE__ */ e.jsx("div", { className: "rounded-md bg-muted/70 px-2 py-1 hover:bg-muted", children: /* @__PURE__ */ e.jsx("p", { children:
|
|
3301
|
+
/* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: /* @__PURE__ */ e.jsx("div", { className: "rounded-md bg-muted/70 px-2 py-1 hover:bg-muted", children: /* @__PURE__ */ e.jsx("p", { children: r[0] }) }) })
|
|
3318
3302
|
] }),
|
|
3319
3303
|
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
3320
3304
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-5", children: [
|
|
3321
3305
|
/* @__PURE__ */ e.jsx(B, { children: t }),
|
|
3322
3306
|
/* @__PURE__ */ e.jsx(wa, {})
|
|
3323
3307
|
] }),
|
|
3324
|
-
/* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children:
|
|
3308
|
+
/* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: l.map((d, f) => /* @__PURE__ */ e.jsx(Gn, { col: d, idx: f }, d)) })
|
|
3325
3309
|
] })
|
|
3326
3310
|
] });
|
|
3327
3311
|
}
|
|
3328
3312
|
function Gn({ col: s, idx: n }) {
|
|
3329
|
-
const a =
|
|
3330
|
-
var
|
|
3331
|
-
return (
|
|
3332
|
-
}), t =
|
|
3333
|
-
(
|
|
3334
|
-
var
|
|
3335
|
-
return (
|
|
3313
|
+
const a = i((l) => {
|
|
3314
|
+
var d;
|
|
3315
|
+
return (d = l.card) == null ? void 0 : d.preferences;
|
|
3316
|
+
}), t = i(
|
|
3317
|
+
(l) => {
|
|
3318
|
+
var d;
|
|
3319
|
+
return (d = l.card.preferences) == null ? void 0 : d.datasetOptions;
|
|
3336
3320
|
}
|
|
3337
|
-
),
|
|
3338
|
-
function l
|
|
3339
|
-
if (!
|
|
3340
|
-
|
|
3321
|
+
), o = t == null ? void 0 : t.find((l) => l.idx === n), { setCardPreferences: c } = i((l) => l.actions);
|
|
3322
|
+
function r(l) {
|
|
3323
|
+
if (!o)
|
|
3324
|
+
c({
|
|
3341
3325
|
...a,
|
|
3342
3326
|
datasetOptions: [
|
|
3343
3327
|
...t || [],
|
|
3344
3328
|
{
|
|
3345
3329
|
idx: n,
|
|
3346
|
-
type:
|
|
3347
|
-
fill:
|
|
3330
|
+
type: l === "area" ? "line" : l,
|
|
3331
|
+
fill: l === "area" ? "origin" : ""
|
|
3348
3332
|
}
|
|
3349
3333
|
]
|
|
3350
3334
|
});
|
|
3351
3335
|
else {
|
|
3352
|
-
const
|
|
3353
|
-
|
|
3354
|
-
const
|
|
3355
|
-
(m) => m.idx === n ?
|
|
3336
|
+
const d = { ...o };
|
|
3337
|
+
d.type = l === "area" ? "line" : l, d.fill = l === "area" ? "origin" : "";
|
|
3338
|
+
const f = t == null ? void 0 : t.map(
|
|
3339
|
+
(m) => m.idx === n ? d : m
|
|
3356
3340
|
);
|
|
3357
|
-
|
|
3341
|
+
c({
|
|
3358
3342
|
...a,
|
|
3359
|
-
datasetOptions:
|
|
3343
|
+
datasetOptions: f
|
|
3360
3344
|
});
|
|
3361
3345
|
}
|
|
3362
3346
|
}
|
|
@@ -3364,28 +3348,28 @@ function Gn({ col: s, idx: n }) {
|
|
|
3364
3348
|
/* @__PURE__ */ e.jsx("p", { children: s }),
|
|
3365
3349
|
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
|
|
3366
3350
|
/* @__PURE__ */ e.jsx(
|
|
3367
|
-
|
|
3351
|
+
ws,
|
|
3368
3352
|
{
|
|
3369
|
-
onClick: () =>
|
|
3353
|
+
onClick: () => r("bar"),
|
|
3370
3354
|
className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
|
|
3371
3355
|
}
|
|
3372
3356
|
),
|
|
3373
3357
|
/* @__PURE__ */ e.jsx(
|
|
3374
|
-
|
|
3358
|
+
zs,
|
|
3375
3359
|
{
|
|
3376
|
-
onClick: () =>
|
|
3360
|
+
onClick: () => r("line"),
|
|
3377
3361
|
className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
|
|
3378
3362
|
}
|
|
3379
3363
|
),
|
|
3380
3364
|
/* @__PURE__ */ e.jsx(
|
|
3381
3365
|
Jt,
|
|
3382
3366
|
{
|
|
3383
|
-
onClick: () =>
|
|
3367
|
+
onClick: () => r("area"),
|
|
3384
3368
|
className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
|
|
3385
3369
|
}
|
|
3386
3370
|
),
|
|
3387
3371
|
/* @__PURE__ */ e.jsx(
|
|
3388
|
-
|
|
3372
|
+
Ss,
|
|
3389
3373
|
{
|
|
3390
3374
|
orientation: "vertical",
|
|
3391
3375
|
className: "invisible size-4 cursor-pointer py-2 text-muted-foreground hover:text-foreground group-hover:visible"
|
|
@@ -3399,8 +3383,8 @@ function Jn({
|
|
|
3399
3383
|
cardType: s
|
|
3400
3384
|
}) {
|
|
3401
3385
|
return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Se, { defaultValue: ["item-2"], type: "multiple", children: [
|
|
3402
|
-
/* @__PURE__ */ e.jsxs(
|
|
3403
|
-
/* @__PURE__ */ e.jsx(R, { children: `${
|
|
3386
|
+
/* @__PURE__ */ e.jsxs(V, { value: "item-1", children: [
|
|
3387
|
+
/* @__PURE__ */ e.jsx(R, { children: `${ks(s)} Chart` }),
|
|
3404
3388
|
/* @__PURE__ */ e.jsxs(_, { className: "space-y-4 font-mono text-xs", children: [
|
|
3405
3389
|
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT x-axis, y-axis-1, y-axis-2,... FROM table" }),
|
|
3406
3390
|
/* @__PURE__ */ e.jsxs("ul", { className: "ml-6 list-disc text-xs [&>li]:mt-2", children: [
|
|
@@ -3424,54 +3408,54 @@ function Jn({
|
|
|
3424
3408
|
] })
|
|
3425
3409
|
] })
|
|
3426
3410
|
] }),
|
|
3427
|
-
/* @__PURE__ */ e.jsxs(
|
|
3411
|
+
/* @__PURE__ */ e.jsxs(V, { value: "item-2", children: [
|
|
3428
3412
|
/* @__PURE__ */ e.jsx(R, { children: "Settings" }),
|
|
3429
3413
|
/* @__PURE__ */ e.jsxs(_, { className: "space-y-4 px-2", children: [
|
|
3430
|
-
/* @__PURE__ */ e.jsx(
|
|
3414
|
+
/* @__PURE__ */ e.jsx(Fs, {}),
|
|
3431
3415
|
/* @__PURE__ */ e.jsx(za, {})
|
|
3432
3416
|
] })
|
|
3433
3417
|
] }),
|
|
3434
|
-
/* @__PURE__ */ e.jsxs(
|
|
3418
|
+
/* @__PURE__ */ e.jsxs(V, { value: "item-3", children: [
|
|
3435
3419
|
/* @__PURE__ */ e.jsx(R, { children: "Filter on click" }),
|
|
3436
3420
|
/* @__PURE__ */ e.jsx(_, { className: "px-2", children: /* @__PURE__ */ e.jsx(De, {}) })
|
|
3437
3421
|
] })
|
|
3438
3422
|
] }) });
|
|
3439
3423
|
}
|
|
3440
|
-
function
|
|
3441
|
-
var
|
|
3442
|
-
const s =
|
|
3443
|
-
(
|
|
3444
|
-
), n =
|
|
3445
|
-
function t(
|
|
3424
|
+
function Os() {
|
|
3425
|
+
var o, c, r;
|
|
3426
|
+
const s = i(
|
|
3427
|
+
(l) => l.card.cfg
|
|
3428
|
+
), n = i((l) => l.actions.setCardCfg), a = i((l) => l.card.type);
|
|
3429
|
+
function t(l) {
|
|
3446
3430
|
var m;
|
|
3447
|
-
const
|
|
3431
|
+
const d = {
|
|
3448
3432
|
datalabels: {
|
|
3449
|
-
display:
|
|
3450
|
-
align:
|
|
3451
|
-
anchor:
|
|
3433
|
+
display: l !== "none",
|
|
3434
|
+
align: l,
|
|
3435
|
+
anchor: l,
|
|
3452
3436
|
clamp: !0
|
|
3453
3437
|
}
|
|
3454
|
-
},
|
|
3438
|
+
}, f = {
|
|
3455
3439
|
...s,
|
|
3456
3440
|
options: {
|
|
3457
3441
|
...s == null ? void 0 : s.options,
|
|
3458
3442
|
plugins: {
|
|
3459
3443
|
...(m = s == null ? void 0 : s.options) == null ? void 0 : m.plugins,
|
|
3460
|
-
...
|
|
3444
|
+
...d
|
|
3461
3445
|
}
|
|
3462
3446
|
}
|
|
3463
3447
|
};
|
|
3464
|
-
n(
|
|
3448
|
+
n(f), console.log(l);
|
|
3465
3449
|
}
|
|
3466
3450
|
return /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
3467
3451
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
3468
3452
|
/* @__PURE__ */ e.jsx("label", { className: "font-medium", children: "Data Labels" }),
|
|
3469
|
-
!["pyramid"
|
|
3453
|
+
!["pyramid"].includes(a) && /* @__PURE__ */ e.jsx(wa, {})
|
|
3470
3454
|
] }),
|
|
3471
3455
|
/* @__PURE__ */ e.jsxs(
|
|
3472
3456
|
Oe,
|
|
3473
3457
|
{
|
|
3474
|
-
value: (
|
|
3458
|
+
value: (r = (c = (o = s == null ? void 0 : s.options) == null ? void 0 : o.plugins) == null ? void 0 : c.datalabels) == null ? void 0 : r.anchor,
|
|
3475
3459
|
onValueChange: t,
|
|
3476
3460
|
defaultValue: "none",
|
|
3477
3461
|
children: [
|
|
@@ -3492,9 +3476,9 @@ function Qn({
|
|
|
3492
3476
|
cardType: s
|
|
3493
3477
|
}) {
|
|
3494
3478
|
function n(a) {
|
|
3495
|
-
const t = "SELECT label, [group], x-axis, y-axis, radius FROM table",
|
|
3479
|
+
const t = "SELECT label, [group], x-axis, y-axis, radius FROM table", o = "SELECT label, [group], x-axis, y-axis FROM table";
|
|
3496
3480
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
3497
|
-
/* @__PURE__ */ e.jsx("div", { className: "bg-muted px-2 py-1 rounded text-xs", children: a === "bubble" ? t :
|
|
3481
|
+
/* @__PURE__ */ e.jsx("div", { className: "bg-muted px-2 py-1 rounded text-xs", children: a === "bubble" ? t : o }),
|
|
3498
3482
|
/* @__PURE__ */ e.jsxs("ul", { className: " ml-6 list-disc [&>li]:mt-2 text-xs", children: [
|
|
3499
3483
|
/* @__PURE__ */ e.jsx("li", { children: "label - category" }),
|
|
3500
3484
|
/* @__PURE__ */ e.jsx("li", { children: "group - category" }),
|
|
@@ -3508,7 +3492,7 @@ function Qn({
|
|
|
3508
3492
|
"a",
|
|
3509
3493
|
{
|
|
3510
3494
|
target: "_blank",
|
|
3511
|
-
onClick: (
|
|
3495
|
+
onClick: (c) => c.stopPropagation(),
|
|
3512
3496
|
className: "text-blue-700",
|
|
3513
3497
|
href: "https://docs.semaphor.cloud/concepts/visuals#pie-chart",
|
|
3514
3498
|
children: "example"
|
|
@@ -3519,15 +3503,15 @@ function Qn({
|
|
|
3519
3503
|
] });
|
|
3520
3504
|
}
|
|
3521
3505
|
return /* @__PURE__ */ e.jsx("div", { className: "px-6 py-2 space-y-6", children: /* @__PURE__ */ e.jsxs(Se, { defaultValue: ["item-2"], type: "multiple", children: [
|
|
3522
|
-
/* @__PURE__ */ e.jsxs(
|
|
3523
|
-
/* @__PURE__ */ e.jsx(R, { children: `${
|
|
3506
|
+
/* @__PURE__ */ e.jsxs(V, { value: "item-1", children: [
|
|
3507
|
+
/* @__PURE__ */ e.jsx(R, { children: `${ks(s)} Chart` }),
|
|
3524
3508
|
/* @__PURE__ */ e.jsx(_, { className: " space-y-4 font-mono text-xs ", children: n(s) })
|
|
3525
3509
|
] }),
|
|
3526
|
-
/* @__PURE__ */ e.jsxs(
|
|
3510
|
+
/* @__PURE__ */ e.jsxs(V, { value: "item-2", children: [
|
|
3527
3511
|
/* @__PURE__ */ e.jsx(R, { children: "Settings" }),
|
|
3528
|
-
/* @__PURE__ */ e.jsx(_, { className: "px-2", children: /* @__PURE__ */ e.jsx(
|
|
3512
|
+
/* @__PURE__ */ e.jsx(_, { className: "px-2", children: /* @__PURE__ */ e.jsx(Os, {}) })
|
|
3529
3513
|
] }),
|
|
3530
|
-
/* @__PURE__ */ e.jsxs(
|
|
3514
|
+
/* @__PURE__ */ e.jsxs(V, { value: "item-3", children: [
|
|
3531
3515
|
/* @__PURE__ */ e.jsx(R, { children: "Filter on click" }),
|
|
3532
3516
|
/* @__PURE__ */ e.jsx(_, { className: "px-2", children: /* @__PURE__ */ e.jsx(De, {}) })
|
|
3533
3517
|
] })
|
|
@@ -3557,7 +3541,7 @@ const Wn = {
|
|
|
3557
3541
|
]
|
|
3558
3542
|
};
|
|
3559
3543
|
function Xn() {
|
|
3560
|
-
const s =
|
|
3544
|
+
const s = i((n) => n.card.type);
|
|
3561
3545
|
return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 p-6", children: [
|
|
3562
3546
|
/* @__PURE__ */ e.jsx(
|
|
3563
3547
|
Se,
|
|
@@ -3568,15 +3552,15 @@ function Xn() {
|
|
|
3568
3552
|
children: Zn(s)
|
|
3569
3553
|
}
|
|
3570
3554
|
),
|
|
3571
|
-
/* @__PURE__ */ e.jsx("section", { className: "", children: ["line", "bar"].includes(s) && /* @__PURE__ */ e.jsx(
|
|
3572
|
-
/* @__PURE__ */ e.jsx("div", { children: !["kpi"].includes(s) && /* @__PURE__ */ e.jsx(
|
|
3555
|
+
/* @__PURE__ */ e.jsx("section", { className: "", children: ["line", "bar"].includes(s) && /* @__PURE__ */ e.jsx(Fs, {}) }),
|
|
3556
|
+
/* @__PURE__ */ e.jsx("div", { children: !["kpi"].includes(s) && /* @__PURE__ */ e.jsx(Os, {}) }),
|
|
3573
3557
|
/* @__PURE__ */ e.jsx("div", { children: !["kpi"].includes(s) && /* @__PURE__ */ e.jsx(De, {}) })
|
|
3574
3558
|
] });
|
|
3575
3559
|
}
|
|
3576
3560
|
function Zn(s) {
|
|
3577
3561
|
if (["line", "bar"].includes(s))
|
|
3578
3562
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
3579
|
-
/* @__PURE__ */ e.jsxs(
|
|
3563
|
+
/* @__PURE__ */ e.jsxs(V, { value: "item-1", children: [
|
|
3580
3564
|
/* @__PURE__ */ e.jsx(R, { className: "font-normal", children: /* @__PURE__ */ e.jsx("p", { children: "Chart Query" }) }),
|
|
3581
3565
|
/* @__PURE__ */ e.jsxs(_, { className: " ", children: [
|
|
3582
3566
|
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 font-mono text-xs font-semibold", children: "SELECT x-axis, y-axis-1, y-axis-2, y-axis-3,... FROM table" }),
|
|
@@ -3586,7 +3570,7 @@ function Zn(s) {
|
|
|
3586
3570
|
] })
|
|
3587
3571
|
] })
|
|
3588
3572
|
] }),
|
|
3589
|
-
/* @__PURE__ */ e.jsxs(
|
|
3573
|
+
/* @__PURE__ */ e.jsxs(V, { value: "item-2", children: [
|
|
3590
3574
|
/* @__PURE__ */ e.jsx(R, { className: "font-normal", children: "Mixed Chart" }),
|
|
3591
3575
|
/* @__PURE__ */ e.jsxs(_, { className: "space-y-2 text-xs", children: [
|
|
3592
3576
|
/* @__PURE__ */ e.jsxs("p", { children: [
|
|
@@ -3597,7 +3581,7 @@ function Zn(s) {
|
|
|
3597
3581
|
/* @__PURE__ */ e.jsx("pre", { children: JSON.stringify(Wn, null, 2) })
|
|
3598
3582
|
] })
|
|
3599
3583
|
] }),
|
|
3600
|
-
/* @__PURE__ */ e.jsxs(
|
|
3584
|
+
/* @__PURE__ */ e.jsxs(V, { value: "item-3", children: [
|
|
3601
3585
|
/* @__PURE__ */ e.jsx(R, { className: "font-normal", children: "Area Chart" }),
|
|
3602
3586
|
/* @__PURE__ */ e.jsxs(_, { className: "space-y-2 text-xs", children: [
|
|
3603
3587
|
/* @__PURE__ */ e.jsxs("p", { children: [
|
|
@@ -3620,7 +3604,7 @@ function Zn(s) {
|
|
|
3620
3604
|
] })
|
|
3621
3605
|
] });
|
|
3622
3606
|
if (s === "bubble")
|
|
3623
|
-
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(
|
|
3607
|
+
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(V, { value: "item-1", children: [
|
|
3624
3608
|
/* @__PURE__ */ e.jsx(R, { className: "font-normal", children: /* @__PURE__ */ e.jsxs("p", { children: [
|
|
3625
3609
|
"How to create a ",
|
|
3626
3610
|
/* @__PURE__ */ e.jsx("span", { children: s }),
|
|
@@ -3638,7 +3622,7 @@ function Zn(s) {
|
|
|
3638
3622
|
] })
|
|
3639
3623
|
] }) });
|
|
3640
3624
|
if (s === "scatter")
|
|
3641
|
-
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(
|
|
3625
|
+
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(V, { value: "item-1", children: [
|
|
3642
3626
|
/* @__PURE__ */ e.jsx(R, { className: "font-normal", children: /* @__PURE__ */ e.jsxs("p", { children: [
|
|
3643
3627
|
"How to create a ",
|
|
3644
3628
|
/* @__PURE__ */ e.jsx("span", { children: s }),
|
|
@@ -3655,7 +3639,7 @@ function Zn(s) {
|
|
|
3655
3639
|
] })
|
|
3656
3640
|
] }) });
|
|
3657
3641
|
if (["pie", "doughnut", "polarArea"].includes(s))
|
|
3658
|
-
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(
|
|
3642
|
+
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(V, { value: "item-1", children: [
|
|
3659
3643
|
/* @__PURE__ */ e.jsx(R, { className: "font-normal", children: /* @__PURE__ */ e.jsxs("p", { children: [
|
|
3660
3644
|
/* @__PURE__ */ e.jsx("span", { children: s === "polarArea" ? "Polar" : s.charAt(0).toUpperCase() + s.slice(1) }),
|
|
3661
3645
|
" ",
|
|
@@ -3670,53 +3654,53 @@ function Zn(s) {
|
|
|
3670
3654
|
] })
|
|
3671
3655
|
] }) });
|
|
3672
3656
|
}
|
|
3673
|
-
function
|
|
3674
|
-
var
|
|
3675
|
-
const s =
|
|
3676
|
-
(
|
|
3677
|
-
), a =
|
|
3678
|
-
(
|
|
3657
|
+
function er() {
|
|
3658
|
+
var d, f, m, u, S;
|
|
3659
|
+
const s = i((h) => h.card.preferences), n = i(
|
|
3660
|
+
(h) => h.actions.setCardPreferences
|
|
3661
|
+
), a = i(
|
|
3662
|
+
(h) => h.actions.setNumberFormat
|
|
3679
3663
|
);
|
|
3680
|
-
|
|
3681
|
-
(
|
|
3682
|
-
var x,
|
|
3683
|
-
return (
|
|
3664
|
+
i(
|
|
3665
|
+
(h) => {
|
|
3666
|
+
var x, g;
|
|
3667
|
+
return (g = (x = h.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : g.decimalPlaces;
|
|
3684
3668
|
}
|
|
3685
3669
|
);
|
|
3686
|
-
const t =
|
|
3687
|
-
(
|
|
3688
|
-
var x,
|
|
3689
|
-
return (
|
|
3670
|
+
const t = i(
|
|
3671
|
+
(h) => {
|
|
3672
|
+
var x, g;
|
|
3673
|
+
return (g = (x = h.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : g.locale;
|
|
3690
3674
|
}
|
|
3691
|
-
),
|
|
3692
|
-
(
|
|
3693
|
-
var x,
|
|
3694
|
-
return (
|
|
3675
|
+
), o = i(
|
|
3676
|
+
(h) => {
|
|
3677
|
+
var x, g;
|
|
3678
|
+
return (g = (x = h.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : g.currency;
|
|
3695
3679
|
}
|
|
3696
3680
|
);
|
|
3697
|
-
|
|
3698
|
-
(
|
|
3681
|
+
i(
|
|
3682
|
+
(h) => h.actions.setFilterOnClickField
|
|
3699
3683
|
);
|
|
3700
|
-
const
|
|
3701
|
-
(
|
|
3702
|
-
var x,
|
|
3703
|
-
return (
|
|
3684
|
+
const c = i(
|
|
3685
|
+
(h) => {
|
|
3686
|
+
var x, g;
|
|
3687
|
+
return (g = (x = h.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : g.colorRanges;
|
|
3704
3688
|
}
|
|
3705
|
-
) || [],
|
|
3706
|
-
(
|
|
3707
|
-
),
|
|
3689
|
+
) || [], r = i(
|
|
3690
|
+
(h) => h.actions.setColorRanges
|
|
3691
|
+
), l = [...new Set(Rs.map((h) => h.currency))];
|
|
3708
3692
|
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
3709
3693
|
/* @__PURE__ */ e.jsxs("div", { className: "mb-3 flex items-center gap-2", children: [
|
|
3710
3694
|
/* @__PURE__ */ e.jsx(
|
|
3711
|
-
|
|
3695
|
+
Pe,
|
|
3712
3696
|
{
|
|
3713
|
-
checked: !!((
|
|
3714
|
-
onCheckedChange: (
|
|
3697
|
+
checked: !!((d = s == null ? void 0 : s.formatNumber) != null && d.enabled),
|
|
3698
|
+
onCheckedChange: (h) => {
|
|
3715
3699
|
n({
|
|
3716
3700
|
...s,
|
|
3717
3701
|
formatNumber: {
|
|
3718
3702
|
...s == null ? void 0 : s.formatNumber,
|
|
3719
|
-
enabled:
|
|
3703
|
+
enabled: h
|
|
3720
3704
|
}
|
|
3721
3705
|
});
|
|
3722
3706
|
}
|
|
@@ -3724,7 +3708,7 @@ function el() {
|
|
|
3724
3708
|
),
|
|
3725
3709
|
/* @__PURE__ */ e.jsx(B, { children: "Format Number" })
|
|
3726
3710
|
] }),
|
|
3727
|
-
((
|
|
3711
|
+
((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.enabled) === !0 && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
3728
3712
|
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 p-2", children: [
|
|
3729
3713
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
3730
3714
|
/* @__PURE__ */ e.jsxs("div", { className: "w-full space-y-1", children: [
|
|
@@ -3733,20 +3717,20 @@ function el() {
|
|
|
3733
3717
|
Oe,
|
|
3734
3718
|
{
|
|
3735
3719
|
value: t || "en-US",
|
|
3736
|
-
onValueChange: (
|
|
3737
|
-
var x,
|
|
3720
|
+
onValueChange: (h) => {
|
|
3721
|
+
var x, g, z;
|
|
3738
3722
|
return a(
|
|
3739
3723
|
((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.decimalPlaces) || 0,
|
|
3740
|
-
((
|
|
3741
|
-
|
|
3742
|
-
((
|
|
3724
|
+
((g = s == null ? void 0 : s.formatNumber) == null ? void 0 : g.currency) || "",
|
|
3725
|
+
h || "en-US",
|
|
3726
|
+
((z = s == null ? void 0 : s.formatNumber) == null ? void 0 : z.suffix) || ""
|
|
3743
3727
|
);
|
|
3744
3728
|
},
|
|
3745
3729
|
children: [
|
|
3746
3730
|
/* @__PURE__ */ e.jsx(Me, { className: "col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(Te, {}) }),
|
|
3747
3731
|
/* @__PURE__ */ e.jsx(Ae, { children: /* @__PURE__ */ e.jsxs(He, { children: [
|
|
3748
3732
|
/* @__PURE__ */ e.jsx(Le, { children: "Format" }),
|
|
3749
|
-
Rs.map((
|
|
3733
|
+
Rs.map((h) => /* @__PURE__ */ e.jsx(X, { value: h.locale, children: h.locale }, h.locale))
|
|
3750
3734
|
] }) })
|
|
3751
3735
|
]
|
|
3752
3736
|
}
|
|
@@ -3757,14 +3741,14 @@ function el() {
|
|
|
3757
3741
|
/* @__PURE__ */ e.jsxs(
|
|
3758
3742
|
Oe,
|
|
3759
3743
|
{
|
|
3760
|
-
value:
|
|
3761
|
-
onValueChange: (
|
|
3762
|
-
var x,
|
|
3744
|
+
value: o || "none",
|
|
3745
|
+
onValueChange: (h) => {
|
|
3746
|
+
var x, g, z;
|
|
3763
3747
|
return a(
|
|
3764
3748
|
((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.decimalPlaces) || 0,
|
|
3765
|
-
|
|
3766
|
-
((
|
|
3767
|
-
((
|
|
3749
|
+
h === "none" ? "" : h,
|
|
3750
|
+
((g = s == null ? void 0 : s.formatNumber) == null ? void 0 : g.locale) || "",
|
|
3751
|
+
((z = s == null ? void 0 : s.formatNumber) == null ? void 0 : z.suffix) || ""
|
|
3768
3752
|
);
|
|
3769
3753
|
},
|
|
3770
3754
|
children: [
|
|
@@ -3772,7 +3756,7 @@ function el() {
|
|
|
3772
3756
|
/* @__PURE__ */ e.jsx(Ae, { children: /* @__PURE__ */ e.jsxs(He, { children: [
|
|
3773
3757
|
/* @__PURE__ */ e.jsx(Le, { children: "Currency" }),
|
|
3774
3758
|
/* @__PURE__ */ e.jsx(X, { value: "none", children: "None" }, "none"),
|
|
3775
|
-
|
|
3759
|
+
l.map((h) => /* @__PURE__ */ e.jsx(X, { value: h, children: h }, h))
|
|
3776
3760
|
] }) })
|
|
3777
3761
|
]
|
|
3778
3762
|
}
|
|
@@ -3786,18 +3770,18 @@ function el() {
|
|
|
3786
3770
|
Oe,
|
|
3787
3771
|
{
|
|
3788
3772
|
value: ((u = (m = s == null ? void 0 : s.formatNumber) == null ? void 0 : m.decimalPlaces) == null ? void 0 : u.toString()) || "0",
|
|
3789
|
-
onValueChange: (
|
|
3790
|
-
var x,
|
|
3773
|
+
onValueChange: (h) => {
|
|
3774
|
+
var x, g, z;
|
|
3791
3775
|
return a(
|
|
3792
|
-
Number(
|
|
3776
|
+
Number(h),
|
|
3793
3777
|
((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.currency) || "",
|
|
3794
|
-
((
|
|
3795
|
-
((
|
|
3778
|
+
((g = s == null ? void 0 : s.formatNumber) == null ? void 0 : g.locale) || "",
|
|
3779
|
+
((z = s == null ? void 0 : s.formatNumber) == null ? void 0 : z.suffix) || ""
|
|
3796
3780
|
);
|
|
3797
3781
|
},
|
|
3798
3782
|
children: [
|
|
3799
3783
|
/* @__PURE__ */ e.jsx(Me, { className: "col-span-3 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(Te, {}) }),
|
|
3800
|
-
/* @__PURE__ */ e.jsx(Ae, { children: ["0", "1", "2", "3", "4"].map((
|
|
3784
|
+
/* @__PURE__ */ e.jsx(Ae, { children: ["0", "1", "2", "3", "4"].map((h) => /* @__PURE__ */ e.jsx(X, { value: h, children: h }, h)) })
|
|
3801
3785
|
]
|
|
3802
3786
|
}
|
|
3803
3787
|
)
|
|
@@ -3807,16 +3791,16 @@ function el() {
|
|
|
3807
3791
|
/* @__PURE__ */ e.jsx(
|
|
3808
3792
|
ae,
|
|
3809
3793
|
{
|
|
3810
|
-
value: ((
|
|
3794
|
+
value: ((S = s == null ? void 0 : s.formatNumber) == null ? void 0 : S.suffix) || "",
|
|
3811
3795
|
className: "h-8 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",
|
|
3812
3796
|
placeholder: "K, M, B, %",
|
|
3813
|
-
onChange: (
|
|
3814
|
-
var x,
|
|
3797
|
+
onChange: (h) => {
|
|
3798
|
+
var x, g, z;
|
|
3815
3799
|
return a(
|
|
3816
3800
|
((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.decimalPlaces) || 0,
|
|
3817
|
-
((
|
|
3818
|
-
((
|
|
3819
|
-
|
|
3801
|
+
((g = s == null ? void 0 : s.formatNumber) == null ? void 0 : g.currency) || "",
|
|
3802
|
+
((z = s == null ? void 0 : s.formatNumber) == null ? void 0 : z.locale) || "",
|
|
3803
|
+
h.target.value
|
|
3820
3804
|
);
|
|
3821
3805
|
}
|
|
3822
3806
|
}
|
|
@@ -3824,20 +3808,20 @@ function el() {
|
|
|
3824
3808
|
] })
|
|
3825
3809
|
] })
|
|
3826
3810
|
] }) }),
|
|
3827
|
-
/* @__PURE__ */ e.jsx(
|
|
3811
|
+
/* @__PURE__ */ e.jsx(Ss, { className: "my-3" }),
|
|
3828
3812
|
/* @__PURE__ */ e.jsx(
|
|
3829
3813
|
It,
|
|
3830
3814
|
{
|
|
3831
|
-
colorRanges:
|
|
3832
|
-
setColorRanges:
|
|
3815
|
+
colorRanges: c,
|
|
3816
|
+
setColorRanges: r
|
|
3833
3817
|
}
|
|
3834
3818
|
)
|
|
3835
3819
|
] })
|
|
3836
3820
|
] });
|
|
3837
3821
|
}
|
|
3838
|
-
function
|
|
3822
|
+
function sr() {
|
|
3839
3823
|
return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 px-6 py-2", children: [
|
|
3840
|
-
/* @__PURE__ */ e.jsx(Se, { type: "single", collapsible: !0, children: /* @__PURE__ */ e.jsxs(
|
|
3824
|
+
/* @__PURE__ */ e.jsx(Se, { type: "single", collapsible: !0, children: /* @__PURE__ */ e.jsxs(V, { value: "item-1", children: [
|
|
3841
3825
|
/* @__PURE__ */ e.jsx(R, { className: "", children: "KPI Query" }),
|
|
3842
3826
|
/* @__PURE__ */ e.jsxs(_, { className: "font-mono", children: [
|
|
3843
3827
|
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 font-mono text-xs", children: "SELECT current, previous FROM table" }),
|
|
@@ -3861,7 +3845,7 @@ function sl() {
|
|
|
3861
3845
|
] })
|
|
3862
3846
|
] })
|
|
3863
3847
|
] }) }),
|
|
3864
|
-
/* @__PURE__ */ e.jsx("section", { className: "", children: /* @__PURE__ */ e.jsx(
|
|
3848
|
+
/* @__PURE__ */ e.jsx("section", { className: "", children: /* @__PURE__ */ e.jsx(er, {}) }),
|
|
3865
3849
|
/* @__PURE__ */ e.jsx("div", {}),
|
|
3866
3850
|
/* @__PURE__ */ e.jsx("div", {})
|
|
3867
3851
|
] });
|
|
@@ -3871,8 +3855,8 @@ function os({
|
|
|
3871
3855
|
docContent: n
|
|
3872
3856
|
}) {
|
|
3873
3857
|
return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Se, { defaultValue: ["item-2"], type: "multiple", children: [
|
|
3874
|
-
/* @__PURE__ */ e.jsxs(
|
|
3875
|
-
/* @__PURE__ */ e.jsx(R, { children: `${
|
|
3858
|
+
/* @__PURE__ */ e.jsxs(V, { value: "item-1", children: [
|
|
3859
|
+
/* @__PURE__ */ e.jsx(R, { children: `${ks(s)} Chart` }),
|
|
3876
3860
|
/* @__PURE__ */ e.jsx(_, { children: n || /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
|
|
3877
3861
|
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT label, measure FROM table" }),
|
|
3878
3862
|
/* @__PURE__ */ e.jsxs("ul", { className: "ml-6 list-disc text-xs [&>li]:mt-2", children: [
|
|
@@ -3895,19 +3879,19 @@ function os({
|
|
|
3895
3879
|
] })
|
|
3896
3880
|
] }) })
|
|
3897
3881
|
] }),
|
|
3898
|
-
/* @__PURE__ */ e.jsxs(
|
|
3882
|
+
/* @__PURE__ */ e.jsxs(V, { value: "item-2", children: [
|
|
3899
3883
|
/* @__PURE__ */ e.jsx(R, { children: "Settings" }),
|
|
3900
|
-
/* @__PURE__ */ e.jsx(_, { className: "px-2", children: /* @__PURE__ */ e.jsx(
|
|
3884
|
+
/* @__PURE__ */ e.jsx(_, { className: "px-2", children: /* @__PURE__ */ e.jsx(Os, {}) })
|
|
3901
3885
|
] }),
|
|
3902
|
-
s !== "range" && /* @__PURE__ */ e.jsxs(
|
|
3886
|
+
s !== "range" && /* @__PURE__ */ e.jsxs(V, { value: "item-3", children: [
|
|
3903
3887
|
/* @__PURE__ */ e.jsx(R, { children: "Filter on click" }),
|
|
3904
3888
|
/* @__PURE__ */ e.jsx(_, { className: "px-2", children: /* @__PURE__ */ e.jsx(De, {}) })
|
|
3905
3889
|
] })
|
|
3906
3890
|
] }) });
|
|
3907
3891
|
}
|
|
3908
|
-
function
|
|
3892
|
+
function ar() {
|
|
3909
3893
|
return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Se, { defaultValue: ["item-2"], type: "multiple", children: [
|
|
3910
|
-
/* @__PURE__ */ e.jsxs(
|
|
3894
|
+
/* @__PURE__ */ e.jsxs(V, { value: "item-1", children: [
|
|
3911
3895
|
/* @__PURE__ */ e.jsx(R, { children: "Stacked Chart" }),
|
|
3912
3896
|
/* @__PURE__ */ e.jsxs(_, { className: "space-y-4 font-mono text-xs", children: [
|
|
3913
3897
|
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT x-axis, stack-by, y-axis FROM table" }),
|
|
@@ -3932,24 +3916,24 @@ function al() {
|
|
|
3932
3916
|
] })
|
|
3933
3917
|
] })
|
|
3934
3918
|
] }),
|
|
3935
|
-
/* @__PURE__ */ e.jsxs(
|
|
3919
|
+
/* @__PURE__ */ e.jsxs(V, { value: "item-2", children: [
|
|
3936
3920
|
/* @__PURE__ */ e.jsx(R, { children: "Settings" }),
|
|
3937
3921
|
/* @__PURE__ */ e.jsxs(_, { className: "space-y-4 px-2", children: [
|
|
3938
|
-
/* @__PURE__ */ e.jsx(
|
|
3922
|
+
/* @__PURE__ */ e.jsx(Fs, {}),
|
|
3939
3923
|
/* @__PURE__ */ e.jsx(za, {})
|
|
3940
3924
|
] })
|
|
3941
3925
|
] }),
|
|
3942
|
-
/* @__PURE__ */ e.jsxs(
|
|
3926
|
+
/* @__PURE__ */ e.jsxs(V, { value: "item-3", children: [
|
|
3943
3927
|
/* @__PURE__ */ e.jsx(R, { children: "Filter on click" }),
|
|
3944
3928
|
/* @__PURE__ */ e.jsx(_, { className: "px-2", children: /* @__PURE__ */ e.jsx(De, {}) })
|
|
3945
3929
|
] })
|
|
3946
3930
|
] }) });
|
|
3947
3931
|
}
|
|
3948
|
-
function
|
|
3949
|
-
const s =
|
|
3950
|
-
var
|
|
3951
|
-
return (
|
|
3952
|
-
}), n =
|
|
3932
|
+
function tr({}) {
|
|
3933
|
+
const s = i((t) => {
|
|
3934
|
+
var o;
|
|
3935
|
+
return (o = t.card) == null ? void 0 : o.preferences;
|
|
3936
|
+
}), n = i(
|
|
3953
3937
|
(t) => t.actions.setCardPreferences
|
|
3954
3938
|
), a = (t) => {
|
|
3955
3939
|
n({
|
|
@@ -3958,12 +3942,12 @@ function tl({}) {
|
|
|
3958
3942
|
});
|
|
3959
3943
|
};
|
|
3960
3944
|
return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 px-6 py-2", children: [
|
|
3961
|
-
/* @__PURE__ */ e.jsx(Se, { defaultValue: ["item-3"], type: "multiple", children: /* @__PURE__ */ e.jsxs(
|
|
3945
|
+
/* @__PURE__ */ e.jsx(Se, { defaultValue: ["item-3"], type: "multiple", children: /* @__PURE__ */ e.jsxs(V, { value: "item-3", children: [
|
|
3962
3946
|
/* @__PURE__ */ e.jsx(R, { children: "Filter on click" }),
|
|
3963
3947
|
/* @__PURE__ */ e.jsx(_, { className: "px-2", children: /* @__PURE__ */ e.jsx(De, {}) })
|
|
3964
3948
|
] }) }),
|
|
3965
3949
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
3966
|
-
/* @__PURE__ */ e.jsx(
|
|
3950
|
+
/* @__PURE__ */ e.jsx(Pe, { onCheckedChange: a, id: "allow-download" }),
|
|
3967
3951
|
/* @__PURE__ */ e.jsx(
|
|
3968
3952
|
"label",
|
|
3969
3953
|
{
|
|
@@ -3975,7 +3959,7 @@ function tl({}) {
|
|
|
3975
3959
|
] })
|
|
3976
3960
|
] });
|
|
3977
3961
|
}
|
|
3978
|
-
const
|
|
3962
|
+
const nr = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
|
|
3979
3963
|
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT dimension, cohort, metric FROM table" }),
|
|
3980
3964
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
3981
3965
|
"See ",
|
|
@@ -3991,7 +3975,7 @@ const nl = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-
|
|
|
3991
3975
|
),
|
|
3992
3976
|
" in the docs."
|
|
3993
3977
|
] })
|
|
3994
|
-
] }),
|
|
3978
|
+
] }), rr = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
|
|
3995
3979
|
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT y-axis, label, range-from, range-to, range-value FROM table" }),
|
|
3996
3980
|
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
3997
3981
|
"See ",
|
|
@@ -4008,21 +3992,21 @@ const nl = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-
|
|
|
4008
3992
|
" in the docs."
|
|
4009
3993
|
] })
|
|
4010
3994
|
] });
|
|
4011
|
-
function
|
|
4012
|
-
const s =
|
|
3995
|
+
function lr() {
|
|
3996
|
+
const s = i((a) => a.card.type);
|
|
4013
3997
|
function n(a) {
|
|
4014
3998
|
switch (a) {
|
|
4015
3999
|
case "stackedBar":
|
|
4016
|
-
return /* @__PURE__ */ e.jsx(
|
|
4000
|
+
return /* @__PURE__ */ e.jsx(ar, {});
|
|
4017
4001
|
case "pyramid":
|
|
4018
|
-
return /* @__PURE__ */ e.jsx(os, { docContent:
|
|
4002
|
+
return /* @__PURE__ */ e.jsx(os, { docContent: nr, cardType: a });
|
|
4019
4003
|
case "kpi":
|
|
4020
|
-
return /* @__PURE__ */ e.jsx(
|
|
4004
|
+
return /* @__PURE__ */ e.jsx(sr, {});
|
|
4021
4005
|
case "line":
|
|
4022
4006
|
case "bar":
|
|
4023
4007
|
return /* @__PURE__ */ e.jsx(Jn, { cardType: a });
|
|
4024
4008
|
case "range":
|
|
4025
|
-
return /* @__PURE__ */ e.jsx(os, { docContent:
|
|
4009
|
+
return /* @__PURE__ */ e.jsx(os, { docContent: rr, cardType: a });
|
|
4026
4010
|
case "pie":
|
|
4027
4011
|
case "doughnut":
|
|
4028
4012
|
case "polarArea":
|
|
@@ -4032,17 +4016,17 @@ function rl() {
|
|
|
4032
4016
|
case "scatter":
|
|
4033
4017
|
return /* @__PURE__ */ e.jsx(Qn, { cardType: a });
|
|
4034
4018
|
case "table":
|
|
4035
|
-
return /* @__PURE__ */ e.jsx(
|
|
4019
|
+
return /* @__PURE__ */ e.jsx(tr, { cardType: a });
|
|
4036
4020
|
default:
|
|
4037
4021
|
return /* @__PURE__ */ e.jsx(Xn, {});
|
|
4038
4022
|
}
|
|
4039
4023
|
}
|
|
4040
|
-
return /* @__PURE__ */ e.jsx(
|
|
4024
|
+
return /* @__PURE__ */ e.jsx(Cs, { className: "h-full w-full text-sm", children: n(s) });
|
|
4041
4025
|
}
|
|
4042
|
-
function
|
|
4043
|
-
const s =
|
|
4026
|
+
function ir() {
|
|
4027
|
+
const s = i((n) => n.isShowingVisual);
|
|
4044
4028
|
return /* @__PURE__ */ e.jsxs(
|
|
4045
|
-
|
|
4029
|
+
ms,
|
|
4046
4030
|
{
|
|
4047
4031
|
direction: "vertical",
|
|
4048
4032
|
className: "min-w-full max-w-lg min-h-[250px]",
|
|
@@ -4054,10 +4038,10 @@ function il() {
|
|
|
4054
4038
|
className: "flex",
|
|
4055
4039
|
minSize: 20,
|
|
4056
4040
|
defaultSize: 40,
|
|
4057
|
-
children: /* @__PURE__ */ e.jsx(
|
|
4041
|
+
children: /* @__PURE__ */ e.jsx(Vn, {})
|
|
4058
4042
|
}
|
|
4059
4043
|
),
|
|
4060
|
-
/* @__PURE__ */ e.jsx(
|
|
4044
|
+
/* @__PURE__ */ e.jsx(us, { withHandle: !0, className: "border " }),
|
|
4061
4045
|
/* @__PURE__ */ e.jsx(
|
|
4062
4046
|
Fe,
|
|
4063
4047
|
{
|
|
@@ -4065,7 +4049,7 @@ function il() {
|
|
|
4065
4049
|
role: "visual-section",
|
|
4066
4050
|
minSize: 0,
|
|
4067
4051
|
defaultSize: 60,
|
|
4068
|
-
children: s ? /* @__PURE__ */ e.jsxs(
|
|
4052
|
+
children: s ? /* @__PURE__ */ e.jsxs(ms, { direction: "horizontal", children: [
|
|
4069
4053
|
/* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
|
|
4070
4054
|
Fe,
|
|
4071
4055
|
{
|
|
@@ -4073,10 +4057,10 @@ function il() {
|
|
|
4073
4057
|
minSize: 20,
|
|
4074
4058
|
defaultSize: 25,
|
|
4075
4059
|
maxSize: 30,
|
|
4076
|
-
children: /* @__PURE__ */ e.jsx(
|
|
4060
|
+
children: /* @__PURE__ */ e.jsx(lr, {})
|
|
4077
4061
|
}
|
|
4078
4062
|
) }),
|
|
4079
|
-
/* @__PURE__ */ e.jsx(
|
|
4063
|
+
/* @__PURE__ */ e.jsx(us, { className: "border " }),
|
|
4080
4064
|
/* @__PURE__ */ e.jsx(Fe, { minSize: 40, defaultSize: 75, maxSize: 100, children: /* @__PURE__ */ e.jsx($s, {}) })
|
|
4081
4065
|
] }) : /* @__PURE__ */ e.jsx($s, {})
|
|
4082
4066
|
}
|
|
@@ -4085,64 +4069,64 @@ function il() {
|
|
|
4085
4069
|
}
|
|
4086
4070
|
);
|
|
4087
4071
|
}
|
|
4088
|
-
function
|
|
4089
|
-
const t =
|
|
4090
|
-
return
|
|
4091
|
-
n && t(n), a &&
|
|
4092
|
-
}, [n, t, a,
|
|
4093
|
-
s && s.accessToken &&
|
|
4094
|
-
}, [s,
|
|
4095
|
-
/* @__PURE__ */ e.jsx(
|
|
4096
|
-
/* @__PURE__ */ e.jsx(Rt, { children: /* @__PURE__ */ e.jsx(
|
|
4072
|
+
function or({ authToken: s, onSave: n, onClose: a }) {
|
|
4073
|
+
const t = i((r) => r.actions.setOnSave), o = i((r) => r.actions.setOnClose), c = k((r) => r.actions.setAuthToken);
|
|
4074
|
+
return P(() => {
|
|
4075
|
+
n && t(n), a && o(a);
|
|
4076
|
+
}, [n, t, a, o]), P(() => {
|
|
4077
|
+
s && s.accessToken && c(s);
|
|
4078
|
+
}, [s, c]), /* @__PURE__ */ e.jsxs(qt, { className: "rounded-none", role: "editor-panel", children: [
|
|
4079
|
+
/* @__PURE__ */ e.jsx(Vt, { className: "rounded-none border-r-[1.5px]", children: /* @__PURE__ */ e.jsx(pa, {}) }),
|
|
4080
|
+
/* @__PURE__ */ e.jsx(Rt, { children: /* @__PURE__ */ e.jsx(ir, {}) })
|
|
4097
4081
|
] });
|
|
4098
4082
|
}
|
|
4099
|
-
function
|
|
4100
|
-
k((
|
|
4101
|
-
const s = k((
|
|
4102
|
-
function
|
|
4103
|
-
s && (t(s,
|
|
4083
|
+
function cr() {
|
|
4084
|
+
k((r) => r.selectedCardId);
|
|
4085
|
+
const s = k((r) => r.selectedSheetId), { setIsVisualEditing: n } = k((r) => r.actions), a = k((r) => r.isVisualEditing), t = k((r) => r.actions.updateFrame);
|
|
4086
|
+
function o(r) {
|
|
4087
|
+
s && (t(s, r), n(!1));
|
|
4104
4088
|
}
|
|
4105
|
-
function
|
|
4089
|
+
function c() {
|
|
4106
4090
|
n(!1);
|
|
4107
4091
|
}
|
|
4108
4092
|
return /* @__PURE__ */ e.jsx(
|
|
4109
4093
|
"div",
|
|
4110
4094
|
{
|
|
4111
4095
|
role: "editor-container",
|
|
4112
|
-
className:
|
|
4096
|
+
className: Y("flex grow", {
|
|
4113
4097
|
block: a,
|
|
4114
4098
|
hidden: !a
|
|
4115
4099
|
}),
|
|
4116
|
-
children: /* @__PURE__ */ e.jsx(
|
|
4100
|
+
children: /* @__PURE__ */ e.jsx(or, { onSave: o, onClose: c })
|
|
4117
4101
|
}
|
|
4118
4102
|
);
|
|
4119
4103
|
}
|
|
4120
|
-
function
|
|
4104
|
+
function dr({
|
|
4121
4105
|
columns: s,
|
|
4122
4106
|
tableName: n
|
|
4123
4107
|
}) {
|
|
4124
|
-
const a =
|
|
4108
|
+
const a = i((u) => u.selectedConnectionId), t = i((u) => u.selectedDatabaseName), o = i((u) => u.selectedSchemaName), c = i((u) => u.selectedTableName), r = k((u) => u.dashboard.filters) || [], l = k((u) => u.actions.addFilter), d = k((u) => u.actions.removeFilter), f = k(
|
|
4125
4109
|
(u) => u.actions.removeFilterValue
|
|
4126
4110
|
);
|
|
4127
4111
|
function m(u) {
|
|
4128
|
-
const
|
|
4112
|
+
const S = he(u.column_name), h = he(t || ""), x = he(o || ""), g = he(n), z = ds(
|
|
4129
4113
|
x,
|
|
4130
|
-
|
|
4131
|
-
), b = `${
|
|
4114
|
+
g
|
|
4115
|
+
), b = `${z}.${S}`;
|
|
4132
4116
|
console.log(
|
|
4133
4117
|
"find",
|
|
4134
4118
|
b,
|
|
4135
|
-
|
|
4136
|
-
|
|
4119
|
+
g,
|
|
4120
|
+
h
|
|
4137
4121
|
);
|
|
4138
|
-
const L =
|
|
4139
|
-
(
|
|
4122
|
+
const L = r == null ? void 0 : r.find(
|
|
4123
|
+
(N) => N.column === b && N.table === g && (N.database === h || N.database === t)
|
|
4140
4124
|
);
|
|
4141
4125
|
if (L)
|
|
4142
|
-
|
|
4126
|
+
f(L.id), d(L.id);
|
|
4143
4127
|
else {
|
|
4144
4128
|
if (n === "api" && a) {
|
|
4145
|
-
|
|
4129
|
+
l({
|
|
4146
4130
|
id: We(),
|
|
4147
4131
|
column: b,
|
|
4148
4132
|
title: u.column_name,
|
|
@@ -4154,43 +4138,43 @@ function dl({
|
|
|
4154
4138
|
operation: "in",
|
|
4155
4139
|
sql: _s(
|
|
4156
4140
|
u.data_type,
|
|
4157
|
-
|
|
4158
|
-
|
|
4141
|
+
z,
|
|
4142
|
+
S
|
|
4159
4143
|
)
|
|
4160
4144
|
//DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
|
|
4161
4145
|
});
|
|
4162
4146
|
return;
|
|
4163
4147
|
}
|
|
4164
|
-
|
|
4148
|
+
l({
|
|
4165
4149
|
id: We(),
|
|
4166
|
-
column: `${
|
|
4150
|
+
column: `${z}.${S}`,
|
|
4167
4151
|
title: u.column_name,
|
|
4168
4152
|
dataType: u.data_type,
|
|
4169
|
-
table:
|
|
4153
|
+
table: c || "",
|
|
4170
4154
|
database: t || "",
|
|
4171
4155
|
connectionId: a || "",
|
|
4172
4156
|
operation: "in",
|
|
4173
4157
|
sql: _s(
|
|
4174
4158
|
u.data_type,
|
|
4175
|
-
|
|
4176
|
-
|
|
4159
|
+
z,
|
|
4160
|
+
S
|
|
4177
4161
|
)
|
|
4178
4162
|
//DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
|
|
4179
4163
|
});
|
|
4180
4164
|
}
|
|
4181
4165
|
}
|
|
4182
4166
|
return /* @__PURE__ */ e.jsx("div", { className: "xbg-red-100 flex-1 basis-0 flex-col overflow-scroll px-3", children: s == null ? void 0 : s.map((u) => {
|
|
4183
|
-
const
|
|
4184
|
-
(
|
|
4167
|
+
const S = r == null ? void 0 : r.find(
|
|
4168
|
+
(h) => h.column === he(u.column_name) && h.table === c && h.database === t
|
|
4185
4169
|
);
|
|
4186
4170
|
return /* @__PURE__ */ e.jsx(
|
|
4187
4171
|
"div",
|
|
4188
4172
|
{
|
|
4189
4173
|
onClick: () => m(u),
|
|
4190
|
-
className:
|
|
4174
|
+
className: Y(
|
|
4191
4175
|
"group flex cursor-pointer items-center justify-between border border-dashed border-background px-3 py-[6px] text-sm transition-colors hover:bg-muted/50",
|
|
4192
4176
|
{
|
|
4193
|
-
"bg-muted":
|
|
4177
|
+
"bg-muted": S
|
|
4194
4178
|
}
|
|
4195
4179
|
),
|
|
4196
4180
|
children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -4202,7 +4186,7 @@ function dl({
|
|
|
4202
4186
|
);
|
|
4203
4187
|
}) });
|
|
4204
4188
|
}
|
|
4205
|
-
function
|
|
4189
|
+
function hr() {
|
|
4206
4190
|
k((n) => n.showFilters);
|
|
4207
4191
|
const s = k(
|
|
4208
4192
|
(n) => n.actions.setShowFilters
|
|
@@ -4211,7 +4195,7 @@ function hl() {
|
|
|
4211
4195
|
/* @__PURE__ */ e.jsxs("div", { className: "mt-4 flex items-center justify-between gap-2 px-3", children: [
|
|
4212
4196
|
/* @__PURE__ */ e.jsx(B, { className: "text-lg", children: "Filters" }),
|
|
4213
4197
|
/* @__PURE__ */ e.jsx(
|
|
4214
|
-
|
|
4198
|
+
w,
|
|
4215
4199
|
{
|
|
4216
4200
|
onClick: () => s(!1),
|
|
4217
4201
|
className: "h-7 w-7 p-0",
|
|
@@ -4224,7 +4208,7 @@ function hl() {
|
|
|
4224
4208
|
pa,
|
|
4225
4209
|
{
|
|
4226
4210
|
ColumnsComponent: (n, a, t) => /* @__PURE__ */ e.jsx(
|
|
4227
|
-
|
|
4211
|
+
dr,
|
|
4228
4212
|
{
|
|
4229
4213
|
schemaName: n,
|
|
4230
4214
|
tableName: a,
|
|
@@ -4235,25 +4219,25 @@ function hl() {
|
|
|
4235
4219
|
) })
|
|
4236
4220
|
] });
|
|
4237
4221
|
}
|
|
4238
|
-
function
|
|
4222
|
+
function mr() {
|
|
4239
4223
|
k((a) => a.dashboard);
|
|
4240
4224
|
const s = k((a) => a.showFilters), n = k((a) => a.isVisualEditing);
|
|
4241
4225
|
return k((a) => a.bookmarkKey), /* @__PURE__ */ e.jsxs(
|
|
4242
4226
|
"div",
|
|
4243
4227
|
{
|
|
4244
4228
|
role: "dashboard-plus-main",
|
|
4245
|
-
className:
|
|
4229
|
+
className: Y("grow", {
|
|
4246
4230
|
hidden: n,
|
|
4247
4231
|
flex: !n
|
|
4248
4232
|
}),
|
|
4249
4233
|
children: [
|
|
4250
4234
|
/* @__PURE__ */ e.jsx(_t, {}),
|
|
4251
|
-
s && /* @__PURE__ */ e.jsx("div", { role: "filter-aside-container", className: "flex", children: /* @__PURE__ */ e.jsx(
|
|
4235
|
+
s && /* @__PURE__ */ e.jsx("div", { role: "filter-aside-container", className: "flex", children: /* @__PURE__ */ e.jsx(hr, {}) })
|
|
4252
4236
|
]
|
|
4253
4237
|
}
|
|
4254
4238
|
);
|
|
4255
4239
|
}
|
|
4256
|
-
function
|
|
4240
|
+
function ur() {
|
|
4257
4241
|
const s = k((t) => t.dashboard), n = k((t) => t.actions.setDashboard), a = k(
|
|
4258
4242
|
(t) => t.showDashboardJSON
|
|
4259
4243
|
);
|
|
@@ -4262,7 +4246,7 @@ function ul() {
|
|
|
4262
4246
|
), /* @__PURE__ */ e.jsx(
|
|
4263
4247
|
"div",
|
|
4264
4248
|
{
|
|
4265
|
-
className:
|
|
4249
|
+
className: Y(" p-2", {
|
|
4266
4250
|
hidden: !a
|
|
4267
4251
|
}),
|
|
4268
4252
|
children: /* @__PURE__ */ e.jsx(
|
|
@@ -4297,25 +4281,25 @@ function ul() {
|
|
|
4297
4281
|
}
|
|
4298
4282
|
);
|
|
4299
4283
|
}
|
|
4300
|
-
function
|
|
4284
|
+
function fr({
|
|
4301
4285
|
showControls: s = !1,
|
|
4302
4286
|
showFooter: n = !0,
|
|
4303
4287
|
...a
|
|
4304
4288
|
}) {
|
|
4305
4289
|
return /* @__PURE__ */ e.jsxs(Bt, { dashboardProps: a, children: [
|
|
4306
4290
|
/* @__PURE__ */ e.jsx($t, {}),
|
|
4307
|
-
/* @__PURE__ */ e.jsxs(
|
|
4308
|
-
/* @__PURE__ */ e.jsx(
|
|
4309
|
-
/* @__PURE__ */ e.jsxs(
|
|
4291
|
+
/* @__PURE__ */ e.jsxs(Pt, { children: [
|
|
4292
|
+
/* @__PURE__ */ e.jsx(ur, {}),
|
|
4293
|
+
/* @__PURE__ */ e.jsxs(Kt, { ...a, children: [
|
|
4310
4294
|
s && /* @__PURE__ */ e.jsx(vn, {}),
|
|
4311
|
-
/* @__PURE__ */ e.jsx(
|
|
4312
|
-
/* @__PURE__ */ e.jsx(
|
|
4295
|
+
/* @__PURE__ */ e.jsx(cr, {}),
|
|
4296
|
+
/* @__PURE__ */ e.jsx(mr, {})
|
|
4313
4297
|
] })
|
|
4314
4298
|
] })
|
|
4315
4299
|
] });
|
|
4316
4300
|
}
|
|
4317
4301
|
export {
|
|
4318
|
-
|
|
4302
|
+
fr as D,
|
|
4319
4303
|
Qe as S,
|
|
4320
4304
|
xa as u
|
|
4321
4305
|
};
|