@object-ui/plugin-detail 7.0.0 → 7.2.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/CHANGELOG.md +17 -0
- package/dist/RelatedList.d.ts +19 -0
- package/dist/RelatedList.d.ts.map +1 -1
- package/dist/index.js +781 -719
- package/dist/index.umd.cjs +3 -3
- package/dist/renderers/record-related-list.d.ts.map +1 -1
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
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 { Alert as i, AlertDescription as a, AlertDialog as o, AlertDialogAction as s, AlertDialogCancel as c, AlertDialogContent as l, AlertDialogDescription as u, AlertDialogFooter as d, AlertDialogHeader as f, AlertDialogTitle as p, AlertTitle as m, Avatar as h, AvatarFallback as g, AvatarImage as _, Badge as v, Button as y, Card as b, CardContent as x, CardHeader as S, CardTitle as C, Collapsible as w, CollapsibleContent as T, CollapsibleTrigger as E, DataEmptyState as D, Input as O, LazyIcon as k, Select as A, SelectContent as j, SelectItem as M, SelectTrigger as N, SelectValue as ee, Sheet as P, SheetContent as
|
|
5
|
-
import { Activity as
|
|
4
|
+
import { Alert as i, AlertDescription as a, AlertDialog as o, AlertDialogAction as s, AlertDialogCancel as c, AlertDialogContent as l, AlertDialogDescription as u, AlertDialogFooter as d, AlertDialogHeader as f, AlertDialogTitle as p, AlertTitle as m, Avatar as h, AvatarFallback as g, AvatarImage as _, Badge as v, Button as y, Card as b, CardContent as x, CardHeader as S, CardTitle as C, Collapsible as w, CollapsibleContent as T, CollapsibleTrigger as E, DataEmptyState as D, Input as O, LazyIcon as k, Select as A, SelectContent as j, SelectItem as M, SelectTrigger as N, SelectValue as ee, Sheet as P, SheetContent as te, SheetHeader as F, SheetTitle as I, Skeleton as L, Tabs as ne, TabsContent as R, TabsList as z, TabsTrigger as B, Tooltip as V, TooltipContent as H, TooltipProvider as re, TooltipTrigger as U, buttonVariants as W, cn as G, useIsMobile as ie } from "@object-ui/components";
|
|
5
|
+
import { Activity as ae, AlertTriangle as K, ArrowLeft as oe, ArrowRight as se, ArrowRightLeft as ce, ArrowUpDown as le, AtSign as q, Bell as J, BellOff as ue, Bold as de, Calendar as fe, Check as pe, CheckSquare as me, ChevronDown as he, ChevronLeft as ge, ChevronRight as _e, ChevronsLeft as ve, ChevronsRight as ye, Code as be, Columns2 as xe, Copy as Se, Edit as Ce, ExternalLink as we, Eye as Te, EyeOff as Y, File as Ee, FileArchive as De, FileText as Oe, History as X, Image as ke, Inbox as Ae, Italic as je, Link as Me, List as Ne, Loader2 as Pe, Lock as Fe, Mail as Ie, MessageSquare as Le, Network as Re, PanelRightClose as ze, PanelRightOpen as Be, Paperclip as Ve, Phone as He, Pin as Ue, Plus as We, PlusCircle as Ge, RotateCcw as Ke, Rows3 as qe, Search as Je, Send as Ye, SmilePlus as Xe, Star as Ze, Trash2 as Qe, Upload as $e, X as et, Zap as tt, icons as nt } from "lucide-react";
|
|
6
6
|
import { SchemaRenderer as rt, toPredicateInput as it, useActionEngine as at, useCondition as ot, useDiscussionContext as st, useHighlightFieldNames as ct, useMetadataItem as lt, useObjectTranslation as ut, useRecordContext as dt, useRegisterHighlightFields as ft, useSafeFieldLabel as pt } from "@object-ui/react";
|
|
7
|
-
import { BooleanField as mt,
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { useFieldPermissions as
|
|
10
|
-
import { resolveFieldCurrency as
|
|
11
|
-
import { Link as
|
|
7
|
+
import { BooleanField as mt, RecordPickerDialog as ht, SelectField as gt, getCellRenderer as _t, humanizeLabel as vt, resolveCellRendererType as yt } from "@object-ui/fields";
|
|
8
|
+
import { Fragment as bt, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
9
|
+
import { useFieldPermissions as xt, usePermissions as St } from "@object-ui/permissions";
|
|
10
|
+
import { resolveFieldCurrency as Ct, useLocalization as wt } from "@object-ui/i18n";
|
|
11
|
+
import { Link as Tt, useParams as Et } from "react-router-dom";
|
|
12
12
|
//#region src/autoLayout.ts
|
|
13
|
-
var
|
|
13
|
+
var Dt = new Set([
|
|
14
14
|
"textarea",
|
|
15
15
|
"markdown",
|
|
16
16
|
"html",
|
|
@@ -22,33 +22,33 @@ var Et = new Set([
|
|
|
22
22
|
"field:grid",
|
|
23
23
|
"field:rich-text"
|
|
24
24
|
]);
|
|
25
|
-
function
|
|
26
|
-
return
|
|
25
|
+
function Ot(e) {
|
|
26
|
+
return Dt.has(e);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function kt(e, t) {
|
|
29
29
|
let n;
|
|
30
30
|
return n = e <= 3 ? 1 : 2, t !== void 0 && t < 640 ? Math.min(n, 1) : n;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type &&
|
|
32
|
+
function At(e, t) {
|
|
33
|
+
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && Ot(e.type) ? {
|
|
34
34
|
...e,
|
|
35
35
|
span: t
|
|
36
36
|
} : e);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function jt(e, t, n) {
|
|
39
39
|
if (t !== void 0) return {
|
|
40
|
-
fields:
|
|
40
|
+
fields: At(e, t),
|
|
41
41
|
columns: t
|
|
42
42
|
};
|
|
43
|
-
let r =
|
|
43
|
+
let r = kt(e.length, n);
|
|
44
44
|
return {
|
|
45
|
-
fields:
|
|
45
|
+
fields: At(e, r),
|
|
46
46
|
columns: r
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/useDetailTranslation.ts
|
|
51
|
-
function
|
|
51
|
+
function Mt(e, t) {
|
|
52
52
|
return function() {
|
|
53
53
|
try {
|
|
54
54
|
let n = ut();
|
|
@@ -66,7 +66,7 @@ function jt(e, t) {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
var
|
|
69
|
+
var Nt = {
|
|
70
70
|
"detail.back": "Back",
|
|
71
71
|
"detail.edit": "Edit",
|
|
72
72
|
"detail.editInline": "Edit",
|
|
@@ -192,13 +192,13 @@ var Mt = {
|
|
|
192
192
|
"detail.concurrentUpdateReload": "Reload latest",
|
|
193
193
|
"detail.concurrentUpdateOverwrite": "Overwrite anyway",
|
|
194
194
|
"detail.concurrentUpdateCancel": "Cancel"
|
|
195
|
-
}, $ =
|
|
195
|
+
}, $ = Mt(Nt, "detail.back");
|
|
196
196
|
//#endregion
|
|
197
197
|
//#region src/DetailSection.tsx
|
|
198
|
-
function
|
|
198
|
+
function Pt(e, t) {
|
|
199
199
|
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" : "";
|
|
200
200
|
}
|
|
201
|
-
var
|
|
201
|
+
var Ft = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s, virtualScroll: c }) => {
|
|
202
202
|
let [l, u] = n.useState(e.defaultCollapsed ?? !1), [d, f] = n.useState(null), [p, m] = n.useState(void 0), [h, g] = n.useState(!1), { t: _ } = $(), { fieldLabel: v, translateOptions: D } = pt(), O = n.useCallback((e, t) => {
|
|
203
203
|
let n = t == null ? "" : String(t);
|
|
204
204
|
navigator.clipboard.writeText(n).then(() => {
|
|
@@ -207,9 +207,9 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
207
207
|
}, []), k = n.useCallback((e) => {
|
|
208
208
|
let n = t?.[e.name] ?? e.value;
|
|
209
209
|
return n == null || n === "";
|
|
210
|
-
}, [t]), A = n.useMemo(() => e.fields.filter(k).length, [e.fields, k]), j =
|
|
211
|
-
if (
|
|
212
|
-
let { fields:
|
|
210
|
+
}, [t]), A = n.useMemo(() => e.fields.filter(k).length, [e.fields, k]), j = ie(), M = j ? 3 : 4, N = j ? .2 : .25, ee = e.fields.length - A, P = !e.hideEmpty && !o && e.fields.length >= M && A / e.fields.length >= N && ee > 0, te = !h && (e.hideEmpty || P) ? e.fields.filter((e) => !k(e)) : e.fields;
|
|
211
|
+
if (te.length === 0 && A === e.fields.length) return null;
|
|
212
|
+
let { fields: F, columns: I } = jt(te, e.columns), L = (e) => {
|
|
213
213
|
let n = t?.[e.name] ?? e.value;
|
|
214
214
|
if (e.render) return /* @__PURE__ */ Z(rt, {
|
|
215
215
|
schema: e.render,
|
|
@@ -218,7 +218,7 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
218
218
|
value: n
|
|
219
219
|
}
|
|
220
220
|
});
|
|
221
|
-
let r =
|
|
221
|
+
let r = Pt(e.span, I), c = i?.fields?.[e.name], l = { ...e };
|
|
222
222
|
if (c) {
|
|
223
223
|
!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);
|
|
224
224
|
let t = c.reference_to || c.reference;
|
|
@@ -232,9 +232,9 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
232
232
|
title: _("detail.noValue", { defaultValue: "No value" }),
|
|
233
233
|
children: "—"
|
|
234
234
|
});
|
|
235
|
-
let t =
|
|
235
|
+
let t = yt(l) || e.type;
|
|
236
236
|
if (t) {
|
|
237
|
-
let e =
|
|
237
|
+
let e = _t(t);
|
|
238
238
|
if (e) return /* @__PURE__ */ Z(e, {
|
|
239
239
|
value: n,
|
|
240
240
|
field: l
|
|
@@ -243,7 +243,7 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
243
243
|
return String(n);
|
|
244
244
|
})(), f = n != null && n !== "", p = d === e.name, m = v(a || "", e.name, e.label || e.name);
|
|
245
245
|
return j && !(o && !e.readonly) ? /* @__PURE__ */ Q("div", {
|
|
246
|
-
className:
|
|
246
|
+
className: G("flex items-baseline justify-between gap-4 py-2.5 min-h-[44px] group", f && "cursor-pointer active:bg-muted/40 transition-colors"),
|
|
247
247
|
onClick: f ? () => O(e.name, n) : void 0,
|
|
248
248
|
onKeyDown: f ? (t) => {
|
|
249
249
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), O(e.name, n));
|
|
@@ -258,7 +258,7 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
258
258
|
children: u
|
|
259
259
|
})]
|
|
260
260
|
}, e.name) : /* @__PURE__ */ Q("div", {
|
|
261
|
-
className:
|
|
261
|
+
className: G("space-y-1.5 group", r),
|
|
262
262
|
children: [/* @__PURE__ */ Z("div", {
|
|
263
263
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
264
264
|
children: v(a || "", e.name, e.label || e.name)
|
|
@@ -266,7 +266,7 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
266
266
|
className: "min-h-[44px] sm:min-h-0",
|
|
267
267
|
children: (() => {
|
|
268
268
|
let t = l.type || e.type;
|
|
269
|
-
if (t === "select" && Array.isArray(l.options) && l.options.length > 0) return /* @__PURE__ */ Z(
|
|
269
|
+
if (t === "select" && Array.isArray(l.options) && l.options.length > 0) return /* @__PURE__ */ Z(gt, {
|
|
270
270
|
field: l,
|
|
271
271
|
value: n == null ? "" : String(n),
|
|
272
272
|
onChange: (t) => s?.(e.name, t)
|
|
@@ -296,7 +296,7 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
296
296
|
});
|
|
297
297
|
})()
|
|
298
298
|
}) : /* @__PURE__ */ Q("div", {
|
|
299
|
-
className:
|
|
299
|
+
className: G("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md", f && "cursor-pointer active:bg-muted/60 transition-colors"),
|
|
300
300
|
onClick: f ? () => O(e.name, n) : void 0,
|
|
301
301
|
onKeyDown: f ? (t) => {
|
|
302
302
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), O(e.name, n));
|
|
@@ -315,7 +315,7 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
315
315
|
onClick: (t) => {
|
|
316
316
|
t.stopPropagation(), O(e.name, n);
|
|
317
317
|
},
|
|
318
|
-
children: p ? /* @__PURE__ */ Z(
|
|
318
|
+
children: p ? /* @__PURE__ */ Z(pe, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Se, { className: "h-3 w-3" })
|
|
319
319
|
})
|
|
320
320
|
}), /* @__PURE__ */ Z(H, { children: _(p ? "detail.copied" : "detail.copyToClipboard") })] }) })]
|
|
321
321
|
})]
|
|
@@ -326,7 +326,7 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
326
326
|
m(void 0);
|
|
327
327
|
return;
|
|
328
328
|
}
|
|
329
|
-
if (
|
|
329
|
+
if (F.length <= R) {
|
|
330
330
|
m(void 0);
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
@@ -335,14 +335,14 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
335
335
|
return () => clearTimeout(e);
|
|
336
336
|
}, [
|
|
337
337
|
ne,
|
|
338
|
-
|
|
338
|
+
F.length,
|
|
339
339
|
R
|
|
340
340
|
]);
|
|
341
|
-
let z = p === void 0 ?
|
|
341
|
+
let z = p === void 0 ? F : F.slice(0, p), B = A > 0 && (e.hideEmpty || P), W = /* @__PURE__ */ Q(bt, { children: [j ? /* @__PURE__ */ Z("div", {
|
|
342
342
|
className: "flex flex-col divide-y divide-border/60",
|
|
343
343
|
children: z.map(L)
|
|
344
344
|
}) : /* @__PURE__ */ Z("div", {
|
|
345
|
-
className:
|
|
345
|
+
className: G("grid gap-3 sm:gap-4", I === 1 ? "grid-cols-1" : I === 2 ? "grid-cols-1 md:grid-cols-2" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"),
|
|
346
346
|
children: z.map(L)
|
|
347
347
|
}), B && /* @__PURE__ */ Z("div", {
|
|
348
348
|
className: "mt-3 -ml-2",
|
|
@@ -352,15 +352,15 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
352
352
|
size: "sm",
|
|
353
353
|
onClick: () => g((e) => !e),
|
|
354
354
|
className: "h-7 px-2 text-xs text-muted-foreground hover:text-foreground",
|
|
355
|
-
children: [Z(h ?
|
|
355
|
+
children: [Z(h ? Y : Te, { className: "h-3.5 w-3.5 mr-1.5" }), h ? _("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : _("detail.showEmptyFields", {
|
|
356
356
|
count: A,
|
|
357
357
|
defaultValue: `Show ${A} empty field${A === 1 ? "" : "s"}`
|
|
358
358
|
})]
|
|
359
359
|
})
|
|
360
360
|
})] });
|
|
361
361
|
return !e.title && !e.collapsible && e.showBorder === !1 ? /* @__PURE__ */ Z("div", {
|
|
362
|
-
className:
|
|
363
|
-
children:
|
|
362
|
+
className: G(r),
|
|
363
|
+
children: W
|
|
364
364
|
}) : e.collapsible ? /* @__PURE__ */ Z(w, {
|
|
365
365
|
open: !l,
|
|
366
366
|
onOpenChange: (e) => u(!e),
|
|
@@ -368,7 +368,7 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
368
368
|
children: /* @__PURE__ */ Q(b, { children: [/* @__PURE__ */ Z(E, {
|
|
369
369
|
asChild: !0,
|
|
370
370
|
children: /* @__PURE__ */ Q(S, {
|
|
371
|
-
className:
|
|
371
|
+
className: G("py-3 px-4 sm:py-4 sm:px-6 cursor-pointer hover:bg-muted/50 transition-colors", e.headerColor && `bg-${e.headerColor}`),
|
|
372
372
|
children: [/* @__PURE__ */ Q(C, {
|
|
373
373
|
className: "flex items-center justify-between text-base font-semibold tracking-tight",
|
|
374
374
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -379,7 +379,7 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
379
379
|
}), /* @__PURE__ */ Z("span", { children: e.title })]
|
|
380
380
|
}), /* @__PURE__ */ Z("div", {
|
|
381
381
|
className: "flex items-center gap-2",
|
|
382
|
-
children: Z(l ?
|
|
382
|
+
children: Z(l ? _e : he, { className: "h-4 w-4 text-muted-foreground" })
|
|
383
383
|
})]
|
|
384
384
|
}), e.description && !l && /* @__PURE__ */ Z("p", {
|
|
385
385
|
className: "text-xs text-muted-foreground mt-1",
|
|
@@ -388,12 +388,12 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
388
388
|
})
|
|
389
389
|
}), /* @__PURE__ */ Z(T, { children: /* @__PURE__ */ Z(x, {
|
|
390
390
|
className: "pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5",
|
|
391
|
-
children:
|
|
391
|
+
children: W
|
|
392
392
|
}) })] })
|
|
393
393
|
}) : /* @__PURE__ */ Q(b, {
|
|
394
|
-
className:
|
|
394
|
+
className: G(e.showBorder === !1 ? "border-none shadow-none" : "", r),
|
|
395
395
|
children: [e.title && /* @__PURE__ */ Q(S, {
|
|
396
|
-
className:
|
|
396
|
+
className: G("py-3 px-4 sm:py-4 sm:px-6", e.headerColor && `bg-${e.headerColor}`),
|
|
397
397
|
children: [/* @__PURE__ */ Z(C, {
|
|
398
398
|
className: "flex items-center justify-between text-base font-semibold tracking-tight",
|
|
399
399
|
children: /* @__PURE__ */ Q("div", {
|
|
@@ -409,10 +409,10 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
409
409
|
})]
|
|
410
410
|
}), /* @__PURE__ */ Z(x, {
|
|
411
411
|
className: "pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5",
|
|
412
|
-
children:
|
|
412
|
+
children: W
|
|
413
413
|
})]
|
|
414
414
|
});
|
|
415
|
-
},
|
|
415
|
+
}, It = ({ tabs: e, data: t, className: r }) => {
|
|
416
416
|
let [i, a] = n.useState(e[0]?.key), o = e.filter((e) => typeof e.visible == "boolean" ? e.visible : (e.visible, !0));
|
|
417
417
|
return /* @__PURE__ */ Q(ne, {
|
|
418
418
|
value: i,
|
|
@@ -457,58 +457,59 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
457
457
|
};
|
|
458
458
|
//#endregion
|
|
459
459
|
//#region src/RelatedList.tsx
|
|
460
|
-
function
|
|
460
|
+
function Lt(e) {
|
|
461
461
|
return e && nt[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || Ae;
|
|
462
462
|
}
|
|
463
|
-
var
|
|
464
|
-
let
|
|
463
|
+
var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className: h, dataSource: g, objectName: _, onNew: w, onViewAll: T, onRowEdit: E, onRowDelete: D, onRowClick: k, add: A, maxColumns: j = 6, pageSize: M, sortable: N = !1, filterable: ee = !1, collapsible: P = !1, defaultCollapsed: te = !1, referenceField: F, parentId: I, icon: L }) => {
|
|
464
|
+
let ne = i !== void 0, R = i ?? [], [z, B] = n.useState(R), [V, H] = n.useState(() => !!r && !ne), [re, U] = n.useState(0), [W, ae] = n.useState(null), [K, oe] = n.useState("asc"), [se, ce] = n.useState(""), [q, J] = n.useState(null), [ue, de] = n.useState(te), [fe, pe] = n.useState(!1), [me, ve] = n.useState(!1), [ye, be] = n.useState(null), [xe, Se] = n.useState(0), [Ce, Te] = n.useState({}), { t: Y } = $(), { fieldLabel: Ee } = pt();
|
|
465
465
|
n.useEffect(() => {
|
|
466
|
-
|
|
467
|
-
}, [i,
|
|
468
|
-
r && g?.getObjectSchema && g.getObjectSchema(r).then(
|
|
466
|
+
ne && B(i ?? []);
|
|
467
|
+
}, [i, ne]), n.useEffect(() => {
|
|
468
|
+
r && g?.getObjectSchema && g.getObjectSchema(r).then(J).catch((e) => {
|
|
469
469
|
console.warn(`[RelatedList] Failed to fetch schema for ${r}:`, e);
|
|
470
470
|
});
|
|
471
471
|
}, [r, g]), n.useEffect(() => {
|
|
472
|
-
if (r && !
|
|
472
|
+
if (r && !ne) {
|
|
473
473
|
if (!(F && I != null && I !== "")) {
|
|
474
|
-
r && (I == null || I === "") && !F && console.warn(`[RelatedList] "${r}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`),
|
|
474
|
+
r && (I == null || I === "") && !F && console.warn(`[RelatedList] "${r}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`), B([]), H(!1);
|
|
475
475
|
return;
|
|
476
476
|
}
|
|
477
|
-
|
|
477
|
+
H(!0);
|
|
478
478
|
let e = { [F]: I };
|
|
479
479
|
if (g && typeof g.find == "function") g.find(r, { $filter: e }).then((e) => {
|
|
480
|
-
|
|
480
|
+
B(Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : []), H(!1);
|
|
481
481
|
}).catch((e) => {
|
|
482
|
-
console.error("Failed to fetch related data:", e),
|
|
482
|
+
console.error("Failed to fetch related data:", e), H(!1);
|
|
483
483
|
});
|
|
484
484
|
else {
|
|
485
485
|
let e = new URLSearchParams({ [`filter[${F}]`]: String(I) }).toString();
|
|
486
486
|
fetch(`${r}?${e}`).then((e) => e.json()).then((e) => {
|
|
487
|
-
|
|
487
|
+
B(Array.isArray(e) ? e : e?.data || []);
|
|
488
488
|
}).catch((e) => {
|
|
489
489
|
console.error("Failed to fetch related data:", e);
|
|
490
|
-
}).finally(() =>
|
|
490
|
+
}).finally(() => H(!1));
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
}, [
|
|
494
494
|
r,
|
|
495
|
-
|
|
495
|
+
ne,
|
|
496
496
|
g,
|
|
497
497
|
F,
|
|
498
|
-
I
|
|
498
|
+
I,
|
|
499
|
+
xe
|
|
499
500
|
]), n.useEffect(() => {
|
|
500
|
-
if (!g?.find || !
|
|
501
|
-
let e =
|
|
501
|
+
if (!g?.find || !q?.fields || !z.length) return;
|
|
502
|
+
let e = q.fields, t = [];
|
|
502
503
|
for (let [n, r] of Object.entries(e)) {
|
|
503
504
|
if (!r || r.type !== "lookup" && r.type !== "master_detail") continue;
|
|
504
505
|
let e = r.reference_to || r.reference;
|
|
505
506
|
if (!e) continue;
|
|
506
507
|
let i = /* @__PURE__ */ new Set();
|
|
507
|
-
for (let e of
|
|
508
|
+
for (let e of z) {
|
|
508
509
|
let t = e?.[n];
|
|
509
510
|
t != null && (typeof t == "string" && t ? i.add(t) : typeof t == "number" && i.add(String(t)));
|
|
510
511
|
}
|
|
511
|
-
let a =
|
|
512
|
+
let a = Ce[n] || {}, o = Array.from(i).filter((e) => !(e in a));
|
|
512
513
|
o.length > 0 && t.push({
|
|
513
514
|
fieldName: n,
|
|
514
515
|
target: e,
|
|
@@ -524,7 +525,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
524
525
|
let n = Array.isArray(t) ? t : t?.data || [], r = {};
|
|
525
526
|
for (let e of n) {
|
|
526
527
|
let t = e?.id || e?._id;
|
|
527
|
-
t && (r[String(t)] = e?.full_name || e?.fullname || e?.display_name || e?.name || e?.subject || e?.title || e?.label || e?.code || String(t));
|
|
528
|
+
t && (r[String(t)] = e?.full_name || e?.fullname || e?.display_name || e?.name || e?.subject || e?.title || e?.label || e?.code || e?.email || String(t));
|
|
528
529
|
}
|
|
529
530
|
return {
|
|
530
531
|
fieldName: e,
|
|
@@ -534,7 +535,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
534
535
|
fieldName: e,
|
|
535
536
|
map: {}
|
|
536
537
|
})))).then((e) => {
|
|
537
|
-
n ||
|
|
538
|
+
n || Te((t) => {
|
|
538
539
|
let n = { ...t };
|
|
539
540
|
for (let { fieldName: t, map: r } of e) n[t] = {
|
|
540
541
|
...n[t] || {},
|
|
@@ -547,53 +548,83 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
547
548
|
};
|
|
548
549
|
}, [
|
|
549
550
|
g,
|
|
550
|
-
|
|
551
|
-
|
|
551
|
+
q,
|
|
552
|
+
z
|
|
552
553
|
]);
|
|
553
|
-
let
|
|
554
|
-
if (!se) return
|
|
554
|
+
let De = n.useMemo(() => {
|
|
555
|
+
if (!se) return z;
|
|
555
556
|
let e = se.toLowerCase();
|
|
556
|
-
return
|
|
557
|
-
}, [
|
|
558
|
-
let n = e[
|
|
557
|
+
return z.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
558
|
+
}, [z, se]), Oe = n.useMemo(() => W ? [...De].sort((e, t) => {
|
|
559
|
+
let n = e[W], r = t[W];
|
|
559
560
|
if (n == null && r == null) return 0;
|
|
560
561
|
if (n == null) return 1;
|
|
561
562
|
if (r == null) return -1;
|
|
562
563
|
let i = String(n).localeCompare(String(r), void 0, { numeric: !0 });
|
|
563
|
-
return
|
|
564
|
-
}) :
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
]), X =
|
|
564
|
+
return K === "asc" ? i : -i;
|
|
565
|
+
}) : De, [
|
|
566
|
+
De,
|
|
567
|
+
W,
|
|
568
|
+
K
|
|
569
|
+
]), X = M && M > 0 ? M : 0, ke = X ? Math.max(1, Math.ceil(Oe.length / X)) : 1, Ae = X ? Oe.slice(re * X, (re + 1) * X) : Oe;
|
|
569
570
|
n.useEffect(() => {
|
|
570
|
-
|
|
571
|
+
U(0);
|
|
571
572
|
}, [
|
|
572
573
|
se,
|
|
573
|
-
|
|
574
|
-
|
|
574
|
+
W,
|
|
575
|
+
K
|
|
575
576
|
]);
|
|
576
|
-
let
|
|
577
|
-
|
|
578
|
-
}, [
|
|
579
|
-
|
|
580
|
-
}, []),
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
577
|
+
let je = n.useCallback((e) => {
|
|
578
|
+
W === e ? oe((e) => e === "asc" ? "desc" : "asc") : (ae(e), oe("asc"));
|
|
579
|
+
}, [W]), [Me, Ne] = n.useState(null), Pe = n.useCallback((e) => {
|
|
580
|
+
Ne(e);
|
|
581
|
+
}, []), Fe = n.useCallback(async () => {
|
|
582
|
+
if (Me) try {
|
|
583
|
+
await D?.(Me), Se((e) => e + 1);
|
|
584
|
+
} catch (e) {
|
|
585
|
+
console.error("[RelatedList] remove failed", e);
|
|
586
|
+
}
|
|
587
|
+
Ne(null);
|
|
588
|
+
}, [Me, D]), Ie = n.useCallback(async (e) => {
|
|
589
|
+
if (!A || !g || !r || F == null || I == null) return;
|
|
590
|
+
let t = A.picker.valueField || "id";
|
|
591
|
+
ve(!0), be(null);
|
|
592
|
+
try {
|
|
593
|
+
for (let n of e || []) {
|
|
594
|
+
let e = n?.[t] ?? n?.id;
|
|
595
|
+
e != null && (A.linkField ? await g.create?.(r, {
|
|
596
|
+
[F]: I,
|
|
597
|
+
[A.linkField]: e
|
|
598
|
+
}) : await g.update?.(A.picker.object, String(e), { [F]: I }));
|
|
599
|
+
}
|
|
600
|
+
Se((e) => e + 1);
|
|
601
|
+
} catch (e) {
|
|
602
|
+
let t = e?.body?.error ?? e?.error ?? e?.message ?? String(e);
|
|
603
|
+
be(typeof t == "string" ? t : "Failed to add");
|
|
604
|
+
} finally {
|
|
605
|
+
ve(!1), pe(!1);
|
|
606
|
+
}
|
|
607
|
+
}, [
|
|
608
|
+
A,
|
|
609
|
+
g,
|
|
610
|
+
r,
|
|
611
|
+
F,
|
|
612
|
+
I
|
|
613
|
+
]), Le = St(), Re = n.useMemo(() => {
|
|
614
|
+
let e = _ || r || "", t = (t) => !Le?.isLoaded || !e ? t : t.filter((t) => {
|
|
584
615
|
let n = t?.accessorKey || t?.field || t?.name;
|
|
585
|
-
return n ?
|
|
586
|
-
}), 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) =>
|
|
616
|
+
return n ? Le.checkField(e, String(n), "read") : !0;
|
|
617
|
+
}), 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) => {
|
|
587
618
|
let t = e?.accessorKey || e?.field || e?.name;
|
|
588
|
-
return t ?
|
|
619
|
+
return t ? z.some((e) => !a(e?.[t])) : !0;
|
|
589
620
|
}) : e, s = (e, t) => {
|
|
590
621
|
if (!t?.type) return;
|
|
591
|
-
let r =
|
|
622
|
+
let r = _t(yt({
|
|
592
623
|
type: t.type,
|
|
593
624
|
format: t.format
|
|
594
625
|
}) || t.type);
|
|
595
626
|
if (!r) return;
|
|
596
|
-
let i = t.type === "lookup" || t.type === "master_detail" ?
|
|
627
|
+
let i = t.type === "lookup" || t.type === "master_detail" ? Ce[e] : void 0, a = i && Object.keys(i).length > 0 ? Object.entries(i).map(([e, t]) => ({
|
|
597
628
|
value: e,
|
|
598
629
|
label: t
|
|
599
630
|
})) : void 0, o = {
|
|
@@ -615,7 +646,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
615
646
|
if (typeof t != "string") {
|
|
616
647
|
let e = t?.accessorKey || t?.field || t?.name;
|
|
617
648
|
if (t && !t.cell && !t.render && e) {
|
|
618
|
-
let n =
|
|
649
|
+
let n = q?.fields?.[e], r = n ? s(String(e), n) : void 0;
|
|
619
650
|
if (r) return {
|
|
620
651
|
...t,
|
|
621
652
|
cell: r
|
|
@@ -623,16 +654,16 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
623
654
|
}
|
|
624
655
|
return t;
|
|
625
656
|
}
|
|
626
|
-
let n =
|
|
657
|
+
let n = q?.fields?.[t], r = {
|
|
627
658
|
accessorKey: t,
|
|
628
|
-
header: n?.label ||
|
|
659
|
+
header: n?.label || Ee(e, t, n) || t,
|
|
629
660
|
fieldDef: n,
|
|
630
661
|
fieldType: n?.type
|
|
631
662
|
}, i = n ? s(t, n) : void 0;
|
|
632
663
|
return i && (r.cell = i), r;
|
|
633
664
|
};
|
|
634
665
|
if (m && m.length > 0) return o(t(i(m.map(c))));
|
|
635
|
-
if (!
|
|
666
|
+
if (!q?.fields) return [];
|
|
636
667
|
let l = e, u = new Set([
|
|
637
668
|
"image",
|
|
638
669
|
"file",
|
|
@@ -649,7 +680,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
649
680
|
"label",
|
|
650
681
|
"code",
|
|
651
682
|
"number"
|
|
652
|
-
], f = Object.entries(
|
|
683
|
+
], f = Object.entries(q.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === F || t?.hidden || t?.type && u.has(t.type) || Le?.isLoaded && l && !Le.checkField(l, e, "read"))), p = new Set([
|
|
653
684
|
"created_at",
|
|
654
685
|
"updated_at",
|
|
655
686
|
"created_by",
|
|
@@ -667,32 +698,32 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
667
698
|
}), o(f.map(([e, t]) => {
|
|
668
699
|
let n = {
|
|
669
700
|
accessorKey: e,
|
|
670
|
-
header:
|
|
701
|
+
header: Ee(l, e, t.label || e)
|
|
671
702
|
};
|
|
672
703
|
if (t.type) {
|
|
673
704
|
let r = s(e, t);
|
|
674
705
|
r && (n.cell = r);
|
|
675
706
|
}
|
|
676
707
|
return n;
|
|
677
|
-
})).slice(0, Math.max(1,
|
|
708
|
+
})).slice(0, Math.max(1, j));
|
|
678
709
|
}, [
|
|
679
710
|
m,
|
|
680
|
-
|
|
711
|
+
q,
|
|
681
712
|
_,
|
|
682
713
|
r,
|
|
683
|
-
|
|
714
|
+
Ee,
|
|
684
715
|
F,
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
]),
|
|
716
|
+
z,
|
|
717
|
+
j,
|
|
718
|
+
Ce,
|
|
719
|
+
Le
|
|
720
|
+
]), ze = !!E || !!D, Be = ie(), Ve = n.useMemo(() => {
|
|
690
721
|
if (a) return a;
|
|
691
|
-
if (
|
|
692
|
-
let e =
|
|
722
|
+
if (Be && (t === "grid" || t === "table")) {
|
|
723
|
+
let e = Re[0]?.accessorKey || Re[0]?.field || Re[0]?.name, t = Re.slice(1, 4).map((e) => e.accessorKey || e.field || e.name).filter(Boolean);
|
|
693
724
|
return {
|
|
694
725
|
type: "object-gallery",
|
|
695
|
-
data:
|
|
726
|
+
data: Ae,
|
|
696
727
|
objectName: r,
|
|
697
728
|
gallery: {
|
|
698
729
|
titleField: e || "name",
|
|
@@ -706,20 +737,20 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
706
737
|
case "grid":
|
|
707
738
|
case "table": return {
|
|
708
739
|
type: "data-table",
|
|
709
|
-
data:
|
|
710
|
-
columns:
|
|
740
|
+
data: Ae,
|
|
741
|
+
columns: Re,
|
|
711
742
|
pagination: !1,
|
|
712
743
|
pageSize: X || 10,
|
|
713
744
|
searchable: !1,
|
|
714
745
|
exportable: !1,
|
|
715
|
-
rowActions:
|
|
746
|
+
rowActions: ze,
|
|
716
747
|
onRowEdit: E,
|
|
717
|
-
onRowDelete: D ?
|
|
748
|
+
onRowDelete: D ? Pe : void 0,
|
|
718
749
|
onRowClick: k
|
|
719
750
|
};
|
|
720
751
|
case "list": return {
|
|
721
752
|
type: "data-list",
|
|
722
|
-
data:
|
|
753
|
+
data: Ae
|
|
723
754
|
};
|
|
724
755
|
default: return {
|
|
725
756
|
type: "div",
|
|
@@ -728,127 +759,136 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
728
759
|
}
|
|
729
760
|
}, [
|
|
730
761
|
t,
|
|
731
|
-
|
|
732
|
-
|
|
762
|
+
Ae,
|
|
763
|
+
Re,
|
|
733
764
|
a,
|
|
734
765
|
X,
|
|
735
|
-
|
|
766
|
+
ze,
|
|
736
767
|
E,
|
|
737
768
|
D,
|
|
738
|
-
|
|
769
|
+
Pe,
|
|
739
770
|
k,
|
|
740
|
-
|
|
771
|
+
Be,
|
|
741
772
|
r
|
|
742
|
-
]),
|
|
773
|
+
]), He = P ? "cursor-pointer select-none" : void 0, Ue = P ? () => de((e) => !e) : void 0, Ge = Lt(L), Ke = !V && z.length === 0, qe = ee;
|
|
743
774
|
return /* @__PURE__ */ Q(b, {
|
|
744
|
-
className:
|
|
775
|
+
className: G("shadow-none border-border/60 bg-transparent", Ke && "bg-muted/10", h),
|
|
745
776
|
children: [
|
|
746
777
|
/* @__PURE__ */ Z(S, {
|
|
747
|
-
className:
|
|
748
|
-
onClick:
|
|
778
|
+
className: G("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", He),
|
|
779
|
+
onClick: Ue,
|
|
749
780
|
children: /* @__PURE__ */ Q(C, {
|
|
750
781
|
className: "flex items-center justify-between gap-2 text-sm font-semibold",
|
|
751
782
|
children: [/* @__PURE__ */ Q("div", {
|
|
752
783
|
className: "flex items-center gap-2 min-w-0",
|
|
753
784
|
children: [
|
|
754
|
-
|
|
755
|
-
/* @__PURE__ */ Z(
|
|
785
|
+
P && Z(ue ? _e : he, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
|
|
786
|
+
/* @__PURE__ */ Z(Ge, {
|
|
756
787
|
className: "h-4 w-4 text-muted-foreground shrink-0",
|
|
757
788
|
"aria-hidden": !0
|
|
758
789
|
}),
|
|
759
790
|
/* @__PURE__ */ Z("span", {
|
|
760
|
-
className:
|
|
791
|
+
className: G("truncate", Ke && "text-muted-foreground font-medium"),
|
|
761
792
|
children: e
|
|
762
793
|
}),
|
|
763
794
|
/* @__PURE__ */ Z(v, {
|
|
764
795
|
variant: "secondary",
|
|
765
|
-
className:
|
|
766
|
-
"aria-label": `${
|
|
767
|
-
children:
|
|
796
|
+
className: G("text-xs font-normal h-5 px-1.5", z.length === 0 && "bg-muted text-muted-foreground"),
|
|
797
|
+
"aria-label": `${z.length} records`,
|
|
798
|
+
children: z.length
|
|
768
799
|
}),
|
|
769
|
-
|
|
800
|
+
Ke && /* @__PURE__ */ Z("span", {
|
|
770
801
|
className: "text-xs text-muted-foreground/70 italic ml-1 truncate",
|
|
771
|
-
children:
|
|
802
|
+
children: Y("detail.noRelatedRecords")
|
|
772
803
|
})
|
|
773
804
|
]
|
|
774
|
-
}), /* @__PURE__ */
|
|
805
|
+
}), /* @__PURE__ */ Q("div", {
|
|
775
806
|
className: "flex items-center gap-1 shrink-0",
|
|
776
|
-
children:
|
|
777
|
-
variant:
|
|
807
|
+
children: [A && /* @__PURE__ */ Q(y, {
|
|
808
|
+
variant: Ke ? "ghost" : "outline",
|
|
809
|
+
size: "sm",
|
|
810
|
+
disabled: me,
|
|
811
|
+
onClick: (e) => {
|
|
812
|
+
e.stopPropagation(), be(null), pe(!0);
|
|
813
|
+
},
|
|
814
|
+
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
815
|
+
children: [/* @__PURE__ */ Z(We, { className: "h-3.5 w-3.5" }), A.label || Y("detail.add", { defaultValue: "Add" })]
|
|
816
|
+
}), w && /* @__PURE__ */ Q(y, {
|
|
817
|
+
variant: Ke ? "ghost" : "outline",
|
|
778
818
|
size: "sm",
|
|
779
819
|
onClick: (e) => {
|
|
780
820
|
e.stopPropagation(), w();
|
|
781
821
|
},
|
|
782
822
|
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
783
|
-
children: [/* @__PURE__ */ Z(We, { className: "h-3.5 w-3.5" }),
|
|
784
|
-
})
|
|
823
|
+
children: [/* @__PURE__ */ Z(We, { className: "h-3.5 w-3.5" }), Y("detail.new")]
|
|
824
|
+
})]
|
|
785
825
|
})]
|
|
786
826
|
})
|
|
787
827
|
}),
|
|
788
|
-
!
|
|
789
|
-
className:
|
|
828
|
+
!ue && !Ke && /* @__PURE__ */ Q(x, {
|
|
829
|
+
className: G("pt-0 pb-4 px-4"),
|
|
790
830
|
children: [
|
|
791
|
-
|
|
831
|
+
qe && /* @__PURE__ */ Z("div", {
|
|
792
832
|
className: "mb-3",
|
|
793
833
|
children: /* @__PURE__ */ Z(O, {
|
|
794
|
-
placeholder:
|
|
834
|
+
placeholder: Y("detail.filterPlaceholder"),
|
|
795
835
|
value: se,
|
|
796
836
|
onChange: (e) => ce(e.target.value),
|
|
797
837
|
className: "h-8 text-sm"
|
|
798
838
|
})
|
|
799
839
|
}),
|
|
800
|
-
|
|
840
|
+
N && Re && Re.length > 0 && z.length > 0 && /* @__PURE__ */ Z("div", {
|
|
801
841
|
className: "flex flex-wrap gap-1 mb-3",
|
|
802
|
-
children:
|
|
842
|
+
children: Re.map((e) => {
|
|
803
843
|
let t = e.accessorKey || e.field || e.name;
|
|
804
844
|
if (!t) return null;
|
|
805
|
-
let n = e.header || e.label || t, r =
|
|
845
|
+
let n = e.header || e.label || t, r = W === t;
|
|
806
846
|
return /* @__PURE__ */ Q(y, {
|
|
807
847
|
variant: r ? "secondary" : "ghost",
|
|
808
848
|
size: "sm",
|
|
809
849
|
className: "gap-1 h-7 text-xs",
|
|
810
|
-
onClick: () =>
|
|
850
|
+
onClick: () => je(t),
|
|
811
851
|
children: [
|
|
812
852
|
/* @__PURE__ */ Z(le, { className: "h-3 w-3" }),
|
|
813
853
|
n,
|
|
814
|
-
r && (
|
|
854
|
+
r && (K === "asc" ? " ↑" : " ↓")
|
|
815
855
|
]
|
|
816
856
|
}, t);
|
|
817
857
|
})
|
|
818
858
|
}),
|
|
819
|
-
|
|
859
|
+
V ? /* @__PURE__ */ Z("div", {
|
|
820
860
|
className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
|
|
821
|
-
children:
|
|
822
|
-
}) : /* @__PURE__ */ Z(rt, { schema:
|
|
823
|
-
X > 0 &&
|
|
861
|
+
children: Y("detail.loading")
|
|
862
|
+
}) : /* @__PURE__ */ Z(rt, { schema: Ve }),
|
|
863
|
+
X > 0 && Oe.length > X && /* @__PURE__ */ Q("div", {
|
|
824
864
|
className: "flex items-center justify-between mt-3 pt-3 border-t",
|
|
825
865
|
children: [
|
|
826
866
|
/* @__PURE__ */ Q(y, {
|
|
827
867
|
variant: "outline",
|
|
828
868
|
size: "sm",
|
|
829
869
|
className: "h-7 text-xs gap-1",
|
|
830
|
-
disabled:
|
|
831
|
-
onClick: () =>
|
|
832
|
-
children: [/* @__PURE__ */ Z(ge, { className: "h-3 w-3" }),
|
|
870
|
+
disabled: re === 0,
|
|
871
|
+
onClick: () => U((e) => Math.max(0, e - 1)),
|
|
872
|
+
children: [/* @__PURE__ */ Z(ge, { className: "h-3 w-3" }), Y("detail.previousPage")]
|
|
833
873
|
}),
|
|
834
874
|
/* @__PURE__ */ Z("span", {
|
|
835
875
|
className: "text-xs text-muted-foreground",
|
|
836
|
-
children:
|
|
837
|
-
current:
|
|
838
|
-
total:
|
|
876
|
+
children: Y("detail.pageOf", {
|
|
877
|
+
current: re + 1,
|
|
878
|
+
total: ke
|
|
839
879
|
})
|
|
840
880
|
}),
|
|
841
881
|
/* @__PURE__ */ Q(y, {
|
|
842
882
|
variant: "outline",
|
|
843
883
|
size: "sm",
|
|
844
884
|
className: "h-7 text-xs gap-1",
|
|
845
|
-
disabled:
|
|
846
|
-
onClick: () =>
|
|
847
|
-
children: [
|
|
885
|
+
disabled: re >= ke - 1,
|
|
886
|
+
onClick: () => U((e) => Math.min(ke - 1, e + 1)),
|
|
887
|
+
children: [Y("detail.nextPage"), /* @__PURE__ */ Z(_e, { className: "h-3 w-3" })]
|
|
848
888
|
})
|
|
849
889
|
]
|
|
850
890
|
}),
|
|
851
|
-
T && !
|
|
891
|
+
T && !Ke && X > 0 && Oe.length > X && /* @__PURE__ */ Z("div", {
|
|
852
892
|
className: "mt-3 pt-3 border-t flex justify-center",
|
|
853
893
|
children: /* @__PURE__ */ Q("button", {
|
|
854
894
|
type: "button",
|
|
@@ -856,28 +896,45 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
856
896
|
e.stopPropagation(), T();
|
|
857
897
|
},
|
|
858
898
|
className: "text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors",
|
|
859
|
-
children: [
|
|
899
|
+
children: [Y("detail.viewAll"), /* @__PURE__ */ Z(we, { className: "h-3 w-3" })]
|
|
860
900
|
})
|
|
861
901
|
})
|
|
862
902
|
]
|
|
863
903
|
}),
|
|
864
904
|
/* @__PURE__ */ Z(o, {
|
|
865
|
-
open:
|
|
905
|
+
open: Me !== null,
|
|
866
906
|
onOpenChange: (e) => {
|
|
867
|
-
e ||
|
|
907
|
+
e || Ne(null);
|
|
868
908
|
},
|
|
869
|
-
children: /* @__PURE__ */ Q(l, { children: [/* @__PURE__ */ Q(f, { children: [/* @__PURE__ */ Z(p, { children:
|
|
870
|
-
onClick:
|
|
909
|
+
children: /* @__PURE__ */ Q(l, { children: [/* @__PURE__ */ Q(f, { children: [/* @__PURE__ */ Z(p, { children: Y("detail.deleteRowTitle", { defaultValue: "Delete record" }) }), /* @__PURE__ */ Z(u, { children: Y("detail.deleteRowConfirmation") })] }), /* @__PURE__ */ Q(d, { children: [/* @__PURE__ */ Z(c, { children: Y("detail.cancel", { defaultValue: "Cancel" }) }), /* @__PURE__ */ Z(s, {
|
|
910
|
+
onClick: Fe,
|
|
871
911
|
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
872
|
-
children:
|
|
912
|
+
children: Y("detail.delete", { defaultValue: "Delete" })
|
|
873
913
|
})] })] })
|
|
914
|
+
}),
|
|
915
|
+
ye && /* @__PURE__ */ Z("div", {
|
|
916
|
+
className: "mx-4 mb-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
|
|
917
|
+
role: "alert",
|
|
918
|
+
children: ye
|
|
919
|
+
}),
|
|
920
|
+
A && g && /* @__PURE__ */ Z(ht, {
|
|
921
|
+
open: fe,
|
|
922
|
+
onOpenChange: (e) => pe(e),
|
|
923
|
+
multiple: !0,
|
|
924
|
+
dataSource: g,
|
|
925
|
+
objectName: A.picker.object,
|
|
926
|
+
title: A.label || Y("detail.add", { defaultValue: "Add" }),
|
|
927
|
+
onSelect: () => {},
|
|
928
|
+
onSelectRecords: (e) => {
|
|
929
|
+
Ie(e);
|
|
930
|
+
}
|
|
874
931
|
})
|
|
875
932
|
]
|
|
876
933
|
});
|
|
877
|
-
},
|
|
934
|
+
}, zt = ({ group: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s }) => {
|
|
878
935
|
let c = e.collapsible ?? !0, [l, u] = n.useState(e.defaultCollapsed ?? !1), d = /* @__PURE__ */ Z("div", {
|
|
879
936
|
className: "space-y-3 sm:space-y-4",
|
|
880
|
-
children: e.sections.map((e, n) => /* @__PURE__ */ Z(
|
|
937
|
+
children: e.sections.map((e, n) => /* @__PURE__ */ Z(Ft, {
|
|
881
938
|
section: e,
|
|
882
939
|
data: t,
|
|
883
940
|
objectSchema: i,
|
|
@@ -896,7 +953,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
896
953
|
children: /* @__PURE__ */ Q("div", {
|
|
897
954
|
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",
|
|
898
955
|
children: [
|
|
899
|
-
Z(l ?
|
|
956
|
+
Z(l ? _e : he, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
|
|
900
957
|
e.icon && /* @__PURE__ */ Z("span", {
|
|
901
958
|
className: "text-muted-foreground",
|
|
902
959
|
children: e.icon
|
|
@@ -918,7 +975,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
918
975
|
}) })
|
|
919
976
|
]
|
|
920
977
|
}) : /* @__PURE__ */ Q("div", {
|
|
921
|
-
className:
|
|
978
|
+
className: G("space-y-3", r),
|
|
922
979
|
children: [
|
|
923
980
|
/* @__PURE__ */ Q("div", {
|
|
924
981
|
className: "flex items-center gap-2 pb-2 border-b",
|
|
@@ -937,7 +994,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
937
994
|
d
|
|
938
995
|
]
|
|
939
996
|
});
|
|
940
|
-
},
|
|
997
|
+
}, Bt = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
|
|
941
998
|
let { fieldLabel: a } = pt();
|
|
942
999
|
if (!e.length || !t) return null;
|
|
943
1000
|
let o = e.filter((e) => {
|
|
@@ -945,10 +1002,10 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
945
1002
|
return n != null && n !== "";
|
|
946
1003
|
});
|
|
947
1004
|
return o.length === 0 ? null : /* @__PURE__ */ Z("section", {
|
|
948
|
-
className:
|
|
1005
|
+
className: G("@container border-b border-border/60 pb-4", n),
|
|
949
1006
|
"aria-label": "Record highlights",
|
|
950
1007
|
children: /* @__PURE__ */ Z("div", {
|
|
951
|
-
className:
|
|
1008
|
+
className: G("flex flex-wrap gap-x-8 gap-y-3"),
|
|
952
1009
|
children: o.map((e) => {
|
|
953
1010
|
let n = t[e.name], o = i?.fields?.[e.name], s = e.type || o?.type, c = {
|
|
954
1011
|
name: e.name,
|
|
@@ -958,15 +1015,15 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
958
1015
|
...o?.currency && { currency: o.currency },
|
|
959
1016
|
...o?.precision !== void 0 && { precision: o.precision },
|
|
960
1017
|
...o?.format && { format: o.format }
|
|
961
|
-
}, l =
|
|
1018
|
+
}, l = _t(yt(c) || s || "text"), u = s === "number" || s === "integer" || s === "currency" || s === "percent" || s === "decimal", d = s === "email" || s === "url" || s === "textarea", f = s === "boolean";
|
|
962
1019
|
return /* @__PURE__ */ Q("div", {
|
|
963
|
-
className:
|
|
1020
|
+
className: G("flex flex-col gap-1 min-w-[8rem] basis-[10rem]", d ? "max-w-[24rem] basis-[16rem]" : "max-w-[16rem]"),
|
|
964
1021
|
children: [/* @__PURE__ */ Z("span", {
|
|
965
1022
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
966
1023
|
children: a(r || "", e.name, e.label)
|
|
967
1024
|
}), f ? n ? /* @__PURE__ */ Q("span", {
|
|
968
1025
|
className: "inline-flex items-center gap-1 self-start rounded-full bg-emerald-500/10 px-2 py-0.5 text-xs font-medium text-emerald-600 ring-1 ring-inset ring-emerald-500/30 dark:text-emerald-400",
|
|
969
|
-
children: [/* @__PURE__ */ Z(
|
|
1026
|
+
children: [/* @__PURE__ */ Z(pe, {
|
|
970
1027
|
className: "h-3 w-3",
|
|
971
1028
|
"aria-hidden": !0
|
|
972
1029
|
}), "Yes"]
|
|
@@ -977,7 +1034,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
977
1034
|
"aria-hidden": !0
|
|
978
1035
|
}), "No"]
|
|
979
1036
|
}) : /* @__PURE__ */ Z("span", {
|
|
980
|
-
className:
|
|
1037
|
+
className: G("block min-w-0 truncate", u ? "text-xl md:text-2xl font-semibold leading-tight tabular-nums tracking-tight" : "text-sm font-semibold"),
|
|
981
1038
|
children: /* @__PURE__ */ Z(l, {
|
|
982
1039
|
value: n,
|
|
983
1040
|
field: c
|
|
@@ -990,7 +1047,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
990
1047
|
};
|
|
991
1048
|
//#endregion
|
|
992
1049
|
//#region src/RecordComments.tsx
|
|
993
|
-
function
|
|
1050
|
+
function Vt(e) {
|
|
994
1051
|
try {
|
|
995
1052
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
996
1053
|
if (r < 1) return "just now";
|
|
@@ -1003,7 +1060,7 @@ function Bt(e) {
|
|
|
1003
1060
|
return e;
|
|
1004
1061
|
}
|
|
1005
1062
|
}
|
|
1006
|
-
var
|
|
1063
|
+
var Ht = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, className: a }) => {
|
|
1007
1064
|
let { t: o } = $(), [s, c] = n.useState(""), [l, u] = n.useState(!1), [d, f] = n.useState(""), p = n.useCallback(async () => {
|
|
1008
1065
|
let e = s.trim();
|
|
1009
1066
|
if (!(!e || !t)) {
|
|
@@ -1021,7 +1078,7 @@ var Vt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1021
1078
|
return e.text.toLowerCase().includes(t) || e.author.toLowerCase().includes(t);
|
|
1022
1079
|
}) : e].sort((e, t) => e.pinned && !t.pinned ? -1 : !e.pinned && t.pinned ? 1 : 0), [e, d]);
|
|
1023
1080
|
return /* @__PURE__ */ Q(b, {
|
|
1024
|
-
className:
|
|
1081
|
+
className: G("", a),
|
|
1025
1082
|
children: [/* @__PURE__ */ Z(S, { children: /* @__PURE__ */ Q(C, {
|
|
1026
1083
|
className: "flex items-center gap-2 text-base",
|
|
1027
1084
|
children: [
|
|
@@ -1086,7 +1143,7 @@ var Vt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1086
1143
|
}) : /* @__PURE__ */ Z("div", {
|
|
1087
1144
|
className: "space-y-3",
|
|
1088
1145
|
children: h.map((e) => /* @__PURE__ */ Q("div", {
|
|
1089
|
-
className:
|
|
1146
|
+
className: G("flex gap-3", e.pinned && "bg-muted/40 rounded-md p-2 -mx-2"),
|
|
1090
1147
|
children: [/* @__PURE__ */ Z("div", {
|
|
1091
1148
|
className: "shrink-0",
|
|
1092
1149
|
children: e.avatarUrl ? /* @__PURE__ */ Z("img", {
|
|
@@ -1109,7 +1166,7 @@ var Vt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1109
1166
|
}),
|
|
1110
1167
|
/* @__PURE__ */ Z("span", {
|
|
1111
1168
|
className: "text-xs text-muted-foreground",
|
|
1112
|
-
children:
|
|
1169
|
+
children: Vt(e.createdAt)
|
|
1113
1170
|
}),
|
|
1114
1171
|
e.pinned && /* @__PURE__ */ Q("span", {
|
|
1115
1172
|
className: "text-xs text-amber-600 flex items-center gap-0.5",
|
|
@@ -1135,20 +1192,20 @@ var Vt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1135
1192
|
]
|
|
1136
1193
|
})]
|
|
1137
1194
|
});
|
|
1138
|
-
},
|
|
1139
|
-
field_change:
|
|
1195
|
+
}, Ut = {
|
|
1196
|
+
field_change: Ce,
|
|
1140
1197
|
create: Ge,
|
|
1141
1198
|
delete: Qe,
|
|
1142
1199
|
comment: Le,
|
|
1143
|
-
status_change:
|
|
1144
|
-
},
|
|
1200
|
+
status_change: ce
|
|
1201
|
+
}, Wt = {
|
|
1145
1202
|
field_change: "bg-blue-100 text-blue-600",
|
|
1146
1203
|
create: "bg-green-100 text-green-600",
|
|
1147
1204
|
delete: "bg-red-100 text-red-600",
|
|
1148
1205
|
comment: "bg-purple-100 text-purple-600",
|
|
1149
1206
|
status_change: "bg-amber-100 text-amber-600"
|
|
1150
1207
|
};
|
|
1151
|
-
function
|
|
1208
|
+
function Gt(e) {
|
|
1152
1209
|
try {
|
|
1153
1210
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1154
1211
|
if (r < 1) return "just now";
|
|
@@ -1161,24 +1218,24 @@ function Wt(e) {
|
|
|
1161
1218
|
return e;
|
|
1162
1219
|
}
|
|
1163
1220
|
}
|
|
1164
|
-
function
|
|
1221
|
+
function Kt(e) {
|
|
1165
1222
|
return e.description ? e.description : e.type === "field_change" && e.field ? `Changed ${e.field.charAt(0).toUpperCase() + e.field.slice(1).replace(/_/g, " ")} from "${e.oldValue == null ? "(empty)" : String(e.oldValue)}" to "${e.newValue == null ? "(empty)" : String(e.newValue)}"` : e.type === "create" ? "Created this record" : e.type === "delete" ? "Deleted this record" : e.type === "status_change" && e.field ? `Changed status to "${e.newValue == null ? "(empty)" : String(e.newValue)}"` : "Updated record";
|
|
1166
1223
|
}
|
|
1167
|
-
var
|
|
1224
|
+
var qt = {
|
|
1168
1225
|
all: "All",
|
|
1169
1226
|
field_change: "Field Changes",
|
|
1170
1227
|
create: "Creates",
|
|
1171
1228
|
delete: "Deletes",
|
|
1172
1229
|
comment: "Comments",
|
|
1173
1230
|
status_change: "Status Changes"
|
|
1174
|
-
},
|
|
1231
|
+
}, Jt = ({ activities: e, filterable: t = !1, defaultFilter: r = "all", className: i }) => {
|
|
1175
1232
|
let [a, o] = n.useState(r), s = n.useMemo(() => a === "all" ? e : e.filter((e) => e.type === a), [e, a]);
|
|
1176
1233
|
return /* @__PURE__ */ Q(b, {
|
|
1177
|
-
className:
|
|
1234
|
+
className: G("", i),
|
|
1178
1235
|
children: [/* @__PURE__ */ Z(S, { children: /* @__PURE__ */ Q(C, {
|
|
1179
1236
|
className: "flex items-center gap-2 text-base",
|
|
1180
1237
|
children: [
|
|
1181
|
-
/* @__PURE__ */ Z(
|
|
1238
|
+
/* @__PURE__ */ Z(ae, { className: "h-4 w-4" }),
|
|
1182
1239
|
"Activity",
|
|
1183
1240
|
/* @__PURE__ */ Q("span", {
|
|
1184
1241
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1193,12 +1250,12 @@ var Kt = {
|
|
|
1193
1250
|
className: "flex flex-wrap gap-1.5 mb-4",
|
|
1194
1251
|
role: "group",
|
|
1195
1252
|
"aria-label": "Activity type filter",
|
|
1196
|
-
children: Object.keys(
|
|
1253
|
+
children: Object.keys(qt).map((e) => /* @__PURE__ */ Q("button", {
|
|
1197
1254
|
type: "button",
|
|
1198
|
-
className:
|
|
1255
|
+
className: G("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"),
|
|
1199
1256
|
onClick: () => o(e),
|
|
1200
1257
|
"aria-pressed": a === e,
|
|
1201
|
-
children: [e !== "all" && n.createElement(
|
|
1258
|
+
children: [e !== "all" && n.createElement(Ut[e] || Ce, { className: "h-3 w-3" }), qt[e]]
|
|
1202
1259
|
}, e))
|
|
1203
1260
|
}), s.length === 0 ? /* @__PURE__ */ Z(D, {
|
|
1204
1261
|
title: "No activity recorded",
|
|
@@ -1208,11 +1265,11 @@ var Kt = {
|
|
|
1208
1265
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
1209
1266
|
className: "space-y-4",
|
|
1210
1267
|
children: s.map((e) => {
|
|
1211
|
-
let t =
|
|
1268
|
+
let t = Ut[e.type] || Ce;
|
|
1212
1269
|
return /* @__PURE__ */ Q("div", {
|
|
1213
1270
|
className: "flex gap-3 relative",
|
|
1214
1271
|
children: [/* @__PURE__ */ Z("div", {
|
|
1215
|
-
className:
|
|
1272
|
+
className: G("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", Wt[e.type] || "bg-gray-100 text-gray-600"),
|
|
1216
1273
|
children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
|
|
1217
1274
|
}), /* @__PURE__ */ Q("div", {
|
|
1218
1275
|
className: "flex-1 min-w-0 pt-1",
|
|
@@ -1226,12 +1283,12 @@ var Kt = {
|
|
|
1226
1283
|
" ",
|
|
1227
1284
|
/* @__PURE__ */ Z("span", {
|
|
1228
1285
|
className: "text-muted-foreground",
|
|
1229
|
-
children:
|
|
1286
|
+
children: Kt(e)
|
|
1230
1287
|
})
|
|
1231
1288
|
]
|
|
1232
1289
|
}), /* @__PURE__ */ Z("p", {
|
|
1233
1290
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
1234
|
-
children:
|
|
1291
|
+
children: Gt(e.timestamp)
|
|
1235
1292
|
})]
|
|
1236
1293
|
})]
|
|
1237
1294
|
}, e.id);
|
|
@@ -1239,7 +1296,7 @@ var Kt = {
|
|
|
1239
1296
|
})]
|
|
1240
1297
|
})] })]
|
|
1241
1298
|
});
|
|
1242
|
-
},
|
|
1299
|
+
}, Yt = {
|
|
1243
1300
|
create: "default",
|
|
1244
1301
|
update: "secondary",
|
|
1245
1302
|
delete: "destructive",
|
|
@@ -1251,12 +1308,12 @@ var Kt = {
|
|
|
1251
1308
|
export: "outline",
|
|
1252
1309
|
import: "outline"
|
|
1253
1310
|
};
|
|
1254
|
-
function
|
|
1311
|
+
function Xt(e) {
|
|
1255
1312
|
if (!e) return "";
|
|
1256
1313
|
let t = e instanceof Date ? e : new Date(e);
|
|
1257
1314
|
return Number.isNaN(t.getTime()) ? String(e) : t.toLocaleString();
|
|
1258
1315
|
}
|
|
1259
|
-
var
|
|
1316
|
+
var Zt = [
|
|
1260
1317
|
[60, "second"],
|
|
1261
1318
|
[60, "minute"],
|
|
1262
1319
|
[24, "hour"],
|
|
@@ -1265,27 +1322,27 @@ var Xt = [
|
|
|
1265
1322
|
[12, "month"],
|
|
1266
1323
|
[Infinity, "year"]
|
|
1267
1324
|
];
|
|
1268
|
-
function
|
|
1325
|
+
function Qt(e, t) {
|
|
1269
1326
|
if (!e) return "";
|
|
1270
1327
|
let n = e instanceof Date ? e : new Date(e);
|
|
1271
1328
|
if (Number.isNaN(n.getTime())) return String(e);
|
|
1272
1329
|
let r = (n.getTime() - Date.now()) / 1e3;
|
|
1273
|
-
for (let [n, i] of
|
|
1330
|
+
for (let [n, i] of Zt) {
|
|
1274
1331
|
if (Math.abs(r) < n) try {
|
|
1275
1332
|
return new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(Math.round(r), i);
|
|
1276
1333
|
} catch {
|
|
1277
|
-
return
|
|
1334
|
+
return Xt(e);
|
|
1278
1335
|
}
|
|
1279
1336
|
r /= n;
|
|
1280
1337
|
}
|
|
1281
|
-
return
|
|
1338
|
+
return Xt(e);
|
|
1282
1339
|
}
|
|
1283
|
-
function
|
|
1340
|
+
function $t(e) {
|
|
1284
1341
|
if (!e) return "?";
|
|
1285
1342
|
let t = e.trim().split(/\s+/).filter(Boolean).slice(0, 2);
|
|
1286
1343
|
return t.length === 0 ? "?" : t.map((e) => e.charAt(0).toUpperCase()).join("");
|
|
1287
1344
|
}
|
|
1288
|
-
function
|
|
1345
|
+
function en(e) {
|
|
1289
1346
|
if (e == null || e === "") return "—";
|
|
1290
1347
|
if (typeof e == "string") return e;
|
|
1291
1348
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -1295,9 +1352,9 @@ function $t(e) {
|
|
|
1295
1352
|
return String(e);
|
|
1296
1353
|
}
|
|
1297
1354
|
}
|
|
1298
|
-
function
|
|
1355
|
+
function tn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
1299
1356
|
return t ? /* @__PURE__ */ Z("div", {
|
|
1300
|
-
className:
|
|
1357
|
+
className: G("space-y-3", r),
|
|
1301
1358
|
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ Q("div", {
|
|
1302
1359
|
className: "flex items-start gap-3",
|
|
1303
1360
|
children: [/* @__PURE__ */ Z(L, { className: "h-8 w-8 rounded-full" }), /* @__PURE__ */ Q("div", {
|
|
@@ -1306,14 +1363,14 @@ function en({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1306
1363
|
})]
|
|
1307
1364
|
}, t))
|
|
1308
1365
|
}) : !e || e.length === 0 ? /* @__PURE__ */ Z("div", {
|
|
1309
|
-
className:
|
|
1366
|
+
className: G("flex items-center justify-center rounded-md border border-dashed py-10 text-sm text-muted-foreground", r),
|
|
1310
1367
|
children: n ?? "No history yet"
|
|
1311
1368
|
}) : /* @__PURE__ */ Z(re, {
|
|
1312
1369
|
delayDuration: 150,
|
|
1313
1370
|
children: /* @__PURE__ */ Z("ol", {
|
|
1314
|
-
className:
|
|
1371
|
+
className: G("space-y-4", r),
|
|
1315
1372
|
children: e.map((e, t) => {
|
|
1316
|
-
let n = (e.action ?? "").toLowerCase(), r =
|
|
1373
|
+
let n = (e.action ?? "").toLowerCase(), r = Yt[n] ?? "outline", a = typeof e.user_name == "string" && e.user_name.trim() || "Unknown user", o = Xt(e.created_at), s = Qt(e.created_at, i), c = typeof e.user_avatar == "string" ? e.user_avatar : void 0;
|
|
1317
1374
|
return /* @__PURE__ */ Q("li", {
|
|
1318
1375
|
className: "flex items-start gap-3",
|
|
1319
1376
|
children: [/* @__PURE__ */ Q(h, {
|
|
@@ -1323,7 +1380,7 @@ function en({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1323
1380
|
alt: a
|
|
1324
1381
|
}) : null, /* @__PURE__ */ Z(g, {
|
|
1325
1382
|
className: "text-[10px] font-medium",
|
|
1326
|
-
children:
|
|
1383
|
+
children: $t(e.user_name)
|
|
1327
1384
|
})]
|
|
1328
1385
|
}), /* @__PURE__ */ Q("div", {
|
|
1329
1386
|
className: "min-w-0 flex-1",
|
|
@@ -1374,7 +1431,7 @@ function en({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1374
1431
|
": ",
|
|
1375
1432
|
/* @__PURE__ */ Z("span", {
|
|
1376
1433
|
className: "text-foreground",
|
|
1377
|
-
children:
|
|
1434
|
+
children: en(e.to)
|
|
1378
1435
|
})
|
|
1379
1436
|
]
|
|
1380
1437
|
}, e.field))
|
|
@@ -1391,12 +1448,12 @@ function en({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1391
1448
|
": ",
|
|
1392
1449
|
/* @__PURE__ */ Z("span", {
|
|
1393
1450
|
className: "line-through opacity-70",
|
|
1394
|
-
children:
|
|
1451
|
+
children: en(e.from)
|
|
1395
1452
|
}),
|
|
1396
1453
|
" → ",
|
|
1397
1454
|
/* @__PURE__ */ Z("span", {
|
|
1398
1455
|
className: "text-foreground",
|
|
1399
|
-
children:
|
|
1456
|
+
children: en(e.to)
|
|
1400
1457
|
})
|
|
1401
1458
|
]
|
|
1402
1459
|
}, e.field))
|
|
@@ -1410,13 +1467,13 @@ function en({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1410
1467
|
}
|
|
1411
1468
|
//#endregion
|
|
1412
1469
|
//#region src/RecordMetaFooter.tsx
|
|
1413
|
-
var
|
|
1470
|
+
var nn = {
|
|
1414
1471
|
createdAt: "created_at",
|
|
1415
1472
|
createdBy: "created_by",
|
|
1416
1473
|
updatedAt: "updated_at",
|
|
1417
1474
|
updatedBy: "updated_by"
|
|
1418
1475
|
};
|
|
1419
|
-
function
|
|
1476
|
+
function rn(e) {
|
|
1420
1477
|
if (!e) return null;
|
|
1421
1478
|
if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
|
|
1422
1479
|
if (typeof e == "string" || typeof e == "number") {
|
|
@@ -1425,7 +1482,7 @@ function nn(e) {
|
|
|
1425
1482
|
}
|
|
1426
1483
|
return null;
|
|
1427
1484
|
}
|
|
1428
|
-
function
|
|
1485
|
+
function an(e, t) {
|
|
1429
1486
|
let n = Date.now() - e.getTime(), r = Math.max(0, Math.floor(n / 1e3));
|
|
1430
1487
|
if (r < 60) return t("detail.justNow");
|
|
1431
1488
|
let i = Math.floor(r / 60);
|
|
@@ -1433,7 +1490,7 @@ function rn(e, t) {
|
|
|
1433
1490
|
let a = Math.floor(i / 60);
|
|
1434
1491
|
return a < 24 ? t("detail.hoursAgo", { count: a }) : t("detail.daysAgo", { count: Math.floor(a / 24) });
|
|
1435
1492
|
}
|
|
1436
|
-
function
|
|
1493
|
+
function on(e) {
|
|
1437
1494
|
try {
|
|
1438
1495
|
return new Intl.DateTimeFormat(void 0, {
|
|
1439
1496
|
dateStyle: "medium",
|
|
@@ -1443,16 +1500,16 @@ function an(e) {
|
|
|
1443
1500
|
return e.toISOString();
|
|
1444
1501
|
}
|
|
1445
1502
|
}
|
|
1446
|
-
var
|
|
1503
|
+
var sn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
1447
1504
|
if (e == null || e === "") return null;
|
|
1448
1505
|
let r = t?.fields?.[n], i = r?.reference_to || r?.reference, a = {
|
|
1449
1506
|
name: n,
|
|
1450
1507
|
type: r?.type || (i ? "lookup" : "text"),
|
|
1451
1508
|
...i && { reference_to: i },
|
|
1452
1509
|
...r?.reference_field && { reference_field: r.reference_field }
|
|
1453
|
-
}, o =
|
|
1510
|
+
}, o = yt(a) || a.type;
|
|
1454
1511
|
if (o) {
|
|
1455
|
-
let t =
|
|
1512
|
+
let t = _t(o);
|
|
1456
1513
|
if (t) return /* @__PURE__ */ Z("span", {
|
|
1457
1514
|
className: "inline-flex items-center [&_a]:text-inherit [&_a]:hover:underline",
|
|
1458
1515
|
children: /* @__PURE__ */ Z(t, {
|
|
@@ -1462,7 +1519,7 @@ var on = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1462
1519
|
});
|
|
1463
1520
|
}
|
|
1464
1521
|
return /* @__PURE__ */ Z("span", { children: String(e) });
|
|
1465
|
-
},
|
|
1522
|
+
}, cn = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
|
|
1466
1523
|
if (!t && !n) return null;
|
|
1467
1524
|
let o = n ? /* @__PURE__ */ Z(re, {
|
|
1468
1525
|
delayDuration: 200,
|
|
@@ -1471,11 +1528,11 @@ var on = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1471
1528
|
children: /* @__PURE__ */ Z("time", {
|
|
1472
1529
|
dateTime: n.toISOString(),
|
|
1473
1530
|
className: "cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2",
|
|
1474
|
-
children:
|
|
1531
|
+
children: an(n, a)
|
|
1475
1532
|
})
|
|
1476
1533
|
}), /* @__PURE__ */ Z(H, {
|
|
1477
1534
|
side: "top",
|
|
1478
|
-
children:
|
|
1535
|
+
children: on(n)
|
|
1479
1536
|
})] })
|
|
1480
1537
|
}) : null;
|
|
1481
1538
|
return /* @__PURE__ */ Q("span", {
|
|
@@ -1485,7 +1542,7 @@ var on = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1485
1542
|
className: "text-muted-foreground/70",
|
|
1486
1543
|
children: e
|
|
1487
1544
|
}),
|
|
1488
|
-
t ? /* @__PURE__ */ Z(
|
|
1545
|
+
t ? /* @__PURE__ */ Z(sn, {
|
|
1489
1546
|
value: t,
|
|
1490
1547
|
objectSchema: r,
|
|
1491
1548
|
fieldName: i
|
|
@@ -1497,31 +1554,31 @@ var on = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1497
1554
|
o
|
|
1498
1555
|
]
|
|
1499
1556
|
});
|
|
1500
|
-
},
|
|
1557
|
+
}, ln = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
|
|
1501
1558
|
let { t: i } = $();
|
|
1502
1559
|
if (!e) return null;
|
|
1503
|
-
let a =
|
|
1560
|
+
let a = rn(e[nn.createdAt]), o = rn(e[nn.updatedAt]), s = e[nn.createdBy], c = e[nn.updatedBy], l = !!(a || s), u = a && o && Math.abs(o.getTime() - a.getTime()) < 2e3, d = !!(o || c) && !(u && (s != null && c != null && String(s) === String(c) || !c));
|
|
1504
1561
|
return !l && !d ? null : /* @__PURE__ */ Q("div", {
|
|
1505
|
-
className:
|
|
1562
|
+
className: G("mt-6 pt-3 border-t border-border/40", "flex flex-wrap items-center gap-x-4 gap-y-1", "text-xs text-muted-foreground", r),
|
|
1506
1563
|
"data-testid": "record-meta-footer",
|
|
1507
|
-
children: [l && /* @__PURE__ */ Z(
|
|
1564
|
+
children: [l && /* @__PURE__ */ Z(cn, {
|
|
1508
1565
|
label: i("detail.createdBy"),
|
|
1509
1566
|
user: s,
|
|
1510
1567
|
date: a,
|
|
1511
1568
|
objectSchema: t,
|
|
1512
|
-
userField:
|
|
1569
|
+
userField: nn.createdBy,
|
|
1513
1570
|
t: i
|
|
1514
|
-
}), d && /* @__PURE__ */ Z(
|
|
1571
|
+
}), d && /* @__PURE__ */ Z(cn, {
|
|
1515
1572
|
label: i("detail.updatedBy"),
|
|
1516
1573
|
user: c,
|
|
1517
1574
|
date: o,
|
|
1518
1575
|
objectSchema: t,
|
|
1519
|
-
userField:
|
|
1576
|
+
userField: nn.updatedBy,
|
|
1520
1577
|
t: i
|
|
1521
1578
|
})]
|
|
1522
1579
|
});
|
|
1523
|
-
},
|
|
1524
|
-
function
|
|
1580
|
+
}, un = 5;
|
|
1581
|
+
function dn(e, t, n, r) {
|
|
1525
1582
|
if (e && typeof e == "object") {
|
|
1526
1583
|
if (t.primaryField) {
|
|
1527
1584
|
let n = e[t.primaryField];
|
|
@@ -1568,10 +1625,10 @@ function un(e, t, n, r) {
|
|
|
1568
1625
|
}
|
|
1569
1626
|
return r;
|
|
1570
1627
|
}
|
|
1571
|
-
var
|
|
1572
|
-
let [g, _] = n.useState(e.data), [b, x] = n.useState(!e.data && !!(e.api && e.resourceId || r && e.objectName && e.resourceId)), [S, C] = n.useState(!1), w = m ?? S, [T, E] = n.useState(!1), [D, O] = n.useState({}), [k, A] = n.useState(!1), [j, M] = n.useState(null), [N, ee] = n.useState(null), [P,
|
|
1573
|
-
if (!
|
|
1574
|
-
let t = (t) =>
|
|
1628
|
+
var fn = ({ 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, isFavorite: m, onToggleFavorite: h }) => {
|
|
1629
|
+
let [g, _] = n.useState(e.data), [b, x] = n.useState(!e.data && !!(e.api && e.resourceId || r && e.objectName && e.resourceId)), [S, C] = n.useState(!1), w = m ?? S, [T, E] = n.useState(!1), [D, O] = n.useState({}), [k, A] = n.useState(!1), [j, M] = n.useState(null), [N, ee] = n.useState(null), [P, te] = n.useState(!1), [F, I] = n.useState(0), [W, ae] = n.useState(!1), { t: K } = $(), { currency: se } = wt(), { fieldOptionLabel: ce } = pt(), le = ie(), q = St(), J = n.useMemo(() => {
|
|
1630
|
+
if (!q?.isLoaded || !e.objectName) return e;
|
|
1631
|
+
let t = (t) => q.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
|
|
1575
1632
|
let n = typeof e == "string" ? e : e?.name;
|
|
1576
1633
|
return !n || t(n);
|
|
1577
1634
|
});
|
|
@@ -1584,13 +1641,13 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1584
1641
|
})),
|
|
1585
1642
|
summaryFields: n(e.summaryFields)
|
|
1586
1643
|
};
|
|
1587
|
-
}, [e,
|
|
1644
|
+
}, [e, q]);
|
|
1588
1645
|
n.useEffect(() => {
|
|
1589
1646
|
g && p && p(g);
|
|
1590
1647
|
}, [g, p]);
|
|
1591
|
-
let
|
|
1592
|
-
if (
|
|
1593
|
-
let e = [...
|
|
1648
|
+
let ue = n.useMemo(() => {
|
|
1649
|
+
if (J.summaryFields && J.summaryFields.length > 0) return [];
|
|
1650
|
+
let e = [...J.sections?.flatMap((e) => e.fields) || [], ...J.fields || []], t = {};
|
|
1594
1651
|
for (let n of e) t[n.name] || (t[n.name] = n);
|
|
1595
1652
|
if (N?.fields) for (let [e, n] of Object.entries(N.fields)) t[e] = {
|
|
1596
1653
|
...t[e] || {},
|
|
@@ -1609,26 +1666,26 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1609
1666
|
let o = Object.keys(t).find((e) => (t[e]?.type === "date" || t[e]?.type === "datetime") && /close|due|start|end|expected/i.test(e) && n(e));
|
|
1610
1667
|
return o && !r.includes(o) && r.push(o), r;
|
|
1611
1668
|
}, [
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1669
|
+
J.summaryFields,
|
|
1670
|
+
J.sections,
|
|
1671
|
+
J.fields,
|
|
1615
1672
|
N,
|
|
1616
1673
|
g
|
|
1617
|
-
]),
|
|
1618
|
-
|
|
1619
|
-
|
|
1674
|
+
]), de = J.summaryFields && J.summaryFields.length > 0 ? J.summaryFields : ue, fe = n.useCallback(() => {
|
|
1675
|
+
J.resourceId && navigator.clipboard.writeText(String(J.resourceId)).then(() => {
|
|
1676
|
+
te(!0), setTimeout(() => te(!1), 1500);
|
|
1620
1677
|
});
|
|
1621
|
-
}, [
|
|
1678
|
+
}, [J.resourceId]);
|
|
1622
1679
|
n.useEffect(() => {
|
|
1623
1680
|
let e = !0;
|
|
1624
|
-
if (
|
|
1681
|
+
if (J.data) return _(J.data), x(!1), r?.getObjectSchema && J.objectName && r.getObjectSchema(J.objectName).then((t) => {
|
|
1625
1682
|
e && ee(t);
|
|
1626
1683
|
}).catch(() => {}), () => {
|
|
1627
1684
|
e = !1;
|
|
1628
1685
|
};
|
|
1629
|
-
if (r &&
|
|
1686
|
+
if (r && J.objectName && J.resourceId) {
|
|
1630
1687
|
x(!0), ee(null), _(null);
|
|
1631
|
-
let n =
|
|
1688
|
+
let n = J.objectName, i = J.resourceId, a = `${n}-`, o = [...J.sections?.flatMap((e) => e.fields) || [], ...J.fields || []];
|
|
1632
1689
|
(r.getObjectSchema ? r.getObjectSchema(n).catch(() => null) : Promise.resolve(null)).then((s) => {
|
|
1633
1690
|
if (!e) return;
|
|
1634
1691
|
ee(s);
|
|
@@ -1652,7 +1709,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1652
1709
|
}).catch((t) => {
|
|
1653
1710
|
e && (console.error("Failed to fetch detail data:", t), x(!1));
|
|
1654
1711
|
});
|
|
1655
|
-
} else
|
|
1712
|
+
} else J.api && J.resourceId && (x(!0), fetch(`${J.api}/${J.resourceId}`).then((e) => e.json()).then((t) => {
|
|
1656
1713
|
e && _(t?.data || t);
|
|
1657
1714
|
}).catch((e) => {
|
|
1658
1715
|
console.error("Failed to fetch detail data:", e);
|
|
@@ -1663,71 +1720,71 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1663
1720
|
e = !1;
|
|
1664
1721
|
};
|
|
1665
1722
|
}, [
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1723
|
+
J.api,
|
|
1724
|
+
J.resourceId,
|
|
1725
|
+
J.objectName,
|
|
1669
1726
|
r,
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1727
|
+
J.sections,
|
|
1728
|
+
J.fields,
|
|
1729
|
+
F
|
|
1673
1730
|
]);
|
|
1674
1731
|
let me = n.useCallback(() => {
|
|
1675
1732
|
if (s) s();
|
|
1676
|
-
else if (
|
|
1677
|
-
let e =
|
|
1678
|
-
|
|
1679
|
-
} else
|
|
1680
|
-
}, [s,
|
|
1681
|
-
a ? a() :
|
|
1682
|
-
}, [a,
|
|
1683
|
-
if (!r?.cancelPendingApproval || !
|
|
1684
|
-
M(
|
|
1733
|
+
else if (J.onNavigate) {
|
|
1734
|
+
let e = J.backUrl || (J.objectName ? `/${J.objectName}` : "/");
|
|
1735
|
+
J.onNavigate(e, { replace: !0 });
|
|
1736
|
+
} else J.backUrl ? window.location.href = J.backUrl : window.history.back();
|
|
1737
|
+
}, [s, J]), he = n.useCallback(() => {
|
|
1738
|
+
a ? a() : J.onNavigate && J.editUrl ? J.onNavigate(J.editUrl) : J.onNavigate && J.objectName && J.resourceId ? J.onNavigate(`/${J.objectName}/${J.resourceId}/edit`) : J.editUrl && (window.location.href = J.editUrl);
|
|
1739
|
+
}, [a, J]), ve = n.useCallback(async () => {
|
|
1740
|
+
if (!r?.cancelPendingApproval || !J.objectName || !J.resourceId) {
|
|
1741
|
+
M(K("detail.cancelApprovalUnavailable"));
|
|
1685
1742
|
return;
|
|
1686
1743
|
}
|
|
1687
|
-
|
|
1744
|
+
ae(!0), M(null);
|
|
1688
1745
|
try {
|
|
1689
|
-
if (await r.cancelPendingApproval(String(
|
|
1690
|
-
let e = await r.findOne(String(
|
|
1746
|
+
if (await r.cancelPendingApproval(String(J.objectName), String(J.resourceId)), r.findOne) try {
|
|
1747
|
+
let e = await r.findOne(String(J.objectName), String(J.resourceId));
|
|
1691
1748
|
e && _(e);
|
|
1692
1749
|
} catch {}
|
|
1693
|
-
|
|
1750
|
+
I((e) => e + 1);
|
|
1694
1751
|
try {
|
|
1695
1752
|
window.dispatchEvent(new CustomEvent("objectui:record-changed", { detail: {
|
|
1696
|
-
objectName: String(
|
|
1697
|
-
recordId: String(
|
|
1753
|
+
objectName: String(J.objectName),
|
|
1754
|
+
recordId: String(J.resourceId),
|
|
1698
1755
|
reason: "approval-recalled"
|
|
1699
1756
|
} }));
|
|
1700
1757
|
} catch {}
|
|
1701
1758
|
} catch (e) {
|
|
1702
1759
|
let t = (e?.message || e?.error || String(e ?? "Cancel failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
|
|
1703
|
-
M(`${
|
|
1760
|
+
M(`${K("detail.cancelApprovalFailed")}: ${t}`);
|
|
1704
1761
|
} finally {
|
|
1705
|
-
|
|
1762
|
+
ae(!1);
|
|
1706
1763
|
}
|
|
1707
1764
|
}, [
|
|
1708
1765
|
r,
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
]),
|
|
1713
|
-
let e =
|
|
1714
|
-
window.confirm(e) && (o?.(),
|
|
1715
|
-
}, [o,
|
|
1716
|
-
navigator.share &&
|
|
1717
|
-
title:
|
|
1718
|
-
text: `${
|
|
1766
|
+
J.objectName,
|
|
1767
|
+
J.resourceId,
|
|
1768
|
+
K
|
|
1769
|
+
]), ye = n.useCallback(() => {
|
|
1770
|
+
let e = J.deleteConfirmation || K("detail.deleteConfirmation");
|
|
1771
|
+
window.confirm(e) && (o?.(), J.onNavigate && J.objectName && J.onNavigate(`/${J.objectName}`, { replace: !0 }));
|
|
1772
|
+
}, [o, J]), be = n.useCallback(() => {
|
|
1773
|
+
navigator.share && J.objectName && J.resourceId ? navigator.share({
|
|
1774
|
+
title: J.title || K("detail.details"),
|
|
1775
|
+
text: `${J.objectName} #${J.resourceId}`,
|
|
1719
1776
|
url: window.location.href
|
|
1720
1777
|
}).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
|
|
1721
1778
|
console.log("Link copied to clipboard");
|
|
1722
1779
|
});
|
|
1723
|
-
}, [
|
|
1780
|
+
}, [J]), xe = n.useCallback(() => {
|
|
1724
1781
|
let e = !w;
|
|
1725
1782
|
h && h(e), m === void 0 && C(e);
|
|
1726
1783
|
}, [
|
|
1727
1784
|
w,
|
|
1728
1785
|
m,
|
|
1729
1786
|
h
|
|
1730
|
-
]),
|
|
1787
|
+
]), we = n.useCallback(async () => {
|
|
1731
1788
|
if (T) {
|
|
1732
1789
|
let e = Object.entries(D);
|
|
1733
1790
|
if (e.length > 0) {
|
|
@@ -1754,79 +1811,79 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1754
1811
|
D,
|
|
1755
1812
|
g,
|
|
1756
1813
|
l
|
|
1757
|
-
]),
|
|
1814
|
+
]), Te = n.useCallback(() => {
|
|
1758
1815
|
O({}), E(!1), M(null);
|
|
1759
|
-
}, []),
|
|
1816
|
+
}, []), Y = n.useCallback((e, t) => {
|
|
1760
1817
|
O((n) => ({
|
|
1761
1818
|
...n,
|
|
1762
1819
|
[e]: t
|
|
1763
1820
|
}));
|
|
1764
1821
|
}, []);
|
|
1765
1822
|
n.useEffect(() => {
|
|
1766
|
-
if (!
|
|
1767
|
-
let e =
|
|
1823
|
+
if (!J.recordNavigation) return;
|
|
1824
|
+
let e = J.recordNavigation, t = (t) => {
|
|
1768
1825
|
let n = t.target?.tagName;
|
|
1769
1826
|
n === "INPUT" || n === "TEXTAREA" || t.target?.isContentEditable || (t.key === "ArrowLeft" && e.currentIndex > 0 ? (t.preventDefault(), e.onNavigate(e.recordIds[e.currentIndex - 1])) : t.key === "ArrowRight" && e.currentIndex < e.recordIds.length - 1 && (t.preventDefault(), e.onNavigate(e.recordIds[e.currentIndex + 1])));
|
|
1770
1827
|
};
|
|
1771
1828
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
1772
|
-
}, [
|
|
1773
|
-
if (!c ||
|
|
1829
|
+
}, [J.recordNavigation]), n.useEffect(() => {
|
|
1830
|
+
if (!c || J.showHeader !== !1) return;
|
|
1774
1831
|
let e = "objectui:record:inline-edit-toggle", t = (e) => {
|
|
1775
1832
|
let t = e.detail;
|
|
1776
|
-
t?.recordId &&
|
|
1833
|
+
t?.recordId && J.recordId && t.recordId !== J.recordId || t?.objectName && J.objectName && t.objectName !== J.objectName || we();
|
|
1777
1834
|
};
|
|
1778
1835
|
return window.addEventListener(e, t), () => window.removeEventListener(e, t);
|
|
1779
1836
|
}, [
|
|
1780
1837
|
c,
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1838
|
+
J.showHeader,
|
|
1839
|
+
J.recordId,
|
|
1840
|
+
J.objectName,
|
|
1841
|
+
we
|
|
1785
1842
|
]);
|
|
1786
|
-
let
|
|
1843
|
+
let Ee = n.useMemo(() => J.related ?? [], [J.related]), De = n.useMemo(() => {
|
|
1787
1844
|
let e = [];
|
|
1788
1845
|
return e.push({
|
|
1789
1846
|
name: "sys_share",
|
|
1790
|
-
label:
|
|
1847
|
+
label: K("detail.share"),
|
|
1791
1848
|
icon: "share-2",
|
|
1792
1849
|
type: "script",
|
|
1793
|
-
onClick:
|
|
1794
|
-
}),
|
|
1850
|
+
onClick: be
|
|
1851
|
+
}), J.showEdit && e.push({
|
|
1795
1852
|
name: "sys_edit_mobile",
|
|
1796
|
-
label:
|
|
1853
|
+
label: K("detail.edit"),
|
|
1797
1854
|
icon: "edit",
|
|
1798
1855
|
type: "script",
|
|
1799
1856
|
className: "sm:hidden",
|
|
1800
1857
|
onClick: he
|
|
1801
1858
|
}), c && e.push({
|
|
1802
1859
|
name: "sys_toggle_inline_edit_mobile",
|
|
1803
|
-
label:
|
|
1860
|
+
label: K(T ? "detail.save" : "detail.editInline"),
|
|
1804
1861
|
icon: "edit",
|
|
1805
1862
|
type: "script",
|
|
1806
1863
|
className: "sm:hidden",
|
|
1807
|
-
onClick:
|
|
1808
|
-
}),
|
|
1864
|
+
onClick: we
|
|
1865
|
+
}), J.showDelete && e.push({
|
|
1809
1866
|
name: "sys_delete",
|
|
1810
|
-
label:
|
|
1867
|
+
label: K("detail.delete"),
|
|
1811
1868
|
icon: "trash-2",
|
|
1812
1869
|
type: "script",
|
|
1813
1870
|
variant: "destructive",
|
|
1814
1871
|
tags: ["separator-before"],
|
|
1815
|
-
onClick:
|
|
1872
|
+
onClick: ye
|
|
1816
1873
|
}), e;
|
|
1817
1874
|
}, [
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1875
|
+
K,
|
|
1876
|
+
J.showEdit,
|
|
1877
|
+
J.showDelete,
|
|
1821
1878
|
c,
|
|
1822
1879
|
T,
|
|
1823
|
-
|
|
1880
|
+
be,
|
|
1824
1881
|
he,
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
]),
|
|
1828
|
-
let e =
|
|
1829
|
-
if (
|
|
1882
|
+
we,
|
|
1883
|
+
ye
|
|
1884
|
+
]), Oe = n.useMemo(() => {
|
|
1885
|
+
let e = J.actions ?? [];
|
|
1886
|
+
if (De.length === 0) return e;
|
|
1830
1887
|
let t = !1, n = e.map((e) => {
|
|
1831
1888
|
let n = e;
|
|
1832
1889
|
if (n && typeof n == "object" && n.type === "action:bar" && (!n.location || n.location === "record_header")) {
|
|
@@ -1834,7 +1891,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1834
1891
|
let e = Array.isArray(n.systemActions) ? n.systemActions : [];
|
|
1835
1892
|
return {
|
|
1836
1893
|
...n,
|
|
1837
|
-
systemActions: [...e, ...
|
|
1894
|
+
systemActions: [...e, ...De]
|
|
1838
1895
|
};
|
|
1839
1896
|
}
|
|
1840
1897
|
return e;
|
|
@@ -1842,72 +1899,72 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1842
1899
|
return t || n.push({
|
|
1843
1900
|
type: "action:bar",
|
|
1844
1901
|
location: "record_header",
|
|
1845
|
-
systemActions:
|
|
1902
|
+
systemActions: De
|
|
1846
1903
|
}), n;
|
|
1847
|
-
}, [
|
|
1848
|
-
return b ||
|
|
1849
|
-
className:
|
|
1904
|
+
}, [J.actions, De]);
|
|
1905
|
+
return b || J.loading ? /* @__PURE__ */ Q("div", {
|
|
1906
|
+
className: G("space-y-4", i),
|
|
1850
1907
|
children: [
|
|
1851
1908
|
/* @__PURE__ */ Z(L, { className: "h-10 w-full" }),
|
|
1852
1909
|
/* @__PURE__ */ Z(L, { className: "h-64 w-full" }),
|
|
1853
1910
|
/* @__PURE__ */ Z(L, { className: "h-48 w-full" })
|
|
1854
1911
|
]
|
|
1855
|
-
}) : !g && !
|
|
1856
|
-
className:
|
|
1912
|
+
}) : !g && !J.data ? /* @__PURE__ */ Q("div", {
|
|
1913
|
+
className: G("flex flex-col items-center justify-center py-16 text-center", i),
|
|
1857
1914
|
children: [
|
|
1858
1915
|
/* @__PURE__ */ Z("p", {
|
|
1859
1916
|
className: "text-lg font-semibold",
|
|
1860
|
-
children:
|
|
1917
|
+
children: K("detail.recordNotFound")
|
|
1861
1918
|
}),
|
|
1862
1919
|
/* @__PURE__ */ Z("p", {
|
|
1863
1920
|
className: "text-sm text-muted-foreground mt-1",
|
|
1864
|
-
children:
|
|
1921
|
+
children: K("detail.recordNotFoundDescription")
|
|
1865
1922
|
}),
|
|
1866
|
-
(
|
|
1923
|
+
(J.showBack ?? !0) && /* @__PURE__ */ Q(y, {
|
|
1867
1924
|
variant: "outline",
|
|
1868
1925
|
size: "sm",
|
|
1869
1926
|
onClick: me,
|
|
1870
1927
|
className: "mt-4 gap-2",
|
|
1871
|
-
children: [/* @__PURE__ */ Z(
|
|
1928
|
+
children: [/* @__PURE__ */ Z(oe, { className: "h-4 w-4" }), K("detail.goBack")]
|
|
1872
1929
|
})
|
|
1873
1930
|
]
|
|
1874
1931
|
}) : /* @__PURE__ */ Z(re, { children: /* @__PURE__ */ Q("div", {
|
|
1875
|
-
className:
|
|
1932
|
+
className: G("space-y-6", i),
|
|
1876
1933
|
children: [
|
|
1877
|
-
|
|
1934
|
+
J.showHeader !== !1 && /* @__PURE__ */ Q("div", {
|
|
1878
1935
|
className: "flex flex-col sm:flex-row items-start justify-between gap-3 sm:gap-4 pb-4 border-b",
|
|
1879
1936
|
children: [/* @__PURE__ */ Q("div", {
|
|
1880
1937
|
className: "flex items-start gap-2 sm:gap-3 flex-1 min-w-0",
|
|
1881
|
-
children: [(
|
|
1938
|
+
children: [(J.showBack ?? !0) && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
1882
1939
|
asChild: !0,
|
|
1883
1940
|
children: /* @__PURE__ */ Z(y, {
|
|
1884
1941
|
variant: "ghost",
|
|
1885
1942
|
size: "icon",
|
|
1886
1943
|
onClick: me,
|
|
1887
1944
|
className: "shrink-0 mt-1",
|
|
1888
|
-
children: /* @__PURE__ */ Z(
|
|
1945
|
+
children: /* @__PURE__ */ Z(oe, { className: "h-4 w-4" })
|
|
1889
1946
|
})
|
|
1890
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
1947
|
+
}), /* @__PURE__ */ Z(H, { children: K("detail.back") })] }), /* @__PURE__ */ Q("div", {
|
|
1891
1948
|
className: "flex-1 min-w-0",
|
|
1892
1949
|
children: [/* @__PURE__ */ Q("div", {
|
|
1893
1950
|
className: "flex items-center gap-2 flex-wrap",
|
|
1894
1951
|
children: [
|
|
1895
1952
|
/* @__PURE__ */ Z("h1", {
|
|
1896
1953
|
className: "text-xl sm:text-2xl font-bold truncate",
|
|
1897
|
-
children:
|
|
1954
|
+
children: dn(g, J, N, K("detail.details"))
|
|
1898
1955
|
}),
|
|
1899
|
-
|
|
1956
|
+
de.map((e) => {
|
|
1900
1957
|
let t = g?.[e];
|
|
1901
1958
|
if (t == null || t === "") return null;
|
|
1902
|
-
let n = (
|
|
1959
|
+
let n = (J.sections || []).flatMap((e) => e.fields).concat(J.fields || []).find((t) => t.name === e), r = N?.fields?.[e], i = n?.type || r?.type, a = String(t), o = null;
|
|
1903
1960
|
try {
|
|
1904
1961
|
if (i === "currency") {
|
|
1905
1962
|
let e = Number(t);
|
|
1906
1963
|
if (!Number.isNaN(e)) {
|
|
1907
|
-
let t =
|
|
1964
|
+
let t = Ct({
|
|
1908
1965
|
...r,
|
|
1909
1966
|
...n
|
|
1910
|
-
},
|
|
1967
|
+
}, se);
|
|
1911
1968
|
a = t ? new Intl.NumberFormat(void 0, {
|
|
1912
1969
|
style: "currency",
|
|
1913
1970
|
currency: t,
|
|
@@ -1936,7 +1993,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1936
1993
|
let e = i[String(t)];
|
|
1937
1994
|
e?.label && (o = e.label);
|
|
1938
1995
|
}
|
|
1939
|
-
a =
|
|
1996
|
+
a = J.objectName ? ce(J.objectName, e, String(t), o) : o;
|
|
1940
1997
|
}
|
|
1941
1998
|
} catch {}
|
|
1942
1999
|
return o === null ? /* @__PURE__ */ Z(v, {
|
|
@@ -1964,34 +2021,34 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1964
2021
|
variant: "ghost",
|
|
1965
2022
|
size: "icon",
|
|
1966
2023
|
className: "h-6 w-6 shrink-0",
|
|
1967
|
-
onClick:
|
|
1968
|
-
"aria-label":
|
|
2024
|
+
onClick: xe,
|
|
2025
|
+
"aria-label": K(w ? "detail.removeFromFavorites" : "detail.addToFavorites"),
|
|
1969
2026
|
children: w ? /* @__PURE__ */ Z(Ze, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z(Ze, { className: "h-4 w-4 text-muted-foreground" })
|
|
1970
2027
|
})
|
|
1971
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2028
|
+
}), /* @__PURE__ */ Z(H, { children: K(w ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
|
|
1972
2029
|
]
|
|
1973
|
-
}),
|
|
2030
|
+
}), J.objectName && /* @__PURE__ */ Q("p", {
|
|
1974
2031
|
className: "text-sm text-muted-foreground mt-1 flex items-center gap-1",
|
|
1975
2032
|
children: [/* @__PURE__ */ Z("span", {
|
|
1976
2033
|
className: "font-medium",
|
|
1977
|
-
children: f ||
|
|
1978
|
-
}),
|
|
2034
|
+
children: f || J.objectName
|
|
2035
|
+
}), J.resourceId && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
1979
2036
|
asChild: !0,
|
|
1980
2037
|
children: /* @__PURE__ */ Z(y, {
|
|
1981
2038
|
variant: "ghost",
|
|
1982
2039
|
size: "icon",
|
|
1983
2040
|
className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
|
|
1984
|
-
onClick:
|
|
1985
|
-
"aria-label":
|
|
1986
|
-
children: P ? /* @__PURE__ */ Z(
|
|
2041
|
+
onClick: fe,
|
|
2042
|
+
"aria-label": K("detail.copyRecordId", { defaultValue: "Copy record ID" }),
|
|
2043
|
+
children: P ? /* @__PURE__ */ Z(pe, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Se, { className: "h-3 w-3" })
|
|
1987
2044
|
})
|
|
1988
|
-
}), /* @__PURE__ */ Z(H, { children: P ?
|
|
2045
|
+
}), /* @__PURE__ */ Z(H, { children: P ? K("detail.copied", { defaultValue: "Copied" }) : K("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
|
|
1989
2046
|
})]
|
|
1990
2047
|
})]
|
|
1991
2048
|
}), /* @__PURE__ */ Q("div", {
|
|
1992
2049
|
className: "flex flex-wrap items-center gap-1.5 shrink-0 w-full sm:w-auto",
|
|
1993
2050
|
children: [
|
|
1994
|
-
|
|
2051
|
+
J.recordNavigation && /* @__PURE__ */ Q("div", {
|
|
1995
2052
|
className: "flex items-center gap-1 mr-2",
|
|
1996
2053
|
children: [
|
|
1997
2054
|
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
@@ -2000,19 +2057,19 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2000
2057
|
variant: "outline",
|
|
2001
2058
|
size: "icon",
|
|
2002
2059
|
className: "h-8 w-8",
|
|
2003
|
-
disabled:
|
|
2060
|
+
disabled: J.recordNavigation.currentIndex <= 0,
|
|
2004
2061
|
onClick: () => {
|
|
2005
|
-
let e =
|
|
2062
|
+
let e = J.recordNavigation;
|
|
2006
2063
|
e.currentIndex > 0 && e.onNavigate(e.recordIds[e.currentIndex - 1]);
|
|
2007
2064
|
},
|
|
2008
2065
|
children: /* @__PURE__ */ Z(ge, { className: "h-4 w-4" })
|
|
2009
2066
|
})
|
|
2010
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2067
|
+
}), /* @__PURE__ */ Z(H, { children: K("detail.previousRecord") })] }),
|
|
2011
2068
|
/* @__PURE__ */ Z("span", {
|
|
2012
2069
|
className: "text-xs text-muted-foreground whitespace-nowrap px-1",
|
|
2013
|
-
children:
|
|
2014
|
-
current:
|
|
2015
|
-
total:
|
|
2070
|
+
children: K("detail.recordOf", {
|
|
2071
|
+
current: J.recordNavigation.currentIndex + 1,
|
|
2072
|
+
total: J.recordNavigation.recordIds.length
|
|
2016
2073
|
})
|
|
2017
2074
|
}),
|
|
2018
2075
|
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
@@ -2021,110 +2078,110 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2021
2078
|
variant: "outline",
|
|
2022
2079
|
size: "icon",
|
|
2023
2080
|
className: "h-8 w-8",
|
|
2024
|
-
disabled:
|
|
2081
|
+
disabled: J.recordNavigation.currentIndex >= J.recordNavigation.recordIds.length - 1,
|
|
2025
2082
|
onClick: () => {
|
|
2026
|
-
let e =
|
|
2083
|
+
let e = J.recordNavigation;
|
|
2027
2084
|
e.currentIndex < e.recordIds.length - 1 && e.onNavigate(e.recordIds[e.currentIndex + 1]);
|
|
2028
2085
|
},
|
|
2029
|
-
children: /* @__PURE__ */ Z(
|
|
2086
|
+
children: /* @__PURE__ */ Z(_e, { className: "h-4 w-4" })
|
|
2030
2087
|
})
|
|
2031
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2088
|
+
}), /* @__PURE__ */ Z(H, { children: K("detail.nextRecord") })] })
|
|
2032
2089
|
]
|
|
2033
2090
|
}),
|
|
2034
|
-
c && /* @__PURE__ */ Q(
|
|
2091
|
+
c && /* @__PURE__ */ Q(bt, { children: [T && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2035
2092
|
asChild: !0,
|
|
2036
2093
|
children: /* @__PURE__ */ Q(y, {
|
|
2037
2094
|
variant: "ghost",
|
|
2038
2095
|
size: "sm",
|
|
2039
|
-
onClick:
|
|
2096
|
+
onClick: Te,
|
|
2040
2097
|
className: "gap-2 hidden sm:inline-flex",
|
|
2041
2098
|
children: [/* @__PURE__ */ Z(et, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2042
2099
|
className: "hidden sm:inline",
|
|
2043
|
-
children:
|
|
2100
|
+
children: K("detail.cancel")
|
|
2044
2101
|
})]
|
|
2045
2102
|
})
|
|
2046
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2103
|
+
}), /* @__PURE__ */ Z(H, { children: K("detail.cancelEdit") })] }), /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2047
2104
|
asChild: !0,
|
|
2048
2105
|
children: /* @__PURE__ */ Z(y, {
|
|
2049
2106
|
variant: T ? "default" : "outline",
|
|
2050
2107
|
size: "sm",
|
|
2051
|
-
onClick:
|
|
2108
|
+
onClick: we,
|
|
2052
2109
|
className: "gap-2 hidden sm:inline-flex",
|
|
2053
|
-
children: T ? /* @__PURE__ */ Q(
|
|
2110
|
+
children: T ? /* @__PURE__ */ Q(bt, { children: [/* @__PURE__ */ Z(pe, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2054
2111
|
className: "hidden sm:inline",
|
|
2055
|
-
children:
|
|
2056
|
-
})] }) : /* @__PURE__ */ Q(
|
|
2112
|
+
children: K("detail.save")
|
|
2113
|
+
})] }) : /* @__PURE__ */ Q(bt, { children: [/* @__PURE__ */ Z(Ce, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2057
2114
|
className: "hidden sm:inline",
|
|
2058
|
-
children:
|
|
2115
|
+
children: K("detail.editInline")
|
|
2059
2116
|
})] })
|
|
2060
2117
|
})
|
|
2061
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2062
|
-
|
|
2118
|
+
}), /* @__PURE__ */ Z(H, { children: K(T ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
|
|
2119
|
+
J.showEdit && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2063
2120
|
asChild: !0,
|
|
2064
2121
|
children: /* @__PURE__ */ Q(y, {
|
|
2065
2122
|
variant: "default",
|
|
2066
2123
|
onClick: he,
|
|
2067
2124
|
className: "gap-2 hidden sm:inline-flex",
|
|
2068
|
-
children: [/* @__PURE__ */ Z(
|
|
2125
|
+
children: [/* @__PURE__ */ Z(Ce, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2069
2126
|
className: "hidden sm:inline",
|
|
2070
|
-
children:
|
|
2127
|
+
children: K("detail.edit")
|
|
2071
2128
|
})]
|
|
2072
2129
|
})
|
|
2073
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2074
|
-
|
|
2130
|
+
}), /* @__PURE__ */ Z(H, { children: K("detail.editRecord") })] }),
|
|
2131
|
+
Oe.map((e, t) => /* @__PURE__ */ Z(rt, {
|
|
2075
2132
|
schema: e,
|
|
2076
2133
|
data: g
|
|
2077
2134
|
}, `header-action-${t}`))
|
|
2078
2135
|
]
|
|
2079
2136
|
})]
|
|
2080
2137
|
}),
|
|
2081
|
-
|
|
2082
|
-
schema:
|
|
2138
|
+
J.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(rt, {
|
|
2139
|
+
schema: J.header,
|
|
2083
2140
|
data: g
|
|
2084
2141
|
}) }),
|
|
2085
|
-
|
|
2086
|
-
fields:
|
|
2142
|
+
J.highlightFields && J.highlightFields.length > 0 && /* @__PURE__ */ Z(Bt, {
|
|
2143
|
+
fields: J.highlightFields,
|
|
2087
2144
|
data: g,
|
|
2088
|
-
objectName:
|
|
2145
|
+
objectName: J.objectName,
|
|
2089
2146
|
objectSchema: N
|
|
2090
2147
|
}),
|
|
2091
|
-
c &&
|
|
2148
|
+
c && J.showHeader === !1 && (() => {
|
|
2092
2149
|
let e = g?.approval_status, t = e === "pending" || e === "in_approval";
|
|
2093
2150
|
return !T && !k && !j && !t ? null : /* @__PURE__ */ Q("div", {
|
|
2094
2151
|
className: "flex flex-col items-end gap-1",
|
|
2095
2152
|
children: [/* @__PURE__ */ Q("div", {
|
|
2096
2153
|
className: "flex items-center justify-end gap-2",
|
|
2097
2154
|
children: [
|
|
2098
|
-
t && !T && /* @__PURE__ */ Q(
|
|
2155
|
+
t && !T && /* @__PURE__ */ Q(bt, { children: [/* @__PURE__ */ Q("span", {
|
|
2099
2156
|
role: "status",
|
|
2100
2157
|
className: "inline-flex items-center gap-1 rounded-md border border-amber-300 bg-amber-50 px-2 py-1 text-xs text-amber-800",
|
|
2101
|
-
title:
|
|
2102
|
-
children: [/* @__PURE__ */ Z(Fe, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children:
|
|
2158
|
+
title: K("detail.lockedTooltip"),
|
|
2159
|
+
children: [/* @__PURE__ */ Z(Fe, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: K("detail.lockedByApproval") })]
|
|
2103
2160
|
}), r?.cancelPendingApproval && /* @__PURE__ */ Q(y, {
|
|
2104
2161
|
variant: "outline",
|
|
2105
2162
|
size: "sm",
|
|
2106
|
-
onClick:
|
|
2107
|
-
disabled:
|
|
2163
|
+
onClick: ve,
|
|
2164
|
+
disabled: W,
|
|
2108
2165
|
className: "gap-2 border-amber-300 text-amber-800 hover:bg-amber-50",
|
|
2109
|
-
title:
|
|
2110
|
-
children: [/* @__PURE__ */ Z(et, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children:
|
|
2166
|
+
title: K("detail.cancelApprovalTooltip"),
|
|
2167
|
+
children: [/* @__PURE__ */ Z(et, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: K(W ? "detail.cancelApprovalInFlight" : "detail.cancelApproval") })]
|
|
2111
2168
|
})] }),
|
|
2112
2169
|
T && /* @__PURE__ */ Q(y, {
|
|
2113
2170
|
variant: "ghost",
|
|
2114
2171
|
size: "sm",
|
|
2115
|
-
onClick:
|
|
2172
|
+
onClick: Te,
|
|
2116
2173
|
className: "gap-2",
|
|
2117
2174
|
disabled: k,
|
|
2118
|
-
children: [/* @__PURE__ */ Z(et, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children:
|
|
2175
|
+
children: [/* @__PURE__ */ Z(et, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: K("detail.cancel") })]
|
|
2119
2176
|
}),
|
|
2120
2177
|
/* @__PURE__ */ Q(y, {
|
|
2121
2178
|
variant: T ? "default" : "outline",
|
|
2122
2179
|
size: "sm",
|
|
2123
|
-
onClick:
|
|
2180
|
+
onClick: we,
|
|
2124
2181
|
className: "gap-2",
|
|
2125
2182
|
disabled: k || t && !T,
|
|
2126
|
-
title: t && !T ?
|
|
2127
|
-
children: [Z(T ?
|
|
2183
|
+
title: t && !T ? K("detail.lockedTooltip") : void 0,
|
|
2184
|
+
children: [Z(T ? pe : Ce, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: K(k ? "detail.saving" : T ? "detail.save" : "detail.editFieldsInline") })]
|
|
2128
2185
|
})
|
|
2129
2186
|
]
|
|
2130
2187
|
}), j && /* @__PURE__ */ Z("div", {
|
|
@@ -2134,49 +2191,49 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2134
2191
|
})]
|
|
2135
2192
|
});
|
|
2136
2193
|
})(),
|
|
2137
|
-
|
|
2138
|
-
let e =
|
|
2194
|
+
J.autoTabs && !J.tabs?.length ? (() => {
|
|
2195
|
+
let e = Ee.length > 0, t = !!J.activities && J.activities.length > 0, n = !!u, i = !!J.history, a = /* @__PURE__ */ Q("div", {
|
|
2139
2196
|
className: "space-y-3 sm:space-y-4",
|
|
2140
2197
|
children: [
|
|
2141
|
-
|
|
2198
|
+
J.sectionGroups && J.sectionGroups.length > 0 && J.sectionGroups.map((e, t) => /* @__PURE__ */ Z(zt, {
|
|
2142
2199
|
group: e,
|
|
2143
2200
|
data: {
|
|
2144
2201
|
...g,
|
|
2145
2202
|
...D
|
|
2146
2203
|
},
|
|
2147
2204
|
objectSchema: N,
|
|
2148
|
-
objectName:
|
|
2205
|
+
objectName: J.objectName,
|
|
2149
2206
|
isEditing: T,
|
|
2150
|
-
onFieldChange:
|
|
2207
|
+
onFieldChange: Y
|
|
2151
2208
|
}, t)),
|
|
2152
|
-
|
|
2209
|
+
J.sections && J.sections.length > 0 && J.sections.map((e, t) => /* @__PURE__ */ Z(Ft, {
|
|
2153
2210
|
section: e,
|
|
2154
2211
|
data: {
|
|
2155
2212
|
...g,
|
|
2156
2213
|
...D
|
|
2157
2214
|
},
|
|
2158
2215
|
objectSchema: N,
|
|
2159
|
-
objectName:
|
|
2216
|
+
objectName: J.objectName,
|
|
2160
2217
|
isEditing: T,
|
|
2161
|
-
onFieldChange:
|
|
2218
|
+
onFieldChange: Y
|
|
2162
2219
|
}, t)),
|
|
2163
|
-
|
|
2220
|
+
J.fields && J.fields.length > 0 && !J.sections?.length && /* @__PURE__ */ Z(Ft, {
|
|
2164
2221
|
section: {
|
|
2165
|
-
fields:
|
|
2166
|
-
columns:
|
|
2222
|
+
fields: J.fields,
|
|
2223
|
+
columns: J.columns
|
|
2167
2224
|
},
|
|
2168
2225
|
data: {
|
|
2169
2226
|
...g,
|
|
2170
2227
|
...D
|
|
2171
2228
|
},
|
|
2172
2229
|
objectSchema: N,
|
|
2173
|
-
objectName:
|
|
2230
|
+
objectName: J.objectName,
|
|
2174
2231
|
isEditing: T,
|
|
2175
|
-
onFieldChange:
|
|
2232
|
+
onFieldChange: Y
|
|
2176
2233
|
}),
|
|
2177
|
-
|
|
2178
|
-
comments:
|
|
2179
|
-
onAddComment:
|
|
2234
|
+
J.comments && /* @__PURE__ */ Z(Ht, {
|
|
2235
|
+
comments: J.comments,
|
|
2236
|
+
onAddComment: J.onAddComment
|
|
2180
2237
|
})
|
|
2181
2238
|
]
|
|
2182
2239
|
});
|
|
@@ -2193,17 +2250,17 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2193
2250
|
/* @__PURE__ */ Z(B, {
|
|
2194
2251
|
value: "details",
|
|
2195
2252
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2196
|
-
children:
|
|
2253
|
+
children: K("detail.details")
|
|
2197
2254
|
}),
|
|
2198
2255
|
e && /* @__PURE__ */ Z(B, {
|
|
2199
2256
|
value: "related",
|
|
2200
2257
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2201
2258
|
children: /* @__PURE__ */ Q("span", {
|
|
2202
2259
|
className: "flex items-center gap-1.5",
|
|
2203
|
-
children: [
|
|
2260
|
+
children: [K("detail.related"), /* @__PURE__ */ Z(v, {
|
|
2204
2261
|
variant: "secondary",
|
|
2205
2262
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2206
|
-
children:
|
|
2263
|
+
children: Ee.length
|
|
2207
2264
|
})]
|
|
2208
2265
|
})
|
|
2209
2266
|
}),
|
|
@@ -2212,27 +2269,27 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2212
2269
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2213
2270
|
children: /* @__PURE__ */ Q("span", {
|
|
2214
2271
|
className: "flex items-center gap-1.5",
|
|
2215
|
-
children: [
|
|
2272
|
+
children: [K("detail.activity"), /* @__PURE__ */ Z(v, {
|
|
2216
2273
|
variant: "secondary",
|
|
2217
2274
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2218
|
-
children:
|
|
2275
|
+
children: J.activities.length
|
|
2219
2276
|
})]
|
|
2220
2277
|
})
|
|
2221
2278
|
}),
|
|
2222
2279
|
n && /* @__PURE__ */ Z(B, {
|
|
2223
2280
|
value: "discussion",
|
|
2224
2281
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2225
|
-
children:
|
|
2282
|
+
children: K("detail.discussion", { defaultValue: "Discussion" })
|
|
2226
2283
|
}),
|
|
2227
2284
|
i && /* @__PURE__ */ Z(B, {
|
|
2228
2285
|
value: "history",
|
|
2229
2286
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2230
2287
|
children: /* @__PURE__ */ Q("span", {
|
|
2231
2288
|
className: "flex items-center gap-1.5",
|
|
2232
|
-
children: [
|
|
2289
|
+
children: [K("detail.history", { defaultValue: "History" }), !J.history.loading && J.history.entries.length > 0 && /* @__PURE__ */ Z(v, {
|
|
2233
2290
|
variant: "secondary",
|
|
2234
2291
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2235
|
-
children:
|
|
2292
|
+
children: J.history.entries.length
|
|
2236
2293
|
})]
|
|
2237
2294
|
})
|
|
2238
2295
|
})
|
|
@@ -2248,7 +2305,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2248
2305
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2249
2306
|
children: /* @__PURE__ */ Z("div", {
|
|
2250
2307
|
className: "space-y-3",
|
|
2251
|
-
children:
|
|
2308
|
+
children: Ee.map((e, t) => /* @__PURE__ */ Z(Rt, {
|
|
2252
2309
|
title: e.title,
|
|
2253
2310
|
type: e.type,
|
|
2254
2311
|
api: e.api,
|
|
@@ -2265,14 +2322,14 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2265
2322
|
onRowDelete: e.onRowDelete,
|
|
2266
2323
|
collapsible: !0,
|
|
2267
2324
|
defaultCollapsed: le && t > 0,
|
|
2268
|
-
pageSize:
|
|
2325
|
+
pageSize: un
|
|
2269
2326
|
}, t))
|
|
2270
2327
|
})
|
|
2271
2328
|
}),
|
|
2272
2329
|
t && /* @__PURE__ */ Z(R, {
|
|
2273
2330
|
value: "activity",
|
|
2274
2331
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2275
|
-
children: /* @__PURE__ */ Z(
|
|
2332
|
+
children: /* @__PURE__ */ Z(Jt, { activities: J.activities })
|
|
2276
2333
|
}),
|
|
2277
2334
|
n && /* @__PURE__ */ Z(R, {
|
|
2278
2335
|
value: "discussion",
|
|
@@ -2282,67 +2339,67 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2282
2339
|
i && /* @__PURE__ */ Z(R, {
|
|
2283
2340
|
value: "history",
|
|
2284
2341
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2285
|
-
children: /* @__PURE__ */ Z(
|
|
2286
|
-
entries:
|
|
2287
|
-
loading:
|
|
2288
|
-
emptyText:
|
|
2342
|
+
children: /* @__PURE__ */ Z(tn, {
|
|
2343
|
+
entries: J.history.entries,
|
|
2344
|
+
loading: J.history.loading,
|
|
2345
|
+
emptyText: J.history.emptyText ?? K("detail.historyEmpty", { defaultValue: "No history yet" })
|
|
2289
2346
|
})
|
|
2290
2347
|
})
|
|
2291
2348
|
]
|
|
2292
2349
|
});
|
|
2293
|
-
})() : /* @__PURE__ */ Q(
|
|
2294
|
-
|
|
2350
|
+
})() : /* @__PURE__ */ Q(bt, { children: [
|
|
2351
|
+
J.sectionGroups && J.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2295
2352
|
className: "space-y-3 sm:space-y-4",
|
|
2296
|
-
children:
|
|
2353
|
+
children: J.sectionGroups.map((e, t) => /* @__PURE__ */ Z(zt, {
|
|
2297
2354
|
group: e,
|
|
2298
2355
|
data: {
|
|
2299
2356
|
...g,
|
|
2300
2357
|
...D
|
|
2301
2358
|
},
|
|
2302
2359
|
objectSchema: N,
|
|
2303
|
-
objectName:
|
|
2360
|
+
objectName: J.objectName,
|
|
2304
2361
|
isEditing: T,
|
|
2305
|
-
onFieldChange:
|
|
2362
|
+
onFieldChange: Y
|
|
2306
2363
|
}, t))
|
|
2307
2364
|
}),
|
|
2308
|
-
|
|
2365
|
+
J.sections && J.sections.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2309
2366
|
className: "space-y-3 sm:space-y-4",
|
|
2310
|
-
children:
|
|
2367
|
+
children: J.sections.map((e, t) => /* @__PURE__ */ Z(Ft, {
|
|
2311
2368
|
section: e,
|
|
2312
2369
|
data: {
|
|
2313
2370
|
...g,
|
|
2314
2371
|
...D
|
|
2315
2372
|
},
|
|
2316
2373
|
objectSchema: N,
|
|
2317
|
-
objectName:
|
|
2374
|
+
objectName: J.objectName,
|
|
2318
2375
|
isEditing: T,
|
|
2319
|
-
onFieldChange:
|
|
2376
|
+
onFieldChange: Y
|
|
2320
2377
|
}, t))
|
|
2321
2378
|
}),
|
|
2322
|
-
|
|
2379
|
+
J.fields && J.fields.length > 0 && !J.sections?.length && /* @__PURE__ */ Z(Ft, {
|
|
2323
2380
|
section: {
|
|
2324
|
-
fields:
|
|
2325
|
-
columns:
|
|
2381
|
+
fields: J.fields,
|
|
2382
|
+
columns: J.columns
|
|
2326
2383
|
},
|
|
2327
2384
|
data: {
|
|
2328
2385
|
...g,
|
|
2329
2386
|
...D
|
|
2330
2387
|
},
|
|
2331
2388
|
objectSchema: N,
|
|
2332
|
-
objectName:
|
|
2389
|
+
objectName: J.objectName,
|
|
2333
2390
|
isEditing: T,
|
|
2334
|
-
onFieldChange:
|
|
2391
|
+
onFieldChange: Y
|
|
2335
2392
|
}),
|
|
2336
|
-
|
|
2337
|
-
tabs:
|
|
2393
|
+
J.tabs && J.tabs.length > 0 && /* @__PURE__ */ Z(It, {
|
|
2394
|
+
tabs: J.tabs,
|
|
2338
2395
|
data: g
|
|
2339
2396
|
}),
|
|
2340
|
-
|
|
2397
|
+
Ee.length > 0 && /* @__PURE__ */ Q("div", {
|
|
2341
2398
|
className: "space-y-3",
|
|
2342
2399
|
children: [/* @__PURE__ */ Z("h2", {
|
|
2343
2400
|
className: "text-lg font-semibold",
|
|
2344
|
-
children:
|
|
2345
|
-
}),
|
|
2401
|
+
children: K("detail.related")
|
|
2402
|
+
}), Ee.map((e, t) => /* @__PURE__ */ Z(Rt, {
|
|
2346
2403
|
title: e.title,
|
|
2347
2404
|
type: e.type,
|
|
2348
2405
|
api: e.api,
|
|
@@ -2359,30 +2416,30 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2359
2416
|
onRowDelete: e.onRowDelete,
|
|
2360
2417
|
collapsible: !0,
|
|
2361
2418
|
defaultCollapsed: le && t > 0,
|
|
2362
|
-
pageSize:
|
|
2419
|
+
pageSize: un
|
|
2363
2420
|
}, t))]
|
|
2364
2421
|
}),
|
|
2365
|
-
|
|
2366
|
-
comments:
|
|
2367
|
-
onAddComment:
|
|
2422
|
+
J.comments && /* @__PURE__ */ Z(Ht, {
|
|
2423
|
+
comments: J.comments,
|
|
2424
|
+
onAddComment: J.onAddComment
|
|
2368
2425
|
}),
|
|
2369
|
-
|
|
2426
|
+
J.activities && J.activities.length > 0 && /* @__PURE__ */ Z(Jt, { activities: J.activities })
|
|
2370
2427
|
] }),
|
|
2371
|
-
/* @__PURE__ */ Z(
|
|
2428
|
+
/* @__PURE__ */ Z(ln, {
|
|
2372
2429
|
data: {
|
|
2373
2430
|
...g,
|
|
2374
2431
|
...D
|
|
2375
2432
|
},
|
|
2376
2433
|
objectSchema: N,
|
|
2377
|
-
objectName:
|
|
2434
|
+
objectName: J.objectName
|
|
2378
2435
|
}),
|
|
2379
|
-
|
|
2380
|
-
schema:
|
|
2436
|
+
J.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(rt, {
|
|
2437
|
+
schema: J.footer,
|
|
2381
2438
|
data: g
|
|
2382
2439
|
}) })
|
|
2383
2440
|
]
|
|
2384
2441
|
}) });
|
|
2385
|
-
},
|
|
2442
|
+
}, pn = (e) => {
|
|
2386
2443
|
if (e == null) return "—";
|
|
2387
2444
|
if (typeof e == "string") return e.length > 0 ? e : "\"\"";
|
|
2388
2445
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -2391,7 +2448,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2391
2448
|
} catch {
|
|
2392
2449
|
return String(e);
|
|
2393
2450
|
}
|
|
2394
|
-
},
|
|
2451
|
+
}, mn = (e) => {
|
|
2395
2452
|
if (typeof e != "string" || e.length === 0) return null;
|
|
2396
2453
|
let t = /\d{4}-\d{2}-\d{2}[ T]/.test(e) ? e.replace(" ", "T") : e, n = new Date(t);
|
|
2397
2454
|
if (Number.isNaN(n.getTime())) return null;
|
|
@@ -2400,13 +2457,13 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2400
2457
|
} catch {
|
|
2401
2458
|
return n.toISOString();
|
|
2402
2459
|
}
|
|
2403
|
-
},
|
|
2404
|
-
let { t: s } = $(), c = t?.label || t?.field || "", m = t ?
|
|
2460
|
+
}, hn = ({ open: e, conflict: t, onReload: n, onOverwrite: r, onCancel: i, busy: a = !1 }) => {
|
|
2461
|
+
let { t: s } = $(), c = t?.label || t?.field || "", m = t ? pn(t.pendingValue) : "", h = t ? pn(t.currentValue) : "", g = t?.currentRecord ?? {}, _ = (() => {
|
|
2405
2462
|
let e = [g.updated_by_name, g.updated_by_label];
|
|
2406
2463
|
for (let t of e) if (typeof t == "string" && t.length > 0) return t;
|
|
2407
2464
|
let t = g.updated_by;
|
|
2408
2465
|
return typeof t != "string" || t.length === 0 || t.length >= 16 && !/\s/.test(t) && /^[A-Za-z0-9_-]+$/.test(t) ? null : t;
|
|
2409
|
-
})(), v =
|
|
2466
|
+
})(), v = mn(g.updated_at ?? t?.currentVersion), [y, b] = s("detail.concurrentUpdateDescription", { field: "{{field}}" }).split("{{field}}");
|
|
2410
2467
|
return /* @__PURE__ */ Z(o, {
|
|
2411
2468
|
open: e,
|
|
2412
2469
|
onOpenChange: (e) => {
|
|
@@ -2420,7 +2477,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2420
2477
|
children: [/* @__PURE__ */ Z("span", {
|
|
2421
2478
|
className: "inline-flex h-9 w-9 flex-none items-center justify-center rounded-full bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-300",
|
|
2422
2479
|
"aria-hidden": "true",
|
|
2423
|
-
children: /* @__PURE__ */ Z(
|
|
2480
|
+
children: /* @__PURE__ */ Z(K, { className: "h-5 w-5" })
|
|
2424
2481
|
}), /* @__PURE__ */ Q("div", {
|
|
2425
2482
|
className: "flex-1",
|
|
2426
2483
|
children: [/* @__PURE__ */ Z(p, { children: s("detail.concurrentUpdateTitle") }), /* @__PURE__ */ Q(u, {
|
|
@@ -2475,14 +2532,14 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2475
2532
|
type: "button",
|
|
2476
2533
|
disabled: a,
|
|
2477
2534
|
onClick: i,
|
|
2478
|
-
className: W(
|
|
2535
|
+
className: G(W({ variant: "ghost" }), "mt-2 sm:mt-0"),
|
|
2479
2536
|
children: s("detail.concurrentUpdateCancel")
|
|
2480
2537
|
}),
|
|
2481
2538
|
/* @__PURE__ */ Z("button", {
|
|
2482
2539
|
type: "button",
|
|
2483
2540
|
disabled: a,
|
|
2484
2541
|
onClick: r,
|
|
2485
|
-
className: W(
|
|
2542
|
+
className: G(W({ variant: "outline" }), "mt-2 sm:mt-0 text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive"),
|
|
2486
2543
|
children: s("detail.concurrentUpdateOverwrite")
|
|
2487
2544
|
}),
|
|
2488
2545
|
/* @__PURE__ */ Z("button", {
|
|
@@ -2490,7 +2547,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2490
2547
|
disabled: a,
|
|
2491
2548
|
onClick: n,
|
|
2492
2549
|
autoFocus: !0,
|
|
2493
|
-
className: W(
|
|
2550
|
+
className: G(W({ variant: "default" }), "mt-2 sm:mt-0"),
|
|
2494
2551
|
children: s("detail.concurrentUpdateReload")
|
|
2495
2552
|
})
|
|
2496
2553
|
]
|
|
@@ -2499,14 +2556,14 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2499
2556
|
})
|
|
2500
2557
|
});
|
|
2501
2558
|
};
|
|
2502
|
-
function
|
|
2559
|
+
function gn(e) {
|
|
2503
2560
|
if (!e || typeof e != "object") return !1;
|
|
2504
2561
|
let t = e;
|
|
2505
2562
|
return t.code === "CONCURRENT_UPDATE" || t.name === "ConcurrentUpdateError";
|
|
2506
2563
|
}
|
|
2507
2564
|
//#endregion
|
|
2508
2565
|
//#region src/renderers/record-details.tsx
|
|
2509
|
-
var
|
|
2566
|
+
var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name) || null, vn = (e) => {
|
|
2510
2567
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2511
2568
|
return {
|
|
2512
2569
|
designer: {
|
|
@@ -2516,8 +2573,8 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2516
2573
|
},
|
|
2517
2574
|
rest: i
|
|
2518
2575
|
};
|
|
2519
|
-
},
|
|
2520
|
-
let i = dt(), { designer: a } =
|
|
2576
|
+
}, yn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2577
|
+
let i = dt(), { designer: a } = vn(n);
|
|
2521
2578
|
if (!i) return /* @__PURE__ */ Z("div", {
|
|
2522
2579
|
className: t,
|
|
2523
2580
|
"data-record-details-placeholder": !0,
|
|
@@ -2527,7 +2584,7 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2527
2584
|
children: "record:details — bind a record to preview"
|
|
2528
2585
|
})
|
|
2529
2586
|
});
|
|
2530
|
-
let o = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", s = i.objectName || "", c =
|
|
2587
|
+
let o = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", s = i.objectName || "", c = St(), { readableFields: l } = xt(s), { sectionLabel: u } = pt(), d = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2531
2588
|
if (d.length > 0 && s && !d.every((e) => c.can(s, e))) return /* @__PURE__ */ Z("div", {
|
|
2532
2589
|
className: t,
|
|
2533
2590
|
...a,
|
|
@@ -2540,15 +2597,15 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2540
2597
|
});
|
|
2541
2598
|
let f = e.enforceFieldSecurity === !0, p = Array.isArray(e.redactFields) ? e.redactFields : [], m = (e) => {
|
|
2542
2599
|
if (!e || !f && p.length === 0) return e;
|
|
2543
|
-
let t = e.map(
|
|
2600
|
+
let t = e.map(_n).filter((e) => !!e), n = new Set((f && s ? l(t) : t).filter((e) => !p.includes(e)));
|
|
2544
2601
|
return e.filter((e) => {
|
|
2545
|
-
let t =
|
|
2602
|
+
let t = _n(e);
|
|
2546
2603
|
return t ? n.has(t) : !0;
|
|
2547
2604
|
});
|
|
2548
2605
|
}, h = (e) => typeof e == "string" ? { name: e } : e && typeof e == "object" && !e.name && e.field ? {
|
|
2549
2606
|
...e,
|
|
2550
2607
|
name: e.field
|
|
2551
|
-
} : e, g = (e) => Array.isArray(e) ? e.map(h) : e, _ = ct(), v = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e :
|
|
2608
|
+
} : e, g = (e) => Array.isArray(e) ? e.map(h) : e, _ = ct(), v = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e : _n(e)).filter((e) => !!e));
|
|
2552
2609
|
for (let e of _) v.add(e);
|
|
2553
2610
|
let y = i.objectSchema, b = i.data ?? {}, x = [
|
|
2554
2611
|
y?.primaryField,
|
|
@@ -2564,7 +2621,7 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2564
2621
|
break;
|
|
2565
2622
|
}
|
|
2566
2623
|
let S = (e) => !e || v.size === 0 ? e : e.filter((e) => {
|
|
2567
|
-
let t =
|
|
2624
|
+
let t = _n(e);
|
|
2568
2625
|
return t ? !v.has(t) : !0;
|
|
2569
2626
|
}), C = S(g(m(e.fields))), w = Array.isArray(e.sections) ? e.sections.map((e) => {
|
|
2570
2627
|
let t = e.title ?? e.label, n = e.name && s ? u(s, e.name, t ?? e.name) : t;
|
|
@@ -2592,7 +2649,7 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2592
2649
|
}
|
|
2593
2650
|
typeof i.refresh == "function" && await i.refresh();
|
|
2594
2651
|
} catch (n) {
|
|
2595
|
-
if (
|
|
2652
|
+
if (gn(n)) {
|
|
2596
2653
|
let r = n.currentRecord ?? null;
|
|
2597
2654
|
throw D({
|
|
2598
2655
|
field: e,
|
|
@@ -2663,12 +2720,12 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2663
2720
|
return /* @__PURE__ */ Q("div", {
|
|
2664
2721
|
className: t,
|
|
2665
2722
|
...a,
|
|
2666
|
-
children: [/* @__PURE__ */ Z(
|
|
2723
|
+
children: [/* @__PURE__ */ Z(fn, {
|
|
2667
2724
|
schema: P,
|
|
2668
2725
|
dataSource: i.dataSource,
|
|
2669
2726
|
inlineEdit: T,
|
|
2670
2727
|
onFieldSave: j
|
|
2671
|
-
}), /* @__PURE__ */ Z(
|
|
2728
|
+
}), /* @__PURE__ */ Z(hn, {
|
|
2672
2729
|
open: !!E,
|
|
2673
2730
|
conflict: E,
|
|
2674
2731
|
busy: O,
|
|
@@ -2677,7 +2734,7 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2677
2734
|
onOverwrite: ee
|
|
2678
2735
|
})]
|
|
2679
2736
|
});
|
|
2680
|
-
},
|
|
2737
|
+
}, bn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name || e.key) || null, xn = (e) => {
|
|
2681
2738
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2682
2739
|
return {
|
|
2683
2740
|
designer: {
|
|
@@ -2687,11 +2744,11 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2687
2744
|
},
|
|
2688
2745
|
rest: i
|
|
2689
2746
|
};
|
|
2690
|
-
},
|
|
2691
|
-
let r = dt(), { designer: i } =
|
|
2747
|
+
}, Sn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2748
|
+
let r = dt(), { designer: i } = xn(n), a = pt(), o = e.objectName, s = o && a.objectLabel ? a.objectLabel({
|
|
2692
2749
|
name: o,
|
|
2693
|
-
label:
|
|
2694
|
-
}) : o ?
|
|
2750
|
+
label: vt(o)
|
|
2751
|
+
}) : o ? vt(o) : "", c = e.title || s || "Related";
|
|
2695
2752
|
if (!o) return /* @__PURE__ */ Z("div", {
|
|
2696
2753
|
className: t,
|
|
2697
2754
|
...i,
|
|
@@ -2700,7 +2757,7 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2700
2757
|
children: "record:related_list — missing objectName"
|
|
2701
2758
|
})
|
|
2702
2759
|
});
|
|
2703
|
-
let l =
|
|
2760
|
+
let l = St(), { readableFields: u } = xt(o), d = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2704
2761
|
if (d.length > 0 && !d.every((e) => l.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2705
2762
|
className: t,
|
|
2706
2763
|
...i,
|
|
@@ -2713,16 +2770,16 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2713
2770
|
});
|
|
2714
2771
|
let f = e.enforceFieldSecurity === !0, p = Array.isArray(e.redactFields) ? e.redactFields : [], m = Array.isArray(e.columns) ? e.columns : [], h = m;
|
|
2715
2772
|
if (f || p.length > 0) {
|
|
2716
|
-
let e = m.map(
|
|
2773
|
+
let e = m.map(bn).filter((e) => !!e), t = new Set((f ? u(e) : e).filter((e) => !p.includes(e)));
|
|
2717
2774
|
h = m.filter((e) => {
|
|
2718
|
-
let n =
|
|
2775
|
+
let n = bn(e);
|
|
2719
2776
|
return n ? t.has(n) : !0;
|
|
2720
2777
|
});
|
|
2721
2778
|
}
|
|
2722
2779
|
return /* @__PURE__ */ Z("div", {
|
|
2723
2780
|
className: t,
|
|
2724
2781
|
...i,
|
|
2725
|
-
children: /* @__PURE__ */ Z(
|
|
2782
|
+
children: /* @__PURE__ */ Z(Rt, {
|
|
2726
2783
|
title: c,
|
|
2727
2784
|
type: "table",
|
|
2728
2785
|
api: o,
|
|
@@ -2731,10 +2788,15 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2731
2788
|
parentId: r?.recordId,
|
|
2732
2789
|
columns: h,
|
|
2733
2790
|
pageSize: e.limit,
|
|
2734
|
-
dataSource: r?.dataSource
|
|
2791
|
+
dataSource: r?.dataSource,
|
|
2792
|
+
add: e.add,
|
|
2793
|
+
onRowDelete: e.add && r?.dataSource ? async (e) => {
|
|
2794
|
+
let t = e?.id ?? e?._id;
|
|
2795
|
+
t != null && await r.dataSource.delete?.(o, String(t));
|
|
2796
|
+
} : void 0
|
|
2735
2797
|
})
|
|
2736
2798
|
});
|
|
2737
|
-
},
|
|
2799
|
+
}, Cn = (e) => {
|
|
2738
2800
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2739
2801
|
return {
|
|
2740
2802
|
designer: {
|
|
@@ -2744,8 +2806,8 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2744
2806
|
},
|
|
2745
2807
|
rest: i
|
|
2746
2808
|
};
|
|
2747
|
-
},
|
|
2748
|
-
let i = dt(), { designer: a } =
|
|
2809
|
+
}, wn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2810
|
+
let i = dt(), { designer: a } = Cn(n), o = i?.objectName || "", s = St(), { readableFields: c } = xt(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2749
2811
|
if (l.length > 0 && o && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2750
2812
|
className: t,
|
|
2751
2813
|
...a,
|
|
@@ -2765,17 +2827,17 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2765
2827
|
return ft(r.useId(), m.map((e) => e.name)), /* @__PURE__ */ Z("div", {
|
|
2766
2828
|
className: t,
|
|
2767
2829
|
...a,
|
|
2768
|
-
children: /* @__PURE__ */ Z(
|
|
2830
|
+
children: /* @__PURE__ */ Z(Bt, {
|
|
2769
2831
|
fields: m,
|
|
2770
2832
|
data: i?.data,
|
|
2771
2833
|
objectName: i?.objectName,
|
|
2772
2834
|
objectSchema: i?.objectSchema
|
|
2773
2835
|
})
|
|
2774
2836
|
});
|
|
2775
|
-
},
|
|
2837
|
+
}, Tn = ({ change: e, className: t }) => {
|
|
2776
2838
|
let n = e.fieldLabel ?? e.field.charAt(0).toUpperCase() + e.field.slice(1).replace(/_/g, " "), r = e.oldDisplayValue ?? (e.oldValue == null ? "(empty)" : String(e.oldValue)), i = e.newDisplayValue ?? (e.newValue == null ? "(empty)" : String(e.newValue));
|
|
2777
2839
|
return /* @__PURE__ */ Q("div", {
|
|
2778
|
-
className:
|
|
2840
|
+
className: G("flex items-center gap-1.5 text-sm flex-wrap", t),
|
|
2779
2841
|
children: [
|
|
2780
2842
|
/* @__PURE__ */ Z("span", {
|
|
2781
2843
|
className: "font-medium text-foreground",
|
|
@@ -2785,29 +2847,29 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2785
2847
|
className: "text-muted-foreground line-through",
|
|
2786
2848
|
children: r
|
|
2787
2849
|
}),
|
|
2788
|
-
/* @__PURE__ */ Z(
|
|
2850
|
+
/* @__PURE__ */ Z(se, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
2789
2851
|
/* @__PURE__ */ Z("span", {
|
|
2790
2852
|
className: "text-foreground",
|
|
2791
2853
|
children: i
|
|
2792
2854
|
})
|
|
2793
2855
|
]
|
|
2794
2856
|
});
|
|
2795
|
-
},
|
|
2857
|
+
}, En = [
|
|
2796
2858
|
"👍",
|
|
2797
2859
|
"❤️",
|
|
2798
2860
|
"🎉",
|
|
2799
2861
|
"😂",
|
|
2800
2862
|
"😮",
|
|
2801
2863
|
"😢"
|
|
2802
|
-
],
|
|
2864
|
+
], Dn = ({ reactions: e, onToggleReaction: t, emojiOptions: r = En, className: i }) => {
|
|
2803
2865
|
let [a, o] = n.useState(!1), s = n.useCallback((e) => {
|
|
2804
2866
|
t?.(e), o(!1);
|
|
2805
2867
|
}, [t]);
|
|
2806
2868
|
return /* @__PURE__ */ Q("div", {
|
|
2807
|
-
className:
|
|
2869
|
+
className: G("flex items-center gap-1 flex-wrap", i),
|
|
2808
2870
|
children: [e.map((e) => /* @__PURE__ */ Q("button", {
|
|
2809
2871
|
type: "button",
|
|
2810
|
-
className:
|
|
2872
|
+
className: G("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs border transition-colors", e.reacted ? "bg-primary/10 border-primary/30 text-primary" : "bg-muted border-border text-muted-foreground hover:bg-muted/80"),
|
|
2811
2873
|
onClick: () => s(e.emoji),
|
|
2812
2874
|
disabled: !t,
|
|
2813
2875
|
"aria-label": `${e.emoji} ${e.count} reaction${e.count === 1 ? "" : "s"}`,
|
|
@@ -2839,7 +2901,7 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2839
2901
|
};
|
|
2840
2902
|
//#endregion
|
|
2841
2903
|
//#region src/ThreadedReplies.tsx
|
|
2842
|
-
function
|
|
2904
|
+
function On(e, t) {
|
|
2843
2905
|
try {
|
|
2844
2906
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
2845
2907
|
if (i < 1) return t("detail.justNow");
|
|
@@ -2852,7 +2914,7 @@ function Dn(e, t) {
|
|
|
2852
2914
|
return e;
|
|
2853
2915
|
}
|
|
2854
2916
|
}
|
|
2855
|
-
var
|
|
2917
|
+
var kn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, className: a }) => {
|
|
2856
2918
|
let { t: o } = $(), [s, c] = n.useState(!1), [l, u] = n.useState(""), [d, f] = n.useState(!1), p = n.useCallback(async () => {
|
|
2857
2919
|
let t = l.trim();
|
|
2858
2920
|
if (!(!t || !r)) {
|
|
@@ -2871,7 +2933,7 @@ var On = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2871
2933
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), p());
|
|
2872
2934
|
}, [p]);
|
|
2873
2935
|
return t.length === 0 && !i ? null : /* @__PURE__ */ Q("div", {
|
|
2874
|
-
className:
|
|
2936
|
+
className: G("ml-10 mt-1", a),
|
|
2875
2937
|
children: [
|
|
2876
2938
|
t.length > 0 && /* @__PURE__ */ Q("button", {
|
|
2877
2939
|
type: "button",
|
|
@@ -2879,7 +2941,7 @@ var On = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2879
2941
|
onClick: () => c(!s),
|
|
2880
2942
|
"aria-expanded": s,
|
|
2881
2943
|
children: [
|
|
2882
|
-
Z(s ? he :
|
|
2944
|
+
Z(s ? he : _e, { className: "h-3 w-3" }),
|
|
2883
2945
|
/* @__PURE__ */ Z(Le, { className: "h-3 w-3" }),
|
|
2884
2946
|
/* @__PURE__ */ Z("span", { children: t.length === 1 ? o("detail.replyCount", { count: t.length }) : o("detail.replyCountPlural", { count: t.length }) })
|
|
2885
2947
|
]
|
|
@@ -2907,7 +2969,7 @@ var On = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2907
2969
|
children: e.actor
|
|
2908
2970
|
}), /* @__PURE__ */ Z("span", {
|
|
2909
2971
|
className: "text-[10px] text-muted-foreground",
|
|
2910
|
-
children:
|
|
2972
|
+
children: On(e.createdAt, o)
|
|
2911
2973
|
})]
|
|
2912
2974
|
}), /* @__PURE__ */ Z("p", {
|
|
2913
2975
|
className: "text-xs whitespace-pre-wrap break-words",
|
|
@@ -2937,7 +2999,7 @@ var On = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2937
2999
|
})
|
|
2938
3000
|
]
|
|
2939
3001
|
});
|
|
2940
|
-
},
|
|
3002
|
+
}, An = ({ subscription: e, onToggle: t, className: r }) => {
|
|
2941
3003
|
let { t: i } = $(), [a, o] = n.useState(!1), s = n.useCallback(async () => {
|
|
2942
3004
|
if (t) {
|
|
2943
3005
|
o(!0);
|
|
@@ -2951,21 +3013,21 @@ var On = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2951
3013
|
return /* @__PURE__ */ Z(y, {
|
|
2952
3014
|
variant: "ghost",
|
|
2953
3015
|
size: "icon",
|
|
2954
|
-
className:
|
|
3016
|
+
className: G("h-8 w-8", r),
|
|
2955
3017
|
onClick: s,
|
|
2956
3018
|
disabled: a || !t,
|
|
2957
3019
|
"aria-label": e.subscribed ? i("detail.unsubscribeAriaLabel") : i("detail.subscribeAriaLabel"),
|
|
2958
3020
|
title: e.subscribed ? i("detail.subscribedTooltip") : i("detail.unsubscribedTooltip"),
|
|
2959
|
-
children: e.subscribed ? /* @__PURE__ */ Z(
|
|
3021
|
+
children: e.subscribed ? /* @__PURE__ */ Z(J, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(ue, { className: "h-4 w-4 text-muted-foreground" })
|
|
2960
3022
|
});
|
|
2961
3023
|
};
|
|
2962
3024
|
//#endregion
|
|
2963
3025
|
//#region src/RichTextCommentInput.tsx
|
|
2964
|
-
function
|
|
3026
|
+
function jn(e) {
|
|
2965
3027
|
let t = e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/```([\s\S]*?)```/g, "<pre class=\"bg-muted rounded p-2 text-xs font-mono my-1 overflow-x-auto\">$1</pre>").replace(/`([^`]+)`/g, "<code class=\"bg-muted rounded px-1 py-0.5 text-xs font-mono\">$1</code>").replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>").replace(/\*(.+?)\*/g, "<em>$1</em>").replace(/@(\w+)/g, "<span class=\"text-primary font-medium\">@$1</span>").replace(/^- (.+)$/gm, "<li class=\"ml-4 list-disc\">$1</li>").replace(/\n/g, "<br/>");
|
|
2966
3028
|
return t = t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g, (e) => `<ul class="my-1">${e.replace(/<br\/>/g, "")}</ul>`), t;
|
|
2967
3029
|
}
|
|
2968
|
-
var
|
|
3030
|
+
var Mn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], placeholder: a, className: o, disabled: s = !1, extraSlot: c, canSubmitEmpty: l = !1 }) => {
|
|
2969
3031
|
let { t: u } = $(), [d, f] = n.useState(!1), [p, m] = n.useState(!1), [h, g] = n.useState(""), [_, v] = n.useState(0), b = n.useRef(null), x = n.useMemo(() => {
|
|
2970
3032
|
if (!h) return i;
|
|
2971
3033
|
let e = h.toLowerCase();
|
|
@@ -3026,7 +3088,7 @@ var jn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3026
3088
|
r
|
|
3027
3089
|
]);
|
|
3028
3090
|
return /* @__PURE__ */ Q("div", {
|
|
3029
|
-
className:
|
|
3091
|
+
className: G("border rounded-md", o),
|
|
3030
3092
|
children: [
|
|
3031
3093
|
/* @__PURE__ */ Q("div", {
|
|
3032
3094
|
className: "flex items-center gap-0.5 px-2 py-1.5 border-b bg-muted/30",
|
|
@@ -3038,7 +3100,7 @@ var jn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3038
3100
|
onClick: C,
|
|
3039
3101
|
disabled: s || d,
|
|
3040
3102
|
title: u("detail.bold"),
|
|
3041
|
-
children: /* @__PURE__ */ Z(
|
|
3103
|
+
children: /* @__PURE__ */ Z(de, { className: "h-3.5 w-3.5" })
|
|
3042
3104
|
}),
|
|
3043
3105
|
/* @__PURE__ */ Z(y, {
|
|
3044
3106
|
variant: "ghost",
|
|
@@ -3065,7 +3127,7 @@ var jn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3065
3127
|
onClick: E,
|
|
3066
3128
|
disabled: s || d,
|
|
3067
3129
|
title: u("detail.inlineCode"),
|
|
3068
|
-
children: /* @__PURE__ */ Z(
|
|
3130
|
+
children: /* @__PURE__ */ Z(be, { className: "h-3.5 w-3.5" })
|
|
3069
3131
|
}),
|
|
3070
3132
|
/* @__PURE__ */ Z(y, {
|
|
3071
3133
|
variant: "ghost",
|
|
@@ -3074,7 +3136,7 @@ var jn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3074
3136
|
onClick: D,
|
|
3075
3137
|
disabled: s || d,
|
|
3076
3138
|
title: u("detail.mentionSomeone"),
|
|
3077
|
-
children: /* @__PURE__ */ Z(
|
|
3139
|
+
children: /* @__PURE__ */ Z(q, { className: "h-3.5 w-3.5" })
|
|
3078
3140
|
}),
|
|
3079
3141
|
/* @__PURE__ */ Z("div", { className: "flex-1" }),
|
|
3080
3142
|
/* @__PURE__ */ Z(y, {
|
|
@@ -3083,7 +3145,7 @@ var jn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3083
3145
|
className: "h-7 w-7",
|
|
3084
3146
|
onClick: () => f(!d),
|
|
3085
3147
|
title: u(d ? "detail.edit" : "detail.preview"),
|
|
3086
|
-
children: Z(d ?
|
|
3148
|
+
children: Z(d ? Ce : Te, { className: "h-3.5 w-3.5" })
|
|
3087
3149
|
}),
|
|
3088
3150
|
r && /* @__PURE__ */ Z(y, {
|
|
3089
3151
|
variant: "ghost",
|
|
@@ -3100,8 +3162,8 @@ var jn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3100
3162
|
className: "relative",
|
|
3101
3163
|
children: d ? /* @__PURE__ */ Z("div", {
|
|
3102
3164
|
className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
|
|
3103
|
-
dangerouslySetInnerHTML: { __html:
|
|
3104
|
-
}) : /* @__PURE__ */ Q(
|
|
3165
|
+
dangerouslySetInnerHTML: { __html: jn(e) }
|
|
3166
|
+
}) : /* @__PURE__ */ Q(bt, { children: [/* @__PURE__ */ Z("textarea", {
|
|
3105
3167
|
ref: b,
|
|
3106
3168
|
className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
|
|
3107
3169
|
placeholder: a ?? u("detail.writeComment"),
|
|
@@ -3113,7 +3175,7 @@ var jn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3113
3175
|
className: "absolute left-2 bottom-full mb-1 w-56 bg-popover border rounded-md shadow-md z-50 max-h-40 overflow-y-auto",
|
|
3114
3176
|
children: x.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
3115
3177
|
type: "button",
|
|
3116
|
-
className:
|
|
3178
|
+
className: G("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === _ && "bg-accent"),
|
|
3117
3179
|
onMouseDown: (t) => {
|
|
3118
3180
|
t.preventDefault(), O(e);
|
|
3119
3181
|
},
|
|
@@ -3137,16 +3199,16 @@ var jn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3137
3199
|
};
|
|
3138
3200
|
//#endregion
|
|
3139
3201
|
//#region src/CommentAttachment.tsx
|
|
3140
|
-
function
|
|
3202
|
+
function Nn(e) {
|
|
3141
3203
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
3142
3204
|
}
|
|
3143
|
-
function
|
|
3205
|
+
function Pn(e) {
|
|
3144
3206
|
return e.startsWith("image/");
|
|
3145
3207
|
}
|
|
3146
|
-
function
|
|
3147
|
-
return
|
|
3208
|
+
function Fn(e) {
|
|
3209
|
+
return Pn(e) ? ke : e.includes("pdf") || e.includes("document") || e.includes("text") ? Oe : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? De : Ee;
|
|
3148
3210
|
}
|
|
3149
|
-
var
|
|
3211
|
+
var In = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a = !1 }) => {
|
|
3150
3212
|
let { t: o } = $(), [s, c] = n.useState(!1), l = n.useRef(null), u = n.useCallback((e) => {
|
|
3151
3213
|
e.preventDefault(), e.stopPropagation(), c(!0);
|
|
3152
3214
|
}, []), d = n.useCallback((e) => {
|
|
@@ -3157,9 +3219,9 @@ var Fn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3157
3219
|
t && e.target.files && e.target.files.length > 0 && (t(e.target.files), e.target.value = "");
|
|
3158
3220
|
}, [t]);
|
|
3159
3221
|
return /* @__PURE__ */ Q("div", {
|
|
3160
|
-
className:
|
|
3222
|
+
className: G("space-y-2", i),
|
|
3161
3223
|
children: [t && !a && /* @__PURE__ */ Q("div", {
|
|
3162
|
-
className:
|
|
3224
|
+
className: G("border-2 border-dashed rounded-md px-4 py-3 text-center transition-colors cursor-pointer", s ? "border-primary bg-primary/5" : "border-muted-foreground/25 hover:border-muted-foreground/40"),
|
|
3163
3225
|
onDragOver: u,
|
|
3164
3226
|
onDragLeave: d,
|
|
3165
3227
|
onDrop: f,
|
|
@@ -3191,7 +3253,7 @@ var Fn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3191
3253
|
}), /* @__PURE__ */ Z("div", {
|
|
3192
3254
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
|
|
3193
3255
|
children: e.map((e) => {
|
|
3194
|
-
let t =
|
|
3256
|
+
let t = Pn(e.type), n = Fn(e.type);
|
|
3195
3257
|
return /* @__PURE__ */ Q("div", {
|
|
3196
3258
|
className: "flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group",
|
|
3197
3259
|
children: [
|
|
@@ -3210,7 +3272,7 @@ var Fn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3210
3272
|
children: e.name
|
|
3211
3273
|
}), /* @__PURE__ */ Z("p", {
|
|
3212
3274
|
className: "text-[10px] text-muted-foreground",
|
|
3213
|
-
children:
|
|
3275
|
+
children: Nn(e.size)
|
|
3214
3276
|
})]
|
|
3215
3277
|
}),
|
|
3216
3278
|
r && !a && /* @__PURE__ */ Z(y, {
|
|
@@ -3227,15 +3289,15 @@ var Fn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3227
3289
|
})]
|
|
3228
3290
|
})]
|
|
3229
3291
|
});
|
|
3230
|
-
},
|
|
3292
|
+
}, Ln = {
|
|
3231
3293
|
comment: Le,
|
|
3232
|
-
field_change:
|
|
3294
|
+
field_change: Ce,
|
|
3233
3295
|
task: me,
|
|
3234
|
-
event:
|
|
3296
|
+
event: fe,
|
|
3235
3297
|
system: tt,
|
|
3236
3298
|
email: Ie,
|
|
3237
3299
|
call: He
|
|
3238
|
-
},
|
|
3300
|
+
}, Rn = {
|
|
3239
3301
|
comment: "bg-purple-100 text-purple-600",
|
|
3240
3302
|
field_change: "bg-blue-100 text-blue-600",
|
|
3241
3303
|
task: "bg-green-100 text-green-600",
|
|
@@ -3244,7 +3306,7 @@ var Fn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3244
3306
|
email: "bg-indigo-100 text-indigo-600",
|
|
3245
3307
|
call: "bg-teal-100 text-teal-600"
|
|
3246
3308
|
};
|
|
3247
|
-
function
|
|
3309
|
+
function zn(e) {
|
|
3248
3310
|
return [
|
|
3249
3311
|
{
|
|
3250
3312
|
value: "all",
|
|
@@ -3264,7 +3326,7 @@ function Rn(e) {
|
|
|
3264
3326
|
}
|
|
3265
3327
|
];
|
|
3266
3328
|
}
|
|
3267
|
-
function
|
|
3329
|
+
function Bn(e, t) {
|
|
3268
3330
|
try {
|
|
3269
3331
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
3270
3332
|
if (i < 1) return t("detail.justNow");
|
|
@@ -3277,7 +3339,7 @@ function zn(e, t) {
|
|
|
3277
3339
|
return e;
|
|
3278
3340
|
}
|
|
3279
3341
|
}
|
|
3280
|
-
function
|
|
3342
|
+
function Vn(e, t) {
|
|
3281
3343
|
switch (t) {
|
|
3282
3344
|
case "comments_only": return e.filter((e) => e.type === "comment");
|
|
3283
3345
|
case "changes_only": return e.filter((e) => e.type === "field_change");
|
|
@@ -3285,8 +3347,8 @@ function Bn(e, t) {
|
|
|
3285
3347
|
default: return e;
|
|
3286
3348
|
}
|
|
3287
3349
|
}
|
|
3288
|
-
var
|
|
3289
|
-
let { t: b } = $(), [x, S] = n.useState("all"), [C, w] = n.useState(""), [T, E] = n.useState(!1), [O, k] = n.useState(!1), [P,
|
|
3350
|
+
var Hn = ({ 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, mentionSuggestions: m, onUploadAttachments: h, titleLabel: g, emptyLabel: _, className: v }) => {
|
|
3351
|
+
let { t: b } = $(), [x, S] = n.useState("all"), [C, w] = n.useState(""), [T, E] = n.useState(!1), [O, k] = n.useState(!1), [P, te] = n.useState([]), [F, I] = n.useState(!1), L = r ?? x, ne = t?.showFilterToggle !== !1, R = t?.showCommentInput !== !1 && !!c, z = t?.enableReactions ?? !1, B = t?.enableThreading ?? !1, V = t?.showSubscriptionToggle ?? !1, H = n.useMemo(() => Vn(e, L), [e, L]), re = n.useMemo(() => B ? H.filter((e) => !e.parentId) : H, [H, B]), U = n.useMemo(() => {
|
|
3290
3352
|
if (!B) return /* @__PURE__ */ new Map();
|
|
3291
3353
|
let e = /* @__PURE__ */ new Map();
|
|
3292
3354
|
for (let t of H) if (t.parentId) {
|
|
@@ -3294,14 +3356,14 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3294
3356
|
n.push(t), e.set(t.parentId, n);
|
|
3295
3357
|
}
|
|
3296
3358
|
return e;
|
|
3297
|
-
}, [H, B]),
|
|
3359
|
+
}, [H, B]), W = n.useCallback((e) => {
|
|
3298
3360
|
i ? i(e) : S(e);
|
|
3299
|
-
}, [i]),
|
|
3361
|
+
}, [i]), ie = n.useCallback(async () => {
|
|
3300
3362
|
let e = C.trim();
|
|
3301
3363
|
if (c && !(!e && P.length === 0)) {
|
|
3302
3364
|
E(!0);
|
|
3303
3365
|
try {
|
|
3304
|
-
await c(e, P.length > 0 ? P : void 0), w(""),
|
|
3366
|
+
await c(e, P.length > 0 ? P : void 0), w(""), te([]);
|
|
3305
3367
|
} finally {
|
|
3306
3368
|
E(!1);
|
|
3307
3369
|
}
|
|
@@ -3310,19 +3372,19 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3310
3372
|
C,
|
|
3311
3373
|
P,
|
|
3312
3374
|
c
|
|
3313
|
-
]),
|
|
3375
|
+
]), K = n.useCallback(async (e) => {
|
|
3314
3376
|
if (!(!h || e.length === 0)) {
|
|
3315
|
-
|
|
3377
|
+
I(!0);
|
|
3316
3378
|
try {
|
|
3317
3379
|
let t = await h(e);
|
|
3318
|
-
Array.isArray(t) && t.length > 0 &&
|
|
3380
|
+
Array.isArray(t) && t.length > 0 && te((e) => [...e, ...t]);
|
|
3319
3381
|
} finally {
|
|
3320
|
-
|
|
3382
|
+
I(!1);
|
|
3321
3383
|
}
|
|
3322
3384
|
}
|
|
3323
|
-
}, [h]),
|
|
3324
|
-
|
|
3325
|
-
}, []),
|
|
3385
|
+
}, [h]), oe = n.useCallback((e) => {
|
|
3386
|
+
te((t) => t.filter((t) => t.id !== e));
|
|
3387
|
+
}, []), se = n.useCallback(async () => {
|
|
3326
3388
|
if (o) {
|
|
3327
3389
|
k(!0);
|
|
3328
3390
|
try {
|
|
@@ -3333,7 +3395,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3333
3395
|
}
|
|
3334
3396
|
}, [o]);
|
|
3335
3397
|
return /* @__PURE__ */ Q("section", {
|
|
3336
|
-
className:
|
|
3398
|
+
className: G("border-t border-border/60 pt-5", v),
|
|
3337
3399
|
"aria-label": "Discussion",
|
|
3338
3400
|
children: [/* @__PURE__ */ Z("header", {
|
|
3339
3401
|
className: "mb-4",
|
|
@@ -3342,7 +3404,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3342
3404
|
children: [/* @__PURE__ */ Q("h2", {
|
|
3343
3405
|
className: "flex items-center gap-2 text-base font-semibold leading-none tracking-tight",
|
|
3344
3406
|
children: [
|
|
3345
|
-
/* @__PURE__ */ Z(
|
|
3407
|
+
/* @__PURE__ */ Z(ae, { className: "h-4 w-4" }),
|
|
3346
3408
|
g ?? b("detail.activity"),
|
|
3347
3409
|
/* @__PURE__ */ Q("span", {
|
|
3348
3410
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -3355,7 +3417,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3355
3417
|
]
|
|
3356
3418
|
}), /* @__PURE__ */ Z("div", {
|
|
3357
3419
|
className: "flex items-center gap-1",
|
|
3358
|
-
children: V && d && /* @__PURE__ */ Z(
|
|
3420
|
+
children: V && d && /* @__PURE__ */ Z(An, {
|
|
3359
3421
|
subscription: d,
|
|
3360
3422
|
onToggle: f
|
|
3361
3423
|
})
|
|
@@ -3368,33 +3430,33 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3368
3430
|
className: "flex items-center gap-2",
|
|
3369
3431
|
children: /* @__PURE__ */ Q(A, {
|
|
3370
3432
|
value: L,
|
|
3371
|
-
onValueChange: (e) =>
|
|
3433
|
+
onValueChange: (e) => W(e),
|
|
3372
3434
|
children: [/* @__PURE__ */ Z(N, {
|
|
3373
3435
|
"aria-label": b("detail.filterActivity"),
|
|
3374
3436
|
className: "h-8 w-auto min-w-[140px] py-1 text-sm",
|
|
3375
3437
|
children: /* @__PURE__ */ Z(ee, {})
|
|
3376
|
-
}), /* @__PURE__ */ Z(j, { children:
|
|
3438
|
+
}), /* @__PURE__ */ Z(j, { children: zn(b).map((e) => /* @__PURE__ */ Z(M, {
|
|
3377
3439
|
value: e.value,
|
|
3378
3440
|
children: e.label
|
|
3379
3441
|
}, e.value)) })]
|
|
3380
3442
|
})
|
|
3381
3443
|
}),
|
|
3382
|
-
R && /* @__PURE__ */ Z(
|
|
3444
|
+
R && /* @__PURE__ */ Z(Mn, {
|
|
3383
3445
|
value: C,
|
|
3384
3446
|
onChange: w,
|
|
3385
|
-
onSubmit:
|
|
3447
|
+
onSubmit: ie,
|
|
3386
3448
|
mentionSuggestions: m,
|
|
3387
3449
|
placeholder: b("detail.leaveCommentPlaceholder"),
|
|
3388
3450
|
disabled: T,
|
|
3389
3451
|
canSubmitEmpty: P.length > 0,
|
|
3390
|
-
extraSlot: h ? /* @__PURE__ */ Z(
|
|
3452
|
+
extraSlot: h ? /* @__PURE__ */ Z(In, {
|
|
3391
3453
|
attachments: P,
|
|
3392
|
-
onUpload:
|
|
3393
|
-
onRemove:
|
|
3394
|
-
readOnly: T ||
|
|
3395
|
-
}) : P.length > 0 ? /* @__PURE__ */ Z(
|
|
3454
|
+
onUpload: K,
|
|
3455
|
+
onRemove: oe,
|
|
3456
|
+
readOnly: T || F
|
|
3457
|
+
}) : P.length > 0 ? /* @__PURE__ */ Z(In, {
|
|
3396
3458
|
attachments: P,
|
|
3397
|
-
onRemove:
|
|
3459
|
+
onRemove: oe,
|
|
3398
3460
|
readOnly: T
|
|
3399
3461
|
}) : void 0
|
|
3400
3462
|
}),
|
|
@@ -3406,11 +3468,11 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3406
3468
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
3407
3469
|
className: "space-y-4",
|
|
3408
3470
|
children: re.map((e) => {
|
|
3409
|
-
let t =
|
|
3471
|
+
let t = Ln[e.type] || tt, n = Rn[e.type] || "bg-gray-100 text-gray-600", r = U.get(e.id) ?? [];
|
|
3410
3472
|
return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
|
|
3411
3473
|
className: "flex gap-3 relative",
|
|
3412
3474
|
children: [/* @__PURE__ */ Z("div", {
|
|
3413
|
-
className:
|
|
3475
|
+
className: G("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", n),
|
|
3414
3476
|
children: e.actorAvatarUrl ? /* @__PURE__ */ Z("img", {
|
|
3415
3477
|
src: e.actorAvatarUrl,
|
|
3416
3478
|
alt: e.actor,
|
|
@@ -3432,7 +3494,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3432
3494
|
}),
|
|
3433
3495
|
/* @__PURE__ */ Z("span", {
|
|
3434
3496
|
className: "text-xs text-muted-foreground",
|
|
3435
|
-
children:
|
|
3497
|
+
children: Bn(e.createdAt, b)
|
|
3436
3498
|
}),
|
|
3437
3499
|
e.edited && /* @__PURE__ */ Z("span", {
|
|
3438
3500
|
className: "text-xs text-muted-foreground italic",
|
|
@@ -3459,25 +3521,25 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3459
3521
|
}),
|
|
3460
3522
|
e.type === "field_change" && e.fieldChanges && /* @__PURE__ */ Z("div", {
|
|
3461
3523
|
className: "space-y-1 mt-1",
|
|
3462
|
-
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(
|
|
3524
|
+
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(Tn, { change: e }, t))
|
|
3463
3525
|
}),
|
|
3464
3526
|
z && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
|
|
3465
3527
|
className: "mt-1.5",
|
|
3466
|
-
children: /* @__PURE__ */ Z(
|
|
3528
|
+
children: /* @__PURE__ */ Z(Dn, {
|
|
3467
3529
|
reactions: e.reactions,
|
|
3468
3530
|
onToggleReaction: u ? (t) => u(e.id, t) : void 0
|
|
3469
3531
|
})
|
|
3470
3532
|
}),
|
|
3471
3533
|
z && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
|
|
3472
3534
|
className: "mt-1.5",
|
|
3473
|
-
children: /* @__PURE__ */ Z(
|
|
3535
|
+
children: /* @__PURE__ */ Z(Dn, {
|
|
3474
3536
|
reactions: [],
|
|
3475
3537
|
onToggleReaction: (t) => u(e.id, t)
|
|
3476
3538
|
})
|
|
3477
3539
|
})
|
|
3478
3540
|
]
|
|
3479
3541
|
})]
|
|
3480
|
-
}), B && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(
|
|
3542
|
+
}), B && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(kn, {
|
|
3481
3543
|
parentItem: e,
|
|
3482
3544
|
replies: r,
|
|
3483
3545
|
onAddReply: l,
|
|
@@ -3491,7 +3553,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3491
3553
|
children: /* @__PURE__ */ Q(y, {
|
|
3492
3554
|
variant: "ghost",
|
|
3493
3555
|
size: "sm",
|
|
3494
|
-
onClick:
|
|
3556
|
+
onClick: se,
|
|
3495
3557
|
disabled: O,
|
|
3496
3558
|
"aria-label": b("detail.loadMore"),
|
|
3497
3559
|
children: [O ? /* @__PURE__ */ Z(Pe, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(he, { className: "h-4 w-4 mr-1" }), b("detail.loadMore")]
|
|
@@ -3500,7 +3562,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3500
3562
|
]
|
|
3501
3563
|
})]
|
|
3502
3564
|
});
|
|
3503
|
-
},
|
|
3565
|
+
}, Un = (e) => {
|
|
3504
3566
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3505
3567
|
return {
|
|
3506
3568
|
designer: {
|
|
@@ -3510,21 +3572,21 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3510
3572
|
},
|
|
3511
3573
|
rest: i
|
|
3512
3574
|
};
|
|
3513
|
-
},
|
|
3575
|
+
}, Wn = ({ schema: e = {}, className: t, ...n }) => {
|
|
3514
3576
|
dt();
|
|
3515
|
-
let { designer: r } =
|
|
3577
|
+
let { designer: r } = Un(n);
|
|
3516
3578
|
return /* @__PURE__ */ Z("div", {
|
|
3517
3579
|
className: t,
|
|
3518
3580
|
...r,
|
|
3519
|
-
children: /* @__PURE__ */ Z(
|
|
3581
|
+
children: /* @__PURE__ */ Z(Hn, {
|
|
3520
3582
|
items: [],
|
|
3521
3583
|
config: e
|
|
3522
3584
|
})
|
|
3523
3585
|
});
|
|
3524
|
-
},
|
|
3586
|
+
}, Gn = ({ config: e, items: t, hasMore: r, onLoadMore: i, loading: a, onAddComment: o, onAddReply: s, onToggleReaction: c, subscription: l, onToggleSubscription: u, filterMode: d, onFilterChange: f, collapseWhenEmpty: p = !1, mentionSuggestions: m, onUploadAttachments: h, className: g }) => {
|
|
3525
3587
|
let _ = e?.position ?? "right", v = e?.width ?? "360px", b = e?.collapsible ?? !0, x = p && t.length === 0 || (e?.defaultCollapsed ?? !1), { t: S } = $(), [C, w] = n.useState(x);
|
|
3526
3588
|
return _ === "right" || _ === "left" ? C && b ? /* @__PURE__ */ Z("div", {
|
|
3527
|
-
className:
|
|
3589
|
+
className: G("flex items-start pt-4", _ === "right" ? "border-l" : "border-r", g),
|
|
3528
3590
|
children: /* @__PURE__ */ Z(y, {
|
|
3529
3591
|
variant: "ghost",
|
|
3530
3592
|
size: "icon",
|
|
@@ -3534,7 +3596,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3534
3596
|
children: /* @__PURE__ */ Z(Be, { className: "h-4 w-4" })
|
|
3535
3597
|
})
|
|
3536
3598
|
}) : /* @__PURE__ */ Q("div", {
|
|
3537
|
-
className:
|
|
3599
|
+
className: G("flex flex-col overflow-hidden", _ === "right" ? "border-l" : "border-r", g),
|
|
3538
3600
|
style: {
|
|
3539
3601
|
width: v,
|
|
3540
3602
|
minWidth: v
|
|
@@ -3557,7 +3619,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3557
3619
|
})]
|
|
3558
3620
|
}), /* @__PURE__ */ Z("div", {
|
|
3559
3621
|
className: "flex-1 overflow-y-auto",
|
|
3560
|
-
children: /* @__PURE__ */ Z(
|
|
3622
|
+
children: /* @__PURE__ */ Z(Hn, {
|
|
3561
3623
|
items: t,
|
|
3562
3624
|
config: e?.feed,
|
|
3563
3625
|
hasMore: r,
|
|
@@ -3579,7 +3641,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3579
3641
|
})
|
|
3580
3642
|
})]
|
|
3581
3643
|
}) : /* @__PURE__ */ Z("div", {
|
|
3582
|
-
className:
|
|
3644
|
+
className: G("", g),
|
|
3583
3645
|
children: b && C ? /* @__PURE__ */ Q(y, {
|
|
3584
3646
|
variant: "ghost",
|
|
3585
3647
|
className: "w-full justify-start gap-2 text-muted-foreground",
|
|
@@ -3599,7 +3661,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3599
3661
|
"aria-label": S("detail.hideDiscussion"),
|
|
3600
3662
|
children: /* @__PURE__ */ Z(ze, { className: "h-3.5 w-3.5" })
|
|
3601
3663
|
})]
|
|
3602
|
-
}), /* @__PURE__ */ Z(
|
|
3664
|
+
}), /* @__PURE__ */ Z(Hn, {
|
|
3603
3665
|
items: t,
|
|
3604
3666
|
config: e?.feed,
|
|
3605
3667
|
hasMore: r,
|
|
@@ -3619,7 +3681,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3619
3681
|
emptyLabel: S("detail.noCommentsYet")
|
|
3620
3682
|
})] })
|
|
3621
3683
|
});
|
|
3622
|
-
},
|
|
3684
|
+
}, Kn = (e) => {
|
|
3623
3685
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3624
3686
|
return {
|
|
3625
3687
|
designer: {
|
|
@@ -3629,9 +3691,9 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3629
3691
|
},
|
|
3630
3692
|
rest: i
|
|
3631
3693
|
};
|
|
3632
|
-
},
|
|
3694
|
+
}, qn = ({ schema: e = {}, className: t, ...n }) => {
|
|
3633
3695
|
dt();
|
|
3634
|
-
let r = st(), { designer: i } =
|
|
3696
|
+
let r = st(), { designer: i } = Kn(n), a = {
|
|
3635
3697
|
position: "bottom",
|
|
3636
3698
|
collapsible: !1,
|
|
3637
3699
|
feed: {
|
|
@@ -3644,7 +3706,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3644
3706
|
return /* @__PURE__ */ Z("div", {
|
|
3645
3707
|
className: t,
|
|
3646
3708
|
...i,
|
|
3647
|
-
children: /* @__PURE__ */ Z(
|
|
3709
|
+
children: /* @__PURE__ */ Z(Gn, {
|
|
3648
3710
|
items: r?.items || [],
|
|
3649
3711
|
config: a,
|
|
3650
3712
|
onAddComment: r?.onAddComment,
|
|
@@ -3654,7 +3716,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3654
3716
|
onUploadAttachments: r?.onUploadAttachments
|
|
3655
3717
|
})
|
|
3656
3718
|
});
|
|
3657
|
-
},
|
|
3719
|
+
}, Jn = (e) => {
|
|
3658
3720
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3659
3721
|
return {
|
|
3660
3722
|
designer: {
|
|
@@ -3664,8 +3726,8 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3664
3726
|
},
|
|
3665
3727
|
rest: i
|
|
3666
3728
|
};
|
|
3667
|
-
},
|
|
3668
|
-
let i = dt(), { translateOptions: a } = pt(), { designer: o } =
|
|
3729
|
+
}, Yn = ({ schema: e = {}, className: t, ...n }) => {
|
|
3730
|
+
let i = dt(), { translateOptions: a } = pt(), { designer: o } = Jn(n), s = Array.isArray(e.stages) ? e.stages : [], c = e.statusField, l = r.useMemo(() => {
|
|
3669
3731
|
if (s.length === 0 || !c || !i?.objectName) return s;
|
|
3670
3732
|
let e = a(i.objectName, c, s);
|
|
3671
3733
|
return Array.isArray(e) && e.length === s.length ? s.map((t, n) => ({
|
|
@@ -3695,7 +3757,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3695
3757
|
});
|
|
3696
3758
|
let b = h.length - 1;
|
|
3697
3759
|
return /* @__PURE__ */ Q("div", {
|
|
3698
|
-
className:
|
|
3760
|
+
className: G("w-full", t),
|
|
3699
3761
|
...o,
|
|
3700
3762
|
children: [/* @__PURE__ */ Q("div", {
|
|
3701
3763
|
className: "hidden sm:flex w-full items-stretch gap-2",
|
|
@@ -3708,7 +3770,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3708
3770
|
return /* @__PURE__ */ Z("div", {
|
|
3709
3771
|
role: "listitem",
|
|
3710
3772
|
"aria-current": r ? "step" : void 0,
|
|
3711
|
-
className:
|
|
3773
|
+
className: G("relative flex-1 min-w-0 px-4 py-2 text-xs font-medium text-center rounded-xl", r && "bg-primary text-primary-foreground shadow-sm", n && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200", !r && !n && i && "bg-emerald-500/10 text-emerald-700/85 dark:text-emerald-300/85", !r && !n && !i && "bg-muted text-muted-foreground"),
|
|
3712
3774
|
children: /* @__PURE__ */ Q("span", {
|
|
3713
3775
|
className: "inline-flex items-center justify-center gap-1.5 truncate",
|
|
3714
3776
|
children: [
|
|
@@ -3735,7 +3797,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3735
3797
|
return /* @__PURE__ */ Z("div", {
|
|
3736
3798
|
role: "listitem",
|
|
3737
3799
|
"aria-current": n ? "step" : void 0,
|
|
3738
|
-
className:
|
|
3800
|
+
className: G("shrink-0 px-3 py-2 text-xs font-medium rounded-md border whitespace-nowrap", n && "bg-destructive text-destructive-foreground border-destructive shadow-sm ring-1 ring-destructive/40", !n && "bg-destructive/5 text-destructive/85 border-destructive/20"),
|
|
3739
3801
|
children: /* @__PURE__ */ Q("span", {
|
|
3740
3802
|
className: "inline-flex items-center gap-1",
|
|
3741
3803
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -3756,7 +3818,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3756
3818
|
return /* @__PURE__ */ Z("div", {
|
|
3757
3819
|
role: "listitem",
|
|
3758
3820
|
"aria-current": i ? "step" : void 0,
|
|
3759
|
-
className:
|
|
3821
|
+
className: G("shrink-0 px-3 py-1.5 rounded-full text-xs font-medium border whitespace-nowrap", n && i && "bg-destructive text-destructive-foreground border-destructive shadow-sm", n && !i && "bg-destructive/5 text-destructive/85 border-destructive/20", !n && i && "bg-primary text-primary-foreground border-primary shadow-sm ring-1 ring-primary/40", !n && r && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200 border-emerald-500/30", !n && !i && !r && "bg-background text-foreground/85 border-border/60"),
|
|
3760
3822
|
children: /* @__PURE__ */ Q("span", {
|
|
3761
3823
|
className: "inline-flex items-center gap-1",
|
|
3762
3824
|
children: [
|
|
@@ -3777,7 +3839,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3777
3839
|
})
|
|
3778
3840
|
})]
|
|
3779
3841
|
});
|
|
3780
|
-
},
|
|
3842
|
+
}, Xn = (e) => {
|
|
3781
3843
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3782
3844
|
return {
|
|
3783
3845
|
designer: {
|
|
@@ -3787,8 +3849,8 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3787
3849
|
},
|
|
3788
3850
|
rest: i
|
|
3789
3851
|
};
|
|
3790
|
-
},
|
|
3791
|
-
let r = dt(), { designer: i } =
|
|
3852
|
+
}, Zn = ({ schema: e = {}, className: t, ...n }) => {
|
|
3853
|
+
let r = dt(), { designer: i } = Xn(n), a = St(), o = Array.isArray(e.actions) ? e.actions : Array.isArray(e.properties?.actions) ? e.properties.actions : [], s = Array.isArray(e.actionNames) ? e.actionNames : Array.isArray(e.properties?.actionNames) ? e.properties.actionNames : [], c = r?.objectName || "", l = s.length > 0 ? s : Array.isArray(o) && o.every((e) => typeof e == "string") ? o : [], u = l.length > 0 && !!c, { item: d } = lt("object", u ? c : null), f = u ? (() => {
|
|
3792
3854
|
let e = Array.isArray(d?.actions) ? d.actions : [], t = new Map(e.map((e) => [e.name, e]));
|
|
3793
3855
|
return l.map((e) => t.get(e)).filter((e) => !!e);
|
|
3794
3856
|
})() : Array.isArray(o) ? o : [], p = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
@@ -3820,11 +3882,11 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3820
3882
|
});
|
|
3821
3883
|
let v = e.align || "end", y = v === "start" ? "justify-start" : v === "center" ? "justify-center" : "justify-end";
|
|
3822
3884
|
return /* @__PURE__ */ Z("div", {
|
|
3823
|
-
className:
|
|
3885
|
+
className: G("flex flex-wrap items-center gap-2", m === "record_header" && !e.inline && "-mt-12 sm:-mt-14 mb-2 relative z-10", y, t),
|
|
3824
3886
|
role: "toolbar",
|
|
3825
3887
|
"aria-label": e.aria?.label || "Quick actions",
|
|
3826
3888
|
...i,
|
|
3827
|
-
children: _.map((t, n) => /* @__PURE__ */ Z(
|
|
3889
|
+
children: _.map((t, n) => /* @__PURE__ */ Z(Qn, {
|
|
3828
3890
|
action: t,
|
|
3829
3891
|
record: r?.data,
|
|
3830
3892
|
variant: t.variant || e.variant || "default",
|
|
@@ -3836,7 +3898,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3836
3898
|
}, t.name || `qa-${n}`))
|
|
3837
3899
|
});
|
|
3838
3900
|
};
|
|
3839
|
-
function
|
|
3901
|
+
function Qn({ action: e, record: t, variant: n, size: i, label: a, onRun: o }) {
|
|
3840
3902
|
let [s, c] = r.useState(!1), l = r.useMemo(() => ({ record: t || {} }), [t]), u = it(e.disabled), d = ot(typeof u == "string" ? u : void 0, l);
|
|
3841
3903
|
return /* @__PURE__ */ Q(y, {
|
|
3842
3904
|
variant: n,
|
|
@@ -3855,7 +3917,7 @@ function Zn({ action: e, record: t, variant: n, size: i, label: a, onRun: o }) {
|
|
|
3855
3917
|
}
|
|
3856
3918
|
//#endregion
|
|
3857
3919
|
//#region src/renderers/record-history.tsx
|
|
3858
|
-
var
|
|
3920
|
+
var $n = (e) => {
|
|
3859
3921
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3860
3922
|
return {
|
|
3861
3923
|
designer: {
|
|
@@ -3865,14 +3927,14 @@ var Qn = (e) => {
|
|
|
3865
3927
|
},
|
|
3866
3928
|
rest: i
|
|
3867
3929
|
};
|
|
3868
|
-
},
|
|
3930
|
+
}, er = new Set([
|
|
3869
3931
|
"created",
|
|
3870
3932
|
"updated",
|
|
3871
3933
|
"assigned",
|
|
3872
3934
|
"shared",
|
|
3873
3935
|
"deleted"
|
|
3874
|
-
]),
|
|
3875
|
-
let { designer: i } =
|
|
3936
|
+
]), tr = ({ schema: e = {}, className: t, ...n }) => {
|
|
3937
|
+
let { designer: i } = $n(n), a = dt(), o = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : void 0, s = e.loading ?? e.properties?.loading, c = e.emptyText ?? e.properties?.emptyText, l = Number(e.limit ?? e.properties?.limit ?? 50) || 50, u = a?.objectName, d = a?.data?.id ?? a?.data?._id ?? a?.recordId, f = a?.dataSource, p = o === void 0 && !!f?.find && !!u && d != null, [m, h] = r.useState(null), [g, _] = r.useState(!1);
|
|
3876
3938
|
r.useEffect(() => {
|
|
3877
3939
|
if (!p) return;
|
|
3878
3940
|
let e = !1;
|
|
@@ -3884,7 +3946,7 @@ var Qn = (e) => {
|
|
|
3884
3946
|
$orderby: { timestamp: "desc" },
|
|
3885
3947
|
$top: Math.max(1, l)
|
|
3886
3948
|
})).then((t) => {
|
|
3887
|
-
e || h((t?.data ?? t?.records ?? []).filter((e) =>
|
|
3949
|
+
e || h((t?.data ?? t?.records ?? []).filter((e) => er.has(e?.type)).map((e) => {
|
|
3888
3950
|
let t = e.timestamp;
|
|
3889
3951
|
return (!t || t === "NOW()" || Number.isNaN(Date.parse(t))) && (t = e.created_at), {
|
|
3890
3952
|
id: e.id,
|
|
@@ -3913,13 +3975,13 @@ var Qn = (e) => {
|
|
|
3913
3975
|
return /* @__PURE__ */ Z("div", {
|
|
3914
3976
|
className: t,
|
|
3915
3977
|
...i,
|
|
3916
|
-
children: /* @__PURE__ */ Z(
|
|
3978
|
+
children: /* @__PURE__ */ Z(tn, {
|
|
3917
3979
|
entries: v,
|
|
3918
3980
|
loading: y,
|
|
3919
3981
|
emptyText: c
|
|
3920
3982
|
})
|
|
3921
3983
|
});
|
|
3922
|
-
},
|
|
3984
|
+
}, nr = (e) => {
|
|
3923
3985
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3924
3986
|
return {
|
|
3925
3987
|
designer: {
|
|
@@ -3929,8 +3991,8 @@ var Qn = (e) => {
|
|
|
3929
3991
|
},
|
|
3930
3992
|
rest: i
|
|
3931
3993
|
};
|
|
3932
|
-
},
|
|
3933
|
-
let i = dt(), a = pt(), { t: o } = $(), { designer: s } =
|
|
3994
|
+
}, rr = (e) => e.replace(/[_-]+/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()).trim(), ir = (e, t) => t && e?.[t] != null && e[t] !== "" ? String(e[t]) : e?.name || e?.title || e?.subject || e?.label || e?.email || e?.username || e?.code || e?.slug || e?.provider_id || e?.user_agent || e?.ip_address || e?.id || "—", ar = ({ schema: e = {}, className: t, ...n }) => {
|
|
3995
|
+
let i = dt(), a = pt(), { t: o } = $(), { designer: s } = nr(n), c = Et().appName, l = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : [], u = i?.recordId, d = i?.dataSource, [f, p] = r.useState({}), m = r.useRef(null), [h, g] = r.useState(!1), _ = r.useRef(!0);
|
|
3934
3996
|
r.useEffect(() => (_.current = !0, () => {
|
|
3935
3997
|
_.current = !1;
|
|
3936
3998
|
}), []);
|
|
@@ -4010,11 +4072,11 @@ var Qn = (e) => {
|
|
|
4010
4072
|
return T && t && !t.loading && !t.error && t.total === 0;
|
|
4011
4073
|
}).map((e) => e.objectName)), k = l.filter((e) => E || !O.has(e.objectName)), A = l.filter((e) => O.has(e.objectName)).map((e) => e.title || (a?.objectLabel ? a.objectLabel({
|
|
4012
4074
|
name: e.objectName,
|
|
4013
|
-
label:
|
|
4014
|
-
}) :
|
|
4075
|
+
label: rr(e.objectName)
|
|
4076
|
+
}) : rr(e.objectName)));
|
|
4015
4077
|
return /* @__PURE__ */ Q("div", {
|
|
4016
4078
|
ref: m,
|
|
4017
|
-
className:
|
|
4079
|
+
className: G("flex flex-col gap-3", e.className, t),
|
|
4018
4080
|
...s,
|
|
4019
4081
|
children: [k.map((e) => {
|
|
4020
4082
|
let t = e.objectName, n = f[t] || {
|
|
@@ -4030,15 +4092,15 @@ var Qn = (e) => {
|
|
|
4030
4092
|
className: "text-sm font-semibold tracking-tight truncate",
|
|
4031
4093
|
children: e.title || (a?.objectLabel ? a.objectLabel({
|
|
4032
4094
|
name: e.objectName,
|
|
4033
|
-
label:
|
|
4034
|
-
}) :
|
|
4095
|
+
label: rr(e.objectName)
|
|
4096
|
+
}) : rr(e.objectName))
|
|
4035
4097
|
}), /* @__PURE__ */ Q("div", {
|
|
4036
4098
|
className: "flex items-center gap-2 shrink-0",
|
|
4037
4099
|
children: [!n.loading && /* @__PURE__ */ Z(v, {
|
|
4038
4100
|
variant: "secondary",
|
|
4039
4101
|
className: "tabular-nums",
|
|
4040
4102
|
children: n.total
|
|
4041
|
-
}), c && u && /* @__PURE__ */ Z(
|
|
4103
|
+
}), c && u && /* @__PURE__ */ Z(Tt, {
|
|
4042
4104
|
to: `/apps/${c}/${e.objectName}?filter%5B${e.relationshipField}%5D=${encodeURIComponent(String(u))}`,
|
|
4043
4105
|
className: "text-[11px] font-medium text-muted-foreground hover:text-foreground transition-colors",
|
|
4044
4106
|
title: o("detail.viewAll", { defaultValue: "View all" }),
|
|
@@ -4060,16 +4122,16 @@ var Qn = (e) => {
|
|
|
4060
4122
|
}) : /* @__PURE__ */ Z("ul", {
|
|
4061
4123
|
className: "divide-y",
|
|
4062
4124
|
children: n.items.map((t) => {
|
|
4063
|
-
let n = t.id || t._id, r =
|
|
4125
|
+
let n = t.id || t._id, r = ir(t, e.displayField), i = n ? `../${e.objectName}/record/${encodeURIComponent(String(n))}` : void 0;
|
|
4064
4126
|
return /* @__PURE__ */ Z("li", {
|
|
4065
4127
|
className: "px-4 py-2",
|
|
4066
|
-
children: i ? /* @__PURE__ */ Q(
|
|
4128
|
+
children: i ? /* @__PURE__ */ Q(Tt, {
|
|
4067
4129
|
to: i,
|
|
4068
4130
|
className: "group flex items-center justify-between gap-2 text-xs hover:text-foreground text-muted-foreground transition-colors",
|
|
4069
4131
|
children: [/* @__PURE__ */ Z("span", {
|
|
4070
4132
|
className: "truncate",
|
|
4071
4133
|
children: r
|
|
4072
|
-
}), /* @__PURE__ */ Z(
|
|
4134
|
+
}), /* @__PURE__ */ Z(_e, { className: "h-3 w-3 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity" })]
|
|
4073
4135
|
}) : /* @__PURE__ */ Z("span", {
|
|
4074
4136
|
className: "block truncate text-xs text-muted-foreground",
|
|
4075
4137
|
children: r
|
|
@@ -4097,7 +4159,7 @@ var Qn = (e) => {
|
|
|
4097
4159
|
})]
|
|
4098
4160
|
})]
|
|
4099
4161
|
});
|
|
4100
|
-
},
|
|
4162
|
+
}, or = {
|
|
4101
4163
|
info: {
|
|
4102
4164
|
wrap: "border-blue-300/60 bg-blue-50 text-blue-900 dark:border-blue-700/40 dark:bg-blue-950/30 dark:text-blue-100 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-300",
|
|
4103
4165
|
icon: "Info"
|
|
@@ -4115,20 +4177,20 @@ var Qn = (e) => {
|
|
|
4115
4177
|
icon: "CheckCircle2"
|
|
4116
4178
|
}
|
|
4117
4179
|
};
|
|
4118
|
-
function
|
|
4180
|
+
function sr(e) {
|
|
4119
4181
|
let t = e?.properties ?? {};
|
|
4120
4182
|
return {
|
|
4121
4183
|
...e,
|
|
4122
4184
|
...t
|
|
4123
4185
|
};
|
|
4124
4186
|
}
|
|
4125
|
-
var
|
|
4126
|
-
let r =
|
|
4187
|
+
var cr = ({ schema: e = {}, className: t }) => {
|
|
4188
|
+
let r = sr(e), o = dt(), s = o?.data, c = o?.objectName || "", l = o?.recordId ?? s?.id, u = [
|
|
4127
4189
|
"info",
|
|
4128
4190
|
"warning",
|
|
4129
4191
|
"error",
|
|
4130
4192
|
"success"
|
|
4131
|
-
].includes(r.severity) ? r.severity : "info", d =
|
|
4193
|
+
].includes(r.severity) ? r.severity : "info", d = or[u], f = r.icon || d.icon, p = it(r.visible), h = ot(p, { record: s }), g = n.useMemo(() => {
|
|
4132
4194
|
if (!r.dismissible) return null;
|
|
4133
4195
|
let e = r.dismissKey || r.title || u;
|
|
4134
4196
|
return `os.record-alert:${c}:${l ?? "_"}:${e}`;
|
|
@@ -4157,7 +4219,7 @@ var sr = ({ schema: e = {}, className: t }) => {
|
|
|
4157
4219
|
}
|
|
4158
4220
|
});
|
|
4159
4221
|
return _ || !s || Object.keys(s).length === 0 || p !== void 0 && !h ? null : /* @__PURE__ */ Q(i, {
|
|
4160
|
-
className:
|
|
4222
|
+
className: G("relative pr-12", d.wrap, t),
|
|
4161
4223
|
role: u === "error" ? "alert" : "status",
|
|
4162
4224
|
"aria-live": u === "error" ? "assertive" : "polite",
|
|
4163
4225
|
children: [
|
|
@@ -4195,7 +4257,7 @@ var sr = ({ schema: e = {}, className: t }) => {
|
|
|
4195
4257
|
}) : null
|
|
4196
4258
|
]
|
|
4197
4259
|
});
|
|
4198
|
-
},
|
|
4260
|
+
}, lr = new Set([
|
|
4199
4261
|
"id",
|
|
4200
4262
|
"_id",
|
|
4201
4263
|
"__v",
|
|
@@ -4210,15 +4272,15 @@ var sr = ({ schema: e = {}, className: t }) => {
|
|
|
4210
4272
|
"owner_id",
|
|
4211
4273
|
"deleted_at",
|
|
4212
4274
|
"is_deleted"
|
|
4213
|
-
]),
|
|
4214
|
-
function
|
|
4275
|
+
]), ur = 480, dr = 95;
|
|
4276
|
+
function fr({ open: e, onClose: t, title: n, record: i, objectName: a, recordId: o, dataSource: s, objectSchema: c, width: l = "min(960px, 60vw)", columns: u = 2, systemFields: d = lr, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
|
|
4215
4277
|
let { t: g } = $(), _ = `objectui.drawerWidth.${a}`, [v, y] = r.useState(() => {
|
|
4216
4278
|
if (typeof window > "u" || !m) return null;
|
|
4217
4279
|
try {
|
|
4218
4280
|
let e = window.localStorage.getItem(_);
|
|
4219
4281
|
if (e) {
|
|
4220
4282
|
let t = parseInt(e, 10);
|
|
4221
|
-
if (Number.isFinite(t) && t >=
|
|
4283
|
+
if (Number.isFinite(t) && t >= ur) return t;
|
|
4222
4284
|
}
|
|
4223
4285
|
} catch {}
|
|
4224
4286
|
return null;
|
|
@@ -4240,7 +4302,7 @@ function dr({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
4240
4302
|
let n = (e) => {
|
|
4241
4303
|
let t = S.current;
|
|
4242
4304
|
if (!t) return;
|
|
4243
|
-
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth *
|
|
4305
|
+
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * dr / 100 : 1600, i = Math.min(r, Math.max(ur, t.startWidth + n));
|
|
4244
4306
|
y(Math.round(i));
|
|
4245
4307
|
}, r = () => {
|
|
4246
4308
|
S.current, S.current = null, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r);
|
|
@@ -4277,7 +4339,7 @@ function dr({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
4277
4339
|
onOpenChange: (e) => {
|
|
4278
4340
|
e || t();
|
|
4279
4341
|
},
|
|
4280
|
-
children: /* @__PURE__ */ Q(
|
|
4342
|
+
children: /* @__PURE__ */ Q(te, {
|
|
4281
4343
|
side: "right",
|
|
4282
4344
|
className: "w-full overflow-y-auto p-0 sm:!max-w-none",
|
|
4283
4345
|
style: x,
|
|
@@ -4290,13 +4352,13 @@ function dr({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
4290
4352
|
onPointerDown: C,
|
|
4291
4353
|
className: "hidden sm:block absolute left-0 top-0 h-full w-1.5 cursor-col-resize select-none bg-transparent hover:bg-primary/30 active:bg-primary/50 transition-colors z-10"
|
|
4292
4354
|
}),
|
|
4293
|
-
/* @__PURE__ */ Z(
|
|
4355
|
+
/* @__PURE__ */ Z(F, {
|
|
4294
4356
|
className: "sr-only",
|
|
4295
|
-
children: /* @__PURE__ */ Z(
|
|
4357
|
+
children: /* @__PURE__ */ Z(I, { children: n })
|
|
4296
4358
|
}),
|
|
4297
4359
|
/* @__PURE__ */ Z("div", {
|
|
4298
4360
|
className: "px-6 pt-6 pb-6",
|
|
4299
|
-
children: /* @__PURE__ */ Z(
|
|
4361
|
+
children: /* @__PURE__ */ Z(fn, {
|
|
4300
4362
|
dataSource: s,
|
|
4301
4363
|
inlineEdit: !0,
|
|
4302
4364
|
schema: {
|
|
@@ -4339,14 +4401,14 @@ function dr({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
4339
4401
|
})
|
|
4340
4402
|
});
|
|
4341
4403
|
}
|
|
4342
|
-
function
|
|
4404
|
+
function pr(e, t) {
|
|
4343
4405
|
if (typeof window > "u") return null;
|
|
4344
4406
|
let n = window.location.pathname, r = `/${e}`, i = n.indexOf(r);
|
|
4345
4407
|
return `${i >= 0 ? n.slice(0, i) : n.replace(/\/$/, "")}/${e}/record/${encodeURIComponent(String(t))}`;
|
|
4346
4408
|
}
|
|
4347
4409
|
//#endregion
|
|
4348
4410
|
//#region src/InlineCreateRelated.tsx
|
|
4349
|
-
var
|
|
4411
|
+
var mr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
|
|
4350
4412
|
let [l, u] = n.useState(!1), [d, f] = n.useState("create"), [p, m] = n.useState({}), [h, g] = n.useState(""), [_, v] = n.useState(s), [w, T] = n.useState(!1), [E, D] = n.useState(!1), k = n.useMemo(() => {
|
|
4351
4413
|
if (!h.trim()) return _;
|
|
4352
4414
|
let e = h.toLowerCase();
|
|
@@ -4392,7 +4454,7 @@ var pr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
4392
4454
|
}
|
|
4393
4455
|
}, [a]), ee = n.useMemo(() => r.filter((e) => e.required).every((e) => p[e.name]?.toString().trim()), [r, p]);
|
|
4394
4456
|
return l ? /* @__PURE__ */ Q(b, {
|
|
4395
|
-
className:
|
|
4457
|
+
className: G("", c),
|
|
4396
4458
|
children: [/* @__PURE__ */ Z(S, {
|
|
4397
4459
|
className: "pb-3",
|
|
4398
4460
|
children: /* @__PURE__ */ Q(C, {
|
|
@@ -4493,7 +4555,7 @@ var pr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
4493
4555
|
]
|
|
4494
4556
|
}) })]
|
|
4495
4557
|
}) : /* @__PURE__ */ Q("div", {
|
|
4496
|
-
className:
|
|
4558
|
+
className: G("flex gap-2", c),
|
|
4497
4559
|
children: [i && /* @__PURE__ */ Q(y, {
|
|
4498
4560
|
variant: "outline",
|
|
4499
4561
|
size: "sm",
|
|
@@ -4519,7 +4581,7 @@ var pr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
4519
4581
|
};
|
|
4520
4582
|
//#endregion
|
|
4521
4583
|
//#region src/DiffView.tsx
|
|
4522
|
-
function
|
|
4584
|
+
function hr(e, t) {
|
|
4523
4585
|
if (e == null) return ["(empty)"];
|
|
4524
4586
|
switch (t) {
|
|
4525
4587
|
case "json": try {
|
|
@@ -4538,7 +4600,7 @@ function mr(e, t) {
|
|
|
4538
4600
|
default: return String(e).split("\n");
|
|
4539
4601
|
}
|
|
4540
4602
|
}
|
|
4541
|
-
function
|
|
4603
|
+
function gr(e, t) {
|
|
4542
4604
|
let n = [], r = Math.max(e.length, t.length);
|
|
4543
4605
|
for (let i = 0; i < r; i++) {
|
|
4544
4606
|
let r = i < e.length ? e[i] : void 0, a = i < t.length ? t[i] : void 0;
|
|
@@ -4555,16 +4617,16 @@ function hr(e, t) {
|
|
|
4555
4617
|
}
|
|
4556
4618
|
return n;
|
|
4557
4619
|
}
|
|
4558
|
-
var
|
|
4620
|
+
var _r = {
|
|
4559
4621
|
added: "bg-green-50 text-green-800 dark:bg-green-950/30 dark:text-green-300",
|
|
4560
4622
|
removed: "bg-red-50 text-red-800 dark:bg-red-950/30 dark:text-red-300",
|
|
4561
4623
|
unchanged: "text-muted-foreground"
|
|
4562
|
-
},
|
|
4624
|
+
}, vr = {
|
|
4563
4625
|
added: "+",
|
|
4564
4626
|
removed: "-",
|
|
4565
4627
|
unchanged: " "
|
|
4566
|
-
},
|
|
4567
|
-
let { t: s } = $(), [c, l] = n.useState(a), u = n.useMemo(() =>
|
|
4628
|
+
}, yr = ({ oldValue: e, newValue: t, fieldName: r, fieldType: i = "string", mode: a = "unified", className: o }) => {
|
|
4629
|
+
let { t: s } = $(), [c, l] = n.useState(a), u = n.useMemo(() => hr(e, i), [e, i]), d = n.useMemo(() => hr(t, i), [t, i]), f = n.useMemo(() => gr(u, d), [u, d]), p = f.some((e) => e.type !== "unchanged"), m = n.useMemo(() => {
|
|
4568
4630
|
if (c !== "side-by-side") return [];
|
|
4569
4631
|
let e = [], t = 0;
|
|
4570
4632
|
for (; t < f.length;) {
|
|
@@ -4590,7 +4652,7 @@ var gr = {
|
|
|
4590
4652
|
return e;
|
|
4591
4653
|
}, [c, f]);
|
|
4592
4654
|
return /* @__PURE__ */ Q(b, {
|
|
4593
|
-
className:
|
|
4655
|
+
className: G("overflow-hidden", o),
|
|
4594
4656
|
children: [/* @__PURE__ */ Z(S, {
|
|
4595
4657
|
className: "pb-2",
|
|
4596
4658
|
children: /* @__PURE__ */ Q(C, {
|
|
@@ -4613,7 +4675,7 @@ var gr = {
|
|
|
4613
4675
|
className: "h-7 w-7",
|
|
4614
4676
|
onClick: () => l("side-by-side"),
|
|
4615
4677
|
title: s("detail.sideBySideDiff"),
|
|
4616
|
-
children: /* @__PURE__ */ Z(
|
|
4678
|
+
children: /* @__PURE__ */ Z(xe, { className: "h-3.5 w-3.5" })
|
|
4617
4679
|
})]
|
|
4618
4680
|
})]
|
|
4619
4681
|
})
|
|
@@ -4622,10 +4684,10 @@ var gr = {
|
|
|
4622
4684
|
children: p ? c === "unified" ? /* @__PURE__ */ Z("div", {
|
|
4623
4685
|
className: "font-mono text-xs overflow-x-auto",
|
|
4624
4686
|
children: f.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
4625
|
-
className:
|
|
4687
|
+
className: G("px-4 py-0.5 whitespace-pre-wrap border-l-2", _r[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
|
|
4626
4688
|
children: [/* @__PURE__ */ Z("span", {
|
|
4627
4689
|
className: "select-none mr-2 inline-block w-3 text-center opacity-60",
|
|
4628
|
-
children:
|
|
4690
|
+
children: vr[e.type]
|
|
4629
4691
|
}), e.value]
|
|
4630
4692
|
}, t))
|
|
4631
4693
|
}) : /* @__PURE__ */ Z("div", {
|
|
@@ -4642,10 +4704,10 @@ var gr = {
|
|
|
4642
4704
|
children: s("detail.currentVersion")
|
|
4643
4705
|
}),
|
|
4644
4706
|
m.map((e, t) => /* @__PURE__ */ Q(n.Fragment, { children: [/* @__PURE__ */ Z("div", {
|
|
4645
|
-
className:
|
|
4707
|
+
className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? _r[e.left.type] : "bg-muted/20"),
|
|
4646
4708
|
children: e.left?.value ?? ""
|
|
4647
4709
|
}), /* @__PURE__ */ Z("div", {
|
|
4648
|
-
className:
|
|
4710
|
+
className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? _r[e.right.type] : "bg-muted/20"),
|
|
4649
4711
|
children: e.right?.value ?? ""
|
|
4650
4712
|
})] }, t))
|
|
4651
4713
|
]
|
|
@@ -4656,7 +4718,7 @@ var gr = {
|
|
|
4656
4718
|
})
|
|
4657
4719
|
})]
|
|
4658
4720
|
});
|
|
4659
|
-
},
|
|
4721
|
+
}, br = ({ currentIndex: e, totalRecords: t, recordIds: r, onNavigate: i, onSearch: a, className: o }) => {
|
|
4660
4722
|
let { t: s } = $(), [c, l] = n.useState(""), [u, d] = n.useState(!1), f = n.useRef(null), p = e > 0, m = e > 0, h = e < t - 1, g = e < t - 1, _ = n.useCallback(() => {
|
|
4661
4723
|
p && i(r[0]);
|
|
4662
4724
|
}, [
|
|
@@ -4724,7 +4786,7 @@ var gr = {
|
|
|
4724
4786
|
i,
|
|
4725
4787
|
a
|
|
4726
4788
|
]), /* @__PURE__ */ Q("div", {
|
|
4727
|
-
className:
|
|
4789
|
+
className: G("flex items-center gap-1.5", o),
|
|
4728
4790
|
children: [
|
|
4729
4791
|
/* @__PURE__ */ Z(y, {
|
|
4730
4792
|
variant: "outline",
|
|
@@ -4733,7 +4795,7 @@ var gr = {
|
|
|
4733
4795
|
disabled: !p,
|
|
4734
4796
|
onClick: _,
|
|
4735
4797
|
title: s("detail.firstRecord"),
|
|
4736
|
-
children: /* @__PURE__ */ Z(
|
|
4798
|
+
children: /* @__PURE__ */ Z(ve, { className: "h-4 w-4" })
|
|
4737
4799
|
}),
|
|
4738
4800
|
/* @__PURE__ */ Z(y, {
|
|
4739
4801
|
variant: "outline",
|
|
@@ -4758,7 +4820,7 @@ var gr = {
|
|
|
4758
4820
|
disabled: !h,
|
|
4759
4821
|
onClick: b,
|
|
4760
4822
|
title: s("detail.nextRecordKey"),
|
|
4761
|
-
children: /* @__PURE__ */ Z(
|
|
4823
|
+
children: /* @__PURE__ */ Z(_e, { className: "h-4 w-4" })
|
|
4762
4824
|
}),
|
|
4763
4825
|
/* @__PURE__ */ Z(y, {
|
|
4764
4826
|
variant: "outline",
|
|
@@ -4767,9 +4829,9 @@ var gr = {
|
|
|
4767
4829
|
disabled: !g,
|
|
4768
4830
|
onClick: x,
|
|
4769
4831
|
title: s("detail.lastRecord"),
|
|
4770
|
-
children: /* @__PURE__ */ Z(
|
|
4832
|
+
children: /* @__PURE__ */ Z(ye, { className: "h-4 w-4" })
|
|
4771
4833
|
}),
|
|
4772
|
-
a && /* @__PURE__ */ Q(
|
|
4834
|
+
a && /* @__PURE__ */ Q(bt, { children: [/* @__PURE__ */ Z(y, {
|
|
4773
4835
|
variant: u ? "secondary" : "ghost",
|
|
4774
4836
|
size: "icon",
|
|
4775
4837
|
className: "h-8 w-8",
|
|
@@ -4789,18 +4851,18 @@ var gr = {
|
|
|
4789
4851
|
})] })
|
|
4790
4852
|
]
|
|
4791
4853
|
});
|
|
4792
|
-
},
|
|
4854
|
+
}, xr = 28, Sr = [
|
|
4793
4855
|
"fill-primary stroke-primary",
|
|
4794
4856
|
"fill-blue-500 stroke-blue-500",
|
|
4795
4857
|
"fill-emerald-500 stroke-emerald-500",
|
|
4796
4858
|
"fill-amber-500 stroke-amber-500"
|
|
4797
|
-
],
|
|
4859
|
+
], Cr = [
|
|
4798
4860
|
"fill-primary-foreground",
|
|
4799
4861
|
"fill-white",
|
|
4800
4862
|
"fill-white",
|
|
4801
4863
|
"fill-white"
|
|
4802
4864
|
];
|
|
4803
|
-
function
|
|
4865
|
+
function wr(e, t, n, r, i) {
|
|
4804
4866
|
let a = [], o = [], s = /* @__PURE__ */ new Set(), c = r / 2, l = i / 2;
|
|
4805
4867
|
a.push({
|
|
4806
4868
|
id: e.id,
|
|
@@ -4864,10 +4926,10 @@ function Cr(e, t, n, r, i) {
|
|
|
4864
4926
|
edges: o
|
|
4865
4927
|
};
|
|
4866
4928
|
}
|
|
4867
|
-
function
|
|
4929
|
+
function Tr(e, t = 6) {
|
|
4868
4930
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
4869
4931
|
}
|
|
4870
|
-
var
|
|
4932
|
+
var Er = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, className: a }) => {
|
|
4871
4933
|
let o = n.useRef(null), [s, c] = n.useState({
|
|
4872
4934
|
width: 500,
|
|
4873
4935
|
height: 400
|
|
@@ -4888,14 +4950,14 @@ var Tr = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
4888
4950
|
});
|
|
4889
4951
|
return n.observe(t), () => n.disconnect();
|
|
4890
4952
|
}, []);
|
|
4891
|
-
let { nodes: d, edges: f } = n.useMemo(() =>
|
|
4953
|
+
let { nodes: d, edges: f } = n.useMemo(() => wr(e, t, r, s.width, s.height), [
|
|
4892
4954
|
e,
|
|
4893
4955
|
t,
|
|
4894
4956
|
r,
|
|
4895
4957
|
s
|
|
4896
4958
|
]);
|
|
4897
4959
|
return /* @__PURE__ */ Q(b, {
|
|
4898
|
-
className:
|
|
4960
|
+
className: G("overflow-hidden", a),
|
|
4899
4961
|
children: [/* @__PURE__ */ Z(S, {
|
|
4900
4962
|
className: "pb-2",
|
|
4901
4963
|
children: /* @__PURE__ */ Q(C, {
|
|
@@ -4930,9 +4992,9 @@ var Tr = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
4930
4992
|
strokeWidth: 1.5,
|
|
4931
4993
|
strokeOpacity: .5
|
|
4932
4994
|
}, `edge-${t}`)), d.map((e) => {
|
|
4933
|
-
let t = l === e.id, n =
|
|
4995
|
+
let t = l === e.id, n = Sr[Math.min(e.level, Sr.length - 1)], r = Cr[Math.min(e.level, Cr.length - 1)], a = e.level === 0 ? 34 : xr;
|
|
4934
4996
|
return /* @__PURE__ */ Q("g", {
|
|
4935
|
-
className:
|
|
4997
|
+
className: G("cursor-pointer transition-transform", i && "hover:opacity-80"),
|
|
4936
4998
|
onClick: () => i?.(e.id),
|
|
4937
4999
|
onMouseEnter: () => u(e.id),
|
|
4938
5000
|
onMouseLeave: () => u(null),
|
|
@@ -4951,8 +5013,8 @@ var Tr = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
4951
5013
|
y: e.y,
|
|
4952
5014
|
textAnchor: "middle",
|
|
4953
5015
|
dominantBaseline: "central",
|
|
4954
|
-
className:
|
|
4955
|
-
children:
|
|
5016
|
+
className: G("text-[10px] font-medium pointer-events-none", r),
|
|
5017
|
+
children: Tr(e.label)
|
|
4956
5018
|
}),
|
|
4957
5019
|
e.type && /* @__PURE__ */ Z("text", {
|
|
4958
5020
|
x: e.x,
|
|
@@ -4961,7 +5023,7 @@ var Tr = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
4961
5023
|
className: "fill-muted-foreground text-[9px] pointer-events-none",
|
|
4962
5024
|
children: e.type
|
|
4963
5025
|
}),
|
|
4964
|
-
t && /* @__PURE__ */ Q(
|
|
5026
|
+
t && /* @__PURE__ */ Q(bt, { children: [/* @__PURE__ */ Z("rect", {
|
|
4965
5027
|
x: e.x - 50,
|
|
4966
5028
|
y: e.y - a - 28,
|
|
4967
5029
|
width: 100,
|
|
@@ -4986,7 +5048,7 @@ var Tr = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
4986
5048
|
};
|
|
4987
5049
|
//#endregion
|
|
4988
5050
|
//#region src/PointInTimeRestore.tsx
|
|
4989
|
-
function
|
|
5051
|
+
function Dr(e) {
|
|
4990
5052
|
try {
|
|
4991
5053
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
4992
5054
|
if (r < 1) return "just now";
|
|
@@ -4997,7 +5059,7 @@ function Er(e) {
|
|
|
4997
5059
|
return e;
|
|
4998
5060
|
}
|
|
4999
5061
|
}
|
|
5000
|
-
var
|
|
5062
|
+
var Or = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
5001
5063
|
let [a, o] = n.useState(null), [s, c] = n.useState(!1), [l, u] = n.useState(!1), d = n.useMemo(() => t.find((e) => e.id === a) ?? null, [t, a]), f = n.useCallback(async () => {
|
|
5002
5064
|
if (!(!d || !r)) {
|
|
5003
5065
|
if (!s) {
|
|
@@ -5020,13 +5082,13 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5020
5082
|
c(!1);
|
|
5021
5083
|
}, []);
|
|
5022
5084
|
return /* @__PURE__ */ Q(b, {
|
|
5023
|
-
className:
|
|
5085
|
+
className: G("", i),
|
|
5024
5086
|
children: [/* @__PURE__ */ Z(S, {
|
|
5025
5087
|
className: "pb-3",
|
|
5026
5088
|
children: /* @__PURE__ */ Q(C, {
|
|
5027
5089
|
className: "flex items-center gap-2 text-base",
|
|
5028
5090
|
children: [
|
|
5029
|
-
/* @__PURE__ */ Z(
|
|
5091
|
+
/* @__PURE__ */ Z(X, { className: "h-4 w-4" }),
|
|
5030
5092
|
"Revision History",
|
|
5031
5093
|
/* @__PURE__ */ Q("span", {
|
|
5032
5094
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -5053,13 +5115,13 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5053
5115
|
let t = e.id === a;
|
|
5054
5116
|
return /* @__PURE__ */ Q("button", {
|
|
5055
5117
|
type: "button",
|
|
5056
|
-
className:
|
|
5118
|
+
className: G("w-full text-left flex items-start gap-3 py-2 px-2 rounded-md transition-colors relative", t ? "bg-accent" : "hover:bg-accent/50"),
|
|
5057
5119
|
onClick: () => {
|
|
5058
5120
|
o(e.id), c(!1);
|
|
5059
5121
|
},
|
|
5060
5122
|
children: [/* @__PURE__ */ Z("div", {
|
|
5061
|
-
className:
|
|
5062
|
-
children: t && /* @__PURE__ */ Z(
|
|
5123
|
+
className: G("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"),
|
|
5124
|
+
children: t && /* @__PURE__ */ Z(_e, { className: "h-3 w-3 text-primary-foreground" })
|
|
5063
5125
|
}), /* @__PURE__ */ Q("div", {
|
|
5064
5126
|
className: "flex-1 min-w-0",
|
|
5065
5127
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -5069,7 +5131,7 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5069
5131
|
children: e.user
|
|
5070
5132
|
}), /* @__PURE__ */ Z("span", {
|
|
5071
5133
|
className: "text-xs text-muted-foreground",
|
|
5072
|
-
children:
|
|
5134
|
+
children: Dr(e.timestamp)
|
|
5073
5135
|
})]
|
|
5074
5136
|
}), /* @__PURE__ */ Q("p", {
|
|
5075
5137
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
@@ -5091,7 +5153,7 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5091
5153
|
children: [
|
|
5092
5154
|
/* @__PURE__ */ Q("div", {
|
|
5093
5155
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
5094
|
-
children: [/* @__PURE__ */ Z(
|
|
5156
|
+
children: [/* @__PURE__ */ Z(Te, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
|
|
5095
5157
|
}),
|
|
5096
5158
|
/* @__PURE__ */ Z("div", {
|
|
5097
5159
|
className: "space-y-2",
|
|
@@ -5107,7 +5169,7 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5107
5169
|
className: "line-through text-red-600 dark:text-red-400 truncate max-w-[120px]",
|
|
5108
5170
|
children: e.oldValue == null ? "(empty)" : String(e.oldValue)
|
|
5109
5171
|
}),
|
|
5110
|
-
/* @__PURE__ */ Z(
|
|
5172
|
+
/* @__PURE__ */ Z(_e, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
5111
5173
|
/* @__PURE__ */ Z("span", {
|
|
5112
5174
|
className: "text-green-600 dark:text-green-400 truncate max-w-[120px]",
|
|
5113
5175
|
children: e.newValue == null ? "(empty)" : String(e.newValue)
|
|
@@ -5137,12 +5199,12 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5137
5199
|
}),
|
|
5138
5200
|
r && /* @__PURE__ */ Z("div", {
|
|
5139
5201
|
className: "pt-1 space-y-2",
|
|
5140
|
-
children: s ? /* @__PURE__ */ Q(
|
|
5202
|
+
children: s ? /* @__PURE__ */ Q(bt, { children: [/* @__PURE__ */ Q("p", {
|
|
5141
5203
|
className: "text-xs text-amber-600 dark:text-amber-400",
|
|
5142
5204
|
children: [
|
|
5143
5205
|
"This will restore the record to its state at",
|
|
5144
5206
|
" ",
|
|
5145
|
-
|
|
5207
|
+
Dr(d.timestamp),
|
|
5146
5208
|
". Continue?"
|
|
5147
5209
|
]
|
|
5148
5210
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -5173,7 +5235,7 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5173
5235
|
})]
|
|
5174
5236
|
}) })]
|
|
5175
5237
|
});
|
|
5176
|
-
},
|
|
5238
|
+
}, kr = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: r = !1, className: i }) => {
|
|
5177
5239
|
let [a, o] = n.useState(""), [s, c] = n.useState(!1), l = n.useCallback(async () => {
|
|
5178
5240
|
let t = a.trim();
|
|
5179
5241
|
if (t) {
|
|
@@ -5188,7 +5250,7 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5188
5250
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), l());
|
|
5189
5251
|
}, [l]);
|
|
5190
5252
|
return /* @__PURE__ */ Q("div", {
|
|
5191
|
-
className:
|
|
5253
|
+
className: G("flex gap-2", i),
|
|
5192
5254
|
children: [/* @__PURE__ */ Z("textarea", {
|
|
5193
5255
|
className: "flex-1 min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-none",
|
|
5194
5256
|
placeholder: t,
|
|
@@ -5206,21 +5268,21 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5206
5268
|
children: /* @__PURE__ */ Z(Ye, { className: "h-4 w-4" })
|
|
5207
5269
|
})]
|
|
5208
5270
|
});
|
|
5209
|
-
},
|
|
5271
|
+
}, Ar = ({ query: e, suggestions: t, onSelect: r, visible: i = !0, activeIndex: a = 0, className: o }) => {
|
|
5210
5272
|
let s = n.useMemo(() => {
|
|
5211
5273
|
if (!e) return t;
|
|
5212
5274
|
let n = e.toLowerCase();
|
|
5213
5275
|
return t.filter((e) => e.name.toLowerCase().includes(n) || e.id.toLowerCase().includes(n));
|
|
5214
5276
|
}, [e, t]);
|
|
5215
5277
|
return !i || s.length === 0 ? null : /* @__PURE__ */ Z("div", {
|
|
5216
|
-
className:
|
|
5278
|
+
className: G("bg-popover border rounded-md shadow-md z-50 max-h-48 overflow-y-auto w-56", o),
|
|
5217
5279
|
role: "listbox",
|
|
5218
5280
|
"aria-label": "Mention suggestions",
|
|
5219
5281
|
children: s.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
5220
5282
|
type: "button",
|
|
5221
5283
|
role: "option",
|
|
5222
5284
|
"aria-selected": t === a,
|
|
5223
|
-
className:
|
|
5285
|
+
className: G("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === a && "bg-accent"),
|
|
5224
5286
|
onMouseDown: (t) => {
|
|
5225
5287
|
t.preventDefault(), r(e);
|
|
5226
5288
|
},
|
|
@@ -5248,7 +5310,7 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5248
5310
|
}, e.id))
|
|
5249
5311
|
});
|
|
5250
5312
|
};
|
|
5251
|
-
function
|
|
5313
|
+
function jr(e, t, n) {
|
|
5252
5314
|
return {
|
|
5253
5315
|
type: e.type,
|
|
5254
5316
|
id: e.id,
|
|
@@ -5259,7 +5321,7 @@ function Ar(e, t, n) {
|
|
|
5259
5321
|
}
|
|
5260
5322
|
//#endregion
|
|
5261
5323
|
//#region src/extractMentions.ts
|
|
5262
|
-
function
|
|
5324
|
+
function Mr(e, t) {
|
|
5263
5325
|
if (!e || !t.length) return [];
|
|
5264
5326
|
let n = [...t].sort((e, t) => t.label.length - e.label.length), r = e, i = /* @__PURE__ */ new Set();
|
|
5265
5327
|
for (let e of n) {
|
|
@@ -5271,10 +5333,10 @@ function jr(e, t) {
|
|
|
5271
5333
|
}
|
|
5272
5334
|
//#endregion
|
|
5273
5335
|
//#region src/synth/buildDefaultPageSchema.ts
|
|
5274
|
-
function
|
|
5336
|
+
function Nr(e) {
|
|
5275
5337
|
return e == null ? [] : Array.isArray(e) ? e.filter((e) => e != null) : [e];
|
|
5276
5338
|
}
|
|
5277
|
-
function
|
|
5339
|
+
function Pr(e) {
|
|
5278
5340
|
if (!e) return null;
|
|
5279
5341
|
if (e.stageField) return e.stageField;
|
|
5280
5342
|
let t = e.fields || {};
|
|
@@ -5290,7 +5352,7 @@ function Nr(e) {
|
|
|
5290
5352
|
}
|
|
5291
5353
|
return null;
|
|
5292
5354
|
}
|
|
5293
|
-
function
|
|
5355
|
+
function Fr(e, t) {
|
|
5294
5356
|
if (!e || !t) return null;
|
|
5295
5357
|
let n = e.fields?.[t]?.options;
|
|
5296
5358
|
return !Array.isArray(n) || n.length === 0 ? null : n.map((e) => ({
|
|
@@ -5298,7 +5360,7 @@ function Pr(e, t) {
|
|
|
5298
5360
|
label: e.label
|
|
5299
5361
|
}));
|
|
5300
5362
|
}
|
|
5301
|
-
function
|
|
5363
|
+
function Ir(e, t, n = 4) {
|
|
5302
5364
|
if (!e) return [];
|
|
5303
5365
|
if (Array.isArray(e.highlightFields) && e.highlightFields.length > 0) return e.highlightFields.slice(0, n);
|
|
5304
5366
|
let r = new Set([
|
|
@@ -5372,22 +5434,22 @@ function Fr(e, t, n = 4) {
|
|
|
5372
5434
|
}
|
|
5373
5435
|
return o;
|
|
5374
5436
|
}
|
|
5375
|
-
function
|
|
5437
|
+
function Lr(e, t = {}) {
|
|
5376
5438
|
return {
|
|
5377
5439
|
type: "page:header",
|
|
5378
5440
|
recordChrome: t.recordChrome !== !1,
|
|
5379
5441
|
...Array.isArray(t.actions) && t.actions.length > 0 ? { actions: t.actions } : {}
|
|
5380
5442
|
};
|
|
5381
5443
|
}
|
|
5382
|
-
function
|
|
5444
|
+
function Rr(e, t) {
|
|
5383
5445
|
return !Array.isArray(t) || t.length === 0 ? null : {
|
|
5384
5446
|
type: "record:quick_actions",
|
|
5385
5447
|
actions: t,
|
|
5386
5448
|
location: "record_header"
|
|
5387
5449
|
};
|
|
5388
5450
|
}
|
|
5389
|
-
function
|
|
5390
|
-
let n = t.statusField ??
|
|
5451
|
+
function zr(e, t = {}) {
|
|
5452
|
+
let n = t.statusField ?? Pr(e), r = t.stages ?? (n ? Fr(e, n) : null), i = t.highlightFields ?? Ir(e, n), a = [];
|
|
5391
5453
|
return !t.hideHighlights && i.length > 0 && a.push({
|
|
5392
5454
|
type: "record:highlights",
|
|
5393
5455
|
fields: i
|
|
@@ -5397,17 +5459,17 @@ function Rr(e, t = {}) {
|
|
|
5397
5459
|
stages: r
|
|
5398
5460
|
}), a;
|
|
5399
5461
|
}
|
|
5400
|
-
function
|
|
5462
|
+
function Br(e, t, n) {
|
|
5401
5463
|
return {
|
|
5402
5464
|
type: "record:details",
|
|
5403
5465
|
sections: t,
|
|
5404
5466
|
...n && n.length > 0 ? { hideFields: n } : {}
|
|
5405
5467
|
};
|
|
5406
5468
|
}
|
|
5407
|
-
function
|
|
5408
|
-
let n = t.statusField ??
|
|
5469
|
+
function Vr(e, t = {}) {
|
|
5470
|
+
let n = t.statusField ?? Pr(e), r = t.highlightFields ?? Ir(e, n), i = [{
|
|
5409
5471
|
label: "Details",
|
|
5410
|
-
children: [
|
|
5472
|
+
children: [Br(e, t.sections, r)]
|
|
5411
5473
|
}];
|
|
5412
5474
|
return !t.hideRelatedTab && Array.isArray(t.related) && t.related.length > 0 && i.push({
|
|
5413
5475
|
label: "Related",
|
|
@@ -5436,15 +5498,15 @@ function Br(e, t = {}) {
|
|
|
5436
5498
|
items: i
|
|
5437
5499
|
};
|
|
5438
5500
|
}
|
|
5439
|
-
function
|
|
5501
|
+
function Hr() {
|
|
5440
5502
|
return { type: "record:discussion" };
|
|
5441
5503
|
}
|
|
5442
|
-
function
|
|
5504
|
+
function Ur(e, t = {}) {
|
|
5443
5505
|
let n = t.slots || {}, r = [];
|
|
5444
|
-
"header" in n && n.header !== void 0 ? r.push(...
|
|
5506
|
+
"header" in n && n.header !== void 0 ? r.push(...Nr(n.header)) : r.push(Lr(e, {
|
|
5445
5507
|
recordChrome: t.recordChrome,
|
|
5446
5508
|
actions: t.headerActions
|
|
5447
|
-
})), "actions" in n && n.actions !== void 0 && r.push(...
|
|
5509
|
+
})), "actions" in n && n.actions !== void 0 && r.push(...Nr(n.actions)), "alerts" in n && n.alerts !== void 0 && r.push(...Nr(n.alerts)), "highlights" in n && n.highlights !== void 0 ? r.push(...Nr(n.highlights)) : r.push(...zr(e, {
|
|
5448
5510
|
highlightFields: t.highlightFields,
|
|
5449
5511
|
statusField: t.statusField,
|
|
5450
5512
|
stages: t.stages,
|
|
@@ -5452,9 +5514,9 @@ function Hr(e, t = {}) {
|
|
|
5452
5514
|
hidePath: t.hidePath
|
|
5453
5515
|
}));
|
|
5454
5516
|
let i = t.showReferenceRail === !0 && !t.hideReferenceRail && Array.isArray(t.related) && t.related.length >= 2, a = t.hideRelatedTab ?? i;
|
|
5455
|
-
if ("tabs" in n && n.tabs !== void 0) r.push(...
|
|
5517
|
+
if ("tabs" in n && n.tabs !== void 0) r.push(...Nr(n.tabs));
|
|
5456
5518
|
else if ("details" in n && n.details !== void 0) {
|
|
5457
|
-
let i =
|
|
5519
|
+
let i = Nr(n.details), o = Vr(e, {
|
|
5458
5520
|
sections: t.sections,
|
|
5459
5521
|
related: t.related,
|
|
5460
5522
|
showActivity: t.showActivity,
|
|
@@ -5467,7 +5529,7 @@ function Hr(e, t = {}) {
|
|
|
5467
5529
|
...o.items[0],
|
|
5468
5530
|
children: i
|
|
5469
5531
|
}), r.push(o);
|
|
5470
|
-
} else r.push(
|
|
5532
|
+
} else r.push(Vr(e, {
|
|
5471
5533
|
sections: t.sections,
|
|
5472
5534
|
related: t.related,
|
|
5473
5535
|
showActivity: t.showActivity,
|
|
@@ -5476,12 +5538,12 @@ function Hr(e, t = {}) {
|
|
|
5476
5538
|
statusField: t.statusField,
|
|
5477
5539
|
hideRelatedTab: a
|
|
5478
5540
|
}));
|
|
5479
|
-
"discussion" in n && n.discussion !== void 0 ? r.push(...
|
|
5541
|
+
"discussion" in n && n.discussion !== void 0 ? r.push(...Nr(n.discussion)) : t.hideDiscussion || r.push(Hr());
|
|
5480
5542
|
let o = [{
|
|
5481
5543
|
name: "main",
|
|
5482
5544
|
width: "full",
|
|
5483
5545
|
components: r
|
|
5484
|
-
}], s =
|
|
5546
|
+
}], s = Nr(n.rightRail);
|
|
5485
5547
|
if (i || s.length > 0) {
|
|
5486
5548
|
let e = [];
|
|
5487
5549
|
i && e.push({
|
|
@@ -5509,7 +5571,7 @@ function Hr(e, t = {}) {
|
|
|
5509
5571
|
regions: o
|
|
5510
5572
|
};
|
|
5511
5573
|
}
|
|
5512
|
-
e.register("detail-view",
|
|
5574
|
+
e.register("detail-view", fn, {
|
|
5513
5575
|
namespace: "plugin-detail",
|
|
5514
5576
|
label: "Detail View",
|
|
5515
5577
|
category: "Views",
|
|
@@ -5639,7 +5701,7 @@ e.register("detail-view", dn, {
|
|
|
5639
5701
|
tabs: [],
|
|
5640
5702
|
related: []
|
|
5641
5703
|
}
|
|
5642
|
-
}), e.register("detail-section",
|
|
5704
|
+
}), e.register("detail-section", Ft, {
|
|
5643
5705
|
namespace: "plugin-detail",
|
|
5644
5706
|
label: "Detail Section",
|
|
5645
5707
|
category: "Detail Components",
|
|
@@ -5690,7 +5752,7 @@ e.register("detail-view", dn, {
|
|
|
5690
5752
|
label: "Header Color"
|
|
5691
5753
|
}
|
|
5692
5754
|
]
|
|
5693
|
-
}), e.register("related-list",
|
|
5755
|
+
}), e.register("related-list", Rt, {
|
|
5694
5756
|
namespace: "plugin-detail",
|
|
5695
5757
|
label: "Related List",
|
|
5696
5758
|
category: "Detail Components",
|
|
@@ -5737,7 +5799,7 @@ e.register("detail-view", dn, {
|
|
|
5737
5799
|
label: "Columns"
|
|
5738
5800
|
}
|
|
5739
5801
|
]
|
|
5740
|
-
}), e.register("detail",
|
|
5802
|
+
}), e.register("detail", fn, {
|
|
5741
5803
|
namespace: "view",
|
|
5742
5804
|
category: "view",
|
|
5743
5805
|
label: "Detail",
|
|
@@ -5760,61 +5822,61 @@ e.register("detail-view", dn, {
|
|
|
5760
5822
|
label: "Fields"
|
|
5761
5823
|
}
|
|
5762
5824
|
]
|
|
5763
|
-
}), e.register("record:details",
|
|
5825
|
+
}), e.register("record:details", yn, {
|
|
5764
5826
|
namespace: "record",
|
|
5765
5827
|
category: "record",
|
|
5766
5828
|
label: "Record Details",
|
|
5767
5829
|
icon: "FileText"
|
|
5768
|
-
}), e.register("record:related_list",
|
|
5830
|
+
}), e.register("record:related_list", Sn, {
|
|
5769
5831
|
namespace: "record",
|
|
5770
5832
|
category: "record",
|
|
5771
5833
|
label: "Related List",
|
|
5772
5834
|
icon: "List"
|
|
5773
|
-
}), e.register("record:highlights",
|
|
5835
|
+
}), e.register("record:highlights", wn, {
|
|
5774
5836
|
namespace: "record",
|
|
5775
5837
|
category: "record",
|
|
5776
5838
|
label: "Highlights Panel",
|
|
5777
5839
|
icon: "Star"
|
|
5778
|
-
}), e.register("record:activity",
|
|
5840
|
+
}), e.register("record:activity", Wn, {
|
|
5779
5841
|
namespace: "record",
|
|
5780
5842
|
category: "record",
|
|
5781
5843
|
label: "Activity Timeline",
|
|
5782
5844
|
icon: "Activity"
|
|
5783
|
-
}), e.register("record:chatter",
|
|
5845
|
+
}), e.register("record:chatter", qn, {
|
|
5784
5846
|
namespace: "record",
|
|
5785
5847
|
category: "record",
|
|
5786
5848
|
label: "Chatter Feed",
|
|
5787
5849
|
icon: "MessageSquare"
|
|
5788
|
-
}), e.register("record:discussion",
|
|
5850
|
+
}), e.register("record:discussion", qn, {
|
|
5789
5851
|
namespace: "record",
|
|
5790
5852
|
category: "record",
|
|
5791
5853
|
label: "Discussion",
|
|
5792
5854
|
icon: "MessageSquare"
|
|
5793
|
-
}), e.register("record:path",
|
|
5855
|
+
}), e.register("record:path", Yn, {
|
|
5794
5856
|
namespace: "record",
|
|
5795
5857
|
category: "record",
|
|
5796
5858
|
label: "Path / Stepper",
|
|
5797
5859
|
icon: "GitBranch"
|
|
5798
|
-
}), e.register("record:quick_actions",
|
|
5860
|
+
}), e.register("record:quick_actions", Zn, {
|
|
5799
5861
|
namespace: "record",
|
|
5800
5862
|
category: "record",
|
|
5801
5863
|
label: "Quick Actions",
|
|
5802
5864
|
icon: "Zap"
|
|
5803
|
-
}), e.register("record:history",
|
|
5865
|
+
}), e.register("record:history", tr, {
|
|
5804
5866
|
namespace: "record",
|
|
5805
5867
|
category: "record",
|
|
5806
5868
|
label: "History Timeline",
|
|
5807
5869
|
icon: "Clock"
|
|
5808
|
-
}), e.register("record:reference_rail",
|
|
5870
|
+
}), e.register("record:reference_rail", ar, {
|
|
5809
5871
|
namespace: "record",
|
|
5810
5872
|
category: "record",
|
|
5811
5873
|
label: "Reference Rail",
|
|
5812
5874
|
icon: "PanelRight"
|
|
5813
|
-
}), e.register("record:alert",
|
|
5875
|
+
}), e.register("record:alert", cr, {
|
|
5814
5876
|
namespace: "record",
|
|
5815
5877
|
category: "record",
|
|
5816
5878
|
label: "Alert Banner",
|
|
5817
5879
|
icon: "AlertTriangle"
|
|
5818
5880
|
});
|
|
5819
5881
|
//#endregion
|
|
5820
|
-
export {
|
|
5882
|
+
export { Jt as ActivityTimeline, In as CommentAttachment, kr as CommentInput, hn as ConcurrentUpdateDialog, Nt as DETAIL_DEFAULT_TRANSLATIONS, Ft as DetailSection, It as DetailTabs, fn as DetailView, yr as DiffView, Tn as FieldChangeItem, Bt as HeaderHighlight, tn as HistoryTimeline, mr as InlineCreateRelated, Ar as MentionAutocomplete, Or as PointInTimeRestore, Dn as ReactionPicker, Wn as RecordActivityRenderer, Hn as RecordActivityTimeline, cr as RecordAlertRenderer, Gn as RecordChatterPanel, qn as RecordChatterRenderer, Ht as RecordComments, fr as RecordDetailDrawer, yn as RecordDetailsRenderer, wn as RecordHighlightsRenderer, tr as RecordHistoryRenderer, ln as RecordMetaFooter, br as RecordNavigationEnhanced, Yn as RecordPathRenderer, Zn as RecordQuickActionsRenderer, ar as RecordReferenceRailRenderer, Sn as RecordRelatedListRenderer, Rt as RelatedList, Er as RelationshipGraph, Mn as RichTextCommentInput, zt as SectionGroup, An as SubscriptionToggle, kn as ThreadedReplies, At as applyAutoSpan, jt as applyDetailAutoLayout, Rr as buildDefaultActions, Br as buildDefaultDetails, Hr as buildDefaultDiscussion, Lr as buildDefaultHeader, zr as buildDefaultHighlights, Ur as buildDefaultPageSchema, Vr as buildDefaultTabs, jr as createMentionFromSuggestion, Mt as createSafeTranslationHook, Ir as deriveHighlightFields, pr as deriveRecordPageHref, Fr as deriveStages, Pr as detectStatusField, Mr as extractMentions, kt as inferDetailColumns, gn as isConcurrentUpdateError, Ot as isWideFieldType, $ as useDetailTranslation };
|