@declarion/react 0.1.29 → 0.1.30
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/index.js +715 -727
- package/dist-lib/index.js.map +1 -1
- package/dist-lib/lib/actions.d.ts +4 -3
- package/package.json +1 -1
package/dist-lib/index.js
CHANGED
|
@@ -3,11 +3,11 @@ var Es = (e, t, r) => t in e ? Rs(e, t, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var st = (e, t, r) => Es(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
4
|
import { jsx as n, jsxs as d, Fragment as pe } from "react/jsx-runtime";
|
|
5
5
|
import * as ae from "react";
|
|
6
|
-
import { useCallback as z, useMemo as ee, Suspense as wr, lazy as wn, useState as
|
|
7
|
-
import { useNavigate as
|
|
8
|
-
import { useQuery as Ve, useQueryClient as Fe, useMutation as Ee, useInfiniteQuery as Ms, QueryClient as
|
|
6
|
+
import { useCallback as z, useMemo as ee, Suspense as wr, lazy as wn, useState as I, useRef as me, useEffect as le, Component as Os } from "react";
|
|
7
|
+
import { useNavigate as Xe, useLocation as Dr, Outlet as Fs, useSearchParams as yt, Link as _n, useParams as Ls, BrowserRouter as qs, Routes as js, Route as Ie, Navigate as zs } from "react-router-dom";
|
|
8
|
+
import { useQuery as Ve, useQueryClient as Fe, useMutation as Ee, useInfiniteQuery as Ms, QueryClient as Us, QueryClientProvider as Is } from "@tanstack/react-query";
|
|
9
9
|
import { toast as ie, Toaster as Vs } from "sonner";
|
|
10
|
-
import { ChevronDown as Mt, ChevronRight as Pr, ChevronLeft as Sn, Check as Tt, Circle as Ks, ChevronsUpDown as Ws, LogOut as Hs, X as ze, ArrowLeft as Js, Copy as Qs, ChevronUp as Gs, ExternalLink as _r, Trash2 as Je, Plus as Oe, EyeOff as $r, Eye as Rr, Loader2 as sr, CheckCircle2 as Ys, AlertTriangle as kn, XCircle as
|
|
10
|
+
import { ChevronDown as Mt, ChevronRight as Pr, ChevronLeft as Sn, Check as Tt, Circle as Ks, ChevronsUpDown as Ws, LogOut as Hs, X as ze, ArrowLeft as Js, Copy as Qs, ChevronUp as Gs, ExternalLink as _r, Trash2 as Je, Plus as Oe, EyeOff as $r, Eye as Rr, Loader2 as sr, CheckCircle2 as Ys, AlertTriangle as kn, XCircle as Xs, Filter as Cn, Columns3 as Bs, RotateCcw as Tn, Save as Er, Star as Zs, Globe as ei, MoreHorizontal as ti, Pencil as Yt, Search as Or, ArrowUp as ri, ArrowDown as ni, ArrowUpDown as si, ArrowUpRight as ii, ArrowDownLeft as ai, Undo2 as An, GripVertical as oi } from "lucide-react";
|
|
11
11
|
import { clsx as li } from "clsx";
|
|
12
12
|
import { twMerge as ci } from "tailwind-merge";
|
|
13
13
|
import { create as Fr } from "zustand";
|
|
@@ -168,8 +168,8 @@ const wi = ["/login", "/signup"], ht = Fr((e, t) => ({
|
|
|
168
168
|
}));
|
|
169
169
|
}
|
|
170
170
|
}));
|
|
171
|
-
function
|
|
172
|
-
const e =
|
|
171
|
+
function Ut() {
|
|
172
|
+
const e = Xe(), { openTab: t, switchTab: r, findTabByPathname: s } = ht();
|
|
173
173
|
return z(
|
|
174
174
|
(a, l) => {
|
|
175
175
|
const c = s(a);
|
|
@@ -253,7 +253,7 @@ function ln(e) {
|
|
|
253
253
|
return t.length === 1 ? t[0] : t.join("|");
|
|
254
254
|
}
|
|
255
255
|
function Ti() {
|
|
256
|
-
const [e, t] =
|
|
256
|
+
const [e, t] = I(!1), [r, s] = I({}), i = Dr(), { data: a } = qe(), l = Ut(), c = (a == null ? void 0 : a.navigation) ?? [], o = a == null ? void 0 : a.branding, u = (o == null ? void 0 : o.app_name) || "Declarion", f = (o == null ? void 0 : o.app_initial) || u.charAt(0), m = (o == null ? void 0 : o.accent_color) || "#4f46e5";
|
|
257
257
|
function p(b) {
|
|
258
258
|
for (const w of b) {
|
|
259
259
|
if (w.screen) return w;
|
|
@@ -396,10 +396,10 @@ async function Di(e, t, r) {
|
|
|
396
396
|
display_name: r
|
|
397
397
|
});
|
|
398
398
|
}
|
|
399
|
-
async function
|
|
399
|
+
async function Un() {
|
|
400
400
|
return lt("auth.me");
|
|
401
401
|
}
|
|
402
|
-
async function
|
|
402
|
+
async function Xt() {
|
|
403
403
|
return (await lt("auth.list_tenants")).tenants;
|
|
404
404
|
}
|
|
405
405
|
async function Pi(e) {
|
|
@@ -430,10 +430,10 @@ const ct = Fr((e) => ({
|
|
|
430
430
|
tenants: [],
|
|
431
431
|
initialize: async () => {
|
|
432
432
|
try {
|
|
433
|
-
const t = await
|
|
433
|
+
const t = await Un(), r = t.tenant ?? null;
|
|
434
434
|
let s = [];
|
|
435
435
|
try {
|
|
436
|
-
s = await
|
|
436
|
+
s = await Xt();
|
|
437
437
|
} catch {
|
|
438
438
|
}
|
|
439
439
|
e({
|
|
@@ -484,10 +484,10 @@ function jr() {
|
|
|
484
484
|
setUser: a,
|
|
485
485
|
setTenants: l,
|
|
486
486
|
logout: c
|
|
487
|
-
} = ct(), o =
|
|
487
|
+
} = ct(), o = Xe(), u = Fe(), f = Ee({
|
|
488
488
|
mutationFn: ({ email: y, password: b }) => Ai(y, b),
|
|
489
489
|
onSuccess: (y) => {
|
|
490
|
-
a(y.user, y.tenant),
|
|
490
|
+
a(y.user, y.tenant), Xt().then(l).catch(() => {
|
|
491
491
|
}), o("/");
|
|
492
492
|
},
|
|
493
493
|
onError: (y) => {
|
|
@@ -500,7 +500,7 @@ function jr() {
|
|
|
500
500
|
displayName: w
|
|
501
501
|
}) => Di(y, b, w),
|
|
502
502
|
onSuccess: (y) => {
|
|
503
|
-
a(y.user, y.tenant),
|
|
503
|
+
a(y.user, y.tenant), Xt().then(l).catch(() => {
|
|
504
504
|
}), o("/");
|
|
505
505
|
},
|
|
506
506
|
onError: (y) => {
|
|
@@ -532,7 +532,7 @@ function jr() {
|
|
|
532
532
|
isSwitchingTenant: p.isPending
|
|
533
533
|
};
|
|
534
534
|
}
|
|
535
|
-
const
|
|
535
|
+
const In = ye.Root, Vn = ye.Trigger, Oi = ae.forwardRef(({ className: e, inset: t, children: r, ...s }, i) => /* @__PURE__ */ d(
|
|
536
536
|
ye.SubTrigger,
|
|
537
537
|
{
|
|
538
538
|
ref: i,
|
|
@@ -681,7 +681,7 @@ function zi() {
|
|
|
681
681
|
var o, u;
|
|
682
682
|
const e = ct((f) => f.user), { logout: t, activeTenant: r, tenants: s, switchTenant: i, isSwitchingTenant: a } = jr(), l = e != null && e.display_name ? e.display_name.split(" ").map((f) => f[0]).join("").toUpperCase().slice(0, 2) : ((u = (o = e == null ? void 0 : e.email) == null ? void 0 : o[0]) == null ? void 0 : u.toUpperCase()) ?? "U", c = s.length > 1;
|
|
683
683
|
return /* @__PURE__ */ d("header", { className: "flex items-center justify-between h-14 px-6 border-b border-[var(--border)] bg-[var(--background)]", children: [
|
|
684
|
-
/* @__PURE__ */ n("div", { className: "flex items-center gap-3", children: r && /* @__PURE__ */ d(
|
|
684
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-3", children: r && /* @__PURE__ */ d(In, { children: [
|
|
685
685
|
/* @__PURE__ */ n(Vn, { asChild: !0, children: /* @__PURE__ */ d(
|
|
686
686
|
j,
|
|
687
687
|
{
|
|
@@ -771,8 +771,8 @@ function Mi({
|
|
|
771
771
|
}
|
|
772
772
|
);
|
|
773
773
|
}
|
|
774
|
-
function
|
|
775
|
-
const e =
|
|
774
|
+
function Ui() {
|
|
775
|
+
const e = Xe(), { tabs: t, activeTabId: r, switchTab: s, closeTab: i, reorderTabs: a } = ht(), l = Dn(
|
|
776
776
|
Pn($n, { activationConstraint: { distance: 5 } })
|
|
777
777
|
), c = ee(() => t.map((p) => p.id), [t]), o = z(
|
|
778
778
|
(p, g, y) => {
|
|
@@ -830,7 +830,7 @@ function Ii() {
|
|
|
830
830
|
}
|
|
831
831
|
) });
|
|
832
832
|
}
|
|
833
|
-
async function*
|
|
833
|
+
async function* Ii(e) {
|
|
834
834
|
const t = await fetch("/api/events", { credentials: "include", signal: e });
|
|
835
835
|
if (!t.ok || !t.body)
|
|
836
836
|
throw new Error(`SSE connection failed: ${t.status}`);
|
|
@@ -871,10 +871,10 @@ async function* Ui(e) {
|
|
|
871
871
|
r.releaseLock();
|
|
872
872
|
}
|
|
873
873
|
}
|
|
874
|
-
const
|
|
875
|
-
function
|
|
874
|
+
const Be = "entity-children";
|
|
875
|
+
function It(e, t, r, s, i, a) {
|
|
876
876
|
return Ve({
|
|
877
|
-
queryKey: [
|
|
877
|
+
queryKey: [Be, e, t, r, i, a],
|
|
878
878
|
queryFn: () => {
|
|
879
879
|
const l = new URLSearchParams(), c = Array.isArray(s) ? s : [s], o = c.length > 1 ? t.split("|") : [t], u = c.map((f, m) => ({ field: f, op: "eq", value: o[m] }));
|
|
880
880
|
return l.set("filters", JSON.stringify(u)), i && l.set("sort", i), a && l.set("limit", String(a)), ue(
|
|
@@ -896,7 +896,7 @@ function cn(e, t) {
|
|
|
896
896
|
e.invalidateQueries({ queryKey: ["entity-data", s] }), e.invalidateQueries({
|
|
897
897
|
predicate: (a) => {
|
|
898
898
|
const l = a.queryKey;
|
|
899
|
-
return l[0] ===
|
|
899
|
+
return l[0] === Be && l[3] === s;
|
|
900
900
|
}
|
|
901
901
|
}), i.mutated && e.invalidateQueries({ queryKey: ["entity-item", s] });
|
|
902
902
|
}
|
|
@@ -919,7 +919,7 @@ function Hi() {
|
|
|
919
919
|
const f = new AbortController();
|
|
920
920
|
r.current = f;
|
|
921
921
|
try {
|
|
922
|
-
for await (const m of
|
|
922
|
+
for await (const m of Ii(f.signal)) {
|
|
923
923
|
if (!s) break;
|
|
924
924
|
if (i = 0, m.type === "session_refresh") {
|
|
925
925
|
try {
|
|
@@ -946,7 +946,7 @@ function Hi() {
|
|
|
946
946
|
}, [e, t]);
|
|
947
947
|
}
|
|
948
948
|
function Ji() {
|
|
949
|
-
const { isAuthenticated: e, isLoading: t } = ct(), r =
|
|
949
|
+
const { isAuthenticated: e, isLoading: t } = ct(), r = Xe(), s = Dr();
|
|
950
950
|
return Hi(), le(() => {
|
|
951
951
|
if (!t && !e) {
|
|
952
952
|
const i = s.pathname + s.search, a = i && i !== "/" ? `?redirect=${encodeURIComponent(i)}` : "";
|
|
@@ -957,7 +957,7 @@ function Ji() {
|
|
|
957
957
|
/* @__PURE__ */ d("div", { className: "flex flex-col flex-1 overflow-hidden", children: [
|
|
958
958
|
/* @__PURE__ */ n(zi, {}),
|
|
959
959
|
/* @__PURE__ */ n("main", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ n(Fs, {}) }),
|
|
960
|
-
/* @__PURE__ */ n(
|
|
960
|
+
/* @__PURE__ */ n(Ui, {})
|
|
961
961
|
] })
|
|
962
962
|
] }) : null;
|
|
963
963
|
}
|
|
@@ -1015,7 +1015,7 @@ const Vt = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
|
1015
1015
|
}
|
|
1016
1016
|
));
|
|
1017
1017
|
Vt.displayName = "CardTitle";
|
|
1018
|
-
const
|
|
1018
|
+
const Ur = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
1019
1019
|
"div",
|
|
1020
1020
|
{
|
|
1021
1021
|
ref: r,
|
|
@@ -1023,7 +1023,7 @@ const Ir = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
|
1023
1023
|
...t
|
|
1024
1024
|
}
|
|
1025
1025
|
));
|
|
1026
|
-
|
|
1026
|
+
Ur.displayName = "CardDescription";
|
|
1027
1027
|
const Nt = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n("div", { ref: r, className: J("p-6 pt-0", e), ...t }));
|
|
1028
1028
|
Nt.displayName = "CardContent";
|
|
1029
1029
|
const Gi = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
@@ -1036,7 +1036,7 @@ const Gi = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
|
1036
1036
|
));
|
|
1037
1037
|
Gi.displayName = "CardFooter";
|
|
1038
1038
|
function Yi() {
|
|
1039
|
-
const e =
|
|
1039
|
+
const e = Xe(), [t] = yt(), { login: r, isLoginPending: s, isAuthenticated: i } = jr(), [a, l] = I(""), [c, o] = I(""), u = t.get("redirect") || "/", f = u.startsWith("/") && !u.startsWith("//") ? u : "/", m = t.get("sso_error"), { data: p } = Ve({
|
|
1040
1040
|
queryKey: ["check-setup"],
|
|
1041
1041
|
queryFn: Mn
|
|
1042
1042
|
}), { data: g } = Ve({
|
|
@@ -1059,7 +1059,7 @@ function Yi() {
|
|
|
1059
1059
|
/* @__PURE__ */ d(bt, { className: "text-center", children: [
|
|
1060
1060
|
/* @__PURE__ */ n("div", { className: "mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-[var(--primary)]", children: /* @__PURE__ */ n("span", { className: "text-lg font-bold text-[var(--primary-foreground)]", children: "D" }) }),
|
|
1061
1061
|
/* @__PURE__ */ n(Vt, { className: "text-2xl", children: "Sign in" }),
|
|
1062
|
-
/* @__PURE__ */ n(
|
|
1062
|
+
/* @__PURE__ */ n(Ur, { children: "Enter your credentials to continue" })
|
|
1063
1063
|
] }),
|
|
1064
1064
|
/* @__PURE__ */ d(Nt, { children: [
|
|
1065
1065
|
b && /* @__PURE__ */ d("div", { className: "space-y-2 mb-4", children: [
|
|
@@ -1121,8 +1121,8 @@ function Yi() {
|
|
|
1121
1121
|
] })
|
|
1122
1122
|
] }) });
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1125
|
-
const e =
|
|
1124
|
+
function Xi() {
|
|
1125
|
+
const e = Xe(), { signup: t, isSignupPending: r, isAuthenticated: s } = jr(), [i, a] = I(""), [l, c] = I(""), [o, u] = I(""), { data: f } = Ve({
|
|
1126
1126
|
queryKey: ["check-setup"],
|
|
1127
1127
|
queryFn: Mn
|
|
1128
1128
|
});
|
|
@@ -1138,7 +1138,7 @@ function Bi() {
|
|
|
1138
1138
|
/* @__PURE__ */ d(bt, { className: "text-center", children: [
|
|
1139
1139
|
/* @__PURE__ */ n("div", { className: "mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-[var(--primary)]", children: /* @__PURE__ */ n("span", { className: "text-lg font-bold text-[var(--primary-foreground)]", children: "D" }) }),
|
|
1140
1140
|
/* @__PURE__ */ n(Vt, { className: "text-2xl", children: "Create account" }),
|
|
1141
|
-
/* @__PURE__ */ n(
|
|
1141
|
+
/* @__PURE__ */ n(Ur, { children: "Set up the first admin account" })
|
|
1142
1142
|
] }),
|
|
1143
1143
|
/* @__PURE__ */ n(Nt, { children: /* @__PURE__ */ d("form", { onSubmit: m, className: "space-y-4", children: [
|
|
1144
1144
|
/* @__PURE__ */ d("div", { className: "space-y-2", children: [
|
|
@@ -1189,12 +1189,12 @@ function Bi() {
|
|
|
1189
1189
|
] }) })
|
|
1190
1190
|
] }) });
|
|
1191
1191
|
}
|
|
1192
|
-
function
|
|
1193
|
-
const e =
|
|
1192
|
+
function Bi() {
|
|
1193
|
+
const e = Xe(), [t] = yt(), { setUser: r, setTenants: s } = ct();
|
|
1194
1194
|
return le(() => {
|
|
1195
1195
|
const i = t.get("redirect") || "/", a = i.startsWith("/") && !i.startsWith("//") ? i : "/";
|
|
1196
|
-
|
|
1197
|
-
r(l, l.tenant),
|
|
1196
|
+
Un().then((l) => {
|
|
1197
|
+
r(l, l.tenant), Xt().then(s).catch(() => {
|
|
1198
1198
|
}), e(a, { replace: !0 });
|
|
1199
1199
|
}).catch(() => {
|
|
1200
1200
|
e("/login?sso_error=authentication+failed", { replace: !0 });
|
|
@@ -1208,8 +1208,8 @@ function Zi() {
|
|
|
1208
1208
|
/* @__PURE__ */ n(j, { asChild: !0, variant: "outline", className: "mt-6", children: /* @__PURE__ */ n(_n, { to: "/", children: "Go home" }) })
|
|
1209
1209
|
] }) });
|
|
1210
1210
|
}
|
|
1211
|
-
function
|
|
1212
|
-
const s =
|
|
1211
|
+
function Bt({ title: e, backTo: t, actions: r }) {
|
|
1212
|
+
const s = Xe(), { switchTab: i, findTabByPathname: a } = ht();
|
|
1213
1213
|
function l() {
|
|
1214
1214
|
if (!t) return;
|
|
1215
1215
|
const c = a(t);
|
|
@@ -1264,10 +1264,10 @@ function ke({ className: e, variant: t, color: r, style: s, ...i }) {
|
|
|
1264
1264
|
);
|
|
1265
1265
|
}
|
|
1266
1266
|
function ta() {
|
|
1267
|
-
const { data: e } = qe(), [t, r] =
|
|
1267
|
+
const { data: e } = qe(), [t, r] = I("handlers");
|
|
1268
1268
|
return e ? /* @__PURE__ */ d("div", { className: "flex flex-col h-full", children: [
|
|
1269
1269
|
/* @__PURE__ */ d("div", { className: "px-6 pt-6", children: [
|
|
1270
|
-
/* @__PURE__ */ n(
|
|
1270
|
+
/* @__PURE__ */ n(Bt, { title: "Handler & Action Catalog" }),
|
|
1271
1271
|
/* @__PURE__ */ d("div", { className: "flex gap-2 mb-4", children: [
|
|
1272
1272
|
/* @__PURE__ */ n(
|
|
1273
1273
|
j,
|
|
@@ -1317,7 +1317,7 @@ function ra({ schema: e }) {
|
|
|
1317
1317
|
}
|
|
1318
1318
|
function na({ code: e, handler: t, entity: r }) {
|
|
1319
1319
|
var l, c;
|
|
1320
|
-
const [s, i] =
|
|
1320
|
+
const [s, i] = I(!1), a = (l = t.display) != null && l.name ? P(t.display.name) : e;
|
|
1321
1321
|
return /* @__PURE__ */ d("div", { className: "border border-[var(--border)] rounded-lg p-4", children: [
|
|
1322
1322
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-between cursor-pointer", onClick: () => i(!s), children: [
|
|
1323
1323
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-3", children: [
|
|
@@ -1431,7 +1431,7 @@ async function la(e, t) {
|
|
|
1431
1431
|
r.set(s, i);
|
|
1432
1432
|
return ue(`/api/data/${e}?${r.toString()}`);
|
|
1433
1433
|
}
|
|
1434
|
-
async function
|
|
1434
|
+
async function Ir(e, t) {
|
|
1435
1435
|
return { data: (await ue(`/api/data/${e}`, {
|
|
1436
1436
|
method: "POST",
|
|
1437
1437
|
body: JSON.stringify([t])
|
|
@@ -1488,7 +1488,7 @@ function Kt(e, t) {
|
|
|
1488
1488
|
function ua(e) {
|
|
1489
1489
|
const t = Fe();
|
|
1490
1490
|
return Ee({
|
|
1491
|
-
mutationFn: (r) =>
|
|
1491
|
+
mutationFn: (r) => Ir(e, r),
|
|
1492
1492
|
onSuccess: () => {
|
|
1493
1493
|
t.invalidateQueries({ queryKey: ["entity-data", e] }), ie.success("Record created");
|
|
1494
1494
|
},
|
|
@@ -1502,7 +1502,7 @@ function Hn(e) {
|
|
|
1502
1502
|
return Ee({
|
|
1503
1503
|
mutationFn: ({ pkValues: r, data: s }) => Vr(e, r, s),
|
|
1504
1504
|
onSuccess: (r, s) => {
|
|
1505
|
-
t.invalidateQueries({ queryKey: ["entity-data", e] }), t.invalidateQueries({ queryKey: ["entity-item", e] }), t.invalidateQueries({ queryKey: [
|
|
1505
|
+
t.invalidateQueries({ queryKey: ["entity-data", e] }), t.invalidateQueries({ queryKey: ["entity-item", e] }), t.invalidateQueries({ queryKey: [Be, e] }), t.invalidateQueries({ queryKey: ["object-status", e] }), t.invalidateQueries({ queryKey: ["object-properties", e] }), ie.success("Record updated");
|
|
1506
1506
|
},
|
|
1507
1507
|
onError: (r) => {
|
|
1508
1508
|
ie.error(r.message);
|
|
@@ -1543,7 +1543,7 @@ function Qn(e) {
|
|
|
1543
1543
|
return i;
|
|
1544
1544
|
},
|
|
1545
1545
|
onSuccess: (r) => {
|
|
1546
|
-
e && (t.invalidateQueries({ queryKey: ["entity-data", e] }), t.invalidateQueries({ queryKey: ["entity-item", e] }), t.invalidateQueries({ queryKey: [
|
|
1546
|
+
e && (t.invalidateQueries({ queryKey: ["entity-data", e] }), t.invalidateQueries({ queryKey: ["entity-item", e] }), t.invalidateQueries({ queryKey: [Be, e] }), t.invalidateQueries({ queryKey: ["object-status", e] }), t.invalidateQueries({ queryKey: ["object-properties", e] })), r.status === "accepted" ? ie.success("Action started - check audit for progress") : r.status === "partial" ? ie.warning("Action partially completed - some items failed or were skipped") : ie.success("Action executed");
|
|
1547
1547
|
},
|
|
1548
1548
|
onError: (r) => {
|
|
1549
1549
|
ie.error(r.message);
|
|
@@ -1551,14 +1551,14 @@ function Qn(e) {
|
|
|
1551
1551
|
});
|
|
1552
1552
|
}
|
|
1553
1553
|
function Gn(e, t) {
|
|
1554
|
-
const [r, s] =
|
|
1554
|
+
const [r, s] = I(e);
|
|
1555
1555
|
return le(() => {
|
|
1556
1556
|
const i = setTimeout(() => s(e), t);
|
|
1557
1557
|
return () => clearTimeout(i);
|
|
1558
1558
|
}, [e, t]), r;
|
|
1559
1559
|
}
|
|
1560
1560
|
function Hr({ value: e, title: t, className: r, size: s = "icon" }) {
|
|
1561
|
-
const [i, a] =
|
|
1561
|
+
const [i, a] = I(!1), l = z(async (u) => {
|
|
1562
1562
|
u.stopPropagation(), u.preventDefault();
|
|
1563
1563
|
try {
|
|
1564
1564
|
await navigator.clipboard.writeText(e), a(!0), setTimeout(() => a(!1), 2e3);
|
|
@@ -1659,7 +1659,7 @@ const Yn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
|
1659
1659
|
}
|
|
1660
1660
|
));
|
|
1661
1661
|
Yn.displayName = ve.ScrollUpButton.displayName;
|
|
1662
|
-
const
|
|
1662
|
+
const Xn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
1663
1663
|
ve.ScrollDownButton,
|
|
1664
1664
|
{
|
|
1665
1665
|
ref: r,
|
|
@@ -1671,7 +1671,7 @@ const Bn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
|
1671
1671
|
children: /* @__PURE__ */ n(Mt, { className: "h-4 w-4" })
|
|
1672
1672
|
}
|
|
1673
1673
|
));
|
|
1674
|
-
|
|
1674
|
+
Xn.displayName = ve.ScrollDownButton.displayName;
|
|
1675
1675
|
const ot = ae.forwardRef(({ className: e, children: t, position: r = "popper", ...s }, i) => /* @__PURE__ */ n(ve.Portal, { children: /* @__PURE__ */ d(
|
|
1676
1676
|
ve.Content,
|
|
1677
1677
|
{
|
|
@@ -1695,12 +1695,12 @@ const ot = ae.forwardRef(({ className: e, children: t, position: r = "popper", .
|
|
|
1695
1695
|
children: t
|
|
1696
1696
|
}
|
|
1697
1697
|
),
|
|
1698
|
-
/* @__PURE__ */ n(
|
|
1698
|
+
/* @__PURE__ */ n(Xn, {})
|
|
1699
1699
|
]
|
|
1700
1700
|
}
|
|
1701
1701
|
) }));
|
|
1702
1702
|
ot.displayName = ve.Content.displayName;
|
|
1703
|
-
const
|
|
1703
|
+
const Ue = ae.forwardRef(({ className: e, children: t, ...r }, s) => /* @__PURE__ */ d(
|
|
1704
1704
|
ve.Item,
|
|
1705
1705
|
{
|
|
1706
1706
|
ref: s,
|
|
@@ -1715,7 +1715,7 @@ const Ie = ae.forwardRef(({ className: e, children: t, ...r }, s) => /* @__PURE_
|
|
|
1715
1715
|
]
|
|
1716
1716
|
}
|
|
1717
1717
|
));
|
|
1718
|
-
|
|
1718
|
+
Ue.displayName = ve.Item.displayName;
|
|
1719
1719
|
const ha = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
1720
1720
|
ve.Label,
|
|
1721
1721
|
{
|
|
@@ -1748,8 +1748,8 @@ function va({ field: e, value: t, mode: r, onChange: s }) {
|
|
|
1748
1748
|
children: [
|
|
1749
1749
|
/* @__PURE__ */ n(at, { children: /* @__PURE__ */ n(vt, { placeholder: "Select..." }) }),
|
|
1750
1750
|
/* @__PURE__ */ d(ot, { children: [
|
|
1751
|
-
l && /* @__PURE__ */ n(
|
|
1752
|
-
i.map((o) => /* @__PURE__ */ n(
|
|
1751
|
+
l && /* @__PURE__ */ n(Ue, { value: fr, children: /* @__PURE__ */ n("span", { className: "text-[var(--muted-foreground)]", children: "— None —" }) }),
|
|
1752
|
+
i.map((o) => /* @__PURE__ */ n(Ue, { value: o.code, children: P(o.name) }, o.code))
|
|
1753
1753
|
] })
|
|
1754
1754
|
]
|
|
1755
1755
|
}
|
|
@@ -1814,7 +1814,7 @@ function Ca(e) {
|
|
|
1814
1814
|
}
|
|
1815
1815
|
function Ta({ field: e, value: t, mode: r, onChange: s }) {
|
|
1816
1816
|
var c;
|
|
1817
|
-
const i = String(t ?? ""), [a, l] =
|
|
1817
|
+
const i = String(t ?? ""), [a, l] = I(null);
|
|
1818
1818
|
if (r === "display") {
|
|
1819
1819
|
if (!i) return /* @__PURE__ */ n("span", { className: "text-sm text-[var(--muted-foreground)]", children: "-" });
|
|
1820
1820
|
const u = ((c = e.display) == null ? void 0 : c.widget) === "link", f = Sa(i);
|
|
@@ -2043,7 +2043,7 @@ function pr({ field: e, fieldName: t, value: r, mode: s, onChange: i, record: a
|
|
|
2043
2043
|
}
|
|
2044
2044
|
);
|
|
2045
2045
|
}
|
|
2046
|
-
function
|
|
2046
|
+
function Bn(e) {
|
|
2047
2047
|
const { data: t } = qe();
|
|
2048
2048
|
if (!(!t || !e))
|
|
2049
2049
|
return t.entities[e];
|
|
@@ -2064,7 +2064,7 @@ function Oa({
|
|
|
2064
2064
|
refs: i
|
|
2065
2065
|
}) {
|
|
2066
2066
|
var b, w, x, N, h;
|
|
2067
|
-
const a = (b = e.ref) == null ? void 0 : b.entity, l =
|
|
2067
|
+
const a = (b = e.ref) == null ? void 0 : b.entity, l = Bn(a), c = ((w = e.display) == null ? void 0 : w.ref_display_field) ?? ((N = (x = e.ref) == null ? void 0 : x.display) == null ? void 0 : N.field) ?? ((h = l == null ? void 0 : l.display) == null ? void 0 : h.display_field), o = ee(
|
|
2068
2068
|
() => {
|
|
2069
2069
|
var v;
|
|
2070
2070
|
return l ? ((v = Object.entries(l.fields).find(([, k]) => k.primary)) == null ? void 0 : v[0]) ?? "id" : "id";
|
|
@@ -2079,13 +2079,13 @@ function Oa({
|
|
|
2079
2079
|
if (i && a) {
|
|
2080
2080
|
const k = i[a];
|
|
2081
2081
|
if (k) {
|
|
2082
|
-
const
|
|
2083
|
-
if (
|
|
2084
|
-
return c ? hr(
|
|
2082
|
+
const A = k[v];
|
|
2083
|
+
if (A)
|
|
2084
|
+
return c ? hr(A[c]) : v;
|
|
2085
2085
|
}
|
|
2086
2086
|
}
|
|
2087
2087
|
if (c && m.length > 0) {
|
|
2088
|
-
const k = m.find((
|
|
2088
|
+
const k = m.find((A) => String(A[o]) === v);
|
|
2089
2089
|
if (k) return hr(k[c] ?? t);
|
|
2090
2090
|
}
|
|
2091
2091
|
return v;
|
|
@@ -2105,8 +2105,8 @@ function Oa({
|
|
|
2105
2105
|
f && g && /* @__PURE__ */ n("option", { value: g, children: p }),
|
|
2106
2106
|
!f && g && !y && /* @__PURE__ */ n("option", { value: g, children: p }),
|
|
2107
2107
|
m.map((v) => {
|
|
2108
|
-
const k = String(v[o]),
|
|
2109
|
-
return /* @__PURE__ */ n("option", { value: k, children:
|
|
2108
|
+
const k = String(v[o]), A = c ? hr(v[c] ?? k) : k;
|
|
2109
|
+
return /* @__PURE__ */ n("option", { value: k, children: A }, k);
|
|
2110
2110
|
})
|
|
2111
2111
|
]
|
|
2112
2112
|
}
|
|
@@ -2335,7 +2335,7 @@ function za({
|
|
|
2335
2335
|
}
|
|
2336
2336
|
const gr = "[SET]";
|
|
2337
2337
|
function Ma({ value: e, mode: t, onChange: r, record: s }) {
|
|
2338
|
-
const [i, a] =
|
|
2338
|
+
const [i, a] = I(!1), [l, c] = I(""), o = s !== void 0, u = e === gr || typeof e == "string" && e !== "";
|
|
2339
2339
|
if (t === "display")
|
|
2340
2340
|
return u ? /* @__PURE__ */ n("span", { className: "text-sm font-mono text-[var(--muted-foreground)]", children: gr }) : /* @__PURE__ */ n("span", { className: "text-sm text-[var(--muted-foreground)] italic", children: "Not set" });
|
|
2341
2341
|
const f = (m) => {
|
|
@@ -2368,8 +2368,8 @@ function Ma({ value: e, mode: t, onChange: r, record: s }) {
|
|
|
2368
2368
|
] });
|
|
2369
2369
|
}
|
|
2370
2370
|
const vr = "[SET]";
|
|
2371
|
-
function
|
|
2372
|
-
const [i, a] =
|
|
2371
|
+
function Ua({ value: e, mode: t, onChange: r, record: s }) {
|
|
2372
|
+
const [i, a] = I(""), [l, c] = I(!1), o = s !== void 0, u = e === vr || typeof e == "string" && e !== "";
|
|
2373
2373
|
if (t === "display")
|
|
2374
2374
|
return u ? /* @__PURE__ */ n("span", { className: "text-sm font-mono text-[var(--muted-foreground)]", children: vr }) : /* @__PURE__ */ n("span", { className: "text-sm text-[var(--muted-foreground)] italic", children: "Not set" });
|
|
2375
2375
|
const f = (m) => {
|
|
@@ -2400,11 +2400,11 @@ function Ia({ value: e, mode: t, onChange: r, record: s }) {
|
|
|
2400
2400
|
)
|
|
2401
2401
|
] });
|
|
2402
2402
|
}
|
|
2403
|
-
function
|
|
2403
|
+
function Ia(e) {
|
|
2404
2404
|
return Array.isArray(e) ? e.filter((t) => t != null).map(String) : [];
|
|
2405
2405
|
}
|
|
2406
2406
|
function Va({ value: e, mode: t, onChange: r }) {
|
|
2407
|
-
const s =
|
|
2407
|
+
const s = Ia(e), [i, a] = I("");
|
|
2408
2408
|
if (t === "display")
|
|
2409
2409
|
return s.length === 0 ? /* @__PURE__ */ n("span", { className: "text-sm text-muted-foreground", children: "-" }) : /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-1", children: s.map((u, f) => /* @__PURE__ */ n(
|
|
2410
2410
|
"span",
|
|
@@ -2461,7 +2461,7 @@ function Ka(e) {
|
|
|
2461
2461
|
return Array.isArray(e) ? e.filter((t) => t != null).map(Number).filter((t) => !isNaN(t)) : [];
|
|
2462
2462
|
}
|
|
2463
2463
|
function Wa({ value: e, mode: t, onChange: r }) {
|
|
2464
|
-
const s = Ka(e), [i, a] =
|
|
2464
|
+
const s = Ka(e), [i, a] = I("");
|
|
2465
2465
|
if (t === "display")
|
|
2466
2466
|
return s.length === 0 ? /* @__PURE__ */ n("span", { className: "text-sm text-muted-foreground", children: "-" }) : /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-1", children: s.map((u, f) => /* @__PURE__ */ n(
|
|
2467
2467
|
"span",
|
|
@@ -2541,7 +2541,7 @@ const yr = {
|
|
|
2541
2541
|
multilang_text: ja,
|
|
2542
2542
|
structure: Zt,
|
|
2543
2543
|
secret: Ma,
|
|
2544
|
-
password:
|
|
2544
|
+
password: Ua
|
|
2545
2545
|
};
|
|
2546
2546
|
function oe(e) {
|
|
2547
2547
|
var s;
|
|
@@ -2668,7 +2668,7 @@ const Yr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
|
2668
2668
|
}
|
|
2669
2669
|
));
|
|
2670
2670
|
Yr.displayName = Le.Description.displayName;
|
|
2671
|
-
const
|
|
2671
|
+
const Xr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
2672
2672
|
Le.Action,
|
|
2673
2673
|
{
|
|
2674
2674
|
ref: r,
|
|
@@ -2676,8 +2676,8 @@ const Br = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
|
2676
2676
|
...t
|
|
2677
2677
|
}
|
|
2678
2678
|
));
|
|
2679
|
-
|
|
2680
|
-
const
|
|
2679
|
+
Xr.displayName = Le.Action.displayName;
|
|
2680
|
+
const Br = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
2681
2681
|
Le.Cancel,
|
|
2682
2682
|
{
|
|
2683
2683
|
ref: r,
|
|
@@ -2689,7 +2689,7 @@ const Xr = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
|
2689
2689
|
...t
|
|
2690
2690
|
}
|
|
2691
2691
|
));
|
|
2692
|
-
|
|
2692
|
+
Br.displayName = Le.Cancel.displayName;
|
|
2693
2693
|
function Zr({
|
|
2694
2694
|
open: e,
|
|
2695
2695
|
onOpenChange: t,
|
|
@@ -2705,9 +2705,9 @@ function Zr({
|
|
|
2705
2705
|
/* @__PURE__ */ n(Yr, { children: s })
|
|
2706
2706
|
] }),
|
|
2707
2707
|
/* @__PURE__ */ d(ss, { children: [
|
|
2708
|
-
/* @__PURE__ */ n(
|
|
2708
|
+
/* @__PURE__ */ n(Br, { children: "Cancel" }),
|
|
2709
2709
|
/* @__PURE__ */ n(
|
|
2710
|
-
|
|
2710
|
+
Xr,
|
|
2711
2711
|
{
|
|
2712
2712
|
onClick: a,
|
|
2713
2713
|
className: l ? "bg-[var(--destructive)] text-[var(--destructive-foreground)] hover:bg-[var(--destructive)]/90" : "",
|
|
@@ -2814,7 +2814,7 @@ function Ya(e, t) {
|
|
|
2814
2814
|
`ActionDialog: prefill template ${e} could not be resolved; row missing or has no field '${s}'`
|
|
2815
2815
|
), "");
|
|
2816
2816
|
}
|
|
2817
|
-
function
|
|
2817
|
+
function Xa(e) {
|
|
2818
2818
|
return {
|
|
2819
2819
|
type: e.type ?? "string",
|
|
2820
2820
|
required: e.required,
|
|
@@ -2844,7 +2844,7 @@ function cs({
|
|
|
2844
2844
|
for (const [w, x] of o)
|
|
2845
2845
|
b[w] = Ya(x.default, l);
|
|
2846
2846
|
return b;
|
|
2847
|
-
}, [o, l]), [f, m] =
|
|
2847
|
+
}, [o, l]), [f, m] = I(
|
|
2848
2848
|
u
|
|
2849
2849
|
), p = z(
|
|
2850
2850
|
(b) => {
|
|
@@ -2869,7 +2869,7 @@ function cs({
|
|
|
2869
2869
|
] }),
|
|
2870
2870
|
/* @__PURE__ */ n("div", { className: "space-y-4 py-2", children: o.map(([b, w]) => {
|
|
2871
2871
|
var h, v;
|
|
2872
|
-
const x =
|
|
2872
|
+
const x = Xa(w), N = P((h = w.display) == null ? void 0 : h.name) || b;
|
|
2873
2873
|
return /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
|
|
2874
2874
|
/* @__PURE__ */ d(Qe, { children: [
|
|
2875
2875
|
N,
|
|
@@ -2905,12 +2905,12 @@ function ds({
|
|
|
2905
2905
|
/* @__PURE__ */ n(Yr, { children: s })
|
|
2906
2906
|
] }),
|
|
2907
2907
|
/* @__PURE__ */ d(ss, { children: [
|
|
2908
|
-
/* @__PURE__ */ n(
|
|
2909
|
-
/* @__PURE__ */ n(
|
|
2908
|
+
/* @__PURE__ */ n(Br, { disabled: a, children: "Cancel" }),
|
|
2909
|
+
/* @__PURE__ */ n(Xr, { onClick: i, disabled: a, children: a ? "Executing..." : "Confirm" })
|
|
2910
2910
|
] })
|
|
2911
2911
|
] }) });
|
|
2912
2912
|
}
|
|
2913
|
-
function
|
|
2913
|
+
function Ba({ open: e, onClose: t, display: r }) {
|
|
2914
2914
|
return /* @__PURE__ */ n(is, { open: e, onOpenChange: (s) => {
|
|
2915
2915
|
s || t();
|
|
2916
2916
|
}, children: /* @__PURE__ */ d(en, { className: "max-w-lg", onInteractOutside: (s) => s.preventDefault(), onEscapeKeyDown: (s) => s.preventDefault(), children: [
|
|
@@ -2979,20 +2979,11 @@ function mn(e, t, r) {
|
|
|
2979
2979
|
return !1;
|
|
2980
2980
|
}
|
|
2981
2981
|
}
|
|
2982
|
-
const ro = {
|
|
2983
|
-
detail: ["detail"],
|
|
2984
|
-
list_row: ["list_row", "row"],
|
|
2985
|
-
list_toolbar: ["list_toolbar", "toolbar"],
|
|
2986
|
-
global: ["global", "toolbar"]
|
|
2987
|
-
// legacy "toolbar" was overloaded for global too
|
|
2988
|
-
};
|
|
2989
2982
|
function us(e, t) {
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
return (i = s.visibility) == null ? void 0 : i.some((a) => r.includes(a));
|
|
2995
|
-
}).map(([s, i]) => ({ code: s, action: i }));
|
|
2983
|
+
return e ? Object.entries(e).filter(([, r]) => {
|
|
2984
|
+
var s;
|
|
2985
|
+
return (s = r.visibility) == null ? void 0 : s.includes(t);
|
|
2986
|
+
}).map(([r, s]) => ({ code: r, action: s })) : [];
|
|
2996
2987
|
}
|
|
2997
2988
|
function kr(e, t, r, s) {
|
|
2998
2989
|
return !e && !s ? [] : t !== void 0 ? t.map((i) => {
|
|
@@ -3021,7 +3012,7 @@ function er(e, t) {
|
|
|
3021
3012
|
}
|
|
3022
3013
|
}
|
|
3023
3014
|
const Gt = /* @__PURE__ */ new Map();
|
|
3024
|
-
function
|
|
3015
|
+
function ro(e, t) {
|
|
3025
3016
|
return Gt.set(e, t), () => {
|
|
3026
3017
|
Gt.get(e) === t && Gt.delete(e);
|
|
3027
3018
|
};
|
|
@@ -3031,11 +3022,11 @@ function Cr(e) {
|
|
|
3031
3022
|
}
|
|
3032
3023
|
function xr(e, t) {
|
|
3033
3024
|
return e.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (r, s) => {
|
|
3034
|
-
const i =
|
|
3025
|
+
const i = no(s, t);
|
|
3035
3026
|
return i == null ? "" : String(i);
|
|
3036
3027
|
});
|
|
3037
3028
|
}
|
|
3038
|
-
function
|
|
3029
|
+
function no(e, t) {
|
|
3039
3030
|
const r = e.split(".");
|
|
3040
3031
|
if (r.length < 2) return;
|
|
3041
3032
|
const [s, ...i] = r;
|
|
@@ -3048,17 +3039,17 @@ function so(e, t) {
|
|
|
3048
3039
|
return c == null ? void 0 : c.getField(l);
|
|
3049
3040
|
}
|
|
3050
3041
|
}
|
|
3051
|
-
async function
|
|
3042
|
+
async function so(e, t) {
|
|
3052
3043
|
for (const r of e)
|
|
3053
3044
|
try {
|
|
3054
|
-
await
|
|
3045
|
+
await io(r, t);
|
|
3055
3046
|
} catch (s) {
|
|
3056
3047
|
const i = s instanceof Error ? s.message : String(s);
|
|
3057
3048
|
ie.error(`ui_step failed: ${i}`);
|
|
3058
3049
|
return;
|
|
3059
3050
|
}
|
|
3060
3051
|
}
|
|
3061
|
-
async function
|
|
3052
|
+
async function io(e, t) {
|
|
3062
3053
|
if (e.copy_to_clipboard != null) {
|
|
3063
3054
|
const r = xr(e.copy_to_clipboard, t);
|
|
3064
3055
|
await navigator.clipboard.writeText(r);
|
|
@@ -3087,7 +3078,7 @@ function pn(e) {
|
|
|
3087
3078
|
if (t <= 0) throw new Error(`invalid path "${e}" (expected "region.field")`);
|
|
3088
3079
|
return { region: e.slice(0, t), field: e.slice(t + 1) };
|
|
3089
3080
|
}
|
|
3090
|
-
function
|
|
3081
|
+
function ao(e) {
|
|
3091
3082
|
return !e.handler && !!e.ui_steps && e.ui_steps.length > 0;
|
|
3092
3083
|
}
|
|
3093
3084
|
function nn({
|
|
@@ -3104,7 +3095,7 @@ function nn({
|
|
|
3104
3095
|
onBatchPartial: f
|
|
3105
3096
|
}) {
|
|
3106
3097
|
var V, Q;
|
|
3107
|
-
const [m, p] =
|
|
3098
|
+
const [m, p] = I(!1), [g, y] = I(!1), [b, w] = I(!1), [x, N] = I(null), h = Qn(r), { data: v } = qe(), k = Ut(), A = ms(t), _ = fs(t), T = !!t.confirmation && Object.keys(t.confirmation).length > 0, $ = i ? pt(t.conditions, i) : !0, F = t.scope === "batch" && s.length === 0, M = t.scope === "single" && s.length !== 1, q = z(async () => {
|
|
3108
3099
|
var Z, fe, Te;
|
|
3109
3100
|
if (!(!t.association || s.length === 0)) {
|
|
3110
3101
|
w(!0);
|
|
@@ -3114,14 +3105,14 @@ function nn({
|
|
|
3114
3105
|
ie.error(`No list screen found for ${be.target_entity}`);
|
|
3115
3106
|
return;
|
|
3116
3107
|
}
|
|
3117
|
-
const
|
|
3108
|
+
const X = v == null ? void 0 : v.entities[be.target_entity], dt = P((Z = t.display) == null ? void 0 : Z.name) || be.target_entity;
|
|
3118
3109
|
if (be.ids.length === 0) {
|
|
3119
3110
|
ie.info(`No related ${dt} found`);
|
|
3120
3111
|
return;
|
|
3121
3112
|
}
|
|
3122
|
-
const Ze = ((fe =
|
|
3113
|
+
const Ze = ((fe = X == null ? void 0 : X.field_order) == null ? void 0 : fe.find((Se) => {
|
|
3123
3114
|
var ut;
|
|
3124
|
-
return (ut =
|
|
3115
|
+
return (ut = X.fields[Se]) == null ? void 0 : ut.primary;
|
|
3125
3116
|
})) ?? "id", Ye = new URLSearchParams();
|
|
3126
3117
|
Ye.set(`filter_${Ze}`, be.ids.join(",")), k(je.route, {
|
|
3127
3118
|
title: dt,
|
|
@@ -3134,7 +3125,7 @@ function nn({
|
|
|
3134
3125
|
w(!1);
|
|
3135
3126
|
}
|
|
3136
3127
|
}
|
|
3137
|
-
}, [t, r, s, v, k, c]), E = t.entity ? `${t.entity}.${e}` : e,
|
|
3128
|
+
}, [t, r, s, v, k, c]), E = t.entity ? `${t.entity}.${e}` : e, U = s.length > 0 ? s : void 0, B = z(
|
|
3138
3129
|
(Z, fe) => {
|
|
3139
3130
|
var Ne;
|
|
3140
3131
|
if (fe == null || fe(), Z.status === "accepted") {
|
|
@@ -3150,40 +3141,40 @@ function nn({
|
|
|
3150
3141
|
},
|
|
3151
3142
|
[s.length, c, f]
|
|
3152
3143
|
), re = z(() => {
|
|
3153
|
-
if (
|
|
3154
|
-
|
|
3144
|
+
if (ao(t)) {
|
|
3145
|
+
so(t.ui_steps, { row: i }).then(() => c == null ? void 0 : c());
|
|
3155
3146
|
return;
|
|
3156
3147
|
}
|
|
3157
|
-
if (
|
|
3148
|
+
if (A) {
|
|
3158
3149
|
q();
|
|
3159
3150
|
return;
|
|
3160
3151
|
}
|
|
3161
|
-
|
|
3162
|
-
{ actionCode: E, body: Ct(void 0,
|
|
3152
|
+
_ ? p(!0) : T ? y(!0) : (o == null || o(s.length), h.mutate(
|
|
3153
|
+
{ actionCode: E, body: Ct(void 0, U) },
|
|
3163
3154
|
{
|
|
3164
|
-
onSuccess: (Z) =>
|
|
3155
|
+
onSuccess: (Z) => B(Z),
|
|
3165
3156
|
onError: () => u == null ? void 0 : u(s.length)
|
|
3166
3157
|
}
|
|
3167
3158
|
));
|
|
3168
|
-
}, [t, i,
|
|
3159
|
+
}, [t, i, A, _, T, E, U, s, h, B, q, o, u, c]), Y = z(() => {
|
|
3169
3160
|
o == null || o(s.length), h.mutate(
|
|
3170
|
-
{ actionCode: E, body: Ct(void 0,
|
|
3161
|
+
{ actionCode: E, body: Ct(void 0, U) },
|
|
3171
3162
|
{
|
|
3172
|
-
onSuccess: (Z) =>
|
|
3163
|
+
onSuccess: (Z) => B(Z, () => y(!1)),
|
|
3173
3164
|
onError: () => u == null ? void 0 : u(s.length)
|
|
3174
3165
|
}
|
|
3175
3166
|
);
|
|
3176
|
-
}, [E,
|
|
3167
|
+
}, [E, U, s, h, B, o, u]), R = z(
|
|
3177
3168
|
(Z) => {
|
|
3178
3169
|
o == null || o(s.length), h.mutate(
|
|
3179
|
-
{ actionCode: E, body: Ct(Z,
|
|
3170
|
+
{ actionCode: E, body: Ct(Z, U) },
|
|
3180
3171
|
{
|
|
3181
|
-
onSuccess: (fe) =>
|
|
3172
|
+
onSuccess: (fe) => B(fe, () => p(!1)),
|
|
3182
3173
|
onError: () => u == null ? void 0 : u(s.length)
|
|
3183
3174
|
}
|
|
3184
3175
|
);
|
|
3185
3176
|
},
|
|
3186
|
-
[E,
|
|
3177
|
+
[E, U, s, h, B, o, u]
|
|
3187
3178
|
), C = P((V = t.display) == null ? void 0 : V.name), L = (Q = t.display) == null ? void 0 : Q.icon;
|
|
3188
3179
|
return /* @__PURE__ */ d(pe, { children: [
|
|
3189
3180
|
/* @__PURE__ */ d(
|
|
@@ -3201,7 +3192,7 @@ function nn({
|
|
|
3201
3192
|
]
|
|
3202
3193
|
}
|
|
3203
3194
|
),
|
|
3204
|
-
|
|
3195
|
+
_ && /* @__PURE__ */ n(
|
|
3205
3196
|
cs,
|
|
3206
3197
|
{
|
|
3207
3198
|
open: m,
|
|
@@ -3225,7 +3216,7 @@ function nn({
|
|
|
3225
3216
|
}
|
|
3226
3217
|
),
|
|
3227
3218
|
x && /* @__PURE__ */ n(
|
|
3228
|
-
|
|
3219
|
+
Ba,
|
|
3229
3220
|
{
|
|
3230
3221
|
open: !!x,
|
|
3231
3222
|
onClose: () => {
|
|
@@ -3236,7 +3227,7 @@ function nn({
|
|
|
3236
3227
|
)
|
|
3237
3228
|
] });
|
|
3238
3229
|
}
|
|
3239
|
-
function
|
|
3230
|
+
function oo({
|
|
3240
3231
|
actionCode: e,
|
|
3241
3232
|
action: t,
|
|
3242
3233
|
entityCode: r,
|
|
@@ -3245,17 +3236,17 @@ function lo({
|
|
|
3245
3236
|
onSuccess: a
|
|
3246
3237
|
}) {
|
|
3247
3238
|
var T, $;
|
|
3248
|
-
const [l, c] =
|
|
3239
|
+
const [l, c] = I(!1), [o, u] = I(!1), f = Qn(r), { data: m } = qe(), p = Ut(), g = ms(t), y = fs(t), b = !!t.confirmation && Object.keys(t.confirmation).length > 0, w = pt(t.conditions, i), x = P((T = t.display) == null ? void 0 : T.name), N = ($ = t.display) == null ? void 0 : $.icon, h = z(async () => {
|
|
3249
3240
|
var F, M, q;
|
|
3250
3241
|
if (t.association)
|
|
3251
3242
|
try {
|
|
3252
|
-
const E = r ? `${r}.${t.association}` : t.association,
|
|
3253
|
-
if (!
|
|
3254
|
-
ie.error(`No list screen found for ${
|
|
3243
|
+
const E = r ? `${r}.${t.association}` : t.association, U = await Wr(E, [s]), B = er(m, U.target_entity);
|
|
3244
|
+
if (!B) {
|
|
3245
|
+
ie.error(`No list screen found for ${U.target_entity}`);
|
|
3255
3246
|
return;
|
|
3256
3247
|
}
|
|
3257
|
-
const re = m == null ? void 0 : m.entities[
|
|
3258
|
-
if (
|
|
3248
|
+
const re = m == null ? void 0 : m.entities[U.target_entity], Y = P((F = t.display) == null ? void 0 : F.name) || U.target_entity;
|
|
3249
|
+
if (U.ids.length === 0) {
|
|
3259
3250
|
ie.info(`No related ${Y} found`);
|
|
3260
3251
|
return;
|
|
3261
3252
|
}
|
|
@@ -3263,9 +3254,9 @@ function lo({
|
|
|
3263
3254
|
var V;
|
|
3264
3255
|
return (V = re.fields[L]) == null ? void 0 : V.primary;
|
|
3265
3256
|
})) ?? "id", C = new URLSearchParams();
|
|
3266
|
-
C.set(`filter_${R}`,
|
|
3257
|
+
C.set(`filter_${R}`, U.ids.join(",")), p(B.route, {
|
|
3267
3258
|
title: Y,
|
|
3268
|
-
icon: ((q = t.display) == null ? void 0 : q.icon) ||
|
|
3259
|
+
icon: ((q = t.display) == null ? void 0 : q.icon) || B.icon,
|
|
3269
3260
|
search: C.toString()
|
|
3270
3261
|
}), a == null || a();
|
|
3271
3262
|
} catch (E) {
|
|
@@ -3280,14 +3271,14 @@ function lo({
|
|
|
3280
3271
|
{ actionCode: v, body: Ct(void 0, [s]) },
|
|
3281
3272
|
{ onSuccess: a }
|
|
3282
3273
|
);
|
|
3283
|
-
}, [g, y, b, v, s, f, a, h]),
|
|
3274
|
+
}, [g, y, b, v, s, f, a, h]), A = z(() => {
|
|
3284
3275
|
f.mutate(
|
|
3285
3276
|
{ actionCode: v, body: Ct(void 0, [s]) },
|
|
3286
3277
|
{ onSuccess: () => {
|
|
3287
3278
|
u(!1), a == null || a();
|
|
3288
3279
|
} }
|
|
3289
3280
|
);
|
|
3290
|
-
}, [v, s, f, a]),
|
|
3281
|
+
}, [v, s, f, a]), _ = z(
|
|
3291
3282
|
(F) => {
|
|
3292
3283
|
f.mutate(
|
|
3293
3284
|
{ actionCode: v, body: Ct(F, [s]) },
|
|
@@ -3317,7 +3308,7 @@ function lo({
|
|
|
3317
3308
|
onOpenChange: c,
|
|
3318
3309
|
action: t,
|
|
3319
3310
|
actionName: x,
|
|
3320
|
-
onSubmit:
|
|
3311
|
+
onSubmit: _,
|
|
3321
3312
|
isPending: f.isPending
|
|
3322
3313
|
}
|
|
3323
3314
|
),
|
|
@@ -3328,13 +3319,13 @@ function lo({
|
|
|
3328
3319
|
onOpenChange: u,
|
|
3329
3320
|
actionName: x,
|
|
3330
3321
|
message: P(t.confirmation),
|
|
3331
|
-
onConfirm:
|
|
3322
|
+
onConfirm: A,
|
|
3332
3323
|
isPending: f.isPending
|
|
3333
3324
|
}
|
|
3334
3325
|
)
|
|
3335
3326
|
] });
|
|
3336
3327
|
}
|
|
3337
|
-
function
|
|
3328
|
+
function lo({
|
|
3338
3329
|
count: e,
|
|
3339
3330
|
isPending: t,
|
|
3340
3331
|
isSuccess: r,
|
|
@@ -3366,7 +3357,7 @@ function co({
|
|
|
3366
3357
|
/* @__PURE__ */ n("span", { children: "Partially completed - some items failed or were skipped" })
|
|
3367
3358
|
] }),
|
|
3368
3359
|
!t && s && /* @__PURE__ */ d(pe, { children: [
|
|
3369
|
-
/* @__PURE__ */ n(
|
|
3360
|
+
/* @__PURE__ */ n(Xs, { className: "w-4 h-4 text-[var(--destructive)]" }),
|
|
3370
3361
|
/* @__PURE__ */ d("span", { children: [
|
|
3371
3362
|
"Failed to process ",
|
|
3372
3363
|
e,
|
|
@@ -3440,10 +3431,10 @@ function tr(e) {
|
|
|
3440
3431
|
}
|
|
3441
3432
|
return t;
|
|
3442
3433
|
}
|
|
3443
|
-
function
|
|
3434
|
+
function co(e) {
|
|
3444
3435
|
return tr(e).length;
|
|
3445
3436
|
}
|
|
3446
|
-
function
|
|
3437
|
+
function uo(e, t) {
|
|
3447
3438
|
return { field: e, op: "eq", value: t };
|
|
3448
3439
|
}
|
|
3449
3440
|
function zt(e, t) {
|
|
@@ -3464,11 +3455,11 @@ function zt(e, t) {
|
|
|
3464
3455
|
}
|
|
3465
3456
|
return r;
|
|
3466
3457
|
}
|
|
3467
|
-
function
|
|
3458
|
+
function fo() {
|
|
3468
3459
|
const [e, t] = yt(), r = ee(
|
|
3469
3460
|
() => gs(e),
|
|
3470
3461
|
[e]
|
|
3471
|
-
), s = ee(() =>
|
|
3462
|
+
), s = ee(() => co(r), [r]), i = z(
|
|
3472
3463
|
(l) => {
|
|
3473
3464
|
const c = new URLSearchParams(e);
|
|
3474
3465
|
vs(l, c), c.set("page", "1"), t(c);
|
|
@@ -3480,7 +3471,7 @@ function mo() {
|
|
|
3480
3471
|
}, [e, t]);
|
|
3481
3472
|
return { filters: r, activeCount: s, setFilters: i, clearFilters: a };
|
|
3482
3473
|
}
|
|
3483
|
-
function
|
|
3474
|
+
function mo({
|
|
3484
3475
|
filters: e,
|
|
3485
3476
|
onRemove: t,
|
|
3486
3477
|
onClearAll: r,
|
|
@@ -3591,14 +3582,14 @@ function xs(e) {
|
|
|
3591
3582
|
const r = Array.isArray(e.value) ? e.value.join(", ") : String(e.value ?? "");
|
|
3592
3583
|
return `${t} ${r}`;
|
|
3593
3584
|
}
|
|
3594
|
-
function
|
|
3585
|
+
function po({
|
|
3595
3586
|
open: e,
|
|
3596
3587
|
onClose: t,
|
|
3597
3588
|
filters: r,
|
|
3598
3589
|
onApply: s,
|
|
3599
3590
|
availableFields: i
|
|
3600
3591
|
}) {
|
|
3601
|
-
const [a, l] =
|
|
3592
|
+
const [a, l] = I(r), [c, o] = I(!1);
|
|
3602
3593
|
if (le(() => {
|
|
3603
3594
|
e && l(r);
|
|
3604
3595
|
}, [e, r]), !e) return null;
|
|
@@ -3663,7 +3654,7 @@ function ho({
|
|
|
3663
3654
|
) : null;
|
|
3664
3655
|
}
|
|
3665
3656
|
return /* @__PURE__ */ n(
|
|
3666
|
-
|
|
3657
|
+
ho,
|
|
3667
3658
|
{
|
|
3668
3659
|
groups: x.or,
|
|
3669
3660
|
availableFields: i,
|
|
@@ -3693,7 +3684,7 @@ function ho({
|
|
|
3693
3684
|
}) })
|
|
3694
3685
|
),
|
|
3695
3686
|
/* @__PURE__ */ n("div", { className: "flex items-center gap-2 pt-2", children: c ? /* @__PURE__ */ n(
|
|
3696
|
-
|
|
3687
|
+
go,
|
|
3697
3688
|
{
|
|
3698
3689
|
fields: i,
|
|
3699
3690
|
activeFields: f,
|
|
@@ -3750,7 +3741,7 @@ function Tr({
|
|
|
3750
3741
|
onValueChange: (a) => r({ op: a }),
|
|
3751
3742
|
children: [
|
|
3752
3743
|
/* @__PURE__ */ n(at, { className: "w-[130px] h-8 text-xs", children: /* @__PURE__ */ n(vt, {}) }),
|
|
3753
|
-
/* @__PURE__ */ n(ot, { children: t.operators.map((a) => /* @__PURE__ */ n(
|
|
3744
|
+
/* @__PURE__ */ n(ot, { children: t.operators.map((a) => /* @__PURE__ */ n(Ue, { value: a, className: "text-xs", children: hs[a] || a }, a)) })
|
|
3754
3745
|
]
|
|
3755
3746
|
}
|
|
3756
3747
|
),
|
|
@@ -3761,7 +3752,7 @@ function Tr({
|
|
|
3761
3752
|
onValueChange: (a) => r({ value: a }),
|
|
3762
3753
|
children: [
|
|
3763
3754
|
/* @__PURE__ */ n(at, { className: "flex-1 h-8 text-xs", children: /* @__PURE__ */ n(vt, { placeholder: "Select..." }) }),
|
|
3764
|
-
/* @__PURE__ */ n(ot, { children: t.options.map((a) => /* @__PURE__ */ n(
|
|
3755
|
+
/* @__PURE__ */ n(ot, { children: t.options.map((a) => /* @__PURE__ */ n(Ue, { value: a.value, className: "text-xs", children: a.label }, a.value)) })
|
|
3765
3756
|
]
|
|
3766
3757
|
}
|
|
3767
3758
|
) : /* @__PURE__ */ n(
|
|
@@ -3785,7 +3776,7 @@ function Tr({
|
|
|
3785
3776
|
)
|
|
3786
3777
|
] });
|
|
3787
3778
|
}
|
|
3788
|
-
function
|
|
3779
|
+
function ho({
|
|
3789
3780
|
groups: e,
|
|
3790
3781
|
availableFields: t,
|
|
3791
3782
|
onChange: r
|
|
@@ -3862,13 +3853,13 @@ function go({
|
|
|
3862
3853
|
)
|
|
3863
3854
|
] });
|
|
3864
3855
|
}
|
|
3865
|
-
function
|
|
3856
|
+
function go({
|
|
3866
3857
|
fields: e,
|
|
3867
3858
|
activeFields: t,
|
|
3868
3859
|
onSelect: r,
|
|
3869
3860
|
onCancel: s
|
|
3870
3861
|
}) {
|
|
3871
|
-
const [i, a] =
|
|
3862
|
+
const [i, a] = I(""), l = e.filter(
|
|
3872
3863
|
(c) => !t.has(c.code) && (i === "" || c.label.toLowerCase().includes(i.toLowerCase()) || c.code.toLowerCase().includes(i.toLowerCase()))
|
|
3873
3864
|
);
|
|
3874
3865
|
return /* @__PURE__ */ d("div", { className: "w-full border border-[var(--border)] rounded-md p-2 space-y-2", children: [
|
|
@@ -3900,7 +3891,7 @@ function vo({
|
|
|
3900
3891
|
/* @__PURE__ */ n(j, { variant: "ghost", size: "sm", className: "text-xs w-full", onClick: s, children: "Cancel" })
|
|
3901
3892
|
] });
|
|
3902
3893
|
}
|
|
3903
|
-
function
|
|
3894
|
+
function vo({
|
|
3904
3895
|
availableColumns: e,
|
|
3905
3896
|
visibleColumns: t,
|
|
3906
3897
|
onToggle: r,
|
|
@@ -3908,7 +3899,7 @@ function yo({
|
|
|
3908
3899
|
onShowAll: i,
|
|
3909
3900
|
columnLabel: a = (l) => l
|
|
3910
3901
|
}) {
|
|
3911
|
-
const [l, c] =
|
|
3902
|
+
const [l, c] = I(!1);
|
|
3912
3903
|
return /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
3913
3904
|
/* @__PURE__ */ d(
|
|
3914
3905
|
j,
|
|
@@ -3918,7 +3909,7 @@ function yo({
|
|
|
3918
3909
|
onClick: () => c(!l),
|
|
3919
3910
|
className: "h-8",
|
|
3920
3911
|
children: [
|
|
3921
|
-
/* @__PURE__ */ n(
|
|
3912
|
+
/* @__PURE__ */ n(Bs, { className: "w-4 h-4 mr-1.5" }),
|
|
3922
3913
|
"Columns"
|
|
3923
3914
|
]
|
|
3924
3915
|
}
|
|
@@ -3958,7 +3949,7 @@ function yo({
|
|
|
3958
3949
|
] })
|
|
3959
3950
|
] });
|
|
3960
3951
|
}
|
|
3961
|
-
function
|
|
3952
|
+
function yo({
|
|
3962
3953
|
views: e,
|
|
3963
3954
|
activeViewId: t,
|
|
3964
3955
|
isDirty: r,
|
|
@@ -3967,7 +3958,7 @@ function xo({
|
|
|
3967
3958
|
onSaveAs: a,
|
|
3968
3959
|
onSetDefault: l
|
|
3969
3960
|
}) {
|
|
3970
|
-
const [c, o] =
|
|
3961
|
+
const [c, o] = I(!1), u = e.find((y) => y.id === t), f = e.filter((y) => y.source === "system"), m = e.filter((y) => y.source === "personal"), p = e.filter((y) => y.source === "shared"), g = u ? P(u.name) : "Default view";
|
|
3971
3962
|
return /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
3972
3963
|
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
3973
3964
|
/* @__PURE__ */ d(
|
|
@@ -4091,13 +4082,13 @@ function Qt({
|
|
|
4091
4082
|
}
|
|
4092
4083
|
);
|
|
4093
4084
|
}
|
|
4094
|
-
function
|
|
4085
|
+
function xo(e) {
|
|
4095
4086
|
const { data: t } = qe();
|
|
4096
4087
|
if (!(!t || !e))
|
|
4097
4088
|
return t.screens[e];
|
|
4098
4089
|
}
|
|
4099
|
-
function
|
|
4100
|
-
const r =
|
|
4090
|
+
function bo(e, t) {
|
|
4091
|
+
const r = xo(e), { data: s } = Kt("view", {
|
|
4101
4092
|
filters: [
|
|
4102
4093
|
{ field: "screen_code", op: "eq", value: e },
|
|
4103
4094
|
// Return own views + shared views. The OR ensures visibility.
|
|
@@ -4145,26 +4136,23 @@ function br(e, t, r, s) {
|
|
|
4145
4136
|
const a = s == null ? void 0 : s[i];
|
|
4146
4137
|
return a != null && a.route ? a.route.replace(":id", encodeURIComponent(t)) : null;
|
|
4147
4138
|
}
|
|
4148
|
-
function
|
|
4139
|
+
function No({ screenCode: e }) {
|
|
4149
4140
|
var $t, Wt, tt, Rt, rt, Et, Ht, _t, St;
|
|
4150
|
-
const t =
|
|
4151
|
-
() => kr(v == null ? void 0 : v.actions, h == null ? void 0 : h.actions, "
|
|
4152
|
-
[v == null ? void 0 : v.actions, h == null ? void 0 : h.actions,
|
|
4141
|
+
const t = Ut(), [r, s] = yt(), { data: i } = qe(), [a, l] = I(null), [c, o] = I({}), [u, f] = I({ isPending: !1, isSuccess: !1, isError: !1, isPartial: !1, count: 0 }), [m, p] = I(!1), { filters: g, activeCount: y, setFilters: b, clearFilters: w } = fo(), x = ct((S) => S.user), N = bo(e, x == null ? void 0 : x.id), h = i == null ? void 0 : i.screens[e], v = h != null && h.entity ? i == null ? void 0 : i.entities[h.entity] : void 0, k = h == null ? void 0 : h.entity, A = i == null ? void 0 : i.actions, _ = ee(
|
|
4142
|
+
() => kr(v == null ? void 0 : v.actions, h == null ? void 0 : h.actions, "list_toolbar", A),
|
|
4143
|
+
[v == null ? void 0 : v.actions, h == null ? void 0 : h.actions, A]
|
|
4153
4144
|
), T = ee(
|
|
4154
|
-
() => kr(v == null ? void 0 : v.actions, h == null ? void 0 : h.row_actions, "
|
|
4155
|
-
[v == null ? void 0 : v.actions, h == null ? void 0 : h.row_actions,
|
|
4145
|
+
() => kr(v == null ? void 0 : v.actions, h == null ? void 0 : h.row_actions, "list_row", A),
|
|
4146
|
+
[v == null ? void 0 : v.actions, h == null ? void 0 : h.row_actions, A]
|
|
4156
4147
|
), $ = (h == null ? void 0 : h.row_actions) !== void 0, F = ee(
|
|
4157
|
-
() =>
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
}),
|
|
4161
|
-
[S]
|
|
4162
|
-
), M = !!(v != null && v.soft_delete), q = M && ((x == null ? void 0 : x.permissions) ?? []).some((_) => _ === "feature:view_deleted" || _ === "feature:*" || _ === "*"), E = q && r.get("include_deleted") === "true", { openTab: I, updateTabSearch: X, findTabByPathname: re } = ht();
|
|
4148
|
+
() => _.some((S) => (S.action.visibility ?? []).includes("list_toolbar")),
|
|
4149
|
+
[_]
|
|
4150
|
+
), M = !!(v != null && v.soft_delete), q = M && ((x == null ? void 0 : x.permissions) ?? []).some((S) => S === "feature:view_deleted" || S === "feature:*" || S === "*"), E = q && r.get("include_deleted") === "true", { openTab: U, updateTabSearch: B, findTabByPathname: re } = ht();
|
|
4163
4151
|
le(() => {
|
|
4164
|
-
var
|
|
4152
|
+
var S, D;
|
|
4165
4153
|
if (h != null && h.route && v) {
|
|
4166
|
-
const H = P((
|
|
4167
|
-
|
|
4154
|
+
const H = P((S = h.display) == null ? void 0 : S.name) || P(v.display.name_plural), ne = ((D = h.display) == null ? void 0 : D.icon) || v.display.icon;
|
|
4155
|
+
U({
|
|
4168
4156
|
pathname: h.route,
|
|
4169
4157
|
search: r.toString(),
|
|
4170
4158
|
title: H,
|
|
@@ -4174,15 +4162,15 @@ function wo({ screenCode: e }) {
|
|
|
4174
4162
|
}
|
|
4175
4163
|
}, [h == null ? void 0 : h.route, (Wt = ($t = h == null ? void 0 : h.display) == null ? void 0 : $t.name) == null ? void 0 : Wt.en, (tt = v == null ? void 0 : v.display.name_plural) == null ? void 0 : tt.en, (Rt = h == null ? void 0 : h.display) == null ? void 0 : Rt.icon, v == null ? void 0 : v.display.icon]), le(() => {
|
|
4176
4164
|
if (!(h != null && h.route)) return;
|
|
4177
|
-
const
|
|
4178
|
-
|
|
4165
|
+
const S = re(h.route);
|
|
4166
|
+
S && B(S.id, r.toString());
|
|
4179
4167
|
}, [r, h == null ? void 0 : h.route]);
|
|
4180
4168
|
const Y = parseInt(r.get("page") ?? "1", 10), R = r.get("search") ?? "", C = r.get("sort") ?? (h == null ? void 0 : h.sort_default) ?? "", L = Gn(R, 300), V = ee(() => {
|
|
4181
|
-
const
|
|
4182
|
-
return
|
|
4169
|
+
const S = r.get("columns");
|
|
4170
|
+
return S ? S.split(",").filter(Boolean) : (h == null ? void 0 : h.columns) ?? [];
|
|
4183
4171
|
}, [r, h == null ? void 0 : h.columns]), Q = ee(() => {
|
|
4184
|
-
const
|
|
4185
|
-
return
|
|
4172
|
+
const S = [], D = [...(h == null ? void 0 : h.columns) ?? [], ...V];
|
|
4173
|
+
return D.some((H) => H.startsWith("$status.")) && S.push("statuses"), D.some((H) => H.startsWith("$property.")) && S.push("properties"), S.length > 0 && S.unshift("refs"), S.length > 0 ? S : void 0;
|
|
4186
4174
|
}, [h == null ? void 0 : h.columns, V]), { data: Z, isLoading: fe, isError: Te } = Kt(k, {
|
|
4187
4175
|
page: Y,
|
|
4188
4176
|
per_page: 50,
|
|
@@ -4194,24 +4182,24 @@ function wo({ screenCode: e }) {
|
|
|
4194
4182
|
screen: h != null && h.fixed_filters ? e : void 0
|
|
4195
4183
|
}), Ne = Jn(k ?? ""), be = ee(() => {
|
|
4196
4184
|
if (!C) return [];
|
|
4197
|
-
const [
|
|
4198
|
-
return [{ id:
|
|
4185
|
+
const [S, D] = C.split(":");
|
|
4186
|
+
return [{ id: S, desc: D === "desc" }];
|
|
4199
4187
|
}, [C]), je = ee(
|
|
4200
4188
|
() => {
|
|
4201
|
-
var
|
|
4202
|
-
return ((
|
|
4189
|
+
var S;
|
|
4190
|
+
return ((S = v == null ? void 0 : v.field_order) == null ? void 0 : S.find((D) => {
|
|
4203
4191
|
var H;
|
|
4204
|
-
return (H = v.fields[
|
|
4192
|
+
return (H = v.fields[D]) == null ? void 0 : H.primary;
|
|
4205
4193
|
})) ?? "id";
|
|
4206
4194
|
},
|
|
4207
4195
|
[v]
|
|
4208
|
-
),
|
|
4209
|
-
dt.current =
|
|
4196
|
+
), X = Z == null ? void 0 : Z.$refs, dt = me(X);
|
|
4197
|
+
dt.current = X;
|
|
4210
4198
|
const Ze = ee(() => {
|
|
4211
4199
|
var H, ne, te;
|
|
4212
4200
|
if (V.length === 0 || !v) return [];
|
|
4213
|
-
const
|
|
4214
|
-
F &&
|
|
4201
|
+
const S = [];
|
|
4202
|
+
F && S.push({
|
|
4215
4203
|
id: "_select",
|
|
4216
4204
|
header: ({ table: G }) => /* @__PURE__ */ n(
|
|
4217
4205
|
"input",
|
|
@@ -4238,7 +4226,7 @@ function wo({ screenCode: e }) {
|
|
|
4238
4226
|
const de = G.slice(8), ge = (H = v.status_groups) == null ? void 0 : H[de];
|
|
4239
4227
|
if (!ge) continue;
|
|
4240
4228
|
const Me = new Map(ge.statuses.map((Ae) => [Ae.code, Ae]));
|
|
4241
|
-
|
|
4229
|
+
S.push({
|
|
4242
4230
|
id: G,
|
|
4243
4231
|
header: P(ge.name) || de,
|
|
4244
4232
|
size: 140,
|
|
@@ -4254,7 +4242,7 @@ function wo({ screenCode: e }) {
|
|
|
4254
4242
|
if (G.startsWith("$property.")) {
|
|
4255
4243
|
const de = G.slice(10), ge = (ne = v.properties) == null ? void 0 : ne[de];
|
|
4256
4244
|
if (!ge) continue;
|
|
4257
|
-
|
|
4245
|
+
S.push({
|
|
4258
4246
|
id: G,
|
|
4259
4247
|
header: P(ge.name) || de,
|
|
4260
4248
|
size: 150,
|
|
@@ -4269,7 +4257,7 @@ function wo({ screenCode: e }) {
|
|
|
4269
4257
|
const xe = v.fields[G];
|
|
4270
4258
|
if (!xe) continue;
|
|
4271
4259
|
const Ce = De(xe, G, i == null ? void 0 : i.entities), we = (te = xe.display) == null ? void 0 : te.width;
|
|
4272
|
-
|
|
4260
|
+
S.push({
|
|
4273
4261
|
id: G,
|
|
4274
4262
|
accessorKey: G,
|
|
4275
4263
|
header: Ce,
|
|
@@ -4284,17 +4272,17 @@ function wo({ screenCode: e }) {
|
|
|
4284
4272
|
})
|
|
4285
4273
|
});
|
|
4286
4274
|
}
|
|
4287
|
-
const
|
|
4288
|
-
return (
|
|
4275
|
+
const D = !$ && !(v != null && v.readonly);
|
|
4276
|
+
return (D || T.length > 0) && S.push({
|
|
4289
4277
|
id: "_actions",
|
|
4290
4278
|
header: "",
|
|
4291
4279
|
size: 48,
|
|
4292
4280
|
cell: ({ row: G }) => {
|
|
4293
4281
|
const xe = String(G.original[je] ?? ""), Ce = br(h, xe, v, i == null ? void 0 : i.screens);
|
|
4294
|
-
return /* @__PURE__ */ d(
|
|
4282
|
+
return /* @__PURE__ */ d(In, { children: [
|
|
4295
4283
|
/* @__PURE__ */ n(Vn, { asChild: !0, children: /* @__PURE__ */ n(j, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ n(ti, { className: "h-4 w-4" }) }) }),
|
|
4296
4284
|
/* @__PURE__ */ d(zr, { align: "end", children: [
|
|
4297
|
-
|
|
4285
|
+
D && /* @__PURE__ */ d(pe, { children: [
|
|
4298
4286
|
Ce && /* @__PURE__ */ d(
|
|
4299
4287
|
mt,
|
|
4300
4288
|
{
|
|
@@ -4360,7 +4348,7 @@ function wo({ screenCode: e }) {
|
|
|
4360
4348
|
);
|
|
4361
4349
|
}
|
|
4362
4350
|
return /* @__PURE__ */ n(
|
|
4363
|
-
|
|
4351
|
+
oo,
|
|
4364
4352
|
{
|
|
4365
4353
|
actionCode: we,
|
|
4366
4354
|
action: de,
|
|
@@ -4374,7 +4362,7 @@ function wo({ screenCode: e }) {
|
|
|
4374
4362
|
] })
|
|
4375
4363
|
] });
|
|
4376
4364
|
}
|
|
4377
|
-
}),
|
|
4365
|
+
}), S;
|
|
4378
4366
|
}, [h, v, V, t, F, T, $, k, je]), Ye = (Z == null ? void 0 : Z.data) ?? [], Se = Z == null ? void 0 : Z.meta, ut = pi({
|
|
4379
4367
|
data: Ye,
|
|
4380
4368
|
columns: Ze,
|
|
@@ -4382,45 +4370,45 @@ function wo({ screenCode: e }) {
|
|
|
4382
4370
|
manualSorting: !0,
|
|
4383
4371
|
manualPagination: !0,
|
|
4384
4372
|
state: { sorting: be, rowSelection: c },
|
|
4385
|
-
onSortingChange: (
|
|
4386
|
-
const
|
|
4387
|
-
if (
|
|
4373
|
+
onSortingChange: (S) => {
|
|
4374
|
+
const D = typeof S == "function" ? S(be) : S, H = new URLSearchParams(r);
|
|
4375
|
+
if (D.length === 0)
|
|
4388
4376
|
H.delete("sort");
|
|
4389
4377
|
else {
|
|
4390
|
-
const ne =
|
|
4378
|
+
const ne = D[0];
|
|
4391
4379
|
H.set("sort", `${ne.id}:${ne.desc ? "desc" : "asc"}`);
|
|
4392
4380
|
}
|
|
4393
4381
|
H.set("page", "1"), s(H);
|
|
4394
4382
|
},
|
|
4395
4383
|
onRowSelectionChange: o,
|
|
4396
|
-
getRowId: (
|
|
4384
|
+
getRowId: (S) => String(S[je] ?? ""),
|
|
4397
4385
|
rowCount: (Se == null ? void 0 : Se.total) ?? 0
|
|
4398
4386
|
}), wt = ee(
|
|
4399
|
-
() => Object.keys(c).filter((
|
|
4387
|
+
() => Object.keys(c).filter((S) => c[S]),
|
|
4400
4388
|
[c]
|
|
4401
4389
|
);
|
|
4402
4390
|
le(() => {
|
|
4403
4391
|
o({});
|
|
4404
4392
|
}, [Y, L, C, g]), le(() => {
|
|
4405
|
-
const
|
|
4393
|
+
const S = (D) => {
|
|
4406
4394
|
var ne;
|
|
4407
|
-
const H = (ne =
|
|
4395
|
+
const H = (ne = D.target) == null ? void 0 : ne.tagName;
|
|
4408
4396
|
if (H === "INPUT" || H === "TEXTAREA" || H === "SELECT") {
|
|
4409
|
-
|
|
4397
|
+
D.key === "Escape" && (D.target.blur(), p(!1));
|
|
4410
4398
|
return;
|
|
4411
4399
|
}
|
|
4412
|
-
if (
|
|
4413
|
-
|
|
4400
|
+
if (D.key === "/" && !D.metaKey && !D.ctrlKey) {
|
|
4401
|
+
D.preventDefault();
|
|
4414
4402
|
const te = document.querySelector('[placeholder*="Search"]');
|
|
4415
4403
|
te == null || te.focus();
|
|
4416
4404
|
}
|
|
4417
|
-
|
|
4405
|
+
D.key === "f" && !D.metaKey && !D.ctrlKey && (D.preventDefault(), p((te) => !te)), D.key === "Escape" && p(!1);
|
|
4418
4406
|
};
|
|
4419
|
-
return document.addEventListener("keydown",
|
|
4407
|
+
return document.addEventListener("keydown", S), () => document.removeEventListener("keydown", S);
|
|
4420
4408
|
}, []), le(() => {
|
|
4421
4409
|
if (u.isSuccess || u.isError || u.isPartial) {
|
|
4422
|
-
const
|
|
4423
|
-
return () => clearTimeout(
|
|
4410
|
+
const S = setTimeout(() => f({ isPending: !1, isSuccess: !1, isError: !1, isPartial: !1, count: 0 }), 3e3);
|
|
4411
|
+
return () => clearTimeout(S);
|
|
4424
4412
|
}
|
|
4425
4413
|
}, [u.isSuccess, u.isError, u.isPartial]);
|
|
4426
4414
|
const At = me(null), { rows: et } = ut.getRowModel(), We = gi({
|
|
@@ -4429,40 +4417,40 @@ function wo({ screenCode: e }) {
|
|
|
4429
4417
|
estimateSize: () => 48,
|
|
4430
4418
|
overscan: 10
|
|
4431
4419
|
}), ar = z(
|
|
4432
|
-
(
|
|
4433
|
-
s((
|
|
4434
|
-
const H = new URLSearchParams(
|
|
4435
|
-
return
|
|
4420
|
+
(S) => {
|
|
4421
|
+
s((D) => {
|
|
4422
|
+
const H = new URLSearchParams(D);
|
|
4423
|
+
return S ? H.set("search", S) : H.delete("search"), H.set("page", "1"), H;
|
|
4436
4424
|
});
|
|
4437
4425
|
},
|
|
4438
4426
|
[s]
|
|
4439
4427
|
), or = z(() => {
|
|
4440
|
-
s((
|
|
4441
|
-
const
|
|
4442
|
-
return
|
|
4428
|
+
s((S) => {
|
|
4429
|
+
const D = new URLSearchParams(S);
|
|
4430
|
+
return D.get("include_deleted") ? D.delete("include_deleted") : D.set("include_deleted", "true"), D.set("page", "1"), D;
|
|
4443
4431
|
});
|
|
4444
4432
|
}, [s]), Pe = z(
|
|
4445
|
-
(
|
|
4446
|
-
s((
|
|
4447
|
-
const H = new URLSearchParams(
|
|
4448
|
-
return H.set("page", String(
|
|
4433
|
+
(S) => {
|
|
4434
|
+
s((D) => {
|
|
4435
|
+
const H = new URLSearchParams(D);
|
|
4436
|
+
return H.set("page", String(S)), H;
|
|
4449
4437
|
});
|
|
4450
4438
|
},
|
|
4451
4439
|
[s]
|
|
4452
4440
|
), Dt = ee(() => !h || !v ? !1 : br(h, "_", v, i == null ? void 0 : i.screens) !== null, [h, v, i == null ? void 0 : i.screens]), lr = z(
|
|
4453
|
-
(
|
|
4441
|
+
(S) => {
|
|
4454
4442
|
var Ce, we, de;
|
|
4455
4443
|
if (!v || !h) return;
|
|
4456
|
-
const
|
|
4444
|
+
const D = (Ce = v.field_order) == null ? void 0 : Ce.find((ge) => {
|
|
4457
4445
|
var Me;
|
|
4458
4446
|
return (Me = v.fields[ge]) == null ? void 0 : Me.primary;
|
|
4459
|
-
}), H =
|
|
4447
|
+
}), H = D ? String(S[D] ?? "") : "";
|
|
4460
4448
|
if (!H) return;
|
|
4461
4449
|
const ne = br(h, H, v, i == null ? void 0 : i.screens);
|
|
4462
4450
|
if (!ne) return;
|
|
4463
4451
|
const te = (we = h.columns) == null ? void 0 : we.find(
|
|
4464
4452
|
(ge) => !ge.startsWith("$status.") && !ge.startsWith("$property.")
|
|
4465
|
-
), G = te ? String(
|
|
4453
|
+
), G = te ? String(S[te] ?? P(v.display.name)) : P(v.display.name), xe = ((de = h.display) == null ? void 0 : de.icon) || v.display.icon;
|
|
4466
4454
|
t(ne, {
|
|
4467
4455
|
title: G,
|
|
4468
4456
|
icon: xe
|
|
@@ -4472,21 +4460,21 @@ function wo({ screenCode: e }) {
|
|
|
4472
4460
|
), cr = z(async () => {
|
|
4473
4461
|
if (!a || a.ids.length === 0) return;
|
|
4474
4462
|
l(null);
|
|
4475
|
-
const
|
|
4463
|
+
const S = await Promise.allSettled(
|
|
4476
4464
|
a.ids.map((H) => Ne.mutateAsync(H))
|
|
4477
|
-
),
|
|
4478
|
-
if (
|
|
4465
|
+
), D = S.filter((H) => H.status === "rejected").length;
|
|
4466
|
+
if (D === 0)
|
|
4479
4467
|
o({});
|
|
4480
|
-
else if (
|
|
4468
|
+
else if (D < a.ids.length) {
|
|
4481
4469
|
const H = new Set(
|
|
4482
|
-
a.ids.filter((ne, te) =>
|
|
4470
|
+
a.ids.filter((ne, te) => S[te].status === "fulfilled")
|
|
4483
4471
|
);
|
|
4484
4472
|
o((ne) => {
|
|
4485
4473
|
const te = {};
|
|
4486
4474
|
for (const [G, xe] of Object.entries(ne))
|
|
4487
4475
|
H.has(G) || (te[G] = xe);
|
|
4488
4476
|
return te;
|
|
4489
|
-
}), ie.warning(`${
|
|
4477
|
+
}), ie.warning(`${D} of ${a.ids.length} deletes failed`);
|
|
4490
4478
|
}
|
|
4491
4479
|
}, [a, Ne]);
|
|
4492
4480
|
if (!h || !v) return null;
|
|
@@ -4494,12 +4482,12 @@ function wo({ screenCode: e }) {
|
|
|
4494
4482
|
return /* @__PURE__ */ d("div", { className: "flex flex-col h-full", children: [
|
|
4495
4483
|
/* @__PURE__ */ d("div", { className: "px-6 pt-6", children: [
|
|
4496
4484
|
/* @__PURE__ */ n(
|
|
4497
|
-
|
|
4485
|
+
Bt,
|
|
4498
4486
|
{
|
|
4499
4487
|
title: Pt,
|
|
4500
4488
|
actions: /* @__PURE__ */ d(pe, { children: [
|
|
4501
4489
|
F && /* @__PURE__ */ n(
|
|
4502
|
-
|
|
4490
|
+
lo,
|
|
4503
4491
|
{
|
|
4504
4492
|
count: u.isPending || u.isSuccess || u.isError || u.isPartial ? u.count : wt.length,
|
|
4505
4493
|
isPending: u.isPending,
|
|
@@ -4508,47 +4496,47 @@ function wo({ screenCode: e }) {
|
|
|
4508
4496
|
isPartial: u.isPartial
|
|
4509
4497
|
}
|
|
4510
4498
|
),
|
|
4511
|
-
|
|
4499
|
+
_.map(({ code: S, action: D }) => {
|
|
4512
4500
|
var H, ne;
|
|
4513
|
-
if (
|
|
4501
|
+
if (D.type === "create")
|
|
4514
4502
|
return v != null && v.readonly ? null : /* @__PURE__ */ d(j, { onClick: () => t(`${h.route}/new`, { title: `New ${P($e.name)}`, icon: ft }), children: [
|
|
4515
4503
|
/* @__PURE__ */ n(Oe, { className: "w-4 h-4" }),
|
|
4516
|
-
P((H =
|
|
4517
|
-
] },
|
|
4518
|
-
if (
|
|
4519
|
-
const te =
|
|
4504
|
+
P((H = D.display) == null ? void 0 : H.name) || `New ${P($e.name)}`
|
|
4505
|
+
] }, S);
|
|
4506
|
+
if (D.type === "delete") {
|
|
4507
|
+
const te = D.scope === "batch" || D.scope === "single" ? wt : [], G = D.conditions && D.conditions.length > 0 ? te.filter((Ce) => {
|
|
4520
4508
|
const we = Ye.find((de) => String(de[je] ?? "") === Ce);
|
|
4521
|
-
return we ? pt(
|
|
4522
|
-
}) : te, xe =
|
|
4509
|
+
return we ? pt(D.conditions, we) : !1;
|
|
4510
|
+
}) : te, xe = D.scope === "batch" ? G.length === 0 : D.scope === "single" ? te.length !== 1 || G.length !== 1 : !1;
|
|
4523
4511
|
return /* @__PURE__ */ d(
|
|
4524
4512
|
j,
|
|
4525
4513
|
{
|
|
4526
4514
|
variant: "outline",
|
|
4527
|
-
onClick: () => l({ ids: G, confirmation: P(
|
|
4515
|
+
onClick: () => l({ ids: G, confirmation: P(D.confirmation) || void 0 }),
|
|
4528
4516
|
disabled: xe,
|
|
4529
4517
|
className: "text-[var(--destructive)] hover:text-[var(--destructive)]",
|
|
4530
4518
|
children: [
|
|
4531
4519
|
/* @__PURE__ */ n(Je, { className: "w-4 h-4" }),
|
|
4532
|
-
P((ne =
|
|
4520
|
+
P((ne = D.display) == null ? void 0 : ne.name) || "Delete"
|
|
4533
4521
|
]
|
|
4534
4522
|
},
|
|
4535
|
-
|
|
4523
|
+
S
|
|
4536
4524
|
);
|
|
4537
4525
|
}
|
|
4538
|
-
return
|
|
4526
|
+
return D.type === "edit" ? null : /* @__PURE__ */ n(
|
|
4539
4527
|
nn,
|
|
4540
4528
|
{
|
|
4541
|
-
actionCode:
|
|
4542
|
-
action:
|
|
4529
|
+
actionCode: S,
|
|
4530
|
+
action: D,
|
|
4543
4531
|
entityCode: k,
|
|
4544
|
-
objectIds:
|
|
4532
|
+
objectIds: D.scope === "batch" || D.scope === "single" ? wt : void 0,
|
|
4545
4533
|
variant: "outline",
|
|
4546
4534
|
onSuccess: () => {
|
|
4547
4535
|
o({}), f({ isPending: !1, isSuccess: !0, isError: !1, isPartial: !1, count: wt.length });
|
|
4548
4536
|
},
|
|
4549
|
-
onBatchStart:
|
|
4550
|
-
onBatchError:
|
|
4551
|
-
onBatchPartial:
|
|
4537
|
+
onBatchStart: D.scope === "batch" ? (te) => f({ isPending: !0, isSuccess: !1, isError: !1, isPartial: !1, count: te }) : void 0,
|
|
4538
|
+
onBatchError: D.scope === "batch" ? (te) => f({ isPending: !1, isSuccess: !1, isError: !0, isPartial: !1, count: te }) : void 0,
|
|
4539
|
+
onBatchPartial: D.scope === "batch" ? (te, G) => {
|
|
4552
4540
|
if (f({ isPending: !1, isSuccess: !1, isError: !1, isPartial: !0, count: te }), G && G.length > 0) {
|
|
4553
4541
|
const xe = new Set(G);
|
|
4554
4542
|
o((Ce) => {
|
|
@@ -4560,7 +4548,7 @@ function wo({ screenCode: e }) {
|
|
|
4560
4548
|
}
|
|
4561
4549
|
} : void 0
|
|
4562
4550
|
},
|
|
4563
|
-
|
|
4551
|
+
S
|
|
4564
4552
|
);
|
|
4565
4553
|
}),
|
|
4566
4554
|
h.actions === void 0 && !(v != null && v.readonly) && /* @__PURE__ */ d(j, { onClick: () => t(`${h.route}/new`, { title: `New ${P($e.name)}`, icon: ft }), children: [
|
|
@@ -4573,19 +4561,19 @@ function wo({ screenCode: e }) {
|
|
|
4573
4561
|
),
|
|
4574
4562
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-3 mb-2", children: [
|
|
4575
4563
|
/* @__PURE__ */ n(
|
|
4576
|
-
|
|
4564
|
+
yo,
|
|
4577
4565
|
{
|
|
4578
4566
|
views: N,
|
|
4579
4567
|
activeViewId: r.get("view"),
|
|
4580
4568
|
isDirty: !1,
|
|
4581
|
-
onSelect: (
|
|
4582
|
-
if (!
|
|
4569
|
+
onSelect: (S) => {
|
|
4570
|
+
if (!S.id) {
|
|
4583
4571
|
const H = new URLSearchParams();
|
|
4584
4572
|
r.get("search") && H.set("search", r.get("search")), s(H);
|
|
4585
4573
|
return;
|
|
4586
4574
|
}
|
|
4587
|
-
const
|
|
4588
|
-
|
|
4575
|
+
const D = new URLSearchParams(r);
|
|
4576
|
+
D.set("view", S.id), S.filters && Array.isArray(S.filters) && S.filters.length > 0 && D.set("filters", JSON.stringify(S.filters)), S.columns && S.columns.length > 0 && D.set("columns", S.columns.join(",")), S.sort && D.set("sort", S.sort), D.set("page", "1"), s(D);
|
|
4589
4577
|
}
|
|
4590
4578
|
}
|
|
4591
4579
|
),
|
|
@@ -4596,7 +4584,7 @@ function wo({ screenCode: e }) {
|
|
|
4596
4584
|
{
|
|
4597
4585
|
placeholder: `Search ${Pt.toLowerCase()}...`,
|
|
4598
4586
|
value: R,
|
|
4599
|
-
onChange: (
|
|
4587
|
+
onChange: (S) => ar(S.target.value),
|
|
4600
4588
|
className: "pl-9"
|
|
4601
4589
|
}
|
|
4602
4590
|
)
|
|
@@ -4616,34 +4604,34 @@ function wo({ screenCode: e }) {
|
|
|
4616
4604
|
}
|
|
4617
4605
|
),
|
|
4618
4606
|
/* @__PURE__ */ n(
|
|
4619
|
-
|
|
4607
|
+
vo,
|
|
4620
4608
|
{
|
|
4621
4609
|
availableColumns: h.columns ?? [],
|
|
4622
4610
|
visibleColumns: V,
|
|
4623
|
-
onToggle: (
|
|
4624
|
-
const
|
|
4625
|
-
H.length !== 0 && (
|
|
4611
|
+
onToggle: (S) => {
|
|
4612
|
+
const D = new URLSearchParams(r), H = V.includes(S) ? V.filter((ne) => ne !== S) : [...V, S];
|
|
4613
|
+
H.length !== 0 && (D.set("columns", H.join(",")), s(D));
|
|
4626
4614
|
},
|
|
4627
4615
|
onReset: () => {
|
|
4628
|
-
const
|
|
4629
|
-
|
|
4616
|
+
const S = new URLSearchParams(r);
|
|
4617
|
+
S.delete("columns"), s(S);
|
|
4630
4618
|
},
|
|
4631
4619
|
onShowAll: () => {
|
|
4632
|
-
const
|
|
4633
|
-
|
|
4620
|
+
const S = new URLSearchParams(r);
|
|
4621
|
+
S.set("columns", (h.columns ?? []).join(",")), s(S);
|
|
4634
4622
|
},
|
|
4635
|
-
columnLabel: (
|
|
4623
|
+
columnLabel: (S) => {
|
|
4636
4624
|
var H, ne;
|
|
4637
|
-
if (
|
|
4638
|
-
const te =
|
|
4639
|
-
return G ? P(G.name) || te :
|
|
4625
|
+
if (S.startsWith("$status.")) {
|
|
4626
|
+
const te = S.slice(8), G = (H = v.status_groups) == null ? void 0 : H[te];
|
|
4627
|
+
return G ? P(G.name) || te : S;
|
|
4640
4628
|
}
|
|
4641
|
-
if (
|
|
4642
|
-
const te =
|
|
4643
|
-
return G ? P(G.name) || te :
|
|
4629
|
+
if (S.startsWith("$property.")) {
|
|
4630
|
+
const te = S.slice(10), G = (ne = v.properties) == null ? void 0 : ne[te];
|
|
4631
|
+
return G ? P(G.name) || te : S;
|
|
4644
4632
|
}
|
|
4645
|
-
const
|
|
4646
|
-
return
|
|
4633
|
+
const D = v.fields[S];
|
|
4634
|
+
return D ? De(D, S, i == null ? void 0 : i.entities) : S;
|
|
4647
4635
|
}
|
|
4648
4636
|
}
|
|
4649
4637
|
),
|
|
@@ -4662,24 +4650,24 @@ function wo({ screenCode: e }) {
|
|
|
4662
4650
|
)
|
|
4663
4651
|
] }),
|
|
4664
4652
|
/* @__PURE__ */ n(
|
|
4665
|
-
|
|
4653
|
+
mo,
|
|
4666
4654
|
{
|
|
4667
4655
|
filters: g,
|
|
4668
|
-
onRemove: (
|
|
4656
|
+
onRemove: (S) => b(zt(g, S)),
|
|
4669
4657
|
onClearAll: w,
|
|
4670
4658
|
onChipClick: () => p(!0),
|
|
4671
|
-
fieldLabel: (
|
|
4659
|
+
fieldLabel: (S) => {
|
|
4672
4660
|
var H, ne;
|
|
4673
|
-
if (
|
|
4674
|
-
const te =
|
|
4675
|
-
return G ? P(G.name) || te :
|
|
4661
|
+
if (S.startsWith("$status.")) {
|
|
4662
|
+
const te = S.slice(8), G = (H = v.status_groups) == null ? void 0 : H[te];
|
|
4663
|
+
return G ? P(G.name) || te : S;
|
|
4676
4664
|
}
|
|
4677
|
-
if (
|
|
4678
|
-
const te =
|
|
4679
|
-
return G ? P(G.name) || te :
|
|
4665
|
+
if (S.startsWith("$property.")) {
|
|
4666
|
+
const te = S.slice(10), G = (ne = v.properties) == null ? void 0 : ne[te];
|
|
4667
|
+
return G ? P(G.name) || te : S;
|
|
4680
4668
|
}
|
|
4681
|
-
const
|
|
4682
|
-
return
|
|
4669
|
+
const D = v.fields[S];
|
|
4670
|
+
return D ? De(D, S, i == null ? void 0 : i.entities) : S;
|
|
4683
4671
|
}
|
|
4684
4672
|
}
|
|
4685
4673
|
)
|
|
@@ -4704,34 +4692,34 @@ function wo({ screenCode: e }) {
|
|
|
4704
4692
|
] }) : void 0
|
|
4705
4693
|
}
|
|
4706
4694
|
) }) : /* @__PURE__ */ n("div", { ref: At, className: "flex-1 overflow-auto px-6", children: /* @__PURE__ */ d("table", { className: "w-full text-sm", children: [
|
|
4707
|
-
/* @__PURE__ */ n("thead", { className: "sticky top-0 bg-[var(--background)] z-10", children: ut.getHeaderGroups().map((
|
|
4708
|
-
const H =
|
|
4695
|
+
/* @__PURE__ */ n("thead", { className: "sticky top-0 bg-[var(--background)] z-10", children: ut.getHeaderGroups().map((S) => /* @__PURE__ */ n("tr", { className: "border-b", children: S.headers.map((D) => {
|
|
4696
|
+
const H = D.id !== "_actions", ne = D.column.getIsSorted();
|
|
4709
4697
|
return /* @__PURE__ */ n(
|
|
4710
4698
|
"th",
|
|
4711
4699
|
{
|
|
4712
4700
|
className: "h-10 px-3 text-left align-middle font-medium text-[var(--muted-foreground)]",
|
|
4713
|
-
style: { width:
|
|
4714
|
-
children:
|
|
4701
|
+
style: { width: D.getSize() },
|
|
4702
|
+
children: D.isPlaceholder ? null : H ? /* @__PURE__ */ d(
|
|
4715
4703
|
"button",
|
|
4716
4704
|
{
|
|
4717
4705
|
className: "inline-flex items-center gap-1 hover:text-[var(--foreground)] transition-colors",
|
|
4718
|
-
onClick:
|
|
4706
|
+
onClick: D.column.getToggleSortingHandler(),
|
|
4719
4707
|
children: [
|
|
4720
4708
|
dr(
|
|
4721
|
-
|
|
4722
|
-
|
|
4709
|
+
D.column.columnDef.header,
|
|
4710
|
+
D.getContext()
|
|
4723
4711
|
),
|
|
4724
4712
|
ne === "asc" ? /* @__PURE__ */ n(ri, { className: "w-3 h-3" }) : ne === "desc" ? /* @__PURE__ */ n(ni, { className: "w-3 h-3" }) : /* @__PURE__ */ n(si, { className: "w-3 h-3 opacity-40" })
|
|
4725
4713
|
]
|
|
4726
4714
|
}
|
|
4727
4715
|
) : dr(
|
|
4728
|
-
|
|
4729
|
-
|
|
4716
|
+
D.column.columnDef.header,
|
|
4717
|
+
D.getContext()
|
|
4730
4718
|
)
|
|
4731
4719
|
},
|
|
4732
|
-
|
|
4720
|
+
D.id
|
|
4733
4721
|
);
|
|
4734
|
-
}) },
|
|
4722
|
+
}) }, S.id)) }),
|
|
4735
4723
|
/* @__PURE__ */ d("tbody", { children: [
|
|
4736
4724
|
We.getVirtualItems().length > 0 && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n(
|
|
4737
4725
|
"td",
|
|
@@ -4740,20 +4728,20 @@ function wo({ screenCode: e }) {
|
|
|
4740
4728
|
colSpan: Ze.length
|
|
4741
4729
|
}
|
|
4742
4730
|
) }),
|
|
4743
|
-
We.getVirtualItems().map((
|
|
4744
|
-
const
|
|
4731
|
+
We.getVirtualItems().map((S) => {
|
|
4732
|
+
const D = et[S.index], H = M && D.original[v.soft_delete] != null;
|
|
4745
4733
|
return /* @__PURE__ */ n(
|
|
4746
4734
|
"tr",
|
|
4747
4735
|
{
|
|
4748
|
-
"data-index":
|
|
4736
|
+
"data-index": S.index,
|
|
4749
4737
|
ref: (ne) => We.measureElement(ne),
|
|
4750
4738
|
className: J(
|
|
4751
4739
|
"border-b transition-colors",
|
|
4752
4740
|
Dt && "hover:bg-[var(--muted)]/50 cursor-pointer",
|
|
4753
4741
|
H && "opacity-50 italic"
|
|
4754
4742
|
),
|
|
4755
|
-
onClick: Dt ? () => lr(
|
|
4756
|
-
children:
|
|
4743
|
+
onClick: Dt ? () => lr(D.original) : void 0,
|
|
4744
|
+
children: D.getVisibleCells().map((ne) => /* @__PURE__ */ n(
|
|
4757
4745
|
"td",
|
|
4758
4746
|
{
|
|
4759
4747
|
className: "px-3 py-2.5 align-middle",
|
|
@@ -4767,7 +4755,7 @@ function wo({ screenCode: e }) {
|
|
|
4767
4755
|
ne.id
|
|
4768
4756
|
))
|
|
4769
4757
|
},
|
|
4770
|
-
|
|
4758
|
+
D.id
|
|
4771
4759
|
);
|
|
4772
4760
|
}),
|
|
4773
4761
|
We.getVirtualItems().length > 0 && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n(
|
|
@@ -4823,20 +4811,20 @@ function wo({ screenCode: e }) {
|
|
|
4823
4811
|
] })
|
|
4824
4812
|
] }),
|
|
4825
4813
|
/* @__PURE__ */ n(
|
|
4826
|
-
|
|
4814
|
+
po,
|
|
4827
4815
|
{
|
|
4828
4816
|
open: m,
|
|
4829
4817
|
onClose: () => p(!1),
|
|
4830
4818
|
filters: g,
|
|
4831
4819
|
onApply: b,
|
|
4832
|
-
availableFields:
|
|
4820
|
+
availableFields: wo(h, v, i == null ? void 0 : i.entities)
|
|
4833
4821
|
}
|
|
4834
4822
|
),
|
|
4835
4823
|
/* @__PURE__ */ n(
|
|
4836
4824
|
Zr,
|
|
4837
4825
|
{
|
|
4838
4826
|
open: a !== null,
|
|
4839
|
-
onOpenChange: (
|
|
4827
|
+
onOpenChange: (S) => !S && l(null),
|
|
4840
4828
|
title: `Delete ${P($e.name)}`,
|
|
4841
4829
|
description: a != null && a.confirmation ? a.confirmation : M ? `Are you sure you want to delete this ${P($e.name).toLowerCase()}? It can be restored later by an admin.` : `Are you sure you want to delete this ${P($e.name).toLowerCase()}? This action cannot be undone.`,
|
|
4842
4830
|
confirmLabel: "Delete",
|
|
@@ -4846,7 +4834,7 @@ function wo({ screenCode: e }) {
|
|
|
4846
4834
|
)
|
|
4847
4835
|
] });
|
|
4848
4836
|
}
|
|
4849
|
-
function
|
|
4837
|
+
function wo(e, t, r) {
|
|
4850
4838
|
var a, l, c;
|
|
4851
4839
|
if (!e || !t) return [];
|
|
4852
4840
|
const s = e.filters ?? Object.keys(t.fields), i = [];
|
|
@@ -4880,7 +4868,7 @@ function _o(e, t, r) {
|
|
|
4880
4868
|
}
|
|
4881
4869
|
const u = t.fields[o];
|
|
4882
4870
|
if (!u) continue;
|
|
4883
|
-
const f = De(u, o, r), m =
|
|
4871
|
+
const f = De(u, o, r), m = _o(u.type), p = (c = u.values) == null ? void 0 : c.map((g) => ({
|
|
4884
4872
|
value: g.code,
|
|
4885
4873
|
label: P(g.name) || g.code,
|
|
4886
4874
|
color: g.color
|
|
@@ -4889,7 +4877,7 @@ function _o(e, t, r) {
|
|
|
4889
4877
|
}
|
|
4890
4878
|
return i;
|
|
4891
4879
|
}
|
|
4892
|
-
function
|
|
4880
|
+
function _o(e) {
|
|
4893
4881
|
switch (e) {
|
|
4894
4882
|
case "string":
|
|
4895
4883
|
case "text":
|
|
@@ -4960,7 +4948,7 @@ function bs(e, t) {
|
|
|
4960
4948
|
enabled: !!e && !!t && t !== "new" && r !== void 0
|
|
4961
4949
|
});
|
|
4962
4950
|
}
|
|
4963
|
-
function
|
|
4951
|
+
function So({
|
|
4964
4952
|
entityCode: e,
|
|
4965
4953
|
recordId: t,
|
|
4966
4954
|
associations: r,
|
|
@@ -4969,7 +4957,7 @@ function ko({
|
|
|
4969
4957
|
const i = ee(
|
|
4970
4958
|
() => Object.entries(r),
|
|
4971
4959
|
[r]
|
|
4972
|
-
), [a, l] =
|
|
4960
|
+
), [a, l] = I(0);
|
|
4973
4961
|
if (i.length === 0) return null;
|
|
4974
4962
|
const [c, o] = i[a];
|
|
4975
4963
|
return /* @__PURE__ */ d(xt, { children: [
|
|
@@ -4992,7 +4980,7 @@ function ko({
|
|
|
4992
4980
|
);
|
|
4993
4981
|
}) }) }),
|
|
4994
4982
|
/* @__PURE__ */ n(Nt, { className: "pt-0", children: /* @__PURE__ */ n(
|
|
4995
|
-
|
|
4983
|
+
ko,
|
|
4996
4984
|
{
|
|
4997
4985
|
entityCode: e,
|
|
4998
4986
|
recordId: t,
|
|
@@ -5003,22 +4991,22 @@ function ko({
|
|
|
5003
4991
|
) })
|
|
5004
4992
|
] });
|
|
5005
4993
|
}
|
|
5006
|
-
function
|
|
4994
|
+
function ko({
|
|
5007
4995
|
entityCode: e,
|
|
5008
4996
|
recordId: t,
|
|
5009
4997
|
assocKey: r,
|
|
5010
4998
|
association: s,
|
|
5011
4999
|
schema: i
|
|
5012
5000
|
}) {
|
|
5013
|
-
const a =
|
|
5001
|
+
const a = Ut(), l = `${e}.${r}`, { data: c, isLoading: o } = Ve({
|
|
5014
5002
|
queryKey: ["association", l, t],
|
|
5015
5003
|
queryFn: () => Wr(l, [t])
|
|
5016
5004
|
}), u = (c == null ? void 0 : c.target_entity) ?? s.target, f = i.entities[u], m = (c == null ? void 0 : c.ids) ?? [], p = ee(
|
|
5017
5005
|
() => {
|
|
5018
5006
|
var k;
|
|
5019
|
-
return ((k = f == null ? void 0 : f.field_order) == null ? void 0 : k.find((
|
|
5020
|
-
var
|
|
5021
|
-
return (
|
|
5007
|
+
return ((k = f == null ? void 0 : f.field_order) == null ? void 0 : k.find((A) => {
|
|
5008
|
+
var _;
|
|
5009
|
+
return (_ = f.fields[A]) == null ? void 0 : _.primary;
|
|
5022
5010
|
})) ?? "id";
|
|
5023
5011
|
},
|
|
5024
5012
|
[f]
|
|
@@ -5030,18 +5018,18 @@ function Co({
|
|
|
5030
5018
|
}),
|
|
5031
5019
|
enabled: g.length > 0 && !!f
|
|
5032
5020
|
}), w = (y == null ? void 0 : y.data) ?? [], x = y == null ? void 0 : y.$refs, N = ee(() => f ? f.field_order.filter((k) => {
|
|
5033
|
-
var
|
|
5034
|
-
const
|
|
5035
|
-
return
|
|
5021
|
+
var _;
|
|
5022
|
+
const A = f.fields[k];
|
|
5023
|
+
return A && !A.primary && !A.auto && ((_ = A.display) == null ? void 0 : _.is_listable) !== !1;
|
|
5036
5024
|
}).slice(0, 6) : [], [f]), h = () => {
|
|
5037
5025
|
var T, $;
|
|
5038
5026
|
const k = er(i, u);
|
|
5039
5027
|
if (!k) return;
|
|
5040
|
-
const
|
|
5041
|
-
|
|
5042
|
-
title:
|
|
5028
|
+
const A = P((T = s.display) == null ? void 0 : T.name) || r, _ = new URLSearchParams();
|
|
5029
|
+
_.set("filters", JSON.stringify([{ field: p, op: "in", value: m }])), a(k.route, {
|
|
5030
|
+
title: A,
|
|
5043
5031
|
icon: (($ = s.display) == null ? void 0 : $.icon) || k.icon,
|
|
5044
|
-
search:
|
|
5032
|
+
search: _.toString()
|
|
5045
5033
|
});
|
|
5046
5034
|
};
|
|
5047
5035
|
if (o || b)
|
|
@@ -5061,17 +5049,17 @@ function Co({
|
|
|
5061
5049
|
},
|
|
5062
5050
|
k
|
|
5063
5051
|
)) }) }),
|
|
5064
|
-
/* @__PURE__ */ n("tbody", { children: w.map((k,
|
|
5065
|
-
const T = f.fields[
|
|
5052
|
+
/* @__PURE__ */ n("tbody", { children: w.map((k, A) => /* @__PURE__ */ n("tr", { className: "border-b last:border-0", children: N.map((_) => {
|
|
5053
|
+
const T = f.fields[_];
|
|
5066
5054
|
return T ? /* @__PURE__ */ n("td", { className: "px-3 py-2 align-middle", children: oe({
|
|
5067
5055
|
field: T,
|
|
5068
|
-
fieldName:
|
|
5069
|
-
value: k[
|
|
5056
|
+
fieldName: _,
|
|
5057
|
+
value: k[_],
|
|
5070
5058
|
mode: "display",
|
|
5071
5059
|
record: k,
|
|
5072
5060
|
refs: x
|
|
5073
|
-
}) },
|
|
5074
|
-
}) },
|
|
5061
|
+
}) }, _) : /* @__PURE__ */ n("td", {}, _);
|
|
5062
|
+
}) }, A)) })
|
|
5075
5063
|
] }),
|
|
5076
5064
|
v && c && c.count > w.length && /* @__PURE__ */ n("div", { className: "pt-3 text-center", children: /* @__PURE__ */ d(j, { variant: "outline", size: "sm", onClick: h, children: [
|
|
5077
5065
|
/* @__PURE__ */ n(_r, { className: "w-3 h-3 mr-1.5" }),
|
|
@@ -5085,12 +5073,12 @@ function Co({
|
|
|
5085
5073
|
] }) })
|
|
5086
5074
|
] });
|
|
5087
5075
|
}
|
|
5088
|
-
const
|
|
5076
|
+
const Co = /^(\d+)px$/;
|
|
5089
5077
|
function sn(e) {
|
|
5090
5078
|
if (e == null || e === "") return null;
|
|
5091
5079
|
if (e === "auto") return { kind: "auto" };
|
|
5092
5080
|
if (e === "fill") return { kind: "fill" };
|
|
5093
|
-
const t =
|
|
5081
|
+
const t = Co.exec(e);
|
|
5094
5082
|
if (t) {
|
|
5095
5083
|
const s = parseInt(t[1], 10);
|
|
5096
5084
|
return s > 0 ? { kind: "px", value: s } : null;
|
|
@@ -5098,8 +5086,8 @@ function sn(e) {
|
|
|
5098
5086
|
const r = parseInt(e, 10);
|
|
5099
5087
|
return !isNaN(r) && String(r) === e && r > 0 ? { kind: "weight", value: r } : null;
|
|
5100
5088
|
}
|
|
5101
|
-
function
|
|
5102
|
-
const { items: r, gap: s = 0, resizable: i = !1, stack_below: a } = e, l = a === "never" ? 0 : a ?? 768, [c, o] =
|
|
5089
|
+
function To({ config: e, ctx: t }) {
|
|
5090
|
+
const { items: r, gap: s = 0, resizable: i = !1, stack_below: a } = e, l = a === "never" ? 0 : a ?? 768, [c, o] = I(!1), u = me(null);
|
|
5103
5091
|
le(() => {
|
|
5104
5092
|
if (l === 0) return;
|
|
5105
5093
|
const x = u.current;
|
|
@@ -5110,7 +5098,7 @@ function Ao({ config: e, ctx: t }) {
|
|
|
5110
5098
|
});
|
|
5111
5099
|
return N.observe(x), () => N.disconnect();
|
|
5112
5100
|
}, [l]);
|
|
5113
|
-
const [f, m] =
|
|
5101
|
+
const [f, m] = I(null), p = me(null), g = z(() => r.map((x) => {
|
|
5114
5102
|
var v, k;
|
|
5115
5103
|
const N = x.width ?? ((v = x.column) == null ? void 0 : v.width) ?? ((k = x.row) == null ? void 0 : k.width) ?? e.width, h = sn(N);
|
|
5116
5104
|
return h && h.kind === "weight" ? h.value : 1;
|
|
@@ -5119,18 +5107,18 @@ function Ao({ config: e, ctx: t }) {
|
|
|
5119
5107
|
N.preventDefault();
|
|
5120
5108
|
const h = f ?? g();
|
|
5121
5109
|
p.current = { index: x, startX: N.clientX, startSizes: [...h] };
|
|
5122
|
-
const v = (
|
|
5123
|
-
const
|
|
5124
|
-
if (!
|
|
5125
|
-
const T = u.current.getBoundingClientRect().width, $ =
|
|
5126
|
-
q[
|
|
5110
|
+
const v = (A) => {
|
|
5111
|
+
const _ = p.current;
|
|
5112
|
+
if (!_ || !u.current) return;
|
|
5113
|
+
const T = u.current.getBoundingClientRect().width, $ = A.clientX - _.startX, F = _.startSizes.reduce((E, U) => E + U, 0), M = $ / T * F, q = [..._.startSizes];
|
|
5114
|
+
q[_.index] = Math.max(0.1, _.startSizes[_.index] + M), q[_.index + 1] = Math.max(0.1, _.startSizes[_.index + 1] - M), m(q);
|
|
5127
5115
|
}, k = () => {
|
|
5128
5116
|
p.current = null, document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", k);
|
|
5129
5117
|
};
|
|
5130
5118
|
document.addEventListener("mousemove", v), document.addEventListener("mouseup", k);
|
|
5131
5119
|
},
|
|
5132
5120
|
[f, g]
|
|
5133
|
-
), b = f ?? g(), w = e.height ?
|
|
5121
|
+
), b = f ?? g(), w = e.height ? Do(e.height) : void 0;
|
|
5134
5122
|
return /* @__PURE__ */ n(
|
|
5135
5123
|
"div",
|
|
5136
5124
|
{
|
|
@@ -5143,7 +5131,7 @@ function Ao({ config: e, ctx: t }) {
|
|
|
5143
5131
|
"div",
|
|
5144
5132
|
{
|
|
5145
5133
|
className: J("min-w-0 flex items-stretch", c && "w-full"),
|
|
5146
|
-
style: c ? void 0 :
|
|
5134
|
+
style: c ? void 0 : Ao(x.width ?? ((h = x.column) == null ? void 0 : h.width) ?? ((v = x.row) == null ? void 0 : v.width) ?? e.width, b[N], x.min_width, x.max_width),
|
|
5147
5135
|
children: [
|
|
5148
5136
|
/* @__PURE__ */ n("div", { className: J("flex-1 min-w-0 flex flex-col", w && "overflow-y-auto overflow-x-hidden"), children: /* @__PURE__ */ n(ir, { node: x, ctx: t }) }),
|
|
5149
5137
|
i && !c && N < r.length - 1 && /* @__PURE__ */ n(
|
|
@@ -5161,19 +5149,19 @@ function Ao({ config: e, ctx: t }) {
|
|
|
5161
5149
|
}
|
|
5162
5150
|
);
|
|
5163
5151
|
}
|
|
5164
|
-
function
|
|
5152
|
+
function Ao(e, t, r, s) {
|
|
5165
5153
|
const i = sn(e);
|
|
5166
5154
|
let a;
|
|
5167
5155
|
return !i || i.kind === "weight" ? a = `${t} 1 0%` : i.kind === "px" ? a = `0 0 ${i.value}px` : i.kind === "fill" ? a = "1 1 0%" : a = "0 0 auto", { flex: a, minWidth: r, maxWidth: s };
|
|
5168
5156
|
}
|
|
5169
|
-
function
|
|
5157
|
+
function Do(e) {
|
|
5170
5158
|
if (!e) return;
|
|
5171
5159
|
const t = sn(e);
|
|
5172
5160
|
if ((t == null ? void 0 : t.kind) === "px") return { height: `${t.value}px`, overflow: "hidden" };
|
|
5173
5161
|
if (typeof e == "string" && (e.includes("vh") || e.includes("calc") || e.includes("%")))
|
|
5174
5162
|
return { height: e, overflow: "hidden" };
|
|
5175
5163
|
}
|
|
5176
|
-
function
|
|
5164
|
+
function Po({ config: e, ctx: t }) {
|
|
5177
5165
|
const { items: r, gap: s = 12 } = e;
|
|
5178
5166
|
return /* @__PURE__ */ n(
|
|
5179
5167
|
"div",
|
|
@@ -5184,7 +5172,7 @@ function $o({ config: e, ctx: t }) {
|
|
|
5184
5172
|
}
|
|
5185
5173
|
);
|
|
5186
5174
|
}
|
|
5187
|
-
function
|
|
5175
|
+
function $o(e, t) {
|
|
5188
5176
|
var r, s;
|
|
5189
5177
|
if (e.children) {
|
|
5190
5178
|
if (e.label) return P(e.label);
|
|
@@ -5195,7 +5183,7 @@ function Ro(e, t) {
|
|
|
5195
5183
|
}
|
|
5196
5184
|
return e.section ? P(e.section.name) : "Tab";
|
|
5197
5185
|
}
|
|
5198
|
-
function
|
|
5186
|
+
function Ro(e, t) {
|
|
5199
5187
|
var r, s;
|
|
5200
5188
|
if (e.icon) return e.icon;
|
|
5201
5189
|
if (e.children) {
|
|
@@ -5205,11 +5193,11 @@ function Eo(e, t) {
|
|
|
5205
5193
|
if (a) return a.display.icon;
|
|
5206
5194
|
}
|
|
5207
5195
|
}
|
|
5208
|
-
function
|
|
5209
|
-
const { items: r } = e, [s, i] =
|
|
5196
|
+
function Eo({ config: e, ctx: t }) {
|
|
5197
|
+
const { items: r } = e, [s, i] = I(0);
|
|
5210
5198
|
return r.length === 0 ? null : /* @__PURE__ */ d(xt, { children: [
|
|
5211
5199
|
/* @__PURE__ */ n(bt, { className: "py-3", children: /* @__PURE__ */ n("div", { className: "flex items-center gap-1 border-b border-[var(--border)]", children: r.map((a, l) => {
|
|
5212
|
-
const c =
|
|
5200
|
+
const c = $o(a, t), o = Ro(a, t);
|
|
5213
5201
|
return /* @__PURE__ */ d(
|
|
5214
5202
|
"button",
|
|
5215
5203
|
{
|
|
@@ -5236,8 +5224,8 @@ function Oo({ config: e, ctx: t }) {
|
|
|
5236
5224
|
) })
|
|
5237
5225
|
] });
|
|
5238
5226
|
}
|
|
5239
|
-
function
|
|
5240
|
-
const { name: r, items: s, collapsed: i = !1, columns: a } = e, [l, c] =
|
|
5227
|
+
function Oo({ config: e, ctx: t }) {
|
|
5228
|
+
const { name: r, items: s, collapsed: i = !1, columns: a } = e, [l, c] = I(i), o = a ? { ...t, columns: a } : t;
|
|
5241
5229
|
return /* @__PURE__ */ d(xt, { children: [
|
|
5242
5230
|
/* @__PURE__ */ n(
|
|
5243
5231
|
bt,
|
|
@@ -5261,21 +5249,21 @@ function Fo({ config: e, ctx: t }) {
|
|
|
5261
5249
|
!l && /* @__PURE__ */ n(Nt, { children: /* @__PURE__ */ n(rr, { nodes: s, ctx: o }) })
|
|
5262
5250
|
] });
|
|
5263
5251
|
}
|
|
5264
|
-
function
|
|
5252
|
+
function Fo(e, t, r) {
|
|
5265
5253
|
const s = e.display, i = {
|
|
5266
5254
|
entity: e.entity,
|
|
5267
5255
|
foreign_key: e.foreign_key,
|
|
5268
|
-
name: it(r == null ? void 0 : r.label, s == null ? void 0 : s.name,
|
|
5256
|
+
name: it(r == null ? void 0 : r.label, s == null ? void 0 : s.name, Lo(t)),
|
|
5269
5257
|
icon: it(r == null ? void 0 : r.icon, s == null ? void 0 : s.icon, t.display.icon) ?? "",
|
|
5270
5258
|
mode: it(r == null ? void 0 : r.mode, s == null ? void 0 : s.mode, "table"),
|
|
5271
|
-
columns: it(r == null ? void 0 : r.columns, s == null ? void 0 : s.columns,
|
|
5272
|
-
sort: it(r == null ? void 0 : r.sort, s == null ? void 0 : s.sort,
|
|
5259
|
+
columns: it(r == null ? void 0 : r.columns, s == null ? void 0 : s.columns, jo(t, e.foreign_key)),
|
|
5260
|
+
sort: it(r == null ? void 0 : r.sort, s == null ? void 0 : s.sort, qo(t)),
|
|
5273
5261
|
limit: it(r == null ? void 0 : r.limit, s == null ? void 0 : s.limit, 20),
|
|
5274
5262
|
editable: it(r == null ? void 0 : r.editable, s == null ? void 0 : s.editable, !0)
|
|
5275
5263
|
}, a = it(r == null ? void 0 : r.position_field, s == null ? void 0 : s.position_field, void 0);
|
|
5276
5264
|
a && (i.position_field = a, i.sort = a + ":asc");
|
|
5277
5265
|
const l = (r == null ? void 0 : r.timeline) ?? (s == null ? void 0 : s.timeline);
|
|
5278
|
-
i.mode === "timeline" ? i.timeline =
|
|
5266
|
+
i.mode === "timeline" ? i.timeline = zo(l ?? {}, t) : l && (i.timeline = l);
|
|
5279
5267
|
const c = (r == null ? void 0 : r.cards) ?? (s == null ? void 0 : s.cards);
|
|
5280
5268
|
c && (i.cards = c);
|
|
5281
5269
|
const o = (r == null ? void 0 : r.quick_add) ?? e.quick_add;
|
|
@@ -5284,10 +5272,10 @@ function Lo(e, t, r) {
|
|
|
5284
5272
|
function it(e, t, r) {
|
|
5285
5273
|
return e ?? t ?? r;
|
|
5286
5274
|
}
|
|
5287
|
-
function
|
|
5275
|
+
function Lo(e) {
|
|
5288
5276
|
return e.display.name_plural && Object.keys(e.display.name_plural).length > 0 ? e.display.name_plural : e.display.name;
|
|
5289
5277
|
}
|
|
5290
|
-
function
|
|
5278
|
+
function qo(e) {
|
|
5291
5279
|
var r, s;
|
|
5292
5280
|
if (((r = e.fields.created_at) == null ? void 0 : r.type) === "timestamp")
|
|
5293
5281
|
return "created_at:desc";
|
|
@@ -5303,10 +5291,10 @@ function jo(e) {
|
|
|
5303
5291
|
if (a && a.type === "date")
|
|
5304
5292
|
return i + ":desc";
|
|
5305
5293
|
}
|
|
5306
|
-
const t =
|
|
5294
|
+
const t = Ko(e);
|
|
5307
5295
|
return t ? t + ":asc" : "";
|
|
5308
5296
|
}
|
|
5309
|
-
function
|
|
5297
|
+
function jo(e, t) {
|
|
5310
5298
|
var i;
|
|
5311
5299
|
const r = new Set(Array.isArray(t) ? t : [t]), s = [];
|
|
5312
5300
|
for (const a of e.field_order) {
|
|
@@ -5316,11 +5304,11 @@ function zo(e, t) {
|
|
|
5316
5304
|
}
|
|
5317
5305
|
return s;
|
|
5318
5306
|
}
|
|
5319
|
-
function
|
|
5307
|
+
function zo(e, t) {
|
|
5320
5308
|
const r = { ...e };
|
|
5321
|
-
return r.time_field || (r.time_field =
|
|
5309
|
+
return r.time_field || (r.time_field = Io(t)), r.type_field || (r.type_field = gn(t, "enum")), r.summary_field || (r.summary_field = Vo(t, "string", "text")), r.content_field || (r.content_field = gn(t, "text")), r.author_field || t.fields.created_by && (r.author_field = "created_by"), r.direction_field || (r.direction_field = Mo(t)), r.intent_field || (r.intent_field = Uo(t)), r;
|
|
5322
5310
|
}
|
|
5323
|
-
function
|
|
5311
|
+
function Mo(e) {
|
|
5324
5312
|
const t = e.fields.direction;
|
|
5325
5313
|
if (t && t.type === "enum") return "direction";
|
|
5326
5314
|
for (const r of ["is_outbound", "outbound", "is_inbound", "inbound"]) {
|
|
@@ -5332,7 +5320,7 @@ function Uo(e) {
|
|
|
5332
5320
|
const t = e.fields.intent;
|
|
5333
5321
|
if (t && t.type === "enum") return "intent";
|
|
5334
5322
|
}
|
|
5335
|
-
function
|
|
5323
|
+
function Io(e) {
|
|
5336
5324
|
var t, r;
|
|
5337
5325
|
for (const s of e.field_order) {
|
|
5338
5326
|
const i = e.fields[s];
|
|
@@ -5353,7 +5341,7 @@ function gn(e, t) {
|
|
|
5353
5341
|
return r;
|
|
5354
5342
|
}
|
|
5355
5343
|
}
|
|
5356
|
-
function
|
|
5344
|
+
function Vo(e, ...t) {
|
|
5357
5345
|
for (const r of e.field_order) {
|
|
5358
5346
|
const s = e.fields[r];
|
|
5359
5347
|
if (s) {
|
|
@@ -5362,15 +5350,15 @@ function Ko(e, ...t) {
|
|
|
5362
5350
|
}
|
|
5363
5351
|
}
|
|
5364
5352
|
}
|
|
5365
|
-
function
|
|
5353
|
+
function Ko(e) {
|
|
5366
5354
|
const t = qr(e);
|
|
5367
5355
|
return t.length > 0 ? t[0] : void 0;
|
|
5368
5356
|
}
|
|
5369
|
-
function
|
|
5357
|
+
function Wo(e, t) {
|
|
5370
5358
|
var r;
|
|
5371
5359
|
return (r = e.children) == null ? void 0 : r.find((s) => s.entity === t);
|
|
5372
5360
|
}
|
|
5373
|
-
function
|
|
5361
|
+
function Ho(e, t, r, s) {
|
|
5374
5362
|
const i = {
|
|
5375
5363
|
...t ?? {},
|
|
5376
5364
|
...e
|
|
@@ -5383,7 +5371,7 @@ function Jo(e, t, r, s) {
|
|
|
5383
5371
|
i[r] = Array.isArray(s) ? s[0] : s;
|
|
5384
5372
|
return i;
|
|
5385
5373
|
}
|
|
5386
|
-
function
|
|
5374
|
+
function Jo(e, t) {
|
|
5387
5375
|
for (const r of t) {
|
|
5388
5376
|
const s = e[r];
|
|
5389
5377
|
if (s == null || s === "") return !1;
|
|
@@ -5395,25 +5383,25 @@ function vn() {
|
|
|
5395
5383
|
return `${t}-${r}-${s}T${i}:${a}`;
|
|
5396
5384
|
}
|
|
5397
5385
|
function Ns(e, t, r, s) {
|
|
5398
|
-
const [i, a] =
|
|
5386
|
+
const [i, a] = I(() => {
|
|
5399
5387
|
var v, k;
|
|
5400
5388
|
const x = e.quick_add, N = s.entities[e.entity], h = {};
|
|
5401
5389
|
if (x != null && x.fields)
|
|
5402
|
-
for (const
|
|
5403
|
-
((v = x.defaults) == null ? void 0 : v[
|
|
5390
|
+
for (const A of x.fields)
|
|
5391
|
+
((v = x.defaults) == null ? void 0 : v[A]) != null ? h[A] = x.defaults[A] : ((k = N == null ? void 0 : N.fields[A]) == null ? void 0 : k.type) === "timestamp" && (h[A] = vn());
|
|
5404
5392
|
return h;
|
|
5405
5393
|
}), l = Fe(), { mutate: c, isPending: o, error: u, reset: f } = Ee({
|
|
5406
|
-
mutationFn: (x) =>
|
|
5394
|
+
mutationFn: (x) => Ir(e.entity, x),
|
|
5407
5395
|
onSuccess: () => {
|
|
5408
|
-
var k,
|
|
5396
|
+
var k, A;
|
|
5409
5397
|
const x = e.quick_add, N = s.entities[e.entity], h = {};
|
|
5410
5398
|
if (x != null && x.fields)
|
|
5411
|
-
for (const
|
|
5412
|
-
((k = x == null ? void 0 : x.defaults) == null ? void 0 : k[
|
|
5399
|
+
for (const _ of x.fields)
|
|
5400
|
+
((k = x == null ? void 0 : x.defaults) == null ? void 0 : k[_]) != null ? h[_] = x.defaults[_] : ((A = N == null ? void 0 : N.fields[_]) == null ? void 0 : A.type) === "timestamp" ? h[_] = vn() : h[_] = "";
|
|
5413
5401
|
a(h);
|
|
5414
5402
|
const v = Array.isArray(r) ? r.join("|") : r;
|
|
5415
5403
|
l.invalidateQueries({
|
|
5416
|
-
queryKey: [
|
|
5404
|
+
queryKey: [Be, t, v, e.entity]
|
|
5417
5405
|
});
|
|
5418
5406
|
}
|
|
5419
5407
|
}), m = e.quick_add, p = s.entities[e.entity], g = (m == null ? void 0 : m.fields.filter(
|
|
@@ -5421,10 +5409,10 @@ function Ns(e, t, r, s) {
|
|
|
5421
5409
|
var N;
|
|
5422
5410
|
return (N = p == null ? void 0 : p.fields[x]) == null ? void 0 : N.required;
|
|
5423
5411
|
}
|
|
5424
|
-
)) ?? [], y =
|
|
5412
|
+
)) ?? [], y = Jo(i, g);
|
|
5425
5413
|
function b(x) {
|
|
5426
5414
|
if (x.preventDefault(), !m) return;
|
|
5427
|
-
const N =
|
|
5415
|
+
const N = Ho(i, m.defaults, e.foreign_key, r);
|
|
5428
5416
|
c(N);
|
|
5429
5417
|
}
|
|
5430
5418
|
function w(x, N) {
|
|
@@ -5470,7 +5458,7 @@ function an({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5470
5458
|
);
|
|
5471
5459
|
}
|
|
5472
5460
|
function yn({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
5473
|
-
const i = s.entities[e.entity], { data: a, isLoading: l, isError: c } =
|
|
5461
|
+
const i = s.entities[e.entity], { data: a, isLoading: l, isError: c } = It(t, r, e.entity, e.foreign_key, e.sort, e.limit), o = (a == null ? void 0 : a.data) ?? [], u = a == null ? void 0 : a.$refs, f = e.columns;
|
|
5474
5462
|
if (!i)
|
|
5475
5463
|
return /* @__PURE__ */ n("div", { className: "text-sm text-[var(--muted-foreground)] py-2", children: "Entity not found." });
|
|
5476
5464
|
const m = /* @__PURE__ */ n(
|
|
@@ -5523,8 +5511,8 @@ function yn({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5523
5511
|
] }) })
|
|
5524
5512
|
] });
|
|
5525
5513
|
}
|
|
5526
|
-
function
|
|
5527
|
-
const i = s.entities[e.entity], { data: a, isLoading: l, isError: c } =
|
|
5514
|
+
function Qo({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
5515
|
+
const i = s.entities[e.entity], { data: a, isLoading: l, isError: c } = It(t, r, e.entity, e.foreign_key, e.sort, e.limit), o = (a == null ? void 0 : a.data) ?? [], u = a == null ? void 0 : a.$refs, f = e.columns;
|
|
5528
5516
|
if (!i)
|
|
5529
5517
|
return /* @__PURE__ */ n("div", { className: "text-sm text-[var(--muted-foreground)] py-2", children: "Entity not found." });
|
|
5530
5518
|
const m = /* @__PURE__ */ n(
|
|
@@ -5584,8 +5572,8 @@ function Go({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5584
5572
|
] }) }, String(g.id ?? y))) })
|
|
5585
5573
|
] });
|
|
5586
5574
|
}
|
|
5587
|
-
function
|
|
5588
|
-
const i = s.entities[e.entity], { data: a, isLoading: l, isError: c } =
|
|
5575
|
+
function Go({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
5576
|
+
const i = s.entities[e.entity], { data: a, isLoading: l, isError: c } = It(t, r, e.entity, e.foreign_key, e.sort, e.limit), o = (a == null ? void 0 : a.data) ?? [], u = a == null ? void 0 : a.$refs, f = e.columns, m = e.cards, p = (m == null ? void 0 : m.header_field) ?? f[0], g = m == null ? void 0 : m.badge_field, y = m == null ? void 0 : m.columns_count;
|
|
5589
5577
|
if (!i)
|
|
5590
5578
|
return /* @__PURE__ */ n("div", { className: "text-sm text-[var(--muted-foreground)] py-2", children: "Entity not found." });
|
|
5591
5579
|
const b = /* @__PURE__ */ n(
|
|
@@ -5639,11 +5627,11 @@ function Yo({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5639
5627
|
}) : String(x[g]) })
|
|
5640
5628
|
] }) }),
|
|
5641
5629
|
w.length > 0 && /* @__PURE__ */ n(Nt, { className: "px-4 pb-3 pt-0", children: /* @__PURE__ */ n("div", { className: "space-y-1", children: w.slice(0, 4).map((h) => {
|
|
5642
|
-
var k,
|
|
5630
|
+
var k, A, _;
|
|
5643
5631
|
const v = i.fields[h];
|
|
5644
5632
|
return v ? /* @__PURE__ */ d("div", { className: "flex items-baseline gap-2 text-xs", children: [
|
|
5645
5633
|
/* @__PURE__ */ d("span", { className: "text-[var(--muted-foreground)] shrink-0", children: [
|
|
5646
|
-
(
|
|
5634
|
+
(_ = (A = (k = s.entities[e.entity]) == null ? void 0 : k.fields[h]) == null ? void 0 : A.display) != null && _.name ? Object.values(s.entities[e.entity].fields[h].display.name)[0] : h,
|
|
5647
5635
|
":"
|
|
5648
5636
|
] }),
|
|
5649
5637
|
/* @__PURE__ */ n("span", { className: "truncate", children: oe({
|
|
@@ -5673,9 +5661,9 @@ function xn(e) {
|
|
|
5673
5661
|
return "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3";
|
|
5674
5662
|
}
|
|
5675
5663
|
}
|
|
5676
|
-
const
|
|
5664
|
+
const Yo = "quick_entry", Xo = 100, Bo = 180, Zo = 800;
|
|
5677
5665
|
function bn({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
5678
|
-
const { values: i, quickAdd: a, childEntity: l, isPending: c, error: o, isReady: u, handleSubmit: f, handleFieldChange: m } = Ns(e, t, r, s), [p, g] =
|
|
5666
|
+
const { values: i, quickAdd: a, childEntity: l, isPending: c, error: o, isReady: u, handleSubmit: f, handleFieldChange: m } = Ns(e, t, r, s), [p, g] = I(Bo), y = me(null), b = me(i);
|
|
5679
5667
|
b.current = i;
|
|
5680
5668
|
const w = me(m);
|
|
5681
5669
|
w.current = m;
|
|
@@ -5690,13 +5678,13 @@ function bn({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5690
5678
|
($.querySelector("textarea, input, select, [contenteditable]") ?? $).focus();
|
|
5691
5679
|
}
|
|
5692
5680
|
}), []);
|
|
5693
|
-
le(() =>
|
|
5681
|
+
le(() => ro(Yo, N), [N]);
|
|
5694
5682
|
const h = z(
|
|
5695
5683
|
(T) => {
|
|
5696
5684
|
T.preventDefault(), y.current = { startY: T.clientY, startHeight: p };
|
|
5697
5685
|
const $ = (M) => {
|
|
5698
5686
|
if (!y.current) return;
|
|
5699
|
-
const q = y.current.startY - M.clientY, E = Math.min(
|
|
5687
|
+
const q = y.current.startY - M.clientY, E = Math.min(Zo, Math.max(Xo, y.current.startHeight + q));
|
|
5700
5688
|
g(E);
|
|
5701
5689
|
}, F = () => {
|
|
5702
5690
|
y.current = null, document.removeEventListener("mousemove", $), document.removeEventListener("mouseup", F);
|
|
@@ -5709,13 +5697,13 @@ function bn({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5709
5697
|
const v = a.fields.find((T) => {
|
|
5710
5698
|
const $ = l.fields[T];
|
|
5711
5699
|
return $ && ($.type === "text" || $.type === "string");
|
|
5712
|
-
}), k = [],
|
|
5700
|
+
}), k = [], A = [];
|
|
5713
5701
|
for (const T of a.fields) {
|
|
5714
5702
|
if (T === v) continue;
|
|
5715
5703
|
const $ = l.fields[T];
|
|
5716
|
-
$ && ($.type === "enum" ? k.push(T) :
|
|
5704
|
+
$ && ($.type === "enum" ? k.push(T) : A.push(T));
|
|
5717
5705
|
}
|
|
5718
|
-
const
|
|
5706
|
+
const _ = (T) => {
|
|
5719
5707
|
const $ = l.fields[T];
|
|
5720
5708
|
return $ ? /* @__PURE__ */ n("div", { ref: (F) => {
|
|
5721
5709
|
x.current[T] = F;
|
|
@@ -5744,7 +5732,7 @@ function bn({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5744
5732
|
}
|
|
5745
5733
|
),
|
|
5746
5734
|
/* @__PURE__ */ d("form", { onSubmit: f, className: "flex-1 min-h-0 flex flex-col gap-1.5 px-3 pb-2", children: [
|
|
5747
|
-
k.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: k.map(
|
|
5735
|
+
k.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: k.map(_) }),
|
|
5748
5736
|
v && l.fields[v] && /* @__PURE__ */ n(
|
|
5749
5737
|
"div",
|
|
5750
5738
|
{
|
|
@@ -5763,7 +5751,7 @@ function bn({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5763
5751
|
}
|
|
5764
5752
|
),
|
|
5765
5753
|
/* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
|
|
5766
|
-
|
|
5754
|
+
A.map(_),
|
|
5767
5755
|
/* @__PURE__ */ n("div", { className: "ml-auto", children: /* @__PURE__ */ n(j, { type: "submit", size: "sm", disabled: c || !u, children: "Add Note" }) })
|
|
5768
5756
|
] }),
|
|
5769
5757
|
o != null && /* @__PURE__ */ n("p", { className: "text-xs text-[var(--destructive)] shrink-0", children: o.message })
|
|
@@ -5772,9 +5760,9 @@ function bn({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5772
5760
|
}
|
|
5773
5761
|
);
|
|
5774
5762
|
}
|
|
5775
|
-
function
|
|
5776
|
-
var k,
|
|
5777
|
-
const i = s.entities[e.entity], { data: a, isLoading: l, isError: c } =
|
|
5763
|
+
function el({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
5764
|
+
var k, A, _;
|
|
5765
|
+
const i = s.entities[e.entity], { data: a, isLoading: l, isError: c } = It(t, r, e.entity, e.foreign_key, e.sort, e.limit), o = (a == null ? void 0 : a.data) ?? [], u = a == null ? void 0 : a.$refs, f = e.timeline, m = (f == null ? void 0 : f.scroll) ?? !1, p = (f == null ? void 0 : f.auto_scroll) ?? "none", g = me(null), y = me(!1), b = me(0);
|
|
5778
5766
|
le(() => {
|
|
5779
5767
|
y.current = !1, b.current = 0;
|
|
5780
5768
|
}, [r]), le(() => {
|
|
@@ -5782,10 +5770,10 @@ function tl({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5782
5770
|
const T = !y.current, $ = o.length > b.current && b.current > 0;
|
|
5783
5771
|
b.current = o.length, (T && p === "bottom" || $) && (g.current.scrollTop = g.current.scrollHeight, y.current = !0);
|
|
5784
5772
|
}, [o, p]);
|
|
5785
|
-
const [w, x] =
|
|
5773
|
+
const [w, x] = I(null);
|
|
5786
5774
|
if (!i)
|
|
5787
5775
|
return /* @__PURE__ */ n("div", { className: "text-sm text-[var(--muted-foreground)] py-2", children: "Entity not found." });
|
|
5788
|
-
const N = ((k = e.quick_add) == null ? void 0 : k.fields) ?? [f == null ? void 0 : f.content_field].filter(Boolean), h = P((
|
|
5776
|
+
const N = ((k = e.quick_add) == null ? void 0 : k.fields) ?? [f == null ? void 0 : f.content_field].filter(Boolean), h = P((A = i.display) == null ? void 0 : A.name_plural) || P((_ = i.display) == null ? void 0 : _.name) || e.entity;
|
|
5789
5777
|
let v;
|
|
5790
5778
|
return c ? v = /* @__PURE__ */ n("div", { className: "text-sm text-[var(--destructive)] p-3", children: "Failed to load." }) : l ? v = /* @__PURE__ */ d("div", { className: "space-y-2 p-3", children: [
|
|
5791
5779
|
/* @__PURE__ */ n(_e, { className: "h-16 w-full rounded-lg" }),
|
|
@@ -5793,7 +5781,7 @@ function tl({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5793
5781
|
] }) : o.length === 0 ? v = /* @__PURE__ */ n("div", { className: "text-sm text-[var(--muted-foreground)] p-3", children: "No activity yet." }) : v = o.map((T, $) => {
|
|
5794
5782
|
const F = String(T.id ?? $);
|
|
5795
5783
|
return /* @__PURE__ */ n(
|
|
5796
|
-
|
|
5784
|
+
tl,
|
|
5797
5785
|
{
|
|
5798
5786
|
row: T,
|
|
5799
5787
|
rowId: F,
|
|
@@ -5821,7 +5809,7 @@ function tl({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5821
5809
|
/* @__PURE__ */ n(bn, { config: e, parentEntity: t, parentId: r, schema: s })
|
|
5822
5810
|
] });
|
|
5823
5811
|
}
|
|
5824
|
-
function
|
|
5812
|
+
function tl({
|
|
5825
5813
|
row: e,
|
|
5826
5814
|
rowId: t,
|
|
5827
5815
|
childEntity: r,
|
|
@@ -5837,8 +5825,8 @@ function rl({
|
|
|
5837
5825
|
onSaved: p,
|
|
5838
5826
|
schema: g
|
|
5839
5827
|
}) {
|
|
5840
|
-
const y = Fe(), [b, w] =
|
|
5841
|
-
y.invalidateQueries({ queryKey: [
|
|
5828
|
+
const y = Fe(), [b, w] = I({}), x = z(() => {
|
|
5829
|
+
y.invalidateQueries({ queryKey: [Be, i, a, s] });
|
|
5842
5830
|
}, [y, i, a, s]), N = Ee({
|
|
5843
5831
|
mutationFn: (E) => Vr(s, t, E),
|
|
5844
5832
|
onSuccess: () => {
|
|
@@ -5853,17 +5841,17 @@ function rl({
|
|
|
5853
5841
|
onError: (E) => ie.error(E.message)
|
|
5854
5842
|
}), v = z(() => {
|
|
5855
5843
|
const E = {};
|
|
5856
|
-
for (const
|
|
5844
|
+
for (const U of c) E[U] = e[U] ?? "";
|
|
5857
5845
|
w(E), f();
|
|
5858
|
-
}, [e, c, f]), k = z((E,
|
|
5859
|
-
w((
|
|
5860
|
-
}, []),
|
|
5846
|
+
}, [e, c, f]), k = z((E, U) => {
|
|
5847
|
+
w((B) => ({ ...B, [E]: U }));
|
|
5848
|
+
}, []), A = l == null ? void 0 : l.time_field, _ = l == null ? void 0 : l.type_field, T = l == null ? void 0 : l.summary_field, $ = l == null ? void 0 : l.content_field, F = l == null ? void 0 : l.author_field, M = l == null ? void 0 : l.direction_field, q = l == null ? void 0 : l.intent_field;
|
|
5861
5849
|
return u ? /* @__PURE__ */ d("div", { className: "rounded-lg border-2 border-[var(--primary)]/40 bg-[var(--card)] p-3 space-y-2", children: [
|
|
5862
5850
|
c.map((E) => {
|
|
5863
|
-
const
|
|
5864
|
-
return
|
|
5865
|
-
/* @__PURE__ */ n("label", { className: "text-xs text-[var(--muted-foreground)] mb-1 block", children: De(
|
|
5866
|
-
oe({ field:
|
|
5851
|
+
const U = r.fields[E];
|
|
5852
|
+
return U ? /* @__PURE__ */ d("div", { children: [
|
|
5853
|
+
/* @__PURE__ */ n("label", { className: "text-xs text-[var(--muted-foreground)] mb-1 block", children: De(U, E, g.entities) }),
|
|
5854
|
+
oe({ field: U, fieldName: E, value: b[E] ?? "", mode: "edit", onChange: (B) => k(E, B), record: b })
|
|
5867
5855
|
] }, E) : null;
|
|
5868
5856
|
}),
|
|
5869
5857
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-1.5 pt-1", children: [
|
|
@@ -5881,9 +5869,9 @@ function rl({
|
|
|
5881
5869
|
] })
|
|
5882
5870
|
] }) : /* @__PURE__ */ d("div", { className: "group rounded-lg border border-[var(--border)] bg-[var(--card)] p-3 hover:border-[var(--muted-foreground)]/30 transition-colors", children: [
|
|
5883
5871
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-2 flex-wrap text-xs text-[var(--muted-foreground)]", children: [
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
M && e[M] != null && r.fields[M] && /* @__PURE__ */ n(
|
|
5872
|
+
A && e[A] != null && r.fields[A] && /* @__PURE__ */ n("span", { className: "font-medium", children: oe({ field: r.fields[A], fieldName: A, value: e[A], mode: "display", record: e, refs: o }) }),
|
|
5873
|
+
_ && e[_] != null && r.fields[_] && /* @__PURE__ */ n("span", { className: "px-1.5 py-0.5 rounded bg-[var(--muted)] text-[10px] uppercase tracking-wide font-semibold", children: oe({ field: r.fields[_], fieldName: _, value: e[_], mode: "display", record: e, refs: o }) }),
|
|
5874
|
+
M && e[M] != null && r.fields[M] && /* @__PURE__ */ n(rl, { value: e[M], field: r.fields[M] }),
|
|
5887
5875
|
q && e[q] != null && r.fields[q] && /* @__PURE__ */ n("span", { className: "px-1.5 py-0.5 rounded bg-[var(--muted)] text-[10px] uppercase tracking-wide font-medium", children: oe({ field: r.fields[q], fieldName: q, value: e[q], mode: "display", record: e, refs: o }) }),
|
|
5888
5876
|
F && e[F] != null && r.fields[F] && /* @__PURE__ */ d("span", { children: [
|
|
5889
5877
|
"by ",
|
|
@@ -5898,14 +5886,14 @@ function rl({
|
|
|
5898
5886
|
$ && e[$] != null && $ !== T && r.fields[$] && /* @__PURE__ */ n("div", { className: "text-sm font-normal mt-1.5", style: { fontWeight: 400 }, children: oe({ field: r.fields[$], fieldName: $, value: e[$], mode: "display", record: e, refs: o }) })
|
|
5899
5887
|
] });
|
|
5900
5888
|
}
|
|
5901
|
-
function
|
|
5902
|
-
const r =
|
|
5889
|
+
function rl({ value: e, field: t }) {
|
|
5890
|
+
const r = nl(e, t);
|
|
5903
5891
|
return r === null ? null : /* @__PURE__ */ d("span", { className: "inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-[var(--muted)] text-[10px] uppercase tracking-wide font-medium", children: [
|
|
5904
5892
|
/* @__PURE__ */ n(r ? ii : ai, { className: "h-3 w-3" }),
|
|
5905
5893
|
r ? "Out" : "In"
|
|
5906
5894
|
] });
|
|
5907
5895
|
}
|
|
5908
|
-
function
|
|
5896
|
+
function nl(e, t) {
|
|
5909
5897
|
if (t.type === "bool")
|
|
5910
5898
|
return e === !0;
|
|
5911
5899
|
if (typeof e == "string") {
|
|
@@ -5915,7 +5903,7 @@ function sl(e, t) {
|
|
|
5915
5903
|
}
|
|
5916
5904
|
return null;
|
|
5917
5905
|
}
|
|
5918
|
-
function
|
|
5906
|
+
function sl({
|
|
5919
5907
|
config: e,
|
|
5920
5908
|
childEntity: t,
|
|
5921
5909
|
schema: r,
|
|
@@ -5938,7 +5926,7 @@ function il({
|
|
|
5938
5926
|
), p = z(
|
|
5939
5927
|
(N, h, v) => {
|
|
5940
5928
|
const k = s.map(
|
|
5941
|
-
(
|
|
5929
|
+
(A) => A._key === N ? { ...A, [h]: v, _dirty: !0 } : A
|
|
5942
5930
|
);
|
|
5943
5931
|
i(k);
|
|
5944
5932
|
},
|
|
@@ -5950,8 +5938,8 @@ function il({
|
|
|
5950
5938
|
_dirty: !0
|
|
5951
5939
|
}, h = ((v = e.quick_add) == null ? void 0 : v.defaults) ?? {};
|
|
5952
5940
|
for (const k of f) {
|
|
5953
|
-
const
|
|
5954
|
-
|
|
5941
|
+
const A = t.fields[k];
|
|
5942
|
+
A && (h[k] !== void 0 ? N[k] = h[k] : A.default !== void 0 ? N[k] = A.default : A.type === "bool" && (N[k] = !1));
|
|
5955
5943
|
}
|
|
5956
5944
|
i([...s, N]);
|
|
5957
5945
|
}, [s, i, f, t, (x = e.quick_add) == null ? void 0 : x.defaults]), y = z(
|
|
@@ -5977,34 +5965,34 @@ function il({
|
|
|
5977
5965
|
if (!v) return;
|
|
5978
5966
|
const k = v.closest("tr");
|
|
5979
5967
|
if (!k) return;
|
|
5980
|
-
const
|
|
5981
|
-
if (!
|
|
5982
|
-
const
|
|
5968
|
+
const A = k.closest("tbody");
|
|
5969
|
+
if (!A) return;
|
|
5970
|
+
const _ = Array.from(k.cells).indexOf(v), T = Array.from(A.rows).indexOf(k);
|
|
5983
5971
|
if (N.key === "Tab") {
|
|
5984
|
-
const M = N.shiftKey ? -1 : 1, q = Array.from(
|
|
5985
|
-
let E = T,
|
|
5972
|
+
const M = N.shiftKey ? -1 : 1, q = Array.from(A.rows);
|
|
5973
|
+
let E = T, U = _ + M;
|
|
5986
5974
|
for (; E >= 0 && E < q.length; )
|
|
5987
|
-
if (
|
|
5988
|
-
const re = q[E].cells[
|
|
5975
|
+
if (U >= 0 && U < q[E].cells.length) {
|
|
5976
|
+
const re = q[E].cells[U].querySelector("input, select, textarea, [tabindex]");
|
|
5989
5977
|
if (re) {
|
|
5990
5978
|
N.preventDefault(), re.focus();
|
|
5991
5979
|
return;
|
|
5992
5980
|
}
|
|
5993
|
-
|
|
5981
|
+
U += M;
|
|
5994
5982
|
} else
|
|
5995
|
-
E += M,
|
|
5983
|
+
E += M, U = M > 0 ? 0 : ((($ = q[E]) == null ? void 0 : $.cells.length) ?? 1) - 1;
|
|
5996
5984
|
} else if (N.key === "Enter") {
|
|
5997
5985
|
N.preventDefault();
|
|
5998
|
-
const M = Array.from(
|
|
5986
|
+
const M = Array.from(A.rows);
|
|
5999
5987
|
if (T < M.length - 1) {
|
|
6000
|
-
const q = M[T + 1].cells[
|
|
5988
|
+
const q = M[T + 1].cells[_], E = q == null ? void 0 : q.querySelector("input, select, textarea, [tabindex]");
|
|
6001
5989
|
E && E.focus();
|
|
6002
5990
|
} else
|
|
6003
5991
|
g(), requestAnimationFrame(() => {
|
|
6004
|
-
const q =
|
|
5992
|
+
const q = A.querySelectorAll("tr"), E = q[q.length - 1];
|
|
6005
5993
|
if (E) {
|
|
6006
|
-
const
|
|
6007
|
-
|
|
5994
|
+
const U = E.querySelector("input, select, textarea, [tabindex]");
|
|
5995
|
+
U && U.focus();
|
|
6008
5996
|
}
|
|
6009
5997
|
});
|
|
6010
5998
|
} else N.key === "Escape" && ((F = h.blur) == null || F.call(h));
|
|
@@ -6035,13 +6023,13 @@ function il({
|
|
|
6035
6023
|
className: `border-b last:border-0 ${h ? "opacity-50" : ""}`,
|
|
6036
6024
|
children: [
|
|
6037
6025
|
o.map((k) => {
|
|
6038
|
-
const
|
|
6026
|
+
const A = t.fields[k], _ = v == null ? void 0 : v.includes(k), T = m.has(k);
|
|
6039
6027
|
return h || T ? /* @__PURE__ */ n(
|
|
6040
6028
|
"td",
|
|
6041
6029
|
{
|
|
6042
6030
|
className: `px-3 py-2 align-middle ${h ? "line-through" : ""}`,
|
|
6043
|
-
children:
|
|
6044
|
-
field:
|
|
6031
|
+
children: A ? oe({
|
|
6032
|
+
field: A,
|
|
6045
6033
|
fieldName: k,
|
|
6046
6034
|
value: N[k],
|
|
6047
6035
|
mode: "display",
|
|
@@ -6053,10 +6041,10 @@ function il({
|
|
|
6053
6041
|
) : /* @__PURE__ */ n(
|
|
6054
6042
|
"td",
|
|
6055
6043
|
{
|
|
6056
|
-
className: `px-1 py-1 align-middle ${
|
|
6057
|
-
title:
|
|
6058
|
-
children:
|
|
6059
|
-
field:
|
|
6044
|
+
className: `px-1 py-1 align-middle ${_ ? "ring-1 ring-inset ring-[var(--destructive)] rounded" : ""}`,
|
|
6045
|
+
title: _ ? `${k} is required` : void 0,
|
|
6046
|
+
children: A ? oe({
|
|
6047
|
+
field: A,
|
|
6060
6048
|
fieldName: k,
|
|
6061
6049
|
value: N[k],
|
|
6062
6050
|
mode: "edit",
|
|
@@ -6110,7 +6098,7 @@ function il({
|
|
|
6110
6098
|
)
|
|
6111
6099
|
] });
|
|
6112
6100
|
}
|
|
6113
|
-
function
|
|
6101
|
+
function il({
|
|
6114
6102
|
config: e,
|
|
6115
6103
|
childEntity: t,
|
|
6116
6104
|
schema: r,
|
|
@@ -6119,70 +6107,70 @@ function al({
|
|
|
6119
6107
|
validationErrors: a,
|
|
6120
6108
|
refs: l
|
|
6121
6109
|
}) {
|
|
6122
|
-
var
|
|
6110
|
+
var A;
|
|
6123
6111
|
const c = me(null), o = e.position_field, u = e.columns, f = Dn(
|
|
6124
6112
|
Pn($n, { activationConstraint: { distance: 5 } })
|
|
6125
|
-
), m = new Set(Array.isArray(e.foreign_key) ? e.foreign_key : [e.foreign_key]), p = u.filter((
|
|
6126
|
-
if (m.has(
|
|
6127
|
-
const T = t.fields[
|
|
6113
|
+
), m = new Set(Array.isArray(e.foreign_key) ? e.foreign_key : [e.foreign_key]), p = u.filter((_) => {
|
|
6114
|
+
if (m.has(_) || _ === o) return !1;
|
|
6115
|
+
const T = t.fields[_];
|
|
6128
6116
|
return !(!T || T.auto || T.primary);
|
|
6129
6117
|
}), g = new Set(
|
|
6130
|
-
u.filter((
|
|
6131
|
-
if (
|
|
6132
|
-
const T = t.fields[
|
|
6118
|
+
u.filter((_) => {
|
|
6119
|
+
if (_ === o) return !0;
|
|
6120
|
+
const T = t.fields[_];
|
|
6133
6121
|
return T && (T.auto || T.primary);
|
|
6134
6122
|
})
|
|
6135
|
-
), y = u.filter((
|
|
6136
|
-
() => s.filter((
|
|
6123
|
+
), y = u.filter((_) => _ !== o), b = ee(
|
|
6124
|
+
() => s.filter((_) => !_._deleted).map((_) => _._key),
|
|
6137
6125
|
[s]
|
|
6138
6126
|
), w = z(
|
|
6139
|
-
(
|
|
6127
|
+
(_, T, $) => {
|
|
6140
6128
|
const F = s.map(
|
|
6141
|
-
(M) => M._key ===
|
|
6129
|
+
(M) => M._key === _ ? { ...M, [T]: $, _dirty: !0 } : M
|
|
6142
6130
|
);
|
|
6143
6131
|
i(F);
|
|
6144
6132
|
},
|
|
6145
6133
|
[s, i]
|
|
6146
6134
|
), x = z(() => {
|
|
6147
6135
|
var F;
|
|
6148
|
-
const
|
|
6136
|
+
const _ = s.filter((M) => !M._deleted).reduce((M, q) => {
|
|
6149
6137
|
const E = typeof q[o] == "number" ? q[o] : -1;
|
|
6150
6138
|
return Math.max(M, E);
|
|
6151
6139
|
}, -1), T = {
|
|
6152
6140
|
_key: crypto.randomUUID(),
|
|
6153
6141
|
_dirty: !0,
|
|
6154
|
-
[o]:
|
|
6142
|
+
[o]: _ + 1
|
|
6155
6143
|
}, $ = ((F = e.quick_add) == null ? void 0 : F.defaults) ?? {};
|
|
6156
6144
|
for (const M of p) {
|
|
6157
6145
|
const q = t.fields[M];
|
|
6158
6146
|
q && ($[M] !== void 0 ? T[M] = $[M] : q.default !== void 0 ? T[M] = q.default : q.type === "bool" && (T[M] = !1));
|
|
6159
6147
|
}
|
|
6160
6148
|
i([...s, T]);
|
|
6161
|
-
}, [s, i, p, t, (
|
|
6162
|
-
(
|
|
6149
|
+
}, [s, i, p, t, (A = e.quick_add) == null ? void 0 : A.defaults, o]), N = z(
|
|
6150
|
+
(_) => {
|
|
6163
6151
|
const T = s.map(
|
|
6164
|
-
($) => $._key ===
|
|
6152
|
+
($) => $._key === _ ? { ...$, _deleted: !0 } : $
|
|
6165
6153
|
);
|
|
6166
6154
|
i(T);
|
|
6167
6155
|
},
|
|
6168
6156
|
[s, i]
|
|
6169
6157
|
), h = z(
|
|
6170
|
-
(
|
|
6158
|
+
(_) => {
|
|
6171
6159
|
const T = s.map(
|
|
6172
|
-
($) => $._key ===
|
|
6160
|
+
($) => $._key === _ ? { ...$, _deleted: !1 } : $
|
|
6173
6161
|
);
|
|
6174
6162
|
i(T);
|
|
6175
6163
|
},
|
|
6176
6164
|
[s, i]
|
|
6177
6165
|
), v = z(
|
|
6178
|
-
(
|
|
6179
|
-
const { active: T, over: $ } =
|
|
6166
|
+
(_) => {
|
|
6167
|
+
const { active: T, over: $ } = _;
|
|
6180
6168
|
if (!$ || T.id === $.id) return;
|
|
6181
6169
|
const F = s.filter((Y) => !Y._deleted), M = s.filter((Y) => Y._deleted), q = F.findIndex((Y) => Y._key === String(T.id)), E = F.findIndex((Y) => Y._key === String($.id));
|
|
6182
6170
|
if (q === -1 || E === -1) return;
|
|
6183
|
-
const
|
|
6184
|
-
|
|
6185
|
-
const re =
|
|
6171
|
+
const U = [...F], [B] = U.splice(q, 1);
|
|
6172
|
+
U.splice(E, 0, B);
|
|
6173
|
+
const re = U.map((Y, R) => ({
|
|
6186
6174
|
...Y,
|
|
6187
6175
|
[o]: R,
|
|
6188
6176
|
_dirty: Y[o] !== R ? !0 : Y._dirty
|
|
@@ -6191,30 +6179,30 @@ function al({
|
|
|
6191
6179
|
},
|
|
6192
6180
|
[s, i, o]
|
|
6193
6181
|
), k = z(
|
|
6194
|
-
(
|
|
6195
|
-
var
|
|
6196
|
-
const T =
|
|
6182
|
+
(_) => {
|
|
6183
|
+
var U, B;
|
|
6184
|
+
const T = _.target, $ = T.closest("td");
|
|
6197
6185
|
if (!$) return;
|
|
6198
6186
|
const F = $.closest("tr");
|
|
6199
6187
|
if (!F) return;
|
|
6200
6188
|
const M = F.closest("tbody");
|
|
6201
6189
|
if (!M) return;
|
|
6202
6190
|
const q = Array.from(F.cells).indexOf($), E = Array.from(M.rows).indexOf(F);
|
|
6203
|
-
if (
|
|
6204
|
-
const re =
|
|
6191
|
+
if (_.key === "Tab") {
|
|
6192
|
+
const re = _.shiftKey ? -1 : 1, Y = Array.from(M.rows);
|
|
6205
6193
|
let R = E, C = q + re;
|
|
6206
6194
|
for (; R >= 0 && R < Y.length; )
|
|
6207
6195
|
if (C >= 0 && C < Y[R].cells.length) {
|
|
6208
6196
|
const V = Y[R].cells[C].querySelector("input, select, textarea, [tabindex]");
|
|
6209
6197
|
if (V) {
|
|
6210
|
-
|
|
6198
|
+
_.preventDefault(), V.focus();
|
|
6211
6199
|
return;
|
|
6212
6200
|
}
|
|
6213
6201
|
C += re;
|
|
6214
6202
|
} else
|
|
6215
|
-
R += re, C = re > 0 ? 0 : (((
|
|
6216
|
-
} else if (
|
|
6217
|
-
|
|
6203
|
+
R += re, C = re > 0 ? 0 : (((U = Y[R]) == null ? void 0 : U.cells.length) ?? 1) - 1;
|
|
6204
|
+
} else if (_.key === "Enter") {
|
|
6205
|
+
_.preventDefault();
|
|
6218
6206
|
const re = Array.from(M.rows);
|
|
6219
6207
|
if (E < re.length - 1) {
|
|
6220
6208
|
const Y = re[E + 1].cells[q], R = Y == null ? void 0 : Y.querySelector("input, select, textarea, [tabindex]");
|
|
@@ -6227,7 +6215,7 @@ function al({
|
|
|
6227
6215
|
C && C.focus();
|
|
6228
6216
|
}
|
|
6229
6217
|
});
|
|
6230
|
-
} else
|
|
6218
|
+
} else _.key === "Escape" && ((B = T.blur) == null || B.call(T));
|
|
6231
6219
|
},
|
|
6232
6220
|
[x]
|
|
6233
6221
|
);
|
|
@@ -6241,23 +6229,23 @@ function al({
|
|
|
6241
6229
|
children: /* @__PURE__ */ d("table", { ref: c, className: "w-full text-sm", onKeyDown: k, children: [
|
|
6242
6230
|
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ d("tr", { className: "border-b", children: [
|
|
6243
6231
|
/* @__PURE__ */ n("th", { className: "h-8 w-8 px-1" }),
|
|
6244
|
-
y.map((
|
|
6245
|
-
const T = t.fields[
|
|
6232
|
+
y.map((_) => {
|
|
6233
|
+
const T = t.fields[_];
|
|
6246
6234
|
return /* @__PURE__ */ n(
|
|
6247
6235
|
"th",
|
|
6248
6236
|
{
|
|
6249
6237
|
className: "h-8 px-3 text-left align-middle font-medium text-[var(--muted-foreground)]",
|
|
6250
|
-
children: T ? De(T,
|
|
6238
|
+
children: T ? De(T, _, r.entities) : _
|
|
6251
6239
|
},
|
|
6252
|
-
|
|
6240
|
+
_
|
|
6253
6241
|
);
|
|
6254
6242
|
}),
|
|
6255
6243
|
/* @__PURE__ */ n("th", { className: "h-8 w-10 px-2" })
|
|
6256
6244
|
] }) }),
|
|
6257
|
-
/* @__PURE__ */ n(On, { items: b, strategy: mi, children: /* @__PURE__ */ n("tbody", { children: s.map((
|
|
6258
|
-
|
|
6245
|
+
/* @__PURE__ */ n(On, { items: b, strategy: mi, children: /* @__PURE__ */ n("tbody", { children: s.map((_) => /* @__PURE__ */ n(
|
|
6246
|
+
al,
|
|
6259
6247
|
{
|
|
6260
|
-
row:
|
|
6248
|
+
row: _,
|
|
6261
6249
|
columns: y,
|
|
6262
6250
|
editableColumns: p,
|
|
6263
6251
|
displayOnlyColumns: g,
|
|
@@ -6268,7 +6256,7 @@ function al({
|
|
|
6268
6256
|
onDelete: N,
|
|
6269
6257
|
onUndoDelete: h
|
|
6270
6258
|
},
|
|
6271
|
-
|
|
6259
|
+
_._key
|
|
6272
6260
|
)) }) })
|
|
6273
6261
|
] })
|
|
6274
6262
|
}
|
|
@@ -6288,7 +6276,7 @@ function al({
|
|
|
6288
6276
|
)
|
|
6289
6277
|
] });
|
|
6290
6278
|
}
|
|
6291
|
-
function
|
|
6279
|
+
function al({
|
|
6292
6280
|
row: e,
|
|
6293
6281
|
columns: t,
|
|
6294
6282
|
editableColumns: r,
|
|
@@ -6331,8 +6319,8 @@ function ol({
|
|
|
6331
6319
|
}
|
|
6332
6320
|
) }),
|
|
6333
6321
|
t.map((h) => {
|
|
6334
|
-
const v = i.fields[h], k = m == null ? void 0 : m.includes(h),
|
|
6335
|
-
return f ||
|
|
6322
|
+
const v = i.fields[h], k = m == null ? void 0 : m.includes(h), A = s.has(h), _ = r.includes(h);
|
|
6323
|
+
return f || A || !_ ? /* @__PURE__ */ n(
|
|
6336
6324
|
"td",
|
|
6337
6325
|
{
|
|
6338
6326
|
className: `px-3 py-2 align-middle ${f ? "line-through" : ""}`,
|
|
@@ -6389,11 +6377,11 @@ function ol({
|
|
|
6389
6377
|
}
|
|
6390
6378
|
);
|
|
6391
6379
|
}
|
|
6392
|
-
function
|
|
6380
|
+
function ol({ node: e, ctx: t }) {
|
|
6393
6381
|
var c;
|
|
6394
6382
|
const r = e.children;
|
|
6395
6383
|
if (!r || t.isNew && t.mode !== "edit") return null;
|
|
6396
|
-
const s =
|
|
6384
|
+
const s = Wo(t.entity, r);
|
|
6397
6385
|
if (!s)
|
|
6398
6386
|
return /* @__PURE__ */ d("div", { className: "text-sm text-[var(--muted-foreground)] py-2", children: [
|
|
6399
6387
|
"Unknown child relation: ",
|
|
@@ -6405,9 +6393,9 @@ function ll({ node: e, ctx: t }) {
|
|
|
6405
6393
|
"Entity not found: ",
|
|
6406
6394
|
s.entity
|
|
6407
6395
|
] });
|
|
6408
|
-
const a =
|
|
6396
|
+
const a = Fo(s, i, e);
|
|
6409
6397
|
if (t.mode === "edit" && a.editable && !i.readonly && a.mode === "table" && t.pendingChildren !== void 0 && t.onChildrenChange) {
|
|
6410
|
-
const o = t.pendingChildren[r] ?? [], u = (c = t.childValidationErrors) == null ? void 0 : c[r], f = a.position_field ?
|
|
6398
|
+
const o = t.pendingChildren[r] ?? [], u = (c = t.childValidationErrors) == null ? void 0 : c[r], f = a.position_field ? il : sl;
|
|
6411
6399
|
return /* @__PURE__ */ n(
|
|
6412
6400
|
f,
|
|
6413
6401
|
{
|
|
@@ -6432,20 +6420,20 @@ function ll({ node: e, ctx: t }) {
|
|
|
6432
6420
|
case "table":
|
|
6433
6421
|
return /* @__PURE__ */ n(yn, { ...l });
|
|
6434
6422
|
case "list":
|
|
6435
|
-
return /* @__PURE__ */ n(
|
|
6423
|
+
return /* @__PURE__ */ n(Qo, { ...l });
|
|
6436
6424
|
case "cards":
|
|
6437
|
-
return /* @__PURE__ */ n(
|
|
6425
|
+
return /* @__PURE__ */ n(Go, { ...l });
|
|
6438
6426
|
case "timeline":
|
|
6439
|
-
return /* @__PURE__ */ n(
|
|
6427
|
+
return /* @__PURE__ */ n(el, { ...l });
|
|
6440
6428
|
default:
|
|
6441
6429
|
return /* @__PURE__ */ n(yn, { ...l });
|
|
6442
6430
|
}
|
|
6443
6431
|
}
|
|
6444
|
-
function
|
|
6432
|
+
function ll(e, t, r, s, i, a, l, c) {
|
|
6445
6433
|
const o = c ? JSON.stringify(Object.entries(c).sort()) : void 0;
|
|
6446
6434
|
return Ms({
|
|
6447
6435
|
queryKey: [
|
|
6448
|
-
|
|
6436
|
+
Be,
|
|
6449
6437
|
e,
|
|
6450
6438
|
t,
|
|
6451
6439
|
r,
|
|
@@ -6473,7 +6461,7 @@ function cl(e, t, r, s, i, a, l, c) {
|
|
|
6473
6461
|
enabled: !!e && !!t && !!r && !!s
|
|
6474
6462
|
});
|
|
6475
6463
|
}
|
|
6476
|
-
function
|
|
6464
|
+
function cl({
|
|
6477
6465
|
entity: e,
|
|
6478
6466
|
searchable: t,
|
|
6479
6467
|
filterFields: r,
|
|
@@ -6503,7 +6491,7 @@ function dl({
|
|
|
6503
6491
|
if (!m) return null;
|
|
6504
6492
|
const p = a[f] ?? "__all__", g = De(m, f, c);
|
|
6505
6493
|
return m.type === "ref" && ((y = m.ref) != null && y.entity) ? /* @__PURE__ */ n(
|
|
6506
|
-
|
|
6494
|
+
dl,
|
|
6507
6495
|
{
|
|
6508
6496
|
field: m,
|
|
6509
6497
|
label: g,
|
|
@@ -6519,11 +6507,11 @@ function dl({
|
|
|
6519
6507
|
children: [
|
|
6520
6508
|
/* @__PURE__ */ n(at, { className: "w-[140px] h-8 text-sm", children: /* @__PURE__ */ n(vt, { placeholder: g }) }),
|
|
6521
6509
|
/* @__PURE__ */ d(ot, { children: [
|
|
6522
|
-
/* @__PURE__ */ d(
|
|
6510
|
+
/* @__PURE__ */ d(Ue, { value: "__all__", children: [
|
|
6523
6511
|
"All ",
|
|
6524
6512
|
g
|
|
6525
6513
|
] }),
|
|
6526
|
-
m.values.map((b) => /* @__PURE__ */ n(
|
|
6514
|
+
m.values.map((b) => /* @__PURE__ */ n(Ue, { value: b.code, children: P(b.name) }, b.code))
|
|
6527
6515
|
] })
|
|
6528
6516
|
]
|
|
6529
6517
|
},
|
|
@@ -6532,14 +6520,14 @@ function dl({
|
|
|
6532
6520
|
})
|
|
6533
6521
|
] });
|
|
6534
6522
|
}
|
|
6535
|
-
function
|
|
6523
|
+
function dl({
|
|
6536
6524
|
field: e,
|
|
6537
6525
|
label: t,
|
|
6538
6526
|
value: r,
|
|
6539
6527
|
onChange: s
|
|
6540
6528
|
}) {
|
|
6541
6529
|
var f, m, p, g;
|
|
6542
|
-
const i =
|
|
6530
|
+
const i = Bn((f = e.ref) == null ? void 0 : f.entity), a = ((m = e.display) == null ? void 0 : m.ref_display_field) ?? ((p = i == null ? void 0 : i.display) == null ? void 0 : p.display_field), l = ee(
|
|
6543
6531
|
() => {
|
|
6544
6532
|
var y;
|
|
6545
6533
|
return i ? ((y = Object.entries(i.fields).find(([, b]) => b.primary)) == null ? void 0 : y[0]) ?? "id" : "id";
|
|
@@ -6559,18 +6547,18 @@ function ul({
|
|
|
6559
6547
|
return /* @__PURE__ */ d(gt, { value: r, onValueChange: s, children: [
|
|
6560
6548
|
/* @__PURE__ */ n(at, { className: "w-[140px] h-8 text-sm", children: /* @__PURE__ */ n(vt, { placeholder: t }) }),
|
|
6561
6549
|
/* @__PURE__ */ d(ot, { children: [
|
|
6562
|
-
/* @__PURE__ */ d(
|
|
6550
|
+
/* @__PURE__ */ d(Ue, { value: "__all__", children: [
|
|
6563
6551
|
"All ",
|
|
6564
6552
|
t
|
|
6565
6553
|
] }),
|
|
6566
6554
|
o.map((y) => {
|
|
6567
6555
|
const b = String(y[l]), w = a ? u(y[a] ?? b) : b;
|
|
6568
|
-
return /* @__PURE__ */ n(
|
|
6556
|
+
return /* @__PURE__ */ n(Ue, { value: b, children: w }, b);
|
|
6569
6557
|
})
|
|
6570
6558
|
] })
|
|
6571
6559
|
] });
|
|
6572
6560
|
}
|
|
6573
|
-
function
|
|
6561
|
+
function ul({ node: e, ctx: t }) {
|
|
6574
6562
|
var u, f, m;
|
|
6575
6563
|
const r = e.associated;
|
|
6576
6564
|
if (!r || t.isNew) return null;
|
|
@@ -6604,7 +6592,7 @@ function fl({ node: e, ctx: t }) {
|
|
|
6604
6592
|
return /* @__PURE__ */ d("div", { children: [
|
|
6605
6593
|
/* @__PURE__ */ n("h3", { className: "text-sm font-medium text-[var(--muted-foreground)] mb-2", children: c }),
|
|
6606
6594
|
o ? /* @__PURE__ */ n(
|
|
6607
|
-
|
|
6595
|
+
ml,
|
|
6608
6596
|
{
|
|
6609
6597
|
entityCode: r,
|
|
6610
6598
|
entity: s,
|
|
@@ -6619,7 +6607,7 @@ function fl({ node: e, ctx: t }) {
|
|
|
6619
6607
|
sort: e.sort
|
|
6620
6608
|
}
|
|
6621
6609
|
) : /* @__PURE__ */ n(
|
|
6622
|
-
|
|
6610
|
+
fl,
|
|
6623
6611
|
{
|
|
6624
6612
|
entityCode: r,
|
|
6625
6613
|
entity: s,
|
|
@@ -6634,7 +6622,7 @@ function fl({ node: e, ctx: t }) {
|
|
|
6634
6622
|
)
|
|
6635
6623
|
] });
|
|
6636
6624
|
}
|
|
6637
|
-
function
|
|
6625
|
+
function fl({
|
|
6638
6626
|
entityCode: e,
|
|
6639
6627
|
entity: t,
|
|
6640
6628
|
parentEntity: r,
|
|
@@ -6645,7 +6633,7 @@ function ml({
|
|
|
6645
6633
|
ctx: c,
|
|
6646
6634
|
sort: o
|
|
6647
6635
|
}) {
|
|
6648
|
-
const u = Fe(), { data: f, isLoading: m, isError: p } =
|
|
6636
|
+
const u = Fe(), { data: f, isLoading: m, isError: p } = It(
|
|
6649
6637
|
r,
|
|
6650
6638
|
s,
|
|
6651
6639
|
e,
|
|
@@ -6653,7 +6641,7 @@ function ml({
|
|
|
6653
6641
|
o
|
|
6654
6642
|
), g = (f == null ? void 0 : f.data) ?? [], y = f == null ? void 0 : f.$refs, b = z(() => {
|
|
6655
6643
|
u.invalidateQueries({
|
|
6656
|
-
queryKey: [
|
|
6644
|
+
queryKey: [Be, r, s, e]
|
|
6657
6645
|
});
|
|
6658
6646
|
}, [u, r, s, e]);
|
|
6659
6647
|
return /* @__PURE__ */ n(
|
|
@@ -6674,7 +6662,7 @@ function ml({
|
|
|
6674
6662
|
}
|
|
6675
6663
|
);
|
|
6676
6664
|
}
|
|
6677
|
-
function
|
|
6665
|
+
function ml({
|
|
6678
6666
|
entityCode: e,
|
|
6679
6667
|
entity: t,
|
|
6680
6668
|
parentEntity: r,
|
|
@@ -6687,28 +6675,28 @@ function pl({
|
|
|
6687
6675
|
filterFields: u,
|
|
6688
6676
|
sort: f
|
|
6689
6677
|
}) {
|
|
6690
|
-
const m = Fe(), [p, g] =
|
|
6678
|
+
const m = Fe(), [p, g] = I(""), [y, b] = I(""), [w, x] = I({}), N = me(void 0);
|
|
6691
6679
|
le(() => (N.current && clearTimeout(N.current), N.current = setTimeout(() => {
|
|
6692
6680
|
b(p);
|
|
6693
6681
|
}, 300), () => {
|
|
6694
6682
|
N.current && clearTimeout(N.current);
|
|
6695
6683
|
}), [p]);
|
|
6696
|
-
const h = z((
|
|
6684
|
+
const h = z((U, B) => {
|
|
6697
6685
|
x((re) => {
|
|
6698
|
-
if (
|
|
6699
|
-
const { [
|
|
6686
|
+
if (B === "__all__") {
|
|
6687
|
+
const { [U]: Y, ...R } = re;
|
|
6700
6688
|
return R;
|
|
6701
6689
|
}
|
|
6702
|
-
return { ...re, [
|
|
6690
|
+
return { ...re, [U]: B };
|
|
6703
6691
|
});
|
|
6704
6692
|
}, []), v = ee(() => Object.keys(w).length > 0 ? w : void 0, [w]), {
|
|
6705
6693
|
data: k,
|
|
6706
|
-
isLoading:
|
|
6707
|
-
isError:
|
|
6694
|
+
isLoading: A,
|
|
6695
|
+
isError: _,
|
|
6708
6696
|
hasNextPage: T,
|
|
6709
6697
|
fetchNextPage: $,
|
|
6710
6698
|
isFetchingNextPage: F
|
|
6711
|
-
} =
|
|
6699
|
+
} = ll(
|
|
6712
6700
|
r,
|
|
6713
6701
|
s,
|
|
6714
6702
|
e,
|
|
@@ -6720,27 +6708,27 @@ function pl({
|
|
|
6720
6708
|
v
|
|
6721
6709
|
), { rows: M, refs: q } = ee(() => {
|
|
6722
6710
|
if (!(k != null && k.pages)) return { rows: [], refs: void 0 };
|
|
6723
|
-
const
|
|
6724
|
-
let
|
|
6711
|
+
const U = [];
|
|
6712
|
+
let B;
|
|
6725
6713
|
for (const re of k.pages)
|
|
6726
|
-
if (
|
|
6727
|
-
if (!
|
|
6728
|
-
|
|
6714
|
+
if (U.push(...re.data), re.$refs)
|
|
6715
|
+
if (!B)
|
|
6716
|
+
B = { ...re.$refs };
|
|
6729
6717
|
else
|
|
6730
6718
|
for (const [Y, R] of Object.entries(re.$refs))
|
|
6731
|
-
|
|
6732
|
-
return { rows:
|
|
6719
|
+
B[Y] = { ...B[Y], ...R };
|
|
6720
|
+
return { rows: U, refs: B };
|
|
6733
6721
|
}, [k]), E = z(() => {
|
|
6734
6722
|
m.invalidateQueries({
|
|
6735
|
-
predicate: (
|
|
6736
|
-
const
|
|
6737
|
-
return
|
|
6723
|
+
predicate: (U) => {
|
|
6724
|
+
const B = U.queryKey;
|
|
6725
|
+
return B[0] === Be && B[3] === e;
|
|
6738
6726
|
}
|
|
6739
6727
|
});
|
|
6740
6728
|
}, [m, e]);
|
|
6741
6729
|
return /* @__PURE__ */ d("div", { children: [
|
|
6742
6730
|
/* @__PURE__ */ n(
|
|
6743
|
-
|
|
6731
|
+
cl,
|
|
6744
6732
|
{
|
|
6745
6733
|
entity: t,
|
|
6746
6734
|
searchable: o,
|
|
@@ -6764,8 +6752,8 @@ function pl({
|
|
|
6764
6752
|
ctx: c,
|
|
6765
6753
|
rows: M,
|
|
6766
6754
|
refs: q,
|
|
6767
|
-
isLoading:
|
|
6768
|
-
isError:
|
|
6755
|
+
isLoading: A,
|
|
6756
|
+
isError: _,
|
|
6769
6757
|
invalidateQuery: E
|
|
6770
6758
|
}
|
|
6771
6759
|
),
|
|
@@ -6805,7 +6793,7 @@ function ws({
|
|
|
6805
6793
|
const L = t.fields[C];
|
|
6806
6794
|
return !(!L || L.auto || L.primary);
|
|
6807
6795
|
})
|
|
6808
|
-
) : /* @__PURE__ */ new Set(), [i, s, t.fields, a]), [g, y] =
|
|
6796
|
+
) : /* @__PURE__ */ new Set(), [i, s, t.fields, a]), [g, y] = I(null), [b, w] = I({}), x = me(b);
|
|
6809
6797
|
x.current = b;
|
|
6810
6798
|
const N = me({});
|
|
6811
6799
|
le(() => {
|
|
@@ -6814,7 +6802,7 @@ function ws({
|
|
|
6814
6802
|
for (const L of Object.values(C)) clearTimeout(L);
|
|
6815
6803
|
};
|
|
6816
6804
|
}, []);
|
|
6817
|
-
const [h, v] =
|
|
6805
|
+
const [h, v] = I(null), [k, A] = I([]), [_, T] = I(!1), [$, F] = I(null), [M, q] = I(/* @__PURE__ */ new Set()), E = z(
|
|
6818
6806
|
async (C, L, V) => {
|
|
6819
6807
|
w((Q) => ({
|
|
6820
6808
|
...Q,
|
|
@@ -6838,7 +6826,7 @@ function ws({
|
|
|
6838
6826
|
}
|
|
6839
6827
|
},
|
|
6840
6828
|
[e, m]
|
|
6841
|
-
),
|
|
6829
|
+
), U = z(
|
|
6842
6830
|
(C, L, V) => {
|
|
6843
6831
|
w((Q) => {
|
|
6844
6832
|
const Z = Q[C] ?? { buffer: {}, ver: 0, saving: !1 }, fe = Z.ver + 1;
|
|
@@ -6856,14 +6844,14 @@ function ws({
|
|
|
6856
6844
|
}, 500);
|
|
6857
6845
|
},
|
|
6858
6846
|
[E]
|
|
6859
|
-
),
|
|
6847
|
+
), B = z(() => {
|
|
6860
6848
|
const C = {};
|
|
6861
6849
|
C[s] = r;
|
|
6862
6850
|
for (const L of i) {
|
|
6863
6851
|
const V = t.fields[L];
|
|
6864
6852
|
V && (V.default !== void 0 ? C[L] = V.default : V.type === "bool" && (C[L] = !1));
|
|
6865
6853
|
}
|
|
6866
|
-
v(C),
|
|
6854
|
+
v(C), A([]);
|
|
6867
6855
|
}, [s, r, i, t.fields]), re = z(async () => {
|
|
6868
6856
|
if (!h) return;
|
|
6869
6857
|
const C = [];
|
|
@@ -6874,15 +6862,15 @@ function ws({
|
|
|
6874
6862
|
(Q == null || Q === "") && C.push(L);
|
|
6875
6863
|
}
|
|
6876
6864
|
if (C.length > 0) {
|
|
6877
|
-
|
|
6865
|
+
A(C);
|
|
6878
6866
|
return;
|
|
6879
6867
|
}
|
|
6880
6868
|
T(!0);
|
|
6881
6869
|
try {
|
|
6882
|
-
await
|
|
6870
|
+
await Ir(e, h), v(null), A([]), m();
|
|
6883
6871
|
} catch (L) {
|
|
6884
6872
|
const V = L instanceof Error ? L.message : "Create failed";
|
|
6885
|
-
|
|
6873
|
+
A([`_error:${V}`]);
|
|
6886
6874
|
} finally {
|
|
6887
6875
|
T(!1);
|
|
6888
6876
|
}
|
|
@@ -6930,7 +6918,7 @@ function ws({
|
|
|
6930
6918
|
c.map((C) => {
|
|
6931
6919
|
const L = String(C.id ?? ""), V = M.has(L), Q = b[L];
|
|
6932
6920
|
return /* @__PURE__ */ n(
|
|
6933
|
-
|
|
6921
|
+
pl,
|
|
6934
6922
|
{
|
|
6935
6923
|
rowId: L,
|
|
6936
6924
|
row: C,
|
|
@@ -6942,7 +6930,7 @@ function ws({
|
|
|
6942
6930
|
activeCell: g,
|
|
6943
6931
|
setActiveCell: y,
|
|
6944
6932
|
rowState: Q,
|
|
6945
|
-
onCellChange:
|
|
6933
|
+
onCellChange: U,
|
|
6946
6934
|
onDeleteClick: (Z) => {
|
|
6947
6935
|
var Ne;
|
|
6948
6936
|
const fe = (Ne = t.display) == null ? void 0 : Ne.display_field, Te = fe ? String(C[fe] ?? "") : "";
|
|
@@ -6954,7 +6942,7 @@ function ws({
|
|
|
6954
6942
|
);
|
|
6955
6943
|
}),
|
|
6956
6944
|
h && /* @__PURE__ */ n(
|
|
6957
|
-
|
|
6945
|
+
hl,
|
|
6958
6946
|
{
|
|
6959
6947
|
draftRow: h,
|
|
6960
6948
|
entity: t,
|
|
@@ -6962,11 +6950,11 @@ function ws({
|
|
|
6962
6950
|
editableColumns: p,
|
|
6963
6951
|
foreignKey: s,
|
|
6964
6952
|
draftErrors: k,
|
|
6965
|
-
draftSaving:
|
|
6953
|
+
draftSaving: _,
|
|
6966
6954
|
onChange: (C, L) => v((V) => V && { ...V, [C]: L }),
|
|
6967
6955
|
onConfirm: re,
|
|
6968
6956
|
onCancel: () => {
|
|
6969
|
-
v(null),
|
|
6957
|
+
v(null), A([]);
|
|
6970
6958
|
},
|
|
6971
6959
|
refs: o
|
|
6972
6960
|
}
|
|
@@ -6979,7 +6967,7 @@ function ws({
|
|
|
6979
6967
|
variant: "ghost",
|
|
6980
6968
|
size: "sm",
|
|
6981
6969
|
className: "mt-2 text-[var(--muted-foreground)]",
|
|
6982
|
-
onClick:
|
|
6970
|
+
onClick: B,
|
|
6983
6971
|
disabled: !!h,
|
|
6984
6972
|
children: [
|
|
6985
6973
|
/* @__PURE__ */ n(Oe, { className: "h-4 w-4 mr-1" }),
|
|
@@ -7001,7 +6989,7 @@ function ws({
|
|
|
7001
6989
|
)
|
|
7002
6990
|
] });
|
|
7003
6991
|
}
|
|
7004
|
-
function
|
|
6992
|
+
function pl({
|
|
7005
6993
|
rowId: e,
|
|
7006
6994
|
row: t,
|
|
7007
6995
|
entity: r,
|
|
@@ -7076,7 +7064,7 @@ function hl({
|
|
|
7076
7064
|
}
|
|
7077
7065
|
);
|
|
7078
7066
|
}
|
|
7079
|
-
function
|
|
7067
|
+
function hl({
|
|
7080
7068
|
draftRow: e,
|
|
7081
7069
|
entity: t,
|
|
7082
7070
|
columns: r,
|
|
@@ -7140,7 +7128,7 @@ function gl({
|
|
|
7140
7128
|
] }) })
|
|
7141
7129
|
] });
|
|
7142
7130
|
}
|
|
7143
|
-
function
|
|
7131
|
+
function gl({ fields: e, ctx: t }) {
|
|
7144
7132
|
const { entity: r, entityCode: s, record: i, mode: a, onFieldChange: l, schema: c } = t, o = t.columns ?? 2, u = o === 1 && e.length === 1;
|
|
7145
7133
|
return /* @__PURE__ */ n("div", { className: J(
|
|
7146
7134
|
"grid gap-x-6 gap-y-3",
|
|
@@ -7187,15 +7175,15 @@ function vl({ fields: e, ctx: t }) {
|
|
|
7187
7175
|
);
|
|
7188
7176
|
}) });
|
|
7189
7177
|
}
|
|
7190
|
-
const
|
|
7191
|
-
function
|
|
7178
|
+
const vl = /* @__PURE__ */ new Set(["string", "text", "int", "float", "decimal", "email", "url"]), yl = 500;
|
|
7179
|
+
function xl({ node: e, ctx: t }) {
|
|
7192
7180
|
const { entity: r, objectProperties: s, onSetProperty: i, isNew: a, mode: l, refs: c } = t, o = r.properties ?? {};
|
|
7193
7181
|
if (a) return null;
|
|
7194
7182
|
const u = e.properties === !0 ? !0 : e.properties, f = u === !0 ? Object.entries(o).sort(([m], [p]) => m.localeCompare(p)) : u.filter((m) => o[m] != null).map((m) => [m, o[m]]);
|
|
7195
7183
|
return f.length === 0 ? null : /* @__PURE__ */ n("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-3", children: f.map(([m, p]) => {
|
|
7196
7184
|
const g = s == null ? void 0 : s.find((w) => w.property_code === m), y = ki(p), b = p.readonly || !i ? "display" : l;
|
|
7197
7185
|
return /* @__PURE__ */ n(
|
|
7198
|
-
|
|
7186
|
+
bl,
|
|
7199
7187
|
{
|
|
7200
7188
|
propCode: m,
|
|
7201
7189
|
prop: p,
|
|
@@ -7209,7 +7197,7 @@ function bl({ node: e, ctx: t }) {
|
|
|
7209
7197
|
);
|
|
7210
7198
|
}) });
|
|
7211
7199
|
}
|
|
7212
|
-
function
|
|
7200
|
+
function bl({
|
|
7213
7201
|
propCode: e,
|
|
7214
7202
|
prop: t,
|
|
7215
7203
|
field: r,
|
|
@@ -7225,7 +7213,7 @@ function Nl({
|
|
|
7225
7213
|
}, []);
|
|
7226
7214
|
const o = z(
|
|
7227
7215
|
(f) => {
|
|
7228
|
-
a && (
|
|
7216
|
+
a && (vl.has(t.type) ? (c.current && clearTimeout(c.current), c.current = setTimeout(() => a(e, f), yl)) : a(e, f));
|
|
7229
7217
|
},
|
|
7230
7218
|
[e, t.type, a]
|
|
7231
7219
|
);
|
|
@@ -7297,7 +7285,7 @@ function _s({
|
|
|
7297
7285
|
children: P(u.name)
|
|
7298
7286
|
}
|
|
7299
7287
|
) : "Select..." }) }),
|
|
7300
|
-
/* @__PURE__ */ n(ot, { children: f.map((m) => /* @__PURE__ */ n(
|
|
7288
|
+
/* @__PURE__ */ n(ot, { children: f.map((m) => /* @__PURE__ */ n(Ue, { value: m.code, children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
7301
7289
|
m.color && /* @__PURE__ */ n(
|
|
7302
7290
|
"span",
|
|
7303
7291
|
{
|
|
@@ -7313,9 +7301,9 @@ function _s({
|
|
|
7313
7301
|
] }, a);
|
|
7314
7302
|
}) });
|
|
7315
7303
|
}
|
|
7316
|
-
const
|
|
7304
|
+
const Nl = () => {
|
|
7317
7305
|
};
|
|
7318
|
-
function
|
|
7306
|
+
function wl({ node: e, ctx: t }) {
|
|
7319
7307
|
const { entity: r, objectStatuses: s, onSetStatus: i, isStatusPending: a, isNew: l } = t, c = r.status_groups ?? {};
|
|
7320
7308
|
if (l) return null;
|
|
7321
7309
|
const o = e.statuses === !0 ? !0 : e.statuses, u = Object.fromEntries(
|
|
@@ -7328,7 +7316,7 @@ function _l({ node: e, ctx: t }) {
|
|
|
7328
7316
|
{
|
|
7329
7317
|
statusGroups: u,
|
|
7330
7318
|
objectStatuses: s,
|
|
7331
|
-
onSetStatus: i ??
|
|
7319
|
+
onSetStatus: i ?? Nl,
|
|
7332
7320
|
isPending: a ?? !1,
|
|
7333
7321
|
mode: t.mode
|
|
7334
7322
|
}
|
|
@@ -7338,9 +7326,9 @@ function rr({ nodes: e, ctx: t }) {
|
|
|
7338
7326
|
return /* @__PURE__ */ n(pe, { children: e.map((r, s) => /* @__PURE__ */ n(ir, { node: r, ctx: t }, s)) });
|
|
7339
7327
|
}
|
|
7340
7328
|
function ir({ node: e, ctx: t }) {
|
|
7341
|
-
return e.row ? /* @__PURE__ */ n(
|
|
7329
|
+
return e.row ? /* @__PURE__ */ n(To, { config: e.row, ctx: t }) : e.column ? /* @__PURE__ */ n(Po, { config: e.column, node: e, ctx: t }) : e.tabs ? /* @__PURE__ */ n(Eo, { config: e.tabs, ctx: t }) : e.section ? /* @__PURE__ */ n(Oo, { config: e.section, ctx: t }) : e.children ? /* @__PURE__ */ n(ol, { node: e, ctx: t }) : e.associated ? /* @__PURE__ */ n(ul, { node: e, ctx: t }) : e.fields ? /* @__PURE__ */ n(gl, { fields: e.fields, ctx: t }) : e.properties != null ? /* @__PURE__ */ n(xl, { node: e, ctx: t }) : e.statuses != null ? /* @__PURE__ */ n(wl, { node: e, ctx: t }) : null;
|
|
7342
7330
|
}
|
|
7343
|
-
function
|
|
7331
|
+
function _l(e, t) {
|
|
7344
7332
|
const r = /* @__PURE__ */ new Set();
|
|
7345
7333
|
for (const s of Object.values(t.entities))
|
|
7346
7334
|
if (s.children) {
|
|
@@ -7353,13 +7341,13 @@ function Sl(e, t) {
|
|
|
7353
7341
|
}
|
|
7354
7342
|
return r;
|
|
7355
7343
|
}
|
|
7356
|
-
function
|
|
7344
|
+
function Sl(e, t) {
|
|
7357
7345
|
if (!e || !t) return {};
|
|
7358
7346
|
const r = {};
|
|
7359
7347
|
for (const [s, i] of Object.entries(e)) {
|
|
7360
7348
|
const a = t.entities[s];
|
|
7361
7349
|
if (!a) continue;
|
|
7362
|
-
const l =
|
|
7350
|
+
const l = _l(s, t), c = [];
|
|
7363
7351
|
for (const [o, u] of Object.entries(a.fields))
|
|
7364
7352
|
u.required && !u.auto && !u.primary && !l.has(o) && c.push(o);
|
|
7365
7353
|
if (c.length !== 0)
|
|
@@ -7377,12 +7365,12 @@ function kl(e, t) {
|
|
|
7377
7365
|
}
|
|
7378
7366
|
const Nn = () => {
|
|
7379
7367
|
};
|
|
7380
|
-
function
|
|
7368
|
+
function kl(e, t) {
|
|
7381
7369
|
return e.length !== t.length ? !1 : JSON.stringify(e) === JSON.stringify(t);
|
|
7382
7370
|
}
|
|
7383
|
-
function
|
|
7371
|
+
function Cl({ screenCode: e }) {
|
|
7384
7372
|
var we, de, ge, Me, Ae, He, nt;
|
|
7385
|
-
const { id: t } = Ls(), r =
|
|
7373
|
+
const { id: t } = Ls(), r = Xe(), [s, i] = yt(), { data: a } = qe(), l = ct((O) => O.user), c = a == null ? void 0 : a.screens[e], o = c != null && c.entity ? a == null ? void 0 : a.entities[c.entity] : void 0, u = c == null ? void 0 : c.entity, f = (c == null ? void 0 : c.self) === !0, m = f ? l == null ? void 0 : l.id : t, p = !f && m === "new", g = ee(() => {
|
|
7386
7374
|
if (!m || p) return;
|
|
7387
7375
|
if (!o) return m;
|
|
7388
7376
|
const O = qr(o);
|
|
@@ -7395,7 +7383,7 @@ function Tl({ screenCode: e }) {
|
|
|
7395
7383
|
}, [m, p, o]), y = ee(() => {
|
|
7396
7384
|
if (g)
|
|
7397
7385
|
return typeof g == "string" ? g : ln(g);
|
|
7398
|
-
}, [g]), { data: b, isLoading: w } = bs(u, g), x = ua(u ?? ""), N = Hn(u ?? ""), h = Jn(u ?? ""), v = fa(u ?? ""), k = Object.keys((o == null ? void 0 : o.status_groups) ?? {}).length > 0,
|
|
7386
|
+
}, [g]), { data: b, isLoading: w } = bs(u, g), x = ua(u ?? ""), N = Hn(u ?? ""), h = Jn(u ?? ""), v = fa(u ?? ""), k = Object.keys((o == null ? void 0 : o.status_groups) ?? {}).length > 0, A = b == null ? void 0 : b.data, _ = A == null ? void 0 : A.$statuses, T = A == null ? void 0 : A.$properties, $ = s.get("edit") === "true", [F, M] = I(p || $), [q, E] = I({}), [U, B] = I({}), [re, Y] = I({}), [R, C] = I(void 0), [L, V] = I(void 0), [Q, Z] = I({ show: !1 }), [fe, Te] = I(() => {
|
|
7399
7387
|
const O = parseInt((c == null ? void 0 : c.sidebar_width) || "380", 10);
|
|
7400
7388
|
return isNaN(O) ? 380 : O;
|
|
7401
7389
|
}), Ne = me(null), be = me(null), je = z(
|
|
@@ -7415,7 +7403,7 @@ function Tl({ screenCode: e }) {
|
|
|
7415
7403
|
document.addEventListener("mousemove", se), document.addEventListener("mouseup", ce);
|
|
7416
7404
|
},
|
|
7417
7405
|
[]
|
|
7418
|
-
),
|
|
7406
|
+
), X = b == null ? void 0 : b.data, dt = X == null ? void 0 : X.$refs, Ze = !!(o != null && o.soft_delete), Ye = Ze && X != null && X[o.soft_delete] != null, Se = Dr(), { openTab: ut, updateTabTitle: wt, findTabByPathname: At } = ht();
|
|
7419
7407
|
le(() => {
|
|
7420
7408
|
var ce, Re;
|
|
7421
7409
|
if (!o || f) return;
|
|
@@ -7429,13 +7417,13 @@ function Tl({ screenCode: e }) {
|
|
|
7429
7417
|
});
|
|
7430
7418
|
}, [Se.pathname, (de = (we = c == null ? void 0 : c.display) == null ? void 0 : we.name) == null ? void 0 : de.en, (ge = o == null ? void 0 : o.display.name) == null ? void 0 : ge.en, (Me = c == null ? void 0 : c.display) == null ? void 0 : Me.icon, o == null ? void 0 : o.display.icon, p, f]), le(() => {
|
|
7431
7419
|
var W, K;
|
|
7432
|
-
if (!
|
|
7420
|
+
if (!X || !o || f) return;
|
|
7433
7421
|
const O = At(Se.pathname);
|
|
7434
7422
|
if (O) {
|
|
7435
|
-
const se = (W = o.display) == null ? void 0 : W.display_field, ce = se ?
|
|
7423
|
+
const se = (W = o.display) == null ? void 0 : W.display_field, ce = se ? X[se] : void 0, Re = ce && typeof ce == "object" && !Array.isArray(ce) ? P(ce) : ce, kt = Re ? String(Re) : P((K = c == null ? void 0 : c.display) == null ? void 0 : K.name) || P(o.display.name);
|
|
7436
7424
|
wt(O.id, kt);
|
|
7437
7425
|
}
|
|
7438
|
-
}, [
|
|
7426
|
+
}, [X, (Ae = o == null ? void 0 : o.display.name) == null ? void 0 : Ae.en, o == null ? void 0 : o.display.display_field, Se.pathname, f]);
|
|
7439
7427
|
const et = ee(() => {
|
|
7440
7428
|
if (!o) return /* @__PURE__ */ new Set();
|
|
7441
7429
|
const O = /* @__PURE__ */ new Set();
|
|
@@ -7444,11 +7432,11 @@ function Tl({ screenCode: e }) {
|
|
|
7444
7432
|
return O;
|
|
7445
7433
|
}, [o]);
|
|
7446
7434
|
le(() => {
|
|
7447
|
-
if (!(!$ || !
|
|
7435
|
+
if (!(!$ || !X || et.size === 0)) {
|
|
7448
7436
|
if (F || M(!0), Object.keys(q).length === 0) {
|
|
7449
7437
|
const O = {};
|
|
7450
7438
|
et.forEach((W) => {
|
|
7451
|
-
O[W] =
|
|
7439
|
+
O[W] = X[W] ?? "";
|
|
7452
7440
|
}), E(O);
|
|
7453
7441
|
}
|
|
7454
7442
|
i((O) => {
|
|
@@ -7456,17 +7444,17 @@ function Tl({ screenCode: e }) {
|
|
|
7456
7444
|
return W.delete("edit"), W;
|
|
7457
7445
|
}, { replace: !0 });
|
|
7458
7446
|
}
|
|
7459
|
-
}, [$,
|
|
7447
|
+
}, [$, X, et]), le(() => {
|
|
7460
7448
|
!p || !(o != null && o.children) || o.children.length === 0 || R === void 0 && (C({}), V({}));
|
|
7461
7449
|
}, [p, o == null ? void 0 : o.children]);
|
|
7462
7450
|
const We = z(() => {
|
|
7463
|
-
if (
|
|
7451
|
+
if (X) {
|
|
7464
7452
|
const W = {};
|
|
7465
7453
|
et.forEach((K) => {
|
|
7466
|
-
W[K] =
|
|
7454
|
+
W[K] = X[K] ?? "";
|
|
7467
7455
|
}), E(W);
|
|
7468
7456
|
}
|
|
7469
|
-
const O =
|
|
7457
|
+
const O = X == null ? void 0 : X.$children;
|
|
7470
7458
|
if (O && Object.keys(O).length > 0) {
|
|
7471
7459
|
const W = {};
|
|
7472
7460
|
for (const [K, se] of Object.entries(O))
|
|
@@ -7477,13 +7465,13 @@ function Tl({ screenCode: e }) {
|
|
|
7477
7465
|
C(W), V(O);
|
|
7478
7466
|
} else o != null && o.children && o.children.length > 0 && (C({}), V({}));
|
|
7479
7467
|
M(!0);
|
|
7480
|
-
}, [
|
|
7468
|
+
}, [X, et, o == null ? void 0 : o.children]), ar = z(() => {
|
|
7481
7469
|
var O;
|
|
7482
7470
|
if (p) {
|
|
7483
7471
|
const W = ((O = c == null ? void 0 : c.route) == null ? void 0 : O.replace("/:id", "")) ?? "/";
|
|
7484
7472
|
r(W);
|
|
7485
7473
|
} else
|
|
7486
|
-
M(!1), E({}),
|
|
7474
|
+
M(!1), E({}), B({}), Y({}), C(void 0), V(void 0);
|
|
7487
7475
|
}, [p, c, r]), or = z((O, W) => {
|
|
7488
7476
|
E((K) => ({ ...K, [O]: W }));
|
|
7489
7477
|
}, []), Pe = ee(() => {
|
|
@@ -7498,10 +7486,10 @@ function Tl({ screenCode: e }) {
|
|
|
7498
7486
|
se !== "" && se !== null && se !== void 0 && (O[K] = se);
|
|
7499
7487
|
else
|
|
7500
7488
|
for (const [K, se] of Object.entries(q)) {
|
|
7501
|
-
const ce =
|
|
7489
|
+
const ce = X == null ? void 0 : X[K];
|
|
7502
7490
|
(se === "" ? null : se) !== (ce === "" || ce === void 0 ? null : ce) && (O[K] = se);
|
|
7503
7491
|
}
|
|
7504
|
-
if (Object.keys(
|
|
7492
|
+
if (Object.keys(U).length > 0 && (O.$statuses = Object.entries(U).map(
|
|
7505
7493
|
([K, se]) => ({ status_group_code: K, status_code: se })
|
|
7506
7494
|
)), Object.keys(re).length > 0 && (O.$properties = Object.entries(re).map(
|
|
7507
7495
|
([K, se]) => ({ property_code: K, value: se })
|
|
@@ -7509,19 +7497,19 @@ function Tl({ screenCode: e }) {
|
|
|
7509
7497
|
const K = {};
|
|
7510
7498
|
for (const [se, ce] of Object.entries(R)) {
|
|
7511
7499
|
const Re = ce.filter((Ot) => !Ot._deleted).map((Ot) => {
|
|
7512
|
-
const { _key: Xl, _deleted:
|
|
7500
|
+
const { _key: Xl, _deleted: Bl, _dirty: Zl, ...$s } = Ot;
|
|
7513
7501
|
return $s;
|
|
7514
7502
|
}), kt = (L == null ? void 0 : L[se]) ?? [];
|
|
7515
|
-
(p || !
|
|
7503
|
+
(p || !kl(Re, kt)) && (K[se] = Re);
|
|
7516
7504
|
}
|
|
7517
7505
|
Object.keys(K).length > 0 && (O.$children = K);
|
|
7518
7506
|
}
|
|
7519
7507
|
if (!p && Object.keys(O).length === 0) {
|
|
7520
|
-
M(!1),
|
|
7508
|
+
M(!1), B({}), Y({}), C(void 0), V(void 0);
|
|
7521
7509
|
return;
|
|
7522
7510
|
}
|
|
7523
7511
|
const W = () => {
|
|
7524
|
-
M(!1),
|
|
7512
|
+
M(!1), B({}), Y({}), C(void 0), V(void 0);
|
|
7525
7513
|
};
|
|
7526
7514
|
p ? x.mutate(O, {
|
|
7527
7515
|
onSuccess: (K) => {
|
|
@@ -7532,7 +7520,7 @@ function Tl({ screenCode: e }) {
|
|
|
7532
7520
|
{ pkValues: g, data: O },
|
|
7533
7521
|
{ onSuccess: W }
|
|
7534
7522
|
);
|
|
7535
|
-
}, [p, m, u, q,
|
|
7523
|
+
}, [p, m, u, q, U, re, R, L, x, N, o, r, Pe, X]), cr = z((O, W) => {
|
|
7536
7524
|
C((K) => ({ ...K ?? {}, [O]: W }));
|
|
7537
7525
|
}, []), $e = z(() => {
|
|
7538
7526
|
!g || p || h.mutate(g, {
|
|
@@ -7541,22 +7529,22 @@ function Tl({ screenCode: e }) {
|
|
|
7541
7529
|
}, [g, p, h, r, Pe]), Pt = z(() => {
|
|
7542
7530
|
!g || p || v.mutate(g);
|
|
7543
7531
|
}, [g, p, v]), ft = ee(
|
|
7544
|
-
() =>
|
|
7532
|
+
() => Sl(R, a),
|
|
7545
7533
|
[R, a]
|
|
7546
7534
|
), $t = Object.keys(ft).length > 0;
|
|
7547
7535
|
if (!c || !o) return null;
|
|
7548
7536
|
if (!p && w) return /* @__PURE__ */ n(es, {});
|
|
7549
|
-
if (!p && !
|
|
7537
|
+
if (!p && !X)
|
|
7550
7538
|
return /* @__PURE__ */ d("div", { className: "p-6", children: [
|
|
7551
|
-
/* @__PURE__ */ n(
|
|
7539
|
+
/* @__PURE__ */ n(Bt, { title: "Not Found", backTo: Dt ? Pe : void 0 }),
|
|
7552
7540
|
/* @__PURE__ */ n("p", { className: "text-[var(--muted-foreground)]", children: "Record not found." })
|
|
7553
7541
|
] });
|
|
7554
|
-
const Wt = o.display, tt = P((He = c.display) == null ? void 0 : He.name) || P(Wt.name), Rt = (nt = o.display) == null ? void 0 : nt.display_field, rt = Rt ?
|
|
7542
|
+
const Wt = o.display, tt = P((He = c.display) == null ? void 0 : He.name) || P(Wt.name), Rt = (nt = o.display) == null ? void 0 : nt.display_field, rt = Rt ? X == null ? void 0 : X[Rt] : void 0, Et = rt && typeof rt == "object" && !Array.isArray(rt) ? P(rt) : rt, Ht = p ? `New ${tt}` : Et ? String(Et) : tt, _t = x.isPending || N.isPending, St = c.actions !== void 0, S = St ? kr(o.actions, c.actions, "detail", a == null ? void 0 : a.actions) : us(o.actions, "detail"), D = {
|
|
7555
7543
|
schema: a,
|
|
7556
7544
|
entity: o,
|
|
7557
7545
|
entityCode: u,
|
|
7558
7546
|
recordId: y ?? m ?? "",
|
|
7559
|
-
record: F ? { ...
|
|
7547
|
+
record: F ? { ...X ?? {}, ...q } : X ?? {},
|
|
7560
7548
|
isNew: p,
|
|
7561
7549
|
mode: F ? "edit" : "display",
|
|
7562
7550
|
onFieldChange: F ? or : void 0,
|
|
@@ -7576,23 +7564,23 @@ function Tl({ screenCode: e }) {
|
|
|
7576
7564
|
// In edit mode, merge pending status changes into displayed statuses and
|
|
7577
7565
|
// store changes locally (saved atomically on Save, discarded on Cancel).
|
|
7578
7566
|
objectStatuses: (() => {
|
|
7579
|
-
const O =
|
|
7580
|
-
if (!F || Object.keys(
|
|
7567
|
+
const O = _ ?? [];
|
|
7568
|
+
if (!F || Object.keys(U).length === 0) return O.length > 0 ? O : void 0;
|
|
7581
7569
|
const W = O.map(
|
|
7582
|
-
(K) =>
|
|
7570
|
+
(K) => U[K.group_code] !== void 0 ? { ...K, status_code: U[K.group_code] } : K
|
|
7583
7571
|
);
|
|
7584
|
-
for (const [K, se] of Object.entries(
|
|
7572
|
+
for (const [K, se] of Object.entries(U))
|
|
7585
7573
|
O.some((ce) => ce.group_code === K) || W.push({ group_code: K, status_code: se, status_name: {}, set_at: (/* @__PURE__ */ new Date()).toISOString() });
|
|
7586
7574
|
return W;
|
|
7587
7575
|
})(),
|
|
7588
|
-
onSetStatus: p || o != null && o.readonly ? void 0 : F ? (O, W) =>
|
|
7576
|
+
onSetStatus: p || o != null && o.readonly ? void 0 : F ? (O, W) => B((K) => ({ ...K, [O]: W })) : void 0,
|
|
7589
7577
|
isStatusPending: !1,
|
|
7590
7578
|
// Children editing context for direct (aggregate) children.
|
|
7591
7579
|
pendingChildren: F ? R : void 0,
|
|
7592
7580
|
onChildrenChange: F ? cr : void 0,
|
|
7593
7581
|
childValidationErrors: F ? ft : void 0
|
|
7594
7582
|
}, H = c.sidebar && c.sidebar.length > 0, ne = /* @__PURE__ */ n(
|
|
7595
|
-
|
|
7583
|
+
Bt,
|
|
7596
7584
|
{
|
|
7597
7585
|
title: Ht,
|
|
7598
7586
|
backTo: f || !Dt ? void 0 : Pe,
|
|
@@ -7617,14 +7605,14 @@ function Tl({ screenCode: e }) {
|
|
|
7617
7605
|
}
|
|
7618
7606
|
)
|
|
7619
7607
|
] }) : /* @__PURE__ */ d(pe, { children: [
|
|
7620
|
-
!p && m &&
|
|
7608
|
+
!p && m && S.map(({ code: O, action: W }) => {
|
|
7621
7609
|
var K, se;
|
|
7622
7610
|
if (W.type === "edit") {
|
|
7623
|
-
const ce =
|
|
7611
|
+
const ce = X ? pt(W.conditions, X) : !0;
|
|
7624
7612
|
return /* @__PURE__ */ n(j, { variant: "outline", onClick: We, disabled: !ce, children: P((K = W.display) == null ? void 0 : K.name) || "Edit" }, O);
|
|
7625
7613
|
}
|
|
7626
7614
|
if (W.type === "delete" && !f) {
|
|
7627
|
-
const ce =
|
|
7615
|
+
const ce = X ? pt(W.conditions, X) : !0;
|
|
7628
7616
|
return /* @__PURE__ */ d(
|
|
7629
7617
|
j,
|
|
7630
7618
|
{
|
|
@@ -7647,7 +7635,7 @@ function Tl({ screenCode: e }) {
|
|
|
7647
7635
|
action: W,
|
|
7648
7636
|
entityCode: u,
|
|
7649
7637
|
objectIds: W.scope !== "global" ? [m] : void 0,
|
|
7650
|
-
row:
|
|
7638
|
+
row: X,
|
|
7651
7639
|
variant: "outline"
|
|
7652
7640
|
},
|
|
7653
7641
|
O
|
|
@@ -7673,28 +7661,28 @@ function Tl({ screenCode: e }) {
|
|
|
7673
7661
|
/* @__PURE__ */ d("span", { children: [
|
|
7674
7662
|
"This record was deleted on",
|
|
7675
7663
|
" ",
|
|
7676
|
-
Nr(String(
|
|
7664
|
+
Nr(String(X[o.soft_delete]))
|
|
7677
7665
|
] })
|
|
7678
7666
|
] }), G = k && !p && !(c.items && c.items.length > 0) && /* @__PURE__ */ n("div", { className: "mb-4", children: /* @__PURE__ */ n(
|
|
7679
7667
|
_s,
|
|
7680
7668
|
{
|
|
7681
7669
|
statusGroups: o.status_groups ?? {},
|
|
7682
|
-
objectStatuses:
|
|
7683
|
-
onSetStatus: o != null && o.readonly ? Nn : F ? (O, W) =>
|
|
7670
|
+
objectStatuses: D.objectStatuses,
|
|
7671
|
+
onSetStatus: o != null && o.readonly ? Nn : F ? (O, W) => B((K) => ({ ...K, [O]: W })) : Nn,
|
|
7684
7672
|
isPending: !1,
|
|
7685
7673
|
mode: F && !(o != null && o.readonly) ? "edit" : "display"
|
|
7686
7674
|
}
|
|
7687
7675
|
) }), xe = /* @__PURE__ */ d(pe, { children: [
|
|
7688
|
-
c.items && c.items.length > 0 && (
|
|
7689
|
-
!p && m && u && o.associations && Object.keys(o.associations).length > 0 && a && /* @__PURE__ */ n(
|
|
7690
|
-
!p &&
|
|
7691
|
-
|
|
7676
|
+
c.items && c.items.length > 0 && (X || p) && a && /* @__PURE__ */ n(rr, { nodes: c.items, ctx: D }),
|
|
7677
|
+
!p && m && u && o.associations && Object.keys(o.associations).length > 0 && a && /* @__PURE__ */ n(So, { entityCode: u, recordId: y ?? m ?? "", associations: o.associations, schema: a }),
|
|
7678
|
+
!p && X && /* @__PURE__ */ d("div", { className: "flex gap-6 px-1 py-2 text-xs text-[var(--muted-foreground)]", children: [
|
|
7679
|
+
X.created_at != null && /* @__PURE__ */ d("span", { children: [
|
|
7692
7680
|
"Created: ",
|
|
7693
|
-
Nr(String(
|
|
7681
|
+
Nr(String(X.created_at))
|
|
7694
7682
|
] }),
|
|
7695
|
-
|
|
7683
|
+
X.updated_at != null && /* @__PURE__ */ d("span", { children: [
|
|
7696
7684
|
"Updated: ",
|
|
7697
|
-
Nr(String(
|
|
7685
|
+
Nr(String(X.updated_at))
|
|
7698
7686
|
] })
|
|
7699
7687
|
] })
|
|
7700
7688
|
] }), Ce = /* @__PURE__ */ n(
|
|
@@ -7725,7 +7713,7 @@ function Tl({ screenCode: e }) {
|
|
|
7725
7713
|
onMouseDown: je
|
|
7726
7714
|
}
|
|
7727
7715
|
),
|
|
7728
|
-
/* @__PURE__ */ n("div", { ref: Ne, className: "shrink-0 h-full", style: { width: `${fe}px` }, children: (
|
|
7716
|
+
/* @__PURE__ */ n("div", { ref: Ne, className: "shrink-0 h-full", style: { width: `${fe}px` }, children: (X || p) && a && /* @__PURE__ */ n(rr, { nodes: c.sidebar, ctx: D }) }),
|
|
7729
7717
|
Ce
|
|
7730
7718
|
] }) : /* @__PURE__ */ d("div", { className: "h-full flex flex-col overflow-hidden", children: [
|
|
7731
7719
|
/* @__PURE__ */ d("div", { className: "shrink-0 px-6 pt-6 pb-2", children: [
|
|
@@ -7737,7 +7725,7 @@ function Tl({ screenCode: e }) {
|
|
|
7737
7725
|
Ce
|
|
7738
7726
|
] });
|
|
7739
7727
|
}
|
|
7740
|
-
async function
|
|
7728
|
+
async function Tl(e, t, r, s, i) {
|
|
7741
7729
|
const a = {
|
|
7742
7730
|
status_group_code: r,
|
|
7743
7731
|
status_code: s
|
|
@@ -7752,10 +7740,10 @@ async function Al(e, t, r, s, i) {
|
|
|
7752
7740
|
))[0], o = (c == null ? void 0 : c.$statuses) ?? [];
|
|
7753
7741
|
return o.find((u) => u.group_code === r) ?? o[0];
|
|
7754
7742
|
}
|
|
7755
|
-
function
|
|
7743
|
+
function Al(e, t) {
|
|
7756
7744
|
const r = Fe();
|
|
7757
7745
|
return Ee({
|
|
7758
|
-
mutationFn: ({ groupCode: s, statusCode: i, note: a }) =>
|
|
7746
|
+
mutationFn: ({ groupCode: s, statusCode: i, note: a }) => Tl(e, t, s, i, a),
|
|
7759
7747
|
onSuccess: () => {
|
|
7760
7748
|
r.invalidateQueries({
|
|
7761
7749
|
queryKey: ["entity-item", e]
|
|
@@ -7766,7 +7754,7 @@ function Dl(e, t) {
|
|
|
7766
7754
|
}
|
|
7767
7755
|
});
|
|
7768
7756
|
}
|
|
7769
|
-
async function
|
|
7757
|
+
async function Dl(e, t, r, s) {
|
|
7770
7758
|
const a = (await ue(
|
|
7771
7759
|
`/api/data/${e}`,
|
|
7772
7760
|
{
|
|
@@ -7776,7 +7764,7 @@ async function Pl(e, t, r, s) {
|
|
|
7776
7764
|
))[0], l = (a == null ? void 0 : a.$properties) ?? [];
|
|
7777
7765
|
return l.find((c) => c.property_code === r) ?? l[0];
|
|
7778
7766
|
}
|
|
7779
|
-
async function
|
|
7767
|
+
async function Pl(e, t, r) {
|
|
7780
7768
|
await ue(
|
|
7781
7769
|
`/api/data/${e}`,
|
|
7782
7770
|
{
|
|
@@ -7785,10 +7773,10 @@ async function $l(e, t, r) {
|
|
|
7785
7773
|
}
|
|
7786
7774
|
);
|
|
7787
7775
|
}
|
|
7788
|
-
function
|
|
7776
|
+
function $l(e, t) {
|
|
7789
7777
|
const r = Fe();
|
|
7790
7778
|
return Ee({
|
|
7791
|
-
mutationFn: ({ propertyCode: s, value: i }) =>
|
|
7779
|
+
mutationFn: ({ propertyCode: s, value: i }) => Dl(e, t, s, i),
|
|
7792
7780
|
onSuccess: () => {
|
|
7793
7781
|
r.invalidateQueries({
|
|
7794
7782
|
queryKey: ["entity-item", e]
|
|
@@ -7799,10 +7787,10 @@ function Rl(e, t) {
|
|
|
7799
7787
|
}
|
|
7800
7788
|
});
|
|
7801
7789
|
}
|
|
7802
|
-
function
|
|
7790
|
+
function bc(e, t) {
|
|
7803
7791
|
const r = Fe();
|
|
7804
7792
|
return Ee({
|
|
7805
|
-
mutationFn: (s) =>
|
|
7793
|
+
mutationFn: (s) => Pl(e, t, s),
|
|
7806
7794
|
onSuccess: () => {
|
|
7807
7795
|
r.invalidateQueries({
|
|
7808
7796
|
queryKey: ["entity-item", e]
|
|
@@ -7813,8 +7801,8 @@ function Nc(e, t) {
|
|
|
7813
7801
|
}
|
|
7814
7802
|
});
|
|
7815
7803
|
}
|
|
7816
|
-
function
|
|
7817
|
-
var
|
|
7804
|
+
function Rl({ screenCode: e }) {
|
|
7805
|
+
var B, re, Y;
|
|
7818
7806
|
const [t, r] = yt(), { data: s } = qe(), i = s == null ? void 0 : s.screens[e], a = i != null && i.entity ? s == null ? void 0 : s.entities[i.entity] : void 0, l = i == null ? void 0 : i.entity, { openTab: c } = ht();
|
|
7819
7807
|
le(() => {
|
|
7820
7808
|
var R, C;
|
|
@@ -7828,7 +7816,7 @@ function El({ screenCode: e }) {
|
|
|
7828
7816
|
closable: !0
|
|
7829
7817
|
});
|
|
7830
7818
|
}
|
|
7831
|
-
}, [i == null ? void 0 : i.route, (re = (
|
|
7819
|
+
}, [i == null ? void 0 : i.route, (re = (B = i == null ? void 0 : i.display) == null ? void 0 : B.name) == null ? void 0 : re.en, (Y = a == null ? void 0 : a.display.name_plural) == null ? void 0 : Y.en]);
|
|
7832
7820
|
const o = t.get("selected") ?? null, u = t.get("search") ?? "", f = Gn(u, 300), m = t.get("sort") ?? (i == null ? void 0 : i.sort_default) ?? "", p = ee(() => {
|
|
7833
7821
|
const R = t.get("filters");
|
|
7834
7822
|
if (R)
|
|
@@ -7881,22 +7869,22 @@ function El({ screenCode: e }) {
|
|
|
7881
7869
|
(L) => {
|
|
7882
7870
|
const V = new URLSearchParams(L), Q = gs(L);
|
|
7883
7871
|
let Z;
|
|
7884
|
-
return C && C !== "__all__" ? Z = [...zt(Q, R),
|
|
7872
|
+
return C && C !== "__all__" ? Z = [...zt(Q, R), uo(R, C)] : Z = zt(Q, R), vs(Z, V), V;
|
|
7885
7873
|
},
|
|
7886
7874
|
{ replace: !0 }
|
|
7887
7875
|
);
|
|
7888
7876
|
},
|
|
7889
7877
|
[r]
|
|
7890
|
-
), k = (i == null ? void 0 : i.list_resizable) ?? !1,
|
|
7878
|
+
), k = (i == null ? void 0 : i.list_resizable) ?? !1, A = me(null), [_, T] = I(null), $ = me(!1), F = i == null ? void 0 : i.list_width;
|
|
7891
7879
|
le(() => {
|
|
7892
|
-
if (!k ||
|
|
7893
|
-
const R =
|
|
7880
|
+
if (!k || _ !== null) return;
|
|
7881
|
+
const R = A.current;
|
|
7894
7882
|
if (R)
|
|
7895
7883
|
if (F && F.endsWith("%")) {
|
|
7896
7884
|
const C = parseFloat(F) / 100;
|
|
7897
7885
|
T(Math.round(R.getBoundingClientRect().width * C));
|
|
7898
7886
|
} else T(F && parseInt(F, 10) || 320);
|
|
7899
|
-
}, [k, F,
|
|
7887
|
+
}, [k, F, _, a]);
|
|
7900
7888
|
const M = me(null);
|
|
7901
7889
|
le(() => () => {
|
|
7902
7890
|
var R;
|
|
@@ -7904,29 +7892,29 @@ function El({ screenCode: e }) {
|
|
|
7904
7892
|
}, []);
|
|
7905
7893
|
const q = z((R) => {
|
|
7906
7894
|
R.preventDefault(), $.current = !0;
|
|
7907
|
-
const C = R.clientX, L =
|
|
7895
|
+
const C = R.clientX, L = _ ?? 320, V = (Z) => {
|
|
7908
7896
|
var je;
|
|
7909
7897
|
if (!$.current) return;
|
|
7910
|
-
const fe = ((je =
|
|
7898
|
+
const fe = ((je = A.current) == null ? void 0 : je.getBoundingClientRect().width) ?? window.innerWidth, Te = 200, Ne = fe - 300, be = Math.max(Te, Math.min(Ne, L + Z.clientX - C));
|
|
7911
7899
|
T(be);
|
|
7912
7900
|
}, Q = () => {
|
|
7913
7901
|
$.current = !1, document.removeEventListener("mousemove", V), document.removeEventListener("mouseup", Q), document.body.style.cursor = "", document.body.style.userSelect = "", M.current = null;
|
|
7914
7902
|
};
|
|
7915
7903
|
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", V), document.addEventListener("mouseup", Q), M.current = Q;
|
|
7916
|
-
}, [
|
|
7904
|
+
}, [_]);
|
|
7917
7905
|
if (!s || !i || !a) return null;
|
|
7918
7906
|
const E = i.columns ?? a.field_order.filter(
|
|
7919
7907
|
(R) => {
|
|
7920
7908
|
var C, L, V, Q;
|
|
7921
7909
|
return !((C = a.fields[R]) != null && C.primary) && !((L = a.fields[R]) != null && L.auto) && ((Q = (V = a.fields[R]) == null ? void 0 : V.display) == null ? void 0 : Q.is_listable) !== !1;
|
|
7922
7910
|
}
|
|
7923
|
-
).slice(0, 4),
|
|
7924
|
-
return /* @__PURE__ */ d("div", { ref:
|
|
7911
|
+
).slice(0, 4), U = (p == null ? void 0 : p.length) ?? 0;
|
|
7912
|
+
return /* @__PURE__ */ d("div", { ref: A, className: "flex h-full overflow-hidden", children: [
|
|
7925
7913
|
/* @__PURE__ */ d(
|
|
7926
7914
|
"div",
|
|
7927
7915
|
{
|
|
7928
7916
|
className: J("flex-none flex flex-col overflow-hidden", !k && "border-r"),
|
|
7929
|
-
style: { width: k &&
|
|
7917
|
+
style: { width: k && _ !== null ? _ : i.list_width ?? "320px" },
|
|
7930
7918
|
children: [
|
|
7931
7919
|
/* @__PURE__ */ d("div", { className: "p-3 space-y-2 border-b", children: [
|
|
7932
7920
|
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
@@ -7960,11 +7948,11 @@ function El({ screenCode: e }) {
|
|
|
7960
7948
|
}
|
|
7961
7949
|
) }),
|
|
7962
7950
|
/* @__PURE__ */ d(ot, { children: [
|
|
7963
|
-
/* @__PURE__ */ d(
|
|
7951
|
+
/* @__PURE__ */ d(Ue, { value: "__all__", children: [
|
|
7964
7952
|
"All ",
|
|
7965
7953
|
De(C, R, s.entities)
|
|
7966
7954
|
] }),
|
|
7967
|
-
C.values.map((Q) => /* @__PURE__ */ n(
|
|
7955
|
+
C.values.map((Q) => /* @__PURE__ */ n(Ue, { value: Q.code, children: P(Q.name) }, Q.code))
|
|
7968
7956
|
] })
|
|
7969
7957
|
]
|
|
7970
7958
|
},
|
|
@@ -7973,7 +7961,7 @@ function El({ screenCode: e }) {
|
|
|
7973
7961
|
}) }),
|
|
7974
7962
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
|
|
7975
7963
|
/* @__PURE__ */ n("span", { children: y ? "Loading..." : `${b.length} ${P(a.display.name_plural)}` }),
|
|
7976
|
-
|
|
7964
|
+
U > 0 && /* @__PURE__ */ n(
|
|
7977
7965
|
"button",
|
|
7978
7966
|
{
|
|
7979
7967
|
className: "text-primary underline",
|
|
@@ -7990,7 +7978,7 @@ function El({ screenCode: e }) {
|
|
|
7990
7978
|
] })
|
|
7991
7979
|
] }),
|
|
7992
7980
|
/* @__PURE__ */ n("div", { className: "flex-1 overflow-y-auto", children: y ? /* @__PURE__ */ n("div", { className: "p-3 space-y-2", children: Array.from({ length: 8 }).map((R, C) => /* @__PURE__ */ n("div", { className: "h-12 rounded bg-muted animate-pulse" }, C)) }) : b.length === 0 ? /* @__PURE__ */ n("div", { className: "p-8 text-center text-sm text-muted-foreground", children: "No records found" }) : b.map((R) => /* @__PURE__ */ n(
|
|
7993
|
-
|
|
7981
|
+
El,
|
|
7994
7982
|
{
|
|
7995
7983
|
record: R,
|
|
7996
7984
|
entity: a,
|
|
@@ -8013,7 +8001,7 @@ function El({ screenCode: e }) {
|
|
|
8013
8001
|
}
|
|
8014
8002
|
),
|
|
8015
8003
|
/* @__PURE__ */ n("div", { className: "flex-1 min-w-0 overflow-hidden", children: o ? /* @__PURE__ */ n(
|
|
8016
|
-
|
|
8004
|
+
Ol,
|
|
8017
8005
|
{
|
|
8018
8006
|
entityCode: l,
|
|
8019
8007
|
recordId: o,
|
|
@@ -8029,7 +8017,7 @@ function El({ screenCode: e }) {
|
|
|
8029
8017
|
] }) }) })
|
|
8030
8018
|
] });
|
|
8031
8019
|
}
|
|
8032
|
-
function
|
|
8020
|
+
function El({
|
|
8033
8021
|
record: e,
|
|
8034
8022
|
entity: t,
|
|
8035
8023
|
columns: r,
|
|
@@ -8080,7 +8068,7 @@ function Ol({
|
|
|
8080
8068
|
}
|
|
8081
8069
|
);
|
|
8082
8070
|
}
|
|
8083
|
-
function
|
|
8071
|
+
function Ol({
|
|
8084
8072
|
entityCode: e,
|
|
8085
8073
|
recordId: t,
|
|
8086
8074
|
items: r,
|
|
@@ -8088,10 +8076,10 @@ function Fl({
|
|
|
8088
8076
|
entity: i
|
|
8089
8077
|
}) {
|
|
8090
8078
|
var M;
|
|
8091
|
-
const { data: a, isLoading: l } = bs(e, t), c = Hn(e), [o, u] =
|
|
8079
|
+
const { data: a, isLoading: l } = bs(e, t), c = Hn(e), [o, u] = I(!1), [f, m] = I({}), p = a == null ? void 0 : a.data, g = p == null ? void 0 : p.$statuses, y = p == null ? void 0 : p.$properties, b = Al(e, t), w = $l(e, t), x = ee(() => {
|
|
8092
8080
|
const q = /* @__PURE__ */ new Set();
|
|
8093
|
-
for (const [E,
|
|
8094
|
-
!
|
|
8081
|
+
for (const [E, U] of Object.entries(i.fields))
|
|
8082
|
+
!U.auto && !U.primary && q.add(E);
|
|
8095
8083
|
return q;
|
|
8096
8084
|
}, [i]), N = z(() => {
|
|
8097
8085
|
if (p) {
|
|
@@ -8114,11 +8102,11 @@ function Fl({
|
|
|
8114
8102
|
}
|
|
8115
8103
|
);
|
|
8116
8104
|
}, [c, t, f]), k = z((q, E) => {
|
|
8117
|
-
m((
|
|
8105
|
+
m((U) => ({ ...U, [q]: E }));
|
|
8118
8106
|
}, []);
|
|
8119
8107
|
if (l) return /* @__PURE__ */ n(es, {});
|
|
8120
8108
|
if (!p) return null;
|
|
8121
|
-
const
|
|
8109
|
+
const A = (M = i.display) == null ? void 0 : M.display_field, _ = A ? p[A] : p[i.field_order[0]], T = _ != null && typeof _ != "object" ? String(_) : P(i.display.name), $ = p == null ? void 0 : p.$refs, F = {
|
|
8122
8110
|
schema: s,
|
|
8123
8111
|
entity: i,
|
|
8124
8112
|
entityCode: e,
|
|
@@ -8235,8 +8223,8 @@ const Ss = {
|
|
|
8235
8223
|
sidebar_accent: "--sidebar-accent",
|
|
8236
8224
|
sidebar_muted: "--sidebar-muted",
|
|
8237
8225
|
radius: "--radius"
|
|
8238
|
-
},
|
|
8239
|
-
function
|
|
8226
|
+
}, Fl = Object.values(Ss);
|
|
8227
|
+
function Ll(e) {
|
|
8240
8228
|
const t = {};
|
|
8241
8229
|
for (const [r, s] of Object.entries(Ss)) {
|
|
8242
8230
|
const i = e[r];
|
|
@@ -8253,7 +8241,7 @@ function Ts(e) {
|
|
|
8253
8241
|
}
|
|
8254
8242
|
function nr(e, t) {
|
|
8255
8243
|
const r = document.documentElement;
|
|
8256
|
-
r.classList.remove("dark"), r.setAttribute("data-theme", e),
|
|
8244
|
+
r.classList.remove("dark"), r.setAttribute("data-theme", e), ql(r);
|
|
8257
8245
|
const s = t[e];
|
|
8258
8246
|
if (s) {
|
|
8259
8247
|
for (const [a, l] of Object.entries(s))
|
|
@@ -8261,14 +8249,14 @@ function nr(e, t) {
|
|
|
8261
8249
|
(s["--_base"] === "dark" || e === "dark") && r.classList.add("dark");
|
|
8262
8250
|
} else e === "dark" && r.classList.add("dark");
|
|
8263
8251
|
}
|
|
8264
|
-
function
|
|
8265
|
-
for (const t of
|
|
8252
|
+
function ql(e) {
|
|
8253
|
+
for (const t of Fl)
|
|
8266
8254
|
e.style.removeProperty(t);
|
|
8267
8255
|
}
|
|
8268
|
-
function
|
|
8256
|
+
function jl() {
|
|
8269
8257
|
return typeof window > "u" ? "light" : localStorage.getItem(ks) || "light";
|
|
8270
8258
|
}
|
|
8271
|
-
const As =
|
|
8259
|
+
const As = jl(), Ds = Ts(As);
|
|
8272
8260
|
typeof window < "u" && nr(Ds, {});
|
|
8273
8261
|
const Ar = Fr((e, t) => ({
|
|
8274
8262
|
selectedTheme: As,
|
|
@@ -8292,13 +8280,13 @@ typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").addEven
|
|
|
8292
8280
|
}
|
|
8293
8281
|
});
|
|
8294
8282
|
const Ps = /* @__PURE__ */ new Map();
|
|
8295
|
-
function
|
|
8283
|
+
function Nc(e, t) {
|
|
8296
8284
|
Ps.set(e, t);
|
|
8297
8285
|
}
|
|
8298
|
-
function
|
|
8286
|
+
function zl(e) {
|
|
8299
8287
|
return Ps.get(e);
|
|
8300
8288
|
}
|
|
8301
|
-
const
|
|
8289
|
+
const Ml = new Us({
|
|
8302
8290
|
defaultOptions: {
|
|
8303
8291
|
queries: {
|
|
8304
8292
|
staleTime: 300 * 1e3,
|
|
@@ -8314,10 +8302,10 @@ function Ul() {
|
|
|
8314
8302
|
if (a.type === "list") {
|
|
8315
8303
|
s.push(
|
|
8316
8304
|
/* @__PURE__ */ n(
|
|
8317
|
-
|
|
8305
|
+
Ie,
|
|
8318
8306
|
{
|
|
8319
8307
|
path: a.route,
|
|
8320
|
-
element: /* @__PURE__ */ n(jt, { children: /* @__PURE__ */ n(
|
|
8308
|
+
element: /* @__PURE__ */ n(jt, { children: /* @__PURE__ */ n(No, { screenCode: i }) })
|
|
8321
8309
|
},
|
|
8322
8310
|
i
|
|
8323
8311
|
)
|
|
@@ -8327,10 +8315,10 @@ function Ul() {
|
|
|
8327
8315
|
if (a.type === "detail") {
|
|
8328
8316
|
s.push(
|
|
8329
8317
|
/* @__PURE__ */ n(
|
|
8330
|
-
|
|
8318
|
+
Ie,
|
|
8331
8319
|
{
|
|
8332
8320
|
path: a.route,
|
|
8333
|
-
element: /* @__PURE__ */ n(jt, { children: /* @__PURE__ */ n(
|
|
8321
|
+
element: /* @__PURE__ */ n(jt, { children: /* @__PURE__ */ n(Cl, { screenCode: i }) })
|
|
8334
8322
|
},
|
|
8335
8323
|
i
|
|
8336
8324
|
)
|
|
@@ -8340,10 +8328,10 @@ function Ul() {
|
|
|
8340
8328
|
if (a.type === "record_list") {
|
|
8341
8329
|
s.push(
|
|
8342
8330
|
/* @__PURE__ */ n(
|
|
8343
|
-
|
|
8331
|
+
Ie,
|
|
8344
8332
|
{
|
|
8345
8333
|
path: a.route,
|
|
8346
|
-
element: /* @__PURE__ */ n(jt, { children: /* @__PURE__ */ n(
|
|
8334
|
+
element: /* @__PURE__ */ n(jt, { children: /* @__PURE__ */ n(Rl, { screenCode: i }) })
|
|
8347
8335
|
},
|
|
8348
8336
|
i
|
|
8349
8337
|
)
|
|
@@ -8351,10 +8339,10 @@ function Ul() {
|
|
|
8351
8339
|
continue;
|
|
8352
8340
|
}
|
|
8353
8341
|
if (a.type === "custom") {
|
|
8354
|
-
const l = a.component ?
|
|
8342
|
+
const l = a.component ? zl(a.component) : void 0;
|
|
8355
8343
|
l && s.push(
|
|
8356
8344
|
/* @__PURE__ */ n(
|
|
8357
|
-
|
|
8345
|
+
Ie,
|
|
8358
8346
|
{
|
|
8359
8347
|
path: a.route,
|
|
8360
8348
|
element: /* @__PURE__ */ n(jt, { children: /* @__PURE__ */ n(l, {}) })
|
|
@@ -8384,7 +8372,7 @@ function Ul() {
|
|
|
8384
8372
|
}, [e]);
|
|
8385
8373
|
return { routes: t, defaultRoute: r };
|
|
8386
8374
|
}
|
|
8387
|
-
function
|
|
8375
|
+
function Il() {
|
|
8388
8376
|
const e = ct((l) => l.initialize), { data: t } = qe(), r = Ar((l) => l.setAvailableThemes), { routes: s, defaultRoute: i } = Ul();
|
|
8389
8377
|
le(() => {
|
|
8390
8378
|
e();
|
|
@@ -8394,39 +8382,39 @@ function Vl() {
|
|
|
8394
8382
|
if (!a || !(t != null && t.themes)) return;
|
|
8395
8383
|
const l = {};
|
|
8396
8384
|
for (const [c, o] of Object.entries(t.themes))
|
|
8397
|
-
l[c] =
|
|
8385
|
+
l[c] = Ll(o);
|
|
8398
8386
|
r(l);
|
|
8399
8387
|
}, [a, r]), /* @__PURE__ */ d(js, { children: [
|
|
8400
|
-
/* @__PURE__ */ n(
|
|
8401
|
-
/* @__PURE__ */ n(
|
|
8402
|
-
/* @__PURE__ */ n(
|
|
8403
|
-
/* @__PURE__ */ d(
|
|
8404
|
-
i && /* @__PURE__ */ n(
|
|
8388
|
+
/* @__PURE__ */ n(Ie, { path: "/login", element: /* @__PURE__ */ n(Yi, {}) }),
|
|
8389
|
+
/* @__PURE__ */ n(Ie, { path: "/login/sso-callback", element: /* @__PURE__ */ n(Bi, {}) }),
|
|
8390
|
+
/* @__PURE__ */ n(Ie, { path: "/signup", element: /* @__PURE__ */ n(Xi, {}) }),
|
|
8391
|
+
/* @__PURE__ */ d(Ie, { element: /* @__PURE__ */ n(Ji, {}), children: [
|
|
8392
|
+
i && /* @__PURE__ */ n(Ie, { index: !0, element: /* @__PURE__ */ n(zs, { to: i, replace: !0 }) }),
|
|
8405
8393
|
s,
|
|
8406
|
-
/* @__PURE__ */ n(
|
|
8407
|
-
/* @__PURE__ */ n(
|
|
8394
|
+
/* @__PURE__ */ n(Ie, { path: "/admin/catalog", element: /* @__PURE__ */ n(ta, {}) }),
|
|
8395
|
+
/* @__PURE__ */ n(Ie, { path: "*", element: /* @__PURE__ */ n(Zi, {}) })
|
|
8408
8396
|
] })
|
|
8409
8397
|
] });
|
|
8410
8398
|
}
|
|
8411
|
-
function
|
|
8412
|
-
return /* @__PURE__ */ n(jt, { children: /* @__PURE__ */ n(
|
|
8413
|
-
/* @__PURE__ */ n(
|
|
8399
|
+
function wc() {
|
|
8400
|
+
return /* @__PURE__ */ n(jt, { children: /* @__PURE__ */ n(Is, { client: Ml, children: /* @__PURE__ */ d(qs, { children: [
|
|
8401
|
+
/* @__PURE__ */ n(Il, {}),
|
|
8414
8402
|
/* @__PURE__ */ n(Vs, { richColors: !0, position: "top-right", toastOptions: { className: "select-text" } })
|
|
8415
8403
|
] }) }) });
|
|
8416
8404
|
}
|
|
8417
|
-
function
|
|
8405
|
+
function Vl(e, t) {
|
|
8418
8406
|
var r;
|
|
8419
8407
|
return (r = e.$statuses) == null ? void 0 : r.find((s) => s.group_code === t);
|
|
8420
8408
|
}
|
|
8421
|
-
function
|
|
8409
|
+
function Kl(e, t) {
|
|
8422
8410
|
var r;
|
|
8423
8411
|
return (r = e.$properties) == null ? void 0 : r.find((s) => s.property_code === t);
|
|
8424
8412
|
}
|
|
8425
8413
|
function Lt(e) {
|
|
8426
8414
|
const t = { ...e };
|
|
8427
|
-
return t.$status = (r) =>
|
|
8415
|
+
return t.$status = (r) => Vl(t, r), t.$property = (r) => Kl(t, r), t;
|
|
8428
8416
|
}
|
|
8429
|
-
class
|
|
8417
|
+
class Wl {
|
|
8430
8418
|
constructor() {
|
|
8431
8419
|
st(this, "cache", {});
|
|
8432
8420
|
}
|
|
@@ -8457,15 +8445,15 @@ class Hl {
|
|
|
8457
8445
|
this.cache = {};
|
|
8458
8446
|
}
|
|
8459
8447
|
}
|
|
8460
|
-
function
|
|
8448
|
+
function Hl(e, t) {
|
|
8461
8449
|
const r = new URL(`/api/data/${e}`, window.location.origin);
|
|
8462
8450
|
return t.select && t.select.length > 0 && r.searchParams.set("select", t.select.join(",")), t.expand && t.expand.length > 0 && r.searchParams.set("expand", t.expand.join(",")), t.sort && r.searchParams.set("sort", t.sort), t.search && r.searchParams.set("search", t.search), t.limit && r.searchParams.set("limit", String(t.limit)), t.after && r.searchParams.set("after", t.after), t.include_deleted && r.searchParams.set("include_deleted", "true"), t.filters && t.filters.length > 0 && r.searchParams.set("filters", JSON.stringify(t.filters)), r.pathname + r.search;
|
|
8463
8451
|
}
|
|
8464
|
-
class
|
|
8452
|
+
class Jl {
|
|
8465
8453
|
constructor(t, r) {
|
|
8466
8454
|
st(this, "entity");
|
|
8467
8455
|
st(this, "refs");
|
|
8468
|
-
this.entity = t, this.refs = r ?? new
|
|
8456
|
+
this.entity = t, this.refs = r ?? new Wl();
|
|
8469
8457
|
}
|
|
8470
8458
|
// ---- Read ----------------------------------------------------------------
|
|
8471
8459
|
/** Get a single record by ID. Returns the full object with all sub-resources. */
|
|
@@ -8478,7 +8466,7 @@ class Ql {
|
|
|
8478
8466
|
/** List records with cursor-based pagination, field selection, and expansion. */
|
|
8479
8467
|
async list(t = {}) {
|
|
8480
8468
|
const r = await ue(
|
|
8481
|
-
|
|
8469
|
+
Hl(this.entity, t)
|
|
8482
8470
|
);
|
|
8483
8471
|
return this.refs.merge(r.$refs), { data: r.data.map((i) => Lt(i)), meta: r.meta, $refs: this.refs.all() };
|
|
8484
8472
|
}
|
|
@@ -8544,40 +8532,40 @@ class Ql {
|
|
|
8544
8532
|
)).map((a) => Lt(a));
|
|
8545
8533
|
}
|
|
8546
8534
|
}
|
|
8547
|
-
function
|
|
8548
|
-
return new
|
|
8535
|
+
function _c(e, t) {
|
|
8536
|
+
return new Jl(e, t);
|
|
8549
8537
|
}
|
|
8550
|
-
async function
|
|
8538
|
+
async function Ql() {
|
|
8551
8539
|
return (await ue("/api/params/public")).data;
|
|
8552
8540
|
}
|
|
8553
|
-
async function
|
|
8541
|
+
async function Gl(e) {
|
|
8554
8542
|
return (await ue(
|
|
8555
8543
|
`/api/params/${encodeURIComponent(e)}`
|
|
8556
8544
|
)).data;
|
|
8557
8545
|
}
|
|
8558
|
-
function
|
|
8546
|
+
function Sc() {
|
|
8559
8547
|
return Ve({
|
|
8560
8548
|
queryKey: ["params-public"],
|
|
8561
|
-
queryFn:
|
|
8549
|
+
queryFn: Ql,
|
|
8562
8550
|
staleTime: 300 * 1e3
|
|
8563
8551
|
});
|
|
8564
8552
|
}
|
|
8565
|
-
function
|
|
8553
|
+
function kc(e) {
|
|
8566
8554
|
return Ve({
|
|
8567
8555
|
queryKey: ["params", e],
|
|
8568
|
-
queryFn: () =>
|
|
8556
|
+
queryFn: () => Gl(e),
|
|
8569
8557
|
enabled: !!e,
|
|
8570
8558
|
staleTime: 300 * 1e3
|
|
8571
8559
|
});
|
|
8572
8560
|
}
|
|
8573
|
-
function
|
|
8561
|
+
function Cc(e, t) {
|
|
8574
8562
|
const [r, s] = yt(), i = ee(() => {
|
|
8575
8563
|
const f = r.get("columns");
|
|
8576
8564
|
return f ? f.split(",").filter(Boolean).filter((p) => e.includes(p)) : t.length > 0 ? t : e;
|
|
8577
8565
|
}, [r, e, t]), a = z(
|
|
8578
8566
|
(f) => {
|
|
8579
8567
|
const m = new URLSearchParams(r);
|
|
8580
|
-
f.length === 0 ||
|
|
8568
|
+
f.length === 0 || Yl(f, t) ? m.delete("columns") : m.set("columns", f.join(",")), s(m);
|
|
8581
8569
|
},
|
|
8582
8570
|
[r, s, t]
|
|
8583
8571
|
), l = z(() => {
|
|
@@ -8608,54 +8596,54 @@ function Tc(e, t) {
|
|
|
8608
8596
|
toggleColumn: u
|
|
8609
8597
|
};
|
|
8610
8598
|
}
|
|
8611
|
-
function
|
|
8599
|
+
function Yl(e, t) {
|
|
8612
8600
|
return e.length !== t.length ? !1 : e.every((r, s) => r === t[s]);
|
|
8613
8601
|
}
|
|
8614
8602
|
export {
|
|
8615
|
-
|
|
8616
|
-
|
|
8603
|
+
wc as App,
|
|
8604
|
+
vo as ColumnPicker,
|
|
8617
8605
|
Zr as ConfirmDialog,
|
|
8618
|
-
|
|
8606
|
+
wc as Declarion,
|
|
8619
8607
|
Ge as DynamicIcon,
|
|
8620
8608
|
fn as EmptyState,
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8609
|
+
Jl as EntityClient,
|
|
8610
|
+
mo as FilterChips,
|
|
8611
|
+
po as FilterDrawer,
|
|
8624
8612
|
ps as NO_VALUE_OPS,
|
|
8625
8613
|
hs as OP_LABELS,
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8614
|
+
Bt as PageHeader,
|
|
8615
|
+
Wl as RefCache,
|
|
8616
|
+
Cl as SmartDetailPage,
|
|
8617
|
+
No as SmartListPage,
|
|
8618
|
+
Rl as SmartRecordListPage,
|
|
8619
|
+
yo as ViewSwitcher,
|
|
8620
|
+
co as countActiveFilters,
|
|
8621
|
+
_c as entityClient,
|
|
8634
8622
|
De as fieldDisplayName,
|
|
8635
8623
|
ys as hasOrGroups,
|
|
8636
8624
|
P as loc,
|
|
8637
8625
|
gs as parseFiltersFromURL,
|
|
8638
|
-
|
|
8626
|
+
Nc as registerScreen,
|
|
8639
8627
|
vs as setFiltersInURL,
|
|
8640
8628
|
jr as useAuth,
|
|
8641
|
-
|
|
8629
|
+
Cc as useColumns,
|
|
8642
8630
|
ua as useCreateEntity,
|
|
8643
8631
|
Gn as useDebounce,
|
|
8644
8632
|
Jn as useDeleteEntity,
|
|
8645
|
-
|
|
8646
|
-
|
|
8633
|
+
bc as useDeleteProperty,
|
|
8634
|
+
Bn as useEntity,
|
|
8647
8635
|
Kt as useEntityData,
|
|
8648
8636
|
bs as useEntityItem,
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8637
|
+
fo as useFilters,
|
|
8638
|
+
Sc as usePublicParams,
|
|
8639
|
+
kc as useResolvedParam,
|
|
8652
8640
|
qe as useSchema,
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8641
|
+
xo as useScreen,
|
|
8642
|
+
$l as useSetProperty,
|
|
8643
|
+
Al as useSetStatus,
|
|
8644
|
+
Ut as useTabNavigate,
|
|
8657
8645
|
ht as useTabStore,
|
|
8658
8646
|
Hn as useUpdateEntity,
|
|
8659
|
-
|
|
8647
|
+
bo as useViews
|
|
8660
8648
|
};
|
|
8661
8649
|
//# sourceMappingURL=index.js.map
|