@object-ui/plugin-detail 11.3.0 → 11.5.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 +82 -0
- package/dist/DetailSection.d.ts.map +1 -1
- package/dist/DetailView.d.ts.map +1 -1
- package/dist/HeaderHighlight.d.ts.map +1 -1
- package/dist/RecordDetailDrawer.d.ts.map +1 -1
- package/dist/RelatedList.d.ts +8 -0
- package/dist/RelatedList.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +956 -857
- package/dist/index.umd.cjs +3 -3
- package/dist/renderers/record-details.d.ts.map +1 -1
- package/dist/renderers/record-related-list.d.ts.map +1 -1
- package/dist/synth/buildDefaultPageSchema.d.ts +73 -14
- package/dist/synth/buildDefaultPageSchema.d.ts.map +1 -1
- package/package.json +14 -13
package/dist/index.js
CHANGED
|
@@ -1,16 +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 ee, SelectTrigger as te, SelectValue as ne, Sheet as
|
|
5
|
-
import { Activity as
|
|
6
|
-
import { SchemaRenderer as at, toPredicateInput as ot, useActionEngine as st, useCondition as ct,
|
|
7
|
-
import { BooleanField as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { useFieldPermissions as
|
|
10
|
-
import { resolveFieldCurrency as
|
|
11
|
-
import { Link as
|
|
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 ee, SelectTrigger as te, SelectValue as ne, Sheet as re, SheetContent as ie, SheetHeader as P, SheetTitle as F, 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 K, AlertTriangle as se, ArrowLeft as ce, ArrowRight as le, ArrowRightLeft as ue, ArrowUpDown as de, AtSign as q, Bell as fe, BellOff as pe, Bold as me, Calendar as he, Check as ge, CheckSquare as _e, ChevronDown as ve, ChevronLeft as ye, ChevronRight as be, ChevronsLeft as xe, ChevronsRight as Se, Code as Ce, Columns2 as we, Copy as Te, Edit as Ee, ExternalLink as De, Eye as Oe, EyeOff as J, File as ke, FileArchive as Ae, FileText as je, History as Y, Image as Me, Inbox as Ne, Italic as Pe, Link as Fe, List as Ie, Loader2 as Le, Lock as Re, Mail as ze, MessageSquare as X, Network as Be, PanelRightClose as Ve, PanelRightOpen as He, Paperclip as Ue, Phone as We, Pin as Ge, Plus as Ke, PlusCircle as qe, RotateCcw as Je, Rows3 as Ye, Search as Xe, Send as Ze, SmilePlus as Qe, Star as $e, Trash2 as et, Upload as tt, X as nt, Zap as rt, icons as it } from "lucide-react";
|
|
6
|
+
import { SchemaRenderer as at, toPredicateInput as ot, useActionEngine as st, useCondition as ct, useDataInvalidation as lt, useDiscussionContext as ut, useHighlightFieldNames as dt, useMetadataItem as ft, useObjectTranslation as pt, useRecordContext as mt, useRegisterHighlightFields as ht, useRelatedRecordActions as gt, useSafeFieldLabel as _t } from "@object-ui/react";
|
|
7
|
+
import { BooleanField as vt, LookupField as yt, RecordPickerDialog as bt, SelectField as xt, UserField as St, coerceToSafeValue as Ct, getCellRenderer as wt, humanizeLabel as Tt, resolveCellRendererType as Et } from "@object-ui/fields";
|
|
8
|
+
import { Fragment as Dt, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
9
|
+
import { useFieldPermissions as Ot, usePermissions as kt } from "@object-ui/permissions";
|
|
10
|
+
import { resolveFieldCurrency as At, useLocalization as jt } from "@object-ui/i18n";
|
|
11
|
+
import { Link as Mt, useParams as Nt } from "react-router-dom";
|
|
12
|
+
import { deriveFieldGroupLayout as Pt } from "@objectstack/spec/data";
|
|
12
13
|
//#region src/autoLayout.ts
|
|
13
|
-
var
|
|
14
|
+
var Ft = /* @__PURE__ */ new Set([
|
|
14
15
|
"textarea",
|
|
15
16
|
"markdown",
|
|
16
17
|
"html",
|
|
@@ -22,36 +23,36 @@ var Mt = /* @__PURE__ */ new Set([
|
|
|
22
23
|
"field:grid",
|
|
23
24
|
"field:rich-text"
|
|
24
25
|
]);
|
|
25
|
-
function
|
|
26
|
-
return
|
|
26
|
+
function It(e) {
|
|
27
|
+
return Ft.has(e);
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function Lt(e, t) {
|
|
29
30
|
let n;
|
|
30
31
|
return n = e <= 3 ? 1 : 2, t !== void 0 && t < 640 ? Math.min(n, 1) : n;
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
-
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type &&
|
|
33
|
+
function Rt(e, t) {
|
|
34
|
+
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && It(e.type) ? {
|
|
34
35
|
...e,
|
|
35
36
|
span: t
|
|
36
37
|
} : e);
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function zt(e, t, n) {
|
|
39
40
|
if (t !== void 0) return {
|
|
40
|
-
fields:
|
|
41
|
+
fields: Rt(e, t),
|
|
41
42
|
columns: t
|
|
42
43
|
};
|
|
43
|
-
let r =
|
|
44
|
+
let r = Lt(e.length, n);
|
|
44
45
|
return {
|
|
45
|
-
fields:
|
|
46
|
+
fields: Rt(e, r),
|
|
46
47
|
columns: r
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
50
|
//#endregion
|
|
50
51
|
//#region src/useDetailTranslation.ts
|
|
51
|
-
function
|
|
52
|
+
function Bt(e, t) {
|
|
52
53
|
return function() {
|
|
53
54
|
try {
|
|
54
|
-
let n =
|
|
55
|
+
let n = pt();
|
|
55
56
|
return n.t(t) === t ? { t: (t, n) => {
|
|
56
57
|
let r = e[t] || t;
|
|
57
58
|
if (n) for (let [e, t] of Object.entries(n)) r = r.replace(`{{${e}}}`, String(t));
|
|
@@ -66,7 +67,7 @@ function Lt(e, t) {
|
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
|
-
var
|
|
70
|
+
var Vt = {
|
|
70
71
|
"detail.back": "Back",
|
|
71
72
|
"detail.edit": "Edit",
|
|
72
73
|
"detail.editInline": "Edit",
|
|
@@ -192,29 +193,29 @@ var Rt = {
|
|
|
192
193
|
"detail.concurrentUpdateReload": "Reload latest",
|
|
193
194
|
"detail.concurrentUpdateOverwrite": "Overwrite anyway",
|
|
194
195
|
"detail.concurrentUpdateCancel": "Cancel"
|
|
195
|
-
}, $ =
|
|
196
|
+
}, $ = Bt(Vt, "detail.back");
|
|
196
197
|
//#endregion
|
|
197
198
|
//#region src/DetailSection.tsx
|
|
198
|
-
function
|
|
199
|
+
function Ht(e, t) {
|
|
199
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" : "";
|
|
200
201
|
}
|
|
201
|
-
var
|
|
202
|
+
var Ut = /* @__PURE__ */ new Set([
|
|
202
203
|
"formula",
|
|
203
204
|
"summary",
|
|
204
205
|
"rollup",
|
|
205
206
|
"auto_number"
|
|
206
207
|
]);
|
|
207
|
-
function
|
|
208
|
+
function Wt(e) {
|
|
208
209
|
if (e == null) return e;
|
|
209
|
-
if (Array.isArray(e)) return e.map(
|
|
210
|
+
if (Array.isArray(e)) return e.map(Wt);
|
|
210
211
|
if (typeof e == "object") {
|
|
211
212
|
let t = e;
|
|
212
213
|
return t.id ?? t._id ?? t.value ?? "";
|
|
213
214
|
}
|
|
214
215
|
return e;
|
|
215
216
|
}
|
|
216
|
-
var
|
|
217
|
-
let [u, d] = i.useState(e.defaultCollapsed ?? !1), [f, p] = i.useState(null), [m, h] = i.useState(void 0), [g, _] = i.useState(!1), { t: v } = $(), { fieldLabel: y, translateOptions: b } =
|
|
217
|
+
var Gt = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, isEditing: o = !1, onFieldChange: s, dataSource: c, virtualScroll: l }) => {
|
|
218
|
+
let [u, d] = i.useState(e.defaultCollapsed ?? !1), [f, p] = i.useState(null), [m, h] = i.useState(void 0), [g, _] = i.useState(!1), { t: v } = $(), { fieldLabel: y, translateOptions: b } = _t(), k = i.useCallback((e, t) => {
|
|
218
219
|
let n = t == null ? "" : String(t);
|
|
219
220
|
navigator.clipboard.writeText(n).then(() => {
|
|
220
221
|
p(e), setTimeout(() => p(null), 2e3);
|
|
@@ -222,9 +223,9 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
222
223
|
}, []), A = i.useCallback((e) => {
|
|
223
224
|
let n = t?.[e.name] ?? e.value;
|
|
224
225
|
return n == null || n === "";
|
|
225
|
-
}, [t]), j = i.useMemo(() => e.fields.filter(A).length, [e.fields, A]), M =
|
|
226
|
-
if (
|
|
227
|
-
let { fields:
|
|
226
|
+
}, [t]), j = i.useMemo(() => e.fields.filter(A).length, [e.fields, A]), M = oe(), N = M ? 3 : 4, ee = M ? .2 : .25, te = e.fields.length - j, ne = !e.hideEmpty && !o && e.fields.length >= N && j / e.fields.length >= ee && te > 0, re = !g && (e.hideEmpty || ne) ? e.fields.filter((e) => !A(e)) : e.fields;
|
|
227
|
+
if (re.length === 0 && j === e.fields.length) return null;
|
|
228
|
+
let { fields: ie, columns: P } = zt(re, e.columns), F = (e) => {
|
|
228
229
|
let n = t?.[e.name] ?? e.value;
|
|
229
230
|
if (e.render) return /* @__PURE__ */ Z(at, {
|
|
230
231
|
schema: e.render,
|
|
@@ -233,11 +234,11 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
233
234
|
value: n
|
|
234
235
|
}
|
|
235
236
|
});
|
|
236
|
-
let i =
|
|
237
|
+
let i = Ht(e.span, P), l = r?.fields?.[e.name], u = { ...e };
|
|
237
238
|
if (l) {
|
|
238
|
-
!e.type && l.type && (u.type = l.type), l.options && !u.options && (u.options = l.options), l.currency && !u.currency && (u.currency = l.currency), l.precision !== void 0 && u.precision === void 0 && (u.precision = l.precision), l.format && !u.format && (u.format = l.format);
|
|
239
|
+
!e.type && l.type && (u.type = l.type), l.options && !u.options && (u.options = l.options), l.currency && !u.currency && (u.currency = l.currency), l.precision !== void 0 && u.precision === void 0 && (u.precision = l.precision), l.scale !== void 0 && u.scale === void 0 && (u.scale = l.scale), l.format && !u.format && (u.format = l.format);
|
|
239
240
|
let t = l.reference_to || l.reference;
|
|
240
|
-
t && !u.reference_to && (u.reference_to = t), l.reference_field && !u.reference_field && (u.reference_field = l.reference_field);
|
|
241
|
+
t && !u.reference_to && (u.reference_to = t), l.reference_field && !u.reference_field && (u.reference_field = l.reference_field), l.dueLike !== void 0 && u.dueLike === void 0 && (u.dueLike = l.dueLike);
|
|
241
242
|
}
|
|
242
243
|
a && Array.isArray(u.options) && u.options.length > 0 && (u.options = b(a, e.name, u.options));
|
|
243
244
|
let d = (() => {
|
|
@@ -247,9 +248,9 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
247
248
|
title: v("detail.noValue", { defaultValue: "No value" }),
|
|
248
249
|
children: "—"
|
|
249
250
|
});
|
|
250
|
-
let t =
|
|
251
|
+
let t = Et(u) || e.type;
|
|
251
252
|
if (t) {
|
|
252
|
-
let e =
|
|
253
|
+
let e = wt(t);
|
|
253
254
|
if (e) return /* @__PURE__ */ Z(e, {
|
|
254
255
|
value: n,
|
|
255
256
|
field: u
|
|
@@ -258,7 +259,7 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
258
259
|
return String(n);
|
|
259
260
|
})(), p = n != null && n !== "", m = f === e.name, h = y(a || "", e.name, e.label || e.name);
|
|
260
261
|
return M && !(o && !e.readonly) ? /* @__PURE__ */ Q("div", {
|
|
261
|
-
className:
|
|
262
|
+
className: G("flex items-baseline justify-between gap-4 py-2.5 min-h-[44px] group", p && "cursor-pointer active:bg-muted/40 transition-colors"),
|
|
262
263
|
onClick: p ? () => k(e.name, n) : void 0,
|
|
263
264
|
onKeyDown: p ? (t) => {
|
|
264
265
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), k(e.name, n));
|
|
@@ -273,7 +274,7 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
273
274
|
children: d
|
|
274
275
|
})]
|
|
275
276
|
}, e.name) : /* @__PURE__ */ Q("div", {
|
|
276
|
-
className:
|
|
277
|
+
className: G("space-y-1.5 group", i),
|
|
277
278
|
children: [/* @__PURE__ */ Z("div", {
|
|
278
279
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
279
280
|
children: y(a || "", e.name, e.label || e.name)
|
|
@@ -281,20 +282,20 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
281
282
|
className: "min-h-[44px] sm:min-h-0",
|
|
282
283
|
children: (() => {
|
|
283
284
|
let t = u.type || e.type;
|
|
284
|
-
if (t === "select" && Array.isArray(u.options) && u.options.length > 0) return /* @__PURE__ */ Z(
|
|
285
|
+
if (t === "select" && Array.isArray(u.options) && u.options.length > 0) return /* @__PURE__ */ Z(xt, {
|
|
285
286
|
field: u,
|
|
286
287
|
value: n == null ? "" : String(n),
|
|
287
288
|
onChange: (t) => s?.(e.name, t)
|
|
288
289
|
});
|
|
289
|
-
if (t === "boolean") return /* @__PURE__ */ Z(
|
|
290
|
+
if (t === "boolean") return /* @__PURE__ */ Z(vt, {
|
|
290
291
|
field: u,
|
|
291
292
|
value: !!n,
|
|
292
293
|
onChange: (t) => s?.(e.name, t)
|
|
293
294
|
});
|
|
294
|
-
let r = t === "user" || t === "owner", i = t === "lookup" || t === "master_detail" || t === "tree" || !!u.reference_to && !
|
|
295
|
-
if (r || i) return /* @__PURE__ */ Z(r ?
|
|
295
|
+
let r = t === "user" || t === "owner", i = t === "lookup" || t === "master_detail" || t === "tree" || !!u.reference_to && !Ut.has(t);
|
|
296
|
+
if (r || i) return /* @__PURE__ */ Z(r ? St : yt, {
|
|
296
297
|
field: u,
|
|
297
|
-
value:
|
|
298
|
+
value: Wt(n),
|
|
298
299
|
onChange: (t) => s?.(e.name, t),
|
|
299
300
|
dataSource: c
|
|
300
301
|
});
|
|
@@ -307,7 +308,7 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
307
308
|
if (/^\d{4}-\d{2}-\d{2}/.test(e)) return e.slice(0, 10);
|
|
308
309
|
let t = new Date(e);
|
|
309
310
|
return isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-CA");
|
|
310
|
-
})() : String(typeof n == "object" ?
|
|
311
|
+
})() : String(typeof n == "object" ? Ct(n) ?? "" : n),
|
|
311
312
|
onChange: (t) => {
|
|
312
313
|
let n = t.target.value;
|
|
313
314
|
if (a && n) {
|
|
@@ -318,7 +319,7 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
318
319
|
});
|
|
319
320
|
})()
|
|
320
321
|
}) : /* @__PURE__ */ Q("div", {
|
|
321
|
-
className:
|
|
322
|
+
className: G("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md", p && "cursor-pointer active:bg-muted/60 transition-colors"),
|
|
322
323
|
onClick: p ? () => k(e.name, n) : void 0,
|
|
323
324
|
onKeyDown: p ? (t) => {
|
|
324
325
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), k(e.name, n));
|
|
@@ -328,7 +329,7 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
328
329
|
children: [/* @__PURE__ */ Z("div", {
|
|
329
330
|
className: "text-sm flex-1 break-words py-1",
|
|
330
331
|
children: d
|
|
331
|
-
}), p && /* @__PURE__ */ Z(
|
|
332
|
+
}), p && /* @__PURE__ */ Z(ae, { children: /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
332
333
|
asChild: !0,
|
|
333
334
|
children: /* @__PURE__ */ Z(x, {
|
|
334
335
|
variant: "ghost",
|
|
@@ -342,31 +343,31 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
342
343
|
}), /* @__PURE__ */ Z(H, { children: v(m ? "detail.copied" : "detail.copyToClipboard") })] }) })]
|
|
343
344
|
})]
|
|
344
345
|
}, e.name);
|
|
345
|
-
},
|
|
346
|
+
}, I = l?.enabled === !0, L = l?.batchSize ?? 20;
|
|
346
347
|
i.useEffect(() => {
|
|
347
|
-
if (!
|
|
348
|
+
if (!I) {
|
|
348
349
|
h(void 0);
|
|
349
350
|
return;
|
|
350
351
|
}
|
|
351
|
-
if (
|
|
352
|
+
if (ie.length <= L) {
|
|
352
353
|
h(void 0);
|
|
353
354
|
return;
|
|
354
355
|
}
|
|
355
|
-
h(
|
|
356
|
+
h(L);
|
|
356
357
|
let e = setTimeout(() => h(void 0), 100);
|
|
357
358
|
return () => clearTimeout(e);
|
|
358
359
|
}, [
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
I,
|
|
361
|
+
ie.length,
|
|
362
|
+
L
|
|
362
363
|
]);
|
|
363
|
-
let
|
|
364
|
+
let R = m === void 0 ? ie : ie.slice(0, m), z = j > 0 && (e.hideEmpty || ne), B = /* @__PURE__ */ Q(Dt, { children: [M ? /* @__PURE__ */ Z("div", {
|
|
364
365
|
className: "flex flex-col divide-y divide-border/60",
|
|
365
|
-
children:
|
|
366
|
+
children: R.map(F)
|
|
366
367
|
}) : /* @__PURE__ */ Z("div", {
|
|
367
|
-
className:
|
|
368
|
-
children:
|
|
369
|
-
}),
|
|
368
|
+
className: G("grid gap-3 sm:gap-4", P === 1 ? "grid-cols-1" : P === 2 ? "grid-cols-1 md:grid-cols-2" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"),
|
|
369
|
+
children: R.map(F)
|
|
370
|
+
}), z && /* @__PURE__ */ Z("div", {
|
|
370
371
|
className: "mt-3 -ml-2",
|
|
371
372
|
children: /* @__PURE__ */ Q(x, {
|
|
372
373
|
type: "button",
|
|
@@ -374,14 +375,14 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
374
375
|
size: "sm",
|
|
375
376
|
onClick: () => _((e) => !e),
|
|
376
377
|
className: "h-7 px-2 text-xs text-muted-foreground hover:text-foreground",
|
|
377
|
-
children: [Z(g ?
|
|
378
|
+
children: [Z(g ? J : Oe, { className: "h-3.5 w-3.5 mr-1.5" }), g ? v("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : v("detail.showEmptyFields", {
|
|
378
379
|
count: j,
|
|
379
380
|
defaultValue: `Show ${j} empty field${j === 1 ? "" : "s"}`
|
|
380
381
|
})]
|
|
381
382
|
})
|
|
382
383
|
})] });
|
|
383
384
|
return !e.title && !e.collapsible && e.showBorder === !1 ? /* @__PURE__ */ Z("div", {
|
|
384
|
-
className:
|
|
385
|
+
className: G(n),
|
|
385
386
|
children: B
|
|
386
387
|
}) : e.collapsible ? /* @__PURE__ */ Z(E, {
|
|
387
388
|
open: !u,
|
|
@@ -390,7 +391,7 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
390
391
|
children: /* @__PURE__ */ Q(S, { children: [/* @__PURE__ */ Z(O, {
|
|
391
392
|
asChild: !0,
|
|
392
393
|
children: /* @__PURE__ */ Q(w, {
|
|
393
|
-
className:
|
|
394
|
+
className: G("py-3 px-4 sm:py-4 sm:px-6 cursor-pointer hover:bg-muted/50 transition-colors", e.headerColor && `bg-${e.headerColor}`),
|
|
394
395
|
children: [/* @__PURE__ */ Q(T, {
|
|
395
396
|
className: "flex items-center justify-between text-base font-semibold tracking-tight",
|
|
396
397
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -413,9 +414,9 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
413
414
|
children: B
|
|
414
415
|
}) })] })
|
|
415
416
|
}) : /* @__PURE__ */ Q(S, {
|
|
416
|
-
className:
|
|
417
|
+
className: G(e.showBorder === !1 ? "border-none shadow-none" : "", n),
|
|
417
418
|
children: [e.title && /* @__PURE__ */ Q(w, {
|
|
418
|
-
className:
|
|
419
|
+
className: G("py-3 px-4 sm:py-4 sm:px-6", e.headerColor && `bg-${e.headerColor}`),
|
|
419
420
|
children: [/* @__PURE__ */ Z(T, {
|
|
420
421
|
className: "flex items-center justify-between text-base font-semibold tracking-tight",
|
|
421
422
|
children: /* @__PURE__ */ Q("div", {
|
|
@@ -434,13 +435,13 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
434
435
|
children: B
|
|
435
436
|
})]
|
|
436
437
|
});
|
|
437
|
-
},
|
|
438
|
+
}, Kt = ({ tabs: e, data: t, className: n }) => {
|
|
438
439
|
let [r, a] = i.useState(e[0]?.key), o = e.filter((e) => typeof e.visible == "boolean" ? e.visible : (e.visible, !0));
|
|
439
|
-
return /* @__PURE__ */ Q(
|
|
440
|
+
return /* @__PURE__ */ Q(L, {
|
|
440
441
|
value: r,
|
|
441
442
|
onValueChange: a,
|
|
442
443
|
className: n,
|
|
443
|
-
children: [/* @__PURE__ */ Z(
|
|
444
|
+
children: [/* @__PURE__ */ Z(z, {
|
|
444
445
|
className: "w-full justify-start border-b rounded-none bg-transparent p-0",
|
|
445
446
|
children: o.map((e) => /* @__PURE__ */ Z(B, {
|
|
446
447
|
value: e.key,
|
|
@@ -458,7 +459,7 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
458
459
|
]
|
|
459
460
|
})
|
|
460
461
|
}, e.key))
|
|
461
|
-
}), o.map((e) => /* @__PURE__ */ Z(
|
|
462
|
+
}), o.map((e) => /* @__PURE__ */ Z(R, {
|
|
462
463
|
value: e.key,
|
|
463
464
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
464
465
|
children: /* @__PURE__ */ Z(i.Suspense, {
|
|
@@ -479,59 +480,66 @@ var Ht = ({ section: e, data: t, className: n, objectSchema: r, objectName: a, i
|
|
|
479
480
|
};
|
|
480
481
|
//#endregion
|
|
481
482
|
//#region src/RelatedList.tsx
|
|
482
|
-
function
|
|
483
|
-
return e && it[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ||
|
|
483
|
+
function qt(e) {
|
|
484
|
+
return e && it[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || Ne;
|
|
484
485
|
}
|
|
485
|
-
var
|
|
486
|
-
let
|
|
486
|
+
var Jt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className: s, dataSource: g, objectName: _, onNew: v, onViewAll: y, onRowEdit: E, onRowDelete: D, onRowClick: O, rowActions: k, onRowAction: j, add: M, maxColumns: N = 6, pageSize: ee, sortable: te = !1, filterable: ne = !1, collapsible: re = !1, defaultCollapsed: ie = !1, referenceField: P, parentId: F, icon: I }) => {
|
|
487
|
+
let L = r !== void 0, R = r ?? [], [z, B] = i.useState(R), [V, H] = i.useState(() => !!n && !L), [ae, U] = i.useState(0), [W, K] = i.useState(null), [se, ce] = i.useState("asc"), [le, ue] = i.useState(""), [q, fe] = i.useState(null), [pe, me] = i.useState(ie), [he, ge] = i.useState(!1), [_e, xe] = i.useState(!1), [Se, Ce] = i.useState(null), [we, Te] = i.useState(0), [Ee, Oe] = i.useState({}), { t: J } = $(), { fieldLabel: ke } = _t();
|
|
487
488
|
i.useEffect(() => {
|
|
488
|
-
|
|
489
|
-
}, [r,
|
|
490
|
-
n && g?.getObjectSchema && g.getObjectSchema(n).then(
|
|
489
|
+
L && B(r ?? []);
|
|
490
|
+
}, [r, L]), i.useEffect(() => {
|
|
491
|
+
n && g?.getObjectSchema && g.getObjectSchema(n).then(fe).catch((e) => {
|
|
491
492
|
console.warn(`[RelatedList] Failed to fetch schema for ${n}:`, e);
|
|
492
493
|
});
|
|
493
494
|
}, [n, g]), i.useEffect(() => {
|
|
494
|
-
if (n && !
|
|
495
|
+
if (n && !L) {
|
|
495
496
|
if (!(P && F != null && F !== "")) {
|
|
496
|
-
n && (F == null || F === "") && !P && console.warn(`[RelatedList] "${n}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`),
|
|
497
|
+
n && (F == null || F === "") && !P && console.warn(`[RelatedList] "${n}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`), B([]), H(!1);
|
|
497
498
|
return;
|
|
498
499
|
}
|
|
499
|
-
|
|
500
|
+
H(!0);
|
|
500
501
|
let e = { [P]: F };
|
|
501
502
|
if (g && typeof g.find == "function") g.find(n, { $filter: e }).then((e) => {
|
|
502
|
-
|
|
503
|
+
B(Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : []), H(!1);
|
|
503
504
|
}).catch((e) => {
|
|
504
|
-
console.error("Failed to fetch related data:", e),
|
|
505
|
+
console.error("Failed to fetch related data:", e), H(!1);
|
|
505
506
|
});
|
|
506
507
|
else {
|
|
507
508
|
let e = new URLSearchParams({ [`filter[${P}]`]: String(F) }).toString();
|
|
508
509
|
fetch(`${n}?${e}`).then((e) => e.json()).then((e) => {
|
|
509
|
-
|
|
510
|
+
B(Array.isArray(e) ? e : e?.data || []);
|
|
510
511
|
}).catch((e) => {
|
|
511
512
|
console.error("Failed to fetch related data:", e);
|
|
512
|
-
}).finally(() =>
|
|
513
|
+
}).finally(() => H(!1));
|
|
513
514
|
}
|
|
514
515
|
}
|
|
515
516
|
}, [
|
|
516
517
|
n,
|
|
517
|
-
|
|
518
|
+
L,
|
|
518
519
|
g,
|
|
519
520
|
P,
|
|
520
521
|
F,
|
|
521
|
-
|
|
522
|
+
we
|
|
522
523
|
]), i.useEffect(() => {
|
|
523
|
-
if (!
|
|
524
|
-
let e =
|
|
524
|
+
if (!n || L) return;
|
|
525
|
+
let e = (e) => {
|
|
526
|
+
let t = e.detail || {};
|
|
527
|
+
t.objectName && t.objectName !== n || Te((e) => e + 1);
|
|
528
|
+
};
|
|
529
|
+
return window.addEventListener("objectui:related-changed", e), () => window.removeEventListener("objectui:related-changed", e);
|
|
530
|
+
}, [n, L]), i.useEffect(() => {
|
|
531
|
+
if (!g?.find || !q?.fields || !z.length) return;
|
|
532
|
+
let e = q.fields, t = [];
|
|
525
533
|
for (let [n, r] of Object.entries(e)) {
|
|
526
534
|
if (!r || r.type !== "lookup" && r.type !== "master_detail") continue;
|
|
527
535
|
let e = r.reference_to || r.reference;
|
|
528
536
|
if (!e) continue;
|
|
529
537
|
let i = /* @__PURE__ */ new Set();
|
|
530
|
-
for (let e of
|
|
538
|
+
for (let e of z) {
|
|
531
539
|
let t = e?.[n];
|
|
532
540
|
t != null && (typeof t == "string" && t ? i.add(t) : typeof t == "number" && i.add(String(t)));
|
|
533
541
|
}
|
|
534
|
-
let a =
|
|
542
|
+
let a = Ee[n] || {}, o = Array.from(i).filter((e) => !(e in a));
|
|
535
543
|
o.length > 0 && t.push({
|
|
536
544
|
fieldName: n,
|
|
537
545
|
target: e,
|
|
@@ -557,7 +565,7 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
557
565
|
fieldName: e,
|
|
558
566
|
map: {}
|
|
559
567
|
})))).then((e) => {
|
|
560
|
-
n ||
|
|
568
|
+
n || Oe((t) => {
|
|
561
569
|
let n = { ...t };
|
|
562
570
|
for (let { fieldName: t, map: r } of e) n[t] = {
|
|
563
571
|
...n[t] || {},
|
|
@@ -570,83 +578,83 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
570
578
|
};
|
|
571
579
|
}, [
|
|
572
580
|
g,
|
|
573
|
-
|
|
574
|
-
|
|
581
|
+
q,
|
|
582
|
+
z
|
|
575
583
|
]);
|
|
576
|
-
let
|
|
577
|
-
if (!
|
|
578
|
-
let e =
|
|
579
|
-
return
|
|
580
|
-
}, [
|
|
581
|
-
let n = e[
|
|
584
|
+
let Ae = i.useMemo(() => {
|
|
585
|
+
if (!le) return z;
|
|
586
|
+
let e = le.toLowerCase();
|
|
587
|
+
return z.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
588
|
+
}, [z, le]), je = i.useMemo(() => W ? [...Ae].sort((e, t) => {
|
|
589
|
+
let n = e[W], r = t[W];
|
|
582
590
|
if (n == null && r == null) return 0;
|
|
583
591
|
if (n == null) return 1;
|
|
584
592
|
if (r == null) return -1;
|
|
585
593
|
let i = String(n).localeCompare(String(r), void 0, { numeric: !0 });
|
|
586
|
-
return
|
|
587
|
-
}) :
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
]),
|
|
594
|
+
return se === "asc" ? i : -i;
|
|
595
|
+
}) : Ae, [
|
|
596
|
+
Ae,
|
|
597
|
+
W,
|
|
598
|
+
se
|
|
599
|
+
]), Y = ee && ee > 0 ? ee : 0, Me = Y ? Math.max(1, Math.ceil(je.length / Y)) : 1, Ne = Y ? je.slice(ae * Y, (ae + 1) * Y) : je;
|
|
592
600
|
i.useEffect(() => {
|
|
593
|
-
|
|
601
|
+
U(0);
|
|
594
602
|
}, [
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
603
|
+
le,
|
|
604
|
+
W,
|
|
605
|
+
se
|
|
598
606
|
]);
|
|
599
|
-
let
|
|
600
|
-
|
|
601
|
-
}, [
|
|
602
|
-
|
|
603
|
-
}, []),
|
|
604
|
-
if (
|
|
605
|
-
await D?.(
|
|
607
|
+
let Pe = i.useCallback((e) => {
|
|
608
|
+
W === e ? ce((e) => e === "asc" ? "desc" : "asc") : (K(e), ce("asc"));
|
|
609
|
+
}, [W]), [Fe, Ie] = i.useState(null), Le = i.useCallback((e) => {
|
|
610
|
+
Ie(e);
|
|
611
|
+
}, []), Re = i.useCallback(async () => {
|
|
612
|
+
if (Fe) try {
|
|
613
|
+
await D?.(Fe), Te((e) => e + 1);
|
|
606
614
|
} catch (e) {
|
|
607
615
|
console.error("[RelatedList] remove failed", e);
|
|
608
616
|
}
|
|
609
|
-
|
|
610
|
-
}, [
|
|
611
|
-
if (!
|
|
612
|
-
let t =
|
|
613
|
-
|
|
617
|
+
Ie(null);
|
|
618
|
+
}, [Fe, D]), ze = i.useCallback(async (e) => {
|
|
619
|
+
if (!M || !g || !n || P == null || F == null) return;
|
|
620
|
+
let t = M.picker.valueField || "id";
|
|
621
|
+
xe(!0), Ce(null);
|
|
614
622
|
try {
|
|
615
623
|
for (let r of e || []) {
|
|
616
624
|
let e = r?.[t] ?? r?.id;
|
|
617
|
-
e != null && (
|
|
625
|
+
e != null && (M.linkField ? await g.create?.(n, {
|
|
618
626
|
[P]: F,
|
|
619
|
-
[
|
|
620
|
-
}) : await g.update?.(
|
|
627
|
+
[M.linkField]: e
|
|
628
|
+
}) : await g.update?.(M.picker.object, String(e), { [P]: F }));
|
|
621
629
|
}
|
|
622
|
-
|
|
630
|
+
Te((e) => e + 1);
|
|
623
631
|
} catch (e) {
|
|
624
632
|
let t = e?.body?.error ?? e?.error ?? e?.message ?? String(e);
|
|
625
|
-
|
|
633
|
+
Ce(typeof t == "string" ? t : "Failed to add");
|
|
626
634
|
} finally {
|
|
627
|
-
|
|
635
|
+
xe(!1), ge(!1);
|
|
628
636
|
}
|
|
629
637
|
}, [
|
|
630
|
-
|
|
638
|
+
M,
|
|
631
639
|
g,
|
|
632
640
|
n,
|
|
633
641
|
P,
|
|
634
642
|
F
|
|
635
|
-
]),
|
|
636
|
-
let e = _ || n || "", t = (t) => !
|
|
643
|
+
]), X = kt(), Be = i.useMemo(() => {
|
|
644
|
+
let e = _ || n || "", t = (t) => !X?.isLoaded || !e ? t : t.filter((t) => {
|
|
637
645
|
let n = t?.accessorKey || t?.field || t?.name;
|
|
638
|
-
return n ?
|
|
639
|
-
}), r = (e) => P ? e.filter((e) => (e?.accessorKey || e?.field || e?.name) !== P) : e, a = (e) => e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0, s = (e) =>
|
|
646
|
+
return n ? X.checkField(e, String(n), "read") : !0;
|
|
647
|
+
}), r = (e) => P ? e.filter((e) => (e?.accessorKey || e?.field || e?.name) !== P) : e, a = (e) => e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0, s = (e) => z.length ? e.filter((e) => {
|
|
640
648
|
let t = e?.accessorKey || e?.field || e?.name;
|
|
641
|
-
return t ?
|
|
649
|
+
return t ? z.some((e) => !a(e?.[t])) : !0;
|
|
642
650
|
}) : e, c = (e, t) => {
|
|
643
651
|
if (!t?.type) return;
|
|
644
|
-
let n =
|
|
652
|
+
let n = wt(Et({
|
|
645
653
|
type: t.type,
|
|
646
654
|
format: t.format
|
|
647
655
|
}) || t.type);
|
|
648
656
|
if (!n) return;
|
|
649
|
-
let r = t.type === "lookup" || t.type === "master_detail" ?
|
|
657
|
+
let r = t.type === "lookup" || t.type === "master_detail" ? Ee[e] : void 0, a = r && Object.keys(r).length > 0 ? Object.entries(r).map(([e, t]) => ({
|
|
650
658
|
value: e,
|
|
651
659
|
label: t
|
|
652
660
|
})) : void 0, o = {
|
|
@@ -656,6 +664,7 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
656
664
|
...(a || t.options) && { options: a || t.options },
|
|
657
665
|
...t.currency && { currency: t.currency },
|
|
658
666
|
...t.precision !== void 0 && { precision: t.precision },
|
|
667
|
+
...t.scale !== void 0 && { scale: t.scale },
|
|
659
668
|
...t.format && { format: t.format },
|
|
660
669
|
...(t.reference_to || t.reference) && { reference_to: t.reference_to || t.reference },
|
|
661
670
|
...t.reference_field && { reference_field: t.reference_field }
|
|
@@ -668,7 +677,7 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
668
677
|
if (typeof t != "string") {
|
|
669
678
|
let e = t?.accessorKey || t?.field || t?.name;
|
|
670
679
|
if (t && !t.cell && !t.render && e) {
|
|
671
|
-
let n =
|
|
680
|
+
let n = q?.fields?.[e], r = n ? c(String(e), n) : void 0;
|
|
672
681
|
if (r) return {
|
|
673
682
|
...t,
|
|
674
683
|
cell: r
|
|
@@ -676,24 +685,29 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
676
685
|
}
|
|
677
686
|
return t;
|
|
678
687
|
}
|
|
679
|
-
let n =
|
|
688
|
+
let n = q?.fields?.[t], r = {
|
|
680
689
|
accessorKey: t,
|
|
681
|
-
header: n?.label ||
|
|
690
|
+
header: n?.label || ke(e, t, n) || t,
|
|
682
691
|
fieldDef: n,
|
|
683
692
|
fieldType: n?.type
|
|
684
693
|
}, i = n ? c(t, n) : void 0;
|
|
685
694
|
return i && (r.cell = i), r;
|
|
686
695
|
};
|
|
687
696
|
if (o && o.length > 0) return s(t(r(o.map(l))));
|
|
688
|
-
if (!
|
|
689
|
-
let u = e
|
|
697
|
+
if (!q?.fields) return [];
|
|
698
|
+
let u = Array.isArray(q.highlightFields) ? q.highlightFields.filter((e) => typeof e == "string" && e.length > 0) : [];
|
|
699
|
+
if (u.length > 0) {
|
|
700
|
+
let e = s(t(r(u.map(l))));
|
|
701
|
+
if (e.length > 0) return e.slice(0, Math.max(1, N));
|
|
702
|
+
}
|
|
703
|
+
let d = e, f = /* @__PURE__ */ new Set([
|
|
690
704
|
"image",
|
|
691
705
|
"file",
|
|
692
706
|
"attachment",
|
|
693
707
|
"rich_text",
|
|
694
708
|
"html",
|
|
695
709
|
"json"
|
|
696
|
-
]),
|
|
710
|
+
]), p = [
|
|
697
711
|
"name",
|
|
698
712
|
"full_name",
|
|
699
713
|
"fullname",
|
|
@@ -702,7 +716,7 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
702
716
|
"label",
|
|
703
717
|
"code",
|
|
704
718
|
"number"
|
|
705
|
-
],
|
|
719
|
+
], m = Object.entries(q.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === P || t?.hidden || t?.type && f.has(t.type) || X?.isLoaded && d && !X.checkField(d, e, "read"))), h = /* @__PURE__ */ new Set([
|
|
706
720
|
"created_at",
|
|
707
721
|
"updated_at",
|
|
708
722
|
"created_by",
|
|
@@ -710,42 +724,42 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
710
724
|
"owner_id",
|
|
711
725
|
"organization_id"
|
|
712
726
|
]);
|
|
713
|
-
return
|
|
714
|
-
let i =
|
|
715
|
-
if (i !==
|
|
716
|
-
let a =
|
|
727
|
+
return m.sort(([e, t], [n, r]) => {
|
|
728
|
+
let i = h.has(e);
|
|
729
|
+
if (i !== h.has(n)) return i ? 1 : -1;
|
|
730
|
+
let a = p.indexOf(e), o = p.indexOf(n), s = a >= 0 ? a : 100, c = o >= 0 ? o : 100;
|
|
717
731
|
if (s !== c) return s - c;
|
|
718
732
|
let l = t?.type === "select" || e.includes("status");
|
|
719
733
|
return l === (r?.type === "select" || n.includes("status")) ? 0 : l ? -1 : 1;
|
|
720
|
-
}), s(
|
|
734
|
+
}), s(m.map(([e, t]) => {
|
|
721
735
|
let n = {
|
|
722
736
|
accessorKey: e,
|
|
723
|
-
header:
|
|
737
|
+
header: ke(d, e, t.label || e)
|
|
724
738
|
};
|
|
725
739
|
if (t.type) {
|
|
726
740
|
let r = c(e, t);
|
|
727
741
|
r && (n.cell = r);
|
|
728
742
|
}
|
|
729
743
|
return n;
|
|
730
|
-
})).slice(0, Math.max(1,
|
|
744
|
+
})).slice(0, Math.max(1, N));
|
|
731
745
|
}, [
|
|
732
746
|
o,
|
|
733
|
-
|
|
747
|
+
q,
|
|
734
748
|
_,
|
|
735
749
|
n,
|
|
736
|
-
|
|
750
|
+
ke,
|
|
737
751
|
P,
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
]),
|
|
752
|
+
z,
|
|
753
|
+
N,
|
|
754
|
+
Ee,
|
|
755
|
+
X
|
|
756
|
+
]), Ve = Array.isArray(k) && k.length > 0, He = !!E || !!D || Ve, Ue = oe(), We = i.useMemo(() => {
|
|
743
757
|
if (a) return a;
|
|
744
|
-
if (
|
|
745
|
-
let e =
|
|
758
|
+
if (Ue && (t === "grid" || t === "table")) {
|
|
759
|
+
let e = Be[0]?.accessorKey || Be[0]?.field || Be[0]?.name, t = Be.slice(1, 4).map((e) => e.accessorKey || e.field || e.name).filter(Boolean);
|
|
746
760
|
return {
|
|
747
761
|
type: "object-gallery",
|
|
748
|
-
data:
|
|
762
|
+
data: Ne,
|
|
749
763
|
objectName: n,
|
|
750
764
|
gallery: {
|
|
751
765
|
titleField: e || "name",
|
|
@@ -759,20 +773,22 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
759
773
|
case "grid":
|
|
760
774
|
case "table": return {
|
|
761
775
|
type: "data-table",
|
|
762
|
-
data:
|
|
763
|
-
columns:
|
|
776
|
+
data: Ne,
|
|
777
|
+
columns: Be,
|
|
764
778
|
pagination: !1,
|
|
765
|
-
pageSize:
|
|
779
|
+
pageSize: Y || 10,
|
|
766
780
|
searchable: !1,
|
|
767
781
|
exportable: !1,
|
|
768
|
-
rowActions:
|
|
782
|
+
rowActions: He,
|
|
769
783
|
onRowEdit: E,
|
|
770
|
-
onRowDelete: D ?
|
|
771
|
-
onRowClick: O
|
|
784
|
+
onRowDelete: D ? Le : void 0,
|
|
785
|
+
onRowClick: O,
|
|
786
|
+
rowActionDefs: Ve ? k : void 0,
|
|
787
|
+
onRowActionDef: Ve ? j : void 0
|
|
772
788
|
};
|
|
773
789
|
case "list": return {
|
|
774
790
|
type: "data-list",
|
|
775
|
-
data:
|
|
791
|
+
data: Ne
|
|
776
792
|
};
|
|
777
793
|
default: return {
|
|
778
794
|
type: "div",
|
|
@@ -781,62 +797,65 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
781
797
|
}
|
|
782
798
|
}, [
|
|
783
799
|
t,
|
|
784
|
-
|
|
785
|
-
|
|
800
|
+
Ne,
|
|
801
|
+
Be,
|
|
786
802
|
a,
|
|
787
|
-
|
|
788
|
-
|
|
803
|
+
Y,
|
|
804
|
+
He,
|
|
805
|
+
Ve,
|
|
806
|
+
k,
|
|
807
|
+
j,
|
|
789
808
|
E,
|
|
790
809
|
D,
|
|
791
|
-
|
|
810
|
+
Le,
|
|
792
811
|
O,
|
|
793
|
-
|
|
812
|
+
Ue,
|
|
794
813
|
n
|
|
795
|
-
]),
|
|
814
|
+
]), Ge = re ? "cursor-pointer select-none" : void 0, qe = re ? () => me((e) => !e) : void 0, Je = qt(I), Ye = !V && z.length === 0, Xe = ne;
|
|
796
815
|
return /* @__PURE__ */ Q(S, {
|
|
797
|
-
className:
|
|
816
|
+
className: G("shadow-none border-border/60 bg-transparent", Ye && "bg-muted/10", s),
|
|
798
817
|
children: [
|
|
799
818
|
/* @__PURE__ */ Z(w, {
|
|
800
|
-
className:
|
|
801
|
-
onClick:
|
|
819
|
+
className: G("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", Ge),
|
|
820
|
+
onClick: qe,
|
|
802
821
|
children: /* @__PURE__ */ Q(T, {
|
|
803
822
|
className: "flex items-center justify-between gap-2 text-sm font-semibold",
|
|
804
823
|
children: [/* @__PURE__ */ Q("div", {
|
|
805
824
|
className: "flex items-center gap-2 min-w-0",
|
|
806
825
|
children: [
|
|
807
|
-
|
|
808
|
-
/* @__PURE__ */ Z(
|
|
826
|
+
re && Z(pe ? be : ve, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
|
|
827
|
+
/* @__PURE__ */ Z(Je, {
|
|
809
828
|
className: "h-4 w-4 text-muted-foreground shrink-0",
|
|
810
829
|
"aria-hidden": !0
|
|
811
830
|
}),
|
|
812
831
|
/* @__PURE__ */ Z("span", {
|
|
813
|
-
className:
|
|
832
|
+
className: G("truncate", Ye && "text-muted-foreground font-medium"),
|
|
814
833
|
children: e
|
|
815
834
|
}),
|
|
816
835
|
/* @__PURE__ */ Z(b, {
|
|
817
836
|
variant: "secondary",
|
|
818
|
-
className:
|
|
819
|
-
"aria-label": `${
|
|
820
|
-
children:
|
|
837
|
+
className: G("text-xs font-normal h-5 px-1.5", z.length === 0 && "bg-muted text-muted-foreground"),
|
|
838
|
+
"aria-label": `${z.length} records`,
|
|
839
|
+
children: z.length
|
|
821
840
|
}),
|
|
822
|
-
|
|
841
|
+
Ye && /* @__PURE__ */ Z("span", {
|
|
823
842
|
className: "text-xs text-muted-foreground/70 italic ml-1 truncate",
|
|
824
843
|
children: J("detail.noRelatedRecords")
|
|
825
844
|
})
|
|
826
845
|
]
|
|
827
846
|
}), /* @__PURE__ */ Q("div", {
|
|
828
847
|
className: "flex items-center gap-1 shrink-0",
|
|
829
|
-
children: [
|
|
830
|
-
variant:
|
|
848
|
+
children: [M && /* @__PURE__ */ Q(x, {
|
|
849
|
+
variant: Ye ? "ghost" : "outline",
|
|
831
850
|
size: "sm",
|
|
832
|
-
disabled:
|
|
851
|
+
disabled: _e,
|
|
833
852
|
onClick: (e) => {
|
|
834
|
-
e.stopPropagation(),
|
|
853
|
+
e.stopPropagation(), Ce(null), ge(!0);
|
|
835
854
|
},
|
|
836
855
|
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
837
|
-
children: [/* @__PURE__ */ Z(Ke, { className: "h-3.5 w-3.5" }),
|
|
856
|
+
children: [/* @__PURE__ */ Z(Ke, { className: "h-3.5 w-3.5" }), M.label || J("detail.add", { defaultValue: "Add" })]
|
|
838
857
|
}), v && /* @__PURE__ */ Q(x, {
|
|
839
|
-
variant:
|
|
858
|
+
variant: Ye ? "ghost" : "outline",
|
|
840
859
|
size: "sm",
|
|
841
860
|
onClick: (e) => {
|
|
842
861
|
e.stopPropagation(), v();
|
|
@@ -847,70 +866,70 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
847
866
|
})]
|
|
848
867
|
})
|
|
849
868
|
}),
|
|
850
|
-
!
|
|
851
|
-
className:
|
|
869
|
+
!pe && !Ye && /* @__PURE__ */ Q(C, {
|
|
870
|
+
className: G("pt-0 pb-4 px-4"),
|
|
852
871
|
children: [
|
|
853
|
-
|
|
872
|
+
Xe && /* @__PURE__ */ Z("div", {
|
|
854
873
|
className: "mb-3",
|
|
855
874
|
children: /* @__PURE__ */ Z(A, {
|
|
856
875
|
placeholder: J("detail.filterPlaceholder"),
|
|
857
|
-
value:
|
|
858
|
-
onChange: (e) =>
|
|
876
|
+
value: le,
|
|
877
|
+
onChange: (e) => ue(e.target.value),
|
|
859
878
|
className: "h-8 text-sm"
|
|
860
879
|
})
|
|
861
880
|
}),
|
|
862
|
-
|
|
881
|
+
te && Be && Be.length > 0 && z.length > 0 && /* @__PURE__ */ Z("div", {
|
|
863
882
|
className: "flex flex-wrap gap-1 mb-3",
|
|
864
|
-
children:
|
|
883
|
+
children: Be.map((e) => {
|
|
865
884
|
let t = e.accessorKey || e.field || e.name;
|
|
866
885
|
if (!t) return null;
|
|
867
|
-
let n = e.header || e.label || t, r =
|
|
886
|
+
let n = e.header || e.label || t, r = W === t;
|
|
868
887
|
return /* @__PURE__ */ Q(x, {
|
|
869
888
|
variant: r ? "secondary" : "ghost",
|
|
870
889
|
size: "sm",
|
|
871
890
|
className: "gap-1 h-7 text-xs",
|
|
872
|
-
onClick: () =>
|
|
891
|
+
onClick: () => Pe(t),
|
|
873
892
|
children: [
|
|
874
|
-
/* @__PURE__ */ Z(
|
|
893
|
+
/* @__PURE__ */ Z(de, { className: "h-3 w-3" }),
|
|
875
894
|
n,
|
|
876
|
-
r && (
|
|
895
|
+
r && (se === "asc" ? " ↑" : " ↓")
|
|
877
896
|
]
|
|
878
897
|
}, t);
|
|
879
898
|
})
|
|
880
899
|
}),
|
|
881
|
-
|
|
900
|
+
V ? /* @__PURE__ */ Z("div", {
|
|
882
901
|
className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
|
|
883
902
|
children: J("detail.loading")
|
|
884
|
-
}) : /* @__PURE__ */ Z(at, { schema:
|
|
885
|
-
|
|
903
|
+
}) : /* @__PURE__ */ Z(at, { schema: We }),
|
|
904
|
+
Y > 0 && je.length > Y && /* @__PURE__ */ Q("div", {
|
|
886
905
|
className: "flex items-center justify-between mt-3 pt-3 border-t",
|
|
887
906
|
children: [
|
|
888
907
|
/* @__PURE__ */ Q(x, {
|
|
889
908
|
variant: "outline",
|
|
890
909
|
size: "sm",
|
|
891
910
|
className: "h-7 text-xs gap-1",
|
|
892
|
-
disabled:
|
|
893
|
-
onClick: () =>
|
|
911
|
+
disabled: ae === 0,
|
|
912
|
+
onClick: () => U((e) => Math.max(0, e - 1)),
|
|
894
913
|
children: [/* @__PURE__ */ Z(ye, { className: "h-3 w-3" }), J("detail.previousPage")]
|
|
895
914
|
}),
|
|
896
915
|
/* @__PURE__ */ Z("span", {
|
|
897
916
|
className: "text-xs text-muted-foreground",
|
|
898
917
|
children: J("detail.pageOf", {
|
|
899
|
-
current:
|
|
900
|
-
total:
|
|
918
|
+
current: ae + 1,
|
|
919
|
+
total: Me
|
|
901
920
|
})
|
|
902
921
|
}),
|
|
903
922
|
/* @__PURE__ */ Q(x, {
|
|
904
923
|
variant: "outline",
|
|
905
924
|
size: "sm",
|
|
906
925
|
className: "h-7 text-xs gap-1",
|
|
907
|
-
disabled:
|
|
908
|
-
onClick: () =>
|
|
926
|
+
disabled: ae >= Me - 1,
|
|
927
|
+
onClick: () => U((e) => Math.min(Me - 1, e + 1)),
|
|
909
928
|
children: [J("detail.nextPage"), /* @__PURE__ */ Z(be, { className: "h-3 w-3" })]
|
|
910
929
|
})
|
|
911
930
|
]
|
|
912
931
|
}),
|
|
913
|
-
y && !
|
|
932
|
+
y && !Ye && Y > 0 && je.length > Y && /* @__PURE__ */ Z("div", {
|
|
914
933
|
className: "mt-3 pt-3 border-t flex justify-center",
|
|
915
934
|
children: /* @__PURE__ */ Q("button", {
|
|
916
935
|
type: "button",
|
|
@@ -918,45 +937,45 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
918
937
|
e.stopPropagation(), y();
|
|
919
938
|
},
|
|
920
939
|
className: "text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors",
|
|
921
|
-
children: [J("detail.viewAll"), /* @__PURE__ */ Z(
|
|
940
|
+
children: [J("detail.viewAll"), /* @__PURE__ */ Z(De, { className: "h-3 w-3" })]
|
|
922
941
|
})
|
|
923
942
|
})
|
|
924
943
|
]
|
|
925
944
|
}),
|
|
926
945
|
/* @__PURE__ */ Z(c, {
|
|
927
|
-
open:
|
|
946
|
+
open: Fe !== null,
|
|
928
947
|
onOpenChange: (e) => {
|
|
929
|
-
e ||
|
|
948
|
+
e || Ie(null);
|
|
930
949
|
},
|
|
931
950
|
children: /* @__PURE__ */ Q(d, { children: [/* @__PURE__ */ Q(m, { children: [/* @__PURE__ */ Z(h, { children: J("detail.deleteRowTitle", { defaultValue: "Delete record" }) }), /* @__PURE__ */ Z(f, { children: J("detail.deleteRowConfirmation") })] }), /* @__PURE__ */ Q(p, { children: [/* @__PURE__ */ Z(u, { children: J("detail.cancel", { defaultValue: "Cancel" }) }), /* @__PURE__ */ Z(l, {
|
|
932
|
-
onClick:
|
|
951
|
+
onClick: Re,
|
|
933
952
|
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
934
953
|
children: J("detail.delete", { defaultValue: "Delete" })
|
|
935
954
|
})] })] })
|
|
936
955
|
}),
|
|
937
|
-
|
|
956
|
+
Se && /* @__PURE__ */ Z("div", {
|
|
938
957
|
className: "mx-4 mb-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
|
|
939
958
|
role: "alert",
|
|
940
|
-
children:
|
|
959
|
+
children: Se
|
|
941
960
|
}),
|
|
942
|
-
|
|
943
|
-
open:
|
|
944
|
-
onOpenChange: (e) =>
|
|
961
|
+
M && g && /* @__PURE__ */ Z(bt, {
|
|
962
|
+
open: he,
|
|
963
|
+
onOpenChange: (e) => ge(e),
|
|
945
964
|
multiple: !0,
|
|
946
965
|
dataSource: g,
|
|
947
|
-
objectName:
|
|
948
|
-
title:
|
|
966
|
+
objectName: M.picker.object,
|
|
967
|
+
title: M.label || J("detail.add", { defaultValue: "Add" }),
|
|
949
968
|
onSelect: () => {},
|
|
950
969
|
onSelectRecords: (e) => {
|
|
951
|
-
|
|
970
|
+
ze(e);
|
|
952
971
|
}
|
|
953
972
|
})
|
|
954
973
|
]
|
|
955
974
|
});
|
|
956
|
-
},
|
|
975
|
+
}, Yt = ({ group: e, data: t, className: n, objectSchema: r, objectName: a, isEditing: o = !1, onFieldChange: s, dataSource: c }) => {
|
|
957
976
|
let l = e.collapsible ?? !0, [u, d] = i.useState(e.defaultCollapsed ?? !1), f = /* @__PURE__ */ Z("div", {
|
|
958
977
|
className: "space-y-3 sm:space-y-4",
|
|
959
|
-
children: e.sections.map((e, n) => /* @__PURE__ */ Z(
|
|
978
|
+
children: e.sections.map((e, n) => /* @__PURE__ */ Z(Gt, {
|
|
960
979
|
section: e,
|
|
961
980
|
data: t,
|
|
962
981
|
objectSchema: r,
|
|
@@ -998,7 +1017,7 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
998
1017
|
}) })
|
|
999
1018
|
]
|
|
1000
1019
|
}) : /* @__PURE__ */ Q("div", {
|
|
1001
|
-
className:
|
|
1020
|
+
className: G("space-y-3", n),
|
|
1002
1021
|
children: [
|
|
1003
1022
|
/* @__PURE__ */ Q("div", {
|
|
1004
1023
|
className: "flex items-center gap-2 pb-2 border-b",
|
|
@@ -1017,18 +1036,18 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
1017
1036
|
f
|
|
1018
1037
|
]
|
|
1019
1038
|
});
|
|
1020
|
-
},
|
|
1021
|
-
let { fieldLabel: a } =
|
|
1039
|
+
}, Xt = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
|
|
1040
|
+
let { fieldLabel: a } = _t();
|
|
1022
1041
|
if (!e.length || !t) return null;
|
|
1023
1042
|
let o = e.filter((e) => {
|
|
1024
1043
|
let n = t?.[e.name];
|
|
1025
1044
|
return n != null && n !== "";
|
|
1026
1045
|
});
|
|
1027
1046
|
return o.length === 0 ? null : /* @__PURE__ */ Z("section", {
|
|
1028
|
-
className:
|
|
1047
|
+
className: G("@container border-b border-border/60 pb-4", n),
|
|
1029
1048
|
"aria-label": "Record highlights",
|
|
1030
1049
|
children: /* @__PURE__ */ Z("div", {
|
|
1031
|
-
className:
|
|
1050
|
+
className: G("flex flex-wrap gap-y-4"),
|
|
1032
1051
|
children: o.map((e) => {
|
|
1033
1052
|
let n = t[e.name], o = i?.fields?.[e.name], s = e.type || o?.type, c = {
|
|
1034
1053
|
name: e.name,
|
|
@@ -1037,12 +1056,13 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
1037
1056
|
...o?.options && { options: o.options },
|
|
1038
1057
|
...o?.currency && { currency: o.currency },
|
|
1039
1058
|
...o?.precision !== void 0 && { precision: o.precision },
|
|
1059
|
+
...o?.scale !== void 0 && { scale: o.scale },
|
|
1040
1060
|
...o?.format && { format: o.format }
|
|
1041
|
-
}, l =
|
|
1061
|
+
}, l = wt(Et(c) || s || "text"), u = s === "number" || s === "integer" || s === "currency" || s === "percent" || s === "decimal", d = s === "email" || s === "url" || s === "textarea" || s === "reference" || s === "lookup" || s === "master_detail", f = s === "boolean";
|
|
1042
1062
|
return /* @__PURE__ */ Q("div", {
|
|
1043
|
-
className:
|
|
1063
|
+
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]"),
|
|
1044
1064
|
children: [/* @__PURE__ */ Z("span", {
|
|
1045
|
-
className: "text-xs font-medium text-muted-foreground
|
|
1065
|
+
className: "text-xs font-medium text-muted-foreground",
|
|
1046
1066
|
children: a(r || "", e.name, e.label)
|
|
1047
1067
|
}), f ? n ? /* @__PURE__ */ Q("span", {
|
|
1048
1068
|
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",
|
|
@@ -1057,7 +1077,8 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
1057
1077
|
"aria-hidden": !0
|
|
1058
1078
|
}), "No"]
|
|
1059
1079
|
}) : /* @__PURE__ */ Z("span", {
|
|
1060
|
-
|
|
1080
|
+
title: typeof n == "string" ? n : void 0,
|
|
1081
|
+
className: G("block min-w-0 truncate text-sm font-semibold", u && "tabular-nums tracking-tight"),
|
|
1061
1082
|
children: /* @__PURE__ */ Z(l, {
|
|
1062
1083
|
value: n,
|
|
1063
1084
|
field: c
|
|
@@ -1070,7 +1091,7 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
1070
1091
|
};
|
|
1071
1092
|
//#endregion
|
|
1072
1093
|
//#region src/RecordComments.tsx
|
|
1073
|
-
function
|
|
1094
|
+
function Zt(e) {
|
|
1074
1095
|
try {
|
|
1075
1096
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1076
1097
|
if (r < 1) return "just now";
|
|
@@ -1083,7 +1104,7 @@ function Jt(e) {
|
|
|
1083
1104
|
return e;
|
|
1084
1105
|
}
|
|
1085
1106
|
}
|
|
1086
|
-
var
|
|
1107
|
+
var Qt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, className: a }) => {
|
|
1087
1108
|
let { t: o } = $(), [s, c] = i.useState(""), [l, u] = i.useState(!1), [d, f] = i.useState(""), p = i.useCallback(async () => {
|
|
1088
1109
|
let e = s.trim();
|
|
1089
1110
|
if (!(!e || !t)) {
|
|
@@ -1101,11 +1122,11 @@ var Yt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1101
1122
|
return e.text.toLowerCase().includes(t) || e.author.toLowerCase().includes(t);
|
|
1102
1123
|
}) : e].sort((e, t) => e.pinned && !t.pinned ? -1 : !e.pinned && t.pinned ? 1 : 0), [e, d]);
|
|
1103
1124
|
return /* @__PURE__ */ Q(S, {
|
|
1104
|
-
className:
|
|
1125
|
+
className: G("", a),
|
|
1105
1126
|
children: [/* @__PURE__ */ Z(w, { children: /* @__PURE__ */ Q(T, {
|
|
1106
1127
|
className: "flex items-center gap-2 text-base",
|
|
1107
1128
|
children: [
|
|
1108
|
-
/* @__PURE__ */ Z(
|
|
1129
|
+
/* @__PURE__ */ Z(X, { className: "h-4 w-4" }),
|
|
1109
1130
|
o("detail.comments"),
|
|
1110
1131
|
/* @__PURE__ */ Q("span", {
|
|
1111
1132
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1166,7 +1187,7 @@ var Yt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1166
1187
|
}) : /* @__PURE__ */ Z("div", {
|
|
1167
1188
|
className: "space-y-3",
|
|
1168
1189
|
children: h.map((e) => /* @__PURE__ */ Q("div", {
|
|
1169
|
-
className:
|
|
1190
|
+
className: G("flex gap-3", e.pinned && "bg-muted/40 rounded-md p-2 -mx-2"),
|
|
1170
1191
|
children: [/* @__PURE__ */ Z("div", {
|
|
1171
1192
|
className: "shrink-0",
|
|
1172
1193
|
children: e.avatarUrl ? /* @__PURE__ */ Z("img", {
|
|
@@ -1189,7 +1210,7 @@ var Yt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1189
1210
|
}),
|
|
1190
1211
|
/* @__PURE__ */ Z("span", {
|
|
1191
1212
|
className: "text-xs text-muted-foreground",
|
|
1192
|
-
children:
|
|
1213
|
+
children: Zt(e.createdAt)
|
|
1193
1214
|
}),
|
|
1194
1215
|
e.pinned && /* @__PURE__ */ Q("span", {
|
|
1195
1216
|
className: "text-xs text-amber-600 flex items-center gap-0.5",
|
|
@@ -1215,20 +1236,20 @@ var Yt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1215
1236
|
]
|
|
1216
1237
|
})]
|
|
1217
1238
|
});
|
|
1218
|
-
},
|
|
1219
|
-
field_change:
|
|
1239
|
+
}, $t = {
|
|
1240
|
+
field_change: Ee,
|
|
1220
1241
|
create: qe,
|
|
1221
1242
|
delete: et,
|
|
1222
|
-
comment:
|
|
1243
|
+
comment: X,
|
|
1223
1244
|
status_change: ue
|
|
1224
|
-
},
|
|
1245
|
+
}, en = {
|
|
1225
1246
|
field_change: "bg-blue-100 text-blue-600",
|
|
1226
1247
|
create: "bg-green-100 text-green-600",
|
|
1227
1248
|
delete: "bg-red-100 text-red-600",
|
|
1228
1249
|
comment: "bg-purple-100 text-purple-600",
|
|
1229
1250
|
status_change: "bg-amber-100 text-amber-600"
|
|
1230
1251
|
};
|
|
1231
|
-
function
|
|
1252
|
+
function tn(e) {
|
|
1232
1253
|
try {
|
|
1233
1254
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1234
1255
|
if (r < 1) return "just now";
|
|
@@ -1241,24 +1262,24 @@ function Qt(e) {
|
|
|
1241
1262
|
return e;
|
|
1242
1263
|
}
|
|
1243
1264
|
}
|
|
1244
|
-
function
|
|
1265
|
+
function nn(e) {
|
|
1245
1266
|
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";
|
|
1246
1267
|
}
|
|
1247
|
-
var
|
|
1268
|
+
var rn = {
|
|
1248
1269
|
all: "All",
|
|
1249
1270
|
field_change: "Field Changes",
|
|
1250
1271
|
create: "Creates",
|
|
1251
1272
|
delete: "Deletes",
|
|
1252
1273
|
comment: "Comments",
|
|
1253
1274
|
status_change: "Status Changes"
|
|
1254
|
-
},
|
|
1275
|
+
}, an = ({ activities: e, filterable: t = !1, defaultFilter: n = "all", className: r }) => {
|
|
1255
1276
|
let [a, o] = i.useState(n), s = i.useMemo(() => a === "all" ? e : e.filter((e) => e.type === a), [e, a]);
|
|
1256
1277
|
return /* @__PURE__ */ Q(S, {
|
|
1257
|
-
className:
|
|
1278
|
+
className: G("", r),
|
|
1258
1279
|
children: [/* @__PURE__ */ Z(w, { children: /* @__PURE__ */ Q(T, {
|
|
1259
1280
|
className: "flex items-center gap-2 text-base",
|
|
1260
1281
|
children: [
|
|
1261
|
-
/* @__PURE__ */ Z(
|
|
1282
|
+
/* @__PURE__ */ Z(K, { className: "h-4 w-4" }),
|
|
1262
1283
|
"Activity",
|
|
1263
1284
|
/* @__PURE__ */ Q("span", {
|
|
1264
1285
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1273,12 +1294,12 @@ var en = {
|
|
|
1273
1294
|
className: "flex flex-wrap gap-1.5 mb-4",
|
|
1274
1295
|
role: "group",
|
|
1275
1296
|
"aria-label": "Activity type filter",
|
|
1276
|
-
children: Object.keys(
|
|
1297
|
+
children: Object.keys(rn).map((e) => /* @__PURE__ */ Q("button", {
|
|
1277
1298
|
type: "button",
|
|
1278
|
-
className:
|
|
1299
|
+
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"),
|
|
1279
1300
|
onClick: () => o(e),
|
|
1280
1301
|
"aria-pressed": a === e,
|
|
1281
|
-
children: [e !== "all" && i.createElement(
|
|
1302
|
+
children: [e !== "all" && i.createElement($t[e] || Ee, { className: "h-3 w-3" }), rn[e]]
|
|
1282
1303
|
}, e))
|
|
1283
1304
|
}), s.length === 0 ? /* @__PURE__ */ Z(k, {
|
|
1284
1305
|
title: "No activity recorded",
|
|
@@ -1288,11 +1309,11 @@ var en = {
|
|
|
1288
1309
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
1289
1310
|
className: "space-y-4",
|
|
1290
1311
|
children: s.map((e) => {
|
|
1291
|
-
let t =
|
|
1312
|
+
let t = $t[e.type] || Ee;
|
|
1292
1313
|
return /* @__PURE__ */ Q("div", {
|
|
1293
1314
|
className: "flex gap-3 relative",
|
|
1294
1315
|
children: [/* @__PURE__ */ Z("div", {
|
|
1295
|
-
className:
|
|
1316
|
+
className: G("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", en[e.type] || "bg-gray-100 text-gray-600"),
|
|
1296
1317
|
children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
|
|
1297
1318
|
}), /* @__PURE__ */ Q("div", {
|
|
1298
1319
|
className: "flex-1 min-w-0 pt-1",
|
|
@@ -1306,12 +1327,12 @@ var en = {
|
|
|
1306
1327
|
" ",
|
|
1307
1328
|
/* @__PURE__ */ Z("span", {
|
|
1308
1329
|
className: "text-muted-foreground",
|
|
1309
|
-
children:
|
|
1330
|
+
children: nn(e)
|
|
1310
1331
|
})
|
|
1311
1332
|
]
|
|
1312
1333
|
}), /* @__PURE__ */ Z("p", {
|
|
1313
1334
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
1314
|
-
children:
|
|
1335
|
+
children: tn(e.timestamp)
|
|
1315
1336
|
})]
|
|
1316
1337
|
})]
|
|
1317
1338
|
}, e.id);
|
|
@@ -1319,7 +1340,7 @@ var en = {
|
|
|
1319
1340
|
})]
|
|
1320
1341
|
})] })]
|
|
1321
1342
|
});
|
|
1322
|
-
},
|
|
1343
|
+
}, on = {
|
|
1323
1344
|
create: "default",
|
|
1324
1345
|
update: "secondary",
|
|
1325
1346
|
delete: "destructive",
|
|
@@ -1331,12 +1352,12 @@ var en = {
|
|
|
1331
1352
|
export: "outline",
|
|
1332
1353
|
import: "outline"
|
|
1333
1354
|
};
|
|
1334
|
-
function
|
|
1355
|
+
function sn(e) {
|
|
1335
1356
|
if (!e) return "";
|
|
1336
1357
|
let t = e instanceof Date ? e : new Date(e);
|
|
1337
1358
|
return Number.isNaN(t.getTime()) ? String(e) : t.toLocaleString();
|
|
1338
1359
|
}
|
|
1339
|
-
var
|
|
1360
|
+
var cn = [
|
|
1340
1361
|
[60, "second"],
|
|
1341
1362
|
[60, "minute"],
|
|
1342
1363
|
[24, "hour"],
|
|
@@ -1345,27 +1366,27 @@ var an = [
|
|
|
1345
1366
|
[12, "month"],
|
|
1346
1367
|
[Infinity, "year"]
|
|
1347
1368
|
];
|
|
1348
|
-
function
|
|
1369
|
+
function ln(e, t) {
|
|
1349
1370
|
if (!e) return "";
|
|
1350
1371
|
let n = e instanceof Date ? e : new Date(e);
|
|
1351
1372
|
if (Number.isNaN(n.getTime())) return String(e);
|
|
1352
1373
|
let r = (n.getTime() - Date.now()) / 1e3;
|
|
1353
|
-
for (let [n, i] of
|
|
1374
|
+
for (let [n, i] of cn) {
|
|
1354
1375
|
if (Math.abs(r) < n) try {
|
|
1355
1376
|
return new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(Math.round(r), i);
|
|
1356
1377
|
} catch {
|
|
1357
|
-
return
|
|
1378
|
+
return sn(e);
|
|
1358
1379
|
}
|
|
1359
1380
|
r /= n;
|
|
1360
1381
|
}
|
|
1361
|
-
return
|
|
1382
|
+
return sn(e);
|
|
1362
1383
|
}
|
|
1363
|
-
function
|
|
1384
|
+
function un(e) {
|
|
1364
1385
|
if (!e) return "?";
|
|
1365
1386
|
let t = e.trim().split(/\s+/).filter(Boolean).slice(0, 2);
|
|
1366
1387
|
return t.length === 0 ? "?" : t.map((e) => e.charAt(0).toUpperCase()).join("");
|
|
1367
1388
|
}
|
|
1368
|
-
function
|
|
1389
|
+
function dn(e) {
|
|
1369
1390
|
if (e == null || e === "") return "—";
|
|
1370
1391
|
if (typeof e == "string") return e;
|
|
1371
1392
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -1375,25 +1396,25 @@ function cn(e) {
|
|
|
1375
1396
|
return String(e);
|
|
1376
1397
|
}
|
|
1377
1398
|
}
|
|
1378
|
-
function
|
|
1399
|
+
function fn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
1379
1400
|
return t ? /* @__PURE__ */ Z("div", {
|
|
1380
|
-
className:
|
|
1401
|
+
className: G("space-y-3", r),
|
|
1381
1402
|
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ Q("div", {
|
|
1382
1403
|
className: "flex items-start gap-3",
|
|
1383
|
-
children: [/* @__PURE__ */ Z(
|
|
1404
|
+
children: [/* @__PURE__ */ Z(I, { className: "h-8 w-8 rounded-full" }), /* @__PURE__ */ Q("div", {
|
|
1384
1405
|
className: "flex-1 space-y-2",
|
|
1385
|
-
children: [/* @__PURE__ */ Z(
|
|
1406
|
+
children: [/* @__PURE__ */ Z(I, { className: "h-4 w-1/3" }), /* @__PURE__ */ Z(I, { className: "h-3 w-1/2" })]
|
|
1386
1407
|
})]
|
|
1387
1408
|
}, t))
|
|
1388
1409
|
}) : !e || e.length === 0 ? /* @__PURE__ */ Z("div", {
|
|
1389
|
-
className:
|
|
1410
|
+
className: G("flex items-center justify-center rounded-md border border-dashed py-10 text-sm text-muted-foreground", r),
|
|
1390
1411
|
children: n ?? "No history yet"
|
|
1391
|
-
}) : /* @__PURE__ */ Z(
|
|
1412
|
+
}) : /* @__PURE__ */ Z(ae, {
|
|
1392
1413
|
delayDuration: 150,
|
|
1393
1414
|
children: /* @__PURE__ */ Z("ol", {
|
|
1394
|
-
className:
|
|
1415
|
+
className: G("space-y-4", r),
|
|
1395
1416
|
children: e.map((e, t) => {
|
|
1396
|
-
let n = (e.action ?? "").toLowerCase(), r =
|
|
1417
|
+
let n = (e.action ?? "").toLowerCase(), r = on[n] ?? "outline", a = typeof e.user_name == "string" && e.user_name.trim() || "Unknown user", o = sn(e.created_at), s = ln(e.created_at, i), c = typeof e.user_avatar == "string" ? e.user_avatar : void 0;
|
|
1397
1418
|
return /* @__PURE__ */ Q("li", {
|
|
1398
1419
|
className: "flex items-start gap-3",
|
|
1399
1420
|
children: [/* @__PURE__ */ Q(_, {
|
|
@@ -1403,7 +1424,7 @@ function ln({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1403
1424
|
alt: a
|
|
1404
1425
|
}) : null, /* @__PURE__ */ Z(v, {
|
|
1405
1426
|
className: "text-[10px] font-medium",
|
|
1406
|
-
children:
|
|
1427
|
+
children: un(e.user_name)
|
|
1407
1428
|
})]
|
|
1408
1429
|
}), /* @__PURE__ */ Q("div", {
|
|
1409
1430
|
className: "min-w-0 flex-1",
|
|
@@ -1420,7 +1441,7 @@ function ln({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1420
1441
|
className: "text-[10px] uppercase tracking-wide",
|
|
1421
1442
|
children: e.action
|
|
1422
1443
|
}),
|
|
1423
|
-
o && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(
|
|
1444
|
+
o && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
1424
1445
|
asChild: !0,
|
|
1425
1446
|
children: /* @__PURE__ */ Z("span", {
|
|
1426
1447
|
className: "text-xs text-muted-foreground cursor-help",
|
|
@@ -1454,7 +1475,7 @@ function ln({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1454
1475
|
": ",
|
|
1455
1476
|
/* @__PURE__ */ Z("span", {
|
|
1456
1477
|
className: "text-foreground",
|
|
1457
|
-
children:
|
|
1478
|
+
children: dn(e.to)
|
|
1458
1479
|
})
|
|
1459
1480
|
]
|
|
1460
1481
|
}, e.field))
|
|
@@ -1471,12 +1492,12 @@ function ln({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1471
1492
|
": ",
|
|
1472
1493
|
/* @__PURE__ */ Z("span", {
|
|
1473
1494
|
className: "line-through opacity-70",
|
|
1474
|
-
children:
|
|
1495
|
+
children: dn(e.from)
|
|
1475
1496
|
}),
|
|
1476
1497
|
" → ",
|
|
1477
1498
|
/* @__PURE__ */ Z("span", {
|
|
1478
1499
|
className: "text-foreground",
|
|
1479
|
-
children:
|
|
1500
|
+
children: dn(e.to)
|
|
1480
1501
|
})
|
|
1481
1502
|
]
|
|
1482
1503
|
}, e.field))
|
|
@@ -1490,13 +1511,13 @@ function ln({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1490
1511
|
}
|
|
1491
1512
|
//#endregion
|
|
1492
1513
|
//#region src/RecordMetaFooter.tsx
|
|
1493
|
-
var
|
|
1514
|
+
var pn = {
|
|
1494
1515
|
createdAt: "created_at",
|
|
1495
1516
|
createdBy: "created_by",
|
|
1496
1517
|
updatedAt: "updated_at",
|
|
1497
1518
|
updatedBy: "updated_by"
|
|
1498
1519
|
};
|
|
1499
|
-
function
|
|
1520
|
+
function mn(e) {
|
|
1500
1521
|
if (!e) return null;
|
|
1501
1522
|
if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
|
|
1502
1523
|
if (typeof e == "string" || typeof e == "number") {
|
|
@@ -1505,7 +1526,7 @@ function dn(e) {
|
|
|
1505
1526
|
}
|
|
1506
1527
|
return null;
|
|
1507
1528
|
}
|
|
1508
|
-
function
|
|
1529
|
+
function hn(e, t) {
|
|
1509
1530
|
let n = Date.now() - e.getTime(), r = Math.max(0, Math.floor(n / 1e3));
|
|
1510
1531
|
if (r < 60) return t("detail.justNow");
|
|
1511
1532
|
let i = Math.floor(r / 60);
|
|
@@ -1513,7 +1534,7 @@ function fn(e, t) {
|
|
|
1513
1534
|
let a = Math.floor(i / 60);
|
|
1514
1535
|
return a < 24 ? t("detail.hoursAgo", { count: a }) : t("detail.daysAgo", { count: Math.floor(a / 24) });
|
|
1515
1536
|
}
|
|
1516
|
-
function
|
|
1537
|
+
function gn(e) {
|
|
1517
1538
|
try {
|
|
1518
1539
|
return new Intl.DateTimeFormat(void 0, {
|
|
1519
1540
|
dateStyle: "medium",
|
|
@@ -1523,16 +1544,16 @@ function pn(e) {
|
|
|
1523
1544
|
return e.toISOString();
|
|
1524
1545
|
}
|
|
1525
1546
|
}
|
|
1526
|
-
var
|
|
1547
|
+
var _n = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
1527
1548
|
if (e == null || e === "") return null;
|
|
1528
1549
|
let r = t?.fields?.[n], i = r?.reference_to || r?.reference, a = {
|
|
1529
1550
|
name: n,
|
|
1530
1551
|
type: r?.type || (i ? "lookup" : "text"),
|
|
1531
1552
|
...i && { reference_to: i },
|
|
1532
1553
|
...r?.reference_field && { reference_field: r.reference_field }
|
|
1533
|
-
}, o =
|
|
1554
|
+
}, o = Et(a) || a.type;
|
|
1534
1555
|
if (o) {
|
|
1535
|
-
let t =
|
|
1556
|
+
let t = wt(o);
|
|
1536
1557
|
if (t) return /* @__PURE__ */ Z("span", {
|
|
1537
1558
|
className: "inline-flex items-center [&_a]:text-inherit [&_a]:hover:underline",
|
|
1538
1559
|
children: /* @__PURE__ */ Z(t, {
|
|
@@ -1542,20 +1563,20 @@ var mn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1542
1563
|
});
|
|
1543
1564
|
}
|
|
1544
1565
|
return /* @__PURE__ */ Z("span", { children: String(e) });
|
|
1545
|
-
},
|
|
1566
|
+
}, vn = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
|
|
1546
1567
|
if (!t && !n) return null;
|
|
1547
|
-
let o = n ? /* @__PURE__ */ Z(
|
|
1568
|
+
let o = n ? /* @__PURE__ */ Z(ae, {
|
|
1548
1569
|
delayDuration: 200,
|
|
1549
|
-
children: /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(
|
|
1570
|
+
children: /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
1550
1571
|
asChild: !0,
|
|
1551
1572
|
children: /* @__PURE__ */ Z("time", {
|
|
1552
1573
|
dateTime: n.toISOString(),
|
|
1553
1574
|
className: "cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2",
|
|
1554
|
-
children:
|
|
1575
|
+
children: hn(n, a)
|
|
1555
1576
|
})
|
|
1556
1577
|
}), /* @__PURE__ */ Z(H, {
|
|
1557
1578
|
side: "top",
|
|
1558
|
-
children:
|
|
1579
|
+
children: gn(n)
|
|
1559
1580
|
})] })
|
|
1560
1581
|
}) : null;
|
|
1561
1582
|
return /* @__PURE__ */ Q("span", {
|
|
@@ -1565,7 +1586,7 @@ var mn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1565
1586
|
className: "text-muted-foreground/70",
|
|
1566
1587
|
children: e
|
|
1567
1588
|
}),
|
|
1568
|
-
t ? /* @__PURE__ */ Z(
|
|
1589
|
+
t ? /* @__PURE__ */ Z(_n, {
|
|
1569
1590
|
value: t,
|
|
1570
1591
|
objectSchema: r,
|
|
1571
1592
|
fieldName: i
|
|
@@ -1577,31 +1598,31 @@ var mn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1577
1598
|
o
|
|
1578
1599
|
]
|
|
1579
1600
|
});
|
|
1580
|
-
},
|
|
1601
|
+
}, yn = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
|
|
1581
1602
|
let { t: i } = $();
|
|
1582
1603
|
if (!e) return null;
|
|
1583
|
-
let a =
|
|
1604
|
+
let a = mn(e[pn.createdAt]), o = mn(e[pn.updatedAt]), s = e[pn.createdBy], c = e[pn.updatedBy], l = !!(a || s), u = a && o && Math.abs(o.getTime() - a.getTime()) < 2e3, d = !!(o || c) && !(u && (s != null && c != null && String(s) === String(c) || !c));
|
|
1584
1605
|
return !l && !d ? null : /* @__PURE__ */ Q("div", {
|
|
1585
|
-
className:
|
|
1606
|
+
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),
|
|
1586
1607
|
"data-testid": "record-meta-footer",
|
|
1587
|
-
children: [l && /* @__PURE__ */ Z(
|
|
1608
|
+
children: [l && /* @__PURE__ */ Z(vn, {
|
|
1588
1609
|
label: i("detail.createdBy"),
|
|
1589
1610
|
user: s,
|
|
1590
1611
|
date: a,
|
|
1591
1612
|
objectSchema: t,
|
|
1592
|
-
userField:
|
|
1613
|
+
userField: pn.createdBy,
|
|
1593
1614
|
t: i
|
|
1594
|
-
}), d && /* @__PURE__ */ Z(
|
|
1615
|
+
}), d && /* @__PURE__ */ Z(vn, {
|
|
1595
1616
|
label: i("detail.updatedBy"),
|
|
1596
1617
|
user: c,
|
|
1597
1618
|
date: o,
|
|
1598
1619
|
objectSchema: t,
|
|
1599
|
-
userField:
|
|
1620
|
+
userField: pn.updatedBy,
|
|
1600
1621
|
t: i
|
|
1601
1622
|
})]
|
|
1602
1623
|
});
|
|
1603
|
-
},
|
|
1604
|
-
function
|
|
1624
|
+
}, bn = 5;
|
|
1625
|
+
function xn(e, t, i, a) {
|
|
1605
1626
|
if (e && typeof e == "object") {
|
|
1606
1627
|
if (t.primaryField) {
|
|
1607
1628
|
let n = e[t.primaryField];
|
|
@@ -1621,10 +1642,10 @@ function vn(e, t, i, a) {
|
|
|
1621
1642
|
}
|
|
1622
1643
|
return a;
|
|
1623
1644
|
}
|
|
1624
|
-
var
|
|
1625
|
-
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), [
|
|
1626
|
-
if (!
|
|
1627
|
-
let t = (t) =>
|
|
1645
|
+
var Sn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBack: s, inlineEdit: c = !1, onFieldSave: l, discussionSlot: u, rightRail: d, objectLabel: f, onDataLoaded: p, isFavorite: m, onToggleFavorite: h }) => {
|
|
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), P = lt(e.objectName || void 0, e.resourceId == null ? void 0 : String(e.resourceId)), [F, W] = i.useState(!1), { t: K } = $(), { currency: se } = jt(), { fieldOptionLabel: le } = _t(), ue = oe(), de = kt(), q = i.useMemo(() => {
|
|
1647
|
+
if (!de?.isLoaded || !e.objectName) return e;
|
|
1648
|
+
let t = (t) => de.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
|
|
1628
1649
|
let n = typeof e == "string" ? e : e?.name;
|
|
1629
1650
|
return !n || t(n);
|
|
1630
1651
|
});
|
|
@@ -1637,11 +1658,11 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1637
1658
|
})),
|
|
1638
1659
|
summaryFields: n(e.summaryFields)
|
|
1639
1660
|
};
|
|
1640
|
-
}, [e,
|
|
1661
|
+
}, [e, de]);
|
|
1641
1662
|
i.useEffect(() => {
|
|
1642
1663
|
g && p && p(g);
|
|
1643
1664
|
}, [g, p]);
|
|
1644
|
-
let
|
|
1665
|
+
let fe = i.useMemo(() => {
|
|
1645
1666
|
if (q.summaryFields && q.summaryFields.length > 0) return [];
|
|
1646
1667
|
let e = [...q.sections?.flatMap((e) => e.fields) || [], ...q.fields || []], t = {};
|
|
1647
1668
|
for (let n of e) t[n.name] || (t[n.name] = n);
|
|
@@ -1667,7 +1688,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1667
1688
|
q.fields,
|
|
1668
1689
|
N,
|
|
1669
1690
|
g
|
|
1670
|
-
]),
|
|
1691
|
+
]), pe = q.summaryFields && q.summaryFields.length > 0 ? q.summaryFields : fe, me = i.useCallback(() => {
|
|
1671
1692
|
q.resourceId && navigator.clipboard.writeText(String(q.resourceId)).then(() => {
|
|
1672
1693
|
ne(!0), setTimeout(() => ne(!1), 1500);
|
|
1673
1694
|
});
|
|
@@ -1722,28 +1743,29 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1722
1743
|
n,
|
|
1723
1744
|
q.sections,
|
|
1724
1745
|
q.fields,
|
|
1746
|
+
re,
|
|
1725
1747
|
P
|
|
1726
1748
|
]);
|
|
1727
|
-
let
|
|
1749
|
+
let he = i.useCallback(() => {
|
|
1728
1750
|
if (s) s();
|
|
1729
1751
|
else if (q.onNavigate) {
|
|
1730
1752
|
let e = q.backUrl || (q.objectName ? `/${q.objectName}` : "/");
|
|
1731
1753
|
q.onNavigate(e, { replace: !0 });
|
|
1732
1754
|
} else q.backUrl ? window.location.href = q.backUrl : window.history.back();
|
|
1733
|
-
}, [s, q]),
|
|
1755
|
+
}, [s, q]), _e = i.useCallback(() => {
|
|
1734
1756
|
a ? a() : q.onNavigate && q.editUrl ? q.onNavigate(q.editUrl) : q.onNavigate && q.objectName && q.resourceId ? q.onNavigate(`/${q.objectName}/${q.resourceId}/edit`) : q.editUrl && (window.location.href = q.editUrl);
|
|
1735
|
-
}, [a, q]),
|
|
1757
|
+
}, [a, q]), ve = i.useCallback(async () => {
|
|
1736
1758
|
if (!n?.cancelPendingApproval || !q.objectName || !q.resourceId) {
|
|
1737
|
-
M(
|
|
1759
|
+
M(K("detail.cancelApprovalUnavailable"));
|
|
1738
1760
|
return;
|
|
1739
1761
|
}
|
|
1740
|
-
|
|
1762
|
+
W(!0), M(null);
|
|
1741
1763
|
try {
|
|
1742
1764
|
if (await n.cancelPendingApproval(String(q.objectName), String(q.resourceId)), n.findOne) try {
|
|
1743
1765
|
let e = await n.findOne(String(q.objectName), String(q.resourceId));
|
|
1744
1766
|
e && _(e);
|
|
1745
1767
|
} catch {}
|
|
1746
|
-
|
|
1768
|
+
ie((e) => e + 1);
|
|
1747
1769
|
try {
|
|
1748
1770
|
window.dispatchEvent(new CustomEvent("objectui:record-changed", { detail: {
|
|
1749
1771
|
objectName: String(q.objectName),
|
|
@@ -1753,34 +1775,34 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1753
1775
|
} catch {}
|
|
1754
1776
|
} catch (e) {
|
|
1755
1777
|
let t = (e?.message || e?.error || String(e ?? "Cancel failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
|
|
1756
|
-
M(`${
|
|
1778
|
+
M(`${K("detail.cancelApprovalFailed")}: ${t}`);
|
|
1757
1779
|
} finally {
|
|
1758
|
-
|
|
1780
|
+
W(!1);
|
|
1759
1781
|
}
|
|
1760
1782
|
}, [
|
|
1761
1783
|
n,
|
|
1762
1784
|
q.objectName,
|
|
1763
1785
|
q.resourceId,
|
|
1764
|
-
|
|
1765
|
-
]),
|
|
1766
|
-
let e = q.deleteConfirmation ||
|
|
1786
|
+
K
|
|
1787
|
+
]), xe = i.useCallback(() => {
|
|
1788
|
+
let e = q.deleteConfirmation || K("detail.deleteConfirmation");
|
|
1767
1789
|
window.confirm(e) && (o?.(), q.onNavigate && q.objectName && q.onNavigate(`/${q.objectName}`, { replace: !0 }));
|
|
1768
|
-
}, [o, q]),
|
|
1790
|
+
}, [o, q]), Se = i.useCallback(() => {
|
|
1769
1791
|
navigator.share && q.objectName && q.resourceId ? navigator.share({
|
|
1770
|
-
title: q.title ||
|
|
1792
|
+
title: q.title || K("detail.details"),
|
|
1771
1793
|
text: `${q.objectName} #${q.resourceId}`,
|
|
1772
1794
|
url: window.location.href
|
|
1773
1795
|
}).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
|
|
1774
1796
|
console.log("Link copied to clipboard");
|
|
1775
1797
|
});
|
|
1776
|
-
}, [q]),
|
|
1798
|
+
}, [q]), Ce = i.useCallback(() => {
|
|
1777
1799
|
let e = !w;
|
|
1778
1800
|
h && h(e), m === void 0 && C(e);
|
|
1779
1801
|
}, [
|
|
1780
1802
|
w,
|
|
1781
1803
|
m,
|
|
1782
1804
|
h
|
|
1783
|
-
]),
|
|
1805
|
+
]), we = i.useCallback(async () => {
|
|
1784
1806
|
if (T) {
|
|
1785
1807
|
let e = Object.entries(D);
|
|
1786
1808
|
if (e.length > 0) {
|
|
@@ -1807,9 +1829,9 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1807
1829
|
D,
|
|
1808
1830
|
g,
|
|
1809
1831
|
l
|
|
1810
|
-
]),
|
|
1832
|
+
]), De = i.useCallback(() => {
|
|
1811
1833
|
O({}), E(!1), M(null);
|
|
1812
|
-
}, []),
|
|
1834
|
+
}, []), Oe = i.useCallback((e, t) => {
|
|
1813
1835
|
O((n) => ({
|
|
1814
1836
|
...n,
|
|
1815
1837
|
[e]: t
|
|
@@ -1826,7 +1848,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1826
1848
|
if (!c || q.showHeader !== !1) return;
|
|
1827
1849
|
let e = "objectui:record:inline-edit-toggle", t = (e) => {
|
|
1828
1850
|
let t = e.detail;
|
|
1829
|
-
t?.recordId && q.recordId && t.recordId !== q.recordId || t?.objectName && q.objectName && t.objectName !== q.objectName ||
|
|
1851
|
+
t?.recordId && q.recordId && t.recordId !== q.recordId || t?.objectName && q.objectName && t.objectName !== q.objectName || we();
|
|
1830
1852
|
};
|
|
1831
1853
|
return window.addEventListener(e, t), () => window.removeEventListener(e, t);
|
|
1832
1854
|
}, [
|
|
@@ -1834,52 +1856,52 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1834
1856
|
q.showHeader,
|
|
1835
1857
|
q.recordId,
|
|
1836
1858
|
q.objectName,
|
|
1837
|
-
|
|
1859
|
+
we
|
|
1838
1860
|
]);
|
|
1839
|
-
let
|
|
1861
|
+
let J = i.useMemo(() => q.related ?? [], [q.related]), ke = i.useMemo(() => {
|
|
1840
1862
|
let e = [];
|
|
1841
1863
|
return e.push({
|
|
1842
1864
|
name: "sys_share",
|
|
1843
|
-
label:
|
|
1865
|
+
label: K("detail.share"),
|
|
1844
1866
|
icon: "share-2",
|
|
1845
1867
|
type: "script",
|
|
1846
|
-
onClick:
|
|
1868
|
+
onClick: Se
|
|
1847
1869
|
}), q.showEdit && e.push({
|
|
1848
1870
|
name: "sys_edit_mobile",
|
|
1849
|
-
label:
|
|
1871
|
+
label: K("detail.edit"),
|
|
1850
1872
|
icon: "edit",
|
|
1851
1873
|
type: "script",
|
|
1852
1874
|
className: "sm:hidden",
|
|
1853
|
-
onClick:
|
|
1875
|
+
onClick: _e
|
|
1854
1876
|
}), c && e.push({
|
|
1855
1877
|
name: "sys_toggle_inline_edit_mobile",
|
|
1856
|
-
label:
|
|
1878
|
+
label: K(T ? "detail.save" : "detail.editInline"),
|
|
1857
1879
|
icon: "edit",
|
|
1858
1880
|
type: "script",
|
|
1859
1881
|
className: "sm:hidden",
|
|
1860
|
-
onClick:
|
|
1882
|
+
onClick: we
|
|
1861
1883
|
}), q.showDelete && e.push({
|
|
1862
1884
|
name: "sys_delete",
|
|
1863
|
-
label:
|
|
1885
|
+
label: K("detail.delete"),
|
|
1864
1886
|
icon: "trash-2",
|
|
1865
1887
|
type: "script",
|
|
1866
1888
|
variant: "destructive",
|
|
1867
1889
|
tags: ["separator-before"],
|
|
1868
|
-
onClick:
|
|
1890
|
+
onClick: xe
|
|
1869
1891
|
}), e;
|
|
1870
1892
|
}, [
|
|
1871
|
-
|
|
1893
|
+
K,
|
|
1872
1894
|
q.showEdit,
|
|
1873
1895
|
q.showDelete,
|
|
1874
1896
|
c,
|
|
1875
1897
|
T,
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
]),
|
|
1898
|
+
Se,
|
|
1899
|
+
_e,
|
|
1900
|
+
we,
|
|
1901
|
+
xe
|
|
1902
|
+
]), Ae = i.useMemo(() => {
|
|
1881
1903
|
let e = q.actions ?? [];
|
|
1882
|
-
if (
|
|
1904
|
+
if (ke.length === 0) return e;
|
|
1883
1905
|
let t = !1, n = e.map((e) => {
|
|
1884
1906
|
let n = e;
|
|
1885
1907
|
if (n && typeof n == "object" && n.type === "action:bar" && (!n.location || n.location === "record_header")) {
|
|
@@ -1887,7 +1909,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1887
1909
|
let e = Array.isArray(n.systemActions) ? n.systemActions : [];
|
|
1888
1910
|
return {
|
|
1889
1911
|
...n,
|
|
1890
|
-
systemActions: [...e, ...
|
|
1912
|
+
systemActions: [...e, ...ke]
|
|
1891
1913
|
};
|
|
1892
1914
|
}
|
|
1893
1915
|
return e;
|
|
@@ -1895,61 +1917,61 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1895
1917
|
return t || n.push({
|
|
1896
1918
|
type: "action:bar",
|
|
1897
1919
|
location: "record_header",
|
|
1898
|
-
systemActions:
|
|
1920
|
+
systemActions: ke
|
|
1899
1921
|
}), n;
|
|
1900
|
-
}, [q.actions,
|
|
1922
|
+
}, [q.actions, ke]);
|
|
1901
1923
|
return v || q.loading ? /* @__PURE__ */ Q("div", {
|
|
1902
|
-
className:
|
|
1924
|
+
className: G("space-y-4", r),
|
|
1903
1925
|
children: [
|
|
1904
|
-
/* @__PURE__ */ Z(
|
|
1905
|
-
/* @__PURE__ */ Z(
|
|
1906
|
-
/* @__PURE__ */ Z(
|
|
1926
|
+
/* @__PURE__ */ Z(I, { className: "h-10 w-full" }),
|
|
1927
|
+
/* @__PURE__ */ Z(I, { className: "h-64 w-full" }),
|
|
1928
|
+
/* @__PURE__ */ Z(I, { className: "h-48 w-full" })
|
|
1907
1929
|
]
|
|
1908
1930
|
}) : !g && !q.data ? /* @__PURE__ */ Q("div", {
|
|
1909
|
-
className:
|
|
1931
|
+
className: G("flex flex-col items-center justify-center py-16 text-center", r),
|
|
1910
1932
|
children: [
|
|
1911
1933
|
/* @__PURE__ */ Z("p", {
|
|
1912
1934
|
className: "text-lg font-semibold",
|
|
1913
|
-
children:
|
|
1935
|
+
children: K("detail.recordNotFound")
|
|
1914
1936
|
}),
|
|
1915
1937
|
/* @__PURE__ */ Z("p", {
|
|
1916
1938
|
className: "text-sm text-muted-foreground mt-1",
|
|
1917
|
-
children:
|
|
1939
|
+
children: K("detail.recordNotFoundDescription")
|
|
1918
1940
|
}),
|
|
1919
1941
|
(q.showBack ?? !0) && /* @__PURE__ */ Q(x, {
|
|
1920
1942
|
variant: "outline",
|
|
1921
1943
|
size: "sm",
|
|
1922
|
-
onClick:
|
|
1944
|
+
onClick: he,
|
|
1923
1945
|
className: "mt-4 gap-2",
|
|
1924
|
-
children: [/* @__PURE__ */ Z(ce, { className: "h-4 w-4" }),
|
|
1946
|
+
children: [/* @__PURE__ */ Z(ce, { className: "h-4 w-4" }), K("detail.goBack")]
|
|
1925
1947
|
})
|
|
1926
1948
|
]
|
|
1927
|
-
}) : /* @__PURE__ */ Z(
|
|
1928
|
-
className:
|
|
1949
|
+
}) : /* @__PURE__ */ Z(ae, { children: /* @__PURE__ */ Q("div", {
|
|
1950
|
+
className: G("space-y-6", r),
|
|
1929
1951
|
children: [
|
|
1930
1952
|
q.showHeader !== !1 && /* @__PURE__ */ Q("div", {
|
|
1931
1953
|
className: "flex flex-col sm:flex-row items-start justify-between gap-3 sm:gap-4 pb-4 border-b",
|
|
1932
1954
|
children: [/* @__PURE__ */ Q("div", {
|
|
1933
1955
|
className: "flex items-start gap-2 sm:gap-3 flex-1 min-w-0",
|
|
1934
|
-
children: [(q.showBack ?? !0) && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(
|
|
1956
|
+
children: [(q.showBack ?? !0) && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
1935
1957
|
asChild: !0,
|
|
1936
1958
|
children: /* @__PURE__ */ Z(x, {
|
|
1937
1959
|
variant: "ghost",
|
|
1938
1960
|
size: "icon",
|
|
1939
|
-
onClick:
|
|
1961
|
+
onClick: he,
|
|
1940
1962
|
className: "shrink-0 mt-1",
|
|
1941
1963
|
children: /* @__PURE__ */ Z(ce, { className: "h-4 w-4" })
|
|
1942
1964
|
})
|
|
1943
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
1965
|
+
}), /* @__PURE__ */ Z(H, { children: K("detail.back") })] }), /* @__PURE__ */ Q("div", {
|
|
1944
1966
|
className: "flex-1 min-w-0",
|
|
1945
1967
|
children: [/* @__PURE__ */ Q("div", {
|
|
1946
1968
|
className: "flex items-center gap-2 flex-wrap",
|
|
1947
1969
|
children: [
|
|
1948
1970
|
/* @__PURE__ */ Z("h1", {
|
|
1949
1971
|
className: "text-xl sm:text-2xl font-bold truncate",
|
|
1950
|
-
children:
|
|
1972
|
+
children: xn(g, q, N, K("detail.details"))
|
|
1951
1973
|
}),
|
|
1952
|
-
|
|
1974
|
+
pe.map((e) => {
|
|
1953
1975
|
let t = g?.[e];
|
|
1954
1976
|
if (t == null || t === "") return null;
|
|
1955
1977
|
let n = (q.sections || []).flatMap((e) => e.fields).concat(q.fields || []).find((t) => t.name === e), r = N?.fields?.[e], i = n?.type || r?.type, a = String(t), o = null;
|
|
@@ -1957,10 +1979,10 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1957
1979
|
if (i === "currency") {
|
|
1958
1980
|
let e = Number(t);
|
|
1959
1981
|
if (!Number.isNaN(e)) {
|
|
1960
|
-
let t =
|
|
1982
|
+
let t = At({
|
|
1961
1983
|
...r,
|
|
1962
1984
|
...n
|
|
1963
|
-
},
|
|
1985
|
+
}, se);
|
|
1964
1986
|
a = t ? new Intl.NumberFormat(void 0, {
|
|
1965
1987
|
style: "currency",
|
|
1966
1988
|
currency: t,
|
|
@@ -1989,7 +2011,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1989
2011
|
let e = i[String(t)];
|
|
1990
2012
|
e?.label && (o = e.label);
|
|
1991
2013
|
}
|
|
1992
|
-
a = q.objectName ?
|
|
2014
|
+
a = q.objectName ? le(q.objectName, e, String(t), o) : o;
|
|
1993
2015
|
}
|
|
1994
2016
|
} catch {}
|
|
1995
2017
|
return o === null ? /* @__PURE__ */ Z(b, {
|
|
@@ -2011,34 +2033,34 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2011
2033
|
}), a]
|
|
2012
2034
|
}, e);
|
|
2013
2035
|
}),
|
|
2014
|
-
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(
|
|
2036
|
+
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2015
2037
|
asChild: !0,
|
|
2016
2038
|
children: /* @__PURE__ */ Z(x, {
|
|
2017
2039
|
variant: "ghost",
|
|
2018
2040
|
size: "icon",
|
|
2019
2041
|
className: "h-6 w-6 shrink-0",
|
|
2020
|
-
onClick:
|
|
2021
|
-
"aria-label":
|
|
2042
|
+
onClick: Ce,
|
|
2043
|
+
"aria-label": K(w ? "detail.removeFromFavorites" : "detail.addToFavorites"),
|
|
2022
2044
|
children: w ? /* @__PURE__ */ Z($e, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z($e, { className: "h-4 w-4 text-muted-foreground" })
|
|
2023
2045
|
})
|
|
2024
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2046
|
+
}), /* @__PURE__ */ Z(H, { children: K(w ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
|
|
2025
2047
|
]
|
|
2026
2048
|
}), q.objectName && /* @__PURE__ */ Q("p", {
|
|
2027
2049
|
className: "text-sm text-muted-foreground mt-1 flex items-center gap-1",
|
|
2028
2050
|
children: [/* @__PURE__ */ Z("span", {
|
|
2029
2051
|
className: "font-medium",
|
|
2030
2052
|
children: f || q.objectName
|
|
2031
|
-
}), q.resourceId && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(
|
|
2053
|
+
}), q.resourceId && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2032
2054
|
asChild: !0,
|
|
2033
2055
|
children: /* @__PURE__ */ Z(x, {
|
|
2034
2056
|
variant: "ghost",
|
|
2035
2057
|
size: "icon",
|
|
2036
2058
|
className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
|
|
2037
|
-
onClick:
|
|
2038
|
-
"aria-label":
|
|
2059
|
+
onClick: me,
|
|
2060
|
+
"aria-label": K("detail.copyRecordId", { defaultValue: "Copy record ID" }),
|
|
2039
2061
|
children: te ? /* @__PURE__ */ Z(ge, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Te, { className: "h-3 w-3" })
|
|
2040
2062
|
})
|
|
2041
|
-
}), /* @__PURE__ */ Z(H, { children: te ?
|
|
2063
|
+
}), /* @__PURE__ */ Z(H, { children: te ? K("detail.copied", { defaultValue: "Copied" }) : K("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
|
|
2042
2064
|
})]
|
|
2043
2065
|
})]
|
|
2044
2066
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -2047,7 +2069,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2047
2069
|
q.recordNavigation && /* @__PURE__ */ Q("div", {
|
|
2048
2070
|
className: "flex items-center gap-1 mr-2",
|
|
2049
2071
|
children: [
|
|
2050
|
-
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(
|
|
2072
|
+
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2051
2073
|
asChild: !0,
|
|
2052
2074
|
children: /* @__PURE__ */ Z(x, {
|
|
2053
2075
|
variant: "outline",
|
|
@@ -2060,15 +2082,15 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2060
2082
|
},
|
|
2061
2083
|
children: /* @__PURE__ */ Z(ye, { className: "h-4 w-4" })
|
|
2062
2084
|
})
|
|
2063
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2085
|
+
}), /* @__PURE__ */ Z(H, { children: K("detail.previousRecord") })] }),
|
|
2064
2086
|
/* @__PURE__ */ Z("span", {
|
|
2065
2087
|
className: "text-xs text-muted-foreground whitespace-nowrap px-1",
|
|
2066
|
-
children:
|
|
2088
|
+
children: K("detail.recordOf", {
|
|
2067
2089
|
current: q.recordNavigation.currentIndex + 1,
|
|
2068
2090
|
total: q.recordNavigation.recordIds.length
|
|
2069
2091
|
})
|
|
2070
2092
|
}),
|
|
2071
|
-
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(
|
|
2093
|
+
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2072
2094
|
asChild: !0,
|
|
2073
2095
|
children: /* @__PURE__ */ Z(x, {
|
|
2074
2096
|
variant: "outline",
|
|
@@ -2081,50 +2103,50 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2081
2103
|
},
|
|
2082
2104
|
children: /* @__PURE__ */ Z(be, { className: "h-4 w-4" })
|
|
2083
2105
|
})
|
|
2084
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2106
|
+
}), /* @__PURE__ */ Z(H, { children: K("detail.nextRecord") })] })
|
|
2085
2107
|
]
|
|
2086
2108
|
}),
|
|
2087
|
-
c && /* @__PURE__ */ Q(
|
|
2109
|
+
c && /* @__PURE__ */ Q(Dt, { children: [T && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2088
2110
|
asChild: !0,
|
|
2089
2111
|
children: /* @__PURE__ */ Q(x, {
|
|
2090
2112
|
variant: "ghost",
|
|
2091
2113
|
size: "sm",
|
|
2092
|
-
onClick:
|
|
2114
|
+
onClick: De,
|
|
2093
2115
|
className: "gap-2 hidden sm:inline-flex",
|
|
2094
2116
|
children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2095
2117
|
className: "hidden sm:inline",
|
|
2096
|
-
children:
|
|
2118
|
+
children: K("detail.cancel")
|
|
2097
2119
|
})]
|
|
2098
2120
|
})
|
|
2099
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2121
|
+
}), /* @__PURE__ */ Z(H, { children: K("detail.cancelEdit") })] }), /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2100
2122
|
asChild: !0,
|
|
2101
2123
|
children: /* @__PURE__ */ Z(x, {
|
|
2102
2124
|
variant: T ? "default" : "outline",
|
|
2103
2125
|
size: "sm",
|
|
2104
|
-
onClick:
|
|
2126
|
+
onClick: we,
|
|
2105
2127
|
className: "gap-2 hidden sm:inline-flex",
|
|
2106
|
-
children: T ? /* @__PURE__ */ Q(
|
|
2128
|
+
children: T ? /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z(ge, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2107
2129
|
className: "hidden sm:inline",
|
|
2108
|
-
children:
|
|
2109
|
-
})] }) : /* @__PURE__ */ Q(
|
|
2130
|
+
children: K("detail.save")
|
|
2131
|
+
})] }) : /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2110
2132
|
className: "hidden sm:inline",
|
|
2111
|
-
children:
|
|
2133
|
+
children: K("detail.editInline")
|
|
2112
2134
|
})] })
|
|
2113
2135
|
})
|
|
2114
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2115
|
-
q.showEdit && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(
|
|
2136
|
+
}), /* @__PURE__ */ Z(H, { children: K(T ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
|
|
2137
|
+
q.showEdit && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2116
2138
|
asChild: !0,
|
|
2117
2139
|
children: /* @__PURE__ */ Q(x, {
|
|
2118
2140
|
variant: "default",
|
|
2119
|
-
onClick:
|
|
2141
|
+
onClick: _e,
|
|
2120
2142
|
className: "gap-2 hidden sm:inline-flex",
|
|
2121
|
-
children: [/* @__PURE__ */ Z(
|
|
2143
|
+
children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2122
2144
|
className: "hidden sm:inline",
|
|
2123
|
-
children:
|
|
2145
|
+
children: K("detail.edit")
|
|
2124
2146
|
})]
|
|
2125
2147
|
})
|
|
2126
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2127
|
-
|
|
2148
|
+
}), /* @__PURE__ */ Z(H, { children: K("detail.editRecord") })] }),
|
|
2149
|
+
Ae.map((e, t) => /* @__PURE__ */ Z(at, {
|
|
2128
2150
|
schema: e,
|
|
2129
2151
|
data: g
|
|
2130
2152
|
}, `header-action-${t}`))
|
|
@@ -2135,7 +2157,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2135
2157
|
schema: q.header,
|
|
2136
2158
|
data: g
|
|
2137
2159
|
}) }),
|
|
2138
|
-
q.highlightFields && q.highlightFields.length > 0 && /* @__PURE__ */ Z(
|
|
2160
|
+
q.highlightFields && q.highlightFields.length > 0 && /* @__PURE__ */ Z(Xt, {
|
|
2139
2161
|
fields: q.highlightFields,
|
|
2140
2162
|
data: g,
|
|
2141
2163
|
objectName: q.objectName,
|
|
@@ -2148,36 +2170,36 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2148
2170
|
children: [/* @__PURE__ */ Q("div", {
|
|
2149
2171
|
className: "flex items-center justify-end gap-2",
|
|
2150
2172
|
children: [
|
|
2151
|
-
t && !T && /* @__PURE__ */ Q(
|
|
2173
|
+
t && !T && /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Q("span", {
|
|
2152
2174
|
role: "status",
|
|
2153
2175
|
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",
|
|
2154
|
-
title:
|
|
2155
|
-
children: [/* @__PURE__ */ Z(
|
|
2176
|
+
title: K("detail.lockedTooltip"),
|
|
2177
|
+
children: [/* @__PURE__ */ Z(Re, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: K("detail.lockedByApproval") })]
|
|
2156
2178
|
}), n?.cancelPendingApproval && /* @__PURE__ */ Q(x, {
|
|
2157
2179
|
variant: "outline",
|
|
2158
2180
|
size: "sm",
|
|
2159
|
-
onClick:
|
|
2160
|
-
disabled:
|
|
2181
|
+
onClick: ve,
|
|
2182
|
+
disabled: F,
|
|
2161
2183
|
className: "gap-2 border-amber-300 text-amber-800 hover:bg-amber-50",
|
|
2162
|
-
title:
|
|
2163
|
-
children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children:
|
|
2184
|
+
title: K("detail.cancelApprovalTooltip"),
|
|
2185
|
+
children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: K(F ? "detail.cancelApprovalInFlight" : "detail.cancelApproval") })]
|
|
2164
2186
|
})] }),
|
|
2165
2187
|
T && /* @__PURE__ */ Q(x, {
|
|
2166
2188
|
variant: "ghost",
|
|
2167
2189
|
size: "sm",
|
|
2168
|
-
onClick:
|
|
2190
|
+
onClick: De,
|
|
2169
2191
|
className: "gap-2",
|
|
2170
2192
|
disabled: k,
|
|
2171
|
-
children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children:
|
|
2193
|
+
children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: K("detail.cancel") })]
|
|
2172
2194
|
}),
|
|
2173
2195
|
/* @__PURE__ */ Q(x, {
|
|
2174
2196
|
variant: T ? "default" : "outline",
|
|
2175
2197
|
size: "sm",
|
|
2176
|
-
onClick:
|
|
2198
|
+
onClick: we,
|
|
2177
2199
|
className: "gap-2",
|
|
2178
2200
|
disabled: k || t && !T,
|
|
2179
|
-
title: t && !T ?
|
|
2180
|
-
children: [Z(T ? ge :
|
|
2201
|
+
title: t && !T ? K("detail.lockedTooltip") : void 0,
|
|
2202
|
+
children: [Z(T ? ge : Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: K(k ? "detail.saving" : T ? "detail.save" : "detail.editFieldsInline") })]
|
|
2181
2203
|
})
|
|
2182
2204
|
]
|
|
2183
2205
|
}), j && /* @__PURE__ */ Z("div", {
|
|
@@ -2188,10 +2210,16 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2188
2210
|
});
|
|
2189
2211
|
})(),
|
|
2190
2212
|
q.autoTabs && !q.tabs?.length ? (() => {
|
|
2191
|
-
let e =
|
|
2213
|
+
let e = J.length > 0, t = !!q.activities && q.activities.length > 0, r = !!u, i = !!q.history, a = [
|
|
2214
|
+
"details",
|
|
2215
|
+
...e ? ["related"] : [],
|
|
2216
|
+
...t ? ["activity"] : [],
|
|
2217
|
+
...r ? ["discussion"] : [],
|
|
2218
|
+
...i ? ["history"] : []
|
|
2219
|
+
], o = q.defaultTab, s = o && a.includes(o) ? o : "details", c = q.onTabChange, l = /* @__PURE__ */ Q("div", {
|
|
2192
2220
|
className: "space-y-3 sm:space-y-4",
|
|
2193
2221
|
children: [
|
|
2194
|
-
q.sectionGroups && q.sectionGroups.length > 0 && q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(
|
|
2222
|
+
q.sectionGroups && q.sectionGroups.length > 0 && q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Yt, {
|
|
2195
2223
|
group: e,
|
|
2196
2224
|
data: {
|
|
2197
2225
|
...g,
|
|
@@ -2200,10 +2228,10 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2200
2228
|
objectSchema: N,
|
|
2201
2229
|
objectName: q.objectName,
|
|
2202
2230
|
isEditing: T,
|
|
2203
|
-
onFieldChange:
|
|
2231
|
+
onFieldChange: Oe,
|
|
2204
2232
|
dataSource: n
|
|
2205
2233
|
}, t)),
|
|
2206
|
-
q.sections && q.sections.length > 0 && q.sections.map((e, t) => /* @__PURE__ */ Z(
|
|
2234
|
+
q.sections && q.sections.length > 0 && q.sections.map((e, t) => /* @__PURE__ */ Z(Gt, {
|
|
2207
2235
|
section: e,
|
|
2208
2236
|
data: {
|
|
2209
2237
|
...g,
|
|
@@ -2212,10 +2240,10 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2212
2240
|
objectSchema: N,
|
|
2213
2241
|
objectName: q.objectName,
|
|
2214
2242
|
isEditing: T,
|
|
2215
|
-
onFieldChange:
|
|
2243
|
+
onFieldChange: Oe,
|
|
2216
2244
|
dataSource: n
|
|
2217
2245
|
}, t)),
|
|
2218
|
-
q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(
|
|
2246
|
+
q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(Gt, {
|
|
2219
2247
|
section: {
|
|
2220
2248
|
fields: q.fields,
|
|
2221
2249
|
columns: q.columns
|
|
@@ -2227,10 +2255,10 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2227
2255
|
objectSchema: N,
|
|
2228
2256
|
objectName: q.objectName,
|
|
2229
2257
|
isEditing: T,
|
|
2230
|
-
onFieldChange:
|
|
2258
|
+
onFieldChange: Oe,
|
|
2231
2259
|
dataSource: n
|
|
2232
2260
|
}),
|
|
2233
|
-
q.comments && /* @__PURE__ */ Z(
|
|
2261
|
+
q.comments && /* @__PURE__ */ Z(Qt, {
|
|
2234
2262
|
comments: q.comments,
|
|
2235
2263
|
onAddComment: q.onAddComment
|
|
2236
2264
|
})
|
|
@@ -2238,28 +2266,29 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2238
2266
|
});
|
|
2239
2267
|
return !e && !t && !r && !i ? /* @__PURE__ */ Z("div", {
|
|
2240
2268
|
className: "mt-2",
|
|
2241
|
-
children:
|
|
2242
|
-
}) : /* @__PURE__ */ Q(
|
|
2243
|
-
defaultValue:
|
|
2269
|
+
children: l
|
|
2270
|
+
}) : /* @__PURE__ */ Q(L, {
|
|
2271
|
+
defaultValue: s,
|
|
2272
|
+
onValueChange: c,
|
|
2244
2273
|
className: "w-full",
|
|
2245
2274
|
children: [
|
|
2246
|
-
/* @__PURE__ */ Q(
|
|
2275
|
+
/* @__PURE__ */ Q(z, {
|
|
2247
2276
|
className: "w-full justify-start border-b rounded-none bg-transparent p-0",
|
|
2248
2277
|
children: [
|
|
2249
2278
|
/* @__PURE__ */ Z(B, {
|
|
2250
2279
|
value: "details",
|
|
2251
2280
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2252
|
-
children:
|
|
2281
|
+
children: K("detail.details")
|
|
2253
2282
|
}),
|
|
2254
2283
|
e && /* @__PURE__ */ Z(B, {
|
|
2255
2284
|
value: "related",
|
|
2256
2285
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2257
2286
|
children: /* @__PURE__ */ Q("span", {
|
|
2258
2287
|
className: "flex items-center gap-1.5",
|
|
2259
|
-
children: [
|
|
2288
|
+
children: [K("detail.related"), /* @__PURE__ */ Z(b, {
|
|
2260
2289
|
variant: "secondary",
|
|
2261
2290
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2262
|
-
children:
|
|
2291
|
+
children: J.length
|
|
2263
2292
|
})]
|
|
2264
2293
|
})
|
|
2265
2294
|
}),
|
|
@@ -2268,7 +2297,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2268
2297
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2269
2298
|
children: /* @__PURE__ */ Q("span", {
|
|
2270
2299
|
className: "flex items-center gap-1.5",
|
|
2271
|
-
children: [
|
|
2300
|
+
children: [K("detail.activity"), /* @__PURE__ */ Z(b, {
|
|
2272
2301
|
variant: "secondary",
|
|
2273
2302
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2274
2303
|
children: q.activities.length
|
|
@@ -2278,14 +2307,14 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2278
2307
|
r && /* @__PURE__ */ Z(B, {
|
|
2279
2308
|
value: "discussion",
|
|
2280
2309
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2281
|
-
children:
|
|
2310
|
+
children: K("detail.discussion", { defaultValue: "Discussion" })
|
|
2282
2311
|
}),
|
|
2283
2312
|
i && /* @__PURE__ */ Z(B, {
|
|
2284
2313
|
value: "history",
|
|
2285
2314
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2286
2315
|
children: /* @__PURE__ */ Q("span", {
|
|
2287
2316
|
className: "flex items-center gap-1.5",
|
|
2288
|
-
children: [
|
|
2317
|
+
children: [K("detail.history", { defaultValue: "History" }), !q.history.loading && q.history.entries.length > 0 && /* @__PURE__ */ Z(b, {
|
|
2289
2318
|
variant: "secondary",
|
|
2290
2319
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2291
2320
|
children: q.history.entries.length
|
|
@@ -2294,17 +2323,17 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2294
2323
|
})
|
|
2295
2324
|
]
|
|
2296
2325
|
}),
|
|
2297
|
-
/* @__PURE__ */ Z(
|
|
2326
|
+
/* @__PURE__ */ Z(R, {
|
|
2298
2327
|
value: "details",
|
|
2299
2328
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2300
|
-
children:
|
|
2329
|
+
children: l
|
|
2301
2330
|
}),
|
|
2302
|
-
e && /* @__PURE__ */ Z(
|
|
2331
|
+
e && /* @__PURE__ */ Z(R, {
|
|
2303
2332
|
value: "related",
|
|
2304
2333
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2305
2334
|
children: /* @__PURE__ */ Z("div", {
|
|
2306
2335
|
className: "space-y-3",
|
|
2307
|
-
children:
|
|
2336
|
+
children: J.map((e, t) => /* @__PURE__ */ Z(Jt, {
|
|
2308
2337
|
title: e.title,
|
|
2309
2338
|
type: e.type,
|
|
2310
2339
|
api: e.api,
|
|
@@ -2320,36 +2349,36 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2320
2349
|
onRowEdit: e.onRowEdit,
|
|
2321
2350
|
onRowDelete: e.onRowDelete,
|
|
2322
2351
|
collapsible: !0,
|
|
2323
|
-
defaultCollapsed:
|
|
2324
|
-
pageSize:
|
|
2352
|
+
defaultCollapsed: ue && t > 0,
|
|
2353
|
+
pageSize: bn
|
|
2325
2354
|
}, t))
|
|
2326
2355
|
})
|
|
2327
2356
|
}),
|
|
2328
|
-
t && /* @__PURE__ */ Z(
|
|
2357
|
+
t && /* @__PURE__ */ Z(R, {
|
|
2329
2358
|
value: "activity",
|
|
2330
2359
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2331
|
-
children: /* @__PURE__ */ Z(
|
|
2360
|
+
children: /* @__PURE__ */ Z(an, { activities: q.activities })
|
|
2332
2361
|
}),
|
|
2333
|
-
r && /* @__PURE__ */ Z(
|
|
2362
|
+
r && /* @__PURE__ */ Z(R, {
|
|
2334
2363
|
value: "discussion",
|
|
2335
2364
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2336
2365
|
children: u
|
|
2337
2366
|
}),
|
|
2338
|
-
i && /* @__PURE__ */ Z(
|
|
2367
|
+
i && /* @__PURE__ */ Z(R, {
|
|
2339
2368
|
value: "history",
|
|
2340
2369
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2341
|
-
children: /* @__PURE__ */ Z(
|
|
2370
|
+
children: /* @__PURE__ */ Z(fn, {
|
|
2342
2371
|
entries: q.history.entries,
|
|
2343
2372
|
loading: q.history.loading,
|
|
2344
|
-
emptyText: q.history.emptyText ??
|
|
2373
|
+
emptyText: q.history.emptyText ?? K("detail.historyEmpty", { defaultValue: "No history yet" })
|
|
2345
2374
|
})
|
|
2346
2375
|
})
|
|
2347
2376
|
]
|
|
2348
2377
|
});
|
|
2349
|
-
})() : /* @__PURE__ */ Q(
|
|
2378
|
+
})() : /* @__PURE__ */ Q(Dt, { children: [
|
|
2350
2379
|
q.sectionGroups && q.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2351
2380
|
className: "space-y-3 sm:space-y-4",
|
|
2352
|
-
children: q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(
|
|
2381
|
+
children: q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Yt, {
|
|
2353
2382
|
group: e,
|
|
2354
2383
|
data: {
|
|
2355
2384
|
...g,
|
|
@@ -2358,13 +2387,13 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2358
2387
|
objectSchema: N,
|
|
2359
2388
|
objectName: q.objectName,
|
|
2360
2389
|
isEditing: T,
|
|
2361
|
-
onFieldChange:
|
|
2390
|
+
onFieldChange: Oe,
|
|
2362
2391
|
dataSource: n
|
|
2363
2392
|
}, t))
|
|
2364
2393
|
}),
|
|
2365
2394
|
q.sections && q.sections.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2366
2395
|
className: "space-y-3 sm:space-y-4",
|
|
2367
|
-
children: q.sections.map((e, t) => /* @__PURE__ */ Z(
|
|
2396
|
+
children: q.sections.map((e, t) => /* @__PURE__ */ Z(Gt, {
|
|
2368
2397
|
section: e,
|
|
2369
2398
|
data: {
|
|
2370
2399
|
...g,
|
|
@@ -2373,11 +2402,11 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2373
2402
|
objectSchema: N,
|
|
2374
2403
|
objectName: q.objectName,
|
|
2375
2404
|
isEditing: T,
|
|
2376
|
-
onFieldChange:
|
|
2405
|
+
onFieldChange: Oe,
|
|
2377
2406
|
dataSource: n
|
|
2378
2407
|
}, t))
|
|
2379
2408
|
}),
|
|
2380
|
-
q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(
|
|
2409
|
+
q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(Gt, {
|
|
2381
2410
|
section: {
|
|
2382
2411
|
fields: q.fields,
|
|
2383
2412
|
columns: q.columns
|
|
@@ -2389,19 +2418,19 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2389
2418
|
objectSchema: N,
|
|
2390
2419
|
objectName: q.objectName,
|
|
2391
2420
|
isEditing: T,
|
|
2392
|
-
onFieldChange:
|
|
2421
|
+
onFieldChange: Oe,
|
|
2393
2422
|
dataSource: n
|
|
2394
2423
|
}),
|
|
2395
|
-
q.tabs && q.tabs.length > 0 && /* @__PURE__ */ Z(
|
|
2424
|
+
q.tabs && q.tabs.length > 0 && /* @__PURE__ */ Z(Kt, {
|
|
2396
2425
|
tabs: q.tabs,
|
|
2397
2426
|
data: g
|
|
2398
2427
|
}),
|
|
2399
|
-
|
|
2428
|
+
J.length > 0 && /* @__PURE__ */ Q("div", {
|
|
2400
2429
|
className: "space-y-3",
|
|
2401
2430
|
children: [/* @__PURE__ */ Z("h2", {
|
|
2402
2431
|
className: "text-lg font-semibold",
|
|
2403
|
-
children:
|
|
2404
|
-
}),
|
|
2432
|
+
children: K("detail.related")
|
|
2433
|
+
}), J.map((e, t) => /* @__PURE__ */ Z(Jt, {
|
|
2405
2434
|
title: e.title,
|
|
2406
2435
|
type: e.type,
|
|
2407
2436
|
api: e.api,
|
|
@@ -2417,17 +2446,17 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2417
2446
|
onRowEdit: e.onRowEdit,
|
|
2418
2447
|
onRowDelete: e.onRowDelete,
|
|
2419
2448
|
collapsible: !0,
|
|
2420
|
-
defaultCollapsed:
|
|
2421
|
-
pageSize:
|
|
2449
|
+
defaultCollapsed: ue && t > 0,
|
|
2450
|
+
pageSize: bn
|
|
2422
2451
|
}, t))]
|
|
2423
2452
|
}),
|
|
2424
|
-
q.comments && /* @__PURE__ */ Z(
|
|
2453
|
+
q.comments && /* @__PURE__ */ Z(Qt, {
|
|
2425
2454
|
comments: q.comments,
|
|
2426
2455
|
onAddComment: q.onAddComment
|
|
2427
2456
|
}),
|
|
2428
|
-
q.activities && q.activities.length > 0 && /* @__PURE__ */ Z(
|
|
2457
|
+
q.activities && q.activities.length > 0 && /* @__PURE__ */ Z(an, { activities: q.activities })
|
|
2429
2458
|
] }),
|
|
2430
|
-
/* @__PURE__ */ Z(
|
|
2459
|
+
/* @__PURE__ */ Z(yn, {
|
|
2431
2460
|
data: {
|
|
2432
2461
|
...g,
|
|
2433
2462
|
...D
|
|
@@ -2441,7 +2470,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2441
2470
|
}) })
|
|
2442
2471
|
]
|
|
2443
2472
|
}) });
|
|
2444
|
-
},
|
|
2473
|
+
}, Cn = (e) => {
|
|
2445
2474
|
if (e == null) return "—";
|
|
2446
2475
|
if (typeof e == "string") return e.length > 0 ? e : "\"\"";
|
|
2447
2476
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -2450,7 +2479,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2450
2479
|
} catch {
|
|
2451
2480
|
return String(e);
|
|
2452
2481
|
}
|
|
2453
|
-
},
|
|
2482
|
+
}, wn = (e) => {
|
|
2454
2483
|
if (typeof e != "string" || e.length === 0) return null;
|
|
2455
2484
|
let t = /\d{4}-\d{2}-\d{2}[ T]/.test(e) ? e.replace(" ", "T") : e, n = new Date(t);
|
|
2456
2485
|
if (Number.isNaN(n.getTime())) return null;
|
|
@@ -2459,13 +2488,13 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2459
2488
|
} catch {
|
|
2460
2489
|
return n.toISOString();
|
|
2461
2490
|
}
|
|
2462
|
-
},
|
|
2463
|
-
let { t: o } = $(), s = t?.label || t?.field || "", l = t ?
|
|
2491
|
+
}, Tn = ({ open: e, conflict: t, onReload: n, onOverwrite: r, onCancel: i, busy: a = !1 }) => {
|
|
2492
|
+
let { t: o } = $(), s = t?.label || t?.field || "", l = t ? Cn(t.pendingValue) : "", u = t ? Cn(t.currentValue) : "", g = t?.currentRecord ?? {}, _ = (() => {
|
|
2464
2493
|
let e = [g.updated_by_name, g.updated_by_label];
|
|
2465
2494
|
for (let t of e) if (typeof t == "string" && t.length > 0) return t;
|
|
2466
2495
|
let t = g.updated_by;
|
|
2467
2496
|
return typeof t != "string" || t.length === 0 || t.length >= 16 && !/\s/.test(t) && /^[A-Za-z0-9_-]+$/.test(t) ? null : t;
|
|
2468
|
-
})(), v =
|
|
2497
|
+
})(), v = wn(g.updated_at ?? t?.currentVersion), [y, b] = o("detail.concurrentUpdateDescription", { field: "{{field}}" }).split("{{field}}");
|
|
2469
2498
|
return /* @__PURE__ */ Z(c, {
|
|
2470
2499
|
open: e,
|
|
2471
2500
|
onOpenChange: (e) => {
|
|
@@ -2534,14 +2563,14 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2534
2563
|
type: "button",
|
|
2535
2564
|
disabled: a,
|
|
2536
2565
|
onClick: i,
|
|
2537
|
-
className:
|
|
2566
|
+
className: G(W({ variant: "ghost" }), "mt-2 sm:mt-0"),
|
|
2538
2567
|
children: o("detail.concurrentUpdateCancel")
|
|
2539
2568
|
}),
|
|
2540
2569
|
/* @__PURE__ */ Z("button", {
|
|
2541
2570
|
type: "button",
|
|
2542
2571
|
disabled: a,
|
|
2543
2572
|
onClick: r,
|
|
2544
|
-
className:
|
|
2573
|
+
className: G(W({ variant: "outline" }), "mt-2 sm:mt-0 text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive"),
|
|
2545
2574
|
children: o("detail.concurrentUpdateOverwrite")
|
|
2546
2575
|
}),
|
|
2547
2576
|
/* @__PURE__ */ Z("button", {
|
|
@@ -2549,7 +2578,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2549
2578
|
disabled: a,
|
|
2550
2579
|
onClick: n,
|
|
2551
2580
|
autoFocus: !0,
|
|
2552
|
-
className:
|
|
2581
|
+
className: G(W({ variant: "default" }), "mt-2 sm:mt-0"),
|
|
2553
2582
|
children: o("detail.concurrentUpdateReload")
|
|
2554
2583
|
})
|
|
2555
2584
|
]
|
|
@@ -2558,14 +2587,14 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2558
2587
|
})
|
|
2559
2588
|
});
|
|
2560
2589
|
};
|
|
2561
|
-
function
|
|
2590
|
+
function En(e) {
|
|
2562
2591
|
if (!e || typeof e != "object") return !1;
|
|
2563
2592
|
let t = e;
|
|
2564
2593
|
return t.code === "CONCURRENT_UPDATE" || t.name === "ConcurrentUpdateError";
|
|
2565
2594
|
}
|
|
2566
2595
|
//#endregion
|
|
2567
2596
|
//#region src/renderers/record-details.tsx
|
|
2568
|
-
var
|
|
2597
|
+
var Dn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name) || null, On = (e) => {
|
|
2569
2598
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2570
2599
|
return {
|
|
2571
2600
|
designer: {
|
|
@@ -2575,8 +2604,80 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2575
2604
|
},
|
|
2576
2605
|
rest: i
|
|
2577
2606
|
};
|
|
2578
|
-
},
|
|
2579
|
-
let r =
|
|
2607
|
+
}, kn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2608
|
+
let r = mt(), { designer: i } = On(n), o = r?.objectName || "", s = kt(), { readableFields: c } = Ot(o), { sectionLabel: l } = _t(), u = dt(), [d, f] = a.useState(null), [p, m] = a.useState(!1), h = a.useCallback((t) => {
|
|
2609
|
+
let n = [...Array.isArray(e.fields) ? e.fields : [], ...(Array.isArray(e.sections) ? e.sections : []).flatMap((e) => Array.isArray(e?.fields) ? e.fields : [])];
|
|
2610
|
+
for (let e of n) if ((typeof e == "string" ? e : e?.name || e?.field) === t) return typeof e == "object" ? e?.label : void 0;
|
|
2611
|
+
}, [e.fields, e.sections]), g = a.useCallback(async (e, t) => {
|
|
2612
|
+
let n = r?.dataSource, i = r?.recordId, a = r?.objectName;
|
|
2613
|
+
if (!n || !i || !a) return;
|
|
2614
|
+
let o = typeof r?.data?.updated_at == "string" ? (r?.data).updated_at : void 0, s = o ? { ifMatch: o } : void 0;
|
|
2615
|
+
try {
|
|
2616
|
+
if (typeof n.update == "function") await n.update(a, i, { [e]: t }, s);
|
|
2617
|
+
else if (typeof n.updateOne == "function") await n.updateOne(a, i, { [e]: t }, s);
|
|
2618
|
+
else if (typeof n.patch == "function") await n.patch(a, i, { [e]: t }, s);
|
|
2619
|
+
else {
|
|
2620
|
+
console.warn("[record:details] DataSource exposes no update/updateOne/patch method; cannot persist inline edit");
|
|
2621
|
+
return;
|
|
2622
|
+
}
|
|
2623
|
+
typeof r?.refresh == "function" && await r.refresh();
|
|
2624
|
+
} catch (n) {
|
|
2625
|
+
if (En(n)) {
|
|
2626
|
+
let r = n.currentRecord ?? null;
|
|
2627
|
+
throw f({
|
|
2628
|
+
field: e,
|
|
2629
|
+
label: h(e),
|
|
2630
|
+
pendingValue: t,
|
|
2631
|
+
currentValue: r ? r[e] : void 0,
|
|
2632
|
+
currentVersion: n.currentVersion,
|
|
2633
|
+
currentRecord: r
|
|
2634
|
+
}), n;
|
|
2635
|
+
}
|
|
2636
|
+
throw console.error("[record:details] Inline-edit save failed", n), n;
|
|
2637
|
+
}
|
|
2638
|
+
}, [
|
|
2639
|
+
r?.dataSource,
|
|
2640
|
+
r?.recordId,
|
|
2641
|
+
r?.objectName,
|
|
2642
|
+
r?.data,
|
|
2643
|
+
r?.refresh,
|
|
2644
|
+
h
|
|
2645
|
+
]), _ = a.useCallback(() => {
|
|
2646
|
+
f(null), m(!1);
|
|
2647
|
+
}, []), v = a.useCallback(async () => {
|
|
2648
|
+
m(!0);
|
|
2649
|
+
try {
|
|
2650
|
+
typeof r?.refresh == "function" && await r.refresh();
|
|
2651
|
+
} finally {
|
|
2652
|
+
_();
|
|
2653
|
+
}
|
|
2654
|
+
}, [r?.refresh, _]), y = a.useCallback(async () => {
|
|
2655
|
+
if (!d) {
|
|
2656
|
+
_();
|
|
2657
|
+
return;
|
|
2658
|
+
}
|
|
2659
|
+
let e = r?.dataSource, t = r?.recordId, n = r?.objectName;
|
|
2660
|
+
if (!e || !t || !n) {
|
|
2661
|
+
_();
|
|
2662
|
+
return;
|
|
2663
|
+
}
|
|
2664
|
+
m(!0);
|
|
2665
|
+
try {
|
|
2666
|
+
let i = d.currentVersion ? { ifMatch: d.currentVersion } : void 0;
|
|
2667
|
+
typeof e.update == "function" ? await e.update(n, t, { [d.field]: d.pendingValue }, i) : typeof e.updateOne == "function" ? await e.updateOne(n, t, { [d.field]: d.pendingValue }, i) : typeof e.patch == "function" && await e.patch(n, t, { [d.field]: d.pendingValue }, i), typeof r?.refresh == "function" && await r.refresh();
|
|
2668
|
+
} catch (e) {
|
|
2669
|
+
console.error("[record:details] Overwrite-on-conflict failed", e);
|
|
2670
|
+
} finally {
|
|
2671
|
+
_();
|
|
2672
|
+
}
|
|
2673
|
+
}, [
|
|
2674
|
+
d,
|
|
2675
|
+
r?.dataSource,
|
|
2676
|
+
r?.recordId,
|
|
2677
|
+
r?.objectName,
|
|
2678
|
+
r?.refresh,
|
|
2679
|
+
_
|
|
2680
|
+
]);
|
|
2580
2681
|
if (!r) return /* @__PURE__ */ Z("div", {
|
|
2581
2682
|
className: t,
|
|
2582
2683
|
"data-record-details-placeholder": !0,
|
|
@@ -2586,8 +2687,8 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2586
2687
|
children: "record:details — bind a record to preview"
|
|
2587
2688
|
})
|
|
2588
2689
|
});
|
|
2589
|
-
let
|
|
2590
|
-
if (
|
|
2690
|
+
let b = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2691
|
+
if (b.length > 0 && o && !b.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2591
2692
|
className: t,
|
|
2592
2693
|
...i,
|
|
2593
2694
|
role: "status",
|
|
@@ -2597,20 +2698,20 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2597
2698
|
children: "Insufficient permissions to view details."
|
|
2598
2699
|
})
|
|
2599
2700
|
});
|
|
2600
|
-
let
|
|
2601
|
-
if (!e || !
|
|
2602
|
-
let t = e.map(
|
|
2701
|
+
let x = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", S = e.enforceFieldSecurity === !0, C = Array.isArray(e.redactFields) ? e.redactFields : [], w = (e) => {
|
|
2702
|
+
if (!e || !S && C.length === 0) return e;
|
|
2703
|
+
let t = e.map(Dn).filter((e) => !!e), n = new Set((S && o ? c(t) : t).filter((e) => !C.includes(e)));
|
|
2603
2704
|
return e.filter((e) => {
|
|
2604
|
-
let t =
|
|
2705
|
+
let t = Dn(e);
|
|
2605
2706
|
return t ? n.has(t) : !0;
|
|
2606
2707
|
});
|
|
2607
|
-
},
|
|
2708
|
+
}, T = (e) => typeof e == "string" ? { name: e } : e && typeof e == "object" && !e.name && e.field ? {
|
|
2608
2709
|
...e,
|
|
2609
2710
|
name: e.field
|
|
2610
|
-
} : e,
|
|
2611
|
-
for (let e of
|
|
2612
|
-
let
|
|
2613
|
-
|
|
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 : Dn(e)).filter((e) => !!e));
|
|
2712
|
+
for (let e of u) D.add(e);
|
|
2713
|
+
let O = r.objectSchema, k = r.data ?? {}, A = [
|
|
2714
|
+
O?.primaryField,
|
|
2614
2715
|
"name",
|
|
2615
2716
|
"full_name",
|
|
2616
2717
|
"title",
|
|
@@ -2618,125 +2719,53 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2618
2719
|
"display_name",
|
|
2619
2720
|
"label"
|
|
2620
2721
|
].filter((e) => typeof e == "string" && e.length > 0);
|
|
2621
|
-
for (let e of
|
|
2622
|
-
|
|
2722
|
+
for (let e of A) if (k[e] !== void 0 && k[e] !== null && k[e] !== "") {
|
|
2723
|
+
D.add(e);
|
|
2623
2724
|
break;
|
|
2624
2725
|
}
|
|
2625
|
-
let
|
|
2626
|
-
let t =
|
|
2627
|
-
return t ? !
|
|
2628
|
-
}),
|
|
2629
|
-
let t = e.title ?? e.label, n = e.name &&
|
|
2726
|
+
let j = (e) => !e || D.size === 0 ? e : e.filter((e) => {
|
|
2727
|
+
let t = Dn(e);
|
|
2728
|
+
return t ? !D.has(t) : !0;
|
|
2729
|
+
}), M = j(E(w(e.fields))), N = Array.isArray(e.sections) ? e.sections.map((e) => {
|
|
2730
|
+
let t = e.title ?? e.label, n = e.name && o ? l(o, e.name, t ?? e.name) : t;
|
|
2630
2731
|
return {
|
|
2631
2732
|
...e,
|
|
2632
2733
|
title: n,
|
|
2633
2734
|
showBorder: e.showBorder ?? !!n,
|
|
2634
2735
|
hideEmpty: e.hideEmpty ?? !0,
|
|
2635
|
-
fields:
|
|
2736
|
+
fields: j(E(w(e.fields)))
|
|
2636
2737
|
};
|
|
2637
|
-
}) : e.sections,
|
|
2638
|
-
let n = [...Array.isArray(e.fields) ? e.fields : [], ...(Array.isArray(e.sections) ? e.sections : []).flatMap((e) => Array.isArray(e?.fields) ? e.fields : [])];
|
|
2639
|
-
for (let e of n) if ((typeof e == "string" ? e : e?.name || e?.field) === t) return typeof e == "object" ? e?.label : void 0;
|
|
2640
|
-
}, [e.fields, e.sections]), j = a.useCallback(async (e, t) => {
|
|
2641
|
-
let n = r.dataSource, i = r.recordId, a = r.objectName;
|
|
2642
|
-
if (!n || !i || !a) return;
|
|
2643
|
-
let o = typeof r.data?.updated_at == "string" ? r.data.updated_at : void 0, s = o ? { ifMatch: o } : void 0;
|
|
2644
|
-
try {
|
|
2645
|
-
if (typeof n.update == "function") await n.update(a, i, { [e]: t }, s);
|
|
2646
|
-
else if (typeof n.updateOne == "function") await n.updateOne(a, i, { [e]: t }, s);
|
|
2647
|
-
else if (typeof n.patch == "function") await n.patch(a, i, { [e]: t }, s);
|
|
2648
|
-
else {
|
|
2649
|
-
console.warn("[record:details] DataSource exposes no update/updateOne/patch method; cannot persist inline edit");
|
|
2650
|
-
return;
|
|
2651
|
-
}
|
|
2652
|
-
typeof r.refresh == "function" && await r.refresh();
|
|
2653
|
-
} catch (n) {
|
|
2654
|
-
if (Cn(n)) {
|
|
2655
|
-
let r = n.currentRecord ?? null;
|
|
2656
|
-
throw D({
|
|
2657
|
-
field: e,
|
|
2658
|
-
label: A(e),
|
|
2659
|
-
pendingValue: t,
|
|
2660
|
-
currentValue: r ? r[e] : void 0,
|
|
2661
|
-
currentVersion: n.currentVersion,
|
|
2662
|
-
currentRecord: r
|
|
2663
|
-
}), n;
|
|
2664
|
-
}
|
|
2665
|
-
throw console.error("[record:details] Inline-edit save failed", n), n;
|
|
2666
|
-
}
|
|
2667
|
-
}, [
|
|
2668
|
-
r.dataSource,
|
|
2669
|
-
r.recordId,
|
|
2670
|
-
r.objectName,
|
|
2671
|
-
r.data,
|
|
2672
|
-
r.refresh,
|
|
2673
|
-
A
|
|
2674
|
-
]), M = a.useCallback(() => {
|
|
2675
|
-
D(null), k(!1);
|
|
2676
|
-
}, []), N = a.useCallback(async () => {
|
|
2677
|
-
k(!0);
|
|
2678
|
-
try {
|
|
2679
|
-
typeof r.refresh == "function" && await r.refresh();
|
|
2680
|
-
} finally {
|
|
2681
|
-
M();
|
|
2682
|
-
}
|
|
2683
|
-
}, [r.refresh, M]), ee = a.useCallback(async () => {
|
|
2684
|
-
if (!E) {
|
|
2685
|
-
M();
|
|
2686
|
-
return;
|
|
2687
|
-
}
|
|
2688
|
-
let e = r.dataSource, t = r.recordId, n = r.objectName;
|
|
2689
|
-
if (!e || !t || !n) {
|
|
2690
|
-
M();
|
|
2691
|
-
return;
|
|
2692
|
-
}
|
|
2693
|
-
k(!0);
|
|
2694
|
-
try {
|
|
2695
|
-
let i = E.currentVersion ? { ifMatch: E.currentVersion } : void 0;
|
|
2696
|
-
typeof e.update == "function" ? await e.update(n, t, { [E.field]: E.pendingValue }, i) : typeof e.updateOne == "function" ? await e.updateOne(n, t, { [E.field]: E.pendingValue }, i) : typeof e.patch == "function" && await e.patch(n, t, { [E.field]: E.pendingValue }, i), typeof r.refresh == "function" && await r.refresh();
|
|
2697
|
-
} catch (e) {
|
|
2698
|
-
console.error("[record:details] Overwrite-on-conflict failed", e);
|
|
2699
|
-
} finally {
|
|
2700
|
-
M();
|
|
2701
|
-
}
|
|
2702
|
-
}, [
|
|
2703
|
-
E,
|
|
2704
|
-
r.dataSource,
|
|
2705
|
-
r.recordId,
|
|
2706
|
-
r.objectName,
|
|
2707
|
-
r.refresh,
|
|
2708
|
-
M
|
|
2709
|
-
]), te = {
|
|
2738
|
+
}) : e.sections, ee = e.inlineEdit ?? !0, te = {
|
|
2710
2739
|
type: "detail-view",
|
|
2711
2740
|
objectName: r.objectName,
|
|
2712
2741
|
resourceId: r.recordId,
|
|
2713
2742
|
data: r.data,
|
|
2714
|
-
layout:
|
|
2743
|
+
layout: x,
|
|
2715
2744
|
columns: e.columns,
|
|
2716
|
-
sections:
|
|
2717
|
-
fields:
|
|
2745
|
+
sections: N,
|
|
2746
|
+
fields: M,
|
|
2718
2747
|
showBack: !1,
|
|
2719
2748
|
showHeader: e.showHeader ?? !1,
|
|
2720
|
-
inlineEdit:
|
|
2749
|
+
inlineEdit: ee
|
|
2721
2750
|
};
|
|
2722
2751
|
return /* @__PURE__ */ Q("div", {
|
|
2723
2752
|
className: t,
|
|
2724
2753
|
...i,
|
|
2725
|
-
children: [/* @__PURE__ */ Z(
|
|
2754
|
+
children: [/* @__PURE__ */ Z(Sn, {
|
|
2726
2755
|
schema: te,
|
|
2727
2756
|
dataSource: r.dataSource,
|
|
2728
|
-
inlineEdit:
|
|
2729
|
-
onFieldSave:
|
|
2730
|
-
}), /* @__PURE__ */ Z(
|
|
2731
|
-
open: !!
|
|
2732
|
-
conflict:
|
|
2733
|
-
busy:
|
|
2734
|
-
onCancel:
|
|
2735
|
-
onReload:
|
|
2736
|
-
onOverwrite:
|
|
2757
|
+
inlineEdit: ee,
|
|
2758
|
+
onFieldSave: g
|
|
2759
|
+
}), /* @__PURE__ */ Z(Tn, {
|
|
2760
|
+
open: !!d,
|
|
2761
|
+
conflict: d,
|
|
2762
|
+
busy: p,
|
|
2763
|
+
onCancel: _,
|
|
2764
|
+
onReload: v,
|
|
2765
|
+
onOverwrite: y
|
|
2737
2766
|
})]
|
|
2738
2767
|
});
|
|
2739
|
-
},
|
|
2768
|
+
}, An = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name || e.key) || null, jn = (e) => e?.id ?? e?._id ?? null, Mn = (e) => {
|
|
2740
2769
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2741
2770
|
return {
|
|
2742
2771
|
designer: {
|
|
@@ -2746,12 +2775,12 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2746
2775
|
},
|
|
2747
2776
|
rest: i
|
|
2748
2777
|
};
|
|
2749
|
-
},
|
|
2750
|
-
let r =
|
|
2751
|
-
name:
|
|
2752
|
-
label:
|
|
2753
|
-
}) :
|
|
2754
|
-
if (!
|
|
2778
|
+
}, Nn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2779
|
+
let r = mt(), { designer: i } = Mn(n), o = _t(), s = e.objectName, c = s && o.objectLabel ? o.objectLabel({
|
|
2780
|
+
name: s,
|
|
2781
|
+
label: Tt(s)
|
|
2782
|
+
}) : s ? Tt(s) : "", l = e.title || c || "Related";
|
|
2783
|
+
if (!s) return /* @__PURE__ */ Z("div", {
|
|
2755
2784
|
className: t,
|
|
2756
2785
|
...i,
|
|
2757
2786
|
children: /* @__PURE__ */ Z("div", {
|
|
@@ -2759,8 +2788,17 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2759
2788
|
children: "record:related_list — missing objectName"
|
|
2760
2789
|
})
|
|
2761
2790
|
});
|
|
2762
|
-
let
|
|
2763
|
-
|
|
2791
|
+
let u = kt(), { readableFields: d } = Ot(s), f = gt(), p = a.useMemo(() => f?.resolve({
|
|
2792
|
+
objectName: s,
|
|
2793
|
+
relationshipField: e.relationshipField,
|
|
2794
|
+
parentId: r?.recordId ?? null
|
|
2795
|
+
}) ?? null, [
|
|
2796
|
+
f,
|
|
2797
|
+
s,
|
|
2798
|
+
e.relationshipField,
|
|
2799
|
+
r?.recordId
|
|
2800
|
+
]), m = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2801
|
+
if (m.length > 0 && !m.every((e) => u.can(s, e))) return /* @__PURE__ */ Z("div", {
|
|
2764
2802
|
className: t,
|
|
2765
2803
|
...i,
|
|
2766
2804
|
role: "status",
|
|
@@ -2770,35 +2808,49 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2770
2808
|
children: "Insufficient permissions to view related list."
|
|
2771
2809
|
})
|
|
2772
2810
|
});
|
|
2773
|
-
let
|
|
2774
|
-
if (
|
|
2775
|
-
let e =
|
|
2776
|
-
|
|
2777
|
-
let n =
|
|
2811
|
+
let h = e.enforceFieldSecurity === !0, g = Array.isArray(e.redactFields) ? e.redactFields : [], _ = Array.isArray(e.columns) ? e.columns : [], v = _;
|
|
2812
|
+
if (h || g.length > 0) {
|
|
2813
|
+
let e = _.map(An).filter((e) => !!e), t = new Set((h ? d(e) : e).filter((e) => !g.includes(e)));
|
|
2814
|
+
v = _.filter((e) => {
|
|
2815
|
+
let n = An(e);
|
|
2778
2816
|
return n ? t.has(n) : !0;
|
|
2779
2817
|
});
|
|
2780
2818
|
}
|
|
2781
2819
|
return /* @__PURE__ */ Z("div", {
|
|
2782
2820
|
className: t,
|
|
2783
2821
|
...i,
|
|
2784
|
-
children: /* @__PURE__ */ Z(
|
|
2785
|
-
title:
|
|
2822
|
+
children: /* @__PURE__ */ Z(Jt, {
|
|
2823
|
+
title: l,
|
|
2786
2824
|
type: "table",
|
|
2787
|
-
api:
|
|
2788
|
-
objectName:
|
|
2825
|
+
api: s,
|
|
2826
|
+
objectName: s,
|
|
2789
2827
|
referenceField: e.relationshipField,
|
|
2790
2828
|
parentId: r?.recordId,
|
|
2791
|
-
columns:
|
|
2829
|
+
columns: v,
|
|
2792
2830
|
pageSize: e.limit,
|
|
2793
2831
|
dataSource: r?.dataSource,
|
|
2794
2832
|
add: e.add,
|
|
2795
|
-
|
|
2833
|
+
rowActions: p?.rowActions,
|
|
2834
|
+
onRowAction: p?.onRowAction,
|
|
2835
|
+
onNew: p?.onCreate,
|
|
2836
|
+
onRowClick: p?.onView ? (e) => {
|
|
2837
|
+
let t = jn(e);
|
|
2838
|
+
t != null && p.onView(t, e);
|
|
2839
|
+
} : void 0,
|
|
2840
|
+
onRowEdit: p?.onEdit ? (e) => {
|
|
2841
|
+
let t = jn(e);
|
|
2842
|
+
t != null && p.onEdit(t, e);
|
|
2843
|
+
} : void 0,
|
|
2844
|
+
onRowDelete: p?.onDelete ? (e) => {
|
|
2845
|
+
let t = jn(e);
|
|
2846
|
+
if (t != null) return p.onDelete(t, e);
|
|
2847
|
+
} : e.add && r?.dataSource ? async (e) => {
|
|
2796
2848
|
let t = e?.id ?? e?._id;
|
|
2797
|
-
t != null && await r.dataSource.delete?.(
|
|
2849
|
+
t != null && await r.dataSource.delete?.(s, String(t));
|
|
2798
2850
|
} : void 0
|
|
2799
2851
|
})
|
|
2800
2852
|
});
|
|
2801
|
-
},
|
|
2853
|
+
}, Pn = (e) => {
|
|
2802
2854
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2803
2855
|
return {
|
|
2804
2856
|
designer: {
|
|
@@ -2808,8 +2860,8 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2808
2860
|
},
|
|
2809
2861
|
rest: i
|
|
2810
2862
|
};
|
|
2811
|
-
},
|
|
2812
|
-
let r =
|
|
2863
|
+
}, Fn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2864
|
+
let r = mt(), { designer: i } = Pn(n), o = r?.objectName || "", s = kt(), { readableFields: c } = Ot(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2813
2865
|
if (l.length > 0 && o && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2814
2866
|
className: t,
|
|
2815
2867
|
...i,
|
|
@@ -2826,20 +2878,20 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2826
2878
|
icon: e?.icon,
|
|
2827
2879
|
type: e?.type
|
|
2828
2880
|
}).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)));
|
|
2829
|
-
return
|
|
2881
|
+
return ht(a.useId(), m.map((e) => e.name)), /* @__PURE__ */ Z("div", {
|
|
2830
2882
|
className: t,
|
|
2831
2883
|
...i,
|
|
2832
|
-
children: /* @__PURE__ */ Z(
|
|
2884
|
+
children: /* @__PURE__ */ Z(Xt, {
|
|
2833
2885
|
fields: m,
|
|
2834
2886
|
data: r?.data,
|
|
2835
2887
|
objectName: r?.objectName,
|
|
2836
2888
|
objectSchema: r?.objectSchema
|
|
2837
2889
|
})
|
|
2838
2890
|
});
|
|
2839
|
-
},
|
|
2891
|
+
}, In = ({ change: e, className: t }) => {
|
|
2840
2892
|
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));
|
|
2841
2893
|
return /* @__PURE__ */ Q("div", {
|
|
2842
|
-
className:
|
|
2894
|
+
className: G("flex items-center gap-1.5 text-sm flex-wrap", t),
|
|
2843
2895
|
children: [
|
|
2844
2896
|
/* @__PURE__ */ Z("span", {
|
|
2845
2897
|
className: "font-medium text-foreground",
|
|
@@ -2856,22 +2908,22 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2856
2908
|
})
|
|
2857
2909
|
]
|
|
2858
2910
|
});
|
|
2859
|
-
},
|
|
2911
|
+
}, Ln = [
|
|
2860
2912
|
"👍",
|
|
2861
2913
|
"❤️",
|
|
2862
2914
|
"🎉",
|
|
2863
2915
|
"😂",
|
|
2864
2916
|
"😮",
|
|
2865
2917
|
"😢"
|
|
2866
|
-
],
|
|
2918
|
+
], Rn = ({ reactions: e, onToggleReaction: t, emojiOptions: n = Ln, className: r }) => {
|
|
2867
2919
|
let [a, o] = i.useState(!1), s = i.useCallback((e) => {
|
|
2868
2920
|
t?.(e), o(!1);
|
|
2869
2921
|
}, [t]);
|
|
2870
2922
|
return /* @__PURE__ */ Q("div", {
|
|
2871
|
-
className:
|
|
2923
|
+
className: G("flex items-center gap-1 flex-wrap", r),
|
|
2872
2924
|
children: [e.map((e) => /* @__PURE__ */ Q("button", {
|
|
2873
2925
|
type: "button",
|
|
2874
|
-
className:
|
|
2926
|
+
className: G("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs border transition-colors", e.reacted ? "bg-primary/10 border-primary/30 text-primary" : "bg-muted border-border text-muted-foreground hover:bg-muted/80"),
|
|
2875
2927
|
onClick: () => s(e.emoji),
|
|
2876
2928
|
disabled: !t,
|
|
2877
2929
|
"aria-label": `${e.emoji} ${e.count} reaction${e.count === 1 ? "" : "s"}`,
|
|
@@ -2903,7 +2955,7 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2903
2955
|
};
|
|
2904
2956
|
//#endregion
|
|
2905
2957
|
//#region src/ThreadedReplies.tsx
|
|
2906
|
-
function
|
|
2958
|
+
function zn(e, t) {
|
|
2907
2959
|
try {
|
|
2908
2960
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
2909
2961
|
if (i < 1) return t("detail.justNow");
|
|
@@ -2916,7 +2968,7 @@ function Fn(e, t) {
|
|
|
2916
2968
|
return e;
|
|
2917
2969
|
}
|
|
2918
2970
|
}
|
|
2919
|
-
var
|
|
2971
|
+
var Bn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, className: a }) => {
|
|
2920
2972
|
let { t: o } = $(), [s, c] = i.useState(!1), [l, u] = i.useState(""), [d, f] = i.useState(!1), p = i.useCallback(async () => {
|
|
2921
2973
|
let t = l.trim();
|
|
2922
2974
|
if (!(!t || !n)) {
|
|
@@ -2935,7 +2987,7 @@ var In = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
2935
2987
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), p());
|
|
2936
2988
|
}, [p]);
|
|
2937
2989
|
return t.length === 0 && !r ? null : /* @__PURE__ */ Q("div", {
|
|
2938
|
-
className:
|
|
2990
|
+
className: G("ml-10 mt-1", a),
|
|
2939
2991
|
children: [
|
|
2940
2992
|
t.length > 0 && /* @__PURE__ */ Q("button", {
|
|
2941
2993
|
type: "button",
|
|
@@ -2944,7 +2996,7 @@ var In = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
2944
2996
|
"aria-expanded": s,
|
|
2945
2997
|
children: [
|
|
2946
2998
|
Z(s ? ve : be, { className: "h-3 w-3" }),
|
|
2947
|
-
/* @__PURE__ */ Z(
|
|
2999
|
+
/* @__PURE__ */ Z(X, { className: "h-3 w-3" }),
|
|
2948
3000
|
/* @__PURE__ */ Z("span", { children: t.length === 1 ? o("detail.replyCount", { count: t.length }) : o("detail.replyCountPlural", { count: t.length }) })
|
|
2949
3001
|
]
|
|
2950
3002
|
}),
|
|
@@ -2971,7 +3023,7 @@ var In = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
2971
3023
|
children: e.actor
|
|
2972
3024
|
}), /* @__PURE__ */ Z("span", {
|
|
2973
3025
|
className: "text-[10px] text-muted-foreground",
|
|
2974
|
-
children:
|
|
3026
|
+
children: zn(e.createdAt, o)
|
|
2975
3027
|
})]
|
|
2976
3028
|
}), /* @__PURE__ */ Z("p", {
|
|
2977
3029
|
className: "text-xs whitespace-pre-wrap break-words",
|
|
@@ -3001,7 +3053,7 @@ var In = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3001
3053
|
})
|
|
3002
3054
|
]
|
|
3003
3055
|
});
|
|
3004
|
-
},
|
|
3056
|
+
}, Vn = ({ subscription: e, onToggle: t, className: n }) => {
|
|
3005
3057
|
let { t: r } = $(), [a, o] = i.useState(!1), s = i.useCallback(async () => {
|
|
3006
3058
|
if (t) {
|
|
3007
3059
|
o(!0);
|
|
@@ -3015,7 +3067,7 @@ var In = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3015
3067
|
return /* @__PURE__ */ Z(x, {
|
|
3016
3068
|
variant: "ghost",
|
|
3017
3069
|
size: "icon",
|
|
3018
|
-
className:
|
|
3070
|
+
className: G("h-8 w-8", n),
|
|
3019
3071
|
onClick: s,
|
|
3020
3072
|
disabled: a || !t,
|
|
3021
3073
|
"aria-label": e.subscribed ? r("detail.unsubscribeAriaLabel") : r("detail.subscribeAriaLabel"),
|
|
@@ -3025,11 +3077,11 @@ var In = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3025
3077
|
};
|
|
3026
3078
|
//#endregion
|
|
3027
3079
|
//#region src/RichTextCommentInput.tsx
|
|
3028
|
-
function
|
|
3080
|
+
function Hn(e) {
|
|
3029
3081
|
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/>");
|
|
3030
3082
|
return t = t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g, (e) => `<ul class="my-1">${e.replace(/<br\/>/g, "")}</ul>`), t;
|
|
3031
3083
|
}
|
|
3032
|
-
var
|
|
3084
|
+
var Un = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], placeholder: a, className: o, disabled: s = !1, extraSlot: c, canSubmitEmpty: l = !1 }) => {
|
|
3033
3085
|
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(() => {
|
|
3034
3086
|
if (!h) return r;
|
|
3035
3087
|
let e = h.toLowerCase();
|
|
@@ -3090,7 +3142,7 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3090
3142
|
n
|
|
3091
3143
|
]);
|
|
3092
3144
|
return /* @__PURE__ */ Q("div", {
|
|
3093
|
-
className:
|
|
3145
|
+
className: G("border rounded-md", o),
|
|
3094
3146
|
children: [
|
|
3095
3147
|
/* @__PURE__ */ Q("div", {
|
|
3096
3148
|
className: "flex items-center gap-0.5 px-2 py-1.5 border-b bg-muted/30",
|
|
@@ -3111,7 +3163,7 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3111
3163
|
onClick: w,
|
|
3112
3164
|
disabled: s || d,
|
|
3113
3165
|
title: u("detail.italic"),
|
|
3114
|
-
children: /* @__PURE__ */ Z(
|
|
3166
|
+
children: /* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" })
|
|
3115
3167
|
}),
|
|
3116
3168
|
/* @__PURE__ */ Z(x, {
|
|
3117
3169
|
variant: "ghost",
|
|
@@ -3120,7 +3172,7 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3120
3172
|
onClick: T,
|
|
3121
3173
|
disabled: s || d,
|
|
3122
3174
|
title: u("detail.listFormat"),
|
|
3123
|
-
children: /* @__PURE__ */ Z(
|
|
3175
|
+
children: /* @__PURE__ */ Z(Ie, { className: "h-3.5 w-3.5" })
|
|
3124
3176
|
}),
|
|
3125
3177
|
/* @__PURE__ */ Z(x, {
|
|
3126
3178
|
variant: "ghost",
|
|
@@ -3138,7 +3190,7 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3138
3190
|
onClick: D,
|
|
3139
3191
|
disabled: s || d,
|
|
3140
3192
|
title: u("detail.mentionSomeone"),
|
|
3141
|
-
children: /* @__PURE__ */ Z(
|
|
3193
|
+
children: /* @__PURE__ */ Z(q, { className: "h-3.5 w-3.5" })
|
|
3142
3194
|
}),
|
|
3143
3195
|
/* @__PURE__ */ Z("div", { className: "flex-1" }),
|
|
3144
3196
|
/* @__PURE__ */ Z(x, {
|
|
@@ -3147,7 +3199,7 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3147
3199
|
className: "h-7 w-7",
|
|
3148
3200
|
onClick: () => f(!d),
|
|
3149
3201
|
title: u(d ? "detail.edit" : "detail.preview"),
|
|
3150
|
-
children: Z(d ?
|
|
3202
|
+
children: Z(d ? Ee : Oe, { className: "h-3.5 w-3.5" })
|
|
3151
3203
|
}),
|
|
3152
3204
|
n && /* @__PURE__ */ Z(x, {
|
|
3153
3205
|
variant: "ghost",
|
|
@@ -3164,8 +3216,8 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3164
3216
|
className: "relative",
|
|
3165
3217
|
children: d ? /* @__PURE__ */ Z("div", {
|
|
3166
3218
|
className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
|
|
3167
|
-
dangerouslySetInnerHTML: { __html:
|
|
3168
|
-
}) : /* @__PURE__ */ Q(
|
|
3219
|
+
dangerouslySetInnerHTML: { __html: Hn(e) }
|
|
3220
|
+
}) : /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z("textarea", {
|
|
3169
3221
|
ref: y,
|
|
3170
3222
|
className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
|
|
3171
3223
|
placeholder: a ?? u("detail.writeComment"),
|
|
@@ -3177,7 +3229,7 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3177
3229
|
className: "absolute left-2 bottom-full mb-1 w-56 bg-popover border rounded-md shadow-md z-50 max-h-40 overflow-y-auto",
|
|
3178
3230
|
children: b.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
3179
3231
|
type: "button",
|
|
3180
|
-
className:
|
|
3232
|
+
className: G("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === _ && "bg-accent"),
|
|
3181
3233
|
onMouseDown: (t) => {
|
|
3182
3234
|
t.preventDefault(), O(e);
|
|
3183
3235
|
},
|
|
@@ -3201,16 +3253,16 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3201
3253
|
};
|
|
3202
3254
|
//#endregion
|
|
3203
3255
|
//#region src/CommentAttachment.tsx
|
|
3204
|
-
function
|
|
3256
|
+
function Wn(e) {
|
|
3205
3257
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
3206
3258
|
}
|
|
3207
|
-
function
|
|
3259
|
+
function Gn(e) {
|
|
3208
3260
|
return e.startsWith("image/");
|
|
3209
3261
|
}
|
|
3210
|
-
function
|
|
3211
|
-
return
|
|
3262
|
+
function Kn(e) {
|
|
3263
|
+
return Gn(e) ? Me : e.includes("pdf") || e.includes("document") || e.includes("text") ? je : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? Ae : ke;
|
|
3212
3264
|
}
|
|
3213
|
-
var
|
|
3265
|
+
var qn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a = !1 }) => {
|
|
3214
3266
|
let { t: o } = $(), [s, c] = i.useState(!1), l = i.useRef(null), u = i.useCallback((e) => {
|
|
3215
3267
|
e.preventDefault(), e.stopPropagation(), c(!0);
|
|
3216
3268
|
}, []), d = i.useCallback((e) => {
|
|
@@ -3221,9 +3273,9 @@ var Un = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3221
3273
|
t && e.target.files && e.target.files.length > 0 && (t(e.target.files), e.target.value = "");
|
|
3222
3274
|
}, [t]);
|
|
3223
3275
|
return /* @__PURE__ */ Q("div", {
|
|
3224
|
-
className:
|
|
3276
|
+
className: G("space-y-2", r),
|
|
3225
3277
|
children: [t && !a && /* @__PURE__ */ Q("div", {
|
|
3226
|
-
className:
|
|
3278
|
+
className: G("border-2 border-dashed rounded-md px-4 py-3 text-center transition-colors cursor-pointer", s ? "border-primary bg-primary/5" : "border-muted-foreground/25 hover:border-muted-foreground/40"),
|
|
3227
3279
|
onDragOver: u,
|
|
3228
3280
|
onDragLeave: d,
|
|
3229
3281
|
onDrop: f,
|
|
@@ -3255,7 +3307,7 @@ var Un = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3255
3307
|
}), /* @__PURE__ */ Z("div", {
|
|
3256
3308
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
|
|
3257
3309
|
children: e.map((e) => {
|
|
3258
|
-
let t =
|
|
3310
|
+
let t = Gn(e.type), r = Kn(e.type);
|
|
3259
3311
|
return /* @__PURE__ */ Q("div", {
|
|
3260
3312
|
className: "flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group",
|
|
3261
3313
|
children: [
|
|
@@ -3274,7 +3326,7 @@ var Un = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3274
3326
|
children: e.name
|
|
3275
3327
|
}), /* @__PURE__ */ Z("p", {
|
|
3276
3328
|
className: "text-[10px] text-muted-foreground",
|
|
3277
|
-
children:
|
|
3329
|
+
children: Wn(e.size)
|
|
3278
3330
|
})]
|
|
3279
3331
|
}),
|
|
3280
3332
|
n && !a && /* @__PURE__ */ Z(x, {
|
|
@@ -3291,15 +3343,15 @@ var Un = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3291
3343
|
})]
|
|
3292
3344
|
})]
|
|
3293
3345
|
});
|
|
3294
|
-
},
|
|
3295
|
-
comment:
|
|
3296
|
-
field_change:
|
|
3346
|
+
}, Jn = {
|
|
3347
|
+
comment: X,
|
|
3348
|
+
field_change: Ee,
|
|
3297
3349
|
task: _e,
|
|
3298
3350
|
event: he,
|
|
3299
3351
|
system: rt,
|
|
3300
|
-
email:
|
|
3352
|
+
email: ze,
|
|
3301
3353
|
call: We
|
|
3302
|
-
},
|
|
3354
|
+
}, Yn = {
|
|
3303
3355
|
comment: "bg-purple-100 text-purple-600",
|
|
3304
3356
|
field_change: "bg-blue-100 text-blue-600",
|
|
3305
3357
|
task: "bg-green-100 text-green-600",
|
|
@@ -3308,7 +3360,7 @@ var Un = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3308
3360
|
email: "bg-indigo-100 text-indigo-600",
|
|
3309
3361
|
call: "bg-teal-100 text-teal-600"
|
|
3310
3362
|
};
|
|
3311
|
-
function
|
|
3363
|
+
function Xn(e) {
|
|
3312
3364
|
return [
|
|
3313
3365
|
{
|
|
3314
3366
|
value: "all",
|
|
@@ -3328,7 +3380,7 @@ function Kn(e) {
|
|
|
3328
3380
|
}
|
|
3329
3381
|
];
|
|
3330
3382
|
}
|
|
3331
|
-
function
|
|
3383
|
+
function Zn(e, t) {
|
|
3332
3384
|
try {
|
|
3333
3385
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
3334
3386
|
if (i < 1) return t("detail.justNow");
|
|
@@ -3341,7 +3393,7 @@ function qn(e, t) {
|
|
|
3341
3393
|
return e;
|
|
3342
3394
|
}
|
|
3343
3395
|
}
|
|
3344
|
-
function
|
|
3396
|
+
function Qn(e, t) {
|
|
3345
3397
|
switch (t) {
|
|
3346
3398
|
case "comments_only": return e.filter((e) => e.type === "comment");
|
|
3347
3399
|
case "changes_only": return e.filter((e) => e.type === "field_change");
|
|
@@ -3349,18 +3401,18 @@ function Jn(e, t) {
|
|
|
3349
3401
|
default: return e;
|
|
3350
3402
|
}
|
|
3351
3403
|
}
|
|
3352
|
-
var
|
|
3353
|
-
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([]), [
|
|
3354
|
-
if (!
|
|
3404
|
+
var $n = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a = !1, onLoadMore: o, loading: s = !1, onAddComment: c, onAddReply: l, onToggleReaction: u, subscription: d, onToggleSubscription: f, collapseWhenEmpty: p = !1, mentionSuggestions: m, onUploadAttachments: h, titleLabel: g, emptyLabel: _, className: v }) => {
|
|
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([]), [re, ie] = i.useState(!1), P = n ?? b, F = t?.showFilterToggle !== !1, I = t?.showCommentInput !== !1 && !!c, L = t?.enableReactions ?? !1, R = t?.enableThreading ?? !1, z = t?.showSubscriptionToggle ?? !1, B = i.useMemo(() => Qn(e, P), [e, P]), V = i.useMemo(() => R ? B.filter((e) => !e.parentId) : B, [B, R]), H = i.useMemo(() => {
|
|
3406
|
+
if (!R) return /* @__PURE__ */ new Map();
|
|
3355
3407
|
let e = /* @__PURE__ */ new Map();
|
|
3356
3408
|
for (let t of B) if (t.parentId) {
|
|
3357
3409
|
let n = e.get(t.parentId) ?? [];
|
|
3358
3410
|
n.push(t), e.set(t.parentId, n);
|
|
3359
3411
|
}
|
|
3360
3412
|
return e;
|
|
3361
|
-
}, [B,
|
|
3413
|
+
}, [B, R]), ae = i.useCallback((e) => {
|
|
3362
3414
|
r ? r(e) : S(e);
|
|
3363
|
-
}, [r]),
|
|
3415
|
+
}, [r]), U = i.useCallback(async () => {
|
|
3364
3416
|
let e = C.trim();
|
|
3365
3417
|
if (c && !(!e && A.length === 0)) {
|
|
3366
3418
|
E(!0);
|
|
@@ -3374,17 +3426,17 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3374
3426
|
C,
|
|
3375
3427
|
A,
|
|
3376
3428
|
c
|
|
3377
|
-
]),
|
|
3429
|
+
]), W = i.useCallback(async (e) => {
|
|
3378
3430
|
if (!(!h || e.length === 0)) {
|
|
3379
|
-
|
|
3431
|
+
ie(!0);
|
|
3380
3432
|
try {
|
|
3381
3433
|
let t = await h(e);
|
|
3382
3434
|
Array.isArray(t) && t.length > 0 && j((e) => [...e, ...t]);
|
|
3383
3435
|
} finally {
|
|
3384
|
-
|
|
3436
|
+
ie(!1);
|
|
3385
3437
|
}
|
|
3386
3438
|
}
|
|
3387
|
-
}, [h]),
|
|
3439
|
+
}, [h]), oe = i.useCallback((e) => {
|
|
3388
3440
|
j((t) => t.filter((t) => t.id !== e));
|
|
3389
3441
|
}, []), se = i.useCallback(async () => {
|
|
3390
3442
|
if (o) {
|
|
@@ -3397,7 +3449,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3397
3449
|
}
|
|
3398
3450
|
}, [o]);
|
|
3399
3451
|
return /* @__PURE__ */ Q("section", {
|
|
3400
|
-
className:
|
|
3452
|
+
className: G("border-t border-border/60 pt-5", v),
|
|
3401
3453
|
"aria-label": "Discussion",
|
|
3402
3454
|
children: [/* @__PURE__ */ Z("header", {
|
|
3403
3455
|
className: "mb-4",
|
|
@@ -3406,7 +3458,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3406
3458
|
children: [/* @__PURE__ */ Q("h2", {
|
|
3407
3459
|
className: "flex items-center gap-2 text-base font-semibold leading-none tracking-tight",
|
|
3408
3460
|
children: [
|
|
3409
|
-
/* @__PURE__ */ Z(
|
|
3461
|
+
/* @__PURE__ */ Z(K, { className: "h-4 w-4" }),
|
|
3410
3462
|
g ?? y("detail.activity"),
|
|
3411
3463
|
/* @__PURE__ */ Q("span", {
|
|
3412
3464
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -3419,7 +3471,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3419
3471
|
]
|
|
3420
3472
|
}), /* @__PURE__ */ Z("div", {
|
|
3421
3473
|
className: "flex items-center gap-1",
|
|
3422
|
-
children:
|
|
3474
|
+
children: z && d && /* @__PURE__ */ Z(Vn, {
|
|
3423
3475
|
subscription: d,
|
|
3424
3476
|
onToggle: f
|
|
3425
3477
|
})
|
|
@@ -3428,37 +3480,37 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3428
3480
|
}), /* @__PURE__ */ Q("div", {
|
|
3429
3481
|
className: "space-y-4",
|
|
3430
3482
|
children: [
|
|
3431
|
-
|
|
3483
|
+
F && /* @__PURE__ */ Z("div", {
|
|
3432
3484
|
className: "flex items-center gap-2",
|
|
3433
3485
|
children: /* @__PURE__ */ Q(M, {
|
|
3434
|
-
value:
|
|
3435
|
-
onValueChange: (e) =>
|
|
3486
|
+
value: P,
|
|
3487
|
+
onValueChange: (e) => ae(e),
|
|
3436
3488
|
children: [/* @__PURE__ */ Z(te, {
|
|
3437
3489
|
"aria-label": y("detail.filterActivity"),
|
|
3438
3490
|
className: "h-8 w-auto min-w-[140px] py-1 text-sm",
|
|
3439
3491
|
children: /* @__PURE__ */ Z(ne, {})
|
|
3440
|
-
}), /* @__PURE__ */ Z(N, { children:
|
|
3492
|
+
}), /* @__PURE__ */ Z(N, { children: Xn(y).map((e) => /* @__PURE__ */ Z(ee, {
|
|
3441
3493
|
value: e.value,
|
|
3442
3494
|
children: e.label
|
|
3443
3495
|
}, e.value)) })]
|
|
3444
3496
|
})
|
|
3445
3497
|
}),
|
|
3446
|
-
|
|
3498
|
+
I && /* @__PURE__ */ Z(Un, {
|
|
3447
3499
|
value: C,
|
|
3448
3500
|
onChange: w,
|
|
3449
|
-
onSubmit:
|
|
3501
|
+
onSubmit: U,
|
|
3450
3502
|
mentionSuggestions: m,
|
|
3451
3503
|
placeholder: y("detail.leaveCommentPlaceholder"),
|
|
3452
3504
|
disabled: T,
|
|
3453
3505
|
canSubmitEmpty: A.length > 0,
|
|
3454
|
-
extraSlot: h ? /* @__PURE__ */ Z(
|
|
3506
|
+
extraSlot: h ? /* @__PURE__ */ Z(qn, {
|
|
3455
3507
|
attachments: A,
|
|
3456
|
-
onUpload:
|
|
3457
|
-
onRemove:
|
|
3458
|
-
readOnly: T ||
|
|
3459
|
-
}) : A.length > 0 ? /* @__PURE__ */ Z(
|
|
3508
|
+
onUpload: W,
|
|
3509
|
+
onRemove: oe,
|
|
3510
|
+
readOnly: T || re
|
|
3511
|
+
}) : A.length > 0 ? /* @__PURE__ */ Z(qn, {
|
|
3460
3512
|
attachments: A,
|
|
3461
|
-
onRemove:
|
|
3513
|
+
onRemove: oe,
|
|
3462
3514
|
readOnly: T
|
|
3463
3515
|
}) : void 0
|
|
3464
3516
|
}),
|
|
@@ -3470,11 +3522,11 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3470
3522
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
3471
3523
|
className: "space-y-4",
|
|
3472
3524
|
children: V.map((e) => {
|
|
3473
|
-
let t =
|
|
3525
|
+
let t = Jn[e.type] || rt, n = Yn[e.type] || "bg-gray-100 text-gray-600", r = H.get(e.id) ?? [];
|
|
3474
3526
|
return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
|
|
3475
3527
|
className: "flex gap-3 relative",
|
|
3476
3528
|
children: [/* @__PURE__ */ Z("div", {
|
|
3477
|
-
className:
|
|
3529
|
+
className: G("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", n),
|
|
3478
3530
|
children: e.actorAvatarUrl ? /* @__PURE__ */ Z("img", {
|
|
3479
3531
|
src: e.actorAvatarUrl,
|
|
3480
3532
|
alt: e.actor,
|
|
@@ -3496,7 +3548,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3496
3548
|
}),
|
|
3497
3549
|
/* @__PURE__ */ Z("span", {
|
|
3498
3550
|
className: "text-xs text-muted-foreground",
|
|
3499
|
-
children:
|
|
3551
|
+
children: Zn(e.createdAt, y)
|
|
3500
3552
|
}),
|
|
3501
3553
|
e.edited && /* @__PURE__ */ Z("span", {
|
|
3502
3554
|
className: "text-xs text-muted-foreground italic",
|
|
@@ -3523,25 +3575,25 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3523
3575
|
}),
|
|
3524
3576
|
e.type === "field_change" && e.fieldChanges && /* @__PURE__ */ Z("div", {
|
|
3525
3577
|
className: "space-y-1 mt-1",
|
|
3526
|
-
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(
|
|
3578
|
+
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(In, { change: e }, t))
|
|
3527
3579
|
}),
|
|
3528
|
-
|
|
3580
|
+
L && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
|
|
3529
3581
|
className: "mt-1.5",
|
|
3530
|
-
children: /* @__PURE__ */ Z(
|
|
3582
|
+
children: /* @__PURE__ */ Z(Rn, {
|
|
3531
3583
|
reactions: e.reactions,
|
|
3532
3584
|
onToggleReaction: u ? (t) => u(e.id, t) : void 0
|
|
3533
3585
|
})
|
|
3534
3586
|
}),
|
|
3535
|
-
|
|
3587
|
+
L && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
|
|
3536
3588
|
className: "mt-1.5",
|
|
3537
|
-
children: /* @__PURE__ */ Z(
|
|
3589
|
+
children: /* @__PURE__ */ Z(Rn, {
|
|
3538
3590
|
reactions: [],
|
|
3539
3591
|
onToggleReaction: (t) => u(e.id, t)
|
|
3540
3592
|
})
|
|
3541
3593
|
})
|
|
3542
3594
|
]
|
|
3543
3595
|
})]
|
|
3544
|
-
}),
|
|
3596
|
+
}), R && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(Bn, {
|
|
3545
3597
|
parentItem: e,
|
|
3546
3598
|
replies: r,
|
|
3547
3599
|
onAddReply: l,
|
|
@@ -3558,13 +3610,13 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3558
3610
|
onClick: se,
|
|
3559
3611
|
disabled: D,
|
|
3560
3612
|
"aria-label": y("detail.loadMore"),
|
|
3561
|
-
children: [D ? /* @__PURE__ */ Z(
|
|
3613
|
+
children: [D ? /* @__PURE__ */ Z(Le, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(ve, { className: "h-4 w-4 mr-1" }), y("detail.loadMore")]
|
|
3562
3614
|
})
|
|
3563
3615
|
})
|
|
3564
3616
|
]
|
|
3565
3617
|
})]
|
|
3566
3618
|
});
|
|
3567
|
-
},
|
|
3619
|
+
}, er = (e) => {
|
|
3568
3620
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3569
3621
|
return {
|
|
3570
3622
|
designer: {
|
|
@@ -3574,21 +3626,21 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3574
3626
|
},
|
|
3575
3627
|
rest: i
|
|
3576
3628
|
};
|
|
3577
|
-
},
|
|
3578
|
-
|
|
3579
|
-
let { designer: r } =
|
|
3629
|
+
}, tr = ({ schema: e = {}, className: t, ...n }) => {
|
|
3630
|
+
mt();
|
|
3631
|
+
let { designer: r } = er(n);
|
|
3580
3632
|
return /* @__PURE__ */ Z("div", {
|
|
3581
3633
|
className: t,
|
|
3582
3634
|
...r,
|
|
3583
|
-
children: /* @__PURE__ */ Z(
|
|
3635
|
+
children: /* @__PURE__ */ Z($n, {
|
|
3584
3636
|
items: [],
|
|
3585
3637
|
config: e
|
|
3586
3638
|
})
|
|
3587
3639
|
});
|
|
3588
|
-
},
|
|
3640
|
+
}, nr = ({ config: e, items: t, hasMore: n, onLoadMore: r, loading: a, onAddComment: o, onAddReply: s, onToggleReaction: c, subscription: l, onToggleSubscription: u, filterMode: d, onFilterChange: f, collapseWhenEmpty: p = !1, mentionSuggestions: m, onUploadAttachments: h, className: g }) => {
|
|
3589
3641
|
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);
|
|
3590
3642
|
return _ === "right" || _ === "left" ? C && y ? /* @__PURE__ */ Z("div", {
|
|
3591
|
-
className:
|
|
3643
|
+
className: G("flex items-start pt-4", _ === "right" ? "border-l" : "border-r", g),
|
|
3592
3644
|
children: /* @__PURE__ */ Z(x, {
|
|
3593
3645
|
variant: "ghost",
|
|
3594
3646
|
size: "icon",
|
|
@@ -3598,7 +3650,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3598
3650
|
children: /* @__PURE__ */ Z(He, { className: "h-4 w-4" })
|
|
3599
3651
|
})
|
|
3600
3652
|
}) : /* @__PURE__ */ Q("div", {
|
|
3601
|
-
className:
|
|
3653
|
+
className: G("flex flex-col overflow-hidden", _ === "right" ? "border-l" : "border-r", g),
|
|
3602
3654
|
style: {
|
|
3603
3655
|
width: v,
|
|
3604
3656
|
minWidth: v
|
|
@@ -3607,7 +3659,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3607
3659
|
className: "flex items-center justify-between px-4 py-3 border-b",
|
|
3608
3660
|
children: [/* @__PURE__ */ Q("div", {
|
|
3609
3661
|
className: "flex items-center gap-2",
|
|
3610
|
-
children: [/* @__PURE__ */ Z(
|
|
3662
|
+
children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
3611
3663
|
className: "text-sm font-medium",
|
|
3612
3664
|
children: S("detail.discussion")
|
|
3613
3665
|
})]
|
|
@@ -3621,7 +3673,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3621
3673
|
})]
|
|
3622
3674
|
}), /* @__PURE__ */ Z("div", {
|
|
3623
3675
|
className: "flex-1 overflow-y-auto",
|
|
3624
|
-
children: /* @__PURE__ */ Z(
|
|
3676
|
+
children: /* @__PURE__ */ Z($n, {
|
|
3625
3677
|
items: t,
|
|
3626
3678
|
config: e?.feed,
|
|
3627
3679
|
hasMore: n,
|
|
@@ -3643,18 +3695,18 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3643
3695
|
})
|
|
3644
3696
|
})]
|
|
3645
3697
|
}) : /* @__PURE__ */ Z("div", {
|
|
3646
|
-
className:
|
|
3698
|
+
className: G("", g),
|
|
3647
3699
|
children: y && C ? /* @__PURE__ */ Q(x, {
|
|
3648
3700
|
variant: "ghost",
|
|
3649
3701
|
className: "w-full justify-start gap-2 text-muted-foreground",
|
|
3650
3702
|
onClick: () => w(!1),
|
|
3651
3703
|
"aria-label": S("detail.showDiscussion", { count: t.length }),
|
|
3652
|
-
children: [/* @__PURE__ */ Z(
|
|
3704
|
+
children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: S("detail.showDiscussion", { count: t.length }) })]
|
|
3653
3705
|
}) : /* @__PURE__ */ Q("div", { children: [y && /* @__PURE__ */ Q("div", {
|
|
3654
3706
|
className: "flex items-center justify-between mb-2",
|
|
3655
3707
|
children: [/* @__PURE__ */ Q("div", {
|
|
3656
3708
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
3657
|
-
children: [/* @__PURE__ */ Z(
|
|
3709
|
+
children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), S("detail.discussion")]
|
|
3658
3710
|
}), /* @__PURE__ */ Z(x, {
|
|
3659
3711
|
variant: "ghost",
|
|
3660
3712
|
size: "icon",
|
|
@@ -3663,7 +3715,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3663
3715
|
"aria-label": S("detail.hideDiscussion"),
|
|
3664
3716
|
children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
|
|
3665
3717
|
})]
|
|
3666
|
-
}), /* @__PURE__ */ Z(
|
|
3718
|
+
}), /* @__PURE__ */ Z($n, {
|
|
3667
3719
|
items: t,
|
|
3668
3720
|
config: e?.feed,
|
|
3669
3721
|
hasMore: n,
|
|
@@ -3683,7 +3735,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3683
3735
|
emptyLabel: S("detail.noCommentsYet")
|
|
3684
3736
|
})] })
|
|
3685
3737
|
});
|
|
3686
|
-
},
|
|
3738
|
+
}, rr = (e) => {
|
|
3687
3739
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3688
3740
|
return {
|
|
3689
3741
|
designer: {
|
|
@@ -3693,9 +3745,9 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3693
3745
|
},
|
|
3694
3746
|
rest: i
|
|
3695
3747
|
};
|
|
3696
|
-
},
|
|
3697
|
-
|
|
3698
|
-
let r =
|
|
3748
|
+
}, ir = ({ schema: e = {}, className: t, ...n }) => {
|
|
3749
|
+
mt();
|
|
3750
|
+
let r = ut(), { designer: i } = rr(n), a = {
|
|
3699
3751
|
position: "bottom",
|
|
3700
3752
|
collapsible: !1,
|
|
3701
3753
|
feed: {
|
|
@@ -3708,7 +3760,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3708
3760
|
return /* @__PURE__ */ Z("div", {
|
|
3709
3761
|
className: t,
|
|
3710
3762
|
...i,
|
|
3711
|
-
children: /* @__PURE__ */ Z(
|
|
3763
|
+
children: /* @__PURE__ */ Z(nr, {
|
|
3712
3764
|
items: r?.items || [],
|
|
3713
3765
|
config: a,
|
|
3714
3766
|
onAddComment: r?.onAddComment,
|
|
@@ -3718,7 +3770,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3718
3770
|
onUploadAttachments: r?.onUploadAttachments
|
|
3719
3771
|
})
|
|
3720
3772
|
});
|
|
3721
|
-
},
|
|
3773
|
+
}, ar = (e) => {
|
|
3722
3774
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3723
3775
|
return {
|
|
3724
3776
|
designer: {
|
|
@@ -3728,8 +3780,8 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3728
3780
|
},
|
|
3729
3781
|
rest: i
|
|
3730
3782
|
};
|
|
3731
|
-
},
|
|
3732
|
-
let r =
|
|
3783
|
+
}, or = ({ schema: e = {}, className: t, ...n }) => {
|
|
3784
|
+
let r = mt(), { translateOptions: i } = _t(), { designer: o } = ar(n), s = Array.isArray(e.stages) ? e.stages : [], c = e.statusField, l = a.useMemo(() => {
|
|
3733
3785
|
if (s.length === 0 || !c || !r?.objectName) return s;
|
|
3734
3786
|
let e = i(r.objectName, c, s);
|
|
3735
3787
|
return Array.isArray(e) && e.length === s.length ? s.map((t, n) => ({
|
|
@@ -3759,7 +3811,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3759
3811
|
});
|
|
3760
3812
|
let b = h.length - 1;
|
|
3761
3813
|
return /* @__PURE__ */ Q("div", {
|
|
3762
|
-
className:
|
|
3814
|
+
className: G("w-full", t),
|
|
3763
3815
|
...o,
|
|
3764
3816
|
children: [/* @__PURE__ */ Q("div", {
|
|
3765
3817
|
className: "hidden sm:flex w-full items-stretch gap-2",
|
|
@@ -3772,7 +3824,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3772
3824
|
return /* @__PURE__ */ Z("div", {
|
|
3773
3825
|
role: "listitem",
|
|
3774
3826
|
"aria-current": r ? "step" : void 0,
|
|
3775
|
-
className:
|
|
3827
|
+
className: G("relative flex-1 min-w-0 px-4 py-2 text-xs font-medium text-center rounded-xl", r && "bg-primary text-primary-foreground shadow-sm", n && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200", !r && !n && i && "bg-emerald-500/10 text-emerald-700/85 dark:text-emerald-300/85", !r && !n && !i && "bg-muted text-muted-foreground"),
|
|
3776
3828
|
children: /* @__PURE__ */ Q("span", {
|
|
3777
3829
|
className: "inline-flex items-center justify-center gap-1.5 truncate",
|
|
3778
3830
|
children: [
|
|
@@ -3799,7 +3851,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3799
3851
|
return /* @__PURE__ */ Z("div", {
|
|
3800
3852
|
role: "listitem",
|
|
3801
3853
|
"aria-current": n ? "step" : void 0,
|
|
3802
|
-
className:
|
|
3854
|
+
className: G("shrink-0 px-3 py-2 text-xs font-medium rounded-md border whitespace-nowrap", n && "bg-destructive text-destructive-foreground border-destructive shadow-sm ring-1 ring-destructive/40", !n && "bg-destructive/5 text-destructive/85 border-destructive/20"),
|
|
3803
3855
|
children: /* @__PURE__ */ Q("span", {
|
|
3804
3856
|
className: "inline-flex items-center gap-1",
|
|
3805
3857
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -3820,7 +3872,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3820
3872
|
return /* @__PURE__ */ Z("div", {
|
|
3821
3873
|
role: "listitem",
|
|
3822
3874
|
"aria-current": i ? "step" : void 0,
|
|
3823
|
-
className:
|
|
3875
|
+
className: G("shrink-0 px-3 py-1.5 rounded-full text-xs font-medium border whitespace-nowrap", n && i && "bg-destructive text-destructive-foreground border-destructive shadow-sm", n && !i && "bg-destructive/5 text-destructive/85 border-destructive/20", !n && i && "bg-primary text-primary-foreground border-primary shadow-sm ring-1 ring-primary/40", !n && r && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200 border-emerald-500/30", !n && !i && !r && "bg-background text-foreground/85 border-border/60"),
|
|
3824
3876
|
children: /* @__PURE__ */ Q("span", {
|
|
3825
3877
|
className: "inline-flex items-center gap-1",
|
|
3826
3878
|
children: [
|
|
@@ -3841,7 +3893,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3841
3893
|
})
|
|
3842
3894
|
})]
|
|
3843
3895
|
});
|
|
3844
|
-
},
|
|
3896
|
+
}, sr = (e) => {
|
|
3845
3897
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3846
3898
|
return {
|
|
3847
3899
|
designer: {
|
|
@@ -3851,8 +3903,8 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3851
3903
|
},
|
|
3852
3904
|
rest: i
|
|
3853
3905
|
};
|
|
3854
|
-
},
|
|
3855
|
-
let r =
|
|
3906
|
+
}, cr = ({ schema: e = {}, className: t, ...n }) => {
|
|
3907
|
+
let r = mt(), { designer: i } = sr(n), a = kt(), o = Array.isArray(e.actions) ? e.actions : Array.isArray(e.properties?.actions) ? e.properties.actions : [], s = Array.isArray(e.actionNames) ? e.actionNames : Array.isArray(e.properties?.actionNames) ? e.properties.actionNames : [], c = r?.objectName || "", l = s.length > 0 ? s : Array.isArray(o) && o.every((e) => typeof e == "string") ? o : [], u = l.length > 0 && !!c, { item: d } = ft("object", u ? c : null), f = u ? (() => {
|
|
3856
3908
|
let e = Array.isArray(d?.actions) ? d.actions : [], t = new Map(e.map((e) => [e.name, e]));
|
|
3857
3909
|
return l.map((e) => t.get(e)).filter((e) => !!e);
|
|
3858
3910
|
})() : Array.isArray(o) ? o : [], p = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
@@ -3884,11 +3936,11 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3884
3936
|
});
|
|
3885
3937
|
let v = e.align || "end", y = v === "start" ? "justify-start" : v === "center" ? "justify-center" : "justify-end";
|
|
3886
3938
|
return /* @__PURE__ */ Z("div", {
|
|
3887
|
-
className:
|
|
3939
|
+
className: G("flex flex-wrap items-center gap-2", m === "record_header" && !e.inline && "-mt-12 sm:-mt-14 mb-2 relative z-10", y, t),
|
|
3888
3940
|
role: "toolbar",
|
|
3889
3941
|
"aria-label": e.aria?.label || "Quick actions",
|
|
3890
3942
|
...i,
|
|
3891
|
-
children: _.map((t, n) => /* @__PURE__ */ Z(
|
|
3943
|
+
children: _.map((t, n) => /* @__PURE__ */ Z(lr, {
|
|
3892
3944
|
action: t,
|
|
3893
3945
|
record: r?.data,
|
|
3894
3946
|
variant: t.variant || e.variant || "default",
|
|
@@ -3900,7 +3952,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3900
3952
|
}, t.name || `qa-${n}`))
|
|
3901
3953
|
});
|
|
3902
3954
|
};
|
|
3903
|
-
function
|
|
3955
|
+
function lr({ action: e, record: t, variant: n, size: r, label: i, onRun: o }) {
|
|
3904
3956
|
let [s, c] = a.useState(!1), l = a.useMemo(() => ({ record: t || {} }), [t]), u = ot(e.disabled), d = ct(typeof u == "string" ? u : void 0, l);
|
|
3905
3957
|
return /* @__PURE__ */ Q(x, {
|
|
3906
3958
|
variant: n,
|
|
@@ -3914,12 +3966,12 @@ function ar({ action: e, record: t, variant: n, size: r, label: i, onRun: o }) {
|
|
|
3914
3966
|
c(!1);
|
|
3915
3967
|
}
|
|
3916
3968
|
},
|
|
3917
|
-
children: [s && /* @__PURE__ */ Z(
|
|
3969
|
+
children: [s && /* @__PURE__ */ Z(Le, { className: "mr-2 h-4 w-4 animate-spin" }), i]
|
|
3918
3970
|
});
|
|
3919
3971
|
}
|
|
3920
3972
|
//#endregion
|
|
3921
3973
|
//#region src/renderers/record-history.tsx
|
|
3922
|
-
var
|
|
3974
|
+
var ur = (e) => {
|
|
3923
3975
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3924
3976
|
return {
|
|
3925
3977
|
designer: {
|
|
@@ -3929,14 +3981,14 @@ var or = (e) => {
|
|
|
3929
3981
|
},
|
|
3930
3982
|
rest: i
|
|
3931
3983
|
};
|
|
3932
|
-
},
|
|
3984
|
+
}, dr = /* @__PURE__ */ new Set([
|
|
3933
3985
|
"created",
|
|
3934
3986
|
"updated",
|
|
3935
3987
|
"assigned",
|
|
3936
3988
|
"shared",
|
|
3937
3989
|
"deleted"
|
|
3938
|
-
]),
|
|
3939
|
-
let { designer: r } =
|
|
3990
|
+
]), fr = ({ schema: e = {}, className: t, ...n }) => {
|
|
3991
|
+
let { designer: r } = ur(n), i = mt(), o = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : void 0, s = e.loading ?? e.properties?.loading, c = e.emptyText ?? e.properties?.emptyText, l = Number(e.limit ?? e.properties?.limit ?? 50) || 50, u = i?.objectName, d = i?.data?.id ?? i?.data?._id ?? i?.recordId, f = i?.dataSource, p = o === void 0 && !!f?.find && !!u && d != null, [m, h] = a.useState(null), [g, _] = a.useState(!1);
|
|
3940
3992
|
a.useEffect(() => {
|
|
3941
3993
|
if (!p) return;
|
|
3942
3994
|
let e = !1;
|
|
@@ -3948,7 +4000,7 @@ var or = (e) => {
|
|
|
3948
4000
|
$orderby: { timestamp: "desc" },
|
|
3949
4001
|
$top: Math.max(1, l)
|
|
3950
4002
|
})).then((t) => {
|
|
3951
|
-
e || h((t?.data ?? t?.records ?? []).filter((e) =>
|
|
4003
|
+
e || h((t?.data ?? t?.records ?? []).filter((e) => dr.has(e?.type)).map((e) => {
|
|
3952
4004
|
let t = e.timestamp;
|
|
3953
4005
|
return (!t || t === "NOW()" || Number.isNaN(Date.parse(t))) && (t = e.created_at), {
|
|
3954
4006
|
id: e.id,
|
|
@@ -3977,13 +4029,13 @@ var or = (e) => {
|
|
|
3977
4029
|
return /* @__PURE__ */ Z("div", {
|
|
3978
4030
|
className: t,
|
|
3979
4031
|
...r,
|
|
3980
|
-
children: /* @__PURE__ */ Z(
|
|
4032
|
+
children: /* @__PURE__ */ Z(fn, {
|
|
3981
4033
|
entries: v,
|
|
3982
4034
|
loading: y,
|
|
3983
4035
|
emptyText: c
|
|
3984
4036
|
})
|
|
3985
4037
|
});
|
|
3986
|
-
},
|
|
4038
|
+
}, pr = (e) => {
|
|
3987
4039
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3988
4040
|
return {
|
|
3989
4041
|
designer: {
|
|
@@ -3993,8 +4045,8 @@ var or = (e) => {
|
|
|
3993
4045
|
},
|
|
3994
4046
|
rest: i
|
|
3995
4047
|
};
|
|
3996
|
-
},
|
|
3997
|
-
let r =
|
|
4048
|
+
}, mr = (e) => e.replace(/[_-]+/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()).trim(), hr = (e, t) => t && e?.[t] != null && e[t] !== "" ? String(e[t]) : e?.name || e?.title || e?.subject || e?.label || e?.email || e?.username || e?.code || e?.slug || e?.provider_id || e?.user_agent || e?.ip_address || e?.id || "—", gr = ({ schema: e = {}, className: t, ...n }) => {
|
|
4049
|
+
let r = mt(), i = _t(), { t: o } = $(), { designer: s } = pr(n), c = Nt().appName, l = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : [], u = r?.recordId, d = r?.dataSource, [f, p] = a.useState({}), m = a.useRef(null), [h, g] = a.useState(!1), _ = a.useRef(!0);
|
|
3998
4050
|
a.useEffect(() => (_.current = !0, () => {
|
|
3999
4051
|
_.current = !1;
|
|
4000
4052
|
}), []);
|
|
@@ -4074,11 +4126,11 @@ var or = (e) => {
|
|
|
4074
4126
|
return x && t && !t.loading && !t.error && t.total === 0;
|
|
4075
4127
|
}).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({
|
|
4076
4128
|
name: e.objectName,
|
|
4077
|
-
label:
|
|
4078
|
-
}) :
|
|
4129
|
+
label: mr(e.objectName)
|
|
4130
|
+
}) : mr(e.objectName)));
|
|
4079
4131
|
return /* @__PURE__ */ Q("div", {
|
|
4080
4132
|
ref: m,
|
|
4081
|
-
className:
|
|
4133
|
+
className: G("flex flex-col gap-3", e.className, t),
|
|
4082
4134
|
...s,
|
|
4083
4135
|
children: [k.map((e) => {
|
|
4084
4136
|
let t = e.objectName, n = f[t] || {
|
|
@@ -4094,15 +4146,15 @@ var or = (e) => {
|
|
|
4094
4146
|
className: "text-sm font-semibold tracking-tight truncate",
|
|
4095
4147
|
children: e.title || (i?.objectLabel ? i.objectLabel({
|
|
4096
4148
|
name: e.objectName,
|
|
4097
|
-
label:
|
|
4098
|
-
}) :
|
|
4149
|
+
label: mr(e.objectName)
|
|
4150
|
+
}) : mr(e.objectName))
|
|
4099
4151
|
}), /* @__PURE__ */ Q("div", {
|
|
4100
4152
|
className: "flex items-center gap-2 shrink-0",
|
|
4101
4153
|
children: [!n.loading && /* @__PURE__ */ Z(b, {
|
|
4102
4154
|
variant: "secondary",
|
|
4103
4155
|
className: "tabular-nums",
|
|
4104
4156
|
children: n.total
|
|
4105
|
-
}), c && u && /* @__PURE__ */ Z(
|
|
4157
|
+
}), c && u && /* @__PURE__ */ Z(Mt, {
|
|
4106
4158
|
to: `/apps/${c}/${e.objectName}?filter%5B${e.relationshipField}%5D=${encodeURIComponent(String(u))}`,
|
|
4107
4159
|
className: "text-[11px] font-medium text-muted-foreground hover:text-foreground transition-colors",
|
|
4108
4160
|
title: o("detail.viewAll", { defaultValue: "View all" }),
|
|
@@ -4114,9 +4166,9 @@ var or = (e) => {
|
|
|
4114
4166
|
children: n.loading ? /* @__PURE__ */ Q("div", {
|
|
4115
4167
|
className: "space-y-1.5 p-3",
|
|
4116
4168
|
children: [
|
|
4117
|
-
/* @__PURE__ */ Z(
|
|
4118
|
-
/* @__PURE__ */ Z(
|
|
4119
|
-
/* @__PURE__ */ Z(
|
|
4169
|
+
/* @__PURE__ */ Z(I, { className: "h-3.5 w-4/5" }),
|
|
4170
|
+
/* @__PURE__ */ Z(I, { className: "h-3.5 w-3/5" }),
|
|
4171
|
+
/* @__PURE__ */ Z(I, { className: "h-3.5 w-2/3" })
|
|
4120
4172
|
]
|
|
4121
4173
|
}) : n.items.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
4122
4174
|
className: "px-4 py-3 text-xs text-muted-foreground",
|
|
@@ -4124,10 +4176,10 @@ var or = (e) => {
|
|
|
4124
4176
|
}) : /* @__PURE__ */ Z("ul", {
|
|
4125
4177
|
className: "divide-y",
|
|
4126
4178
|
children: n.items.map((t) => {
|
|
4127
|
-
let n = t.id || t._id, r =
|
|
4179
|
+
let n = t.id || t._id, r = hr(t, e.displayField), i = n ? `../${e.objectName}/record/${encodeURIComponent(String(n))}` : void 0;
|
|
4128
4180
|
return /* @__PURE__ */ Z("li", {
|
|
4129
4181
|
className: "px-4 py-2",
|
|
4130
|
-
children: i ? /* @__PURE__ */ Q(
|
|
4182
|
+
children: i ? /* @__PURE__ */ Q(Mt, {
|
|
4131
4183
|
to: i,
|
|
4132
4184
|
className: "group flex items-center justify-between gap-2 text-xs hover:text-foreground text-muted-foreground transition-colors",
|
|
4133
4185
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -4161,7 +4213,7 @@ var or = (e) => {
|
|
|
4161
4213
|
})]
|
|
4162
4214
|
})]
|
|
4163
4215
|
});
|
|
4164
|
-
},
|
|
4216
|
+
}, _r = {
|
|
4165
4217
|
info: {
|
|
4166
4218
|
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",
|
|
4167
4219
|
icon: "Info"
|
|
@@ -4179,20 +4231,20 @@ var or = (e) => {
|
|
|
4179
4231
|
icon: "CheckCircle2"
|
|
4180
4232
|
}
|
|
4181
4233
|
};
|
|
4182
|
-
function
|
|
4234
|
+
function vr(e) {
|
|
4183
4235
|
let t = e?.properties ?? {};
|
|
4184
4236
|
return {
|
|
4185
4237
|
...e,
|
|
4186
4238
|
...t
|
|
4187
4239
|
};
|
|
4188
4240
|
}
|
|
4189
|
-
var
|
|
4190
|
-
let n =
|
|
4241
|
+
var yr = ({ schema: e = {}, className: t }) => {
|
|
4242
|
+
let n = vr(e), r = mt(), a = r?.data, c = r?.objectName || "", l = r?.recordId ?? a?.id, u = [
|
|
4191
4243
|
"info",
|
|
4192
4244
|
"warning",
|
|
4193
4245
|
"error",
|
|
4194
4246
|
"success"
|
|
4195
|
-
].includes(n.severity) ? n.severity : "info", d =
|
|
4247
|
+
].includes(n.severity) ? n.severity : "info", d = _r[u], f = n.icon || d.icon, p = ot(n.visible), m = ct(p, { record: a }), h = i.useMemo(() => {
|
|
4196
4248
|
if (!n.dismissible) return null;
|
|
4197
4249
|
let e = n.dismissKey || n.title || u;
|
|
4198
4250
|
return `os.record-alert:${c}:${l ?? "_"}:${e}`;
|
|
@@ -4210,7 +4262,7 @@ var hr = ({ schema: e = {}, className: t }) => {
|
|
|
4210
4262
|
} catch {
|
|
4211
4263
|
return !1;
|
|
4212
4264
|
}
|
|
4213
|
-
}), y = n.action?.actionName, { item: b } =
|
|
4265
|
+
}), y = n.action?.actionName, { item: b } = ft("object", y && c ? c : null), S = i.useMemo(() => {
|
|
4214
4266
|
if (!(!y || !b?.actions)) return b.actions.find((e) => e.name === y);
|
|
4215
4267
|
}, [y, b]), { executeAction: C } = st({
|
|
4216
4268
|
actions: i.useMemo(() => S ? [S] : [], [S]),
|
|
@@ -4221,7 +4273,7 @@ var hr = ({ schema: e = {}, className: t }) => {
|
|
|
4221
4273
|
}
|
|
4222
4274
|
});
|
|
4223
4275
|
return _ || !a || Object.keys(a).length === 0 || p !== void 0 && !m ? null : /* @__PURE__ */ Q(o, {
|
|
4224
|
-
className:
|
|
4276
|
+
className: G("relative pr-12", d.wrap, t),
|
|
4225
4277
|
role: u === "error" ? "alert" : "status",
|
|
4226
4278
|
"aria-live": u === "error" ? "assertive" : "polite",
|
|
4227
4279
|
children: [
|
|
@@ -4259,7 +4311,7 @@ var hr = ({ schema: e = {}, className: t }) => {
|
|
|
4259
4311
|
}) : null
|
|
4260
4312
|
]
|
|
4261
4313
|
});
|
|
4262
|
-
},
|
|
4314
|
+
}, br = /* @__PURE__ */ new Set([
|
|
4263
4315
|
"id",
|
|
4264
4316
|
"_id",
|
|
4265
4317
|
"__v",
|
|
@@ -4274,15 +4326,15 @@ var hr = ({ schema: e = {}, className: t }) => {
|
|
|
4274
4326
|
"owner_id",
|
|
4275
4327
|
"deleted_at",
|
|
4276
4328
|
"is_deleted"
|
|
4277
|
-
]),
|
|
4278
|
-
function
|
|
4329
|
+
]), xr = 480, Sr = 95;
|
|
4330
|
+
function Cr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId: o, dataSource: s, objectSchema: c, width: l = "min(960px, 60vw)", columns: u = 2, systemFields: d = br, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
|
|
4279
4331
|
let { t: g } = $(), _ = `objectui.drawerWidth.${i}`, [v, y] = a.useState(() => {
|
|
4280
4332
|
if (typeof window > "u" || !m) return null;
|
|
4281
4333
|
try {
|
|
4282
4334
|
let e = window.localStorage.getItem(_);
|
|
4283
4335
|
if (e) {
|
|
4284
4336
|
let t = parseInt(e, 10);
|
|
4285
|
-
if (Number.isFinite(t) && t >=
|
|
4337
|
+
if (Number.isFinite(t) && t >= xr) return t;
|
|
4286
4338
|
}
|
|
4287
4339
|
} catch {}
|
|
4288
4340
|
return null;
|
|
@@ -4304,7 +4356,7 @@ function yr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4304
4356
|
let n = (e) => {
|
|
4305
4357
|
let t = S.current;
|
|
4306
4358
|
if (!t) return;
|
|
4307
|
-
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth *
|
|
4359
|
+
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * Sr / 100 : 1600, i = Math.min(r, Math.max(xr, t.startWidth + n));
|
|
4308
4360
|
y(Math.round(i));
|
|
4309
4361
|
}, r = () => {
|
|
4310
4362
|
S.current, S.current = null, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r);
|
|
@@ -4327,6 +4379,7 @@ function yr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4327
4379
|
options: t.options,
|
|
4328
4380
|
currency: t.currency,
|
|
4329
4381
|
precision: t.precision,
|
|
4382
|
+
scale: t.scale,
|
|
4330
4383
|
format: t.format,
|
|
4331
4384
|
reference_to: t.reference_to ?? t.referenceTo ?? t.target,
|
|
4332
4385
|
reference_field: t.reference_field ?? t.referenceField,
|
|
@@ -4336,12 +4389,12 @@ function yr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4336
4389
|
description: t.description
|
|
4337
4390
|
};
|
|
4338
4391
|
});
|
|
4339
|
-
return /* @__PURE__ */ Z(
|
|
4392
|
+
return /* @__PURE__ */ Z(re, {
|
|
4340
4393
|
open: e,
|
|
4341
4394
|
onOpenChange: (e) => {
|
|
4342
4395
|
e || t();
|
|
4343
4396
|
},
|
|
4344
|
-
children: /* @__PURE__ */ Q(
|
|
4397
|
+
children: /* @__PURE__ */ Q(ie, {
|
|
4345
4398
|
side: "right",
|
|
4346
4399
|
className: "w-full overflow-y-auto p-0 sm:!max-w-none",
|
|
4347
4400
|
style: x,
|
|
@@ -4354,13 +4407,13 @@ function yr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4354
4407
|
onPointerDown: C,
|
|
4355
4408
|
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"
|
|
4356
4409
|
}),
|
|
4357
|
-
/* @__PURE__ */ Z(
|
|
4410
|
+
/* @__PURE__ */ Z(P, {
|
|
4358
4411
|
className: "sr-only",
|
|
4359
|
-
children: /* @__PURE__ */ Z(
|
|
4412
|
+
children: /* @__PURE__ */ Z(F, { children: n })
|
|
4360
4413
|
}),
|
|
4361
4414
|
/* @__PURE__ */ Z("div", {
|
|
4362
4415
|
className: "px-6 pt-6 pb-6",
|
|
4363
|
-
children: /* @__PURE__ */ Z(
|
|
4416
|
+
children: /* @__PURE__ */ Z(Sn, {
|
|
4364
4417
|
dataSource: s,
|
|
4365
4418
|
inlineEdit: !0,
|
|
4366
4419
|
schema: {
|
|
@@ -4403,14 +4456,14 @@ function yr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4403
4456
|
})
|
|
4404
4457
|
});
|
|
4405
4458
|
}
|
|
4406
|
-
function
|
|
4459
|
+
function wr(e, t) {
|
|
4407
4460
|
if (typeof window > "u") return null;
|
|
4408
4461
|
let n = window.location.pathname, r = `/${e}`, i = n.indexOf(r);
|
|
4409
4462
|
return `${i >= 0 ? n.slice(0, i) : n.replace(/\/$/, "")}/${e}/record/${encodeURIComponent(String(t))}`;
|
|
4410
4463
|
}
|
|
4411
4464
|
//#endregion
|
|
4412
4465
|
//#region src/InlineCreateRelated.tsx
|
|
4413
|
-
var
|
|
4466
|
+
var Tr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
|
|
4414
4467
|
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(() => {
|
|
4415
4468
|
if (!h.trim()) return _;
|
|
4416
4469
|
let e = h.toLowerCase();
|
|
@@ -4456,7 +4509,7 @@ var xr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4456
4509
|
}
|
|
4457
4510
|
}, [a]), ee = i.useMemo(() => n.filter((e) => e.required).every((e) => p[e.name]?.toString().trim()), [n, p]);
|
|
4458
4511
|
return l ? /* @__PURE__ */ Q(S, {
|
|
4459
|
-
className:
|
|
4512
|
+
className: G("", c),
|
|
4460
4513
|
children: [/* @__PURE__ */ Z(w, {
|
|
4461
4514
|
className: "pb-3",
|
|
4462
4515
|
children: /* @__PURE__ */ Q(T, {
|
|
@@ -4473,11 +4526,11 @@ var xr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4473
4526
|
children: /* @__PURE__ */ Z(nt, { className: "h-3.5 w-3.5" })
|
|
4474
4527
|
})]
|
|
4475
4528
|
})
|
|
4476
|
-
}), /* @__PURE__ */ Z(C, { children: /* @__PURE__ */ Q(
|
|
4529
|
+
}), /* @__PURE__ */ Z(C, { children: /* @__PURE__ */ Q(L, {
|
|
4477
4530
|
value: d,
|
|
4478
4531
|
onValueChange: f,
|
|
4479
4532
|
children: [
|
|
4480
|
-
/* @__PURE__ */ Q(
|
|
4533
|
+
/* @__PURE__ */ Q(z, {
|
|
4481
4534
|
className: "mb-3 w-full",
|
|
4482
4535
|
children: [r && /* @__PURE__ */ Q(B, {
|
|
4483
4536
|
value: "create",
|
|
@@ -4486,10 +4539,10 @@ var xr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4486
4539
|
}), a && /* @__PURE__ */ Q(B, {
|
|
4487
4540
|
value: "link",
|
|
4488
4541
|
className: "flex-1 gap-1.5",
|
|
4489
|
-
children: [/* @__PURE__ */ Z(
|
|
4542
|
+
children: [/* @__PURE__ */ Z(Fe, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
4490
4543
|
})]
|
|
4491
4544
|
}),
|
|
4492
|
-
r && /* @__PURE__ */ Q(
|
|
4545
|
+
r && /* @__PURE__ */ Q(R, {
|
|
4493
4546
|
value: "create",
|
|
4494
4547
|
className: "space-y-3 mt-0",
|
|
4495
4548
|
children: [n.map((e) => /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("label", {
|
|
@@ -4516,11 +4569,11 @@ var xr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4516
4569
|
onClick: M,
|
|
4517
4570
|
disabled: !ee || y,
|
|
4518
4571
|
className: "gap-1.5",
|
|
4519
|
-
children: [y && /* @__PURE__ */ Z(
|
|
4572
|
+
children: [y && /* @__PURE__ */ Z(Le, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
|
|
4520
4573
|
})]
|
|
4521
4574
|
})]
|
|
4522
4575
|
}),
|
|
4523
|
-
a && /* @__PURE__ */ Q(
|
|
4576
|
+
a && /* @__PURE__ */ Q(R, {
|
|
4524
4577
|
value: "link",
|
|
4525
4578
|
className: "space-y-3 mt-0",
|
|
4526
4579
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -4535,7 +4588,7 @@ var xr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4535
4588
|
className: "max-h-48 overflow-y-auto space-y-1",
|
|
4536
4589
|
children: E ? /* @__PURE__ */ Q("div", {
|
|
4537
4590
|
className: "flex items-center justify-center py-4 text-sm text-muted-foreground",
|
|
4538
|
-
children: [/* @__PURE__ */ Z(
|
|
4591
|
+
children: [/* @__PURE__ */ Z(Le, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
|
|
4539
4592
|
}) : O.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
4540
4593
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
4541
4594
|
children: h ? "No records found" : "Type to search records"
|
|
@@ -4557,7 +4610,7 @@ var xr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4557
4610
|
]
|
|
4558
4611
|
}) })]
|
|
4559
4612
|
}) : /* @__PURE__ */ Q("div", {
|
|
4560
|
-
className:
|
|
4613
|
+
className: G("flex gap-2", c),
|
|
4561
4614
|
children: [r && /* @__PURE__ */ Q(x, {
|
|
4562
4615
|
variant: "outline",
|
|
4563
4616
|
size: "sm",
|
|
@@ -4577,13 +4630,13 @@ var xr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4577
4630
|
f("link"), u(!0);
|
|
4578
4631
|
},
|
|
4579
4632
|
className: "gap-1.5",
|
|
4580
|
-
children: [/* @__PURE__ */ Z(
|
|
4633
|
+
children: [/* @__PURE__ */ Z(Fe, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
4581
4634
|
})]
|
|
4582
4635
|
});
|
|
4583
4636
|
};
|
|
4584
4637
|
//#endregion
|
|
4585
4638
|
//#region src/DiffView.tsx
|
|
4586
|
-
function
|
|
4639
|
+
function Er(e, t) {
|
|
4587
4640
|
if (e == null) return ["(empty)"];
|
|
4588
4641
|
switch (t) {
|
|
4589
4642
|
case "json": try {
|
|
@@ -4602,7 +4655,7 @@ function Sr(e, t) {
|
|
|
4602
4655
|
default: return String(e).split("\n");
|
|
4603
4656
|
}
|
|
4604
4657
|
}
|
|
4605
|
-
function
|
|
4658
|
+
function Dr(e, t) {
|
|
4606
4659
|
let n = [], r = Math.max(e.length, t.length);
|
|
4607
4660
|
for (let i = 0; i < r; i++) {
|
|
4608
4661
|
let r = i < e.length ? e[i] : void 0, a = i < t.length ? t[i] : void 0;
|
|
@@ -4619,16 +4672,16 @@ function Cr(e, t) {
|
|
|
4619
4672
|
}
|
|
4620
4673
|
return n;
|
|
4621
4674
|
}
|
|
4622
|
-
var
|
|
4675
|
+
var Or = {
|
|
4623
4676
|
added: "bg-green-50 text-green-800 dark:bg-green-950/30 dark:text-green-300",
|
|
4624
4677
|
removed: "bg-red-50 text-red-800 dark:bg-red-950/30 dark:text-red-300",
|
|
4625
4678
|
unchanged: "text-muted-foreground"
|
|
4626
|
-
},
|
|
4679
|
+
}, kr = {
|
|
4627
4680
|
added: "+",
|
|
4628
4681
|
removed: "-",
|
|
4629
4682
|
unchanged: " "
|
|
4630
|
-
},
|
|
4631
|
-
let { t: s } = $(), [c, l] = i.useState(a), u = i.useMemo(() =>
|
|
4683
|
+
}, Ar = ({ oldValue: e, newValue: t, fieldName: n, fieldType: r = "string", mode: a = "unified", className: o }) => {
|
|
4684
|
+
let { t: s } = $(), [c, l] = i.useState(a), u = i.useMemo(() => Er(e, r), [e, r]), d = i.useMemo(() => Er(t, r), [t, r]), f = i.useMemo(() => Dr(u, d), [u, d]), p = f.some((e) => e.type !== "unchanged"), m = i.useMemo(() => {
|
|
4632
4685
|
if (c !== "side-by-side") return [];
|
|
4633
4686
|
let e = [], t = 0;
|
|
4634
4687
|
for (; t < f.length;) {
|
|
@@ -4654,7 +4707,7 @@ var wr = {
|
|
|
4654
4707
|
return e;
|
|
4655
4708
|
}, [c, f]);
|
|
4656
4709
|
return /* @__PURE__ */ Q(S, {
|
|
4657
|
-
className:
|
|
4710
|
+
className: G("overflow-hidden", o),
|
|
4658
4711
|
children: [/* @__PURE__ */ Z(w, {
|
|
4659
4712
|
className: "pb-2",
|
|
4660
4713
|
children: /* @__PURE__ */ Q(T, {
|
|
@@ -4686,10 +4739,10 @@ var wr = {
|
|
|
4686
4739
|
children: p ? c === "unified" ? /* @__PURE__ */ Z("div", {
|
|
4687
4740
|
className: "font-mono text-xs overflow-x-auto",
|
|
4688
4741
|
children: f.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
4689
|
-
className:
|
|
4742
|
+
className: G("px-4 py-0.5 whitespace-pre-wrap border-l-2", Or[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
|
|
4690
4743
|
children: [/* @__PURE__ */ Z("span", {
|
|
4691
4744
|
className: "select-none mr-2 inline-block w-3 text-center opacity-60",
|
|
4692
|
-
children:
|
|
4745
|
+
children: kr[e.type]
|
|
4693
4746
|
}), e.value]
|
|
4694
4747
|
}, t))
|
|
4695
4748
|
}) : /* @__PURE__ */ Z("div", {
|
|
@@ -4706,10 +4759,10 @@ var wr = {
|
|
|
4706
4759
|
children: s("detail.currentVersion")
|
|
4707
4760
|
}),
|
|
4708
4761
|
m.map((e, t) => /* @__PURE__ */ Q(i.Fragment, { children: [/* @__PURE__ */ Z("div", {
|
|
4709
|
-
className:
|
|
4762
|
+
className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? Or[e.left.type] : "bg-muted/20"),
|
|
4710
4763
|
children: e.left?.value ?? ""
|
|
4711
4764
|
}), /* @__PURE__ */ Z("div", {
|
|
4712
|
-
className:
|
|
4765
|
+
className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? Or[e.right.type] : "bg-muted/20"),
|
|
4713
4766
|
children: e.right?.value ?? ""
|
|
4714
4767
|
})] }, t))
|
|
4715
4768
|
]
|
|
@@ -4720,7 +4773,7 @@ var wr = {
|
|
|
4720
4773
|
})
|
|
4721
4774
|
})]
|
|
4722
4775
|
});
|
|
4723
|
-
},
|
|
4776
|
+
}, jr = ({ currentIndex: e, totalRecords: t, recordIds: n, onNavigate: r, onSearch: a, className: o }) => {
|
|
4724
4777
|
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(() => {
|
|
4725
4778
|
p && r(n[0]);
|
|
4726
4779
|
}, [
|
|
@@ -4788,7 +4841,7 @@ var wr = {
|
|
|
4788
4841
|
r,
|
|
4789
4842
|
a
|
|
4790
4843
|
]), /* @__PURE__ */ Q("div", {
|
|
4791
|
-
className:
|
|
4844
|
+
className: G("flex items-center gap-1.5", o),
|
|
4792
4845
|
children: [
|
|
4793
4846
|
/* @__PURE__ */ Z(x, {
|
|
4794
4847
|
variant: "outline",
|
|
@@ -4833,7 +4886,7 @@ var wr = {
|
|
|
4833
4886
|
title: s("detail.lastRecord"),
|
|
4834
4887
|
children: /* @__PURE__ */ Z(Se, { className: "h-4 w-4" })
|
|
4835
4888
|
}),
|
|
4836
|
-
a && /* @__PURE__ */ Q(
|
|
4889
|
+
a && /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z(x, {
|
|
4837
4890
|
variant: u ? "secondary" : "ghost",
|
|
4838
4891
|
size: "icon",
|
|
4839
4892
|
className: "h-8 w-8",
|
|
@@ -4853,18 +4906,18 @@ var wr = {
|
|
|
4853
4906
|
})] })
|
|
4854
4907
|
]
|
|
4855
4908
|
});
|
|
4856
|
-
},
|
|
4909
|
+
}, Mr = 28, Nr = [
|
|
4857
4910
|
"fill-primary stroke-primary",
|
|
4858
4911
|
"fill-blue-500 stroke-blue-500",
|
|
4859
4912
|
"fill-emerald-500 stroke-emerald-500",
|
|
4860
4913
|
"fill-amber-500 stroke-amber-500"
|
|
4861
|
-
],
|
|
4914
|
+
], Pr = [
|
|
4862
4915
|
"fill-primary-foreground",
|
|
4863
4916
|
"fill-white",
|
|
4864
4917
|
"fill-white",
|
|
4865
4918
|
"fill-white"
|
|
4866
4919
|
];
|
|
4867
|
-
function
|
|
4920
|
+
function Fr(e, t, n, r, i) {
|
|
4868
4921
|
let a = [], o = [], s = /* @__PURE__ */ new Set(), c = r / 2, l = i / 2;
|
|
4869
4922
|
a.push({
|
|
4870
4923
|
id: e.id,
|
|
@@ -4928,10 +4981,10 @@ function jr(e, t, n, r, i) {
|
|
|
4928
4981
|
edges: o
|
|
4929
4982
|
};
|
|
4930
4983
|
}
|
|
4931
|
-
function
|
|
4984
|
+
function Ir(e, t = 6) {
|
|
4932
4985
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
4933
4986
|
}
|
|
4934
|
-
var
|
|
4987
|
+
var Lr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, className: a }) => {
|
|
4935
4988
|
let o = i.useRef(null), [s, c] = i.useState({
|
|
4936
4989
|
width: 500,
|
|
4937
4990
|
height: 400
|
|
@@ -4952,14 +5005,14 @@ var Nr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
4952
5005
|
});
|
|
4953
5006
|
return n.observe(t), () => n.disconnect();
|
|
4954
5007
|
}, []);
|
|
4955
|
-
let { nodes: d, edges: f } = i.useMemo(() =>
|
|
5008
|
+
let { nodes: d, edges: f } = i.useMemo(() => Fr(e, t, n, s.width, s.height), [
|
|
4956
5009
|
e,
|
|
4957
5010
|
t,
|
|
4958
5011
|
n,
|
|
4959
5012
|
s
|
|
4960
5013
|
]);
|
|
4961
5014
|
return /* @__PURE__ */ Q(S, {
|
|
4962
|
-
className:
|
|
5015
|
+
className: G("overflow-hidden", a),
|
|
4963
5016
|
children: [/* @__PURE__ */ Z(w, {
|
|
4964
5017
|
className: "pb-2",
|
|
4965
5018
|
children: /* @__PURE__ */ Q(T, {
|
|
@@ -4994,9 +5047,9 @@ var Nr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
4994
5047
|
strokeWidth: 1.5,
|
|
4995
5048
|
strokeOpacity: .5
|
|
4996
5049
|
}, `edge-${t}`)), d.map((e) => {
|
|
4997
|
-
let t = l === e.id, n =
|
|
5050
|
+
let t = l === e.id, n = Nr[Math.min(e.level, Nr.length - 1)], i = Pr[Math.min(e.level, Pr.length - 1)], a = e.level === 0 ? 34 : Mr;
|
|
4998
5051
|
return /* @__PURE__ */ Q("g", {
|
|
4999
|
-
className:
|
|
5052
|
+
className: G("cursor-pointer transition-transform", r && "hover:opacity-80"),
|
|
5000
5053
|
onClick: () => r?.(e.id),
|
|
5001
5054
|
onMouseEnter: () => u(e.id),
|
|
5002
5055
|
onMouseLeave: () => u(null),
|
|
@@ -5015,8 +5068,8 @@ var Nr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5015
5068
|
y: e.y,
|
|
5016
5069
|
textAnchor: "middle",
|
|
5017
5070
|
dominantBaseline: "central",
|
|
5018
|
-
className:
|
|
5019
|
-
children:
|
|
5071
|
+
className: G("text-[10px] font-medium pointer-events-none", i),
|
|
5072
|
+
children: Ir(e.label)
|
|
5020
5073
|
}),
|
|
5021
5074
|
e.type && /* @__PURE__ */ Z("text", {
|
|
5022
5075
|
x: e.x,
|
|
@@ -5025,7 +5078,7 @@ var Nr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5025
5078
|
className: "fill-muted-foreground text-[9px] pointer-events-none",
|
|
5026
5079
|
children: e.type
|
|
5027
5080
|
}),
|
|
5028
|
-
t && /* @__PURE__ */ Q(
|
|
5081
|
+
t && /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Z("rect", {
|
|
5029
5082
|
x: e.x - 50,
|
|
5030
5083
|
y: e.y - a - 28,
|
|
5031
5084
|
width: 100,
|
|
@@ -5050,7 +5103,7 @@ var Nr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5050
5103
|
};
|
|
5051
5104
|
//#endregion
|
|
5052
5105
|
//#region src/PointInTimeRestore.tsx
|
|
5053
|
-
function
|
|
5106
|
+
function Rr(e) {
|
|
5054
5107
|
try {
|
|
5055
5108
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
5056
5109
|
if (r < 1) return "just now";
|
|
@@ -5061,7 +5114,7 @@ function Pr(e) {
|
|
|
5061
5114
|
return e;
|
|
5062
5115
|
}
|
|
5063
5116
|
}
|
|
5064
|
-
var
|
|
5117
|
+
var zr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
5065
5118
|
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 () => {
|
|
5066
5119
|
if (!(!d || !n)) {
|
|
5067
5120
|
if (!s) {
|
|
@@ -5084,13 +5137,13 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5084
5137
|
c(!1);
|
|
5085
5138
|
}, []);
|
|
5086
5139
|
return /* @__PURE__ */ Q(S, {
|
|
5087
|
-
className:
|
|
5140
|
+
className: G("", r),
|
|
5088
5141
|
children: [/* @__PURE__ */ Z(w, {
|
|
5089
5142
|
className: "pb-3",
|
|
5090
5143
|
children: /* @__PURE__ */ Q(T, {
|
|
5091
5144
|
className: "flex items-center gap-2 text-base",
|
|
5092
5145
|
children: [
|
|
5093
|
-
/* @__PURE__ */ Z(
|
|
5146
|
+
/* @__PURE__ */ Z(Y, { className: "h-4 w-4" }),
|
|
5094
5147
|
"Revision History",
|
|
5095
5148
|
/* @__PURE__ */ Q("span", {
|
|
5096
5149
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -5117,12 +5170,12 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5117
5170
|
let t = e.id === a;
|
|
5118
5171
|
return /* @__PURE__ */ Q("button", {
|
|
5119
5172
|
type: "button",
|
|
5120
|
-
className:
|
|
5173
|
+
className: G("w-full text-left flex items-start gap-3 py-2 px-2 rounded-md transition-colors relative", t ? "bg-accent" : "hover:bg-accent/50"),
|
|
5121
5174
|
onClick: () => {
|
|
5122
5175
|
o(e.id), c(!1);
|
|
5123
5176
|
},
|
|
5124
5177
|
children: [/* @__PURE__ */ Z("div", {
|
|
5125
|
-
className:
|
|
5178
|
+
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"),
|
|
5126
5179
|
children: t && /* @__PURE__ */ Z(be, { className: "h-3 w-3 text-primary-foreground" })
|
|
5127
5180
|
}), /* @__PURE__ */ Q("div", {
|
|
5128
5181
|
className: "flex-1 min-w-0",
|
|
@@ -5133,7 +5186,7 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5133
5186
|
children: e.user
|
|
5134
5187
|
}), /* @__PURE__ */ Z("span", {
|
|
5135
5188
|
className: "text-xs text-muted-foreground",
|
|
5136
|
-
children:
|
|
5189
|
+
children: Rr(e.timestamp)
|
|
5137
5190
|
})]
|
|
5138
5191
|
}), /* @__PURE__ */ Q("p", {
|
|
5139
5192
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
@@ -5155,7 +5208,7 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5155
5208
|
children: [
|
|
5156
5209
|
/* @__PURE__ */ Q("div", {
|
|
5157
5210
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
5158
|
-
children: [/* @__PURE__ */ Z(
|
|
5211
|
+
children: [/* @__PURE__ */ Z(Oe, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
|
|
5159
5212
|
}),
|
|
5160
5213
|
/* @__PURE__ */ Z("div", {
|
|
5161
5214
|
className: "space-y-2",
|
|
@@ -5201,12 +5254,12 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5201
5254
|
}),
|
|
5202
5255
|
n && /* @__PURE__ */ Z("div", {
|
|
5203
5256
|
className: "pt-1 space-y-2",
|
|
5204
|
-
children: s ? /* @__PURE__ */ Q(
|
|
5257
|
+
children: s ? /* @__PURE__ */ Q(Dt, { children: [/* @__PURE__ */ Q("p", {
|
|
5205
5258
|
className: "text-xs text-amber-600 dark:text-amber-400",
|
|
5206
5259
|
children: [
|
|
5207
5260
|
"This will restore the record to its state at",
|
|
5208
5261
|
" ",
|
|
5209
|
-
|
|
5262
|
+
Rr(d.timestamp),
|
|
5210
5263
|
". Continue?"
|
|
5211
5264
|
]
|
|
5212
5265
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -5237,7 +5290,7 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5237
5290
|
})]
|
|
5238
5291
|
}) })]
|
|
5239
5292
|
});
|
|
5240
|
-
},
|
|
5293
|
+
}, Br = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: n = !1, className: r }) => {
|
|
5241
5294
|
let [a, o] = i.useState(""), [s, c] = i.useState(!1), l = i.useCallback(async () => {
|
|
5242
5295
|
let t = a.trim();
|
|
5243
5296
|
if (t) {
|
|
@@ -5252,7 +5305,7 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5252
5305
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), l());
|
|
5253
5306
|
}, [l]);
|
|
5254
5307
|
return /* @__PURE__ */ Q("div", {
|
|
5255
|
-
className:
|
|
5308
|
+
className: G("flex gap-2", r),
|
|
5256
5309
|
children: [/* @__PURE__ */ Z("textarea", {
|
|
5257
5310
|
className: "flex-1 min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-none",
|
|
5258
5311
|
placeholder: t,
|
|
@@ -5270,21 +5323,21 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5270
5323
|
children: /* @__PURE__ */ Z(Ze, { className: "h-4 w-4" })
|
|
5271
5324
|
})]
|
|
5272
5325
|
});
|
|
5273
|
-
},
|
|
5326
|
+
}, Vr = ({ query: e, suggestions: t, onSelect: n, visible: r = !0, activeIndex: a = 0, className: o }) => {
|
|
5274
5327
|
let s = i.useMemo(() => {
|
|
5275
5328
|
if (!e) return t;
|
|
5276
5329
|
let n = e.toLowerCase();
|
|
5277
5330
|
return t.filter((e) => e.name.toLowerCase().includes(n) || e.id.toLowerCase().includes(n));
|
|
5278
5331
|
}, [e, t]);
|
|
5279
5332
|
return !r || s.length === 0 ? null : /* @__PURE__ */ Z("div", {
|
|
5280
|
-
className:
|
|
5333
|
+
className: G("bg-popover border rounded-md shadow-md z-50 max-h-48 overflow-y-auto w-56", o),
|
|
5281
5334
|
role: "listbox",
|
|
5282
5335
|
"aria-label": "Mention suggestions",
|
|
5283
5336
|
children: s.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
5284
5337
|
type: "button",
|
|
5285
5338
|
role: "option",
|
|
5286
5339
|
"aria-selected": t === a,
|
|
5287
|
-
className:
|
|
5340
|
+
className: G("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === a && "bg-accent"),
|
|
5288
5341
|
onMouseDown: (t) => {
|
|
5289
5342
|
t.preventDefault(), n(e);
|
|
5290
5343
|
},
|
|
@@ -5312,7 +5365,7 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5312
5365
|
}, e.id))
|
|
5313
5366
|
});
|
|
5314
5367
|
};
|
|
5315
|
-
function
|
|
5368
|
+
function Hr(e, t, n) {
|
|
5316
5369
|
return {
|
|
5317
5370
|
type: e.type,
|
|
5318
5371
|
id: e.id,
|
|
@@ -5323,7 +5376,7 @@ function Rr(e, t, n) {
|
|
|
5323
5376
|
}
|
|
5324
5377
|
//#endregion
|
|
5325
5378
|
//#region src/extractMentions.ts
|
|
5326
|
-
function
|
|
5379
|
+
function Ur(e, t) {
|
|
5327
5380
|
if (!e || !t.length) return [];
|
|
5328
5381
|
let n = [...t].sort((e, t) => t.label.length - e.label.length), r = e, i = /* @__PURE__ */ new Set();
|
|
5329
5382
|
for (let e of n) {
|
|
@@ -5335,26 +5388,28 @@ function zr(e, t) {
|
|
|
5335
5388
|
}
|
|
5336
5389
|
//#endregion
|
|
5337
5390
|
//#region src/synth/buildDefaultPageSchema.ts
|
|
5338
|
-
function
|
|
5391
|
+
function Wr(e) {
|
|
5339
5392
|
return e == null ? [] : Array.isArray(e) ? e.filter((e) => e != null) : [e];
|
|
5340
5393
|
}
|
|
5341
|
-
function
|
|
5394
|
+
function Gr(e) {
|
|
5342
5395
|
if (!e) return null;
|
|
5343
|
-
|
|
5344
|
-
|
|
5396
|
+
let t = e.stageField;
|
|
5397
|
+
if (t === !1) return null;
|
|
5398
|
+
if (typeof t == "string" && t) return t;
|
|
5399
|
+
let n = e.fields || {};
|
|
5345
5400
|
for (let e of [
|
|
5346
5401
|
"status",
|
|
5347
5402
|
"stage",
|
|
5348
5403
|
"state",
|
|
5349
5404
|
"phase"
|
|
5350
|
-
]) if (e in
|
|
5351
|
-
for (let [e,
|
|
5352
|
-
let
|
|
5353
|
-
if (
|
|
5405
|
+
]) if (e in n) return e;
|
|
5406
|
+
for (let [e, t] of Object.entries(n)) {
|
|
5407
|
+
let n = (t?.type || "").toLowerCase();
|
|
5408
|
+
if (n === "status" || n === "stage") return e;
|
|
5354
5409
|
}
|
|
5355
5410
|
return null;
|
|
5356
5411
|
}
|
|
5357
|
-
function
|
|
5412
|
+
function Kr(e, t) {
|
|
5358
5413
|
if (!e || !t) return null;
|
|
5359
5414
|
let n = e.fields?.[t]?.options;
|
|
5360
5415
|
return !Array.isArray(n) || n.length === 0 ? null : n.map((e) => ({
|
|
@@ -5362,10 +5417,11 @@ function Hr(e, t) {
|
|
|
5362
5417
|
label: e.label
|
|
5363
5418
|
}));
|
|
5364
5419
|
}
|
|
5365
|
-
function
|
|
5420
|
+
function qr(e, t, n = 4) {
|
|
5366
5421
|
if (!e) return [];
|
|
5367
|
-
|
|
5368
|
-
|
|
5422
|
+
let r = Array.isArray(e.highlightFields) && e.highlightFields.length > 0 ? e.highlightFields : null;
|
|
5423
|
+
if (r) return r.filter((e) => typeof e == "string" && e.length > 0).slice(0, n);
|
|
5424
|
+
let i = /* @__PURE__ */ new Set([
|
|
5369
5425
|
"id",
|
|
5370
5426
|
"_id",
|
|
5371
5427
|
"created_at",
|
|
@@ -5379,15 +5435,15 @@ function Ur(e, t, n = 4) {
|
|
|
5379
5435
|
"tenant_id",
|
|
5380
5436
|
"org_id"
|
|
5381
5437
|
]);
|
|
5382
|
-
t &&
|
|
5438
|
+
t && i.add(t), e.primaryField && i.add(e.primaryField), e.nameField && i.add(e.nameField), e.displayNameField && i.add(e.displayNameField);
|
|
5383
5439
|
for (let t of [
|
|
5384
5440
|
"name",
|
|
5385
5441
|
"full_name",
|
|
5386
5442
|
"title",
|
|
5387
5443
|
"subject",
|
|
5388
5444
|
"display_name"
|
|
5389
|
-
]) t in (e.fields || {}) &&
|
|
5390
|
-
let
|
|
5445
|
+
]) t in (e.fields || {}) && i.add(t);
|
|
5446
|
+
let a = [
|
|
5391
5447
|
"owner",
|
|
5392
5448
|
"owner_id",
|
|
5393
5449
|
"amount",
|
|
@@ -5405,7 +5461,7 @@ function Ur(e, t, n = 4) {
|
|
|
5405
5461
|
"account_id",
|
|
5406
5462
|
"contact",
|
|
5407
5463
|
"contact_id"
|
|
5408
|
-
],
|
|
5464
|
+
], o = /* @__PURE__ */ new Set([
|
|
5409
5465
|
"currency",
|
|
5410
5466
|
"number",
|
|
5411
5467
|
"integer",
|
|
@@ -5427,31 +5483,31 @@ function Ur(e, t, n = 4) {
|
|
|
5427
5483
|
"url",
|
|
5428
5484
|
"text",
|
|
5429
5485
|
"string"
|
|
5430
|
-
]),
|
|
5431
|
-
for (let e of
|
|
5432
|
-
for (let e of Object.keys(
|
|
5433
|
-
if (
|
|
5434
|
-
let t =
|
|
5435
|
-
if (!(t && !
|
|
5486
|
+
]), s = [], c = e.fields || {};
|
|
5487
|
+
for (let e of a) if (e in c && !i.has(e) && s.push(e), s.length >= n) return s;
|
|
5488
|
+
for (let e of Object.keys(c)) {
|
|
5489
|
+
if (s.includes(e) || i.has(e)) continue;
|
|
5490
|
+
let t = c[e]?.type;
|
|
5491
|
+
if (!(t && !o.has(t)) && (s.push(e), s.length >= n)) break;
|
|
5436
5492
|
}
|
|
5437
|
-
return
|
|
5493
|
+
return s;
|
|
5438
5494
|
}
|
|
5439
|
-
function
|
|
5495
|
+
function Jr(e, t = {}) {
|
|
5440
5496
|
return {
|
|
5441
5497
|
type: "page:header",
|
|
5442
5498
|
recordChrome: t.recordChrome !== !1,
|
|
5443
5499
|
...Array.isArray(t.actions) && t.actions.length > 0 ? { actions: t.actions } : {}
|
|
5444
5500
|
};
|
|
5445
5501
|
}
|
|
5446
|
-
function
|
|
5502
|
+
function Yr(e, t) {
|
|
5447
5503
|
return !Array.isArray(t) || t.length === 0 ? null : {
|
|
5448
5504
|
type: "record:quick_actions",
|
|
5449
5505
|
actions: t,
|
|
5450
5506
|
location: "record_header"
|
|
5451
5507
|
};
|
|
5452
5508
|
}
|
|
5453
|
-
function
|
|
5454
|
-
let n = t.statusField ??
|
|
5509
|
+
function Xr(e, t = {}) {
|
|
5510
|
+
let n = t.statusField ?? Gr(e), r = t.stages ?? (n ? Kr(e, n) : null), i = t.highlightFields ?? qr(e, n), a = [];
|
|
5455
5511
|
return !t.hideHighlights && i.length > 0 && a.push({
|
|
5456
5512
|
type: "record:highlights",
|
|
5457
5513
|
fields: i
|
|
@@ -5461,17 +5517,47 @@ function Kr(e, t = {}) {
|
|
|
5461
5517
|
stages: r
|
|
5462
5518
|
}), a;
|
|
5463
5519
|
}
|
|
5464
|
-
function
|
|
5520
|
+
function Zr(e) {
|
|
5521
|
+
if (!e) return null;
|
|
5522
|
+
let t = Pt(e);
|
|
5523
|
+
if (!t) return null;
|
|
5524
|
+
let n = e.fields || {}, r = (e) => {
|
|
5525
|
+
let t = n[e] || {};
|
|
5526
|
+
return {
|
|
5527
|
+
name: e,
|
|
5528
|
+
label: t.label || e,
|
|
5529
|
+
type: t.type || "text",
|
|
5530
|
+
...t.options ? { options: t.options } : {},
|
|
5531
|
+
...t.reference_to || t.reference ? { reference_to: t.reference_to || t.reference } : {},
|
|
5532
|
+
...t.reference_field ? { reference_field: t.reference_field } : {},
|
|
5533
|
+
...t.currency ? { currency: t.currency } : {}
|
|
5534
|
+
};
|
|
5535
|
+
};
|
|
5536
|
+
return t.map((e) => ({
|
|
5537
|
+
...e.key === void 0 ? {} : {
|
|
5538
|
+
name: e.key,
|
|
5539
|
+
title: e.label ?? e.key
|
|
5540
|
+
},
|
|
5541
|
+
...e.collapse === "none" ? {} : { collapsible: !0 },
|
|
5542
|
+
...e.collapse === "collapsed" ? { defaultCollapsed: !0 } : {},
|
|
5543
|
+
fields: e.fields.map(r)
|
|
5544
|
+
}));
|
|
5545
|
+
}
|
|
5546
|
+
function Qr(e, t) {
|
|
5547
|
+
return Array.isArray(t) && t.length > 0 ? t : Zr(e) ?? void 0;
|
|
5548
|
+
}
|
|
5549
|
+
function $r(e, t, n) {
|
|
5465
5550
|
return {
|
|
5466
5551
|
type: "record:details",
|
|
5467
|
-
sections: t,
|
|
5552
|
+
sections: Qr(e, t),
|
|
5468
5553
|
...n && n.length > 0 ? { hideFields: n } : {}
|
|
5469
5554
|
};
|
|
5470
5555
|
}
|
|
5471
|
-
function
|
|
5472
|
-
let n = t.statusField ??
|
|
5556
|
+
function ei(e, t = {}) {
|
|
5557
|
+
let n = t.statusField ?? Gr(e), r = t.highlightFields ?? qr(e, n), i = [{
|
|
5473
5558
|
label: "Details",
|
|
5474
|
-
|
|
5559
|
+
value: "details",
|
|
5560
|
+
children: [$r(e, t.sections, r)]
|
|
5475
5561
|
}];
|
|
5476
5562
|
if (!t.hideRelatedTab && Array.isArray(t.related) && t.related.length > 0) {
|
|
5477
5563
|
let e = (e) => ({
|
|
@@ -5482,22 +5568,35 @@ function Jr(e, t = {}) {
|
|
|
5482
5568
|
...e.columns ? { columns: e.columns } : {},
|
|
5483
5569
|
...e.limit ? { limit: e.limit } : {},
|
|
5484
5570
|
...e.icon ? { icon: e.icon } : {}
|
|
5571
|
+
}), n = (t) => ({
|
|
5572
|
+
label: t.title || t.objectName,
|
|
5573
|
+
value: `related:${t.objectName}`,
|
|
5574
|
+
...t.icon ? { icon: t.icon } : {},
|
|
5575
|
+
children: [e(t)]
|
|
5485
5576
|
});
|
|
5486
|
-
if (t.relatedLayout === "tabs") for (let
|
|
5487
|
-
|
|
5488
|
-
...n.icon ? { icon: n.icon } : {},
|
|
5489
|
-
children: [e(n)]
|
|
5490
|
-
});
|
|
5491
|
-
else i.push({
|
|
5577
|
+
if (t.relatedLayout === "tabs") for (let e of t.related) i.push(n(e));
|
|
5578
|
+
else if (t.relatedLayout === "stack") i.push({
|
|
5492
5579
|
label: "Related",
|
|
5580
|
+
value: "related",
|
|
5493
5581
|
children: t.related.map(e)
|
|
5494
5582
|
});
|
|
5583
|
+
else {
|
|
5584
|
+
let r = t.related.filter((e) => e.isPrimary), a = t.related.filter((e) => !e.isPrimary);
|
|
5585
|
+
for (let e of r) i.push(n(e));
|
|
5586
|
+
a.length > 0 && i.push({
|
|
5587
|
+
label: "Related",
|
|
5588
|
+
value: "related",
|
|
5589
|
+
children: a.map(e)
|
|
5590
|
+
});
|
|
5591
|
+
}
|
|
5495
5592
|
}
|
|
5496
5593
|
return t.showActivity && i.push({
|
|
5497
5594
|
label: "Activity",
|
|
5595
|
+
value: "activity",
|
|
5498
5596
|
children: [{ type: "record:activity" }]
|
|
5499
5597
|
}), t.history && i.push({
|
|
5500
5598
|
label: "History",
|
|
5599
|
+
value: "history",
|
|
5501
5600
|
children: [{
|
|
5502
5601
|
type: "record:history",
|
|
5503
5602
|
entries: t.history.entries,
|
|
@@ -5509,15 +5608,15 @@ function Jr(e, t = {}) {
|
|
|
5509
5608
|
items: i
|
|
5510
5609
|
};
|
|
5511
5610
|
}
|
|
5512
|
-
function
|
|
5611
|
+
function ti() {
|
|
5513
5612
|
return { type: "record:discussion" };
|
|
5514
5613
|
}
|
|
5515
|
-
function
|
|
5614
|
+
function ni(e, t = {}) {
|
|
5516
5615
|
let n = t.slots || {}, r = [];
|
|
5517
|
-
"header" in n && n.header !== void 0 ? r.push(...
|
|
5616
|
+
"header" in n && n.header !== void 0 ? r.push(...Wr(n.header)) : r.push(Jr(e, {
|
|
5518
5617
|
recordChrome: t.recordChrome,
|
|
5519
5618
|
actions: t.headerActions
|
|
5520
|
-
})), "actions" in n && n.actions !== void 0 && r.push(...
|
|
5619
|
+
})), "actions" in n && n.actions !== void 0 && r.push(...Wr(n.actions)), "alerts" in n && n.alerts !== void 0 && r.push(...Wr(n.alerts)), "highlights" in n && n.highlights !== void 0 ? r.push(...Wr(n.highlights)) : r.push(...Xr(e, {
|
|
5521
5620
|
highlightFields: t.highlightFields,
|
|
5522
5621
|
statusField: t.statusField,
|
|
5523
5622
|
stages: t.stages,
|
|
@@ -5525,9 +5624,9 @@ function Xr(e, t = {}) {
|
|
|
5525
5624
|
hidePath: t.hidePath
|
|
5526
5625
|
}));
|
|
5527
5626
|
let i = t.showReferenceRail === !0 && !t.hideReferenceRail && Array.isArray(t.related) && t.related.length >= 2, a = t.hideRelatedTab ?? i;
|
|
5528
|
-
if ("tabs" in n && n.tabs !== void 0) r.push(...
|
|
5627
|
+
if ("tabs" in n && n.tabs !== void 0) r.push(...Wr(n.tabs));
|
|
5529
5628
|
else if ("details" in n && n.details !== void 0) {
|
|
5530
|
-
let i =
|
|
5629
|
+
let i = Wr(n.details), o = ei(e, {
|
|
5531
5630
|
sections: t.sections,
|
|
5532
5631
|
related: t.related,
|
|
5533
5632
|
showActivity: t.showActivity,
|
|
@@ -5541,7 +5640,7 @@ function Xr(e, t = {}) {
|
|
|
5541
5640
|
...o.items[0],
|
|
5542
5641
|
children: i
|
|
5543
5642
|
}), r.push(o);
|
|
5544
|
-
} else r.push(
|
|
5643
|
+
} else r.push(ei(e, {
|
|
5545
5644
|
sections: t.sections,
|
|
5546
5645
|
related: t.related,
|
|
5547
5646
|
showActivity: t.showActivity,
|
|
@@ -5551,12 +5650,12 @@ function Xr(e, t = {}) {
|
|
|
5551
5650
|
hideRelatedTab: a,
|
|
5552
5651
|
relatedLayout: t.relatedLayout
|
|
5553
5652
|
}));
|
|
5554
|
-
"discussion" in n && n.discussion !== void 0 ? r.push(...
|
|
5653
|
+
"discussion" in n && n.discussion !== void 0 ? r.push(...Wr(n.discussion)) : t.hideDiscussion || r.push(ti());
|
|
5555
5654
|
let o = [{
|
|
5556
5655
|
name: "main",
|
|
5557
5656
|
width: "full",
|
|
5558
5657
|
components: r
|
|
5559
|
-
}], s =
|
|
5658
|
+
}], s = Wr(n.rightRail);
|
|
5560
5659
|
if (i || s.length > 0) {
|
|
5561
5660
|
let e = [];
|
|
5562
5661
|
i && e.push({
|
|
@@ -5584,7 +5683,7 @@ function Xr(e, t = {}) {
|
|
|
5584
5683
|
regions: o
|
|
5585
5684
|
};
|
|
5586
5685
|
}
|
|
5587
|
-
e.register("detail-view",
|
|
5686
|
+
e.register("detail-view", Sn, {
|
|
5588
5687
|
namespace: "plugin-detail",
|
|
5589
5688
|
label: "Detail View",
|
|
5590
5689
|
category: "Views",
|
|
@@ -5714,7 +5813,7 @@ e.register("detail-view", yn, {
|
|
|
5714
5813
|
tabs: [],
|
|
5715
5814
|
related: []
|
|
5716
5815
|
}
|
|
5717
|
-
}), e.register("detail-section",
|
|
5816
|
+
}), e.register("detail-section", Gt, {
|
|
5718
5817
|
namespace: "plugin-detail",
|
|
5719
5818
|
label: "Detail Section",
|
|
5720
5819
|
category: "Detail Components",
|
|
@@ -5765,7 +5864,7 @@ e.register("detail-view", yn, {
|
|
|
5765
5864
|
label: "Header Color"
|
|
5766
5865
|
}
|
|
5767
5866
|
]
|
|
5768
|
-
}), e.register("related-list",
|
|
5867
|
+
}), e.register("related-list", Jt, {
|
|
5769
5868
|
namespace: "plugin-detail",
|
|
5770
5869
|
label: "Related List",
|
|
5771
5870
|
category: "Detail Components",
|
|
@@ -5812,7 +5911,7 @@ e.register("detail-view", yn, {
|
|
|
5812
5911
|
label: "Columns"
|
|
5813
5912
|
}
|
|
5814
5913
|
]
|
|
5815
|
-
}), e.register("detail",
|
|
5914
|
+
}), e.register("detail", Sn, {
|
|
5816
5915
|
namespace: "view",
|
|
5817
5916
|
category: "view",
|
|
5818
5917
|
label: "Detail",
|
|
@@ -5835,7 +5934,7 @@ e.register("detail-view", yn, {
|
|
|
5835
5934
|
label: "Fields"
|
|
5836
5935
|
}
|
|
5837
5936
|
]
|
|
5838
|
-
}), e.register("record:details",
|
|
5937
|
+
}), e.register("record:details", kn, {
|
|
5839
5938
|
namespace: "record",
|
|
5840
5939
|
category: "record",
|
|
5841
5940
|
label: "Record Details",
|
|
@@ -5860,7 +5959,7 @@ e.register("detail-view", yn, {
|
|
|
5860
5959
|
label: "Layout",
|
|
5861
5960
|
enum: ["auto", "custom"],
|
|
5862
5961
|
defaultValue: "auto",
|
|
5863
|
-
description: "auto uses the object
|
|
5962
|
+
description: "auto uses the object highlightFields; custom uses explicit sections"
|
|
5864
5963
|
},
|
|
5865
5964
|
{
|
|
5866
5965
|
name: "sections",
|
|
@@ -5872,10 +5971,10 @@ e.register("detail-view", yn, {
|
|
|
5872
5971
|
name: "fields",
|
|
5873
5972
|
type: "array",
|
|
5874
5973
|
label: "Fields",
|
|
5875
|
-
description: "Explicit field list (overrides
|
|
5974
|
+
description: "Explicit field list (overrides highlightFields)"
|
|
5876
5975
|
}
|
|
5877
5976
|
]
|
|
5878
|
-
}), e.register("record:related_list",
|
|
5977
|
+
}), e.register("record:related_list", Nn, {
|
|
5879
5978
|
namespace: "record",
|
|
5880
5979
|
category: "record",
|
|
5881
5980
|
label: "Related List",
|
|
@@ -5938,7 +6037,7 @@ e.register("detail-view", yn, {
|
|
|
5938
6037
|
description: "Action IDs available for related records"
|
|
5939
6038
|
}
|
|
5940
6039
|
]
|
|
5941
|
-
}), e.register("record:highlights",
|
|
6040
|
+
}), e.register("record:highlights", Fn, {
|
|
5942
6041
|
namespace: "record",
|
|
5943
6042
|
category: "record",
|
|
5944
6043
|
label: "Highlights Panel",
|
|
@@ -5957,22 +6056,22 @@ e.register("detail-view", yn, {
|
|
|
5957
6056
|
defaultValue: "horizontal",
|
|
5958
6057
|
description: "Layout orientation for highlight fields"
|
|
5959
6058
|
}]
|
|
5960
|
-
}), e.register("record:activity",
|
|
6059
|
+
}), e.register("record:activity", tr, {
|
|
5961
6060
|
namespace: "record",
|
|
5962
6061
|
category: "record",
|
|
5963
6062
|
label: "Activity Timeline",
|
|
5964
6063
|
icon: "Activity"
|
|
5965
|
-
}), e.register("record:chatter",
|
|
6064
|
+
}), e.register("record:chatter", ir, {
|
|
5966
6065
|
namespace: "record",
|
|
5967
6066
|
category: "record",
|
|
5968
6067
|
label: "Chatter Feed",
|
|
5969
6068
|
icon: "MessageSquare"
|
|
5970
|
-
}), e.register("record:discussion",
|
|
6069
|
+
}), e.register("record:discussion", ir, {
|
|
5971
6070
|
namespace: "record",
|
|
5972
6071
|
category: "record",
|
|
5973
6072
|
label: "Discussion",
|
|
5974
6073
|
icon: "MessageSquare"
|
|
5975
|
-
}), e.register("record:path",
|
|
6074
|
+
}), e.register("record:path", or, {
|
|
5976
6075
|
namespace: "record",
|
|
5977
6076
|
category: "record",
|
|
5978
6077
|
label: "Path / Stepper",
|
|
@@ -5989,26 +6088,26 @@ e.register("detail-view", yn, {
|
|
|
5989
6088
|
label: "Stages",
|
|
5990
6089
|
description: "Explicit stage definitions [{ value, label }] (else derived from field metadata)"
|
|
5991
6090
|
}]
|
|
5992
|
-
}), e.register("record:quick_actions",
|
|
6091
|
+
}), e.register("record:quick_actions", cr, {
|
|
5993
6092
|
namespace: "record",
|
|
5994
6093
|
category: "record",
|
|
5995
6094
|
label: "Quick Actions",
|
|
5996
6095
|
icon: "Zap"
|
|
5997
|
-
}), e.register("record:history",
|
|
6096
|
+
}), e.register("record:history", fr, {
|
|
5998
6097
|
namespace: "record",
|
|
5999
6098
|
category: "record",
|
|
6000
6099
|
label: "History Timeline",
|
|
6001
6100
|
icon: "Clock"
|
|
6002
|
-
}), e.register("record:reference_rail",
|
|
6101
|
+
}), e.register("record:reference_rail", gr, {
|
|
6003
6102
|
namespace: "record",
|
|
6004
6103
|
category: "record",
|
|
6005
6104
|
label: "Reference Rail",
|
|
6006
6105
|
icon: "PanelRight"
|
|
6007
|
-
}), e.register("record:alert",
|
|
6106
|
+
}), e.register("record:alert", yr, {
|
|
6008
6107
|
namespace: "record",
|
|
6009
6108
|
category: "record",
|
|
6010
6109
|
label: "Alert Banner",
|
|
6011
6110
|
icon: "AlertTriangle"
|
|
6012
6111
|
});
|
|
6013
6112
|
//#endregion
|
|
6014
|
-
export {
|
|
6113
|
+
export { an as ActivityTimeline, qn as CommentAttachment, Br as CommentInput, Tn as ConcurrentUpdateDialog, Vt as DETAIL_DEFAULT_TRANSLATIONS, Gt as DetailSection, Kt as DetailTabs, Sn as DetailView, Ar as DiffView, In as FieldChangeItem, Xt as HeaderHighlight, fn as HistoryTimeline, Tr as InlineCreateRelated, Vr as MentionAutocomplete, zr as PointInTimeRestore, Rn as ReactionPicker, tr as RecordActivityRenderer, $n as RecordActivityTimeline, yr as RecordAlertRenderer, nr as RecordChatterPanel, ir as RecordChatterRenderer, Qt as RecordComments, Cr as RecordDetailDrawer, kn as RecordDetailsRenderer, Fn as RecordHighlightsRenderer, fr as RecordHistoryRenderer, yn as RecordMetaFooter, jr as RecordNavigationEnhanced, or as RecordPathRenderer, cr as RecordQuickActionsRenderer, gr as RecordReferenceRailRenderer, Nn as RecordRelatedListRenderer, Jt as RelatedList, Lr as RelationshipGraph, Un as RichTextCommentInput, Yt as SectionGroup, Vn as SubscriptionToggle, Bn as ThreadedReplies, Rt as applyAutoSpan, zt as applyDetailAutoLayout, Yr as buildDefaultActions, $r as buildDefaultDetails, ti as buildDefaultDiscussion, Jr as buildDefaultHeader, Xr as buildDefaultHighlights, ni as buildDefaultPageSchema, ei as buildDefaultTabs, Hr as createMentionFromSuggestion, Bt as createSafeTranslationHook, Zr as deriveFieldGroupDetailSections, qr as deriveHighlightFields, wr as deriveRecordPageHref, Kr as deriveStages, Gr as detectStatusField, Ur as extractMentions, Lt as inferDetailColumns, En as isConcurrentUpdateError, It as isWideFieldType, Qr as resolveDetailSections, $ as useDetailTranslation };
|