@declarion/react 0.36.3 → 0.36.5
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-lib/{DraggableChildrenTable-ChUh120M.js → DraggableChildrenTable-BfErdVdt.js} +35 -35
- package/dist-lib/{Grid-DT9wV-D7.js → Grid-D0ckegd1.js} +41 -41
- package/dist-lib/{LayoutRenderer-0UKE3pp6.js → LayoutRenderer-BGeN0rwC.js} +465 -465
- package/dist-lib/{MarkdownRenderer-CvURrJCu.js → MarkdownRenderer-14LG1clY.js} +1 -1
- package/dist-lib/{RefreshControl-CX_D6PcA.js → RefreshControl-Bpd9kw0G.js} +45 -45
- package/dist-lib/{SmartDetailPage.impl-Ccz4TqfJ.js → SmartDetailPage.impl-BaXAi7OH.js} +234 -234
- package/dist-lib/{SmartRecordListPage.impl-Y0w4oIe3.js → SmartRecordListPage.impl-CgiZWbF3.js} +189 -189
- package/dist-lib/index.d.ts +1 -1
- package/dist-lib/index.js +1510 -1526
- package/dist-lib/{registry-D_zbJrLC.js → registry-KMbQkTF6.js} +1036 -1034
- package/dist-lib/testing.d.ts +8 -0
- package/dist-lib/testing.js +63 -60
- package/dist-lib/{ActionRunner-BrXXs8ga.js → useCurrentScreen-Bgp6_vne.js} +18 -2
- package/dist-lib/{useProperties-C_1KM72K.js → useProperties-DMT162ot.js} +68 -68
- package/dist-lib/{value-BBnVc95O.js → value-CUVtVjKI.js} +22 -22
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { s as e, t } from "./DynamicIcon-BWO6QtNF.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as fe, c as pe, d as me, f as he, i as ge, l as _e, n as ve, o as ye, p as be, r as xe, s as Se, t as Ce, u as we } from "./value-
|
|
2
|
+
import { $ as n, C as r, E as i, F as a, Gn as o, Hn as s, K as c, Kn as l, Nn as u, O as d, On as f, Pn as p, S as m, T as h, U as g, Wn as _, a as v, an as y, at as b, bn as x, cn as S, ct as C, dt as w, en as T, f as E, fn as D, g as O, gn as k, gt as A, h as j, ht as M, i as N, it as P, j as F, jn as I, jt as L, k as R, ln as z, nt as B, o as ee, on as V, ot as te, p as ne, pn as H, q as U, rt as re, sn as ie, un as W, ut as ae, vn as oe, w as se, x as ce, xn as le, y as ue, zn as de } from "./useCurrentScreen-Bgp6_vne.js";
|
|
3
|
+
import { a as fe, c as pe, d as me, f as he, i as ge, l as _e, n as ve, o as ye, p as be, r as xe, s as Se, t as Ce, u as we } from "./value-CUVtVjKI.js";
|
|
4
4
|
import { n as Te, r as Ee, t as De } from "./dataTableStyles-vwD1mVOP.js";
|
|
5
5
|
import { Component as Oe, Suspense as ke, lazy as Ae, useCallback as G, useEffect as K, useId as je, useLayoutEffect as Me, useMemo as q, useRef as J, useState as Y } from "react";
|
|
6
6
|
import { parsePath as Ne, useNavigate as Pe } from "react-router-dom";
|
|
@@ -20,8 +20,8 @@ var He = {
|
|
|
20
20
|
shadow: "none"
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
function Ue({ title: t, subtitle: n, right: r, badge: i, count: a, children:
|
|
24
|
-
let [
|
|
23
|
+
function Ue({ title: t, subtitle: n, right: r, badge: i, count: a, children: s, footer: c, collapsible: l = !0, defaultOpen: u = !0, icon: d, emphasis: f = "primary", headingLevel: p = 2, padding: m = "16px" }) {
|
|
24
|
+
let [h, g] = Y(u), v = He[f] ?? He.primary;
|
|
25
25
|
return /* @__PURE__ */ Q("div", {
|
|
26
26
|
"data-emphasis": f,
|
|
27
27
|
style: {
|
|
@@ -39,7 +39,7 @@ function Ue({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
|
|
|
39
39
|
alignItems: "center",
|
|
40
40
|
gap: 10,
|
|
41
41
|
padding: "10px 14px",
|
|
42
|
-
borderBottom:
|
|
42
|
+
borderBottom: h ? "1px solid var(--divider)" : "none",
|
|
43
43
|
minHeight: 40
|
|
44
44
|
},
|
|
45
45
|
children: [
|
|
@@ -54,10 +54,10 @@ function Ue({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
|
|
|
54
54
|
children: /* @__PURE__ */ Q("div", {
|
|
55
55
|
role: l ? "button" : void 0,
|
|
56
56
|
tabIndex: l ? 0 : void 0,
|
|
57
|
-
"aria-expanded": l ?
|
|
58
|
-
onClick: l ? () =>
|
|
57
|
+
"aria-expanded": l ? h : void 0,
|
|
58
|
+
onClick: l ? () => g((e) => !e) : void 0,
|
|
59
59
|
onKeyDown: l ? (e) => {
|
|
60
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
60
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), g((e) => !e));
|
|
61
61
|
} : void 0,
|
|
62
62
|
style: {
|
|
63
63
|
display: "flex",
|
|
@@ -119,26 +119,26 @@ function Ue({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
|
|
|
119
119
|
]
|
|
120
120
|
})
|
|
121
121
|
}),
|
|
122
|
-
i && /* @__PURE__ */ Z(
|
|
122
|
+
i && /* @__PURE__ */ Z(_, {
|
|
123
123
|
tone: i.tone ?? "violet",
|
|
124
124
|
size: "xs",
|
|
125
125
|
dot: i.dot,
|
|
126
126
|
children: i.text
|
|
127
127
|
}),
|
|
128
128
|
r,
|
|
129
|
-
l && /* @__PURE__ */ Z(
|
|
129
|
+
l && /* @__PURE__ */ Z(o, {
|
|
130
130
|
size: 24,
|
|
131
|
-
icon: Z(
|
|
132
|
-
onClick: () =>
|
|
133
|
-
title:
|
|
131
|
+
icon: Z(h ? e.up : e.down, { size: 14 }),
|
|
132
|
+
onClick: () => g((e) => !e),
|
|
133
|
+
title: h ? "Collapse" : "Expand"
|
|
134
134
|
})
|
|
135
135
|
]
|
|
136
136
|
}),
|
|
137
|
-
|
|
138
|
-
style: { padding:
|
|
139
|
-
children:
|
|
137
|
+
h && /* @__PURE__ */ Z("div", {
|
|
138
|
+
style: { padding: m },
|
|
139
|
+
children: s
|
|
140
140
|
}),
|
|
141
|
-
|
|
141
|
+
c && h && /* @__PURE__ */ Z("div", {
|
|
142
142
|
style: {
|
|
143
143
|
padding: "8px 14px",
|
|
144
144
|
borderTop: "1px solid var(--divider)",
|
|
@@ -146,7 +146,7 @@ function Ue({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
|
|
|
146
146
|
fontSize: 11.5,
|
|
147
147
|
color: "var(--text-3)"
|
|
148
148
|
},
|
|
149
|
-
children:
|
|
149
|
+
children: c
|
|
150
150
|
})
|
|
151
151
|
]
|
|
152
152
|
});
|
|
@@ -525,10 +525,10 @@ function Dt(e) {
|
|
|
525
525
|
}
|
|
526
526
|
//#endregion
|
|
527
527
|
//#region src/components/shared/ConfirmDialog.tsx
|
|
528
|
-
function Ot({ open: t, onOpenChange: n, title: r, description: i, confirmLabel: a = "Confirm", onConfirm:
|
|
529
|
-
let
|
|
528
|
+
function Ot({ open: t, onOpenChange: n, title: r, description: i, confirmLabel: a = "Confirm", onConfirm: s, destructive: c = !1 }) {
|
|
529
|
+
let u = J(null);
|
|
530
530
|
return K(() => {
|
|
531
|
-
t &&
|
|
531
|
+
t && u.current?.focus();
|
|
532
532
|
}, [t]), t ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("div", {
|
|
533
533
|
onClick: () => n(!1),
|
|
534
534
|
style: {
|
|
@@ -539,7 +539,7 @@ function Ot({ open: t, onOpenChange: n, title: r, description: i, confirmLabel:
|
|
|
539
539
|
backdropFilter: "blur(2px)"
|
|
540
540
|
}
|
|
541
541
|
}), /* @__PURE__ */ Q("div", {
|
|
542
|
-
ref:
|
|
542
|
+
ref: u,
|
|
543
543
|
role: "dialog",
|
|
544
544
|
"aria-modal": "true",
|
|
545
545
|
"aria-label": r,
|
|
@@ -580,14 +580,14 @@ function Ot({ open: t, onOpenChange: n, title: r, description: i, confirmLabel:
|
|
|
580
580
|
width: 28,
|
|
581
581
|
height: 28,
|
|
582
582
|
borderRadius: 7,
|
|
583
|
-
background:
|
|
584
|
-
color:
|
|
583
|
+
background: c ? "var(--danger-soft)" : "var(--accent-soft)",
|
|
584
|
+
color: c ? "var(--danger)" : "var(--accent)",
|
|
585
585
|
display: "inline-flex",
|
|
586
586
|
alignItems: "center",
|
|
587
587
|
justifyContent: "center",
|
|
588
588
|
flexShrink: 0
|
|
589
589
|
},
|
|
590
|
-
children: Z(
|
|
590
|
+
children: Z(c ? e.trash : e.info, { size: 15 })
|
|
591
591
|
}),
|
|
592
592
|
/* @__PURE__ */ Q("div", {
|
|
593
593
|
style: {
|
|
@@ -610,7 +610,7 @@ function Ot({ open: t, onOpenChange: n, title: r, description: i, confirmLabel:
|
|
|
610
610
|
children: i
|
|
611
611
|
})]
|
|
612
612
|
}),
|
|
613
|
-
/* @__PURE__ */ Z(
|
|
613
|
+
/* @__PURE__ */ Z(o, {
|
|
614
614
|
icon: /* @__PURE__ */ Z(e.x, { size: 14 }),
|
|
615
615
|
onClick: () => n(!1)
|
|
616
616
|
})
|
|
@@ -629,15 +629,15 @@ function Ot({ open: t, onOpenChange: n, title: r, description: i, confirmLabel:
|
|
|
629
629
|
},
|
|
630
630
|
children: [
|
|
631
631
|
/* @__PURE__ */ Z("div", { style: { flex: 1 } }),
|
|
632
|
-
/* @__PURE__ */ Z(
|
|
632
|
+
/* @__PURE__ */ Z(l, {
|
|
633
633
|
onClick: () => n(!1),
|
|
634
634
|
children: "Cancel"
|
|
635
635
|
}),
|
|
636
|
-
/* @__PURE__ */ Z(
|
|
636
|
+
/* @__PURE__ */ Z(l, {
|
|
637
637
|
kind: "primary",
|
|
638
|
-
danger:
|
|
638
|
+
danger: c,
|
|
639
639
|
onClick: () => {
|
|
640
|
-
|
|
640
|
+
s(), n(!1);
|
|
641
641
|
},
|
|
642
642
|
children: a
|
|
643
643
|
})
|
|
@@ -701,11 +701,11 @@ function Ft(e) {
|
|
|
701
701
|
if (!(!e || e === "?")) return e.startsWith("?") ? e : `?${e}`;
|
|
702
702
|
}
|
|
703
703
|
function It() {
|
|
704
|
-
let e = Pe(), { data: t } =
|
|
705
|
-
return G((
|
|
706
|
-
let { pathname: o, search: s, hash: c } = Pt(
|
|
707
|
-
if (
|
|
708
|
-
|
|
704
|
+
let e = Pe(), { data: t } = A(), r = n(), i = U();
|
|
705
|
+
return G((n, a) => {
|
|
706
|
+
let { pathname: o, search: s, hash: c } = Pt(n, a?.search);
|
|
707
|
+
if (r.enabled) {
|
|
708
|
+
i(`${o}${s ?? ""}${c ?? ""}`, { replace: a?.replace });
|
|
709
709
|
return;
|
|
710
710
|
}
|
|
711
711
|
let l = wt.getState(), u = a?.topLevel ?? !1, d = kt(s), f = u || typeof window > "u" ? void 0 : jt({
|
|
@@ -727,7 +727,7 @@ function It() {
|
|
|
727
727
|
}, { replace: a?.replace });
|
|
728
728
|
return;
|
|
729
729
|
}
|
|
730
|
-
let m = a?.title ? void 0 :
|
|
730
|
+
let m = a?.title ? void 0 : oe(o, t?.screens, t?.entities), h = a?.title ?? m?.title ?? o, g = a?.icon ?? m?.icon;
|
|
731
731
|
l.openTab({
|
|
732
732
|
pathname: o,
|
|
733
733
|
search: d,
|
|
@@ -744,8 +744,8 @@ function It() {
|
|
|
744
744
|
e,
|
|
745
745
|
t?.screens,
|
|
746
746
|
t?.entities,
|
|
747
|
-
|
|
748
|
-
|
|
747
|
+
r.enabled,
|
|
748
|
+
i
|
|
749
749
|
]);
|
|
750
750
|
}
|
|
751
751
|
//#endregion
|
|
@@ -782,57 +782,57 @@ function Kt(e) {
|
|
|
782
782
|
return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[1][0]).toUpperCase();
|
|
783
783
|
}
|
|
784
784
|
function qt(e) {
|
|
785
|
-
let { field: t, fieldName: n, value:
|
|
785
|
+
let { field: t, fieldName: n, value: r, onChange: i, mode: a, alt: o, disabled: s, visual: c, uploadFieldCode: l, uploadSlotCode: u } = e, d = ve(r), [f, p] = Y("idle"), [g, _] = Y(null), [v, y] = Y(null), [b, x] = Y(null), [S, C] = Y(!1), w = J(null), T = J(!1), E = J(null), { register: D, unregister: O, isDraft: k } = ue();
|
|
786
786
|
K(() => () => {
|
|
787
|
-
|
|
787
|
+
w.current && w.current.abort();
|
|
788
788
|
}, []);
|
|
789
|
-
let
|
|
790
|
-
|
|
789
|
+
let A = q(() => he(d, o, t.display?.placeholder || n), [
|
|
790
|
+
o,
|
|
791
791
|
t.display?.placeholder,
|
|
792
792
|
n,
|
|
793
|
-
|
|
794
|
-
]),
|
|
795
|
-
let
|
|
796
|
-
if (
|
|
797
|
-
|
|
793
|
+
d
|
|
794
|
+
]), j = (t.accepts ?? ["image/*"]).join(","), M = G(async (r) => {
|
|
795
|
+
let a = h(r, t.accepts, t.max_size_bytes);
|
|
796
|
+
if (a) {
|
|
797
|
+
y(a), p("error");
|
|
798
798
|
return;
|
|
799
799
|
}
|
|
800
|
-
let
|
|
800
|
+
let o = r;
|
|
801
801
|
if (t.display?.crop_on_upload) try {
|
|
802
802
|
let { blob: e, filename: n } = await Wt()({
|
|
803
|
-
file:
|
|
803
|
+
file: r,
|
|
804
804
|
aspectRatio: Zt(t.display.aspect_ratio)
|
|
805
805
|
});
|
|
806
|
-
|
|
806
|
+
o = new File([e], n, { type: e.type || r.type });
|
|
807
807
|
} catch (e) {
|
|
808
|
-
|
|
808
|
+
y({
|
|
809
809
|
code: "CROP_FAILED",
|
|
810
810
|
message: e instanceof Error ? e.message : "Crop failed"
|
|
811
|
-
}),
|
|
811
|
+
}), p("error");
|
|
812
812
|
return;
|
|
813
813
|
}
|
|
814
|
-
|
|
814
|
+
y(null), T.current = !1, p("uploading"), _({
|
|
815
815
|
loaded: 0,
|
|
816
|
-
total:
|
|
816
|
+
total: o.size,
|
|
817
817
|
pct: 0
|
|
818
818
|
});
|
|
819
|
-
let
|
|
820
|
-
|
|
819
|
+
let s = new AbortController();
|
|
820
|
+
w.current = s;
|
|
821
821
|
try {
|
|
822
|
-
let r = await
|
|
823
|
-
file:
|
|
822
|
+
let r = await se({
|
|
823
|
+
file: o,
|
|
824
824
|
entityCode: e.entityCode,
|
|
825
|
-
fieldCode:
|
|
826
|
-
slotCode:
|
|
827
|
-
signal:
|
|
825
|
+
fieldCode: l ?? n,
|
|
826
|
+
slotCode: u,
|
|
827
|
+
signal: s.signal,
|
|
828
828
|
onProgress: _
|
|
829
829
|
});
|
|
830
|
-
if (
|
|
831
|
-
|
|
830
|
+
if (T.current) {
|
|
831
|
+
m(r.id).catch(() => {}), O(r.id);
|
|
832
832
|
return;
|
|
833
833
|
}
|
|
834
|
-
|
|
835
|
-
let
|
|
834
|
+
d && k(d.id) && (m(d.id).catch(() => {}), O(d.id)), D(r.id, () => m(r.id)), x(r.id), p("idle"), _(null);
|
|
835
|
+
let a = {
|
|
836
836
|
id: r.id,
|
|
837
837
|
filename: r.filename,
|
|
838
838
|
content_type: r.content_type,
|
|
@@ -843,17 +843,17 @@ function qt(e) {
|
|
|
843
843
|
url: r.url,
|
|
844
844
|
metadata: r.metadata
|
|
845
845
|
};
|
|
846
|
-
|
|
846
|
+
i?.(t.mode === "array" ? [a] : a);
|
|
847
847
|
} catch (e) {
|
|
848
|
-
if (e instanceof
|
|
849
|
-
let t = e instanceof
|
|
848
|
+
if (e instanceof ce && e.code === "ABORTED") return;
|
|
849
|
+
let t = e instanceof ce ? {
|
|
850
850
|
code: e.code,
|
|
851
851
|
message: e.message
|
|
852
852
|
} : {
|
|
853
853
|
code: "UNKNOWN",
|
|
854
854
|
message: e instanceof Error ? e.message : "Upload failed"
|
|
855
855
|
};
|
|
856
|
-
|
|
856
|
+
y(t), p("error"), _(null);
|
|
857
857
|
}
|
|
858
858
|
}, [
|
|
859
859
|
t.accepts,
|
|
@@ -862,133 +862,133 @@ function qt(e) {
|
|
|
862
862
|
t.display?.aspect_ratio,
|
|
863
863
|
t.mode,
|
|
864
864
|
n,
|
|
865
|
-
|
|
865
|
+
i,
|
|
866
866
|
e.entityCode,
|
|
867
|
+
D,
|
|
867
868
|
k,
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
u
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
m === "uploading" && E.current && (D.current = !0, E.current.abort(), E.current = null, h("idle"), _(null)), S && (x(S).catch(() => {}), A(S), C(null));
|
|
875
|
-
}, [
|
|
876
|
-
m,
|
|
877
|
-
S,
|
|
878
|
-
A
|
|
879
|
-
]), I = G(() => {
|
|
880
|
-
f && j(f.id) && (x(f.id).catch(() => {}), A(f.id), C(null)), a?.(t.mode === "array" ? [] : null);
|
|
869
|
+
d,
|
|
870
|
+
O,
|
|
871
|
+
l,
|
|
872
|
+
u
|
|
873
|
+
]), N = G(() => {
|
|
874
|
+
f === "uploading" && w.current && (T.current = !0, w.current.abort(), w.current = null, p("idle"), _(null)), b && (m(b).catch(() => {}), O(b), x(null));
|
|
881
875
|
}, [
|
|
882
876
|
f,
|
|
877
|
+
b,
|
|
878
|
+
O
|
|
879
|
+
]), P = G(() => {
|
|
880
|
+
d && k(d.id) && (m(d.id).catch(() => {}), O(d.id), x(null)), i?.(t.mode === "array" ? [] : null);
|
|
881
|
+
}, [
|
|
882
|
+
d,
|
|
883
883
|
t.mode,
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
]),
|
|
888
|
-
|
|
889
|
-
}, []),
|
|
890
|
-
|
|
891
|
-
}, [
|
|
892
|
-
|
|
893
|
-
}, [
|
|
894
|
-
|
|
895
|
-
}, [
|
|
896
|
-
if (
|
|
884
|
+
k,
|
|
885
|
+
i,
|
|
886
|
+
O
|
|
887
|
+
]), F = G(() => {
|
|
888
|
+
y(null), p("idle"), E.current?.click();
|
|
889
|
+
}, []), I = G(() => {
|
|
890
|
+
s || E.current?.click();
|
|
891
|
+
}, [s]), L = G((e) => {
|
|
892
|
+
s || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), I());
|
|
893
|
+
}, [s, I]), R = G((e) => {
|
|
894
|
+
s || (e.preventDefault(), e.dataTransfer.dropEffect = "copy");
|
|
895
|
+
}, [s]), z = G((e) => {
|
|
896
|
+
if (s) return;
|
|
897
897
|
e.preventDefault();
|
|
898
898
|
let t = e.dataTransfer.files?.[0];
|
|
899
|
-
t &&
|
|
900
|
-
}, [
|
|
899
|
+
t && M(t);
|
|
900
|
+
}, [s, M]), B = G((e) => {
|
|
901
901
|
let t = e.target.files?.[0];
|
|
902
|
-
e.target.value = "", t &&
|
|
903
|
-
}, [
|
|
904
|
-
aspectRatio:
|
|
905
|
-
width:
|
|
906
|
-
},
|
|
907
|
-
e.stopPropagation(),
|
|
908
|
-
}, []),
|
|
909
|
-
if (!
|
|
910
|
-
let n = e.currentTarget.getBoundingClientRect(), r = n.width > 0 ? (e.clientX - n.left) / n.width : .5,
|
|
902
|
+
e.target.value = "", t && M(t);
|
|
903
|
+
}, [M]), ee = c.aspectRatio ?? Xt(c.shape, t.display?.aspect_ratio), V = me(d), te = {
|
|
904
|
+
aspectRatio: ee,
|
|
905
|
+
width: c.width ?? (c.shape === "wide" ? "100%" : "120px")
|
|
906
|
+
}, ne = !!d, H = Gt(d, t.display?.listable_thumbnail), U = _e(d, t.display?.listable_thumbnail), re = ge(d?.id, U, H), ie = a === "display", W = G((e) => {
|
|
907
|
+
e.stopPropagation(), C((e) => !e);
|
|
908
|
+
}, []), ae = G((e) => {
|
|
909
|
+
if (!d || !S) return;
|
|
910
|
+
let n = e.currentTarget.getBoundingClientRect(), r = n.width > 0 ? (e.clientX - n.left) / n.width : .5, a = n.height > 0 ? (e.clientY - n.top) / n.height : .5, o = be(d, {
|
|
911
911
|
x: Math.max(0, Math.min(1, r)),
|
|
912
|
-
y: Math.max(0, Math.min(1,
|
|
912
|
+
y: Math.max(0, Math.min(1, a))
|
|
913
913
|
});
|
|
914
|
-
|
|
914
|
+
i?.(t.mode === "array" ? [o] : o), C(!1);
|
|
915
915
|
}, [
|
|
916
916
|
t.mode,
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
917
|
+
d,
|
|
918
|
+
S,
|
|
919
|
+
i
|
|
920
920
|
]);
|
|
921
|
-
return
|
|
922
|
-
className: Jt(
|
|
923
|
-
style:
|
|
924
|
-
"aria-label":
|
|
925
|
-
children:
|
|
926
|
-
src:
|
|
927
|
-
alt:
|
|
928
|
-
className: Yt(
|
|
929
|
-
style: { objectPosition: Se(
|
|
921
|
+
return ie ? /* @__PURE__ */ Z("div", {
|
|
922
|
+
className: Jt(c.shape, !1),
|
|
923
|
+
style: te,
|
|
924
|
+
"aria-label": A,
|
|
925
|
+
children: ne && re ? /* @__PURE__ */ Z("img", {
|
|
926
|
+
src: re,
|
|
927
|
+
alt: A,
|
|
928
|
+
className: Yt(c.shape),
|
|
929
|
+
style: { objectPosition: Se(V) },
|
|
930
930
|
loading: "lazy"
|
|
931
931
|
}) : /* @__PURE__ */ Z(Qt, {
|
|
932
|
-
shape:
|
|
933
|
-
label:
|
|
932
|
+
shape: c.shape,
|
|
933
|
+
label: A,
|
|
934
934
|
placeholder: t.display?.placeholder
|
|
935
935
|
})
|
|
936
936
|
}) : /* @__PURE__ */ Q("div", {
|
|
937
|
-
className: Jt(
|
|
938
|
-
style:
|
|
939
|
-
tabIndex:
|
|
937
|
+
className: Jt(c.shape, !s),
|
|
938
|
+
style: te,
|
|
939
|
+
tabIndex: s ? -1 : 0,
|
|
940
940
|
role: "button",
|
|
941
|
-
"aria-label":
|
|
942
|
-
"aria-disabled":
|
|
943
|
-
"aria-busy":
|
|
944
|
-
"aria-invalid":
|
|
945
|
-
onClick:
|
|
946
|
-
onMouseDown:
|
|
947
|
-
onKeyDown:
|
|
948
|
-
onDragOver:
|
|
941
|
+
"aria-label": A,
|
|
942
|
+
"aria-disabled": s || void 0,
|
|
943
|
+
"aria-busy": f === "uploading" || void 0,
|
|
944
|
+
"aria-invalid": f === "error" || void 0,
|
|
945
|
+
onClick: f === "idle" && !ne ? I : void 0,
|
|
946
|
+
onMouseDown: S ? ae : void 0,
|
|
947
|
+
onKeyDown: L,
|
|
948
|
+
onDragOver: R,
|
|
949
949
|
onDrop: z,
|
|
950
|
-
"data-testid":
|
|
950
|
+
"data-testid": S ? "focal-point-target" : `file-widget-${n}`,
|
|
951
951
|
children: [
|
|
952
952
|
/* @__PURE__ */ Z("input", {
|
|
953
|
-
ref:
|
|
953
|
+
ref: E,
|
|
954
954
|
type: "file",
|
|
955
|
-
accept:
|
|
955
|
+
accept: j,
|
|
956
956
|
onChange: B,
|
|
957
957
|
style: { display: "none" },
|
|
958
958
|
"data-testid": `file-input-${n}`
|
|
959
959
|
}),
|
|
960
|
-
|
|
961
|
-
src:
|
|
962
|
-
alt:
|
|
963
|
-
className: Yt(
|
|
964
|
-
style: { objectPosition: Se(
|
|
960
|
+
ne && re ? /* @__PURE__ */ Z("img", {
|
|
961
|
+
src: re,
|
|
962
|
+
alt: A,
|
|
963
|
+
className: Yt(c.shape),
|
|
964
|
+
style: { objectPosition: Se(V) },
|
|
965
965
|
loading: "lazy"
|
|
966
|
-
}) :
|
|
967
|
-
shape:
|
|
968
|
-
label:
|
|
966
|
+
}) : f === "uploading" ? null : /* @__PURE__ */ Z(Qt, {
|
|
967
|
+
shape: c.shape,
|
|
968
|
+
label: A,
|
|
969
969
|
placeholder: t.display?.placeholder
|
|
970
970
|
}),
|
|
971
|
-
|
|
972
|
-
|
|
971
|
+
f === "uploading" && /* @__PURE__ */ Z($t, { pct: g?.pct ?? 0 }),
|
|
972
|
+
b && /* @__PURE__ */ Z("span", {
|
|
973
973
|
className: "absolute right-1 top-1 h-2 w-2 rounded-full bg-warning",
|
|
974
974
|
"aria-hidden": "true",
|
|
975
975
|
"data-testid": "draft-indicator"
|
|
976
976
|
}),
|
|
977
|
-
|
|
977
|
+
ne && f === "idle" && !s && /* @__PURE__ */ Q("div", {
|
|
978
978
|
className: "absolute inset-0 flex items-center justify-center gap-2 bg-black/40 opacity-0 transition-opacity hover:opacity-100 focus-within:opacity-100",
|
|
979
979
|
children: [
|
|
980
980
|
t.display?.focal_point && /* @__PURE__ */ Z("button", {
|
|
981
981
|
type: "button",
|
|
982
982
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
983
|
-
onClick:
|
|
983
|
+
onClick: W,
|
|
984
984
|
"data-testid": "focal-point-toggle",
|
|
985
|
-
children:
|
|
985
|
+
children: S ? "Cancel focus" : "Set focus"
|
|
986
986
|
}),
|
|
987
987
|
/* @__PURE__ */ Z("button", {
|
|
988
988
|
type: "button",
|
|
989
989
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
990
990
|
onClick: (e) => {
|
|
991
|
-
e.stopPropagation(),
|
|
991
|
+
e.stopPropagation(), I();
|
|
992
992
|
},
|
|
993
993
|
children: "Change"
|
|
994
994
|
}),
|
|
@@ -996,30 +996,30 @@ function qt(e) {
|
|
|
996
996
|
type: "button",
|
|
997
997
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-destructive hover:bg-surface-2",
|
|
998
998
|
onClick: (e) => {
|
|
999
|
-
e.stopPropagation(),
|
|
999
|
+
e.stopPropagation(), P();
|
|
1000
1000
|
},
|
|
1001
1001
|
children: "Remove"
|
|
1002
1002
|
})
|
|
1003
1003
|
]
|
|
1004
1004
|
}),
|
|
1005
|
-
|
|
1005
|
+
V && ne && /* @__PURE__ */ Z("span", {
|
|
1006
1006
|
className: "absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white bg-black/70",
|
|
1007
1007
|
style: {
|
|
1008
|
-
left: `${
|
|
1009
|
-
top: `${
|
|
1008
|
+
left: `${V.x * 100}%`,
|
|
1009
|
+
top: `${V.y * 100}%`
|
|
1010
1010
|
},
|
|
1011
1011
|
"data-testid": "focal-point-marker"
|
|
1012
1012
|
}),
|
|
1013
|
-
|
|
1013
|
+
f === "uploading" && /* @__PURE__ */ Z("button", {
|
|
1014
1014
|
type: "button",
|
|
1015
1015
|
className: "absolute bottom-1 right-1 rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
|
|
1016
1016
|
onClick: (e) => {
|
|
1017
|
-
e.stopPropagation(),
|
|
1017
|
+
e.stopPropagation(), N();
|
|
1018
1018
|
},
|
|
1019
1019
|
"data-testid": "cancel-upload",
|
|
1020
1020
|
children: "Cancel"
|
|
1021
1021
|
}),
|
|
1022
|
-
|
|
1022
|
+
f === "error" && v && /* @__PURE__ */ Q("div", {
|
|
1023
1023
|
className: "absolute inset-x-0 bottom-0 flex items-center justify-between gap-2 bg-destructive-soft px-2 py-1 text-xs text-destructive",
|
|
1024
1024
|
role: "alert",
|
|
1025
1025
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -1030,7 +1030,7 @@ function qt(e) {
|
|
|
1030
1030
|
type: "button",
|
|
1031
1031
|
className: "underline",
|
|
1032
1032
|
onClick: (e) => {
|
|
1033
|
-
e.stopPropagation(),
|
|
1033
|
+
e.stopPropagation(), F();
|
|
1034
1034
|
},
|
|
1035
1035
|
"data-testid": "retry-upload",
|
|
1036
1036
|
children: "Retry"
|
|
@@ -1142,7 +1142,7 @@ function nn(e) {
|
|
|
1142
1142
|
}
|
|
1143
1143
|
//#endregion
|
|
1144
1144
|
//#region src/components/file-widgets/GridLazy.tsx
|
|
1145
|
-
var rn = Ae(() => import("./Grid-
|
|
1145
|
+
var rn = Ae(() => import("./Grid-D0ckegd1.js").then((e) => ({ default: e.Grid })));
|
|
1146
1146
|
function an() {
|
|
1147
1147
|
return /* @__PURE__ */ Z("div", { className: "h-24 w-full rounded-md bg-muted animate-pulse" });
|
|
1148
1148
|
}
|
|
@@ -1161,61 +1161,61 @@ function sn({ contentType: e }) {
|
|
|
1161
1161
|
});
|
|
1162
1162
|
}
|
|
1163
1163
|
function cn(e) {
|
|
1164
|
-
let { field: t, fieldName: n, value: i, onChange: a, mode: o, disabled: s, uploadFieldCode: c, uploadSlotCode: l } = e, u = ve(i), [d, f] = Y("idle"), [
|
|
1164
|
+
let { field: t, fieldName: n, value: i, onChange: a, mode: o, disabled: s, uploadFieldCode: c, uploadSlotCode: l } = e, u = ve(i), [d, f] = Y("idle"), [p, g] = Y(null), [_, v] = Y(null), [y, b] = Y(!1), [x, S] = Y(u?.filename ?? ""), C = J(null), w = J(!1), T = J(null), { register: E, unregister: D, isDraft: O } = ue(), { open: k } = xe();
|
|
1165
1165
|
K(() => () => {
|
|
1166
|
-
|
|
1166
|
+
C.current && C.current.abort();
|
|
1167
1167
|
}, []), K(() => {
|
|
1168
|
-
|
|
1168
|
+
S(u?.filename ?? "");
|
|
1169
1169
|
}, [u?.filename]);
|
|
1170
|
-
let
|
|
1171
|
-
let
|
|
1172
|
-
if (
|
|
1173
|
-
|
|
1170
|
+
let A = (t.accepts ?? []).join(","), j = G(async (r) => {
|
|
1171
|
+
let i = h(r, t.accepts, t.max_size_bytes);
|
|
1172
|
+
if (i) {
|
|
1173
|
+
v(i), f("error");
|
|
1174
1174
|
return;
|
|
1175
1175
|
}
|
|
1176
|
-
|
|
1176
|
+
v(null), w.current = !1, f("uploading"), g({
|
|
1177
1177
|
loaded: 0,
|
|
1178
|
-
total:
|
|
1178
|
+
total: r.size,
|
|
1179
1179
|
pct: 0
|
|
1180
1180
|
});
|
|
1181
|
-
let
|
|
1182
|
-
|
|
1181
|
+
let o = new AbortController();
|
|
1182
|
+
C.current = o;
|
|
1183
1183
|
try {
|
|
1184
|
-
let
|
|
1185
|
-
file:
|
|
1184
|
+
let i = await se({
|
|
1185
|
+
file: r,
|
|
1186
1186
|
entityCode: e.entityCode,
|
|
1187
1187
|
fieldCode: c ?? n,
|
|
1188
1188
|
slotCode: l,
|
|
1189
|
-
signal:
|
|
1190
|
-
onProgress:
|
|
1189
|
+
signal: o.signal,
|
|
1190
|
+
onProgress: g
|
|
1191
1191
|
});
|
|
1192
|
-
if (
|
|
1193
|
-
|
|
1192
|
+
if (w.current) {
|
|
1193
|
+
m(i.id).catch(() => {}), D(i.id);
|
|
1194
1194
|
return;
|
|
1195
1195
|
}
|
|
1196
|
-
u &&
|
|
1197
|
-
let
|
|
1198
|
-
id:
|
|
1199
|
-
filename:
|
|
1200
|
-
content_type:
|
|
1201
|
-
size_bytes:
|
|
1202
|
-
sha256:
|
|
1203
|
-
width:
|
|
1204
|
-
height:
|
|
1205
|
-
url:
|
|
1206
|
-
metadata:
|
|
1196
|
+
u && O(u.id) && (m(u.id).catch(() => {}), D(u.id)), E(i.id, () => m(i.id)), f("idle"), g(null);
|
|
1197
|
+
let s = {
|
|
1198
|
+
id: i.id,
|
|
1199
|
+
filename: i.filename,
|
|
1200
|
+
content_type: i.content_type,
|
|
1201
|
+
size_bytes: i.size_bytes,
|
|
1202
|
+
sha256: i.sha256,
|
|
1203
|
+
width: i.width,
|
|
1204
|
+
height: i.height,
|
|
1205
|
+
url: i.url,
|
|
1206
|
+
metadata: i.metadata
|
|
1207
1207
|
};
|
|
1208
|
-
a?.(t.mode === "array" ? [
|
|
1208
|
+
a?.(t.mode === "array" ? [s] : s);
|
|
1209
1209
|
} catch (e) {
|
|
1210
|
-
if (e instanceof
|
|
1211
|
-
let t = e instanceof
|
|
1210
|
+
if (e instanceof ce && e.code === "ABORTED") return;
|
|
1211
|
+
let t = e instanceof ce ? {
|
|
1212
1212
|
code: e.code,
|
|
1213
1213
|
message: e.message
|
|
1214
1214
|
} : {
|
|
1215
1215
|
code: "UNKNOWN",
|
|
1216
1216
|
message: e instanceof Error ? e.message : "Upload failed"
|
|
1217
1217
|
};
|
|
1218
|
-
|
|
1218
|
+
v(t), f("error"), g(null);
|
|
1219
1219
|
}
|
|
1220
1220
|
}, [
|
|
1221
1221
|
t.accepts,
|
|
@@ -1223,40 +1223,40 @@ function cn(e) {
|
|
|
1223
1223
|
t.mode,
|
|
1224
1224
|
n,
|
|
1225
1225
|
u,
|
|
1226
|
-
|
|
1226
|
+
O,
|
|
1227
1227
|
a,
|
|
1228
1228
|
e.entityCode,
|
|
1229
|
+
E,
|
|
1229
1230
|
D,
|
|
1230
|
-
O,
|
|
1231
1231
|
c,
|
|
1232
1232
|
l
|
|
1233
|
-
]),
|
|
1234
|
-
s ||
|
|
1235
|
-
}, [s]),
|
|
1233
|
+
]), M = G(() => {
|
|
1234
|
+
s || T.current?.click();
|
|
1235
|
+
}, [s]), N = G((e) => {
|
|
1236
1236
|
let t = e.target.files?.[0];
|
|
1237
|
-
e.target.value = "", t &&
|
|
1238
|
-
}, [
|
|
1239
|
-
u &&
|
|
1237
|
+
e.target.value = "", t && j(t);
|
|
1238
|
+
}, [j]), P = G(() => {
|
|
1239
|
+
u && O(u.id) && (m(u.id).catch(() => {}), D(u.id)), a?.(t.mode === "array" ? [] : null);
|
|
1240
1240
|
}, [
|
|
1241
1241
|
u,
|
|
1242
1242
|
t.mode,
|
|
1243
|
-
|
|
1243
|
+
O,
|
|
1244
1244
|
a,
|
|
1245
|
-
|
|
1246
|
-
]),
|
|
1247
|
-
d === "uploading" &&
|
|
1248
|
-
}, [d]),
|
|
1249
|
-
u &&
|
|
1250
|
-
}, [u,
|
|
1251
|
-
!u || !fe(u) ||
|
|
1252
|
-
}, [u,
|
|
1245
|
+
D
|
|
1246
|
+
]), F = G(() => {
|
|
1247
|
+
d === "uploading" && C.current && (w.current = !0, C.current.abort(), C.current = null, f("idle"), g(null));
|
|
1248
|
+
}, [d]), I = G(() => {
|
|
1249
|
+
u && k(u.id, "download", ye(u));
|
|
1250
|
+
}, [u, k]), L = u ? fe(u) : !1, R = G(() => {
|
|
1251
|
+
!u || !fe(u) || k(u.id, "preview", we(u));
|
|
1252
|
+
}, [u, k]), z = G(() => {
|
|
1253
1253
|
if (!u) {
|
|
1254
1254
|
b(!1);
|
|
1255
1255
|
return;
|
|
1256
1256
|
}
|
|
1257
|
-
let e =
|
|
1257
|
+
let e = x.trim();
|
|
1258
1258
|
if (b(!1), !e || e === u.filename) {
|
|
1259
|
-
|
|
1259
|
+
S(u.filename);
|
|
1260
1260
|
return;
|
|
1261
1261
|
}
|
|
1262
1262
|
let n = {
|
|
@@ -1265,11 +1265,11 @@ function cn(e) {
|
|
|
1265
1265
|
};
|
|
1266
1266
|
a?.(t.mode === "array" ? [n] : n);
|
|
1267
1267
|
}, [
|
|
1268
|
-
|
|
1268
|
+
x,
|
|
1269
1269
|
u,
|
|
1270
1270
|
a,
|
|
1271
1271
|
t.mode
|
|
1272
|
-
]),
|
|
1272
|
+
]), B = o === "display";
|
|
1273
1273
|
return !u && d !== "uploading" ? /* @__PURE__ */ Q("div", {
|
|
1274
1274
|
"data-testid": `file-widget-${n}`,
|
|
1275
1275
|
className: "flex items-center gap-3 rounded-md border border-dashed border-border bg-surface p-3",
|
|
@@ -1280,27 +1280,27 @@ function cn(e) {
|
|
|
1280
1280
|
children: [/* @__PURE__ */ Z("span", {
|
|
1281
1281
|
className: "text-sm text-foreground",
|
|
1282
1282
|
children: t.display?.placeholder || "No document attached"
|
|
1283
|
-
}), !
|
|
1283
|
+
}), !B && /* @__PURE__ */ Z("button", {
|
|
1284
1284
|
type: "button",
|
|
1285
1285
|
className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
1286
|
-
onClick:
|
|
1286
|
+
onClick: M,
|
|
1287
1287
|
disabled: s,
|
|
1288
1288
|
"data-testid": "upload",
|
|
1289
1289
|
children: "Upload"
|
|
1290
1290
|
})]
|
|
1291
1291
|
}),
|
|
1292
|
-
!
|
|
1293
|
-
ref:
|
|
1292
|
+
!B && /* @__PURE__ */ Z("input", {
|
|
1293
|
+
ref: T,
|
|
1294
1294
|
type: "file",
|
|
1295
|
-
accept:
|
|
1296
|
-
onChange:
|
|
1295
|
+
accept: A || void 0,
|
|
1296
|
+
onChange: N,
|
|
1297
1297
|
style: { display: "none" },
|
|
1298
1298
|
"data-testid": `file-input-${n}`
|
|
1299
1299
|
}),
|
|
1300
|
-
d === "error" &&
|
|
1300
|
+
d === "error" && _ && /* @__PURE__ */ Z("div", {
|
|
1301
1301
|
className: "ml-auto text-xs text-destructive",
|
|
1302
1302
|
role: "alert",
|
|
1303
|
-
children:
|
|
1303
|
+
children: _.message
|
|
1304
1304
|
})
|
|
1305
1305
|
]
|
|
1306
1306
|
}) : /* @__PURE__ */ Q("div", {
|
|
@@ -1313,22 +1313,22 @@ function cn(e) {
|
|
|
1313
1313
|
/* @__PURE__ */ Q("div", {
|
|
1314
1314
|
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
1315
1315
|
children: [
|
|
1316
|
-
|
|
1316
|
+
y && u ? /* @__PURE__ */ Z("input", {
|
|
1317
1317
|
type: "text",
|
|
1318
1318
|
className: "rounded-sm border border-border bg-card px-1 py-0.5 text-sm text-foreground",
|
|
1319
|
-
value:
|
|
1319
|
+
value: x,
|
|
1320
1320
|
autoFocus: !0,
|
|
1321
|
-
onChange: (e) =>
|
|
1322
|
-
onBlur:
|
|
1321
|
+
onChange: (e) => S(e.target.value),
|
|
1322
|
+
onBlur: z,
|
|
1323
1323
|
onKeyDown: (e) => {
|
|
1324
|
-
e.key === "Enter" ?
|
|
1324
|
+
e.key === "Enter" ? z() : e.key === "Escape" && (b(!1), S(u.filename));
|
|
1325
1325
|
},
|
|
1326
1326
|
"data-testid": "filename-input"
|
|
1327
1327
|
}) : /* @__PURE__ */ Z("button", {
|
|
1328
1328
|
type: "button",
|
|
1329
1329
|
className: "truncate text-left text-sm font-medium text-foreground hover:underline",
|
|
1330
|
-
onClick: () => !
|
|
1331
|
-
disabled:
|
|
1330
|
+
onClick: () => !B && u && b(!0),
|
|
1331
|
+
disabled: B || s || !u,
|
|
1332
1332
|
title: u?.filename,
|
|
1333
1333
|
"data-testid": "filename",
|
|
1334
1334
|
children: u?.filename ?? "Uploading…"
|
|
@@ -1336,7 +1336,7 @@ function cn(e) {
|
|
|
1336
1336
|
/* @__PURE__ */ Q("div", {
|
|
1337
1337
|
className: "flex flex-wrap gap-2 text-xs text-muted-foreground",
|
|
1338
1338
|
children: [
|
|
1339
|
-
u && /* @__PURE__ */ Z("span", { children:
|
|
1339
|
+
u && /* @__PURE__ */ Z("span", { children: r(u.size_bytes) }),
|
|
1340
1340
|
u?.page_count != null && /* @__PURE__ */ Q("span", { children: [u.page_count, " pages"] }),
|
|
1341
1341
|
u?.uploaded_at && /* @__PURE__ */ Z("span", { children: ln(u.uploaded_at) }),
|
|
1342
1342
|
u?.uploaded_by && /* @__PURE__ */ Q("span", { children: ["by ", u.uploaded_by] }),
|
|
@@ -1349,20 +1349,20 @@ function cn(e) {
|
|
|
1349
1349
|
d === "uploading" && /* @__PURE__ */ Q("div", {
|
|
1350
1350
|
className: "text-xs text-muted-foreground",
|
|
1351
1351
|
role: "progressbar",
|
|
1352
|
-
"aria-valuenow":
|
|
1352
|
+
"aria-valuenow": p?.pct ?? 0,
|
|
1353
1353
|
"aria-valuemin": 0,
|
|
1354
1354
|
"aria-valuemax": 100,
|
|
1355
1355
|
"data-testid": "upload-progress",
|
|
1356
1356
|
children: [
|
|
1357
1357
|
"Uploading ",
|
|
1358
|
-
|
|
1358
|
+
p?.pct ?? 0,
|
|
1359
1359
|
"%"
|
|
1360
1360
|
]
|
|
1361
1361
|
}),
|
|
1362
|
-
d === "error" &&
|
|
1362
|
+
d === "error" && _ && /* @__PURE__ */ Z("div", {
|
|
1363
1363
|
className: "text-xs text-destructive",
|
|
1364
1364
|
role: "alert",
|
|
1365
|
-
children:
|
|
1365
|
+
children: _.message
|
|
1366
1366
|
})
|
|
1367
1367
|
]
|
|
1368
1368
|
}),
|
|
@@ -1372,7 +1372,7 @@ function cn(e) {
|
|
|
1372
1372
|
/* @__PURE__ */ Z("button", {
|
|
1373
1373
|
type: "button",
|
|
1374
1374
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
1375
|
-
onClick:
|
|
1375
|
+
onClick: I,
|
|
1376
1376
|
"data-testid": "download",
|
|
1377
1377
|
children: "Download"
|
|
1378
1378
|
}),
|
|
@@ -1385,17 +1385,17 @@ function cn(e) {
|
|
|
1385
1385
|
"data-testid": "preview",
|
|
1386
1386
|
children: "Preview"
|
|
1387
1387
|
}),
|
|
1388
|
-
!
|
|
1388
|
+
!B && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("button", {
|
|
1389
1389
|
type: "button",
|
|
1390
1390
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
1391
|
-
onClick:
|
|
1391
|
+
onClick: M,
|
|
1392
1392
|
disabled: s,
|
|
1393
1393
|
"data-testid": "replace",
|
|
1394
1394
|
children: "Replace"
|
|
1395
1395
|
}), /* @__PURE__ */ Z("button", {
|
|
1396
1396
|
type: "button",
|
|
1397
1397
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-destructive hover:bg-surface-2",
|
|
1398
|
-
onClick:
|
|
1398
|
+
onClick: P,
|
|
1399
1399
|
disabled: s,
|
|
1400
1400
|
"data-testid": "remove",
|
|
1401
1401
|
children: "Remove"
|
|
@@ -1403,16 +1403,16 @@ function cn(e) {
|
|
|
1403
1403
|
] }), d === "uploading" && /* @__PURE__ */ Z("button", {
|
|
1404
1404
|
type: "button",
|
|
1405
1405
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs",
|
|
1406
|
-
onClick:
|
|
1406
|
+
onClick: F,
|
|
1407
1407
|
"data-testid": "cancel-upload",
|
|
1408
1408
|
children: "Cancel"
|
|
1409
1409
|
})]
|
|
1410
1410
|
}),
|
|
1411
|
-
!
|
|
1412
|
-
ref:
|
|
1411
|
+
!B && /* @__PURE__ */ Z("input", {
|
|
1412
|
+
ref: T,
|
|
1413
1413
|
type: "file",
|
|
1414
|
-
accept:
|
|
1415
|
-
onChange:
|
|
1414
|
+
accept: A || void 0,
|
|
1415
|
+
onChange: N,
|
|
1416
1416
|
style: { display: "none" },
|
|
1417
1417
|
"data-testid": `file-input-${n}`
|
|
1418
1418
|
})
|
|
@@ -1429,54 +1429,54 @@ function un(e) {
|
|
|
1429
1429
|
return e ? (e.split("/")[1] ?? e).toUpperCase().slice(0, 6) : "";
|
|
1430
1430
|
}
|
|
1431
1431
|
function dn(e) {
|
|
1432
|
-
let { field: t, fieldName: n, value: i, onChange: a, mode: o, disabled: s } = e, c = Ce(i), [l, u] = Y([]), { register: d, unregister: f, isDraft:
|
|
1433
|
-
|
|
1434
|
-
let
|
|
1435
|
-
|
|
1432
|
+
let { field: t, fieldName: n, value: i, onChange: a, mode: o, disabled: s } = e, c = Ce(i), [l, u] = Y([]), { register: d, unregister: f, isDraft: p } = ue(), g = J(c);
|
|
1433
|
+
g.current = c;
|
|
1434
|
+
let _ = J(null), v = J(/* @__PURE__ */ new Set()), y = J([]);
|
|
1435
|
+
y.current = l;
|
|
1436
1436
|
let { open: b } = xe();
|
|
1437
1437
|
K(() => () => {
|
|
1438
|
-
|
|
1438
|
+
y.current.forEach((e) => e.abort());
|
|
1439
1439
|
}, []);
|
|
1440
|
-
let
|
|
1441
|
-
let
|
|
1442
|
-
if (
|
|
1440
|
+
let x = (t.accepts ?? []).join(","), S = o === "display", C = G(async (r) => {
|
|
1441
|
+
let i = h(r, t.accepts, t.max_size_bytes), o = `row-${Math.random().toString(36).slice(2)}-${Date.now()}`, s = new AbortController();
|
|
1442
|
+
if (i) {
|
|
1443
1443
|
u((e) => [...e, {
|
|
1444
|
-
localId:
|
|
1445
|
-
filename:
|
|
1444
|
+
localId: o,
|
|
1445
|
+
filename: r.name,
|
|
1446
1446
|
progress: null,
|
|
1447
|
-
error:
|
|
1447
|
+
error: i,
|
|
1448
1448
|
abort: () => {}
|
|
1449
1449
|
}]);
|
|
1450
1450
|
return;
|
|
1451
1451
|
}
|
|
1452
1452
|
u((e) => [...e, {
|
|
1453
|
-
localId:
|
|
1454
|
-
filename:
|
|
1453
|
+
localId: o,
|
|
1454
|
+
filename: r.name,
|
|
1455
1455
|
progress: {
|
|
1456
1456
|
loaded: 0,
|
|
1457
|
-
total:
|
|
1457
|
+
total: r.size,
|
|
1458
1458
|
pct: 0
|
|
1459
1459
|
},
|
|
1460
1460
|
error: null,
|
|
1461
|
-
abort: () =>
|
|
1461
|
+
abort: () => s.abort()
|
|
1462
1462
|
}]);
|
|
1463
1463
|
try {
|
|
1464
|
-
let t = await
|
|
1465
|
-
file:
|
|
1464
|
+
let t = await se({
|
|
1465
|
+
file: r,
|
|
1466
1466
|
entityCode: e.entityCode,
|
|
1467
1467
|
fieldCode: n,
|
|
1468
|
-
signal:
|
|
1469
|
-
onProgress: (e) => u((t) => t.map((t) => t.localId ===
|
|
1468
|
+
signal: s.signal,
|
|
1469
|
+
onProgress: (e) => u((t) => t.map((t) => t.localId === o ? {
|
|
1470
1470
|
...t,
|
|
1471
1471
|
progress: e
|
|
1472
1472
|
} : t))
|
|
1473
1473
|
});
|
|
1474
|
-
if (
|
|
1475
|
-
|
|
1474
|
+
if (v.current.delete(o)) {
|
|
1475
|
+
m(t.id).catch(() => {}), f(t.id);
|
|
1476
1476
|
return;
|
|
1477
1477
|
}
|
|
1478
|
-
d(t.id, () =>
|
|
1479
|
-
let
|
|
1478
|
+
d(t.id, () => m(t.id));
|
|
1479
|
+
let i = {
|
|
1480
1480
|
id: t.id,
|
|
1481
1481
|
filename: t.filename,
|
|
1482
1482
|
content_type: t.content_type,
|
|
@@ -1486,21 +1486,21 @@ function dn(e) {
|
|
|
1486
1486
|
height: t.height,
|
|
1487
1487
|
url: t.url,
|
|
1488
1488
|
metadata: t.metadata
|
|
1489
|
-
},
|
|
1490
|
-
|
|
1489
|
+
}, c = [...g.current, i];
|
|
1490
|
+
g.current = c, a?.(c), u((e) => e.filter((e) => e.localId !== o));
|
|
1491
1491
|
} catch (e) {
|
|
1492
|
-
if (e instanceof
|
|
1493
|
-
u((e) => e.filter((e) => e.localId !==
|
|
1492
|
+
if (e instanceof ce && e.code === "ABORTED") {
|
|
1493
|
+
u((e) => e.filter((e) => e.localId !== o));
|
|
1494
1494
|
return;
|
|
1495
1495
|
}
|
|
1496
|
-
let t = e instanceof
|
|
1496
|
+
let t = e instanceof ce ? {
|
|
1497
1497
|
code: e.code,
|
|
1498
1498
|
message: e.message
|
|
1499
1499
|
} : {
|
|
1500
1500
|
code: "UNKNOWN",
|
|
1501
1501
|
message: e instanceof Error ? e.message : "Upload failed"
|
|
1502
1502
|
};
|
|
1503
|
-
u((e) => e.map((e) => e.localId ===
|
|
1503
|
+
u((e) => e.map((e) => e.localId === o ? {
|
|
1504
1504
|
...e,
|
|
1505
1505
|
error: t,
|
|
1506
1506
|
progress: null,
|
|
@@ -1515,21 +1515,21 @@ function dn(e) {
|
|
|
1515
1515
|
e.entityCode,
|
|
1516
1516
|
d,
|
|
1517
1517
|
f
|
|
1518
|
-
]),
|
|
1519
|
-
Array.from(e).forEach((e) => void
|
|
1520
|
-
}, [
|
|
1521
|
-
s ||
|
|
1522
|
-
}, [s]),
|
|
1518
|
+
]), w = G((e) => {
|
|
1519
|
+
Array.from(e).forEach((e) => void C(e));
|
|
1520
|
+
}, [C]), T = G(() => {
|
|
1521
|
+
s || _.current?.click();
|
|
1522
|
+
}, [s]), E = G((e) => {
|
|
1523
1523
|
let t = e.target.files;
|
|
1524
|
-
e.target.value = "", t && t.length > 0 &&
|
|
1525
|
-
}, [
|
|
1526
|
-
|
|
1524
|
+
e.target.value = "", t && t.length > 0 && w(t);
|
|
1525
|
+
}, [w]), D = G((e) => {
|
|
1526
|
+
p(e) && (m(e).catch(() => {}), f(e)), a?.(c.filter((t) => t.id !== e));
|
|
1527
1527
|
}, [
|
|
1528
|
-
|
|
1528
|
+
p,
|
|
1529
1529
|
c,
|
|
1530
1530
|
a,
|
|
1531
1531
|
f
|
|
1532
|
-
]),
|
|
1532
|
+
]), O = G((e) => {
|
|
1533
1533
|
b(e.id, "download", ye(e));
|
|
1534
1534
|
}, [b]);
|
|
1535
1535
|
return /* @__PURE__ */ Q("div", {
|
|
@@ -1552,26 +1552,26 @@ function dn(e) {
|
|
|
1552
1552
|
}),
|
|
1553
1553
|
/* @__PURE__ */ Z("button", {
|
|
1554
1554
|
type: "button",
|
|
1555
|
-
onClick: () =>
|
|
1555
|
+
onClick: () => O(e),
|
|
1556
1556
|
className: "min-w-0 flex-1 truncate text-left text-sm text-foreground hover:underline",
|
|
1557
1557
|
title: e.filename,
|
|
1558
1558
|
children: e.filename
|
|
1559
1559
|
}),
|
|
1560
1560
|
/* @__PURE__ */ Z("span", {
|
|
1561
1561
|
className: "flex-none text-xs text-muted-foreground",
|
|
1562
|
-
children:
|
|
1562
|
+
children: r(e.size_bytes)
|
|
1563
1563
|
}),
|
|
1564
1564
|
/* @__PURE__ */ Z("button", {
|
|
1565
1565
|
type: "button",
|
|
1566
1566
|
className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs text-foreground hover:bg-surface-2",
|
|
1567
|
-
onClick: () =>
|
|
1567
|
+
onClick: () => O(e),
|
|
1568
1568
|
"data-testid": `download-${e.id}`,
|
|
1569
1569
|
children: "Download"
|
|
1570
1570
|
}),
|
|
1571
|
-
!
|
|
1571
|
+
!S && /* @__PURE__ */ Z("button", {
|
|
1572
1572
|
type: "button",
|
|
1573
1573
|
className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs text-destructive hover:bg-surface-2",
|
|
1574
|
-
onClick: () =>
|
|
1574
|
+
onClick: () => D(e.id),
|
|
1575
1575
|
disabled: s,
|
|
1576
1576
|
"data-testid": `remove-${e.id}`,
|
|
1577
1577
|
children: "Remove"
|
|
@@ -1606,26 +1606,26 @@ function dn(e) {
|
|
|
1606
1606
|
type: "button",
|
|
1607
1607
|
className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
|
|
1608
1608
|
onClick: () => {
|
|
1609
|
-
e.abort(),
|
|
1609
|
+
e.abort(), v.current.add(e.localId), u((t) => t.filter((t) => t.localId !== e.localId));
|
|
1610
1610
|
},
|
|
1611
1611
|
children: e.error ? "Dismiss" : "Cancel"
|
|
1612
1612
|
})
|
|
1613
1613
|
]
|
|
1614
1614
|
}, e.localId))
|
|
1615
1615
|
]
|
|
1616
|
-
}), !
|
|
1616
|
+
}), !S && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("button", {
|
|
1617
1617
|
type: "button",
|
|
1618
1618
|
className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
1619
|
-
onClick:
|
|
1619
|
+
onClick: T,
|
|
1620
1620
|
disabled: s,
|
|
1621
1621
|
"data-testid": "add-files",
|
|
1622
1622
|
children: "Add files"
|
|
1623
1623
|
}), /* @__PURE__ */ Z("input", {
|
|
1624
|
-
ref:
|
|
1624
|
+
ref: _,
|
|
1625
1625
|
type: "file",
|
|
1626
|
-
accept:
|
|
1626
|
+
accept: x || void 0,
|
|
1627
1627
|
multiple: !0,
|
|
1628
|
-
onChange:
|
|
1628
|
+
onChange: E,
|
|
1629
1629
|
style: { display: "none" },
|
|
1630
1630
|
"data-testid": `file-input-${n}`
|
|
1631
1631
|
})] })]
|
|
@@ -1736,17 +1736,17 @@ function bn(e, t) {
|
|
|
1736
1736
|
function xn(e, t, n) {
|
|
1737
1737
|
if (yn(e, n)) return bn(t, n);
|
|
1738
1738
|
let r = e.fields.get(n);
|
|
1739
|
-
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ?
|
|
1739
|
+
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? i(t[n], bn(t, n)) : t[n];
|
|
1740
1740
|
}
|
|
1741
1741
|
function Sn(e, t, n) {
|
|
1742
1742
|
let r = e.fields.get(t);
|
|
1743
|
-
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ?
|
|
1743
|
+
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? R(n) : n;
|
|
1744
1744
|
}
|
|
1745
1745
|
function Cn(e, t, n) {
|
|
1746
1746
|
let r = yn(e, t);
|
|
1747
1747
|
if (r) return r.name || t;
|
|
1748
1748
|
let i = e.fields.get(t);
|
|
1749
|
-
return i ?
|
|
1749
|
+
return i ? ie(i, t, n) : t;
|
|
1750
1750
|
}
|
|
1751
1751
|
function wn(e) {
|
|
1752
1752
|
let { entity: t, entityCode: n, fieldName: r, record: i, mode: a, onChange: o, refs: s, disabled: c, surface: l, entities: u, screens: d, locale: f, fieldId: p, labelId: m } = e, h = yn(t, r);
|
|
@@ -1767,7 +1767,7 @@ function wn(e) {
|
|
|
1767
1767
|
});
|
|
1768
1768
|
}
|
|
1769
1769
|
let g = t.fields.get(r);
|
|
1770
|
-
return g ?
|
|
1770
|
+
return g ? O({
|
|
1771
1771
|
field: g,
|
|
1772
1772
|
entityCode: n,
|
|
1773
1773
|
fieldName: r,
|
|
@@ -1862,7 +1862,7 @@ function Nn(e) {
|
|
|
1862
1862
|
}
|
|
1863
1863
|
function Pn(e, t) {
|
|
1864
1864
|
if (e.mode !== "rich_text_inline") return { clear: !0 };
|
|
1865
|
-
let n =
|
|
1865
|
+
let n = d(R(t));
|
|
1866
1866
|
return n.length === 0 ? { clear: !0 } : { set: n.map((e, t) => ({
|
|
1867
1867
|
file_id: e,
|
|
1868
1868
|
position: t
|
|
@@ -1872,7 +1872,7 @@ function Pn(e, t) {
|
|
|
1872
1872
|
//#region src/hooks/useChildrenData.ts
|
|
1873
1873
|
var Fn = "entity-children";
|
|
1874
1874
|
function In(e, t, n, r, i, a) {
|
|
1875
|
-
let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ?
|
|
1875
|
+
let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? D(t, o.length) : [t];
|
|
1876
1876
|
return Le({
|
|
1877
1877
|
queryKey: [
|
|
1878
1878
|
Fn,
|
|
@@ -1890,7 +1890,7 @@ function In(e, t, n, r, i, a) {
|
|
|
1890
1890
|
op: "eq",
|
|
1891
1891
|
value: s[t]
|
|
1892
1892
|
}));
|
|
1893
|
-
return e.set("filters", JSON.stringify(t)), e.set("preview", "true"), i && e.set("sort", i), a && e.set("limit", String(a)),
|
|
1893
|
+
return e.set("filters", JSON.stringify(t)), e.set("preview", "true"), i && e.set("sort", i), a && e.set("limit", String(a)), L(`/api/data/${n}?${e.toString()}`);
|
|
1894
1894
|
},
|
|
1895
1895
|
enabled: !!e && !!t && !!n && !!r && s !== null
|
|
1896
1896
|
});
|
|
@@ -1933,7 +1933,7 @@ function zn(e, t, n, r, i, a, o, s) {
|
|
|
1933
1933
|
op: "eq",
|
|
1934
1934
|
value: t
|
|
1935
1935
|
});
|
|
1936
|
-
return c.set("filters", JSON.stringify(l)), i && c.set("sort", i), a && c.set("limit", String(a)), o && c.set("search", o), e && c.set("after", e),
|
|
1936
|
+
return c.set("filters", JSON.stringify(l)), i && c.set("sort", i), a && c.set("limit", String(a)), o && c.set("search", o), e && c.set("after", e), L(`/api/data/${n}?${c.toString()}`);
|
|
1937
1937
|
},
|
|
1938
1938
|
getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
|
|
1939
1939
|
initialPageParam: void 0,
|
|
@@ -1942,12 +1942,12 @@ function zn(e, t, n, r, i, a, o, s) {
|
|
|
1942
1942
|
}
|
|
1943
1943
|
//#endregion
|
|
1944
1944
|
//#region src/components/shared/ActionConfirmDialog.tsx
|
|
1945
|
-
function Bn({ open: t, onOpenChange: n, actionName: r, message: i, onConfirm: a, isPending:
|
|
1946
|
-
let
|
|
1945
|
+
function Bn({ open: t, onOpenChange: n, actionName: r, message: i, onConfirm: a, isPending: s }) {
|
|
1946
|
+
let c = J(null);
|
|
1947
1947
|
return K(() => {
|
|
1948
|
-
t &&
|
|
1948
|
+
t && c.current?.focus();
|
|
1949
1949
|
}, [t]), t ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("div", {
|
|
1950
|
-
onClick: () => !
|
|
1950
|
+
onClick: () => !s && n(!1),
|
|
1951
1951
|
style: {
|
|
1952
1952
|
position: "fixed",
|
|
1953
1953
|
inset: 0,
|
|
@@ -1956,13 +1956,13 @@ function Bn({ open: t, onOpenChange: n, actionName: r, message: i, onConfirm: a,
|
|
|
1956
1956
|
backdropFilter: "blur(2px)"
|
|
1957
1957
|
}
|
|
1958
1958
|
}), /* @__PURE__ */ Q("div", {
|
|
1959
|
-
ref:
|
|
1959
|
+
ref: c,
|
|
1960
1960
|
role: "dialog",
|
|
1961
1961
|
"aria-modal": "true",
|
|
1962
1962
|
"aria-label": r,
|
|
1963
1963
|
tabIndex: -1,
|
|
1964
1964
|
onKeyDown: (e) => {
|
|
1965
|
-
e.key === "Escape" && !
|
|
1965
|
+
e.key === "Escape" && !s && n(!1);
|
|
1966
1966
|
},
|
|
1967
1967
|
style: {
|
|
1968
1968
|
position: "fixed",
|
|
@@ -2027,9 +2027,9 @@ function Bn({ open: t, onOpenChange: n, actionName: r, message: i, onConfirm: a,
|
|
|
2027
2027
|
children: i
|
|
2028
2028
|
})]
|
|
2029
2029
|
}),
|
|
2030
|
-
/* @__PURE__ */ Z(
|
|
2030
|
+
/* @__PURE__ */ Z(o, {
|
|
2031
2031
|
icon: /* @__PURE__ */ Z(e.x, { size: 14 }),
|
|
2032
|
-
onClick: () => !
|
|
2032
|
+
onClick: () => !s && n(!1)
|
|
2033
2033
|
})
|
|
2034
2034
|
]
|
|
2035
2035
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -2046,17 +2046,17 @@ function Bn({ open: t, onOpenChange: n, actionName: r, message: i, onConfirm: a,
|
|
|
2046
2046
|
},
|
|
2047
2047
|
children: [
|
|
2048
2048
|
/* @__PURE__ */ Z("div", { style: { flex: 1 } }),
|
|
2049
|
-
/* @__PURE__ */ Z(
|
|
2049
|
+
/* @__PURE__ */ Z(l, {
|
|
2050
2050
|
onClick: () => n(!1),
|
|
2051
|
-
disabled:
|
|
2051
|
+
disabled: s,
|
|
2052
2052
|
children: "Cancel"
|
|
2053
2053
|
}),
|
|
2054
|
-
/* @__PURE__ */ Z(
|
|
2054
|
+
/* @__PURE__ */ Z(l, {
|
|
2055
2055
|
kind: "primary",
|
|
2056
|
-
icon: Z(
|
|
2056
|
+
icon: Z(s ? u : e.bolt, { size: 13 }),
|
|
2057
2057
|
onClick: a,
|
|
2058
|
-
disabled:
|
|
2059
|
-
children:
|
|
2058
|
+
disabled: s,
|
|
2059
|
+
children: s ? "Executing…" : "Confirm"
|
|
2060
2060
|
})
|
|
2061
2061
|
]
|
|
2062
2062
|
})]
|
|
@@ -2065,7 +2065,7 @@ function Bn({ open: t, onOpenChange: n, actionName: r, message: i, onConfirm: a,
|
|
|
2065
2065
|
//#endregion
|
|
2066
2066
|
//#region src/hooks/useMutations.ts
|
|
2067
2067
|
function Vn(e) {
|
|
2068
|
-
|
|
2068
|
+
g.error(e.message);
|
|
2069
2069
|
}
|
|
2070
2070
|
function Hn(e, t, n = {}) {
|
|
2071
2071
|
e.invalidateQueries({ queryKey: ["entity-data", t] }), e.invalidateQueries({ queryKey: ["entity-count", t] }), n.item && e.invalidateQueries({ queryKey: ["entity-item", t] }), n.children && e.invalidateQueries({ queryKey: [Fn, t] }), n.objectMeta && (e.invalidateQueries({ queryKey: ["object-status", t] }), e.invalidateQueries({ queryKey: ["object-properties", t] }));
|
|
@@ -2073,9 +2073,9 @@ function Hn(e, t, n = {}) {
|
|
|
2073
2073
|
function Un(e) {
|
|
2074
2074
|
let t = Re();
|
|
2075
2075
|
return Ie({
|
|
2076
|
-
mutationFn: (t) =>
|
|
2076
|
+
mutationFn: (t) => re(e, t),
|
|
2077
2077
|
onSuccess: () => {
|
|
2078
|
-
Hn(t, e),
|
|
2078
|
+
Hn(t, e), g.success("Record created");
|
|
2079
2079
|
},
|
|
2080
2080
|
onError: Vn
|
|
2081
2081
|
});
|
|
@@ -2083,13 +2083,13 @@ function Un(e) {
|
|
|
2083
2083
|
function Wn(e) {
|
|
2084
2084
|
let t = Re();
|
|
2085
2085
|
return Ie({
|
|
2086
|
-
mutationFn: ({ pkValues: t, data: n }) =>
|
|
2086
|
+
mutationFn: ({ pkValues: t, data: n }) => M(e, t, n),
|
|
2087
2087
|
onSuccess: () => {
|
|
2088
2088
|
Hn(t, e, {
|
|
2089
2089
|
item: !0,
|
|
2090
2090
|
children: !0,
|
|
2091
2091
|
objectMeta: !0
|
|
2092
|
-
}),
|
|
2092
|
+
}), g.success("Record updated");
|
|
2093
2093
|
},
|
|
2094
2094
|
onError: Vn
|
|
2095
2095
|
});
|
|
@@ -2097,9 +2097,9 @@ function Wn(e) {
|
|
|
2097
2097
|
function Gn(e) {
|
|
2098
2098
|
let t = Re();
|
|
2099
2099
|
return Ie({
|
|
2100
|
-
mutationFn: (t) =>
|
|
2100
|
+
mutationFn: (t) => P(e, t),
|
|
2101
2101
|
onSuccess: () => {
|
|
2102
|
-
Hn(t, e, { item: !0 }),
|
|
2102
|
+
Hn(t, e, { item: !0 }), g.success("Record deleted");
|
|
2103
2103
|
},
|
|
2104
2104
|
onError: Vn
|
|
2105
2105
|
});
|
|
@@ -2107,12 +2107,12 @@ function Gn(e) {
|
|
|
2107
2107
|
function Kn(e) {
|
|
2108
2108
|
let t = Re();
|
|
2109
2109
|
return Ie({
|
|
2110
|
-
mutationFn: (t) =>
|
|
2110
|
+
mutationFn: (t) => w(e, t),
|
|
2111
2111
|
onSuccess: () => {
|
|
2112
2112
|
Hn(t, e, {
|
|
2113
2113
|
item: !0,
|
|
2114
2114
|
objectMeta: !0
|
|
2115
|
-
}),
|
|
2115
|
+
}), g.success("Record restored");
|
|
2116
2116
|
},
|
|
2117
2117
|
onError: Vn
|
|
2118
2118
|
});
|
|
@@ -2121,7 +2121,7 @@ function qn(e) {
|
|
|
2121
2121
|
let t = Re();
|
|
2122
2122
|
return Ie({
|
|
2123
2123
|
mutationFn: async ({ actionCode: e, body: t }) => {
|
|
2124
|
-
let n = await
|
|
2124
|
+
let n = await te(e, t);
|
|
2125
2125
|
if (n.status === "error") throw Error("Action failed for all items");
|
|
2126
2126
|
return n;
|
|
2127
2127
|
},
|
|
@@ -2130,7 +2130,7 @@ function qn(e) {
|
|
|
2130
2130
|
item: !0,
|
|
2131
2131
|
children: !0,
|
|
2132
2132
|
objectMeta: !0
|
|
2133
|
-
}), n.status === "accepted" ?
|
|
2133
|
+
}), n.status === "accepted" ? g.success("Action started - check audit for progress") : n.status === "partial" ? g.warning("Action partially completed - some items failed or were skipped") : g.success("Action executed");
|
|
2134
2134
|
},
|
|
2135
2135
|
onError: Vn
|
|
2136
2136
|
});
|
|
@@ -2146,10 +2146,10 @@ var Jn = {
|
|
|
2146
2146
|
function Yn(e, t) {
|
|
2147
2147
|
if (!e) return "";
|
|
2148
2148
|
if (t) try {
|
|
2149
|
-
return
|
|
2149
|
+
return H(t, V(t, e));
|
|
2150
2150
|
} catch {}
|
|
2151
2151
|
let n = e.id;
|
|
2152
|
-
return typeof n == "string" ? n : n == null ? "" :
|
|
2152
|
+
return typeof n == "string" ? n : n == null ? "" : x(n);
|
|
2153
2153
|
}
|
|
2154
2154
|
function Xn(e, t) {
|
|
2155
2155
|
if (!e || e.length === 0) return !0;
|
|
@@ -2165,10 +2165,10 @@ function Xn(e, t) {
|
|
|
2165
2165
|
function Zn(e, t) {
|
|
2166
2166
|
let n = Qn(t, e.field), r = e.op || "eq";
|
|
2167
2167
|
if (r === "in" || r === "not_in") {
|
|
2168
|
-
let t = Array.isArray(e.value) ? e.value : [e.value], i =
|
|
2168
|
+
let t = Array.isArray(e.value) ? e.value : [e.value], i = x(n), a = t.some((e) => x(e) === i);
|
|
2169
2169
|
return r === "in" ? a : !a;
|
|
2170
2170
|
}
|
|
2171
|
-
return typeof e.value == "boolean" && r === "eq" ? er(n) === e.value : typeof n == "number" && typeof e.value == "number" ? tr(n, e.value, r) : tr(
|
|
2171
|
+
return typeof e.value == "boolean" && r === "eq" ? er(n) === e.value : typeof n == "number" && typeof e.value == "number" ? tr(n, e.value, r) : tr(x(n), x(e.value), r);
|
|
2172
2172
|
}
|
|
2173
2173
|
function Qn(e, t) {
|
|
2174
2174
|
if (Object.prototype.hasOwnProperty.call(e, t)) return e[t];
|
|
@@ -2232,7 +2232,7 @@ function rr(e, t, n, r) {
|
|
|
2232
2232
|
function ir(e, t) {
|
|
2233
2233
|
return e.filter(({ code: e }) => {
|
|
2234
2234
|
let n = Jn[e];
|
|
2235
|
-
return !n ||
|
|
2235
|
+
return !n || y(t, n);
|
|
2236
2236
|
});
|
|
2237
2237
|
}
|
|
2238
2238
|
function ar(e) {
|
|
@@ -2241,7 +2241,7 @@ function ar(e) {
|
|
|
2241
2241
|
}
|
|
2242
2242
|
function or(e, t, n, r) {
|
|
2243
2243
|
if (n && r) return r;
|
|
2244
|
-
let i =
|
|
2244
|
+
let i = W(e?.display?.description);
|
|
2245
2245
|
return i ? e?.display?.icon_only === !0 ? `${t} - ${i}` : i : t;
|
|
2246
2246
|
}
|
|
2247
2247
|
function sr(e) {
|
|
@@ -2405,185 +2405,185 @@ function Cr(e, t) {
|
|
|
2405
2405
|
}
|
|
2406
2406
|
//#endregion
|
|
2407
2407
|
//#region src/components/shared/ActionButton.tsx
|
|
2408
|
-
function wr({ actionCode: n, action: r, entityCode: i, objectIds: a = [], row:
|
|
2409
|
-
let [
|
|
2408
|
+
function wr({ actionCode: n, action: r, entityCode: i, objectIds: a = [], row: s, variant: c = "outline", size: u = "default", onSuccess: d, onBatchStart: f, onBatchError: p, onBatchPartial: m }) {
|
|
2409
|
+
let [h, _] = Y(!1), [y, b] = Y(!1), [x, S] = Y(!1), [C, w] = Y(null), T = qn(i), { data: D } = A(), O = It(), k = sr(r), j = ar(r), M = !!r.confirmation && Object.keys(r.confirmation).length > 0, N = s ? Xn(r.conditions, s) : !0, P = G(async () => {
|
|
2410
2410
|
if (!(!r.association || a.length === 0)) {
|
|
2411
|
-
|
|
2411
|
+
S(!0);
|
|
2412
2412
|
try {
|
|
2413
|
-
let e = await
|
|
2413
|
+
let e = await ae(i ? `${i}.${r.association}` : r.association, a), t = cr(D, e.target_entity);
|
|
2414
2414
|
if (!t) {
|
|
2415
|
-
|
|
2415
|
+
g.error(`No list screen found for ${e.target_entity}`);
|
|
2416
2416
|
return;
|
|
2417
2417
|
}
|
|
2418
|
-
let n =
|
|
2418
|
+
let n = D?.entities[e.target_entity], o = W(r.display?.name) || e.target_entity;
|
|
2419
2419
|
if (e.ids.length === 0) {
|
|
2420
|
-
|
|
2420
|
+
g.info(`No related ${o} found`);
|
|
2421
2421
|
return;
|
|
2422
2422
|
}
|
|
2423
2423
|
let s = n?.fields.names().find((e) => n.fields.get(e)?.primary) ?? "id", c = new URLSearchParams();
|
|
2424
|
-
c.set(`filter_${s}`, e.ids.join(",")),
|
|
2424
|
+
c.set(`filter_${s}`, e.ids.join(",")), O(t.route, {
|
|
2425
2425
|
title: o,
|
|
2426
2426
|
icon: r.display?.icon || t.icon,
|
|
2427
2427
|
search: c.toString()
|
|
2428
|
-
}),
|
|
2428
|
+
}), d?.();
|
|
2429
2429
|
} catch (e) {
|
|
2430
|
-
|
|
2430
|
+
g.error(e instanceof Error ? e.message : "Failed to resolve association");
|
|
2431
2431
|
} finally {
|
|
2432
|
-
|
|
2432
|
+
S(!1);
|
|
2433
2433
|
}
|
|
2434
2434
|
}
|
|
2435
2435
|
}, [
|
|
2436
2436
|
r,
|
|
2437
2437
|
i,
|
|
2438
2438
|
a,
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
]),
|
|
2439
|
+
D,
|
|
2440
|
+
O,
|
|
2441
|
+
d
|
|
2442
|
+
]), F = r.entity ? `${r.entity}.${n}` : n, I = a.length > 0 ? a : void 0, L = r.resolved_hidden_defaults && Object.keys(r.resolved_hidden_defaults).length > 0 ? r.resolved_hidden_defaults : void 0, R = G((e, t) => {
|
|
2443
2443
|
if (t?.(), e.status === "accepted") {
|
|
2444
|
-
|
|
2444
|
+
d?.();
|
|
2445
2445
|
return;
|
|
2446
2446
|
}
|
|
2447
2447
|
let n = e.result?.$display;
|
|
2448
2448
|
if (n) {
|
|
2449
|
-
|
|
2449
|
+
w(n);
|
|
2450
2450
|
return;
|
|
2451
2451
|
}
|
|
2452
|
-
e.status === "partial" ?
|
|
2452
|
+
e.status === "partial" ? m?.(a.length, e.success) : d?.();
|
|
2453
2453
|
}, [
|
|
2454
2454
|
a.length,
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
]),
|
|
2458
|
-
if (
|
|
2459
|
-
|
|
2455
|
+
d,
|
|
2456
|
+
m
|
|
2457
|
+
]), z = G(() => {
|
|
2458
|
+
if (ne(r)) {
|
|
2459
|
+
E(r.ui_steps, { row: s }).then(() => d?.());
|
|
2460
2460
|
return;
|
|
2461
2461
|
}
|
|
2462
|
-
if (
|
|
2463
|
-
|
|
2462
|
+
if (k) {
|
|
2463
|
+
P();
|
|
2464
2464
|
return;
|
|
2465
2465
|
}
|
|
2466
2466
|
if (r.href && !r.handler && !r.association) {
|
|
2467
|
-
let e = Yn(
|
|
2468
|
-
i && (t = t.replaceAll("${entity}", i)), e && (t = t.replaceAll("${id}", encodeURIComponent(e))),
|
|
2469
|
-
title:
|
|
2467
|
+
let e = Yn(s, i ? D?.entities[i] : void 0), t = r.href;
|
|
2468
|
+
i && (t = t.replaceAll("${entity}", i)), e && (t = t.replaceAll("${id}", encodeURIComponent(e))), O(t, {
|
|
2469
|
+
title: W(r.display?.name) || n,
|
|
2470
2470
|
icon: r.display?.icon
|
|
2471
|
-
}),
|
|
2471
|
+
}), d?.();
|
|
2472
2472
|
return;
|
|
2473
2473
|
}
|
|
2474
|
-
|
|
2475
|
-
actionCode:
|
|
2476
|
-
body:
|
|
2474
|
+
j ? _(!0) : M ? b(!0) : (f?.(a.length), T.mutate({
|
|
2475
|
+
actionCode: F,
|
|
2476
|
+
body: B(L, I)
|
|
2477
2477
|
}, {
|
|
2478
|
-
onSuccess: (e) =>
|
|
2479
|
-
onError: () =>
|
|
2478
|
+
onSuccess: (e) => R(e),
|
|
2479
|
+
onError: () => p?.(a.length)
|
|
2480
2480
|
}));
|
|
2481
2481
|
}, [
|
|
2482
2482
|
r,
|
|
2483
|
-
|
|
2483
|
+
s,
|
|
2484
2484
|
i,
|
|
2485
|
-
|
|
2485
|
+
D?.entities,
|
|
2486
2486
|
n,
|
|
2487
|
+
O,
|
|
2488
|
+
k,
|
|
2487
2489
|
j,
|
|
2488
2490
|
M,
|
|
2489
|
-
|
|
2490
|
-
P,
|
|
2491
|
-
ee,
|
|
2492
|
-
R,
|
|
2493
|
-
a,
|
|
2494
|
-
te,
|
|
2495
|
-
k,
|
|
2496
|
-
z,
|
|
2491
|
+
F,
|
|
2497
2492
|
I,
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2493
|
+
a,
|
|
2494
|
+
L,
|
|
2495
|
+
T,
|
|
2496
|
+
R,
|
|
2497
|
+
P,
|
|
2498
|
+
f,
|
|
2499
|
+
p,
|
|
2500
|
+
d
|
|
2501
|
+
]), V = G(() => {
|
|
2502
|
+
f?.(a.length), T.mutate({
|
|
2503
|
+
actionCode: F,
|
|
2504
|
+
body: B(L, I)
|
|
2505
2505
|
}, {
|
|
2506
|
-
onSuccess: (e) =>
|
|
2507
|
-
onError: () =>
|
|
2506
|
+
onSuccess: (e) => R(e, () => b(!1)),
|
|
2507
|
+
onError: () => p?.(a.length)
|
|
2508
2508
|
});
|
|
2509
2509
|
}, [
|
|
2510
|
-
|
|
2511
|
-
|
|
2510
|
+
F,
|
|
2511
|
+
I,
|
|
2512
2512
|
a,
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
]),
|
|
2519
|
-
|
|
2520
|
-
actionCode:
|
|
2521
|
-
body:
|
|
2513
|
+
L,
|
|
2514
|
+
T,
|
|
2515
|
+
R,
|
|
2516
|
+
f,
|
|
2517
|
+
p
|
|
2518
|
+
]), te = G((e) => {
|
|
2519
|
+
f?.(a.length), T.mutate({
|
|
2520
|
+
actionCode: F,
|
|
2521
|
+
body: B(e, I)
|
|
2522
2522
|
}, {
|
|
2523
|
-
onSuccess: (e) =>
|
|
2524
|
-
onError: () =>
|
|
2523
|
+
onSuccess: (e) => R(e, () => _(!1)),
|
|
2524
|
+
onError: () => p?.(a.length)
|
|
2525
2525
|
});
|
|
2526
2526
|
}, [
|
|
2527
|
-
|
|
2528
|
-
|
|
2527
|
+
F,
|
|
2528
|
+
I,
|
|
2529
2529
|
a,
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
]),
|
|
2535
|
-
name:
|
|
2530
|
+
T,
|
|
2531
|
+
R,
|
|
2532
|
+
f,
|
|
2533
|
+
p
|
|
2534
|
+
]), H = W(r.display?.name), U = r.display?.icon, re = U && e[U], ie = re ? /* @__PURE__ */ Z(re, { size: 13 }) : U ? /* @__PURE__ */ Z(t, {
|
|
2535
|
+
name: U,
|
|
2536
2536
|
size: 13
|
|
2537
|
-
}) : null,
|
|
2537
|
+
}) : null, oe = !N || T.isPending || x;
|
|
2538
2538
|
return /* @__PURE__ */ Q(X, { children: [
|
|
2539
|
-
|
|
2540
|
-
icon:
|
|
2541
|
-
onClick:
|
|
2542
|
-
title:
|
|
2543
|
-
}) : /* @__PURE__ */ Z(
|
|
2544
|
-
kind:
|
|
2539
|
+
u === "icon" ? /* @__PURE__ */ Z(o, {
|
|
2540
|
+
icon: ie ?? /* @__PURE__ */ Z(e.bolt, { size: 13 }),
|
|
2541
|
+
onClick: z,
|
|
2542
|
+
title: H
|
|
2543
|
+
}) : /* @__PURE__ */ Z(l, {
|
|
2544
|
+
kind: c === "default" ? "primary" : c === "ghost" ? "ghost" : "default",
|
|
2545
2545
|
size: "sm",
|
|
2546
|
-
icon:
|
|
2546
|
+
icon: ie,
|
|
2547
2547
|
danger: r.destructive,
|
|
2548
|
-
onClick:
|
|
2549
|
-
disabled:
|
|
2550
|
-
title:
|
|
2551
|
-
"aria-label":
|
|
2552
|
-
children:
|
|
2548
|
+
onClick: z,
|
|
2549
|
+
disabled: oe,
|
|
2550
|
+
title: H,
|
|
2551
|
+
"aria-label": H,
|
|
2552
|
+
children: H
|
|
2553
2553
|
}),
|
|
2554
|
-
|
|
2555
|
-
open:
|
|
2556
|
-
onOpenChange:
|
|
2554
|
+
j && /* @__PURE__ */ Z(ee, {
|
|
2555
|
+
open: h,
|
|
2556
|
+
onOpenChange: _,
|
|
2557
2557
|
action: r,
|
|
2558
|
-
actionName:
|
|
2559
|
-
onSubmit:
|
|
2560
|
-
isPending:
|
|
2561
|
-
row:
|
|
2558
|
+
actionName: H,
|
|
2559
|
+
onSubmit: te,
|
|
2560
|
+
isPending: T.isPending,
|
|
2561
|
+
row: s
|
|
2562
2562
|
}),
|
|
2563
|
-
|
|
2564
|
-
open:
|
|
2565
|
-
onOpenChange:
|
|
2566
|
-
actionName:
|
|
2567
|
-
message:
|
|
2568
|
-
onConfirm:
|
|
2569
|
-
isPending:
|
|
2563
|
+
M && /* @__PURE__ */ Z(Bn, {
|
|
2564
|
+
open: y,
|
|
2565
|
+
onOpenChange: b,
|
|
2566
|
+
actionName: H,
|
|
2567
|
+
message: W(r.confirmation),
|
|
2568
|
+
onConfirm: V,
|
|
2569
|
+
isPending: T.isPending
|
|
2570
2570
|
}),
|
|
2571
|
-
|
|
2572
|
-
open: !!
|
|
2571
|
+
C && /* @__PURE__ */ Z(v, {
|
|
2572
|
+
open: !!C,
|
|
2573
2573
|
onClose: () => {
|
|
2574
|
-
|
|
2574
|
+
w(null), d?.();
|
|
2575
2575
|
},
|
|
2576
|
-
display:
|
|
2576
|
+
display: C
|
|
2577
2577
|
})
|
|
2578
2578
|
] });
|
|
2579
2579
|
}
|
|
2580
2580
|
//#endregion
|
|
2581
2581
|
//#region src/components/shared/RowActionsKebab.tsx
|
|
2582
|
-
function Tr({ actions: t, objectIds:
|
|
2583
|
-
let d = J(null), [f,
|
|
2584
|
-
if (!
|
|
2582
|
+
function Tr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divider: c, size: l = 22, align: u = "end" }) {
|
|
2583
|
+
let d = J(null), [f, m] = Y(!1), { run: h } = N();
|
|
2584
|
+
if (!a && t.length === 0) return null;
|
|
2585
2585
|
let g = (e) => () => {
|
|
2586
|
-
|
|
2586
|
+
m(!1), e();
|
|
2587
2587
|
};
|
|
2588
2588
|
return /* @__PURE__ */ Q("div", {
|
|
2589
2589
|
className: "sl-row-actions",
|
|
@@ -2593,35 +2593,35 @@ function Tr({ actions: t, objectIds: r, row: i, onSuccess: a, preMenu: o, divide
|
|
|
2593
2593
|
alignItems: "center",
|
|
2594
2594
|
justifyContent: "flex-end"
|
|
2595
2595
|
},
|
|
2596
|
-
children: [/* @__PURE__ */ Z(
|
|
2596
|
+
children: [/* @__PURE__ */ Z(o, {
|
|
2597
2597
|
ref: d,
|
|
2598
|
-
size:
|
|
2599
|
-
icon: /* @__PURE__ */ Z(e.more, { size: Math.round(
|
|
2600
|
-
onClick: () =>
|
|
2598
|
+
size: l,
|
|
2599
|
+
icon: /* @__PURE__ */ Z(e.more, { size: Math.round(l * .55) }),
|
|
2600
|
+
onClick: () => m((e) => !e),
|
|
2601
2601
|
title: "Actions"
|
|
2602
|
-
}), /* @__PURE__ */ Q(
|
|
2602
|
+
}), /* @__PURE__ */ Q(s, {
|
|
2603
2603
|
open: f,
|
|
2604
2604
|
anchor: d.current,
|
|
2605
|
-
onClose: () =>
|
|
2605
|
+
onClose: () => m(!1),
|
|
2606
2606
|
width: 200,
|
|
2607
|
-
align:
|
|
2607
|
+
align: u,
|
|
2608
2608
|
children: [
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
t.map(({ code: t, action:
|
|
2612
|
-
let o =
|
|
2613
|
-
return /* @__PURE__ */ Z(
|
|
2609
|
+
a,
|
|
2610
|
+
a && c && t.length > 0 && /* @__PURE__ */ Z(p, { divider: !0 }),
|
|
2611
|
+
t.map(({ code: t, action: a }) => {
|
|
2612
|
+
let o = r ? Xn(a.conditions, r) : !0, s = W(a.display?.name) || t, c = a.display?.icon, l = c && e[c] ? e[c] : void 0;
|
|
2613
|
+
return /* @__PURE__ */ Z(p, {
|
|
2614
2614
|
icon: l ? /* @__PURE__ */ Z(l, { size: 12 }) : null,
|
|
2615
|
-
danger:
|
|
2615
|
+
danger: a.destructive,
|
|
2616
2616
|
onClick: g(() => {
|
|
2617
2617
|
if (!o) return;
|
|
2618
|
-
let e =
|
|
2618
|
+
let e = a.entity ? `${a.entity}.${t}` : t;
|
|
2619
2619
|
h({
|
|
2620
|
-
action:
|
|
2620
|
+
action: a,
|
|
2621
2621
|
title: s,
|
|
2622
2622
|
execute: async (t) => {
|
|
2623
|
-
let
|
|
2624
|
-
return
|
|
2623
|
+
let r = await te(e, B(t, n));
|
|
2624
|
+
return i?.(), r;
|
|
2625
2625
|
}
|
|
2626
2626
|
});
|
|
2627
2627
|
}),
|
|
@@ -2634,47 +2634,47 @@ function Tr({ actions: t, objectIds: r, row: i, onSuccess: a, preMenu: o, divide
|
|
|
2634
2634
|
}
|
|
2635
2635
|
//#endregion
|
|
2636
2636
|
//#region src/components/detail-layout/AssociatedToolbar.tsx
|
|
2637
|
-
function Er({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearchChange: a, filters:
|
|
2638
|
-
let
|
|
2639
|
-
return !
|
|
2637
|
+
function Er({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearchChange: a, filters: o, onFilterChange: s, allEntities: c }) {
|
|
2638
|
+
let l = n === !0, u = r && r.length > 0;
|
|
2639
|
+
return !l && !u ? null : /* @__PURE__ */ Q("div", {
|
|
2640
2640
|
style: {
|
|
2641
2641
|
display: "flex",
|
|
2642
2642
|
alignItems: "center",
|
|
2643
2643
|
gap: 6,
|
|
2644
2644
|
marginBottom: 8
|
|
2645
2645
|
},
|
|
2646
|
-
children: [
|
|
2646
|
+
children: [l && /* @__PURE__ */ Z("div", {
|
|
2647
2647
|
style: {
|
|
2648
2648
|
flex: 1,
|
|
2649
2649
|
maxWidth: 220
|
|
2650
2650
|
},
|
|
2651
|
-
children: /* @__PURE__ */ Z(
|
|
2651
|
+
children: /* @__PURE__ */ Z(I, {
|
|
2652
2652
|
value: i,
|
|
2653
2653
|
onChange: a,
|
|
2654
2654
|
placeholder: "Search…",
|
|
2655
2655
|
prefix: /* @__PURE__ */ Z(e.search, { size: 12 })
|
|
2656
2656
|
})
|
|
2657
|
-
}),
|
|
2657
|
+
}), u && r.map((e) => {
|
|
2658
2658
|
let n = t.fields.get(e);
|
|
2659
2659
|
if (!n) return null;
|
|
2660
|
-
let r =
|
|
2660
|
+
let r = o[e] ?? "__all__", i = ie(n, e, c);
|
|
2661
2661
|
return n.type === "ref" && n.ref?.entity ? /* @__PURE__ */ Z(Dr, {
|
|
2662
2662
|
field: n,
|
|
2663
2663
|
label: i,
|
|
2664
2664
|
value: r,
|
|
2665
|
-
onChange: (t) =>
|
|
2665
|
+
onChange: (t) => s(e, t)
|
|
2666
2666
|
}, e) : n.values ? /* @__PURE__ */ Z("div", {
|
|
2667
2667
|
style: { width: 160 },
|
|
2668
|
-
children: /* @__PURE__ */ Z(
|
|
2668
|
+
children: /* @__PURE__ */ Z(f, {
|
|
2669
2669
|
value: r,
|
|
2670
2670
|
options: [{
|
|
2671
2671
|
value: "__all__",
|
|
2672
2672
|
label: `All ${i}`
|
|
2673
2673
|
}, ...n.values.map((e) => ({
|
|
2674
2674
|
value: e.code,
|
|
2675
|
-
label:
|
|
2675
|
+
label: W(e.name) || e.code
|
|
2676
2676
|
}))],
|
|
2677
|
-
onChange: (t) =>
|
|
2677
|
+
onChange: (t) => s(e, t),
|
|
2678
2678
|
placeholder: i
|
|
2679
2679
|
})
|
|
2680
2680
|
}, e) : null;
|
|
@@ -2682,29 +2682,29 @@ function Er({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearc
|
|
|
2682
2682
|
});
|
|
2683
2683
|
}
|
|
2684
2684
|
function Dr({ field: e, label: t, value: n, onChange: r }) {
|
|
2685
|
-
let i =
|
|
2685
|
+
let i = F(e.ref?.entity), o = e.display?.ref_display_field ?? i?.display?.display_field, s = q(() => i ? [...i.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [i]), { data: c } = a(e.ref?.entity, {
|
|
2686
2686
|
per_page: 200,
|
|
2687
|
-
sort:
|
|
2687
|
+
sort: o ? `${o}:asc` : void 0
|
|
2688
2688
|
}), l = c?.data ?? [], u = (e) => {
|
|
2689
2689
|
if (e == null) return "—";
|
|
2690
2690
|
if (typeof e == "object" && !Array.isArray(e)) {
|
|
2691
2691
|
let t = Object.values(e)[0];
|
|
2692
|
-
return t == null ? "—" :
|
|
2692
|
+
return t == null ? "—" : x(t);
|
|
2693
2693
|
}
|
|
2694
|
-
return
|
|
2694
|
+
return x(e);
|
|
2695
2695
|
};
|
|
2696
2696
|
return /* @__PURE__ */ Z("div", {
|
|
2697
2697
|
style: { width: 160 },
|
|
2698
|
-
children: /* @__PURE__ */ Z(
|
|
2698
|
+
children: /* @__PURE__ */ Z(f, {
|
|
2699
2699
|
value: n,
|
|
2700
2700
|
options: [{
|
|
2701
2701
|
value: "__all__",
|
|
2702
2702
|
label: `All ${t}`
|
|
2703
2703
|
}, ...l.map((e) => {
|
|
2704
|
-
let t = String(e[s]), n = e[
|
|
2704
|
+
let t = String(e[s]), n = e[T];
|
|
2705
2705
|
return {
|
|
2706
2706
|
value: t,
|
|
2707
|
-
label: typeof n == "string" && n !== "" ? n :
|
|
2707
|
+
label: typeof n == "string" && n !== "" ? n : o ? u(e[o] ?? t) : t
|
|
2708
2708
|
};
|
|
2709
2709
|
})],
|
|
2710
2710
|
onChange: r,
|
|
@@ -2783,7 +2783,7 @@ function Pr(e, t, n) {
|
|
|
2783
2783
|
if (n && e in n) return n[e];
|
|
2784
2784
|
}
|
|
2785
2785
|
function Fr(e, t, n) {
|
|
2786
|
-
return
|
|
2786
|
+
return W(Pr(e, t, n)?.display?.name) || e;
|
|
2787
2787
|
}
|
|
2788
2788
|
function Ir(e, t, n) {
|
|
2789
2789
|
return Pr(e, t, n)?.display?.icon || void 0;
|
|
@@ -2791,32 +2791,32 @@ function Ir(e, t, n) {
|
|
|
2791
2791
|
function Lr(e) {
|
|
2792
2792
|
return `action-tooltip-${e}`;
|
|
2793
2793
|
}
|
|
2794
|
-
function Rr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a, onLoadingChange: o, measureRef: s, style: c, row:
|
|
2795
|
-
let
|
|
2796
|
-
if (!(!
|
|
2794
|
+
function Rr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a, onLoadingChange: o, measureRef: s, style: c, row: d, widgetContext: f, onActionClick: p }) {
|
|
2795
|
+
let m = Pr(e.code, n, r), h = Fr(e.code, n, r), g = Ir(e.code, n, r), _ = m?.destructive ?? !1, v = !_ && m?.display?.primary === !0, y = !e.enabled, b = y ? Lr(e.code) : void 0, x = G(async () => {
|
|
2796
|
+
if (!(!m || y || a)) {
|
|
2797
2797
|
o(!0);
|
|
2798
2798
|
try {
|
|
2799
|
-
Ar(e.code,
|
|
2799
|
+
Ar(e.code, m, d, f, p) || await Promise.resolve(i(e.code, m));
|
|
2800
2800
|
} finally {
|
|
2801
2801
|
o(!1);
|
|
2802
2802
|
}
|
|
2803
2803
|
}
|
|
2804
2804
|
}, [
|
|
2805
|
-
|
|
2806
|
-
|
|
2805
|
+
m,
|
|
2806
|
+
y,
|
|
2807
2807
|
a,
|
|
2808
2808
|
i,
|
|
2809
2809
|
e.code,
|
|
2810
2810
|
o,
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
]),
|
|
2815
|
-
name:
|
|
2811
|
+
d,
|
|
2812
|
+
f,
|
|
2813
|
+
p
|
|
2814
|
+
]), S = a ? /* @__PURE__ */ Z(u, { size: 12 }) : g ? /* @__PURE__ */ Z(t, {
|
|
2815
|
+
name: g,
|
|
2816
2816
|
size: 12
|
|
2817
2817
|
}) : null;
|
|
2818
|
-
return /* @__PURE__ */ Q(X, { children: [
|
|
2819
|
-
id:
|
|
2818
|
+
return /* @__PURE__ */ Q(X, { children: [b && e.reason && /* @__PURE__ */ Z("span", {
|
|
2819
|
+
id: b,
|
|
2820
2820
|
role: "tooltip",
|
|
2821
2821
|
style: {
|
|
2822
2822
|
position: "absolute",
|
|
@@ -2826,72 +2826,72 @@ function Rr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
|
|
|
2826
2826
|
clip: "rect(0,0,0,0)"
|
|
2827
2827
|
},
|
|
2828
2828
|
children: e.reason
|
|
2829
|
-
}), /* @__PURE__ */ Z(
|
|
2829
|
+
}), /* @__PURE__ */ Z(l, {
|
|
2830
2830
|
ref: s,
|
|
2831
|
-
kind:
|
|
2832
|
-
danger:
|
|
2833
|
-
icon:
|
|
2834
|
-
disabled:
|
|
2835
|
-
"aria-disabled":
|
|
2836
|
-
"aria-describedby":
|
|
2837
|
-
title: or(
|
|
2838
|
-
onClick:
|
|
2831
|
+
kind: v ? "primary" : "default",
|
|
2832
|
+
danger: _,
|
|
2833
|
+
icon: S,
|
|
2834
|
+
disabled: y || a,
|
|
2835
|
+
"aria-disabled": y ? "true" : void 0,
|
|
2836
|
+
"aria-describedby": b,
|
|
2837
|
+
title: or(m, h, y, e.reason),
|
|
2838
|
+
onClick: x,
|
|
2839
2839
|
style: c,
|
|
2840
|
-
children:
|
|
2840
|
+
children: h
|
|
2841
2841
|
})] });
|
|
2842
2842
|
}
|
|
2843
|
-
function zr({ group:
|
|
2844
|
-
let
|
|
2845
|
-
|
|
2846
|
-
}, [
|
|
2847
|
-
return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(
|
|
2848
|
-
ref:
|
|
2843
|
+
function zr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o, onLoadingChange: c, measureRef: d, style: f }) {
|
|
2844
|
+
let p = J(null), [m, h] = Y(!1), g = n.name ? W(n.name) : "Actions", _ = G((e) => {
|
|
2845
|
+
p.current = e, d?.(e);
|
|
2846
|
+
}, [d]), v = G((e, t) => (h(!1), a(e, t)), [a]);
|
|
2847
|
+
return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(l, {
|
|
2848
|
+
ref: _,
|
|
2849
2849
|
kind: "default",
|
|
2850
|
-
icon:
|
|
2851
|
-
name:
|
|
2850
|
+
icon: o == null ? n.icon ? /* @__PURE__ */ Z(t, {
|
|
2851
|
+
name: n.icon,
|
|
2852
2852
|
size: 12
|
|
2853
|
-
}) : void 0 : /* @__PURE__ */ Z(
|
|
2853
|
+
}) : void 0 : /* @__PURE__ */ Z(u, { size: 12 }),
|
|
2854
2854
|
iconRight: /* @__PURE__ */ Z(e.down, { size: 10 }),
|
|
2855
2855
|
"aria-haspopup": "menu",
|
|
2856
|
-
"aria-expanded":
|
|
2857
|
-
title:
|
|
2858
|
-
onClick: () =>
|
|
2859
|
-
style:
|
|
2860
|
-
children:
|
|
2861
|
-
}), /* @__PURE__ */ Z(
|
|
2862
|
-
open:
|
|
2863
|
-
anchor:
|
|
2864
|
-
onClose: () =>
|
|
2856
|
+
"aria-expanded": m ? "true" : "false",
|
|
2857
|
+
title: g,
|
|
2858
|
+
onClick: () => h((e) => !e),
|
|
2859
|
+
style: f,
|
|
2860
|
+
children: g
|
|
2861
|
+
}), /* @__PURE__ */ Z(s, {
|
|
2862
|
+
open: m,
|
|
2863
|
+
anchor: p.current,
|
|
2864
|
+
onClose: () => h(!1),
|
|
2865
2865
|
align: "start",
|
|
2866
2866
|
width: 200,
|
|
2867
2867
|
children: /* @__PURE__ */ Z("div", {
|
|
2868
2868
|
role: "menu",
|
|
2869
|
-
"aria-label":
|
|
2870
|
-
children:
|
|
2869
|
+
"aria-label": g,
|
|
2870
|
+
children: n.items.map((e) => e.kind === "action" ? /* @__PURE__ */ Z(Br, {
|
|
2871
2871
|
leaf: e,
|
|
2872
|
-
entityActions:
|
|
2873
|
-
globalActions:
|
|
2874
|
-
onRun:
|
|
2875
|
-
loading:
|
|
2872
|
+
entityActions: r,
|
|
2873
|
+
globalActions: i,
|
|
2874
|
+
onRun: v,
|
|
2875
|
+
loading: o === e.code,
|
|
2876
2876
|
onLoadingChange: (t) => c(t ? e.code : null)
|
|
2877
2877
|
}, e.code) : /* @__PURE__ */ Z(Vr, {
|
|
2878
2878
|
group: e,
|
|
2879
|
-
entityActions:
|
|
2880
|
-
globalActions:
|
|
2881
|
-
onRun:
|
|
2882
|
-
loading:
|
|
2879
|
+
entityActions: r,
|
|
2880
|
+
globalActions: i,
|
|
2881
|
+
onRun: v,
|
|
2882
|
+
loading: o,
|
|
2883
2883
|
onLoadingChange: c
|
|
2884
2884
|
}, e.items[0]?.kind === "action" ? e.items[0].code : e.icon ?? "group"))
|
|
2885
2885
|
})
|
|
2886
2886
|
})] });
|
|
2887
2887
|
}
|
|
2888
2888
|
function Br({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a, onLoadingChange: o, row: s, widgetContext: c, onActionClick: l }) {
|
|
2889
|
-
let
|
|
2890
|
-
name:
|
|
2889
|
+
let d = Pr(e.code, n, r), f = Fr(e.code, n, r), p = Ir(e.code, n, r), m = d?.destructive ?? !1, h = !e.enabled, g = h ? Lr(e.code) : void 0, _ = a ? /* @__PURE__ */ Z(u, { size: 12 }) : p ? /* @__PURE__ */ Z(t, {
|
|
2890
|
+
name: p,
|
|
2891
2891
|
size: 12
|
|
2892
2892
|
}) : null;
|
|
2893
|
-
return /* @__PURE__ */ Q(X, { children: [
|
|
2894
|
-
id:
|
|
2893
|
+
return /* @__PURE__ */ Q(X, { children: [g && e.reason && /* @__PURE__ */ Z("span", {
|
|
2894
|
+
id: g,
|
|
2895
2895
|
role: "tooltip",
|
|
2896
2896
|
style: {
|
|
2897
2897
|
position: "absolute",
|
|
@@ -2903,14 +2903,14 @@ function Br({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
|
|
|
2903
2903
|
children: e.reason
|
|
2904
2904
|
}), /* @__PURE__ */ Q("div", {
|
|
2905
2905
|
role: "menuitem",
|
|
2906
|
-
"aria-disabled":
|
|
2907
|
-
"aria-describedby":
|
|
2908
|
-
title: or(
|
|
2906
|
+
"aria-disabled": h ? "true" : void 0,
|
|
2907
|
+
"aria-describedby": g,
|
|
2908
|
+
title: or(d, f, h, e.reason),
|
|
2909
2909
|
onClick: async () => {
|
|
2910
|
-
if (!(!
|
|
2910
|
+
if (!(!d || h || a)) {
|
|
2911
2911
|
o(!0);
|
|
2912
2912
|
try {
|
|
2913
|
-
Ar(e.code,
|
|
2913
|
+
Ar(e.code, d, s, c, l) || await Promise.resolve(i(e.code, d));
|
|
2914
2914
|
} finally {
|
|
2915
2915
|
o(!1);
|
|
2916
2916
|
}
|
|
@@ -2923,30 +2923,30 @@ function Br({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
|
|
|
2923
2923
|
padding: "6px 10px",
|
|
2924
2924
|
borderRadius: 5,
|
|
2925
2925
|
fontSize: 12.5,
|
|
2926
|
-
color:
|
|
2927
|
-
cursor:
|
|
2928
|
-
opacity:
|
|
2926
|
+
color: m ? "var(--danger)" : h ? "var(--text-3)" : "var(--text-2)",
|
|
2927
|
+
cursor: h ? "not-allowed" : "pointer",
|
|
2928
|
+
opacity: h ? .6 : 1
|
|
2929
2929
|
},
|
|
2930
2930
|
onMouseEnter: (e) => {
|
|
2931
|
-
|
|
2931
|
+
h || (e.currentTarget.style.background = "var(--surface-3)");
|
|
2932
2932
|
},
|
|
2933
2933
|
onMouseLeave: (e) => {
|
|
2934
2934
|
e.currentTarget.style.background = "transparent";
|
|
2935
2935
|
},
|
|
2936
|
-
children: [
|
|
2936
|
+
children: [_ && /* @__PURE__ */ Z("span", {
|
|
2937
2937
|
style: {
|
|
2938
|
-
color:
|
|
2938
|
+
color: m ? "var(--danger)" : "var(--text-3)",
|
|
2939
2939
|
display: "flex"
|
|
2940
2940
|
},
|
|
2941
|
-
children:
|
|
2941
|
+
children: _
|
|
2942
2942
|
}), /* @__PURE__ */ Z("span", {
|
|
2943
2943
|
style: { flex: 1 },
|
|
2944
|
-
children:
|
|
2944
|
+
children: f
|
|
2945
2945
|
})]
|
|
2946
2946
|
})] });
|
|
2947
2947
|
}
|
|
2948
2948
|
function Vr({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i, onLoadingChange: a, row: o, widgetContext: s, onActionClick: c }) {
|
|
2949
|
-
let l = e.name ?
|
|
2949
|
+
let l = e.name ? W(e.name) : void 0;
|
|
2950
2950
|
return /* @__PURE__ */ Q(X, { children: [l && /* @__PURE__ */ Z("div", {
|
|
2951
2951
|
style: {
|
|
2952
2952
|
padding: "4px 10px 2px",
|
|
@@ -2979,66 +2979,66 @@ function Vr({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i
|
|
|
2979
2979
|
onActionClick: c
|
|
2980
2980
|
}, e.icon ?? "nested"))] });
|
|
2981
2981
|
}
|
|
2982
|
-
function Hr({ layout: t, entityActions:
|
|
2983
|
-
let
|
|
2984
|
-
if (jr(t) === 0 && !
|
|
2985
|
-
let { normal:
|
|
2982
|
+
function Hr({ layout: t, entityActions: n, globalActions: r, onRun: i, trailingNormalItems: a, trailingDestructiveItems: c, row: l, widgetContext: d, onActionClick: f }) {
|
|
2983
|
+
let m = J(null), [h, g] = Y(!1), [_, v] = Y(null), y = G((e, t) => (g(!1), i(e, t)), [i]), b = a != null && a !== !1, x = c != null && c !== !1;
|
|
2984
|
+
if (jr(t) === 0 && !b && !x) return null;
|
|
2985
|
+
let { normal: S, destructive: C } = Mr(t, n, r), w = C.length > 0 || x;
|
|
2986
2986
|
return /* @__PURE__ */ Q("div", {
|
|
2987
2987
|
style: {
|
|
2988
2988
|
display: "inline-flex",
|
|
2989
2989
|
alignItems: "center"
|
|
2990
2990
|
},
|
|
2991
|
-
children: [/* @__PURE__ */ Z(
|
|
2992
|
-
ref:
|
|
2993
|
-
icon: Z(
|
|
2991
|
+
children: [/* @__PURE__ */ Z(o, {
|
|
2992
|
+
ref: m,
|
|
2993
|
+
icon: Z(_ == null ? e.more : u, { size: 14 }),
|
|
2994
2994
|
title: "Actions",
|
|
2995
2995
|
size: 28,
|
|
2996
|
-
onClick: () =>
|
|
2997
|
-
}), /* @__PURE__ */ Z(
|
|
2998
|
-
open:
|
|
2999
|
-
anchor:
|
|
3000
|
-
onClose: () =>
|
|
2996
|
+
onClick: () => g((e) => !e)
|
|
2997
|
+
}), /* @__PURE__ */ Z(s, {
|
|
2998
|
+
open: h,
|
|
2999
|
+
anchor: m.current,
|
|
3000
|
+
onClose: () => g(!1),
|
|
3001
3001
|
align: "end",
|
|
3002
3002
|
width: 220,
|
|
3003
3003
|
children: /* @__PURE__ */ Q("div", {
|
|
3004
3004
|
role: "menu",
|
|
3005
3005
|
"aria-label": "Row actions",
|
|
3006
3006
|
children: [
|
|
3007
|
-
|
|
3007
|
+
S.map((e) => e.kind === "action" ? /* @__PURE__ */ Z(Br, {
|
|
3008
3008
|
leaf: e,
|
|
3009
|
-
entityActions:
|
|
3010
|
-
globalActions:
|
|
3011
|
-
onRun:
|
|
3012
|
-
loading:
|
|
3013
|
-
onLoadingChange: (t) =>
|
|
3014
|
-
row:
|
|
3015
|
-
widgetContext:
|
|
3016
|
-
onActionClick:
|
|
3009
|
+
entityActions: n,
|
|
3010
|
+
globalActions: r,
|
|
3011
|
+
onRun: y,
|
|
3012
|
+
loading: _ === e.code,
|
|
3013
|
+
onLoadingChange: (t) => v(t ? e.code : null),
|
|
3014
|
+
row: l,
|
|
3015
|
+
widgetContext: d,
|
|
3016
|
+
onActionClick: f
|
|
3017
3017
|
}, e.code) : /* @__PURE__ */ Z(Vr, {
|
|
3018
3018
|
group: e,
|
|
3019
|
-
entityActions:
|
|
3020
|
-
globalActions:
|
|
3021
|
-
onRun:
|
|
3022
|
-
loading:
|
|
3023
|
-
onLoadingChange:
|
|
3024
|
-
row:
|
|
3025
|
-
widgetContext:
|
|
3026
|
-
onActionClick:
|
|
3019
|
+
entityActions: n,
|
|
3020
|
+
globalActions: r,
|
|
3021
|
+
onRun: y,
|
|
3022
|
+
loading: _,
|
|
3023
|
+
onLoadingChange: v,
|
|
3024
|
+
row: l,
|
|
3025
|
+
widgetContext: d,
|
|
3026
|
+
onActionClick: f
|
|
3027
3027
|
}, e.icon ?? "group")),
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3028
|
+
b && a,
|
|
3029
|
+
w && /* @__PURE__ */ Z(p, { divider: !0 }),
|
|
3030
|
+
C.map((e) => /* @__PURE__ */ Z(Br, {
|
|
3031
3031
|
leaf: e,
|
|
3032
|
-
entityActions:
|
|
3033
|
-
globalActions:
|
|
3034
|
-
onRun:
|
|
3035
|
-
loading:
|
|
3036
|
-
onLoadingChange: (t) =>
|
|
3037
|
-
row:
|
|
3038
|
-
widgetContext:
|
|
3039
|
-
onActionClick:
|
|
3032
|
+
entityActions: n,
|
|
3033
|
+
globalActions: r,
|
|
3034
|
+
onRun: y,
|
|
3035
|
+
loading: _ === e.code,
|
|
3036
|
+
onLoadingChange: (t) => v(t ? e.code : null),
|
|
3037
|
+
row: l,
|
|
3038
|
+
widgetContext: d,
|
|
3039
|
+
onActionClick: f
|
|
3040
3040
|
}, e.code)),
|
|
3041
|
-
|
|
3041
|
+
x && c
|
|
3042
3042
|
]
|
|
3043
3043
|
})
|
|
3044
3044
|
})]
|
|
@@ -3064,65 +3064,67 @@ function Kr(e, t, n, r, i, a, o) {
|
|
|
3064
3064
|
};
|
|
3065
3065
|
}
|
|
3066
3066
|
function qr(e) {
|
|
3067
|
-
return e.kind === "action" ? `action:${e.code}` : `group:${e.name ?
|
|
3067
|
+
return e.kind === "action" ? `action:${e.code}` : `group:${e.name ? W(e.name) : ""}`;
|
|
3068
3068
|
}
|
|
3069
|
-
function Jr({ layout:
|
|
3070
|
-
let
|
|
3069
|
+
function Jr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedRightWidth: o = 0, measurementOverride: c, ariaLabel: u = "Actions", align: d = "trailing", constrain: f = !0, row: p, widgetContext: m, onActionClick: h }) {
|
|
3070
|
+
let g = J(null), _ = J(null), [v, y] = Y(0), [b, x] = Y(/* @__PURE__ */ new Map()), [S, C] = Y(!1), [w, T] = Y(null), [E, D] = Y(() => typeof document < "u" && document.documentElement.dir === "rtl");
|
|
3071
3071
|
K(() => {
|
|
3072
3072
|
if (typeof MutationObserver > "u") return;
|
|
3073
3073
|
let e = new MutationObserver((e) => {
|
|
3074
|
-
for (let t of e) t.attributeName === "dir" &&
|
|
3074
|
+
for (let t of e) t.attributeName === "dir" && D(document.documentElement.dir === "rtl"), t.attributeName === "lang" && C(!1);
|
|
3075
3075
|
});
|
|
3076
3076
|
return e.observe(document.documentElement, {
|
|
3077
3077
|
attributes: !0,
|
|
3078
3078
|
attributeFilter: ["dir", "lang"]
|
|
3079
3079
|
}), () => e.disconnect();
|
|
3080
3080
|
}, []);
|
|
3081
|
-
let
|
|
3082
|
-
if (
|
|
3083
|
-
let e = Array.from(
|
|
3081
|
+
let O = J(null), [k, A] = Y(!1), j = G((e, t) => (A(!1), a(e, t)), [a]), M = jr(n), N = !!c, P = G(() => {
|
|
3082
|
+
if (N || !_.current) return;
|
|
3083
|
+
let e = Array.from(_.current.children), t = /* @__PURE__ */ new Map();
|
|
3084
3084
|
e.forEach((e) => {
|
|
3085
3085
|
let n = e.dataset.nodeKey;
|
|
3086
3086
|
n && t.set(n, e.getBoundingClientRect().width || e.offsetWidth);
|
|
3087
|
-
}), x(t),
|
|
3088
|
-
}, [
|
|
3087
|
+
}), x(t), C(!0);
|
|
3088
|
+
}, [N]);
|
|
3089
3089
|
Me(() => {
|
|
3090
|
-
if (
|
|
3091
|
-
|
|
3090
|
+
if (N) {
|
|
3091
|
+
C(!0);
|
|
3092
3092
|
return;
|
|
3093
3093
|
}
|
|
3094
|
-
|
|
3094
|
+
C(!1);
|
|
3095
3095
|
let e = requestAnimationFrame(() => {
|
|
3096
|
-
|
|
3096
|
+
P();
|
|
3097
3097
|
});
|
|
3098
3098
|
return () => cancelAnimationFrame(e);
|
|
3099
3099
|
}, [
|
|
3100
|
-
q(() => JSON.stringify(
|
|
3101
|
-
|
|
3102
|
-
|
|
3100
|
+
q(() => JSON.stringify(n.map((e) => qr(e))), [n]),
|
|
3101
|
+
P,
|
|
3102
|
+
N
|
|
3103
3103
|
]), K(() => {
|
|
3104
|
-
if (
|
|
3104
|
+
if (N || S) return;
|
|
3105
3105
|
let e = setTimeout(() => {
|
|
3106
|
-
|
|
3106
|
+
P(), C(!0);
|
|
3107
3107
|
}, 16);
|
|
3108
3108
|
return () => clearTimeout(e);
|
|
3109
3109
|
}, [
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3110
|
+
S,
|
|
3111
|
+
P,
|
|
3112
|
+
N
|
|
3113
3113
|
]), K(() => {
|
|
3114
|
-
if (
|
|
3115
|
-
let e =
|
|
3116
|
-
|
|
3114
|
+
if (N || !f || !S || v === 0) return;
|
|
3115
|
+
let e = g.current;
|
|
3116
|
+
if (!e) return;
|
|
3117
|
+
let t = [...e.children].filter((e) => e.getAttribute("aria-hidden") !== "true"), n = t.length > 1 ? (t.length - 1) * 4 : 0, r = t.reduce((e, t) => e + t.getBoundingClientRect().width, 0) + n;
|
|
3118
|
+
r > 0 && Math.abs(v - r) < 1 && console.error(`[declarion] ResponsiveActionBar is measuring itself: its container is ${Math.round(v)}px, exactly the width of what it just rendered. The slot holding this bar is sized by its own content, so it cannot tell the bar how much room there is. Give that slot \`flex: 1 1 auto; min-width: 0\` (and justify its content to the edge the buttons sit on), or pass \`constrain={false}\` if it genuinely has no row to take space from.`);
|
|
3117
3119
|
}, [
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3120
|
+
N,
|
|
3121
|
+
f,
|
|
3122
|
+
S,
|
|
3121
3123
|
v,
|
|
3122
3124
|
b
|
|
3123
3125
|
]), K(() => {
|
|
3124
|
-
if (
|
|
3125
|
-
let e =
|
|
3126
|
+
if (N) return;
|
|
3127
|
+
let e = g.current;
|
|
3126
3128
|
if (!e) return;
|
|
3127
3129
|
if (typeof ResizeObserver > "u") {
|
|
3128
3130
|
y(e.getBoundingClientRect().width);
|
|
@@ -3133,45 +3135,45 @@ function Jr({ layout: r, entityActions: i, globalActions: a, onRun: o, reservedR
|
|
|
3133
3135
|
t && y(t.contentRect.width);
|
|
3134
3136
|
});
|
|
3135
3137
|
return t.observe(e), y(e.getBoundingClientRect().width), () => t.disconnect();
|
|
3136
|
-
}, [
|
|
3137
|
-
let
|
|
3138
|
+
}, [N]);
|
|
3139
|
+
let F = q(() => N || !f ? Kr(n, 2 ** 53 - 1, o, b, r, i, c) : S ? v === 0 ? Kr(n, 2 ** 53 - 1, o, b, r, i, c) : Kr(n, v, o, b, r, i, c) : {
|
|
3138
3140
|
primaryInline: [],
|
|
3139
3141
|
inline: [],
|
|
3140
3142
|
overflow: [],
|
|
3141
3143
|
destructiveInline: []
|
|
3142
3144
|
}, [
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3145
|
+
N,
|
|
3146
|
+
f,
|
|
3147
|
+
S,
|
|
3146
3148
|
v,
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
+
n,
|
|
3150
|
+
o,
|
|
3149
3151
|
b,
|
|
3152
|
+
r,
|
|
3150
3153
|
i,
|
|
3151
|
-
a,
|
|
3152
3154
|
c
|
|
3153
3155
|
]);
|
|
3154
|
-
if (
|
|
3155
|
-
let
|
|
3156
|
+
if (M === 0) return null;
|
|
3157
|
+
let I = F.overflow.length > 0;
|
|
3156
3158
|
return /* @__PURE__ */ Q("div", {
|
|
3157
|
-
ref:
|
|
3159
|
+
ref: g,
|
|
3158
3160
|
role: "toolbar",
|
|
3159
|
-
"aria-label":
|
|
3161
|
+
"aria-label": u,
|
|
3160
3162
|
style: {
|
|
3161
3163
|
display: "flex",
|
|
3162
|
-
flexDirection:
|
|
3164
|
+
flexDirection: E ? "row-reverse" : "row",
|
|
3163
3165
|
alignItems: "center",
|
|
3164
3166
|
gap: 4,
|
|
3165
|
-
visibility:
|
|
3167
|
+
visibility: S || N ? "visible" : "hidden",
|
|
3166
3168
|
position: "relative",
|
|
3167
|
-
flex:
|
|
3168
|
-
justifyContent:
|
|
3169
|
+
flex: f ? "1 1 auto" : "0 1 auto",
|
|
3170
|
+
justifyContent: d === "trailing" ? "flex-end" : "flex-start",
|
|
3169
3171
|
minWidth: 0,
|
|
3170
3172
|
boxSizing: "border-box"
|
|
3171
3173
|
},
|
|
3172
3174
|
children: [
|
|
3173
3175
|
/* @__PURE__ */ Q("div", {
|
|
3174
|
-
ref:
|
|
3176
|
+
ref: _,
|
|
3175
3177
|
"aria-hidden": "true",
|
|
3176
3178
|
style: {
|
|
3177
3179
|
position: "absolute",
|
|
@@ -3182,17 +3184,17 @@ function Jr({ layout: r, entityActions: i, globalActions: a, onRun: o, reservedR
|
|
|
3182
3184
|
top: 0,
|
|
3183
3185
|
left: 0
|
|
3184
3186
|
},
|
|
3185
|
-
children: [/* @__PURE__ */ Z(
|
|
3187
|
+
children: [/* @__PURE__ */ Z(l, {
|
|
3186
3188
|
"data-node-key": Ur,
|
|
3187
3189
|
iconRight: /* @__PURE__ */ Z(e.down, { size: 10 }),
|
|
3188
3190
|
tabIndex: -1,
|
|
3189
3191
|
children: "Actions"
|
|
3190
|
-
}, Ur),
|
|
3191
|
-
let
|
|
3192
|
+
}, Ur), n.map((n) => {
|
|
3193
|
+
let a = qr(n);
|
|
3192
3194
|
if (n.kind === "action") {
|
|
3193
|
-
let e = Pr(n.code,
|
|
3194
|
-
return /* @__PURE__ */ Z(
|
|
3195
|
-
"data-node-key":
|
|
3195
|
+
let e = Pr(n.code, r, i), o = Fr(n.code, r, i), s = Ir(n.code, r, i);
|
|
3196
|
+
return /* @__PURE__ */ Z(l, {
|
|
3197
|
+
"data-node-key": a,
|
|
3196
3198
|
icon: s ? /* @__PURE__ */ Z(t, {
|
|
3197
3199
|
name: s,
|
|
3198
3200
|
size: 12
|
|
@@ -3200,97 +3202,97 @@ function Jr({ layout: r, entityActions: i, globalActions: a, onRun: o, reservedR
|
|
|
3200
3202
|
danger: e?.destructive,
|
|
3201
3203
|
tabIndex: -1,
|
|
3202
3204
|
children: o
|
|
3203
|
-
},
|
|
3205
|
+
}, a);
|
|
3204
3206
|
} else {
|
|
3205
|
-
let t = n.name ?
|
|
3206
|
-
return /* @__PURE__ */ Z(
|
|
3207
|
-
"data-node-key":
|
|
3207
|
+
let t = n.name ? W(n.name) : "Actions";
|
|
3208
|
+
return /* @__PURE__ */ Z(l, {
|
|
3209
|
+
"data-node-key": a,
|
|
3208
3210
|
iconRight: /* @__PURE__ */ Z(e.down, { size: 10 }),
|
|
3209
3211
|
tabIndex: -1,
|
|
3210
3212
|
children: t
|
|
3211
|
-
},
|
|
3213
|
+
}, a);
|
|
3212
3214
|
}
|
|
3213
3215
|
})]
|
|
3214
3216
|
}),
|
|
3215
|
-
|
|
3217
|
+
F.primaryInline.map((e) => /* @__PURE__ */ Z(Rr, {
|
|
3216
3218
|
leaf: e,
|
|
3217
|
-
entityActions:
|
|
3218
|
-
globalActions:
|
|
3219
|
-
onRun:
|
|
3220
|
-
loading:
|
|
3221
|
-
onLoadingChange: (t) =>
|
|
3222
|
-
row:
|
|
3223
|
-
widgetContext:
|
|
3224
|
-
onActionClick:
|
|
3219
|
+
entityActions: r,
|
|
3220
|
+
globalActions: i,
|
|
3221
|
+
onRun: a,
|
|
3222
|
+
loading: w === e.code,
|
|
3223
|
+
onLoadingChange: (t) => T(t ? e.code : null),
|
|
3224
|
+
row: p,
|
|
3225
|
+
widgetContext: m,
|
|
3226
|
+
onActionClick: h
|
|
3225
3227
|
}, qr(e))),
|
|
3226
|
-
|
|
3228
|
+
F.inline.map((e) => {
|
|
3227
3229
|
let t = qr(e);
|
|
3228
3230
|
return e.kind === "action" ? /* @__PURE__ */ Z(Rr, {
|
|
3229
3231
|
leaf: e,
|
|
3230
|
-
entityActions:
|
|
3231
|
-
globalActions:
|
|
3232
|
-
onRun:
|
|
3233
|
-
loading:
|
|
3234
|
-
onLoadingChange: (t) =>
|
|
3235
|
-
row:
|
|
3236
|
-
widgetContext:
|
|
3237
|
-
onActionClick:
|
|
3232
|
+
entityActions: r,
|
|
3233
|
+
globalActions: i,
|
|
3234
|
+
onRun: a,
|
|
3235
|
+
loading: w === e.code,
|
|
3236
|
+
onLoadingChange: (t) => T(t ? e.code : null),
|
|
3237
|
+
row: p,
|
|
3238
|
+
widgetContext: m,
|
|
3239
|
+
onActionClick: h
|
|
3238
3240
|
}, t) : /* @__PURE__ */ Z(zr, {
|
|
3239
3241
|
group: e,
|
|
3240
|
-
entityActions:
|
|
3241
|
-
globalActions:
|
|
3242
|
-
onRun:
|
|
3243
|
-
loading:
|
|
3244
|
-
onLoadingChange:
|
|
3242
|
+
entityActions: r,
|
|
3243
|
+
globalActions: i,
|
|
3244
|
+
onRun: a,
|
|
3245
|
+
loading: w,
|
|
3246
|
+
onLoadingChange: T
|
|
3245
3247
|
}, t);
|
|
3246
3248
|
}),
|
|
3247
|
-
|
|
3248
|
-
ref:
|
|
3249
|
+
I && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(l, {
|
|
3250
|
+
ref: O,
|
|
3249
3251
|
kind: "default",
|
|
3250
3252
|
iconRight: /* @__PURE__ */ Z(e.down, { size: 10 }),
|
|
3251
3253
|
"aria-haspopup": "menu",
|
|
3252
|
-
"aria-expanded":
|
|
3253
|
-
onClick: () =>
|
|
3254
|
+
"aria-expanded": k ? "true" : "false",
|
|
3255
|
+
onClick: () => A((e) => !e),
|
|
3254
3256
|
children: "Actions"
|
|
3255
|
-
}), /* @__PURE__ */ Z(
|
|
3256
|
-
open:
|
|
3257
|
-
anchor:
|
|
3258
|
-
onClose: () =>
|
|
3259
|
-
align:
|
|
3257
|
+
}), /* @__PURE__ */ Z(s, {
|
|
3258
|
+
open: k,
|
|
3259
|
+
anchor: O.current,
|
|
3260
|
+
onClose: () => A(!1),
|
|
3261
|
+
align: E ? "start" : "end",
|
|
3260
3262
|
width: 220,
|
|
3261
3263
|
children: /* @__PURE__ */ Z("div", {
|
|
3262
3264
|
role: "menu",
|
|
3263
3265
|
"aria-label": "More actions",
|
|
3264
|
-
children:
|
|
3266
|
+
children: F.overflow.map((e) => e.kind === "action" ? /* @__PURE__ */ Z(Br, {
|
|
3265
3267
|
leaf: e,
|
|
3266
|
-
entityActions:
|
|
3267
|
-
globalActions:
|
|
3268
|
-
onRun:
|
|
3269
|
-
loading:
|
|
3270
|
-
onLoadingChange: (t) =>
|
|
3271
|
-
row:
|
|
3272
|
-
widgetContext:
|
|
3273
|
-
onActionClick:
|
|
3268
|
+
entityActions: r,
|
|
3269
|
+
globalActions: i,
|
|
3270
|
+
onRun: j,
|
|
3271
|
+
loading: w === e.code,
|
|
3272
|
+
onLoadingChange: (t) => T(t ? e.code : null),
|
|
3273
|
+
row: p,
|
|
3274
|
+
widgetContext: m,
|
|
3275
|
+
onActionClick: h
|
|
3274
3276
|
}, e.code) : /* @__PURE__ */ Z(Vr, {
|
|
3275
3277
|
group: e,
|
|
3276
|
-
entityActions:
|
|
3277
|
-
globalActions:
|
|
3278
|
-
onRun:
|
|
3279
|
-
loading:
|
|
3280
|
-
onLoadingChange:
|
|
3278
|
+
entityActions: r,
|
|
3279
|
+
globalActions: i,
|
|
3280
|
+
onRun: j,
|
|
3281
|
+
loading: w,
|
|
3282
|
+
onLoadingChange: T
|
|
3281
3283
|
}, qr(e)))
|
|
3282
3284
|
})
|
|
3283
3285
|
})] }),
|
|
3284
|
-
|
|
3286
|
+
F.destructiveInline.map((e) => /* @__PURE__ */ Z(Rr, {
|
|
3285
3287
|
leaf: e,
|
|
3286
|
-
entityActions:
|
|
3287
|
-
globalActions:
|
|
3288
|
-
onRun:
|
|
3289
|
-
loading:
|
|
3290
|
-
onLoadingChange: (t) =>
|
|
3291
|
-
row:
|
|
3292
|
-
widgetContext:
|
|
3293
|
-
onActionClick:
|
|
3288
|
+
entityActions: r,
|
|
3289
|
+
globalActions: i,
|
|
3290
|
+
onRun: a,
|
|
3291
|
+
loading: w === e.code,
|
|
3292
|
+
onLoadingChange: (t) => T(t ? e.code : null),
|
|
3293
|
+
row: p,
|
|
3294
|
+
widgetContext: m,
|
|
3295
|
+
onActionClick: h
|
|
3294
3296
|
}, qr(e)))
|
|
3295
3297
|
]
|
|
3296
3298
|
});
|
|
@@ -3362,7 +3364,7 @@ function Xr({ layout: e, row: t, rowSelection: n, onRun: r, reservedRightWidth:
|
|
|
3362
3364
|
//#endregion
|
|
3363
3365
|
//#region src/lib/action-dispatch.ts
|
|
3364
3366
|
function Zr(e, t, n, r) {
|
|
3365
|
-
return
|
|
3367
|
+
return ne(t) ? (E(t.ui_steps, n), null) : t.entity ? `${t.entity}.${e}` : r ? `${r}.${e}` : e;
|
|
3366
3368
|
}
|
|
3367
3369
|
//#endregion
|
|
3368
3370
|
//#region src/components/detail-layout/AssociatedBlock.tsx
|
|
@@ -3391,7 +3393,7 @@ function $r(e, t, n) {
|
|
|
3391
3393
|
let n = a.resolved_params.items().filter((e) => e.name !== t);
|
|
3392
3394
|
e = {
|
|
3393
3395
|
...e,
|
|
3394
|
-
resolved_params: new
|
|
3396
|
+
resolved_params: new le(n)
|
|
3395
3397
|
};
|
|
3396
3398
|
}
|
|
3397
3399
|
r.push({
|
|
@@ -3424,7 +3426,7 @@ function ei(e, t, n) {
|
|
|
3424
3426
|
return null;
|
|
3425
3427
|
}
|
|
3426
3428
|
function ti(e, t, n) {
|
|
3427
|
-
let r = new Set(
|
|
3429
|
+
let r = new Set(z(e));
|
|
3428
3430
|
return new Set(t.filter((t) => {
|
|
3429
3431
|
if (t === n || r.has(t)) return !1;
|
|
3430
3432
|
let i = e.fields.get(t);
|
|
@@ -3486,52 +3488,52 @@ function ai({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
|
|
|
3486
3488
|
if (e === o) return !1;
|
|
3487
3489
|
let t = a.fields.get(e);
|
|
3488
3490
|
return !(!t || t.primary || t.display?.is_listable === !1);
|
|
3489
|
-
}), c =
|
|
3491
|
+
}), c = y(a, "update"), u = n.interaction ?? (c ? "navigate" : "readonly"), d = (u === "inline_edit" || u === "row_edit") && c && n.editable !== !1, f = W(a.display?.name_plural) || W(a.display?.name) || i, p = n.searchable === !0 || n.filters && n.filters.length > 0, m = q(() => $r(a.actions, o, r.recordId), [
|
|
3490
3492
|
a.actions,
|
|
3491
3493
|
o,
|
|
3492
3494
|
r.recordId
|
|
3493
|
-
]),
|
|
3495
|
+
]), h = q(() => {
|
|
3494
3496
|
let e = {};
|
|
3495
|
-
for (let { code: t, action: n } of
|
|
3497
|
+
for (let { code: t, action: n } of m) e[t] = n;
|
|
3496
3498
|
return e;
|
|
3497
|
-
}, [
|
|
3499
|
+
}, [m]), g = q(() => lr(a.action_layout ?? null ?? Cr(h, "list_toolbar"), h, void 0, {}, []), [a.action_layout, h]), { run: _ } = N(), v = It(), b = j(), x = q(() => ({
|
|
3498
3500
|
entity: a,
|
|
3499
3501
|
entityCode: i,
|
|
3500
3502
|
screenRoute: typeof window < "u" ? window.location.pathname : "",
|
|
3501
3503
|
selectedRows: [],
|
|
3502
3504
|
selectedIds: [],
|
|
3503
|
-
locale:
|
|
3505
|
+
locale: b,
|
|
3504
3506
|
tabNavigate: (e, t) => v(e, {
|
|
3505
3507
|
title: t?.title,
|
|
3506
3508
|
icon: t?.icon,
|
|
3507
3509
|
search: t?.search
|
|
3508
3510
|
}),
|
|
3509
|
-
runActionApi: (e, t) =>
|
|
3511
|
+
runActionApi: (e, t) => te(e, t)
|
|
3510
3512
|
}), [
|
|
3511
3513
|
a,
|
|
3512
3514
|
i,
|
|
3513
|
-
|
|
3515
|
+
b,
|
|
3514
3516
|
v
|
|
3515
|
-
]),
|
|
3516
|
-
|
|
3517
|
+
]), S = Re(), C = G(() => {
|
|
3518
|
+
S.invalidateQueries({ predicate: (e) => {
|
|
3517
3519
|
let t = e.queryKey;
|
|
3518
3520
|
return t[0] === "entity-children" && t[3] === i;
|
|
3519
3521
|
} });
|
|
3520
|
-
}, [
|
|
3522
|
+
}, [S, i]), w = G((e, t) => {
|
|
3521
3523
|
let n = Zr(e, t, {}, i);
|
|
3522
|
-
if (n !== null) return
|
|
3524
|
+
if (n !== null) return _({
|
|
3523
3525
|
action: t,
|
|
3524
|
-
title:
|
|
3526
|
+
title: W(t.display?.name) || e,
|
|
3525
3527
|
execute: async (e) => {
|
|
3526
|
-
let t = await
|
|
3528
|
+
let t = await te(n, B(e, void 0));
|
|
3527
3529
|
return C(), t;
|
|
3528
3530
|
}
|
|
3529
3531
|
});
|
|
3530
3532
|
}, [
|
|
3531
|
-
|
|
3533
|
+
_,
|
|
3532
3534
|
i,
|
|
3533
3535
|
C
|
|
3534
|
-
]), [T,
|
|
3536
|
+
]), [T, E] = Y(0), D = /* @__PURE__ */ Q("div", {
|
|
3535
3537
|
style: {
|
|
3536
3538
|
display: "flex",
|
|
3537
3539
|
alignItems: "center",
|
|
@@ -3540,36 +3542,36 @@ function ai({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
|
|
|
3540
3542
|
minWidth: 0,
|
|
3541
3543
|
justifyContent: "flex-end"
|
|
3542
3544
|
},
|
|
3543
|
-
children: [a.action_layout ?
|
|
3545
|
+
children: [a.action_layout ? g.length > 0 && /* @__PURE__ */ Z(Xr, {
|
|
3544
3546
|
kind: "toolbar",
|
|
3545
|
-
layout:
|
|
3546
|
-
entityActions:
|
|
3547
|
+
layout: g,
|
|
3548
|
+
entityActions: h,
|
|
3547
3549
|
onRun: w,
|
|
3548
|
-
widgetContext:
|
|
3549
|
-
ariaLabel: `${
|
|
3550
|
-
}) :
|
|
3550
|
+
widgetContext: x,
|
|
3551
|
+
ariaLabel: `${f} toolbar actions`
|
|
3552
|
+
}) : m.map(({ code: e, action: t }) => /* @__PURE__ */ Z(wr, {
|
|
3551
3553
|
actionCode: e,
|
|
3552
3554
|
action: t,
|
|
3553
3555
|
entityCode: i,
|
|
3554
3556
|
variant: "ghost",
|
|
3555
3557
|
size: "sm",
|
|
3556
3558
|
onSuccess: C
|
|
3557
|
-
}, e)),
|
|
3559
|
+
}, e)), d && /* @__PURE__ */ Z(l, {
|
|
3558
3560
|
kind: "ghost",
|
|
3559
3561
|
size: "xs",
|
|
3560
3562
|
icon: /* @__PURE__ */ Z(e.plus, { size: 12 }),
|
|
3561
|
-
onClick: () =>
|
|
3563
|
+
onClick: () => E((e) => e + 1),
|
|
3562
3564
|
children: "Add row"
|
|
3563
3565
|
})]
|
|
3564
|
-
}),
|
|
3566
|
+
}), O = p ? /* @__PURE__ */ Z(si, {
|
|
3565
3567
|
entityCode: i,
|
|
3566
3568
|
entity: a,
|
|
3567
3569
|
parentEntity: r.entityCode,
|
|
3568
3570
|
parentId: r.recordId,
|
|
3569
3571
|
foreignKey: o,
|
|
3570
3572
|
columns: s,
|
|
3571
|
-
editable:
|
|
3572
|
-
interaction:
|
|
3573
|
+
editable: d,
|
|
3574
|
+
interaction: u,
|
|
3573
3575
|
ctx: r,
|
|
3574
3576
|
searchable: n.searchable,
|
|
3575
3577
|
filterFields: n.filters,
|
|
@@ -3582,8 +3584,8 @@ function ai({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
|
|
|
3582
3584
|
parentId: r.recordId,
|
|
3583
3585
|
foreignKey: o,
|
|
3584
3586
|
columns: s,
|
|
3585
|
-
editable:
|
|
3586
|
-
interaction:
|
|
3587
|
+
editable: d,
|
|
3588
|
+
interaction: u,
|
|
3587
3589
|
ctx: r,
|
|
3588
3590
|
sort: n.sort,
|
|
3589
3591
|
startDraftSignal: T
|
|
@@ -3594,15 +3596,15 @@ function ai({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
|
|
|
3594
3596
|
justifyContent: "flex-end",
|
|
3595
3597
|
marginBottom: 8
|
|
3596
3598
|
},
|
|
3597
|
-
children:
|
|
3598
|
-
}),
|
|
3599
|
-
title:
|
|
3599
|
+
children: D
|
|
3600
|
+
}), O] }) : /* @__PURE__ */ Z(Ue, {
|
|
3601
|
+
title: f,
|
|
3600
3602
|
icon: a.display?.icon ? /* @__PURE__ */ Z(t, {
|
|
3601
3603
|
name: a.display.icon,
|
|
3602
3604
|
size: 14
|
|
3603
3605
|
}) : void 0,
|
|
3604
|
-
right:
|
|
3605
|
-
children:
|
|
3606
|
+
right: D,
|
|
3607
|
+
children: O
|
|
3606
3608
|
});
|
|
3607
3609
|
}
|
|
3608
3610
|
function oi({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, sort: l, startDraftSignal: u }) {
|
|
@@ -3636,15 +3638,15 @@ function oi({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3636
3638
|
startDraftSignal: u
|
|
3637
3639
|
});
|
|
3638
3640
|
}
|
|
3639
|
-
function si({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, searchable:
|
|
3640
|
-
let
|
|
3641
|
-
K(() => (
|
|
3642
|
-
|
|
3641
|
+
function si({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, searchable: d, filterFields: f, sort: p, startDraftSignal: m }) {
|
|
3642
|
+
let h = Re(), [g, _] = Y(""), [v, y] = Y(""), [b, x] = Y({}), S = J(void 0);
|
|
3643
|
+
K(() => (S.current && clearTimeout(S.current), S.current = setTimeout(() => {
|
|
3644
|
+
y(g);
|
|
3643
3645
|
}, 300), () => {
|
|
3644
|
-
|
|
3645
|
-
}), [
|
|
3646
|
-
let
|
|
3647
|
-
|
|
3646
|
+
S.current && clearTimeout(S.current);
|
|
3647
|
+
}), [g]);
|
|
3648
|
+
let C = G((e, t) => {
|
|
3649
|
+
x((n) => {
|
|
3648
3650
|
if (t === "__all__") {
|
|
3649
3651
|
let { [e]: t, ...r } = n;
|
|
3650
3652
|
return r;
|
|
@@ -3654,13 +3656,13 @@ function si({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3654
3656
|
[e]: t
|
|
3655
3657
|
};
|
|
3656
3658
|
});
|
|
3657
|
-
}, []),
|
|
3658
|
-
if (!
|
|
3659
|
+
}, []), w = q(() => Object.keys(b).length > 0 ? b : void 0, [b]), { data: T, isLoading: E, isError: D, hasNextPage: O, fetchNextPage: k, isFetchingNextPage: A } = zn(n, r, e, i, p, void 0, v || void 0, w), { rows: j, refs: M } = q(() => {
|
|
3660
|
+
if (!T?.pages) return {
|
|
3659
3661
|
rows: [],
|
|
3660
3662
|
refs: void 0
|
|
3661
3663
|
};
|
|
3662
3664
|
let e = [], t;
|
|
3663
|
-
for (let n of
|
|
3665
|
+
for (let n of T.pages) if (e.push(...n.data), n.$refs) if (!t) t = { ...n.$refs };
|
|
3664
3666
|
else for (let [e, r] of Object.entries(n.$refs)) t[e] = {
|
|
3665
3667
|
...t[e],
|
|
3666
3668
|
...r
|
|
@@ -3669,21 +3671,21 @@ function si({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3669
3671
|
rows: e,
|
|
3670
3672
|
refs: t
|
|
3671
3673
|
};
|
|
3672
|
-
}, [
|
|
3673
|
-
|
|
3674
|
+
}, [T]), N = G(() => {
|
|
3675
|
+
h.invalidateQueries({ predicate: (t) => {
|
|
3674
3676
|
let n = t.queryKey;
|
|
3675
3677
|
return n[0] === "entity-children" && n[3] === e;
|
|
3676
3678
|
} });
|
|
3677
|
-
}, [
|
|
3679
|
+
}, [h, e]);
|
|
3678
3680
|
return /* @__PURE__ */ Q("div", { children: [
|
|
3679
3681
|
/* @__PURE__ */ Z(Er, {
|
|
3680
3682
|
entity: t,
|
|
3681
|
-
searchable:
|
|
3682
|
-
filterFields:
|
|
3683
|
-
searchValue:
|
|
3684
|
-
onSearchChange:
|
|
3685
|
-
filters:
|
|
3686
|
-
onFilterChange:
|
|
3683
|
+
searchable: d,
|
|
3684
|
+
filterFields: f,
|
|
3685
|
+
searchValue: g,
|
|
3686
|
+
onSearchChange: _,
|
|
3687
|
+
filters: b,
|
|
3688
|
+
onFilterChange: C,
|
|
3687
3689
|
allEntities: c.schema.entities
|
|
3688
3690
|
}),
|
|
3689
3691
|
/* @__PURE__ */ Z(ci, {
|
|
@@ -3695,65 +3697,65 @@ function si({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3695
3697
|
editable: o,
|
|
3696
3698
|
interaction: s,
|
|
3697
3699
|
ctx: c,
|
|
3698
|
-
rows:
|
|
3700
|
+
rows: j,
|
|
3699
3701
|
refs: M,
|
|
3700
|
-
isLoading:
|
|
3701
|
-
isError:
|
|
3702
|
+
isLoading: E,
|
|
3703
|
+
isError: D,
|
|
3702
3704
|
invalidateQuery: N,
|
|
3703
|
-
startDraftSignal:
|
|
3705
|
+
startDraftSignal: m
|
|
3704
3706
|
}),
|
|
3705
|
-
|
|
3707
|
+
O && /* @__PURE__ */ Z("div", {
|
|
3706
3708
|
style: { marginTop: 4 },
|
|
3707
|
-
children: /* @__PURE__ */ Z(
|
|
3709
|
+
children: /* @__PURE__ */ Z(l, {
|
|
3708
3710
|
kind: "ghost",
|
|
3709
3711
|
size: "xs",
|
|
3710
|
-
icon:
|
|
3711
|
-
onClick: () =>
|
|
3712
|
-
disabled:
|
|
3712
|
+
icon: A ? /* @__PURE__ */ Z(u, { size: 12 }) : void 0,
|
|
3713
|
+
onClick: () => k(),
|
|
3714
|
+
disabled: A,
|
|
3713
3715
|
children: "Load more"
|
|
3714
3716
|
})
|
|
3715
3717
|
})
|
|
3716
3718
|
] });
|
|
3717
3719
|
}
|
|
3718
|
-
function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i, editable: a, interaction: o, ctx: s, rows: c, refs:
|
|
3719
|
-
let
|
|
3720
|
+
function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i, editable: a, interaction: o, ctx: s, rows: c, refs: l, isLoading: u, isError: d, invalidateQuery: f, startDraftSignal: p }) {
|
|
3721
|
+
let m = de(), h = m.isPhone && s.relatedRecordsPresentation === "table", g = i.find((e) => e !== r), _ = q(() => o === "navigate" ? k(void 0, t, s.schema.screens) : null, [
|
|
3720
3722
|
o,
|
|
3721
3723
|
t,
|
|
3722
3724
|
s.schema.screens
|
|
3723
|
-
]),
|
|
3725
|
+
]), v = q(() => a ? ti(t, i, r) : /* @__PURE__ */ new Set(), [
|
|
3724
3726
|
i,
|
|
3725
3727
|
r,
|
|
3726
3728
|
t,
|
|
3727
3729
|
a
|
|
3728
|
-
]),
|
|
3730
|
+
]), y = q(() => ni(t, i, r), [
|
|
3729
3731
|
i,
|
|
3730
3732
|
r,
|
|
3731
3733
|
t
|
|
3732
|
-
]),
|
|
3734
|
+
]), x = q(() => {
|
|
3733
3735
|
let e = /* @__PURE__ */ new Map();
|
|
3734
3736
|
for (let n of c) {
|
|
3735
|
-
let r =
|
|
3736
|
-
e.set(
|
|
3737
|
+
let r = V(t, n);
|
|
3738
|
+
e.set(b(r), r);
|
|
3737
3739
|
}
|
|
3738
3740
|
return e;
|
|
3739
3741
|
}, [c, t]), C = q(() => {
|
|
3740
3742
|
let e = /* @__PURE__ */ new Map();
|
|
3741
3743
|
for (let n of c) {
|
|
3742
3744
|
let r = n.$row_version;
|
|
3743
|
-
typeof r == "string" && r !== "" && e.set(
|
|
3745
|
+
typeof r == "string" && r !== "" && e.set(b(V(t, n)), r);
|
|
3744
3746
|
}
|
|
3745
3747
|
return e;
|
|
3746
|
-
}, [c, t]), w = q(() => Qr(t.actions), [t.actions]), [T, E] = Y(null), [D, O] = Y(null), [A, j] = Y([]), [
|
|
3747
|
-
|
|
3748
|
-
let
|
|
3748
|
+
}, [c, t]), w = q(() => Qr(t.actions), [t.actions]), [T, E] = Y(null), [D, O] = Y(null), [A, j] = Y([]), [N, F] = Y({}), I = J(N);
|
|
3749
|
+
I.current = N;
|
|
3750
|
+
let L = J({});
|
|
3749
3751
|
K(() => {
|
|
3750
|
-
let e =
|
|
3752
|
+
let e = L.current;
|
|
3751
3753
|
return () => {
|
|
3752
3754
|
for (let t of Object.values(e)) clearTimeout(t);
|
|
3753
3755
|
};
|
|
3754
3756
|
}, []);
|
|
3755
|
-
let [
|
|
3756
|
-
|
|
3757
|
+
let [R, z] = Y(null), [B, ee] = Y([]), [te, ne] = Y(!1), [H, U] = Y(null), [W, ae] = Y(/* @__PURE__ */ new Set()), oe = G(async (t, n, r) => {
|
|
3758
|
+
F((e) => ({
|
|
3757
3759
|
...e,
|
|
3758
3760
|
[t]: {
|
|
3759
3761
|
...e[t],
|
|
@@ -3766,7 +3768,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3766
3768
|
...n,
|
|
3767
3769
|
$row_version: i
|
|
3768
3770
|
} : n;
|
|
3769
|
-
return await
|
|
3771
|
+
return await M(e, x.get(t) ?? t, a), F((e) => {
|
|
3770
3772
|
let n = e[t];
|
|
3771
3773
|
if (!n) return e;
|
|
3772
3774
|
if (n.ver > r) return {
|
|
@@ -3778,10 +3780,10 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3778
3780
|
};
|
|
3779
3781
|
let { [t]: i, ...a } = e;
|
|
3780
3782
|
return a;
|
|
3781
|
-
}),
|
|
3783
|
+
}), f(), !0;
|
|
3782
3784
|
} catch (e) {
|
|
3783
3785
|
let n = e instanceof Error ? e.message : "Save failed";
|
|
3784
|
-
return
|
|
3786
|
+
return F((e) => ({
|
|
3785
3787
|
...e,
|
|
3786
3788
|
[t]: {
|
|
3787
3789
|
...e[t],
|
|
@@ -3792,11 +3794,11 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3792
3794
|
}
|
|
3793
3795
|
}, [
|
|
3794
3796
|
e,
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
+
f,
|
|
3798
|
+
x,
|
|
3797
3799
|
C
|
|
3798
|
-
]),
|
|
3799
|
-
|
|
3800
|
+
]), se = G((e, t, n) => {
|
|
3801
|
+
F((r) => {
|
|
3800
3802
|
let i = r[e] ?? {
|
|
3801
3803
|
buffer: {},
|
|
3802
3804
|
ver: 0,
|
|
@@ -3813,99 +3815,99 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3813
3815
|
ver: a
|
|
3814
3816
|
}
|
|
3815
3817
|
};
|
|
3816
|
-
}), o === "inline_edit" && (
|
|
3817
|
-
let t =
|
|
3818
|
-
t && Object.keys(t.buffer).length > 0 &&
|
|
3818
|
+
}), o === "inline_edit" && (L.current[e] && clearTimeout(L.current[e]), L.current[e] = setTimeout(() => {
|
|
3819
|
+
let t = I.current[e];
|
|
3820
|
+
t && Object.keys(t.buffer).length > 0 && oe(e, { ...t.buffer }, t.ver);
|
|
3819
3821
|
}, 500));
|
|
3820
|
-
}, [
|
|
3822
|
+
}, [oe, o]), ce = G(() => {
|
|
3821
3823
|
let e = {};
|
|
3822
3824
|
e[r] = n;
|
|
3823
3825
|
for (let n of i) {
|
|
3824
3826
|
let r = t.fields.get(n);
|
|
3825
3827
|
r && (r.default === void 0 ? r.type === "bool" && (e[n] = !1) : e[n] = r.default);
|
|
3826
3828
|
}
|
|
3827
|
-
|
|
3829
|
+
z(e), ee([]);
|
|
3828
3830
|
}, [
|
|
3829
3831
|
r,
|
|
3830
3832
|
n,
|
|
3831
3833
|
i,
|
|
3832
3834
|
t.fields
|
|
3833
|
-
]),
|
|
3835
|
+
]), le = J(p);
|
|
3834
3836
|
K(() => {
|
|
3835
|
-
|
|
3837
|
+
p !== void 0 && p !== le.current && (le.current = p, !R && ce());
|
|
3836
3838
|
}, [
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3839
|
+
p,
|
|
3840
|
+
R,
|
|
3841
|
+
ce
|
|
3840
3842
|
]);
|
|
3841
|
-
let
|
|
3842
|
-
if (!
|
|
3843
|
-
let n = ri(
|
|
3843
|
+
let ue = G(async () => {
|
|
3844
|
+
if (!R) return;
|
|
3845
|
+
let n = ri(R, i, t, r);
|
|
3844
3846
|
if (n.length > 0) {
|
|
3845
|
-
|
|
3847
|
+
ee(n);
|
|
3846
3848
|
return;
|
|
3847
3849
|
}
|
|
3848
|
-
|
|
3850
|
+
ne(!0);
|
|
3849
3851
|
try {
|
|
3850
|
-
await
|
|
3852
|
+
await re(e, R), z(null), ee([]), f();
|
|
3851
3853
|
} catch (e) {
|
|
3852
3854
|
let t = e instanceof Error ? e.message : "Create failed";
|
|
3853
|
-
|
|
3855
|
+
ee([`_error:${t}`]);
|
|
3854
3856
|
} finally {
|
|
3855
|
-
|
|
3857
|
+
ne(!1);
|
|
3856
3858
|
}
|
|
3857
3859
|
}, [
|
|
3858
|
-
|
|
3860
|
+
R,
|
|
3859
3861
|
i,
|
|
3860
3862
|
t,
|
|
3861
3863
|
r,
|
|
3862
3864
|
e,
|
|
3863
|
-
|
|
3865
|
+
f
|
|
3864
3866
|
]), fe = G((e) => {
|
|
3865
|
-
|
|
3867
|
+
F({}), j([]), O(e);
|
|
3866
3868
|
}, []), pe = G(async (e) => {
|
|
3867
|
-
let n =
|
|
3869
|
+
let n = I.current[e], a = n?.buffer ?? {};
|
|
3868
3870
|
if (Object.keys(a).length === 0) {
|
|
3869
3871
|
O(null), j([]);
|
|
3870
3872
|
return;
|
|
3871
3873
|
}
|
|
3872
3874
|
let o = ri({
|
|
3873
|
-
...c.find((n) =>
|
|
3875
|
+
...c.find((n) => b(V(t, n)) === e) ?? {},
|
|
3874
3876
|
...a
|
|
3875
3877
|
}, i, t, r);
|
|
3876
3878
|
if (o.length > 0) {
|
|
3877
3879
|
j(o);
|
|
3878
3880
|
return;
|
|
3879
3881
|
}
|
|
3880
|
-
await
|
|
3882
|
+
await oe(e, { ...a }, n?.ver ?? 0) && (O(null), j([]));
|
|
3881
3883
|
}, [
|
|
3882
3884
|
c,
|
|
3883
3885
|
t,
|
|
3884
3886
|
i,
|
|
3885
3887
|
r,
|
|
3886
|
-
|
|
3888
|
+
oe
|
|
3887
3889
|
]), me = G((e) => {
|
|
3888
|
-
|
|
3890
|
+
F((t) => {
|
|
3889
3891
|
if (!t[e]) return t;
|
|
3890
3892
|
let { [e]: n, ...r } = t;
|
|
3891
3893
|
return r;
|
|
3892
3894
|
}), j([]), O(null);
|
|
3893
3895
|
}, []), he = G(async (t) => {
|
|
3894
|
-
U(null),
|
|
3896
|
+
U(null), ae((e) => new Set(e).add(t));
|
|
3895
3897
|
try {
|
|
3896
|
-
await
|
|
3898
|
+
await P(e, x.get(t) ?? t), f();
|
|
3897
3899
|
} catch {} finally {
|
|
3898
|
-
|
|
3900
|
+
ae((e) => {
|
|
3899
3901
|
let n = new Set(e);
|
|
3900
3902
|
return n.delete(t), n;
|
|
3901
3903
|
});
|
|
3902
3904
|
}
|
|
3903
3905
|
}, [
|
|
3904
3906
|
e,
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
+
f,
|
|
3908
|
+
x
|
|
3907
3909
|
]);
|
|
3908
|
-
if (
|
|
3910
|
+
if (d) return /* @__PURE__ */ Z("div", {
|
|
3909
3911
|
style: {
|
|
3910
3912
|
fontSize: 12.5,
|
|
3911
3913
|
color: "var(--danger)",
|
|
@@ -3913,7 +3915,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3913
3915
|
},
|
|
3914
3916
|
children: "Failed to load."
|
|
3915
3917
|
});
|
|
3916
|
-
if (
|
|
3918
|
+
if (u) return /* @__PURE__ */ Q("div", {
|
|
3917
3919
|
style: {
|
|
3918
3920
|
display: "flex",
|
|
3919
3921
|
flexDirection: "column",
|
|
@@ -3930,8 +3932,8 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3930
3932
|
borderRadius: 6
|
|
3931
3933
|
} })]
|
|
3932
3934
|
});
|
|
3933
|
-
let ge = c.length === 0 && !
|
|
3934
|
-
return
|
|
3935
|
+
let ge = c.length === 0 && !R;
|
|
3936
|
+
return m.isPhone && !h ? /* @__PURE__ */ Q("div", { children: [
|
|
3935
3937
|
ge && !a && /* @__PURE__ */ Z("div", {
|
|
3936
3938
|
style: {
|
|
3937
3939
|
fontSize: 12.5,
|
|
@@ -3947,7 +3949,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3947
3949
|
gap: 10
|
|
3948
3950
|
},
|
|
3949
3951
|
children: [c.map((n) => {
|
|
3950
|
-
let r =
|
|
3952
|
+
let r = b(V(t, n)), c = W.has(r), u = N[r], d = _ && r ? _.replace(/:\w+/, r) : void 0;
|
|
3951
3953
|
return /* @__PURE__ */ Z(li, {
|
|
3952
3954
|
rowId: r,
|
|
3953
3955
|
row: n,
|
|
@@ -3955,7 +3957,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3955
3957
|
entities: s.schema.entities,
|
|
3956
3958
|
screens: s.schema.screens,
|
|
3957
3959
|
columns: i,
|
|
3958
|
-
editableColumns:
|
|
3960
|
+
editableColumns: v,
|
|
3959
3961
|
editable: a,
|
|
3960
3962
|
interaction: o,
|
|
3961
3963
|
isEditing: D === r,
|
|
@@ -3963,10 +3965,10 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3963
3965
|
isDeleting: c,
|
|
3964
3966
|
activeCell: T,
|
|
3965
3967
|
setActiveCell: E,
|
|
3966
|
-
rowState:
|
|
3967
|
-
onCellChange:
|
|
3968
|
+
rowState: u,
|
|
3969
|
+
onCellChange: se,
|
|
3968
3970
|
onDeleteClick: (e) => {
|
|
3969
|
-
let r =
|
|
3971
|
+
let r = S(n, t) ?? "";
|
|
3970
3972
|
U({
|
|
3971
3973
|
show: !0,
|
|
3972
3974
|
rowId: e,
|
|
@@ -3976,39 +3978,39 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3976
3978
|
onStartEdit: fe,
|
|
3977
3979
|
onConfirmEdit: pe,
|
|
3978
3980
|
onCancelEdit: me,
|
|
3979
|
-
refs:
|
|
3980
|
-
identityCol:
|
|
3981
|
+
refs: l,
|
|
3982
|
+
identityCol: g,
|
|
3981
3983
|
href: d,
|
|
3982
3984
|
rowActions: w,
|
|
3983
3985
|
entityCode: e,
|
|
3984
|
-
onRowActionSuccess:
|
|
3986
|
+
onRowActionSuccess: f
|
|
3985
3987
|
}, r);
|
|
3986
|
-
}),
|
|
3987
|
-
draftRow:
|
|
3988
|
+
}), R && /* @__PURE__ */ Z(mi, {
|
|
3989
|
+
draftRow: R,
|
|
3988
3990
|
entity: t,
|
|
3989
3991
|
columns: i,
|
|
3990
|
-
editableColumns:
|
|
3992
|
+
editableColumns: y,
|
|
3991
3993
|
foreignKey: r,
|
|
3992
|
-
draftErrors:
|
|
3993
|
-
draftSaving:
|
|
3994
|
-
onChange: (e, t) =>
|
|
3994
|
+
draftErrors: B,
|
|
3995
|
+
draftSaving: te,
|
|
3996
|
+
onChange: (e, t) => z((n) => n && {
|
|
3995
3997
|
...n,
|
|
3996
3998
|
[e]: t
|
|
3997
3999
|
}),
|
|
3998
|
-
onConfirm:
|
|
4000
|
+
onConfirm: ue,
|
|
3999
4001
|
onCancel: () => {
|
|
4000
|
-
|
|
4002
|
+
z(null), ee([]);
|
|
4001
4003
|
},
|
|
4002
|
-
refs:
|
|
4004
|
+
refs: l
|
|
4003
4005
|
})]
|
|
4004
4006
|
}),
|
|
4005
|
-
|
|
4006
|
-
open:
|
|
4007
|
+
H && /* @__PURE__ */ Z(Ot, {
|
|
4008
|
+
open: H.show,
|
|
4007
4009
|
onOpenChange: (e) => !e && U(null),
|
|
4008
4010
|
title: "Delete record",
|
|
4009
|
-
description:
|
|
4011
|
+
description: H.label ? `Are you sure you want to delete "${H.label}"?` : "Are you sure you want to delete this record?",
|
|
4010
4012
|
confirmLabel: "Delete",
|
|
4011
|
-
onConfirm: () => he(
|
|
4013
|
+
onConfirm: () => he(H.rowId),
|
|
4012
4014
|
destructive: !0
|
|
4013
4015
|
})
|
|
4014
4016
|
] }) : /* @__PURE__ */ Q("div", { children: [
|
|
@@ -4029,7 +4031,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
4029
4031
|
let n = t.fields.get(e);
|
|
4030
4032
|
return /* @__PURE__ */ Z("th", {
|
|
4031
4033
|
style: Te,
|
|
4032
|
-
children: n ?
|
|
4034
|
+
children: n ? ie(n, e, s.schema.entities) : e
|
|
4033
4035
|
}, e);
|
|
4034
4036
|
}),
|
|
4035
4037
|
a && /* @__PURE__ */ Z("th", { style: {
|
|
@@ -4041,7 +4043,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
4041
4043
|
width: 40
|
|
4042
4044
|
} })
|
|
4043
4045
|
] }) }), /* @__PURE__ */ Q("tbody", { children: [c.map((n) => {
|
|
4044
|
-
let r =
|
|
4046
|
+
let r = b(V(t, n)), c = W.has(r), u = N[r], d = _ && r ? _.replace(/:\w+/, r) : void 0;
|
|
4045
4047
|
return /* @__PURE__ */ Z(ui, {
|
|
4046
4048
|
rowId: r,
|
|
4047
4049
|
row: n,
|
|
@@ -4049,7 +4051,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
4049
4051
|
entities: s.schema.entities,
|
|
4050
4052
|
screens: s.schema.screens,
|
|
4051
4053
|
columns: i,
|
|
4052
|
-
editableColumns:
|
|
4054
|
+
editableColumns: v,
|
|
4053
4055
|
editable: a,
|
|
4054
4056
|
interaction: o,
|
|
4055
4057
|
isEditing: D === r,
|
|
@@ -4057,10 +4059,10 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
4057
4059
|
isDeleting: c,
|
|
4058
4060
|
activeCell: T,
|
|
4059
4061
|
setActiveCell: E,
|
|
4060
|
-
rowState:
|
|
4061
|
-
onCellChange:
|
|
4062
|
+
rowState: u,
|
|
4063
|
+
onCellChange: se,
|
|
4062
4064
|
onDeleteClick: (e) => {
|
|
4063
|
-
let r =
|
|
4065
|
+
let r = S(n, t) ?? "";
|
|
4064
4066
|
U({
|
|
4065
4067
|
show: !0,
|
|
4066
4068
|
rowId: e,
|
|
@@ -4070,66 +4072,66 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
4070
4072
|
onStartEdit: fe,
|
|
4071
4073
|
onConfirmEdit: pe,
|
|
4072
4074
|
onCancelEdit: me,
|
|
4073
|
-
refs:
|
|
4074
|
-
identityCol:
|
|
4075
|
+
refs: l,
|
|
4076
|
+
identityCol: g,
|
|
4075
4077
|
href: d,
|
|
4076
4078
|
rowActions: w,
|
|
4077
4079
|
entityCode: e,
|
|
4078
|
-
onRowActionSuccess:
|
|
4080
|
+
onRowActionSuccess: f
|
|
4079
4081
|
}, r);
|
|
4080
|
-
}),
|
|
4081
|
-
draftRow:
|
|
4082
|
+
}), R && /* @__PURE__ */ Z(pi, {
|
|
4083
|
+
draftRow: R,
|
|
4082
4084
|
entity: t,
|
|
4083
4085
|
columns: i,
|
|
4084
|
-
editableColumns:
|
|
4086
|
+
editableColumns: y,
|
|
4085
4087
|
foreignKey: r,
|
|
4086
|
-
draftErrors:
|
|
4087
|
-
draftSaving:
|
|
4088
|
-
onChange: (e, t) =>
|
|
4088
|
+
draftErrors: B,
|
|
4089
|
+
draftSaving: te,
|
|
4090
|
+
onChange: (e, t) => z((n) => n && {
|
|
4089
4091
|
...n,
|
|
4090
4092
|
[e]: t
|
|
4091
4093
|
}),
|
|
4092
|
-
onConfirm:
|
|
4094
|
+
onConfirm: ue,
|
|
4093
4095
|
onCancel: () => {
|
|
4094
|
-
|
|
4096
|
+
z(null), ee([]);
|
|
4095
4097
|
},
|
|
4096
|
-
refs:
|
|
4098
|
+
refs: l
|
|
4097
4099
|
})] })]
|
|
4098
4100
|
})
|
|
4099
4101
|
}),
|
|
4100
|
-
|
|
4101
|
-
open:
|
|
4102
|
+
H && /* @__PURE__ */ Z(Ot, {
|
|
4103
|
+
open: H.show,
|
|
4102
4104
|
onOpenChange: (e) => !e && U(null),
|
|
4103
4105
|
title: "Delete record",
|
|
4104
|
-
description:
|
|
4106
|
+
description: H.label ? `Are you sure you want to delete "${H.label}"?` : "Are you sure you want to delete this record?",
|
|
4105
4107
|
confirmLabel: "Delete",
|
|
4106
|
-
onConfirm: () => he(
|
|
4108
|
+
onConfirm: () => he(H.rowId),
|
|
4107
4109
|
destructive: !0
|
|
4108
4110
|
})
|
|
4109
4111
|
] });
|
|
4110
4112
|
}
|
|
4111
|
-
function li({ rowId: t, row: n, entity: r, entities: i, screens: a, columns:
|
|
4112
|
-
let
|
|
4113
|
+
function li({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: s, editableColumns: c, editable: l, interaction: d, isEditing: f, editErrors: p, isDeleting: m, rowState: h, onCellChange: g, onDeleteClick: _, onStartEdit: v, onConfirmEdit: y, onCancelEdit: b, refs: S, identityCol: C, href: w, rowActions: T, onRowActionSuccess: E }) {
|
|
4114
|
+
let D = j(), k = je(), A = q(() => !h || Object.keys(h.buffer).length === 0 ? n : {
|
|
4113
4115
|
...n,
|
|
4114
|
-
...
|
|
4115
|
-
}, [n,
|
|
4116
|
-
return
|
|
4117
|
-
values:
|
|
4116
|
+
...h.buffer
|
|
4117
|
+
}, [n, h]);
|
|
4118
|
+
return d === "row_edit" && f ? /* @__PURE__ */ Z(fi, {
|
|
4119
|
+
values: A,
|
|
4118
4120
|
entity: r,
|
|
4119
|
-
columns:
|
|
4120
|
-
editableColumns:
|
|
4121
|
-
errors:
|
|
4122
|
-
saving:
|
|
4123
|
-
onChange: (e, n) =>
|
|
4124
|
-
onConfirm: () =>
|
|
4125
|
-
onCancel: () =>
|
|
4126
|
-
refs:
|
|
4121
|
+
columns: s,
|
|
4122
|
+
editableColumns: c,
|
|
4123
|
+
errors: h?.error ? [...p, `_error:${h.error}`] : p,
|
|
4124
|
+
saving: h?.saving ?? !1,
|
|
4125
|
+
onChange: (e, n) => g(t, e, n),
|
|
4126
|
+
onConfirm: () => y(t),
|
|
4127
|
+
onCancel: () => b(t),
|
|
4128
|
+
refs: S
|
|
4127
4129
|
}) : /* @__PURE__ */ Q("div", {
|
|
4128
4130
|
style: {
|
|
4129
4131
|
border: "1px solid var(--border)",
|
|
4130
4132
|
borderRadius: 8,
|
|
4131
4133
|
background: "var(--surface)",
|
|
4132
|
-
opacity:
|
|
4134
|
+
opacity: m ? .58 : 1,
|
|
4133
4135
|
overflow: "hidden"
|
|
4134
4136
|
},
|
|
4135
4137
|
children: [/* @__PURE__ */ Z("div", {
|
|
@@ -4139,27 +4141,27 @@ function li({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
4139
4141
|
flexDirection: "column",
|
|
4140
4142
|
gap: 12
|
|
4141
4143
|
},
|
|
4142
|
-
children:
|
|
4143
|
-
let n = r.fields.get(e), o =
|
|
4144
|
+
children: s.map((e) => {
|
|
4145
|
+
let n = r.fields.get(e), o = l && d === "inline_edit" && c.has(e), s = w && e === C, u = n ? ie(n, e, i) : e, f = `${k}-${t}-${e}`, p = `${f}-label`, m = {
|
|
4144
4146
|
fontSize: 11.5,
|
|
4145
4147
|
fontWeight: 600,
|
|
4146
4148
|
color: "var(--text-3)"
|
|
4147
|
-
},
|
|
4149
|
+
}, h = n ? O({
|
|
4148
4150
|
field: n,
|
|
4149
4151
|
fieldName: e,
|
|
4150
|
-
value:
|
|
4152
|
+
value: A[e],
|
|
4151
4153
|
mode: o ? "edit" : "display",
|
|
4152
|
-
onChange: o ? (n) =>
|
|
4153
|
-
record:
|
|
4154
|
-
refs:
|
|
4154
|
+
onChange: o ? (n) => g(t, e, n) : void 0,
|
|
4155
|
+
record: A,
|
|
4156
|
+
refs: S,
|
|
4155
4157
|
compact: o,
|
|
4156
4158
|
entity: r,
|
|
4157
4159
|
entities: i,
|
|
4158
|
-
screens:
|
|
4160
|
+
screens: s ? void 0 : a,
|
|
4159
4161
|
fieldId: f,
|
|
4160
4162
|
labelId: p,
|
|
4161
|
-
locale:
|
|
4162
|
-
}) :
|
|
4163
|
+
locale: D
|
|
4164
|
+
}) : x(A[e]);
|
|
4163
4165
|
return /* @__PURE__ */ Q("div", {
|
|
4164
4166
|
style: {
|
|
4165
4167
|
display: "flex",
|
|
@@ -4171,26 +4173,26 @@ function li({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
4171
4173
|
id: p,
|
|
4172
4174
|
htmlFor: f,
|
|
4173
4175
|
style: m,
|
|
4174
|
-
children:
|
|
4176
|
+
children: u
|
|
4175
4177
|
}) : /* @__PURE__ */ Z("div", {
|
|
4176
4178
|
id: p,
|
|
4177
4179
|
style: m,
|
|
4178
|
-
children:
|
|
4180
|
+
children: u
|
|
4179
4181
|
}), /* @__PURE__ */ Z("div", {
|
|
4180
4182
|
style: { minWidth: 0 },
|
|
4181
|
-
children:
|
|
4182
|
-
href:
|
|
4183
|
+
children: s && !o ? /* @__PURE__ */ Z("a", {
|
|
4184
|
+
href: w,
|
|
4183
4185
|
style: {
|
|
4184
4186
|
color: "var(--accent)",
|
|
4185
4187
|
textDecoration: "none",
|
|
4186
4188
|
fontWeight: 500
|
|
4187
4189
|
},
|
|
4188
|
-
children:
|
|
4189
|
-
}) :
|
|
4190
|
+
children: h
|
|
4191
|
+
}) : h
|
|
4190
4192
|
})]
|
|
4191
4193
|
}, e);
|
|
4192
4194
|
})
|
|
4193
|
-
}), (
|
|
4195
|
+
}), (l || T && T.length > 0) && /* @__PURE__ */ Q("div", {
|
|
4194
4196
|
style: {
|
|
4195
4197
|
minHeight: 42,
|
|
4196
4198
|
padding: "6px 8px",
|
|
@@ -4200,101 +4202,101 @@ function li({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
4200
4202
|
justifyContent: "flex-end",
|
|
4201
4203
|
gap: 6
|
|
4202
4204
|
},
|
|
4203
|
-
children: [
|
|
4204
|
-
|
|
4205
|
-
|
|
4205
|
+
children: [l && /* @__PURE__ */ Q(X, { children: [
|
|
4206
|
+
h?.saving && /* @__PURE__ */ Z(u, { size: 12 }),
|
|
4207
|
+
h?.error && /* @__PURE__ */ Z("span", {
|
|
4206
4208
|
style: {
|
|
4207
4209
|
fontSize: 11,
|
|
4208
4210
|
color: "var(--danger)"
|
|
4209
4211
|
},
|
|
4210
|
-
title:
|
|
4212
|
+
title: h.error,
|
|
4211
4213
|
children: "!"
|
|
4212
4214
|
}),
|
|
4213
|
-
|
|
4215
|
+
d === "row_edit" && /* @__PURE__ */ Z(o, {
|
|
4214
4216
|
size: 32,
|
|
4215
4217
|
icon: /* @__PURE__ */ Z(e.edit, { size: 14 }),
|
|
4216
|
-
onClick: () =>
|
|
4218
|
+
onClick: () => v(t),
|
|
4217
4219
|
title: "Edit row"
|
|
4218
4220
|
}),
|
|
4219
|
-
/* @__PURE__ */ Z(
|
|
4221
|
+
/* @__PURE__ */ Z(o, {
|
|
4220
4222
|
size: 32,
|
|
4221
4223
|
icon: /* @__PURE__ */ Z(e.trash, { size: 14 }),
|
|
4222
|
-
onClick: () =>
|
|
4224
|
+
onClick: () => _(t),
|
|
4223
4225
|
title: "Delete row"
|
|
4224
4226
|
})
|
|
4225
|
-
] }), !
|
|
4226
|
-
actions:
|
|
4227
|
+
] }), !l && T && T.length > 0 && /* @__PURE__ */ Z(Tr, {
|
|
4228
|
+
actions: T,
|
|
4227
4229
|
objectIds: [t],
|
|
4228
|
-
row:
|
|
4229
|
-
onSuccess:
|
|
4230
|
+
row: A,
|
|
4231
|
+
onSuccess: E
|
|
4230
4232
|
})]
|
|
4231
4233
|
})]
|
|
4232
4234
|
});
|
|
4233
4235
|
}
|
|
4234
|
-
function ui({ rowId: t, row: n, entity: r, entities: i, screens: a, columns:
|
|
4235
|
-
let
|
|
4236
|
+
function ui({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: s, editableColumns: c, editable: l, interaction: d, isEditing: f, editErrors: p, isDeleting: m, activeCell: h, setActiveCell: g, rowState: _, onCellChange: v, onDeleteClick: y, onStartEdit: b, onConfirmEdit: S, onCancelEdit: C, refs: w, identityCol: T, href: E, rowActions: D, onRowActionSuccess: k }) {
|
|
4237
|
+
let A = j(), M = q(() => !_ || Object.keys(_.buffer).length === 0 ? n : {
|
|
4236
4238
|
...n,
|
|
4237
|
-
...
|
|
4238
|
-
}, [n,
|
|
4239
|
-
if (
|
|
4240
|
-
values:
|
|
4239
|
+
..._.buffer
|
|
4240
|
+
}, [n, _]);
|
|
4241
|
+
if (d === "row_edit" && f) return /* @__PURE__ */ Z(di, {
|
|
4242
|
+
values: M,
|
|
4241
4243
|
entity: r,
|
|
4242
|
-
columns:
|
|
4243
|
-
editableColumns:
|
|
4244
|
-
errors:
|
|
4245
|
-
saving:
|
|
4246
|
-
onChange: (e, n) =>
|
|
4247
|
-
onConfirm: () =>
|
|
4248
|
-
onCancel: () =>
|
|
4249
|
-
refs:
|
|
4244
|
+
columns: s,
|
|
4245
|
+
editableColumns: c,
|
|
4246
|
+
errors: _?.error ? [...p, `_error:${_.error}`] : p,
|
|
4247
|
+
saving: _?.saving ?? !1,
|
|
4248
|
+
onChange: (e, n) => v(t, e, n),
|
|
4249
|
+
onConfirm: () => S(t),
|
|
4250
|
+
onCancel: () => C(t),
|
|
4251
|
+
refs: w
|
|
4250
4252
|
});
|
|
4251
|
-
let
|
|
4253
|
+
let N = De, P = {
|
|
4252
4254
|
padding: "4px 4px",
|
|
4253
4255
|
borderBottom: "1px solid var(--divider)",
|
|
4254
4256
|
verticalAlign: "middle"
|
|
4255
|
-
},
|
|
4257
|
+
}, F = d === "inline_edit";
|
|
4256
4258
|
return /* @__PURE__ */ Q("tr", {
|
|
4257
|
-
style: { opacity:
|
|
4259
|
+
style: { opacity: m ? .5 : 1 },
|
|
4258
4260
|
children: [
|
|
4259
|
-
|
|
4260
|
-
let n = r.fields.get(e), o =
|
|
4261
|
-
if (
|
|
4262
|
-
style:
|
|
4263
|
-
children: n ?
|
|
4261
|
+
s.map((e) => {
|
|
4262
|
+
let n = r.fields.get(e), o = c.has(e);
|
|
4263
|
+
if (F && h?.rowId === t && h?.col === e && o) return /* @__PURE__ */ Z("td", {
|
|
4264
|
+
style: P,
|
|
4265
|
+
children: n ? O({
|
|
4264
4266
|
field: n,
|
|
4265
4267
|
fieldName: e,
|
|
4266
|
-
value:
|
|
4268
|
+
value: M[e],
|
|
4267
4269
|
mode: "edit",
|
|
4268
|
-
onChange: (n) =>
|
|
4269
|
-
record:
|
|
4270
|
-
refs:
|
|
4270
|
+
onChange: (n) => v(t, e, n),
|
|
4271
|
+
record: M,
|
|
4272
|
+
refs: w,
|
|
4271
4273
|
compact: !0,
|
|
4272
|
-
locale:
|
|
4273
|
-
}) :
|
|
4274
|
+
locale: A
|
|
4275
|
+
}) : x(M[e])
|
|
4274
4276
|
}, e);
|
|
4275
|
-
let
|
|
4277
|
+
let s = E && e === T, l = n ? O({
|
|
4276
4278
|
field: n,
|
|
4277
4279
|
fieldName: e,
|
|
4278
|
-
value:
|
|
4280
|
+
value: M[e],
|
|
4279
4281
|
mode: "display",
|
|
4280
|
-
record:
|
|
4281
|
-
refs:
|
|
4282
|
+
record: M,
|
|
4283
|
+
refs: w,
|
|
4282
4284
|
entity: r,
|
|
4283
4285
|
entities: i,
|
|
4284
|
-
screens:
|
|
4285
|
-
locale:
|
|
4286
|
-
}) :
|
|
4286
|
+
screens: s ? void 0 : a,
|
|
4287
|
+
locale: A
|
|
4288
|
+
}) : x(M[e]), u = F && o && !m;
|
|
4287
4289
|
return /* @__PURE__ */ Z("td", {
|
|
4288
4290
|
style: {
|
|
4289
|
-
...
|
|
4291
|
+
...N,
|
|
4290
4292
|
cursor: u ? "pointer" : "default"
|
|
4291
4293
|
},
|
|
4292
|
-
onClick: u ? () =>
|
|
4294
|
+
onClick: u ? () => g({
|
|
4293
4295
|
rowId: t,
|
|
4294
4296
|
col: e
|
|
4295
4297
|
}) : void 0,
|
|
4296
|
-
children:
|
|
4297
|
-
href:
|
|
4298
|
+
children: s ? /* @__PURE__ */ Z("a", {
|
|
4299
|
+
href: E,
|
|
4298
4300
|
style: {
|
|
4299
4301
|
color: "var(--accent)",
|
|
4300
4302
|
textDecoration: "none",
|
|
@@ -4306,7 +4308,7 @@ function ui({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
4306
4308
|
}) : l
|
|
4307
4309
|
}, e);
|
|
4308
4310
|
}),
|
|
4309
|
-
|
|
4311
|
+
l && /* @__PURE__ */ Z("td", {
|
|
4310
4312
|
style: {
|
|
4311
4313
|
padding: "4px 8px",
|
|
4312
4314
|
borderBottom: "1px solid var(--divider)",
|
|
@@ -4319,96 +4321,96 @@ function ui({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
4319
4321
|
gap: 4
|
|
4320
4322
|
},
|
|
4321
4323
|
children: [
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
+
_?.saving && /* @__PURE__ */ Z(u, { size: 12 }),
|
|
4325
|
+
_?.error && /* @__PURE__ */ Z("span", {
|
|
4324
4326
|
style: {
|
|
4325
4327
|
fontSize: 11,
|
|
4326
4328
|
color: "var(--danger)"
|
|
4327
4329
|
},
|
|
4328
|
-
title:
|
|
4330
|
+
title: _.error,
|
|
4329
4331
|
children: "!"
|
|
4330
4332
|
}),
|
|
4331
|
-
|
|
4333
|
+
d === "row_edit" && /* @__PURE__ */ Z(o, {
|
|
4332
4334
|
size: 24,
|
|
4333
4335
|
icon: /* @__PURE__ */ Z(e.edit, { size: 12 }),
|
|
4334
|
-
onClick: () =>
|
|
4336
|
+
onClick: () => b(t),
|
|
4335
4337
|
title: "Edit row"
|
|
4336
4338
|
}),
|
|
4337
|
-
/* @__PURE__ */ Z(
|
|
4339
|
+
/* @__PURE__ */ Z(o, {
|
|
4338
4340
|
size: 24,
|
|
4339
4341
|
icon: /* @__PURE__ */ Z(e.trash, { size: 12 }),
|
|
4340
|
-
onClick: () =>
|
|
4342
|
+
onClick: () => y(t),
|
|
4341
4343
|
title: "Delete row"
|
|
4342
4344
|
})
|
|
4343
4345
|
]
|
|
4344
4346
|
})
|
|
4345
4347
|
}),
|
|
4346
|
-
!
|
|
4348
|
+
!l && D && D.length > 0 && /* @__PURE__ */ Z("td", {
|
|
4347
4349
|
style: {
|
|
4348
4350
|
padding: "4px 8px",
|
|
4349
4351
|
borderBottom: "1px solid var(--divider)",
|
|
4350
4352
|
verticalAlign: "middle"
|
|
4351
4353
|
},
|
|
4352
4354
|
children: /* @__PURE__ */ Z(Tr, {
|
|
4353
|
-
actions:
|
|
4355
|
+
actions: D,
|
|
4354
4356
|
objectIds: [t],
|
|
4355
|
-
row:
|
|
4356
|
-
onSuccess:
|
|
4357
|
+
row: M,
|
|
4358
|
+
onSuccess: k
|
|
4357
4359
|
})
|
|
4358
4360
|
})
|
|
4359
4361
|
]
|
|
4360
4362
|
});
|
|
4361
4363
|
}
|
|
4362
|
-
function di({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving:
|
|
4363
|
-
let
|
|
4364
|
+
function di({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving: s, onChange: c, onConfirm: l, onCancel: d, refs: f, accent: p }) {
|
|
4365
|
+
let m = j(), h = a.find((e) => e.startsWith("_error:")), g = new Set(a.filter((e) => !e.startsWith("_error:"))), _ = {
|
|
4364
4366
|
padding: "6px 12px",
|
|
4365
4367
|
borderBottom: "1px solid var(--divider)",
|
|
4366
4368
|
verticalAlign: "middle",
|
|
4367
4369
|
height: 40,
|
|
4368
4370
|
minWidth: 0
|
|
4369
|
-
},
|
|
4371
|
+
}, v = {
|
|
4370
4372
|
display: "block",
|
|
4371
4373
|
width: "100%",
|
|
4372
4374
|
maxWidth: "100%",
|
|
4373
4375
|
minWidth: 0
|
|
4374
4376
|
};
|
|
4375
4377
|
return /* @__PURE__ */ Q("tr", {
|
|
4376
|
-
style:
|
|
4378
|
+
style: p ? { boxShadow: "inset 3px 0 0 var(--accent)" } : void 0,
|
|
4377
4379
|
onKeyDown: (e) => {
|
|
4378
|
-
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(),
|
|
4380
|
+
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), l()) : e.key === "Escape" && (e.preventDefault(), d());
|
|
4379
4381
|
},
|
|
4380
4382
|
children: [r.map((e) => {
|
|
4381
|
-
let r = n.fields.get(e), a = i.has(e), o =
|
|
4383
|
+
let r = n.fields.get(e), a = i.has(e), o = g.has(e);
|
|
4382
4384
|
return a ? /* @__PURE__ */ Z("td", {
|
|
4383
4385
|
style: {
|
|
4384
|
-
...
|
|
4386
|
+
..._,
|
|
4385
4387
|
outline: o ? "1px solid var(--danger)" : "none",
|
|
4386
4388
|
outlineOffset: -1
|
|
4387
4389
|
},
|
|
4388
4390
|
title: o ? `${e} is required` : void 0,
|
|
4389
4391
|
children: /* @__PURE__ */ Z("div", {
|
|
4390
|
-
style:
|
|
4391
|
-
children: r ?
|
|
4392
|
+
style: v,
|
|
4393
|
+
children: r ? O({
|
|
4392
4394
|
field: r,
|
|
4393
4395
|
fieldName: e,
|
|
4394
4396
|
value: t[e],
|
|
4395
4397
|
mode: "edit",
|
|
4396
|
-
onChange: (t) =>
|
|
4398
|
+
onChange: (t) => c(e, t),
|
|
4397
4399
|
record: t,
|
|
4398
|
-
refs:
|
|
4400
|
+
refs: f,
|
|
4399
4401
|
compact: !0,
|
|
4400
|
-
locale:
|
|
4401
|
-
}) :
|
|
4402
|
+
locale: m
|
|
4403
|
+
}) : x(t[e])
|
|
4402
4404
|
})
|
|
4403
4405
|
}, e) : /* @__PURE__ */ Z("td", {
|
|
4404
4406
|
style: {
|
|
4405
|
-
...
|
|
4407
|
+
..._,
|
|
4406
4408
|
color: "var(--text-3)"
|
|
4407
4409
|
},
|
|
4408
|
-
children: r?.auto ? "—" :
|
|
4410
|
+
children: r?.auto ? "—" : x(t[e])
|
|
4409
4411
|
}, e);
|
|
4410
4412
|
}), /* @__PURE__ */ Z("td", {
|
|
4411
|
-
style:
|
|
4413
|
+
style: _,
|
|
4412
4414
|
children: /* @__PURE__ */ Q("div", {
|
|
4413
4415
|
style: {
|
|
4414
4416
|
display: "flex",
|
|
@@ -4417,24 +4419,24 @@ function di({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
|
|
|
4417
4419
|
justifyContent: "flex-end"
|
|
4418
4420
|
},
|
|
4419
4421
|
children: [
|
|
4420
|
-
|
|
4422
|
+
h && /* @__PURE__ */ Z("span", {
|
|
4421
4423
|
style: {
|
|
4422
4424
|
fontSize: 11,
|
|
4423
4425
|
color: "var(--danger)"
|
|
4424
4426
|
},
|
|
4425
|
-
title:
|
|
4427
|
+
title: h.slice(7),
|
|
4426
4428
|
children: "!"
|
|
4427
4429
|
}),
|
|
4428
|
-
/* @__PURE__ */ Z(
|
|
4430
|
+
/* @__PURE__ */ Z(o, {
|
|
4429
4431
|
size: 24,
|
|
4430
|
-
icon: Z(
|
|
4431
|
-
onClick:
|
|
4432
|
+
icon: Z(s ? u : e.check, { size: 12 }),
|
|
4433
|
+
onClick: l,
|
|
4432
4434
|
title: "Confirm (Enter)"
|
|
4433
4435
|
}),
|
|
4434
|
-
/* @__PURE__ */ Z(
|
|
4436
|
+
/* @__PURE__ */ Z(o, {
|
|
4435
4437
|
size: 24,
|
|
4436
4438
|
icon: /* @__PURE__ */ Z(e.x, { size: 12 }),
|
|
4437
|
-
onClick:
|
|
4439
|
+
onClick: d,
|
|
4438
4440
|
title: "Cancel (Esc)"
|
|
4439
4441
|
})
|
|
4440
4442
|
]
|
|
@@ -4442,18 +4444,18 @@ function di({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
|
|
|
4442
4444
|
})]
|
|
4443
4445
|
});
|
|
4444
4446
|
}
|
|
4445
|
-
function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving:
|
|
4446
|
-
let
|
|
4447
|
+
function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving: s, onChange: c, onConfirm: l, onCancel: d, refs: f, accent: p }) {
|
|
4448
|
+
let m = j(), h = je(), g = a.find((e) => e.startsWith("_error:")), _ = new Set(a.filter((e) => !e.startsWith("_error:")));
|
|
4447
4449
|
return /* @__PURE__ */ Q("div", {
|
|
4448
4450
|
style: {
|
|
4449
4451
|
border: "1px solid var(--border)",
|
|
4450
4452
|
borderRadius: 8,
|
|
4451
4453
|
background: "var(--surface)",
|
|
4452
4454
|
overflow: "hidden",
|
|
4453
|
-
boxShadow:
|
|
4455
|
+
boxShadow: p ? "inset 3px 0 0 var(--accent)" : void 0
|
|
4454
4456
|
},
|
|
4455
4457
|
onKeyDown: (e) => {
|
|
4456
|
-
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(),
|
|
4458
|
+
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), l()) : e.key === "Escape" && (e.preventDefault(), d());
|
|
4457
4459
|
},
|
|
4458
4460
|
children: [/* @__PURE__ */ Z("div", {
|
|
4459
4461
|
style: {
|
|
@@ -4463,7 +4465,7 @@ function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
|
|
|
4463
4465
|
gap: 12
|
|
4464
4466
|
},
|
|
4465
4467
|
children: r.map((e) => {
|
|
4466
|
-
let r = n.fields.get(e), a = i.has(e), o =
|
|
4468
|
+
let r = n.fields.get(e), a = i.has(e), o = _.has(e), s = r ? ie(r, e) : e, l = `${h}-${e}`, u = `${l}-label`, d = {
|
|
4467
4469
|
fontSize: 11.5,
|
|
4468
4470
|
fontWeight: 600,
|
|
4469
4471
|
color: "var(--text-3)"
|
|
@@ -4476,14 +4478,14 @@ function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
|
|
|
4476
4478
|
minWidth: 0
|
|
4477
4479
|
},
|
|
4478
4480
|
children: [a && r ? /* @__PURE__ */ Z("label", {
|
|
4479
|
-
id:
|
|
4481
|
+
id: u,
|
|
4480
4482
|
htmlFor: l,
|
|
4481
|
-
style:
|
|
4482
|
-
children:
|
|
4483
|
+
style: d,
|
|
4484
|
+
children: s
|
|
4483
4485
|
}) : /* @__PURE__ */ Z("div", {
|
|
4484
|
-
id:
|
|
4485
|
-
style:
|
|
4486
|
-
children:
|
|
4486
|
+
id: u,
|
|
4487
|
+
style: d,
|
|
4488
|
+
children: s
|
|
4487
4489
|
}), /* @__PURE__ */ Z("div", {
|
|
4488
4490
|
style: {
|
|
4489
4491
|
minWidth: 0,
|
|
@@ -4492,19 +4494,19 @@ function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
|
|
|
4492
4494
|
borderRadius: o ? 5 : 0
|
|
4493
4495
|
},
|
|
4494
4496
|
title: o ? `${e} is required` : void 0,
|
|
4495
|
-
children: a ? r ?
|
|
4497
|
+
children: a ? r ? O({
|
|
4496
4498
|
field: r,
|
|
4497
4499
|
fieldName: e,
|
|
4498
4500
|
value: t[e],
|
|
4499
4501
|
mode: "edit",
|
|
4500
|
-
onChange: (t) =>
|
|
4502
|
+
onChange: (t) => c(e, t),
|
|
4501
4503
|
record: t,
|
|
4502
|
-
refs:
|
|
4504
|
+
refs: f,
|
|
4503
4505
|
compact: !0,
|
|
4504
4506
|
fieldId: l,
|
|
4505
|
-
labelId:
|
|
4506
|
-
locale:
|
|
4507
|
-
}) :
|
|
4507
|
+
labelId: u,
|
|
4508
|
+
locale: m
|
|
4509
|
+
}) : x(t[e]) : r?.auto ? "—" : x(t[e])
|
|
4508
4510
|
})]
|
|
4509
4511
|
}, e);
|
|
4510
4512
|
})
|
|
@@ -4519,24 +4521,24 @@ function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
|
|
|
4519
4521
|
gap: 6
|
|
4520
4522
|
},
|
|
4521
4523
|
children: [
|
|
4522
|
-
|
|
4524
|
+
g && /* @__PURE__ */ Z("span", {
|
|
4523
4525
|
style: {
|
|
4524
4526
|
fontSize: 11,
|
|
4525
4527
|
color: "var(--danger)"
|
|
4526
4528
|
},
|
|
4527
|
-
title:
|
|
4529
|
+
title: g.slice(7),
|
|
4528
4530
|
children: "!"
|
|
4529
4531
|
}),
|
|
4530
|
-
/* @__PURE__ */ Z(
|
|
4532
|
+
/* @__PURE__ */ Z(o, {
|
|
4531
4533
|
size: 32,
|
|
4532
|
-
icon: Z(
|
|
4533
|
-
onClick:
|
|
4534
|
+
icon: Z(s ? u : e.check, { size: 14 }),
|
|
4535
|
+
onClick: l,
|
|
4534
4536
|
title: "Confirm (Enter)"
|
|
4535
4537
|
}),
|
|
4536
|
-
/* @__PURE__ */ Z(
|
|
4538
|
+
/* @__PURE__ */ Z(o, {
|
|
4537
4539
|
size: 32,
|
|
4538
4540
|
icon: /* @__PURE__ */ Z(e.x, { size: 14 }),
|
|
4539
|
-
onClick:
|
|
4541
|
+
onClick: d,
|
|
4540
4542
|
title: "Cancel (Esc)"
|
|
4541
4543
|
})
|
|
4542
4544
|
]
|
|
@@ -4755,49 +4757,49 @@ function Ti(e, t) {
|
|
|
4755
4757
|
//#endregion
|
|
4756
4758
|
//#region src/hooks/useScreenBack.ts
|
|
4757
4759
|
function Ei(e) {
|
|
4758
|
-
let t = Pe(),
|
|
4760
|
+
let t = Pe(), r = n(), i = c(), a = Tt((e) => e.depth), { data: o } = A(), s = e?.fallback, l = wt((e) => {
|
|
4759
4761
|
let t = e.tabs.find((t) => t.id === e.activeTabId);
|
|
4760
4762
|
return t ? t.returnTo : void 0;
|
|
4761
|
-
}), { hasOriginBack:
|
|
4762
|
-
if (
|
|
4763
|
-
Tt.getState().depth > 0 ?
|
|
4763
|
+
}), { hasOriginBack: u, allowFallbackBack: d } = q(() => Mt(l, r.enabled), [l, r.enabled]), f = G(() => {
|
|
4764
|
+
if (r.enabled) {
|
|
4765
|
+
Tt.getState().depth > 0 ? i() : s?.();
|
|
4764
4766
|
return;
|
|
4765
4767
|
}
|
|
4766
|
-
let e = wt.getState(),
|
|
4767
|
-
if (!
|
|
4768
|
-
|
|
4768
|
+
let e = wt.getState(), n = Nt(e.tabs.find((t) => t.id === e.activeTabId)?.returnTo, e.tabs, !1);
|
|
4769
|
+
if (!n) {
|
|
4770
|
+
s?.();
|
|
4769
4771
|
return;
|
|
4770
4772
|
}
|
|
4771
|
-
if (
|
|
4772
|
-
else if (
|
|
4773
|
-
let t =
|
|
4773
|
+
if (n.kind === "live" && n.tabId) e.commitTabNavigation(n.tabId, { search: n.search ?? "" });
|
|
4774
|
+
else if (n.kind === "reopen") {
|
|
4775
|
+
let t = n.title ? void 0 : oe(n.pathname, o?.screens, o?.entities);
|
|
4774
4776
|
e.openTab({
|
|
4775
|
-
pathname:
|
|
4776
|
-
search:
|
|
4777
|
-
title:
|
|
4778
|
-
icon:
|
|
4779
|
-
screen:
|
|
4777
|
+
pathname: n.pathname,
|
|
4778
|
+
search: n.search ?? "",
|
|
4779
|
+
title: n.title ?? t?.title ?? n.pathname,
|
|
4780
|
+
icon: n.icon ?? t?.icon,
|
|
4781
|
+
screen: n.screen,
|
|
4780
4782
|
closable: !0
|
|
4781
4783
|
});
|
|
4782
4784
|
}
|
|
4783
4785
|
t({
|
|
4784
|
-
pathname:
|
|
4785
|
-
search: At(
|
|
4786
|
-
hash:
|
|
4786
|
+
pathname: n.pathname,
|
|
4787
|
+
search: At(n.search),
|
|
4788
|
+
hash: n.hash || void 0
|
|
4787
4789
|
});
|
|
4788
4790
|
}, [
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4791
|
+
r.enabled,
|
|
4792
|
+
i,
|
|
4793
|
+
s,
|
|
4792
4794
|
t,
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
+
o?.screens,
|
|
4796
|
+
o?.entities
|
|
4795
4797
|
]);
|
|
4796
4798
|
return {
|
|
4797
|
-
canGoBack:
|
|
4798
|
-
hasOriginBack:
|
|
4799
|
-
allowFallbackBack:
|
|
4800
|
-
goBack:
|
|
4799
|
+
canGoBack: r.enabled ? a > 0 || !!s : u || !!s,
|
|
4800
|
+
hasOriginBack: u,
|
|
4801
|
+
allowFallbackBack: d,
|
|
4802
|
+
goBack: f
|
|
4801
4803
|
};
|
|
4802
4804
|
}
|
|
4803
4805
|
//#endregion
|
|
@@ -5074,7 +5076,7 @@ function sa(e, t) {
|
|
|
5074
5076
|
function ca(e, t) {
|
|
5075
5077
|
if (!e) return [];
|
|
5076
5078
|
let n = new $();
|
|
5077
|
-
for (let r of
|
|
5079
|
+
for (let r of z(e)) n.add(r), t.addField(r, "identity");
|
|
5078
5080
|
let r = Qi(e, e.display.display_field, { explicit: !0 });
|
|
5079
5081
|
r && (n.add(r), t.addField(r, "display"), xa(e, r, t, "display"));
|
|
5080
5082
|
for (let r of la(e.display.display_template)) {
|
|
@@ -5334,7 +5336,7 @@ var $ = class {
|
|
|
5334
5336
|
},
|
|
5335
5337
|
children: this.state.error?.message || "An unexpected error occurred."
|
|
5336
5338
|
}),
|
|
5337
|
-
/* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(
|
|
5339
|
+
/* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(l, {
|
|
5338
5340
|
onClick: this.handleRetry,
|
|
5339
5341
|
children: "Try again"
|
|
5340
5342
|
}) })
|
|
@@ -5356,7 +5358,7 @@ function Da(e, t) {
|
|
|
5356
5358
|
let n = Ea(e, t), r = n[2];
|
|
5357
5359
|
return Le({
|
|
5358
5360
|
queryKey: n,
|
|
5359
|
-
queryFn: () =>
|
|
5361
|
+
queryFn: () => C(e, t),
|
|
5360
5362
|
enabled: !!e && !!t && t !== "new" && r !== void 0
|
|
5361
5363
|
});
|
|
5362
5364
|
}
|