deepspotscreen-sdk 0.0.1
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/README.md +485 -0
- package/dist/DeepspotSDK-CyX06_c2.js +1486 -0
- package/dist/DeepspotSDK-g7o9tAip.cjs +546 -0
- package/dist/_commonjsHelpers-MeVG4QFm.cjs +1 -0
- package/dist/_commonjsHelpers-bAxELxBV.js +8 -0
- package/dist/apexcharts.common-DGzslxI3.cjs +808 -0
- package/dist/apexcharts.common-k3hLWpB8.js +8956 -0
- package/dist/components/DashboardElement.d.ts +18 -0
- package/dist/components/ReportElement.d.ts +15 -0
- package/dist/core/ApiClient.d.ts +41 -0
- package/dist/core/DeepspotSDK.d.ts +11 -0
- package/dist/core/EmbedInstance.d.ts +46 -0
- package/dist/deepspot-sdk.esm.js +1704 -0
- package/dist/deepspot-sdk.js +1655 -0
- package/dist/html2canvas.esm-CzwMv54K.js +4870 -0
- package/dist/html2canvas.esm-EoNFmhrp.cjs +22 -0
- package/dist/index.d.ts +146 -0
- package/dist/index.es-C-ai08UC.js +5632 -0
- package/dist/index.es-ELJ1Oc0z.cjs +18 -0
- package/dist/index.es-TiU5c3LF.js +5632 -0
- package/dist/jspdf.es.min-D6GjoB2T.cjs +243 -0
- package/dist/jspdf.es.min-Ge0fRUwj.js +8107 -0
- package/dist/jspdf.es.min-d9hlG26J.js +8107 -0
- package/dist/layout/GridLayout.d.ts +25 -0
- package/dist/purify.es-CuxL4pit.js +471 -0
- package/dist/purify.es-D_pYQKft.cjs +3 -0
- package/dist/react/index.cjs +1 -0
- package/dist/react/index.d.ts +33 -0
- package/dist/react/index.mjs +188 -0
- package/dist/renderer/CardRenderer.d.ts +6 -0
- package/dist/renderer/ChartRenderer.d.ts +19 -0
- package/dist/renderer/DashboardRenderer.d.ts +64 -0
- package/dist/renderer/FilterRenderer.d.ts +20 -0
- package/dist/renderer/ReportRenderer.d.ts +14 -0
- package/dist/renderer/TableRenderer.d.ts +8 -0
- package/dist/types.d.ts +140 -0
- package/dist/utils.d.ts +4 -0
- package/dist/vue/index.cjs +1 -0
- package/dist/vue/index.d.ts +212 -0
- package/dist/vue/index.mjs +138 -0
- package/package.json +69 -0
|
@@ -0,0 +1,1704 @@
|
|
|
1
|
+
class S {
|
|
2
|
+
constructor(e, t) {
|
|
3
|
+
this.tokenCache = /* @__PURE__ */ new Map(), this.baseUrl = e.replace(/\/$/, ""), this.apiKey = t;
|
|
4
|
+
}
|
|
5
|
+
// ── Embed Token ─────────────────────────────────────────────────────────────
|
|
6
|
+
async getEmbedToken(e) {
|
|
7
|
+
var i, a, d, o;
|
|
8
|
+
const t = [
|
|
9
|
+
e.dashboardId,
|
|
10
|
+
e.embedType,
|
|
11
|
+
(i = e.embedLevel) != null ? i : "",
|
|
12
|
+
(a = e.componentId) != null ? a : "",
|
|
13
|
+
(d = e.userId) != null ? d : ""
|
|
14
|
+
].join(":"), s = this.tokenCache.get(t);
|
|
15
|
+
if (s && s.expiresAt > Date.now() + 6e4) return s.token;
|
|
16
|
+
const r = await this.post(
|
|
17
|
+
"/dashboard-builder/embed-token",
|
|
18
|
+
{
|
|
19
|
+
dashboardId: e.dashboardId,
|
|
20
|
+
embedType: e.embedType,
|
|
21
|
+
embedLevel: (o = e.embedLevel) != null ? o : "dashboard",
|
|
22
|
+
componentId: e.componentId,
|
|
23
|
+
userId: e.userId,
|
|
24
|
+
tenantId: e.tenantId,
|
|
25
|
+
expiresIn: 3600
|
|
26
|
+
},
|
|
27
|
+
{ "x-deepspot-api-key": this.apiKey }
|
|
28
|
+
);
|
|
29
|
+
return this.tokenCache.set(t, {
|
|
30
|
+
token: r.token,
|
|
31
|
+
expiresAt: new Date(r.expiresAt).getTime()
|
|
32
|
+
}), r.token;
|
|
33
|
+
}
|
|
34
|
+
// ── Dashboard Render (lazy — loads one tab at a time) ──────────────────────
|
|
35
|
+
async getDashboardRender(e, t, s = {}) {
|
|
36
|
+
var i;
|
|
37
|
+
const r = new URLSearchParams({
|
|
38
|
+
embedType: "dashboard",
|
|
39
|
+
embedLevel: (i = s.embedLevel) != null ? i : "dashboard"
|
|
40
|
+
});
|
|
41
|
+
return s.pageId && r.set("pageId", s.pageId), s.tabId && r.set("tabId", s.tabId), s.filters && Object.entries(s.filters).forEach(([a, d]) => {
|
|
42
|
+
d != null && d !== "" && r.set(`filter[${a}]`, Array.isArray(d) ? d.join(",") : String(d));
|
|
43
|
+
}), this.get(
|
|
44
|
+
`/dashboard-builder/embed/${e}/render?${r}`,
|
|
45
|
+
{ "x-embed-token": t }
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
// ── Single Report Render ────────────────────────────────────────────────────
|
|
49
|
+
async getReportRender(e, t, s, r = {}) {
|
|
50
|
+
const i = new URLSearchParams({
|
|
51
|
+
embedType: "report",
|
|
52
|
+
embedLevel: "report",
|
|
53
|
+
componentId: t
|
|
54
|
+
});
|
|
55
|
+
return r.filters && Object.entries(r.filters).forEach(([a, d]) => {
|
|
56
|
+
d != null && d !== "" && i.set(`filter[${a}]`, Array.isArray(d) ? d.join(",") : String(d));
|
|
57
|
+
}), this.get(
|
|
58
|
+
`/dashboard-builder/embed/${e}/render?${i}`,
|
|
59
|
+
{ "x-embed-token": s }
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
// ── API Key Management ──────────────────────────────────────────────────────
|
|
63
|
+
async createApiKey(e, t) {
|
|
64
|
+
return this.post("/dashboard-builder/api-keys", e, {
|
|
65
|
+
Authorization: `Bearer ${t}`
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
async listApiKeys(e) {
|
|
69
|
+
return this.get("/dashboard-builder/api-keys", {
|
|
70
|
+
Authorization: `Bearer ${e}`
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
async deleteApiKey(e, t) {
|
|
74
|
+
await this.delete(`/dashboard-builder/api-keys/${e}`, {
|
|
75
|
+
Authorization: `Bearer ${t}`
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
// ── Filter Options ──────────────────────────────────────────────────────────
|
|
79
|
+
/**
|
|
80
|
+
* Fetches distinct option values for a dropdown / multi-select filter.
|
|
81
|
+
* Mirrors the main dashboard call:
|
|
82
|
+
* GET /dashboard-builder/{dashboardId}/filters/{filterId}/options
|
|
83
|
+
* The embed token is sent so the backend can validate the caller has
|
|
84
|
+
* access to this dashboard without requiring an admin JWT.
|
|
85
|
+
*/
|
|
86
|
+
async getFilterOptions(e, t, s) {
|
|
87
|
+
try {
|
|
88
|
+
const r = await this.get(
|
|
89
|
+
`/dashboard-builder/embed/${e}/filters/${t}/options`,
|
|
90
|
+
{ "x-embed-token": s }
|
|
91
|
+
);
|
|
92
|
+
return Array.isArray(r) ? r : Array.isArray(r == null ? void 0 : r.options) ? r.options : Array.isArray(r == null ? void 0 : r.data) ? r.data : [];
|
|
93
|
+
} catch (r) {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
clearTokenCache() {
|
|
98
|
+
this.tokenCache.clear();
|
|
99
|
+
}
|
|
100
|
+
// ── Private helpers ─────────────────────────────────────────────────────────
|
|
101
|
+
async get(e, t = {}) {
|
|
102
|
+
const s = await fetch(`${this.baseUrl}${e}`, {
|
|
103
|
+
method: "GET",
|
|
104
|
+
headers: { "Content-Type": "application/json", ...t }
|
|
105
|
+
});
|
|
106
|
+
return this.handleResponse(s);
|
|
107
|
+
}
|
|
108
|
+
async post(e, t, s = {}) {
|
|
109
|
+
const r = await fetch(`${this.baseUrl}${e}`, {
|
|
110
|
+
method: "POST",
|
|
111
|
+
headers: { "Content-Type": "application/json", ...s },
|
|
112
|
+
body: JSON.stringify(t)
|
|
113
|
+
});
|
|
114
|
+
return this.handleResponse(r);
|
|
115
|
+
}
|
|
116
|
+
async delete(e, t = {}) {
|
|
117
|
+
const s = await fetch(`${this.baseUrl}${e}`, {
|
|
118
|
+
method: "DELETE",
|
|
119
|
+
headers: { "Content-Type": "application/json", ...t }
|
|
120
|
+
});
|
|
121
|
+
if (!s.ok) throw new Error(`Deepspot SDK: DELETE ${e} failed (${s.status})`);
|
|
122
|
+
}
|
|
123
|
+
async handleResponse(e) {
|
|
124
|
+
if (!e.ok) {
|
|
125
|
+
let s = `HTTP ${e.status}`;
|
|
126
|
+
try {
|
|
127
|
+
const r = await e.json();
|
|
128
|
+
s = (r == null ? void 0 : r.message) || (r == null ? void 0 : r.error) || s;
|
|
129
|
+
} catch (r) {
|
|
130
|
+
}
|
|
131
|
+
throw new Error(`Deepspot SDK: ${s}`);
|
|
132
|
+
}
|
|
133
|
+
const t = await e.json();
|
|
134
|
+
return (t == null ? void 0 : t.data) !== void 0 ? t.data : t;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
class w {
|
|
138
|
+
constructor(e) {
|
|
139
|
+
var t, s;
|
|
140
|
+
this.destroyed = !1, this.refreshTimer = null, this.opts = e, this.filters = { ...e.activeFilters }, this.activePageId = (t = e.activePageId) != null ? t : "", this.activeTabId = (s = e.activeTabId) != null ? s : "";
|
|
141
|
+
}
|
|
142
|
+
/** Returns a copy of the currently applied filters */
|
|
143
|
+
getActiveFilters() {
|
|
144
|
+
return { ...this.filters };
|
|
145
|
+
}
|
|
146
|
+
/** Apply a single filter and re-fetch data */
|
|
147
|
+
setFilter(e, t) {
|
|
148
|
+
this.filters[e] = t, this.scheduleRefresh();
|
|
149
|
+
}
|
|
150
|
+
/** Apply multiple filters at once and re-fetch */
|
|
151
|
+
setFilters(e) {
|
|
152
|
+
Object.assign(this.filters, e), this.scheduleRefresh();
|
|
153
|
+
}
|
|
154
|
+
/** Navigate to a different page (dashboard embed only) */
|
|
155
|
+
goToPage(e) {
|
|
156
|
+
this.opts.embedType === "dashboard" && (this.activePageId = e, this.opts.renderer.goToPage(e));
|
|
157
|
+
}
|
|
158
|
+
/** Navigate to a specific tab on a specific page */
|
|
159
|
+
goToTab(e, t) {
|
|
160
|
+
this.opts.embedType === "dashboard" && (this.activePageId = e, this.activeTabId = t, this.opts.renderer.goToTab(e, t));
|
|
161
|
+
}
|
|
162
|
+
/** Force re-fetch all data from backend */
|
|
163
|
+
async refresh() {
|
|
164
|
+
if (!this.destroyed)
|
|
165
|
+
try {
|
|
166
|
+
const e = await this.fetchData();
|
|
167
|
+
this.opts.renderer.update(e);
|
|
168
|
+
} catch (e) {
|
|
169
|
+
console.error("Deepspot SDK: refresh failed", e);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/** Export PDF (dashboard embed only) */
|
|
173
|
+
exportPDF() {
|
|
174
|
+
this.opts.embedType === "dashboard" && this.opts.renderer.exportPDF();
|
|
175
|
+
}
|
|
176
|
+
/** Remove the embed and clean up */
|
|
177
|
+
destroy() {
|
|
178
|
+
this.destroyed = !0, this.refreshTimer && clearTimeout(this.refreshTimer), this.opts.renderer.destroy(), this.opts.apiClient.clearTokenCache();
|
|
179
|
+
}
|
|
180
|
+
// ── Private ─────────────────────────────────────────────────────────────────
|
|
181
|
+
/** Debounce rapid filter changes into a single fetch */
|
|
182
|
+
scheduleRefresh() {
|
|
183
|
+
this.refreshTimer && clearTimeout(this.refreshTimer), this.refreshTimer = setTimeout(() => this.refresh(), 300);
|
|
184
|
+
}
|
|
185
|
+
async fetchData() {
|
|
186
|
+
const { apiClient: e, dashboardId: t, componentId: s, token: r, embedType: i, embedLevel: a } = this.opts;
|
|
187
|
+
return i === "report" && s ? e.getReportRender(t, s, r, {
|
|
188
|
+
filters: this.filters
|
|
189
|
+
}) : e.getDashboardRender(t, r, {
|
|
190
|
+
embedLevel: a,
|
|
191
|
+
pageId: this.activePageId || void 0,
|
|
192
|
+
tabId: this.activeTabId || void 0,
|
|
193
|
+
filters: this.filters
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const K = 24, $ = 10, C = 12;
|
|
198
|
+
class E {
|
|
199
|
+
/**
|
|
200
|
+
* @param containerWidth Actual pixel width of the grid container.
|
|
201
|
+
* @param minY Minimum y value across all components (normalises
|
|
202
|
+
* the grid so the topmost component starts at top=6px).
|
|
203
|
+
*/
|
|
204
|
+
constructor(e, t = 0) {
|
|
205
|
+
this.containerWidth = e, this.minY = t;
|
|
206
|
+
}
|
|
207
|
+
/** Pixel width of one column unit */
|
|
208
|
+
get colWidth() {
|
|
209
|
+
return this.containerWidth / K;
|
|
210
|
+
}
|
|
211
|
+
/** Convert grid position {x,y,w,h} → CSS absolute pixel values */
|
|
212
|
+
toPx(e) {
|
|
213
|
+
const t = this.colWidth, s = C / 2;
|
|
214
|
+
return {
|
|
215
|
+
left: e.x * t + s,
|
|
216
|
+
top: (e.y - this.minY) * $ + s,
|
|
217
|
+
width: e.w * t - C,
|
|
218
|
+
height: e.h * $ - C
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
/** Total pixel height required to fit all positioned components */
|
|
222
|
+
static totalHeight(e) {
|
|
223
|
+
if (!e.length) return 400;
|
|
224
|
+
const t = Math.min(...e.map((r) => r.y));
|
|
225
|
+
return (Math.max(...e.map((r) => r.y + r.h)) - t) * $ + 40;
|
|
226
|
+
}
|
|
227
|
+
/** Apply absolute positioning styles directly to a DOM element */
|
|
228
|
+
applyStyles(e, t) {
|
|
229
|
+
const s = this.toPx(t);
|
|
230
|
+
e.style.position = "absolute", e.style.left = `${s.left}px`, e.style.top = `${s.top}px`, e.style.width = `${s.width}px`, e.style.height = `${s.height}px`;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
let R = null;
|
|
234
|
+
function q() {
|
|
235
|
+
return R || (R = import("./apexcharts.common-k3hLWpB8.js").then((u) => u.a)), R;
|
|
236
|
+
}
|
|
237
|
+
class O {
|
|
238
|
+
constructor(e) {
|
|
239
|
+
this.chart = null, this.container = e;
|
|
240
|
+
}
|
|
241
|
+
async render(e, t, s, r) {
|
|
242
|
+
if (!t || t.length === 0) {
|
|
243
|
+
this.renderEmpty(e.title);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const i = this.buildOptions(e, t, s, r);
|
|
247
|
+
if (!i) {
|
|
248
|
+
this.renderEmpty(e.title);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
this.container.innerHTML = `
|
|
252
|
+
<div class="ds-chart-card">
|
|
253
|
+
<div class="ds-chart-title">${e.title || ""}</div>
|
|
254
|
+
<div class="ds-chart-body" id="ds-chart-body-${e.id}"></div>
|
|
255
|
+
</div>
|
|
256
|
+
`;
|
|
257
|
+
const a = this.container.querySelector(`#ds-chart-body-${e.id}`);
|
|
258
|
+
if (a)
|
|
259
|
+
try {
|
|
260
|
+
this.chart && this.chart.destroy();
|
|
261
|
+
const { default: d } = await q();
|
|
262
|
+
this.chart = new d(a, i), this.chart.render();
|
|
263
|
+
} catch (d) {
|
|
264
|
+
console.error("[Deepspot SDK] ChartRenderer error:", d), a.innerHTML = '<div class="ds-chart-empty">Chart render error</div>';
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
async update(e, t, s) {
|
|
268
|
+
if (!this.chart || !t || t.length === 0) {
|
|
269
|
+
await this.render(e, t, s);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const { series: r, categories: i } = this.extractSeriesAndCategories(e, t);
|
|
273
|
+
try {
|
|
274
|
+
this.chart.updateOptions({
|
|
275
|
+
series: r,
|
|
276
|
+
xaxis: { categories: i },
|
|
277
|
+
theme: { mode: s }
|
|
278
|
+
});
|
|
279
|
+
} catch (a) {
|
|
280
|
+
this.render(e, t, s);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
destroy() {
|
|
284
|
+
var e;
|
|
285
|
+
try {
|
|
286
|
+
(e = this.chart) == null || e.destroy();
|
|
287
|
+
} catch (t) {
|
|
288
|
+
}
|
|
289
|
+
this.chart = null;
|
|
290
|
+
}
|
|
291
|
+
// ── Private ─────────────────────────────────────────────────────────────────
|
|
292
|
+
buildOptions(e, t, s, r) {
|
|
293
|
+
const i = e.type;
|
|
294
|
+
return i === "pie" || i === "donut" ? this.buildPieOptions(e, t, s, r) : i === "bar" || i === "line" || i === "area" ? this.buildCartesianOptions(e, t, s, r) : null;
|
|
295
|
+
}
|
|
296
|
+
buildCartesianOptions(e, t, s, r) {
|
|
297
|
+
var l;
|
|
298
|
+
const { series: i, categories: a, xAxisLabel: d, yAxisLabel: o } = this.extractSeriesAndCategories(e, t), n = e.properties || {}, b = n.colors ? Object.values(n.colors) : ["#6366f1", "#8b5cf6", "#ec4899", "#f59e0b", "#10b981", "#3b82f6"], h = s === "dark";
|
|
299
|
+
return {
|
|
300
|
+
chart: {
|
|
301
|
+
type: e.type === "area" ? "area" : e.type === "line" ? "line" : "bar",
|
|
302
|
+
toolbar: { show: !1 },
|
|
303
|
+
background: "transparent",
|
|
304
|
+
animations: { enabled: !0, speed: 400 },
|
|
305
|
+
fontFamily: "inherit",
|
|
306
|
+
// Explicit height prevents ApexCharts from guessing the flex-child height
|
|
307
|
+
// at render time (which can read as 0 before the browser settles layout).
|
|
308
|
+
height: r != null ? r : "100%"
|
|
309
|
+
},
|
|
310
|
+
theme: { mode: s },
|
|
311
|
+
series: i,
|
|
312
|
+
xaxis: {
|
|
313
|
+
categories: a,
|
|
314
|
+
title: { text: d },
|
|
315
|
+
labels: {
|
|
316
|
+
rotate: a.length > 8 ? -45 : 0,
|
|
317
|
+
style: { colors: h ? "#94a3b8" : "#6b7280", fontSize: "11px" }
|
|
318
|
+
},
|
|
319
|
+
axisBorder: { color: h ? "#334155" : "#e5e7eb" },
|
|
320
|
+
axisTicks: { color: h ? "#334155" : "#e5e7eb" }
|
|
321
|
+
},
|
|
322
|
+
yaxis: {
|
|
323
|
+
title: { text: o },
|
|
324
|
+
labels: { style: { colors: h ? "#94a3b8" : "#6b7280", fontSize: "11px" } }
|
|
325
|
+
},
|
|
326
|
+
colors: b,
|
|
327
|
+
legend: {
|
|
328
|
+
show: i.length > 1 || ((l = n.showLegend) != null ? l : !1),
|
|
329
|
+
position: "bottom",
|
|
330
|
+
labels: { colors: h ? "#94a3b8" : "#6b7280" }
|
|
331
|
+
},
|
|
332
|
+
grid: {
|
|
333
|
+
borderColor: h ? "#1e293b" : "#f3f4f6",
|
|
334
|
+
strokeDashArray: 4,
|
|
335
|
+
padding: {
|
|
336
|
+
bottom: a.length > 8 ? 60 : 10
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
tooltip: { theme: s },
|
|
340
|
+
stroke: {
|
|
341
|
+
curve: "smooth",
|
|
342
|
+
width: e.type === "bar" ? 0 : 2
|
|
343
|
+
},
|
|
344
|
+
fill: e.type === "area" ? { type: "gradient", gradient: { shadeIntensity: 0.5, opacityFrom: 0.4, opacityTo: 0 } } : {},
|
|
345
|
+
dataLabels: { enabled: !1 },
|
|
346
|
+
plotOptions: {
|
|
347
|
+
bar: {
|
|
348
|
+
borderRadius: 4,
|
|
349
|
+
distributed: i.length === 1
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
buildPieOptions(e, t, s, r) {
|
|
355
|
+
const i = e.properties || {}, a = t.length > 0 ? Object.keys(t[0]) : [], d = a[0] || "label", o = a[1] || "value", n = t.map((c) => {
|
|
356
|
+
var p;
|
|
357
|
+
return String((p = c[d]) != null ? p : "");
|
|
358
|
+
}), b = t.map((c) => Number(c[o]) || 0), h = s === "dark", l = i.colors ? Object.values(i.colors) : ["#6366f1", "#8b5cf6", "#ec4899", "#f59e0b", "#10b981", "#3b82f6"];
|
|
359
|
+
return {
|
|
360
|
+
chart: {
|
|
361
|
+
type: e.type,
|
|
362
|
+
toolbar: { show: !1 },
|
|
363
|
+
background: "transparent",
|
|
364
|
+
fontFamily: "inherit",
|
|
365
|
+
height: r != null ? r : "100%"
|
|
366
|
+
},
|
|
367
|
+
theme: { mode: s },
|
|
368
|
+
series: b,
|
|
369
|
+
labels: n,
|
|
370
|
+
colors: l,
|
|
371
|
+
legend: {
|
|
372
|
+
position: "bottom",
|
|
373
|
+
labels: { colors: h ? "#94a3b8" : "#6b7280" }
|
|
374
|
+
},
|
|
375
|
+
tooltip: { theme: s },
|
|
376
|
+
dataLabels: { enabled: n.length <= 8 },
|
|
377
|
+
plotOptions: {
|
|
378
|
+
pie: {
|
|
379
|
+
donut: { size: e.type === "donut" ? "65%" : "0%" }
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
extractSeriesAndCategories(e, t) {
|
|
385
|
+
const s = e.properties || {}, r = t.length > 0 ? Object.keys(t[0]) : [], i = s.xAxis || r[0] || "x";
|
|
386
|
+
let a = [];
|
|
387
|
+
if (s.selectedYAxisColumn)
|
|
388
|
+
try {
|
|
389
|
+
const l = typeof s.selectedYAxisColumn == "string" ? JSON.parse(s.selectedYAxisColumn) : s.selectedYAxisColumn;
|
|
390
|
+
Array.isArray(l) && (a = l.map(
|
|
391
|
+
(c) => typeof c == "string" ? { column: c } : c
|
|
392
|
+
));
|
|
393
|
+
} catch (l) {
|
|
394
|
+
}
|
|
395
|
+
if (!a.length && s.yAxis) {
|
|
396
|
+
const l = s.yAxis;
|
|
397
|
+
a = (Array.isArray(l) ? l : [l]).map((p) => ({ column: String(p) }));
|
|
398
|
+
}
|
|
399
|
+
!a.length && r.length > 1 && (a = r.slice(1).map((l) => ({ column: l })));
|
|
400
|
+
const d = t.map((l) => {
|
|
401
|
+
var c;
|
|
402
|
+
return String((c = l[i]) != null ? c : "");
|
|
403
|
+
}), o = t.length > 0 ? Object.keys(t[0]) : [], n = a.map((l) => {
|
|
404
|
+
const c = o.includes(l.column) ? l.column : null, p = c ? null : o.find((f) => f.includes(l.column) || l.column.includes(f)), g = !c && !p ? o.find((f) => {
|
|
405
|
+
var y;
|
|
406
|
+
return f !== i && !isNaN(Number((y = t[0]) == null ? void 0 : y[f]));
|
|
407
|
+
}) : null, m = c || p || g || l.column;
|
|
408
|
+
return {
|
|
409
|
+
name: l.label || l.column.replace(/_/g, " "),
|
|
410
|
+
data: t.map((f) => {
|
|
411
|
+
const y = f[m];
|
|
412
|
+
return y != null ? Number(y) : null;
|
|
413
|
+
})
|
|
414
|
+
};
|
|
415
|
+
}), b = s.xAxisLabel || i.replace(/_/g, " "), h = s.yAxisLabel || (n.length === 1 ? n[0].name : "Values");
|
|
416
|
+
return { series: n, categories: d, xAxisLabel: b, yAxisLabel: h };
|
|
417
|
+
}
|
|
418
|
+
renderEmpty(e) {
|
|
419
|
+
this.container.innerHTML = `
|
|
420
|
+
<div class="ds-chart-card">
|
|
421
|
+
${e ? `<div class="ds-chart-title">${e}</div>` : ""}
|
|
422
|
+
<div class="ds-chart-empty">No data available</div>
|
|
423
|
+
</div>
|
|
424
|
+
`;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
class j {
|
|
428
|
+
render(e, t, s) {
|
|
429
|
+
var n;
|
|
430
|
+
if (!s || s.length === 0) {
|
|
431
|
+
e.innerHTML = `
|
|
432
|
+
<div class="ds-table-card">
|
|
433
|
+
<div class="ds-table-title">${t.title || ""}</div>
|
|
434
|
+
<div class="ds-chart-empty">No data available</div>
|
|
435
|
+
</div>
|
|
436
|
+
`;
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
const r = Object.keys(s[0]), i = ((n = t.properties) == null ? void 0 : n.columns) || [], a = i.length ? i.filter((b) => r.includes(b)) : r, d = a.map((b) => `<th>${this.formatHeader(b)}</th>`).join(""), o = s.map((b) => `<tr>${a.map((l) => {
|
|
440
|
+
const c = b[l];
|
|
441
|
+
return `<td title="${this.escape(String(c != null ? c : ""))}">${this.escape(this.formatValue(c))}</td>`;
|
|
442
|
+
}).join("")}</tr>`).join("");
|
|
443
|
+
e.innerHTML = `
|
|
444
|
+
<div class="ds-table-card">
|
|
445
|
+
<div class="ds-table-title">${t.title || ""}</div>
|
|
446
|
+
<div class="ds-table-scroll">
|
|
447
|
+
<table class="ds-table">
|
|
448
|
+
<thead><tr>${d}</tr></thead>
|
|
449
|
+
<tbody>${o}</tbody>
|
|
450
|
+
</table>
|
|
451
|
+
</div>
|
|
452
|
+
</div>
|
|
453
|
+
`;
|
|
454
|
+
}
|
|
455
|
+
formatHeader(e) {
|
|
456
|
+
return e.replace(/_/g, " ").replace(/\b\w/g, (t) => t.toUpperCase());
|
|
457
|
+
}
|
|
458
|
+
formatValue(e) {
|
|
459
|
+
return e == null ? "—" : typeof e == "number" ? e % 1 === 0 ? e.toLocaleString() : e.toFixed(2) : String(e);
|
|
460
|
+
}
|
|
461
|
+
escape(e) {
|
|
462
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
class M {
|
|
466
|
+
render(e, t, s) {
|
|
467
|
+
const r = t.properties || {};
|
|
468
|
+
let i = null;
|
|
469
|
+
if (s && s.length > 0) {
|
|
470
|
+
const c = s[0], p = r.metric || Object.keys(c)[0], g = c[p];
|
|
471
|
+
if (g !== void 0)
|
|
472
|
+
i = g;
|
|
473
|
+
else {
|
|
474
|
+
const m = Object.keys(c).find(
|
|
475
|
+
(f) => f.includes(p) || p.includes(f)
|
|
476
|
+
);
|
|
477
|
+
i = c[m != null ? m : Object.keys(c)[0]];
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
const a = this.formatValue(i, r), d = r.backgroundColor || "", o = r.textColor || "", n = t.title || "", b = d ? `background:${d};border-color:${d};` : "", h = o ? `color:${o};` : "", l = o ? `color:${o};opacity:0.7;` : "";
|
|
481
|
+
e.innerHTML = `
|
|
482
|
+
<div class="ds-card"${b ? ` style="${b}"` : ""}>
|
|
483
|
+
<div class="ds-card-label"${l ? ` style="${l}"` : ""}>${n}</div>
|
|
484
|
+
<div class="ds-card-value"${h ? ` style="${h}"` : ""}>${a}</div>
|
|
485
|
+
</div>
|
|
486
|
+
`;
|
|
487
|
+
}
|
|
488
|
+
formatValue(e, t) {
|
|
489
|
+
if (e == null) return "—";
|
|
490
|
+
const s = Number(e);
|
|
491
|
+
if (isNaN(s)) return String(e);
|
|
492
|
+
const r = (t == null ? void 0 : t.prefix) || (t == null ? void 0 : t.currencySymbol) || "", i = (t == null ? void 0 : t.suffix) || "";
|
|
493
|
+
let a;
|
|
494
|
+
return Math.abs(s) >= 1e6 ? a = (s / 1e6).toFixed(1) + "M" : Math.abs(s) >= 1e3 ? a = (s / 1e3).toFixed(1) + "K" : a = s % 1 === 0 ? s.toLocaleString() : s.toFixed(2), `${r}${a}${i}`;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
class z {
|
|
498
|
+
constructor(e, t) {
|
|
499
|
+
this.currentValues = {}, this.container = e, this.onFilterChange = t;
|
|
500
|
+
}
|
|
501
|
+
render(e, t = {}) {
|
|
502
|
+
if (!e || e.length === 0) {
|
|
503
|
+
this.container.style.display = "none";
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
this.container.style.display = "", this.currentValues = { ...t }, this.container.innerHTML = `<div class="ds-filter-bar">${e.map((s) => this.renderFilter(s, t[s.applyToField || s.filterId])).join("")}</div>`, this.attachListeners(e);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Populate a dropdown / multi-select with options fetched from the API.
|
|
510
|
+
* Called asynchronously after the filter bar is rendered.
|
|
511
|
+
*/
|
|
512
|
+
updateOptions(e, t) {
|
|
513
|
+
const s = this.container.querySelector(
|
|
514
|
+
`select[data-filter-id="${e}"]`
|
|
515
|
+
);
|
|
516
|
+
if (!s) return;
|
|
517
|
+
const r = s.value;
|
|
518
|
+
s.innerHTML = '<option value="">All</option>' + t.map(
|
|
519
|
+
(i) => `<option value="${this.escAttr(i)}">${this.escText(i)}</option>`
|
|
520
|
+
).join(""), r && t.includes(r) && (s.value = r);
|
|
521
|
+
}
|
|
522
|
+
/** Update the stored values without re-rendering (for programmatic setFilter) */
|
|
523
|
+
updateValues(e) {
|
|
524
|
+
Object.assign(this.currentValues, e), Object.entries(e).forEach(([t, s]) => {
|
|
525
|
+
const r = this.container.querySelector(`[data-filter-id="${t}"]`);
|
|
526
|
+
r && s !== void 0 && (r.value = String(s));
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
// ── Private ─────────────────────────────────────────────────────────────────
|
|
530
|
+
renderFilter(e, t) {
|
|
531
|
+
const s = `ds-filter-${e.filterId}`, r = `<label class="ds-filter-label" for="${s}">${e.label}</label>`;
|
|
532
|
+
switch (e.type) {
|
|
533
|
+
case "dropdown":
|
|
534
|
+
return `
|
|
535
|
+
<div class="ds-filter-item">
|
|
536
|
+
${r}
|
|
537
|
+
<select class="ds-filter-select" id="${s}" data-filter-id="${e.filterId}">
|
|
538
|
+
<option value="">All</option>
|
|
539
|
+
${(e.options || []).map((d) => `
|
|
540
|
+
<option value="${this.escAttr(d)}" ${t === d ? "selected" : ""}>
|
|
541
|
+
${this.escText(d)}
|
|
542
|
+
</option>
|
|
543
|
+
`).join("")}
|
|
544
|
+
</select>
|
|
545
|
+
</div>`;
|
|
546
|
+
case "multi-select":
|
|
547
|
+
return `
|
|
548
|
+
<div class="ds-filter-item">
|
|
549
|
+
${r}
|
|
550
|
+
<select class="ds-filter-select" id="${s}" data-filter-id="${e.filterId}" multiple size="1">
|
|
551
|
+
${(e.options || []).map((d) => `
|
|
552
|
+
<option value="${this.escAttr(d)}">${this.escText(d)}</option>
|
|
553
|
+
`).join("")}
|
|
554
|
+
</select>
|
|
555
|
+
</div>`;
|
|
556
|
+
case "date-range":
|
|
557
|
+
const i = (t == null ? void 0 : t.from) || "", a = (t == null ? void 0 : t.to) || "";
|
|
558
|
+
return `
|
|
559
|
+
<div class="ds-filter-item">
|
|
560
|
+
${r}
|
|
561
|
+
<div class="ds-date-range-inputs">
|
|
562
|
+
<input type="date" class="ds-filter-input"
|
|
563
|
+
data-filter-id="${e.filterId}" data-date-part="from"
|
|
564
|
+
value="${i}" />
|
|
565
|
+
<span>–</span>
|
|
566
|
+
<input type="date" class="ds-filter-input"
|
|
567
|
+
data-filter-id="${e.filterId}" data-date-part="to"
|
|
568
|
+
value="${a}" />
|
|
569
|
+
</div>
|
|
570
|
+
</div>`;
|
|
571
|
+
case "text-input":
|
|
572
|
+
return `
|
|
573
|
+
<div class="ds-filter-item">
|
|
574
|
+
${r}
|
|
575
|
+
<input type="text" class="ds-filter-input" id="${s}"
|
|
576
|
+
data-filter-id="${e.filterId}"
|
|
577
|
+
value="${this.escAttr(String(t != null ? t : ""))}"
|
|
578
|
+
placeholder="Search..." />
|
|
579
|
+
</div>`;
|
|
580
|
+
case "number-input":
|
|
581
|
+
return `
|
|
582
|
+
<div class="ds-filter-item">
|
|
583
|
+
${r}
|
|
584
|
+
<input type="number" class="ds-filter-input" id="${s}"
|
|
585
|
+
data-filter-id="${e.filterId}"
|
|
586
|
+
value="${this.escAttr(String(t != null ? t : ""))}" />
|
|
587
|
+
</div>`;
|
|
588
|
+
default:
|
|
589
|
+
return "";
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
attachListeners(e) {
|
|
593
|
+
const t = {};
|
|
594
|
+
this.container.querySelectorAll("[data-filter-id]").forEach((s) => {
|
|
595
|
+
const r = s.dataset.filterId, i = s.dataset.datePart, a = e.find((o) => o.filterId === r), d = () => {
|
|
596
|
+
let o;
|
|
597
|
+
if ((a == null ? void 0 : a.type) === "date-range" && i)
|
|
598
|
+
t[r] = t[r] || {}, t[r][i] = s.value, o = { ...t[r] };
|
|
599
|
+
else if ((a == null ? void 0 : a.type) === "multi-select") {
|
|
600
|
+
const n = s;
|
|
601
|
+
o = Array.from(n.selectedOptions).map((b) => b.value).filter(Boolean);
|
|
602
|
+
} else
|
|
603
|
+
o = s.value;
|
|
604
|
+
this.currentValues[r] = o, this.onFilterChange(r, o);
|
|
605
|
+
};
|
|
606
|
+
s.addEventListener(
|
|
607
|
+
(a == null ? void 0 : a.type) === "text-input" ? "input" : "change",
|
|
608
|
+
d
|
|
609
|
+
);
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
escAttr(e) {
|
|
613
|
+
return e.replace(/"/g, """).replace(/'/g, "'");
|
|
614
|
+
}
|
|
615
|
+
escText(e) {
|
|
616
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
class N {
|
|
620
|
+
constructor(e, t) {
|
|
621
|
+
this.activePageId = "", this.activeTabId = "", this.activeFilters = {}, this.chartRenderers = /* @__PURE__ */ new Map(), this.tableRenderer = new j(), this.cardRenderer = new M(), this.isLoadingTab = !1, this.root = e, this.opts = t, this.activeFilters = { ...t.initialFilters };
|
|
622
|
+
}
|
|
623
|
+
// ── Initial full render ───────────────────────────────────────────────────
|
|
624
|
+
render(e) {
|
|
625
|
+
var t, s;
|
|
626
|
+
this.renderData = e, this.activePageId = e.activePage, this.activeTabId = e.activeTab, this.buildShell(), this.renderNavigation(), this.renderFilterBar(), this.renderGrid(), (s = (t = this.opts).onReady) == null || s.call(t);
|
|
627
|
+
}
|
|
628
|
+
// ── Called after lazy tab fetch completes ─────────────────────────────────
|
|
629
|
+
update(e) {
|
|
630
|
+
this.renderData = e, this.activePageId = e.activePage, this.activeTabId = e.activeTab, this.isLoadingTab = !1, this.syncNavHighlight(), this.updateFilterBar(), this.renderGrid();
|
|
631
|
+
}
|
|
632
|
+
goToPage(e) {
|
|
633
|
+
const t = this.getTabsForPage(e)[0];
|
|
634
|
+
t && this.triggerTabSwitch(e, t.id);
|
|
635
|
+
}
|
|
636
|
+
goToTab(e, t) {
|
|
637
|
+
this.triggerTabSwitch(e, t);
|
|
638
|
+
}
|
|
639
|
+
destroy() {
|
|
640
|
+
this.chartRenderers.forEach((e) => e.destroy()), this.chartRenderers.clear(), this.root.innerHTML = "";
|
|
641
|
+
}
|
|
642
|
+
exportPDF() {
|
|
643
|
+
const e = this.root.querySelector("#ds-canvas");
|
|
644
|
+
e && import("./html2canvas.esm-CzwMv54K.js").then(
|
|
645
|
+
({ default: t }) => t(e, { scale: 2, useCORS: !0 }).then(
|
|
646
|
+
(s) => import("./jspdf.es.min-d9hlG26J.js").then((r) => r.j).then(({ jsPDF: r }) => {
|
|
647
|
+
const i = new r({ orientation: "landscape", unit: "px" });
|
|
648
|
+
i.addImage(s.toDataURL("image/png"), "PNG", 0, 0, i.internal.pageSize.width, 0), i.save(`${this.renderData.dashboard.name || "dashboard"}.pdf`);
|
|
649
|
+
})
|
|
650
|
+
)
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
exportCSV() {
|
|
654
|
+
this.renderData.components.forEach((e) => {
|
|
655
|
+
const t = this.renderData.data[e.id];
|
|
656
|
+
if (!(t != null && t.length) || !["table", "bar", "line", "area"].includes(e.type)) return;
|
|
657
|
+
const s = Object.keys(t[0]), r = [s.join(","), ...t.map(
|
|
658
|
+
(a) => s.map((d) => {
|
|
659
|
+
var o;
|
|
660
|
+
return JSON.stringify((o = a[d]) != null ? o : "");
|
|
661
|
+
}).join(",")
|
|
662
|
+
)].join(`
|
|
663
|
+
`);
|
|
664
|
+
Object.assign(document.createElement("a"), {
|
|
665
|
+
href: URL.createObjectURL(new Blob([r], { type: "text/csv" })),
|
|
666
|
+
download: `${e.title || e.id}.csv`
|
|
667
|
+
}).click();
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
updateFilterValues(e) {
|
|
671
|
+
var t;
|
|
672
|
+
Object.assign(this.activeFilters, e), (t = this.filterRenderer) == null || t.updateValues(e);
|
|
673
|
+
}
|
|
674
|
+
// ── Shell ─────────────────────────────────────────────────────────────────
|
|
675
|
+
buildShell() {
|
|
676
|
+
const e = this.opts.embedLevel, t = this.renderData.dashboard.pages, s = e === "dashboard" && t.length > 1, r = e === "page" || e === "dashboard";
|
|
677
|
+
this.root.innerHTML = `
|
|
678
|
+
${this.opts.hideExport ? "" : '<div class="ds-toolbar" id="ds-toolbar"></div>'}
|
|
679
|
+
${s ? '<nav class="ds-page-nav" id="ds-page-nav"></nav>' : ""}
|
|
680
|
+
${r ? '<nav class="ds-page-nav" id="ds-tab-nav"></nav>' : ""}
|
|
681
|
+
<div id="ds-filter-container"></div>
|
|
682
|
+
<div class="ds-canvas" id="ds-canvas">
|
|
683
|
+
<div class="ds-grid" id="ds-grid"></div>
|
|
684
|
+
</div>
|
|
685
|
+
<div id="ds-tab-loading" style="display:none;position:absolute;inset:0;
|
|
686
|
+
background:rgba(255,255,255,0.5);align-items:center;justify-content:center;">
|
|
687
|
+
<div class="ds-embed-spinner"></div>
|
|
688
|
+
</div>
|
|
689
|
+
`, this.root.style.position = "relative", this.opts.hideExport || this.buildExportToolbar();
|
|
690
|
+
const i = this.root.querySelector("#ds-filter-container");
|
|
691
|
+
this.filterRenderer = new z(i, (a, d) => {
|
|
692
|
+
var b, h;
|
|
693
|
+
const o = this.renderData.filters.find((l) => l.filterId === a), n = (o == null ? void 0 : o.applyToField) || a;
|
|
694
|
+
this.activeFilters[n] = d, (h = (b = this.opts).onFilterChange) == null || h.call(b, this.activeFilters), this.opts.onTabSwitch(this.activePageId, this.activeTabId);
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
buildExportToolbar() {
|
|
698
|
+
var t, s;
|
|
699
|
+
const e = this.root.querySelector("#ds-toolbar");
|
|
700
|
+
e && (e.innerHTML = `
|
|
701
|
+
<button class="ds-toolbar-btn" id="ds-btn-pdf">⬇ PDF</button>
|
|
702
|
+
<button class="ds-toolbar-btn" id="ds-btn-csv">⬇ CSV</button>
|
|
703
|
+
`, (t = e.querySelector("#ds-btn-pdf")) == null || t.addEventListener("click", () => this.exportPDF()), (s = e.querySelector("#ds-btn-csv")) == null || s.addEventListener("click", () => this.exportCSV()));
|
|
704
|
+
}
|
|
705
|
+
// ── Navigation ────────────────────────────────────────────────────────────
|
|
706
|
+
renderNavigation() {
|
|
707
|
+
this.renderPageNav(), this.renderTabNav(this.activePageId);
|
|
708
|
+
}
|
|
709
|
+
renderPageNav() {
|
|
710
|
+
const e = this.root.querySelector("#ds-page-nav");
|
|
711
|
+
e && (e.innerHTML = this.renderData.dashboard.pages.map((t) => `
|
|
712
|
+
<button class="ds-page-tab ${t.pageId === this.activePageId ? "ds-active" : ""}"
|
|
713
|
+
data-page-id="${t.pageId}">${t.title}</button>
|
|
714
|
+
`).join(""), e.querySelectorAll(".ds-page-tab").forEach((t) => {
|
|
715
|
+
t.addEventListener("click", () => {
|
|
716
|
+
var r, i;
|
|
717
|
+
const s = t.dataset.pageId;
|
|
718
|
+
s === this.activePageId && !this.isLoadingTab || this.triggerTabSwitch(s, (i = (r = this.getTabsForPage(s)[0]) == null ? void 0 : r.id) != null ? i : "");
|
|
719
|
+
});
|
|
720
|
+
}));
|
|
721
|
+
}
|
|
722
|
+
renderTabNav(e) {
|
|
723
|
+
const t = this.root.querySelector("#ds-tab-nav");
|
|
724
|
+
t && this.buildTabButtons(t, e);
|
|
725
|
+
}
|
|
726
|
+
buildTabButtons(e, t) {
|
|
727
|
+
const s = this.getTabsForPage(t);
|
|
728
|
+
if (s.length <= 1) {
|
|
729
|
+
e.style.display = "none";
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
e.style.display = "", e.innerHTML = s.map((r) => `
|
|
733
|
+
<button class="ds-page-tab ${r.id === this.activeTabId ? "ds-active" : ""}"
|
|
734
|
+
data-tab-id="${r.id}" data-page-id="${t}">${r.title}</button>
|
|
735
|
+
`).join(""), e.querySelectorAll(".ds-page-tab").forEach((r) => {
|
|
736
|
+
r.addEventListener("click", () => {
|
|
737
|
+
const i = r.dataset.tabId, a = r.dataset.pageId;
|
|
738
|
+
i === this.activeTabId && a === this.activePageId && !this.isLoadingTab || this.triggerTabSwitch(a, i);
|
|
739
|
+
});
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
/** Optimistically highlight new tab + show spinner, then fire callback */
|
|
743
|
+
triggerTabSwitch(e, t) {
|
|
744
|
+
this.isLoadingTab || !e || !t || (this.isLoadingTab = !0, this.activePageId = e, this.activeTabId = t, this.syncNavHighlight(), this.showTabSpinner(), this.opts.onTabSwitch(e, t));
|
|
745
|
+
}
|
|
746
|
+
syncNavHighlight() {
|
|
747
|
+
this.root.querySelectorAll("#ds-page-nav .ds-page-tab").forEach((t) => {
|
|
748
|
+
t.classList.toggle("ds-active", t.dataset.pageId === this.activePageId);
|
|
749
|
+
});
|
|
750
|
+
const e = this.root.querySelector("#ds-tab-nav");
|
|
751
|
+
e && this.buildTabButtons(e, this.activePageId);
|
|
752
|
+
}
|
|
753
|
+
// ── Filter bar ────────────────────────────────────────────────────────────
|
|
754
|
+
renderFilterBar() {
|
|
755
|
+
this.opts.hideFilters || (this.filterRenderer.render(this.renderData.filters, this.activeFilters), this.fetchFilterOptions());
|
|
756
|
+
}
|
|
757
|
+
updateFilterBar() {
|
|
758
|
+
this.opts.hideFilters || (this.filterRenderer.render(this.renderData.filters, this.activeFilters), this.fetchFilterOptions());
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* For every dropdown / multi-select filter whose options array is empty,
|
|
762
|
+
* call onFetchFilterOptions(filterId) and populate the select element.
|
|
763
|
+
* Mirrors: GET /dashboard-builder/{dashboardId}/filters/{filterId}/options
|
|
764
|
+
*/
|
|
765
|
+
async fetchFilterOptions() {
|
|
766
|
+
if (this.opts.onFetchFilterOptions)
|
|
767
|
+
for (const e of this.renderData.filters) {
|
|
768
|
+
if (e.type !== "dropdown" && e.type !== "multi-select" || e.options && e.options.length > 0) continue;
|
|
769
|
+
const t = await this.opts.onFetchFilterOptions(e.filterId);
|
|
770
|
+
t.length > 0 && this.filterRenderer.updateOptions(e.filterId, t);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
// ── Grid ──────────────────────────────────────────────────────────────────
|
|
774
|
+
renderGrid() {
|
|
775
|
+
this.hideTabSpinner();
|
|
776
|
+
const e = this.root.querySelector("#ds-grid");
|
|
777
|
+
if (!e) return;
|
|
778
|
+
this.chartRenderers.forEach((n) => n.destroy()), this.chartRenderers.clear();
|
|
779
|
+
const t = this.renderData.components;
|
|
780
|
+
if (!t.length) {
|
|
781
|
+
e.style.height = "200px", e.innerHTML = '<div class="ds-chart-empty" style="padding-top:80px;">No components on this tab.</div>';
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
const s = e.clientWidth || this.root.clientWidth || 800, r = t.map((n) => n.position), i = r.length ? Math.min(...r.map((n) => n.y)) : 0, a = new E(s, i);
|
|
785
|
+
e.style.height = `${E.totalHeight(r)}px`, e.innerHTML = "";
|
|
786
|
+
const d = 36, o = [];
|
|
787
|
+
t.forEach((n) => {
|
|
788
|
+
const b = document.createElement("div");
|
|
789
|
+
b.className = "ds-component-wrapper", b.dataset.componentId = n.id, a.applyStyles(b, n.position), e.appendChild(b);
|
|
790
|
+
const h = a.toPx(n.position), l = Math.max(50, h.height - d);
|
|
791
|
+
o.push(this.renderComponent(b, n, l));
|
|
792
|
+
}), Promise.all(o).catch(() => {
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
async renderComponent(e, t, s) {
|
|
796
|
+
var a, d;
|
|
797
|
+
const r = this.renderData.data[t.id] || [], i = this.opts.theme;
|
|
798
|
+
switch (t.type) {
|
|
799
|
+
case "bar":
|
|
800
|
+
case "line":
|
|
801
|
+
case "pie":
|
|
802
|
+
case "donut":
|
|
803
|
+
case "area": {
|
|
804
|
+
const o = new O(e);
|
|
805
|
+
await o.render(t, r, i, s), this.chartRenderers.set(t.id, o);
|
|
806
|
+
break;
|
|
807
|
+
}
|
|
808
|
+
case "table":
|
|
809
|
+
this.tableRenderer.render(e, t, r);
|
|
810
|
+
break;
|
|
811
|
+
case "number-card":
|
|
812
|
+
this.cardRenderer.render(e, t, r);
|
|
813
|
+
break;
|
|
814
|
+
case "text": {
|
|
815
|
+
const o = Object.entries(((a = t.properties) == null ? void 0 : a.style) || {}).map(([n, b]) => `${n}:${b}`).join(";");
|
|
816
|
+
e.innerHTML = `<div style="${o};padding:8px;">${((d = t.properties) == null ? void 0 : d.content) || ""}</div>`;
|
|
817
|
+
break;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
// ── Spinner ───────────────────────────────────────────────────────────────
|
|
822
|
+
showTabSpinner() {
|
|
823
|
+
const e = this.root.querySelector("#ds-tab-loading"), t = this.root.querySelector("#ds-grid");
|
|
824
|
+
e && (e.style.display = "flex"), t && (t.style.opacity = "0.35");
|
|
825
|
+
}
|
|
826
|
+
hideTabSpinner() {
|
|
827
|
+
const e = this.root.querySelector("#ds-tab-loading"), t = this.root.querySelector("#ds-grid");
|
|
828
|
+
e && (e.style.display = "none"), t && (t.style.opacity = "1");
|
|
829
|
+
}
|
|
830
|
+
// ── Helpers ───────────────────────────────────────────────────────────────
|
|
831
|
+
getTabsForPage(e) {
|
|
832
|
+
var t, s;
|
|
833
|
+
return (s = (t = this.renderData.dashboard.pages.find((r) => r.pageId === e)) == null ? void 0 : t.tabs) != null ? s : [];
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
class H {
|
|
837
|
+
constructor(e, t) {
|
|
838
|
+
this.chartRenderer = null, this.tableRenderer = new j(), this.cardRenderer = new M(), this.root = e, this.theme = t;
|
|
839
|
+
}
|
|
840
|
+
render(e, t) {
|
|
841
|
+
const s = e.components[0];
|
|
842
|
+
if (!s) {
|
|
843
|
+
this.root.innerHTML = `<div class="ds-embed-error">
|
|
844
|
+
<div class="ds-embed-error-icon">⚠</div>
|
|
845
|
+
<div>Component not found.</div>
|
|
846
|
+
</div>`;
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
const r = e.data[s.id] || [];
|
|
850
|
+
this.renderComponent(s, r), t == null || t();
|
|
851
|
+
}
|
|
852
|
+
update(e) {
|
|
853
|
+
const t = e.components[0];
|
|
854
|
+
if (!t) return;
|
|
855
|
+
const s = e.data[t.id] || [];
|
|
856
|
+
switch (t.type) {
|
|
857
|
+
case "bar":
|
|
858
|
+
case "line":
|
|
859
|
+
case "pie":
|
|
860
|
+
case "donut":
|
|
861
|
+
case "area":
|
|
862
|
+
this.chartRenderer ? this.chartRenderer.update(t, s, this.theme) : this.renderComponent(t, s);
|
|
863
|
+
break;
|
|
864
|
+
case "table":
|
|
865
|
+
this.tableRenderer.render(this.root, t, s);
|
|
866
|
+
break;
|
|
867
|
+
case "number-card":
|
|
868
|
+
this.cardRenderer.render(this.root, t, s);
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
destroy() {
|
|
873
|
+
var e;
|
|
874
|
+
(e = this.chartRenderer) == null || e.destroy(), this.chartRenderer = null, this.root.innerHTML = "";
|
|
875
|
+
}
|
|
876
|
+
renderComponent(e, t) {
|
|
877
|
+
var s;
|
|
878
|
+
switch (e.type) {
|
|
879
|
+
case "bar":
|
|
880
|
+
case "line":
|
|
881
|
+
case "pie":
|
|
882
|
+
case "donut":
|
|
883
|
+
case "area":
|
|
884
|
+
(s = this.chartRenderer) == null || s.destroy(), this.chartRenderer = new O(this.root), this.chartRenderer.render(e, t, this.theme);
|
|
885
|
+
break;
|
|
886
|
+
case "table":
|
|
887
|
+
this.tableRenderer.render(this.root, e, t);
|
|
888
|
+
break;
|
|
889
|
+
case "number-card":
|
|
890
|
+
this.cardRenderer.render(this.root, e, t);
|
|
891
|
+
break;
|
|
892
|
+
default:
|
|
893
|
+
this.root.innerHTML = `<div class="ds-chart-empty">Unsupported component type: ${e.type}</div>`;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
let D = !1;
|
|
898
|
+
function F() {
|
|
899
|
+
if (!(D || typeof document == "undefined")) {
|
|
900
|
+
D = !0;
|
|
901
|
+
try {
|
|
902
|
+
const u = `/* ─────────────────────────────────────────────────────────────────────────────
|
|
903
|
+
Deepspot SDK — Base Embed Styles
|
|
904
|
+
Injected once into the host page's <head> by the SDK.
|
|
905
|
+
All selectors are scoped under .ds-embed-* to avoid leaking into host styles.
|
|
906
|
+
───────────────────────────────────────────────────────────────────────────── */
|
|
907
|
+
|
|
908
|
+
/* ── Reset inside SDK containers ──────────────────────────────────────────── */
|
|
909
|
+
.ds-embed-root *,
|
|
910
|
+
.ds-embed-root *::before,
|
|
911
|
+
.ds-embed-root *::after {
|
|
912
|
+
box-sizing: border-box;
|
|
913
|
+
margin: 0;
|
|
914
|
+
padding: 0;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
/* ── Root container ────────────────────────────────────────────────────────── */
|
|
918
|
+
.ds-embed-root {
|
|
919
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
|
|
920
|
+
Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
|
921
|
+
font-size: 14px;
|
|
922
|
+
line-height: 1.5;
|
|
923
|
+
width: 100%;
|
|
924
|
+
height: 100%;
|
|
925
|
+
overflow: auto;
|
|
926
|
+
position: relative;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
.ds-embed-root.ds-theme-light {
|
|
930
|
+
background: #ffffff;
|
|
931
|
+
color: #111827;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
.ds-embed-root.ds-theme-dark {
|
|
935
|
+
background: #0f172a;
|
|
936
|
+
color: #f1f5f9;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
/* ── Loading state ─────────────────────────────────────────────────────────── */
|
|
940
|
+
.ds-embed-loading {
|
|
941
|
+
display: flex;
|
|
942
|
+
flex-direction: column;
|
|
943
|
+
align-items: center;
|
|
944
|
+
justify-content: center;
|
|
945
|
+
height: 100%;
|
|
946
|
+
min-height: 200px;
|
|
947
|
+
gap: 12px;
|
|
948
|
+
color: #6b7280;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
.ds-embed-spinner {
|
|
952
|
+
width: 36px;
|
|
953
|
+
height: 36px;
|
|
954
|
+
border: 3px solid #e5e7eb;
|
|
955
|
+
border-top-color: #6366f1;
|
|
956
|
+
border-radius: 50%;
|
|
957
|
+
animation: ds-spin 0.8s linear infinite;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
@keyframes ds-spin {
|
|
961
|
+
to { transform: rotate(360deg); }
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
.ds-embed-loading-text {
|
|
965
|
+
font-size: 13px;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
/* ── Error state ───────────────────────────────────────────────────────────── */
|
|
969
|
+
.ds-embed-error {
|
|
970
|
+
display: flex;
|
|
971
|
+
flex-direction: column;
|
|
972
|
+
align-items: center;
|
|
973
|
+
justify-content: center;
|
|
974
|
+
height: 100%;
|
|
975
|
+
min-height: 200px;
|
|
976
|
+
gap: 8px;
|
|
977
|
+
padding: 24px;
|
|
978
|
+
text-align: center;
|
|
979
|
+
color: #ef4444;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
.ds-embed-error-icon {
|
|
983
|
+
font-size: 32px;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
.ds-embed-error-message {
|
|
987
|
+
font-size: 13px;
|
|
988
|
+
color: #6b7280;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
/* ── Filter bar ────────────────────────────────────────────────────────────── */
|
|
992
|
+
.ds-filter-bar {
|
|
993
|
+
display: flex;
|
|
994
|
+
flex-wrap: wrap;
|
|
995
|
+
align-items: center;
|
|
996
|
+
gap: 10px;
|
|
997
|
+
padding: 10px 16px;
|
|
998
|
+
border-bottom: 1px solid #e5e7eb;
|
|
999
|
+
background: inherit;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
.ds-theme-dark .ds-filter-bar {
|
|
1003
|
+
border-bottom-color: #1e293b;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
.ds-filter-item {
|
|
1007
|
+
display: flex;
|
|
1008
|
+
flex-direction: column;
|
|
1009
|
+
gap: 4px;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
.ds-filter-label {
|
|
1013
|
+
font-size: 11px;
|
|
1014
|
+
font-weight: 600;
|
|
1015
|
+
text-transform: uppercase;
|
|
1016
|
+
letter-spacing: 0.05em;
|
|
1017
|
+
color: #6b7280;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
.ds-filter-select,
|
|
1021
|
+
.ds-filter-input {
|
|
1022
|
+
height: 32px;
|
|
1023
|
+
padding: 0 10px;
|
|
1024
|
+
border: 1px solid #d1d5db;
|
|
1025
|
+
border-radius: 6px;
|
|
1026
|
+
font-size: 13px;
|
|
1027
|
+
background: #ffffff;
|
|
1028
|
+
color: #111827;
|
|
1029
|
+
cursor: pointer;
|
|
1030
|
+
min-width: 130px;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
.ds-theme-dark .ds-filter-select,
|
|
1034
|
+
.ds-theme-dark .ds-filter-input {
|
|
1035
|
+
background: #1e293b;
|
|
1036
|
+
border-color: #334155;
|
|
1037
|
+
color: #f1f5f9;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
.ds-filter-select:focus,
|
|
1041
|
+
.ds-filter-input:focus {
|
|
1042
|
+
outline: none;
|
|
1043
|
+
border-color: #6366f1;
|
|
1044
|
+
box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
.ds-date-range-inputs {
|
|
1048
|
+
display: flex;
|
|
1049
|
+
gap: 6px;
|
|
1050
|
+
align-items: center;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
.ds-date-range-inputs input[type="date"] {
|
|
1054
|
+
height: 32px;
|
|
1055
|
+
padding: 0 8px;
|
|
1056
|
+
border: 1px solid #d1d5db;
|
|
1057
|
+
border-radius: 6px;
|
|
1058
|
+
font-size: 13px;
|
|
1059
|
+
background: #ffffff;
|
|
1060
|
+
color: #111827;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
.ds-theme-dark .ds-date-range-inputs input[type="date"] {
|
|
1064
|
+
background: #1e293b;
|
|
1065
|
+
border-color: #334155;
|
|
1066
|
+
color: #f1f5f9;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
/* ── Page / Tab navigation ─────────────────────────────────────────────────── */
|
|
1070
|
+
.ds-page-nav {
|
|
1071
|
+
display: flex;
|
|
1072
|
+
gap: 4px;
|
|
1073
|
+
padding: 8px 16px 0;
|
|
1074
|
+
border-bottom: 1px solid #e5e7eb;
|
|
1075
|
+
overflow-x: auto;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
.ds-theme-dark .ds-page-nav {
|
|
1079
|
+
border-bottom-color: #1e293b;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
.ds-page-tab {
|
|
1083
|
+
padding: 6px 16px;
|
|
1084
|
+
font-size: 13px;
|
|
1085
|
+
font-weight: 500;
|
|
1086
|
+
border: none;
|
|
1087
|
+
border-bottom: 2px solid transparent;
|
|
1088
|
+
background: transparent;
|
|
1089
|
+
color: #6b7280;
|
|
1090
|
+
cursor: pointer;
|
|
1091
|
+
white-space: nowrap;
|
|
1092
|
+
transition: color 0.15s, border-color 0.15s;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
.ds-page-tab:hover {
|
|
1096
|
+
color: #111827;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
.ds-theme-dark .ds-page-tab:hover {
|
|
1100
|
+
color: #f1f5f9;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
.ds-page-tab.ds-active {
|
|
1104
|
+
color: #6366f1;
|
|
1105
|
+
border-bottom-color: #6366f1;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
/* ── Grid canvas ───────────────────────────────────────────────────────────── */
|
|
1109
|
+
.ds-canvas {
|
|
1110
|
+
position: relative;
|
|
1111
|
+
width: 100%;
|
|
1112
|
+
/* No horizontal padding — grid.clientWidth must equal container width so
|
|
1113
|
+
GridLayout.colWidth = containerWidth/24 matches the dashboard builder.
|
|
1114
|
+
16px on each side was shrinking the grid by 32px and misaligning positions. */
|
|
1115
|
+
padding: 8px 0 16px;
|
|
1116
|
+
overflow-x: hidden;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
.ds-grid {
|
|
1120
|
+
position: relative;
|
|
1121
|
+
width: 100%;
|
|
1122
|
+
/* Clip absolutely-positioned children to the grid boundary so rounding
|
|
1123
|
+
errors or miscalculated widths don't create a horizontal scrollbar. */
|
|
1124
|
+
overflow: hidden;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
.ds-component-wrapper {
|
|
1128
|
+
position: absolute;
|
|
1129
|
+
overflow: hidden;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
/* ── Chart component ───────────────────────────────────────────────────────── */
|
|
1133
|
+
.ds-chart-card {
|
|
1134
|
+
width: 100%;
|
|
1135
|
+
height: 100%;
|
|
1136
|
+
background: #ffffff;
|
|
1137
|
+
border: 1px solid #e5e7eb;
|
|
1138
|
+
border-radius: 10px;
|
|
1139
|
+
overflow: hidden;
|
|
1140
|
+
display: flex;
|
|
1141
|
+
flex-direction: column;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
.ds-theme-dark .ds-chart-card {
|
|
1145
|
+
background: #1e293b;
|
|
1146
|
+
border-color: #334155;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
.ds-chart-title {
|
|
1150
|
+
padding: 10px 14px 4px;
|
|
1151
|
+
font-size: 13px;
|
|
1152
|
+
font-weight: 600;
|
|
1153
|
+
color: #374151;
|
|
1154
|
+
flex-shrink: 0;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
.ds-theme-dark .ds-chart-title {
|
|
1158
|
+
color: #e2e8f0;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
.ds-chart-body {
|
|
1162
|
+
flex: 1;
|
|
1163
|
+
min-height: 0;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
.ds-chart-empty {
|
|
1167
|
+
display: flex;
|
|
1168
|
+
align-items: center;
|
|
1169
|
+
justify-content: center;
|
|
1170
|
+
height: 100%;
|
|
1171
|
+
color: #9ca3af;
|
|
1172
|
+
font-size: 13px;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
/* ── Table component ───────────────────────────────────────────────────────── */
|
|
1176
|
+
.ds-table-card {
|
|
1177
|
+
width: 100%;
|
|
1178
|
+
height: 100%;
|
|
1179
|
+
background: #ffffff;
|
|
1180
|
+
border: 1px solid #e5e7eb;
|
|
1181
|
+
border-radius: 10px;
|
|
1182
|
+
overflow: hidden;
|
|
1183
|
+
display: flex;
|
|
1184
|
+
flex-direction: column;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
.ds-theme-dark .ds-table-card {
|
|
1188
|
+
background: #1e293b;
|
|
1189
|
+
border-color: #334155;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
.ds-table-title {
|
|
1193
|
+
padding: 10px 14px 4px;
|
|
1194
|
+
font-size: 13px;
|
|
1195
|
+
font-weight: 600;
|
|
1196
|
+
color: #374151;
|
|
1197
|
+
flex-shrink: 0;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
.ds-theme-dark .ds-table-title {
|
|
1201
|
+
color: #e2e8f0;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
.ds-table-scroll {
|
|
1205
|
+
flex: 1;
|
|
1206
|
+
overflow: auto;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
.ds-table {
|
|
1210
|
+
width: 100%;
|
|
1211
|
+
border-collapse: collapse;
|
|
1212
|
+
font-size: 12px;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
.ds-table th {
|
|
1216
|
+
position: sticky;
|
|
1217
|
+
top: 0;
|
|
1218
|
+
padding: 8px 12px;
|
|
1219
|
+
text-align: left;
|
|
1220
|
+
font-weight: 600;
|
|
1221
|
+
font-size: 11px;
|
|
1222
|
+
text-transform: uppercase;
|
|
1223
|
+
letter-spacing: 0.05em;
|
|
1224
|
+
background: #f9fafb;
|
|
1225
|
+
color: #6b7280;
|
|
1226
|
+
border-bottom: 1px solid #e5e7eb;
|
|
1227
|
+
white-space: nowrap;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
.ds-theme-dark .ds-table th {
|
|
1231
|
+
background: #0f172a;
|
|
1232
|
+
color: #94a3b8;
|
|
1233
|
+
border-bottom-color: #334155;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
.ds-table td {
|
|
1237
|
+
padding: 8px 12px;
|
|
1238
|
+
border-bottom: 1px solid #f3f4f6;
|
|
1239
|
+
color: #374151;
|
|
1240
|
+
max-width: 200px;
|
|
1241
|
+
overflow: hidden;
|
|
1242
|
+
text-overflow: ellipsis;
|
|
1243
|
+
white-space: nowrap;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
.ds-theme-dark .ds-table td {
|
|
1247
|
+
color: #cbd5e1;
|
|
1248
|
+
border-bottom-color: #1e293b;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
.ds-table tr:hover td {
|
|
1252
|
+
background: #f9fafb;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
.ds-theme-dark .ds-table tr:hover td {
|
|
1256
|
+
background: #1e293b;
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
/* ── KPI Number Card ───────────────────────────────────────────────────────── */
|
|
1260
|
+
.ds-card {
|
|
1261
|
+
width: 100%;
|
|
1262
|
+
height: 100%;
|
|
1263
|
+
border: 1px solid #e5e7eb;
|
|
1264
|
+
border-radius: 10px;
|
|
1265
|
+
display: flex;
|
|
1266
|
+
flex-direction: column;
|
|
1267
|
+
align-items: center;
|
|
1268
|
+
justify-content: center;
|
|
1269
|
+
padding: 16px;
|
|
1270
|
+
text-align: center;
|
|
1271
|
+
background: #ffffff;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
.ds-theme-dark .ds-card {
|
|
1275
|
+
background: #1e293b;
|
|
1276
|
+
border-color: #334155;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
.ds-card-label {
|
|
1280
|
+
font-size: 12px;
|
|
1281
|
+
font-weight: 500;
|
|
1282
|
+
color: #6b7280;
|
|
1283
|
+
margin-bottom: 6px;
|
|
1284
|
+
text-transform: uppercase;
|
|
1285
|
+
letter-spacing: 0.05em;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
.ds-card-value {
|
|
1289
|
+
font-size: 32px;
|
|
1290
|
+
font-weight: 700;
|
|
1291
|
+
color: #111827;
|
|
1292
|
+
line-height: 1.1;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
.ds-theme-dark .ds-card-value {
|
|
1296
|
+
color: #f1f5f9;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
/* ── Export toolbar ────────────────────────────────────────────────────────── */
|
|
1300
|
+
.ds-toolbar {
|
|
1301
|
+
display: flex;
|
|
1302
|
+
justify-content: flex-end;
|
|
1303
|
+
padding: 8px 16px 0;
|
|
1304
|
+
gap: 8px;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
.ds-toolbar-btn {
|
|
1308
|
+
height: 30px;
|
|
1309
|
+
padding: 0 12px;
|
|
1310
|
+
border: 1px solid #d1d5db;
|
|
1311
|
+
border-radius: 6px;
|
|
1312
|
+
font-size: 12px;
|
|
1313
|
+
font-weight: 500;
|
|
1314
|
+
background: #ffffff;
|
|
1315
|
+
color: #374151;
|
|
1316
|
+
cursor: pointer;
|
|
1317
|
+
display: flex;
|
|
1318
|
+
align-items: center;
|
|
1319
|
+
gap: 5px;
|
|
1320
|
+
transition: background 0.15s, border-color 0.15s;
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
.ds-toolbar-btn:hover {
|
|
1324
|
+
background: #f9fafb;
|
|
1325
|
+
border-color: #9ca3af;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
.ds-theme-dark .ds-toolbar-btn {
|
|
1329
|
+
background: #1e293b;
|
|
1330
|
+
border-color: #334155;
|
|
1331
|
+
color: #e2e8f0;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
.ds-theme-dark .ds-toolbar-btn:hover {
|
|
1335
|
+
background: #0f172a;
|
|
1336
|
+
}
|
|
1337
|
+
`, e = document.createElement("style");
|
|
1338
|
+
e.id = "deepspot-sdk-styles", e.textContent = u, document.head.appendChild(e);
|
|
1339
|
+
} catch (u) {
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
function P(u) {
|
|
1344
|
+
if (typeof u == "string") {
|
|
1345
|
+
const e = document.querySelector(u);
|
|
1346
|
+
if (!e) throw new Error(`Deepspot SDK: container "${u}" not found in DOM`);
|
|
1347
|
+
return e;
|
|
1348
|
+
}
|
|
1349
|
+
return u;
|
|
1350
|
+
}
|
|
1351
|
+
class U {
|
|
1352
|
+
constructor(e) {
|
|
1353
|
+
if (!e.apiKey) throw new Error("Deepspot SDK: apiKey is required");
|
|
1354
|
+
if (!e.baseUrl) throw new Error("Deepspot SDK: baseUrl is required");
|
|
1355
|
+
this.apiClient = new S(e.baseUrl, e.apiKey), F();
|
|
1356
|
+
}
|
|
1357
|
+
// ── Embed full dashboard ────────────────────────────────────────────────────
|
|
1358
|
+
async embedDashboard(e) {
|
|
1359
|
+
var a, d, o, n, b;
|
|
1360
|
+
const t = P(e.container), s = (a = e.embedLevel) != null ? a : "dashboard", r = (d = e.theme) != null ? d : "light";
|
|
1361
|
+
t.style.height = e.height || "600px", t.style.display = "block";
|
|
1362
|
+
const i = this.createRoot(t, r);
|
|
1363
|
+
this.showLoading(i);
|
|
1364
|
+
try {
|
|
1365
|
+
const h = await this.apiClient.getEmbedToken({
|
|
1366
|
+
dashboardId: e.dashboardId,
|
|
1367
|
+
embedType: "dashboard",
|
|
1368
|
+
embedLevel: s,
|
|
1369
|
+
userId: e.userId,
|
|
1370
|
+
tenantId: e.tenantId
|
|
1371
|
+
}), l = await this.apiClient.getDashboardRender(
|
|
1372
|
+
e.dashboardId,
|
|
1373
|
+
h,
|
|
1374
|
+
{
|
|
1375
|
+
embedLevel: s,
|
|
1376
|
+
pageId: e.pageId,
|
|
1377
|
+
tabId: e.tabId,
|
|
1378
|
+
filters: e.filters || {}
|
|
1379
|
+
}
|
|
1380
|
+
);
|
|
1381
|
+
let c;
|
|
1382
|
+
const p = new N(i, {
|
|
1383
|
+
embedLevel: s,
|
|
1384
|
+
theme: r,
|
|
1385
|
+
hideFilters: (o = e.hideFilters) != null ? o : !1,
|
|
1386
|
+
hideExport: (n = e.hideExport) != null ? n : !1,
|
|
1387
|
+
initialFilters: e.filters || {},
|
|
1388
|
+
onFilterChange: e.onFilterChange,
|
|
1389
|
+
onReady: e.onReady,
|
|
1390
|
+
onFetchFilterOptions: (g) => this.apiClient.getFilterOptions(e.dashboardId, g, h),
|
|
1391
|
+
onTabSwitch: async (g, m) => {
|
|
1392
|
+
var f, y, x;
|
|
1393
|
+
(f = e.onTabSwitch) == null || f.call(e, g, m);
|
|
1394
|
+
try {
|
|
1395
|
+
const v = await this.apiClient.getDashboardRender(
|
|
1396
|
+
e.dashboardId,
|
|
1397
|
+
h,
|
|
1398
|
+
{
|
|
1399
|
+
embedLevel: s,
|
|
1400
|
+
pageId: g,
|
|
1401
|
+
tabId: m,
|
|
1402
|
+
filters: (x = (y = c == null ? void 0 : c.getActiveFilters()) != null ? y : e.filters) != null ? x : {}
|
|
1403
|
+
}
|
|
1404
|
+
);
|
|
1405
|
+
p.update(v);
|
|
1406
|
+
} catch (v) {
|
|
1407
|
+
console.error("Deepspot SDK: tab fetch failed", v);
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
});
|
|
1411
|
+
return p.render(l), c = new w({
|
|
1412
|
+
dashboardId: e.dashboardId,
|
|
1413
|
+
token: h,
|
|
1414
|
+
embedType: "dashboard",
|
|
1415
|
+
embedLevel: s,
|
|
1416
|
+
activePageId: l.activePage,
|
|
1417
|
+
activeTabId: l.activeTab,
|
|
1418
|
+
activeFilters: e.filters || {},
|
|
1419
|
+
apiClient: this.apiClient,
|
|
1420
|
+
renderer: p,
|
|
1421
|
+
onFilterChange: e.onFilterChange
|
|
1422
|
+
}), c;
|
|
1423
|
+
} catch (h) {
|
|
1424
|
+
throw this.showError(i, (h == null ? void 0 : h.message) || "Failed to load dashboard"), (b = e.onError) == null || b.call(e, (h == null ? void 0 : h.message) || "Failed to load dashboard"), h;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
// ── Embed single report (component) ────────────────────────────────────────
|
|
1428
|
+
async embedReport(e) {
|
|
1429
|
+
var r;
|
|
1430
|
+
const t = P(e.container);
|
|
1431
|
+
t.style.height = e.height || "400px", t.style.display = "block";
|
|
1432
|
+
const s = this.createRoot(t, e.theme || "light");
|
|
1433
|
+
this.showLoading(s);
|
|
1434
|
+
try {
|
|
1435
|
+
const i = await this.apiClient.getEmbedToken({
|
|
1436
|
+
dashboardId: e.dashboardId,
|
|
1437
|
+
embedType: "report",
|
|
1438
|
+
componentId: e.componentId,
|
|
1439
|
+
userId: e.userId,
|
|
1440
|
+
tenantId: e.tenantId
|
|
1441
|
+
}), a = await this.apiClient.getReportRender(
|
|
1442
|
+
e.dashboardId,
|
|
1443
|
+
e.componentId,
|
|
1444
|
+
i,
|
|
1445
|
+
{ filters: e.filters || {} }
|
|
1446
|
+
), d = new H(s, e.theme || "light");
|
|
1447
|
+
return d.render(a, e.onReady), new w({
|
|
1448
|
+
dashboardId: e.dashboardId,
|
|
1449
|
+
componentId: e.componentId,
|
|
1450
|
+
token: i,
|
|
1451
|
+
embedType: "report",
|
|
1452
|
+
activeFilters: e.filters || {},
|
|
1453
|
+
apiClient: this.apiClient,
|
|
1454
|
+
renderer: d
|
|
1455
|
+
});
|
|
1456
|
+
} catch (i) {
|
|
1457
|
+
throw this.showError(s, (i == null ? void 0 : i.message) || "Failed to load report"), (r = e.onError) == null || r.call(e, (i == null ? void 0 : i.message) || "Failed to load report"), i;
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
// ── Private helpers ─────────────────────────────────────────────────────────
|
|
1461
|
+
createRoot(e, t) {
|
|
1462
|
+
e.innerHTML = "";
|
|
1463
|
+
const s = document.createElement("div");
|
|
1464
|
+
return s.className = `ds-embed-root ds-theme-${t}`, s.style.width = "100%", s.style.height = "100%", e.appendChild(s), s;
|
|
1465
|
+
}
|
|
1466
|
+
showLoading(e) {
|
|
1467
|
+
e.innerHTML = `
|
|
1468
|
+
<div class="ds-embed-loading">
|
|
1469
|
+
<div class="ds-embed-spinner"></div>
|
|
1470
|
+
<div class="ds-embed-loading-text">Loading…</div>
|
|
1471
|
+
</div>
|
|
1472
|
+
`;
|
|
1473
|
+
}
|
|
1474
|
+
showError(e, t) {
|
|
1475
|
+
e.innerHTML = `
|
|
1476
|
+
<div class="ds-embed-error">
|
|
1477
|
+
<div class="ds-embed-error-icon">⚠</div>
|
|
1478
|
+
<div>${t}</div>
|
|
1479
|
+
<div class="ds-embed-error-message">Check your SDK configuration.</div>
|
|
1480
|
+
</div>
|
|
1481
|
+
`;
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
const L = class L extends HTMLElement {
|
|
1485
|
+
constructor() {
|
|
1486
|
+
super(...arguments), this.instance = null, this.connected = !1;
|
|
1487
|
+
}
|
|
1488
|
+
connectedCallback() {
|
|
1489
|
+
this.connected = !0, F(), this.style.display = "block", this.renderRoot = document.createElement("div"), this.renderRoot.className = "ds-embed-root", this.appendChild(this.renderRoot), this.mount();
|
|
1490
|
+
}
|
|
1491
|
+
disconnectedCallback() {
|
|
1492
|
+
var e;
|
|
1493
|
+
this.connected = !1, (e = this.instance) == null || e.destroy(), this.instance = null;
|
|
1494
|
+
}
|
|
1495
|
+
attributeChangedCallback(e, t, s) {
|
|
1496
|
+
var r;
|
|
1497
|
+
t === s || !this.connected || ((r = this.instance) == null || r.destroy(), this.instance = null, this.mount());
|
|
1498
|
+
}
|
|
1499
|
+
async mount() {
|
|
1500
|
+
const e = this.getAttribute("dashboard-id"), t = this.getAttribute("api-key"), s = this.getAttribute("base-url") || "", r = this.getAttribute("user-id") || void 0, i = this.getAttribute("tenant-id") || void 0, a = this.getAttribute("embed-level") || "dashboard", d = this.getAttribute("theme") || "light", o = this.getAttribute("height") || "600px", n = this.getAttribute("page-id") || void 0, b = this.getAttribute("tab-id") || void 0, h = this.getAttribute("hide-filters") === "true", l = this.getAttribute("hide-export") === "true";
|
|
1501
|
+
if (!e || !t || !s) {
|
|
1502
|
+
this.showError("Missing required attributes: dashboard-id, api-key, base-url");
|
|
1503
|
+
return;
|
|
1504
|
+
}
|
|
1505
|
+
this.renderRoot.style.height = o, this.renderRoot.className = `ds-embed-root ds-theme-${d}`, this.showLoading();
|
|
1506
|
+
try {
|
|
1507
|
+
const c = new S(s, t), p = await c.getEmbedToken({
|
|
1508
|
+
dashboardId: e,
|
|
1509
|
+
embedType: "dashboard",
|
|
1510
|
+
embedLevel: a,
|
|
1511
|
+
userId: r,
|
|
1512
|
+
tenantId: i
|
|
1513
|
+
}), g = await c.getDashboardRender(e, p, {
|
|
1514
|
+
embedLevel: a,
|
|
1515
|
+
pageId: n,
|
|
1516
|
+
tabId: b,
|
|
1517
|
+
filters: {}
|
|
1518
|
+
}), m = new N(this.renderRoot, {
|
|
1519
|
+
embedLevel: a,
|
|
1520
|
+
theme: d,
|
|
1521
|
+
hideFilters: h,
|
|
1522
|
+
hideExport: l,
|
|
1523
|
+
initialFilters: {},
|
|
1524
|
+
onFetchFilterOptions: (f) => c.getFilterOptions(e, f, p),
|
|
1525
|
+
onTabSwitch: async (f, y) => {
|
|
1526
|
+
var x, v;
|
|
1527
|
+
try {
|
|
1528
|
+
const I = await c.getDashboardRender(e, p, {
|
|
1529
|
+
embedLevel: a,
|
|
1530
|
+
pageId: f,
|
|
1531
|
+
tabId: y,
|
|
1532
|
+
filters: (v = (x = this.instance) == null ? void 0 : x.getActiveFilters()) != null ? v : {}
|
|
1533
|
+
});
|
|
1534
|
+
m.update(I);
|
|
1535
|
+
} catch (I) {
|
|
1536
|
+
console.error("Deepspot SDK: tab fetch failed", I);
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
});
|
|
1540
|
+
m.render(g), this.instance = new w({
|
|
1541
|
+
dashboardId: e,
|
|
1542
|
+
token: p,
|
|
1543
|
+
embedLevel: a,
|
|
1544
|
+
embedType: "dashboard",
|
|
1545
|
+
activePageId: g.activePage,
|
|
1546
|
+
activeTabId: g.activeTab,
|
|
1547
|
+
activeFilters: {},
|
|
1548
|
+
apiClient: c,
|
|
1549
|
+
renderer: m
|
|
1550
|
+
});
|
|
1551
|
+
} catch (c) {
|
|
1552
|
+
this.showError((c == null ? void 0 : c.message) || "Failed to load dashboard");
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
showLoading() {
|
|
1556
|
+
this.renderRoot.innerHTML = `
|
|
1557
|
+
<div class="ds-embed-loading">
|
|
1558
|
+
<div class="ds-embed-spinner"></div>
|
|
1559
|
+
<div class="ds-embed-loading-text">Loading dashboard…</div>
|
|
1560
|
+
</div>`;
|
|
1561
|
+
}
|
|
1562
|
+
showError(e) {
|
|
1563
|
+
this.renderRoot && (this.renderRoot.innerHTML = `
|
|
1564
|
+
<div class="ds-embed-error">
|
|
1565
|
+
<div class="ds-embed-error-icon">⚠</div>
|
|
1566
|
+
<div>${e}</div>
|
|
1567
|
+
<div class="ds-embed-error-message">Check your api-key, base-url and dashboard-id.</div>
|
|
1568
|
+
</div>`);
|
|
1569
|
+
}
|
|
1570
|
+
// Public API
|
|
1571
|
+
setFilter(e, t) {
|
|
1572
|
+
var s;
|
|
1573
|
+
(s = this.instance) == null || s.setFilter(e, t);
|
|
1574
|
+
}
|
|
1575
|
+
setFilters(e) {
|
|
1576
|
+
var t;
|
|
1577
|
+
(t = this.instance) == null || t.setFilters(e);
|
|
1578
|
+
}
|
|
1579
|
+
goToPage(e) {
|
|
1580
|
+
var t;
|
|
1581
|
+
(t = this.instance) == null || t.goToPage(e);
|
|
1582
|
+
}
|
|
1583
|
+
goToTab(e, t) {
|
|
1584
|
+
var s;
|
|
1585
|
+
(s = this.instance) == null || s.goToTab(e, t);
|
|
1586
|
+
}
|
|
1587
|
+
refresh() {
|
|
1588
|
+
var e;
|
|
1589
|
+
(e = this.instance) == null || e.refresh();
|
|
1590
|
+
}
|
|
1591
|
+
exportPDF() {
|
|
1592
|
+
var e;
|
|
1593
|
+
(e = this.instance) == null || e.exportPDF();
|
|
1594
|
+
}
|
|
1595
|
+
};
|
|
1596
|
+
L.observedAttributes = [
|
|
1597
|
+
"dashboard-id",
|
|
1598
|
+
"api-key",
|
|
1599
|
+
"user-id",
|
|
1600
|
+
"tenant-id",
|
|
1601
|
+
"base-url",
|
|
1602
|
+
"embed-level",
|
|
1603
|
+
"theme",
|
|
1604
|
+
"height",
|
|
1605
|
+
"page-id",
|
|
1606
|
+
"tab-id",
|
|
1607
|
+
"hide-filters",
|
|
1608
|
+
"hide-export"
|
|
1609
|
+
];
|
|
1610
|
+
let T = L;
|
|
1611
|
+
customElements.get("deepspot-dashboard") || customElements.define("deepspot-dashboard", T);
|
|
1612
|
+
const A = class A extends HTMLElement {
|
|
1613
|
+
constructor() {
|
|
1614
|
+
super(...arguments), this.instance = null, this.isConnected_ = !1;
|
|
1615
|
+
}
|
|
1616
|
+
connectedCallback() {
|
|
1617
|
+
this.isConnected_ = !0, F(), this.style.display = "block", this.renderRoot = document.createElement("div"), this.renderRoot.className = "ds-embed-root", this.appendChild(this.renderRoot), this.mount();
|
|
1618
|
+
}
|
|
1619
|
+
disconnectedCallback() {
|
|
1620
|
+
var e;
|
|
1621
|
+
this.isConnected_ = !1, (e = this.instance) == null || e.destroy(), this.instance = null;
|
|
1622
|
+
}
|
|
1623
|
+
attributeChangedCallback(e, t, s) {
|
|
1624
|
+
var r;
|
|
1625
|
+
t !== s && this.isConnected_ && ((r = this.instance) == null || r.destroy(), this.instance = null, this.mount());
|
|
1626
|
+
}
|
|
1627
|
+
async mount() {
|
|
1628
|
+
const e = this.getAttribute("dashboard-id"), t = this.getAttribute("component-id"), s = this.getAttribute("api-key"), r = this.getAttribute("base-url") || "", i = this.getAttribute("user-id") || void 0, a = this.getAttribute("tenant-id") || void 0, d = this.getAttribute("theme") || "light", o = this.getAttribute("height") || "400px";
|
|
1629
|
+
if (!e || !t || !s || !r) {
|
|
1630
|
+
this.showError("Missing required attributes: dashboard-id, component-id, api-key, base-url");
|
|
1631
|
+
return;
|
|
1632
|
+
}
|
|
1633
|
+
this.renderRoot.style.height = o, this.renderRoot.className = `ds-embed-root ds-theme-${d}`, this.showLoading();
|
|
1634
|
+
try {
|
|
1635
|
+
const n = new S(r, s), b = await n.getEmbedToken({
|
|
1636
|
+
dashboardId: e,
|
|
1637
|
+
embedType: "report",
|
|
1638
|
+
componentId: t,
|
|
1639
|
+
userId: i,
|
|
1640
|
+
tenantId: a
|
|
1641
|
+
}), h = await n.getReportRender(e, t, b, {
|
|
1642
|
+
filters: {}
|
|
1643
|
+
}), l = new H(this.renderRoot, d);
|
|
1644
|
+
l.render(h, () => {
|
|
1645
|
+
}), this.instance = new w({
|
|
1646
|
+
dashboardId: e,
|
|
1647
|
+
componentId: t,
|
|
1648
|
+
token: b,
|
|
1649
|
+
embedType: "report",
|
|
1650
|
+
activeFilters: {},
|
|
1651
|
+
apiClient: n,
|
|
1652
|
+
renderer: l
|
|
1653
|
+
});
|
|
1654
|
+
} catch (n) {
|
|
1655
|
+
this.showError((n == null ? void 0 : n.message) || "Failed to load report");
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
showLoading() {
|
|
1659
|
+
this.renderRoot.innerHTML = `
|
|
1660
|
+
<div class="ds-embed-loading">
|
|
1661
|
+
<div class="ds-embed-spinner"></div>
|
|
1662
|
+
<div class="ds-embed-loading-text">Loading report…</div>
|
|
1663
|
+
</div>
|
|
1664
|
+
`;
|
|
1665
|
+
}
|
|
1666
|
+
showError(e) {
|
|
1667
|
+
this.renderRoot && (this.renderRoot.innerHTML = `
|
|
1668
|
+
<div class="ds-embed-error">
|
|
1669
|
+
<div class="ds-embed-error-icon">⚠</div>
|
|
1670
|
+
<div>${e}</div>
|
|
1671
|
+
<div class="ds-embed-error-message">Check your api-key, base-url, dashboard-id and component-id.</div>
|
|
1672
|
+
</div>
|
|
1673
|
+
`);
|
|
1674
|
+
}
|
|
1675
|
+
setFilter(e, t) {
|
|
1676
|
+
var s;
|
|
1677
|
+
(s = this.instance) == null || s.setFilter(e, t);
|
|
1678
|
+
}
|
|
1679
|
+
setFilters(e) {
|
|
1680
|
+
var t;
|
|
1681
|
+
(t = this.instance) == null || t.setFilters(e);
|
|
1682
|
+
}
|
|
1683
|
+
refresh() {
|
|
1684
|
+
var e;
|
|
1685
|
+
(e = this.instance) == null || e.refresh();
|
|
1686
|
+
}
|
|
1687
|
+
};
|
|
1688
|
+
A.observedAttributes = [
|
|
1689
|
+
"dashboard-id",
|
|
1690
|
+
"component-id",
|
|
1691
|
+
"api-key",
|
|
1692
|
+
"user-id",
|
|
1693
|
+
"tenant-id",
|
|
1694
|
+
"base-url",
|
|
1695
|
+
"theme",
|
|
1696
|
+
"height"
|
|
1697
|
+
];
|
|
1698
|
+
let k = A;
|
|
1699
|
+
customElements.get("deepspot-report") || customElements.define("deepspot-report", k);
|
|
1700
|
+
customElements.get("deepspot-dashboard") || customElements.define("deepspot-dashboard", T);
|
|
1701
|
+
customElements.get("deepspot-report") || customElements.define("deepspot-report", k);
|
|
1702
|
+
export {
|
|
1703
|
+
U as DeepspotSDK
|
|
1704
|
+
};
|