@declarion/react 0.1.31 → 0.1.32
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 +491 -492
- package/dist-lib/index.js.map +1 -1
- package/dist-lib/types/schema.d.ts +0 -2
- package/package.json +1 -1
package/dist-lib/index.js
CHANGED
|
@@ -4,7 +4,7 @@ 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
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
|
|
7
|
+
import { useNavigate as Xe, useLocation as Dr, Outlet as Fs, useSearchParams as yt, Link as _n, useParams as Ls, BrowserRouter as js, Routes as qs, Route as Ie, Navigate as zs } from "react-router-dom";
|
|
8
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
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";
|
|
@@ -18,7 +18,7 @@ import { cva as Lr } from "class-variance-authority";
|
|
|
18
18
|
import { useSensors as Dn, useSensor as Pn, PointerSensor as $n, DndContext as Rn, closestCenter as En } from "@dnd-kit/core";
|
|
19
19
|
import { SortableContext as On, horizontalListSortingStrategy as fi, useSortable as Fn, verticalListSortingStrategy as mi } from "@dnd-kit/sortable";
|
|
20
20
|
import { CSS as Ln } from "@dnd-kit/utilities";
|
|
21
|
-
import * as
|
|
21
|
+
import * as jn from "@radix-ui/react-label";
|
|
22
22
|
import { useReactTable as pi, getCoreRowModel as hi, flexRender as dr } from "@tanstack/react-table";
|
|
23
23
|
import { useVirtualizer as gi } from "@tanstack/react-virtual";
|
|
24
24
|
import vi from "react-markdown";
|
|
@@ -39,14 +39,14 @@ class Jt extends Error {
|
|
|
39
39
|
this.name = "ApiError", this.status = r, this.code = i, this.index = a;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
const
|
|
42
|
+
const qn = (e) => JSON.stringify(e ?? {});
|
|
43
43
|
let Ft = null;
|
|
44
44
|
async function xi() {
|
|
45
45
|
const e = {
|
|
46
46
|
method: "POST",
|
|
47
47
|
credentials: "include",
|
|
48
48
|
headers: { "Content-Type": "application/json" },
|
|
49
|
-
body:
|
|
49
|
+
body: qn({})
|
|
50
50
|
}, t = await fetch("/api/actions/auth.refresh", e);
|
|
51
51
|
if (t.status === 429) {
|
|
52
52
|
const r = parseInt(t.headers.get("Retry-After") || "1", 10);
|
|
@@ -109,14 +109,14 @@ async function lt(e, t = {}) {
|
|
|
109
109
|
`/api/actions/${encodeURIComponent(e)}`,
|
|
110
110
|
{
|
|
111
111
|
method: "POST",
|
|
112
|
-
body:
|
|
112
|
+
body: qn(t)
|
|
113
113
|
}
|
|
114
114
|
)).result;
|
|
115
115
|
}
|
|
116
116
|
async function Ni() {
|
|
117
117
|
return ue("/api/schema");
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function je() {
|
|
120
120
|
return Ve({
|
|
121
121
|
queryKey: ["schema"],
|
|
122
122
|
queryFn: Ni,
|
|
@@ -208,17 +208,17 @@ function Ge({ name: e, ...t }) {
|
|
|
208
208
|
return r ? /* @__PURE__ */ n(wr, { fallback: /* @__PURE__ */ n("div", { className: "w-4 h-4" }), children: /* @__PURE__ */ n(r, { ...t }) }) : null;
|
|
209
209
|
}
|
|
210
210
|
const Si = "none";
|
|
211
|
-
function
|
|
211
|
+
function D(e, t = "en") {
|
|
212
212
|
return e ? e[t] ?? Object.values(e)[0] ?? "" : "";
|
|
213
213
|
}
|
|
214
214
|
function De(e, t, r) {
|
|
215
215
|
var i, a, l;
|
|
216
|
-
const s =
|
|
216
|
+
const s = D((i = e.display) == null ? void 0 : i.name);
|
|
217
217
|
if (s) return s;
|
|
218
218
|
if (e.type === "ref" && ((a = e.ref) != null && a.entity) && r) {
|
|
219
219
|
const c = r[e.ref.entity];
|
|
220
220
|
if (c) {
|
|
221
|
-
const o =
|
|
221
|
+
const o = D((l = c.display) == null ? void 0 : l.name);
|
|
222
222
|
if (o) return o;
|
|
223
223
|
}
|
|
224
224
|
}
|
|
@@ -234,7 +234,7 @@ function ki(e) {
|
|
|
234
234
|
structure: e.structure
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function jr(e) {
|
|
238
238
|
var t;
|
|
239
239
|
if (e.primary_key && e.primary_key.length > 0)
|
|
240
240
|
return e.primary_key;
|
|
@@ -243,7 +243,7 @@ function qr(e) {
|
|
|
243
243
|
return ["id"];
|
|
244
244
|
}
|
|
245
245
|
function Ci(e, t) {
|
|
246
|
-
const r =
|
|
246
|
+
const r = jr(e), s = {};
|
|
247
247
|
for (const i of r)
|
|
248
248
|
s[i] = String(t[i] ?? "");
|
|
249
249
|
return s;
|
|
@@ -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] = I(!1), [r, s] = I({}), i = Dr(), { data: a } =
|
|
256
|
+
const [e, t] = I(!1), [r, s] = I({}), i = Dr(), { data: a } = je(), 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;
|
|
@@ -283,7 +283,7 @@ function Ti() {
|
|
|
283
283
|
onClick: () => {
|
|
284
284
|
const b = p(c), w = b != null && b.screen ? a == null ? void 0 : a.screens[b.screen] : void 0;
|
|
285
285
|
w && b && l(w.route, {
|
|
286
|
-
title:
|
|
286
|
+
title: D(b.name),
|
|
287
287
|
icon: b.icon
|
|
288
288
|
});
|
|
289
289
|
},
|
|
@@ -304,7 +304,7 @@ function Ti() {
|
|
|
304
304
|
onClick: () => g(w),
|
|
305
305
|
className: "flex items-center justify-between w-full px-3 mb-1 text-[10px] font-semibold uppercase tracking-wider text-[var(--sidebar-muted)] hover:text-[var(--sidebar-foreground)] transition-colors",
|
|
306
306
|
children: [
|
|
307
|
-
/* @__PURE__ */ n("span", { children:
|
|
307
|
+
/* @__PURE__ */ n("span", { children: D(b.name) }),
|
|
308
308
|
/* @__PURE__ */ n(
|
|
309
309
|
Mt,
|
|
310
310
|
{
|
|
@@ -326,17 +326,17 @@ function Ti() {
|
|
|
326
326
|
"button",
|
|
327
327
|
{
|
|
328
328
|
onClick: () => l(h, {
|
|
329
|
-
title:
|
|
329
|
+
title: D(x.name),
|
|
330
330
|
icon: x.icon
|
|
331
331
|
}),
|
|
332
332
|
className: J(
|
|
333
333
|
"flex items-center gap-3 px-3 py-2 rounded-md text-sm transition-colors w-full text-left",
|
|
334
334
|
v ? "bg-[var(--sidebar-accent)] text-[var(--sidebar-foreground)]" : "text-[var(--sidebar-muted)] hover:bg-[var(--sidebar-accent)]/50 hover:text-[var(--sidebar-foreground)]"
|
|
335
335
|
),
|
|
336
|
-
title: e ?
|
|
336
|
+
title: e ? D(x.name) : void 0,
|
|
337
337
|
children: [
|
|
338
338
|
x.icon && /* @__PURE__ */ n(Ge, { name: x.icon, className: "w-4 h-4 shrink-0" }),
|
|
339
|
-
!e && /* @__PURE__ */ n("span", { children:
|
|
339
|
+
!e && /* @__PURE__ */ n("span", { children: D(x.name) })
|
|
340
340
|
]
|
|
341
341
|
},
|
|
342
342
|
x.screen
|
|
@@ -353,17 +353,17 @@ function Ti() {
|
|
|
353
353
|
"button",
|
|
354
354
|
{
|
|
355
355
|
onClick: () => l(N, {
|
|
356
|
-
title:
|
|
356
|
+
title: D(b.name),
|
|
357
357
|
icon: b.icon
|
|
358
358
|
}),
|
|
359
359
|
className: J(
|
|
360
360
|
"flex items-center gap-3 px-3 py-2 rounded-md text-sm transition-colors w-full text-left",
|
|
361
361
|
h ? "bg-[var(--sidebar-accent)] text-[var(--sidebar-foreground)]" : "text-[var(--sidebar-muted)] hover:bg-[var(--sidebar-accent)]/50 hover:text-[var(--sidebar-foreground)]"
|
|
362
362
|
),
|
|
363
|
-
title: e ?
|
|
363
|
+
title: e ? D(b.name) : void 0,
|
|
364
364
|
children: [
|
|
365
365
|
b.icon && /* @__PURE__ */ n(Ge, { name: b.icon, className: "w-4 h-4 shrink-0" }),
|
|
366
|
-
!e && /* @__PURE__ */ n("span", { children:
|
|
366
|
+
!e && /* @__PURE__ */ n("span", { children: D(b.name) })
|
|
367
367
|
]
|
|
368
368
|
},
|
|
369
369
|
b.screen
|
|
@@ -474,7 +474,7 @@ const ct = Fr((e) => ({
|
|
|
474
474
|
});
|
|
475
475
|
}
|
|
476
476
|
}));
|
|
477
|
-
function
|
|
477
|
+
function qr() {
|
|
478
478
|
const {
|
|
479
479
|
user: e,
|
|
480
480
|
isAuthenticated: t,
|
|
@@ -604,7 +604,7 @@ const Li = ae.forwardRef(({ className: e, children: t, checked: r, ...s }, i) =>
|
|
|
604
604
|
}
|
|
605
605
|
));
|
|
606
606
|
Li.displayName = ye.CheckboxItem.displayName;
|
|
607
|
-
const
|
|
607
|
+
const ji = ae.forwardRef(({ className: e, children: t, ...r }, s) => /* @__PURE__ */ d(
|
|
608
608
|
ye.RadioItem,
|
|
609
609
|
{
|
|
610
610
|
ref: s,
|
|
@@ -619,8 +619,8 @@ const qi = ae.forwardRef(({ className: e, children: t, ...r }, s) => /* @__PURE_
|
|
|
619
619
|
]
|
|
620
620
|
}
|
|
621
621
|
));
|
|
622
|
-
|
|
623
|
-
const
|
|
622
|
+
ji.displayName = ye.RadioItem.displayName;
|
|
623
|
+
const qi = ae.forwardRef(({ className: e, inset: t, ...r }, s) => /* @__PURE__ */ n(
|
|
624
624
|
ye.Label,
|
|
625
625
|
{
|
|
626
626
|
ref: s,
|
|
@@ -632,7 +632,7 @@ const ji = ae.forwardRef(({ className: e, inset: t, ...r }, s) => /* @__PURE__ *
|
|
|
632
632
|
...r
|
|
633
633
|
}
|
|
634
634
|
));
|
|
635
|
-
|
|
635
|
+
qi.displayName = ye.Label.displayName;
|
|
636
636
|
const Kn = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
637
637
|
ye.Separator,
|
|
638
638
|
{
|
|
@@ -666,7 +666,7 @@ const Mr = Lr(
|
|
|
666
666
|
size: "default"
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
|
-
),
|
|
669
|
+
), q = ae.forwardRef(
|
|
670
670
|
({ className: e, variant: t, size: r, asChild: s = !1, ...i }, a) => /* @__PURE__ */ n(
|
|
671
671
|
s ? ui : "button",
|
|
672
672
|
{
|
|
@@ -676,14 +676,14 @@ const Mr = Lr(
|
|
|
676
676
|
}
|
|
677
677
|
)
|
|
678
678
|
);
|
|
679
|
-
|
|
679
|
+
q.displayName = "Button";
|
|
680
680
|
function zi() {
|
|
681
681
|
var o, u;
|
|
682
|
-
const e = ct((f) => f.user), { logout: t, activeTenant: r, tenants: s, switchTenant: i, isSwitchingTenant: a } =
|
|
682
|
+
const e = ct((f) => f.user), { logout: t, activeTenant: r, tenants: s, switchTenant: i, isSwitchingTenant: a } = qr(), 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
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
|
+
q,
|
|
687
687
|
{
|
|
688
688
|
variant: "outline",
|
|
689
689
|
size: "sm",
|
|
@@ -977,14 +977,14 @@ he.displayName = "Input";
|
|
|
977
977
|
const Qi = Lr(
|
|
978
978
|
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
979
979
|
), Qe = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
980
|
-
|
|
980
|
+
jn.Root,
|
|
981
981
|
{
|
|
982
982
|
ref: r,
|
|
983
983
|
className: J(Qi(), e),
|
|
984
984
|
...t
|
|
985
985
|
}
|
|
986
986
|
));
|
|
987
|
-
Qe.displayName =
|
|
987
|
+
Qe.displayName = jn.Root.displayName;
|
|
988
988
|
const xt = ae.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
989
989
|
"div",
|
|
990
990
|
{
|
|
@@ -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 = Xe(), [t] = yt(), { login: r, isLoginPending: s, isAuthenticated: i } =
|
|
1039
|
+
const e = Xe(), [t] = yt(), { login: r, isLoginPending: s, isAuthenticated: i } = qr(), [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({
|
|
@@ -1064,7 +1064,7 @@ function Yi() {
|
|
|
1064
1064
|
/* @__PURE__ */ d(Nt, { children: [
|
|
1065
1065
|
b && /* @__PURE__ */ d("div", { className: "space-y-2 mb-4", children: [
|
|
1066
1066
|
g.map((w) => /* @__PURE__ */ n(
|
|
1067
|
-
|
|
1067
|
+
q,
|
|
1068
1068
|
{
|
|
1069
1069
|
variant: "outline",
|
|
1070
1070
|
className: "w-full",
|
|
@@ -1111,7 +1111,7 @@ function Yi() {
|
|
|
1111
1111
|
}
|
|
1112
1112
|
)
|
|
1113
1113
|
] }),
|
|
1114
|
-
/* @__PURE__ */ n(
|
|
1114
|
+
/* @__PURE__ */ n(q, { type: "submit", className: "w-full", disabled: s, children: s ? "Signing in..." : "Sign in" })
|
|
1115
1115
|
] }),
|
|
1116
1116
|
/* @__PURE__ */ d("p", { className: "mt-4 text-center text-sm text-[var(--muted-foreground)]", children: [
|
|
1117
1117
|
"First time?",
|
|
@@ -1122,7 +1122,7 @@ function Yi() {
|
|
|
1122
1122
|
] }) });
|
|
1123
1123
|
}
|
|
1124
1124
|
function Xi() {
|
|
1125
|
-
const e = Xe(), { signup: t, isSignupPending: r, isAuthenticated: s } =
|
|
1125
|
+
const e = Xe(), { signup: t, isSignupPending: r, isAuthenticated: s } = qr(), [i, a] = I(""), [l, c] = I(""), [o, u] = I(""), { data: f } = Ve({
|
|
1126
1126
|
queryKey: ["check-setup"],
|
|
1127
1127
|
queryFn: Mn
|
|
1128
1128
|
});
|
|
@@ -1185,7 +1185,7 @@ function Xi() {
|
|
|
1185
1185
|
}
|
|
1186
1186
|
)
|
|
1187
1187
|
] }),
|
|
1188
|
-
/* @__PURE__ */ n(
|
|
1188
|
+
/* @__PURE__ */ n(q, { type: "submit", className: "w-full", disabled: r, children: r ? "Creating..." : "Create account" })
|
|
1189
1189
|
] }) })
|
|
1190
1190
|
] }) });
|
|
1191
1191
|
}
|
|
@@ -1205,7 +1205,7 @@ function Zi() {
|
|
|
1205
1205
|
return /* @__PURE__ */ n("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ d("div", { className: "text-center", children: [
|
|
1206
1206
|
/* @__PURE__ */ n("h1", { className: "text-6xl font-bold text-[var(--muted-foreground)]", children: "404" }),
|
|
1207
1207
|
/* @__PURE__ */ n("p", { className: "mt-2 text-lg text-[var(--muted-foreground)]", children: "Page not found" }),
|
|
1208
|
-
/* @__PURE__ */ n(
|
|
1208
|
+
/* @__PURE__ */ n(q, { asChild: !0, variant: "outline", className: "mt-6", children: /* @__PURE__ */ n(_n, { to: "/", children: "Go home" }) })
|
|
1209
1209
|
] }) });
|
|
1210
1210
|
}
|
|
1211
1211
|
function Bt({ title: e, backTo: t, actions: r }) {
|
|
@@ -1218,7 +1218,7 @@ function Bt({ title: e, backTo: t, actions: r }) {
|
|
|
1218
1218
|
return /* @__PURE__ */ d("div", { className: "flex items-center justify-between mb-6", children: [
|
|
1219
1219
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-3", children: [
|
|
1220
1220
|
t && /* @__PURE__ */ n(
|
|
1221
|
-
|
|
1221
|
+
q,
|
|
1222
1222
|
{
|
|
1223
1223
|
variant: "ghost",
|
|
1224
1224
|
size: "icon",
|
|
@@ -1247,7 +1247,7 @@ const ea = Lr(
|
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
1249
|
);
|
|
1250
|
-
function
|
|
1250
|
+
function Ce({ className: e, variant: t, color: r, style: s, ...i }) {
|
|
1251
1251
|
const a = r ? {
|
|
1252
1252
|
backgroundColor: r + "1a",
|
|
1253
1253
|
color: r,
|
|
@@ -1264,13 +1264,13 @@ function ke({ className: e, variant: t, color: r, style: s, ...i }) {
|
|
|
1264
1264
|
);
|
|
1265
1265
|
}
|
|
1266
1266
|
function ta() {
|
|
1267
|
-
const { data: e } =
|
|
1267
|
+
const { data: e } = je(), [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
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
|
+
q,
|
|
1274
1274
|
{
|
|
1275
1275
|
variant: t === "handlers" ? "default" : "outline",
|
|
1276
1276
|
size: "sm",
|
|
@@ -1279,7 +1279,7 @@ function ta() {
|
|
|
1279
1279
|
}
|
|
1280
1280
|
),
|
|
1281
1281
|
/* @__PURE__ */ n(
|
|
1282
|
-
|
|
1282
|
+
q,
|
|
1283
1283
|
{
|
|
1284
1284
|
variant: t === "actions" ? "default" : "outline",
|
|
1285
1285
|
size: "sm",
|
|
@@ -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] = I(!1), a = (l = t.display) != null && l.name ?
|
|
1320
|
+
const [s, i] = I(!1), a = (l = t.display) != null && l.name ? D(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: [
|
|
@@ -1328,9 +1328,9 @@ function na({ code: e, handler: t, entity: r }) {
|
|
|
1328
1328
|
] })
|
|
1329
1329
|
] }),
|
|
1330
1330
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1331
|
-
/* @__PURE__ */ n(
|
|
1332
|
-
r && /* @__PURE__ */ n(
|
|
1333
|
-
t.success_event && /* @__PURE__ */ d(
|
|
1331
|
+
/* @__PURE__ */ n(Ce, { variant: "outline", children: t.type }),
|
|
1332
|
+
r && /* @__PURE__ */ n(Ce, { variant: "secondary", children: r }),
|
|
1333
|
+
t.success_event && /* @__PURE__ */ d(Ce, { variant: "secondary", children: [
|
|
1334
1334
|
"event: ",
|
|
1335
1335
|
t.success_event
|
|
1336
1336
|
] })
|
|
@@ -1347,12 +1347,12 @@ function na({ code: e, handler: t, entity: r }) {
|
|
|
1347
1347
|
}
|
|
1348
1348
|
function sa({ code: e, param: t }) {
|
|
1349
1349
|
var s;
|
|
1350
|
-
const r = (s = t.display) != null && s.name ?
|
|
1350
|
+
const r = (s = t.display) != null && s.name ? D(t.display.name) : void 0;
|
|
1351
1351
|
return /* @__PURE__ */ d("div", { className: "flex items-center gap-3 text-sm py-1", children: [
|
|
1352
1352
|
/* @__PURE__ */ n("span", { className: "font-mono text-xs w-32 shrink-0", children: e }),
|
|
1353
|
-
/* @__PURE__ */ n(
|
|
1354
|
-
t.required && /* @__PURE__ */ n(
|
|
1355
|
-
t.hidden && /* @__PURE__ */ n(
|
|
1353
|
+
/* @__PURE__ */ n(Ce, { variant: "outline", className: "text-xs", children: t.type || "string" }),
|
|
1354
|
+
t.required && /* @__PURE__ */ n(Ce, { variant: "destructive", className: "text-xs", children: "required" }),
|
|
1355
|
+
t.hidden && /* @__PURE__ */ n(Ce, { variant: "secondary", className: "text-xs", children: "hidden" }),
|
|
1356
1356
|
t.default != null && /* @__PURE__ */ d("span", { className: "text-xs text-[var(--muted-foreground)]", children: [
|
|
1357
1357
|
"default: ",
|
|
1358
1358
|
String(t.default)
|
|
@@ -1392,7 +1392,7 @@ function ia({ schema: e }) {
|
|
|
1392
1392
|
}
|
|
1393
1393
|
function aa({ code: e, action: t }) {
|
|
1394
1394
|
var s, i;
|
|
1395
|
-
const r =
|
|
1395
|
+
const r = D((s = t.display) == null ? void 0 : s.name);
|
|
1396
1396
|
return /* @__PURE__ */ d("div", { className: "border border-[var(--border)] rounded-lg p-3 flex items-center justify-between", children: [
|
|
1397
1397
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-3", children: [
|
|
1398
1398
|
((i = t.display) == null ? void 0 : i.icon) && /* @__PURE__ */ n(Ge, { name: t.display.icon, className: "w-4 h-4 text-[var(--muted-foreground)]" }),
|
|
@@ -1402,13 +1402,12 @@ function aa({ code: e, action: t }) {
|
|
|
1402
1402
|
] })
|
|
1403
1403
|
] }),
|
|
1404
1404
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1405
|
-
t.type && /* @__PURE__ */ n(
|
|
1406
|
-
t.scope && /* @__PURE__ */ n(ke, { variant: "secondary", children: t.scope }),
|
|
1405
|
+
t.type && /* @__PURE__ */ n(Ce, { variant: "outline", children: t.type }),
|
|
1407
1406
|
t.handler && /* @__PURE__ */ d("span", { className: "text-xs text-[var(--muted-foreground)] font-mono", children: [
|
|
1408
1407
|
"handler: ",
|
|
1409
1408
|
t.handler
|
|
1410
1409
|
] }),
|
|
1411
|
-
t.visibility && t.visibility.length > 0 && /* @__PURE__ */ n("div", { className: "flex gap-1", children: t.visibility.map((a) => /* @__PURE__ */ n(
|
|
1410
|
+
t.visibility && t.visibility.length > 0 && /* @__PURE__ */ n("div", { className: "flex gap-1", children: t.visibility.map((a) => /* @__PURE__ */ n(Ce, { variant: "outline", className: "text-xs", children: a }, a)) })
|
|
1412
1411
|
] })
|
|
1413
1412
|
] });
|
|
1414
1413
|
}
|
|
@@ -1566,7 +1565,7 @@ function Hr({ value: e, title: t, className: r, size: s = "icon" }) {
|
|
|
1566
1565
|
}
|
|
1567
1566
|
}, [e]), c = s === "sm" ? "h-3 w-3" : "h-4 w-4";
|
|
1568
1567
|
return /* @__PURE__ */ n(
|
|
1569
|
-
|
|
1568
|
+
q,
|
|
1570
1569
|
{
|
|
1571
1570
|
type: "button",
|
|
1572
1571
|
variant: "ghost",
|
|
@@ -1578,7 +1577,7 @@ function Hr({ value: e, title: t, className: r, size: s = "icon" }) {
|
|
|
1578
1577
|
}
|
|
1579
1578
|
);
|
|
1580
1579
|
}
|
|
1581
|
-
function
|
|
1580
|
+
function jt({ field: e, value: t, mode: r, onChange: s }) {
|
|
1582
1581
|
if (r === "display") {
|
|
1583
1582
|
const i = String(t ?? "");
|
|
1584
1583
|
return e.copyable && i ? /* @__PURE__ */ d("span", { className: "inline-flex items-center gap-1", children: [
|
|
@@ -1738,7 +1737,7 @@ const fr = "__declarion_enum_null__";
|
|
|
1738
1737
|
function va({ field: e, value: t, mode: r, onChange: s }) {
|
|
1739
1738
|
const i = e.values ?? [], a = i.find((o) => o.code === t);
|
|
1740
1739
|
if (r === "display")
|
|
1741
|
-
return a ? /* @__PURE__ */ n(
|
|
1740
|
+
return a ? /* @__PURE__ */ n(Ce, { color: a.color, children: D(a.name) }) : /* @__PURE__ */ n("span", { className: "text-sm text-[var(--muted-foreground)]", children: "-" });
|
|
1742
1741
|
const l = !e.required, c = t != null && t !== "" ? String(t) : fr;
|
|
1743
1742
|
return /* @__PURE__ */ d(
|
|
1744
1743
|
gt,
|
|
@@ -1749,7 +1748,7 @@ function va({ field: e, value: t, mode: r, onChange: s }) {
|
|
|
1749
1748
|
/* @__PURE__ */ n(at, { children: /* @__PURE__ */ n(vt, { placeholder: "Select..." }) }),
|
|
1750
1749
|
/* @__PURE__ */ d(ot, { children: [
|
|
1751
1750
|
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:
|
|
1751
|
+
i.map((o) => /* @__PURE__ */ n(Ue, { value: o.code, children: D(o.name) }, o.code))
|
|
1753
1752
|
] })
|
|
1754
1753
|
]
|
|
1755
1754
|
}
|
|
@@ -2044,7 +2043,7 @@ function pr({ field: e, fieldName: t, value: r, mode: s, onChange: i, record: a
|
|
|
2044
2043
|
);
|
|
2045
2044
|
}
|
|
2046
2045
|
function Bn(e) {
|
|
2047
|
-
const { data: t } =
|
|
2046
|
+
const { data: t } = je();
|
|
2048
2047
|
if (!(!t || !e))
|
|
2049
2048
|
return t.entities[e];
|
|
2050
2049
|
}
|
|
@@ -2130,7 +2129,7 @@ function La({
|
|
|
2130
2129
|
onChange: r
|
|
2131
2130
|
}) {
|
|
2132
2131
|
var c;
|
|
2133
|
-
const { data: s } =
|
|
2132
|
+
const { data: s } = je(), i = (c = s == null ? void 0 : s.languages) != null && c.length ? s.languages : [{ code: "en", name: { en: "English" } }], a = Fa(e);
|
|
2134
2133
|
if (t === "display") {
|
|
2135
2134
|
const o = Object.values(a)[0] ?? "-";
|
|
2136
2135
|
return /* @__PURE__ */ n("span", { className: "text-sm", children: o });
|
|
@@ -2153,16 +2152,16 @@ function La({
|
|
|
2153
2152
|
)
|
|
2154
2153
|
] }, o.code)) });
|
|
2155
2154
|
}
|
|
2156
|
-
function
|
|
2155
|
+
function ja(e) {
|
|
2157
2156
|
return e == null ? {} : typeof e == "object" && !Array.isArray(e) ? e : typeof e == "string" ? { en: e } : {};
|
|
2158
2157
|
}
|
|
2159
|
-
function
|
|
2158
|
+
function qa({
|
|
2160
2159
|
value: e,
|
|
2161
2160
|
mode: t,
|
|
2162
2161
|
onChange: r
|
|
2163
2162
|
}) {
|
|
2164
2163
|
var c;
|
|
2165
|
-
const { data: s } =
|
|
2164
|
+
const { data: s } = je(), i = (c = s == null ? void 0 : s.languages) != null && c.length ? s.languages : [{ code: "en", name: { en: "English" } }], a = ja(e);
|
|
2166
2165
|
if (t === "display") {
|
|
2167
2166
|
const o = Object.values(a)[0] ?? "-";
|
|
2168
2167
|
return /* @__PURE__ */ n("p", { className: "text-sm whitespace-pre-wrap", children: o });
|
|
@@ -2189,7 +2188,7 @@ function ja({
|
|
|
2189
2188
|
}
|
|
2190
2189
|
function Zt(e) {
|
|
2191
2190
|
var c;
|
|
2192
|
-
const { field: t, value: r, mode: s, onChange: i } = e, { data: a } =
|
|
2191
|
+
const { field: t, value: r, mode: s, onChange: i } = e, { data: a } = je(), l = t.structure ? (c = a == null ? void 0 : a.structures) == null ? void 0 : c[t.structure] : void 0;
|
|
2193
2192
|
return l ? t.array ? /* @__PURE__ */ n(
|
|
2194
2193
|
za,
|
|
2195
2194
|
{
|
|
@@ -2222,7 +2221,7 @@ function Sr({
|
|
|
2222
2221
|
if (!f) return null;
|
|
2223
2222
|
const m = i[u];
|
|
2224
2223
|
return m == null ? null : /* @__PURE__ */ d("div", { className: "flex items-baseline gap-2", children: [
|
|
2225
|
-
/* @__PURE__ */ n("span", { className: "text-xs font-medium text-[var(--muted-foreground)] min-w-[100px] shrink-0", children: f.display ?
|
|
2224
|
+
/* @__PURE__ */ n("span", { className: "text-xs font-medium text-[var(--muted-foreground)] min-w-[100px] shrink-0", children: f.display ? D(f.display.name) : u }),
|
|
2226
2225
|
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: f.type === "structure" && f.structure ? /* @__PURE__ */ n(
|
|
2227
2226
|
Zt,
|
|
2228
2227
|
{
|
|
@@ -2246,7 +2245,7 @@ function Sr({
|
|
|
2246
2245
|
const u = e.fields[o];
|
|
2247
2246
|
return u ? /* @__PURE__ */ d("div", { className: "space-y-1", children: [
|
|
2248
2247
|
/* @__PURE__ */ d(Qe, { className: "text-xs", children: [
|
|
2249
|
-
u.display ?
|
|
2248
|
+
u.display ? D(u.display.name) : o,
|
|
2250
2249
|
u.required && /* @__PURE__ */ n("span", { className: "text-[var(--destructive)] ml-0.5", children: "*" })
|
|
2251
2250
|
] }),
|
|
2252
2251
|
u.type === "structure" && u.structure ? /* @__PURE__ */ n(
|
|
@@ -2306,7 +2305,7 @@ function za({
|
|
|
2306
2305
|
}
|
|
2307
2306
|
),
|
|
2308
2307
|
/* @__PURE__ */ n(
|
|
2309
|
-
|
|
2308
|
+
q,
|
|
2310
2309
|
{
|
|
2311
2310
|
type: "button",
|
|
2312
2311
|
variant: "ghost",
|
|
@@ -2318,7 +2317,7 @@ function za({
|
|
|
2318
2317
|
)
|
|
2319
2318
|
] }, u)),
|
|
2320
2319
|
/* @__PURE__ */ d(
|
|
2321
|
-
|
|
2320
|
+
q,
|
|
2322
2321
|
{
|
|
2323
2322
|
type: "button",
|
|
2324
2323
|
variant: "outline",
|
|
@@ -2354,7 +2353,7 @@ function Ma({ value: e, mode: t, onChange: r, record: s }) {
|
|
|
2354
2353
|
}
|
|
2355
2354
|
),
|
|
2356
2355
|
/* @__PURE__ */ n(
|
|
2357
|
-
|
|
2356
|
+
q,
|
|
2358
2357
|
{
|
|
2359
2358
|
type: "button",
|
|
2360
2359
|
variant: "ghost",
|
|
@@ -2453,7 +2452,7 @@ function Va({ value: e, mode: t, onChange: r }) {
|
|
|
2453
2452
|
className: "flex-1"
|
|
2454
2453
|
}
|
|
2455
2454
|
),
|
|
2456
|
-
/* @__PURE__ */ n(
|
|
2455
|
+
/* @__PURE__ */ n(q, { type: "button", variant: "outline", size: "sm", onClick: l, children: /* @__PURE__ */ n(Oe, { className: "h-4 w-4" }) })
|
|
2457
2456
|
] })
|
|
2458
2457
|
] });
|
|
2459
2458
|
}
|
|
@@ -2513,17 +2512,17 @@ function Wa({ value: e, mode: t, onChange: r }) {
|
|
|
2513
2512
|
className: "flex-1"
|
|
2514
2513
|
}
|
|
2515
2514
|
),
|
|
2516
|
-
/* @__PURE__ */ n(
|
|
2515
|
+
/* @__PURE__ */ n(q, { type: "button", variant: "outline", size: "sm", onClick: l, children: /* @__PURE__ */ n(Oe, { className: "h-4 w-4" }) })
|
|
2517
2516
|
] })
|
|
2518
2517
|
] });
|
|
2519
2518
|
}
|
|
2520
2519
|
const yr = {
|
|
2521
|
-
string:
|
|
2520
|
+
string: jt,
|
|
2522
2521
|
text: pa,
|
|
2523
2522
|
enum: va,
|
|
2524
2523
|
email: ya,
|
|
2525
2524
|
url: Ta,
|
|
2526
|
-
phone:
|
|
2525
|
+
phone: jt,
|
|
2527
2526
|
timestamp: mr,
|
|
2528
2527
|
date: mr,
|
|
2529
2528
|
time: mr,
|
|
@@ -2531,14 +2530,14 @@ const yr = {
|
|
|
2531
2530
|
int: pr,
|
|
2532
2531
|
float: pr,
|
|
2533
2532
|
decimal: pr,
|
|
2534
|
-
uuid:
|
|
2533
|
+
uuid: jt,
|
|
2535
2534
|
ref: Oa,
|
|
2536
2535
|
json: Zn,
|
|
2537
|
-
tags:
|
|
2536
|
+
tags: jt,
|
|
2538
2537
|
string_array: Va,
|
|
2539
2538
|
int_array: Wa,
|
|
2540
2539
|
multilang: La,
|
|
2541
|
-
multilang_text:
|
|
2540
|
+
multilang_text: qa,
|
|
2542
2541
|
structure: Zt,
|
|
2543
2542
|
secret: Ma,
|
|
2544
2543
|
password: Ua
|
|
@@ -2552,7 +2551,7 @@ function oe(e) {
|
|
|
2552
2551
|
const i = yr[t];
|
|
2553
2552
|
return /* @__PURE__ */ n(i, { ...e });
|
|
2554
2553
|
}
|
|
2555
|
-
const r = yr[e.field.type] ??
|
|
2554
|
+
const r = yr[e.field.type] ?? jt;
|
|
2556
2555
|
return /* @__PURE__ */ n(r, { ...e });
|
|
2557
2556
|
}
|
|
2558
2557
|
function fn({ icon: e, title: t, description: r, action: s }) {
|
|
@@ -2869,7 +2868,7 @@ function cs({
|
|
|
2869
2868
|
] }),
|
|
2870
2869
|
/* @__PURE__ */ n("div", { className: "space-y-4 py-2", children: o.map(([b, w]) => {
|
|
2871
2870
|
var h, v;
|
|
2872
|
-
const x = Xa(w), N =
|
|
2871
|
+
const x = Xa(w), N = D((h = w.display) == null ? void 0 : h.name) || b;
|
|
2873
2872
|
return /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
|
|
2874
2873
|
/* @__PURE__ */ d(Qe, { children: [
|
|
2875
2874
|
N,
|
|
@@ -2882,12 +2881,12 @@ function cs({
|
|
|
2882
2881
|
mode: "edit",
|
|
2883
2882
|
onChange: (k) => g(b, k)
|
|
2884
2883
|
}),
|
|
2885
|
-
((v = w.display) == null ? void 0 : v.description) && /* @__PURE__ */ n("p", { className: "text-xs text-[var(--muted-foreground)]", children:
|
|
2884
|
+
((v = w.display) == null ? void 0 : v.description) && /* @__PURE__ */ n("p", { className: "text-xs text-[var(--muted-foreground)]", children: D(w.display.description) })
|
|
2886
2885
|
] }, b);
|
|
2887
2886
|
}) }),
|
|
2888
2887
|
/* @__PURE__ */ d(ls, { children: [
|
|
2889
|
-
/* @__PURE__ */ n(
|
|
2890
|
-
/* @__PURE__ */ n(
|
|
2888
|
+
/* @__PURE__ */ n(q, { variant: "outline", onClick: () => t(!1), disabled: a, children: "Cancel" }),
|
|
2889
|
+
/* @__PURE__ */ n(q, { onClick: y, disabled: a, children: a ? "Executing..." : "Execute" })
|
|
2891
2890
|
] })
|
|
2892
2891
|
] }) });
|
|
2893
2892
|
}
|
|
@@ -2919,7 +2918,7 @@ function Ba({ open: e, onClose: t, display: r }) {
|
|
|
2919
2918
|
r.message && /* @__PURE__ */ n(rn, { children: r.message })
|
|
2920
2919
|
] }),
|
|
2921
2920
|
r.fields && r.fields.length > 0 && /* @__PURE__ */ n("div", { className: "space-y-3 py-2", children: r.fields.map((s, i) => /* @__PURE__ */ n(Za, { field: s }, i)) }),
|
|
2922
|
-
/* @__PURE__ */ n(ls, { children: /* @__PURE__ */ n(
|
|
2921
|
+
/* @__PURE__ */ n(ls, { children: /* @__PURE__ */ n(q, { onClick: t, children: "Close" }) })
|
|
2923
2922
|
] }) });
|
|
2924
2923
|
}
|
|
2925
2924
|
function Za({ field: e }) {
|
|
@@ -3095,17 +3094,17 @@ function nn({
|
|
|
3095
3094
|
onBatchPartial: f
|
|
3096
3095
|
}) {
|
|
3097
3096
|
var V, Q;
|
|
3098
|
-
const [m, p] = I(!1), [g, y] = I(!1), [b, w] = I(!1), [x, N] = I(null), h = Qn(r), { data: v } =
|
|
3097
|
+
const [m, p] = I(!1), [g, y] = I(!1), [b, w] = I(!1), [x, N] = I(null), h = Qn(r), { data: v } = je(), k = Ut(), A = ms(t), _ = fs(t), T = !!t.confirmation && Object.keys(t.confirmation).length > 0, $ = i ? pt(t.conditions, i) : !0, F = !1, M = !1, j = z(async () => {
|
|
3099
3098
|
var Z, fe, Te;
|
|
3100
3099
|
if (!(!t.association || s.length === 0)) {
|
|
3101
3100
|
w(!0);
|
|
3102
3101
|
try {
|
|
3103
|
-
const Ne = r ? `${r}.${t.association}` : t.association, be = await Wr(Ne, s),
|
|
3104
|
-
if (!
|
|
3102
|
+
const Ne = r ? `${r}.${t.association}` : t.association, be = await Wr(Ne, s), qe = er(v, be.target_entity);
|
|
3103
|
+
if (!qe) {
|
|
3105
3104
|
ie.error(`No list screen found for ${be.target_entity}`);
|
|
3106
3105
|
return;
|
|
3107
3106
|
}
|
|
3108
|
-
const X = v == null ? void 0 : v.entities[be.target_entity], dt =
|
|
3107
|
+
const X = v == null ? void 0 : v.entities[be.target_entity], dt = D((Z = t.display) == null ? void 0 : Z.name) || be.target_entity;
|
|
3109
3108
|
if (be.ids.length === 0) {
|
|
3110
3109
|
ie.info(`No related ${dt} found`);
|
|
3111
3110
|
return;
|
|
@@ -3114,9 +3113,9 @@ function nn({
|
|
|
3114
3113
|
var ut;
|
|
3115
3114
|
return (ut = X.fields[Se]) == null ? void 0 : ut.primary;
|
|
3116
3115
|
})) ?? "id", Ye = new URLSearchParams();
|
|
3117
|
-
Ye.set(`filter_${Ze}`, be.ids.join(",")), k(
|
|
3116
|
+
Ye.set(`filter_${Ze}`, be.ids.join(",")), k(qe.route, {
|
|
3118
3117
|
title: dt,
|
|
3119
|
-
icon: ((Te = t.display) == null ? void 0 : Te.icon) ||
|
|
3118
|
+
icon: ((Te = t.display) == null ? void 0 : Te.icon) || qe.icon,
|
|
3120
3119
|
search: Ye.toString()
|
|
3121
3120
|
}), c == null || c();
|
|
3122
3121
|
} catch (Ne) {
|
|
@@ -3140,13 +3139,13 @@ function nn({
|
|
|
3140
3139
|
Z.status === "partial" ? f == null || f(s.length, Z.success) : c == null || c();
|
|
3141
3140
|
},
|
|
3142
3141
|
[s.length, c, f]
|
|
3143
|
-
),
|
|
3142
|
+
), te = z(() => {
|
|
3144
3143
|
if (ao(t)) {
|
|
3145
3144
|
so(t.ui_steps, { row: i }).then(() => c == null ? void 0 : c());
|
|
3146
3145
|
return;
|
|
3147
3146
|
}
|
|
3148
3147
|
if (A) {
|
|
3149
|
-
|
|
3148
|
+
j();
|
|
3150
3149
|
return;
|
|
3151
3150
|
}
|
|
3152
3151
|
_ ? p(!0) : T ? y(!0) : (o == null || o(s.length), h.mutate(
|
|
@@ -3156,7 +3155,7 @@ function nn({
|
|
|
3156
3155
|
onError: () => u == null ? void 0 : u(s.length)
|
|
3157
3156
|
}
|
|
3158
3157
|
));
|
|
3159
|
-
}, [t, i, A, _, T, E, U, s, h, B,
|
|
3158
|
+
}, [t, i, A, _, T, E, U, s, h, B, j, o, u, c]), G = z(() => {
|
|
3160
3159
|
o == null || o(s.length), h.mutate(
|
|
3161
3160
|
{ actionCode: E, body: Ct(void 0, U) },
|
|
3162
3161
|
{
|
|
@@ -3175,14 +3174,14 @@ function nn({
|
|
|
3175
3174
|
);
|
|
3176
3175
|
},
|
|
3177
3176
|
[E, U, s, h, B, o, u]
|
|
3178
|
-
), C =
|
|
3177
|
+
), C = D((V = t.display) == null ? void 0 : V.name), L = (Q = t.display) == null ? void 0 : Q.icon;
|
|
3179
3178
|
return /* @__PURE__ */ d(pe, { children: [
|
|
3180
3179
|
/* @__PURE__ */ d(
|
|
3181
|
-
|
|
3180
|
+
q,
|
|
3182
3181
|
{
|
|
3183
3182
|
variant: a,
|
|
3184
3183
|
size: l,
|
|
3185
|
-
onClick:
|
|
3184
|
+
onClick: te,
|
|
3186
3185
|
disabled: !$ || F || M || h.isPending || b,
|
|
3187
3186
|
title: C,
|
|
3188
3187
|
"aria-label": C,
|
|
@@ -3210,8 +3209,8 @@ function nn({
|
|
|
3210
3209
|
open: g,
|
|
3211
3210
|
onOpenChange: y,
|
|
3212
3211
|
actionName: C,
|
|
3213
|
-
message:
|
|
3214
|
-
onConfirm:
|
|
3212
|
+
message: D(t.confirmation),
|
|
3213
|
+
onConfirm: G,
|
|
3215
3214
|
isPending: h.isPending
|
|
3216
3215
|
}
|
|
3217
3216
|
),
|
|
@@ -3236,8 +3235,8 @@ function oo({
|
|
|
3236
3235
|
onSuccess: a
|
|
3237
3236
|
}) {
|
|
3238
3237
|
var T, $;
|
|
3239
|
-
const [l, c] = I(!1), [o, u] = I(!1), f = Qn(r), { data: m } =
|
|
3240
|
-
var F, M,
|
|
3238
|
+
const [l, c] = I(!1), [o, u] = I(!1), f = Qn(r), { data: m } = je(), p = Ut(), g = ms(t), y = fs(t), b = !!t.confirmation && Object.keys(t.confirmation).length > 0, w = pt(t.conditions, i), x = D((T = t.display) == null ? void 0 : T.name), N = ($ = t.display) == null ? void 0 : $.icon, h = z(async () => {
|
|
3239
|
+
var F, M, j;
|
|
3241
3240
|
if (t.association)
|
|
3242
3241
|
try {
|
|
3243
3242
|
const E = r ? `${r}.${t.association}` : t.association, U = await Wr(E, [s]), B = er(m, U.target_entity);
|
|
@@ -3245,18 +3244,18 @@ function oo({
|
|
|
3245
3244
|
ie.error(`No list screen found for ${U.target_entity}`);
|
|
3246
3245
|
return;
|
|
3247
3246
|
}
|
|
3248
|
-
const
|
|
3247
|
+
const te = m == null ? void 0 : m.entities[U.target_entity], G = D((F = t.display) == null ? void 0 : F.name) || U.target_entity;
|
|
3249
3248
|
if (U.ids.length === 0) {
|
|
3250
|
-
ie.info(`No related ${
|
|
3249
|
+
ie.info(`No related ${G} found`);
|
|
3251
3250
|
return;
|
|
3252
3251
|
}
|
|
3253
|
-
const R = ((M =
|
|
3252
|
+
const R = ((M = te == null ? void 0 : te.field_order) == null ? void 0 : M.find((L) => {
|
|
3254
3253
|
var V;
|
|
3255
|
-
return (V =
|
|
3254
|
+
return (V = te.fields[L]) == null ? void 0 : V.primary;
|
|
3256
3255
|
})) ?? "id", C = new URLSearchParams();
|
|
3257
3256
|
C.set(`filter_${R}`, U.ids.join(",")), p(B.route, {
|
|
3258
|
-
title:
|
|
3259
|
-
icon: ((
|
|
3257
|
+
title: G,
|
|
3258
|
+
icon: ((j = t.display) == null ? void 0 : j.icon) || B.icon,
|
|
3260
3259
|
search: C.toString()
|
|
3261
3260
|
}), a == null || a();
|
|
3262
3261
|
} catch (E) {
|
|
@@ -3318,7 +3317,7 @@ function oo({
|
|
|
3318
3317
|
open: o,
|
|
3319
3318
|
onOpenChange: u,
|
|
3320
3319
|
actionName: x,
|
|
3321
|
-
message:
|
|
3320
|
+
message: D(t.confirmation),
|
|
3322
3321
|
onConfirm: A,
|
|
3323
3322
|
isPending: f.isPending
|
|
3324
3323
|
}
|
|
@@ -3484,7 +3483,7 @@ function mo({
|
|
|
3484
3483
|
e.map((c, o) => c.or ? /* @__PURE__ */ n("div", { className: "flex items-center gap-1", children: c.or.map((u, f) => /* @__PURE__ */ d("span", { className: "flex items-center gap-1", children: [
|
|
3485
3484
|
f > 0 && /* @__PURE__ */ n("span", { className: "text-xs text-[var(--muted-foreground)] font-medium px-1", children: "OR" }),
|
|
3486
3485
|
/* @__PURE__ */ n(
|
|
3487
|
-
|
|
3486
|
+
Ce,
|
|
3488
3487
|
{
|
|
3489
3488
|
variant: "secondary",
|
|
3490
3489
|
className: "cursor-pointer text-xs",
|
|
@@ -3503,7 +3502,7 @@ function mo({
|
|
|
3503
3502
|
`${c.field}-${o}`
|
|
3504
3503
|
) : null),
|
|
3505
3504
|
/* @__PURE__ */ d(
|
|
3506
|
-
|
|
3505
|
+
q,
|
|
3507
3506
|
{
|
|
3508
3507
|
variant: "ghost",
|
|
3509
3508
|
size: "sm",
|
|
@@ -3529,7 +3528,7 @@ function mo({
|
|
|
3529
3528
|
`${c.field}-${o}`
|
|
3530
3529
|
)),
|
|
3531
3530
|
/* @__PURE__ */ d(
|
|
3532
|
-
|
|
3531
|
+
q,
|
|
3533
3532
|
{
|
|
3534
3533
|
variant: "ghost",
|
|
3535
3534
|
size: "sm",
|
|
@@ -3550,7 +3549,7 @@ function hn({
|
|
|
3550
3549
|
onClick: s
|
|
3551
3550
|
}) {
|
|
3552
3551
|
return /* @__PURE__ */ d(
|
|
3553
|
-
|
|
3552
|
+
Ce,
|
|
3554
3553
|
{
|
|
3555
3554
|
variant: "secondary",
|
|
3556
3555
|
className: "cursor-pointer text-xs gap-1 pr-1",
|
|
@@ -3633,7 +3632,7 @@ function po({
|
|
|
3633
3632
|
/* @__PURE__ */ n(Cn, { className: "w-4 h-4" }),
|
|
3634
3633
|
/* @__PURE__ */ n("h3", { className: "font-semibold text-sm", children: "Filters" })
|
|
3635
3634
|
] }),
|
|
3636
|
-
/* @__PURE__ */ n(
|
|
3635
|
+
/* @__PURE__ */ n(q, { variant: "ghost", size: "icon", onClick: t, className: "h-8 w-8", children: /* @__PURE__ */ n(ze, { className: "w-4 h-4" }) })
|
|
3637
3636
|
] }),
|
|
3638
3637
|
/* @__PURE__ */ d("div", { className: "flex-1 overflow-auto p-4 space-y-3", children: [
|
|
3639
3638
|
u ? (
|
|
@@ -3693,7 +3692,7 @@ function po({
|
|
|
3693
3692
|
}
|
|
3694
3693
|
) : /* @__PURE__ */ d(pe, { children: [
|
|
3695
3694
|
/* @__PURE__ */ d(
|
|
3696
|
-
|
|
3695
|
+
q,
|
|
3697
3696
|
{
|
|
3698
3697
|
variant: "outline",
|
|
3699
3698
|
size: "sm",
|
|
@@ -3705,7 +3704,7 @@ function po({
|
|
|
3705
3704
|
}
|
|
3706
3705
|
),
|
|
3707
3706
|
!u && a.some((x) => x.field) && /* @__PURE__ */ d(
|
|
3708
|
-
|
|
3707
|
+
q,
|
|
3709
3708
|
{
|
|
3710
3709
|
variant: "ghost",
|
|
3711
3710
|
size: "sm",
|
|
@@ -3720,8 +3719,8 @@ function po({
|
|
|
3720
3719
|
] }) })
|
|
3721
3720
|
] }),
|
|
3722
3721
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-between px-4 py-3 border-t border-[var(--border)]", children: [
|
|
3723
|
-
/* @__PURE__ */ n(
|
|
3724
|
-
/* @__PURE__ */ n(
|
|
3722
|
+
/* @__PURE__ */ n(q, { variant: "ghost", size: "sm", onClick: w, children: "Reset" }),
|
|
3723
|
+
/* @__PURE__ */ n(q, { size: "sm", onClick: b, children: "Apply" })
|
|
3725
3724
|
] })
|
|
3726
3725
|
] });
|
|
3727
3726
|
}
|
|
@@ -3765,7 +3764,7 @@ function Tr({
|
|
|
3765
3764
|
}
|
|
3766
3765
|
)),
|
|
3767
3766
|
/* @__PURE__ */ n(
|
|
3768
|
-
|
|
3767
|
+
q,
|
|
3769
3768
|
{
|
|
3770
3769
|
variant: "ghost",
|
|
3771
3770
|
size: "icon",
|
|
@@ -3814,7 +3813,7 @@ function ho({
|
|
|
3814
3813
|
) : null;
|
|
3815
3814
|
}),
|
|
3816
3815
|
/* @__PURE__ */ d(
|
|
3817
|
-
|
|
3816
|
+
q,
|
|
3818
3817
|
{
|
|
3819
3818
|
variant: "ghost",
|
|
3820
3819
|
size: "sm",
|
|
@@ -3839,7 +3838,7 @@ function ho({
|
|
|
3839
3838
|
] })
|
|
3840
3839
|
] }, i)),
|
|
3841
3840
|
/* @__PURE__ */ d(
|
|
3842
|
-
|
|
3841
|
+
q,
|
|
3843
3842
|
{
|
|
3844
3843
|
variant: "ghost",
|
|
3845
3844
|
size: "sm",
|
|
@@ -3888,7 +3887,7 @@ function go({
|
|
|
3888
3887
|
)),
|
|
3889
3888
|
l.length === 0 && /* @__PURE__ */ n("div", { className: "text-xs text-[var(--muted-foreground)] px-2 py-1", children: "No fields available" })
|
|
3890
3889
|
] }),
|
|
3891
|
-
/* @__PURE__ */ n(
|
|
3890
|
+
/* @__PURE__ */ n(q, { variant: "ghost", size: "sm", className: "text-xs w-full", onClick: s, children: "Cancel" })
|
|
3892
3891
|
] });
|
|
3893
3892
|
}
|
|
3894
3893
|
function vo({
|
|
@@ -3902,7 +3901,7 @@ function vo({
|
|
|
3902
3901
|
const [l, c] = I(!1);
|
|
3903
3902
|
return /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
3904
3903
|
/* @__PURE__ */ d(
|
|
3905
|
-
|
|
3904
|
+
q,
|
|
3906
3905
|
{
|
|
3907
3906
|
variant: "outline",
|
|
3908
3907
|
size: "sm",
|
|
@@ -3939,11 +3938,11 @@ function vo({
|
|
|
3939
3938
|
);
|
|
3940
3939
|
}) }),
|
|
3941
3940
|
/* @__PURE__ */ d("div", { className: "border-t border-[var(--border)] px-2 py-1.5 flex items-center gap-1", children: [
|
|
3942
|
-
/* @__PURE__ */ d(
|
|
3941
|
+
/* @__PURE__ */ d(q, { variant: "ghost", size: "sm", className: "text-xs h-7 flex-1", onClick: s, children: [
|
|
3943
3942
|
/* @__PURE__ */ n(Tn, { className: "w-3 h-3 mr-1" }),
|
|
3944
3943
|
"Reset"
|
|
3945
3944
|
] }),
|
|
3946
|
-
/* @__PURE__ */ n(
|
|
3945
|
+
/* @__PURE__ */ n(q, { variant: "ghost", size: "sm", className: "text-xs h-7 flex-1", onClick: i, children: "Show all" })
|
|
3947
3946
|
] })
|
|
3948
3947
|
] })
|
|
3949
3948
|
] })
|
|
@@ -3958,11 +3957,11 @@ function yo({
|
|
|
3958
3957
|
onSaveAs: a,
|
|
3959
3958
|
onSetDefault: l
|
|
3960
3959
|
}) {
|
|
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 ?
|
|
3960
|
+
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 ? D(u.name) : "Default view";
|
|
3962
3961
|
return /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
3963
3962
|
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
3964
3963
|
/* @__PURE__ */ d(
|
|
3965
|
-
|
|
3964
|
+
q,
|
|
3966
3965
|
{
|
|
3967
3966
|
variant: "outline",
|
|
3968
3967
|
size: "sm",
|
|
@@ -3999,7 +3998,7 @@ function yo({
|
|
|
3999
3998
|
f.map((y) => /* @__PURE__ */ n(
|
|
4000
3999
|
Qt,
|
|
4001
4000
|
{
|
|
4002
|
-
label:
|
|
4001
|
+
label: D(y.name),
|
|
4003
4002
|
isActive: t === y.id,
|
|
4004
4003
|
onClick: () => {
|
|
4005
4004
|
s(y), o(!1);
|
|
@@ -4013,7 +4012,7 @@ function yo({
|
|
|
4013
4012
|
m.map((y) => /* @__PURE__ */ n(
|
|
4014
4013
|
Qt,
|
|
4015
4014
|
{
|
|
4016
|
-
label:
|
|
4015
|
+
label: D(y.name),
|
|
4017
4016
|
isActive: t === y.id,
|
|
4018
4017
|
isDefault: y.is_default,
|
|
4019
4018
|
onSetDefault: l ? () => l(y.id) : void 0,
|
|
@@ -4029,7 +4028,7 @@ function yo({
|
|
|
4029
4028
|
p.map((y) => /* @__PURE__ */ n(
|
|
4030
4029
|
Qt,
|
|
4031
4030
|
{
|
|
4032
|
-
label:
|
|
4031
|
+
label: D(y.name),
|
|
4033
4032
|
isActive: t === y.id,
|
|
4034
4033
|
isShared: !0,
|
|
4035
4034
|
onClick: () => {
|
|
@@ -4055,7 +4054,7 @@ function yo({
|
|
|
4055
4054
|
] })
|
|
4056
4055
|
] })
|
|
4057
4056
|
] }),
|
|
4058
|
-
r && t && i && /* @__PURE__ */ d(
|
|
4057
|
+
r && t && i && /* @__PURE__ */ d(q, { variant: "outline", size: "sm", className: "h-8", onClick: i, children: [
|
|
4059
4058
|
/* @__PURE__ */ n(Er, { className: "w-3 h-3 mr-1" }),
|
|
4060
4059
|
"Save"
|
|
4061
4060
|
] })
|
|
@@ -4083,7 +4082,7 @@ function Qt({
|
|
|
4083
4082
|
);
|
|
4084
4083
|
}
|
|
4085
4084
|
function xo(e) {
|
|
4086
|
-
const { data: t } =
|
|
4085
|
+
const { data: t } = je();
|
|
4087
4086
|
if (!(!t || !e))
|
|
4088
4087
|
return t.screens[e];
|
|
4089
4088
|
}
|
|
@@ -4138,7 +4137,7 @@ function br(e, t, r, s) {
|
|
|
4138
4137
|
}
|
|
4139
4138
|
function No({ screenCode: e }) {
|
|
4140
4139
|
var $t, Wt, tt, Rt, rt, Et, Ht, _t, St;
|
|
4141
|
-
const t = Ut(), [r, s] = yt(), { data: i } =
|
|
4140
|
+
const t = Ut(), [r, s] = yt(), { data: i } = je(), [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
4141
|
() => kr(v == null ? void 0 : v.actions, h == null ? void 0 : h.actions, "list_toolbar", A),
|
|
4143
4142
|
[v == null ? void 0 : v.actions, h == null ? void 0 : h.actions, A]
|
|
4144
4143
|
), T = ee(
|
|
@@ -4147,32 +4146,32 @@ function No({ screenCode: e }) {
|
|
|
4147
4146
|
), $ = (h == null ? void 0 : h.row_actions) !== void 0, F = ee(
|
|
4148
4147
|
() => _.some((S) => (S.action.visibility ?? []).includes("list_toolbar")),
|
|
4149
4148
|
[_]
|
|
4150
|
-
), M = !!(v != null && v.soft_delete),
|
|
4149
|
+
), M = !!(v != null && v.soft_delete), j = M && ((x == null ? void 0 : x.permissions) ?? []).some((S) => S === "feature:view_deleted" || S === "feature:*" || S === "*"), E = j && r.get("include_deleted") === "true", { openTab: U, updateTabSearch: B, findTabByPathname: te } = ht();
|
|
4151
4150
|
le(() => {
|
|
4152
|
-
var S,
|
|
4151
|
+
var S, P;
|
|
4153
4152
|
if (h != null && h.route && v) {
|
|
4154
|
-
const H =
|
|
4153
|
+
const H = D((S = h.display) == null ? void 0 : S.name) || D(v.display.name_plural), re = ((P = h.display) == null ? void 0 : P.icon) || v.display.icon;
|
|
4155
4154
|
U({
|
|
4156
4155
|
pathname: h.route,
|
|
4157
4156
|
search: r.toString(),
|
|
4158
4157
|
title: H,
|
|
4159
|
-
icon:
|
|
4158
|
+
icon: re,
|
|
4160
4159
|
closable: !0
|
|
4161
4160
|
});
|
|
4162
4161
|
}
|
|
4163
4162
|
}, [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(() => {
|
|
4164
4163
|
if (!(h != null && h.route)) return;
|
|
4165
|
-
const S =
|
|
4164
|
+
const S = te(h.route);
|
|
4166
4165
|
S && B(S.id, r.toString());
|
|
4167
4166
|
}, [r, h == null ? void 0 : h.route]);
|
|
4168
|
-
const
|
|
4167
|
+
const G = 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(() => {
|
|
4169
4168
|
const S = r.get("columns");
|
|
4170
4169
|
return S ? S.split(",").filter(Boolean) : (h == null ? void 0 : h.columns) ?? [];
|
|
4171
4170
|
}, [r, h == null ? void 0 : h.columns]), Q = ee(() => {
|
|
4172
|
-
const S = [],
|
|
4173
|
-
return
|
|
4171
|
+
const S = [], P = [...(h == null ? void 0 : h.columns) ?? [], ...V];
|
|
4172
|
+
return P.some((H) => H.startsWith("$status.")) && S.push("statuses"), P.some((H) => H.startsWith("$property.")) && S.push("properties"), S.length > 0 && S.unshift("refs"), S.length > 0 ? S : void 0;
|
|
4174
4173
|
}, [h == null ? void 0 : h.columns, V]), { data: Z, isLoading: fe, isError: Te } = Kt(k, {
|
|
4175
|
-
page:
|
|
4174
|
+
page: G,
|
|
4176
4175
|
per_page: 50,
|
|
4177
4176
|
sort: C || void 0,
|
|
4178
4177
|
search: L || void 0,
|
|
@@ -4182,69 +4181,69 @@ function No({ screenCode: e }) {
|
|
|
4182
4181
|
screen: h != null && h.fixed_filters ? e : void 0
|
|
4183
4182
|
}), Ne = Jn(k ?? ""), be = ee(() => {
|
|
4184
4183
|
if (!C) return [];
|
|
4185
|
-
const [S,
|
|
4186
|
-
return [{ id: S, desc:
|
|
4187
|
-
}, [C]),
|
|
4184
|
+
const [S, P] = C.split(":");
|
|
4185
|
+
return [{ id: S, desc: P === "desc" }];
|
|
4186
|
+
}, [C]), qe = ee(
|
|
4188
4187
|
() => {
|
|
4189
4188
|
var S;
|
|
4190
|
-
return ((S = v == null ? void 0 : v.field_order) == null ? void 0 : S.find((
|
|
4189
|
+
return ((S = v == null ? void 0 : v.field_order) == null ? void 0 : S.find((P) => {
|
|
4191
4190
|
var H;
|
|
4192
|
-
return (H = v.fields[
|
|
4191
|
+
return (H = v.fields[P]) == null ? void 0 : H.primary;
|
|
4193
4192
|
})) ?? "id";
|
|
4194
4193
|
},
|
|
4195
4194
|
[v]
|
|
4196
4195
|
), X = Z == null ? void 0 : Z.$refs, dt = me(X);
|
|
4197
4196
|
dt.current = X;
|
|
4198
4197
|
const Ze = ee(() => {
|
|
4199
|
-
var H,
|
|
4198
|
+
var H, re, ne;
|
|
4200
4199
|
if (V.length === 0 || !v) return [];
|
|
4201
4200
|
const S = [];
|
|
4202
4201
|
F && S.push({
|
|
4203
4202
|
id: "_select",
|
|
4204
|
-
header: ({ table:
|
|
4203
|
+
header: ({ table: Y }) => /* @__PURE__ */ n(
|
|
4205
4204
|
"input",
|
|
4206
4205
|
{
|
|
4207
4206
|
type: "checkbox",
|
|
4208
4207
|
className: "accent-[var(--primary)]",
|
|
4209
|
-
checked:
|
|
4210
|
-
onChange:
|
|
4208
|
+
checked: Y.getIsAllRowsSelected(),
|
|
4209
|
+
onChange: Y.getToggleAllRowsSelectedHandler()
|
|
4211
4210
|
}
|
|
4212
4211
|
),
|
|
4213
4212
|
size: 36,
|
|
4214
|
-
cell: ({ row:
|
|
4213
|
+
cell: ({ row: Y }) => /* @__PURE__ */ n(
|
|
4215
4214
|
"input",
|
|
4216
4215
|
{
|
|
4217
4216
|
type: "checkbox",
|
|
4218
4217
|
className: "accent-[var(--primary)]",
|
|
4219
|
-
checked:
|
|
4220
|
-
onChange:
|
|
4218
|
+
checked: Y.getIsSelected(),
|
|
4219
|
+
onChange: Y.getToggleSelectedHandler()
|
|
4221
4220
|
}
|
|
4222
4221
|
)
|
|
4223
4222
|
});
|
|
4224
|
-
for (const
|
|
4225
|
-
if (
|
|
4226
|
-
const de =
|
|
4223
|
+
for (const Y of V) {
|
|
4224
|
+
if (Y.startsWith("$status.")) {
|
|
4225
|
+
const de = Y.slice(8), ge = (H = v.status_groups) == null ? void 0 : H[de];
|
|
4227
4226
|
if (!ge) continue;
|
|
4228
4227
|
const Me = new Map(ge.statuses.map((Ae) => [Ae.code, Ae]));
|
|
4229
4228
|
S.push({
|
|
4230
|
-
id:
|
|
4231
|
-
header:
|
|
4229
|
+
id: Y,
|
|
4230
|
+
header: D(ge.name) || de,
|
|
4232
4231
|
size: 140,
|
|
4233
4232
|
cell: ({ row: Ae }) => {
|
|
4234
4233
|
const He = Ae.original.$statuses, nt = He == null ? void 0 : He.find((W) => W.group_code === de);
|
|
4235
4234
|
if (!nt) return /* @__PURE__ */ n("span", { className: "text-sm text-[var(--muted-foreground)]", children: "-" });
|
|
4236
4235
|
const O = Me.get(nt.status_code);
|
|
4237
|
-
return /* @__PURE__ */ n(
|
|
4236
|
+
return /* @__PURE__ */ n(Ce, { color: O == null ? void 0 : O.color, children: D(O == null ? void 0 : O.name) || nt.status_code });
|
|
4238
4237
|
}
|
|
4239
4238
|
});
|
|
4240
4239
|
continue;
|
|
4241
4240
|
}
|
|
4242
|
-
if (
|
|
4243
|
-
const de =
|
|
4241
|
+
if (Y.startsWith("$property.")) {
|
|
4242
|
+
const de = Y.slice(10), ge = (re = v.properties) == null ? void 0 : re[de];
|
|
4244
4243
|
if (!ge) continue;
|
|
4245
4244
|
S.push({
|
|
4246
|
-
id:
|
|
4247
|
-
header:
|
|
4245
|
+
id: Y,
|
|
4246
|
+
header: D(ge.name) || de,
|
|
4248
4247
|
size: 150,
|
|
4249
4248
|
enableSorting: !1,
|
|
4250
4249
|
cell: ({ row: Me }) => {
|
|
@@ -4254,17 +4253,17 @@ function No({ screenCode: e }) {
|
|
|
4254
4253
|
});
|
|
4255
4254
|
continue;
|
|
4256
4255
|
}
|
|
4257
|
-
const xe = v.fields[
|
|
4256
|
+
const xe = v.fields[Y];
|
|
4258
4257
|
if (!xe) continue;
|
|
4259
|
-
const
|
|
4258
|
+
const ke = De(xe, Y, i == null ? void 0 : i.entities), we = (ne = xe.display) == null ? void 0 : ne.width;
|
|
4260
4259
|
S.push({
|
|
4261
|
-
id:
|
|
4262
|
-
accessorKey:
|
|
4263
|
-
header:
|
|
4260
|
+
id: Y,
|
|
4261
|
+
accessorKey: Y,
|
|
4262
|
+
header: ke,
|
|
4264
4263
|
size: we ?? 150,
|
|
4265
4264
|
cell: ({ getValue: de, row: ge }) => oe({
|
|
4266
4265
|
field: xe,
|
|
4267
|
-
fieldName:
|
|
4266
|
+
fieldName: Y,
|
|
4268
4267
|
value: de(),
|
|
4269
4268
|
mode: "display",
|
|
4270
4269
|
record: ge.original,
|
|
@@ -4272,22 +4271,22 @@ function No({ screenCode: e }) {
|
|
|
4272
4271
|
})
|
|
4273
4272
|
});
|
|
4274
4273
|
}
|
|
4275
|
-
const
|
|
4276
|
-
return (
|
|
4274
|
+
const P = !$ && !(v != null && v.readonly);
|
|
4275
|
+
return (P || T.length > 0) && S.push({
|
|
4277
4276
|
id: "_actions",
|
|
4278
4277
|
header: "",
|
|
4279
4278
|
size: 48,
|
|
4280
|
-
cell: ({ row:
|
|
4281
|
-
const xe = String(
|
|
4279
|
+
cell: ({ row: Y }) => {
|
|
4280
|
+
const xe = String(Y.original[qe] ?? ""), ke = br(h, xe, v, i == null ? void 0 : i.screens);
|
|
4282
4281
|
return /* @__PURE__ */ d(In, { children: [
|
|
4283
|
-
/* @__PURE__ */ n(Vn, { asChild: !0, children: /* @__PURE__ */ n(
|
|
4282
|
+
/* @__PURE__ */ n(Vn, { asChild: !0, children: /* @__PURE__ */ n(q, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ n(ti, { className: "h-4 w-4" }) }) }),
|
|
4284
4283
|
/* @__PURE__ */ d(zr, { align: "end", children: [
|
|
4285
|
-
|
|
4286
|
-
|
|
4284
|
+
P && /* @__PURE__ */ d(pe, { children: [
|
|
4285
|
+
ke && /* @__PURE__ */ d(
|
|
4287
4286
|
mt,
|
|
4288
4287
|
{
|
|
4289
|
-
onClick: () => t(
|
|
4290
|
-
title:
|
|
4288
|
+
onClick: () => t(ke, {
|
|
4289
|
+
title: D(v.display.name),
|
|
4291
4290
|
icon: v.display.icon,
|
|
4292
4291
|
search: "edit=true"
|
|
4293
4292
|
}),
|
|
@@ -4313,35 +4312,35 @@ function No({ screenCode: e }) {
|
|
|
4313
4312
|
T.map(({ code: we, action: de }) => {
|
|
4314
4313
|
var ge, Me;
|
|
4315
4314
|
if (de.type === "edit") {
|
|
4316
|
-
const Ae = pt(de.conditions,
|
|
4317
|
-
return
|
|
4315
|
+
const Ae = pt(de.conditions, Y.original);
|
|
4316
|
+
return ke ? /* @__PURE__ */ d(
|
|
4318
4317
|
mt,
|
|
4319
4318
|
{
|
|
4320
4319
|
disabled: !Ae,
|
|
4321
|
-
onClick: () => t(
|
|
4322
|
-
title:
|
|
4320
|
+
onClick: () => t(ke, {
|
|
4321
|
+
title: D(v.display.name),
|
|
4323
4322
|
icon: v.display.icon,
|
|
4324
4323
|
search: "edit=true"
|
|
4325
4324
|
}),
|
|
4326
4325
|
children: [
|
|
4327
4326
|
/* @__PURE__ */ n(Yt, { className: "mr-2 h-4 w-4" }),
|
|
4328
|
-
|
|
4327
|
+
D((ge = de.display) == null ? void 0 : ge.name) || "Edit"
|
|
4329
4328
|
]
|
|
4330
4329
|
},
|
|
4331
4330
|
we
|
|
4332
4331
|
) : null;
|
|
4333
4332
|
}
|
|
4334
4333
|
if (de.type === "delete") {
|
|
4335
|
-
const Ae = pt(de.conditions,
|
|
4334
|
+
const Ae = pt(de.conditions, Y.original);
|
|
4336
4335
|
return /* @__PURE__ */ d(
|
|
4337
4336
|
mt,
|
|
4338
4337
|
{
|
|
4339
4338
|
disabled: !Ae,
|
|
4340
|
-
onClick: () => l({ ids: [xe], confirmation:
|
|
4339
|
+
onClick: () => l({ ids: [xe], confirmation: D(de.confirmation) || void 0 }),
|
|
4341
4340
|
className: "text-[var(--destructive)]",
|
|
4342
4341
|
children: [
|
|
4343
4342
|
/* @__PURE__ */ n(Je, { className: "mr-2 h-4 w-4" }),
|
|
4344
|
-
|
|
4343
|
+
D((Me = de.display) == null ? void 0 : Me.name) || "Delete"
|
|
4345
4344
|
]
|
|
4346
4345
|
},
|
|
4347
4346
|
we
|
|
@@ -4354,7 +4353,7 @@ function No({ screenCode: e }) {
|
|
|
4354
4353
|
action: de,
|
|
4355
4354
|
entityCode: k,
|
|
4356
4355
|
objectId: xe,
|
|
4357
|
-
row:
|
|
4356
|
+
row: Y.original
|
|
4358
4357
|
},
|
|
4359
4358
|
we
|
|
4360
4359
|
);
|
|
@@ -4363,7 +4362,7 @@ function No({ screenCode: e }) {
|
|
|
4363
4362
|
] });
|
|
4364
4363
|
}
|
|
4365
4364
|
}), S;
|
|
4366
|
-
}, [h, v, V, t, F, T, $, k,
|
|
4365
|
+
}, [h, v, V, t, F, T, $, k, qe]), Ye = (Z == null ? void 0 : Z.data) ?? [], Se = Z == null ? void 0 : Z.meta, ut = pi({
|
|
4367
4366
|
data: Ye,
|
|
4368
4367
|
columns: Ze,
|
|
4369
4368
|
getCoreRowModel: hi(),
|
|
@@ -4371,17 +4370,17 @@ function No({ screenCode: e }) {
|
|
|
4371
4370
|
manualPagination: !0,
|
|
4372
4371
|
state: { sorting: be, rowSelection: c },
|
|
4373
4372
|
onSortingChange: (S) => {
|
|
4374
|
-
const
|
|
4375
|
-
if (
|
|
4373
|
+
const P = typeof S == "function" ? S(be) : S, H = new URLSearchParams(r);
|
|
4374
|
+
if (P.length === 0)
|
|
4376
4375
|
H.delete("sort");
|
|
4377
4376
|
else {
|
|
4378
|
-
const
|
|
4379
|
-
H.set("sort", `${
|
|
4377
|
+
const re = P[0];
|
|
4378
|
+
H.set("sort", `${re.id}:${re.desc ? "desc" : "asc"}`);
|
|
4380
4379
|
}
|
|
4381
4380
|
H.set("page", "1"), s(H);
|
|
4382
4381
|
},
|
|
4383
4382
|
onRowSelectionChange: o,
|
|
4384
|
-
getRowId: (S) => String(S[
|
|
4383
|
+
getRowId: (S) => String(S[qe] ?? ""),
|
|
4385
4384
|
rowCount: (Se == null ? void 0 : Se.total) ?? 0
|
|
4386
4385
|
}), wt = ee(
|
|
4387
4386
|
() => Object.keys(c).filter((S) => c[S]),
|
|
@@ -4389,20 +4388,20 @@ function No({ screenCode: e }) {
|
|
|
4389
4388
|
);
|
|
4390
4389
|
le(() => {
|
|
4391
4390
|
o({});
|
|
4392
|
-
}, [
|
|
4393
|
-
const S = (
|
|
4394
|
-
var
|
|
4395
|
-
const H = (
|
|
4391
|
+
}, [G, L, C, g]), le(() => {
|
|
4392
|
+
const S = (P) => {
|
|
4393
|
+
var re;
|
|
4394
|
+
const H = (re = P.target) == null ? void 0 : re.tagName;
|
|
4396
4395
|
if (H === "INPUT" || H === "TEXTAREA" || H === "SELECT") {
|
|
4397
|
-
|
|
4396
|
+
P.key === "Escape" && (P.target.blur(), p(!1));
|
|
4398
4397
|
return;
|
|
4399
4398
|
}
|
|
4400
|
-
if (
|
|
4401
|
-
|
|
4402
|
-
const
|
|
4403
|
-
|
|
4399
|
+
if (P.key === "/" && !P.metaKey && !P.ctrlKey) {
|
|
4400
|
+
P.preventDefault();
|
|
4401
|
+
const ne = document.querySelector('[placeholder*="Search"]');
|
|
4402
|
+
ne == null || ne.focus();
|
|
4404
4403
|
}
|
|
4405
|
-
|
|
4404
|
+
P.key === "f" && !P.metaKey && !P.ctrlKey && (P.preventDefault(), p((ne) => !ne)), P.key === "Escape" && p(!1);
|
|
4406
4405
|
};
|
|
4407
4406
|
return document.addEventListener("keydown", S), () => document.removeEventListener("keydown", S);
|
|
4408
4407
|
}, []), le(() => {
|
|
@@ -4418,41 +4417,41 @@ function No({ screenCode: e }) {
|
|
|
4418
4417
|
overscan: 10
|
|
4419
4418
|
}), ar = z(
|
|
4420
4419
|
(S) => {
|
|
4421
|
-
s((
|
|
4422
|
-
const H = new URLSearchParams(
|
|
4420
|
+
s((P) => {
|
|
4421
|
+
const H = new URLSearchParams(P);
|
|
4423
4422
|
return S ? H.set("search", S) : H.delete("search"), H.set("page", "1"), H;
|
|
4424
4423
|
});
|
|
4425
4424
|
},
|
|
4426
4425
|
[s]
|
|
4427
4426
|
), or = z(() => {
|
|
4428
4427
|
s((S) => {
|
|
4429
|
-
const
|
|
4430
|
-
return
|
|
4428
|
+
const P = new URLSearchParams(S);
|
|
4429
|
+
return P.get("include_deleted") ? P.delete("include_deleted") : P.set("include_deleted", "true"), P.set("page", "1"), P;
|
|
4431
4430
|
});
|
|
4432
4431
|
}, [s]), Pe = z(
|
|
4433
4432
|
(S) => {
|
|
4434
|
-
s((
|
|
4435
|
-
const H = new URLSearchParams(
|
|
4433
|
+
s((P) => {
|
|
4434
|
+
const H = new URLSearchParams(P);
|
|
4436
4435
|
return H.set("page", String(S)), H;
|
|
4437
4436
|
});
|
|
4438
4437
|
},
|
|
4439
4438
|
[s]
|
|
4440
4439
|
), 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(
|
|
4441
4440
|
(S) => {
|
|
4442
|
-
var
|
|
4441
|
+
var ke, we, de;
|
|
4443
4442
|
if (!v || !h) return;
|
|
4444
|
-
const
|
|
4443
|
+
const P = (ke = v.field_order) == null ? void 0 : ke.find((ge) => {
|
|
4445
4444
|
var Me;
|
|
4446
4445
|
return (Me = v.fields[ge]) == null ? void 0 : Me.primary;
|
|
4447
|
-
}), H =
|
|
4446
|
+
}), H = P ? String(S[P] ?? "") : "";
|
|
4448
4447
|
if (!H) return;
|
|
4449
|
-
const
|
|
4450
|
-
if (!
|
|
4451
|
-
const
|
|
4448
|
+
const re = br(h, H, v, i == null ? void 0 : i.screens);
|
|
4449
|
+
if (!re) return;
|
|
4450
|
+
const ne = (we = h.columns) == null ? void 0 : we.find(
|
|
4452
4451
|
(ge) => !ge.startsWith("$status.") && !ge.startsWith("$property.")
|
|
4453
|
-
),
|
|
4454
|
-
t(
|
|
4455
|
-
title:
|
|
4452
|
+
), Y = ne ? String(S[ne] ?? D(v.display.name)) : D(v.display.name), xe = ((de = h.display) == null ? void 0 : de.icon) || v.display.icon;
|
|
4453
|
+
t(re, {
|
|
4454
|
+
title: Y,
|
|
4456
4455
|
icon: xe
|
|
4457
4456
|
});
|
|
4458
4457
|
},
|
|
@@ -4462,23 +4461,23 @@ function No({ screenCode: e }) {
|
|
|
4462
4461
|
l(null);
|
|
4463
4462
|
const S = await Promise.allSettled(
|
|
4464
4463
|
a.ids.map((H) => Ne.mutateAsync(H))
|
|
4465
|
-
),
|
|
4466
|
-
if (
|
|
4464
|
+
), P = S.filter((H) => H.status === "rejected").length;
|
|
4465
|
+
if (P === 0)
|
|
4467
4466
|
o({});
|
|
4468
|
-
else if (
|
|
4467
|
+
else if (P < a.ids.length) {
|
|
4469
4468
|
const H = new Set(
|
|
4470
|
-
a.ids.filter((
|
|
4469
|
+
a.ids.filter((re, ne) => S[ne].status === "fulfilled")
|
|
4471
4470
|
);
|
|
4472
|
-
o((
|
|
4473
|
-
const
|
|
4474
|
-
for (const [
|
|
4475
|
-
H.has(
|
|
4476
|
-
return
|
|
4477
|
-
}), ie.warning(`${
|
|
4471
|
+
o((re) => {
|
|
4472
|
+
const ne = {};
|
|
4473
|
+
for (const [Y, xe] of Object.entries(re))
|
|
4474
|
+
H.has(Y) || (ne[Y] = xe);
|
|
4475
|
+
return ne;
|
|
4476
|
+
}), ie.warning(`${P} of ${a.ids.length} deletes failed`);
|
|
4478
4477
|
}
|
|
4479
4478
|
}, [a, Ne]);
|
|
4480
4479
|
if (!h || !v) return null;
|
|
4481
|
-
const $e = v.display, Pt =
|
|
4480
|
+
const $e = v.display, Pt = D((rt = h.display) == null ? void 0 : rt.name) || D($e.name), ft = ((Et = h.display) == null ? void 0 : Et.icon) || $e.icon;
|
|
4482
4481
|
return /* @__PURE__ */ d("div", { className: "flex flex-col h-full", children: [
|
|
4483
4482
|
/* @__PURE__ */ d("div", { className: "px-6 pt-6", children: [
|
|
4484
4483
|
/* @__PURE__ */ n(
|
|
@@ -4496,65 +4495,65 @@ function No({ screenCode: e }) {
|
|
|
4496
4495
|
isPartial: u.isPartial
|
|
4497
4496
|
}
|
|
4498
4497
|
),
|
|
4499
|
-
_.map(({ code: S, action:
|
|
4500
|
-
var H,
|
|
4501
|
-
if (
|
|
4502
|
-
return v != null && v.readonly ? null : /* @__PURE__ */ d(
|
|
4498
|
+
_.map(({ code: S, action: P }) => {
|
|
4499
|
+
var H, re;
|
|
4500
|
+
if (P.type === "create")
|
|
4501
|
+
return v != null && v.readonly ? null : /* @__PURE__ */ d(q, { onClick: () => t(`${h.route}/new`, { title: `New ${D($e.name)}`, icon: ft }), children: [
|
|
4503
4502
|
/* @__PURE__ */ n(Oe, { className: "w-4 h-4" }),
|
|
4504
|
-
|
|
4503
|
+
D((H = P.display) == null ? void 0 : H.name) || `New ${D($e.name)}`
|
|
4505
4504
|
] }, S);
|
|
4506
|
-
if (
|
|
4507
|
-
const
|
|
4508
|
-
const we = Ye.find((de) => String(de[
|
|
4509
|
-
return we ? pt(
|
|
4510
|
-
}) :
|
|
4505
|
+
if (P.type === "delete") {
|
|
4506
|
+
const ne = wt, Y = P.conditions && P.conditions.length > 0 ? ne.filter((ke) => {
|
|
4507
|
+
const we = Ye.find((de) => String(de[qe] ?? "") === ke);
|
|
4508
|
+
return we ? pt(P.conditions, we) : !1;
|
|
4509
|
+
}) : ne, xe = Y.length === 0;
|
|
4511
4510
|
return /* @__PURE__ */ d(
|
|
4512
|
-
|
|
4511
|
+
q,
|
|
4513
4512
|
{
|
|
4514
4513
|
variant: "outline",
|
|
4515
|
-
onClick: () => l({ ids:
|
|
4514
|
+
onClick: () => l({ ids: Y, confirmation: D(P.confirmation) || void 0 }),
|
|
4516
4515
|
disabled: xe,
|
|
4517
4516
|
className: "text-[var(--destructive)] hover:text-[var(--destructive)]",
|
|
4518
4517
|
children: [
|
|
4519
4518
|
/* @__PURE__ */ n(Je, { className: "w-4 h-4" }),
|
|
4520
|
-
|
|
4519
|
+
D((re = P.display) == null ? void 0 : re.name) || "Delete"
|
|
4521
4520
|
]
|
|
4522
4521
|
},
|
|
4523
4522
|
S
|
|
4524
4523
|
);
|
|
4525
4524
|
}
|
|
4526
|
-
return
|
|
4525
|
+
return P.type === "edit" ? null : /* @__PURE__ */ n(
|
|
4527
4526
|
nn,
|
|
4528
4527
|
{
|
|
4529
4528
|
actionCode: S,
|
|
4530
|
-
action:
|
|
4529
|
+
action: P,
|
|
4531
4530
|
entityCode: k,
|
|
4532
|
-
objectIds:
|
|
4531
|
+
objectIds: wt,
|
|
4533
4532
|
variant: "outline",
|
|
4534
4533
|
onSuccess: () => {
|
|
4535
4534
|
o({}), f({ isPending: !1, isSuccess: !0, isError: !1, isPartial: !1, count: wt.length });
|
|
4536
4535
|
},
|
|
4537
|
-
onBatchStart:
|
|
4538
|
-
onBatchError:
|
|
4539
|
-
onBatchPartial:
|
|
4540
|
-
if (f({ isPending: !1, isSuccess: !1, isError: !1, isPartial: !0, count:
|
|
4541
|
-
const xe = new Set(
|
|
4542
|
-
o((
|
|
4536
|
+
onBatchStart: (ne) => f({ isPending: !0, isSuccess: !1, isError: !1, isPartial: !1, count: ne }),
|
|
4537
|
+
onBatchError: (ne) => f({ isPending: !1, isSuccess: !1, isError: !0, isPartial: !1, count: ne }),
|
|
4538
|
+
onBatchPartial: (ne, Y) => {
|
|
4539
|
+
if (f({ isPending: !1, isSuccess: !1, isError: !1, isPartial: !0, count: ne }), Y && Y.length > 0) {
|
|
4540
|
+
const xe = new Set(Y);
|
|
4541
|
+
o((ke) => {
|
|
4543
4542
|
const we = {};
|
|
4544
|
-
for (const [de, ge] of Object.entries(
|
|
4543
|
+
for (const [de, ge] of Object.entries(ke))
|
|
4545
4544
|
xe.has(de) || (we[de] = ge);
|
|
4546
4545
|
return we;
|
|
4547
4546
|
});
|
|
4548
4547
|
}
|
|
4549
|
-
}
|
|
4548
|
+
}
|
|
4550
4549
|
},
|
|
4551
4550
|
S
|
|
4552
4551
|
);
|
|
4553
4552
|
}),
|
|
4554
|
-
h.actions === void 0 && !(v != null && v.readonly) && /* @__PURE__ */ d(
|
|
4553
|
+
h.actions === void 0 && !(v != null && v.readonly) && /* @__PURE__ */ d(q, { onClick: () => t(`${h.route}/new`, { title: `New ${D($e.name)}`, icon: ft }), children: [
|
|
4555
4554
|
/* @__PURE__ */ n(Oe, { className: "w-4 h-4" }),
|
|
4556
4555
|
"New ",
|
|
4557
|
-
|
|
4556
|
+
D($e.name)
|
|
4558
4557
|
] })
|
|
4559
4558
|
] })
|
|
4560
4559
|
}
|
|
@@ -4572,8 +4571,8 @@ function No({ screenCode: e }) {
|
|
|
4572
4571
|
r.get("search") && H.set("search", r.get("search")), s(H);
|
|
4573
4572
|
return;
|
|
4574
4573
|
}
|
|
4575
|
-
const
|
|
4576
|
-
|
|
4574
|
+
const P = new URLSearchParams(r);
|
|
4575
|
+
P.set("view", S.id), S.filters && Array.isArray(S.filters) && S.filters.length > 0 && P.set("filters", JSON.stringify(S.filters)), S.columns && S.columns.length > 0 && P.set("columns", S.columns.join(",")), S.sort && P.set("sort", S.sort), P.set("page", "1"), s(P);
|
|
4577
4576
|
}
|
|
4578
4577
|
}
|
|
4579
4578
|
),
|
|
@@ -4590,7 +4589,7 @@ function No({ screenCode: e }) {
|
|
|
4590
4589
|
)
|
|
4591
4590
|
] }),
|
|
4592
4591
|
/* @__PURE__ */ d(
|
|
4593
|
-
|
|
4592
|
+
q,
|
|
4594
4593
|
{
|
|
4595
4594
|
variant: y > 0 ? "secondary" : "outline",
|
|
4596
4595
|
size: "sm",
|
|
@@ -4599,7 +4598,7 @@ function No({ screenCode: e }) {
|
|
|
4599
4598
|
children: [
|
|
4600
4599
|
/* @__PURE__ */ n(Cn, { className: "w-4 h-4 mr-1.5" }),
|
|
4601
4600
|
"Filters",
|
|
4602
|
-
y > 0 && /* @__PURE__ */ n(
|
|
4601
|
+
y > 0 && /* @__PURE__ */ n(Ce, { variant: "secondary", className: "ml-1.5 h-5 min-w-[20px] px-1 text-xs", children: y })
|
|
4603
4602
|
]
|
|
4604
4603
|
}
|
|
4605
4604
|
),
|
|
@@ -4609,8 +4608,8 @@ function No({ screenCode: e }) {
|
|
|
4609
4608
|
availableColumns: h.columns ?? [],
|
|
4610
4609
|
visibleColumns: V,
|
|
4611
4610
|
onToggle: (S) => {
|
|
4612
|
-
const
|
|
4613
|
-
H.length !== 0 && (
|
|
4611
|
+
const P = new URLSearchParams(r), H = V.includes(S) ? V.filter((re) => re !== S) : [...V, S];
|
|
4612
|
+
H.length !== 0 && (P.set("columns", H.join(",")), s(P));
|
|
4614
4613
|
},
|
|
4615
4614
|
onReset: () => {
|
|
4616
4615
|
const S = new URLSearchParams(r);
|
|
@@ -4621,22 +4620,22 @@ function No({ screenCode: e }) {
|
|
|
4621
4620
|
S.set("columns", (h.columns ?? []).join(",")), s(S);
|
|
4622
4621
|
},
|
|
4623
4622
|
columnLabel: (S) => {
|
|
4624
|
-
var H,
|
|
4623
|
+
var H, re;
|
|
4625
4624
|
if (S.startsWith("$status.")) {
|
|
4626
|
-
const
|
|
4627
|
-
return
|
|
4625
|
+
const ne = S.slice(8), Y = (H = v.status_groups) == null ? void 0 : H[ne];
|
|
4626
|
+
return Y ? D(Y.name) || ne : S;
|
|
4628
4627
|
}
|
|
4629
4628
|
if (S.startsWith("$property.")) {
|
|
4630
|
-
const
|
|
4631
|
-
return
|
|
4629
|
+
const ne = S.slice(10), Y = (re = v.properties) == null ? void 0 : re[ne];
|
|
4630
|
+
return Y ? D(Y.name) || ne : S;
|
|
4632
4631
|
}
|
|
4633
|
-
const
|
|
4634
|
-
return
|
|
4632
|
+
const P = v.fields[S];
|
|
4633
|
+
return P ? De(P, S, i == null ? void 0 : i.entities) : S;
|
|
4635
4634
|
}
|
|
4636
4635
|
}
|
|
4637
4636
|
),
|
|
4638
|
-
|
|
4639
|
-
|
|
4637
|
+
j && /* @__PURE__ */ d(
|
|
4638
|
+
q,
|
|
4640
4639
|
{
|
|
4641
4640
|
variant: E ? "secondary" : "outline",
|
|
4642
4641
|
size: "sm",
|
|
@@ -4657,17 +4656,17 @@ function No({ screenCode: e }) {
|
|
|
4657
4656
|
onClearAll: w,
|
|
4658
4657
|
onChipClick: () => p(!0),
|
|
4659
4658
|
fieldLabel: (S) => {
|
|
4660
|
-
var H,
|
|
4659
|
+
var H, re;
|
|
4661
4660
|
if (S.startsWith("$status.")) {
|
|
4662
|
-
const
|
|
4663
|
-
return
|
|
4661
|
+
const ne = S.slice(8), Y = (H = v.status_groups) == null ? void 0 : H[ne];
|
|
4662
|
+
return Y ? D(Y.name) || ne : S;
|
|
4664
4663
|
}
|
|
4665
4664
|
if (S.startsWith("$property.")) {
|
|
4666
|
-
const
|
|
4667
|
-
return
|
|
4665
|
+
const ne = S.slice(10), Y = (re = v.properties) == null ? void 0 : re[ne];
|
|
4666
|
+
return Y ? D(Y.name) || ne : S;
|
|
4668
4667
|
}
|
|
4669
|
-
const
|
|
4670
|
-
return
|
|
4668
|
+
const P = v.fields[S];
|
|
4669
|
+
return P ? De(P, S, i == null ? void 0 : i.entities) : S;
|
|
4671
4670
|
}
|
|
4672
4671
|
}
|
|
4673
4672
|
)
|
|
@@ -4684,40 +4683,40 @@ function No({ screenCode: e }) {
|
|
|
4684
4683
|
{
|
|
4685
4684
|
icon: ft,
|
|
4686
4685
|
title: L || y > 0 ? "No results found" : `No ${Pt.toLowerCase()} yet`,
|
|
4687
|
-
description: L || y > 0 ? "Try adjusting your search or filters" : `Create your first ${
|
|
4688
|
-
action: !L && y === 0 && !(v != null && v.readonly) ? /* @__PURE__ */ d(
|
|
4686
|
+
description: L || y > 0 ? "Try adjusting your search or filters" : `Create your first ${D($e.name).toLowerCase()} to get started`,
|
|
4687
|
+
action: !L && y === 0 && !(v != null && v.readonly) ? /* @__PURE__ */ d(q, { onClick: () => t(`${h.route}/new`, { title: `New ${D($e.name)}`, icon: ft }), children: [
|
|
4689
4688
|
/* @__PURE__ */ n(Oe, { className: "w-4 h-4" }),
|
|
4690
4689
|
"New ",
|
|
4691
|
-
|
|
4690
|
+
D($e.name)
|
|
4692
4691
|
] }) : void 0
|
|
4693
4692
|
}
|
|
4694
4693
|
) }) : /* @__PURE__ */ n("div", { ref: At, className: "flex-1 overflow-auto px-6", children: /* @__PURE__ */ d("table", { className: "w-full text-sm", children: [
|
|
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((
|
|
4696
|
-
const H =
|
|
4694
|
+
/* @__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((P) => {
|
|
4695
|
+
const H = P.id !== "_actions", re = P.column.getIsSorted();
|
|
4697
4696
|
return /* @__PURE__ */ n(
|
|
4698
4697
|
"th",
|
|
4699
4698
|
{
|
|
4700
4699
|
className: "h-10 px-3 text-left align-middle font-medium text-[var(--muted-foreground)]",
|
|
4701
|
-
style: { width:
|
|
4702
|
-
children:
|
|
4700
|
+
style: { width: P.getSize() },
|
|
4701
|
+
children: P.isPlaceholder ? null : H ? /* @__PURE__ */ d(
|
|
4703
4702
|
"button",
|
|
4704
4703
|
{
|
|
4705
4704
|
className: "inline-flex items-center gap-1 hover:text-[var(--foreground)] transition-colors",
|
|
4706
|
-
onClick:
|
|
4705
|
+
onClick: P.column.getToggleSortingHandler(),
|
|
4707
4706
|
children: [
|
|
4708
4707
|
dr(
|
|
4709
|
-
|
|
4710
|
-
|
|
4708
|
+
P.column.columnDef.header,
|
|
4709
|
+
P.getContext()
|
|
4711
4710
|
),
|
|
4712
|
-
|
|
4711
|
+
re === "asc" ? /* @__PURE__ */ n(ri, { className: "w-3 h-3" }) : re === "desc" ? /* @__PURE__ */ n(ni, { className: "w-3 h-3" }) : /* @__PURE__ */ n(si, { className: "w-3 h-3 opacity-40" })
|
|
4713
4712
|
]
|
|
4714
4713
|
}
|
|
4715
4714
|
) : dr(
|
|
4716
|
-
|
|
4717
|
-
|
|
4715
|
+
P.column.columnDef.header,
|
|
4716
|
+
P.getContext()
|
|
4718
4717
|
)
|
|
4719
4718
|
},
|
|
4720
|
-
|
|
4719
|
+
P.id
|
|
4721
4720
|
);
|
|
4722
4721
|
}) }, S.id)) }),
|
|
4723
4722
|
/* @__PURE__ */ d("tbody", { children: [
|
|
@@ -4729,33 +4728,33 @@ function No({ screenCode: e }) {
|
|
|
4729
4728
|
}
|
|
4730
4729
|
) }),
|
|
4731
4730
|
We.getVirtualItems().map((S) => {
|
|
4732
|
-
const
|
|
4731
|
+
const P = et[S.index], H = M && P.original[v.soft_delete] != null;
|
|
4733
4732
|
return /* @__PURE__ */ n(
|
|
4734
4733
|
"tr",
|
|
4735
4734
|
{
|
|
4736
4735
|
"data-index": S.index,
|
|
4737
|
-
ref: (
|
|
4736
|
+
ref: (re) => We.measureElement(re),
|
|
4738
4737
|
className: J(
|
|
4739
4738
|
"border-b transition-colors",
|
|
4740
4739
|
Dt && "hover:bg-[var(--muted)]/50 cursor-pointer",
|
|
4741
4740
|
H && "opacity-50 italic"
|
|
4742
4741
|
),
|
|
4743
|
-
onClick: Dt ? () => lr(
|
|
4744
|
-
children:
|
|
4742
|
+
onClick: Dt ? () => lr(P.original) : void 0,
|
|
4743
|
+
children: P.getVisibleCells().map((re) => /* @__PURE__ */ n(
|
|
4745
4744
|
"td",
|
|
4746
4745
|
{
|
|
4747
4746
|
className: "px-3 py-2.5 align-middle",
|
|
4748
|
-
style: { width:
|
|
4749
|
-
onClick:
|
|
4747
|
+
style: { width: re.column.getSize() },
|
|
4748
|
+
onClick: re.column.id === "_actions" || re.column.id === "_select" ? (ne) => ne.stopPropagation() : void 0,
|
|
4750
4749
|
children: dr(
|
|
4751
|
-
|
|
4752
|
-
|
|
4750
|
+
re.column.columnDef.cell,
|
|
4751
|
+
re.getContext()
|
|
4753
4752
|
)
|
|
4754
4753
|
},
|
|
4755
|
-
|
|
4754
|
+
re.id
|
|
4756
4755
|
))
|
|
4757
4756
|
},
|
|
4758
|
-
|
|
4757
|
+
P.id
|
|
4759
4758
|
);
|
|
4760
4759
|
}),
|
|
4761
4760
|
We.getVirtualItems().length > 0 && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n(
|
|
@@ -4777,12 +4776,12 @@ function No({ screenCode: e }) {
|
|
|
4777
4776
|
] }),
|
|
4778
4777
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
4779
4778
|
/* @__PURE__ */ d(
|
|
4780
|
-
|
|
4779
|
+
q,
|
|
4781
4780
|
{
|
|
4782
4781
|
variant: "outline",
|
|
4783
4782
|
size: "sm",
|
|
4784
|
-
onClick: () => Pe(
|
|
4785
|
-
disabled:
|
|
4783
|
+
onClick: () => Pe(G - 1),
|
|
4784
|
+
disabled: G <= 1,
|
|
4786
4785
|
children: [
|
|
4787
4786
|
/* @__PURE__ */ n(Sn, { className: "w-4 h-4" }),
|
|
4788
4787
|
"Prev"
|
|
@@ -4796,12 +4795,12 @@ function No({ screenCode: e }) {
|
|
|
4796
4795
|
Se.total_pages
|
|
4797
4796
|
] }),
|
|
4798
4797
|
/* @__PURE__ */ d(
|
|
4799
|
-
|
|
4798
|
+
q,
|
|
4800
4799
|
{
|
|
4801
4800
|
variant: "outline",
|
|
4802
4801
|
size: "sm",
|
|
4803
|
-
onClick: () => Pe(
|
|
4804
|
-
disabled:
|
|
4802
|
+
onClick: () => Pe(G + 1),
|
|
4803
|
+
disabled: G >= Se.total_pages,
|
|
4805
4804
|
children: [
|
|
4806
4805
|
"Next",
|
|
4807
4806
|
/* @__PURE__ */ n(Pr, { className: "w-4 h-4" })
|
|
@@ -4825,8 +4824,8 @@ function No({ screenCode: e }) {
|
|
|
4825
4824
|
{
|
|
4826
4825
|
open: a !== null,
|
|
4827
4826
|
onOpenChange: (S) => !S && l(null),
|
|
4828
|
-
title: `Delete ${
|
|
4829
|
-
description: a != null && a.confirmation ? a.confirmation : M ? `Are you sure you want to delete this ${
|
|
4827
|
+
title: `Delete ${D($e.name)}`,
|
|
4828
|
+
description: a != null && a.confirmation ? a.confirmation : M ? `Are you sure you want to delete this ${D($e.name).toLowerCase()}? It can be restored later by an admin.` : `Are you sure you want to delete this ${D($e.name).toLowerCase()}? This action cannot be undone.`,
|
|
4830
4829
|
confirmLabel: "Delete",
|
|
4831
4830
|
onConfirm: cr,
|
|
4832
4831
|
destructive: !0
|
|
@@ -4844,12 +4843,12 @@ function wo(e, t, r) {
|
|
|
4844
4843
|
if (!y) continue;
|
|
4845
4844
|
i.push({
|
|
4846
4845
|
code: o,
|
|
4847
|
-
label:
|
|
4846
|
+
label: D(y.name) || g,
|
|
4848
4847
|
type: "status",
|
|
4849
4848
|
operators: ["eq", "not_eq", "in", "not_in"],
|
|
4850
4849
|
options: y.statuses.map((b) => ({
|
|
4851
4850
|
value: b.code,
|
|
4852
|
-
label:
|
|
4851
|
+
label: D(b.name) || b.code,
|
|
4853
4852
|
color: b.color
|
|
4854
4853
|
}))
|
|
4855
4854
|
});
|
|
@@ -4860,7 +4859,7 @@ function wo(e, t, r) {
|
|
|
4860
4859
|
if (!y) continue;
|
|
4861
4860
|
i.push({
|
|
4862
4861
|
code: o,
|
|
4863
|
-
label:
|
|
4862
|
+
label: D(y.name) || g,
|
|
4864
4863
|
type: "property",
|
|
4865
4864
|
operators: ["eq", "not_eq", "contains", "is_empty", "is_not_empty"]
|
|
4866
4865
|
});
|
|
@@ -4870,7 +4869,7 @@ function wo(e, t, r) {
|
|
|
4870
4869
|
if (!u) continue;
|
|
4871
4870
|
const f = De(u, o, r), m = _o(u.type), p = (c = u.values) == null ? void 0 : c.map((g) => ({
|
|
4872
4871
|
value: g.code,
|
|
4873
|
-
label:
|
|
4872
|
+
label: D(g.name) || g.code,
|
|
4874
4873
|
color: g.color
|
|
4875
4874
|
}));
|
|
4876
4875
|
i.push({ code: o, label: f, type: u.type, operators: m, options: p });
|
|
@@ -4973,7 +4972,7 @@ function So({
|
|
|
4973
4972
|
onClick: () => l(m),
|
|
4974
4973
|
children: [
|
|
4975
4974
|
((p = f.display) == null ? void 0 : p.icon) && /* @__PURE__ */ n(Ge, { name: f.display.icon, className: "w-4 h-4" }),
|
|
4976
|
-
|
|
4975
|
+
D((g = f.display) == null ? void 0 : g.name) || u
|
|
4977
4976
|
]
|
|
4978
4977
|
},
|
|
4979
4978
|
u
|
|
@@ -5025,7 +5024,7 @@ function ko({
|
|
|
5025
5024
|
var T, $;
|
|
5026
5025
|
const k = er(i, u);
|
|
5027
5026
|
if (!k) return;
|
|
5028
|
-
const A =
|
|
5027
|
+
const A = D((T = s.display) == null ? void 0 : T.name) || r, _ = new URLSearchParams();
|
|
5029
5028
|
_.set("filters", JSON.stringify([{ field: p, op: "in", value: m }])), a(k.route, {
|
|
5030
5029
|
title: A,
|
|
5031
5030
|
icon: (($ = s.display) == null ? void 0 : $.icon) || k.icon,
|
|
@@ -5061,13 +5060,13 @@ function ko({
|
|
|
5061
5060
|
}) }, _) : /* @__PURE__ */ n("td", {}, _);
|
|
5062
5061
|
}) }, A)) })
|
|
5063
5062
|
] }),
|
|
5064
|
-
v && c && c.count > w.length && /* @__PURE__ */ n("div", { className: "pt-3 text-center", children: /* @__PURE__ */ d(
|
|
5063
|
+
v && c && c.count > w.length && /* @__PURE__ */ n("div", { className: "pt-3 text-center", children: /* @__PURE__ */ d(q, { variant: "outline", size: "sm", onClick: h, children: [
|
|
5065
5064
|
/* @__PURE__ */ n(_r, { className: "w-3 h-3 mr-1.5" }),
|
|
5066
5065
|
"View all ",
|
|
5067
5066
|
c.count,
|
|
5068
5067
|
" records"
|
|
5069
5068
|
] }) }),
|
|
5070
|
-
v && w.length > 0 && c && c.count <= w.length && /* @__PURE__ */ n("div", { className: "pt-3 text-center", children: /* @__PURE__ */ d(
|
|
5069
|
+
v && w.length > 0 && c && c.count <= w.length && /* @__PURE__ */ n("div", { className: "pt-3 text-center", children: /* @__PURE__ */ d(q, { variant: "ghost", size: "sm", onClick: h, children: [
|
|
5071
5070
|
/* @__PURE__ */ n(_r, { className: "w-3 h-3 mr-1.5" }),
|
|
5072
5071
|
"Open in list view"
|
|
5073
5072
|
] }) })
|
|
@@ -5110,8 +5109,8 @@ function To({ config: e, ctx: t }) {
|
|
|
5110
5109
|
const v = (A) => {
|
|
5111
5110
|
const _ = p.current;
|
|
5112
5111
|
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,
|
|
5114
|
-
|
|
5112
|
+
const T = u.current.getBoundingClientRect().width, $ = A.clientX - _.startX, F = _.startSizes.reduce((E, U) => E + U, 0), M = $ / T * F, j = [..._.startSizes];
|
|
5113
|
+
j[_.index] = Math.max(0.1, _.startSizes[_.index] + M), j[_.index + 1] = Math.max(0.1, _.startSizes[_.index + 1] - M), m(j);
|
|
5115
5114
|
}, k = () => {
|
|
5116
5115
|
p.current = null, document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", k);
|
|
5117
5116
|
};
|
|
@@ -5175,13 +5174,13 @@ function Po({ config: e, ctx: t }) {
|
|
|
5175
5174
|
function $o(e, t) {
|
|
5176
5175
|
var r, s;
|
|
5177
5176
|
if (e.children) {
|
|
5178
|
-
if (e.label) return
|
|
5177
|
+
if (e.label) return D(e.label);
|
|
5179
5178
|
const i = (r = t.entity.children) == null ? void 0 : r.find((l) => l.entity === e.children);
|
|
5180
|
-
if ((s = i == null ? void 0 : i.display) != null && s.name) return
|
|
5179
|
+
if ((s = i == null ? void 0 : i.display) != null && s.name) return D(i.display.name);
|
|
5181
5180
|
const a = t.schema.entities[e.children];
|
|
5182
|
-
return a &&
|
|
5181
|
+
return a && D(a.display.name_plural) || e.children;
|
|
5183
5182
|
}
|
|
5184
|
-
return e.section ?
|
|
5183
|
+
return e.section ? D(e.section.name) : "Tab";
|
|
5185
5184
|
}
|
|
5186
5185
|
function Ro(e, t) {
|
|
5187
5186
|
var r, s;
|
|
@@ -5233,7 +5232,7 @@ function Oo({ config: e, ctx: t }) {
|
|
|
5233
5232
|
className: "cursor-pointer py-4",
|
|
5234
5233
|
onClick: () => c((u) => !u),
|
|
5235
5234
|
children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
|
|
5236
|
-
/* @__PURE__ */ n(Vt, { className: "text-base", children:
|
|
5235
|
+
/* @__PURE__ */ n(Vt, { className: "text-base", children: D(r) }),
|
|
5237
5236
|
/* @__PURE__ */ n(
|
|
5238
5237
|
Mt,
|
|
5239
5238
|
{
|
|
@@ -5256,8 +5255,8 @@ function Fo(e, t, r) {
|
|
|
5256
5255
|
name: it(r == null ? void 0 : r.label, s == null ? void 0 : s.name, Lo(t)),
|
|
5257
5256
|
icon: it(r == null ? void 0 : r.icon, s == null ? void 0 : s.icon, t.display.icon) ?? "",
|
|
5258
5257
|
mode: it(r == null ? void 0 : r.mode, s == null ? void 0 : s.mode, "table"),
|
|
5259
|
-
columns: it(r == null ? void 0 : r.columns, s == null ? void 0 : s.columns,
|
|
5260
|
-
sort: it(r == null ? void 0 : r.sort, s == null ? void 0 : s.sort,
|
|
5258
|
+
columns: it(r == null ? void 0 : r.columns, s == null ? void 0 : s.columns, qo(t, e.foreign_key)),
|
|
5259
|
+
sort: it(r == null ? void 0 : r.sort, s == null ? void 0 : s.sort, jo(t)),
|
|
5261
5260
|
limit: it(r == null ? void 0 : r.limit, s == null ? void 0 : s.limit, 20),
|
|
5262
5261
|
editable: it(r == null ? void 0 : r.editable, s == null ? void 0 : s.editable, !0)
|
|
5263
5262
|
}, a = it(r == null ? void 0 : r.position_field, s == null ? void 0 : s.position_field, void 0);
|
|
@@ -5275,7 +5274,7 @@ function it(e, t, r) {
|
|
|
5275
5274
|
function Lo(e) {
|
|
5276
5275
|
return e.display.name_plural && Object.keys(e.display.name_plural).length > 0 ? e.display.name_plural : e.display.name;
|
|
5277
5276
|
}
|
|
5278
|
-
function
|
|
5277
|
+
function jo(e) {
|
|
5279
5278
|
var r, s;
|
|
5280
5279
|
if (((r = e.fields.created_at) == null ? void 0 : r.type) === "timestamp")
|
|
5281
5280
|
return "created_at:desc";
|
|
@@ -5294,7 +5293,7 @@ function qo(e) {
|
|
|
5294
5293
|
const t = Ko(e);
|
|
5295
5294
|
return t ? t + ":asc" : "";
|
|
5296
5295
|
}
|
|
5297
|
-
function
|
|
5296
|
+
function qo(e, t) {
|
|
5298
5297
|
var i;
|
|
5299
5298
|
const r = new Set(Array.isArray(t) ? t : [t]), s = [];
|
|
5300
5299
|
for (const a of e.field_order) {
|
|
@@ -5351,7 +5350,7 @@ function Vo(e, ...t) {
|
|
|
5351
5350
|
}
|
|
5352
5351
|
}
|
|
5353
5352
|
function Ko(e) {
|
|
5354
|
-
const t =
|
|
5353
|
+
const t = jr(e);
|
|
5355
5354
|
return t.length > 0 ? t[0] : void 0;
|
|
5356
5355
|
}
|
|
5357
5356
|
function Wo(e, t) {
|
|
@@ -5451,7 +5450,7 @@ function an({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5451
5450
|
})
|
|
5452
5451
|
] }, p) : null;
|
|
5453
5452
|
}),
|
|
5454
|
-
/* @__PURE__ */ n(
|
|
5453
|
+
/* @__PURE__ */ n(q, { type: "submit", size: "sm", disabled: c || !u, className: "shrink-0 mb-0.5", children: "Add" }),
|
|
5455
5454
|
o != null && /* @__PURE__ */ n("span", { className: "text-xs text-[var(--destructive)] self-end mb-1", children: o.message })
|
|
5456
5455
|
]
|
|
5457
5456
|
}
|
|
@@ -5617,7 +5616,7 @@ function Go({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5617
5616
|
record: x,
|
|
5618
5617
|
refs: u
|
|
5619
5618
|
}) : `Record ${N + 1}` }),
|
|
5620
|
-
g && x[g] != null && /* @__PURE__ */ n(
|
|
5619
|
+
g && x[g] != null && /* @__PURE__ */ n(Ce, { variant: "secondary", className: "text-xs shrink-0", children: i.fields[g] ? oe({
|
|
5621
5620
|
field: i.fields[g],
|
|
5622
5621
|
fieldName: g,
|
|
5623
5622
|
value: x[g],
|
|
@@ -5684,7 +5683,7 @@ function bn({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5684
5683
|
T.preventDefault(), y.current = { startY: T.clientY, startHeight: p };
|
|
5685
5684
|
const $ = (M) => {
|
|
5686
5685
|
if (!y.current) return;
|
|
5687
|
-
const
|
|
5686
|
+
const j = y.current.startY - M.clientY, E = Math.min(Zo, Math.max(Xo, y.current.startHeight + j));
|
|
5688
5687
|
g(E);
|
|
5689
5688
|
}, F = () => {
|
|
5690
5689
|
y.current = null, document.removeEventListener("mousemove", $), document.removeEventListener("mouseup", F);
|
|
@@ -5752,7 +5751,7 @@ function bn({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5752
5751
|
),
|
|
5753
5752
|
/* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
|
|
5754
5753
|
A.map(_),
|
|
5755
|
-
/* @__PURE__ */ n("div", { className: "ml-auto", children: /* @__PURE__ */ n(
|
|
5754
|
+
/* @__PURE__ */ n("div", { className: "ml-auto", children: /* @__PURE__ */ n(q, { type: "submit", size: "sm", disabled: c || !u, children: "Add Note" }) })
|
|
5756
5755
|
] }),
|
|
5757
5756
|
o != null && /* @__PURE__ */ n("p", { className: "text-xs text-[var(--destructive)] shrink-0", children: o.message })
|
|
5758
5757
|
] })
|
|
@@ -5773,7 +5772,7 @@ function el({ config: e, parentEntity: t, parentId: r, schema: s }) {
|
|
|
5773
5772
|
const [w, x] = I(null);
|
|
5774
5773
|
if (!i)
|
|
5775
5774
|
return /* @__PURE__ */ n("div", { className: "text-sm text-[var(--muted-foreground)] py-2", children: "Entity not found." });
|
|
5776
|
-
const N = ((k = e.quick_add) == null ? void 0 : k.fields) ?? [f == null ? void 0 : f.content_field].filter(Boolean), h =
|
|
5775
|
+
const N = ((k = e.quick_add) == null ? void 0 : k.fields) ?? [f == null ? void 0 : f.content_field].filter(Boolean), h = D((A = i.display) == null ? void 0 : A.name_plural) || D((_ = i.display) == null ? void 0 : _.name) || e.entity;
|
|
5777
5776
|
let v;
|
|
5778
5777
|
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: [
|
|
5779
5778
|
/* @__PURE__ */ n(_e, { className: "h-16 w-full rounded-lg" }),
|
|
@@ -5845,7 +5844,7 @@ function tl({
|
|
|
5845
5844
|
w(E), f();
|
|
5846
5845
|
}, [e, c, f]), k = z((E, U) => {
|
|
5847
5846
|
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,
|
|
5847
|
+
}, []), 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, j = l == null ? void 0 : l.intent_field;
|
|
5849
5848
|
return u ? /* @__PURE__ */ d("div", { className: "rounded-lg border-2 border-[var(--primary)]/40 bg-[var(--card)] p-3 space-y-2", children: [
|
|
5850
5849
|
c.map((E) => {
|
|
5851
5850
|
const U = r.fields[E];
|
|
@@ -5855,12 +5854,12 @@ function tl({
|
|
|
5855
5854
|
] }, E) : null;
|
|
5856
5855
|
}),
|
|
5857
5856
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-1.5 pt-1", children: [
|
|
5858
|
-
/* @__PURE__ */ d(
|
|
5857
|
+
/* @__PURE__ */ d(q, { size: "sm", onClick: () => N.mutate(b), disabled: N.isPending, className: "h-7 text-xs gap-1", children: [
|
|
5859
5858
|
/* @__PURE__ */ n(Tt, { className: "h-3 w-3" }),
|
|
5860
5859
|
" ",
|
|
5861
5860
|
N.isPending ? "Saving..." : "Save"
|
|
5862
5861
|
] }),
|
|
5863
|
-
/* @__PURE__ */ d(
|
|
5862
|
+
/* @__PURE__ */ d(q, { size: "sm", variant: "outline", onClick: () => {
|
|
5864
5863
|
w({}), m();
|
|
5865
5864
|
}, disabled: N.isPending, className: "h-7 text-xs gap-1", children: [
|
|
5866
5865
|
/* @__PURE__ */ n(ze, { className: "h-3 w-3" }),
|
|
@@ -5872,7 +5871,7 @@ function tl({
|
|
|
5872
5871
|
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
5872
|
_ && 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
5873
|
M && e[M] != null && r.fields[M] && /* @__PURE__ */ n(rl, { value: e[M], field: r.fields[M] }),
|
|
5875
|
-
|
|
5874
|
+
j && e[j] != null && r.fields[j] && /* @__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[j], fieldName: j, value: e[j], mode: "display", record: e, refs: o }) }),
|
|
5876
5875
|
F && e[F] != null && r.fields[F] && /* @__PURE__ */ d("span", { children: [
|
|
5877
5876
|
"by ",
|
|
5878
5877
|
oe({ field: r.fields[F], fieldName: F, value: e[F], mode: "display", record: e, refs: o })
|
|
@@ -5969,27 +5968,27 @@ function sl({
|
|
|
5969
5968
|
if (!A) return;
|
|
5970
5969
|
const _ = Array.from(k.cells).indexOf(v), T = Array.from(A.rows).indexOf(k);
|
|
5971
5970
|
if (N.key === "Tab") {
|
|
5972
|
-
const M = N.shiftKey ? -1 : 1,
|
|
5971
|
+
const M = N.shiftKey ? -1 : 1, j = Array.from(A.rows);
|
|
5973
5972
|
let E = T, U = _ + M;
|
|
5974
|
-
for (; E >= 0 && E <
|
|
5975
|
-
if (U >= 0 && U <
|
|
5976
|
-
const
|
|
5977
|
-
if (
|
|
5978
|
-
N.preventDefault(),
|
|
5973
|
+
for (; E >= 0 && E < j.length; )
|
|
5974
|
+
if (U >= 0 && U < j[E].cells.length) {
|
|
5975
|
+
const te = j[E].cells[U].querySelector("input, select, textarea, [tabindex]");
|
|
5976
|
+
if (te) {
|
|
5977
|
+
N.preventDefault(), te.focus();
|
|
5979
5978
|
return;
|
|
5980
5979
|
}
|
|
5981
5980
|
U += M;
|
|
5982
5981
|
} else
|
|
5983
|
-
E += M, U = M > 0 ? 0 : ((($ =
|
|
5982
|
+
E += M, U = M > 0 ? 0 : ((($ = j[E]) == null ? void 0 : $.cells.length) ?? 1) - 1;
|
|
5984
5983
|
} else if (N.key === "Enter") {
|
|
5985
5984
|
N.preventDefault();
|
|
5986
5985
|
const M = Array.from(A.rows);
|
|
5987
5986
|
if (T < M.length - 1) {
|
|
5988
|
-
const
|
|
5987
|
+
const j = M[T + 1].cells[_], E = j == null ? void 0 : j.querySelector("input, select, textarea, [tabindex]");
|
|
5989
5988
|
E && E.focus();
|
|
5990
5989
|
} else
|
|
5991
5990
|
g(), requestAnimationFrame(() => {
|
|
5992
|
-
const
|
|
5991
|
+
const j = A.querySelectorAll("tr"), E = j[j.length - 1];
|
|
5993
5992
|
if (E) {
|
|
5994
5993
|
const U = E.querySelector("input, select, textarea, [tabindex]");
|
|
5995
5994
|
U && U.focus();
|
|
@@ -6057,7 +6056,7 @@ function sl({
|
|
|
6057
6056
|
);
|
|
6058
6057
|
}),
|
|
6059
6058
|
/* @__PURE__ */ n("td", { className: "px-2 py-1 align-middle", children: h ? /* @__PURE__ */ n(
|
|
6060
|
-
|
|
6059
|
+
q,
|
|
6061
6060
|
{
|
|
6062
6061
|
variant: "ghost",
|
|
6063
6062
|
size: "icon",
|
|
@@ -6067,7 +6066,7 @@ function sl({
|
|
|
6067
6066
|
children: /* @__PURE__ */ n(An, { className: "h-4 w-4" })
|
|
6068
6067
|
}
|
|
6069
6068
|
) : /* @__PURE__ */ n(
|
|
6070
|
-
|
|
6069
|
+
q,
|
|
6071
6070
|
{
|
|
6072
6071
|
variant: "ghost",
|
|
6073
6072
|
size: "icon",
|
|
@@ -6084,7 +6083,7 @@ function sl({
|
|
|
6084
6083
|
}) })
|
|
6085
6084
|
] }) }),
|
|
6086
6085
|
/* @__PURE__ */ d(
|
|
6087
|
-
|
|
6086
|
+
q,
|
|
6088
6087
|
{
|
|
6089
6088
|
variant: "ghost",
|
|
6090
6089
|
size: "sm",
|
|
@@ -6133,8 +6132,8 @@ function il({
|
|
|
6133
6132
|
[s, i]
|
|
6134
6133
|
), x = z(() => {
|
|
6135
6134
|
var F;
|
|
6136
|
-
const _ = s.filter((M) => !M._deleted).reduce((M,
|
|
6137
|
-
const E = typeof
|
|
6135
|
+
const _ = s.filter((M) => !M._deleted).reduce((M, j) => {
|
|
6136
|
+
const E = typeof j[o] == "number" ? j[o] : -1;
|
|
6138
6137
|
return Math.max(M, E);
|
|
6139
6138
|
}, -1), T = {
|
|
6140
6139
|
_key: crypto.randomUUID(),
|
|
@@ -6142,8 +6141,8 @@ function il({
|
|
|
6142
6141
|
[o]: _ + 1
|
|
6143
6142
|
}, $ = ((F = e.quick_add) == null ? void 0 : F.defaults) ?? {};
|
|
6144
6143
|
for (const M of p) {
|
|
6145
|
-
const
|
|
6146
|
-
|
|
6144
|
+
const j = t.fields[M];
|
|
6145
|
+
j && ($[M] !== void 0 ? T[M] = $[M] : j.default !== void 0 ? T[M] = j.default : j.type === "bool" && (T[M] = !1));
|
|
6147
6146
|
}
|
|
6148
6147
|
i([...s, T]);
|
|
6149
6148
|
}, [s, i, p, t, (A = e.quick_add) == null ? void 0 : A.defaults, o]), N = z(
|
|
@@ -6166,16 +6165,16 @@ function il({
|
|
|
6166
6165
|
(_) => {
|
|
6167
6166
|
const { active: T, over: $ } = _;
|
|
6168
6167
|
if (!$ || T.id === $.id) return;
|
|
6169
|
-
const F = s.filter((
|
|
6170
|
-
if (
|
|
6171
|
-
const U = [...F], [B] = U.splice(
|
|
6168
|
+
const F = s.filter((G) => !G._deleted), M = s.filter((G) => G._deleted), j = F.findIndex((G) => G._key === String(T.id)), E = F.findIndex((G) => G._key === String($.id));
|
|
6169
|
+
if (j === -1 || E === -1) return;
|
|
6170
|
+
const U = [...F], [B] = U.splice(j, 1);
|
|
6172
6171
|
U.splice(E, 0, B);
|
|
6173
|
-
const
|
|
6174
|
-
...
|
|
6172
|
+
const te = U.map((G, R) => ({
|
|
6173
|
+
...G,
|
|
6175
6174
|
[o]: R,
|
|
6176
|
-
_dirty:
|
|
6175
|
+
_dirty: G[o] !== R ? !0 : G._dirty
|
|
6177
6176
|
}));
|
|
6178
|
-
i([...
|
|
6177
|
+
i([...te, ...M]);
|
|
6179
6178
|
},
|
|
6180
6179
|
[s, i, o]
|
|
6181
6180
|
), k = z(
|
|
@@ -6187,29 +6186,29 @@ function il({
|
|
|
6187
6186
|
if (!F) return;
|
|
6188
6187
|
const M = F.closest("tbody");
|
|
6189
6188
|
if (!M) return;
|
|
6190
|
-
const
|
|
6189
|
+
const j = Array.from(F.cells).indexOf($), E = Array.from(M.rows).indexOf(F);
|
|
6191
6190
|
if (_.key === "Tab") {
|
|
6192
|
-
const
|
|
6193
|
-
let R = E, C =
|
|
6194
|
-
for (; R >= 0 && R <
|
|
6195
|
-
if (C >= 0 && C <
|
|
6196
|
-
const V =
|
|
6191
|
+
const te = _.shiftKey ? -1 : 1, G = Array.from(M.rows);
|
|
6192
|
+
let R = E, C = j + te;
|
|
6193
|
+
for (; R >= 0 && R < G.length; )
|
|
6194
|
+
if (C >= 0 && C < G[R].cells.length) {
|
|
6195
|
+
const V = G[R].cells[C].querySelector("input, select, textarea, [tabindex]");
|
|
6197
6196
|
if (V) {
|
|
6198
6197
|
_.preventDefault(), V.focus();
|
|
6199
6198
|
return;
|
|
6200
6199
|
}
|
|
6201
|
-
C +=
|
|
6200
|
+
C += te;
|
|
6202
6201
|
} else
|
|
6203
|
-
R +=
|
|
6202
|
+
R += te, C = te > 0 ? 0 : (((U = G[R]) == null ? void 0 : U.cells.length) ?? 1) - 1;
|
|
6204
6203
|
} else if (_.key === "Enter") {
|
|
6205
6204
|
_.preventDefault();
|
|
6206
|
-
const
|
|
6207
|
-
if (E <
|
|
6208
|
-
const
|
|
6205
|
+
const te = Array.from(M.rows);
|
|
6206
|
+
if (E < te.length - 1) {
|
|
6207
|
+
const G = te[E + 1].cells[j], R = G == null ? void 0 : G.querySelector("input, select, textarea, [tabindex]");
|
|
6209
6208
|
R && R.focus();
|
|
6210
6209
|
} else
|
|
6211
6210
|
x(), requestAnimationFrame(() => {
|
|
6212
|
-
const
|
|
6211
|
+
const G = M.querySelectorAll("tr"), R = G[G.length - 1];
|
|
6213
6212
|
if (R) {
|
|
6214
6213
|
const C = R.querySelector("input, select, textarea, [tabindex]");
|
|
6215
6214
|
C && C.focus();
|
|
@@ -6262,7 +6261,7 @@ function il({
|
|
|
6262
6261
|
}
|
|
6263
6262
|
) }),
|
|
6264
6263
|
/* @__PURE__ */ d(
|
|
6265
|
-
|
|
6264
|
+
q,
|
|
6266
6265
|
{
|
|
6267
6266
|
variant: "ghost",
|
|
6268
6267
|
size: "sm",
|
|
@@ -6353,7 +6352,7 @@ function al({
|
|
|
6353
6352
|
);
|
|
6354
6353
|
}),
|
|
6355
6354
|
/* @__PURE__ */ n("td", { className: "px-2 py-1 align-middle", children: f ? /* @__PURE__ */ n(
|
|
6356
|
-
|
|
6355
|
+
q,
|
|
6357
6356
|
{
|
|
6358
6357
|
variant: "ghost",
|
|
6359
6358
|
size: "icon",
|
|
@@ -6363,7 +6362,7 @@ function al({
|
|
|
6363
6362
|
children: /* @__PURE__ */ n(An, { className: "h-4 w-4" })
|
|
6364
6363
|
}
|
|
6365
6364
|
) : /* @__PURE__ */ n(
|
|
6366
|
-
|
|
6365
|
+
q,
|
|
6367
6366
|
{
|
|
6368
6367
|
variant: "ghost",
|
|
6369
6368
|
size: "icon",
|
|
@@ -6511,7 +6510,7 @@ function cl({
|
|
|
6511
6510
|
"All ",
|
|
6512
6511
|
g
|
|
6513
6512
|
] }),
|
|
6514
|
-
m.values.map((b) => /* @__PURE__ */ n(Ue, { value: b.code, children:
|
|
6513
|
+
m.values.map((b) => /* @__PURE__ */ n(Ue, { value: b.code, children: D(b.name) }, b.code))
|
|
6515
6514
|
] })
|
|
6516
6515
|
]
|
|
6517
6516
|
},
|
|
@@ -6588,7 +6587,7 @@ function ul({ node: e, ctx: t }) {
|
|
|
6588
6587
|
const g = s.fields[p];
|
|
6589
6588
|
return !(!g || g.primary || ((y = g.display) == null ? void 0 : y.is_listable) === !1);
|
|
6590
6589
|
}
|
|
6591
|
-
), l = s.readonly ? !1 : e.editable !== !1, c =
|
|
6590
|
+
), l = s.readonly ? !1 : e.editable !== !1, c = D((f = s.display) == null ? void 0 : f.name_plural) || D((m = s.display) == null ? void 0 : m.name) || r, o = e.searchable === !0 || e.filters && e.filters.length > 0;
|
|
6592
6591
|
return /* @__PURE__ */ d("div", { children: [
|
|
6593
6592
|
/* @__PURE__ */ n("h3", { className: "text-sm font-medium text-[var(--muted-foreground)] mb-2", children: c }),
|
|
6594
6593
|
o ? /* @__PURE__ */ n(
|
|
@@ -6682,12 +6681,12 @@ function ml({
|
|
|
6682
6681
|
N.current && clearTimeout(N.current);
|
|
6683
6682
|
}), [p]);
|
|
6684
6683
|
const h = z((U, B) => {
|
|
6685
|
-
x((
|
|
6684
|
+
x((te) => {
|
|
6686
6685
|
if (B === "__all__") {
|
|
6687
|
-
const { [U]:
|
|
6686
|
+
const { [U]: G, ...R } = te;
|
|
6688
6687
|
return R;
|
|
6689
6688
|
}
|
|
6690
|
-
return { ...
|
|
6689
|
+
return { ...te, [U]: B };
|
|
6691
6690
|
});
|
|
6692
6691
|
}, []), v = ee(() => Object.keys(w).length > 0 ? w : void 0, [w]), {
|
|
6693
6692
|
data: k,
|
|
@@ -6706,17 +6705,17 @@ function ml({
|
|
|
6706
6705
|
// limit
|
|
6707
6706
|
y || void 0,
|
|
6708
6707
|
v
|
|
6709
|
-
), { rows: M, refs:
|
|
6708
|
+
), { rows: M, refs: j } = ee(() => {
|
|
6710
6709
|
if (!(k != null && k.pages)) return { rows: [], refs: void 0 };
|
|
6711
6710
|
const U = [];
|
|
6712
6711
|
let B;
|
|
6713
|
-
for (const
|
|
6714
|
-
if (U.push(...
|
|
6712
|
+
for (const te of k.pages)
|
|
6713
|
+
if (U.push(...te.data), te.$refs)
|
|
6715
6714
|
if (!B)
|
|
6716
|
-
B = { ...
|
|
6715
|
+
B = { ...te.$refs };
|
|
6717
6716
|
else
|
|
6718
|
-
for (const [
|
|
6719
|
-
B[
|
|
6717
|
+
for (const [G, R] of Object.entries(te.$refs))
|
|
6718
|
+
B[G] = { ...B[G], ...R };
|
|
6720
6719
|
return { rows: U, refs: B };
|
|
6721
6720
|
}, [k]), E = z(() => {
|
|
6722
6721
|
m.invalidateQueries({
|
|
@@ -6751,14 +6750,14 @@ function ml({
|
|
|
6751
6750
|
editable: l,
|
|
6752
6751
|
ctx: c,
|
|
6753
6752
|
rows: M,
|
|
6754
|
-
refs:
|
|
6753
|
+
refs: j,
|
|
6755
6754
|
isLoading: A,
|
|
6756
6755
|
isError: _,
|
|
6757
6756
|
invalidateQuery: E
|
|
6758
6757
|
}
|
|
6759
6758
|
),
|
|
6760
6759
|
T && /* @__PURE__ */ d(
|
|
6761
|
-
|
|
6760
|
+
q,
|
|
6762
6761
|
{
|
|
6763
6762
|
variant: "ghost",
|
|
6764
6763
|
size: "sm",
|
|
@@ -6802,7 +6801,7 @@ function ws({
|
|
|
6802
6801
|
for (const L of Object.values(C)) clearTimeout(L);
|
|
6803
6802
|
};
|
|
6804
6803
|
}, []);
|
|
6805
|
-
const [h, v] = I(null), [k, A] = I([]), [_, T] = I(!1), [$, F] = I(null), [M,
|
|
6804
|
+
const [h, v] = I(null), [k, A] = I([]), [_, T] = I(!1), [$, F] = I(null), [M, j] = I(/* @__PURE__ */ new Set()), E = z(
|
|
6806
6805
|
async (C, L, V) => {
|
|
6807
6806
|
w((Q) => ({
|
|
6808
6807
|
...Q,
|
|
@@ -6852,7 +6851,7 @@ function ws({
|
|
|
6852
6851
|
V && (V.default !== void 0 ? C[L] = V.default : V.type === "bool" && (C[L] = !1));
|
|
6853
6852
|
}
|
|
6854
6853
|
v(C), A([]);
|
|
6855
|
-
}, [s, r, i, t.fields]),
|
|
6854
|
+
}, [s, r, i, t.fields]), te = z(async () => {
|
|
6856
6855
|
if (!h) return;
|
|
6857
6856
|
const C = [];
|
|
6858
6857
|
for (const L of i) {
|
|
@@ -6874,14 +6873,14 @@ function ws({
|
|
|
6874
6873
|
} finally {
|
|
6875
6874
|
T(!1);
|
|
6876
6875
|
}
|
|
6877
|
-
}, [h, i, t.fields, s, e, m]),
|
|
6876
|
+
}, [h, i, t.fields, s, e, m]), G = z(
|
|
6878
6877
|
async (C) => {
|
|
6879
|
-
F(null),
|
|
6878
|
+
F(null), j((L) => new Set(L).add(C));
|
|
6880
6879
|
try {
|
|
6881
6880
|
await Kr(e, C), m();
|
|
6882
6881
|
} catch {
|
|
6883
6882
|
} finally {
|
|
6884
|
-
|
|
6883
|
+
j((L) => {
|
|
6885
6884
|
const V = new Set(L);
|
|
6886
6885
|
return V.delete(C), V;
|
|
6887
6886
|
});
|
|
@@ -6952,7 +6951,7 @@ function ws({
|
|
|
6952
6951
|
draftErrors: k,
|
|
6953
6952
|
draftSaving: _,
|
|
6954
6953
|
onChange: (C, L) => v((V) => V && { ...V, [C]: L }),
|
|
6955
|
-
onConfirm:
|
|
6954
|
+
onConfirm: te,
|
|
6956
6955
|
onCancel: () => {
|
|
6957
6956
|
v(null), A([]);
|
|
6958
6957
|
},
|
|
@@ -6962,7 +6961,7 @@ function ws({
|
|
|
6962
6961
|
] })
|
|
6963
6962
|
] }) }),
|
|
6964
6963
|
a && /* @__PURE__ */ d(
|
|
6965
|
-
|
|
6964
|
+
q,
|
|
6966
6965
|
{
|
|
6967
6966
|
variant: "ghost",
|
|
6968
6967
|
size: "sm",
|
|
@@ -6983,7 +6982,7 @@ function ws({
|
|
|
6983
6982
|
title: "Delete record",
|
|
6984
6983
|
description: $.label ? `Are you sure you want to delete "${$.label}"?` : "Are you sure you want to delete this record?",
|
|
6985
6984
|
confirmLabel: "Delete",
|
|
6986
|
-
onConfirm: () =>
|
|
6985
|
+
onConfirm: () => G($.rowId),
|
|
6987
6986
|
destructive: !0
|
|
6988
6987
|
}
|
|
6989
6988
|
)
|
|
@@ -7048,7 +7047,7 @@ function pl({
|
|
|
7048
7047
|
(u == null ? void 0 : u.saving) && /* @__PURE__ */ n(sr, { className: "h-3 w-3 animate-spin text-[var(--muted-foreground)]" }),
|
|
7049
7048
|
(u == null ? void 0 : u.error) && /* @__PURE__ */ n("span", { className: "text-xs text-[var(--destructive)]", title: u.error, children: "!" }),
|
|
7050
7049
|
/* @__PURE__ */ n(
|
|
7051
|
-
|
|
7050
|
+
q,
|
|
7052
7051
|
{
|
|
7053
7052
|
variant: "ghost",
|
|
7054
7053
|
size: "icon",
|
|
@@ -7102,7 +7101,7 @@ function hl({
|
|
|
7102
7101
|
/* @__PURE__ */ n("td", { className: "px-2 py-1 align-middle", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-1", children: [
|
|
7103
7102
|
m && /* @__PURE__ */ n("span", { className: "text-xs text-[var(--destructive)]", title: m.slice(7), children: "!" }),
|
|
7104
7103
|
/* @__PURE__ */ n(
|
|
7105
|
-
|
|
7104
|
+
q,
|
|
7106
7105
|
{
|
|
7107
7106
|
variant: "ghost",
|
|
7108
7107
|
size: "icon",
|
|
@@ -7114,7 +7113,7 @@ function hl({
|
|
|
7114
7113
|
}
|
|
7115
7114
|
),
|
|
7116
7115
|
/* @__PURE__ */ n(
|
|
7117
|
-
|
|
7116
|
+
q,
|
|
7118
7117
|
{
|
|
7119
7118
|
variant: "ghost",
|
|
7120
7119
|
size: "icon",
|
|
@@ -7218,7 +7217,7 @@ function bl({
|
|
|
7218
7217
|
[e, t.type, a]
|
|
7219
7218
|
);
|
|
7220
7219
|
return /* @__PURE__ */ d("div", { className: "flex flex-col md:flex-row gap-1", children: [
|
|
7221
|
-
/* @__PURE__ */ n("div", { className: "md:w-40 md:pt-0.5 text-sm text-[var(--muted-foreground)]", children:
|
|
7220
|
+
/* @__PURE__ */ n("div", { className: "md:w-40 md:pt-0.5 text-sm text-[var(--muted-foreground)]", children: D(((u = t.display) == null ? void 0 : u.name) ?? t.name) }),
|
|
7222
7221
|
/* @__PURE__ */ n("div", { className: "flex-1 min-w-0", children: oe({
|
|
7223
7222
|
field: r,
|
|
7224
7223
|
fieldName: e,
|
|
@@ -7241,18 +7240,18 @@ function _s({
|
|
|
7241
7240
|
if (i === "display")
|
|
7242
7241
|
return /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
7243
7242
|
/* @__PURE__ */ d("span", { className: "text-sm text-[var(--muted-foreground)]", children: [
|
|
7244
|
-
|
|
7243
|
+
D(l.name),
|
|
7245
7244
|
":"
|
|
7246
7245
|
] }),
|
|
7247
7246
|
u ? /* @__PURE__ */ n(
|
|
7248
|
-
|
|
7247
|
+
Ce,
|
|
7249
7248
|
{
|
|
7250
7249
|
className: "text-xs",
|
|
7251
7250
|
style: {
|
|
7252
7251
|
backgroundColor: u.color || void 0,
|
|
7253
7252
|
color: u.color ? "#fff" : void 0
|
|
7254
7253
|
},
|
|
7255
|
-
children:
|
|
7254
|
+
children: D(u.name)
|
|
7256
7255
|
}
|
|
7257
7256
|
) : /* @__PURE__ */ n("span", { className: "text-sm text-[var(--muted-foreground)]", children: "-" })
|
|
7258
7257
|
] }, a);
|
|
@@ -7264,7 +7263,7 @@ function _s({
|
|
|
7264
7263
|
) : l.statuses;
|
|
7265
7264
|
return /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
7266
7265
|
/* @__PURE__ */ d("span", { className: "text-sm text-[var(--muted-foreground)]", children: [
|
|
7267
|
-
|
|
7266
|
+
D(l.name),
|
|
7268
7267
|
":"
|
|
7269
7268
|
] }),
|
|
7270
7269
|
/* @__PURE__ */ d(
|
|
@@ -7275,14 +7274,14 @@ function _s({
|
|
|
7275
7274
|
disabled: s,
|
|
7276
7275
|
children: [
|
|
7277
7276
|
/* @__PURE__ */ n(at, { className: "w-[180px]", children: /* @__PURE__ */ n(vt, { children: u ? /* @__PURE__ */ n(
|
|
7278
|
-
|
|
7277
|
+
Ce,
|
|
7279
7278
|
{
|
|
7280
7279
|
className: "text-xs",
|
|
7281
7280
|
style: {
|
|
7282
7281
|
backgroundColor: u.color || void 0,
|
|
7283
7282
|
color: u.color ? "#fff" : void 0
|
|
7284
7283
|
},
|
|
7285
|
-
children:
|
|
7284
|
+
children: D(u.name)
|
|
7286
7285
|
}
|
|
7287
7286
|
) : "Select..." }) }),
|
|
7288
7287
|
/* @__PURE__ */ n(ot, { children: f.map((m) => /* @__PURE__ */ n(Ue, { value: m.code, children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
@@ -7293,7 +7292,7 @@ function _s({
|
|
|
7293
7292
|
style: { backgroundColor: m.color }
|
|
7294
7293
|
}
|
|
7295
7294
|
),
|
|
7296
|
-
|
|
7295
|
+
D(m.name)
|
|
7297
7296
|
] }) }, m.code)) })
|
|
7298
7297
|
]
|
|
7299
7298
|
}
|
|
@@ -7370,10 +7369,10 @@ function kl(e, t) {
|
|
|
7370
7369
|
}
|
|
7371
7370
|
function Cl({ screenCode: e }) {
|
|
7372
7371
|
var we, de, ge, Me, Ae, He, nt;
|
|
7373
|
-
const { id: t } = Ls(), r = Xe(), [s, i] = yt(), { data: a } =
|
|
7372
|
+
const { id: t } = Ls(), r = Xe(), [s, i] = yt(), { data: a } = je(), 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(() => {
|
|
7374
7373
|
if (!m || p) return;
|
|
7375
7374
|
if (!o) return m;
|
|
7376
|
-
const O =
|
|
7375
|
+
const O = jr(o);
|
|
7377
7376
|
if (O.length === 1)
|
|
7378
7377
|
return { [O[0]]: m };
|
|
7379
7378
|
const W = m.split("|"), K = {};
|
|
@@ -7383,10 +7382,10 @@ function Cl({ screenCode: e }) {
|
|
|
7383
7382
|
}, [m, p, o]), y = ee(() => {
|
|
7384
7383
|
if (g)
|
|
7385
7384
|
return typeof g == "string" ? g : ln(g);
|
|
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 || $), [
|
|
7385
|
+
}, [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 || $), [j, E] = I({}), [U, B] = I({}), [te, G] = I({}), [R, C] = I(void 0), [L, V] = I(void 0), [Q, Z] = I({ show: !1 }), [fe, Te] = I(() => {
|
|
7387
7386
|
const O = parseInt((c == null ? void 0 : c.sidebar_width) || "380", 10);
|
|
7388
7387
|
return isNaN(O) ? 380 : O;
|
|
7389
|
-
}), Ne = me(null), be = me(null),
|
|
7388
|
+
}), Ne = me(null), be = me(null), qe = z(
|
|
7390
7389
|
(O) => {
|
|
7391
7390
|
O.preventDefault();
|
|
7392
7391
|
const W = Ne.current;
|
|
@@ -7407,7 +7406,7 @@ function Cl({ screenCode: e }) {
|
|
|
7407
7406
|
le(() => {
|
|
7408
7407
|
var ce, Re;
|
|
7409
7408
|
if (!o || f) return;
|
|
7410
|
-
const O = Se.pathname, W =
|
|
7409
|
+
const O = Se.pathname, W = D((ce = c == null ? void 0 : c.display) == null ? void 0 : ce.name) || D(o.display.name), K = ((Re = c == null ? void 0 : c.display) == null ? void 0 : Re.icon) || o.display.icon;
|
|
7411
7410
|
At(O) || ut({
|
|
7412
7411
|
pathname: O,
|
|
7413
7412
|
search: "",
|
|
@@ -7420,7 +7419,7 @@ function Cl({ screenCode: e }) {
|
|
|
7420
7419
|
if (!X || !o || f) return;
|
|
7421
7420
|
const O = At(Se.pathname);
|
|
7422
7421
|
if (O) {
|
|
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) ?
|
|
7422
|
+
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) ? D(ce) : ce, kt = Re ? String(Re) : D((K = c == null ? void 0 : c.display) == null ? void 0 : K.name) || D(o.display.name);
|
|
7424
7423
|
wt(O.id, kt);
|
|
7425
7424
|
}
|
|
7426
7425
|
}, [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]);
|
|
@@ -7433,7 +7432,7 @@ function Cl({ screenCode: e }) {
|
|
|
7433
7432
|
}, [o]);
|
|
7434
7433
|
le(() => {
|
|
7435
7434
|
if (!(!$ || !X || et.size === 0)) {
|
|
7436
|
-
if (F || M(!0), Object.keys(
|
|
7435
|
+
if (F || M(!0), Object.keys(j).length === 0) {
|
|
7437
7436
|
const O = {};
|
|
7438
7437
|
et.forEach((W) => {
|
|
7439
7438
|
O[W] = X[W] ?? "";
|
|
@@ -7471,7 +7470,7 @@ function Cl({ screenCode: e }) {
|
|
|
7471
7470
|
const W = ((O = c == null ? void 0 : c.route) == null ? void 0 : O.replace("/:id", "")) ?? "/";
|
|
7472
7471
|
r(W);
|
|
7473
7472
|
} else
|
|
7474
|
-
M(!1), E({}), B({}),
|
|
7473
|
+
M(!1), E({}), B({}), G({}), C(void 0), V(void 0);
|
|
7475
7474
|
}, [p, c, r]), or = z((O, W) => {
|
|
7476
7475
|
E((K) => ({ ...K, [O]: W }));
|
|
7477
7476
|
}, []), Pe = ee(() => {
|
|
@@ -7482,16 +7481,16 @@ function Cl({ screenCode: e }) {
|
|
|
7482
7481
|
if (!u) return;
|
|
7483
7482
|
const O = {};
|
|
7484
7483
|
if (p)
|
|
7485
|
-
for (const [K, se] of Object.entries(
|
|
7484
|
+
for (const [K, se] of Object.entries(j))
|
|
7486
7485
|
se !== "" && se !== null && se !== void 0 && (O[K] = se);
|
|
7487
7486
|
else
|
|
7488
|
-
for (const [K, se] of Object.entries(
|
|
7487
|
+
for (const [K, se] of Object.entries(j)) {
|
|
7489
7488
|
const ce = X == null ? void 0 : X[K];
|
|
7490
7489
|
(se === "" ? null : se) !== (ce === "" || ce === void 0 ? null : ce) && (O[K] = se);
|
|
7491
7490
|
}
|
|
7492
7491
|
if (Object.keys(U).length > 0 && (O.$statuses = Object.entries(U).map(
|
|
7493
7492
|
([K, se]) => ({ status_group_code: K, status_code: se })
|
|
7494
|
-
)), Object.keys(
|
|
7493
|
+
)), Object.keys(te).length > 0 && (O.$properties = Object.entries(te).map(
|
|
7495
7494
|
([K, se]) => ({ property_code: K, value: se })
|
|
7496
7495
|
)), R) {
|
|
7497
7496
|
const K = {};
|
|
@@ -7505,11 +7504,11 @@ function Cl({ screenCode: e }) {
|
|
|
7505
7504
|
Object.keys(K).length > 0 && (O.$children = K);
|
|
7506
7505
|
}
|
|
7507
7506
|
if (!p && Object.keys(O).length === 0) {
|
|
7508
|
-
M(!1), B({}),
|
|
7507
|
+
M(!1), B({}), G({}), C(void 0), V(void 0);
|
|
7509
7508
|
return;
|
|
7510
7509
|
}
|
|
7511
7510
|
const W = () => {
|
|
7512
|
-
M(!1), B({}),
|
|
7511
|
+
M(!1), B({}), G({}), C(void 0), V(void 0);
|
|
7513
7512
|
};
|
|
7514
7513
|
p ? x.mutate(O, {
|
|
7515
7514
|
onSuccess: (K) => {
|
|
@@ -7520,7 +7519,7 @@ function Cl({ screenCode: e }) {
|
|
|
7520
7519
|
{ pkValues: g, data: O },
|
|
7521
7520
|
{ onSuccess: W }
|
|
7522
7521
|
);
|
|
7523
|
-
}, [p, m, u,
|
|
7522
|
+
}, [p, m, u, j, U, te, R, L, x, N, o, r, Pe, X]), cr = z((O, W) => {
|
|
7524
7523
|
C((K) => ({ ...K ?? {}, [O]: W }));
|
|
7525
7524
|
}, []), $e = z(() => {
|
|
7526
7525
|
!g || p || h.mutate(g, {
|
|
@@ -7539,27 +7538,27 @@ function Cl({ screenCode: e }) {
|
|
|
7539
7538
|
/* @__PURE__ */ n(Bt, { title: "Not Found", backTo: Dt ? Pe : void 0 }),
|
|
7540
7539
|
/* @__PURE__ */ n("p", { className: "text-[var(--muted-foreground)]", children: "Record not found." })
|
|
7541
7540
|
] });
|
|
7542
|
-
const Wt = o.display, tt =
|
|
7541
|
+
const Wt = o.display, tt = D((He = c.display) == null ? void 0 : He.name) || D(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) ? D(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"), P = {
|
|
7543
7542
|
schema: a,
|
|
7544
7543
|
entity: o,
|
|
7545
7544
|
entityCode: u,
|
|
7546
7545
|
recordId: y ?? m ?? "",
|
|
7547
|
-
record: F ? { ...X ?? {}, ...
|
|
7546
|
+
record: F ? { ...X ?? {}, ...j } : X ?? {},
|
|
7548
7547
|
isNew: p,
|
|
7549
7548
|
mode: F ? "edit" : "display",
|
|
7550
7549
|
onFieldChange: F ? or : void 0,
|
|
7551
7550
|
refs: dt,
|
|
7552
7551
|
objectProperties: (() => {
|
|
7553
7552
|
const O = T ?? [];
|
|
7554
|
-
if (!F || Object.keys(
|
|
7553
|
+
if (!F || Object.keys(te).length === 0) return O.length > 0 ? O : void 0;
|
|
7555
7554
|
const W = O.map(
|
|
7556
|
-
(K) =>
|
|
7555
|
+
(K) => te[K.property_code] !== void 0 ? { ...K, value: te[K.property_code] } : K
|
|
7557
7556
|
);
|
|
7558
|
-
for (const [K, se] of Object.entries(
|
|
7557
|
+
for (const [K, se] of Object.entries(te))
|
|
7559
7558
|
O.some((ce) => ce.property_code === K) || W.push({ property_code: K, name: {}, type: "string", value: se });
|
|
7560
7559
|
return W;
|
|
7561
7560
|
})(),
|
|
7562
|
-
onSetProperty: p || o != null && o.readonly ? void 0 : F ? (O, W) =>
|
|
7561
|
+
onSetProperty: p || o != null && o.readonly ? void 0 : F ? (O, W) => G((K) => ({ ...K, [O]: W })) : void 0,
|
|
7563
7562
|
isPropertyPending: !1,
|
|
7564
7563
|
// In edit mode, merge pending status changes into displayed statuses and
|
|
7565
7564
|
// store changes locally (saved atomically on Save, discarded on Cancel).
|
|
@@ -7579,21 +7578,21 @@ function Cl({ screenCode: e }) {
|
|
|
7579
7578
|
pendingChildren: F ? R : void 0,
|
|
7580
7579
|
onChildrenChange: F ? cr : void 0,
|
|
7581
7580
|
childValidationErrors: F ? ft : void 0
|
|
7582
|
-
}, H = c.sidebar && c.sidebar.length > 0,
|
|
7581
|
+
}, H = c.sidebar && c.sidebar.length > 0, re = /* @__PURE__ */ n(
|
|
7583
7582
|
Bt,
|
|
7584
7583
|
{
|
|
7585
7584
|
title: Ht,
|
|
7586
7585
|
backTo: f || !Dt ? void 0 : Pe,
|
|
7587
|
-
actions: Ye ? /* @__PURE__ */ d(
|
|
7586
|
+
actions: Ye ? /* @__PURE__ */ d(q, { onClick: Pt, disabled: v.isPending, children: [
|
|
7588
7587
|
/* @__PURE__ */ n(Tn, { className: "w-4 h-4" }),
|
|
7589
7588
|
v.isPending ? "Restoring..." : "Restore"
|
|
7590
7589
|
] }) : F ? /* @__PURE__ */ d(pe, { children: [
|
|
7591
|
-
/* @__PURE__ */ d(
|
|
7590
|
+
/* @__PURE__ */ d(q, { variant: "outline", onClick: ar, disabled: _t, children: [
|
|
7592
7591
|
/* @__PURE__ */ n(ze, { className: "w-4 h-4" }),
|
|
7593
7592
|
"Cancel"
|
|
7594
7593
|
] }),
|
|
7595
7594
|
/* @__PURE__ */ d(
|
|
7596
|
-
|
|
7595
|
+
q,
|
|
7597
7596
|
{
|
|
7598
7597
|
onClick: lr,
|
|
7599
7598
|
disabled: _t || $t,
|
|
@@ -7609,20 +7608,20 @@ function Cl({ screenCode: e }) {
|
|
|
7609
7608
|
var K, se;
|
|
7610
7609
|
if (W.type === "edit") {
|
|
7611
7610
|
const ce = X ? pt(W.conditions, X) : !0;
|
|
7612
|
-
return /* @__PURE__ */ n(
|
|
7611
|
+
return /* @__PURE__ */ n(q, { variant: "outline", onClick: We, disabled: !ce, children: D((K = W.display) == null ? void 0 : K.name) || "Edit" }, O);
|
|
7613
7612
|
}
|
|
7614
7613
|
if (W.type === "delete" && !f) {
|
|
7615
7614
|
const ce = X ? pt(W.conditions, X) : !0;
|
|
7616
7615
|
return /* @__PURE__ */ d(
|
|
7617
|
-
|
|
7616
|
+
q,
|
|
7618
7617
|
{
|
|
7619
7618
|
variant: "outline",
|
|
7620
|
-
onClick: () => Z({ show: !0, confirmation:
|
|
7619
|
+
onClick: () => Z({ show: !0, confirmation: D(W.confirmation) || void 0 }),
|
|
7621
7620
|
disabled: !ce,
|
|
7622
7621
|
className: "text-[var(--destructive)] hover:text-[var(--destructive)]",
|
|
7623
7622
|
children: [
|
|
7624
7623
|
/* @__PURE__ */ n(Je, { className: "w-4 h-4" }),
|
|
7625
|
-
|
|
7624
|
+
D((se = W.display) == null ? void 0 : se.name) || "Delete"
|
|
7626
7625
|
]
|
|
7627
7626
|
},
|
|
7628
7627
|
O
|
|
@@ -7634,16 +7633,16 @@ function Cl({ screenCode: e }) {
|
|
|
7634
7633
|
actionCode: O,
|
|
7635
7634
|
action: W,
|
|
7636
7635
|
entityCode: u,
|
|
7637
|
-
objectIds:
|
|
7636
|
+
objectIds: [m],
|
|
7638
7637
|
row: X,
|
|
7639
7638
|
variant: "outline"
|
|
7640
7639
|
},
|
|
7641
7640
|
O
|
|
7642
7641
|
);
|
|
7643
7642
|
}),
|
|
7644
|
-
!St && !(o != null && o.readonly) && /* @__PURE__ */ n(
|
|
7643
|
+
!St && !(o != null && o.readonly) && /* @__PURE__ */ n(q, { variant: "outline", onClick: We, children: "Edit" }),
|
|
7645
7644
|
!St && !p && !f && !(o != null && o.readonly) && /* @__PURE__ */ d(
|
|
7646
|
-
|
|
7645
|
+
q,
|
|
7647
7646
|
{
|
|
7648
7647
|
variant: "outline",
|
|
7649
7648
|
onClick: () => Z({ show: !0 }),
|
|
@@ -7656,24 +7655,24 @@ function Cl({ screenCode: e }) {
|
|
|
7656
7655
|
)
|
|
7657
7656
|
] })
|
|
7658
7657
|
}
|
|
7659
|
-
),
|
|
7658
|
+
), ne = Ye && /* @__PURE__ */ d("div", { className: "flex items-center gap-2 px-4 py-3 mb-4 rounded-md border border-[var(--destructive)]/30 bg-[var(--destructive)]/10 text-sm text-[var(--destructive)]", children: [
|
|
7660
7659
|
/* @__PURE__ */ n(kn, { className: "w-4 h-4 shrink-0" }),
|
|
7661
7660
|
/* @__PURE__ */ d("span", { children: [
|
|
7662
7661
|
"This record was deleted on",
|
|
7663
7662
|
" ",
|
|
7664
7663
|
Nr(String(X[o.soft_delete]))
|
|
7665
7664
|
] })
|
|
7666
|
-
] }),
|
|
7665
|
+
] }), Y = k && !p && !(c.items && c.items.length > 0) && /* @__PURE__ */ n("div", { className: "mb-4", children: /* @__PURE__ */ n(
|
|
7667
7666
|
_s,
|
|
7668
7667
|
{
|
|
7669
7668
|
statusGroups: o.status_groups ?? {},
|
|
7670
|
-
objectStatuses:
|
|
7669
|
+
objectStatuses: P.objectStatuses,
|
|
7671
7670
|
onSetStatus: o != null && o.readonly ? Nn : F ? (O, W) => B((K) => ({ ...K, [O]: W })) : Nn,
|
|
7672
7671
|
isPending: !1,
|
|
7673
7672
|
mode: F && !(o != null && o.readonly) ? "edit" : "display"
|
|
7674
7673
|
}
|
|
7675
7674
|
) }), xe = /* @__PURE__ */ d(pe, { children: [
|
|
7676
|
-
c.items && c.items.length > 0 && (X || p) && a && /* @__PURE__ */ n(rr, { nodes: c.items, ctx:
|
|
7675
|
+
c.items && c.items.length > 0 && (X || p) && a && /* @__PURE__ */ n(rr, { nodes: c.items, ctx: P }),
|
|
7677
7676
|
!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
7677
|
!p && X && /* @__PURE__ */ d("div", { className: "flex gap-6 px-1 py-2 text-xs text-[var(--muted-foreground)]", children: [
|
|
7679
7678
|
X.created_at != null && /* @__PURE__ */ d("span", { children: [
|
|
@@ -7685,7 +7684,7 @@ function Cl({ screenCode: e }) {
|
|
|
7685
7684
|
Nr(String(X.updated_at))
|
|
7686
7685
|
] })
|
|
7687
7686
|
] })
|
|
7688
|
-
] }),
|
|
7687
|
+
] }), ke = /* @__PURE__ */ n(
|
|
7689
7688
|
Zr,
|
|
7690
7689
|
{
|
|
7691
7690
|
open: Q.show,
|
|
@@ -7700,9 +7699,9 @@ function Cl({ screenCode: e }) {
|
|
|
7700
7699
|
return H ? /* @__PURE__ */ d("div", { className: "h-full flex overflow-hidden", children: [
|
|
7701
7700
|
/* @__PURE__ */ d("div", { className: "flex-1 min-w-0 flex flex-col h-full", children: [
|
|
7702
7701
|
/* @__PURE__ */ d("div", { className: "shrink-0 px-6 pt-6 pb-2", children: [
|
|
7702
|
+
re,
|
|
7703
7703
|
ne,
|
|
7704
|
-
|
|
7705
|
-
G
|
|
7704
|
+
Y
|
|
7706
7705
|
] }),
|
|
7707
7706
|
/* @__PURE__ */ n("div", { className: "flex-1 min-h-0 overflow-y-auto px-6 pb-6 space-y-4", children: xe })
|
|
7708
7707
|
] }),
|
|
@@ -7710,19 +7709,19 @@ function Cl({ screenCode: e }) {
|
|
|
7710
7709
|
"div",
|
|
7711
7710
|
{
|
|
7712
7711
|
className: "shrink-0 w-1 cursor-col-resize hover:bg-[var(--primary)]/20 active:bg-[var(--primary)]/30 transition-colors",
|
|
7713
|
-
onMouseDown:
|
|
7712
|
+
onMouseDown: qe
|
|
7714
7713
|
}
|
|
7715
7714
|
),
|
|
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:
|
|
7717
|
-
|
|
7715
|
+
/* @__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: P }) }),
|
|
7716
|
+
ke
|
|
7718
7717
|
] }) : /* @__PURE__ */ d("div", { className: "h-full flex flex-col overflow-hidden", children: [
|
|
7719
7718
|
/* @__PURE__ */ d("div", { className: "shrink-0 px-6 pt-6 pb-2", children: [
|
|
7719
|
+
re,
|
|
7720
7720
|
ne,
|
|
7721
|
-
|
|
7722
|
-
G
|
|
7721
|
+
Y
|
|
7723
7722
|
] }),
|
|
7724
7723
|
/* @__PURE__ */ n("div", { className: "flex-1 min-h-0 overflow-y-auto px-6 pb-6 space-y-4", children: xe }),
|
|
7725
|
-
|
|
7724
|
+
ke
|
|
7726
7725
|
] });
|
|
7727
7726
|
}
|
|
7728
7727
|
async function Tl(e, t, r, s, i) {
|
|
@@ -7802,12 +7801,12 @@ function bc(e, t) {
|
|
|
7802
7801
|
});
|
|
7803
7802
|
}
|
|
7804
7803
|
function Rl({ screenCode: e }) {
|
|
7805
|
-
var B,
|
|
7806
|
-
const [t, r] = yt(), { data: s } =
|
|
7804
|
+
var B, te, G;
|
|
7805
|
+
const [t, r] = yt(), { data: s } = je(), 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();
|
|
7807
7806
|
le(() => {
|
|
7808
7807
|
var R, C;
|
|
7809
7808
|
if (i != null && i.route && a) {
|
|
7810
|
-
const L =
|
|
7809
|
+
const L = D((R = i.display) == null ? void 0 : R.name) || D(a.display.name_plural), V = ((C = i.display) == null ? void 0 : C.icon) || a.display.icon;
|
|
7811
7810
|
c({
|
|
7812
7811
|
pathname: i.route,
|
|
7813
7812
|
search: t.toString(),
|
|
@@ -7816,7 +7815,7 @@ function Rl({ screenCode: e }) {
|
|
|
7816
7815
|
closable: !0
|
|
7817
7816
|
});
|
|
7818
7817
|
}
|
|
7819
|
-
}, [i == null ? void 0 : i.route, (
|
|
7818
|
+
}, [i == null ? void 0 : i.route, (te = (B = i == null ? void 0 : i.display) == null ? void 0 : B.name) == null ? void 0 : te.en, (G = a == null ? void 0 : a.display.name_plural) == null ? void 0 : G.en]);
|
|
7820
7819
|
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(() => {
|
|
7821
7820
|
const R = t.get("filters");
|
|
7822
7821
|
if (R)
|
|
@@ -7890,12 +7889,12 @@ function Rl({ screenCode: e }) {
|
|
|
7890
7889
|
var R;
|
|
7891
7890
|
(R = M.current) == null || R.call(M);
|
|
7892
7891
|
}, []);
|
|
7893
|
-
const
|
|
7892
|
+
const j = z((R) => {
|
|
7894
7893
|
R.preventDefault(), $.current = !0;
|
|
7895
7894
|
const C = R.clientX, L = _ ?? 320, V = (Z) => {
|
|
7896
|
-
var
|
|
7895
|
+
var qe;
|
|
7897
7896
|
if (!$.current) return;
|
|
7898
|
-
const fe = ((
|
|
7897
|
+
const fe = ((qe = A.current) == null ? void 0 : qe.getBoundingClientRect().width) ?? window.innerWidth, Te = 200, Ne = fe - 300, be = Math.max(Te, Math.min(Ne, L + Z.clientX - C));
|
|
7899
7898
|
T(be);
|
|
7900
7899
|
}, Q = () => {
|
|
7901
7900
|
$.current = !1, document.removeEventListener("mousemove", V), document.removeEventListener("mouseup", Q), document.body.style.cursor = "", document.body.style.userSelect = "", M.current = null;
|
|
@@ -7923,7 +7922,7 @@ function Rl({ screenCode: e }) {
|
|
|
7923
7922
|
he,
|
|
7924
7923
|
{
|
|
7925
7924
|
className: "pl-8 h-9 text-sm",
|
|
7926
|
-
placeholder: `Search ${
|
|
7925
|
+
placeholder: `Search ${D(a.display.name_plural)}...`,
|
|
7927
7926
|
value: u,
|
|
7928
7927
|
onChange: (R) => h(R.target.value)
|
|
7929
7928
|
}
|
|
@@ -7952,7 +7951,7 @@ function Rl({ screenCode: e }) {
|
|
|
7952
7951
|
"All ",
|
|
7953
7952
|
De(C, R, s.entities)
|
|
7954
7953
|
] }),
|
|
7955
|
-
C.values.map((Q) => /* @__PURE__ */ n(Ue, { value: Q.code, children:
|
|
7954
|
+
C.values.map((Q) => /* @__PURE__ */ n(Ue, { value: Q.code, children: D(Q.name) }, Q.code))
|
|
7956
7955
|
] })
|
|
7957
7956
|
]
|
|
7958
7957
|
},
|
|
@@ -7960,7 +7959,7 @@ function Rl({ screenCode: e }) {
|
|
|
7960
7959
|
);
|
|
7961
7960
|
}) }),
|
|
7962
7961
|
/* @__PURE__ */ d("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
|
|
7963
|
-
/* @__PURE__ */ n("span", { children: y ? "Loading..." : `${b.length} ${
|
|
7962
|
+
/* @__PURE__ */ n("span", { children: y ? "Loading..." : `${b.length} ${D(a.display.name_plural)}` }),
|
|
7964
7963
|
U > 0 && /* @__PURE__ */ n(
|
|
7965
7964
|
"button",
|
|
7966
7965
|
{
|
|
@@ -7997,7 +7996,7 @@ function Rl({ screenCode: e }) {
|
|
|
7997
7996
|
"div",
|
|
7998
7997
|
{
|
|
7999
7998
|
className: "flex-none w-1 cursor-col-resize hover:bg-[var(--border)] active:bg-[var(--border)] transition-colors",
|
|
8000
|
-
onMouseDown:
|
|
7999
|
+
onMouseDown: j
|
|
8001
8000
|
}
|
|
8002
8001
|
),
|
|
8003
8002
|
/* @__PURE__ */ n("div", { className: "flex-1 min-w-0 overflow-hidden", children: o ? /* @__PURE__ */ n(
|
|
@@ -8012,7 +8011,7 @@ function Rl({ screenCode: e }) {
|
|
|
8012
8011
|
o
|
|
8013
8012
|
) : /* @__PURE__ */ n("div", { className: "flex items-center justify-center h-full text-muted-foreground", children: /* @__PURE__ */ d("p", { className: "text-sm", children: [
|
|
8014
8013
|
"Select a ",
|
|
8015
|
-
|
|
8014
|
+
D(a.display.name),
|
|
8016
8015
|
" to view details"
|
|
8017
8016
|
] }) }) })
|
|
8018
8017
|
] });
|
|
@@ -8077,16 +8076,16 @@ function Ol({
|
|
|
8077
8076
|
}) {
|
|
8078
8077
|
var M;
|
|
8079
8078
|
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(() => {
|
|
8080
|
-
const
|
|
8079
|
+
const j = /* @__PURE__ */ new Set();
|
|
8081
8080
|
for (const [E, U] of Object.entries(i.fields))
|
|
8082
|
-
!U.auto && !U.primary &&
|
|
8083
|
-
return
|
|
8081
|
+
!U.auto && !U.primary && j.add(E);
|
|
8082
|
+
return j;
|
|
8084
8083
|
}, [i]), N = z(() => {
|
|
8085
8084
|
if (p) {
|
|
8086
|
-
const
|
|
8085
|
+
const j = {};
|
|
8087
8086
|
x.forEach((E) => {
|
|
8088
|
-
|
|
8089
|
-
}), m(
|
|
8087
|
+
j[E] = p[E] ?? "";
|
|
8088
|
+
}), m(j);
|
|
8090
8089
|
}
|
|
8091
8090
|
u(!0);
|
|
8092
8091
|
}, [p, x]), h = z(() => {
|
|
@@ -8101,12 +8100,12 @@ function Ol({
|
|
|
8101
8100
|
onError: () => ie.error("Failed to save")
|
|
8102
8101
|
}
|
|
8103
8102
|
);
|
|
8104
|
-
}, [c, t, f]), k = z((
|
|
8105
|
-
m((U) => ({ ...U, [
|
|
8103
|
+
}, [c, t, f]), k = z((j, E) => {
|
|
8104
|
+
m((U) => ({ ...U, [j]: E }));
|
|
8106
8105
|
}, []);
|
|
8107
8106
|
if (l) return /* @__PURE__ */ n(es, {});
|
|
8108
8107
|
if (!p) return null;
|
|
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(_) :
|
|
8108
|
+
const A = (M = i.display) == null ? void 0 : M.display_field, _ = A ? p[A] : p[i.field_order[0]], T = _ != null && typeof _ != "object" ? String(_) : D(i.display.name), $ = p == null ? void 0 : p.$refs, F = {
|
|
8110
8109
|
schema: s,
|
|
8111
8110
|
entity: i,
|
|
8112
8111
|
entityCode: e,
|
|
@@ -8117,10 +8116,10 @@ function Ol({
|
|
|
8117
8116
|
onFieldChange: o ? k : void 0,
|
|
8118
8117
|
refs: $,
|
|
8119
8118
|
objectProperties: y ?? void 0,
|
|
8120
|
-
onSetProperty: i.readonly ? void 0 : (
|
|
8119
|
+
onSetProperty: i.readonly ? void 0 : (j, E) => w.mutate({ propertyCode: j, value: E }),
|
|
8121
8120
|
isPropertyPending: w.isPending,
|
|
8122
8121
|
objectStatuses: g ?? void 0,
|
|
8123
|
-
onSetStatus: i.readonly ? void 0 : (
|
|
8122
|
+
onSetStatus: i.readonly ? void 0 : (j, E) => b.mutate({ groupCode: j, statusCode: E }),
|
|
8124
8123
|
isStatusPending: b.isPending
|
|
8125
8124
|
};
|
|
8126
8125
|
return /* @__PURE__ */ d("div", { className: "flex flex-col h-full", children: [
|
|
@@ -8128,7 +8127,7 @@ function Ol({
|
|
|
8128
8127
|
/* @__PURE__ */ n("h2", { className: "text-sm font-semibold truncate", children: T }),
|
|
8129
8128
|
/* @__PURE__ */ n("div", { className: "flex items-center gap-1.5", children: !i.readonly && (o ? /* @__PURE__ */ d(pe, { children: [
|
|
8130
8129
|
/* @__PURE__ */ d(
|
|
8131
|
-
|
|
8130
|
+
q,
|
|
8132
8131
|
{
|
|
8133
8132
|
size: "sm",
|
|
8134
8133
|
variant: "outline",
|
|
@@ -8141,7 +8140,7 @@ function Ol({
|
|
|
8141
8140
|
}
|
|
8142
8141
|
),
|
|
8143
8142
|
/* @__PURE__ */ d(
|
|
8144
|
-
|
|
8143
|
+
q,
|
|
8145
8144
|
{
|
|
8146
8145
|
size: "sm",
|
|
8147
8146
|
onClick: v,
|
|
@@ -8154,7 +8153,7 @@ function Ol({
|
|
|
8154
8153
|
}
|
|
8155
8154
|
)
|
|
8156
8155
|
] }) : /* @__PURE__ */ d(
|
|
8157
|
-
|
|
8156
|
+
q,
|
|
8158
8157
|
{
|
|
8159
8158
|
size: "sm",
|
|
8160
8159
|
variant: "outline",
|
|
@@ -8174,7 +8173,7 @@ function Ol({
|
|
|
8174
8173
|
] }) })
|
|
8175
8174
|
] });
|
|
8176
8175
|
}
|
|
8177
|
-
class
|
|
8176
|
+
class qt extends Os {
|
|
8178
8177
|
constructor(r) {
|
|
8179
8178
|
super(r);
|
|
8180
8179
|
st(this, "handleRetry", () => {
|
|
@@ -8193,7 +8192,7 @@ class jt extends Os {
|
|
|
8193
8192
|
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ n("div", { className: "flex items-center justify-center min-h-[200px] p-8", children: /* @__PURE__ */ d("div", { className: "text-center space-y-4 max-w-md", children: [
|
|
8194
8193
|
/* @__PURE__ */ n("h2", { className: "text-lg font-semibold text-foreground", children: "Something went wrong" }),
|
|
8195
8194
|
/* @__PURE__ */ n("p", { className: "text-sm text-muted-foreground", children: ((r = this.state.error) == null ? void 0 : r.message) || "An unexpected error occurred." }),
|
|
8196
|
-
/* @__PURE__ */ n(
|
|
8195
|
+
/* @__PURE__ */ n(q, { variant: "outline", onClick: this.handleRetry, children: "Try again" })
|
|
8197
8196
|
] }) }) : this.props.children;
|
|
8198
8197
|
}
|
|
8199
8198
|
}
|
|
@@ -8241,7 +8240,7 @@ function Ts(e) {
|
|
|
8241
8240
|
}
|
|
8242
8241
|
function nr(e, t) {
|
|
8243
8242
|
const r = document.documentElement;
|
|
8244
|
-
r.classList.remove("dark"), r.setAttribute("data-theme", e),
|
|
8243
|
+
r.classList.remove("dark"), r.setAttribute("data-theme", e), jl(r);
|
|
8245
8244
|
const s = t[e];
|
|
8246
8245
|
if (s) {
|
|
8247
8246
|
for (const [a, l] of Object.entries(s))
|
|
@@ -8249,14 +8248,14 @@ function nr(e, t) {
|
|
|
8249
8248
|
(s["--_base"] === "dark" || e === "dark") && r.classList.add("dark");
|
|
8250
8249
|
} else e === "dark" && r.classList.add("dark");
|
|
8251
8250
|
}
|
|
8252
|
-
function
|
|
8251
|
+
function jl(e) {
|
|
8253
8252
|
for (const t of Fl)
|
|
8254
8253
|
e.style.removeProperty(t);
|
|
8255
8254
|
}
|
|
8256
|
-
function
|
|
8255
|
+
function ql() {
|
|
8257
8256
|
return typeof window > "u" ? "light" : localStorage.getItem(ks) || "light";
|
|
8258
8257
|
}
|
|
8259
|
-
const As =
|
|
8258
|
+
const As = ql(), Ds = Ts(As);
|
|
8260
8259
|
typeof window < "u" && nr(Ds, {});
|
|
8261
8260
|
const Ar = Fr((e, t) => ({
|
|
8262
8261
|
selectedTheme: As,
|
|
@@ -8295,7 +8294,7 @@ const Ml = new Us({
|
|
|
8295
8294
|
}
|
|
8296
8295
|
});
|
|
8297
8296
|
function Ul() {
|
|
8298
|
-
const { data: e } =
|
|
8297
|
+
const { data: e } = je(), t = ee(() => {
|
|
8299
8298
|
if (!e) return [];
|
|
8300
8299
|
const s = [];
|
|
8301
8300
|
for (const [i, a] of Object.entries(e.screens)) {
|
|
@@ -8305,7 +8304,7 @@ function Ul() {
|
|
|
8305
8304
|
Ie,
|
|
8306
8305
|
{
|
|
8307
8306
|
path: a.route,
|
|
8308
|
-
element: /* @__PURE__ */ n(
|
|
8307
|
+
element: /* @__PURE__ */ n(qt, { children: /* @__PURE__ */ n(No, { screenCode: i }) })
|
|
8309
8308
|
},
|
|
8310
8309
|
i
|
|
8311
8310
|
)
|
|
@@ -8318,7 +8317,7 @@ function Ul() {
|
|
|
8318
8317
|
Ie,
|
|
8319
8318
|
{
|
|
8320
8319
|
path: a.route,
|
|
8321
|
-
element: /* @__PURE__ */ n(
|
|
8320
|
+
element: /* @__PURE__ */ n(qt, { children: /* @__PURE__ */ n(Cl, { screenCode: i }) })
|
|
8322
8321
|
},
|
|
8323
8322
|
i
|
|
8324
8323
|
)
|
|
@@ -8331,7 +8330,7 @@ function Ul() {
|
|
|
8331
8330
|
Ie,
|
|
8332
8331
|
{
|
|
8333
8332
|
path: a.route,
|
|
8334
|
-
element: /* @__PURE__ */ n(
|
|
8333
|
+
element: /* @__PURE__ */ n(qt, { children: /* @__PURE__ */ n(Rl, { screenCode: i }) })
|
|
8335
8334
|
},
|
|
8336
8335
|
i
|
|
8337
8336
|
)
|
|
@@ -8345,7 +8344,7 @@ function Ul() {
|
|
|
8345
8344
|
Ie,
|
|
8346
8345
|
{
|
|
8347
8346
|
path: a.route,
|
|
8348
|
-
element: /* @__PURE__ */ n(
|
|
8347
|
+
element: /* @__PURE__ */ n(qt, { children: /* @__PURE__ */ n(l, {}) })
|
|
8349
8348
|
},
|
|
8350
8349
|
i
|
|
8351
8350
|
)
|
|
@@ -8373,7 +8372,7 @@ function Ul() {
|
|
|
8373
8372
|
return { routes: t, defaultRoute: r };
|
|
8374
8373
|
}
|
|
8375
8374
|
function Il() {
|
|
8376
|
-
const e = ct((l) => l.initialize), { data: t } =
|
|
8375
|
+
const e = ct((l) => l.initialize), { data: t } = je(), r = Ar((l) => l.setAvailableThemes), { routes: s, defaultRoute: i } = Ul();
|
|
8377
8376
|
le(() => {
|
|
8378
8377
|
e();
|
|
8379
8378
|
}, [e]);
|
|
@@ -8384,7 +8383,7 @@ function Il() {
|
|
|
8384
8383
|
for (const [c, o] of Object.entries(t.themes))
|
|
8385
8384
|
l[c] = Ll(o);
|
|
8386
8385
|
r(l);
|
|
8387
|
-
}, [a, r]), /* @__PURE__ */ d(
|
|
8386
|
+
}, [a, r]), /* @__PURE__ */ d(qs, { children: [
|
|
8388
8387
|
/* @__PURE__ */ n(Ie, { path: "/login", element: /* @__PURE__ */ n(Yi, {}) }),
|
|
8389
8388
|
/* @__PURE__ */ n(Ie, { path: "/login/sso-callback", element: /* @__PURE__ */ n(Bi, {}) }),
|
|
8390
8389
|
/* @__PURE__ */ n(Ie, { path: "/signup", element: /* @__PURE__ */ n(Xi, {}) }),
|
|
@@ -8397,7 +8396,7 @@ function Il() {
|
|
|
8397
8396
|
] });
|
|
8398
8397
|
}
|
|
8399
8398
|
function wc() {
|
|
8400
|
-
return /* @__PURE__ */ n(
|
|
8399
|
+
return /* @__PURE__ */ n(qt, { children: /* @__PURE__ */ n(Is, { client: Ml, children: /* @__PURE__ */ d(js, { children: [
|
|
8401
8400
|
/* @__PURE__ */ n(Il, {}),
|
|
8402
8401
|
/* @__PURE__ */ n(Vs, { richColors: !0, position: "top-right", toastOptions: { className: "select-text" } })
|
|
8403
8402
|
] }) }) });
|
|
@@ -8621,11 +8620,11 @@ export {
|
|
|
8621
8620
|
_c as entityClient,
|
|
8622
8621
|
De as fieldDisplayName,
|
|
8623
8622
|
ys as hasOrGroups,
|
|
8624
|
-
|
|
8623
|
+
D as loc,
|
|
8625
8624
|
gs as parseFiltersFromURL,
|
|
8626
8625
|
Nc as registerScreen,
|
|
8627
8626
|
vs as setFiltersInURL,
|
|
8628
|
-
|
|
8627
|
+
qr as useAuth,
|
|
8629
8628
|
Cc as useColumns,
|
|
8630
8629
|
ua as useCreateEntity,
|
|
8631
8630
|
Gn as useDebounce,
|
|
@@ -8637,7 +8636,7 @@ export {
|
|
|
8637
8636
|
fo as useFilters,
|
|
8638
8637
|
Sc as usePublicParams,
|
|
8639
8638
|
kc as useResolvedParam,
|
|
8640
|
-
|
|
8639
|
+
je as useSchema,
|
|
8641
8640
|
xo as useScreen,
|
|
8642
8641
|
$l as useSetProperty,
|
|
8643
8642
|
Al as useSetStatus,
|