@object-ui/plugin-detail 11.4.0 → 13.1.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 +80 -0
- package/dist/DetailSection.d.ts +5 -1
- package/dist/DetailSection.d.ts.map +1 -1
- package/dist/DetailView.d.ts.map +1 -1
- package/dist/HeaderHighlight.d.ts.map +1 -1
- package/dist/RelatedList.d.ts +8 -0
- package/dist/RelatedList.d.ts.map +1 -1
- package/dist/autoLayout.d.ts +5 -4
- package/dist/autoLayout.d.ts.map +1 -1
- package/dist/index.js +907 -869
- package/dist/index.umd.cjs +3 -3
- package/dist/renderers/record-details.d.ts.map +1 -1
- package/dist/renderers/record-related-list.d.ts.map +1 -1
- package/dist/synth/buildDefaultPageSchema.d.ts.map +1 -1
- package/package.json +16 -16
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ComponentRegistry as e, buildExpandFields as t, formatTitleTemplate as n, getRecordDisplayName as r } from "@object-ui/core";
|
|
2
2
|
import * as i from "react";
|
|
3
3
|
import a from "react";
|
|
4
|
-
import { Alert as o, AlertDescription as s, AlertDialog as c, AlertDialogAction as l, AlertDialogCancel as u, AlertDialogContent as d, AlertDialogDescription as f, AlertDialogFooter as p, AlertDialogHeader as m, AlertDialogTitle as h, AlertTitle as g, Avatar as _, AvatarFallback as v, AvatarImage as y, Badge as b, Button as x, Card as S, CardContent as C, CardHeader as w, CardTitle as T, Collapsible as E, CollapsibleContent as D, CollapsibleTrigger as O, DataEmptyState as k, Input as A, LazyIcon as j, Select as M, SelectContent as N, SelectItem as
|
|
5
|
-
import { Activity as
|
|
6
|
-
import { SchemaRenderer as at, toPredicateInput as ot, useActionEngine as st, useCondition as ct,
|
|
7
|
-
import { BooleanField as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { useFieldPermissions as
|
|
10
|
-
import { resolveFieldCurrency as
|
|
11
|
-
import { Link as
|
|
12
|
-
import { deriveFieldGroupLayout as
|
|
4
|
+
import { Alert as o, AlertDescription as s, AlertDialog as c, AlertDialogAction as l, AlertDialogCancel as u, AlertDialogContent as d, AlertDialogDescription as f, AlertDialogFooter as p, AlertDialogHeader as m, AlertDialogTitle as h, AlertTitle as g, Avatar as _, AvatarFallback as v, AvatarImage as y, Badge as b, Button as x, Card as S, CardContent as C, CardHeader as w, CardTitle as T, Collapsible as E, CollapsibleContent as D, CollapsibleTrigger as O, DataEmptyState as k, Input as A, LazyIcon as j, Select as M, SelectContent as N, SelectItem as P, SelectTrigger as ee, SelectValue as te, Sheet as ne, SheetContent as re, SheetHeader as ie, SheetTitle as ae, Skeleton as F, Tabs as I, TabsContent as L, TabsList as R, TabsTrigger as z, Tooltip as B, TooltipContent as V, TooltipProvider as oe, TooltipTrigger as H, buttonVariants as U, cn as W, useIsMobile as se } from "@object-ui/components";
|
|
5
|
+
import { Activity as G, AlertTriangle as ce, ArrowLeft as le, ArrowRight as ue, ArrowRightLeft as de, ArrowUpDown as fe, AtSign as K, Bell as pe, BellOff as q, Bold as me, Calendar as he, Check as ge, CheckSquare as _e, ChevronDown as ve, ChevronLeft as ye, ChevronRight as be, ChevronsLeft as xe, ChevronsRight as Se, Code as Ce, Columns2 as we, Copy as Te, Edit as Ee, ExternalLink as De, Eye as J, EyeOff as Oe, File as ke, FileArchive as Y, FileText as Ae, History as je, Image as Me, Inbox as X, Italic as Ne, Link as Pe, List as Fe, Loader2 as Ie, Lock as Le, Mail as Re, MessageSquare as ze, Network as Be, PanelRightClose as Ve, PanelRightOpen as He, Paperclip as Ue, Phone as We, Pin as Ge, Plus as Ke, PlusCircle as qe, RotateCcw as Je, Rows3 as Ye, Search as Xe, Send as Ze, SmilePlus as Qe, Star as $e, Trash2 as et, Upload as tt, X as nt, Zap as rt, icons as it } from "lucide-react";
|
|
6
|
+
import { SchemaRenderer as at, toPredicateInput as ot, useActionEngine as st, useCondition as ct, useDataInvalidation as lt, useDiscussionContext as ut, useHighlightFieldNames as dt, useMetadataItem as ft, useObjectTranslation as pt, useRecordContext as mt, useRegisterHighlightFields as ht, useRelatedRecordActions as gt, useSafeFieldLabel as _t } from "@object-ui/react";
|
|
7
|
+
import { BooleanField as vt, LookupField as yt, RecordPickerDialog as bt, SelectField as xt, UserField as St, coerceToSafeValue as Ct, getCellRenderer as wt, humanizeLabel as Tt, resolveCellRendererType as Et } from "@object-ui/fields";
|
|
8
|
+
import { Fragment as Dt, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
9
|
+
import { useFieldPermissions as Ot, usePermissions as kt } from "@object-ui/permissions";
|
|
10
|
+
import { resolveFieldCurrency as At, useLocalization as jt } from "@object-ui/i18n";
|
|
11
|
+
import { Link as Mt, useParams as Nt } from "react-router-dom";
|
|
12
|
+
import { deriveFieldGroupLayout as Pt } from "@objectstack/spec/data";
|
|
13
13
|
//#region src/autoLayout.ts
|
|
14
|
-
var
|
|
14
|
+
var Ft = /* @__PURE__ */ new Set([
|
|
15
15
|
"textarea",
|
|
16
16
|
"markdown",
|
|
17
17
|
"html",
|
|
@@ -23,36 +23,36 @@ var Pt = /* @__PURE__ */ new Set([
|
|
|
23
23
|
"field:grid",
|
|
24
24
|
"field:rich-text"
|
|
25
25
|
]);
|
|
26
|
-
function
|
|
27
|
-
return
|
|
26
|
+
function It(e) {
|
|
27
|
+
return Ft.has(e);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function Lt(e, t) {
|
|
30
30
|
let n;
|
|
31
|
-
return n = e <= 3 ? 1 : 2, t !== void 0 && t < 640 ? Math.min(n, 1) : n;
|
|
31
|
+
return n = e <= 3 ? 1 : e <= 8 ? 2 : e <= 15 ? 3 : 4, t !== void 0 && t < 640 ? Math.min(n, 1) : n;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type &&
|
|
33
|
+
function Rt(e, t) {
|
|
34
|
+
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && It(e.type) ? {
|
|
35
35
|
...e,
|
|
36
36
|
span: t
|
|
37
37
|
} : e);
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function zt(e, t, n) {
|
|
40
40
|
if (t !== void 0) return {
|
|
41
|
-
fields:
|
|
41
|
+
fields: Rt(e, t),
|
|
42
42
|
columns: t
|
|
43
43
|
};
|
|
44
|
-
let r =
|
|
44
|
+
let r = Lt(e.length, n);
|
|
45
45
|
return {
|
|
46
|
-
fields:
|
|
46
|
+
fields: Rt(e, r),
|
|
47
47
|
columns: r
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/useDetailTranslation.ts
|
|
52
|
-
function
|
|
52
|
+
function Bt(e, t) {
|
|
53
53
|
return function() {
|
|
54
54
|
try {
|
|
55
|
-
let n =
|
|
55
|
+
let n = pt();
|
|
56
56
|
return n.t(t) === t ? { t: (t, n) => {
|
|
57
57
|
let r = e[t] || t;
|
|
58
58
|
if (n) for (let [e, t] of Object.entries(n)) r = r.replace(`{{${e}}}`, String(t));
|
|
@@ -67,7 +67,7 @@ function zt(e, t) {
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
var
|
|
70
|
+
var Vt = {
|
|
71
71
|
"detail.back": "Back",
|
|
72
72
|
"detail.edit": "Edit",
|
|
73
73
|
"detail.editInline": "Edit",
|
|
@@ -193,29 +193,29 @@ var Bt = {
|
|
|
193
193
|
"detail.concurrentUpdateReload": "Reload latest",
|
|
194
194
|
"detail.concurrentUpdateOverwrite": "Overwrite anyway",
|
|
195
195
|
"detail.concurrentUpdateCancel": "Cancel"
|
|
196
|
-
}, $ =
|
|
196
|
+
}, $ = Bt(Vt, "detail.back");
|
|
197
197
|
//#endregion
|
|
198
198
|
//#region src/DetailSection.tsx
|
|
199
|
-
function
|
|
200
|
-
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" : "";
|
|
199
|
+
function Ht(e, t) {
|
|
200
|
+
return !e || e <= 1 || t <= 1 ? "" : t === 2 ? e >= 2 ? "md:col-span-2" : "" : t === 3 ? e === 2 ? "md:col-span-2" : e >= 3 ? "md:col-span-2 lg:col-span-3" : "" : e === 2 ? "md:col-span-2" : e === 3 ? "md:col-span-2 lg:col-span-3" : e >= 4 ? "md:col-span-2 lg:col-span-3 xl:col-span-4" : "";
|
|
201
201
|
}
|
|
202
|
-
var
|
|
202
|
+
var Ut = /* @__PURE__ */ new Set([
|
|
203
203
|
"formula",
|
|
204
204
|
"summary",
|
|
205
205
|
"rollup",
|
|
206
206
|
"auto_number"
|
|
207
207
|
]);
|
|
208
|
-
function
|
|
208
|
+
function Wt(e) {
|
|
209
209
|
if (e == null) return e;
|
|
210
|
-
if (Array.isArray(e)) return e.map(
|
|
210
|
+
if (Array.isArray(e)) return e.map(Wt);
|
|
211
211
|
if (typeof e == "object") {
|
|
212
212
|
let t = e;
|
|
213
213
|
return t.id ?? t._id ?? t.value ?? "";
|
|
214
214
|
}
|
|
215
215
|
return e;
|
|
216
216
|
}
|
|
217
|
-
var
|
|
218
|
-
let [u, d] = i.useState(e.defaultCollapsed ?? !1), [f, p] = i.useState(null), [m, h] = i.useState(void 0), [g, _] = i.useState(!1), { t: v } = $(), { fieldLabel: y, translateOptions: b } =
|
|
217
|
+
var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, isEditing: o = !1, onFieldChange: s, dataSource: c, virtualScroll: l }) => {
|
|
218
|
+
let [u, d] = i.useState(e.defaultCollapsed ?? !1), [f, p] = i.useState(null), [m, h] = i.useState(void 0), [g, _] = i.useState(!1), { t: v } = $(), { fieldLabel: y, translateOptions: b } = _t(), k = i.useCallback((e, t) => {
|
|
219
219
|
let n = t == null ? "" : String(t);
|
|
220
220
|
navigator.clipboard.writeText(n).then(() => {
|
|
221
221
|
p(e), setTimeout(() => p(null), 2e3);
|
|
@@ -223,9 +223,7 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
223
223
|
}, []), A = i.useCallback((e) => {
|
|
224
224
|
let n = t?.[e.name] ?? e.value;
|
|
225
225
|
return n == null || n === "";
|
|
226
|
-
}, [t]), j = i.useMemo(() => e.fields.filter(A).length, [e.fields, A]), M =
|
|
227
|
-
if (re.length === 0 && j === e.fields.length) return null;
|
|
228
|
-
let { fields: ie, columns: P } = Rt(re, e.columns), F = (e) => {
|
|
226
|
+
}, [t]), j = i.useMemo(() => e.fields.filter(A).length, [e.fields, A]), M = se(), N = M ? 3 : 4, P = M ? .2 : .25, ee = e.fields.length - j, te = !e.hideEmpty && !o && e.fields.length >= N && j / e.fields.length >= P && ee > 0, ne = !g && (e.hideEmpty || te) ? e.fields.filter((e) => !A(e)) : e.fields, { fields: re, columns: ie } = zt(ne, e.columns), ae = Math.min(ie, Math.max(1, ne.length)), F = (e) => {
|
|
229
227
|
let n = t?.[e.name] ?? e.value;
|
|
230
228
|
if (e.render) return /* @__PURE__ */ Z(at, {
|
|
231
229
|
schema: e.render,
|
|
@@ -234,11 +232,11 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
234
232
|
value: n
|
|
235
233
|
}
|
|
236
234
|
});
|
|
237
|
-
let i =
|
|
235
|
+
let i = Ht(e.span, ae), l = r?.fields?.[e.name], u = { ...e };
|
|
238
236
|
if (l) {
|
|
239
237
|
!e.type && l.type && (u.type = l.type), l.options && !u.options && (u.options = l.options), l.currency && !u.currency && (u.currency = l.currency), l.precision !== void 0 && u.precision === void 0 && (u.precision = l.precision), l.scale !== void 0 && u.scale === void 0 && (u.scale = l.scale), l.format && !u.format && (u.format = l.format);
|
|
240
238
|
let t = l.reference_to || l.reference;
|
|
241
|
-
t && !u.reference_to && (u.reference_to = t), l.reference_field && !u.reference_field && (u.reference_field = l.reference_field);
|
|
239
|
+
t && !u.reference_to && (u.reference_to = t), l.reference_field && !u.reference_field && (u.reference_field = l.reference_field), l.dueLike !== void 0 && u.dueLike === void 0 && (u.dueLike = l.dueLike);
|
|
242
240
|
}
|
|
243
241
|
a && Array.isArray(u.options) && u.options.length > 0 && (u.options = b(a, e.name, u.options));
|
|
244
242
|
let d = (() => {
|
|
@@ -248,9 +246,9 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
248
246
|
title: v("detail.noValue", { defaultValue: "No value" }),
|
|
249
247
|
children: "—"
|
|
250
248
|
});
|
|
251
|
-
let t =
|
|
249
|
+
let t = Et(u) || e.type;
|
|
252
250
|
if (t) {
|
|
253
|
-
let e =
|
|
251
|
+
let e = wt(t);
|
|
254
252
|
if (e) return /* @__PURE__ */ Z(e, {
|
|
255
253
|
value: n,
|
|
256
254
|
field: u
|
|
@@ -259,7 +257,7 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
259
257
|
return String(n);
|
|
260
258
|
})(), p = n != null && n !== "", m = f === e.name, h = y(a || "", e.name, e.label || e.name);
|
|
261
259
|
return M && !(o && !e.readonly) ? /* @__PURE__ */ Q("div", {
|
|
262
|
-
className:
|
|
260
|
+
className: W("flex items-baseline justify-between gap-4 py-2.5 min-h-[44px] group", p && "cursor-pointer active:bg-muted/40 transition-colors"),
|
|
263
261
|
onClick: p ? () => k(e.name, n) : void 0,
|
|
264
262
|
onKeyDown: p ? (t) => {
|
|
265
263
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), k(e.name, n));
|
|
@@ -274,7 +272,7 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
274
272
|
children: d
|
|
275
273
|
})]
|
|
276
274
|
}, e.name) : /* @__PURE__ */ Q("div", {
|
|
277
|
-
className:
|
|
275
|
+
className: W("space-y-1.5 group min-w-0", i),
|
|
278
276
|
children: [/* @__PURE__ */ Z("div", {
|
|
279
277
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
280
278
|
children: y(a || "", e.name, e.label || e.name)
|
|
@@ -282,20 +280,20 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
282
280
|
className: "min-h-[44px] sm:min-h-0",
|
|
283
281
|
children: (() => {
|
|
284
282
|
let t = u.type || e.type;
|
|
285
|
-
if (t === "select" && Array.isArray(u.options) && u.options.length > 0) return /* @__PURE__ */ Z(
|
|
283
|
+
if (t === "select" && Array.isArray(u.options) && u.options.length > 0) return /* @__PURE__ */ Z(xt, {
|
|
286
284
|
field: u,
|
|
287
285
|
value: n == null ? "" : String(n),
|
|
288
286
|
onChange: (t) => s?.(e.name, t)
|
|
289
287
|
});
|
|
290
|
-
if (t === "boolean") return /* @__PURE__ */ Z(
|
|
288
|
+
if (t === "boolean") return /* @__PURE__ */ Z(vt, {
|
|
291
289
|
field: u,
|
|
292
290
|
value: !!n,
|
|
293
291
|
onChange: (t) => s?.(e.name, t)
|
|
294
292
|
});
|
|
295
|
-
let r = t === "user" || t === "owner", i = t === "lookup" || t === "master_detail" || t === "tree" || !!u.reference_to && !
|
|
296
|
-
if (r || i) return /* @__PURE__ */ Z(r ?
|
|
293
|
+
let r = t === "user" || t === "owner", i = t === "lookup" || t === "master_detail" || t === "tree" || !!u.reference_to && !Ut.has(t);
|
|
294
|
+
if (r || i) return /* @__PURE__ */ Z(r ? St : yt, {
|
|
297
295
|
field: u,
|
|
298
|
-
value:
|
|
296
|
+
value: Wt(n),
|
|
299
297
|
onChange: (t) => s?.(e.name, t),
|
|
300
298
|
dataSource: c
|
|
301
299
|
});
|
|
@@ -308,7 +306,7 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
308
306
|
if (/^\d{4}-\d{2}-\d{2}/.test(e)) return e.slice(0, 10);
|
|
309
307
|
let t = new Date(e);
|
|
310
308
|
return isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-CA");
|
|
311
|
-
})() : String(typeof n == "object" ?
|
|
309
|
+
})() : String(typeof n == "object" ? Ct(n) ?? "" : n),
|
|
312
310
|
onChange: (t) => {
|
|
313
311
|
let n = t.target.value;
|
|
314
312
|
if (a && n) {
|
|
@@ -319,7 +317,7 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
319
317
|
});
|
|
320
318
|
})()
|
|
321
319
|
}) : /* @__PURE__ */ Q("div", {
|
|
322
|
-
className:
|
|
320
|
+
className: W("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md", p && "cursor-pointer active:bg-muted/60 transition-colors"),
|
|
323
321
|
onClick: p ? () => k(e.name, n) : void 0,
|
|
324
322
|
onKeyDown: p ? (t) => {
|
|
325
323
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), k(e.name, n));
|
|
@@ -327,9 +325,9 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
327
325
|
role: p ? "button" : void 0,
|
|
328
326
|
tabIndex: p ? 0 : void 0,
|
|
329
327
|
children: [/* @__PURE__ */ Z("div", {
|
|
330
|
-
className: "text-sm flex-1 break-words py-1",
|
|
328
|
+
className: "text-sm flex-1 min-w-0 break-words py-1",
|
|
331
329
|
children: d
|
|
332
|
-
}), p && /* @__PURE__ */ Z(
|
|
330
|
+
}), p && /* @__PURE__ */ Z(oe, { children: /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
333
331
|
asChild: !0,
|
|
334
332
|
children: /* @__PURE__ */ Z(x, {
|
|
335
333
|
variant: "ghost",
|
|
@@ -340,16 +338,16 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
340
338
|
},
|
|
341
339
|
children: m ? /* @__PURE__ */ Z(ge, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Te, { className: "h-3 w-3" })
|
|
342
340
|
})
|
|
343
|
-
}), /* @__PURE__ */ Z(
|
|
341
|
+
}), /* @__PURE__ */ Z(V, { children: v(m ? "detail.copied" : "detail.copyToClipboard") })] }) })]
|
|
344
342
|
})]
|
|
345
343
|
}, e.name);
|
|
346
344
|
}, I = l?.enabled === !0, L = l?.batchSize ?? 20;
|
|
347
|
-
i.useEffect(() => {
|
|
345
|
+
if (i.useEffect(() => {
|
|
348
346
|
if (!I) {
|
|
349
347
|
h(void 0);
|
|
350
348
|
return;
|
|
351
349
|
}
|
|
352
|
-
if (
|
|
350
|
+
if (re.length <= L) {
|
|
353
351
|
h(void 0);
|
|
354
352
|
return;
|
|
355
353
|
}
|
|
@@ -358,14 +356,14 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
358
356
|
return () => clearTimeout(e);
|
|
359
357
|
}, [
|
|
360
358
|
I,
|
|
361
|
-
|
|
359
|
+
re.length,
|
|
362
360
|
L
|
|
363
|
-
]);
|
|
364
|
-
let R = m === void 0 ?
|
|
361
|
+
]), ne.length === 0 && j === e.fields.length) return null;
|
|
362
|
+
let R = m === void 0 ? re : re.slice(0, m), z = j > 0 && (e.hideEmpty || te), U = /* @__PURE__ */ Q(Dt, { children: [M ? /* @__PURE__ */ Z("div", {
|
|
365
363
|
className: "flex flex-col divide-y divide-border/60",
|
|
366
364
|
children: R.map(F)
|
|
367
365
|
}) : /* @__PURE__ */ Z("div", {
|
|
368
|
-
className:
|
|
366
|
+
className: W("grid gap-3 sm:gap-4", ae === 1 ? "grid-cols-1" : ae === 2 ? "grid-cols-1 md:grid-cols-2" : ae === 3 ? "grid-cols-1 md:grid-cols-2 lg:grid-cols-3" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"),
|
|
369
367
|
children: R.map(F)
|
|
370
368
|
}), z && /* @__PURE__ */ Z("div", {
|
|
371
369
|
className: "mt-3 -ml-2",
|
|
@@ -375,15 +373,15 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
375
373
|
size: "sm",
|
|
376
374
|
onClick: () => _((e) => !e),
|
|
377
375
|
className: "h-7 px-2 text-xs text-muted-foreground hover:text-foreground",
|
|
378
|
-
children: [Z(g ?
|
|
376
|
+
children: [Z(g ? Oe : J, { className: "h-3.5 w-3.5 mr-1.5" }), g ? v("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : v("detail.showEmptyFields", {
|
|
379
377
|
count: j,
|
|
380
378
|
defaultValue: `Show ${j} empty field${j === 1 ? "" : "s"}`
|
|
381
379
|
})]
|
|
382
380
|
})
|
|
383
381
|
})] });
|
|
384
382
|
return !e.title && !e.collapsible && e.showBorder === !1 ? /* @__PURE__ */ Z("div", {
|
|
385
|
-
className:
|
|
386
|
-
children:
|
|
383
|
+
className: W(n),
|
|
384
|
+
children: U
|
|
387
385
|
}) : e.collapsible ? /* @__PURE__ */ Z(E, {
|
|
388
386
|
open: !u,
|
|
389
387
|
onOpenChange: (e) => d(!e),
|
|
@@ -391,7 +389,7 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
391
389
|
children: /* @__PURE__ */ Q(S, { children: [/* @__PURE__ */ Z(O, {
|
|
392
390
|
asChild: !0,
|
|
393
391
|
children: /* @__PURE__ */ Q(w, {
|
|
394
|
-
className:
|
|
392
|
+
className: W("py-3 px-4 sm:py-4 sm:px-6 cursor-pointer hover:bg-muted/50 transition-colors", e.headerColor && `bg-${e.headerColor}`),
|
|
395
393
|
children: [/* @__PURE__ */ Q(T, {
|
|
396
394
|
className: "flex items-center justify-between text-base font-semibold tracking-tight",
|
|
397
395
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -411,12 +409,12 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
411
409
|
})
|
|
412
410
|
}), /* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(C, {
|
|
413
411
|
className: "pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5",
|
|
414
|
-
children:
|
|
412
|
+
children: U
|
|
415
413
|
}) })] })
|
|
416
414
|
}) : /* @__PURE__ */ Q(S, {
|
|
417
|
-
className:
|
|
415
|
+
className: W(e.showBorder === !1 ? "border-none shadow-none" : "", n),
|
|
418
416
|
children: [e.title && /* @__PURE__ */ Q(w, {
|
|
419
|
-
className:
|
|
417
|
+
className: W("py-3 px-4 sm:py-4 sm:px-6", e.headerColor && `bg-${e.headerColor}`),
|
|
420
418
|
children: [/* @__PURE__ */ Z(T, {
|
|
421
419
|
className: "flex items-center justify-between text-base font-semibold tracking-tight",
|
|
422
420
|
children: /* @__PURE__ */ Q("div", {
|
|
@@ -432,18 +430,18 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
432
430
|
})]
|
|
433
431
|
}), /* @__PURE__ */ Z(C, {
|
|
434
432
|
className: "pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5",
|
|
435
|
-
children:
|
|
433
|
+
children: U
|
|
436
434
|
})]
|
|
437
435
|
});
|
|
438
|
-
},
|
|
436
|
+
}, Kt = ({ tabs: e, data: t, className: n }) => {
|
|
439
437
|
let [r, a] = i.useState(e[0]?.key), o = e.filter((e) => typeof e.visible == "boolean" ? e.visible : (e.visible, !0));
|
|
440
|
-
return /* @__PURE__ */ Q(
|
|
438
|
+
return /* @__PURE__ */ Q(I, {
|
|
441
439
|
value: r,
|
|
442
440
|
onValueChange: a,
|
|
443
441
|
className: n,
|
|
444
|
-
children: [/* @__PURE__ */ Z(
|
|
442
|
+
children: [/* @__PURE__ */ Z(R, {
|
|
445
443
|
className: "w-full justify-start border-b rounded-none bg-transparent p-0",
|
|
446
|
-
children: o.map((e) => /* @__PURE__ */ Z(
|
|
444
|
+
children: o.map((e) => /* @__PURE__ */ Z(z, {
|
|
447
445
|
value: e.key,
|
|
448
446
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
449
447
|
children: /* @__PURE__ */ Q("div", {
|
|
@@ -459,7 +457,7 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
459
457
|
]
|
|
460
458
|
})
|
|
461
459
|
}, e.key))
|
|
462
|
-
}), o.map((e) => /* @__PURE__ */ Z(
|
|
460
|
+
}), o.map((e) => /* @__PURE__ */ Z(L, {
|
|
463
461
|
value: e.key,
|
|
464
462
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
465
463
|
children: /* @__PURE__ */ Z(i.Suspense, {
|
|
@@ -480,34 +478,36 @@ var Wt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
480
478
|
};
|
|
481
479
|
//#endregion
|
|
482
480
|
//#region src/RelatedList.tsx
|
|
483
|
-
function
|
|
484
|
-
return e && it[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ||
|
|
481
|
+
function qt(e) {
|
|
482
|
+
return e && it[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || X;
|
|
485
483
|
}
|
|
486
|
-
var
|
|
487
|
-
let
|
|
484
|
+
var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className: s, dataSource: g, objectName: _, onNew: v, onViewAll: y, onRowEdit: E, onRowDelete: D, onRowClick: O, rowActions: k, onRowAction: j, toolbarActions: M, onToolbarAction: N, add: P, maxColumns: ee = 6, pageSize: te, sortable: ne = !1, filterable: re = !1, collapsible: ie = !1, defaultCollapsed: ae = !1, referenceField: F, parentId: I, icon: L }) => {
|
|
485
|
+
let R = r !== void 0, z = r ?? [], [B, V] = i.useState(z), [oe, H] = i.useState(() => !!n && !R), [U, G] = i.useState(0), [ce, le] = i.useState(null), [ue, de] = i.useState("asc"), [K, pe] = i.useState(""), [q, me] = i.useState(null), [he, ge] = i.useState(ae), [_e, xe] = i.useState(!1), [Se, Ce] = i.useState(!1), [we, Te] = i.useState(null), [Ee, J] = i.useState(0), [Oe, ke] = i.useState({}), { t: Y } = $(), { fieldLabel: Ae } = _t();
|
|
488
486
|
i.useEffect(() => {
|
|
489
|
-
|
|
490
|
-
}, [r,
|
|
491
|
-
n && g?.getObjectSchema && g.getObjectSchema(n).then(
|
|
487
|
+
R && V(r ?? []);
|
|
488
|
+
}, [r, R]), i.useEffect(() => {
|
|
489
|
+
n && g?.getObjectSchema && g.getObjectSchema(n).then(me).catch((e) => {
|
|
492
490
|
console.warn(`[RelatedList] Failed to fetch schema for ${n}:`, e);
|
|
493
491
|
});
|
|
494
492
|
}, [n, g]), i.useEffect(() => {
|
|
495
|
-
if (n && !
|
|
496
|
-
if (!(
|
|
497
|
-
n && (
|
|
493
|
+
if (n && !R) {
|
|
494
|
+
if (!(F && I != null && I !== "")) {
|
|
495
|
+
n && (I == null || I === "") && !F && console.warn(`[RelatedList] "${n}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`), V([]), H(!1);
|
|
498
496
|
return;
|
|
499
497
|
}
|
|
500
498
|
H(!0);
|
|
501
|
-
let e = { [
|
|
499
|
+
let e = { [F]: I };
|
|
502
500
|
if (g && typeof g.find == "function") g.find(n, { $filter: e }).then((e) => {
|
|
503
|
-
|
|
501
|
+
let t = Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : [];
|
|
502
|
+
V(t), H(!1);
|
|
504
503
|
}).catch((e) => {
|
|
505
504
|
console.error("Failed to fetch related data:", e), H(!1);
|
|
506
505
|
});
|
|
507
506
|
else {
|
|
508
|
-
let e = new URLSearchParams({ [`filter[${
|
|
507
|
+
let e = new URLSearchParams({ [`filter[${F}]`]: String(I) }).toString();
|
|
509
508
|
fetch(`${n}?${e}`).then((e) => e.json()).then((e) => {
|
|
510
|
-
|
|
509
|
+
let t = Array.isArray(e) ? e : e?.data || [];
|
|
510
|
+
V(t);
|
|
511
511
|
}).catch((e) => {
|
|
512
512
|
console.error("Failed to fetch related data:", e);
|
|
513
513
|
}).finally(() => H(!1));
|
|
@@ -515,31 +515,31 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
515
515
|
}
|
|
516
516
|
}, [
|
|
517
517
|
n,
|
|
518
|
-
|
|
518
|
+
R,
|
|
519
519
|
g,
|
|
520
|
-
P,
|
|
521
520
|
F,
|
|
522
|
-
|
|
521
|
+
I,
|
|
522
|
+
Ee
|
|
523
523
|
]), i.useEffect(() => {
|
|
524
|
-
if (!n ||
|
|
524
|
+
if (!n || R) return;
|
|
525
525
|
let e = (e) => {
|
|
526
526
|
let t = e.detail || {};
|
|
527
|
-
t.objectName && t.objectName !== n ||
|
|
527
|
+
t.objectName && t.objectName !== n || J((e) => e + 1);
|
|
528
528
|
};
|
|
529
529
|
return window.addEventListener("objectui:related-changed", e), () => window.removeEventListener("objectui:related-changed", e);
|
|
530
|
-
}, [n,
|
|
531
|
-
if (!g?.find || !q?.fields || !
|
|
530
|
+
}, [n, R]), i.useEffect(() => {
|
|
531
|
+
if (!g?.find || !q?.fields || !B.length) return;
|
|
532
532
|
let e = q.fields, t = [];
|
|
533
533
|
for (let [n, r] of Object.entries(e)) {
|
|
534
534
|
if (!r || r.type !== "lookup" && r.type !== "master_detail") continue;
|
|
535
535
|
let e = r.reference_to || r.reference;
|
|
536
536
|
if (!e) continue;
|
|
537
537
|
let i = /* @__PURE__ */ new Set();
|
|
538
|
-
for (let e of
|
|
538
|
+
for (let e of B) {
|
|
539
539
|
let t = e?.[n];
|
|
540
540
|
t != null && (typeof t == "string" && t ? i.add(t) : typeof t == "number" && i.add(String(t)));
|
|
541
541
|
}
|
|
542
|
-
let a =
|
|
542
|
+
let a = Oe[n] || {}, o = Array.from(i).filter((e) => !(e in a));
|
|
543
543
|
o.length > 0 && t.push({
|
|
544
544
|
fieldName: n,
|
|
545
545
|
target: e,
|
|
@@ -565,7 +565,7 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
565
565
|
fieldName: e,
|
|
566
566
|
map: {}
|
|
567
567
|
})))).then((e) => {
|
|
568
|
-
n ||
|
|
568
|
+
n || ke((t) => {
|
|
569
569
|
let n = { ...t };
|
|
570
570
|
for (let { fieldName: t, map: r } of e) n[t] = {
|
|
571
571
|
...n[t] || {},
|
|
@@ -579,82 +579,82 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
579
579
|
}, [
|
|
580
580
|
g,
|
|
581
581
|
q,
|
|
582
|
-
|
|
582
|
+
B
|
|
583
583
|
]);
|
|
584
|
-
let
|
|
585
|
-
if (!
|
|
586
|
-
let e =
|
|
587
|
-
return
|
|
588
|
-
}, [
|
|
589
|
-
let n = e[
|
|
584
|
+
let je = i.useMemo(() => {
|
|
585
|
+
if (!K) return B;
|
|
586
|
+
let e = K.toLowerCase();
|
|
587
|
+
return B.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
588
|
+
}, [B, K]), Me = i.useMemo(() => ce ? [...je].sort((e, t) => {
|
|
589
|
+
let n = e[ce], r = t[ce];
|
|
590
590
|
if (n == null && r == null) return 0;
|
|
591
591
|
if (n == null) return 1;
|
|
592
592
|
if (r == null) return -1;
|
|
593
593
|
let i = String(n).localeCompare(String(r), void 0, { numeric: !0 });
|
|
594
|
-
return
|
|
595
|
-
}) :
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
]),
|
|
594
|
+
return ue === "asc" ? i : -i;
|
|
595
|
+
}) : je, [
|
|
596
|
+
je,
|
|
597
|
+
ce,
|
|
598
|
+
ue
|
|
599
|
+
]), X = te && te > 0 ? te : 0, Ne = X ? Math.max(1, Math.ceil(Me.length / X)) : 1, Pe = X ? Me.slice(U * X, (U + 1) * X) : Me;
|
|
600
600
|
i.useEffect(() => {
|
|
601
|
-
|
|
601
|
+
G(0);
|
|
602
602
|
}, [
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
603
|
+
K,
|
|
604
|
+
ce,
|
|
605
|
+
ue
|
|
606
606
|
]);
|
|
607
|
-
let
|
|
608
|
-
|
|
609
|
-
}, [
|
|
610
|
-
|
|
611
|
-
}, []),
|
|
612
|
-
if (
|
|
613
|
-
await D?.(
|
|
607
|
+
let Fe = i.useCallback((e) => {
|
|
608
|
+
ce === e ? de((e) => e === "asc" ? "desc" : "asc") : (le(e), de("asc"));
|
|
609
|
+
}, [ce]), [Ie, Le] = i.useState(null), Re = i.useCallback((e) => {
|
|
610
|
+
Le(e);
|
|
611
|
+
}, []), ze = i.useCallback(async () => {
|
|
612
|
+
if (Ie) try {
|
|
613
|
+
await D?.(Ie), J((e) => e + 1);
|
|
614
614
|
} catch (e) {
|
|
615
615
|
console.error("[RelatedList] remove failed", e);
|
|
616
616
|
}
|
|
617
|
-
|
|
618
|
-
}, [
|
|
619
|
-
if (!
|
|
620
|
-
let t =
|
|
621
|
-
|
|
617
|
+
Le(null);
|
|
618
|
+
}, [Ie, D]), Be = i.useCallback(async (e) => {
|
|
619
|
+
if (!P || !g || !n || F == null || I == null) return;
|
|
620
|
+
let t = P.picker.valueField || "id";
|
|
621
|
+
Ce(!0), Te(null);
|
|
622
622
|
try {
|
|
623
623
|
for (let r of e || []) {
|
|
624
624
|
let e = r?.[t] ?? r?.id;
|
|
625
|
-
e != null && (
|
|
626
|
-
[
|
|
627
|
-
[
|
|
628
|
-
}) : await g.update?.(
|
|
625
|
+
e != null && (P.linkField ? await g.create?.(n, {
|
|
626
|
+
[F]: I,
|
|
627
|
+
[P.linkField]: e
|
|
628
|
+
}) : await g.update?.(P.picker.object, String(e), { [F]: I }));
|
|
629
629
|
}
|
|
630
|
-
|
|
630
|
+
J((e) => e + 1);
|
|
631
631
|
} catch (e) {
|
|
632
632
|
let t = e?.body?.error ?? e?.error ?? e?.message ?? String(e);
|
|
633
|
-
|
|
633
|
+
Te(typeof t == "string" ? t : "Failed to add");
|
|
634
634
|
} finally {
|
|
635
|
-
|
|
635
|
+
Ce(!1), xe(!1);
|
|
636
636
|
}
|
|
637
637
|
}, [
|
|
638
|
-
|
|
638
|
+
P,
|
|
639
639
|
g,
|
|
640
640
|
n,
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
]),
|
|
644
|
-
let e = _ || n || "", t = (t) => !
|
|
641
|
+
F,
|
|
642
|
+
I
|
|
643
|
+
]), Ve = kt(), He = i.useMemo(() => {
|
|
644
|
+
let e = _ || n || "", t = (t) => !Ve?.isLoaded || !e ? t : t.filter((t) => {
|
|
645
645
|
let n = t?.accessorKey || t?.field || t?.name;
|
|
646
|
-
return n ?
|
|
647
|
-
}), r = (e) =>
|
|
646
|
+
return n ? Ve.checkField(e, String(n), "read") : !0;
|
|
647
|
+
}), r = (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, s = (e) => B.length ? e.filter((e) => {
|
|
648
648
|
let t = e?.accessorKey || e?.field || e?.name;
|
|
649
|
-
return t ?
|
|
649
|
+
return t ? B.some((e) => !a(e?.[t])) : !0;
|
|
650
650
|
}) : e, c = (e, t) => {
|
|
651
651
|
if (!t?.type) return;
|
|
652
|
-
let n =
|
|
652
|
+
let n = wt(Et({
|
|
653
653
|
type: t.type,
|
|
654
654
|
format: t.format
|
|
655
655
|
}) || t.type);
|
|
656
656
|
if (!n) return;
|
|
657
|
-
let r = t.type === "lookup" || t.type === "master_detail" ?
|
|
657
|
+
let r = t.type === "lookup" || t.type === "master_detail" ? Oe[e] : void 0, a = r && Object.keys(r).length > 0 ? Object.entries(r).map(([e, t]) => ({
|
|
658
658
|
value: e,
|
|
659
659
|
label: t
|
|
660
660
|
})) : void 0, o = {
|
|
@@ -687,7 +687,7 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
687
687
|
}
|
|
688
688
|
let n = q?.fields?.[t], r = {
|
|
689
689
|
accessorKey: t,
|
|
690
|
-
header: n?.label ||
|
|
690
|
+
header: n?.label || Ae(e, t, n) || t,
|
|
691
691
|
fieldDef: n,
|
|
692
692
|
fieldType: n?.type
|
|
693
693
|
}, i = n ? c(t, n) : void 0;
|
|
@@ -698,7 +698,7 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
698
698
|
let u = Array.isArray(q.highlightFields) ? q.highlightFields.filter((e) => typeof e == "string" && e.length > 0) : [];
|
|
699
699
|
if (u.length > 0) {
|
|
700
700
|
let e = s(t(r(u.map(l))));
|
|
701
|
-
if (e.length > 0) return e.slice(0, Math.max(1,
|
|
701
|
+
if (e.length > 0) return e.slice(0, Math.max(1, ee));
|
|
702
702
|
}
|
|
703
703
|
let d = e, f = /* @__PURE__ */ new Set([
|
|
704
704
|
"image",
|
|
@@ -716,7 +716,7 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
716
716
|
"label",
|
|
717
717
|
"code",
|
|
718
718
|
"number"
|
|
719
|
-
], m = Object.entries(q.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e ===
|
|
719
|
+
], m = Object.entries(q.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === F || t?.hidden || t?.type && f.has(t.type) || Ve?.isLoaded && d && !Ve.checkField(d, e, "read"))), h = /* @__PURE__ */ new Set([
|
|
720
720
|
"created_at",
|
|
721
721
|
"updated_at",
|
|
722
722
|
"created_by",
|
|
@@ -734,32 +734,32 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
734
734
|
}), s(m.map(([e, t]) => {
|
|
735
735
|
let n = {
|
|
736
736
|
accessorKey: e,
|
|
737
|
-
header:
|
|
737
|
+
header: Ae(d, e, t.label || e)
|
|
738
738
|
};
|
|
739
739
|
if (t.type) {
|
|
740
740
|
let r = c(e, t);
|
|
741
741
|
r && (n.cell = r);
|
|
742
742
|
}
|
|
743
743
|
return n;
|
|
744
|
-
})).slice(0, Math.max(1,
|
|
744
|
+
})).slice(0, Math.max(1, ee));
|
|
745
745
|
}, [
|
|
746
746
|
o,
|
|
747
747
|
q,
|
|
748
748
|
_,
|
|
749
749
|
n,
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
]),
|
|
750
|
+
Ae,
|
|
751
|
+
F,
|
|
752
|
+
B,
|
|
753
|
+
ee,
|
|
754
|
+
Oe,
|
|
755
|
+
Ve
|
|
756
|
+
]), Ue = Array.isArray(k) && k.length > 0, We = !!E || !!D || Ue, Ge = se(), qe = i.useMemo(() => {
|
|
757
757
|
if (a) return a;
|
|
758
|
-
if (
|
|
759
|
-
let e =
|
|
758
|
+
if (Ge && (t === "grid" || t === "table")) {
|
|
759
|
+
let e = He[0]?.accessorKey || He[0]?.field || He[0]?.name, t = He.slice(1, 4).map((e) => e.accessorKey || e.field || e.name).filter(Boolean);
|
|
760
760
|
return {
|
|
761
761
|
type: "object-gallery",
|
|
762
|
-
data:
|
|
762
|
+
data: Pe,
|
|
763
763
|
objectName: n,
|
|
764
764
|
gallery: {
|
|
765
765
|
titleField: e || "name",
|
|
@@ -773,22 +773,22 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
773
773
|
case "grid":
|
|
774
774
|
case "table": return {
|
|
775
775
|
type: "data-table",
|
|
776
|
-
data:
|
|
777
|
-
columns:
|
|
776
|
+
data: Pe,
|
|
777
|
+
columns: He,
|
|
778
778
|
pagination: !1,
|
|
779
|
-
pageSize:
|
|
779
|
+
pageSize: X || 10,
|
|
780
780
|
searchable: !1,
|
|
781
781
|
exportable: !1,
|
|
782
|
-
rowActions:
|
|
782
|
+
rowActions: We,
|
|
783
783
|
onRowEdit: E,
|
|
784
|
-
onRowDelete: D ?
|
|
784
|
+
onRowDelete: D ? Re : void 0,
|
|
785
785
|
onRowClick: O,
|
|
786
|
-
rowActionDefs:
|
|
787
|
-
onRowActionDef:
|
|
786
|
+
rowActionDefs: Ue ? k : void 0,
|
|
787
|
+
onRowActionDef: Ue ? j : void 0
|
|
788
788
|
};
|
|
789
789
|
case "list": return {
|
|
790
790
|
type: "data-list",
|
|
791
|
-
data:
|
|
791
|
+
data: Pe
|
|
792
792
|
};
|
|
793
793
|
default: return {
|
|
794
794
|
type: "div",
|
|
@@ -797,139 +797,154 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
797
797
|
}
|
|
798
798
|
}, [
|
|
799
799
|
t,
|
|
800
|
-
|
|
801
|
-
Be,
|
|
802
|
-
a,
|
|
803
|
-
Y,
|
|
800
|
+
Pe,
|
|
804
801
|
He,
|
|
805
|
-
|
|
802
|
+
a,
|
|
803
|
+
X,
|
|
804
|
+
We,
|
|
805
|
+
Ue,
|
|
806
806
|
k,
|
|
807
807
|
j,
|
|
808
808
|
E,
|
|
809
809
|
D,
|
|
810
|
-
|
|
810
|
+
Re,
|
|
811
811
|
O,
|
|
812
|
-
|
|
812
|
+
Ge,
|
|
813
813
|
n
|
|
814
|
-
]),
|
|
814
|
+
]), Je = ie ? "cursor-pointer select-none" : void 0, Ye = ie ? () => ge((e) => !e) : void 0, Xe = qt(L), Ze = !oe && B.length === 0, Qe = re;
|
|
815
815
|
return /* @__PURE__ */ Q(S, {
|
|
816
|
-
className:
|
|
816
|
+
className: W("shadow-none border-border/60 bg-transparent", Ze && "bg-muted/10", s),
|
|
817
817
|
children: [
|
|
818
818
|
/* @__PURE__ */ Z(w, {
|
|
819
|
-
className:
|
|
820
|
-
onClick:
|
|
819
|
+
className: W("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", Je),
|
|
820
|
+
onClick: Ye,
|
|
821
821
|
children: /* @__PURE__ */ Q(T, {
|
|
822
822
|
className: "flex items-center justify-between gap-2 text-sm font-semibold",
|
|
823
823
|
children: [/* @__PURE__ */ Q("div", {
|
|
824
824
|
className: "flex items-center gap-2 min-w-0",
|
|
825
825
|
children: [
|
|
826
|
-
|
|
827
|
-
/* @__PURE__ */ Z(
|
|
826
|
+
ie && Z(he ? be : ve, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
|
|
827
|
+
/* @__PURE__ */ Z(Xe, {
|
|
828
828
|
className: "h-4 w-4 text-muted-foreground shrink-0",
|
|
829
829
|
"aria-hidden": !0
|
|
830
830
|
}),
|
|
831
831
|
/* @__PURE__ */ Z("span", {
|
|
832
|
-
className:
|
|
832
|
+
className: W("truncate", Ze && "text-muted-foreground font-medium"),
|
|
833
833
|
children: e
|
|
834
834
|
}),
|
|
835
835
|
/* @__PURE__ */ Z(b, {
|
|
836
836
|
variant: "secondary",
|
|
837
|
-
className:
|
|
838
|
-
"aria-label": `${
|
|
839
|
-
children:
|
|
837
|
+
className: W("text-xs font-normal h-5 px-1.5", B.length === 0 && "bg-muted text-muted-foreground"),
|
|
838
|
+
"aria-label": `${B.length} records`,
|
|
839
|
+
children: B.length
|
|
840
840
|
}),
|
|
841
|
-
|
|
841
|
+
Ze && /* @__PURE__ */ Z("span", {
|
|
842
842
|
className: "text-xs text-muted-foreground/70 italic ml-1 truncate",
|
|
843
|
-
children:
|
|
843
|
+
children: Y("detail.noRelatedRecords")
|
|
844
844
|
})
|
|
845
845
|
]
|
|
846
846
|
}), /* @__PURE__ */ Q("div", {
|
|
847
847
|
className: "flex items-center gap-1 shrink-0",
|
|
848
|
-
children: [
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
848
|
+
children: [
|
|
849
|
+
N && (M ?? []).map((e) => {
|
|
850
|
+
let t = e.icon ? qt(e.icon) : null;
|
|
851
|
+
return /* @__PURE__ */ Q(x, {
|
|
852
|
+
variant: e.variant === "primary" ? "default" : "outline",
|
|
853
|
+
size: "sm",
|
|
854
|
+
onClick: (t) => {
|
|
855
|
+
t.stopPropagation(), N(e);
|
|
856
|
+
},
|
|
857
|
+
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
858
|
+
children: [t && /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" }), e.label || e.name]
|
|
859
|
+
}, e.name);
|
|
860
|
+
}),
|
|
861
|
+
P && /* @__PURE__ */ Q(x, {
|
|
862
|
+
variant: Ze ? "ghost" : "outline",
|
|
863
|
+
size: "sm",
|
|
864
|
+
disabled: Se,
|
|
865
|
+
onClick: (e) => {
|
|
866
|
+
e.stopPropagation(), Te(null), xe(!0);
|
|
867
|
+
},
|
|
868
|
+
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
869
|
+
children: [/* @__PURE__ */ Z(Ke, { className: "h-3.5 w-3.5" }), P.label || Y("detail.add", { defaultValue: "Add" })]
|
|
870
|
+
}),
|
|
871
|
+
v && /* @__PURE__ */ Q(x, {
|
|
872
|
+
variant: Ze ? "ghost" : "outline",
|
|
873
|
+
size: "sm",
|
|
874
|
+
onClick: (e) => {
|
|
875
|
+
e.stopPropagation(), v();
|
|
876
|
+
},
|
|
877
|
+
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
878
|
+
children: [/* @__PURE__ */ Z(Ke, { className: "h-3.5 w-3.5" }), Y("detail.new")]
|
|
879
|
+
})
|
|
880
|
+
]
|
|
866
881
|
})]
|
|
867
882
|
})
|
|
868
883
|
}),
|
|
869
|
-
!
|
|
870
|
-
className:
|
|
884
|
+
!he && !Ze && /* @__PURE__ */ Q(C, {
|
|
885
|
+
className: W("pt-0 pb-4 px-4"),
|
|
871
886
|
children: [
|
|
872
|
-
|
|
887
|
+
Qe && /* @__PURE__ */ Z("div", {
|
|
873
888
|
className: "mb-3",
|
|
874
889
|
children: /* @__PURE__ */ Z(A, {
|
|
875
|
-
placeholder:
|
|
876
|
-
value:
|
|
877
|
-
onChange: (e) =>
|
|
890
|
+
placeholder: Y("detail.filterPlaceholder"),
|
|
891
|
+
value: K,
|
|
892
|
+
onChange: (e) => pe(e.target.value),
|
|
878
893
|
className: "h-8 text-sm"
|
|
879
894
|
})
|
|
880
895
|
}),
|
|
881
|
-
|
|
896
|
+
ne && He && He.length > 0 && B.length > 0 && /* @__PURE__ */ Z("div", {
|
|
882
897
|
className: "flex flex-wrap gap-1 mb-3",
|
|
883
|
-
children:
|
|
898
|
+
children: He.map((e) => {
|
|
884
899
|
let t = e.accessorKey || e.field || e.name;
|
|
885
900
|
if (!t) return null;
|
|
886
|
-
let n = e.header || e.label || t, r =
|
|
901
|
+
let n = e.header || e.label || t, r = ce === t;
|
|
887
902
|
return /* @__PURE__ */ Q(x, {
|
|
888
903
|
variant: r ? "secondary" : "ghost",
|
|
889
904
|
size: "sm",
|
|
890
905
|
className: "gap-1 h-7 text-xs",
|
|
891
|
-
onClick: () =>
|
|
906
|
+
onClick: () => Fe(t),
|
|
892
907
|
children: [
|
|
893
|
-
/* @__PURE__ */ Z(
|
|
908
|
+
/* @__PURE__ */ Z(fe, { className: "h-3 w-3" }),
|
|
894
909
|
n,
|
|
895
|
-
r && (
|
|
910
|
+
r && (ue === "asc" ? " ↑" : " ↓")
|
|
896
911
|
]
|
|
897
912
|
}, t);
|
|
898
913
|
})
|
|
899
914
|
}),
|
|
900
|
-
|
|
915
|
+
oe ? /* @__PURE__ */ Z("div", {
|
|
901
916
|
className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
|
|
902
|
-
children:
|
|
903
|
-
}) : /* @__PURE__ */ Z(at, { schema:
|
|
904
|
-
|
|
917
|
+
children: Y("detail.loading")
|
|
918
|
+
}) : /* @__PURE__ */ Z(at, { schema: qe }),
|
|
919
|
+
X > 0 && Me.length > X && /* @__PURE__ */ Q("div", {
|
|
905
920
|
className: "flex items-center justify-between mt-3 pt-3 border-t",
|
|
906
921
|
children: [
|
|
907
922
|
/* @__PURE__ */ Q(x, {
|
|
908
923
|
variant: "outline",
|
|
909
924
|
size: "sm",
|
|
910
925
|
className: "h-7 text-xs gap-1",
|
|
911
|
-
disabled:
|
|
912
|
-
onClick: () =>
|
|
913
|
-
children: [/* @__PURE__ */ Z(ye, { className: "h-3 w-3" }),
|
|
926
|
+
disabled: U === 0,
|
|
927
|
+
onClick: () => G((e) => Math.max(0, e - 1)),
|
|
928
|
+
children: [/* @__PURE__ */ Z(ye, { className: "h-3 w-3" }), Y("detail.previousPage")]
|
|
914
929
|
}),
|
|
915
930
|
/* @__PURE__ */ Z("span", {
|
|
916
931
|
className: "text-xs text-muted-foreground",
|
|
917
|
-
children:
|
|
918
|
-
current:
|
|
919
|
-
total:
|
|
932
|
+
children: Y("detail.pageOf", {
|
|
933
|
+
current: U + 1,
|
|
934
|
+
total: Ne
|
|
920
935
|
})
|
|
921
936
|
}),
|
|
922
937
|
/* @__PURE__ */ Q(x, {
|
|
923
938
|
variant: "outline",
|
|
924
939
|
size: "sm",
|
|
925
940
|
className: "h-7 text-xs gap-1",
|
|
926
|
-
disabled:
|
|
927
|
-
onClick: () =>
|
|
928
|
-
children: [
|
|
941
|
+
disabled: U >= Ne - 1,
|
|
942
|
+
onClick: () => G((e) => Math.min(Ne - 1, e + 1)),
|
|
943
|
+
children: [Y("detail.nextPage"), /* @__PURE__ */ Z(be, { className: "h-3 w-3" })]
|
|
929
944
|
})
|
|
930
945
|
]
|
|
931
946
|
}),
|
|
932
|
-
y && !
|
|
947
|
+
y && !Ze && X > 0 && Me.length > X && /* @__PURE__ */ Z("div", {
|
|
933
948
|
className: "mt-3 pt-3 border-t flex justify-center",
|
|
934
949
|
children: /* @__PURE__ */ Q("button", {
|
|
935
950
|
type: "button",
|
|
@@ -937,45 +952,45 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
937
952
|
e.stopPropagation(), y();
|
|
938
953
|
},
|
|
939
954
|
className: "text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors",
|
|
940
|
-
children: [
|
|
955
|
+
children: [Y("detail.viewAll"), /* @__PURE__ */ Z(De, { className: "h-3 w-3" })]
|
|
941
956
|
})
|
|
942
957
|
})
|
|
943
958
|
]
|
|
944
959
|
}),
|
|
945
960
|
/* @__PURE__ */ Z(c, {
|
|
946
|
-
open:
|
|
961
|
+
open: Ie !== null,
|
|
947
962
|
onOpenChange: (e) => {
|
|
948
|
-
e ||
|
|
963
|
+
e || Le(null);
|
|
949
964
|
},
|
|
950
|
-
children: /* @__PURE__ */ Q(d, { children: [/* @__PURE__ */ Q(m, { children: [/* @__PURE__ */ Z(h, { children:
|
|
951
|
-
onClick:
|
|
965
|
+
children: /* @__PURE__ */ Q(d, { children: [/* @__PURE__ */ Q(m, { children: [/* @__PURE__ */ Z(h, { children: Y("detail.deleteRowTitle", { defaultValue: "Delete record" }) }), /* @__PURE__ */ Z(f, { children: Y("detail.deleteRowConfirmation") })] }), /* @__PURE__ */ Q(p, { children: [/* @__PURE__ */ Z(u, { children: Y("detail.cancel", { defaultValue: "Cancel" }) }), /* @__PURE__ */ Z(l, {
|
|
966
|
+
onClick: ze,
|
|
952
967
|
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
953
|
-
children:
|
|
968
|
+
children: Y("detail.delete", { defaultValue: "Delete" })
|
|
954
969
|
})] })] })
|
|
955
970
|
}),
|
|
956
|
-
|
|
971
|
+
we && /* @__PURE__ */ Z("div", {
|
|
957
972
|
className: "mx-4 mb-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
|
|
958
973
|
role: "alert",
|
|
959
|
-
children:
|
|
974
|
+
children: we
|
|
960
975
|
}),
|
|
961
|
-
|
|
962
|
-
open:
|
|
963
|
-
onOpenChange: (e) =>
|
|
976
|
+
P && g && /* @__PURE__ */ Z(bt, {
|
|
977
|
+
open: _e,
|
|
978
|
+
onOpenChange: (e) => xe(e),
|
|
964
979
|
multiple: !0,
|
|
965
980
|
dataSource: g,
|
|
966
|
-
objectName:
|
|
967
|
-
title:
|
|
981
|
+
objectName: P.picker.object,
|
|
982
|
+
title: P.label || Y("detail.add", { defaultValue: "Add" }),
|
|
968
983
|
onSelect: () => {},
|
|
969
984
|
onSelectRecords: (e) => {
|
|
970
|
-
|
|
985
|
+
Be(e);
|
|
971
986
|
}
|
|
972
987
|
})
|
|
973
988
|
]
|
|
974
989
|
});
|
|
975
|
-
},
|
|
990
|
+
}, Yt = ({ group: e, data: t, className: n, objectSchema: r, objectName: a, isEditing: o = !1, onFieldChange: s, dataSource: c }) => {
|
|
976
991
|
let l = e.collapsible ?? !0, [u, d] = i.useState(e.defaultCollapsed ?? !1), f = /* @__PURE__ */ Z("div", {
|
|
977
992
|
className: "space-y-3 sm:space-y-4",
|
|
978
|
-
children: e.sections.map((e, n) => /* @__PURE__ */ Z(
|
|
993
|
+
children: e.sections.map((e, n) => /* @__PURE__ */ Z(Gt, {
|
|
979
994
|
section: e,
|
|
980
995
|
data: t,
|
|
981
996
|
objectSchema: r,
|
|
@@ -1017,7 +1032,7 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
1017
1032
|
}) })
|
|
1018
1033
|
]
|
|
1019
1034
|
}) : /* @__PURE__ */ Q("div", {
|
|
1020
|
-
className:
|
|
1035
|
+
className: W("space-y-3", n),
|
|
1021
1036
|
children: [
|
|
1022
1037
|
/* @__PURE__ */ Q("div", {
|
|
1023
1038
|
className: "flex items-center gap-2 pb-2 border-b",
|
|
@@ -1036,18 +1051,18 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
1036
1051
|
f
|
|
1037
1052
|
]
|
|
1038
1053
|
});
|
|
1039
|
-
},
|
|
1040
|
-
let { fieldLabel: a } =
|
|
1054
|
+
}, Xt = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
|
|
1055
|
+
let { fieldLabel: a } = _t();
|
|
1041
1056
|
if (!e.length || !t) return null;
|
|
1042
1057
|
let o = e.filter((e) => {
|
|
1043
1058
|
let n = t?.[e.name];
|
|
1044
1059
|
return n != null && n !== "";
|
|
1045
1060
|
});
|
|
1046
1061
|
return o.length === 0 ? null : /* @__PURE__ */ Z("section", {
|
|
1047
|
-
className:
|
|
1062
|
+
className: W("@container border-b border-border/60 pb-4", n),
|
|
1048
1063
|
"aria-label": "Record highlights",
|
|
1049
1064
|
children: /* @__PURE__ */ Z("div", {
|
|
1050
|
-
className:
|
|
1065
|
+
className: W("flex flex-wrap gap-y-4"),
|
|
1051
1066
|
children: o.map((e) => {
|
|
1052
1067
|
let n = t[e.name], o = i?.fields?.[e.name], s = e.type || o?.type, c = {
|
|
1053
1068
|
name: e.name,
|
|
@@ -1058,11 +1073,11 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
1058
1073
|
...o?.precision !== void 0 && { precision: o.precision },
|
|
1059
1074
|
...o?.scale !== void 0 && { scale: o.scale },
|
|
1060
1075
|
...o?.format && { format: o.format }
|
|
1061
|
-
}, l =
|
|
1076
|
+
}, l = wt(Et(c) || s || "text"), u = s === "number" || s === "integer" || s === "currency" || s === "percent" || s === "decimal", d = s === "email" || s === "url" || s === "textarea" || s === "reference" || s === "lookup" || s === "master_detail", f = s === "boolean";
|
|
1062
1077
|
return /* @__PURE__ */ Q("div", {
|
|
1063
|
-
className:
|
|
1078
|
+
className: W("flex flex-col gap-1 min-w-[7rem] px-5 border-l border-border/60 first:border-l-0 first:pl-0", d ? "basis-[16rem] max-w-[24rem]" : "basis-[9rem] max-w-[16rem]"),
|
|
1064
1079
|
children: [/* @__PURE__ */ Z("span", {
|
|
1065
|
-
className: "text-xs font-medium text-muted-foreground
|
|
1080
|
+
className: "text-xs font-medium text-muted-foreground",
|
|
1066
1081
|
children: a(r || "", e.name, e.label)
|
|
1067
1082
|
}), f ? n ? /* @__PURE__ */ Q("span", {
|
|
1068
1083
|
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",
|
|
@@ -1077,7 +1092,8 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
1077
1092
|
"aria-hidden": !0
|
|
1078
1093
|
}), "No"]
|
|
1079
1094
|
}) : /* @__PURE__ */ Z("span", {
|
|
1080
|
-
|
|
1095
|
+
title: typeof n == "string" ? n : void 0,
|
|
1096
|
+
className: W("block min-w-0 truncate text-sm font-semibold", u && "tabular-nums tracking-tight"),
|
|
1081
1097
|
children: /* @__PURE__ */ Z(l, {
|
|
1082
1098
|
value: n,
|
|
1083
1099
|
field: c
|
|
@@ -1090,7 +1106,7 @@ var qt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
1090
1106
|
};
|
|
1091
1107
|
//#endregion
|
|
1092
1108
|
//#region src/RecordComments.tsx
|
|
1093
|
-
function
|
|
1109
|
+
function Zt(e) {
|
|
1094
1110
|
try {
|
|
1095
1111
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1096
1112
|
if (r < 1) return "just now";
|
|
@@ -1103,7 +1119,7 @@ function Xt(e) {
|
|
|
1103
1119
|
return e;
|
|
1104
1120
|
}
|
|
1105
1121
|
}
|
|
1106
|
-
var
|
|
1122
|
+
var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, className: a }) => {
|
|
1107
1123
|
let { t: o } = $(), [s, c] = i.useState(""), [l, u] = i.useState(!1), [d, f] = i.useState(""), p = i.useCallback(async () => {
|
|
1108
1124
|
let e = s.trim();
|
|
1109
1125
|
if (!(!e || !t)) {
|
|
@@ -1121,11 +1137,11 @@ var Zt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1121
1137
|
return e.text.toLowerCase().includes(t) || e.author.toLowerCase().includes(t);
|
|
1122
1138
|
}) : e].sort((e, t) => e.pinned && !t.pinned ? -1 : !e.pinned && t.pinned ? 1 : 0), [e, d]);
|
|
1123
1139
|
return /* @__PURE__ */ Q(S, {
|
|
1124
|
-
className:
|
|
1140
|
+
className: W("", a),
|
|
1125
1141
|
children: [/* @__PURE__ */ Z(w, { children: /* @__PURE__ */ Q(T, {
|
|
1126
1142
|
className: "flex items-center gap-2 text-base",
|
|
1127
1143
|
children: [
|
|
1128
|
-
/* @__PURE__ */ Z(
|
|
1144
|
+
/* @__PURE__ */ Z(ze, { className: "h-4 w-4" }),
|
|
1129
1145
|
o("detail.comments"),
|
|
1130
1146
|
/* @__PURE__ */ Q("span", {
|
|
1131
1147
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1186,7 +1202,7 @@ var Zt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1186
1202
|
}) : /* @__PURE__ */ Z("div", {
|
|
1187
1203
|
className: "space-y-3",
|
|
1188
1204
|
children: h.map((e) => /* @__PURE__ */ Q("div", {
|
|
1189
|
-
className:
|
|
1205
|
+
className: W("flex gap-3", e.pinned && "bg-muted/40 rounded-md p-2 -mx-2"),
|
|
1190
1206
|
children: [/* @__PURE__ */ Z("div", {
|
|
1191
1207
|
className: "shrink-0",
|
|
1192
1208
|
children: e.avatarUrl ? /* @__PURE__ */ Z("img", {
|
|
@@ -1209,7 +1225,7 @@ var Zt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1209
1225
|
}),
|
|
1210
1226
|
/* @__PURE__ */ Z("span", {
|
|
1211
1227
|
className: "text-xs text-muted-foreground",
|
|
1212
|
-
children:
|
|
1228
|
+
children: Zt(e.createdAt)
|
|
1213
1229
|
}),
|
|
1214
1230
|
e.pinned && /* @__PURE__ */ Q("span", {
|
|
1215
1231
|
className: "text-xs text-amber-600 flex items-center gap-0.5",
|
|
@@ -1235,20 +1251,20 @@ var Zt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1235
1251
|
]
|
|
1236
1252
|
})]
|
|
1237
1253
|
});
|
|
1238
|
-
},
|
|
1254
|
+
}, $t = {
|
|
1239
1255
|
field_change: Ee,
|
|
1240
1256
|
create: qe,
|
|
1241
1257
|
delete: et,
|
|
1242
|
-
comment:
|
|
1258
|
+
comment: ze,
|
|
1243
1259
|
status_change: de
|
|
1244
|
-
},
|
|
1260
|
+
}, en = {
|
|
1245
1261
|
field_change: "bg-blue-100 text-blue-600",
|
|
1246
1262
|
create: "bg-green-100 text-green-600",
|
|
1247
1263
|
delete: "bg-red-100 text-red-600",
|
|
1248
1264
|
comment: "bg-purple-100 text-purple-600",
|
|
1249
1265
|
status_change: "bg-amber-100 text-amber-600"
|
|
1250
1266
|
};
|
|
1251
|
-
function
|
|
1267
|
+
function tn(e) {
|
|
1252
1268
|
try {
|
|
1253
1269
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1254
1270
|
if (r < 1) return "just now";
|
|
@@ -1261,24 +1277,24 @@ function en(e) {
|
|
|
1261
1277
|
return e;
|
|
1262
1278
|
}
|
|
1263
1279
|
}
|
|
1264
|
-
function
|
|
1280
|
+
function nn(e) {
|
|
1265
1281
|
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";
|
|
1266
1282
|
}
|
|
1267
|
-
var
|
|
1283
|
+
var rn = {
|
|
1268
1284
|
all: "All",
|
|
1269
1285
|
field_change: "Field Changes",
|
|
1270
1286
|
create: "Creates",
|
|
1271
1287
|
delete: "Deletes",
|
|
1272
1288
|
comment: "Comments",
|
|
1273
1289
|
status_change: "Status Changes"
|
|
1274
|
-
},
|
|
1290
|
+
}, an = ({ activities: e, filterable: t = !1, defaultFilter: n = "all", className: r }) => {
|
|
1275
1291
|
let [a, o] = i.useState(n), s = i.useMemo(() => a === "all" ? e : e.filter((e) => e.type === a), [e, a]);
|
|
1276
1292
|
return /* @__PURE__ */ Q(S, {
|
|
1277
|
-
className:
|
|
1293
|
+
className: W("", r),
|
|
1278
1294
|
children: [/* @__PURE__ */ Z(w, { children: /* @__PURE__ */ Q(T, {
|
|
1279
1295
|
className: "flex items-center gap-2 text-base",
|
|
1280
1296
|
children: [
|
|
1281
|
-
/* @__PURE__ */ Z(
|
|
1297
|
+
/* @__PURE__ */ Z(G, { className: "h-4 w-4" }),
|
|
1282
1298
|
"Activity",
|
|
1283
1299
|
/* @__PURE__ */ Q("span", {
|
|
1284
1300
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1293,12 +1309,12 @@ var nn = {
|
|
|
1293
1309
|
className: "flex flex-wrap gap-1.5 mb-4",
|
|
1294
1310
|
role: "group",
|
|
1295
1311
|
"aria-label": "Activity type filter",
|
|
1296
|
-
children: Object.keys(
|
|
1312
|
+
children: Object.keys(rn).map((e) => /* @__PURE__ */ Q("button", {
|
|
1297
1313
|
type: "button",
|
|
1298
|
-
className:
|
|
1314
|
+
className: W("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"),
|
|
1299
1315
|
onClick: () => o(e),
|
|
1300
1316
|
"aria-pressed": a === e,
|
|
1301
|
-
children: [e !== "all" && i.createElement(
|
|
1317
|
+
children: [e !== "all" && i.createElement($t[e] || Ee, { className: "h-3 w-3" }), rn[e]]
|
|
1302
1318
|
}, e))
|
|
1303
1319
|
}), s.length === 0 ? /* @__PURE__ */ Z(k, {
|
|
1304
1320
|
title: "No activity recorded",
|
|
@@ -1308,11 +1324,11 @@ var nn = {
|
|
|
1308
1324
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
1309
1325
|
className: "space-y-4",
|
|
1310
1326
|
children: s.map((e) => {
|
|
1311
|
-
let t =
|
|
1327
|
+
let t = $t[e.type] || Ee;
|
|
1312
1328
|
return /* @__PURE__ */ Q("div", {
|
|
1313
1329
|
className: "flex gap-3 relative",
|
|
1314
1330
|
children: [/* @__PURE__ */ Z("div", {
|
|
1315
|
-
className:
|
|
1331
|
+
className: W("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", en[e.type] || "bg-gray-100 text-gray-600"),
|
|
1316
1332
|
children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
|
|
1317
1333
|
}), /* @__PURE__ */ Q("div", {
|
|
1318
1334
|
className: "flex-1 min-w-0 pt-1",
|
|
@@ -1326,12 +1342,12 @@ var nn = {
|
|
|
1326
1342
|
" ",
|
|
1327
1343
|
/* @__PURE__ */ Z("span", {
|
|
1328
1344
|
className: "text-muted-foreground",
|
|
1329
|
-
children:
|
|
1345
|
+
children: nn(e)
|
|
1330
1346
|
})
|
|
1331
1347
|
]
|
|
1332
1348
|
}), /* @__PURE__ */ Z("p", {
|
|
1333
1349
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
1334
|
-
children:
|
|
1350
|
+
children: tn(e.timestamp)
|
|
1335
1351
|
})]
|
|
1336
1352
|
})]
|
|
1337
1353
|
}, e.id);
|
|
@@ -1339,7 +1355,7 @@ var nn = {
|
|
|
1339
1355
|
})]
|
|
1340
1356
|
})] })]
|
|
1341
1357
|
});
|
|
1342
|
-
},
|
|
1358
|
+
}, on = {
|
|
1343
1359
|
create: "default",
|
|
1344
1360
|
update: "secondary",
|
|
1345
1361
|
delete: "destructive",
|
|
@@ -1351,12 +1367,12 @@ var nn = {
|
|
|
1351
1367
|
export: "outline",
|
|
1352
1368
|
import: "outline"
|
|
1353
1369
|
};
|
|
1354
|
-
function
|
|
1370
|
+
function sn(e) {
|
|
1355
1371
|
if (!e) return "";
|
|
1356
1372
|
let t = e instanceof Date ? e : new Date(e);
|
|
1357
1373
|
return Number.isNaN(t.getTime()) ? String(e) : t.toLocaleString();
|
|
1358
1374
|
}
|
|
1359
|
-
var
|
|
1375
|
+
var cn = [
|
|
1360
1376
|
[60, "second"],
|
|
1361
1377
|
[60, "minute"],
|
|
1362
1378
|
[24, "hour"],
|
|
@@ -1365,27 +1381,27 @@ var sn = [
|
|
|
1365
1381
|
[12, "month"],
|
|
1366
1382
|
[Infinity, "year"]
|
|
1367
1383
|
];
|
|
1368
|
-
function
|
|
1384
|
+
function ln(e, t) {
|
|
1369
1385
|
if (!e) return "";
|
|
1370
1386
|
let n = e instanceof Date ? e : new Date(e);
|
|
1371
1387
|
if (Number.isNaN(n.getTime())) return String(e);
|
|
1372
1388
|
let r = (n.getTime() - Date.now()) / 1e3;
|
|
1373
|
-
for (let [n, i] of
|
|
1389
|
+
for (let [n, i] of cn) {
|
|
1374
1390
|
if (Math.abs(r) < n) try {
|
|
1375
1391
|
return new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(Math.round(r), i);
|
|
1376
1392
|
} catch {
|
|
1377
|
-
return
|
|
1393
|
+
return sn(e);
|
|
1378
1394
|
}
|
|
1379
1395
|
r /= n;
|
|
1380
1396
|
}
|
|
1381
|
-
return
|
|
1397
|
+
return sn(e);
|
|
1382
1398
|
}
|
|
1383
|
-
function
|
|
1399
|
+
function un(e) {
|
|
1384
1400
|
if (!e) return "?";
|
|
1385
1401
|
let t = e.trim().split(/\s+/).filter(Boolean).slice(0, 2);
|
|
1386
1402
|
return t.length === 0 ? "?" : t.map((e) => e.charAt(0).toUpperCase()).join("");
|
|
1387
1403
|
}
|
|
1388
|
-
function
|
|
1404
|
+
function dn(e) {
|
|
1389
1405
|
if (e == null || e === "") return "—";
|
|
1390
1406
|
if (typeof e == "string") return e;
|
|
1391
1407
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -1395,25 +1411,25 @@ function un(e) {
|
|
|
1395
1411
|
return String(e);
|
|
1396
1412
|
}
|
|
1397
1413
|
}
|
|
1398
|
-
function
|
|
1414
|
+
function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
1399
1415
|
return t ? /* @__PURE__ */ Z("div", {
|
|
1400
|
-
className:
|
|
1416
|
+
className: W("space-y-3", r),
|
|
1401
1417
|
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ Q("div", {
|
|
1402
1418
|
className: "flex items-start gap-3",
|
|
1403
|
-
children: [/* @__PURE__ */ Z(
|
|
1419
|
+
children: [/* @__PURE__ */ Z(F, { className: "h-8 w-8 rounded-full" }), /* @__PURE__ */ Q("div", {
|
|
1404
1420
|
className: "flex-1 space-y-2",
|
|
1405
|
-
children: [/* @__PURE__ */ Z(
|
|
1421
|
+
children: [/* @__PURE__ */ Z(F, { className: "h-4 w-1/3" }), /* @__PURE__ */ Z(F, { className: "h-3 w-1/2" })]
|
|
1406
1422
|
})]
|
|
1407
1423
|
}, t))
|
|
1408
1424
|
}) : !e || e.length === 0 ? /* @__PURE__ */ Z("div", {
|
|
1409
|
-
className:
|
|
1425
|
+
className: W("flex items-center justify-center rounded-md border border-dashed py-10 text-sm text-muted-foreground", r),
|
|
1410
1426
|
children: n ?? "No history yet"
|
|
1411
|
-
}) : /* @__PURE__ */ Z(
|
|
1427
|
+
}) : /* @__PURE__ */ Z(oe, {
|
|
1412
1428
|
delayDuration: 150,
|
|
1413
1429
|
children: /* @__PURE__ */ Z("ol", {
|
|
1414
|
-
className:
|
|
1430
|
+
className: W("space-y-4", r),
|
|
1415
1431
|
children: e.map((e, t) => {
|
|
1416
|
-
let n = (e.action ?? "").toLowerCase(), r =
|
|
1432
|
+
let n = (e.action ?? "").toLowerCase(), r = on[n] ?? "outline", a = typeof e.user_name == "string" && e.user_name.trim() || "Unknown user", o = sn(e.created_at), s = ln(e.created_at, i), c = typeof e.user_avatar == "string" ? e.user_avatar : void 0;
|
|
1417
1433
|
return /* @__PURE__ */ Q("li", {
|
|
1418
1434
|
className: "flex items-start gap-3",
|
|
1419
1435
|
children: [/* @__PURE__ */ Q(_, {
|
|
@@ -1423,7 +1439,7 @@ function dn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1423
1439
|
alt: a
|
|
1424
1440
|
}) : null, /* @__PURE__ */ Z(v, {
|
|
1425
1441
|
className: "text-[10px] font-medium",
|
|
1426
|
-
children:
|
|
1442
|
+
children: un(e.user_name)
|
|
1427
1443
|
})]
|
|
1428
1444
|
}), /* @__PURE__ */ Q("div", {
|
|
1429
1445
|
className: "min-w-0 flex-1",
|
|
@@ -1440,14 +1456,14 @@ function dn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1440
1456
|
className: "text-[10px] uppercase tracking-wide",
|
|
1441
1457
|
children: e.action
|
|
1442
1458
|
}),
|
|
1443
|
-
o && /* @__PURE__ */ Q(
|
|
1459
|
+
o && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
1444
1460
|
asChild: !0,
|
|
1445
1461
|
children: /* @__PURE__ */ Z("span", {
|
|
1446
1462
|
className: "text-xs text-muted-foreground cursor-help",
|
|
1447
1463
|
"aria-label": o,
|
|
1448
1464
|
children: s || o
|
|
1449
1465
|
})
|
|
1450
|
-
}), /* @__PURE__ */ Z(
|
|
1466
|
+
}), /* @__PURE__ */ Z(V, { children: o })] })
|
|
1451
1467
|
]
|
|
1452
1468
|
}),
|
|
1453
1469
|
e.summary && /* @__PURE__ */ Z("p", {
|
|
@@ -1474,7 +1490,7 @@ function dn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1474
1490
|
": ",
|
|
1475
1491
|
/* @__PURE__ */ Z("span", {
|
|
1476
1492
|
className: "text-foreground",
|
|
1477
|
-
children:
|
|
1493
|
+
children: dn(e.to)
|
|
1478
1494
|
})
|
|
1479
1495
|
]
|
|
1480
1496
|
}, e.field))
|
|
@@ -1491,12 +1507,12 @@ function dn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1491
1507
|
": ",
|
|
1492
1508
|
/* @__PURE__ */ Z("span", {
|
|
1493
1509
|
className: "line-through opacity-70",
|
|
1494
|
-
children:
|
|
1510
|
+
children: dn(e.from)
|
|
1495
1511
|
}),
|
|
1496
1512
|
" → ",
|
|
1497
1513
|
/* @__PURE__ */ Z("span", {
|
|
1498
1514
|
className: "text-foreground",
|
|
1499
|
-
children:
|
|
1515
|
+
children: dn(e.to)
|
|
1500
1516
|
})
|
|
1501
1517
|
]
|
|
1502
1518
|
}, e.field))
|
|
@@ -1510,13 +1526,13 @@ function dn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1510
1526
|
}
|
|
1511
1527
|
//#endregion
|
|
1512
1528
|
//#region src/RecordMetaFooter.tsx
|
|
1513
|
-
var
|
|
1529
|
+
var pn = {
|
|
1514
1530
|
createdAt: "created_at",
|
|
1515
1531
|
createdBy: "created_by",
|
|
1516
1532
|
updatedAt: "updated_at",
|
|
1517
1533
|
updatedBy: "updated_by"
|
|
1518
1534
|
};
|
|
1519
|
-
function
|
|
1535
|
+
function mn(e) {
|
|
1520
1536
|
if (!e) return null;
|
|
1521
1537
|
if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
|
|
1522
1538
|
if (typeof e == "string" || typeof e == "number") {
|
|
@@ -1525,7 +1541,7 @@ function pn(e) {
|
|
|
1525
1541
|
}
|
|
1526
1542
|
return null;
|
|
1527
1543
|
}
|
|
1528
|
-
function
|
|
1544
|
+
function hn(e, t) {
|
|
1529
1545
|
let n = Date.now() - e.getTime(), r = Math.max(0, Math.floor(n / 1e3));
|
|
1530
1546
|
if (r < 60) return t("detail.justNow");
|
|
1531
1547
|
let i = Math.floor(r / 60);
|
|
@@ -1533,7 +1549,7 @@ function mn(e, t) {
|
|
|
1533
1549
|
let a = Math.floor(i / 60);
|
|
1534
1550
|
return a < 24 ? t("detail.hoursAgo", { count: a }) : t("detail.daysAgo", { count: Math.floor(a / 24) });
|
|
1535
1551
|
}
|
|
1536
|
-
function
|
|
1552
|
+
function gn(e) {
|
|
1537
1553
|
try {
|
|
1538
1554
|
return new Intl.DateTimeFormat(void 0, {
|
|
1539
1555
|
dateStyle: "medium",
|
|
@@ -1543,16 +1559,16 @@ function hn(e) {
|
|
|
1543
1559
|
return e.toISOString();
|
|
1544
1560
|
}
|
|
1545
1561
|
}
|
|
1546
|
-
var
|
|
1562
|
+
var _n = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
1547
1563
|
if (e == null || e === "") return null;
|
|
1548
1564
|
let r = t?.fields?.[n], i = r?.reference_to || r?.reference, a = {
|
|
1549
1565
|
name: n,
|
|
1550
1566
|
type: r?.type || (i ? "lookup" : "text"),
|
|
1551
1567
|
...i && { reference_to: i },
|
|
1552
1568
|
...r?.reference_field && { reference_field: r.reference_field }
|
|
1553
|
-
}, o =
|
|
1569
|
+
}, o = Et(a) || a.type;
|
|
1554
1570
|
if (o) {
|
|
1555
|
-
let t =
|
|
1571
|
+
let t = wt(o);
|
|
1556
1572
|
if (t) return /* @__PURE__ */ Z("span", {
|
|
1557
1573
|
className: "inline-flex items-center [&_a]:text-inherit [&_a]:hover:underline",
|
|
1558
1574
|
children: /* @__PURE__ */ Z(t, {
|
|
@@ -1562,20 +1578,20 @@ var gn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1562
1578
|
});
|
|
1563
1579
|
}
|
|
1564
1580
|
return /* @__PURE__ */ Z("span", { children: String(e) });
|
|
1565
|
-
},
|
|
1581
|
+
}, vn = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
|
|
1566
1582
|
if (!t && !n) return null;
|
|
1567
|
-
let o = n ? /* @__PURE__ */ Z(
|
|
1583
|
+
let o = n ? /* @__PURE__ */ Z(oe, {
|
|
1568
1584
|
delayDuration: 200,
|
|
1569
|
-
children: /* @__PURE__ */ Q(
|
|
1585
|
+
children: /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
1570
1586
|
asChild: !0,
|
|
1571
1587
|
children: /* @__PURE__ */ Z("time", {
|
|
1572
1588
|
dateTime: n.toISOString(),
|
|
1573
1589
|
className: "cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2",
|
|
1574
|
-
children:
|
|
1590
|
+
children: hn(n, a)
|
|
1575
1591
|
})
|
|
1576
|
-
}), /* @__PURE__ */ Z(
|
|
1592
|
+
}), /* @__PURE__ */ Z(V, {
|
|
1577
1593
|
side: "top",
|
|
1578
|
-
children:
|
|
1594
|
+
children: gn(n)
|
|
1579
1595
|
})] })
|
|
1580
1596
|
}) : null;
|
|
1581
1597
|
return /* @__PURE__ */ Q("span", {
|
|
@@ -1585,7 +1601,7 @@ var gn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1585
1601
|
className: "text-muted-foreground/70",
|
|
1586
1602
|
children: e
|
|
1587
1603
|
}),
|
|
1588
|
-
t ? /* @__PURE__ */ Z(
|
|
1604
|
+
t ? /* @__PURE__ */ Z(_n, {
|
|
1589
1605
|
value: t,
|
|
1590
1606
|
objectSchema: r,
|
|
1591
1607
|
fieldName: i
|
|
@@ -1597,31 +1613,31 @@ var gn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1597
1613
|
o
|
|
1598
1614
|
]
|
|
1599
1615
|
});
|
|
1600
|
-
},
|
|
1616
|
+
}, yn = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
|
|
1601
1617
|
let { t: i } = $();
|
|
1602
1618
|
if (!e) return null;
|
|
1603
|
-
let a =
|
|
1619
|
+
let a = mn(e[pn.createdAt]), o = mn(e[pn.updatedAt]), s = e[pn.createdBy], c = e[pn.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));
|
|
1604
1620
|
return !l && !d ? null : /* @__PURE__ */ Q("div", {
|
|
1605
|
-
className:
|
|
1621
|
+
className: W("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),
|
|
1606
1622
|
"data-testid": "record-meta-footer",
|
|
1607
|
-
children: [l && /* @__PURE__ */ Z(
|
|
1623
|
+
children: [l && /* @__PURE__ */ Z(vn, {
|
|
1608
1624
|
label: i("detail.createdBy"),
|
|
1609
1625
|
user: s,
|
|
1610
1626
|
date: a,
|
|
1611
1627
|
objectSchema: t,
|
|
1612
|
-
userField:
|
|
1628
|
+
userField: pn.createdBy,
|
|
1613
1629
|
t: i
|
|
1614
|
-
}), d && /* @__PURE__ */ Z(
|
|
1630
|
+
}), d && /* @__PURE__ */ Z(vn, {
|
|
1615
1631
|
label: i("detail.updatedBy"),
|
|
1616
1632
|
user: c,
|
|
1617
1633
|
date: o,
|
|
1618
1634
|
objectSchema: t,
|
|
1619
|
-
userField:
|
|
1635
|
+
userField: pn.updatedBy,
|
|
1620
1636
|
t: i
|
|
1621
1637
|
})]
|
|
1622
1638
|
});
|
|
1623
|
-
},
|
|
1624
|
-
function
|
|
1639
|
+
}, bn = 5;
|
|
1640
|
+
function xn(e, t, i, a) {
|
|
1625
1641
|
if (e && typeof e == "object") {
|
|
1626
1642
|
if (t.primaryField) {
|
|
1627
1643
|
let n = e[t.primaryField];
|
|
@@ -1641,10 +1657,10 @@ function bn(e, t, i, a) {
|
|
|
1641
1657
|
}
|
|
1642
1658
|
return a;
|
|
1643
1659
|
}
|
|
1644
|
-
var
|
|
1645
|
-
let [g, _] = i.useState(e.data), [v, y] = i.useState(!e.data && !!(e.api && e.resourceId || n && e.objectName && e.resourceId)), [S, C] = i.useState(!1), w = m ?? S, [T, E] = i.useState(!1), [D, O] = i.useState({}), [k, A] = i.useState(!1), [j, M] = i.useState(null), [N,
|
|
1646
|
-
if (!
|
|
1647
|
-
let t = (t) =>
|
|
1660
|
+
var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBack: s, inlineEdit: c = !1, onFieldSave: l, discussionSlot: u, rightRail: d, objectLabel: f, onDataLoaded: p, isFavorite: m, onToggleFavorite: h }) => {
|
|
1661
|
+
let [g, _] = i.useState(e.data), [v, y] = i.useState(!e.data && !!(e.api && e.resourceId || n && e.objectName && e.resourceId)), [S, C] = i.useState(!1), w = m ?? S, [T, E] = i.useState(!1), [D, O] = i.useState({}), [k, A] = i.useState(!1), [j, M] = i.useState(null), [N, P] = i.useState(null), [ee, te] = i.useState(!1), [ne, re] = i.useState(0), ie = lt(e.objectName || void 0, e.resourceId == null ? void 0 : String(e.resourceId)), [ae, U] = i.useState(!1), { t: G } = $(), { currency: ce } = jt(), { fieldOptionLabel: ue } = _t(), de = se(), fe = kt(), K = i.useMemo(() => {
|
|
1662
|
+
if (!fe?.isLoaded || !e.objectName) return e;
|
|
1663
|
+
let t = (t) => fe.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
|
|
1648
1664
|
let n = typeof e == "string" ? e : e?.name;
|
|
1649
1665
|
return !n || t(n);
|
|
1650
1666
|
});
|
|
@@ -1657,11 +1673,11 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1657
1673
|
})),
|
|
1658
1674
|
summaryFields: n(e.summaryFields)
|
|
1659
1675
|
};
|
|
1660
|
-
}, [e,
|
|
1676
|
+
}, [e, fe]);
|
|
1661
1677
|
i.useEffect(() => {
|
|
1662
1678
|
g && p && p(g);
|
|
1663
1679
|
}, [g, p]);
|
|
1664
|
-
let
|
|
1680
|
+
let pe = i.useMemo(() => {
|
|
1665
1681
|
if (K.summaryFields && K.summaryFields.length > 0) return [];
|
|
1666
1682
|
let e = [...K.sections?.flatMap((e) => e.fields) || [], ...K.fields || []], t = {};
|
|
1667
1683
|
for (let n of e) t[n.name] || (t[n.name] = n);
|
|
@@ -1687,24 +1703,24 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1687
1703
|
K.fields,
|
|
1688
1704
|
N,
|
|
1689
1705
|
g
|
|
1690
|
-
]),
|
|
1706
|
+
]), q = K.summaryFields && K.summaryFields.length > 0 ? K.summaryFields : pe, me = i.useCallback(() => {
|
|
1691
1707
|
K.resourceId && navigator.clipboard.writeText(String(K.resourceId)).then(() => {
|
|
1692
|
-
|
|
1708
|
+
te(!0), setTimeout(() => te(!1), 1500);
|
|
1693
1709
|
});
|
|
1694
1710
|
}, [K.resourceId]);
|
|
1695
1711
|
i.useEffect(() => {
|
|
1696
1712
|
let e = !0;
|
|
1697
1713
|
if (K.data) return _(K.data), y(!1), n?.getObjectSchema && K.objectName && n.getObjectSchema(K.objectName).then((t) => {
|
|
1698
|
-
e &&
|
|
1714
|
+
e && P(t);
|
|
1699
1715
|
}).catch(() => {}), () => {
|
|
1700
1716
|
e = !1;
|
|
1701
1717
|
};
|
|
1702
1718
|
if (n && K.objectName && K.resourceId) {
|
|
1703
|
-
y(!0),
|
|
1719
|
+
y(!0), P(null), _(null);
|
|
1704
1720
|
let r = K.objectName, i = K.resourceId, a = `${r}-`, o = [...K.sections?.flatMap((e) => e.fields) || [], ...K.fields || []];
|
|
1705
1721
|
(n.getObjectSchema ? n.getObjectSchema(r).catch(() => null) : Promise.resolve(null)).then((s) => {
|
|
1706
1722
|
if (!e) return;
|
|
1707
|
-
|
|
1723
|
+
P(s);
|
|
1708
1724
|
let c = t(s?.fields, o), l = c.length > 0 ? { $expand: c } : void 0, u = l ? n.findOne(r, i, l) : n.findOne(r, i), d = () => {
|
|
1709
1725
|
let t = String(i), o = t.startsWith(a) ? t.slice(a.length) : `${a}${t}`;
|
|
1710
1726
|
return (l ? n.findOne(r, o, l) : n.findOne(r, o)).then((t) => {
|
|
@@ -1742,28 +1758,29 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1742
1758
|
n,
|
|
1743
1759
|
K.sections,
|
|
1744
1760
|
K.fields,
|
|
1745
|
-
|
|
1761
|
+
ne,
|
|
1762
|
+
ie
|
|
1746
1763
|
]);
|
|
1747
|
-
let
|
|
1764
|
+
let he = i.useCallback(() => {
|
|
1748
1765
|
if (s) s();
|
|
1749
1766
|
else if (K.onNavigate) {
|
|
1750
1767
|
let e = K.backUrl || (K.objectName ? `/${K.objectName}` : "/");
|
|
1751
1768
|
K.onNavigate(e, { replace: !0 });
|
|
1752
1769
|
} else K.backUrl ? window.location.href = K.backUrl : window.history.back();
|
|
1753
|
-
}, [s, K]),
|
|
1770
|
+
}, [s, K]), _e = i.useCallback(() => {
|
|
1754
1771
|
a ? a() : K.onNavigate && K.editUrl ? K.onNavigate(K.editUrl) : K.onNavigate && K.objectName && K.resourceId ? K.onNavigate(`/${K.objectName}/${K.resourceId}/edit`) : K.editUrl && (window.location.href = K.editUrl);
|
|
1755
|
-
}, [a, K]),
|
|
1772
|
+
}, [a, K]), ve = i.useCallback(async () => {
|
|
1756
1773
|
if (!n?.cancelPendingApproval || !K.objectName || !K.resourceId) {
|
|
1757
|
-
M(
|
|
1774
|
+
M(G("detail.cancelApprovalUnavailable"));
|
|
1758
1775
|
return;
|
|
1759
1776
|
}
|
|
1760
|
-
|
|
1777
|
+
U(!0), M(null);
|
|
1761
1778
|
try {
|
|
1762
1779
|
if (await n.cancelPendingApproval(String(K.objectName), String(K.resourceId)), n.findOne) try {
|
|
1763
1780
|
let e = await n.findOne(String(K.objectName), String(K.resourceId));
|
|
1764
1781
|
e && _(e);
|
|
1765
1782
|
} catch {}
|
|
1766
|
-
|
|
1783
|
+
re((e) => e + 1);
|
|
1767
1784
|
try {
|
|
1768
1785
|
window.dispatchEvent(new CustomEvent("objectui:record-changed", { detail: {
|
|
1769
1786
|
objectName: String(K.objectName),
|
|
@@ -1773,34 +1790,34 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1773
1790
|
} catch {}
|
|
1774
1791
|
} catch (e) {
|
|
1775
1792
|
let t = (e?.message || e?.error || String(e ?? "Cancel failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
|
|
1776
|
-
M(`${
|
|
1793
|
+
M(`${G("detail.cancelApprovalFailed")}: ${t}`);
|
|
1777
1794
|
} finally {
|
|
1778
|
-
|
|
1795
|
+
U(!1);
|
|
1779
1796
|
}
|
|
1780
1797
|
}, [
|
|
1781
1798
|
n,
|
|
1782
1799
|
K.objectName,
|
|
1783
1800
|
K.resourceId,
|
|
1784
|
-
|
|
1785
|
-
]),
|
|
1786
|
-
let e = K.deleteConfirmation ||
|
|
1801
|
+
G
|
|
1802
|
+
]), xe = i.useCallback(() => {
|
|
1803
|
+
let e = K.deleteConfirmation || G("detail.deleteConfirmation");
|
|
1787
1804
|
window.confirm(e) && (o?.(), K.onNavigate && K.objectName && K.onNavigate(`/${K.objectName}`, { replace: !0 }));
|
|
1788
|
-
}, [o, K]),
|
|
1805
|
+
}, [o, K]), Se = i.useCallback(() => {
|
|
1789
1806
|
navigator.share && K.objectName && K.resourceId ? navigator.share({
|
|
1790
|
-
title: K.title ||
|
|
1807
|
+
title: K.title || G("detail.details"),
|
|
1791
1808
|
text: `${K.objectName} #${K.resourceId}`,
|
|
1792
1809
|
url: window.location.href
|
|
1793
1810
|
}).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
|
|
1794
1811
|
console.log("Link copied to clipboard");
|
|
1795
1812
|
});
|
|
1796
|
-
}, [K]),
|
|
1813
|
+
}, [K]), Ce = i.useCallback(() => {
|
|
1797
1814
|
let e = !w;
|
|
1798
1815
|
h && h(e), m === void 0 && C(e);
|
|
1799
1816
|
}, [
|
|
1800
1817
|
w,
|
|
1801
1818
|
m,
|
|
1802
1819
|
h
|
|
1803
|
-
]),
|
|
1820
|
+
]), we = i.useCallback(async () => {
|
|
1804
1821
|
if (T) {
|
|
1805
1822
|
let e = Object.entries(D);
|
|
1806
1823
|
if (e.length > 0) {
|
|
@@ -1813,7 +1830,9 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1813
1830
|
if (l) for (let [t, r] of e) await l(t, r, n);
|
|
1814
1831
|
O({}), E(!1);
|
|
1815
1832
|
} catch (e) {
|
|
1816
|
-
_(t)
|
|
1833
|
+
_(t);
|
|
1834
|
+
let n = (e?.message || e?.error || String(e ?? "Save failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
|
|
1835
|
+
M(n);
|
|
1817
1836
|
} finally {
|
|
1818
1837
|
A(!1);
|
|
1819
1838
|
}
|
|
@@ -1827,9 +1846,9 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1827
1846
|
D,
|
|
1828
1847
|
g,
|
|
1829
1848
|
l
|
|
1830
|
-
]),
|
|
1849
|
+
]), De = i.useCallback(() => {
|
|
1831
1850
|
O({}), E(!1), M(null);
|
|
1832
|
-
}, []),
|
|
1851
|
+
}, []), J = i.useCallback((e, t) => {
|
|
1833
1852
|
O((n) => ({
|
|
1834
1853
|
...n,
|
|
1835
1854
|
[e]: t
|
|
@@ -1846,7 +1865,7 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1846
1865
|
if (!c || K.showHeader !== !1) return;
|
|
1847
1866
|
let e = "objectui:record:inline-edit-toggle", t = (e) => {
|
|
1848
1867
|
let t = e.detail;
|
|
1849
|
-
t?.recordId && K.recordId && t.recordId !== K.recordId || t?.objectName && K.objectName && t.objectName !== K.objectName ||
|
|
1868
|
+
t?.recordId && K.recordId && t.recordId !== K.recordId || t?.objectName && K.objectName && t.objectName !== K.objectName || we();
|
|
1850
1869
|
};
|
|
1851
1870
|
return window.addEventListener(e, t), () => window.removeEventListener(e, t);
|
|
1852
1871
|
}, [
|
|
@@ -1854,52 +1873,52 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1854
1873
|
K.showHeader,
|
|
1855
1874
|
K.recordId,
|
|
1856
1875
|
K.objectName,
|
|
1857
|
-
|
|
1876
|
+
we
|
|
1858
1877
|
]);
|
|
1859
|
-
let Oe = i.useMemo(() => K.related ?? [], [K.related]),
|
|
1878
|
+
let Oe = i.useMemo(() => K.related ?? [], [K.related]), ke = i.useMemo(() => {
|
|
1860
1879
|
let e = [];
|
|
1861
1880
|
return e.push({
|
|
1862
1881
|
name: "sys_share",
|
|
1863
|
-
label:
|
|
1882
|
+
label: G("detail.share"),
|
|
1864
1883
|
icon: "share-2",
|
|
1865
1884
|
type: "script",
|
|
1866
|
-
onClick:
|
|
1885
|
+
onClick: Se
|
|
1867
1886
|
}), K.showEdit && e.push({
|
|
1868
1887
|
name: "sys_edit_mobile",
|
|
1869
|
-
label:
|
|
1888
|
+
label: G("detail.edit"),
|
|
1870
1889
|
icon: "edit",
|
|
1871
1890
|
type: "script",
|
|
1872
1891
|
className: "sm:hidden",
|
|
1873
|
-
onClick:
|
|
1892
|
+
onClick: _e
|
|
1874
1893
|
}), c && e.push({
|
|
1875
1894
|
name: "sys_toggle_inline_edit_mobile",
|
|
1876
|
-
label:
|
|
1895
|
+
label: G(T ? "detail.save" : "detail.editInline"),
|
|
1877
1896
|
icon: "edit",
|
|
1878
1897
|
type: "script",
|
|
1879
1898
|
className: "sm:hidden",
|
|
1880
|
-
onClick:
|
|
1899
|
+
onClick: we
|
|
1881
1900
|
}), K.showDelete && e.push({
|
|
1882
1901
|
name: "sys_delete",
|
|
1883
|
-
label:
|
|
1902
|
+
label: G("detail.delete"),
|
|
1884
1903
|
icon: "trash-2",
|
|
1885
1904
|
type: "script",
|
|
1886
1905
|
variant: "destructive",
|
|
1887
1906
|
tags: ["separator-before"],
|
|
1888
|
-
onClick:
|
|
1907
|
+
onClick: xe
|
|
1889
1908
|
}), e;
|
|
1890
1909
|
}, [
|
|
1891
|
-
|
|
1910
|
+
G,
|
|
1892
1911
|
K.showEdit,
|
|
1893
1912
|
K.showDelete,
|
|
1894
1913
|
c,
|
|
1895
1914
|
T,
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
]),
|
|
1915
|
+
Se,
|
|
1916
|
+
_e,
|
|
1917
|
+
we,
|
|
1918
|
+
xe
|
|
1919
|
+
]), Y = i.useMemo(() => {
|
|
1901
1920
|
let e = K.actions ?? [];
|
|
1902
|
-
if (
|
|
1921
|
+
if (ke.length === 0) return e;
|
|
1903
1922
|
let t = !1, n = e.map((e) => {
|
|
1904
1923
|
let n = e;
|
|
1905
1924
|
if (n && typeof n == "object" && n.type === "action:bar" && (!n.location || n.location === "record_header")) {
|
|
@@ -1907,7 +1926,7 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1907
1926
|
let e = Array.isArray(n.systemActions) ? n.systemActions : [];
|
|
1908
1927
|
return {
|
|
1909
1928
|
...n,
|
|
1910
|
-
systemActions: [...e, ...
|
|
1929
|
+
systemActions: [...e, ...ke]
|
|
1911
1930
|
};
|
|
1912
1931
|
}
|
|
1913
1932
|
return e;
|
|
@@ -1915,61 +1934,61 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1915
1934
|
return t || n.push({
|
|
1916
1935
|
type: "action:bar",
|
|
1917
1936
|
location: "record_header",
|
|
1918
|
-
systemActions:
|
|
1937
|
+
systemActions: ke
|
|
1919
1938
|
}), n;
|
|
1920
|
-
}, [K.actions,
|
|
1939
|
+
}, [K.actions, ke]);
|
|
1921
1940
|
return v || K.loading ? /* @__PURE__ */ Q("div", {
|
|
1922
|
-
className:
|
|
1941
|
+
className: W("space-y-4", r),
|
|
1923
1942
|
children: [
|
|
1924
|
-
/* @__PURE__ */ Z(
|
|
1925
|
-
/* @__PURE__ */ Z(
|
|
1926
|
-
/* @__PURE__ */ Z(
|
|
1943
|
+
/* @__PURE__ */ Z(F, { className: "h-10 w-full" }),
|
|
1944
|
+
/* @__PURE__ */ Z(F, { className: "h-64 w-full" }),
|
|
1945
|
+
/* @__PURE__ */ Z(F, { className: "h-48 w-full" })
|
|
1927
1946
|
]
|
|
1928
1947
|
}) : !g && !K.data ? /* @__PURE__ */ Q("div", {
|
|
1929
|
-
className:
|
|
1948
|
+
className: W("flex flex-col items-center justify-center py-16 text-center", r),
|
|
1930
1949
|
children: [
|
|
1931
1950
|
/* @__PURE__ */ Z("p", {
|
|
1932
1951
|
className: "text-lg font-semibold",
|
|
1933
|
-
children:
|
|
1952
|
+
children: G("detail.recordNotFound")
|
|
1934
1953
|
}),
|
|
1935
1954
|
/* @__PURE__ */ Z("p", {
|
|
1936
1955
|
className: "text-sm text-muted-foreground mt-1",
|
|
1937
|
-
children:
|
|
1956
|
+
children: G("detail.recordNotFoundDescription")
|
|
1938
1957
|
}),
|
|
1939
1958
|
(K.showBack ?? !0) && /* @__PURE__ */ Q(x, {
|
|
1940
1959
|
variant: "outline",
|
|
1941
1960
|
size: "sm",
|
|
1942
|
-
onClick:
|
|
1961
|
+
onClick: he,
|
|
1943
1962
|
className: "mt-4 gap-2",
|
|
1944
|
-
children: [/* @__PURE__ */ Z(le, { className: "h-4 w-4" }),
|
|
1963
|
+
children: [/* @__PURE__ */ Z(le, { className: "h-4 w-4" }), G("detail.goBack")]
|
|
1945
1964
|
})
|
|
1946
1965
|
]
|
|
1947
|
-
}) : /* @__PURE__ */ Z(
|
|
1948
|
-
className:
|
|
1966
|
+
}) : /* @__PURE__ */ Z(oe, { children: /* @__PURE__ */ Q("div", {
|
|
1967
|
+
className: W("space-y-6", r),
|
|
1949
1968
|
children: [
|
|
1950
1969
|
K.showHeader !== !1 && /* @__PURE__ */ Q("div", {
|
|
1951
1970
|
className: "flex flex-col sm:flex-row items-start justify-between gap-3 sm:gap-4 pb-4 border-b",
|
|
1952
1971
|
children: [/* @__PURE__ */ Q("div", {
|
|
1953
1972
|
className: "flex items-start gap-2 sm:gap-3 flex-1 min-w-0",
|
|
1954
|
-
children: [(K.showBack ?? !0) && /* @__PURE__ */ Q(
|
|
1973
|
+
children: [(K.showBack ?? !0) && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
1955
1974
|
asChild: !0,
|
|
1956
1975
|
children: /* @__PURE__ */ Z(x, {
|
|
1957
1976
|
variant: "ghost",
|
|
1958
1977
|
size: "icon",
|
|
1959
|
-
onClick:
|
|
1978
|
+
onClick: he,
|
|
1960
1979
|
className: "shrink-0 mt-1",
|
|
1961
1980
|
children: /* @__PURE__ */ Z(le, { className: "h-4 w-4" })
|
|
1962
1981
|
})
|
|
1963
|
-
}), /* @__PURE__ */ Z(
|
|
1982
|
+
}), /* @__PURE__ */ Z(V, { children: G("detail.back") })] }), /* @__PURE__ */ Q("div", {
|
|
1964
1983
|
className: "flex-1 min-w-0",
|
|
1965
1984
|
children: [/* @__PURE__ */ Q("div", {
|
|
1966
1985
|
className: "flex items-center gap-2 flex-wrap",
|
|
1967
1986
|
children: [
|
|
1968
1987
|
/* @__PURE__ */ Z("h1", {
|
|
1969
1988
|
className: "text-xl sm:text-2xl font-bold truncate",
|
|
1970
|
-
children:
|
|
1989
|
+
children: xn(g, K, N, G("detail.details"))
|
|
1971
1990
|
}),
|
|
1972
|
-
|
|
1991
|
+
q.map((e) => {
|
|
1973
1992
|
let t = g?.[e];
|
|
1974
1993
|
if (t == null || t === "") return null;
|
|
1975
1994
|
let n = (K.sections || []).flatMap((e) => e.fields).concat(K.fields || []).find((t) => t.name === e), r = N?.fields?.[e], i = n?.type || r?.type, a = String(t), o = null;
|
|
@@ -1977,10 +1996,10 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1977
1996
|
if (i === "currency") {
|
|
1978
1997
|
let e = Number(t);
|
|
1979
1998
|
if (!Number.isNaN(e)) {
|
|
1980
|
-
let t =
|
|
1999
|
+
let t = At({
|
|
1981
2000
|
...r,
|
|
1982
2001
|
...n
|
|
1983
|
-
},
|
|
2002
|
+
}, ce);
|
|
1984
2003
|
a = t ? new Intl.NumberFormat(void 0, {
|
|
1985
2004
|
style: "currency",
|
|
1986
2005
|
currency: t,
|
|
@@ -2009,7 +2028,7 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2009
2028
|
let e = i[String(t)];
|
|
2010
2029
|
e?.label && (o = e.label);
|
|
2011
2030
|
}
|
|
2012
|
-
a = K.objectName ?
|
|
2031
|
+
a = K.objectName ? ue(K.objectName, e, String(t), o) : o;
|
|
2013
2032
|
}
|
|
2014
2033
|
} catch {}
|
|
2015
2034
|
return o === null ? /* @__PURE__ */ Z(b, {
|
|
@@ -2031,34 +2050,34 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2031
2050
|
}), a]
|
|
2032
2051
|
}, e);
|
|
2033
2052
|
}),
|
|
2034
|
-
/* @__PURE__ */ Q(
|
|
2053
|
+
/* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2035
2054
|
asChild: !0,
|
|
2036
2055
|
children: /* @__PURE__ */ Z(x, {
|
|
2037
2056
|
variant: "ghost",
|
|
2038
2057
|
size: "icon",
|
|
2039
2058
|
className: "h-6 w-6 shrink-0",
|
|
2040
|
-
onClick:
|
|
2041
|
-
"aria-label":
|
|
2059
|
+
onClick: Ce,
|
|
2060
|
+
"aria-label": G(w ? "detail.removeFromFavorites" : "detail.addToFavorites"),
|
|
2042
2061
|
children: w ? /* @__PURE__ */ Z($e, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z($e, { className: "h-4 w-4 text-muted-foreground" })
|
|
2043
2062
|
})
|
|
2044
|
-
}), /* @__PURE__ */ Z(
|
|
2063
|
+
}), /* @__PURE__ */ Z(V, { children: G(w ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
|
|
2045
2064
|
]
|
|
2046
2065
|
}), K.objectName && /* @__PURE__ */ Q("p", {
|
|
2047
2066
|
className: "text-sm text-muted-foreground mt-1 flex items-center gap-1",
|
|
2048
2067
|
children: [/* @__PURE__ */ Z("span", {
|
|
2049
2068
|
className: "font-medium",
|
|
2050
2069
|
children: f || K.objectName
|
|
2051
|
-
}), K.resourceId && /* @__PURE__ */ Q(
|
|
2070
|
+
}), K.resourceId && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2052
2071
|
asChild: !0,
|
|
2053
2072
|
children: /* @__PURE__ */ Z(x, {
|
|
2054
2073
|
variant: "ghost",
|
|
2055
2074
|
size: "icon",
|
|
2056
2075
|
className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
|
|
2057
|
-
onClick:
|
|
2058
|
-
"aria-label":
|
|
2059
|
-
children:
|
|
2076
|
+
onClick: me,
|
|
2077
|
+
"aria-label": G("detail.copyRecordId", { defaultValue: "Copy record ID" }),
|
|
2078
|
+
children: ee ? /* @__PURE__ */ Z(ge, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Te, { className: "h-3 w-3" })
|
|
2060
2079
|
})
|
|
2061
|
-
}), /* @__PURE__ */ Z(
|
|
2080
|
+
}), /* @__PURE__ */ Z(V, { children: ee ? G("detail.copied", { defaultValue: "Copied" }) : G("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
|
|
2062
2081
|
})]
|
|
2063
2082
|
})]
|
|
2064
2083
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -2067,7 +2086,7 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2067
2086
|
K.recordNavigation && /* @__PURE__ */ Q("div", {
|
|
2068
2087
|
className: "flex items-center gap-1 mr-2",
|
|
2069
2088
|
children: [
|
|
2070
|
-
/* @__PURE__ */ Q(
|
|
2089
|
+
/* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2071
2090
|
asChild: !0,
|
|
2072
2091
|
children: /* @__PURE__ */ Z(x, {
|
|
2073
2092
|
variant: "outline",
|
|
@@ -2080,15 +2099,15 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2080
2099
|
},
|
|
2081
2100
|
children: /* @__PURE__ */ Z(ye, { className: "h-4 w-4" })
|
|
2082
2101
|
})
|
|
2083
|
-
}), /* @__PURE__ */ Z(
|
|
2102
|
+
}), /* @__PURE__ */ Z(V, { children: G("detail.previousRecord") })] }),
|
|
2084
2103
|
/* @__PURE__ */ Z("span", {
|
|
2085
2104
|
className: "text-xs text-muted-foreground whitespace-nowrap px-1",
|
|
2086
|
-
children:
|
|
2105
|
+
children: G("detail.recordOf", {
|
|
2087
2106
|
current: K.recordNavigation.currentIndex + 1,
|
|
2088
2107
|
total: K.recordNavigation.recordIds.length
|
|
2089
2108
|
})
|
|
2090
2109
|
}),
|
|
2091
|
-
/* @__PURE__ */ Q(
|
|
2110
|
+
/* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2092
2111
|
asChild: !0,
|
|
2093
2112
|
children: /* @__PURE__ */ Z(x, {
|
|
2094
2113
|
variant: "outline",
|
|
@@ -2101,50 +2120,50 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2101
2120
|
},
|
|
2102
2121
|
children: /* @__PURE__ */ Z(be, { className: "h-4 w-4" })
|
|
2103
2122
|
})
|
|
2104
|
-
}), /* @__PURE__ */ Z(
|
|
2123
|
+
}), /* @__PURE__ */ Z(V, { children: G("detail.nextRecord") })] })
|
|
2105
2124
|
]
|
|
2106
2125
|
}),
|
|
2107
|
-
c && /* @__PURE__ */ Q(
|
|
2126
|
+
c && /* @__PURE__ */ Q(Dt, { children: [T && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2108
2127
|
asChild: !0,
|
|
2109
2128
|
children: /* @__PURE__ */ Q(x, {
|
|
2110
2129
|
variant: "ghost",
|
|
2111
2130
|
size: "sm",
|
|
2112
|
-
onClick:
|
|
2131
|
+
onClick: De,
|
|
2113
2132
|
className: "gap-2 hidden sm:inline-flex",
|
|
2114
2133
|
children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2115
2134
|
className: "hidden sm:inline",
|
|
2116
|
-
children:
|
|
2135
|
+
children: G("detail.cancel")
|
|
2117
2136
|
})]
|
|
2118
2137
|
})
|
|
2119
|
-
}), /* @__PURE__ */ Z(
|
|
2138
|
+
}), /* @__PURE__ */ Z(V, { children: G("detail.cancelEdit") })] }), /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2120
2139
|
asChild: !0,
|
|
2121
2140
|
children: /* @__PURE__ */ Z(x, {
|
|
2122
2141
|
variant: T ? "default" : "outline",
|
|
2123
2142
|
size: "sm",
|
|
2124
|
-
onClick:
|
|
2143
|
+
onClick: we,
|
|
2125
2144
|
className: "gap-2 hidden sm:inline-flex",
|
|
2126
|
-
children: T ? /* @__PURE__ */ Q(
|
|
2145
|
+
children: T ? /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z(ge, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2127
2146
|
className: "hidden sm:inline",
|
|
2128
|
-
children:
|
|
2129
|
-
})] }) : /* @__PURE__ */ Q(
|
|
2147
|
+
children: G("detail.save")
|
|
2148
|
+
})] }) : /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2130
2149
|
className: "hidden sm:inline",
|
|
2131
|
-
children:
|
|
2150
|
+
children: G("detail.editInline")
|
|
2132
2151
|
})] })
|
|
2133
2152
|
})
|
|
2134
|
-
}), /* @__PURE__ */ Z(
|
|
2135
|
-
K.showEdit && /* @__PURE__ */ Q(
|
|
2153
|
+
}), /* @__PURE__ */ Z(V, { children: G(T ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
|
|
2154
|
+
K.showEdit && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2136
2155
|
asChild: !0,
|
|
2137
2156
|
children: /* @__PURE__ */ Q(x, {
|
|
2138
2157
|
variant: "default",
|
|
2139
|
-
onClick:
|
|
2158
|
+
onClick: _e,
|
|
2140
2159
|
className: "gap-2 hidden sm:inline-flex",
|
|
2141
2160
|
children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2142
2161
|
className: "hidden sm:inline",
|
|
2143
|
-
children:
|
|
2162
|
+
children: G("detail.edit")
|
|
2144
2163
|
})]
|
|
2145
2164
|
})
|
|
2146
|
-
}), /* @__PURE__ */ Z(
|
|
2147
|
-
|
|
2165
|
+
}), /* @__PURE__ */ Z(V, { children: G("detail.editRecord") })] }),
|
|
2166
|
+
Y.map((e, t) => /* @__PURE__ */ Z(at, {
|
|
2148
2167
|
schema: e,
|
|
2149
2168
|
data: g
|
|
2150
2169
|
}, `header-action-${t}`))
|
|
@@ -2155,7 +2174,7 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2155
2174
|
schema: K.header,
|
|
2156
2175
|
data: g
|
|
2157
2176
|
}) }),
|
|
2158
|
-
K.highlightFields && K.highlightFields.length > 0 && /* @__PURE__ */ Z(
|
|
2177
|
+
K.highlightFields && K.highlightFields.length > 0 && /* @__PURE__ */ Z(Xt, {
|
|
2159
2178
|
fields: K.highlightFields,
|
|
2160
2179
|
data: g,
|
|
2161
2180
|
objectName: K.objectName,
|
|
@@ -2168,36 +2187,36 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2168
2187
|
children: [/* @__PURE__ */ Q("div", {
|
|
2169
2188
|
className: "flex items-center justify-end gap-2",
|
|
2170
2189
|
children: [
|
|
2171
|
-
t && !T && /* @__PURE__ */ Q(
|
|
2190
|
+
t && !T && /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Q("span", {
|
|
2172
2191
|
role: "status",
|
|
2173
2192
|
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",
|
|
2174
|
-
title:
|
|
2175
|
-
children: [/* @__PURE__ */ Z(
|
|
2193
|
+
title: G("detail.lockedTooltip"),
|
|
2194
|
+
children: [/* @__PURE__ */ Z(Le, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: G("detail.lockedByApproval") })]
|
|
2176
2195
|
}), n?.cancelPendingApproval && /* @__PURE__ */ Q(x, {
|
|
2177
2196
|
variant: "outline",
|
|
2178
2197
|
size: "sm",
|
|
2179
|
-
onClick:
|
|
2180
|
-
disabled:
|
|
2198
|
+
onClick: ve,
|
|
2199
|
+
disabled: ae,
|
|
2181
2200
|
className: "gap-2 border-amber-300 text-amber-800 hover:bg-amber-50",
|
|
2182
|
-
title:
|
|
2183
|
-
children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children:
|
|
2201
|
+
title: G("detail.cancelApprovalTooltip"),
|
|
2202
|
+
children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G(ae ? "detail.cancelApprovalInFlight" : "detail.cancelApproval") })]
|
|
2184
2203
|
})] }),
|
|
2185
2204
|
T && /* @__PURE__ */ Q(x, {
|
|
2186
2205
|
variant: "ghost",
|
|
2187
2206
|
size: "sm",
|
|
2188
|
-
onClick:
|
|
2207
|
+
onClick: De,
|
|
2189
2208
|
className: "gap-2",
|
|
2190
2209
|
disabled: k,
|
|
2191
|
-
children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children:
|
|
2210
|
+
children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G("detail.cancel") })]
|
|
2192
2211
|
}),
|
|
2193
2212
|
/* @__PURE__ */ Q(x, {
|
|
2194
2213
|
variant: T ? "default" : "outline",
|
|
2195
2214
|
size: "sm",
|
|
2196
|
-
onClick:
|
|
2215
|
+
onClick: we,
|
|
2197
2216
|
className: "gap-2",
|
|
2198
2217
|
disabled: k || t && !T,
|
|
2199
|
-
title: t && !T ?
|
|
2200
|
-
children: [Z(T ? ge : Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children:
|
|
2218
|
+
title: t && !T ? G("detail.lockedTooltip") : void 0,
|
|
2219
|
+
children: [Z(T ? ge : Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G(k ? "detail.saving" : T ? "detail.save" : "detail.editFieldsInline") })]
|
|
2201
2220
|
})
|
|
2202
2221
|
]
|
|
2203
2222
|
}), j && /* @__PURE__ */ Z("div", {
|
|
@@ -2208,10 +2227,16 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2208
2227
|
});
|
|
2209
2228
|
})(),
|
|
2210
2229
|
K.autoTabs && !K.tabs?.length ? (() => {
|
|
2211
|
-
let e = Oe.length > 0, t = !!K.activities && K.activities.length > 0, r = !!u, i = !!K.history, a =
|
|
2230
|
+
let e = Oe.length > 0, t = !!K.activities && K.activities.length > 0, r = !!u, i = !!K.history, a = [
|
|
2231
|
+
"details",
|
|
2232
|
+
...e ? ["related"] : [],
|
|
2233
|
+
...t ? ["activity"] : [],
|
|
2234
|
+
...r ? ["discussion"] : [],
|
|
2235
|
+
...i ? ["history"] : []
|
|
2236
|
+
], o = K.defaultTab, s = o && a.includes(o) ? o : "details", c = K.onTabChange, l = /* @__PURE__ */ Q("div", {
|
|
2212
2237
|
className: "space-y-3 sm:space-y-4",
|
|
2213
2238
|
children: [
|
|
2214
|
-
K.sectionGroups && K.sectionGroups.length > 0 && K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(
|
|
2239
|
+
K.sectionGroups && K.sectionGroups.length > 0 && K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Yt, {
|
|
2215
2240
|
group: e,
|
|
2216
2241
|
data: {
|
|
2217
2242
|
...g,
|
|
@@ -2220,10 +2245,10 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2220
2245
|
objectSchema: N,
|
|
2221
2246
|
objectName: K.objectName,
|
|
2222
2247
|
isEditing: T,
|
|
2223
|
-
onFieldChange:
|
|
2248
|
+
onFieldChange: J,
|
|
2224
2249
|
dataSource: n
|
|
2225
2250
|
}, t)),
|
|
2226
|
-
K.sections && K.sections.length > 0 && K.sections.map((e, t) => /* @__PURE__ */ Z(
|
|
2251
|
+
K.sections && K.sections.length > 0 && K.sections.map((e, t) => /* @__PURE__ */ Z(Gt, {
|
|
2227
2252
|
section: e,
|
|
2228
2253
|
data: {
|
|
2229
2254
|
...g,
|
|
@@ -2232,10 +2257,10 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2232
2257
|
objectSchema: N,
|
|
2233
2258
|
objectName: K.objectName,
|
|
2234
2259
|
isEditing: T,
|
|
2235
|
-
onFieldChange:
|
|
2260
|
+
onFieldChange: J,
|
|
2236
2261
|
dataSource: n
|
|
2237
2262
|
}, t)),
|
|
2238
|
-
K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(
|
|
2263
|
+
K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(Gt, {
|
|
2239
2264
|
section: {
|
|
2240
2265
|
fields: K.fields,
|
|
2241
2266
|
columns: K.columns
|
|
@@ -2247,10 +2272,10 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2247
2272
|
objectSchema: N,
|
|
2248
2273
|
objectName: K.objectName,
|
|
2249
2274
|
isEditing: T,
|
|
2250
|
-
onFieldChange:
|
|
2275
|
+
onFieldChange: J,
|
|
2251
2276
|
dataSource: n
|
|
2252
2277
|
}),
|
|
2253
|
-
K.comments && /* @__PURE__ */ Z(
|
|
2278
|
+
K.comments && /* @__PURE__ */ Z(Qt, {
|
|
2254
2279
|
comments: K.comments,
|
|
2255
2280
|
onAddComment: K.onAddComment
|
|
2256
2281
|
})
|
|
@@ -2258,54 +2283,55 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2258
2283
|
});
|
|
2259
2284
|
return !e && !t && !r && !i ? /* @__PURE__ */ Z("div", {
|
|
2260
2285
|
className: "mt-2",
|
|
2261
|
-
children:
|
|
2262
|
-
}) : /* @__PURE__ */ Q(
|
|
2263
|
-
defaultValue:
|
|
2286
|
+
children: l
|
|
2287
|
+
}) : /* @__PURE__ */ Q(I, {
|
|
2288
|
+
defaultValue: s,
|
|
2289
|
+
onValueChange: c,
|
|
2264
2290
|
className: "w-full",
|
|
2265
2291
|
children: [
|
|
2266
|
-
/* @__PURE__ */ Q(
|
|
2292
|
+
/* @__PURE__ */ Q(R, {
|
|
2267
2293
|
className: "w-full justify-start border-b rounded-none bg-transparent p-0",
|
|
2268
2294
|
children: [
|
|
2269
|
-
/* @__PURE__ */ Z(
|
|
2295
|
+
/* @__PURE__ */ Z(z, {
|
|
2270
2296
|
value: "details",
|
|
2271
2297
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2272
|
-
children:
|
|
2298
|
+
children: G("detail.details")
|
|
2273
2299
|
}),
|
|
2274
|
-
e && /* @__PURE__ */ Z(
|
|
2300
|
+
e && /* @__PURE__ */ Z(z, {
|
|
2275
2301
|
value: "related",
|
|
2276
2302
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2277
2303
|
children: /* @__PURE__ */ Q("span", {
|
|
2278
2304
|
className: "flex items-center gap-1.5",
|
|
2279
|
-
children: [
|
|
2305
|
+
children: [G("detail.related"), /* @__PURE__ */ Z(b, {
|
|
2280
2306
|
variant: "secondary",
|
|
2281
2307
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2282
2308
|
children: Oe.length
|
|
2283
2309
|
})]
|
|
2284
2310
|
})
|
|
2285
2311
|
}),
|
|
2286
|
-
t && /* @__PURE__ */ Z(
|
|
2312
|
+
t && /* @__PURE__ */ Z(z, {
|
|
2287
2313
|
value: "activity",
|
|
2288
2314
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2289
2315
|
children: /* @__PURE__ */ Q("span", {
|
|
2290
2316
|
className: "flex items-center gap-1.5",
|
|
2291
|
-
children: [
|
|
2317
|
+
children: [G("detail.activity"), /* @__PURE__ */ Z(b, {
|
|
2292
2318
|
variant: "secondary",
|
|
2293
2319
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2294
2320
|
children: K.activities.length
|
|
2295
2321
|
})]
|
|
2296
2322
|
})
|
|
2297
2323
|
}),
|
|
2298
|
-
r && /* @__PURE__ */ Z(
|
|
2324
|
+
r && /* @__PURE__ */ Z(z, {
|
|
2299
2325
|
value: "discussion",
|
|
2300
2326
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2301
|
-
children:
|
|
2327
|
+
children: G("detail.discussion", { defaultValue: "Discussion" })
|
|
2302
2328
|
}),
|
|
2303
|
-
i && /* @__PURE__ */ Z(
|
|
2329
|
+
i && /* @__PURE__ */ Z(z, {
|
|
2304
2330
|
value: "history",
|
|
2305
2331
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2306
2332
|
children: /* @__PURE__ */ Q("span", {
|
|
2307
2333
|
className: "flex items-center gap-1.5",
|
|
2308
|
-
children: [
|
|
2334
|
+
children: [G("detail.history", { defaultValue: "History" }), !K.history.loading && K.history.entries.length > 0 && /* @__PURE__ */ Z(b, {
|
|
2309
2335
|
variant: "secondary",
|
|
2310
2336
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2311
2337
|
children: K.history.entries.length
|
|
@@ -2314,17 +2340,17 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2314
2340
|
})
|
|
2315
2341
|
]
|
|
2316
2342
|
}),
|
|
2317
|
-
/* @__PURE__ */ Z(
|
|
2343
|
+
/* @__PURE__ */ Z(L, {
|
|
2318
2344
|
value: "details",
|
|
2319
2345
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2320
|
-
children:
|
|
2346
|
+
children: l
|
|
2321
2347
|
}),
|
|
2322
|
-
e && /* @__PURE__ */ Z(
|
|
2348
|
+
e && /* @__PURE__ */ Z(L, {
|
|
2323
2349
|
value: "related",
|
|
2324
2350
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2325
2351
|
children: /* @__PURE__ */ Z("div", {
|
|
2326
2352
|
className: "space-y-3",
|
|
2327
|
-
children: Oe.map((e, t) => /* @__PURE__ */ Z(
|
|
2353
|
+
children: Oe.map((e, t) => /* @__PURE__ */ Z(Jt, {
|
|
2328
2354
|
title: e.title,
|
|
2329
2355
|
type: e.type,
|
|
2330
2356
|
api: e.api,
|
|
@@ -2340,36 +2366,36 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2340
2366
|
onRowEdit: e.onRowEdit,
|
|
2341
2367
|
onRowDelete: e.onRowDelete,
|
|
2342
2368
|
collapsible: !0,
|
|
2343
|
-
defaultCollapsed:
|
|
2344
|
-
pageSize:
|
|
2369
|
+
defaultCollapsed: de && t > 0,
|
|
2370
|
+
pageSize: bn
|
|
2345
2371
|
}, t))
|
|
2346
2372
|
})
|
|
2347
2373
|
}),
|
|
2348
|
-
t && /* @__PURE__ */ Z(
|
|
2374
|
+
t && /* @__PURE__ */ Z(L, {
|
|
2349
2375
|
value: "activity",
|
|
2350
2376
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2351
|
-
children: /* @__PURE__ */ Z(
|
|
2377
|
+
children: /* @__PURE__ */ Z(an, { activities: K.activities })
|
|
2352
2378
|
}),
|
|
2353
|
-
r && /* @__PURE__ */ Z(
|
|
2379
|
+
r && /* @__PURE__ */ Z(L, {
|
|
2354
2380
|
value: "discussion",
|
|
2355
2381
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2356
2382
|
children: u
|
|
2357
2383
|
}),
|
|
2358
|
-
i && /* @__PURE__ */ Z(
|
|
2384
|
+
i && /* @__PURE__ */ Z(L, {
|
|
2359
2385
|
value: "history",
|
|
2360
2386
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2361
|
-
children: /* @__PURE__ */ Z(
|
|
2387
|
+
children: /* @__PURE__ */ Z(fn, {
|
|
2362
2388
|
entries: K.history.entries,
|
|
2363
2389
|
loading: K.history.loading,
|
|
2364
|
-
emptyText: K.history.emptyText ??
|
|
2390
|
+
emptyText: K.history.emptyText ?? G("detail.historyEmpty", { defaultValue: "No history yet" })
|
|
2365
2391
|
})
|
|
2366
2392
|
})
|
|
2367
2393
|
]
|
|
2368
2394
|
});
|
|
2369
|
-
})() : /* @__PURE__ */ Q(
|
|
2395
|
+
})() : /* @__PURE__ */ Q(Dt, { children: [
|
|
2370
2396
|
K.sectionGroups && K.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2371
2397
|
className: "space-y-3 sm:space-y-4",
|
|
2372
|
-
children: K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(
|
|
2398
|
+
children: K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Yt, {
|
|
2373
2399
|
group: e,
|
|
2374
2400
|
data: {
|
|
2375
2401
|
...g,
|
|
@@ -2378,13 +2404,13 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2378
2404
|
objectSchema: N,
|
|
2379
2405
|
objectName: K.objectName,
|
|
2380
2406
|
isEditing: T,
|
|
2381
|
-
onFieldChange:
|
|
2407
|
+
onFieldChange: J,
|
|
2382
2408
|
dataSource: n
|
|
2383
2409
|
}, t))
|
|
2384
2410
|
}),
|
|
2385
2411
|
K.sections && K.sections.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2386
2412
|
className: "space-y-3 sm:space-y-4",
|
|
2387
|
-
children: K.sections.map((e, t) => /* @__PURE__ */ Z(
|
|
2413
|
+
children: K.sections.map((e, t) => /* @__PURE__ */ Z(Gt, {
|
|
2388
2414
|
section: e,
|
|
2389
2415
|
data: {
|
|
2390
2416
|
...g,
|
|
@@ -2393,11 +2419,11 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2393
2419
|
objectSchema: N,
|
|
2394
2420
|
objectName: K.objectName,
|
|
2395
2421
|
isEditing: T,
|
|
2396
|
-
onFieldChange:
|
|
2422
|
+
onFieldChange: J,
|
|
2397
2423
|
dataSource: n
|
|
2398
2424
|
}, t))
|
|
2399
2425
|
}),
|
|
2400
|
-
K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(
|
|
2426
|
+
K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(Gt, {
|
|
2401
2427
|
section: {
|
|
2402
2428
|
fields: K.fields,
|
|
2403
2429
|
columns: K.columns
|
|
@@ -2409,10 +2435,10 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2409
2435
|
objectSchema: N,
|
|
2410
2436
|
objectName: K.objectName,
|
|
2411
2437
|
isEditing: T,
|
|
2412
|
-
onFieldChange:
|
|
2438
|
+
onFieldChange: J,
|
|
2413
2439
|
dataSource: n
|
|
2414
2440
|
}),
|
|
2415
|
-
K.tabs && K.tabs.length > 0 && /* @__PURE__ */ Z(
|
|
2441
|
+
K.tabs && K.tabs.length > 0 && /* @__PURE__ */ Z(Kt, {
|
|
2416
2442
|
tabs: K.tabs,
|
|
2417
2443
|
data: g
|
|
2418
2444
|
}),
|
|
@@ -2420,8 +2446,8 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2420
2446
|
className: "space-y-3",
|
|
2421
2447
|
children: [/* @__PURE__ */ Z("h2", {
|
|
2422
2448
|
className: "text-lg font-semibold",
|
|
2423
|
-
children:
|
|
2424
|
-
}), Oe.map((e, t) => /* @__PURE__ */ Z(
|
|
2449
|
+
children: G("detail.related")
|
|
2450
|
+
}), Oe.map((e, t) => /* @__PURE__ */ Z(Jt, {
|
|
2425
2451
|
title: e.title,
|
|
2426
2452
|
type: e.type,
|
|
2427
2453
|
api: e.api,
|
|
@@ -2437,17 +2463,17 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2437
2463
|
onRowEdit: e.onRowEdit,
|
|
2438
2464
|
onRowDelete: e.onRowDelete,
|
|
2439
2465
|
collapsible: !0,
|
|
2440
|
-
defaultCollapsed:
|
|
2441
|
-
pageSize:
|
|
2466
|
+
defaultCollapsed: de && t > 0,
|
|
2467
|
+
pageSize: bn
|
|
2442
2468
|
}, t))]
|
|
2443
2469
|
}),
|
|
2444
|
-
K.comments && /* @__PURE__ */ Z(
|
|
2470
|
+
K.comments && /* @__PURE__ */ Z(Qt, {
|
|
2445
2471
|
comments: K.comments,
|
|
2446
2472
|
onAddComment: K.onAddComment
|
|
2447
2473
|
}),
|
|
2448
|
-
K.activities && K.activities.length > 0 && /* @__PURE__ */ Z(
|
|
2474
|
+
K.activities && K.activities.length > 0 && /* @__PURE__ */ Z(an, { activities: K.activities })
|
|
2449
2475
|
] }),
|
|
2450
|
-
/* @__PURE__ */ Z(
|
|
2476
|
+
/* @__PURE__ */ Z(yn, {
|
|
2451
2477
|
data: {
|
|
2452
2478
|
...g,
|
|
2453
2479
|
...D
|
|
@@ -2461,7 +2487,7 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2461
2487
|
}) })
|
|
2462
2488
|
]
|
|
2463
2489
|
}) });
|
|
2464
|
-
},
|
|
2490
|
+
}, Cn = (e) => {
|
|
2465
2491
|
if (e == null) return "—";
|
|
2466
2492
|
if (typeof e == "string") return e.length > 0 ? e : "\"\"";
|
|
2467
2493
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -2470,7 +2496,7 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2470
2496
|
} catch {
|
|
2471
2497
|
return String(e);
|
|
2472
2498
|
}
|
|
2473
|
-
},
|
|
2499
|
+
}, wn = (e) => {
|
|
2474
2500
|
if (typeof e != "string" || e.length === 0) return null;
|
|
2475
2501
|
let t = /\d{4}-\d{2}-\d{2}[ T]/.test(e) ? e.replace(" ", "T") : e, n = new Date(t);
|
|
2476
2502
|
if (Number.isNaN(n.getTime())) return null;
|
|
@@ -2479,13 +2505,13 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2479
2505
|
} catch {
|
|
2480
2506
|
return n.toISOString();
|
|
2481
2507
|
}
|
|
2482
|
-
},
|
|
2483
|
-
let { t: o } = $(), s = t?.label || t?.field || "", l = t ?
|
|
2508
|
+
}, Tn = ({ open: e, conflict: t, onReload: n, onOverwrite: r, onCancel: i, busy: a = !1 }) => {
|
|
2509
|
+
let { t: o } = $(), s = t?.label || t?.field || "", l = t ? Cn(t.pendingValue) : "", u = t ? Cn(t.currentValue) : "", g = t?.currentRecord ?? {}, _ = (() => {
|
|
2484
2510
|
let e = [g.updated_by_name, g.updated_by_label];
|
|
2485
2511
|
for (let t of e) if (typeof t == "string" && t.length > 0) return t;
|
|
2486
2512
|
let t = g.updated_by;
|
|
2487
2513
|
return typeof t != "string" || t.length === 0 || t.length >= 16 && !/\s/.test(t) && /^[A-Za-z0-9_-]+$/.test(t) ? null : t;
|
|
2488
|
-
})(), v =
|
|
2514
|
+
})(), v = wn(g.updated_at ?? t?.currentVersion), [y, b] = o("detail.concurrentUpdateDescription", { field: "{{field}}" }).split("{{field}}");
|
|
2489
2515
|
return /* @__PURE__ */ Z(c, {
|
|
2490
2516
|
open: e,
|
|
2491
2517
|
onOpenChange: (e) => {
|
|
@@ -2554,14 +2580,14 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2554
2580
|
type: "button",
|
|
2555
2581
|
disabled: a,
|
|
2556
2582
|
onClick: i,
|
|
2557
|
-
className:
|
|
2583
|
+
className: W(U({ variant: "ghost" }), "mt-2 sm:mt-0"),
|
|
2558
2584
|
children: o("detail.concurrentUpdateCancel")
|
|
2559
2585
|
}),
|
|
2560
2586
|
/* @__PURE__ */ Z("button", {
|
|
2561
2587
|
type: "button",
|
|
2562
2588
|
disabled: a,
|
|
2563
2589
|
onClick: r,
|
|
2564
|
-
className:
|
|
2590
|
+
className: W(U({ variant: "outline" }), "mt-2 sm:mt-0 text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive"),
|
|
2565
2591
|
children: o("detail.concurrentUpdateOverwrite")
|
|
2566
2592
|
}),
|
|
2567
2593
|
/* @__PURE__ */ Z("button", {
|
|
@@ -2569,7 +2595,7 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2569
2595
|
disabled: a,
|
|
2570
2596
|
onClick: n,
|
|
2571
2597
|
autoFocus: !0,
|
|
2572
|
-
className:
|
|
2598
|
+
className: W(U({ variant: "default" }), "mt-2 sm:mt-0"),
|
|
2573
2599
|
children: o("detail.concurrentUpdateReload")
|
|
2574
2600
|
})
|
|
2575
2601
|
]
|
|
@@ -2578,14 +2604,14 @@ var xn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2578
2604
|
})
|
|
2579
2605
|
});
|
|
2580
2606
|
};
|
|
2581
|
-
function
|
|
2607
|
+
function En(e) {
|
|
2582
2608
|
if (!e || typeof e != "object") return !1;
|
|
2583
2609
|
let t = e;
|
|
2584
2610
|
return t.code === "CONCURRENT_UPDATE" || t.name === "ConcurrentUpdateError";
|
|
2585
2611
|
}
|
|
2586
2612
|
//#endregion
|
|
2587
2613
|
//#region src/renderers/record-details.tsx
|
|
2588
|
-
var
|
|
2614
|
+
var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name) || null, On = (e) => {
|
|
2589
2615
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2590
2616
|
return {
|
|
2591
2617
|
designer: {
|
|
@@ -2595,8 +2621,80 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2595
2621
|
},
|
|
2596
2622
|
rest: i
|
|
2597
2623
|
};
|
|
2598
|
-
},
|
|
2599
|
-
let r =
|
|
2624
|
+
}, kn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2625
|
+
let r = mt(), { designer: i } = On(n), o = r?.objectName || "", s = kt(), { readableFields: c } = Ot(o), { sectionLabel: l } = _t(), u = dt(), [d, f] = a.useState(null), [p, m] = a.useState(!1), h = a.useCallback((t) => {
|
|
2626
|
+
let n = [...Array.isArray(e.fields) ? e.fields : [], ...(Array.isArray(e.sections) ? e.sections : []).flatMap((e) => Array.isArray(e?.fields) ? e.fields : [])];
|
|
2627
|
+
for (let e of n) if ((typeof e == "string" ? e : e?.name || e?.field) === t) return typeof e == "object" ? e?.label : void 0;
|
|
2628
|
+
}, [e.fields, e.sections]), g = a.useCallback(async (e, t) => {
|
|
2629
|
+
let n = r?.dataSource, i = r?.recordId, a = r?.objectName;
|
|
2630
|
+
if (!n || !i || !a) return;
|
|
2631
|
+
let o = typeof r?.data?.updated_at == "string" ? (r?.data).updated_at : void 0, s = o ? { ifMatch: o } : void 0;
|
|
2632
|
+
try {
|
|
2633
|
+
if (typeof n.update == "function") await n.update(a, i, { [e]: t }, s);
|
|
2634
|
+
else if (typeof n.updateOne == "function") await n.updateOne(a, i, { [e]: t }, s);
|
|
2635
|
+
else if (typeof n.patch == "function") await n.patch(a, i, { [e]: t }, s);
|
|
2636
|
+
else {
|
|
2637
|
+
console.warn("[record:details] DataSource exposes no update/updateOne/patch method; cannot persist inline edit");
|
|
2638
|
+
return;
|
|
2639
|
+
}
|
|
2640
|
+
typeof r?.refresh == "function" && await r.refresh();
|
|
2641
|
+
} catch (n) {
|
|
2642
|
+
if (En(n)) {
|
|
2643
|
+
let r = n.currentRecord ?? null;
|
|
2644
|
+
throw f({
|
|
2645
|
+
field: e,
|
|
2646
|
+
label: h(e),
|
|
2647
|
+
pendingValue: t,
|
|
2648
|
+
currentValue: r ? r[e] : void 0,
|
|
2649
|
+
currentVersion: n.currentVersion,
|
|
2650
|
+
currentRecord: r
|
|
2651
|
+
}), n;
|
|
2652
|
+
}
|
|
2653
|
+
throw console.error("[record:details] Inline-edit save failed", n), n;
|
|
2654
|
+
}
|
|
2655
|
+
}, [
|
|
2656
|
+
r?.dataSource,
|
|
2657
|
+
r?.recordId,
|
|
2658
|
+
r?.objectName,
|
|
2659
|
+
r?.data,
|
|
2660
|
+
r?.refresh,
|
|
2661
|
+
h
|
|
2662
|
+
]), _ = a.useCallback(() => {
|
|
2663
|
+
f(null), m(!1);
|
|
2664
|
+
}, []), v = a.useCallback(async () => {
|
|
2665
|
+
m(!0);
|
|
2666
|
+
try {
|
|
2667
|
+
typeof r?.refresh == "function" && await r.refresh();
|
|
2668
|
+
} finally {
|
|
2669
|
+
_();
|
|
2670
|
+
}
|
|
2671
|
+
}, [r?.refresh, _]), y = a.useCallback(async () => {
|
|
2672
|
+
if (!d) {
|
|
2673
|
+
_();
|
|
2674
|
+
return;
|
|
2675
|
+
}
|
|
2676
|
+
let e = r?.dataSource, t = r?.recordId, n = r?.objectName;
|
|
2677
|
+
if (!e || !t || !n) {
|
|
2678
|
+
_();
|
|
2679
|
+
return;
|
|
2680
|
+
}
|
|
2681
|
+
m(!0);
|
|
2682
|
+
try {
|
|
2683
|
+
let i = d.currentVersion ? { ifMatch: d.currentVersion } : void 0;
|
|
2684
|
+
typeof e.update == "function" ? await e.update(n, t, { [d.field]: d.pendingValue }, i) : typeof e.updateOne == "function" ? await e.updateOne(n, t, { [d.field]: d.pendingValue }, i) : typeof e.patch == "function" && await e.patch(n, t, { [d.field]: d.pendingValue }, i), typeof r?.refresh == "function" && await r.refresh();
|
|
2685
|
+
} catch (e) {
|
|
2686
|
+
console.error("[record:details] Overwrite-on-conflict failed", e);
|
|
2687
|
+
} finally {
|
|
2688
|
+
_();
|
|
2689
|
+
}
|
|
2690
|
+
}, [
|
|
2691
|
+
d,
|
|
2692
|
+
r?.dataSource,
|
|
2693
|
+
r?.recordId,
|
|
2694
|
+
r?.objectName,
|
|
2695
|
+
r?.refresh,
|
|
2696
|
+
_
|
|
2697
|
+
]);
|
|
2600
2698
|
if (!r) return /* @__PURE__ */ Z("div", {
|
|
2601
2699
|
className: t,
|
|
2602
2700
|
"data-record-details-placeholder": !0,
|
|
@@ -2606,8 +2704,8 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2606
2704
|
children: "record:details — bind a record to preview"
|
|
2607
2705
|
})
|
|
2608
2706
|
});
|
|
2609
|
-
let
|
|
2610
|
-
if (
|
|
2707
|
+
let b = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2708
|
+
if (b.length > 0 && o && !b.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2611
2709
|
className: t,
|
|
2612
2710
|
...i,
|
|
2613
2711
|
role: "status",
|
|
@@ -2617,20 +2715,20 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2617
2715
|
children: "Insufficient permissions to view details."
|
|
2618
2716
|
})
|
|
2619
2717
|
});
|
|
2620
|
-
let
|
|
2621
|
-
if (!e || !
|
|
2622
|
-
let t = e.map(
|
|
2718
|
+
let x = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", S = e.enforceFieldSecurity === !0, C = Array.isArray(e.redactFields) ? e.redactFields : [], w = (e) => {
|
|
2719
|
+
if (!e || !S && C.length === 0) return e;
|
|
2720
|
+
let t = e.map(Dn).filter((e) => !!e), n = new Set((S && o ? c(t) : t).filter((e) => !C.includes(e)));
|
|
2623
2721
|
return e.filter((e) => {
|
|
2624
|
-
let t =
|
|
2722
|
+
let t = Dn(e);
|
|
2625
2723
|
return t ? n.has(t) : !0;
|
|
2626
2724
|
});
|
|
2627
|
-
},
|
|
2725
|
+
}, T = (e) => typeof e == "string" ? { name: e } : e && typeof e == "object" && !e.name && e.field ? {
|
|
2628
2726
|
...e,
|
|
2629
2727
|
name: e.field
|
|
2630
|
-
} : e,
|
|
2631
|
-
for (let e of
|
|
2632
|
-
let
|
|
2633
|
-
|
|
2728
|
+
} : e, E = (e) => Array.isArray(e) ? e.map(T) : e, D = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e : Dn(e)).filter((e) => !!e));
|
|
2729
|
+
for (let e of u) D.add(e);
|
|
2730
|
+
let O = r.objectSchema, k = r.data ?? {}, A = [
|
|
2731
|
+
O?.primaryField,
|
|
2634
2732
|
"name",
|
|
2635
2733
|
"full_name",
|
|
2636
2734
|
"title",
|
|
@@ -2638,125 +2736,53 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2638
2736
|
"display_name",
|
|
2639
2737
|
"label"
|
|
2640
2738
|
].filter((e) => typeof e == "string" && e.length > 0);
|
|
2641
|
-
for (let e of
|
|
2642
|
-
|
|
2739
|
+
for (let e of A) if (k[e] !== void 0 && k[e] !== null && k[e] !== "") {
|
|
2740
|
+
D.add(e);
|
|
2643
2741
|
break;
|
|
2644
2742
|
}
|
|
2645
|
-
let
|
|
2646
|
-
let t =
|
|
2647
|
-
return t ? !
|
|
2648
|
-
}),
|
|
2649
|
-
let t = e.title ?? e.label, n = e.name &&
|
|
2743
|
+
let j = (e) => !e || D.size === 0 ? e : e.filter((e) => {
|
|
2744
|
+
let t = Dn(e);
|
|
2745
|
+
return t ? !D.has(t) : !0;
|
|
2746
|
+
}), M = j(E(w(e.fields))), N = Array.isArray(e.sections) ? e.sections.map((e) => {
|
|
2747
|
+
let t = e.title ?? e.label, n = e.name && o ? l(o, e.name, t ?? e.name) : t;
|
|
2650
2748
|
return {
|
|
2651
2749
|
...e,
|
|
2652
2750
|
title: n,
|
|
2653
2751
|
showBorder: e.showBorder ?? !!n,
|
|
2654
2752
|
hideEmpty: e.hideEmpty ?? !0,
|
|
2655
|
-
fields:
|
|
2753
|
+
fields: j(E(w(e.fields)))
|
|
2656
2754
|
};
|
|
2657
|
-
}) : e.sections,
|
|
2658
|
-
let n = [...Array.isArray(e.fields) ? e.fields : [], ...(Array.isArray(e.sections) ? e.sections : []).flatMap((e) => Array.isArray(e?.fields) ? e.fields : [])];
|
|
2659
|
-
for (let e of n) if ((typeof e == "string" ? e : e?.name || e?.field) === t) return typeof e == "object" ? e?.label : void 0;
|
|
2660
|
-
}, [e.fields, e.sections]), j = a.useCallback(async (e, t) => {
|
|
2661
|
-
let n = r.dataSource, i = r.recordId, a = r.objectName;
|
|
2662
|
-
if (!n || !i || !a) return;
|
|
2663
|
-
let o = typeof r.data?.updated_at == "string" ? r.data.updated_at : void 0, s = o ? { ifMatch: o } : void 0;
|
|
2664
|
-
try {
|
|
2665
|
-
if (typeof n.update == "function") await n.update(a, i, { [e]: t }, s);
|
|
2666
|
-
else if (typeof n.updateOne == "function") await n.updateOne(a, i, { [e]: t }, s);
|
|
2667
|
-
else if (typeof n.patch == "function") await n.patch(a, i, { [e]: t }, s);
|
|
2668
|
-
else {
|
|
2669
|
-
console.warn("[record:details] DataSource exposes no update/updateOne/patch method; cannot persist inline edit");
|
|
2670
|
-
return;
|
|
2671
|
-
}
|
|
2672
|
-
typeof r.refresh == "function" && await r.refresh();
|
|
2673
|
-
} catch (n) {
|
|
2674
|
-
if (Tn(n)) {
|
|
2675
|
-
let r = n.currentRecord ?? null;
|
|
2676
|
-
throw D({
|
|
2677
|
-
field: e,
|
|
2678
|
-
label: A(e),
|
|
2679
|
-
pendingValue: t,
|
|
2680
|
-
currentValue: r ? r[e] : void 0,
|
|
2681
|
-
currentVersion: n.currentVersion,
|
|
2682
|
-
currentRecord: r
|
|
2683
|
-
}), n;
|
|
2684
|
-
}
|
|
2685
|
-
throw console.error("[record:details] Inline-edit save failed", n), n;
|
|
2686
|
-
}
|
|
2687
|
-
}, [
|
|
2688
|
-
r.dataSource,
|
|
2689
|
-
r.recordId,
|
|
2690
|
-
r.objectName,
|
|
2691
|
-
r.data,
|
|
2692
|
-
r.refresh,
|
|
2693
|
-
A
|
|
2694
|
-
]), M = a.useCallback(() => {
|
|
2695
|
-
D(null), k(!1);
|
|
2696
|
-
}, []), N = a.useCallback(async () => {
|
|
2697
|
-
k(!0);
|
|
2698
|
-
try {
|
|
2699
|
-
typeof r.refresh == "function" && await r.refresh();
|
|
2700
|
-
} finally {
|
|
2701
|
-
M();
|
|
2702
|
-
}
|
|
2703
|
-
}, [r.refresh, M]), ee = a.useCallback(async () => {
|
|
2704
|
-
if (!E) {
|
|
2705
|
-
M();
|
|
2706
|
-
return;
|
|
2707
|
-
}
|
|
2708
|
-
let e = r.dataSource, t = r.recordId, n = r.objectName;
|
|
2709
|
-
if (!e || !t || !n) {
|
|
2710
|
-
M();
|
|
2711
|
-
return;
|
|
2712
|
-
}
|
|
2713
|
-
k(!0);
|
|
2714
|
-
try {
|
|
2715
|
-
let i = E.currentVersion ? { ifMatch: E.currentVersion } : void 0;
|
|
2716
|
-
typeof e.update == "function" ? await e.update(n, t, { [E.field]: E.pendingValue }, i) : typeof e.updateOne == "function" ? await e.updateOne(n, t, { [E.field]: E.pendingValue }, i) : typeof e.patch == "function" && await e.patch(n, t, { [E.field]: E.pendingValue }, i), typeof r.refresh == "function" && await r.refresh();
|
|
2717
|
-
} catch (e) {
|
|
2718
|
-
console.error("[record:details] Overwrite-on-conflict failed", e);
|
|
2719
|
-
} finally {
|
|
2720
|
-
M();
|
|
2721
|
-
}
|
|
2722
|
-
}, [
|
|
2723
|
-
E,
|
|
2724
|
-
r.dataSource,
|
|
2725
|
-
r.recordId,
|
|
2726
|
-
r.objectName,
|
|
2727
|
-
r.refresh,
|
|
2728
|
-
M
|
|
2729
|
-
]), te = {
|
|
2755
|
+
}) : e.sections, P = e.inlineEdit ?? !0, ee = {
|
|
2730
2756
|
type: "detail-view",
|
|
2731
2757
|
objectName: r.objectName,
|
|
2732
2758
|
resourceId: r.recordId,
|
|
2733
2759
|
data: r.data,
|
|
2734
|
-
layout:
|
|
2760
|
+
layout: x,
|
|
2735
2761
|
columns: e.columns,
|
|
2736
|
-
sections:
|
|
2737
|
-
fields:
|
|
2762
|
+
sections: N,
|
|
2763
|
+
fields: M,
|
|
2738
2764
|
showBack: !1,
|
|
2739
2765
|
showHeader: e.showHeader ?? !1,
|
|
2740
|
-
inlineEdit:
|
|
2766
|
+
inlineEdit: P
|
|
2741
2767
|
};
|
|
2742
2768
|
return /* @__PURE__ */ Q("div", {
|
|
2743
2769
|
className: t,
|
|
2744
2770
|
...i,
|
|
2745
|
-
children: [/* @__PURE__ */ Z(
|
|
2746
|
-
schema:
|
|
2771
|
+
children: [/* @__PURE__ */ Z(Sn, {
|
|
2772
|
+
schema: ee,
|
|
2747
2773
|
dataSource: r.dataSource,
|
|
2748
|
-
inlineEdit:
|
|
2749
|
-
onFieldSave:
|
|
2750
|
-
}), /* @__PURE__ */ Z(
|
|
2751
|
-
open: !!
|
|
2752
|
-
conflict:
|
|
2753
|
-
busy:
|
|
2754
|
-
onCancel:
|
|
2755
|
-
onReload:
|
|
2756
|
-
onOverwrite:
|
|
2774
|
+
inlineEdit: P,
|
|
2775
|
+
onFieldSave: g
|
|
2776
|
+
}), /* @__PURE__ */ Z(Tn, {
|
|
2777
|
+
open: !!d,
|
|
2778
|
+
conflict: d,
|
|
2779
|
+
busy: p,
|
|
2780
|
+
onCancel: _,
|
|
2781
|
+
onReload: v,
|
|
2782
|
+
onOverwrite: y
|
|
2757
2783
|
})]
|
|
2758
2784
|
});
|
|
2759
|
-
},
|
|
2785
|
+
}, An = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name || e.key) || null, jn = (e) => e?.id ?? e?._id ?? null, Mn = (e) => {
|
|
2760
2786
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2761
2787
|
return {
|
|
2762
2788
|
designer: {
|
|
@@ -2766,11 +2792,11 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2766
2792
|
},
|
|
2767
2793
|
rest: i
|
|
2768
2794
|
};
|
|
2769
|
-
},
|
|
2770
|
-
let r =
|
|
2795
|
+
}, Nn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2796
|
+
let r = mt(), { designer: i } = Mn(n), o = _t(), s = e.objectName, c = s && o.objectLabel ? o.objectLabel({
|
|
2771
2797
|
name: s,
|
|
2772
|
-
label:
|
|
2773
|
-
}) : s ?
|
|
2798
|
+
label: Tt(s)
|
|
2799
|
+
}) : s ? Tt(s) : "", l = e.title || c || "Related";
|
|
2774
2800
|
if (!s) return /* @__PURE__ */ Z("div", {
|
|
2775
2801
|
className: t,
|
|
2776
2802
|
...i,
|
|
@@ -2779,7 +2805,7 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2779
2805
|
children: "record:related_list — missing objectName"
|
|
2780
2806
|
})
|
|
2781
2807
|
});
|
|
2782
|
-
let u =
|
|
2808
|
+
let u = kt(), { readableFields: d } = Ot(s), f = gt(), p = a.useMemo(() => f?.resolve({
|
|
2783
2809
|
objectName: s,
|
|
2784
2810
|
relationshipField: e.relationshipField,
|
|
2785
2811
|
parentId: r?.recordId ?? null
|
|
@@ -2801,16 +2827,16 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2801
2827
|
});
|
|
2802
2828
|
let h = e.enforceFieldSecurity === !0, g = Array.isArray(e.redactFields) ? e.redactFields : [], _ = Array.isArray(e.columns) ? e.columns : [], v = _;
|
|
2803
2829
|
if (h || g.length > 0) {
|
|
2804
|
-
let e = _.map(
|
|
2830
|
+
let e = _.map(An).filter((e) => !!e), t = new Set((h ? d(e) : e).filter((e) => !g.includes(e)));
|
|
2805
2831
|
v = _.filter((e) => {
|
|
2806
|
-
let n =
|
|
2832
|
+
let n = An(e);
|
|
2807
2833
|
return n ? t.has(n) : !0;
|
|
2808
2834
|
});
|
|
2809
2835
|
}
|
|
2810
2836
|
return /* @__PURE__ */ Z("div", {
|
|
2811
2837
|
className: t,
|
|
2812
2838
|
...i,
|
|
2813
|
-
children: /* @__PURE__ */ Z(
|
|
2839
|
+
children: /* @__PURE__ */ Z(Jt, {
|
|
2814
2840
|
title: l,
|
|
2815
2841
|
type: "table",
|
|
2816
2842
|
api: s,
|
|
@@ -2823,17 +2849,19 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2823
2849
|
add: e.add,
|
|
2824
2850
|
rowActions: p?.rowActions,
|
|
2825
2851
|
onRowAction: p?.onRowAction,
|
|
2852
|
+
toolbarActions: p?.toolbarActions,
|
|
2853
|
+
onToolbarAction: p?.onToolbarAction,
|
|
2826
2854
|
onNew: p?.onCreate,
|
|
2827
2855
|
onRowClick: p?.onView ? (e) => {
|
|
2828
|
-
let t =
|
|
2856
|
+
let t = jn(e);
|
|
2829
2857
|
t != null && p.onView(t, e);
|
|
2830
2858
|
} : void 0,
|
|
2831
2859
|
onRowEdit: p?.onEdit ? (e) => {
|
|
2832
|
-
let t =
|
|
2860
|
+
let t = jn(e);
|
|
2833
2861
|
t != null && p.onEdit(t, e);
|
|
2834
2862
|
} : void 0,
|
|
2835
2863
|
onRowDelete: p?.onDelete ? (e) => {
|
|
2836
|
-
let t =
|
|
2864
|
+
let t = jn(e);
|
|
2837
2865
|
if (t != null) return p.onDelete(t, e);
|
|
2838
2866
|
} : e.add && r?.dataSource ? async (e) => {
|
|
2839
2867
|
let t = e?.id ?? e?._id;
|
|
@@ -2841,7 +2869,7 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2841
2869
|
} : void 0
|
|
2842
2870
|
})
|
|
2843
2871
|
});
|
|
2844
|
-
},
|
|
2872
|
+
}, Pn = (e) => {
|
|
2845
2873
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2846
2874
|
return {
|
|
2847
2875
|
designer: {
|
|
@@ -2851,8 +2879,8 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2851
2879
|
},
|
|
2852
2880
|
rest: i
|
|
2853
2881
|
};
|
|
2854
|
-
},
|
|
2855
|
-
let r =
|
|
2882
|
+
}, Fn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2883
|
+
let r = mt(), { designer: i } = Pn(n), o = r?.objectName || "", s = kt(), { readableFields: c } = Ot(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2856
2884
|
if (l.length > 0 && o && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2857
2885
|
className: t,
|
|
2858
2886
|
...i,
|
|
@@ -2869,20 +2897,20 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2869
2897
|
icon: e?.icon,
|
|
2870
2898
|
type: e?.type
|
|
2871
2899
|
}).filter((e) => typeof e.name == "string" && e.name.length > 0), d = e.enforceFieldSecurity === !0, f = Array.isArray(e.redactFields) ? e.redactFields : [], p = d && o ? new Set(c(u.map((e) => e.name))) : null, m = u.filter((e) => !(f.includes(e.name) || p && !p.has(e.name)));
|
|
2872
|
-
return
|
|
2900
|
+
return ht(a.useId(), m.map((e) => e.name)), /* @__PURE__ */ Z("div", {
|
|
2873
2901
|
className: t,
|
|
2874
2902
|
...i,
|
|
2875
|
-
children: /* @__PURE__ */ Z(
|
|
2903
|
+
children: /* @__PURE__ */ Z(Xt, {
|
|
2876
2904
|
fields: m,
|
|
2877
2905
|
data: r?.data,
|
|
2878
2906
|
objectName: r?.objectName,
|
|
2879
2907
|
objectSchema: r?.objectSchema
|
|
2880
2908
|
})
|
|
2881
2909
|
});
|
|
2882
|
-
},
|
|
2910
|
+
}, In = ({ change: e, className: t }) => {
|
|
2883
2911
|
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));
|
|
2884
2912
|
return /* @__PURE__ */ Q("div", {
|
|
2885
|
-
className:
|
|
2913
|
+
className: W("flex items-center gap-1.5 text-sm flex-wrap", t),
|
|
2886
2914
|
children: [
|
|
2887
2915
|
/* @__PURE__ */ Z("span", {
|
|
2888
2916
|
className: "font-medium text-foreground",
|
|
@@ -2899,22 +2927,22 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2899
2927
|
})
|
|
2900
2928
|
]
|
|
2901
2929
|
});
|
|
2902
|
-
},
|
|
2930
|
+
}, Ln = [
|
|
2903
2931
|
"👍",
|
|
2904
2932
|
"❤️",
|
|
2905
2933
|
"🎉",
|
|
2906
2934
|
"😂",
|
|
2907
2935
|
"😮",
|
|
2908
2936
|
"😢"
|
|
2909
|
-
],
|
|
2937
|
+
], Rn = ({ reactions: e, onToggleReaction: t, emojiOptions: n = Ln, className: r }) => {
|
|
2910
2938
|
let [a, o] = i.useState(!1), s = i.useCallback((e) => {
|
|
2911
2939
|
t?.(e), o(!1);
|
|
2912
2940
|
}, [t]);
|
|
2913
2941
|
return /* @__PURE__ */ Q("div", {
|
|
2914
|
-
className:
|
|
2942
|
+
className: W("flex items-center gap-1 flex-wrap", r),
|
|
2915
2943
|
children: [e.map((e) => /* @__PURE__ */ Q("button", {
|
|
2916
2944
|
type: "button",
|
|
2917
|
-
className:
|
|
2945
|
+
className: W("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"),
|
|
2918
2946
|
onClick: () => s(e.emoji),
|
|
2919
2947
|
disabled: !t,
|
|
2920
2948
|
"aria-label": `${e.emoji} ${e.count} reaction${e.count === 1 ? "" : "s"}`,
|
|
@@ -2946,7 +2974,7 @@ var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2946
2974
|
};
|
|
2947
2975
|
//#endregion
|
|
2948
2976
|
//#region src/ThreadedReplies.tsx
|
|
2949
|
-
function
|
|
2977
|
+
function zn(e, t) {
|
|
2950
2978
|
try {
|
|
2951
2979
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
2952
2980
|
if (i < 1) return t("detail.justNow");
|
|
@@ -2959,7 +2987,7 @@ function Rn(e, t) {
|
|
|
2959
2987
|
return e;
|
|
2960
2988
|
}
|
|
2961
2989
|
}
|
|
2962
|
-
var
|
|
2990
|
+
var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, className: a }) => {
|
|
2963
2991
|
let { t: o } = $(), [s, c] = i.useState(!1), [l, u] = i.useState(""), [d, f] = i.useState(!1), p = i.useCallback(async () => {
|
|
2964
2992
|
let t = l.trim();
|
|
2965
2993
|
if (!(!t || !n)) {
|
|
@@ -2978,7 +3006,7 @@ var zn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
2978
3006
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), p());
|
|
2979
3007
|
}, [p]);
|
|
2980
3008
|
return t.length === 0 && !r ? null : /* @__PURE__ */ Q("div", {
|
|
2981
|
-
className:
|
|
3009
|
+
className: W("ml-10 mt-1", a),
|
|
2982
3010
|
children: [
|
|
2983
3011
|
t.length > 0 && /* @__PURE__ */ Q("button", {
|
|
2984
3012
|
type: "button",
|
|
@@ -2987,7 +3015,7 @@ var zn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
2987
3015
|
"aria-expanded": s,
|
|
2988
3016
|
children: [
|
|
2989
3017
|
Z(s ? ve : be, { className: "h-3 w-3" }),
|
|
2990
|
-
/* @__PURE__ */ Z(
|
|
3018
|
+
/* @__PURE__ */ Z(ze, { className: "h-3 w-3" }),
|
|
2991
3019
|
/* @__PURE__ */ Z("span", { children: t.length === 1 ? o("detail.replyCount", { count: t.length }) : o("detail.replyCountPlural", { count: t.length }) })
|
|
2992
3020
|
]
|
|
2993
3021
|
}),
|
|
@@ -3014,7 +3042,7 @@ var zn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3014
3042
|
children: e.actor
|
|
3015
3043
|
}), /* @__PURE__ */ Z("span", {
|
|
3016
3044
|
className: "text-[10px] text-muted-foreground",
|
|
3017
|
-
children:
|
|
3045
|
+
children: zn(e.createdAt, o)
|
|
3018
3046
|
})]
|
|
3019
3047
|
}), /* @__PURE__ */ Z("p", {
|
|
3020
3048
|
className: "text-xs whitespace-pre-wrap break-words",
|
|
@@ -3044,7 +3072,7 @@ var zn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3044
3072
|
})
|
|
3045
3073
|
]
|
|
3046
3074
|
});
|
|
3047
|
-
},
|
|
3075
|
+
}, Vn = ({ subscription: e, onToggle: t, className: n }) => {
|
|
3048
3076
|
let { t: r } = $(), [a, o] = i.useState(!1), s = i.useCallback(async () => {
|
|
3049
3077
|
if (t) {
|
|
3050
3078
|
o(!0);
|
|
@@ -3058,21 +3086,21 @@ var zn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3058
3086
|
return /* @__PURE__ */ Z(x, {
|
|
3059
3087
|
variant: "ghost",
|
|
3060
3088
|
size: "icon",
|
|
3061
|
-
className:
|
|
3089
|
+
className: W("h-8 w-8", n),
|
|
3062
3090
|
onClick: s,
|
|
3063
3091
|
disabled: a || !t,
|
|
3064
3092
|
"aria-label": e.subscribed ? r("detail.unsubscribeAriaLabel") : r("detail.subscribeAriaLabel"),
|
|
3065
3093
|
title: e.subscribed ? r("detail.subscribedTooltip") : r("detail.unsubscribedTooltip"),
|
|
3066
|
-
children: e.subscribed ? /* @__PURE__ */ Z(
|
|
3094
|
+
children: e.subscribed ? /* @__PURE__ */ Z(pe, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(q, { className: "h-4 w-4 text-muted-foreground" })
|
|
3067
3095
|
});
|
|
3068
3096
|
};
|
|
3069
3097
|
//#endregion
|
|
3070
3098
|
//#region src/RichTextCommentInput.tsx
|
|
3071
|
-
function
|
|
3099
|
+
function Hn(e) {
|
|
3072
3100
|
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/>");
|
|
3073
3101
|
return t = t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g, (e) => `<ul class="my-1">${e.replace(/<br\/>/g, "")}</ul>`), t;
|
|
3074
3102
|
}
|
|
3075
|
-
var
|
|
3103
|
+
var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], placeholder: a, className: o, disabled: s = !1, extraSlot: c, canSubmitEmpty: l = !1 }) => {
|
|
3076
3104
|
let { t: u } = $(), [d, f] = i.useState(!1), [p, m] = i.useState(!1), [h, g] = i.useState(""), [_, v] = i.useState(0), y = i.useRef(null), b = i.useMemo(() => {
|
|
3077
3105
|
if (!h) return r;
|
|
3078
3106
|
let e = h.toLowerCase();
|
|
@@ -3133,7 +3161,7 @@ var Hn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3133
3161
|
n
|
|
3134
3162
|
]);
|
|
3135
3163
|
return /* @__PURE__ */ Q("div", {
|
|
3136
|
-
className:
|
|
3164
|
+
className: W("border rounded-md", o),
|
|
3137
3165
|
children: [
|
|
3138
3166
|
/* @__PURE__ */ Q("div", {
|
|
3139
3167
|
className: "flex items-center gap-0.5 px-2 py-1.5 border-b bg-muted/30",
|
|
@@ -3154,7 +3182,7 @@ var Hn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3154
3182
|
onClick: w,
|
|
3155
3183
|
disabled: s || d,
|
|
3156
3184
|
title: u("detail.italic"),
|
|
3157
|
-
children: /* @__PURE__ */ Z(
|
|
3185
|
+
children: /* @__PURE__ */ Z(Ne, { className: "h-3.5 w-3.5" })
|
|
3158
3186
|
}),
|
|
3159
3187
|
/* @__PURE__ */ Z(x, {
|
|
3160
3188
|
variant: "ghost",
|
|
@@ -3163,7 +3191,7 @@ var Hn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3163
3191
|
onClick: T,
|
|
3164
3192
|
disabled: s || d,
|
|
3165
3193
|
title: u("detail.listFormat"),
|
|
3166
|
-
children: /* @__PURE__ */ Z(
|
|
3194
|
+
children: /* @__PURE__ */ Z(Fe, { className: "h-3.5 w-3.5" })
|
|
3167
3195
|
}),
|
|
3168
3196
|
/* @__PURE__ */ Z(x, {
|
|
3169
3197
|
variant: "ghost",
|
|
@@ -3181,7 +3209,7 @@ var Hn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3181
3209
|
onClick: D,
|
|
3182
3210
|
disabled: s || d,
|
|
3183
3211
|
title: u("detail.mentionSomeone"),
|
|
3184
|
-
children: /* @__PURE__ */ Z(
|
|
3212
|
+
children: /* @__PURE__ */ Z(K, { className: "h-3.5 w-3.5" })
|
|
3185
3213
|
}),
|
|
3186
3214
|
/* @__PURE__ */ Z("div", { className: "flex-1" }),
|
|
3187
3215
|
/* @__PURE__ */ Z(x, {
|
|
@@ -3190,7 +3218,7 @@ var Hn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3190
3218
|
className: "h-7 w-7",
|
|
3191
3219
|
onClick: () => f(!d),
|
|
3192
3220
|
title: u(d ? "detail.edit" : "detail.preview"),
|
|
3193
|
-
children: Z(d ? Ee :
|
|
3221
|
+
children: Z(d ? Ee : J, { className: "h-3.5 w-3.5" })
|
|
3194
3222
|
}),
|
|
3195
3223
|
n && /* @__PURE__ */ Z(x, {
|
|
3196
3224
|
variant: "ghost",
|
|
@@ -3207,8 +3235,8 @@ var Hn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3207
3235
|
className: "relative",
|
|
3208
3236
|
children: d ? /* @__PURE__ */ Z("div", {
|
|
3209
3237
|
className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
|
|
3210
|
-
dangerouslySetInnerHTML: { __html:
|
|
3211
|
-
}) : /* @__PURE__ */ Q(
|
|
3238
|
+
dangerouslySetInnerHTML: { __html: Hn(e) }
|
|
3239
|
+
}) : /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z("textarea", {
|
|
3212
3240
|
ref: y,
|
|
3213
3241
|
className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
|
|
3214
3242
|
placeholder: a ?? u("detail.writeComment"),
|
|
@@ -3220,7 +3248,7 @@ var Hn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3220
3248
|
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",
|
|
3221
3249
|
children: b.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
3222
3250
|
type: "button",
|
|
3223
|
-
className:
|
|
3251
|
+
className: W("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === _ && "bg-accent"),
|
|
3224
3252
|
onMouseDown: (t) => {
|
|
3225
3253
|
t.preventDefault(), O(e);
|
|
3226
3254
|
},
|
|
@@ -3244,16 +3272,16 @@ var Hn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3244
3272
|
};
|
|
3245
3273
|
//#endregion
|
|
3246
3274
|
//#region src/CommentAttachment.tsx
|
|
3247
|
-
function
|
|
3275
|
+
function Wn(e) {
|
|
3248
3276
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
3249
3277
|
}
|
|
3250
|
-
function
|
|
3278
|
+
function Gn(e) {
|
|
3251
3279
|
return e.startsWith("image/");
|
|
3252
3280
|
}
|
|
3253
|
-
function
|
|
3254
|
-
return
|
|
3281
|
+
function Kn(e) {
|
|
3282
|
+
return Gn(e) ? Me : e.includes("pdf") || e.includes("document") || e.includes("text") ? Ae : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? Y : ke;
|
|
3255
3283
|
}
|
|
3256
|
-
var
|
|
3284
|
+
var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a = !1 }) => {
|
|
3257
3285
|
let { t: o } = $(), [s, c] = i.useState(!1), l = i.useRef(null), u = i.useCallback((e) => {
|
|
3258
3286
|
e.preventDefault(), e.stopPropagation(), c(!0);
|
|
3259
3287
|
}, []), d = i.useCallback((e) => {
|
|
@@ -3264,9 +3292,9 @@ var Kn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3264
3292
|
t && e.target.files && e.target.files.length > 0 && (t(e.target.files), e.target.value = "");
|
|
3265
3293
|
}, [t]);
|
|
3266
3294
|
return /* @__PURE__ */ Q("div", {
|
|
3267
|
-
className:
|
|
3295
|
+
className: W("space-y-2", r),
|
|
3268
3296
|
children: [t && !a && /* @__PURE__ */ Q("div", {
|
|
3269
|
-
className:
|
|
3297
|
+
className: W("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"),
|
|
3270
3298
|
onDragOver: u,
|
|
3271
3299
|
onDragLeave: d,
|
|
3272
3300
|
onDrop: f,
|
|
@@ -3298,7 +3326,7 @@ var Kn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3298
3326
|
}), /* @__PURE__ */ Z("div", {
|
|
3299
3327
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
|
|
3300
3328
|
children: e.map((e) => {
|
|
3301
|
-
let t =
|
|
3329
|
+
let t = Gn(e.type), r = Kn(e.type);
|
|
3302
3330
|
return /* @__PURE__ */ Q("div", {
|
|
3303
3331
|
className: "flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group",
|
|
3304
3332
|
children: [
|
|
@@ -3317,7 +3345,7 @@ var Kn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3317
3345
|
children: e.name
|
|
3318
3346
|
}), /* @__PURE__ */ Z("p", {
|
|
3319
3347
|
className: "text-[10px] text-muted-foreground",
|
|
3320
|
-
children:
|
|
3348
|
+
children: Wn(e.size)
|
|
3321
3349
|
})]
|
|
3322
3350
|
}),
|
|
3323
3351
|
n && !a && /* @__PURE__ */ Z(x, {
|
|
@@ -3334,15 +3362,15 @@ var Kn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3334
3362
|
})]
|
|
3335
3363
|
})]
|
|
3336
3364
|
});
|
|
3337
|
-
},
|
|
3338
|
-
comment:
|
|
3365
|
+
}, Jn = {
|
|
3366
|
+
comment: ze,
|
|
3339
3367
|
field_change: Ee,
|
|
3340
3368
|
task: _e,
|
|
3341
3369
|
event: he,
|
|
3342
3370
|
system: rt,
|
|
3343
|
-
email:
|
|
3371
|
+
email: Re,
|
|
3344
3372
|
call: We
|
|
3345
|
-
},
|
|
3373
|
+
}, Yn = {
|
|
3346
3374
|
comment: "bg-purple-100 text-purple-600",
|
|
3347
3375
|
field_change: "bg-blue-100 text-blue-600",
|
|
3348
3376
|
task: "bg-green-100 text-green-600",
|
|
@@ -3351,7 +3379,7 @@ var Kn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3351
3379
|
email: "bg-indigo-100 text-indigo-600",
|
|
3352
3380
|
call: "bg-teal-100 text-teal-600"
|
|
3353
3381
|
};
|
|
3354
|
-
function
|
|
3382
|
+
function Xn(e) {
|
|
3355
3383
|
return [
|
|
3356
3384
|
{
|
|
3357
3385
|
value: "all",
|
|
@@ -3371,7 +3399,7 @@ function Yn(e) {
|
|
|
3371
3399
|
}
|
|
3372
3400
|
];
|
|
3373
3401
|
}
|
|
3374
|
-
function
|
|
3402
|
+
function Zn(e, t) {
|
|
3375
3403
|
try {
|
|
3376
3404
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
3377
3405
|
if (i < 1) return t("detail.justNow");
|
|
@@ -3384,7 +3412,7 @@ function Xn(e, t) {
|
|
|
3384
3412
|
return e;
|
|
3385
3413
|
}
|
|
3386
3414
|
}
|
|
3387
|
-
function
|
|
3415
|
+
function Qn(e, t) {
|
|
3388
3416
|
switch (t) {
|
|
3389
3417
|
case "comments_only": return e.filter((e) => e.type === "comment");
|
|
3390
3418
|
case "changes_only": return e.filter((e) => e.type === "field_change");
|
|
@@ -3392,18 +3420,18 @@ function Zn(e, t) {
|
|
|
3392
3420
|
default: return e;
|
|
3393
3421
|
}
|
|
3394
3422
|
}
|
|
3395
|
-
var
|
|
3396
|
-
let { t: y } = $(), [b, S] = i.useState("all"), [C, w] = i.useState(""), [T, E] = i.useState(!1), [D, O] = i.useState(!1), [A, j] = i.useState([]), [
|
|
3397
|
-
if (!
|
|
3423
|
+
var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, 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 }) => {
|
|
3424
|
+
let { t: y } = $(), [b, S] = i.useState("all"), [C, w] = i.useState(""), [T, E] = i.useState(!1), [D, O] = i.useState(!1), [A, j] = i.useState([]), [ne, re] = i.useState(!1), ie = n ?? b, ae = t?.showFilterToggle !== !1, F = t?.showCommentInput !== !1 && !!c, I = t?.enableReactions ?? !1, L = t?.enableThreading ?? !1, R = t?.showSubscriptionToggle ?? !1, z = i.useMemo(() => Qn(e, ie), [e, ie]), B = i.useMemo(() => L ? z.filter((e) => !e.parentId) : z, [z, L]), V = i.useMemo(() => {
|
|
3425
|
+
if (!L) return /* @__PURE__ */ new Map();
|
|
3398
3426
|
let e = /* @__PURE__ */ new Map();
|
|
3399
|
-
for (let t of
|
|
3427
|
+
for (let t of z) if (t.parentId) {
|
|
3400
3428
|
let n = e.get(t.parentId) ?? [];
|
|
3401
3429
|
n.push(t), e.set(t.parentId, n);
|
|
3402
3430
|
}
|
|
3403
3431
|
return e;
|
|
3404
|
-
}, [
|
|
3432
|
+
}, [z, L]), oe = i.useCallback((e) => {
|
|
3405
3433
|
r ? r(e) : S(e);
|
|
3406
|
-
}, [r]),
|
|
3434
|
+
}, [r]), H = i.useCallback(async () => {
|
|
3407
3435
|
let e = C.trim();
|
|
3408
3436
|
if (c && !(!e && A.length === 0)) {
|
|
3409
3437
|
E(!0);
|
|
@@ -3417,17 +3445,17 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3417
3445
|
C,
|
|
3418
3446
|
A,
|
|
3419
3447
|
c
|
|
3420
|
-
]),
|
|
3448
|
+
]), U = i.useCallback(async (e) => {
|
|
3421
3449
|
if (!(!h || e.length === 0)) {
|
|
3422
|
-
|
|
3450
|
+
re(!0);
|
|
3423
3451
|
try {
|
|
3424
3452
|
let t = await h(e);
|
|
3425
3453
|
Array.isArray(t) && t.length > 0 && j((e) => [...e, ...t]);
|
|
3426
3454
|
} finally {
|
|
3427
|
-
|
|
3455
|
+
re(!1);
|
|
3428
3456
|
}
|
|
3429
3457
|
}
|
|
3430
|
-
}, [h]),
|
|
3458
|
+
}, [h]), se = i.useCallback((e) => {
|
|
3431
3459
|
j((t) => t.filter((t) => t.id !== e));
|
|
3432
3460
|
}, []), ce = i.useCallback(async () => {
|
|
3433
3461
|
if (o) {
|
|
@@ -3440,7 +3468,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3440
3468
|
}
|
|
3441
3469
|
}, [o]);
|
|
3442
3470
|
return /* @__PURE__ */ Q("section", {
|
|
3443
|
-
className:
|
|
3471
|
+
className: W("border-t border-border/60 pt-5", v),
|
|
3444
3472
|
"aria-label": "Discussion",
|
|
3445
3473
|
children: [/* @__PURE__ */ Z("header", {
|
|
3446
3474
|
className: "mb-4",
|
|
@@ -3449,20 +3477,20 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3449
3477
|
children: [/* @__PURE__ */ Q("h2", {
|
|
3450
3478
|
className: "flex items-center gap-2 text-base font-semibold leading-none tracking-tight",
|
|
3451
3479
|
children: [
|
|
3452
|
-
/* @__PURE__ */ Z(
|
|
3480
|
+
/* @__PURE__ */ Z(G, { className: "h-4 w-4" }),
|
|
3453
3481
|
g ?? y("detail.activity"),
|
|
3454
3482
|
/* @__PURE__ */ Q("span", {
|
|
3455
3483
|
className: "text-sm font-normal text-muted-foreground",
|
|
3456
3484
|
children: [
|
|
3457
3485
|
"(",
|
|
3458
|
-
|
|
3486
|
+
z.length,
|
|
3459
3487
|
")"
|
|
3460
3488
|
]
|
|
3461
3489
|
})
|
|
3462
3490
|
]
|
|
3463
3491
|
}), /* @__PURE__ */ Z("div", {
|
|
3464
3492
|
className: "flex items-center gap-1",
|
|
3465
|
-
children:
|
|
3493
|
+
children: R && d && /* @__PURE__ */ Z(Vn, {
|
|
3466
3494
|
subscription: d,
|
|
3467
3495
|
onToggle: f
|
|
3468
3496
|
})
|
|
@@ -3471,53 +3499,53 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3471
3499
|
}), /* @__PURE__ */ Q("div", {
|
|
3472
3500
|
className: "space-y-4",
|
|
3473
3501
|
children: [
|
|
3474
|
-
|
|
3502
|
+
ae && /* @__PURE__ */ Z("div", {
|
|
3475
3503
|
className: "flex items-center gap-2",
|
|
3476
3504
|
children: /* @__PURE__ */ Q(M, {
|
|
3477
|
-
value:
|
|
3478
|
-
onValueChange: (e) =>
|
|
3479
|
-
children: [/* @__PURE__ */ Z(
|
|
3505
|
+
value: ie,
|
|
3506
|
+
onValueChange: (e) => oe(e),
|
|
3507
|
+
children: [/* @__PURE__ */ Z(ee, {
|
|
3480
3508
|
"aria-label": y("detail.filterActivity"),
|
|
3481
3509
|
className: "h-8 w-auto min-w-[140px] py-1 text-sm",
|
|
3482
|
-
children: /* @__PURE__ */ Z(
|
|
3483
|
-
}), /* @__PURE__ */ Z(N, { children:
|
|
3510
|
+
children: /* @__PURE__ */ Z(te, {})
|
|
3511
|
+
}), /* @__PURE__ */ Z(N, { children: Xn(y).map((e) => /* @__PURE__ */ Z(P, {
|
|
3484
3512
|
value: e.value,
|
|
3485
3513
|
children: e.label
|
|
3486
3514
|
}, e.value)) })]
|
|
3487
3515
|
})
|
|
3488
3516
|
}),
|
|
3489
|
-
|
|
3517
|
+
F && /* @__PURE__ */ Z(Un, {
|
|
3490
3518
|
value: C,
|
|
3491
3519
|
onChange: w,
|
|
3492
|
-
onSubmit:
|
|
3520
|
+
onSubmit: H,
|
|
3493
3521
|
mentionSuggestions: m,
|
|
3494
3522
|
placeholder: y("detail.leaveCommentPlaceholder"),
|
|
3495
3523
|
disabled: T,
|
|
3496
3524
|
canSubmitEmpty: A.length > 0,
|
|
3497
|
-
extraSlot: h ? /* @__PURE__ */ Z(
|
|
3525
|
+
extraSlot: h ? /* @__PURE__ */ Z(qn, {
|
|
3498
3526
|
attachments: A,
|
|
3499
|
-
onUpload:
|
|
3500
|
-
onRemove:
|
|
3501
|
-
readOnly: T ||
|
|
3502
|
-
}) : A.length > 0 ? /* @__PURE__ */ Z(
|
|
3527
|
+
onUpload: U,
|
|
3528
|
+
onRemove: se,
|
|
3529
|
+
readOnly: T || ne
|
|
3530
|
+
}) : A.length > 0 ? /* @__PURE__ */ Z(qn, {
|
|
3503
3531
|
attachments: A,
|
|
3504
|
-
onRemove:
|
|
3532
|
+
onRemove: se,
|
|
3505
3533
|
readOnly: T
|
|
3506
3534
|
}) : void 0
|
|
3507
3535
|
}),
|
|
3508
|
-
|
|
3536
|
+
z.length === 0 ? p ? null : /* @__PURE__ */ Z(k, {
|
|
3509
3537
|
title: _ ?? y("detail.noActivity"),
|
|
3510
3538
|
className: "py-6"
|
|
3511
3539
|
}) : /* @__PURE__ */ Q("div", {
|
|
3512
3540
|
className: "relative",
|
|
3513
3541
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
3514
3542
|
className: "space-y-4",
|
|
3515
|
-
children:
|
|
3516
|
-
let t =
|
|
3543
|
+
children: B.map((e) => {
|
|
3544
|
+
let t = Jn[e.type] || rt, n = Yn[e.type] || "bg-gray-100 text-gray-600", r = V.get(e.id) ?? [];
|
|
3517
3545
|
return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
|
|
3518
3546
|
className: "flex gap-3 relative",
|
|
3519
3547
|
children: [/* @__PURE__ */ Z("div", {
|
|
3520
|
-
className:
|
|
3548
|
+
className: W("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", n),
|
|
3521
3549
|
children: e.actorAvatarUrl ? /* @__PURE__ */ Z("img", {
|
|
3522
3550
|
src: e.actorAvatarUrl,
|
|
3523
3551
|
alt: e.actor,
|
|
@@ -3539,7 +3567,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3539
3567
|
}),
|
|
3540
3568
|
/* @__PURE__ */ Z("span", {
|
|
3541
3569
|
className: "text-xs text-muted-foreground",
|
|
3542
|
-
children:
|
|
3570
|
+
children: Zn(e.createdAt, y)
|
|
3543
3571
|
}),
|
|
3544
3572
|
e.edited && /* @__PURE__ */ Z("span", {
|
|
3545
3573
|
className: "text-xs text-muted-foreground italic",
|
|
@@ -3566,25 +3594,25 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3566
3594
|
}),
|
|
3567
3595
|
e.type === "field_change" && e.fieldChanges && /* @__PURE__ */ Z("div", {
|
|
3568
3596
|
className: "space-y-1 mt-1",
|
|
3569
|
-
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(
|
|
3597
|
+
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(In, { change: e }, t))
|
|
3570
3598
|
}),
|
|
3571
|
-
|
|
3599
|
+
I && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
|
|
3572
3600
|
className: "mt-1.5",
|
|
3573
|
-
children: /* @__PURE__ */ Z(
|
|
3601
|
+
children: /* @__PURE__ */ Z(Rn, {
|
|
3574
3602
|
reactions: e.reactions,
|
|
3575
3603
|
onToggleReaction: u ? (t) => u(e.id, t) : void 0
|
|
3576
3604
|
})
|
|
3577
3605
|
}),
|
|
3578
|
-
|
|
3606
|
+
I && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
|
|
3579
3607
|
className: "mt-1.5",
|
|
3580
|
-
children: /* @__PURE__ */ Z(
|
|
3608
|
+
children: /* @__PURE__ */ Z(Rn, {
|
|
3581
3609
|
reactions: [],
|
|
3582
3610
|
onToggleReaction: (t) => u(e.id, t)
|
|
3583
3611
|
})
|
|
3584
3612
|
})
|
|
3585
3613
|
]
|
|
3586
3614
|
})]
|
|
3587
|
-
}),
|
|
3615
|
+
}), L && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(Bn, {
|
|
3588
3616
|
parentItem: e,
|
|
3589
3617
|
replies: r,
|
|
3590
3618
|
onAddReply: l,
|
|
@@ -3601,13 +3629,13 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3601
3629
|
onClick: ce,
|
|
3602
3630
|
disabled: D,
|
|
3603
3631
|
"aria-label": y("detail.loadMore"),
|
|
3604
|
-
children: [D ? /* @__PURE__ */ Z(
|
|
3632
|
+
children: [D ? /* @__PURE__ */ Z(Ie, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(ve, { className: "h-4 w-4 mr-1" }), y("detail.loadMore")]
|
|
3605
3633
|
})
|
|
3606
3634
|
})
|
|
3607
3635
|
]
|
|
3608
3636
|
})]
|
|
3609
3637
|
});
|
|
3610
|
-
},
|
|
3638
|
+
}, er = (e) => {
|
|
3611
3639
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3612
3640
|
return {
|
|
3613
3641
|
designer: {
|
|
@@ -3617,21 +3645,21 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3617
3645
|
},
|
|
3618
3646
|
rest: i
|
|
3619
3647
|
};
|
|
3620
|
-
},
|
|
3621
|
-
|
|
3622
|
-
let { designer: r } =
|
|
3648
|
+
}, tr = ({ schema: e = {}, className: t, ...n }) => {
|
|
3649
|
+
mt();
|
|
3650
|
+
let { designer: r } = er(n);
|
|
3623
3651
|
return /* @__PURE__ */ Z("div", {
|
|
3624
3652
|
className: t,
|
|
3625
3653
|
...r,
|
|
3626
|
-
children: /* @__PURE__ */ Z(
|
|
3654
|
+
children: /* @__PURE__ */ Z($n, {
|
|
3627
3655
|
items: [],
|
|
3628
3656
|
config: e
|
|
3629
3657
|
})
|
|
3630
3658
|
});
|
|
3631
|
-
},
|
|
3659
|
+
}, nr = ({ config: e, items: t, hasMore: n, onLoadMore: r, 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 }) => {
|
|
3632
3660
|
let _ = e?.position ?? "right", v = e?.width ?? "360px", y = e?.collapsible ?? !0, b = p && t.length === 0 || (e?.defaultCollapsed ?? !1), { t: S } = $(), [C, w] = i.useState(b);
|
|
3633
3661
|
return _ === "right" || _ === "left" ? C && y ? /* @__PURE__ */ Z("div", {
|
|
3634
|
-
className:
|
|
3662
|
+
className: W("flex items-start pt-4", _ === "right" ? "border-l" : "border-r", g),
|
|
3635
3663
|
children: /* @__PURE__ */ Z(x, {
|
|
3636
3664
|
variant: "ghost",
|
|
3637
3665
|
size: "icon",
|
|
@@ -3641,7 +3669,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3641
3669
|
children: /* @__PURE__ */ Z(He, { className: "h-4 w-4" })
|
|
3642
3670
|
})
|
|
3643
3671
|
}) : /* @__PURE__ */ Q("div", {
|
|
3644
|
-
className:
|
|
3672
|
+
className: W("flex flex-col overflow-hidden", _ === "right" ? "border-l" : "border-r", g),
|
|
3645
3673
|
style: {
|
|
3646
3674
|
width: v,
|
|
3647
3675
|
minWidth: v
|
|
@@ -3650,7 +3678,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3650
3678
|
className: "flex items-center justify-between px-4 py-3 border-b",
|
|
3651
3679
|
children: [/* @__PURE__ */ Q("div", {
|
|
3652
3680
|
className: "flex items-center gap-2",
|
|
3653
|
-
children: [/* @__PURE__ */ Z(
|
|
3681
|
+
children: [/* @__PURE__ */ Z(ze, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
3654
3682
|
className: "text-sm font-medium",
|
|
3655
3683
|
children: S("detail.discussion")
|
|
3656
3684
|
})]
|
|
@@ -3664,7 +3692,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3664
3692
|
})]
|
|
3665
3693
|
}), /* @__PURE__ */ Z("div", {
|
|
3666
3694
|
className: "flex-1 overflow-y-auto",
|
|
3667
|
-
children: /* @__PURE__ */ Z(
|
|
3695
|
+
children: /* @__PURE__ */ Z($n, {
|
|
3668
3696
|
items: t,
|
|
3669
3697
|
config: e?.feed,
|
|
3670
3698
|
hasMore: n,
|
|
@@ -3686,18 +3714,18 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3686
3714
|
})
|
|
3687
3715
|
})]
|
|
3688
3716
|
}) : /* @__PURE__ */ Z("div", {
|
|
3689
|
-
className:
|
|
3717
|
+
className: W("", g),
|
|
3690
3718
|
children: y && C ? /* @__PURE__ */ Q(x, {
|
|
3691
3719
|
variant: "ghost",
|
|
3692
3720
|
className: "w-full justify-start gap-2 text-muted-foreground",
|
|
3693
3721
|
onClick: () => w(!1),
|
|
3694
3722
|
"aria-label": S("detail.showDiscussion", { count: t.length }),
|
|
3695
|
-
children: [/* @__PURE__ */ Z(
|
|
3723
|
+
children: [/* @__PURE__ */ Z(ze, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: S("detail.showDiscussion", { count: t.length }) })]
|
|
3696
3724
|
}) : /* @__PURE__ */ Q("div", { children: [y && /* @__PURE__ */ Q("div", {
|
|
3697
3725
|
className: "flex items-center justify-between mb-2",
|
|
3698
3726
|
children: [/* @__PURE__ */ Q("div", {
|
|
3699
3727
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
3700
|
-
children: [/* @__PURE__ */ Z(
|
|
3728
|
+
children: [/* @__PURE__ */ Z(ze, { className: "h-4 w-4" }), S("detail.discussion")]
|
|
3701
3729
|
}), /* @__PURE__ */ Z(x, {
|
|
3702
3730
|
variant: "ghost",
|
|
3703
3731
|
size: "icon",
|
|
@@ -3706,7 +3734,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3706
3734
|
"aria-label": S("detail.hideDiscussion"),
|
|
3707
3735
|
children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
|
|
3708
3736
|
})]
|
|
3709
|
-
}), /* @__PURE__ */ Z(
|
|
3737
|
+
}), /* @__PURE__ */ Z($n, {
|
|
3710
3738
|
items: t,
|
|
3711
3739
|
config: e?.feed,
|
|
3712
3740
|
hasMore: n,
|
|
@@ -3726,7 +3754,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3726
3754
|
emptyLabel: S("detail.noCommentsYet")
|
|
3727
3755
|
})] })
|
|
3728
3756
|
});
|
|
3729
|
-
},
|
|
3757
|
+
}, rr = (e) => {
|
|
3730
3758
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3731
3759
|
return {
|
|
3732
3760
|
designer: {
|
|
@@ -3736,9 +3764,9 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3736
3764
|
},
|
|
3737
3765
|
rest: i
|
|
3738
3766
|
};
|
|
3739
|
-
},
|
|
3740
|
-
|
|
3741
|
-
let r =
|
|
3767
|
+
}, ir = ({ schema: e = {}, className: t, ...n }) => {
|
|
3768
|
+
mt();
|
|
3769
|
+
let r = ut(), { designer: i } = rr(n), a = {
|
|
3742
3770
|
position: "bottom",
|
|
3743
3771
|
collapsible: !1,
|
|
3744
3772
|
feed: {
|
|
@@ -3751,7 +3779,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3751
3779
|
return /* @__PURE__ */ Z("div", {
|
|
3752
3780
|
className: t,
|
|
3753
3781
|
...i,
|
|
3754
|
-
children: /* @__PURE__ */ Z(
|
|
3782
|
+
children: /* @__PURE__ */ Z(nr, {
|
|
3755
3783
|
items: r?.items || [],
|
|
3756
3784
|
config: a,
|
|
3757
3785
|
onAddComment: r?.onAddComment,
|
|
@@ -3761,7 +3789,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3761
3789
|
onUploadAttachments: r?.onUploadAttachments
|
|
3762
3790
|
})
|
|
3763
3791
|
});
|
|
3764
|
-
},
|
|
3792
|
+
}, ar = (e) => {
|
|
3765
3793
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3766
3794
|
return {
|
|
3767
3795
|
designer: {
|
|
@@ -3771,8 +3799,8 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3771
3799
|
},
|
|
3772
3800
|
rest: i
|
|
3773
3801
|
};
|
|
3774
|
-
},
|
|
3775
|
-
let r =
|
|
3802
|
+
}, or = ({ schema: e = {}, className: t, ...n }) => {
|
|
3803
|
+
let r = mt(), { translateOptions: i } = _t(), { designer: o } = ar(n), s = Array.isArray(e.stages) ? e.stages : [], c = e.statusField, l = a.useMemo(() => {
|
|
3776
3804
|
if (s.length === 0 || !c || !r?.objectName) return s;
|
|
3777
3805
|
let e = i(r.objectName, c, s);
|
|
3778
3806
|
return Array.isArray(e) && e.length === s.length ? s.map((t, n) => ({
|
|
@@ -3802,7 +3830,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3802
3830
|
});
|
|
3803
3831
|
let b = h.length - 1;
|
|
3804
3832
|
return /* @__PURE__ */ Q("div", {
|
|
3805
|
-
className:
|
|
3833
|
+
className: W("w-full", t),
|
|
3806
3834
|
...o,
|
|
3807
3835
|
children: [/* @__PURE__ */ Q("div", {
|
|
3808
3836
|
className: "hidden sm:flex w-full items-stretch gap-2",
|
|
@@ -3815,7 +3843,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3815
3843
|
return /* @__PURE__ */ Z("div", {
|
|
3816
3844
|
role: "listitem",
|
|
3817
3845
|
"aria-current": r ? "step" : void 0,
|
|
3818
|
-
className:
|
|
3846
|
+
className: W("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"),
|
|
3819
3847
|
children: /* @__PURE__ */ Q("span", {
|
|
3820
3848
|
className: "inline-flex items-center justify-center gap-1.5 truncate",
|
|
3821
3849
|
children: [
|
|
@@ -3842,7 +3870,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3842
3870
|
return /* @__PURE__ */ Z("div", {
|
|
3843
3871
|
role: "listitem",
|
|
3844
3872
|
"aria-current": n ? "step" : void 0,
|
|
3845
|
-
className:
|
|
3873
|
+
className: W("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"),
|
|
3846
3874
|
children: /* @__PURE__ */ Q("span", {
|
|
3847
3875
|
className: "inline-flex items-center gap-1",
|
|
3848
3876
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -3863,7 +3891,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3863
3891
|
return /* @__PURE__ */ Z("div", {
|
|
3864
3892
|
role: "listitem",
|
|
3865
3893
|
"aria-current": i ? "step" : void 0,
|
|
3866
|
-
className:
|
|
3894
|
+
className: W("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"),
|
|
3867
3895
|
children: /* @__PURE__ */ Q("span", {
|
|
3868
3896
|
className: "inline-flex items-center gap-1",
|
|
3869
3897
|
children: [
|
|
@@ -3884,7 +3912,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3884
3912
|
})
|
|
3885
3913
|
})]
|
|
3886
3914
|
});
|
|
3887
|
-
},
|
|
3915
|
+
}, sr = (e) => {
|
|
3888
3916
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3889
3917
|
return {
|
|
3890
3918
|
designer: {
|
|
@@ -3894,8 +3922,8 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3894
3922
|
},
|
|
3895
3923
|
rest: i
|
|
3896
3924
|
};
|
|
3897
|
-
},
|
|
3898
|
-
let r =
|
|
3925
|
+
}, cr = ({ schema: e = {}, className: t, ...n }) => {
|
|
3926
|
+
let r = mt(), { designer: i } = sr(n), a = kt(), 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 } = ft("object", u ? c : null), f = u ? (() => {
|
|
3899
3927
|
let e = Array.isArray(d?.actions) ? d.actions : [], t = new Map(e.map((e) => [e.name, e]));
|
|
3900
3928
|
return l.map((e) => t.get(e)).filter((e) => !!e);
|
|
3901
3929
|
})() : Array.isArray(o) ? o : [], p = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
@@ -3927,11 +3955,11 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3927
3955
|
});
|
|
3928
3956
|
let v = e.align || "end", y = v === "start" ? "justify-start" : v === "center" ? "justify-center" : "justify-end";
|
|
3929
3957
|
return /* @__PURE__ */ Z("div", {
|
|
3930
|
-
className:
|
|
3958
|
+
className: W("flex flex-wrap items-center gap-2", m === "record_header" && !e.inline && "-mt-12 sm:-mt-14 mb-2 relative z-10", y, t),
|
|
3931
3959
|
role: "toolbar",
|
|
3932
3960
|
"aria-label": e.aria?.label || "Quick actions",
|
|
3933
3961
|
...i,
|
|
3934
|
-
children: _.map((t, n) => /* @__PURE__ */ Z(
|
|
3962
|
+
children: _.map((t, n) => /* @__PURE__ */ Z(lr, {
|
|
3935
3963
|
action: t,
|
|
3936
3964
|
record: r?.data,
|
|
3937
3965
|
variant: t.variant || e.variant || "default",
|
|
@@ -3943,7 +3971,7 @@ var Qn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3943
3971
|
}, t.name || `qa-${n}`))
|
|
3944
3972
|
});
|
|
3945
3973
|
};
|
|
3946
|
-
function
|
|
3974
|
+
function lr({ action: e, record: t, variant: n, size: r, label: i, onRun: o }) {
|
|
3947
3975
|
let [s, c] = a.useState(!1), l = a.useMemo(() => ({ record: t || {} }), [t]), u = ot(e.disabled), d = ct(typeof u == "string" ? u : void 0, l);
|
|
3948
3976
|
return /* @__PURE__ */ Q(x, {
|
|
3949
3977
|
variant: n,
|
|
@@ -3957,12 +3985,12 @@ function cr({ action: e, record: t, variant: n, size: r, label: i, onRun: o }) {
|
|
|
3957
3985
|
c(!1);
|
|
3958
3986
|
}
|
|
3959
3987
|
},
|
|
3960
|
-
children: [s && /* @__PURE__ */ Z(
|
|
3988
|
+
children: [s && /* @__PURE__ */ Z(Ie, { className: "mr-2 h-4 w-4 animate-spin" }), i]
|
|
3961
3989
|
});
|
|
3962
3990
|
}
|
|
3963
3991
|
//#endregion
|
|
3964
3992
|
//#region src/renderers/record-history.tsx
|
|
3965
|
-
var
|
|
3993
|
+
var ur = (e) => {
|
|
3966
3994
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3967
3995
|
return {
|
|
3968
3996
|
designer: {
|
|
@@ -3972,14 +4000,14 @@ var lr = (e) => {
|
|
|
3972
4000
|
},
|
|
3973
4001
|
rest: i
|
|
3974
4002
|
};
|
|
3975
|
-
},
|
|
4003
|
+
}, dr = /* @__PURE__ */ new Set([
|
|
3976
4004
|
"created",
|
|
3977
4005
|
"updated",
|
|
3978
4006
|
"assigned",
|
|
3979
4007
|
"shared",
|
|
3980
4008
|
"deleted"
|
|
3981
|
-
]),
|
|
3982
|
-
let { designer: r } =
|
|
4009
|
+
]), fr = ({ schema: e = {}, className: t, ...n }) => {
|
|
4010
|
+
let { designer: r } = ur(n), i = mt(), 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 = i?.objectName, d = i?.data?.id ?? i?.data?._id ?? i?.recordId, f = i?.dataSource, p = o === void 0 && !!f?.find && !!u && d != null, [m, h] = a.useState(null), [g, _] = a.useState(!1);
|
|
3983
4011
|
a.useEffect(() => {
|
|
3984
4012
|
if (!p) return;
|
|
3985
4013
|
let e = !1;
|
|
@@ -3991,7 +4019,8 @@ var lr = (e) => {
|
|
|
3991
4019
|
$orderby: { timestamp: "desc" },
|
|
3992
4020
|
$top: Math.max(1, l)
|
|
3993
4021
|
})).then((t) => {
|
|
3994
|
-
|
|
4022
|
+
if (e) return;
|
|
4023
|
+
let n = (t?.data ?? t?.records ?? []).filter((e) => dr.has(e?.type)).map((e) => {
|
|
3995
4024
|
let t = e.timestamp;
|
|
3996
4025
|
return (!t || t === "NOW()" || Number.isNaN(Date.parse(t))) && (t = e.created_at), {
|
|
3997
4026
|
id: e.id,
|
|
@@ -4001,7 +4030,8 @@ var lr = (e) => {
|
|
|
4001
4030
|
user_avatar: e.actor_avatar_url ?? null,
|
|
4002
4031
|
summary: e.summary ?? null
|
|
4003
4032
|
};
|
|
4004
|
-
})
|
|
4033
|
+
});
|
|
4034
|
+
h(n);
|
|
4005
4035
|
}).catch(() => {
|
|
4006
4036
|
e || h([]);
|
|
4007
4037
|
}).finally(() => {
|
|
@@ -4020,13 +4050,13 @@ var lr = (e) => {
|
|
|
4020
4050
|
return /* @__PURE__ */ Z("div", {
|
|
4021
4051
|
className: t,
|
|
4022
4052
|
...r,
|
|
4023
|
-
children: /* @__PURE__ */ Z(
|
|
4053
|
+
children: /* @__PURE__ */ Z(fn, {
|
|
4024
4054
|
entries: v,
|
|
4025
4055
|
loading: y,
|
|
4026
4056
|
emptyText: c
|
|
4027
4057
|
})
|
|
4028
4058
|
});
|
|
4029
|
-
},
|
|
4059
|
+
}, pr = (e) => {
|
|
4030
4060
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
4031
4061
|
return {
|
|
4032
4062
|
designer: {
|
|
@@ -4036,8 +4066,8 @@ var lr = (e) => {
|
|
|
4036
4066
|
},
|
|
4037
4067
|
rest: i
|
|
4038
4068
|
};
|
|
4039
|
-
},
|
|
4040
|
-
let r =
|
|
4069
|
+
}, mr = (e) => e.replace(/[_-]+/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()).trim(), hr = (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 || "—", gr = ({ schema: e = {}, className: t, ...n }) => {
|
|
4070
|
+
let r = mt(), i = _t(), { t: o } = $(), { designer: s } = pr(n), c = Nt().appName, l = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : [], u = r?.recordId, d = r?.dataSource, [f, p] = a.useState({}), m = a.useRef(null), [h, g] = a.useState(!1), _ = a.useRef(!0);
|
|
4041
4071
|
a.useEffect(() => (_.current = !0, () => {
|
|
4042
4072
|
_.current = !1;
|
|
4043
4073
|
}), []);
|
|
@@ -4117,11 +4147,11 @@ var lr = (e) => {
|
|
|
4117
4147
|
return x && t && !t.loading && !t.error && t.total === 0;
|
|
4118
4148
|
}).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 || (i?.objectLabel ? i.objectLabel({
|
|
4119
4149
|
name: e.objectName,
|
|
4120
|
-
label:
|
|
4121
|
-
}) :
|
|
4150
|
+
label: mr(e.objectName)
|
|
4151
|
+
}) : mr(e.objectName)));
|
|
4122
4152
|
return /* @__PURE__ */ Q("div", {
|
|
4123
4153
|
ref: m,
|
|
4124
|
-
className:
|
|
4154
|
+
className: W("flex flex-col gap-3", e.className, t),
|
|
4125
4155
|
...s,
|
|
4126
4156
|
children: [k.map((e) => {
|
|
4127
4157
|
let t = e.objectName, n = f[t] || {
|
|
@@ -4137,15 +4167,15 @@ var lr = (e) => {
|
|
|
4137
4167
|
className: "text-sm font-semibold tracking-tight truncate",
|
|
4138
4168
|
children: e.title || (i?.objectLabel ? i.objectLabel({
|
|
4139
4169
|
name: e.objectName,
|
|
4140
|
-
label:
|
|
4141
|
-
}) :
|
|
4170
|
+
label: mr(e.objectName)
|
|
4171
|
+
}) : mr(e.objectName))
|
|
4142
4172
|
}), /* @__PURE__ */ Q("div", {
|
|
4143
4173
|
className: "flex items-center gap-2 shrink-0",
|
|
4144
4174
|
children: [!n.loading && /* @__PURE__ */ Z(b, {
|
|
4145
4175
|
variant: "secondary",
|
|
4146
4176
|
className: "tabular-nums",
|
|
4147
4177
|
children: n.total
|
|
4148
|
-
}), c && u && /* @__PURE__ */ Z(
|
|
4178
|
+
}), c && u && /* @__PURE__ */ Z(Mt, {
|
|
4149
4179
|
to: `/apps/${c}/${e.objectName}?filter%5B${e.relationshipField}%5D=${encodeURIComponent(String(u))}`,
|
|
4150
4180
|
className: "text-[11px] font-medium text-muted-foreground hover:text-foreground transition-colors",
|
|
4151
4181
|
title: o("detail.viewAll", { defaultValue: "View all" }),
|
|
@@ -4157,9 +4187,9 @@ var lr = (e) => {
|
|
|
4157
4187
|
children: n.loading ? /* @__PURE__ */ Q("div", {
|
|
4158
4188
|
className: "space-y-1.5 p-3",
|
|
4159
4189
|
children: [
|
|
4160
|
-
/* @__PURE__ */ Z(
|
|
4161
|
-
/* @__PURE__ */ Z(
|
|
4162
|
-
/* @__PURE__ */ Z(
|
|
4190
|
+
/* @__PURE__ */ Z(F, { className: "h-3.5 w-4/5" }),
|
|
4191
|
+
/* @__PURE__ */ Z(F, { className: "h-3.5 w-3/5" }),
|
|
4192
|
+
/* @__PURE__ */ Z(F, { className: "h-3.5 w-2/3" })
|
|
4163
4193
|
]
|
|
4164
4194
|
}) : n.items.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
4165
4195
|
className: "px-4 py-3 text-xs text-muted-foreground",
|
|
@@ -4167,10 +4197,10 @@ var lr = (e) => {
|
|
|
4167
4197
|
}) : /* @__PURE__ */ Z("ul", {
|
|
4168
4198
|
className: "divide-y",
|
|
4169
4199
|
children: n.items.map((t) => {
|
|
4170
|
-
let n = t.id || t._id, r =
|
|
4200
|
+
let n = t.id || t._id, r = hr(t, e.displayField), i = n ? `../${e.objectName}/record/${encodeURIComponent(String(n))}` : void 0;
|
|
4171
4201
|
return /* @__PURE__ */ Z("li", {
|
|
4172
4202
|
className: "px-4 py-2",
|
|
4173
|
-
children: i ? /* @__PURE__ */ Q(
|
|
4203
|
+
children: i ? /* @__PURE__ */ Q(Mt, {
|
|
4174
4204
|
to: i,
|
|
4175
4205
|
className: "group flex items-center justify-between gap-2 text-xs hover:text-foreground text-muted-foreground transition-colors",
|
|
4176
4206
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -4204,7 +4234,7 @@ var lr = (e) => {
|
|
|
4204
4234
|
})]
|
|
4205
4235
|
})]
|
|
4206
4236
|
});
|
|
4207
|
-
},
|
|
4237
|
+
}, _r = {
|
|
4208
4238
|
info: {
|
|
4209
4239
|
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",
|
|
4210
4240
|
icon: "Info"
|
|
@@ -4222,20 +4252,20 @@ var lr = (e) => {
|
|
|
4222
4252
|
icon: "CheckCircle2"
|
|
4223
4253
|
}
|
|
4224
4254
|
};
|
|
4225
|
-
function
|
|
4255
|
+
function vr(e) {
|
|
4226
4256
|
let t = e?.properties ?? {};
|
|
4227
4257
|
return {
|
|
4228
4258
|
...e,
|
|
4229
4259
|
...t
|
|
4230
4260
|
};
|
|
4231
4261
|
}
|
|
4232
|
-
var
|
|
4233
|
-
let n =
|
|
4262
|
+
var yr = ({ schema: e = {}, className: t }) => {
|
|
4263
|
+
let n = vr(e), r = mt(), a = r?.data, c = r?.objectName || "", l = r?.recordId ?? a?.id, u = [
|
|
4234
4264
|
"info",
|
|
4235
4265
|
"warning",
|
|
4236
4266
|
"error",
|
|
4237
4267
|
"success"
|
|
4238
|
-
].includes(n.severity) ? n.severity : "info", d =
|
|
4268
|
+
].includes(n.severity) ? n.severity : "info", d = _r[u], f = n.icon || d.icon, p = ot(n.visible), m = ct(p, { record: a }), h = i.useMemo(() => {
|
|
4239
4269
|
if (!n.dismissible) return null;
|
|
4240
4270
|
let e = n.dismissKey || n.title || u;
|
|
4241
4271
|
return `os.record-alert:${c}:${l ?? "_"}:${e}`;
|
|
@@ -4253,7 +4283,7 @@ var vr = ({ schema: e = {}, className: t }) => {
|
|
|
4253
4283
|
} catch {
|
|
4254
4284
|
return !1;
|
|
4255
4285
|
}
|
|
4256
|
-
}), y = n.action?.actionName, { item: b } =
|
|
4286
|
+
}), y = n.action?.actionName, { item: b } = ft("object", y && c ? c : null), S = i.useMemo(() => {
|
|
4257
4287
|
if (!(!y || !b?.actions)) return b.actions.find((e) => e.name === y);
|
|
4258
4288
|
}, [y, b]), { executeAction: C } = st({
|
|
4259
4289
|
actions: i.useMemo(() => S ? [S] : [], [S]),
|
|
@@ -4264,7 +4294,7 @@ var vr = ({ schema: e = {}, className: t }) => {
|
|
|
4264
4294
|
}
|
|
4265
4295
|
});
|
|
4266
4296
|
return _ || !a || Object.keys(a).length === 0 || p !== void 0 && !m ? null : /* @__PURE__ */ Q(o, {
|
|
4267
|
-
className:
|
|
4297
|
+
className: W("relative pr-12", d.wrap, t),
|
|
4268
4298
|
role: u === "error" ? "alert" : "status",
|
|
4269
4299
|
"aria-live": u === "error" ? "assertive" : "polite",
|
|
4270
4300
|
children: [
|
|
@@ -4302,7 +4332,7 @@ var vr = ({ schema: e = {}, className: t }) => {
|
|
|
4302
4332
|
}) : null
|
|
4303
4333
|
]
|
|
4304
4334
|
});
|
|
4305
|
-
},
|
|
4335
|
+
}, br = /* @__PURE__ */ new Set([
|
|
4306
4336
|
"id",
|
|
4307
4337
|
"_id",
|
|
4308
4338
|
"__v",
|
|
@@ -4317,15 +4347,15 @@ var vr = ({ schema: e = {}, className: t }) => {
|
|
|
4317
4347
|
"owner_id",
|
|
4318
4348
|
"deleted_at",
|
|
4319
4349
|
"is_deleted"
|
|
4320
|
-
]),
|
|
4321
|
-
function
|
|
4350
|
+
]), xr = 480, Sr = 95;
|
|
4351
|
+
function Cr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId: o, dataSource: s, objectSchema: c, width: l = "min(960px, 60vw)", columns: u = 2, systemFields: d = br, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
|
|
4322
4352
|
let { t: g } = $(), _ = `objectui.drawerWidth.${i}`, [v, y] = a.useState(() => {
|
|
4323
4353
|
if (typeof window > "u" || !m) return null;
|
|
4324
4354
|
try {
|
|
4325
4355
|
let e = window.localStorage.getItem(_);
|
|
4326
4356
|
if (e) {
|
|
4327
4357
|
let t = parseInt(e, 10);
|
|
4328
|
-
if (Number.isFinite(t) && t >=
|
|
4358
|
+
if (Number.isFinite(t) && t >= xr) return t;
|
|
4329
4359
|
}
|
|
4330
4360
|
} catch {}
|
|
4331
4361
|
return null;
|
|
@@ -4347,7 +4377,7 @@ function Sr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4347
4377
|
let n = (e) => {
|
|
4348
4378
|
let t = S.current;
|
|
4349
4379
|
if (!t) return;
|
|
4350
|
-
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth *
|
|
4380
|
+
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * Sr / 100 : 1600, i = Math.min(r, Math.max(xr, t.startWidth + n));
|
|
4351
4381
|
y(Math.round(i));
|
|
4352
4382
|
}, r = () => {
|
|
4353
4383
|
S.current, S.current = null, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r);
|
|
@@ -4380,12 +4410,12 @@ function Sr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4380
4410
|
description: t.description
|
|
4381
4411
|
};
|
|
4382
4412
|
});
|
|
4383
|
-
return /* @__PURE__ */ Z(
|
|
4413
|
+
return /* @__PURE__ */ Z(ne, {
|
|
4384
4414
|
open: e,
|
|
4385
4415
|
onOpenChange: (e) => {
|
|
4386
4416
|
e || t();
|
|
4387
4417
|
},
|
|
4388
|
-
children: /* @__PURE__ */ Q(
|
|
4418
|
+
children: /* @__PURE__ */ Q(re, {
|
|
4389
4419
|
side: "right",
|
|
4390
4420
|
className: "w-full overflow-y-auto p-0 sm:!max-w-none",
|
|
4391
4421
|
style: x,
|
|
@@ -4398,13 +4428,13 @@ function Sr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4398
4428
|
onPointerDown: C,
|
|
4399
4429
|
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"
|
|
4400
4430
|
}),
|
|
4401
|
-
/* @__PURE__ */ Z(
|
|
4431
|
+
/* @__PURE__ */ Z(ie, {
|
|
4402
4432
|
className: "sr-only",
|
|
4403
|
-
children: /* @__PURE__ */ Z(
|
|
4433
|
+
children: /* @__PURE__ */ Z(ae, { children: n })
|
|
4404
4434
|
}),
|
|
4405
4435
|
/* @__PURE__ */ Z("div", {
|
|
4406
4436
|
className: "px-6 pt-6 pb-6",
|
|
4407
|
-
children: /* @__PURE__ */ Z(
|
|
4437
|
+
children: /* @__PURE__ */ Z(Sn, {
|
|
4408
4438
|
dataSource: s,
|
|
4409
4439
|
inlineEdit: !0,
|
|
4410
4440
|
schema: {
|
|
@@ -4447,14 +4477,14 @@ function Sr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4447
4477
|
})
|
|
4448
4478
|
});
|
|
4449
4479
|
}
|
|
4450
|
-
function
|
|
4480
|
+
function wr(e, t) {
|
|
4451
4481
|
if (typeof window > "u") return null;
|
|
4452
4482
|
let n = window.location.pathname, r = `/${e}`, i = n.indexOf(r);
|
|
4453
4483
|
return `${i >= 0 ? n.slice(0, i) : n.replace(/\/$/, "")}/${e}/record/${encodeURIComponent(String(t))}`;
|
|
4454
4484
|
}
|
|
4455
4485
|
//#endregion
|
|
4456
4486
|
//#region src/InlineCreateRelated.tsx
|
|
4457
|
-
var
|
|
4487
|
+
var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
|
|
4458
4488
|
let [l, u] = i.useState(!1), [d, f] = i.useState("create"), [p, m] = i.useState({}), [h, g] = i.useState(""), [_, v] = i.useState(s), [y, b] = i.useState(!1), [E, D] = i.useState(!1), O = i.useMemo(() => {
|
|
4459
4489
|
if (!h.trim()) return _;
|
|
4460
4490
|
let e = h.toLowerCase();
|
|
@@ -4463,7 +4493,8 @@ var wr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4463
4493
|
if (g(e), o && e.trim().length >= 2) {
|
|
4464
4494
|
D(!0);
|
|
4465
4495
|
try {
|
|
4466
|
-
|
|
4496
|
+
let t = await o(e);
|
|
4497
|
+
v(t);
|
|
4467
4498
|
} finally {
|
|
4468
4499
|
D(!1);
|
|
4469
4500
|
}
|
|
@@ -4498,9 +4529,9 @@ var wr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4498
4529
|
b(!1);
|
|
4499
4530
|
}
|
|
4500
4531
|
}
|
|
4501
|
-
}, [a]),
|
|
4532
|
+
}, [a]), P = i.useMemo(() => n.filter((e) => e.required).every((e) => p[e.name]?.toString().trim()), [n, p]);
|
|
4502
4533
|
return l ? /* @__PURE__ */ Q(S, {
|
|
4503
|
-
className:
|
|
4534
|
+
className: W("", c),
|
|
4504
4535
|
children: [/* @__PURE__ */ Z(w, {
|
|
4505
4536
|
className: "pb-3",
|
|
4506
4537
|
children: /* @__PURE__ */ Q(T, {
|
|
@@ -4517,23 +4548,23 @@ var wr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4517
4548
|
children: /* @__PURE__ */ Z(nt, { className: "h-3.5 w-3.5" })
|
|
4518
4549
|
})]
|
|
4519
4550
|
})
|
|
4520
|
-
}), /* @__PURE__ */ Z(C, { children: /* @__PURE__ */ Q(
|
|
4551
|
+
}), /* @__PURE__ */ Z(C, { children: /* @__PURE__ */ Q(I, {
|
|
4521
4552
|
value: d,
|
|
4522
4553
|
onValueChange: f,
|
|
4523
4554
|
children: [
|
|
4524
|
-
/* @__PURE__ */ Q(
|
|
4555
|
+
/* @__PURE__ */ Q(R, {
|
|
4525
4556
|
className: "mb-3 w-full",
|
|
4526
|
-
children: [r && /* @__PURE__ */ Q(
|
|
4557
|
+
children: [r && /* @__PURE__ */ Q(z, {
|
|
4527
4558
|
value: "create",
|
|
4528
4559
|
className: "flex-1 gap-1.5",
|
|
4529
4560
|
children: [/* @__PURE__ */ Z(Ke, { className: "h-3.5 w-3.5" }), "Create New"]
|
|
4530
|
-
}), a && /* @__PURE__ */ Q(
|
|
4561
|
+
}), a && /* @__PURE__ */ Q(z, {
|
|
4531
4562
|
value: "link",
|
|
4532
4563
|
className: "flex-1 gap-1.5",
|
|
4533
|
-
children: [/* @__PURE__ */ Z(
|
|
4564
|
+
children: [/* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
4534
4565
|
})]
|
|
4535
4566
|
}),
|
|
4536
|
-
r && /* @__PURE__ */ Q(
|
|
4567
|
+
r && /* @__PURE__ */ Q(L, {
|
|
4537
4568
|
value: "create",
|
|
4538
4569
|
className: "space-y-3 mt-0",
|
|
4539
4570
|
children: [n.map((e) => /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("label", {
|
|
@@ -4558,13 +4589,13 @@ var wr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4558
4589
|
}), /* @__PURE__ */ Q(x, {
|
|
4559
4590
|
size: "sm",
|
|
4560
4591
|
onClick: M,
|
|
4561
|
-
disabled: !
|
|
4592
|
+
disabled: !P || y,
|
|
4562
4593
|
className: "gap-1.5",
|
|
4563
|
-
children: [y && /* @__PURE__ */ Z(
|
|
4594
|
+
children: [y && /* @__PURE__ */ Z(Ie, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
|
|
4564
4595
|
})]
|
|
4565
4596
|
})]
|
|
4566
4597
|
}),
|
|
4567
|
-
a && /* @__PURE__ */ Q(
|
|
4598
|
+
a && /* @__PURE__ */ Q(L, {
|
|
4568
4599
|
value: "link",
|
|
4569
4600
|
className: "space-y-3 mt-0",
|
|
4570
4601
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -4579,7 +4610,7 @@ var wr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4579
4610
|
className: "max-h-48 overflow-y-auto space-y-1",
|
|
4580
4611
|
children: E ? /* @__PURE__ */ Q("div", {
|
|
4581
4612
|
className: "flex items-center justify-center py-4 text-sm text-muted-foreground",
|
|
4582
|
-
children: [/* @__PURE__ */ Z(
|
|
4613
|
+
children: [/* @__PURE__ */ Z(Ie, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
|
|
4583
4614
|
}) : O.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
4584
4615
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
4585
4616
|
children: h ? "No records found" : "Type to search records"
|
|
@@ -4601,7 +4632,7 @@ var wr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4601
4632
|
]
|
|
4602
4633
|
}) })]
|
|
4603
4634
|
}) : /* @__PURE__ */ Q("div", {
|
|
4604
|
-
className:
|
|
4635
|
+
className: W("flex gap-2", c),
|
|
4605
4636
|
children: [r && /* @__PURE__ */ Q(x, {
|
|
4606
4637
|
variant: "outline",
|
|
4607
4638
|
size: "sm",
|
|
@@ -4621,13 +4652,13 @@ var wr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4621
4652
|
f("link"), u(!0);
|
|
4622
4653
|
},
|
|
4623
4654
|
className: "gap-1.5",
|
|
4624
|
-
children: [/* @__PURE__ */ Z(
|
|
4655
|
+
children: [/* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
4625
4656
|
})]
|
|
4626
4657
|
});
|
|
4627
4658
|
};
|
|
4628
4659
|
//#endregion
|
|
4629
4660
|
//#region src/DiffView.tsx
|
|
4630
|
-
function
|
|
4661
|
+
function Er(e, t) {
|
|
4631
4662
|
if (e == null) return ["(empty)"];
|
|
4632
4663
|
switch (t) {
|
|
4633
4664
|
case "json": try {
|
|
@@ -4646,7 +4677,7 @@ function Tr(e, t) {
|
|
|
4646
4677
|
default: return String(e).split("\n");
|
|
4647
4678
|
}
|
|
4648
4679
|
}
|
|
4649
|
-
function
|
|
4680
|
+
function Dr(e, t) {
|
|
4650
4681
|
let n = [], r = Math.max(e.length, t.length);
|
|
4651
4682
|
for (let i = 0; i < r; i++) {
|
|
4652
4683
|
let r = i < e.length ? e[i] : void 0, a = i < t.length ? t[i] : void 0;
|
|
@@ -4663,16 +4694,16 @@ function Er(e, t) {
|
|
|
4663
4694
|
}
|
|
4664
4695
|
return n;
|
|
4665
4696
|
}
|
|
4666
|
-
var
|
|
4697
|
+
var Or = {
|
|
4667
4698
|
added: "bg-green-50 text-green-800 dark:bg-green-950/30 dark:text-green-300",
|
|
4668
4699
|
removed: "bg-red-50 text-red-800 dark:bg-red-950/30 dark:text-red-300",
|
|
4669
4700
|
unchanged: "text-muted-foreground"
|
|
4670
|
-
},
|
|
4701
|
+
}, kr = {
|
|
4671
4702
|
added: "+",
|
|
4672
4703
|
removed: "-",
|
|
4673
4704
|
unchanged: " "
|
|
4674
|
-
},
|
|
4675
|
-
let { t: s } = $(), [c, l] = i.useState(a), u = i.useMemo(() =>
|
|
4705
|
+
}, Ar = ({ oldValue: e, newValue: t, fieldName: n, fieldType: r = "string", mode: a = "unified", className: o }) => {
|
|
4706
|
+
let { t: s } = $(), [c, l] = i.useState(a), u = i.useMemo(() => Er(e, r), [e, r]), d = i.useMemo(() => Er(t, r), [t, r]), f = i.useMemo(() => Dr(u, d), [u, d]), p = f.some((e) => e.type !== "unchanged"), m = i.useMemo(() => {
|
|
4676
4707
|
if (c !== "side-by-side") return [];
|
|
4677
4708
|
let e = [], t = 0;
|
|
4678
4709
|
for (; t < f.length;) {
|
|
@@ -4698,7 +4729,7 @@ var Dr = {
|
|
|
4698
4729
|
return e;
|
|
4699
4730
|
}, [c, f]);
|
|
4700
4731
|
return /* @__PURE__ */ Q(S, {
|
|
4701
|
-
className:
|
|
4732
|
+
className: W("overflow-hidden", o),
|
|
4702
4733
|
children: [/* @__PURE__ */ Z(w, {
|
|
4703
4734
|
className: "pb-2",
|
|
4704
4735
|
children: /* @__PURE__ */ Q(T, {
|
|
@@ -4730,10 +4761,10 @@ var Dr = {
|
|
|
4730
4761
|
children: p ? c === "unified" ? /* @__PURE__ */ Z("div", {
|
|
4731
4762
|
className: "font-mono text-xs overflow-x-auto",
|
|
4732
4763
|
children: f.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
4733
|
-
className:
|
|
4764
|
+
className: W("px-4 py-0.5 whitespace-pre-wrap border-l-2", Or[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
|
|
4734
4765
|
children: [/* @__PURE__ */ Z("span", {
|
|
4735
4766
|
className: "select-none mr-2 inline-block w-3 text-center opacity-60",
|
|
4736
|
-
children:
|
|
4767
|
+
children: kr[e.type]
|
|
4737
4768
|
}), e.value]
|
|
4738
4769
|
}, t))
|
|
4739
4770
|
}) : /* @__PURE__ */ Z("div", {
|
|
@@ -4750,10 +4781,10 @@ var Dr = {
|
|
|
4750
4781
|
children: s("detail.currentVersion")
|
|
4751
4782
|
}),
|
|
4752
4783
|
m.map((e, t) => /* @__PURE__ */ Q(i.Fragment, { children: [/* @__PURE__ */ Z("div", {
|
|
4753
|
-
className:
|
|
4784
|
+
className: W("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? Or[e.left.type] : "bg-muted/20"),
|
|
4754
4785
|
children: e.left?.value ?? ""
|
|
4755
4786
|
}), /* @__PURE__ */ Z("div", {
|
|
4756
|
-
className:
|
|
4787
|
+
className: W("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? Or[e.right.type] : "bg-muted/20"),
|
|
4757
4788
|
children: e.right?.value ?? ""
|
|
4758
4789
|
})] }, t))
|
|
4759
4790
|
]
|
|
@@ -4764,7 +4795,7 @@ var Dr = {
|
|
|
4764
4795
|
})
|
|
4765
4796
|
})]
|
|
4766
4797
|
});
|
|
4767
|
-
},
|
|
4798
|
+
}, jr = ({ currentIndex: e, totalRecords: t, recordIds: n, onNavigate: r, onSearch: a, className: o }) => {
|
|
4768
4799
|
let { t: s } = $(), [c, l] = i.useState(""), [u, d] = i.useState(!1), f = i.useRef(null), p = e > 0, m = e > 0, h = e < t - 1, g = e < t - 1, _ = i.useCallback(() => {
|
|
4769
4800
|
p && r(n[0]);
|
|
4770
4801
|
}, [
|
|
@@ -4832,7 +4863,7 @@ var Dr = {
|
|
|
4832
4863
|
r,
|
|
4833
4864
|
a
|
|
4834
4865
|
]), /* @__PURE__ */ Q("div", {
|
|
4835
|
-
className:
|
|
4866
|
+
className: W("flex items-center gap-1.5", o),
|
|
4836
4867
|
children: [
|
|
4837
4868
|
/* @__PURE__ */ Z(x, {
|
|
4838
4869
|
variant: "outline",
|
|
@@ -4877,7 +4908,7 @@ var Dr = {
|
|
|
4877
4908
|
title: s("detail.lastRecord"),
|
|
4878
4909
|
children: /* @__PURE__ */ Z(Se, { className: "h-4 w-4" })
|
|
4879
4910
|
}),
|
|
4880
|
-
a && /* @__PURE__ */ Q(
|
|
4911
|
+
a && /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z(x, {
|
|
4881
4912
|
variant: u ? "secondary" : "ghost",
|
|
4882
4913
|
size: "icon",
|
|
4883
4914
|
className: "h-8 w-8",
|
|
@@ -4897,18 +4928,18 @@ var Dr = {
|
|
|
4897
4928
|
})] })
|
|
4898
4929
|
]
|
|
4899
4930
|
});
|
|
4900
|
-
},
|
|
4931
|
+
}, Mr = 28, Nr = [
|
|
4901
4932
|
"fill-primary stroke-primary",
|
|
4902
4933
|
"fill-blue-500 stroke-blue-500",
|
|
4903
4934
|
"fill-emerald-500 stroke-emerald-500",
|
|
4904
4935
|
"fill-amber-500 stroke-amber-500"
|
|
4905
|
-
],
|
|
4936
|
+
], Pr = [
|
|
4906
4937
|
"fill-primary-foreground",
|
|
4907
4938
|
"fill-white",
|
|
4908
4939
|
"fill-white",
|
|
4909
4940
|
"fill-white"
|
|
4910
4941
|
];
|
|
4911
|
-
function
|
|
4942
|
+
function Fr(e, t, n, r, i) {
|
|
4912
4943
|
let a = [], o = [], s = /* @__PURE__ */ new Set(), c = r / 2, l = i / 2;
|
|
4913
4944
|
a.push({
|
|
4914
4945
|
id: e.id,
|
|
@@ -4972,10 +5003,10 @@ function Pr(e, t, n, r, i) {
|
|
|
4972
5003
|
edges: o
|
|
4973
5004
|
};
|
|
4974
5005
|
}
|
|
4975
|
-
function
|
|
5006
|
+
function Ir(e, t = 6) {
|
|
4976
5007
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
4977
5008
|
}
|
|
4978
|
-
var
|
|
5009
|
+
var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, className: a }) => {
|
|
4979
5010
|
let o = i.useRef(null), [s, c] = i.useState({
|
|
4980
5011
|
width: 500,
|
|
4981
5012
|
height: 400
|
|
@@ -4996,14 +5027,14 @@ var Ir = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
4996
5027
|
});
|
|
4997
5028
|
return n.observe(t), () => n.disconnect();
|
|
4998
5029
|
}, []);
|
|
4999
|
-
let { nodes: d, edges: f } = i.useMemo(() =>
|
|
5030
|
+
let { nodes: d, edges: f } = i.useMemo(() => Fr(e, t, n, s.width, s.height), [
|
|
5000
5031
|
e,
|
|
5001
5032
|
t,
|
|
5002
5033
|
n,
|
|
5003
5034
|
s
|
|
5004
5035
|
]);
|
|
5005
5036
|
return /* @__PURE__ */ Q(S, {
|
|
5006
|
-
className:
|
|
5037
|
+
className: W("overflow-hidden", a),
|
|
5007
5038
|
children: [/* @__PURE__ */ Z(w, {
|
|
5008
5039
|
className: "pb-2",
|
|
5009
5040
|
children: /* @__PURE__ */ Q(T, {
|
|
@@ -5038,9 +5069,9 @@ var Ir = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5038
5069
|
strokeWidth: 1.5,
|
|
5039
5070
|
strokeOpacity: .5
|
|
5040
5071
|
}, `edge-${t}`)), d.map((e) => {
|
|
5041
|
-
let t = l === e.id, n =
|
|
5072
|
+
let t = l === e.id, n = Nr[Math.min(e.level, Nr.length - 1)], i = Pr[Math.min(e.level, Pr.length - 1)], a = e.level === 0 ? 34 : Mr;
|
|
5042
5073
|
return /* @__PURE__ */ Q("g", {
|
|
5043
|
-
className:
|
|
5074
|
+
className: W("cursor-pointer transition-transform", r && "hover:opacity-80"),
|
|
5044
5075
|
onClick: () => r?.(e.id),
|
|
5045
5076
|
onMouseEnter: () => u(e.id),
|
|
5046
5077
|
onMouseLeave: () => u(null),
|
|
@@ -5059,8 +5090,8 @@ var Ir = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5059
5090
|
y: e.y,
|
|
5060
5091
|
textAnchor: "middle",
|
|
5061
5092
|
dominantBaseline: "central",
|
|
5062
|
-
className:
|
|
5063
|
-
children:
|
|
5093
|
+
className: W("text-[10px] font-medium pointer-events-none", i),
|
|
5094
|
+
children: Ir(e.label)
|
|
5064
5095
|
}),
|
|
5065
5096
|
e.type && /* @__PURE__ */ Z("text", {
|
|
5066
5097
|
x: e.x,
|
|
@@ -5069,7 +5100,7 @@ var Ir = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5069
5100
|
className: "fill-muted-foreground text-[9px] pointer-events-none",
|
|
5070
5101
|
children: e.type
|
|
5071
5102
|
}),
|
|
5072
|
-
t && /* @__PURE__ */ Q(
|
|
5103
|
+
t && /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z("rect", {
|
|
5073
5104
|
x: e.x - 50,
|
|
5074
5105
|
y: e.y - a - 28,
|
|
5075
5106
|
width: 100,
|
|
@@ -5094,7 +5125,7 @@ var Ir = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5094
5125
|
};
|
|
5095
5126
|
//#endregion
|
|
5096
5127
|
//#region src/PointInTimeRestore.tsx
|
|
5097
|
-
function
|
|
5128
|
+
function Rr(e) {
|
|
5098
5129
|
try {
|
|
5099
5130
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
5100
5131
|
if (r < 1) return "just now";
|
|
@@ -5105,7 +5136,7 @@ function Lr(e) {
|
|
|
5105
5136
|
return e;
|
|
5106
5137
|
}
|
|
5107
5138
|
}
|
|
5108
|
-
var
|
|
5139
|
+
var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
5109
5140
|
let [a, o] = i.useState(null), [s, c] = i.useState(!1), [l, u] = i.useState(!1), d = i.useMemo(() => t.find((e) => e.id === a) ?? null, [t, a]), f = i.useCallback(async () => {
|
|
5110
5141
|
if (!(!d || !n)) {
|
|
5111
5142
|
if (!s) {
|
|
@@ -5128,13 +5159,13 @@ var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5128
5159
|
c(!1);
|
|
5129
5160
|
}, []);
|
|
5130
5161
|
return /* @__PURE__ */ Q(S, {
|
|
5131
|
-
className:
|
|
5162
|
+
className: W("", r),
|
|
5132
5163
|
children: [/* @__PURE__ */ Z(w, {
|
|
5133
5164
|
className: "pb-3",
|
|
5134
5165
|
children: /* @__PURE__ */ Q(T, {
|
|
5135
5166
|
className: "flex items-center gap-2 text-base",
|
|
5136
5167
|
children: [
|
|
5137
|
-
/* @__PURE__ */ Z(
|
|
5168
|
+
/* @__PURE__ */ Z(je, { className: "h-4 w-4" }),
|
|
5138
5169
|
"Revision History",
|
|
5139
5170
|
/* @__PURE__ */ Q("span", {
|
|
5140
5171
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -5161,12 +5192,12 @@ var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5161
5192
|
let t = e.id === a;
|
|
5162
5193
|
return /* @__PURE__ */ Q("button", {
|
|
5163
5194
|
type: "button",
|
|
5164
|
-
className:
|
|
5195
|
+
className: W("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"),
|
|
5165
5196
|
onClick: () => {
|
|
5166
5197
|
o(e.id), c(!1);
|
|
5167
5198
|
},
|
|
5168
5199
|
children: [/* @__PURE__ */ Z("div", {
|
|
5169
|
-
className:
|
|
5200
|
+
className: W("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"),
|
|
5170
5201
|
children: t && /* @__PURE__ */ Z(be, { className: "h-3 w-3 text-primary-foreground" })
|
|
5171
5202
|
}), /* @__PURE__ */ Q("div", {
|
|
5172
5203
|
className: "flex-1 min-w-0",
|
|
@@ -5177,7 +5208,7 @@ var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5177
5208
|
children: e.user
|
|
5178
5209
|
}), /* @__PURE__ */ Z("span", {
|
|
5179
5210
|
className: "text-xs text-muted-foreground",
|
|
5180
|
-
children:
|
|
5211
|
+
children: Rr(e.timestamp)
|
|
5181
5212
|
})]
|
|
5182
5213
|
}), /* @__PURE__ */ Q("p", {
|
|
5183
5214
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
@@ -5199,7 +5230,7 @@ var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5199
5230
|
children: [
|
|
5200
5231
|
/* @__PURE__ */ Q("div", {
|
|
5201
5232
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
5202
|
-
children: [/* @__PURE__ */ Z(
|
|
5233
|
+
children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
|
|
5203
5234
|
}),
|
|
5204
5235
|
/* @__PURE__ */ Z("div", {
|
|
5205
5236
|
className: "space-y-2",
|
|
@@ -5245,12 +5276,12 @@ var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5245
5276
|
}),
|
|
5246
5277
|
n && /* @__PURE__ */ Z("div", {
|
|
5247
5278
|
className: "pt-1 space-y-2",
|
|
5248
|
-
children: s ? /* @__PURE__ */ Q(
|
|
5279
|
+
children: s ? /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Q("p", {
|
|
5249
5280
|
className: "text-xs text-amber-600 dark:text-amber-400",
|
|
5250
5281
|
children: [
|
|
5251
5282
|
"This will restore the record to its state at",
|
|
5252
5283
|
" ",
|
|
5253
|
-
|
|
5284
|
+
Rr(d.timestamp),
|
|
5254
5285
|
". Continue?"
|
|
5255
5286
|
]
|
|
5256
5287
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -5281,7 +5312,7 @@ var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5281
5312
|
})]
|
|
5282
5313
|
}) })]
|
|
5283
5314
|
});
|
|
5284
|
-
},
|
|
5315
|
+
}, Br = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: n = !1, className: r }) => {
|
|
5285
5316
|
let [a, o] = i.useState(""), [s, c] = i.useState(!1), l = i.useCallback(async () => {
|
|
5286
5317
|
let t = a.trim();
|
|
5287
5318
|
if (t) {
|
|
@@ -5296,7 +5327,7 @@ var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5296
5327
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), l());
|
|
5297
5328
|
}, [l]);
|
|
5298
5329
|
return /* @__PURE__ */ Q("div", {
|
|
5299
|
-
className:
|
|
5330
|
+
className: W("flex gap-2", r),
|
|
5300
5331
|
children: [/* @__PURE__ */ Z("textarea", {
|
|
5301
5332
|
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",
|
|
5302
5333
|
placeholder: t,
|
|
@@ -5314,21 +5345,21 @@ var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5314
5345
|
children: /* @__PURE__ */ Z(Ze, { className: "h-4 w-4" })
|
|
5315
5346
|
})]
|
|
5316
5347
|
});
|
|
5317
|
-
},
|
|
5348
|
+
}, Vr = ({ query: e, suggestions: t, onSelect: n, visible: r = !0, activeIndex: a = 0, className: o }) => {
|
|
5318
5349
|
let s = i.useMemo(() => {
|
|
5319
5350
|
if (!e) return t;
|
|
5320
5351
|
let n = e.toLowerCase();
|
|
5321
5352
|
return t.filter((e) => e.name.toLowerCase().includes(n) || e.id.toLowerCase().includes(n));
|
|
5322
5353
|
}, [e, t]);
|
|
5323
5354
|
return !r || s.length === 0 ? null : /* @__PURE__ */ Z("div", {
|
|
5324
|
-
className:
|
|
5355
|
+
className: W("bg-popover border rounded-md shadow-md z-50 max-h-48 overflow-y-auto w-56", o),
|
|
5325
5356
|
role: "listbox",
|
|
5326
5357
|
"aria-label": "Mention suggestions",
|
|
5327
5358
|
children: s.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
5328
5359
|
type: "button",
|
|
5329
5360
|
role: "option",
|
|
5330
5361
|
"aria-selected": t === a,
|
|
5331
|
-
className:
|
|
5362
|
+
className: W("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"),
|
|
5332
5363
|
onMouseDown: (t) => {
|
|
5333
5364
|
t.preventDefault(), n(e);
|
|
5334
5365
|
},
|
|
@@ -5356,7 +5387,7 @@ var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5356
5387
|
}, e.id))
|
|
5357
5388
|
});
|
|
5358
5389
|
};
|
|
5359
|
-
function
|
|
5390
|
+
function Hr(e, t, n) {
|
|
5360
5391
|
return {
|
|
5361
5392
|
type: e.type,
|
|
5362
5393
|
id: e.id,
|
|
@@ -5367,7 +5398,7 @@ function Vr(e, t, n) {
|
|
|
5367
5398
|
}
|
|
5368
5399
|
//#endregion
|
|
5369
5400
|
//#region src/extractMentions.ts
|
|
5370
|
-
function
|
|
5401
|
+
function Ur(e, t) {
|
|
5371
5402
|
if (!e || !t.length) return [];
|
|
5372
5403
|
let n = [...t].sort((e, t) => t.label.length - e.label.length), r = e, i = /* @__PURE__ */ new Set();
|
|
5373
5404
|
for (let e of n) {
|
|
@@ -5379,10 +5410,10 @@ function Hr(e, t) {
|
|
|
5379
5410
|
}
|
|
5380
5411
|
//#endregion
|
|
5381
5412
|
//#region src/synth/buildDefaultPageSchema.ts
|
|
5382
|
-
function
|
|
5413
|
+
function Wr(e) {
|
|
5383
5414
|
return e == null ? [] : Array.isArray(e) ? e.filter((e) => e != null) : [e];
|
|
5384
5415
|
}
|
|
5385
|
-
function
|
|
5416
|
+
function Gr(e) {
|
|
5386
5417
|
if (!e) return null;
|
|
5387
5418
|
let t = e.stageField;
|
|
5388
5419
|
if (t === !1) return null;
|
|
@@ -5400,7 +5431,7 @@ function Wr(e) {
|
|
|
5400
5431
|
}
|
|
5401
5432
|
return null;
|
|
5402
5433
|
}
|
|
5403
|
-
function
|
|
5434
|
+
function Kr(e, t) {
|
|
5404
5435
|
if (!e || !t) return null;
|
|
5405
5436
|
let n = e.fields?.[t]?.options;
|
|
5406
5437
|
return !Array.isArray(n) || n.length === 0 ? null : n.map((e) => ({
|
|
@@ -5408,7 +5439,7 @@ function Gr(e, t) {
|
|
|
5408
5439
|
label: e.label
|
|
5409
5440
|
}));
|
|
5410
5441
|
}
|
|
5411
|
-
function
|
|
5442
|
+
function qr(e, t, n = 4) {
|
|
5412
5443
|
if (!e) return [];
|
|
5413
5444
|
let r = Array.isArray(e.highlightFields) && e.highlightFields.length > 0 ? e.highlightFields : null;
|
|
5414
5445
|
if (r) return r.filter((e) => typeof e == "string" && e.length > 0).slice(0, n);
|
|
@@ -5483,22 +5514,22 @@ function Kr(e, t, n = 4) {
|
|
|
5483
5514
|
}
|
|
5484
5515
|
return s;
|
|
5485
5516
|
}
|
|
5486
|
-
function
|
|
5517
|
+
function Jr(e, t = {}) {
|
|
5487
5518
|
return {
|
|
5488
5519
|
type: "page:header",
|
|
5489
5520
|
recordChrome: t.recordChrome !== !1,
|
|
5490
5521
|
...Array.isArray(t.actions) && t.actions.length > 0 ? { actions: t.actions } : {}
|
|
5491
5522
|
};
|
|
5492
5523
|
}
|
|
5493
|
-
function
|
|
5524
|
+
function Yr(e, t) {
|
|
5494
5525
|
return !Array.isArray(t) || t.length === 0 ? null : {
|
|
5495
5526
|
type: "record:quick_actions",
|
|
5496
5527
|
actions: t,
|
|
5497
5528
|
location: "record_header"
|
|
5498
5529
|
};
|
|
5499
5530
|
}
|
|
5500
|
-
function
|
|
5501
|
-
let n = t.statusField ??
|
|
5531
|
+
function Xr(e, t = {}) {
|
|
5532
|
+
let n = t.statusField ?? Gr(e), r = t.stages ?? (n ? Kr(e, n) : null), i = t.highlightFields ?? qr(e, n), a = [];
|
|
5502
5533
|
return !t.hideHighlights && i.length > 0 && a.push({
|
|
5503
5534
|
type: "record:highlights",
|
|
5504
5535
|
fields: i
|
|
@@ -5508,9 +5539,9 @@ function Yr(e, t = {}) {
|
|
|
5508
5539
|
stages: r
|
|
5509
5540
|
}), a;
|
|
5510
5541
|
}
|
|
5511
|
-
function
|
|
5542
|
+
function Zr(e) {
|
|
5512
5543
|
if (!e) return null;
|
|
5513
|
-
let t =
|
|
5544
|
+
let t = Pt(e);
|
|
5514
5545
|
if (!t) return null;
|
|
5515
5546
|
let n = e.fields || {}, r = (e) => {
|
|
5516
5547
|
let t = n[e] || {};
|
|
@@ -5523,7 +5554,7 @@ function Xr(e) {
|
|
|
5523
5554
|
...t.reference_field ? { reference_field: t.reference_field } : {},
|
|
5524
5555
|
...t.currency ? { currency: t.currency } : {}
|
|
5525
5556
|
};
|
|
5526
|
-
};
|
|
5557
|
+
}, i = Lt(t.reduce((e, t) => e + t.fields.length, 0));
|
|
5527
5558
|
return t.map((e) => ({
|
|
5528
5559
|
...e.key === void 0 ? {} : {
|
|
5529
5560
|
name: e.key,
|
|
@@ -5531,23 +5562,25 @@ function Xr(e) {
|
|
|
5531
5562
|
},
|
|
5532
5563
|
...e.collapse === "none" ? {} : { collapsible: !0 },
|
|
5533
5564
|
...e.collapse === "collapsed" ? { defaultCollapsed: !0 } : {},
|
|
5565
|
+
columns: i,
|
|
5534
5566
|
fields: e.fields.map(r)
|
|
5535
5567
|
}));
|
|
5536
5568
|
}
|
|
5537
|
-
function
|
|
5538
|
-
return Array.isArray(t) && t.length > 0 ? t :
|
|
5569
|
+
function Qr(e, t) {
|
|
5570
|
+
return Array.isArray(t) && t.length > 0 ? t : Zr(e) ?? void 0;
|
|
5539
5571
|
}
|
|
5540
|
-
function
|
|
5572
|
+
function $r(e, t, n) {
|
|
5541
5573
|
return {
|
|
5542
5574
|
type: "record:details",
|
|
5543
|
-
sections:
|
|
5575
|
+
sections: Qr(e, t),
|
|
5544
5576
|
...n && n.length > 0 ? { hideFields: n } : {}
|
|
5545
5577
|
};
|
|
5546
5578
|
}
|
|
5547
|
-
function
|
|
5548
|
-
let n = t.statusField ??
|
|
5579
|
+
function ei(e, t = {}) {
|
|
5580
|
+
let n = t.statusField ?? Gr(e), r = t.highlightFields ?? qr(e, n), i = [{
|
|
5549
5581
|
label: "Details",
|
|
5550
|
-
|
|
5582
|
+
value: "details",
|
|
5583
|
+
children: [$r(e, t.sections, r)]
|
|
5551
5584
|
}];
|
|
5552
5585
|
if (!t.hideRelatedTab && Array.isArray(t.related) && t.related.length > 0) {
|
|
5553
5586
|
let e = (e) => ({
|
|
@@ -5560,12 +5593,14 @@ function $r(e, t = {}) {
|
|
|
5560
5593
|
...e.icon ? { icon: e.icon } : {}
|
|
5561
5594
|
}), n = (t) => ({
|
|
5562
5595
|
label: t.title || t.objectName,
|
|
5596
|
+
value: `related:${t.objectName}`,
|
|
5563
5597
|
...t.icon ? { icon: t.icon } : {},
|
|
5564
5598
|
children: [e(t)]
|
|
5565
5599
|
});
|
|
5566
5600
|
if (t.relatedLayout === "tabs") for (let e of t.related) i.push(n(e));
|
|
5567
5601
|
else if (t.relatedLayout === "stack") i.push({
|
|
5568
5602
|
label: "Related",
|
|
5603
|
+
value: "related",
|
|
5569
5604
|
children: t.related.map(e)
|
|
5570
5605
|
});
|
|
5571
5606
|
else {
|
|
@@ -5573,15 +5608,18 @@ function $r(e, t = {}) {
|
|
|
5573
5608
|
for (let e of r) i.push(n(e));
|
|
5574
5609
|
a.length > 0 && i.push({
|
|
5575
5610
|
label: "Related",
|
|
5611
|
+
value: "related",
|
|
5576
5612
|
children: a.map(e)
|
|
5577
5613
|
});
|
|
5578
5614
|
}
|
|
5579
5615
|
}
|
|
5580
5616
|
return t.showActivity && i.push({
|
|
5581
5617
|
label: "Activity",
|
|
5618
|
+
value: "activity",
|
|
5582
5619
|
children: [{ type: "record:activity" }]
|
|
5583
5620
|
}), t.history && i.push({
|
|
5584
5621
|
label: "History",
|
|
5622
|
+
value: "history",
|
|
5585
5623
|
children: [{
|
|
5586
5624
|
type: "record:history",
|
|
5587
5625
|
entries: t.history.entries,
|
|
@@ -5593,15 +5631,15 @@ function $r(e, t = {}) {
|
|
|
5593
5631
|
items: i
|
|
5594
5632
|
};
|
|
5595
5633
|
}
|
|
5596
|
-
function
|
|
5634
|
+
function ti() {
|
|
5597
5635
|
return { type: "record:discussion" };
|
|
5598
5636
|
}
|
|
5599
|
-
function
|
|
5637
|
+
function ni(e, t = {}) {
|
|
5600
5638
|
let n = t.slots || {}, r = [];
|
|
5601
|
-
"header" in n && n.header !== void 0 ? r.push(...
|
|
5639
|
+
"header" in n && n.header !== void 0 ? r.push(...Wr(n.header)) : r.push(Jr(e, {
|
|
5602
5640
|
recordChrome: t.recordChrome,
|
|
5603
5641
|
actions: t.headerActions
|
|
5604
|
-
})), "actions" in n && n.actions !== void 0 && r.push(...
|
|
5642
|
+
})), "actions" in n && n.actions !== void 0 && r.push(...Wr(n.actions)), "alerts" in n && n.alerts !== void 0 && r.push(...Wr(n.alerts)), "highlights" in n && n.highlights !== void 0 ? r.push(...Wr(n.highlights)) : r.push(...Xr(e, {
|
|
5605
5643
|
highlightFields: t.highlightFields,
|
|
5606
5644
|
statusField: t.statusField,
|
|
5607
5645
|
stages: t.stages,
|
|
@@ -5609,9 +5647,9 @@ function ti(e, t = {}) {
|
|
|
5609
5647
|
hidePath: t.hidePath
|
|
5610
5648
|
}));
|
|
5611
5649
|
let i = t.showReferenceRail === !0 && !t.hideReferenceRail && Array.isArray(t.related) && t.related.length >= 2, a = t.hideRelatedTab ?? i;
|
|
5612
|
-
if ("tabs" in n && n.tabs !== void 0) r.push(...
|
|
5650
|
+
if ("tabs" in n && n.tabs !== void 0) r.push(...Wr(n.tabs));
|
|
5613
5651
|
else if ("details" in n && n.details !== void 0) {
|
|
5614
|
-
let i =
|
|
5652
|
+
let i = Wr(n.details), o = ei(e, {
|
|
5615
5653
|
sections: t.sections,
|
|
5616
5654
|
related: t.related,
|
|
5617
5655
|
showActivity: t.showActivity,
|
|
@@ -5625,7 +5663,7 @@ function ti(e, t = {}) {
|
|
|
5625
5663
|
...o.items[0],
|
|
5626
5664
|
children: i
|
|
5627
5665
|
}), r.push(o);
|
|
5628
|
-
} else r.push(
|
|
5666
|
+
} else r.push(ei(e, {
|
|
5629
5667
|
sections: t.sections,
|
|
5630
5668
|
related: t.related,
|
|
5631
5669
|
showActivity: t.showActivity,
|
|
@@ -5635,12 +5673,12 @@ function ti(e, t = {}) {
|
|
|
5635
5673
|
hideRelatedTab: a,
|
|
5636
5674
|
relatedLayout: t.relatedLayout
|
|
5637
5675
|
}));
|
|
5638
|
-
"discussion" in n && n.discussion !== void 0 ? r.push(...
|
|
5676
|
+
"discussion" in n && n.discussion !== void 0 ? r.push(...Wr(n.discussion)) : t.hideDiscussion || r.push(ti());
|
|
5639
5677
|
let o = [{
|
|
5640
5678
|
name: "main",
|
|
5641
5679
|
width: "full",
|
|
5642
5680
|
components: r
|
|
5643
|
-
}], s =
|
|
5681
|
+
}], s = Wr(n.rightRail);
|
|
5644
5682
|
if (i || s.length > 0) {
|
|
5645
5683
|
let e = [];
|
|
5646
5684
|
i && e.push({
|
|
@@ -5668,7 +5706,7 @@ function ti(e, t = {}) {
|
|
|
5668
5706
|
regions: o
|
|
5669
5707
|
};
|
|
5670
5708
|
}
|
|
5671
|
-
e.register("detail-view",
|
|
5709
|
+
e.register("detail-view", Sn, {
|
|
5672
5710
|
namespace: "plugin-detail",
|
|
5673
5711
|
label: "Detail View",
|
|
5674
5712
|
category: "Views",
|
|
@@ -5798,7 +5836,7 @@ e.register("detail-view", xn, {
|
|
|
5798
5836
|
tabs: [],
|
|
5799
5837
|
related: []
|
|
5800
5838
|
}
|
|
5801
|
-
}), e.register("detail-section",
|
|
5839
|
+
}), e.register("detail-section", Gt, {
|
|
5802
5840
|
namespace: "plugin-detail",
|
|
5803
5841
|
label: "Detail Section",
|
|
5804
5842
|
category: "Detail Components",
|
|
@@ -5849,7 +5887,7 @@ e.register("detail-view", xn, {
|
|
|
5849
5887
|
label: "Header Color"
|
|
5850
5888
|
}
|
|
5851
5889
|
]
|
|
5852
|
-
}), e.register("related-list",
|
|
5890
|
+
}), e.register("related-list", Jt, {
|
|
5853
5891
|
namespace: "plugin-detail",
|
|
5854
5892
|
label: "Related List",
|
|
5855
5893
|
category: "Detail Components",
|
|
@@ -5896,7 +5934,7 @@ e.register("detail-view", xn, {
|
|
|
5896
5934
|
label: "Columns"
|
|
5897
5935
|
}
|
|
5898
5936
|
]
|
|
5899
|
-
}), e.register("detail",
|
|
5937
|
+
}), e.register("detail", Sn, {
|
|
5900
5938
|
namespace: "view",
|
|
5901
5939
|
category: "view",
|
|
5902
5940
|
label: "Detail",
|
|
@@ -5919,7 +5957,7 @@ e.register("detail-view", xn, {
|
|
|
5919
5957
|
label: "Fields"
|
|
5920
5958
|
}
|
|
5921
5959
|
]
|
|
5922
|
-
}), e.register("record:details",
|
|
5960
|
+
}), e.register("record:details", kn, {
|
|
5923
5961
|
namespace: "record",
|
|
5924
5962
|
category: "record",
|
|
5925
5963
|
label: "Record Details",
|
|
@@ -5959,7 +5997,7 @@ e.register("detail-view", xn, {
|
|
|
5959
5997
|
description: "Explicit field list (overrides highlightFields)"
|
|
5960
5998
|
}
|
|
5961
5999
|
]
|
|
5962
|
-
}), e.register("record:related_list",
|
|
6000
|
+
}), e.register("record:related_list", Nn, {
|
|
5963
6001
|
namespace: "record",
|
|
5964
6002
|
category: "record",
|
|
5965
6003
|
label: "Related List",
|
|
@@ -6022,7 +6060,7 @@ e.register("detail-view", xn, {
|
|
|
6022
6060
|
description: "Action IDs available for related records"
|
|
6023
6061
|
}
|
|
6024
6062
|
]
|
|
6025
|
-
}), e.register("record:highlights",
|
|
6063
|
+
}), e.register("record:highlights", Fn, {
|
|
6026
6064
|
namespace: "record",
|
|
6027
6065
|
category: "record",
|
|
6028
6066
|
label: "Highlights Panel",
|
|
@@ -6041,22 +6079,22 @@ e.register("detail-view", xn, {
|
|
|
6041
6079
|
defaultValue: "horizontal",
|
|
6042
6080
|
description: "Layout orientation for highlight fields"
|
|
6043
6081
|
}]
|
|
6044
|
-
}), e.register("record:activity",
|
|
6082
|
+
}), e.register("record:activity", tr, {
|
|
6045
6083
|
namespace: "record",
|
|
6046
6084
|
category: "record",
|
|
6047
6085
|
label: "Activity Timeline",
|
|
6048
6086
|
icon: "Activity"
|
|
6049
|
-
}), e.register("record:chatter",
|
|
6087
|
+
}), e.register("record:chatter", ir, {
|
|
6050
6088
|
namespace: "record",
|
|
6051
6089
|
category: "record",
|
|
6052
6090
|
label: "Chatter Feed",
|
|
6053
6091
|
icon: "MessageSquare"
|
|
6054
|
-
}), e.register("record:discussion",
|
|
6092
|
+
}), e.register("record:discussion", ir, {
|
|
6055
6093
|
namespace: "record",
|
|
6056
6094
|
category: "record",
|
|
6057
6095
|
label: "Discussion",
|
|
6058
6096
|
icon: "MessageSquare"
|
|
6059
|
-
}), e.register("record:path",
|
|
6097
|
+
}), e.register("record:path", or, {
|
|
6060
6098
|
namespace: "record",
|
|
6061
6099
|
category: "record",
|
|
6062
6100
|
label: "Path / Stepper",
|
|
@@ -6073,26 +6111,26 @@ e.register("detail-view", xn, {
|
|
|
6073
6111
|
label: "Stages",
|
|
6074
6112
|
description: "Explicit stage definitions [{ value, label }] (else derived from field metadata)"
|
|
6075
6113
|
}]
|
|
6076
|
-
}), e.register("record:quick_actions",
|
|
6114
|
+
}), e.register("record:quick_actions", cr, {
|
|
6077
6115
|
namespace: "record",
|
|
6078
6116
|
category: "record",
|
|
6079
6117
|
label: "Quick Actions",
|
|
6080
6118
|
icon: "Zap"
|
|
6081
|
-
}), e.register("record:history",
|
|
6119
|
+
}), e.register("record:history", fr, {
|
|
6082
6120
|
namespace: "record",
|
|
6083
6121
|
category: "record",
|
|
6084
6122
|
label: "History Timeline",
|
|
6085
6123
|
icon: "Clock"
|
|
6086
|
-
}), e.register("record:reference_rail",
|
|
6124
|
+
}), e.register("record:reference_rail", gr, {
|
|
6087
6125
|
namespace: "record",
|
|
6088
6126
|
category: "record",
|
|
6089
6127
|
label: "Reference Rail",
|
|
6090
6128
|
icon: "PanelRight"
|
|
6091
|
-
}), e.register("record:alert",
|
|
6129
|
+
}), e.register("record:alert", yr, {
|
|
6092
6130
|
namespace: "record",
|
|
6093
6131
|
category: "record",
|
|
6094
6132
|
label: "Alert Banner",
|
|
6095
6133
|
icon: "AlertTriangle"
|
|
6096
6134
|
});
|
|
6097
6135
|
//#endregion
|
|
6098
|
-
export {
|
|
6136
|
+
export { an as ActivityTimeline, qn as CommentAttachment, Br as CommentInput, Tn as ConcurrentUpdateDialog, Vt as DETAIL_DEFAULT_TRANSLATIONS, Gt as DetailSection, Kt as DetailTabs, Sn as DetailView, Ar as DiffView, In as FieldChangeItem, Xt as HeaderHighlight, fn as HistoryTimeline, Tr as InlineCreateRelated, Vr as MentionAutocomplete, zr as PointInTimeRestore, Rn as ReactionPicker, tr as RecordActivityRenderer, $n as RecordActivityTimeline, yr as RecordAlertRenderer, nr as RecordChatterPanel, ir as RecordChatterRenderer, Qt as RecordComments, Cr as RecordDetailDrawer, kn as RecordDetailsRenderer, Fn as RecordHighlightsRenderer, fr as RecordHistoryRenderer, yn as RecordMetaFooter, jr as RecordNavigationEnhanced, or as RecordPathRenderer, cr as RecordQuickActionsRenderer, gr as RecordReferenceRailRenderer, Nn as RecordRelatedListRenderer, Jt as RelatedList, Lr as RelationshipGraph, Un as RichTextCommentInput, Yt as SectionGroup, Vn as SubscriptionToggle, Bn as ThreadedReplies, Rt as applyAutoSpan, zt as applyDetailAutoLayout, Yr as buildDefaultActions, $r as buildDefaultDetails, ti as buildDefaultDiscussion, Jr as buildDefaultHeader, Xr as buildDefaultHighlights, ni as buildDefaultPageSchema, ei as buildDefaultTabs, Hr as createMentionFromSuggestion, Bt as createSafeTranslationHook, Zr as deriveFieldGroupDetailSections, qr as deriveHighlightFields, wr as deriveRecordPageHref, Kr as deriveStages, Gr as detectStatusField, Ur as extractMentions, Lt as inferDetailColumns, En as isConcurrentUpdateError, It as isWideFieldType, Qr as resolveDetailSections, $ as useDetailTranslation };
|