@object-ui/plugin-detail 4.7.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ComponentRegistry as e, buildExpandFields as t } from "@object-ui/core";
|
|
2
2
|
import * as n from "react";
|
|
3
3
|
import r from "react";
|
|
4
|
-
import { AlertDialog as i, AlertDialogAction as a, AlertDialogCancel as o, AlertDialogContent as s, AlertDialogDescription as c, AlertDialogFooter as l, AlertDialogHeader as u, AlertDialogTitle as d, Avatar as f, AvatarFallback as p, AvatarImage as m, Badge as h, Button as g, Card as _, CardContent as v, CardHeader as y, CardTitle as b, Collapsible as x, CollapsibleContent as S, CollapsibleTrigger as C, Input as w, Sheet as T, SheetContent as E, SheetHeader as D, SheetTitle as O, Skeleton as k, Tabs as A, TabsContent as j, TabsList as ee, TabsTrigger as M, Tooltip as N, TooltipContent as P, TooltipProvider as F, TooltipTrigger as I, cn as L, useIsMobile as
|
|
5
|
-
import { Activity as
|
|
6
|
-
import { SchemaRenderer as
|
|
7
|
-
import { BooleanField as
|
|
8
|
-
import { Fragment as
|
|
4
|
+
import { AlertDialog as i, AlertDialogAction as a, AlertDialogCancel as o, AlertDialogContent as s, AlertDialogDescription as c, AlertDialogFooter as l, AlertDialogHeader as u, AlertDialogTitle as d, Avatar as f, AvatarFallback as p, AvatarImage as m, Badge as h, Button as g, Card as _, CardContent as v, CardHeader as y, CardTitle as b, Collapsible as x, CollapsibleContent as S, CollapsibleTrigger as C, Input as w, Sheet as T, SheetContent as E, SheetHeader as D, SheetTitle as O, Skeleton as k, Tabs as A, TabsContent as j, TabsList as ee, TabsTrigger as M, Tooltip as N, TooltipContent as P, TooltipProvider as F, TooltipTrigger as I, cn as L, useIsMobile as te } from "@object-ui/components";
|
|
5
|
+
import { Activity as R, ArrowLeft as ne, ArrowRight as z, ArrowRightLeft as B, ArrowUpDown as re, AtSign as V, Bell as H, BellOff as U, Bold as ie, Calendar as W, Check as ae, CheckSquare as oe, ChevronDown as se, ChevronLeft as ce, ChevronRight as le, ChevronsLeft as ue, ChevronsRight as de, Code as fe, Columns2 as G, Copy as pe, Edit as K, ExternalLink as me, Eye as q, EyeOff as he, File as ge, FileArchive as J, FileText as _e, History as ve, Image as ye, Inbox as Y, Italic as be, Link as xe, List as Se, Loader2 as Ce, Mail as we, MessageSquare as Te, Network as Ee, PanelRightClose as De, PanelRightOpen as X, Paperclip as Oe, Phone as ke, Pin as Ae, Plus as je, PlusCircle as Me, RotateCcw as Ne, Rows3 as Pe, Search as Fe, Send as Ie, SmilePlus as Le, Star as Re, Trash2 as ze, Upload as Be, X as Ve, Zap as He, icons as Ue } from "lucide-react";
|
|
6
|
+
import { SchemaRenderer as We, useActionEngine as Ge, useObjectTranslation as Ke, useRecordContext as qe, useSafeFieldLabel as Je } from "@object-ui/react";
|
|
7
|
+
import { BooleanField as Ye, SelectField as Xe, getCellRenderer as Ze, resolveCellRendererType as Qe } from "@object-ui/fields";
|
|
8
|
+
import { Fragment as $e, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
9
9
|
import { useFieldPermissions as et, usePermissions as tt } from "@object-ui/permissions";
|
|
10
10
|
//#region src/autoLayout.ts
|
|
11
11
|
var nt = new Set([
|
|
@@ -53,7 +53,7 @@ function ot(e, t, n) {
|
|
|
53
53
|
function st(e, t) {
|
|
54
54
|
return function() {
|
|
55
55
|
try {
|
|
56
|
-
let n =
|
|
56
|
+
let n = Ke();
|
|
57
57
|
return n.t(t) === t ? { t: (t, n) => {
|
|
58
58
|
let r = e[t] || t;
|
|
59
59
|
if (n) for (let [e, t] of Object.entries(n)) r = r.replace(`{{${e}}}`, String(t));
|
|
@@ -188,7 +188,7 @@ function lt(e, t) {
|
|
|
188
188
|
return !e || e <= 1 || t <= 1 ? "" : t === 2 ? e >= 2 ? "md:col-span-2" : "" : e === 2 ? "md:col-span-2" : e >= 3 ? "md:col-span-2 lg:col-span-3" : "";
|
|
189
189
|
}
|
|
190
190
|
var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s, virtualScroll: c }) => {
|
|
191
|
-
let [l, u] = n.useState(e.defaultCollapsed ?? !1), [d, f] = n.useState(null), [p, m] = n.useState(void 0), [w, T] = n.useState(!1), { t: E } = $(), { fieldLabel: D, translateOptions: O } =
|
|
191
|
+
let [l, u] = n.useState(e.defaultCollapsed ?? !1), [d, f] = n.useState(null), [p, m] = n.useState(void 0), [w, T] = n.useState(!1), { t: E } = $(), { fieldLabel: D, translateOptions: O } = Je(), k = n.useCallback((e, t) => {
|
|
192
192
|
let n = t == null ? "" : String(t);
|
|
193
193
|
navigator.clipboard.writeText(n).then(() => {
|
|
194
194
|
f(e), setTimeout(() => f(null), 2e3);
|
|
@@ -196,18 +196,18 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
196
196
|
}, []), A = n.useCallback((e) => {
|
|
197
197
|
let n = t?.[e.name] ?? e.value;
|
|
198
198
|
return n == null || n === "";
|
|
199
|
-
}, [t]), j = n.useMemo(() => e.fields.filter(A).length, [e.fields, A]), ee =
|
|
200
|
-
if (
|
|
201
|
-
let { fields:
|
|
199
|
+
}, [t]), j = n.useMemo(() => e.fields.filter(A).length, [e.fields, A]), ee = te(), M = ee ? 3 : 6, R = ee ? .2 : .5, ne = e.fields.length - j, z = !e.hideEmpty && !o && e.fields.length >= M && j / e.fields.length >= R && ne > 0, B = !w && (e.hideEmpty || z) ? e.fields.filter((e) => !A(e)) : e.fields;
|
|
200
|
+
if (B.length === 0 && j === e.fields.length) return null;
|
|
201
|
+
let { fields: re, columns: V } = ot(B, e.columns), H = (e) => {
|
|
202
202
|
let n = t?.[e.name] ?? e.value;
|
|
203
|
-
if (e.render) return /* @__PURE__ */ Z(
|
|
203
|
+
if (e.render) return /* @__PURE__ */ Z(We, {
|
|
204
204
|
schema: e.render,
|
|
205
205
|
data: {
|
|
206
206
|
...t,
|
|
207
207
|
value: n
|
|
208
208
|
}
|
|
209
209
|
});
|
|
210
|
-
let r = lt(e.span,
|
|
210
|
+
let r = lt(e.span, V), c = i?.fields?.[e.name], l = { ...e };
|
|
211
211
|
if (c) {
|
|
212
212
|
!e.type && c.type && (l.type = c.type), c.options && !l.options && (l.options = c.options), c.currency && !l.currency && (l.currency = c.currency), c.precision !== void 0 && l.precision === void 0 && (l.precision = c.precision), c.format && !l.format && (l.format = c.format);
|
|
213
213
|
let t = c.reference_to || c.reference;
|
|
@@ -219,9 +219,9 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
219
219
|
className: "text-muted-foreground/50 text-xs italic",
|
|
220
220
|
children: "—"
|
|
221
221
|
});
|
|
222
|
-
let t =
|
|
222
|
+
let t = Qe(l) || e.type;
|
|
223
223
|
if (t) {
|
|
224
|
-
let e =
|
|
224
|
+
let e = Ze(t);
|
|
225
225
|
if (e) return /* @__PURE__ */ Z(e, {
|
|
226
226
|
value: n,
|
|
227
227
|
field: l
|
|
@@ -238,12 +238,12 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
238
238
|
className: "min-h-[44px] sm:min-h-0",
|
|
239
239
|
children: (() => {
|
|
240
240
|
let t = l.type || e.type;
|
|
241
|
-
if (t === "select" && Array.isArray(l.options) && l.options.length > 0) return /* @__PURE__ */ Z(
|
|
241
|
+
if (t === "select" && Array.isArray(l.options) && l.options.length > 0) return /* @__PURE__ */ Z(Xe, {
|
|
242
242
|
field: l,
|
|
243
243
|
value: n == null ? "" : String(n),
|
|
244
244
|
onChange: (t) => s?.(e.name, t)
|
|
245
245
|
});
|
|
246
|
-
if (t === "boolean") return /* @__PURE__ */ Z(
|
|
246
|
+
if (t === "boolean") return /* @__PURE__ */ Z(Ye, {
|
|
247
247
|
field: l,
|
|
248
248
|
value: !!n,
|
|
249
249
|
onChange: (t) => s?.(e.name, t)
|
|
@@ -287,32 +287,32 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
287
287
|
onClick: (t) => {
|
|
288
288
|
t.stopPropagation(), k(e.name, n);
|
|
289
289
|
},
|
|
290
|
-
children: p ? /* @__PURE__ */ Z(ae, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(
|
|
290
|
+
children: p ? /* @__PURE__ */ Z(ae, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(pe, { className: "h-3 w-3" })
|
|
291
291
|
})
|
|
292
292
|
}), /* @__PURE__ */ Z(P, { children: E(p ? "detail.copied" : "detail.copyToClipboard") })] }) })]
|
|
293
293
|
})]
|
|
294
294
|
}, e.name);
|
|
295
|
-
},
|
|
295
|
+
}, U = c?.enabled === !0, ie = c?.batchSize ?? 20;
|
|
296
296
|
n.useEffect(() => {
|
|
297
|
-
if (!
|
|
297
|
+
if (!U) {
|
|
298
298
|
m(void 0);
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
|
-
if (
|
|
301
|
+
if (re.length <= ie) {
|
|
302
302
|
m(void 0);
|
|
303
303
|
return;
|
|
304
304
|
}
|
|
305
|
-
m(
|
|
305
|
+
m(ie);
|
|
306
306
|
let e = setTimeout(() => m(void 0), 100);
|
|
307
307
|
return () => clearTimeout(e);
|
|
308
308
|
}, [
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
309
|
+
U,
|
|
310
|
+
re.length,
|
|
311
|
+
ie
|
|
312
312
|
]);
|
|
313
|
-
let
|
|
314
|
-
className: L("grid gap-3 sm:gap-4",
|
|
315
|
-
children:
|
|
313
|
+
let W = p === void 0 ? re : re.slice(0, p), oe = j > 0 && (e.hideEmpty || z), ce = /* @__PURE__ */ Q($e, { children: [/* @__PURE__ */ Z("div", {
|
|
314
|
+
className: L("grid gap-3 sm:gap-4", V === 1 ? "grid-cols-1" : V === 2 ? "grid-cols-1 md:grid-cols-2" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"),
|
|
315
|
+
children: W.map(H)
|
|
316
316
|
}), oe && /* @__PURE__ */ Z("div", {
|
|
317
317
|
className: "mt-3 -ml-2",
|
|
318
318
|
children: /* @__PURE__ */ Q(g, {
|
|
@@ -356,7 +356,7 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
356
356
|
]
|
|
357
357
|
}), /* @__PURE__ */ Z("div", {
|
|
358
358
|
className: "flex items-center gap-2",
|
|
359
|
-
children: Z(l ?
|
|
359
|
+
children: Z(l ? le : se, { className: "h-4 w-4 text-muted-foreground" })
|
|
360
360
|
})]
|
|
361
361
|
}), e.description && !l && /* @__PURE__ */ Z("p", {
|
|
362
362
|
className: "text-sm text-muted-foreground mt-1.5",
|
|
@@ -420,11 +420,11 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
420
420
|
fallback: null,
|
|
421
421
|
children: Array.isArray(e.content) ? /* @__PURE__ */ Z("div", {
|
|
422
422
|
className: "space-y-4",
|
|
423
|
-
children: e.content.map((e, n) => /* @__PURE__ */ Z(
|
|
423
|
+
children: e.content.map((e, n) => /* @__PURE__ */ Z(We, {
|
|
424
424
|
schema: e,
|
|
425
425
|
data: t
|
|
426
426
|
}, n))
|
|
427
|
-
}) : /* @__PURE__ */ Z(
|
|
427
|
+
}) : /* @__PURE__ */ Z(We, {
|
|
428
428
|
schema: e.content,
|
|
429
429
|
data: t
|
|
430
430
|
})
|
|
@@ -435,14 +435,14 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
435
435
|
//#endregion
|
|
436
436
|
//#region src/RelatedList.tsx
|
|
437
437
|
function ft(e) {
|
|
438
|
-
return e &&
|
|
438
|
+
return e && Ue[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || Y;
|
|
439
439
|
}
|
|
440
440
|
var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className: x, dataSource: S, objectName: C, onNew: T, onViewAll: E, onRowEdit: D, onRowDelete: O, onRowClick: k, maxColumns: A = 6, pageSize: j, sortable: ee = !1, filterable: M = !1, collapsible: N = !1, defaultCollapsed: P = !1, referenceField: F, icon: I }) => {
|
|
441
|
-
let R = f !== void 0,
|
|
441
|
+
let R = f !== void 0, ne = f ?? [], [z, B] = n.useState(ne), [V, H] = n.useState(() => !!r && !R), [U, ie] = n.useState(0), [W, ae] = n.useState(null), [oe, ue] = n.useState("asc"), [de, fe] = n.useState(""), [G, pe] = n.useState(null), [K, q] = n.useState(P), [he, ge] = n.useState({}), { t: J } = $(), { fieldLabel: _e } = Je();
|
|
442
442
|
n.useEffect(() => {
|
|
443
|
-
R &&
|
|
443
|
+
R && B(f ?? []);
|
|
444
444
|
}, [f, R]), n.useEffect(() => {
|
|
445
|
-
r && S?.getObjectSchema && !m?.length && S.getObjectSchema(r).then(
|
|
445
|
+
r && S?.getObjectSchema && !m?.length && S.getObjectSchema(r).then(pe).catch((e) => {
|
|
446
446
|
console.warn(`[RelatedList] Failed to fetch schema for ${r}:`, e);
|
|
447
447
|
});
|
|
448
448
|
}, [
|
|
@@ -450,32 +450,32 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
450
450
|
S,
|
|
451
451
|
m
|
|
452
452
|
]), n.useEffect(() => {
|
|
453
|
-
r && !R && (
|
|
454
|
-
|
|
453
|
+
r && !R && (H(!0), S && typeof S.find == "function" ? S.find(r).then((e) => {
|
|
454
|
+
B(Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : []), H(!1);
|
|
455
455
|
}).catch((e) => {
|
|
456
|
-
console.error("Failed to fetch related data:", e),
|
|
456
|
+
console.error("Failed to fetch related data:", e), H(!1);
|
|
457
457
|
}) : fetch(r).then((e) => e.json()).then((e) => {
|
|
458
|
-
|
|
458
|
+
B(Array.isArray(e) ? e : e?.data || []);
|
|
459
459
|
}).catch((e) => {
|
|
460
460
|
console.error("Failed to fetch related data:", e);
|
|
461
|
-
}).finally(() =>
|
|
461
|
+
}).finally(() => H(!1)));
|
|
462
462
|
}, [
|
|
463
463
|
r,
|
|
464
464
|
R,
|
|
465
465
|
S
|
|
466
466
|
]), n.useEffect(() => {
|
|
467
|
-
if (!S?.find || !
|
|
468
|
-
let e =
|
|
467
|
+
if (!S?.find || !G?.fields || !z.length) return;
|
|
468
|
+
let e = G.fields, t = [];
|
|
469
469
|
for (let [n, r] of Object.entries(e)) {
|
|
470
470
|
if (!r || r.type !== "lookup" && r.type !== "master_detail") continue;
|
|
471
471
|
let e = r.reference_to || r.reference;
|
|
472
472
|
if (!e) continue;
|
|
473
473
|
let i = /* @__PURE__ */ new Set();
|
|
474
|
-
for (let e of
|
|
474
|
+
for (let e of z) {
|
|
475
475
|
let t = e?.[n];
|
|
476
476
|
t != null && (typeof t == "string" && t ? i.add(t) : typeof t == "number" && i.add(String(t)));
|
|
477
477
|
}
|
|
478
|
-
let a =
|
|
478
|
+
let a = he[n] || {}, o = Array.from(i).filter((e) => !(e in a));
|
|
479
479
|
o.length > 0 && t.push({
|
|
480
480
|
fieldName: n,
|
|
481
481
|
target: e,
|
|
@@ -501,7 +501,7 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
501
501
|
fieldName: e,
|
|
502
502
|
map: {}
|
|
503
503
|
})))).then((e) => {
|
|
504
|
-
n ||
|
|
504
|
+
n || ge((t) => {
|
|
505
505
|
let n = { ...t };
|
|
506
506
|
for (let { fieldName: t, map: r } of e) n[t] = {
|
|
507
507
|
...n[t] || {},
|
|
@@ -514,48 +514,48 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
514
514
|
};
|
|
515
515
|
}, [
|
|
516
516
|
S,
|
|
517
|
-
|
|
518
|
-
|
|
517
|
+
G,
|
|
518
|
+
z
|
|
519
519
|
]);
|
|
520
|
-
let
|
|
521
|
-
if (!
|
|
522
|
-
let e =
|
|
523
|
-
return
|
|
524
|
-
}, [
|
|
520
|
+
let ve = n.useMemo(() => {
|
|
521
|
+
if (!de) return z;
|
|
522
|
+
let e = de.toLowerCase();
|
|
523
|
+
return z.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
524
|
+
}, [z, de]), ye = n.useMemo(() => W ? [...ve].sort((e, t) => {
|
|
525
525
|
let n = e[W], r = t[W];
|
|
526
526
|
if (n == null && r == null) return 0;
|
|
527
527
|
if (n == null) return 1;
|
|
528
528
|
if (r == null) return -1;
|
|
529
529
|
let i = String(n).localeCompare(String(r), void 0, { numeric: !0 });
|
|
530
|
-
return
|
|
531
|
-
}) :
|
|
532
|
-
|
|
530
|
+
return oe === "asc" ? i : -i;
|
|
531
|
+
}) : ve, [
|
|
532
|
+
ve,
|
|
533
533
|
W,
|
|
534
|
-
|
|
535
|
-
]), Y = j && j > 0 ? j : 0,
|
|
534
|
+
oe
|
|
535
|
+
]), Y = j && j > 0 ? j : 0, be = Y ? Math.max(1, Math.ceil(ye.length / Y)) : 1, xe = Y ? ye.slice(U * Y, (U + 1) * Y) : ye;
|
|
536
536
|
n.useEffect(() => {
|
|
537
|
-
|
|
537
|
+
ie(0);
|
|
538
538
|
}, [
|
|
539
|
-
|
|
539
|
+
de,
|
|
540
540
|
W,
|
|
541
|
-
|
|
541
|
+
oe
|
|
542
542
|
]);
|
|
543
|
-
let
|
|
544
|
-
W === e ?
|
|
545
|
-
}, [W]), [
|
|
546
|
-
|
|
547
|
-
}, []),
|
|
548
|
-
|
|
549
|
-
}, [
|
|
550
|
-
let e = C || r || "", t = (t) => !
|
|
543
|
+
let Se = n.useCallback((e) => {
|
|
544
|
+
W === e ? ue((e) => e === "asc" ? "desc" : "asc") : (ae(e), ue("asc"));
|
|
545
|
+
}, [W]), [Ce, we] = n.useState(null), Te = n.useCallback((e) => {
|
|
546
|
+
we(e);
|
|
547
|
+
}, []), Ee = n.useCallback(() => {
|
|
548
|
+
Ce && O?.(Ce), we(null);
|
|
549
|
+
}, [Ce, O]), De = tt(), X = n.useMemo(() => {
|
|
550
|
+
let e = C || r || "", t = (t) => !De?.isLoaded || !e ? t : t.filter((t) => {
|
|
551
551
|
let n = t?.accessorKey || t?.field || t?.name;
|
|
552
|
-
return n ?
|
|
553
|
-
}), i = (e) => F ? e.filter((e) => (e?.accessorKey || e?.field || e?.name) !== F) : e, a = (e) => e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0, o = (e) =>
|
|
552
|
+
return n ? De.checkField(e, String(n), "read") : !0;
|
|
553
|
+
}), i = (e) => F ? e.filter((e) => (e?.accessorKey || e?.field || e?.name) !== F) : e, a = (e) => e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0, o = (e) => z.length ? e.filter((e) => {
|
|
554
554
|
let t = e?.accessorKey || e?.field || e?.name;
|
|
555
|
-
return t ?
|
|
555
|
+
return t ? z.some((e) => !a(e?.[t])) : !0;
|
|
556
556
|
}) : e;
|
|
557
557
|
if (m && m.length > 0) return o(t(i(m)));
|
|
558
|
-
if (!
|
|
558
|
+
if (!G?.fields) return [];
|
|
559
559
|
let s = e, c = new Set([
|
|
560
560
|
"image",
|
|
561
561
|
"file",
|
|
@@ -572,7 +572,7 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
572
572
|
"label",
|
|
573
573
|
"code",
|
|
574
574
|
"number"
|
|
575
|
-
], u = Object.entries(
|
|
575
|
+
], u = Object.entries(G.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === F || t?.hidden || t?.type && c.has(t.type) || De?.isLoaded && s && !De.checkField(s, e, "read")));
|
|
576
576
|
return u.sort(([e, t], [n, r]) => {
|
|
577
577
|
let i = l.indexOf(e), a = l.indexOf(n), o = i >= 0 ? i : 100, s = a >= 0 ? a : 100;
|
|
578
578
|
if (o !== s) return o - s;
|
|
@@ -581,15 +581,15 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
581
581
|
}), o(u.map(([e, t]) => {
|
|
582
582
|
let r = {
|
|
583
583
|
accessorKey: e,
|
|
584
|
-
header:
|
|
584
|
+
header: _e(s, e, t.label || e)
|
|
585
585
|
};
|
|
586
586
|
if (t.type) {
|
|
587
|
-
let i = Qe(
|
|
587
|
+
let i = Ze(Qe({
|
|
588
588
|
type: t.type,
|
|
589
589
|
format: t.format
|
|
590
590
|
}) || t.type);
|
|
591
591
|
if (i) {
|
|
592
|
-
let a = t.type === "lookup" || t.type === "master_detail" ?
|
|
592
|
+
let a = t.type === "lookup" || t.type === "master_detail" ? he[e] : void 0, o = a && Object.keys(a).length > 0 ? Object.entries(a).map(([e, t]) => ({
|
|
593
593
|
value: e,
|
|
594
594
|
label: t
|
|
595
595
|
})) : void 0, s = {
|
|
@@ -613,35 +613,49 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
613
613
|
})).slice(0, Math.max(1, A));
|
|
614
614
|
}, [
|
|
615
615
|
m,
|
|
616
|
-
|
|
616
|
+
G,
|
|
617
617
|
C,
|
|
618
618
|
r,
|
|
619
|
-
|
|
619
|
+
_e,
|
|
620
620
|
F,
|
|
621
|
-
|
|
621
|
+
z,
|
|
622
622
|
A,
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
]), Oe = !!D || !!O, ke = n.useMemo(() => {
|
|
623
|
+
he,
|
|
624
|
+
De
|
|
625
|
+
]), Oe = !!D || !!O, ke = te(), Ae = n.useMemo(() => {
|
|
626
626
|
if (p) return p;
|
|
627
|
+
if (ke && (t === "grid" || t === "table")) {
|
|
628
|
+
let e = X[0]?.accessorKey || X[0]?.field || X[0]?.name, t = X.slice(1, 4).map((e) => e.accessorKey || e.field || e.name).filter(Boolean);
|
|
629
|
+
return {
|
|
630
|
+
type: "object-gallery",
|
|
631
|
+
data: xe,
|
|
632
|
+
objectName: r,
|
|
633
|
+
gallery: {
|
|
634
|
+
titleField: e || "name",
|
|
635
|
+
visibleFields: t,
|
|
636
|
+
cardSize: "medium"
|
|
637
|
+
},
|
|
638
|
+
onRowClick: k
|
|
639
|
+
};
|
|
640
|
+
}
|
|
627
641
|
switch (t) {
|
|
628
642
|
case "grid":
|
|
629
643
|
case "table": return {
|
|
630
644
|
type: "data-table",
|
|
631
|
-
data:
|
|
632
|
-
columns:
|
|
645
|
+
data: xe,
|
|
646
|
+
columns: X,
|
|
633
647
|
pagination: !1,
|
|
634
648
|
pageSize: Y || 10,
|
|
635
649
|
searchable: !1,
|
|
636
650
|
exportable: !1,
|
|
637
651
|
rowActions: Oe,
|
|
638
652
|
onRowEdit: D,
|
|
639
|
-
onRowDelete: O ?
|
|
653
|
+
onRowDelete: O ? Te : void 0,
|
|
640
654
|
onRowClick: k
|
|
641
655
|
};
|
|
642
656
|
case "list": return {
|
|
643
657
|
type: "data-list",
|
|
644
|
-
data:
|
|
658
|
+
data: xe
|
|
645
659
|
};
|
|
646
660
|
default: return {
|
|
647
661
|
type: "div",
|
|
@@ -650,29 +664,31 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
650
664
|
}
|
|
651
665
|
}, [
|
|
652
666
|
t,
|
|
653
|
-
|
|
654
|
-
|
|
667
|
+
xe,
|
|
668
|
+
X,
|
|
655
669
|
p,
|
|
656
670
|
Y,
|
|
657
671
|
Oe,
|
|
658
672
|
D,
|
|
659
673
|
O,
|
|
660
|
-
|
|
661
|
-
k
|
|
662
|
-
|
|
674
|
+
Te,
|
|
675
|
+
k,
|
|
676
|
+
ke,
|
|
677
|
+
r
|
|
678
|
+
]), Me = N ? "cursor-pointer select-none" : void 0, Ne = N ? () => q((e) => !e) : void 0, Pe = ft(I), Fe = !V && z.length === 0, Ie = M;
|
|
663
679
|
return /* @__PURE__ */ Q(_, {
|
|
664
|
-
className: L("shadow-none",
|
|
680
|
+
className: L("shadow-none", Fe && "bg-muted/20", x),
|
|
665
681
|
children: [
|
|
666
682
|
/* @__PURE__ */ Z(y, {
|
|
667
|
-
className: L("py-3 px-4",
|
|
668
|
-
onClick:
|
|
683
|
+
className: L("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", Me),
|
|
684
|
+
onClick: Ne,
|
|
669
685
|
children: /* @__PURE__ */ Q(b, {
|
|
670
686
|
className: "flex items-center justify-between gap-2 text-sm font-semibold",
|
|
671
687
|
children: [/* @__PURE__ */ Q("div", {
|
|
672
688
|
className: "flex items-center gap-2 min-w-0",
|
|
673
689
|
children: [
|
|
674
|
-
N && Z(
|
|
675
|
-
/* @__PURE__ */ Z(
|
|
690
|
+
N && Z(K ? le : se, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
|
|
691
|
+
/* @__PURE__ */ Z(Pe, {
|
|
676
692
|
className: "h-4 w-4 text-muted-foreground shrink-0",
|
|
677
693
|
"aria-hidden": !0
|
|
678
694
|
}),
|
|
@@ -682,9 +698,9 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
682
698
|
}),
|
|
683
699
|
/* @__PURE__ */ Z(h, {
|
|
684
700
|
variant: "secondary",
|
|
685
|
-
className: L("text-xs font-normal h-5 px-1.5",
|
|
686
|
-
"aria-label": `${
|
|
687
|
-
children:
|
|
701
|
+
className: L("text-xs font-normal h-5 px-1.5", z.length === 0 && "bg-muted text-muted-foreground"),
|
|
702
|
+
"aria-label": `${z.length} records`,
|
|
703
|
+
children: z.length
|
|
688
704
|
})
|
|
689
705
|
]
|
|
690
706
|
}), /* @__PURE__ */ Z("div", {
|
|
@@ -695,27 +711,27 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
695
711
|
onClick: (e) => {
|
|
696
712
|
e.stopPropagation(), T();
|
|
697
713
|
},
|
|
698
|
-
className: "gap-1 h-7 text-xs shadow-none",
|
|
699
|
-
children: [/* @__PURE__ */ Z(
|
|
714
|
+
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
715
|
+
children: [/* @__PURE__ */ Z(je, { className: "h-3.5 w-3.5" }), J("detail.new")]
|
|
700
716
|
})
|
|
701
717
|
})]
|
|
702
718
|
})
|
|
703
719
|
}),
|
|
704
|
-
!
|
|
705
|
-
className: L("pt-0",
|
|
720
|
+
!K && /* @__PURE__ */ Q(v, {
|
|
721
|
+
className: L("pt-0", Fe ? "pb-3 px-4" : "pb-4 px-4"),
|
|
706
722
|
children: [
|
|
707
|
-
|
|
723
|
+
Ie && /* @__PURE__ */ Z("div", {
|
|
708
724
|
className: "mb-3",
|
|
709
725
|
children: /* @__PURE__ */ Z(w, {
|
|
710
726
|
placeholder: J("detail.filterPlaceholder"),
|
|
711
|
-
value:
|
|
712
|
-
onChange: (e) =>
|
|
727
|
+
value: de,
|
|
728
|
+
onChange: (e) => fe(e.target.value),
|
|
713
729
|
className: "h-8 text-sm"
|
|
714
730
|
})
|
|
715
731
|
}),
|
|
716
|
-
ee &&
|
|
732
|
+
ee && X && X.length > 0 && z.length > 0 && /* @__PURE__ */ Z("div", {
|
|
717
733
|
className: "flex flex-wrap gap-1 mb-3",
|
|
718
|
-
children:
|
|
734
|
+
children: X.map((e) => {
|
|
719
735
|
let t = e.accessorKey || e.field || e.name;
|
|
720
736
|
if (!t) return null;
|
|
721
737
|
let n = e.header || e.label || t, r = W === t;
|
|
@@ -723,11 +739,11 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
723
739
|
variant: r ? "secondary" : "ghost",
|
|
724
740
|
size: "sm",
|
|
725
741
|
className: "gap-1 h-7 text-xs",
|
|
726
|
-
onClick: () =>
|
|
742
|
+
onClick: () => Se(t),
|
|
727
743
|
children: [
|
|
728
|
-
/* @__PURE__ */ Z(
|
|
744
|
+
/* @__PURE__ */ Z(re, { className: "h-3 w-3" }),
|
|
729
745
|
n,
|
|
730
|
-
r && (
|
|
746
|
+
r && (oe === "asc" ? " ↑" : " ↓")
|
|
731
747
|
]
|
|
732
748
|
}, t);
|
|
733
749
|
})
|
|
@@ -735,10 +751,10 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
735
751
|
V ? /* @__PURE__ */ Z("div", {
|
|
736
752
|
className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
|
|
737
753
|
children: J("detail.loading")
|
|
738
|
-
}) :
|
|
754
|
+
}) : Fe ? /* @__PURE__ */ Q("div", {
|
|
739
755
|
className: "flex flex-col items-center justify-center gap-2 py-6 text-sm",
|
|
740
756
|
children: [
|
|
741
|
-
/* @__PURE__ */ Z(
|
|
757
|
+
/* @__PURE__ */ Z(Pe, {
|
|
742
758
|
className: "h-8 w-8 text-muted-foreground/40",
|
|
743
759
|
"aria-hidden": !0
|
|
744
760
|
}),
|
|
@@ -751,39 +767,39 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
751
767
|
size: "sm",
|
|
752
768
|
onClick: T,
|
|
753
769
|
className: "gap-1 h-7 text-xs mt-1",
|
|
754
|
-
children: [/* @__PURE__ */ Z(
|
|
770
|
+
children: [/* @__PURE__ */ Z(je, { className: "h-3.5 w-3.5" }), J("detail.new")]
|
|
755
771
|
})
|
|
756
772
|
]
|
|
757
|
-
}) : /* @__PURE__ */ Z(
|
|
758
|
-
Y > 0 &&
|
|
773
|
+
}) : /* @__PURE__ */ Z(We, { schema: Ae }),
|
|
774
|
+
Y > 0 && ye.length > Y && /* @__PURE__ */ Q("div", {
|
|
759
775
|
className: "flex items-center justify-between mt-3 pt-3 border-t",
|
|
760
776
|
children: [
|
|
761
777
|
/* @__PURE__ */ Q(g, {
|
|
762
778
|
variant: "outline",
|
|
763
779
|
size: "sm",
|
|
764
780
|
className: "h-7 text-xs gap-1",
|
|
765
|
-
disabled:
|
|
766
|
-
onClick: () =>
|
|
781
|
+
disabled: U === 0,
|
|
782
|
+
onClick: () => ie((e) => Math.max(0, e - 1)),
|
|
767
783
|
children: [/* @__PURE__ */ Z(ce, { className: "h-3 w-3" }), J("detail.previousPage")]
|
|
768
784
|
}),
|
|
769
785
|
/* @__PURE__ */ Z("span", {
|
|
770
786
|
className: "text-xs text-muted-foreground",
|
|
771
787
|
children: J("detail.pageOf", {
|
|
772
|
-
current:
|
|
773
|
-
total:
|
|
788
|
+
current: U + 1,
|
|
789
|
+
total: be
|
|
774
790
|
})
|
|
775
791
|
}),
|
|
776
792
|
/* @__PURE__ */ Q(g, {
|
|
777
793
|
variant: "outline",
|
|
778
794
|
size: "sm",
|
|
779
795
|
className: "h-7 text-xs gap-1",
|
|
780
|
-
disabled:
|
|
781
|
-
onClick: () =>
|
|
782
|
-
children: [J("detail.nextPage"), /* @__PURE__ */ Z(
|
|
796
|
+
disabled: U >= be - 1,
|
|
797
|
+
onClick: () => ie((e) => Math.min(be - 1, e + 1)),
|
|
798
|
+
children: [J("detail.nextPage"), /* @__PURE__ */ Z(le, { className: "h-3 w-3" })]
|
|
783
799
|
})
|
|
784
800
|
]
|
|
785
801
|
}),
|
|
786
|
-
E && !
|
|
802
|
+
E && !Fe && Y > 0 && ye.length > Y && /* @__PURE__ */ Z("div", {
|
|
787
803
|
className: "mt-3 pt-3 border-t flex justify-center",
|
|
788
804
|
children: /* @__PURE__ */ Q("button", {
|
|
789
805
|
type: "button",
|
|
@@ -797,12 +813,12 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
797
813
|
]
|
|
798
814
|
}),
|
|
799
815
|
/* @__PURE__ */ Z(i, {
|
|
800
|
-
open:
|
|
816
|
+
open: Ce !== null,
|
|
801
817
|
onOpenChange: (e) => {
|
|
802
|
-
e ||
|
|
818
|
+
e || we(null);
|
|
803
819
|
},
|
|
804
820
|
children: /* @__PURE__ */ Q(s, { children: [/* @__PURE__ */ Q(u, { children: [/* @__PURE__ */ Z(d, { children: J("detail.deleteRowTitle", { defaultValue: "Delete record" }) }), /* @__PURE__ */ Z(c, { children: J("detail.deleteRowConfirmation") })] }), /* @__PURE__ */ Q(l, { children: [/* @__PURE__ */ Z(o, { children: J("detail.cancel", { defaultValue: "Cancel" }) }), /* @__PURE__ */ Z(a, {
|
|
805
|
-
onClick:
|
|
821
|
+
onClick: Ee,
|
|
806
822
|
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
807
823
|
children: J("detail.delete", { defaultValue: "Delete" })
|
|
808
824
|
})] })] })
|
|
@@ -831,7 +847,7 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
831
847
|
children: /* @__PURE__ */ Q("div", {
|
|
832
848
|
className: "flex items-center gap-2 pb-2 border-b cursor-pointer hover:bg-muted/50 transition-colors rounded-t-md px-2 py-1.5",
|
|
833
849
|
children: [
|
|
834
|
-
Z(l ?
|
|
850
|
+
Z(l ? le : se, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
|
|
835
851
|
e.icon && /* @__PURE__ */ Z("span", {
|
|
836
852
|
className: "text-muted-foreground",
|
|
837
853
|
children: e.icon
|
|
@@ -873,7 +889,7 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
873
889
|
]
|
|
874
890
|
});
|
|
875
891
|
}, ht = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
|
|
876
|
-
let { fieldLabel: a } =
|
|
892
|
+
let { fieldLabel: a } = Je();
|
|
877
893
|
if (!e.length || !t) return null;
|
|
878
894
|
let o = e.filter((e) => {
|
|
879
895
|
let n = t?.[e.name];
|
|
@@ -894,7 +910,7 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
894
910
|
...o?.currency && { currency: o.currency },
|
|
895
911
|
...o?.precision !== void 0 && { precision: o.precision },
|
|
896
912
|
...o?.format && { format: o.format }
|
|
897
|
-
}, l = Qe(
|
|
913
|
+
}, l = Ze(Qe(c) || s || "text");
|
|
898
914
|
return /* @__PURE__ */ Q("div", {
|
|
899
915
|
className: "flex min-w-0 flex-col gap-0.5",
|
|
900
916
|
children: [/* @__PURE__ */ Q("span", {
|
|
@@ -972,7 +988,7 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
972
988
|
children: /* @__PURE__ */ Q("div", {
|
|
973
989
|
className: "relative flex-1",
|
|
974
990
|
children: [
|
|
975
|
-
/* @__PURE__ */ Z(
|
|
991
|
+
/* @__PURE__ */ Z(Fe, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
|
|
976
992
|
/* @__PURE__ */ Z("input", {
|
|
977
993
|
className: "w-full rounded-md border border-input bg-background pl-8 pr-8 py-1.5 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
978
994
|
placeholder: o("detail.searchComments"),
|
|
@@ -985,7 +1001,7 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
985
1001
|
onClick: () => f(""),
|
|
986
1002
|
"aria-label": o("detail.clearSearch"),
|
|
987
1003
|
type: "button",
|
|
988
|
-
children: /* @__PURE__ */ Z(
|
|
1004
|
+
children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
|
|
989
1005
|
})
|
|
990
1006
|
]
|
|
991
1007
|
})
|
|
@@ -1005,7 +1021,7 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1005
1021
|
onClick: p,
|
|
1006
1022
|
disabled: !s.trim() || l,
|
|
1007
1023
|
className: "shrink-0 self-end",
|
|
1008
|
-
children: /* @__PURE__ */ Z(
|
|
1024
|
+
children: /* @__PURE__ */ Z(Ie, { className: "h-4 w-4" })
|
|
1009
1025
|
})]
|
|
1010
1026
|
}),
|
|
1011
1027
|
h.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
@@ -1041,7 +1057,7 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1041
1057
|
}),
|
|
1042
1058
|
e.pinned && /* @__PURE__ */ Q("span", {
|
|
1043
1059
|
className: "text-xs text-amber-600 flex items-center gap-0.5",
|
|
1044
|
-
children: [/* @__PURE__ */ Z(
|
|
1060
|
+
children: [/* @__PURE__ */ Z(Ae, { className: "h-3 w-3" }), o("detail.pinned")]
|
|
1045
1061
|
})
|
|
1046
1062
|
]
|
|
1047
1063
|
}),
|
|
@@ -1054,7 +1070,7 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1054
1070
|
className: "mt-1 text-xs text-muted-foreground hover:text-foreground flex items-center gap-1",
|
|
1055
1071
|
onClick: () => r(e.id),
|
|
1056
1072
|
"aria-label": e.pinned ? o("detail.unpin") : o("detail.pin"),
|
|
1057
|
-
children: [/* @__PURE__ */ Z(
|
|
1073
|
+
children: [/* @__PURE__ */ Z(Ae, { className: "h-3 w-3" }), e.pinned ? o("detail.unpin") : o("detail.pin")]
|
|
1058
1074
|
})
|
|
1059
1075
|
]
|
|
1060
1076
|
})]
|
|
@@ -1064,11 +1080,11 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1064
1080
|
})]
|
|
1065
1081
|
});
|
|
1066
1082
|
}, vt = {
|
|
1067
|
-
field_change:
|
|
1068
|
-
create:
|
|
1069
|
-
delete:
|
|
1083
|
+
field_change: K,
|
|
1084
|
+
create: Me,
|
|
1085
|
+
delete: ze,
|
|
1070
1086
|
comment: Te,
|
|
1071
|
-
status_change:
|
|
1087
|
+
status_change: B
|
|
1072
1088
|
}, yt = {
|
|
1073
1089
|
field_change: "bg-blue-100 text-blue-600",
|
|
1074
1090
|
create: "bg-green-100 text-green-600",
|
|
@@ -1106,7 +1122,7 @@ var St = {
|
|
|
1106
1122
|
children: [/* @__PURE__ */ Z(y, { children: /* @__PURE__ */ Q(b, {
|
|
1107
1123
|
className: "flex items-center gap-2 text-base",
|
|
1108
1124
|
children: [
|
|
1109
|
-
/* @__PURE__ */ Z(
|
|
1125
|
+
/* @__PURE__ */ Z(R, { className: "h-4 w-4" }),
|
|
1110
1126
|
"Activity",
|
|
1111
1127
|
/* @__PURE__ */ Q("span", {
|
|
1112
1128
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1126,7 +1142,7 @@ var St = {
|
|
|
1126
1142
|
className: L("inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors", a === e ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-muted/80"),
|
|
1127
1143
|
onClick: () => o(e),
|
|
1128
1144
|
"aria-pressed": a === e,
|
|
1129
|
-
children: [e !== "all" && n.createElement(vt[e] ||
|
|
1145
|
+
children: [e !== "all" && n.createElement(vt[e] || K, { className: "h-3 w-3" }), St[e]]
|
|
1130
1146
|
}, e))
|
|
1131
1147
|
}), s.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
1132
1148
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
@@ -1136,7 +1152,7 @@ var St = {
|
|
|
1136
1152
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
1137
1153
|
className: "space-y-4",
|
|
1138
1154
|
children: s.map((e) => {
|
|
1139
|
-
let t = vt[e.type] ||
|
|
1155
|
+
let t = vt[e.type] || K;
|
|
1140
1156
|
return /* @__PURE__ */ Q("div", {
|
|
1141
1157
|
className: "flex gap-3 relative",
|
|
1142
1158
|
children: [/* @__PURE__ */ Z("div", {
|
|
@@ -1353,9 +1369,9 @@ var Ft = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1353
1369
|
type: r?.type || (i ? "lookup" : "text"),
|
|
1354
1370
|
...i && { reference_to: i },
|
|
1355
1371
|
...r?.reference_field && { reference_field: r.reference_field }
|
|
1356
|
-
}, o =
|
|
1372
|
+
}, o = Qe(a) || a.type;
|
|
1357
1373
|
if (o) {
|
|
1358
|
-
let t =
|
|
1374
|
+
let t = Ze(o);
|
|
1359
1375
|
if (t) return /* @__PURE__ */ Z("span", {
|
|
1360
1376
|
className: "inline-flex items-center [&_a]:text-inherit [&_a]:hover:underline",
|
|
1361
1377
|
children: /* @__PURE__ */ Z(t, {
|
|
@@ -1472,7 +1488,7 @@ function zt(e, t, n, r) {
|
|
|
1472
1488
|
return r;
|
|
1473
1489
|
}
|
|
1474
1490
|
var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBack: s, inlineEdit: c = !1, onFieldSave: l, discussionSlot: u, rightRail: d, objectLabel: f, onDataLoaded: p }) => {
|
|
1475
|
-
let [m, _] = n.useState(e.data), [v, y] = n.useState(!e.data && !!(e.api && e.resourceId || r && e.objectName && e.resourceId)), [b, x] = n.useState(!1), [S, C] = n.useState(!1), [w, T] = n.useState({}), [E, D] = n.useState(null), [O, R] = n.useState(!1), { t: z } = $(), { fieldOptionLabel:
|
|
1491
|
+
let [m, _] = n.useState(e.data), [v, y] = n.useState(!e.data && !!(e.api && e.resourceId || r && e.objectName && e.resourceId)), [b, x] = n.useState(!1), [S, C] = n.useState(!1), [w, T] = n.useState({}), [E, D] = n.useState(null), [O, R] = n.useState(!1), { t: z } = $(), { fieldOptionLabel: B } = Je(), re = te(), V = tt(), H = n.useMemo(() => {
|
|
1476
1492
|
if (!V?.isLoaded || !e.objectName) return e;
|
|
1477
1493
|
let t = (t) => V.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
|
|
1478
1494
|
let n = typeof e == "string" ? e : e?.name;
|
|
@@ -1517,7 +1533,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1517
1533
|
H.fields,
|
|
1518
1534
|
E,
|
|
1519
1535
|
m
|
|
1520
|
-
]),
|
|
1536
|
+
]), ie = H.summaryFields && H.summaryFields.length > 0 ? H.summaryFields : U, W = n.useCallback(() => {
|
|
1521
1537
|
H.resourceId && navigator.clipboard.writeText(String(H.resourceId)).then(() => {
|
|
1522
1538
|
R(!0), setTimeout(() => R(!1), 1500);
|
|
1523
1539
|
});
|
|
@@ -1572,18 +1588,18 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1572
1588
|
H.sections,
|
|
1573
1589
|
H.fields
|
|
1574
1590
|
]);
|
|
1575
|
-
let
|
|
1591
|
+
let oe = n.useCallback(() => {
|
|
1576
1592
|
if (s) s();
|
|
1577
1593
|
else if (H.onNavigate) {
|
|
1578
1594
|
let e = H.backUrl || (H.objectName ? `/${H.objectName}` : "/");
|
|
1579
1595
|
H.onNavigate(e, { replace: !0 });
|
|
1580
1596
|
} else H.backUrl ? window.location.href = H.backUrl : window.history.back();
|
|
1581
|
-
}, [s, H]),
|
|
1597
|
+
}, [s, H]), se = n.useCallback(() => {
|
|
1582
1598
|
a ? a() : H.onNavigate && H.editUrl ? H.onNavigate(H.editUrl) : H.onNavigate && H.objectName && H.resourceId ? H.onNavigate(`/${H.objectName}/${H.resourceId}/edit`) : H.editUrl && (window.location.href = H.editUrl);
|
|
1583
|
-
}, [a, H]),
|
|
1599
|
+
}, [a, H]), ue = n.useCallback(() => {
|
|
1584
1600
|
let e = H.deleteConfirmation || z("detail.deleteConfirmation");
|
|
1585
1601
|
window.confirm(e) && (o?.(), H.onNavigate && H.objectName && H.onNavigate(`/${H.objectName}`, { replace: !0 }));
|
|
1586
|
-
}, [o, H]),
|
|
1602
|
+
}, [o, H]), de = n.useCallback(() => {
|
|
1587
1603
|
navigator.share && H.objectName && H.resourceId ? navigator.share({
|
|
1588
1604
|
title: H.title || z("detail.details"),
|
|
1589
1605
|
text: `${H.objectName} #${H.resourceId}`,
|
|
@@ -1591,9 +1607,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1591
1607
|
}).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
|
|
1592
1608
|
console.log("Link copied to clipboard");
|
|
1593
1609
|
});
|
|
1594
|
-
}, [H]),
|
|
1610
|
+
}, [H]), fe = n.useCallback(() => {
|
|
1595
1611
|
x(!b);
|
|
1596
|
-
}, [b]),
|
|
1612
|
+
}, [b]), G = n.useCallback(() => {
|
|
1597
1613
|
if (S) {
|
|
1598
1614
|
let e = Object.entries(w);
|
|
1599
1615
|
if (e.length > 0) {
|
|
@@ -1613,9 +1629,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1613
1629
|
w,
|
|
1614
1630
|
m,
|
|
1615
1631
|
l
|
|
1616
|
-
]),
|
|
1632
|
+
]), me = n.useCallback(() => {
|
|
1617
1633
|
T({}), C(!1);
|
|
1618
|
-
}, []),
|
|
1634
|
+
}, []), q = n.useCallback((e, t) => {
|
|
1619
1635
|
T((n) => ({
|
|
1620
1636
|
...n,
|
|
1621
1637
|
[e]: t
|
|
@@ -1629,28 +1645,28 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1629
1645
|
};
|
|
1630
1646
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
1631
1647
|
}, [H.recordNavigation]);
|
|
1632
|
-
let
|
|
1648
|
+
let he = n.useMemo(() => H.related ?? [], [H.related]), ge = n.useMemo(() => {
|
|
1633
1649
|
let e = [];
|
|
1634
1650
|
return e.push({
|
|
1635
1651
|
name: "sys_share",
|
|
1636
1652
|
label: z("detail.share"),
|
|
1637
1653
|
icon: "share-2",
|
|
1638
1654
|
type: "script",
|
|
1639
|
-
onClick:
|
|
1655
|
+
onClick: de
|
|
1640
1656
|
}), H.showEdit && e.push({
|
|
1641
1657
|
name: "sys_edit_mobile",
|
|
1642
1658
|
label: z("detail.edit"),
|
|
1643
1659
|
icon: "edit",
|
|
1644
1660
|
type: "script",
|
|
1645
1661
|
className: "sm:hidden",
|
|
1646
|
-
onClick:
|
|
1662
|
+
onClick: se
|
|
1647
1663
|
}), c && e.push({
|
|
1648
1664
|
name: "sys_toggle_inline_edit_mobile",
|
|
1649
1665
|
label: z(S ? "detail.save" : "detail.editInline"),
|
|
1650
1666
|
icon: "edit",
|
|
1651
1667
|
type: "script",
|
|
1652
1668
|
className: "sm:hidden",
|
|
1653
|
-
onClick:
|
|
1669
|
+
onClick: G
|
|
1654
1670
|
}), H.showDelete && e.push({
|
|
1655
1671
|
name: "sys_delete",
|
|
1656
1672
|
label: z("detail.delete"),
|
|
@@ -1658,7 +1674,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1658
1674
|
type: "script",
|
|
1659
1675
|
variant: "destructive",
|
|
1660
1676
|
tags: ["separator-before"],
|
|
1661
|
-
onClick:
|
|
1677
|
+
onClick: ue
|
|
1662
1678
|
}), e;
|
|
1663
1679
|
}, [
|
|
1664
1680
|
z,
|
|
@@ -1666,13 +1682,13 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1666
1682
|
H.showDelete,
|
|
1667
1683
|
c,
|
|
1668
1684
|
S,
|
|
1685
|
+
de,
|
|
1669
1686
|
se,
|
|
1670
|
-
|
|
1671
|
-
ue
|
|
1672
|
-
|
|
1673
|
-
]), he = n.useMemo(() => {
|
|
1687
|
+
G,
|
|
1688
|
+
ue
|
|
1689
|
+
]), J = n.useMemo(() => {
|
|
1674
1690
|
let e = H.actions ?? [];
|
|
1675
|
-
if (
|
|
1691
|
+
if (ge.length === 0) return e;
|
|
1676
1692
|
let t = !1, n = e.map((e) => {
|
|
1677
1693
|
let n = e;
|
|
1678
1694
|
if (n && typeof n == "object" && n.type === "action:bar" && (!n.location || n.location === "record_header")) {
|
|
@@ -1680,7 +1696,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1680
1696
|
let e = Array.isArray(n.systemActions) ? n.systemActions : [];
|
|
1681
1697
|
return {
|
|
1682
1698
|
...n,
|
|
1683
|
-
systemActions: [...e, ...
|
|
1699
|
+
systemActions: [...e, ...ge]
|
|
1684
1700
|
};
|
|
1685
1701
|
}
|
|
1686
1702
|
return e;
|
|
@@ -1688,9 +1704,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1688
1704
|
return t || n.push({
|
|
1689
1705
|
type: "action:bar",
|
|
1690
1706
|
location: "record_header",
|
|
1691
|
-
systemActions:
|
|
1707
|
+
systemActions: ge
|
|
1692
1708
|
}), n;
|
|
1693
|
-
}, [H.actions,
|
|
1709
|
+
}, [H.actions, ge]);
|
|
1694
1710
|
return v || H.loading ? /* @__PURE__ */ Q("div", {
|
|
1695
1711
|
className: L("space-y-4", i),
|
|
1696
1712
|
children: [
|
|
@@ -1712,9 +1728,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1712
1728
|
(H.showBack ?? !0) && /* @__PURE__ */ Q(g, {
|
|
1713
1729
|
variant: "outline",
|
|
1714
1730
|
size: "sm",
|
|
1715
|
-
onClick:
|
|
1731
|
+
onClick: oe,
|
|
1716
1732
|
className: "mt-4 gap-2",
|
|
1717
|
-
children: [/* @__PURE__ */ Z(
|
|
1733
|
+
children: [/* @__PURE__ */ Z(ne, { className: "h-4 w-4" }), z("detail.goBack")]
|
|
1718
1734
|
})
|
|
1719
1735
|
]
|
|
1720
1736
|
}) : /* @__PURE__ */ Z(F, { children: /* @__PURE__ */ Q("div", {
|
|
@@ -1729,9 +1745,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1729
1745
|
children: /* @__PURE__ */ Z(g, {
|
|
1730
1746
|
variant: "ghost",
|
|
1731
1747
|
size: "icon",
|
|
1732
|
-
onClick:
|
|
1748
|
+
onClick: oe,
|
|
1733
1749
|
className: "shrink-0 mt-1",
|
|
1734
|
-
children: /* @__PURE__ */ Z(
|
|
1750
|
+
children: /* @__PURE__ */ Z(ne, { className: "h-4 w-4" })
|
|
1735
1751
|
})
|
|
1736
1752
|
}), /* @__PURE__ */ Z(P, { children: z("detail.back") })] }), /* @__PURE__ */ Q("div", {
|
|
1737
1753
|
className: "flex-1 min-w-0",
|
|
@@ -1742,7 +1758,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1742
1758
|
className: "text-xl sm:text-2xl font-bold truncate",
|
|
1743
1759
|
children: zt(m, H, E, z("detail.details"))
|
|
1744
1760
|
}),
|
|
1745
|
-
|
|
1761
|
+
ie.map((e) => {
|
|
1746
1762
|
let t = m?.[e];
|
|
1747
1763
|
if (t == null || t === "") return null;
|
|
1748
1764
|
let n = (H.sections || []).flatMap((e) => e.fields).concat(H.fields || []).find((t) => t.name === e), r = E?.fields?.[e], i = n?.type || r?.type, a = String(t), o = null;
|
|
@@ -1776,7 +1792,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1776
1792
|
let e = i[String(t)];
|
|
1777
1793
|
e?.label && (o = e.label);
|
|
1778
1794
|
}
|
|
1779
|
-
a = H.objectName ?
|
|
1795
|
+
a = H.objectName ? B(H.objectName, e, String(t), o) : o;
|
|
1780
1796
|
}
|
|
1781
1797
|
} catch {}
|
|
1782
1798
|
return o === null ? /* @__PURE__ */ Z(h, {
|
|
@@ -1804,9 +1820,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1804
1820
|
variant: "ghost",
|
|
1805
1821
|
size: "icon",
|
|
1806
1822
|
className: "h-6 w-6 shrink-0",
|
|
1807
|
-
onClick:
|
|
1823
|
+
onClick: fe,
|
|
1808
1824
|
"aria-label": z(b ? "detail.removeFromFavorites" : "detail.addToFavorites"),
|
|
1809
|
-
children: b ? /* @__PURE__ */ Z(
|
|
1825
|
+
children: b ? /* @__PURE__ */ Z(Re, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z(Re, { className: "h-4 w-4 text-muted-foreground" })
|
|
1810
1826
|
})
|
|
1811
1827
|
}), /* @__PURE__ */ Z(P, { children: z(b ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
|
|
1812
1828
|
]
|
|
@@ -1821,9 +1837,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1821
1837
|
variant: "ghost",
|
|
1822
1838
|
size: "icon",
|
|
1823
1839
|
className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
|
|
1824
|
-
onClick:
|
|
1840
|
+
onClick: W,
|
|
1825
1841
|
"aria-label": z("detail.copyRecordId", { defaultValue: "Copy record ID" }),
|
|
1826
|
-
children: O ? /* @__PURE__ */ Z(ae, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(
|
|
1842
|
+
children: O ? /* @__PURE__ */ Z(ae, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(pe, { className: "h-3 w-3" })
|
|
1827
1843
|
})
|
|
1828
1844
|
}), /* @__PURE__ */ Z(P, { children: O ? z("detail.copied", { defaultValue: "Copied" }) : z("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
|
|
1829
1845
|
})]
|
|
@@ -1866,19 +1882,19 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1866
1882
|
let e = H.recordNavigation;
|
|
1867
1883
|
e.currentIndex < e.recordIds.length - 1 && e.onNavigate(e.recordIds[e.currentIndex + 1]);
|
|
1868
1884
|
},
|
|
1869
|
-
children: /* @__PURE__ */ Z(
|
|
1885
|
+
children: /* @__PURE__ */ Z(le, { className: "h-4 w-4" })
|
|
1870
1886
|
})
|
|
1871
1887
|
}), /* @__PURE__ */ Z(P, { children: z("detail.nextRecord") })] })
|
|
1872
1888
|
]
|
|
1873
1889
|
}),
|
|
1874
|
-
c && /* @__PURE__ */ Q(
|
|
1890
|
+
c && /* @__PURE__ */ Q($e, { children: [S && /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
|
|
1875
1891
|
asChild: !0,
|
|
1876
1892
|
children: /* @__PURE__ */ Q(g, {
|
|
1877
1893
|
variant: "ghost",
|
|
1878
1894
|
size: "sm",
|
|
1879
|
-
onClick:
|
|
1895
|
+
onClick: me,
|
|
1880
1896
|
className: "gap-2 hidden sm:inline-flex",
|
|
1881
|
-
children: [/* @__PURE__ */ Z(
|
|
1897
|
+
children: [/* @__PURE__ */ Z(Ve, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1882
1898
|
className: "hidden sm:inline",
|
|
1883
1899
|
children: z("detail.cancel")
|
|
1884
1900
|
})]
|
|
@@ -1888,12 +1904,12 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1888
1904
|
children: /* @__PURE__ */ Z(g, {
|
|
1889
1905
|
variant: S ? "default" : "outline",
|
|
1890
1906
|
size: "sm",
|
|
1891
|
-
onClick:
|
|
1907
|
+
onClick: G,
|
|
1892
1908
|
className: "gap-2 hidden sm:inline-flex",
|
|
1893
|
-
children: S ? /* @__PURE__ */ Q(
|
|
1909
|
+
children: S ? /* @__PURE__ */ Q($e, { children: [/* @__PURE__ */ Z(ae, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1894
1910
|
className: "hidden sm:inline",
|
|
1895
1911
|
children: z("detail.save")
|
|
1896
|
-
})] }) : /* @__PURE__ */ Q(
|
|
1912
|
+
})] }) : /* @__PURE__ */ Q($e, { children: [/* @__PURE__ */ Z(K, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1897
1913
|
className: "hidden sm:inline",
|
|
1898
1914
|
children: z("detail.editInline")
|
|
1899
1915
|
})] })
|
|
@@ -1903,22 +1919,22 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1903
1919
|
asChild: !0,
|
|
1904
1920
|
children: /* @__PURE__ */ Q(g, {
|
|
1905
1921
|
variant: "default",
|
|
1906
|
-
onClick:
|
|
1922
|
+
onClick: se,
|
|
1907
1923
|
className: "gap-2 hidden sm:inline-flex",
|
|
1908
|
-
children: [/* @__PURE__ */ Z(
|
|
1924
|
+
children: [/* @__PURE__ */ Z(K, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1909
1925
|
className: "hidden sm:inline",
|
|
1910
1926
|
children: z("detail.edit")
|
|
1911
1927
|
})]
|
|
1912
1928
|
})
|
|
1913
1929
|
}), /* @__PURE__ */ Z(P, { children: z("detail.editRecord") })] }),
|
|
1914
|
-
|
|
1930
|
+
J.map((e, t) => /* @__PURE__ */ Z(We, {
|
|
1915
1931
|
schema: e,
|
|
1916
1932
|
data: m
|
|
1917
1933
|
}, `header-action-${t}`))
|
|
1918
1934
|
]
|
|
1919
1935
|
})]
|
|
1920
1936
|
}),
|
|
1921
|
-
H.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(
|
|
1937
|
+
H.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(We, {
|
|
1922
1938
|
schema: H.header,
|
|
1923
1939
|
data: m
|
|
1924
1940
|
}) }),
|
|
@@ -1929,7 +1945,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1929
1945
|
objectSchema: E
|
|
1930
1946
|
}),
|
|
1931
1947
|
H.autoTabs && !H.tabs?.length ? (() => {
|
|
1932
|
-
let e =
|
|
1948
|
+
let e = he.length > 0, t = !!H.activities && H.activities.length > 0, n = !!u, i = !!H.history, a = /* @__PURE__ */ Q("div", {
|
|
1933
1949
|
className: "space-y-3 sm:space-y-4",
|
|
1934
1950
|
children: [
|
|
1935
1951
|
H.sectionGroups && H.sectionGroups.length > 0 && H.sectionGroups.map((e, t) => /* @__PURE__ */ Z(mt, {
|
|
@@ -1941,7 +1957,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1941
1957
|
objectSchema: E,
|
|
1942
1958
|
objectName: H.objectName,
|
|
1943
1959
|
isEditing: S,
|
|
1944
|
-
onFieldChange:
|
|
1960
|
+
onFieldChange: q
|
|
1945
1961
|
}, t)),
|
|
1946
1962
|
H.sections && H.sections.length > 0 && H.sections.map((e, t) => /* @__PURE__ */ Z(ut, {
|
|
1947
1963
|
section: e,
|
|
@@ -1952,7 +1968,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1952
1968
|
objectSchema: E,
|
|
1953
1969
|
objectName: H.objectName,
|
|
1954
1970
|
isEditing: S,
|
|
1955
|
-
onFieldChange:
|
|
1971
|
+
onFieldChange: q
|
|
1956
1972
|
}, t)),
|
|
1957
1973
|
H.fields && H.fields.length > 0 && !H.sections?.length && /* @__PURE__ */ Z(ut, {
|
|
1958
1974
|
section: {
|
|
@@ -1966,7 +1982,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1966
1982
|
objectSchema: E,
|
|
1967
1983
|
objectName: H.objectName,
|
|
1968
1984
|
isEditing: S,
|
|
1969
|
-
onFieldChange:
|
|
1985
|
+
onFieldChange: q
|
|
1970
1986
|
}),
|
|
1971
1987
|
H.comments && /* @__PURE__ */ Z(_t, {
|
|
1972
1988
|
comments: H.comments,
|
|
@@ -1997,7 +2013,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1997
2013
|
children: [z("detail.related"), /* @__PURE__ */ Z(h, {
|
|
1998
2014
|
variant: "secondary",
|
|
1999
2015
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2000
|
-
children:
|
|
2016
|
+
children: he.length
|
|
2001
2017
|
})]
|
|
2002
2018
|
})
|
|
2003
2019
|
}),
|
|
@@ -2042,7 +2058,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2042
2058
|
className: "mt-4",
|
|
2043
2059
|
children: /* @__PURE__ */ Z("div", {
|
|
2044
2060
|
className: "space-y-3",
|
|
2045
|
-
children:
|
|
2061
|
+
children: he.map((e, t) => /* @__PURE__ */ Z(pt, {
|
|
2046
2062
|
title: e.title,
|
|
2047
2063
|
type: e.type,
|
|
2048
2064
|
api: e.api,
|
|
@@ -2058,6 +2074,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2058
2074
|
onRowEdit: e.onRowEdit,
|
|
2059
2075
|
onRowDelete: e.onRowDelete,
|
|
2060
2076
|
collapsible: !0,
|
|
2077
|
+
defaultCollapsed: re && t > 0,
|
|
2061
2078
|
pageSize: Rt
|
|
2062
2079
|
}, t))
|
|
2063
2080
|
})
|
|
@@ -2083,7 +2100,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2083
2100
|
})
|
|
2084
2101
|
]
|
|
2085
2102
|
});
|
|
2086
|
-
})() : /* @__PURE__ */ Q(
|
|
2103
|
+
})() : /* @__PURE__ */ Q($e, { children: [
|
|
2087
2104
|
H.sectionGroups && H.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2088
2105
|
className: "space-y-3 sm:space-y-4",
|
|
2089
2106
|
children: H.sectionGroups.map((e, t) => /* @__PURE__ */ Z(mt, {
|
|
@@ -2095,7 +2112,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2095
2112
|
objectSchema: E,
|
|
2096
2113
|
objectName: H.objectName,
|
|
2097
2114
|
isEditing: S,
|
|
2098
|
-
onFieldChange:
|
|
2115
|
+
onFieldChange: q
|
|
2099
2116
|
}, t))
|
|
2100
2117
|
}),
|
|
2101
2118
|
H.sections && H.sections.length > 0 && /* @__PURE__ */ Z("div", {
|
|
@@ -2109,7 +2126,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2109
2126
|
objectSchema: E,
|
|
2110
2127
|
objectName: H.objectName,
|
|
2111
2128
|
isEditing: S,
|
|
2112
|
-
onFieldChange:
|
|
2129
|
+
onFieldChange: q
|
|
2113
2130
|
}, t))
|
|
2114
2131
|
}),
|
|
2115
2132
|
H.fields && H.fields.length > 0 && !H.sections?.length && /* @__PURE__ */ Z(ut, {
|
|
@@ -2124,18 +2141,18 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2124
2141
|
objectSchema: E,
|
|
2125
2142
|
objectName: H.objectName,
|
|
2126
2143
|
isEditing: S,
|
|
2127
|
-
onFieldChange:
|
|
2144
|
+
onFieldChange: q
|
|
2128
2145
|
}),
|
|
2129
2146
|
H.tabs && H.tabs.length > 0 && /* @__PURE__ */ Z(dt, {
|
|
2130
2147
|
tabs: H.tabs,
|
|
2131
2148
|
data: m
|
|
2132
2149
|
}),
|
|
2133
|
-
|
|
2150
|
+
he.length > 0 && /* @__PURE__ */ Q("div", {
|
|
2134
2151
|
className: "space-y-3",
|
|
2135
2152
|
children: [/* @__PURE__ */ Z("h2", {
|
|
2136
2153
|
className: "text-lg font-semibold",
|
|
2137
2154
|
children: z("detail.related")
|
|
2138
|
-
}),
|
|
2155
|
+
}), he.map((e, t) => /* @__PURE__ */ Z(pt, {
|
|
2139
2156
|
title: e.title,
|
|
2140
2157
|
type: e.type,
|
|
2141
2158
|
api: e.api,
|
|
@@ -2151,6 +2168,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2151
2168
|
onRowEdit: e.onRowEdit,
|
|
2152
2169
|
onRowDelete: e.onRowDelete,
|
|
2153
2170
|
collapsible: !0,
|
|
2171
|
+
defaultCollapsed: re && t > 0,
|
|
2154
2172
|
pageSize: Rt
|
|
2155
2173
|
}, t))]
|
|
2156
2174
|
}),
|
|
@@ -2168,7 +2186,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2168
2186
|
objectSchema: E,
|
|
2169
2187
|
objectName: H.objectName
|
|
2170
2188
|
}),
|
|
2171
|
-
H.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(
|
|
2189
|
+
H.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(We, {
|
|
2172
2190
|
schema: H.footer,
|
|
2173
2191
|
data: m
|
|
2174
2192
|
}) })
|
|
@@ -2185,7 +2203,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2185
2203
|
rest: i
|
|
2186
2204
|
};
|
|
2187
2205
|
}, Ut = ({ schema: e = {}, className: t, ...n }) => {
|
|
2188
|
-
let r =
|
|
2206
|
+
let r = qe(), { designer: i } = Ht(n);
|
|
2189
2207
|
if (!r) return /* @__PURE__ */ Z("div", {
|
|
2190
2208
|
className: t,
|
|
2191
2209
|
"data-record-details-placeholder": !0,
|
|
@@ -2251,7 +2269,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2251
2269
|
rest: i
|
|
2252
2270
|
};
|
|
2253
2271
|
}, Kt = ({ schema: e = {}, className: t, ...n }) => {
|
|
2254
|
-
let r =
|
|
2272
|
+
let r = qe(), { designer: i } = Gt(n), a = e.title || e.objectName || "Related", o = e.objectName;
|
|
2255
2273
|
if (!o) return /* @__PURE__ */ Z("div", {
|
|
2256
2274
|
className: t,
|
|
2257
2275
|
...i,
|
|
@@ -2304,7 +2322,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2304
2322
|
rest: i
|
|
2305
2323
|
};
|
|
2306
2324
|
}, Jt = ({ schema: e = {}, className: t, ...n }) => {
|
|
2307
|
-
let r =
|
|
2325
|
+
let r = qe(), { designer: i } = qt(n), a = r?.objectName || "", o = tt(), { readableFields: s } = et(a), c = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2308
2326
|
if (c.length > 0 && a && !c.every((e) => o.can(a, e))) return /* @__PURE__ */ Z("div", {
|
|
2309
2327
|
className: t,
|
|
2310
2328
|
...i,
|
|
@@ -2344,7 +2362,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2344
2362
|
className: "text-muted-foreground line-through",
|
|
2345
2363
|
children: r
|
|
2346
2364
|
}),
|
|
2347
|
-
/* @__PURE__ */ Z(
|
|
2365
|
+
/* @__PURE__ */ Z(z, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
2348
2366
|
/* @__PURE__ */ Z("span", {
|
|
2349
2367
|
className: "text-foreground",
|
|
2350
2368
|
children: i
|
|
@@ -2379,7 +2397,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2379
2397
|
className: "h-6 w-6",
|
|
2380
2398
|
onClick: () => o(!a),
|
|
2381
2399
|
"aria-label": "Add reaction",
|
|
2382
|
-
children: /* @__PURE__ */ Z(
|
|
2400
|
+
children: /* @__PURE__ */ Z(Le, { className: "h-3.5 w-3.5" })
|
|
2383
2401
|
}), a && /* @__PURE__ */ Z("div", {
|
|
2384
2402
|
className: "absolute bottom-full mb-1 left-0 bg-popover border rounded-md shadow-md z-50 p-1.5 flex gap-1",
|
|
2385
2403
|
role: "listbox",
|
|
@@ -2438,7 +2456,7 @@ var $t = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2438
2456
|
onClick: () => c(!s),
|
|
2439
2457
|
"aria-expanded": s,
|
|
2440
2458
|
children: [
|
|
2441
|
-
Z(s ? se :
|
|
2459
|
+
Z(s ? se : le, { className: "h-3 w-3" }),
|
|
2442
2460
|
/* @__PURE__ */ Z(Te, { className: "h-3 w-3" }),
|
|
2443
2461
|
/* @__PURE__ */ Z("span", { children: t.length === 1 ? o("detail.replyCount", { count: t.length }) : o("detail.replyCountPlural", { count: t.length }) })
|
|
2444
2462
|
]
|
|
@@ -2491,7 +2509,7 @@ var $t = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2491
2509
|
onClick: p,
|
|
2492
2510
|
disabled: !l.trim() || d,
|
|
2493
2511
|
"aria-label": "Send reply",
|
|
2494
|
-
children: /* @__PURE__ */ Z(
|
|
2512
|
+
children: /* @__PURE__ */ Z(Ie, { className: "h-3 w-3" })
|
|
2495
2513
|
})]
|
|
2496
2514
|
})
|
|
2497
2515
|
]
|
|
@@ -2515,16 +2533,16 @@ var $t = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2515
2533
|
disabled: a || !t,
|
|
2516
2534
|
"aria-label": e.subscribed ? i("detail.unsubscribeAriaLabel") : i("detail.subscribeAriaLabel"),
|
|
2517
2535
|
title: e.subscribed ? i("detail.subscribedTooltip") : i("detail.unsubscribedTooltip"),
|
|
2518
|
-
children: e.subscribed ? /* @__PURE__ */ Z(
|
|
2536
|
+
children: e.subscribed ? /* @__PURE__ */ Z(H, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(U, { className: "h-4 w-4 text-muted-foreground" })
|
|
2519
2537
|
});
|
|
2520
2538
|
}, tn = {
|
|
2521
2539
|
comment: Te,
|
|
2522
|
-
field_change:
|
|
2540
|
+
field_change: K,
|
|
2523
2541
|
task: oe,
|
|
2524
|
-
event:
|
|
2525
|
-
system:
|
|
2542
|
+
event: W,
|
|
2543
|
+
system: He,
|
|
2526
2544
|
email: we,
|
|
2527
|
-
call:
|
|
2545
|
+
call: ke
|
|
2528
2546
|
}, nn = {
|
|
2529
2547
|
comment: "bg-purple-100 text-purple-600",
|
|
2530
2548
|
field_change: "bg-blue-100 text-blue-600",
|
|
@@ -2576,7 +2594,7 @@ function on(e, t) {
|
|
|
2576
2594
|
}
|
|
2577
2595
|
}
|
|
2578
2596
|
var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a = !1, onLoadMore: o, loading: s = !1, onAddComment: c, onAddReply: l, onToggleReaction: u, subscription: d, onToggleSubscription: f, collapseWhenEmpty: p = !1, titleLabel: m, emptyLabel: h, className: x }) => {
|
|
2579
|
-
let { t: S } = $(), [C, w] = n.useState("all"), [T, E] = n.useState(""), [D, O] = n.useState(!1), [k, A] = n.useState(!1), j = r ?? C, ee = t?.showFilterToggle !== !1, M = t?.showCommentInput !== !1 && !!c, N = t?.enableReactions ?? !1, P = t?.enableThreading ?? !1, F = t?.showSubscriptionToggle ?? !1, I = n.useMemo(() => on(e, j), [e, j]),
|
|
2597
|
+
let { t: S } = $(), [C, w] = n.useState("all"), [T, E] = n.useState(""), [D, O] = n.useState(!1), [k, A] = n.useState(!1), j = r ?? C, ee = t?.showFilterToggle !== !1, M = t?.showCommentInput !== !1 && !!c, N = t?.enableReactions ?? !1, P = t?.enableThreading ?? !1, F = t?.showSubscriptionToggle ?? !1, I = n.useMemo(() => on(e, j), [e, j]), te = n.useMemo(() => P ? I.filter((e) => !e.parentId) : I, [I, P]), ne = n.useMemo(() => {
|
|
2580
2598
|
if (!P) return /* @__PURE__ */ new Map();
|
|
2581
2599
|
let e = /* @__PURE__ */ new Map();
|
|
2582
2600
|
for (let t of I) if (t.parentId) {
|
|
@@ -2584,9 +2602,9 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2584
2602
|
n.push(t), e.set(t.parentId, n);
|
|
2585
2603
|
}
|
|
2586
2604
|
return e;
|
|
2587
|
-
}, [I, P]),
|
|
2605
|
+
}, [I, P]), z = n.useCallback((e) => {
|
|
2588
2606
|
i ? i(e) : w(e);
|
|
2589
|
-
}, [i]),
|
|
2607
|
+
}, [i]), B = n.useCallback(async () => {
|
|
2590
2608
|
let e = T.trim();
|
|
2591
2609
|
if (!(!e || !c)) {
|
|
2592
2610
|
O(!0);
|
|
@@ -2596,9 +2614,9 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2596
2614
|
O(!1);
|
|
2597
2615
|
}
|
|
2598
2616
|
}
|
|
2599
|
-
}, [T, c]),
|
|
2600
|
-
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(),
|
|
2601
|
-
}, [
|
|
2617
|
+
}, [T, c]), re = n.useCallback((e) => {
|
|
2618
|
+
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), B());
|
|
2619
|
+
}, [B]), V = n.useCallback(async () => {
|
|
2602
2620
|
if (o) {
|
|
2603
2621
|
A(!0);
|
|
2604
2622
|
try {
|
|
@@ -2615,7 +2633,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2615
2633
|
children: [/* @__PURE__ */ Q(b, {
|
|
2616
2634
|
className: "flex items-center gap-2 text-base",
|
|
2617
2635
|
children: [
|
|
2618
|
-
/* @__PURE__ */ Z(
|
|
2636
|
+
/* @__PURE__ */ Z(R, { className: "h-4 w-4" }),
|
|
2619
2637
|
m ?? S("detail.activity"),
|
|
2620
2638
|
/* @__PURE__ */ Q("span", {
|
|
2621
2639
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -2641,7 +2659,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2641
2659
|
children: /* @__PURE__ */ Z("select", {
|
|
2642
2660
|
className: "rounded-md border border-input bg-background px-2.5 py-1.5 text-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
2643
2661
|
value: j,
|
|
2644
|
-
onChange: (e) =>
|
|
2662
|
+
onChange: (e) => z(e.target.value),
|
|
2645
2663
|
"aria-label": S("detail.filterActivity"),
|
|
2646
2664
|
children: rn(S).map((e) => /* @__PURE__ */ Z("option", {
|
|
2647
2665
|
value: e.value,
|
|
@@ -2656,16 +2674,16 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2656
2674
|
placeholder: S("detail.leaveCommentPlaceholder"),
|
|
2657
2675
|
value: T,
|
|
2658
2676
|
onChange: (e) => E(e.target.value),
|
|
2659
|
-
onKeyDown:
|
|
2677
|
+
onKeyDown: re,
|
|
2660
2678
|
disabled: D
|
|
2661
2679
|
}), /* @__PURE__ */ Q(g, {
|
|
2662
2680
|
variant: "default",
|
|
2663
|
-
onClick:
|
|
2681
|
+
onClick: B,
|
|
2664
2682
|
disabled: !T.trim() || D,
|
|
2665
2683
|
className: "shrink-0 self-end gap-1.5",
|
|
2666
2684
|
"aria-label": S("detail.submitComment"),
|
|
2667
2685
|
title: S("detail.submitComment"),
|
|
2668
|
-
children: [/* @__PURE__ */ Z(
|
|
2686
|
+
children: [/* @__PURE__ */ Z(Ie, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: S("detail.sendComment") })]
|
|
2669
2687
|
})]
|
|
2670
2688
|
}),
|
|
2671
2689
|
I.length === 0 ? p ? null : /* @__PURE__ */ Z("p", {
|
|
@@ -2675,8 +2693,8 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2675
2693
|
className: "relative",
|
|
2676
2694
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
2677
2695
|
className: "space-y-4",
|
|
2678
|
-
children:
|
|
2679
|
-
let t = tn[e.type] ||
|
|
2696
|
+
children: te.map((e) => {
|
|
2697
|
+
let t = tn[e.type] || He, n = nn[e.type] || "bg-gray-100 text-gray-600", r = ne.get(e.id) ?? [];
|
|
2680
2698
|
return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
|
|
2681
2699
|
className: "flex gap-3 relative",
|
|
2682
2700
|
children: [/* @__PURE__ */ Z("div", {
|
|
@@ -2752,7 +2770,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2752
2770
|
children: /* @__PURE__ */ Q(g, {
|
|
2753
2771
|
variant: "ghost",
|
|
2754
2772
|
size: "sm",
|
|
2755
|
-
onClick:
|
|
2773
|
+
onClick: V,
|
|
2756
2774
|
disabled: k,
|
|
2757
2775
|
"aria-label": S("detail.loadMore"),
|
|
2758
2776
|
children: [k ? /* @__PURE__ */ Z(Ce, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(se, { className: "h-4 w-4 mr-1" }), S("detail.loadMore")]
|
|
@@ -2772,7 +2790,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2772
2790
|
rest: i
|
|
2773
2791
|
};
|
|
2774
2792
|
}, ln = ({ schema: e = {}, className: t, ...n }) => {
|
|
2775
|
-
|
|
2793
|
+
qe();
|
|
2776
2794
|
let { designer: r } = cn(n);
|
|
2777
2795
|
return /* @__PURE__ */ Z("div", {
|
|
2778
2796
|
className: t,
|
|
@@ -2792,7 +2810,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2792
2810
|
className: "h-8 w-8 mx-1",
|
|
2793
2811
|
onClick: () => S(!1),
|
|
2794
2812
|
"aria-label": b("detail.openDiscussion"),
|
|
2795
|
-
children: /* @__PURE__ */ Z(
|
|
2813
|
+
children: /* @__PURE__ */ Z(X, { className: "h-4 w-4" })
|
|
2796
2814
|
})
|
|
2797
2815
|
}) : /* @__PURE__ */ Q("div", {
|
|
2798
2816
|
className: L("flex flex-col overflow-hidden", h === "right" ? "border-l" : "border-r", m),
|
|
@@ -2814,7 +2832,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2814
2832
|
className: "h-7 w-7",
|
|
2815
2833
|
onClick: () => S(!0),
|
|
2816
2834
|
"aria-label": b("detail.closeDiscussion"),
|
|
2817
|
-
children: /* @__PURE__ */ Z(
|
|
2835
|
+
children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
|
|
2818
2836
|
})]
|
|
2819
2837
|
}), /* @__PURE__ */ Z("div", {
|
|
2820
2838
|
className: "flex-1 overflow-y-auto",
|
|
@@ -2887,7 +2905,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2887
2905
|
rest: i
|
|
2888
2906
|
};
|
|
2889
2907
|
}, fn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2890
|
-
|
|
2908
|
+
qe();
|
|
2891
2909
|
let { designer: r } = dn(n);
|
|
2892
2910
|
return /* @__PURE__ */ Z("div", {
|
|
2893
2911
|
className: t,
|
|
@@ -2908,7 +2926,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2908
2926
|
rest: i
|
|
2909
2927
|
};
|
|
2910
2928
|
}, mn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2911
|
-
let r =
|
|
2929
|
+
let r = qe(), { designer: i } = pn(n), a = Array.isArray(e.stages) ? e.stages : [], o = e.statusField, s = o && r?.data ? r.data[o] : void 0, c = a.findIndex((e) => e.value === s);
|
|
2912
2930
|
return c < 0 && (c = -1), a.length === 0 ? /* @__PURE__ */ Z("div", {
|
|
2913
2931
|
className: t,
|
|
2914
2932
|
...i,
|
|
@@ -2948,7 +2966,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2948
2966
|
rest: i
|
|
2949
2967
|
};
|
|
2950
2968
|
}, gn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2951
|
-
let r =
|
|
2969
|
+
let r = qe(), { designer: i } = hn(n), a = tt(), o = Array.isArray(e.actions) ? e.actions : Array.isArray(e.properties?.actions) ? e.properties.actions : [], s = r?.objectName || "", c = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2952
2970
|
if (c.length > 0 && s && !c.every((e) => a.can(s, e))) return /* @__PURE__ */ Z("div", {
|
|
2953
2971
|
className: t,
|
|
2954
2972
|
...i,
|
|
@@ -2959,7 +2977,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2959
2977
|
children: "Insufficient permissions to view quick actions."
|
|
2960
2978
|
})
|
|
2961
2979
|
});
|
|
2962
|
-
let l = e.location || "record_header", { getActionsForLocation: u, executeAction: d } =
|
|
2980
|
+
let l = e.location || "record_header", { getActionsForLocation: u, executeAction: d } = Ge({
|
|
2963
2981
|
actions: o,
|
|
2964
2982
|
context: {
|
|
2965
2983
|
record: r?.data,
|
|
@@ -3193,7 +3211,7 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3193
3211
|
E(!1);
|
|
3194
3212
|
}
|
|
3195
3213
|
}
|
|
3196
|
-
}, [a]),
|
|
3214
|
+
}, [a]), te = n.useMemo(() => r.filter((e) => e.required).every((e) => p[e.name]?.toString().trim()), [r, p]);
|
|
3197
3215
|
return l ? /* @__PURE__ */ Q(_, {
|
|
3198
3216
|
className: L("", c),
|
|
3199
3217
|
children: [/* @__PURE__ */ Z(y, {
|
|
@@ -3209,7 +3227,7 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3209
3227
|
size: "icon",
|
|
3210
3228
|
className: "h-6 w-6",
|
|
3211
3229
|
onClick: () => u(!1),
|
|
3212
|
-
children: /* @__PURE__ */ Z(
|
|
3230
|
+
children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
|
|
3213
3231
|
})]
|
|
3214
3232
|
})
|
|
3215
3233
|
}), /* @__PURE__ */ Z(v, { children: /* @__PURE__ */ Q(A, {
|
|
@@ -3221,7 +3239,7 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3221
3239
|
children: [i && /* @__PURE__ */ Q(M, {
|
|
3222
3240
|
value: "create",
|
|
3223
3241
|
className: "flex-1 gap-1.5",
|
|
3224
|
-
children: [/* @__PURE__ */ Z(
|
|
3242
|
+
children: [/* @__PURE__ */ Z(je, { className: "h-3.5 w-3.5" }), "Create New"]
|
|
3225
3243
|
}), a && /* @__PURE__ */ Q(M, {
|
|
3226
3244
|
value: "link",
|
|
3227
3245
|
className: "flex-1 gap-1.5",
|
|
@@ -3253,7 +3271,7 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3253
3271
|
}), /* @__PURE__ */ Q(g, {
|
|
3254
3272
|
size: "sm",
|
|
3255
3273
|
onClick: F,
|
|
3256
|
-
disabled: !
|
|
3274
|
+
disabled: !te || T,
|
|
3257
3275
|
className: "gap-1.5",
|
|
3258
3276
|
children: [T && /* @__PURE__ */ Z(Ce, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
|
|
3259
3277
|
})]
|
|
@@ -3264,7 +3282,7 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3264
3282
|
className: "space-y-3 mt-0",
|
|
3265
3283
|
children: [/* @__PURE__ */ Q("div", {
|
|
3266
3284
|
className: "relative",
|
|
3267
|
-
children: [/* @__PURE__ */ Z(
|
|
3285
|
+
children: [/* @__PURE__ */ Z(Fe, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }), /* @__PURE__ */ Z(w, {
|
|
3268
3286
|
placeholder: `Search ${e}…`,
|
|
3269
3287
|
value: h,
|
|
3270
3288
|
onChange: (e) => N(e.target.value),
|
|
@@ -3305,7 +3323,7 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3305
3323
|
},
|
|
3306
3324
|
className: "gap-1.5",
|
|
3307
3325
|
children: [
|
|
3308
|
-
/* @__PURE__ */ Z(
|
|
3326
|
+
/* @__PURE__ */ Z(je, { className: "h-3.5 w-3.5" }),
|
|
3309
3327
|
"New ",
|
|
3310
3328
|
e
|
|
3311
3329
|
]
|
|
@@ -3398,7 +3416,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3398
3416
|
onClick: x,
|
|
3399
3417
|
disabled: s || l,
|
|
3400
3418
|
title: c("detail.bold"),
|
|
3401
|
-
children: /* @__PURE__ */ Z(
|
|
3419
|
+
children: /* @__PURE__ */ Z(ie, { className: "h-3.5 w-3.5" })
|
|
3402
3420
|
}),
|
|
3403
3421
|
/* @__PURE__ */ Z(g, {
|
|
3404
3422
|
variant: "ghost",
|
|
@@ -3425,7 +3443,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3425
3443
|
onClick: w,
|
|
3426
3444
|
disabled: s || l,
|
|
3427
3445
|
title: c("detail.inlineCode"),
|
|
3428
|
-
children: /* @__PURE__ */ Z(
|
|
3446
|
+
children: /* @__PURE__ */ Z(fe, { className: "h-3.5 w-3.5" })
|
|
3429
3447
|
}),
|
|
3430
3448
|
/* @__PURE__ */ Z(g, {
|
|
3431
3449
|
variant: "ghost",
|
|
@@ -3434,7 +3452,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3434
3452
|
onClick: T,
|
|
3435
3453
|
disabled: s || l,
|
|
3436
3454
|
title: c("detail.mentionSomeone"),
|
|
3437
|
-
children: /* @__PURE__ */ Z(
|
|
3455
|
+
children: /* @__PURE__ */ Z(V, { className: "h-3.5 w-3.5" })
|
|
3438
3456
|
}),
|
|
3439
3457
|
/* @__PURE__ */ Z("div", { className: "flex-1" }),
|
|
3440
3458
|
/* @__PURE__ */ Z(g, {
|
|
@@ -3443,7 +3461,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3443
3461
|
className: "h-7 w-7",
|
|
3444
3462
|
onClick: () => u(!l),
|
|
3445
3463
|
title: c(l ? "detail.edit" : "detail.preview"),
|
|
3446
|
-
children: Z(l ?
|
|
3464
|
+
children: Z(l ? K : q, { className: "h-3.5 w-3.5" })
|
|
3447
3465
|
}),
|
|
3448
3466
|
r && /* @__PURE__ */ Z(g, {
|
|
3449
3467
|
variant: "ghost",
|
|
@@ -3452,7 +3470,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3452
3470
|
onClick: r,
|
|
3453
3471
|
disabled: s || !e.trim(),
|
|
3454
3472
|
title: c("detail.submitComment"),
|
|
3455
|
-
children: /* @__PURE__ */ Z(
|
|
3473
|
+
children: /* @__PURE__ */ Z(Ie, { className: "h-3.5 w-3.5" })
|
|
3456
3474
|
})
|
|
3457
3475
|
]
|
|
3458
3476
|
}), /* @__PURE__ */ Z("div", {
|
|
@@ -3460,7 +3478,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3460
3478
|
children: l ? /* @__PURE__ */ Z("div", {
|
|
3461
3479
|
className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
|
|
3462
3480
|
dangerouslySetInnerHTML: { __html: Cn(e) }
|
|
3463
|
-
}) : /* @__PURE__ */ Q(
|
|
3481
|
+
}) : /* @__PURE__ */ Q($e, { children: [/* @__PURE__ */ Z("textarea", {
|
|
3464
3482
|
ref: v,
|
|
3465
3483
|
className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
|
|
3466
3484
|
placeholder: a ?? c("detail.writeComment"),
|
|
@@ -3578,14 +3596,14 @@ var Dn = {
|
|
|
3578
3596
|
className: "h-7 w-7",
|
|
3579
3597
|
onClick: () => l("unified"),
|
|
3580
3598
|
title: s("detail.unifiedDiff"),
|
|
3581
|
-
children: /* @__PURE__ */ Z(
|
|
3599
|
+
children: /* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" })
|
|
3582
3600
|
}), /* @__PURE__ */ Z(g, {
|
|
3583
3601
|
variant: c === "side-by-side" ? "secondary" : "ghost",
|
|
3584
3602
|
size: "icon",
|
|
3585
3603
|
className: "h-7 w-7",
|
|
3586
3604
|
onClick: () => l("side-by-side"),
|
|
3587
3605
|
title: s("detail.sideBySideDiff"),
|
|
3588
|
-
children: /* @__PURE__ */ Z(
|
|
3606
|
+
children: /* @__PURE__ */ Z(G, { className: "h-3.5 w-3.5" })
|
|
3589
3607
|
})]
|
|
3590
3608
|
})]
|
|
3591
3609
|
})
|
|
@@ -3705,7 +3723,7 @@ var Dn = {
|
|
|
3705
3723
|
disabled: !p,
|
|
3706
3724
|
onClick: v,
|
|
3707
3725
|
title: s("detail.firstRecord"),
|
|
3708
|
-
children: /* @__PURE__ */ Z(
|
|
3726
|
+
children: /* @__PURE__ */ Z(ue, { className: "h-4 w-4" })
|
|
3709
3727
|
}),
|
|
3710
3728
|
/* @__PURE__ */ Z(g, {
|
|
3711
3729
|
variant: "outline",
|
|
@@ -3730,7 +3748,7 @@ var Dn = {
|
|
|
3730
3748
|
disabled: !h,
|
|
3731
3749
|
onClick: b,
|
|
3732
3750
|
title: s("detail.nextRecordKey"),
|
|
3733
|
-
children: /* @__PURE__ */ Z(
|
|
3751
|
+
children: /* @__PURE__ */ Z(le, { className: "h-4 w-4" })
|
|
3734
3752
|
}),
|
|
3735
3753
|
/* @__PURE__ */ Z(g, {
|
|
3736
3754
|
variant: "outline",
|
|
@@ -3739,15 +3757,15 @@ var Dn = {
|
|
|
3739
3757
|
disabled: !_,
|
|
3740
3758
|
onClick: x,
|
|
3741
3759
|
title: s("detail.lastRecord"),
|
|
3742
|
-
children: /* @__PURE__ */ Z(
|
|
3760
|
+
children: /* @__PURE__ */ Z(de, { className: "h-4 w-4" })
|
|
3743
3761
|
}),
|
|
3744
|
-
a && /* @__PURE__ */ Q(
|
|
3762
|
+
a && /* @__PURE__ */ Q($e, { children: [/* @__PURE__ */ Z(g, {
|
|
3745
3763
|
variant: u ? "secondary" : "ghost",
|
|
3746
3764
|
size: "icon",
|
|
3747
3765
|
className: "h-8 w-8",
|
|
3748
3766
|
onClick: C,
|
|
3749
3767
|
title: s("detail.searchWhileNavigating"),
|
|
3750
|
-
children: /* @__PURE__ */ Z(
|
|
3768
|
+
children: /* @__PURE__ */ Z(Fe, { className: "h-4 w-4" })
|
|
3751
3769
|
}), u && /* @__PURE__ */ Z("div", {
|
|
3752
3770
|
className: "relative",
|
|
3753
3771
|
children: /* @__PURE__ */ Z(w, {
|
|
@@ -3933,7 +3951,7 @@ var In = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
3933
3951
|
className: "fill-muted-foreground text-[9px] pointer-events-none",
|
|
3934
3952
|
children: e.type
|
|
3935
3953
|
}),
|
|
3936
|
-
t && /* @__PURE__ */ Q(
|
|
3954
|
+
t && /* @__PURE__ */ Q($e, { children: [/* @__PURE__ */ Z("rect", {
|
|
3937
3955
|
x: e.x - 50,
|
|
3938
3956
|
y: e.y - a - 28,
|
|
3939
3957
|
width: 100,
|
|
@@ -3965,7 +3983,7 @@ function Rn(e) {
|
|
|
3965
3983
|
return e.startsWith("image/");
|
|
3966
3984
|
}
|
|
3967
3985
|
function zn(e) {
|
|
3968
|
-
return Rn(e) ?
|
|
3986
|
+
return Rn(e) ? ye : e.includes("pdf") || e.includes("document") || e.includes("text") ? _e : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? J : ge;
|
|
3969
3987
|
}
|
|
3970
3988
|
var Bn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a = !1 }) => {
|
|
3971
3989
|
let { t: o } = $(), [s, c] = n.useState(!1), l = n.useRef(null), u = n.useCallback((e) => {
|
|
@@ -3991,7 +4009,7 @@ var Bn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3991
4009
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), l.current?.click());
|
|
3992
4010
|
},
|
|
3993
4011
|
children: [
|
|
3994
|
-
/* @__PURE__ */ Z(
|
|
4012
|
+
/* @__PURE__ */ Z(Be, { className: "h-5 w-5 mx-auto text-muted-foreground mb-1" }),
|
|
3995
4013
|
/* @__PURE__ */ Z("p", {
|
|
3996
4014
|
className: "text-xs text-muted-foreground",
|
|
3997
4015
|
children: o("detail.dropFilesToUpload")
|
|
@@ -4008,7 +4026,7 @@ var Bn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
4008
4026
|
className: "space-y-1.5",
|
|
4009
4027
|
children: [/* @__PURE__ */ Q("div", {
|
|
4010
4028
|
className: "flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
4011
|
-
children: [/* @__PURE__ */ Z(
|
|
4029
|
+
children: [/* @__PURE__ */ Z(Oe, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: e.length === 1 ? o("detail.attachmentCount", { count: e.length }) : o("detail.attachmentCountPlural", { count: e.length }) })]
|
|
4012
4030
|
}), /* @__PURE__ */ Z("div", {
|
|
4013
4031
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
|
|
4014
4032
|
children: e.map((e) => {
|
|
@@ -4040,7 +4058,7 @@ var Bn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
4040
4058
|
className: "h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
4041
4059
|
onClick: () => r(e.id),
|
|
4042
4060
|
title: o("detail.removeAttachment"),
|
|
4043
|
-
children: /* @__PURE__ */ Z(
|
|
4061
|
+
children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
|
|
4044
4062
|
})
|
|
4045
4063
|
]
|
|
4046
4064
|
}, e.id);
|
|
@@ -4124,7 +4142,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4124
4142
|
},
|
|
4125
4143
|
children: [/* @__PURE__ */ Z("div", {
|
|
4126
4144
|
className: L("shrink-0 h-6 w-6 rounded-full border-2 flex items-center justify-center z-10 mt-0.5", t ? "border-primary bg-primary" : "border-border bg-background"),
|
|
4127
|
-
children: t && /* @__PURE__ */ Z(
|
|
4145
|
+
children: t && /* @__PURE__ */ Z(le, { className: "h-3 w-3 text-primary-foreground" })
|
|
4128
4146
|
}), /* @__PURE__ */ Q("div", {
|
|
4129
4147
|
className: "flex-1 min-w-0",
|
|
4130
4148
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -4172,7 +4190,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4172
4190
|
className: "line-through text-red-600 dark:text-red-400 truncate max-w-[120px]",
|
|
4173
4191
|
children: e.oldValue == null ? "(empty)" : String(e.oldValue)
|
|
4174
4192
|
}),
|
|
4175
|
-
/* @__PURE__ */ Z(
|
|
4193
|
+
/* @__PURE__ */ Z(le, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
4176
4194
|
/* @__PURE__ */ Z("span", {
|
|
4177
4195
|
className: "text-green-600 dark:text-green-400 truncate max-w-[120px]",
|
|
4178
4196
|
children: e.newValue == null ? "(empty)" : String(e.newValue)
|
|
@@ -4202,7 +4220,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4202
4220
|
}),
|
|
4203
4221
|
r && /* @__PURE__ */ Z("div", {
|
|
4204
4222
|
className: "pt-1 space-y-2",
|
|
4205
|
-
children: s ? /* @__PURE__ */ Q(
|
|
4223
|
+
children: s ? /* @__PURE__ */ Q($e, { children: [/* @__PURE__ */ Q("p", {
|
|
4206
4224
|
className: "text-xs text-amber-600 dark:text-amber-400",
|
|
4207
4225
|
children: [
|
|
4208
4226
|
"This will restore the record to its state at",
|
|
@@ -4218,7 +4236,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4218
4236
|
className: "gap-1.5 flex-1",
|
|
4219
4237
|
onClick: f,
|
|
4220
4238
|
disabled: l,
|
|
4221
|
-
children: [/* @__PURE__ */ Z(
|
|
4239
|
+
children: [/* @__PURE__ */ Z(Ne, { className: "h-3.5 w-3.5" }), l ? "Restoring…" : "Confirm Restore"]
|
|
4222
4240
|
}), /* @__PURE__ */ Z(g, {
|
|
4223
4241
|
variant: "ghost",
|
|
4224
4242
|
size: "sm",
|
|
@@ -4231,7 +4249,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4231
4249
|
size: "sm",
|
|
4232
4250
|
className: "w-full gap-1.5",
|
|
4233
4251
|
onClick: f,
|
|
4234
|
-
children: [/* @__PURE__ */ Z(
|
|
4252
|
+
children: [/* @__PURE__ */ Z(Ne, { className: "h-3.5 w-3.5" }), "Restore to this point"]
|
|
4235
4253
|
})
|
|
4236
4254
|
})
|
|
4237
4255
|
]
|
|
@@ -4268,7 +4286,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4268
4286
|
disabled: !a.trim() || s || r,
|
|
4269
4287
|
className: "shrink-0 self-end",
|
|
4270
4288
|
"aria-label": "Submit comment",
|
|
4271
|
-
children: /* @__PURE__ */ Z(
|
|
4289
|
+
children: /* @__PURE__ */ Z(Ie, { className: "h-4 w-4" })
|
|
4272
4290
|
})]
|
|
4273
4291
|
});
|
|
4274
4292
|
}, Wn = ({ query: e, suggestions: t, onSelect: r, visible: i = !0, activeIndex: a = 0, className: o }) => {
|