@object-ui/plugin-detail 11.3.0 → 11.4.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 +58 -0
- package/dist/DetailSection.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 +903 -819
- package/dist/index.umd.cjs +3 -3
- 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, useDiscussionContext as lt, useHighlightFieldNames as ut, useMetadataItem as dt, useObjectTranslation as ft, useRecordContext as pt, useRegisterHighlightFields as mt,
|
|
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 se, AlertTriangle as ce, ArrowLeft as le, ArrowRight as ue, ArrowRightLeft as de, ArrowUpDown as K, 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, useDiscussionContext as lt, useHighlightFieldNames as ut, useMetadataItem as dt, useObjectTranslation as ft, useRecordContext as pt, useRegisterHighlightFields as mt, useRelatedRecordActions as ht, useSafeFieldLabel as gt } from "@object-ui/react";
|
|
7
|
+
import { BooleanField as _t, LookupField as vt, RecordPickerDialog as yt, SelectField as bt, UserField as xt, coerceToSafeValue as St, getCellRenderer as Ct, humanizeLabel as wt, resolveCellRendererType as Tt } from "@object-ui/fields";
|
|
8
|
+
import { Fragment as Et, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
9
|
+
import { useFieldPermissions as Dt, usePermissions as Ot } from "@object-ui/permissions";
|
|
10
|
+
import { resolveFieldCurrency as kt, useLocalization as At } from "@object-ui/i18n";
|
|
11
|
+
import { Link as jt, useParams as Mt } from "react-router-dom";
|
|
12
|
+
import { deriveFieldGroupLayout as Nt } from "@objectstack/spec/data";
|
|
12
13
|
//#region src/autoLayout.ts
|
|
13
|
-
var
|
|
14
|
+
var Pt = /* @__PURE__ */ new Set([
|
|
14
15
|
"textarea",
|
|
15
16
|
"markdown",
|
|
16
17
|
"html",
|
|
@@ -22,33 +23,33 @@ var Mt = /* @__PURE__ */ new Set([
|
|
|
22
23
|
"field:grid",
|
|
23
24
|
"field:rich-text"
|
|
24
25
|
]);
|
|
25
|
-
function
|
|
26
|
-
return
|
|
26
|
+
function Ft(e) {
|
|
27
|
+
return Pt.has(e);
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function It(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 Lt(e, t) {
|
|
34
|
+
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && Ft(e.type) ? {
|
|
34
35
|
...e,
|
|
35
36
|
span: t
|
|
36
37
|
} : e);
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function Rt(e, t, n) {
|
|
39
40
|
if (t !== void 0) return {
|
|
40
|
-
fields:
|
|
41
|
+
fields: Lt(e, t),
|
|
41
42
|
columns: t
|
|
42
43
|
};
|
|
43
|
-
let r =
|
|
44
|
+
let r = It(e.length, n);
|
|
44
45
|
return {
|
|
45
|
-
fields:
|
|
46
|
+
fields: Lt(e, r),
|
|
46
47
|
columns: r
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
50
|
//#endregion
|
|
50
51
|
//#region src/useDetailTranslation.ts
|
|
51
|
-
function
|
|
52
|
+
function zt(e, t) {
|
|
52
53
|
return function() {
|
|
53
54
|
try {
|
|
54
55
|
let n = ft();
|
|
@@ -66,7 +67,7 @@ function Lt(e, t) {
|
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
|
-
var
|
|
70
|
+
var Bt = {
|
|
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
|
+
}, $ = zt(Bt, "detail.back");
|
|
196
197
|
//#endregion
|
|
197
198
|
//#region src/DetailSection.tsx
|
|
198
|
-
function
|
|
199
|
+
function Vt(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 Ht = /* @__PURE__ */ new Set([
|
|
202
203
|
"formula",
|
|
203
204
|
"summary",
|
|
204
205
|
"rollup",
|
|
205
206
|
"auto_number"
|
|
206
207
|
]);
|
|
207
|
-
function
|
|
208
|
+
function Ut(e) {
|
|
208
209
|
if (e == null) return e;
|
|
209
|
-
if (Array.isArray(e)) return e.map(
|
|
210
|
+
if (Array.isArray(e)) return e.map(Ut);
|
|
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 Wt = ({ 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 } = gt(), 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 } = Rt(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,9 +234,9 @@ 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 = Vt(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
241
|
t && !u.reference_to && (u.reference_to = t), l.reference_field && !u.reference_field && (u.reference_field = l.reference_field);
|
|
241
242
|
}
|
|
@@ -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 = Tt(u) || e.type;
|
|
251
252
|
if (t) {
|
|
252
|
-
let e =
|
|
253
|
+
let e = Ct(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(bt, {
|
|
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(_t, {
|
|
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 && !Ht.has(t);
|
|
296
|
+
if (r || i) return /* @__PURE__ */ Z(r ? xt : vt, {
|
|
296
297
|
field: u,
|
|
297
|
-
value:
|
|
298
|
+
value: Ut(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" ? St(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(Et, { 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
|
+
}, Gt = ({ 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 Kt(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 qt = ({ 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, se] = i.useState(null), [ce, le] = i.useState("asc"), [ue, de] = 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 } = gt();
|
|
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 (!ue) return z;
|
|
586
|
+
let e = ue.toLowerCase();
|
|
587
|
+
return z.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
588
|
+
}, [z, ue]), 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 ce === "asc" ? i : -i;
|
|
595
|
+
}) : Ae, [
|
|
596
|
+
Ae,
|
|
597
|
+
W,
|
|
598
|
+
ce
|
|
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
|
+
ue,
|
|
604
|
+
W,
|
|
605
|
+
ce
|
|
598
606
|
]);
|
|
599
|
-
let
|
|
600
|
-
|
|
601
|
-
}, [
|
|
602
|
-
|
|
603
|
-
}, []),
|
|
604
|
-
if (
|
|
605
|
-
await D?.(
|
|
607
|
+
let Pe = i.useCallback((e) => {
|
|
608
|
+
W === e ? le((e) => e === "asc" ? "desc" : "asc") : (se(e), le("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 = Ot(), 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 = Ct(Tt({
|
|
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 = Kt(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: ue,
|
|
877
|
+
onChange: (e) => de(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(K, { className: "h-3 w-3" }),
|
|
875
894
|
n,
|
|
876
|
-
r && (
|
|
895
|
+
r && (ce === "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(yt, {
|
|
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
|
+
}, Jt = ({ 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(Wt, {
|
|
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
|
+
}, Yt = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
|
|
1040
|
+
let { fieldLabel: a } = gt();
|
|
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-x-8 gap-y-3"),
|
|
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,10 +1056,11 @@ 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 = Ct(Tt(c) || s || "text"), u = s === "number" || s === "integer" || s === "currency" || s === "percent" || s === "decimal", d = s === "email" || s === "url" || s === "textarea", f = s === "boolean";
|
|
1042
1062
|
return /* @__PURE__ */ Q("div", {
|
|
1043
|
-
className:
|
|
1063
|
+
className: G("flex flex-col gap-1 min-w-[8rem] basis-[10rem]", d ? "max-w-[24rem] basis-[16rem]" : "max-w-[16rem]"),
|
|
1044
1064
|
children: [/* @__PURE__ */ Z("span", {
|
|
1045
1065
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
1046
1066
|
children: a(r || "", e.name, e.label)
|
|
@@ -1057,7 +1077,7 @@ 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
|
-
className:
|
|
1080
|
+
className: G("block min-w-0 truncate", u ? "text-xl md:text-2xl font-semibold leading-tight tabular-nums tracking-tight" : "text-sm font-semibold"),
|
|
1061
1081
|
children: /* @__PURE__ */ Z(l, {
|
|
1062
1082
|
value: n,
|
|
1063
1083
|
field: c
|
|
@@ -1070,7 +1090,7 @@ var Gt = ({ title: e, type: t, api: n, data: r, schema: a, columns: o, className
|
|
|
1070
1090
|
};
|
|
1071
1091
|
//#endregion
|
|
1072
1092
|
//#region src/RecordComments.tsx
|
|
1073
|
-
function
|
|
1093
|
+
function Xt(e) {
|
|
1074
1094
|
try {
|
|
1075
1095
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1076
1096
|
if (r < 1) return "just now";
|
|
@@ -1083,7 +1103,7 @@ function Jt(e) {
|
|
|
1083
1103
|
return e;
|
|
1084
1104
|
}
|
|
1085
1105
|
}
|
|
1086
|
-
var
|
|
1106
|
+
var Zt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, className: a }) => {
|
|
1087
1107
|
let { t: o } = $(), [s, c] = i.useState(""), [l, u] = i.useState(!1), [d, f] = i.useState(""), p = i.useCallback(async () => {
|
|
1088
1108
|
let e = s.trim();
|
|
1089
1109
|
if (!(!e || !t)) {
|
|
@@ -1101,11 +1121,11 @@ var Yt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1101
1121
|
return e.text.toLowerCase().includes(t) || e.author.toLowerCase().includes(t);
|
|
1102
1122
|
}) : e].sort((e, t) => e.pinned && !t.pinned ? -1 : !e.pinned && t.pinned ? 1 : 0), [e, d]);
|
|
1103
1123
|
return /* @__PURE__ */ Q(S, {
|
|
1104
|
-
className:
|
|
1124
|
+
className: G("", a),
|
|
1105
1125
|
children: [/* @__PURE__ */ Z(w, { children: /* @__PURE__ */ Q(T, {
|
|
1106
1126
|
className: "flex items-center gap-2 text-base",
|
|
1107
1127
|
children: [
|
|
1108
|
-
/* @__PURE__ */ Z(
|
|
1128
|
+
/* @__PURE__ */ Z(X, { className: "h-4 w-4" }),
|
|
1109
1129
|
o("detail.comments"),
|
|
1110
1130
|
/* @__PURE__ */ Q("span", {
|
|
1111
1131
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1166,7 +1186,7 @@ var Yt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1166
1186
|
}) : /* @__PURE__ */ Z("div", {
|
|
1167
1187
|
className: "space-y-3",
|
|
1168
1188
|
children: h.map((e) => /* @__PURE__ */ Q("div", {
|
|
1169
|
-
className:
|
|
1189
|
+
className: G("flex gap-3", e.pinned && "bg-muted/40 rounded-md p-2 -mx-2"),
|
|
1170
1190
|
children: [/* @__PURE__ */ Z("div", {
|
|
1171
1191
|
className: "shrink-0",
|
|
1172
1192
|
children: e.avatarUrl ? /* @__PURE__ */ Z("img", {
|
|
@@ -1189,7 +1209,7 @@ var Yt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1189
1209
|
}),
|
|
1190
1210
|
/* @__PURE__ */ Z("span", {
|
|
1191
1211
|
className: "text-xs text-muted-foreground",
|
|
1192
|
-
children:
|
|
1212
|
+
children: Xt(e.createdAt)
|
|
1193
1213
|
}),
|
|
1194
1214
|
e.pinned && /* @__PURE__ */ Q("span", {
|
|
1195
1215
|
className: "text-xs text-amber-600 flex items-center gap-0.5",
|
|
@@ -1215,20 +1235,20 @@ var Yt = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1215
1235
|
]
|
|
1216
1236
|
})]
|
|
1217
1237
|
});
|
|
1218
|
-
},
|
|
1219
|
-
field_change:
|
|
1238
|
+
}, Qt = {
|
|
1239
|
+
field_change: Ee,
|
|
1220
1240
|
create: qe,
|
|
1221
1241
|
delete: et,
|
|
1222
|
-
comment:
|
|
1223
|
-
status_change:
|
|
1224
|
-
},
|
|
1242
|
+
comment: X,
|
|
1243
|
+
status_change: de
|
|
1244
|
+
}, $t = {
|
|
1225
1245
|
field_change: "bg-blue-100 text-blue-600",
|
|
1226
1246
|
create: "bg-green-100 text-green-600",
|
|
1227
1247
|
delete: "bg-red-100 text-red-600",
|
|
1228
1248
|
comment: "bg-purple-100 text-purple-600",
|
|
1229
1249
|
status_change: "bg-amber-100 text-amber-600"
|
|
1230
1250
|
};
|
|
1231
|
-
function
|
|
1251
|
+
function en(e) {
|
|
1232
1252
|
try {
|
|
1233
1253
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1234
1254
|
if (r < 1) return "just now";
|
|
@@ -1241,24 +1261,24 @@ function Qt(e) {
|
|
|
1241
1261
|
return e;
|
|
1242
1262
|
}
|
|
1243
1263
|
}
|
|
1244
|
-
function
|
|
1264
|
+
function tn(e) {
|
|
1245
1265
|
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
1266
|
}
|
|
1247
|
-
var
|
|
1267
|
+
var nn = {
|
|
1248
1268
|
all: "All",
|
|
1249
1269
|
field_change: "Field Changes",
|
|
1250
1270
|
create: "Creates",
|
|
1251
1271
|
delete: "Deletes",
|
|
1252
1272
|
comment: "Comments",
|
|
1253
1273
|
status_change: "Status Changes"
|
|
1254
|
-
},
|
|
1274
|
+
}, rn = ({ activities: e, filterable: t = !1, defaultFilter: n = "all", className: r }) => {
|
|
1255
1275
|
let [a, o] = i.useState(n), s = i.useMemo(() => a === "all" ? e : e.filter((e) => e.type === a), [e, a]);
|
|
1256
1276
|
return /* @__PURE__ */ Q(S, {
|
|
1257
|
-
className:
|
|
1277
|
+
className: G("", r),
|
|
1258
1278
|
children: [/* @__PURE__ */ Z(w, { children: /* @__PURE__ */ Q(T, {
|
|
1259
1279
|
className: "flex items-center gap-2 text-base",
|
|
1260
1280
|
children: [
|
|
1261
|
-
/* @__PURE__ */ Z(
|
|
1281
|
+
/* @__PURE__ */ Z(se, { className: "h-4 w-4" }),
|
|
1262
1282
|
"Activity",
|
|
1263
1283
|
/* @__PURE__ */ Q("span", {
|
|
1264
1284
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1273,12 +1293,12 @@ var en = {
|
|
|
1273
1293
|
className: "flex flex-wrap gap-1.5 mb-4",
|
|
1274
1294
|
role: "group",
|
|
1275
1295
|
"aria-label": "Activity type filter",
|
|
1276
|
-
children: Object.keys(
|
|
1296
|
+
children: Object.keys(nn).map((e) => /* @__PURE__ */ Q("button", {
|
|
1277
1297
|
type: "button",
|
|
1278
|
-
className:
|
|
1298
|
+
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
1299
|
onClick: () => o(e),
|
|
1280
1300
|
"aria-pressed": a === e,
|
|
1281
|
-
children: [e !== "all" && i.createElement(
|
|
1301
|
+
children: [e !== "all" && i.createElement(Qt[e] || Ee, { className: "h-3 w-3" }), nn[e]]
|
|
1282
1302
|
}, e))
|
|
1283
1303
|
}), s.length === 0 ? /* @__PURE__ */ Z(k, {
|
|
1284
1304
|
title: "No activity recorded",
|
|
@@ -1288,11 +1308,11 @@ var en = {
|
|
|
1288
1308
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
1289
1309
|
className: "space-y-4",
|
|
1290
1310
|
children: s.map((e) => {
|
|
1291
|
-
let t =
|
|
1311
|
+
let t = Qt[e.type] || Ee;
|
|
1292
1312
|
return /* @__PURE__ */ Q("div", {
|
|
1293
1313
|
className: "flex gap-3 relative",
|
|
1294
1314
|
children: [/* @__PURE__ */ Z("div", {
|
|
1295
|
-
className:
|
|
1315
|
+
className: G("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", $t[e.type] || "bg-gray-100 text-gray-600"),
|
|
1296
1316
|
children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
|
|
1297
1317
|
}), /* @__PURE__ */ Q("div", {
|
|
1298
1318
|
className: "flex-1 min-w-0 pt-1",
|
|
@@ -1306,12 +1326,12 @@ var en = {
|
|
|
1306
1326
|
" ",
|
|
1307
1327
|
/* @__PURE__ */ Z("span", {
|
|
1308
1328
|
className: "text-muted-foreground",
|
|
1309
|
-
children:
|
|
1329
|
+
children: tn(e)
|
|
1310
1330
|
})
|
|
1311
1331
|
]
|
|
1312
1332
|
}), /* @__PURE__ */ Z("p", {
|
|
1313
1333
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
1314
|
-
children:
|
|
1334
|
+
children: en(e.timestamp)
|
|
1315
1335
|
})]
|
|
1316
1336
|
})]
|
|
1317
1337
|
}, e.id);
|
|
@@ -1319,7 +1339,7 @@ var en = {
|
|
|
1319
1339
|
})]
|
|
1320
1340
|
})] })]
|
|
1321
1341
|
});
|
|
1322
|
-
},
|
|
1342
|
+
}, an = {
|
|
1323
1343
|
create: "default",
|
|
1324
1344
|
update: "secondary",
|
|
1325
1345
|
delete: "destructive",
|
|
@@ -1331,12 +1351,12 @@ var en = {
|
|
|
1331
1351
|
export: "outline",
|
|
1332
1352
|
import: "outline"
|
|
1333
1353
|
};
|
|
1334
|
-
function
|
|
1354
|
+
function on(e) {
|
|
1335
1355
|
if (!e) return "";
|
|
1336
1356
|
let t = e instanceof Date ? e : new Date(e);
|
|
1337
1357
|
return Number.isNaN(t.getTime()) ? String(e) : t.toLocaleString();
|
|
1338
1358
|
}
|
|
1339
|
-
var
|
|
1359
|
+
var sn = [
|
|
1340
1360
|
[60, "second"],
|
|
1341
1361
|
[60, "minute"],
|
|
1342
1362
|
[24, "hour"],
|
|
@@ -1345,27 +1365,27 @@ var an = [
|
|
|
1345
1365
|
[12, "month"],
|
|
1346
1366
|
[Infinity, "year"]
|
|
1347
1367
|
];
|
|
1348
|
-
function
|
|
1368
|
+
function cn(e, t) {
|
|
1349
1369
|
if (!e) return "";
|
|
1350
1370
|
let n = e instanceof Date ? e : new Date(e);
|
|
1351
1371
|
if (Number.isNaN(n.getTime())) return String(e);
|
|
1352
1372
|
let r = (n.getTime() - Date.now()) / 1e3;
|
|
1353
|
-
for (let [n, i] of
|
|
1373
|
+
for (let [n, i] of sn) {
|
|
1354
1374
|
if (Math.abs(r) < n) try {
|
|
1355
1375
|
return new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(Math.round(r), i);
|
|
1356
1376
|
} catch {
|
|
1357
|
-
return
|
|
1377
|
+
return on(e);
|
|
1358
1378
|
}
|
|
1359
1379
|
r /= n;
|
|
1360
1380
|
}
|
|
1361
|
-
return
|
|
1381
|
+
return on(e);
|
|
1362
1382
|
}
|
|
1363
|
-
function
|
|
1383
|
+
function ln(e) {
|
|
1364
1384
|
if (!e) return "?";
|
|
1365
1385
|
let t = e.trim().split(/\s+/).filter(Boolean).slice(0, 2);
|
|
1366
1386
|
return t.length === 0 ? "?" : t.map((e) => e.charAt(0).toUpperCase()).join("");
|
|
1367
1387
|
}
|
|
1368
|
-
function
|
|
1388
|
+
function un(e) {
|
|
1369
1389
|
if (e == null || e === "") return "—";
|
|
1370
1390
|
if (typeof e == "string") return e;
|
|
1371
1391
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -1375,25 +1395,25 @@ function cn(e) {
|
|
|
1375
1395
|
return String(e);
|
|
1376
1396
|
}
|
|
1377
1397
|
}
|
|
1378
|
-
function
|
|
1398
|
+
function dn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
1379
1399
|
return t ? /* @__PURE__ */ Z("div", {
|
|
1380
|
-
className:
|
|
1400
|
+
className: G("space-y-3", r),
|
|
1381
1401
|
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ Q("div", {
|
|
1382
1402
|
className: "flex items-start gap-3",
|
|
1383
|
-
children: [/* @__PURE__ */ Z(
|
|
1403
|
+
children: [/* @__PURE__ */ Z(I, { className: "h-8 w-8 rounded-full" }), /* @__PURE__ */ Q("div", {
|
|
1384
1404
|
className: "flex-1 space-y-2",
|
|
1385
|
-
children: [/* @__PURE__ */ Z(
|
|
1405
|
+
children: [/* @__PURE__ */ Z(I, { className: "h-4 w-1/3" }), /* @__PURE__ */ Z(I, { className: "h-3 w-1/2" })]
|
|
1386
1406
|
})]
|
|
1387
1407
|
}, t))
|
|
1388
1408
|
}) : !e || e.length === 0 ? /* @__PURE__ */ Z("div", {
|
|
1389
|
-
className:
|
|
1409
|
+
className: G("flex items-center justify-center rounded-md border border-dashed py-10 text-sm text-muted-foreground", r),
|
|
1390
1410
|
children: n ?? "No history yet"
|
|
1391
|
-
}) : /* @__PURE__ */ Z(
|
|
1411
|
+
}) : /* @__PURE__ */ Z(ae, {
|
|
1392
1412
|
delayDuration: 150,
|
|
1393
1413
|
children: /* @__PURE__ */ Z("ol", {
|
|
1394
|
-
className:
|
|
1414
|
+
className: G("space-y-4", r),
|
|
1395
1415
|
children: e.map((e, t) => {
|
|
1396
|
-
let n = (e.action ?? "").toLowerCase(), r =
|
|
1416
|
+
let n = (e.action ?? "").toLowerCase(), r = an[n] ?? "outline", a = typeof e.user_name == "string" && e.user_name.trim() || "Unknown user", o = on(e.created_at), s = cn(e.created_at, i), c = typeof e.user_avatar == "string" ? e.user_avatar : void 0;
|
|
1397
1417
|
return /* @__PURE__ */ Q("li", {
|
|
1398
1418
|
className: "flex items-start gap-3",
|
|
1399
1419
|
children: [/* @__PURE__ */ Q(_, {
|
|
@@ -1403,7 +1423,7 @@ function ln({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1403
1423
|
alt: a
|
|
1404
1424
|
}) : null, /* @__PURE__ */ Z(v, {
|
|
1405
1425
|
className: "text-[10px] font-medium",
|
|
1406
|
-
children:
|
|
1426
|
+
children: ln(e.user_name)
|
|
1407
1427
|
})]
|
|
1408
1428
|
}), /* @__PURE__ */ Q("div", {
|
|
1409
1429
|
className: "min-w-0 flex-1",
|
|
@@ -1420,7 +1440,7 @@ function ln({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1420
1440
|
className: "text-[10px] uppercase tracking-wide",
|
|
1421
1441
|
children: e.action
|
|
1422
1442
|
}),
|
|
1423
|
-
o && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(
|
|
1443
|
+
o && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
1424
1444
|
asChild: !0,
|
|
1425
1445
|
children: /* @__PURE__ */ Z("span", {
|
|
1426
1446
|
className: "text-xs text-muted-foreground cursor-help",
|
|
@@ -1454,7 +1474,7 @@ function ln({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1454
1474
|
": ",
|
|
1455
1475
|
/* @__PURE__ */ Z("span", {
|
|
1456
1476
|
className: "text-foreground",
|
|
1457
|
-
children:
|
|
1477
|
+
children: un(e.to)
|
|
1458
1478
|
})
|
|
1459
1479
|
]
|
|
1460
1480
|
}, e.field))
|
|
@@ -1471,12 +1491,12 @@ function ln({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1471
1491
|
": ",
|
|
1472
1492
|
/* @__PURE__ */ Z("span", {
|
|
1473
1493
|
className: "line-through opacity-70",
|
|
1474
|
-
children:
|
|
1494
|
+
children: un(e.from)
|
|
1475
1495
|
}),
|
|
1476
1496
|
" → ",
|
|
1477
1497
|
/* @__PURE__ */ Z("span", {
|
|
1478
1498
|
className: "text-foreground",
|
|
1479
|
-
children:
|
|
1499
|
+
children: un(e.to)
|
|
1480
1500
|
})
|
|
1481
1501
|
]
|
|
1482
1502
|
}, e.field))
|
|
@@ -1490,13 +1510,13 @@ function ln({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1490
1510
|
}
|
|
1491
1511
|
//#endregion
|
|
1492
1512
|
//#region src/RecordMetaFooter.tsx
|
|
1493
|
-
var
|
|
1513
|
+
var fn = {
|
|
1494
1514
|
createdAt: "created_at",
|
|
1495
1515
|
createdBy: "created_by",
|
|
1496
1516
|
updatedAt: "updated_at",
|
|
1497
1517
|
updatedBy: "updated_by"
|
|
1498
1518
|
};
|
|
1499
|
-
function
|
|
1519
|
+
function pn(e) {
|
|
1500
1520
|
if (!e) return null;
|
|
1501
1521
|
if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
|
|
1502
1522
|
if (typeof e == "string" || typeof e == "number") {
|
|
@@ -1505,7 +1525,7 @@ function dn(e) {
|
|
|
1505
1525
|
}
|
|
1506
1526
|
return null;
|
|
1507
1527
|
}
|
|
1508
|
-
function
|
|
1528
|
+
function mn(e, t) {
|
|
1509
1529
|
let n = Date.now() - e.getTime(), r = Math.max(0, Math.floor(n / 1e3));
|
|
1510
1530
|
if (r < 60) return t("detail.justNow");
|
|
1511
1531
|
let i = Math.floor(r / 60);
|
|
@@ -1513,7 +1533,7 @@ function fn(e, t) {
|
|
|
1513
1533
|
let a = Math.floor(i / 60);
|
|
1514
1534
|
return a < 24 ? t("detail.hoursAgo", { count: a }) : t("detail.daysAgo", { count: Math.floor(a / 24) });
|
|
1515
1535
|
}
|
|
1516
|
-
function
|
|
1536
|
+
function hn(e) {
|
|
1517
1537
|
try {
|
|
1518
1538
|
return new Intl.DateTimeFormat(void 0, {
|
|
1519
1539
|
dateStyle: "medium",
|
|
@@ -1523,16 +1543,16 @@ function pn(e) {
|
|
|
1523
1543
|
return e.toISOString();
|
|
1524
1544
|
}
|
|
1525
1545
|
}
|
|
1526
|
-
var
|
|
1546
|
+
var gn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
1527
1547
|
if (e == null || e === "") return null;
|
|
1528
1548
|
let r = t?.fields?.[n], i = r?.reference_to || r?.reference, a = {
|
|
1529
1549
|
name: n,
|
|
1530
1550
|
type: r?.type || (i ? "lookup" : "text"),
|
|
1531
1551
|
...i && { reference_to: i },
|
|
1532
1552
|
...r?.reference_field && { reference_field: r.reference_field }
|
|
1533
|
-
}, o =
|
|
1553
|
+
}, o = Tt(a) || a.type;
|
|
1534
1554
|
if (o) {
|
|
1535
|
-
let t =
|
|
1555
|
+
let t = Ct(o);
|
|
1536
1556
|
if (t) return /* @__PURE__ */ Z("span", {
|
|
1537
1557
|
className: "inline-flex items-center [&_a]:text-inherit [&_a]:hover:underline",
|
|
1538
1558
|
children: /* @__PURE__ */ Z(t, {
|
|
@@ -1542,20 +1562,20 @@ var mn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1542
1562
|
});
|
|
1543
1563
|
}
|
|
1544
1564
|
return /* @__PURE__ */ Z("span", { children: String(e) });
|
|
1545
|
-
},
|
|
1565
|
+
}, _n = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
|
|
1546
1566
|
if (!t && !n) return null;
|
|
1547
|
-
let o = n ? /* @__PURE__ */ Z(
|
|
1567
|
+
let o = n ? /* @__PURE__ */ Z(ae, {
|
|
1548
1568
|
delayDuration: 200,
|
|
1549
|
-
children: /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(
|
|
1569
|
+
children: /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
1550
1570
|
asChild: !0,
|
|
1551
1571
|
children: /* @__PURE__ */ Z("time", {
|
|
1552
1572
|
dateTime: n.toISOString(),
|
|
1553
1573
|
className: "cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2",
|
|
1554
|
-
children:
|
|
1574
|
+
children: mn(n, a)
|
|
1555
1575
|
})
|
|
1556
1576
|
}), /* @__PURE__ */ Z(H, {
|
|
1557
1577
|
side: "top",
|
|
1558
|
-
children:
|
|
1578
|
+
children: hn(n)
|
|
1559
1579
|
})] })
|
|
1560
1580
|
}) : null;
|
|
1561
1581
|
return /* @__PURE__ */ Q("span", {
|
|
@@ -1565,7 +1585,7 @@ var mn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1565
1585
|
className: "text-muted-foreground/70",
|
|
1566
1586
|
children: e
|
|
1567
1587
|
}),
|
|
1568
|
-
t ? /* @__PURE__ */ Z(
|
|
1588
|
+
t ? /* @__PURE__ */ Z(gn, {
|
|
1569
1589
|
value: t,
|
|
1570
1590
|
objectSchema: r,
|
|
1571
1591
|
fieldName: i
|
|
@@ -1577,31 +1597,31 @@ var mn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1577
1597
|
o
|
|
1578
1598
|
]
|
|
1579
1599
|
});
|
|
1580
|
-
},
|
|
1600
|
+
}, vn = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
|
|
1581
1601
|
let { t: i } = $();
|
|
1582
1602
|
if (!e) return null;
|
|
1583
|
-
let a =
|
|
1603
|
+
let a = pn(e[fn.createdAt]), o = pn(e[fn.updatedAt]), s = e[fn.createdBy], c = e[fn.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
1604
|
return !l && !d ? null : /* @__PURE__ */ Q("div", {
|
|
1585
|
-
className:
|
|
1605
|
+
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
1606
|
"data-testid": "record-meta-footer",
|
|
1587
|
-
children: [l && /* @__PURE__ */ Z(
|
|
1607
|
+
children: [l && /* @__PURE__ */ Z(_n, {
|
|
1588
1608
|
label: i("detail.createdBy"),
|
|
1589
1609
|
user: s,
|
|
1590
1610
|
date: a,
|
|
1591
1611
|
objectSchema: t,
|
|
1592
|
-
userField:
|
|
1612
|
+
userField: fn.createdBy,
|
|
1593
1613
|
t: i
|
|
1594
|
-
}), d && /* @__PURE__ */ Z(
|
|
1614
|
+
}), d && /* @__PURE__ */ Z(_n, {
|
|
1595
1615
|
label: i("detail.updatedBy"),
|
|
1596
1616
|
user: c,
|
|
1597
1617
|
date: o,
|
|
1598
1618
|
objectSchema: t,
|
|
1599
|
-
userField:
|
|
1619
|
+
userField: fn.updatedBy,
|
|
1600
1620
|
t: i
|
|
1601
1621
|
})]
|
|
1602
1622
|
});
|
|
1603
|
-
},
|
|
1604
|
-
function
|
|
1623
|
+
}, yn = 5;
|
|
1624
|
+
function bn(e, t, i, a) {
|
|
1605
1625
|
if (e && typeof e == "object") {
|
|
1606
1626
|
if (t.primaryField) {
|
|
1607
1627
|
let n = e[t.primaryField];
|
|
@@ -1621,10 +1641,10 @@ function vn(e, t, i, a) {
|
|
|
1621
1641
|
}
|
|
1622
1642
|
return a;
|
|
1623
1643
|
}
|
|
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) =>
|
|
1644
|
+
var xn = ({ 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 }) => {
|
|
1645
|
+
let [g, _] = i.useState(e.data), [v, y] = i.useState(!e.data && !!(e.api && e.resourceId || n && e.objectName && e.resourceId)), [S, C] = i.useState(!1), w = m ?? S, [T, E] = i.useState(!1), [D, O] = i.useState({}), [k, A] = i.useState(!1), [j, M] = i.useState(null), [N, ee] = i.useState(null), [te, ne] = i.useState(!1), [re, ie] = i.useState(0), [P, F] = i.useState(!1), { t: W } = $(), { currency: se } = At(), { fieldOptionLabel: ce } = gt(), ue = oe(), de = Ot(), K = i.useMemo(() => {
|
|
1646
|
+
if (!de?.isLoaded || !e.objectName) return e;
|
|
1647
|
+
let t = (t) => de.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
|
|
1628
1648
|
let n = typeof e == "string" ? e : e?.name;
|
|
1629
1649
|
return !n || t(n);
|
|
1630
1650
|
});
|
|
@@ -1637,13 +1657,13 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1637
1657
|
})),
|
|
1638
1658
|
summaryFields: n(e.summaryFields)
|
|
1639
1659
|
};
|
|
1640
|
-
}, [e,
|
|
1660
|
+
}, [e, de]);
|
|
1641
1661
|
i.useEffect(() => {
|
|
1642
1662
|
g && p && p(g);
|
|
1643
1663
|
}, [g, p]);
|
|
1644
|
-
let
|
|
1645
|
-
if (
|
|
1646
|
-
let e = [...
|
|
1664
|
+
let q = i.useMemo(() => {
|
|
1665
|
+
if (K.summaryFields && K.summaryFields.length > 0) return [];
|
|
1666
|
+
let e = [...K.sections?.flatMap((e) => e.fields) || [], ...K.fields || []], t = {};
|
|
1647
1667
|
for (let n of e) t[n.name] || (t[n.name] = n);
|
|
1648
1668
|
if (N?.fields) for (let [e, n] of Object.entries(N.fields)) t[e] = {
|
|
1649
1669
|
...t[e] || {},
|
|
@@ -1662,26 +1682,26 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1662
1682
|
let o = Object.keys(t).find((e) => (t[e]?.type === "date" || t[e]?.type === "datetime") && /close|due|start|end|expected/i.test(e) && n(e));
|
|
1663
1683
|
return o && !r.includes(o) && r.push(o), r;
|
|
1664
1684
|
}, [
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1685
|
+
K.summaryFields,
|
|
1686
|
+
K.sections,
|
|
1687
|
+
K.fields,
|
|
1668
1688
|
N,
|
|
1669
1689
|
g
|
|
1670
|
-
]), fe =
|
|
1671
|
-
|
|
1690
|
+
]), fe = K.summaryFields && K.summaryFields.length > 0 ? K.summaryFields : q, pe = i.useCallback(() => {
|
|
1691
|
+
K.resourceId && navigator.clipboard.writeText(String(K.resourceId)).then(() => {
|
|
1672
1692
|
ne(!0), setTimeout(() => ne(!1), 1500);
|
|
1673
1693
|
});
|
|
1674
|
-
}, [
|
|
1694
|
+
}, [K.resourceId]);
|
|
1675
1695
|
i.useEffect(() => {
|
|
1676
1696
|
let e = !0;
|
|
1677
|
-
if (
|
|
1697
|
+
if (K.data) return _(K.data), y(!1), n?.getObjectSchema && K.objectName && n.getObjectSchema(K.objectName).then((t) => {
|
|
1678
1698
|
e && ee(t);
|
|
1679
1699
|
}).catch(() => {}), () => {
|
|
1680
1700
|
e = !1;
|
|
1681
1701
|
};
|
|
1682
|
-
if (n &&
|
|
1702
|
+
if (n && K.objectName && K.resourceId) {
|
|
1683
1703
|
y(!0), ee(null), _(null);
|
|
1684
|
-
let r =
|
|
1704
|
+
let r = K.objectName, i = K.resourceId, a = `${r}-`, o = [...K.sections?.flatMap((e) => e.fields) || [], ...K.fields || []];
|
|
1685
1705
|
(n.getObjectSchema ? n.getObjectSchema(r).catch(() => null) : Promise.resolve(null)).then((s) => {
|
|
1686
1706
|
if (!e) return;
|
|
1687
1707
|
ee(s);
|
|
@@ -1705,7 +1725,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1705
1725
|
}).catch((t) => {
|
|
1706
1726
|
e && (console.error("Failed to fetch detail data:", t), y(!1));
|
|
1707
1727
|
});
|
|
1708
|
-
} else
|
|
1728
|
+
} else K.api && K.resourceId && (y(!0), fetch(`${K.api}/${K.resourceId}`).then((e) => e.json()).then((t) => {
|
|
1709
1729
|
e && _(t?.data || t);
|
|
1710
1730
|
}).catch((e) => {
|
|
1711
1731
|
console.error("Failed to fetch detail data:", e);
|
|
@@ -1716,64 +1736,64 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1716
1736
|
e = !1;
|
|
1717
1737
|
};
|
|
1718
1738
|
}, [
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1739
|
+
K.api,
|
|
1740
|
+
K.resourceId,
|
|
1741
|
+
K.objectName,
|
|
1722
1742
|
n,
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1743
|
+
K.sections,
|
|
1744
|
+
K.fields,
|
|
1745
|
+
re
|
|
1726
1746
|
]);
|
|
1727
1747
|
let me = i.useCallback(() => {
|
|
1728
1748
|
if (s) s();
|
|
1729
|
-
else if (
|
|
1730
|
-
let e =
|
|
1731
|
-
|
|
1732
|
-
} else
|
|
1733
|
-
}, [s,
|
|
1734
|
-
a ? a() :
|
|
1735
|
-
}, [a,
|
|
1736
|
-
if (!n?.cancelPendingApproval || !
|
|
1737
|
-
M(
|
|
1749
|
+
else if (K.onNavigate) {
|
|
1750
|
+
let e = K.backUrl || (K.objectName ? `/${K.objectName}` : "/");
|
|
1751
|
+
K.onNavigate(e, { replace: !0 });
|
|
1752
|
+
} else K.backUrl ? window.location.href = K.backUrl : window.history.back();
|
|
1753
|
+
}, [s, K]), he = i.useCallback(() => {
|
|
1754
|
+
a ? a() : K.onNavigate && K.editUrl ? K.onNavigate(K.editUrl) : K.onNavigate && K.objectName && K.resourceId ? K.onNavigate(`/${K.objectName}/${K.resourceId}/edit`) : K.editUrl && (window.location.href = K.editUrl);
|
|
1755
|
+
}, [a, K]), _e = i.useCallback(async () => {
|
|
1756
|
+
if (!n?.cancelPendingApproval || !K.objectName || !K.resourceId) {
|
|
1757
|
+
M(W("detail.cancelApprovalUnavailable"));
|
|
1738
1758
|
return;
|
|
1739
1759
|
}
|
|
1740
|
-
|
|
1760
|
+
F(!0), M(null);
|
|
1741
1761
|
try {
|
|
1742
|
-
if (await n.cancelPendingApproval(String(
|
|
1743
|
-
let e = await n.findOne(String(
|
|
1762
|
+
if (await n.cancelPendingApproval(String(K.objectName), String(K.resourceId)), n.findOne) try {
|
|
1763
|
+
let e = await n.findOne(String(K.objectName), String(K.resourceId));
|
|
1744
1764
|
e && _(e);
|
|
1745
1765
|
} catch {}
|
|
1746
|
-
|
|
1766
|
+
ie((e) => e + 1);
|
|
1747
1767
|
try {
|
|
1748
1768
|
window.dispatchEvent(new CustomEvent("objectui:record-changed", { detail: {
|
|
1749
|
-
objectName: String(
|
|
1750
|
-
recordId: String(
|
|
1769
|
+
objectName: String(K.objectName),
|
|
1770
|
+
recordId: String(K.resourceId),
|
|
1751
1771
|
reason: "approval-recalled"
|
|
1752
1772
|
} }));
|
|
1753
1773
|
} catch {}
|
|
1754
1774
|
} catch (e) {
|
|
1755
1775
|
let t = (e?.message || e?.error || String(e ?? "Cancel failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
|
|
1756
|
-
M(`${
|
|
1776
|
+
M(`${W("detail.cancelApprovalFailed")}: ${t}`);
|
|
1757
1777
|
} finally {
|
|
1758
|
-
|
|
1778
|
+
F(!1);
|
|
1759
1779
|
}
|
|
1760
1780
|
}, [
|
|
1761
1781
|
n,
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1782
|
+
K.objectName,
|
|
1783
|
+
K.resourceId,
|
|
1784
|
+
W
|
|
1765
1785
|
]), ve = i.useCallback(() => {
|
|
1766
|
-
let e =
|
|
1767
|
-
window.confirm(e) && (o?.(),
|
|
1768
|
-
}, [o,
|
|
1769
|
-
navigator.share &&
|
|
1770
|
-
title:
|
|
1771
|
-
text: `${
|
|
1786
|
+
let e = K.deleteConfirmation || W("detail.deleteConfirmation");
|
|
1787
|
+
window.confirm(e) && (o?.(), K.onNavigate && K.objectName && K.onNavigate(`/${K.objectName}`, { replace: !0 }));
|
|
1788
|
+
}, [o, K]), xe = i.useCallback(() => {
|
|
1789
|
+
navigator.share && K.objectName && K.resourceId ? navigator.share({
|
|
1790
|
+
title: K.title || W("detail.details"),
|
|
1791
|
+
text: `${K.objectName} #${K.resourceId}`,
|
|
1772
1792
|
url: window.location.href
|
|
1773
1793
|
}).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
|
|
1774
1794
|
console.log("Link copied to clipboard");
|
|
1775
1795
|
});
|
|
1776
|
-
}, [
|
|
1796
|
+
}, [K]), Se = i.useCallback(() => {
|
|
1777
1797
|
let e = !w;
|
|
1778
1798
|
h && h(e), m === void 0 && C(e);
|
|
1779
1799
|
}, [
|
|
@@ -1809,58 +1829,58 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1809
1829
|
l
|
|
1810
1830
|
]), we = i.useCallback(() => {
|
|
1811
1831
|
O({}), E(!1), M(null);
|
|
1812
|
-
}, []),
|
|
1832
|
+
}, []), De = i.useCallback((e, t) => {
|
|
1813
1833
|
O((n) => ({
|
|
1814
1834
|
...n,
|
|
1815
1835
|
[e]: t
|
|
1816
1836
|
}));
|
|
1817
1837
|
}, []);
|
|
1818
1838
|
i.useEffect(() => {
|
|
1819
|
-
if (!
|
|
1820
|
-
let e =
|
|
1839
|
+
if (!K.recordNavigation) return;
|
|
1840
|
+
let e = K.recordNavigation, t = (t) => {
|
|
1821
1841
|
let n = t.target?.tagName;
|
|
1822
1842
|
n === "INPUT" || n === "TEXTAREA" || t.target?.isContentEditable || (t.key === "ArrowLeft" && e.currentIndex > 0 ? (t.preventDefault(), e.onNavigate(e.recordIds[e.currentIndex - 1])) : t.key === "ArrowRight" && e.currentIndex < e.recordIds.length - 1 && (t.preventDefault(), e.onNavigate(e.recordIds[e.currentIndex + 1])));
|
|
1823
1843
|
};
|
|
1824
1844
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
1825
|
-
}, [
|
|
1826
|
-
if (!c ||
|
|
1845
|
+
}, [K.recordNavigation]), i.useEffect(() => {
|
|
1846
|
+
if (!c || K.showHeader !== !1) return;
|
|
1827
1847
|
let e = "objectui:record:inline-edit-toggle", t = (e) => {
|
|
1828
1848
|
let t = e.detail;
|
|
1829
|
-
t?.recordId &&
|
|
1849
|
+
t?.recordId && K.recordId && t.recordId !== K.recordId || t?.objectName && K.objectName && t.objectName !== K.objectName || Ce();
|
|
1830
1850
|
};
|
|
1831
1851
|
return window.addEventListener(e, t), () => window.removeEventListener(e, t);
|
|
1832
1852
|
}, [
|
|
1833
1853
|
c,
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1854
|
+
K.showHeader,
|
|
1855
|
+
K.recordId,
|
|
1856
|
+
K.objectName,
|
|
1837
1857
|
Ce
|
|
1838
1858
|
]);
|
|
1839
|
-
let
|
|
1859
|
+
let Oe = i.useMemo(() => K.related ?? [], [K.related]), J = i.useMemo(() => {
|
|
1840
1860
|
let e = [];
|
|
1841
1861
|
return e.push({
|
|
1842
1862
|
name: "sys_share",
|
|
1843
|
-
label:
|
|
1863
|
+
label: W("detail.share"),
|
|
1844
1864
|
icon: "share-2",
|
|
1845
1865
|
type: "script",
|
|
1846
1866
|
onClick: xe
|
|
1847
|
-
}),
|
|
1867
|
+
}), K.showEdit && e.push({
|
|
1848
1868
|
name: "sys_edit_mobile",
|
|
1849
|
-
label:
|
|
1869
|
+
label: W("detail.edit"),
|
|
1850
1870
|
icon: "edit",
|
|
1851
1871
|
type: "script",
|
|
1852
1872
|
className: "sm:hidden",
|
|
1853
1873
|
onClick: he
|
|
1854
1874
|
}), c && e.push({
|
|
1855
1875
|
name: "sys_toggle_inline_edit_mobile",
|
|
1856
|
-
label:
|
|
1876
|
+
label: W(T ? "detail.save" : "detail.editInline"),
|
|
1857
1877
|
icon: "edit",
|
|
1858
1878
|
type: "script",
|
|
1859
1879
|
className: "sm:hidden",
|
|
1860
1880
|
onClick: Ce
|
|
1861
|
-
}),
|
|
1881
|
+
}), K.showDelete && e.push({
|
|
1862
1882
|
name: "sys_delete",
|
|
1863
|
-
label:
|
|
1883
|
+
label: W("detail.delete"),
|
|
1864
1884
|
icon: "trash-2",
|
|
1865
1885
|
type: "script",
|
|
1866
1886
|
variant: "destructive",
|
|
@@ -1868,18 +1888,18 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1868
1888
|
onClick: ve
|
|
1869
1889
|
}), e;
|
|
1870
1890
|
}, [
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1891
|
+
W,
|
|
1892
|
+
K.showEdit,
|
|
1893
|
+
K.showDelete,
|
|
1874
1894
|
c,
|
|
1875
1895
|
T,
|
|
1876
1896
|
xe,
|
|
1877
1897
|
he,
|
|
1878
1898
|
Ce,
|
|
1879
1899
|
ve
|
|
1880
|
-
]),
|
|
1881
|
-
let e =
|
|
1882
|
-
if (
|
|
1900
|
+
]), ke = i.useMemo(() => {
|
|
1901
|
+
let e = K.actions ?? [];
|
|
1902
|
+
if (J.length === 0) return e;
|
|
1883
1903
|
let t = !1, n = e.map((e) => {
|
|
1884
1904
|
let n = e;
|
|
1885
1905
|
if (n && typeof n == "object" && n.type === "action:bar" && (!n.location || n.location === "record_header")) {
|
|
@@ -1887,7 +1907,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1887
1907
|
let e = Array.isArray(n.systemActions) ? n.systemActions : [];
|
|
1888
1908
|
return {
|
|
1889
1909
|
...n,
|
|
1890
|
-
systemActions: [...e, ...
|
|
1910
|
+
systemActions: [...e, ...J]
|
|
1891
1911
|
};
|
|
1892
1912
|
}
|
|
1893
1913
|
return e;
|
|
@@ -1895,72 +1915,72 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1895
1915
|
return t || n.push({
|
|
1896
1916
|
type: "action:bar",
|
|
1897
1917
|
location: "record_header",
|
|
1898
|
-
systemActions:
|
|
1918
|
+
systemActions: J
|
|
1899
1919
|
}), n;
|
|
1900
|
-
}, [
|
|
1901
|
-
return v ||
|
|
1902
|
-
className:
|
|
1920
|
+
}, [K.actions, J]);
|
|
1921
|
+
return v || K.loading ? /* @__PURE__ */ Q("div", {
|
|
1922
|
+
className: G("space-y-4", r),
|
|
1903
1923
|
children: [
|
|
1904
|
-
/* @__PURE__ */ Z(
|
|
1905
|
-
/* @__PURE__ */ Z(
|
|
1906
|
-
/* @__PURE__ */ Z(
|
|
1924
|
+
/* @__PURE__ */ Z(I, { className: "h-10 w-full" }),
|
|
1925
|
+
/* @__PURE__ */ Z(I, { className: "h-64 w-full" }),
|
|
1926
|
+
/* @__PURE__ */ Z(I, { className: "h-48 w-full" })
|
|
1907
1927
|
]
|
|
1908
|
-
}) : !g && !
|
|
1909
|
-
className:
|
|
1928
|
+
}) : !g && !K.data ? /* @__PURE__ */ Q("div", {
|
|
1929
|
+
className: G("flex flex-col items-center justify-center py-16 text-center", r),
|
|
1910
1930
|
children: [
|
|
1911
1931
|
/* @__PURE__ */ Z("p", {
|
|
1912
1932
|
className: "text-lg font-semibold",
|
|
1913
|
-
children:
|
|
1933
|
+
children: W("detail.recordNotFound")
|
|
1914
1934
|
}),
|
|
1915
1935
|
/* @__PURE__ */ Z("p", {
|
|
1916
1936
|
className: "text-sm text-muted-foreground mt-1",
|
|
1917
|
-
children:
|
|
1937
|
+
children: W("detail.recordNotFoundDescription")
|
|
1918
1938
|
}),
|
|
1919
|
-
(
|
|
1939
|
+
(K.showBack ?? !0) && /* @__PURE__ */ Q(x, {
|
|
1920
1940
|
variant: "outline",
|
|
1921
1941
|
size: "sm",
|
|
1922
1942
|
onClick: me,
|
|
1923
1943
|
className: "mt-4 gap-2",
|
|
1924
|
-
children: [/* @__PURE__ */ Z(
|
|
1944
|
+
children: [/* @__PURE__ */ Z(le, { className: "h-4 w-4" }), W("detail.goBack")]
|
|
1925
1945
|
})
|
|
1926
1946
|
]
|
|
1927
|
-
}) : /* @__PURE__ */ Z(
|
|
1928
|
-
className:
|
|
1947
|
+
}) : /* @__PURE__ */ Z(ae, { children: /* @__PURE__ */ Q("div", {
|
|
1948
|
+
className: G("space-y-6", r),
|
|
1929
1949
|
children: [
|
|
1930
|
-
|
|
1950
|
+
K.showHeader !== !1 && /* @__PURE__ */ Q("div", {
|
|
1931
1951
|
className: "flex flex-col sm:flex-row items-start justify-between gap-3 sm:gap-4 pb-4 border-b",
|
|
1932
1952
|
children: [/* @__PURE__ */ Q("div", {
|
|
1933
1953
|
className: "flex items-start gap-2 sm:gap-3 flex-1 min-w-0",
|
|
1934
|
-
children: [(
|
|
1954
|
+
children: [(K.showBack ?? !0) && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
1935
1955
|
asChild: !0,
|
|
1936
1956
|
children: /* @__PURE__ */ Z(x, {
|
|
1937
1957
|
variant: "ghost",
|
|
1938
1958
|
size: "icon",
|
|
1939
1959
|
onClick: me,
|
|
1940
1960
|
className: "shrink-0 mt-1",
|
|
1941
|
-
children: /* @__PURE__ */ Z(
|
|
1961
|
+
children: /* @__PURE__ */ Z(le, { className: "h-4 w-4" })
|
|
1942
1962
|
})
|
|
1943
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
1963
|
+
}), /* @__PURE__ */ Z(H, { children: W("detail.back") })] }), /* @__PURE__ */ Q("div", {
|
|
1944
1964
|
className: "flex-1 min-w-0",
|
|
1945
1965
|
children: [/* @__PURE__ */ Q("div", {
|
|
1946
1966
|
className: "flex items-center gap-2 flex-wrap",
|
|
1947
1967
|
children: [
|
|
1948
1968
|
/* @__PURE__ */ Z("h1", {
|
|
1949
1969
|
className: "text-xl sm:text-2xl font-bold truncate",
|
|
1950
|
-
children:
|
|
1970
|
+
children: bn(g, K, N, W("detail.details"))
|
|
1951
1971
|
}),
|
|
1952
1972
|
fe.map((e) => {
|
|
1953
1973
|
let t = g?.[e];
|
|
1954
1974
|
if (t == null || t === "") return null;
|
|
1955
|
-
let n = (
|
|
1975
|
+
let n = (K.sections || []).flatMap((e) => e.fields).concat(K.fields || []).find((t) => t.name === e), r = N?.fields?.[e], i = n?.type || r?.type, a = String(t), o = null;
|
|
1956
1976
|
try {
|
|
1957
1977
|
if (i === "currency") {
|
|
1958
1978
|
let e = Number(t);
|
|
1959
1979
|
if (!Number.isNaN(e)) {
|
|
1960
|
-
let t =
|
|
1980
|
+
let t = kt({
|
|
1961
1981
|
...r,
|
|
1962
1982
|
...n
|
|
1963
|
-
},
|
|
1983
|
+
}, se);
|
|
1964
1984
|
a = t ? new Intl.NumberFormat(void 0, {
|
|
1965
1985
|
style: "currency",
|
|
1966
1986
|
currency: t,
|
|
@@ -1989,7 +2009,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
1989
2009
|
let e = i[String(t)];
|
|
1990
2010
|
e?.label && (o = e.label);
|
|
1991
2011
|
}
|
|
1992
|
-
a =
|
|
2012
|
+
a = K.objectName ? ce(K.objectName, e, String(t), o) : o;
|
|
1993
2013
|
}
|
|
1994
2014
|
} catch {}
|
|
1995
2015
|
return o === null ? /* @__PURE__ */ Z(b, {
|
|
@@ -2011,80 +2031,80 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2011
2031
|
}), a]
|
|
2012
2032
|
}, e);
|
|
2013
2033
|
}),
|
|
2014
|
-
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(
|
|
2034
|
+
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2015
2035
|
asChild: !0,
|
|
2016
2036
|
children: /* @__PURE__ */ Z(x, {
|
|
2017
2037
|
variant: "ghost",
|
|
2018
2038
|
size: "icon",
|
|
2019
2039
|
className: "h-6 w-6 shrink-0",
|
|
2020
2040
|
onClick: Se,
|
|
2021
|
-
"aria-label":
|
|
2041
|
+
"aria-label": W(w ? "detail.removeFromFavorites" : "detail.addToFavorites"),
|
|
2022
2042
|
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
2043
|
})
|
|
2024
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2044
|
+
}), /* @__PURE__ */ Z(H, { children: W(w ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
|
|
2025
2045
|
]
|
|
2026
|
-
}),
|
|
2046
|
+
}), K.objectName && /* @__PURE__ */ Q("p", {
|
|
2027
2047
|
className: "text-sm text-muted-foreground mt-1 flex items-center gap-1",
|
|
2028
2048
|
children: [/* @__PURE__ */ Z("span", {
|
|
2029
2049
|
className: "font-medium",
|
|
2030
|
-
children: f ||
|
|
2031
|
-
}),
|
|
2050
|
+
children: f || K.objectName
|
|
2051
|
+
}), K.resourceId && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2032
2052
|
asChild: !0,
|
|
2033
2053
|
children: /* @__PURE__ */ Z(x, {
|
|
2034
2054
|
variant: "ghost",
|
|
2035
2055
|
size: "icon",
|
|
2036
2056
|
className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
|
|
2037
2057
|
onClick: pe,
|
|
2038
|
-
"aria-label":
|
|
2058
|
+
"aria-label": W("detail.copyRecordId", { defaultValue: "Copy record ID" }),
|
|
2039
2059
|
children: te ? /* @__PURE__ */ Z(ge, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Te, { className: "h-3 w-3" })
|
|
2040
2060
|
})
|
|
2041
|
-
}), /* @__PURE__ */ Z(H, { children: te ?
|
|
2061
|
+
}), /* @__PURE__ */ Z(H, { children: te ? W("detail.copied", { defaultValue: "Copied" }) : W("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
|
|
2042
2062
|
})]
|
|
2043
2063
|
})]
|
|
2044
2064
|
}), /* @__PURE__ */ Q("div", {
|
|
2045
2065
|
className: "flex flex-wrap items-center gap-1.5 shrink-0 w-full sm:w-auto",
|
|
2046
2066
|
children: [
|
|
2047
|
-
|
|
2067
|
+
K.recordNavigation && /* @__PURE__ */ Q("div", {
|
|
2048
2068
|
className: "flex items-center gap-1 mr-2",
|
|
2049
2069
|
children: [
|
|
2050
|
-
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(
|
|
2070
|
+
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2051
2071
|
asChild: !0,
|
|
2052
2072
|
children: /* @__PURE__ */ Z(x, {
|
|
2053
2073
|
variant: "outline",
|
|
2054
2074
|
size: "icon",
|
|
2055
2075
|
className: "h-8 w-8",
|
|
2056
|
-
disabled:
|
|
2076
|
+
disabled: K.recordNavigation.currentIndex <= 0,
|
|
2057
2077
|
onClick: () => {
|
|
2058
|
-
let e =
|
|
2078
|
+
let e = K.recordNavigation;
|
|
2059
2079
|
e.currentIndex > 0 && e.onNavigate(e.recordIds[e.currentIndex - 1]);
|
|
2060
2080
|
},
|
|
2061
2081
|
children: /* @__PURE__ */ Z(ye, { className: "h-4 w-4" })
|
|
2062
2082
|
})
|
|
2063
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2083
|
+
}), /* @__PURE__ */ Z(H, { children: W("detail.previousRecord") })] }),
|
|
2064
2084
|
/* @__PURE__ */ Z("span", {
|
|
2065
2085
|
className: "text-xs text-muted-foreground whitespace-nowrap px-1",
|
|
2066
|
-
children:
|
|
2067
|
-
current:
|
|
2068
|
-
total:
|
|
2086
|
+
children: W("detail.recordOf", {
|
|
2087
|
+
current: K.recordNavigation.currentIndex + 1,
|
|
2088
|
+
total: K.recordNavigation.recordIds.length
|
|
2069
2089
|
})
|
|
2070
2090
|
}),
|
|
2071
|
-
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(
|
|
2091
|
+
/* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2072
2092
|
asChild: !0,
|
|
2073
2093
|
children: /* @__PURE__ */ Z(x, {
|
|
2074
2094
|
variant: "outline",
|
|
2075
2095
|
size: "icon",
|
|
2076
2096
|
className: "h-8 w-8",
|
|
2077
|
-
disabled:
|
|
2097
|
+
disabled: K.recordNavigation.currentIndex >= K.recordNavigation.recordIds.length - 1,
|
|
2078
2098
|
onClick: () => {
|
|
2079
|
-
let e =
|
|
2099
|
+
let e = K.recordNavigation;
|
|
2080
2100
|
e.currentIndex < e.recordIds.length - 1 && e.onNavigate(e.recordIds[e.currentIndex + 1]);
|
|
2081
2101
|
},
|
|
2082
2102
|
children: /* @__PURE__ */ Z(be, { className: "h-4 w-4" })
|
|
2083
2103
|
})
|
|
2084
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2104
|
+
}), /* @__PURE__ */ Z(H, { children: W("detail.nextRecord") })] })
|
|
2085
2105
|
]
|
|
2086
2106
|
}),
|
|
2087
|
-
c && /* @__PURE__ */ Q(
|
|
2107
|
+
c && /* @__PURE__ */ Q(Et, { children: [T && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2088
2108
|
asChild: !0,
|
|
2089
2109
|
children: /* @__PURE__ */ Q(x, {
|
|
2090
2110
|
variant: "ghost",
|
|
@@ -2093,74 +2113,74 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2093
2113
|
className: "gap-2 hidden sm:inline-flex",
|
|
2094
2114
|
children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2095
2115
|
className: "hidden sm:inline",
|
|
2096
|
-
children:
|
|
2116
|
+
children: W("detail.cancel")
|
|
2097
2117
|
})]
|
|
2098
2118
|
})
|
|
2099
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2119
|
+
}), /* @__PURE__ */ Z(H, { children: W("detail.cancelEdit") })] }), /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2100
2120
|
asChild: !0,
|
|
2101
2121
|
children: /* @__PURE__ */ Z(x, {
|
|
2102
2122
|
variant: T ? "default" : "outline",
|
|
2103
2123
|
size: "sm",
|
|
2104
2124
|
onClick: Ce,
|
|
2105
2125
|
className: "gap-2 hidden sm:inline-flex",
|
|
2106
|
-
children: T ? /* @__PURE__ */ Q(
|
|
2126
|
+
children: T ? /* @__PURE__ */ Q(Et, { children: [/* @__PURE__ */ Z(ge, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2107
2127
|
className: "hidden sm:inline",
|
|
2108
|
-
children:
|
|
2109
|
-
})] }) : /* @__PURE__ */ Q(
|
|
2128
|
+
children: W("detail.save")
|
|
2129
|
+
})] }) : /* @__PURE__ */ Q(Et, { children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2110
2130
|
className: "hidden sm:inline",
|
|
2111
|
-
children:
|
|
2131
|
+
children: W("detail.editInline")
|
|
2112
2132
|
})] })
|
|
2113
2133
|
})
|
|
2114
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2115
|
-
|
|
2134
|
+
}), /* @__PURE__ */ Z(H, { children: W(T ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
|
|
2135
|
+
K.showEdit && /* @__PURE__ */ Q(V, { children: [/* @__PURE__ */ Z(U, {
|
|
2116
2136
|
asChild: !0,
|
|
2117
2137
|
children: /* @__PURE__ */ Q(x, {
|
|
2118
2138
|
variant: "default",
|
|
2119
2139
|
onClick: he,
|
|
2120
2140
|
className: "gap-2 hidden sm:inline-flex",
|
|
2121
|
-
children: [/* @__PURE__ */ Z(
|
|
2141
|
+
children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2122
2142
|
className: "hidden sm:inline",
|
|
2123
|
-
children:
|
|
2143
|
+
children: W("detail.edit")
|
|
2124
2144
|
})]
|
|
2125
2145
|
})
|
|
2126
|
-
}), /* @__PURE__ */ Z(H, { children:
|
|
2127
|
-
|
|
2146
|
+
}), /* @__PURE__ */ Z(H, { children: W("detail.editRecord") })] }),
|
|
2147
|
+
ke.map((e, t) => /* @__PURE__ */ Z(at, {
|
|
2128
2148
|
schema: e,
|
|
2129
2149
|
data: g
|
|
2130
2150
|
}, `header-action-${t}`))
|
|
2131
2151
|
]
|
|
2132
2152
|
})]
|
|
2133
2153
|
}),
|
|
2134
|
-
|
|
2135
|
-
schema:
|
|
2154
|
+
K.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(at, {
|
|
2155
|
+
schema: K.header,
|
|
2136
2156
|
data: g
|
|
2137
2157
|
}) }),
|
|
2138
|
-
|
|
2139
|
-
fields:
|
|
2158
|
+
K.highlightFields && K.highlightFields.length > 0 && /* @__PURE__ */ Z(Yt, {
|
|
2159
|
+
fields: K.highlightFields,
|
|
2140
2160
|
data: g,
|
|
2141
|
-
objectName:
|
|
2161
|
+
objectName: K.objectName,
|
|
2142
2162
|
objectSchema: N
|
|
2143
2163
|
}),
|
|
2144
|
-
c &&
|
|
2164
|
+
c && K.showHeader === !1 && (() => {
|
|
2145
2165
|
let e = g?.approval_status, t = e === "pending" || e === "in_approval";
|
|
2146
2166
|
return !T && !k && !j && !t ? null : /* @__PURE__ */ Q("div", {
|
|
2147
2167
|
className: "flex flex-col items-end gap-1",
|
|
2148
2168
|
children: [/* @__PURE__ */ Q("div", {
|
|
2149
2169
|
className: "flex items-center justify-end gap-2",
|
|
2150
2170
|
children: [
|
|
2151
|
-
t && !T && /* @__PURE__ */ Q(
|
|
2171
|
+
t && !T && /* @__PURE__ */ Q(Et, { children: [/* @__PURE__ */ Q("span", {
|
|
2152
2172
|
role: "status",
|
|
2153
2173
|
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(
|
|
2174
|
+
title: W("detail.lockedTooltip"),
|
|
2175
|
+
children: [/* @__PURE__ */ Z(Re, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: W("detail.lockedByApproval") })]
|
|
2156
2176
|
}), n?.cancelPendingApproval && /* @__PURE__ */ Q(x, {
|
|
2157
2177
|
variant: "outline",
|
|
2158
2178
|
size: "sm",
|
|
2159
2179
|
onClick: _e,
|
|
2160
|
-
disabled:
|
|
2180
|
+
disabled: P,
|
|
2161
2181
|
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:
|
|
2182
|
+
title: W("detail.cancelApprovalTooltip"),
|
|
2183
|
+
children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: W(P ? "detail.cancelApprovalInFlight" : "detail.cancelApproval") })]
|
|
2164
2184
|
})] }),
|
|
2165
2185
|
T && /* @__PURE__ */ Q(x, {
|
|
2166
2186
|
variant: "ghost",
|
|
@@ -2168,7 +2188,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2168
2188
|
onClick: we,
|
|
2169
2189
|
className: "gap-2",
|
|
2170
2190
|
disabled: k,
|
|
2171
|
-
children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children:
|
|
2191
|
+
children: [/* @__PURE__ */ Z(nt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: W("detail.cancel") })]
|
|
2172
2192
|
}),
|
|
2173
2193
|
/* @__PURE__ */ Q(x, {
|
|
2174
2194
|
variant: T ? "default" : "outline",
|
|
@@ -2176,8 +2196,8 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2176
2196
|
onClick: Ce,
|
|
2177
2197
|
className: "gap-2",
|
|
2178
2198
|
disabled: k || t && !T,
|
|
2179
|
-
title: t && !T ?
|
|
2180
|
-
children: [Z(T ? ge :
|
|
2199
|
+
title: t && !T ? W("detail.lockedTooltip") : void 0,
|
|
2200
|
+
children: [Z(T ? ge : Ee, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: W(k ? "detail.saving" : T ? "detail.save" : "detail.editFieldsInline") })]
|
|
2181
2201
|
})
|
|
2182
2202
|
]
|
|
2183
2203
|
}), j && /* @__PURE__ */ Z("div", {
|
|
@@ -2187,79 +2207,79 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2187
2207
|
})]
|
|
2188
2208
|
});
|
|
2189
2209
|
})(),
|
|
2190
|
-
|
|
2191
|
-
let e =
|
|
2210
|
+
K.autoTabs && !K.tabs?.length ? (() => {
|
|
2211
|
+
let e = Oe.length > 0, t = !!K.activities && K.activities.length > 0, r = !!u, i = !!K.history, a = /* @__PURE__ */ Q("div", {
|
|
2192
2212
|
className: "space-y-3 sm:space-y-4",
|
|
2193
2213
|
children: [
|
|
2194
|
-
|
|
2214
|
+
K.sectionGroups && K.sectionGroups.length > 0 && K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Jt, {
|
|
2195
2215
|
group: e,
|
|
2196
2216
|
data: {
|
|
2197
2217
|
...g,
|
|
2198
2218
|
...D
|
|
2199
2219
|
},
|
|
2200
2220
|
objectSchema: N,
|
|
2201
|
-
objectName:
|
|
2221
|
+
objectName: K.objectName,
|
|
2202
2222
|
isEditing: T,
|
|
2203
|
-
onFieldChange:
|
|
2223
|
+
onFieldChange: De,
|
|
2204
2224
|
dataSource: n
|
|
2205
2225
|
}, t)),
|
|
2206
|
-
|
|
2226
|
+
K.sections && K.sections.length > 0 && K.sections.map((e, t) => /* @__PURE__ */ Z(Wt, {
|
|
2207
2227
|
section: e,
|
|
2208
2228
|
data: {
|
|
2209
2229
|
...g,
|
|
2210
2230
|
...D
|
|
2211
2231
|
},
|
|
2212
2232
|
objectSchema: N,
|
|
2213
|
-
objectName:
|
|
2233
|
+
objectName: K.objectName,
|
|
2214
2234
|
isEditing: T,
|
|
2215
|
-
onFieldChange:
|
|
2235
|
+
onFieldChange: De,
|
|
2216
2236
|
dataSource: n
|
|
2217
2237
|
}, t)),
|
|
2218
|
-
|
|
2238
|
+
K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(Wt, {
|
|
2219
2239
|
section: {
|
|
2220
|
-
fields:
|
|
2221
|
-
columns:
|
|
2240
|
+
fields: K.fields,
|
|
2241
|
+
columns: K.columns
|
|
2222
2242
|
},
|
|
2223
2243
|
data: {
|
|
2224
2244
|
...g,
|
|
2225
2245
|
...D
|
|
2226
2246
|
},
|
|
2227
2247
|
objectSchema: N,
|
|
2228
|
-
objectName:
|
|
2248
|
+
objectName: K.objectName,
|
|
2229
2249
|
isEditing: T,
|
|
2230
|
-
onFieldChange:
|
|
2250
|
+
onFieldChange: De,
|
|
2231
2251
|
dataSource: n
|
|
2232
2252
|
}),
|
|
2233
|
-
|
|
2234
|
-
comments:
|
|
2235
|
-
onAddComment:
|
|
2253
|
+
K.comments && /* @__PURE__ */ Z(Zt, {
|
|
2254
|
+
comments: K.comments,
|
|
2255
|
+
onAddComment: K.onAddComment
|
|
2236
2256
|
})
|
|
2237
2257
|
]
|
|
2238
2258
|
});
|
|
2239
2259
|
return !e && !t && !r && !i ? /* @__PURE__ */ Z("div", {
|
|
2240
2260
|
className: "mt-2",
|
|
2241
2261
|
children: a
|
|
2242
|
-
}) : /* @__PURE__ */ Q(
|
|
2262
|
+
}) : /* @__PURE__ */ Q(L, {
|
|
2243
2263
|
defaultValue: "details",
|
|
2244
2264
|
className: "w-full",
|
|
2245
2265
|
children: [
|
|
2246
|
-
/* @__PURE__ */ Q(
|
|
2266
|
+
/* @__PURE__ */ Q(z, {
|
|
2247
2267
|
className: "w-full justify-start border-b rounded-none bg-transparent p-0",
|
|
2248
2268
|
children: [
|
|
2249
2269
|
/* @__PURE__ */ Z(B, {
|
|
2250
2270
|
value: "details",
|
|
2251
2271
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2252
|
-
children:
|
|
2272
|
+
children: W("detail.details")
|
|
2253
2273
|
}),
|
|
2254
2274
|
e && /* @__PURE__ */ Z(B, {
|
|
2255
2275
|
value: "related",
|
|
2256
2276
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2257
2277
|
children: /* @__PURE__ */ Q("span", {
|
|
2258
2278
|
className: "flex items-center gap-1.5",
|
|
2259
|
-
children: [
|
|
2279
|
+
children: [W("detail.related"), /* @__PURE__ */ Z(b, {
|
|
2260
2280
|
variant: "secondary",
|
|
2261
2281
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2262
|
-
children:
|
|
2282
|
+
children: Oe.length
|
|
2263
2283
|
})]
|
|
2264
2284
|
})
|
|
2265
2285
|
}),
|
|
@@ -2268,43 +2288,43 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2268
2288
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2269
2289
|
children: /* @__PURE__ */ Q("span", {
|
|
2270
2290
|
className: "flex items-center gap-1.5",
|
|
2271
|
-
children: [
|
|
2291
|
+
children: [W("detail.activity"), /* @__PURE__ */ Z(b, {
|
|
2272
2292
|
variant: "secondary",
|
|
2273
2293
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2274
|
-
children:
|
|
2294
|
+
children: K.activities.length
|
|
2275
2295
|
})]
|
|
2276
2296
|
})
|
|
2277
2297
|
}),
|
|
2278
2298
|
r && /* @__PURE__ */ Z(B, {
|
|
2279
2299
|
value: "discussion",
|
|
2280
2300
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2281
|
-
children:
|
|
2301
|
+
children: W("detail.discussion", { defaultValue: "Discussion" })
|
|
2282
2302
|
}),
|
|
2283
2303
|
i && /* @__PURE__ */ Z(B, {
|
|
2284
2304
|
value: "history",
|
|
2285
2305
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2286
2306
|
children: /* @__PURE__ */ Q("span", {
|
|
2287
2307
|
className: "flex items-center gap-1.5",
|
|
2288
|
-
children: [
|
|
2308
|
+
children: [W("detail.history", { defaultValue: "History" }), !K.history.loading && K.history.entries.length > 0 && /* @__PURE__ */ Z(b, {
|
|
2289
2309
|
variant: "secondary",
|
|
2290
2310
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2291
|
-
children:
|
|
2311
|
+
children: K.history.entries.length
|
|
2292
2312
|
})]
|
|
2293
2313
|
})
|
|
2294
2314
|
})
|
|
2295
2315
|
]
|
|
2296
2316
|
}),
|
|
2297
|
-
/* @__PURE__ */ Z(
|
|
2317
|
+
/* @__PURE__ */ Z(R, {
|
|
2298
2318
|
value: "details",
|
|
2299
2319
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2300
2320
|
children: a
|
|
2301
2321
|
}),
|
|
2302
|
-
e && /* @__PURE__ */ Z(
|
|
2322
|
+
e && /* @__PURE__ */ Z(R, {
|
|
2303
2323
|
value: "related",
|
|
2304
2324
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2305
2325
|
children: /* @__PURE__ */ Z("div", {
|
|
2306
2326
|
className: "space-y-3",
|
|
2307
|
-
children:
|
|
2327
|
+
children: Oe.map((e, t) => /* @__PURE__ */ Z(qt, {
|
|
2308
2328
|
title: e.title,
|
|
2309
2329
|
type: e.type,
|
|
2310
2330
|
api: e.api,
|
|
@@ -2320,88 +2340,88 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2320
2340
|
onRowEdit: e.onRowEdit,
|
|
2321
2341
|
onRowDelete: e.onRowDelete,
|
|
2322
2342
|
collapsible: !0,
|
|
2323
|
-
defaultCollapsed:
|
|
2324
|
-
pageSize:
|
|
2343
|
+
defaultCollapsed: ue && t > 0,
|
|
2344
|
+
pageSize: yn
|
|
2325
2345
|
}, t))
|
|
2326
2346
|
})
|
|
2327
2347
|
}),
|
|
2328
|
-
t && /* @__PURE__ */ Z(
|
|
2348
|
+
t && /* @__PURE__ */ Z(R, {
|
|
2329
2349
|
value: "activity",
|
|
2330
2350
|
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(
|
|
2351
|
+
children: /* @__PURE__ */ Z(rn, { activities: K.activities })
|
|
2332
2352
|
}),
|
|
2333
|
-
r && /* @__PURE__ */ Z(
|
|
2353
|
+
r && /* @__PURE__ */ Z(R, {
|
|
2334
2354
|
value: "discussion",
|
|
2335
2355
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2336
2356
|
children: u
|
|
2337
2357
|
}),
|
|
2338
|
-
i && /* @__PURE__ */ Z(
|
|
2358
|
+
i && /* @__PURE__ */ Z(R, {
|
|
2339
2359
|
value: "history",
|
|
2340
2360
|
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(
|
|
2342
|
-
entries:
|
|
2343
|
-
loading:
|
|
2344
|
-
emptyText:
|
|
2361
|
+
children: /* @__PURE__ */ Z(dn, {
|
|
2362
|
+
entries: K.history.entries,
|
|
2363
|
+
loading: K.history.loading,
|
|
2364
|
+
emptyText: K.history.emptyText ?? W("detail.historyEmpty", { defaultValue: "No history yet" })
|
|
2345
2365
|
})
|
|
2346
2366
|
})
|
|
2347
2367
|
]
|
|
2348
2368
|
});
|
|
2349
|
-
})() : /* @__PURE__ */ Q(
|
|
2350
|
-
|
|
2369
|
+
})() : /* @__PURE__ */ Q(Et, { children: [
|
|
2370
|
+
K.sectionGroups && K.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2351
2371
|
className: "space-y-3 sm:space-y-4",
|
|
2352
|
-
children:
|
|
2372
|
+
children: K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Jt, {
|
|
2353
2373
|
group: e,
|
|
2354
2374
|
data: {
|
|
2355
2375
|
...g,
|
|
2356
2376
|
...D
|
|
2357
2377
|
},
|
|
2358
2378
|
objectSchema: N,
|
|
2359
|
-
objectName:
|
|
2379
|
+
objectName: K.objectName,
|
|
2360
2380
|
isEditing: T,
|
|
2361
|
-
onFieldChange:
|
|
2381
|
+
onFieldChange: De,
|
|
2362
2382
|
dataSource: n
|
|
2363
2383
|
}, t))
|
|
2364
2384
|
}),
|
|
2365
|
-
|
|
2385
|
+
K.sections && K.sections.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2366
2386
|
className: "space-y-3 sm:space-y-4",
|
|
2367
|
-
children:
|
|
2387
|
+
children: K.sections.map((e, t) => /* @__PURE__ */ Z(Wt, {
|
|
2368
2388
|
section: e,
|
|
2369
2389
|
data: {
|
|
2370
2390
|
...g,
|
|
2371
2391
|
...D
|
|
2372
2392
|
},
|
|
2373
2393
|
objectSchema: N,
|
|
2374
|
-
objectName:
|
|
2394
|
+
objectName: K.objectName,
|
|
2375
2395
|
isEditing: T,
|
|
2376
|
-
onFieldChange:
|
|
2396
|
+
onFieldChange: De,
|
|
2377
2397
|
dataSource: n
|
|
2378
2398
|
}, t))
|
|
2379
2399
|
}),
|
|
2380
|
-
|
|
2400
|
+
K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(Wt, {
|
|
2381
2401
|
section: {
|
|
2382
|
-
fields:
|
|
2383
|
-
columns:
|
|
2402
|
+
fields: K.fields,
|
|
2403
|
+
columns: K.columns
|
|
2384
2404
|
},
|
|
2385
2405
|
data: {
|
|
2386
2406
|
...g,
|
|
2387
2407
|
...D
|
|
2388
2408
|
},
|
|
2389
2409
|
objectSchema: N,
|
|
2390
|
-
objectName:
|
|
2410
|
+
objectName: K.objectName,
|
|
2391
2411
|
isEditing: T,
|
|
2392
|
-
onFieldChange:
|
|
2412
|
+
onFieldChange: De,
|
|
2393
2413
|
dataSource: n
|
|
2394
2414
|
}),
|
|
2395
|
-
|
|
2396
|
-
tabs:
|
|
2415
|
+
K.tabs && K.tabs.length > 0 && /* @__PURE__ */ Z(Gt, {
|
|
2416
|
+
tabs: K.tabs,
|
|
2397
2417
|
data: g
|
|
2398
2418
|
}),
|
|
2399
|
-
|
|
2419
|
+
Oe.length > 0 && /* @__PURE__ */ Q("div", {
|
|
2400
2420
|
className: "space-y-3",
|
|
2401
2421
|
children: [/* @__PURE__ */ Z("h2", {
|
|
2402
2422
|
className: "text-lg font-semibold",
|
|
2403
|
-
children:
|
|
2404
|
-
}),
|
|
2423
|
+
children: W("detail.related")
|
|
2424
|
+
}), Oe.map((e, t) => /* @__PURE__ */ Z(qt, {
|
|
2405
2425
|
title: e.title,
|
|
2406
2426
|
type: e.type,
|
|
2407
2427
|
api: e.api,
|
|
@@ -2417,31 +2437,31 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2417
2437
|
onRowEdit: e.onRowEdit,
|
|
2418
2438
|
onRowDelete: e.onRowDelete,
|
|
2419
2439
|
collapsible: !0,
|
|
2420
|
-
defaultCollapsed:
|
|
2421
|
-
pageSize:
|
|
2440
|
+
defaultCollapsed: ue && t > 0,
|
|
2441
|
+
pageSize: yn
|
|
2422
2442
|
}, t))]
|
|
2423
2443
|
}),
|
|
2424
|
-
|
|
2425
|
-
comments:
|
|
2426
|
-
onAddComment:
|
|
2444
|
+
K.comments && /* @__PURE__ */ Z(Zt, {
|
|
2445
|
+
comments: K.comments,
|
|
2446
|
+
onAddComment: K.onAddComment
|
|
2427
2447
|
}),
|
|
2428
|
-
|
|
2448
|
+
K.activities && K.activities.length > 0 && /* @__PURE__ */ Z(rn, { activities: K.activities })
|
|
2429
2449
|
] }),
|
|
2430
|
-
/* @__PURE__ */ Z(
|
|
2450
|
+
/* @__PURE__ */ Z(vn, {
|
|
2431
2451
|
data: {
|
|
2432
2452
|
...g,
|
|
2433
2453
|
...D
|
|
2434
2454
|
},
|
|
2435
2455
|
objectSchema: N,
|
|
2436
|
-
objectName:
|
|
2456
|
+
objectName: K.objectName
|
|
2437
2457
|
}),
|
|
2438
|
-
|
|
2439
|
-
schema:
|
|
2458
|
+
K.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(at, {
|
|
2459
|
+
schema: K.footer,
|
|
2440
2460
|
data: g
|
|
2441
2461
|
}) })
|
|
2442
2462
|
]
|
|
2443
2463
|
}) });
|
|
2444
|
-
},
|
|
2464
|
+
}, Sn = (e) => {
|
|
2445
2465
|
if (e == null) return "—";
|
|
2446
2466
|
if (typeof e == "string") return e.length > 0 ? e : "\"\"";
|
|
2447
2467
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -2450,7 +2470,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2450
2470
|
} catch {
|
|
2451
2471
|
return String(e);
|
|
2452
2472
|
}
|
|
2453
|
-
},
|
|
2473
|
+
}, Cn = (e) => {
|
|
2454
2474
|
if (typeof e != "string" || e.length === 0) return null;
|
|
2455
2475
|
let t = /\d{4}-\d{2}-\d{2}[ T]/.test(e) ? e.replace(" ", "T") : e, n = new Date(t);
|
|
2456
2476
|
if (Number.isNaN(n.getTime())) return null;
|
|
@@ -2459,13 +2479,13 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2459
2479
|
} catch {
|
|
2460
2480
|
return n.toISOString();
|
|
2461
2481
|
}
|
|
2462
|
-
},
|
|
2463
|
-
let { t: o } = $(), s = t?.label || t?.field || "", l = t ?
|
|
2482
|
+
}, wn = ({ open: e, conflict: t, onReload: n, onOverwrite: r, onCancel: i, busy: a = !1 }) => {
|
|
2483
|
+
let { t: o } = $(), s = t?.label || t?.field || "", l = t ? Sn(t.pendingValue) : "", u = t ? Sn(t.currentValue) : "", g = t?.currentRecord ?? {}, _ = (() => {
|
|
2464
2484
|
let e = [g.updated_by_name, g.updated_by_label];
|
|
2465
2485
|
for (let t of e) if (typeof t == "string" && t.length > 0) return t;
|
|
2466
2486
|
let t = g.updated_by;
|
|
2467
2487
|
return typeof t != "string" || t.length === 0 || t.length >= 16 && !/\s/.test(t) && /^[A-Za-z0-9_-]+$/.test(t) ? null : t;
|
|
2468
|
-
})(), v =
|
|
2488
|
+
})(), v = Cn(g.updated_at ?? t?.currentVersion), [y, b] = o("detail.concurrentUpdateDescription", { field: "{{field}}" }).split("{{field}}");
|
|
2469
2489
|
return /* @__PURE__ */ Z(c, {
|
|
2470
2490
|
open: e,
|
|
2471
2491
|
onOpenChange: (e) => {
|
|
@@ -2479,7 +2499,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2479
2499
|
children: [/* @__PURE__ */ Z("span", {
|
|
2480
2500
|
className: "inline-flex h-9 w-9 flex-none items-center justify-center rounded-full bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-300",
|
|
2481
2501
|
"aria-hidden": "true",
|
|
2482
|
-
children: /* @__PURE__ */ Z(
|
|
2502
|
+
children: /* @__PURE__ */ Z(ce, { className: "h-5 w-5" })
|
|
2483
2503
|
}), /* @__PURE__ */ Q("div", {
|
|
2484
2504
|
className: "flex-1",
|
|
2485
2505
|
children: [/* @__PURE__ */ Z(h, { children: o("detail.concurrentUpdateTitle") }), /* @__PURE__ */ Q(f, {
|
|
@@ -2534,14 +2554,14 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2534
2554
|
type: "button",
|
|
2535
2555
|
disabled: a,
|
|
2536
2556
|
onClick: i,
|
|
2537
|
-
className:
|
|
2557
|
+
className: G(W({ variant: "ghost" }), "mt-2 sm:mt-0"),
|
|
2538
2558
|
children: o("detail.concurrentUpdateCancel")
|
|
2539
2559
|
}),
|
|
2540
2560
|
/* @__PURE__ */ Z("button", {
|
|
2541
2561
|
type: "button",
|
|
2542
2562
|
disabled: a,
|
|
2543
2563
|
onClick: r,
|
|
2544
|
-
className:
|
|
2564
|
+
className: G(W({ variant: "outline" }), "mt-2 sm:mt-0 text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive"),
|
|
2545
2565
|
children: o("detail.concurrentUpdateOverwrite")
|
|
2546
2566
|
}),
|
|
2547
2567
|
/* @__PURE__ */ Z("button", {
|
|
@@ -2549,7 +2569,7 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2549
2569
|
disabled: a,
|
|
2550
2570
|
onClick: n,
|
|
2551
2571
|
autoFocus: !0,
|
|
2552
|
-
className:
|
|
2572
|
+
className: G(W({ variant: "default" }), "mt-2 sm:mt-0"),
|
|
2553
2573
|
children: o("detail.concurrentUpdateReload")
|
|
2554
2574
|
})
|
|
2555
2575
|
]
|
|
@@ -2558,14 +2578,14 @@ var yn = ({ schema: e, dataSource: n, className: r, onEdit: a, onDelete: o, onBa
|
|
|
2558
2578
|
})
|
|
2559
2579
|
});
|
|
2560
2580
|
};
|
|
2561
|
-
function
|
|
2581
|
+
function Tn(e) {
|
|
2562
2582
|
if (!e || typeof e != "object") return !1;
|
|
2563
2583
|
let t = e;
|
|
2564
2584
|
return t.code === "CONCURRENT_UPDATE" || t.name === "ConcurrentUpdateError";
|
|
2565
2585
|
}
|
|
2566
2586
|
//#endregion
|
|
2567
2587
|
//#region src/renderers/record-details.tsx
|
|
2568
|
-
var
|
|
2588
|
+
var En = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name) || null, Dn = (e) => {
|
|
2569
2589
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2570
2590
|
return {
|
|
2571
2591
|
designer: {
|
|
@@ -2575,8 +2595,8 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2575
2595
|
},
|
|
2576
2596
|
rest: i
|
|
2577
2597
|
};
|
|
2578
|
-
},
|
|
2579
|
-
let r = pt(), { designer: i } =
|
|
2598
|
+
}, On = ({ schema: e = {}, className: t, ...n }) => {
|
|
2599
|
+
let r = pt(), { designer: i } = Dn(n);
|
|
2580
2600
|
if (!r) return /* @__PURE__ */ Z("div", {
|
|
2581
2601
|
className: t,
|
|
2582
2602
|
"data-record-details-placeholder": !0,
|
|
@@ -2586,7 +2606,7 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2586
2606
|
children: "record:details — bind a record to preview"
|
|
2587
2607
|
})
|
|
2588
2608
|
});
|
|
2589
|
-
let o = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", s = r.objectName || "", c =
|
|
2609
|
+
let o = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", s = r.objectName || "", c = Ot(), { readableFields: l } = Dt(s), { sectionLabel: u } = gt(), d = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2590
2610
|
if (d.length > 0 && s && !d.every((e) => c.can(s, e))) return /* @__PURE__ */ Z("div", {
|
|
2591
2611
|
className: t,
|
|
2592
2612
|
...i,
|
|
@@ -2599,15 +2619,15 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2599
2619
|
});
|
|
2600
2620
|
let f = e.enforceFieldSecurity === !0, p = Array.isArray(e.redactFields) ? e.redactFields : [], m = (e) => {
|
|
2601
2621
|
if (!e || !f && p.length === 0) return e;
|
|
2602
|
-
let t = e.map(
|
|
2622
|
+
let t = e.map(En).filter((e) => !!e), n = new Set((f && s ? l(t) : t).filter((e) => !p.includes(e)));
|
|
2603
2623
|
return e.filter((e) => {
|
|
2604
|
-
let t =
|
|
2624
|
+
let t = En(e);
|
|
2605
2625
|
return t ? n.has(t) : !0;
|
|
2606
2626
|
});
|
|
2607
2627
|
}, h = (e) => typeof e == "string" ? { name: e } : e && typeof e == "object" && !e.name && e.field ? {
|
|
2608
2628
|
...e,
|
|
2609
2629
|
name: e.field
|
|
2610
|
-
} : e, g = (e) => Array.isArray(e) ? e.map(h) : e, _ = ut(), v = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e :
|
|
2630
|
+
} : e, g = (e) => Array.isArray(e) ? e.map(h) : e, _ = ut(), v = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e : En(e)).filter((e) => !!e));
|
|
2611
2631
|
for (let e of _) v.add(e);
|
|
2612
2632
|
let y = r.objectSchema, b = r.data ?? {}, x = [
|
|
2613
2633
|
y?.primaryField,
|
|
@@ -2623,7 +2643,7 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2623
2643
|
break;
|
|
2624
2644
|
}
|
|
2625
2645
|
let S = (e) => !e || v.size === 0 ? e : e.filter((e) => {
|
|
2626
|
-
let t =
|
|
2646
|
+
let t = En(e);
|
|
2627
2647
|
return t ? !v.has(t) : !0;
|
|
2628
2648
|
}), C = S(g(m(e.fields))), w = Array.isArray(e.sections) ? e.sections.map((e) => {
|
|
2629
2649
|
let t = e.title ?? e.label, n = e.name && s ? u(s, e.name, t ?? e.name) : t;
|
|
@@ -2651,7 +2671,7 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2651
2671
|
}
|
|
2652
2672
|
typeof r.refresh == "function" && await r.refresh();
|
|
2653
2673
|
} catch (n) {
|
|
2654
|
-
if (
|
|
2674
|
+
if (Tn(n)) {
|
|
2655
2675
|
let r = n.currentRecord ?? null;
|
|
2656
2676
|
throw D({
|
|
2657
2677
|
field: e,
|
|
@@ -2722,12 +2742,12 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2722
2742
|
return /* @__PURE__ */ Q("div", {
|
|
2723
2743
|
className: t,
|
|
2724
2744
|
...i,
|
|
2725
|
-
children: [/* @__PURE__ */ Z(
|
|
2745
|
+
children: [/* @__PURE__ */ Z(xn, {
|
|
2726
2746
|
schema: te,
|
|
2727
2747
|
dataSource: r.dataSource,
|
|
2728
2748
|
inlineEdit: T,
|
|
2729
2749
|
onFieldSave: j
|
|
2730
|
-
}), /* @__PURE__ */ Z(
|
|
2750
|
+
}), /* @__PURE__ */ Z(wn, {
|
|
2731
2751
|
open: !!E,
|
|
2732
2752
|
conflict: E,
|
|
2733
2753
|
busy: O,
|
|
@@ -2736,7 +2756,7 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2736
2756
|
onOverwrite: ee
|
|
2737
2757
|
})]
|
|
2738
2758
|
});
|
|
2739
|
-
},
|
|
2759
|
+
}, kn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name || e.key) || null, An = (e) => e?.id ?? e?._id ?? null, jn = (e) => {
|
|
2740
2760
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2741
2761
|
return {
|
|
2742
2762
|
designer: {
|
|
@@ -2746,12 +2766,12 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2746
2766
|
},
|
|
2747
2767
|
rest: i
|
|
2748
2768
|
};
|
|
2749
|
-
},
|
|
2750
|
-
let r = pt(), { designer: i } =
|
|
2751
|
-
name:
|
|
2752
|
-
label:
|
|
2753
|
-
}) :
|
|
2754
|
-
if (!
|
|
2769
|
+
}, Mn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2770
|
+
let r = pt(), { designer: i } = jn(n), o = gt(), s = e.objectName, c = s && o.objectLabel ? o.objectLabel({
|
|
2771
|
+
name: s,
|
|
2772
|
+
label: wt(s)
|
|
2773
|
+
}) : s ? wt(s) : "", l = e.title || c || "Related";
|
|
2774
|
+
if (!s) return /* @__PURE__ */ Z("div", {
|
|
2755
2775
|
className: t,
|
|
2756
2776
|
...i,
|
|
2757
2777
|
children: /* @__PURE__ */ Z("div", {
|
|
@@ -2759,8 +2779,17 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2759
2779
|
children: "record:related_list — missing objectName"
|
|
2760
2780
|
})
|
|
2761
2781
|
});
|
|
2762
|
-
let
|
|
2763
|
-
|
|
2782
|
+
let u = Ot(), { readableFields: d } = Dt(s), f = ht(), p = a.useMemo(() => f?.resolve({
|
|
2783
|
+
objectName: s,
|
|
2784
|
+
relationshipField: e.relationshipField,
|
|
2785
|
+
parentId: r?.recordId ?? null
|
|
2786
|
+
}) ?? null, [
|
|
2787
|
+
f,
|
|
2788
|
+
s,
|
|
2789
|
+
e.relationshipField,
|
|
2790
|
+
r?.recordId
|
|
2791
|
+
]), m = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2792
|
+
if (m.length > 0 && !m.every((e) => u.can(s, e))) return /* @__PURE__ */ Z("div", {
|
|
2764
2793
|
className: t,
|
|
2765
2794
|
...i,
|
|
2766
2795
|
role: "status",
|
|
@@ -2770,35 +2799,49 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2770
2799
|
children: "Insufficient permissions to view related list."
|
|
2771
2800
|
})
|
|
2772
2801
|
});
|
|
2773
|
-
let
|
|
2774
|
-
if (
|
|
2775
|
-
let e =
|
|
2776
|
-
|
|
2777
|
-
let n =
|
|
2802
|
+
let h = e.enforceFieldSecurity === !0, g = Array.isArray(e.redactFields) ? e.redactFields : [], _ = Array.isArray(e.columns) ? e.columns : [], v = _;
|
|
2803
|
+
if (h || g.length > 0) {
|
|
2804
|
+
let e = _.map(kn).filter((e) => !!e), t = new Set((h ? d(e) : e).filter((e) => !g.includes(e)));
|
|
2805
|
+
v = _.filter((e) => {
|
|
2806
|
+
let n = kn(e);
|
|
2778
2807
|
return n ? t.has(n) : !0;
|
|
2779
2808
|
});
|
|
2780
2809
|
}
|
|
2781
2810
|
return /* @__PURE__ */ Z("div", {
|
|
2782
2811
|
className: t,
|
|
2783
2812
|
...i,
|
|
2784
|
-
children: /* @__PURE__ */ Z(
|
|
2785
|
-
title:
|
|
2813
|
+
children: /* @__PURE__ */ Z(qt, {
|
|
2814
|
+
title: l,
|
|
2786
2815
|
type: "table",
|
|
2787
|
-
api:
|
|
2788
|
-
objectName:
|
|
2816
|
+
api: s,
|
|
2817
|
+
objectName: s,
|
|
2789
2818
|
referenceField: e.relationshipField,
|
|
2790
2819
|
parentId: r?.recordId,
|
|
2791
|
-
columns:
|
|
2820
|
+
columns: v,
|
|
2792
2821
|
pageSize: e.limit,
|
|
2793
2822
|
dataSource: r?.dataSource,
|
|
2794
2823
|
add: e.add,
|
|
2795
|
-
|
|
2824
|
+
rowActions: p?.rowActions,
|
|
2825
|
+
onRowAction: p?.onRowAction,
|
|
2826
|
+
onNew: p?.onCreate,
|
|
2827
|
+
onRowClick: p?.onView ? (e) => {
|
|
2828
|
+
let t = An(e);
|
|
2829
|
+
t != null && p.onView(t, e);
|
|
2830
|
+
} : void 0,
|
|
2831
|
+
onRowEdit: p?.onEdit ? (e) => {
|
|
2832
|
+
let t = An(e);
|
|
2833
|
+
t != null && p.onEdit(t, e);
|
|
2834
|
+
} : void 0,
|
|
2835
|
+
onRowDelete: p?.onDelete ? (e) => {
|
|
2836
|
+
let t = An(e);
|
|
2837
|
+
if (t != null) return p.onDelete(t, e);
|
|
2838
|
+
} : e.add && r?.dataSource ? async (e) => {
|
|
2796
2839
|
let t = e?.id ?? e?._id;
|
|
2797
|
-
t != null && await r.dataSource.delete?.(
|
|
2840
|
+
t != null && await r.dataSource.delete?.(s, String(t));
|
|
2798
2841
|
} : void 0
|
|
2799
2842
|
})
|
|
2800
2843
|
});
|
|
2801
|
-
},
|
|
2844
|
+
}, Nn = (e) => {
|
|
2802
2845
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2803
2846
|
return {
|
|
2804
2847
|
designer: {
|
|
@@ -2808,8 +2851,8 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2808
2851
|
},
|
|
2809
2852
|
rest: i
|
|
2810
2853
|
};
|
|
2811
|
-
},
|
|
2812
|
-
let r = pt(), { designer: i } =
|
|
2854
|
+
}, Pn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2855
|
+
let r = pt(), { designer: i } = Nn(n), o = r?.objectName || "", s = Ot(), { readableFields: c } = Dt(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2813
2856
|
if (l.length > 0 && o && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2814
2857
|
className: t,
|
|
2815
2858
|
...i,
|
|
@@ -2829,17 +2872,17 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2829
2872
|
return mt(a.useId(), m.map((e) => e.name)), /* @__PURE__ */ Z("div", {
|
|
2830
2873
|
className: t,
|
|
2831
2874
|
...i,
|
|
2832
|
-
children: /* @__PURE__ */ Z(
|
|
2875
|
+
children: /* @__PURE__ */ Z(Yt, {
|
|
2833
2876
|
fields: m,
|
|
2834
2877
|
data: r?.data,
|
|
2835
2878
|
objectName: r?.objectName,
|
|
2836
2879
|
objectSchema: r?.objectSchema
|
|
2837
2880
|
})
|
|
2838
2881
|
});
|
|
2839
|
-
},
|
|
2882
|
+
}, Fn = ({ change: e, className: t }) => {
|
|
2840
2883
|
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
2884
|
return /* @__PURE__ */ Q("div", {
|
|
2842
|
-
className:
|
|
2885
|
+
className: G("flex items-center gap-1.5 text-sm flex-wrap", t),
|
|
2843
2886
|
children: [
|
|
2844
2887
|
/* @__PURE__ */ Z("span", {
|
|
2845
2888
|
className: "font-medium text-foreground",
|
|
@@ -2849,29 +2892,29 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2849
2892
|
className: "text-muted-foreground line-through",
|
|
2850
2893
|
children: r
|
|
2851
2894
|
}),
|
|
2852
|
-
/* @__PURE__ */ Z(
|
|
2895
|
+
/* @__PURE__ */ Z(ue, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
2853
2896
|
/* @__PURE__ */ Z("span", {
|
|
2854
2897
|
className: "text-foreground",
|
|
2855
2898
|
children: i
|
|
2856
2899
|
})
|
|
2857
2900
|
]
|
|
2858
2901
|
});
|
|
2859
|
-
},
|
|
2902
|
+
}, In = [
|
|
2860
2903
|
"👍",
|
|
2861
2904
|
"❤️",
|
|
2862
2905
|
"🎉",
|
|
2863
2906
|
"😂",
|
|
2864
2907
|
"😮",
|
|
2865
2908
|
"😢"
|
|
2866
|
-
],
|
|
2909
|
+
], Ln = ({ reactions: e, onToggleReaction: t, emojiOptions: n = In, className: r }) => {
|
|
2867
2910
|
let [a, o] = i.useState(!1), s = i.useCallback((e) => {
|
|
2868
2911
|
t?.(e), o(!1);
|
|
2869
2912
|
}, [t]);
|
|
2870
2913
|
return /* @__PURE__ */ Q("div", {
|
|
2871
|
-
className:
|
|
2914
|
+
className: G("flex items-center gap-1 flex-wrap", r),
|
|
2872
2915
|
children: [e.map((e) => /* @__PURE__ */ Q("button", {
|
|
2873
2916
|
type: "button",
|
|
2874
|
-
className:
|
|
2917
|
+
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
2918
|
onClick: () => s(e.emoji),
|
|
2876
2919
|
disabled: !t,
|
|
2877
2920
|
"aria-label": `${e.emoji} ${e.count} reaction${e.count === 1 ? "" : "s"}`,
|
|
@@ -2903,7 +2946,7 @@ var wn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2903
2946
|
};
|
|
2904
2947
|
//#endregion
|
|
2905
2948
|
//#region src/ThreadedReplies.tsx
|
|
2906
|
-
function
|
|
2949
|
+
function Rn(e, t) {
|
|
2907
2950
|
try {
|
|
2908
2951
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
2909
2952
|
if (i < 1) return t("detail.justNow");
|
|
@@ -2916,7 +2959,7 @@ function Fn(e, t) {
|
|
|
2916
2959
|
return e;
|
|
2917
2960
|
}
|
|
2918
2961
|
}
|
|
2919
|
-
var
|
|
2962
|
+
var zn = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, className: a }) => {
|
|
2920
2963
|
let { t: o } = $(), [s, c] = i.useState(!1), [l, u] = i.useState(""), [d, f] = i.useState(!1), p = i.useCallback(async () => {
|
|
2921
2964
|
let t = l.trim();
|
|
2922
2965
|
if (!(!t || !n)) {
|
|
@@ -2935,7 +2978,7 @@ var In = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
2935
2978
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), p());
|
|
2936
2979
|
}, [p]);
|
|
2937
2980
|
return t.length === 0 && !r ? null : /* @__PURE__ */ Q("div", {
|
|
2938
|
-
className:
|
|
2981
|
+
className: G("ml-10 mt-1", a),
|
|
2939
2982
|
children: [
|
|
2940
2983
|
t.length > 0 && /* @__PURE__ */ Q("button", {
|
|
2941
2984
|
type: "button",
|
|
@@ -2944,7 +2987,7 @@ var In = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
2944
2987
|
"aria-expanded": s,
|
|
2945
2988
|
children: [
|
|
2946
2989
|
Z(s ? ve : be, { className: "h-3 w-3" }),
|
|
2947
|
-
/* @__PURE__ */ Z(
|
|
2990
|
+
/* @__PURE__ */ Z(X, { className: "h-3 w-3" }),
|
|
2948
2991
|
/* @__PURE__ */ Z("span", { children: t.length === 1 ? o("detail.replyCount", { count: t.length }) : o("detail.replyCountPlural", { count: t.length }) })
|
|
2949
2992
|
]
|
|
2950
2993
|
}),
|
|
@@ -2971,7 +3014,7 @@ var In = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
2971
3014
|
children: e.actor
|
|
2972
3015
|
}), /* @__PURE__ */ Z("span", {
|
|
2973
3016
|
className: "text-[10px] text-muted-foreground",
|
|
2974
|
-
children:
|
|
3017
|
+
children: Rn(e.createdAt, o)
|
|
2975
3018
|
})]
|
|
2976
3019
|
}), /* @__PURE__ */ Z("p", {
|
|
2977
3020
|
className: "text-xs whitespace-pre-wrap break-words",
|
|
@@ -3001,7 +3044,7 @@ var In = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3001
3044
|
})
|
|
3002
3045
|
]
|
|
3003
3046
|
});
|
|
3004
|
-
},
|
|
3047
|
+
}, Bn = ({ subscription: e, onToggle: t, className: n }) => {
|
|
3005
3048
|
let { t: r } = $(), [a, o] = i.useState(!1), s = i.useCallback(async () => {
|
|
3006
3049
|
if (t) {
|
|
3007
3050
|
o(!0);
|
|
@@ -3015,7 +3058,7 @@ var In = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3015
3058
|
return /* @__PURE__ */ Z(x, {
|
|
3016
3059
|
variant: "ghost",
|
|
3017
3060
|
size: "icon",
|
|
3018
|
-
className:
|
|
3061
|
+
className: G("h-8 w-8", n),
|
|
3019
3062
|
onClick: s,
|
|
3020
3063
|
disabled: a || !t,
|
|
3021
3064
|
"aria-label": e.subscribed ? r("detail.unsubscribeAriaLabel") : r("detail.subscribeAriaLabel"),
|
|
@@ -3025,11 +3068,11 @@ var In = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3025
3068
|
};
|
|
3026
3069
|
//#endregion
|
|
3027
3070
|
//#region src/RichTextCommentInput.tsx
|
|
3028
|
-
function
|
|
3071
|
+
function Vn(e) {
|
|
3029
3072
|
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
3073
|
return t = t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g, (e) => `<ul class="my-1">${e.replace(/<br\/>/g, "")}</ul>`), t;
|
|
3031
3074
|
}
|
|
3032
|
-
var
|
|
3075
|
+
var Hn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], placeholder: a, className: o, disabled: s = !1, extraSlot: c, canSubmitEmpty: l = !1 }) => {
|
|
3033
3076
|
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
3077
|
if (!h) return r;
|
|
3035
3078
|
let e = h.toLowerCase();
|
|
@@ -3090,7 +3133,7 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3090
3133
|
n
|
|
3091
3134
|
]);
|
|
3092
3135
|
return /* @__PURE__ */ Q("div", {
|
|
3093
|
-
className:
|
|
3136
|
+
className: G("border rounded-md", o),
|
|
3094
3137
|
children: [
|
|
3095
3138
|
/* @__PURE__ */ Q("div", {
|
|
3096
3139
|
className: "flex items-center gap-0.5 px-2 py-1.5 border-b bg-muted/30",
|
|
@@ -3111,7 +3154,7 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3111
3154
|
onClick: w,
|
|
3112
3155
|
disabled: s || d,
|
|
3113
3156
|
title: u("detail.italic"),
|
|
3114
|
-
children: /* @__PURE__ */ Z(
|
|
3157
|
+
children: /* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" })
|
|
3115
3158
|
}),
|
|
3116
3159
|
/* @__PURE__ */ Z(x, {
|
|
3117
3160
|
variant: "ghost",
|
|
@@ -3120,7 +3163,7 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3120
3163
|
onClick: T,
|
|
3121
3164
|
disabled: s || d,
|
|
3122
3165
|
title: u("detail.listFormat"),
|
|
3123
|
-
children: /* @__PURE__ */ Z(
|
|
3166
|
+
children: /* @__PURE__ */ Z(Ie, { className: "h-3.5 w-3.5" })
|
|
3124
3167
|
}),
|
|
3125
3168
|
/* @__PURE__ */ Z(x, {
|
|
3126
3169
|
variant: "ghost",
|
|
@@ -3138,7 +3181,7 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3138
3181
|
onClick: D,
|
|
3139
3182
|
disabled: s || d,
|
|
3140
3183
|
title: u("detail.mentionSomeone"),
|
|
3141
|
-
children: /* @__PURE__ */ Z(
|
|
3184
|
+
children: /* @__PURE__ */ Z(q, { className: "h-3.5 w-3.5" })
|
|
3142
3185
|
}),
|
|
3143
3186
|
/* @__PURE__ */ Z("div", { className: "flex-1" }),
|
|
3144
3187
|
/* @__PURE__ */ Z(x, {
|
|
@@ -3147,7 +3190,7 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3147
3190
|
className: "h-7 w-7",
|
|
3148
3191
|
onClick: () => f(!d),
|
|
3149
3192
|
title: u(d ? "detail.edit" : "detail.preview"),
|
|
3150
|
-
children: Z(d ?
|
|
3193
|
+
children: Z(d ? Ee : Oe, { className: "h-3.5 w-3.5" })
|
|
3151
3194
|
}),
|
|
3152
3195
|
n && /* @__PURE__ */ Z(x, {
|
|
3153
3196
|
variant: "ghost",
|
|
@@ -3164,8 +3207,8 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3164
3207
|
className: "relative",
|
|
3165
3208
|
children: d ? /* @__PURE__ */ Z("div", {
|
|
3166
3209
|
className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
|
|
3167
|
-
dangerouslySetInnerHTML: { __html:
|
|
3168
|
-
}) : /* @__PURE__ */ Q(
|
|
3210
|
+
dangerouslySetInnerHTML: { __html: Vn(e) }
|
|
3211
|
+
}) : /* @__PURE__ */ Q(Et, { children: [/* @__PURE__ */ Z("textarea", {
|
|
3169
3212
|
ref: y,
|
|
3170
3213
|
className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
|
|
3171
3214
|
placeholder: a ?? u("detail.writeComment"),
|
|
@@ -3177,7 +3220,7 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3177
3220
|
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
3221
|
children: b.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
3179
3222
|
type: "button",
|
|
3180
|
-
className:
|
|
3223
|
+
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
3224
|
onMouseDown: (t) => {
|
|
3182
3225
|
t.preventDefault(), O(e);
|
|
3183
3226
|
},
|
|
@@ -3201,16 +3244,16 @@ var zn = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3201
3244
|
};
|
|
3202
3245
|
//#endregion
|
|
3203
3246
|
//#region src/CommentAttachment.tsx
|
|
3204
|
-
function
|
|
3247
|
+
function Un(e) {
|
|
3205
3248
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
3206
3249
|
}
|
|
3207
|
-
function
|
|
3250
|
+
function Wn(e) {
|
|
3208
3251
|
return e.startsWith("image/");
|
|
3209
3252
|
}
|
|
3210
|
-
function
|
|
3211
|
-
return
|
|
3253
|
+
function Gn(e) {
|
|
3254
|
+
return Wn(e) ? Me : e.includes("pdf") || e.includes("document") || e.includes("text") ? je : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? Ae : ke;
|
|
3212
3255
|
}
|
|
3213
|
-
var
|
|
3256
|
+
var Kn = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a = !1 }) => {
|
|
3214
3257
|
let { t: o } = $(), [s, c] = i.useState(!1), l = i.useRef(null), u = i.useCallback((e) => {
|
|
3215
3258
|
e.preventDefault(), e.stopPropagation(), c(!0);
|
|
3216
3259
|
}, []), d = i.useCallback((e) => {
|
|
@@ -3221,9 +3264,9 @@ var Un = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3221
3264
|
t && e.target.files && e.target.files.length > 0 && (t(e.target.files), e.target.value = "");
|
|
3222
3265
|
}, [t]);
|
|
3223
3266
|
return /* @__PURE__ */ Q("div", {
|
|
3224
|
-
className:
|
|
3267
|
+
className: G("space-y-2", r),
|
|
3225
3268
|
children: [t && !a && /* @__PURE__ */ Q("div", {
|
|
3226
|
-
className:
|
|
3269
|
+
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
3270
|
onDragOver: u,
|
|
3228
3271
|
onDragLeave: d,
|
|
3229
3272
|
onDrop: f,
|
|
@@ -3255,7 +3298,7 @@ var Un = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3255
3298
|
}), /* @__PURE__ */ Z("div", {
|
|
3256
3299
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
|
|
3257
3300
|
children: e.map((e) => {
|
|
3258
|
-
let t =
|
|
3301
|
+
let t = Wn(e.type), r = Gn(e.type);
|
|
3259
3302
|
return /* @__PURE__ */ Q("div", {
|
|
3260
3303
|
className: "flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group",
|
|
3261
3304
|
children: [
|
|
@@ -3274,7 +3317,7 @@ var Un = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3274
3317
|
children: e.name
|
|
3275
3318
|
}), /* @__PURE__ */ Z("p", {
|
|
3276
3319
|
className: "text-[10px] text-muted-foreground",
|
|
3277
|
-
children:
|
|
3320
|
+
children: Un(e.size)
|
|
3278
3321
|
})]
|
|
3279
3322
|
}),
|
|
3280
3323
|
n && !a && /* @__PURE__ */ Z(x, {
|
|
@@ -3291,15 +3334,15 @@ var Un = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3291
3334
|
})]
|
|
3292
3335
|
})]
|
|
3293
3336
|
});
|
|
3294
|
-
},
|
|
3295
|
-
comment:
|
|
3296
|
-
field_change:
|
|
3337
|
+
}, qn = {
|
|
3338
|
+
comment: X,
|
|
3339
|
+
field_change: Ee,
|
|
3297
3340
|
task: _e,
|
|
3298
3341
|
event: he,
|
|
3299
3342
|
system: rt,
|
|
3300
|
-
email:
|
|
3343
|
+
email: ze,
|
|
3301
3344
|
call: We
|
|
3302
|
-
},
|
|
3345
|
+
}, Jn = {
|
|
3303
3346
|
comment: "bg-purple-100 text-purple-600",
|
|
3304
3347
|
field_change: "bg-blue-100 text-blue-600",
|
|
3305
3348
|
task: "bg-green-100 text-green-600",
|
|
@@ -3308,7 +3351,7 @@ var Un = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: a
|
|
|
3308
3351
|
email: "bg-indigo-100 text-indigo-600",
|
|
3309
3352
|
call: "bg-teal-100 text-teal-600"
|
|
3310
3353
|
};
|
|
3311
|
-
function
|
|
3354
|
+
function Yn(e) {
|
|
3312
3355
|
return [
|
|
3313
3356
|
{
|
|
3314
3357
|
value: "all",
|
|
@@ -3328,7 +3371,7 @@ function Kn(e) {
|
|
|
3328
3371
|
}
|
|
3329
3372
|
];
|
|
3330
3373
|
}
|
|
3331
|
-
function
|
|
3374
|
+
function Xn(e, t) {
|
|
3332
3375
|
try {
|
|
3333
3376
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
3334
3377
|
if (i < 1) return t("detail.justNow");
|
|
@@ -3341,7 +3384,7 @@ function qn(e, t) {
|
|
|
3341
3384
|
return e;
|
|
3342
3385
|
}
|
|
3343
3386
|
}
|
|
3344
|
-
function
|
|
3387
|
+
function Zn(e, t) {
|
|
3345
3388
|
switch (t) {
|
|
3346
3389
|
case "comments_only": return e.filter((e) => e.type === "comment");
|
|
3347
3390
|
case "changes_only": return e.filter((e) => e.type === "field_change");
|
|
@@ -3349,18 +3392,18 @@ function Jn(e, t) {
|
|
|
3349
3392
|
default: return e;
|
|
3350
3393
|
}
|
|
3351
3394
|
}
|
|
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 (!
|
|
3395
|
+
var Qn = ({ 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 }) => {
|
|
3396
|
+
let { t: y } = $(), [b, S] = i.useState("all"), [C, w] = i.useState(""), [T, E] = i.useState(!1), [D, O] = i.useState(!1), [A, j] = i.useState([]), [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(() => Zn(e, P), [e, P]), V = i.useMemo(() => R ? B.filter((e) => !e.parentId) : B, [B, R]), H = i.useMemo(() => {
|
|
3397
|
+
if (!R) return /* @__PURE__ */ new Map();
|
|
3355
3398
|
let e = /* @__PURE__ */ new Map();
|
|
3356
3399
|
for (let t of B) if (t.parentId) {
|
|
3357
3400
|
let n = e.get(t.parentId) ?? [];
|
|
3358
3401
|
n.push(t), e.set(t.parentId, n);
|
|
3359
3402
|
}
|
|
3360
3403
|
return e;
|
|
3361
|
-
}, [B,
|
|
3404
|
+
}, [B, R]), ae = i.useCallback((e) => {
|
|
3362
3405
|
r ? r(e) : S(e);
|
|
3363
|
-
}, [r]),
|
|
3406
|
+
}, [r]), U = i.useCallback(async () => {
|
|
3364
3407
|
let e = C.trim();
|
|
3365
3408
|
if (c && !(!e && A.length === 0)) {
|
|
3366
3409
|
E(!0);
|
|
@@ -3374,19 +3417,19 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3374
3417
|
C,
|
|
3375
3418
|
A,
|
|
3376
3419
|
c
|
|
3377
|
-
]),
|
|
3420
|
+
]), W = i.useCallback(async (e) => {
|
|
3378
3421
|
if (!(!h || e.length === 0)) {
|
|
3379
|
-
|
|
3422
|
+
ie(!0);
|
|
3380
3423
|
try {
|
|
3381
3424
|
let t = await h(e);
|
|
3382
3425
|
Array.isArray(t) && t.length > 0 && j((e) => [...e, ...t]);
|
|
3383
3426
|
} finally {
|
|
3384
|
-
|
|
3427
|
+
ie(!1);
|
|
3385
3428
|
}
|
|
3386
3429
|
}
|
|
3387
|
-
}, [h]),
|
|
3430
|
+
}, [h]), oe = i.useCallback((e) => {
|
|
3388
3431
|
j((t) => t.filter((t) => t.id !== e));
|
|
3389
|
-
}, []),
|
|
3432
|
+
}, []), ce = i.useCallback(async () => {
|
|
3390
3433
|
if (o) {
|
|
3391
3434
|
O(!0);
|
|
3392
3435
|
try {
|
|
@@ -3397,7 +3440,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3397
3440
|
}
|
|
3398
3441
|
}, [o]);
|
|
3399
3442
|
return /* @__PURE__ */ Q("section", {
|
|
3400
|
-
className:
|
|
3443
|
+
className: G("border-t border-border/60 pt-5", v),
|
|
3401
3444
|
"aria-label": "Discussion",
|
|
3402
3445
|
children: [/* @__PURE__ */ Z("header", {
|
|
3403
3446
|
className: "mb-4",
|
|
@@ -3406,7 +3449,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3406
3449
|
children: [/* @__PURE__ */ Q("h2", {
|
|
3407
3450
|
className: "flex items-center gap-2 text-base font-semibold leading-none tracking-tight",
|
|
3408
3451
|
children: [
|
|
3409
|
-
/* @__PURE__ */ Z(
|
|
3452
|
+
/* @__PURE__ */ Z(se, { className: "h-4 w-4" }),
|
|
3410
3453
|
g ?? y("detail.activity"),
|
|
3411
3454
|
/* @__PURE__ */ Q("span", {
|
|
3412
3455
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -3419,7 +3462,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3419
3462
|
]
|
|
3420
3463
|
}), /* @__PURE__ */ Z("div", {
|
|
3421
3464
|
className: "flex items-center gap-1",
|
|
3422
|
-
children:
|
|
3465
|
+
children: z && d && /* @__PURE__ */ Z(Bn, {
|
|
3423
3466
|
subscription: d,
|
|
3424
3467
|
onToggle: f
|
|
3425
3468
|
})
|
|
@@ -3428,37 +3471,37 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3428
3471
|
}), /* @__PURE__ */ Q("div", {
|
|
3429
3472
|
className: "space-y-4",
|
|
3430
3473
|
children: [
|
|
3431
|
-
|
|
3474
|
+
F && /* @__PURE__ */ Z("div", {
|
|
3432
3475
|
className: "flex items-center gap-2",
|
|
3433
3476
|
children: /* @__PURE__ */ Q(M, {
|
|
3434
|
-
value:
|
|
3435
|
-
onValueChange: (e) =>
|
|
3477
|
+
value: P,
|
|
3478
|
+
onValueChange: (e) => ae(e),
|
|
3436
3479
|
children: [/* @__PURE__ */ Z(te, {
|
|
3437
3480
|
"aria-label": y("detail.filterActivity"),
|
|
3438
3481
|
className: "h-8 w-auto min-w-[140px] py-1 text-sm",
|
|
3439
3482
|
children: /* @__PURE__ */ Z(ne, {})
|
|
3440
|
-
}), /* @__PURE__ */ Z(N, { children:
|
|
3483
|
+
}), /* @__PURE__ */ Z(N, { children: Yn(y).map((e) => /* @__PURE__ */ Z(ee, {
|
|
3441
3484
|
value: e.value,
|
|
3442
3485
|
children: e.label
|
|
3443
3486
|
}, e.value)) })]
|
|
3444
3487
|
})
|
|
3445
3488
|
}),
|
|
3446
|
-
|
|
3489
|
+
I && /* @__PURE__ */ Z(Hn, {
|
|
3447
3490
|
value: C,
|
|
3448
3491
|
onChange: w,
|
|
3449
|
-
onSubmit:
|
|
3492
|
+
onSubmit: U,
|
|
3450
3493
|
mentionSuggestions: m,
|
|
3451
3494
|
placeholder: y("detail.leaveCommentPlaceholder"),
|
|
3452
3495
|
disabled: T,
|
|
3453
3496
|
canSubmitEmpty: A.length > 0,
|
|
3454
|
-
extraSlot: h ? /* @__PURE__ */ Z(
|
|
3497
|
+
extraSlot: h ? /* @__PURE__ */ Z(Kn, {
|
|
3455
3498
|
attachments: A,
|
|
3456
|
-
onUpload:
|
|
3457
|
-
onRemove:
|
|
3458
|
-
readOnly: T ||
|
|
3459
|
-
}) : A.length > 0 ? /* @__PURE__ */ Z(
|
|
3499
|
+
onUpload: W,
|
|
3500
|
+
onRemove: oe,
|
|
3501
|
+
readOnly: T || re
|
|
3502
|
+
}) : A.length > 0 ? /* @__PURE__ */ Z(Kn, {
|
|
3460
3503
|
attachments: A,
|
|
3461
|
-
onRemove:
|
|
3504
|
+
onRemove: oe,
|
|
3462
3505
|
readOnly: T
|
|
3463
3506
|
}) : void 0
|
|
3464
3507
|
}),
|
|
@@ -3470,11 +3513,11 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3470
3513
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
3471
3514
|
className: "space-y-4",
|
|
3472
3515
|
children: V.map((e) => {
|
|
3473
|
-
let t =
|
|
3516
|
+
let t = qn[e.type] || rt, n = Jn[e.type] || "bg-gray-100 text-gray-600", r = H.get(e.id) ?? [];
|
|
3474
3517
|
return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
|
|
3475
3518
|
className: "flex gap-3 relative",
|
|
3476
3519
|
children: [/* @__PURE__ */ Z("div", {
|
|
3477
|
-
className:
|
|
3520
|
+
className: G("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", n),
|
|
3478
3521
|
children: e.actorAvatarUrl ? /* @__PURE__ */ Z("img", {
|
|
3479
3522
|
src: e.actorAvatarUrl,
|
|
3480
3523
|
alt: e.actor,
|
|
@@ -3496,7 +3539,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3496
3539
|
}),
|
|
3497
3540
|
/* @__PURE__ */ Z("span", {
|
|
3498
3541
|
className: "text-xs text-muted-foreground",
|
|
3499
|
-
children:
|
|
3542
|
+
children: Xn(e.createdAt, y)
|
|
3500
3543
|
}),
|
|
3501
3544
|
e.edited && /* @__PURE__ */ Z("span", {
|
|
3502
3545
|
className: "text-xs text-muted-foreground italic",
|
|
@@ -3523,25 +3566,25 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3523
3566
|
}),
|
|
3524
3567
|
e.type === "field_change" && e.fieldChanges && /* @__PURE__ */ Z("div", {
|
|
3525
3568
|
className: "space-y-1 mt-1",
|
|
3526
|
-
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(
|
|
3569
|
+
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(Fn, { change: e }, t))
|
|
3527
3570
|
}),
|
|
3528
|
-
|
|
3571
|
+
L && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
|
|
3529
3572
|
className: "mt-1.5",
|
|
3530
|
-
children: /* @__PURE__ */ Z(
|
|
3573
|
+
children: /* @__PURE__ */ Z(Ln, {
|
|
3531
3574
|
reactions: e.reactions,
|
|
3532
3575
|
onToggleReaction: u ? (t) => u(e.id, t) : void 0
|
|
3533
3576
|
})
|
|
3534
3577
|
}),
|
|
3535
|
-
|
|
3578
|
+
L && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
|
|
3536
3579
|
className: "mt-1.5",
|
|
3537
|
-
children: /* @__PURE__ */ Z(
|
|
3580
|
+
children: /* @__PURE__ */ Z(Ln, {
|
|
3538
3581
|
reactions: [],
|
|
3539
3582
|
onToggleReaction: (t) => u(e.id, t)
|
|
3540
3583
|
})
|
|
3541
3584
|
})
|
|
3542
3585
|
]
|
|
3543
3586
|
})]
|
|
3544
|
-
}),
|
|
3587
|
+
}), R && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(zn, {
|
|
3545
3588
|
parentItem: e,
|
|
3546
3589
|
replies: r,
|
|
3547
3590
|
onAddReply: l,
|
|
@@ -3555,16 +3598,16 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3555
3598
|
children: /* @__PURE__ */ Q(x, {
|
|
3556
3599
|
variant: "ghost",
|
|
3557
3600
|
size: "sm",
|
|
3558
|
-
onClick:
|
|
3601
|
+
onClick: ce,
|
|
3559
3602
|
disabled: D,
|
|
3560
3603
|
"aria-label": y("detail.loadMore"),
|
|
3561
|
-
children: [D ? /* @__PURE__ */ Z(
|
|
3604
|
+
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
3605
|
})
|
|
3563
3606
|
})
|
|
3564
3607
|
]
|
|
3565
3608
|
})]
|
|
3566
3609
|
});
|
|
3567
|
-
},
|
|
3610
|
+
}, $n = (e) => {
|
|
3568
3611
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3569
3612
|
return {
|
|
3570
3613
|
designer: {
|
|
@@ -3574,21 +3617,21 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3574
3617
|
},
|
|
3575
3618
|
rest: i
|
|
3576
3619
|
};
|
|
3577
|
-
},
|
|
3620
|
+
}, er = ({ schema: e = {}, className: t, ...n }) => {
|
|
3578
3621
|
pt();
|
|
3579
|
-
let { designer: r } =
|
|
3622
|
+
let { designer: r } = $n(n);
|
|
3580
3623
|
return /* @__PURE__ */ Z("div", {
|
|
3581
3624
|
className: t,
|
|
3582
3625
|
...r,
|
|
3583
|
-
children: /* @__PURE__ */ Z(
|
|
3626
|
+
children: /* @__PURE__ */ Z(Qn, {
|
|
3584
3627
|
items: [],
|
|
3585
3628
|
config: e
|
|
3586
3629
|
})
|
|
3587
3630
|
});
|
|
3588
|
-
},
|
|
3631
|
+
}, tr = ({ 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
3632
|
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
3633
|
return _ === "right" || _ === "left" ? C && y ? /* @__PURE__ */ Z("div", {
|
|
3591
|
-
className:
|
|
3634
|
+
className: G("flex items-start pt-4", _ === "right" ? "border-l" : "border-r", g),
|
|
3592
3635
|
children: /* @__PURE__ */ Z(x, {
|
|
3593
3636
|
variant: "ghost",
|
|
3594
3637
|
size: "icon",
|
|
@@ -3598,7 +3641,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3598
3641
|
children: /* @__PURE__ */ Z(He, { className: "h-4 w-4" })
|
|
3599
3642
|
})
|
|
3600
3643
|
}) : /* @__PURE__ */ Q("div", {
|
|
3601
|
-
className:
|
|
3644
|
+
className: G("flex flex-col overflow-hidden", _ === "right" ? "border-l" : "border-r", g),
|
|
3602
3645
|
style: {
|
|
3603
3646
|
width: v,
|
|
3604
3647
|
minWidth: v
|
|
@@ -3607,7 +3650,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3607
3650
|
className: "flex items-center justify-between px-4 py-3 border-b",
|
|
3608
3651
|
children: [/* @__PURE__ */ Q("div", {
|
|
3609
3652
|
className: "flex items-center gap-2",
|
|
3610
|
-
children: [/* @__PURE__ */ Z(
|
|
3653
|
+
children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
3611
3654
|
className: "text-sm font-medium",
|
|
3612
3655
|
children: S("detail.discussion")
|
|
3613
3656
|
})]
|
|
@@ -3621,7 +3664,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3621
3664
|
})]
|
|
3622
3665
|
}), /* @__PURE__ */ Z("div", {
|
|
3623
3666
|
className: "flex-1 overflow-y-auto",
|
|
3624
|
-
children: /* @__PURE__ */ Z(
|
|
3667
|
+
children: /* @__PURE__ */ Z(Qn, {
|
|
3625
3668
|
items: t,
|
|
3626
3669
|
config: e?.feed,
|
|
3627
3670
|
hasMore: n,
|
|
@@ -3643,18 +3686,18 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3643
3686
|
})
|
|
3644
3687
|
})]
|
|
3645
3688
|
}) : /* @__PURE__ */ Z("div", {
|
|
3646
|
-
className:
|
|
3689
|
+
className: G("", g),
|
|
3647
3690
|
children: y && C ? /* @__PURE__ */ Q(x, {
|
|
3648
3691
|
variant: "ghost",
|
|
3649
3692
|
className: "w-full justify-start gap-2 text-muted-foreground",
|
|
3650
3693
|
onClick: () => w(!1),
|
|
3651
3694
|
"aria-label": S("detail.showDiscussion", { count: t.length }),
|
|
3652
|
-
children: [/* @__PURE__ */ Z(
|
|
3695
|
+
children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: S("detail.showDiscussion", { count: t.length }) })]
|
|
3653
3696
|
}) : /* @__PURE__ */ Q("div", { children: [y && /* @__PURE__ */ Q("div", {
|
|
3654
3697
|
className: "flex items-center justify-between mb-2",
|
|
3655
3698
|
children: [/* @__PURE__ */ Q("div", {
|
|
3656
3699
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
3657
|
-
children: [/* @__PURE__ */ Z(
|
|
3700
|
+
children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), S("detail.discussion")]
|
|
3658
3701
|
}), /* @__PURE__ */ Z(x, {
|
|
3659
3702
|
variant: "ghost",
|
|
3660
3703
|
size: "icon",
|
|
@@ -3663,7 +3706,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3663
3706
|
"aria-label": S("detail.hideDiscussion"),
|
|
3664
3707
|
children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
|
|
3665
3708
|
})]
|
|
3666
|
-
}), /* @__PURE__ */ Z(
|
|
3709
|
+
}), /* @__PURE__ */ Z(Qn, {
|
|
3667
3710
|
items: t,
|
|
3668
3711
|
config: e?.feed,
|
|
3669
3712
|
hasMore: n,
|
|
@@ -3683,7 +3726,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3683
3726
|
emptyLabel: S("detail.noCommentsYet")
|
|
3684
3727
|
})] })
|
|
3685
3728
|
});
|
|
3686
|
-
},
|
|
3729
|
+
}, nr = (e) => {
|
|
3687
3730
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3688
3731
|
return {
|
|
3689
3732
|
designer: {
|
|
@@ -3693,9 +3736,9 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3693
3736
|
},
|
|
3694
3737
|
rest: i
|
|
3695
3738
|
};
|
|
3696
|
-
},
|
|
3739
|
+
}, rr = ({ schema: e = {}, className: t, ...n }) => {
|
|
3697
3740
|
pt();
|
|
3698
|
-
let r = lt(), { designer: i } =
|
|
3741
|
+
let r = lt(), { designer: i } = nr(n), a = {
|
|
3699
3742
|
position: "bottom",
|
|
3700
3743
|
collapsible: !1,
|
|
3701
3744
|
feed: {
|
|
@@ -3708,7 +3751,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3708
3751
|
return /* @__PURE__ */ Z("div", {
|
|
3709
3752
|
className: t,
|
|
3710
3753
|
...i,
|
|
3711
|
-
children: /* @__PURE__ */ Z(
|
|
3754
|
+
children: /* @__PURE__ */ Z(tr, {
|
|
3712
3755
|
items: r?.items || [],
|
|
3713
3756
|
config: a,
|
|
3714
3757
|
onAddComment: r?.onAddComment,
|
|
@@ -3718,7 +3761,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3718
3761
|
onUploadAttachments: r?.onUploadAttachments
|
|
3719
3762
|
})
|
|
3720
3763
|
});
|
|
3721
|
-
},
|
|
3764
|
+
}, ir = (e) => {
|
|
3722
3765
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3723
3766
|
return {
|
|
3724
3767
|
designer: {
|
|
@@ -3728,8 +3771,8 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3728
3771
|
},
|
|
3729
3772
|
rest: i
|
|
3730
3773
|
};
|
|
3731
|
-
},
|
|
3732
|
-
let r = pt(), { translateOptions: i } =
|
|
3774
|
+
}, ar = ({ schema: e = {}, className: t, ...n }) => {
|
|
3775
|
+
let r = pt(), { translateOptions: i } = gt(), { designer: o } = ir(n), s = Array.isArray(e.stages) ? e.stages : [], c = e.statusField, l = a.useMemo(() => {
|
|
3733
3776
|
if (s.length === 0 || !c || !r?.objectName) return s;
|
|
3734
3777
|
let e = i(r.objectName, c, s);
|
|
3735
3778
|
return Array.isArray(e) && e.length === s.length ? s.map((t, n) => ({
|
|
@@ -3759,7 +3802,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3759
3802
|
});
|
|
3760
3803
|
let b = h.length - 1;
|
|
3761
3804
|
return /* @__PURE__ */ Q("div", {
|
|
3762
|
-
className:
|
|
3805
|
+
className: G("w-full", t),
|
|
3763
3806
|
...o,
|
|
3764
3807
|
children: [/* @__PURE__ */ Q("div", {
|
|
3765
3808
|
className: "hidden sm:flex w-full items-stretch gap-2",
|
|
@@ -3772,7 +3815,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3772
3815
|
return /* @__PURE__ */ Z("div", {
|
|
3773
3816
|
role: "listitem",
|
|
3774
3817
|
"aria-current": r ? "step" : void 0,
|
|
3775
|
-
className:
|
|
3818
|
+
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
3819
|
children: /* @__PURE__ */ Q("span", {
|
|
3777
3820
|
className: "inline-flex items-center justify-center gap-1.5 truncate",
|
|
3778
3821
|
children: [
|
|
@@ -3799,7 +3842,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3799
3842
|
return /* @__PURE__ */ Z("div", {
|
|
3800
3843
|
role: "listitem",
|
|
3801
3844
|
"aria-current": n ? "step" : void 0,
|
|
3802
|
-
className:
|
|
3845
|
+
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
3846
|
children: /* @__PURE__ */ Q("span", {
|
|
3804
3847
|
className: "inline-flex items-center gap-1",
|
|
3805
3848
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -3820,7 +3863,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3820
3863
|
return /* @__PURE__ */ Z("div", {
|
|
3821
3864
|
role: "listitem",
|
|
3822
3865
|
"aria-current": i ? "step" : void 0,
|
|
3823
|
-
className:
|
|
3866
|
+
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
3867
|
children: /* @__PURE__ */ Q("span", {
|
|
3825
3868
|
className: "inline-flex items-center gap-1",
|
|
3826
3869
|
children: [
|
|
@@ -3841,7 +3884,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3841
3884
|
})
|
|
3842
3885
|
})]
|
|
3843
3886
|
});
|
|
3844
|
-
},
|
|
3887
|
+
}, or = (e) => {
|
|
3845
3888
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3846
3889
|
return {
|
|
3847
3890
|
designer: {
|
|
@@ -3851,8 +3894,8 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3851
3894
|
},
|
|
3852
3895
|
rest: i
|
|
3853
3896
|
};
|
|
3854
|
-
},
|
|
3855
|
-
let r = pt(), { designer: i } =
|
|
3897
|
+
}, sr = ({ schema: e = {}, className: t, ...n }) => {
|
|
3898
|
+
let r = pt(), { designer: i } = or(n), a = Ot(), 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 } = dt("object", u ? c : null), f = u ? (() => {
|
|
3856
3899
|
let e = Array.isArray(d?.actions) ? d.actions : [], t = new Map(e.map((e) => [e.name, e]));
|
|
3857
3900
|
return l.map((e) => t.get(e)).filter((e) => !!e);
|
|
3858
3901
|
})() : Array.isArray(o) ? o : [], p = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
@@ -3884,11 +3927,11 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3884
3927
|
});
|
|
3885
3928
|
let v = e.align || "end", y = v === "start" ? "justify-start" : v === "center" ? "justify-center" : "justify-end";
|
|
3886
3929
|
return /* @__PURE__ */ Z("div", {
|
|
3887
|
-
className:
|
|
3930
|
+
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
3931
|
role: "toolbar",
|
|
3889
3932
|
"aria-label": e.aria?.label || "Quick actions",
|
|
3890
3933
|
...i,
|
|
3891
|
-
children: _.map((t, n) => /* @__PURE__ */ Z(
|
|
3934
|
+
children: _.map((t, n) => /* @__PURE__ */ Z(cr, {
|
|
3892
3935
|
action: t,
|
|
3893
3936
|
record: r?.data,
|
|
3894
3937
|
variant: t.variant || e.variant || "default",
|
|
@@ -3900,7 +3943,7 @@ var Yn = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: a =
|
|
|
3900
3943
|
}, t.name || `qa-${n}`))
|
|
3901
3944
|
});
|
|
3902
3945
|
};
|
|
3903
|
-
function
|
|
3946
|
+
function cr({ action: e, record: t, variant: n, size: r, label: i, onRun: o }) {
|
|
3904
3947
|
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
3948
|
return /* @__PURE__ */ Q(x, {
|
|
3906
3949
|
variant: n,
|
|
@@ -3914,12 +3957,12 @@ function ar({ action: e, record: t, variant: n, size: r, label: i, onRun: o }) {
|
|
|
3914
3957
|
c(!1);
|
|
3915
3958
|
}
|
|
3916
3959
|
},
|
|
3917
|
-
children: [s && /* @__PURE__ */ Z(
|
|
3960
|
+
children: [s && /* @__PURE__ */ Z(Le, { className: "mr-2 h-4 w-4 animate-spin" }), i]
|
|
3918
3961
|
});
|
|
3919
3962
|
}
|
|
3920
3963
|
//#endregion
|
|
3921
3964
|
//#region src/renderers/record-history.tsx
|
|
3922
|
-
var
|
|
3965
|
+
var lr = (e) => {
|
|
3923
3966
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3924
3967
|
return {
|
|
3925
3968
|
designer: {
|
|
@@ -3929,14 +3972,14 @@ var or = (e) => {
|
|
|
3929
3972
|
},
|
|
3930
3973
|
rest: i
|
|
3931
3974
|
};
|
|
3932
|
-
},
|
|
3975
|
+
}, ur = /* @__PURE__ */ new Set([
|
|
3933
3976
|
"created",
|
|
3934
3977
|
"updated",
|
|
3935
3978
|
"assigned",
|
|
3936
3979
|
"shared",
|
|
3937
3980
|
"deleted"
|
|
3938
|
-
]),
|
|
3939
|
-
let { designer: r } =
|
|
3981
|
+
]), dr = ({ schema: e = {}, className: t, ...n }) => {
|
|
3982
|
+
let { designer: r } = lr(n), i = pt(), 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
3983
|
a.useEffect(() => {
|
|
3941
3984
|
if (!p) return;
|
|
3942
3985
|
let e = !1;
|
|
@@ -3948,7 +3991,7 @@ var or = (e) => {
|
|
|
3948
3991
|
$orderby: { timestamp: "desc" },
|
|
3949
3992
|
$top: Math.max(1, l)
|
|
3950
3993
|
})).then((t) => {
|
|
3951
|
-
e || h((t?.data ?? t?.records ?? []).filter((e) =>
|
|
3994
|
+
e || h((t?.data ?? t?.records ?? []).filter((e) => ur.has(e?.type)).map((e) => {
|
|
3952
3995
|
let t = e.timestamp;
|
|
3953
3996
|
return (!t || t === "NOW()" || Number.isNaN(Date.parse(t))) && (t = e.created_at), {
|
|
3954
3997
|
id: e.id,
|
|
@@ -3977,13 +4020,13 @@ var or = (e) => {
|
|
|
3977
4020
|
return /* @__PURE__ */ Z("div", {
|
|
3978
4021
|
className: t,
|
|
3979
4022
|
...r,
|
|
3980
|
-
children: /* @__PURE__ */ Z(
|
|
4023
|
+
children: /* @__PURE__ */ Z(dn, {
|
|
3981
4024
|
entries: v,
|
|
3982
4025
|
loading: y,
|
|
3983
4026
|
emptyText: c
|
|
3984
4027
|
})
|
|
3985
4028
|
});
|
|
3986
|
-
},
|
|
4029
|
+
}, fr = (e) => {
|
|
3987
4030
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3988
4031
|
return {
|
|
3989
4032
|
designer: {
|
|
@@ -3993,8 +4036,8 @@ var or = (e) => {
|
|
|
3993
4036
|
},
|
|
3994
4037
|
rest: i
|
|
3995
4038
|
};
|
|
3996
|
-
},
|
|
3997
|
-
let r = pt(), i =
|
|
4039
|
+
}, pr = (e) => e.replace(/[_-]+/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()).trim(), mr = (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 || "—", hr = ({ schema: e = {}, className: t, ...n }) => {
|
|
4040
|
+
let r = pt(), i = gt(), { t: o } = $(), { designer: s } = fr(n), c = Mt().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
4041
|
a.useEffect(() => (_.current = !0, () => {
|
|
3999
4042
|
_.current = !1;
|
|
4000
4043
|
}), []);
|
|
@@ -4074,11 +4117,11 @@ var or = (e) => {
|
|
|
4074
4117
|
return x && t && !t.loading && !t.error && t.total === 0;
|
|
4075
4118
|
}).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
4119
|
name: e.objectName,
|
|
4077
|
-
label:
|
|
4078
|
-
}) :
|
|
4120
|
+
label: pr(e.objectName)
|
|
4121
|
+
}) : pr(e.objectName)));
|
|
4079
4122
|
return /* @__PURE__ */ Q("div", {
|
|
4080
4123
|
ref: m,
|
|
4081
|
-
className:
|
|
4124
|
+
className: G("flex flex-col gap-3", e.className, t),
|
|
4082
4125
|
...s,
|
|
4083
4126
|
children: [k.map((e) => {
|
|
4084
4127
|
let t = e.objectName, n = f[t] || {
|
|
@@ -4094,15 +4137,15 @@ var or = (e) => {
|
|
|
4094
4137
|
className: "text-sm font-semibold tracking-tight truncate",
|
|
4095
4138
|
children: e.title || (i?.objectLabel ? i.objectLabel({
|
|
4096
4139
|
name: e.objectName,
|
|
4097
|
-
label:
|
|
4098
|
-
}) :
|
|
4140
|
+
label: pr(e.objectName)
|
|
4141
|
+
}) : pr(e.objectName))
|
|
4099
4142
|
}), /* @__PURE__ */ Q("div", {
|
|
4100
4143
|
className: "flex items-center gap-2 shrink-0",
|
|
4101
4144
|
children: [!n.loading && /* @__PURE__ */ Z(b, {
|
|
4102
4145
|
variant: "secondary",
|
|
4103
4146
|
className: "tabular-nums",
|
|
4104
4147
|
children: n.total
|
|
4105
|
-
}), c && u && /* @__PURE__ */ Z(
|
|
4148
|
+
}), c && u && /* @__PURE__ */ Z(jt, {
|
|
4106
4149
|
to: `/apps/${c}/${e.objectName}?filter%5B${e.relationshipField}%5D=${encodeURIComponent(String(u))}`,
|
|
4107
4150
|
className: "text-[11px] font-medium text-muted-foreground hover:text-foreground transition-colors",
|
|
4108
4151
|
title: o("detail.viewAll", { defaultValue: "View all" }),
|
|
@@ -4114,9 +4157,9 @@ var or = (e) => {
|
|
|
4114
4157
|
children: n.loading ? /* @__PURE__ */ Q("div", {
|
|
4115
4158
|
className: "space-y-1.5 p-3",
|
|
4116
4159
|
children: [
|
|
4117
|
-
/* @__PURE__ */ Z(
|
|
4118
|
-
/* @__PURE__ */ Z(
|
|
4119
|
-
/* @__PURE__ */ Z(
|
|
4160
|
+
/* @__PURE__ */ Z(I, { className: "h-3.5 w-4/5" }),
|
|
4161
|
+
/* @__PURE__ */ Z(I, { className: "h-3.5 w-3/5" }),
|
|
4162
|
+
/* @__PURE__ */ Z(I, { className: "h-3.5 w-2/3" })
|
|
4120
4163
|
]
|
|
4121
4164
|
}) : n.items.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
4122
4165
|
className: "px-4 py-3 text-xs text-muted-foreground",
|
|
@@ -4124,10 +4167,10 @@ var or = (e) => {
|
|
|
4124
4167
|
}) : /* @__PURE__ */ Z("ul", {
|
|
4125
4168
|
className: "divide-y",
|
|
4126
4169
|
children: n.items.map((t) => {
|
|
4127
|
-
let n = t.id || t._id, r =
|
|
4170
|
+
let n = t.id || t._id, r = mr(t, e.displayField), i = n ? `../${e.objectName}/record/${encodeURIComponent(String(n))}` : void 0;
|
|
4128
4171
|
return /* @__PURE__ */ Z("li", {
|
|
4129
4172
|
className: "px-4 py-2",
|
|
4130
|
-
children: i ? /* @__PURE__ */ Q(
|
|
4173
|
+
children: i ? /* @__PURE__ */ Q(jt, {
|
|
4131
4174
|
to: i,
|
|
4132
4175
|
className: "group flex items-center justify-between gap-2 text-xs hover:text-foreground text-muted-foreground transition-colors",
|
|
4133
4176
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -4161,7 +4204,7 @@ var or = (e) => {
|
|
|
4161
4204
|
})]
|
|
4162
4205
|
})]
|
|
4163
4206
|
});
|
|
4164
|
-
},
|
|
4207
|
+
}, gr = {
|
|
4165
4208
|
info: {
|
|
4166
4209
|
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
4210
|
icon: "Info"
|
|
@@ -4179,20 +4222,20 @@ var or = (e) => {
|
|
|
4179
4222
|
icon: "CheckCircle2"
|
|
4180
4223
|
}
|
|
4181
4224
|
};
|
|
4182
|
-
function
|
|
4225
|
+
function _r(e) {
|
|
4183
4226
|
let t = e?.properties ?? {};
|
|
4184
4227
|
return {
|
|
4185
4228
|
...e,
|
|
4186
4229
|
...t
|
|
4187
4230
|
};
|
|
4188
4231
|
}
|
|
4189
|
-
var
|
|
4190
|
-
let n =
|
|
4232
|
+
var vr = ({ schema: e = {}, className: t }) => {
|
|
4233
|
+
let n = _r(e), r = pt(), a = r?.data, c = r?.objectName || "", l = r?.recordId ?? a?.id, u = [
|
|
4191
4234
|
"info",
|
|
4192
4235
|
"warning",
|
|
4193
4236
|
"error",
|
|
4194
4237
|
"success"
|
|
4195
|
-
].includes(n.severity) ? n.severity : "info", d =
|
|
4238
|
+
].includes(n.severity) ? n.severity : "info", d = gr[u], f = n.icon || d.icon, p = ot(n.visible), m = ct(p, { record: a }), h = i.useMemo(() => {
|
|
4196
4239
|
if (!n.dismissible) return null;
|
|
4197
4240
|
let e = n.dismissKey || n.title || u;
|
|
4198
4241
|
return `os.record-alert:${c}:${l ?? "_"}:${e}`;
|
|
@@ -4221,7 +4264,7 @@ var hr = ({ schema: e = {}, className: t }) => {
|
|
|
4221
4264
|
}
|
|
4222
4265
|
});
|
|
4223
4266
|
return _ || !a || Object.keys(a).length === 0 || p !== void 0 && !m ? null : /* @__PURE__ */ Q(o, {
|
|
4224
|
-
className:
|
|
4267
|
+
className: G("relative pr-12", d.wrap, t),
|
|
4225
4268
|
role: u === "error" ? "alert" : "status",
|
|
4226
4269
|
"aria-live": u === "error" ? "assertive" : "polite",
|
|
4227
4270
|
children: [
|
|
@@ -4259,7 +4302,7 @@ var hr = ({ schema: e = {}, className: t }) => {
|
|
|
4259
4302
|
}) : null
|
|
4260
4303
|
]
|
|
4261
4304
|
});
|
|
4262
|
-
},
|
|
4305
|
+
}, yr = /* @__PURE__ */ new Set([
|
|
4263
4306
|
"id",
|
|
4264
4307
|
"_id",
|
|
4265
4308
|
"__v",
|
|
@@ -4274,15 +4317,15 @@ var hr = ({ schema: e = {}, className: t }) => {
|
|
|
4274
4317
|
"owner_id",
|
|
4275
4318
|
"deleted_at",
|
|
4276
4319
|
"is_deleted"
|
|
4277
|
-
]),
|
|
4278
|
-
function
|
|
4320
|
+
]), br = 480, xr = 95;
|
|
4321
|
+
function Sr({ 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 = yr, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
|
|
4279
4322
|
let { t: g } = $(), _ = `objectui.drawerWidth.${i}`, [v, y] = a.useState(() => {
|
|
4280
4323
|
if (typeof window > "u" || !m) return null;
|
|
4281
4324
|
try {
|
|
4282
4325
|
let e = window.localStorage.getItem(_);
|
|
4283
4326
|
if (e) {
|
|
4284
4327
|
let t = parseInt(e, 10);
|
|
4285
|
-
if (Number.isFinite(t) && t >=
|
|
4328
|
+
if (Number.isFinite(t) && t >= br) return t;
|
|
4286
4329
|
}
|
|
4287
4330
|
} catch {}
|
|
4288
4331
|
return null;
|
|
@@ -4304,7 +4347,7 @@ function yr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4304
4347
|
let n = (e) => {
|
|
4305
4348
|
let t = S.current;
|
|
4306
4349
|
if (!t) return;
|
|
4307
|
-
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth *
|
|
4350
|
+
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * xr / 100 : 1600, i = Math.min(r, Math.max(br, t.startWidth + n));
|
|
4308
4351
|
y(Math.round(i));
|
|
4309
4352
|
}, r = () => {
|
|
4310
4353
|
S.current, S.current = null, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r);
|
|
@@ -4327,6 +4370,7 @@ function yr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4327
4370
|
options: t.options,
|
|
4328
4371
|
currency: t.currency,
|
|
4329
4372
|
precision: t.precision,
|
|
4373
|
+
scale: t.scale,
|
|
4330
4374
|
format: t.format,
|
|
4331
4375
|
reference_to: t.reference_to ?? t.referenceTo ?? t.target,
|
|
4332
4376
|
reference_field: t.reference_field ?? t.referenceField,
|
|
@@ -4336,12 +4380,12 @@ function yr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4336
4380
|
description: t.description
|
|
4337
4381
|
};
|
|
4338
4382
|
});
|
|
4339
|
-
return /* @__PURE__ */ Z(
|
|
4383
|
+
return /* @__PURE__ */ Z(re, {
|
|
4340
4384
|
open: e,
|
|
4341
4385
|
onOpenChange: (e) => {
|
|
4342
4386
|
e || t();
|
|
4343
4387
|
},
|
|
4344
|
-
children: /* @__PURE__ */ Q(
|
|
4388
|
+
children: /* @__PURE__ */ Q(ie, {
|
|
4345
4389
|
side: "right",
|
|
4346
4390
|
className: "w-full overflow-y-auto p-0 sm:!max-w-none",
|
|
4347
4391
|
style: x,
|
|
@@ -4354,13 +4398,13 @@ function yr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4354
4398
|
onPointerDown: C,
|
|
4355
4399
|
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
4400
|
}),
|
|
4357
|
-
/* @__PURE__ */ Z(
|
|
4401
|
+
/* @__PURE__ */ Z(P, {
|
|
4358
4402
|
className: "sr-only",
|
|
4359
|
-
children: /* @__PURE__ */ Z(
|
|
4403
|
+
children: /* @__PURE__ */ Z(F, { children: n })
|
|
4360
4404
|
}),
|
|
4361
4405
|
/* @__PURE__ */ Z("div", {
|
|
4362
4406
|
className: "px-6 pt-6 pb-6",
|
|
4363
|
-
children: /* @__PURE__ */ Z(
|
|
4407
|
+
children: /* @__PURE__ */ Z(xn, {
|
|
4364
4408
|
dataSource: s,
|
|
4365
4409
|
inlineEdit: !0,
|
|
4366
4410
|
schema: {
|
|
@@ -4403,14 +4447,14 @@ function yr({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4403
4447
|
})
|
|
4404
4448
|
});
|
|
4405
4449
|
}
|
|
4406
|
-
function
|
|
4450
|
+
function Cr(e, t) {
|
|
4407
4451
|
if (typeof window > "u") return null;
|
|
4408
4452
|
let n = window.location.pathname, r = `/${e}`, i = n.indexOf(r);
|
|
4409
4453
|
return `${i >= 0 ? n.slice(0, i) : n.replace(/\/$/, "")}/${e}/record/${encodeURIComponent(String(t))}`;
|
|
4410
4454
|
}
|
|
4411
4455
|
//#endregion
|
|
4412
4456
|
//#region src/InlineCreateRelated.tsx
|
|
4413
|
-
var
|
|
4457
|
+
var wr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
|
|
4414
4458
|
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
4459
|
if (!h.trim()) return _;
|
|
4416
4460
|
let e = h.toLowerCase();
|
|
@@ -4456,7 +4500,7 @@ var xr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4456
4500
|
}
|
|
4457
4501
|
}, [a]), ee = i.useMemo(() => n.filter((e) => e.required).every((e) => p[e.name]?.toString().trim()), [n, p]);
|
|
4458
4502
|
return l ? /* @__PURE__ */ Q(S, {
|
|
4459
|
-
className:
|
|
4503
|
+
className: G("", c),
|
|
4460
4504
|
children: [/* @__PURE__ */ Z(w, {
|
|
4461
4505
|
className: "pb-3",
|
|
4462
4506
|
children: /* @__PURE__ */ Q(T, {
|
|
@@ -4473,11 +4517,11 @@ var xr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4473
4517
|
children: /* @__PURE__ */ Z(nt, { className: "h-3.5 w-3.5" })
|
|
4474
4518
|
})]
|
|
4475
4519
|
})
|
|
4476
|
-
}), /* @__PURE__ */ Z(C, { children: /* @__PURE__ */ Q(
|
|
4520
|
+
}), /* @__PURE__ */ Z(C, { children: /* @__PURE__ */ Q(L, {
|
|
4477
4521
|
value: d,
|
|
4478
4522
|
onValueChange: f,
|
|
4479
4523
|
children: [
|
|
4480
|
-
/* @__PURE__ */ Q(
|
|
4524
|
+
/* @__PURE__ */ Q(z, {
|
|
4481
4525
|
className: "mb-3 w-full",
|
|
4482
4526
|
children: [r && /* @__PURE__ */ Q(B, {
|
|
4483
4527
|
value: "create",
|
|
@@ -4486,10 +4530,10 @@ var xr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4486
4530
|
}), a && /* @__PURE__ */ Q(B, {
|
|
4487
4531
|
value: "link",
|
|
4488
4532
|
className: "flex-1 gap-1.5",
|
|
4489
|
-
children: [/* @__PURE__ */ Z(
|
|
4533
|
+
children: [/* @__PURE__ */ Z(Fe, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
4490
4534
|
})]
|
|
4491
4535
|
}),
|
|
4492
|
-
r && /* @__PURE__ */ Q(
|
|
4536
|
+
r && /* @__PURE__ */ Q(R, {
|
|
4493
4537
|
value: "create",
|
|
4494
4538
|
className: "space-y-3 mt-0",
|
|
4495
4539
|
children: [n.map((e) => /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("label", {
|
|
@@ -4516,11 +4560,11 @@ var xr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4516
4560
|
onClick: M,
|
|
4517
4561
|
disabled: !ee || y,
|
|
4518
4562
|
className: "gap-1.5",
|
|
4519
|
-
children: [y && /* @__PURE__ */ Z(
|
|
4563
|
+
children: [y && /* @__PURE__ */ Z(Le, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
|
|
4520
4564
|
})]
|
|
4521
4565
|
})]
|
|
4522
4566
|
}),
|
|
4523
|
-
a && /* @__PURE__ */ Q(
|
|
4567
|
+
a && /* @__PURE__ */ Q(R, {
|
|
4524
4568
|
value: "link",
|
|
4525
4569
|
className: "space-y-3 mt-0",
|
|
4526
4570
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -4535,7 +4579,7 @@ var xr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4535
4579
|
className: "max-h-48 overflow-y-auto space-y-1",
|
|
4536
4580
|
children: E ? /* @__PURE__ */ Q("div", {
|
|
4537
4581
|
className: "flex items-center justify-center py-4 text-sm text-muted-foreground",
|
|
4538
|
-
children: [/* @__PURE__ */ Z(
|
|
4582
|
+
children: [/* @__PURE__ */ Z(Le, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
|
|
4539
4583
|
}) : O.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
4540
4584
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
4541
4585
|
children: h ? "No records found" : "Type to search records"
|
|
@@ -4557,7 +4601,7 @@ var xr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4557
4601
|
]
|
|
4558
4602
|
}) })]
|
|
4559
4603
|
}) : /* @__PURE__ */ Q("div", {
|
|
4560
|
-
className:
|
|
4604
|
+
className: G("flex gap-2", c),
|
|
4561
4605
|
children: [r && /* @__PURE__ */ Q(x, {
|
|
4562
4606
|
variant: "outline",
|
|
4563
4607
|
size: "sm",
|
|
@@ -4577,13 +4621,13 @@ var xr = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4577
4621
|
f("link"), u(!0);
|
|
4578
4622
|
},
|
|
4579
4623
|
className: "gap-1.5",
|
|
4580
|
-
children: [/* @__PURE__ */ Z(
|
|
4624
|
+
children: [/* @__PURE__ */ Z(Fe, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
4581
4625
|
})]
|
|
4582
4626
|
});
|
|
4583
4627
|
};
|
|
4584
4628
|
//#endregion
|
|
4585
4629
|
//#region src/DiffView.tsx
|
|
4586
|
-
function
|
|
4630
|
+
function Tr(e, t) {
|
|
4587
4631
|
if (e == null) return ["(empty)"];
|
|
4588
4632
|
switch (t) {
|
|
4589
4633
|
case "json": try {
|
|
@@ -4602,7 +4646,7 @@ function Sr(e, t) {
|
|
|
4602
4646
|
default: return String(e).split("\n");
|
|
4603
4647
|
}
|
|
4604
4648
|
}
|
|
4605
|
-
function
|
|
4649
|
+
function Er(e, t) {
|
|
4606
4650
|
let n = [], r = Math.max(e.length, t.length);
|
|
4607
4651
|
for (let i = 0; i < r; i++) {
|
|
4608
4652
|
let r = i < e.length ? e[i] : void 0, a = i < t.length ? t[i] : void 0;
|
|
@@ -4619,16 +4663,16 @@ function Cr(e, t) {
|
|
|
4619
4663
|
}
|
|
4620
4664
|
return n;
|
|
4621
4665
|
}
|
|
4622
|
-
var
|
|
4666
|
+
var Dr = {
|
|
4623
4667
|
added: "bg-green-50 text-green-800 dark:bg-green-950/30 dark:text-green-300",
|
|
4624
4668
|
removed: "bg-red-50 text-red-800 dark:bg-red-950/30 dark:text-red-300",
|
|
4625
4669
|
unchanged: "text-muted-foreground"
|
|
4626
|
-
},
|
|
4670
|
+
}, Or = {
|
|
4627
4671
|
added: "+",
|
|
4628
4672
|
removed: "-",
|
|
4629
4673
|
unchanged: " "
|
|
4630
|
-
},
|
|
4631
|
-
let { t: s } = $(), [c, l] = i.useState(a), u = i.useMemo(() =>
|
|
4674
|
+
}, kr = ({ oldValue: e, newValue: t, fieldName: n, fieldType: r = "string", mode: a = "unified", className: o }) => {
|
|
4675
|
+
let { t: s } = $(), [c, l] = i.useState(a), u = i.useMemo(() => Tr(e, r), [e, r]), d = i.useMemo(() => Tr(t, r), [t, r]), f = i.useMemo(() => Er(u, d), [u, d]), p = f.some((e) => e.type !== "unchanged"), m = i.useMemo(() => {
|
|
4632
4676
|
if (c !== "side-by-side") return [];
|
|
4633
4677
|
let e = [], t = 0;
|
|
4634
4678
|
for (; t < f.length;) {
|
|
@@ -4654,7 +4698,7 @@ var wr = {
|
|
|
4654
4698
|
return e;
|
|
4655
4699
|
}, [c, f]);
|
|
4656
4700
|
return /* @__PURE__ */ Q(S, {
|
|
4657
|
-
className:
|
|
4701
|
+
className: G("overflow-hidden", o),
|
|
4658
4702
|
children: [/* @__PURE__ */ Z(w, {
|
|
4659
4703
|
className: "pb-2",
|
|
4660
4704
|
children: /* @__PURE__ */ Q(T, {
|
|
@@ -4686,10 +4730,10 @@ var wr = {
|
|
|
4686
4730
|
children: p ? c === "unified" ? /* @__PURE__ */ Z("div", {
|
|
4687
4731
|
className: "font-mono text-xs overflow-x-auto",
|
|
4688
4732
|
children: f.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
4689
|
-
className:
|
|
4733
|
+
className: G("px-4 py-0.5 whitespace-pre-wrap border-l-2", Dr[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
|
|
4690
4734
|
children: [/* @__PURE__ */ Z("span", {
|
|
4691
4735
|
className: "select-none mr-2 inline-block w-3 text-center opacity-60",
|
|
4692
|
-
children:
|
|
4736
|
+
children: Or[e.type]
|
|
4693
4737
|
}), e.value]
|
|
4694
4738
|
}, t))
|
|
4695
4739
|
}) : /* @__PURE__ */ Z("div", {
|
|
@@ -4706,10 +4750,10 @@ var wr = {
|
|
|
4706
4750
|
children: s("detail.currentVersion")
|
|
4707
4751
|
}),
|
|
4708
4752
|
m.map((e, t) => /* @__PURE__ */ Q(i.Fragment, { children: [/* @__PURE__ */ Z("div", {
|
|
4709
|
-
className:
|
|
4753
|
+
className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? Dr[e.left.type] : "bg-muted/20"),
|
|
4710
4754
|
children: e.left?.value ?? ""
|
|
4711
4755
|
}), /* @__PURE__ */ Z("div", {
|
|
4712
|
-
className:
|
|
4756
|
+
className: G("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? Dr[e.right.type] : "bg-muted/20"),
|
|
4713
4757
|
children: e.right?.value ?? ""
|
|
4714
4758
|
})] }, t))
|
|
4715
4759
|
]
|
|
@@ -4720,7 +4764,7 @@ var wr = {
|
|
|
4720
4764
|
})
|
|
4721
4765
|
})]
|
|
4722
4766
|
});
|
|
4723
|
-
},
|
|
4767
|
+
}, Ar = ({ currentIndex: e, totalRecords: t, recordIds: n, onNavigate: r, onSearch: a, className: o }) => {
|
|
4724
4768
|
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
4769
|
p && r(n[0]);
|
|
4726
4770
|
}, [
|
|
@@ -4788,7 +4832,7 @@ var wr = {
|
|
|
4788
4832
|
r,
|
|
4789
4833
|
a
|
|
4790
4834
|
]), /* @__PURE__ */ Q("div", {
|
|
4791
|
-
className:
|
|
4835
|
+
className: G("flex items-center gap-1.5", o),
|
|
4792
4836
|
children: [
|
|
4793
4837
|
/* @__PURE__ */ Z(x, {
|
|
4794
4838
|
variant: "outline",
|
|
@@ -4833,7 +4877,7 @@ var wr = {
|
|
|
4833
4877
|
title: s("detail.lastRecord"),
|
|
4834
4878
|
children: /* @__PURE__ */ Z(Se, { className: "h-4 w-4" })
|
|
4835
4879
|
}),
|
|
4836
|
-
a && /* @__PURE__ */ Q(
|
|
4880
|
+
a && /* @__PURE__ */ Q(Et, { children: [/* @__PURE__ */ Z(x, {
|
|
4837
4881
|
variant: u ? "secondary" : "ghost",
|
|
4838
4882
|
size: "icon",
|
|
4839
4883
|
className: "h-8 w-8",
|
|
@@ -4853,18 +4897,18 @@ var wr = {
|
|
|
4853
4897
|
})] })
|
|
4854
4898
|
]
|
|
4855
4899
|
});
|
|
4856
|
-
},
|
|
4900
|
+
}, jr = 28, Mr = [
|
|
4857
4901
|
"fill-primary stroke-primary",
|
|
4858
4902
|
"fill-blue-500 stroke-blue-500",
|
|
4859
4903
|
"fill-emerald-500 stroke-emerald-500",
|
|
4860
4904
|
"fill-amber-500 stroke-amber-500"
|
|
4861
|
-
],
|
|
4905
|
+
], Nr = [
|
|
4862
4906
|
"fill-primary-foreground",
|
|
4863
4907
|
"fill-white",
|
|
4864
4908
|
"fill-white",
|
|
4865
4909
|
"fill-white"
|
|
4866
4910
|
];
|
|
4867
|
-
function
|
|
4911
|
+
function Pr(e, t, n, r, i) {
|
|
4868
4912
|
let a = [], o = [], s = /* @__PURE__ */ new Set(), c = r / 2, l = i / 2;
|
|
4869
4913
|
a.push({
|
|
4870
4914
|
id: e.id,
|
|
@@ -4928,10 +4972,10 @@ function jr(e, t, n, r, i) {
|
|
|
4928
4972
|
edges: o
|
|
4929
4973
|
};
|
|
4930
4974
|
}
|
|
4931
|
-
function
|
|
4975
|
+
function Fr(e, t = 6) {
|
|
4932
4976
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
4933
4977
|
}
|
|
4934
|
-
var
|
|
4978
|
+
var Ir = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, className: a }) => {
|
|
4935
4979
|
let o = i.useRef(null), [s, c] = i.useState({
|
|
4936
4980
|
width: 500,
|
|
4937
4981
|
height: 400
|
|
@@ -4952,14 +4996,14 @@ var Nr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
4952
4996
|
});
|
|
4953
4997
|
return n.observe(t), () => n.disconnect();
|
|
4954
4998
|
}, []);
|
|
4955
|
-
let { nodes: d, edges: f } = i.useMemo(() =>
|
|
4999
|
+
let { nodes: d, edges: f } = i.useMemo(() => Pr(e, t, n, s.width, s.height), [
|
|
4956
5000
|
e,
|
|
4957
5001
|
t,
|
|
4958
5002
|
n,
|
|
4959
5003
|
s
|
|
4960
5004
|
]);
|
|
4961
5005
|
return /* @__PURE__ */ Q(S, {
|
|
4962
|
-
className:
|
|
5006
|
+
className: G("overflow-hidden", a),
|
|
4963
5007
|
children: [/* @__PURE__ */ Z(w, {
|
|
4964
5008
|
className: "pb-2",
|
|
4965
5009
|
children: /* @__PURE__ */ Q(T, {
|
|
@@ -4994,9 +5038,9 @@ var Nr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
4994
5038
|
strokeWidth: 1.5,
|
|
4995
5039
|
strokeOpacity: .5
|
|
4996
5040
|
}, `edge-${t}`)), d.map((e) => {
|
|
4997
|
-
let t = l === e.id, n =
|
|
5041
|
+
let t = l === e.id, n = Mr[Math.min(e.level, Mr.length - 1)], i = Nr[Math.min(e.level, Nr.length - 1)], a = e.level === 0 ? 34 : jr;
|
|
4998
5042
|
return /* @__PURE__ */ Q("g", {
|
|
4999
|
-
className:
|
|
5043
|
+
className: G("cursor-pointer transition-transform", r && "hover:opacity-80"),
|
|
5000
5044
|
onClick: () => r?.(e.id),
|
|
5001
5045
|
onMouseEnter: () => u(e.id),
|
|
5002
5046
|
onMouseLeave: () => u(null),
|
|
@@ -5015,8 +5059,8 @@ var Nr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5015
5059
|
y: e.y,
|
|
5016
5060
|
textAnchor: "middle",
|
|
5017
5061
|
dominantBaseline: "central",
|
|
5018
|
-
className:
|
|
5019
|
-
children:
|
|
5062
|
+
className: G("text-[10px] font-medium pointer-events-none", i),
|
|
5063
|
+
children: Fr(e.label)
|
|
5020
5064
|
}),
|
|
5021
5065
|
e.type && /* @__PURE__ */ Z("text", {
|
|
5022
5066
|
x: e.x,
|
|
@@ -5025,7 +5069,7 @@ var Nr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5025
5069
|
className: "fill-muted-foreground text-[9px] pointer-events-none",
|
|
5026
5070
|
children: e.type
|
|
5027
5071
|
}),
|
|
5028
|
-
t && /* @__PURE__ */ Q(
|
|
5072
|
+
t && /* @__PURE__ */ Q(Et, { children: [/* @__PURE__ */ Z("rect", {
|
|
5029
5073
|
x: e.x - 50,
|
|
5030
5074
|
y: e.y - a - 28,
|
|
5031
5075
|
width: 100,
|
|
@@ -5050,7 +5094,7 @@ var Nr = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5050
5094
|
};
|
|
5051
5095
|
//#endregion
|
|
5052
5096
|
//#region src/PointInTimeRestore.tsx
|
|
5053
|
-
function
|
|
5097
|
+
function Lr(e) {
|
|
5054
5098
|
try {
|
|
5055
5099
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
5056
5100
|
if (r < 1) return "just now";
|
|
@@ -5061,7 +5105,7 @@ function Pr(e) {
|
|
|
5061
5105
|
return e;
|
|
5062
5106
|
}
|
|
5063
5107
|
}
|
|
5064
|
-
var
|
|
5108
|
+
var Rr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
5065
5109
|
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
5110
|
if (!(!d || !n)) {
|
|
5067
5111
|
if (!s) {
|
|
@@ -5084,13 +5128,13 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5084
5128
|
c(!1);
|
|
5085
5129
|
}, []);
|
|
5086
5130
|
return /* @__PURE__ */ Q(S, {
|
|
5087
|
-
className:
|
|
5131
|
+
className: G("", r),
|
|
5088
5132
|
children: [/* @__PURE__ */ Z(w, {
|
|
5089
5133
|
className: "pb-3",
|
|
5090
5134
|
children: /* @__PURE__ */ Q(T, {
|
|
5091
5135
|
className: "flex items-center gap-2 text-base",
|
|
5092
5136
|
children: [
|
|
5093
|
-
/* @__PURE__ */ Z(
|
|
5137
|
+
/* @__PURE__ */ Z(Y, { className: "h-4 w-4" }),
|
|
5094
5138
|
"Revision History",
|
|
5095
5139
|
/* @__PURE__ */ Q("span", {
|
|
5096
5140
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -5117,12 +5161,12 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5117
5161
|
let t = e.id === a;
|
|
5118
5162
|
return /* @__PURE__ */ Q("button", {
|
|
5119
5163
|
type: "button",
|
|
5120
|
-
className:
|
|
5164
|
+
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
5165
|
onClick: () => {
|
|
5122
5166
|
o(e.id), c(!1);
|
|
5123
5167
|
},
|
|
5124
5168
|
children: [/* @__PURE__ */ Z("div", {
|
|
5125
|
-
className:
|
|
5169
|
+
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
5170
|
children: t && /* @__PURE__ */ Z(be, { className: "h-3 w-3 text-primary-foreground" })
|
|
5127
5171
|
}), /* @__PURE__ */ Q("div", {
|
|
5128
5172
|
className: "flex-1 min-w-0",
|
|
@@ -5133,7 +5177,7 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5133
5177
|
children: e.user
|
|
5134
5178
|
}), /* @__PURE__ */ Z("span", {
|
|
5135
5179
|
className: "text-xs text-muted-foreground",
|
|
5136
|
-
children:
|
|
5180
|
+
children: Lr(e.timestamp)
|
|
5137
5181
|
})]
|
|
5138
5182
|
}), /* @__PURE__ */ Q("p", {
|
|
5139
5183
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
@@ -5155,7 +5199,7 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5155
5199
|
children: [
|
|
5156
5200
|
/* @__PURE__ */ Q("div", {
|
|
5157
5201
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
5158
|
-
children: [/* @__PURE__ */ Z(
|
|
5202
|
+
children: [/* @__PURE__ */ Z(Oe, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
|
|
5159
5203
|
}),
|
|
5160
5204
|
/* @__PURE__ */ Z("div", {
|
|
5161
5205
|
className: "space-y-2",
|
|
@@ -5201,12 +5245,12 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5201
5245
|
}),
|
|
5202
5246
|
n && /* @__PURE__ */ Z("div", {
|
|
5203
5247
|
className: "pt-1 space-y-2",
|
|
5204
|
-
children: s ? /* @__PURE__ */ Q(
|
|
5248
|
+
children: s ? /* @__PURE__ */ Q(Et, { children: [/* @__PURE__ */ Q("p", {
|
|
5205
5249
|
className: "text-xs text-amber-600 dark:text-amber-400",
|
|
5206
5250
|
children: [
|
|
5207
5251
|
"This will restore the record to its state at",
|
|
5208
5252
|
" ",
|
|
5209
|
-
|
|
5253
|
+
Lr(d.timestamp),
|
|
5210
5254
|
". Continue?"
|
|
5211
5255
|
]
|
|
5212
5256
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -5237,7 +5281,7 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5237
5281
|
})]
|
|
5238
5282
|
}) })]
|
|
5239
5283
|
});
|
|
5240
|
-
},
|
|
5284
|
+
}, zr = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: n = !1, className: r }) => {
|
|
5241
5285
|
let [a, o] = i.useState(""), [s, c] = i.useState(!1), l = i.useCallback(async () => {
|
|
5242
5286
|
let t = a.trim();
|
|
5243
5287
|
if (t) {
|
|
@@ -5252,7 +5296,7 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5252
5296
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), l());
|
|
5253
5297
|
}, [l]);
|
|
5254
5298
|
return /* @__PURE__ */ Q("div", {
|
|
5255
|
-
className:
|
|
5299
|
+
className: G("flex gap-2", r),
|
|
5256
5300
|
children: [/* @__PURE__ */ Z("textarea", {
|
|
5257
5301
|
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
5302
|
placeholder: t,
|
|
@@ -5270,21 +5314,21 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5270
5314
|
children: /* @__PURE__ */ Z(Ze, { className: "h-4 w-4" })
|
|
5271
5315
|
})]
|
|
5272
5316
|
});
|
|
5273
|
-
},
|
|
5317
|
+
}, Br = ({ query: e, suggestions: t, onSelect: n, visible: r = !0, activeIndex: a = 0, className: o }) => {
|
|
5274
5318
|
let s = i.useMemo(() => {
|
|
5275
5319
|
if (!e) return t;
|
|
5276
5320
|
let n = e.toLowerCase();
|
|
5277
5321
|
return t.filter((e) => e.name.toLowerCase().includes(n) || e.id.toLowerCase().includes(n));
|
|
5278
5322
|
}, [e, t]);
|
|
5279
5323
|
return !r || s.length === 0 ? null : /* @__PURE__ */ Z("div", {
|
|
5280
|
-
className:
|
|
5324
|
+
className: G("bg-popover border rounded-md shadow-md z-50 max-h-48 overflow-y-auto w-56", o),
|
|
5281
5325
|
role: "listbox",
|
|
5282
5326
|
"aria-label": "Mention suggestions",
|
|
5283
5327
|
children: s.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
5284
5328
|
type: "button",
|
|
5285
5329
|
role: "option",
|
|
5286
5330
|
"aria-selected": t === a,
|
|
5287
|
-
className:
|
|
5331
|
+
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
5332
|
onMouseDown: (t) => {
|
|
5289
5333
|
t.preventDefault(), n(e);
|
|
5290
5334
|
},
|
|
@@ -5312,7 +5356,7 @@ var Fr = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5312
5356
|
}, e.id))
|
|
5313
5357
|
});
|
|
5314
5358
|
};
|
|
5315
|
-
function
|
|
5359
|
+
function Vr(e, t, n) {
|
|
5316
5360
|
return {
|
|
5317
5361
|
type: e.type,
|
|
5318
5362
|
id: e.id,
|
|
@@ -5323,7 +5367,7 @@ function Rr(e, t, n) {
|
|
|
5323
5367
|
}
|
|
5324
5368
|
//#endregion
|
|
5325
5369
|
//#region src/extractMentions.ts
|
|
5326
|
-
function
|
|
5370
|
+
function Hr(e, t) {
|
|
5327
5371
|
if (!e || !t.length) return [];
|
|
5328
5372
|
let n = [...t].sort((e, t) => t.label.length - e.label.length), r = e, i = /* @__PURE__ */ new Set();
|
|
5329
5373
|
for (let e of n) {
|
|
@@ -5335,26 +5379,28 @@ function zr(e, t) {
|
|
|
5335
5379
|
}
|
|
5336
5380
|
//#endregion
|
|
5337
5381
|
//#region src/synth/buildDefaultPageSchema.ts
|
|
5338
|
-
function
|
|
5382
|
+
function Ur(e) {
|
|
5339
5383
|
return e == null ? [] : Array.isArray(e) ? e.filter((e) => e != null) : [e];
|
|
5340
5384
|
}
|
|
5341
|
-
function
|
|
5385
|
+
function Wr(e) {
|
|
5342
5386
|
if (!e) return null;
|
|
5343
|
-
|
|
5344
|
-
|
|
5387
|
+
let t = e.stageField;
|
|
5388
|
+
if (t === !1) return null;
|
|
5389
|
+
if (typeof t == "string" && t) return t;
|
|
5390
|
+
let n = e.fields || {};
|
|
5345
5391
|
for (let e of [
|
|
5346
5392
|
"status",
|
|
5347
5393
|
"stage",
|
|
5348
5394
|
"state",
|
|
5349
5395
|
"phase"
|
|
5350
|
-
]) if (e in
|
|
5351
|
-
for (let [e,
|
|
5352
|
-
let
|
|
5353
|
-
if (
|
|
5396
|
+
]) if (e in n) return e;
|
|
5397
|
+
for (let [e, t] of Object.entries(n)) {
|
|
5398
|
+
let n = (t?.type || "").toLowerCase();
|
|
5399
|
+
if (n === "status" || n === "stage") return e;
|
|
5354
5400
|
}
|
|
5355
5401
|
return null;
|
|
5356
5402
|
}
|
|
5357
|
-
function
|
|
5403
|
+
function Gr(e, t) {
|
|
5358
5404
|
if (!e || !t) return null;
|
|
5359
5405
|
let n = e.fields?.[t]?.options;
|
|
5360
5406
|
return !Array.isArray(n) || n.length === 0 ? null : n.map((e) => ({
|
|
@@ -5362,10 +5408,11 @@ function Hr(e, t) {
|
|
|
5362
5408
|
label: e.label
|
|
5363
5409
|
}));
|
|
5364
5410
|
}
|
|
5365
|
-
function
|
|
5411
|
+
function Kr(e, t, n = 4) {
|
|
5366
5412
|
if (!e) return [];
|
|
5367
|
-
|
|
5368
|
-
|
|
5413
|
+
let r = Array.isArray(e.highlightFields) && e.highlightFields.length > 0 ? e.highlightFields : null;
|
|
5414
|
+
if (r) return r.filter((e) => typeof e == "string" && e.length > 0).slice(0, n);
|
|
5415
|
+
let i = /* @__PURE__ */ new Set([
|
|
5369
5416
|
"id",
|
|
5370
5417
|
"_id",
|
|
5371
5418
|
"created_at",
|
|
@@ -5379,15 +5426,15 @@ function Ur(e, t, n = 4) {
|
|
|
5379
5426
|
"tenant_id",
|
|
5380
5427
|
"org_id"
|
|
5381
5428
|
]);
|
|
5382
|
-
t &&
|
|
5429
|
+
t && i.add(t), e.primaryField && i.add(e.primaryField), e.nameField && i.add(e.nameField), e.displayNameField && i.add(e.displayNameField);
|
|
5383
5430
|
for (let t of [
|
|
5384
5431
|
"name",
|
|
5385
5432
|
"full_name",
|
|
5386
5433
|
"title",
|
|
5387
5434
|
"subject",
|
|
5388
5435
|
"display_name"
|
|
5389
|
-
]) t in (e.fields || {}) &&
|
|
5390
|
-
let
|
|
5436
|
+
]) t in (e.fields || {}) && i.add(t);
|
|
5437
|
+
let a = [
|
|
5391
5438
|
"owner",
|
|
5392
5439
|
"owner_id",
|
|
5393
5440
|
"amount",
|
|
@@ -5405,7 +5452,7 @@ function Ur(e, t, n = 4) {
|
|
|
5405
5452
|
"account_id",
|
|
5406
5453
|
"contact",
|
|
5407
5454
|
"contact_id"
|
|
5408
|
-
],
|
|
5455
|
+
], o = /* @__PURE__ */ new Set([
|
|
5409
5456
|
"currency",
|
|
5410
5457
|
"number",
|
|
5411
5458
|
"integer",
|
|
@@ -5427,31 +5474,31 @@ function Ur(e, t, n = 4) {
|
|
|
5427
5474
|
"url",
|
|
5428
5475
|
"text",
|
|
5429
5476
|
"string"
|
|
5430
|
-
]),
|
|
5431
|
-
for (let e of
|
|
5432
|
-
for (let e of Object.keys(
|
|
5433
|
-
if (
|
|
5434
|
-
let t =
|
|
5435
|
-
if (!(t && !
|
|
5477
|
+
]), s = [], c = e.fields || {};
|
|
5478
|
+
for (let e of a) if (e in c && !i.has(e) && s.push(e), s.length >= n) return s;
|
|
5479
|
+
for (let e of Object.keys(c)) {
|
|
5480
|
+
if (s.includes(e) || i.has(e)) continue;
|
|
5481
|
+
let t = c[e]?.type;
|
|
5482
|
+
if (!(t && !o.has(t)) && (s.push(e), s.length >= n)) break;
|
|
5436
5483
|
}
|
|
5437
|
-
return
|
|
5484
|
+
return s;
|
|
5438
5485
|
}
|
|
5439
|
-
function
|
|
5486
|
+
function qr(e, t = {}) {
|
|
5440
5487
|
return {
|
|
5441
5488
|
type: "page:header",
|
|
5442
5489
|
recordChrome: t.recordChrome !== !1,
|
|
5443
5490
|
...Array.isArray(t.actions) && t.actions.length > 0 ? { actions: t.actions } : {}
|
|
5444
5491
|
};
|
|
5445
5492
|
}
|
|
5446
|
-
function
|
|
5493
|
+
function Jr(e, t) {
|
|
5447
5494
|
return !Array.isArray(t) || t.length === 0 ? null : {
|
|
5448
5495
|
type: "record:quick_actions",
|
|
5449
5496
|
actions: t,
|
|
5450
5497
|
location: "record_header"
|
|
5451
5498
|
};
|
|
5452
5499
|
}
|
|
5453
|
-
function
|
|
5454
|
-
let n = t.statusField ??
|
|
5500
|
+
function Yr(e, t = {}) {
|
|
5501
|
+
let n = t.statusField ?? Wr(e), r = t.stages ?? (n ? Gr(e, n) : null), i = t.highlightFields ?? Kr(e, n), a = [];
|
|
5455
5502
|
return !t.hideHighlights && i.length > 0 && a.push({
|
|
5456
5503
|
type: "record:highlights",
|
|
5457
5504
|
fields: i
|
|
@@ -5461,17 +5508,46 @@ function Kr(e, t = {}) {
|
|
|
5461
5508
|
stages: r
|
|
5462
5509
|
}), a;
|
|
5463
5510
|
}
|
|
5464
|
-
function
|
|
5511
|
+
function Xr(e) {
|
|
5512
|
+
if (!e) return null;
|
|
5513
|
+
let t = Nt(e);
|
|
5514
|
+
if (!t) return null;
|
|
5515
|
+
let n = e.fields || {}, r = (e) => {
|
|
5516
|
+
let t = n[e] || {};
|
|
5517
|
+
return {
|
|
5518
|
+
name: e,
|
|
5519
|
+
label: t.label || e,
|
|
5520
|
+
type: t.type || "text",
|
|
5521
|
+
...t.options ? { options: t.options } : {},
|
|
5522
|
+
...t.reference_to || t.reference ? { reference_to: t.reference_to || t.reference } : {},
|
|
5523
|
+
...t.reference_field ? { reference_field: t.reference_field } : {},
|
|
5524
|
+
...t.currency ? { currency: t.currency } : {}
|
|
5525
|
+
};
|
|
5526
|
+
};
|
|
5527
|
+
return t.map((e) => ({
|
|
5528
|
+
...e.key === void 0 ? {} : {
|
|
5529
|
+
name: e.key,
|
|
5530
|
+
title: e.label ?? e.key
|
|
5531
|
+
},
|
|
5532
|
+
...e.collapse === "none" ? {} : { collapsible: !0 },
|
|
5533
|
+
...e.collapse === "collapsed" ? { defaultCollapsed: !0 } : {},
|
|
5534
|
+
fields: e.fields.map(r)
|
|
5535
|
+
}));
|
|
5536
|
+
}
|
|
5537
|
+
function Zr(e, t) {
|
|
5538
|
+
return Array.isArray(t) && t.length > 0 ? t : Xr(e) ?? void 0;
|
|
5539
|
+
}
|
|
5540
|
+
function Qr(e, t, n) {
|
|
5465
5541
|
return {
|
|
5466
5542
|
type: "record:details",
|
|
5467
|
-
sections: t,
|
|
5543
|
+
sections: Zr(e, t),
|
|
5468
5544
|
...n && n.length > 0 ? { hideFields: n } : {}
|
|
5469
5545
|
};
|
|
5470
5546
|
}
|
|
5471
|
-
function
|
|
5472
|
-
let n = t.statusField ??
|
|
5547
|
+
function $r(e, t = {}) {
|
|
5548
|
+
let n = t.statusField ?? Wr(e), r = t.highlightFields ?? Kr(e, n), i = [{
|
|
5473
5549
|
label: "Details",
|
|
5474
|
-
children: [
|
|
5550
|
+
children: [Qr(e, t.sections, r)]
|
|
5475
5551
|
}];
|
|
5476
5552
|
if (!t.hideRelatedTab && Array.isArray(t.related) && t.related.length > 0) {
|
|
5477
5553
|
let e = (e) => ({
|
|
@@ -5482,16 +5558,24 @@ function Jr(e, t = {}) {
|
|
|
5482
5558
|
...e.columns ? { columns: e.columns } : {},
|
|
5483
5559
|
...e.limit ? { limit: e.limit } : {},
|
|
5484
5560
|
...e.icon ? { icon: e.icon } : {}
|
|
5561
|
+
}), n = (t) => ({
|
|
5562
|
+
label: t.title || t.objectName,
|
|
5563
|
+
...t.icon ? { icon: t.icon } : {},
|
|
5564
|
+
children: [e(t)]
|
|
5485
5565
|
});
|
|
5486
|
-
if (t.relatedLayout === "tabs") for (let
|
|
5487
|
-
|
|
5488
|
-
...n.icon ? { icon: n.icon } : {},
|
|
5489
|
-
children: [e(n)]
|
|
5490
|
-
});
|
|
5491
|
-
else i.push({
|
|
5566
|
+
if (t.relatedLayout === "tabs") for (let e of t.related) i.push(n(e));
|
|
5567
|
+
else if (t.relatedLayout === "stack") i.push({
|
|
5492
5568
|
label: "Related",
|
|
5493
5569
|
children: t.related.map(e)
|
|
5494
5570
|
});
|
|
5571
|
+
else {
|
|
5572
|
+
let r = t.related.filter((e) => e.isPrimary), a = t.related.filter((e) => !e.isPrimary);
|
|
5573
|
+
for (let e of r) i.push(n(e));
|
|
5574
|
+
a.length > 0 && i.push({
|
|
5575
|
+
label: "Related",
|
|
5576
|
+
children: a.map(e)
|
|
5577
|
+
});
|
|
5578
|
+
}
|
|
5495
5579
|
}
|
|
5496
5580
|
return t.showActivity && i.push({
|
|
5497
5581
|
label: "Activity",
|
|
@@ -5509,15 +5593,15 @@ function Jr(e, t = {}) {
|
|
|
5509
5593
|
items: i
|
|
5510
5594
|
};
|
|
5511
5595
|
}
|
|
5512
|
-
function
|
|
5596
|
+
function ei() {
|
|
5513
5597
|
return { type: "record:discussion" };
|
|
5514
5598
|
}
|
|
5515
|
-
function
|
|
5599
|
+
function ti(e, t = {}) {
|
|
5516
5600
|
let n = t.slots || {}, r = [];
|
|
5517
|
-
"header" in n && n.header !== void 0 ? r.push(...
|
|
5601
|
+
"header" in n && n.header !== void 0 ? r.push(...Ur(n.header)) : r.push(qr(e, {
|
|
5518
5602
|
recordChrome: t.recordChrome,
|
|
5519
5603
|
actions: t.headerActions
|
|
5520
|
-
})), "actions" in n && n.actions !== void 0 && r.push(...
|
|
5604
|
+
})), "actions" in n && n.actions !== void 0 && r.push(...Ur(n.actions)), "alerts" in n && n.alerts !== void 0 && r.push(...Ur(n.alerts)), "highlights" in n && n.highlights !== void 0 ? r.push(...Ur(n.highlights)) : r.push(...Yr(e, {
|
|
5521
5605
|
highlightFields: t.highlightFields,
|
|
5522
5606
|
statusField: t.statusField,
|
|
5523
5607
|
stages: t.stages,
|
|
@@ -5525,9 +5609,9 @@ function Xr(e, t = {}) {
|
|
|
5525
5609
|
hidePath: t.hidePath
|
|
5526
5610
|
}));
|
|
5527
5611
|
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(...
|
|
5612
|
+
if ("tabs" in n && n.tabs !== void 0) r.push(...Ur(n.tabs));
|
|
5529
5613
|
else if ("details" in n && n.details !== void 0) {
|
|
5530
|
-
let i =
|
|
5614
|
+
let i = Ur(n.details), o = $r(e, {
|
|
5531
5615
|
sections: t.sections,
|
|
5532
5616
|
related: t.related,
|
|
5533
5617
|
showActivity: t.showActivity,
|
|
@@ -5541,7 +5625,7 @@ function Xr(e, t = {}) {
|
|
|
5541
5625
|
...o.items[0],
|
|
5542
5626
|
children: i
|
|
5543
5627
|
}), r.push(o);
|
|
5544
|
-
} else r.push(
|
|
5628
|
+
} else r.push($r(e, {
|
|
5545
5629
|
sections: t.sections,
|
|
5546
5630
|
related: t.related,
|
|
5547
5631
|
showActivity: t.showActivity,
|
|
@@ -5551,12 +5635,12 @@ function Xr(e, t = {}) {
|
|
|
5551
5635
|
hideRelatedTab: a,
|
|
5552
5636
|
relatedLayout: t.relatedLayout
|
|
5553
5637
|
}));
|
|
5554
|
-
"discussion" in n && n.discussion !== void 0 ? r.push(...
|
|
5638
|
+
"discussion" in n && n.discussion !== void 0 ? r.push(...Ur(n.discussion)) : t.hideDiscussion || r.push(ei());
|
|
5555
5639
|
let o = [{
|
|
5556
5640
|
name: "main",
|
|
5557
5641
|
width: "full",
|
|
5558
5642
|
components: r
|
|
5559
|
-
}], s =
|
|
5643
|
+
}], s = Ur(n.rightRail);
|
|
5560
5644
|
if (i || s.length > 0) {
|
|
5561
5645
|
let e = [];
|
|
5562
5646
|
i && e.push({
|
|
@@ -5584,7 +5668,7 @@ function Xr(e, t = {}) {
|
|
|
5584
5668
|
regions: o
|
|
5585
5669
|
};
|
|
5586
5670
|
}
|
|
5587
|
-
e.register("detail-view",
|
|
5671
|
+
e.register("detail-view", xn, {
|
|
5588
5672
|
namespace: "plugin-detail",
|
|
5589
5673
|
label: "Detail View",
|
|
5590
5674
|
category: "Views",
|
|
@@ -5714,7 +5798,7 @@ e.register("detail-view", yn, {
|
|
|
5714
5798
|
tabs: [],
|
|
5715
5799
|
related: []
|
|
5716
5800
|
}
|
|
5717
|
-
}), e.register("detail-section",
|
|
5801
|
+
}), e.register("detail-section", Wt, {
|
|
5718
5802
|
namespace: "plugin-detail",
|
|
5719
5803
|
label: "Detail Section",
|
|
5720
5804
|
category: "Detail Components",
|
|
@@ -5765,7 +5849,7 @@ e.register("detail-view", yn, {
|
|
|
5765
5849
|
label: "Header Color"
|
|
5766
5850
|
}
|
|
5767
5851
|
]
|
|
5768
|
-
}), e.register("related-list",
|
|
5852
|
+
}), e.register("related-list", qt, {
|
|
5769
5853
|
namespace: "plugin-detail",
|
|
5770
5854
|
label: "Related List",
|
|
5771
5855
|
category: "Detail Components",
|
|
@@ -5812,7 +5896,7 @@ e.register("detail-view", yn, {
|
|
|
5812
5896
|
label: "Columns"
|
|
5813
5897
|
}
|
|
5814
5898
|
]
|
|
5815
|
-
}), e.register("detail",
|
|
5899
|
+
}), e.register("detail", xn, {
|
|
5816
5900
|
namespace: "view",
|
|
5817
5901
|
category: "view",
|
|
5818
5902
|
label: "Detail",
|
|
@@ -5835,7 +5919,7 @@ e.register("detail-view", yn, {
|
|
|
5835
5919
|
label: "Fields"
|
|
5836
5920
|
}
|
|
5837
5921
|
]
|
|
5838
|
-
}), e.register("record:details",
|
|
5922
|
+
}), e.register("record:details", On, {
|
|
5839
5923
|
namespace: "record",
|
|
5840
5924
|
category: "record",
|
|
5841
5925
|
label: "Record Details",
|
|
@@ -5860,7 +5944,7 @@ e.register("detail-view", yn, {
|
|
|
5860
5944
|
label: "Layout",
|
|
5861
5945
|
enum: ["auto", "custom"],
|
|
5862
5946
|
defaultValue: "auto",
|
|
5863
|
-
description: "auto uses the object
|
|
5947
|
+
description: "auto uses the object highlightFields; custom uses explicit sections"
|
|
5864
5948
|
},
|
|
5865
5949
|
{
|
|
5866
5950
|
name: "sections",
|
|
@@ -5872,10 +5956,10 @@ e.register("detail-view", yn, {
|
|
|
5872
5956
|
name: "fields",
|
|
5873
5957
|
type: "array",
|
|
5874
5958
|
label: "Fields",
|
|
5875
|
-
description: "Explicit field list (overrides
|
|
5959
|
+
description: "Explicit field list (overrides highlightFields)"
|
|
5876
5960
|
}
|
|
5877
5961
|
]
|
|
5878
|
-
}), e.register("record:related_list",
|
|
5962
|
+
}), e.register("record:related_list", Mn, {
|
|
5879
5963
|
namespace: "record",
|
|
5880
5964
|
category: "record",
|
|
5881
5965
|
label: "Related List",
|
|
@@ -5938,7 +6022,7 @@ e.register("detail-view", yn, {
|
|
|
5938
6022
|
description: "Action IDs available for related records"
|
|
5939
6023
|
}
|
|
5940
6024
|
]
|
|
5941
|
-
}), e.register("record:highlights",
|
|
6025
|
+
}), e.register("record:highlights", Pn, {
|
|
5942
6026
|
namespace: "record",
|
|
5943
6027
|
category: "record",
|
|
5944
6028
|
label: "Highlights Panel",
|
|
@@ -5957,22 +6041,22 @@ e.register("detail-view", yn, {
|
|
|
5957
6041
|
defaultValue: "horizontal",
|
|
5958
6042
|
description: "Layout orientation for highlight fields"
|
|
5959
6043
|
}]
|
|
5960
|
-
}), e.register("record:activity",
|
|
6044
|
+
}), e.register("record:activity", er, {
|
|
5961
6045
|
namespace: "record",
|
|
5962
6046
|
category: "record",
|
|
5963
6047
|
label: "Activity Timeline",
|
|
5964
6048
|
icon: "Activity"
|
|
5965
|
-
}), e.register("record:chatter",
|
|
6049
|
+
}), e.register("record:chatter", rr, {
|
|
5966
6050
|
namespace: "record",
|
|
5967
6051
|
category: "record",
|
|
5968
6052
|
label: "Chatter Feed",
|
|
5969
6053
|
icon: "MessageSquare"
|
|
5970
|
-
}), e.register("record:discussion",
|
|
6054
|
+
}), e.register("record:discussion", rr, {
|
|
5971
6055
|
namespace: "record",
|
|
5972
6056
|
category: "record",
|
|
5973
6057
|
label: "Discussion",
|
|
5974
6058
|
icon: "MessageSquare"
|
|
5975
|
-
}), e.register("record:path",
|
|
6059
|
+
}), e.register("record:path", ar, {
|
|
5976
6060
|
namespace: "record",
|
|
5977
6061
|
category: "record",
|
|
5978
6062
|
label: "Path / Stepper",
|
|
@@ -5989,26 +6073,26 @@ e.register("detail-view", yn, {
|
|
|
5989
6073
|
label: "Stages",
|
|
5990
6074
|
description: "Explicit stage definitions [{ value, label }] (else derived from field metadata)"
|
|
5991
6075
|
}]
|
|
5992
|
-
}), e.register("record:quick_actions",
|
|
6076
|
+
}), e.register("record:quick_actions", sr, {
|
|
5993
6077
|
namespace: "record",
|
|
5994
6078
|
category: "record",
|
|
5995
6079
|
label: "Quick Actions",
|
|
5996
6080
|
icon: "Zap"
|
|
5997
|
-
}), e.register("record:history",
|
|
6081
|
+
}), e.register("record:history", dr, {
|
|
5998
6082
|
namespace: "record",
|
|
5999
6083
|
category: "record",
|
|
6000
6084
|
label: "History Timeline",
|
|
6001
6085
|
icon: "Clock"
|
|
6002
|
-
}), e.register("record:reference_rail",
|
|
6086
|
+
}), e.register("record:reference_rail", hr, {
|
|
6003
6087
|
namespace: "record",
|
|
6004
6088
|
category: "record",
|
|
6005
6089
|
label: "Reference Rail",
|
|
6006
6090
|
icon: "PanelRight"
|
|
6007
|
-
}), e.register("record:alert",
|
|
6091
|
+
}), e.register("record:alert", vr, {
|
|
6008
6092
|
namespace: "record",
|
|
6009
6093
|
category: "record",
|
|
6010
6094
|
label: "Alert Banner",
|
|
6011
6095
|
icon: "AlertTriangle"
|
|
6012
6096
|
});
|
|
6013
6097
|
//#endregion
|
|
6014
|
-
export {
|
|
6098
|
+
export { rn as ActivityTimeline, Kn as CommentAttachment, zr as CommentInput, wn as ConcurrentUpdateDialog, Bt as DETAIL_DEFAULT_TRANSLATIONS, Wt as DetailSection, Gt as DetailTabs, xn as DetailView, kr as DiffView, Fn as FieldChangeItem, Yt as HeaderHighlight, dn as HistoryTimeline, wr as InlineCreateRelated, Br as MentionAutocomplete, Rr as PointInTimeRestore, Ln as ReactionPicker, er as RecordActivityRenderer, Qn as RecordActivityTimeline, vr as RecordAlertRenderer, tr as RecordChatterPanel, rr as RecordChatterRenderer, Zt as RecordComments, Sr as RecordDetailDrawer, On as RecordDetailsRenderer, Pn as RecordHighlightsRenderer, dr as RecordHistoryRenderer, vn as RecordMetaFooter, Ar as RecordNavigationEnhanced, ar as RecordPathRenderer, sr as RecordQuickActionsRenderer, hr as RecordReferenceRailRenderer, Mn as RecordRelatedListRenderer, qt as RelatedList, Ir as RelationshipGraph, Hn as RichTextCommentInput, Jt as SectionGroup, Bn as SubscriptionToggle, zn as ThreadedReplies, Lt as applyAutoSpan, Rt as applyDetailAutoLayout, Jr as buildDefaultActions, Qr as buildDefaultDetails, ei as buildDefaultDiscussion, qr as buildDefaultHeader, Yr as buildDefaultHighlights, ti as buildDefaultPageSchema, $r as buildDefaultTabs, Vr as createMentionFromSuggestion, zt as createSafeTranslationHook, Xr as deriveFieldGroupDetailSections, Kr as deriveHighlightFields, Cr as deriveRecordPageHref, Gr as deriveStages, Wr as detectStatusField, Hr as extractMentions, It as inferDetailColumns, Tn as isConcurrentUpdateError, Ft as isWideFieldType, Zr as resolveDetailSections, $ as useDetailTranslation };
|