@declarion/react 0.36.3 → 0.36.4
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-DRpSyfhM.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-Bm_XARHf.js} +234 -234
- package/dist-lib/{SmartRecordListPage.impl-Y0w4oIe3.js → SmartRecordListPage.impl-BEAzY8Ce.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-F_ieiQHj.js} +1032 -1032
- 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-inTonnKw.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,65 @@ 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 (
|
|
3114
|
+
if (N || !f || !S || v === 0) return;
|
|
3115
3115
|
let e = [...b.entries()].filter(([e]) => e !== Ur).reduce((e, [, t]) => e + t, 0);
|
|
3116
3116
|
e > 0 && v <= e && console.error(`[declarion] ResponsiveActionBar has no room to measure: its container is ${Math.round(v)}px and its buttons are ${Math.round(e)}px. The slot holding this bar is sized by its own content, so the bar is measuring itself. 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
3117
|
}, [
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3118
|
+
N,
|
|
3119
|
+
f,
|
|
3120
|
+
S,
|
|
3121
3121
|
v,
|
|
3122
3122
|
b
|
|
3123
3123
|
]), K(() => {
|
|
3124
|
-
if (
|
|
3125
|
-
let e =
|
|
3124
|
+
if (N) return;
|
|
3125
|
+
let e = g.current;
|
|
3126
3126
|
if (!e) return;
|
|
3127
3127
|
if (typeof ResizeObserver > "u") {
|
|
3128
3128
|
y(e.getBoundingClientRect().width);
|
|
@@ -3133,45 +3133,45 @@ function Jr({ layout: r, entityActions: i, globalActions: a, onRun: o, reservedR
|
|
|
3133
3133
|
t && y(t.contentRect.width);
|
|
3134
3134
|
});
|
|
3135
3135
|
return t.observe(e), y(e.getBoundingClientRect().width), () => t.disconnect();
|
|
3136
|
-
}, [
|
|
3137
|
-
let
|
|
3136
|
+
}, [N]);
|
|
3137
|
+
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
3138
|
primaryInline: [],
|
|
3139
3139
|
inline: [],
|
|
3140
3140
|
overflow: [],
|
|
3141
3141
|
destructiveInline: []
|
|
3142
3142
|
}, [
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3143
|
+
N,
|
|
3144
|
+
f,
|
|
3145
|
+
S,
|
|
3146
3146
|
v,
|
|
3147
|
-
|
|
3148
|
-
|
|
3147
|
+
n,
|
|
3148
|
+
o,
|
|
3149
3149
|
b,
|
|
3150
|
+
r,
|
|
3150
3151
|
i,
|
|
3151
|
-
a,
|
|
3152
3152
|
c
|
|
3153
3153
|
]);
|
|
3154
|
-
if (
|
|
3155
|
-
let
|
|
3154
|
+
if (M === 0) return null;
|
|
3155
|
+
let I = F.overflow.length > 0;
|
|
3156
3156
|
return /* @__PURE__ */ Q("div", {
|
|
3157
|
-
ref:
|
|
3157
|
+
ref: g,
|
|
3158
3158
|
role: "toolbar",
|
|
3159
|
-
"aria-label":
|
|
3159
|
+
"aria-label": u,
|
|
3160
3160
|
style: {
|
|
3161
3161
|
display: "flex",
|
|
3162
|
-
flexDirection:
|
|
3162
|
+
flexDirection: E ? "row-reverse" : "row",
|
|
3163
3163
|
alignItems: "center",
|
|
3164
3164
|
gap: 4,
|
|
3165
|
-
visibility:
|
|
3165
|
+
visibility: S || N ? "visible" : "hidden",
|
|
3166
3166
|
position: "relative",
|
|
3167
|
-
flex:
|
|
3168
|
-
justifyContent:
|
|
3167
|
+
flex: f ? "1 1 auto" : "0 1 auto",
|
|
3168
|
+
justifyContent: d === "trailing" ? "flex-end" : "flex-start",
|
|
3169
3169
|
minWidth: 0,
|
|
3170
3170
|
boxSizing: "border-box"
|
|
3171
3171
|
},
|
|
3172
3172
|
children: [
|
|
3173
3173
|
/* @__PURE__ */ Q("div", {
|
|
3174
|
-
ref:
|
|
3174
|
+
ref: _,
|
|
3175
3175
|
"aria-hidden": "true",
|
|
3176
3176
|
style: {
|
|
3177
3177
|
position: "absolute",
|
|
@@ -3182,17 +3182,17 @@ function Jr({ layout: r, entityActions: i, globalActions: a, onRun: o, reservedR
|
|
|
3182
3182
|
top: 0,
|
|
3183
3183
|
left: 0
|
|
3184
3184
|
},
|
|
3185
|
-
children: [/* @__PURE__ */ Z(
|
|
3185
|
+
children: [/* @__PURE__ */ Z(l, {
|
|
3186
3186
|
"data-node-key": Ur,
|
|
3187
3187
|
iconRight: /* @__PURE__ */ Z(e.down, { size: 10 }),
|
|
3188
3188
|
tabIndex: -1,
|
|
3189
3189
|
children: "Actions"
|
|
3190
|
-
}, Ur),
|
|
3191
|
-
let
|
|
3190
|
+
}, Ur), n.map((n) => {
|
|
3191
|
+
let a = qr(n);
|
|
3192
3192
|
if (n.kind === "action") {
|
|
3193
|
-
let e = Pr(n.code,
|
|
3194
|
-
return /* @__PURE__ */ Z(
|
|
3195
|
-
"data-node-key":
|
|
3193
|
+
let e = Pr(n.code, r, i), o = Fr(n.code, r, i), s = Ir(n.code, r, i);
|
|
3194
|
+
return /* @__PURE__ */ Z(l, {
|
|
3195
|
+
"data-node-key": a,
|
|
3196
3196
|
icon: s ? /* @__PURE__ */ Z(t, {
|
|
3197
3197
|
name: s,
|
|
3198
3198
|
size: 12
|
|
@@ -3200,97 +3200,97 @@ function Jr({ layout: r, entityActions: i, globalActions: a, onRun: o, reservedR
|
|
|
3200
3200
|
danger: e?.destructive,
|
|
3201
3201
|
tabIndex: -1,
|
|
3202
3202
|
children: o
|
|
3203
|
-
},
|
|
3203
|
+
}, a);
|
|
3204
3204
|
} else {
|
|
3205
|
-
let t = n.name ?
|
|
3206
|
-
return /* @__PURE__ */ Z(
|
|
3207
|
-
"data-node-key":
|
|
3205
|
+
let t = n.name ? W(n.name) : "Actions";
|
|
3206
|
+
return /* @__PURE__ */ Z(l, {
|
|
3207
|
+
"data-node-key": a,
|
|
3208
3208
|
iconRight: /* @__PURE__ */ Z(e.down, { size: 10 }),
|
|
3209
3209
|
tabIndex: -1,
|
|
3210
3210
|
children: t
|
|
3211
|
-
},
|
|
3211
|
+
}, a);
|
|
3212
3212
|
}
|
|
3213
3213
|
})]
|
|
3214
3214
|
}),
|
|
3215
|
-
|
|
3215
|
+
F.primaryInline.map((e) => /* @__PURE__ */ Z(Rr, {
|
|
3216
3216
|
leaf: e,
|
|
3217
|
-
entityActions:
|
|
3218
|
-
globalActions:
|
|
3219
|
-
onRun:
|
|
3220
|
-
loading:
|
|
3221
|
-
onLoadingChange: (t) =>
|
|
3222
|
-
row:
|
|
3223
|
-
widgetContext:
|
|
3224
|
-
onActionClick:
|
|
3217
|
+
entityActions: r,
|
|
3218
|
+
globalActions: i,
|
|
3219
|
+
onRun: a,
|
|
3220
|
+
loading: w === e.code,
|
|
3221
|
+
onLoadingChange: (t) => T(t ? e.code : null),
|
|
3222
|
+
row: p,
|
|
3223
|
+
widgetContext: m,
|
|
3224
|
+
onActionClick: h
|
|
3225
3225
|
}, qr(e))),
|
|
3226
|
-
|
|
3226
|
+
F.inline.map((e) => {
|
|
3227
3227
|
let t = qr(e);
|
|
3228
3228
|
return e.kind === "action" ? /* @__PURE__ */ Z(Rr, {
|
|
3229
3229
|
leaf: e,
|
|
3230
|
-
entityActions:
|
|
3231
|
-
globalActions:
|
|
3232
|
-
onRun:
|
|
3233
|
-
loading:
|
|
3234
|
-
onLoadingChange: (t) =>
|
|
3235
|
-
row:
|
|
3236
|
-
widgetContext:
|
|
3237
|
-
onActionClick:
|
|
3230
|
+
entityActions: r,
|
|
3231
|
+
globalActions: i,
|
|
3232
|
+
onRun: a,
|
|
3233
|
+
loading: w === e.code,
|
|
3234
|
+
onLoadingChange: (t) => T(t ? e.code : null),
|
|
3235
|
+
row: p,
|
|
3236
|
+
widgetContext: m,
|
|
3237
|
+
onActionClick: h
|
|
3238
3238
|
}, t) : /* @__PURE__ */ Z(zr, {
|
|
3239
3239
|
group: e,
|
|
3240
|
-
entityActions:
|
|
3241
|
-
globalActions:
|
|
3242
|
-
onRun:
|
|
3243
|
-
loading:
|
|
3244
|
-
onLoadingChange:
|
|
3240
|
+
entityActions: r,
|
|
3241
|
+
globalActions: i,
|
|
3242
|
+
onRun: a,
|
|
3243
|
+
loading: w,
|
|
3244
|
+
onLoadingChange: T
|
|
3245
3245
|
}, t);
|
|
3246
3246
|
}),
|
|
3247
|
-
|
|
3248
|
-
ref:
|
|
3247
|
+
I && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(l, {
|
|
3248
|
+
ref: O,
|
|
3249
3249
|
kind: "default",
|
|
3250
3250
|
iconRight: /* @__PURE__ */ Z(e.down, { size: 10 }),
|
|
3251
3251
|
"aria-haspopup": "menu",
|
|
3252
|
-
"aria-expanded":
|
|
3253
|
-
onClick: () =>
|
|
3252
|
+
"aria-expanded": k ? "true" : "false",
|
|
3253
|
+
onClick: () => A((e) => !e),
|
|
3254
3254
|
children: "Actions"
|
|
3255
|
-
}), /* @__PURE__ */ Z(
|
|
3256
|
-
open:
|
|
3257
|
-
anchor:
|
|
3258
|
-
onClose: () =>
|
|
3259
|
-
align:
|
|
3255
|
+
}), /* @__PURE__ */ Z(s, {
|
|
3256
|
+
open: k,
|
|
3257
|
+
anchor: O.current,
|
|
3258
|
+
onClose: () => A(!1),
|
|
3259
|
+
align: E ? "start" : "end",
|
|
3260
3260
|
width: 220,
|
|
3261
3261
|
children: /* @__PURE__ */ Z("div", {
|
|
3262
3262
|
role: "menu",
|
|
3263
3263
|
"aria-label": "More actions",
|
|
3264
|
-
children:
|
|
3264
|
+
children: F.overflow.map((e) => e.kind === "action" ? /* @__PURE__ */ Z(Br, {
|
|
3265
3265
|
leaf: e,
|
|
3266
|
-
entityActions:
|
|
3267
|
-
globalActions:
|
|
3268
|
-
onRun:
|
|
3269
|
-
loading:
|
|
3270
|
-
onLoadingChange: (t) =>
|
|
3271
|
-
row:
|
|
3272
|
-
widgetContext:
|
|
3273
|
-
onActionClick:
|
|
3266
|
+
entityActions: r,
|
|
3267
|
+
globalActions: i,
|
|
3268
|
+
onRun: j,
|
|
3269
|
+
loading: w === e.code,
|
|
3270
|
+
onLoadingChange: (t) => T(t ? e.code : null),
|
|
3271
|
+
row: p,
|
|
3272
|
+
widgetContext: m,
|
|
3273
|
+
onActionClick: h
|
|
3274
3274
|
}, e.code) : /* @__PURE__ */ Z(Vr, {
|
|
3275
3275
|
group: e,
|
|
3276
|
-
entityActions:
|
|
3277
|
-
globalActions:
|
|
3278
|
-
onRun:
|
|
3279
|
-
loading:
|
|
3280
|
-
onLoadingChange:
|
|
3276
|
+
entityActions: r,
|
|
3277
|
+
globalActions: i,
|
|
3278
|
+
onRun: j,
|
|
3279
|
+
loading: w,
|
|
3280
|
+
onLoadingChange: T
|
|
3281
3281
|
}, qr(e)))
|
|
3282
3282
|
})
|
|
3283
3283
|
})] }),
|
|
3284
|
-
|
|
3284
|
+
F.destructiveInline.map((e) => /* @__PURE__ */ Z(Rr, {
|
|
3285
3285
|
leaf: e,
|
|
3286
|
-
entityActions:
|
|
3287
|
-
globalActions:
|
|
3288
|
-
onRun:
|
|
3289
|
-
loading:
|
|
3290
|
-
onLoadingChange: (t) =>
|
|
3291
|
-
row:
|
|
3292
|
-
widgetContext:
|
|
3293
|
-
onActionClick:
|
|
3286
|
+
entityActions: r,
|
|
3287
|
+
globalActions: i,
|
|
3288
|
+
onRun: a,
|
|
3289
|
+
loading: w === e.code,
|
|
3290
|
+
onLoadingChange: (t) => T(t ? e.code : null),
|
|
3291
|
+
row: p,
|
|
3292
|
+
widgetContext: m,
|
|
3293
|
+
onActionClick: h
|
|
3294
3294
|
}, qr(e)))
|
|
3295
3295
|
]
|
|
3296
3296
|
});
|
|
@@ -3362,7 +3362,7 @@ function Xr({ layout: e, row: t, rowSelection: n, onRun: r, reservedRightWidth:
|
|
|
3362
3362
|
//#endregion
|
|
3363
3363
|
//#region src/lib/action-dispatch.ts
|
|
3364
3364
|
function Zr(e, t, n, r) {
|
|
3365
|
-
return
|
|
3365
|
+
return ne(t) ? (E(t.ui_steps, n), null) : t.entity ? `${t.entity}.${e}` : r ? `${r}.${e}` : e;
|
|
3366
3366
|
}
|
|
3367
3367
|
//#endregion
|
|
3368
3368
|
//#region src/components/detail-layout/AssociatedBlock.tsx
|
|
@@ -3391,7 +3391,7 @@ function $r(e, t, n) {
|
|
|
3391
3391
|
let n = a.resolved_params.items().filter((e) => e.name !== t);
|
|
3392
3392
|
e = {
|
|
3393
3393
|
...e,
|
|
3394
|
-
resolved_params: new
|
|
3394
|
+
resolved_params: new le(n)
|
|
3395
3395
|
};
|
|
3396
3396
|
}
|
|
3397
3397
|
r.push({
|
|
@@ -3424,7 +3424,7 @@ function ei(e, t, n) {
|
|
|
3424
3424
|
return null;
|
|
3425
3425
|
}
|
|
3426
3426
|
function ti(e, t, n) {
|
|
3427
|
-
let r = new Set(
|
|
3427
|
+
let r = new Set(z(e));
|
|
3428
3428
|
return new Set(t.filter((t) => {
|
|
3429
3429
|
if (t === n || r.has(t)) return !1;
|
|
3430
3430
|
let i = e.fields.get(t);
|
|
@@ -3486,52 +3486,52 @@ function ai({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
|
|
|
3486
3486
|
if (e === o) return !1;
|
|
3487
3487
|
let t = a.fields.get(e);
|
|
3488
3488
|
return !(!t || t.primary || t.display?.is_listable === !1);
|
|
3489
|
-
}), c =
|
|
3489
|
+
}), 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
3490
|
a.actions,
|
|
3491
3491
|
o,
|
|
3492
3492
|
r.recordId
|
|
3493
|
-
]),
|
|
3493
|
+
]), h = q(() => {
|
|
3494
3494
|
let e = {};
|
|
3495
|
-
for (let { code: t, action: n } of
|
|
3495
|
+
for (let { code: t, action: n } of m) e[t] = n;
|
|
3496
3496
|
return e;
|
|
3497
|
-
}, [
|
|
3497
|
+
}, [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
3498
|
entity: a,
|
|
3499
3499
|
entityCode: i,
|
|
3500
3500
|
screenRoute: typeof window < "u" ? window.location.pathname : "",
|
|
3501
3501
|
selectedRows: [],
|
|
3502
3502
|
selectedIds: [],
|
|
3503
|
-
locale:
|
|
3503
|
+
locale: b,
|
|
3504
3504
|
tabNavigate: (e, t) => v(e, {
|
|
3505
3505
|
title: t?.title,
|
|
3506
3506
|
icon: t?.icon,
|
|
3507
3507
|
search: t?.search
|
|
3508
3508
|
}),
|
|
3509
|
-
runActionApi: (e, t) =>
|
|
3509
|
+
runActionApi: (e, t) => te(e, t)
|
|
3510
3510
|
}), [
|
|
3511
3511
|
a,
|
|
3512
3512
|
i,
|
|
3513
|
-
|
|
3513
|
+
b,
|
|
3514
3514
|
v
|
|
3515
|
-
]),
|
|
3516
|
-
|
|
3515
|
+
]), S = Re(), C = G(() => {
|
|
3516
|
+
S.invalidateQueries({ predicate: (e) => {
|
|
3517
3517
|
let t = e.queryKey;
|
|
3518
3518
|
return t[0] === "entity-children" && t[3] === i;
|
|
3519
3519
|
} });
|
|
3520
|
-
}, [
|
|
3520
|
+
}, [S, i]), w = G((e, t) => {
|
|
3521
3521
|
let n = Zr(e, t, {}, i);
|
|
3522
|
-
if (n !== null) return
|
|
3522
|
+
if (n !== null) return _({
|
|
3523
3523
|
action: t,
|
|
3524
|
-
title:
|
|
3524
|
+
title: W(t.display?.name) || e,
|
|
3525
3525
|
execute: async (e) => {
|
|
3526
|
-
let t = await
|
|
3526
|
+
let t = await te(n, B(e, void 0));
|
|
3527
3527
|
return C(), t;
|
|
3528
3528
|
}
|
|
3529
3529
|
});
|
|
3530
3530
|
}, [
|
|
3531
|
-
|
|
3531
|
+
_,
|
|
3532
3532
|
i,
|
|
3533
3533
|
C
|
|
3534
|
-
]), [T,
|
|
3534
|
+
]), [T, E] = Y(0), D = /* @__PURE__ */ Q("div", {
|
|
3535
3535
|
style: {
|
|
3536
3536
|
display: "flex",
|
|
3537
3537
|
alignItems: "center",
|
|
@@ -3540,36 +3540,36 @@ function ai({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
|
|
|
3540
3540
|
minWidth: 0,
|
|
3541
3541
|
justifyContent: "flex-end"
|
|
3542
3542
|
},
|
|
3543
|
-
children: [a.action_layout ?
|
|
3543
|
+
children: [a.action_layout ? g.length > 0 && /* @__PURE__ */ Z(Xr, {
|
|
3544
3544
|
kind: "toolbar",
|
|
3545
|
-
layout:
|
|
3546
|
-
entityActions:
|
|
3545
|
+
layout: g,
|
|
3546
|
+
entityActions: h,
|
|
3547
3547
|
onRun: w,
|
|
3548
|
-
widgetContext:
|
|
3549
|
-
ariaLabel: `${
|
|
3550
|
-
}) :
|
|
3548
|
+
widgetContext: x,
|
|
3549
|
+
ariaLabel: `${f} toolbar actions`
|
|
3550
|
+
}) : m.map(({ code: e, action: t }) => /* @__PURE__ */ Z(wr, {
|
|
3551
3551
|
actionCode: e,
|
|
3552
3552
|
action: t,
|
|
3553
3553
|
entityCode: i,
|
|
3554
3554
|
variant: "ghost",
|
|
3555
3555
|
size: "sm",
|
|
3556
3556
|
onSuccess: C
|
|
3557
|
-
}, e)),
|
|
3557
|
+
}, e)), d && /* @__PURE__ */ Z(l, {
|
|
3558
3558
|
kind: "ghost",
|
|
3559
3559
|
size: "xs",
|
|
3560
3560
|
icon: /* @__PURE__ */ Z(e.plus, { size: 12 }),
|
|
3561
|
-
onClick: () =>
|
|
3561
|
+
onClick: () => E((e) => e + 1),
|
|
3562
3562
|
children: "Add row"
|
|
3563
3563
|
})]
|
|
3564
|
-
}),
|
|
3564
|
+
}), O = p ? /* @__PURE__ */ Z(si, {
|
|
3565
3565
|
entityCode: i,
|
|
3566
3566
|
entity: a,
|
|
3567
3567
|
parentEntity: r.entityCode,
|
|
3568
3568
|
parentId: r.recordId,
|
|
3569
3569
|
foreignKey: o,
|
|
3570
3570
|
columns: s,
|
|
3571
|
-
editable:
|
|
3572
|
-
interaction:
|
|
3571
|
+
editable: d,
|
|
3572
|
+
interaction: u,
|
|
3573
3573
|
ctx: r,
|
|
3574
3574
|
searchable: n.searchable,
|
|
3575
3575
|
filterFields: n.filters,
|
|
@@ -3582,8 +3582,8 @@ function ai({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
|
|
|
3582
3582
|
parentId: r.recordId,
|
|
3583
3583
|
foreignKey: o,
|
|
3584
3584
|
columns: s,
|
|
3585
|
-
editable:
|
|
3586
|
-
interaction:
|
|
3585
|
+
editable: d,
|
|
3586
|
+
interaction: u,
|
|
3587
3587
|
ctx: r,
|
|
3588
3588
|
sort: n.sort,
|
|
3589
3589
|
startDraftSignal: T
|
|
@@ -3594,15 +3594,15 @@ function ai({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
|
|
|
3594
3594
|
justifyContent: "flex-end",
|
|
3595
3595
|
marginBottom: 8
|
|
3596
3596
|
},
|
|
3597
|
-
children:
|
|
3598
|
-
}),
|
|
3599
|
-
title:
|
|
3597
|
+
children: D
|
|
3598
|
+
}), O] }) : /* @__PURE__ */ Z(Ue, {
|
|
3599
|
+
title: f,
|
|
3600
3600
|
icon: a.display?.icon ? /* @__PURE__ */ Z(t, {
|
|
3601
3601
|
name: a.display.icon,
|
|
3602
3602
|
size: 14
|
|
3603
3603
|
}) : void 0,
|
|
3604
|
-
right:
|
|
3605
|
-
children:
|
|
3604
|
+
right: D,
|
|
3605
|
+
children: O
|
|
3606
3606
|
});
|
|
3607
3607
|
}
|
|
3608
3608
|
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 +3636,15 @@ function oi({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3636
3636
|
startDraftSignal: u
|
|
3637
3637
|
});
|
|
3638
3638
|
}
|
|
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
|
-
|
|
3639
|
+
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 }) {
|
|
3640
|
+
let h = Re(), [g, _] = Y(""), [v, y] = Y(""), [b, x] = Y({}), S = J(void 0);
|
|
3641
|
+
K(() => (S.current && clearTimeout(S.current), S.current = setTimeout(() => {
|
|
3642
|
+
y(g);
|
|
3643
3643
|
}, 300), () => {
|
|
3644
|
-
|
|
3645
|
-
}), [
|
|
3646
|
-
let
|
|
3647
|
-
|
|
3644
|
+
S.current && clearTimeout(S.current);
|
|
3645
|
+
}), [g]);
|
|
3646
|
+
let C = G((e, t) => {
|
|
3647
|
+
x((n) => {
|
|
3648
3648
|
if (t === "__all__") {
|
|
3649
3649
|
let { [e]: t, ...r } = n;
|
|
3650
3650
|
return r;
|
|
@@ -3654,13 +3654,13 @@ function si({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3654
3654
|
[e]: t
|
|
3655
3655
|
};
|
|
3656
3656
|
});
|
|
3657
|
-
}, []),
|
|
3658
|
-
if (!
|
|
3657
|
+
}, []), 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(() => {
|
|
3658
|
+
if (!T?.pages) return {
|
|
3659
3659
|
rows: [],
|
|
3660
3660
|
refs: void 0
|
|
3661
3661
|
};
|
|
3662
3662
|
let e = [], t;
|
|
3663
|
-
for (let n of
|
|
3663
|
+
for (let n of T.pages) if (e.push(...n.data), n.$refs) if (!t) t = { ...n.$refs };
|
|
3664
3664
|
else for (let [e, r] of Object.entries(n.$refs)) t[e] = {
|
|
3665
3665
|
...t[e],
|
|
3666
3666
|
...r
|
|
@@ -3669,21 +3669,21 @@ function si({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3669
3669
|
rows: e,
|
|
3670
3670
|
refs: t
|
|
3671
3671
|
};
|
|
3672
|
-
}, [
|
|
3673
|
-
|
|
3672
|
+
}, [T]), N = G(() => {
|
|
3673
|
+
h.invalidateQueries({ predicate: (t) => {
|
|
3674
3674
|
let n = t.queryKey;
|
|
3675
3675
|
return n[0] === "entity-children" && n[3] === e;
|
|
3676
3676
|
} });
|
|
3677
|
-
}, [
|
|
3677
|
+
}, [h, e]);
|
|
3678
3678
|
return /* @__PURE__ */ Q("div", { children: [
|
|
3679
3679
|
/* @__PURE__ */ Z(Er, {
|
|
3680
3680
|
entity: t,
|
|
3681
|
-
searchable:
|
|
3682
|
-
filterFields:
|
|
3683
|
-
searchValue:
|
|
3684
|
-
onSearchChange:
|
|
3685
|
-
filters:
|
|
3686
|
-
onFilterChange:
|
|
3681
|
+
searchable: d,
|
|
3682
|
+
filterFields: f,
|
|
3683
|
+
searchValue: g,
|
|
3684
|
+
onSearchChange: _,
|
|
3685
|
+
filters: b,
|
|
3686
|
+
onFilterChange: C,
|
|
3687
3687
|
allEntities: c.schema.entities
|
|
3688
3688
|
}),
|
|
3689
3689
|
/* @__PURE__ */ Z(ci, {
|
|
@@ -3695,65 +3695,65 @@ function si({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3695
3695
|
editable: o,
|
|
3696
3696
|
interaction: s,
|
|
3697
3697
|
ctx: c,
|
|
3698
|
-
rows:
|
|
3698
|
+
rows: j,
|
|
3699
3699
|
refs: M,
|
|
3700
|
-
isLoading:
|
|
3701
|
-
isError:
|
|
3700
|
+
isLoading: E,
|
|
3701
|
+
isError: D,
|
|
3702
3702
|
invalidateQuery: N,
|
|
3703
|
-
startDraftSignal:
|
|
3703
|
+
startDraftSignal: m
|
|
3704
3704
|
}),
|
|
3705
|
-
|
|
3705
|
+
O && /* @__PURE__ */ Z("div", {
|
|
3706
3706
|
style: { marginTop: 4 },
|
|
3707
|
-
children: /* @__PURE__ */ Z(
|
|
3707
|
+
children: /* @__PURE__ */ Z(l, {
|
|
3708
3708
|
kind: "ghost",
|
|
3709
3709
|
size: "xs",
|
|
3710
|
-
icon:
|
|
3711
|
-
onClick: () =>
|
|
3712
|
-
disabled:
|
|
3710
|
+
icon: A ? /* @__PURE__ */ Z(u, { size: 12 }) : void 0,
|
|
3711
|
+
onClick: () => k(),
|
|
3712
|
+
disabled: A,
|
|
3713
3713
|
children: "Load more"
|
|
3714
3714
|
})
|
|
3715
3715
|
})
|
|
3716
3716
|
] });
|
|
3717
3717
|
}
|
|
3718
|
-
function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i, editable: a, interaction: o, ctx: s, rows: c, refs:
|
|
3719
|
-
let
|
|
3718
|
+
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 }) {
|
|
3719
|
+
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
3720
|
o,
|
|
3721
3721
|
t,
|
|
3722
3722
|
s.schema.screens
|
|
3723
|
-
]),
|
|
3723
|
+
]), v = q(() => a ? ti(t, i, r) : /* @__PURE__ */ new Set(), [
|
|
3724
3724
|
i,
|
|
3725
3725
|
r,
|
|
3726
3726
|
t,
|
|
3727
3727
|
a
|
|
3728
|
-
]),
|
|
3728
|
+
]), y = q(() => ni(t, i, r), [
|
|
3729
3729
|
i,
|
|
3730
3730
|
r,
|
|
3731
3731
|
t
|
|
3732
|
-
]),
|
|
3732
|
+
]), x = q(() => {
|
|
3733
3733
|
let e = /* @__PURE__ */ new Map();
|
|
3734
3734
|
for (let n of c) {
|
|
3735
|
-
let r =
|
|
3736
|
-
e.set(
|
|
3735
|
+
let r = V(t, n);
|
|
3736
|
+
e.set(b(r), r);
|
|
3737
3737
|
}
|
|
3738
3738
|
return e;
|
|
3739
3739
|
}, [c, t]), C = q(() => {
|
|
3740
3740
|
let e = /* @__PURE__ */ new Map();
|
|
3741
3741
|
for (let n of c) {
|
|
3742
3742
|
let r = n.$row_version;
|
|
3743
|
-
typeof r == "string" && r !== "" && e.set(
|
|
3743
|
+
typeof r == "string" && r !== "" && e.set(b(V(t, n)), r);
|
|
3744
3744
|
}
|
|
3745
3745
|
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
|
|
3746
|
+
}, [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);
|
|
3747
|
+
I.current = N;
|
|
3748
|
+
let L = J({});
|
|
3749
3749
|
K(() => {
|
|
3750
|
-
let e =
|
|
3750
|
+
let e = L.current;
|
|
3751
3751
|
return () => {
|
|
3752
3752
|
for (let t of Object.values(e)) clearTimeout(t);
|
|
3753
3753
|
};
|
|
3754
3754
|
}, []);
|
|
3755
|
-
let [
|
|
3756
|
-
|
|
3755
|
+
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) => {
|
|
3756
|
+
F((e) => ({
|
|
3757
3757
|
...e,
|
|
3758
3758
|
[t]: {
|
|
3759
3759
|
...e[t],
|
|
@@ -3766,7 +3766,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3766
3766
|
...n,
|
|
3767
3767
|
$row_version: i
|
|
3768
3768
|
} : n;
|
|
3769
|
-
return await
|
|
3769
|
+
return await M(e, x.get(t) ?? t, a), F((e) => {
|
|
3770
3770
|
let n = e[t];
|
|
3771
3771
|
if (!n) return e;
|
|
3772
3772
|
if (n.ver > r) return {
|
|
@@ -3778,10 +3778,10 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3778
3778
|
};
|
|
3779
3779
|
let { [t]: i, ...a } = e;
|
|
3780
3780
|
return a;
|
|
3781
|
-
}),
|
|
3781
|
+
}), f(), !0;
|
|
3782
3782
|
} catch (e) {
|
|
3783
3783
|
let n = e instanceof Error ? e.message : "Save failed";
|
|
3784
|
-
return
|
|
3784
|
+
return F((e) => ({
|
|
3785
3785
|
...e,
|
|
3786
3786
|
[t]: {
|
|
3787
3787
|
...e[t],
|
|
@@ -3792,11 +3792,11 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3792
3792
|
}
|
|
3793
3793
|
}, [
|
|
3794
3794
|
e,
|
|
3795
|
-
|
|
3796
|
-
|
|
3795
|
+
f,
|
|
3796
|
+
x,
|
|
3797
3797
|
C
|
|
3798
|
-
]),
|
|
3799
|
-
|
|
3798
|
+
]), se = G((e, t, n) => {
|
|
3799
|
+
F((r) => {
|
|
3800
3800
|
let i = r[e] ?? {
|
|
3801
3801
|
buffer: {},
|
|
3802
3802
|
ver: 0,
|
|
@@ -3813,99 +3813,99 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3813
3813
|
ver: a
|
|
3814
3814
|
}
|
|
3815
3815
|
};
|
|
3816
|
-
}), o === "inline_edit" && (
|
|
3817
|
-
let t =
|
|
3818
|
-
t && Object.keys(t.buffer).length > 0 &&
|
|
3816
|
+
}), o === "inline_edit" && (L.current[e] && clearTimeout(L.current[e]), L.current[e] = setTimeout(() => {
|
|
3817
|
+
let t = I.current[e];
|
|
3818
|
+
t && Object.keys(t.buffer).length > 0 && oe(e, { ...t.buffer }, t.ver);
|
|
3819
3819
|
}, 500));
|
|
3820
|
-
}, [
|
|
3820
|
+
}, [oe, o]), ce = G(() => {
|
|
3821
3821
|
let e = {};
|
|
3822
3822
|
e[r] = n;
|
|
3823
3823
|
for (let n of i) {
|
|
3824
3824
|
let r = t.fields.get(n);
|
|
3825
3825
|
r && (r.default === void 0 ? r.type === "bool" && (e[n] = !1) : e[n] = r.default);
|
|
3826
3826
|
}
|
|
3827
|
-
|
|
3827
|
+
z(e), ee([]);
|
|
3828
3828
|
}, [
|
|
3829
3829
|
r,
|
|
3830
3830
|
n,
|
|
3831
3831
|
i,
|
|
3832
3832
|
t.fields
|
|
3833
|
-
]),
|
|
3833
|
+
]), le = J(p);
|
|
3834
3834
|
K(() => {
|
|
3835
|
-
|
|
3835
|
+
p !== void 0 && p !== le.current && (le.current = p, !R && ce());
|
|
3836
3836
|
}, [
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3837
|
+
p,
|
|
3838
|
+
R,
|
|
3839
|
+
ce
|
|
3840
3840
|
]);
|
|
3841
|
-
let
|
|
3842
|
-
if (!
|
|
3843
|
-
let n = ri(
|
|
3841
|
+
let ue = G(async () => {
|
|
3842
|
+
if (!R) return;
|
|
3843
|
+
let n = ri(R, i, t, r);
|
|
3844
3844
|
if (n.length > 0) {
|
|
3845
|
-
|
|
3845
|
+
ee(n);
|
|
3846
3846
|
return;
|
|
3847
3847
|
}
|
|
3848
|
-
|
|
3848
|
+
ne(!0);
|
|
3849
3849
|
try {
|
|
3850
|
-
await
|
|
3850
|
+
await re(e, R), z(null), ee([]), f();
|
|
3851
3851
|
} catch (e) {
|
|
3852
3852
|
let t = e instanceof Error ? e.message : "Create failed";
|
|
3853
|
-
|
|
3853
|
+
ee([`_error:${t}`]);
|
|
3854
3854
|
} finally {
|
|
3855
|
-
|
|
3855
|
+
ne(!1);
|
|
3856
3856
|
}
|
|
3857
3857
|
}, [
|
|
3858
|
-
|
|
3858
|
+
R,
|
|
3859
3859
|
i,
|
|
3860
3860
|
t,
|
|
3861
3861
|
r,
|
|
3862
3862
|
e,
|
|
3863
|
-
|
|
3863
|
+
f
|
|
3864
3864
|
]), fe = G((e) => {
|
|
3865
|
-
|
|
3865
|
+
F({}), j([]), O(e);
|
|
3866
3866
|
}, []), pe = G(async (e) => {
|
|
3867
|
-
let n =
|
|
3867
|
+
let n = I.current[e], a = n?.buffer ?? {};
|
|
3868
3868
|
if (Object.keys(a).length === 0) {
|
|
3869
3869
|
O(null), j([]);
|
|
3870
3870
|
return;
|
|
3871
3871
|
}
|
|
3872
3872
|
let o = ri({
|
|
3873
|
-
...c.find((n) =>
|
|
3873
|
+
...c.find((n) => b(V(t, n)) === e) ?? {},
|
|
3874
3874
|
...a
|
|
3875
3875
|
}, i, t, r);
|
|
3876
3876
|
if (o.length > 0) {
|
|
3877
3877
|
j(o);
|
|
3878
3878
|
return;
|
|
3879
3879
|
}
|
|
3880
|
-
await
|
|
3880
|
+
await oe(e, { ...a }, n?.ver ?? 0) && (O(null), j([]));
|
|
3881
3881
|
}, [
|
|
3882
3882
|
c,
|
|
3883
3883
|
t,
|
|
3884
3884
|
i,
|
|
3885
3885
|
r,
|
|
3886
|
-
|
|
3886
|
+
oe
|
|
3887
3887
|
]), me = G((e) => {
|
|
3888
|
-
|
|
3888
|
+
F((t) => {
|
|
3889
3889
|
if (!t[e]) return t;
|
|
3890
3890
|
let { [e]: n, ...r } = t;
|
|
3891
3891
|
return r;
|
|
3892
3892
|
}), j([]), O(null);
|
|
3893
3893
|
}, []), he = G(async (t) => {
|
|
3894
|
-
U(null),
|
|
3894
|
+
U(null), ae((e) => new Set(e).add(t));
|
|
3895
3895
|
try {
|
|
3896
|
-
await
|
|
3896
|
+
await P(e, x.get(t) ?? t), f();
|
|
3897
3897
|
} catch {} finally {
|
|
3898
|
-
|
|
3898
|
+
ae((e) => {
|
|
3899
3899
|
let n = new Set(e);
|
|
3900
3900
|
return n.delete(t), n;
|
|
3901
3901
|
});
|
|
3902
3902
|
}
|
|
3903
3903
|
}, [
|
|
3904
3904
|
e,
|
|
3905
|
-
|
|
3906
|
-
|
|
3905
|
+
f,
|
|
3906
|
+
x
|
|
3907
3907
|
]);
|
|
3908
|
-
if (
|
|
3908
|
+
if (d) return /* @__PURE__ */ Z("div", {
|
|
3909
3909
|
style: {
|
|
3910
3910
|
fontSize: 12.5,
|
|
3911
3911
|
color: "var(--danger)",
|
|
@@ -3913,7 +3913,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3913
3913
|
},
|
|
3914
3914
|
children: "Failed to load."
|
|
3915
3915
|
});
|
|
3916
|
-
if (
|
|
3916
|
+
if (u) return /* @__PURE__ */ Q("div", {
|
|
3917
3917
|
style: {
|
|
3918
3918
|
display: "flex",
|
|
3919
3919
|
flexDirection: "column",
|
|
@@ -3930,8 +3930,8 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3930
3930
|
borderRadius: 6
|
|
3931
3931
|
} })]
|
|
3932
3932
|
});
|
|
3933
|
-
let ge = c.length === 0 && !
|
|
3934
|
-
return
|
|
3933
|
+
let ge = c.length === 0 && !R;
|
|
3934
|
+
return m.isPhone && !h ? /* @__PURE__ */ Q("div", { children: [
|
|
3935
3935
|
ge && !a && /* @__PURE__ */ Z("div", {
|
|
3936
3936
|
style: {
|
|
3937
3937
|
fontSize: 12.5,
|
|
@@ -3947,7 +3947,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3947
3947
|
gap: 10
|
|
3948
3948
|
},
|
|
3949
3949
|
children: [c.map((n) => {
|
|
3950
|
-
let r =
|
|
3950
|
+
let r = b(V(t, n)), c = W.has(r), u = N[r], d = _ && r ? _.replace(/:\w+/, r) : void 0;
|
|
3951
3951
|
return /* @__PURE__ */ Z(li, {
|
|
3952
3952
|
rowId: r,
|
|
3953
3953
|
row: n,
|
|
@@ -3955,7 +3955,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3955
3955
|
entities: s.schema.entities,
|
|
3956
3956
|
screens: s.schema.screens,
|
|
3957
3957
|
columns: i,
|
|
3958
|
-
editableColumns:
|
|
3958
|
+
editableColumns: v,
|
|
3959
3959
|
editable: a,
|
|
3960
3960
|
interaction: o,
|
|
3961
3961
|
isEditing: D === r,
|
|
@@ -3963,10 +3963,10 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3963
3963
|
isDeleting: c,
|
|
3964
3964
|
activeCell: T,
|
|
3965
3965
|
setActiveCell: E,
|
|
3966
|
-
rowState:
|
|
3967
|
-
onCellChange:
|
|
3966
|
+
rowState: u,
|
|
3967
|
+
onCellChange: se,
|
|
3968
3968
|
onDeleteClick: (e) => {
|
|
3969
|
-
let r =
|
|
3969
|
+
let r = S(n, t) ?? "";
|
|
3970
3970
|
U({
|
|
3971
3971
|
show: !0,
|
|
3972
3972
|
rowId: e,
|
|
@@ -3976,39 +3976,39 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
3976
3976
|
onStartEdit: fe,
|
|
3977
3977
|
onConfirmEdit: pe,
|
|
3978
3978
|
onCancelEdit: me,
|
|
3979
|
-
refs:
|
|
3980
|
-
identityCol:
|
|
3979
|
+
refs: l,
|
|
3980
|
+
identityCol: g,
|
|
3981
3981
|
href: d,
|
|
3982
3982
|
rowActions: w,
|
|
3983
3983
|
entityCode: e,
|
|
3984
|
-
onRowActionSuccess:
|
|
3984
|
+
onRowActionSuccess: f
|
|
3985
3985
|
}, r);
|
|
3986
|
-
}),
|
|
3987
|
-
draftRow:
|
|
3986
|
+
}), R && /* @__PURE__ */ Z(mi, {
|
|
3987
|
+
draftRow: R,
|
|
3988
3988
|
entity: t,
|
|
3989
3989
|
columns: i,
|
|
3990
|
-
editableColumns:
|
|
3990
|
+
editableColumns: y,
|
|
3991
3991
|
foreignKey: r,
|
|
3992
|
-
draftErrors:
|
|
3993
|
-
draftSaving:
|
|
3994
|
-
onChange: (e, t) =>
|
|
3992
|
+
draftErrors: B,
|
|
3993
|
+
draftSaving: te,
|
|
3994
|
+
onChange: (e, t) => z((n) => n && {
|
|
3995
3995
|
...n,
|
|
3996
3996
|
[e]: t
|
|
3997
3997
|
}),
|
|
3998
|
-
onConfirm:
|
|
3998
|
+
onConfirm: ue,
|
|
3999
3999
|
onCancel: () => {
|
|
4000
|
-
|
|
4000
|
+
z(null), ee([]);
|
|
4001
4001
|
},
|
|
4002
|
-
refs:
|
|
4002
|
+
refs: l
|
|
4003
4003
|
})]
|
|
4004
4004
|
}),
|
|
4005
|
-
|
|
4006
|
-
open:
|
|
4005
|
+
H && /* @__PURE__ */ Z(Ot, {
|
|
4006
|
+
open: H.show,
|
|
4007
4007
|
onOpenChange: (e) => !e && U(null),
|
|
4008
4008
|
title: "Delete record",
|
|
4009
|
-
description:
|
|
4009
|
+
description: H.label ? `Are you sure you want to delete "${H.label}"?` : "Are you sure you want to delete this record?",
|
|
4010
4010
|
confirmLabel: "Delete",
|
|
4011
|
-
onConfirm: () => he(
|
|
4011
|
+
onConfirm: () => he(H.rowId),
|
|
4012
4012
|
destructive: !0
|
|
4013
4013
|
})
|
|
4014
4014
|
] }) : /* @__PURE__ */ Q("div", { children: [
|
|
@@ -4029,7 +4029,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
4029
4029
|
let n = t.fields.get(e);
|
|
4030
4030
|
return /* @__PURE__ */ Z("th", {
|
|
4031
4031
|
style: Te,
|
|
4032
|
-
children: n ?
|
|
4032
|
+
children: n ? ie(n, e, s.schema.entities) : e
|
|
4033
4033
|
}, e);
|
|
4034
4034
|
}),
|
|
4035
4035
|
a && /* @__PURE__ */ Z("th", { style: {
|
|
@@ -4041,7 +4041,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
4041
4041
|
width: 40
|
|
4042
4042
|
} })
|
|
4043
4043
|
] }) }), /* @__PURE__ */ Q("tbody", { children: [c.map((n) => {
|
|
4044
|
-
let r =
|
|
4044
|
+
let r = b(V(t, n)), c = W.has(r), u = N[r], d = _ && r ? _.replace(/:\w+/, r) : void 0;
|
|
4045
4045
|
return /* @__PURE__ */ Z(ui, {
|
|
4046
4046
|
rowId: r,
|
|
4047
4047
|
row: n,
|
|
@@ -4049,7 +4049,7 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
4049
4049
|
entities: s.schema.entities,
|
|
4050
4050
|
screens: s.schema.screens,
|
|
4051
4051
|
columns: i,
|
|
4052
|
-
editableColumns:
|
|
4052
|
+
editableColumns: v,
|
|
4053
4053
|
editable: a,
|
|
4054
4054
|
interaction: o,
|
|
4055
4055
|
isEditing: D === r,
|
|
@@ -4057,10 +4057,10 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
4057
4057
|
isDeleting: c,
|
|
4058
4058
|
activeCell: T,
|
|
4059
4059
|
setActiveCell: E,
|
|
4060
|
-
rowState:
|
|
4061
|
-
onCellChange:
|
|
4060
|
+
rowState: u,
|
|
4061
|
+
onCellChange: se,
|
|
4062
4062
|
onDeleteClick: (e) => {
|
|
4063
|
-
let r =
|
|
4063
|
+
let r = S(n, t) ?? "";
|
|
4064
4064
|
U({
|
|
4065
4065
|
show: !0,
|
|
4066
4066
|
rowId: e,
|
|
@@ -4070,66 +4070,66 @@ function ci({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
4070
4070
|
onStartEdit: fe,
|
|
4071
4071
|
onConfirmEdit: pe,
|
|
4072
4072
|
onCancelEdit: me,
|
|
4073
|
-
refs:
|
|
4074
|
-
identityCol:
|
|
4073
|
+
refs: l,
|
|
4074
|
+
identityCol: g,
|
|
4075
4075
|
href: d,
|
|
4076
4076
|
rowActions: w,
|
|
4077
4077
|
entityCode: e,
|
|
4078
|
-
onRowActionSuccess:
|
|
4078
|
+
onRowActionSuccess: f
|
|
4079
4079
|
}, r);
|
|
4080
|
-
}),
|
|
4081
|
-
draftRow:
|
|
4080
|
+
}), R && /* @__PURE__ */ Z(pi, {
|
|
4081
|
+
draftRow: R,
|
|
4082
4082
|
entity: t,
|
|
4083
4083
|
columns: i,
|
|
4084
|
-
editableColumns:
|
|
4084
|
+
editableColumns: y,
|
|
4085
4085
|
foreignKey: r,
|
|
4086
|
-
draftErrors:
|
|
4087
|
-
draftSaving:
|
|
4088
|
-
onChange: (e, t) =>
|
|
4086
|
+
draftErrors: B,
|
|
4087
|
+
draftSaving: te,
|
|
4088
|
+
onChange: (e, t) => z((n) => n && {
|
|
4089
4089
|
...n,
|
|
4090
4090
|
[e]: t
|
|
4091
4091
|
}),
|
|
4092
|
-
onConfirm:
|
|
4092
|
+
onConfirm: ue,
|
|
4093
4093
|
onCancel: () => {
|
|
4094
|
-
|
|
4094
|
+
z(null), ee([]);
|
|
4095
4095
|
},
|
|
4096
|
-
refs:
|
|
4096
|
+
refs: l
|
|
4097
4097
|
})] })]
|
|
4098
4098
|
})
|
|
4099
4099
|
}),
|
|
4100
|
-
|
|
4101
|
-
open:
|
|
4100
|
+
H && /* @__PURE__ */ Z(Ot, {
|
|
4101
|
+
open: H.show,
|
|
4102
4102
|
onOpenChange: (e) => !e && U(null),
|
|
4103
4103
|
title: "Delete record",
|
|
4104
|
-
description:
|
|
4104
|
+
description: H.label ? `Are you sure you want to delete "${H.label}"?` : "Are you sure you want to delete this record?",
|
|
4105
4105
|
confirmLabel: "Delete",
|
|
4106
|
-
onConfirm: () => he(
|
|
4106
|
+
onConfirm: () => he(H.rowId),
|
|
4107
4107
|
destructive: !0
|
|
4108
4108
|
})
|
|
4109
4109
|
] });
|
|
4110
4110
|
}
|
|
4111
|
-
function li({ rowId: t, row: n, entity: r, entities: i, screens: a, columns:
|
|
4112
|
-
let
|
|
4111
|
+
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 }) {
|
|
4112
|
+
let D = j(), k = je(), A = q(() => !h || Object.keys(h.buffer).length === 0 ? n : {
|
|
4113
4113
|
...n,
|
|
4114
|
-
...
|
|
4115
|
-
}, [n,
|
|
4116
|
-
return
|
|
4117
|
-
values:
|
|
4114
|
+
...h.buffer
|
|
4115
|
+
}, [n, h]);
|
|
4116
|
+
return d === "row_edit" && f ? /* @__PURE__ */ Z(fi, {
|
|
4117
|
+
values: A,
|
|
4118
4118
|
entity: r,
|
|
4119
|
-
columns:
|
|
4120
|
-
editableColumns:
|
|
4121
|
-
errors:
|
|
4122
|
-
saving:
|
|
4123
|
-
onChange: (e, n) =>
|
|
4124
|
-
onConfirm: () =>
|
|
4125
|
-
onCancel: () =>
|
|
4126
|
-
refs:
|
|
4119
|
+
columns: s,
|
|
4120
|
+
editableColumns: c,
|
|
4121
|
+
errors: h?.error ? [...p, `_error:${h.error}`] : p,
|
|
4122
|
+
saving: h?.saving ?? !1,
|
|
4123
|
+
onChange: (e, n) => g(t, e, n),
|
|
4124
|
+
onConfirm: () => y(t),
|
|
4125
|
+
onCancel: () => b(t),
|
|
4126
|
+
refs: S
|
|
4127
4127
|
}) : /* @__PURE__ */ Q("div", {
|
|
4128
4128
|
style: {
|
|
4129
4129
|
border: "1px solid var(--border)",
|
|
4130
4130
|
borderRadius: 8,
|
|
4131
4131
|
background: "var(--surface)",
|
|
4132
|
-
opacity:
|
|
4132
|
+
opacity: m ? .58 : 1,
|
|
4133
4133
|
overflow: "hidden"
|
|
4134
4134
|
},
|
|
4135
4135
|
children: [/* @__PURE__ */ Z("div", {
|
|
@@ -4139,27 +4139,27 @@ function li({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
4139
4139
|
flexDirection: "column",
|
|
4140
4140
|
gap: 12
|
|
4141
4141
|
},
|
|
4142
|
-
children:
|
|
4143
|
-
let n = r.fields.get(e), o =
|
|
4142
|
+
children: s.map((e) => {
|
|
4143
|
+
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
4144
|
fontSize: 11.5,
|
|
4145
4145
|
fontWeight: 600,
|
|
4146
4146
|
color: "var(--text-3)"
|
|
4147
|
-
},
|
|
4147
|
+
}, h = n ? O({
|
|
4148
4148
|
field: n,
|
|
4149
4149
|
fieldName: e,
|
|
4150
|
-
value:
|
|
4150
|
+
value: A[e],
|
|
4151
4151
|
mode: o ? "edit" : "display",
|
|
4152
|
-
onChange: o ? (n) =>
|
|
4153
|
-
record:
|
|
4154
|
-
refs:
|
|
4152
|
+
onChange: o ? (n) => g(t, e, n) : void 0,
|
|
4153
|
+
record: A,
|
|
4154
|
+
refs: S,
|
|
4155
4155
|
compact: o,
|
|
4156
4156
|
entity: r,
|
|
4157
4157
|
entities: i,
|
|
4158
|
-
screens:
|
|
4158
|
+
screens: s ? void 0 : a,
|
|
4159
4159
|
fieldId: f,
|
|
4160
4160
|
labelId: p,
|
|
4161
|
-
locale:
|
|
4162
|
-
}) :
|
|
4161
|
+
locale: D
|
|
4162
|
+
}) : x(A[e]);
|
|
4163
4163
|
return /* @__PURE__ */ Q("div", {
|
|
4164
4164
|
style: {
|
|
4165
4165
|
display: "flex",
|
|
@@ -4171,26 +4171,26 @@ function li({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
4171
4171
|
id: p,
|
|
4172
4172
|
htmlFor: f,
|
|
4173
4173
|
style: m,
|
|
4174
|
-
children:
|
|
4174
|
+
children: u
|
|
4175
4175
|
}) : /* @__PURE__ */ Z("div", {
|
|
4176
4176
|
id: p,
|
|
4177
4177
|
style: m,
|
|
4178
|
-
children:
|
|
4178
|
+
children: u
|
|
4179
4179
|
}), /* @__PURE__ */ Z("div", {
|
|
4180
4180
|
style: { minWidth: 0 },
|
|
4181
|
-
children:
|
|
4182
|
-
href:
|
|
4181
|
+
children: s && !o ? /* @__PURE__ */ Z("a", {
|
|
4182
|
+
href: w,
|
|
4183
4183
|
style: {
|
|
4184
4184
|
color: "var(--accent)",
|
|
4185
4185
|
textDecoration: "none",
|
|
4186
4186
|
fontWeight: 500
|
|
4187
4187
|
},
|
|
4188
|
-
children:
|
|
4189
|
-
}) :
|
|
4188
|
+
children: h
|
|
4189
|
+
}) : h
|
|
4190
4190
|
})]
|
|
4191
4191
|
}, e);
|
|
4192
4192
|
})
|
|
4193
|
-
}), (
|
|
4193
|
+
}), (l || T && T.length > 0) && /* @__PURE__ */ Q("div", {
|
|
4194
4194
|
style: {
|
|
4195
4195
|
minHeight: 42,
|
|
4196
4196
|
padding: "6px 8px",
|
|
@@ -4200,101 +4200,101 @@ function li({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
4200
4200
|
justifyContent: "flex-end",
|
|
4201
4201
|
gap: 6
|
|
4202
4202
|
},
|
|
4203
|
-
children: [
|
|
4204
|
-
|
|
4205
|
-
|
|
4203
|
+
children: [l && /* @__PURE__ */ Q(X, { children: [
|
|
4204
|
+
h?.saving && /* @__PURE__ */ Z(u, { size: 12 }),
|
|
4205
|
+
h?.error && /* @__PURE__ */ Z("span", {
|
|
4206
4206
|
style: {
|
|
4207
4207
|
fontSize: 11,
|
|
4208
4208
|
color: "var(--danger)"
|
|
4209
4209
|
},
|
|
4210
|
-
title:
|
|
4210
|
+
title: h.error,
|
|
4211
4211
|
children: "!"
|
|
4212
4212
|
}),
|
|
4213
|
-
|
|
4213
|
+
d === "row_edit" && /* @__PURE__ */ Z(o, {
|
|
4214
4214
|
size: 32,
|
|
4215
4215
|
icon: /* @__PURE__ */ Z(e.edit, { size: 14 }),
|
|
4216
|
-
onClick: () =>
|
|
4216
|
+
onClick: () => v(t),
|
|
4217
4217
|
title: "Edit row"
|
|
4218
4218
|
}),
|
|
4219
|
-
/* @__PURE__ */ Z(
|
|
4219
|
+
/* @__PURE__ */ Z(o, {
|
|
4220
4220
|
size: 32,
|
|
4221
4221
|
icon: /* @__PURE__ */ Z(e.trash, { size: 14 }),
|
|
4222
|
-
onClick: () =>
|
|
4222
|
+
onClick: () => _(t),
|
|
4223
4223
|
title: "Delete row"
|
|
4224
4224
|
})
|
|
4225
|
-
] }), !
|
|
4226
|
-
actions:
|
|
4225
|
+
] }), !l && T && T.length > 0 && /* @__PURE__ */ Z(Tr, {
|
|
4226
|
+
actions: T,
|
|
4227
4227
|
objectIds: [t],
|
|
4228
|
-
row:
|
|
4229
|
-
onSuccess:
|
|
4228
|
+
row: A,
|
|
4229
|
+
onSuccess: E
|
|
4230
4230
|
})]
|
|
4231
4231
|
})]
|
|
4232
4232
|
});
|
|
4233
4233
|
}
|
|
4234
|
-
function ui({ rowId: t, row: n, entity: r, entities: i, screens: a, columns:
|
|
4235
|
-
let
|
|
4234
|
+
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 }) {
|
|
4235
|
+
let A = j(), M = q(() => !_ || Object.keys(_.buffer).length === 0 ? n : {
|
|
4236
4236
|
...n,
|
|
4237
|
-
...
|
|
4238
|
-
}, [n,
|
|
4239
|
-
if (
|
|
4240
|
-
values:
|
|
4237
|
+
..._.buffer
|
|
4238
|
+
}, [n, _]);
|
|
4239
|
+
if (d === "row_edit" && f) return /* @__PURE__ */ Z(di, {
|
|
4240
|
+
values: M,
|
|
4241
4241
|
entity: r,
|
|
4242
|
-
columns:
|
|
4243
|
-
editableColumns:
|
|
4244
|
-
errors:
|
|
4245
|
-
saving:
|
|
4246
|
-
onChange: (e, n) =>
|
|
4247
|
-
onConfirm: () =>
|
|
4248
|
-
onCancel: () =>
|
|
4249
|
-
refs:
|
|
4242
|
+
columns: s,
|
|
4243
|
+
editableColumns: c,
|
|
4244
|
+
errors: _?.error ? [...p, `_error:${_.error}`] : p,
|
|
4245
|
+
saving: _?.saving ?? !1,
|
|
4246
|
+
onChange: (e, n) => v(t, e, n),
|
|
4247
|
+
onConfirm: () => S(t),
|
|
4248
|
+
onCancel: () => C(t),
|
|
4249
|
+
refs: w
|
|
4250
4250
|
});
|
|
4251
|
-
let
|
|
4251
|
+
let N = De, P = {
|
|
4252
4252
|
padding: "4px 4px",
|
|
4253
4253
|
borderBottom: "1px solid var(--divider)",
|
|
4254
4254
|
verticalAlign: "middle"
|
|
4255
|
-
},
|
|
4255
|
+
}, F = d === "inline_edit";
|
|
4256
4256
|
return /* @__PURE__ */ Q("tr", {
|
|
4257
|
-
style: { opacity:
|
|
4257
|
+
style: { opacity: m ? .5 : 1 },
|
|
4258
4258
|
children: [
|
|
4259
|
-
|
|
4260
|
-
let n = r.fields.get(e), o =
|
|
4261
|
-
if (
|
|
4262
|
-
style:
|
|
4263
|
-
children: n ?
|
|
4259
|
+
s.map((e) => {
|
|
4260
|
+
let n = r.fields.get(e), o = c.has(e);
|
|
4261
|
+
if (F && h?.rowId === t && h?.col === e && o) return /* @__PURE__ */ Z("td", {
|
|
4262
|
+
style: P,
|
|
4263
|
+
children: n ? O({
|
|
4264
4264
|
field: n,
|
|
4265
4265
|
fieldName: e,
|
|
4266
|
-
value:
|
|
4266
|
+
value: M[e],
|
|
4267
4267
|
mode: "edit",
|
|
4268
|
-
onChange: (n) =>
|
|
4269
|
-
record:
|
|
4270
|
-
refs:
|
|
4268
|
+
onChange: (n) => v(t, e, n),
|
|
4269
|
+
record: M,
|
|
4270
|
+
refs: w,
|
|
4271
4271
|
compact: !0,
|
|
4272
|
-
locale:
|
|
4273
|
-
}) :
|
|
4272
|
+
locale: A
|
|
4273
|
+
}) : x(M[e])
|
|
4274
4274
|
}, e);
|
|
4275
|
-
let
|
|
4275
|
+
let s = E && e === T, l = n ? O({
|
|
4276
4276
|
field: n,
|
|
4277
4277
|
fieldName: e,
|
|
4278
|
-
value:
|
|
4278
|
+
value: M[e],
|
|
4279
4279
|
mode: "display",
|
|
4280
|
-
record:
|
|
4281
|
-
refs:
|
|
4280
|
+
record: M,
|
|
4281
|
+
refs: w,
|
|
4282
4282
|
entity: r,
|
|
4283
4283
|
entities: i,
|
|
4284
|
-
screens:
|
|
4285
|
-
locale:
|
|
4286
|
-
}) :
|
|
4284
|
+
screens: s ? void 0 : a,
|
|
4285
|
+
locale: A
|
|
4286
|
+
}) : x(M[e]), u = F && o && !m;
|
|
4287
4287
|
return /* @__PURE__ */ Z("td", {
|
|
4288
4288
|
style: {
|
|
4289
|
-
...
|
|
4289
|
+
...N,
|
|
4290
4290
|
cursor: u ? "pointer" : "default"
|
|
4291
4291
|
},
|
|
4292
|
-
onClick: u ? () =>
|
|
4292
|
+
onClick: u ? () => g({
|
|
4293
4293
|
rowId: t,
|
|
4294
4294
|
col: e
|
|
4295
4295
|
}) : void 0,
|
|
4296
|
-
children:
|
|
4297
|
-
href:
|
|
4296
|
+
children: s ? /* @__PURE__ */ Z("a", {
|
|
4297
|
+
href: E,
|
|
4298
4298
|
style: {
|
|
4299
4299
|
color: "var(--accent)",
|
|
4300
4300
|
textDecoration: "none",
|
|
@@ -4306,7 +4306,7 @@ function ui({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
4306
4306
|
}) : l
|
|
4307
4307
|
}, e);
|
|
4308
4308
|
}),
|
|
4309
|
-
|
|
4309
|
+
l && /* @__PURE__ */ Z("td", {
|
|
4310
4310
|
style: {
|
|
4311
4311
|
padding: "4px 8px",
|
|
4312
4312
|
borderBottom: "1px solid var(--divider)",
|
|
@@ -4319,96 +4319,96 @@ function ui({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o,
|
|
|
4319
4319
|
gap: 4
|
|
4320
4320
|
},
|
|
4321
4321
|
children: [
|
|
4322
|
-
|
|
4323
|
-
|
|
4322
|
+
_?.saving && /* @__PURE__ */ Z(u, { size: 12 }),
|
|
4323
|
+
_?.error && /* @__PURE__ */ Z("span", {
|
|
4324
4324
|
style: {
|
|
4325
4325
|
fontSize: 11,
|
|
4326
4326
|
color: "var(--danger)"
|
|
4327
4327
|
},
|
|
4328
|
-
title:
|
|
4328
|
+
title: _.error,
|
|
4329
4329
|
children: "!"
|
|
4330
4330
|
}),
|
|
4331
|
-
|
|
4331
|
+
d === "row_edit" && /* @__PURE__ */ Z(o, {
|
|
4332
4332
|
size: 24,
|
|
4333
4333
|
icon: /* @__PURE__ */ Z(e.edit, { size: 12 }),
|
|
4334
|
-
onClick: () =>
|
|
4334
|
+
onClick: () => b(t),
|
|
4335
4335
|
title: "Edit row"
|
|
4336
4336
|
}),
|
|
4337
|
-
/* @__PURE__ */ Z(
|
|
4337
|
+
/* @__PURE__ */ Z(o, {
|
|
4338
4338
|
size: 24,
|
|
4339
4339
|
icon: /* @__PURE__ */ Z(e.trash, { size: 12 }),
|
|
4340
|
-
onClick: () =>
|
|
4340
|
+
onClick: () => y(t),
|
|
4341
4341
|
title: "Delete row"
|
|
4342
4342
|
})
|
|
4343
4343
|
]
|
|
4344
4344
|
})
|
|
4345
4345
|
}),
|
|
4346
|
-
!
|
|
4346
|
+
!l && D && D.length > 0 && /* @__PURE__ */ Z("td", {
|
|
4347
4347
|
style: {
|
|
4348
4348
|
padding: "4px 8px",
|
|
4349
4349
|
borderBottom: "1px solid var(--divider)",
|
|
4350
4350
|
verticalAlign: "middle"
|
|
4351
4351
|
},
|
|
4352
4352
|
children: /* @__PURE__ */ Z(Tr, {
|
|
4353
|
-
actions:
|
|
4353
|
+
actions: D,
|
|
4354
4354
|
objectIds: [t],
|
|
4355
|
-
row:
|
|
4356
|
-
onSuccess:
|
|
4355
|
+
row: M,
|
|
4356
|
+
onSuccess: k
|
|
4357
4357
|
})
|
|
4358
4358
|
})
|
|
4359
4359
|
]
|
|
4360
4360
|
});
|
|
4361
4361
|
}
|
|
4362
|
-
function di({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving:
|
|
4363
|
-
let
|
|
4362
|
+
function di({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving: s, onChange: c, onConfirm: l, onCancel: d, refs: f, accent: p }) {
|
|
4363
|
+
let m = j(), h = a.find((e) => e.startsWith("_error:")), g = new Set(a.filter((e) => !e.startsWith("_error:"))), _ = {
|
|
4364
4364
|
padding: "6px 12px",
|
|
4365
4365
|
borderBottom: "1px solid var(--divider)",
|
|
4366
4366
|
verticalAlign: "middle",
|
|
4367
4367
|
height: 40,
|
|
4368
4368
|
minWidth: 0
|
|
4369
|
-
},
|
|
4369
|
+
}, v = {
|
|
4370
4370
|
display: "block",
|
|
4371
4371
|
width: "100%",
|
|
4372
4372
|
maxWidth: "100%",
|
|
4373
4373
|
minWidth: 0
|
|
4374
4374
|
};
|
|
4375
4375
|
return /* @__PURE__ */ Q("tr", {
|
|
4376
|
-
style:
|
|
4376
|
+
style: p ? { boxShadow: "inset 3px 0 0 var(--accent)" } : void 0,
|
|
4377
4377
|
onKeyDown: (e) => {
|
|
4378
|
-
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(),
|
|
4378
|
+
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), l()) : e.key === "Escape" && (e.preventDefault(), d());
|
|
4379
4379
|
},
|
|
4380
4380
|
children: [r.map((e) => {
|
|
4381
|
-
let r = n.fields.get(e), a = i.has(e), o =
|
|
4381
|
+
let r = n.fields.get(e), a = i.has(e), o = g.has(e);
|
|
4382
4382
|
return a ? /* @__PURE__ */ Z("td", {
|
|
4383
4383
|
style: {
|
|
4384
|
-
...
|
|
4384
|
+
..._,
|
|
4385
4385
|
outline: o ? "1px solid var(--danger)" : "none",
|
|
4386
4386
|
outlineOffset: -1
|
|
4387
4387
|
},
|
|
4388
4388
|
title: o ? `${e} is required` : void 0,
|
|
4389
4389
|
children: /* @__PURE__ */ Z("div", {
|
|
4390
|
-
style:
|
|
4391
|
-
children: r ?
|
|
4390
|
+
style: v,
|
|
4391
|
+
children: r ? O({
|
|
4392
4392
|
field: r,
|
|
4393
4393
|
fieldName: e,
|
|
4394
4394
|
value: t[e],
|
|
4395
4395
|
mode: "edit",
|
|
4396
|
-
onChange: (t) =>
|
|
4396
|
+
onChange: (t) => c(e, t),
|
|
4397
4397
|
record: t,
|
|
4398
|
-
refs:
|
|
4398
|
+
refs: f,
|
|
4399
4399
|
compact: !0,
|
|
4400
|
-
locale:
|
|
4401
|
-
}) :
|
|
4400
|
+
locale: m
|
|
4401
|
+
}) : x(t[e])
|
|
4402
4402
|
})
|
|
4403
4403
|
}, e) : /* @__PURE__ */ Z("td", {
|
|
4404
4404
|
style: {
|
|
4405
|
-
...
|
|
4405
|
+
..._,
|
|
4406
4406
|
color: "var(--text-3)"
|
|
4407
4407
|
},
|
|
4408
|
-
children: r?.auto ? "—" :
|
|
4408
|
+
children: r?.auto ? "—" : x(t[e])
|
|
4409
4409
|
}, e);
|
|
4410
4410
|
}), /* @__PURE__ */ Z("td", {
|
|
4411
|
-
style:
|
|
4411
|
+
style: _,
|
|
4412
4412
|
children: /* @__PURE__ */ Q("div", {
|
|
4413
4413
|
style: {
|
|
4414
4414
|
display: "flex",
|
|
@@ -4417,24 +4417,24 @@ function di({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
|
|
|
4417
4417
|
justifyContent: "flex-end"
|
|
4418
4418
|
},
|
|
4419
4419
|
children: [
|
|
4420
|
-
|
|
4420
|
+
h && /* @__PURE__ */ Z("span", {
|
|
4421
4421
|
style: {
|
|
4422
4422
|
fontSize: 11,
|
|
4423
4423
|
color: "var(--danger)"
|
|
4424
4424
|
},
|
|
4425
|
-
title:
|
|
4425
|
+
title: h.slice(7),
|
|
4426
4426
|
children: "!"
|
|
4427
4427
|
}),
|
|
4428
|
-
/* @__PURE__ */ Z(
|
|
4428
|
+
/* @__PURE__ */ Z(o, {
|
|
4429
4429
|
size: 24,
|
|
4430
|
-
icon: Z(
|
|
4431
|
-
onClick:
|
|
4430
|
+
icon: Z(s ? u : e.check, { size: 12 }),
|
|
4431
|
+
onClick: l,
|
|
4432
4432
|
title: "Confirm (Enter)"
|
|
4433
4433
|
}),
|
|
4434
|
-
/* @__PURE__ */ Z(
|
|
4434
|
+
/* @__PURE__ */ Z(o, {
|
|
4435
4435
|
size: 24,
|
|
4436
4436
|
icon: /* @__PURE__ */ Z(e.x, { size: 12 }),
|
|
4437
|
-
onClick:
|
|
4437
|
+
onClick: d,
|
|
4438
4438
|
title: "Cancel (Esc)"
|
|
4439
4439
|
})
|
|
4440
4440
|
]
|
|
@@ -4442,18 +4442,18 @@ function di({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
|
|
|
4442
4442
|
})]
|
|
4443
4443
|
});
|
|
4444
4444
|
}
|
|
4445
|
-
function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving:
|
|
4446
|
-
let
|
|
4445
|
+
function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving: s, onChange: c, onConfirm: l, onCancel: d, refs: f, accent: p }) {
|
|
4446
|
+
let m = j(), h = je(), g = a.find((e) => e.startsWith("_error:")), _ = new Set(a.filter((e) => !e.startsWith("_error:")));
|
|
4447
4447
|
return /* @__PURE__ */ Q("div", {
|
|
4448
4448
|
style: {
|
|
4449
4449
|
border: "1px solid var(--border)",
|
|
4450
4450
|
borderRadius: 8,
|
|
4451
4451
|
background: "var(--surface)",
|
|
4452
4452
|
overflow: "hidden",
|
|
4453
|
-
boxShadow:
|
|
4453
|
+
boxShadow: p ? "inset 3px 0 0 var(--accent)" : void 0
|
|
4454
4454
|
},
|
|
4455
4455
|
onKeyDown: (e) => {
|
|
4456
|
-
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(),
|
|
4456
|
+
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), l()) : e.key === "Escape" && (e.preventDefault(), d());
|
|
4457
4457
|
},
|
|
4458
4458
|
children: [/* @__PURE__ */ Z("div", {
|
|
4459
4459
|
style: {
|
|
@@ -4463,7 +4463,7 @@ function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
|
|
|
4463
4463
|
gap: 12
|
|
4464
4464
|
},
|
|
4465
4465
|
children: r.map((e) => {
|
|
4466
|
-
let r = n.fields.get(e), a = i.has(e), o =
|
|
4466
|
+
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
4467
|
fontSize: 11.5,
|
|
4468
4468
|
fontWeight: 600,
|
|
4469
4469
|
color: "var(--text-3)"
|
|
@@ -4476,14 +4476,14 @@ function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
|
|
|
4476
4476
|
minWidth: 0
|
|
4477
4477
|
},
|
|
4478
4478
|
children: [a && r ? /* @__PURE__ */ Z("label", {
|
|
4479
|
-
id:
|
|
4479
|
+
id: u,
|
|
4480
4480
|
htmlFor: l,
|
|
4481
|
-
style:
|
|
4482
|
-
children:
|
|
4481
|
+
style: d,
|
|
4482
|
+
children: s
|
|
4483
4483
|
}) : /* @__PURE__ */ Z("div", {
|
|
4484
|
-
id:
|
|
4485
|
-
style:
|
|
4486
|
-
children:
|
|
4484
|
+
id: u,
|
|
4485
|
+
style: d,
|
|
4486
|
+
children: s
|
|
4487
4487
|
}), /* @__PURE__ */ Z("div", {
|
|
4488
4488
|
style: {
|
|
4489
4489
|
minWidth: 0,
|
|
@@ -4492,19 +4492,19 @@ function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
|
|
|
4492
4492
|
borderRadius: o ? 5 : 0
|
|
4493
4493
|
},
|
|
4494
4494
|
title: o ? `${e} is required` : void 0,
|
|
4495
|
-
children: a ? r ?
|
|
4495
|
+
children: a ? r ? O({
|
|
4496
4496
|
field: r,
|
|
4497
4497
|
fieldName: e,
|
|
4498
4498
|
value: t[e],
|
|
4499
4499
|
mode: "edit",
|
|
4500
|
-
onChange: (t) =>
|
|
4500
|
+
onChange: (t) => c(e, t),
|
|
4501
4501
|
record: t,
|
|
4502
|
-
refs:
|
|
4502
|
+
refs: f,
|
|
4503
4503
|
compact: !0,
|
|
4504
4504
|
fieldId: l,
|
|
4505
|
-
labelId:
|
|
4506
|
-
locale:
|
|
4507
|
-
}) :
|
|
4505
|
+
labelId: u,
|
|
4506
|
+
locale: m
|
|
4507
|
+
}) : x(t[e]) : r?.auto ? "—" : x(t[e])
|
|
4508
4508
|
})]
|
|
4509
4509
|
}, e);
|
|
4510
4510
|
})
|
|
@@ -4519,24 +4519,24 @@ function fi({ values: t, entity: n, columns: r, editableColumns: i, errors: a, s
|
|
|
4519
4519
|
gap: 6
|
|
4520
4520
|
},
|
|
4521
4521
|
children: [
|
|
4522
|
-
|
|
4522
|
+
g && /* @__PURE__ */ Z("span", {
|
|
4523
4523
|
style: {
|
|
4524
4524
|
fontSize: 11,
|
|
4525
4525
|
color: "var(--danger)"
|
|
4526
4526
|
},
|
|
4527
|
-
title:
|
|
4527
|
+
title: g.slice(7),
|
|
4528
4528
|
children: "!"
|
|
4529
4529
|
}),
|
|
4530
|
-
/* @__PURE__ */ Z(
|
|
4530
|
+
/* @__PURE__ */ Z(o, {
|
|
4531
4531
|
size: 32,
|
|
4532
|
-
icon: Z(
|
|
4533
|
-
onClick:
|
|
4532
|
+
icon: Z(s ? u : e.check, { size: 14 }),
|
|
4533
|
+
onClick: l,
|
|
4534
4534
|
title: "Confirm (Enter)"
|
|
4535
4535
|
}),
|
|
4536
|
-
/* @__PURE__ */ Z(
|
|
4536
|
+
/* @__PURE__ */ Z(o, {
|
|
4537
4537
|
size: 32,
|
|
4538
4538
|
icon: /* @__PURE__ */ Z(e.x, { size: 14 }),
|
|
4539
|
-
onClick:
|
|
4539
|
+
onClick: d,
|
|
4540
4540
|
title: "Cancel (Esc)"
|
|
4541
4541
|
})
|
|
4542
4542
|
]
|
|
@@ -4755,49 +4755,49 @@ function Ti(e, t) {
|
|
|
4755
4755
|
//#endregion
|
|
4756
4756
|
//#region src/hooks/useScreenBack.ts
|
|
4757
4757
|
function Ei(e) {
|
|
4758
|
-
let t = Pe(),
|
|
4758
|
+
let t = Pe(), r = n(), i = c(), a = Tt((e) => e.depth), { data: o } = A(), s = e?.fallback, l = wt((e) => {
|
|
4759
4759
|
let t = e.tabs.find((t) => t.id === e.activeTabId);
|
|
4760
4760
|
return t ? t.returnTo : void 0;
|
|
4761
|
-
}), { hasOriginBack:
|
|
4762
|
-
if (
|
|
4763
|
-
Tt.getState().depth > 0 ?
|
|
4761
|
+
}), { hasOriginBack: u, allowFallbackBack: d } = q(() => Mt(l, r.enabled), [l, r.enabled]), f = G(() => {
|
|
4762
|
+
if (r.enabled) {
|
|
4763
|
+
Tt.getState().depth > 0 ? i() : s?.();
|
|
4764
4764
|
return;
|
|
4765
4765
|
}
|
|
4766
|
-
let e = wt.getState(),
|
|
4767
|
-
if (!
|
|
4768
|
-
|
|
4766
|
+
let e = wt.getState(), n = Nt(e.tabs.find((t) => t.id === e.activeTabId)?.returnTo, e.tabs, !1);
|
|
4767
|
+
if (!n) {
|
|
4768
|
+
s?.();
|
|
4769
4769
|
return;
|
|
4770
4770
|
}
|
|
4771
|
-
if (
|
|
4772
|
-
else if (
|
|
4773
|
-
let t =
|
|
4771
|
+
if (n.kind === "live" && n.tabId) e.commitTabNavigation(n.tabId, { search: n.search ?? "" });
|
|
4772
|
+
else if (n.kind === "reopen") {
|
|
4773
|
+
let t = n.title ? void 0 : oe(n.pathname, o?.screens, o?.entities);
|
|
4774
4774
|
e.openTab({
|
|
4775
|
-
pathname:
|
|
4776
|
-
search:
|
|
4777
|
-
title:
|
|
4778
|
-
icon:
|
|
4779
|
-
screen:
|
|
4775
|
+
pathname: n.pathname,
|
|
4776
|
+
search: n.search ?? "",
|
|
4777
|
+
title: n.title ?? t?.title ?? n.pathname,
|
|
4778
|
+
icon: n.icon ?? t?.icon,
|
|
4779
|
+
screen: n.screen,
|
|
4780
4780
|
closable: !0
|
|
4781
4781
|
});
|
|
4782
4782
|
}
|
|
4783
4783
|
t({
|
|
4784
|
-
pathname:
|
|
4785
|
-
search: At(
|
|
4786
|
-
hash:
|
|
4784
|
+
pathname: n.pathname,
|
|
4785
|
+
search: At(n.search),
|
|
4786
|
+
hash: n.hash || void 0
|
|
4787
4787
|
});
|
|
4788
4788
|
}, [
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4789
|
+
r.enabled,
|
|
4790
|
+
i,
|
|
4791
|
+
s,
|
|
4792
4792
|
t,
|
|
4793
|
-
|
|
4794
|
-
|
|
4793
|
+
o?.screens,
|
|
4794
|
+
o?.entities
|
|
4795
4795
|
]);
|
|
4796
4796
|
return {
|
|
4797
|
-
canGoBack:
|
|
4798
|
-
hasOriginBack:
|
|
4799
|
-
allowFallbackBack:
|
|
4800
|
-
goBack:
|
|
4797
|
+
canGoBack: r.enabled ? a > 0 || !!s : u || !!s,
|
|
4798
|
+
hasOriginBack: u,
|
|
4799
|
+
allowFallbackBack: d,
|
|
4800
|
+
goBack: f
|
|
4801
4801
|
};
|
|
4802
4802
|
}
|
|
4803
4803
|
//#endregion
|
|
@@ -5074,7 +5074,7 @@ function sa(e, t) {
|
|
|
5074
5074
|
function ca(e, t) {
|
|
5075
5075
|
if (!e) return [];
|
|
5076
5076
|
let n = new $();
|
|
5077
|
-
for (let r of
|
|
5077
|
+
for (let r of z(e)) n.add(r), t.addField(r, "identity");
|
|
5078
5078
|
let r = Qi(e, e.display.display_field, { explicit: !0 });
|
|
5079
5079
|
r && (n.add(r), t.addField(r, "display"), xa(e, r, t, "display"));
|
|
5080
5080
|
for (let r of la(e.display.display_template)) {
|
|
@@ -5334,7 +5334,7 @@ var $ = class {
|
|
|
5334
5334
|
},
|
|
5335
5335
|
children: this.state.error?.message || "An unexpected error occurred."
|
|
5336
5336
|
}),
|
|
5337
|
-
/* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(
|
|
5337
|
+
/* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(l, {
|
|
5338
5338
|
onClick: this.handleRetry,
|
|
5339
5339
|
children: "Try again"
|
|
5340
5340
|
}) })
|
|
@@ -5356,7 +5356,7 @@ function Da(e, t) {
|
|
|
5356
5356
|
let n = Ea(e, t), r = n[2];
|
|
5357
5357
|
return Le({
|
|
5358
5358
|
queryKey: n,
|
|
5359
|
-
queryFn: () =>
|
|
5359
|
+
queryFn: () => C(e, t),
|
|
5360
5360
|
enabled: !!e && !!t && t !== "new" && r !== void 0
|
|
5361
5361
|
});
|
|
5362
5362
|
}
|