react-semaphor 0.1.525 → 0.1.526
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/brand-studio/index.js +37 -37
- package/dist/briefings/index.js +3 -3
- package/dist/chunks/{calculated-field-identity-Dy_WpDdo.js → calculated-field-identity-D1ofR4KJ.js} +28 -28
- package/dist/chunks/{card-config-utils-CAyjC5Tp.js → card-config-utils-9sv4e-Vb.js} +15 -15
- package/dist/chunks/{switch-CWPcwAZ4.js → code-highlight-994tgM9v.js} +6309 -8642
- package/dist/chunks/dashboard-CsHvEtjN.js +15 -0
- package/dist/chunks/{dashboard-briefing-launcher-BilVIEyw.js → dashboard-briefing-launcher-DXz1GhFZ.js} +364 -370
- package/dist/chunks/{dashboard-controls-DyLPcvCK.js → dashboard-controls-Df8qOSrs.js} +163 -168
- package/dist/chunks/dashboard-json-Xldp0qww.js +65 -0
- package/dist/chunks/{edit-dashboard-visual-DtmKNNdE.js → edit-dashboard-visual-COHBqyic.js} +1108 -1107
- package/dist/chunks/editor-action-buttons-DahlP57T.js +2071 -0
- package/dist/chunks/{index-ON7Gpvcv.js → index-CbjuruKe.js} +40 -40
- package/dist/chunks/{matrix-control-sources-B1K7x0SL.js → matrix-control-sources-2VAzGlt8.js} +29 -29
- package/dist/chunks/pre-block-Cq1RqhZX.js +3987 -0
- package/dist/chunks/report-preferences-dialog-BcH-0lR-.js +1232 -0
- package/dist/chunks/search-CJz-QQ0Q.js +24 -0
- package/dist/chunks/{selection-reducer-CvCBQbl2.js → selection-reducer-NF5C07yM.js} +25 -46
- package/dist/chunks/{index-DYOaHuLS.js → semaphor-ready-indicator-BLRDuLr4.js} +142229 -147767
- package/dist/chunks/slider-BYIH4icg.js +877 -0
- package/dist/chunks/switch-XaAACBrJ.js +2234 -0
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.js +4 -4
- package/dist/data-app-builder/index.js +67 -67
- package/dist/data-app-sdk/index.js +33 -32
- package/dist/index.js +435 -243
- package/dist/surfboard/index.js +4 -5
- package/dist/types/components/dashboard/dashboard-container.d.ts +1 -1
- package/dist/types/components/dashboard/sheet/layout-change-guard.d.ts +1 -1
- package/dist/types/components/dashboard/sheet/sheet-layout.d.ts +1 -1
- package/dist/types/components/editor/editor-main/text-card.d.ts +1 -1
- package/dist/types/components/editor/editor.d.ts +1 -1
- package/dist/types/components/providers/semaphor-context-provider.d.ts +1 -1
- package/dist/types/components/providers/theme-provider-context.d.ts +1 -1
- package/dist/types/components/providers/theme-provider.d.ts +1 -1
- package/dist/types/components/shared/unsaved-changes/use-pristine-snapshot-initializer.d.ts +1 -1
- package/dist/types/components/surfboard/dashboard-plus.d.ts +1 -1
- package/dist/types/components/visual/column-display-utils.d.ts +1 -1
- package/dist/types/components/visual/kpi-visual/kpi-utils.d.ts +1 -1
- package/dist/types/components/visual/settings/color-format.d.ts +1 -1
- package/dist/types/components/visual/visual-utils.d.ts +1 -1
- package/dist/types/lib/actions/data-point-click-action.d.ts +2 -1
- package/dist/types/lib/dashboard/normalize-dashboard-for-dirty-check.d.ts +1 -1
- package/dist/types/lib/hooks/explorer/use-schemas.d.ts +1 -1
- package/dist/types/lib/hooks/use-dashboard.d.ts +2 -2
- package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +1 -2
- package/dist/types/lib/stores/editor-store.d.ts +1 -2
- package/dist/types/lib/stores/table-actions.d.ts +2 -1
- package/dist/types/lib/types/token-types.d.ts +0 -12
- package/dist/types/lib/utils.d.ts +0 -2
- package/package.json +2 -1
- package/dist/chunks/dashboard-json-QEoU-mx4.js +0 -75
- package/dist/chunks/editor-action-buttons-B9VRW3Bh.js +0 -2019
- package/dist/chunks/report-preferences-dialog-BLaFmlE2.js +0 -723
- package/dist/types/lib/encrypt-utils.d.ts +0 -9
|
@@ -1,2019 +0,0 @@
|
|
|
1
|
-
import { c as Ve, C as Qe, X as et } from "./x-CXDkqdur.js";
|
|
2
|
-
import { useState as K, useEffect as ie, useCallback as U, useMemo as oe, useRef as Se, Fragment as bt } from "react";
|
|
3
|
-
import { E as de, z as _e, u as J, a4 as j, D as z, Q as gt, V as yt, W as xt, c as fe, Y as vt, a5 as Ct, a6 as St, a7 as me, a8 as Re, a9 as Be, aa as ke, ab as Ne, ac as kt, ad as Nt, ae as $e, af as wt, ag as Dt, ah as pe, ai as Et, aj as We, B as q, ak as tt, al as at, am as rt, O as ne, Z as st, _ as we, $ as De, a0 as Ee, a1 as Te, a2 as Ie, an as nt, ao as Tt, ap as It, aq as He, ar as Ft, as as Ke, at as Vt, au as _t, av as At, aw as Lt, ax as Fe, d as qt, L as ot, ay as Mt } from "./switch-CWPcwAZ4.js";
|
|
4
|
-
import { b6 as Ot, b7 as zt, az as Ut, b8 as ce, b9 as jt, ba as Ae, bb as Qt, bc as Rt, bd as Bt, be as $t, bf as Wt, bg as Ht, bh as lt, bi as it, u as Kt, bj as Yt, bk as Gt, bl as Ye, bm as Pt, bn as Xt, bo as dt, bp as ct, bq as Jt, br as Zt, bs as ea, bt as ta, bu as aa, aY as ra, bv as sa, bw as ut, bx as na } from "./index-DYOaHuLS.js";
|
|
5
|
-
import { jsx as r, jsxs as p, Fragment as Z } from "react/jsx-runtime";
|
|
6
|
-
import "./card-config-utils-CAyjC5Tp.js";
|
|
7
|
-
import { t as oa } from "./validators-CsdOtZI6.js";
|
|
8
|
-
import "./matrix-operation-contract-D32U2CSw.js";
|
|
9
|
-
import "../value-format-preferences/index.js";
|
|
10
|
-
import { C as Ge } from "./selection-reducer-CvCBQbl2.js";
|
|
11
|
-
import { f as la } from "./index-ON7Gpvcv.js";
|
|
12
|
-
import { S as mt } from "./save-DgMfP0j8.js";
|
|
13
|
-
/**
|
|
14
|
-
* @license lucide-react v0.453.0 - ISC
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the ISC license.
|
|
17
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/
|
|
19
|
-
const Ma = Ve("FilterX", [
|
|
20
|
-
["path", { d: "M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055", key: "1fi1da" }],
|
|
21
|
-
["path", { d: "m22 3-5 5", key: "12jva0" }],
|
|
22
|
-
["path", { d: "m17 3 5 5", key: "k36vhe" }]
|
|
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 ia = Ve("Library", [
|
|
31
|
-
["path", { d: "m16 6 4 14", key: "ji33uf" }],
|
|
32
|
-
["path", { d: "M12 6v14", key: "1n7gus" }],
|
|
33
|
-
["path", { d: "M8 8v12", key: "1gg7y9" }],
|
|
34
|
-
["path", { d: "M4 4v16", key: "6qkkli" }]
|
|
35
|
-
]);
|
|
36
|
-
/**
|
|
37
|
-
* @license lucide-react v0.453.0 - ISC
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the ISC license.
|
|
40
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/
|
|
42
|
-
const da = Ve("Link2", [
|
|
43
|
-
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
44
|
-
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
45
|
-
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
46
|
-
]);
|
|
47
|
-
function ca(t) {
|
|
48
|
-
const [a, o] = K(null), [s, i] = K(null), c = Ot();
|
|
49
|
-
return ie(() => {
|
|
50
|
-
if (!t || t.trim() === "") {
|
|
51
|
-
o(null), i(null);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (!c)
|
|
55
|
-
return;
|
|
56
|
-
(async () => {
|
|
57
|
-
try {
|
|
58
|
-
if (!t.startsWith("http://") && !t.startsWith("https://"))
|
|
59
|
-
throw new Error(`Invalid URL format: ${t}`);
|
|
60
|
-
try {
|
|
61
|
-
new URL(t);
|
|
62
|
-
} catch {
|
|
63
|
-
throw new Error(`Invalid URL: ${t}`);
|
|
64
|
-
}
|
|
65
|
-
const u = `${t.endsWith("/") ? t : `${t}/`}index.js`;
|
|
66
|
-
try {
|
|
67
|
-
if (!(await fetch(u, { method: "HEAD" })).ok)
|
|
68
|
-
throw new Error(`Module not found at ${u}`);
|
|
69
|
-
} catch {
|
|
70
|
-
}
|
|
71
|
-
const x = await import(
|
|
72
|
-
/* @vite-ignore */
|
|
73
|
-
/* webpackIgnore: true */
|
|
74
|
-
u
|
|
75
|
-
);
|
|
76
|
-
if (typeof x.useChartStore != "function")
|
|
77
|
-
throw new Error("useChartStore is not a function");
|
|
78
|
-
o(() => x.useChartStore), i(null);
|
|
79
|
-
} catch (h) {
|
|
80
|
-
const u = h instanceof Error ? h.message : "Unknown error";
|
|
81
|
-
console.error("Failed to load remote chart store:", u), i(u), o(null);
|
|
82
|
-
}
|
|
83
|
-
})();
|
|
84
|
-
}, [t, c]), a;
|
|
85
|
-
}
|
|
86
|
-
function ua(t, a) {
|
|
87
|
-
if (t.length === 0)
|
|
88
|
-
return "";
|
|
89
|
-
const o = t.find(
|
|
90
|
-
(s) => {
|
|
91
|
-
var i, c;
|
|
92
|
-
return ((i = s.customCardPreferences) == null ? void 0 : i.visualType) === "multiple" || !!((c = s.customCardPreferences) != null && c.dataInputCardIds);
|
|
93
|
-
}
|
|
94
|
-
);
|
|
95
|
-
if (o)
|
|
96
|
-
return o.id;
|
|
97
|
-
if (a) {
|
|
98
|
-
const s = t.find((i) => i.id === a);
|
|
99
|
-
if (s) {
|
|
100
|
-
const i = s.tabTitle;
|
|
101
|
-
if (i == "All__Header")
|
|
102
|
-
return t[0].id;
|
|
103
|
-
if (i && i.endsWith("__Header")) {
|
|
104
|
-
const m = i.split("__")[0], h = t.find(
|
|
105
|
-
(u) => u.tabTitle === m
|
|
106
|
-
);
|
|
107
|
-
return h ? h.id : t[0].id;
|
|
108
|
-
}
|
|
109
|
-
return a;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return t[0].id;
|
|
113
|
-
}
|
|
114
|
-
function ma(t, a) {
|
|
115
|
-
return a ? {
|
|
116
|
-
...t,
|
|
117
|
-
settings: a
|
|
118
|
-
} : t;
|
|
119
|
-
}
|
|
120
|
-
function pa(t, a) {
|
|
121
|
-
const o = a.selectedConnectionId || t.connectionId || "";
|
|
122
|
-
if (!t.dataSource) {
|
|
123
|
-
if (!o)
|
|
124
|
-
return;
|
|
125
|
-
const s = a.selectedDatabaseName || t.lastSelectedDatabase, i = a.selectedSchemaName || t.lastSelectedSchema, c = a.selectedTableName || t.lastSelectedTable;
|
|
126
|
-
return {
|
|
127
|
-
connectionId: o,
|
|
128
|
-
connectionType: "",
|
|
129
|
-
mode: "database",
|
|
130
|
-
selectedEntities: [],
|
|
131
|
-
...s && i && c ? {
|
|
132
|
-
dbSelection: {
|
|
133
|
-
database: s,
|
|
134
|
-
schema: i,
|
|
135
|
-
entityType: "table"
|
|
136
|
-
}
|
|
137
|
-
} : {}
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
return {
|
|
141
|
-
...t.dataSource,
|
|
142
|
-
connectionId: a.selectedConnectionId || t.dataSource.connectionId || t.connectionId || ""
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
function fa(t, {
|
|
146
|
-
isDevMode: a,
|
|
147
|
-
cardSql: o,
|
|
148
|
-
isShowingVisual: s,
|
|
149
|
-
selectedSchemaName: i,
|
|
150
|
-
selectedDatamodelId: c,
|
|
151
|
-
selectedDatabaseName: m,
|
|
152
|
-
selectedTableName: h,
|
|
153
|
-
selectedConnectionId: u,
|
|
154
|
-
remoteChartSettings: x,
|
|
155
|
-
stripConfig: y
|
|
156
|
-
}) {
|
|
157
|
-
const f = a || zt(t);
|
|
158
|
-
return {
|
|
159
|
-
...t,
|
|
160
|
-
dataSource: pa(t, {
|
|
161
|
-
selectedConnectionId: u,
|
|
162
|
-
selectedDatabaseName: m,
|
|
163
|
-
selectedSchemaName: i,
|
|
164
|
-
selectedTableName: h
|
|
165
|
-
}),
|
|
166
|
-
lastSelectedSchema: i,
|
|
167
|
-
lastSelectedDatamodelId: c,
|
|
168
|
-
lastSelectedDatabase: m,
|
|
169
|
-
lastSelectedTable: h,
|
|
170
|
-
connectionId: u || t.connectionId,
|
|
171
|
-
sql: f ? o || t.sql : void 0,
|
|
172
|
-
python: f ? t.python : void 0,
|
|
173
|
-
config: a || !t.config ? void 0 : y(t.config),
|
|
174
|
-
customCfg: s ? t.customCfg : null,
|
|
175
|
-
preferences: t.preferences,
|
|
176
|
-
customCardPreferences: ma(
|
|
177
|
-
t.customCardPreferences,
|
|
178
|
-
x
|
|
179
|
-
)
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
const ha = (t) => {
|
|
183
|
-
if (!t || !("detailTableBackup" in t))
|
|
184
|
-
return t;
|
|
185
|
-
const { detailTableBackup: a, ...o } = t;
|
|
186
|
-
return o;
|
|
187
|
-
};
|
|
188
|
-
async function Pe(t, a, o, s, i = "Opening library visual...") {
|
|
189
|
-
if (!a || !o)
|
|
190
|
-
throw new Error("Missing auth token or visual ID");
|
|
191
|
-
const c = ["resource-by-id", "visual", o], m = s.getQueryData(c);
|
|
192
|
-
if (m)
|
|
193
|
-
return console.log("Using cached visual data for:", o), { data: m, fromCache: !0 };
|
|
194
|
-
console.log("Fetching visual data from network for:", o);
|
|
195
|
-
const h = j.loading(i, {
|
|
196
|
-
position: "top-center"
|
|
197
|
-
});
|
|
198
|
-
try {
|
|
199
|
-
const u = await fetch(
|
|
200
|
-
`${t}/management/v1/visuals/${o}`,
|
|
201
|
-
{
|
|
202
|
-
headers: {
|
|
203
|
-
Authorization: `Bearer ${a}`
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
);
|
|
207
|
-
if (!u.ok)
|
|
208
|
-
throw new Error("Failed to load visual");
|
|
209
|
-
const x = await u.json();
|
|
210
|
-
return s.setQueryData(c, x), j.dismiss(h), { data: x, fromCache: !1 };
|
|
211
|
-
} catch (u) {
|
|
212
|
-
throw j.dismiss(h), u;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
function pt(t) {
|
|
216
|
-
if (typeof t == "string")
|
|
217
|
-
return JSON.parse(t);
|
|
218
|
-
if (typeof t == "object")
|
|
219
|
-
return t;
|
|
220
|
-
throw new Error("Invalid frame object format");
|
|
221
|
-
}
|
|
222
|
-
function ba(t, a) {
|
|
223
|
-
var c, m;
|
|
224
|
-
const o = (t == null ? void 0 : t.frameObject) ?? ((c = t == null ? void 0 : t.visual) == null ? void 0 : c.frameObject);
|
|
225
|
-
if (!o)
|
|
226
|
-
return !1;
|
|
227
|
-
const s = pt(o);
|
|
228
|
-
if (!(s != null && s.cards) || s.cards.length === 0)
|
|
229
|
-
return !1;
|
|
230
|
-
const i = (m = s.cards) == null ? void 0 : m.find(
|
|
231
|
-
(h) => h.id === s.activeCardId
|
|
232
|
-
);
|
|
233
|
-
return i ? ($t({
|
|
234
|
-
...a,
|
|
235
|
-
frame: s,
|
|
236
|
-
card: i,
|
|
237
|
-
visualId: (t == null ? void 0 : t.id) || s.visualId
|
|
238
|
-
}), !0) : !1;
|
|
239
|
-
}
|
|
240
|
-
function ga() {
|
|
241
|
-
const t = z(
|
|
242
|
-
(s) => {
|
|
243
|
-
var i;
|
|
244
|
-
return ((i = s.card.customCardPreferences) == null ? void 0 : i.url) || "";
|
|
245
|
-
}
|
|
246
|
-
), a = ca(t);
|
|
247
|
-
return { getUpdatedFrame: U(() => {
|
|
248
|
-
var V;
|
|
249
|
-
Wt();
|
|
250
|
-
const {
|
|
251
|
-
frame: s,
|
|
252
|
-
card: i,
|
|
253
|
-
isDevMode: c,
|
|
254
|
-
isShowingVisual: m,
|
|
255
|
-
selectedSchemaName: h,
|
|
256
|
-
selectedDatamodelId: u,
|
|
257
|
-
selectedDatabaseName: x,
|
|
258
|
-
selectedTableName: y,
|
|
259
|
-
selectedConnectionId: f
|
|
260
|
-
} = z.getState(), C = i.sql, T = (V = a == null ? void 0 : a.getState()) == null ? void 0 : V.settings, S = fa(i, {
|
|
261
|
-
isDevMode: c,
|
|
262
|
-
cardSql: C,
|
|
263
|
-
isShowingVisual: m,
|
|
264
|
-
selectedSchemaName: h,
|
|
265
|
-
selectedDatamodelId: u,
|
|
266
|
-
selectedDatabaseName: x,
|
|
267
|
-
selectedTableName: y,
|
|
268
|
-
selectedConnectionId: f,
|
|
269
|
-
remoteChartSettings: T,
|
|
270
|
-
stripConfig: ha
|
|
271
|
-
}), N = s.cards.map(
|
|
272
|
-
(Q) => Q.id === i.id ? S : Q
|
|
273
|
-
);
|
|
274
|
-
return {
|
|
275
|
-
...s,
|
|
276
|
-
cards: N,
|
|
277
|
-
activeCardId: ua(N, s.activeCardId)
|
|
278
|
-
};
|
|
279
|
-
}, [a]) };
|
|
280
|
-
}
|
|
281
|
-
function Le() {
|
|
282
|
-
const { authToken: t, tokenProps: a } = Ut(), o = ce(), s = jt(), i = Ae(), { selectVisual: c } = Qt(), {
|
|
283
|
-
setFrame: m,
|
|
284
|
-
setCard: h,
|
|
285
|
-
setIsDevMode: u,
|
|
286
|
-
initializeModeDrafts: x,
|
|
287
|
-
setActiveTabCardId: y,
|
|
288
|
-
updateDataSource: f,
|
|
289
|
-
setQueryResultColumns: C,
|
|
290
|
-
setSelectedConnectionId: T,
|
|
291
|
-
setSelectedDatabaseName: S,
|
|
292
|
-
setSelectedSchemaName: N,
|
|
293
|
-
setSelectedTableName: V,
|
|
294
|
-
setSelectedDatamodelId: Q,
|
|
295
|
-
setFilterValues: G,
|
|
296
|
-
setInlineFilterValuesMap: R,
|
|
297
|
-
setApplyFilters: $,
|
|
298
|
-
clearEditorContext: ee
|
|
299
|
-
} = de(), {
|
|
300
|
-
setIsDashboardEditing: I,
|
|
301
|
-
setIsVisualEditing: n,
|
|
302
|
-
setSelectedFrameId: w,
|
|
303
|
-
clearSelectedFrameId: W
|
|
304
|
-
} = _e(), O = J((_) => _.selectedSheetId), P = J((_) => _.selectedFrameId), X = J((_) => _.dashboard), te = J((_) => _.filterValues), M = J(
|
|
305
|
-
(_) => _.inlineFilterValuesMap
|
|
306
|
-
), Y = Rt((i == null ? void 0 : i.id) || "", {
|
|
307
|
-
enabled: !!(i != null && i.id) && !!(t != null && t.accessToken)
|
|
308
|
-
}), re = U(
|
|
309
|
-
async (_) => {
|
|
310
|
-
try {
|
|
311
|
-
c(_), W(), ee();
|
|
312
|
-
const { data: F, fromCache: H } = await Pe(
|
|
313
|
-
a.apiServiceUrl,
|
|
314
|
-
(t == null ? void 0 : t.accessToken) || "",
|
|
315
|
-
_.id,
|
|
316
|
-
o,
|
|
317
|
-
"Opening library visual..."
|
|
318
|
-
);
|
|
319
|
-
if (!ba(F, {
|
|
320
|
-
setFrame: m,
|
|
321
|
-
setCard: h,
|
|
322
|
-
setIsDevMode: u,
|
|
323
|
-
initializeModeDrafts: x,
|
|
324
|
-
setActiveTabCardId: y,
|
|
325
|
-
updateDataSource: f,
|
|
326
|
-
setQueryResultColumns: C,
|
|
327
|
-
setSelectedConnectionId: T,
|
|
328
|
-
setSelectedDatabaseName: S,
|
|
329
|
-
setSelectedSchemaName: N,
|
|
330
|
-
setSelectedTableName: V,
|
|
331
|
-
setSelectedDatamodelId: Q,
|
|
332
|
-
setFilterValues: G,
|
|
333
|
-
setInlineFilterValuesMap: R,
|
|
334
|
-
setApplyFilters: $,
|
|
335
|
-
setIsDashboardEditing: I,
|
|
336
|
-
setIsVisualEditing: n,
|
|
337
|
-
dashboard: X,
|
|
338
|
-
selectedSheetId: O,
|
|
339
|
-
selectedFrameId: P,
|
|
340
|
-
filterValues: te,
|
|
341
|
-
inlineFilterValuesMap: M
|
|
342
|
-
}))
|
|
343
|
-
throw new Error("Failed to setup editor with visual data");
|
|
344
|
-
return { success: !0, fromCache: H };
|
|
345
|
-
} catch (F) {
|
|
346
|
-
return console.error("Error editing visual:", F), { success: !1, error: "Failed to load visual for editing" };
|
|
347
|
-
}
|
|
348
|
-
},
|
|
349
|
-
[
|
|
350
|
-
t == null ? void 0 : t.accessToken,
|
|
351
|
-
a.apiServiceUrl,
|
|
352
|
-
o,
|
|
353
|
-
c,
|
|
354
|
-
m,
|
|
355
|
-
h,
|
|
356
|
-
I,
|
|
357
|
-
n,
|
|
358
|
-
u,
|
|
359
|
-
x,
|
|
360
|
-
y,
|
|
361
|
-
f,
|
|
362
|
-
C,
|
|
363
|
-
T,
|
|
364
|
-
S,
|
|
365
|
-
N,
|
|
366
|
-
V,
|
|
367
|
-
Q,
|
|
368
|
-
G,
|
|
369
|
-
R,
|
|
370
|
-
$,
|
|
371
|
-
ee,
|
|
372
|
-
W,
|
|
373
|
-
X,
|
|
374
|
-
O,
|
|
375
|
-
P,
|
|
376
|
-
te,
|
|
377
|
-
M
|
|
378
|
-
]
|
|
379
|
-
), be = U(
|
|
380
|
-
async (_) => {
|
|
381
|
-
var H;
|
|
382
|
-
const F = (L) => (j.error(L), { success: !1, error: L });
|
|
383
|
-
try {
|
|
384
|
-
if (c(_), !O)
|
|
385
|
-
return F("No sheet selected. Please select a sheet first.");
|
|
386
|
-
const { data: L, fromCache: ge } = await Pe(
|
|
387
|
-
a.apiServiceUrl,
|
|
388
|
-
(t == null ? void 0 : t.accessToken) || "",
|
|
389
|
-
_.id,
|
|
390
|
-
o,
|
|
391
|
-
"Adding visual to dashboard..."
|
|
392
|
-
), ue = (L == null ? void 0 : L.frameObject) ?? ((H = L == null ? void 0 : L.visual) == null ? void 0 : H.frameObject);
|
|
393
|
-
if (!ue)
|
|
394
|
-
return F("Visual has no frame data");
|
|
395
|
-
const B = pt(ue);
|
|
396
|
-
if (!(B != null && B.cards) || B.cards.length === 0)
|
|
397
|
-
return F("Visual frame is malformed");
|
|
398
|
-
const le = {
|
|
399
|
-
...Bt(B),
|
|
400
|
-
visualId: _.id
|
|
401
|
-
// Link this frame to the library visual
|
|
402
|
-
};
|
|
403
|
-
return await s(
|
|
404
|
-
O,
|
|
405
|
-
le,
|
|
406
|
-
"end"
|
|
407
|
-
), I(!0), w(le.id), { success: !0, fromCache: ge };
|
|
408
|
-
} catch (L) {
|
|
409
|
-
return console.error("Error adding visual:", L), F(
|
|
410
|
-
L instanceof Error ? L.message : "Failed to add visual to dashboard"
|
|
411
|
-
);
|
|
412
|
-
}
|
|
413
|
-
},
|
|
414
|
-
[
|
|
415
|
-
t == null ? void 0 : t.accessToken,
|
|
416
|
-
a.apiServiceUrl,
|
|
417
|
-
o,
|
|
418
|
-
c,
|
|
419
|
-
O,
|
|
420
|
-
I,
|
|
421
|
-
w,
|
|
422
|
-
s
|
|
423
|
-
]
|
|
424
|
-
);
|
|
425
|
-
return {
|
|
426
|
-
visual: Y.data,
|
|
427
|
-
isLoading: Y.isLoading,
|
|
428
|
-
isError: Y.isError,
|
|
429
|
-
error: Y.error,
|
|
430
|
-
handleEditLibraryVisual: re,
|
|
431
|
-
handleAddLibraryVisual: be,
|
|
432
|
-
getUpdatedFrame: ga().getUpdatedFrame,
|
|
433
|
-
refetch: Y.refetch
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
function Oa() {
|
|
437
|
-
const t = z((m) => m.card.dataSource), {
|
|
438
|
-
setSelectedConnectionId: a,
|
|
439
|
-
setSelectedDatabaseName: o,
|
|
440
|
-
setSelectedSchemaName: s,
|
|
441
|
-
setSelectedTableName: i,
|
|
442
|
-
setSelectedDatamodelId: c
|
|
443
|
-
} = de();
|
|
444
|
-
ie(() => {
|
|
445
|
-
var T;
|
|
446
|
-
if (!t) return;
|
|
447
|
-
const { tableName: m, schemaName: h, databaseName: u, connectionId: x } = Ht(t), y = (T = t.selectedEntities) == null ? void 0 : T[0], C = (y == null ? void 0 : y.type) === "model" && "id" in y ? y.id : "";
|
|
448
|
-
a(x || ""), o(u || ""), s(h || ""), i(m || ""), c(C);
|
|
449
|
-
}, [
|
|
450
|
-
t,
|
|
451
|
-
a,
|
|
452
|
-
o,
|
|
453
|
-
s,
|
|
454
|
-
i,
|
|
455
|
-
c
|
|
456
|
-
]);
|
|
457
|
-
}
|
|
458
|
-
function ya(t, a) {
|
|
459
|
-
return {
|
|
460
|
-
...t,
|
|
461
|
-
sql: "",
|
|
462
|
-
python: "",
|
|
463
|
-
config: void 0,
|
|
464
|
-
customCfg: "",
|
|
465
|
-
preferences: {},
|
|
466
|
-
interactionConfig: void 0,
|
|
467
|
-
linkedInteractionTargetOverrides: void 0,
|
|
468
|
-
customCardPreferences: a ? t.customCardPreferences : void 0,
|
|
469
|
-
type: a ? t.type : "bar"
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
function xa() {
|
|
473
|
-
const { setTempQueryData: t } = de(), a = ce(), o = z((R) => R.tempQueryData), s = z((R) => R.card), i = lt(), c = oe(() => i !== s.type ? { ...s, type: i } : s, [s, i]), { queryKey: m } = it(c), {
|
|
474
|
-
setCardSql: h,
|
|
475
|
-
setSqlGen: u,
|
|
476
|
-
setCardPython: x,
|
|
477
|
-
setCardCustomCfg: y,
|
|
478
|
-
setCardPreferences: f,
|
|
479
|
-
clearQueryConfig: C,
|
|
480
|
-
setCardConfig: T,
|
|
481
|
-
setCardType: S,
|
|
482
|
-
setFrame: N,
|
|
483
|
-
setCard: V,
|
|
484
|
-
setActiveTabCardId: Q
|
|
485
|
-
} = de();
|
|
486
|
-
function G() {
|
|
487
|
-
var W, O, P, X;
|
|
488
|
-
const R = a.getQueryData(m);
|
|
489
|
-
o != null && o.queryData || t({
|
|
490
|
-
queryKey: m,
|
|
491
|
-
queryData: R
|
|
492
|
-
}), a.setQueryData(m, null), a.removeQueries({ queryKey: m, exact: !0 }), h(""), u({}), C(), T(void 0), x(""), y(""), f({});
|
|
493
|
-
const $ = z.getState().frame, ee = z.getState().card, I = la($, ee), n = ((W = I == null ? void 0 : I.customCardPreferences) == null ? void 0 : W.visualType) === "multiple" || !!((O = I == null ? void 0 : I.customCardPreferences) != null && O.dataInputCardIds) || (((P = I == null ? void 0 : I.customCardPreferences) == null ? void 0 : P.minInputs) || 0) > 1 || (((X = I == null ? void 0 : I.customCardPreferences) == null ? void 0 : X.maxInputs) || 0) > 1, w = ya(ee, n);
|
|
494
|
-
N({
|
|
495
|
-
...$,
|
|
496
|
-
cards: $.cards.map(
|
|
497
|
-
(te) => te.id === w.id ? w : te
|
|
498
|
-
)
|
|
499
|
-
}), Q(w.id), V(w), n || S("bar");
|
|
500
|
-
}
|
|
501
|
-
return G;
|
|
502
|
-
}
|
|
503
|
-
function za({
|
|
504
|
-
type: t,
|
|
505
|
-
isLinked: a,
|
|
506
|
-
className: o,
|
|
507
|
-
showLabel: s = !1,
|
|
508
|
-
showLocal: i = !1
|
|
509
|
-
}) {
|
|
510
|
-
const c = J((N) => N.selectedFrameId), m = Kt((N) => N.selectedVisual), h = z((N) => N.frame);
|
|
511
|
-
let u;
|
|
512
|
-
if (t)
|
|
513
|
-
u = t;
|
|
514
|
-
else if (a !== void 0)
|
|
515
|
-
u = a ? "linked" : "library";
|
|
516
|
-
else if (!!!(h != null && h.visualId || m != null && m.id) && c)
|
|
517
|
-
u = "local";
|
|
518
|
-
else if (m && !c)
|
|
519
|
-
u = "library";
|
|
520
|
-
else if (h != null && h.visualId && c)
|
|
521
|
-
u = "linked";
|
|
522
|
-
else if (m != null && m.id && c)
|
|
523
|
-
u = "library";
|
|
524
|
-
else
|
|
525
|
-
return null;
|
|
526
|
-
if (u === "local" && !i)
|
|
527
|
-
return null;
|
|
528
|
-
const x = {
|
|
529
|
-
local: "border-slate-200/70 bg-slate-50/80 text-slate-700 shadow-sm hover:bg-slate-100/80 dark:border-slate-700 dark:bg-slate-900/70 dark:text-slate-200 dark:hover:bg-slate-800/80",
|
|
530
|
-
linked: "border-purple-200/70 bg-gradient-to-r from-purple-50/50 to-purple-100/30 text-purple-900 shadow-sm hover:from-purple-100/60 hover:to-purple-100/50 hover:shadow-md dark:border-purple-800/50 dark:from-purple-950/40 dark:to-purple-900/30 dark:text-purple-100 dark:hover:from-purple-950/60 dark:hover:to-purple-900/50",
|
|
531
|
-
library: "border-blue-200/70 bg-gradient-to-r from-blue-50/50 to-blue-100/30 text-blue-900 shadow-sm hover:from-blue-100/60 hover:to-blue-100/50 hover:shadow-md dark:border-blue-800/50 dark:from-blue-950/40 dark:to-blue-900/30 dark:text-blue-100 dark:hover:from-blue-950/60 dark:hover:to-blue-900/50"
|
|
532
|
-
}, y = {
|
|
533
|
-
local: "Local to this dashboard: Changes made here only affect this dashboard copy.",
|
|
534
|
-
linked: "Linked to library: Changes made here update the library visual and all linked instances.",
|
|
535
|
-
library: "Library visual: Share and reuse this visual across multiple dashboards."
|
|
536
|
-
}, f = {
|
|
537
|
-
local: "border-slate-200 bg-slate-50 text-slate-900 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100",
|
|
538
|
-
linked: "border-purple-200 bg-purple-50 text-purple-900 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-100",
|
|
539
|
-
library: "border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-100"
|
|
540
|
-
}, C = {
|
|
541
|
-
local: "fill-slate-50 dark:fill-slate-900",
|
|
542
|
-
linked: "fill-purple-50 dark:fill-purple-950",
|
|
543
|
-
library: "fill-blue-50 dark:fill-blue-950"
|
|
544
|
-
}, T = {
|
|
545
|
-
local: /* @__PURE__ */ r("span", { className: "h-2 w-2 rounded-full bg-current/70" }),
|
|
546
|
-
linked: /* @__PURE__ */ r(da, { className: "h-3.5 w-3.5" }),
|
|
547
|
-
library: /* @__PURE__ */ r(ia, { className: "h-3.5 w-3.5" })
|
|
548
|
-
}, S = {
|
|
549
|
-
local: "Local",
|
|
550
|
-
linked: "Linked",
|
|
551
|
-
library: "Library"
|
|
552
|
-
};
|
|
553
|
-
return /* @__PURE__ */ r(gt, { children: /* @__PURE__ */ p(yt, { delayDuration: 300, children: [
|
|
554
|
-
/* @__PURE__ */ r(xt, { asChild: !0, children: /* @__PURE__ */ p(
|
|
555
|
-
Yt,
|
|
556
|
-
{
|
|
557
|
-
variant: "outline",
|
|
558
|
-
className: fe(
|
|
559
|
-
"cursor-help select-none transition-all",
|
|
560
|
-
x[u],
|
|
561
|
-
o
|
|
562
|
-
),
|
|
563
|
-
children: [
|
|
564
|
-
T[u],
|
|
565
|
-
s && /* @__PURE__ */ r("span", { className: "ml-1 text-xs font-medium leading-none", children: S[u] })
|
|
566
|
-
]
|
|
567
|
-
}
|
|
568
|
-
) }),
|
|
569
|
-
/* @__PURE__ */ p(
|
|
570
|
-
vt,
|
|
571
|
-
{
|
|
572
|
-
side: "bottom",
|
|
573
|
-
className: fe("max-w-xs", f[u]),
|
|
574
|
-
children: [
|
|
575
|
-
/* @__PURE__ */ r(Ct, { className: C[u] }),
|
|
576
|
-
/* @__PURE__ */ r("p", { children: y[u] })
|
|
577
|
-
]
|
|
578
|
-
}
|
|
579
|
-
)
|
|
580
|
-
] }) });
|
|
581
|
-
}
|
|
582
|
-
function ft(t) {
|
|
583
|
-
const { control: a, onChange: o } = t;
|
|
584
|
-
return /* @__PURE__ */ p("div", { className: "flex flex-col gap-1.5", children: [
|
|
585
|
-
/* @__PURE__ */ r(ne, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Label" }),
|
|
586
|
-
/* @__PURE__ */ r(
|
|
587
|
-
st,
|
|
588
|
-
{
|
|
589
|
-
size: "xs",
|
|
590
|
-
value: a.label,
|
|
591
|
-
placeholder: "Control label",
|
|
592
|
-
onChange: (s) => o(s.target.value)
|
|
593
|
-
}
|
|
594
|
-
)
|
|
595
|
-
] });
|
|
596
|
-
}
|
|
597
|
-
function va(t) {
|
|
598
|
-
const { currentStep: a, labels: o } = t;
|
|
599
|
-
return /* @__PURE__ */ r("div", { className: "sticky top-0 z-10 -mx-1 border-b border-border/60 bg-background/95 px-1 pb-2.5 pt-1 backdrop-blur supports-[backdrop-filter]:bg-background/85", children: /* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-2 sm:gap-2.5", children: o.map((s, i) => {
|
|
600
|
-
const c = i + 1, m = c === a, h = c < a;
|
|
601
|
-
return /* @__PURE__ */ p(bt, { children: [
|
|
602
|
-
/* @__PURE__ */ p("div", { className: "flex items-center gap-1.5", children: [
|
|
603
|
-
/* @__PURE__ */ r(
|
|
604
|
-
"span",
|
|
605
|
-
{
|
|
606
|
-
className: fe(
|
|
607
|
-
"flex h-5 w-5 items-center justify-center rounded-full border text-[10px] font-medium tabular-nums",
|
|
608
|
-
m ? "border-foreground bg-foreground text-background" : h ? "border-foreground/30 bg-foreground/10 text-foreground" : "border-border/60 bg-background text-muted-foreground"
|
|
609
|
-
),
|
|
610
|
-
children: c
|
|
611
|
-
}
|
|
612
|
-
),
|
|
613
|
-
/* @__PURE__ */ r(
|
|
614
|
-
"span",
|
|
615
|
-
{
|
|
616
|
-
className: fe(
|
|
617
|
-
"text-[12px]",
|
|
618
|
-
m ? "font-medium text-foreground" : "text-muted-foreground"
|
|
619
|
-
),
|
|
620
|
-
children: s
|
|
621
|
-
}
|
|
622
|
-
)
|
|
623
|
-
] }),
|
|
624
|
-
i < o.length - 1 ? /* @__PURE__ */ r(
|
|
625
|
-
"span",
|
|
626
|
-
{
|
|
627
|
-
className: "h-px w-4 bg-border/60 sm:w-6",
|
|
628
|
-
"aria-hidden": "true"
|
|
629
|
-
}
|
|
630
|
-
) : null
|
|
631
|
-
] }, s);
|
|
632
|
-
}) }) });
|
|
633
|
-
}
|
|
634
|
-
function he(t) {
|
|
635
|
-
const { secondary: a, tertiary: o, primary: s } = t;
|
|
636
|
-
return /* @__PURE__ */ p("div", { className: "sticky bottom-0 z-10 -mx-1 flex justify-end gap-2 border-t bg-background/95 px-1 pb-1 pt-3 backdrop-blur supports-[backdrop-filter]:bg-background/85", children: [
|
|
637
|
-
a,
|
|
638
|
-
o,
|
|
639
|
-
s
|
|
640
|
-
] });
|
|
641
|
-
}
|
|
642
|
-
function Ca(t) {
|
|
643
|
-
const { control: a, scope: o, detail: s } = t;
|
|
644
|
-
return /* @__PURE__ */ p("div", { className: "flex items-start gap-2.5 rounded-control border border-border/60 bg-muted/30 px-3 py-2.5", children: [
|
|
645
|
-
/* @__PURE__ */ r(sa, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-foreground" }),
|
|
646
|
-
/* @__PURE__ */ p("div", { className: "min-w-0 space-y-0.5", children: [
|
|
647
|
-
/* @__PURE__ */ r("div", { className: "text-[13px] font-medium text-foreground", children: a.label }),
|
|
648
|
-
/* @__PURE__ */ p("div", { className: "text-[12px] text-muted-foreground", children: [
|
|
649
|
-
tt(a.type).label,
|
|
650
|
-
" ·",
|
|
651
|
-
" ",
|
|
652
|
-
rt(a),
|
|
653
|
-
" ·",
|
|
654
|
-
" ",
|
|
655
|
-
at(o, a.placement)
|
|
656
|
-
] }),
|
|
657
|
-
s ? /* @__PURE__ */ r("div", { className: "text-[12px] text-muted-foreground", children: s }) : null
|
|
658
|
-
] })
|
|
659
|
-
] });
|
|
660
|
-
}
|
|
661
|
-
function Xe(t) {
|
|
662
|
-
const {
|
|
663
|
-
control: a,
|
|
664
|
-
defaultValue: o,
|
|
665
|
-
availableFieldChoices: s,
|
|
666
|
-
availableMetricChoices: i,
|
|
667
|
-
previewControlDefinitions: c,
|
|
668
|
-
previewControlValues: m,
|
|
669
|
-
onControlChange: h,
|
|
670
|
-
onLabelChange: u,
|
|
671
|
-
onDefaultValueChange: x,
|
|
672
|
-
onBack: y,
|
|
673
|
-
onNext: f,
|
|
674
|
-
nextDisabled: C
|
|
675
|
-
} = t;
|
|
676
|
-
return /* @__PURE__ */ p("div", { className: "space-y-3", children: [
|
|
677
|
-
/* @__PURE__ */ r(ft, { control: a, onChange: u }),
|
|
678
|
-
/* @__PURE__ */ r(
|
|
679
|
-
dt,
|
|
680
|
-
{
|
|
681
|
-
control: a,
|
|
682
|
-
availableFieldChoices: s,
|
|
683
|
-
availableMetricChoices: i,
|
|
684
|
-
previewControlDefinitions: c,
|
|
685
|
-
previewControlValues: m,
|
|
686
|
-
controlLifecycle: "create",
|
|
687
|
-
onChange: h
|
|
688
|
-
}
|
|
689
|
-
),
|
|
690
|
-
/* @__PURE__ */ r(
|
|
691
|
-
ct,
|
|
692
|
-
{
|
|
693
|
-
control: a,
|
|
694
|
-
value: o,
|
|
695
|
-
onChange: x,
|
|
696
|
-
allowNoDefault: !0,
|
|
697
|
-
allowCardDefault: !0,
|
|
698
|
-
hint: "This is the value viewers will see first.",
|
|
699
|
-
previewControlDefinitions: c,
|
|
700
|
-
previewControlValues: m
|
|
701
|
-
}
|
|
702
|
-
),
|
|
703
|
-
/* @__PURE__ */ r(
|
|
704
|
-
he,
|
|
705
|
-
{
|
|
706
|
-
secondary: /* @__PURE__ */ r(q, { type: "button", variant: "outline", size: "xs", onClick: y, children: "Back" }),
|
|
707
|
-
primary: /* @__PURE__ */ r(
|
|
708
|
-
q,
|
|
709
|
-
{
|
|
710
|
-
type: "button",
|
|
711
|
-
size: "xs",
|
|
712
|
-
onClick: f,
|
|
713
|
-
disabled: C,
|
|
714
|
-
children: "Next"
|
|
715
|
-
}
|
|
716
|
-
)
|
|
717
|
-
}
|
|
718
|
-
)
|
|
719
|
-
] });
|
|
720
|
-
}
|
|
721
|
-
const Sa = /* @__PURE__ */ new Set([
|
|
722
|
-
"grain_selector",
|
|
723
|
-
"aggregation_selector",
|
|
724
|
-
"field_selector",
|
|
725
|
-
"metric_selector"
|
|
726
|
-
]);
|
|
727
|
-
function Je(t) {
|
|
728
|
-
const { text: a, ariaLabel: o } = t, [s, i] = K(!1);
|
|
729
|
-
return /* @__PURE__ */ p(
|
|
730
|
-
"button",
|
|
731
|
-
{
|
|
732
|
-
type: "button",
|
|
733
|
-
"aria-label": o,
|
|
734
|
-
onClick: async () => {
|
|
735
|
-
try {
|
|
736
|
-
await navigator.clipboard.writeText(a), i(!0), setTimeout(() => i(!1), 1200);
|
|
737
|
-
} catch (c) {
|
|
738
|
-
console.error("Failed to copy", c);
|
|
739
|
-
}
|
|
740
|
-
},
|
|
741
|
-
className: "group flex w-full items-center justify-between gap-2 rounded-control bg-muted/40 px-2 py-1 text-left transition-colors hover:bg-muted/60 focus-visible:bg-muted/60 focus-visible:outline-none",
|
|
742
|
-
children: [
|
|
743
|
-
/* @__PURE__ */ r("code", { className: "min-w-0 truncate font-mono text-[12px] text-foreground", children: a }),
|
|
744
|
-
/* @__PURE__ */ r("span", { className: "shrink-0 text-[11px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100", children: s ? "Copied" : "Click to copy" })
|
|
745
|
-
]
|
|
746
|
-
}
|
|
747
|
-
);
|
|
748
|
-
}
|
|
749
|
-
function Ze(t) {
|
|
750
|
-
const {
|
|
751
|
-
control: a,
|
|
752
|
-
scope: o,
|
|
753
|
-
createdReference: s,
|
|
754
|
-
explorerContent: i,
|
|
755
|
-
sqlDescription: c,
|
|
756
|
-
summaryDetail: m,
|
|
757
|
-
onBack: h,
|
|
758
|
-
onCancel: u,
|
|
759
|
-
onDone: x
|
|
760
|
-
} = t, y = Sa.has(a.type), f = s.match(/\[\[param\.(.+?)\]\]/), C = f ? `{{ param('${f[1]}') }}` : "";
|
|
761
|
-
return /* @__PURE__ */ p("div", { className: "space-y-4", children: [
|
|
762
|
-
/* @__PURE__ */ r(
|
|
763
|
-
Ca,
|
|
764
|
-
{
|
|
765
|
-
control: a,
|
|
766
|
-
scope: o,
|
|
767
|
-
detail: m
|
|
768
|
-
}
|
|
769
|
-
),
|
|
770
|
-
/* @__PURE__ */ p("div", { className: "space-y-2", children: [
|
|
771
|
-
/* @__PURE__ */ r("p", { className: "text-[13px] font-medium text-foreground", children: "How cards use this control" }),
|
|
772
|
-
/* @__PURE__ */ p("div", { className: "divide-y divide-border/60 overflow-hidden rounded-control border border-border/60", children: [
|
|
773
|
-
y ? /* @__PURE__ */ p("div", { className: "space-y-1 px-3 py-2.5", children: [
|
|
774
|
-
/* @__PURE__ */ r("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Explorer cards" }),
|
|
775
|
-
/* @__PURE__ */ r("div", { className: "text-[12px] text-muted-foreground", children: i })
|
|
776
|
-
] }) : null,
|
|
777
|
-
/* @__PURE__ */ p("div", { className: "space-y-1.5 px-3 py-2.5", children: [
|
|
778
|
-
/* @__PURE__ */ r("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "SQL cards" }),
|
|
779
|
-
/* @__PURE__ */ r(
|
|
780
|
-
Je,
|
|
781
|
-
{
|
|
782
|
-
text: s,
|
|
783
|
-
ariaLabel: "Copy SQL control reference"
|
|
784
|
-
}
|
|
785
|
-
),
|
|
786
|
-
C ? /* @__PURE__ */ r(
|
|
787
|
-
Je,
|
|
788
|
-
{
|
|
789
|
-
text: C,
|
|
790
|
-
ariaLabel: "Copy Jinja control reference"
|
|
791
|
-
}
|
|
792
|
-
) : null,
|
|
793
|
-
/* @__PURE__ */ p("p", { className: "text-[12px] text-muted-foreground", children: [
|
|
794
|
-
c,
|
|
795
|
-
" ",
|
|
796
|
-
/* @__PURE__ */ r(
|
|
797
|
-
"a",
|
|
798
|
-
{
|
|
799
|
-
href: "https://docs.semaphor.cloud/docs/concepts/template-expressions",
|
|
800
|
-
target: "_blank",
|
|
801
|
-
rel: "noreferrer",
|
|
802
|
-
className: "underline underline-offset-2 hover:text-foreground",
|
|
803
|
-
children: "Template expressions docs"
|
|
804
|
-
}
|
|
805
|
-
),
|
|
806
|
-
"."
|
|
807
|
-
] })
|
|
808
|
-
] })
|
|
809
|
-
] })
|
|
810
|
-
] }),
|
|
811
|
-
/* @__PURE__ */ r(
|
|
812
|
-
he,
|
|
813
|
-
{
|
|
814
|
-
secondary: /* @__PURE__ */ r(q, { type: "button", variant: "outline", size: "xs", onClick: h, children: "Back" }),
|
|
815
|
-
tertiary: /* @__PURE__ */ r(q, { type: "button", variant: "outline", size: "xs", onClick: u, children: "Cancel" }),
|
|
816
|
-
primary: /* @__PURE__ */ r(q, { type: "button", size: "xs", onClick: x, children: "Done" })
|
|
817
|
-
}
|
|
818
|
-
)
|
|
819
|
-
] });
|
|
820
|
-
}
|
|
821
|
-
function ka(t) {
|
|
822
|
-
const a = me(
|
|
823
|
-
t.scope,
|
|
824
|
-
t.existingControls,
|
|
825
|
-
t.reservedIds
|
|
826
|
-
), o = t.type === a.type ? {
|
|
827
|
-
...a,
|
|
828
|
-
label: Fe[t.type]
|
|
829
|
-
} : {
|
|
830
|
-
...nt({
|
|
831
|
-
controls: [
|
|
832
|
-
{
|
|
833
|
-
...a,
|
|
834
|
-
label: Fe[t.type]
|
|
835
|
-
}
|
|
836
|
-
],
|
|
837
|
-
controlId: a.id,
|
|
838
|
-
nextType: t.type
|
|
839
|
-
}).controls[0],
|
|
840
|
-
label: Fe[t.type]
|
|
841
|
-
};
|
|
842
|
-
return {
|
|
843
|
-
step: 2,
|
|
844
|
-
control: o,
|
|
845
|
-
defaultValue: pe(o, void 0)
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
function Ua({
|
|
849
|
-
scope: t,
|
|
850
|
-
controls: a,
|
|
851
|
-
reservedControlIds: o,
|
|
852
|
-
defaultValues: s,
|
|
853
|
-
onChange: i,
|
|
854
|
-
emptyMessage: c,
|
|
855
|
-
initialCreateFlow: m = !1,
|
|
856
|
-
usageByControlId: h,
|
|
857
|
-
availableFieldChoices: u,
|
|
858
|
-
availableMetricChoices: x,
|
|
859
|
-
structuralParticipants: y,
|
|
860
|
-
structuralParticipantIdsByControlId: f,
|
|
861
|
-
card: C,
|
|
862
|
-
allowedControlTypes: T,
|
|
863
|
-
onCreateFlowActiveChange: S,
|
|
864
|
-
onCreateFlowComplete: N
|
|
865
|
-
}) {
|
|
866
|
-
const V = oe(
|
|
867
|
-
() => new Set(o || []),
|
|
868
|
-
[o]
|
|
869
|
-
), Q = Tt(t), G = St(t), [R, $] = K(
|
|
870
|
-
null
|
|
871
|
-
), [ee, I] = K(
|
|
872
|
-
null
|
|
873
|
-
), [n, w] = K(
|
|
874
|
-
() => m ? {
|
|
875
|
-
step: 1,
|
|
876
|
-
control: me(t, a, Array.from(V))
|
|
877
|
-
} : null
|
|
878
|
-
), W = Se({}), O = Se(void 0), P = Se(m), X = oe(() => {
|
|
879
|
-
const e = Re({ scope: t, card: C });
|
|
880
|
-
if (!T)
|
|
881
|
-
return e;
|
|
882
|
-
const d = new Set(T);
|
|
883
|
-
return e.filter((l) => d.has(l.value));
|
|
884
|
-
}, [T, C, t]), te = U(
|
|
885
|
-
(e) => {
|
|
886
|
-
const d = Re({
|
|
887
|
-
scope: t,
|
|
888
|
-
card: C,
|
|
889
|
-
includeType: T ? void 0 : e
|
|
890
|
-
});
|
|
891
|
-
if (!T)
|
|
892
|
-
return d;
|
|
893
|
-
const l = new Set(T);
|
|
894
|
-
return d.filter((b) => l.has(b.value));
|
|
895
|
-
},
|
|
896
|
-
[T, C, t]
|
|
897
|
-
), M = U(
|
|
898
|
-
(e) => t === "dashboard" && (e === "field_selector" || e === "metric_selector"),
|
|
899
|
-
[t]
|
|
900
|
-
), Y = oe(
|
|
901
|
-
() => n ? Be(
|
|
902
|
-
y || [],
|
|
903
|
-
n.control.type
|
|
904
|
-
) : [],
|
|
905
|
-
[n, y]
|
|
906
|
-
), re = oe(() => {
|
|
907
|
-
if (!n)
|
|
908
|
-
return {
|
|
909
|
-
fields: u || [],
|
|
910
|
-
metrics: x || []
|
|
911
|
-
};
|
|
912
|
-
if (!M(n.control.type))
|
|
913
|
-
return {
|
|
914
|
-
fields: u || [],
|
|
915
|
-
metrics: x || []
|
|
916
|
-
};
|
|
917
|
-
const e = n.selectedCardIds || [], d = ke({
|
|
918
|
-
controlType: n.control.type,
|
|
919
|
-
participants: y || [],
|
|
920
|
-
selectedCardIds: e
|
|
921
|
-
});
|
|
922
|
-
return {
|
|
923
|
-
fields: n.control.type === "field_selector" ? d.choices.map((l) => ({
|
|
924
|
-
option: l,
|
|
925
|
-
target: d.fieldTargetMap[l.value]
|
|
926
|
-
})) : [],
|
|
927
|
-
metrics: n.control.type === "metric_selector" ? d.choices.map((l) => ({
|
|
928
|
-
option: l,
|
|
929
|
-
target: d.metricTargetMap[l.value]
|
|
930
|
-
})) : []
|
|
931
|
-
};
|
|
932
|
-
}, [
|
|
933
|
-
u,
|
|
934
|
-
x,
|
|
935
|
-
n,
|
|
936
|
-
M,
|
|
937
|
-
y
|
|
938
|
-
]);
|
|
939
|
-
ie(() => {
|
|
940
|
-
S == null || S(!!n);
|
|
941
|
-
}, [n, S]), ie(() => {
|
|
942
|
-
const e = m && !P.current;
|
|
943
|
-
P.current = m, e && (w({
|
|
944
|
-
step: 1,
|
|
945
|
-
control: me(t, a, Array.from(V))
|
|
946
|
-
}), I(null), $(null));
|
|
947
|
-
}, [a, m, V, t]);
|
|
948
|
-
const be = (e) => {
|
|
949
|
-
if (!M(e.type))
|
|
950
|
-
return {
|
|
951
|
-
fields: u || [],
|
|
952
|
-
metrics: x || []
|
|
953
|
-
};
|
|
954
|
-
const d = (f == null ? void 0 : f[e.id]) || [];
|
|
955
|
-
if (d.length === 0)
|
|
956
|
-
return {
|
|
957
|
-
fields: u || [],
|
|
958
|
-
metrics: x || []
|
|
959
|
-
};
|
|
960
|
-
const l = ke({
|
|
961
|
-
controlType: e.type,
|
|
962
|
-
participants: y || [],
|
|
963
|
-
selectedCardIds: d
|
|
964
|
-
});
|
|
965
|
-
return {
|
|
966
|
-
fields: e.type === "field_selector" ? l.choices.map((b) => ({
|
|
967
|
-
option: b,
|
|
968
|
-
target: l.fieldTargetMap[b.value]
|
|
969
|
-
})) : [],
|
|
970
|
-
metrics: e.type === "metric_selector" ? l.choices.map((b) => ({
|
|
971
|
-
option: b,
|
|
972
|
-
target: l.metricTargetMap[b.value]
|
|
973
|
-
})) : []
|
|
974
|
-
};
|
|
975
|
-
}, _ = (e) => {
|
|
976
|
-
if (!M(e.control.type))
|
|
977
|
-
return {
|
|
978
|
-
nextControl: e.control,
|
|
979
|
-
cardBindingsById: void 0
|
|
980
|
-
};
|
|
981
|
-
const d = (f == null ? void 0 : f[e.control.id]) || [], l = ke({
|
|
982
|
-
controlType: e.control.type,
|
|
983
|
-
participants: y || [],
|
|
984
|
-
selectedCardIds: e.nextSelectedCardIds
|
|
985
|
-
}), b = At({
|
|
986
|
-
control: e.control,
|
|
987
|
-
choices: l.choices
|
|
988
|
-
}), v = Object.fromEntries(
|
|
989
|
-
d.filter((k) => !e.nextSelectedCardIds.includes(k)).map((k) => [k, void 0])
|
|
990
|
-
);
|
|
991
|
-
return e.nextSelectedCardIds.length > 0 && b.source.kind === "manual" && b.source.options.length > 0 && Object.assign(
|
|
992
|
-
v,
|
|
993
|
-
Ke({
|
|
994
|
-
control: b,
|
|
995
|
-
participants: y || [],
|
|
996
|
-
selectedCardIds: e.nextSelectedCardIds,
|
|
997
|
-
matrixTargetIds: e.matrixTargetIds
|
|
998
|
-
})
|
|
999
|
-
), {
|
|
1000
|
-
nextControl: b,
|
|
1001
|
-
cardBindingsById: v
|
|
1002
|
-
};
|
|
1003
|
-
}, F = U(
|
|
1004
|
-
(e, d = s, l = { type: "update" }) => {
|
|
1005
|
-
const b = e.map((v) => (Ne({
|
|
1006
|
-
control: v,
|
|
1007
|
-
defaultValues: d
|
|
1008
|
-
}), kt(
|
|
1009
|
-
v
|
|
1010
|
-
)));
|
|
1011
|
-
i(b, d, l);
|
|
1012
|
-
},
|
|
1013
|
-
[s, i]
|
|
1014
|
-
), H = (e, d) => {
|
|
1015
|
-
const l = a.find(
|
|
1016
|
-
(E) => E.id === e
|
|
1017
|
-
);
|
|
1018
|
-
let b = a.map((E) => E.id !== e ? E : d(E));
|
|
1019
|
-
const v = b.find(
|
|
1020
|
-
(E) => E.id === e
|
|
1021
|
-
);
|
|
1022
|
-
let k, g;
|
|
1023
|
-
if (v && (!l || Vt({ control: l }, { control: v })) && t === "dashboard" && (v.type === "field_selector" || v.type === "metric_selector")) {
|
|
1024
|
-
const E = (f == null ? void 0 : f[v.id]) || [], se = _({
|
|
1025
|
-
control: v,
|
|
1026
|
-
nextSelectedCardIds: E
|
|
1027
|
-
});
|
|
1028
|
-
b = b.map(
|
|
1029
|
-
(ae) => ae.id === e ? se.nextControl : ae
|
|
1030
|
-
), k = se.cardBindingsById, g = [v.id];
|
|
1031
|
-
} else if (l && (!v || !_t(v.type)) && t === "dashboard" && (l.type === "field_selector" || l.type === "metric_selector")) {
|
|
1032
|
-
const E = (f == null ? void 0 : f[l.id]) || [];
|
|
1033
|
-
k = Object.fromEntries(
|
|
1034
|
-
E.map((se) => [se, void 0])
|
|
1035
|
-
), g = [l.id];
|
|
1036
|
-
}
|
|
1037
|
-
const D = b.find(
|
|
1038
|
-
(E) => E.id === e
|
|
1039
|
-
);
|
|
1040
|
-
let A = s;
|
|
1041
|
-
if (l && D) {
|
|
1042
|
-
const E = Ne({
|
|
1043
|
-
control: l,
|
|
1044
|
-
defaultValues: s
|
|
1045
|
-
});
|
|
1046
|
-
l.source.kind === "manual" && D.source.kind === "sql_query" && (W.current[e] = E);
|
|
1047
|
-
const se = E === void 0 && l.source.kind === "sql_query" && D.source.kind === "manual" ? W.current[e] : E, ae = He({
|
|
1048
|
-
previousControl: l,
|
|
1049
|
-
nextControl: D,
|
|
1050
|
-
currentDefaultValue: se
|
|
1051
|
-
});
|
|
1052
|
-
D.source.kind === "manual" && (W.current[e] = ae), s && (A = { ...s }, ae === void 0 ? delete A[e] : A[e] = ae), b = b.map(
|
|
1053
|
-
(je) => je.id === e ? { ...D, defaultValue: ae } : je
|
|
1054
|
-
);
|
|
1055
|
-
}
|
|
1056
|
-
F(b, A, {
|
|
1057
|
-
type: "update",
|
|
1058
|
-
cardBindingsById: k,
|
|
1059
|
-
affectedBindingControlIds: g
|
|
1060
|
-
});
|
|
1061
|
-
}, L = (e, d) => {
|
|
1062
|
-
if (!d.trim())
|
|
1063
|
-
return;
|
|
1064
|
-
const l = Lt(d);
|
|
1065
|
-
if (l === e || V.has(l) || a.some(
|
|
1066
|
-
(k) => k.id === l && k.id !== e
|
|
1067
|
-
))
|
|
1068
|
-
return;
|
|
1069
|
-
const b = a.map(
|
|
1070
|
-
(k) => k.id === e ? { ...k, id: l } : k
|
|
1071
|
-
);
|
|
1072
|
-
if (!s) {
|
|
1073
|
-
F(b, void 0, {
|
|
1074
|
-
type: "rename",
|
|
1075
|
-
oldId: e,
|
|
1076
|
-
newId: l
|
|
1077
|
-
});
|
|
1078
|
-
return;
|
|
1079
|
-
}
|
|
1080
|
-
const v = { ...s };
|
|
1081
|
-
Object.prototype.hasOwnProperty.call(v, e) && (v[l] = v[e], delete v[e]), F(b, v, {
|
|
1082
|
-
type: "rename",
|
|
1083
|
-
oldId: e,
|
|
1084
|
-
newId: l
|
|
1085
|
-
});
|
|
1086
|
-
}, ge = (e) => {
|
|
1087
|
-
const d = a.filter((b) => b.id !== e);
|
|
1088
|
-
if (!s) {
|
|
1089
|
-
F(d, void 0, { type: "remove", controlId: e });
|
|
1090
|
-
return;
|
|
1091
|
-
}
|
|
1092
|
-
const l = { ...s };
|
|
1093
|
-
delete l[e], F(d, l, { type: "remove", controlId: e });
|
|
1094
|
-
}, ue = U(() => {
|
|
1095
|
-
O.current = void 0, w({
|
|
1096
|
-
step: 1,
|
|
1097
|
-
control: me(t, a, Array.from(V))
|
|
1098
|
-
}), I(null), $(null);
|
|
1099
|
-
}, [a, V, t]), B = (e) => {
|
|
1100
|
-
w(
|
|
1101
|
-
(d) => d && (() => {
|
|
1102
|
-
const l = e(d.control);
|
|
1103
|
-
d.control.source.kind === "manual" && l.source.kind === "sql_query" && (O.current = d.defaultValue);
|
|
1104
|
-
const b = d.defaultValue === void 0 && d.control.source.kind === "sql_query" && l.source.kind === "manual" ? O.current : d.defaultValue, v = He({
|
|
1105
|
-
previousControl: d.control,
|
|
1106
|
-
nextControl: l,
|
|
1107
|
-
currentDefaultValue: b
|
|
1108
|
-
});
|
|
1109
|
-
return l.source.kind === "manual" && (O.current = v), {
|
|
1110
|
-
...d,
|
|
1111
|
-
control: l,
|
|
1112
|
-
defaultValue: v
|
|
1113
|
-
};
|
|
1114
|
-
})()
|
|
1115
|
-
);
|
|
1116
|
-
}, le = (e) => {
|
|
1117
|
-
w(
|
|
1118
|
-
(d) => d && (d.control.source.kind === "manual" && (O.current = e), {
|
|
1119
|
-
...d,
|
|
1120
|
-
defaultValue: e
|
|
1121
|
-
})
|
|
1122
|
-
);
|
|
1123
|
-
}, ye = (() => {
|
|
1124
|
-
if (!n)
|
|
1125
|
-
return !1;
|
|
1126
|
-
if (n.step === 2 && M(n.control.type))
|
|
1127
|
-
return (n.selectedCardIds || []).length > 0 && Nt({
|
|
1128
|
-
participants: y || [],
|
|
1129
|
-
selectedCardIds: n.selectedCardIds || [],
|
|
1130
|
-
control: n.control,
|
|
1131
|
-
selected: n.matrixTargetIds
|
|
1132
|
-
});
|
|
1133
|
-
if (n.step !== 2 && n.step !== 3 || !n.control.label.trim())
|
|
1134
|
-
return !1;
|
|
1135
|
-
const d = n.control.source.kind === "sql_query" ? n.control : $e(n.control);
|
|
1136
|
-
if (d.source.kind === "manual" && (wt(d) && d.source.options.length === 0 || d.source.options.some(
|
|
1137
|
-
(b) => b.label.trim().length === 0 || b.value.trim().length === 0
|
|
1138
|
-
)))
|
|
1139
|
-
return !1;
|
|
1140
|
-
if (d.source.kind === "sql_query") {
|
|
1141
|
-
const { connectionId: l, sql: b, valueColumn: v } = d.source;
|
|
1142
|
-
return l.trim().length > 0 && b.trim().length > 0 && v.trim().length > 0;
|
|
1143
|
-
}
|
|
1144
|
-
return Dt(
|
|
1145
|
-
pe(d, n.defaultValue)
|
|
1146
|
-
);
|
|
1147
|
-
})(), Me = () => {
|
|
1148
|
-
var k;
|
|
1149
|
-
if (!n)
|
|
1150
|
-
return;
|
|
1151
|
-
const e = $e(n.control), d = Ft({
|
|
1152
|
-
label: e.label,
|
|
1153
|
-
fallbackId: e.id,
|
|
1154
|
-
existingControls: a,
|
|
1155
|
-
reservedIds: Array.from(V)
|
|
1156
|
-
}), l = {
|
|
1157
|
-
...e,
|
|
1158
|
-
id: d
|
|
1159
|
-
}, b = t === "dashboard" && (l.type === "field_selector" || l.type === "metric_selector") && ((k = n.selectedCardIds) != null && k.length) ? Ke({
|
|
1160
|
-
control: l,
|
|
1161
|
-
participants: y || [],
|
|
1162
|
-
selectedCardIds: n.selectedCardIds,
|
|
1163
|
-
matrixTargetIds: n.matrixTargetIds
|
|
1164
|
-
}) : void 0, v = pe(
|
|
1165
|
-
l,
|
|
1166
|
-
n.defaultValue
|
|
1167
|
-
);
|
|
1168
|
-
w({
|
|
1169
|
-
step: t === "dashboard" && (l.type === "field_selector" || l.type === "metric_selector") ? 4 : 3,
|
|
1170
|
-
control: l,
|
|
1171
|
-
defaultValue: v,
|
|
1172
|
-
createdControlId: d,
|
|
1173
|
-
selectedCardIds: n.selectedCardIds,
|
|
1174
|
-
matrixTargetIds: n.matrixTargetIds,
|
|
1175
|
-
cardBindingsById: b
|
|
1176
|
-
});
|
|
1177
|
-
}, xe = U(() => {
|
|
1178
|
-
w(null);
|
|
1179
|
-
}, []), Oe = U(() => {
|
|
1180
|
-
if (!(n != null && n.createdControlId)) {
|
|
1181
|
-
w(null);
|
|
1182
|
-
return;
|
|
1183
|
-
}
|
|
1184
|
-
const e = n.control, d = n.createdControlId, l = pe(
|
|
1185
|
-
e,
|
|
1186
|
-
n.defaultValue
|
|
1187
|
-
);
|
|
1188
|
-
if (s) {
|
|
1189
|
-
const b = { ...s };
|
|
1190
|
-
l === void 0 ? delete b[d] : b[d] = l, F(
|
|
1191
|
-
[
|
|
1192
|
-
...a,
|
|
1193
|
-
{
|
|
1194
|
-
...e,
|
|
1195
|
-
defaultValue: l
|
|
1196
|
-
}
|
|
1197
|
-
],
|
|
1198
|
-
b,
|
|
1199
|
-
{
|
|
1200
|
-
type: "add",
|
|
1201
|
-
cardBindingsById: n.cardBindingsById
|
|
1202
|
-
}
|
|
1203
|
-
);
|
|
1204
|
-
} else
|
|
1205
|
-
F(
|
|
1206
|
-
[
|
|
1207
|
-
...a,
|
|
1208
|
-
{
|
|
1209
|
-
...e,
|
|
1210
|
-
defaultValue: l
|
|
1211
|
-
}
|
|
1212
|
-
],
|
|
1213
|
-
void 0,
|
|
1214
|
-
{
|
|
1215
|
-
type: "add",
|
|
1216
|
-
cardBindingsById: n.cardBindingsById
|
|
1217
|
-
}
|
|
1218
|
-
);
|
|
1219
|
-
I(d), w(null), N == null || N();
|
|
1220
|
-
}, [a, n, s, F, N]), ht = n ? M(n.control.type) ? ["Choose type", "Select cards", "Configure", "Finish"] : ["Choose type", "Configure", "Finish"] : [], ze = n != null && n.createdControlId ? `[[param.${n.createdControlId}]]` : n ? `[[param.${Et(n.control.label) || n.control.id}]]` : "", ve = We({
|
|
1221
|
-
controls: a,
|
|
1222
|
-
defaultValues: s
|
|
1223
|
-
}), Ce = n ? [...a, n.control] : a, Ue = n ? We({
|
|
1224
|
-
controls: Ce,
|
|
1225
|
-
defaultValues: s,
|
|
1226
|
-
overrides: [
|
|
1227
|
-
{
|
|
1228
|
-
controlId: n.control.id,
|
|
1229
|
-
value: n.defaultValue
|
|
1230
|
-
}
|
|
1231
|
-
]
|
|
1232
|
-
}) : ve;
|
|
1233
|
-
return /* @__PURE__ */ p("div", { className: "space-y-4", children: [
|
|
1234
|
-
n ? /* @__PURE__ */ p("div", { className: "space-y-4 pb-1", children: [
|
|
1235
|
-
/* @__PURE__ */ r(
|
|
1236
|
-
va,
|
|
1237
|
-
{
|
|
1238
|
-
currentStep: n.step,
|
|
1239
|
-
labels: ht
|
|
1240
|
-
}
|
|
1241
|
-
),
|
|
1242
|
-
n.step === 1 && (() => {
|
|
1243
|
-
const e = /* @__PURE__ */ new Set([
|
|
1244
|
-
"grain_selector",
|
|
1245
|
-
"aggregation_selector",
|
|
1246
|
-
"field_selector",
|
|
1247
|
-
"metric_selector"
|
|
1248
|
-
]), d = /* @__PURE__ */ new Set([
|
|
1249
|
-
// Temporarily hide these from the add-control dialog while
|
|
1250
|
-
// keeping the shared definitions for existing controls.
|
|
1251
|
-
"date",
|
|
1252
|
-
"text"
|
|
1253
|
-
]), l = X.filter(
|
|
1254
|
-
(k) => !e.has(k.value) && !d.has(k.value)
|
|
1255
|
-
), b = X.filter(
|
|
1256
|
-
(k) => e.has(k.value)
|
|
1257
|
-
), v = (k) => /* @__PURE__ */ p(
|
|
1258
|
-
"button",
|
|
1259
|
-
{
|
|
1260
|
-
type: "button",
|
|
1261
|
-
className: "rounded-control border border-border/60 bg-background px-3 py-2.5 text-left transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:outline-none",
|
|
1262
|
-
onClick: () => w(
|
|
1263
|
-
ka({
|
|
1264
|
-
scope: t,
|
|
1265
|
-
existingControls: a,
|
|
1266
|
-
reservedIds: Array.from(V),
|
|
1267
|
-
type: k.value
|
|
1268
|
-
})
|
|
1269
|
-
),
|
|
1270
|
-
children: [
|
|
1271
|
-
/* @__PURE__ */ r("div", { className: "text-[13px] font-medium text-foreground", children: k.label }),
|
|
1272
|
-
/* @__PURE__ */ r("p", { className: "mt-0.5 text-[12px] text-muted-foreground", children: k.description })
|
|
1273
|
-
]
|
|
1274
|
-
},
|
|
1275
|
-
k.value
|
|
1276
|
-
);
|
|
1277
|
-
return /* @__PURE__ */ p("div", { className: "space-y-4", children: [
|
|
1278
|
-
t === "card" && (C == null ? void 0 : C.sql) == null ? /* @__PURE__ */ r("p", { className: "text-[12px] text-muted-foreground", children: "Explorer cards support displayed metric, group by field, aggregation, and time grain controls here." }) : null,
|
|
1279
|
-
l.length > 0 && /* @__PURE__ */ p("div", { className: "space-y-1.5", children: [
|
|
1280
|
-
/* @__PURE__ */ r("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Input controls" }),
|
|
1281
|
-
/* @__PURE__ */ r("div", { className: "grid gap-1.5 sm:grid-cols-2", children: l.map(v) })
|
|
1282
|
-
] }),
|
|
1283
|
-
b.length > 0 && /* @__PURE__ */ p("div", { className: "space-y-1.5", children: [
|
|
1284
|
-
/* @__PURE__ */ r("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Data-driven controls" }),
|
|
1285
|
-
/* @__PURE__ */ r("div", { className: "grid gap-1.5 sm:grid-cols-2", children: b.map(v) })
|
|
1286
|
-
] }),
|
|
1287
|
-
/* @__PURE__ */ r(
|
|
1288
|
-
he,
|
|
1289
|
-
{
|
|
1290
|
-
secondary: /* @__PURE__ */ r(
|
|
1291
|
-
q,
|
|
1292
|
-
{
|
|
1293
|
-
type: "button",
|
|
1294
|
-
variant: "outline",
|
|
1295
|
-
size: "xs",
|
|
1296
|
-
onClick: xe,
|
|
1297
|
-
children: "Back to controls"
|
|
1298
|
-
}
|
|
1299
|
-
)
|
|
1300
|
-
}
|
|
1301
|
-
)
|
|
1302
|
-
] });
|
|
1303
|
-
})(),
|
|
1304
|
-
n.step === 2 && M(n.control.type) && /* @__PURE__ */ p("div", { className: "space-y-3", children: [
|
|
1305
|
-
/* @__PURE__ */ p("div", { className: "space-y-3", children: [
|
|
1306
|
-
/* @__PURE__ */ r(
|
|
1307
|
-
ft,
|
|
1308
|
-
{
|
|
1309
|
-
control: n.control,
|
|
1310
|
-
onChange: (e) => B((d) => ({
|
|
1311
|
-
...d,
|
|
1312
|
-
label: e
|
|
1313
|
-
}))
|
|
1314
|
-
}
|
|
1315
|
-
),
|
|
1316
|
-
/* @__PURE__ */ r("p", { className: "text-[12px] text-muted-foreground", children: "Choose which cards should respond to this shared control." })
|
|
1317
|
-
] }),
|
|
1318
|
-
Y.length === 0 ? /* @__PURE__ */ r("div", { className: "rounded-control border border-border/60 bg-muted/30 px-3 py-2.5 text-[12px] text-muted-foreground", children: "No eligible cards are available yet. Add compatible metrics or group-by fields to cards first." }) : /* @__PURE__ */ r("div", { className: "space-y-1 rounded-control border border-border/60 bg-background p-2", children: Y.map((e) => {
|
|
1319
|
-
const d = (n.selectedCardIds || []).includes(e.cardId);
|
|
1320
|
-
return /* @__PURE__ */ p(
|
|
1321
|
-
"label",
|
|
1322
|
-
{
|
|
1323
|
-
className: "flex items-start gap-2 rounded-control px-1.5 py-1 text-[13px] hover:bg-muted/40",
|
|
1324
|
-
children: [
|
|
1325
|
-
/* @__PURE__ */ r(
|
|
1326
|
-
Gt,
|
|
1327
|
-
{
|
|
1328
|
-
checked: d,
|
|
1329
|
-
onCheckedChange: (l) => w(
|
|
1330
|
-
(b) => b && {
|
|
1331
|
-
...b,
|
|
1332
|
-
selectedCardIds: l === !0 ? [
|
|
1333
|
-
...b.selectedCardIds || [],
|
|
1334
|
-
e.cardId
|
|
1335
|
-
] : (b.selectedCardIds || []).filter(
|
|
1336
|
-
(v) => v !== e.cardId
|
|
1337
|
-
)
|
|
1338
|
-
}
|
|
1339
|
-
)
|
|
1340
|
-
}
|
|
1341
|
-
),
|
|
1342
|
-
/* @__PURE__ */ p("div", { className: "min-w-0", children: [
|
|
1343
|
-
/* @__PURE__ */ r("div", { className: "font-medium text-foreground", children: e.title }),
|
|
1344
|
-
/* @__PURE__ */ r("div", { className: "text-[12px] text-muted-foreground", children: n.control.type === "field_selector" ? `${e.fieldChoices.length} compatible group-by fields` : `${e.metricChoices.length} compatible metrics` })
|
|
1345
|
-
] })
|
|
1346
|
-
]
|
|
1347
|
-
},
|
|
1348
|
-
e.cardId
|
|
1349
|
-
);
|
|
1350
|
-
}) }),
|
|
1351
|
-
/* @__PURE__ */ r(
|
|
1352
|
-
Ye,
|
|
1353
|
-
{
|
|
1354
|
-
participants: Y,
|
|
1355
|
-
selectedCardIds: n.selectedCardIds || [],
|
|
1356
|
-
control: n.control,
|
|
1357
|
-
selected: n.matrixTargetIds,
|
|
1358
|
-
onChange: (e, d) => w((l) => l && { ...l, matrixTargetIds: { ...l.matrixTargetIds, [e]: d } })
|
|
1359
|
-
}
|
|
1360
|
-
),
|
|
1361
|
-
/* @__PURE__ */ r(
|
|
1362
|
-
he,
|
|
1363
|
-
{
|
|
1364
|
-
secondary: /* @__PURE__ */ r(
|
|
1365
|
-
q,
|
|
1366
|
-
{
|
|
1367
|
-
type: "button",
|
|
1368
|
-
variant: "outline",
|
|
1369
|
-
size: "xs",
|
|
1370
|
-
onClick: () => w(
|
|
1371
|
-
(e) => e && {
|
|
1372
|
-
...e,
|
|
1373
|
-
step: 1,
|
|
1374
|
-
selectedCardIds: []
|
|
1375
|
-
}
|
|
1376
|
-
),
|
|
1377
|
-
children: "Back"
|
|
1378
|
-
}
|
|
1379
|
-
),
|
|
1380
|
-
primary: /* @__PURE__ */ r(
|
|
1381
|
-
q,
|
|
1382
|
-
{
|
|
1383
|
-
type: "button",
|
|
1384
|
-
size: "xs",
|
|
1385
|
-
onClick: () => w(
|
|
1386
|
-
(e) => e && {
|
|
1387
|
-
...e,
|
|
1388
|
-
step: 3
|
|
1389
|
-
}
|
|
1390
|
-
),
|
|
1391
|
-
disabled: !ye,
|
|
1392
|
-
children: "Next"
|
|
1393
|
-
}
|
|
1394
|
-
)
|
|
1395
|
-
}
|
|
1396
|
-
)
|
|
1397
|
-
] }),
|
|
1398
|
-
n.step === 2 && !M(n.control.type) && /* @__PURE__ */ r(
|
|
1399
|
-
Xe,
|
|
1400
|
-
{
|
|
1401
|
-
control: n.control,
|
|
1402
|
-
defaultValue: n.defaultValue,
|
|
1403
|
-
availableFieldChoices: re.fields,
|
|
1404
|
-
availableMetricChoices: re.metrics,
|
|
1405
|
-
previewControlDefinitions: Ce,
|
|
1406
|
-
previewControlValues: Ue,
|
|
1407
|
-
onControlChange: (e) => B(() => e),
|
|
1408
|
-
onLabelChange: (e) => B((d) => ({
|
|
1409
|
-
...d,
|
|
1410
|
-
label: e
|
|
1411
|
-
})),
|
|
1412
|
-
onDefaultValueChange: le,
|
|
1413
|
-
onBack: () => w(
|
|
1414
|
-
(e) => e && {
|
|
1415
|
-
...e,
|
|
1416
|
-
step: 1
|
|
1417
|
-
}
|
|
1418
|
-
),
|
|
1419
|
-
onNext: Me,
|
|
1420
|
-
nextDisabled: !ye
|
|
1421
|
-
}
|
|
1422
|
-
),
|
|
1423
|
-
n.step === 3 && M(n.control.type) && /* @__PURE__ */ r(
|
|
1424
|
-
Xe,
|
|
1425
|
-
{
|
|
1426
|
-
control: n.control,
|
|
1427
|
-
defaultValue: n.defaultValue,
|
|
1428
|
-
availableFieldChoices: re.fields,
|
|
1429
|
-
availableMetricChoices: re.metrics,
|
|
1430
|
-
previewControlDefinitions: Ce,
|
|
1431
|
-
previewControlValues: Ue,
|
|
1432
|
-
onControlChange: (e) => B(() => e),
|
|
1433
|
-
onLabelChange: (e) => B((d) => ({
|
|
1434
|
-
...d,
|
|
1435
|
-
label: e
|
|
1436
|
-
})),
|
|
1437
|
-
onDefaultValueChange: le,
|
|
1438
|
-
onBack: () => w(
|
|
1439
|
-
(e) => e && {
|
|
1440
|
-
...e,
|
|
1441
|
-
step: 2
|
|
1442
|
-
}
|
|
1443
|
-
),
|
|
1444
|
-
onNext: Me,
|
|
1445
|
-
nextDisabled: !ye
|
|
1446
|
-
}
|
|
1447
|
-
),
|
|
1448
|
-
n.step === 3 && !M(n.control.type) && /* @__PURE__ */ r(
|
|
1449
|
-
Ze,
|
|
1450
|
-
{
|
|
1451
|
-
control: n.control,
|
|
1452
|
-
scope: t,
|
|
1453
|
-
createdReference: ze,
|
|
1454
|
-
explorerContent: /* @__PURE__ */ p(Z, { children: [
|
|
1455
|
-
"Open the card and use",
|
|
1456
|
-
" ",
|
|
1457
|
-
/* @__PURE__ */ r("span", { className: "font-medium text-foreground", children: "Settings → Controls" }),
|
|
1458
|
-
" ",
|
|
1459
|
-
"to choose what this control changes."
|
|
1460
|
-
] }),
|
|
1461
|
-
sqlDescription: "Reference this control directly in the SQL editor.",
|
|
1462
|
-
onBack: () => w(
|
|
1463
|
-
(e) => e && {
|
|
1464
|
-
...e,
|
|
1465
|
-
step: 2
|
|
1466
|
-
}
|
|
1467
|
-
),
|
|
1468
|
-
onCancel: xe,
|
|
1469
|
-
onDone: Oe
|
|
1470
|
-
}
|
|
1471
|
-
),
|
|
1472
|
-
n.step === 4 && M(n.control.type) && /* @__PURE__ */ r(
|
|
1473
|
-
Ze,
|
|
1474
|
-
{
|
|
1475
|
-
control: n.control,
|
|
1476
|
-
scope: t,
|
|
1477
|
-
createdReference: ze,
|
|
1478
|
-
summaryDetail: /* @__PURE__ */ p(Z, { children: [
|
|
1479
|
-
"Used by ",
|
|
1480
|
-
(n.selectedCardIds || []).length,
|
|
1481
|
-
" selected card",
|
|
1482
|
-
(n.selectedCardIds || []).length === 1 ? "" : "s"
|
|
1483
|
-
] }),
|
|
1484
|
-
explorerContent: /* @__PURE__ */ r(Z, { children: "Selected cards have been set up to respond to this control automatically." }),
|
|
1485
|
-
sqlDescription: "SQL cards can still reference this control directly in the SQL editor.",
|
|
1486
|
-
onBack: () => w(
|
|
1487
|
-
(e) => e && {
|
|
1488
|
-
...e,
|
|
1489
|
-
step: 3
|
|
1490
|
-
}
|
|
1491
|
-
),
|
|
1492
|
-
onCancel: xe,
|
|
1493
|
-
onDone: Oe
|
|
1494
|
-
}
|
|
1495
|
-
)
|
|
1496
|
-
] }) : null,
|
|
1497
|
-
!n && a.length === 0 ? /* @__PURE__ */ r("div", { className: "rounded-md border border-dashed p-3 text-sm text-muted-foreground", children: c }) : null,
|
|
1498
|
-
!n && a.map((e) => {
|
|
1499
|
-
const d = be(e), l = h == null ? void 0 : h[e.id], b = Ne({
|
|
1500
|
-
control: e,
|
|
1501
|
-
defaultValues: s
|
|
1502
|
-
}), v = ee === e.id, k = "inline-flex shrink-0 items-center rounded-[4px] border border-border/60 bg-muted/40 px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground";
|
|
1503
|
-
return /* @__PURE__ */ p(
|
|
1504
|
-
"div",
|
|
1505
|
-
{
|
|
1506
|
-
className: "rounded-control border border-border/60",
|
|
1507
|
-
children: [
|
|
1508
|
-
/* @__PURE__ */ p("div", { className: "flex items-center gap-2 px-3 py-2.5", children: [
|
|
1509
|
-
/* @__PURE__ */ p(
|
|
1510
|
-
"button",
|
|
1511
|
-
{
|
|
1512
|
-
type: "button",
|
|
1513
|
-
className: "flex min-w-0 flex-1 items-start gap-2 rounded-control text-left focus:outline-none focus-visible:bg-muted/40",
|
|
1514
|
-
onClick: () => I(
|
|
1515
|
-
(g) => g === e.id ? null : e.id
|
|
1516
|
-
),
|
|
1517
|
-
children: [
|
|
1518
|
-
v ? /* @__PURE__ */ r(Qe, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }) : /* @__PURE__ */ r(Ge, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
1519
|
-
/* @__PURE__ */ p("div", { className: "min-w-0", children: [
|
|
1520
|
-
/* @__PURE__ */ p("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
1521
|
-
/* @__PURE__ */ r("span", { className: "truncate text-[13px] font-medium text-foreground", children: e.label || "Untitled control" }),
|
|
1522
|
-
/* @__PURE__ */ r("span", { className: k, children: tt(e.type).label }),
|
|
1523
|
-
/* @__PURE__ */ r("span", { className: k, children: at(t, e.placement) })
|
|
1524
|
-
] }),
|
|
1525
|
-
/* @__PURE__ */ p("div", { className: "mt-0.5 text-[12px] text-muted-foreground", children: [
|
|
1526
|
-
rt(e),
|
|
1527
|
-
l != null && l.status ? ` · ${l.status}` : ""
|
|
1528
|
-
] })
|
|
1529
|
-
] })
|
|
1530
|
-
]
|
|
1531
|
-
}
|
|
1532
|
-
),
|
|
1533
|
-
/* @__PURE__ */ r(
|
|
1534
|
-
q,
|
|
1535
|
-
{
|
|
1536
|
-
type: "button",
|
|
1537
|
-
size: "xs",
|
|
1538
|
-
variant: "ghost",
|
|
1539
|
-
className: "h-7 w-7 shrink-0 p-0 text-muted-foreground",
|
|
1540
|
-
onClick: () => ge(e.id),
|
|
1541
|
-
"aria-label": `Remove ${e.label}`,
|
|
1542
|
-
children: /* @__PURE__ */ r(Pt, { className: "h-3.5 w-3.5" })
|
|
1543
|
-
}
|
|
1544
|
-
)
|
|
1545
|
-
] }),
|
|
1546
|
-
v && /* @__PURE__ */ p("div", { className: "space-y-4 border-t border-border/60 px-3 py-3", children: [
|
|
1547
|
-
/* @__PURE__ */ p("div", { className: "grid gap-3 md:grid-cols-3", children: [
|
|
1548
|
-
/* @__PURE__ */ p("div", { className: "flex flex-col gap-1.5", children: [
|
|
1549
|
-
/* @__PURE__ */ r(ne, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Label" }),
|
|
1550
|
-
/* @__PURE__ */ r(
|
|
1551
|
-
st,
|
|
1552
|
-
{
|
|
1553
|
-
size: "xs",
|
|
1554
|
-
value: e.label,
|
|
1555
|
-
placeholder: "Control label",
|
|
1556
|
-
onChange: (g) => H(e.id, (D) => ({
|
|
1557
|
-
...D,
|
|
1558
|
-
label: g.target.value
|
|
1559
|
-
}))
|
|
1560
|
-
}
|
|
1561
|
-
)
|
|
1562
|
-
] }),
|
|
1563
|
-
/* @__PURE__ */ p("div", { className: "flex flex-col gap-1.5", children: [
|
|
1564
|
-
/* @__PURE__ */ r(ne, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Type" }),
|
|
1565
|
-
/* @__PURE__ */ p(
|
|
1566
|
-
we,
|
|
1567
|
-
{
|
|
1568
|
-
value: e.type,
|
|
1569
|
-
onValueChange: (g) => {
|
|
1570
|
-
const D = nt({
|
|
1571
|
-
controls: a,
|
|
1572
|
-
controlId: e.id,
|
|
1573
|
-
nextType: g,
|
|
1574
|
-
defaultValues: s
|
|
1575
|
-
});
|
|
1576
|
-
F(D.controls, D.defaultValues);
|
|
1577
|
-
},
|
|
1578
|
-
children: [
|
|
1579
|
-
/* @__PURE__ */ r(De, { size: "xs", children: /* @__PURE__ */ r(Ee, {}) }),
|
|
1580
|
-
/* @__PURE__ */ r(Te, { children: te(e.type).map(
|
|
1581
|
-
(g) => /* @__PURE__ */ r(
|
|
1582
|
-
Ie,
|
|
1583
|
-
{
|
|
1584
|
-
value: g.value,
|
|
1585
|
-
children: g.label
|
|
1586
|
-
},
|
|
1587
|
-
g.value
|
|
1588
|
-
)
|
|
1589
|
-
) })
|
|
1590
|
-
]
|
|
1591
|
-
}
|
|
1592
|
-
)
|
|
1593
|
-
] }),
|
|
1594
|
-
/* @__PURE__ */ p("div", { className: "flex flex-col gap-1.5", children: [
|
|
1595
|
-
/* @__PURE__ */ r(ne, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Show in" }),
|
|
1596
|
-
/* @__PURE__ */ p(
|
|
1597
|
-
we,
|
|
1598
|
-
{
|
|
1599
|
-
value: e.placement || G,
|
|
1600
|
-
onValueChange: (g) => H(e.id, (D) => ({
|
|
1601
|
-
...D,
|
|
1602
|
-
placement: g
|
|
1603
|
-
})),
|
|
1604
|
-
children: [
|
|
1605
|
-
/* @__PURE__ */ r(De, { size: "xs", children: /* @__PURE__ */ r(Ee, {}) }),
|
|
1606
|
-
/* @__PURE__ */ r(Te, { children: Q.map((g) => /* @__PURE__ */ r(Ie, { value: g.value, children: g.label }, g.value)) })
|
|
1607
|
-
]
|
|
1608
|
-
}
|
|
1609
|
-
)
|
|
1610
|
-
] })
|
|
1611
|
-
] }),
|
|
1612
|
-
M(e.type) ? /* @__PURE__ */ p(Z, { children: [
|
|
1613
|
-
/* @__PURE__ */ r(
|
|
1614
|
-
Xt,
|
|
1615
|
-
{
|
|
1616
|
-
type: e.type,
|
|
1617
|
-
participants: Be(
|
|
1618
|
-
y || [],
|
|
1619
|
-
e.type
|
|
1620
|
-
).map((g) => ({
|
|
1621
|
-
cardId: g.cardId,
|
|
1622
|
-
title: g.title,
|
|
1623
|
-
choiceCount: e.type === "field_selector" ? g.fieldChoices.length : g.metricChoices.length
|
|
1624
|
-
})),
|
|
1625
|
-
selectedCardIds: (f == null ? void 0 : f[e.id]) || [],
|
|
1626
|
-
onChange: (g) => {
|
|
1627
|
-
const D = _({
|
|
1628
|
-
control: e,
|
|
1629
|
-
nextSelectedCardIds: g
|
|
1630
|
-
}), A = a.map(
|
|
1631
|
-
(E) => E.id === e.id ? D.nextControl : E
|
|
1632
|
-
);
|
|
1633
|
-
F(A, s, {
|
|
1634
|
-
type: "update",
|
|
1635
|
-
cardBindingsById: D.cardBindingsById
|
|
1636
|
-
});
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
),
|
|
1640
|
-
/* @__PURE__ */ r(
|
|
1641
|
-
Ye,
|
|
1642
|
-
{
|
|
1643
|
-
participants: y || [],
|
|
1644
|
-
selectedCardIds: (f == null ? void 0 : f[e.id]) || [],
|
|
1645
|
-
control: e,
|
|
1646
|
-
onChange: (g, D) => {
|
|
1647
|
-
const A = _({
|
|
1648
|
-
control: e,
|
|
1649
|
-
nextSelectedCardIds: (f == null ? void 0 : f[e.id]) || [],
|
|
1650
|
-
matrixTargetIds: { [g]: D }
|
|
1651
|
-
});
|
|
1652
|
-
F(
|
|
1653
|
-
a.map((E) => E.id === e.id ? A.nextControl : E),
|
|
1654
|
-
s,
|
|
1655
|
-
{ type: "update", cardBindingsById: A.cardBindingsById }
|
|
1656
|
-
);
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
)
|
|
1660
|
-
] }) : null,
|
|
1661
|
-
/* @__PURE__ */ r(
|
|
1662
|
-
dt,
|
|
1663
|
-
{
|
|
1664
|
-
control: e,
|
|
1665
|
-
availableFieldChoices: d.fields,
|
|
1666
|
-
availableMetricChoices: d.metrics,
|
|
1667
|
-
previewControlDefinitions: a,
|
|
1668
|
-
previewControlValues: ve,
|
|
1669
|
-
controlLifecycle: "edit",
|
|
1670
|
-
onChange: (g) => H(e.id, () => g)
|
|
1671
|
-
}
|
|
1672
|
-
),
|
|
1673
|
-
e.initialValueStrategy === "saved_default" && /* @__PURE__ */ r(
|
|
1674
|
-
ct,
|
|
1675
|
-
{
|
|
1676
|
-
control: e,
|
|
1677
|
-
value: b,
|
|
1678
|
-
allowNoDefault: !0,
|
|
1679
|
-
allowCardDefault: !0,
|
|
1680
|
-
previewControlDefinitions: a,
|
|
1681
|
-
previewControlValues: ve,
|
|
1682
|
-
onChange: (g) => {
|
|
1683
|
-
const D = a.map(
|
|
1684
|
-
(A) => A.id === e.id ? { ...A, defaultValue: g } : A
|
|
1685
|
-
);
|
|
1686
|
-
if (e.source.kind === "manual" && (W.current[e.id] = g), s) {
|
|
1687
|
-
const A = { ...s };
|
|
1688
|
-
g === void 0 ? delete A[e.id] : A[e.id] = g, F(D, A);
|
|
1689
|
-
return;
|
|
1690
|
-
}
|
|
1691
|
-
F(D, void 0);
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
),
|
|
1695
|
-
/* @__PURE__ */ p(
|
|
1696
|
-
Jt,
|
|
1697
|
-
{
|
|
1698
|
-
open: R === e.id,
|
|
1699
|
-
onOpenChange: (g) => $(g ? e.id : null),
|
|
1700
|
-
children: [
|
|
1701
|
-
/* @__PURE__ */ r(Zt, { asChild: !0, children: /* @__PURE__ */ p(
|
|
1702
|
-
q,
|
|
1703
|
-
{
|
|
1704
|
-
type: "button",
|
|
1705
|
-
variant: "ghost",
|
|
1706
|
-
size: "xs",
|
|
1707
|
-
className: "-ml-2 gap-1 text-muted-foreground hover:text-foreground",
|
|
1708
|
-
children: [
|
|
1709
|
-
R === e.id ? /* @__PURE__ */ r(Qe, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ r(Ge, { className: "h-3.5 w-3.5" }),
|
|
1710
|
-
"Advanced"
|
|
1711
|
-
]
|
|
1712
|
-
}
|
|
1713
|
-
) }),
|
|
1714
|
-
/* @__PURE__ */ p(ea, { className: "space-y-3 pt-2", children: [
|
|
1715
|
-
/* @__PURE__ */ p("div", { className: "grid gap-3 md:grid-cols-2", children: [
|
|
1716
|
-
/* @__PURE__ */ p("div", { className: "flex flex-col gap-1.5", children: [
|
|
1717
|
-
/* @__PURE__ */ r(ne, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Variable name" }),
|
|
1718
|
-
/* @__PURE__ */ r(
|
|
1719
|
-
ta,
|
|
1720
|
-
{
|
|
1721
|
-
controlId: e.id,
|
|
1722
|
-
onCommit: (g) => L(e.id, g)
|
|
1723
|
-
},
|
|
1724
|
-
e.id
|
|
1725
|
-
)
|
|
1726
|
-
] }),
|
|
1727
|
-
/* @__PURE__ */ p("div", { className: "flex flex-col gap-1.5", children: [
|
|
1728
|
-
/* @__PURE__ */ r(ne, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Initial value" }),
|
|
1729
|
-
/* @__PURE__ */ p(
|
|
1730
|
-
we,
|
|
1731
|
-
{
|
|
1732
|
-
value: e.initialValueStrategy,
|
|
1733
|
-
onValueChange: (g) => H(e.id, (D) => ({
|
|
1734
|
-
...D,
|
|
1735
|
-
initialValueStrategy: g
|
|
1736
|
-
})),
|
|
1737
|
-
children: [
|
|
1738
|
-
/* @__PURE__ */ r(De, { size: "xs", children: /* @__PURE__ */ r(Ee, {}) }),
|
|
1739
|
-
/* @__PURE__ */ r(Te, { children: It.map((g) => /* @__PURE__ */ r(
|
|
1740
|
-
Ie,
|
|
1741
|
-
{
|
|
1742
|
-
value: g.value,
|
|
1743
|
-
children: g.label
|
|
1744
|
-
},
|
|
1745
|
-
g.value
|
|
1746
|
-
)) })
|
|
1747
|
-
]
|
|
1748
|
-
}
|
|
1749
|
-
)
|
|
1750
|
-
] })
|
|
1751
|
-
] }),
|
|
1752
|
-
/* @__PURE__ */ r(
|
|
1753
|
-
aa,
|
|
1754
|
-
{
|
|
1755
|
-
control: e,
|
|
1756
|
-
onChange: (g) => H(e.id, () => g)
|
|
1757
|
-
}
|
|
1758
|
-
)
|
|
1759
|
-
] })
|
|
1760
|
-
]
|
|
1761
|
-
}
|
|
1762
|
-
)
|
|
1763
|
-
] })
|
|
1764
|
-
]
|
|
1765
|
-
},
|
|
1766
|
-
e.id
|
|
1767
|
-
);
|
|
1768
|
-
}),
|
|
1769
|
-
!n && /* @__PURE__ */ p(
|
|
1770
|
-
q,
|
|
1771
|
-
{
|
|
1772
|
-
type: "button",
|
|
1773
|
-
variant: "outline",
|
|
1774
|
-
size: "xs",
|
|
1775
|
-
onClick: ue,
|
|
1776
|
-
children: [
|
|
1777
|
-
/* @__PURE__ */ r(ra, { className: "h-3.5 w-3.5" }),
|
|
1778
|
-
"Add control"
|
|
1779
|
-
]
|
|
1780
|
-
}
|
|
1781
|
-
)
|
|
1782
|
-
] });
|
|
1783
|
-
}
|
|
1784
|
-
function ja(t) {
|
|
1785
|
-
const {
|
|
1786
|
-
open: a,
|
|
1787
|
-
onOpenChange: o,
|
|
1788
|
-
initialCreateFlowActive: s = !1,
|
|
1789
|
-
dismissMode: i = "passive"
|
|
1790
|
-
} = t, c = a !== void 0, [m, h] = K(!1), [u, x] = K(
|
|
1791
|
-
s
|
|
1792
|
-
), y = c ? a : m, f = U(
|
|
1793
|
-
(S) => {
|
|
1794
|
-
!S && u && i === "passive" || (c || h(S), S || x(!1), o == null || o(S));
|
|
1795
|
-
},
|
|
1796
|
-
[c, u, i, o]
|
|
1797
|
-
), C = U(() => {
|
|
1798
|
-
c || h(!1), x(!1), o == null || o(!1);
|
|
1799
|
-
}, [c, o]);
|
|
1800
|
-
ie(() => {
|
|
1801
|
-
y || x(!1);
|
|
1802
|
-
}, [y]);
|
|
1803
|
-
const T = U(
|
|
1804
|
-
(S) => {
|
|
1805
|
-
u && S.preventDefault();
|
|
1806
|
-
},
|
|
1807
|
-
[u]
|
|
1808
|
-
);
|
|
1809
|
-
return {
|
|
1810
|
-
forceClose: C,
|
|
1811
|
-
handleOpenChange: f,
|
|
1812
|
-
isCreateFlowActive: u,
|
|
1813
|
-
preventPassiveDismissDuringCreate: T,
|
|
1814
|
-
resolvedOpen: y,
|
|
1815
|
-
setIsCreateFlowActive: x
|
|
1816
|
-
};
|
|
1817
|
-
}
|
|
1818
|
-
function qe(t) {
|
|
1819
|
-
var a;
|
|
1820
|
-
for (const o of t.cards)
|
|
1821
|
-
if (o.type === "matrixTable" && !oa.safeParse((a = o.config) == null ? void 0 : a.matrix).success)
|
|
1822
|
-
return j.error("Matrix requires at least one row field, one metric, and valid settings."), !1;
|
|
1823
|
-
return !0;
|
|
1824
|
-
}
|
|
1825
|
-
function Qa({
|
|
1826
|
-
className: t,
|
|
1827
|
-
variant: a = "outline"
|
|
1828
|
-
}) {
|
|
1829
|
-
const o = z((c) => c.onSave), { getUpdatedFrame: s } = Le();
|
|
1830
|
-
function i() {
|
|
1831
|
-
const c = s();
|
|
1832
|
-
qe(c) && (o == null || o(c));
|
|
1833
|
-
}
|
|
1834
|
-
return /* @__PURE__ */ p(
|
|
1835
|
-
q,
|
|
1836
|
-
{
|
|
1837
|
-
onClick: i,
|
|
1838
|
-
className: t,
|
|
1839
|
-
size: "xs",
|
|
1840
|
-
variant: a,
|
|
1841
|
-
children: [
|
|
1842
|
-
/* @__PURE__ */ r(qt, { className: "h-3.5 w-3.5" }),
|
|
1843
|
-
"Accept"
|
|
1844
|
-
]
|
|
1845
|
-
}
|
|
1846
|
-
);
|
|
1847
|
-
}
|
|
1848
|
-
function Ra({
|
|
1849
|
-
className: t,
|
|
1850
|
-
variant: a = "default"
|
|
1851
|
-
}) {
|
|
1852
|
-
const o = ce(), [s, i] = K(!1), { setIsVisualEditing: c } = _e(), { getUpdatedFrame: m } = Le(), h = Ae(), u = z((f) => f.frame), x = ut();
|
|
1853
|
-
return /* @__PURE__ */ r(
|
|
1854
|
-
q,
|
|
1855
|
-
{
|
|
1856
|
-
onClick: () => {
|
|
1857
|
-
const f = m();
|
|
1858
|
-
if (!qe(f))
|
|
1859
|
-
return;
|
|
1860
|
-
const C = (u == null ? void 0 : u.visualId) || (h == null ? void 0 : h.id);
|
|
1861
|
-
if (!C) {
|
|
1862
|
-
j.error("No visual to save");
|
|
1863
|
-
return;
|
|
1864
|
-
}
|
|
1865
|
-
i(!0), x.mutate(
|
|
1866
|
-
{
|
|
1867
|
-
visualId: C,
|
|
1868
|
-
data: {
|
|
1869
|
-
frameObject: f
|
|
1870
|
-
}
|
|
1871
|
-
},
|
|
1872
|
-
{
|
|
1873
|
-
onSuccess: () => {
|
|
1874
|
-
i(!1), j.success("Visual updated successfully"), o.invalidateQueries({
|
|
1875
|
-
queryKey: ["resource-by-id", "visual", C],
|
|
1876
|
-
exact: !0
|
|
1877
|
-
});
|
|
1878
|
-
},
|
|
1879
|
-
onError: () => {
|
|
1880
|
-
i(!1), j.error("Failed to update visual");
|
|
1881
|
-
}
|
|
1882
|
-
}
|
|
1883
|
-
);
|
|
1884
|
-
},
|
|
1885
|
-
className: t,
|
|
1886
|
-
size: "xs",
|
|
1887
|
-
variant: a,
|
|
1888
|
-
children: s ? /* @__PURE__ */ p(Z, { children: [
|
|
1889
|
-
/* @__PURE__ */ r(ot, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1890
|
-
"Saving"
|
|
1891
|
-
] }) : /* @__PURE__ */ p(Z, { children: [
|
|
1892
|
-
/* @__PURE__ */ r(mt, { className: "h-3.5 w-3.5" }),
|
|
1893
|
-
"Save to Library"
|
|
1894
|
-
] })
|
|
1895
|
-
}
|
|
1896
|
-
);
|
|
1897
|
-
}
|
|
1898
|
-
function Ba({
|
|
1899
|
-
className: t
|
|
1900
|
-
}) {
|
|
1901
|
-
const a = ce(), [o, s] = K(!1), i = Ae(), c = z((S) => S.frame), m = J((S) => S.selectedSheetId), h = J((S) => S.dashboard), { updateFrame: u, setIsVisualEditing: x } = _e(), { getUpdatedFrame: y } = Le(), f = ut(), C = na();
|
|
1902
|
-
return /* @__PURE__ */ r(
|
|
1903
|
-
q,
|
|
1904
|
-
{
|
|
1905
|
-
onClick: async () => {
|
|
1906
|
-
if (!m) {
|
|
1907
|
-
j.error("No sheet selected");
|
|
1908
|
-
return;
|
|
1909
|
-
}
|
|
1910
|
-
const S = (c == null ? void 0 : c.visualId) || (i == null ? void 0 : i.id);
|
|
1911
|
-
if (!S) {
|
|
1912
|
-
j.error("No visual to update");
|
|
1913
|
-
return;
|
|
1914
|
-
}
|
|
1915
|
-
s(!0);
|
|
1916
|
-
try {
|
|
1917
|
-
const N = y();
|
|
1918
|
-
if (!qe(N)) {
|
|
1919
|
-
s(!1);
|
|
1920
|
-
return;
|
|
1921
|
-
}
|
|
1922
|
-
const V = {
|
|
1923
|
-
...N,
|
|
1924
|
-
visualId: S
|
|
1925
|
-
// Keep the link to library visual
|
|
1926
|
-
}, Q = Mt(h, V.id), G = await C(V, {
|
|
1927
|
-
previousFrame: Q
|
|
1928
|
-
});
|
|
1929
|
-
await f.mutateAsync({
|
|
1930
|
-
visualId: S,
|
|
1931
|
-
data: {
|
|
1932
|
-
frameObject: N
|
|
1933
|
-
}
|
|
1934
|
-
}), u(m, V, {
|
|
1935
|
-
semanticExecutionPayload: G
|
|
1936
|
-
}), a.invalidateQueries({ queryKey: ["visuals"] }), a.invalidateQueries({ queryKey: ["visual", S] }), j.success("Saved to library and applied locally"), setTimeout(() => {
|
|
1937
|
-
x(!1);
|
|
1938
|
-
}, 300);
|
|
1939
|
-
} catch (N) {
|
|
1940
|
-
console.error("Failed to save and apply:", N), j.error(
|
|
1941
|
-
N instanceof Error ? N.message : "Failed to save and apply changes"
|
|
1942
|
-
);
|
|
1943
|
-
} finally {
|
|
1944
|
-
s(!1);
|
|
1945
|
-
}
|
|
1946
|
-
},
|
|
1947
|
-
className: t,
|
|
1948
|
-
size: "xs",
|
|
1949
|
-
variant: "default",
|
|
1950
|
-
disabled: o,
|
|
1951
|
-
children: o ? /* @__PURE__ */ p(Z, { children: [
|
|
1952
|
-
/* @__PURE__ */ r(ot, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1953
|
-
"Saving..."
|
|
1954
|
-
] }) : /* @__PURE__ */ p(Z, { children: [
|
|
1955
|
-
/* @__PURE__ */ r(mt, { className: "h-3.5 w-3.5" }),
|
|
1956
|
-
"Save & Apply"
|
|
1957
|
-
] })
|
|
1958
|
-
}
|
|
1959
|
-
);
|
|
1960
|
-
}
|
|
1961
|
-
function $a({ className: t }) {
|
|
1962
|
-
const { setTempQueryData: a, setSqlGen: o } = de(), s = ce(), i = z((f) => f.tempQueryData), c = z((f) => f.onClose), m = z((f) => f.card), h = lt(), u = oe(() => h !== m.type ? { ...m, type: h } : m, [m, h]), { queryKey: x } = it(u);
|
|
1963
|
-
function y() {
|
|
1964
|
-
if (i) {
|
|
1965
|
-
const { queryKey: f, queryData: C } = i;
|
|
1966
|
-
f && C && s.setQueryData(f, C);
|
|
1967
|
-
}
|
|
1968
|
-
o({}), c == null || c();
|
|
1969
|
-
}
|
|
1970
|
-
return /* @__PURE__ */ p(
|
|
1971
|
-
q,
|
|
1972
|
-
{
|
|
1973
|
-
onClick: y,
|
|
1974
|
-
className: t,
|
|
1975
|
-
size: "xs",
|
|
1976
|
-
variant: "outline",
|
|
1977
|
-
children: [
|
|
1978
|
-
/* @__PURE__ */ r(et, { className: "h-3.5 w-3.5" }),
|
|
1979
|
-
"Close"
|
|
1980
|
-
]
|
|
1981
|
-
}
|
|
1982
|
-
);
|
|
1983
|
-
}
|
|
1984
|
-
function Wa({
|
|
1985
|
-
label: t = "Clear",
|
|
1986
|
-
variant: a = "secondary",
|
|
1987
|
-
className: o
|
|
1988
|
-
} = {}) {
|
|
1989
|
-
const s = xa();
|
|
1990
|
-
return /* @__PURE__ */ p(
|
|
1991
|
-
q,
|
|
1992
|
-
{
|
|
1993
|
-
onClick: s,
|
|
1994
|
-
className: o,
|
|
1995
|
-
size: "xs",
|
|
1996
|
-
variant: a,
|
|
1997
|
-
children: [
|
|
1998
|
-
/* @__PURE__ */ r(et, { className: "h-3.5 w-3.5" }),
|
|
1999
|
-
t
|
|
2000
|
-
]
|
|
2001
|
-
}
|
|
2002
|
-
);
|
|
2003
|
-
}
|
|
2004
|
-
export {
|
|
2005
|
-
Ua as C,
|
|
2006
|
-
Qa as E,
|
|
2007
|
-
Ma as F,
|
|
2008
|
-
ia as L,
|
|
2009
|
-
za as V,
|
|
2010
|
-
$a as a,
|
|
2011
|
-
Ra as b,
|
|
2012
|
-
Ba as c,
|
|
2013
|
-
da as d,
|
|
2014
|
-
ja as e,
|
|
2015
|
-
Oa as f,
|
|
2016
|
-
xa as g,
|
|
2017
|
-
Wa as h,
|
|
2018
|
-
Le as u
|
|
2019
|
-
};
|