@restio/ui 0.2.1-20261007123729 → 0.2.1-20261117141230
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/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.js +1 -1
- package/dist/experimental.cjs +2 -2
- package/dist/experimental.js +446 -441
- package/dist/framework.cjs +1 -1
- package/dist/framework.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-Bzrq1hWW.js → src-C5tNrBNS.js} +11490 -11400
- package/dist/src-Deyw30nR.cjs +158 -0
- package/dist/ui.css +1 -1
- package/package.json +27 -27
- package/dist/src-kY7g6XFo.cjs +0 -158
package/dist/experimental.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { A as Ie, B as fe, Bt as Ee, D as Pe, E as xe, Et as ge, Ft as
|
|
2
|
-
import { useCallback as
|
|
1
|
+
import { A as Ie, B as fe, Bt as Ee, D as Pe, E as xe, Et as ge, Ft as ce, Ht as Q, I as Fe, It as Oe, Jt as Be, Lt as Te, N as Ae, O as pe, Pt as $e, Rt as _e, T as Le, Wt as se, Y as Ge, Yt as He, f as Ve, jt as be, mt as ke, nt as Ye, pt as qe, q as Ke, qt as ve, rt as Ne, u as Xe, w as Je, wt as Qe, z as Ze } from "./src-C5tNrBNS.js";
|
|
2
|
+
import { useCallback as j, useEffect as te, useMemo as X, useRef as ne, useState as z } from "react";
|
|
3
3
|
import { createPortal as Ue } from "react-dom";
|
|
4
|
-
var er = { "rst-pip-container": "_rst-pip-container_63eby_1" }, e = Be(), kr = ({ pipWindow: r, className: a, children: i, ...s }) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
var er = { "rst-pip-container": "_rst-pip-container_63eby_1" }, e = Be(), kr = ({ pipWindow: r, className: a, children: i, ...s }) => {
|
|
5
|
+
if (!r) return null;
|
|
6
|
+
const h = [er["rst-pip-container"], a].filter(Boolean).join(" ");
|
|
7
|
+
return Ue(/* @__PURE__ */ (0, e.jsx)("div", {
|
|
8
|
+
className: h,
|
|
9
|
+
...s,
|
|
10
|
+
children: i
|
|
11
|
+
}), r.document.body);
|
|
12
|
+
};
|
|
9
13
|
function Se() {
|
|
10
14
|
return globalThis.documentPictureInPicture;
|
|
11
15
|
}
|
|
@@ -17,7 +21,7 @@ function ar(r, a = document) {
|
|
|
17
21
|
for (const { name: i, value: s } of Array.from(a.documentElement.attributes)) r.documentElement.setAttribute(i, s);
|
|
18
22
|
for (const { name: i, value: s } of Array.from(a.body.attributes)) r.body.setAttribute(i, s);
|
|
19
23
|
}
|
|
20
|
-
function
|
|
24
|
+
function sr(r) {
|
|
21
25
|
const a = r.createElement("style");
|
|
22
26
|
a.textContent = [
|
|
23
27
|
"html, body { height: 100%; margin: 0; }",
|
|
@@ -30,32 +34,32 @@ function tr(r) {
|
|
|
30
34
|
`), r.head.appendChild(a);
|
|
31
35
|
}
|
|
32
36
|
function Nr({ width: r, height: a, copyStyles: i = !0 } = {}) {
|
|
33
|
-
const [s,
|
|
34
|
-
const
|
|
35
|
-
if (!(!
|
|
36
|
-
|
|
37
|
+
const [s, h] = z(null), [b, f] = z(null), w = ne(null), k = j(async () => {
|
|
38
|
+
const g = Se();
|
|
39
|
+
if (!(!g || w.current)) {
|
|
40
|
+
f(null);
|
|
37
41
|
try {
|
|
38
|
-
const
|
|
42
|
+
const x = await g.requestWindow({
|
|
39
43
|
width: r,
|
|
40
44
|
height: a
|
|
41
45
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}),
|
|
45
|
-
} catch (
|
|
46
|
-
|
|
46
|
+
w.current = x, i && ar(x.document), sr(x.document), x.addEventListener("pagehide", () => {
|
|
47
|
+
w.current = null, h(null);
|
|
48
|
+
}), h(x);
|
|
49
|
+
} catch (x) {
|
|
50
|
+
f(x instanceof Error ? `${x.name}: ${x.message}` : String(x));
|
|
47
51
|
}
|
|
48
52
|
}
|
|
49
53
|
}, [
|
|
50
54
|
r,
|
|
51
55
|
a,
|
|
52
56
|
i
|
|
53
|
-
]), c =
|
|
54
|
-
|
|
57
|
+
]), c = j(() => {
|
|
58
|
+
w.current?.close();
|
|
55
59
|
}, []);
|
|
56
|
-
return
|
|
60
|
+
return te(() => () => w.current?.close(), []), {
|
|
57
61
|
pipWindow: s,
|
|
58
|
-
error:
|
|
62
|
+
error: b,
|
|
59
63
|
isOpen: s !== null,
|
|
60
64
|
isSupported: rr(),
|
|
61
65
|
open: k,
|
|
@@ -63,32 +67,32 @@ function Nr({ width: r, height: a, copyStyles: i = !0 } = {}) {
|
|
|
63
67
|
};
|
|
64
68
|
}
|
|
65
69
|
var Sr = 1;
|
|
66
|
-
function
|
|
67
|
-
const i = r.col + r.w, s = r.row + r.h,
|
|
68
|
-
return r.col <
|
|
70
|
+
function tr(r, a) {
|
|
71
|
+
const i = r.col + r.w, s = r.row + r.h, h = a.col + a.w, b = a.row + a.h;
|
|
72
|
+
return r.col < h && i > a.col && r.row < b && s > a.row;
|
|
69
73
|
}
|
|
70
74
|
function ye(r) {
|
|
71
75
|
return r.col >= 1 && r.col + r.w - 1 <= 12 && r.row >= 1 && r.row + r.h - 1 <= 30;
|
|
72
76
|
}
|
|
73
|
-
function
|
|
77
|
+
function he(r, a, i) {
|
|
74
78
|
for (const s of a)
|
|
75
|
-
if (s.id !== i &&
|
|
79
|
+
if (s.id !== i && tr(r, s.position))
|
|
76
80
|
return s.id;
|
|
77
81
|
return null;
|
|
78
82
|
}
|
|
79
83
|
function Me(r, a, i) {
|
|
80
|
-
for (let
|
|
81
|
-
const
|
|
82
|
-
col:
|
|
83
|
-
row:
|
|
84
|
+
for (let b = 1; b <= 30 - a + 1; b++) for (let f = 1; f <= 12 - r + 1; f++) {
|
|
85
|
+
const w = {
|
|
86
|
+
col: f,
|
|
87
|
+
row: b,
|
|
84
88
|
w: r,
|
|
85
89
|
h: a
|
|
86
90
|
};
|
|
87
|
-
if (!
|
|
91
|
+
if (!he(w, i)) return w;
|
|
88
92
|
}
|
|
89
93
|
return {
|
|
90
94
|
col: 1,
|
|
91
|
-
row: i.reduce((
|
|
95
|
+
row: i.reduce((b, f) => Math.max(b, f.position.row + f.position.h), 1),
|
|
92
96
|
w: r,
|
|
93
97
|
h: a
|
|
94
98
|
};
|
|
@@ -96,11 +100,11 @@ function Me(r, a, i) {
|
|
|
96
100
|
function dr(r, a) {
|
|
97
101
|
const i = {};
|
|
98
102
|
for (const s of r) {
|
|
99
|
-
const
|
|
100
|
-
if (!
|
|
101
|
-
const
|
|
102
|
-
for (const
|
|
103
|
-
i[s.dataSourceId] =
|
|
103
|
+
const h = a[s.dataSourceId];
|
|
104
|
+
if (!h) continue;
|
|
105
|
+
const b = h.data ?? [], f = b.length > 0 ? Object.keys(b[0]) : [], w = ke(f), k = s.columns ?? w, c = Ne(k), g = /* @__PURE__ */ new Set(), x = [];
|
|
106
|
+
for (const _ of c) g.has(_.id) || (g.add(_.id), x.push(_));
|
|
107
|
+
i[s.dataSourceId] = x;
|
|
104
108
|
}
|
|
105
109
|
return i;
|
|
106
110
|
}
|
|
@@ -117,93 +121,93 @@ function Ce() {
|
|
|
117
121
|
};
|
|
118
122
|
}
|
|
119
123
|
function ir(r, a) {
|
|
120
|
-
const [i, s] =
|
|
124
|
+
const [i, s] = z(r ?? Ce), [h, b] = z(null), [f, w] = z(a ? "view" : "edit"), k = ne(!1), c = j(() => {
|
|
121
125
|
k.current = !0;
|
|
122
|
-
}, []),
|
|
126
|
+
}, []), g = j((o, p, I) => {
|
|
123
127
|
s((d) => {
|
|
124
128
|
const C = {
|
|
125
129
|
id: we(),
|
|
126
|
-
title: `New ${
|
|
127
|
-
componentType:
|
|
128
|
-
dataSourceId:
|
|
129
|
-
position:
|
|
130
|
+
title: `New ${o}`,
|
|
131
|
+
componentType: o,
|
|
132
|
+
dataSourceId: p,
|
|
133
|
+
position: I
|
|
130
134
|
};
|
|
131
135
|
return {
|
|
132
136
|
...d,
|
|
133
137
|
widgets: [...d.widgets, C]
|
|
134
138
|
};
|
|
135
139
|
}), c();
|
|
136
|
-
}, [c]),
|
|
137
|
-
s((
|
|
138
|
-
const
|
|
140
|
+
}, [c]), x = j((o) => {
|
|
141
|
+
s((p) => {
|
|
142
|
+
const I = Me(6, 3, p.widgets), d = {
|
|
139
143
|
id: we(),
|
|
140
|
-
position:
|
|
141
|
-
...
|
|
144
|
+
position: I,
|
|
145
|
+
...o.widget
|
|
142
146
|
};
|
|
143
147
|
return {
|
|
144
|
-
...
|
|
145
|
-
widgets: [...
|
|
148
|
+
...p,
|
|
149
|
+
widgets: [...p.widgets, d]
|
|
146
150
|
};
|
|
147
151
|
}), c();
|
|
148
|
-
}, [c]),
|
|
149
|
-
s((
|
|
150
|
-
...
|
|
151
|
-
widgets:
|
|
152
|
-
})),
|
|
153
|
-
}, [c]),
|
|
154
|
-
s((
|
|
155
|
-
...
|
|
156
|
-
widgets:
|
|
157
|
-
if (d.id !==
|
|
152
|
+
}, [c]), _ = j((o) => {
|
|
153
|
+
s((p) => ({
|
|
154
|
+
...p,
|
|
155
|
+
widgets: p.widgets.filter((I) => I.id !== o)
|
|
156
|
+
})), b((p) => p === o ? null : p), c();
|
|
157
|
+
}, [c]), W = j((o, p) => {
|
|
158
|
+
s((I) => ({
|
|
159
|
+
...I,
|
|
160
|
+
widgets: I.widgets.map((d) => {
|
|
161
|
+
if (d.id !== o) return d;
|
|
158
162
|
const C = {
|
|
159
163
|
...d,
|
|
160
|
-
...
|
|
164
|
+
...p
|
|
161
165
|
};
|
|
162
|
-
if (
|
|
163
|
-
const
|
|
164
|
-
C.columns = void 0, C.componentProps = xe(
|
|
166
|
+
if (p.dataSourceId && p.dataSourceId !== d.dataSourceId) {
|
|
167
|
+
const F = pe[d.componentType] ?? [];
|
|
168
|
+
C.columns = void 0, C.componentProps = xe(F), C.filters = void 0, C.uiConfig = void 0;
|
|
165
169
|
}
|
|
166
170
|
return C;
|
|
167
171
|
})
|
|
168
172
|
})), c();
|
|
169
|
-
}, [c]),
|
|
170
|
-
|
|
171
|
-
}, [
|
|
172
|
-
|
|
173
|
-
}, []), L = i.widgets.find((
|
|
174
|
-
s((
|
|
175
|
-
...
|
|
176
|
-
name:
|
|
173
|
+
}, [c]), l = j((o, p) => {
|
|
174
|
+
W(o, { position: p });
|
|
175
|
+
}, [W]), P = j((o) => {
|
|
176
|
+
b(o);
|
|
177
|
+
}, []), L = i.widgets.find((o) => o.id === h) ?? null, B = j((o) => {
|
|
178
|
+
s((p) => ({
|
|
179
|
+
...p,
|
|
180
|
+
name: o
|
|
177
181
|
})), c();
|
|
178
|
-
}, [c]), t =
|
|
179
|
-
s((
|
|
180
|
-
...
|
|
181
|
-
filters: typeof
|
|
182
|
+
}, [c]), t = j((o) => {
|
|
183
|
+
s((p) => ({
|
|
184
|
+
...p,
|
|
185
|
+
filters: typeof o == "function" ? o(p.filters) : o
|
|
182
186
|
})), c();
|
|
183
|
-
}, [c]),
|
|
184
|
-
s(
|
|
185
|
-
}, []),
|
|
186
|
-
s(
|
|
187
|
+
}, [c]), u = j((o) => {
|
|
188
|
+
s(o ?? Ce()), b(null), k.current = !1;
|
|
189
|
+
}, []), M = j((o) => {
|
|
190
|
+
s(o), b(null), k.current = !1;
|
|
187
191
|
}, []);
|
|
188
192
|
return {
|
|
189
193
|
state: {
|
|
190
194
|
config: i,
|
|
191
|
-
selectedWidgetId:
|
|
195
|
+
selectedWidgetId: h,
|
|
192
196
|
isDirty: k.current
|
|
193
197
|
},
|
|
194
|
-
mode:
|
|
195
|
-
setMode:
|
|
196
|
-
addWidget:
|
|
197
|
-
addPrebuiltWidget:
|
|
198
|
-
removeWidget:
|
|
199
|
-
updateWidget:
|
|
200
|
-
moveWidget:
|
|
201
|
-
selectWidget:
|
|
198
|
+
mode: f,
|
|
199
|
+
setMode: w,
|
|
200
|
+
addWidget: g,
|
|
201
|
+
addPrebuiltWidget: x,
|
|
202
|
+
removeWidget: _,
|
|
203
|
+
updateWidget: W,
|
|
204
|
+
moveWidget: l,
|
|
205
|
+
selectWidget: P,
|
|
202
206
|
selectedWidget: L,
|
|
203
|
-
setName:
|
|
207
|
+
setName: B,
|
|
204
208
|
setFilters: t,
|
|
205
|
-
resetConfig:
|
|
206
|
-
loadConfig:
|
|
209
|
+
resetConfig: u,
|
|
210
|
+
loadConfig: M
|
|
207
211
|
};
|
|
208
212
|
}
|
|
209
213
|
var n = {
|
|
@@ -263,141 +267,141 @@ var n = {
|
|
|
263
267
|
"rst-dashboard-builder-template-item": "_rst-dashboard-builder-template-item_ukxxh_705",
|
|
264
268
|
"rst-dashboard-builder-template-item-name": "_rst-dashboard-builder-template-item-name_ukxxh_727",
|
|
265
269
|
"rst-dashboard-builder-template-item-desc": "_rst-dashboard-builder-template-item-desc_ukxxh_733"
|
|
266
|
-
},
|
|
270
|
+
}, ee = 12, ie = 30, me = 12;
|
|
267
271
|
function nr({ widgets: r, onMoveWidget: a, onAddWidget: i, onChange: s }) {
|
|
268
|
-
const
|
|
269
|
-
colWidth: (
|
|
272
|
+
const h = ne(null), [b, f] = z(null), [w, k] = z(null), [c, g] = z(null), [x, _] = z(null), [W, l] = z(!1), [P, L] = z(null), [B, t] = z(null), [u, M] = z(null), [o, p] = z(null), [I, d] = z(!1), C = j(() => h.current ? {
|
|
273
|
+
colWidth: (h.current.getBoundingClientRect().width - 132) / ee,
|
|
270
274
|
rowHeight: 92
|
|
271
|
-
} : null, []),
|
|
272
|
-
if (!
|
|
275
|
+
} : null, []), F = j((y, N) => {
|
|
276
|
+
if (!h.current) return {
|
|
273
277
|
col: 1,
|
|
274
278
|
row: 1
|
|
275
279
|
};
|
|
276
|
-
const
|
|
280
|
+
const R = h.current.getBoundingClientRect(), D = (R.width - 132) / ee;
|
|
277
281
|
return {
|
|
278
|
-
col: Math.max(1, Math.min(
|
|
279
|
-
row: Math.max(1, Math.min(
|
|
282
|
+
col: Math.max(1, Math.min(ee, Math.round((y - R.left) / (D + me)) + 1)),
|
|
283
|
+
row: Math.max(1, Math.min(ie, Math.round((N - R.top) / 92) + 1))
|
|
280
284
|
};
|
|
281
|
-
}, []),
|
|
282
|
-
if (
|
|
283
|
-
|
|
285
|
+
}, []), Z = j((y) => {
|
|
286
|
+
if (y.preventDefault(), y.dataTransfer.types.includes("application/widget-type")) {
|
|
287
|
+
y.dataTransfer.dropEffect = "copy";
|
|
284
288
|
return;
|
|
285
289
|
}
|
|
286
|
-
if (
|
|
287
|
-
|
|
288
|
-
const N = r.find((
|
|
290
|
+
if (y.dataTransfer.types.includes("application/move-widget") && b && w && c) {
|
|
291
|
+
y.dataTransfer.dropEffect = "move";
|
|
292
|
+
const N = r.find((E) => E.id === b);
|
|
289
293
|
if (!N) return;
|
|
290
|
-
const
|
|
291
|
-
if (!
|
|
292
|
-
const
|
|
293
|
-
col: Math.max(1, Math.min(
|
|
294
|
-
row: Math.max(1, Math.min(
|
|
294
|
+
const R = C();
|
|
295
|
+
if (!R) return;
|
|
296
|
+
const D = y.clientX - w.x, G = y.clientY - w.y, oe = Math.round(D / (R.colWidth + me)), Y = Math.round(G / R.rowHeight), H = {
|
|
297
|
+
col: Math.max(1, Math.min(ee - N.position.w + 1, c.col + oe)),
|
|
298
|
+
row: Math.max(1, Math.min(ie - N.position.h + 1, c.row + Y)),
|
|
295
299
|
w: N.position.w,
|
|
296
300
|
h: N.position.h
|
|
297
301
|
};
|
|
298
|
-
|
|
299
|
-
const T =
|
|
300
|
-
|
|
302
|
+
_(H);
|
|
303
|
+
const T = he(H, r, b);
|
|
304
|
+
l(T !== null);
|
|
301
305
|
}
|
|
302
306
|
}, [
|
|
303
|
-
|
|
304
|
-
|
|
307
|
+
b,
|
|
308
|
+
w,
|
|
305
309
|
c,
|
|
306
310
|
C,
|
|
307
311
|
r
|
|
308
|
-
]),
|
|
309
|
-
|
|
310
|
-
const N =
|
|
312
|
+
]), U = j((y) => {
|
|
313
|
+
y.preventDefault();
|
|
314
|
+
const N = y.dataTransfer.getData("application/widget-type");
|
|
311
315
|
if (N) {
|
|
312
|
-
const { col:
|
|
313
|
-
col:
|
|
314
|
-
row:
|
|
316
|
+
const { col: R, row: D } = F(y.clientX, y.clientY), G = {
|
|
317
|
+
col: R,
|
|
318
|
+
row: D,
|
|
315
319
|
w: 4,
|
|
316
320
|
h: 3
|
|
317
321
|
};
|
|
318
|
-
if (
|
|
322
|
+
if (R + 4 - 1 > ee && (G.col = 9), D + 3 - 1 > ie && (G.row = 28), he(G, r)) return;
|
|
319
323
|
i(N, "", G), s();
|
|
320
324
|
return;
|
|
321
325
|
}
|
|
322
|
-
|
|
326
|
+
b && x && (!W && ye(x) && (a(b, x), s()), f(null), k(null), g(null), _(null), l(!1));
|
|
323
327
|
}, [
|
|
324
|
-
|
|
328
|
+
F,
|
|
325
329
|
r,
|
|
326
330
|
i,
|
|
327
331
|
s,
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
332
|
+
b,
|
|
333
|
+
x,
|
|
334
|
+
W,
|
|
331
335
|
a
|
|
332
|
-
]), re =
|
|
333
|
-
|
|
334
|
-
x:
|
|
335
|
-
y:
|
|
336
|
-
}),
|
|
337
|
-
}, []),
|
|
338
|
-
|
|
339
|
-
}, []),
|
|
340
|
-
|
|
341
|
-
x:
|
|
342
|
-
y:
|
|
336
|
+
]), re = j((y, N) => {
|
|
337
|
+
y.stopPropagation(), y.dataTransfer.setData("application/move-widget", N.id), y.dataTransfer.effectAllowed = "move", f(N.id), k({
|
|
338
|
+
x: y.clientX,
|
|
339
|
+
y: y.clientY
|
|
340
|
+
}), g({ ...N.position }), _({ ...N.position }), l(!1);
|
|
341
|
+
}, []), de = j(() => {
|
|
342
|
+
f(null), k(null), g(null), _(null), l(!1);
|
|
343
|
+
}, []), v = j((y, N, R) => {
|
|
344
|
+
y.stopPropagation(), y.preventDefault(), L(N.id), t(R), M({ ...N.position }), p({
|
|
345
|
+
x: y.clientX,
|
|
346
|
+
y: y.clientY
|
|
343
347
|
}), d(!1);
|
|
344
348
|
}, []);
|
|
345
|
-
return
|
|
346
|
-
if (!
|
|
347
|
-
const
|
|
348
|
-
if (!r.find((S) => S.id ===
|
|
349
|
-
const
|
|
350
|
-
if (!
|
|
351
|
-
const G =
|
|
352
|
-
let
|
|
353
|
-
switch (
|
|
349
|
+
return te(() => {
|
|
350
|
+
if (!P || !B || !u || !o) return;
|
|
351
|
+
const y = (R) => {
|
|
352
|
+
if (!r.find((S) => S.id === P)) return;
|
|
353
|
+
const D = C();
|
|
354
|
+
if (!D) return;
|
|
355
|
+
const G = R.clientX - o.x, oe = R.clientY - o.y, Y = Math.round(G / (D.colWidth + me)), H = Math.round(oe / D.rowHeight), T = u.col, E = u.row, q = u.w, K = u.h;
|
|
356
|
+
let O = { ...u };
|
|
357
|
+
switch (B) {
|
|
354
358
|
case "e": {
|
|
355
|
-
const S = Math.max(1, Math.min(
|
|
356
|
-
|
|
357
|
-
...
|
|
359
|
+
const S = Math.max(1, Math.min(ee - T + 1, q + Y));
|
|
360
|
+
O = {
|
|
361
|
+
...O,
|
|
358
362
|
w: S
|
|
359
363
|
};
|
|
360
364
|
break;
|
|
361
365
|
}
|
|
362
366
|
case "w": {
|
|
363
367
|
const S = Math.max(1, Math.min(T + q - 1, T + Y)), A = T + q - S;
|
|
364
|
-
|
|
365
|
-
...
|
|
368
|
+
O = {
|
|
369
|
+
...u,
|
|
366
370
|
col: S,
|
|
367
371
|
w: Math.max(1, A)
|
|
368
372
|
};
|
|
369
373
|
break;
|
|
370
374
|
}
|
|
371
375
|
case "s": {
|
|
372
|
-
const S = Math.max(1, Math.min(
|
|
373
|
-
|
|
374
|
-
...
|
|
376
|
+
const S = Math.max(1, Math.min(ie - E + 1, K + H));
|
|
377
|
+
O = {
|
|
378
|
+
...u,
|
|
375
379
|
h: S
|
|
376
380
|
};
|
|
377
381
|
break;
|
|
378
382
|
}
|
|
379
383
|
case "n": {
|
|
380
|
-
const S = Math.max(1, Math.min(
|
|
381
|
-
|
|
382
|
-
...
|
|
384
|
+
const S = Math.max(1, Math.min(E + K - 1, E + H)), A = E + K - S;
|
|
385
|
+
O = {
|
|
386
|
+
...u,
|
|
383
387
|
row: S,
|
|
384
388
|
h: Math.max(1, A)
|
|
385
389
|
};
|
|
386
390
|
break;
|
|
387
391
|
}
|
|
388
392
|
case "se": {
|
|
389
|
-
const S = Math.max(1, Math.min(
|
|
390
|
-
|
|
391
|
-
...
|
|
393
|
+
const S = Math.max(1, Math.min(ee - T + 1, q + Y)), A = Math.max(1, Math.min(ie - E + 1, K + H));
|
|
394
|
+
O = {
|
|
395
|
+
...u,
|
|
392
396
|
w: S,
|
|
393
397
|
h: A
|
|
394
398
|
};
|
|
395
399
|
break;
|
|
396
400
|
}
|
|
397
401
|
case "sw": {
|
|
398
|
-
const S = Math.max(1, Math.min(T + q - 1, T + Y)), A = T + q - S, m = Math.max(1, Math.min(
|
|
399
|
-
|
|
400
|
-
...
|
|
402
|
+
const S = Math.max(1, Math.min(T + q - 1, T + Y)), A = T + q - S, m = Math.max(1, Math.min(ie - E + 1, K + H));
|
|
403
|
+
O = {
|
|
404
|
+
...u,
|
|
401
405
|
col: S,
|
|
402
406
|
w: Math.max(1, A),
|
|
403
407
|
h: m
|
|
@@ -405,9 +409,9 @@ function nr({ widgets: r, onMoveWidget: a, onAddWidget: i, onChange: s }) {
|
|
|
405
409
|
break;
|
|
406
410
|
}
|
|
407
411
|
case "ne": {
|
|
408
|
-
const S = Math.max(1, Math.min(
|
|
409
|
-
|
|
410
|
-
...
|
|
412
|
+
const S = Math.max(1, Math.min(E + K - 1, E + H)), A = E + K - S, m = Math.max(1, Math.min(ee - T + 1, q + Y));
|
|
413
|
+
O = {
|
|
414
|
+
...u,
|
|
411
415
|
row: S,
|
|
412
416
|
h: Math.max(1, A),
|
|
413
417
|
w: m
|
|
@@ -415,8 +419,8 @@ function nr({ widgets: r, onMoveWidget: a, onAddWidget: i, onChange: s }) {
|
|
|
415
419
|
break;
|
|
416
420
|
}
|
|
417
421
|
case "nw": {
|
|
418
|
-
const S = Math.max(1, Math.min(T + q - 1, T + Y)), A = Math.max(1, Math.min(
|
|
419
|
-
|
|
422
|
+
const S = Math.max(1, Math.min(T + q - 1, T + Y)), A = Math.max(1, Math.min(E + K - 1, E + H)), m = T + q - S, $ = E + K - A;
|
|
423
|
+
O = {
|
|
420
424
|
col: S,
|
|
421
425
|
row: A,
|
|
422
426
|
w: Math.max(1, m),
|
|
@@ -425,61 +429,61 @@ function nr({ widgets: r, onMoveWidget: a, onAddWidget: i, onChange: s }) {
|
|
|
425
429
|
break;
|
|
426
430
|
}
|
|
427
431
|
}
|
|
428
|
-
|
|
429
|
-
const
|
|
430
|
-
d(
|
|
432
|
+
_(O), f(P);
|
|
433
|
+
const le = he(O, r, P);
|
|
434
|
+
d(le !== null), l(le !== null);
|
|
431
435
|
}, N = () => {
|
|
432
|
-
r.find((
|
|
436
|
+
r.find((R) => R.id === P) && x && !I && ye(x) && (a(P, x), s()), L(null), t(null), M(null), p(null), d(!1), f(null), k(null), g(null), _(null), l(!1);
|
|
433
437
|
};
|
|
434
|
-
return document.addEventListener("mousemove",
|
|
435
|
-
document.removeEventListener("mousemove",
|
|
438
|
+
return document.addEventListener("mousemove", y), document.addEventListener("mouseup", N), () => {
|
|
439
|
+
document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", N);
|
|
436
440
|
};
|
|
437
441
|
}, [
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
l,
|
|
442
|
+
P,
|
|
443
|
+
B,
|
|
441
444
|
u,
|
|
445
|
+
o,
|
|
442
446
|
r,
|
|
443
|
-
|
|
444
|
-
|
|
447
|
+
x,
|
|
448
|
+
I,
|
|
445
449
|
C,
|
|
446
450
|
a,
|
|
447
451
|
s
|
|
448
452
|
]), {
|
|
449
|
-
gridRef:
|
|
450
|
-
draggingWidgetId:
|
|
451
|
-
dragPreviewPos:
|
|
452
|
-
hasCollision:
|
|
453
|
-
resizeCollision:
|
|
454
|
-
handleDragOver:
|
|
455
|
-
handleDrop:
|
|
453
|
+
gridRef: h,
|
|
454
|
+
draggingWidgetId: b,
|
|
455
|
+
dragPreviewPos: x,
|
|
456
|
+
hasCollision: W,
|
|
457
|
+
resizeCollision: I,
|
|
458
|
+
handleDragOver: Z,
|
|
459
|
+
handleDrop: U,
|
|
456
460
|
handleWidgetDragStart: re,
|
|
457
|
-
handleWidgetDragEnd:
|
|
458
|
-
handleResizeStart:
|
|
459
|
-
pixelToGrid:
|
|
461
|
+
handleWidgetDragEnd: de,
|
|
462
|
+
handleResizeStart: v,
|
|
463
|
+
pixelToGrid: F
|
|
460
464
|
};
|
|
461
465
|
}
|
|
462
|
-
var or = 12, lr = 20, De = ({ widgets: r, selectedWidgetId: a, dataSources: i, onSelectWidget: s, onMoveWidget:
|
|
463
|
-
const
|
|
466
|
+
var or = 12, lr = 20, De = ({ widgets: r, selectedWidgetId: a, dataSources: i, onSelectWidget: s, onMoveWidget: h, onRemoveWidget: b, onAddWidget: f, onChange: w, getWidgetActions: k, mode: c = "edit" }) => {
|
|
467
|
+
const g = c === "view", { gridRef: x, draggingWidgetId: _, dragPreviewPos: W, hasCollision: l, handleDragOver: P, handleDrop: L, handleWidgetDragStart: B, handleWidgetDragEnd: t, handleResizeStart: u } = nr({
|
|
464
468
|
widgets: r,
|
|
465
|
-
onMoveWidget:
|
|
466
|
-
onAddWidget:
|
|
467
|
-
onChange:
|
|
468
|
-
}),
|
|
469
|
+
onMoveWidget: h,
|
|
470
|
+
onAddWidget: f,
|
|
471
|
+
onChange: w
|
|
472
|
+
}), M = j((d, C) => {
|
|
469
473
|
d.stopPropagation(), s(C);
|
|
470
|
-
}, [s]),
|
|
474
|
+
}, [s]), o = j(() => {
|
|
471
475
|
s(null);
|
|
472
|
-
}, [s]),
|
|
473
|
-
const C = i[d.dataSourceId]?.data ?? [],
|
|
476
|
+
}, [s]), p = j((d) => {
|
|
477
|
+
const C = i[d.dataSourceId]?.data ?? [], F = C.length > 0 ? Object.keys(C[0]) : [];
|
|
474
478
|
return {
|
|
475
479
|
data: C,
|
|
476
|
-
columns: d.columns ?? ke(
|
|
480
|
+
columns: d.columns ?? ke(F)
|
|
477
481
|
};
|
|
478
|
-
}, [i]),
|
|
482
|
+
}, [i]), I = [];
|
|
479
483
|
for (let d = 1; d <= lr; d++) for (let C = 1; C <= or; C++) {
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
className:
|
|
484
|
+
const F = g ? n["rst-dashboard-builder-grid-cell-view"] : n["rst-dashboard-builder-grid-cell"];
|
|
485
|
+
I.push(/* @__PURE__ */ (0, e.jsx)("div", {
|
|
486
|
+
className: F,
|
|
483
487
|
style: {
|
|
484
488
|
gridColumn: C,
|
|
485
489
|
gridRow: d
|
|
@@ -488,42 +492,42 @@ var or = 12, lr = 20, De = ({ widgets: r, selectedWidgetId: a, dataSources: i, o
|
|
|
488
492
|
}
|
|
489
493
|
return /* @__PURE__ */ (0, e.jsx)("div", {
|
|
490
494
|
className: n["rst-dashboard-builder-canvas"],
|
|
491
|
-
onClick:
|
|
495
|
+
onClick: o,
|
|
492
496
|
children: /* @__PURE__ */ (0, e.jsxs)("div", {
|
|
493
|
-
ref:
|
|
497
|
+
ref: x,
|
|
494
498
|
className: n["rst-dashboard-builder-grid"],
|
|
495
|
-
onDragOver:
|
|
499
|
+
onDragOver: P,
|
|
496
500
|
onDrop: L,
|
|
497
501
|
children: [
|
|
498
|
-
|
|
502
|
+
I,
|
|
499
503
|
r.length === 0 && /* @__PURE__ */ (0, e.jsx)("div", {
|
|
500
504
|
className: n["rst-dashboard-builder-grid-empty"],
|
|
501
505
|
children: "Drag a widget from the palette to get started"
|
|
502
506
|
}),
|
|
503
507
|
r.map((d) => {
|
|
504
|
-
const C = !
|
|
508
|
+
const C = !g && d.id === a, F = !g && d.id === _, Z = p(d), U = F && W ? W : d.position, re = F && l, de = [
|
|
509
|
+
n["rst-dashboard-builder-widget"],
|
|
510
|
+
g ? n["rst-dashboard-builder-widget-view"] : "",
|
|
511
|
+
C ? n["rst-dashboard-builder-widget-selected"] : "",
|
|
512
|
+
F ? n["rst-dashboard-builder-widget-dragging"] : "",
|
|
513
|
+
re ? n["rst-dashboard-builder-widget-collision"] : ""
|
|
514
|
+
].filter(Boolean).join(" ");
|
|
505
515
|
return /* @__PURE__ */ (0, e.jsxs)("div", {
|
|
506
|
-
className:
|
|
507
|
-
n["rst-dashboard-builder-widget"],
|
|
508
|
-
f ? n["rst-dashboard-builder-widget-view"] : "",
|
|
509
|
-
C ? n["rst-dashboard-builder-widget-selected"] : "",
|
|
510
|
-
P ? n["rst-dashboard-builder-widget-dragging"] : "",
|
|
511
|
-
re ? n["rst-dashboard-builder-widget-collision"] : ""
|
|
512
|
-
].filter(Boolean).join(" "),
|
|
516
|
+
className: de,
|
|
513
517
|
style: {
|
|
514
|
-
gridColumn: `${
|
|
515
|
-
gridRow: `${
|
|
518
|
+
gridColumn: `${U.col} / span ${U.w}`,
|
|
519
|
+
gridRow: `${U.row} / span ${U.h}`
|
|
516
520
|
},
|
|
517
|
-
draggable: !
|
|
518
|
-
...
|
|
519
|
-
onDragStart: (
|
|
521
|
+
draggable: !g,
|
|
522
|
+
...g ? {} : {
|
|
523
|
+
onDragStart: (v) => B(v, d),
|
|
520
524
|
onDragEnd: t,
|
|
521
|
-
onClick: (
|
|
525
|
+
onClick: (v) => M(v, d.id),
|
|
522
526
|
role: "button",
|
|
523
527
|
tabIndex: 0,
|
|
524
528
|
"aria-label": `Widget: ${d.title}`,
|
|
525
|
-
onKeyDown: (
|
|
526
|
-
(
|
|
529
|
+
onKeyDown: (v) => {
|
|
530
|
+
(v.key === "Enter" || v.key === " ") && (v.preventDefault(), s(d.id)), (v.key === "Delete" || v.key === "Backspace") && (v.preventDefault(), b(d.id), w());
|
|
527
531
|
}
|
|
528
532
|
},
|
|
529
533
|
children: [/* @__PURE__ */ (0, e.jsx)(Xe, {
|
|
@@ -532,52 +536,52 @@ var or = 12, lr = 20, De = ({ widgets: r, selectedWidgetId: a, dataSources: i, o
|
|
|
532
536
|
title: d.title,
|
|
533
537
|
subtitle: d.subtitle,
|
|
534
538
|
icon: d.icon,
|
|
535
|
-
data:
|
|
536
|
-
columns:
|
|
539
|
+
data: Z.data,
|
|
540
|
+
columns: Z.columns,
|
|
537
541
|
enableExport: k?.(d).enableExport ?? !0,
|
|
538
542
|
enableScreenshot: k?.(d).enableScreenshot ?? !1,
|
|
539
543
|
enableExpand: k?.(d).enableExpand ?? !0,
|
|
540
544
|
enableFilter: k?.(d).enableFilter ?? !1,
|
|
541
|
-
fieldOptions: Ne(
|
|
542
|
-
children: ({ data:
|
|
543
|
-
data:
|
|
544
|
-
columns:
|
|
545
|
+
fieldOptions: Ne(Z.columns),
|
|
546
|
+
children: ({ data: v }) => /* @__PURE__ */ (0, e.jsx)(Je, {
|
|
547
|
+
data: v,
|
|
548
|
+
columns: Z.columns,
|
|
545
549
|
activeComponent: d.componentType,
|
|
546
550
|
componentProps: d.componentProps,
|
|
547
551
|
showConfigurator: !1
|
|
548
552
|
})
|
|
549
|
-
}), !
|
|
553
|
+
}), !g && C && /* @__PURE__ */ (0, e.jsxs)(e.Fragment, { children: [
|
|
550
554
|
/* @__PURE__ */ (0, e.jsx)("div", {
|
|
551
555
|
className: n["rst-dashboard-builder-resize-handle-n"],
|
|
552
|
-
onMouseDown: (
|
|
556
|
+
onMouseDown: (v) => u(v, d, "n")
|
|
553
557
|
}),
|
|
554
558
|
/* @__PURE__ */ (0, e.jsx)("div", {
|
|
555
559
|
className: n["rst-dashboard-builder-resize-handle-s"],
|
|
556
|
-
onMouseDown: (
|
|
560
|
+
onMouseDown: (v) => u(v, d, "s")
|
|
557
561
|
}),
|
|
558
562
|
/* @__PURE__ */ (0, e.jsx)("div", {
|
|
559
563
|
className: n["rst-dashboard-builder-resize-handle-e"],
|
|
560
|
-
onMouseDown: (
|
|
564
|
+
onMouseDown: (v) => u(v, d, "e")
|
|
561
565
|
}),
|
|
562
566
|
/* @__PURE__ */ (0, e.jsx)("div", {
|
|
563
567
|
className: n["rst-dashboard-builder-resize-handle-w"],
|
|
564
|
-
onMouseDown: (
|
|
568
|
+
onMouseDown: (v) => u(v, d, "w")
|
|
565
569
|
}),
|
|
566
570
|
/* @__PURE__ */ (0, e.jsx)("div", {
|
|
567
571
|
className: n["rst-dashboard-builder-resize-handle-ne"],
|
|
568
|
-
onMouseDown: (
|
|
572
|
+
onMouseDown: (v) => u(v, d, "ne")
|
|
569
573
|
}),
|
|
570
574
|
/* @__PURE__ */ (0, e.jsx)("div", {
|
|
571
575
|
className: n["rst-dashboard-builder-resize-handle-nw"],
|
|
572
|
-
onMouseDown: (
|
|
576
|
+
onMouseDown: (v) => u(v, d, "nw")
|
|
573
577
|
}),
|
|
574
578
|
/* @__PURE__ */ (0, e.jsx)("div", {
|
|
575
579
|
className: n["rst-dashboard-builder-resize-handle-se"],
|
|
576
|
-
onMouseDown: (
|
|
580
|
+
onMouseDown: (v) => u(v, d, "se")
|
|
577
581
|
}),
|
|
578
582
|
/* @__PURE__ */ (0, e.jsx)("div", {
|
|
579
583
|
className: n["rst-dashboard-builder-resize-handle-sw"],
|
|
580
|
-
onMouseDown: (
|
|
584
|
+
onMouseDown: (v) => u(v, d, "sw")
|
|
581
585
|
})
|
|
582
586
|
] })]
|
|
583
587
|
}, `${d.id}::${d.dataSourceId}`);
|
|
@@ -630,7 +634,7 @@ var cr = [
|
|
|
630
634
|
icon: "chart",
|
|
631
635
|
description: "Single-metric KPI card"
|
|
632
636
|
}
|
|
633
|
-
], ze = ({ widget: r, dataSources: a, onUpdate: i, onRemove: s, onClose:
|
|
637
|
+
], ze = ({ widget: r, dataSources: a, onUpdate: i, onRemove: s, onClose: h, onAddWidget: b, prebuiltSections: f, onAddPrebuiltSection: w }) => {
|
|
634
638
|
const k = Object.values(a).map((t) => ({
|
|
635
639
|
value: t.id,
|
|
636
640
|
label: t.name
|
|
@@ -640,40 +644,41 @@ var cr = [
|
|
|
640
644
|
}, ...Object.keys(He).map((t) => ({
|
|
641
645
|
value: t,
|
|
642
646
|
leadingVisual: t
|
|
643
|
-
}))], []),
|
|
644
|
-
if (!
|
|
645
|
-
const t = a[
|
|
646
|
-
return t ? t.fields.map((
|
|
647
|
-
id:
|
|
648
|
-
header:
|
|
649
|
-
accessorKey:
|
|
647
|
+
}))], []), g = r?.dataSourceId, x = X(() => {
|
|
648
|
+
if (!g) return [];
|
|
649
|
+
const t = a[g];
|
|
650
|
+
return t ? t.fields.map((u) => ({
|
|
651
|
+
id: u.id,
|
|
652
|
+
header: u.name,
|
|
653
|
+
accessorKey: u.id
|
|
650
654
|
})) : [];
|
|
651
|
-
}, [
|
|
652
|
-
i({ [t]:
|
|
653
|
-
}, [i]),
|
|
655
|
+
}, [g, a]), _ = X(() => pe[r?.componentType ?? "table-grid"] ?? [], [r?.componentType]), W = X(() => r?.componentProps ?? xe(_), [r?.componentProps, _]), l = j((t, u) => {
|
|
656
|
+
i({ [t]: u });
|
|
657
|
+
}, [i]), P = j((t) => {
|
|
658
|
+
const u = pe[t] ?? [];
|
|
654
659
|
i({
|
|
655
660
|
componentType: t,
|
|
656
|
-
componentProps: xe(
|
|
661
|
+
componentProps: xe(u)
|
|
657
662
|
});
|
|
658
|
-
}, [i]), L =
|
|
663
|
+
}, [i]), L = j((t, u) => {
|
|
659
664
|
i({ componentProps: {
|
|
660
|
-
...
|
|
661
|
-
[t]:
|
|
665
|
+
...W,
|
|
666
|
+
[t]: u
|
|
662
667
|
} });
|
|
663
|
-
}, [
|
|
668
|
+
}, [W, i]), B = X(() => !f || f.length === 0 ? [] : f.filter((t) => t.version === 1), [f]);
|
|
664
669
|
return r ? /* @__PURE__ */ (0, e.jsxs)("aside", {
|
|
665
670
|
className: n["rst-dashboard-builder-configurator"],
|
|
666
671
|
"aria-label": "Widget configurator",
|
|
667
672
|
children: [/* @__PURE__ */ (0, e.jsxs)("div", {
|
|
668
673
|
className: n["rst-dashboard-builder-configurator-header"],
|
|
669
|
-
children: [/* @__PURE__ */ (0, e.jsx)(
|
|
674
|
+
children: [/* @__PURE__ */ (0, e.jsx)(se, {
|
|
670
675
|
variant: "heading",
|
|
671
676
|
children: "Configure"
|
|
672
|
-
}), /* @__PURE__ */ (0, e.jsx)(
|
|
677
|
+
}), /* @__PURE__ */ (0, e.jsx)(Q, {
|
|
673
678
|
variant: "invisible",
|
|
674
679
|
size: "small",
|
|
675
680
|
leadingVisual: "close",
|
|
676
|
-
onClick:
|
|
681
|
+
onClick: h,
|
|
677
682
|
"aria-label": "Close configurator"
|
|
678
683
|
})]
|
|
679
684
|
}), /* @__PURE__ */ (0, e.jsxs)("div", {
|
|
@@ -686,7 +691,7 @@ var cr = [
|
|
|
686
691
|
children: "Title"
|
|
687
692
|
}), /* @__PURE__ */ (0, e.jsx)(_e, {
|
|
688
693
|
value: r.title,
|
|
689
|
-
onChange: (t) =>
|
|
694
|
+
onChange: (t) => l("title", t ?? ""),
|
|
690
695
|
placeholder: "Widget title"
|
|
691
696
|
})]
|
|
692
697
|
}),
|
|
@@ -697,7 +702,7 @@ var cr = [
|
|
|
697
702
|
children: "Subtitle"
|
|
698
703
|
}), /* @__PURE__ */ (0, e.jsx)(_e, {
|
|
699
704
|
value: r.subtitle ?? "",
|
|
700
|
-
onChange: (t) =>
|
|
705
|
+
onChange: (t) => l("subtitle", t || void 0),
|
|
701
706
|
placeholder: "Optional subtitle"
|
|
702
707
|
})]
|
|
703
708
|
}),
|
|
@@ -708,13 +713,13 @@ var cr = [
|
|
|
708
713
|
children: "Icon"
|
|
709
714
|
}), /* @__PURE__ */ (0, e.jsx)(ge, {
|
|
710
715
|
value: r.icon ?? "",
|
|
711
|
-
onChange: (t) =>
|
|
716
|
+
onChange: (t) => l("icon", t || void 0),
|
|
712
717
|
options: c,
|
|
713
|
-
renderList: ({ options: t, value:
|
|
718
|
+
renderList: ({ options: t, value: u, onChange: M, onClose: o }) => /* @__PURE__ */ (0, e.jsx)(Te, {
|
|
714
719
|
options: t,
|
|
715
|
-
activeIndex: [typeof
|
|
716
|
-
onClick: (
|
|
717
|
-
|
|
720
|
+
activeIndex: [typeof u == "string" ? u : ""],
|
|
721
|
+
onClick: (p) => {
|
|
722
|
+
M(p.value), o();
|
|
718
723
|
},
|
|
719
724
|
showFilter: !0
|
|
720
725
|
})
|
|
@@ -727,7 +732,7 @@ var cr = [
|
|
|
727
732
|
children: "Data Source"
|
|
728
733
|
}), /* @__PURE__ */ (0, e.jsx)(ge, {
|
|
729
734
|
value: r.dataSourceId,
|
|
730
|
-
onChange: (t) =>
|
|
735
|
+
onChange: (t) => l("dataSourceId", t),
|
|
731
736
|
options: k
|
|
732
737
|
})]
|
|
733
738
|
}),
|
|
@@ -743,12 +748,12 @@ var cr = [
|
|
|
743
748
|
})),
|
|
744
749
|
value: r.columns?.map((t) => t.id).filter(Boolean) ?? a[r.dataSourceId].fields.map((t) => t.id),
|
|
745
750
|
onChange: (t) => {
|
|
746
|
-
const
|
|
747
|
-
id:
|
|
748
|
-
header:
|
|
749
|
-
accessorKey:
|
|
751
|
+
const u = a[r.dataSourceId], M = t.map((o) => u.fields.find((p) => p.id === o)).filter(Boolean).map((o) => ({
|
|
752
|
+
id: o.id,
|
|
753
|
+
header: o.name,
|
|
754
|
+
accessorKey: o.id
|
|
750
755
|
}));
|
|
751
|
-
i({ columns:
|
|
756
|
+
i({ columns: M.length === u.fields.length ? void 0 : M });
|
|
752
757
|
}
|
|
753
758
|
})]
|
|
754
759
|
}),
|
|
@@ -761,9 +766,9 @@ var cr = [
|
|
|
761
766
|
}),
|
|
762
767
|
/* @__PURE__ */ (0, e.jsxs)("div", {
|
|
763
768
|
className: n["rst-dashboard-builder-checkbox-row"],
|
|
764
|
-
children: [/* @__PURE__ */ (0, e.jsx)(
|
|
769
|
+
children: [/* @__PURE__ */ (0, e.jsx)(ce, {
|
|
765
770
|
checked: r.enableExport ?? !0,
|
|
766
|
-
onChange: (t) =>
|
|
771
|
+
onChange: (t) => l("enableExport", t)
|
|
767
772
|
}), /* @__PURE__ */ (0, e.jsx)("span", {
|
|
768
773
|
className: n["rst-dashboard-builder-checkbox-label"],
|
|
769
774
|
children: "Export CSV"
|
|
@@ -771,9 +776,9 @@ var cr = [
|
|
|
771
776
|
}),
|
|
772
777
|
/* @__PURE__ */ (0, e.jsxs)("div", {
|
|
773
778
|
className: n["rst-dashboard-builder-checkbox-row"],
|
|
774
|
-
children: [/* @__PURE__ */ (0, e.jsx)(
|
|
779
|
+
children: [/* @__PURE__ */ (0, e.jsx)(ce, {
|
|
775
780
|
checked: r.enableScreenshot ?? !1,
|
|
776
|
-
onChange: (t) =>
|
|
781
|
+
onChange: (t) => l("enableScreenshot", t)
|
|
777
782
|
}), /* @__PURE__ */ (0, e.jsx)("span", {
|
|
778
783
|
className: n["rst-dashboard-builder-checkbox-label"],
|
|
779
784
|
children: "Screenshot"
|
|
@@ -781,9 +786,9 @@ var cr = [
|
|
|
781
786
|
}),
|
|
782
787
|
/* @__PURE__ */ (0, e.jsxs)("div", {
|
|
783
788
|
className: n["rst-dashboard-builder-checkbox-row"],
|
|
784
|
-
children: [/* @__PURE__ */ (0, e.jsx)(
|
|
789
|
+
children: [/* @__PURE__ */ (0, e.jsx)(ce, {
|
|
785
790
|
checked: r.enableExpand ?? !0,
|
|
786
|
-
onChange: (t) =>
|
|
791
|
+
onChange: (t) => l("enableExpand", t)
|
|
787
792
|
}), /* @__PURE__ */ (0, e.jsx)("span", {
|
|
788
793
|
className: n["rst-dashboard-builder-checkbox-label"],
|
|
789
794
|
children: "Expand"
|
|
@@ -791,9 +796,9 @@ var cr = [
|
|
|
791
796
|
}),
|
|
792
797
|
/* @__PURE__ */ (0, e.jsxs)("div", {
|
|
793
798
|
className: n["rst-dashboard-builder-checkbox-row"],
|
|
794
|
-
children: [/* @__PURE__ */ (0, e.jsx)(
|
|
799
|
+
children: [/* @__PURE__ */ (0, e.jsx)(ce, {
|
|
795
800
|
checked: r.enableFilter ?? !0,
|
|
796
|
-
onChange: (t) =>
|
|
801
|
+
onChange: (t) => l("enableFilter", t)
|
|
797
802
|
}), /* @__PURE__ */ (0, e.jsx)("span", {
|
|
798
803
|
className: n["rst-dashboard-builder-checkbox-label"],
|
|
799
804
|
children: "Filter"
|
|
@@ -803,17 +808,17 @@ var cr = [
|
|
|
803
808
|
}),
|
|
804
809
|
/* @__PURE__ */ (0, e.jsx)("div", { className: n["rst-dashboard-builder-configurator-divider"] }),
|
|
805
810
|
/* @__PURE__ */ (0, e.jsx)(Le, {
|
|
806
|
-
schema:
|
|
807
|
-
values:
|
|
811
|
+
schema: _,
|
|
812
|
+
values: W,
|
|
808
813
|
onChange: L,
|
|
809
|
-
columns:
|
|
814
|
+
columns: x,
|
|
810
815
|
scope: "all",
|
|
811
816
|
componentId: r.componentType,
|
|
812
|
-
onComponentChange:
|
|
817
|
+
onComponentChange: P,
|
|
813
818
|
componentMetaList: Pe
|
|
814
819
|
}, r.dataSourceId ?? "no-ds"),
|
|
815
820
|
/* @__PURE__ */ (0, e.jsx)("div", { className: n["rst-dashboard-builder-configurator-divider"] }),
|
|
816
|
-
/* @__PURE__ */ (0, e.jsx)(
|
|
821
|
+
/* @__PURE__ */ (0, e.jsx)(Q, {
|
|
817
822
|
variant: "danger",
|
|
818
823
|
size: "small",
|
|
819
824
|
value: "Remove widget",
|
|
@@ -827,7 +832,7 @@ var cr = [
|
|
|
827
832
|
"aria-label": "Add widget",
|
|
828
833
|
children: [/* @__PURE__ */ (0, e.jsx)("div", {
|
|
829
834
|
className: n["rst-dashboard-builder-configurator-header"],
|
|
830
|
-
children: /* @__PURE__ */ (0, e.jsx)(
|
|
835
|
+
children: /* @__PURE__ */ (0, e.jsx)(se, {
|
|
831
836
|
variant: "heading",
|
|
832
837
|
children: "Add Widget"
|
|
833
838
|
})
|
|
@@ -835,7 +840,7 @@ var cr = [
|
|
|
835
840
|
className: n["rst-dashboard-builder-configurator-body"],
|
|
836
841
|
children: [cr.map((t) => /* @__PURE__ */ (0, e.jsxs)("button", {
|
|
837
842
|
className: n["rst-dashboard-builder-add-widget-item"],
|
|
838
|
-
onClick: () =>
|
|
843
|
+
onClick: () => b(t.type),
|
|
839
844
|
children: [/* @__PURE__ */ (0, e.jsx)(ve, { src: t.icon }), /* @__PURE__ */ (0, e.jsxs)("div", { children: [/* @__PURE__ */ (0, e.jsx)("div", {
|
|
840
845
|
className: n["rst-dashboard-builder-add-widget-item-label"],
|
|
841
846
|
children: t.label
|
|
@@ -843,15 +848,15 @@ var cr = [
|
|
|
843
848
|
className: n["rst-dashboard-builder-add-widget-item-desc"],
|
|
844
849
|
children: t.description
|
|
845
850
|
})] })]
|
|
846
|
-
}, t.type)),
|
|
851
|
+
}, t.type)), B.length > 0 && /* @__PURE__ */ (0, e.jsxs)(e.Fragment, { children: [
|
|
847
852
|
/* @__PURE__ */ (0, e.jsx)("div", { className: n["rst-dashboard-builder-configurator-divider"] }),
|
|
848
|
-
/* @__PURE__ */ (0, e.jsx)(
|
|
853
|
+
/* @__PURE__ */ (0, e.jsx)(se, {
|
|
849
854
|
variant: "heading",
|
|
850
855
|
children: "Pre-built Sections"
|
|
851
856
|
}),
|
|
852
|
-
|
|
857
|
+
B.map((t) => /* @__PURE__ */ (0, e.jsxs)("button", {
|
|
853
858
|
className: n["rst-dashboard-builder-add-widget-item"],
|
|
854
|
-
onClick: () =>
|
|
859
|
+
onClick: () => w?.(t),
|
|
855
860
|
children: [/* @__PURE__ */ (0, e.jsx)(ve, { src: "layout" }), /* @__PURE__ */ (0, e.jsxs)("div", { children: [/* @__PURE__ */ (0, e.jsx)("div", {
|
|
856
861
|
className: n["rst-dashboard-builder-add-widget-item-label"],
|
|
857
862
|
children: t.name
|
|
@@ -865,64 +870,64 @@ var cr = [
|
|
|
865
870
|
});
|
|
866
871
|
};
|
|
867
872
|
ze.displayName = "WidgetConfigurator";
|
|
868
|
-
var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s, onSave:
|
|
869
|
-
const { state: c, mode:
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
}, [
|
|
873
|
-
const
|
|
874
|
-
|
|
873
|
+
var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s, onSave: h, onChange: b, widgetActionDefaults: f, readOnly: w, className: k }) => {
|
|
874
|
+
const { state: c, mode: g, setMode: x, addWidget: _, addPrebuiltWidget: W, removeWidget: l, updateWidget: P, moveWidget: L, selectWidget: B, selectedWidget: t, setName: u, setFilters: M, loadConfig: o } = ir(a, w), [p, I] = z(!1), [d, C] = z("dialog"), [F, Z] = z(null), [U, re] = z(null), [de, v] = z(!1), [y, N] = z(null), R = X(() => dr(c.config.widgets, r), [c.config.widgets, r]), D = g === "view", G = D ? U : c.config.filters;
|
|
875
|
+
te(() => {
|
|
876
|
+
p && N(G);
|
|
877
|
+
}, [p]);
|
|
878
|
+
const oe = j(() => {
|
|
879
|
+
D ? re(y) : M(y), I(!1);
|
|
875
880
|
}, [
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
881
|
+
y,
|
|
882
|
+
D,
|
|
883
|
+
M
|
|
879
884
|
]);
|
|
880
|
-
|
|
881
|
-
|
|
885
|
+
te(() => {
|
|
886
|
+
D && !de && (re(c.config.filters), v(!0)), D || v(!1);
|
|
882
887
|
}, [
|
|
883
|
-
|
|
884
|
-
|
|
888
|
+
D,
|
|
889
|
+
de,
|
|
885
890
|
c.config.filters
|
|
886
891
|
]);
|
|
887
|
-
const Y =
|
|
888
|
-
Y.current =
|
|
889
|
-
const H =
|
|
890
|
-
(
|
|
892
|
+
const Y = ne(b);
|
|
893
|
+
Y.current = b;
|
|
894
|
+
const H = j((m, $) => {
|
|
895
|
+
(D ? re : M)((ae) => ({
|
|
891
896
|
...ae ?? {},
|
|
892
897
|
[m]: $
|
|
893
898
|
}));
|
|
894
|
-
}, [
|
|
899
|
+
}, [D, M]), T = X(() => ({
|
|
895
900
|
filters: G,
|
|
896
901
|
onFilterChange: H
|
|
897
|
-
}), [G, H]),
|
|
902
|
+
}), [G, H]), E = X(() => !i || i.length === 0 ? [] : i.filter((m) => m.version === 1), [i]), q = X(() => E.map((m) => ({
|
|
898
903
|
value: m.name,
|
|
899
904
|
id: m.name,
|
|
900
905
|
description: m.description
|
|
901
|
-
})), [
|
|
902
|
-
const $ =
|
|
906
|
+
})), [E]), K = j((m) => {
|
|
907
|
+
const $ = E.find((J) => J.name === m);
|
|
903
908
|
if (!$) return;
|
|
904
909
|
const ae = {
|
|
905
910
|
version: 1,
|
|
906
911
|
...$.config
|
|
907
912
|
};
|
|
908
|
-
|
|
909
|
-
}, [
|
|
910
|
-
enableExport:
|
|
911
|
-
enableScreenshot:
|
|
912
|
-
enableExpand:
|
|
913
|
-
enableFilter:
|
|
914
|
-
}), [
|
|
915
|
-
enableExport: m.enableExport ??
|
|
916
|
-
enableScreenshot: m.enableScreenshot ??
|
|
917
|
-
enableExpand: m.enableExpand ??
|
|
918
|
-
enableFilter: m.enableFilter ??
|
|
919
|
-
}), [
|
|
920
|
-
|
|
913
|
+
o(ae);
|
|
914
|
+
}, [E, o]), O = X(() => ({
|
|
915
|
+
enableExport: f?.enableExport ?? !0,
|
|
916
|
+
enableScreenshot: f?.enableScreenshot ?? !1,
|
|
917
|
+
enableExpand: f?.enableExpand ?? !0,
|
|
918
|
+
enableFilter: f?.enableFilter ?? !0
|
|
919
|
+
}), [f]), le = j((m) => ({
|
|
920
|
+
enableExport: m.enableExport ?? O.enableExport,
|
|
921
|
+
enableScreenshot: m.enableScreenshot ?? O.enableScreenshot,
|
|
922
|
+
enableExpand: m.enableExpand ?? O.enableExpand,
|
|
923
|
+
enableFilter: m.enableFilter ?? O.enableFilter
|
|
924
|
+
}), [O]);
|
|
925
|
+
te(() => {
|
|
921
926
|
Y.current?.(c.config);
|
|
922
927
|
}, [c.config]);
|
|
923
|
-
const S = [n["rst-dashboard-builder"], k].filter(Boolean).join(" "), A =
|
|
924
|
-
|
|
925
|
-
}, [c.config,
|
|
928
|
+
const S = [n["rst-dashboard-builder"], k].filter(Boolean).join(" "), A = j(() => {
|
|
929
|
+
h(c.config);
|
|
930
|
+
}, [c.config, h]);
|
|
926
931
|
return /* @__PURE__ */ (0, e.jsx)("div", {
|
|
927
932
|
className: S,
|
|
928
933
|
children: /* @__PURE__ */ (0, e.jsxs)("div", {
|
|
@@ -931,39 +936,39 @@ var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s,
|
|
|
931
936
|
className: n["rst-dashboard-builder-toolbar"],
|
|
932
937
|
children: [/* @__PURE__ */ (0, e.jsxs)("div", {
|
|
933
938
|
className: n["rst-dashboard-builder-toolbar-left"],
|
|
934
|
-
children: [
|
|
939
|
+
children: [D ? /* @__PURE__ */ (0, e.jsx)("span", {
|
|
935
940
|
className: n["rst-dashboard-builder-name-display"],
|
|
936
941
|
children: c.config.name
|
|
937
942
|
}) : /* @__PURE__ */ (0, e.jsx)("input", {
|
|
938
943
|
className: n["rst-dashboard-builder-name-input"],
|
|
939
944
|
type: "text",
|
|
940
945
|
value: c.config.name,
|
|
941
|
-
onChange: (m) =>
|
|
946
|
+
onChange: (m) => u(m.target.value),
|
|
942
947
|
placeholder: "Dashboard name",
|
|
943
948
|
"aria-label": "Dashboard name"
|
|
944
|
-
}), Object.keys(
|
|
949
|
+
}), Object.keys(R).length > 0 && /* @__PURE__ */ (0, e.jsx)(Q, {
|
|
945
950
|
variant: "invisible",
|
|
946
951
|
size: "small",
|
|
947
952
|
leadingVisual: "filter",
|
|
948
|
-
onClick: () =>
|
|
953
|
+
onClick: () => I((m) => !m),
|
|
949
954
|
"aria-label": "Toggle filter panel",
|
|
950
|
-
"aria-pressed":
|
|
955
|
+
"aria-pressed": p
|
|
951
956
|
})]
|
|
952
957
|
}), /* @__PURE__ */ (0, e.jsxs)("div", {
|
|
953
958
|
className: n["rst-dashboard-builder-toolbar-right"],
|
|
954
959
|
children: [
|
|
955
|
-
|
|
960
|
+
E.length > 0 && !D && /* @__PURE__ */ (0, e.jsx)(Oe, {
|
|
956
961
|
options: q,
|
|
957
962
|
onChange: K,
|
|
958
963
|
placeholder: "Load Template",
|
|
959
964
|
size: "small"
|
|
960
965
|
}),
|
|
961
|
-
!
|
|
962
|
-
value:
|
|
966
|
+
!w && /* @__PURE__ */ (0, e.jsx)(Ee, {
|
|
967
|
+
value: g,
|
|
963
968
|
options: [{ value: "edit" }, { value: "view" }],
|
|
964
|
-
onChange: (m) =>
|
|
969
|
+
onChange: (m) => x(m)
|
|
965
970
|
}),
|
|
966
|
-
!
|
|
971
|
+
!D && /* @__PURE__ */ (0, e.jsx)(Q, {
|
|
967
972
|
variant: "primary",
|
|
968
973
|
size: "small",
|
|
969
974
|
value: "Save",
|
|
@@ -981,23 +986,23 @@ var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s,
|
|
|
981
986
|
},
|
|
982
987
|
children: [
|
|
983
988
|
/* @__PURE__ */ (0, e.jsx)(De, {
|
|
984
|
-
mode:
|
|
989
|
+
mode: g,
|
|
985
990
|
widgets: c.config.widgets,
|
|
986
991
|
selectedWidgetId: c.selectedWidgetId,
|
|
987
992
|
dataSources: r,
|
|
988
|
-
onSelectWidget:
|
|
993
|
+
onSelectWidget: B,
|
|
989
994
|
onMoveWidget: L,
|
|
990
|
-
onRemoveWidget:
|
|
991
|
-
onAddWidget:
|
|
995
|
+
onRemoveWidget: l,
|
|
996
|
+
onAddWidget: _,
|
|
992
997
|
onChange: () => {
|
|
993
998
|
},
|
|
994
|
-
getWidgetActions:
|
|
999
|
+
getWidgetActions: le
|
|
995
1000
|
}),
|
|
996
|
-
|
|
997
|
-
open:
|
|
1001
|
+
p && Object.keys(R).length > 0 && /* @__PURE__ */ (0, e.jsxs)(be, {
|
|
1002
|
+
open: p,
|
|
998
1003
|
variant: d,
|
|
999
1004
|
position: d === "dialog" ? "center" : "right",
|
|
1000
|
-
onClose: () =>
|
|
1005
|
+
onClose: () => I(!1),
|
|
1001
1006
|
closeOnEscape: !0,
|
|
1002
1007
|
closeOnClickOutside: d === "dialog",
|
|
1003
1008
|
width: d === "sidepanel" ? 360 : void 0,
|
|
@@ -1005,10 +1010,10 @@ var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s,
|
|
|
1005
1010
|
maxHeight: d === "dialog" ? "80vh" : void 0,
|
|
1006
1011
|
"aria-label": "Dashboard filters",
|
|
1007
1012
|
children: [
|
|
1008
|
-
/* @__PURE__ */ (0, e.jsx)(
|
|
1013
|
+
/* @__PURE__ */ (0, e.jsx)(be.Header, {
|
|
1009
1014
|
title: "Filters",
|
|
1010
|
-
onClose: () =>
|
|
1011
|
-
actions: /* @__PURE__ */ (0, e.jsx)(
|
|
1015
|
+
onClose: () => I(!1),
|
|
1016
|
+
actions: /* @__PURE__ */ (0, e.jsx)(Q, {
|
|
1012
1017
|
variant: "invisible",
|
|
1013
1018
|
size: "small",
|
|
1014
1019
|
leadingVisual: d === "dialog" ? "square-half" : "open-center",
|
|
@@ -1019,19 +1024,19 @@ var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s,
|
|
|
1019
1024
|
/* @__PURE__ */ (0, e.jsx)("div", {
|
|
1020
1025
|
className: n["rst-dashboard-builder-filter-body"],
|
|
1021
1026
|
children: (() => {
|
|
1022
|
-
const m = Object.keys(
|
|
1027
|
+
const m = Object.keys(R);
|
|
1023
1028
|
if (m.length === 0) return /* @__PURE__ */ (0, e.jsx)("div", {
|
|
1024
1029
|
style: { padding: "var(--rst-space-default)" },
|
|
1025
1030
|
children: "No data sources to filter."
|
|
1026
1031
|
});
|
|
1027
|
-
const $ =
|
|
1032
|
+
const $ = F && m.includes(F) ? F : m[0], ae = y?.[$] ?? Ye();
|
|
1028
1033
|
return /* @__PURE__ */ (0, e.jsxs)(e.Fragment, { children: [/* @__PURE__ */ (0, e.jsx)("div", {
|
|
1029
1034
|
className: n["rst-dashboard-builder-filter-tabs"],
|
|
1030
|
-
children: m.map((J) => /* @__PURE__ */ (0, e.jsx)(
|
|
1035
|
+
children: m.map((J) => /* @__PURE__ */ (0, e.jsx)(Q, {
|
|
1031
1036
|
value: J,
|
|
1032
1037
|
variant: J === $ ? "base" : "invisible",
|
|
1033
1038
|
size: "small",
|
|
1034
|
-
onClick: () =>
|
|
1039
|
+
onClick: () => Z(J),
|
|
1035
1040
|
children: J
|
|
1036
1041
|
}, J))
|
|
1037
1042
|
}), /* @__PURE__ */ (0, e.jsx)(Ge, {
|
|
@@ -1040,40 +1045,40 @@ var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s,
|
|
|
1040
1045
|
...We ?? {},
|
|
1041
1046
|
[$]: J.filters.length === 0 ? null : J
|
|
1042
1047
|
})),
|
|
1043
|
-
fieldOptions:
|
|
1048
|
+
fieldOptions: R[$]
|
|
1044
1049
|
})] });
|
|
1045
1050
|
})()
|
|
1046
1051
|
}),
|
|
1047
|
-
/* @__PURE__ */ (0, e.jsxs)(
|
|
1052
|
+
/* @__PURE__ */ (0, e.jsxs)(be.Footer, { children: [/* @__PURE__ */ (0, e.jsx)(Q, {
|
|
1048
1053
|
variant: "invisible",
|
|
1049
1054
|
size: "small",
|
|
1050
1055
|
value: "Clear",
|
|
1051
1056
|
onClick: () => N({})
|
|
1052
|
-
}), /* @__PURE__ */ (0, e.jsx)(
|
|
1057
|
+
}), /* @__PURE__ */ (0, e.jsx)(Q, {
|
|
1053
1058
|
variant: "primary",
|
|
1054
1059
|
size: "small",
|
|
1055
1060
|
value: "Apply",
|
|
1056
|
-
onClick:
|
|
1061
|
+
onClick: oe
|
|
1057
1062
|
})] })
|
|
1058
1063
|
]
|
|
1059
1064
|
}),
|
|
1060
|
-
!
|
|
1065
|
+
!D && /* @__PURE__ */ (0, e.jsx)(ze, {
|
|
1061
1066
|
widget: t,
|
|
1062
1067
|
dataSources: r,
|
|
1063
1068
|
onUpdate: (m) => {
|
|
1064
|
-
t &&
|
|
1069
|
+
t && P(t.id, m);
|
|
1065
1070
|
},
|
|
1066
1071
|
onRemove: () => {
|
|
1067
|
-
t &&
|
|
1072
|
+
t && l(t.id);
|
|
1068
1073
|
},
|
|
1069
|
-
onClose: () =>
|
|
1074
|
+
onClose: () => B(null),
|
|
1070
1075
|
onAddWidget: (m) => {
|
|
1071
1076
|
const $ = Object.values(r)[0], ae = Me(6, 3, c.config.widgets);
|
|
1072
|
-
|
|
1077
|
+
_(m, $?.id ?? "", ae);
|
|
1073
1078
|
},
|
|
1074
1079
|
prebuiltSections: s,
|
|
1075
1080
|
onAddPrebuiltSection: (m) => {
|
|
1076
|
-
|
|
1081
|
+
W(m);
|
|
1077
1082
|
}
|
|
1078
1083
|
})
|
|
1079
1084
|
]
|
|
@@ -1083,7 +1088,7 @@ var ur = ({ dataSources: r, initialConfig: a, templates: i, prebuiltSections: s,
|
|
|
1083
1088
|
});
|
|
1084
1089
|
};
|
|
1085
1090
|
ur.displayName = "DashboardBuilder";
|
|
1086
|
-
var
|
|
1091
|
+
var ue = {
|
|
1087
1092
|
"rst-border-beam": "_rst-border-beam_4g5sg_1",
|
|
1088
1093
|
"rst-border-beam-effect": "_rst-border-beam-effect_4g5sg_7",
|
|
1089
1094
|
"rst-border-beam-ring": "_rst-border-beam-ring_4g5sg_15",
|
|
@@ -1097,12 +1102,12 @@ function hr(r) {
|
|
|
1097
1102
|
})).sort((a, i) => a.percent - i.percent);
|
|
1098
1103
|
}
|
|
1099
1104
|
function br(r, a, i, s) {
|
|
1100
|
-
const
|
|
1101
|
-
return
|
|
1105
|
+
const h = 360 / Math.max(1, s), b = 2 * (a + i);
|
|
1106
|
+
return b <= 0 || r <= 0 ? Math.min(90, h) : Math.min(r / b * 360, h);
|
|
1102
1107
|
}
|
|
1103
1108
|
function mr(r, a) {
|
|
1104
1109
|
const i = Math.max(0, Math.min(a, 360)), s = hr(r);
|
|
1105
|
-
return `conic-gradient(from 0deg, ${s.length ? s.map((
|
|
1110
|
+
return `conic-gradient(from 0deg, ${s.length ? s.map((h) => `${h.color} ${h.percent / 100 * i}deg`).join(", ") : "var(--rst-borderColor-focus) 0deg"}, transparent ${i}deg, transparent 360deg)`;
|
|
1106
1111
|
}
|
|
1107
1112
|
var xr = [
|
|
1108
1113
|
{
|
|
@@ -1117,54 +1122,54 @@ var xr = [
|
|
|
1117
1122
|
color: "var(--rst-borderColor-focus)",
|
|
1118
1123
|
percent: 100
|
|
1119
1124
|
}
|
|
1120
|
-
], pr = ({ children: r, color: a = xr, count: i = 1, duration: s = 6, lineWidth:
|
|
1121
|
-
const
|
|
1125
|
+
], pr = ({ children: r, color: a = xr, count: i = 1, duration: s = 6, lineWidth: h = 1, outset: b = 0, inset: f = 0, size: w = 120, className: k, style: c, ...g }) => {
|
|
1126
|
+
const x = ne(null), [_, W] = z({
|
|
1122
1127
|
radius: "",
|
|
1123
1128
|
width: 0,
|
|
1124
1129
|
height: 0
|
|
1125
1130
|
});
|
|
1126
|
-
|
|
1127
|
-
const
|
|
1128
|
-
if (!
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1131
|
-
radius: getComputedStyle(
|
|
1132
|
-
width:
|
|
1133
|
-
height:
|
|
1131
|
+
te(() => {
|
|
1132
|
+
const M = x.current?.firstElementChild;
|
|
1133
|
+
if (!M || typeof ResizeObserver > "u") return;
|
|
1134
|
+
const o = new ResizeObserver(() => {
|
|
1135
|
+
W({
|
|
1136
|
+
radius: getComputedStyle(M).borderTopLeftRadius,
|
|
1137
|
+
width: M.clientWidth,
|
|
1138
|
+
height: M.clientHeight
|
|
1134
1139
|
});
|
|
1135
1140
|
});
|
|
1136
|
-
return
|
|
1141
|
+
return o.observe(M), () => o.disconnect();
|
|
1137
1142
|
}, []);
|
|
1138
|
-
const
|
|
1143
|
+
const l = Math.max(1, Math.floor(i)), P = X(() => mr(a, br(w, _.width, _.height, l)), [
|
|
1139
1144
|
a,
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
]), L = 360 /
|
|
1145
|
+
w,
|
|
1146
|
+
_.width,
|
|
1147
|
+
_.height,
|
|
1148
|
+
l
|
|
1149
|
+
]), L = 360 / l, B = Math.hypot(_.width + 2 * b, _.height + 2 * b), t = [ue["rst-border-beam"], k].filter(Boolean).join(" "), u = {
|
|
1150
|
+
"--rst-border-beam-gradient": P,
|
|
1151
|
+
"--rst-border-beam-duration": `${s}s`,
|
|
1152
|
+
"--rst-border-beam-line-width": `${h}px`,
|
|
1153
|
+
"--rst-border-beam-outset": `${b}px`,
|
|
1154
|
+
"--rst-border-beam-inset": `${f}px`,
|
|
1155
|
+
...B > 0 ? { "--rst-border-beam-diagonal": `${B}px` } : {},
|
|
1156
|
+
..._.radius ? { "--rst-border-beam-radius": _.radius } : {},
|
|
1157
|
+
...c
|
|
1158
|
+
};
|
|
1145
1159
|
return /* @__PURE__ */ (0, e.jsxs)("div", {
|
|
1146
|
-
ref:
|
|
1147
|
-
className:
|
|
1148
|
-
style:
|
|
1149
|
-
|
|
1150
|
-
"--rst-border-beam-duration": `${s}s`,
|
|
1151
|
-
"--rst-border-beam-line-width": `${b}px`,
|
|
1152
|
-
"--rst-border-beam-outset": `${h}px`,
|
|
1153
|
-
"--rst-border-beam-inset": `${p}px`,
|
|
1154
|
-
...O > 0 ? { "--rst-border-beam-diagonal": `${O}px` } : {},
|
|
1155
|
-
...w.radius ? { "--rst-border-beam-radius": w.radius } : {},
|
|
1156
|
-
...c
|
|
1157
|
-
},
|
|
1158
|
-
...f,
|
|
1160
|
+
ref: x,
|
|
1161
|
+
className: t,
|
|
1162
|
+
style: u,
|
|
1163
|
+
...g,
|
|
1159
1164
|
children: [r, /* @__PURE__ */ (0, e.jsx)("span", {
|
|
1160
|
-
className:
|
|
1165
|
+
className: ue["rst-border-beam-effect"],
|
|
1161
1166
|
"aria-hidden": "true",
|
|
1162
1167
|
children: /* @__PURE__ */ (0, e.jsx)("span", {
|
|
1163
|
-
className:
|
|
1164
|
-
children: Array.from({ length:
|
|
1165
|
-
className:
|
|
1166
|
-
style: { "--rst-border-beam-offset": `${
|
|
1167
|
-
},
|
|
1168
|
+
className: ue["rst-border-beam-ring"],
|
|
1169
|
+
children: Array.from({ length: l }, (M, o) => /* @__PURE__ */ (0, e.jsx)("span", {
|
|
1170
|
+
className: ue["rst-border-beam-spin"],
|
|
1171
|
+
style: { "--rst-border-beam-offset": `${o * L}deg` }
|
|
1172
|
+
}, o))
|
|
1168
1173
|
})
|
|
1169
1174
|
})]
|
|
1170
1175
|
});
|
|
@@ -1186,7 +1191,7 @@ function _r({ block: r, onBlockEvent: a }) {
|
|
|
1186
1191
|
onBlockEvent: a
|
|
1187
1192
|
});
|
|
1188
1193
|
if (r.component === "chart") {
|
|
1189
|
-
const
|
|
1194
|
+
const h = s.height ?? 16;
|
|
1190
1195
|
return /* @__PURE__ */ (0, e.jsx)(qe, {
|
|
1191
1196
|
data: i,
|
|
1192
1197
|
columns: r.columns,
|
|
@@ -1198,7 +1203,7 @@ function _r({ block: r, onBlockEvent: a }) {
|
|
|
1198
1203
|
subtitle: s.subtitle,
|
|
1199
1204
|
showLegend: s.showLegend,
|
|
1200
1205
|
showGrid: s.showGrid,
|
|
1201
|
-
height:
|
|
1206
|
+
height: h
|
|
1202
1207
|
});
|
|
1203
1208
|
}
|
|
1204
1209
|
return r.component === "kpi" ? /* @__PURE__ */ (0, e.jsx)(Fe, {
|
|
@@ -1209,12 +1214,12 @@ function _r({ block: r, onBlockEvent: a }) {
|
|
|
1209
1214
|
data: i,
|
|
1210
1215
|
columns: r.columns,
|
|
1211
1216
|
layout: Ae(s.layout),
|
|
1212
|
-
onCardClick: Re(r, "action") ? (
|
|
1217
|
+
onCardClick: Re(r, "action") ? (h) => a?.({
|
|
1213
1218
|
blockId: r.id,
|
|
1214
1219
|
component: "card-list",
|
|
1215
1220
|
event: "action",
|
|
1216
1221
|
handler: r.handler,
|
|
1217
|
-
values:
|
|
1222
|
+
values: h
|
|
1218
1223
|
}) : void 0
|
|
1219
1224
|
}) : /* @__PURE__ */ (0, e.jsx)(Ke, {
|
|
1220
1225
|
data: i,
|
|
@@ -1227,12 +1232,12 @@ function _r({ block: r, onBlockEvent: a }) {
|
|
|
1227
1232
|
});
|
|
1228
1233
|
}
|
|
1229
1234
|
function vr({ block: r, onBlockEvent: a }) {
|
|
1230
|
-
const [i, s] =
|
|
1235
|
+
const [i, s] = z(!1);
|
|
1231
1236
|
return Re(r, "submit") ? /* @__PURE__ */ (0, e.jsx)(fe, {
|
|
1232
1237
|
data: r.data ?? [{}],
|
|
1233
1238
|
columns: r.columns,
|
|
1234
1239
|
labelAlign: "top",
|
|
1235
|
-
onSubmit: async (
|
|
1240
|
+
onSubmit: async (h) => {
|
|
1236
1241
|
s(!0);
|
|
1237
1242
|
try {
|
|
1238
1243
|
await a?.({
|
|
@@ -1240,7 +1245,7 @@ function vr({ block: r, onBlockEvent: a }) {
|
|
|
1240
1245
|
component: "form",
|
|
1241
1246
|
event: "submit",
|
|
1242
1247
|
handler: r.handler,
|
|
1243
|
-
values:
|
|
1248
|
+
values: h
|
|
1244
1249
|
});
|
|
1245
1250
|
} finally {
|
|
1246
1251
|
s(!1);
|
|
@@ -1279,73 +1284,73 @@ var V = {
|
|
|
1279
1284
|
"rst-chat-processing": "_rst-chat-processing_12syz_80",
|
|
1280
1285
|
"rst-chat-composer": "_rst-chat-composer_12syz_84"
|
|
1281
1286
|
};
|
|
1282
|
-
function Mr({ messages: r, isProcessing: a = !1, inputValue: i, onInputChange: s, onSubmit:
|
|
1283
|
-
const
|
|
1284
|
-
|
|
1285
|
-
const
|
|
1286
|
-
|
|
1287
|
+
function Mr({ messages: r, isProcessing: a = !1, inputValue: i, onInputChange: s, onSubmit: h, onKeyDown: b, onBlockEvent: f, emptyStateText: w = "Ask a question to get started.", inputPlaceholder: k = "Ask something...", className: c, renderBlock: g }) {
|
|
1288
|
+
const x = ne(null);
|
|
1289
|
+
te(() => {
|
|
1290
|
+
const l = x.current;
|
|
1291
|
+
l && (l.scrollTop = l.scrollHeight);
|
|
1287
1292
|
}, [r, a]);
|
|
1288
|
-
const
|
|
1293
|
+
const _ = a || i.trim().length === 0, W = (l, P) => l.type === "text" ? /* @__PURE__ */ (0, e.jsx)(se, {
|
|
1289
1294
|
variant: "body",
|
|
1290
1295
|
className: V["rst-chat-text"],
|
|
1291
|
-
children:
|
|
1292
|
-
},
|
|
1296
|
+
children: l.text
|
|
1297
|
+
}, P) : /* @__PURE__ */ (0, e.jsxs)("div", {
|
|
1293
1298
|
className: V["rst-chat-block"],
|
|
1294
|
-
children: [
|
|
1299
|
+
children: [l.block.meta?.title && /* @__PURE__ */ (0, e.jsx)(se, {
|
|
1295
1300
|
variant: "label",
|
|
1296
1301
|
className: V["rst-chat-block-title"],
|
|
1297
|
-
children:
|
|
1298
|
-
}),
|
|
1299
|
-
block:
|
|
1300
|
-
onBlockEvent:
|
|
1302
|
+
children: l.block.meta.title
|
|
1303
|
+
}), g ? g(l.block) : /* @__PURE__ */ (0, e.jsx)(_r, {
|
|
1304
|
+
block: l.block,
|
|
1305
|
+
onBlockEvent: f
|
|
1301
1306
|
})]
|
|
1302
|
-
},
|
|
1307
|
+
}, l.block.id);
|
|
1303
1308
|
return /* @__PURE__ */ (0, e.jsxs)("div", {
|
|
1304
1309
|
className: [V["rst-chat"], c].filter(Boolean).join(" "),
|
|
1305
1310
|
children: [r.length === 0 ? /* @__PURE__ */ (0, e.jsx)("div", {
|
|
1306
1311
|
className: V["rst-chat-empty"],
|
|
1307
|
-
children: /* @__PURE__ */ (0, e.jsx)(
|
|
1312
|
+
children: /* @__PURE__ */ (0, e.jsx)(se, {
|
|
1308
1313
|
variant: "body",
|
|
1309
|
-
children:
|
|
1314
|
+
children: w
|
|
1310
1315
|
})
|
|
1311
1316
|
}) : /* @__PURE__ */ (0, e.jsxs)("div", {
|
|
1312
|
-
ref:
|
|
1317
|
+
ref: x,
|
|
1313
1318
|
className: V["rst-chat-messages"],
|
|
1314
1319
|
role: "log",
|
|
1315
1320
|
"aria-live": "polite",
|
|
1316
|
-
children: [r.map((
|
|
1317
|
-
className: [V["rst-chat-message"], V[`rst-chat-message-${
|
|
1318
|
-
"aria-label": `${
|
|
1321
|
+
children: [r.map((l) => /* @__PURE__ */ (0, e.jsx)("article", {
|
|
1322
|
+
className: [V["rst-chat-message"], V[`rst-chat-message-${l.role}`]].join(" "),
|
|
1323
|
+
"aria-label": `${l.role === "user" ? "You" : "Assistant"}: ${fr(l.parts)}`,
|
|
1319
1324
|
children: /* @__PURE__ */ (0, e.jsx)("div", {
|
|
1320
|
-
className: [V["rst-chat-bubble"], V[`rst-chat-bubble-${
|
|
1321
|
-
children:
|
|
1325
|
+
className: [V["rst-chat-bubble"], V[`rst-chat-bubble-${l.role}`]].join(" "),
|
|
1326
|
+
children: l.parts.map(W)
|
|
1322
1327
|
})
|
|
1323
|
-
},
|
|
1328
|
+
}, l.id)), a && /* @__PURE__ */ (0, e.jsx)("div", {
|
|
1324
1329
|
className: V["rst-chat-processing"],
|
|
1325
|
-
children: /* @__PURE__ */ (0, e.jsx)(
|
|
1330
|
+
children: /* @__PURE__ */ (0, e.jsx)(se, {
|
|
1326
1331
|
variant: "caption",
|
|
1327
1332
|
children: "Working..."
|
|
1328
1333
|
})
|
|
1329
1334
|
})]
|
|
1330
1335
|
}), /* @__PURE__ */ (0, e.jsxs)("form", {
|
|
1331
1336
|
className: V["rst-chat-composer"],
|
|
1332
|
-
onSubmit: (
|
|
1333
|
-
|
|
1337
|
+
onSubmit: (l) => {
|
|
1338
|
+
l.preventDefault(), _ || h();
|
|
1334
1339
|
},
|
|
1335
1340
|
children: [/* @__PURE__ */ (0, e.jsx)(Qe, {
|
|
1336
1341
|
value: i,
|
|
1337
1342
|
onChange: s,
|
|
1338
|
-
onKeyDown:
|
|
1343
|
+
onKeyDown: b,
|
|
1339
1344
|
placeholder: k,
|
|
1340
1345
|
ariaLabel: "Message",
|
|
1341
1346
|
rows: 1,
|
|
1342
1347
|
disabled: a
|
|
1343
|
-
}), /* @__PURE__ */ (0, e.jsx)(
|
|
1348
|
+
}), /* @__PURE__ */ (0, e.jsx)(Q, {
|
|
1344
1349
|
type: "submit",
|
|
1345
1350
|
variant: "primary",
|
|
1346
1351
|
value: "Send",
|
|
1347
1352
|
leadingVisual: "send",
|
|
1348
|
-
disabled:
|
|
1353
|
+
disabled: _
|
|
1349
1354
|
})]
|
|
1350
1355
|
})]
|
|
1351
1356
|
});
|