react-semaphor 0.1.59 → 0.1.61
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/axis-mapping-8ZVwlkl6.js +315 -0
- package/dist/chunks/axis-mapping-Cwa3KrDR.js +16 -0
- package/dist/chunks/bar-chart-settings-B_WyC-7g.js +52 -0
- package/dist/chunks/bar-chart-settings-CvorW7RD.js +1 -0
- package/dist/chunks/bubble-chart-settings-BPtESqYK.js +1 -0
- package/dist/chunks/bubble-chart-settings-CxFAlErV.js +50 -0
- package/dist/chunks/common-chart-settings-CvRrQf-H.js +1 -0
- package/dist/chunks/common-chart-settings-D3ww0Xtx.js +147 -0
- package/dist/chunks/custom-visual-settings-DXWyN2Dr.js +11 -0
- package/dist/chunks/custom-visual-settings-m5o8R5tL.js +243 -0
- package/dist/chunks/dashboard-plus-B8-ocT_Z.js +41 -0
- package/dist/chunks/dashboard-plus-DSUKhvcv.js +2941 -0
- package/dist/chunks/display-labels-BYsRReye.js +1 -0
- package/dist/chunks/display-labels-C_jsL0Jo.js +74 -0
- package/dist/chunks/editor-C7xQi9Ab.js +105 -0
- package/dist/chunks/editor-DqvyBUrl.js +8321 -0
- package/dist/chunks/filter-on-click-columns-6dRYhvgz.js +1 -0
- package/dist/chunks/filter-on-click-columns-BJUGTE6W.js +120 -0
- package/dist/chunks/frame-filters-D9sDN4Vm.js +1 -0
- package/dist/chunks/frame-filters-DFgqSoV2.js +75 -0
- package/dist/chunks/{index-D4y2uVa5.js → index--MUeDITx.js} +28329 -25746
- package/dist/chunks/index-Bvtpj-_R.js +1080 -0
- package/dist/chunks/kpi-settings-BONvmfNr.js +1 -0
- package/dist/chunks/kpi-settings-CI-9fp4Z.js +286 -0
- package/dist/chunks/map-chart-settings-CSxZdu_g.js +1 -0
- package/dist/chunks/map-chart-settings-DQIN7Pn8.js +334 -0
- package/dist/chunks/pie-chart-settings-CN3JCLdP.js +86 -0
- package/dist/chunks/pie-chart-settings-CsErfZOL.js +1 -0
- package/dist/chunks/reusable-select-CQbD03nT.js +40 -0
- package/dist/chunks/reusable-select-CVRzPWkg.js +1 -0
- package/dist/chunks/stacked-chart-settings-BfqHFFqA.js +1 -0
- package/dist/chunks/stacked-chart-settings-poYotO6Q.js +90 -0
- package/dist/chunks/table-visual-settings-B46pdUra.js +46 -0
- package/dist/chunks/table-visual-settings-ZKWuNokZ.js +1 -0
- package/dist/chunks/tag-BrxBSbSe.js +20 -0
- package/dist/chunks/tag-D9G2kz2B.js +6 -0
- package/dist/chunks/use-assign-filter-5gplfsO1.js +83 -0
- package/dist/chunks/use-assign-filter-DzmBSsyO.js +1 -0
- package/dist/chunks/use-local-storage-state-CBh2HHB9.js +16 -0
- package/dist/chunks/use-local-storage-state-CL0JsTZM.js +1745 -0
- package/dist/chunks/use-plugin-query-DA6Yrp7P.js +12 -0
- package/dist/chunks/use-plugin-query-JdHNPYZS.js +1 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +103 -103
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/dashboard-plus-B-lXkbRY.js +0 -225
- package/dist/chunks/dashboard-plus-CHqCwJFO.js +0 -17362
- package/dist/chunks/index-CLxl35mK.js +0 -1045
|
@@ -0,0 +1,1745 @@
|
|
|
1
|
+
import { useRef as De, useEffect as ae, useState as G, useCallback as A } from "react";
|
|
2
|
+
import { jsxs as C, jsx as i, Fragment as W } from "react/jsx-runtime";
|
|
3
|
+
import { E as ne, Q as fe, aV as X, aW as re, aX as qe, d as P, G as Y, e as Q, aY as Me, M as ge, aZ as V, a_ as Ve, u as y, aK as oe, B as H, q as J, ah as ye, a$ as le, b0 as be, a0 as Ce, R as Le, b1 as Ue, b2 as Ne, b3 as Oe, b4 as $e, b5 as _e, b6 as Ge, b7 as Re, b8 as je, b9 as ve, f as Se, at as ce, aC as de, ax as xe, aw as Fe, H as te, as as Qe, au as ze, ba as Pe, bb as Ke, bc as We, bd as He, be as Je, bf as Xe, bg as Ye, bh as Ze, aO as et, aP as tt, aQ as at, aR as st, bi as nt, bj as rt, bk as we, bl as ot, bm as lt, bn as it, bo as ct, bp as dt, bq as ut, br as mt, bs as pt, bt as ht, bu as ft, bv as gt, bw as ue, bx as yt, by as bt, bz as Ct, a4 as Nt, a5 as vt, a6 as Z, bA as St, bB as xt, bC as Ft, bD as wt, A as Tt, a as It, b as kt, c as Et, bE as At, bF as me } from "./index--MUeDITx.js";
|
|
4
|
+
import { u as Bt } from "./use-assign-filter-5gplfsO1.js";
|
|
5
|
+
import "react-dom";
|
|
6
|
+
import { T as Dt } from "./tag-BrxBSbSe.js";
|
|
7
|
+
/**
|
|
8
|
+
* @license lucide-react v0.453.0 - ISC
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the ISC license.
|
|
11
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
const qt = ne("Eraser", [
|
|
14
|
+
[
|
|
15
|
+
"path",
|
|
16
|
+
{
|
|
17
|
+
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",
|
|
18
|
+
key: "182aya"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
["path", { d: "M22 21H7", key: "t4ddhn" }],
|
|
22
|
+
["path", { d: "m5 11 9 9", key: "1mo9qw" }]
|
|
23
|
+
]);
|
|
24
|
+
/**
|
|
25
|
+
* @license lucide-react v0.453.0 - ISC
|
|
26
|
+
*
|
|
27
|
+
* This source code is licensed under the ISC license.
|
|
28
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
29
|
+
*/
|
|
30
|
+
const Te = ne("Save", [
|
|
31
|
+
[
|
|
32
|
+
"path",
|
|
33
|
+
{
|
|
34
|
+
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",
|
|
35
|
+
key: "1c8476"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
|
|
39
|
+
["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
|
|
40
|
+
]);
|
|
41
|
+
/**
|
|
42
|
+
* @license lucide-react v0.453.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/
|
|
47
|
+
const Mt = ne("Terminal", [
|
|
48
|
+
["polyline", { points: "4 17 10 11 4 5", key: "akl6gq" }],
|
|
49
|
+
["line", { x1: "12", x2: "20", y1: "19", y2: "19", key: "q2wloq" }]
|
|
50
|
+
]);
|
|
51
|
+
function ea(e, s = {}) {
|
|
52
|
+
const { enabled: t = !0, eventType: a = "mousedown" } = s, o = De(null);
|
|
53
|
+
return ae(() => {
|
|
54
|
+
const c = (d) => {
|
|
55
|
+
const u = d.target;
|
|
56
|
+
o.current && o.current.contains(u) || u instanceof Element && (u.closest("[data-radix-popper-content-wrapper]") || u.closest("[data-radix-select-content]") || u.closest("[data-radix-popover-content]") || u.closest("[data-radix-dropdown-menu-content]") || u.closest("[data-radix-tooltip-content]") || u.closest('[role="listbox"]') || u.closest('[role="option"]') || u.closest('[role="combobox"]')) || u instanceof Element && u.hasAttribute("data-radix-") || e();
|
|
57
|
+
};
|
|
58
|
+
return t && document.addEventListener(a, c), () => {
|
|
59
|
+
document.removeEventListener(a, c);
|
|
60
|
+
};
|
|
61
|
+
}, [e, t, a]), o;
|
|
62
|
+
}
|
|
63
|
+
function Ie(e) {
|
|
64
|
+
const [s, t] = G(null), [a, o] = G(null);
|
|
65
|
+
return ae(() => {
|
|
66
|
+
if (!e || e.trim() === "") {
|
|
67
|
+
t(null), o(null);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
(async () => {
|
|
71
|
+
try {
|
|
72
|
+
if (!e.startsWith("http://") && !e.startsWith("https://"))
|
|
73
|
+
throw new Error(`Invalid URL format: ${e}`);
|
|
74
|
+
try {
|
|
75
|
+
new URL(e);
|
|
76
|
+
} catch {
|
|
77
|
+
throw new Error(`Invalid URL: ${e}`);
|
|
78
|
+
}
|
|
79
|
+
const u = `${e.endsWith("/") ? e : `${e}/`}index.js`;
|
|
80
|
+
try {
|
|
81
|
+
if (!(await fetch(u, { method: "HEAD" })).ok)
|
|
82
|
+
throw new Error(`Module not found at ${u}`);
|
|
83
|
+
} catch {
|
|
84
|
+
}
|
|
85
|
+
const m = await import(
|
|
86
|
+
/* @vite-ignore */
|
|
87
|
+
/* webpackIgnore: true */
|
|
88
|
+
u
|
|
89
|
+
);
|
|
90
|
+
if (typeof m.useChartStore != "function")
|
|
91
|
+
throw new Error("useChartStore is not a function");
|
|
92
|
+
t(() => m.useChartStore), o(null);
|
|
93
|
+
} catch (d) {
|
|
94
|
+
const u = d instanceof Error ? d.message : "Unknown error";
|
|
95
|
+
console.error("Failed to load remote chart store:", u), o(u), t(null);
|
|
96
|
+
}
|
|
97
|
+
})();
|
|
98
|
+
}, [e]), s;
|
|
99
|
+
}
|
|
100
|
+
function Vt(e) {
|
|
101
|
+
const s = e.toUpperCase().indexOf("WHERE"), t = e.toUpperCase().indexOf("GROUP BY"), a = e.toUpperCase().indexOf("LIMIT"), o = e.toUpperCase().indexOf("ORDER BY");
|
|
102
|
+
let c = e.length;
|
|
103
|
+
if (o !== -1 && (c = o), a !== -1 && a < c && (c = a), s !== -1) {
|
|
104
|
+
const d = e.substring(0, s), u = e.substring(s);
|
|
105
|
+
return `${d} {{ filters | where }} AND ${u.substring(
|
|
106
|
+
6
|
|
107
|
+
)}`;
|
|
108
|
+
} else if (t !== -1) {
|
|
109
|
+
const d = e.substring(0, t), u = e.substring(t);
|
|
110
|
+
return `${d} {{ filters | where }} ${u}`;
|
|
111
|
+
} else {
|
|
112
|
+
const d = e.substring(0, c), u = e.substring(c);
|
|
113
|
+
return console.log("beforeClause", d), console.log("afterClause", u), u ? `${d} {{ filters | where }} ${u}` : `${d.replace(/;$/, "")} {{ filters | where }}`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function Lt(e, s) {
|
|
117
|
+
if (e.length === 0)
|
|
118
|
+
return "";
|
|
119
|
+
if (s) {
|
|
120
|
+
const t = e.find((a) => a.id === s);
|
|
121
|
+
if (t) {
|
|
122
|
+
const a = t.tabTitle;
|
|
123
|
+
if (a == "All__Header")
|
|
124
|
+
return e[0].id;
|
|
125
|
+
if (a && a.endsWith("__Header")) {
|
|
126
|
+
const c = a.split("__")[0], d = e.find(
|
|
127
|
+
(u) => u.tabTitle === c
|
|
128
|
+
);
|
|
129
|
+
return d ? d.id : e[0].id;
|
|
130
|
+
}
|
|
131
|
+
return s;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return e[0].id;
|
|
135
|
+
}
|
|
136
|
+
async function pe(e, s, t, a) {
|
|
137
|
+
if (!s || !t)
|
|
138
|
+
throw new Error("Missing auth token or visual ID");
|
|
139
|
+
const o = ["resource-by-id", "visual", t], c = a.getQueryData(o);
|
|
140
|
+
if (c)
|
|
141
|
+
return console.log("Using cached visual data for:", t), { data: c, fromCache: !0 };
|
|
142
|
+
console.log("Fetching visual data from network for:", t);
|
|
143
|
+
const d = V.loading("Loading visual...", {
|
|
144
|
+
position: "top-center"
|
|
145
|
+
});
|
|
146
|
+
try {
|
|
147
|
+
const u = await fetch(
|
|
148
|
+
`${e}/management/v1/visuals/${t}`,
|
|
149
|
+
{
|
|
150
|
+
headers: {
|
|
151
|
+
Authorization: `Bearer ${s}`
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
if (!u.ok)
|
|
156
|
+
throw new Error("Failed to load visual");
|
|
157
|
+
const m = await u.json();
|
|
158
|
+
return a.setQueryData(o, m), V.dismiss(d), { data: m, fromCache: !1 };
|
|
159
|
+
} catch (u) {
|
|
160
|
+
throw V.dismiss(d), u;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function ke(e) {
|
|
164
|
+
if (typeof e == "string")
|
|
165
|
+
return JSON.parse(e);
|
|
166
|
+
if (typeof e == "object")
|
|
167
|
+
return e;
|
|
168
|
+
throw new Error("Invalid frame object format");
|
|
169
|
+
}
|
|
170
|
+
function Ut(e, s) {
|
|
171
|
+
var c, d;
|
|
172
|
+
const t = (e == null ? void 0 : e.frameObject) ?? ((c = e == null ? void 0 : e.visual) == null ? void 0 : c.frameObject);
|
|
173
|
+
if (!t)
|
|
174
|
+
return !1;
|
|
175
|
+
const a = ke(t);
|
|
176
|
+
if (!(a != null && a.cards) || a.cards.length === 0)
|
|
177
|
+
return !1;
|
|
178
|
+
const o = (d = a.cards) == null ? void 0 : d.find(
|
|
179
|
+
(u) => u.id === a.activeCardId
|
|
180
|
+
);
|
|
181
|
+
return o ? (Ve({
|
|
182
|
+
...s,
|
|
183
|
+
frame: a,
|
|
184
|
+
card: o,
|
|
185
|
+
visualId: (e == null ? void 0 : e.id) || a.visualId
|
|
186
|
+
}), !0) : !1;
|
|
187
|
+
}
|
|
188
|
+
function Ot() {
|
|
189
|
+
var h;
|
|
190
|
+
const { setCardSql: e } = P(), s = y((n) => n.frame), t = y((n) => n.card), a = Ie(
|
|
191
|
+
((h = t.customCardPreferences) == null ? void 0 : h.url) || ""
|
|
192
|
+
), o = y(
|
|
193
|
+
(n) => n.selectedSchemaName
|
|
194
|
+
), c = y(
|
|
195
|
+
(n) => n.selectedDatamodelId
|
|
196
|
+
), d = y(
|
|
197
|
+
(n) => n.selectedDatabaseName
|
|
198
|
+
), u = y((n) => n.selectedTableName), m = y(
|
|
199
|
+
(n) => n.selectedConnectionId
|
|
200
|
+
), g = y((n) => n.isShowingVisual), v = t.sql;
|
|
201
|
+
return { getUpdatedFrame: A(() => {
|
|
202
|
+
var x;
|
|
203
|
+
let n = v;
|
|
204
|
+
v && !v.includes("{{") && (n = Vt(v), e(n));
|
|
205
|
+
const p = (x = a == null ? void 0 : a.getState()) == null ? void 0 : x.settings, S = {
|
|
206
|
+
...t,
|
|
207
|
+
dataSource: t.dataSource || { mode: "directSource" },
|
|
208
|
+
lastSelectedSchema: o,
|
|
209
|
+
lastSelectedDatamodelId: c,
|
|
210
|
+
lastSelectedDatabase: d,
|
|
211
|
+
lastSelectedTable: u,
|
|
212
|
+
connectionId: m,
|
|
213
|
+
// type: isShowingVisual ? card.type : 'table', /// CHECK THIS!!!!
|
|
214
|
+
sql: n,
|
|
215
|
+
customCfg: g ? t.customCfg : null,
|
|
216
|
+
preferences: t.preferences,
|
|
217
|
+
// Preserve all preferences including column sizing
|
|
218
|
+
...p && {
|
|
219
|
+
customCardPreferences: {
|
|
220
|
+
...t.customCardPreferences,
|
|
221
|
+
settings: p
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}, T = s.cards.map(
|
|
225
|
+
(q) => q.id === t.id ? S : q
|
|
226
|
+
);
|
|
227
|
+
return {
|
|
228
|
+
...s,
|
|
229
|
+
cards: T,
|
|
230
|
+
activeCardId: Lt(T, s.activeCardId)
|
|
231
|
+
};
|
|
232
|
+
}, [
|
|
233
|
+
t,
|
|
234
|
+
s,
|
|
235
|
+
g,
|
|
236
|
+
o,
|
|
237
|
+
c,
|
|
238
|
+
d,
|
|
239
|
+
u,
|
|
240
|
+
m,
|
|
241
|
+
e,
|
|
242
|
+
a,
|
|
243
|
+
v
|
|
244
|
+
]) };
|
|
245
|
+
}
|
|
246
|
+
function se() {
|
|
247
|
+
const { authToken: e, tokenProps: s } = fe(), t = X(), a = re(), { selectVisual: o } = qe(), {
|
|
248
|
+
setFrame: c,
|
|
249
|
+
setCard: d,
|
|
250
|
+
setIsDevMode: u,
|
|
251
|
+
setActiveTabCardId: m,
|
|
252
|
+
updateDataSource: g,
|
|
253
|
+
setQueryResultColumns: v,
|
|
254
|
+
setSelectedConnectionId: w,
|
|
255
|
+
setSelectedDatabaseName: h,
|
|
256
|
+
setSelectedSchemaName: n,
|
|
257
|
+
setSelectedTableName: p,
|
|
258
|
+
setSelectedDatamodelId: S,
|
|
259
|
+
setFilterValues: T,
|
|
260
|
+
setApplyFilters: x
|
|
261
|
+
} = P(), {
|
|
262
|
+
setIsDashboardEditing: q,
|
|
263
|
+
setIsVisualEditing: D,
|
|
264
|
+
setSelectedFrameId: j,
|
|
265
|
+
clearSelectedFrameId: U,
|
|
266
|
+
addFrame: N,
|
|
267
|
+
setIsDashboardPanelOpen: b
|
|
268
|
+
} = Y(), B = Q((r) => r.selectedSheetId), E = Q((r) => r.selectedFrameId), O = Q((r) => r.dashboard), R = Q((r) => r.filterValues), L = Me((a == null ? void 0 : a.id) || "", {
|
|
269
|
+
enabled: !!(a != null && a.id) && !!(e != null && e.accessToken)
|
|
270
|
+
}), z = A(
|
|
271
|
+
async (r) => {
|
|
272
|
+
try {
|
|
273
|
+
o(r), U();
|
|
274
|
+
const { data: F, fromCache: f } = await pe(
|
|
275
|
+
s.apiServiceUrl,
|
|
276
|
+
(e == null ? void 0 : e.accessToken) || "",
|
|
277
|
+
r.id,
|
|
278
|
+
t
|
|
279
|
+
);
|
|
280
|
+
if (!Ut(F, {
|
|
281
|
+
setFrame: c,
|
|
282
|
+
setCard: d,
|
|
283
|
+
setIsDevMode: u,
|
|
284
|
+
setActiveTabCardId: m,
|
|
285
|
+
updateDataSource: g,
|
|
286
|
+
setQueryResultColumns: v,
|
|
287
|
+
setSelectedConnectionId: w,
|
|
288
|
+
setSelectedDatabaseName: h,
|
|
289
|
+
setSelectedSchemaName: n,
|
|
290
|
+
setSelectedTableName: p,
|
|
291
|
+
setSelectedDatamodelId: S,
|
|
292
|
+
setFilterValues: T,
|
|
293
|
+
setApplyFilters: x,
|
|
294
|
+
setIsDashboardEditing: q,
|
|
295
|
+
setIsVisualEditing: D,
|
|
296
|
+
dashboard: O,
|
|
297
|
+
selectedSheetId: B,
|
|
298
|
+
selectedFrameId: E,
|
|
299
|
+
filterValues: R
|
|
300
|
+
}))
|
|
301
|
+
throw new Error("Failed to setup editor with visual data");
|
|
302
|
+
return { success: !0, fromCache: f };
|
|
303
|
+
} catch (F) {
|
|
304
|
+
return console.error("Error editing visual:", F), { success: !1, error: "Failed to load visual for editing" };
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
[
|
|
308
|
+
e == null ? void 0 : e.accessToken,
|
|
309
|
+
s.apiServiceUrl,
|
|
310
|
+
t,
|
|
311
|
+
o,
|
|
312
|
+
c,
|
|
313
|
+
d,
|
|
314
|
+
q,
|
|
315
|
+
D,
|
|
316
|
+
u,
|
|
317
|
+
m,
|
|
318
|
+
g,
|
|
319
|
+
v,
|
|
320
|
+
w,
|
|
321
|
+
h,
|
|
322
|
+
n,
|
|
323
|
+
p,
|
|
324
|
+
S,
|
|
325
|
+
T,
|
|
326
|
+
x,
|
|
327
|
+
U,
|
|
328
|
+
O,
|
|
329
|
+
B,
|
|
330
|
+
E,
|
|
331
|
+
R
|
|
332
|
+
]
|
|
333
|
+
), l = A(
|
|
334
|
+
async (r) => {
|
|
335
|
+
var F;
|
|
336
|
+
try {
|
|
337
|
+
if (o(r), !B)
|
|
338
|
+
return {
|
|
339
|
+
success: !1,
|
|
340
|
+
error: "No sheet selected. Please select a sheet first."
|
|
341
|
+
};
|
|
342
|
+
const { data: f, fromCache: k } = await pe(
|
|
343
|
+
s.apiServiceUrl,
|
|
344
|
+
(e == null ? void 0 : e.accessToken) || "",
|
|
345
|
+
r.id,
|
|
346
|
+
t
|
|
347
|
+
), M = (f == null ? void 0 : f.frameObject) ?? ((F = f == null ? void 0 : f.visual) == null ? void 0 : F.frameObject);
|
|
348
|
+
if (!M)
|
|
349
|
+
return { success: !1, error: "Visual has no frame data" };
|
|
350
|
+
const $ = ke(M);
|
|
351
|
+
if (!($ != null && $.cards) || $.cards.length === 0)
|
|
352
|
+
return { success: !1, error: "Visual frame is malformed" };
|
|
353
|
+
const _ = {
|
|
354
|
+
...$,
|
|
355
|
+
id: ge(),
|
|
356
|
+
visualId: r.id
|
|
357
|
+
// Link this frame to the library visual
|
|
358
|
+
};
|
|
359
|
+
return N(B, _, "end"), q(!0), j(_.id), b(!1), { success: !0, fromCache: k };
|
|
360
|
+
} catch (f) {
|
|
361
|
+
return console.error("Error adding visual:", f), { success: !1, error: "Failed to add visual to dashboard" };
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
[
|
|
365
|
+
e == null ? void 0 : e.accessToken,
|
|
366
|
+
s.apiServiceUrl,
|
|
367
|
+
t,
|
|
368
|
+
o,
|
|
369
|
+
B,
|
|
370
|
+
N,
|
|
371
|
+
q,
|
|
372
|
+
j,
|
|
373
|
+
b
|
|
374
|
+
]
|
|
375
|
+
);
|
|
376
|
+
return {
|
|
377
|
+
visual: L.data,
|
|
378
|
+
isLoading: L.isLoading,
|
|
379
|
+
isError: L.isError,
|
|
380
|
+
error: L.error,
|
|
381
|
+
handleEditLibraryVisual: z,
|
|
382
|
+
handleAddLibraryVisual: l,
|
|
383
|
+
getUpdatedFrame: Ot().getUpdatedFrame,
|
|
384
|
+
refetch: L.refetch
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
function ta({
|
|
388
|
+
className: e,
|
|
389
|
+
variant: s = "outline"
|
|
390
|
+
}) {
|
|
391
|
+
var u;
|
|
392
|
+
const { setCardSql: t } = P();
|
|
393
|
+
y((m) => m.frame);
|
|
394
|
+
const a = y((m) => m.card);
|
|
395
|
+
Ie(
|
|
396
|
+
((u = a.customCardPreferences) == null ? void 0 : u.url) || ""
|
|
397
|
+
), y(
|
|
398
|
+
(m) => m.selectedSchemaName
|
|
399
|
+
), y(
|
|
400
|
+
(m) => m.selectedDatamodelId
|
|
401
|
+
), y(
|
|
402
|
+
(m) => m.selectedDatabaseName
|
|
403
|
+
), y((m) => m.selectedTableName), y(
|
|
404
|
+
(m) => m.selectedConnectionId
|
|
405
|
+
), y((m) => m.isShowingVisual), a.sql;
|
|
406
|
+
const o = y((m) => m.onSave), { getUpdatedFrame: c } = se();
|
|
407
|
+
function d() {
|
|
408
|
+
const m = c();
|
|
409
|
+
o == null || o(m);
|
|
410
|
+
}
|
|
411
|
+
return /* @__PURE__ */ C(
|
|
412
|
+
H,
|
|
413
|
+
{
|
|
414
|
+
onClick: d,
|
|
415
|
+
className: J("h-8", e),
|
|
416
|
+
size: "sm",
|
|
417
|
+
variant: s,
|
|
418
|
+
children: [
|
|
419
|
+
/* @__PURE__ */ i(ye, { className: "mr-2 size-4 font-bold" }),
|
|
420
|
+
"Accept"
|
|
421
|
+
]
|
|
422
|
+
}
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
function aa({
|
|
426
|
+
className: e,
|
|
427
|
+
variant: s = "default"
|
|
428
|
+
}) {
|
|
429
|
+
const t = X(), [a, o] = G(!1), c = Q(
|
|
430
|
+
(h) => h.actions.setIsDashboardPanelOpen
|
|
431
|
+
), { setIsVisualEditing: d } = Y(), { getUpdatedFrame: u } = se(), m = re(), g = y((h) => h.frame), v = be();
|
|
432
|
+
return /* @__PURE__ */ C(
|
|
433
|
+
H,
|
|
434
|
+
{
|
|
435
|
+
onClick: () => {
|
|
436
|
+
const h = u(), n = (g == null ? void 0 : g.visualId) || (m == null ? void 0 : m.id);
|
|
437
|
+
if (!n) {
|
|
438
|
+
V.error("No visual to save");
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
o(!0), v.mutate(
|
|
442
|
+
{
|
|
443
|
+
visualId: n,
|
|
444
|
+
data: {
|
|
445
|
+
frameObject: h
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
onSuccess: () => {
|
|
450
|
+
o(!1), c(!0), V.success("Visual updated successfully"), t.invalidateQueries({
|
|
451
|
+
queryKey: ["resource-by-id", "visual", n],
|
|
452
|
+
exact: !0
|
|
453
|
+
});
|
|
454
|
+
},
|
|
455
|
+
onError: () => {
|
|
456
|
+
o(!1), V.error("Failed to update visual");
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
);
|
|
460
|
+
},
|
|
461
|
+
className: J("h-8", e),
|
|
462
|
+
size: "sm",
|
|
463
|
+
variant: s,
|
|
464
|
+
children: [
|
|
465
|
+
a && /* @__PURE__ */ C(W, { children: [
|
|
466
|
+
/* @__PURE__ */ i(le, { className: "mr-2 size-4 animate-spin font-bold" }),
|
|
467
|
+
" Saving"
|
|
468
|
+
] }),
|
|
469
|
+
!a && /* @__PURE__ */ C(W, { children: [
|
|
470
|
+
/* @__PURE__ */ i(Te, { className: "mr-2 size-4 font-bold" }),
|
|
471
|
+
"Save to Library"
|
|
472
|
+
] })
|
|
473
|
+
]
|
|
474
|
+
}
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
function sa({
|
|
478
|
+
className: e
|
|
479
|
+
}) {
|
|
480
|
+
const s = X(), [t, a] = G(!1), o = re(), c = y((h) => h.frame), d = Q((h) => h.selectedSheetId), { updateFrame: u, setIsVisualEditing: m } = Y(), { getUpdatedFrame: g } = se(), v = be();
|
|
481
|
+
return /* @__PURE__ */ i(
|
|
482
|
+
H,
|
|
483
|
+
{
|
|
484
|
+
onClick: async () => {
|
|
485
|
+
if (!d) {
|
|
486
|
+
V.error("No sheet selected");
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
const h = (c == null ? void 0 : c.visualId) || (o == null ? void 0 : o.id);
|
|
490
|
+
if (!h) {
|
|
491
|
+
V.error("No visual to update");
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
a(!0);
|
|
495
|
+
try {
|
|
496
|
+
const n = g();
|
|
497
|
+
await v.mutateAsync({
|
|
498
|
+
visualId: h,
|
|
499
|
+
data: {
|
|
500
|
+
frameObject: n
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
const p = {
|
|
504
|
+
...n,
|
|
505
|
+
visualId: h
|
|
506
|
+
// Keep the link to library visual
|
|
507
|
+
};
|
|
508
|
+
u(d, p), s.invalidateQueries({ queryKey: ["visuals"] }), s.invalidateQueries({ queryKey: ["visual", h] }), V.success("Saved to library and applied locally"), setTimeout(() => {
|
|
509
|
+
m(!1);
|
|
510
|
+
}, 300);
|
|
511
|
+
} catch (n) {
|
|
512
|
+
console.error("Failed to save and apply:", n), V.error("Failed to save and apply changes");
|
|
513
|
+
} finally {
|
|
514
|
+
a(!1);
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
className: J("h-8", e),
|
|
518
|
+
size: "sm",
|
|
519
|
+
variant: "default",
|
|
520
|
+
disabled: t,
|
|
521
|
+
children: t ? /* @__PURE__ */ C(W, { children: [
|
|
522
|
+
/* @__PURE__ */ i(le, { className: "mr-2 size-4 animate-spin font-bold" }),
|
|
523
|
+
" Saving..."
|
|
524
|
+
] }) : /* @__PURE__ */ C(W, { children: [
|
|
525
|
+
/* @__PURE__ */ i(Te, { className: "mr-2 size-4 font-bold" }),
|
|
526
|
+
"Save & Apply"
|
|
527
|
+
] })
|
|
528
|
+
}
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
function na({ className: e }) {
|
|
532
|
+
const { getUpdatedFrame: s } = se();
|
|
533
|
+
y((m) => m.frame);
|
|
534
|
+
const t = Q((m) => m.selectedSheetId), { updateFrame: a, setIsVisualEditing: o } = Y(), [c, d] = G(!1);
|
|
535
|
+
return /* @__PURE__ */ C(
|
|
536
|
+
H,
|
|
537
|
+
{
|
|
538
|
+
onClick: () => {
|
|
539
|
+
if (!t) {
|
|
540
|
+
V.error("No sheet selected");
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
d(!0);
|
|
544
|
+
const g = {
|
|
545
|
+
...s(),
|
|
546
|
+
visualId: void 0
|
|
547
|
+
// Remove the link to library visual
|
|
548
|
+
};
|
|
549
|
+
a(t, g), setTimeout(() => {
|
|
550
|
+
d(!1), V.success("Changes applied. Visual is now local to this dashboard"), o(!1);
|
|
551
|
+
}, 300);
|
|
552
|
+
},
|
|
553
|
+
className: J("h-8", e),
|
|
554
|
+
size: "sm",
|
|
555
|
+
variant: "outline",
|
|
556
|
+
children: [
|
|
557
|
+
c && /* @__PURE__ */ C(W, { children: [
|
|
558
|
+
/* @__PURE__ */ i(le, { className: "mr-2 size-4 animate-spin font-bold" }),
|
|
559
|
+
" Applying"
|
|
560
|
+
] }),
|
|
561
|
+
!c && /* @__PURE__ */ C(W, { children: [
|
|
562
|
+
/* @__PURE__ */ i(ye, { className: "mr-2 size-4 font-bold" }),
|
|
563
|
+
"Apply Locally"
|
|
564
|
+
] })
|
|
565
|
+
]
|
|
566
|
+
}
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
function ra({ className: e }) {
|
|
570
|
+
const { setTempQueryData: s, setSqlGen: t } = P(), a = X(), o = y((g) => g.tempQueryData), c = y((g) => g.onClose), d = y((g) => g.card), { queryKey: u } = oe(d);
|
|
571
|
+
function m() {
|
|
572
|
+
if (o) {
|
|
573
|
+
const { queryKey: g, queryData: v } = o;
|
|
574
|
+
g && v && a.setQueryData(g, v);
|
|
575
|
+
}
|
|
576
|
+
t({}), c == null || c();
|
|
577
|
+
}
|
|
578
|
+
return /* @__PURE__ */ C(
|
|
579
|
+
H,
|
|
580
|
+
{
|
|
581
|
+
onClick: m,
|
|
582
|
+
className: J("h-8", e),
|
|
583
|
+
size: "sm",
|
|
584
|
+
variant: "outline",
|
|
585
|
+
children: [
|
|
586
|
+
/* @__PURE__ */ i(Ce, { className: "mr-2 size-4" }),
|
|
587
|
+
"Close"
|
|
588
|
+
]
|
|
589
|
+
}
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
function oa() {
|
|
593
|
+
const { setTempQueryData: e } = P(), s = X();
|
|
594
|
+
y((S) => S.isDevMode);
|
|
595
|
+
const t = y((S) => S.tempQueryData), a = y((S) => S.card), { queryKey: o } = oe(a), {
|
|
596
|
+
setCardSql: c,
|
|
597
|
+
setSqlGen: d,
|
|
598
|
+
setCardPython: u,
|
|
599
|
+
setCardCustomCfg: m,
|
|
600
|
+
setCardPreferences: g,
|
|
601
|
+
updateDataSource: v,
|
|
602
|
+
clearQueryConfig: w,
|
|
603
|
+
setCardConfig: h,
|
|
604
|
+
setCardType: n
|
|
605
|
+
} = P();
|
|
606
|
+
function p() {
|
|
607
|
+
const S = s.getQueryData(o);
|
|
608
|
+
t != null && t.queryData || e({
|
|
609
|
+
queryKey: o,
|
|
610
|
+
queryData: S
|
|
611
|
+
}), s.setQueryData(o, null), s.removeQueries({ queryKey: o, exact: !0 }), c(""), d({}), w(), h(void 0), u(""), m(""), g({}), n("bar");
|
|
612
|
+
}
|
|
613
|
+
return /* @__PURE__ */ C(
|
|
614
|
+
H,
|
|
615
|
+
{
|
|
616
|
+
onClick: p,
|
|
617
|
+
className: "h-8",
|
|
618
|
+
size: "sm",
|
|
619
|
+
variant: "secondary",
|
|
620
|
+
children: [
|
|
621
|
+
/* @__PURE__ */ i(qt, { className: "mr-2 size-4" }),
|
|
622
|
+
"Clear"
|
|
623
|
+
]
|
|
624
|
+
}
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
function Ee(e) {
|
|
628
|
+
const { tokenProps: s, authToken: t } = fe(), a = s == null ? void 0 : s.apiServiceUrl;
|
|
629
|
+
return Le({
|
|
630
|
+
queryKey: ["joinability-map", e],
|
|
631
|
+
queryFn: async () => {
|
|
632
|
+
if (!e || !(t != null && t.accessToken))
|
|
633
|
+
return null;
|
|
634
|
+
const o = `${a}/v1/domains/${e}/joinability`;
|
|
635
|
+
return Ue(o, t.accessToken);
|
|
636
|
+
},
|
|
637
|
+
// Only run query when semantic domain exists AND auth is ready
|
|
638
|
+
// This prevents caching null responses before auth token loads
|
|
639
|
+
enabled: !!e && !!(t != null && t.accessToken) && !!a,
|
|
640
|
+
// Cache for 5 minutes - relationships don't change often
|
|
641
|
+
staleTime: 5 * 60 * 1e3,
|
|
642
|
+
// Keep in cache for 10 minutes after becoming stale
|
|
643
|
+
gcTime: 10 * 60 * 1e3,
|
|
644
|
+
// Retry on failure (network issues, etc.)
|
|
645
|
+
retry: 2,
|
|
646
|
+
retryDelay: (o) => Math.min(1e3 * 2 ** o, 3e4)
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
function $t(e, s, t) {
|
|
650
|
+
if (s === "source")
|
|
651
|
+
return { isValid: !0 };
|
|
652
|
+
const a = Ne(e.dataType);
|
|
653
|
+
if (t === "kpi") {
|
|
654
|
+
if (s === "groupBy" && a !== "date")
|
|
655
|
+
return {
|
|
656
|
+
isValid: !1,
|
|
657
|
+
reason: "KPI Trend By only accepts date fields"
|
|
658
|
+
};
|
|
659
|
+
if (s === "metrics" && a === "date")
|
|
660
|
+
return {
|
|
661
|
+
isValid: !1,
|
|
662
|
+
reason: "KPI metrics cannot be date fields"
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
return { isValid: !0 };
|
|
666
|
+
}
|
|
667
|
+
function _t(e, s, t, a, o) {
|
|
668
|
+
if (e !== "kpi" || o.length < 3)
|
|
669
|
+
return;
|
|
670
|
+
const c = (s == null ? void 0 : s.groupByColumns) && s.groupByColumns.length > 0, d = (s == null ? void 0 : s.comparisonType) === "none";
|
|
671
|
+
!c && d || t(a, {
|
|
672
|
+
groupByColumns: [],
|
|
673
|
+
comparisonType: "none"
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
const Gt = (e) => {
|
|
677
|
+
var z;
|
|
678
|
+
const s = (z = e == null ? void 0 : e.dataSource) == null ? void 0 : z.semanticDomainId, { data: t } = Ee(s), {
|
|
679
|
+
updateCardConfig: a,
|
|
680
|
+
updateGroupByColumn: o,
|
|
681
|
+
updateMetricColumn: c,
|
|
682
|
+
updatePivotByColumn: d,
|
|
683
|
+
updateSortByColumn: u,
|
|
684
|
+
removeGroupByColumn: m,
|
|
685
|
+
removeMetricColumn: g,
|
|
686
|
+
removePivotByColumn: v,
|
|
687
|
+
removeSortByColumn: w
|
|
688
|
+
} = P(), h = y((l) => l.card.type), n = e == null ? void 0 : e.id, p = A(
|
|
689
|
+
(l) => {
|
|
690
|
+
if (!(e != null && e.config)) return [];
|
|
691
|
+
switch (l) {
|
|
692
|
+
case "groupBy":
|
|
693
|
+
return (e.config.groupByColumns || []).map(
|
|
694
|
+
(r) => ({
|
|
695
|
+
id: r.id,
|
|
696
|
+
name: r.name,
|
|
697
|
+
dataType: r.dataType,
|
|
698
|
+
label: r.label !== void 0 ? r.label : r.name,
|
|
699
|
+
qualifiedEntityName: r.qualifiedEntityName,
|
|
700
|
+
entityId: r.entityId,
|
|
701
|
+
entityName: r.entityName,
|
|
702
|
+
entityType: r.entityType,
|
|
703
|
+
dateFormat: r.dateFormat,
|
|
704
|
+
customFormat: r.customFormat,
|
|
705
|
+
granularity: r.granularity
|
|
706
|
+
})
|
|
707
|
+
);
|
|
708
|
+
case "metrics":
|
|
709
|
+
return e.config.metricColumns || [];
|
|
710
|
+
case "pivotBy":
|
|
711
|
+
return (e.config.pivotByColumns || []).map(
|
|
712
|
+
(r) => ({
|
|
713
|
+
id: r.id,
|
|
714
|
+
name: r.name,
|
|
715
|
+
dataType: r.dataType,
|
|
716
|
+
label: r.label !== void 0 ? r.label : r.name,
|
|
717
|
+
qualifiedEntityName: r.qualifiedEntityName,
|
|
718
|
+
entityId: r.entityId,
|
|
719
|
+
entityName: r.entityName,
|
|
720
|
+
entityType: r.entityType
|
|
721
|
+
})
|
|
722
|
+
);
|
|
723
|
+
case "sortBy":
|
|
724
|
+
return (e.config.sortByColumns || []).map(
|
|
725
|
+
(r) => ({
|
|
726
|
+
id: r.id,
|
|
727
|
+
name: r.name,
|
|
728
|
+
dataType: r.dataType,
|
|
729
|
+
label: r.label !== void 0 ? r.label : r.name,
|
|
730
|
+
qualifiedEntityName: r.qualifiedEntityName,
|
|
731
|
+
entityId: r.entityId,
|
|
732
|
+
entityName: r.entityName,
|
|
733
|
+
entityType: r.entityType,
|
|
734
|
+
direction: r.direction
|
|
735
|
+
})
|
|
736
|
+
);
|
|
737
|
+
case "source":
|
|
738
|
+
return [];
|
|
739
|
+
default:
|
|
740
|
+
return [];
|
|
741
|
+
}
|
|
742
|
+
},
|
|
743
|
+
[e]
|
|
744
|
+
), S = A(
|
|
745
|
+
(l, r) => {
|
|
746
|
+
if (n)
|
|
747
|
+
switch (l) {
|
|
748
|
+
case "groupBy": {
|
|
749
|
+
a(n, {
|
|
750
|
+
groupByColumns: r
|
|
751
|
+
});
|
|
752
|
+
break;
|
|
753
|
+
}
|
|
754
|
+
case "metrics": {
|
|
755
|
+
a(n, {
|
|
756
|
+
metricColumns: r
|
|
757
|
+
});
|
|
758
|
+
break;
|
|
759
|
+
}
|
|
760
|
+
case "pivotBy": {
|
|
761
|
+
a(n, {
|
|
762
|
+
pivotByColumns: r
|
|
763
|
+
});
|
|
764
|
+
break;
|
|
765
|
+
}
|
|
766
|
+
case "sortBy": {
|
|
767
|
+
a(n, {
|
|
768
|
+
sortByColumns: r
|
|
769
|
+
});
|
|
770
|
+
break;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
},
|
|
774
|
+
[
|
|
775
|
+
n,
|
|
776
|
+
// createGroupByColumn,
|
|
777
|
+
a
|
|
778
|
+
// createStackByColumn,
|
|
779
|
+
// createSortByColumn,
|
|
780
|
+
]
|
|
781
|
+
), T = A(
|
|
782
|
+
(l, r, F) => {
|
|
783
|
+
if (!n) return;
|
|
784
|
+
const k = p(l)[r];
|
|
785
|
+
if (k)
|
|
786
|
+
switch (l) {
|
|
787
|
+
case "groupBy":
|
|
788
|
+
o(n, k.id, { label: F });
|
|
789
|
+
break;
|
|
790
|
+
case "metrics":
|
|
791
|
+
c(n, k.id, { label: F });
|
|
792
|
+
break;
|
|
793
|
+
case "pivotBy":
|
|
794
|
+
d(n, k.id, { label: F });
|
|
795
|
+
break;
|
|
796
|
+
case "sortBy":
|
|
797
|
+
u(n, k.id, { label: F });
|
|
798
|
+
break;
|
|
799
|
+
}
|
|
800
|
+
},
|
|
801
|
+
[
|
|
802
|
+
n,
|
|
803
|
+
p,
|
|
804
|
+
o,
|
|
805
|
+
c,
|
|
806
|
+
d,
|
|
807
|
+
u
|
|
808
|
+
]
|
|
809
|
+
), x = A(
|
|
810
|
+
(l, r) => {
|
|
811
|
+
if (!n) return;
|
|
812
|
+
const f = p("metrics")[l];
|
|
813
|
+
f && c(n, f.id, {
|
|
814
|
+
aggregate: r,
|
|
815
|
+
label: Oe(
|
|
816
|
+
f.name,
|
|
817
|
+
r
|
|
818
|
+
)
|
|
819
|
+
});
|
|
820
|
+
},
|
|
821
|
+
[n, p, c]
|
|
822
|
+
), q = A(
|
|
823
|
+
(l, r, F) => {
|
|
824
|
+
if (!n) return;
|
|
825
|
+
const k = p("groupBy")[l];
|
|
826
|
+
if (!k) return;
|
|
827
|
+
const M = {
|
|
828
|
+
dateFormat: r
|
|
829
|
+
};
|
|
830
|
+
r === "custom" && F ? M.customFormat = F : M.customFormat = void 0, o(n, k.id, M);
|
|
831
|
+
},
|
|
832
|
+
[n, p, o]
|
|
833
|
+
), D = A(
|
|
834
|
+
(l, r) => {
|
|
835
|
+
if (!n) return;
|
|
836
|
+
const f = p("groupBy")[l];
|
|
837
|
+
f && o(n, f.id, {
|
|
838
|
+
granularity: r
|
|
839
|
+
});
|
|
840
|
+
},
|
|
841
|
+
[n, p, o]
|
|
842
|
+
), j = A(
|
|
843
|
+
(l, r) => {
|
|
844
|
+
if (!n) return;
|
|
845
|
+
const f = p("metrics")[l];
|
|
846
|
+
f && c(n, f.id, {
|
|
847
|
+
aliasTemplate: r
|
|
848
|
+
});
|
|
849
|
+
},
|
|
850
|
+
[n, p, c]
|
|
851
|
+
), U = A(
|
|
852
|
+
(l, r) => {
|
|
853
|
+
if (console.log("handleValueAliasesChange", l, r), !n) return;
|
|
854
|
+
console.log("handleValueAliasesChange", l, r);
|
|
855
|
+
const f = p("metrics")[l];
|
|
856
|
+
f && (console.log("handleValueAliasesChange", r), c(n, f.id, {
|
|
857
|
+
valueAliases: r
|
|
858
|
+
}));
|
|
859
|
+
},
|
|
860
|
+
[n, p, c]
|
|
861
|
+
), N = A(
|
|
862
|
+
(l) => {
|
|
863
|
+
if (!n) return;
|
|
864
|
+
if (p("metrics").length === 0) {
|
|
865
|
+
V.error("Add Metric First", {
|
|
866
|
+
description: "Please add a metric field before selecting a comparison type",
|
|
867
|
+
position: "top-center",
|
|
868
|
+
duration: 3e3
|
|
869
|
+
});
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
a(n, { comparisonType: l });
|
|
873
|
+
},
|
|
874
|
+
[n, a, p]
|
|
875
|
+
), b = A(
|
|
876
|
+
(l) => {
|
|
877
|
+
n && a(n, { showTrendline: l });
|
|
878
|
+
},
|
|
879
|
+
[n, a]
|
|
880
|
+
), B = A(
|
|
881
|
+
(l) => {
|
|
882
|
+
n && a(n, { trendlineWindow: l });
|
|
883
|
+
},
|
|
884
|
+
[n, a]
|
|
885
|
+
), E = A(
|
|
886
|
+
(l) => {
|
|
887
|
+
n && a(n, { trendlineGranularity: l });
|
|
888
|
+
},
|
|
889
|
+
[n, a]
|
|
890
|
+
), O = A(
|
|
891
|
+
(l) => {
|
|
892
|
+
n && a(n, { targetValue: l });
|
|
893
|
+
},
|
|
894
|
+
[n, a]
|
|
895
|
+
), R = A(
|
|
896
|
+
(l) => {
|
|
897
|
+
var _;
|
|
898
|
+
if (!n) return;
|
|
899
|
+
const r = [
|
|
900
|
+
...p("groupBy"),
|
|
901
|
+
...p("pivotBy"),
|
|
902
|
+
...p("metrics"),
|
|
903
|
+
...p("sortBy")
|
|
904
|
+
], F = $e(l, r, {
|
|
905
|
+
joinPlan: (_ = e == null ? void 0 : e.config) == null ? void 0 : _.joinPlan,
|
|
906
|
+
joinabilityMap: t == null ? void 0 : t.joinabilityMap,
|
|
907
|
+
semanticDomainId: s
|
|
908
|
+
});
|
|
909
|
+
if (!F.isValid) {
|
|
910
|
+
F.showError && _e();
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
const f = Ge(
|
|
914
|
+
l,
|
|
915
|
+
r,
|
|
916
|
+
h
|
|
917
|
+
// Pass chart type for KPI-specific routing
|
|
918
|
+
);
|
|
919
|
+
if (!f) {
|
|
920
|
+
V.error("Invalid Field", {
|
|
921
|
+
description: "This field cannot be added to any container",
|
|
922
|
+
position: "top-center",
|
|
923
|
+
duration: 3e3
|
|
924
|
+
});
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
const k = $t(
|
|
928
|
+
l,
|
|
929
|
+
f,
|
|
930
|
+
h
|
|
931
|
+
);
|
|
932
|
+
if (!k.isValid) {
|
|
933
|
+
V.error("Invalid Field Type", {
|
|
934
|
+
description: k.reason,
|
|
935
|
+
position: "top-center",
|
|
936
|
+
duration: 3e3
|
|
937
|
+
});
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
const M = p(f);
|
|
941
|
+
if (Re(l, M)) return;
|
|
942
|
+
const $ = je(l, f, M);
|
|
943
|
+
if ($) {
|
|
944
|
+
const I = [...M, $];
|
|
945
|
+
S(f, I), f === "metrics" && _t(
|
|
946
|
+
h,
|
|
947
|
+
e == null ? void 0 : e.config,
|
|
948
|
+
a,
|
|
949
|
+
n,
|
|
950
|
+
I
|
|
951
|
+
// Fresh metrics array including the newly added field
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
},
|
|
955
|
+
[
|
|
956
|
+
n,
|
|
957
|
+
e == null ? void 0 : e.config,
|
|
958
|
+
p,
|
|
959
|
+
S,
|
|
960
|
+
s,
|
|
961
|
+
t,
|
|
962
|
+
h,
|
|
963
|
+
a
|
|
964
|
+
]
|
|
965
|
+
), L = A(
|
|
966
|
+
(l, r) => {
|
|
967
|
+
if (!n) return;
|
|
968
|
+
const f = p(l)[r];
|
|
969
|
+
if (f) {
|
|
970
|
+
if (l !== "sortBy") {
|
|
971
|
+
const k = p("sortBy"), M = k.filter(
|
|
972
|
+
($) => !($.name === f.name && $.qualifiedEntityName === f.qualifiedEntityName)
|
|
973
|
+
);
|
|
974
|
+
M.length !== k.length && a(n, {
|
|
975
|
+
sortByColumns: M
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
switch (l) {
|
|
979
|
+
case "groupBy":
|
|
980
|
+
m(n, f.id);
|
|
981
|
+
break;
|
|
982
|
+
case "metrics":
|
|
983
|
+
g(n, f.id);
|
|
984
|
+
break;
|
|
985
|
+
case "pivotBy":
|
|
986
|
+
v(n, f.id);
|
|
987
|
+
break;
|
|
988
|
+
case "sortBy":
|
|
989
|
+
w(n, f.id);
|
|
990
|
+
break;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
},
|
|
994
|
+
[
|
|
995
|
+
n,
|
|
996
|
+
p,
|
|
997
|
+
m,
|
|
998
|
+
g,
|
|
999
|
+
v,
|
|
1000
|
+
w,
|
|
1001
|
+
a
|
|
1002
|
+
]
|
|
1003
|
+
);
|
|
1004
|
+
return {
|
|
1005
|
+
getFieldsForContainer: p,
|
|
1006
|
+
setFieldsForContainer: S,
|
|
1007
|
+
updateLabel: T,
|
|
1008
|
+
handleAggregationChange: x,
|
|
1009
|
+
handleDateFormatChange: q,
|
|
1010
|
+
handleGranularityChange: D,
|
|
1011
|
+
handleAliasTemplateChange: j,
|
|
1012
|
+
handleValueAliasesChange: U,
|
|
1013
|
+
removeField: L,
|
|
1014
|
+
handleFieldClick: R,
|
|
1015
|
+
// KPI-specific handlers
|
|
1016
|
+
handleKpiComparisonTypeChange: N,
|
|
1017
|
+
handleKpiShowTrendlineChange: b,
|
|
1018
|
+
handleKpiTrendlineWindowChange: B,
|
|
1019
|
+
handleKpiTrendlineGranularityChange: E,
|
|
1020
|
+
handleKpiTargetValueChange: O,
|
|
1021
|
+
// Card type for conditional rendering
|
|
1022
|
+
cardType: h
|
|
1023
|
+
};
|
|
1024
|
+
};
|
|
1025
|
+
function ee(e) {
|
|
1026
|
+
return `${e}-${ge()}`;
|
|
1027
|
+
}
|
|
1028
|
+
function he(e, s) {
|
|
1029
|
+
const t = ve(e.replace(/_/g, " "));
|
|
1030
|
+
switch (s) {
|
|
1031
|
+
case "SUM":
|
|
1032
|
+
return `Sum of ${t}`;
|
|
1033
|
+
case "COUNT":
|
|
1034
|
+
return `Count of ${t}`;
|
|
1035
|
+
case "DISTINCT":
|
|
1036
|
+
return `Unique ${t}`;
|
|
1037
|
+
case "AVG":
|
|
1038
|
+
return `Average of ${t}`;
|
|
1039
|
+
case "MIN":
|
|
1040
|
+
return `Min of ${t}`;
|
|
1041
|
+
case "MAX":
|
|
1042
|
+
return `Max of ${t}`;
|
|
1043
|
+
default:
|
|
1044
|
+
return t;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
function Rt(e, s) {
|
|
1048
|
+
const t = ve(e.replace(/_/g, " "));
|
|
1049
|
+
switch (s) {
|
|
1050
|
+
case "day":
|
|
1051
|
+
return `Date of ${t}`;
|
|
1052
|
+
case "week":
|
|
1053
|
+
return `Week of ${t}`;
|
|
1054
|
+
case "month":
|
|
1055
|
+
return `Month of ${t}`;
|
|
1056
|
+
case "year":
|
|
1057
|
+
return `Year of ${t}`;
|
|
1058
|
+
default:
|
|
1059
|
+
return t;
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
function ie(e) {
|
|
1063
|
+
if (!e || !e.selectedEntities || e.selectedEntities.length === 0)
|
|
1064
|
+
return {
|
|
1065
|
+
tableName: void 0,
|
|
1066
|
+
schemaName: void 0,
|
|
1067
|
+
databaseName: void 0,
|
|
1068
|
+
connectionId: e == null ? void 0 : e.connectionId,
|
|
1069
|
+
connectionType: e == null ? void 0 : e.connectionType
|
|
1070
|
+
};
|
|
1071
|
+
const s = e.selectedEntities[0];
|
|
1072
|
+
return {
|
|
1073
|
+
tableName: s == null ? void 0 : s.name,
|
|
1074
|
+
schemaName: s == null ? void 0 : s.schema,
|
|
1075
|
+
databaseName: s == null ? void 0 : s.database,
|
|
1076
|
+
connectionId: e.connectionId,
|
|
1077
|
+
connectionType: e.connectionType
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
function Ae(e) {
|
|
1081
|
+
if (!e || !e.selectedEntities || e.selectedEntities.length === 0)
|
|
1082
|
+
return !1;
|
|
1083
|
+
const s = e.selectedEntities[0];
|
|
1084
|
+
return !!(s != null && s.name);
|
|
1085
|
+
}
|
|
1086
|
+
function Be() {
|
|
1087
|
+
const e = y((N) => N.sqlGen), s = y((N) => N.isDevMode), t = y((N) => N.card.dataSource), a = y(
|
|
1088
|
+
(N) => {
|
|
1089
|
+
var b, B;
|
|
1090
|
+
return (B = (b = N.card) == null ? void 0 : b.queryConfig) == null ? void 0 : B.metricColumns;
|
|
1091
|
+
}
|
|
1092
|
+
), { tableName: o, schemaName: c, databaseName: d } = ie(t), u = Ae(t), m = y(
|
|
1093
|
+
(N) => N.selectedDatamodelId
|
|
1094
|
+
), {
|
|
1095
|
+
addColumnToMetricColumns: g,
|
|
1096
|
+
addColumnToGroupBy: v,
|
|
1097
|
+
setCardSql: w,
|
|
1098
|
+
setRunSql: h,
|
|
1099
|
+
setSqlGen: n,
|
|
1100
|
+
setIsShowingVisual: p
|
|
1101
|
+
} = P(), { connectionType: S, modelItems: T, selectedDatamodelName: x } = Se(), q = (N) => ({
|
|
1102
|
+
column_name: N.name,
|
|
1103
|
+
data_type: N.dataType,
|
|
1104
|
+
label: N.label,
|
|
1105
|
+
description: N.description
|
|
1106
|
+
});
|
|
1107
|
+
return {
|
|
1108
|
+
handleDevModeFieldClick: (N) => {
|
|
1109
|
+
var B;
|
|
1110
|
+
if (!s) return;
|
|
1111
|
+
const b = q(N);
|
|
1112
|
+
if (s && u && o) {
|
|
1113
|
+
const E = xe(b, e);
|
|
1114
|
+
n(E);
|
|
1115
|
+
const O = (B = T == null ? void 0 : T.find(
|
|
1116
|
+
(L) => L.id === m
|
|
1117
|
+
)) == null ? void 0 : B.name, R = Fe(
|
|
1118
|
+
E,
|
|
1119
|
+
te(c || ""),
|
|
1120
|
+
te(o),
|
|
1121
|
+
O || "",
|
|
1122
|
+
S,
|
|
1123
|
+
d || ""
|
|
1124
|
+
);
|
|
1125
|
+
R && (w(R), h(!0));
|
|
1126
|
+
} else if (!s) {
|
|
1127
|
+
if (Qe(b.data_type))
|
|
1128
|
+
if (a && a.length > 0) {
|
|
1129
|
+
const E = {
|
|
1130
|
+
...b,
|
|
1131
|
+
role: "groupby",
|
|
1132
|
+
id: ee(b.column_name),
|
|
1133
|
+
name: b.column_name,
|
|
1134
|
+
type: b.data_type
|
|
1135
|
+
};
|
|
1136
|
+
v(E);
|
|
1137
|
+
} else {
|
|
1138
|
+
const E = {
|
|
1139
|
+
...b,
|
|
1140
|
+
role: "metric",
|
|
1141
|
+
id: ee(b.column_name),
|
|
1142
|
+
name: b.column_name,
|
|
1143
|
+
label: he(b.column_name, "COUNT"),
|
|
1144
|
+
type: b.data_type,
|
|
1145
|
+
aggregate: "COUNT"
|
|
1146
|
+
};
|
|
1147
|
+
g(E);
|
|
1148
|
+
}
|
|
1149
|
+
if (ze(b.data_type)) {
|
|
1150
|
+
const E = {
|
|
1151
|
+
...b,
|
|
1152
|
+
role: "groupby",
|
|
1153
|
+
id: ee(b.column_name),
|
|
1154
|
+
name: b.column_name,
|
|
1155
|
+
type: b.data_type,
|
|
1156
|
+
label: Rt(b.column_name, "month"),
|
|
1157
|
+
granularity: "month"
|
|
1158
|
+
};
|
|
1159
|
+
v(E);
|
|
1160
|
+
}
|
|
1161
|
+
if (ce(b.data_type)) {
|
|
1162
|
+
const E = {
|
|
1163
|
+
...b,
|
|
1164
|
+
role: "metric",
|
|
1165
|
+
id: ee(b.column_name),
|
|
1166
|
+
name: b.column_name,
|
|
1167
|
+
label: he(b.column_name, "SUM"),
|
|
1168
|
+
type: b.data_type,
|
|
1169
|
+
aggregate: "SUM"
|
|
1170
|
+
};
|
|
1171
|
+
g(E);
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
},
|
|
1175
|
+
handleShowSample: () => {
|
|
1176
|
+
if (!u || !o) {
|
|
1177
|
+
console.warn("Cannot generate SQL: missing table metadata");
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
const N = de({
|
|
1181
|
+
schemaName: c || "",
|
|
1182
|
+
tableName: o,
|
|
1183
|
+
modelName: x,
|
|
1184
|
+
connectionType: S,
|
|
1185
|
+
databaseName: d || ""
|
|
1186
|
+
});
|
|
1187
|
+
p(!1);
|
|
1188
|
+
const b = S === "MSSQL" ? `SELECT top 10 * FROM ${N}` : `SELECT * FROM ${N} LIMIT 10`;
|
|
1189
|
+
w(b), h(!0);
|
|
1190
|
+
},
|
|
1191
|
+
handleShowCount: () => {
|
|
1192
|
+
if (!u || !o) {
|
|
1193
|
+
console.warn("Cannot generate SQL: missing table metadata");
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
const N = de({
|
|
1197
|
+
schemaName: c || "",
|
|
1198
|
+
tableName: o,
|
|
1199
|
+
modelName: x,
|
|
1200
|
+
connectionType: S,
|
|
1201
|
+
databaseName: d || ""
|
|
1202
|
+
});
|
|
1203
|
+
w(`SELECT COUNT(*) as count FROM ${N}`), h(!0);
|
|
1204
|
+
},
|
|
1205
|
+
isNumberField: (N) => ce(N.dataType)
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
function jt({ column: e }) {
|
|
1209
|
+
const [s, t] = G(!1), a = y((x) => x.card.dataSource), { tableName: o, schemaName: c, databaseName: d } = ie(a), u = y(
|
|
1210
|
+
(x) => x.selectedDatamodelId
|
|
1211
|
+
), m = y((x) => x.sqlGen), { modelItems: g, connectionType: v } = Se(), w = y((x) => x.actions.setSqlGen), h = y((x) => x.actions.setCardSql), n = y((x) => x.actions.setRunSql), p = Ae(a);
|
|
1212
|
+
function S(x, q) {
|
|
1213
|
+
var N;
|
|
1214
|
+
if (!p || !o) {
|
|
1215
|
+
console.warn("Cannot generate SQL: missing table metadata");
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
const D = xe(x, m, q), j = (N = g == null ? void 0 : g.find(
|
|
1219
|
+
(b) => b.id === u
|
|
1220
|
+
)) == null ? void 0 : N.name;
|
|
1221
|
+
w(D);
|
|
1222
|
+
const U = Fe(
|
|
1223
|
+
D,
|
|
1224
|
+
te(c || ""),
|
|
1225
|
+
te(o),
|
|
1226
|
+
j || "",
|
|
1227
|
+
v,
|
|
1228
|
+
d || ""
|
|
1229
|
+
);
|
|
1230
|
+
U && (h(U), n(!0)), t(!1);
|
|
1231
|
+
}
|
|
1232
|
+
function T() {
|
|
1233
|
+
return /* @__PURE__ */ C("ul", { className: "text-xs", children: [
|
|
1234
|
+
/* @__PURE__ */ i(
|
|
1235
|
+
"li",
|
|
1236
|
+
{
|
|
1237
|
+
onClick: () => S(e, "COUNT"),
|
|
1238
|
+
className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
|
|
1239
|
+
children: "Count"
|
|
1240
|
+
}
|
|
1241
|
+
),
|
|
1242
|
+
/* @__PURE__ */ i(
|
|
1243
|
+
"li",
|
|
1244
|
+
{
|
|
1245
|
+
onClick: () => S(e, "AVG"),
|
|
1246
|
+
className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
|
|
1247
|
+
children: "Avg"
|
|
1248
|
+
}
|
|
1249
|
+
),
|
|
1250
|
+
/* @__PURE__ */ i(
|
|
1251
|
+
"li",
|
|
1252
|
+
{
|
|
1253
|
+
onClick: () => S(e, "SUM"),
|
|
1254
|
+
className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
|
|
1255
|
+
children: "Sum"
|
|
1256
|
+
}
|
|
1257
|
+
),
|
|
1258
|
+
/* @__PURE__ */ i(
|
|
1259
|
+
"li",
|
|
1260
|
+
{
|
|
1261
|
+
onClick: () => S(e, "MAX"),
|
|
1262
|
+
className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
|
|
1263
|
+
children: "Max"
|
|
1264
|
+
}
|
|
1265
|
+
),
|
|
1266
|
+
/* @__PURE__ */ i(
|
|
1267
|
+
"li",
|
|
1268
|
+
{
|
|
1269
|
+
onClick: () => S(e, "MIN"),
|
|
1270
|
+
className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
|
|
1271
|
+
children: "Min"
|
|
1272
|
+
}
|
|
1273
|
+
)
|
|
1274
|
+
] });
|
|
1275
|
+
}
|
|
1276
|
+
return p ? /* @__PURE__ */ C(Pe, { openDelay: 0, open: s, onOpenChange: t, children: [
|
|
1277
|
+
/* @__PURE__ */ i(Ke, { asChild: !0, children: /* @__PURE__ */ i(We, { className: "invisible size-3.5 cursor-pointer text-foreground/40 group-hover/container:visible" }) }),
|
|
1278
|
+
/* @__PURE__ */ i(
|
|
1279
|
+
He,
|
|
1280
|
+
{
|
|
1281
|
+
align: "center",
|
|
1282
|
+
className: "w-20 rounded-md p-0 shadow-none",
|
|
1283
|
+
children: T()
|
|
1284
|
+
}
|
|
1285
|
+
)
|
|
1286
|
+
] }) : null;
|
|
1287
|
+
}
|
|
1288
|
+
function Qt({
|
|
1289
|
+
field: e,
|
|
1290
|
+
fieldState: s
|
|
1291
|
+
}) {
|
|
1292
|
+
return /* @__PURE__ */ C("div", { className: "w-64 bg-background p-0", children: [
|
|
1293
|
+
/* @__PURE__ */ C("div", { className: "mb-2 flex items-start justify-between gap-2", children: [
|
|
1294
|
+
/* @__PURE__ */ i("h3", { className: "text-sm font-medium text-foreground", children: e.label || e.name }),
|
|
1295
|
+
/* @__PURE__ */ i("span", { className: "rounded bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground", children: e.dataType })
|
|
1296
|
+
] }),
|
|
1297
|
+
e.description && /* @__PURE__ */ i("p", { className: "mb-3 text-xs text-muted-foreground", children: e.description }),
|
|
1298
|
+
s && s.tooltip && /* @__PURE__ */ i("div", { className: "mb-2 rounded bg-muted/50 p-2", children: /* @__PURE__ */ i("p", { className: "text-xs text-muted-foreground", children: s.tooltip }) }),
|
|
1299
|
+
/* @__PURE__ */ i("div", { className: "overflow-x-auto border-t border-border pb-2 pt-2", children: /* @__PURE__ */ i("span", { className: "font-mono text-xs text-muted-foreground", children: e.name }) })
|
|
1300
|
+
] });
|
|
1301
|
+
}
|
|
1302
|
+
function zt({
|
|
1303
|
+
field: e,
|
|
1304
|
+
context: s = "editor",
|
|
1305
|
+
fieldState: t
|
|
1306
|
+
}) {
|
|
1307
|
+
const a = y((I) => I.isDevMode), o = s === "filter", c = a || o || (t == null ? void 0 : t.state) === "unreachable" && !o, d = Q((I) => I.dashboard.filters), u = Q((I) => I.selectedSheetId), m = Q((I) => I.actions.removeFilter), { removeFilterValues: g } = Y(), { assignFilter: v } = Bt(), w = o ? Je(d, u) : d, h = o ? w == null ? void 0 : w.find(
|
|
1308
|
+
(I) => {
|
|
1309
|
+
var K;
|
|
1310
|
+
return I.title === e.name || ((K = I.column) == null ? void 0 : K.includes(e.name));
|
|
1311
|
+
}
|
|
1312
|
+
) : void 0, n = !!h, p = h && o ? d == null ? void 0 : d.find((I) => I.id === h.id) : void 0, S = p && (p.applyToSheetIds && p.applyToSheetIds.length > 1 || p.excludeSheetIds && p.excludeSheetIds.length > 0 || !p.applyToSheetIds && !p.excludeSheetIds && !p.sheetId);
|
|
1313
|
+
o && n && console.log("[SourceField Debug]", {
|
|
1314
|
+
fieldName: e.name,
|
|
1315
|
+
hasActiveFilter: n,
|
|
1316
|
+
activeFilterOnSheet: h ? {
|
|
1317
|
+
id: h.id,
|
|
1318
|
+
title: h.title,
|
|
1319
|
+
column: h.column,
|
|
1320
|
+
applyToSheetIds: h.applyToSheetIds,
|
|
1321
|
+
excludeSheetIds: h.excludeSheetIds
|
|
1322
|
+
} : null,
|
|
1323
|
+
activeFilterForField: p ? {
|
|
1324
|
+
id: p.id,
|
|
1325
|
+
title: p.title,
|
|
1326
|
+
column: p.column,
|
|
1327
|
+
applyToSheetIds: p.applyToSheetIds,
|
|
1328
|
+
excludeSheetIds: p.excludeSheetIds
|
|
1329
|
+
} : null,
|
|
1330
|
+
isMultiSheetFilter: S,
|
|
1331
|
+
selectedSheetId: u
|
|
1332
|
+
});
|
|
1333
|
+
const [T, x] = G(!1), [q, D] = G(null), {
|
|
1334
|
+
attributes: j,
|
|
1335
|
+
listeners: U,
|
|
1336
|
+
setNodeRef: N,
|
|
1337
|
+
transform: b,
|
|
1338
|
+
transition: B,
|
|
1339
|
+
isDragging: E
|
|
1340
|
+
} = Xe({
|
|
1341
|
+
id: e.id,
|
|
1342
|
+
disabled: c
|
|
1343
|
+
}), [O, R] = G(!1), L = y((I) => I.card), { handleFieldClick: z } = Gt(L), { handleDevModeFieldClick: l, isNumberField: r } = Be(), F = () => {
|
|
1344
|
+
p && (console.log("[SourceField] Removing multi-sheet filter:", p.id), g(p.id), m(p.id)), D(null), x(!1);
|
|
1345
|
+
}, f = () => {
|
|
1346
|
+
if (o) {
|
|
1347
|
+
const I = {
|
|
1348
|
+
column_name: e.name,
|
|
1349
|
+
data_type: e.dataType,
|
|
1350
|
+
label: e.label,
|
|
1351
|
+
description: e.description
|
|
1352
|
+
};
|
|
1353
|
+
console.log("[SourceField Click]", {
|
|
1354
|
+
fieldName: e.name,
|
|
1355
|
+
hasActiveFilter: n,
|
|
1356
|
+
isMultiSheetFilter: S,
|
|
1357
|
+
willShowWarning: n && S
|
|
1358
|
+
}), n && S ? (console.log("[SourceField] Showing warning dialog for multi-sheet filter"), D({ column: I, field: e }), x(!0)) : (console.log("[SourceField] Calling assignFilter directly (single-sheet or new filter)"), v(I, "sheet", e));
|
|
1359
|
+
} else a ? l(e) : z(e);
|
|
1360
|
+
}, k = {
|
|
1361
|
+
column_name: e.name,
|
|
1362
|
+
data_type: e.dataType,
|
|
1363
|
+
label: e.label,
|
|
1364
|
+
description: e.description
|
|
1365
|
+
}, M = {
|
|
1366
|
+
transform: Ye.Transform.toString(b),
|
|
1367
|
+
transition: B
|
|
1368
|
+
}, _ = (() => {
|
|
1369
|
+
if (!t || o) return {};
|
|
1370
|
+
const K = {
|
|
1371
|
+
base: {
|
|
1372
|
+
hoverBorderColor: "hover:border-blue-500/40",
|
|
1373
|
+
hoverBgColor: "hover:bg-blue-50/50 dark:hover:bg-blue-950/20"
|
|
1374
|
+
},
|
|
1375
|
+
draggable: {
|
|
1376
|
+
hoverBorderColor: "hover:border-green-500/40",
|
|
1377
|
+
hoverBgColor: "hover:bg-green-50/30 dark:hover:bg-green-950/20"
|
|
1378
|
+
},
|
|
1379
|
+
indirect: {
|
|
1380
|
+
hoverBorderColor: "hover:border-yellow-500/40",
|
|
1381
|
+
hoverBgColor: "hover:bg-yellow-50/30 dark:hover:bg-yellow-950/20"
|
|
1382
|
+
},
|
|
1383
|
+
unreachable: {
|
|
1384
|
+
// Unreachable fields show gray treatment always (not just on hover)
|
|
1385
|
+
borderColor: "border-gray-300/40 dark:border-gray-700/40",
|
|
1386
|
+
bgColor: "bg-gray-50/30 dark:bg-gray-900/20",
|
|
1387
|
+
hoverBgColor: "hover:bg-gray-100/30 dark:hover:bg-gray-800/20",
|
|
1388
|
+
opacity: "opacity-50",
|
|
1389
|
+
cursor: "cursor-not-allowed"
|
|
1390
|
+
}
|
|
1391
|
+
}[t.state] || {};
|
|
1392
|
+
return t.isSelected && {
|
|
1393
|
+
base: {
|
|
1394
|
+
borderColor: "border-blue-300/30 dark:border-blue-700/30",
|
|
1395
|
+
bgColor: "bg-blue-50/20 dark:bg-blue-950/10",
|
|
1396
|
+
...K
|
|
1397
|
+
},
|
|
1398
|
+
draggable: {
|
|
1399
|
+
borderColor: "border-green-300/30 dark:border-green-700/30",
|
|
1400
|
+
bgColor: "bg-green-50/20 dark:bg-green-950/10",
|
|
1401
|
+
...K
|
|
1402
|
+
},
|
|
1403
|
+
indirect: {
|
|
1404
|
+
borderColor: "border-yellow-300/30 dark:border-yellow-700/30",
|
|
1405
|
+
bgColor: "bg-yellow-50/20 dark:bg-yellow-950/10",
|
|
1406
|
+
...K
|
|
1407
|
+
}
|
|
1408
|
+
}[t.state] || K;
|
|
1409
|
+
})();
|
|
1410
|
+
return /* @__PURE__ */ C(
|
|
1411
|
+
"div",
|
|
1412
|
+
{
|
|
1413
|
+
ref: N,
|
|
1414
|
+
style: M,
|
|
1415
|
+
...c ? {} : j,
|
|
1416
|
+
...c ? {} : U,
|
|
1417
|
+
className: J(
|
|
1418
|
+
"group/container max-w-[265px] overflow-hidden rounded-lg transition-all",
|
|
1419
|
+
E && "scale-95 opacity-50",
|
|
1420
|
+
!E && "border",
|
|
1421
|
+
// Default: plain border and background (clean UI)
|
|
1422
|
+
_.borderColor || "border-transparent",
|
|
1423
|
+
_.bgColor || "",
|
|
1424
|
+
// Hover: show state-specific colors
|
|
1425
|
+
_.hoverBorderColor,
|
|
1426
|
+
_.hoverBgColor || "hover:bg-muted",
|
|
1427
|
+
// Unreachable field states (always visible)
|
|
1428
|
+
_.opacity,
|
|
1429
|
+
_.cursor,
|
|
1430
|
+
// Active filter highlighting
|
|
1431
|
+
n && "bg-accent border-accent-foreground/20",
|
|
1432
|
+
// Cursor styling
|
|
1433
|
+
{
|
|
1434
|
+
"cursor-pointer": a || o,
|
|
1435
|
+
"cursor-grab active:cursor-grabbing": !c && !a && !o
|
|
1436
|
+
}
|
|
1437
|
+
),
|
|
1438
|
+
title: t == null ? void 0 : t.tooltip,
|
|
1439
|
+
children: [
|
|
1440
|
+
/* @__PURE__ */ C(
|
|
1441
|
+
"div",
|
|
1442
|
+
{
|
|
1443
|
+
className: "flex min-w-0 items-center gap-3 p-2",
|
|
1444
|
+
onClick: f,
|
|
1445
|
+
children: [
|
|
1446
|
+
Ze(e.dataType),
|
|
1447
|
+
/* @__PURE__ */ i(et, { children: /* @__PURE__ */ C(tt, { children: [
|
|
1448
|
+
/* @__PURE__ */ i(at, { asChild: !0, children: /* @__PURE__ */ i("div", { className: "min-w-0 flex-1 overflow-hidden", children: /* @__PURE__ */ i(
|
|
1449
|
+
"span",
|
|
1450
|
+
{
|
|
1451
|
+
className: `block text-sm text-foreground/80 hover:text-foreground dark:text-muted-foreground ${O ? "whitespace-normal break-words" : "truncate"}`,
|
|
1452
|
+
children: e.label || e.name
|
|
1453
|
+
}
|
|
1454
|
+
) }) }),
|
|
1455
|
+
/* @__PURE__ */ i(
|
|
1456
|
+
st,
|
|
1457
|
+
{
|
|
1458
|
+
side: "bottom",
|
|
1459
|
+
align: "start",
|
|
1460
|
+
className: "ml-5 max-w-xs px-4 pb-2 pt-4",
|
|
1461
|
+
children: /* @__PURE__ */ i(Qt, { field: e, fieldState: t })
|
|
1462
|
+
}
|
|
1463
|
+
)
|
|
1464
|
+
] }) }),
|
|
1465
|
+
a && !o && r(e) && /* @__PURE__ */ i("div", { onClick: (I) => I.stopPropagation(), children: /* @__PURE__ */ i(jt, { column: k }) })
|
|
1466
|
+
]
|
|
1467
|
+
}
|
|
1468
|
+
),
|
|
1469
|
+
O && // <div className="px-2 pb-3 text-sm text-gray-600">
|
|
1470
|
+
// <div className="break-all rounded bg-gray-50 p-2">
|
|
1471
|
+
// <p>
|
|
1472
|
+
// <span className="font-medium">Label:</span>{' '}
|
|
1473
|
+
// {field.label || field.name}
|
|
1474
|
+
// </p>
|
|
1475
|
+
// <p>
|
|
1476
|
+
// <span className="font-medium">Name:</span> {field.name}
|
|
1477
|
+
// </p>
|
|
1478
|
+
// <p>
|
|
1479
|
+
// <span className="font-medium">Full name:</span>{' '}
|
|
1480
|
+
// {field.qualifiedEntityName
|
|
1481
|
+
// ? `${field.qualifiedEntityName}.${field.name}`
|
|
1482
|
+
// : field.name}
|
|
1483
|
+
// </p>
|
|
1484
|
+
// <Badge variant="outline" className="text-xs">
|
|
1485
|
+
// {field.dataType}
|
|
1486
|
+
// </Badge>
|
|
1487
|
+
// </div>
|
|
1488
|
+
// </div>
|
|
1489
|
+
/* @__PURE__ */ i("div", { className: "text-muted-foreground-700 px-2 pb-3 text-sm", children: /* @__PURE__ */ i(nt, { className: "", children: /* @__PURE__ */ C(rt, { className: "space-y-2 p-3", children: [
|
|
1490
|
+
/* @__PURE__ */ C("div", { className: "flex items-center gap-2", children: [
|
|
1491
|
+
/* @__PURE__ */ i(Dt, { className: "h-4 w-4 text-muted-foreground" }),
|
|
1492
|
+
/* @__PURE__ */ i("span", { className: "break-all", children: e.label || e.name })
|
|
1493
|
+
] }),
|
|
1494
|
+
/* @__PURE__ */ C("div", { className: "flex items-center gap-2", children: [
|
|
1495
|
+
/* @__PURE__ */ i(Mt, { className: "h-4 w-4 text-muted-foreground" }),
|
|
1496
|
+
/* @__PURE__ */ i("span", { className: "break-all", children: e.name })
|
|
1497
|
+
] }),
|
|
1498
|
+
/* @__PURE__ */ i(we, { variant: "outline", className: "mt-2 text-xs", children: e.dataType })
|
|
1499
|
+
] }) }) }),
|
|
1500
|
+
/* @__PURE__ */ i(ot, { open: T, onOpenChange: x, children: /* @__PURE__ */ C(lt, { children: [
|
|
1501
|
+
/* @__PURE__ */ C(it, { children: [
|
|
1502
|
+
/* @__PURE__ */ i(ct, { children: "Remove Filter from Multiple Sheets?" }),
|
|
1503
|
+
/* @__PURE__ */ i(dt, { children: "This filter is currently applied to multiple sheets. Removing it will affect all sheets where it's applied." })
|
|
1504
|
+
] }),
|
|
1505
|
+
/* @__PURE__ */ C(ut, { children: [
|
|
1506
|
+
/* @__PURE__ */ i(mt, { children: "Cancel" }),
|
|
1507
|
+
/* @__PURE__ */ i(pt, { onClick: F, children: "Remove Filter" })
|
|
1508
|
+
] })
|
|
1509
|
+
] }) })
|
|
1510
|
+
]
|
|
1511
|
+
}
|
|
1512
|
+
);
|
|
1513
|
+
}
|
|
1514
|
+
function Pt({ context: e = "editor" } = {}) {
|
|
1515
|
+
var O, R, L, z;
|
|
1516
|
+
const [s, t] = G(""), [a, o] = G("all");
|
|
1517
|
+
y((l) => l.isDevMode);
|
|
1518
|
+
const c = y((l) => l.card.dataSource), d = y((l) => l.card.config), u = y((l) => l.card), { autoJoinMetadata: m } = oe(u), {
|
|
1519
|
+
columns: g = [],
|
|
1520
|
+
columnGroups: v = [],
|
|
1521
|
+
isLoading: w,
|
|
1522
|
+
error: h
|
|
1523
|
+
} = ht(), n = (c == null ? void 0 : c.mode) === "semanticDomain" ? c.semanticDomainId : void 0, { data: p } = Ee(n), S = [
|
|
1524
|
+
...(d == null ? void 0 : d.groupByColumns) || [],
|
|
1525
|
+
...(d == null ? void 0 : d.metricColumns) || []
|
|
1526
|
+
];
|
|
1527
|
+
(R = (O = d == null ? void 0 : d.joinPlan) == null ? void 0 : O.baseEntity) == null || R.name, (z = (L = m == null ? void 0 : m.resolvedJoinPlan) == null ? void 0 : L.baseEntity) == null || z.name, Be();
|
|
1528
|
+
const T = g.filter(
|
|
1529
|
+
(l) => l.name.toLowerCase().includes(s.toLowerCase()) || l.dataType.toLowerCase().includes(s.toLowerCase()) || l.label && l.label.toLowerCase().includes(s.toLowerCase()) || l.qualifiedEntityName && l.qualifiedEntityName.toLowerCase().includes(s.toLowerCase())
|
|
1530
|
+
), x = (l) => {
|
|
1531
|
+
if (l.dataType === "number" || l.dataType === "integer" || l.dataType === "float" || l.dataType === "decimal" || l.dataType === "currency")
|
|
1532
|
+
return "metrics";
|
|
1533
|
+
const r = Ne(l.dataType);
|
|
1534
|
+
return ["date", "string", "boolean"].includes(r) ? "dimensions" : r === "number" ? "metrics" : "dimensions";
|
|
1535
|
+
}, D = (a === "all" ? T : T.filter(
|
|
1536
|
+
(l) => x(l) === a
|
|
1537
|
+
)).reduce((l, r) => {
|
|
1538
|
+
const F = r.qualifiedEntityName || "Other Fields";
|
|
1539
|
+
return l[F] || (l[F] = {
|
|
1540
|
+
label: ft(r.entityName),
|
|
1541
|
+
fields: []
|
|
1542
|
+
}), l[F].fields.push(r), l;
|
|
1543
|
+
}, {}), U = Object.keys(D), N = T.filter(
|
|
1544
|
+
(l) => x(l) === "dimensions"
|
|
1545
|
+
).length, b = T.filter(
|
|
1546
|
+
(l) => x(l) === "metrics"
|
|
1547
|
+
).length, B = T.filter(
|
|
1548
|
+
(l) => x(l) === "calculated"
|
|
1549
|
+
).length, E = T.length > 0;
|
|
1550
|
+
return w ? /* @__PURE__ */ i("div", { className: "flex h-full w-[290px] flex-col items-center justify-center", children: /* @__PURE__ */ i(gt, { size: "md", color: "muted", "aria-label": "Loading data" }) }) : h ? /* @__PURE__ */ C("div", { className: "flex h-full w-[290px] flex-col items-center justify-center", children: [
|
|
1551
|
+
/* @__PURE__ */ i(ue, { className: "mb-4 h-12 w-12 text-red-300" }),
|
|
1552
|
+
/* @__PURE__ */ i("p", { className: "mb-2 text-sm text-red-500", children: "Error loading fields" }),
|
|
1553
|
+
/* @__PURE__ */ i("p", { className: "px-4 text-center text-xs text-red-400", children: h.message || "Failed to load column data" })
|
|
1554
|
+
] }) : !c || !c.selectedEntities || c.selectedEntities.length === 0 ? /* @__PURE__ */ i(yt, { className: "h-[calc(100vh-200px)] w-[290px]", children: /* @__PURE__ */ C("div", { className: "flex flex-col items-center justify-center py-8 text-center", children: [
|
|
1555
|
+
/* @__PURE__ */ i(ue, { className: "mb-4 h-12 w-12 text-gray-300" }),
|
|
1556
|
+
/* @__PURE__ */ i("p", { className: "mb-2 text-sm text-gray-500", children: "No data source selected" }),
|
|
1557
|
+
/* @__PURE__ */ i("p", { className: "px-4 text-xs text-gray-400", children: e === "filter" ? "Configure a data source for this card to see available fields" : "Select a table, view, or dataset from the data source panel to see available fields" })
|
|
1558
|
+
] }) }) : /* @__PURE__ */ C("div", { className: "mt-2 flex h-full w-full grow flex-col gap-2 px-6 pb-6", children: [
|
|
1559
|
+
/* @__PURE__ */ C("div", { className: "mt-1 flex-shrink-0 space-y-2", children: [
|
|
1560
|
+
g.length > 0 && /* @__PURE__ */ C("div", { className: "relative mb-4", children: [
|
|
1561
|
+
/* @__PURE__ */ i(bt, { className: "absolute left-3 top-1/2 size-3.5 -translate-y-1/2 transform text-muted-foreground" }),
|
|
1562
|
+
/* @__PURE__ */ i(
|
|
1563
|
+
Ct,
|
|
1564
|
+
{
|
|
1565
|
+
className: "pl-10 pr-10",
|
|
1566
|
+
type: "text",
|
|
1567
|
+
placeholder: "Search fields...",
|
|
1568
|
+
value: s,
|
|
1569
|
+
onChange: (l) => t(l.target.value)
|
|
1570
|
+
}
|
|
1571
|
+
),
|
|
1572
|
+
s && /* @__PURE__ */ i(
|
|
1573
|
+
"button",
|
|
1574
|
+
{
|
|
1575
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 transform text-muted-foreground hover:text-foreground",
|
|
1576
|
+
onClick: () => t(""),
|
|
1577
|
+
type: "button",
|
|
1578
|
+
children: /* @__PURE__ */ i(Ce, { className: "size-3.5" })
|
|
1579
|
+
}
|
|
1580
|
+
)
|
|
1581
|
+
] }),
|
|
1582
|
+
E && /* @__PURE__ */ i(
|
|
1583
|
+
Nt,
|
|
1584
|
+
{
|
|
1585
|
+
defaultValue: "all",
|
|
1586
|
+
value: a,
|
|
1587
|
+
onValueChange: (l) => o(l),
|
|
1588
|
+
className: "mb-4",
|
|
1589
|
+
children: /* @__PURE__ */ C(vt, { className: "grid h-9 w-full grid-cols-4", children: [
|
|
1590
|
+
/* @__PURE__ */ C(Z, { value: "all", className: "text-xs", children: [
|
|
1591
|
+
"All",
|
|
1592
|
+
/* @__PURE__ */ i("span", { className: "ml-2 text-xs font-semibold", children: T.length })
|
|
1593
|
+
] }),
|
|
1594
|
+
/* @__PURE__ */ C(Z, { value: "dimensions", className: "text-xs", children: [
|
|
1595
|
+
/* @__PURE__ */ i(St, { className: "size-4 shrink-0" }),
|
|
1596
|
+
/* @__PURE__ */ i("span", { className: "ml-2 text-xs font-semibold", children: N })
|
|
1597
|
+
] }),
|
|
1598
|
+
/* @__PURE__ */ C(Z, { value: "metrics", className: "text-xs", children: [
|
|
1599
|
+
/* @__PURE__ */ i(xt, { className: "size-4 shrink-0" }),
|
|
1600
|
+
/* @__PURE__ */ i("span", { className: "ml-2 text-xs font-semibold", children: b })
|
|
1601
|
+
] }),
|
|
1602
|
+
/* @__PURE__ */ C(Z, { value: "calculated", className: "text-xs", children: [
|
|
1603
|
+
/* @__PURE__ */ i(Ft, { className: "size-4 shrink-0" }),
|
|
1604
|
+
/* @__PURE__ */ i("span", { className: "ml-2 text-xs font-semibold", children: B })
|
|
1605
|
+
] })
|
|
1606
|
+
] })
|
|
1607
|
+
}
|
|
1608
|
+
)
|
|
1609
|
+
] }),
|
|
1610
|
+
/* @__PURE__ */ C(wt, { className: "py-2", children: [
|
|
1611
|
+
/* @__PURE__ */ i(
|
|
1612
|
+
Tt,
|
|
1613
|
+
{
|
|
1614
|
+
type: "multiple",
|
|
1615
|
+
defaultValue: U,
|
|
1616
|
+
className: "space-y-2",
|
|
1617
|
+
children: Object.entries(D).map(([l, r]) => {
|
|
1618
|
+
const F = v.find((f) => f.entityName === l) || {
|
|
1619
|
+
entityName: l,
|
|
1620
|
+
label: r.label
|
|
1621
|
+
};
|
|
1622
|
+
return /* @__PURE__ */ C(
|
|
1623
|
+
It,
|
|
1624
|
+
{
|
|
1625
|
+
value: l,
|
|
1626
|
+
className: "border-none",
|
|
1627
|
+
children: [
|
|
1628
|
+
/* @__PURE__ */ i(kt, { className: "group rounded-md px-2.5 py-2 text-muted-foreground hover:bg-muted hover:no-underline", children: /* @__PURE__ */ C(
|
|
1629
|
+
"div",
|
|
1630
|
+
{
|
|
1631
|
+
title: F.label || F.entityName,
|
|
1632
|
+
className: "flex items-center gap-2",
|
|
1633
|
+
children: [
|
|
1634
|
+
/* @__PURE__ */ i("span", { className: "max-w-[190px] truncate text-ellipsis whitespace-nowrap text-sm font-medium text-primary", children: F.label || F.entityName }),
|
|
1635
|
+
/* @__PURE__ */ i(
|
|
1636
|
+
we,
|
|
1637
|
+
{
|
|
1638
|
+
variant: "secondary",
|
|
1639
|
+
className: "rounded-full text-xs text-muted-foreground group-hover:bg-background",
|
|
1640
|
+
children: r.fields.length
|
|
1641
|
+
}
|
|
1642
|
+
)
|
|
1643
|
+
]
|
|
1644
|
+
}
|
|
1645
|
+
) }),
|
|
1646
|
+
/* @__PURE__ */ i(Et, { className: "pb-2", children: /* @__PURE__ */ i("div", { className: "space-y-1", children: r.fields.map((f) => {
|
|
1647
|
+
const k = At(f, {
|
|
1648
|
+
joinabilityMap: (p == null ? void 0 : p.joinabilityMap) || null,
|
|
1649
|
+
selectedFields: S,
|
|
1650
|
+
cardConfig: d,
|
|
1651
|
+
// Manual join plan (user-configured)
|
|
1652
|
+
autoJoinMetadata: m
|
|
1653
|
+
// Auto-resolved join plan (backend semantic relationships)
|
|
1654
|
+
});
|
|
1655
|
+
return /* @__PURE__ */ i(
|
|
1656
|
+
zt,
|
|
1657
|
+
{
|
|
1658
|
+
field: f,
|
|
1659
|
+
context: e,
|
|
1660
|
+
fieldState: k
|
|
1661
|
+
},
|
|
1662
|
+
f.id
|
|
1663
|
+
);
|
|
1664
|
+
}) }) })
|
|
1665
|
+
]
|
|
1666
|
+
},
|
|
1667
|
+
l
|
|
1668
|
+
);
|
|
1669
|
+
})
|
|
1670
|
+
}
|
|
1671
|
+
),
|
|
1672
|
+
Object.keys(D).length === 0 && g.length === 0 && /* @__PURE__ */ C("div", { className: "py-8 text-center text-sm text-gray-500", children: [
|
|
1673
|
+
/* @__PURE__ */ i("p", { children: "No fields found for selected data source" }),
|
|
1674
|
+
/* @__PURE__ */ i("p", { className: "mt-1 text-xs text-gray-400", children: e === "filter" ? "The selected data source has no available fields" : "Try selecting different data sources" })
|
|
1675
|
+
] }),
|
|
1676
|
+
Object.keys(D).length === 0 && g.length > 0 && /* @__PURE__ */ i("div", { className: "py-4 text-center text-sm text-gray-500", children: "No fields found for this category" }),
|
|
1677
|
+
/* @__PURE__ */ i(me, { orientation: "horizontal" }),
|
|
1678
|
+
/* @__PURE__ */ i(me, { orientation: "vertical" })
|
|
1679
|
+
] })
|
|
1680
|
+
] });
|
|
1681
|
+
}
|
|
1682
|
+
function la({ context: e = "editor" } = {}) {
|
|
1683
|
+
return /* @__PURE__ */ C(
|
|
1684
|
+
"div",
|
|
1685
|
+
{
|
|
1686
|
+
"data-content": "fields-section",
|
|
1687
|
+
className: "flex h-full grow flex-col items-center overflow-hidden",
|
|
1688
|
+
children: [
|
|
1689
|
+
" ",
|
|
1690
|
+
/* @__PURE__ */ i(Pt, { context: e }),
|
|
1691
|
+
" "
|
|
1692
|
+
]
|
|
1693
|
+
}
|
|
1694
|
+
);
|
|
1695
|
+
}
|
|
1696
|
+
function ia() {
|
|
1697
|
+
const e = y((d) => d.card.dataSource), {
|
|
1698
|
+
setSelectedConnectionId: s,
|
|
1699
|
+
setSelectedDatabaseName: t,
|
|
1700
|
+
setSelectedSchemaName: a,
|
|
1701
|
+
setSelectedTableName: o,
|
|
1702
|
+
setSelectedDatamodelId: c
|
|
1703
|
+
} = P();
|
|
1704
|
+
ae(() => {
|
|
1705
|
+
var n;
|
|
1706
|
+
if (!e) return;
|
|
1707
|
+
const { tableName: d, schemaName: u, databaseName: m, connectionId: g } = ie(e), v = (n = e.selectedEntities) == null ? void 0 : n[0], h = (v == null ? void 0 : v.type) === "model" && "id" in v ? v.id : "";
|
|
1708
|
+
s(g || ""), t(m || ""), a(u || ""), o(d || ""), c(h);
|
|
1709
|
+
}, [
|
|
1710
|
+
e,
|
|
1711
|
+
s,
|
|
1712
|
+
t,
|
|
1713
|
+
a,
|
|
1714
|
+
o,
|
|
1715
|
+
c
|
|
1716
|
+
]);
|
|
1717
|
+
}
|
|
1718
|
+
function ca(e, s) {
|
|
1719
|
+
const [t, a] = G(() => {
|
|
1720
|
+
const o = localStorage.getItem(e);
|
|
1721
|
+
return o ? JSON.parse(o) : s;
|
|
1722
|
+
});
|
|
1723
|
+
return ae(() => {
|
|
1724
|
+
localStorage.setItem(e, JSON.stringify(t));
|
|
1725
|
+
}, [t, e]), [t, a];
|
|
1726
|
+
}
|
|
1727
|
+
export {
|
|
1728
|
+
ta as E,
|
|
1729
|
+
la as F,
|
|
1730
|
+
Te as S,
|
|
1731
|
+
na as V,
|
|
1732
|
+
aa as a,
|
|
1733
|
+
sa as b,
|
|
1734
|
+
ra as c,
|
|
1735
|
+
ia as d,
|
|
1736
|
+
ca as e,
|
|
1737
|
+
ea as f,
|
|
1738
|
+
oa as g,
|
|
1739
|
+
Ie as h,
|
|
1740
|
+
Gt as i,
|
|
1741
|
+
Ee as j,
|
|
1742
|
+
_t as k,
|
|
1743
|
+
se as u,
|
|
1744
|
+
$t as v
|
|
1745
|
+
};
|