@object-ui/plugin-detail 11.5.0 → 13.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +110 -0
- package/dist/DetailSection.d.ts +14 -1
- package/dist/DetailSection.d.ts.map +1 -1
- package/dist/DetailView.d.ts.map +1 -1
- package/dist/RelatedList.d.ts +27 -0
- package/dist/RelatedList.d.ts.map +1 -1
- package/dist/SectionGroup.d.ts +4 -0
- package/dist/SectionGroup.d.ts.map +1 -1
- package/dist/autoLayout.d.ts +5 -4
- package/dist/autoLayout.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1067 -917
- package/dist/index.umd.cjs +3 -3
- package/dist/renderers/PermissionFacetLink.d.ts +38 -0
- package/dist/renderers/PermissionFacetLink.d.ts.map +1 -0
- 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/dist/useDetailTranslation.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
|
|
7
|
-
import { BooleanField as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
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 F, SelectValue as ee, Sheet as te, SheetContent as ne, SheetHeader as re, SheetTitle as ie, Skeleton as I, Tabs as L, TabsContent as R, TabsList as z, TabsTrigger as B, Tooltip as V, TooltipContent as H, TooltipProvider as ae, TooltipTrigger as U, buttonVariants as W, cn as G, useIsMobile as oe } from "@object-ui/components";
|
|
5
|
+
import { Activity as se, AlertTriangle as K, ArrowLeft as ce, ArrowRight as q, ArrowRightLeft as le, ArrowUpDown as ue, AtSign as de, Bell as fe, BellOff as J, Bold as pe, Calendar as me, Check as he, CheckSquare as ge, ChevronDown as _e, ChevronLeft as ve, ChevronRight as ye, ChevronsLeft as be, ChevronsRight as xe, Code as Se, Columns2 as Ce, Copy as we, Edit as Te, ExternalLink as Ee, Eye as De, 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, Pencil as We, Phone as Ge, Pin as Ke, Plus as qe, PlusCircle as Je, RotateCcw as Ye, Rows3 as Xe, Search as Ze, Send as Qe, SmilePlus as $e, Star as et, Trash2 as tt, Upload as nt, X as rt, Zap as it, icons as at } from "lucide-react";
|
|
6
|
+
import { SchemaRenderer as ot, toPredicateInput as st, useActionEngine as ct, useCondition as lt, useDataInvalidation as ut, useDiscussionContext as dt, useHighlightFieldNames as ft, useMetadataItem as pt, useObjectTranslation as mt, useRecordContext as ht, useRegisterHighlightFields as gt, useRelatedRecordActions as _t, useSafeFieldLabel as vt } from "@object-ui/react";
|
|
7
|
+
import { BooleanField as yt, CapabilityMultiSelectField as bt, LookupField as xt, RecordPickerDialog as St, SelectField as Ct, UserField as wt, coerceToSafeValue as Tt, getCellRenderer as Et, humanizeLabel as Dt, parseCapabilityNames as Ot, resolveCellRendererType as kt } from "@object-ui/fields";
|
|
8
|
+
import { Link as At, useParams as jt } from "react-router-dom";
|
|
9
|
+
import { Fragment as Mt, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
10
|
+
import { useFieldPermissions as Nt, usePermissions as Pt } from "@object-ui/permissions";
|
|
11
|
+
import { resolveFieldCurrency as Ft, useLocalization as It } from "@object-ui/i18n";
|
|
12
|
+
import { deriveFieldGroupLayout as Lt } from "@objectstack/spec/data";
|
|
13
13
|
//#region src/autoLayout.ts
|
|
14
|
-
var
|
|
14
|
+
var Rt = /* @__PURE__ */ new Set([
|
|
15
15
|
"textarea",
|
|
16
16
|
"markdown",
|
|
17
17
|
"html",
|
|
@@ -23,36 +23,36 @@ var Ft = /* @__PURE__ */ new Set([
|
|
|
23
23
|
"field:grid",
|
|
24
24
|
"field:rich-text"
|
|
25
25
|
]);
|
|
26
|
-
function
|
|
27
|
-
return
|
|
26
|
+
function zt(e) {
|
|
27
|
+
return Rt.has(e);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function Bt(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 Vt(e, t) {
|
|
34
|
+
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && zt(e.type) ? {
|
|
35
35
|
...e,
|
|
36
36
|
span: t
|
|
37
37
|
} : e);
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function Ht(e, t, n) {
|
|
40
40
|
if (t !== void 0) return {
|
|
41
|
-
fields:
|
|
41
|
+
fields: Vt(e, t),
|
|
42
42
|
columns: t
|
|
43
43
|
};
|
|
44
|
-
let r =
|
|
44
|
+
let r = Bt(e.length, n);
|
|
45
45
|
return {
|
|
46
|
-
fields:
|
|
46
|
+
fields: Vt(e, r),
|
|
47
47
|
columns: r
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/useDetailTranslation.ts
|
|
52
|
-
function
|
|
52
|
+
function Ut(e, t) {
|
|
53
53
|
return function() {
|
|
54
54
|
try {
|
|
55
|
-
let n =
|
|
55
|
+
let n = mt();
|
|
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,13 +67,14 @@ function Bt(e, t) {
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
var
|
|
70
|
+
var Wt = {
|
|
71
71
|
"detail.back": "Back",
|
|
72
72
|
"detail.edit": "Edit",
|
|
73
73
|
"detail.editInline": "Edit",
|
|
74
74
|
"detail.save": "Save",
|
|
75
75
|
"detail.saveChanges": "Save changes",
|
|
76
76
|
"detail.editFieldsInline": "Edit fields inline",
|
|
77
|
+
"detail.editInlineHint": "Double-click to edit",
|
|
77
78
|
"detail.cancel": "Cancel",
|
|
78
79
|
"detail.cancelEdit": "Discard changes",
|
|
79
80
|
"detail.openInNewTab": "Open in new tab",
|
|
@@ -193,125 +194,216 @@ var Vt = {
|
|
|
193
194
|
"detail.concurrentUpdateReload": "Reload latest",
|
|
194
195
|
"detail.concurrentUpdateOverwrite": "Overwrite anyway",
|
|
195
196
|
"detail.concurrentUpdateCancel": "Cancel"
|
|
196
|
-
}, $ =
|
|
197
|
+
}, $ = Ut(Wt, "detail.back");
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/renderers/PermissionFacetLink.tsx
|
|
200
|
+
function Gt(e) {
|
|
201
|
+
if (typeof e == "string") {
|
|
202
|
+
let t = e.trim();
|
|
203
|
+
if (!t) return null;
|
|
204
|
+
try {
|
|
205
|
+
return JSON.parse(t);
|
|
206
|
+
} catch {
|
|
207
|
+
return t;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return e ?? null;
|
|
211
|
+
}
|
|
212
|
+
function Kt(e) {
|
|
213
|
+
let t = Gt(e);
|
|
214
|
+
return t == null || t === "" ? 0 : Array.isArray(t) ? t.length : typeof t == "object" ? Object.keys(t).length : 1;
|
|
215
|
+
}
|
|
216
|
+
function qt({ value: e, field: t }) {
|
|
217
|
+
let { t: n } = $(), r = ht(), { appName: i } = jt(), a = t?.name || "", o = r?.data?.name, s = i && o ? `/apps/${i}/metadata/permission/${encodeURIComponent(String(o))}` : null, c = Kt(e), l = c === 0;
|
|
218
|
+
return /* @__PURE__ */ Q("span", {
|
|
219
|
+
className: "inline-flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",
|
|
220
|
+
children: [(() => {
|
|
221
|
+
if (l) return /* @__PURE__ */ Z("span", {
|
|
222
|
+
className: "text-muted-foreground",
|
|
223
|
+
children: n("perm.facet.none", { defaultValue: "None" })
|
|
224
|
+
});
|
|
225
|
+
if (a === "system_permissions") {
|
|
226
|
+
let t = Ot(e), r = t.slice(0, 6), i = t.length - r.length;
|
|
227
|
+
return /* @__PURE__ */ Q("span", {
|
|
228
|
+
className: "inline-flex flex-wrap items-center gap-1",
|
|
229
|
+
children: [r.map((e) => /* @__PURE__ */ Z(b, {
|
|
230
|
+
variant: "outline",
|
|
231
|
+
children: e
|
|
232
|
+
}, e)), i > 0 && /* @__PURE__ */ Z("span", {
|
|
233
|
+
className: "text-muted-foreground text-xs",
|
|
234
|
+
children: n("perm.facet.more", {
|
|
235
|
+
count: i,
|
|
236
|
+
defaultValue: `+${i} more`
|
|
237
|
+
})
|
|
238
|
+
})]
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
return /* @__PURE__ */ Z("span", {
|
|
242
|
+
className: "text-foreground",
|
|
243
|
+
children: (() => {
|
|
244
|
+
switch (a) {
|
|
245
|
+
case "object_permissions": return n("perm.facet.objects", {
|
|
246
|
+
count: c,
|
|
247
|
+
defaultValue: `${c} object${c === 1 ? "" : "s"}`
|
|
248
|
+
});
|
|
249
|
+
case "field_permissions": return n("perm.facet.fields", {
|
|
250
|
+
count: c,
|
|
251
|
+
defaultValue: `${c} field rule${c === 1 ? "" : "s"}`
|
|
252
|
+
});
|
|
253
|
+
case "row_level_security": return n("perm.facet.rls", {
|
|
254
|
+
count: c,
|
|
255
|
+
defaultValue: `${c} RLS polic${c === 1 ? "y" : "ies"}`
|
|
256
|
+
});
|
|
257
|
+
case "tab_permissions": return n("perm.facet.tabs", {
|
|
258
|
+
count: c,
|
|
259
|
+
defaultValue: `${c} tab rule${c === 1 ? "" : "s"}`
|
|
260
|
+
});
|
|
261
|
+
case "admin_scope": return n("perm.facet.adminScope", { defaultValue: "Delegated admin configured" });
|
|
262
|
+
default: return String(c);
|
|
263
|
+
}
|
|
264
|
+
})()
|
|
265
|
+
});
|
|
266
|
+
})(), s ? /* @__PURE__ */ Z(At, {
|
|
267
|
+
to: s,
|
|
268
|
+
className: "text-primary hover:underline whitespace-nowrap",
|
|
269
|
+
children: n("perm.facet.designInStudio", { defaultValue: "Design in Studio →" })
|
|
270
|
+
}) : /* @__PURE__ */ Z("span", {
|
|
271
|
+
className: "text-muted-foreground/60 whitespace-nowrap",
|
|
272
|
+
children: n("perm.facet.designInStudioHint", { defaultValue: "Design in Studio" })
|
|
273
|
+
})]
|
|
274
|
+
});
|
|
275
|
+
}
|
|
197
276
|
//#endregion
|
|
198
277
|
//#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" : "";
|
|
278
|
+
function Jt(e, t) {
|
|
279
|
+
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
280
|
}
|
|
202
|
-
var
|
|
281
|
+
var Yt = /* @__PURE__ */ new Set([
|
|
203
282
|
"formula",
|
|
204
283
|
"summary",
|
|
205
284
|
"rollup",
|
|
206
285
|
"auto_number"
|
|
207
286
|
]);
|
|
208
|
-
function
|
|
287
|
+
function Xt(e) {
|
|
209
288
|
if (e == null) return e;
|
|
210
|
-
if (Array.isArray(e)) return e.map(
|
|
289
|
+
if (Array.isArray(e)) return e.map(Xt);
|
|
211
290
|
if (typeof e == "object") {
|
|
212
291
|
let t = e;
|
|
213
292
|
return t.id ?? t._id ?? t.value ?? "";
|
|
214
293
|
}
|
|
215
294
|
return e;
|
|
216
295
|
}
|
|
217
|
-
var
|
|
218
|
-
let [
|
|
296
|
+
var Zt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, isEditing: o = !1, onFieldChange: s, onEnterInlineEdit: c, autoFocusField: l, dataSource: u, virtualScroll: d }) => {
|
|
297
|
+
let [f, p] = i.useState(e.defaultCollapsed ?? !1), [m, h] = i.useState(null), [g, _] = i.useState(void 0), [v, y] = i.useState(!1), { t: b } = $(), { fieldLabel: k, translateOptions: A } = vt(), j = i.useCallback((e, t) => {
|
|
219
298
|
let n = t == null ? "" : String(t);
|
|
220
299
|
navigator.clipboard.writeText(n).then(() => {
|
|
221
|
-
|
|
300
|
+
h(e), setTimeout(() => h(null), 2e3);
|
|
222
301
|
});
|
|
223
|
-
}, []),
|
|
302
|
+
}, []), M = i.useCallback((e) => {
|
|
224
303
|
let n = t?.[e.name] ?? e.value;
|
|
225
304
|
return n == null || n === "";
|
|
226
|
-
}, [t]),
|
|
227
|
-
if (re.length === 0 && j === e.fields.length) return null;
|
|
228
|
-
let { fields: ie, columns: P } = zt(re, e.columns), F = (e) => {
|
|
305
|
+
}, [t]), N = i.useMemo(() => e.fields.filter(M).length, [e.fields, M]), P = oe(), F = P ? 3 : 4, ee = P ? .2 : .25, te = e.fields.length - N, ne = !e.hideEmpty && !o && e.fields.length >= F && N / e.fields.length >= ee && te > 0, re = !v && (e.hideEmpty || ne) ? e.fields.filter((e) => !M(e)) : e.fields, { fields: ie, columns: I } = Ht(re, e.columns), L = Math.min(I, Math.max(1, re.length)), R = (e) => {
|
|
229
306
|
let n = t?.[e.name] ?? e.value;
|
|
230
|
-
if (e.render) return /* @__PURE__ */ Z(
|
|
307
|
+
if (e.render) return /* @__PURE__ */ Z(ot, {
|
|
231
308
|
schema: e.render,
|
|
232
309
|
data: {
|
|
233
310
|
...t,
|
|
234
311
|
value: n
|
|
235
312
|
}
|
|
236
313
|
});
|
|
237
|
-
let i =
|
|
238
|
-
if (
|
|
239
|
-
!e.type &&
|
|
240
|
-
let t =
|
|
241
|
-
t && !
|
|
314
|
+
let i = Jt(e.span, L), d = r?.fields?.[e.name], f = { ...e };
|
|
315
|
+
if (d) {
|
|
316
|
+
!e.type && d.type && (f.type = d.type), d.options && !f.options && (f.options = d.options), d.currency && !f.currency && (f.currency = d.currency), d.precision !== void 0 && f.precision === void 0 && (f.precision = d.precision), d.scale !== void 0 && f.scale === void 0 && (f.scale = d.scale), d.format && !f.format && (f.format = d.format), d.widget && !f.widget && (f.widget = d.widget);
|
|
317
|
+
let t = d.reference_to || d.reference;
|
|
318
|
+
t && !f.reference_to && (f.reference_to = t), d.reference_field && !f.reference_field && (f.reference_field = d.reference_field), d.dueLike !== void 0 && f.dueLike === void 0 && (f.dueLike = d.dueLike);
|
|
242
319
|
}
|
|
243
|
-
a && Array.isArray(
|
|
244
|
-
let
|
|
320
|
+
a && Array.isArray(f.options) && f.options.length > 0 && (f.options = A(a, e.name, f.options));
|
|
321
|
+
let p = f.type || e.type, h = Yt.has(p), g = !e.readonly && !h, _ = g && !!c, v = (() => {
|
|
322
|
+
if ((f.widget || e.widget) === "permission-facet-link") return /* @__PURE__ */ Z(qt, {
|
|
323
|
+
value: n,
|
|
324
|
+
field: f
|
|
325
|
+
});
|
|
245
326
|
if (n == null || n === "") return /* @__PURE__ */ Z("span", {
|
|
246
327
|
className: "text-muted-foreground/60 text-sm select-none",
|
|
247
|
-
"aria-label":
|
|
248
|
-
title:
|
|
328
|
+
"aria-label": b("detail.noValue", { defaultValue: "No value" }),
|
|
329
|
+
title: b("detail.noValue", { defaultValue: "No value" }),
|
|
249
330
|
children: "—"
|
|
250
331
|
});
|
|
251
|
-
let t =
|
|
332
|
+
let t = kt(f) || e.type;
|
|
252
333
|
if (t) {
|
|
253
|
-
let e =
|
|
334
|
+
let e = Et(t);
|
|
254
335
|
if (e) return /* @__PURE__ */ Z(e, {
|
|
255
336
|
value: n,
|
|
256
|
-
field:
|
|
337
|
+
field: f
|
|
257
338
|
});
|
|
258
339
|
}
|
|
259
340
|
return String(n);
|
|
260
|
-
})(),
|
|
261
|
-
return
|
|
262
|
-
className: G("flex items-baseline justify-between gap-4 py-2.5 min-h-[44px] group",
|
|
263
|
-
onClick:
|
|
264
|
-
onKeyDown:
|
|
265
|
-
(t.key === "Enter" || t.key === " ") && (t.preventDefault(),
|
|
341
|
+
})(), y = n != null && n !== "", S = y && !_, C = m === e.name, w = k(a || "", e.name, e.label || e.name);
|
|
342
|
+
return P && !(o && g) ? /* @__PURE__ */ Q("div", {
|
|
343
|
+
className: G("flex items-baseline justify-between gap-4 py-2.5 min-h-[44px] group", y && "cursor-pointer active:bg-muted/40 transition-colors"),
|
|
344
|
+
onClick: y ? () => j(e.name, n) : void 0,
|
|
345
|
+
onKeyDown: y ? (t) => {
|
|
346
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), j(e.name, n));
|
|
266
347
|
} : void 0,
|
|
267
|
-
role:
|
|
268
|
-
tabIndex:
|
|
348
|
+
role: y ? "button" : void 0,
|
|
349
|
+
tabIndex: y ? 0 : void 0,
|
|
269
350
|
children: [/* @__PURE__ */ Z("span", {
|
|
270
351
|
className: "text-[15px] text-muted-foreground shrink-0",
|
|
271
|
-
children:
|
|
352
|
+
children: w
|
|
272
353
|
}), /* @__PURE__ */ Z("span", {
|
|
273
354
|
className: "text-[15px] text-foreground text-right break-words min-w-0 leading-snug",
|
|
274
|
-
children:
|
|
355
|
+
children: v
|
|
275
356
|
})]
|
|
276
357
|
}, e.name) : /* @__PURE__ */ Q("div", {
|
|
277
|
-
className: G("space-y-1.5 group", i),
|
|
358
|
+
className: G("space-y-1.5 group min-w-0", i),
|
|
278
359
|
children: [/* @__PURE__ */ Z("div", {
|
|
279
360
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
280
|
-
children:
|
|
281
|
-
}), o &&
|
|
361
|
+
children: k(a || "", e.name, e.label || e.name)
|
|
362
|
+
}), o && g ? /* @__PURE__ */ Z("div", {
|
|
282
363
|
className: "min-h-[44px] sm:min-h-0",
|
|
283
364
|
children: (() => {
|
|
284
|
-
let t =
|
|
285
|
-
if (
|
|
286
|
-
|
|
365
|
+
let t = f.type || e.type, r = f.widget || e.widget;
|
|
366
|
+
if (r === "permission-facet-link") return /* @__PURE__ */ Z(qt, {
|
|
367
|
+
value: n,
|
|
368
|
+
field: f
|
|
369
|
+
});
|
|
370
|
+
if (r === "capability-multiselect") return /* @__PURE__ */ Z(bt, {
|
|
371
|
+
value: n,
|
|
372
|
+
onChange: (t) => s?.(e.name, t),
|
|
373
|
+
field: f,
|
|
374
|
+
dataSource: u
|
|
375
|
+
});
|
|
376
|
+
if (t === "select" && Array.isArray(f.options) && f.options.length > 0) return /* @__PURE__ */ Z(Ct, {
|
|
377
|
+
field: f,
|
|
287
378
|
value: n == null ? "" : String(n),
|
|
288
379
|
onChange: (t) => s?.(e.name, t)
|
|
289
380
|
});
|
|
290
|
-
if (t === "boolean") return /* @__PURE__ */ Z(
|
|
291
|
-
field:
|
|
381
|
+
if (t === "boolean") return /* @__PURE__ */ Z(yt, {
|
|
382
|
+
field: f,
|
|
292
383
|
value: !!n,
|
|
293
384
|
onChange: (t) => s?.(e.name, t)
|
|
294
385
|
});
|
|
295
|
-
let
|
|
296
|
-
if (
|
|
297
|
-
field:
|
|
298
|
-
value:
|
|
386
|
+
let i = t === "user" || t === "owner", a = t === "lookup" || t === "master_detail" || t === "tree" || !!f.reference_to && !Yt.has(t);
|
|
387
|
+
if (i || a) return /* @__PURE__ */ Z(i ? wt : xt, {
|
|
388
|
+
field: f,
|
|
389
|
+
value: Xt(n),
|
|
299
390
|
onChange: (t) => s?.(e.name, t),
|
|
300
|
-
dataSource:
|
|
391
|
+
dataSource: u
|
|
301
392
|
});
|
|
302
|
-
let
|
|
393
|
+
let o = t === "date" || t === "datetime", c = t === "number" ? "number" : o ? "date" : "text", d = n == null ? "" : o ? (() => {
|
|
394
|
+
let e = String(n);
|
|
395
|
+
if (/^\d{4}-\d{2}-\d{2}/.test(e)) return e.slice(0, 10);
|
|
396
|
+
let t = new Date(e);
|
|
397
|
+
return isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-CA");
|
|
398
|
+
})() : String(typeof n == "object" ? Tt(n) ?? "" : n);
|
|
303
399
|
return /* @__PURE__ */ Z("input", {
|
|
304
|
-
type:
|
|
400
|
+
type: c,
|
|
401
|
+
autoFocus: l === e.name,
|
|
305
402
|
className: "w-full px-2 py-1.5 text-sm border rounded-md bg-background focus:outline-none focus:ring-2 focus:ring-ring",
|
|
306
|
-
value:
|
|
307
|
-
let e = String(n);
|
|
308
|
-
if (/^\d{4}-\d{2}-\d{2}/.test(e)) return e.slice(0, 10);
|
|
309
|
-
let t = new Date(e);
|
|
310
|
-
return isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-CA");
|
|
311
|
-
})() : String(typeof n == "object" ? Ct(n) ?? "" : n),
|
|
403
|
+
value: d,
|
|
312
404
|
onChange: (t) => {
|
|
313
405
|
let n = t.target.value;
|
|
314
|
-
if (
|
|
406
|
+
if (o && n) {
|
|
315
407
|
let t = (/* @__PURE__ */ new Date(n + "T00:00:00")).toISOString();
|
|
316
408
|
s?.(e.name, t);
|
|
317
409
|
} else s?.(e.name, n);
|
|
@@ -319,74 +411,88 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
319
411
|
});
|
|
320
412
|
})()
|
|
321
413
|
}) : /* @__PURE__ */ Q("div", {
|
|
322
|
-
className: G("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md",
|
|
323
|
-
onClick:
|
|
324
|
-
|
|
325
|
-
|
|
414
|
+
className: G("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md", S && "cursor-pointer active:bg-muted/60 transition-colors", _ && "cursor-pointer hover:bg-muted/40 transition-colors -mx-1.5 px-1.5"),
|
|
415
|
+
onClick: S ? () => j(e.name, n) : void 0,
|
|
416
|
+
onDoubleClick: _ ? () => c?.(e.name) : void 0,
|
|
417
|
+
onKeyDown: S ? (t) => {
|
|
418
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), j(e.name, n));
|
|
326
419
|
} : void 0,
|
|
327
|
-
role:
|
|
328
|
-
tabIndex:
|
|
420
|
+
role: S ? "button" : void 0,
|
|
421
|
+
tabIndex: S ? 0 : void 0,
|
|
422
|
+
title: _ ? b("detail.editInlineHint") : void 0,
|
|
329
423
|
children: [/* @__PURE__ */ Z("div", {
|
|
330
|
-
className: "text-sm flex-1 break-words py-1",
|
|
331
|
-
children:
|
|
332
|
-
}),
|
|
424
|
+
className: "text-sm flex-1 min-w-0 break-words py-1",
|
|
425
|
+
children: v
|
|
426
|
+
}), _ ? /* @__PURE__ */ Z(ae, { children: /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
333
427
|
asChild: !0,
|
|
334
428
|
children: /* @__PURE__ */ Z(x, {
|
|
335
429
|
variant: "ghost",
|
|
336
430
|
size: "icon",
|
|
337
431
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",
|
|
432
|
+
"aria-label": b("detail.editInlineHint"),
|
|
338
433
|
onClick: (t) => {
|
|
339
|
-
t.stopPropagation(),
|
|
434
|
+
t.stopPropagation(), c?.(e.name);
|
|
340
435
|
},
|
|
341
|
-
children:
|
|
436
|
+
children: /* @__PURE__ */ Z(We, { className: "h-3 w-3" })
|
|
342
437
|
})
|
|
343
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
438
|
+
}), /* @__PURE__ */ Z(H, { children: b("detail.editInlineHint") })] }) }) : y ? /* @__PURE__ */ Z(ae, { children: /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
439
|
+
asChild: !0,
|
|
440
|
+
children: /* @__PURE__ */ Z(x, {
|
|
441
|
+
variant: "ghost",
|
|
442
|
+
size: "icon",
|
|
443
|
+
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",
|
|
444
|
+
onClick: (t) => {
|
|
445
|
+
t.stopPropagation(), j(e.name, n);
|
|
446
|
+
},
|
|
447
|
+
children: C ? /* @__PURE__ */ Z(he, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(we, { className: "h-3 w-3" })
|
|
448
|
+
})
|
|
449
|
+
}), /* @__PURE__ */ Z(H, { children: b(C ? "detail.copied" : "detail.copyToClipboard") })] }) }) : null]
|
|
344
450
|
})]
|
|
345
451
|
}, e.name);
|
|
346
|
-
},
|
|
347
|
-
i.useEffect(() => {
|
|
348
|
-
if (!
|
|
349
|
-
|
|
452
|
+
}, z = d?.enabled === !0, B = d?.batchSize ?? 20;
|
|
453
|
+
if (i.useEffect(() => {
|
|
454
|
+
if (!z) {
|
|
455
|
+
_(void 0);
|
|
350
456
|
return;
|
|
351
457
|
}
|
|
352
|
-
if (ie.length <=
|
|
353
|
-
|
|
458
|
+
if (ie.length <= B) {
|
|
459
|
+
_(void 0);
|
|
354
460
|
return;
|
|
355
461
|
}
|
|
356
|
-
|
|
357
|
-
let e = setTimeout(() =>
|
|
462
|
+
_(B);
|
|
463
|
+
let e = setTimeout(() => _(void 0), 100);
|
|
358
464
|
return () => clearTimeout(e);
|
|
359
465
|
}, [
|
|
360
|
-
|
|
466
|
+
z,
|
|
361
467
|
ie.length,
|
|
362
|
-
|
|
363
|
-
]);
|
|
364
|
-
let
|
|
468
|
+
B
|
|
469
|
+
]), re.length === 0 && N === e.fields.length) return null;
|
|
470
|
+
let W = g === void 0 ? ie : ie.slice(0, g), se = N > 0 && (e.hideEmpty || ne), K = /* @__PURE__ */ Q(Mt, { children: [P ? /* @__PURE__ */ Z("div", {
|
|
365
471
|
className: "flex flex-col divide-y divide-border/60",
|
|
366
|
-
children:
|
|
472
|
+
children: W.map(R)
|
|
367
473
|
}) : /* @__PURE__ */ Z("div", {
|
|
368
|
-
className: G("grid gap-3 sm:gap-4",
|
|
369
|
-
children:
|
|
370
|
-
}),
|
|
474
|
+
className: G("grid gap-3 sm:gap-4", L === 1 ? "grid-cols-1" : L === 2 ? "grid-cols-1 md:grid-cols-2" : L === 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"),
|
|
475
|
+
children: W.map(R)
|
|
476
|
+
}), se && /* @__PURE__ */ Z("div", {
|
|
371
477
|
className: "mt-3 -ml-2",
|
|
372
478
|
children: /* @__PURE__ */ Q(x, {
|
|
373
479
|
type: "button",
|
|
374
480
|
variant: "ghost",
|
|
375
481
|
size: "sm",
|
|
376
|
-
onClick: () =>
|
|
482
|
+
onClick: () => y((e) => !e),
|
|
377
483
|
className: "h-7 px-2 text-xs text-muted-foreground hover:text-foreground",
|
|
378
|
-
children: [Z(
|
|
379
|
-
count:
|
|
380
|
-
defaultValue: `Show ${
|
|
484
|
+
children: [Z(v ? Oe : De, { className: "h-3.5 w-3.5 mr-1.5" }), v ? b("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : b("detail.showEmptyFields", {
|
|
485
|
+
count: N,
|
|
486
|
+
defaultValue: `Show ${N} empty field${N === 1 ? "" : "s"}`
|
|
381
487
|
})]
|
|
382
488
|
})
|
|
383
489
|
})] });
|
|
384
490
|
return !e.title && !e.collapsible && e.showBorder === !1 ? /* @__PURE__ */ Z("div", {
|
|
385
491
|
className: G(n),
|
|
386
|
-
children:
|
|
492
|
+
children: K
|
|
387
493
|
}) : e.collapsible ? /* @__PURE__ */ Z(E, {
|
|
388
|
-
open: !
|
|
389
|
-
onOpenChange: (e) =>
|
|
494
|
+
open: !f,
|
|
495
|
+
onOpenChange: (e) => p(!e),
|
|
390
496
|
className: n,
|
|
391
497
|
children: /* @__PURE__ */ Q(S, { children: [/* @__PURE__ */ Z(O, {
|
|
392
498
|
asChild: !0,
|
|
@@ -402,16 +508,16 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
402
508
|
}), /* @__PURE__ */ Z("span", { children: e.title })]
|
|
403
509
|
}), /* @__PURE__ */ Z("div", {
|
|
404
510
|
className: "flex items-center gap-2",
|
|
405
|
-
children: Z(
|
|
511
|
+
children: Z(f ? ye : _e, { className: "h-4 w-4 text-muted-foreground" })
|
|
406
512
|
})]
|
|
407
|
-
}), e.description && !
|
|
513
|
+
}), e.description && !f && /* @__PURE__ */ Z("p", {
|
|
408
514
|
className: "text-xs text-muted-foreground mt-1",
|
|
409
515
|
children: e.description
|
|
410
516
|
})]
|
|
411
517
|
})
|
|
412
518
|
}), /* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z(C, {
|
|
413
519
|
className: "pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5",
|
|
414
|
-
children:
|
|
520
|
+
children: K
|
|
415
521
|
}) })] })
|
|
416
522
|
}) : /* @__PURE__ */ Q(S, {
|
|
417
523
|
className: G(e.showBorder === !1 ? "border-none shadow-none" : "", n),
|
|
@@ -432,10 +538,10 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
432
538
|
})]
|
|
433
539
|
}), /* @__PURE__ */ Z(C, {
|
|
434
540
|
className: "pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5",
|
|
435
|
-
children:
|
|
541
|
+
children: K
|
|
436
542
|
})]
|
|
437
543
|
});
|
|
438
|
-
},
|
|
544
|
+
}, Qt = ({ tabs: e, data: t, className: n }) => {
|
|
439
545
|
let [r, a] = i.useState(e[0]?.key), o = e.filter((e) => typeof e.visible == "boolean" ? e.visible : (e.visible, !0));
|
|
440
546
|
return /* @__PURE__ */ Q(L, {
|
|
441
547
|
value: r,
|
|
@@ -466,11 +572,11 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
466
572
|
fallback: null,
|
|
467
573
|
children: Array.isArray(e.content) ? /* @__PURE__ */ Z("div", {
|
|
468
574
|
className: "space-y-4",
|
|
469
|
-
children: e.content.map((e, n) => /* @__PURE__ */ Z(
|
|
575
|
+
children: e.content.map((e, n) => /* @__PURE__ */ Z(ot, {
|
|
470
576
|
schema: e,
|
|
471
577
|
data: t
|
|
472
578
|
}, n))
|
|
473
|
-
}) : /* @__PURE__ */ Z(
|
|
579
|
+
}) : /* @__PURE__ */ Z(ot, {
|
|
474
580
|
schema: e.content,
|
|
475
581
|
data: t
|
|
476
582
|
})
|
|
@@ -480,66 +586,82 @@ var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
480
586
|
};
|
|
481
587
|
//#endregion
|
|
482
588
|
//#region src/RelatedList.tsx
|
|
483
|
-
function
|
|
484
|
-
return e &&
|
|
589
|
+
function $t(e) {
|
|
590
|
+
return e && at[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || X;
|
|
485
591
|
}
|
|
486
|
-
var
|
|
487
|
-
let
|
|
592
|
+
var en = ({ action: e, onToolbarAction: t }) => {
|
|
593
|
+
let n = e.visible, r = lt(st(n));
|
|
594
|
+
if (n && !r) return null;
|
|
595
|
+
let i = e.icon ? $t(e.icon) : null;
|
|
596
|
+
return /* @__PURE__ */ Q(x, {
|
|
597
|
+
variant: e.variant === "primary" ? "default" : "outline",
|
|
598
|
+
size: "sm",
|
|
599
|
+
onClick: (n) => {
|
|
600
|
+
n.stopPropagation(), t(e);
|
|
601
|
+
},
|
|
602
|
+
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
603
|
+
"data-testid": `related-toolbar-action-${e.name}`,
|
|
604
|
+
children: [i && /* @__PURE__ */ Z(i, { className: "h-3.5 w-3.5" }), e.label || e.name]
|
|
605
|
+
});
|
|
606
|
+
}, tn = ({ 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: F = 6, pageSize: ee, sortable: te = !1, filterable: ne = !1, collapsible: re = !1, defaultCollapsed: ie = !1, referenceField: I, parentId: L, icon: R }) => {
|
|
607
|
+
let z = r !== void 0, B = r ?? [], [V, H] = i.useState(B), [ae, U] = i.useState(() => !!n && !z), [W, se] = i.useState(0), [K, ce] = i.useState(null), [q, le] = i.useState("asc"), [de, fe] = i.useState(""), [J, pe] = i.useState(null), [me, he] = i.useState(ie), [ge, be] = i.useState(!1), [xe, Se] = i.useState(!1), [Ce, we] = i.useState(null), [Te, De] = i.useState(0), [Oe, ke] = i.useState({}), { t: Y } = $(), { fieldLabel: Ae } = vt();
|
|
488
608
|
i.useEffect(() => {
|
|
489
|
-
|
|
490
|
-
}, [r,
|
|
491
|
-
n && g?.getObjectSchema && g.getObjectSchema(n).then(
|
|
609
|
+
z && H(r ?? []);
|
|
610
|
+
}, [r, z]), i.useEffect(() => {
|
|
611
|
+
n && g?.getObjectSchema && g.getObjectSchema(n).then(pe).catch((e) => {
|
|
492
612
|
console.warn(`[RelatedList] Failed to fetch schema for ${n}:`, e);
|
|
493
613
|
});
|
|
494
614
|
}, [n, g]), i.useEffect(() => {
|
|
495
|
-
if (n && !
|
|
496
|
-
if (!(
|
|
497
|
-
n && (
|
|
615
|
+
if (n && !z) {
|
|
616
|
+
if (!(I && L != null && L !== "")) {
|
|
617
|
+
n && (L == null || L === "") && !I && console.warn(`[RelatedList] "${n}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`), H([]), U(!1);
|
|
498
618
|
return;
|
|
499
619
|
}
|
|
500
|
-
|
|
501
|
-
let e = { [
|
|
620
|
+
U(!0);
|
|
621
|
+
let e = { [I]: L };
|
|
502
622
|
if (g && typeof g.find == "function") g.find(n, { $filter: e }).then((e) => {
|
|
503
|
-
|
|
623
|
+
let t = Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : [];
|
|
624
|
+
H(t), U(!1);
|
|
504
625
|
}).catch((e) => {
|
|
505
|
-
console.error("Failed to fetch related data:", e),
|
|
626
|
+
console.error("Failed to fetch related data:", e), U(!1);
|
|
506
627
|
});
|
|
507
628
|
else {
|
|
508
|
-
let e = new URLSearchParams({ [`filter[${
|
|
629
|
+
let e = new URLSearchParams({ [`filter[${I}]`]: String(L) }).toString();
|
|
509
630
|
fetch(`${n}?${e}`).then((e) => e.json()).then((e) => {
|
|
510
|
-
|
|
631
|
+
let t = Array.isArray(e) ? e : e?.data || [];
|
|
632
|
+
H(t);
|
|
511
633
|
}).catch((e) => {
|
|
512
634
|
console.error("Failed to fetch related data:", e);
|
|
513
|
-
}).finally(() =>
|
|
635
|
+
}).finally(() => U(!1));
|
|
514
636
|
}
|
|
515
637
|
}
|
|
516
638
|
}, [
|
|
517
639
|
n,
|
|
518
|
-
|
|
640
|
+
z,
|
|
519
641
|
g,
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
642
|
+
I,
|
|
643
|
+
L,
|
|
644
|
+
Te
|
|
523
645
|
]), i.useEffect(() => {
|
|
524
|
-
if (!n ||
|
|
646
|
+
if (!n || z) return;
|
|
525
647
|
let e = (e) => {
|
|
526
648
|
let t = e.detail || {};
|
|
527
|
-
t.objectName && t.objectName !== n ||
|
|
649
|
+
t.objectName && t.objectName !== n || De((e) => e + 1);
|
|
528
650
|
};
|
|
529
651
|
return window.addEventListener("objectui:related-changed", e), () => window.removeEventListener("objectui:related-changed", e);
|
|
530
|
-
}, [n,
|
|
531
|
-
if (!g?.find || !
|
|
532
|
-
let e =
|
|
652
|
+
}, [n, z]), i.useEffect(() => {
|
|
653
|
+
if (!g?.find || !J?.fields || !V.length) return;
|
|
654
|
+
let e = J.fields, t = [];
|
|
533
655
|
for (let [n, r] of Object.entries(e)) {
|
|
534
656
|
if (!r || r.type !== "lookup" && r.type !== "master_detail") continue;
|
|
535
657
|
let e = r.reference_to || r.reference;
|
|
536
658
|
if (!e) continue;
|
|
537
659
|
let i = /* @__PURE__ */ new Set();
|
|
538
|
-
for (let e of
|
|
660
|
+
for (let e of V) {
|
|
539
661
|
let t = e?.[n];
|
|
540
662
|
t != null && (typeof t == "string" && t ? i.add(t) : typeof t == "number" && i.add(String(t)));
|
|
541
663
|
}
|
|
542
|
-
let a =
|
|
664
|
+
let a = Oe[n] || {}, o = Array.from(i).filter((e) => !(e in a));
|
|
543
665
|
o.length > 0 && t.push({
|
|
544
666
|
fieldName: n,
|
|
545
667
|
target: e,
|
|
@@ -565,7 +687,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
565
687
|
fieldName: e,
|
|
566
688
|
map: {}
|
|
567
689
|
})))).then((e) => {
|
|
568
|
-
n ||
|
|
690
|
+
n || ke((t) => {
|
|
569
691
|
let n = { ...t };
|
|
570
692
|
for (let { fieldName: t, map: r } of e) n[t] = {
|
|
571
693
|
...n[t] || {},
|
|
@@ -578,83 +700,83 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
578
700
|
};
|
|
579
701
|
}, [
|
|
580
702
|
g,
|
|
581
|
-
|
|
582
|
-
|
|
703
|
+
J,
|
|
704
|
+
V
|
|
583
705
|
]);
|
|
584
|
-
let
|
|
585
|
-
if (!
|
|
586
|
-
let e =
|
|
587
|
-
return
|
|
588
|
-
}, [
|
|
589
|
-
let n = e[
|
|
706
|
+
let je = i.useMemo(() => {
|
|
707
|
+
if (!de) return V;
|
|
708
|
+
let e = de.toLowerCase();
|
|
709
|
+
return V.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
710
|
+
}, [V, de]), Me = i.useMemo(() => K ? [...je].sort((e, t) => {
|
|
711
|
+
let n = e[K], r = t[K];
|
|
590
712
|
if (n == null && r == null) return 0;
|
|
591
713
|
if (n == null) return 1;
|
|
592
714
|
if (r == null) return -1;
|
|
593
715
|
let i = String(n).localeCompare(String(r), void 0, { numeric: !0 });
|
|
594
|
-
return
|
|
595
|
-
}) :
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
]),
|
|
716
|
+
return q === "asc" ? i : -i;
|
|
717
|
+
}) : je, [
|
|
718
|
+
je,
|
|
719
|
+
K,
|
|
720
|
+
q
|
|
721
|
+
]), X = ee && ee > 0 ? ee : 0, Ne = X ? Math.max(1, Math.ceil(Me.length / X)) : 1, Pe = X ? Me.slice(W * X, (W + 1) * X) : Me;
|
|
600
722
|
i.useEffect(() => {
|
|
601
|
-
|
|
723
|
+
se(0);
|
|
602
724
|
}, [
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
725
|
+
de,
|
|
726
|
+
K,
|
|
727
|
+
q
|
|
606
728
|
]);
|
|
607
|
-
let
|
|
608
|
-
|
|
609
|
-
}, [
|
|
610
|
-
|
|
611
|
-
}, []),
|
|
612
|
-
if (
|
|
613
|
-
await D?.(
|
|
729
|
+
let Fe = i.useCallback((e) => {
|
|
730
|
+
K === e ? le((e) => e === "asc" ? "desc" : "asc") : (ce(e), le("asc"));
|
|
731
|
+
}, [K]), [Ie, Le] = i.useState(null), Re = i.useCallback((e) => {
|
|
732
|
+
Le(e);
|
|
733
|
+
}, []), ze = i.useCallback(async () => {
|
|
734
|
+
if (Ie) try {
|
|
735
|
+
await D?.(Ie), De((e) => e + 1);
|
|
614
736
|
} catch (e) {
|
|
615
737
|
console.error("[RelatedList] remove failed", e);
|
|
616
738
|
}
|
|
617
|
-
|
|
618
|
-
}, [
|
|
619
|
-
if (!
|
|
620
|
-
let t =
|
|
621
|
-
|
|
739
|
+
Le(null);
|
|
740
|
+
}, [Ie, D]), Be = i.useCallback(async (e) => {
|
|
741
|
+
if (!P || !g || !n || I == null || L == null) return;
|
|
742
|
+
let t = P.picker.valueField || "id";
|
|
743
|
+
Se(!0), we(null);
|
|
622
744
|
try {
|
|
623
745
|
for (let r of e || []) {
|
|
624
746
|
let e = r?.[t] ?? r?.id;
|
|
625
|
-
e != null && (
|
|
626
|
-
[
|
|
627
|
-
[
|
|
628
|
-
}) : await g.update?.(
|
|
747
|
+
e != null && (P.linkField ? await g.create?.(n, {
|
|
748
|
+
[I]: L,
|
|
749
|
+
[P.linkField]: e
|
|
750
|
+
}) : await g.update?.(P.picker.object, String(e), { [I]: L }));
|
|
629
751
|
}
|
|
630
|
-
|
|
752
|
+
De((e) => e + 1);
|
|
631
753
|
} catch (e) {
|
|
632
754
|
let t = e?.body?.error ?? e?.error ?? e?.message ?? String(e);
|
|
633
|
-
|
|
755
|
+
we(typeof t == "string" ? t : "Failed to add");
|
|
634
756
|
} finally {
|
|
635
|
-
|
|
757
|
+
Se(!1), be(!1);
|
|
636
758
|
}
|
|
637
759
|
}, [
|
|
638
|
-
|
|
760
|
+
P,
|
|
639
761
|
g,
|
|
640
762
|
n,
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
]),
|
|
644
|
-
let e = _ || n || "", t = (t) => !
|
|
763
|
+
I,
|
|
764
|
+
L
|
|
765
|
+
]), Ve = Pt(), He = i.useMemo(() => {
|
|
766
|
+
let e = _ || n || "", t = (t) => !Ve?.isLoaded || !e ? t : t.filter((t) => {
|
|
645
767
|
let n = t?.accessorKey || t?.field || t?.name;
|
|
646
|
-
return n ?
|
|
647
|
-
}), r = (e) =>
|
|
768
|
+
return n ? Ve.checkField(e, String(n), "read") : !0;
|
|
769
|
+
}), r = (e) => I ? e.filter((e) => (e?.accessorKey || e?.field || e?.name) !== I) : e, a = (e) => e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0, s = (e) => V.length ? e.filter((e) => {
|
|
648
770
|
let t = e?.accessorKey || e?.field || e?.name;
|
|
649
|
-
return t ?
|
|
771
|
+
return t ? V.some((e) => !a(e?.[t])) : !0;
|
|
650
772
|
}) : e, c = (e, t) => {
|
|
651
773
|
if (!t?.type) return;
|
|
652
|
-
let n =
|
|
774
|
+
let n = Et(kt({
|
|
653
775
|
type: t.type,
|
|
654
776
|
format: t.format
|
|
655
777
|
}) || t.type);
|
|
656
778
|
if (!n) return;
|
|
657
|
-
let r = t.type === "lookup" || t.type === "master_detail" ?
|
|
779
|
+
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
780
|
value: e,
|
|
659
781
|
label: t
|
|
660
782
|
})) : void 0, o = {
|
|
@@ -677,7 +799,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
677
799
|
if (typeof t != "string") {
|
|
678
800
|
let e = t?.accessorKey || t?.field || t?.name;
|
|
679
801
|
if (t && !t.cell && !t.render && e) {
|
|
680
|
-
let n =
|
|
802
|
+
let n = J?.fields?.[e], r = n ? c(String(e), n) : void 0;
|
|
681
803
|
if (r) return {
|
|
682
804
|
...t,
|
|
683
805
|
cell: r
|
|
@@ -685,20 +807,20 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
685
807
|
}
|
|
686
808
|
return t;
|
|
687
809
|
}
|
|
688
|
-
let n =
|
|
810
|
+
let n = J?.fields?.[t], r = {
|
|
689
811
|
accessorKey: t,
|
|
690
|
-
header: n?.label ||
|
|
812
|
+
header: n?.label || Ae(e, t, n) || t,
|
|
691
813
|
fieldDef: n,
|
|
692
814
|
fieldType: n?.type
|
|
693
815
|
}, i = n ? c(t, n) : void 0;
|
|
694
816
|
return i && (r.cell = i), r;
|
|
695
817
|
};
|
|
696
818
|
if (o && o.length > 0) return s(t(r(o.map(l))));
|
|
697
|
-
if (!
|
|
698
|
-
let u = Array.isArray(
|
|
819
|
+
if (!J?.fields) return [];
|
|
820
|
+
let u = Array.isArray(J.highlightFields) ? J.highlightFields.filter((e) => typeof e == "string" && e.length > 0) : [];
|
|
699
821
|
if (u.length > 0) {
|
|
700
822
|
let e = s(t(r(u.map(l))));
|
|
701
|
-
if (e.length > 0) return e.slice(0, Math.max(1,
|
|
823
|
+
if (e.length > 0) return e.slice(0, Math.max(1, F));
|
|
702
824
|
}
|
|
703
825
|
let d = e, f = /* @__PURE__ */ new Set([
|
|
704
826
|
"image",
|
|
@@ -716,7 +838,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
716
838
|
"label",
|
|
717
839
|
"code",
|
|
718
840
|
"number"
|
|
719
|
-
], m = Object.entries(
|
|
841
|
+
], m = Object.entries(J.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === I || t?.hidden || t?.type && f.has(t.type) || Ve?.isLoaded && d && !Ve.checkField(d, e, "read"))), h = /* @__PURE__ */ new Set([
|
|
720
842
|
"created_at",
|
|
721
843
|
"updated_at",
|
|
722
844
|
"created_by",
|
|
@@ -734,32 +856,32 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
734
856
|
}), s(m.map(([e, t]) => {
|
|
735
857
|
let n = {
|
|
736
858
|
accessorKey: e,
|
|
737
|
-
header:
|
|
859
|
+
header: Ae(d, e, t.label || e)
|
|
738
860
|
};
|
|
739
861
|
if (t.type) {
|
|
740
862
|
let r = c(e, t);
|
|
741
863
|
r && (n.cell = r);
|
|
742
864
|
}
|
|
743
865
|
return n;
|
|
744
|
-
})).slice(0, Math.max(1,
|
|
866
|
+
})).slice(0, Math.max(1, F));
|
|
745
867
|
}, [
|
|
746
868
|
o,
|
|
747
|
-
|
|
869
|
+
J,
|
|
748
870
|
_,
|
|
749
871
|
n,
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
]),
|
|
872
|
+
Ae,
|
|
873
|
+
I,
|
|
874
|
+
V,
|
|
875
|
+
F,
|
|
876
|
+
Oe,
|
|
877
|
+
Ve
|
|
878
|
+
]), Ue = Array.isArray(k) && k.length > 0, We = !!E || !!D || Ue, Ge = oe(), Ke = i.useMemo(() => {
|
|
757
879
|
if (a) return a;
|
|
758
|
-
if (
|
|
759
|
-
let e =
|
|
880
|
+
if (Ge && (t === "grid" || t === "table")) {
|
|
881
|
+
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
882
|
return {
|
|
761
883
|
type: "object-gallery",
|
|
762
|
-
data:
|
|
884
|
+
data: Pe,
|
|
763
885
|
objectName: n,
|
|
764
886
|
gallery: {
|
|
765
887
|
titleField: e || "name",
|
|
@@ -773,22 +895,22 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
773
895
|
case "grid":
|
|
774
896
|
case "table": return {
|
|
775
897
|
type: "data-table",
|
|
776
|
-
data:
|
|
777
|
-
columns:
|
|
898
|
+
data: Pe,
|
|
899
|
+
columns: He,
|
|
778
900
|
pagination: !1,
|
|
779
|
-
pageSize:
|
|
901
|
+
pageSize: X || 10,
|
|
780
902
|
searchable: !1,
|
|
781
903
|
exportable: !1,
|
|
782
|
-
rowActions:
|
|
904
|
+
rowActions: We,
|
|
783
905
|
onRowEdit: E,
|
|
784
|
-
onRowDelete: D ?
|
|
906
|
+
onRowDelete: D ? Re : void 0,
|
|
785
907
|
onRowClick: O,
|
|
786
|
-
rowActionDefs:
|
|
787
|
-
onRowActionDef:
|
|
908
|
+
rowActionDefs: Ue ? k : void 0,
|
|
909
|
+
onRowActionDef: Ue ? j : void 0
|
|
788
910
|
};
|
|
789
911
|
case "list": return {
|
|
790
912
|
type: "data-list",
|
|
791
|
-
data:
|
|
913
|
+
data: Pe
|
|
792
914
|
};
|
|
793
915
|
default: return {
|
|
794
916
|
type: "div",
|
|
@@ -797,139 +919,146 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
797
919
|
}
|
|
798
920
|
}, [
|
|
799
921
|
t,
|
|
800
|
-
|
|
801
|
-
Be,
|
|
802
|
-
a,
|
|
803
|
-
Y,
|
|
922
|
+
Pe,
|
|
804
923
|
He,
|
|
805
|
-
|
|
924
|
+
a,
|
|
925
|
+
X,
|
|
926
|
+
We,
|
|
927
|
+
Ue,
|
|
806
928
|
k,
|
|
807
929
|
j,
|
|
808
930
|
E,
|
|
809
931
|
D,
|
|
810
|
-
|
|
932
|
+
Re,
|
|
811
933
|
O,
|
|
812
|
-
|
|
934
|
+
Ge,
|
|
813
935
|
n
|
|
814
|
-
]),
|
|
936
|
+
]), Je = re ? "cursor-pointer select-none" : void 0, Ye = re ? () => he((e) => !e) : void 0, Xe = $t(R), Ze = !ae && V.length === 0, Qe = ne;
|
|
815
937
|
return /* @__PURE__ */ Q(S, {
|
|
816
|
-
className: G("shadow-none border-border/60 bg-transparent",
|
|
938
|
+
className: G("shadow-none border-border/60 bg-transparent", Ze && "bg-muted/10", s),
|
|
817
939
|
children: [
|
|
818
940
|
/* @__PURE__ */ Z(w, {
|
|
819
|
-
className: G("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0",
|
|
820
|
-
onClick:
|
|
941
|
+
className: G("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", Je),
|
|
942
|
+
onClick: Ye,
|
|
821
943
|
children: /* @__PURE__ */ Q(T, {
|
|
822
944
|
className: "flex items-center justify-between gap-2 text-sm font-semibold",
|
|
823
945
|
children: [/* @__PURE__ */ Q("div", {
|
|
824
946
|
className: "flex items-center gap-2 min-w-0",
|
|
825
947
|
children: [
|
|
826
|
-
re && Z(
|
|
827
|
-
/* @__PURE__ */ Z(
|
|
948
|
+
re && Z(me ? ye : _e, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
|
|
949
|
+
/* @__PURE__ */ Z(Xe, {
|
|
828
950
|
className: "h-4 w-4 text-muted-foreground shrink-0",
|
|
829
951
|
"aria-hidden": !0
|
|
830
952
|
}),
|
|
831
953
|
/* @__PURE__ */ Z("span", {
|
|
832
|
-
className: G("truncate",
|
|
954
|
+
className: G("truncate", Ze && "text-muted-foreground font-medium"),
|
|
833
955
|
children: e
|
|
834
956
|
}),
|
|
835
957
|
/* @__PURE__ */ Z(b, {
|
|
836
958
|
variant: "secondary",
|
|
837
|
-
className: G("text-xs font-normal h-5 px-1.5",
|
|
838
|
-
"aria-label": `${
|
|
839
|
-
children:
|
|
959
|
+
className: G("text-xs font-normal h-5 px-1.5", V.length === 0 && "bg-muted text-muted-foreground"),
|
|
960
|
+
"aria-label": `${V.length} records`,
|
|
961
|
+
children: V.length
|
|
840
962
|
}),
|
|
841
|
-
|
|
963
|
+
Ze && /* @__PURE__ */ Z("span", {
|
|
842
964
|
className: "text-xs text-muted-foreground/70 italic ml-1 truncate",
|
|
843
|
-
children:
|
|
965
|
+
children: Y("detail.noRelatedRecords")
|
|
844
966
|
})
|
|
845
967
|
]
|
|
846
968
|
}), /* @__PURE__ */ Q("div", {
|
|
847
969
|
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
|
-
|
|
970
|
+
children: [
|
|
971
|
+
N && (M ?? []).map((e) => /* @__PURE__ */ Z(en, {
|
|
972
|
+
action: e,
|
|
973
|
+
onToolbarAction: N
|
|
974
|
+
}, e.name)),
|
|
975
|
+
P && /* @__PURE__ */ Q(x, {
|
|
976
|
+
variant: Ze ? "ghost" : "outline",
|
|
977
|
+
size: "sm",
|
|
978
|
+
disabled: xe,
|
|
979
|
+
onClick: (e) => {
|
|
980
|
+
e.stopPropagation(), we(null), be(!0);
|
|
981
|
+
},
|
|
982
|
+
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
983
|
+
children: [/* @__PURE__ */ Z(qe, { className: "h-3.5 w-3.5" }), P.label || Y("detail.add", { defaultValue: "Add" })]
|
|
984
|
+
}),
|
|
985
|
+
v && /* @__PURE__ */ Q(x, {
|
|
986
|
+
variant: Ze ? "ghost" : "outline",
|
|
987
|
+
size: "sm",
|
|
988
|
+
onClick: (e) => {
|
|
989
|
+
e.stopPropagation(), v();
|
|
990
|
+
},
|
|
991
|
+
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
992
|
+
children: [/* @__PURE__ */ Z(qe, { className: "h-3.5 w-3.5" }), Y("detail.new")]
|
|
993
|
+
})
|
|
994
|
+
]
|
|
866
995
|
})]
|
|
867
996
|
})
|
|
868
997
|
}),
|
|
869
|
-
!
|
|
998
|
+
!me && !Ze && /* @__PURE__ */ Q(C, {
|
|
870
999
|
className: G("pt-0 pb-4 px-4"),
|
|
871
1000
|
children: [
|
|
872
|
-
|
|
1001
|
+
Qe && /* @__PURE__ */ Z("div", {
|
|
873
1002
|
className: "mb-3",
|
|
874
1003
|
children: /* @__PURE__ */ Z(A, {
|
|
875
|
-
placeholder:
|
|
876
|
-
value:
|
|
877
|
-
onChange: (e) =>
|
|
1004
|
+
placeholder: Y("detail.filterPlaceholder"),
|
|
1005
|
+
value: de,
|
|
1006
|
+
onChange: (e) => fe(e.target.value),
|
|
878
1007
|
className: "h-8 text-sm"
|
|
879
1008
|
})
|
|
880
1009
|
}),
|
|
881
|
-
te &&
|
|
1010
|
+
te && He && He.length > 0 && V.length > 0 && /* @__PURE__ */ Z("div", {
|
|
882
1011
|
className: "flex flex-wrap gap-1 mb-3",
|
|
883
|
-
children:
|
|
1012
|
+
children: He.map((e) => {
|
|
884
1013
|
let t = e.accessorKey || e.field || e.name;
|
|
885
1014
|
if (!t) return null;
|
|
886
|
-
let n = e.header || e.label || t, r =
|
|
1015
|
+
let n = e.header || e.label || t, r = K === t;
|
|
887
1016
|
return /* @__PURE__ */ Q(x, {
|
|
888
1017
|
variant: r ? "secondary" : "ghost",
|
|
889
1018
|
size: "sm",
|
|
890
1019
|
className: "gap-1 h-7 text-xs",
|
|
891
|
-
onClick: () =>
|
|
1020
|
+
onClick: () => Fe(t),
|
|
892
1021
|
children: [
|
|
893
|
-
/* @__PURE__ */ Z(
|
|
1022
|
+
/* @__PURE__ */ Z(ue, { className: "h-3 w-3" }),
|
|
894
1023
|
n,
|
|
895
|
-
r && (
|
|
1024
|
+
r && (q === "asc" ? " ↑" : " ↓")
|
|
896
1025
|
]
|
|
897
1026
|
}, t);
|
|
898
1027
|
})
|
|
899
1028
|
}),
|
|
900
|
-
|
|
1029
|
+
ae ? /* @__PURE__ */ Z("div", {
|
|
901
1030
|
className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
|
|
902
|
-
children:
|
|
903
|
-
}) : /* @__PURE__ */ Z(
|
|
904
|
-
|
|
1031
|
+
children: Y("detail.loading")
|
|
1032
|
+
}) : /* @__PURE__ */ Z(ot, { schema: Ke }),
|
|
1033
|
+
X > 0 && Me.length > X && /* @__PURE__ */ Q("div", {
|
|
905
1034
|
className: "flex items-center justify-between mt-3 pt-3 border-t",
|
|
906
1035
|
children: [
|
|
907
1036
|
/* @__PURE__ */ Q(x, {
|
|
908
1037
|
variant: "outline",
|
|
909
1038
|
size: "sm",
|
|
910
1039
|
className: "h-7 text-xs gap-1",
|
|
911
|
-
disabled:
|
|
912
|
-
onClick: () =>
|
|
913
|
-
children: [/* @__PURE__ */ Z(
|
|
1040
|
+
disabled: W === 0,
|
|
1041
|
+
onClick: () => se((e) => Math.max(0, e - 1)),
|
|
1042
|
+
children: [/* @__PURE__ */ Z(ve, { className: "h-3 w-3" }), Y("detail.previousPage")]
|
|
914
1043
|
}),
|
|
915
1044
|
/* @__PURE__ */ Z("span", {
|
|
916
1045
|
className: "text-xs text-muted-foreground",
|
|
917
|
-
children:
|
|
918
|
-
current:
|
|
919
|
-
total:
|
|
1046
|
+
children: Y("detail.pageOf", {
|
|
1047
|
+
current: W + 1,
|
|
1048
|
+
total: Ne
|
|
920
1049
|
})
|
|
921
1050
|
}),
|
|
922
1051
|
/* @__PURE__ */ Q(x, {
|
|
923
1052
|
variant: "outline",
|
|
924
1053
|
size: "sm",
|
|
925
1054
|
className: "h-7 text-xs gap-1",
|
|
926
|
-
disabled:
|
|
927
|
-
onClick: () =>
|
|
928
|
-
children: [
|
|
1055
|
+
disabled: W >= Ne - 1,
|
|
1056
|
+
onClick: () => se((e) => Math.min(Ne - 1, e + 1)),
|
|
1057
|
+
children: [Y("detail.nextPage"), /* @__PURE__ */ Z(ye, { className: "h-3 w-3" })]
|
|
929
1058
|
})
|
|
930
1059
|
]
|
|
931
1060
|
}),
|
|
932
|
-
y && !
|
|
1061
|
+
y && !Ze && X > 0 && Me.length > X && /* @__PURE__ */ Z("div", {
|
|
933
1062
|
className: "mt-3 pt-3 border-t flex justify-center",
|
|
934
1063
|
children: /* @__PURE__ */ Q("button", {
|
|
935
1064
|
type: "button",
|
|
@@ -937,57 +1066,59 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
937
1066
|
e.stopPropagation(), y();
|
|
938
1067
|
},
|
|
939
1068
|
className: "text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors",
|
|
940
|
-
children: [
|
|
1069
|
+
children: [Y("detail.viewAll"), /* @__PURE__ */ Z(Ee, { className: "h-3 w-3" })]
|
|
941
1070
|
})
|
|
942
1071
|
})
|
|
943
1072
|
]
|
|
944
1073
|
}),
|
|
945
1074
|
/* @__PURE__ */ Z(c, {
|
|
946
|
-
open:
|
|
1075
|
+
open: Ie !== null,
|
|
947
1076
|
onOpenChange: (e) => {
|
|
948
|
-
e ||
|
|
1077
|
+
e || Le(null);
|
|
949
1078
|
},
|
|
950
|
-
children: /* @__PURE__ */ Q(d, { children: [/* @__PURE__ */ Q(m, { children: [/* @__PURE__ */ Z(h, { children:
|
|
951
|
-
onClick:
|
|
1079
|
+
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, {
|
|
1080
|
+
onClick: ze,
|
|
952
1081
|
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
953
|
-
children:
|
|
1082
|
+
children: Y("detail.delete", { defaultValue: "Delete" })
|
|
954
1083
|
})] })] })
|
|
955
1084
|
}),
|
|
956
|
-
|
|
1085
|
+
Ce && /* @__PURE__ */ Z("div", {
|
|
957
1086
|
className: "mx-4 mb-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
|
|
958
1087
|
role: "alert",
|
|
959
|
-
children:
|
|
1088
|
+
children: Ce
|
|
960
1089
|
}),
|
|
961
|
-
|
|
962
|
-
open:
|
|
963
|
-
onOpenChange: (e) =>
|
|
1090
|
+
P && g && /* @__PURE__ */ Z(St, {
|
|
1091
|
+
open: ge,
|
|
1092
|
+
onOpenChange: (e) => be(e),
|
|
964
1093
|
multiple: !0,
|
|
965
1094
|
dataSource: g,
|
|
966
|
-
objectName:
|
|
967
|
-
title:
|
|
1095
|
+
objectName: P.picker.object,
|
|
1096
|
+
title: P.label || Y("detail.add", { defaultValue: "Add" }),
|
|
968
1097
|
onSelect: () => {},
|
|
969
1098
|
onSelectRecords: (e) => {
|
|
970
|
-
|
|
1099
|
+
Be(e);
|
|
971
1100
|
}
|
|
972
1101
|
})
|
|
973
1102
|
]
|
|
974
1103
|
});
|
|
975
|
-
},
|
|
976
|
-
let
|
|
1104
|
+
}, nn = ({ group: e, data: t, className: n, objectSchema: r, objectName: a, isEditing: o = !1, onFieldChange: s, onEnterInlineEdit: c, autoFocusField: l, dataSource: u }) => {
|
|
1105
|
+
let d = e.collapsible ?? !0, [f, p] = i.useState(e.defaultCollapsed ?? !1), m = /* @__PURE__ */ Z("div", {
|
|
977
1106
|
className: "space-y-3 sm:space-y-4",
|
|
978
|
-
children: e.sections.map((e, n) => /* @__PURE__ */ Z(
|
|
1107
|
+
children: e.sections.map((e, n) => /* @__PURE__ */ Z(Zt, {
|
|
979
1108
|
section: e,
|
|
980
1109
|
data: t,
|
|
981
1110
|
objectSchema: r,
|
|
982
1111
|
objectName: a,
|
|
983
1112
|
isEditing: o,
|
|
984
1113
|
onFieldChange: s,
|
|
985
|
-
|
|
1114
|
+
onEnterInlineEdit: c,
|
|
1115
|
+
autoFocusField: l,
|
|
1116
|
+
dataSource: u
|
|
986
1117
|
}, n))
|
|
987
1118
|
});
|
|
988
|
-
return
|
|
989
|
-
open: !
|
|
990
|
-
onOpenChange: (e) =>
|
|
1119
|
+
return d ? /* @__PURE__ */ Q(E, {
|
|
1120
|
+
open: !f,
|
|
1121
|
+
onOpenChange: (e) => p(!e),
|
|
991
1122
|
className: n,
|
|
992
1123
|
children: [
|
|
993
1124
|
/* @__PURE__ */ Z(O, {
|
|
@@ -995,7 +1126,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
995
1126
|
children: /* @__PURE__ */ Q("div", {
|
|
996
1127
|
className: "flex items-center gap-2 pb-2 border-b cursor-pointer hover:bg-muted/50 transition-colors rounded-t-md px-2 py-1.5",
|
|
997
1128
|
children: [
|
|
998
|
-
Z(
|
|
1129
|
+
Z(f ? ye : _e, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
|
|
999
1130
|
e.icon && /* @__PURE__ */ Z("span", {
|
|
1000
1131
|
className: "text-muted-foreground",
|
|
1001
1132
|
children: e.icon
|
|
@@ -1007,13 +1138,13 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
1007
1138
|
]
|
|
1008
1139
|
})
|
|
1009
1140
|
}),
|
|
1010
|
-
e.description && !
|
|
1141
|
+
e.description && !f && /* @__PURE__ */ Z("p", {
|
|
1011
1142
|
className: "text-sm text-muted-foreground mt-1",
|
|
1012
1143
|
children: e.description
|
|
1013
1144
|
}),
|
|
1014
1145
|
/* @__PURE__ */ Z(D, { children: /* @__PURE__ */ Z("div", {
|
|
1015
1146
|
className: "mt-3",
|
|
1016
|
-
children:
|
|
1147
|
+
children: m
|
|
1017
1148
|
}) })
|
|
1018
1149
|
]
|
|
1019
1150
|
}) : /* @__PURE__ */ Q("div", {
|
|
@@ -1033,11 +1164,11 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
1033
1164
|
className: "text-sm text-muted-foreground",
|
|
1034
1165
|
children: e.description
|
|
1035
1166
|
}),
|
|
1036
|
-
|
|
1167
|
+
m
|
|
1037
1168
|
]
|
|
1038
1169
|
});
|
|
1039
|
-
},
|
|
1040
|
-
let { fieldLabel: a } =
|
|
1170
|
+
}, rn = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
|
|
1171
|
+
let { fieldLabel: a } = vt();
|
|
1041
1172
|
if (!e.length || !t) return null;
|
|
1042
1173
|
let o = e.filter((e) => {
|
|
1043
1174
|
let n = t?.[e.name];
|
|
@@ -1058,7 +1189,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
1058
1189
|
...o?.precision !== void 0 && { precision: o.precision },
|
|
1059
1190
|
...o?.scale !== void 0 && { scale: o.scale },
|
|
1060
1191
|
...o?.format && { format: o.format }
|
|
1061
|
-
}, l =
|
|
1192
|
+
}, l = Et(kt(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
1193
|
return /* @__PURE__ */ Q("div", {
|
|
1063
1194
|
className: G("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
1195
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -1066,13 +1197,13 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
1066
1197
|
children: a(r || "", e.name, e.label)
|
|
1067
1198
|
}), f ? n ? /* @__PURE__ */ Q("span", {
|
|
1068
1199
|
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",
|
|
1069
|
-
children: [/* @__PURE__ */ Z(
|
|
1200
|
+
children: [/* @__PURE__ */ Z(he, {
|
|
1070
1201
|
className: "h-3 w-3",
|
|
1071
1202
|
"aria-hidden": !0
|
|
1072
1203
|
}), "Yes"]
|
|
1073
1204
|
}) : /* @__PURE__ */ Q("span", {
|
|
1074
1205
|
className: "inline-flex items-center gap-1 self-start rounded-full bg-amber-500/10 px-2 py-0.5 text-xs font-medium text-amber-700 ring-1 ring-inset ring-amber-500/30 dark:text-amber-400",
|
|
1075
|
-
children: [/* @__PURE__ */ Z(
|
|
1206
|
+
children: [/* @__PURE__ */ Z(rt, {
|
|
1076
1207
|
className: "h-3 w-3",
|
|
1077
1208
|
"aria-hidden": !0
|
|
1078
1209
|
}), "No"]
|
|
@@ -1091,7 +1222,7 @@ var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
1091
1222
|
};
|
|
1092
1223
|
//#endregion
|
|
1093
1224
|
//#region src/RecordComments.tsx
|
|
1094
|
-
function
|
|
1225
|
+
function an(e) {
|
|
1095
1226
|
try {
|
|
1096
1227
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1097
1228
|
if (r < 1) return "just now";
|
|
@@ -1104,7 +1235,7 @@ function Zt(e) {
|
|
|
1104
1235
|
return e;
|
|
1105
1236
|
}
|
|
1106
1237
|
}
|
|
1107
|
-
var
|
|
1238
|
+
var on = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, className: a }) => {
|
|
1108
1239
|
let { t: o } = $(), [s, c] = i.useState(""), [l, u] = i.useState(!1), [d, f] = i.useState(""), p = i.useCallback(async () => {
|
|
1109
1240
|
let e = s.trim();
|
|
1110
1241
|
if (!(!e || !t)) {
|
|
@@ -1126,7 +1257,7 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1126
1257
|
children: [/* @__PURE__ */ Z(w, { children: /* @__PURE__ */ Q(T, {
|
|
1127
1258
|
className: "flex items-center gap-2 text-base",
|
|
1128
1259
|
children: [
|
|
1129
|
-
/* @__PURE__ */ Z(
|
|
1260
|
+
/* @__PURE__ */ Z(ze, { className: "h-4 w-4" }),
|
|
1130
1261
|
o("detail.comments"),
|
|
1131
1262
|
/* @__PURE__ */ Q("span", {
|
|
1132
1263
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1145,7 +1276,7 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1145
1276
|
children: /* @__PURE__ */ Q("div", {
|
|
1146
1277
|
className: "relative flex-1",
|
|
1147
1278
|
children: [
|
|
1148
|
-
/* @__PURE__ */ Z(
|
|
1279
|
+
/* @__PURE__ */ Z(Ze, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
|
|
1149
1280
|
/* @__PURE__ */ Z("input", {
|
|
1150
1281
|
className: "w-full rounded-md border border-input bg-background pl-8 pr-8 py-1.5 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
1151
1282
|
placeholder: o("detail.searchComments"),
|
|
@@ -1158,7 +1289,7 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1158
1289
|
onClick: () => f(""),
|
|
1159
1290
|
"aria-label": o("detail.clearSearch"),
|
|
1160
1291
|
type: "button",
|
|
1161
|
-
children: /* @__PURE__ */ Z(
|
|
1292
|
+
children: /* @__PURE__ */ Z(rt, { className: "h-3.5 w-3.5" })
|
|
1162
1293
|
})
|
|
1163
1294
|
]
|
|
1164
1295
|
})
|
|
@@ -1178,7 +1309,7 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1178
1309
|
onClick: p,
|
|
1179
1310
|
disabled: !s.trim() || l,
|
|
1180
1311
|
className: "shrink-0 self-end",
|
|
1181
|
-
children: /* @__PURE__ */ Z(
|
|
1312
|
+
children: /* @__PURE__ */ Z(Qe, { className: "h-4 w-4" })
|
|
1182
1313
|
})]
|
|
1183
1314
|
}),
|
|
1184
1315
|
h.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
@@ -1210,11 +1341,11 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1210
1341
|
}),
|
|
1211
1342
|
/* @__PURE__ */ Z("span", {
|
|
1212
1343
|
className: "text-xs text-muted-foreground",
|
|
1213
|
-
children:
|
|
1344
|
+
children: an(e.createdAt)
|
|
1214
1345
|
}),
|
|
1215
1346
|
e.pinned && /* @__PURE__ */ Q("span", {
|
|
1216
1347
|
className: "text-xs text-amber-600 flex items-center gap-0.5",
|
|
1217
|
-
children: [/* @__PURE__ */ Z(
|
|
1348
|
+
children: [/* @__PURE__ */ Z(Ke, { className: "h-3 w-3" }), o("detail.pinned")]
|
|
1218
1349
|
})
|
|
1219
1350
|
]
|
|
1220
1351
|
}),
|
|
@@ -1227,7 +1358,7 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1227
1358
|
className: "mt-1 text-xs text-muted-foreground hover:text-foreground flex items-center gap-1",
|
|
1228
1359
|
onClick: () => n(e.id),
|
|
1229
1360
|
"aria-label": e.pinned ? o("detail.unpin") : o("detail.pin"),
|
|
1230
|
-
children: [/* @__PURE__ */ Z(
|
|
1361
|
+
children: [/* @__PURE__ */ Z(Ke, { className: "h-3 w-3" }), e.pinned ? o("detail.unpin") : o("detail.pin")]
|
|
1231
1362
|
})
|
|
1232
1363
|
]
|
|
1233
1364
|
})]
|
|
@@ -1236,20 +1367,20 @@ var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1236
1367
|
]
|
|
1237
1368
|
})]
|
|
1238
1369
|
});
|
|
1239
|
-
},
|
|
1240
|
-
field_change:
|
|
1241
|
-
create:
|
|
1242
|
-
delete:
|
|
1243
|
-
comment:
|
|
1244
|
-
status_change:
|
|
1245
|
-
},
|
|
1370
|
+
}, sn = {
|
|
1371
|
+
field_change: Te,
|
|
1372
|
+
create: Je,
|
|
1373
|
+
delete: tt,
|
|
1374
|
+
comment: ze,
|
|
1375
|
+
status_change: le
|
|
1376
|
+
}, cn = {
|
|
1246
1377
|
field_change: "bg-blue-100 text-blue-600",
|
|
1247
1378
|
create: "bg-green-100 text-green-600",
|
|
1248
1379
|
delete: "bg-red-100 text-red-600",
|
|
1249
1380
|
comment: "bg-purple-100 text-purple-600",
|
|
1250
1381
|
status_change: "bg-amber-100 text-amber-600"
|
|
1251
1382
|
};
|
|
1252
|
-
function
|
|
1383
|
+
function ln(e) {
|
|
1253
1384
|
try {
|
|
1254
1385
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1255
1386
|
if (r < 1) return "just now";
|
|
@@ -1262,24 +1393,24 @@ function tn(e) {
|
|
|
1262
1393
|
return e;
|
|
1263
1394
|
}
|
|
1264
1395
|
}
|
|
1265
|
-
function
|
|
1396
|
+
function un(e) {
|
|
1266
1397
|
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";
|
|
1267
1398
|
}
|
|
1268
|
-
var
|
|
1399
|
+
var dn = {
|
|
1269
1400
|
all: "All",
|
|
1270
1401
|
field_change: "Field Changes",
|
|
1271
1402
|
create: "Creates",
|
|
1272
1403
|
delete: "Deletes",
|
|
1273
1404
|
comment: "Comments",
|
|
1274
1405
|
status_change: "Status Changes"
|
|
1275
|
-
},
|
|
1406
|
+
}, fn = ({ activities: e, filterable: t = !1, defaultFilter: n = "all", className: r }) => {
|
|
1276
1407
|
let [a, o] = i.useState(n), s = i.useMemo(() => a === "all" ? e : e.filter((e) => e.type === a), [e, a]);
|
|
1277
1408
|
return /* @__PURE__ */ Q(S, {
|
|
1278
1409
|
className: G("", r),
|
|
1279
1410
|
children: [/* @__PURE__ */ Z(w, { children: /* @__PURE__ */ Q(T, {
|
|
1280
1411
|
className: "flex items-center gap-2 text-base",
|
|
1281
1412
|
children: [
|
|
1282
|
-
/* @__PURE__ */ Z(
|
|
1413
|
+
/* @__PURE__ */ Z(se, { className: "h-4 w-4" }),
|
|
1283
1414
|
"Activity",
|
|
1284
1415
|
/* @__PURE__ */ Q("span", {
|
|
1285
1416
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1294,12 +1425,12 @@ var rn = {
|
|
|
1294
1425
|
className: "flex flex-wrap gap-1.5 mb-4",
|
|
1295
1426
|
role: "group",
|
|
1296
1427
|
"aria-label": "Activity type filter",
|
|
1297
|
-
children: Object.keys(
|
|
1428
|
+
children: Object.keys(dn).map((e) => /* @__PURE__ */ Q("button", {
|
|
1298
1429
|
type: "button",
|
|
1299
1430
|
className: G("inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors", a === e ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-muted/80"),
|
|
1300
1431
|
onClick: () => o(e),
|
|
1301
1432
|
"aria-pressed": a === e,
|
|
1302
|
-
children: [e !== "all" && i.createElement(
|
|
1433
|
+
children: [e !== "all" && i.createElement(sn[e] || Te, { className: "h-3 w-3" }), dn[e]]
|
|
1303
1434
|
}, e))
|
|
1304
1435
|
}), s.length === 0 ? /* @__PURE__ */ Z(k, {
|
|
1305
1436
|
title: "No activity recorded",
|
|
@@ -1309,11 +1440,11 @@ var rn = {
|
|
|
1309
1440
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
1310
1441
|
className: "space-y-4",
|
|
1311
1442
|
children: s.map((e) => {
|
|
1312
|
-
let t =
|
|
1443
|
+
let t = sn[e.type] || Te;
|
|
1313
1444
|
return /* @__PURE__ */ Q("div", {
|
|
1314
1445
|
className: "flex gap-3 relative",
|
|
1315
1446
|
children: [/* @__PURE__ */ Z("div", {
|
|
1316
|
-
className: G("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10",
|
|
1447
|
+
className: G("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", cn[e.type] || "bg-gray-100 text-gray-600"),
|
|
1317
1448
|
children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
|
|
1318
1449
|
}), /* @__PURE__ */ Q("div", {
|
|
1319
1450
|
className: "flex-1 min-w-0 pt-1",
|
|
@@ -1327,12 +1458,12 @@ var rn = {
|
|
|
1327
1458
|
" ",
|
|
1328
1459
|
/* @__PURE__ */ Z("span", {
|
|
1329
1460
|
className: "text-muted-foreground",
|
|
1330
|
-
children:
|
|
1461
|
+
children: un(e)
|
|
1331
1462
|
})
|
|
1332
1463
|
]
|
|
1333
1464
|
}), /* @__PURE__ */ Z("p", {
|
|
1334
1465
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
1335
|
-
children:
|
|
1466
|
+
children: ln(e.timestamp)
|
|
1336
1467
|
})]
|
|
1337
1468
|
})]
|
|
1338
1469
|
}, e.id);
|
|
@@ -1340,7 +1471,7 @@ var rn = {
|
|
|
1340
1471
|
})]
|
|
1341
1472
|
})] })]
|
|
1342
1473
|
});
|
|
1343
|
-
},
|
|
1474
|
+
}, pn = {
|
|
1344
1475
|
create: "default",
|
|
1345
1476
|
update: "secondary",
|
|
1346
1477
|
delete: "destructive",
|
|
@@ -1352,12 +1483,12 @@ var rn = {
|
|
|
1352
1483
|
export: "outline",
|
|
1353
1484
|
import: "outline"
|
|
1354
1485
|
};
|
|
1355
|
-
function
|
|
1486
|
+
function mn(e) {
|
|
1356
1487
|
if (!e) return "";
|
|
1357
1488
|
let t = e instanceof Date ? e : new Date(e);
|
|
1358
1489
|
return Number.isNaN(t.getTime()) ? String(e) : t.toLocaleString();
|
|
1359
1490
|
}
|
|
1360
|
-
var
|
|
1491
|
+
var hn = [
|
|
1361
1492
|
[60, "second"],
|
|
1362
1493
|
[60, "minute"],
|
|
1363
1494
|
[24, "hour"],
|
|
@@ -1366,27 +1497,27 @@ var cn = [
|
|
|
1366
1497
|
[12, "month"],
|
|
1367
1498
|
[Infinity, "year"]
|
|
1368
1499
|
];
|
|
1369
|
-
function
|
|
1500
|
+
function gn(e, t) {
|
|
1370
1501
|
if (!e) return "";
|
|
1371
1502
|
let n = e instanceof Date ? e : new Date(e);
|
|
1372
1503
|
if (Number.isNaN(n.getTime())) return String(e);
|
|
1373
1504
|
let r = (n.getTime() - Date.now()) / 1e3;
|
|
1374
|
-
for (let [n, i] of
|
|
1505
|
+
for (let [n, i] of hn) {
|
|
1375
1506
|
if (Math.abs(r) < n) try {
|
|
1376
1507
|
return new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(Math.round(r), i);
|
|
1377
1508
|
} catch {
|
|
1378
|
-
return
|
|
1509
|
+
return mn(e);
|
|
1379
1510
|
}
|
|
1380
1511
|
r /= n;
|
|
1381
1512
|
}
|
|
1382
|
-
return
|
|
1513
|
+
return mn(e);
|
|
1383
1514
|
}
|
|
1384
|
-
function
|
|
1515
|
+
function _n(e) {
|
|
1385
1516
|
if (!e) return "?";
|
|
1386
1517
|
let t = e.trim().split(/\s+/).filter(Boolean).slice(0, 2);
|
|
1387
1518
|
return t.length === 0 ? "?" : t.map((e) => e.charAt(0).toUpperCase()).join("");
|
|
1388
1519
|
}
|
|
1389
|
-
function
|
|
1520
|
+
function vn(e) {
|
|
1390
1521
|
if (e == null || e === "") return "—";
|
|
1391
1522
|
if (typeof e == "string") return e;
|
|
1392
1523
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -1396,7 +1527,7 @@ function dn(e) {
|
|
|
1396
1527
|
return String(e);
|
|
1397
1528
|
}
|
|
1398
1529
|
}
|
|
1399
|
-
function
|
|
1530
|
+
function yn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
1400
1531
|
return t ? /* @__PURE__ */ Z("div", {
|
|
1401
1532
|
className: G("space-y-3", r),
|
|
1402
1533
|
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ Q("div", {
|
|
@@ -1414,7 +1545,7 @@ function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1414
1545
|
children: /* @__PURE__ */ Z("ol", {
|
|
1415
1546
|
className: G("space-y-4", r),
|
|
1416
1547
|
children: e.map((e, t) => {
|
|
1417
|
-
let n = (e.action ?? "").toLowerCase(), r =
|
|
1548
|
+
let n = (e.action ?? "").toLowerCase(), r = pn[n] ?? "outline", a = typeof e.user_name == "string" && e.user_name.trim() || "Unknown user", o = mn(e.created_at), s = gn(e.created_at, i), c = typeof e.user_avatar == "string" ? e.user_avatar : void 0;
|
|
1418
1549
|
return /* @__PURE__ */ Q("li", {
|
|
1419
1550
|
className: "flex items-start gap-3",
|
|
1420
1551
|
children: [/* @__PURE__ */ Q(_, {
|
|
@@ -1424,7 +1555,7 @@ function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1424
1555
|
alt: a
|
|
1425
1556
|
}) : null, /* @__PURE__ */ Z(v, {
|
|
1426
1557
|
className: "text-[10px] font-medium",
|
|
1427
|
-
children:
|
|
1558
|
+
children: _n(e.user_name)
|
|
1428
1559
|
})]
|
|
1429
1560
|
}), /* @__PURE__ */ Q("div", {
|
|
1430
1561
|
className: "min-w-0 flex-1",
|
|
@@ -1475,7 +1606,7 @@ function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1475
1606
|
": ",
|
|
1476
1607
|
/* @__PURE__ */ Z("span", {
|
|
1477
1608
|
className: "text-foreground",
|
|
1478
|
-
children:
|
|
1609
|
+
children: vn(e.to)
|
|
1479
1610
|
})
|
|
1480
1611
|
]
|
|
1481
1612
|
}, e.field))
|
|
@@ -1492,12 +1623,12 @@ function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1492
1623
|
": ",
|
|
1493
1624
|
/* @__PURE__ */ Z("span", {
|
|
1494
1625
|
className: "line-through opacity-70",
|
|
1495
|
-
children:
|
|
1626
|
+
children: vn(e.from)
|
|
1496
1627
|
}),
|
|
1497
1628
|
" → ",
|
|
1498
1629
|
/* @__PURE__ */ Z("span", {
|
|
1499
1630
|
className: "text-foreground",
|
|
1500
|
-
children:
|
|
1631
|
+
children: vn(e.to)
|
|
1501
1632
|
})
|
|
1502
1633
|
]
|
|
1503
1634
|
}, e.field))
|
|
@@ -1511,13 +1642,13 @@ function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1511
1642
|
}
|
|
1512
1643
|
//#endregion
|
|
1513
1644
|
//#region src/RecordMetaFooter.tsx
|
|
1514
|
-
var
|
|
1645
|
+
var bn = {
|
|
1515
1646
|
createdAt: "created_at",
|
|
1516
1647
|
createdBy: "created_by",
|
|
1517
1648
|
updatedAt: "updated_at",
|
|
1518
1649
|
updatedBy: "updated_by"
|
|
1519
1650
|
};
|
|
1520
|
-
function
|
|
1651
|
+
function xn(e) {
|
|
1521
1652
|
if (!e) return null;
|
|
1522
1653
|
if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
|
|
1523
1654
|
if (typeof e == "string" || typeof e == "number") {
|
|
@@ -1526,7 +1657,7 @@ function mn(e) {
|
|
|
1526
1657
|
}
|
|
1527
1658
|
return null;
|
|
1528
1659
|
}
|
|
1529
|
-
function
|
|
1660
|
+
function Sn(e, t) {
|
|
1530
1661
|
let n = Date.now() - e.getTime(), r = Math.max(0, Math.floor(n / 1e3));
|
|
1531
1662
|
if (r < 60) return t("detail.justNow");
|
|
1532
1663
|
let i = Math.floor(r / 60);
|
|
@@ -1534,7 +1665,7 @@ function hn(e, t) {
|
|
|
1534
1665
|
let a = Math.floor(i / 60);
|
|
1535
1666
|
return a < 24 ? t("detail.hoursAgo", { count: a }) : t("detail.daysAgo", { count: Math.floor(a / 24) });
|
|
1536
1667
|
}
|
|
1537
|
-
function
|
|
1668
|
+
function Cn(e) {
|
|
1538
1669
|
try {
|
|
1539
1670
|
return new Intl.DateTimeFormat(void 0, {
|
|
1540
1671
|
dateStyle: "medium",
|
|
@@ -1544,16 +1675,16 @@ function gn(e) {
|
|
|
1544
1675
|
return e.toISOString();
|
|
1545
1676
|
}
|
|
1546
1677
|
}
|
|
1547
|
-
var
|
|
1678
|
+
var wn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
1548
1679
|
if (e == null || e === "") return null;
|
|
1549
1680
|
let r = t?.fields?.[n], i = r?.reference_to || r?.reference, a = {
|
|
1550
1681
|
name: n,
|
|
1551
1682
|
type: r?.type || (i ? "lookup" : "text"),
|
|
1552
1683
|
...i && { reference_to: i },
|
|
1553
1684
|
...r?.reference_field && { reference_field: r.reference_field }
|
|
1554
|
-
}, o =
|
|
1685
|
+
}, o = kt(a) || a.type;
|
|
1555
1686
|
if (o) {
|
|
1556
|
-
let t =
|
|
1687
|
+
let t = Et(o);
|
|
1557
1688
|
if (t) return /* @__PURE__ */ Z("span", {
|
|
1558
1689
|
className: "inline-flex items-center [&_a]:text-inherit [&_a]:hover:underline",
|
|
1559
1690
|
children: /* @__PURE__ */ Z(t, {
|
|
@@ -1563,7 +1694,7 @@ var _n = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1563
1694
|
});
|
|
1564
1695
|
}
|
|
1565
1696
|
return /* @__PURE__ */ Z("span", { children: String(e) });
|
|
1566
|
-
},
|
|
1697
|
+
}, Tn = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
|
|
1567
1698
|
if (!t && !n) return null;
|
|
1568
1699
|
let o = n ? /* @__PURE__ */ Z(ae, {
|
|
1569
1700
|
delayDuration: 200,
|
|
@@ -1572,11 +1703,11 @@ var _n = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1572
1703
|
children: /* @__PURE__ */ Z("time", {
|
|
1573
1704
|
dateTime: n.toISOString(),
|
|
1574
1705
|
className: "cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2",
|
|
1575
|
-
children:
|
|
1706
|
+
children: Sn(n, a)
|
|
1576
1707
|
})
|
|
1577
1708
|
}), /* @__PURE__ */ Z(H, {
|
|
1578
1709
|
side: "top",
|
|
1579
|
-
children:
|
|
1710
|
+
children: Cn(n)
|
|
1580
1711
|
})] })
|
|
1581
1712
|
}) : null;
|
|
1582
1713
|
return /* @__PURE__ */ Q("span", {
|
|
@@ -1586,7 +1717,7 @@ var _n = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1586
1717
|
className: "text-muted-foreground/70",
|
|
1587
1718
|
children: e
|
|
1588
1719
|
}),
|
|
1589
|
-
t ? /* @__PURE__ */ Z(
|
|
1720
|
+
t ? /* @__PURE__ */ Z(wn, {
|
|
1590
1721
|
value: t,
|
|
1591
1722
|
objectSchema: r,
|
|
1592
1723
|
fieldName: i
|
|
@@ -1598,31 +1729,31 @@ var _n = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1598
1729
|
o
|
|
1599
1730
|
]
|
|
1600
1731
|
});
|
|
1601
|
-
},
|
|
1732
|
+
}, En = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
|
|
1602
1733
|
let { t: i } = $();
|
|
1603
1734
|
if (!e) return null;
|
|
1604
|
-
let a =
|
|
1735
|
+
let a = xn(e[bn.createdAt]), o = xn(e[bn.updatedAt]), s = e[bn.createdBy], c = e[bn.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));
|
|
1605
1736
|
return !l && !d ? null : /* @__PURE__ */ Q("div", {
|
|
1606
1737
|
className: G("mt-6 pt-3 border-t border-border/40", "flex flex-wrap items-center gap-x-4 gap-y-1", "text-xs text-muted-foreground", r),
|
|
1607
1738
|
"data-testid": "record-meta-footer",
|
|
1608
|
-
children: [l && /* @__PURE__ */ Z(
|
|
1739
|
+
children: [l && /* @__PURE__ */ Z(Tn, {
|
|
1609
1740
|
label: i("detail.createdBy"),
|
|
1610
1741
|
user: s,
|
|
1611
1742
|
date: a,
|
|
1612
1743
|
objectSchema: t,
|
|
1613
|
-
userField:
|
|
1744
|
+
userField: bn.createdBy,
|
|
1614
1745
|
t: i
|
|
1615
|
-
}), d && /* @__PURE__ */ Z(
|
|
1746
|
+
}), d && /* @__PURE__ */ Z(Tn, {
|
|
1616
1747
|
label: i("detail.updatedBy"),
|
|
1617
1748
|
user: c,
|
|
1618
1749
|
date: o,
|
|
1619
1750
|
objectSchema: t,
|
|
1620
|
-
userField:
|
|
1751
|
+
userField: bn.updatedBy,
|
|
1621
1752
|
t: i
|
|
1622
1753
|
})]
|
|
1623
1754
|
});
|
|
1624
|
-
},
|
|
1625
|
-
function
|
|
1755
|
+
}, Dn = 5;
|
|
1756
|
+
function On(e, t, i, a) {
|
|
1626
1757
|
if (e && typeof e == "object") {
|
|
1627
1758
|
if (t.primaryField) {
|
|
1628
1759
|
let n = e[t.primaryField];
|
|
@@ -1642,10 +1773,10 @@ function xn(e, t, i, a) {
|
|
|
1642
1773
|
}
|
|
1643
1774
|
return a;
|
|
1644
1775
|
}
|
|
1645
|
-
var
|
|
1646
|
-
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, ee] = i.useState(null), [te, ne] = i.useState(!1), [re, ie] = i.useState(0),
|
|
1647
|
-
if (!
|
|
1648
|
-
let t = (t) =>
|
|
1776
|
+
var kn = ({ 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 }) => {
|
|
1777
|
+
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), [F, ee] = i.useState(null), [te, ne] = i.useState(!1), [re, ie] = i.useState(0), W = ut(e.objectName || void 0, e.resourceId == null ? void 0 : String(e.resourceId)), [se, K] = i.useState(!1), { t: q } = $(), { currency: le } = It(), { fieldOptionLabel: ue } = vt(), de = oe(), fe = Pt(), J = i.useMemo(() => {
|
|
1778
|
+
if (!fe?.isLoaded || !e.objectName) return e;
|
|
1779
|
+
let t = (t) => fe.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
|
|
1649
1780
|
let n = typeof e == "string" ? e : e?.name;
|
|
1650
1781
|
return !n || t(n);
|
|
1651
1782
|
});
|
|
@@ -1658,15 +1789,15 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1658
1789
|
})),
|
|
1659
1790
|
summaryFields: n(e.summaryFields)
|
|
1660
1791
|
};
|
|
1661
|
-
}, [e,
|
|
1792
|
+
}, [e, fe]);
|
|
1662
1793
|
i.useEffect(() => {
|
|
1663
1794
|
g && p && p(g);
|
|
1664
1795
|
}, [g, p]);
|
|
1665
|
-
let
|
|
1666
|
-
if (
|
|
1667
|
-
let e = [...
|
|
1796
|
+
let pe = i.useMemo(() => {
|
|
1797
|
+
if (J.summaryFields && J.summaryFields.length > 0) return [];
|
|
1798
|
+
let e = [...J.sections?.flatMap((e) => e.fields) || [], ...J.fields || []], t = {};
|
|
1668
1799
|
for (let n of e) t[n.name] || (t[n.name] = n);
|
|
1669
|
-
if (
|
|
1800
|
+
if (F?.fields) for (let [e, n] of Object.entries(F.fields)) t[e] = {
|
|
1670
1801
|
...t[e] || {},
|
|
1671
1802
|
...n,
|
|
1672
1803
|
name: e
|
|
@@ -1683,26 +1814,26 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1683
1814
|
let o = Object.keys(t).find((e) => (t[e]?.type === "date" || t[e]?.type === "datetime") && /close|due|start|end|expected/i.test(e) && n(e));
|
|
1684
1815
|
return o && !r.includes(o) && r.push(o), r;
|
|
1685
1816
|
}, [
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1817
|
+
J.summaryFields,
|
|
1818
|
+
J.sections,
|
|
1819
|
+
J.fields,
|
|
1820
|
+
F,
|
|
1690
1821
|
g
|
|
1691
|
-
]),
|
|
1692
|
-
|
|
1822
|
+
]), me = J.summaryFields && J.summaryFields.length > 0 ? J.summaryFields : pe, ge = i.useCallback(() => {
|
|
1823
|
+
J.resourceId && navigator.clipboard.writeText(String(J.resourceId)).then(() => {
|
|
1693
1824
|
ne(!0), setTimeout(() => ne(!1), 1500);
|
|
1694
1825
|
});
|
|
1695
|
-
}, [
|
|
1826
|
+
}, [J.resourceId]);
|
|
1696
1827
|
i.useEffect(() => {
|
|
1697
1828
|
let e = !0;
|
|
1698
|
-
if (
|
|
1829
|
+
if (J.data) return _(J.data), y(!1), n?.getObjectSchema && J.objectName && n.getObjectSchema(J.objectName).then((t) => {
|
|
1699
1830
|
e && ee(t);
|
|
1700
1831
|
}).catch(() => {}), () => {
|
|
1701
1832
|
e = !1;
|
|
1702
1833
|
};
|
|
1703
|
-
if (n &&
|
|
1834
|
+
if (n && J.objectName && J.resourceId) {
|
|
1704
1835
|
y(!0), ee(null), _(null);
|
|
1705
|
-
let r =
|
|
1836
|
+
let r = J.objectName, i = J.resourceId, a = `${r}-`, o = [...J.sections?.flatMap((e) => e.fields) || [], ...J.fields || []];
|
|
1706
1837
|
(n.getObjectSchema ? n.getObjectSchema(r).catch(() => null) : Promise.resolve(null)).then((s) => {
|
|
1707
1838
|
if (!e) return;
|
|
1708
1839
|
ee(s);
|
|
@@ -1726,7 +1857,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1726
1857
|
}).catch((t) => {
|
|
1727
1858
|
e && (console.error("Failed to fetch detail data:", t), y(!1));
|
|
1728
1859
|
});
|
|
1729
|
-
} else
|
|
1860
|
+
} else J.api && J.resourceId && (y(!0), fetch(`${J.api}/${J.resourceId}`).then((e) => e.json()).then((t) => {
|
|
1730
1861
|
e && _(t?.data || t);
|
|
1731
1862
|
}).catch((e) => {
|
|
1732
1863
|
console.error("Failed to fetch detail data:", e);
|
|
@@ -1737,72 +1868,72 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1737
1868
|
e = !1;
|
|
1738
1869
|
};
|
|
1739
1870
|
}, [
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1871
|
+
J.api,
|
|
1872
|
+
J.resourceId,
|
|
1873
|
+
J.objectName,
|
|
1743
1874
|
n,
|
|
1744
|
-
|
|
1745
|
-
|
|
1875
|
+
J.sections,
|
|
1876
|
+
J.fields,
|
|
1746
1877
|
re,
|
|
1747
|
-
|
|
1878
|
+
W
|
|
1748
1879
|
]);
|
|
1749
|
-
let
|
|
1880
|
+
let _e = i.useCallback(() => {
|
|
1750
1881
|
if (s) s();
|
|
1751
|
-
else if (
|
|
1752
|
-
let e =
|
|
1753
|
-
|
|
1754
|
-
} else
|
|
1755
|
-
}, [s,
|
|
1756
|
-
a ? a() :
|
|
1757
|
-
}, [a,
|
|
1758
|
-
if (!n?.cancelPendingApproval || !
|
|
1759
|
-
M(
|
|
1882
|
+
else if (J.onNavigate) {
|
|
1883
|
+
let e = J.backUrl || (J.objectName ? `/${J.objectName}` : "/");
|
|
1884
|
+
J.onNavigate(e, { replace: !0 });
|
|
1885
|
+
} else J.backUrl ? window.location.href = J.backUrl : window.history.back();
|
|
1886
|
+
}, [s, J]), be = i.useCallback(() => {
|
|
1887
|
+
a ? a() : J.onNavigate && J.editUrl ? J.onNavigate(J.editUrl) : J.onNavigate && J.objectName && J.resourceId ? J.onNavigate(`/${J.objectName}/${J.resourceId}/edit`) : J.editUrl && (window.location.href = J.editUrl);
|
|
1888
|
+
}, [a, J]), xe = i.useCallback(async () => {
|
|
1889
|
+
if (!n?.cancelPendingApproval || !J.objectName || !J.resourceId) {
|
|
1890
|
+
M(q("detail.cancelApprovalUnavailable"));
|
|
1760
1891
|
return;
|
|
1761
1892
|
}
|
|
1762
|
-
|
|
1893
|
+
K(!0), M(null);
|
|
1763
1894
|
try {
|
|
1764
|
-
if (await n.cancelPendingApproval(String(
|
|
1765
|
-
let e = await n.findOne(String(
|
|
1895
|
+
if (await n.cancelPendingApproval(String(J.objectName), String(J.resourceId)), n.findOne) try {
|
|
1896
|
+
let e = await n.findOne(String(J.objectName), String(J.resourceId));
|
|
1766
1897
|
e && _(e);
|
|
1767
1898
|
} catch {}
|
|
1768
1899
|
ie((e) => e + 1);
|
|
1769
1900
|
try {
|
|
1770
1901
|
window.dispatchEvent(new CustomEvent("objectui:record-changed", { detail: {
|
|
1771
|
-
objectName: String(
|
|
1772
|
-
recordId: String(
|
|
1902
|
+
objectName: String(J.objectName),
|
|
1903
|
+
recordId: String(J.resourceId),
|
|
1773
1904
|
reason: "approval-recalled"
|
|
1774
1905
|
} }));
|
|
1775
1906
|
} catch {}
|
|
1776
1907
|
} catch (e) {
|
|
1777
1908
|
let t = (e?.message || e?.error || String(e ?? "Cancel failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
|
|
1778
|
-
M(`${
|
|
1909
|
+
M(`${q("detail.cancelApprovalFailed")}: ${t}`);
|
|
1779
1910
|
} finally {
|
|
1780
|
-
|
|
1911
|
+
K(!1);
|
|
1781
1912
|
}
|
|
1782
1913
|
}, [
|
|
1783
1914
|
n,
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
]),
|
|
1788
|
-
let e =
|
|
1789
|
-
window.confirm(e) && (o?.(),
|
|
1790
|
-
}, [o,
|
|
1791
|
-
navigator.share &&
|
|
1792
|
-
title:
|
|
1793
|
-
text: `${
|
|
1915
|
+
J.objectName,
|
|
1916
|
+
J.resourceId,
|
|
1917
|
+
q
|
|
1918
|
+
]), Se = i.useCallback(() => {
|
|
1919
|
+
let e = J.deleteConfirmation || q("detail.deleteConfirmation");
|
|
1920
|
+
window.confirm(e) && (o?.(), J.onNavigate && J.objectName && J.onNavigate(`/${J.objectName}`, { replace: !0 }));
|
|
1921
|
+
}, [o, J]), Ce = i.useCallback(() => {
|
|
1922
|
+
navigator.share && J.objectName && J.resourceId ? navigator.share({
|
|
1923
|
+
title: J.title || q("detail.details"),
|
|
1924
|
+
text: `${J.objectName} #${J.resourceId}`,
|
|
1794
1925
|
url: window.location.href
|
|
1795
1926
|
}).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
|
|
1796
1927
|
console.log("Link copied to clipboard");
|
|
1797
1928
|
});
|
|
1798
|
-
}, [
|
|
1929
|
+
}, [J]), Ee = i.useCallback(() => {
|
|
1799
1930
|
let e = !w;
|
|
1800
1931
|
h && h(e), m === void 0 && C(e);
|
|
1801
1932
|
}, [
|
|
1802
1933
|
w,
|
|
1803
1934
|
m,
|
|
1804
1935
|
h
|
|
1805
|
-
]),
|
|
1936
|
+
]), De = i.useCallback(async () => {
|
|
1806
1937
|
if (T) {
|
|
1807
1938
|
let e = Object.entries(D);
|
|
1808
1939
|
if (e.length > 0) {
|
|
@@ -1813,9 +1944,11 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1813
1944
|
_(n), M(null), A(!0);
|
|
1814
1945
|
try {
|
|
1815
1946
|
if (l) for (let [t, r] of e) await l(t, r, n);
|
|
1816
|
-
O({}), E(!1);
|
|
1947
|
+
O({}), E(!1), P(null);
|
|
1817
1948
|
} catch (e) {
|
|
1818
|
-
_(t)
|
|
1949
|
+
_(t);
|
|
1950
|
+
let n = (e?.message || e?.error || String(e ?? "Save failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
|
|
1951
|
+
M(n);
|
|
1819
1952
|
} finally {
|
|
1820
1953
|
A(!1);
|
|
1821
1954
|
}
|
|
@@ -1829,79 +1962,71 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1829
1962
|
D,
|
|
1830
1963
|
g,
|
|
1831
1964
|
l
|
|
1832
|
-
]),
|
|
1833
|
-
O({}), E(!1), M(null);
|
|
1834
|
-
}, []),
|
|
1965
|
+
]), Oe = i.useCallback(() => {
|
|
1966
|
+
O({}), E(!1), M(null), P(null);
|
|
1967
|
+
}, []), ke = i.useCallback((e, t) => {
|
|
1835
1968
|
O((n) => ({
|
|
1836
1969
|
...n,
|
|
1837
1970
|
[e]: t
|
|
1838
1971
|
}));
|
|
1972
|
+
}, []), Y = i.useCallback((e) => {
|
|
1973
|
+
P(e), E(!0), M(null);
|
|
1839
1974
|
}, []);
|
|
1840
1975
|
i.useEffect(() => {
|
|
1841
|
-
if (!
|
|
1842
|
-
let e =
|
|
1976
|
+
if (!J.recordNavigation) return;
|
|
1977
|
+
let e = J.recordNavigation, t = (t) => {
|
|
1843
1978
|
let n = t.target?.tagName;
|
|
1844
1979
|
n === "INPUT" || n === "TEXTAREA" || t.target?.isContentEditable || (t.key === "ArrowLeft" && e.currentIndex > 0 ? (t.preventDefault(), e.onNavigate(e.recordIds[e.currentIndex - 1])) : t.key === "ArrowRight" && e.currentIndex < e.recordIds.length - 1 && (t.preventDefault(), e.onNavigate(e.recordIds[e.currentIndex + 1])));
|
|
1845
1980
|
};
|
|
1846
1981
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
1847
|
-
}, [
|
|
1848
|
-
if (!c ||
|
|
1982
|
+
}, [J.recordNavigation]), i.useEffect(() => {
|
|
1983
|
+
if (!c || J.showHeader !== !1) return;
|
|
1849
1984
|
let e = "objectui:record:inline-edit-toggle", t = (e) => {
|
|
1850
1985
|
let t = e.detail;
|
|
1851
|
-
t?.recordId &&
|
|
1986
|
+
t?.recordId && J.recordId && t.recordId !== J.recordId || t?.objectName && J.objectName && t.objectName !== J.objectName || De();
|
|
1852
1987
|
};
|
|
1853
1988
|
return window.addEventListener(e, t), () => window.removeEventListener(e, t);
|
|
1854
1989
|
}, [
|
|
1855
1990
|
c,
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1991
|
+
J.showHeader,
|
|
1992
|
+
J.recordId,
|
|
1993
|
+
J.objectName,
|
|
1994
|
+
De
|
|
1860
1995
|
]);
|
|
1861
|
-
let
|
|
1996
|
+
let Ae = i.useMemo(() => J.related ?? [], [J.related]), je = i.useMemo(() => {
|
|
1862
1997
|
let e = [];
|
|
1863
1998
|
return e.push({
|
|
1864
1999
|
name: "sys_share",
|
|
1865
|
-
label:
|
|
2000
|
+
label: q("detail.share"),
|
|
1866
2001
|
icon: "share-2",
|
|
1867
2002
|
type: "script",
|
|
1868
|
-
onClick:
|
|
1869
|
-
}),
|
|
2003
|
+
onClick: Ce
|
|
2004
|
+
}), J.showEdit && e.push({
|
|
1870
2005
|
name: "sys_edit_mobile",
|
|
1871
|
-
label:
|
|
1872
|
-
icon: "edit",
|
|
1873
|
-
type: "script",
|
|
1874
|
-
className: "sm:hidden",
|
|
1875
|
-
onClick: _e
|
|
1876
|
-
}), c && e.push({
|
|
1877
|
-
name: "sys_toggle_inline_edit_mobile",
|
|
1878
|
-
label: K(T ? "detail.save" : "detail.editInline"),
|
|
2006
|
+
label: q("detail.edit"),
|
|
1879
2007
|
icon: "edit",
|
|
1880
2008
|
type: "script",
|
|
1881
2009
|
className: "sm:hidden",
|
|
1882
|
-
onClick:
|
|
1883
|
-
}),
|
|
2010
|
+
onClick: be
|
|
2011
|
+
}), J.showDelete && e.push({
|
|
1884
2012
|
name: "sys_delete",
|
|
1885
|
-
label:
|
|
2013
|
+
label: q("detail.delete"),
|
|
1886
2014
|
icon: "trash-2",
|
|
1887
2015
|
type: "script",
|
|
1888
2016
|
variant: "destructive",
|
|
1889
2017
|
tags: ["separator-before"],
|
|
1890
|
-
onClick:
|
|
2018
|
+
onClick: Se
|
|
1891
2019
|
}), e;
|
|
1892
2020
|
}, [
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
Se
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
]), Ae = i.useMemo(() => {
|
|
1903
|
-
let e = q.actions ?? [];
|
|
1904
|
-
if (ke.length === 0) return e;
|
|
2021
|
+
q,
|
|
2022
|
+
J.showEdit,
|
|
2023
|
+
J.showDelete,
|
|
2024
|
+
Ce,
|
|
2025
|
+
be,
|
|
2026
|
+
Se
|
|
2027
|
+
]), Me = i.useMemo(() => {
|
|
2028
|
+
let e = J.actions ?? [];
|
|
2029
|
+
if (je.length === 0) return e;
|
|
1905
2030
|
let t = !1, n = e.map((e) => {
|
|
1906
2031
|
let n = e;
|
|
1907
2032
|
if (n && typeof n == "object" && n.type === "action:bar" && (!n.location || n.location === "record_header")) {
|
|
@@ -1909,7 +2034,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1909
2034
|
let e = Array.isArray(n.systemActions) ? n.systemActions : [];
|
|
1910
2035
|
return {
|
|
1911
2036
|
...n,
|
|
1912
|
-
systemActions: [...e, ...
|
|
2037
|
+
systemActions: [...e, ...je]
|
|
1913
2038
|
};
|
|
1914
2039
|
}
|
|
1915
2040
|
return e;
|
|
@@ -1917,72 +2042,72 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1917
2042
|
return t || n.push({
|
|
1918
2043
|
type: "action:bar",
|
|
1919
2044
|
location: "record_header",
|
|
1920
|
-
systemActions:
|
|
2045
|
+
systemActions: je
|
|
1921
2046
|
}), n;
|
|
1922
|
-
}, [
|
|
1923
|
-
return v ||
|
|
2047
|
+
}, [J.actions, je]);
|
|
2048
|
+
return v || J.loading ? /* @__PURE__ */ Q("div", {
|
|
1924
2049
|
className: G("space-y-4", r),
|
|
1925
2050
|
children: [
|
|
1926
2051
|
/* @__PURE__ */ Z(I, { className: "h-10 w-full" }),
|
|
1927
2052
|
/* @__PURE__ */ Z(I, { className: "h-64 w-full" }),
|
|
1928
2053
|
/* @__PURE__ */ Z(I, { className: "h-48 w-full" })
|
|
1929
2054
|
]
|
|
1930
|
-
}) : !g && !
|
|
2055
|
+
}) : !g && !J.data ? /* @__PURE__ */ Q("div", {
|
|
1931
2056
|
className: G("flex flex-col items-center justify-center py-16 text-center", r),
|
|
1932
2057
|
children: [
|
|
1933
2058
|
/* @__PURE__ */ Z("p", {
|
|
1934
2059
|
className: "text-lg font-semibold",
|
|
1935
|
-
children:
|
|
2060
|
+
children: q("detail.recordNotFound")
|
|
1936
2061
|
}),
|
|
1937
2062
|
/* @__PURE__ */ Z("p", {
|
|
1938
2063
|
className: "text-sm text-muted-foreground mt-1",
|
|
1939
|
-
children:
|
|
2064
|
+
children: q("detail.recordNotFoundDescription")
|
|
1940
2065
|
}),
|
|
1941
|
-
(
|
|
2066
|
+
(J.showBack ?? !0) && /* @__PURE__ */ Q(x, {
|
|
1942
2067
|
variant: "outline",
|
|
1943
2068
|
size: "sm",
|
|
1944
|
-
onClick:
|
|
2069
|
+
onClick: _e,
|
|
1945
2070
|
className: "mt-4 gap-2",
|
|
1946
|
-
children: [/* @__PURE__ */ Z(ce, { className: "h-4 w-4" }),
|
|
2071
|
+
children: [/* @__PURE__ */ Z(ce, { className: "h-4 w-4" }), q("detail.goBack")]
|
|
1947
2072
|
})
|
|
1948
2073
|
]
|
|
1949
2074
|
}) : /* @__PURE__ */ Z(ae, { children: /* @__PURE__ */ Q("div", {
|
|
1950
2075
|
className: G("space-y-6", r),
|
|
1951
2076
|
children: [
|
|
1952
|
-
|
|
2077
|
+
J.showHeader !== !1 && /* @__PURE__ */ Q("div", {
|
|
1953
2078
|
className: "flex flex-col sm:flex-row items-start justify-between gap-3 sm:gap-4 pb-4 border-b",
|
|
1954
2079
|
children: [/* @__PURE__ */ Q("div", {
|
|
1955
2080
|
className: "flex items-start gap-2 sm:gap-3 flex-1 min-w-0",
|
|
1956
|
-
children: [(
|
|
2081
|
+
children: [(J.showBack ?? !0) && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
1957
2082
|
asChild: !0,
|
|
1958
2083
|
children: /* @__PURE__ */ Z(x, {
|
|
1959
2084
|
variant: "ghost",
|
|
1960
2085
|
size: "icon",
|
|
1961
|
-
onClick:
|
|
2086
|
+
onClick: _e,
|
|
1962
2087
|
className: "shrink-0 mt-1",
|
|
1963
2088
|
children: /* @__PURE__ */ Z(ce, { className: "h-4 w-4" })
|
|
1964
2089
|
})
|
|
1965
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2090
|
+
}), /* @__PURE__ */ Z(H, { children: q("detail.back") })] }), /* @__PURE__ */ Q("div", {
|
|
1966
2091
|
className: "flex-1 min-w-0",
|
|
1967
2092
|
children: [/* @__PURE__ */ Q("div", {
|
|
1968
2093
|
className: "flex items-center gap-2 flex-wrap",
|
|
1969
2094
|
children: [
|
|
1970
2095
|
/* @__PURE__ */ Z("h1", {
|
|
1971
2096
|
className: "text-xl sm:text-2xl font-bold truncate",
|
|
1972
|
-
children:
|
|
2097
|
+
children: On(g, J, F, q("detail.details"))
|
|
1973
2098
|
}),
|
|
1974
|
-
|
|
2099
|
+
me.map((e) => {
|
|
1975
2100
|
let t = g?.[e];
|
|
1976
2101
|
if (t == null || t === "") return null;
|
|
1977
|
-
let n = (
|
|
2102
|
+
let n = (J.sections || []).flatMap((e) => e.fields).concat(J.fields || []).find((t) => t.name === e), r = F?.fields?.[e], i = n?.type || r?.type, a = String(t), o = null;
|
|
1978
2103
|
try {
|
|
1979
2104
|
if (i === "currency") {
|
|
1980
2105
|
let e = Number(t);
|
|
1981
2106
|
if (!Number.isNaN(e)) {
|
|
1982
|
-
let t =
|
|
2107
|
+
let t = Ft({
|
|
1983
2108
|
...r,
|
|
1984
2109
|
...n
|
|
1985
|
-
},
|
|
2110
|
+
}, le);
|
|
1986
2111
|
a = t ? new Intl.NumberFormat(void 0, {
|
|
1987
2112
|
style: "currency",
|
|
1988
2113
|
currency: t,
|
|
@@ -2011,7 +2136,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2011
2136
|
let e = i[String(t)];
|
|
2012
2137
|
e?.label && (o = e.label);
|
|
2013
2138
|
}
|
|
2014
|
-
a =
|
|
2139
|
+
a = J.objectName ? ue(J.objectName, e, String(t), o) : o;
|
|
2015
2140
|
}
|
|
2016
2141
|
} catch {}
|
|
2017
2142
|
return o === null ? /* @__PURE__ */ Z(b, {
|
|
@@ -2039,34 +2164,34 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2039
2164
|
variant: "ghost",
|
|
2040
2165
|
size: "icon",
|
|
2041
2166
|
className: "h-6 w-6 shrink-0",
|
|
2042
|
-
onClick:
|
|
2043
|
-
"aria-label":
|
|
2044
|
-
children: w ? /* @__PURE__ */ Z(
|
|
2167
|
+
onClick: Ee,
|
|
2168
|
+
"aria-label": q(w ? "detail.removeFromFavorites" : "detail.addToFavorites"),
|
|
2169
|
+
children: w ? /* @__PURE__ */ Z(et, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z(et, { className: "h-4 w-4 text-muted-foreground" })
|
|
2045
2170
|
})
|
|
2046
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2171
|
+
}), /* @__PURE__ */ Z(H, { children: q(w ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
|
|
2047
2172
|
]
|
|
2048
|
-
}),
|
|
2173
|
+
}), J.objectName && /* @__PURE__ */ Q("p", {
|
|
2049
2174
|
className: "text-sm text-muted-foreground mt-1 flex items-center gap-1",
|
|
2050
2175
|
children: [/* @__PURE__ */ Z("span", {
|
|
2051
2176
|
className: "font-medium",
|
|
2052
|
-
children: f ||
|
|
2053
|
-
}),
|
|
2177
|
+
children: f || J.objectName
|
|
2178
|
+
}), J.resourceId && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2054
2179
|
asChild: !0,
|
|
2055
2180
|
children: /* @__PURE__ */ Z(x, {
|
|
2056
2181
|
variant: "ghost",
|
|
2057
2182
|
size: "icon",
|
|
2058
2183
|
className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
|
|
2059
|
-
onClick:
|
|
2060
|
-
"aria-label":
|
|
2061
|
-
children: te ? /* @__PURE__ */ Z(
|
|
2184
|
+
onClick: ge,
|
|
2185
|
+
"aria-label": q("detail.copyRecordId", { defaultValue: "Copy record ID" }),
|
|
2186
|
+
children: te ? /* @__PURE__ */ Z(he, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(we, { className: "h-3 w-3" })
|
|
2062
2187
|
})
|
|
2063
|
-
}), /* @__PURE__ */ Z(H, { children: te ?
|
|
2188
|
+
}), /* @__PURE__ */ Z(H, { children: te ? q("detail.copied", { defaultValue: "Copied" }) : q("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
|
|
2064
2189
|
})]
|
|
2065
2190
|
})]
|
|
2066
2191
|
}), /* @__PURE__ */ Q("div", {
|
|
2067
2192
|
className: "flex flex-wrap items-center gap-1.5 shrink-0 w-full sm:w-auto",
|
|
2068
2193
|
children: [
|
|
2069
|
-
|
|
2194
|
+
J.recordNavigation && /* @__PURE__ */ Q("div", {
|
|
2070
2195
|
className: "flex items-center gap-1 mr-2",
|
|
2071
2196
|
children: [
|
|
2072
2197
|
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
@@ -2075,19 +2200,19 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2075
2200
|
variant: "outline",
|
|
2076
2201
|
size: "icon",
|
|
2077
2202
|
className: "h-8 w-8",
|
|
2078
|
-
disabled:
|
|
2203
|
+
disabled: J.recordNavigation.currentIndex <= 0,
|
|
2079
2204
|
onClick: () => {
|
|
2080
|
-
let e =
|
|
2205
|
+
let e = J.recordNavigation;
|
|
2081
2206
|
e.currentIndex > 0 && e.onNavigate(e.recordIds[e.currentIndex - 1]);
|
|
2082
2207
|
},
|
|
2083
|
-
children: /* @__PURE__ */ Z(
|
|
2208
|
+
children: /* @__PURE__ */ Z(ve, { className: "h-4 w-4" })
|
|
2084
2209
|
})
|
|
2085
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2210
|
+
}), /* @__PURE__ */ Z(H, { children: q("detail.previousRecord") })] }),
|
|
2086
2211
|
/* @__PURE__ */ Z("span", {
|
|
2087
2212
|
className: "text-xs text-muted-foreground whitespace-nowrap px-1",
|
|
2088
|
-
children:
|
|
2089
|
-
current:
|
|
2090
|
-
total:
|
|
2213
|
+
children: q("detail.recordOf", {
|
|
2214
|
+
current: J.recordNavigation.currentIndex + 1,
|
|
2215
|
+
total: J.recordNavigation.recordIds.length
|
|
2091
2216
|
})
|
|
2092
2217
|
}),
|
|
2093
2218
|
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
@@ -2096,110 +2221,110 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2096
2221
|
variant: "outline",
|
|
2097
2222
|
size: "icon",
|
|
2098
2223
|
className: "h-8 w-8",
|
|
2099
|
-
disabled:
|
|
2224
|
+
disabled: J.recordNavigation.currentIndex >= J.recordNavigation.recordIds.length - 1,
|
|
2100
2225
|
onClick: () => {
|
|
2101
|
-
let e =
|
|
2226
|
+
let e = J.recordNavigation;
|
|
2102
2227
|
e.currentIndex < e.recordIds.length - 1 && e.onNavigate(e.recordIds[e.currentIndex + 1]);
|
|
2103
2228
|
},
|
|
2104
|
-
children: /* @__PURE__ */ Z(
|
|
2229
|
+
children: /* @__PURE__ */ Z(ye, { className: "h-4 w-4" })
|
|
2105
2230
|
})
|
|
2106
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2231
|
+
}), /* @__PURE__ */ Z(H, { children: q("detail.nextRecord") })] })
|
|
2107
2232
|
]
|
|
2108
2233
|
}),
|
|
2109
|
-
c && /* @__PURE__ */ Q(
|
|
2234
|
+
c && T && /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2110
2235
|
asChild: !0,
|
|
2111
2236
|
children: /* @__PURE__ */ Q(x, {
|
|
2112
2237
|
variant: "ghost",
|
|
2113
2238
|
size: "sm",
|
|
2114
|
-
onClick:
|
|
2239
|
+
onClick: Oe,
|
|
2115
2240
|
className: "gap-2 hidden sm:inline-flex",
|
|
2116
|
-
children: [/* @__PURE__ */ Z(
|
|
2241
|
+
children: [/* @__PURE__ */ Z(rt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2117
2242
|
className: "hidden sm:inline",
|
|
2118
|
-
children:
|
|
2243
|
+
children: q("detail.cancel")
|
|
2119
2244
|
})]
|
|
2120
2245
|
})
|
|
2121
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2246
|
+
}), /* @__PURE__ */ Z(H, { children: q("detail.cancelEdit") })] }), /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2122
2247
|
asChild: !0,
|
|
2123
2248
|
children: /* @__PURE__ */ Z(x, {
|
|
2124
2249
|
variant: T ? "default" : "outline",
|
|
2125
2250
|
size: "sm",
|
|
2126
|
-
onClick:
|
|
2251
|
+
onClick: De,
|
|
2127
2252
|
className: "gap-2 hidden sm:inline-flex",
|
|
2128
|
-
children: T ? /* @__PURE__ */ Q(
|
|
2253
|
+
children: T ? /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2129
2254
|
className: "hidden sm:inline",
|
|
2130
|
-
children:
|
|
2131
|
-
})] }) : /* @__PURE__ */ Q(
|
|
2255
|
+
children: q("detail.save")
|
|
2256
|
+
})] }) : /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Z(Te, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2132
2257
|
className: "hidden sm:inline",
|
|
2133
|
-
children:
|
|
2258
|
+
children: q("detail.editInline")
|
|
2134
2259
|
})] })
|
|
2135
2260
|
})
|
|
2136
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2137
|
-
|
|
2261
|
+
}), /* @__PURE__ */ Z(H, { children: q(T ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
|
|
2262
|
+
J.showEdit && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2138
2263
|
asChild: !0,
|
|
2139
2264
|
children: /* @__PURE__ */ Q(x, {
|
|
2140
2265
|
variant: "default",
|
|
2141
|
-
onClick:
|
|
2266
|
+
onClick: be,
|
|
2142
2267
|
className: "gap-2 hidden sm:inline-flex",
|
|
2143
|
-
children: [/* @__PURE__ */ Z(
|
|
2268
|
+
children: [/* @__PURE__ */ Z(Te, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2144
2269
|
className: "hidden sm:inline",
|
|
2145
|
-
children:
|
|
2270
|
+
children: q("detail.edit")
|
|
2146
2271
|
})]
|
|
2147
2272
|
})
|
|
2148
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2149
|
-
|
|
2273
|
+
}), /* @__PURE__ */ Z(H, { children: q("detail.editRecord") })] }),
|
|
2274
|
+
Me.map((e, t) => /* @__PURE__ */ Z(ot, {
|
|
2150
2275
|
schema: e,
|
|
2151
2276
|
data: g
|
|
2152
2277
|
}, `header-action-${t}`))
|
|
2153
2278
|
]
|
|
2154
2279
|
})]
|
|
2155
2280
|
}),
|
|
2156
|
-
|
|
2157
|
-
schema:
|
|
2281
|
+
J.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(ot, {
|
|
2282
|
+
schema: J.header,
|
|
2158
2283
|
data: g
|
|
2159
2284
|
}) }),
|
|
2160
|
-
|
|
2161
|
-
fields:
|
|
2285
|
+
J.highlightFields && J.highlightFields.length > 0 && /* @__PURE__ */ Z(rn, {
|
|
2286
|
+
fields: J.highlightFields,
|
|
2162
2287
|
data: g,
|
|
2163
|
-
objectName:
|
|
2164
|
-
objectSchema:
|
|
2288
|
+
objectName: J.objectName,
|
|
2289
|
+
objectSchema: F
|
|
2165
2290
|
}),
|
|
2166
|
-
c &&
|
|
2291
|
+
c && J.showHeader === !1 && (() => {
|
|
2167
2292
|
let e = g?.approval_status, t = e === "pending" || e === "in_approval";
|
|
2168
2293
|
return !T && !k && !j && !t ? null : /* @__PURE__ */ Q("div", {
|
|
2169
2294
|
className: "flex flex-col items-end gap-1",
|
|
2170
2295
|
children: [/* @__PURE__ */ Q("div", {
|
|
2171
2296
|
className: "flex items-center justify-end gap-2",
|
|
2172
2297
|
children: [
|
|
2173
|
-
t && !T && /* @__PURE__ */ Q(
|
|
2298
|
+
t && !T && /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Q("span", {
|
|
2174
2299
|
role: "status",
|
|
2175
2300
|
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",
|
|
2176
|
-
title:
|
|
2177
|
-
children: [/* @__PURE__ */ Z(
|
|
2301
|
+
title: q("detail.lockedTooltip"),
|
|
2302
|
+
children: [/* @__PURE__ */ Z(Le, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: q("detail.lockedByApproval") })]
|
|
2178
2303
|
}), n?.cancelPendingApproval && /* @__PURE__ */ Q(x, {
|
|
2179
2304
|
variant: "outline",
|
|
2180
2305
|
size: "sm",
|
|
2181
|
-
onClick:
|
|
2182
|
-
disabled:
|
|
2306
|
+
onClick: xe,
|
|
2307
|
+
disabled: se,
|
|
2183
2308
|
className: "gap-2 border-amber-300 text-amber-800 hover:bg-amber-50",
|
|
2184
|
-
title:
|
|
2185
|
-
children: [/* @__PURE__ */ Z(
|
|
2309
|
+
title: q("detail.cancelApprovalTooltip"),
|
|
2310
|
+
children: [/* @__PURE__ */ Z(rt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: q(se ? "detail.cancelApprovalInFlight" : "detail.cancelApproval") })]
|
|
2186
2311
|
})] }),
|
|
2187
2312
|
T && /* @__PURE__ */ Q(x, {
|
|
2188
2313
|
variant: "ghost",
|
|
2189
2314
|
size: "sm",
|
|
2190
|
-
onClick:
|
|
2315
|
+
onClick: Oe,
|
|
2191
2316
|
className: "gap-2",
|
|
2192
2317
|
disabled: k,
|
|
2193
|
-
children: [/* @__PURE__ */ Z(
|
|
2318
|
+
children: [/* @__PURE__ */ Z(rt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: q("detail.cancel") })]
|
|
2194
2319
|
}),
|
|
2195
2320
|
/* @__PURE__ */ Q(x, {
|
|
2196
2321
|
variant: T ? "default" : "outline",
|
|
2197
2322
|
size: "sm",
|
|
2198
|
-
onClick:
|
|
2323
|
+
onClick: De,
|
|
2199
2324
|
className: "gap-2",
|
|
2200
2325
|
disabled: k || t && !T,
|
|
2201
|
-
title: t && !T ?
|
|
2202
|
-
children: [Z(T ?
|
|
2326
|
+
title: t && !T ? q("detail.lockedTooltip") : void 0,
|
|
2327
|
+
children: [Z(T ? he : Te, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: q(k ? "detail.saving" : T ? "detail.save" : "detail.editFieldsInline") })]
|
|
2203
2328
|
})
|
|
2204
2329
|
]
|
|
2205
2330
|
}), j && /* @__PURE__ */ Z("div", {
|
|
@@ -2209,67 +2334,73 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2209
2334
|
})]
|
|
2210
2335
|
});
|
|
2211
2336
|
})(),
|
|
2212
|
-
|
|
2213
|
-
let e =
|
|
2337
|
+
J.autoTabs && !J.tabs?.length ? (() => {
|
|
2338
|
+
let e = Ae.length > 0, t = !!J.activities && J.activities.length > 0, r = !!u, i = !!J.history, a = [
|
|
2214
2339
|
"details",
|
|
2215
2340
|
...e ? ["related"] : [],
|
|
2216
2341
|
...t ? ["activity"] : [],
|
|
2217
2342
|
...r ? ["discussion"] : [],
|
|
2218
2343
|
...i ? ["history"] : []
|
|
2219
|
-
], o =
|
|
2344
|
+
], o = J.defaultTab, s = o && a.includes(o) ? o : "details", l = J.onTabChange, d = /* @__PURE__ */ Q("div", {
|
|
2220
2345
|
className: "space-y-3 sm:space-y-4",
|
|
2221
2346
|
children: [
|
|
2222
|
-
|
|
2347
|
+
J.sectionGroups && J.sectionGroups.length > 0 && J.sectionGroups.map((e, t) => /* @__PURE__ */ Z(nn, {
|
|
2223
2348
|
group: e,
|
|
2224
2349
|
data: {
|
|
2225
2350
|
...g,
|
|
2226
2351
|
...D
|
|
2227
2352
|
},
|
|
2228
|
-
objectSchema:
|
|
2229
|
-
objectName:
|
|
2353
|
+
objectSchema: F,
|
|
2354
|
+
objectName: J.objectName,
|
|
2230
2355
|
isEditing: T,
|
|
2231
|
-
onFieldChange:
|
|
2356
|
+
onFieldChange: ke,
|
|
2357
|
+
onEnterInlineEdit: c ? Y : void 0,
|
|
2358
|
+
autoFocusField: N,
|
|
2232
2359
|
dataSource: n
|
|
2233
2360
|
}, t)),
|
|
2234
|
-
|
|
2361
|
+
J.sections && J.sections.length > 0 && J.sections.map((e, t) => /* @__PURE__ */ Z(Zt, {
|
|
2235
2362
|
section: e,
|
|
2236
2363
|
data: {
|
|
2237
2364
|
...g,
|
|
2238
2365
|
...D
|
|
2239
2366
|
},
|
|
2240
|
-
objectSchema:
|
|
2241
|
-
objectName:
|
|
2367
|
+
objectSchema: F,
|
|
2368
|
+
objectName: J.objectName,
|
|
2242
2369
|
isEditing: T,
|
|
2243
|
-
onFieldChange:
|
|
2370
|
+
onFieldChange: ke,
|
|
2371
|
+
onEnterInlineEdit: c ? Y : void 0,
|
|
2372
|
+
autoFocusField: N,
|
|
2244
2373
|
dataSource: n
|
|
2245
2374
|
}, t)),
|
|
2246
|
-
|
|
2375
|
+
J.fields && J.fields.length > 0 && !J.sections?.length && /* @__PURE__ */ Z(Zt, {
|
|
2247
2376
|
section: {
|
|
2248
|
-
fields:
|
|
2249
|
-
columns:
|
|
2377
|
+
fields: J.fields,
|
|
2378
|
+
columns: J.columns
|
|
2250
2379
|
},
|
|
2251
2380
|
data: {
|
|
2252
2381
|
...g,
|
|
2253
2382
|
...D
|
|
2254
2383
|
},
|
|
2255
|
-
objectSchema:
|
|
2256
|
-
objectName:
|
|
2384
|
+
objectSchema: F,
|
|
2385
|
+
objectName: J.objectName,
|
|
2257
2386
|
isEditing: T,
|
|
2258
|
-
onFieldChange:
|
|
2387
|
+
onFieldChange: ke,
|
|
2388
|
+
onEnterInlineEdit: c ? Y : void 0,
|
|
2389
|
+
autoFocusField: N,
|
|
2259
2390
|
dataSource: n
|
|
2260
2391
|
}),
|
|
2261
|
-
|
|
2262
|
-
comments:
|
|
2263
|
-
onAddComment:
|
|
2392
|
+
J.comments && /* @__PURE__ */ Z(on, {
|
|
2393
|
+
comments: J.comments,
|
|
2394
|
+
onAddComment: J.onAddComment
|
|
2264
2395
|
})
|
|
2265
2396
|
]
|
|
2266
2397
|
});
|
|
2267
2398
|
return !e && !t && !r && !i ? /* @__PURE__ */ Z("div", {
|
|
2268
2399
|
className: "mt-2",
|
|
2269
|
-
children:
|
|
2400
|
+
children: d
|
|
2270
2401
|
}) : /* @__PURE__ */ Q(L, {
|
|
2271
2402
|
defaultValue: s,
|
|
2272
|
-
onValueChange:
|
|
2403
|
+
onValueChange: l,
|
|
2273
2404
|
className: "w-full",
|
|
2274
2405
|
children: [
|
|
2275
2406
|
/* @__PURE__ */ Q(z, {
|
|
@@ -2278,17 +2409,17 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2278
2409
|
/* @__PURE__ */ Z(B, {
|
|
2279
2410
|
value: "details",
|
|
2280
2411
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2281
|
-
children:
|
|
2412
|
+
children: q("detail.details")
|
|
2282
2413
|
}),
|
|
2283
2414
|
e && /* @__PURE__ */ Z(B, {
|
|
2284
2415
|
value: "related",
|
|
2285
2416
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2286
2417
|
children: /* @__PURE__ */ Q("span", {
|
|
2287
2418
|
className: "flex items-center gap-1.5",
|
|
2288
|
-
children: [
|
|
2419
|
+
children: [q("detail.related"), /* @__PURE__ */ Z(b, {
|
|
2289
2420
|
variant: "secondary",
|
|
2290
2421
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2291
|
-
children:
|
|
2422
|
+
children: Ae.length
|
|
2292
2423
|
})]
|
|
2293
2424
|
})
|
|
2294
2425
|
}),
|
|
@@ -2297,27 +2428,27 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2297
2428
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2298
2429
|
children: /* @__PURE__ */ Q("span", {
|
|
2299
2430
|
className: "flex items-center gap-1.5",
|
|
2300
|
-
children: [
|
|
2431
|
+
children: [q("detail.activity"), /* @__PURE__ */ Z(b, {
|
|
2301
2432
|
variant: "secondary",
|
|
2302
2433
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2303
|
-
children:
|
|
2434
|
+
children: J.activities.length
|
|
2304
2435
|
})]
|
|
2305
2436
|
})
|
|
2306
2437
|
}),
|
|
2307
2438
|
r && /* @__PURE__ */ Z(B, {
|
|
2308
2439
|
value: "discussion",
|
|
2309
2440
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2310
|
-
children:
|
|
2441
|
+
children: q("detail.discussion", { defaultValue: "Discussion" })
|
|
2311
2442
|
}),
|
|
2312
2443
|
i && /* @__PURE__ */ Z(B, {
|
|
2313
2444
|
value: "history",
|
|
2314
2445
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2315
2446
|
children: /* @__PURE__ */ Q("span", {
|
|
2316
2447
|
className: "flex items-center gap-1.5",
|
|
2317
|
-
children: [
|
|
2448
|
+
children: [q("detail.history", { defaultValue: "History" }), !J.history.loading && J.history.entries.length > 0 && /* @__PURE__ */ Z(b, {
|
|
2318
2449
|
variant: "secondary",
|
|
2319
2450
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2320
|
-
children:
|
|
2451
|
+
children: J.history.entries.length
|
|
2321
2452
|
})]
|
|
2322
2453
|
})
|
|
2323
2454
|
})
|
|
@@ -2326,14 +2457,14 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2326
2457
|
/* @__PURE__ */ Z(R, {
|
|
2327
2458
|
value: "details",
|
|
2328
2459
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2329
|
-
children:
|
|
2460
|
+
children: d
|
|
2330
2461
|
}),
|
|
2331
2462
|
e && /* @__PURE__ */ Z(R, {
|
|
2332
2463
|
value: "related",
|
|
2333
2464
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2334
2465
|
children: /* @__PURE__ */ Z("div", {
|
|
2335
2466
|
className: "space-y-3",
|
|
2336
|
-
children:
|
|
2467
|
+
children: Ae.map((e, t) => /* @__PURE__ */ Z(tn, {
|
|
2337
2468
|
title: e.title,
|
|
2338
2469
|
type: e.type,
|
|
2339
2470
|
api: e.api,
|
|
@@ -2349,15 +2480,15 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2349
2480
|
onRowEdit: e.onRowEdit,
|
|
2350
2481
|
onRowDelete: e.onRowDelete,
|
|
2351
2482
|
collapsible: !0,
|
|
2352
|
-
defaultCollapsed:
|
|
2353
|
-
pageSize:
|
|
2483
|
+
defaultCollapsed: de && t > 0,
|
|
2484
|
+
pageSize: Dn
|
|
2354
2485
|
}, t))
|
|
2355
2486
|
})
|
|
2356
2487
|
}),
|
|
2357
2488
|
t && /* @__PURE__ */ Z(R, {
|
|
2358
2489
|
value: "activity",
|
|
2359
2490
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2360
|
-
children: /* @__PURE__ */ Z(
|
|
2491
|
+
children: /* @__PURE__ */ Z(fn, { activities: J.activities })
|
|
2361
2492
|
}),
|
|
2362
2493
|
r && /* @__PURE__ */ Z(R, {
|
|
2363
2494
|
value: "discussion",
|
|
@@ -2367,70 +2498,76 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2367
2498
|
i && /* @__PURE__ */ Z(R, {
|
|
2368
2499
|
value: "history",
|
|
2369
2500
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2370
|
-
children: /* @__PURE__ */ Z(
|
|
2371
|
-
entries:
|
|
2372
|
-
loading:
|
|
2373
|
-
emptyText:
|
|
2501
|
+
children: /* @__PURE__ */ Z(yn, {
|
|
2502
|
+
entries: J.history.entries,
|
|
2503
|
+
loading: J.history.loading,
|
|
2504
|
+
emptyText: J.history.emptyText ?? q("detail.historyEmpty", { defaultValue: "No history yet" })
|
|
2374
2505
|
})
|
|
2375
2506
|
})
|
|
2376
2507
|
]
|
|
2377
2508
|
});
|
|
2378
|
-
})() : /* @__PURE__ */ Q(
|
|
2379
|
-
|
|
2509
|
+
})() : /* @__PURE__ */ Q(Mt, { children: [
|
|
2510
|
+
J.sectionGroups && J.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2380
2511
|
className: "space-y-3 sm:space-y-4",
|
|
2381
|
-
children:
|
|
2512
|
+
children: J.sectionGroups.map((e, t) => /* @__PURE__ */ Z(nn, {
|
|
2382
2513
|
group: e,
|
|
2383
2514
|
data: {
|
|
2384
2515
|
...g,
|
|
2385
2516
|
...D
|
|
2386
2517
|
},
|
|
2387
|
-
objectSchema:
|
|
2388
|
-
objectName:
|
|
2518
|
+
objectSchema: F,
|
|
2519
|
+
objectName: J.objectName,
|
|
2389
2520
|
isEditing: T,
|
|
2390
|
-
onFieldChange:
|
|
2521
|
+
onFieldChange: ke,
|
|
2522
|
+
onEnterInlineEdit: c ? Y : void 0,
|
|
2523
|
+
autoFocusField: N,
|
|
2391
2524
|
dataSource: n
|
|
2392
2525
|
}, t))
|
|
2393
2526
|
}),
|
|
2394
|
-
|
|
2527
|
+
J.sections && J.sections.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2395
2528
|
className: "space-y-3 sm:space-y-4",
|
|
2396
|
-
children:
|
|
2529
|
+
children: J.sections.map((e, t) => /* @__PURE__ */ Z(Zt, {
|
|
2397
2530
|
section: e,
|
|
2398
2531
|
data: {
|
|
2399
2532
|
...g,
|
|
2400
2533
|
...D
|
|
2401
2534
|
},
|
|
2402
|
-
objectSchema:
|
|
2403
|
-
objectName:
|
|
2535
|
+
objectSchema: F,
|
|
2536
|
+
objectName: J.objectName,
|
|
2404
2537
|
isEditing: T,
|
|
2405
|
-
onFieldChange:
|
|
2538
|
+
onFieldChange: ke,
|
|
2539
|
+
onEnterInlineEdit: c ? Y : void 0,
|
|
2540
|
+
autoFocusField: N,
|
|
2406
2541
|
dataSource: n
|
|
2407
2542
|
}, t))
|
|
2408
2543
|
}),
|
|
2409
|
-
|
|
2544
|
+
J.fields && J.fields.length > 0 && !J.sections?.length && /* @__PURE__ */ Z(Zt, {
|
|
2410
2545
|
section: {
|
|
2411
|
-
fields:
|
|
2412
|
-
columns:
|
|
2546
|
+
fields: J.fields,
|
|
2547
|
+
columns: J.columns
|
|
2413
2548
|
},
|
|
2414
2549
|
data: {
|
|
2415
2550
|
...g,
|
|
2416
2551
|
...D
|
|
2417
2552
|
},
|
|
2418
|
-
objectSchema:
|
|
2419
|
-
objectName:
|
|
2553
|
+
objectSchema: F,
|
|
2554
|
+
objectName: J.objectName,
|
|
2420
2555
|
isEditing: T,
|
|
2421
|
-
onFieldChange:
|
|
2556
|
+
onFieldChange: ke,
|
|
2557
|
+
onEnterInlineEdit: c ? Y : void 0,
|
|
2558
|
+
autoFocusField: N,
|
|
2422
2559
|
dataSource: n
|
|
2423
2560
|
}),
|
|
2424
|
-
|
|
2425
|
-
tabs:
|
|
2561
|
+
J.tabs && J.tabs.length > 0 && /* @__PURE__ */ Z(Qt, {
|
|
2562
|
+
tabs: J.tabs,
|
|
2426
2563
|
data: g
|
|
2427
2564
|
}),
|
|
2428
|
-
|
|
2565
|
+
Ae.length > 0 && /* @__PURE__ */ Q("div", {
|
|
2429
2566
|
className: "space-y-3",
|
|
2430
2567
|
children: [/* @__PURE__ */ Z("h2", {
|
|
2431
2568
|
className: "text-lg font-semibold",
|
|
2432
|
-
children:
|
|
2433
|
-
}),
|
|
2569
|
+
children: q("detail.related")
|
|
2570
|
+
}), Ae.map((e, t) => /* @__PURE__ */ Z(tn, {
|
|
2434
2571
|
title: e.title,
|
|
2435
2572
|
type: e.type,
|
|
2436
2573
|
api: e.api,
|
|
@@ -2446,31 +2583,31 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2446
2583
|
onRowEdit: e.onRowEdit,
|
|
2447
2584
|
onRowDelete: e.onRowDelete,
|
|
2448
2585
|
collapsible: !0,
|
|
2449
|
-
defaultCollapsed:
|
|
2450
|
-
pageSize:
|
|
2586
|
+
defaultCollapsed: de && t > 0,
|
|
2587
|
+
pageSize: Dn
|
|
2451
2588
|
}, t))]
|
|
2452
2589
|
}),
|
|
2453
|
-
|
|
2454
|
-
comments:
|
|
2455
|
-
onAddComment:
|
|
2590
|
+
J.comments && /* @__PURE__ */ Z(on, {
|
|
2591
|
+
comments: J.comments,
|
|
2592
|
+
onAddComment: J.onAddComment
|
|
2456
2593
|
}),
|
|
2457
|
-
|
|
2594
|
+
J.activities && J.activities.length > 0 && /* @__PURE__ */ Z(fn, { activities: J.activities })
|
|
2458
2595
|
] }),
|
|
2459
|
-
/* @__PURE__ */ Z(
|
|
2596
|
+
/* @__PURE__ */ Z(En, {
|
|
2460
2597
|
data: {
|
|
2461
2598
|
...g,
|
|
2462
2599
|
...D
|
|
2463
2600
|
},
|
|
2464
|
-
objectSchema:
|
|
2465
|
-
objectName:
|
|
2601
|
+
objectSchema: F,
|
|
2602
|
+
objectName: J.objectName
|
|
2466
2603
|
}),
|
|
2467
|
-
|
|
2468
|
-
schema:
|
|
2604
|
+
J.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(ot, {
|
|
2605
|
+
schema: J.footer,
|
|
2469
2606
|
data: g
|
|
2470
2607
|
}) })
|
|
2471
2608
|
]
|
|
2472
2609
|
}) });
|
|
2473
|
-
},
|
|
2610
|
+
}, An = (e) => {
|
|
2474
2611
|
if (e == null) return "—";
|
|
2475
2612
|
if (typeof e == "string") return e.length > 0 ? e : "\"\"";
|
|
2476
2613
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -2479,7 +2616,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2479
2616
|
} catch {
|
|
2480
2617
|
return String(e);
|
|
2481
2618
|
}
|
|
2482
|
-
},
|
|
2619
|
+
}, jn = (e) => {
|
|
2483
2620
|
if (typeof e != "string" || e.length === 0) return null;
|
|
2484
2621
|
let t = /\d{4}-\d{2}-\d{2}[ T]/.test(e) ? e.replace(" ", "T") : e, n = new Date(t);
|
|
2485
2622
|
if (Number.isNaN(n.getTime())) return null;
|
|
@@ -2488,13 +2625,13 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2488
2625
|
} catch {
|
|
2489
2626
|
return n.toISOString();
|
|
2490
2627
|
}
|
|
2491
|
-
},
|
|
2492
|
-
let { t: o } = $(), s = t?.label || t?.field || "", l = t ?
|
|
2628
|
+
}, Mn = ({ open: e, conflict: t, onReload: n, onOverwrite: r, onCancel: i, busy: a = !1 }) => {
|
|
2629
|
+
let { t: o } = $(), s = t?.label || t?.field || "", l = t ? An(t.pendingValue) : "", u = t ? An(t.currentValue) : "", g = t?.currentRecord ?? {}, _ = (() => {
|
|
2493
2630
|
let e = [g.updated_by_name, g.updated_by_label];
|
|
2494
2631
|
for (let t of e) if (typeof t == "string" && t.length > 0) return t;
|
|
2495
2632
|
let t = g.updated_by;
|
|
2496
2633
|
return typeof t != "string" || t.length === 0 || t.length >= 16 && !/\s/.test(t) && /^[A-Za-z0-9_-]+$/.test(t) ? null : t;
|
|
2497
|
-
})(), v =
|
|
2634
|
+
})(), v = jn(g.updated_at ?? t?.currentVersion), [y, b] = o("detail.concurrentUpdateDescription", { field: "{{field}}" }).split("{{field}}");
|
|
2498
2635
|
return /* @__PURE__ */ Z(c, {
|
|
2499
2636
|
open: e,
|
|
2500
2637
|
onOpenChange: (e) => {
|
|
@@ -2508,7 +2645,7 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2508
2645
|
children: [/* @__PURE__ */ Z("span", {
|
|
2509
2646
|
className: "inline-flex h-9 w-9 flex-none items-center justify-center rounded-full bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-300",
|
|
2510
2647
|
"aria-hidden": "true",
|
|
2511
|
-
children: /* @__PURE__ */ Z(
|
|
2648
|
+
children: /* @__PURE__ */ Z(K, { className: "h-5 w-5" })
|
|
2512
2649
|
}), /* @__PURE__ */ Q("div", {
|
|
2513
2650
|
className: "flex-1",
|
|
2514
2651
|
children: [/* @__PURE__ */ Z(h, { children: o("detail.concurrentUpdateTitle") }), /* @__PURE__ */ Q(f, {
|
|
@@ -2587,14 +2724,14 @@ var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2587
2724
|
})
|
|
2588
2725
|
});
|
|
2589
2726
|
};
|
|
2590
|
-
function
|
|
2727
|
+
function Nn(e) {
|
|
2591
2728
|
if (!e || typeof e != "object") return !1;
|
|
2592
2729
|
let t = e;
|
|
2593
2730
|
return t.code === "CONCURRENT_UPDATE" || t.name === "ConcurrentUpdateError";
|
|
2594
2731
|
}
|
|
2595
2732
|
//#endregion
|
|
2596
2733
|
//#region src/renderers/record-details.tsx
|
|
2597
|
-
var
|
|
2734
|
+
var Pn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name) || null, Fn = (e) => {
|
|
2598
2735
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2599
2736
|
return {
|
|
2600
2737
|
designer: {
|
|
@@ -2604,8 +2741,8 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2604
2741
|
},
|
|
2605
2742
|
rest: i
|
|
2606
2743
|
};
|
|
2607
|
-
},
|
|
2608
|
-
let r =
|
|
2744
|
+
}, In = ({ schema: e = {}, className: t, ...n }) => {
|
|
2745
|
+
let r = ht(), { designer: i } = Fn(n), o = r?.objectName || "", s = Pt(), { readableFields: c } = Nt(o), { sectionLabel: l } = vt(), u = ft(), [d, f] = a.useState(null), [p, m] = a.useState(!1), h = a.useCallback((t) => {
|
|
2609
2746
|
let n = [...Array.isArray(e.fields) ? e.fields : [], ...(Array.isArray(e.sections) ? e.sections : []).flatMap((e) => Array.isArray(e?.fields) ? e.fields : [])];
|
|
2610
2747
|
for (let e of n) if ((typeof e == "string" ? e : e?.name || e?.field) === t) return typeof e == "object" ? e?.label : void 0;
|
|
2611
2748
|
}, [e.fields, e.sections]), g = a.useCallback(async (e, t) => {
|
|
@@ -2622,7 +2759,7 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2622
2759
|
}
|
|
2623
2760
|
typeof r?.refresh == "function" && await r.refresh();
|
|
2624
2761
|
} catch (n) {
|
|
2625
|
-
if (
|
|
2762
|
+
if (Nn(n)) {
|
|
2626
2763
|
let r = n.currentRecord ?? null;
|
|
2627
2764
|
throw f({
|
|
2628
2765
|
field: e,
|
|
@@ -2700,15 +2837,15 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2700
2837
|
});
|
|
2701
2838
|
let x = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", S = e.enforceFieldSecurity === !0, C = Array.isArray(e.redactFields) ? e.redactFields : [], w = (e) => {
|
|
2702
2839
|
if (!e || !S && C.length === 0) return e;
|
|
2703
|
-
let t = e.map(
|
|
2840
|
+
let t = e.map(Pn).filter((e) => !!e), n = new Set((S && o ? c(t) : t).filter((e) => !C.includes(e)));
|
|
2704
2841
|
return e.filter((e) => {
|
|
2705
|
-
let t =
|
|
2842
|
+
let t = Pn(e);
|
|
2706
2843
|
return t ? n.has(t) : !0;
|
|
2707
2844
|
});
|
|
2708
2845
|
}, T = (e) => typeof e == "string" ? { name: e } : e && typeof e == "object" && !e.name && e.field ? {
|
|
2709
2846
|
...e,
|
|
2710
2847
|
name: e.field
|
|
2711
|
-
} : 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 :
|
|
2848
|
+
} : 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 : Pn(e)).filter((e) => !!e));
|
|
2712
2849
|
for (let e of u) D.add(e);
|
|
2713
2850
|
let O = r.objectSchema, k = r.data ?? {}, A = [
|
|
2714
2851
|
O?.primaryField,
|
|
@@ -2724,7 +2861,7 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2724
2861
|
break;
|
|
2725
2862
|
}
|
|
2726
2863
|
let j = (e) => !e || D.size === 0 ? e : e.filter((e) => {
|
|
2727
|
-
let t =
|
|
2864
|
+
let t = Pn(e);
|
|
2728
2865
|
return t ? !D.has(t) : !0;
|
|
2729
2866
|
}), M = j(E(w(e.fields))), N = Array.isArray(e.sections) ? e.sections.map((e) => {
|
|
2730
2867
|
let t = e.title ?? e.label, n = e.name && o ? l(o, e.name, t ?? e.name) : t;
|
|
@@ -2735,7 +2872,11 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2735
2872
|
hideEmpty: e.hideEmpty ?? !0,
|
|
2736
2873
|
fields: j(E(w(e.fields)))
|
|
2737
2874
|
};
|
|
2738
|
-
}) : e.sections,
|
|
2875
|
+
}) : e.sections, P = /* @__PURE__ */ new Set([
|
|
2876
|
+
"system",
|
|
2877
|
+
"append-only",
|
|
2878
|
+
"better-auth"
|
|
2879
|
+
]), F = O?.managedBy, ee = O?.userActions?.edit ?? !(F != null && P.has(F)), te = (e.inlineEdit ?? !0) && ee, ne = {
|
|
2739
2880
|
type: "detail-view",
|
|
2740
2881
|
objectName: r.objectName,
|
|
2741
2882
|
resourceId: r.recordId,
|
|
@@ -2746,17 +2887,17 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2746
2887
|
fields: M,
|
|
2747
2888
|
showBack: !1,
|
|
2748
2889
|
showHeader: e.showHeader ?? !1,
|
|
2749
|
-
inlineEdit:
|
|
2890
|
+
inlineEdit: te
|
|
2750
2891
|
};
|
|
2751
2892
|
return /* @__PURE__ */ Q("div", {
|
|
2752
2893
|
className: t,
|
|
2753
2894
|
...i,
|
|
2754
|
-
children: [/* @__PURE__ */ Z(
|
|
2755
|
-
schema:
|
|
2895
|
+
children: [/* @__PURE__ */ Z(kn, {
|
|
2896
|
+
schema: ne,
|
|
2756
2897
|
dataSource: r.dataSource,
|
|
2757
|
-
inlineEdit:
|
|
2898
|
+
inlineEdit: te,
|
|
2758
2899
|
onFieldSave: g
|
|
2759
|
-
}), /* @__PURE__ */ Z(
|
|
2900
|
+
}), /* @__PURE__ */ Z(Mn, {
|
|
2760
2901
|
open: !!d,
|
|
2761
2902
|
conflict: d,
|
|
2762
2903
|
busy: p,
|
|
@@ -2765,7 +2906,7 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2765
2906
|
onOverwrite: y
|
|
2766
2907
|
})]
|
|
2767
2908
|
});
|
|
2768
|
-
},
|
|
2909
|
+
}, Ln = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name || e.key) || null, Rn = (e) => e?.id ?? e?._id ?? null, zn = (e) => {
|
|
2769
2910
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2770
2911
|
return {
|
|
2771
2912
|
designer: {
|
|
@@ -2775,11 +2916,11 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2775
2916
|
},
|
|
2776
2917
|
rest: i
|
|
2777
2918
|
};
|
|
2778
|
-
},
|
|
2779
|
-
let r =
|
|
2919
|
+
}, Bn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2920
|
+
let r = ht(), { designer: i } = zn(n), o = vt(), s = e.objectName, c = s && o.objectLabel ? o.objectLabel({
|
|
2780
2921
|
name: s,
|
|
2781
|
-
label:
|
|
2782
|
-
}) : s ?
|
|
2922
|
+
label: Dt(s)
|
|
2923
|
+
}) : s ? Dt(s) : "", l = e.title || c || "Related";
|
|
2783
2924
|
if (!s) return /* @__PURE__ */ Z("div", {
|
|
2784
2925
|
className: t,
|
|
2785
2926
|
...i,
|
|
@@ -2788,17 +2929,17 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2788
2929
|
children: "record:related_list — missing objectName"
|
|
2789
2930
|
})
|
|
2790
2931
|
});
|
|
2791
|
-
let u =
|
|
2932
|
+
let u = Pt(), { readableFields: d } = Nt(s), f = e.relationshipValueField || "id", p = f === "id" ? r?.recordId ?? null : r?.data?.[f] ?? null, m = _t(), h = a.useMemo(() => m?.resolve({
|
|
2792
2933
|
objectName: s,
|
|
2793
2934
|
relationshipField: e.relationshipField,
|
|
2794
|
-
parentId:
|
|
2935
|
+
parentId: p
|
|
2795
2936
|
}) ?? null, [
|
|
2796
|
-
|
|
2937
|
+
m,
|
|
2797
2938
|
s,
|
|
2798
2939
|
e.relationshipField,
|
|
2799
|
-
|
|
2800
|
-
]),
|
|
2801
|
-
if (
|
|
2940
|
+
p
|
|
2941
|
+
]), g = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2942
|
+
if (g.length > 0 && !g.every((e) => u.can(s, e))) return /* @__PURE__ */ Z("div", {
|
|
2802
2943
|
className: t,
|
|
2803
2944
|
...i,
|
|
2804
2945
|
role: "status",
|
|
@@ -2808,49 +2949,51 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2808
2949
|
children: "Insufficient permissions to view related list."
|
|
2809
2950
|
})
|
|
2810
2951
|
});
|
|
2811
|
-
let
|
|
2812
|
-
if (
|
|
2813
|
-
let e =
|
|
2814
|
-
|
|
2815
|
-
let n =
|
|
2952
|
+
let _ = e.enforceFieldSecurity === !0, v = Array.isArray(e.redactFields) ? e.redactFields : [], y = Array.isArray(e.columns) ? e.columns : [], b = y;
|
|
2953
|
+
if (_ || v.length > 0) {
|
|
2954
|
+
let e = y.map(Ln).filter((e) => !!e), t = new Set((_ ? d(e) : e).filter((e) => !v.includes(e)));
|
|
2955
|
+
b = y.filter((e) => {
|
|
2956
|
+
let n = Ln(e);
|
|
2816
2957
|
return n ? t.has(n) : !0;
|
|
2817
2958
|
});
|
|
2818
2959
|
}
|
|
2819
2960
|
return /* @__PURE__ */ Z("div", {
|
|
2820
2961
|
className: t,
|
|
2821
2962
|
...i,
|
|
2822
|
-
children: /* @__PURE__ */ Z(
|
|
2963
|
+
children: /* @__PURE__ */ Z(tn, {
|
|
2823
2964
|
title: l,
|
|
2824
2965
|
type: "table",
|
|
2825
2966
|
api: s,
|
|
2826
2967
|
objectName: s,
|
|
2827
2968
|
referenceField: e.relationshipField,
|
|
2828
|
-
parentId:
|
|
2829
|
-
columns:
|
|
2969
|
+
parentId: p,
|
|
2970
|
+
columns: b,
|
|
2830
2971
|
pageSize: e.limit,
|
|
2831
2972
|
dataSource: r?.dataSource,
|
|
2832
2973
|
add: e.add,
|
|
2833
|
-
rowActions:
|
|
2834
|
-
onRowAction:
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2974
|
+
rowActions: h?.rowActions,
|
|
2975
|
+
onRowAction: h?.onRowAction,
|
|
2976
|
+
toolbarActions: h?.toolbarActions,
|
|
2977
|
+
onToolbarAction: h?.onToolbarAction,
|
|
2978
|
+
onNew: h?.onCreate,
|
|
2979
|
+
onRowClick: h?.onView ? (e) => {
|
|
2980
|
+
let t = Rn(e);
|
|
2981
|
+
t != null && h.onView(t, e);
|
|
2839
2982
|
} : void 0,
|
|
2840
|
-
onRowEdit:
|
|
2841
|
-
let t =
|
|
2842
|
-
t != null &&
|
|
2983
|
+
onRowEdit: h?.onEdit ? (e) => {
|
|
2984
|
+
let t = Rn(e);
|
|
2985
|
+
t != null && h.onEdit(t, e);
|
|
2843
2986
|
} : void 0,
|
|
2844
|
-
onRowDelete:
|
|
2845
|
-
let t =
|
|
2846
|
-
if (t != null) return
|
|
2987
|
+
onRowDelete: h?.onDelete ? (e) => {
|
|
2988
|
+
let t = Rn(e);
|
|
2989
|
+
if (t != null) return h.onDelete(t, e);
|
|
2847
2990
|
} : e.add && r?.dataSource ? async (e) => {
|
|
2848
2991
|
let t = e?.id ?? e?._id;
|
|
2849
2992
|
t != null && await r.dataSource.delete?.(s, String(t));
|
|
2850
2993
|
} : void 0
|
|
2851
2994
|
})
|
|
2852
2995
|
});
|
|
2853
|
-
},
|
|
2996
|
+
}, Vn = (e) => {
|
|
2854
2997
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2855
2998
|
return {
|
|
2856
2999
|
designer: {
|
|
@@ -2860,8 +3003,8 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2860
3003
|
},
|
|
2861
3004
|
rest: i
|
|
2862
3005
|
};
|
|
2863
|
-
},
|
|
2864
|
-
let r =
|
|
3006
|
+
}, Hn = ({ schema: e = {}, className: t, ...n }) => {
|
|
3007
|
+
let r = ht(), { designer: i } = Vn(n), o = r?.objectName || "", s = Pt(), { readableFields: c } = Nt(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2865
3008
|
if (l.length > 0 && o && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2866
3009
|
className: t,
|
|
2867
3010
|
...i,
|
|
@@ -2878,17 +3021,17 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2878
3021
|
icon: e?.icon,
|
|
2879
3022
|
type: e?.type
|
|
2880
3023
|
}).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)));
|
|
2881
|
-
return
|
|
3024
|
+
return gt(a.useId(), m.map((e) => e.name)), /* @__PURE__ */ Z("div", {
|
|
2882
3025
|
className: t,
|
|
2883
3026
|
...i,
|
|
2884
|
-
children: /* @__PURE__ */ Z(
|
|
3027
|
+
children: /* @__PURE__ */ Z(rn, {
|
|
2885
3028
|
fields: m,
|
|
2886
3029
|
data: r?.data,
|
|
2887
3030
|
objectName: r?.objectName,
|
|
2888
3031
|
objectSchema: r?.objectSchema
|
|
2889
3032
|
})
|
|
2890
3033
|
});
|
|
2891
|
-
},
|
|
3034
|
+
}, Un = ({ change: e, className: t }) => {
|
|
2892
3035
|
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));
|
|
2893
3036
|
return /* @__PURE__ */ Q("div", {
|
|
2894
3037
|
className: G("flex items-center gap-1.5 text-sm flex-wrap", t),
|
|
@@ -2901,21 +3044,21 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2901
3044
|
className: "text-muted-foreground line-through",
|
|
2902
3045
|
children: r
|
|
2903
3046
|
}),
|
|
2904
|
-
/* @__PURE__ */ Z(
|
|
3047
|
+
/* @__PURE__ */ Z(q, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
2905
3048
|
/* @__PURE__ */ Z("span", {
|
|
2906
3049
|
className: "text-foreground",
|
|
2907
3050
|
children: i
|
|
2908
3051
|
})
|
|
2909
3052
|
]
|
|
2910
3053
|
});
|
|
2911
|
-
},
|
|
3054
|
+
}, Wn = [
|
|
2912
3055
|
"👍",
|
|
2913
3056
|
"❤️",
|
|
2914
3057
|
"🎉",
|
|
2915
3058
|
"😂",
|
|
2916
3059
|
"😮",
|
|
2917
3060
|
"😢"
|
|
2918
|
-
],
|
|
3061
|
+
], Gn = ({ reactions: e, onToggleReaction: t, emojiOptions: n = Wn, className: r }) => {
|
|
2919
3062
|
let [a, o] = i.useState(!1), s = i.useCallback((e) => {
|
|
2920
3063
|
t?.(e), o(!1);
|
|
2921
3064
|
}, [t]);
|
|
@@ -2936,7 +3079,7 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2936
3079
|
className: "h-6 w-6",
|
|
2937
3080
|
onClick: () => o(!a),
|
|
2938
3081
|
"aria-label": "Add reaction",
|
|
2939
|
-
children: /* @__PURE__ */ Z(
|
|
3082
|
+
children: /* @__PURE__ */ Z($e, { className: "h-3.5 w-3.5" })
|
|
2940
3083
|
}), a && /* @__PURE__ */ Z("div", {
|
|
2941
3084
|
className: "absolute bottom-full mb-1 left-0 bg-popover border rounded-md shadow-md z-50 p-1.5 flex gap-1",
|
|
2942
3085
|
role: "listbox",
|
|
@@ -2955,7 +3098,7 @@ var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2955
3098
|
};
|
|
2956
3099
|
//#endregion
|
|
2957
3100
|
//#region src/ThreadedReplies.tsx
|
|
2958
|
-
function
|
|
3101
|
+
function Kn(e, t) {
|
|
2959
3102
|
try {
|
|
2960
3103
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
2961
3104
|
if (i < 1) return t("detail.justNow");
|
|
@@ -2968,7 +3111,7 @@ function zn(e, t) {
|
|
|
2968
3111
|
return e;
|
|
2969
3112
|
}
|
|
2970
3113
|
}
|
|
2971
|
-
var
|
|
3114
|
+
var qn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, className: a }) => {
|
|
2972
3115
|
let { t: o } = $(), [s, c] = i.useState(!1), [l, u] = i.useState(""), [d, f] = i.useState(!1), p = i.useCallback(async () => {
|
|
2973
3116
|
let t = l.trim();
|
|
2974
3117
|
if (!(!t || !n)) {
|
|
@@ -2995,8 +3138,8 @@ var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
2995
3138
|
onClick: () => c(!s),
|
|
2996
3139
|
"aria-expanded": s,
|
|
2997
3140
|
children: [
|
|
2998
|
-
Z(s ?
|
|
2999
|
-
/* @__PURE__ */ Z(
|
|
3141
|
+
Z(s ? _e : ye, { className: "h-3 w-3" }),
|
|
3142
|
+
/* @__PURE__ */ Z(ze, { className: "h-3 w-3" }),
|
|
3000
3143
|
/* @__PURE__ */ Z("span", { children: t.length === 1 ? o("detail.replyCount", { count: t.length }) : o("detail.replyCountPlural", { count: t.length }) })
|
|
3001
3144
|
]
|
|
3002
3145
|
}),
|
|
@@ -3023,7 +3166,7 @@ var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3023
3166
|
children: e.actor
|
|
3024
3167
|
}), /* @__PURE__ */ Z("span", {
|
|
3025
3168
|
className: "text-[10px] text-muted-foreground",
|
|
3026
|
-
children:
|
|
3169
|
+
children: Kn(e.createdAt, o)
|
|
3027
3170
|
})]
|
|
3028
3171
|
}), /* @__PURE__ */ Z("p", {
|
|
3029
3172
|
className: "text-xs whitespace-pre-wrap break-words",
|
|
@@ -3048,12 +3191,12 @@ var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3048
3191
|
onClick: p,
|
|
3049
3192
|
disabled: !l.trim() || d,
|
|
3050
3193
|
"aria-label": "Send reply",
|
|
3051
|
-
children: /* @__PURE__ */ Z(
|
|
3194
|
+
children: /* @__PURE__ */ Z(Qe, { className: "h-3 w-3" })
|
|
3052
3195
|
})]
|
|
3053
3196
|
})
|
|
3054
3197
|
]
|
|
3055
3198
|
});
|
|
3056
|
-
},
|
|
3199
|
+
}, Jn = ({ subscription: e, onToggle: t, className: n }) => {
|
|
3057
3200
|
let { t: r } = $(), [a, o] = i.useState(!1), s = i.useCallback(async () => {
|
|
3058
3201
|
if (t) {
|
|
3059
3202
|
o(!0);
|
|
@@ -3072,16 +3215,16 @@ var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3072
3215
|
disabled: a || !t,
|
|
3073
3216
|
"aria-label": e.subscribed ? r("detail.unsubscribeAriaLabel") : r("detail.subscribeAriaLabel"),
|
|
3074
3217
|
title: e.subscribed ? r("detail.subscribedTooltip") : r("detail.unsubscribedTooltip"),
|
|
3075
|
-
children: e.subscribed ? /* @__PURE__ */ Z(fe, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(
|
|
3218
|
+
children: e.subscribed ? /* @__PURE__ */ Z(fe, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(J, { className: "h-4 w-4 text-muted-foreground" })
|
|
3076
3219
|
});
|
|
3077
3220
|
};
|
|
3078
3221
|
//#endregion
|
|
3079
3222
|
//#region src/RichTextCommentInput.tsx
|
|
3080
|
-
function
|
|
3223
|
+
function Yn(e) {
|
|
3081
3224
|
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/>");
|
|
3082
3225
|
return t = t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g, (e) => `<ul class="my-1">${e.replace(/<br\/>/g, "")}</ul>`), t;
|
|
3083
3226
|
}
|
|
3084
|
-
var
|
|
3227
|
+
var Xn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], placeholder: a, className: o, disabled: s = !1, extraSlot: c, canSubmitEmpty: l = !1 }) => {
|
|
3085
3228
|
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(() => {
|
|
3086
3229
|
if (!h) return r;
|
|
3087
3230
|
let e = h.toLowerCase();
|
|
@@ -3154,7 +3297,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3154
3297
|
onClick: C,
|
|
3155
3298
|
disabled: s || d,
|
|
3156
3299
|
title: u("detail.bold"),
|
|
3157
|
-
children: /* @__PURE__ */ Z(
|
|
3300
|
+
children: /* @__PURE__ */ Z(pe, { className: "h-3.5 w-3.5" })
|
|
3158
3301
|
}),
|
|
3159
3302
|
/* @__PURE__ */ Z(x, {
|
|
3160
3303
|
variant: "ghost",
|
|
@@ -3163,7 +3306,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3163
3306
|
onClick: w,
|
|
3164
3307
|
disabled: s || d,
|
|
3165
3308
|
title: u("detail.italic"),
|
|
3166
|
-
children: /* @__PURE__ */ Z(
|
|
3309
|
+
children: /* @__PURE__ */ Z(Ne, { className: "h-3.5 w-3.5" })
|
|
3167
3310
|
}),
|
|
3168
3311
|
/* @__PURE__ */ Z(x, {
|
|
3169
3312
|
variant: "ghost",
|
|
@@ -3172,7 +3315,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3172
3315
|
onClick: T,
|
|
3173
3316
|
disabled: s || d,
|
|
3174
3317
|
title: u("detail.listFormat"),
|
|
3175
|
-
children: /* @__PURE__ */ Z(
|
|
3318
|
+
children: /* @__PURE__ */ Z(Fe, { className: "h-3.5 w-3.5" })
|
|
3176
3319
|
}),
|
|
3177
3320
|
/* @__PURE__ */ Z(x, {
|
|
3178
3321
|
variant: "ghost",
|
|
@@ -3181,7 +3324,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3181
3324
|
onClick: E,
|
|
3182
3325
|
disabled: s || d,
|
|
3183
3326
|
title: u("detail.inlineCode"),
|
|
3184
|
-
children: /* @__PURE__ */ Z(
|
|
3327
|
+
children: /* @__PURE__ */ Z(Se, { className: "h-3.5 w-3.5" })
|
|
3185
3328
|
}),
|
|
3186
3329
|
/* @__PURE__ */ Z(x, {
|
|
3187
3330
|
variant: "ghost",
|
|
@@ -3190,7 +3333,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3190
3333
|
onClick: D,
|
|
3191
3334
|
disabled: s || d,
|
|
3192
3335
|
title: u("detail.mentionSomeone"),
|
|
3193
|
-
children: /* @__PURE__ */ Z(
|
|
3336
|
+
children: /* @__PURE__ */ Z(de, { className: "h-3.5 w-3.5" })
|
|
3194
3337
|
}),
|
|
3195
3338
|
/* @__PURE__ */ Z("div", { className: "flex-1" }),
|
|
3196
3339
|
/* @__PURE__ */ Z(x, {
|
|
@@ -3199,7 +3342,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3199
3342
|
className: "h-7 w-7",
|
|
3200
3343
|
onClick: () => f(!d),
|
|
3201
3344
|
title: u(d ? "detail.edit" : "detail.preview"),
|
|
3202
|
-
children: Z(d ?
|
|
3345
|
+
children: Z(d ? Te : De, { className: "h-3.5 w-3.5" })
|
|
3203
3346
|
}),
|
|
3204
3347
|
n && /* @__PURE__ */ Z(x, {
|
|
3205
3348
|
variant: "ghost",
|
|
@@ -3208,7 +3351,7 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3208
3351
|
onClick: n,
|
|
3209
3352
|
disabled: s || !l && !e.trim(),
|
|
3210
3353
|
title: u("detail.submitComment"),
|
|
3211
|
-
children: /* @__PURE__ */ Z(
|
|
3354
|
+
children: /* @__PURE__ */ Z(Qe, { className: "h-3.5 w-3.5" })
|
|
3212
3355
|
})
|
|
3213
3356
|
]
|
|
3214
3357
|
}),
|
|
@@ -3216,8 +3359,8 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3216
3359
|
className: "relative",
|
|
3217
3360
|
children: d ? /* @__PURE__ */ Z("div", {
|
|
3218
3361
|
className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
|
|
3219
|
-
dangerouslySetInnerHTML: { __html:
|
|
3220
|
-
}) : /* @__PURE__ */ Q(
|
|
3362
|
+
dangerouslySetInnerHTML: { __html: Yn(e) }
|
|
3363
|
+
}) : /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Z("textarea", {
|
|
3221
3364
|
ref: y,
|
|
3222
3365
|
className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
|
|
3223
3366
|
placeholder: a ?? u("detail.writeComment"),
|
|
@@ -3253,16 +3396,16 @@ var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3253
3396
|
};
|
|
3254
3397
|
//#endregion
|
|
3255
3398
|
//#region src/CommentAttachment.tsx
|
|
3256
|
-
function
|
|
3399
|
+
function Zn(e) {
|
|
3257
3400
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
3258
3401
|
}
|
|
3259
|
-
function
|
|
3402
|
+
function Qn(e) {
|
|
3260
3403
|
return e.startsWith("image/");
|
|
3261
3404
|
}
|
|
3262
|
-
function
|
|
3263
|
-
return
|
|
3405
|
+
function $n(e) {
|
|
3406
|
+
return Qn(e) ? Me : e.includes("pdf") || e.includes("document") || e.includes("text") ? Ae : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? Y : ke;
|
|
3264
3407
|
}
|
|
3265
|
-
var
|
|
3408
|
+
var er = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a = !1 }) => {
|
|
3266
3409
|
let { t: o } = $(), [s, c] = i.useState(!1), l = i.useRef(null), u = i.useCallback((e) => {
|
|
3267
3410
|
e.preventDefault(), e.stopPropagation(), c(!0);
|
|
3268
3411
|
}, []), d = i.useCallback((e) => {
|
|
@@ -3286,7 +3429,7 @@ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3286
3429
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), l.current?.click());
|
|
3287
3430
|
},
|
|
3288
3431
|
children: [
|
|
3289
|
-
/* @__PURE__ */ Z(
|
|
3432
|
+
/* @__PURE__ */ Z(nt, { className: "h-5 w-5 mx-auto text-muted-foreground mb-1" }),
|
|
3290
3433
|
/* @__PURE__ */ Z("p", {
|
|
3291
3434
|
className: "text-xs text-muted-foreground",
|
|
3292
3435
|
children: o("detail.dropFilesToUpload")
|
|
@@ -3307,7 +3450,7 @@ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3307
3450
|
}), /* @__PURE__ */ Z("div", {
|
|
3308
3451
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
|
|
3309
3452
|
children: e.map((e) => {
|
|
3310
|
-
let t =
|
|
3453
|
+
let t = Qn(e.type), r = $n(e.type);
|
|
3311
3454
|
return /* @__PURE__ */ Q("div", {
|
|
3312
3455
|
className: "flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group",
|
|
3313
3456
|
children: [
|
|
@@ -3326,7 +3469,7 @@ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3326
3469
|
children: e.name
|
|
3327
3470
|
}), /* @__PURE__ */ Z("p", {
|
|
3328
3471
|
className: "text-[10px] text-muted-foreground",
|
|
3329
|
-
children:
|
|
3472
|
+
children: Zn(e.size)
|
|
3330
3473
|
})]
|
|
3331
3474
|
}),
|
|
3332
3475
|
n && !a && /* @__PURE__ */ Z(x, {
|
|
@@ -3335,7 +3478,7 @@ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3335
3478
|
className: "h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
3336
3479
|
onClick: () => n(e.id),
|
|
3337
3480
|
title: o("detail.removeAttachment"),
|
|
3338
|
-
children: /* @__PURE__ */ Z(
|
|
3481
|
+
children: /* @__PURE__ */ Z(rt, { className: "h-3.5 w-3.5" })
|
|
3339
3482
|
})
|
|
3340
3483
|
]
|
|
3341
3484
|
}, e.id);
|
|
@@ -3343,15 +3486,15 @@ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3343
3486
|
})]
|
|
3344
3487
|
})]
|
|
3345
3488
|
});
|
|
3346
|
-
},
|
|
3347
|
-
comment:
|
|
3348
|
-
field_change:
|
|
3349
|
-
task:
|
|
3350
|
-
event:
|
|
3351
|
-
system:
|
|
3352
|
-
email:
|
|
3353
|
-
call:
|
|
3354
|
-
},
|
|
3489
|
+
}, tr = {
|
|
3490
|
+
comment: ze,
|
|
3491
|
+
field_change: Te,
|
|
3492
|
+
task: ge,
|
|
3493
|
+
event: me,
|
|
3494
|
+
system: it,
|
|
3495
|
+
email: Re,
|
|
3496
|
+
call: Ge
|
|
3497
|
+
}, nr = {
|
|
3355
3498
|
comment: "bg-purple-100 text-purple-600",
|
|
3356
3499
|
field_change: "bg-blue-100 text-blue-600",
|
|
3357
3500
|
task: "bg-green-100 text-green-600",
|
|
@@ -3360,7 +3503,7 @@ var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3360
3503
|
email: "bg-indigo-100 text-indigo-600",
|
|
3361
3504
|
call: "bg-teal-100 text-teal-600"
|
|
3362
3505
|
};
|
|
3363
|
-
function
|
|
3506
|
+
function rr(e) {
|
|
3364
3507
|
return [
|
|
3365
3508
|
{
|
|
3366
3509
|
value: "all",
|
|
@@ -3380,7 +3523,7 @@ function Xn(e) {
|
|
|
3380
3523
|
}
|
|
3381
3524
|
];
|
|
3382
3525
|
}
|
|
3383
|
-
function
|
|
3526
|
+
function ir(e, t) {
|
|
3384
3527
|
try {
|
|
3385
3528
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
3386
3529
|
if (i < 1) return t("detail.justNow");
|
|
@@ -3393,7 +3536,7 @@ function Zn(e, t) {
|
|
|
3393
3536
|
return e;
|
|
3394
3537
|
}
|
|
3395
3538
|
}
|
|
3396
|
-
function
|
|
3539
|
+
function ar(e, t) {
|
|
3397
3540
|
switch (t) {
|
|
3398
3541
|
case "comments_only": return e.filter((e) => e.type === "comment");
|
|
3399
3542
|
case "changes_only": return e.filter((e) => e.type === "field_change");
|
|
@@ -3401,8 +3544,8 @@ function Qn(e, t) {
|
|
|
3401
3544
|
default: return e;
|
|
3402
3545
|
}
|
|
3403
3546
|
}
|
|
3404
|
-
var
|
|
3405
|
-
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([]), [
|
|
3547
|
+
var or = ({ 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 }) => {
|
|
3548
|
+
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([]), [te, ne] = i.useState(!1), re = n ?? b, ie = t?.showFilterToggle !== !1, I = t?.showCommentInput !== !1 && !!c, L = t?.enableReactions ?? !1, R = t?.enableThreading ?? !1, z = t?.showSubscriptionToggle ?? !1, B = i.useMemo(() => ar(e, re), [e, re]), V = i.useMemo(() => R ? B.filter((e) => !e.parentId) : B, [B, R]), H = i.useMemo(() => {
|
|
3406
3549
|
if (!R) return /* @__PURE__ */ new Map();
|
|
3407
3550
|
let e = /* @__PURE__ */ new Map();
|
|
3408
3551
|
for (let t of B) if (t.parentId) {
|
|
@@ -3428,17 +3571,17 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3428
3571
|
c
|
|
3429
3572
|
]), W = i.useCallback(async (e) => {
|
|
3430
3573
|
if (!(!h || e.length === 0)) {
|
|
3431
|
-
|
|
3574
|
+
ne(!0);
|
|
3432
3575
|
try {
|
|
3433
3576
|
let t = await h(e);
|
|
3434
3577
|
Array.isArray(t) && t.length > 0 && j((e) => [...e, ...t]);
|
|
3435
3578
|
} finally {
|
|
3436
|
-
|
|
3579
|
+
ne(!1);
|
|
3437
3580
|
}
|
|
3438
3581
|
}
|
|
3439
3582
|
}, [h]), oe = i.useCallback((e) => {
|
|
3440
3583
|
j((t) => t.filter((t) => t.id !== e));
|
|
3441
|
-
}, []),
|
|
3584
|
+
}, []), K = i.useCallback(async () => {
|
|
3442
3585
|
if (o) {
|
|
3443
3586
|
O(!0);
|
|
3444
3587
|
try {
|
|
@@ -3458,7 +3601,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3458
3601
|
children: [/* @__PURE__ */ Q("h2", {
|
|
3459
3602
|
className: "flex items-center gap-2 text-base font-semibold leading-none tracking-tight",
|
|
3460
3603
|
children: [
|
|
3461
|
-
/* @__PURE__ */ Z(
|
|
3604
|
+
/* @__PURE__ */ Z(se, { className: "h-4 w-4" }),
|
|
3462
3605
|
g ?? y("detail.activity"),
|
|
3463
3606
|
/* @__PURE__ */ Q("span", {
|
|
3464
3607
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -3471,7 +3614,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3471
3614
|
]
|
|
3472
3615
|
}), /* @__PURE__ */ Z("div", {
|
|
3473
3616
|
className: "flex items-center gap-1",
|
|
3474
|
-
children: z && d && /* @__PURE__ */ Z(
|
|
3617
|
+
children: z && d && /* @__PURE__ */ Z(Jn, {
|
|
3475
3618
|
subscription: d,
|
|
3476
3619
|
onToggle: f
|
|
3477
3620
|
})
|
|
@@ -3480,22 +3623,22 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3480
3623
|
}), /* @__PURE__ */ Q("div", {
|
|
3481
3624
|
className: "space-y-4",
|
|
3482
3625
|
children: [
|
|
3483
|
-
|
|
3626
|
+
ie && /* @__PURE__ */ Z("div", {
|
|
3484
3627
|
className: "flex items-center gap-2",
|
|
3485
3628
|
children: /* @__PURE__ */ Q(M, {
|
|
3486
|
-
value:
|
|
3629
|
+
value: re,
|
|
3487
3630
|
onValueChange: (e) => ae(e),
|
|
3488
|
-
children: [/* @__PURE__ */ Z(
|
|
3631
|
+
children: [/* @__PURE__ */ Z(F, {
|
|
3489
3632
|
"aria-label": y("detail.filterActivity"),
|
|
3490
3633
|
className: "h-8 w-auto min-w-[140px] py-1 text-sm",
|
|
3491
|
-
children: /* @__PURE__ */ Z(
|
|
3492
|
-
}), /* @__PURE__ */ Z(N, { children:
|
|
3634
|
+
children: /* @__PURE__ */ Z(ee, {})
|
|
3635
|
+
}), /* @__PURE__ */ Z(N, { children: rr(y).map((e) => /* @__PURE__ */ Z(P, {
|
|
3493
3636
|
value: e.value,
|
|
3494
3637
|
children: e.label
|
|
3495
3638
|
}, e.value)) })]
|
|
3496
3639
|
})
|
|
3497
3640
|
}),
|
|
3498
|
-
I && /* @__PURE__ */ Z(
|
|
3641
|
+
I && /* @__PURE__ */ Z(Xn, {
|
|
3499
3642
|
value: C,
|
|
3500
3643
|
onChange: w,
|
|
3501
3644
|
onSubmit: U,
|
|
@@ -3503,12 +3646,12 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3503
3646
|
placeholder: y("detail.leaveCommentPlaceholder"),
|
|
3504
3647
|
disabled: T,
|
|
3505
3648
|
canSubmitEmpty: A.length > 0,
|
|
3506
|
-
extraSlot: h ? /* @__PURE__ */ Z(
|
|
3649
|
+
extraSlot: h ? /* @__PURE__ */ Z(er, {
|
|
3507
3650
|
attachments: A,
|
|
3508
3651
|
onUpload: W,
|
|
3509
3652
|
onRemove: oe,
|
|
3510
|
-
readOnly: T ||
|
|
3511
|
-
}) : A.length > 0 ? /* @__PURE__ */ Z(
|
|
3653
|
+
readOnly: T || te
|
|
3654
|
+
}) : A.length > 0 ? /* @__PURE__ */ Z(er, {
|
|
3512
3655
|
attachments: A,
|
|
3513
3656
|
onRemove: oe,
|
|
3514
3657
|
readOnly: T
|
|
@@ -3522,7 +3665,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3522
3665
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
3523
3666
|
className: "space-y-4",
|
|
3524
3667
|
children: V.map((e) => {
|
|
3525
|
-
let t =
|
|
3668
|
+
let t = tr[e.type] || it, n = nr[e.type] || "bg-gray-100 text-gray-600", r = H.get(e.id) ?? [];
|
|
3526
3669
|
return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
|
|
3527
3670
|
className: "flex gap-3 relative",
|
|
3528
3671
|
children: [/* @__PURE__ */ Z("div", {
|
|
@@ -3548,7 +3691,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3548
3691
|
}),
|
|
3549
3692
|
/* @__PURE__ */ Z("span", {
|
|
3550
3693
|
className: "text-xs text-muted-foreground",
|
|
3551
|
-
children:
|
|
3694
|
+
children: ir(e.createdAt, y)
|
|
3552
3695
|
}),
|
|
3553
3696
|
e.edited && /* @__PURE__ */ Z("span", {
|
|
3554
3697
|
className: "text-xs text-muted-foreground italic",
|
|
@@ -3575,25 +3718,25 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3575
3718
|
}),
|
|
3576
3719
|
e.type === "field_change" && e.fieldChanges && /* @__PURE__ */ Z("div", {
|
|
3577
3720
|
className: "space-y-1 mt-1",
|
|
3578
|
-
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(
|
|
3721
|
+
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(Un, { change: e }, t))
|
|
3579
3722
|
}),
|
|
3580
3723
|
L && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
|
|
3581
3724
|
className: "mt-1.5",
|
|
3582
|
-
children: /* @__PURE__ */ Z(
|
|
3725
|
+
children: /* @__PURE__ */ Z(Gn, {
|
|
3583
3726
|
reactions: e.reactions,
|
|
3584
3727
|
onToggleReaction: u ? (t) => u(e.id, t) : void 0
|
|
3585
3728
|
})
|
|
3586
3729
|
}),
|
|
3587
3730
|
L && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
|
|
3588
3731
|
className: "mt-1.5",
|
|
3589
|
-
children: /* @__PURE__ */ Z(
|
|
3732
|
+
children: /* @__PURE__ */ Z(Gn, {
|
|
3590
3733
|
reactions: [],
|
|
3591
3734
|
onToggleReaction: (t) => u(e.id, t)
|
|
3592
3735
|
})
|
|
3593
3736
|
})
|
|
3594
3737
|
]
|
|
3595
3738
|
})]
|
|
3596
|
-
}), R && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(
|
|
3739
|
+
}), R && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(qn, {
|
|
3597
3740
|
parentItem: e,
|
|
3598
3741
|
replies: r,
|
|
3599
3742
|
onAddReply: l,
|
|
@@ -3607,16 +3750,16 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3607
3750
|
children: /* @__PURE__ */ Q(x, {
|
|
3608
3751
|
variant: "ghost",
|
|
3609
3752
|
size: "sm",
|
|
3610
|
-
onClick:
|
|
3753
|
+
onClick: K,
|
|
3611
3754
|
disabled: D,
|
|
3612
3755
|
"aria-label": y("detail.loadMore"),
|
|
3613
|
-
children: [D ? /* @__PURE__ */ Z(
|
|
3756
|
+
children: [D ? /* @__PURE__ */ Z(Ie, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(_e, { className: "h-4 w-4 mr-1" }), y("detail.loadMore")]
|
|
3614
3757
|
})
|
|
3615
3758
|
})
|
|
3616
3759
|
]
|
|
3617
3760
|
})]
|
|
3618
3761
|
});
|
|
3619
|
-
},
|
|
3762
|
+
}, sr = (e) => {
|
|
3620
3763
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3621
3764
|
return {
|
|
3622
3765
|
designer: {
|
|
@@ -3626,18 +3769,18 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3626
3769
|
},
|
|
3627
3770
|
rest: i
|
|
3628
3771
|
};
|
|
3629
|
-
},
|
|
3630
|
-
|
|
3631
|
-
let { designer: r } =
|
|
3772
|
+
}, cr = ({ schema: e = {}, className: t, ...n }) => {
|
|
3773
|
+
ht();
|
|
3774
|
+
let { designer: r } = sr(n);
|
|
3632
3775
|
return /* @__PURE__ */ Z("div", {
|
|
3633
3776
|
className: t,
|
|
3634
3777
|
...r,
|
|
3635
|
-
children: /* @__PURE__ */ Z(
|
|
3778
|
+
children: /* @__PURE__ */ Z(or, {
|
|
3636
3779
|
items: [],
|
|
3637
3780
|
config: e
|
|
3638
3781
|
})
|
|
3639
3782
|
});
|
|
3640
|
-
},
|
|
3783
|
+
}, lr = ({ 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 }) => {
|
|
3641
3784
|
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);
|
|
3642
3785
|
return _ === "right" || _ === "left" ? C && y ? /* @__PURE__ */ Z("div", {
|
|
3643
3786
|
className: G("flex items-start pt-4", _ === "right" ? "border-l" : "border-r", g),
|
|
@@ -3659,7 +3802,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3659
3802
|
className: "flex items-center justify-between px-4 py-3 border-b",
|
|
3660
3803
|
children: [/* @__PURE__ */ Q("div", {
|
|
3661
3804
|
className: "flex items-center gap-2",
|
|
3662
|
-
children: [/* @__PURE__ */ Z(
|
|
3805
|
+
children: [/* @__PURE__ */ Z(ze, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
3663
3806
|
className: "text-sm font-medium",
|
|
3664
3807
|
children: S("detail.discussion")
|
|
3665
3808
|
})]
|
|
@@ -3669,11 +3812,11 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3669
3812
|
className: "h-7 w-7",
|
|
3670
3813
|
onClick: () => w(!0),
|
|
3671
3814
|
"aria-label": S("detail.closeDiscussion"),
|
|
3672
|
-
children: /* @__PURE__ */ Z(
|
|
3815
|
+
children: /* @__PURE__ */ Z(rt, { className: "h-3.5 w-3.5" })
|
|
3673
3816
|
})]
|
|
3674
3817
|
}), /* @__PURE__ */ Z("div", {
|
|
3675
3818
|
className: "flex-1 overflow-y-auto",
|
|
3676
|
-
children: /* @__PURE__ */ Z(
|
|
3819
|
+
children: /* @__PURE__ */ Z(or, {
|
|
3677
3820
|
items: t,
|
|
3678
3821
|
config: e?.feed,
|
|
3679
3822
|
hasMore: n,
|
|
@@ -3701,12 +3844,12 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3701
3844
|
className: "w-full justify-start gap-2 text-muted-foreground",
|
|
3702
3845
|
onClick: () => w(!1),
|
|
3703
3846
|
"aria-label": S("detail.showDiscussion", { count: t.length }),
|
|
3704
|
-
children: [/* @__PURE__ */ Z(
|
|
3847
|
+
children: [/* @__PURE__ */ Z(ze, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: S("detail.showDiscussion", { count: t.length }) })]
|
|
3705
3848
|
}) : /* @__PURE__ */ Q("div", { children: [y && /* @__PURE__ */ Q("div", {
|
|
3706
3849
|
className: "flex items-center justify-between mb-2",
|
|
3707
3850
|
children: [/* @__PURE__ */ Q("div", {
|
|
3708
3851
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
3709
|
-
children: [/* @__PURE__ */ Z(
|
|
3852
|
+
children: [/* @__PURE__ */ Z(ze, { className: "h-4 w-4" }), S("detail.discussion")]
|
|
3710
3853
|
}), /* @__PURE__ */ Z(x, {
|
|
3711
3854
|
variant: "ghost",
|
|
3712
3855
|
size: "icon",
|
|
@@ -3715,7 +3858,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3715
3858
|
"aria-label": S("detail.hideDiscussion"),
|
|
3716
3859
|
children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
|
|
3717
3860
|
})]
|
|
3718
|
-
}), /* @__PURE__ */ Z(
|
|
3861
|
+
}), /* @__PURE__ */ Z(or, {
|
|
3719
3862
|
items: t,
|
|
3720
3863
|
config: e?.feed,
|
|
3721
3864
|
hasMore: n,
|
|
@@ -3735,7 +3878,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3735
3878
|
emptyLabel: S("detail.noCommentsYet")
|
|
3736
3879
|
})] })
|
|
3737
3880
|
});
|
|
3738
|
-
},
|
|
3881
|
+
}, ur = (e) => {
|
|
3739
3882
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3740
3883
|
return {
|
|
3741
3884
|
designer: {
|
|
@@ -3745,9 +3888,9 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3745
3888
|
},
|
|
3746
3889
|
rest: i
|
|
3747
3890
|
};
|
|
3748
|
-
},
|
|
3749
|
-
|
|
3750
|
-
let r =
|
|
3891
|
+
}, dr = ({ schema: e = {}, className: t, ...n }) => {
|
|
3892
|
+
ht();
|
|
3893
|
+
let r = dt(), { designer: i } = ur(n), a = {
|
|
3751
3894
|
position: "bottom",
|
|
3752
3895
|
collapsible: !1,
|
|
3753
3896
|
feed: {
|
|
@@ -3760,7 +3903,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3760
3903
|
return /* @__PURE__ */ Z("div", {
|
|
3761
3904
|
className: t,
|
|
3762
3905
|
...i,
|
|
3763
|
-
children: /* @__PURE__ */ Z(
|
|
3906
|
+
children: /* @__PURE__ */ Z(lr, {
|
|
3764
3907
|
items: r?.items || [],
|
|
3765
3908
|
config: a,
|
|
3766
3909
|
onAddComment: r?.onAddComment,
|
|
@@ -3770,7 +3913,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3770
3913
|
onUploadAttachments: r?.onUploadAttachments
|
|
3771
3914
|
})
|
|
3772
3915
|
});
|
|
3773
|
-
},
|
|
3916
|
+
}, fr = (e) => {
|
|
3774
3917
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3775
3918
|
return {
|
|
3776
3919
|
designer: {
|
|
@@ -3780,8 +3923,8 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3780
3923
|
},
|
|
3781
3924
|
rest: i
|
|
3782
3925
|
};
|
|
3783
|
-
},
|
|
3784
|
-
let r =
|
|
3926
|
+
}, pr = ({ schema: e = {}, className: t, ...n }) => {
|
|
3927
|
+
let r = ht(), { translateOptions: i } = vt(), { designer: o } = fr(n), s = Array.isArray(e.stages) ? e.stages : [], c = e.statusField, l = a.useMemo(() => {
|
|
3785
3928
|
if (s.length === 0 || !c || !r?.objectName) return s;
|
|
3786
3929
|
let e = i(r.objectName, c, s);
|
|
3787
3930
|
return Array.isArray(e) && e.length === s.length ? s.map((t, n) => ({
|
|
@@ -3893,7 +4036,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3893
4036
|
})
|
|
3894
4037
|
})]
|
|
3895
4038
|
});
|
|
3896
|
-
},
|
|
4039
|
+
}, mr = (e) => {
|
|
3897
4040
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3898
4041
|
return {
|
|
3899
4042
|
designer: {
|
|
@@ -3903,8 +4046,8 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3903
4046
|
},
|
|
3904
4047
|
rest: i
|
|
3905
4048
|
};
|
|
3906
|
-
},
|
|
3907
|
-
let r =
|
|
4049
|
+
}, hr = ({ schema: e = {}, className: t, ...n }) => {
|
|
4050
|
+
let r = ht(), { designer: i } = mr(n), a = Pt(), 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 } = pt("object", u ? c : null), f = u ? (() => {
|
|
3908
4051
|
let e = Array.isArray(d?.actions) ? d.actions : [], t = new Map(e.map((e) => [e.name, e]));
|
|
3909
4052
|
return l.map((e) => t.get(e)).filter((e) => !!e);
|
|
3910
4053
|
})() : Array.isArray(o) ? o : [], p = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
@@ -3918,7 +4061,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3918
4061
|
children: "Insufficient permissions to view quick actions."
|
|
3919
4062
|
})
|
|
3920
4063
|
});
|
|
3921
|
-
let m = e.location || "record_header", { getActionsForLocation: h, executeAction: g } =
|
|
4064
|
+
let m = e.location || "record_header", { getActionsForLocation: h, executeAction: g } = ct({
|
|
3922
4065
|
actions: f,
|
|
3923
4066
|
context: {
|
|
3924
4067
|
record: r?.data,
|
|
@@ -3940,7 +4083,7 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3940
4083
|
role: "toolbar",
|
|
3941
4084
|
"aria-label": e.aria?.label || "Quick actions",
|
|
3942
4085
|
...i,
|
|
3943
|
-
children: _.map((t, n) => /* @__PURE__ */ Z(
|
|
4086
|
+
children: _.map((t, n) => /* @__PURE__ */ Z(gr, {
|
|
3944
4087
|
action: t,
|
|
3945
4088
|
record: r?.data,
|
|
3946
4089
|
variant: t.variant || e.variant || "default",
|
|
@@ -3952,8 +4095,8 @@ var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3952
4095
|
}, t.name || `qa-${n}`))
|
|
3953
4096
|
});
|
|
3954
4097
|
};
|
|
3955
|
-
function
|
|
3956
|
-
let [s, c] = a.useState(!1), l = a.useMemo(() => ({ record: t || {} }), [t]), u =
|
|
4098
|
+
function gr({ action: e, record: t, variant: n, size: r, label: i, onRun: o }) {
|
|
4099
|
+
let [s, c] = a.useState(!1), l = a.useMemo(() => ({ record: t || {} }), [t]), u = st(e.disabled), d = lt(typeof u == "string" ? u : void 0, l);
|
|
3957
4100
|
return /* @__PURE__ */ Q(x, {
|
|
3958
4101
|
variant: n,
|
|
3959
4102
|
size: r,
|
|
@@ -3966,12 +4109,12 @@ function lr({ action: e, record: t, variant: n, size: r, label: i, onRun: o }) {
|
|
|
3966
4109
|
c(!1);
|
|
3967
4110
|
}
|
|
3968
4111
|
},
|
|
3969
|
-
children: [s && /* @__PURE__ */ Z(
|
|
4112
|
+
children: [s && /* @__PURE__ */ Z(Ie, { className: "mr-2 h-4 w-4 animate-spin" }), i]
|
|
3970
4113
|
});
|
|
3971
4114
|
}
|
|
3972
4115
|
//#endregion
|
|
3973
4116
|
//#region src/renderers/record-history.tsx
|
|
3974
|
-
var
|
|
4117
|
+
var _r = (e) => {
|
|
3975
4118
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3976
4119
|
return {
|
|
3977
4120
|
designer: {
|
|
@@ -3981,14 +4124,14 @@ var ur = (e) => {
|
|
|
3981
4124
|
},
|
|
3982
4125
|
rest: i
|
|
3983
4126
|
};
|
|
3984
|
-
},
|
|
4127
|
+
}, vr = /* @__PURE__ */ new Set([
|
|
3985
4128
|
"created",
|
|
3986
4129
|
"updated",
|
|
3987
4130
|
"assigned",
|
|
3988
4131
|
"shared",
|
|
3989
4132
|
"deleted"
|
|
3990
|
-
]),
|
|
3991
|
-
let { designer: r } =
|
|
4133
|
+
]), yr = ({ schema: e = {}, className: t, ...n }) => {
|
|
4134
|
+
let { designer: r } = _r(n), i = ht(), 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);
|
|
3992
4135
|
a.useEffect(() => {
|
|
3993
4136
|
if (!p) return;
|
|
3994
4137
|
let e = !1;
|
|
@@ -4000,7 +4143,8 @@ var ur = (e) => {
|
|
|
4000
4143
|
$orderby: { timestamp: "desc" },
|
|
4001
4144
|
$top: Math.max(1, l)
|
|
4002
4145
|
})).then((t) => {
|
|
4003
|
-
|
|
4146
|
+
if (e) return;
|
|
4147
|
+
let n = (t?.data ?? t?.records ?? []).filter((e) => vr.has(e?.type)).map((e) => {
|
|
4004
4148
|
let t = e.timestamp;
|
|
4005
4149
|
return (!t || t === "NOW()" || Number.isNaN(Date.parse(t))) && (t = e.created_at), {
|
|
4006
4150
|
id: e.id,
|
|
@@ -4010,7 +4154,8 @@ var ur = (e) => {
|
|
|
4010
4154
|
user_avatar: e.actor_avatar_url ?? null,
|
|
4011
4155
|
summary: e.summary ?? null
|
|
4012
4156
|
};
|
|
4013
|
-
})
|
|
4157
|
+
});
|
|
4158
|
+
h(n);
|
|
4014
4159
|
}).catch(() => {
|
|
4015
4160
|
e || h([]);
|
|
4016
4161
|
}).finally(() => {
|
|
@@ -4029,13 +4174,13 @@ var ur = (e) => {
|
|
|
4029
4174
|
return /* @__PURE__ */ Z("div", {
|
|
4030
4175
|
className: t,
|
|
4031
4176
|
...r,
|
|
4032
|
-
children: /* @__PURE__ */ Z(
|
|
4177
|
+
children: /* @__PURE__ */ Z(yn, {
|
|
4033
4178
|
entries: v,
|
|
4034
4179
|
loading: y,
|
|
4035
4180
|
emptyText: c
|
|
4036
4181
|
})
|
|
4037
4182
|
});
|
|
4038
|
-
},
|
|
4183
|
+
}, br = (e) => {
|
|
4039
4184
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
4040
4185
|
return {
|
|
4041
4186
|
designer: {
|
|
@@ -4045,8 +4190,8 @@ var ur = (e) => {
|
|
|
4045
4190
|
},
|
|
4046
4191
|
rest: i
|
|
4047
4192
|
};
|
|
4048
|
-
},
|
|
4049
|
-
let r =
|
|
4193
|
+
}, xr = (e) => e.replace(/[_-]+/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()).trim(), Sr = (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 || "—", Cr = ({ schema: e = {}, className: t, ...n }) => {
|
|
4194
|
+
let r = ht(), i = vt(), { t: o } = $(), { designer: s } = br(n), c = jt().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);
|
|
4050
4195
|
a.useEffect(() => (_.current = !0, () => {
|
|
4051
4196
|
_.current = !1;
|
|
4052
4197
|
}), []);
|
|
@@ -4126,8 +4271,8 @@ var ur = (e) => {
|
|
|
4126
4271
|
return x && t && !t.loading && !t.error && t.total === 0;
|
|
4127
4272
|
}).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({
|
|
4128
4273
|
name: e.objectName,
|
|
4129
|
-
label:
|
|
4130
|
-
}) :
|
|
4274
|
+
label: xr(e.objectName)
|
|
4275
|
+
}) : xr(e.objectName)));
|
|
4131
4276
|
return /* @__PURE__ */ Q("div", {
|
|
4132
4277
|
ref: m,
|
|
4133
4278
|
className: G("flex flex-col gap-3", e.className, t),
|
|
@@ -4146,15 +4291,15 @@ var ur = (e) => {
|
|
|
4146
4291
|
className: "text-sm font-semibold tracking-tight truncate",
|
|
4147
4292
|
children: e.title || (i?.objectLabel ? i.objectLabel({
|
|
4148
4293
|
name: e.objectName,
|
|
4149
|
-
label:
|
|
4150
|
-
}) :
|
|
4294
|
+
label: xr(e.objectName)
|
|
4295
|
+
}) : xr(e.objectName))
|
|
4151
4296
|
}), /* @__PURE__ */ Q("div", {
|
|
4152
4297
|
className: "flex items-center gap-2 shrink-0",
|
|
4153
4298
|
children: [!n.loading && /* @__PURE__ */ Z(b, {
|
|
4154
4299
|
variant: "secondary",
|
|
4155
4300
|
className: "tabular-nums",
|
|
4156
4301
|
children: n.total
|
|
4157
|
-
}), c && u && /* @__PURE__ */ Z(
|
|
4302
|
+
}), c && u && /* @__PURE__ */ Z(At, {
|
|
4158
4303
|
to: `/apps/${c}/${e.objectName}?filter%5B${e.relationshipField}%5D=${encodeURIComponent(String(u))}`,
|
|
4159
4304
|
className: "text-[11px] font-medium text-muted-foreground hover:text-foreground transition-colors",
|
|
4160
4305
|
title: o("detail.viewAll", { defaultValue: "View all" }),
|
|
@@ -4176,16 +4321,16 @@ var ur = (e) => {
|
|
|
4176
4321
|
}) : /* @__PURE__ */ Z("ul", {
|
|
4177
4322
|
className: "divide-y",
|
|
4178
4323
|
children: n.items.map((t) => {
|
|
4179
|
-
let n = t.id || t._id, r =
|
|
4324
|
+
let n = t.id || t._id, r = Sr(t, e.displayField), i = n ? `../${e.objectName}/record/${encodeURIComponent(String(n))}` : void 0;
|
|
4180
4325
|
return /* @__PURE__ */ Z("li", {
|
|
4181
4326
|
className: "px-4 py-2",
|
|
4182
|
-
children: i ? /* @__PURE__ */ Q(
|
|
4327
|
+
children: i ? /* @__PURE__ */ Q(At, {
|
|
4183
4328
|
to: i,
|
|
4184
4329
|
className: "group flex items-center justify-between gap-2 text-xs hover:text-foreground text-muted-foreground transition-colors",
|
|
4185
4330
|
children: [/* @__PURE__ */ Z("span", {
|
|
4186
4331
|
className: "truncate",
|
|
4187
4332
|
children: r
|
|
4188
|
-
}), /* @__PURE__ */ Z(
|
|
4333
|
+
}), /* @__PURE__ */ Z(ye, { className: "h-3 w-3 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity" })]
|
|
4189
4334
|
}) : /* @__PURE__ */ Z("span", {
|
|
4190
4335
|
className: "block truncate text-xs text-muted-foreground",
|
|
4191
4336
|
children: r
|
|
@@ -4213,7 +4358,7 @@ var ur = (e) => {
|
|
|
4213
4358
|
})]
|
|
4214
4359
|
})]
|
|
4215
4360
|
});
|
|
4216
|
-
},
|
|
4361
|
+
}, wr = {
|
|
4217
4362
|
info: {
|
|
4218
4363
|
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",
|
|
4219
4364
|
icon: "Info"
|
|
@@ -4231,20 +4376,20 @@ var ur = (e) => {
|
|
|
4231
4376
|
icon: "CheckCircle2"
|
|
4232
4377
|
}
|
|
4233
4378
|
};
|
|
4234
|
-
function
|
|
4379
|
+
function Tr(e) {
|
|
4235
4380
|
let t = e?.properties ?? {};
|
|
4236
4381
|
return {
|
|
4237
4382
|
...e,
|
|
4238
4383
|
...t
|
|
4239
4384
|
};
|
|
4240
4385
|
}
|
|
4241
|
-
var
|
|
4242
|
-
let n =
|
|
4386
|
+
var Er = ({ schema: e = {}, className: t }) => {
|
|
4387
|
+
let n = Tr(e), r = ht(), a = r?.data, c = r?.objectName || "", l = r?.recordId ?? a?.id, u = [
|
|
4243
4388
|
"info",
|
|
4244
4389
|
"warning",
|
|
4245
4390
|
"error",
|
|
4246
4391
|
"success"
|
|
4247
|
-
].includes(n.severity) ? n.severity : "info", d =
|
|
4392
|
+
].includes(n.severity) ? n.severity : "info", d = wr[u], f = n.icon || d.icon, p = st(n.visible), m = lt(p, { record: a }), h = i.useMemo(() => {
|
|
4248
4393
|
if (!n.dismissible) return null;
|
|
4249
4394
|
let e = n.dismissKey || n.title || u;
|
|
4250
4395
|
return `os.record-alert:${c}:${l ?? "_"}:${e}`;
|
|
@@ -4262,9 +4407,9 @@ var yr = ({ schema: e = {}, className: t }) => {
|
|
|
4262
4407
|
} catch {
|
|
4263
4408
|
return !1;
|
|
4264
4409
|
}
|
|
4265
|
-
}), y = n.action?.actionName, { item: b } =
|
|
4410
|
+
}), y = n.action?.actionName, { item: b } = pt("object", y && c ? c : null), S = i.useMemo(() => {
|
|
4266
4411
|
if (!(!y || !b?.actions)) return b.actions.find((e) => e.name === y);
|
|
4267
|
-
}, [y, b]), { executeAction: C } =
|
|
4412
|
+
}, [y, b]), { executeAction: C } = ct({
|
|
4268
4413
|
actions: i.useMemo(() => S ? [S] : [], [S]),
|
|
4269
4414
|
context: {
|
|
4270
4415
|
record: a,
|
|
@@ -4311,7 +4456,7 @@ var yr = ({ schema: e = {}, className: t }) => {
|
|
|
4311
4456
|
}) : null
|
|
4312
4457
|
]
|
|
4313
4458
|
});
|
|
4314
|
-
},
|
|
4459
|
+
}, Dr = /* @__PURE__ */ new Set([
|
|
4315
4460
|
"id",
|
|
4316
4461
|
"_id",
|
|
4317
4462
|
"__v",
|
|
@@ -4326,15 +4471,15 @@ var yr = ({ schema: e = {}, className: t }) => {
|
|
|
4326
4471
|
"owner_id",
|
|
4327
4472
|
"deleted_at",
|
|
4328
4473
|
"is_deleted"
|
|
4329
|
-
]),
|
|
4330
|
-
function
|
|
4474
|
+
]), Or = 480, kr = 95;
|
|
4475
|
+
function Ar({ 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 = Dr, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
|
|
4331
4476
|
let { t: g } = $(), _ = `objectui.drawerWidth.${i}`, [v, y] = a.useState(() => {
|
|
4332
4477
|
if (typeof window > "u" || !m) return null;
|
|
4333
4478
|
try {
|
|
4334
4479
|
let e = window.localStorage.getItem(_);
|
|
4335
4480
|
if (e) {
|
|
4336
4481
|
let t = parseInt(e, 10);
|
|
4337
|
-
if (Number.isFinite(t) && t >=
|
|
4482
|
+
if (Number.isFinite(t) && t >= Or) return t;
|
|
4338
4483
|
}
|
|
4339
4484
|
} catch {}
|
|
4340
4485
|
return null;
|
|
@@ -4356,7 +4501,7 @@ function Cr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4356
4501
|
let n = (e) => {
|
|
4357
4502
|
let t = S.current;
|
|
4358
4503
|
if (!t) return;
|
|
4359
|
-
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth *
|
|
4504
|
+
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * kr / 100 : 1600, i = Math.min(r, Math.max(Or, t.startWidth + n));
|
|
4360
4505
|
y(Math.round(i));
|
|
4361
4506
|
}, r = () => {
|
|
4362
4507
|
S.current, S.current = null, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r);
|
|
@@ -4389,12 +4534,12 @@ function Cr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4389
4534
|
description: t.description
|
|
4390
4535
|
};
|
|
4391
4536
|
});
|
|
4392
|
-
return /* @__PURE__ */ Z(
|
|
4537
|
+
return /* @__PURE__ */ Z(te, {
|
|
4393
4538
|
open: e,
|
|
4394
4539
|
onOpenChange: (e) => {
|
|
4395
4540
|
e || t();
|
|
4396
4541
|
},
|
|
4397
|
-
children: /* @__PURE__ */ Q(
|
|
4542
|
+
children: /* @__PURE__ */ Q(ne, {
|
|
4398
4543
|
side: "right",
|
|
4399
4544
|
className: "w-full overflow-y-auto p-0 sm:!max-w-none",
|
|
4400
4545
|
style: x,
|
|
@@ -4407,13 +4552,13 @@ function Cr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4407
4552
|
onPointerDown: C,
|
|
4408
4553
|
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"
|
|
4409
4554
|
}),
|
|
4410
|
-
/* @__PURE__ */ Z(
|
|
4555
|
+
/* @__PURE__ */ Z(re, {
|
|
4411
4556
|
className: "sr-only",
|
|
4412
|
-
children: /* @__PURE__ */ Z(
|
|
4557
|
+
children: /* @__PURE__ */ Z(ie, { children: n })
|
|
4413
4558
|
}),
|
|
4414
4559
|
/* @__PURE__ */ Z("div", {
|
|
4415
4560
|
className: "px-6 pt-6 pb-6",
|
|
4416
|
-
children: /* @__PURE__ */ Z(
|
|
4561
|
+
children: /* @__PURE__ */ Z(kn, {
|
|
4417
4562
|
dataSource: s,
|
|
4418
4563
|
inlineEdit: !0,
|
|
4419
4564
|
schema: {
|
|
@@ -4456,14 +4601,14 @@ function Cr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4456
4601
|
})
|
|
4457
4602
|
});
|
|
4458
4603
|
}
|
|
4459
|
-
function
|
|
4604
|
+
function jr(e, t) {
|
|
4460
4605
|
if (typeof window > "u") return null;
|
|
4461
4606
|
let n = window.location.pathname, r = `/${e}`, i = n.indexOf(r);
|
|
4462
4607
|
return `${i >= 0 ? n.slice(0, i) : n.replace(/\/$/, "")}/${e}/record/${encodeURIComponent(String(t))}`;
|
|
4463
4608
|
}
|
|
4464
4609
|
//#endregion
|
|
4465
4610
|
//#region src/InlineCreateRelated.tsx
|
|
4466
|
-
var
|
|
4611
|
+
var Mr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
|
|
4467
4612
|
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(() => {
|
|
4468
4613
|
if (!h.trim()) return _;
|
|
4469
4614
|
let e = h.toLowerCase();
|
|
@@ -4472,7 +4617,8 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4472
4617
|
if (g(e), o && e.trim().length >= 2) {
|
|
4473
4618
|
D(!0);
|
|
4474
4619
|
try {
|
|
4475
|
-
|
|
4620
|
+
let t = await o(e);
|
|
4621
|
+
v(t);
|
|
4476
4622
|
} finally {
|
|
4477
4623
|
D(!1);
|
|
4478
4624
|
}
|
|
@@ -4507,7 +4653,7 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4507
4653
|
b(!1);
|
|
4508
4654
|
}
|
|
4509
4655
|
}
|
|
4510
|
-
}, [a]),
|
|
4656
|
+
}, [a]), P = i.useMemo(() => n.filter((e) => e.required).every((e) => p[e.name]?.toString().trim()), [n, p]);
|
|
4511
4657
|
return l ? /* @__PURE__ */ Q(S, {
|
|
4512
4658
|
className: G("", c),
|
|
4513
4659
|
children: [/* @__PURE__ */ Z(w, {
|
|
@@ -4523,7 +4669,7 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4523
4669
|
size: "icon",
|
|
4524
4670
|
className: "h-6 w-6",
|
|
4525
4671
|
onClick: () => u(!1),
|
|
4526
|
-
children: /* @__PURE__ */ Z(
|
|
4672
|
+
children: /* @__PURE__ */ Z(rt, { className: "h-3.5 w-3.5" })
|
|
4527
4673
|
})]
|
|
4528
4674
|
})
|
|
4529
4675
|
}), /* @__PURE__ */ Z(C, { children: /* @__PURE__ */ Q(L, {
|
|
@@ -4535,11 +4681,11 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4535
4681
|
children: [r && /* @__PURE__ */ Q(B, {
|
|
4536
4682
|
value: "create",
|
|
4537
4683
|
className: "flex-1 gap-1.5",
|
|
4538
|
-
children: [/* @__PURE__ */ Z(
|
|
4684
|
+
children: [/* @__PURE__ */ Z(qe, { className: "h-3.5 w-3.5" }), "Create New"]
|
|
4539
4685
|
}), a && /* @__PURE__ */ Q(B, {
|
|
4540
4686
|
value: "link",
|
|
4541
4687
|
className: "flex-1 gap-1.5",
|
|
4542
|
-
children: [/* @__PURE__ */ Z(
|
|
4688
|
+
children: [/* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
4543
4689
|
})]
|
|
4544
4690
|
}),
|
|
4545
4691
|
r && /* @__PURE__ */ Q(R, {
|
|
@@ -4567,9 +4713,9 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4567
4713
|
}), /* @__PURE__ */ Q(x, {
|
|
4568
4714
|
size: "sm",
|
|
4569
4715
|
onClick: M,
|
|
4570
|
-
disabled: !
|
|
4716
|
+
disabled: !P || y,
|
|
4571
4717
|
className: "gap-1.5",
|
|
4572
|
-
children: [y && /* @__PURE__ */ Z(
|
|
4718
|
+
children: [y && /* @__PURE__ */ Z(Ie, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
|
|
4573
4719
|
})]
|
|
4574
4720
|
})]
|
|
4575
4721
|
}),
|
|
@@ -4578,7 +4724,7 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4578
4724
|
className: "space-y-3 mt-0",
|
|
4579
4725
|
children: [/* @__PURE__ */ Q("div", {
|
|
4580
4726
|
className: "relative",
|
|
4581
|
-
children: [/* @__PURE__ */ Z(
|
|
4727
|
+
children: [/* @__PURE__ */ Z(Ze, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }), /* @__PURE__ */ Z(A, {
|
|
4582
4728
|
placeholder: `Search ${e}…`,
|
|
4583
4729
|
value: h,
|
|
4584
4730
|
onChange: (e) => k(e.target.value),
|
|
@@ -4588,7 +4734,7 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4588
4734
|
className: "max-h-48 overflow-y-auto space-y-1",
|
|
4589
4735
|
children: E ? /* @__PURE__ */ Q("div", {
|
|
4590
4736
|
className: "flex items-center justify-center py-4 text-sm text-muted-foreground",
|
|
4591
|
-
children: [/* @__PURE__ */ Z(
|
|
4737
|
+
children: [/* @__PURE__ */ Z(Ie, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
|
|
4592
4738
|
}) : O.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
4593
4739
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
4594
4740
|
children: h ? "No records found" : "Type to search records"
|
|
@@ -4619,7 +4765,7 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4619
4765
|
},
|
|
4620
4766
|
className: "gap-1.5",
|
|
4621
4767
|
children: [
|
|
4622
|
-
/* @__PURE__ */ Z(
|
|
4768
|
+
/* @__PURE__ */ Z(qe, { className: "h-3.5 w-3.5" }),
|
|
4623
4769
|
"New ",
|
|
4624
4770
|
e
|
|
4625
4771
|
]
|
|
@@ -4630,13 +4776,13 @@ var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4630
4776
|
f("link"), u(!0);
|
|
4631
4777
|
},
|
|
4632
4778
|
className: "gap-1.5",
|
|
4633
|
-
children: [/* @__PURE__ */ Z(
|
|
4779
|
+
children: [/* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
4634
4780
|
})]
|
|
4635
4781
|
});
|
|
4636
4782
|
};
|
|
4637
4783
|
//#endregion
|
|
4638
4784
|
//#region src/DiffView.tsx
|
|
4639
|
-
function
|
|
4785
|
+
function Nr(e, t) {
|
|
4640
4786
|
if (e == null) return ["(empty)"];
|
|
4641
4787
|
switch (t) {
|
|
4642
4788
|
case "json": try {
|
|
@@ -4655,7 +4801,7 @@ function Er(e, t) {
|
|
|
4655
4801
|
default: return String(e).split("\n");
|
|
4656
4802
|
}
|
|
4657
4803
|
}
|
|
4658
|
-
function
|
|
4804
|
+
function Pr(e, t) {
|
|
4659
4805
|
let n = [], r = Math.max(e.length, t.length);
|
|
4660
4806
|
for (let i = 0; i < r; i++) {
|
|
4661
4807
|
let r = i < e.length ? e[i] : void 0, a = i < t.length ? t[i] : void 0;
|
|
@@ -4672,16 +4818,16 @@ function Dr(e, t) {
|
|
|
4672
4818
|
}
|
|
4673
4819
|
return n;
|
|
4674
4820
|
}
|
|
4675
|
-
var
|
|
4821
|
+
var Fr = {
|
|
4676
4822
|
added: "bg-green-50 text-green-800 dark:bg-green-950/30 dark:text-green-300",
|
|
4677
4823
|
removed: "bg-red-50 text-red-800 dark:bg-red-950/30 dark:text-red-300",
|
|
4678
4824
|
unchanged: "text-muted-foreground"
|
|
4679
|
-
},
|
|
4825
|
+
}, Ir = {
|
|
4680
4826
|
added: "+",
|
|
4681
4827
|
removed: "-",
|
|
4682
4828
|
unchanged: " "
|
|
4683
|
-
},
|
|
4684
|
-
let { t: s } = $(), [c, l] = i.useState(a), u = i.useMemo(() =>
|
|
4829
|
+
}, Lr = ({ oldValue: e, newValue: t, fieldName: n, fieldType: r = "string", mode: a = "unified", className: o }) => {
|
|
4830
|
+
let { t: s } = $(), [c, l] = i.useState(a), u = i.useMemo(() => Nr(e, r), [e, r]), d = i.useMemo(() => Nr(t, r), [t, r]), f = i.useMemo(() => Pr(u, d), [u, d]), p = f.some((e) => e.type !== "unchanged"), m = i.useMemo(() => {
|
|
4685
4831
|
if (c !== "side-by-side") return [];
|
|
4686
4832
|
let e = [], t = 0;
|
|
4687
4833
|
for (; t < f.length;) {
|
|
@@ -4723,14 +4869,14 @@ var Or = {
|
|
|
4723
4869
|
className: "h-7 w-7",
|
|
4724
4870
|
onClick: () => l("unified"),
|
|
4725
4871
|
title: s("detail.unifiedDiff"),
|
|
4726
|
-
children: /* @__PURE__ */ Z(
|
|
4872
|
+
children: /* @__PURE__ */ Z(Xe, { className: "h-3.5 w-3.5" })
|
|
4727
4873
|
}), /* @__PURE__ */ Z(x, {
|
|
4728
4874
|
variant: c === "side-by-side" ? "secondary" : "ghost",
|
|
4729
4875
|
size: "icon",
|
|
4730
4876
|
className: "h-7 w-7",
|
|
4731
4877
|
onClick: () => l("side-by-side"),
|
|
4732
4878
|
title: s("detail.sideBySideDiff"),
|
|
4733
|
-
children: /* @__PURE__ */ Z(
|
|
4879
|
+
children: /* @__PURE__ */ Z(Ce, { className: "h-3.5 w-3.5" })
|
|
4734
4880
|
})]
|
|
4735
4881
|
})]
|
|
4736
4882
|
})
|
|
@@ -4739,10 +4885,10 @@ var Or = {
|
|
|
4739
4885
|
children: p ? c === "unified" ? /* @__PURE__ */ Z("div", {
|
|
4740
4886
|
className: "font-mono text-xs overflow-x-auto",
|
|
4741
4887
|
children: f.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
4742
|
-
className: G("px-4 py-0.5 whitespace-pre-wrap border-l-2",
|
|
4888
|
+
className: G("px-4 py-0.5 whitespace-pre-wrap border-l-2", Fr[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
|
|
4743
4889
|
children: [/* @__PURE__ */ Z("span", {
|
|
4744
4890
|
className: "select-none mr-2 inline-block w-3 text-center opacity-60",
|
|
4745
|
-
children:
|
|
4891
|
+
children: Ir[e.type]
|
|
4746
4892
|
}), e.value]
|
|
4747
4893
|
}, t))
|
|
4748
4894
|
}) : /* @__PURE__ */ Z("div", {
|
|
@@ -4759,10 +4905,10 @@ var Or = {
|
|
|
4759
4905
|
children: s("detail.currentVersion")
|
|
4760
4906
|
}),
|
|
4761
4907
|
m.map((e, t) => /* @__PURE__ */ Q(i.Fragment, { children: [/* @__PURE__ */ Z("div", {
|
|
4762
|
-
className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ?
|
|
4908
|
+
className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? Fr[e.left.type] : "bg-muted/20"),
|
|
4763
4909
|
children: e.left?.value ?? ""
|
|
4764
4910
|
}), /* @__PURE__ */ Z("div", {
|
|
4765
|
-
className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ?
|
|
4911
|
+
className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? Fr[e.right.type] : "bg-muted/20"),
|
|
4766
4912
|
children: e.right?.value ?? ""
|
|
4767
4913
|
})] }, t))
|
|
4768
4914
|
]
|
|
@@ -4773,7 +4919,7 @@ var Or = {
|
|
|
4773
4919
|
})
|
|
4774
4920
|
})]
|
|
4775
4921
|
});
|
|
4776
|
-
},
|
|
4922
|
+
}, Rr = ({ currentIndex: e, totalRecords: t, recordIds: n, onNavigate: r, onSearch: a, className: o }) => {
|
|
4777
4923
|
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(() => {
|
|
4778
4924
|
p && r(n[0]);
|
|
4779
4925
|
}, [
|
|
@@ -4850,7 +4996,7 @@ var Or = {
|
|
|
4850
4996
|
disabled: !p,
|
|
4851
4997
|
onClick: _,
|
|
4852
4998
|
title: s("detail.firstRecord"),
|
|
4853
|
-
children: /* @__PURE__ */ Z(
|
|
4999
|
+
children: /* @__PURE__ */ Z(be, { className: "h-4 w-4" })
|
|
4854
5000
|
}),
|
|
4855
5001
|
/* @__PURE__ */ Z(x, {
|
|
4856
5002
|
variant: "outline",
|
|
@@ -4859,7 +5005,7 @@ var Or = {
|
|
|
4859
5005
|
disabled: !m,
|
|
4860
5006
|
onClick: v,
|
|
4861
5007
|
title: s("detail.previousRecordKey"),
|
|
4862
|
-
children: /* @__PURE__ */ Z(
|
|
5008
|
+
children: /* @__PURE__ */ Z(ve, { className: "h-4 w-4" })
|
|
4863
5009
|
}),
|
|
4864
5010
|
/* @__PURE__ */ Z("span", {
|
|
4865
5011
|
className: "text-xs text-muted-foreground whitespace-nowrap px-1.5 tabular-nums",
|
|
@@ -4875,7 +5021,7 @@ var Or = {
|
|
|
4875
5021
|
disabled: !h,
|
|
4876
5022
|
onClick: y,
|
|
4877
5023
|
title: s("detail.nextRecordKey"),
|
|
4878
|
-
children: /* @__PURE__ */ Z(
|
|
5024
|
+
children: /* @__PURE__ */ Z(ye, { className: "h-4 w-4" })
|
|
4879
5025
|
}),
|
|
4880
5026
|
/* @__PURE__ */ Z(x, {
|
|
4881
5027
|
variant: "outline",
|
|
@@ -4884,15 +5030,15 @@ var Or = {
|
|
|
4884
5030
|
disabled: !g,
|
|
4885
5031
|
onClick: b,
|
|
4886
5032
|
title: s("detail.lastRecord"),
|
|
4887
|
-
children: /* @__PURE__ */ Z(
|
|
5033
|
+
children: /* @__PURE__ */ Z(xe, { className: "h-4 w-4" })
|
|
4888
5034
|
}),
|
|
4889
|
-
a && /* @__PURE__ */ Q(
|
|
5035
|
+
a && /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Z(x, {
|
|
4890
5036
|
variant: u ? "secondary" : "ghost",
|
|
4891
5037
|
size: "icon",
|
|
4892
5038
|
className: "h-8 w-8",
|
|
4893
5039
|
onClick: C,
|
|
4894
5040
|
title: s("detail.searchWhileNavigating"),
|
|
4895
|
-
children: /* @__PURE__ */ Z(
|
|
5041
|
+
children: /* @__PURE__ */ Z(Ze, { className: "h-4 w-4" })
|
|
4896
5042
|
}), u && /* @__PURE__ */ Z("div", {
|
|
4897
5043
|
className: "relative",
|
|
4898
5044
|
children: /* @__PURE__ */ Z(A, {
|
|
@@ -4906,18 +5052,18 @@ var Or = {
|
|
|
4906
5052
|
})] })
|
|
4907
5053
|
]
|
|
4908
5054
|
});
|
|
4909
|
-
},
|
|
5055
|
+
}, zr = 28, Br = [
|
|
4910
5056
|
"fill-primary stroke-primary",
|
|
4911
5057
|
"fill-blue-500 stroke-blue-500",
|
|
4912
5058
|
"fill-emerald-500 stroke-emerald-500",
|
|
4913
5059
|
"fill-amber-500 stroke-amber-500"
|
|
4914
|
-
],
|
|
5060
|
+
], Vr = [
|
|
4915
5061
|
"fill-primary-foreground",
|
|
4916
5062
|
"fill-white",
|
|
4917
5063
|
"fill-white",
|
|
4918
5064
|
"fill-white"
|
|
4919
5065
|
];
|
|
4920
|
-
function
|
|
5066
|
+
function Hr(e, t, n, r, i) {
|
|
4921
5067
|
let a = [], o = [], s = /* @__PURE__ */ new Set(), c = r / 2, l = i / 2;
|
|
4922
5068
|
a.push({
|
|
4923
5069
|
id: e.id,
|
|
@@ -4981,10 +5127,10 @@ function Fr(e, t, n, r, i) {
|
|
|
4981
5127
|
edges: o
|
|
4982
5128
|
};
|
|
4983
5129
|
}
|
|
4984
|
-
function
|
|
5130
|
+
function Ur(e, t = 6) {
|
|
4985
5131
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
4986
5132
|
}
|
|
4987
|
-
var
|
|
5133
|
+
var Wr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, className: a }) => {
|
|
4988
5134
|
let o = i.useRef(null), [s, c] = i.useState({
|
|
4989
5135
|
width: 500,
|
|
4990
5136
|
height: 400
|
|
@@ -5005,7 +5151,7 @@ var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5005
5151
|
});
|
|
5006
5152
|
return n.observe(t), () => n.disconnect();
|
|
5007
5153
|
}, []);
|
|
5008
|
-
let { nodes: d, edges: f } = i.useMemo(() =>
|
|
5154
|
+
let { nodes: d, edges: f } = i.useMemo(() => Hr(e, t, n, s.width, s.height), [
|
|
5009
5155
|
e,
|
|
5010
5156
|
t,
|
|
5011
5157
|
n,
|
|
@@ -5047,7 +5193,7 @@ var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5047
5193
|
strokeWidth: 1.5,
|
|
5048
5194
|
strokeOpacity: .5
|
|
5049
5195
|
}, `edge-${t}`)), d.map((e) => {
|
|
5050
|
-
let t = l === e.id, n =
|
|
5196
|
+
let t = l === e.id, n = Br[Math.min(e.level, Br.length - 1)], i = Vr[Math.min(e.level, Vr.length - 1)], a = e.level === 0 ? 34 : zr;
|
|
5051
5197
|
return /* @__PURE__ */ Q("g", {
|
|
5052
5198
|
className: G("cursor-pointer transition-transform", r && "hover:opacity-80"),
|
|
5053
5199
|
onClick: () => r?.(e.id),
|
|
@@ -5069,7 +5215,7 @@ var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5069
5215
|
textAnchor: "middle",
|
|
5070
5216
|
dominantBaseline: "central",
|
|
5071
5217
|
className: G("text-[10px] font-medium pointer-events-none", i),
|
|
5072
|
-
children:
|
|
5218
|
+
children: Ur(e.label)
|
|
5073
5219
|
}),
|
|
5074
5220
|
e.type && /* @__PURE__ */ Z("text", {
|
|
5075
5221
|
x: e.x,
|
|
@@ -5078,7 +5224,7 @@ var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5078
5224
|
className: "fill-muted-foreground text-[9px] pointer-events-none",
|
|
5079
5225
|
children: e.type
|
|
5080
5226
|
}),
|
|
5081
|
-
t && /* @__PURE__ */ Q(
|
|
5227
|
+
t && /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Z("rect", {
|
|
5082
5228
|
x: e.x - 50,
|
|
5083
5229
|
y: e.y - a - 28,
|
|
5084
5230
|
width: 100,
|
|
@@ -5103,7 +5249,7 @@ var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5103
5249
|
};
|
|
5104
5250
|
//#endregion
|
|
5105
5251
|
//#region src/PointInTimeRestore.tsx
|
|
5106
|
-
function
|
|
5252
|
+
function Gr(e) {
|
|
5107
5253
|
try {
|
|
5108
5254
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
5109
5255
|
if (r < 1) return "just now";
|
|
@@ -5114,7 +5260,7 @@ function Rr(e) {
|
|
|
5114
5260
|
return e;
|
|
5115
5261
|
}
|
|
5116
5262
|
}
|
|
5117
|
-
var
|
|
5263
|
+
var Kr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
5118
5264
|
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 () => {
|
|
5119
5265
|
if (!(!d || !n)) {
|
|
5120
5266
|
if (!s) {
|
|
@@ -5143,7 +5289,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5143
5289
|
children: /* @__PURE__ */ Q(T, {
|
|
5144
5290
|
className: "flex items-center gap-2 text-base",
|
|
5145
5291
|
children: [
|
|
5146
|
-
/* @__PURE__ */ Z(
|
|
5292
|
+
/* @__PURE__ */ Z(je, { className: "h-4 w-4" }),
|
|
5147
5293
|
"Revision History",
|
|
5148
5294
|
/* @__PURE__ */ Q("span", {
|
|
5149
5295
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -5176,7 +5322,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5176
5322
|
},
|
|
5177
5323
|
children: [/* @__PURE__ */ Z("div", {
|
|
5178
5324
|
className: G("shrink-0 h-6 w-6 rounded-full border-2 flex items-center justify-center z-10 mt-0.5", t ? "border-primary bg-primary" : "border-border bg-background"),
|
|
5179
|
-
children: t && /* @__PURE__ */ Z(
|
|
5325
|
+
children: t && /* @__PURE__ */ Z(ye, { className: "h-3 w-3 text-primary-foreground" })
|
|
5180
5326
|
}), /* @__PURE__ */ Q("div", {
|
|
5181
5327
|
className: "flex-1 min-w-0",
|
|
5182
5328
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -5186,7 +5332,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5186
5332
|
children: e.user
|
|
5187
5333
|
}), /* @__PURE__ */ Z("span", {
|
|
5188
5334
|
className: "text-xs text-muted-foreground",
|
|
5189
|
-
children:
|
|
5335
|
+
children: Gr(e.timestamp)
|
|
5190
5336
|
})]
|
|
5191
5337
|
}), /* @__PURE__ */ Q("p", {
|
|
5192
5338
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
@@ -5208,7 +5354,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5208
5354
|
children: [
|
|
5209
5355
|
/* @__PURE__ */ Q("div", {
|
|
5210
5356
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
5211
|
-
children: [/* @__PURE__ */ Z(
|
|
5357
|
+
children: [/* @__PURE__ */ Z(De, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
|
|
5212
5358
|
}),
|
|
5213
5359
|
/* @__PURE__ */ Z("div", {
|
|
5214
5360
|
className: "space-y-2",
|
|
@@ -5224,7 +5370,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5224
5370
|
className: "line-through text-red-600 dark:text-red-400 truncate max-w-[120px]",
|
|
5225
5371
|
children: e.oldValue == null ? "(empty)" : String(e.oldValue)
|
|
5226
5372
|
}),
|
|
5227
|
-
/* @__PURE__ */ Z(
|
|
5373
|
+
/* @__PURE__ */ Z(ye, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
5228
5374
|
/* @__PURE__ */ Z("span", {
|
|
5229
5375
|
className: "text-green-600 dark:text-green-400 truncate max-w-[120px]",
|
|
5230
5376
|
children: e.newValue == null ? "(empty)" : String(e.newValue)
|
|
@@ -5254,12 +5400,12 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5254
5400
|
}),
|
|
5255
5401
|
n && /* @__PURE__ */ Z("div", {
|
|
5256
5402
|
className: "pt-1 space-y-2",
|
|
5257
|
-
children: s ? /* @__PURE__ */ Q(
|
|
5403
|
+
children: s ? /* @__PURE__ */ Q(Mt, { children: [/* @__PURE__ */ Q("p", {
|
|
5258
5404
|
className: "text-xs text-amber-600 dark:text-amber-400",
|
|
5259
5405
|
children: [
|
|
5260
5406
|
"This will restore the record to its state at",
|
|
5261
5407
|
" ",
|
|
5262
|
-
|
|
5408
|
+
Gr(d.timestamp),
|
|
5263
5409
|
". Continue?"
|
|
5264
5410
|
]
|
|
5265
5411
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -5270,7 +5416,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5270
5416
|
className: "gap-1.5 flex-1",
|
|
5271
5417
|
onClick: f,
|
|
5272
5418
|
disabled: l,
|
|
5273
|
-
children: [/* @__PURE__ */ Z(
|
|
5419
|
+
children: [/* @__PURE__ */ Z(Ye, { className: "h-3.5 w-3.5" }), l ? "Restoring…" : "Confirm Restore"]
|
|
5274
5420
|
}), /* @__PURE__ */ Z(x, {
|
|
5275
5421
|
variant: "ghost",
|
|
5276
5422
|
size: "sm",
|
|
@@ -5283,14 +5429,14 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5283
5429
|
size: "sm",
|
|
5284
5430
|
className: "w-full gap-1.5",
|
|
5285
5431
|
onClick: f,
|
|
5286
|
-
children: [/* @__PURE__ */ Z(
|
|
5432
|
+
children: [/* @__PURE__ */ Z(Ye, { className: "h-3.5 w-3.5" }), "Restore to this point"]
|
|
5287
5433
|
})
|
|
5288
5434
|
})
|
|
5289
5435
|
]
|
|
5290
5436
|
})]
|
|
5291
5437
|
}) })]
|
|
5292
5438
|
});
|
|
5293
|
-
},
|
|
5439
|
+
}, qr = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: n = !1, className: r }) => {
|
|
5294
5440
|
let [a, o] = i.useState(""), [s, c] = i.useState(!1), l = i.useCallback(async () => {
|
|
5295
5441
|
let t = a.trim();
|
|
5296
5442
|
if (t) {
|
|
@@ -5320,10 +5466,10 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5320
5466
|
disabled: !a.trim() || s || n,
|
|
5321
5467
|
className: "shrink-0 self-end",
|
|
5322
5468
|
"aria-label": "Submit comment",
|
|
5323
|
-
children: /* @__PURE__ */ Z(
|
|
5469
|
+
children: /* @__PURE__ */ Z(Qe, { className: "h-4 w-4" })
|
|
5324
5470
|
})]
|
|
5325
5471
|
});
|
|
5326
|
-
},
|
|
5472
|
+
}, Jr = ({ query: e, suggestions: t, onSelect: n, visible: r = !0, activeIndex: a = 0, className: o }) => {
|
|
5327
5473
|
let s = i.useMemo(() => {
|
|
5328
5474
|
if (!e) return t;
|
|
5329
5475
|
let n = e.toLowerCase();
|
|
@@ -5365,7 +5511,7 @@ var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5365
5511
|
}, e.id))
|
|
5366
5512
|
});
|
|
5367
5513
|
};
|
|
5368
|
-
function
|
|
5514
|
+
function Yr(e, t, n) {
|
|
5369
5515
|
return {
|
|
5370
5516
|
type: e.type,
|
|
5371
5517
|
id: e.id,
|
|
@@ -5376,7 +5522,7 @@ function Hr(e, t, n) {
|
|
|
5376
5522
|
}
|
|
5377
5523
|
//#endregion
|
|
5378
5524
|
//#region src/extractMentions.ts
|
|
5379
|
-
function
|
|
5525
|
+
function Xr(e, t) {
|
|
5380
5526
|
if (!e || !t.length) return [];
|
|
5381
5527
|
let n = [...t].sort((e, t) => t.label.length - e.label.length), r = e, i = /* @__PURE__ */ new Set();
|
|
5382
5528
|
for (let e of n) {
|
|
@@ -5388,10 +5534,10 @@ function Ur(e, t) {
|
|
|
5388
5534
|
}
|
|
5389
5535
|
//#endregion
|
|
5390
5536
|
//#region src/synth/buildDefaultPageSchema.ts
|
|
5391
|
-
function
|
|
5537
|
+
function Zr(e) {
|
|
5392
5538
|
return e == null ? [] : Array.isArray(e) ? e.filter((e) => e != null) : [e];
|
|
5393
5539
|
}
|
|
5394
|
-
function
|
|
5540
|
+
function Qr(e) {
|
|
5395
5541
|
if (!e) return null;
|
|
5396
5542
|
let t = e.stageField;
|
|
5397
5543
|
if (t === !1) return null;
|
|
@@ -5409,7 +5555,7 @@ function Gr(e) {
|
|
|
5409
5555
|
}
|
|
5410
5556
|
return null;
|
|
5411
5557
|
}
|
|
5412
|
-
function
|
|
5558
|
+
function $r(e, t) {
|
|
5413
5559
|
if (!e || !t) return null;
|
|
5414
5560
|
let n = e.fields?.[t]?.options;
|
|
5415
5561
|
return !Array.isArray(n) || n.length === 0 ? null : n.map((e) => ({
|
|
@@ -5417,7 +5563,7 @@ function Kr(e, t) {
|
|
|
5417
5563
|
label: e.label
|
|
5418
5564
|
}));
|
|
5419
5565
|
}
|
|
5420
|
-
function
|
|
5566
|
+
function ei(e, t, n = 4) {
|
|
5421
5567
|
if (!e) return [];
|
|
5422
5568
|
let r = Array.isArray(e.highlightFields) && e.highlightFields.length > 0 ? e.highlightFields : null;
|
|
5423
5569
|
if (r) return r.filter((e) => typeof e == "string" && e.length > 0).slice(0, n);
|
|
@@ -5492,22 +5638,22 @@ function qr(e, t, n = 4) {
|
|
|
5492
5638
|
}
|
|
5493
5639
|
return s;
|
|
5494
5640
|
}
|
|
5495
|
-
function
|
|
5641
|
+
function ti(e, t = {}) {
|
|
5496
5642
|
return {
|
|
5497
5643
|
type: "page:header",
|
|
5498
5644
|
recordChrome: t.recordChrome !== !1,
|
|
5499
5645
|
...Array.isArray(t.actions) && t.actions.length > 0 ? { actions: t.actions } : {}
|
|
5500
5646
|
};
|
|
5501
5647
|
}
|
|
5502
|
-
function
|
|
5648
|
+
function ni(e, t) {
|
|
5503
5649
|
return !Array.isArray(t) || t.length === 0 ? null : {
|
|
5504
5650
|
type: "record:quick_actions",
|
|
5505
5651
|
actions: t,
|
|
5506
5652
|
location: "record_header"
|
|
5507
5653
|
};
|
|
5508
5654
|
}
|
|
5509
|
-
function
|
|
5510
|
-
let n = t.statusField ??
|
|
5655
|
+
function ri(e, t = {}) {
|
|
5656
|
+
let n = t.statusField ?? Qr(e), r = t.stages ?? (n ? $r(e, n) : null), i = t.highlightFields ?? ei(e, n), a = [];
|
|
5511
5657
|
return !t.hideHighlights && i.length > 0 && a.push({
|
|
5512
5658
|
type: "record:highlights",
|
|
5513
5659
|
fields: i
|
|
@@ -5517,9 +5663,9 @@ function Xr(e, t = {}) {
|
|
|
5517
5663
|
stages: r
|
|
5518
5664
|
}), a;
|
|
5519
5665
|
}
|
|
5520
|
-
function
|
|
5666
|
+
function ii(e) {
|
|
5521
5667
|
if (!e) return null;
|
|
5522
|
-
let t =
|
|
5668
|
+
let t = Lt(e);
|
|
5523
5669
|
if (!t) return null;
|
|
5524
5670
|
let n = e.fields || {}, r = (e) => {
|
|
5525
5671
|
let t = n[e] || {};
|
|
@@ -5532,7 +5678,7 @@ function Zr(e) {
|
|
|
5532
5678
|
...t.reference_field ? { reference_field: t.reference_field } : {},
|
|
5533
5679
|
...t.currency ? { currency: t.currency } : {}
|
|
5534
5680
|
};
|
|
5535
|
-
};
|
|
5681
|
+
}, i = Bt(t.reduce((e, t) => e + t.fields.length, 0));
|
|
5536
5682
|
return t.map((e) => ({
|
|
5537
5683
|
...e.key === void 0 ? {} : {
|
|
5538
5684
|
name: e.key,
|
|
@@ -5540,24 +5686,25 @@ function Zr(e) {
|
|
|
5540
5686
|
},
|
|
5541
5687
|
...e.collapse === "none" ? {} : { collapsible: !0 },
|
|
5542
5688
|
...e.collapse === "collapsed" ? { defaultCollapsed: !0 } : {},
|
|
5689
|
+
columns: i,
|
|
5543
5690
|
fields: e.fields.map(r)
|
|
5544
5691
|
}));
|
|
5545
5692
|
}
|
|
5546
|
-
function
|
|
5547
|
-
return Array.isArray(t) && t.length > 0 ? t :
|
|
5693
|
+
function ai(e, t) {
|
|
5694
|
+
return Array.isArray(t) && t.length > 0 ? t : ii(e) ?? void 0;
|
|
5548
5695
|
}
|
|
5549
|
-
function
|
|
5696
|
+
function oi(e, t, n) {
|
|
5550
5697
|
return {
|
|
5551
5698
|
type: "record:details",
|
|
5552
|
-
sections:
|
|
5699
|
+
sections: ai(e, t),
|
|
5553
5700
|
...n && n.length > 0 ? { hideFields: n } : {}
|
|
5554
5701
|
};
|
|
5555
5702
|
}
|
|
5556
|
-
function
|
|
5557
|
-
let n = t.statusField ??
|
|
5703
|
+
function si(e, t = {}) {
|
|
5704
|
+
let n = t.statusField ?? Qr(e), r = t.highlightFields ?? ei(e, n), i = [{
|
|
5558
5705
|
label: "Details",
|
|
5559
5706
|
value: "details",
|
|
5560
|
-
children: [
|
|
5707
|
+
children: [oi(e, t.sections, r)]
|
|
5561
5708
|
}];
|
|
5562
5709
|
if (!t.hideRelatedTab && Array.isArray(t.related) && t.related.length > 0) {
|
|
5563
5710
|
let e = (e) => ({
|
|
@@ -5608,15 +5755,15 @@ function ei(e, t = {}) {
|
|
|
5608
5755
|
items: i
|
|
5609
5756
|
};
|
|
5610
5757
|
}
|
|
5611
|
-
function
|
|
5758
|
+
function ci() {
|
|
5612
5759
|
return { type: "record:discussion" };
|
|
5613
5760
|
}
|
|
5614
|
-
function
|
|
5761
|
+
function li(e, t = {}) {
|
|
5615
5762
|
let n = t.slots || {}, r = [];
|
|
5616
|
-
"header" in n && n.header !== void 0 ? r.push(...
|
|
5763
|
+
"header" in n && n.header !== void 0 ? r.push(...Zr(n.header)) : r.push(ti(e, {
|
|
5617
5764
|
recordChrome: t.recordChrome,
|
|
5618
5765
|
actions: t.headerActions
|
|
5619
|
-
})), "actions" in n && n.actions !== void 0 && r.push(...
|
|
5766
|
+
})), "actions" in n && n.actions !== void 0 && r.push(...Zr(n.actions)), "alerts" in n && n.alerts !== void 0 && r.push(...Zr(n.alerts)), "highlights" in n && n.highlights !== void 0 ? r.push(...Zr(n.highlights)) : r.push(...ri(e, {
|
|
5620
5767
|
highlightFields: t.highlightFields,
|
|
5621
5768
|
statusField: t.statusField,
|
|
5622
5769
|
stages: t.stages,
|
|
@@ -5624,9 +5771,9 @@ function ni(e, t = {}) {
|
|
|
5624
5771
|
hidePath: t.hidePath
|
|
5625
5772
|
}));
|
|
5626
5773
|
let i = t.showReferenceRail === !0 && !t.hideReferenceRail && Array.isArray(t.related) && t.related.length >= 2, a = t.hideRelatedTab ?? i;
|
|
5627
|
-
if ("tabs" in n && n.tabs !== void 0) r.push(...
|
|
5774
|
+
if ("tabs" in n && n.tabs !== void 0) r.push(...Zr(n.tabs));
|
|
5628
5775
|
else if ("details" in n && n.details !== void 0) {
|
|
5629
|
-
let i =
|
|
5776
|
+
let i = Zr(n.details), o = si(e, {
|
|
5630
5777
|
sections: t.sections,
|
|
5631
5778
|
related: t.related,
|
|
5632
5779
|
showActivity: t.showActivity,
|
|
@@ -5640,7 +5787,7 @@ function ni(e, t = {}) {
|
|
|
5640
5787
|
...o.items[0],
|
|
5641
5788
|
children: i
|
|
5642
5789
|
}), r.push(o);
|
|
5643
|
-
} else r.push(
|
|
5790
|
+
} else r.push(si(e, {
|
|
5644
5791
|
sections: t.sections,
|
|
5645
5792
|
related: t.related,
|
|
5646
5793
|
showActivity: t.showActivity,
|
|
@@ -5650,12 +5797,12 @@ function ni(e, t = {}) {
|
|
|
5650
5797
|
hideRelatedTab: a,
|
|
5651
5798
|
relatedLayout: t.relatedLayout
|
|
5652
5799
|
}));
|
|
5653
|
-
"discussion" in n && n.discussion !== void 0 ? r.push(...
|
|
5800
|
+
"discussion" in n && n.discussion !== void 0 ? r.push(...Zr(n.discussion)) : t.hideDiscussion || r.push(ci());
|
|
5654
5801
|
let o = [{
|
|
5655
5802
|
name: "main",
|
|
5656
5803
|
width: "full",
|
|
5657
5804
|
components: r
|
|
5658
|
-
}], s =
|
|
5805
|
+
}], s = Zr(n.rightRail);
|
|
5659
5806
|
if (i || s.length > 0) {
|
|
5660
5807
|
let e = [];
|
|
5661
5808
|
i && e.push({
|
|
@@ -5683,7 +5830,7 @@ function ni(e, t = {}) {
|
|
|
5683
5830
|
regions: o
|
|
5684
5831
|
};
|
|
5685
5832
|
}
|
|
5686
|
-
e.register("detail-view",
|
|
5833
|
+
e.register("detail-view", kn, {
|
|
5687
5834
|
namespace: "plugin-detail",
|
|
5688
5835
|
label: "Detail View",
|
|
5689
5836
|
category: "Views",
|
|
@@ -5813,7 +5960,7 @@ e.register("detail-view", Sn, {
|
|
|
5813
5960
|
tabs: [],
|
|
5814
5961
|
related: []
|
|
5815
5962
|
}
|
|
5816
|
-
}), e.register("detail-section",
|
|
5963
|
+
}), e.register("detail-section", Zt, {
|
|
5817
5964
|
namespace: "plugin-detail",
|
|
5818
5965
|
label: "Detail Section",
|
|
5819
5966
|
category: "Detail Components",
|
|
@@ -5864,7 +6011,7 @@ e.register("detail-view", Sn, {
|
|
|
5864
6011
|
label: "Header Color"
|
|
5865
6012
|
}
|
|
5866
6013
|
]
|
|
5867
|
-
}), e.register("related-list",
|
|
6014
|
+
}), e.register("related-list", tn, {
|
|
5868
6015
|
namespace: "plugin-detail",
|
|
5869
6016
|
label: "Related List",
|
|
5870
6017
|
category: "Detail Components",
|
|
@@ -5911,7 +6058,7 @@ e.register("detail-view", Sn, {
|
|
|
5911
6058
|
label: "Columns"
|
|
5912
6059
|
}
|
|
5913
6060
|
]
|
|
5914
|
-
}), e.register("detail",
|
|
6061
|
+
}), e.register("detail", kn, {
|
|
5915
6062
|
namespace: "view",
|
|
5916
6063
|
category: "view",
|
|
5917
6064
|
label: "Detail",
|
|
@@ -5934,7 +6081,7 @@ e.register("detail-view", Sn, {
|
|
|
5934
6081
|
label: "Fields"
|
|
5935
6082
|
}
|
|
5936
6083
|
]
|
|
5937
|
-
}), e.register("record:details",
|
|
6084
|
+
}), e.register("record:details", In, {
|
|
5938
6085
|
namespace: "record",
|
|
5939
6086
|
category: "record",
|
|
5940
6087
|
label: "Record Details",
|
|
@@ -5974,7 +6121,7 @@ e.register("detail-view", Sn, {
|
|
|
5974
6121
|
description: "Explicit field list (overrides highlightFields)"
|
|
5975
6122
|
}
|
|
5976
6123
|
]
|
|
5977
|
-
}), e.register("record:related_list",
|
|
6124
|
+
}), e.register("record:related_list", Bn, {
|
|
5978
6125
|
namespace: "record",
|
|
5979
6126
|
category: "record",
|
|
5980
6127
|
label: "Related List",
|
|
@@ -6037,7 +6184,7 @@ e.register("detail-view", Sn, {
|
|
|
6037
6184
|
description: "Action IDs available for related records"
|
|
6038
6185
|
}
|
|
6039
6186
|
]
|
|
6040
|
-
}), e.register("record:highlights",
|
|
6187
|
+
}), e.register("record:highlights", Hn, {
|
|
6041
6188
|
namespace: "record",
|
|
6042
6189
|
category: "record",
|
|
6043
6190
|
label: "Highlights Panel",
|
|
@@ -6056,22 +6203,22 @@ e.register("detail-view", Sn, {
|
|
|
6056
6203
|
defaultValue: "horizontal",
|
|
6057
6204
|
description: "Layout orientation for highlight fields"
|
|
6058
6205
|
}]
|
|
6059
|
-
}), e.register("record:activity",
|
|
6206
|
+
}), e.register("record:activity", cr, {
|
|
6060
6207
|
namespace: "record",
|
|
6061
6208
|
category: "record",
|
|
6062
6209
|
label: "Activity Timeline",
|
|
6063
6210
|
icon: "Activity"
|
|
6064
|
-
}), e.register("record:chatter",
|
|
6211
|
+
}), e.register("record:chatter", dr, {
|
|
6065
6212
|
namespace: "record",
|
|
6066
6213
|
category: "record",
|
|
6067
6214
|
label: "Chatter Feed",
|
|
6068
6215
|
icon: "MessageSquare"
|
|
6069
|
-
}), e.register("record:discussion",
|
|
6216
|
+
}), e.register("record:discussion", dr, {
|
|
6070
6217
|
namespace: "record",
|
|
6071
6218
|
category: "record",
|
|
6072
6219
|
label: "Discussion",
|
|
6073
6220
|
icon: "MessageSquare"
|
|
6074
|
-
}), e.register("record:path",
|
|
6221
|
+
}), e.register("record:path", pr, {
|
|
6075
6222
|
namespace: "record",
|
|
6076
6223
|
category: "record",
|
|
6077
6224
|
label: "Path / Stepper",
|
|
@@ -6088,26 +6235,29 @@ e.register("detail-view", Sn, {
|
|
|
6088
6235
|
label: "Stages",
|
|
6089
6236
|
description: "Explicit stage definitions [{ value, label }] (else derived from field metadata)"
|
|
6090
6237
|
}]
|
|
6091
|
-
}), e.register("record:quick_actions",
|
|
6238
|
+
}), e.register("record:quick_actions", hr, {
|
|
6092
6239
|
namespace: "record",
|
|
6093
6240
|
category: "record",
|
|
6094
6241
|
label: "Quick Actions",
|
|
6095
6242
|
icon: "Zap"
|
|
6096
|
-
}), e.register("record:history",
|
|
6243
|
+
}), e.register("record:history", yr, {
|
|
6097
6244
|
namespace: "record",
|
|
6098
6245
|
category: "record",
|
|
6099
6246
|
label: "History Timeline",
|
|
6100
6247
|
icon: "Clock"
|
|
6101
|
-
}), e.register("record:reference_rail",
|
|
6248
|
+
}), e.register("record:reference_rail", Cr, {
|
|
6102
6249
|
namespace: "record",
|
|
6103
6250
|
category: "record",
|
|
6104
6251
|
label: "Reference Rail",
|
|
6105
6252
|
icon: "PanelRight"
|
|
6106
|
-
}), e.register("record:alert",
|
|
6253
|
+
}), e.register("record:alert", Er, {
|
|
6107
6254
|
namespace: "record",
|
|
6108
6255
|
category: "record",
|
|
6109
6256
|
label: "Alert Banner",
|
|
6110
6257
|
icon: "AlertTriangle"
|
|
6258
|
+
}), e.register("permission-facet-link", qt, {
|
|
6259
|
+
namespace: "field",
|
|
6260
|
+
skipFallback: !0
|
|
6111
6261
|
});
|
|
6112
6262
|
//#endregion
|
|
6113
|
-
export {
|
|
6263
|
+
export { fn as ActivityTimeline, er as CommentAttachment, qr as CommentInput, Mn as ConcurrentUpdateDialog, Wt as DETAIL_DEFAULT_TRANSLATIONS, Zt as DetailSection, Qt as DetailTabs, kn as DetailView, Lr as DiffView, Un as FieldChangeItem, rn as HeaderHighlight, yn as HistoryTimeline, Mr as InlineCreateRelated, Jr as MentionAutocomplete, Kr as PointInTimeRestore, Gn as ReactionPicker, cr as RecordActivityRenderer, or as RecordActivityTimeline, Er as RecordAlertRenderer, lr as RecordChatterPanel, dr as RecordChatterRenderer, on as RecordComments, Ar as RecordDetailDrawer, In as RecordDetailsRenderer, Hn as RecordHighlightsRenderer, yr as RecordHistoryRenderer, En as RecordMetaFooter, Rr as RecordNavigationEnhanced, pr as RecordPathRenderer, hr as RecordQuickActionsRenderer, Cr as RecordReferenceRailRenderer, Bn as RecordRelatedListRenderer, tn as RelatedList, Wr as RelationshipGraph, Xn as RichTextCommentInput, nn as SectionGroup, Jn as SubscriptionToggle, qn as ThreadedReplies, Vt as applyAutoSpan, Ht as applyDetailAutoLayout, ni as buildDefaultActions, oi as buildDefaultDetails, ci as buildDefaultDiscussion, ti as buildDefaultHeader, ri as buildDefaultHighlights, li as buildDefaultPageSchema, si as buildDefaultTabs, Yr as createMentionFromSuggestion, Ut as createSafeTranslationHook, ii as deriveFieldGroupDetailSections, ei as deriveHighlightFields, jr as deriveRecordPageHref, $r as deriveStages, Qr as detectStatusField, Xr as extractMentions, Bt as inferDetailColumns, Nn as isConcurrentUpdateError, zt as isWideFieldType, ai as resolveDetailSections, $ as useDetailTranslation };
|