@object-ui/plugin-dashboard 3.3.1 → 3.3.2
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/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ComponentRegistry as e, extractRecords as t } from "@object-ui/core";
|
|
2
2
|
import { SchemaRenderer as n, SchemaRendererContext as r, useActionEngine as i, useDataScope as a, useDnd as o, useHasDndProvider as s } from "@object-ui/react";
|
|
3
|
-
import { Button as c, Card as l, CardContent as u, CardHeader as d, CardTitle as f, Combobox as p, ConfigPanelRenderer as m, ConfigRow as h, Skeleton as g, cn as _,
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
6
|
-
import * as O from "lucide-react";
|
|
3
|
+
import { Button as c, Card as l, CardContent as u, CardHeader as d, CardTitle as f, Combobox as p, ConfigPanelRenderer as m, ConfigRow as h, Skeleton as g, cn as _, getLazyIcon as v, useConfigDraft as y } from "@object-ui/components";
|
|
4
|
+
import * as b from "react";
|
|
5
|
+
import x, { forwardRef as S, useCallback as C, useContext as w, useEffect as T, useMemo as E, useRef as D, useState as O } from "react";
|
|
7
6
|
import { AlertCircle as k, ArrowDownIcon as A, ArrowUpIcon as j, Edit as M, GripVertical as N, Loader2 as P, MinusIcon as F, RefreshCw as I, Save as L, Settings as R, X as z } from "lucide-react";
|
|
8
7
|
import ee from "clsx";
|
|
9
8
|
//#region \0rolldown/runtime.js
|
|
@@ -195,9 +194,7 @@ var te = /* @__PURE__ */ B(((e) => {
|
|
|
195
194
|
process.env.NODE_ENV === "production" ? t.exports = te() : t.exports = ne();
|
|
196
195
|
})))();
|
|
197
196
|
function re(e) {
|
|
198
|
-
|
|
199
|
-
let t = O;
|
|
200
|
-
return t[e] ? t[e] : t[e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ?? null;
|
|
197
|
+
return e ? v(e) : null;
|
|
201
198
|
}
|
|
202
199
|
function ie(e) {
|
|
203
200
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
@@ -208,7 +205,7 @@ var ae = [
|
|
|
208
205
|
"hsl(var(--chart-3))",
|
|
209
206
|
"hsl(var(--chart-4))",
|
|
210
207
|
"hsl(var(--chart-5))"
|
|
211
|
-
], W =
|
|
208
|
+
], W = S(({ schema: e, className: t, dataSource: r, onRefresh: a, recordCount: o, userActions: s, designMode: p, selectedWidgetId: m, onWidgetClick: h, modalHandler: g, scriptHandlers: v, ...y }, b) => {
|
|
212
209
|
let x = (() => {
|
|
213
210
|
if (e.columns != null) return e.columns;
|
|
214
211
|
let t = e.widgets ?? [], n = 0;
|
|
@@ -217,27 +214,27 @@ var ae = [
|
|
|
217
214
|
t > n && (n = t), (e.layout?.w ?? 0) > n && (n = e.layout.w);
|
|
218
215
|
}
|
|
219
216
|
return n > 4 ? 12 : 4;
|
|
220
|
-
})(),
|
|
217
|
+
})(), S = x, w = e.gap || 4, [k, A] = O(!1), [j, M] = O(!1), N = D(null), { executeAction: P, engine: F } = i({ actions: E(() => (e.header?.actions ?? []).map((e) => ({
|
|
221
218
|
name: e.actionUrl || e.label,
|
|
222
219
|
type: e.actionType || "url",
|
|
223
220
|
target: e.actionUrl,
|
|
224
221
|
label: e.label
|
|
225
222
|
})), [e.header?.actions]) });
|
|
226
|
-
|
|
223
|
+
T(() => {
|
|
227
224
|
let e = F.getRunner();
|
|
228
225
|
if (g && e.setModalHandler(g), v) for (let [t, n] of Object.entries(v)) e.registerScript(t, n);
|
|
229
226
|
}, [
|
|
230
227
|
F,
|
|
231
228
|
g,
|
|
232
229
|
v
|
|
233
|
-
]),
|
|
230
|
+
]), T(() => {
|
|
234
231
|
let e = () => M(window.innerWidth < 768);
|
|
235
232
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
236
233
|
}, []);
|
|
237
|
-
let L =
|
|
234
|
+
let L = C(() => {
|
|
238
235
|
a && (A(!0), a(), setTimeout(() => A(!1), 600));
|
|
239
236
|
}, [a]);
|
|
240
|
-
|
|
237
|
+
T(() => {
|
|
241
238
|
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !a)) return N.current = setInterval(L, e.refreshInterval * 1e3), () => {
|
|
242
239
|
N.current && clearInterval(N.current);
|
|
243
240
|
};
|
|
@@ -246,9 +243,9 @@ var ae = [
|
|
|
246
243
|
a,
|
|
247
244
|
L
|
|
248
245
|
]);
|
|
249
|
-
let R =
|
|
246
|
+
let R = C((e, t) => {
|
|
250
247
|
!p || !h || !t || (e.stopPropagation(), h(t));
|
|
251
|
-
}, [p, h]), z =
|
|
248
|
+
}, [p, h]), z = C((t, n, r) => {
|
|
252
249
|
if (!p || !h) return;
|
|
253
250
|
let i = e.widgets || [];
|
|
254
251
|
if (t.key === "Enter" || t.key === " ") t.preventDefault(), h(n ?? null);
|
|
@@ -265,12 +262,12 @@ var ae = [
|
|
|
265
262
|
p,
|
|
266
263
|
h,
|
|
267
264
|
e.widgets
|
|
268
|
-
]), ee =
|
|
265
|
+
]), ee = C((e) => {
|
|
269
266
|
!p || !h || e.target === e.currentTarget && h(null);
|
|
270
267
|
}, [p, h]), B = (e, t, i) => {
|
|
271
268
|
let a = e.layout ? {
|
|
272
269
|
...e.layout,
|
|
273
|
-
w: Math.min(e.layout.w,
|
|
270
|
+
w: Math.min(e.layout.w, S)
|
|
274
271
|
} : void 0, o = (() => {
|
|
275
272
|
if (e.component) return e.component;
|
|
276
273
|
let t = e.type, n = e.options || {};
|
|
@@ -568,8 +565,8 @@ var ae = [
|
|
|
568
565
|
ref: b,
|
|
569
566
|
className: _("grid auto-rows-min", !oe && "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
|
|
570
567
|
style: {
|
|
571
|
-
...oe && { gridTemplateColumns: `repeat(${
|
|
572
|
-
gap: `${
|
|
568
|
+
...oe && { gridTemplateColumns: `repeat(${S}, minmax(0, 1fr))` },
|
|
569
|
+
gap: `${w * .25}rem`
|
|
573
570
|
},
|
|
574
571
|
"data-user-actions": ne,
|
|
575
572
|
onClick: ee,
|
|
@@ -1206,14 +1203,14 @@ var rt = /* @__PURE__ */ B(((e, t) => {
|
|
|
1206
1203
|
//#endregion
|
|
1207
1204
|
//#region ../../node_modules/.pnpm/react-grid-layout@2.2.3_react-dom@19.2.5_react@19.2.5__react@19.2.5/node_modules/react-grid-layout/dist/chunk-PZLKKWSX.mjs
|
|
1208
1205
|
function it(e = {}) {
|
|
1209
|
-
let { measureBeforeMount: t = !1, initialWidth: n = 1280 } = e, [r, i] =
|
|
1206
|
+
let { measureBeforeMount: t = !1, initialWidth: n = 1280 } = e, [r, i] = O(n), [a, o] = O(!t), s = D(null), c = D(null), l = C(() => {
|
|
1210
1207
|
let e = s.current;
|
|
1211
1208
|
if (e) {
|
|
1212
1209
|
let t = e.offsetWidth;
|
|
1213
1210
|
i(t), a || o(!0);
|
|
1214
1211
|
}
|
|
1215
1212
|
}, [a]);
|
|
1216
|
-
return
|
|
1213
|
+
return T(() => {
|
|
1217
1214
|
let e = s.current;
|
|
1218
1215
|
if (e) {
|
|
1219
1216
|
if (l(), typeof ResizeObserver < "u") {
|
|
@@ -2851,20 +2848,20 @@ var at = /* @__PURE__ */ B(((e) => {
|
|
|
2851
2848
|
}, t.exports.Resizable = Tt().default, t.exports.ResizableBox = Et().default;
|
|
2852
2849
|
})), Ot = St(), kt = Dt(), At = rt();
|
|
2853
2850
|
function jt(e) {
|
|
2854
|
-
let { children: t, cols: n, containerWidth: r, margin: i, containerPadding: a, rowHeight: o, maxRows: s, isDraggable: c, isResizable: l, isBounded: u, static: d, useCSSTransforms: f = !0, usePercentages: p = !1, transformScale: m = 1, positionStrategy: h, dragThreshold: g = 0, droppingPosition: _, className: v = "", style: y, handle:
|
|
2851
|
+
let { children: t, cols: n, containerWidth: r, margin: i, containerPadding: a, rowHeight: o, maxRows: s, isDraggable: c, isResizable: l, isBounded: u, static: d, useCSSTransforms: f = !0, usePercentages: p = !1, transformScale: m = 1, positionStrategy: h, dragThreshold: g = 0, droppingPosition: _, className: v = "", style: y, handle: b = "", cancel: S = "", x: w, y: k, w: A, h: j, minW: M = 1, maxW: N = Infinity, minH: P = 1, maxH: F = Infinity, i: I, resizeHandles: L, resizeHandle: R, constraints: z = xe, layoutItem: B, layout: V = [], onDragStart: H, onDrag: te, onDragStop: ne, onResizeStart: re, onResize: ie, onResizeStop: ae } = e, [W, le] = O(!1), [fe, K] = O(!1), pe = D(null), q = D({
|
|
2855
2852
|
left: 0,
|
|
2856
2853
|
top: 0
|
|
2857
|
-
}), me =
|
|
2854
|
+
}), me = D({
|
|
2858
2855
|
top: 0,
|
|
2859
2856
|
left: 0,
|
|
2860
2857
|
width: 0,
|
|
2861
2858
|
height: 0
|
|
2862
|
-
}), he =
|
|
2859
|
+
}), he = D(void 0), ge = D(V);
|
|
2863
2860
|
ge.current = V;
|
|
2864
|
-
let _e =
|
|
2861
|
+
let _e = D(null), ve = D(null), ye = D(!1), J = D({
|
|
2865
2862
|
x: 0,
|
|
2866
2863
|
y: 0
|
|
2867
|
-
}), be =
|
|
2864
|
+
}), be = D(!1), Y = E(() => ({
|
|
2868
2865
|
cols: n,
|
|
2869
2866
|
containerPadding: a,
|
|
2870
2867
|
containerWidth: r,
|
|
@@ -2878,7 +2875,7 @@ function jt(e) {
|
|
|
2878
2875
|
i,
|
|
2879
2876
|
s,
|
|
2880
2877
|
o
|
|
2881
|
-
]), X =
|
|
2878
|
+
]), X = E(() => ({
|
|
2882
2879
|
cols: n,
|
|
2883
2880
|
maxRows: s,
|
|
2884
2881
|
containerWidth: r,
|
|
@@ -2892,12 +2889,12 @@ function jt(e) {
|
|
|
2892
2889
|
r,
|
|
2893
2890
|
o,
|
|
2894
2891
|
i
|
|
2895
|
-
]), Z =
|
|
2892
|
+
]), Z = C(() => ({
|
|
2896
2893
|
...X,
|
|
2897
2894
|
layout: ge.current
|
|
2898
|
-
}), [X]), Q =
|
|
2895
|
+
}), [X]), Q = E(() => B ?? {
|
|
2899
2896
|
i: I,
|
|
2900
|
-
x:
|
|
2897
|
+
x: w,
|
|
2901
2898
|
y: k,
|
|
2902
2899
|
w: A,
|
|
2903
2900
|
h: j,
|
|
@@ -2908,7 +2905,7 @@ function jt(e) {
|
|
|
2908
2905
|
}, [
|
|
2909
2906
|
B,
|
|
2910
2907
|
I,
|
|
2911
|
-
|
|
2908
|
+
w,
|
|
2912
2909
|
k,
|
|
2913
2910
|
A,
|
|
2914
2911
|
j,
|
|
@@ -2916,7 +2913,7 @@ function jt(e) {
|
|
|
2916
2913
|
N,
|
|
2917
2914
|
P,
|
|
2918
2915
|
F
|
|
2919
|
-
]), $ =
|
|
2916
|
+
]), $ = C((e) => {
|
|
2920
2917
|
if (h?.calcStyle) return h.calcStyle(e);
|
|
2921
2918
|
if (f) return we(e);
|
|
2922
2919
|
let t = Te(e);
|
|
@@ -2930,7 +2927,7 @@ function jt(e) {
|
|
|
2930
2927
|
f,
|
|
2931
2928
|
p,
|
|
2932
2929
|
r
|
|
2933
|
-
]), De =
|
|
2930
|
+
]), De = C((e, { node: t }) => {
|
|
2934
2931
|
if (!H) return;
|
|
2935
2932
|
let { offsetParent: n } = t;
|
|
2936
2933
|
if (!n) return;
|
|
@@ -2967,7 +2964,7 @@ function jt(e) {
|
|
|
2967
2964
|
Q,
|
|
2968
2965
|
Z,
|
|
2969
2966
|
I
|
|
2970
|
-
]), Oe =
|
|
2967
|
+
]), Oe = C((e, { node: t, deltaX: n, deltaY: a }) => {
|
|
2971
2968
|
if (!te || !W) return;
|
|
2972
2969
|
let s = e;
|
|
2973
2970
|
if (ye.current && !be.current) {
|
|
@@ -3019,7 +3016,7 @@ function jt(e) {
|
|
|
3019
3016
|
z,
|
|
3020
3017
|
Q,
|
|
3021
3018
|
Z
|
|
3022
|
-
]), ke =
|
|
3019
|
+
]), ke = C((e, { node: t }) => {
|
|
3023
3020
|
if (!ne || !W) return;
|
|
3024
3021
|
let n = ye.current;
|
|
3025
3022
|
if (ye.current = !1, be.current = !1, J.current = {
|
|
@@ -3056,7 +3053,7 @@ function jt(e) {
|
|
|
3056
3053
|
I
|
|
3057
3054
|
]);
|
|
3058
3055
|
_e.current = De, ve.current = Oe;
|
|
3059
|
-
let Ae =
|
|
3056
|
+
let Ae = C((e, { node: t, size: n, handle: i }, a, o) => {
|
|
3060
3057
|
let s = o === "onResizeStart" ? re : o === "onResize" ? ie : ae;
|
|
3061
3058
|
if (!s) return;
|
|
3062
3059
|
let c;
|
|
@@ -3082,9 +3079,9 @@ function jt(e) {
|
|
|
3082
3079
|
z,
|
|
3083
3080
|
Q,
|
|
3084
3081
|
Z
|
|
3085
|
-
]), je =
|
|
3082
|
+
]), je = C((e, t) => {
|
|
3086
3083
|
K(!0);
|
|
3087
|
-
let n = ce(Y,
|
|
3084
|
+
let n = ce(Y, w, k, A, j);
|
|
3088
3085
|
Ae(e, {
|
|
3089
3086
|
...t,
|
|
3090
3087
|
handle: t.handle
|
|
@@ -3092,12 +3089,12 @@ function jt(e) {
|
|
|
3092
3089
|
}, [
|
|
3093
3090
|
Ae,
|
|
3094
3091
|
Y,
|
|
3095
|
-
|
|
3092
|
+
w,
|
|
3096
3093
|
k,
|
|
3097
3094
|
A,
|
|
3098
3095
|
j
|
|
3099
|
-
]), Me =
|
|
3100
|
-
let n = ce(Y,
|
|
3096
|
+
]), Me = C((e, t) => {
|
|
3097
|
+
let n = ce(Y, w, k, A, j);
|
|
3101
3098
|
Ae(e, {
|
|
3102
3099
|
...t,
|
|
3103
3100
|
handle: t.handle
|
|
@@ -3105,18 +3102,18 @@ function jt(e) {
|
|
|
3105
3102
|
}, [
|
|
3106
3103
|
Ae,
|
|
3107
3104
|
Y,
|
|
3108
|
-
|
|
3105
|
+
w,
|
|
3109
3106
|
k,
|
|
3110
3107
|
A,
|
|
3111
3108
|
j
|
|
3112
|
-
]), Ne =
|
|
3109
|
+
]), Ne = C((e, t) => {
|
|
3113
3110
|
K(!1), me.current = {
|
|
3114
3111
|
top: 0,
|
|
3115
3112
|
left: 0,
|
|
3116
3113
|
width: 0,
|
|
3117
3114
|
height: 0
|
|
3118
3115
|
};
|
|
3119
|
-
let n = ce(Y,
|
|
3116
|
+
let n = ce(Y, w, k, A, j);
|
|
3120
3117
|
Ae(e, {
|
|
3121
3118
|
...t,
|
|
3122
3119
|
handle: t.handle
|
|
@@ -3124,12 +3121,12 @@ function jt(e) {
|
|
|
3124
3121
|
}, [
|
|
3125
3122
|
Ae,
|
|
3126
3123
|
Y,
|
|
3127
|
-
|
|
3124
|
+
w,
|
|
3128
3125
|
k,
|
|
3129
3126
|
A,
|
|
3130
3127
|
j
|
|
3131
3128
|
]);
|
|
3132
|
-
|
|
3129
|
+
T(() => {
|
|
3133
3130
|
if (!_) return;
|
|
3134
3131
|
let e = pe.current;
|
|
3135
3132
|
if (!e) return;
|
|
@@ -3166,7 +3163,7 @@ function jt(e) {
|
|
|
3166
3163
|
W,
|
|
3167
3164
|
I
|
|
3168
3165
|
]);
|
|
3169
|
-
let Pe = ce(Y,
|
|
3166
|
+
let Pe = ce(Y, w, k, A, j, W ? q.current : null, fe ? me.current : null), Fe = x.Children.only(t), Le = oe(Y), Re = [se(M, Le, i[0]), se(P, o, i[1])], ze = [se(N, Le, i[0]), se(F, o, i[1])], Be = Fe.props, Ve = Be.className, He = Be.style, Ue = x.cloneElement(Fe, {
|
|
3170
3167
|
ref: pe,
|
|
3171
3168
|
className: ee("react-grid-item", Ve, v, {
|
|
3172
3169
|
static: d,
|
|
@@ -3201,8 +3198,8 @@ function jt(e) {
|
|
|
3201
3198
|
onStart: De,
|
|
3202
3199
|
onDrag: Oe,
|
|
3203
3200
|
onStop: ke,
|
|
3204
|
-
handle:
|
|
3205
|
-
cancel: ".react-resizable-handle" + (
|
|
3201
|
+
handle: b,
|
|
3202
|
+
cancel: ".react-resizable-handle" + (S ? "," + S : ""),
|
|
3206
3203
|
scale: m,
|
|
3207
3204
|
nodeRef: pe,
|
|
3208
3205
|
children: Ue
|
|
@@ -3213,7 +3210,7 @@ try {
|
|
|
3213
3210
|
Pt = /firefox/i.test(navigator.userAgent);
|
|
3214
3211
|
} catch {}
|
|
3215
3212
|
function Ft(e, t) {
|
|
3216
|
-
let n =
|
|
3213
|
+
let n = x.Children.toArray(e), r = x.Children.toArray(t);
|
|
3217
3214
|
if (n.length !== r.length) return !1;
|
|
3218
3215
|
for (let e = 0; e < n.length; e++) {
|
|
3219
3216
|
let t = n[e], i = r[e];
|
|
@@ -3223,8 +3220,8 @@ function Ft(e, t) {
|
|
|
3223
3220
|
}
|
|
3224
3221
|
function It(e, t, n, r) {
|
|
3225
3222
|
let i = [], a = /* @__PURE__ */ new Set();
|
|
3226
|
-
|
|
3227
|
-
if (!
|
|
3223
|
+
x.Children.forEach(t, (t) => {
|
|
3224
|
+
if (!x.isValidElement(t) || t.key === null) return;
|
|
3228
3225
|
let n = String(t.key);
|
|
3229
3226
|
a.add(n);
|
|
3230
3227
|
let r = e.find((e) => e.i === n);
|
|
@@ -3259,25 +3256,25 @@ function It(e, t, n, r) {
|
|
|
3259
3256
|
return r.compact(o, n);
|
|
3260
3257
|
}
|
|
3261
3258
|
function Lt(e) {
|
|
3262
|
-
let { children: t, width: n, gridConfig: r, dragConfig: i, resizeConfig: a, dropConfig: o, positionStrategy: s = Le, compactor: c, constraints: l = xe, layout: u = [], droppingItem: d, autoSize: f = !0, className: p = "", style: m = {}, innerRef: h, onLayoutChange: g = Mt, onDragStart: _ = Mt, onDrag: v = Mt, onDragStop: y = Mt, onResizeStart:
|
|
3259
|
+
let { children: t, width: n, gridConfig: r, dragConfig: i, resizeConfig: a, dropConfig: o, positionStrategy: s = Le, compactor: c, constraints: l = xe, layout: u = [], droppingItem: d, autoSize: f = !0, className: p = "", style: m = {}, innerRef: h, onLayoutChange: g = Mt, onDragStart: _ = Mt, onDrag: v = Mt, onDragStop: y = Mt, onResizeStart: b = Mt, onResize: S = Mt, onResizeStop: w = Mt, onDrop: k = Mt, onDropDragOver: A = Mt } = e, j = E(() => ({
|
|
3263
3260
|
...Re,
|
|
3264
3261
|
...r
|
|
3265
|
-
}), [r]), M =
|
|
3262
|
+
}), [r]), M = E(() => ({
|
|
3266
3263
|
...ze,
|
|
3267
3264
|
...i
|
|
3268
|
-
}), [i]), N =
|
|
3265
|
+
}), [i]), N = E(() => ({
|
|
3269
3266
|
...Be,
|
|
3270
3267
|
...a
|
|
3271
|
-
}), [a]), P =
|
|
3268
|
+
}), [a]), P = E(() => ({
|
|
3272
3269
|
...Ve,
|
|
3273
3270
|
...o
|
|
3274
|
-
}), [o]), { cols: F, rowHeight: I, maxRows: L, margin: R, containerPadding: z } = j, { enabled: B, bounded: V, handle: H, cancel: te, threshold: ne } = M, { enabled: re, handles: ie, handleComponent: ae } = N, { enabled: W, defaultItem: ce, onDragOver: ue } = P, G = c ?? Ze("vertical"), de = G.type, fe = G.allowOverlap, K = G.preventCollision ?? !1, q =
|
|
3271
|
+
}), [o]), { cols: F, rowHeight: I, maxRows: L, margin: R, containerPadding: z } = j, { enabled: B, bounded: V, handle: H, cancel: te, threshold: ne } = M, { enabled: re, handles: ie, handleComponent: ae } = N, { enabled: W, defaultItem: ce, onDragOver: ue } = P, G = c ?? Ze("vertical"), de = G.type, fe = G.allowOverlap, K = G.preventCollision ?? !1, q = E(() => d ?? {
|
|
3275
3272
|
i: "__dropping-elem__",
|
|
3276
3273
|
...ce
|
|
3277
|
-
}, [d, ce]), me = s.type === "transform", he = s.scale, ve = z ?? R, [J, be] =
|
|
3278
|
-
He.current = X,
|
|
3274
|
+
}, [d, ce]), me = s.type === "transform", he = s.scale, ve = z ?? R, [J, be] = O(!1), [X, Q] = O(() => It(u, t, F, G)), [$, Se] = O(null), [Ce, we] = O(!1), [Te, Ee] = O(null), [De, Oe] = O(), ke = D(null), Ae = D(null), je = D(null), Me = D(0), Ne = D(X), Pe = D(u), Fe = D(t), Ie = D(de), He = D(X);
|
|
3275
|
+
He.current = X, T(() => {
|
|
3279
3276
|
be(!0), (0, At.deepEqual)(X, u) || g(X);
|
|
3280
|
-
}, []),
|
|
3277
|
+
}, []), T(() => {
|
|
3281
3278
|
if ($ || Te) return;
|
|
3282
3279
|
let e = !(0, At.deepEqual)(u, Pe.current), n = !Ft(t, Fe.current), r = de !== Ie.current;
|
|
3283
3280
|
if (e || n || r) {
|
|
@@ -3294,7 +3291,7 @@ function Lt(e) {
|
|
|
3294
3291
|
$,
|
|
3295
3292
|
Te,
|
|
3296
3293
|
X
|
|
3297
|
-
]),
|
|
3294
|
+
]), T(() => {
|
|
3298
3295
|
!$ && !(0, At.deepEqual)(X, Ne.current) && (Ne.current = X, g(X.filter((e) => e.i !== q.i)));
|
|
3299
3296
|
}, [
|
|
3300
3297
|
X,
|
|
@@ -3302,7 +3299,7 @@ function Lt(e) {
|
|
|
3302
3299
|
g,
|
|
3303
3300
|
q.i
|
|
3304
3301
|
]);
|
|
3305
|
-
let Ue =
|
|
3302
|
+
let Ue = E(() => {
|
|
3306
3303
|
if (!f) return;
|
|
3307
3304
|
let e = ge(X), t = ve[1];
|
|
3308
3305
|
return e * I + (e - 1) * R[1] + t * 2 + "px";
|
|
@@ -3312,7 +3309,7 @@ function Lt(e) {
|
|
|
3312
3309
|
I,
|
|
3313
3310
|
R,
|
|
3314
3311
|
ve
|
|
3315
|
-
]), We =
|
|
3312
|
+
]), We = C((e, t, n, r) => {
|
|
3316
3313
|
let i = He.current, a = _e(i, e);
|
|
3317
3314
|
if (!a) return;
|
|
3318
3315
|
let o = {
|
|
@@ -3323,7 +3320,7 @@ function Lt(e) {
|
|
|
3323
3320
|
i: e
|
|
3324
3321
|
};
|
|
3325
3322
|
ke.current = ye(a), je.current = i, Se(o), _(i, a, a, null, r.e, r.node);
|
|
3326
|
-
}, [_]), Ge =
|
|
3323
|
+
}, [_]), Ge = C((e, t, n, r) => {
|
|
3327
3324
|
let i = He.current, a = ke.current, o = _e(i, e);
|
|
3328
3325
|
if (!o) return;
|
|
3329
3326
|
let s = {
|
|
@@ -3341,7 +3338,7 @@ function Lt(e) {
|
|
|
3341
3338
|
fe,
|
|
3342
3339
|
G,
|
|
3343
3340
|
v
|
|
3344
|
-
]), Ke =
|
|
3341
|
+
]), Ke = C((e, t, n, r) => {
|
|
3345
3342
|
if (!$) return;
|
|
3346
3343
|
let i = He.current, a = ke.current, o = _e(i, e);
|
|
3347
3344
|
if (!o) return;
|
|
@@ -3358,10 +3355,10 @@ function Lt(e) {
|
|
|
3358
3355
|
G,
|
|
3359
3356
|
y,
|
|
3360
3357
|
g
|
|
3361
|
-
]), qe =
|
|
3358
|
+
]), qe = C((e, t, n, r) => {
|
|
3362
3359
|
let i = He.current, a = _e(i, e);
|
|
3363
|
-
a && (Ae.current = ye(a), je.current = i, we(!0),
|
|
3364
|
-
}, [
|
|
3360
|
+
a && (Ae.current = ye(a), je.current = i, we(!0), b(i, a, a, null, r.e, r.node));
|
|
3361
|
+
}, [b]), Je = C((e, t, n, r) => {
|
|
3365
3362
|
let i = He.current, a = Ae.current, { handle: o } = r, s = !1, c, l, [u, d] = Y(i, e, (e) => (c = e.x, l = e.y, [
|
|
3366
3363
|
"sw",
|
|
3367
3364
|
"w",
|
|
@@ -3394,25 +3391,25 @@ function Lt(e) {
|
|
|
3394
3391
|
i: e,
|
|
3395
3392
|
static: !0
|
|
3396
3393
|
};
|
|
3397
|
-
|
|
3394
|
+
S(f, a, d, p, r.e, r.node), Q(G.compact(f, F)), Se(p);
|
|
3398
3395
|
}, [
|
|
3399
3396
|
K,
|
|
3400
3397
|
de,
|
|
3401
3398
|
F,
|
|
3402
3399
|
fe,
|
|
3403
3400
|
G,
|
|
3404
|
-
|
|
3405
|
-
]), Ye =
|
|
3401
|
+
S
|
|
3402
|
+
]), Ye = C((e, t, n, r) => {
|
|
3406
3403
|
let i = He.current, a = Ae.current, o = _e(i, e), s = G.compact(i, F);
|
|
3407
|
-
|
|
3404
|
+
w(s, a, o ?? null, null, r.e, r.node);
|
|
3408
3405
|
let c = je.current;
|
|
3409
3406
|
Ae.current = null, je.current = null, Se(null), we(!1), Q(s), c && !(0, At.deepEqual)(c, s) && g(s);
|
|
3410
3407
|
}, [
|
|
3411
3408
|
F,
|
|
3412
3409
|
G,
|
|
3413
|
-
|
|
3410
|
+
w,
|
|
3414
3411
|
g
|
|
3415
|
-
]), Xe =
|
|
3412
|
+
]), Xe = C(() => {
|
|
3416
3413
|
let e = He.current;
|
|
3417
3414
|
if (!e.some((e) => e.i === q.i)) {
|
|
3418
3415
|
Ee(null), Se(null), Oe(void 0);
|
|
@@ -3423,7 +3420,7 @@ function Lt(e) {
|
|
|
3423
3420
|
q.i,
|
|
3424
3421
|
F,
|
|
3425
3422
|
G
|
|
3426
|
-
]), Qe =
|
|
3423
|
+
]), Qe = C((e) => {
|
|
3427
3424
|
if (e.preventDefault(), e.stopPropagation(), Pt && !e.nativeEvent.target?.classList.contains(Nt)) return !1;
|
|
3428
3425
|
let t = ue ? ue(e.nativeEvent) : A(e);
|
|
3429
3426
|
if (t === !1) return Te && Xe(), !1;
|
|
@@ -3467,11 +3464,11 @@ function Lt(e) {
|
|
|
3467
3464
|
I,
|
|
3468
3465
|
n,
|
|
3469
3466
|
ve
|
|
3470
|
-
]), $e =
|
|
3467
|
+
]), $e = C((e) => {
|
|
3471
3468
|
e.preventDefault(), e.stopPropagation(), Me.current--, Me.current < 0 && (Me.current = 0), Me.current === 0 && Xe();
|
|
3472
|
-
}, [Xe]), et =
|
|
3469
|
+
}, [Xe]), et = C((e) => {
|
|
3473
3470
|
e.preventDefault(), e.stopPropagation(), Me.current++;
|
|
3474
|
-
}, []), tt =
|
|
3471
|
+
}, []), tt = C((e) => {
|
|
3475
3472
|
e.preventDefault(), e.stopPropagation();
|
|
3476
3473
|
let t = He.current, n = t.find((e) => e.i === q.i);
|
|
3477
3474
|
Me.current = 0, Xe(), k(t, n, e.nativeEvent);
|
|
@@ -3479,7 +3476,7 @@ function Lt(e) {
|
|
|
3479
3476
|
q.i,
|
|
3480
3477
|
Xe,
|
|
3481
3478
|
k
|
|
3482
|
-
]), nt =
|
|
3479
|
+
]), nt = C((e, t) => {
|
|
3483
3480
|
if (!e || !e.key) return null;
|
|
3484
3481
|
let r = _e(X, String(e.key));
|
|
3485
3482
|
if (!r) return null;
|
|
@@ -3587,7 +3584,7 @@ function Lt(e) {
|
|
|
3587
3584
|
onDragEnter: W ? et : void 0,
|
|
3588
3585
|
onDragOver: W ? Qe : void 0,
|
|
3589
3586
|
children: [
|
|
3590
|
-
|
|
3587
|
+
x.Children.map(t, (e) => x.isValidElement(e) ? nt(e) : null),
|
|
3591
3588
|
W && Te && nt(Te, !0),
|
|
3592
3589
|
rt()
|
|
3593
3590
|
]
|
|
@@ -3608,8 +3605,8 @@ var Rt = {
|
|
|
3608
3605
|
}, Bt = () => {};
|
|
3609
3606
|
function Vt(e, t, n, r) {
|
|
3610
3607
|
let i = [];
|
|
3611
|
-
|
|
3612
|
-
if (!
|
|
3608
|
+
x.Children.forEach(t, (t) => {
|
|
3609
|
+
if (!x.isValidElement(t) || t.key === null) return;
|
|
3613
3610
|
let n = String(t.key), r = e.find((e) => e.i === n);
|
|
3614
3611
|
if (r) i.push({
|
|
3615
3612
|
...r,
|
|
@@ -3645,24 +3642,24 @@ function Vt(e, t, n, r) {
|
|
|
3645
3642
|
return r.compact(a, n);
|
|
3646
3643
|
}
|
|
3647
3644
|
function Ht(e) {
|
|
3648
|
-
let { children: t, width: n, breakpoint: r, breakpoints: i = Rt, cols: a = zt, layouts: o = {}, rowHeight: s = 150, maxRows: c = Infinity, margin: l = [10, 10], containerPadding: u = null, compactor: d, onBreakpointChange: f = Bt, onLayoutChange: p = Bt, onWidthChange: m = Bt, ...h } = e, g = d ?? Ze("vertical"), _ = g.type, v = g.allowOverlap, y =
|
|
3649
|
-
|
|
3645
|
+
let { children: t, width: n, breakpoint: r, breakpoints: i = Rt, cols: a = zt, layouts: o = {}, rowHeight: s = 150, maxRows: c = Infinity, margin: l = [10, 10], containerPadding: u = null, compactor: d, onBreakpointChange: f = Bt, onLayoutChange: p = Bt, onWidthChange: m = Bt, ...h } = e, g = d ?? Ze("vertical"), _ = g.type, v = g.allowOverlap, y = E(() => r ?? $e(i, n), []), b = E(() => et(y, a), [y, a]), x = E(() => tt(o, i, y, y, b, _), []), [S, w] = O(y), [k, A] = O(b), [j, M] = O(x), [N, P] = O(o), F = D(n), I = D(r), L = D(i), R = D(a), z = D(o), ee = D(_), B = D(N);
|
|
3646
|
+
T(() => {
|
|
3650
3647
|
B.current = N;
|
|
3651
3648
|
}, [N]);
|
|
3652
|
-
let V =
|
|
3649
|
+
let V = E(() => (0, At.deepEqual)(o, z.current) ? null : tt(o, i, S, S, k, g), [
|
|
3653
3650
|
o,
|
|
3654
3651
|
i,
|
|
3655
|
-
|
|
3652
|
+
S,
|
|
3656
3653
|
k,
|
|
3657
3654
|
g
|
|
3658
3655
|
]), H = V ?? j;
|
|
3659
|
-
|
|
3656
|
+
T(() => {
|
|
3660
3657
|
V !== null && (M(V), P(o), B.current = o, z.current = o);
|
|
3661
|
-
}, [V, o]),
|
|
3658
|
+
}, [V, o]), T(() => {
|
|
3662
3659
|
if (_ !== ee.current) {
|
|
3663
3660
|
let e = g.compact(J(H), k), t = {
|
|
3664
3661
|
...B.current,
|
|
3665
|
-
[
|
|
3662
|
+
[S]: e
|
|
3666
3663
|
};
|
|
3667
3664
|
M(e), P(t), B.current = t, p(e, t), ee.current = _;
|
|
3668
3665
|
}
|
|
@@ -3672,17 +3669,17 @@ function Ht(e) {
|
|
|
3672
3669
|
H,
|
|
3673
3670
|
k,
|
|
3674
3671
|
v,
|
|
3675
|
-
|
|
3672
|
+
S,
|
|
3676
3673
|
p
|
|
3677
|
-
]),
|
|
3674
|
+
]), T(() => {
|
|
3678
3675
|
let e = n !== F.current, o = r !== I.current, s = !(0, At.deepEqual)(i, L.current), c = !(0, At.deepEqual)(a, R.current);
|
|
3679
3676
|
if (e || o || s || c) {
|
|
3680
|
-
let e = r ?? $e(i, n), o = et(e, a), d =
|
|
3677
|
+
let e = r ?? $e(i, n), o = et(e, a), d = S;
|
|
3681
3678
|
if (d !== e || s || c) {
|
|
3682
3679
|
let n = { ...B.current };
|
|
3683
3680
|
n[d] || (n[d] = J(j));
|
|
3684
3681
|
let r = tt(n, i, e, d, o, g);
|
|
3685
|
-
r = Vt(r, t, o, g), n[e] = r,
|
|
3682
|
+
r = Vt(r, t, o, g), n[e] = r, w(e), A(o), M(r), P(n), B.current = n, f(e, o), p(r, n);
|
|
3686
3683
|
}
|
|
3687
3684
|
m(n, nt(l, e), o, u ? nt(u, e) : null), F.current = n, I.current = r, L.current = i, R.current = a;
|
|
3688
3685
|
}
|
|
@@ -3691,7 +3688,7 @@ function Ht(e) {
|
|
|
3691
3688
|
r,
|
|
3692
3689
|
i,
|
|
3693
3690
|
a,
|
|
3694
|
-
|
|
3691
|
+
S,
|
|
3695
3692
|
k,
|
|
3696
3693
|
j,
|
|
3697
3694
|
t,
|
|
@@ -3704,13 +3701,13 @@ function Ht(e) {
|
|
|
3704
3701
|
p,
|
|
3705
3702
|
m
|
|
3706
3703
|
]);
|
|
3707
|
-
let te =
|
|
3704
|
+
let te = C((e) => {
|
|
3708
3705
|
let t = {
|
|
3709
3706
|
...B.current,
|
|
3710
|
-
[
|
|
3707
|
+
[S]: e
|
|
3711
3708
|
};
|
|
3712
3709
|
M(e), P(t), B.current = t, p(e, t);
|
|
3713
|
-
}, [
|
|
3710
|
+
}, [S, p]), ne = E(() => nt(l, S), [l, S]), re = E(() => u === null ? null : nt(u, S), [u, S]), ie = E(() => ({
|
|
3714
3711
|
cols: k,
|
|
3715
3712
|
rowHeight: s,
|
|
3716
3713
|
maxRows: c,
|
|
@@ -3737,7 +3734,7 @@ function Ht(e) {
|
|
|
3737
3734
|
//#region src/DashboardGridLayout.tsx
|
|
3738
3735
|
function Ut({ editMode: e }) {
|
|
3739
3736
|
let t = o();
|
|
3740
|
-
return
|
|
3737
|
+
return b.useEffect(() => {
|
|
3741
3738
|
if (e) return t.startDrag({
|
|
3742
3739
|
id: "dashboard-layout",
|
|
3743
3740
|
type: "dashboard-widget",
|
|
@@ -3755,10 +3752,10 @@ var Wt = [
|
|
|
3755
3752
|
"hsl(var(--chart-4))",
|
|
3756
3753
|
"hsl(var(--chart-5))"
|
|
3757
3754
|
], Gt = ({ schema: e, className: t, onLayoutChange: r, persistLayoutKey: i = "dashboard-layout", onRefresh: a }) => {
|
|
3758
|
-
let { width: o, containerRef: p, mounted: m } = it(), [h, g] =
|
|
3759
|
-
a && (
|
|
3755
|
+
let { width: o, containerRef: p, mounted: m } = it(), [h, g] = b.useState(!1), [v, y] = b.useState(!1), x = s(), S = b.useRef(null), C = b.useCallback(() => {
|
|
3756
|
+
a && (y(!0), a(), setTimeout(() => y(!1), 600));
|
|
3760
3757
|
}, [a]);
|
|
3761
|
-
|
|
3758
|
+
b.useEffect(() => {
|
|
3762
3759
|
if (!(!e.refreshInterval || e.refreshInterval <= 0 || !a)) return S.current = setInterval(C, e.refreshInterval * 1e3), () => {
|
|
3763
3760
|
S.current && clearInterval(S.current);
|
|
3764
3761
|
};
|
|
@@ -3767,7 +3764,7 @@ var Wt = [
|
|
|
3767
3764
|
a,
|
|
3768
3765
|
C
|
|
3769
3766
|
]);
|
|
3770
|
-
let [w, T] =
|
|
3767
|
+
let [w, T] = b.useState(() => {
|
|
3771
3768
|
if (typeof window < "u" && i) {
|
|
3772
3769
|
let e = localStorage.getItem(i);
|
|
3773
3770
|
if (e) try {
|
|
@@ -3783,11 +3780,11 @@ var Wt = [
|
|
|
3783
3780
|
w: e.layout?.w || 3,
|
|
3784
3781
|
h: e.layout?.h || 4
|
|
3785
3782
|
})) || [] };
|
|
3786
|
-
}), E =
|
|
3783
|
+
}), E = b.useCallback((e, t) => {
|
|
3787
3784
|
T(t), r?.(e);
|
|
3788
|
-
}, [r]), D =
|
|
3785
|
+
}, [r]), D = b.useCallback(() => {
|
|
3789
3786
|
typeof window < "u" && i && localStorage.setItem(i, JSON.stringify(w)), g(!1);
|
|
3790
|
-
}, [w, i]), O =
|
|
3787
|
+
}, [w, i]), O = b.useCallback(() => {
|
|
3791
3788
|
T({ lg: e.widgets?.map((e, t) => ({
|
|
3792
3789
|
i: e.id || `widget-${t}`,
|
|
3793
3790
|
x: e.layout?.x || t % 4 * 3,
|
|
@@ -3795,7 +3792,7 @@ var Wt = [
|
|
|
3795
3792
|
w: e.layout?.w || 3,
|
|
3796
3793
|
h: e.layout?.h || 4
|
|
3797
3794
|
})) || [] }), typeof window < "u" && i && localStorage.removeItem(i);
|
|
3798
|
-
}, [e.widgets, i]), k =
|
|
3795
|
+
}, [e.widgets, i]), k = b.useCallback((e) => {
|
|
3799
3796
|
if (e.component) return e.component;
|
|
3800
3797
|
let t = e.type, n = e.options || {};
|
|
3801
3798
|
if (t === "bar" || t === "line" || t === "area" || t === "pie" || t === "donut" || t === "scatter") {
|
|
@@ -4025,9 +4022,9 @@ var qt = {
|
|
|
4025
4022
|
warning: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
|
|
4026
4023
|
danger: "bg-rose-500/10 text-rose-600 dark:text-rose-400"
|
|
4027
4024
|
}, Jt = ({ label: e, value: t, trend: n, icon: r, className: i, description: a, loading: o, error: s, colorVariant: c = "default", ...p }) => {
|
|
4028
|
-
let m = qt[c] || qt.default, h =
|
|
4025
|
+
let m = qt[c] || qt.default, h = E(() => {
|
|
4029
4026
|
if (typeof r == "string") {
|
|
4030
|
-
let e =
|
|
4027
|
+
let e = v(r);
|
|
4031
4028
|
return e ? /* @__PURE__ */ (0, U.jsx)(e, { className: "h-4 w-4" }) : null;
|
|
4032
4029
|
}
|
|
4033
4030
|
return r;
|
|
@@ -4086,7 +4083,7 @@ function Yt(e) {
|
|
|
4086
4083
|
if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
|
|
4087
4084
|
}
|
|
4088
4085
|
var Xt = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...p }) => {
|
|
4089
|
-
let m = n
|
|
4086
|
+
let m = n ? v(n) : null;
|
|
4090
4087
|
return /* @__PURE__ */ (0, U.jsxs)(l, {
|
|
4091
4088
|
className: _("h-full", o),
|
|
4092
4089
|
...p,
|
|
@@ -4128,7 +4125,7 @@ var Xt = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
4128
4125
|
})] }) })]
|
|
4129
4126
|
});
|
|
4130
4127
|
}, Zt = ({ objectName: e, aggregate: t, filter: n, label: i, fallbackValue: a, trend: o, icon: s, className: c, description: l, dataSource: u, colorVariant: d }) => {
|
|
4131
|
-
let f =
|
|
4128
|
+
let f = w(r), p = u || f?.dataSource, [m, h] = O(null), [g, _] = O(!1), [v, y] = O(null), b = C(async (r, i) => {
|
|
4132
4129
|
if (!(!r || !e)) {
|
|
4133
4130
|
i.current && (_(!0), y(null));
|
|
4134
4131
|
try {
|
|
@@ -4157,7 +4154,7 @@ var Xt = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
|
|
|
4157
4154
|
t,
|
|
4158
4155
|
n
|
|
4159
4156
|
]);
|
|
4160
|
-
return
|
|
4157
|
+
return T(() => {
|
|
4161
4158
|
let t = { current: !0 };
|
|
4162
4159
|
return p && e ? b(p, t) : (h(null), y(null)), () => {
|
|
4163
4160
|
t.current = !1;
|
|
@@ -4209,7 +4206,7 @@ function $t(e, t) {
|
|
|
4209
4206
|
}
|
|
4210
4207
|
}
|
|
4211
4208
|
var en = ({ schema: e, className: t }) => {
|
|
4212
|
-
let { title: n, rowField: r, columnField: i, valueField: a, aggregation: o = "sum", data: s = [], showRowTotals: c = !1, showColumnTotals: l = !1, format: u, columnColors: d } = e, f = Array.isArray(s) ? s : [], { rowKeys: p, colKeys: m, matrix: h, rowTotals: g, colTotals: v, grandTotal: y } =
|
|
4209
|
+
let { title: n, rowField: r, columnField: i, valueField: a, aggregation: o = "sum", data: s = [], showRowTotals: c = !1, showColumnTotals: l = !1, format: u, columnColors: d } = e, f = Array.isArray(s) ? s : [], { rowKeys: p, colKeys: m, matrix: h, rowTotals: g, colTotals: v, grandTotal: y } = E(() => {
|
|
4213
4210
|
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = {};
|
|
4214
4211
|
for (let o of f) {
|
|
4215
4212
|
let s = String(o[r] ?? ""), c = String(o[i] ?? ""), l = Number(o[a]) || 0;
|
|
@@ -4362,8 +4359,8 @@ var en = ({ schema: e, className: t }) => {
|
|
|
4362
4359
|
})]
|
|
4363
4360
|
});
|
|
4364
4361
|
}, tn = ({ schema: e, dataSource: n, className: i }) => {
|
|
4365
|
-
let o =
|
|
4366
|
-
|
|
4362
|
+
let o = w(r), s = n || o?.dataSource, c = a(e.bind), [l, u] = O([]), [d, f] = O(!1), [p, m] = O(null);
|
|
4363
|
+
T(() => {
|
|
4367
4364
|
let n = !0;
|
|
4368
4365
|
return e.objectName && !c && (!e.data || e.data.length === 0) && (async () => {
|
|
4369
4366
|
if (!(!s || !e.objectName)) {
|
|
@@ -4495,8 +4492,8 @@ function nn(e) {
|
|
|
4495
4492
|
} : e);
|
|
4496
4493
|
}
|
|
4497
4494
|
var rn = ({ schema: e, dataSource: i, className: o }) => {
|
|
4498
|
-
let s =
|
|
4499
|
-
|
|
4495
|
+
let s = w(r), c = i || s?.dataSource, l = a(e.bind), [u, d] = O([]), [f, p] = O(!1), [m, h] = O(null);
|
|
4496
|
+
T(() => {
|
|
4500
4497
|
let n = !0;
|
|
4501
4498
|
return e.objectName && !l && (!e.data || e.data.length === 0) && (async () => {
|
|
4502
4499
|
if (!(!c || !e.objectName)) {
|
|
@@ -4522,7 +4519,7 @@ var rn = ({ schema: e, dataSource: i, className: o }) => {
|
|
|
4522
4519
|
e.data,
|
|
4523
4520
|
e.filter
|
|
4524
4521
|
]);
|
|
4525
|
-
let v = l || e.data || u, y = Array.isArray(v) ? v : [], b =
|
|
4522
|
+
let v = l || e.data || u, y = Array.isArray(v) ? v : [], b = E(() => e.columns && e.columns.length > 0 ? nn(e.columns) : y.length === 0 ? [] : Object.keys(y[0]).filter((e) => !e.startsWith("_")).map((e) => ({
|
|
4526
4523
|
header: e.charAt(0).toUpperCase() + e.slice(1).replace(/([A-Z])/g, " $1"),
|
|
4527
4524
|
accessorKey: e
|
|
4528
4525
|
})), [e.columns, y]);
|
|
@@ -4762,7 +4759,7 @@ var rn = ({ schema: e, dataSource: i, className: o }) => {
|
|
|
4762
4759
|
]
|
|
4763
4760
|
};
|
|
4764
4761
|
function on({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
|
|
4765
|
-
let { draft: a, isDirty: o, updateField: s, discard: c } =
|
|
4762
|
+
let { draft: a, isDirty: o, updateField: s, discard: c } = y(n, { onUpdate: i });
|
|
4766
4763
|
return /* @__PURE__ */ (0, U.jsx)(m, {
|
|
4767
4764
|
open: e,
|
|
4768
4765
|
onClose: t,
|
|
@@ -5217,7 +5214,7 @@ function gn(e) {
|
|
|
5217
5214
|
return String(e);
|
|
5218
5215
|
}
|
|
5219
5216
|
function _n({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, availableObjects: o, availableFields: s }) {
|
|
5220
|
-
let { draft: c, isDirty: l, updateField: u, discard: d } =
|
|
5217
|
+
let { draft: c, isDirty: l, updateField: u, discard: d } = y(b.useMemo(() => ({
|
|
5221
5218
|
...n,
|
|
5222
5219
|
title: typeof n.title == "object" ? gn(n.title) : n.title,
|
|
5223
5220
|
description: typeof n.description == "object" ? gn(n.description) : n.description
|
|
@@ -5225,7 +5222,7 @@ function _n({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, heade
|
|
|
5225
5222
|
return /* @__PURE__ */ (0, U.jsx)(m, {
|
|
5226
5223
|
open: e,
|
|
5227
5224
|
onClose: t,
|
|
5228
|
-
schema:
|
|
5225
|
+
schema: b.useMemo(() => hn(o, s, c.type), [
|
|
5229
5226
|
o,
|
|
5230
5227
|
s,
|
|
5231
5228
|
c.type
|
|
@@ -5241,11 +5238,11 @@ function _n({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, heade
|
|
|
5241
5238
|
//#endregion
|
|
5242
5239
|
//#region src/DashboardWithConfig.tsx
|
|
5243
5240
|
function vn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s }) {
|
|
5244
|
-
let [l, u] =
|
|
5245
|
-
|
|
5241
|
+
let [l, u] = O(o), [d, f] = O(null), [p, m] = O(e), [h, g] = O(0);
|
|
5242
|
+
T(() => {
|
|
5246
5243
|
m(e), g((e) => e + 1);
|
|
5247
5244
|
}, [e]);
|
|
5248
|
-
let v =
|
|
5245
|
+
let v = b.useMemo(() => {
|
|
5249
5246
|
if (!d || !p.widgets) return null;
|
|
5250
5247
|
let e = p.widgets.find((e) => (e.id || e.title) === d);
|
|
5251
5248
|
return e ? {
|
|
@@ -5262,11 +5259,11 @@ function vn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
5262
5259
|
layoutW: e.layout?.w ?? 1,
|
|
5263
5260
|
layoutH: e.layout?.h ?? 1
|
|
5264
5261
|
} : null;
|
|
5265
|
-
}, [d, h]),
|
|
5262
|
+
}, [d, h]), y = C((e) => {
|
|
5266
5263
|
f(e), u(!0);
|
|
5267
|
-
}, []), x =
|
|
5264
|
+
}, []), x = C(() => {
|
|
5268
5265
|
f(null);
|
|
5269
|
-
}, []),
|
|
5266
|
+
}, []), S = C((e, t) => {
|
|
5270
5267
|
d && m((n) => n.widgets ? {
|
|
5271
5268
|
...n,
|
|
5272
5269
|
widgets: n.widgets.map((n) => (n.id || n.title) === d ? e === "layoutW" ? {
|
|
@@ -5286,9 +5283,9 @@ function vn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
5286
5283
|
[e]: t
|
|
5287
5284
|
} : n)
|
|
5288
5285
|
} : n);
|
|
5289
|
-
}, [d]),
|
|
5286
|
+
}, [d]), w = C((e) => {
|
|
5290
5287
|
d && r && r(d, e), f(null), g((e) => e + 1);
|
|
5291
|
-
}, [d, r]), E =
|
|
5288
|
+
}, [d, r]), E = C(() => {
|
|
5292
5289
|
u((e) => !e), f(null);
|
|
5293
5290
|
}, []);
|
|
5294
5291
|
return /* @__PURE__ */ (0, U.jsxs)("div", {
|
|
@@ -5311,7 +5308,7 @@ function vn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
5311
5308
|
recordCount: a,
|
|
5312
5309
|
designMode: l,
|
|
5313
5310
|
selectedWidgetId: d,
|
|
5314
|
-
onWidgetClick:
|
|
5311
|
+
onWidgetClick: y
|
|
5315
5312
|
})]
|
|
5316
5313
|
}), l && /* @__PURE__ */ (0, U.jsx)("div", {
|
|
5317
5314
|
className: "relative shrink-0",
|
|
@@ -5319,8 +5316,8 @@ function vn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
|
|
|
5319
5316
|
open: !0,
|
|
5320
5317
|
onClose: x,
|
|
5321
5318
|
config: v,
|
|
5322
|
-
onSave:
|
|
5323
|
-
onFieldChange:
|
|
5319
|
+
onSave: w,
|
|
5320
|
+
onFieldChange: S
|
|
5324
5321
|
}) : /* @__PURE__ */ (0, U.jsx)(on, {
|
|
5325
5322
|
open: !0,
|
|
5326
5323
|
onClose: () => u(!1),
|