@declarion/react 0.40.4 → 0.42.0
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-BkqtkJuz.js → DraggableChildrenTable-G4Sw1XAD.js} +43 -43
- package/dist-lib/{Grid-CTxov4x2.js → Grid-CXn-IK3H.js} +2 -2
- package/dist-lib/{LayoutRenderer-Cbh-pY26.js → LayoutRenderer-DX8pFS5A.js} +906 -861
- package/dist-lib/MarkdownRenderer-CreI9x2m.js +85 -0
- package/dist-lib/{MonacoJson-BfpzZ1iT.js → MonacoJson-BG3S3GHX.js} +1 -1
- package/dist-lib/{RefreshControl-DG2kMABB.js → RefreshControl-DFh0-gCb.js} +59 -61
- package/dist-lib/{SmartDetailPage.impl-DCJ_V-Nh.js → SmartDetailPage.impl-K6Jj1-9z.js} +545 -545
- package/dist-lib/{SmartRecordListPage.impl-sYCMQw8V.js → SmartRecordListPage.impl-DQW_uVfL.js} +250 -250
- package/dist-lib/declarion-react.css +2 -2
- package/dist-lib/embed/useEmbedNavigate.d.ts +1 -1
- package/dist-lib/hooks/usePageStateTtl.d.ts +1 -1
- package/dist-lib/index.d.ts +1 -1
- package/dist-lib/index.js +1217 -1217
- package/dist-lib/lib/brand-tokens.d.ts +1 -1
- package/dist-lib/lib/evidence-verdict.d.ts +0 -1
- package/dist-lib/lib/safe-url.d.ts +14 -0
- package/dist-lib/{registry-DbZX1hy8.js → registry-r4hiflwC.js} +502 -502
- package/dist-lib/testing.js +43 -43
- package/dist-lib/types/api.d.ts +1 -1
- package/dist-lib/{useCurrentScreen-C33VZcNn.js → useCurrentScreen-CpQjVmrT.js} +1409 -1292
- package/dist-lib/{useProperties-BgAEk8X9.js → useProperties-CULxrNT4.js} +44 -44
- package/dist-lib/{value-VOi8Svry.js → value-fUHxMV4r.js} +20 -20
- package/package.json +23 -23
- package/dist-lib/MarkdownRenderer-DeguFsZL.js +0 -98
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { s as e, t } from "./DynamicIcon-DeRpAaXm.js";
|
|
2
|
-
import { A as n,
|
|
3
|
-
import { a as _e, c as ve, d as ye, f as be, i as xe, l as Se, n as Ce, o as we, p as Te, r as Ee, s as De, t as Oe, u as ke } from "./value-
|
|
2
|
+
import { A as n, An as r, At as i, B as a, C as o, Cn as s, E as c, En as l, Gn as u, Gt as d, I as f, In as p, Jn as m, K as h, L as g, Ln as _, Mn as v, O as y, P as b, R as x, St as S, T as C, Tt as w, U as T, V as E, W as D, X as O, Xn as k, Zn as A, _ as j, _t as M, ar as N, b as P, bn as F, bt as I, cr as L, d as R, g as z, gt as ee, i as te, j as B, kt as ne, lr as V, mn as re, nr as ie, ot as ae, pt as oe, rt as H, sr as se, st as ce, u as le, v as ue, vt as de, wn as U, wt as fe, xn as pe, yn as me, yt as he, z as ge } from "./useCurrentScreen-CpQjVmrT.js";
|
|
3
|
+
import { a as _e, c as ve, d as ye, f as be, i as xe, l as Se, n as Ce, o as we, p as Te, r as Ee, s as De, t as Oe, u as ke } from "./value-fUHxMV4r.js";
|
|
4
4
|
import { n as Ae, r as je, t as Me } from "./dataTableStyles-vwD1mVOP.js";
|
|
5
5
|
import { Component as Ne, Suspense as Pe, lazy as Fe, useCallback as W, useEffect as G, useId as Ie, useLayoutEffect as Le, useMemo as K, useRef as q, useState as J } from "react";
|
|
6
|
-
import { parsePath as Re, useNavigate as ze } from "react-router
|
|
6
|
+
import { parsePath as Re, useNavigate as ze } from "react-router";
|
|
7
7
|
import { useInfiniteQuery as Be, useMutation as Ve, useQuery as He, useQueryClient as Ue } from "@tanstack/react-query";
|
|
8
8
|
import { Fragment as Y, jsx as X, jsxs as Z } from "react/jsx-runtime";
|
|
9
9
|
import { create as We } from "zustand";
|
|
@@ -119,14 +119,14 @@ function Je({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
|
|
|
119
119
|
]
|
|
120
120
|
})
|
|
121
121
|
}),
|
|
122
|
-
i && /* @__PURE__ */ X(
|
|
122
|
+
i && /* @__PURE__ */ X(se, {
|
|
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
|
-
c && /* @__PURE__ */ X(
|
|
129
|
+
c && /* @__PURE__ */ X(L, {
|
|
130
130
|
size: 24,
|
|
131
131
|
icon: X(m ? e.up : e.down, { size: 14 }),
|
|
132
132
|
onClick: () => h((e) => !e),
|
|
@@ -579,7 +579,7 @@ function zt(e) {
|
|
|
579
579
|
if (!(!e || e === "?")) return e.startsWith("?") ? e : `?${e}`;
|
|
580
580
|
}
|
|
581
581
|
function Bt() {
|
|
582
|
-
let e = ze(), { data: t } =
|
|
582
|
+
let e = ze(), { data: t } = i(), n = oe(), r = ce();
|
|
583
583
|
return W((i, a) => {
|
|
584
584
|
let { pathname: o, search: s, hash: c } = Rt(i, a?.search);
|
|
585
585
|
if (n.enabled) {
|
|
@@ -614,12 +614,12 @@ function Bt() {
|
|
|
614
614
|
}, { replace: a?.replace });
|
|
615
615
|
return;
|
|
616
616
|
}
|
|
617
|
-
let m = a?.title ? void 0 :
|
|
617
|
+
let m = a?.title ? void 0 : v(o, t?.screens, t?.entities), h = a?.title ?? m?.title ?? o, g = a?.icon ?? m?.icon;
|
|
618
618
|
l.openTab({
|
|
619
619
|
pathname: o,
|
|
620
620
|
search: d,
|
|
621
621
|
title: h,
|
|
622
|
-
icon:
|
|
622
|
+
icon: g,
|
|
623
623
|
closable: !0,
|
|
624
624
|
returnTo: u ? null : f
|
|
625
625
|
}), e({
|
|
@@ -669,7 +669,7 @@ function Xt(e) {
|
|
|
669
669
|
return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[1][0]).toUpperCase();
|
|
670
670
|
}
|
|
671
671
|
function Zt(e) {
|
|
672
|
-
let { field: t, fieldName: n, value: r, onChange:
|
|
672
|
+
let { field: t, fieldName: n, value: r, onChange: i, mode: o, alt: s, disabled: c, visual: l, uploadFieldCode: u, uploadSlotCode: d } = e, p = Ce(r), [m, h] = J("idle"), [_, v] = J(null), [y, x] = J(null), [S, C] = J(null), [w, T] = J(!1), E = q(null), D = q(!1), O = q(null), { register: k, unregister: A, isDraft: j } = b();
|
|
673
673
|
G(() => () => {
|
|
674
674
|
E.current && E.current.abort();
|
|
675
675
|
}, []);
|
|
@@ -679,9 +679,9 @@ function Zt(e) {
|
|
|
679
679
|
n,
|
|
680
680
|
p
|
|
681
681
|
]), N = (t.accepts ?? ["image/*"]).join(","), P = W(async (r) => {
|
|
682
|
-
let o =
|
|
682
|
+
let o = a(r, t.accepts, t.max_size_bytes);
|
|
683
683
|
if (o) {
|
|
684
|
-
x(o),
|
|
684
|
+
x(o), h("error");
|
|
685
685
|
return;
|
|
686
686
|
}
|
|
687
687
|
let s = r;
|
|
@@ -695,10 +695,10 @@ function Zt(e) {
|
|
|
695
695
|
x({
|
|
696
696
|
code: "CROP_FAILED",
|
|
697
697
|
message: e instanceof Error ? e.message : "Crop failed"
|
|
698
|
-
}),
|
|
698
|
+
}), h("error");
|
|
699
699
|
return;
|
|
700
700
|
}
|
|
701
|
-
x(null), D.current = !1,
|
|
701
|
+
x(null), D.current = !1, h("uploading"), v({
|
|
702
702
|
loaded: 0,
|
|
703
703
|
total: s.size,
|
|
704
704
|
pct: 0
|
|
@@ -710,16 +710,16 @@ function Zt(e) {
|
|
|
710
710
|
file: s,
|
|
711
711
|
entityCode: e.entityCode,
|
|
712
712
|
fieldCode: u ?? n,
|
|
713
|
-
slotCode:
|
|
713
|
+
slotCode: d,
|
|
714
714
|
signal: c.signal,
|
|
715
|
-
onProgress:
|
|
715
|
+
onProgress: v
|
|
716
716
|
});
|
|
717
717
|
if (D.current) {
|
|
718
|
-
|
|
718
|
+
g(r.id).catch(() => {}), A(r.id);
|
|
719
719
|
return;
|
|
720
720
|
}
|
|
721
|
-
p && j(p.id) && (
|
|
722
|
-
let
|
|
721
|
+
p && j(p.id) && (g(p.id).catch(() => {}), A(p.id)), k(r.id, () => g(r.id)), C(r.id), h("idle"), v(null);
|
|
722
|
+
let a = {
|
|
723
723
|
id: r.id,
|
|
724
724
|
filename: r.filename,
|
|
725
725
|
content_type: r.content_type,
|
|
@@ -730,17 +730,17 @@ function Zt(e) {
|
|
|
730
730
|
url: r.url,
|
|
731
731
|
metadata: r.metadata
|
|
732
732
|
};
|
|
733
|
-
|
|
733
|
+
i?.(t.mode === "array" ? [a] : a);
|
|
734
734
|
} catch (e) {
|
|
735
|
-
if (e instanceof
|
|
736
|
-
let t = e instanceof
|
|
735
|
+
if (e instanceof f && e.code === "ABORTED") return;
|
|
736
|
+
let t = e instanceof f ? {
|
|
737
737
|
code: e.code,
|
|
738
738
|
message: e.message
|
|
739
739
|
} : {
|
|
740
740
|
code: "UNKNOWN",
|
|
741
741
|
message: e instanceof Error ? e.message : "Upload failed"
|
|
742
742
|
};
|
|
743
|
-
x(t),
|
|
743
|
+
x(t), h("error"), v(null);
|
|
744
744
|
}
|
|
745
745
|
}, [
|
|
746
746
|
t.accepts,
|
|
@@ -749,68 +749,68 @@ function Zt(e) {
|
|
|
749
749
|
t.display?.aspect_ratio,
|
|
750
750
|
t.mode,
|
|
751
751
|
n,
|
|
752
|
-
|
|
752
|
+
i,
|
|
753
753
|
e.entityCode,
|
|
754
754
|
k,
|
|
755
755
|
j,
|
|
756
756
|
p,
|
|
757
757
|
A,
|
|
758
758
|
u,
|
|
759
|
-
|
|
759
|
+
d
|
|
760
760
|
]), F = W(() => {
|
|
761
|
-
m === "uploading" && E.current && (D.current = !0, E.current.abort(), E.current = null,
|
|
761
|
+
m === "uploading" && E.current && (D.current = !0, E.current.abort(), E.current = null, h("idle"), v(null)), S && (g(S).catch(() => {}), A(S), C(null));
|
|
762
762
|
}, [
|
|
763
763
|
m,
|
|
764
764
|
S,
|
|
765
765
|
A
|
|
766
766
|
]), I = W(() => {
|
|
767
|
-
p && j(p.id) && (
|
|
767
|
+
p && j(p.id) && (g(p.id).catch(() => {}), A(p.id), C(null)), i?.(t.mode === "array" ? [] : null);
|
|
768
768
|
}, [
|
|
769
769
|
p,
|
|
770
770
|
t.mode,
|
|
771
771
|
j,
|
|
772
|
-
|
|
772
|
+
i,
|
|
773
773
|
A
|
|
774
774
|
]), L = W(() => {
|
|
775
|
-
x(null),
|
|
775
|
+
x(null), h("idle"), O.current?.click();
|
|
776
776
|
}, []), R = W(() => {
|
|
777
777
|
c || O.current?.click();
|
|
778
|
-
}, [c]),
|
|
778
|
+
}, [c]), z = W((e) => {
|
|
779
779
|
c || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), R());
|
|
780
|
-
}, [c, R]),
|
|
780
|
+
}, [c, R]), ee = W((e) => {
|
|
781
781
|
c || (e.preventDefault(), e.dataTransfer.dropEffect = "copy");
|
|
782
|
-
}, [c]),
|
|
782
|
+
}, [c]), te = W((e) => {
|
|
783
783
|
if (c) return;
|
|
784
784
|
e.preventDefault();
|
|
785
785
|
let t = e.dataTransfer.files?.[0];
|
|
786
786
|
t && P(t);
|
|
787
|
-
}, [c, P]),
|
|
787
|
+
}, [c, P]), B = W((e) => {
|
|
788
788
|
let t = e.target.files?.[0];
|
|
789
789
|
e.target.value = "", t && P(t);
|
|
790
|
-
}, [P]),
|
|
791
|
-
aspectRatio:
|
|
790
|
+
}, [P]), ne = l.aspectRatio ?? en(l.shape, t.display?.aspect_ratio), V = ye(p), re = {
|
|
791
|
+
aspectRatio: ne,
|
|
792
792
|
width: l.width ?? (l.shape === "wide" ? "100%" : "120px")
|
|
793
|
-
},
|
|
793
|
+
}, ie = !!p, ae = Yt(p, t.display?.listable_thumbnail), oe = Se(p, t.display?.listable_thumbnail), H = xe(p?.id, oe, ae), se = o === "display", ce = W((e) => {
|
|
794
794
|
e.stopPropagation(), T((e) => !e);
|
|
795
|
-
}, []),
|
|
795
|
+
}, []), le = W((e) => {
|
|
796
796
|
if (!p || !w) return;
|
|
797
|
-
let n = e.currentTarget.getBoundingClientRect(), r = n.width > 0 ? (e.clientX - n.left) / n.width : .5,
|
|
797
|
+
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 = Te(p, {
|
|
798
798
|
x: Math.max(0, Math.min(1, r)),
|
|
799
|
-
y: Math.max(0, Math.min(1,
|
|
799
|
+
y: Math.max(0, Math.min(1, a))
|
|
800
800
|
});
|
|
801
|
-
|
|
801
|
+
i?.(t.mode === "array" ? [o] : o), T(!1);
|
|
802
802
|
}, [
|
|
803
803
|
t.mode,
|
|
804
804
|
p,
|
|
805
805
|
w,
|
|
806
|
-
|
|
806
|
+
i
|
|
807
807
|
]);
|
|
808
|
-
return
|
|
808
|
+
return se ? /* @__PURE__ */ X("div", {
|
|
809
809
|
className: Qt(l.shape, !1),
|
|
810
810
|
style: re,
|
|
811
811
|
"aria-label": M,
|
|
812
|
-
children:
|
|
813
|
-
src:
|
|
812
|
+
children: ie && H ? /* @__PURE__ */ X("img", {
|
|
813
|
+
src: H,
|
|
814
814
|
alt: M,
|
|
815
815
|
className: $t(l.shape),
|
|
816
816
|
style: { objectPosition: De(V) },
|
|
@@ -829,23 +829,23 @@ function Zt(e) {
|
|
|
829
829
|
"aria-disabled": c || void 0,
|
|
830
830
|
"aria-busy": m === "uploading" || void 0,
|
|
831
831
|
"aria-invalid": m === "error" || void 0,
|
|
832
|
-
onClick: m === "idle" && !
|
|
833
|
-
onMouseDown: w ?
|
|
834
|
-
onKeyDown:
|
|
835
|
-
onDragOver:
|
|
836
|
-
onDrop:
|
|
832
|
+
onClick: m === "idle" && !ie ? R : void 0,
|
|
833
|
+
onMouseDown: w ? le : void 0,
|
|
834
|
+
onKeyDown: z,
|
|
835
|
+
onDragOver: ee,
|
|
836
|
+
onDrop: te,
|
|
837
837
|
"data-testid": w ? "focal-point-target" : `file-widget-${n}`,
|
|
838
838
|
children: [
|
|
839
839
|
/* @__PURE__ */ X("input", {
|
|
840
840
|
ref: O,
|
|
841
841
|
type: "file",
|
|
842
842
|
accept: N,
|
|
843
|
-
onChange:
|
|
843
|
+
onChange: B,
|
|
844
844
|
style: { display: "none" },
|
|
845
845
|
"data-testid": `file-input-${n}`
|
|
846
846
|
}),
|
|
847
|
-
|
|
848
|
-
src:
|
|
847
|
+
ie && H ? /* @__PURE__ */ X("img", {
|
|
848
|
+
src: H,
|
|
849
849
|
alt: M,
|
|
850
850
|
className: $t(l.shape),
|
|
851
851
|
style: { objectPosition: De(V) },
|
|
@@ -861,13 +861,13 @@ function Zt(e) {
|
|
|
861
861
|
"aria-hidden": "true",
|
|
862
862
|
"data-testid": "draft-indicator"
|
|
863
863
|
}),
|
|
864
|
-
|
|
864
|
+
ie && m === "idle" && !c && /* @__PURE__ */ Z("div", {
|
|
865
865
|
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",
|
|
866
866
|
children: [
|
|
867
867
|
t.display?.focal_point && /* @__PURE__ */ X("button", {
|
|
868
868
|
type: "button",
|
|
869
869
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
870
|
-
onClick:
|
|
870
|
+
onClick: ce,
|
|
871
871
|
"data-testid": "focal-point-toggle",
|
|
872
872
|
children: w ? "Cancel focus" : "Set focus"
|
|
873
873
|
}),
|
|
@@ -889,7 +889,7 @@ function Zt(e) {
|
|
|
889
889
|
})
|
|
890
890
|
]
|
|
891
891
|
}),
|
|
892
|
-
V &&
|
|
892
|
+
V && ie && /* @__PURE__ */ X("span", {
|
|
893
893
|
className: "absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white bg-black/70",
|
|
894
894
|
style: {
|
|
895
895
|
left: `${V.x * 100}%`,
|
|
@@ -906,13 +906,13 @@ function Zt(e) {
|
|
|
906
906
|
"data-testid": "cancel-upload",
|
|
907
907
|
children: "Cancel"
|
|
908
908
|
}),
|
|
909
|
-
m === "error" &&
|
|
909
|
+
m === "error" && y && /* @__PURE__ */ Z("div", {
|
|
910
910
|
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",
|
|
911
911
|
role: "alert",
|
|
912
912
|
children: [/* @__PURE__ */ X("span", {
|
|
913
913
|
className: "truncate",
|
|
914
|
-
title:
|
|
915
|
-
children:
|
|
914
|
+
title: y.message,
|
|
915
|
+
children: y.message
|
|
916
916
|
}), /* @__PURE__ */ X("button", {
|
|
917
917
|
type: "button",
|
|
918
918
|
className: "underline",
|
|
@@ -1029,7 +1029,7 @@ function sn(e) {
|
|
|
1029
1029
|
}
|
|
1030
1030
|
//#endregion
|
|
1031
1031
|
//#region src/components/file-widgets/GridLazy.tsx
|
|
1032
|
-
var cn = Fe(() => import("./Grid-
|
|
1032
|
+
var cn = Fe(() => import("./Grid-CXn-IK3H.js").then((e) => ({ default: e.Grid })));
|
|
1033
1033
|
function ln() {
|
|
1034
1034
|
return /* @__PURE__ */ X("div", { className: "h-24 w-full rounded-md bg-muted animate-pulse" });
|
|
1035
1035
|
}
|
|
@@ -1048,19 +1048,19 @@ function dn({ contentType: e }) {
|
|
|
1048
1048
|
});
|
|
1049
1049
|
}
|
|
1050
1050
|
function fn(e) {
|
|
1051
|
-
let { field: t, fieldName: n, value: r, onChange:
|
|
1051
|
+
let { field: t, fieldName: n, value: r, onChange: i, mode: o, disabled: s, uploadFieldCode: c, uploadSlotCode: l } = e, u = Ce(r), [d, p] = J("idle"), [m, h] = J(null), [_, v] = J(null), [y, S] = J(!1), [C, w] = J(u?.filename ?? ""), T = q(null), E = q(!1), D = q(null), { register: O, unregister: k, isDraft: A } = b(), { open: j } = Ee();
|
|
1052
1052
|
G(() => () => {
|
|
1053
1053
|
T.current && T.current.abort();
|
|
1054
1054
|
}, []), G(() => {
|
|
1055
1055
|
w(u?.filename ?? "");
|
|
1056
1056
|
}, [u?.filename]);
|
|
1057
1057
|
let M = (t.accepts ?? []).join(","), N = W(async (r) => {
|
|
1058
|
-
let o =
|
|
1058
|
+
let o = a(r, t.accepts, t.max_size_bytes);
|
|
1059
1059
|
if (o) {
|
|
1060
|
-
|
|
1060
|
+
v(o), p("error");
|
|
1061
1061
|
return;
|
|
1062
1062
|
}
|
|
1063
|
-
|
|
1063
|
+
v(null), E.current = !1, p("uploading"), h({
|
|
1064
1064
|
loaded: 0,
|
|
1065
1065
|
total: r.size,
|
|
1066
1066
|
pct: 0
|
|
@@ -1068,41 +1068,41 @@ function fn(e) {
|
|
|
1068
1068
|
let s = new AbortController();
|
|
1069
1069
|
T.current = s;
|
|
1070
1070
|
try {
|
|
1071
|
-
let
|
|
1071
|
+
let a = await ge({
|
|
1072
1072
|
file: r,
|
|
1073
1073
|
entityCode: e.entityCode,
|
|
1074
1074
|
fieldCode: c ?? n,
|
|
1075
1075
|
slotCode: l,
|
|
1076
1076
|
signal: s.signal,
|
|
1077
|
-
onProgress:
|
|
1077
|
+
onProgress: h
|
|
1078
1078
|
});
|
|
1079
1079
|
if (E.current) {
|
|
1080
|
-
|
|
1080
|
+
g(a.id).catch(() => {}), k(a.id);
|
|
1081
1081
|
return;
|
|
1082
1082
|
}
|
|
1083
|
-
u && A(u.id) && (
|
|
1083
|
+
u && A(u.id) && (g(u.id).catch(() => {}), k(u.id)), O(a.id, () => g(a.id)), p("idle"), h(null);
|
|
1084
1084
|
let o = {
|
|
1085
|
-
id:
|
|
1086
|
-
filename:
|
|
1087
|
-
content_type:
|
|
1088
|
-
size_bytes:
|
|
1089
|
-
sha256:
|
|
1090
|
-
width:
|
|
1091
|
-
height:
|
|
1092
|
-
url:
|
|
1093
|
-
metadata:
|
|
1085
|
+
id: a.id,
|
|
1086
|
+
filename: a.filename,
|
|
1087
|
+
content_type: a.content_type,
|
|
1088
|
+
size_bytes: a.size_bytes,
|
|
1089
|
+
sha256: a.sha256,
|
|
1090
|
+
width: a.width,
|
|
1091
|
+
height: a.height,
|
|
1092
|
+
url: a.url,
|
|
1093
|
+
metadata: a.metadata
|
|
1094
1094
|
};
|
|
1095
|
-
|
|
1095
|
+
i?.(t.mode === "array" ? [o] : o);
|
|
1096
1096
|
} catch (e) {
|
|
1097
|
-
if (e instanceof
|
|
1098
|
-
let t = e instanceof
|
|
1097
|
+
if (e instanceof f && e.code === "ABORTED") return;
|
|
1098
|
+
let t = e instanceof f ? {
|
|
1099
1099
|
code: e.code,
|
|
1100
1100
|
message: e.message
|
|
1101
1101
|
} : {
|
|
1102
1102
|
code: "UNKNOWN",
|
|
1103
1103
|
message: e instanceof Error ? e.message : "Upload failed"
|
|
1104
1104
|
};
|
|
1105
|
-
|
|
1105
|
+
v(t), p("error"), h(null);
|
|
1106
1106
|
}
|
|
1107
1107
|
}, [
|
|
1108
1108
|
t.accepts,
|
|
@@ -1111,7 +1111,7 @@ function fn(e) {
|
|
|
1111
1111
|
n,
|
|
1112
1112
|
u,
|
|
1113
1113
|
A,
|
|
1114
|
-
|
|
1114
|
+
i,
|
|
1115
1115
|
e.entityCode,
|
|
1116
1116
|
O,
|
|
1117
1117
|
k,
|
|
@@ -1123,20 +1123,20 @@ function fn(e) {
|
|
|
1123
1123
|
let t = e.target.files?.[0];
|
|
1124
1124
|
e.target.value = "", t && N(t);
|
|
1125
1125
|
}, [N]), I = W(() => {
|
|
1126
|
-
u && A(u.id) && (
|
|
1126
|
+
u && A(u.id) && (g(u.id).catch(() => {}), k(u.id)), i?.(t.mode === "array" ? [] : null);
|
|
1127
1127
|
}, [
|
|
1128
1128
|
u,
|
|
1129
1129
|
t.mode,
|
|
1130
1130
|
A,
|
|
1131
|
-
|
|
1131
|
+
i,
|
|
1132
1132
|
k
|
|
1133
1133
|
]), L = W(() => {
|
|
1134
|
-
|
|
1135
|
-
}, [
|
|
1134
|
+
d === "uploading" && T.current && (E.current = !0, T.current.abort(), T.current = null, p("idle"), h(null));
|
|
1135
|
+
}, [d]), R = W(() => {
|
|
1136
1136
|
u && j(u.id, "download", we(u));
|
|
1137
|
-
}, [u, j]),
|
|
1137
|
+
}, [u, j]), z = u ? _e(u) : !1, ee = W(() => {
|
|
1138
1138
|
!u || !_e(u) || j(u.id, "preview", ke(u));
|
|
1139
|
-
}, [u, j]),
|
|
1139
|
+
}, [u, j]), te = W(() => {
|
|
1140
1140
|
if (!u) {
|
|
1141
1141
|
S(!1);
|
|
1142
1142
|
return;
|
|
@@ -1150,14 +1150,14 @@ function fn(e) {
|
|
|
1150
1150
|
...u,
|
|
1151
1151
|
filename: e
|
|
1152
1152
|
};
|
|
1153
|
-
|
|
1153
|
+
i?.(t.mode === "array" ? [n] : n);
|
|
1154
1154
|
}, [
|
|
1155
1155
|
C,
|
|
1156
1156
|
u,
|
|
1157
|
-
|
|
1157
|
+
i,
|
|
1158
1158
|
t.mode
|
|
1159
|
-
]),
|
|
1160
|
-
return !u &&
|
|
1159
|
+
]), B = o === "display";
|
|
1160
|
+
return !u && d !== "uploading" ? /* @__PURE__ */ Z("div", {
|
|
1161
1161
|
"data-testid": `file-widget-${n}`,
|
|
1162
1162
|
className: "flex items-center gap-3 rounded-md border border-dashed border-border bg-surface p-3",
|
|
1163
1163
|
children: [
|
|
@@ -1167,7 +1167,7 @@ function fn(e) {
|
|
|
1167
1167
|
children: [/* @__PURE__ */ X("span", {
|
|
1168
1168
|
className: "text-sm text-foreground",
|
|
1169
1169
|
children: t.display?.placeholder || "No document attached"
|
|
1170
|
-
}), !
|
|
1170
|
+
}), !B && /* @__PURE__ */ X("button", {
|
|
1171
1171
|
type: "button",
|
|
1172
1172
|
className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
1173
1173
|
onClick: P,
|
|
@@ -1176,7 +1176,7 @@ function fn(e) {
|
|
|
1176
1176
|
children: "Upload"
|
|
1177
1177
|
})]
|
|
1178
1178
|
}),
|
|
1179
|
-
!
|
|
1179
|
+
!B && /* @__PURE__ */ X("input", {
|
|
1180
1180
|
ref: D,
|
|
1181
1181
|
type: "file",
|
|
1182
1182
|
accept: M || void 0,
|
|
@@ -1184,7 +1184,7 @@ function fn(e) {
|
|
|
1184
1184
|
style: { display: "none" },
|
|
1185
1185
|
"data-testid": `file-input-${n}`
|
|
1186
1186
|
}),
|
|
1187
|
-
|
|
1187
|
+
d === "error" && _ && /* @__PURE__ */ X("div", {
|
|
1188
1188
|
className: "ml-auto text-xs text-destructive",
|
|
1189
1189
|
role: "alert",
|
|
1190
1190
|
children: _.message
|
|
@@ -1193,29 +1193,29 @@ function fn(e) {
|
|
|
1193
1193
|
}) : /* @__PURE__ */ Z("div", {
|
|
1194
1194
|
"data-testid": `file-widget-${n}`,
|
|
1195
1195
|
className: "flex items-center gap-3 rounded-md border border-border bg-surface p-3",
|
|
1196
|
-
"aria-busy":
|
|
1197
|
-
"aria-invalid":
|
|
1196
|
+
"aria-busy": d === "uploading" || void 0,
|
|
1197
|
+
"aria-invalid": d === "error" || void 0,
|
|
1198
1198
|
children: [
|
|
1199
1199
|
/* @__PURE__ */ X(dn, { contentType: u?.content_type }),
|
|
1200
1200
|
/* @__PURE__ */ Z("div", {
|
|
1201
1201
|
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
1202
1202
|
children: [
|
|
1203
|
-
|
|
1203
|
+
y && u ? /* @__PURE__ */ X("input", {
|
|
1204
1204
|
type: "text",
|
|
1205
1205
|
className: "rounded-sm border border-border bg-card px-1 py-0.5 text-sm text-foreground",
|
|
1206
1206
|
value: C,
|
|
1207
1207
|
autoFocus: !0,
|
|
1208
1208
|
onChange: (e) => w(e.target.value),
|
|
1209
|
-
onBlur:
|
|
1209
|
+
onBlur: te,
|
|
1210
1210
|
onKeyDown: (e) => {
|
|
1211
|
-
e.key === "Enter" ?
|
|
1211
|
+
e.key === "Enter" ? te() : e.key === "Escape" && (S(!1), w(u.filename));
|
|
1212
1212
|
},
|
|
1213
1213
|
"data-testid": "filename-input"
|
|
1214
1214
|
}) : /* @__PURE__ */ X("button", {
|
|
1215
1215
|
type: "button",
|
|
1216
1216
|
className: "truncate text-left text-sm font-medium text-foreground hover:underline",
|
|
1217
|
-
onClick: () => !
|
|
1218
|
-
disabled:
|
|
1217
|
+
onClick: () => !B && u && S(!0),
|
|
1218
|
+
disabled: B || s || !u,
|
|
1219
1219
|
title: u?.filename,
|
|
1220
1220
|
"data-testid": "filename",
|
|
1221
1221
|
children: u?.filename ?? "Uploading…"
|
|
@@ -1223,7 +1223,7 @@ function fn(e) {
|
|
|
1223
1223
|
/* @__PURE__ */ Z("div", {
|
|
1224
1224
|
className: "flex flex-wrap gap-2 text-xs text-muted-foreground",
|
|
1225
1225
|
children: [
|
|
1226
|
-
u && /* @__PURE__ */ X("span", { children:
|
|
1226
|
+
u && /* @__PURE__ */ X("span", { children: x(u.size_bytes) }),
|
|
1227
1227
|
u?.page_count != null && /* @__PURE__ */ Z("span", { children: [u.page_count, " pages"] }),
|
|
1228
1228
|
u?.uploaded_at && /* @__PURE__ */ X("span", { children: pn(u.uploaded_at) }),
|
|
1229
1229
|
u?.uploaded_by && /* @__PURE__ */ Z("span", { children: ["by ", u.uploaded_by] }),
|
|
@@ -1233,7 +1233,7 @@ function fn(e) {
|
|
|
1233
1233
|
})
|
|
1234
1234
|
]
|
|
1235
1235
|
}),
|
|
1236
|
-
|
|
1236
|
+
d === "uploading" && /* @__PURE__ */ Z("div", {
|
|
1237
1237
|
className: "text-xs text-muted-foreground",
|
|
1238
1238
|
role: "progressbar",
|
|
1239
1239
|
"aria-valuenow": m?.pct ?? 0,
|
|
@@ -1246,7 +1246,7 @@ function fn(e) {
|
|
|
1246
1246
|
"%"
|
|
1247
1247
|
]
|
|
1248
1248
|
}),
|
|
1249
|
-
|
|
1249
|
+
d === "error" && _ && /* @__PURE__ */ X("div", {
|
|
1250
1250
|
className: "text-xs text-destructive",
|
|
1251
1251
|
role: "alert",
|
|
1252
1252
|
children: _.message
|
|
@@ -1255,7 +1255,7 @@ function fn(e) {
|
|
|
1255
1255
|
}),
|
|
1256
1256
|
/* @__PURE__ */ Z("div", {
|
|
1257
1257
|
className: "flex flex-none items-center gap-1",
|
|
1258
|
-
children: [u &&
|
|
1258
|
+
children: [u && d !== "uploading" && /* @__PURE__ */ Z(Y, { children: [
|
|
1259
1259
|
/* @__PURE__ */ X("button", {
|
|
1260
1260
|
type: "button",
|
|
1261
1261
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
@@ -1266,13 +1266,13 @@ function fn(e) {
|
|
|
1266
1266
|
/* @__PURE__ */ X("button", {
|
|
1267
1267
|
type: "button",
|
|
1268
1268
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
1269
|
-
onClick:
|
|
1270
|
-
disabled: !
|
|
1271
|
-
title:
|
|
1269
|
+
onClick: ee,
|
|
1270
|
+
disabled: !z,
|
|
1271
|
+
title: z ? void 0 : "Preview is available only for images and PDFs",
|
|
1272
1272
|
"data-testid": "preview",
|
|
1273
1273
|
children: "Preview"
|
|
1274
1274
|
}),
|
|
1275
|
-
!
|
|
1275
|
+
!B && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X("button", {
|
|
1276
1276
|
type: "button",
|
|
1277
1277
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
1278
1278
|
onClick: P,
|
|
@@ -1287,7 +1287,7 @@ function fn(e) {
|
|
|
1287
1287
|
"data-testid": "remove",
|
|
1288
1288
|
children: "Remove"
|
|
1289
1289
|
})] })
|
|
1290
|
-
] }),
|
|
1290
|
+
] }), d === "uploading" && /* @__PURE__ */ X("button", {
|
|
1291
1291
|
type: "button",
|
|
1292
1292
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs",
|
|
1293
1293
|
onClick: L,
|
|
@@ -1295,7 +1295,7 @@ function fn(e) {
|
|
|
1295
1295
|
children: "Cancel"
|
|
1296
1296
|
})]
|
|
1297
1297
|
}),
|
|
1298
|
-
!
|
|
1298
|
+
!B && /* @__PURE__ */ X("input", {
|
|
1299
1299
|
ref: D,
|
|
1300
1300
|
type: "file",
|
|
1301
1301
|
accept: M || void 0,
|
|
@@ -1316,16 +1316,16 @@ function mn(e) {
|
|
|
1316
1316
|
return e ? (e.split("/")[1] ?? e).toUpperCase().slice(0, 6) : "";
|
|
1317
1317
|
}
|
|
1318
1318
|
function hn(e) {
|
|
1319
|
-
let { field: t, fieldName: n, value: r, onChange:
|
|
1320
|
-
|
|
1321
|
-
let _ = q(null),
|
|
1322
|
-
|
|
1319
|
+
let { field: t, fieldName: n, value: r, onChange: i, mode: o, disabled: s } = e, c = Oe(r), [l, u] = J([]), { register: d, unregister: p, isDraft: m } = b(), h = q(c);
|
|
1320
|
+
h.current = c;
|
|
1321
|
+
let _ = q(null), v = q(/* @__PURE__ */ new Set()), y = q([]);
|
|
1322
|
+
y.current = l;
|
|
1323
1323
|
let { open: S } = Ee();
|
|
1324
1324
|
G(() => () => {
|
|
1325
|
-
|
|
1325
|
+
y.current.forEach((e) => e.abort());
|
|
1326
1326
|
}, []);
|
|
1327
1327
|
let C = (t.accepts ?? []).join(","), w = o === "display", T = W(async (r) => {
|
|
1328
|
-
let o =
|
|
1328
|
+
let o = a(r, t.accepts, t.max_size_bytes), s = `row-${Math.random().toString(36).slice(2)}-${Date.now()}`, c = new AbortController();
|
|
1329
1329
|
if (o) {
|
|
1330
1330
|
u((e) => [...e, {
|
|
1331
1331
|
localId: s,
|
|
@@ -1358,12 +1358,12 @@ function hn(e) {
|
|
|
1358
1358
|
progress: e
|
|
1359
1359
|
} : t))
|
|
1360
1360
|
});
|
|
1361
|
-
if (
|
|
1362
|
-
|
|
1361
|
+
if (v.current.delete(s)) {
|
|
1362
|
+
g(t.id).catch(() => {}), p(t.id);
|
|
1363
1363
|
return;
|
|
1364
1364
|
}
|
|
1365
|
-
|
|
1366
|
-
let
|
|
1365
|
+
d(t.id, () => g(t.id));
|
|
1366
|
+
let a = {
|
|
1367
1367
|
id: t.id,
|
|
1368
1368
|
filename: t.filename,
|
|
1369
1369
|
content_type: t.content_type,
|
|
@@ -1373,14 +1373,14 @@ function hn(e) {
|
|
|
1373
1373
|
height: t.height,
|
|
1374
1374
|
url: t.url,
|
|
1375
1375
|
metadata: t.metadata
|
|
1376
|
-
}, o = [...
|
|
1377
|
-
|
|
1376
|
+
}, o = [...h.current, a];
|
|
1377
|
+
h.current = o, i?.(o), u((e) => e.filter((e) => e.localId !== s));
|
|
1378
1378
|
} catch (e) {
|
|
1379
|
-
if (e instanceof
|
|
1379
|
+
if (e instanceof f && e.code === "ABORTED") {
|
|
1380
1380
|
u((e) => e.filter((e) => e.localId !== s));
|
|
1381
1381
|
return;
|
|
1382
1382
|
}
|
|
1383
|
-
let t = e instanceof
|
|
1383
|
+
let t = e instanceof f ? {
|
|
1384
1384
|
code: e.code,
|
|
1385
1385
|
message: e.message
|
|
1386
1386
|
} : {
|
|
@@ -1398,9 +1398,9 @@ function hn(e) {
|
|
|
1398
1398
|
t.accepts,
|
|
1399
1399
|
t.max_size_bytes,
|
|
1400
1400
|
n,
|
|
1401
|
-
|
|
1401
|
+
i,
|
|
1402
1402
|
e.entityCode,
|
|
1403
|
-
|
|
1403
|
+
d,
|
|
1404
1404
|
p
|
|
1405
1405
|
]), E = W((e) => {
|
|
1406
1406
|
Array.from(e).forEach((e) => void T(e));
|
|
@@ -1410,11 +1410,11 @@ function hn(e) {
|
|
|
1410
1410
|
let t = e.target.files;
|
|
1411
1411
|
e.target.value = "", t && t.length > 0 && E(t);
|
|
1412
1412
|
}, [E]), k = W((e) => {
|
|
1413
|
-
m(e) && (
|
|
1413
|
+
m(e) && (g(e).catch(() => {}), p(e)), i?.(c.filter((t) => t.id !== e));
|
|
1414
1414
|
}, [
|
|
1415
1415
|
m,
|
|
1416
1416
|
c,
|
|
1417
|
-
|
|
1417
|
+
i,
|
|
1418
1418
|
p
|
|
1419
1419
|
]), A = W((e) => {
|
|
1420
1420
|
S(e.id, "download", we(e));
|
|
@@ -1446,7 +1446,7 @@ function hn(e) {
|
|
|
1446
1446
|
}),
|
|
1447
1447
|
/* @__PURE__ */ X("span", {
|
|
1448
1448
|
className: "flex-none text-xs text-muted-foreground",
|
|
1449
|
-
children:
|
|
1449
|
+
children: x(e.size_bytes)
|
|
1450
1450
|
}),
|
|
1451
1451
|
/* @__PURE__ */ X("button", {
|
|
1452
1452
|
type: "button",
|
|
@@ -1493,7 +1493,7 @@ function hn(e) {
|
|
|
1493
1493
|
type: "button",
|
|
1494
1494
|
className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
|
|
1495
1495
|
onClick: () => {
|
|
1496
|
-
e.abort(),
|
|
1496
|
+
e.abort(), v.current.add(e.localId), u((t) => t.filter((t) => t.localId !== e.localId));
|
|
1497
1497
|
},
|
|
1498
1498
|
children: e.error ? "Dismiss" : "Cancel"
|
|
1499
1499
|
})
|
|
@@ -1623,17 +1623,17 @@ function wn(e, t) {
|
|
|
1623
1623
|
function Tn(e, t, n) {
|
|
1624
1624
|
if (Cn(e, n)) return wn(t, n);
|
|
1625
1625
|
let r = e.fields.get(n);
|
|
1626
|
-
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ?
|
|
1626
|
+
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? E(t[n], wn(t, n)) : t[n];
|
|
1627
1627
|
}
|
|
1628
1628
|
function En(e, t, n) {
|
|
1629
1629
|
let r = e.fields.get(t);
|
|
1630
|
-
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ?
|
|
1630
|
+
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? D(n) : n;
|
|
1631
1631
|
}
|
|
1632
1632
|
function Dn(e, t, n) {
|
|
1633
1633
|
let r = Cn(e, t);
|
|
1634
1634
|
if (r) return r.name || t;
|
|
1635
1635
|
let i = e.fields.get(t);
|
|
1636
|
-
return i ?
|
|
1636
|
+
return i ? pe(i, t, n) : t;
|
|
1637
1637
|
}
|
|
1638
1638
|
function On(e) {
|
|
1639
1639
|
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 = Cn(t, r);
|
|
@@ -1654,7 +1654,7 @@ function On(e) {
|
|
|
1654
1654
|
});
|
|
1655
1655
|
}
|
|
1656
1656
|
let g = t.fields.get(r);
|
|
1657
|
-
return g ?
|
|
1657
|
+
return g ? B({
|
|
1658
1658
|
field: g,
|
|
1659
1659
|
entityCode: n,
|
|
1660
1660
|
fieldName: r,
|
|
@@ -1749,7 +1749,7 @@ function Ln(e) {
|
|
|
1749
1749
|
}
|
|
1750
1750
|
function Rn(e, t) {
|
|
1751
1751
|
if (e.mode !== "rich_text_inline") return { clear: !0 };
|
|
1752
|
-
let n =
|
|
1752
|
+
let n = T(D(t));
|
|
1753
1753
|
return n.length === 0 ? { clear: !0 } : { set: n.map((e, t) => ({
|
|
1754
1754
|
file_id: e,
|
|
1755
1755
|
position: t
|
|
@@ -1933,7 +1933,7 @@ function er(e) {
|
|
|
1933
1933
|
//#region src/hooks/useChildrenData.ts
|
|
1934
1934
|
var tr = "entity-children";
|
|
1935
1935
|
function nr(e, t, n, r, i, a) {
|
|
1936
|
-
let o = Array.isArray(r) ? r : [r],
|
|
1936
|
+
let o = Array.isArray(r) ? r : [r], s = Array.isArray(r) ? l(t, o.length) : [t];
|
|
1937
1937
|
return He({
|
|
1938
1938
|
queryKey: [
|
|
1939
1939
|
tr,
|
|
@@ -1945,15 +1945,15 @@ function nr(e, t, n, r, i, a) {
|
|
|
1945
1945
|
],
|
|
1946
1946
|
queryFn: () => {
|
|
1947
1947
|
let e = new URLSearchParams();
|
|
1948
|
-
if (!
|
|
1948
|
+
if (!s) throw Error("invalid composite parent id");
|
|
1949
1949
|
let t = o.map((e, t) => ({
|
|
1950
1950
|
field: e,
|
|
1951
1951
|
op: "eq",
|
|
1952
|
-
value:
|
|
1952
|
+
value: s[t]
|
|
1953
1953
|
}));
|
|
1954
|
-
return e.set("filters", JSON.stringify(t)),
|
|
1954
|
+
return e.set("filters", JSON.stringify(t)), i && e.set("sort", i), a && e.set("limit", String(a)), d(`/api/data/${n}?${e.toString()}`);
|
|
1955
1955
|
},
|
|
1956
|
-
enabled: !!e && !!t && !!n && !!r &&
|
|
1956
|
+
enabled: !!e && !!t && !!n && !!r && s !== null
|
|
1957
1957
|
});
|
|
1958
1958
|
}
|
|
1959
1959
|
//#endregion
|
|
@@ -1994,7 +1994,7 @@ function ar(e, t, n, r, i, a, o, s) {
|
|
|
1994
1994
|
op: "eq",
|
|
1995
1995
|
value: t
|
|
1996
1996
|
});
|
|
1997
|
-
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),
|
|
1997
|
+
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), d(`/api/data/${n}?${c.toString()}`);
|
|
1998
1998
|
},
|
|
1999
1999
|
getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
|
|
2000
2000
|
initialPageParam: void 0,
|
|
@@ -2003,105 +2003,105 @@ function ar(e, t, n, r, i, a, o, s) {
|
|
|
2003
2003
|
}
|
|
2004
2004
|
//#endregion
|
|
2005
2005
|
//#region src/components/shared/ActionButton.tsx
|
|
2006
|
-
function or({ actionCode: n, action: r, entityCode:
|
|
2007
|
-
let [
|
|
2008
|
-
if (!(!r.association ||
|
|
2009
|
-
|
|
2006
|
+
function or({ actionCode: n, action: r, entityCode: a, objectIds: s = [], row: c, variant: l = "outline", size: u = "default", onSuccess: d }) {
|
|
2007
|
+
let [f, p] = J(!1), [m, h] = J(!1), { data: g } = i(), _ = Bt(), { run: v } = te(), b = C(r), x = !c || P(r.conditions, c), S = W(async () => {
|
|
2008
|
+
if (!(!r.association || s.length === 0)) {
|
|
2009
|
+
p(!0);
|
|
2010
2010
|
try {
|
|
2011
|
-
let e = await
|
|
2011
|
+
let e = await fe(a ? `${a}.${r.association}` : r.association, s), t = o(g, e.target_entity);
|
|
2012
2012
|
if (!t) {
|
|
2013
|
-
|
|
2013
|
+
H.error(`No list screen found for ${e.target_entity}`);
|
|
2014
2014
|
return;
|
|
2015
2015
|
}
|
|
2016
|
-
let n =
|
|
2016
|
+
let n = g?.entities[e.target_entity], i = U(r.display?.name) || e.target_entity;
|
|
2017
2017
|
if (e.ids.length === 0) {
|
|
2018
|
-
|
|
2018
|
+
H.info(`No related ${i} found`);
|
|
2019
2019
|
return;
|
|
2020
2020
|
}
|
|
2021
2021
|
let c = n?.fields.names().find((e) => n.fields.get(e)?.primary) ?? "id", l = new URLSearchParams();
|
|
2022
|
-
l.set(`filter_${c}`, e.ids.join(",")),
|
|
2023
|
-
title:
|
|
2022
|
+
l.set(`filter_${c}`, e.ids.join(",")), _(t.route, {
|
|
2023
|
+
title: i,
|
|
2024
2024
|
icon: r.display?.icon || t.icon,
|
|
2025
2025
|
search: l.toString()
|
|
2026
|
-
}),
|
|
2026
|
+
}), d?.();
|
|
2027
2027
|
} catch (e) {
|
|
2028
|
-
|
|
2028
|
+
H.error(e instanceof Error ? e.message : "Failed to resolve association");
|
|
2029
2029
|
} finally {
|
|
2030
|
-
|
|
2030
|
+
p(!1);
|
|
2031
2031
|
}
|
|
2032
2032
|
}
|
|
2033
2033
|
}, [
|
|
2034
2034
|
r,
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
h,
|
|
2035
|
+
a,
|
|
2036
|
+
s,
|
|
2038
2037
|
g,
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2038
|
+
_,
|
|
2039
|
+
d
|
|
2040
|
+
]), w = r.entity ? `${r.entity}.${n}` : n, T = s.length > 0 ? s : void 0, E = W(() => {
|
|
2041
|
+
h(!0), v({
|
|
2042
2042
|
action: r,
|
|
2043
|
-
title:
|
|
2044
|
-
row:
|
|
2045
|
-
entity:
|
|
2046
|
-
execute: (e) =>
|
|
2047
|
-
onSuccess: () =>
|
|
2048
|
-
}).finally(() =>
|
|
2043
|
+
title: U(r.display?.name) || n,
|
|
2044
|
+
row: c,
|
|
2045
|
+
entity: a,
|
|
2046
|
+
execute: (e) => I(w, ee(e, T)),
|
|
2047
|
+
onSuccess: () => d?.()
|
|
2048
|
+
}).finally(() => h(!1));
|
|
2049
2049
|
}, [
|
|
2050
2050
|
v,
|
|
2051
2051
|
r,
|
|
2052
2052
|
n,
|
|
2053
|
-
|
|
2054
|
-
|
|
2053
|
+
c,
|
|
2054
|
+
a,
|
|
2055
|
+
w,
|
|
2055
2056
|
T,
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
]), O = W(() => {
|
|
2057
|
+
d
|
|
2058
|
+
]), D = W(() => {
|
|
2059
2059
|
if (R(r)) {
|
|
2060
|
-
le(r.ui_steps, { row:
|
|
2060
|
+
le(r.ui_steps, { row: c }).then(() => d?.());
|
|
2061
2061
|
return;
|
|
2062
2062
|
}
|
|
2063
|
-
if (
|
|
2064
|
-
|
|
2063
|
+
if (b) {
|
|
2064
|
+
S();
|
|
2065
2065
|
return;
|
|
2066
2066
|
}
|
|
2067
2067
|
if (r.href && !r.handler && !r.association) {
|
|
2068
|
-
let e =
|
|
2069
|
-
|
|
2070
|
-
title:
|
|
2068
|
+
let e = y(c, a ? g?.entities[a] : void 0), t = r.href;
|
|
2069
|
+
a && (t = t.replaceAll("${entity}", a)), e && (t = t.replaceAll("${id}", encodeURIComponent(e))), _(t, {
|
|
2070
|
+
title: U(r.display?.name) || n,
|
|
2071
2071
|
icon: r.display?.icon
|
|
2072
|
-
}),
|
|
2072
|
+
}), d?.();
|
|
2073
2073
|
return;
|
|
2074
2074
|
}
|
|
2075
|
-
|
|
2075
|
+
E();
|
|
2076
2076
|
}, [
|
|
2077
2077
|
r,
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2078
|
+
c,
|
|
2079
|
+
a,
|
|
2080
|
+
g?.entities,
|
|
2081
2081
|
n,
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
]),
|
|
2088
|
-
name:
|
|
2082
|
+
_,
|
|
2083
|
+
b,
|
|
2084
|
+
S,
|
|
2085
|
+
E,
|
|
2086
|
+
d
|
|
2087
|
+
]), O = U(r.display?.name), k = r.display?.icon, A = k && e[k], j = A ? /* @__PURE__ */ X(A, { size: 13 }) : k ? /* @__PURE__ */ X(t, {
|
|
2088
|
+
name: k,
|
|
2089
2089
|
size: 13
|
|
2090
|
-
}) : null,
|
|
2091
|
-
return
|
|
2092
|
-
icon:
|
|
2093
|
-
onClick:
|
|
2094
|
-
title:
|
|
2095
|
-
}) : /* @__PURE__ */ X(
|
|
2096
|
-
kind:
|
|
2090
|
+
}) : null, M = !x || m || f;
|
|
2091
|
+
return u === "icon" ? /* @__PURE__ */ X(L, {
|
|
2092
|
+
icon: j ?? /* @__PURE__ */ X(e.bolt, { size: 13 }),
|
|
2093
|
+
onClick: D,
|
|
2094
|
+
title: O
|
|
2095
|
+
}) : /* @__PURE__ */ X(V, {
|
|
2096
|
+
kind: l === "default" ? "primary" : l === "ghost" ? "ghost" : "default",
|
|
2097
2097
|
size: "sm",
|
|
2098
|
-
icon:
|
|
2098
|
+
icon: j,
|
|
2099
2099
|
danger: r.destructive,
|
|
2100
|
-
onClick:
|
|
2101
|
-
disabled:
|
|
2102
|
-
title:
|
|
2103
|
-
"aria-label":
|
|
2104
|
-
children:
|
|
2100
|
+
onClick: D,
|
|
2101
|
+
disabled: M,
|
|
2102
|
+
title: O,
|
|
2103
|
+
"aria-label": O,
|
|
2104
|
+
children: O
|
|
2105
2105
|
});
|
|
2106
2106
|
}
|
|
2107
2107
|
//#endregion
|
|
@@ -2113,7 +2113,7 @@ function cr(e) {
|
|
|
2113
2113
|
return e.widget ? "widget" : e.href ? "href" : e.handler ? "handler" : e.association ? "association" : e.ui_steps && e.ui_steps.length > 0 ? "ui_steps" : "unknown";
|
|
2114
2114
|
}
|
|
2115
2115
|
function lr(e, t, n, r, i) {
|
|
2116
|
-
let a = cr(t), o =
|
|
2116
|
+
let a = cr(t), o = y(n, r?.entity), s = r?.entityCode ?? "";
|
|
2117
2117
|
if (e === "__peek") return i?.({
|
|
2118
2118
|
code: e,
|
|
2119
2119
|
entity: s,
|
|
@@ -2181,7 +2181,7 @@ function pr(e, t, n) {
|
|
|
2181
2181
|
if (n && e in n) return n[e];
|
|
2182
2182
|
}
|
|
2183
2183
|
function mr(e, t, n) {
|
|
2184
|
-
return
|
|
2184
|
+
return U(pr(e, t, n)?.display?.name) || e;
|
|
2185
2185
|
}
|
|
2186
2186
|
function hr(e, t, n) {
|
|
2187
2187
|
return pr(e, t, n)?.display?.icon || void 0;
|
|
@@ -2209,7 +2209,7 @@ function _r({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
|
|
|
2209
2209
|
l,
|
|
2210
2210
|
u,
|
|
2211
2211
|
d
|
|
2212
|
-
]), b = a ? /* @__PURE__ */ X(
|
|
2212
|
+
]), b = a ? /* @__PURE__ */ X(k, { size: 12 }) : m ? /* @__PURE__ */ X(t, {
|
|
2213
2213
|
name: m,
|
|
2214
2214
|
size: 12
|
|
2215
2215
|
}) : null;
|
|
@@ -2224,7 +2224,7 @@ function _r({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
|
|
|
2224
2224
|
clip: "rect(0,0,0,0)"
|
|
2225
2225
|
},
|
|
2226
2226
|
children: e.reason
|
|
2227
|
-
}), /* @__PURE__ */ X(
|
|
2227
|
+
}), /* @__PURE__ */ X(V, {
|
|
2228
2228
|
ref: s,
|
|
2229
2229
|
kind: g ? "primary" : "default",
|
|
2230
2230
|
danger: h,
|
|
@@ -2232,23 +2232,23 @@ function _r({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
|
|
|
2232
2232
|
disabled: _ || a,
|
|
2233
2233
|
"aria-disabled": _ ? "true" : void 0,
|
|
2234
2234
|
"aria-describedby": v,
|
|
2235
|
-
title:
|
|
2235
|
+
title: z(f, p, _, e.reason),
|
|
2236
2236
|
onClick: y,
|
|
2237
2237
|
style: c,
|
|
2238
2238
|
children: p
|
|
2239
2239
|
})] });
|
|
2240
2240
|
}
|
|
2241
2241
|
function vr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o, onLoadingChange: s, measureRef: c, style: l, row: u, widgetContext: d, onActionClick: f }) {
|
|
2242
|
-
let p = q(null), [m, h] = J(!1), g = n.name ?
|
|
2242
|
+
let p = q(null), [m, h] = J(!1), g = n.name ? U(n.name) : "Actions", _ = W((e) => {
|
|
2243
2243
|
p.current = e, c?.(e);
|
|
2244
2244
|
}, [c]), v = W((e, t) => (h(!1), a(e, t)), [a]);
|
|
2245
|
-
return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(
|
|
2245
|
+
return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(V, {
|
|
2246
2246
|
ref: _,
|
|
2247
2247
|
kind: "default",
|
|
2248
2248
|
icon: o == null ? n.icon ? /* @__PURE__ */ X(t, {
|
|
2249
2249
|
name: n.icon,
|
|
2250
2250
|
size: 12
|
|
2251
|
-
}) : void 0 : /* @__PURE__ */ X(
|
|
2251
|
+
}) : void 0 : /* @__PURE__ */ X(k, { size: 12 }),
|
|
2252
2252
|
iconRight: /* @__PURE__ */ X(e.down, { size: 10 }),
|
|
2253
2253
|
"aria-haspopup": "menu",
|
|
2254
2254
|
"aria-expanded": m ? "true" : "false",
|
|
@@ -2256,7 +2256,7 @@ function vr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o
|
|
|
2256
2256
|
onClick: () => h((e) => !e),
|
|
2257
2257
|
style: l,
|
|
2258
2258
|
children: g
|
|
2259
|
-
}), /* @__PURE__ */ X(
|
|
2259
|
+
}), /* @__PURE__ */ X(N, {
|
|
2260
2260
|
open: m,
|
|
2261
2261
|
anchor: p.current,
|
|
2262
2262
|
onClose: () => h(!1),
|
|
@@ -2290,7 +2290,7 @@ function vr({ group: n, entityActions: r, globalActions: i, onRun: a, loading: o
|
|
|
2290
2290
|
})] });
|
|
2291
2291
|
}
|
|
2292
2292
|
function yr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a, onLoadingChange: o, row: s, widgetContext: c, onActionClick: l }) {
|
|
2293
|
-
let u = pr(e.code, n, r), d = mr(e.code, n, r), f = hr(e.code, n, r), p = u?.destructive ?? !1, m = !e.enabled, h = m ? gr(e.code) : void 0, g = a ? /* @__PURE__ */ X(
|
|
2293
|
+
let u = pr(e.code, n, r), d = mr(e.code, n, r), f = hr(e.code, n, r), p = u?.destructive ?? !1, m = !e.enabled, h = m ? gr(e.code) : void 0, g = a ? /* @__PURE__ */ X(k, { size: 12 }) : f ? /* @__PURE__ */ X(t, {
|
|
2294
2294
|
name: f,
|
|
2295
2295
|
size: 12
|
|
2296
2296
|
}) : null;
|
|
@@ -2309,7 +2309,7 @@ function yr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
|
|
|
2309
2309
|
role: "menuitem",
|
|
2310
2310
|
"aria-disabled": m ? "true" : void 0,
|
|
2311
2311
|
"aria-describedby": h,
|
|
2312
|
-
title:
|
|
2312
|
+
title: z(u, d, m, e.reason),
|
|
2313
2313
|
onClick: async () => {
|
|
2314
2314
|
if (!(!u || m || a)) {
|
|
2315
2315
|
o(!0);
|
|
@@ -2350,7 +2350,7 @@ function yr({ leaf: e, entityActions: n, globalActions: r, onRun: i, loading: a,
|
|
|
2350
2350
|
})] });
|
|
2351
2351
|
}
|
|
2352
2352
|
function br({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i, onLoadingChange: a, row: o, widgetContext: s, onActionClick: c }) {
|
|
2353
|
-
let l = e.name ?
|
|
2353
|
+
let l = e.name ? U(e.name) : void 0;
|
|
2354
2354
|
return /* @__PURE__ */ Z(Y, { children: [l && /* @__PURE__ */ X("div", {
|
|
2355
2355
|
style: {
|
|
2356
2356
|
padding: "4px 10px 2px",
|
|
@@ -2390,13 +2390,13 @@ function xr({ layout: t, entityActions: n, globalActions: r, onRun: i, row: a, w
|
|
|
2390
2390
|
display: "inline-flex",
|
|
2391
2391
|
alignItems: "center"
|
|
2392
2392
|
},
|
|
2393
|
-
children: [/* @__PURE__ */ X(
|
|
2393
|
+
children: [/* @__PURE__ */ X(L, {
|
|
2394
2394
|
ref: c,
|
|
2395
|
-
icon: X(d == null ? e.more :
|
|
2395
|
+
icon: X(d == null ? e.more : k, { size: 14 }),
|
|
2396
2396
|
title: "Actions",
|
|
2397
2397
|
size: 28,
|
|
2398
2398
|
onClick: () => u((e) => !e)
|
|
2399
|
-
}), /* @__PURE__ */ X(
|
|
2399
|
+
}), /* @__PURE__ */ X(N, {
|
|
2400
2400
|
open: l,
|
|
2401
2401
|
anchor: c.current,
|
|
2402
2402
|
onClose: () => u(!1),
|
|
@@ -2439,7 +2439,7 @@ function Cr({ layout: e, entityActions: t, globalActions: n, onRun: r, loading:
|
|
|
2439
2439
|
"aria-label": l,
|
|
2440
2440
|
children: [
|
|
2441
2441
|
p.map((e) => e.kind === "action" ? _(e) : null),
|
|
2442
|
-
p.length > 0 && g && /* @__PURE__ */ X(
|
|
2442
|
+
p.length > 0 && g && /* @__PURE__ */ X(A, { divider: !0 }),
|
|
2443
2443
|
m.map((e) => e.kind === "action" ? _(e) : /* @__PURE__ */ X(br, {
|
|
2444
2444
|
group: e,
|
|
2445
2445
|
entityActions: t,
|
|
@@ -2451,7 +2451,7 @@ function Cr({ layout: e, entityActions: t, globalActions: n, onRun: r, loading:
|
|
|
2451
2451
|
widgetContext: s,
|
|
2452
2452
|
onActionClick: c
|
|
2453
2453
|
}, e.icon ?? "group")),
|
|
2454
|
-
h && /* @__PURE__ */ X(
|
|
2454
|
+
h && /* @__PURE__ */ X(A, { divider: !0 }),
|
|
2455
2455
|
d.map((e) => _(e))
|
|
2456
2456
|
]
|
|
2457
2457
|
});
|
|
@@ -2479,66 +2479,66 @@ function Or(e, t, n, r, i, a, o, s) {
|
|
|
2479
2479
|
};
|
|
2480
2480
|
}
|
|
2481
2481
|
function Q(e) {
|
|
2482
|
-
return e.kind === "action" ? `action:${e.code}` : `group:${e.name ?
|
|
2482
|
+
return e.kind === "action" ? `action:${e.code}` : `group:${e.name ? U(e.name) : ""}`;
|
|
2483
2483
|
}
|
|
2484
2484
|
function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedRightWidth: o = 0, measurementOverride: s, ariaLabel: c = "Actions", align: l = "trailing", constrain: u = !0, row: d, widgetContext: f, onActionClick: p }) {
|
|
2485
|
-
let m = q(null), h = q(null), [g, _] = J(0), [v, y] = J(/* @__PURE__ */ new Map()), [b, x] = J(!1), [
|
|
2485
|
+
let m = q(null), h = q(null), [g, _] = J(0), [v, y] = J(/* @__PURE__ */ new Map()), [b, x] = J(!1), [S, C] = J(null), [w, T] = J(() => typeof document < "u" && document.documentElement.dir === "rtl");
|
|
2486
2486
|
G(() => {
|
|
2487
2487
|
if (typeof MutationObserver > "u") return;
|
|
2488
2488
|
let e = new MutationObserver((e) => {
|
|
2489
|
-
for (let t of e) t.attributeName === "dir" &&
|
|
2489
|
+
for (let t of e) t.attributeName === "dir" && T(document.documentElement.dir === "rtl"), t.attributeName === "lang" && x(!1);
|
|
2490
2490
|
});
|
|
2491
2491
|
return e.observe(document.documentElement, {
|
|
2492
2492
|
attributes: !0,
|
|
2493
2493
|
attributeFilter: ["dir", "lang"]
|
|
2494
2494
|
}), () => e.disconnect();
|
|
2495
2495
|
}, []);
|
|
2496
|
-
let
|
|
2497
|
-
if (
|
|
2496
|
+
let E = q(null), [D, O] = J(!1), k = W((e, t) => (O(!1), a(e, t)), [a]), A = ur(n), j = !!s, M = W(() => {
|
|
2497
|
+
if (j || !h.current) return;
|
|
2498
2498
|
let e = Array.from(h.current.children), t = /* @__PURE__ */ new Map();
|
|
2499
2499
|
e.forEach((e) => {
|
|
2500
2500
|
let n = e.dataset.nodeKey;
|
|
2501
2501
|
n && t.set(n, e.getBoundingClientRect().width || e.offsetWidth);
|
|
2502
2502
|
}), y(t), x(!0);
|
|
2503
|
-
}, [
|
|
2503
|
+
}, [j]), P = K(() => JSON.stringify(n.map((e) => Q(e))), [n]);
|
|
2504
2504
|
Le(() => {
|
|
2505
|
-
if (
|
|
2505
|
+
if (j) {
|
|
2506
2506
|
x(!0);
|
|
2507
2507
|
return;
|
|
2508
2508
|
}
|
|
2509
2509
|
x(!1);
|
|
2510
2510
|
let e = requestAnimationFrame(() => {
|
|
2511
|
-
|
|
2511
|
+
M();
|
|
2512
2512
|
});
|
|
2513
2513
|
return () => cancelAnimationFrame(e);
|
|
2514
2514
|
}, [
|
|
2515
2515
|
P,
|
|
2516
|
-
|
|
2517
|
-
|
|
2516
|
+
M,
|
|
2517
|
+
j
|
|
2518
2518
|
]), G(() => {
|
|
2519
|
-
if (
|
|
2519
|
+
if (j || b) return;
|
|
2520
2520
|
let e = setTimeout(() => {
|
|
2521
|
-
|
|
2521
|
+
M(), x(!0);
|
|
2522
2522
|
}, 16);
|
|
2523
2523
|
return () => clearTimeout(e);
|
|
2524
2524
|
}, [
|
|
2525
2525
|
b,
|
|
2526
|
-
|
|
2527
|
-
|
|
2526
|
+
M,
|
|
2527
|
+
j
|
|
2528
2528
|
]), G(() => {
|
|
2529
|
-
if (
|
|
2529
|
+
if (j || !u || !b || g === 0) return;
|
|
2530
2530
|
let e = m.current;
|
|
2531
2531
|
if (!e) return;
|
|
2532
2532
|
let t = [...e.children].filter((e) => e.getAttribute("aria-hidden") !== "true"), n = t.length > 1 ? (t.length - 1) * 4 : 0, r = t.reduce((e, t) => e + t.getBoundingClientRect().width, 0) + n;
|
|
2533
2533
|
r > 0 && Math.abs(g - r) < 1 && console.error(`[declarion] ResponsiveActionBar is measuring itself: its container is ${Math.round(g)}px, exactly the width of what it just rendered. The slot holding this bar is sized by its own content, so it cannot tell the bar how much room there is. Give that slot \`flex: 1 1 auto; min-width: 0\` (and justify its content to the edge the buttons sit on), or pass \`constrain={false}\` if it genuinely has no row to take space from.`);
|
|
2534
2534
|
}, [
|
|
2535
|
-
|
|
2535
|
+
j,
|
|
2536
2536
|
u,
|
|
2537
2537
|
b,
|
|
2538
2538
|
g,
|
|
2539
2539
|
v
|
|
2540
2540
|
]), G(() => {
|
|
2541
|
-
if (
|
|
2541
|
+
if (j) return;
|
|
2542
2542
|
let e = m.current;
|
|
2543
2543
|
if (!e) return;
|
|
2544
2544
|
if (typeof ResizeObserver > "u") {
|
|
@@ -2550,18 +2550,18 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
|
|
|
2550
2550
|
t && _(t.contentRect.width);
|
|
2551
2551
|
});
|
|
2552
2552
|
return t.observe(e), _(e.getBoundingClientRect().width), () => t.disconnect();
|
|
2553
|
-
}, [
|
|
2553
|
+
}, [j]);
|
|
2554
2554
|
let F = q(void 0);
|
|
2555
2555
|
G(() => {
|
|
2556
2556
|
F.current = void 0;
|
|
2557
2557
|
}, [P]);
|
|
2558
|
-
let
|
|
2558
|
+
let I = K(() => j || !u ? Or(n, 2 ** 53 - 1, o, v, r, i, s) : b ? g === 0 ? Or(n, 2 ** 53 - 1, o, v, r, i, s) : Or(n, g, o, v, r, i, s, F.current) : {
|
|
2559
2559
|
primaryInline: [],
|
|
2560
2560
|
inline: [],
|
|
2561
2561
|
overflow: [],
|
|
2562
2562
|
destructiveInline: []
|
|
2563
2563
|
}, [
|
|
2564
|
-
|
|
2564
|
+
j,
|
|
2565
2565
|
u,
|
|
2566
2566
|
b,
|
|
2567
2567
|
g,
|
|
@@ -2573,19 +2573,19 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
|
|
|
2573
2573
|
s
|
|
2574
2574
|
]);
|
|
2575
2575
|
if (G(() => {
|
|
2576
|
-
F.current = new Set([...
|
|
2577
|
-
}, [
|
|
2578
|
-
let
|
|
2576
|
+
F.current = new Set([...I.inline, ...I.primaryInline].map(Q));
|
|
2577
|
+
}, [I]), A === 0) return null;
|
|
2578
|
+
let L = I.overflow.length > 0;
|
|
2579
2579
|
return /* @__PURE__ */ Z("div", {
|
|
2580
2580
|
ref: m,
|
|
2581
2581
|
role: "toolbar",
|
|
2582
2582
|
"aria-label": c,
|
|
2583
2583
|
style: {
|
|
2584
2584
|
display: "flex",
|
|
2585
|
-
flexDirection:
|
|
2585
|
+
flexDirection: w ? "row-reverse" : "row",
|
|
2586
2586
|
alignItems: "center",
|
|
2587
2587
|
gap: 4,
|
|
2588
|
-
visibility: b ||
|
|
2588
|
+
visibility: b || j ? "visible" : "hidden",
|
|
2589
2589
|
position: "relative",
|
|
2590
2590
|
flex: u ? "1 1 auto" : "0 1 auto",
|
|
2591
2591
|
justifyContent: l === "trailing" ? "flex-end" : "flex-start",
|
|
@@ -2605,7 +2605,7 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
|
|
|
2605
2605
|
top: 0,
|
|
2606
2606
|
left: 0
|
|
2607
2607
|
},
|
|
2608
|
-
children: [/* @__PURE__ */ X(
|
|
2608
|
+
children: [/* @__PURE__ */ X(V, {
|
|
2609
2609
|
"data-node-key": wr,
|
|
2610
2610
|
iconRight: /* @__PURE__ */ X(e.down, { size: 10 }),
|
|
2611
2611
|
tabIndex: -1,
|
|
@@ -2614,7 +2614,7 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
|
|
|
2614
2614
|
let a = Q(n);
|
|
2615
2615
|
if (n.kind === "action") {
|
|
2616
2616
|
let e = pr(n.code, r, i), o = mr(n.code, r, i), s = hr(n.code, r, i);
|
|
2617
|
-
return /* @__PURE__ */ X(
|
|
2617
|
+
return /* @__PURE__ */ X(V, {
|
|
2618
2618
|
"data-node-key": a,
|
|
2619
2619
|
icon: s ? /* @__PURE__ */ X(t, {
|
|
2620
2620
|
name: s,
|
|
@@ -2625,8 +2625,8 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
|
|
|
2625
2625
|
children: o
|
|
2626
2626
|
}, a);
|
|
2627
2627
|
} else {
|
|
2628
|
-
let t = n.name ?
|
|
2629
|
-
return /* @__PURE__ */ X(
|
|
2628
|
+
let t = n.name ? U(n.name) : "Actions";
|
|
2629
|
+
return /* @__PURE__ */ X(V, {
|
|
2630
2630
|
"data-node-key": a,
|
|
2631
2631
|
iconRight: /* @__PURE__ */ X(e.down, { size: 10 }),
|
|
2632
2632
|
tabIndex: -1,
|
|
@@ -2635,26 +2635,26 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
|
|
|
2635
2635
|
}
|
|
2636
2636
|
})]
|
|
2637
2637
|
}),
|
|
2638
|
-
|
|
2638
|
+
I.primaryInline.map((e) => /* @__PURE__ */ X(_r, {
|
|
2639
2639
|
leaf: e,
|
|
2640
2640
|
entityActions: r,
|
|
2641
2641
|
globalActions: i,
|
|
2642
2642
|
onRun: a,
|
|
2643
|
-
loading:
|
|
2644
|
-
onLoadingChange: (t) =>
|
|
2643
|
+
loading: S === e.code,
|
|
2644
|
+
onLoadingChange: (t) => C(t ? e.code : null),
|
|
2645
2645
|
row: d,
|
|
2646
2646
|
widgetContext: f,
|
|
2647
2647
|
onActionClick: p
|
|
2648
2648
|
}, Q(e))),
|
|
2649
|
-
|
|
2649
|
+
I.inline.map((e) => {
|
|
2650
2650
|
let t = Q(e);
|
|
2651
2651
|
return e.kind === "action" ? /* @__PURE__ */ X(_r, {
|
|
2652
2652
|
leaf: e,
|
|
2653
2653
|
entityActions: r,
|
|
2654
2654
|
globalActions: i,
|
|
2655
2655
|
onRun: a,
|
|
2656
|
-
loading:
|
|
2657
|
-
onLoadingChange: (t) =>
|
|
2656
|
+
loading: S === e.code,
|
|
2657
|
+
onLoadingChange: (t) => C(t ? e.code : null),
|
|
2658
2658
|
row: d,
|
|
2659
2659
|
widgetContext: f,
|
|
2660
2660
|
onActionClick: p
|
|
@@ -2663,37 +2663,37 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
|
|
|
2663
2663
|
entityActions: r,
|
|
2664
2664
|
globalActions: i,
|
|
2665
2665
|
onRun: a,
|
|
2666
|
-
loading:
|
|
2667
|
-
onLoadingChange:
|
|
2666
|
+
loading: S,
|
|
2667
|
+
onLoadingChange: C,
|
|
2668
2668
|
row: d,
|
|
2669
2669
|
widgetContext: f,
|
|
2670
2670
|
onActionClick: p
|
|
2671
2671
|
}, t);
|
|
2672
2672
|
}),
|
|
2673
|
-
|
|
2674
|
-
ref:
|
|
2673
|
+
L && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(V, {
|
|
2674
|
+
ref: E,
|
|
2675
2675
|
kind: "default",
|
|
2676
2676
|
iconRight: /* @__PURE__ */ X(e.down, { size: 10 }),
|
|
2677
2677
|
"aria-haspopup": "menu",
|
|
2678
|
-
"aria-expanded":
|
|
2679
|
-
onClick: () =>
|
|
2678
|
+
"aria-expanded": D ? "true" : "false",
|
|
2679
|
+
onClick: () => O((e) => !e),
|
|
2680
2680
|
children: "Actions"
|
|
2681
|
-
}), /* @__PURE__ */ X(
|
|
2682
|
-
open:
|
|
2683
|
-
anchor:
|
|
2684
|
-
onClose: () =>
|
|
2685
|
-
align:
|
|
2681
|
+
}), /* @__PURE__ */ X(N, {
|
|
2682
|
+
open: D,
|
|
2683
|
+
anchor: E.current,
|
|
2684
|
+
onClose: () => O(!1),
|
|
2685
|
+
align: w ? "start" : "end",
|
|
2686
2686
|
width: 220,
|
|
2687
2687
|
children: /* @__PURE__ */ X("div", {
|
|
2688
2688
|
role: "menu",
|
|
2689
2689
|
"aria-label": "More actions",
|
|
2690
|
-
children:
|
|
2690
|
+
children: I.overflow.map((e) => e.kind === "action" ? /* @__PURE__ */ X(yr, {
|
|
2691
2691
|
leaf: e,
|
|
2692
2692
|
entityActions: r,
|
|
2693
2693
|
globalActions: i,
|
|
2694
|
-
onRun:
|
|
2695
|
-
loading:
|
|
2696
|
-
onLoadingChange: (t) =>
|
|
2694
|
+
onRun: k,
|
|
2695
|
+
loading: S === e.code,
|
|
2696
|
+
onLoadingChange: (t) => C(t ? e.code : null),
|
|
2697
2697
|
row: d,
|
|
2698
2698
|
widgetContext: f,
|
|
2699
2699
|
onActionClick: p
|
|
@@ -2701,22 +2701,22 @@ function kr({ layout: n, entityActions: r, globalActions: i, onRun: a, reservedR
|
|
|
2701
2701
|
group: e,
|
|
2702
2702
|
entityActions: r,
|
|
2703
2703
|
globalActions: i,
|
|
2704
|
-
onRun:
|
|
2705
|
-
loading:
|
|
2706
|
-
onLoadingChange:
|
|
2704
|
+
onRun: k,
|
|
2705
|
+
loading: S,
|
|
2706
|
+
onLoadingChange: C,
|
|
2707
2707
|
row: d,
|
|
2708
2708
|
widgetContext: f,
|
|
2709
2709
|
onActionClick: p
|
|
2710
2710
|
}, Q(e)))
|
|
2711
2711
|
})
|
|
2712
2712
|
})] }),
|
|
2713
|
-
|
|
2713
|
+
I.destructiveInline.map((e) => /* @__PURE__ */ X(_r, {
|
|
2714
2714
|
leaf: e,
|
|
2715
2715
|
entityActions: r,
|
|
2716
2716
|
globalActions: i,
|
|
2717
2717
|
onRun: a,
|
|
2718
|
-
loading:
|
|
2719
|
-
onLoadingChange: (t) =>
|
|
2718
|
+
loading: S === e.code,
|
|
2719
|
+
onLoadingChange: (t) => C(t ? e.code : null),
|
|
2720
2720
|
row: d,
|
|
2721
2721
|
widgetContext: f,
|
|
2722
2722
|
onActionClick: p
|
|
@@ -2789,7 +2789,7 @@ function jr({ layout: e, row: t, rowSelection: n, onRun: r, reservedRightWidth:
|
|
|
2789
2789
|
//#endregion
|
|
2790
2790
|
//#region src/components/shared/RowActionsKebab.tsx
|
|
2791
2791
|
function Mr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divider: o, size: s = 22, align: c = "end" }) {
|
|
2792
|
-
let l = q(null), [u, d] = J(!1), [f, p] = J(null), { run: m } =
|
|
2792
|
+
let l = q(null), [u, d] = J(!1), [f, p] = J(null), { run: m } = te(), h = K(() => {
|
|
2793
2793
|
let e = {};
|
|
2794
2794
|
for (let { code: n, action: r } of t) e[n] = r;
|
|
2795
2795
|
return e;
|
|
@@ -2810,10 +2810,10 @@ function Mr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divide
|
|
|
2810
2810
|
let a = t.entity ? `${t.entity}.${e}` : e;
|
|
2811
2811
|
return m({
|
|
2812
2812
|
action: t,
|
|
2813
|
-
title:
|
|
2813
|
+
title: U(t.display?.name) || e,
|
|
2814
2814
|
row: r,
|
|
2815
2815
|
execute: async (e) => {
|
|
2816
|
-
let t = await
|
|
2816
|
+
let t = await I(a, ee(e, n));
|
|
2817
2817
|
return i?.(), t;
|
|
2818
2818
|
}
|
|
2819
2819
|
});
|
|
@@ -2831,13 +2831,13 @@ function Mr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divide
|
|
|
2831
2831
|
alignItems: "center",
|
|
2832
2832
|
justifyContent: "flex-end"
|
|
2833
2833
|
},
|
|
2834
|
-
children: [/* @__PURE__ */ X(
|
|
2834
|
+
children: [/* @__PURE__ */ X(L, {
|
|
2835
2835
|
ref: l,
|
|
2836
2836
|
size: s,
|
|
2837
2837
|
icon: /* @__PURE__ */ X(e.more, { size: Math.round(s * .55) }),
|
|
2838
2838
|
onClick: () => d((e) => !e),
|
|
2839
2839
|
title: "Actions"
|
|
2840
|
-
}), /* @__PURE__ */ Z(
|
|
2840
|
+
}), /* @__PURE__ */ Z(N, {
|
|
2841
2841
|
open: u,
|
|
2842
2842
|
anchor: l.current,
|
|
2843
2843
|
onClose: () => d(!1),
|
|
@@ -2845,7 +2845,7 @@ function Mr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divide
|
|
|
2845
2845
|
align: c,
|
|
2846
2846
|
children: [
|
|
2847
2847
|
a,
|
|
2848
|
-
a && o && g.length > 0 && /* @__PURE__ */ X(
|
|
2848
|
+
a && o && g.length > 0 && /* @__PURE__ */ X(A, { divider: !0 }),
|
|
2849
2849
|
/* @__PURE__ */ X(Cr, {
|
|
2850
2850
|
layout: g,
|
|
2851
2851
|
entityActions: h,
|
|
@@ -2861,8 +2861,8 @@ function Mr({ actions: t, objectIds: n, row: r, onSuccess: i, preMenu: a, divide
|
|
|
2861
2861
|
//#endregion
|
|
2862
2862
|
//#region src/components/detail-layout/AssociatedToolbar.tsx
|
|
2863
2863
|
function Nr({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearchChange: a, filters: o, onFilterChange: s, allEntities: c }) {
|
|
2864
|
-
let l = n === !0,
|
|
2865
|
-
return !l && !
|
|
2864
|
+
let l = n === !0, d = r && r.length > 0;
|
|
2865
|
+
return !l && !d ? null : /* @__PURE__ */ Z("div", {
|
|
2866
2866
|
style: {
|
|
2867
2867
|
display: "flex",
|
|
2868
2868
|
alignItems: "center",
|
|
@@ -2874,16 +2874,16 @@ function Nr({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearc
|
|
|
2874
2874
|
flex: 1,
|
|
2875
2875
|
maxWidth: 220
|
|
2876
2876
|
},
|
|
2877
|
-
children: /* @__PURE__ */ X(
|
|
2877
|
+
children: /* @__PURE__ */ X(m, {
|
|
2878
2878
|
value: i,
|
|
2879
2879
|
onChange: a,
|
|
2880
2880
|
placeholder: "Search…",
|
|
2881
2881
|
prefix: /* @__PURE__ */ X(e.search, { size: 12 })
|
|
2882
2882
|
})
|
|
2883
|
-
}),
|
|
2883
|
+
}), d && r.map((e) => {
|
|
2884
2884
|
let n = t.fields.get(e);
|
|
2885
2885
|
if (!n) return null;
|
|
2886
|
-
let r = o[e] ?? "__all__", i =
|
|
2886
|
+
let r = o[e] ?? "__all__", i = pe(n, e, c);
|
|
2887
2887
|
return n.type === "ref" && n.ref?.entity ? /* @__PURE__ */ X(Pr, {
|
|
2888
2888
|
field: n,
|
|
2889
2889
|
label: i,
|
|
@@ -2891,14 +2891,14 @@ function Nr({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearc
|
|
|
2891
2891
|
onChange: (t) => s(e, t)
|
|
2892
2892
|
}, e) : n.values ? /* @__PURE__ */ X("div", {
|
|
2893
2893
|
style: { width: 160 },
|
|
2894
|
-
children: /* @__PURE__ */ X(
|
|
2894
|
+
children: /* @__PURE__ */ X(u, {
|
|
2895
2895
|
value: r,
|
|
2896
2896
|
options: [{
|
|
2897
2897
|
value: "__all__",
|
|
2898
2898
|
label: `All ${i}`
|
|
2899
2899
|
}, ...n.values.map((e) => ({
|
|
2900
2900
|
value: e.code,
|
|
2901
|
-
label:
|
|
2901
|
+
label: U(e.name) || e.code
|
|
2902
2902
|
}))],
|
|
2903
2903
|
onChange: (t) => s(e, t),
|
|
2904
2904
|
placeholder: i
|
|
@@ -2908,26 +2908,26 @@ function Nr({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearc
|
|
|
2908
2908
|
});
|
|
2909
2909
|
}
|
|
2910
2910
|
function Pr({ field: e, label: t, value: n, onChange: r }) {
|
|
2911
|
-
let i =
|
|
2911
|
+
let i = h(e.ref?.entity), a = e.display?.ref_display_field ?? i?.display?.display_field, o = K(() => i ? [...i.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [i]), { data: s } = O(e.ref?.entity, {
|
|
2912
2912
|
per_page: 200,
|
|
2913
2913
|
sort: a ? `${a}:asc` : void 0
|
|
2914
2914
|
}), c = s?.data ?? [], l = (e) => {
|
|
2915
2915
|
if (e == null) return "—";
|
|
2916
2916
|
if (typeof e == "object" && !Array.isArray(e)) {
|
|
2917
2917
|
let t = Object.values(e)[0];
|
|
2918
|
-
return t == null ? "—" :
|
|
2918
|
+
return t == null ? "—" : p(t);
|
|
2919
2919
|
}
|
|
2920
|
-
return
|
|
2920
|
+
return p(e);
|
|
2921
2921
|
};
|
|
2922
2922
|
return /* @__PURE__ */ X("div", {
|
|
2923
2923
|
style: { width: 160 },
|
|
2924
|
-
children: /* @__PURE__ */ X(
|
|
2924
|
+
children: /* @__PURE__ */ X(u, {
|
|
2925
2925
|
value: n,
|
|
2926
2926
|
options: [{
|
|
2927
2927
|
value: "__all__",
|
|
2928
2928
|
label: `All ${t}`
|
|
2929
2929
|
}, ...c.map((e) => {
|
|
2930
|
-
let t = String(e[o]), n = e[
|
|
2930
|
+
let t = String(e[o]), n = e[re];
|
|
2931
2931
|
return {
|
|
2932
2932
|
value: t,
|
|
2933
2933
|
label: typeof n == "string" && n !== "" ? n : a ? l(e[a] ?? t) : t
|
|
@@ -2970,7 +2970,7 @@ function Lr(e, t, n) {
|
|
|
2970
2970
|
let n = a.resolved_params.items().filter((e) => e.name !== t);
|
|
2971
2971
|
e = {
|
|
2972
2972
|
...e,
|
|
2973
|
-
resolved_params: new
|
|
2973
|
+
resolved_params: new _(n)
|
|
2974
2974
|
};
|
|
2975
2975
|
}
|
|
2976
2976
|
r.push({
|
|
@@ -3003,7 +3003,7 @@ function Rr(e, t, n) {
|
|
|
3003
3003
|
return null;
|
|
3004
3004
|
}
|
|
3005
3005
|
function zr(e, t, n) {
|
|
3006
|
-
let r = new Set(
|
|
3006
|
+
let r = new Set(s(e));
|
|
3007
3007
|
return new Set(t.filter((t) => {
|
|
3008
3008
|
if (t === n || r.has(t)) return !1;
|
|
3009
3009
|
let i = e.fields.get(t);
|
|
@@ -3065,7 +3065,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
|
|
|
3065
3065
|
if (e === s) return !1;
|
|
3066
3066
|
let t = o.fields.get(e);
|
|
3067
3067
|
return !(!t || t.primary || t.display?.is_listable === !1);
|
|
3068
|
-
}), l =
|
|
3068
|
+
}), l = me(o, "update"), u = r.interaction ?? (l ? "navigate" : "readonly"), d = (u === "inline_edit" || u === "row_edit") && l && r.editable !== !1, f = U(o.display?.name_plural) || U(o.display?.name) || a, p = r.searchable === !0 || r.filters && r.filters.length > 0, m = K(() => Lr(o.actions, s, i.recordId), [
|
|
3069
3069
|
o.actions,
|
|
3070
3070
|
s,
|
|
3071
3071
|
i.recordId
|
|
@@ -3073,7 +3073,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
|
|
|
3073
3073
|
let e = {};
|
|
3074
3074
|
for (let { code: t, action: n } of m) e[t] = n;
|
|
3075
3075
|
return e;
|
|
3076
|
-
}, [m]), g = K(() => j(o.action_layout ?? null ?? ue(h, "list_toolbar"), h, void 0, {}, []), [o.action_layout, h]), { run: _ } =
|
|
3076
|
+
}, [m]), g = K(() => j(o.action_layout ?? null ?? ue(h, "list_toolbar"), h, void 0, {}, []), [o.action_layout, h]), { run: _ } = te(), v = Bt(), y = n(), b = K(() => ({
|
|
3077
3077
|
entity: o,
|
|
3078
3078
|
entityCode: a,
|
|
3079
3079
|
screenRoute: typeof window < "u" ? window.location.pathname : "",
|
|
@@ -3085,32 +3085,32 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
|
|
|
3085
3085
|
icon: t?.icon,
|
|
3086
3086
|
search: t?.search
|
|
3087
3087
|
}),
|
|
3088
|
-
runActionApi: (e, t) =>
|
|
3088
|
+
runActionApi: (e, t) => I(e, t)
|
|
3089
3089
|
}), [
|
|
3090
3090
|
o,
|
|
3091
3091
|
a,
|
|
3092
3092
|
y,
|
|
3093
3093
|
v
|
|
3094
|
-
]), x = Ue(),
|
|
3094
|
+
]), x = Ue(), S = W(() => {
|
|
3095
3095
|
x.invalidateQueries({ predicate: (e) => {
|
|
3096
3096
|
let t = e.queryKey;
|
|
3097
3097
|
return t[0] === "entity-children" && t[3] === a;
|
|
3098
3098
|
} });
|
|
3099
|
-
}, [x, a]),
|
|
3099
|
+
}, [x, a]), C = W((e, t) => {
|
|
3100
3100
|
let n = Fr(e, t, {}, a);
|
|
3101
3101
|
if (n !== null) return _({
|
|
3102
3102
|
action: t,
|
|
3103
|
-
title:
|
|
3103
|
+
title: U(t.display?.name) || e,
|
|
3104
3104
|
execute: async (e) => {
|
|
3105
|
-
let t = await
|
|
3106
|
-
return
|
|
3105
|
+
let t = await I(n, ee(e, void 0));
|
|
3106
|
+
return S(), t;
|
|
3107
3107
|
}
|
|
3108
3108
|
});
|
|
3109
3109
|
}, [
|
|
3110
3110
|
_,
|
|
3111
3111
|
a,
|
|
3112
|
-
|
|
3113
|
-
]), [
|
|
3112
|
+
S
|
|
3113
|
+
]), [w, T] = J(0), E = /* @__PURE__ */ Z("div", {
|
|
3114
3114
|
style: {
|
|
3115
3115
|
display: "flex",
|
|
3116
3116
|
alignItems: "center",
|
|
@@ -3123,7 +3123,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
|
|
|
3123
3123
|
kind: "toolbar",
|
|
3124
3124
|
layout: g,
|
|
3125
3125
|
entityActions: h,
|
|
3126
|
-
onRun:
|
|
3126
|
+
onRun: C,
|
|
3127
3127
|
widgetContext: b,
|
|
3128
3128
|
ariaLabel: `${f} toolbar actions`
|
|
3129
3129
|
}) : m.map(({ code: e, action: t }) => /* @__PURE__ */ X(or, {
|
|
@@ -3132,15 +3132,15 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
|
|
|
3132
3132
|
entityCode: a,
|
|
3133
3133
|
variant: "ghost",
|
|
3134
3134
|
size: "sm",
|
|
3135
|
-
onSuccess:
|
|
3136
|
-
}, e)), d && /* @__PURE__ */ X(
|
|
3135
|
+
onSuccess: S
|
|
3136
|
+
}, e)), d && /* @__PURE__ */ X(V, {
|
|
3137
3137
|
kind: "ghost",
|
|
3138
3138
|
size: "xs",
|
|
3139
3139
|
icon: /* @__PURE__ */ X(e.plus, { size: 12 }),
|
|
3140
|
-
onClick: () =>
|
|
3140
|
+
onClick: () => T((e) => e + 1),
|
|
3141
3141
|
children: "Add row"
|
|
3142
3142
|
})]
|
|
3143
|
-
}),
|
|
3143
|
+
}), D = p ? /* @__PURE__ */ X(Gr, {
|
|
3144
3144
|
entityCode: a,
|
|
3145
3145
|
entity: o,
|
|
3146
3146
|
parentEntity: i.entityCode,
|
|
@@ -3153,7 +3153,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
|
|
|
3153
3153
|
searchable: r.searchable,
|
|
3154
3154
|
filterFields: r.filters,
|
|
3155
3155
|
sort: r.sort,
|
|
3156
|
-
startDraftSignal:
|
|
3156
|
+
startDraftSignal: w
|
|
3157
3157
|
}) : /* @__PURE__ */ X(Wr, {
|
|
3158
3158
|
entityCode: a,
|
|
3159
3159
|
entity: o,
|
|
@@ -3165,7 +3165,7 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
|
|
|
3165
3165
|
interaction: u,
|
|
3166
3166
|
ctx: i,
|
|
3167
3167
|
sort: r.sort,
|
|
3168
|
-
startDraftSignal:
|
|
3168
|
+
startDraftSignal: w
|
|
3169
3169
|
});
|
|
3170
3170
|
return i.withinCard ? /* @__PURE__ */ Z("div", { children: [/* @__PURE__ */ X("div", {
|
|
3171
3171
|
style: {
|
|
@@ -3173,15 +3173,15 @@ function Ur({ node: r, ctx: i, assocCode: a, assocEntity: o, fkField: s }) {
|
|
|
3173
3173
|
justifyContent: "flex-end",
|
|
3174
3174
|
marginBottom: 8
|
|
3175
3175
|
},
|
|
3176
|
-
children:
|
|
3177
|
-
}),
|
|
3176
|
+
children: E
|
|
3177
|
+
}), D] }) : /* @__PURE__ */ X(Je, {
|
|
3178
3178
|
title: f,
|
|
3179
3179
|
icon: o.display?.icon ? /* @__PURE__ */ X(t, {
|
|
3180
3180
|
name: o.display.icon,
|
|
3181
3181
|
size: 14
|
|
3182
3182
|
}) : void 0,
|
|
3183
|
-
right:
|
|
3184
|
-
children:
|
|
3183
|
+
right: E,
|
|
3184
|
+
children: D
|
|
3185
3185
|
});
|
|
3186
3186
|
}
|
|
3187
3187
|
function Wr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, sort: l, startDraftSignal: u }) {
|
|
@@ -3233,7 +3233,7 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3233
3233
|
[e]: t
|
|
3234
3234
|
};
|
|
3235
3235
|
});
|
|
3236
|
-
}, []), S = K(() => Object.keys(v).length > 0 ? v : void 0, [v]), { data: C, isLoading: w, isError: T, hasNextPage: E, fetchNextPage: D, isFetchingNextPage: O } = ar(n, r, e, i, d, void 0, g || void 0, S), { rows:
|
|
3236
|
+
}, []), S = K(() => Object.keys(v).length > 0 ? v : void 0, [v]), { data: C, isLoading: w, isError: T, hasNextPage: E, fetchNextPage: D, isFetchingNextPage: O } = ar(n, r, e, i, d, void 0, g || void 0, S), { rows: A, refs: j } = K(() => {
|
|
3237
3237
|
if (!C?.pages) return {
|
|
3238
3238
|
rows: [],
|
|
3239
3239
|
refs: void 0
|
|
@@ -3274,7 +3274,7 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3274
3274
|
editable: o,
|
|
3275
3275
|
interaction: s,
|
|
3276
3276
|
ctx: c,
|
|
3277
|
-
rows:
|
|
3277
|
+
rows: A,
|
|
3278
3278
|
refs: j,
|
|
3279
3279
|
isLoading: w,
|
|
3280
3280
|
isError: T,
|
|
@@ -3283,10 +3283,10 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3283
3283
|
}),
|
|
3284
3284
|
E && /* @__PURE__ */ X("div", {
|
|
3285
3285
|
style: { marginTop: 4 },
|
|
3286
|
-
children: /* @__PURE__ */ X(
|
|
3286
|
+
children: /* @__PURE__ */ X(V, {
|
|
3287
3287
|
kind: "ghost",
|
|
3288
3288
|
size: "xs",
|
|
3289
|
-
icon: O ? /* @__PURE__ */ X(
|
|
3289
|
+
icon: O ? /* @__PURE__ */ X(k, { size: 12 }) : void 0,
|
|
3290
3290
|
onClick: () => D(),
|
|
3291
3291
|
disabled: O,
|
|
3292
3292
|
children: "Load more"
|
|
@@ -3295,7 +3295,7 @@ function Gr({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
3295
3295
|
] });
|
|
3296
3296
|
}
|
|
3297
3297
|
function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, rows: l, refs: u, isLoading: d, isError: f, invalidateQuery: p, startDraftSignal: m }) {
|
|
3298
|
-
let h =
|
|
3298
|
+
let h = ie(), g = h.isPhone && c.relatedRecordsPresentation === "table", _ = a.find((e) => e !== i), v = K(() => s === "navigate" ? r(void 0, t, c.schema.screens) : null, [
|
|
3299
3299
|
s,
|
|
3300
3300
|
t,
|
|
3301
3301
|
c.schema.screens
|
|
@@ -3304,35 +3304,35 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
|
|
|
3304
3304
|
i,
|
|
3305
3305
|
t,
|
|
3306
3306
|
o
|
|
3307
|
-
]),
|
|
3307
|
+
]), b = K(() => Br(t, a, i), [
|
|
3308
3308
|
a,
|
|
3309
3309
|
i,
|
|
3310
3310
|
t
|
|
3311
|
-
]),
|
|
3311
|
+
]), x = K(() => {
|
|
3312
3312
|
let e = /* @__PURE__ */ new Map();
|
|
3313
3313
|
for (let n of l) {
|
|
3314
|
-
let r =
|
|
3315
|
-
e.set(
|
|
3314
|
+
let r = F(t, n);
|
|
3315
|
+
e.set(he(r), r);
|
|
3316
3316
|
}
|
|
3317
3317
|
return e;
|
|
3318
|
-
}, [l, t]),
|
|
3318
|
+
}, [l, t]), S = K(() => {
|
|
3319
3319
|
let e = /* @__PURE__ */ new Map();
|
|
3320
3320
|
for (let n of l) {
|
|
3321
3321
|
let r = n.$row_version;
|
|
3322
|
-
typeof r == "string" && r !== "" && e.set(F(
|
|
3322
|
+
typeof r == "string" && r !== "" && e.set(he(F(t, n)), r);
|
|
3323
3323
|
}
|
|
3324
3324
|
return e;
|
|
3325
|
-
}, [l, t]),
|
|
3326
|
-
|
|
3327
|
-
let
|
|
3325
|
+
}, [l, t]), C = K(() => Ir(t.actions), [t.actions]), [w, T] = J(null), [E, D] = J(null), [O, k] = J([]), [A, j] = J({}), N = q(A);
|
|
3326
|
+
N.current = A;
|
|
3327
|
+
let P = q({});
|
|
3328
3328
|
G(() => {
|
|
3329
|
-
let e =
|
|
3329
|
+
let e = P.current;
|
|
3330
3330
|
return () => {
|
|
3331
3331
|
for (let t of Object.values(e)) clearTimeout(t);
|
|
3332
3332
|
};
|
|
3333
3333
|
}, []);
|
|
3334
|
-
let [
|
|
3335
|
-
|
|
3334
|
+
let [I, L] = J(null), [R, z] = J([]), [ee, B] = J(!1), { run: V } = te(), [re, ae] = J(/* @__PURE__ */ new Set()), oe = W(async (t, n, r) => {
|
|
3335
|
+
j((e) => ({
|
|
3336
3336
|
...e,
|
|
3337
3337
|
[t]: {
|
|
3338
3338
|
...e[t],
|
|
@@ -3341,26 +3341,26 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
|
|
|
3341
3341
|
}
|
|
3342
3342
|
}));
|
|
3343
3343
|
try {
|
|
3344
|
-
let
|
|
3344
|
+
let i = S.get(t), a = i ? {
|
|
3345
3345
|
...n,
|
|
3346
|
-
$row_version:
|
|
3346
|
+
$row_version: i
|
|
3347
3347
|
} : n;
|
|
3348
|
-
return await
|
|
3348
|
+
return await ne(e, x.get(t) ?? t, a), j((e) => {
|
|
3349
3349
|
let n = e[t];
|
|
3350
3350
|
if (!n) return e;
|
|
3351
|
-
if (n.ver >
|
|
3351
|
+
if (n.ver > r) return {
|
|
3352
3352
|
...e,
|
|
3353
3353
|
[t]: {
|
|
3354
3354
|
...n,
|
|
3355
3355
|
saving: !1
|
|
3356
3356
|
}
|
|
3357
3357
|
};
|
|
3358
|
-
let { [t]:
|
|
3358
|
+
let { [t]: i, ...a } = e;
|
|
3359
3359
|
return a;
|
|
3360
3360
|
}), p(), !0;
|
|
3361
3361
|
} catch (e) {
|
|
3362
3362
|
let n = e instanceof Error ? e.message : "Save failed";
|
|
3363
|
-
return
|
|
3363
|
+
return j((e) => ({
|
|
3364
3364
|
...e,
|
|
3365
3365
|
[t]: {
|
|
3366
3366
|
...e[t],
|
|
@@ -3372,10 +3372,10 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
|
|
|
3372
3372
|
}, [
|
|
3373
3373
|
e,
|
|
3374
3374
|
p,
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
]),
|
|
3378
|
-
|
|
3375
|
+
x,
|
|
3376
|
+
S
|
|
3377
|
+
]), H = W((e, t, n) => {
|
|
3378
|
+
j((r) => {
|
|
3379
3379
|
let i = r[e] ?? {
|
|
3380
3380
|
buffer: {},
|
|
3381
3381
|
ver: 0,
|
|
@@ -3392,97 +3392,97 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
|
|
|
3392
3392
|
ver: a
|
|
3393
3393
|
}
|
|
3394
3394
|
};
|
|
3395
|
-
}), s === "inline_edit" && (
|
|
3396
|
-
let t =
|
|
3397
|
-
t && Object.keys(t.buffer).length > 0 &&
|
|
3395
|
+
}), s === "inline_edit" && (P.current[e] && clearTimeout(P.current[e]), P.current[e] = setTimeout(() => {
|
|
3396
|
+
let t = N.current[e];
|
|
3397
|
+
t && Object.keys(t.buffer).length > 0 && oe(e, { ...t.buffer }, t.ver);
|
|
3398
3398
|
}, 500));
|
|
3399
|
-
}, [
|
|
3399
|
+
}, [oe, s]), se = W(() => {
|
|
3400
3400
|
let e = {};
|
|
3401
3401
|
e[i] = n;
|
|
3402
3402
|
for (let n of a) {
|
|
3403
3403
|
let r = t.fields.get(n);
|
|
3404
3404
|
r && (r.default === void 0 ? r.type === "bool" && (e[n] = !1) : e[n] = r.default);
|
|
3405
3405
|
}
|
|
3406
|
-
|
|
3406
|
+
L(e), z([]);
|
|
3407
3407
|
}, [
|
|
3408
3408
|
i,
|
|
3409
3409
|
n,
|
|
3410
3410
|
a,
|
|
3411
3411
|
t.fields
|
|
3412
|
-
]),
|
|
3412
|
+
]), ce = q(m);
|
|
3413
3413
|
G(() => {
|
|
3414
|
-
m !== void 0 && m !==
|
|
3414
|
+
m !== void 0 && m !== ce.current && (ce.current = m, !I && se());
|
|
3415
3415
|
}, [
|
|
3416
3416
|
m,
|
|
3417
|
-
|
|
3418
|
-
|
|
3417
|
+
I,
|
|
3418
|
+
se
|
|
3419
3419
|
]);
|
|
3420
3420
|
let le = W(async () => {
|
|
3421
|
-
if (!
|
|
3422
|
-
let n = Vr(
|
|
3421
|
+
if (!I) return;
|
|
3422
|
+
let n = Vr(I, a, t, i);
|
|
3423
3423
|
if (n.length > 0) {
|
|
3424
|
-
|
|
3424
|
+
z(n);
|
|
3425
3425
|
return;
|
|
3426
3426
|
}
|
|
3427
3427
|
B(!0);
|
|
3428
3428
|
try {
|
|
3429
|
-
await
|
|
3429
|
+
await M(e, I), L(null), z([]), p();
|
|
3430
3430
|
} catch (e) {
|
|
3431
3431
|
let t = e instanceof Error ? e.message : "Create failed";
|
|
3432
|
-
|
|
3432
|
+
z([`_error:${t}`]);
|
|
3433
3433
|
} finally {
|
|
3434
3434
|
B(!1);
|
|
3435
3435
|
}
|
|
3436
3436
|
}, [
|
|
3437
|
-
|
|
3437
|
+
I,
|
|
3438
3438
|
a,
|
|
3439
3439
|
t,
|
|
3440
3440
|
i,
|
|
3441
3441
|
e,
|
|
3442
3442
|
p
|
|
3443
3443
|
]), ue = W((e) => {
|
|
3444
|
-
|
|
3444
|
+
j({}), k([]), D(e);
|
|
3445
3445
|
}, []), fe = W(async (e) => {
|
|
3446
|
-
let n =
|
|
3446
|
+
let n = N.current[e], r = n?.buffer ?? {};
|
|
3447
3447
|
if (Object.keys(r).length === 0) {
|
|
3448
|
-
|
|
3448
|
+
D(null), k([]);
|
|
3449
3449
|
return;
|
|
3450
3450
|
}
|
|
3451
3451
|
let o = Vr({
|
|
3452
|
-
...l.find((n) => F(
|
|
3452
|
+
...l.find((n) => he(F(t, n)) === e) ?? {},
|
|
3453
3453
|
...r
|
|
3454
3454
|
}, a, t, i);
|
|
3455
3455
|
if (o.length > 0) {
|
|
3456
|
-
|
|
3456
|
+
k(o);
|
|
3457
3457
|
return;
|
|
3458
3458
|
}
|
|
3459
|
-
await
|
|
3459
|
+
await oe(e, { ...r }, n?.ver ?? 0) && (D(null), k([]));
|
|
3460
3460
|
}, [
|
|
3461
3461
|
l,
|
|
3462
3462
|
t,
|
|
3463
3463
|
a,
|
|
3464
3464
|
i,
|
|
3465
|
-
|
|
3465
|
+
oe
|
|
3466
3466
|
]), me = W((e) => {
|
|
3467
|
-
|
|
3467
|
+
j((t) => {
|
|
3468
3468
|
if (!t[e]) return t;
|
|
3469
3469
|
let { [e]: n, ...r } = t;
|
|
3470
3470
|
return r;
|
|
3471
|
-
}),
|
|
3471
|
+
}), k([]), D(null);
|
|
3472
3472
|
}, []), ge = W((n, r) => {
|
|
3473
|
-
let i =
|
|
3473
|
+
let i = x.get(n) ?? n;
|
|
3474
3474
|
return V({
|
|
3475
3475
|
action: t.actions?.__delete,
|
|
3476
3476
|
destructive: !0,
|
|
3477
|
-
title:
|
|
3477
|
+
title: U(t.display?.name) || "Delete",
|
|
3478
3478
|
row: r,
|
|
3479
3479
|
entity: e,
|
|
3480
3480
|
execute: async () => {
|
|
3481
|
-
|
|
3481
|
+
ae((e) => new Set(e).add(n));
|
|
3482
3482
|
try {
|
|
3483
|
-
return await
|
|
3483
|
+
return await de(e, i);
|
|
3484
3484
|
} finally {
|
|
3485
|
-
|
|
3485
|
+
ae((e) => {
|
|
3486
3486
|
let t = new Set(e);
|
|
3487
3487
|
return t.delete(n), t;
|
|
3488
3488
|
});
|
|
@@ -3495,7 +3495,7 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
|
|
|
3495
3495
|
t,
|
|
3496
3496
|
e,
|
|
3497
3497
|
p,
|
|
3498
|
-
|
|
3498
|
+
x
|
|
3499
3499
|
]);
|
|
3500
3500
|
if (f) return /* @__PURE__ */ X("div", {
|
|
3501
3501
|
style: {
|
|
@@ -3522,7 +3522,7 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
|
|
|
3522
3522
|
borderRadius: 6
|
|
3523
3523
|
} })]
|
|
3524
3524
|
});
|
|
3525
|
-
let _e = l.length === 0 && !
|
|
3525
|
+
let _e = l.length === 0 && !I;
|
|
3526
3526
|
return h.isPhone && !g ? /* @__PURE__ */ Z("div", { children: [_e && !o && /* @__PURE__ */ X("div", {
|
|
3527
3527
|
style: {
|
|
3528
3528
|
fontSize: 12.5,
|
|
@@ -3537,7 +3537,7 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
|
|
|
3537
3537
|
gap: 10
|
|
3538
3538
|
},
|
|
3539
3539
|
children: [l.map((n) => {
|
|
3540
|
-
let r = F(
|
|
3540
|
+
let r = he(F(t, n)), i = re.has(r), l = A[r], d = v && r ? v.replace(/:\w+/, r) : void 0;
|
|
3541
3541
|
return /* @__PURE__ */ X(qr, {
|
|
3542
3542
|
rowId: r,
|
|
3543
3543
|
row: n,
|
|
@@ -3548,13 +3548,13 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
|
|
|
3548
3548
|
editableColumns: y,
|
|
3549
3549
|
editable: o,
|
|
3550
3550
|
interaction: s,
|
|
3551
|
-
isEditing:
|
|
3552
|
-
editErrors:
|
|
3551
|
+
isEditing: E === r,
|
|
3552
|
+
editErrors: O,
|
|
3553
3553
|
isDeleting: i,
|
|
3554
|
-
activeCell:
|
|
3555
|
-
setActiveCell:
|
|
3554
|
+
activeCell: w,
|
|
3555
|
+
setActiveCell: T,
|
|
3556
3556
|
rowState: l,
|
|
3557
|
-
onCellChange:
|
|
3557
|
+
onCellChange: H,
|
|
3558
3558
|
onDeleteClick: (e) => void ge(e, n),
|
|
3559
3559
|
onStartEdit: ue,
|
|
3560
3560
|
onConfirmEdit: fe,
|
|
@@ -3562,25 +3562,25 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
|
|
|
3562
3562
|
refs: u,
|
|
3563
3563
|
identityCol: _,
|
|
3564
3564
|
href: d,
|
|
3565
|
-
rowActions:
|
|
3565
|
+
rowActions: C,
|
|
3566
3566
|
entityCode: e,
|
|
3567
3567
|
onRowActionSuccess: p
|
|
3568
3568
|
}, r);
|
|
3569
|
-
}),
|
|
3570
|
-
draftRow:
|
|
3569
|
+
}), I && /* @__PURE__ */ X(Qr, {
|
|
3570
|
+
draftRow: I,
|
|
3571
3571
|
entity: t,
|
|
3572
3572
|
columns: a,
|
|
3573
|
-
editableColumns:
|
|
3573
|
+
editableColumns: b,
|
|
3574
3574
|
foreignKey: i,
|
|
3575
|
-
draftErrors:
|
|
3576
|
-
draftSaving:
|
|
3577
|
-
onChange: (e, t) =>
|
|
3575
|
+
draftErrors: R,
|
|
3576
|
+
draftSaving: ee,
|
|
3577
|
+
onChange: (e, t) => L((n) => n && {
|
|
3578
3578
|
...n,
|
|
3579
3579
|
[e]: t
|
|
3580
3580
|
}),
|
|
3581
3581
|
onConfirm: le,
|
|
3582
3582
|
onCancel: () => {
|
|
3583
|
-
|
|
3583
|
+
L(null), z([]);
|
|
3584
3584
|
},
|
|
3585
3585
|
refs: u
|
|
3586
3586
|
})]
|
|
@@ -3600,19 +3600,19 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
|
|
|
3600
3600
|
let n = t.fields.get(e);
|
|
3601
3601
|
return /* @__PURE__ */ X("th", {
|
|
3602
3602
|
style: Ae,
|
|
3603
|
-
children: n ?
|
|
3603
|
+
children: n ? pe(n, e, c.schema.entities) : e
|
|
3604
3604
|
}, e);
|
|
3605
3605
|
}),
|
|
3606
3606
|
o && /* @__PURE__ */ X("th", { style: {
|
|
3607
3607
|
height: 30,
|
|
3608
3608
|
width: 72
|
|
3609
3609
|
} }),
|
|
3610
|
-
!o &&
|
|
3610
|
+
!o && C.length > 0 && /* @__PURE__ */ X("th", { style: {
|
|
3611
3611
|
height: 30,
|
|
3612
3612
|
width: 40
|
|
3613
3613
|
} })
|
|
3614
3614
|
] }) }), /* @__PURE__ */ Z("tbody", { children: [l.map((n) => {
|
|
3615
|
-
let r = F(
|
|
3615
|
+
let r = he(F(t, n)), i = re.has(r), l = A[r], d = v && r ? v.replace(/:\w+/, r) : void 0;
|
|
3616
3616
|
return /* @__PURE__ */ X(Jr, {
|
|
3617
3617
|
rowId: r,
|
|
3618
3618
|
row: n,
|
|
@@ -3623,13 +3623,13 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
|
|
|
3623
3623
|
editableColumns: y,
|
|
3624
3624
|
editable: o,
|
|
3625
3625
|
interaction: s,
|
|
3626
|
-
isEditing:
|
|
3627
|
-
editErrors:
|
|
3626
|
+
isEditing: E === r,
|
|
3627
|
+
editErrors: O,
|
|
3628
3628
|
isDeleting: i,
|
|
3629
|
-
activeCell:
|
|
3630
|
-
setActiveCell:
|
|
3629
|
+
activeCell: w,
|
|
3630
|
+
setActiveCell: T,
|
|
3631
3631
|
rowState: l,
|
|
3632
|
-
onCellChange:
|
|
3632
|
+
onCellChange: H,
|
|
3633
3633
|
onDeleteClick: (e) => void ge(e, n),
|
|
3634
3634
|
onStartEdit: ue,
|
|
3635
3635
|
onConfirmEdit: fe,
|
|
@@ -3637,47 +3637,47 @@ function Kr({ entityCode: e, entity: t, parentId: n, foreignKey: i, columns: a,
|
|
|
3637
3637
|
refs: u,
|
|
3638
3638
|
identityCol: _,
|
|
3639
3639
|
href: d,
|
|
3640
|
-
rowActions:
|
|
3640
|
+
rowActions: C,
|
|
3641
3641
|
entityCode: e,
|
|
3642
3642
|
onRowActionSuccess: p
|
|
3643
3643
|
}, r);
|
|
3644
|
-
}),
|
|
3645
|
-
draftRow:
|
|
3644
|
+
}), I && /* @__PURE__ */ X(Zr, {
|
|
3645
|
+
draftRow: I,
|
|
3646
3646
|
entity: t,
|
|
3647
3647
|
columns: a,
|
|
3648
|
-
editableColumns:
|
|
3648
|
+
editableColumns: b,
|
|
3649
3649
|
foreignKey: i,
|
|
3650
|
-
draftErrors:
|
|
3651
|
-
draftSaving:
|
|
3652
|
-
onChange: (e, t) =>
|
|
3650
|
+
draftErrors: R,
|
|
3651
|
+
draftSaving: ee,
|
|
3652
|
+
onChange: (e, t) => L((n) => n && {
|
|
3653
3653
|
...n,
|
|
3654
3654
|
[e]: t
|
|
3655
3655
|
}),
|
|
3656
3656
|
onConfirm: le,
|
|
3657
3657
|
onCancel: () => {
|
|
3658
|
-
|
|
3658
|
+
L(null), z([]);
|
|
3659
3659
|
},
|
|
3660
3660
|
refs: u
|
|
3661
3661
|
})] })]
|
|
3662
3662
|
})
|
|
3663
3663
|
})] });
|
|
3664
3664
|
}
|
|
3665
|
-
function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s, editableColumns: c, editable: l, interaction:
|
|
3666
|
-
let
|
|
3665
|
+
function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s, editableColumns: c, editable: l, interaction: u, isEditing: d, editErrors: f, isDeleting: m, rowState: h, onCellChange: g, onDeleteClick: _, onStartEdit: v, onConfirmEdit: y, onCancelEdit: b, refs: x, identityCol: S, href: C, rowActions: w, onRowActionSuccess: T }) {
|
|
3666
|
+
let E = n(), D = Ie(), O = K(() => !h || Object.keys(h.buffer).length === 0 ? r : {
|
|
3667
3667
|
...r,
|
|
3668
3668
|
...h.buffer
|
|
3669
3669
|
}, [r, h]);
|
|
3670
|
-
return
|
|
3671
|
-
values:
|
|
3670
|
+
return u === "row_edit" && d ? /* @__PURE__ */ X(Xr, {
|
|
3671
|
+
values: O,
|
|
3672
3672
|
entity: i,
|
|
3673
3673
|
columns: s,
|
|
3674
3674
|
editableColumns: c,
|
|
3675
|
-
errors: h?.error ? [...
|
|
3675
|
+
errors: h?.error ? [...f, `_error:${h.error}`] : f,
|
|
3676
3676
|
saving: h?.saving ?? !1,
|
|
3677
3677
|
onChange: (e, n) => g(t, e, n),
|
|
3678
3678
|
onConfirm: () => y(t),
|
|
3679
|
-
onCancel: () =>
|
|
3680
|
-
refs:
|
|
3679
|
+
onCancel: () => b(t),
|
|
3680
|
+
refs: x
|
|
3681
3681
|
}) : /* @__PURE__ */ Z("div", {
|
|
3682
3682
|
style: {
|
|
3683
3683
|
border: "1px solid var(--border)",
|
|
@@ -3694,26 +3694,26 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3694
3694
|
gap: 12
|
|
3695
3695
|
},
|
|
3696
3696
|
children: s.map((e) => {
|
|
3697
|
-
let n = i.fields.get(e), r = l &&
|
|
3697
|
+
let n = i.fields.get(e), r = l && u === "inline_edit" && c.has(e), s = C && e === S, d = n ? pe(n, e, a) : e, f = `${D}-${t}-${e}`, m = `${f}-label`, h = {
|
|
3698
3698
|
fontSize: 11.5,
|
|
3699
3699
|
fontWeight: 600,
|
|
3700
3700
|
color: "var(--text-3)"
|
|
3701
|
-
}, _ = n ?
|
|
3701
|
+
}, _ = n ? B({
|
|
3702
3702
|
field: n,
|
|
3703
3703
|
fieldName: e,
|
|
3704
|
-
value:
|
|
3704
|
+
value: O[e],
|
|
3705
3705
|
mode: r ? "edit" : "display",
|
|
3706
3706
|
onChange: r ? (n) => g(t, e, n) : void 0,
|
|
3707
|
-
record:
|
|
3708
|
-
refs:
|
|
3707
|
+
record: O,
|
|
3708
|
+
refs: x,
|
|
3709
3709
|
compact: r,
|
|
3710
3710
|
entity: i,
|
|
3711
3711
|
entities: a,
|
|
3712
3712
|
screens: s ? void 0 : o,
|
|
3713
|
-
fieldId:
|
|
3713
|
+
fieldId: f,
|
|
3714
3714
|
labelId: m,
|
|
3715
|
-
locale:
|
|
3716
|
-
}) :
|
|
3715
|
+
locale: E
|
|
3716
|
+
}) : p(O[e]);
|
|
3717
3717
|
return /* @__PURE__ */ Z("div", {
|
|
3718
3718
|
style: {
|
|
3719
3719
|
display: "flex",
|
|
@@ -3723,17 +3723,17 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3723
3723
|
},
|
|
3724
3724
|
children: [r && n ? /* @__PURE__ */ X("label", {
|
|
3725
3725
|
id: m,
|
|
3726
|
-
htmlFor:
|
|
3726
|
+
htmlFor: f,
|
|
3727
3727
|
style: h,
|
|
3728
|
-
children:
|
|
3728
|
+
children: d
|
|
3729
3729
|
}) : /* @__PURE__ */ X("div", {
|
|
3730
3730
|
id: m,
|
|
3731
3731
|
style: h,
|
|
3732
|
-
children:
|
|
3732
|
+
children: d
|
|
3733
3733
|
}), /* @__PURE__ */ X("div", {
|
|
3734
3734
|
style: { minWidth: 0 },
|
|
3735
3735
|
children: s && !r ? /* @__PURE__ */ X("a", {
|
|
3736
|
-
href:
|
|
3736
|
+
href: C,
|
|
3737
3737
|
style: {
|
|
3738
3738
|
color: "var(--accent)",
|
|
3739
3739
|
textDecoration: "none",
|
|
@@ -3744,7 +3744,7 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3744
3744
|
})]
|
|
3745
3745
|
}, e);
|
|
3746
3746
|
})
|
|
3747
|
-
}), (l ||
|
|
3747
|
+
}), (l || w && w.length > 0) && /* @__PURE__ */ Z("div", {
|
|
3748
3748
|
style: {
|
|
3749
3749
|
minHeight: 42,
|
|
3750
3750
|
padding: "6px 8px",
|
|
@@ -3755,7 +3755,7 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3755
3755
|
gap: 6
|
|
3756
3756
|
},
|
|
3757
3757
|
children: [l && /* @__PURE__ */ Z(Y, { children: [
|
|
3758
|
-
h?.saving && /* @__PURE__ */ X(
|
|
3758
|
+
h?.saving && /* @__PURE__ */ X(k, { size: 12 }),
|
|
3759
3759
|
h?.error && /* @__PURE__ */ X("span", {
|
|
3760
3760
|
style: {
|
|
3761
3761
|
fontSize: 11,
|
|
@@ -3764,38 +3764,38 @@ function qr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3764
3764
|
title: h.error,
|
|
3765
3765
|
children: "!"
|
|
3766
3766
|
}),
|
|
3767
|
-
|
|
3767
|
+
u === "row_edit" && /* @__PURE__ */ X(L, {
|
|
3768
3768
|
size: 32,
|
|
3769
3769
|
icon: /* @__PURE__ */ X(e.edit, { size: 14 }),
|
|
3770
3770
|
onClick: () => v(t),
|
|
3771
3771
|
title: "Edit row"
|
|
3772
3772
|
}),
|
|
3773
|
-
/* @__PURE__ */ X(
|
|
3773
|
+
/* @__PURE__ */ X(L, {
|
|
3774
3774
|
size: 32,
|
|
3775
3775
|
icon: /* @__PURE__ */ X(e.trash, { size: 14 }),
|
|
3776
3776
|
onClick: () => _(t),
|
|
3777
3777
|
title: "Delete row"
|
|
3778
3778
|
})
|
|
3779
|
-
] }), !l &&
|
|
3780
|
-
actions:
|
|
3779
|
+
] }), !l && w && w.length > 0 && /* @__PURE__ */ X(Mr, {
|
|
3780
|
+
actions: w,
|
|
3781
3781
|
objectIds: [t],
|
|
3782
|
-
row:
|
|
3783
|
-
onSuccess:
|
|
3782
|
+
row: O,
|
|
3783
|
+
onSuccess: T
|
|
3784
3784
|
})]
|
|
3785
3785
|
})]
|
|
3786
3786
|
});
|
|
3787
3787
|
}
|
|
3788
|
-
function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s, editableColumns: c, editable: l, interaction:
|
|
3789
|
-
let O = n(),
|
|
3788
|
+
function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s, editableColumns: c, editable: l, interaction: u, isEditing: d, editErrors: f, isDeleting: m, activeCell: h, setActiveCell: g, rowState: _, onCellChange: v, onDeleteClick: y, onStartEdit: b, onConfirmEdit: x, onCancelEdit: S, refs: C, identityCol: w, href: T, rowActions: E, onRowActionSuccess: D }) {
|
|
3789
|
+
let O = n(), A = K(() => !_ || Object.keys(_.buffer).length === 0 ? r : {
|
|
3790
3790
|
...r,
|
|
3791
3791
|
..._.buffer
|
|
3792
3792
|
}, [r, _]);
|
|
3793
|
-
if (
|
|
3794
|
-
values:
|
|
3793
|
+
if (u === "row_edit" && d) return /* @__PURE__ */ X(Yr, {
|
|
3794
|
+
values: A,
|
|
3795
3795
|
entity: i,
|
|
3796
3796
|
columns: s,
|
|
3797
3797
|
editableColumns: c,
|
|
3798
|
-
errors: _?.error ? [...
|
|
3798
|
+
errors: _?.error ? [...f, `_error:${_.error}`] : f,
|
|
3799
3799
|
saving: _?.saving ?? !1,
|
|
3800
3800
|
onChange: (e, n) => v(t, e, n),
|
|
3801
3801
|
onConfirm: () => x(t),
|
|
@@ -3806,7 +3806,7 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3806
3806
|
padding: "4px 4px",
|
|
3807
3807
|
borderBottom: "1px solid var(--divider)",
|
|
3808
3808
|
verticalAlign: "middle"
|
|
3809
|
-
}, N =
|
|
3809
|
+
}, N = u === "inline_edit";
|
|
3810
3810
|
return /* @__PURE__ */ Z("tr", {
|
|
3811
3811
|
style: { opacity: m ? .5 : 1 },
|
|
3812
3812
|
children: [
|
|
@@ -3814,36 +3814,36 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3814
3814
|
let n = i.fields.get(e), r = c.has(e);
|
|
3815
3815
|
if (N && h?.rowId === t && h?.col === e && r) return /* @__PURE__ */ X("td", {
|
|
3816
3816
|
style: M,
|
|
3817
|
-
children: n ?
|
|
3817
|
+
children: n ? B({
|
|
3818
3818
|
field: n,
|
|
3819
3819
|
fieldName: e,
|
|
3820
|
-
value:
|
|
3820
|
+
value: A[e],
|
|
3821
3821
|
mode: "edit",
|
|
3822
3822
|
onChange: (n) => v(t, e, n),
|
|
3823
|
-
record:
|
|
3823
|
+
record: A,
|
|
3824
3824
|
refs: C,
|
|
3825
3825
|
compact: !0,
|
|
3826
3826
|
locale: O
|
|
3827
|
-
}) :
|
|
3827
|
+
}) : p(A[e])
|
|
3828
3828
|
}, e);
|
|
3829
|
-
let s = T && e === w, l = n ?
|
|
3829
|
+
let s = T && e === w, l = n ? B({
|
|
3830
3830
|
field: n,
|
|
3831
3831
|
fieldName: e,
|
|
3832
|
-
value:
|
|
3832
|
+
value: A[e],
|
|
3833
3833
|
mode: "display",
|
|
3834
|
-
record:
|
|
3834
|
+
record: A,
|
|
3835
3835
|
refs: C,
|
|
3836
3836
|
entity: i,
|
|
3837
3837
|
entities: a,
|
|
3838
3838
|
screens: s ? void 0 : o,
|
|
3839
3839
|
locale: O
|
|
3840
|
-
}) :
|
|
3840
|
+
}) : p(A[e]), u = N && r && !m;
|
|
3841
3841
|
return /* @__PURE__ */ X("td", {
|
|
3842
3842
|
style: {
|
|
3843
3843
|
...j,
|
|
3844
|
-
cursor:
|
|
3844
|
+
cursor: u ? "pointer" : "default"
|
|
3845
3845
|
},
|
|
3846
|
-
onClick:
|
|
3846
|
+
onClick: u ? () => g({
|
|
3847
3847
|
rowId: t,
|
|
3848
3848
|
col: e
|
|
3849
3849
|
}) : void 0,
|
|
@@ -3873,7 +3873,7 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3873
3873
|
gap: 4
|
|
3874
3874
|
},
|
|
3875
3875
|
children: [
|
|
3876
|
-
_?.saving && /* @__PURE__ */ X(
|
|
3876
|
+
_?.saving && /* @__PURE__ */ X(k, { size: 12 }),
|
|
3877
3877
|
_?.error && /* @__PURE__ */ X("span", {
|
|
3878
3878
|
style: {
|
|
3879
3879
|
fontSize: 11,
|
|
@@ -3882,13 +3882,13 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3882
3882
|
title: _.error,
|
|
3883
3883
|
children: "!"
|
|
3884
3884
|
}),
|
|
3885
|
-
|
|
3885
|
+
u === "row_edit" && /* @__PURE__ */ X(L, {
|
|
3886
3886
|
size: 24,
|
|
3887
3887
|
icon: /* @__PURE__ */ X(e.edit, { size: 12 }),
|
|
3888
3888
|
onClick: () => b(t),
|
|
3889
3889
|
title: "Edit row"
|
|
3890
3890
|
}),
|
|
3891
|
-
/* @__PURE__ */ X(
|
|
3891
|
+
/* @__PURE__ */ X(L, {
|
|
3892
3892
|
size: 24,
|
|
3893
3893
|
icon: /* @__PURE__ */ X(e.trash, { size: 12 }),
|
|
3894
3894
|
onClick: () => y(t),
|
|
@@ -3906,14 +3906,14 @@ function Jr({ rowId: t, row: r, entity: i, entities: a, screens: o, columns: s,
|
|
|
3906
3906
|
children: /* @__PURE__ */ X(Mr, {
|
|
3907
3907
|
actions: E,
|
|
3908
3908
|
objectIds: [t],
|
|
3909
|
-
row:
|
|
3909
|
+
row: A,
|
|
3910
3910
|
onSuccess: D
|
|
3911
3911
|
})
|
|
3912
3912
|
})
|
|
3913
3913
|
]
|
|
3914
3914
|
});
|
|
3915
3915
|
}
|
|
3916
|
-
function Yr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, saving: s, onChange: c, onConfirm: l, onCancel:
|
|
3916
|
+
function Yr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, saving: s, onChange: c, onConfirm: l, onCancel: u, refs: d, accent: f }) {
|
|
3917
3917
|
let m = n(), h = o.find((e) => e.startsWith("_error:")), g = new Set(o.filter((e) => !e.startsWith("_error:"))), _ = {
|
|
3918
3918
|
padding: "6px 12px",
|
|
3919
3919
|
borderBottom: "1px solid var(--divider)",
|
|
@@ -3927,9 +3927,9 @@ function Yr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
|
|
|
3927
3927
|
minWidth: 0
|
|
3928
3928
|
};
|
|
3929
3929
|
return /* @__PURE__ */ Z("tr", {
|
|
3930
|
-
style:
|
|
3930
|
+
style: f ? { boxShadow: "inset 3px 0 0 var(--accent)" } : void 0,
|
|
3931
3931
|
onKeyDown: (e) => {
|
|
3932
|
-
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), l()) : e.key === "Escape" && (e.preventDefault(),
|
|
3932
|
+
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), l()) : e.key === "Escape" && (e.preventDefault(), u());
|
|
3933
3933
|
},
|
|
3934
3934
|
children: [i.map((e) => {
|
|
3935
3935
|
let n = r.fields.get(e), i = a.has(e), o = g.has(e);
|
|
@@ -3942,24 +3942,24 @@ function Yr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
|
|
|
3942
3942
|
title: o ? `${e} is required` : void 0,
|
|
3943
3943
|
children: /* @__PURE__ */ X("div", {
|
|
3944
3944
|
style: v,
|
|
3945
|
-
children: n ?
|
|
3945
|
+
children: n ? B({
|
|
3946
3946
|
field: n,
|
|
3947
3947
|
fieldName: e,
|
|
3948
3948
|
value: t[e],
|
|
3949
3949
|
mode: "edit",
|
|
3950
3950
|
onChange: (t) => c(e, t),
|
|
3951
3951
|
record: t,
|
|
3952
|
-
refs:
|
|
3952
|
+
refs: d,
|
|
3953
3953
|
compact: !0,
|
|
3954
3954
|
locale: m
|
|
3955
|
-
}) :
|
|
3955
|
+
}) : p(t[e])
|
|
3956
3956
|
})
|
|
3957
3957
|
}, e) : /* @__PURE__ */ X("td", {
|
|
3958
3958
|
style: {
|
|
3959
3959
|
..._,
|
|
3960
3960
|
color: "var(--text-3)"
|
|
3961
3961
|
},
|
|
3962
|
-
children: n?.auto ? "—" :
|
|
3962
|
+
children: n?.auto ? "—" : p(t[e])
|
|
3963
3963
|
}, e);
|
|
3964
3964
|
}), /* @__PURE__ */ X("td", {
|
|
3965
3965
|
style: _,
|
|
@@ -3979,16 +3979,16 @@ function Yr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
|
|
|
3979
3979
|
title: h.slice(7),
|
|
3980
3980
|
children: "!"
|
|
3981
3981
|
}),
|
|
3982
|
-
/* @__PURE__ */ X(
|
|
3982
|
+
/* @__PURE__ */ X(L, {
|
|
3983
3983
|
size: 24,
|
|
3984
|
-
icon: X(s ?
|
|
3984
|
+
icon: X(s ? k : e.check, { size: 12 }),
|
|
3985
3985
|
onClick: l,
|
|
3986
3986
|
title: "Confirm (Enter)"
|
|
3987
3987
|
}),
|
|
3988
|
-
/* @__PURE__ */ X(
|
|
3988
|
+
/* @__PURE__ */ X(L, {
|
|
3989
3989
|
size: 24,
|
|
3990
3990
|
icon: /* @__PURE__ */ X(e.x, { size: 12 }),
|
|
3991
|
-
onClick:
|
|
3991
|
+
onClick: u,
|
|
3992
3992
|
title: "Cancel (Esc)"
|
|
3993
3993
|
})
|
|
3994
3994
|
]
|
|
@@ -3996,7 +3996,7 @@ function Yr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
|
|
|
3996
3996
|
})]
|
|
3997
3997
|
});
|
|
3998
3998
|
}
|
|
3999
|
-
function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, saving: s, onChange: c, onConfirm: l, onCancel:
|
|
3999
|
+
function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, saving: s, onChange: c, onConfirm: l, onCancel: u, refs: d, accent: f }) {
|
|
4000
4000
|
let m = n(), h = Ie(), g = o.find((e) => e.startsWith("_error:")), _ = new Set(o.filter((e) => !e.startsWith("_error:")));
|
|
4001
4001
|
return /* @__PURE__ */ Z("div", {
|
|
4002
4002
|
style: {
|
|
@@ -4004,10 +4004,10 @@ function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
|
|
|
4004
4004
|
borderRadius: 8,
|
|
4005
4005
|
background: "var(--surface)",
|
|
4006
4006
|
overflow: "hidden",
|
|
4007
|
-
boxShadow:
|
|
4007
|
+
boxShadow: f ? "inset 3px 0 0 var(--accent)" : void 0
|
|
4008
4008
|
},
|
|
4009
4009
|
onKeyDown: (e) => {
|
|
4010
|
-
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), l()) : e.key === "Escape" && (e.preventDefault(),
|
|
4010
|
+
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), l()) : e.key === "Escape" && (e.preventDefault(), u());
|
|
4011
4011
|
},
|
|
4012
4012
|
children: [/* @__PURE__ */ X("div", {
|
|
4013
4013
|
style: {
|
|
@@ -4017,7 +4017,7 @@ function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
|
|
|
4017
4017
|
gap: 12
|
|
4018
4018
|
},
|
|
4019
4019
|
children: i.map((e) => {
|
|
4020
|
-
let n = r.fields.get(e), i = a.has(e), o = _.has(e), s = n ?
|
|
4020
|
+
let n = r.fields.get(e), i = a.has(e), o = _.has(e), s = n ? pe(n, e) : e, l = `${h}-${e}`, u = `${l}-label`, f = {
|
|
4021
4021
|
fontSize: 11.5,
|
|
4022
4022
|
fontWeight: 600,
|
|
4023
4023
|
color: "var(--text-3)"
|
|
@@ -4030,13 +4030,13 @@ function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
|
|
|
4030
4030
|
minWidth: 0
|
|
4031
4031
|
},
|
|
4032
4032
|
children: [i && n ? /* @__PURE__ */ X("label", {
|
|
4033
|
-
id:
|
|
4033
|
+
id: u,
|
|
4034
4034
|
htmlFor: l,
|
|
4035
|
-
style:
|
|
4035
|
+
style: f,
|
|
4036
4036
|
children: s
|
|
4037
4037
|
}) : /* @__PURE__ */ X("div", {
|
|
4038
|
-
id:
|
|
4039
|
-
style:
|
|
4038
|
+
id: u,
|
|
4039
|
+
style: f,
|
|
4040
4040
|
children: s
|
|
4041
4041
|
}), /* @__PURE__ */ X("div", {
|
|
4042
4042
|
style: {
|
|
@@ -4046,19 +4046,19 @@ function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
|
|
|
4046
4046
|
borderRadius: o ? 5 : 0
|
|
4047
4047
|
},
|
|
4048
4048
|
title: o ? `${e} is required` : void 0,
|
|
4049
|
-
children: i ? n ?
|
|
4049
|
+
children: i ? n ? B({
|
|
4050
4050
|
field: n,
|
|
4051
4051
|
fieldName: e,
|
|
4052
4052
|
value: t[e],
|
|
4053
4053
|
mode: "edit",
|
|
4054
4054
|
onChange: (t) => c(e, t),
|
|
4055
4055
|
record: t,
|
|
4056
|
-
refs:
|
|
4056
|
+
refs: d,
|
|
4057
4057
|
compact: !0,
|
|
4058
4058
|
fieldId: l,
|
|
4059
|
-
labelId:
|
|
4059
|
+
labelId: u,
|
|
4060
4060
|
locale: m
|
|
4061
|
-
}) :
|
|
4061
|
+
}) : p(t[e]) : n?.auto ? "—" : p(t[e])
|
|
4062
4062
|
})]
|
|
4063
4063
|
}, e);
|
|
4064
4064
|
})
|
|
@@ -4081,16 +4081,16 @@ function Xr({ values: t, entity: r, columns: i, editableColumns: a, errors: o, s
|
|
|
4081
4081
|
title: g.slice(7),
|
|
4082
4082
|
children: "!"
|
|
4083
4083
|
}),
|
|
4084
|
-
/* @__PURE__ */ X(
|
|
4084
|
+
/* @__PURE__ */ X(L, {
|
|
4085
4085
|
size: 32,
|
|
4086
|
-
icon: X(s ?
|
|
4086
|
+
icon: X(s ? k : e.check, { size: 14 }),
|
|
4087
4087
|
onClick: l,
|
|
4088
4088
|
title: "Confirm (Enter)"
|
|
4089
4089
|
}),
|
|
4090
|
-
/* @__PURE__ */ X(
|
|
4090
|
+
/* @__PURE__ */ X(L, {
|
|
4091
4091
|
size: 32,
|
|
4092
4092
|
icon: /* @__PURE__ */ X(e.x, { size: 14 }),
|
|
4093
|
-
onClick:
|
|
4093
|
+
onClick: u,
|
|
4094
4094
|
title: "Cancel (Esc)"
|
|
4095
4095
|
})
|
|
4096
4096
|
]
|
|
@@ -4136,7 +4136,7 @@ function Qr({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey
|
|
|
4136
4136
|
//#endregion
|
|
4137
4137
|
//#region src/hooks/useMutations.ts
|
|
4138
4138
|
function $r(e) {
|
|
4139
|
-
|
|
4139
|
+
H.error(e.message);
|
|
4140
4140
|
}
|
|
4141
4141
|
function ei(e, t, n = {}) {
|
|
4142
4142
|
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: [tr, t] }), n.objectMeta && (e.invalidateQueries({ queryKey: ["object-status", t] }), e.invalidateQueries({ queryKey: ["object-properties", t] }));
|
|
@@ -4144,9 +4144,9 @@ function ei(e, t, n = {}) {
|
|
|
4144
4144
|
function ti(e) {
|
|
4145
4145
|
let t = Ue();
|
|
4146
4146
|
return Ve({
|
|
4147
|
-
mutationFn: (t) =>
|
|
4147
|
+
mutationFn: (t) => M(e, t),
|
|
4148
4148
|
onSuccess: () => {
|
|
4149
|
-
ei(t, e),
|
|
4149
|
+
ei(t, e), H.success("Record created");
|
|
4150
4150
|
},
|
|
4151
4151
|
onError: $r
|
|
4152
4152
|
});
|
|
@@ -4154,13 +4154,13 @@ function ti(e) {
|
|
|
4154
4154
|
function ni(e) {
|
|
4155
4155
|
let t = Ue();
|
|
4156
4156
|
return Ve({
|
|
4157
|
-
mutationFn: ({ pkValues: t, data: n }) =>
|
|
4157
|
+
mutationFn: ({ pkValues: t, data: n }) => ne(e, t, n),
|
|
4158
4158
|
onSuccess: () => {
|
|
4159
4159
|
ei(t, e, {
|
|
4160
4160
|
item: !0,
|
|
4161
4161
|
children: !0,
|
|
4162
4162
|
objectMeta: !0
|
|
4163
|
-
}),
|
|
4163
|
+
}), H.success("Record updated");
|
|
4164
4164
|
},
|
|
4165
4165
|
onError: $r
|
|
4166
4166
|
});
|
|
@@ -4168,9 +4168,9 @@ function ni(e) {
|
|
|
4168
4168
|
function ri(e) {
|
|
4169
4169
|
let t = Ue();
|
|
4170
4170
|
return Ve({
|
|
4171
|
-
mutationFn: (t) =>
|
|
4171
|
+
mutationFn: (t) => de(e, t),
|
|
4172
4172
|
onSuccess: () => {
|
|
4173
|
-
ei(t, e, { item: !0 }),
|
|
4173
|
+
ei(t, e, { item: !0 }), H.success("Record deleted");
|
|
4174
4174
|
},
|
|
4175
4175
|
onError: $r
|
|
4176
4176
|
});
|
|
@@ -4178,12 +4178,12 @@ function ri(e) {
|
|
|
4178
4178
|
function ii(e) {
|
|
4179
4179
|
let t = Ue();
|
|
4180
4180
|
return Ve({
|
|
4181
|
-
mutationFn: (t) =>
|
|
4181
|
+
mutationFn: (t) => w(e, t),
|
|
4182
4182
|
onSuccess: () => {
|
|
4183
4183
|
ei(t, e, {
|
|
4184
4184
|
item: !0,
|
|
4185
4185
|
objectMeta: !0
|
|
4186
|
-
}),
|
|
4186
|
+
}), H.success("Record restored");
|
|
4187
4187
|
},
|
|
4188
4188
|
onError: $r
|
|
4189
4189
|
});
|
|
@@ -4364,22 +4364,22 @@ function hi(e, t) {
|
|
|
4364
4364
|
//#endregion
|
|
4365
4365
|
//#region src/hooks/useScreenBack.ts
|
|
4366
4366
|
function gi(e) {
|
|
4367
|
-
let t = ze(), n =
|
|
4367
|
+
let t = ze(), n = oe(), r = ae(), a = At((e) => e.depth), { data: o } = i(), s = e?.fallback, c = kt((e) => {
|
|
4368
4368
|
let t = e.tabs.find((t) => t.id === e.activeTabId);
|
|
4369
4369
|
return t ? t.returnTo : void 0;
|
|
4370
|
-
}), { hasOriginBack:
|
|
4370
|
+
}), { hasOriginBack: l, allowFallbackBack: u } = K(() => It(c, n.enabled), [c, n.enabled]), d = W(() => {
|
|
4371
4371
|
if (n.enabled) {
|
|
4372
|
-
At.getState().depth > 0 ? r() :
|
|
4372
|
+
At.getState().depth > 0 ? r() : s?.();
|
|
4373
4373
|
return;
|
|
4374
4374
|
}
|
|
4375
4375
|
let e = kt.getState(), i = Lt(e.tabs.find((t) => t.id === e.activeTabId)?.returnTo, e.tabs, !1);
|
|
4376
4376
|
if (!i) {
|
|
4377
|
-
|
|
4377
|
+
s?.();
|
|
4378
4378
|
return;
|
|
4379
4379
|
}
|
|
4380
4380
|
if (i.kind === "live" && i.tabId) e.commitTabNavigation(i.tabId, { search: i.search ?? "" });
|
|
4381
4381
|
else if (i.kind === "reopen") {
|
|
4382
|
-
let t = i.title ? void 0 :
|
|
4382
|
+
let t = i.title ? void 0 : v(i.pathname, o?.screens, o?.entities);
|
|
4383
4383
|
e.openTab({
|
|
4384
4384
|
pathname: i.pathname,
|
|
4385
4385
|
search: i.search ?? "",
|
|
@@ -4397,16 +4397,16 @@ function gi(e) {
|
|
|
4397
4397
|
}, [
|
|
4398
4398
|
n.enabled,
|
|
4399
4399
|
r,
|
|
4400
|
-
|
|
4400
|
+
s,
|
|
4401
4401
|
t,
|
|
4402
|
-
|
|
4403
|
-
|
|
4402
|
+
o?.screens,
|
|
4403
|
+
o?.entities
|
|
4404
4404
|
]);
|
|
4405
4405
|
return {
|
|
4406
|
-
canGoBack: n.enabled ?
|
|
4407
|
-
hasOriginBack:
|
|
4408
|
-
allowFallbackBack:
|
|
4409
|
-
goBack:
|
|
4406
|
+
canGoBack: n.enabled ? a > 0 || !!s : l || !!s,
|
|
4407
|
+
hasOriginBack: l,
|
|
4408
|
+
allowFallbackBack: u,
|
|
4409
|
+
goBack: d
|
|
4410
4410
|
};
|
|
4411
4411
|
}
|
|
4412
4412
|
//#endregion
|
|
@@ -4684,7 +4684,7 @@ function Zi(e, t) {
|
|
|
4684
4684
|
function Qi(e, t) {
|
|
4685
4685
|
if (!e) return [];
|
|
4686
4686
|
let n = new $();
|
|
4687
|
-
for (let r of
|
|
4687
|
+
for (let r of s(e)) n.add(r), t.addField(r, "identity");
|
|
4688
4688
|
let r = Hi(e, e.display.display_field, { explicit: !0 });
|
|
4689
4689
|
r && (n.add(r), t.addField(r, "display"), da(e, r, t, "display"));
|
|
4690
4690
|
for (let r of $i(e.display.display_template)) {
|
|
@@ -4949,7 +4949,7 @@ var $ = class {
|
|
|
4949
4949
|
},
|
|
4950
4950
|
children: this.state.error?.message || "An unexpected error occurred."
|
|
4951
4951
|
}),
|
|
4952
|
-
/* @__PURE__ */ X("div", { children: /* @__PURE__ */ X(
|
|
4952
|
+
/* @__PURE__ */ X("div", { children: /* @__PURE__ */ X(V, {
|
|
4953
4953
|
onClick: this.handleRetry,
|
|
4954
4954
|
children: "Try again"
|
|
4955
4955
|
}) })
|
|
@@ -4971,7 +4971,7 @@ function _a(e, t) {
|
|
|
4971
4971
|
let n = ga(e, t), r = n[2];
|
|
4972
4972
|
return He({
|
|
4973
4973
|
queryKey: n,
|
|
4974
|
-
queryFn: () =>
|
|
4974
|
+
queryFn: () => S(e, t),
|
|
4975
4975
|
enabled: !!e && !!t && t !== "new" && r !== void 0
|
|
4976
4976
|
});
|
|
4977
4977
|
}
|