semaphor 0.0.64 → 0.0.66
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-5at88oIA.js +245 -0
- package/dist/chunks/dashboard-plus-FX4aBajk.js +5309 -0
- package/dist/chunks/index-RiPhpkfr.js +448 -0
- package/dist/chunks/{index-iGlNQo-C.js → index-wsauSY2B.js} +9937 -9725
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/dashboard.d.ts +20 -0
- package/dist/types/main.d.ts +143 -1
- package/dist/types/surfboard.d.ts +20 -0
- package/dist/types/types.d.ts +20 -0
- package/package.json +2 -2
- package/dist/chunks/dashboard-plus-ZKVo8Fde.js +0 -220
- package/dist/chunks/dashboard-plus-r2bMLEpF.js +0 -4790
- package/dist/chunks/index-4xK4D4qH.js +0 -448
|
@@ -1,4790 +0,0 @@
|
|
|
1
|
-
import { J as D, L as Pe, b as w, c as bs, u as je, j as e, M as ys, O as vs, P as z, Q as Ns, R as Cs, U as Ss, V as ws, W as ks, X as $, Y as de, Z as st, _ as Rt, $ as Ht, a0 as $t, a1 as Pt, a2 as Bt, a3 as Gt, a4 as $s, f as Z, a5 as Ve, a6 as Ut, a7 as tt, a8 as Ze, a9 as Xe, T as zs, e as at, g as Fs, aa as ke, ab as ze, ac as Fe, ad as Le, ae as _e, af as Me, ag as te, ah as Ls, G as o, ai as Ms, aj as Os, ak as Ds, w as nt, v as rt, t as ue, al as Kt, r as Wt, N as it, s as Qt, am as Jt, B as Yt, an as lt, ao as Zt, S as Ts, z as Xt, n as Ps, A as ot, ap as ms, aq as he, ar as ge, as as Re, at as ts, au as ct, av as ea, aw as sa, ax as dt, ay as ta, az as aa, aA as na, aB as ra, aC as ia, aD as xs, aE as la, aF as oa, aG as qe, aH as ps, aI as we, aJ as fs, aK as Bs, aL as ca, aM as da, aN as ha, aO as ua, aP as ma, aQ as us, aR as xa, aS as Gs, aT as pa, aU as Us, aV as fa, aW as ga, aX as ja, aY as ht, l as ba, C as ya, E as Qe, d as va, h as Na, aZ as Ca, i as Sa, o as wa, a_ as ka, m as za, H as as, a$ as Fa, b0 as ut, b1 as mt, b2 as Je, b3 as xt, b4 as Ye, b5 as Ks, b6 as ns, b7 as rs, b8 as is, b9 as pt, K as La, ba as Ma, bb as Oa, bc as As, bd as Oe, be as ft, bf as Da, bg as Ta, bh as Aa, bi as Ia, bj as Ea, bk as Ws, bl as qa, bm as Va, bn as _a, bo as Ra, bp as Ha, bq as $a, br as Pa, bs as Ba, bt as Ne, bu as B, bv as G, bw as Is, bx as U, by as Qs, bz as Ga, bA as Ua, bB as Ka, bC as Wa, bD as Qa, bE as Ja, bF as Ya, bG as Za, bH as Xa, bI as en } from "./index-iGlNQo-C.js";
|
|
2
|
-
import * as Js from "react";
|
|
3
|
-
import me, { useState as T, useMemo as gs, useEffect as Y, useRef as He } from "react";
|
|
4
|
-
/**
|
|
5
|
-
* @license lucide-react v0.379.0 - ISC
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the ISC license.
|
|
8
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/
|
|
10
|
-
const sn = D("AreaChart", [
|
|
11
|
-
["path", { d: "M3 3v18h18", key: "1s2lah" }],
|
|
12
|
-
["path", { d: "M7 12v5h12V8l-5 5-4-4Z", key: "zxz28u" }]
|
|
13
|
-
]);
|
|
14
|
-
/**
|
|
15
|
-
* @license lucide-react v0.379.0 - ISC
|
|
16
|
-
*
|
|
17
|
-
* This source code is licensed under the ISC license.
|
|
18
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/
|
|
20
|
-
const Es = D("BarChart4", [
|
|
21
|
-
["path", { d: "M3 3v18h18", key: "1s2lah" }],
|
|
22
|
-
["path", { d: "M13 17V9", key: "1fwyjl" }],
|
|
23
|
-
["path", { d: "M18 17V5", key: "sfb6ij" }],
|
|
24
|
-
["path", { d: "M8 17v-3", key: "17ska0" }]
|
|
25
|
-
]);
|
|
26
|
-
/**
|
|
27
|
-
* @license lucide-react v0.379.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/
|
|
32
|
-
const tn = D("Box", [
|
|
33
|
-
[
|
|
34
|
-
"path",
|
|
35
|
-
{
|
|
36
|
-
d: "M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",
|
|
37
|
-
key: "hh9hay"
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
["path", { d: "m3.3 7 8.7 5 8.7-5", key: "g66t2b" }],
|
|
41
|
-
["path", { d: "M12 22V12", key: "d0xqtd" }]
|
|
42
|
-
]);
|
|
43
|
-
/**
|
|
44
|
-
* @license lucide-react v0.379.0 - ISC
|
|
45
|
-
*
|
|
46
|
-
* This source code is licensed under the ISC license.
|
|
47
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
48
|
-
*/
|
|
49
|
-
const an = D("CircleX", [
|
|
50
|
-
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
51
|
-
["path", { d: "m15 9-6 6", key: "1uzhvr" }],
|
|
52
|
-
["path", { d: "m9 9 6 6", key: "z0biqf" }]
|
|
53
|
-
]);
|
|
54
|
-
/**
|
|
55
|
-
* @license lucide-react v0.379.0 - ISC
|
|
56
|
-
*
|
|
57
|
-
* This source code is licensed under the ISC license.
|
|
58
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
59
|
-
*/
|
|
60
|
-
const nn = D("Database", [
|
|
61
|
-
["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3", key: "msslwz" }],
|
|
62
|
-
["path", { d: "M3 5V19A9 3 0 0 0 21 19V5", key: "1wlel7" }],
|
|
63
|
-
["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
|
|
64
|
-
]);
|
|
65
|
-
/**
|
|
66
|
-
* @license lucide-react v0.379.0 - ISC
|
|
67
|
-
*
|
|
68
|
-
* This source code is licensed under the ISC license.
|
|
69
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
-
*/
|
|
71
|
-
const rn = D("EllipsisVertical", [
|
|
72
|
-
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
|
73
|
-
["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
|
|
74
|
-
["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
|
|
75
|
-
]);
|
|
76
|
-
/**
|
|
77
|
-
* @license lucide-react v0.379.0 - ISC
|
|
78
|
-
*
|
|
79
|
-
* This source code is licensed under the ISC license.
|
|
80
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/
|
|
82
|
-
const ln = D("Eraser", [
|
|
83
|
-
[
|
|
84
|
-
"path",
|
|
85
|
-
{
|
|
86
|
-
d: "m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",
|
|
87
|
-
key: "182aya"
|
|
88
|
-
}
|
|
89
|
-
],
|
|
90
|
-
["path", { d: "M22 21H7", key: "t4ddhn" }],
|
|
91
|
-
["path", { d: "m5 11 9 9", key: "1mo9qw" }]
|
|
92
|
-
]);
|
|
93
|
-
/**
|
|
94
|
-
* @license lucide-react v0.379.0 - ISC
|
|
95
|
-
*
|
|
96
|
-
* This source code is licensed under the ISC license.
|
|
97
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
-
*/
|
|
99
|
-
const gt = D("GanttChart", [
|
|
100
|
-
["path", { d: "M8 6h10", key: "9lnwnk" }],
|
|
101
|
-
["path", { d: "M6 12h9", key: "1g9pqf" }],
|
|
102
|
-
["path", { d: "M11 18h7", key: "c8dzvl" }]
|
|
103
|
-
]);
|
|
104
|
-
/**
|
|
105
|
-
* @license lucide-react v0.379.0 - ISC
|
|
106
|
-
*
|
|
107
|
-
* This source code is licensed under the ISC license.
|
|
108
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
109
|
-
*/
|
|
110
|
-
const on = D("Glasses", [
|
|
111
|
-
["circle", { cx: "6", cy: "15", r: "4", key: "vux9w4" }],
|
|
112
|
-
["circle", { cx: "18", cy: "15", r: "4", key: "18o8ve" }],
|
|
113
|
-
["path", { d: "M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2", key: "1ag4bs" }],
|
|
114
|
-
["path", { d: "M2.5 13 5 7c.7-1.3 1.4-2 3-2", key: "1hm1gs" }],
|
|
115
|
-
["path", { d: "M21.5 13 19 7c-.7-1.3-1.5-2-3-2", key: "1r31ai" }]
|
|
116
|
-
]);
|
|
117
|
-
/**
|
|
118
|
-
* @license lucide-react v0.379.0 - ISC
|
|
119
|
-
*
|
|
120
|
-
* This source code is licensed under the ISC license.
|
|
121
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
122
|
-
*/
|
|
123
|
-
const cn = D("Hammer", [
|
|
124
|
-
["path", { d: "m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9", key: "eefl8a" }],
|
|
125
|
-
["path", { d: "m18 15 4-4", key: "16gjal" }],
|
|
126
|
-
[
|
|
127
|
-
"path",
|
|
128
|
-
{
|
|
129
|
-
d: "m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",
|
|
130
|
-
key: "b7pghm"
|
|
131
|
-
}
|
|
132
|
-
]
|
|
133
|
-
]);
|
|
134
|
-
/**
|
|
135
|
-
* @license lucide-react v0.379.0 - ISC
|
|
136
|
-
*
|
|
137
|
-
* This source code is licensed under the ISC license.
|
|
138
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
139
|
-
*/
|
|
140
|
-
const dn = D("Hash", [
|
|
141
|
-
["line", { x1: "4", x2: "20", y1: "9", y2: "9", key: "4lhtct" }],
|
|
142
|
-
["line", { x1: "4", x2: "20", y1: "15", y2: "15", key: "vyu0kd" }],
|
|
143
|
-
["line", { x1: "10", x2: "8", y1: "3", y2: "21", key: "1ggp8o" }],
|
|
144
|
-
["line", { x1: "16", x2: "14", y1: "3", y2: "21", key: "weycgp" }]
|
|
145
|
-
]);
|
|
146
|
-
/**
|
|
147
|
-
* @license lucide-react v0.379.0 - ISC
|
|
148
|
-
*
|
|
149
|
-
* This source code is licensed under the ISC license.
|
|
150
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
-
*/
|
|
152
|
-
const hn = D("Home", [
|
|
153
|
-
["path", { d: "m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z", key: "y5dka4" }],
|
|
154
|
-
["polyline", { points: "9 22 9 12 15 12 15 22", key: "e2us08" }]
|
|
155
|
-
]);
|
|
156
|
-
/**
|
|
157
|
-
* @license lucide-react v0.379.0 - ISC
|
|
158
|
-
*
|
|
159
|
-
* This source code is licensed under the ISC license.
|
|
160
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
-
*/
|
|
162
|
-
const un = D("Key", [
|
|
163
|
-
["path", { d: "m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4", key: "g0fldk" }],
|
|
164
|
-
["path", { d: "m21 2-9.6 9.6", key: "1j0ho8" }],
|
|
165
|
-
["circle", { cx: "7.5", cy: "15.5", r: "5.5", key: "yqb3hr" }]
|
|
166
|
-
]);
|
|
167
|
-
/**
|
|
168
|
-
* @license lucide-react v0.379.0 - ISC
|
|
169
|
-
*
|
|
170
|
-
* This source code is licensed under the ISC license.
|
|
171
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
172
|
-
*/
|
|
173
|
-
const qs = D("LineChart", [
|
|
174
|
-
["path", { d: "M3 3v18h18", key: "1s2lah" }],
|
|
175
|
-
["path", { d: "m19 9-5 5-4-4-3 3", key: "2osh9i" }]
|
|
176
|
-
]);
|
|
177
|
-
/**
|
|
178
|
-
* @license lucide-react v0.379.0 - ISC
|
|
179
|
-
*
|
|
180
|
-
* This source code is licensed under the ISC license.
|
|
181
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
182
|
-
*/
|
|
183
|
-
const mn = D("ListEnd", [
|
|
184
|
-
["path", { d: "M16 12H3", key: "1a2rj7" }],
|
|
185
|
-
["path", { d: "M16 6H3", key: "1wxfjs" }],
|
|
186
|
-
["path", { d: "M10 18H3", key: "13769t" }],
|
|
187
|
-
["path", { d: "M21 6v10a2 2 0 0 1-2 2h-5", key: "ilrcs8" }],
|
|
188
|
-
["path", { d: "m16 16-2 2 2 2", key: "kkc6pm" }]
|
|
189
|
-
]);
|
|
190
|
-
/**
|
|
191
|
-
* @license lucide-react v0.379.0 - ISC
|
|
192
|
-
*
|
|
193
|
-
* This source code is licensed under the ISC license.
|
|
194
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
-
*/
|
|
196
|
-
const xn = D("ListStart", [
|
|
197
|
-
["path", { d: "M16 12H3", key: "1a2rj7" }],
|
|
198
|
-
["path", { d: "M16 18H3", key: "12xzn7" }],
|
|
199
|
-
["path", { d: "M10 6H3", key: "lf8lx7" }],
|
|
200
|
-
["path", { d: "M21 18V8a2 2 0 0 0-2-2h-5", key: "1hghli" }],
|
|
201
|
-
["path", { d: "m16 8-2-2 2-2", key: "160uvd" }]
|
|
202
|
-
]);
|
|
203
|
-
/**
|
|
204
|
-
* @license lucide-react v0.379.0 - ISC
|
|
205
|
-
*
|
|
206
|
-
* This source code is licensed under the ISC license.
|
|
207
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
208
|
-
*/
|
|
209
|
-
const pn = D("ListX", [
|
|
210
|
-
["path", { d: "M11 12H3", key: "51ecnj" }],
|
|
211
|
-
["path", { d: "M16 6H3", key: "1wxfjs" }],
|
|
212
|
-
["path", { d: "M16 18H3", key: "12xzn7" }],
|
|
213
|
-
["path", { d: "m19 10-4 4", key: "1tz659" }],
|
|
214
|
-
["path", { d: "m15 10 4 4", key: "1n7nei" }]
|
|
215
|
-
]);
|
|
216
|
-
/**
|
|
217
|
-
* @license lucide-react v0.379.0 - ISC
|
|
218
|
-
*
|
|
219
|
-
* This source code is licensed under the ISC license.
|
|
220
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
221
|
-
*/
|
|
222
|
-
const $e = D("LoaderCircle", [
|
|
223
|
-
["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
|
|
224
|
-
]);
|
|
225
|
-
/**
|
|
226
|
-
* @license lucide-react v0.379.0 - ISC
|
|
227
|
-
*
|
|
228
|
-
* This source code is licensed under the ISC license.
|
|
229
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
-
*/
|
|
231
|
-
const fn = D("MessageSquareMore", [
|
|
232
|
-
["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" }],
|
|
233
|
-
["path", { d: "M8 10h.01", key: "19clt8" }],
|
|
234
|
-
["path", { d: "M12 10h.01", key: "1nrarc" }],
|
|
235
|
-
["path", { d: "M16 10h.01", key: "1m94wz" }]
|
|
236
|
-
]);
|
|
237
|
-
/**
|
|
238
|
-
* @license lucide-react v0.379.0 - ISC
|
|
239
|
-
*
|
|
240
|
-
* This source code is licensed under the ISC license.
|
|
241
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
242
|
-
*/
|
|
243
|
-
const gn = D("Network", [
|
|
244
|
-
["rect", { x: "16", y: "16", width: "6", height: "6", rx: "1", key: "4q2zg0" }],
|
|
245
|
-
["rect", { x: "2", y: "16", width: "6", height: "6", rx: "1", key: "8cvhb9" }],
|
|
246
|
-
["rect", { x: "9", y: "2", width: "6", height: "6", rx: "1", key: "1egb70" }],
|
|
247
|
-
["path", { d: "M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3", key: "1jsf9p" }],
|
|
248
|
-
["path", { d: "M12 12V8", key: "2874zd" }]
|
|
249
|
-
]);
|
|
250
|
-
/**
|
|
251
|
-
* @license lucide-react v0.379.0 - ISC
|
|
252
|
-
*
|
|
253
|
-
* This source code is licensed under the ISC license.
|
|
254
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
-
*/
|
|
256
|
-
const jt = D("Pencil", [
|
|
257
|
-
["path", { d: "M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z", key: "5qss01" }],
|
|
258
|
-
["path", { d: "m15 5 4 4", key: "1mk7zo" }]
|
|
259
|
-
]);
|
|
260
|
-
/**
|
|
261
|
-
* @license lucide-react v0.379.0 - ISC
|
|
262
|
-
*
|
|
263
|
-
* This source code is licensed under the ISC license.
|
|
264
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
-
*/
|
|
266
|
-
const bt = D("PieChart", [
|
|
267
|
-
["path", { d: "M21.21 15.89A10 10 0 1 1 8 2.83", key: "k2fpak" }],
|
|
268
|
-
["path", { d: "M22 12A10 10 0 0 0 12 2v10z", key: "1rfc4y" }]
|
|
269
|
-
]);
|
|
270
|
-
/**
|
|
271
|
-
* @license lucide-react v0.379.0 - ISC
|
|
272
|
-
*
|
|
273
|
-
* This source code is licensed under the ISC license.
|
|
274
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
-
*/
|
|
276
|
-
const jn = D("Play", [
|
|
277
|
-
["polygon", { points: "6 3 20 12 6 21 6 3", key: "1oa8hb" }]
|
|
278
|
-
]);
|
|
279
|
-
/**
|
|
280
|
-
* @license lucide-react v0.379.0 - ISC
|
|
281
|
-
*
|
|
282
|
-
* This source code is licensed under the ISC license.
|
|
283
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
284
|
-
*/
|
|
285
|
-
const bn = D("Plug2", [
|
|
286
|
-
["path", { d: "M9 2v6", key: "17ngun" }],
|
|
287
|
-
["path", { d: "M15 2v6", key: "s7yy2p" }],
|
|
288
|
-
["path", { d: "M12 17v5", key: "bb1du9" }],
|
|
289
|
-
["path", { d: "M5 8h14", key: "pcz4l3" }],
|
|
290
|
-
["path", { d: "M6 11V8h12v3a6 6 0 1 1-12 0v0Z", key: "nd4hoy" }]
|
|
291
|
-
]);
|
|
292
|
-
/**
|
|
293
|
-
* @license lucide-react v0.379.0 - ISC
|
|
294
|
-
*
|
|
295
|
-
* This source code is licensed under the ISC license.
|
|
296
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
297
|
-
*/
|
|
298
|
-
const yn = D("Save", [
|
|
299
|
-
[
|
|
300
|
-
"path",
|
|
301
|
-
{
|
|
302
|
-
d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
|
|
303
|
-
key: "1c8476"
|
|
304
|
-
}
|
|
305
|
-
],
|
|
306
|
-
["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
|
|
307
|
-
["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
|
|
308
|
-
]);
|
|
309
|
-
/**
|
|
310
|
-
* @license lucide-react v0.379.0 - ISC
|
|
311
|
-
*
|
|
312
|
-
* This source code is licensed under the ISC license.
|
|
313
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
314
|
-
*/
|
|
315
|
-
const yt = D("ScatterChart", [
|
|
316
|
-
["circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor", key: "kqv944" }],
|
|
317
|
-
["circle", { cx: "18.5", cy: "5.5", r: ".5", fill: "currentColor", key: "lysivs" }],
|
|
318
|
-
["circle", { cx: "11.5", cy: "11.5", r: ".5", fill: "currentColor", key: "byv1b8" }],
|
|
319
|
-
["circle", { cx: "7.5", cy: "16.5", r: ".5", fill: "currentColor", key: "nkw3mc" }],
|
|
320
|
-
["circle", { cx: "17.5", cy: "14.5", r: ".5", fill: "currentColor", key: "1gjh6j" }],
|
|
321
|
-
["path", { d: "M3 3v18h18", key: "1s2lah" }]
|
|
322
|
-
]);
|
|
323
|
-
/**
|
|
324
|
-
* @license lucide-react v0.379.0 - ISC
|
|
325
|
-
*
|
|
326
|
-
* This source code is licensed under the ISC license.
|
|
327
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
328
|
-
*/
|
|
329
|
-
const vn = D("ShieldQuestion", [
|
|
330
|
-
[
|
|
331
|
-
"path",
|
|
332
|
-
{
|
|
333
|
-
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
|
334
|
-
key: "oel41y"
|
|
335
|
-
}
|
|
336
|
-
],
|
|
337
|
-
["path", { d: "M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3", key: "mhlwft" }],
|
|
338
|
-
["path", { d: "M12 17h.01", key: "p32p05" }]
|
|
339
|
-
]);
|
|
340
|
-
/**
|
|
341
|
-
* @license lucide-react v0.379.0 - ISC
|
|
342
|
-
*
|
|
343
|
-
* This source code is licensed under the ISC license.
|
|
344
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
345
|
-
*/
|
|
346
|
-
const Nn = D("Sigma", [
|
|
347
|
-
["path", { d: "M18 7V4H6l6 8-6 8h12v-3", key: "zis8ev" }]
|
|
348
|
-
]);
|
|
349
|
-
/**
|
|
350
|
-
* @license lucide-react v0.379.0 - ISC
|
|
351
|
-
*
|
|
352
|
-
* This source code is licensed under the ISC license.
|
|
353
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
354
|
-
*/
|
|
355
|
-
const Cn = D("SwatchBook", [
|
|
356
|
-
["path", { d: "M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z", key: "1ldrpk" }],
|
|
357
|
-
["path", { d: "M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7", key: "11i5po" }],
|
|
358
|
-
["path", { d: "M 7 17h0.01", key: "10821z" }],
|
|
359
|
-
[
|
|
360
|
-
"path",
|
|
361
|
-
{
|
|
362
|
-
d: "m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8",
|
|
363
|
-
key: "o2gii7"
|
|
364
|
-
}
|
|
365
|
-
]
|
|
366
|
-
]);
|
|
367
|
-
/**
|
|
368
|
-
* @license lucide-react v0.379.0 - ISC
|
|
369
|
-
*
|
|
370
|
-
* This source code is licensed under the ISC license.
|
|
371
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
372
|
-
*/
|
|
373
|
-
const Sn = D("Tag", [
|
|
374
|
-
[
|
|
375
|
-
"path",
|
|
376
|
-
{
|
|
377
|
-
d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",
|
|
378
|
-
key: "vktsd0"
|
|
379
|
-
}
|
|
380
|
-
],
|
|
381
|
-
["circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor", key: "kqv944" }]
|
|
382
|
-
]);
|
|
383
|
-
/**
|
|
384
|
-
* @license lucide-react v0.379.0 - ISC
|
|
385
|
-
*
|
|
386
|
-
* This source code is licensed under the ISC license.
|
|
387
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
388
|
-
*/
|
|
389
|
-
const wn = D("ToggleLeft", [
|
|
390
|
-
["rect", { width: "20", height: "12", x: "2", y: "6", rx: "6", ry: "6", key: "f2vt7d" }],
|
|
391
|
-
["circle", { cx: "8", cy: "12", r: "2", key: "1nvbw3" }]
|
|
392
|
-
]);
|
|
393
|
-
/**
|
|
394
|
-
* @license lucide-react v0.379.0 - ISC
|
|
395
|
-
*
|
|
396
|
-
* This source code is licensed under the ISC license.
|
|
397
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
398
|
-
*/
|
|
399
|
-
const Vs = D("Type", [
|
|
400
|
-
["polyline", { points: "4 7 4 4 20 4 20 7", key: "1nosan" }],
|
|
401
|
-
["line", { x1: "9", x2: "15", y1: "20", y2: "20", key: "swin9y" }],
|
|
402
|
-
["line", { x1: "12", x2: "12", y1: "4", y2: "20", key: "1tx1rr" }]
|
|
403
|
-
]);
|
|
404
|
-
/**
|
|
405
|
-
* @license lucide-react v0.379.0 - ISC
|
|
406
|
-
*
|
|
407
|
-
* This source code is licensed under the ISC license.
|
|
408
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
409
|
-
*/
|
|
410
|
-
const kn = D("User", [
|
|
411
|
-
["path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2", key: "975kel" }],
|
|
412
|
-
["circle", { cx: "12", cy: "7", r: "4", key: "17ys0d" }]
|
|
413
|
-
]);
|
|
414
|
-
function vt(s) {
|
|
415
|
-
var n;
|
|
416
|
-
return {
|
|
417
|
-
...s,
|
|
418
|
-
sheets: (n = s == null ? void 0 : s.sheets) == null ? void 0 : n.map((t) => {
|
|
419
|
-
var a;
|
|
420
|
-
return {
|
|
421
|
-
...t,
|
|
422
|
-
frames: (a = t.frames) == null ? void 0 : a.map((i) => {
|
|
423
|
-
var h;
|
|
424
|
-
return {
|
|
425
|
-
...i,
|
|
426
|
-
cards: (h = i.cards) == null ? void 0 : h.map((r) => zn(r))
|
|
427
|
-
};
|
|
428
|
-
})
|
|
429
|
-
};
|
|
430
|
-
})
|
|
431
|
-
};
|
|
432
|
-
}
|
|
433
|
-
function zn(s) {
|
|
434
|
-
var n, t, a, i;
|
|
435
|
-
return {
|
|
436
|
-
...s,
|
|
437
|
-
cfg: {
|
|
438
|
-
...s.cfg,
|
|
439
|
-
data: {
|
|
440
|
-
...(n = s.cfg) == null ? void 0 : n.data,
|
|
441
|
-
labels: [],
|
|
442
|
-
datasets: (i = (a = (t = s.cfg) == null ? void 0 : t.data) == null ? void 0 : a.datasets) == null ? void 0 : i.map((h) => ({
|
|
443
|
-
...h,
|
|
444
|
-
data: []
|
|
445
|
-
}))
|
|
446
|
-
}
|
|
447
|
-
},
|
|
448
|
-
customCfg: Fn(s.customCfg),
|
|
449
|
-
// if customCfg is present, clean it, otherwise return null{
|
|
450
|
-
data: []
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
function Fn(s) {
|
|
454
|
-
var n, t;
|
|
455
|
-
return s ? {
|
|
456
|
-
...s,
|
|
457
|
-
data: {
|
|
458
|
-
...s == null ? void 0 : s.data,
|
|
459
|
-
labels: [],
|
|
460
|
-
datasets: (t = (n = s == null ? void 0 : s.data) == null ? void 0 : n.datasets) == null ? void 0 : t.map((a) => ({
|
|
461
|
-
...a,
|
|
462
|
-
data: []
|
|
463
|
-
}))
|
|
464
|
-
}
|
|
465
|
-
} : null;
|
|
466
|
-
}
|
|
467
|
-
async function Ln(s, n, t, a) {
|
|
468
|
-
if (!a)
|
|
469
|
-
return null;
|
|
470
|
-
const i = JSON.stringify(n);
|
|
471
|
-
return await Pe("https://semaphor.cloud/api/v1/lens", a, {
|
|
472
|
-
name: s,
|
|
473
|
-
template: i,
|
|
474
|
-
filterValues: t,
|
|
475
|
-
operation: "create"
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
async function js(s, n) {
|
|
479
|
-
if (!n)
|
|
480
|
-
return null;
|
|
481
|
-
const { id: t, template: a, filterValues: i, isDefault: h, shared: r } = s;
|
|
482
|
-
return await Pe("https://semaphor.cloud/api/v1/lens", n, {
|
|
483
|
-
lensId: t,
|
|
484
|
-
template: a,
|
|
485
|
-
filterValues: i,
|
|
486
|
-
isDefault: h,
|
|
487
|
-
shared: r,
|
|
488
|
-
operation: "update"
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
async function Mn(s, n) {
|
|
492
|
-
return n ? await Pe("https://semaphor.cloud/api/v1/lens", n, {
|
|
493
|
-
operation: "delete",
|
|
494
|
-
lensId: s
|
|
495
|
-
}) : null;
|
|
496
|
-
}
|
|
497
|
-
function On() {
|
|
498
|
-
const [s, n] = T(""), [t, a] = T(!1), i = w((v) => v.lenses), { setLenses: h, setSelectedLensId: r } = bs(), [l, c] = T(!1), [m, u] = T(!1), g = w((v) => v.dashboard), j = w((v) => v.filterValues), { authToken: d } = je();
|
|
499
|
-
async function x() {
|
|
500
|
-
c(!0);
|
|
501
|
-
const v = vt(
|
|
502
|
-
g
|
|
503
|
-
), f = await Ln(
|
|
504
|
-
s,
|
|
505
|
-
v,
|
|
506
|
-
j,
|
|
507
|
-
d == null ? void 0 : d.accessToken
|
|
508
|
-
);
|
|
509
|
-
f && (h([...i || [], f]), r(f.id), u(!1)), c(!1);
|
|
510
|
-
}
|
|
511
|
-
return /* @__PURE__ */ e.jsxs(ys, { open: m, onOpenChange: u, children: [
|
|
512
|
-
/* @__PURE__ */ e.jsx(vs, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
513
|
-
z,
|
|
514
|
-
{
|
|
515
|
-
variant: "secondary",
|
|
516
|
-
className: "h-7 p-2",
|
|
517
|
-
size: "sm",
|
|
518
|
-
children: [
|
|
519
|
-
/* @__PURE__ */ e.jsx(Ns, { className: "mr-2 h-4 w-4", strokeWidth: 1.5 }),
|
|
520
|
-
"Lens"
|
|
521
|
-
]
|
|
522
|
-
}
|
|
523
|
-
) }),
|
|
524
|
-
/* @__PURE__ */ e.jsxs(Cs, { className: "sm:max-w-[425px]", children: [
|
|
525
|
-
/* @__PURE__ */ e.jsxs(Ss, { children: [
|
|
526
|
-
/* @__PURE__ */ e.jsx(ws, { children: "Create Lens" }),
|
|
527
|
-
/* @__PURE__ */ e.jsx(ks, { children: "Lenses are private by default and are only visible to you." })
|
|
528
|
-
] }),
|
|
529
|
-
/* @__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: [
|
|
530
|
-
/* @__PURE__ */ e.jsx($, { className: "text-right", children: "Name" }),
|
|
531
|
-
/* @__PURE__ */ e.jsx(
|
|
532
|
-
de,
|
|
533
|
-
{
|
|
534
|
-
value: s,
|
|
535
|
-
onChange: (v) => {
|
|
536
|
-
n(v.target.value);
|
|
537
|
-
},
|
|
538
|
-
id: "name",
|
|
539
|
-
className: "col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
|
|
540
|
-
}
|
|
541
|
-
)
|
|
542
|
-
] }) }),
|
|
543
|
-
t && /* @__PURE__ */ e.jsx("p", { className: "text-sm", children: "The lens name already exists. Use a differnet name." }),
|
|
544
|
-
/* @__PURE__ */ e.jsx(st, { children: /* @__PURE__ */ e.jsx(
|
|
545
|
-
z,
|
|
546
|
-
{
|
|
547
|
-
size: "sm",
|
|
548
|
-
variant: "outline",
|
|
549
|
-
type: "submit",
|
|
550
|
-
onClick: x,
|
|
551
|
-
disabled: l,
|
|
552
|
-
children: l ? "Creating..." : "Add"
|
|
553
|
-
}
|
|
554
|
-
) })
|
|
555
|
-
] })
|
|
556
|
-
] });
|
|
557
|
-
}
|
|
558
|
-
function Dn() {
|
|
559
|
-
const [s, n] = T(!1), t = w((u) => u.lenses), a = w((u) => u.selectedLensId), { setLenses: i, setSelectedLensId: h } = bs(), { authToken: r } = je();
|
|
560
|
-
async function l(u) {
|
|
561
|
-
h(u);
|
|
562
|
-
}
|
|
563
|
-
async function c(u) {
|
|
564
|
-
if (await Mn(u, r == null ? void 0 : r.accessToken)) {
|
|
565
|
-
const j = t == null ? void 0 : t.filter((d) => d.id !== u);
|
|
566
|
-
i(j || []), h("original");
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
async function m(u) {
|
|
570
|
-
const g = t == null ? void 0 : t.map((x) => x.id === u.id ? {
|
|
571
|
-
...x,
|
|
572
|
-
isDefault: !u.isDefault
|
|
573
|
-
} : {
|
|
574
|
-
...x,
|
|
575
|
-
isDefault: !1
|
|
576
|
-
});
|
|
577
|
-
i(g || []);
|
|
578
|
-
const j = {
|
|
579
|
-
...u,
|
|
580
|
-
isDefault: !u.isDefault
|
|
581
|
-
};
|
|
582
|
-
await js(j, r == null ? void 0 : r.accessToken);
|
|
583
|
-
const d = t == null ? void 0 : t.find((x) => x.isDefault);
|
|
584
|
-
if (d && d.id !== u.id) {
|
|
585
|
-
const x = {
|
|
586
|
-
...d,
|
|
587
|
-
isDefault: !1
|
|
588
|
-
};
|
|
589
|
-
await js(x, r == null ? void 0 : r.accessToken);
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
return /* @__PURE__ */ e.jsxs(Rt, { open: s, onOpenChange: n, children: [
|
|
593
|
-
/* @__PURE__ */ e.jsx(Ht, { asChild: !0, children: /* @__PURE__ */ e.jsx(z, { variant: "ghost", className: "h-7 p-2", children: /* @__PURE__ */ e.jsx(on, { className: "h-4 w-4", strokeWidth: 1.5 }) }) }),
|
|
594
|
-
/* @__PURE__ */ e.jsxs($t, { align: "end", className: "w-60", children: [
|
|
595
|
-
/* @__PURE__ */ e.jsx(Pt, { className: "px-3", children: "Lenses" }),
|
|
596
|
-
/* @__PURE__ */ e.jsx(Bt, {}),
|
|
597
|
-
/* @__PURE__ */ e.jsxs(
|
|
598
|
-
Gt,
|
|
599
|
-
{
|
|
600
|
-
value: a,
|
|
601
|
-
onValueChange: l,
|
|
602
|
-
children: [
|
|
603
|
-
/* @__PURE__ */ e.jsx($s, { value: "original", children: "Original" }),
|
|
604
|
-
t == null ? void 0 : t.map((u) => /* @__PURE__ */ e.jsxs(
|
|
605
|
-
$s,
|
|
606
|
-
{
|
|
607
|
-
className: "group flex justify-between",
|
|
608
|
-
value: u.id,
|
|
609
|
-
children: [
|
|
610
|
-
/* @__PURE__ */ e.jsx("p", { children: u.name }),
|
|
611
|
-
/* @__PURE__ */ e.jsxs("span", { className: "flex items-center gap-3", children: [
|
|
612
|
-
/* @__PURE__ */ e.jsx(
|
|
613
|
-
hn,
|
|
614
|
-
{
|
|
615
|
-
onClick: (g) => {
|
|
616
|
-
g.preventDefault(), m(u);
|
|
617
|
-
},
|
|
618
|
-
className: Z(
|
|
619
|
-
"size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
|
|
620
|
-
{
|
|
621
|
-
invisible: !u.isDefault
|
|
622
|
-
}
|
|
623
|
-
),
|
|
624
|
-
strokeWidth: 1.5
|
|
625
|
-
}
|
|
626
|
-
),
|
|
627
|
-
/* @__PURE__ */ e.jsx(
|
|
628
|
-
Ve,
|
|
629
|
-
{
|
|
630
|
-
onClick: (g) => {
|
|
631
|
-
g.preventDefault(), c(u.id);
|
|
632
|
-
},
|
|
633
|
-
className: "invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
|
|
634
|
-
strokeWidth: 1.5
|
|
635
|
-
}
|
|
636
|
-
)
|
|
637
|
-
] })
|
|
638
|
-
]
|
|
639
|
-
},
|
|
640
|
-
u.id
|
|
641
|
-
))
|
|
642
|
-
]
|
|
643
|
-
}
|
|
644
|
-
)
|
|
645
|
-
] })
|
|
646
|
-
] });
|
|
647
|
-
}
|
|
648
|
-
function Tn() {
|
|
649
|
-
const { authToken: s } = je(), n = w((b) => b.lenses), t = w((b) => b.selectedLensId), a = n == null ? void 0 : n.find((b) => b.id === t), i = w((b) => b.dashboard);
|
|
650
|
-
w((b) => b.selectedSheetId);
|
|
651
|
-
const h = w(
|
|
652
|
-
(b) => b.isDashboardEditing
|
|
653
|
-
), [r, l] = T(!1), c = w((b) => b.filterValues), m = w((b) => b.isVisualEditing), u = w((b) => b.showFilters);
|
|
654
|
-
w(
|
|
655
|
-
(b) => b.showDashboardJSON
|
|
656
|
-
);
|
|
657
|
-
const g = w((b) => b.onSaveFunction), j = w(
|
|
658
|
-
(b) => b.actions.setShowFilters
|
|
659
|
-
), { addFrame: d, setSelectedFrameId: x } = w(
|
|
660
|
-
(b) => b.actions
|
|
661
|
-
), { getSelectedSheet: v, setIsDashboardEditing: f, setShowDashboardJSON: F } = w((b) => b.actions), M = v(), { tenantId: N, endUserId: V } = gs(
|
|
662
|
-
() => Ut(s == null ? void 0 : s.accessToken),
|
|
663
|
-
[s == null ? void 0 : s.accessToken]
|
|
664
|
-
), q = gs(() => N || V, [N, V]), _ = () => {
|
|
665
|
-
if (!h || !M)
|
|
666
|
-
return;
|
|
667
|
-
const b = {
|
|
668
|
-
id: Ze(),
|
|
669
|
-
title: "Title",
|
|
670
|
-
description: "Description",
|
|
671
|
-
preferences: {
|
|
672
|
-
onClickFilter: [
|
|
673
|
-
{
|
|
674
|
-
columnIndex: 0,
|
|
675
|
-
expression: ""
|
|
676
|
-
}
|
|
677
|
-
]
|
|
678
|
-
},
|
|
679
|
-
type: "bar",
|
|
680
|
-
sql: "select COUNT(*) from YOUR_TABLE",
|
|
681
|
-
data: []
|
|
682
|
-
}, R = {
|
|
683
|
-
id: Ze(),
|
|
684
|
-
cards: [b],
|
|
685
|
-
activeCardId: b.id
|
|
686
|
-
};
|
|
687
|
-
d(M.id, R), x(R.id);
|
|
688
|
-
}, L = () => {
|
|
689
|
-
f(!0);
|
|
690
|
-
};
|
|
691
|
-
async function C() {
|
|
692
|
-
if (l(!0), !t || !a)
|
|
693
|
-
return;
|
|
694
|
-
const b = vt(
|
|
695
|
-
i
|
|
696
|
-
), R = JSON.stringify(b), H = {
|
|
697
|
-
...a,
|
|
698
|
-
template: R,
|
|
699
|
-
filterValues: c
|
|
700
|
-
};
|
|
701
|
-
await js(H, s == null ? void 0 : s.accessToken), Xe.success("Lens saved"), g == null || g(b), l(!1);
|
|
702
|
-
}
|
|
703
|
-
return m ? null : /* @__PURE__ */ e.jsxs(
|
|
704
|
-
"div",
|
|
705
|
-
{
|
|
706
|
-
className: "flex items-center justify-between gap-2 border-b bg-muted/50 py-2 pl-3 pr-2",
|
|
707
|
-
role: "dashboard-controls",
|
|
708
|
-
children: [
|
|
709
|
-
!m && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ e.jsx($, { children: a == null ? void 0 : a.name }) }),
|
|
710
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
|
|
711
|
-
h && !m && q && /* @__PURE__ */ e.jsx(On, {}),
|
|
712
|
-
!m && q && /* @__PURE__ */ e.jsx(Dn, {}),
|
|
713
|
-
h && !m && /* @__PURE__ */ e.jsxs(
|
|
714
|
-
z,
|
|
715
|
-
{
|
|
716
|
-
variant: "secondary",
|
|
717
|
-
className: "h-7 p-2",
|
|
718
|
-
size: "sm",
|
|
719
|
-
disabled: !h,
|
|
720
|
-
onClick: _,
|
|
721
|
-
children: [
|
|
722
|
-
/* @__PURE__ */ e.jsx(Ns, { className: "mr-2 h-4 w-4", strokeWidth: 1.5 }),
|
|
723
|
-
"Frame"
|
|
724
|
-
]
|
|
725
|
-
}
|
|
726
|
-
),
|
|
727
|
-
!h && /* @__PURE__ */ e.jsx(
|
|
728
|
-
z,
|
|
729
|
-
{
|
|
730
|
-
variant: "ghost",
|
|
731
|
-
className: "h-7 p-2",
|
|
732
|
-
onClick: L,
|
|
733
|
-
size: "sm",
|
|
734
|
-
children: /* @__PURE__ */ e.jsx(jt, { className: "h-4 w-4", strokeWidth: 1.5 })
|
|
735
|
-
}
|
|
736
|
-
),
|
|
737
|
-
h && !m && /* @__PURE__ */ e.jsx(
|
|
738
|
-
z,
|
|
739
|
-
{
|
|
740
|
-
variant: "ghost",
|
|
741
|
-
role: "close",
|
|
742
|
-
className: "h-7 p-2",
|
|
743
|
-
onClick: () => {
|
|
744
|
-
f(!1), F(!1);
|
|
745
|
-
},
|
|
746
|
-
size: "sm",
|
|
747
|
-
children: /* @__PURE__ */ e.jsx(Ve, { className: "h-4 w-4", strokeWidth: 1.5 })
|
|
748
|
-
}
|
|
749
|
-
),
|
|
750
|
-
h && !m && q && /* @__PURE__ */ e.jsx(
|
|
751
|
-
z,
|
|
752
|
-
{
|
|
753
|
-
className: "h-7 p-2",
|
|
754
|
-
variant: "ghost",
|
|
755
|
-
disabled: r,
|
|
756
|
-
onClick: C,
|
|
757
|
-
size: "sm",
|
|
758
|
-
children: /* @__PURE__ */ e.jsx(yn, { className: "h-4 w-4", strokeWidth: 1.5 })
|
|
759
|
-
}
|
|
760
|
-
),
|
|
761
|
-
!u && !m && h && /* @__PURE__ */ e.jsx(
|
|
762
|
-
z,
|
|
763
|
-
{
|
|
764
|
-
className: "h-7 p-2",
|
|
765
|
-
variant: "ghost",
|
|
766
|
-
onClick: () => j(!0),
|
|
767
|
-
size: "sm",
|
|
768
|
-
children: /* @__PURE__ */ e.jsx(tt, { className: "h-4 w-4", strokeWidth: 1.5 })
|
|
769
|
-
}
|
|
770
|
-
),
|
|
771
|
-
!m && h && !1,
|
|
772
|
-
!m && !1
|
|
773
|
-
] })
|
|
774
|
-
]
|
|
775
|
-
}
|
|
776
|
-
);
|
|
777
|
-
}
|
|
778
|
-
function Ee({
|
|
779
|
-
title: s,
|
|
780
|
-
items: n,
|
|
781
|
-
value: t,
|
|
782
|
-
isLoading: a,
|
|
783
|
-
isError: i,
|
|
784
|
-
connectionTooltip: h,
|
|
785
|
-
onChange: r,
|
|
786
|
-
showNone: l = !1,
|
|
787
|
-
className: c,
|
|
788
|
-
showIcon: m = !0,
|
|
789
|
-
disabled: u = !1
|
|
790
|
-
}) {
|
|
791
|
-
const g = a ? "Loading..." : i ? "Error" : t;
|
|
792
|
-
function j() {
|
|
793
|
-
if (s === "Connection")
|
|
794
|
-
return /* @__PURE__ */ e.jsx(bn, { className: "size-4 rotate-90" });
|
|
795
|
-
if (s === "Database")
|
|
796
|
-
return /* @__PURE__ */ e.jsx(nn, { className: "size-4" });
|
|
797
|
-
if (s === "Schema")
|
|
798
|
-
return /* @__PURE__ */ e.jsx(gn, { className: "size-4" });
|
|
799
|
-
if (s === "Table")
|
|
800
|
-
return /* @__PURE__ */ e.jsx(Ls, { className: "size-4" });
|
|
801
|
-
if (s === "Model")
|
|
802
|
-
return /* @__PURE__ */ e.jsx(tn, { className: "size-4" });
|
|
803
|
-
}
|
|
804
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
805
|
-
m && /* @__PURE__ */ e.jsx("div", { className: "shrink-0", children: h ? /* @__PURE__ */ e.jsxs(zs, { children: [
|
|
806
|
-
/* @__PURE__ */ e.jsx(at, { children: j() }),
|
|
807
|
-
/* @__PURE__ */ e.jsx(Fs, { className: "text-xs", align: "start", children: h })
|
|
808
|
-
] }) : j() }),
|
|
809
|
-
/* @__PURE__ */ e.jsxs(ke, { disabled: u, value: g, onValueChange: r, children: [
|
|
810
|
-
/* @__PURE__ */ e.jsx(
|
|
811
|
-
ze,
|
|
812
|
-
{
|
|
813
|
-
className: Z(
|
|
814
|
-
"h-9 w-full focus:ring-1 focus:ring-offset-0",
|
|
815
|
-
c
|
|
816
|
-
),
|
|
817
|
-
children: /* @__PURE__ */ e.jsx(
|
|
818
|
-
Fe,
|
|
819
|
-
{
|
|
820
|
-
placeholder: a ? "Loading..." : i ? "Error" : `Select ${s}`
|
|
821
|
-
}
|
|
822
|
-
)
|
|
823
|
-
}
|
|
824
|
-
),
|
|
825
|
-
/* @__PURE__ */ e.jsx(Le, { children: /* @__PURE__ */ e.jsxs(_e, { children: [
|
|
826
|
-
a ? /* @__PURE__ */ e.jsx(Me, { children: "Loading..." }) : /* @__PURE__ */ e.jsx(Me, { children: s }),
|
|
827
|
-
/* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
828
|
-
l && /* @__PURE__ */ e.jsx(te, { value: "none", children: "None" }, "none"),
|
|
829
|
-
n && n.map((d, x) => /* @__PURE__ */ e.jsx(te, { value: d.id, children: d.name }, x))
|
|
830
|
-
] }),
|
|
831
|
-
(a || i) && /* @__PURE__ */ e.jsx(te, { value: g, children: g })
|
|
832
|
-
] }) })
|
|
833
|
-
] })
|
|
834
|
-
] });
|
|
835
|
-
}
|
|
836
|
-
function An({ column: s }) {
|
|
837
|
-
const [n, t] = T(!1), a = o((d) => d.selectedTableName), i = o(
|
|
838
|
-
(d) => d.selectedSchemaName
|
|
839
|
-
), h = o(
|
|
840
|
-
(d) => d.selectedDatamodelId
|
|
841
|
-
), r = o((d) => d.sqlGen), { modelItems: l } = De(), c = o((d) => d.actions.setSqlGen), m = o((d) => d.actions.setCardSql), u = o((d) => d.actions.setRunSql);
|
|
842
|
-
function g(d, x) {
|
|
843
|
-
var M;
|
|
844
|
-
const v = nt(d, r, x), f = (M = l == null ? void 0 : l.find(
|
|
845
|
-
(N) => N.id === h
|
|
846
|
-
)) == null ? void 0 : M.name;
|
|
847
|
-
c(v);
|
|
848
|
-
const F = rt(
|
|
849
|
-
v,
|
|
850
|
-
ue(i || ""),
|
|
851
|
-
ue(a),
|
|
852
|
-
f
|
|
853
|
-
);
|
|
854
|
-
F && (m(F), u(!0)), t(!1);
|
|
855
|
-
}
|
|
856
|
-
function j() {
|
|
857
|
-
return /* @__PURE__ */ e.jsxs("ul", { className: "text-xs", children: [
|
|
858
|
-
/* @__PURE__ */ e.jsx(
|
|
859
|
-
"li",
|
|
860
|
-
{
|
|
861
|
-
onClick: () => g(s, "COUNT"),
|
|
862
|
-
className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
|
|
863
|
-
children: "Count"
|
|
864
|
-
}
|
|
865
|
-
),
|
|
866
|
-
/* @__PURE__ */ e.jsx(
|
|
867
|
-
"li",
|
|
868
|
-
{
|
|
869
|
-
onClick: () => g(s, "AVG"),
|
|
870
|
-
className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
|
|
871
|
-
children: "Avg"
|
|
872
|
-
}
|
|
873
|
-
),
|
|
874
|
-
/* @__PURE__ */ e.jsx(
|
|
875
|
-
"li",
|
|
876
|
-
{
|
|
877
|
-
onClick: () => g(s, "SUM"),
|
|
878
|
-
className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
|
|
879
|
-
children: "Sum"
|
|
880
|
-
}
|
|
881
|
-
),
|
|
882
|
-
/* @__PURE__ */ e.jsx(
|
|
883
|
-
"li",
|
|
884
|
-
{
|
|
885
|
-
onClick: () => g(s, "MAX"),
|
|
886
|
-
className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
|
|
887
|
-
children: "Max"
|
|
888
|
-
}
|
|
889
|
-
),
|
|
890
|
-
/* @__PURE__ */ e.jsx(
|
|
891
|
-
"li",
|
|
892
|
-
{
|
|
893
|
-
onClick: () => g(s, "MIN"),
|
|
894
|
-
className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
|
|
895
|
-
children: "Min"
|
|
896
|
-
}
|
|
897
|
-
)
|
|
898
|
-
] });
|
|
899
|
-
}
|
|
900
|
-
return /* @__PURE__ */ e.jsxs(Ms, { openDelay: 0, open: n, onOpenChange: t, children: [
|
|
901
|
-
/* @__PURE__ */ e.jsx(Os, { asChild: !0, children: /* @__PURE__ */ e.jsx(rn, { className: "invisible size-3.5 cursor-pointer text-foreground/40 group-hover:visible" }) }),
|
|
902
|
-
/* @__PURE__ */ e.jsx(
|
|
903
|
-
Ds,
|
|
904
|
-
{
|
|
905
|
-
align: "center",
|
|
906
|
-
className: "w-20 rounded-md p-0 shadow-none",
|
|
907
|
-
children: j()
|
|
908
|
-
}
|
|
909
|
-
)
|
|
910
|
-
] });
|
|
911
|
-
}
|
|
912
|
-
function Nt({ column: s }) {
|
|
913
|
-
return /* @__PURE__ */ e.jsxs(zs, { children: [
|
|
914
|
-
/* @__PURE__ */ e.jsx(Kt, { asChild: !0, children: Wt.includes(s.data_type.toLowerCase()) ? (
|
|
915
|
-
// <span className=" font-thin">T</span>
|
|
916
|
-
/* @__PURE__ */ e.jsx(Vs, { className: "size-3" })
|
|
917
|
-
) : it.includes(s.data_type.toLowerCase()) ? (
|
|
918
|
-
//
|
|
919
|
-
/* @__PURE__ */ e.jsx(dn, { className: "size-3" })
|
|
920
|
-
) : Qt.includes(s.data_type.toLowerCase()) ? /* @__PURE__ */ e.jsx(Jt, { className: "size-3" }) : Yt.includes(s.data_type.toLowerCase()) ? /* @__PURE__ */ e.jsx(wn, { className: "size-3" }) : /* @__PURE__ */ e.jsx(vn, { className: "size-3" }) }),
|
|
921
|
-
/* @__PURE__ */ e.jsx(Fs, { children: /* @__PURE__ */ e.jsx("p", { className: "font-mono text-xs", children: s.data_type }) })
|
|
922
|
-
] });
|
|
923
|
-
}
|
|
924
|
-
function In({
|
|
925
|
-
schemaName: s,
|
|
926
|
-
tableName: n,
|
|
927
|
-
columns: t,
|
|
928
|
-
status: a
|
|
929
|
-
}) {
|
|
930
|
-
const i = o((C) => C.sqlGen), h = o(
|
|
931
|
-
(C) => C.selectedConnectionId
|
|
932
|
-
), r = o(
|
|
933
|
-
(C) => C.selectedDatabaseName
|
|
934
|
-
), l = o(
|
|
935
|
-
(C) => C.selectedSchemaName
|
|
936
|
-
), c = o((C) => C.selectedTableName), m = o(
|
|
937
|
-
(C) => C.selectedDatamodelId
|
|
938
|
-
), u = w(
|
|
939
|
-
(C) => C.dashboard.aiScopeTables
|
|
940
|
-
), { setAIScopeTables: g } = w((C) => C.actions), j = o((C) => C.actions.setRunSql), d = o((C) => C.actions.setSqlGen), x = o(
|
|
941
|
-
(C) => C.actions.setIsShowingVisual
|
|
942
|
-
), v = o((C) => C.actions.setCardSql), { connectionType: f, modelItems: F } = De();
|
|
943
|
-
function M(C) {
|
|
944
|
-
var A;
|
|
945
|
-
const b = nt(C, i);
|
|
946
|
-
d(b);
|
|
947
|
-
const R = (A = F == null ? void 0 : F.find(
|
|
948
|
-
(P) => P.id === m
|
|
949
|
-
)) == null ? void 0 : A.name, H = rt(b, ue(s), ue(n), R);
|
|
950
|
-
H && (v(H), j(!0));
|
|
951
|
-
}
|
|
952
|
-
function N() {
|
|
953
|
-
return (u == null ? void 0 : u.find(
|
|
954
|
-
(C) => C.connectinonId === h && C.tableName === c
|
|
955
|
-
)) !== void 0;
|
|
956
|
-
}
|
|
957
|
-
function V(C) {
|
|
958
|
-
if (C === !0 && c && h) {
|
|
959
|
-
const b = {
|
|
960
|
-
connectinonId: h,
|
|
961
|
-
connectionType: f,
|
|
962
|
-
databaseName: r,
|
|
963
|
-
schemaName: l,
|
|
964
|
-
tableName: c
|
|
965
|
-
}, H = [...u || [], b].filter(
|
|
966
|
-
(A, P, X) => X.findIndex(
|
|
967
|
-
(W) => W.connectinonId === A.connectinonId && W.tableName === A.tableName
|
|
968
|
-
) === P
|
|
969
|
-
);
|
|
970
|
-
g(H), Xe.success(`Added '${c}' to AI Scope`, {
|
|
971
|
-
position: "top-right",
|
|
972
|
-
duration: 2500,
|
|
973
|
-
richColors: !0
|
|
974
|
-
});
|
|
975
|
-
} else {
|
|
976
|
-
const b = (u || []).filter(
|
|
977
|
-
(R) => R.connectinonId !== h && R.tableName !== c
|
|
978
|
-
);
|
|
979
|
-
g(b), Xe(`Removed '${c}' from AI Scope`, {
|
|
980
|
-
position: "top-right",
|
|
981
|
-
duration: 2e3,
|
|
982
|
-
richColors: !0
|
|
983
|
-
});
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
function q() {
|
|
987
|
-
var A;
|
|
988
|
-
let C = ot(s, n);
|
|
989
|
-
const b = (A = F == null ? void 0 : F.find(
|
|
990
|
-
(P) => P.id === m
|
|
991
|
-
)) == null ? void 0 : A.name;
|
|
992
|
-
console.log("modelName", b), m && m !== "none" && (C = `${ms}.${b}`);
|
|
993
|
-
let R = C;
|
|
994
|
-
return ((P) => /[A-Z]/.test(P))(n) && (R = R.split(".").map((X) => `"${X}"`).join(".")), R;
|
|
995
|
-
}
|
|
996
|
-
function _() {
|
|
997
|
-
const C = q();
|
|
998
|
-
x(!1);
|
|
999
|
-
const b = f === "MSSQL" ? `SELECT top 10 * FROM ${C}` : `SELECT * FROM ${C} LIMIT 10`;
|
|
1000
|
-
v(b), j(!0);
|
|
1001
|
-
}
|
|
1002
|
-
function L() {
|
|
1003
|
-
const C = q();
|
|
1004
|
-
v(`SELECT COUNT(*) as count FROM ${C}`), j(!0);
|
|
1005
|
-
}
|
|
1006
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "flex grow flex-col space-y-4 px-4", children: [
|
|
1007
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center gap-1", children: [
|
|
1008
|
-
/* @__PURE__ */ e.jsx(
|
|
1009
|
-
lt,
|
|
1010
|
-
{
|
|
1011
|
-
title: `${N() ? "Remove from" : "Add to"} AI Scope`,
|
|
1012
|
-
pressed: N(),
|
|
1013
|
-
onPressedChange: V,
|
|
1014
|
-
variant: "outline",
|
|
1015
|
-
className: "h-9 px-2",
|
|
1016
|
-
children: /* @__PURE__ */ e.jsx(
|
|
1017
|
-
Zt,
|
|
1018
|
-
{
|
|
1019
|
-
className: Z("size-4", {
|
|
1020
|
-
"text-primary": N(),
|
|
1021
|
-
"text-muted-foreground": !N()
|
|
1022
|
-
})
|
|
1023
|
-
}
|
|
1024
|
-
)
|
|
1025
|
-
}
|
|
1026
|
-
),
|
|
1027
|
-
/* @__PURE__ */ e.jsxs(
|
|
1028
|
-
z,
|
|
1029
|
-
{
|
|
1030
|
-
disabled: a !== "Success",
|
|
1031
|
-
onClick: _,
|
|
1032
|
-
size: "sm",
|
|
1033
|
-
variant: "secondary",
|
|
1034
|
-
className: "flex",
|
|
1035
|
-
children: [
|
|
1036
|
-
a !== "Success" ? /* @__PURE__ */ e.jsx($e, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx(Cn, { className: "mr-2 size-4" }),
|
|
1037
|
-
"Top 10"
|
|
1038
|
-
]
|
|
1039
|
-
}
|
|
1040
|
-
),
|
|
1041
|
-
/* @__PURE__ */ e.jsxs(
|
|
1042
|
-
z,
|
|
1043
|
-
{
|
|
1044
|
-
disabled: a !== "Success",
|
|
1045
|
-
onClick: L,
|
|
1046
|
-
size: "sm",
|
|
1047
|
-
variant: "secondary",
|
|
1048
|
-
className: "flex",
|
|
1049
|
-
children: [
|
|
1050
|
-
a !== "Success" ? /* @__PURE__ */ e.jsx($e, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx(Nn, { className: "mr-2 size-4" }),
|
|
1051
|
-
"Count"
|
|
1052
|
-
]
|
|
1053
|
-
}
|
|
1054
|
-
)
|
|
1055
|
-
] }),
|
|
1056
|
-
/* @__PURE__ */ e.jsxs(
|
|
1057
|
-
Ts,
|
|
1058
|
-
{
|
|
1059
|
-
className: "flex-1 basis-0 overflow-y-auto border-b border-t border-muted py-3",
|
|
1060
|
-
children: [
|
|
1061
|
-
t == null ? void 0 : t.map((C) => /* @__PURE__ */ e.jsxs(
|
|
1062
|
-
"div",
|
|
1063
|
-
{
|
|
1064
|
-
onClick: () => M(C),
|
|
1065
|
-
className: Z(
|
|
1066
|
-
"group mx-3 flex cursor-pointer items-center justify-between rounded px-2 py-[6px] text-sm transition-colors hover:bg-muted/50",
|
|
1067
|
-
{
|
|
1068
|
-
"bg-muted": Xt(C, i)
|
|
1069
|
-
}
|
|
1070
|
-
),
|
|
1071
|
-
children: [
|
|
1072
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
1073
|
-
/* @__PURE__ */ e.jsx(Nt, { column: C }),
|
|
1074
|
-
/* @__PURE__ */ e.jsx("span", { children: C.column_name })
|
|
1075
|
-
] }),
|
|
1076
|
-
/* @__PURE__ */ e.jsx(
|
|
1077
|
-
"div",
|
|
1078
|
-
{
|
|
1079
|
-
onClick: (b) => b.stopPropagation(),
|
|
1080
|
-
className: "flex items-center justify-end",
|
|
1081
|
-
children: it.includes(C.data_type) && /* @__PURE__ */ e.jsx(An, { column: C })
|
|
1082
|
-
}
|
|
1083
|
-
)
|
|
1084
|
-
]
|
|
1085
|
-
},
|
|
1086
|
-
C.column_name
|
|
1087
|
-
)),
|
|
1088
|
-
/* @__PURE__ */ e.jsx(Ps, { orientation: "vertical" }),
|
|
1089
|
-
/* @__PURE__ */ e.jsx(Ps, { orientation: "horizontal" })
|
|
1090
|
-
]
|
|
1091
|
-
}
|
|
1092
|
-
)
|
|
1093
|
-
] });
|
|
1094
|
-
}
|
|
1095
|
-
function De(s, n) {
|
|
1096
|
-
var Ge, Ie, Ue, Ke, p;
|
|
1097
|
-
let t = gs(() => [], []);
|
|
1098
|
-
const a = je().authToken || s, i = o(
|
|
1099
|
-
(y) => y.selectedConnectionId
|
|
1100
|
-
), h = o(
|
|
1101
|
-
(y) => y.selectedDatamodelId
|
|
1102
|
-
), r = o(
|
|
1103
|
-
(y) => y.selectedDatabaseName
|
|
1104
|
-
), l = o(
|
|
1105
|
-
(y) => y.selectedSchemaName
|
|
1106
|
-
), c = o((y) => y.selectedTableName), m = o(
|
|
1107
|
-
(y) => y.actions.setCurrentColumns
|
|
1108
|
-
), u = o(
|
|
1109
|
-
(y) => y.actions.setSelectedConnectionId
|
|
1110
|
-
), g = o(
|
|
1111
|
-
(y) => y.actions.setSelectedDatamodelId
|
|
1112
|
-
), j = o(
|
|
1113
|
-
(y) => y.actions.setSelectedDatabaseName
|
|
1114
|
-
), d = o(
|
|
1115
|
-
(y) => y.actions.setSelectedSchemaName
|
|
1116
|
-
), x = o(
|
|
1117
|
-
(y) => y.actions.setSelectedTableName
|
|
1118
|
-
), v = o((y) => y.actions.setCardSql);
|
|
1119
|
-
function f(y) {
|
|
1120
|
-
return i && r && l && r !== "NA" ? !0 : i && y === "API" ? !1 : !!(i && y === "S3");
|
|
1121
|
-
}
|
|
1122
|
-
function F(y) {
|
|
1123
|
-
return !!(i && r && r !== "NA" && l && c || i && (y === "S3" || y === "API") || h && h);
|
|
1124
|
-
}
|
|
1125
|
-
function M(y) {
|
|
1126
|
-
return i && y ? !(y === "API" || y === "S3") : !1;
|
|
1127
|
-
}
|
|
1128
|
-
const {
|
|
1129
|
-
data: N,
|
|
1130
|
-
isLoading: V,
|
|
1131
|
-
isError: q
|
|
1132
|
-
} = he({
|
|
1133
|
-
queryKey: ["connections"],
|
|
1134
|
-
queryFn: () => ge(
|
|
1135
|
-
"https://semaphor.cloud/api/v1/connections",
|
|
1136
|
-
(a == null ? void 0 : a.accessToken) || ""
|
|
1137
|
-
),
|
|
1138
|
-
enabled: !!(a != null && a.accessToken)
|
|
1139
|
-
// Only fetch if authToken is present
|
|
1140
|
-
}), {
|
|
1141
|
-
data: _,
|
|
1142
|
-
isLoading: L,
|
|
1143
|
-
isError: C
|
|
1144
|
-
} = he({
|
|
1145
|
-
queryKey: ["models", i],
|
|
1146
|
-
queryFn: () => ge(
|
|
1147
|
-
"https://semaphor.cloud/api/v1/datamodels",
|
|
1148
|
-
(a == null ? void 0 : a.accessToken) || "",
|
|
1149
|
-
{
|
|
1150
|
-
connection_id: i
|
|
1151
|
-
}
|
|
1152
|
-
),
|
|
1153
|
-
enabled: !!(a != null && a.accessToken) && !!i
|
|
1154
|
-
// Only fetch if authToken is present
|
|
1155
|
-
}), b = N == null ? void 0 : N.connections.find(
|
|
1156
|
-
(y) => y.id === i
|
|
1157
|
-
), R = b == null ? void 0 : b.type, H = (b == null ? void 0 : b.type) === "API" || (b == null ? void 0 : b.type) === "S3", {
|
|
1158
|
-
data: A,
|
|
1159
|
-
isLoading: P,
|
|
1160
|
-
isFetching: X,
|
|
1161
|
-
isError: W,
|
|
1162
|
-
refetch: re
|
|
1163
|
-
} = he({
|
|
1164
|
-
queryKey: ["databases", i],
|
|
1165
|
-
queryFn: () => ge(
|
|
1166
|
-
"https://semaphor.cloud/api/v1/databases",
|
|
1167
|
-
(a == null ? void 0 : a.accessToken) || "",
|
|
1168
|
-
{
|
|
1169
|
-
connection_id: i
|
|
1170
|
-
}
|
|
1171
|
-
),
|
|
1172
|
-
enabled: M(R)
|
|
1173
|
-
// !!selectedConnectionId && !isNonDbConnection, //currentConnection?.type !== 'API', // Only fetch if connectionId is present
|
|
1174
|
-
}), {
|
|
1175
|
-
data: K,
|
|
1176
|
-
isLoading: ie,
|
|
1177
|
-
isFetching: S,
|
|
1178
|
-
isError: O,
|
|
1179
|
-
refetch: J
|
|
1180
|
-
} = he({
|
|
1181
|
-
queryKey: ["schemas", i, r],
|
|
1182
|
-
queryFn: () => ge(
|
|
1183
|
-
"https://semaphor.cloud/api/v1/schemas",
|
|
1184
|
-
(a == null ? void 0 : a.accessToken) || "",
|
|
1185
|
-
{
|
|
1186
|
-
connection_id: i,
|
|
1187
|
-
database_name: r
|
|
1188
|
-
}
|
|
1189
|
-
),
|
|
1190
|
-
enabled: !!i && !!r && !H && r !== "NA"
|
|
1191
|
-
//currentConnection?.type !== 'API', // Only fetch if connectionId and database is present
|
|
1192
|
-
}), {
|
|
1193
|
-
data: k,
|
|
1194
|
-
isLoading: I,
|
|
1195
|
-
isFetching: ee,
|
|
1196
|
-
isError: E,
|
|
1197
|
-
refetch: se
|
|
1198
|
-
} = he({
|
|
1199
|
-
queryKey: [
|
|
1200
|
-
"tables",
|
|
1201
|
-
i,
|
|
1202
|
-
r,
|
|
1203
|
-
l
|
|
1204
|
-
],
|
|
1205
|
-
queryFn: () => ge(
|
|
1206
|
-
"https://semaphor.cloud/api/v1/tables",
|
|
1207
|
-
(a == null ? void 0 : a.accessToken) || "",
|
|
1208
|
-
{
|
|
1209
|
-
connection_id: i,
|
|
1210
|
-
database_name: r,
|
|
1211
|
-
schema_name: l
|
|
1212
|
-
}
|
|
1213
|
-
),
|
|
1214
|
-
enabled: f(R)
|
|
1215
|
-
}), {
|
|
1216
|
-
data: ae,
|
|
1217
|
-
isLoading: be,
|
|
1218
|
-
isFetching: pe,
|
|
1219
|
-
isError: Q
|
|
1220
|
-
} = he({
|
|
1221
|
-
queryKey: [
|
|
1222
|
-
"columns",
|
|
1223
|
-
i,
|
|
1224
|
-
r,
|
|
1225
|
-
h,
|
|
1226
|
-
l,
|
|
1227
|
-
c
|
|
1228
|
-
],
|
|
1229
|
-
queryFn: () => ge(
|
|
1230
|
-
"https://semaphor.cloud/api/v1/columns",
|
|
1231
|
-
(a == null ? void 0 : a.accessToken) || "",
|
|
1232
|
-
{
|
|
1233
|
-
connection_id: i,
|
|
1234
|
-
datamodel_id: h || "",
|
|
1235
|
-
// don't pass undefined. Pass empty string
|
|
1236
|
-
database_name: r,
|
|
1237
|
-
schema_name: l,
|
|
1238
|
-
table_name: c
|
|
1239
|
-
}
|
|
1240
|
-
),
|
|
1241
|
-
enabled: F(R)
|
|
1242
|
-
// (!!selectedConnectionId &&
|
|
1243
|
-
// !!selectedDatabaseName &&
|
|
1244
|
-
// !!selectedSchemaName &&
|
|
1245
|
-
// !!selectedTableName) ||
|
|
1246
|
-
// isNonDbConnection,
|
|
1247
|
-
//currentConnection?.type === 'API',
|
|
1248
|
-
// && currentConnection?.type !== 'API', // Only fetch if connectionId, database, and table is present
|
|
1249
|
-
});
|
|
1250
|
-
Y(() => {
|
|
1251
|
-
m(t);
|
|
1252
|
-
}, [ae, m, t]), Y(() => {
|
|
1253
|
-
}, [
|
|
1254
|
-
H,
|
|
1255
|
-
v,
|
|
1256
|
-
x,
|
|
1257
|
-
d,
|
|
1258
|
-
j,
|
|
1259
|
-
b
|
|
1260
|
-
]);
|
|
1261
|
-
const le = (b == null ? void 0 : b.type) === "API" ? (Ge = b == null ? void 0 : b.type) == null ? void 0 : Ge.toLowerCase() : c || "", oe = H ? "" : l || "";
|
|
1262
|
-
function ye(y) {
|
|
1263
|
-
d(y), x("");
|
|
1264
|
-
}
|
|
1265
|
-
function ce(y) {
|
|
1266
|
-
j(y === "none" ? "" : y), d(""), x(""), y !== "none" && y !== "" && g("");
|
|
1267
|
-
}
|
|
1268
|
-
function fe(y) {
|
|
1269
|
-
u(y);
|
|
1270
|
-
}
|
|
1271
|
-
function Rs(y) {
|
|
1272
|
-
g(y === "none" ? "" : y), y !== "none" && y !== "" && j("");
|
|
1273
|
-
}
|
|
1274
|
-
A && ((Ie = A == null ? void 0 : A.databases) == null ? void 0 : Ie.length) > 0, K && ((Ue = K == null ? void 0 : K.schemas) == null ? void 0 : Ue.length) > 0, ae && ((Ke = ae == null ? void 0 : ae.columns) == null ? void 0 : Ke.length) > 0 && (t = ae.columns.map((y) => ({
|
|
1275
|
-
...y,
|
|
1276
|
-
data_type: y.data_type.toLowerCase()
|
|
1277
|
-
}))), W && (t = []), (Q || q) && (t = []);
|
|
1278
|
-
const Ce = N == null ? void 0 : N.connections.map(
|
|
1279
|
-
(y) => ({
|
|
1280
|
-
id: y.id,
|
|
1281
|
-
name: y.name,
|
|
1282
|
-
type: y.type
|
|
1283
|
-
})
|
|
1284
|
-
), os = (p = _ == null ? void 0 : _.datamodels) == null ? void 0 : p.map((y) => ({
|
|
1285
|
-
id: y.id,
|
|
1286
|
-
name: y.name
|
|
1287
|
-
})), Be = A == null ? void 0 : A.databases.map((y) => ({
|
|
1288
|
-
id: y.database_name,
|
|
1289
|
-
name: y.database_name
|
|
1290
|
-
})), cs = K == null ? void 0 : K.schemas.map((y) => ({
|
|
1291
|
-
id: y.schema_name,
|
|
1292
|
-
name: y.schema_name
|
|
1293
|
-
})), ds = k == null ? void 0 : k.tables.map((y) => ({
|
|
1294
|
-
id: y.table_name,
|
|
1295
|
-
name: y.table_name
|
|
1296
|
-
}));
|
|
1297
|
-
return {
|
|
1298
|
-
connectionItems: Ce,
|
|
1299
|
-
isConnectionsLoading: V,
|
|
1300
|
-
isConnectionsError: q,
|
|
1301
|
-
modelItems: os,
|
|
1302
|
-
isModelsLoading: L,
|
|
1303
|
-
isModelsError: C,
|
|
1304
|
-
databaseItems: Be,
|
|
1305
|
-
isDatabasesLoadingOrFetching: P || X,
|
|
1306
|
-
isDatabaseError: W,
|
|
1307
|
-
schemaItems: cs,
|
|
1308
|
-
isSchemaLoadingOrFetching: ie || S,
|
|
1309
|
-
isSchemaError: O,
|
|
1310
|
-
tableItems: ds,
|
|
1311
|
-
isTableLoadingOrFetching: I || ee,
|
|
1312
|
-
isTableError: E,
|
|
1313
|
-
columns: t,
|
|
1314
|
-
isColumnsLoadingOrFetching: be || pe,
|
|
1315
|
-
isColumnsError: Q,
|
|
1316
|
-
isNonDbConnection: H,
|
|
1317
|
-
connectionType: R,
|
|
1318
|
-
tableName: le,
|
|
1319
|
-
schemaName: oe,
|
|
1320
|
-
handleConnectionChange: fe,
|
|
1321
|
-
handleDatamodelChange: Rs,
|
|
1322
|
-
handleDatabaseChange: ce,
|
|
1323
|
-
handleSchemaChange: ye
|
|
1324
|
-
};
|
|
1325
|
-
}
|
|
1326
|
-
function Ct({
|
|
1327
|
-
ColumnsComponent: s
|
|
1328
|
-
}) {
|
|
1329
|
-
var ee;
|
|
1330
|
-
const n = o(
|
|
1331
|
-
(E) => E.selectedConnectionId
|
|
1332
|
-
), t = o(
|
|
1333
|
-
(E) => E.selectedDatamodelId
|
|
1334
|
-
), a = o(
|
|
1335
|
-
(E) => E.selectedDatabaseName
|
|
1336
|
-
), i = o(
|
|
1337
|
-
(E) => E.selectedSchemaName
|
|
1338
|
-
), h = o((E) => E.selectedTableName), r = o(
|
|
1339
|
-
(E) => E.actions.setSelectedTableName
|
|
1340
|
-
), {
|
|
1341
|
-
connectionItems: l,
|
|
1342
|
-
modelItems: c,
|
|
1343
|
-
schemaItems: m,
|
|
1344
|
-
databaseItems: u,
|
|
1345
|
-
tableItems: g,
|
|
1346
|
-
columns: j,
|
|
1347
|
-
isConnectionsLoading: d,
|
|
1348
|
-
isModelsLoading: x,
|
|
1349
|
-
isConnectionsError: v,
|
|
1350
|
-
isModelsError: f,
|
|
1351
|
-
isDatabasesLoadingOrFetching: F,
|
|
1352
|
-
isDatabaseError: M,
|
|
1353
|
-
isSchemaLoadingOrFetching: N,
|
|
1354
|
-
isSchemaError: V,
|
|
1355
|
-
isColumnsError: q,
|
|
1356
|
-
isColumnsLoadingOrFetching: _,
|
|
1357
|
-
isTableLoadingOrFetching: L,
|
|
1358
|
-
isTableError: C,
|
|
1359
|
-
connectionType: b,
|
|
1360
|
-
isNonDbConnection: R,
|
|
1361
|
-
handleConnectionChange: H,
|
|
1362
|
-
handleDatabaseChange: A,
|
|
1363
|
-
handleSchemaChange: P,
|
|
1364
|
-
handleDatamodelChange: X,
|
|
1365
|
-
tableName: W,
|
|
1366
|
-
schemaName: re
|
|
1367
|
-
} = De();
|
|
1368
|
-
function K() {
|
|
1369
|
-
return s ? s(re, W, j) : /* @__PURE__ */ e.jsx(
|
|
1370
|
-
In,
|
|
1371
|
-
{
|
|
1372
|
-
schemaName: re,
|
|
1373
|
-
tableName: W,
|
|
1374
|
-
columns: j,
|
|
1375
|
-
status: _ ? "Loading..." : q ? "Error" : "Success"
|
|
1376
|
-
}
|
|
1377
|
-
);
|
|
1378
|
-
}
|
|
1379
|
-
function ie() {
|
|
1380
|
-
window.location.href = "mailto:support@semaphor.cloud?subject=Help&body=I need help with...";
|
|
1381
|
-
}
|
|
1382
|
-
function S() {
|
|
1383
|
-
if (!n || b === "S3" || b === "API")
|
|
1384
|
-
return null;
|
|
1385
|
-
if (!t || t === "none")
|
|
1386
|
-
return /* @__PURE__ */ e.jsx(
|
|
1387
|
-
Ee,
|
|
1388
|
-
{
|
|
1389
|
-
showNone: !0,
|
|
1390
|
-
onChange: A,
|
|
1391
|
-
isError: M,
|
|
1392
|
-
isLoading: F,
|
|
1393
|
-
items: u,
|
|
1394
|
-
value: a || "",
|
|
1395
|
-
title: "Database"
|
|
1396
|
-
}
|
|
1397
|
-
);
|
|
1398
|
-
}
|
|
1399
|
-
function O() {
|
|
1400
|
-
if (n && !R && (!a || a === "none") && (!t || t === "none"))
|
|
1401
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3", children: [
|
|
1402
|
-
/* @__PURE__ */ e.jsx("div", { className: "col-span-1 grid place-items-center", children: /* @__PURE__ */ e.jsx(Re, {}) }),
|
|
1403
|
-
/* @__PURE__ */ e.jsx("div", { className: "col-span-1 grid place-items-center", children: /* @__PURE__ */ e.jsx($, { children: "OR" }) }),
|
|
1404
|
-
/* @__PURE__ */ e.jsx("div", { className: "col-span-1 grid place-items-center", children: /* @__PURE__ */ e.jsx(Re, {}) })
|
|
1405
|
-
] });
|
|
1406
|
-
}
|
|
1407
|
-
function J() {
|
|
1408
|
-
if (!n || b === "S3" || b === "API")
|
|
1409
|
-
return null;
|
|
1410
|
-
if (!a || a === "none")
|
|
1411
|
-
return /* @__PURE__ */ e.jsx(
|
|
1412
|
-
Ee,
|
|
1413
|
-
{
|
|
1414
|
-
showNone: !0,
|
|
1415
|
-
onChange: X,
|
|
1416
|
-
isError: f,
|
|
1417
|
-
isLoading: x,
|
|
1418
|
-
items: c,
|
|
1419
|
-
value: t || "",
|
|
1420
|
-
title: "Model"
|
|
1421
|
-
}
|
|
1422
|
-
);
|
|
1423
|
-
}
|
|
1424
|
-
function k() {
|
|
1425
|
-
return !n || b === "S3" || b === "API" || !a || a === "none" ? null : /* @__PURE__ */ e.jsx(
|
|
1426
|
-
Ee,
|
|
1427
|
-
{
|
|
1428
|
-
onChange: P,
|
|
1429
|
-
isError: V,
|
|
1430
|
-
isLoading: N,
|
|
1431
|
-
items: m,
|
|
1432
|
-
value: i || "",
|
|
1433
|
-
title: "Schema"
|
|
1434
|
-
}
|
|
1435
|
-
);
|
|
1436
|
-
}
|
|
1437
|
-
function I() {
|
|
1438
|
-
function E() {
|
|
1439
|
-
let se = !1;
|
|
1440
|
-
return b === "API" ? (se = !1, se) : ((b === "S3" || n && a && a !== "none" && i) && (se = !0), se);
|
|
1441
|
-
}
|
|
1442
|
-
return E() ? /* @__PURE__ */ e.jsx(
|
|
1443
|
-
Ee,
|
|
1444
|
-
{
|
|
1445
|
-
onChange: r,
|
|
1446
|
-
isError: C,
|
|
1447
|
-
items: g,
|
|
1448
|
-
isLoading: L,
|
|
1449
|
-
value: h || "",
|
|
1450
|
-
title: "Table"
|
|
1451
|
-
}
|
|
1452
|
-
) : null;
|
|
1453
|
-
}
|
|
1454
|
-
return /* @__PURE__ */ e.jsxs("aside", { className: "xbg-red-100 flex grow flex-col justify-between", children: [
|
|
1455
|
-
/* @__PURE__ */ e.jsxs("section", { className: "space-y-3 px-6 py-4", children: [
|
|
1456
|
-
/* @__PURE__ */ e.jsx(
|
|
1457
|
-
Ee,
|
|
1458
|
-
{
|
|
1459
|
-
items: l,
|
|
1460
|
-
title: "Connection",
|
|
1461
|
-
value: n || "",
|
|
1462
|
-
onChange: H,
|
|
1463
|
-
isLoading: d,
|
|
1464
|
-
isError: v,
|
|
1465
|
-
connectionTooltip: ((ee = l == null ? void 0 : l.find(
|
|
1466
|
-
(E) => E.id === n
|
|
1467
|
-
)) == null ? void 0 : ee.type) || ""
|
|
1468
|
-
}
|
|
1469
|
-
),
|
|
1470
|
-
J(),
|
|
1471
|
-
O(),
|
|
1472
|
-
S(),
|
|
1473
|
-
k(),
|
|
1474
|
-
I()
|
|
1475
|
-
] }),
|
|
1476
|
-
K(),
|
|
1477
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-end justify-center gap-2 px-6 py-4", children: /* @__PURE__ */ e.jsxs(
|
|
1478
|
-
z,
|
|
1479
|
-
{
|
|
1480
|
-
onClick: ie,
|
|
1481
|
-
size: "sm",
|
|
1482
|
-
variant: "secondary",
|
|
1483
|
-
className: "w-full",
|
|
1484
|
-
children: [
|
|
1485
|
-
/* @__PURE__ */ e.jsx(fn, { className: "mr-2 size-4" }),
|
|
1486
|
-
"Help"
|
|
1487
|
-
]
|
|
1488
|
-
}
|
|
1489
|
-
) })
|
|
1490
|
-
] });
|
|
1491
|
-
}
|
|
1492
|
-
function En(s) {
|
|
1493
|
-
const n = s.toUpperCase().indexOf("WHERE"), t = s.toUpperCase().indexOf("GROUP BY"), a = s.toUpperCase().indexOf("LIMIT"), i = s.toUpperCase().indexOf("ORDER BY");
|
|
1494
|
-
let h = s.length;
|
|
1495
|
-
if (i !== -1 && (h = i), a !== -1 && a < h && (h = a), n !== -1) {
|
|
1496
|
-
const r = s.substring(0, n), l = s.substring(n);
|
|
1497
|
-
return `${r} {{ filters | where }} AND ${l.substring(
|
|
1498
|
-
6
|
|
1499
|
-
)}`;
|
|
1500
|
-
} else if (t !== -1) {
|
|
1501
|
-
const r = s.substring(0, t), l = s.substring(t);
|
|
1502
|
-
return `${r} {{ filters | where }} ${l}`;
|
|
1503
|
-
} else {
|
|
1504
|
-
const r = s.substring(0, h), l = s.substring(h);
|
|
1505
|
-
return `${r} {{ filters | where }} ${l}`;
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
function qn({
|
|
1509
|
-
error: s,
|
|
1510
|
-
setShowAIDialog: n,
|
|
1511
|
-
setUserInputforAI: t,
|
|
1512
|
-
setTriggerAIRun: a
|
|
1513
|
-
}) {
|
|
1514
|
-
return /* @__PURE__ */ e.jsxs(Ms, { openDelay: 0, children: [
|
|
1515
|
-
/* @__PURE__ */ e.jsx(Os, { asChild: !0, children: /* @__PURE__ */ e.jsx(z, { variant: "link", className: "h-5 p-0", children: /* @__PURE__ */ e.jsx(an, { className: "h-4 w-4 text-red-500" }) }) }),
|
|
1516
|
-
/* @__PURE__ */ e.jsx(Ds, { 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: "flex grow flex-col space-y-2", children: [
|
|
1517
|
-
/* @__PURE__ */ e.jsx(Ts, { className: "max-h-[250px] min-h-0 overflow-scroll", children: /* @__PURE__ */ e.jsx("p", { className: "overflow-auto rounded-md bg-muted p-2 text-xs leading-relaxed", children: s }) }),
|
|
1518
|
-
/* @__PURE__ */ e.jsxs(
|
|
1519
|
-
z,
|
|
1520
|
-
{
|
|
1521
|
-
onClick: () => {
|
|
1522
|
-
n(!0), t(s), a(!0);
|
|
1523
|
-
},
|
|
1524
|
-
size: "sm",
|
|
1525
|
-
variant: "outline",
|
|
1526
|
-
children: [
|
|
1527
|
-
/* @__PURE__ */ e.jsx(cn, { className: "mr-2 h-4 w-4" }),
|
|
1528
|
-
"Debug with AI"
|
|
1529
|
-
]
|
|
1530
|
-
}
|
|
1531
|
-
)
|
|
1532
|
-
] }) }) })
|
|
1533
|
-
] });
|
|
1534
|
-
}
|
|
1535
|
-
function Vn({
|
|
1536
|
-
text: s,
|
|
1537
|
-
onCheckedChange: n,
|
|
1538
|
-
checked: t
|
|
1539
|
-
}) {
|
|
1540
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "xbg-red-100 ml-6 flex items-center gap-2", children: [
|
|
1541
|
-
/* @__PURE__ */ e.jsx(ts, { checked: t, onCheckedChange: n }),
|
|
1542
|
-
/* @__PURE__ */ e.jsx("label", { className: "text-xs leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: s })
|
|
1543
|
-
] });
|
|
1544
|
-
}
|
|
1545
|
-
function _n() {
|
|
1546
|
-
const { authToken: s } = je(), n = o(
|
|
1547
|
-
(h) => h.selectedConnectionId
|
|
1548
|
-
), { data: t } = he({
|
|
1549
|
-
queryKey: ["connections"],
|
|
1550
|
-
queryFn: () => ge(
|
|
1551
|
-
"https://semaphor.cloud/api/v1/connections",
|
|
1552
|
-
(s == null ? void 0 : s.accessToken) || ""
|
|
1553
|
-
),
|
|
1554
|
-
enabled: !!(s != null && s.accessToken)
|
|
1555
|
-
// Only fetch if authToken is present
|
|
1556
|
-
}), a = t == null ? void 0 : t.connections.find(
|
|
1557
|
-
(h) => h.id === n
|
|
1558
|
-
);
|
|
1559
|
-
return a == null ? void 0 : a.type;
|
|
1560
|
-
}
|
|
1561
|
-
function Rn() {
|
|
1562
|
-
const { authToken: s } = je(), n = He(null), t = o((c) => c.applyFilters), [a, i] = T(""), h = o((c) => c.filterValues), r = o((c) => c.card.sql), l = _n();
|
|
1563
|
-
return /* @__PURE__ */ e.jsxs(
|
|
1564
|
-
Ms,
|
|
1565
|
-
{
|
|
1566
|
-
openDelay: 0,
|
|
1567
|
-
onOpenChange: async (c) => {
|
|
1568
|
-
if (!c)
|
|
1569
|
-
return;
|
|
1570
|
-
console.log("onOpenChange");
|
|
1571
|
-
const m = await Pe(
|
|
1572
|
-
"https://semaphor.cloud/api/v1/filter-sql",
|
|
1573
|
-
(s == null ? void 0 : s.accessToken) || "",
|
|
1574
|
-
{
|
|
1575
|
-
sql: r,
|
|
1576
|
-
active_filters: h,
|
|
1577
|
-
connection_type: l
|
|
1578
|
-
}
|
|
1579
|
-
);
|
|
1580
|
-
console.log(m), m.sql ? (console.log(m.records), i(m.sql)) : i("Error");
|
|
1581
|
-
},
|
|
1582
|
-
children: [
|
|
1583
|
-
/* @__PURE__ */ e.jsx(Os, { asChild: !0, children: t && /* @__PURE__ */ e.jsx("p", { className: "p-0 text-xs hover:cursor-pointer", children: "| Filter Query" }) }),
|
|
1584
|
-
/* @__PURE__ */ e.jsxs(Ds, { align: "end", className: "w-[600px]", children: [
|
|
1585
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex justify-between space-x-4", children: /* @__PURE__ */ e.jsx("div", { className: "rounded-sm bg-muted p-2", children: /* @__PURE__ */ e.jsxs("code", { ref: n, className: "font-mono text-sm", children: [
|
|
1586
|
-
a,
|
|
1587
|
-
/* @__PURE__ */ e.jsx(
|
|
1588
|
-
ct,
|
|
1589
|
-
{
|
|
1590
|
-
onClick: () => ea(n),
|
|
1591
|
-
className: "ml-3 inline-block h-4 w-4 opacity-70 hover:cursor-pointer hover:opacity-100"
|
|
1592
|
-
}
|
|
1593
|
-
)
|
|
1594
|
-
] }) }) }),
|
|
1595
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 pt-2", children: [
|
|
1596
|
-
/* @__PURE__ */ e.jsx(sa, { className: "h-4 w-4 opacity-70" }),
|
|
1597
|
-
/* @__PURE__ */ e.jsx("span", { className: "text-xs text-muted-foreground", children: "A preview of the query with filters applied." })
|
|
1598
|
-
] })
|
|
1599
|
-
] })
|
|
1600
|
-
]
|
|
1601
|
-
}
|
|
1602
|
-
);
|
|
1603
|
-
}
|
|
1604
|
-
const Hn = `
|
|
1605
|
-
|
|
1606
|
-
Use the following syntax to create a chart query. Please replace the x-axis, y-axis, stack-by, label, and measure with the actual column names of the table.
|
|
1607
|
-
|
|
1608
|
-
Bar / Line Chart:
|
|
1609
|
-
|
|
1610
|
-
SELECT x-axis, y-axis-1, y-axis-2, y-axis-3,... FROM table
|
|
1611
|
-
|
|
1612
|
-
- X-axis - Category
|
|
1613
|
-
- Y-axis - Number
|
|
1614
|
-
|
|
1615
|
-
Stacked Chart:
|
|
1616
|
-
|
|
1617
|
-
SELECT x-axis, stack-by, y-axis FROM table
|
|
1618
|
-
|
|
1619
|
-
- X-axis - Category
|
|
1620
|
-
- Stack by - Category
|
|
1621
|
-
- Y-axis - Number
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
Scatter Chart:
|
|
1625
|
-
|
|
1626
|
-
SELECT label, x-axis, y-axis FROM table
|
|
1627
|
-
|
|
1628
|
-
- Label - Category
|
|
1629
|
-
- Group (opt) - Category
|
|
1630
|
-
- X-axis - Number
|
|
1631
|
-
- Y-axis - Number
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
Bubble Chart:
|
|
1635
|
-
|
|
1636
|
-
SELECT label, x-axis, y-axis, radius FROM table
|
|
1637
|
-
|
|
1638
|
-
- Label - Category
|
|
1639
|
-
- Bubble Group (opt) - Category
|
|
1640
|
-
- X-axis - Number
|
|
1641
|
-
- Y-axis - Number
|
|
1642
|
-
- Radius - Number
|
|
1643
|
-
|
|
1644
|
-
Pie / Dougnut Chart:
|
|
1645
|
-
|
|
1646
|
-
SELECT label, measure FROM table
|
|
1647
|
-
|
|
1648
|
-
- Label - Category
|
|
1649
|
-
- Measure - Number
|
|
1650
|
-
`;
|
|
1651
|
-
function $n({
|
|
1652
|
-
open: s,
|
|
1653
|
-
setOpen: n,
|
|
1654
|
-
userInput: t,
|
|
1655
|
-
setUserInput: a,
|
|
1656
|
-
triggerAIRun: i,
|
|
1657
|
-
setTriggerAIRun: h
|
|
1658
|
-
}) {
|
|
1659
|
-
const r = He(null), l = He(null), { authToken: c } = je(), [m, u] = T(!1), g = o((S) => S.actions.setCardSql), j = w((S) => S.dashboard.baseQueries), d = o((S) => S.actions.setRunSql), x = o((S) => S.actions.setCardType), [v, f] = T([]), F = o((S) => S.currentColumns), M = o((S) => S.card.sql), N = o((S) => S.selectedTableName), V = `
|
|
1660
|
-
${t}
|
|
1661
|
-
|
|
1662
|
-
Database Query Dialect: ${N === "api" || N === "s3" ? "DuckDb" : ""}
|
|
1663
|
-
Table Name: ${N}
|
|
1664
|
-
Table Columns: ${F == null ? void 0 : F.map((S) => `${S.column_name} | ${S.data_type}`).join(", ")}
|
|
1665
|
-
User SQL: ${M}
|
|
1666
|
-
${j && `Base Queries: ${JSON.stringify(j)} `}`, q = ` 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.
|
|
1667
|
-
Visual Query Syntax: ${Hn}`, { data: _, isLoading: L, isFetching: C, isError: b, refetch: R } = he({
|
|
1668
|
-
queryKey: ["ai-query"],
|
|
1669
|
-
queryFn: () => ge(
|
|
1670
|
-
"https://semaphor.cloud/api/v1/ai",
|
|
1671
|
-
(c == null ? void 0 : c.accessToken) || "",
|
|
1672
|
-
{
|
|
1673
|
-
user_content: `userContent: ${V} ${m ? q : ""}`
|
|
1674
|
-
}
|
|
1675
|
-
),
|
|
1676
|
-
enabled: !1
|
|
1677
|
-
// Do not run by default.
|
|
1678
|
-
});
|
|
1679
|
-
function H(S) {
|
|
1680
|
-
if (S.toLowerCase().includes("bar"))
|
|
1681
|
-
x("bar");
|
|
1682
|
-
else if (S.toLowerCase().includes("line"))
|
|
1683
|
-
x("line");
|
|
1684
|
-
else if (S.toLowerCase().includes("bubble"))
|
|
1685
|
-
x("bubble");
|
|
1686
|
-
else if (S.toLowerCase().includes("scatter"))
|
|
1687
|
-
x("scatter");
|
|
1688
|
-
else if (S.toLowerCase().includes("stacked"))
|
|
1689
|
-
x("stackedBar");
|
|
1690
|
-
else if (S.toLowerCase().includes("pie"))
|
|
1691
|
-
x("pie");
|
|
1692
|
-
else if (S.toLowerCase().includes("donut") || S.toLowerCase().includes("doughnut"))
|
|
1693
|
-
x("doughnut");
|
|
1694
|
-
else if (S.toLowerCase().includes("radar"))
|
|
1695
|
-
x("radar");
|
|
1696
|
-
else
|
|
1697
|
-
return x("bar"), !1;
|
|
1698
|
-
return !0;
|
|
1699
|
-
}
|
|
1700
|
-
Y(() => {
|
|
1701
|
-
_ && f((S) => [...S, { role: "ai", content: _.response }]);
|
|
1702
|
-
}, [_]), Y(() => {
|
|
1703
|
-
const S = setTimeout(() => {
|
|
1704
|
-
var O;
|
|
1705
|
-
l.current && (l.current.scroll({
|
|
1706
|
-
top: l.current.scrollHeight,
|
|
1707
|
-
behavior: "smooth"
|
|
1708
|
-
}), (O = r.current) == null || O.focus());
|
|
1709
|
-
}, 100);
|
|
1710
|
-
return () => clearTimeout(S);
|
|
1711
|
-
}, [v]);
|
|
1712
|
-
function A() {
|
|
1713
|
-
t && (f((S) => [...S, { role: "user", content: t }]), H(t) && u(!0), a(""), R());
|
|
1714
|
-
}
|
|
1715
|
-
Y(() => {
|
|
1716
|
-
i && (A(), h(!1));
|
|
1717
|
-
}, [i, h]);
|
|
1718
|
-
const P = {
|
|
1719
|
-
//seleect a darker color
|
|
1720
|
-
// color: '#000',
|
|
1721
|
-
fontFamily: "Arial, sans-serif",
|
|
1722
|
-
lineHeight: 1.6,
|
|
1723
|
-
fontSize: 15,
|
|
1724
|
-
// padding: '5px',
|
|
1725
|
-
width: "100%"
|
|
1726
|
-
}, X = {
|
|
1727
|
-
// background: '#f6f8fa',
|
|
1728
|
-
// color: '#000',
|
|
1729
|
-
fontFamily: "monospace",
|
|
1730
|
-
fontSize: 14,
|
|
1731
|
-
lineHeight: 1.6
|
|
1732
|
-
// padding: 20,
|
|
1733
|
-
}, W = {
|
|
1734
|
-
// color: '#000',
|
|
1735
|
-
fontFamily: "Arial, sans-serif",
|
|
1736
|
-
lineHeight: 1.6,
|
|
1737
|
-
fontSize: 15,
|
|
1738
|
-
padding: "2px 0",
|
|
1739
|
-
// add a bit of left margin to make it look nice
|
|
1740
|
-
marginLeft: 20,
|
|
1741
|
-
// add bullet points for unordered lists
|
|
1742
|
-
listStyleType: "disc"
|
|
1743
|
-
}, re = {
|
|
1744
|
-
// Override how paragraphs are rendered
|
|
1745
|
-
p: ({ node: S, ...O }) => /* @__PURE__ */ e.jsx("p", { style: P, ...O }),
|
|
1746
|
-
code: ({ node: S, ...O }) => /* @__PURE__ */ e.jsx("code", { className: "rounded-sm bg-muted px-2 py-1 text-sm", ...O }),
|
|
1747
|
-
pre: ({ node: S, ...O }) => /* @__PURE__ */ e.jsxs("pre", { className: "space-y-2 rounded-sm bg-muted/50 p-3", style: X, children: [
|
|
1748
|
-
/* @__PURE__ */ e.jsx("code", { className: "whitespace-normal text-sm", children: O.children }),
|
|
1749
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex justify-start gap-2", children: [
|
|
1750
|
-
/* @__PURE__ */ e.jsx(z, { onClick: K, size: "sm", variant: "outline", children: /* @__PURE__ */ e.jsx(ct, {}) }),
|
|
1751
|
-
/* @__PURE__ */ e.jsx(
|
|
1752
|
-
z,
|
|
1753
|
-
{
|
|
1754
|
-
onClick: (J) => {
|
|
1755
|
-
const k = K(J);
|
|
1756
|
-
k && (n(!1), g(k), d(!0));
|
|
1757
|
-
},
|
|
1758
|
-
size: "sm",
|
|
1759
|
-
variant: "outline",
|
|
1760
|
-
children: /* @__PURE__ */ e.jsx(na, {})
|
|
1761
|
-
}
|
|
1762
|
-
)
|
|
1763
|
-
] })
|
|
1764
|
-
] }),
|
|
1765
|
-
li: ({ node: S, ...O }) => /* @__PURE__ */ e.jsx("li", { style: W, ...O })
|
|
1766
|
-
// You can add more overrides for other elements like h1, h2, etc.
|
|
1767
|
-
};
|
|
1768
|
-
function K(S) {
|
|
1769
|
-
const O = S.currentTarget.closest("pre");
|
|
1770
|
-
if (!O)
|
|
1771
|
-
return;
|
|
1772
|
-
const J = O.textContent || O.innerText;
|
|
1773
|
-
return navigator.clipboard.writeText(J).then(() => console.log("Text copied to clipboard")).catch((k) => console.error("Error in copying text: ", k)), J;
|
|
1774
|
-
}
|
|
1775
|
-
function ie() {
|
|
1776
|
-
return v == null ? void 0 : v.map((S, O) => S.role === "user" ? /* @__PURE__ */ e.jsxs(
|
|
1777
|
-
"div",
|
|
1778
|
-
{
|
|
1779
|
-
className: "flex items-start rounded-md bg-muted p-3 text-sm",
|
|
1780
|
-
children: [
|
|
1781
|
-
/* @__PURE__ */ e.jsx(kn, { className: "mr-2 h-5 w-5" }),
|
|
1782
|
-
/* @__PURE__ */ e.jsx("div", { children: S.content })
|
|
1783
|
-
]
|
|
1784
|
-
},
|
|
1785
|
-
O
|
|
1786
|
-
) : S.role === "ai" ? /* @__PURE__ */ e.jsx(
|
|
1787
|
-
aa,
|
|
1788
|
-
{
|
|
1789
|
-
className: "w-full overflow-auto py-1",
|
|
1790
|
-
components: re,
|
|
1791
|
-
children: _ == null ? void 0 : _.response.replace(/DuckDB/gi, "Semaphor")
|
|
1792
|
-
},
|
|
1793
|
-
O
|
|
1794
|
-
) : /* @__PURE__ */ e.jsx("div", {}, O));
|
|
1795
|
-
}
|
|
1796
|
-
return /* @__PURE__ */ e.jsxs(ys, { open: s, onOpenChange: n, children: [
|
|
1797
|
-
/* @__PURE__ */ e.jsx(vs, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
1798
|
-
z,
|
|
1799
|
-
{
|
|
1800
|
-
size: "sm",
|
|
1801
|
-
className: "w-full justify-start border font-normal text-muted-foreground focus-visible:ring-0 focus-visible:ring-offset-0",
|
|
1802
|
-
variant: "secondary",
|
|
1803
|
-
children: "Type your question here..."
|
|
1804
|
-
}
|
|
1805
|
-
) }),
|
|
1806
|
-
/* @__PURE__ */ e.jsxs(
|
|
1807
|
-
Cs,
|
|
1808
|
-
{
|
|
1809
|
-
className: "flex flex-col justify-between overflow-auto sm:max-w-[425px] md:max-h-[625px] md:min-w-[625px]",
|
|
1810
|
-
children: [
|
|
1811
|
-
/* @__PURE__ */ e.jsxs(Ss, { children: [
|
|
1812
|
-
/* @__PURE__ */ e.jsx(ws, { children: "Assistant" }),
|
|
1813
|
-
/* @__PURE__ */ e.jsx(ks, { children: "What can I help you with?" })
|
|
1814
|
-
] }),
|
|
1815
|
-
/* @__PURE__ */ e.jsx(
|
|
1816
|
-
"div",
|
|
1817
|
-
{
|
|
1818
|
-
ref: l,
|
|
1819
|
-
className: "h-[625px] w-full overflow-auto border-t border-t-muted",
|
|
1820
|
-
children: /* @__PURE__ */ e.jsx("div", { className: "space-y-4 py-2 pr-3", role: "messages", children: ie() })
|
|
1821
|
-
}
|
|
1822
|
-
),
|
|
1823
|
-
/* @__PURE__ */ e.jsx(
|
|
1824
|
-
"div",
|
|
1825
|
-
{
|
|
1826
|
-
children: /* @__PURE__ */ e.jsxs("div", { className: "flex w-full items-center rounded-md border", children: [
|
|
1827
|
-
/* @__PURE__ */ e.jsx(
|
|
1828
|
-
dt,
|
|
1829
|
-
{
|
|
1830
|
-
autoFocus: !0,
|
|
1831
|
-
ref: r,
|
|
1832
|
-
onKeyDown: (S) => {
|
|
1833
|
-
S.key === "Enter" && !S.shiftKey && (S.preventDefault(), a(""), A());
|
|
1834
|
-
},
|
|
1835
|
-
placeholder: "Type your question here...",
|
|
1836
|
-
onFocus: (S) => {
|
|
1837
|
-
const O = S.target, J = O.value.length;
|
|
1838
|
-
O.setSelectionRange(J, J);
|
|
1839
|
-
},
|
|
1840
|
-
className: Z(
|
|
1841
|
-
"max-h-10 min-h-7 resize-none border-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
|
|
1842
|
-
),
|
|
1843
|
-
disabled: L || C,
|
|
1844
|
-
value: t,
|
|
1845
|
-
onChange: (S) => a(S.target.value)
|
|
1846
|
-
}
|
|
1847
|
-
),
|
|
1848
|
-
" ",
|
|
1849
|
-
/* @__PURE__ */ e.jsx(
|
|
1850
|
-
z,
|
|
1851
|
-
{
|
|
1852
|
-
className: "h-8",
|
|
1853
|
-
size: "sm",
|
|
1854
|
-
variant: "ghost",
|
|
1855
|
-
onClick: A,
|
|
1856
|
-
children: !L && !C ? /* @__PURE__ */ e.jsx(ta, {}) : /* @__PURE__ */ e.jsx($e, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" })
|
|
1857
|
-
}
|
|
1858
|
-
)
|
|
1859
|
-
] })
|
|
1860
|
-
}
|
|
1861
|
-
)
|
|
1862
|
-
]
|
|
1863
|
-
}
|
|
1864
|
-
)
|
|
1865
|
-
] });
|
|
1866
|
-
}
|
|
1867
|
-
var St = {
|
|
1868
|
-
color: void 0,
|
|
1869
|
-
size: void 0,
|
|
1870
|
-
className: void 0,
|
|
1871
|
-
style: void 0,
|
|
1872
|
-
attr: void 0
|
|
1873
|
-
}, Ys = me.createContext && /* @__PURE__ */ me.createContext(St), Pn = ["attr", "size", "title"];
|
|
1874
|
-
function Bn(s, n) {
|
|
1875
|
-
if (s == null)
|
|
1876
|
-
return {};
|
|
1877
|
-
var t = Gn(s, n), a, i;
|
|
1878
|
-
if (Object.getOwnPropertySymbols) {
|
|
1879
|
-
var h = Object.getOwnPropertySymbols(s);
|
|
1880
|
-
for (i = 0; i < h.length; i++)
|
|
1881
|
-
a = h[i], !(n.indexOf(a) >= 0) && Object.prototype.propertyIsEnumerable.call(s, a) && (t[a] = s[a]);
|
|
1882
|
-
}
|
|
1883
|
-
return t;
|
|
1884
|
-
}
|
|
1885
|
-
function Gn(s, n) {
|
|
1886
|
-
if (s == null)
|
|
1887
|
-
return {};
|
|
1888
|
-
var t = {}, a = Object.keys(s), i, h;
|
|
1889
|
-
for (h = 0; h < a.length; h++)
|
|
1890
|
-
i = a[h], !(n.indexOf(i) >= 0) && (t[i] = s[i]);
|
|
1891
|
-
return t;
|
|
1892
|
-
}
|
|
1893
|
-
function es() {
|
|
1894
|
-
return es = Object.assign ? Object.assign.bind() : function(s) {
|
|
1895
|
-
for (var n = 1; n < arguments.length; n++) {
|
|
1896
|
-
var t = arguments[n];
|
|
1897
|
-
for (var a in t)
|
|
1898
|
-
Object.prototype.hasOwnProperty.call(t, a) && (s[a] = t[a]);
|
|
1899
|
-
}
|
|
1900
|
-
return s;
|
|
1901
|
-
}, es.apply(this, arguments);
|
|
1902
|
-
}
|
|
1903
|
-
function Zs(s, n) {
|
|
1904
|
-
var t = Object.keys(s);
|
|
1905
|
-
if (Object.getOwnPropertySymbols) {
|
|
1906
|
-
var a = Object.getOwnPropertySymbols(s);
|
|
1907
|
-
n && (a = a.filter(function(i) {
|
|
1908
|
-
return Object.getOwnPropertyDescriptor(s, i).enumerable;
|
|
1909
|
-
})), t.push.apply(t, a);
|
|
1910
|
-
}
|
|
1911
|
-
return t;
|
|
1912
|
-
}
|
|
1913
|
-
function ss(s) {
|
|
1914
|
-
for (var n = 1; n < arguments.length; n++) {
|
|
1915
|
-
var t = arguments[n] != null ? arguments[n] : {};
|
|
1916
|
-
n % 2 ? Zs(Object(t), !0).forEach(function(a) {
|
|
1917
|
-
Un(s, a, t[a]);
|
|
1918
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(t)) : Zs(Object(t)).forEach(function(a) {
|
|
1919
|
-
Object.defineProperty(s, a, Object.getOwnPropertyDescriptor(t, a));
|
|
1920
|
-
});
|
|
1921
|
-
}
|
|
1922
|
-
return s;
|
|
1923
|
-
}
|
|
1924
|
-
function Un(s, n, t) {
|
|
1925
|
-
return n = Kn(n), n in s ? Object.defineProperty(s, n, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : s[n] = t, s;
|
|
1926
|
-
}
|
|
1927
|
-
function Kn(s) {
|
|
1928
|
-
var n = Wn(s, "string");
|
|
1929
|
-
return typeof n == "symbol" ? n : String(n);
|
|
1930
|
-
}
|
|
1931
|
-
function Wn(s, n) {
|
|
1932
|
-
if (typeof s != "object" || s === null)
|
|
1933
|
-
return s;
|
|
1934
|
-
var t = s[Symbol.toPrimitive];
|
|
1935
|
-
if (t !== void 0) {
|
|
1936
|
-
var a = t.call(s, n || "default");
|
|
1937
|
-
if (typeof a != "object")
|
|
1938
|
-
return a;
|
|
1939
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1940
|
-
}
|
|
1941
|
-
return (n === "string" ? String : Number)(s);
|
|
1942
|
-
}
|
|
1943
|
-
function wt(s) {
|
|
1944
|
-
return s && s.map((n, t) => /* @__PURE__ */ me.createElement(n.tag, ss({
|
|
1945
|
-
key: t
|
|
1946
|
-
}, n.attr), wt(n.child)));
|
|
1947
|
-
}
|
|
1948
|
-
function xe(s) {
|
|
1949
|
-
return (n) => /* @__PURE__ */ me.createElement(Qn, es({
|
|
1950
|
-
attr: ss({}, s.attr)
|
|
1951
|
-
}, n), wt(s.child));
|
|
1952
|
-
}
|
|
1953
|
-
function Qn(s) {
|
|
1954
|
-
var n = (t) => {
|
|
1955
|
-
var {
|
|
1956
|
-
attr: a,
|
|
1957
|
-
size: i,
|
|
1958
|
-
title: h
|
|
1959
|
-
} = s, r = Bn(s, Pn), l = i || t.size || "1em", c;
|
|
1960
|
-
return t.className && (c = t.className), s.className && (c = (c ? c + " " : "") + s.className), /* @__PURE__ */ me.createElement("svg", es({
|
|
1961
|
-
stroke: "currentColor",
|
|
1962
|
-
fill: "currentColor",
|
|
1963
|
-
strokeWidth: "0"
|
|
1964
|
-
}, t.attr, a, r, {
|
|
1965
|
-
className: c,
|
|
1966
|
-
style: ss(ss({
|
|
1967
|
-
color: s.color || t.color
|
|
1968
|
-
}, t.style), s.style),
|
|
1969
|
-
height: l,
|
|
1970
|
-
width: l,
|
|
1971
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
1972
|
-
}), h && /* @__PURE__ */ me.createElement("title", null, h), s.children);
|
|
1973
|
-
};
|
|
1974
|
-
return Ys !== void 0 ? /* @__PURE__ */ me.createElement(Ys.Consumer, null, (t) => n(t)) : n(St);
|
|
1975
|
-
}
|
|
1976
|
-
function Jn(s) {
|
|
1977
|
-
return xe({ 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);
|
|
1978
|
-
}
|
|
1979
|
-
function Yn() {
|
|
1980
|
-
const { theme: s } = ra(), n = He(), t = He(), [a, i] = T(!1), [h, r] = T(!1), [l, c] = T(!1), [m, u] = T(""), [g, j] = T(!1), { authToken: d } = je();
|
|
1981
|
-
w((p) => p.selectedSheetId);
|
|
1982
|
-
const x = w((p) => p.dashboard.baseQueries), v = o((p) => p.card), f = w((p) => p.theme), F = o((p) => p.isShowingVisual), M = o(
|
|
1983
|
-
(p) => p.selectedConnectionId
|
|
1984
|
-
), N = o(
|
|
1985
|
-
(p) => p.selectedDatabaseName
|
|
1986
|
-
), V = o(
|
|
1987
|
-
(p) => p.selectedDatamodelId
|
|
1988
|
-
), q = o(
|
|
1989
|
-
(p) => p.selectedSchemaName
|
|
1990
|
-
);
|
|
1991
|
-
w(
|
|
1992
|
-
(p) => p.actions.updateFrameCard
|
|
1993
|
-
);
|
|
1994
|
-
const _ = o((p) => p.selectedTableName), L = o((p) => p.card.sql), C = o((p) => p.card.python), b = ia(L, x), R = o((p) => p.selectedConnectionId), H = o((p) => p.frame), A = w((p) => p.filterValues), P = o((p) => p.applyFilters), {
|
|
1995
|
-
setCardCustomCfg: X,
|
|
1996
|
-
setQueryResultColumns: W,
|
|
1997
|
-
setFilterValues: re,
|
|
1998
|
-
setCardSql: K,
|
|
1999
|
-
setCardPython: ie,
|
|
2000
|
-
setQueryError: S,
|
|
2001
|
-
setPythonStdOut: O,
|
|
2002
|
-
setCardPreferences: J
|
|
2003
|
-
} = o((p) => p.actions), k = o((p) => p.onSave), I = o(
|
|
2004
|
-
(p) => p.actions.setApplyFilters
|
|
2005
|
-
), ee = o((p) => p.onClose), E = o((p) => p.actions.setCardData), se = o((p) => p.actions.setSqlGen), ae = o((p) => p.runSql), be = o((p) => p.actions.setRunSql), pe = o(
|
|
2006
|
-
(p) => p.actions.setIsSqlRunning
|
|
2007
|
-
), {
|
|
2008
|
-
data: Q,
|
|
2009
|
-
isLoading: le,
|
|
2010
|
-
isFetching: oe,
|
|
2011
|
-
isSuccess: ye,
|
|
2012
|
-
isError: ce,
|
|
2013
|
-
error: fe,
|
|
2014
|
-
status: Rs,
|
|
2015
|
-
refetch: Ce
|
|
2016
|
-
} = he({
|
|
2017
|
-
queryKey: [b, C],
|
|
2018
|
-
queryFn: () => Pe(
|
|
2019
|
-
"https://semaphor.cloud/api/v1/query",
|
|
2020
|
-
(d == null ? void 0 : d.accessToken) || "",
|
|
2021
|
-
{
|
|
2022
|
-
connection_id: R,
|
|
2023
|
-
sql: b,
|
|
2024
|
-
python: C === Bs ? "" : C,
|
|
2025
|
-
active_filters: P ? A : []
|
|
2026
|
-
}
|
|
2027
|
-
),
|
|
2028
|
-
enabled: !1,
|
|
2029
|
-
retry: !1
|
|
2030
|
-
});
|
|
2031
|
-
Y(() => {
|
|
2032
|
-
if (Q && (E(Q.records), Q.rowLimitExceeded && Xe.error("Row limit (10,000) exceeded. Refine your query.", {
|
|
2033
|
-
position: "top-center",
|
|
2034
|
-
richColors: !0
|
|
2035
|
-
}), O((Q == null ? void 0 : Q.output) || ""), Q.records.length > 0)) {
|
|
2036
|
-
const { dimensionKeys: p } = xs(Q.records);
|
|
2037
|
-
W(p);
|
|
2038
|
-
}
|
|
2039
|
-
}, [Q, E, W, O]), Y(() => {
|
|
2040
|
-
ae && (Ce(), be(!1));
|
|
2041
|
-
}, [ae, Ce, be]), Y(() => {
|
|
2042
|
-
(le || oe) && pe(!0), (ce || ye) && pe(!1), ce ? (S(fe.message), E([]), W([]), O("")) : S("");
|
|
2043
|
-
}, [
|
|
2044
|
-
le,
|
|
2045
|
-
oe,
|
|
2046
|
-
Q,
|
|
2047
|
-
O,
|
|
2048
|
-
ce,
|
|
2049
|
-
ye,
|
|
2050
|
-
pe,
|
|
2051
|
-
E,
|
|
2052
|
-
W,
|
|
2053
|
-
S,
|
|
2054
|
-
fe
|
|
2055
|
-
]);
|
|
2056
|
-
function os() {
|
|
2057
|
-
K(""), E([]), se({}), X(""), J({});
|
|
2058
|
-
}
|
|
2059
|
-
const Be = (p) => {
|
|
2060
|
-
t.current = p;
|
|
2061
|
-
};
|
|
2062
|
-
function cs(p, y) {
|
|
2063
|
-
if (p.length === 0)
|
|
2064
|
-
return "";
|
|
2065
|
-
if (y) {
|
|
2066
|
-
const ve = p.find((ne) => ne.id === y);
|
|
2067
|
-
if (ve) {
|
|
2068
|
-
const ne = ve.tabTitle;
|
|
2069
|
-
if (ne == "All__Header")
|
|
2070
|
-
return p[0].id;
|
|
2071
|
-
if (ne && ne.endsWith("__Header")) {
|
|
2072
|
-
const Vt = ne.split("__")[0], Hs = p.find(
|
|
2073
|
-
(_t) => _t.tabTitle === Vt
|
|
2074
|
-
);
|
|
2075
|
-
return Hs ? Hs.id : p[0].id;
|
|
2076
|
-
}
|
|
2077
|
-
return y;
|
|
2078
|
-
}
|
|
2079
|
-
}
|
|
2080
|
-
return p[0].id;
|
|
2081
|
-
}
|
|
2082
|
-
function ds() {
|
|
2083
|
-
let p = L;
|
|
2084
|
-
L && !L.includes("{{") && (p = En(L), K(p));
|
|
2085
|
-
const y = {
|
|
2086
|
-
...v,
|
|
2087
|
-
lastSelectedSchema: q,
|
|
2088
|
-
lastSelectedDatamodelId: V,
|
|
2089
|
-
lastSelectedDatabase: N,
|
|
2090
|
-
lastSelectedTable: _,
|
|
2091
|
-
connectionId: M,
|
|
2092
|
-
type: F ? v.type : "table",
|
|
2093
|
-
sql: p,
|
|
2094
|
-
customCfg: F ? v.customCfg : null
|
|
2095
|
-
}, ve = H.cards.map(
|
|
2096
|
-
(hs) => hs.id === v.id ? y : hs
|
|
2097
|
-
), ne = {
|
|
2098
|
-
...H,
|
|
2099
|
-
cards: ve,
|
|
2100
|
-
activeCardId: cs(ve, H.activeCardId)
|
|
2101
|
-
};
|
|
2102
|
-
k == null || k(ne);
|
|
2103
|
-
}
|
|
2104
|
-
function Ge() {
|
|
2105
|
-
ee == null || ee();
|
|
2106
|
-
}
|
|
2107
|
-
Y(() => {
|
|
2108
|
-
const p = n.current, y = t.current;
|
|
2109
|
-
if (p) {
|
|
2110
|
-
const ve = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", ne = f === "system" ? ve : f;
|
|
2111
|
-
p.editor.defineTheme("default", {
|
|
2112
|
-
// base: theme === 'light' ? 'hc-light' : 'vs-dark',
|
|
2113
|
-
base: ne === "light" ? "vs" : "vs-dark",
|
|
2114
|
-
inherit: !0,
|
|
2115
|
-
rules: [],
|
|
2116
|
-
colors: {
|
|
2117
|
-
// 'editor.background': activeTheme === 'light' ? '#ffffff' : '#020817',
|
|
2118
|
-
"editor.background": ne === "light" ? "#ffffff" : la("--semaphor-background")
|
|
2119
|
-
}
|
|
2120
|
-
}), p.editor.setTheme("default");
|
|
2121
|
-
}
|
|
2122
|
-
return y && p && y.addCommand(
|
|
2123
|
-
p.KeyMod.Shift | p.KeyCode.Enter,
|
|
2124
|
-
function() {
|
|
2125
|
-
return console.log("Executing query..."), Ce(), !1;
|
|
2126
|
-
}
|
|
2127
|
-
), () => {
|
|
2128
|
-
};
|
|
2129
|
-
}, [s, f, n.current]);
|
|
2130
|
-
function Ie(p) {
|
|
2131
|
-
n.current = p;
|
|
2132
|
-
}
|
|
2133
|
-
function Ue() {
|
|
2134
|
-
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
2135
|
-
h && /* @__PURE__ */ e.jsx(
|
|
2136
|
-
"div",
|
|
2137
|
-
{
|
|
2138
|
-
className: "xbg-yellow-100 relative flex w-1/3 min-w-0 grow overflow-hidden border-l p-1 text-xs",
|
|
2139
|
-
role: "editor-filter-container",
|
|
2140
|
-
children: /* @__PURE__ */ e.jsxs("div", { className: "w-[99%]", children: [
|
|
2141
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 pt-3", children: [
|
|
2142
|
-
/* @__PURE__ */ e.jsx(
|
|
2143
|
-
Vn,
|
|
2144
|
-
{
|
|
2145
|
-
checked: P,
|
|
2146
|
-
onCheckedChange: () => I(!P),
|
|
2147
|
-
text: "Apply Filters"
|
|
2148
|
-
}
|
|
2149
|
-
),
|
|
2150
|
-
/* @__PURE__ */ e.jsx(Rn, {}),
|
|
2151
|
-
A && h && /* @__PURE__ */ e.jsx(
|
|
2152
|
-
Ve,
|
|
2153
|
-
{
|
|
2154
|
-
onClick: () => r(!1),
|
|
2155
|
-
className: "bg-background/50 text-foreground/50 hover:cursor-pointer hover:text-foreground"
|
|
2156
|
-
}
|
|
2157
|
-
)
|
|
2158
|
-
] }),
|
|
2159
|
-
/* @__PURE__ */ e.jsx(
|
|
2160
|
-
qe,
|
|
2161
|
-
{
|
|
2162
|
-
theme: "default",
|
|
2163
|
-
onChange: (p) => {
|
|
2164
|
-
if (p)
|
|
2165
|
-
try {
|
|
2166
|
-
JSON.parse(p), re(JSON.parse(p));
|
|
2167
|
-
} catch {
|
|
2168
|
-
}
|
|
2169
|
-
},
|
|
2170
|
-
defaultLanguage: "json",
|
|
2171
|
-
className: "mt-1 min-h-[220px]",
|
|
2172
|
-
value: JSON.stringify(A, null, 2),
|
|
2173
|
-
options: {
|
|
2174
|
-
readOnly: !0,
|
|
2175
|
-
minimap: {
|
|
2176
|
-
enabled: !1
|
|
2177
|
-
},
|
|
2178
|
-
lineNumbers: "off",
|
|
2179
|
-
glyphMargin: !1,
|
|
2180
|
-
wordWrap: "on",
|
|
2181
|
-
scrollbar: {
|
|
2182
|
-
verticalScrollbarSize: 0,
|
|
2183
|
-
horizontalScrollbarSize: 0
|
|
2184
|
-
},
|
|
2185
|
-
fontSize: 12,
|
|
2186
|
-
renderLineHighlight: "none"
|
|
2187
|
-
}
|
|
2188
|
-
}
|
|
2189
|
-
)
|
|
2190
|
-
] })
|
|
2191
|
-
}
|
|
2192
|
-
),
|
|
2193
|
-
A && !h && /* @__PURE__ */ e.jsx(
|
|
2194
|
-
tt,
|
|
2195
|
-
{
|
|
2196
|
-
onClick: () => r(!0),
|
|
2197
|
-
className: Z(
|
|
2198
|
-
"absolute bottom-4 right-6 h-3 w-3 text-foreground/50 hover:cursor-pointer hover:text-foreground",
|
|
2199
|
-
{
|
|
2200
|
-
"font-bold text-red-800": P
|
|
2201
|
-
}
|
|
2202
|
-
)
|
|
2203
|
-
}
|
|
2204
|
-
)
|
|
2205
|
-
] });
|
|
2206
|
-
}
|
|
2207
|
-
function Ke() {
|
|
2208
|
-
return /* @__PURE__ */ e.jsxs(
|
|
2209
|
-
ps,
|
|
2210
|
-
{
|
|
2211
|
-
className: "flex grow pb-1",
|
|
2212
|
-
direction: "vertical",
|
|
2213
|
-
role: "editor-resizable-group",
|
|
2214
|
-
children: [
|
|
2215
|
-
/* @__PURE__ */ e.jsxs(
|
|
2216
|
-
we,
|
|
2217
|
-
{
|
|
2218
|
-
id: "1",
|
|
2219
|
-
order: 1,
|
|
2220
|
-
defaultSize: a ? 20 : 100,
|
|
2221
|
-
className: "relative flex grow",
|
|
2222
|
-
children: [
|
|
2223
|
-
/* @__PURE__ */ e.jsx(
|
|
2224
|
-
"div",
|
|
2225
|
-
{
|
|
2226
|
-
role: "sql-container",
|
|
2227
|
-
className: "relative flex w-[99%]",
|
|
2228
|
-
children: /* @__PURE__ */ e.jsx(
|
|
2229
|
-
qe,
|
|
2230
|
-
{
|
|
2231
|
-
theme: "default",
|
|
2232
|
-
className: "pt-3",
|
|
2233
|
-
onChange: (p) => {
|
|
2234
|
-
K(p);
|
|
2235
|
-
},
|
|
2236
|
-
value: L,
|
|
2237
|
-
options: {
|
|
2238
|
-
minimap: {
|
|
2239
|
-
enabled: !1
|
|
2240
|
-
},
|
|
2241
|
-
wordWrap: "on",
|
|
2242
|
-
scrollbar: {
|
|
2243
|
-
verticalScrollbarSize: 0,
|
|
2244
|
-
horizontalScrollbarSize: 0
|
|
2245
|
-
},
|
|
2246
|
-
fontSize: 14,
|
|
2247
|
-
renderLineHighlight: "none"
|
|
2248
|
-
},
|
|
2249
|
-
defaultLanguage: "sql",
|
|
2250
|
-
beforeMount: Ie,
|
|
2251
|
-
onMount: Be
|
|
2252
|
-
}
|
|
2253
|
-
)
|
|
2254
|
-
}
|
|
2255
|
-
),
|
|
2256
|
-
a && /* @__PURE__ */ e.jsx("code", { className: "absolute right-6 top-3 text-sm text-muted-foreground/70", children: "sql" })
|
|
2257
|
-
]
|
|
2258
|
-
}
|
|
2259
|
-
),
|
|
2260
|
-
a && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
2261
|
-
/* @__PURE__ */ e.jsx(fs, { withHandle: !0, className: "border" }),
|
|
2262
|
-
/* @__PURE__ */ e.jsxs(
|
|
2263
|
-
we,
|
|
2264
|
-
{
|
|
2265
|
-
id: "2",
|
|
2266
|
-
order: 2,
|
|
2267
|
-
defaultSize: 80,
|
|
2268
|
-
className: "relative flex grow",
|
|
2269
|
-
children: [
|
|
2270
|
-
/* @__PURE__ */ e.jsx(
|
|
2271
|
-
"div",
|
|
2272
|
-
{
|
|
2273
|
-
role: "python-container",
|
|
2274
|
-
className: "relative flex w-[99%] pt-0",
|
|
2275
|
-
children: /* @__PURE__ */ e.jsx(
|
|
2276
|
-
qe,
|
|
2277
|
-
{
|
|
2278
|
-
className: "pt-3",
|
|
2279
|
-
theme: "default",
|
|
2280
|
-
onChange: (p) => {
|
|
2281
|
-
ie(p && p.trim() || "");
|
|
2282
|
-
},
|
|
2283
|
-
value: C || Bs,
|
|
2284
|
-
options: {
|
|
2285
|
-
minimap: {
|
|
2286
|
-
enabled: !1
|
|
2287
|
-
},
|
|
2288
|
-
wordWrap: "on",
|
|
2289
|
-
scrollbar: {
|
|
2290
|
-
verticalScrollbarSize: 0,
|
|
2291
|
-
horizontalScrollbarSize: 0
|
|
2292
|
-
},
|
|
2293
|
-
fontSize: 14,
|
|
2294
|
-
renderLineHighlight: "none"
|
|
2295
|
-
},
|
|
2296
|
-
defaultLanguage: "python",
|
|
2297
|
-
beforeMount: Ie,
|
|
2298
|
-
onMount: Be
|
|
2299
|
-
}
|
|
2300
|
-
)
|
|
2301
|
-
}
|
|
2302
|
-
),
|
|
2303
|
-
/* @__PURE__ */ e.jsx("code", { className: "absolute right-6 top-3 text-sm text-muted-foreground/70", children: "python" })
|
|
2304
|
-
]
|
|
2305
|
-
}
|
|
2306
|
-
)
|
|
2307
|
-
] })
|
|
2308
|
-
]
|
|
2309
|
-
}
|
|
2310
|
-
);
|
|
2311
|
-
}
|
|
2312
|
-
return (
|
|
2313
|
-
// This is a tricky css, the pt-8 is to make sure the editor doesn't slide under the header
|
|
2314
|
-
/* @__PURE__ */ e.jsxs(
|
|
2315
|
-
"section",
|
|
2316
|
-
{
|
|
2317
|
-
role: "editor-section",
|
|
2318
|
-
className: "flex grow flex-col justify-end",
|
|
2319
|
-
children: [
|
|
2320
|
-
/* @__PURE__ */ e.jsxs(
|
|
2321
|
-
"div",
|
|
2322
|
-
{
|
|
2323
|
-
role: "sql-editor",
|
|
2324
|
-
className: "relative flex grow justify-between overflow-y-scroll",
|
|
2325
|
-
children: [
|
|
2326
|
-
Ke(),
|
|
2327
|
-
Ue()
|
|
2328
|
-
]
|
|
2329
|
-
}
|
|
2330
|
-
),
|
|
2331
|
-
/* @__PURE__ */ e.jsxs(
|
|
2332
|
-
"div",
|
|
2333
|
-
{
|
|
2334
|
-
role: "editor-controls",
|
|
2335
|
-
className: "item-center flex flex-wrap justify-between gap-2 px-6 py-4",
|
|
2336
|
-
children: [
|
|
2337
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex grow items-center gap-2", children: [
|
|
2338
|
-
/* @__PURE__ */ e.jsxs(
|
|
2339
|
-
z,
|
|
2340
|
-
{
|
|
2341
|
-
title: "Shift + Enter",
|
|
2342
|
-
disabled: le || oe,
|
|
2343
|
-
onClick: () => {
|
|
2344
|
-
Ce();
|
|
2345
|
-
},
|
|
2346
|
-
className: "shrink-0",
|
|
2347
|
-
size: "sm",
|
|
2348
|
-
variant: "outline",
|
|
2349
|
-
children: [
|
|
2350
|
-
le || oe ? /* @__PURE__ */ e.jsx($e, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx(jn, { className: "mr-2 h-4 w-4" }),
|
|
2351
|
-
"Run"
|
|
2352
|
-
]
|
|
2353
|
-
}
|
|
2354
|
-
),
|
|
2355
|
-
ce && /* @__PURE__ */ e.jsx(
|
|
2356
|
-
qn,
|
|
2357
|
-
{
|
|
2358
|
-
error: fe.message,
|
|
2359
|
-
setShowAIDialog: c,
|
|
2360
|
-
setTriggerAIRun: j,
|
|
2361
|
-
setUserInputforAI: u
|
|
2362
|
-
}
|
|
2363
|
-
),
|
|
2364
|
-
/* @__PURE__ */ e.jsxs(
|
|
2365
|
-
z,
|
|
2366
|
-
{
|
|
2367
|
-
onClick: os,
|
|
2368
|
-
className: "",
|
|
2369
|
-
size: "sm",
|
|
2370
|
-
variant: "outline",
|
|
2371
|
-
children: [
|
|
2372
|
-
/* @__PURE__ */ e.jsx(ln, { className: "mr-2 size-4" }),
|
|
2373
|
-
"Clear"
|
|
2374
|
-
]
|
|
2375
|
-
}
|
|
2376
|
-
),
|
|
2377
|
-
/* @__PURE__ */ e.jsx(
|
|
2378
|
-
lt,
|
|
2379
|
-
{
|
|
2380
|
-
pressed: a,
|
|
2381
|
-
onPressedChange: (p) => i(p),
|
|
2382
|
-
className: "",
|
|
2383
|
-
size: "sm",
|
|
2384
|
-
variant: "outline",
|
|
2385
|
-
children: /* @__PURE__ */ e.jsx(Jn, { className: "size-4 text-foreground/70" })
|
|
2386
|
-
}
|
|
2387
|
-
),
|
|
2388
|
-
/* @__PURE__ */ e.jsx(
|
|
2389
|
-
$n,
|
|
2390
|
-
{
|
|
2391
|
-
open: l,
|
|
2392
|
-
setOpen: c,
|
|
2393
|
-
userInput: m,
|
|
2394
|
-
triggerAIRun: g,
|
|
2395
|
-
setTriggerAIRun: j,
|
|
2396
|
-
setUserInput: (p) => u(p)
|
|
2397
|
-
}
|
|
2398
|
-
)
|
|
2399
|
-
] }),
|
|
2400
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-end gap-2", children: [
|
|
2401
|
-
/* @__PURE__ */ e.jsxs(
|
|
2402
|
-
z,
|
|
2403
|
-
{
|
|
2404
|
-
onClick: ds,
|
|
2405
|
-
size: "sm",
|
|
2406
|
-
variant: "outline",
|
|
2407
|
-
children: [
|
|
2408
|
-
/* @__PURE__ */ e.jsx(oa, { className: "mr-2 size-4 font-bold text-green-600" }),
|
|
2409
|
-
"Accept"
|
|
2410
|
-
]
|
|
2411
|
-
}
|
|
2412
|
-
),
|
|
2413
|
-
/* @__PURE__ */ e.jsxs(
|
|
2414
|
-
z,
|
|
2415
|
-
{
|
|
2416
|
-
onClick: Ge,
|
|
2417
|
-
className: "w-full",
|
|
2418
|
-
size: "sm",
|
|
2419
|
-
variant: "outline",
|
|
2420
|
-
children: [
|
|
2421
|
-
/* @__PURE__ */ e.jsx(Ve, { className: "mr-2 size-4" }),
|
|
2422
|
-
"Close"
|
|
2423
|
-
]
|
|
2424
|
-
}
|
|
2425
|
-
)
|
|
2426
|
-
] })
|
|
2427
|
-
]
|
|
2428
|
-
}
|
|
2429
|
-
)
|
|
2430
|
-
]
|
|
2431
|
-
}
|
|
2432
|
-
)
|
|
2433
|
-
);
|
|
2434
|
-
}
|
|
2435
|
-
function Zn({ data: s }) {
|
|
2436
|
-
var r;
|
|
2437
|
-
const [n, t] = me.useState([]), i = Object.keys(s[0]).map((l) => ({
|
|
2438
|
-
// header: key,
|
|
2439
|
-
accessorKey: l,
|
|
2440
|
-
header: ({ column: c }) => {
|
|
2441
|
-
const m = c.getIsSorted();
|
|
2442
|
-
return /* @__PURE__ */ e.jsx("div", { className: "flex gap-2", children: /* @__PURE__ */ e.jsxs(
|
|
2443
|
-
"div",
|
|
2444
|
-
{
|
|
2445
|
-
className: "flex cursor-pointer items-center",
|
|
2446
|
-
onClick: () => c.toggleSorting(c.getIsSorted() === "asc"),
|
|
2447
|
-
children: [
|
|
2448
|
-
l,
|
|
2449
|
-
m === "asc" ? /* @__PURE__ */ e.jsx(ca, { className: "ml-2 h-5 w-5" }) : m === "desc" ? /* @__PURE__ */ e.jsx(da, { className: "ml-2 h-5 w-5" }) : null
|
|
2450
|
-
]
|
|
2451
|
-
}
|
|
2452
|
-
) });
|
|
2453
|
-
}
|
|
2454
|
-
})), h = ha({
|
|
2455
|
-
data: s,
|
|
2456
|
-
columns: i,
|
|
2457
|
-
getCoreRowModel: fa(),
|
|
2458
|
-
getPaginationRowModel: ga(),
|
|
2459
|
-
onSortingChange: t,
|
|
2460
|
-
getSortedRowModel: ja(),
|
|
2461
|
-
manualPagination: !0,
|
|
2462
|
-
state: {
|
|
2463
|
-
sorting: n
|
|
2464
|
-
}
|
|
2465
|
-
});
|
|
2466
|
-
return /* @__PURE__ */ e.jsxs(ua, { children: [
|
|
2467
|
-
/* @__PURE__ */ e.jsx(ma, { children: h.getHeaderGroups().map((l) => /* @__PURE__ */ e.jsx(us, { children: l.headers.map((c) => /* @__PURE__ */ e.jsx(xa, { className: "sticky top-0 bg-muted", children: c.isPlaceholder ? null : Gs(
|
|
2468
|
-
c.column.columnDef.header,
|
|
2469
|
-
c.getContext()
|
|
2470
|
-
) }, c.id)) }, l.id)) }),
|
|
2471
|
-
/* @__PURE__ */ e.jsx(pa, { children: (r = h.getRowModel().rows) != null && r.length ? h.getRowModel().rows.map((l) => /* @__PURE__ */ e.jsx(
|
|
2472
|
-
us,
|
|
2473
|
-
{
|
|
2474
|
-
className: "whitespace-nowrap py-2",
|
|
2475
|
-
"data-state": l.getIsSelected() && "selected",
|
|
2476
|
-
children: l.getVisibleCells().map((c) => /* @__PURE__ */ e.jsx(Us, { children: Gs(c.column.columnDef.cell, c.getContext()) }, c.id))
|
|
2477
|
-
},
|
|
2478
|
-
l.id
|
|
2479
|
-
)) : /* @__PURE__ */ e.jsx(us, { children: /* @__PURE__ */ e.jsx(Us, { colSpan: i.length, className: "h-24 text-center", children: "No results." }) }) })
|
|
2480
|
-
] });
|
|
2481
|
-
}
|
|
2482
|
-
function kt({
|
|
2483
|
-
// card,
|
|
2484
|
-
// showCard,
|
|
2485
|
-
className: s,
|
|
2486
|
-
...n
|
|
2487
|
-
}) {
|
|
2488
|
-
var j;
|
|
2489
|
-
me.useState(0);
|
|
2490
|
-
const t = w((d) => d.themeStyle), a = o((d) => d.card), i = o((d) => d.frame), h = w((d) => d.dashboard.filters), r = w((d) => d.filterValues), l = o((d) => d.actions.setRunSql), { updateFilter: c } = bs(), m = h == null ? void 0 : h.find((d) => d.id === i.filterId), u = o((d) => d.actions.setCard);
|
|
2491
|
-
if (Y(() => {
|
|
2492
|
-
a.sql && l(!0);
|
|
2493
|
-
}, [r]), Y(() => {
|
|
2494
|
-
}, [
|
|
2495
|
-
a.data,
|
|
2496
|
-
a.type,
|
|
2497
|
-
a.cfg,
|
|
2498
|
-
a.customCfg,
|
|
2499
|
-
t,
|
|
2500
|
-
a.preferences
|
|
2501
|
-
]), !a.id)
|
|
2502
|
-
return null;
|
|
2503
|
-
let g;
|
|
2504
|
-
return a.data && a.data.length > 0 && (g = ht({
|
|
2505
|
-
data: a.data,
|
|
2506
|
-
cardType: a.type,
|
|
2507
|
-
cfg: a.cfg,
|
|
2508
|
-
customCfg: a.customCfg,
|
|
2509
|
-
preferences: a.preferences
|
|
2510
|
-
})), /* @__PURE__ */ e.jsxs(
|
|
2511
|
-
ba,
|
|
2512
|
-
{
|
|
2513
|
-
role: "editor-visual-card",
|
|
2514
|
-
className: Z("relative flex h-full flex-col rounded-none", s),
|
|
2515
|
-
...n,
|
|
2516
|
-
children: [
|
|
2517
|
-
/* @__PURE__ */ e.jsxs(ya, { className: "flex flex-row items-start justify-between py-4", children: [
|
|
2518
|
-
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
2519
|
-
/* @__PURE__ */ e.jsx(
|
|
2520
|
-
Qe,
|
|
2521
|
-
{
|
|
2522
|
-
text: a.title,
|
|
2523
|
-
onSave: (d) => u({ ...a, title: d }),
|
|
2524
|
-
children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e.jsx(va, { className: "text-base", children: a.title }) })
|
|
2525
|
-
},
|
|
2526
|
-
a.title
|
|
2527
|
-
),
|
|
2528
|
-
/* @__PURE__ */ e.jsx(
|
|
2529
|
-
Qe,
|
|
2530
|
-
{
|
|
2531
|
-
text: a.description || "",
|
|
2532
|
-
onSave: (d) => u({ ...a, description: d }),
|
|
2533
|
-
children: /* @__PURE__ */ e.jsxs(Na, { children: [
|
|
2534
|
-
" ",
|
|
2535
|
-
a.description
|
|
2536
|
-
] })
|
|
2537
|
-
},
|
|
2538
|
-
a.description
|
|
2539
|
-
)
|
|
2540
|
-
] }),
|
|
2541
|
-
m && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
2542
|
-
/* @__PURE__ */ e.jsx(
|
|
2543
|
-
Qe,
|
|
2544
|
-
{
|
|
2545
|
-
className: "my-1",
|
|
2546
|
-
text: m.title || m.column,
|
|
2547
|
-
onSave: (d) => c({ ...m, title: d }),
|
|
2548
|
-
children: /* @__PURE__ */ e.jsx($, { children: m.title })
|
|
2549
|
-
}
|
|
2550
|
-
),
|
|
2551
|
-
Ca(m)
|
|
2552
|
-
] })
|
|
2553
|
-
] }),
|
|
2554
|
-
/* @__PURE__ */ e.jsxs(Sa, { className: "flex grow flex-col pb-3", children: [
|
|
2555
|
-
a.type !== "table" && g && // <ChartJsVisual key={visualKey} cfg={cfg} />
|
|
2556
|
-
/* @__PURE__ */ e.jsx(
|
|
2557
|
-
wa,
|
|
2558
|
-
{
|
|
2559
|
-
cfg: g
|
|
2560
|
-
},
|
|
2561
|
-
JSON.stringify(g) + JSON.stringify(a.preferences) + ((j = a == null ? void 0 : a.preferences) == null ? void 0 : j.customVisualCode)
|
|
2562
|
-
),
|
|
2563
|
-
a.type === "table" && a.data && a.data.length > 0 && // All of the below css classes are #IMPORTANT for the table to scroll properly
|
|
2564
|
-
/* @__PURE__ */ e.jsx(ka, { className: "flex min-h-0 flex-1 grow basis-0", children: /* @__PURE__ */ e.jsx(za, { card: a, data: a == null ? void 0 : a.data }) })
|
|
2565
|
-
] })
|
|
2566
|
-
]
|
|
2567
|
-
}
|
|
2568
|
-
);
|
|
2569
|
-
}
|
|
2570
|
-
function Xn() {
|
|
2571
|
-
const [s, n] = T(!1), [t, a] = T(""), [i, h] = T(""), [r, l] = T(""), [c, m] = T(""), u = o((N) => N.card), g = o(
|
|
2572
|
-
(N) => N.card.customCfg
|
|
2573
|
-
), { setCardCustomCfg: j, setCustomVisualCode: d } = as();
|
|
2574
|
-
function x(N) {
|
|
2575
|
-
var _, L;
|
|
2576
|
-
const V = {
|
|
2577
|
-
...N,
|
|
2578
|
-
data: {
|
|
2579
|
-
...N == null ? void 0 : N.data,
|
|
2580
|
-
datasets: (L = (_ = N == null ? void 0 : N.data) == null ? void 0 : _.datasets) == null ? void 0 : L.map((C) => ({
|
|
2581
|
-
...C,
|
|
2582
|
-
data: []
|
|
2583
|
-
}))
|
|
2584
|
-
}
|
|
2585
|
-
};
|
|
2586
|
-
return JSON.stringify(V, null, 1);
|
|
2587
|
-
}
|
|
2588
|
-
function v() {
|
|
2589
|
-
var V, q;
|
|
2590
|
-
if (!u.data || u.data.length === 0)
|
|
2591
|
-
return;
|
|
2592
|
-
const N = ht({
|
|
2593
|
-
data: u.data,
|
|
2594
|
-
cardType: u.type,
|
|
2595
|
-
cfg: u.cfg,
|
|
2596
|
-
preferences: u.preferences
|
|
2597
|
-
});
|
|
2598
|
-
N && (a(JSON.stringify(N, null, 1)), (V = u == null ? void 0 : u.preferences) != null && V.customVisualCode && l((q = u == null ? void 0 : u.preferences) == null ? void 0 : q.customVisualCode), g && h(JSON.stringify(g, null, 1)));
|
|
2599
|
-
}
|
|
2600
|
-
function f() {
|
|
2601
|
-
if (r && d(r), !!i)
|
|
2602
|
-
try {
|
|
2603
|
-
const N = JSON.parse(i);
|
|
2604
|
-
return N ? (j(N), m(""), h(""), N) : void 0;
|
|
2605
|
-
} catch (N) {
|
|
2606
|
-
console.log(N), m("Invalid JSON");
|
|
2607
|
-
}
|
|
2608
|
-
}
|
|
2609
|
-
function F() {
|
|
2610
|
-
h(""), j(null);
|
|
2611
|
-
}
|
|
2612
|
-
function M() {
|
|
2613
|
-
let N;
|
|
2614
|
-
if (g) {
|
|
2615
|
-
const V = Ks.cloneDeep(u.cfg), q = Ks.merge(V, g);
|
|
2616
|
-
return N = x(q), N;
|
|
2617
|
-
}
|
|
2618
|
-
return t ? (N = x(JSON.parse(t)), N) : "";
|
|
2619
|
-
}
|
|
2620
|
-
return /* @__PURE__ */ e.jsxs(ys, { open: s, onOpenChange: n, children: [
|
|
2621
|
-
/* @__PURE__ */ e.jsx(vs, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
2622
|
-
z,
|
|
2623
|
-
{
|
|
2624
|
-
onClick: v,
|
|
2625
|
-
className: ` ${g && "border-foreground/50 dark:border-foreground/70"}`,
|
|
2626
|
-
size: "sm",
|
|
2627
|
-
variant: "outline",
|
|
2628
|
-
children: /* @__PURE__ */ e.jsx(Fa, { className: "h-4 w-4" })
|
|
2629
|
-
}
|
|
2630
|
-
) }),
|
|
2631
|
-
/* @__PURE__ */ e.jsxs(
|
|
2632
|
-
Cs,
|
|
2633
|
-
{
|
|
2634
|
-
className: "max-h-[70vh] min-h-[70vh] overflow-auto sm:min-w-[900px] lg:min-w-[1200px]",
|
|
2635
|
-
children: [
|
|
2636
|
-
/* @__PURE__ */ e.jsxs(Ss, { className: "", children: [
|
|
2637
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2638
|
-
/* @__PURE__ */ e.jsx(ws, { children: "Customize Card" }),
|
|
2639
|
-
/* @__PURE__ */ e.jsxs(zs, { children: [
|
|
2640
|
-
/* @__PURE__ */ e.jsx(at, { children: /* @__PURE__ */ e.jsx(
|
|
2641
|
-
un,
|
|
2642
|
-
{
|
|
2643
|
-
onClick: () => {
|
|
2644
|
-
navigator.clipboard.writeText(u.id);
|
|
2645
|
-
},
|
|
2646
|
-
className: "size-3 cursor-pointer text-muted-foreground/70 transition-colors hover:text-muted-foreground"
|
|
2647
|
-
}
|
|
2648
|
-
) }),
|
|
2649
|
-
/* @__PURE__ */ e.jsx(Fs, { side: "right", align: "center", children: /* @__PURE__ */ e.jsx("p", { className: "text-xs", children: "Copy Card ID" }) })
|
|
2650
|
-
] })
|
|
2651
|
-
] }),
|
|
2652
|
-
/* @__PURE__ */ e.jsxs(ks, { children: [
|
|
2653
|
-
"See the configuration options and documentation",
|
|
2654
|
-
/* @__PURE__ */ e.jsx(
|
|
2655
|
-
"a",
|
|
2656
|
-
{
|
|
2657
|
-
target: "_blank",
|
|
2658
|
-
className: "ml-1 text-blue-500 underline",
|
|
2659
|
-
href: "https://www.chartjs.org/docs/latest/samples/bar/vertical.html",
|
|
2660
|
-
children: "here."
|
|
2661
|
-
}
|
|
2662
|
-
)
|
|
2663
|
-
] })
|
|
2664
|
-
] }),
|
|
2665
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex grow gap-2", children: [
|
|
2666
|
-
/* @__PURE__ */ e.jsx(kt, { className: "w-1/2 rounded shadow-none" }),
|
|
2667
|
-
/* @__PURE__ */ e.jsxs(ut, { defaultValue: "custom-config", className: "flex w-1/2 flex-col", children: [
|
|
2668
|
-
/* @__PURE__ */ e.jsxs(mt, { className: "justify-start rounded-sm rounded-b-none border border-b-0", children: [
|
|
2669
|
-
/* @__PURE__ */ e.jsxs(Je, { value: "custom-config", children: [
|
|
2670
|
-
g && /* @__PURE__ */ e.jsx(xt, { className: "mr-1 h-5 w-5 text-green-600" }),
|
|
2671
|
-
g ? "Custom Config" : "Default Config"
|
|
2672
|
-
] }),
|
|
2673
|
-
/* @__PURE__ */ e.jsx(Je, { className: "", value: "output", children: "Output" }),
|
|
2674
|
-
/* @__PURE__ */ e.jsx(Je, { className: "", value: "custom-code", children: "Custom Code" })
|
|
2675
|
-
] }),
|
|
2676
|
-
/* @__PURE__ */ e.jsx(
|
|
2677
|
-
Ye,
|
|
2678
|
-
{
|
|
2679
|
-
className: "bg-red-x mt-0 grow rounded-b border border-t-0 p-2",
|
|
2680
|
-
value: "output",
|
|
2681
|
-
children: /* @__PURE__ */ e.jsx(
|
|
2682
|
-
dt,
|
|
2683
|
-
{
|
|
2684
|
-
disabled: !0,
|
|
2685
|
-
value: t,
|
|
2686
|
-
className: "h-full resize-none border-none font-mono focus-visible:ring-0 focus-visible:ring-offset-0"
|
|
2687
|
-
}
|
|
2688
|
-
)
|
|
2689
|
-
}
|
|
2690
|
-
),
|
|
2691
|
-
/* @__PURE__ */ e.jsx(
|
|
2692
|
-
Ye,
|
|
2693
|
-
{
|
|
2694
|
-
className: "mt-0 grow rounded-b border border-t-0",
|
|
2695
|
-
value: "custom-config",
|
|
2696
|
-
children: /* @__PURE__ */ e.jsx(
|
|
2697
|
-
qe,
|
|
2698
|
-
{
|
|
2699
|
-
className: "h-full w-full overflow-hidden",
|
|
2700
|
-
theme: "default",
|
|
2701
|
-
options: {
|
|
2702
|
-
minimap: {
|
|
2703
|
-
enabled: !1
|
|
2704
|
-
},
|
|
2705
|
-
wordWrap: "on",
|
|
2706
|
-
scrollbar: {
|
|
2707
|
-
verticalScrollbarSize: 0,
|
|
2708
|
-
horizontalScrollbarSize: 0
|
|
2709
|
-
},
|
|
2710
|
-
fontSize: 14,
|
|
2711
|
-
renderLineHighlight: "none"
|
|
2712
|
-
},
|
|
2713
|
-
defaultLanguage: "json",
|
|
2714
|
-
value: M(),
|
|
2715
|
-
onChange: (N) => h(N)
|
|
2716
|
-
}
|
|
2717
|
-
)
|
|
2718
|
-
}
|
|
2719
|
-
),
|
|
2720
|
-
/* @__PURE__ */ e.jsx(
|
|
2721
|
-
Ye,
|
|
2722
|
-
{
|
|
2723
|
-
className: "mt-0 grow rounded-b border border-t-0",
|
|
2724
|
-
value: "custom-code",
|
|
2725
|
-
children: /* @__PURE__ */ e.jsx(
|
|
2726
|
-
qe,
|
|
2727
|
-
{
|
|
2728
|
-
className: "h-full w-full overflow-hidden",
|
|
2729
|
-
theme: "default",
|
|
2730
|
-
options: {
|
|
2731
|
-
minimap: {
|
|
2732
|
-
enabled: !1
|
|
2733
|
-
},
|
|
2734
|
-
wordWrap: "on",
|
|
2735
|
-
scrollbar: {
|
|
2736
|
-
verticalScrollbarSize: 0,
|
|
2737
|
-
horizontalScrollbarSize: 0
|
|
2738
|
-
},
|
|
2739
|
-
fontSize: 14,
|
|
2740
|
-
renderLineHighlight: "none"
|
|
2741
|
-
},
|
|
2742
|
-
defaultLanguage: "javascript",
|
|
2743
|
-
value: r,
|
|
2744
|
-
onChange: (N) => l(N || "")
|
|
2745
|
-
}
|
|
2746
|
-
)
|
|
2747
|
-
}
|
|
2748
|
-
)
|
|
2749
|
-
] })
|
|
2750
|
-
] }),
|
|
2751
|
-
/* @__PURE__ */ e.jsxs(st, { className: "flex items-center", children: [
|
|
2752
|
-
/* @__PURE__ */ e.jsx($, { className: "mr-2 text-red-500", children: c }),
|
|
2753
|
-
/* @__PURE__ */ e.jsx(
|
|
2754
|
-
z,
|
|
2755
|
-
{
|
|
2756
|
-
disabled: !g,
|
|
2757
|
-
onClick: F,
|
|
2758
|
-
variant: "outline",
|
|
2759
|
-
children: "Reset"
|
|
2760
|
-
}
|
|
2761
|
-
),
|
|
2762
|
-
/* @__PURE__ */ e.jsx(z, { onClick: f, variant: "outline", children: "Apply" }),
|
|
2763
|
-
/* @__PURE__ */ e.jsx(z, { onClick: () => n(!1), variant: "outline", children: "Close" })
|
|
2764
|
-
] })
|
|
2765
|
-
]
|
|
2766
|
-
}
|
|
2767
|
-
)
|
|
2768
|
-
] });
|
|
2769
|
-
}
|
|
2770
|
-
function zt(s) {
|
|
2771
|
-
return xe({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M926.8 397.1l-396-288a31.81 31.81 0 0 0-37.6 0l-396 288a31.99 31.99 0 0 0-11.6 35.8l151.3 466a32 32 0 0 0 30.4 22.1h489.5c13.9 0 26.1-8.9 30.4-22.1l151.3-466c4.2-13.2-.5-27.6-11.7-35.8zM838.6 417l-98.5 32-200-144.7V199.9L838.6 417zM466 567.2l-89.1 122.3-55.2-169.2L466 567.2zm-116.3-96.8L484 373.3v140.8l-134.3-43.7zM512 599.2l93.9 128.9H418.1L512 599.2zm28.1-225.9l134.2 97.1L540.1 514V373.3zM558 567.2l144.3-46.9-55.2 169.2L558 567.2zm-74-367.3v104.4L283.9 449l-98.5-32L484 199.9zM169.3 470.8l86.5 28.1 80.4 246.4-53.8 73.9-113.1-348.4zM327.1 853l50.3-69h269.3l50.3 69H327.1zm414.5-33.8l-53.8-73.9 80.4-246.4 86.5-28.1-113.1 348.4z" }, child: [] }] })(s);
|
|
2772
|
-
}
|
|
2773
|
-
function Ft(s) {
|
|
2774
|
-
return xe({ tag: "svg", attr: { viewBox: "0 0 256 256", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M137.39,24.06A16,16,0,0,0,120,40V80.67a15.86,15.86,0,0,0,13.25,15.76A32,32,0,1,1,96,129.68c-.41-8.22,1.27-15,5-20.26h0a15.86,15.86,0,0,0-1.69-20.47L71.69,60.68a16,16,0,0,0-23.63,1.1A103.6,103.6,0,0,0,55,202.05,103.24,103.24,0,0,0,128,232h1.49A104.3,104.3,0,0,0,232,129.48C232.75,75.18,191.19,28.88,137.39,24.06ZM60.32,71.94l27.61,28.19,0,.06A43.29,43.29,0,0,0,80.44,120H40.36A87.13,87.13,0,0,1,60.32,71.94ZM40.37,136h40.3A48,48,0,0,0,120,175.34v40.3A88,88,0,0,1,40.37,136Zm149.77,54.14A87.45,87.45,0,0,1,136,215.61V175.34a47.55,47.55,0,0,0,24.73-12.23A48,48,0,0,0,136,80.66L136,40c45.52,4.08,80.67,43.28,80,89.25A87.45,87.45,0,0,1,190.14,190.14Z" }, child: [] }] })(s);
|
|
2775
|
-
}
|
|
2776
|
-
function Lt(s) {
|
|
2777
|
-
return xe({ tag: "svg", attr: { viewBox: "0 0 256 256", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm87.63,96H191.48A64.1,64.1,0,0,0,136,64.52V40.37A88.13,88.13,0,0,1,215.63,120ZM120,120H80.68A48.09,48.09,0,0,1,120,80.68Zm0,16v39.32A48.09,48.09,0,0,1,80.68,136Zm16,0h39.32A48.09,48.09,0,0,1,136,175.32Zm0-16V80.68A48.09,48.09,0,0,1,175.32,120ZM120,40.37V64.52A64.1,64.1,0,0,0,64.52,120H40.37A88.13,88.13,0,0,1,120,40.37ZM40.37,136H64.52A64.1,64.1,0,0,0,120,191.48v24.15A88.13,88.13,0,0,1,40.37,136ZM136,215.63V191.48A64.1,64.1,0,0,0,191.48,136h24.15A88.13,88.13,0,0,1,136,215.63Z" }, child: [] }] })(s);
|
|
2778
|
-
}
|
|
2779
|
-
function Mt(s) {
|
|
2780
|
-
return xe({ tag: "svg", attr: { viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }, child: [] }, { tag: "path", attr: { d: "M6 16m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" }, child: [] }, { tag: "path", attr: { d: "M16 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" }, child: [] }, { tag: "path", attr: { d: "M14.5 7.5m-4.5 0a4.5 4.5 0 1 0 9 0a4.5 4.5 0 1 0 -9 0" }, child: [] }] })(s);
|
|
2781
|
-
}
|
|
2782
|
-
function Ot(s) {
|
|
2783
|
-
return xe({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "m2 19.99 7.5-7.51 4 4 7.09-7.97L22 9.92l-8.5 9.56-4-4-6 6.01-1.5-1.5zm1.5-4.5 6-6.01 4 4L22 3.92l-1.41-1.41-7.09 7.97-4-4L2 13.99l1.5 1.5z" }, child: [] }] })(s);
|
|
2784
|
-
}
|
|
2785
|
-
function Dt(s) {
|
|
2786
|
-
return xe({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M4 9h4v11H4zM4 4h4v4H4zM10 7h4v4h-4zM16 10h4v4h-4zM16 15h4v5h-4zM10 12h4v8h-4z" }, child: [] }] })(s);
|
|
2787
|
-
}
|
|
2788
|
-
function Tt(s) {
|
|
2789
|
-
return xe({ tag: "svg", attr: { version: "1.2", baseProfile: "tiny", viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M4 18c-.552 0-1-.448-1-1v-6.382l-.553.276c-.495.248-1.095.046-1.342-.447-.247-.494-.046-1.094.448-1.342l2-1c.31-.155.678-.139.973.044.294.183.474.504.474.851v8c0 .552-.448 1-1 1zM13 18h-5c-.404 0-.769-.244-.924-.617-.155-.374-.069-.804.217-1.09l4-4c.254-.254.394-.591.394-.95 0-.358-.14-.695-.394-.949-.508-.508-1.39-.508-1.9.001-.253.252-.393.589-.393.948 0 .552-.448 1-1 1s-1-.448-1-1c0-.894.348-1.733.98-2.364 1.265-1.263 3.464-1.263 4.727.001.632.631.979 1.471.979 2.363 0 .893-.348 1.733-.979 2.364l-2.293 2.293h2.586c.552 0 1 .448 1 1s-.448 1-1 1zM20.955 12.377c.338-.457.545-1.016.545-1.627 0-1.517-1.234-2.75-2.75-2.75-1.031 0-1.966.569-2.44 1.484-.254.49-.063 1.094.428 1.348.49.254 1.094.062 1.348-.428.128-.249.383-.404.664-.404.414 0 .75.336.75.75s-.336.75-.75.75c-.552 0-1 .448-1 1s.448 1 1 1c.689 0 1.25.561 1.25 1.25s-.561 1.25-1.25 1.25-1.25-.561-1.25-1.25c0-.552-.448-1-1-1s-1 .448-1 1c0 1.792 1.458 3.25 3.25 3.25s3.25-1.458 3.25-3.25c0-.939-.406-1.779-1.045-2.373z" }, child: [] }] })(s);
|
|
2790
|
-
}
|
|
2791
|
-
function At(s) {
|
|
2792
|
-
return xe({ 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);
|
|
2793
|
-
}
|
|
2794
|
-
function er() {
|
|
2795
|
-
const [s, n] = T(!1), t = o((c) => c.card.type), { setCardType: a, setCardPreferences: i, setChartOrientation: h } = o((c) => c.actions), r = o(
|
|
2796
|
-
(c) => c.actions.setCardCustomCfg
|
|
2797
|
-
);
|
|
2798
|
-
function l(c) {
|
|
2799
|
-
r(null), i({}), a(c), n(!1);
|
|
2800
|
-
}
|
|
2801
|
-
return /* @__PURE__ */ e.jsxs(ns, { open: s, onOpenChange: n, children: [
|
|
2802
|
-
/* @__PURE__ */ e.jsx(rs, { asChild: !0, children: /* @__PURE__ */ e.jsx(z, { size: "sm", variant: "outline", children: /* @__PURE__ */ e.jsx(sr, { className: "h-4 w-4", chartType: t }) }) }),
|
|
2803
|
-
/* @__PURE__ */ e.jsx(is, { className: "w-50", children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 place-items-center", children: [
|
|
2804
|
-
/* @__PURE__ */ e.jsx(
|
|
2805
|
-
z,
|
|
2806
|
-
{
|
|
2807
|
-
onClick: () => l("bar"),
|
|
2808
|
-
className: "font-normal",
|
|
2809
|
-
variant: "ghost",
|
|
2810
|
-
children: /* @__PURE__ */ e.jsx(Es, { className: "size-5" })
|
|
2811
|
-
}
|
|
2812
|
-
),
|
|
2813
|
-
/* @__PURE__ */ e.jsx(
|
|
2814
|
-
z,
|
|
2815
|
-
{
|
|
2816
|
-
onClick: () => l("line"),
|
|
2817
|
-
variant: "ghost",
|
|
2818
|
-
children: /* @__PURE__ */ e.jsx(qs, { className: "size-5" })
|
|
2819
|
-
}
|
|
2820
|
-
),
|
|
2821
|
-
/* @__PURE__ */ e.jsx(
|
|
2822
|
-
z,
|
|
2823
|
-
{
|
|
2824
|
-
onClick: () => l("stackedBar"),
|
|
2825
|
-
variant: "ghost",
|
|
2826
|
-
children: /* @__PURE__ */ e.jsx(Dt, { className: "size-5", strokeWidth: 0 })
|
|
2827
|
-
}
|
|
2828
|
-
),
|
|
2829
|
-
/* @__PURE__ */ e.jsx(
|
|
2830
|
-
z,
|
|
2831
|
-
{
|
|
2832
|
-
onClick: () => l("stackedLine"),
|
|
2833
|
-
variant: "ghost",
|
|
2834
|
-
children: /* @__PURE__ */ e.jsx(Ot, { className: "size-5", strokeWidth: 0 })
|
|
2835
|
-
}
|
|
2836
|
-
),
|
|
2837
|
-
/* @__PURE__ */ e.jsx(
|
|
2838
|
-
z,
|
|
2839
|
-
{
|
|
2840
|
-
onClick: () => l("scatter"),
|
|
2841
|
-
variant: "ghost",
|
|
2842
|
-
children: /* @__PURE__ */ e.jsx(yt, { className: "size-5" })
|
|
2843
|
-
}
|
|
2844
|
-
),
|
|
2845
|
-
/* @__PURE__ */ e.jsx(
|
|
2846
|
-
z,
|
|
2847
|
-
{
|
|
2848
|
-
onClick: () => l("bubble"),
|
|
2849
|
-
variant: "ghost",
|
|
2850
|
-
children: /* @__PURE__ */ e.jsx(Mt, { className: "size-4" })
|
|
2851
|
-
}
|
|
2852
|
-
),
|
|
2853
|
-
/* @__PURE__ */ e.jsx(
|
|
2854
|
-
z,
|
|
2855
|
-
{
|
|
2856
|
-
onClick: () => l("pie"),
|
|
2857
|
-
variant: "ghost",
|
|
2858
|
-
children: /* @__PURE__ */ e.jsx(bt, { className: "size-5" })
|
|
2859
|
-
}
|
|
2860
|
-
),
|
|
2861
|
-
/* @__PURE__ */ e.jsx(
|
|
2862
|
-
z,
|
|
2863
|
-
{
|
|
2864
|
-
onClick: () => l("doughnut"),
|
|
2865
|
-
variant: "ghost",
|
|
2866
|
-
children: /* @__PURE__ */ e.jsx(Ft, { className: "size-5", strokeWidth: 1 })
|
|
2867
|
-
}
|
|
2868
|
-
),
|
|
2869
|
-
/* @__PURE__ */ e.jsx(
|
|
2870
|
-
z,
|
|
2871
|
-
{
|
|
2872
|
-
onClick: () => l("radar"),
|
|
2873
|
-
variant: "ghost",
|
|
2874
|
-
children: /* @__PURE__ */ e.jsx(
|
|
2875
|
-
zt,
|
|
2876
|
-
{
|
|
2877
|
-
className: "size-5 font-extralight",
|
|
2878
|
-
strokeWidth: 0.5
|
|
2879
|
-
}
|
|
2880
|
-
)
|
|
2881
|
-
}
|
|
2882
|
-
),
|
|
2883
|
-
/* @__PURE__ */ e.jsx(
|
|
2884
|
-
z,
|
|
2885
|
-
{
|
|
2886
|
-
onClick: () => l("polarArea"),
|
|
2887
|
-
variant: "ghost",
|
|
2888
|
-
children: /* @__PURE__ */ e.jsx(Lt, { className: "size-5" })
|
|
2889
|
-
}
|
|
2890
|
-
),
|
|
2891
|
-
/* @__PURE__ */ e.jsx(
|
|
2892
|
-
z,
|
|
2893
|
-
{
|
|
2894
|
-
onClick: () => l("pyramid"),
|
|
2895
|
-
variant: "ghost",
|
|
2896
|
-
children: /* @__PURE__ */ e.jsx(At, { className: "size-5" })
|
|
2897
|
-
}
|
|
2898
|
-
),
|
|
2899
|
-
/* @__PURE__ */ e.jsx(
|
|
2900
|
-
z,
|
|
2901
|
-
{
|
|
2902
|
-
onClick: () => l("range"),
|
|
2903
|
-
variant: "ghost",
|
|
2904
|
-
children: /* @__PURE__ */ e.jsx(gt, { className: "size-5" })
|
|
2905
|
-
}
|
|
2906
|
-
),
|
|
2907
|
-
/* @__PURE__ */ e.jsx(
|
|
2908
|
-
z,
|
|
2909
|
-
{
|
|
2910
|
-
onClick: () => l("table"),
|
|
2911
|
-
variant: "ghost",
|
|
2912
|
-
children: /* @__PURE__ */ e.jsx(Ls, { className: "size-5" })
|
|
2913
|
-
}
|
|
2914
|
-
),
|
|
2915
|
-
/* @__PURE__ */ e.jsx(
|
|
2916
|
-
z,
|
|
2917
|
-
{
|
|
2918
|
-
onClick: () => l("kpi"),
|
|
2919
|
-
variant: "ghost",
|
|
2920
|
-
children: /* @__PURE__ */ e.jsx(Tt, { className: "size-6" })
|
|
2921
|
-
}
|
|
2922
|
-
),
|
|
2923
|
-
/* @__PURE__ */ e.jsx(
|
|
2924
|
-
z,
|
|
2925
|
-
{
|
|
2926
|
-
onClick: () => l("text"),
|
|
2927
|
-
variant: "ghost",
|
|
2928
|
-
children: /* @__PURE__ */ e.jsx(Vs, { className: "size-4" })
|
|
2929
|
-
}
|
|
2930
|
-
)
|
|
2931
|
-
] }) })
|
|
2932
|
-
] });
|
|
2933
|
-
}
|
|
2934
|
-
function sr({ chartType: s, className: n }) {
|
|
2935
|
-
switch (s) {
|
|
2936
|
-
case "bar":
|
|
2937
|
-
return /* @__PURE__ */ e.jsx(Es, { className: n });
|
|
2938
|
-
case "line":
|
|
2939
|
-
return /* @__PURE__ */ e.jsx(qs, { className: n });
|
|
2940
|
-
case "pie":
|
|
2941
|
-
return /* @__PURE__ */ e.jsx(bt, { className: n });
|
|
2942
|
-
case "radar":
|
|
2943
|
-
return /* @__PURE__ */ e.jsx(zt, { className: n });
|
|
2944
|
-
case "scatter":
|
|
2945
|
-
return /* @__PURE__ */ e.jsx(yt, { className: n });
|
|
2946
|
-
case "bubble":
|
|
2947
|
-
return /* @__PURE__ */ e.jsx(Mt, { className: n });
|
|
2948
|
-
case "doughnut":
|
|
2949
|
-
return /* @__PURE__ */ e.jsx(Ft, { className: n });
|
|
2950
|
-
case "stackedBar":
|
|
2951
|
-
return /* @__PURE__ */ e.jsx(Dt, { className: "size-4 text-foreground/70" });
|
|
2952
|
-
case "stackedLine":
|
|
2953
|
-
return /* @__PURE__ */ e.jsx(Ot, { className: "size-4 text-foreground/70" });
|
|
2954
|
-
case "polarArea":
|
|
2955
|
-
return /* @__PURE__ */ e.jsx(Lt, { className: n });
|
|
2956
|
-
case "pyramid":
|
|
2957
|
-
return /* @__PURE__ */ e.jsx(At, { className: n });
|
|
2958
|
-
case "range":
|
|
2959
|
-
return /* @__PURE__ */ e.jsx(gt, { className: n });
|
|
2960
|
-
case "kpi":
|
|
2961
|
-
return /* @__PURE__ */ e.jsx(Tt, { className: n });
|
|
2962
|
-
case "text":
|
|
2963
|
-
return /* @__PURE__ */ e.jsx(Vs, { className: n });
|
|
2964
|
-
default:
|
|
2965
|
-
return /* @__PURE__ */ e.jsx(Ls, { className: n });
|
|
2966
|
-
}
|
|
2967
|
-
}
|
|
2968
|
-
function Xs() {
|
|
2969
|
-
const s = o((f) => f.frame), n = o((f) => f.card), t = o((f) => f.card.data), a = o((f) => f.isShowingVisual), i = o((f) => f.isSqlRunning), h = o((f) => f.queryError), r = o((f) => f.pythonStdOut), l = o((f) => f.actions.setRunSql);
|
|
2970
|
-
o((f) => f.onSave), o((f) => f.onClose), o((f) => f.actions.setCardSql), o((f) => f.actions.setCardType), o((f) => f.actions.setSqlGen);
|
|
2971
|
-
const { setFrame: c, setCard: m, updateCardInFrame: u } = as();
|
|
2972
|
-
if (!n)
|
|
2973
|
-
return /* @__PURE__ */ e.jsx(e.Fragment, { children: "No Active Card" });
|
|
2974
|
-
function g() {
|
|
2975
|
-
const f = {
|
|
2976
|
-
id: Ze(),
|
|
2977
|
-
title: "Title",
|
|
2978
|
-
description: "Description",
|
|
2979
|
-
preferences: {
|
|
2980
|
-
onClickFilter: [
|
|
2981
|
-
{
|
|
2982
|
-
columnIndex: 0,
|
|
2983
|
-
expression: ""
|
|
2984
|
-
}
|
|
2985
|
-
]
|
|
2986
|
-
},
|
|
2987
|
-
type: "bar",
|
|
2988
|
-
sql: "",
|
|
2989
|
-
data: []
|
|
2990
|
-
}, F = {
|
|
2991
|
-
...s,
|
|
2992
|
-
cards: [...s.cards, f],
|
|
2993
|
-
activeCardId: f.id
|
|
2994
|
-
};
|
|
2995
|
-
c(F), m(f);
|
|
2996
|
-
}
|
|
2997
|
-
function j(f) {
|
|
2998
|
-
const F = s.cards.filter((V) => V.id !== f), M = F[0], N = {
|
|
2999
|
-
...s,
|
|
3000
|
-
cards: F,
|
|
3001
|
-
// update the active card to the first card in the frame
|
|
3002
|
-
activeCardId: M.id
|
|
3003
|
-
};
|
|
3004
|
-
c(N), m(M);
|
|
3005
|
-
}
|
|
3006
|
-
function d(f) {
|
|
3007
|
-
const F = {
|
|
3008
|
-
...s,
|
|
3009
|
-
cards: s.cards.map((N) => N.id === n.id ? n : N),
|
|
3010
|
-
activeCardId: f
|
|
3011
|
-
};
|
|
3012
|
-
c(F);
|
|
3013
|
-
const M = F.cards.find((N) => N.id === f);
|
|
3014
|
-
m(M), M.sql && (console.log("newActiveCard.sql", M.sql), M.data && M.data.length === 0 && l(!0));
|
|
3015
|
-
}
|
|
3016
|
-
function x() {
|
|
3017
|
-
return /* @__PURE__ */ e.jsxs(
|
|
3018
|
-
ut,
|
|
3019
|
-
{
|
|
3020
|
-
onValueChange: d,
|
|
3021
|
-
value: s.activeCardId,
|
|
3022
|
-
className: "flex grow flex-col pb-3",
|
|
3023
|
-
children: [
|
|
3024
|
-
s.cards.map((f) => /* @__PURE__ */ e.jsx(Ye, { className: "mt-0 grow", value: f.id, children: v() }, f.id)),
|
|
3025
|
-
/* @__PURE__ */ e.jsx(mt, { className: "mx-6 justify-between", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
3026
|
-
s.cards.map((f) => /* @__PURE__ */ e.jsx(
|
|
3027
|
-
Qe,
|
|
3028
|
-
{
|
|
3029
|
-
text: f.tabTitle || f.title,
|
|
3030
|
-
onSave: (F) => {
|
|
3031
|
-
m({ ...n, tabTitle: F }), u({ ...n, tabTitle: F });
|
|
3032
|
-
},
|
|
3033
|
-
children: /* @__PURE__ */ e.jsxs(Je, { className: "", value: f.id, children: [
|
|
3034
|
-
f.tabTitle || f.title,
|
|
3035
|
-
s.activeCardId === f.id && s.cards.length > 1 && /* @__PURE__ */ e.jsx(
|
|
3036
|
-
pt,
|
|
3037
|
-
{
|
|
3038
|
-
className: "ml-2 size-3.5 text-muted-foreground hover:text-foreground",
|
|
3039
|
-
onClick: () => j(f.id)
|
|
3040
|
-
}
|
|
3041
|
-
)
|
|
3042
|
-
] })
|
|
3043
|
-
},
|
|
3044
|
-
f.id
|
|
3045
|
-
)),
|
|
3046
|
-
/* @__PURE__ */ e.jsx(
|
|
3047
|
-
z,
|
|
3048
|
-
{
|
|
3049
|
-
className: "ml-1 h-8 px-2 hover:bg-muted-foreground/50",
|
|
3050
|
-
variant: "outline",
|
|
3051
|
-
onClick: g,
|
|
3052
|
-
children: /* @__PURE__ */ e.jsx(Ns, { className: "h-4 w-4" })
|
|
3053
|
-
}
|
|
3054
|
-
)
|
|
3055
|
-
] }) })
|
|
3056
|
-
]
|
|
3057
|
-
}
|
|
3058
|
-
);
|
|
3059
|
-
}
|
|
3060
|
-
function v() {
|
|
3061
|
-
return n.type === "kpi" ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e.jsx(La, { isLoading: i, card: n }) }) }) : n.type === "text" ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e.jsx(Ma, { isLoading: i, card: n }) }) }) : /* @__PURE__ */ e.jsx(kt, { className: "grow border-none shadow-none" });
|
|
3062
|
-
}
|
|
3063
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full flex-col pt-3", children: [
|
|
3064
|
-
i && /* @__PURE__ */ e.jsx($e, { className: "absolute bottom-0 left-0 right-0 top-0 z-10 m-auto h-10 w-10 animate-spin text-foreground/10" }),
|
|
3065
|
-
/* @__PURE__ */ e.jsxs("div", { className: "mb-0 flex min-h-10 items-center justify-end gap-2 px-6", children: [
|
|
3066
|
-
a && /* @__PURE__ */ e.jsxs("div", { className: "flex grow items-center gap-2", children: [
|
|
3067
|
-
/* @__PURE__ */ e.jsx(er, {}),
|
|
3068
|
-
n.type !== "table" && /* @__PURE__ */ e.jsx(Xn, {})
|
|
3069
|
-
] }),
|
|
3070
|
-
/* @__PURE__ */ e.jsx(ar, {})
|
|
3071
|
-
] }),
|
|
3072
|
-
a ? x() : /* @__PURE__ */ e.jsxs("div", { className: "flex min-h-0 w-full flex-1 grow basis-0 px-6", children: [
|
|
3073
|
-
r && /* @__PURE__ */ e.jsx(tr, {}),
|
|
3074
|
-
n.data && n.data.length > 0 && /* @__PURE__ */ e.jsx(Zn, { data: t || [] }),
|
|
3075
|
-
h && /* @__PURE__ */ e.jsx("span", { className: "font-mono text-sm", children: h })
|
|
3076
|
-
] })
|
|
3077
|
-
] });
|
|
3078
|
-
}
|
|
3079
|
-
function tr() {
|
|
3080
|
-
const s = o((t) => t.pythonStdOut);
|
|
3081
|
-
if (!s)
|
|
3082
|
-
return null;
|
|
3083
|
-
const n = s.replace(/\n/g, "<br>");
|
|
3084
|
-
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
3085
|
-
/* @__PURE__ */ e.jsx("p", { className: "font-mono text-sm", children: "Output:" }),
|
|
3086
|
-
/* @__PURE__ */ e.jsx(
|
|
3087
|
-
"div",
|
|
3088
|
-
{
|
|
3089
|
-
dangerouslySetInnerHTML: { __html: n },
|
|
3090
|
-
className: "bg-muted p-2 font-mono text-sm"
|
|
3091
|
-
}
|
|
3092
|
-
),
|
|
3093
|
-
/* @__PURE__ */ e.jsx(Re, { className: "mb-2" })
|
|
3094
|
-
] });
|
|
3095
|
-
}
|
|
3096
|
-
function ar() {
|
|
3097
|
-
const s = o((t) => t.isShowingVisual), n = o(
|
|
3098
|
-
(t) => t.actions.setIsShowingVisual
|
|
3099
|
-
);
|
|
3100
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
3101
|
-
/* @__PURE__ */ e.jsx($, { htmlFor: "visualize", children: "Chart" }),
|
|
3102
|
-
/* @__PURE__ */ e.jsx(
|
|
3103
|
-
Oa,
|
|
3104
|
-
{
|
|
3105
|
-
checked: s,
|
|
3106
|
-
onCheckedChange: () => n(!s),
|
|
3107
|
-
id: "visualize",
|
|
3108
|
-
className: "data-[state=checked]:bg-foreground/50"
|
|
3109
|
-
}
|
|
3110
|
-
)
|
|
3111
|
-
] });
|
|
3112
|
-
}
|
|
3113
|
-
function Te() {
|
|
3114
|
-
const [s, n] = T([]);
|
|
3115
|
-
o(
|
|
3116
|
-
(u) => u.card.cfg
|
|
3117
|
-
);
|
|
3118
|
-
const t = o((u) => u.card.preferences), { setCardCfg: a, setFilterOnClickColumnIndex: i, setCardPreferences: h } = o((u) => u.actions), r = o(
|
|
3119
|
-
(u) => u.queryResultColumns
|
|
3120
|
-
);
|
|
3121
|
-
o(
|
|
3122
|
-
(u) => {
|
|
3123
|
-
var g;
|
|
3124
|
-
return (g = u.card.preferences) == null ? void 0 : g.filterOnClickColumnIndex;
|
|
3125
|
-
}
|
|
3126
|
-
), Y(() => {
|
|
3127
|
-
r && n(new Array(r.length).fill(!1));
|
|
3128
|
-
}, [r]);
|
|
3129
|
-
function l(u, g) {
|
|
3130
|
-
var j, d;
|
|
3131
|
-
g ? t != null && t.onClickFilter && ((j = t == null ? void 0 : t.onClickFilter) == null ? void 0 : j.length) > 0 ? h({
|
|
3132
|
-
...t,
|
|
3133
|
-
onClickFilter: [
|
|
3134
|
-
...t.onClickFilter,
|
|
3135
|
-
{
|
|
3136
|
-
columnIndex: u,
|
|
3137
|
-
expression: ""
|
|
3138
|
-
}
|
|
3139
|
-
]
|
|
3140
|
-
}) : h({
|
|
3141
|
-
...t,
|
|
3142
|
-
onClickFilter: [
|
|
3143
|
-
{
|
|
3144
|
-
columnIndex: u,
|
|
3145
|
-
expression: ""
|
|
3146
|
-
}
|
|
3147
|
-
]
|
|
3148
|
-
}) : (h({
|
|
3149
|
-
...t,
|
|
3150
|
-
onClickFilter: (d = t == null ? void 0 : t.onClickFilter) == null ? void 0 : d.filter(
|
|
3151
|
-
(x) => x.columnIndex !== u
|
|
3152
|
-
)
|
|
3153
|
-
}), n((x) => {
|
|
3154
|
-
const v = [...x];
|
|
3155
|
-
return v[u] = !1, v;
|
|
3156
|
-
}));
|
|
3157
|
-
}
|
|
3158
|
-
function c(u, g) {
|
|
3159
|
-
var d;
|
|
3160
|
-
const j = (d = t == null ? void 0 : t.onClickFilter) == null ? void 0 : d.map((x) => x.columnIndex === u ? {
|
|
3161
|
-
...x,
|
|
3162
|
-
expression: g.target.value
|
|
3163
|
-
} : x);
|
|
3164
|
-
h({
|
|
3165
|
-
...t,
|
|
3166
|
-
onClickFilter: j
|
|
3167
|
-
});
|
|
3168
|
-
}
|
|
3169
|
-
function m(u) {
|
|
3170
|
-
var g, j, d, x;
|
|
3171
|
-
if (s != null && s[u] || (j = (g = t == null ? void 0 : t.onClickFilter) == null ? void 0 : g.find((v) => v.columnIndex === u)) != null && j.expression)
|
|
3172
|
-
return /* @__PURE__ */ e.jsx(
|
|
3173
|
-
de,
|
|
3174
|
-
{
|
|
3175
|
-
value: (x = (d = t == null ? void 0 : t.onClickFilter) == null ? void 0 : d.find((v) => v.columnIndex === u)) == null ? void 0 : x.expression,
|
|
3176
|
-
onChange: (v) => c(u, v),
|
|
3177
|
-
type: "text",
|
|
3178
|
-
className: "h-9 w-full font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",
|
|
3179
|
-
placeholder: "Expression"
|
|
3180
|
-
}
|
|
3181
|
-
);
|
|
3182
|
-
}
|
|
3183
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
3184
|
-
/* @__PURE__ */ e.jsx($, { children: "On Click" }),
|
|
3185
|
-
r == null ? void 0 : r.map((u, g) => {
|
|
3186
|
-
var j, d;
|
|
3187
|
-
return /* @__PURE__ */ e.jsx(
|
|
3188
|
-
"div",
|
|
3189
|
-
{
|
|
3190
|
-
className: "xbg-red-100 group flex items-center justify-between space-y-2",
|
|
3191
|
-
children: /* @__PURE__ */ e.jsxs("div", { className: "grow", children: [
|
|
3192
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2 py-2", children: [
|
|
3193
|
-
/* @__PURE__ */ e.jsx(
|
|
3194
|
-
ts,
|
|
3195
|
-
{
|
|
3196
|
-
checked: !!((j = t == null ? void 0 : t.onClickFilter) != null && j.find(
|
|
3197
|
-
(x) => x.columnIndex === g
|
|
3198
|
-
)),
|
|
3199
|
-
onCheckedChange: (x) => l(g, x)
|
|
3200
|
-
}
|
|
3201
|
-
),
|
|
3202
|
-
/* @__PURE__ */ e.jsx(
|
|
3203
|
-
"label",
|
|
3204
|
-
{
|
|
3205
|
-
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
3206
|
-
children: u
|
|
3207
|
-
}
|
|
3208
|
-
),
|
|
3209
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: ((d = t == null ? void 0 : t.onClickFilter) == null ? void 0 : d.find(
|
|
3210
|
-
(x) => x.columnIndex === g
|
|
3211
|
-
)) && /* @__PURE__ */ e.jsx(
|
|
3212
|
-
jt,
|
|
3213
|
-
{
|
|
3214
|
-
onClick: () => {
|
|
3215
|
-
n((x) => {
|
|
3216
|
-
const v = [...x];
|
|
3217
|
-
return v[g] = !x[g], v;
|
|
3218
|
-
});
|
|
3219
|
-
},
|
|
3220
|
-
className: "invisible size-3 cursor-pointer text-gray-400 group-hover:visible"
|
|
3221
|
-
}
|
|
3222
|
-
) })
|
|
3223
|
-
] }),
|
|
3224
|
-
m(g)
|
|
3225
|
-
] })
|
|
3226
|
-
},
|
|
3227
|
-
u
|
|
3228
|
-
);
|
|
3229
|
-
})
|
|
3230
|
-
] });
|
|
3231
|
-
}
|
|
3232
|
-
function ls() {
|
|
3233
|
-
var r, l, c;
|
|
3234
|
-
const s = o((m) => m.card.preferences), n = o(
|
|
3235
|
-
(m) => m.card.cfg
|
|
3236
|
-
), { setCardCfg: t, setCardPreferences: a, setChartOrientation: i } = o((m) => m.actions);
|
|
3237
|
-
(r = n == null ? void 0 : n.options) != null && r.indexAxis;
|
|
3238
|
-
function h(m) {
|
|
3239
|
-
i(m);
|
|
3240
|
-
}
|
|
3241
|
-
return /* @__PURE__ */ e.jsxs(
|
|
3242
|
-
As,
|
|
3243
|
-
{
|
|
3244
|
-
value: ((l = s == null ? void 0 : s.chartOptions) == null ? void 0 : l.indexAxis) || ((c = n == null ? void 0 : n.options) == null ? void 0 : c.indexAxis) || "x",
|
|
3245
|
-
onValueChange: h,
|
|
3246
|
-
className: "flex gap-3",
|
|
3247
|
-
defaultValue: "x",
|
|
3248
|
-
children: [
|
|
3249
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
3250
|
-
/* @__PURE__ */ e.jsx(Oe, { value: "x", id: "r1" }),
|
|
3251
|
-
/* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r1", children: "Vertical" })
|
|
3252
|
-
] }),
|
|
3253
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
3254
|
-
/* @__PURE__ */ e.jsx(Oe, { value: "y", id: "r2" }),
|
|
3255
|
-
/* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r2", children: "Horizontal" })
|
|
3256
|
-
] })
|
|
3257
|
-
]
|
|
3258
|
-
}
|
|
3259
|
-
);
|
|
3260
|
-
}
|
|
3261
|
-
const Se = "focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0";
|
|
3262
|
-
function et(s, n) {
|
|
3263
|
-
var a, i, h;
|
|
3264
|
-
const t = ft(s, n);
|
|
3265
|
-
return ((h = (i = (a = s == null ? void 0 : s.chartOptions) == null ? void 0 : a.scales) == null ? void 0 : i[t]) == null ? void 0 : h.type) || "linear";
|
|
3266
|
-
}
|
|
3267
|
-
function It() {
|
|
3268
|
-
var re, K, ie, S, O, J;
|
|
3269
|
-
const [s, n] = T(!1), t = o((k) => {
|
|
3270
|
-
var I;
|
|
3271
|
-
return (I = k.card) == null ? void 0 : I.preferences;
|
|
3272
|
-
}), a = o((k) => {
|
|
3273
|
-
var I;
|
|
3274
|
-
return (I = k.card) == null ? void 0 : I.cfg;
|
|
3275
|
-
}), i = ft(t, a), [h, r] = T(
|
|
3276
|
-
et(t)
|
|
3277
|
-
), [l, c] = T(
|
|
3278
|
-
((ie = (K = (re = t == null ? void 0 : t.chartOptions) == null ? void 0 : re.scales) == null ? void 0 : K[i]) == null ? void 0 : ie.min) || ""
|
|
3279
|
-
), [m, u] = T(
|
|
3280
|
-
((J = (O = (S = t == null ? void 0 : t.chartOptions) == null ? void 0 : S.scales) == null ? void 0 : O[i]) == null ? void 0 : J.max) || ""
|
|
3281
|
-
), [g, j] = T(l || m ? "custom" : "auto"), [d, x] = T(""), [v, f] = T(0), [F, M] = T(""), [N, V] = T(""), [q, _] = T(""), L = o(
|
|
3282
|
-
(k) => k.actions.setCardPreferences
|
|
3283
|
-
), { updateCardInFrame: C } = as(), b = o((k) => k.card), R = o((k) => {
|
|
3284
|
-
var I;
|
|
3285
|
-
return (I = k.card) == null ? void 0 : I.type;
|
|
3286
|
-
}), H = ["pie", "doughnut", "polarArea"].includes(R);
|
|
3287
|
-
Y(() => {
|
|
3288
|
-
var k, I, ee, E, se, ae, be, pe, Q, le, oe, ye, ce, fe;
|
|
3289
|
-
r(et(t)), c(
|
|
3290
|
-
((ee = (I = (k = t == null ? void 0 : t.chartOptions) == null ? void 0 : k.scales) == null ? void 0 : I[i]) == null ? void 0 : ee.min) === 0 ? 0 : ""
|
|
3291
|
-
), u(((ae = (se = (E = t == null ? void 0 : t.chartOptions) == null ? void 0 : E.scales) == null ? void 0 : se[i]) == null ? void 0 : ae.max) || ""), x(
|
|
3292
|
-
((le = (Q = (pe = (be = t == null ? void 0 : t.chartOptions) == null ? void 0 : be.scales) == null ? void 0 : pe[i]) == null ? void 0 : Q.ticks) == null ? void 0 : le.stepSize) || ""
|
|
3293
|
-
), f(((oe = t == null ? void 0 : t.numberAxisFormat) == null ? void 0 : oe.decimalPlaces) || 0), M(((ye = t == null ? void 0 : t.numberAxisFormat) == null ? void 0 : ye.suffix) || ""), V(((ce = t == null ? void 0 : t.numberAxisFormat) == null ? void 0 : ce.currency) || ""), _(((fe = t == null ? void 0 : t.numberAxisFormat) == null ? void 0 : fe.locale) || "");
|
|
3294
|
-
}, [s, t, i]);
|
|
3295
|
-
function A(k, I) {
|
|
3296
|
-
return I === "" || /^[0-9\b]+$/.test(I) ? Number(I) : Number(k);
|
|
3297
|
-
}
|
|
3298
|
-
function P() {
|
|
3299
|
-
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
3300
|
-
/* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-6 items-center gap-2", children: [
|
|
3301
|
-
/* @__PURE__ */ e.jsx(
|
|
3302
|
-
$,
|
|
3303
|
-
{
|
|
3304
|
-
className: "col-span-2 hover:cursor-pointer hover:underline",
|
|
3305
|
-
htmlFor: "currency",
|
|
3306
|
-
children: /* @__PURE__ */ e.jsx(
|
|
3307
|
-
"a",
|
|
3308
|
-
{
|
|
3309
|
-
target: "_blank",
|
|
3310
|
-
href: "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat",
|
|
3311
|
-
children: "Currency"
|
|
3312
|
-
}
|
|
3313
|
-
)
|
|
3314
|
-
}
|
|
3315
|
-
),
|
|
3316
|
-
/* @__PURE__ */ e.jsx(
|
|
3317
|
-
de,
|
|
3318
|
-
{
|
|
3319
|
-
value: N,
|
|
3320
|
-
placeholder: "USD",
|
|
3321
|
-
onChange: (k) => V(k.target.value),
|
|
3322
|
-
id: "currency",
|
|
3323
|
-
className: `col-span-2 h-8 w-full ${Se}`
|
|
3324
|
-
}
|
|
3325
|
-
),
|
|
3326
|
-
/* @__PURE__ */ e.jsx(
|
|
3327
|
-
de,
|
|
3328
|
-
{
|
|
3329
|
-
value: q,
|
|
3330
|
-
placeholder: "en-US",
|
|
3331
|
-
onChange: (k) => _(k.target.value),
|
|
3332
|
-
id: "locale",
|
|
3333
|
-
className: `col-span-2 h-8 w-full ${Se}`
|
|
3334
|
-
}
|
|
3335
|
-
)
|
|
3336
|
-
] }),
|
|
3337
|
-
/* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-9 items-center gap-2", children: [
|
|
3338
|
-
/* @__PURE__ */ e.jsx($, { className: "col-span-3", htmlFor: "format", children: "Decimals" }),
|
|
3339
|
-
/* @__PURE__ */ e.jsx(
|
|
3340
|
-
de,
|
|
3341
|
-
{
|
|
3342
|
-
value: v,
|
|
3343
|
-
onChange: (k) => f(Number(k.target.value)),
|
|
3344
|
-
id: "format",
|
|
3345
|
-
className: `col-span-6 h-8 w-full tracking-wide ${Se}`
|
|
3346
|
-
}
|
|
3347
|
-
)
|
|
3348
|
-
] })
|
|
3349
|
-
] });
|
|
3350
|
-
}
|
|
3351
|
-
function X() {
|
|
3352
|
-
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
3353
|
-
/* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 items-center gap-2", children: [
|
|
3354
|
-
/* @__PURE__ */ e.jsx($, { htmlFor: "range", children: "Range" }),
|
|
3355
|
-
/* @__PURE__ */ e.jsx(
|
|
3356
|
-
de,
|
|
3357
|
-
{
|
|
3358
|
-
id: "min",
|
|
3359
|
-
value: l,
|
|
3360
|
-
onChange: (k) => c((I) => A(I, k.target.value)),
|
|
3361
|
-
className: `col-span-1 h-8 w-full ${Se}`
|
|
3362
|
-
}
|
|
3363
|
-
),
|
|
3364
|
-
/* @__PURE__ */ e.jsx(
|
|
3365
|
-
de,
|
|
3366
|
-
{
|
|
3367
|
-
value: m,
|
|
3368
|
-
onChange: (k) => u((I) => A(I, k.target.value)),
|
|
3369
|
-
id: "max",
|
|
3370
|
-
className: `col-span-1 h-8 w-full ${Se}`
|
|
3371
|
-
}
|
|
3372
|
-
)
|
|
3373
|
-
] }),
|
|
3374
|
-
/* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 items-center gap-2", children: [
|
|
3375
|
-
/* @__PURE__ */ e.jsx($, { htmlFor: "step-size", children: "Step Size" }),
|
|
3376
|
-
/* @__PURE__ */ e.jsx(
|
|
3377
|
-
de,
|
|
3378
|
-
{
|
|
3379
|
-
value: d,
|
|
3380
|
-
onChange: (k) => x((I) => A(I, k.target.value)),
|
|
3381
|
-
id: "step-size",
|
|
3382
|
-
className: `col-span-1 h-8 w-full ${Se}`
|
|
3383
|
-
}
|
|
3384
|
-
)
|
|
3385
|
-
] })
|
|
3386
|
-
] });
|
|
3387
|
-
}
|
|
3388
|
-
function W() {
|
|
3389
|
-
var E;
|
|
3390
|
-
let k = {};
|
|
3391
|
-
g === "custom" && (k = {
|
|
3392
|
-
min: l,
|
|
3393
|
-
max: m,
|
|
3394
|
-
ticks: {
|
|
3395
|
-
stepSize: d
|
|
3396
|
-
}
|
|
3397
|
-
});
|
|
3398
|
-
const I = {
|
|
3399
|
-
...t || {},
|
|
3400
|
-
chartOptions: {
|
|
3401
|
-
...t == null ? void 0 : t.chartOptions,
|
|
3402
|
-
scales: {
|
|
3403
|
-
...(E = t == null ? void 0 : t.chartOptions) == null ? void 0 : E.scales,
|
|
3404
|
-
[i]: {
|
|
3405
|
-
// ...cardPreferences?.chartOptions?.scales?.[axis],
|
|
3406
|
-
type: h,
|
|
3407
|
-
...h === "linear" ? k : {}
|
|
3408
|
-
}
|
|
3409
|
-
}
|
|
3410
|
-
},
|
|
3411
|
-
numberAxisFormat: {
|
|
3412
|
-
decimalPlaces: v,
|
|
3413
|
-
suffix: F,
|
|
3414
|
-
currency: N,
|
|
3415
|
-
locale: q
|
|
3416
|
-
}
|
|
3417
|
-
};
|
|
3418
|
-
console.log(I), L(I);
|
|
3419
|
-
const ee = {
|
|
3420
|
-
...b,
|
|
3421
|
-
preferences: I
|
|
3422
|
-
};
|
|
3423
|
-
C(ee);
|
|
3424
|
-
}
|
|
3425
|
-
return /* @__PURE__ */ e.jsxs(ns, { onOpenChange: (k) => n(k), children: [
|
|
3426
|
-
/* @__PURE__ */ e.jsx(rs, { asChild: !0, children: /* @__PURE__ */ e.jsx(Da, { className: "size-4 cursor-pointer text-muted-foreground hover:text-foreground" }) }),
|
|
3427
|
-
/* @__PURE__ */ e.jsx(is, { align: "center", className: "max-w-65", children: /* @__PURE__ */ e.jsxs("div", { className: "grid gap-4", children: [
|
|
3428
|
-
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
3429
|
-
/* @__PURE__ */ e.jsx("h4", { className: "font-medium leading-none", children: "Scale Options" }),
|
|
3430
|
-
/* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: "Set the scale for the number axis" })
|
|
3431
|
-
] }),
|
|
3432
|
-
/* @__PURE__ */ e.jsxs("div", { className: "grid gap-2", children: [
|
|
3433
|
-
/* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 items-center gap-2", children: [
|
|
3434
|
-
/* @__PURE__ */ e.jsx($, { htmlFor: "scale", children: "Type" }),
|
|
3435
|
-
/* @__PURE__ */ e.jsxs(
|
|
3436
|
-
ke,
|
|
3437
|
-
{
|
|
3438
|
-
disabled: H,
|
|
3439
|
-
value: h,
|
|
3440
|
-
onValueChange: (k) => r(k),
|
|
3441
|
-
children: [
|
|
3442
|
-
/* @__PURE__ */ e.jsx(ze, { className: "col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(Fe, {}) }),
|
|
3443
|
-
/* @__PURE__ */ e.jsx(Le, { id: "type", children: /* @__PURE__ */ e.jsxs(_e, { children: [
|
|
3444
|
-
/* @__PURE__ */ e.jsx(Me, { children: "Option" }),
|
|
3445
|
-
/* @__PURE__ */ e.jsx(te, { value: "linear", children: "Linear" }),
|
|
3446
|
-
/* @__PURE__ */ e.jsx(te, { value: "logarithmic", children: "Logarithmic" })
|
|
3447
|
-
] }) })
|
|
3448
|
-
]
|
|
3449
|
-
}
|
|
3450
|
-
)
|
|
3451
|
-
] }),
|
|
3452
|
-
h == "linear" && /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 items-center gap-2 py-1", children: [
|
|
3453
|
-
/* @__PURE__ */ e.jsx($, { htmlFor: "scale-option", children: "Setup" }),
|
|
3454
|
-
/* @__PURE__ */ e.jsxs(
|
|
3455
|
-
As,
|
|
3456
|
-
{
|
|
3457
|
-
disabled: H,
|
|
3458
|
-
id: "scale-option",
|
|
3459
|
-
value: g,
|
|
3460
|
-
onValueChange: (k) => j(k),
|
|
3461
|
-
className: "col-span-2 flex gap-3",
|
|
3462
|
-
defaultValue: "x",
|
|
3463
|
-
children: [
|
|
3464
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
3465
|
-
/* @__PURE__ */ e.jsx(Oe, { value: "auto", id: "r1" }),
|
|
3466
|
-
/* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r1", children: "Auto" })
|
|
3467
|
-
] }),
|
|
3468
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
3469
|
-
/* @__PURE__ */ e.jsx(Oe, { value: "custom", id: "r2" }),
|
|
3470
|
-
/* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r2", children: "Custom" })
|
|
3471
|
-
] })
|
|
3472
|
-
]
|
|
3473
|
-
}
|
|
3474
|
-
)
|
|
3475
|
-
] }),
|
|
3476
|
-
g === "custom" && h == "linear" && X(),
|
|
3477
|
-
P(),
|
|
3478
|
-
/* @__PURE__ */ e.jsx(Ta, {}),
|
|
3479
|
-
/* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3", children: /* @__PURE__ */ e.jsx(
|
|
3480
|
-
z,
|
|
3481
|
-
{
|
|
3482
|
-
onClick: W,
|
|
3483
|
-
variant: "secondary",
|
|
3484
|
-
className: "col-span-1 col-start-3 h-8 w-full",
|
|
3485
|
-
children: "Apply"
|
|
3486
|
-
}
|
|
3487
|
-
) })
|
|
3488
|
-
] })
|
|
3489
|
-
] }) })
|
|
3490
|
-
] });
|
|
3491
|
-
}
|
|
3492
|
-
function nr({ idx: s }) {
|
|
3493
|
-
var l;
|
|
3494
|
-
const n = o((c) => {
|
|
3495
|
-
var m;
|
|
3496
|
-
return (m = c.card) == null ? void 0 : m.preferences;
|
|
3497
|
-
}), t = o(
|
|
3498
|
-
(c) => {
|
|
3499
|
-
var m;
|
|
3500
|
-
return (m = c.card.preferences) == null ? void 0 : m.datasetOptions;
|
|
3501
|
-
}
|
|
3502
|
-
), a = o(
|
|
3503
|
-
(c) => c.actions.setCardPreferences
|
|
3504
|
-
), i = (l = n == null ? void 0 : n.chartOptions) == null ? void 0 : l.indexAxis, h = t == null ? void 0 : t.find((c) => c.idx === s);
|
|
3505
|
-
function r(c, m) {
|
|
3506
|
-
(c === "end" || c === "start") && Aa(Ia());
|
|
3507
|
-
const u = {
|
|
3508
|
-
display: c !== "none",
|
|
3509
|
-
align: c,
|
|
3510
|
-
anchor: c,
|
|
3511
|
-
clamp: !0
|
|
3512
|
-
};
|
|
3513
|
-
if (!h)
|
|
3514
|
-
a({
|
|
3515
|
-
...n,
|
|
3516
|
-
datasetOptions: [
|
|
3517
|
-
...t || [],
|
|
3518
|
-
{
|
|
3519
|
-
idx: m,
|
|
3520
|
-
datalabels: u
|
|
3521
|
-
}
|
|
3522
|
-
]
|
|
3523
|
-
});
|
|
3524
|
-
else {
|
|
3525
|
-
const g = { ...h };
|
|
3526
|
-
g.datalabels = u;
|
|
3527
|
-
const j = t == null ? void 0 : t.map(
|
|
3528
|
-
(d) => d.idx === m ? g : d
|
|
3529
|
-
);
|
|
3530
|
-
a({
|
|
3531
|
-
...n,
|
|
3532
|
-
datasetOptions: j
|
|
3533
|
-
});
|
|
3534
|
-
}
|
|
3535
|
-
}
|
|
3536
|
-
return /* @__PURE__ */ e.jsxs(ns, { children: [
|
|
3537
|
-
/* @__PURE__ */ e.jsx(rs, { children: /* @__PURE__ */ e.jsx(Sn, { className: "invisible size-4 rotate-[135deg] cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible" }) }),
|
|
3538
|
-
/* @__PURE__ */ e.jsx(is, { className: "w-fit p-1", children: /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
|
|
3539
|
-
/* @__PURE__ */ e.jsx(
|
|
3540
|
-
z,
|
|
3541
|
-
{
|
|
3542
|
-
onClick: () => r("none", s),
|
|
3543
|
-
size: "sm",
|
|
3544
|
-
variant: "secondary",
|
|
3545
|
-
className: "h-7 p-1 text-xs font-normal",
|
|
3546
|
-
children: /* @__PURE__ */ e.jsx(pt, { className: "size-4" })
|
|
3547
|
-
}
|
|
3548
|
-
),
|
|
3549
|
-
/* @__PURE__ */ e.jsx(
|
|
3550
|
-
z,
|
|
3551
|
-
{
|
|
3552
|
-
onClick: () => r("start", s),
|
|
3553
|
-
size: "sm",
|
|
3554
|
-
variant: "secondary",
|
|
3555
|
-
className: "h-7 p-1 text-xs font-normal",
|
|
3556
|
-
children: /* @__PURE__ */ e.jsx(
|
|
3557
|
-
mn,
|
|
3558
|
-
{
|
|
3559
|
-
className: Z("h-4 w-4", {
|
|
3560
|
-
"rotate-90": i === "y"
|
|
3561
|
-
})
|
|
3562
|
-
}
|
|
3563
|
-
)
|
|
3564
|
-
}
|
|
3565
|
-
),
|
|
3566
|
-
/* @__PURE__ */ e.jsx(
|
|
3567
|
-
z,
|
|
3568
|
-
{
|
|
3569
|
-
onClick: () => r("center", s),
|
|
3570
|
-
size: "sm",
|
|
3571
|
-
variant: "secondary",
|
|
3572
|
-
className: "h-7 p-1 text-xs font-normal",
|
|
3573
|
-
children: /* @__PURE__ */ e.jsx(
|
|
3574
|
-
pn,
|
|
3575
|
-
{
|
|
3576
|
-
className: Z("h-4 w-4", {
|
|
3577
|
-
"rotate-90": i === "y"
|
|
3578
|
-
})
|
|
3579
|
-
}
|
|
3580
|
-
)
|
|
3581
|
-
}
|
|
3582
|
-
),
|
|
3583
|
-
/* @__PURE__ */ e.jsx(
|
|
3584
|
-
z,
|
|
3585
|
-
{
|
|
3586
|
-
onClick: () => r("end", s),
|
|
3587
|
-
size: "sm",
|
|
3588
|
-
variant: "secondary",
|
|
3589
|
-
className: "h-7 p-1 text-xs font-normal",
|
|
3590
|
-
children: /* @__PURE__ */ e.jsx(
|
|
3591
|
-
xn,
|
|
3592
|
-
{
|
|
3593
|
-
className: Z("h-4 w-4", {
|
|
3594
|
-
"rotate-90": i === "y"
|
|
3595
|
-
})
|
|
3596
|
-
}
|
|
3597
|
-
)
|
|
3598
|
-
}
|
|
3599
|
-
)
|
|
3600
|
-
] }) })
|
|
3601
|
-
] });
|
|
3602
|
-
}
|
|
3603
|
-
function Et() {
|
|
3604
|
-
const s = o((c) => c.card), n = o(
|
|
3605
|
-
(c) => {
|
|
3606
|
-
var m, u, g;
|
|
3607
|
-
return (g = (u = (m = c == null ? void 0 : c.card) == null ? void 0 : m.preferences) == null ? void 0 : u.chartOptions) == null ? void 0 : g.indexAxis;
|
|
3608
|
-
}
|
|
3609
|
-
), t = n === "y" ? "Y axis" : "X axis", a = n === "y" ? "X axis" : "Y axis", {
|
|
3610
|
-
keys: i,
|
|
3611
|
-
metricKeys: h,
|
|
3612
|
-
dimensionKeys: r
|
|
3613
|
-
} = xs(s.data || []);
|
|
3614
|
-
let l = h;
|
|
3615
|
-
if (["stackedBar", "stackedLine"].includes(s.type)) {
|
|
3616
|
-
const c = Ea({
|
|
3617
|
-
dataArray: s.data || [],
|
|
3618
|
-
groupKey: r[0],
|
|
3619
|
-
pivotKey: r[1],
|
|
3620
|
-
valueKey: l[0]
|
|
3621
|
-
}), { metricKeys: m } = xs(c);
|
|
3622
|
-
l = m;
|
|
3623
|
-
}
|
|
3624
|
-
return i.length === 0 ? null : /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
|
|
3625
|
-
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
3626
|
-
/* @__PURE__ */ e.jsx($, { children: t }),
|
|
3627
|
-
/* @__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] }) }) })
|
|
3628
|
-
] }),
|
|
3629
|
-
/* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
3630
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-5", children: [
|
|
3631
|
-
/* @__PURE__ */ e.jsx($, { children: a }),
|
|
3632
|
-
/* @__PURE__ */ e.jsx(It, {})
|
|
3633
|
-
] }),
|
|
3634
|
-
/* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: l.map((c, m) => /* @__PURE__ */ e.jsx(rr, { col: c, idx: m }, c)) })
|
|
3635
|
-
] })
|
|
3636
|
-
] });
|
|
3637
|
-
}
|
|
3638
|
-
function rr({ col: s, idx: n }) {
|
|
3639
|
-
const t = o((l) => {
|
|
3640
|
-
var c;
|
|
3641
|
-
return (c = l.card) == null ? void 0 : c.preferences;
|
|
3642
|
-
}), a = o(
|
|
3643
|
-
(l) => {
|
|
3644
|
-
var c;
|
|
3645
|
-
return (c = l.card.preferences) == null ? void 0 : c.datasetOptions;
|
|
3646
|
-
}
|
|
3647
|
-
), i = a == null ? void 0 : a.find((l) => l.idx === n), { setCardPreferences: h } = o((l) => l.actions);
|
|
3648
|
-
function r(l) {
|
|
3649
|
-
if (!i)
|
|
3650
|
-
h({
|
|
3651
|
-
...t,
|
|
3652
|
-
datasetOptions: [
|
|
3653
|
-
...a || [],
|
|
3654
|
-
{
|
|
3655
|
-
idx: n,
|
|
3656
|
-
type: l === "area" ? "line" : l,
|
|
3657
|
-
fill: l === "area" ? "origin" : ""
|
|
3658
|
-
}
|
|
3659
|
-
]
|
|
3660
|
-
});
|
|
3661
|
-
else {
|
|
3662
|
-
const c = { ...i };
|
|
3663
|
-
c.type = l === "area" ? "line" : l, c.fill = l === "area" ? "origin" : "";
|
|
3664
|
-
const m = a == null ? void 0 : a.map(
|
|
3665
|
-
(u) => u.idx === n ? c : u
|
|
3666
|
-
);
|
|
3667
|
-
h({
|
|
3668
|
-
...t,
|
|
3669
|
-
datasetOptions: m
|
|
3670
|
-
});
|
|
3671
|
-
}
|
|
3672
|
-
}
|
|
3673
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "group flex items-center justify-between gap-5 rounded-md bg-muted/70 px-2 py-1 hover:bg-muted", children: [
|
|
3674
|
-
/* @__PURE__ */ e.jsx("p", { children: s }),
|
|
3675
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
|
|
3676
|
-
/* @__PURE__ */ e.jsx(
|
|
3677
|
-
Es,
|
|
3678
|
-
{
|
|
3679
|
-
onClick: () => r("bar"),
|
|
3680
|
-
className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
|
|
3681
|
-
}
|
|
3682
|
-
),
|
|
3683
|
-
/* @__PURE__ */ e.jsx(
|
|
3684
|
-
qs,
|
|
3685
|
-
{
|
|
3686
|
-
onClick: () => r("line"),
|
|
3687
|
-
className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
|
|
3688
|
-
}
|
|
3689
|
-
),
|
|
3690
|
-
/* @__PURE__ */ e.jsx(
|
|
3691
|
-
sn,
|
|
3692
|
-
{
|
|
3693
|
-
onClick: () => r("area"),
|
|
3694
|
-
className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
|
|
3695
|
-
}
|
|
3696
|
-
),
|
|
3697
|
-
/* @__PURE__ */ e.jsx(
|
|
3698
|
-
Re,
|
|
3699
|
-
{
|
|
3700
|
-
orientation: "vertical",
|
|
3701
|
-
className: "invisible size-4 cursor-pointer py-2 text-muted-foreground hover:text-foreground group-hover:visible"
|
|
3702
|
-
}
|
|
3703
|
-
),
|
|
3704
|
-
/* @__PURE__ */ e.jsx(nr, { idx: n })
|
|
3705
|
-
] })
|
|
3706
|
-
] });
|
|
3707
|
-
}
|
|
3708
|
-
function qt() {
|
|
3709
|
-
const s = o((j) => j.selectedConnectionId), n = o((j) => j.selectedDatamodelId), t = o((j) => j.selectedDatabaseName), a = o((j) => j.selectedSchemaName), i = o((j) => j.selectedTableName), h = w((j) => j.dashboard.filters) || [], r = w((j) => j.actions.addFilter), l = w((j) => j.actions.removeFilter), c = w(
|
|
3710
|
-
(j) => j.actions.removeFilterValue
|
|
3711
|
-
), { modelItems: m, tableName: u } = De();
|
|
3712
|
-
function g(j, d = "dashboard") {
|
|
3713
|
-
var _;
|
|
3714
|
-
const x = ue(j.column_name), v = ue(t || ""), f = ue(a || ""), F = ue(u);
|
|
3715
|
-
let M = ot(
|
|
3716
|
-
f,
|
|
3717
|
-
F
|
|
3718
|
-
), N = `${M}.${x}`;
|
|
3719
|
-
const V = (_ = m == null ? void 0 : m.find(
|
|
3720
|
-
(L) => L.id === n
|
|
3721
|
-
)) == null ? void 0 : _.name;
|
|
3722
|
-
n && n !== "none" && (N = `${ms}.${V}.${x}`, M = `${ms}.${V}`);
|
|
3723
|
-
const q = h == null ? void 0 : h.find(
|
|
3724
|
-
(L) => L.column === N && L.table === F && (L.database === v || L.database === t)
|
|
3725
|
-
);
|
|
3726
|
-
if (q)
|
|
3727
|
-
c(q.id), l(q.id);
|
|
3728
|
-
else {
|
|
3729
|
-
const L = Ze();
|
|
3730
|
-
return u === "api" && s ? (r({
|
|
3731
|
-
location: d,
|
|
3732
|
-
id: L,
|
|
3733
|
-
//uuidv4(),
|
|
3734
|
-
column: N,
|
|
3735
|
-
title: j.column_name,
|
|
3736
|
-
dataType: j.data_type,
|
|
3737
|
-
table: "api",
|
|
3738
|
-
database: "",
|
|
3739
|
-
// database: 'NA',
|
|
3740
|
-
connectionId: s,
|
|
3741
|
-
operation: "in",
|
|
3742
|
-
sql: Ws(
|
|
3743
|
-
j.data_type,
|
|
3744
|
-
M,
|
|
3745
|
-
x
|
|
3746
|
-
)
|
|
3747
|
-
//DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
|
|
3748
|
-
}), L) : (r({
|
|
3749
|
-
id: L,
|
|
3750
|
-
//uuidv4(),
|
|
3751
|
-
location: d,
|
|
3752
|
-
column: N,
|
|
3753
|
-
//columnName, //`${qualifiedTableName}.${formattedColumnName}`,
|
|
3754
|
-
title: j.column_name,
|
|
3755
|
-
dataType: j.data_type,
|
|
3756
|
-
table: i || "",
|
|
3757
|
-
database: t || "",
|
|
3758
|
-
connectionId: s || "",
|
|
3759
|
-
operation: "in",
|
|
3760
|
-
sql: Ws(
|
|
3761
|
-
j.data_type,
|
|
3762
|
-
M,
|
|
3763
|
-
x
|
|
3764
|
-
)
|
|
3765
|
-
//DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
|
|
3766
|
-
}), L);
|
|
3767
|
-
}
|
|
3768
|
-
}
|
|
3769
|
-
return { assignFilter: g };
|
|
3770
|
-
}
|
|
3771
|
-
function Ae() {
|
|
3772
|
-
const s = w(
|
|
3773
|
-
(l) => l.dashboard.filters
|
|
3774
|
-
), n = o((l) => l.frame), { setFrame: t } = as(), { columns: a } = De(), { assignFilter: i } = qt();
|
|
3775
|
-
function h(l) {
|
|
3776
|
-
const c = i(l, "frame");
|
|
3777
|
-
t({ ...n, filterId: c });
|
|
3778
|
-
}
|
|
3779
|
-
const r = s == null ? void 0 : s.find((l) => l.id === n.filterId);
|
|
3780
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
|
|
3781
|
-
/* @__PURE__ */ e.jsx($, { children: "Card Filter" }),
|
|
3782
|
-
/* @__PURE__ */ e.jsx(ir, { onSelect: h, columns: a }),
|
|
3783
|
-
r && /* @__PURE__ */ e.jsx(qa, { filter: r })
|
|
3784
|
-
] });
|
|
3785
|
-
}
|
|
3786
|
-
function ir({
|
|
3787
|
-
columns: s,
|
|
3788
|
-
onSelect: n
|
|
3789
|
-
}) {
|
|
3790
|
-
var r;
|
|
3791
|
-
const [t, a] = Js.useState(!1), [i, h] = Js.useState("");
|
|
3792
|
-
return /* @__PURE__ */ e.jsxs(ns, { open: t, onOpenChange: a, children: [
|
|
3793
|
-
/* @__PURE__ */ e.jsx(rs, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
|
|
3794
|
-
z,
|
|
3795
|
-
{
|
|
3796
|
-
size: "sm",
|
|
3797
|
-
variant: "outline",
|
|
3798
|
-
role: "combobox",
|
|
3799
|
-
"aria-expanded": t,
|
|
3800
|
-
className: "w-full justify-between font-normal",
|
|
3801
|
-
children: [
|
|
3802
|
-
i ? (r = s.find((l) => l.column_name === i)) == null ? void 0 : r.column_name : "Select Column...",
|
|
3803
|
-
/* @__PURE__ */ e.jsx(Va, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
3804
|
-
]
|
|
3805
|
-
}
|
|
3806
|
-
) }),
|
|
3807
|
-
/* @__PURE__ */ e.jsx(is, { className: "w-[200px] p-0", children: /* @__PURE__ */ e.jsxs(_a, { children: [
|
|
3808
|
-
/* @__PURE__ */ e.jsx(Ra, { placeholder: "Search column", className: "h-9" }),
|
|
3809
|
-
/* @__PURE__ */ e.jsxs(Ha, { children: [
|
|
3810
|
-
/* @__PURE__ */ e.jsx($a, { children: "No framework found." }),
|
|
3811
|
-
/* @__PURE__ */ e.jsx(Pa, { children: s.map((l) => /* @__PURE__ */ e.jsxs(
|
|
3812
|
-
Ba,
|
|
3813
|
-
{
|
|
3814
|
-
value: l.column_name,
|
|
3815
|
-
onSelect: (c) => {
|
|
3816
|
-
const m = c === i ? "" : c;
|
|
3817
|
-
h(m), a(!1), m && n(l);
|
|
3818
|
-
},
|
|
3819
|
-
children: [
|
|
3820
|
-
l.column_name,
|
|
3821
|
-
/* @__PURE__ */ e.jsx(
|
|
3822
|
-
xt,
|
|
3823
|
-
{
|
|
3824
|
-
className: Z(
|
|
3825
|
-
"ml-auto h-4 w-4",
|
|
3826
|
-
i === l.column_name ? "opacity-100" : "opacity-0"
|
|
3827
|
-
)
|
|
3828
|
-
}
|
|
3829
|
-
)
|
|
3830
|
-
]
|
|
3831
|
-
},
|
|
3832
|
-
l.column_name
|
|
3833
|
-
)) })
|
|
3834
|
-
] })
|
|
3835
|
-
] }) })
|
|
3836
|
-
] });
|
|
3837
|
-
}
|
|
3838
|
-
function lr({
|
|
3839
|
-
cardType: s
|
|
3840
|
-
}) {
|
|
3841
|
-
return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Ne, { defaultValue: ["item-2"], type: "multiple", children: [
|
|
3842
|
-
/* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
|
|
3843
|
-
/* @__PURE__ */ e.jsx(G, { children: `${Is(s)} Chart` }),
|
|
3844
|
-
/* @__PURE__ */ e.jsxs(U, { className: "space-y-4 font-mono text-xs", children: [
|
|
3845
|
-
/* @__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" }),
|
|
3846
|
-
/* @__PURE__ */ e.jsxs("ul", { className: "ml-6 list-disc text-xs [&>li]:mt-2", children: [
|
|
3847
|
-
/* @__PURE__ */ e.jsx("li", { children: "x-axis - category" }),
|
|
3848
|
-
/* @__PURE__ */ e.jsx("li", { children: "y-axis1 - number" }),
|
|
3849
|
-
/* @__PURE__ */ e.jsx("li", { children: "y-axis2 - number" })
|
|
3850
|
-
] }),
|
|
3851
|
-
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
3852
|
-
"See ",
|
|
3853
|
-
/* @__PURE__ */ e.jsx(
|
|
3854
|
-
"a",
|
|
3855
|
-
{
|
|
3856
|
-
target: "_blank",
|
|
3857
|
-
onClick: (n) => n.stopPropagation(),
|
|
3858
|
-
className: "text-blue-700",
|
|
3859
|
-
href: "https://docs.semaphor.cloud/concepts/visuals#line-chart",
|
|
3860
|
-
children: "example"
|
|
3861
|
-
}
|
|
3862
|
-
),
|
|
3863
|
-
" in the docs."
|
|
3864
|
-
] })
|
|
3865
|
-
] })
|
|
3866
|
-
] }),
|
|
3867
|
-
/* @__PURE__ */ e.jsxs(B, { value: "item-2", children: [
|
|
3868
|
-
/* @__PURE__ */ e.jsx(G, { children: "Settings" }),
|
|
3869
|
-
/* @__PURE__ */ e.jsxs(U, { className: "space-y-4 px-2", children: [
|
|
3870
|
-
/* @__PURE__ */ e.jsx(ls, {}),
|
|
3871
|
-
/* @__PURE__ */ e.jsx(Et, {})
|
|
3872
|
-
] })
|
|
3873
|
-
] }),
|
|
3874
|
-
/* @__PURE__ */ e.jsxs(B, { value: "item-3", children: [
|
|
3875
|
-
/* @__PURE__ */ e.jsx(G, { children: "Filters" }),
|
|
3876
|
-
/* @__PURE__ */ e.jsxs(U, { className: "space-y-4 px-2", children: [
|
|
3877
|
-
/* @__PURE__ */ e.jsx(Te, {}),
|
|
3878
|
-
/* @__PURE__ */ e.jsx(Ae, {})
|
|
3879
|
-
] })
|
|
3880
|
-
] })
|
|
3881
|
-
] }) });
|
|
3882
|
-
}
|
|
3883
|
-
function _s() {
|
|
3884
|
-
var i, h, r;
|
|
3885
|
-
const s = o(
|
|
3886
|
-
(l) => l.card.cfg
|
|
3887
|
-
), n = o((l) => l.actions.setCardCfg), t = o((l) => l.card.type);
|
|
3888
|
-
function a(l) {
|
|
3889
|
-
var u;
|
|
3890
|
-
const c = {
|
|
3891
|
-
datalabels: {
|
|
3892
|
-
display: l !== "none",
|
|
3893
|
-
align: l,
|
|
3894
|
-
anchor: l,
|
|
3895
|
-
clamp: !0
|
|
3896
|
-
}
|
|
3897
|
-
}, m = {
|
|
3898
|
-
...s,
|
|
3899
|
-
options: {
|
|
3900
|
-
...s == null ? void 0 : s.options,
|
|
3901
|
-
plugins: {
|
|
3902
|
-
...(u = s == null ? void 0 : s.options) == null ? void 0 : u.plugins,
|
|
3903
|
-
...c
|
|
3904
|
-
}
|
|
3905
|
-
}
|
|
3906
|
-
};
|
|
3907
|
-
n(m), console.log(l);
|
|
3908
|
-
}
|
|
3909
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
3910
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
3911
|
-
/* @__PURE__ */ e.jsx("label", { className: "font-medium", children: "Data Labels" }),
|
|
3912
|
-
!["pyramid"].includes(t) && /* @__PURE__ */ e.jsx(It, {})
|
|
3913
|
-
] }),
|
|
3914
|
-
/* @__PURE__ */ e.jsxs(
|
|
3915
|
-
ke,
|
|
3916
|
-
{
|
|
3917
|
-
value: (r = (h = (i = s == null ? void 0 : s.options) == null ? void 0 : i.plugins) == null ? void 0 : h.datalabels) == null ? void 0 : r.anchor,
|
|
3918
|
-
onValueChange: a,
|
|
3919
|
-
defaultValue: "none",
|
|
3920
|
-
children: [
|
|
3921
|
-
/* @__PURE__ */ e.jsx(ze, { className: "h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(Fe, { placeholder: "Select position" }) }),
|
|
3922
|
-
/* @__PURE__ */ e.jsx(Le, { children: /* @__PURE__ */ e.jsxs(_e, { children: [
|
|
3923
|
-
/* @__PURE__ */ e.jsx(Me, { children: "Data Labels" }),
|
|
3924
|
-
/* @__PURE__ */ e.jsx(te, { value: "none", children: "None" }),
|
|
3925
|
-
t !== "pyramid" && /* @__PURE__ */ e.jsx(te, { value: "start", children: "Start" }),
|
|
3926
|
-
/* @__PURE__ */ e.jsx(te, { value: "center", children: "Center" }),
|
|
3927
|
-
t !== "pyramid" && /* @__PURE__ */ e.jsx(te, { value: "end", children: "End" })
|
|
3928
|
-
] }) })
|
|
3929
|
-
]
|
|
3930
|
-
}
|
|
3931
|
-
)
|
|
3932
|
-
] });
|
|
3933
|
-
}
|
|
3934
|
-
function or({
|
|
3935
|
-
cardType: s
|
|
3936
|
-
}) {
|
|
3937
|
-
function n(t) {
|
|
3938
|
-
const a = "SELECT label, [group], x-axis, y-axis, radius FROM table", i = "SELECT label, [group], x-axis, y-axis FROM table";
|
|
3939
|
-
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
3940
|
-
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: t === "bubble" ? a : i }),
|
|
3941
|
-
/* @__PURE__ */ e.jsxs("ul", { className: "ml-6 list-disc text-xs [&>li]:mt-2", children: [
|
|
3942
|
-
/* @__PURE__ */ e.jsx("li", { children: "label - category" }),
|
|
3943
|
-
/* @__PURE__ */ e.jsx("li", { children: "group - category" }),
|
|
3944
|
-
/* @__PURE__ */ e.jsx("li", { children: "x-axis - category" }),
|
|
3945
|
-
/* @__PURE__ */ e.jsx("li", { children: "y-axis - category" }),
|
|
3946
|
-
t === "bubble" && /* @__PURE__ */ e.jsx("li", { children: "radius - number" })
|
|
3947
|
-
] }),
|
|
3948
|
-
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
3949
|
-
"See ",
|
|
3950
|
-
/* @__PURE__ */ e.jsx(
|
|
3951
|
-
"a",
|
|
3952
|
-
{
|
|
3953
|
-
target: "_blank",
|
|
3954
|
-
onClick: (h) => h.stopPropagation(),
|
|
3955
|
-
className: "text-blue-700",
|
|
3956
|
-
href: "https://docs.semaphor.cloud/concepts/visuals#pie-chart",
|
|
3957
|
-
children: "example"
|
|
3958
|
-
}
|
|
3959
|
-
),
|
|
3960
|
-
" in the docs."
|
|
3961
|
-
] })
|
|
3962
|
-
] });
|
|
3963
|
-
}
|
|
3964
|
-
return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Ne, { defaultValue: ["item-2"], type: "multiple", children: [
|
|
3965
|
-
/* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
|
|
3966
|
-
/* @__PURE__ */ e.jsx(G, { children: `${Is(s)} Chart` }),
|
|
3967
|
-
/* @__PURE__ */ e.jsx(U, { className: "space-y-4 font-mono text-xs", children: n(s) })
|
|
3968
|
-
] }),
|
|
3969
|
-
/* @__PURE__ */ e.jsxs(B, { value: "item-2", children: [
|
|
3970
|
-
/* @__PURE__ */ e.jsx(G, { children: "Settings" }),
|
|
3971
|
-
/* @__PURE__ */ e.jsx(U, { className: "px-2", children: /* @__PURE__ */ e.jsx(_s, {}) })
|
|
3972
|
-
] }),
|
|
3973
|
-
/* @__PURE__ */ e.jsxs(B, { value: "item-3", children: [
|
|
3974
|
-
/* @__PURE__ */ e.jsx(G, { children: "Filters" }),
|
|
3975
|
-
/* @__PURE__ */ e.jsxs(U, { className: "space-y-4 px-2", children: [
|
|
3976
|
-
/* @__PURE__ */ e.jsx(Te, {}),
|
|
3977
|
-
/* @__PURE__ */ e.jsx(Ae, {})
|
|
3978
|
-
] })
|
|
3979
|
-
] })
|
|
3980
|
-
] }) });
|
|
3981
|
-
}
|
|
3982
|
-
const cr = {
|
|
3983
|
-
datasets: [
|
|
3984
|
-
{
|
|
3985
|
-
type: "line",
|
|
3986
|
-
label: "Sum_sales",
|
|
3987
|
-
data: []
|
|
3988
|
-
},
|
|
3989
|
-
{
|
|
3990
|
-
type: "bar",
|
|
3991
|
-
label: "Sum_profit",
|
|
3992
|
-
data: []
|
|
3993
|
-
}
|
|
3994
|
-
]
|
|
3995
|
-
}, dr = {
|
|
3996
|
-
datasets: [
|
|
3997
|
-
{
|
|
3998
|
-
fill: "origin",
|
|
3999
|
-
type: "line",
|
|
4000
|
-
label: "Sum_sales",
|
|
4001
|
-
data: []
|
|
4002
|
-
}
|
|
4003
|
-
]
|
|
4004
|
-
};
|
|
4005
|
-
function hr() {
|
|
4006
|
-
const s = o((n) => n.card.type);
|
|
4007
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 p-6", children: [
|
|
4008
|
-
/* @__PURE__ */ e.jsx(
|
|
4009
|
-
Ne,
|
|
4010
|
-
{
|
|
4011
|
-
className: " ",
|
|
4012
|
-
type: "single",
|
|
4013
|
-
collapsible: !0,
|
|
4014
|
-
children: ur(s)
|
|
4015
|
-
}
|
|
4016
|
-
),
|
|
4017
|
-
/* @__PURE__ */ e.jsx("section", { className: "", children: ["line", "bar"].includes(s) && /* @__PURE__ */ e.jsx(ls, {}) }),
|
|
4018
|
-
!["kpi"].includes(s) && /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
|
|
4019
|
-
/* @__PURE__ */ e.jsx(_s, {}),
|
|
4020
|
-
/* @__PURE__ */ e.jsx(Te, {}),
|
|
4021
|
-
/* @__PURE__ */ e.jsx(Ae, {})
|
|
4022
|
-
] })
|
|
4023
|
-
] });
|
|
4024
|
-
}
|
|
4025
|
-
function ur(s) {
|
|
4026
|
-
if (["line", "bar"].includes(s))
|
|
4027
|
-
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
4028
|
-
/* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
|
|
4029
|
-
/* @__PURE__ */ e.jsx(G, { className: "font-normal", children: /* @__PURE__ */ e.jsx("p", { children: "Chart Query" }) }),
|
|
4030
|
-
/* @__PURE__ */ e.jsxs(U, { className: " ", children: [
|
|
4031
|
-
/* @__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" }),
|
|
4032
|
-
/* @__PURE__ */ e.jsxs("ul", { className: "my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2", children: [
|
|
4033
|
-
/* @__PURE__ */ e.jsx("li", { children: "X-axis - Category (ex. city)" }),
|
|
4034
|
-
/* @__PURE__ */ e.jsx("li", { children: "Y-axis - Number (ex. population)" })
|
|
4035
|
-
] })
|
|
4036
|
-
] })
|
|
4037
|
-
] }),
|
|
4038
|
-
/* @__PURE__ */ e.jsxs(B, { value: "item-2", children: [
|
|
4039
|
-
/* @__PURE__ */ e.jsx(G, { className: "font-normal", children: "Mixed Chart" }),
|
|
4040
|
-
/* @__PURE__ */ e.jsxs(U, { className: "space-y-2 text-xs", children: [
|
|
4041
|
-
/* @__PURE__ */ e.jsxs("p", { children: [
|
|
4042
|
-
"Click ",
|
|
4043
|
-
/* @__PURE__ */ e.jsx("b", { children: "Customize" }),
|
|
4044
|
-
" and change the `type` property in the dataset."
|
|
4045
|
-
] }),
|
|
4046
|
-
/* @__PURE__ */ e.jsx("pre", { children: JSON.stringify(cr, null, 2) })
|
|
4047
|
-
] })
|
|
4048
|
-
] }),
|
|
4049
|
-
/* @__PURE__ */ e.jsxs(B, { value: "item-3", children: [
|
|
4050
|
-
/* @__PURE__ */ e.jsx(G, { className: "font-normal", children: "Area Chart" }),
|
|
4051
|
-
/* @__PURE__ */ e.jsxs(U, { className: "space-y-2 text-xs", children: [
|
|
4052
|
-
/* @__PURE__ */ e.jsxs("p", { children: [
|
|
4053
|
-
"Click ",
|
|
4054
|
-
/* @__PURE__ */ e.jsx("b", { children: "Customize" }),
|
|
4055
|
-
" and add `fill` property to the dataset. See",
|
|
4056
|
-
/* @__PURE__ */ e.jsx(
|
|
4057
|
-
"a",
|
|
4058
|
-
{
|
|
4059
|
-
className: "mx-1 text-blue-500 hover:underline",
|
|
4060
|
-
href: "https://www.chartjs.org/docs/latest/samples/area/line-boundaries.html",
|
|
4061
|
-
target: "_blank",
|
|
4062
|
-
children: "docs"
|
|
4063
|
-
}
|
|
4064
|
-
),
|
|
4065
|
-
"for more options."
|
|
4066
|
-
] }),
|
|
4067
|
-
/* @__PURE__ */ e.jsx("pre", { children: JSON.stringify(dr, null, 2) })
|
|
4068
|
-
] })
|
|
4069
|
-
] })
|
|
4070
|
-
] });
|
|
4071
|
-
if (s === "bubble")
|
|
4072
|
-
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
|
|
4073
|
-
/* @__PURE__ */ e.jsx(G, { className: "font-normal", children: /* @__PURE__ */ e.jsxs("p", { children: [
|
|
4074
|
-
"How to create a ",
|
|
4075
|
-
/* @__PURE__ */ e.jsx("span", { children: s }),
|
|
4076
|
-
" chart query?"
|
|
4077
|
-
] }) }),
|
|
4078
|
-
/* @__PURE__ */ e.jsxs(U, { className: " ", children: [
|
|
4079
|
-
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 font-mono text-xs font-semibold", children: "SELECT label, x-axis, y-axis, radius FROM table" }),
|
|
4080
|
-
/* @__PURE__ */ e.jsxs("ul", { className: "my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2", children: [
|
|
4081
|
-
/* @__PURE__ */ e.jsx("li", { children: "Label - Category (ex. city)" }),
|
|
4082
|
-
/* @__PURE__ */ e.jsx("li", { children: "Bubble Group (opt) - Category (ex. state)" }),
|
|
4083
|
-
/* @__PURE__ */ e.jsx("li", { children: "X-axis - Number (ex. avg. age)" }),
|
|
4084
|
-
/* @__PURE__ */ e.jsx("li", { children: "Y-axis - Number (ex. avg. weight)" }),
|
|
4085
|
-
/* @__PURE__ */ e.jsx("li", { children: "Radius - Number (ex. population)" })
|
|
4086
|
-
] })
|
|
4087
|
-
] })
|
|
4088
|
-
] }) });
|
|
4089
|
-
if (s === "scatter")
|
|
4090
|
-
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
|
|
4091
|
-
/* @__PURE__ */ e.jsx(G, { className: "font-normal", children: /* @__PURE__ */ e.jsxs("p", { children: [
|
|
4092
|
-
"How to create a ",
|
|
4093
|
-
/* @__PURE__ */ e.jsx("span", { children: s }),
|
|
4094
|
-
" chart query?"
|
|
4095
|
-
] }) }),
|
|
4096
|
-
/* @__PURE__ */ e.jsxs(U, { className: " ", children: [
|
|
4097
|
-
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 font-mono text-xs font-semibold", children: "SELECT label, x-axis, y-axis FROM table" }),
|
|
4098
|
-
/* @__PURE__ */ e.jsxs("ul", { className: "my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2", children: [
|
|
4099
|
-
/* @__PURE__ */ e.jsx("li", { children: "Label - Category (ex. city)" }),
|
|
4100
|
-
/* @__PURE__ */ e.jsx("li", { children: "Group (opt) - Category (ex. state)" }),
|
|
4101
|
-
/* @__PURE__ */ e.jsx("li", { children: "X-axis - Number (ex. avg. age)" }),
|
|
4102
|
-
/* @__PURE__ */ e.jsx("li", { children: "Y-axis - Number (ex. avg. weight)" })
|
|
4103
|
-
] })
|
|
4104
|
-
] })
|
|
4105
|
-
] }) });
|
|
4106
|
-
if (["pie", "doughnut", "polarArea"].includes(s))
|
|
4107
|
-
return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
|
|
4108
|
-
/* @__PURE__ */ e.jsx(G, { className: "font-normal", children: /* @__PURE__ */ e.jsxs("p", { children: [
|
|
4109
|
-
/* @__PURE__ */ e.jsx("span", { children: s === "polarArea" ? "Polar" : s.charAt(0).toUpperCase() + s.slice(1) }),
|
|
4110
|
-
" ",
|
|
4111
|
-
"chart query"
|
|
4112
|
-
] }) }),
|
|
4113
|
-
/* @__PURE__ */ e.jsxs(U, { className: " ", children: [
|
|
4114
|
-
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 font-mono text-xs font-semibold", children: "SELECT label, measure FROM table" }),
|
|
4115
|
-
/* @__PURE__ */ e.jsxs("ul", { className: "my-6 ml-6 list-disc text-xs font-normal [&>li]:mt-2", children: [
|
|
4116
|
-
/* @__PURE__ */ e.jsx("li", { children: "Label - Category (ex. city)" }),
|
|
4117
|
-
/* @__PURE__ */ e.jsx("li", { children: "Measure - Number (ex. population)" })
|
|
4118
|
-
] })
|
|
4119
|
-
] })
|
|
4120
|
-
] }) });
|
|
4121
|
-
}
|
|
4122
|
-
function mr() {
|
|
4123
|
-
var c, m, u, g, j;
|
|
4124
|
-
const s = o((d) => d.card.preferences), n = o(
|
|
4125
|
-
(d) => d.actions.setCardPreferences
|
|
4126
|
-
), t = o(
|
|
4127
|
-
(d) => d.actions.setNumberFormat
|
|
4128
|
-
);
|
|
4129
|
-
o(
|
|
4130
|
-
(d) => {
|
|
4131
|
-
var x, v;
|
|
4132
|
-
return (v = (x = d.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : v.decimalPlaces;
|
|
4133
|
-
}
|
|
4134
|
-
);
|
|
4135
|
-
const a = o(
|
|
4136
|
-
(d) => {
|
|
4137
|
-
var x, v;
|
|
4138
|
-
return (v = (x = d.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : v.locale;
|
|
4139
|
-
}
|
|
4140
|
-
), i = o(
|
|
4141
|
-
(d) => {
|
|
4142
|
-
var x, v;
|
|
4143
|
-
return (v = (x = d.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : v.currency;
|
|
4144
|
-
}
|
|
4145
|
-
);
|
|
4146
|
-
o(
|
|
4147
|
-
(d) => d.actions.setFilterOnClickField
|
|
4148
|
-
);
|
|
4149
|
-
const h = o(
|
|
4150
|
-
(d) => {
|
|
4151
|
-
var x, v;
|
|
4152
|
-
return (v = (x = d.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : v.colorRanges;
|
|
4153
|
-
}
|
|
4154
|
-
) || [], r = o(
|
|
4155
|
-
(d) => d.actions.setColorRanges
|
|
4156
|
-
), l = [...new Set(Qs.map((d) => d.currency))];
|
|
4157
|
-
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
4158
|
-
/* @__PURE__ */ e.jsxs("div", { className: "mb-3 flex items-center gap-2", children: [
|
|
4159
|
-
/* @__PURE__ */ e.jsx(
|
|
4160
|
-
ts,
|
|
4161
|
-
{
|
|
4162
|
-
checked: !!((c = s == null ? void 0 : s.formatNumber) != null && c.enabled),
|
|
4163
|
-
onCheckedChange: (d) => {
|
|
4164
|
-
n({
|
|
4165
|
-
...s,
|
|
4166
|
-
formatNumber: {
|
|
4167
|
-
...s == null ? void 0 : s.formatNumber,
|
|
4168
|
-
enabled: d
|
|
4169
|
-
}
|
|
4170
|
-
});
|
|
4171
|
-
}
|
|
4172
|
-
}
|
|
4173
|
-
),
|
|
4174
|
-
/* @__PURE__ */ e.jsx($, { children: "Format Number" })
|
|
4175
|
-
] }),
|
|
4176
|
-
((m = s == null ? void 0 : s.formatNumber) == null ? void 0 : m.enabled) === !0 && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
4177
|
-
/* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 p-2", children: [
|
|
4178
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4179
|
-
/* @__PURE__ */ e.jsxs("div", { className: "w-full space-y-1", children: [
|
|
4180
|
-
/* @__PURE__ */ e.jsx($, { children: "Locale" }),
|
|
4181
|
-
/* @__PURE__ */ e.jsxs(
|
|
4182
|
-
ke,
|
|
4183
|
-
{
|
|
4184
|
-
value: a || "en-US",
|
|
4185
|
-
onValueChange: (d) => {
|
|
4186
|
-
var x, v, f;
|
|
4187
|
-
return t(
|
|
4188
|
-
((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.decimalPlaces) || 0,
|
|
4189
|
-
((v = s == null ? void 0 : s.formatNumber) == null ? void 0 : v.currency) || "",
|
|
4190
|
-
d || "en-US",
|
|
4191
|
-
((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.suffix) || ""
|
|
4192
|
-
);
|
|
4193
|
-
},
|
|
4194
|
-
children: [
|
|
4195
|
-
/* @__PURE__ */ e.jsx(ze, { className: "col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(Fe, {}) }),
|
|
4196
|
-
/* @__PURE__ */ e.jsx(Le, { children: /* @__PURE__ */ e.jsxs(_e, { children: [
|
|
4197
|
-
/* @__PURE__ */ e.jsx(Me, { children: "Format" }),
|
|
4198
|
-
Qs.map((d) => /* @__PURE__ */ e.jsx(te, { value: d.locale, children: d.locale }, d.locale))
|
|
4199
|
-
] }) })
|
|
4200
|
-
]
|
|
4201
|
-
}
|
|
4202
|
-
)
|
|
4203
|
-
] }),
|
|
4204
|
-
/* @__PURE__ */ e.jsxs("div", { className: "w-full space-y-1", children: [
|
|
4205
|
-
/* @__PURE__ */ e.jsx($, { children: "Currency" }),
|
|
4206
|
-
/* @__PURE__ */ e.jsxs(
|
|
4207
|
-
ke,
|
|
4208
|
-
{
|
|
4209
|
-
value: i || "none",
|
|
4210
|
-
onValueChange: (d) => {
|
|
4211
|
-
var x, v, f;
|
|
4212
|
-
return t(
|
|
4213
|
-
((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.decimalPlaces) || 0,
|
|
4214
|
-
d === "none" ? "" : d,
|
|
4215
|
-
((v = s == null ? void 0 : s.formatNumber) == null ? void 0 : v.locale) || "",
|
|
4216
|
-
((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.suffix) || ""
|
|
4217
|
-
);
|
|
4218
|
-
},
|
|
4219
|
-
children: [
|
|
4220
|
-
/* @__PURE__ */ e.jsx(ze, { className: "col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(Fe, {}) }),
|
|
4221
|
-
/* @__PURE__ */ e.jsx(Le, { children: /* @__PURE__ */ e.jsxs(_e, { children: [
|
|
4222
|
-
/* @__PURE__ */ e.jsx(Me, { children: "Currency" }),
|
|
4223
|
-
/* @__PURE__ */ e.jsx(te, { value: "none", children: "None" }, "none"),
|
|
4224
|
-
l.map((d) => /* @__PURE__ */ e.jsx(te, { value: d, children: d }, d))
|
|
4225
|
-
] }) })
|
|
4226
|
-
]
|
|
4227
|
-
}
|
|
4228
|
-
)
|
|
4229
|
-
] })
|
|
4230
|
-
] }),
|
|
4231
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
|
|
4232
|
-
/* @__PURE__ */ e.jsxs("div", { className: "w-full space-y-1", children: [
|
|
4233
|
-
/* @__PURE__ */ e.jsx($, { children: "Decimals" }),
|
|
4234
|
-
/* @__PURE__ */ e.jsxs(
|
|
4235
|
-
ke,
|
|
4236
|
-
{
|
|
4237
|
-
value: ((g = (u = s == null ? void 0 : s.formatNumber) == null ? void 0 : u.decimalPlaces) == null ? void 0 : g.toString()) || "0",
|
|
4238
|
-
onValueChange: (d) => {
|
|
4239
|
-
var x, v, f;
|
|
4240
|
-
return t(
|
|
4241
|
-
Number(d),
|
|
4242
|
-
((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.currency) || "",
|
|
4243
|
-
((v = s == null ? void 0 : s.formatNumber) == null ? void 0 : v.locale) || "",
|
|
4244
|
-
((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.suffix) || ""
|
|
4245
|
-
);
|
|
4246
|
-
},
|
|
4247
|
-
children: [
|
|
4248
|
-
/* @__PURE__ */ e.jsx(ze, { className: "col-span-3 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(Fe, {}) }),
|
|
4249
|
-
/* @__PURE__ */ e.jsx(Le, { children: ["0", "1", "2", "3", "4"].map((d) => /* @__PURE__ */ e.jsx(te, { value: d, children: d }, d)) })
|
|
4250
|
-
]
|
|
4251
|
-
}
|
|
4252
|
-
)
|
|
4253
|
-
] }),
|
|
4254
|
-
/* @__PURE__ */ e.jsxs("div", { className: "w-full space-y-1", children: [
|
|
4255
|
-
/* @__PURE__ */ e.jsx($, { children: "Suffix" }),
|
|
4256
|
-
/* @__PURE__ */ e.jsx(
|
|
4257
|
-
de,
|
|
4258
|
-
{
|
|
4259
|
-
value: ((j = s == null ? void 0 : s.formatNumber) == null ? void 0 : j.suffix) || "",
|
|
4260
|
-
className: "h-8 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",
|
|
4261
|
-
placeholder: "K, M, B, %",
|
|
4262
|
-
onChange: (d) => {
|
|
4263
|
-
var x, v, f;
|
|
4264
|
-
return t(
|
|
4265
|
-
((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.decimalPlaces) || 0,
|
|
4266
|
-
((v = s == null ? void 0 : s.formatNumber) == null ? void 0 : v.currency) || "",
|
|
4267
|
-
((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.locale) || "",
|
|
4268
|
-
d.target.value
|
|
4269
|
-
);
|
|
4270
|
-
}
|
|
4271
|
-
}
|
|
4272
|
-
)
|
|
4273
|
-
] })
|
|
4274
|
-
] })
|
|
4275
|
-
] }) }),
|
|
4276
|
-
/* @__PURE__ */ e.jsx(Re, { className: "my-3" }),
|
|
4277
|
-
/* @__PURE__ */ e.jsx(
|
|
4278
|
-
Ga,
|
|
4279
|
-
{
|
|
4280
|
-
colorRanges: h,
|
|
4281
|
-
setColorRanges: r
|
|
4282
|
-
}
|
|
4283
|
-
)
|
|
4284
|
-
] })
|
|
4285
|
-
] });
|
|
4286
|
-
}
|
|
4287
|
-
function xr() {
|
|
4288
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 px-6 py-2", children: [
|
|
4289
|
-
/* @__PURE__ */ e.jsx(Ne, { type: "single", collapsible: !0, children: /* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
|
|
4290
|
-
/* @__PURE__ */ e.jsx(G, { className: "", children: "KPI Query" }),
|
|
4291
|
-
/* @__PURE__ */ e.jsxs(U, { className: "font-mono", children: [
|
|
4292
|
-
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 font-mono text-xs", children: "SELECT current, previous FROM table" }),
|
|
4293
|
-
/* @__PURE__ */ e.jsxs("ul", { className: "my-6 ml-6 list-disc text-xs [&>li]:mt-2", children: [
|
|
4294
|
-
/* @__PURE__ */ e.jsx("li", { children: "current - number" }),
|
|
4295
|
-
/* @__PURE__ */ e.jsx("li", { children: "previous - number" })
|
|
4296
|
-
] }),
|
|
4297
|
-
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
4298
|
-
"See ",
|
|
4299
|
-
/* @__PURE__ */ e.jsx(
|
|
4300
|
-
"a",
|
|
4301
|
-
{
|
|
4302
|
-
target: "_blank",
|
|
4303
|
-
onClick: (s) => s.stopPropagation(),
|
|
4304
|
-
className: "text-blue-700",
|
|
4305
|
-
href: "https://docs.semaphor.cloud/concepts/visuals#kpi",
|
|
4306
|
-
children: "example"
|
|
4307
|
-
}
|
|
4308
|
-
),
|
|
4309
|
-
" in the docs."
|
|
4310
|
-
] })
|
|
4311
|
-
] })
|
|
4312
|
-
] }) }),
|
|
4313
|
-
/* @__PURE__ */ e.jsx("section", { className: "", children: /* @__PURE__ */ e.jsx(mr, {}) }),
|
|
4314
|
-
/* @__PURE__ */ e.jsx("div", {}),
|
|
4315
|
-
/* @__PURE__ */ e.jsx("div", {})
|
|
4316
|
-
] });
|
|
4317
|
-
}
|
|
4318
|
-
function pr() {
|
|
4319
|
-
var a;
|
|
4320
|
-
const s = o((i) => i.card.preferences), { setCardPreferences: n } = o((i) => i.actions);
|
|
4321
|
-
function t(i) {
|
|
4322
|
-
n({
|
|
4323
|
-
...s,
|
|
4324
|
-
textVisualOptions: {
|
|
4325
|
-
...s == null ? void 0 : s.textVisualOptions,
|
|
4326
|
-
isDynamicText: i === "dynamic"
|
|
4327
|
-
}
|
|
4328
|
-
});
|
|
4329
|
-
}
|
|
4330
|
-
return /* @__PURE__ */ e.jsxs(
|
|
4331
|
-
As,
|
|
4332
|
-
{
|
|
4333
|
-
value: (a = s == null ? void 0 : s.textVisualOptions) != null && a.isDynamicText ? "dynamic" : "static",
|
|
4334
|
-
onValueChange: t,
|
|
4335
|
-
className: "flex gap-3",
|
|
4336
|
-
defaultValue: "x",
|
|
4337
|
-
children: [
|
|
4338
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
4339
|
-
/* @__PURE__ */ e.jsx(Oe, { value: "static", id: "r1" }),
|
|
4340
|
-
/* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r1", children: "Static" })
|
|
4341
|
-
] }),
|
|
4342
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
4343
|
-
/* @__PURE__ */ e.jsx(Oe, { value: "dynamic", id: "r2" }),
|
|
4344
|
-
/* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r2", children: "Dynamic" })
|
|
4345
|
-
] })
|
|
4346
|
-
]
|
|
4347
|
-
}
|
|
4348
|
-
);
|
|
4349
|
-
}
|
|
4350
|
-
function We({
|
|
4351
|
-
cardType: s,
|
|
4352
|
-
docContent: n,
|
|
4353
|
-
suffix: t = "Chart"
|
|
4354
|
-
}) {
|
|
4355
|
-
return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Ne, { defaultValue: ["item-2"], type: "multiple", children: [
|
|
4356
|
-
/* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
|
|
4357
|
-
/* @__PURE__ */ e.jsx(G, { children: `${Is(s)} ${t}` }),
|
|
4358
|
-
/* @__PURE__ */ e.jsx(U, { children: n || /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
|
|
4359
|
-
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT label, measure FROM table" }),
|
|
4360
|
-
/* @__PURE__ */ e.jsxs("ul", { className: "ml-6 list-disc text-xs [&>li]:mt-2", children: [
|
|
4361
|
-
/* @__PURE__ */ e.jsx("li", { children: "label - category" }),
|
|
4362
|
-
/* @__PURE__ */ e.jsx("li", { children: "measure - number" })
|
|
4363
|
-
] }),
|
|
4364
|
-
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
4365
|
-
"See ",
|
|
4366
|
-
/* @__PURE__ */ e.jsx(
|
|
4367
|
-
"a",
|
|
4368
|
-
{
|
|
4369
|
-
target: "_blank",
|
|
4370
|
-
onClick: (a) => a.stopPropagation(),
|
|
4371
|
-
className: "text-blue-700",
|
|
4372
|
-
href: "https://docs.semaphor.cloud/concepts/visuals#pie-chart",
|
|
4373
|
-
children: "example"
|
|
4374
|
-
}
|
|
4375
|
-
),
|
|
4376
|
-
" in the docs."
|
|
4377
|
-
] })
|
|
4378
|
-
] }) })
|
|
4379
|
-
] }),
|
|
4380
|
-
/* @__PURE__ */ e.jsxs(B, { value: "item-2", children: [
|
|
4381
|
-
/* @__PURE__ */ e.jsx(G, { children: "Settings" }),
|
|
4382
|
-
/* @__PURE__ */ e.jsxs(U, { className: "space-y-4 px-2", children: [
|
|
4383
|
-
s === "range" && /* @__PURE__ */ e.jsx(ls, {}),
|
|
4384
|
-
s !== "text" && /* @__PURE__ */ e.jsx(_s, {}),
|
|
4385
|
-
s === "text" && /* @__PURE__ */ e.jsx(pr, {})
|
|
4386
|
-
] })
|
|
4387
|
-
] }),
|
|
4388
|
-
!["range", "text"].includes(s) && /* @__PURE__ */ e.jsxs(B, { value: "item-3", children: [
|
|
4389
|
-
/* @__PURE__ */ e.jsx(G, { children: "Filters" }),
|
|
4390
|
-
/* @__PURE__ */ e.jsxs(U, { className: "space-y-4 px-2", children: [
|
|
4391
|
-
/* @__PURE__ */ e.jsx(Te, {}),
|
|
4392
|
-
/* @__PURE__ */ e.jsx(Ae, {})
|
|
4393
|
-
] })
|
|
4394
|
-
] })
|
|
4395
|
-
] }) });
|
|
4396
|
-
}
|
|
4397
|
-
function fr() {
|
|
4398
|
-
return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Ne, { defaultValue: ["item-2"], type: "multiple", children: [
|
|
4399
|
-
/* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
|
|
4400
|
-
/* @__PURE__ */ e.jsx(G, { children: "Stacked Chart" }),
|
|
4401
|
-
/* @__PURE__ */ e.jsxs(U, { className: "space-y-4 font-mono text-xs", children: [
|
|
4402
|
-
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT x-axis, stack-by, y-axis FROM table" }),
|
|
4403
|
-
/* @__PURE__ */ e.jsxs("ul", { className: "ml-6 list-disc text-xs [&>li]:mt-2", children: [
|
|
4404
|
-
/* @__PURE__ */ e.jsx("li", { children: "x-axis - category" }),
|
|
4405
|
-
/* @__PURE__ */ e.jsx("li", { children: "stack by - category" }),
|
|
4406
|
-
/* @__PURE__ */ e.jsx("li", { children: "y-axis - number" })
|
|
4407
|
-
] }),
|
|
4408
|
-
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
4409
|
-
"See ",
|
|
4410
|
-
/* @__PURE__ */ e.jsx(
|
|
4411
|
-
"a",
|
|
4412
|
-
{
|
|
4413
|
-
target: "_blank",
|
|
4414
|
-
onClick: (s) => s.stopPropagation(),
|
|
4415
|
-
className: "text-blue-700",
|
|
4416
|
-
href: "https://docs.semaphor.cloud/concepts/visuals#stacked-chart",
|
|
4417
|
-
children: "example"
|
|
4418
|
-
}
|
|
4419
|
-
),
|
|
4420
|
-
" in the docs."
|
|
4421
|
-
] })
|
|
4422
|
-
] })
|
|
4423
|
-
] }),
|
|
4424
|
-
/* @__PURE__ */ e.jsxs(B, { value: "item-2", children: [
|
|
4425
|
-
/* @__PURE__ */ e.jsx(G, { children: "Settings" }),
|
|
4426
|
-
/* @__PURE__ */ e.jsxs(U, { className: "space-y-4 px-2", children: [
|
|
4427
|
-
/* @__PURE__ */ e.jsx(ls, {}),
|
|
4428
|
-
/* @__PURE__ */ e.jsx(Et, {})
|
|
4429
|
-
] })
|
|
4430
|
-
] }),
|
|
4431
|
-
/* @__PURE__ */ e.jsxs(B, { value: "item-3", children: [
|
|
4432
|
-
/* @__PURE__ */ e.jsx(G, { children: "Filters" }),
|
|
4433
|
-
/* @__PURE__ */ e.jsxs(U, { className: "space-y-4 px-2", children: [
|
|
4434
|
-
/* @__PURE__ */ e.jsx(Te, {}),
|
|
4435
|
-
/* @__PURE__ */ e.jsx(Ae, {})
|
|
4436
|
-
] })
|
|
4437
|
-
] })
|
|
4438
|
-
] }) });
|
|
4439
|
-
}
|
|
4440
|
-
function gr({}) {
|
|
4441
|
-
const s = o((a) => {
|
|
4442
|
-
var i;
|
|
4443
|
-
return (i = a.card) == null ? void 0 : i.preferences;
|
|
4444
|
-
}), n = o(
|
|
4445
|
-
(a) => a.actions.setCardPreferences
|
|
4446
|
-
), t = (a) => {
|
|
4447
|
-
n({
|
|
4448
|
-
...s,
|
|
4449
|
-
allowDownload: a
|
|
4450
|
-
});
|
|
4451
|
-
};
|
|
4452
|
-
return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 px-6 py-2", children: [
|
|
4453
|
-
/* @__PURE__ */ e.jsx(Ne, { defaultValue: ["item-3"], type: "multiple", children: /* @__PURE__ */ e.jsxs(B, { value: "item-3", children: [
|
|
4454
|
-
/* @__PURE__ */ e.jsx(G, { children: "Filters" }),
|
|
4455
|
-
/* @__PURE__ */ e.jsxs(U, { className: "space-y-4 px-2", children: [
|
|
4456
|
-
/* @__PURE__ */ e.jsx(Te, {}),
|
|
4457
|
-
/* @__PURE__ */ e.jsx(Ae, {})
|
|
4458
|
-
] })
|
|
4459
|
-
] }) }),
|
|
4460
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
4461
|
-
/* @__PURE__ */ e.jsx(ts, { onCheckedChange: t, id: "allow-download" }),
|
|
4462
|
-
/* @__PURE__ */ e.jsx(
|
|
4463
|
-
"label",
|
|
4464
|
-
{
|
|
4465
|
-
htmlFor: "allow-download",
|
|
4466
|
-
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
4467
|
-
children: "Allow Download"
|
|
4468
|
-
}
|
|
4469
|
-
)
|
|
4470
|
-
] })
|
|
4471
|
-
] });
|
|
4472
|
-
}
|
|
4473
|
-
const jr = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
|
|
4474
|
-
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT dimension, cohort, metric FROM table" }),
|
|
4475
|
-
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
4476
|
-
"See ",
|
|
4477
|
-
/* @__PURE__ */ e.jsx(
|
|
4478
|
-
"a",
|
|
4479
|
-
{
|
|
4480
|
-
target: "_blank",
|
|
4481
|
-
onClick: (s) => s.stopPropagation(),
|
|
4482
|
-
className: "text-blue-700",
|
|
4483
|
-
href: "https://docs.semaphor.cloud/concepts/visuals#pyramid-chart",
|
|
4484
|
-
children: "example"
|
|
4485
|
-
}
|
|
4486
|
-
),
|
|
4487
|
-
" in the docs."
|
|
4488
|
-
] })
|
|
4489
|
-
] }), br = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
|
|
4490
|
-
/* @__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" }),
|
|
4491
|
-
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
4492
|
-
"See ",
|
|
4493
|
-
/* @__PURE__ */ e.jsx(
|
|
4494
|
-
"a",
|
|
4495
|
-
{
|
|
4496
|
-
target: "_blank",
|
|
4497
|
-
onClick: (s) => s.stopPropagation(),
|
|
4498
|
-
className: "text-blue-700",
|
|
4499
|
-
href: "https://docs.semaphor.cloud/concepts/visuals#range-charts",
|
|
4500
|
-
children: "example"
|
|
4501
|
-
}
|
|
4502
|
-
),
|
|
4503
|
-
" in the docs."
|
|
4504
|
-
] })
|
|
4505
|
-
] }), yr = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
|
|
4506
|
-
/* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT text FROM table limit 1" }),
|
|
4507
|
-
/* @__PURE__ */ e.jsxs("div", { children: [
|
|
4508
|
-
"See ",
|
|
4509
|
-
/* @__PURE__ */ e.jsx(
|
|
4510
|
-
"a",
|
|
4511
|
-
{
|
|
4512
|
-
target: "_blank",
|
|
4513
|
-
onClick: (s) => s.stopPropagation(),
|
|
4514
|
-
className: "text-blue-700",
|
|
4515
|
-
href: "https://docs.semaphor.cloud/concepts/visuals#text-visual",
|
|
4516
|
-
children: "example"
|
|
4517
|
-
}
|
|
4518
|
-
),
|
|
4519
|
-
" in the docs."
|
|
4520
|
-
] })
|
|
4521
|
-
] });
|
|
4522
|
-
function vr() {
|
|
4523
|
-
const s = o((t) => t.card.type);
|
|
4524
|
-
function n(t) {
|
|
4525
|
-
switch (t) {
|
|
4526
|
-
case "stackedBar":
|
|
4527
|
-
case "stackedLine":
|
|
4528
|
-
return /* @__PURE__ */ e.jsx(fr, {});
|
|
4529
|
-
case "pyramid":
|
|
4530
|
-
return /* @__PURE__ */ e.jsx(We, { docContent: jr, cardType: t });
|
|
4531
|
-
case "kpi":
|
|
4532
|
-
return /* @__PURE__ */ e.jsx(xr, {});
|
|
4533
|
-
case "line":
|
|
4534
|
-
case "bar":
|
|
4535
|
-
return /* @__PURE__ */ e.jsx(lr, { cardType: t });
|
|
4536
|
-
case "range":
|
|
4537
|
-
return /* @__PURE__ */ e.jsx(We, { docContent: br, cardType: t });
|
|
4538
|
-
case "pie":
|
|
4539
|
-
case "doughnut":
|
|
4540
|
-
case "polarArea":
|
|
4541
|
-
case "radar":
|
|
4542
|
-
return /* @__PURE__ */ e.jsx(We, { cardType: t });
|
|
4543
|
-
case "bubble":
|
|
4544
|
-
case "scatter":
|
|
4545
|
-
return /* @__PURE__ */ e.jsx(or, { cardType: t });
|
|
4546
|
-
case "table":
|
|
4547
|
-
return /* @__PURE__ */ e.jsx(gr, { cardType: t });
|
|
4548
|
-
case "text":
|
|
4549
|
-
return /* @__PURE__ */ e.jsx(
|
|
4550
|
-
We,
|
|
4551
|
-
{
|
|
4552
|
-
docContent: yr,
|
|
4553
|
-
cardType: t,
|
|
4554
|
-
suffix: "Visual"
|
|
4555
|
-
}
|
|
4556
|
-
);
|
|
4557
|
-
default:
|
|
4558
|
-
return /* @__PURE__ */ e.jsx(hr, {});
|
|
4559
|
-
}
|
|
4560
|
-
}
|
|
4561
|
-
return /* @__PURE__ */ e.jsx(Ts, { className: "h-full w-full text-sm", children: n(s) });
|
|
4562
|
-
}
|
|
4563
|
-
function Nr() {
|
|
4564
|
-
const s = o((n) => n.isShowingVisual);
|
|
4565
|
-
return /* @__PURE__ */ e.jsxs(
|
|
4566
|
-
ps,
|
|
4567
|
-
{
|
|
4568
|
-
direction: "vertical",
|
|
4569
|
-
className: "min-h-[250px] min-w-full max-w-lg",
|
|
4570
|
-
children: [
|
|
4571
|
-
/* @__PURE__ */ e.jsx(
|
|
4572
|
-
we,
|
|
4573
|
-
{
|
|
4574
|
-
role: "query-section",
|
|
4575
|
-
className: "flex",
|
|
4576
|
-
minSize: 20,
|
|
4577
|
-
defaultSize: 40,
|
|
4578
|
-
children: /* @__PURE__ */ e.jsx(Yn, {})
|
|
4579
|
-
}
|
|
4580
|
-
),
|
|
4581
|
-
/* @__PURE__ */ e.jsx(fs, { withHandle: !0, className: "border" }),
|
|
4582
|
-
/* @__PURE__ */ e.jsx(
|
|
4583
|
-
we,
|
|
4584
|
-
{
|
|
4585
|
-
className: "pb-1",
|
|
4586
|
-
role: "visual-section",
|
|
4587
|
-
minSize: 0,
|
|
4588
|
-
defaultSize: 60,
|
|
4589
|
-
children: s ? /* @__PURE__ */ e.jsxs(ps, { direction: "horizontal", children: [
|
|
4590
|
-
/* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
|
|
4591
|
-
we,
|
|
4592
|
-
{
|
|
4593
|
-
className: "flex min-w-[275px]",
|
|
4594
|
-
minSize: 20,
|
|
4595
|
-
defaultSize: 25,
|
|
4596
|
-
maxSize: 30,
|
|
4597
|
-
children: /* @__PURE__ */ e.jsx(vr, {})
|
|
4598
|
-
}
|
|
4599
|
-
) }),
|
|
4600
|
-
/* @__PURE__ */ e.jsx(fs, { className: "border" }),
|
|
4601
|
-
/* @__PURE__ */ e.jsx(we, { minSize: 40, defaultSize: 75, maxSize: 100, children: /* @__PURE__ */ e.jsx(Xs, {}) })
|
|
4602
|
-
] }) : /* @__PURE__ */ e.jsx(Xs, {})
|
|
4603
|
-
}
|
|
4604
|
-
)
|
|
4605
|
-
]
|
|
4606
|
-
}
|
|
4607
|
-
);
|
|
4608
|
-
}
|
|
4609
|
-
function Cr({ authToken: s, onSave: n, onClose: t }) {
|
|
4610
|
-
const a = o((r) => r.actions.setOnSave), i = o((r) => r.actions.setOnClose), h = w((r) => r.actions.setAuthToken);
|
|
4611
|
-
return Y(() => {
|
|
4612
|
-
n && a(n), t && i(t);
|
|
4613
|
-
}, [n, a, t, i]), Y(() => {
|
|
4614
|
-
s && s.accessToken && h(s);
|
|
4615
|
-
}, [s, h]), /* @__PURE__ */ e.jsxs(Ua, { className: "rounded-none", role: "editor-panel", children: [
|
|
4616
|
-
/* @__PURE__ */ e.jsx(Ka, { className: "rounded-none border-r-[1.5px]", children: /* @__PURE__ */ e.jsx(Ct, {}) }),
|
|
4617
|
-
/* @__PURE__ */ e.jsx(Wa, { children: /* @__PURE__ */ e.jsx(Nr, {}) })
|
|
4618
|
-
] });
|
|
4619
|
-
}
|
|
4620
|
-
function Sr() {
|
|
4621
|
-
w((r) => r.selectedCardId);
|
|
4622
|
-
const s = w((r) => r.selectedSheetId), { setIsVisualEditing: n } = w((r) => r.actions), t = w((r) => r.isVisualEditing), a = w((r) => r.actions.updateFrame);
|
|
4623
|
-
function i(r) {
|
|
4624
|
-
s && (a(s, r), n(!1));
|
|
4625
|
-
}
|
|
4626
|
-
function h() {
|
|
4627
|
-
n(!1);
|
|
4628
|
-
}
|
|
4629
|
-
return /* @__PURE__ */ e.jsx(
|
|
4630
|
-
"div",
|
|
4631
|
-
{
|
|
4632
|
-
role: "editor-container",
|
|
4633
|
-
className: Z("flex grow", {
|
|
4634
|
-
block: t,
|
|
4635
|
-
hidden: !t
|
|
4636
|
-
}),
|
|
4637
|
-
children: /* @__PURE__ */ e.jsx(Cr, { onSave: i, onClose: h })
|
|
4638
|
-
}
|
|
4639
|
-
);
|
|
4640
|
-
}
|
|
4641
|
-
function wr() {
|
|
4642
|
-
o((r) => r.selectedConnectionId), o((r) => r.selectedDatamodelId);
|
|
4643
|
-
const s = o((r) => r.selectedDatabaseName);
|
|
4644
|
-
o((r) => r.selectedSchemaName);
|
|
4645
|
-
const n = o((r) => r.selectedTableName), t = w((r) => r.dashboard.filters) || [];
|
|
4646
|
-
w((r) => r.actions.addFilter), w((r) => r.actions.removeFilter), w(
|
|
4647
|
-
(r) => r.actions.removeFilterValue
|
|
4648
|
-
);
|
|
4649
|
-
const { modelItems: a, columns: i } = De(), { assignFilter: h } = qt();
|
|
4650
|
-
return /* @__PURE__ */ e.jsx("div", { className: "xbg-red-100 flex-1 basis-0 flex-col overflow-scroll px-3", children: i == null ? void 0 : i.map((r) => {
|
|
4651
|
-
const l = t == null ? void 0 : t.find(
|
|
4652
|
-
(c) => c.column === ue(r.column_name) && c.table === n && c.database === s
|
|
4653
|
-
);
|
|
4654
|
-
return /* @__PURE__ */ e.jsx(
|
|
4655
|
-
"div",
|
|
4656
|
-
{
|
|
4657
|
-
onClick: () => h(r),
|
|
4658
|
-
className: Z(
|
|
4659
|
-
"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",
|
|
4660
|
-
{
|
|
4661
|
-
"bg-muted": l
|
|
4662
|
-
}
|
|
4663
|
-
),
|
|
4664
|
-
children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
4665
|
-
/* @__PURE__ */ e.jsx(Nt, { column: r }),
|
|
4666
|
-
/* @__PURE__ */ e.jsx("span", { children: r.column_name })
|
|
4667
|
-
] })
|
|
4668
|
-
},
|
|
4669
|
-
r.column_name
|
|
4670
|
-
);
|
|
4671
|
-
}) });
|
|
4672
|
-
}
|
|
4673
|
-
function kr() {
|
|
4674
|
-
w((n) => n.showFilters);
|
|
4675
|
-
const s = w(
|
|
4676
|
-
(n) => n.actions.setShowFilters
|
|
4677
|
-
);
|
|
4678
|
-
return /* @__PURE__ */ e.jsxs("section", { className: "relative flex grow flex-col border-l px-4", children: [
|
|
4679
|
-
/* @__PURE__ */ e.jsxs("div", { className: "mt-4 flex items-center justify-between gap-2 px-3", children: [
|
|
4680
|
-
/* @__PURE__ */ e.jsx($, { className: "text-lg", children: "Filters" }),
|
|
4681
|
-
/* @__PURE__ */ e.jsx(
|
|
4682
|
-
z,
|
|
4683
|
-
{
|
|
4684
|
-
onClick: () => s(!1),
|
|
4685
|
-
className: "h-7 w-7 p-0",
|
|
4686
|
-
variant: "ghost",
|
|
4687
|
-
children: /* @__PURE__ */ e.jsx(Ve, {})
|
|
4688
|
-
}
|
|
4689
|
-
)
|
|
4690
|
-
] }),
|
|
4691
|
-
/* @__PURE__ */ e.jsx("div", { className: "flex grow", children: /* @__PURE__ */ e.jsx(
|
|
4692
|
-
Ct,
|
|
4693
|
-
{
|
|
4694
|
-
ColumnsComponent: () => (
|
|
4695
|
-
// schemaName, tableName, columns
|
|
4696
|
-
/* @__PURE__ */ e.jsx(
|
|
4697
|
-
wr,
|
|
4698
|
-
{}
|
|
4699
|
-
)
|
|
4700
|
-
)
|
|
4701
|
-
}
|
|
4702
|
-
) })
|
|
4703
|
-
] });
|
|
4704
|
-
}
|
|
4705
|
-
function zr() {
|
|
4706
|
-
const s = w((t) => t.showFilters), n = w((t) => t.isVisualEditing);
|
|
4707
|
-
return /* @__PURE__ */ e.jsxs(
|
|
4708
|
-
"div",
|
|
4709
|
-
{
|
|
4710
|
-
role: "dashboard-plus-main",
|
|
4711
|
-
className: Z("grow", {
|
|
4712
|
-
hidden: n,
|
|
4713
|
-
flex: !n
|
|
4714
|
-
}),
|
|
4715
|
-
children: [
|
|
4716
|
-
/* @__PURE__ */ e.jsx(Qa, {}),
|
|
4717
|
-
s && /* @__PURE__ */ e.jsx("div", { role: "filter-aside-container", className: "flex", children: /* @__PURE__ */ e.jsx(kr, {}) })
|
|
4718
|
-
]
|
|
4719
|
-
}
|
|
4720
|
-
);
|
|
4721
|
-
}
|
|
4722
|
-
function Fr() {
|
|
4723
|
-
const s = w((a) => a.dashboard), n = w((a) => a.actions.setDashboard), t = w(
|
|
4724
|
-
(a) => a.showDashboardJSON
|
|
4725
|
-
);
|
|
4726
|
-
return w(
|
|
4727
|
-
(a) => a.actions.setShowDashboardJSON
|
|
4728
|
-
), /* @__PURE__ */ e.jsx(
|
|
4729
|
-
"div",
|
|
4730
|
-
{
|
|
4731
|
-
className: Z(" p-2", {
|
|
4732
|
-
hidden: !t
|
|
4733
|
-
}),
|
|
4734
|
-
children: /* @__PURE__ */ e.jsx(
|
|
4735
|
-
Ja,
|
|
4736
|
-
{
|
|
4737
|
-
onChange: (a) => {
|
|
4738
|
-
if (a)
|
|
4739
|
-
try {
|
|
4740
|
-
JSON.parse(a), n(JSON.parse(a));
|
|
4741
|
-
} catch {
|
|
4742
|
-
}
|
|
4743
|
-
},
|
|
4744
|
-
defaultLanguage: "json",
|
|
4745
|
-
className: "h-[550px] overflow-y-auto ",
|
|
4746
|
-
value: JSON.stringify(s, null, 2),
|
|
4747
|
-
options: {
|
|
4748
|
-
minimap: {
|
|
4749
|
-
enabled: !1
|
|
4750
|
-
},
|
|
4751
|
-
// lineNumbers: 'off',
|
|
4752
|
-
glyphMargin: !1,
|
|
4753
|
-
wordWrap: "on",
|
|
4754
|
-
scrollbar: {
|
|
4755
|
-
verticalScrollbarSize: 0,
|
|
4756
|
-
horizontalScrollbarSize: 0
|
|
4757
|
-
},
|
|
4758
|
-
fontSize: 12,
|
|
4759
|
-
renderLineHighlight: "none"
|
|
4760
|
-
}
|
|
4761
|
-
}
|
|
4762
|
-
)
|
|
4763
|
-
}
|
|
4764
|
-
);
|
|
4765
|
-
}
|
|
4766
|
-
function Or({
|
|
4767
|
-
showControls: s = !1,
|
|
4768
|
-
showFooter: n = !0,
|
|
4769
|
-
...t
|
|
4770
|
-
}) {
|
|
4771
|
-
return /* @__PURE__ */ e.jsxs(Ya, { dashboardProps: t, children: [
|
|
4772
|
-
/* @__PURE__ */ e.jsx(Za, {}),
|
|
4773
|
-
/* @__PURE__ */ e.jsxs(Xa, { children: [
|
|
4774
|
-
/* @__PURE__ */ e.jsx(Fr, {}),
|
|
4775
|
-
/* @__PURE__ */ e.jsxs(en, { ...t, children: [
|
|
4776
|
-
s && /* @__PURE__ */ e.jsx(Tn, {}),
|
|
4777
|
-
/* @__PURE__ */ e.jsx(Sr, {}),
|
|
4778
|
-
/* @__PURE__ */ e.jsx(zr, {})
|
|
4779
|
-
] })
|
|
4780
|
-
] })
|
|
4781
|
-
] });
|
|
4782
|
-
}
|
|
4783
|
-
export {
|
|
4784
|
-
Or as D,
|
|
4785
|
-
$e as L,
|
|
4786
|
-
Ee as S,
|
|
4787
|
-
zn as c,
|
|
4788
|
-
vt as g,
|
|
4789
|
-
De as u
|
|
4790
|
-
};
|