@object-ui/plugin-detail 4.7.0 → 5.0.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 +391 -0
- package/dist/index.js +961 -631
- package/dist/index.umd.cjs +3 -3
- package/dist/packages/plugin-detail/src/DetailSection.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/DetailView.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/HeaderHighlight.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/HistoryTimeline.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/RecordActivityTimeline.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/RelatedList.d.ts +9 -0
- package/dist/packages/plugin-detail/src/RelatedList.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/autoLayout.d.ts +4 -6
- package/dist/packages/plugin-detail/src/autoLayout.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/index.d.ts +4 -1
- package/dist/packages/plugin-detail/src/index.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/renderers/record-chatter.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/renderers/record-details.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/renderers/record-highlights.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/renderers/record-history.d.ts +16 -0
- package/dist/packages/plugin-detail/src/renderers/record-history.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/renderers/record-path.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/renderers/record-related-list.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/synth/buildDefaultPageSchema.d.ts +238 -0
- package/dist/packages/plugin-detail/src/synth/buildDefaultPageSchema.d.ts.map +1 -0
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ComponentRegistry as e, buildExpandFields as t } from "@object-ui/core";
|
|
2
2
|
import * as n from "react";
|
|
3
3
|
import r from "react";
|
|
4
|
-
import { AlertDialog as i, AlertDialogAction as a, AlertDialogCancel as o, AlertDialogContent as s, AlertDialogDescription as c, AlertDialogFooter as l, AlertDialogHeader as u, AlertDialogTitle as d, Avatar as f, AvatarFallback as p, AvatarImage as m, Badge as h, Button as g, Card as _, CardContent as v, CardHeader as y, CardTitle as b, Collapsible as x, CollapsibleContent as S, CollapsibleTrigger as C, Input as w, Sheet as T, SheetContent as E, SheetHeader as D, SheetTitle as O, Skeleton as k, Tabs as A, TabsContent as j, TabsList as ee, TabsTrigger as M, Tooltip as N, TooltipContent as P, TooltipProvider as F, TooltipTrigger as I, cn as L, useIsMobile as
|
|
5
|
-
import { Activity as
|
|
6
|
-
import { SchemaRenderer as
|
|
7
|
-
import { BooleanField as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { useFieldPermissions as
|
|
4
|
+
import { AlertDialog as i, AlertDialogAction as a, AlertDialogCancel as o, AlertDialogContent as s, AlertDialogDescription as c, AlertDialogFooter as l, AlertDialogHeader as u, AlertDialogTitle as d, Avatar as f, AvatarFallback as p, AvatarImage as m, Badge as h, Button as g, Card as _, CardContent as v, CardHeader as y, CardTitle as b, Collapsible as x, CollapsibleContent as S, CollapsibleTrigger as C, Input as w, Sheet as T, SheetContent as E, SheetHeader as D, SheetTitle as O, Skeleton as k, Tabs as A, TabsContent as j, TabsList as ee, TabsTrigger as M, Tooltip as N, TooltipContent as P, TooltipProvider as F, TooltipTrigger as I, cn as L, useIsMobile as te } from "@object-ui/components";
|
|
5
|
+
import { Activity as ne, ArrowLeft as R, ArrowRight as z, ArrowRightLeft as B, ArrowUpDown as re, AtSign as V, Bell as H, BellOff as ie, Bold as U, Calendar as ae, Check as W, CheckSquare as oe, ChevronDown as se, ChevronLeft as ce, ChevronRight as le, ChevronsLeft as ue, ChevronsRight as de, Code as fe, Columns2 as pe, Copy as me, Edit as he, ExternalLink as ge, Eye as G, EyeOff as _e, File as ve, FileArchive as ye, FileText as K, History as be, Image as xe, Inbox as Se, Italic as q, Link as Ce, List as we, Loader2 as Te, Mail as Ee, MessageSquare as J, Network as De, PanelRightClose as Oe, PanelRightOpen as ke, Paperclip as Y, Phone as Ae, Pin as je, Plus as Me, PlusCircle as Ne, RotateCcw as Pe, Rows3 as Fe, Search as Ie, Send as X, SmilePlus as Le, Star as Re, Trash2 as ze, Upload as Be, X as Ve, Zap as He, icons as Ue } from "lucide-react";
|
|
6
|
+
import { SchemaRenderer as We, useActionEngine as Ge, useDiscussionContext as Ke, useHighlightFieldNames as qe, useObjectTranslation as Je, useRecordContext as Ye, useRegisterHighlightFields as Xe, useSafeFieldLabel as Ze } from "@object-ui/react";
|
|
7
|
+
import { BooleanField as Qe, SelectField as $e, getCellRenderer as et, resolveCellRendererType as tt } from "@object-ui/fields";
|
|
8
|
+
import { Fragment as nt, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
9
|
+
import { useFieldPermissions as rt, usePermissions as it } from "@object-ui/permissions";
|
|
10
10
|
//#region src/autoLayout.ts
|
|
11
|
-
var
|
|
11
|
+
var at = new Set([
|
|
12
12
|
"textarea",
|
|
13
13
|
"markdown",
|
|
14
14
|
"html",
|
|
@@ -20,40 +20,36 @@ var nt = new Set([
|
|
|
20
20
|
"field:grid",
|
|
21
21
|
"field:rich-text"
|
|
22
22
|
]);
|
|
23
|
-
function
|
|
24
|
-
return
|
|
23
|
+
function ot(e) {
|
|
24
|
+
return at.has(e);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function st(e, t) {
|
|
27
27
|
let n;
|
|
28
|
-
|
|
29
|
-
if (t < 640) return Math.min(n, 1);
|
|
30
|
-
if (t < 900) return Math.min(n, 2);
|
|
31
|
-
}
|
|
32
|
-
return n;
|
|
28
|
+
return n = e <= 3 ? 1 : 2, t !== void 0 && t < 640 ? Math.min(n, 1) : n;
|
|
33
29
|
}
|
|
34
|
-
function
|
|
35
|
-
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type &&
|
|
30
|
+
function ct(e, t) {
|
|
31
|
+
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && ot(e.type) ? {
|
|
36
32
|
...e,
|
|
37
33
|
span: t
|
|
38
34
|
} : e);
|
|
39
35
|
}
|
|
40
|
-
function
|
|
36
|
+
function lt(e, t, n) {
|
|
41
37
|
if (t !== void 0) return {
|
|
42
|
-
fields:
|
|
38
|
+
fields: ct(e, t),
|
|
43
39
|
columns: t
|
|
44
40
|
};
|
|
45
|
-
let r =
|
|
41
|
+
let r = st(e.length, n);
|
|
46
42
|
return {
|
|
47
|
-
fields:
|
|
43
|
+
fields: ct(e, r),
|
|
48
44
|
columns: r
|
|
49
45
|
};
|
|
50
46
|
}
|
|
51
47
|
//#endregion
|
|
52
48
|
//#region src/useDetailTranslation.ts
|
|
53
|
-
function
|
|
49
|
+
function ut(e, t) {
|
|
54
50
|
return function() {
|
|
55
51
|
try {
|
|
56
|
-
let n =
|
|
52
|
+
let n = Je();
|
|
57
53
|
return n.t(t) === t ? { t: (t, n) => {
|
|
58
54
|
let r = e[t] || t;
|
|
59
55
|
if (n) for (let [e, t] of Object.entries(n)) r = r.replace(`{{${e}}}`, String(t));
|
|
@@ -68,7 +64,7 @@ function st(e, t) {
|
|
|
68
64
|
}
|
|
69
65
|
};
|
|
70
66
|
}
|
|
71
|
-
var
|
|
67
|
+
var dt = {
|
|
72
68
|
"detail.back": "Back",
|
|
73
69
|
"detail.edit": "Edit",
|
|
74
70
|
"detail.editInline": "Edit",
|
|
@@ -181,14 +177,14 @@ var ct = {
|
|
|
181
177
|
"detail.subscribeAriaLabel": "Subscribe to notifications",
|
|
182
178
|
"detail.unsubscribeAriaLabel": "Unsubscribe from notifications",
|
|
183
179
|
"detail.clearSearch": "Clear search"
|
|
184
|
-
}, $ =
|
|
180
|
+
}, $ = ut(dt, "detail.back");
|
|
185
181
|
//#endregion
|
|
186
182
|
//#region src/DetailSection.tsx
|
|
187
|
-
function
|
|
183
|
+
function ft(e, t) {
|
|
188
184
|
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" : "";
|
|
189
185
|
}
|
|
190
|
-
var
|
|
191
|
-
let [l, u] = n.useState(e.defaultCollapsed ?? !1), [d, f] = n.useState(null), [p, m] = n.useState(void 0), [w, T] = n.useState(!1), { t: E } = $(), { fieldLabel: D, translateOptions: O } =
|
|
186
|
+
var pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s, virtualScroll: c }) => {
|
|
187
|
+
let [l, u] = n.useState(e.defaultCollapsed ?? !1), [d, f] = n.useState(null), [p, m] = n.useState(void 0), [w, T] = n.useState(!1), { t: E } = $(), { fieldLabel: D, translateOptions: O } = Ze(), k = n.useCallback((e, t) => {
|
|
192
188
|
let n = t == null ? "" : String(t);
|
|
193
189
|
navigator.clipboard.writeText(n).then(() => {
|
|
194
190
|
f(e), setTimeout(() => f(null), 2e3);
|
|
@@ -196,18 +192,18 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
196
192
|
}, []), A = n.useCallback((e) => {
|
|
197
193
|
let n = t?.[e.name] ?? e.value;
|
|
198
194
|
return n == null || n === "";
|
|
199
|
-
}, [t]), j = n.useMemo(() => e.fields.filter(A).length, [e.fields, A]), ee =
|
|
200
|
-
if (
|
|
201
|
-
let { fields:
|
|
195
|
+
}, [t]), j = n.useMemo(() => e.fields.filter(A).length, [e.fields, A]), ee = te(), M = ee ? 3 : 4, ne = ee ? .2 : .25, R = e.fields.length - j, z = !e.hideEmpty && !o && e.fields.length >= M && j / e.fields.length >= ne && R > 0, B = !w && (e.hideEmpty || z) ? e.fields.filter((e) => !A(e)) : e.fields;
|
|
196
|
+
if (B.length === 0 && j === e.fields.length) return null;
|
|
197
|
+
let { fields: re, columns: V } = lt(B, e.columns), H = (e) => {
|
|
202
198
|
let n = t?.[e.name] ?? e.value;
|
|
203
|
-
if (e.render) return /* @__PURE__ */ Z(
|
|
199
|
+
if (e.render) return /* @__PURE__ */ Z(We, {
|
|
204
200
|
schema: e.render,
|
|
205
201
|
data: {
|
|
206
202
|
...t,
|
|
207
203
|
value: n
|
|
208
204
|
}
|
|
209
205
|
});
|
|
210
|
-
let r =
|
|
206
|
+
let r = ft(e.span, V), c = i?.fields?.[e.name], l = { ...e };
|
|
211
207
|
if (c) {
|
|
212
208
|
!e.type && c.type && (l.type = c.type), c.options && !l.options && (l.options = c.options), c.currency && !l.currency && (l.currency = c.currency), c.precision !== void 0 && l.precision === void 0 && (l.precision = c.precision), c.format && !l.format && (l.format = c.format);
|
|
213
209
|
let t = c.reference_to || c.reference;
|
|
@@ -219,9 +215,9 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
219
215
|
className: "text-muted-foreground/50 text-xs italic",
|
|
220
216
|
children: "—"
|
|
221
217
|
});
|
|
222
|
-
let t =
|
|
218
|
+
let t = tt(l) || e.type;
|
|
223
219
|
if (t) {
|
|
224
|
-
let e =
|
|
220
|
+
let e = et(t);
|
|
225
221
|
if (e) return /* @__PURE__ */ Z(e, {
|
|
226
222
|
value: n,
|
|
227
223
|
field: l
|
|
@@ -238,12 +234,12 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
238
234
|
className: "min-h-[44px] sm:min-h-0",
|
|
239
235
|
children: (() => {
|
|
240
236
|
let t = l.type || e.type;
|
|
241
|
-
if (t === "select" && Array.isArray(l.options) && l.options.length > 0) return /* @__PURE__ */ Z(
|
|
237
|
+
if (t === "select" && Array.isArray(l.options) && l.options.length > 0) return /* @__PURE__ */ Z($e, {
|
|
242
238
|
field: l,
|
|
243
239
|
value: n == null ? "" : String(n),
|
|
244
240
|
onChange: (t) => s?.(e.name, t)
|
|
245
241
|
});
|
|
246
|
-
if (t === "boolean") return /* @__PURE__ */ Z(
|
|
242
|
+
if (t === "boolean") return /* @__PURE__ */ Z(Qe, {
|
|
247
243
|
field: l,
|
|
248
244
|
value: !!n,
|
|
249
245
|
onChange: (t) => s?.(e.name, t)
|
|
@@ -287,32 +283,32 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
287
283
|
onClick: (t) => {
|
|
288
284
|
t.stopPropagation(), k(e.name, n);
|
|
289
285
|
},
|
|
290
|
-
children: p ? /* @__PURE__ */ Z(
|
|
286
|
+
children: p ? /* @__PURE__ */ Z(W, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(me, { className: "h-3 w-3" })
|
|
291
287
|
})
|
|
292
288
|
}), /* @__PURE__ */ Z(P, { children: E(p ? "detail.copied" : "detail.copyToClipboard") })] }) })]
|
|
293
289
|
})]
|
|
294
290
|
}, e.name);
|
|
295
|
-
},
|
|
291
|
+
}, ie = c?.enabled === !0, U = c?.batchSize ?? 20;
|
|
296
292
|
n.useEffect(() => {
|
|
297
|
-
if (!
|
|
293
|
+
if (!ie) {
|
|
298
294
|
m(void 0);
|
|
299
295
|
return;
|
|
300
296
|
}
|
|
301
|
-
if (
|
|
297
|
+
if (re.length <= U) {
|
|
302
298
|
m(void 0);
|
|
303
299
|
return;
|
|
304
300
|
}
|
|
305
|
-
m(
|
|
301
|
+
m(U);
|
|
306
302
|
let e = setTimeout(() => m(void 0), 100);
|
|
307
303
|
return () => clearTimeout(e);
|
|
308
304
|
}, [
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
305
|
+
ie,
|
|
306
|
+
re.length,
|
|
307
|
+
U
|
|
312
308
|
]);
|
|
313
|
-
let
|
|
314
|
-
className: L("grid gap-3 sm:gap-4",
|
|
315
|
-
children:
|
|
309
|
+
let ae = p === void 0 ? re : re.slice(0, p), oe = j > 0 && (e.hideEmpty || z), ce = /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z("div", {
|
|
310
|
+
className: L("grid gap-3 sm:gap-4", V === 1 ? "grid-cols-1" : V === 2 ? "grid-cols-1 md:grid-cols-2" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"),
|
|
311
|
+
children: ae.map(H)
|
|
316
312
|
}), oe && /* @__PURE__ */ Z("div", {
|
|
317
313
|
className: "mt-3 -ml-2",
|
|
318
314
|
children: /* @__PURE__ */ Q(g, {
|
|
@@ -321,7 +317,7 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
321
317
|
size: "sm",
|
|
322
318
|
onClick: () => T((e) => !e),
|
|
323
319
|
className: "h-7 px-2 text-xs text-muted-foreground hover:text-foreground",
|
|
324
|
-
children: [Z(w ?
|
|
320
|
+
children: [Z(w ? _e : G, { className: "h-3.5 w-3.5 mr-1.5" }), w ? E("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : E("detail.showEmptyFields", {
|
|
325
321
|
count: j,
|
|
326
322
|
defaultValue: `Show ${j} empty field${j === 1 ? "" : "s"}`
|
|
327
323
|
})]
|
|
@@ -356,7 +352,7 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
356
352
|
]
|
|
357
353
|
}), /* @__PURE__ */ Z("div", {
|
|
358
354
|
className: "flex items-center gap-2",
|
|
359
|
-
children: Z(l ?
|
|
355
|
+
children: Z(l ? le : se, { className: "h-4 w-4 text-muted-foreground" })
|
|
360
356
|
})]
|
|
361
357
|
}), e.description && !l && /* @__PURE__ */ Z("p", {
|
|
362
358
|
className: "text-sm text-muted-foreground mt-1.5",
|
|
@@ -389,7 +385,7 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
389
385
|
children: ce
|
|
390
386
|
})]
|
|
391
387
|
});
|
|
392
|
-
},
|
|
388
|
+
}, mt = ({ tabs: e, data: t, className: r }) => {
|
|
393
389
|
let [i, a] = n.useState(e[0]?.key), o = e.filter((e) => typeof e.visible == "boolean" ? e.visible : (e.visible, !0));
|
|
394
390
|
return /* @__PURE__ */ Q(A, {
|
|
395
391
|
value: i,
|
|
@@ -420,11 +416,11 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
420
416
|
fallback: null,
|
|
421
417
|
children: Array.isArray(e.content) ? /* @__PURE__ */ Z("div", {
|
|
422
418
|
className: "space-y-4",
|
|
423
|
-
children: e.content.map((e, n) => /* @__PURE__ */ Z(
|
|
419
|
+
children: e.content.map((e, n) => /* @__PURE__ */ Z(We, {
|
|
424
420
|
schema: e,
|
|
425
421
|
data: t
|
|
426
422
|
}, n))
|
|
427
|
-
}) : /* @__PURE__ */ Z(
|
|
423
|
+
}) : /* @__PURE__ */ Z(We, {
|
|
428
424
|
schema: e.content,
|
|
429
425
|
data: t
|
|
430
426
|
})
|
|
@@ -434,15 +430,15 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
434
430
|
};
|
|
435
431
|
//#endregion
|
|
436
432
|
//#region src/RelatedList.tsx
|
|
437
|
-
function
|
|
438
|
-
return e &&
|
|
433
|
+
function ht(e) {
|
|
434
|
+
return e && Ue[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || Se;
|
|
439
435
|
}
|
|
440
|
-
var
|
|
441
|
-
let R = f !== void 0, z = f ?? [], [B,
|
|
436
|
+
var gt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className: x, dataSource: S, objectName: C, onNew: T, onViewAll: E, onRowEdit: D, onRowDelete: O, onRowClick: k, maxColumns: A = 6, pageSize: j, sortable: ee = !1, filterable: M = !1, collapsible: N = !1, defaultCollapsed: P = !1, referenceField: F, parentId: I, icon: ne }) => {
|
|
437
|
+
let R = f !== void 0, z = f ?? [], [B, V] = n.useState(z), [H, ie] = n.useState(() => !!r && !R), [U, ae] = n.useState(0), [W, oe] = n.useState(null), [ue, de] = n.useState("asc"), [fe, pe] = n.useState(""), [me, he] = n.useState(null), [G, _e] = n.useState(P), [ve, ye] = n.useState({}), { t: K } = $(), { fieldLabel: be } = Ze();
|
|
442
438
|
n.useEffect(() => {
|
|
443
|
-
R &&
|
|
439
|
+
R && V(f ?? []);
|
|
444
440
|
}, [f, R]), n.useEffect(() => {
|
|
445
|
-
r && S?.getObjectSchema && !m?.length && S.getObjectSchema(r).then(
|
|
441
|
+
r && S?.getObjectSchema && !m?.length && S.getObjectSchema(r).then(he).catch((e) => {
|
|
446
442
|
console.warn(`[RelatedList] Failed to fetch schema for ${r}:`, e);
|
|
447
443
|
});
|
|
448
444
|
}, [
|
|
@@ -450,22 +446,36 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
450
446
|
S,
|
|
451
447
|
m
|
|
452
448
|
]), n.useEffect(() => {
|
|
453
|
-
r && !R
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
449
|
+
if (r && !R) {
|
|
450
|
+
if (!(F && I != null && I !== "")) {
|
|
451
|
+
r && (I == null || I === "") && !F && console.warn(`[RelatedList] "${r}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`), V([]), ie(!1);
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
ie(!0);
|
|
455
|
+
let e = { [F]: I };
|
|
456
|
+
if (S && typeof S.find == "function") S.find(r, { $filter: e }).then((e) => {
|
|
457
|
+
V(Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : []), ie(!1);
|
|
458
|
+
}).catch((e) => {
|
|
459
|
+
console.error("Failed to fetch related data:", e), ie(!1);
|
|
460
|
+
});
|
|
461
|
+
else {
|
|
462
|
+
let e = new URLSearchParams({ [`filter[${F}]`]: String(I) }).toString();
|
|
463
|
+
fetch(`${r}?${e}`).then((e) => e.json()).then((e) => {
|
|
464
|
+
V(Array.isArray(e) ? e : e?.data || []);
|
|
465
|
+
}).catch((e) => {
|
|
466
|
+
console.error("Failed to fetch related data:", e);
|
|
467
|
+
}).finally(() => ie(!1));
|
|
468
|
+
}
|
|
469
|
+
}
|
|
462
470
|
}, [
|
|
463
471
|
r,
|
|
464
472
|
R,
|
|
465
|
-
S
|
|
473
|
+
S,
|
|
474
|
+
F,
|
|
475
|
+
I
|
|
466
476
|
]), n.useEffect(() => {
|
|
467
|
-
if (!S?.find || !
|
|
468
|
-
let e =
|
|
477
|
+
if (!S?.find || !me?.fields || !B.length) return;
|
|
478
|
+
let e = me.fields, t = [];
|
|
469
479
|
for (let [n, r] of Object.entries(e)) {
|
|
470
480
|
if (!r || r.type !== "lookup" && r.type !== "master_detail") continue;
|
|
471
481
|
let e = r.reference_to || r.reference;
|
|
@@ -475,7 +485,7 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
475
485
|
let t = e?.[n];
|
|
476
486
|
t != null && (typeof t == "string" && t ? i.add(t) : typeof t == "number" && i.add(String(t)));
|
|
477
487
|
}
|
|
478
|
-
let a =
|
|
488
|
+
let a = ve[n] || {}, o = Array.from(i).filter((e) => !(e in a));
|
|
479
489
|
o.length > 0 && t.push({
|
|
480
490
|
fieldName: n,
|
|
481
491
|
target: e,
|
|
@@ -501,7 +511,7 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
501
511
|
fieldName: e,
|
|
502
512
|
map: {}
|
|
503
513
|
})))).then((e) => {
|
|
504
|
-
n ||
|
|
514
|
+
n || ye((t) => {
|
|
505
515
|
let n = { ...t };
|
|
506
516
|
for (let { fieldName: t, map: r } of e) n[t] = {
|
|
507
517
|
...n[t] || {},
|
|
@@ -514,48 +524,48 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
514
524
|
};
|
|
515
525
|
}, [
|
|
516
526
|
S,
|
|
517
|
-
|
|
527
|
+
me,
|
|
518
528
|
B
|
|
519
529
|
]);
|
|
520
|
-
let
|
|
521
|
-
if (!
|
|
522
|
-
let e =
|
|
530
|
+
let xe = n.useMemo(() => {
|
|
531
|
+
if (!fe) return B;
|
|
532
|
+
let e = fe.toLowerCase();
|
|
523
533
|
return B.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
524
|
-
}, [B,
|
|
534
|
+
}, [B, fe]), Se = n.useMemo(() => W ? [...xe].sort((e, t) => {
|
|
525
535
|
let n = e[W], r = t[W];
|
|
526
536
|
if (n == null && r == null) return 0;
|
|
527
537
|
if (n == null) return 1;
|
|
528
538
|
if (r == null) return -1;
|
|
529
539
|
let i = String(n).localeCompare(String(r), void 0, { numeric: !0 });
|
|
530
|
-
return
|
|
531
|
-
}) :
|
|
532
|
-
|
|
540
|
+
return ue === "asc" ? i : -i;
|
|
541
|
+
}) : xe, [
|
|
542
|
+
xe,
|
|
533
543
|
W,
|
|
534
|
-
|
|
535
|
-
]),
|
|
544
|
+
ue
|
|
545
|
+
]), q = j && j > 0 ? j : 0, Ce = q ? Math.max(1, Math.ceil(Se.length / q)) : 1, we = q ? Se.slice(U * q, (U + 1) * q) : Se;
|
|
536
546
|
n.useEffect(() => {
|
|
537
|
-
|
|
547
|
+
ae(0);
|
|
538
548
|
}, [
|
|
539
|
-
|
|
549
|
+
fe,
|
|
540
550
|
W,
|
|
541
|
-
|
|
551
|
+
ue
|
|
542
552
|
]);
|
|
543
|
-
let
|
|
544
|
-
W === e ?
|
|
545
|
-
}, [W]), [
|
|
546
|
-
|
|
547
|
-
}, []),
|
|
548
|
-
|
|
549
|
-
}, [
|
|
550
|
-
let e = C || r || "", t = (t) => !
|
|
553
|
+
let Te = n.useCallback((e) => {
|
|
554
|
+
W === e ? de((e) => e === "asc" ? "desc" : "asc") : (oe(e), de("asc"));
|
|
555
|
+
}, [W]), [Ee, J] = n.useState(null), De = n.useCallback((e) => {
|
|
556
|
+
J(e);
|
|
557
|
+
}, []), Oe = n.useCallback(() => {
|
|
558
|
+
Ee && O?.(Ee), J(null);
|
|
559
|
+
}, [Ee, O]), ke = it(), Y = n.useMemo(() => {
|
|
560
|
+
let e = C || r || "", t = (t) => !ke?.isLoaded || !e ? t : t.filter((t) => {
|
|
551
561
|
let n = t?.accessorKey || t?.field || t?.name;
|
|
552
|
-
return n ?
|
|
562
|
+
return n ? ke.checkField(e, String(n), "read") : !0;
|
|
553
563
|
}), i = (e) => F ? e.filter((e) => (e?.accessorKey || e?.field || e?.name) !== F) : e, a = (e) => e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0, o = (e) => B.length ? e.filter((e) => {
|
|
554
564
|
let t = e?.accessorKey || e?.field || e?.name;
|
|
555
565
|
return t ? B.some((e) => !a(e?.[t])) : !0;
|
|
556
566
|
}) : e;
|
|
557
567
|
if (m && m.length > 0) return o(t(i(m)));
|
|
558
|
-
if (!
|
|
568
|
+
if (!me?.fields) return [];
|
|
559
569
|
let s = e, c = new Set([
|
|
560
570
|
"image",
|
|
561
571
|
"file",
|
|
@@ -572,7 +582,7 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
572
582
|
"label",
|
|
573
583
|
"code",
|
|
574
584
|
"number"
|
|
575
|
-
], u = Object.entries(
|
|
585
|
+
], u = Object.entries(me.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === F || t?.hidden || t?.type && c.has(t.type) || ke?.isLoaded && s && !ke.checkField(s, e, "read")));
|
|
576
586
|
return u.sort(([e, t], [n, r]) => {
|
|
577
587
|
let i = l.indexOf(e), a = l.indexOf(n), o = i >= 0 ? i : 100, s = a >= 0 ? a : 100;
|
|
578
588
|
if (o !== s) return o - s;
|
|
@@ -581,15 +591,15 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
581
591
|
}), o(u.map(([e, t]) => {
|
|
582
592
|
let r = {
|
|
583
593
|
accessorKey: e,
|
|
584
|
-
header:
|
|
594
|
+
header: be(s, e, t.label || e)
|
|
585
595
|
};
|
|
586
596
|
if (t.type) {
|
|
587
|
-
let i =
|
|
597
|
+
let i = et(tt({
|
|
588
598
|
type: t.type,
|
|
589
599
|
format: t.format
|
|
590
600
|
}) || t.type);
|
|
591
601
|
if (i) {
|
|
592
|
-
let a = t.type === "lookup" || t.type === "master_detail" ?
|
|
602
|
+
let a = t.type === "lookup" || t.type === "master_detail" ? ve[e] : void 0, o = a && Object.keys(a).length > 0 ? Object.entries(a).map(([e, t]) => ({
|
|
593
603
|
value: e,
|
|
594
604
|
label: t
|
|
595
605
|
})) : void 0, s = {
|
|
@@ -613,35 +623,49 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
613
623
|
})).slice(0, Math.max(1, A));
|
|
614
624
|
}, [
|
|
615
625
|
m,
|
|
616
|
-
|
|
626
|
+
me,
|
|
617
627
|
C,
|
|
618
628
|
r,
|
|
619
|
-
|
|
629
|
+
be,
|
|
620
630
|
F,
|
|
621
631
|
B,
|
|
622
632
|
A,
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
]),
|
|
633
|
+
ve,
|
|
634
|
+
ke
|
|
635
|
+
]), Ae = !!D || !!O, je = te(), Ne = n.useMemo(() => {
|
|
626
636
|
if (p) return p;
|
|
637
|
+
if (je && (t === "grid" || t === "table")) {
|
|
638
|
+
let e = Y[0]?.accessorKey || Y[0]?.field || Y[0]?.name, t = Y.slice(1, 4).map((e) => e.accessorKey || e.field || e.name).filter(Boolean);
|
|
639
|
+
return {
|
|
640
|
+
type: "object-gallery",
|
|
641
|
+
data: we,
|
|
642
|
+
objectName: r,
|
|
643
|
+
gallery: {
|
|
644
|
+
titleField: e || "name",
|
|
645
|
+
visibleFields: t,
|
|
646
|
+
cardSize: "medium"
|
|
647
|
+
},
|
|
648
|
+
onRowClick: k
|
|
649
|
+
};
|
|
650
|
+
}
|
|
627
651
|
switch (t) {
|
|
628
652
|
case "grid":
|
|
629
653
|
case "table": return {
|
|
630
654
|
type: "data-table",
|
|
631
|
-
data:
|
|
632
|
-
columns:
|
|
655
|
+
data: we,
|
|
656
|
+
columns: Y,
|
|
633
657
|
pagination: !1,
|
|
634
|
-
pageSize:
|
|
658
|
+
pageSize: q || 10,
|
|
635
659
|
searchable: !1,
|
|
636
660
|
exportable: !1,
|
|
637
|
-
rowActions:
|
|
661
|
+
rowActions: Ae,
|
|
638
662
|
onRowEdit: D,
|
|
639
|
-
onRowDelete: O ?
|
|
663
|
+
onRowDelete: O ? De : void 0,
|
|
640
664
|
onRowClick: k
|
|
641
665
|
};
|
|
642
666
|
case "list": return {
|
|
643
667
|
type: "data-list",
|
|
644
|
-
data:
|
|
668
|
+
data: we
|
|
645
669
|
};
|
|
646
670
|
default: return {
|
|
647
671
|
type: "div",
|
|
@@ -650,34 +674,36 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
650
674
|
}
|
|
651
675
|
}, [
|
|
652
676
|
t,
|
|
653
|
-
|
|
654
|
-
De,
|
|
655
|
-
p,
|
|
677
|
+
we,
|
|
656
678
|
Y,
|
|
657
|
-
|
|
679
|
+
p,
|
|
680
|
+
q,
|
|
681
|
+
Ae,
|
|
658
682
|
D,
|
|
659
683
|
O,
|
|
660
|
-
|
|
661
|
-
k
|
|
662
|
-
|
|
684
|
+
De,
|
|
685
|
+
k,
|
|
686
|
+
je,
|
|
687
|
+
r
|
|
688
|
+
]), Pe = N ? "cursor-pointer select-none" : void 0, Fe = N ? () => _e((e) => !e) : void 0, Ie = ht(ne), X = !H && B.length === 0, Le = M;
|
|
663
689
|
return /* @__PURE__ */ Q(_, {
|
|
664
|
-
className: L("shadow-none",
|
|
690
|
+
className: L("shadow-none border-border/60 bg-transparent", X && "bg-muted/10", x),
|
|
665
691
|
children: [
|
|
666
692
|
/* @__PURE__ */ Z(y, {
|
|
667
|
-
className: L("py-3 px-4",
|
|
668
|
-
onClick:
|
|
693
|
+
className: L("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", Pe),
|
|
694
|
+
onClick: Fe,
|
|
669
695
|
children: /* @__PURE__ */ Q(b, {
|
|
670
696
|
className: "flex items-center justify-between gap-2 text-sm font-semibold",
|
|
671
697
|
children: [/* @__PURE__ */ Q("div", {
|
|
672
698
|
className: "flex items-center gap-2 min-w-0",
|
|
673
699
|
children: [
|
|
674
|
-
N && Z(
|
|
675
|
-
/* @__PURE__ */ Z(
|
|
700
|
+
N && Z(G ? le : se, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
|
|
701
|
+
/* @__PURE__ */ Z(Ie, {
|
|
676
702
|
className: "h-4 w-4 text-muted-foreground shrink-0",
|
|
677
703
|
"aria-hidden": !0
|
|
678
704
|
}),
|
|
679
705
|
/* @__PURE__ */ Z("span", {
|
|
680
|
-
className: "truncate",
|
|
706
|
+
className: L("truncate", X && "text-muted-foreground font-medium"),
|
|
681
707
|
children: e
|
|
682
708
|
}),
|
|
683
709
|
/* @__PURE__ */ Z(h, {
|
|
@@ -685,37 +711,41 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
685
711
|
className: L("text-xs font-normal h-5 px-1.5", B.length === 0 && "bg-muted text-muted-foreground"),
|
|
686
712
|
"aria-label": `${B.length} records`,
|
|
687
713
|
children: B.length
|
|
714
|
+
}),
|
|
715
|
+
X && /* @__PURE__ */ Z("span", {
|
|
716
|
+
className: "text-xs text-muted-foreground/70 italic ml-1 truncate",
|
|
717
|
+
children: K("detail.noRelatedRecords")
|
|
688
718
|
})
|
|
689
719
|
]
|
|
690
720
|
}), /* @__PURE__ */ Z("div", {
|
|
691
721
|
className: "flex items-center gap-1 shrink-0",
|
|
692
722
|
children: T && /* @__PURE__ */ Q(g, {
|
|
693
|
-
variant: "outline",
|
|
723
|
+
variant: X ? "ghost" : "outline",
|
|
694
724
|
size: "sm",
|
|
695
725
|
onClick: (e) => {
|
|
696
726
|
e.stopPropagation(), T();
|
|
697
727
|
},
|
|
698
|
-
className: "gap-1 h-7 text-xs shadow-none",
|
|
699
|
-
children: [/* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5" }),
|
|
728
|
+
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
729
|
+
children: [/* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5" }), K("detail.new")]
|
|
700
730
|
})
|
|
701
731
|
})]
|
|
702
732
|
})
|
|
703
733
|
}),
|
|
704
|
-
!
|
|
705
|
-
className: L("pt-0
|
|
734
|
+
!G && !X && /* @__PURE__ */ Q(v, {
|
|
735
|
+
className: L("pt-0 pb-4 px-4"),
|
|
706
736
|
children: [
|
|
707
|
-
|
|
737
|
+
Le && /* @__PURE__ */ Z("div", {
|
|
708
738
|
className: "mb-3",
|
|
709
739
|
children: /* @__PURE__ */ Z(w, {
|
|
710
|
-
placeholder:
|
|
711
|
-
value:
|
|
712
|
-
onChange: (e) =>
|
|
740
|
+
placeholder: K("detail.filterPlaceholder"),
|
|
741
|
+
value: fe,
|
|
742
|
+
onChange: (e) => pe(e.target.value),
|
|
713
743
|
className: "h-8 text-sm"
|
|
714
744
|
})
|
|
715
745
|
}),
|
|
716
|
-
ee &&
|
|
746
|
+
ee && Y && Y.length > 0 && B.length > 0 && /* @__PURE__ */ Z("div", {
|
|
717
747
|
className: "flex flex-wrap gap-1 mb-3",
|
|
718
|
-
children:
|
|
748
|
+
children: Y.map((e) => {
|
|
719
749
|
let t = e.accessorKey || e.field || e.name;
|
|
720
750
|
if (!t) return null;
|
|
721
751
|
let n = e.header || e.label || t, r = W === t;
|
|
@@ -723,67 +753,48 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
723
753
|
variant: r ? "secondary" : "ghost",
|
|
724
754
|
size: "sm",
|
|
725
755
|
className: "gap-1 h-7 text-xs",
|
|
726
|
-
onClick: () =>
|
|
756
|
+
onClick: () => Te(t),
|
|
727
757
|
children: [
|
|
728
|
-
/* @__PURE__ */ Z(
|
|
758
|
+
/* @__PURE__ */ Z(re, { className: "h-3 w-3" }),
|
|
729
759
|
n,
|
|
730
|
-
r && (
|
|
760
|
+
r && (ue === "asc" ? " ↑" : " ↓")
|
|
731
761
|
]
|
|
732
762
|
}, t);
|
|
733
763
|
})
|
|
734
764
|
}),
|
|
735
|
-
|
|
765
|
+
H ? /* @__PURE__ */ Z("div", {
|
|
736
766
|
className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
|
|
737
|
-
children:
|
|
738
|
-
}) :
|
|
739
|
-
|
|
740
|
-
children: [
|
|
741
|
-
/* @__PURE__ */ Z(Ne, {
|
|
742
|
-
className: "h-8 w-8 text-muted-foreground/40",
|
|
743
|
-
"aria-hidden": !0
|
|
744
|
-
}),
|
|
745
|
-
/* @__PURE__ */ Z("span", {
|
|
746
|
-
className: "text-muted-foreground italic",
|
|
747
|
-
children: J("detail.noRelatedRecords")
|
|
748
|
-
}),
|
|
749
|
-
T && /* @__PURE__ */ Q(g, {
|
|
750
|
-
variant: "outline",
|
|
751
|
-
size: "sm",
|
|
752
|
-
onClick: T,
|
|
753
|
-
className: "gap-1 h-7 text-xs mt-1",
|
|
754
|
-
children: [/* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5" }), J("detail.new")]
|
|
755
|
-
})
|
|
756
|
-
]
|
|
757
|
-
}) : /* @__PURE__ */ Z(Ge, { schema: ke }),
|
|
758
|
-
Y > 0 && ve.length > Y && /* @__PURE__ */ Q("div", {
|
|
767
|
+
children: K("detail.loading")
|
|
768
|
+
}) : /* @__PURE__ */ Z(We, { schema: Ne }),
|
|
769
|
+
q > 0 && Se.length > q && /* @__PURE__ */ Q("div", {
|
|
759
770
|
className: "flex items-center justify-between mt-3 pt-3 border-t",
|
|
760
771
|
children: [
|
|
761
772
|
/* @__PURE__ */ Q(g, {
|
|
762
773
|
variant: "outline",
|
|
763
774
|
size: "sm",
|
|
764
775
|
className: "h-7 text-xs gap-1",
|
|
765
|
-
disabled:
|
|
766
|
-
onClick: () =>
|
|
767
|
-
children: [/* @__PURE__ */ Z(ce, { className: "h-3 w-3" }),
|
|
776
|
+
disabled: U === 0,
|
|
777
|
+
onClick: () => ae((e) => Math.max(0, e - 1)),
|
|
778
|
+
children: [/* @__PURE__ */ Z(ce, { className: "h-3 w-3" }), K("detail.previousPage")]
|
|
768
779
|
}),
|
|
769
780
|
/* @__PURE__ */ Z("span", {
|
|
770
781
|
className: "text-xs text-muted-foreground",
|
|
771
|
-
children:
|
|
772
|
-
current:
|
|
773
|
-
total:
|
|
782
|
+
children: K("detail.pageOf", {
|
|
783
|
+
current: U + 1,
|
|
784
|
+
total: Ce
|
|
774
785
|
})
|
|
775
786
|
}),
|
|
776
787
|
/* @__PURE__ */ Q(g, {
|
|
777
788
|
variant: "outline",
|
|
778
789
|
size: "sm",
|
|
779
790
|
className: "h-7 text-xs gap-1",
|
|
780
|
-
disabled:
|
|
781
|
-
onClick: () =>
|
|
782
|
-
children: [
|
|
791
|
+
disabled: U >= Ce - 1,
|
|
792
|
+
onClick: () => ae((e) => Math.min(Ce - 1, e + 1)),
|
|
793
|
+
children: [K("detail.nextPage"), /* @__PURE__ */ Z(le, { className: "h-3 w-3" })]
|
|
783
794
|
})
|
|
784
795
|
]
|
|
785
796
|
}),
|
|
786
|
-
E && !
|
|
797
|
+
E && !X && q > 0 && Se.length > q && /* @__PURE__ */ Z("div", {
|
|
787
798
|
className: "mt-3 pt-3 border-t flex justify-center",
|
|
788
799
|
children: /* @__PURE__ */ Q("button", {
|
|
789
800
|
type: "button",
|
|
@@ -791,28 +802,28 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
791
802
|
e.stopPropagation(), E();
|
|
792
803
|
},
|
|
793
804
|
className: "text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors",
|
|
794
|
-
children: [
|
|
805
|
+
children: [K("detail.viewAll"), /* @__PURE__ */ Z(ge, { className: "h-3 w-3" })]
|
|
795
806
|
})
|
|
796
807
|
})
|
|
797
808
|
]
|
|
798
809
|
}),
|
|
799
810
|
/* @__PURE__ */ Z(i, {
|
|
800
|
-
open:
|
|
811
|
+
open: Ee !== null,
|
|
801
812
|
onOpenChange: (e) => {
|
|
802
|
-
e ||
|
|
813
|
+
e || J(null);
|
|
803
814
|
},
|
|
804
|
-
children: /* @__PURE__ */ Q(s, { children: [/* @__PURE__ */ Q(u, { children: [/* @__PURE__ */ Z(d, { children:
|
|
805
|
-
onClick:
|
|
815
|
+
children: /* @__PURE__ */ Q(s, { children: [/* @__PURE__ */ Q(u, { children: [/* @__PURE__ */ Z(d, { children: K("detail.deleteRowTitle", { defaultValue: "Delete record" }) }), /* @__PURE__ */ Z(c, { children: K("detail.deleteRowConfirmation") })] }), /* @__PURE__ */ Q(l, { children: [/* @__PURE__ */ Z(o, { children: K("detail.cancel", { defaultValue: "Cancel" }) }), /* @__PURE__ */ Z(a, {
|
|
816
|
+
onClick: Oe,
|
|
806
817
|
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
807
|
-
children:
|
|
818
|
+
children: K("detail.delete", { defaultValue: "Delete" })
|
|
808
819
|
})] })] })
|
|
809
820
|
})
|
|
810
821
|
]
|
|
811
822
|
});
|
|
812
|
-
},
|
|
823
|
+
}, _t = ({ group: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s }) => {
|
|
813
824
|
let c = e.collapsible ?? !0, [l, u] = n.useState(e.defaultCollapsed ?? !1), d = /* @__PURE__ */ Z("div", {
|
|
814
825
|
className: "space-y-3 sm:space-y-4",
|
|
815
|
-
children: e.sections.map((e, n) => /* @__PURE__ */ Z(
|
|
826
|
+
children: e.sections.map((e, n) => /* @__PURE__ */ Z(pt, {
|
|
816
827
|
section: e,
|
|
817
828
|
data: t,
|
|
818
829
|
objectSchema: i,
|
|
@@ -831,7 +842,7 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
831
842
|
children: /* @__PURE__ */ Q("div", {
|
|
832
843
|
className: "flex items-center gap-2 pb-2 border-b cursor-pointer hover:bg-muted/50 transition-colors rounded-t-md px-2 py-1.5",
|
|
833
844
|
children: [
|
|
834
|
-
Z(l ?
|
|
845
|
+
Z(l ? le : se, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
|
|
835
846
|
e.icon && /* @__PURE__ */ Z("span", {
|
|
836
847
|
className: "text-muted-foreground",
|
|
837
848
|
children: e.icon
|
|
@@ -872,53 +883,51 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
872
883
|
d
|
|
873
884
|
]
|
|
874
885
|
});
|
|
875
|
-
},
|
|
876
|
-
let { fieldLabel: a } =
|
|
886
|
+
}, vt = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
|
|
887
|
+
let { fieldLabel: a } = Ze();
|
|
877
888
|
if (!e.length || !t) return null;
|
|
878
889
|
let o = e.filter((e) => {
|
|
879
890
|
let n = t?.[e.name];
|
|
880
891
|
return n != null && n !== "";
|
|
881
892
|
});
|
|
882
|
-
return o.length === 0 ? null : /* @__PURE__ */ Z(
|
|
883
|
-
className: L("
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
}, e.name);
|
|
914
|
-
})
|
|
893
|
+
return o.length === 0 ? null : /* @__PURE__ */ Z("section", {
|
|
894
|
+
className: L("@container border-b border-border/60 pb-4", n),
|
|
895
|
+
"aria-label": "Record highlights",
|
|
896
|
+
children: /* @__PURE__ */ Z("div", {
|
|
897
|
+
className: L("flex flex-wrap gap-x-8 gap-y-3"),
|
|
898
|
+
children: o.map((e) => {
|
|
899
|
+
let n = t[e.name], o = i?.fields?.[e.name], s = e.type || o?.type, c = {
|
|
900
|
+
name: e.name,
|
|
901
|
+
label: e.label,
|
|
902
|
+
type: s || "text",
|
|
903
|
+
...o?.options && { options: o.options },
|
|
904
|
+
...o?.currency && { currency: o.currency },
|
|
905
|
+
...o?.precision !== void 0 && { precision: o.precision },
|
|
906
|
+
...o?.format && { format: o.format }
|
|
907
|
+
}, l = et(tt(c) || s || "text");
|
|
908
|
+
return /* @__PURE__ */ Q("div", {
|
|
909
|
+
className: "flex min-w-[8rem] max-w-[16rem] basis-[10rem] flex-col gap-0.5",
|
|
910
|
+
children: [/* @__PURE__ */ Q("span", {
|
|
911
|
+
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
912
|
+
children: [e.icon && /* @__PURE__ */ Z("span", {
|
|
913
|
+
className: "mr-1",
|
|
914
|
+
children: e.icon
|
|
915
|
+
}), a(r || "", e.name, e.label)]
|
|
916
|
+
}), /* @__PURE__ */ Z("span", {
|
|
917
|
+
className: "block min-w-0 truncate text-sm font-semibold",
|
|
918
|
+
children: /* @__PURE__ */ Z(l, {
|
|
919
|
+
value: n,
|
|
920
|
+
field: c
|
|
921
|
+
})
|
|
922
|
+
})]
|
|
923
|
+
}, e.name);
|
|
915
924
|
})
|
|
916
925
|
})
|
|
917
926
|
});
|
|
918
927
|
};
|
|
919
928
|
//#endregion
|
|
920
929
|
//#region src/RecordComments.tsx
|
|
921
|
-
function
|
|
930
|
+
function yt(e) {
|
|
922
931
|
try {
|
|
923
932
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
924
933
|
if (r < 1) return "just now";
|
|
@@ -931,7 +940,7 @@ function gt(e) {
|
|
|
931
940
|
return e;
|
|
932
941
|
}
|
|
933
942
|
}
|
|
934
|
-
var
|
|
943
|
+
var bt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, className: a }) => {
|
|
935
944
|
let { t: o } = $(), [s, c] = n.useState(""), [l, u] = n.useState(!1), [d, f] = n.useState(""), p = n.useCallback(async () => {
|
|
936
945
|
let e = s.trim();
|
|
937
946
|
if (!(!e || !t)) {
|
|
@@ -953,7 +962,7 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
953
962
|
children: [/* @__PURE__ */ Z(y, { children: /* @__PURE__ */ Q(b, {
|
|
954
963
|
className: "flex items-center gap-2 text-base",
|
|
955
964
|
children: [
|
|
956
|
-
/* @__PURE__ */ Z(
|
|
965
|
+
/* @__PURE__ */ Z(J, { className: "h-4 w-4" }),
|
|
957
966
|
o("detail.comments"),
|
|
958
967
|
/* @__PURE__ */ Q("span", {
|
|
959
968
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -985,7 +994,7 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
985
994
|
onClick: () => f(""),
|
|
986
995
|
"aria-label": o("detail.clearSearch"),
|
|
987
996
|
type: "button",
|
|
988
|
-
children: /* @__PURE__ */ Z(
|
|
997
|
+
children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
|
|
989
998
|
})
|
|
990
999
|
]
|
|
991
1000
|
})
|
|
@@ -1005,7 +1014,7 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1005
1014
|
onClick: p,
|
|
1006
1015
|
disabled: !s.trim() || l,
|
|
1007
1016
|
className: "shrink-0 self-end",
|
|
1008
|
-
children: /* @__PURE__ */ Z(
|
|
1017
|
+
children: /* @__PURE__ */ Z(X, { className: "h-4 w-4" })
|
|
1009
1018
|
})]
|
|
1010
1019
|
}),
|
|
1011
1020
|
h.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
@@ -1037,7 +1046,7 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1037
1046
|
}),
|
|
1038
1047
|
/* @__PURE__ */ Z("span", {
|
|
1039
1048
|
className: "text-xs text-muted-foreground",
|
|
1040
|
-
children:
|
|
1049
|
+
children: yt(e.createdAt)
|
|
1041
1050
|
}),
|
|
1042
1051
|
e.pinned && /* @__PURE__ */ Q("span", {
|
|
1043
1052
|
className: "text-xs text-amber-600 flex items-center gap-0.5",
|
|
@@ -1063,20 +1072,20 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1063
1072
|
]
|
|
1064
1073
|
})]
|
|
1065
1074
|
});
|
|
1066
|
-
},
|
|
1067
|
-
field_change:
|
|
1075
|
+
}, xt = {
|
|
1076
|
+
field_change: he,
|
|
1068
1077
|
create: Ne,
|
|
1069
|
-
delete:
|
|
1070
|
-
comment:
|
|
1071
|
-
status_change:
|
|
1072
|
-
},
|
|
1078
|
+
delete: ze,
|
|
1079
|
+
comment: J,
|
|
1080
|
+
status_change: B
|
|
1081
|
+
}, St = {
|
|
1073
1082
|
field_change: "bg-blue-100 text-blue-600",
|
|
1074
1083
|
create: "bg-green-100 text-green-600",
|
|
1075
1084
|
delete: "bg-red-100 text-red-600",
|
|
1076
1085
|
comment: "bg-purple-100 text-purple-600",
|
|
1077
1086
|
status_change: "bg-amber-100 text-amber-600"
|
|
1078
1087
|
};
|
|
1079
|
-
function
|
|
1088
|
+
function Ct(e) {
|
|
1080
1089
|
try {
|
|
1081
1090
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1082
1091
|
if (r < 1) return "just now";
|
|
@@ -1089,24 +1098,24 @@ function bt(e) {
|
|
|
1089
1098
|
return e;
|
|
1090
1099
|
}
|
|
1091
1100
|
}
|
|
1092
|
-
function
|
|
1101
|
+
function wt(e) {
|
|
1093
1102
|
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";
|
|
1094
1103
|
}
|
|
1095
|
-
var
|
|
1104
|
+
var Tt = {
|
|
1096
1105
|
all: "All",
|
|
1097
1106
|
field_change: "Field Changes",
|
|
1098
1107
|
create: "Creates",
|
|
1099
1108
|
delete: "Deletes",
|
|
1100
1109
|
comment: "Comments",
|
|
1101
1110
|
status_change: "Status Changes"
|
|
1102
|
-
},
|
|
1111
|
+
}, Et = ({ activities: e, filterable: t = !1, defaultFilter: r = "all", className: i }) => {
|
|
1103
1112
|
let [a, o] = n.useState(r), s = n.useMemo(() => a === "all" ? e : e.filter((e) => e.type === a), [e, a]);
|
|
1104
1113
|
return /* @__PURE__ */ Q(_, {
|
|
1105
1114
|
className: L("", i),
|
|
1106
1115
|
children: [/* @__PURE__ */ Z(y, { children: /* @__PURE__ */ Q(b, {
|
|
1107
1116
|
className: "flex items-center gap-2 text-base",
|
|
1108
1117
|
children: [
|
|
1109
|
-
/* @__PURE__ */ Z(
|
|
1118
|
+
/* @__PURE__ */ Z(ne, { className: "h-4 w-4" }),
|
|
1110
1119
|
"Activity",
|
|
1111
1120
|
/* @__PURE__ */ Q("span", {
|
|
1112
1121
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1121,12 +1130,12 @@ var St = {
|
|
|
1121
1130
|
className: "flex flex-wrap gap-1.5 mb-4",
|
|
1122
1131
|
role: "group",
|
|
1123
1132
|
"aria-label": "Activity type filter",
|
|
1124
|
-
children: Object.keys(
|
|
1133
|
+
children: Object.keys(Tt).map((e) => /* @__PURE__ */ Q("button", {
|
|
1125
1134
|
type: "button",
|
|
1126
1135
|
className: L("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"),
|
|
1127
1136
|
onClick: () => o(e),
|
|
1128
1137
|
"aria-pressed": a === e,
|
|
1129
|
-
children: [e !== "all" && n.createElement(
|
|
1138
|
+
children: [e !== "all" && n.createElement(xt[e] || he, { className: "h-3 w-3" }), Tt[e]]
|
|
1130
1139
|
}, e))
|
|
1131
1140
|
}), s.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
1132
1141
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
@@ -1136,11 +1145,11 @@ var St = {
|
|
|
1136
1145
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
1137
1146
|
className: "space-y-4",
|
|
1138
1147
|
children: s.map((e) => {
|
|
1139
|
-
let t =
|
|
1148
|
+
let t = xt[e.type] || he;
|
|
1140
1149
|
return /* @__PURE__ */ Q("div", {
|
|
1141
1150
|
className: "flex gap-3 relative",
|
|
1142
1151
|
children: [/* @__PURE__ */ Z("div", {
|
|
1143
|
-
className: L("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10",
|
|
1152
|
+
className: L("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", St[e.type] || "bg-gray-100 text-gray-600"),
|
|
1144
1153
|
children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
|
|
1145
1154
|
}), /* @__PURE__ */ Q("div", {
|
|
1146
1155
|
className: "flex-1 min-w-0 pt-1",
|
|
@@ -1154,12 +1163,12 @@ var St = {
|
|
|
1154
1163
|
" ",
|
|
1155
1164
|
/* @__PURE__ */ Z("span", {
|
|
1156
1165
|
className: "text-muted-foreground",
|
|
1157
|
-
children:
|
|
1166
|
+
children: wt(e)
|
|
1158
1167
|
})
|
|
1159
1168
|
]
|
|
1160
1169
|
}), /* @__PURE__ */ Z("p", {
|
|
1161
1170
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
1162
|
-
children:
|
|
1171
|
+
children: Ct(e.timestamp)
|
|
1163
1172
|
})]
|
|
1164
1173
|
})]
|
|
1165
1174
|
}, e.id);
|
|
@@ -1167,7 +1176,7 @@ var St = {
|
|
|
1167
1176
|
})]
|
|
1168
1177
|
})] })]
|
|
1169
1178
|
});
|
|
1170
|
-
},
|
|
1179
|
+
}, Dt = {
|
|
1171
1180
|
create: "default",
|
|
1172
1181
|
update: "secondary",
|
|
1173
1182
|
delete: "destructive",
|
|
@@ -1179,12 +1188,12 @@ var St = {
|
|
|
1179
1188
|
export: "outline",
|
|
1180
1189
|
import: "outline"
|
|
1181
1190
|
};
|
|
1182
|
-
function
|
|
1191
|
+
function Ot(e) {
|
|
1183
1192
|
if (!e) return "";
|
|
1184
1193
|
let t = e instanceof Date ? e : new Date(e);
|
|
1185
1194
|
return Number.isNaN(t.getTime()) ? String(e) : t.toLocaleString();
|
|
1186
1195
|
}
|
|
1187
|
-
var
|
|
1196
|
+
var kt = [
|
|
1188
1197
|
[60, "second"],
|
|
1189
1198
|
[60, "minute"],
|
|
1190
1199
|
[24, "hour"],
|
|
@@ -1193,27 +1202,27 @@ var Et = [
|
|
|
1193
1202
|
[12, "month"],
|
|
1194
1203
|
[Infinity, "year"]
|
|
1195
1204
|
];
|
|
1196
|
-
function
|
|
1205
|
+
function At(e, t) {
|
|
1197
1206
|
if (!e) return "";
|
|
1198
1207
|
let n = e instanceof Date ? e : new Date(e);
|
|
1199
1208
|
if (Number.isNaN(n.getTime())) return String(e);
|
|
1200
1209
|
let r = (n.getTime() - Date.now()) / 1e3;
|
|
1201
|
-
for (let [n, i] of
|
|
1210
|
+
for (let [n, i] of kt) {
|
|
1202
1211
|
if (Math.abs(r) < n) try {
|
|
1203
1212
|
return new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(Math.round(r), i);
|
|
1204
1213
|
} catch {
|
|
1205
|
-
return
|
|
1214
|
+
return Ot(e);
|
|
1206
1215
|
}
|
|
1207
1216
|
r /= n;
|
|
1208
1217
|
}
|
|
1209
|
-
return
|
|
1218
|
+
return Ot(e);
|
|
1210
1219
|
}
|
|
1211
|
-
function
|
|
1220
|
+
function jt(e) {
|
|
1212
1221
|
if (!e) return "?";
|
|
1213
1222
|
let t = e.trim().split(/\s+/).filter(Boolean).slice(0, 2);
|
|
1214
1223
|
return t.length === 0 ? "?" : t.map((e) => e.charAt(0).toUpperCase()).join("");
|
|
1215
1224
|
}
|
|
1216
|
-
function
|
|
1225
|
+
function Mt(e) {
|
|
1217
1226
|
if (e == null || e === "") return "—";
|
|
1218
1227
|
if (typeof e == "string") return e;
|
|
1219
1228
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -1223,7 +1232,7 @@ function kt(e) {
|
|
|
1223
1232
|
return String(e);
|
|
1224
1233
|
}
|
|
1225
1234
|
}
|
|
1226
|
-
function
|
|
1235
|
+
function Nt({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
1227
1236
|
return t ? /* @__PURE__ */ Z("div", {
|
|
1228
1237
|
className: L("space-y-3", r),
|
|
1229
1238
|
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ Q("div", {
|
|
@@ -1241,17 +1250,17 @@ function At({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1241
1250
|
children: /* @__PURE__ */ Z("ol", {
|
|
1242
1251
|
className: L("space-y-4", r),
|
|
1243
1252
|
children: e.map((e, t) => {
|
|
1244
|
-
let n =
|
|
1253
|
+
let n = (e.action ?? "").toLowerCase(), r = Dt[n] ?? "outline", a = typeof e.user_name == "string" && e.user_name.trim() || "Unknown user", o = Ot(e.created_at), s = At(e.created_at, i), c = typeof e.user_avatar == "string" ? e.user_avatar : void 0;
|
|
1245
1254
|
return /* @__PURE__ */ Q("li", {
|
|
1246
1255
|
className: "flex items-start gap-3",
|
|
1247
1256
|
children: [/* @__PURE__ */ Q(f, {
|
|
1248
1257
|
className: "h-8 w-8 mt-0.5 shrink-0",
|
|
1249
|
-
children: [
|
|
1250
|
-
src:
|
|
1251
|
-
alt:
|
|
1258
|
+
children: [c ? /* @__PURE__ */ Z(m, {
|
|
1259
|
+
src: c,
|
|
1260
|
+
alt: a
|
|
1252
1261
|
}) : null, /* @__PURE__ */ Z(p, {
|
|
1253
1262
|
className: "text-[10px] font-medium",
|
|
1254
|
-
children:
|
|
1263
|
+
children: jt(e.user_name)
|
|
1255
1264
|
})]
|
|
1256
1265
|
}), /* @__PURE__ */ Q("div", {
|
|
1257
1266
|
className: "min-w-0 flex-1",
|
|
@@ -1261,28 +1270,53 @@ function At({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1261
1270
|
children: [
|
|
1262
1271
|
/* @__PURE__ */ Z("span", {
|
|
1263
1272
|
className: "text-sm font-medium text-foreground",
|
|
1264
|
-
children:
|
|
1273
|
+
children: a
|
|
1265
1274
|
}),
|
|
1266
1275
|
e.action && /* @__PURE__ */ Z(h, {
|
|
1267
|
-
variant:
|
|
1276
|
+
variant: r,
|
|
1268
1277
|
className: "text-[10px] uppercase tracking-wide",
|
|
1269
1278
|
children: e.action
|
|
1270
1279
|
}),
|
|
1271
|
-
|
|
1280
|
+
o && /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
|
|
1272
1281
|
asChild: !0,
|
|
1273
1282
|
children: /* @__PURE__ */ Z("span", {
|
|
1274
1283
|
className: "text-xs text-muted-foreground cursor-help",
|
|
1275
|
-
"aria-label":
|
|
1276
|
-
children:
|
|
1284
|
+
"aria-label": o,
|
|
1285
|
+
children: s || o
|
|
1277
1286
|
})
|
|
1278
|
-
}), /* @__PURE__ */ Z(P, { children:
|
|
1287
|
+
}), /* @__PURE__ */ Z(P, { children: o })] })
|
|
1279
1288
|
]
|
|
1280
1289
|
}),
|
|
1281
1290
|
e.summary && /* @__PURE__ */ Z("p", {
|
|
1282
1291
|
className: "mt-1 text-sm text-muted-foreground",
|
|
1283
1292
|
children: e.summary
|
|
1284
1293
|
}),
|
|
1285
|
-
e.changes && e.changes.length > 0 && /* @__PURE__ */
|
|
1294
|
+
e.changes && e.changes.length > 0 && (n === "create" ? /* @__PURE__ */ Q("details", {
|
|
1295
|
+
className: "mt-1 group",
|
|
1296
|
+
children: [/* @__PURE__ */ Q("summary", {
|
|
1297
|
+
className: "cursor-pointer list-none text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 select-none",
|
|
1298
|
+
children: [/* @__PURE__ */ Z("span", {
|
|
1299
|
+
className: "transition-transform group-open:rotate-90",
|
|
1300
|
+
children: "▸"
|
|
1301
|
+
}), /* @__PURE__ */ Z("span", { children: e.changes.length === 1 ? "1 field populated" : `${e.changes.length} fields populated` })]
|
|
1302
|
+
}), /* @__PURE__ */ Z("ul", {
|
|
1303
|
+
className: "mt-1.5 space-y-0.5 text-xs text-muted-foreground pl-4",
|
|
1304
|
+
children: e.changes.map((e) => /* @__PURE__ */ Q("li", {
|
|
1305
|
+
className: "leading-relaxed",
|
|
1306
|
+
children: [
|
|
1307
|
+
/* @__PURE__ */ Z("span", {
|
|
1308
|
+
className: "font-medium text-foreground",
|
|
1309
|
+
children: e.label || e.field
|
|
1310
|
+
}),
|
|
1311
|
+
": ",
|
|
1312
|
+
/* @__PURE__ */ Z("span", {
|
|
1313
|
+
className: "text-foreground",
|
|
1314
|
+
children: Mt(e.to)
|
|
1315
|
+
})
|
|
1316
|
+
]
|
|
1317
|
+
}, e.field))
|
|
1318
|
+
})]
|
|
1319
|
+
}) : /* @__PURE__ */ Z("ul", {
|
|
1286
1320
|
className: "mt-1.5 space-y-0.5 text-xs text-muted-foreground",
|
|
1287
1321
|
children: e.changes.map((e) => /* @__PURE__ */ Q("li", {
|
|
1288
1322
|
className: "leading-relaxed",
|
|
@@ -1294,16 +1328,16 @@ function At({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1294
1328
|
": ",
|
|
1295
1329
|
/* @__PURE__ */ Z("span", {
|
|
1296
1330
|
className: "line-through opacity-70",
|
|
1297
|
-
children:
|
|
1331
|
+
children: Mt(e.from)
|
|
1298
1332
|
}),
|
|
1299
1333
|
" → ",
|
|
1300
1334
|
/* @__PURE__ */ Z("span", {
|
|
1301
1335
|
className: "text-foreground",
|
|
1302
|
-
children:
|
|
1336
|
+
children: Mt(e.to)
|
|
1303
1337
|
})
|
|
1304
1338
|
]
|
|
1305
1339
|
}, e.field))
|
|
1306
|
-
})
|
|
1340
|
+
}))
|
|
1307
1341
|
]
|
|
1308
1342
|
})]
|
|
1309
1343
|
}, e.id ?? t);
|
|
@@ -1313,13 +1347,13 @@ function At({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1313
1347
|
}
|
|
1314
1348
|
//#endregion
|
|
1315
1349
|
//#region src/RecordMetaFooter.tsx
|
|
1316
|
-
var
|
|
1350
|
+
var Pt = {
|
|
1317
1351
|
createdAt: "created_at",
|
|
1318
1352
|
createdBy: "created_by",
|
|
1319
1353
|
updatedAt: "updated_at",
|
|
1320
1354
|
updatedBy: "updated_by"
|
|
1321
1355
|
};
|
|
1322
|
-
function
|
|
1356
|
+
function Ft(e) {
|
|
1323
1357
|
if (!e) return null;
|
|
1324
1358
|
if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
|
|
1325
1359
|
if (typeof e == "string" || typeof e == "number") {
|
|
@@ -1328,7 +1362,7 @@ function Mt(e) {
|
|
|
1328
1362
|
}
|
|
1329
1363
|
return null;
|
|
1330
1364
|
}
|
|
1331
|
-
function
|
|
1365
|
+
function It(e, t) {
|
|
1332
1366
|
let n = Date.now() - e.getTime(), r = Math.max(0, Math.floor(n / 1e3));
|
|
1333
1367
|
if (r < 60) return t("detail.justNow");
|
|
1334
1368
|
let i = Math.floor(r / 60);
|
|
@@ -1336,7 +1370,7 @@ function Nt(e, t) {
|
|
|
1336
1370
|
let a = Math.floor(i / 60);
|
|
1337
1371
|
return a < 24 ? t("detail.hoursAgo", { count: a }) : t("detail.daysAgo", { count: Math.floor(a / 24) });
|
|
1338
1372
|
}
|
|
1339
|
-
function
|
|
1373
|
+
function Lt(e) {
|
|
1340
1374
|
try {
|
|
1341
1375
|
return new Intl.DateTimeFormat(void 0, {
|
|
1342
1376
|
dateStyle: "medium",
|
|
@@ -1346,16 +1380,16 @@ function Pt(e) {
|
|
|
1346
1380
|
return e.toISOString();
|
|
1347
1381
|
}
|
|
1348
1382
|
}
|
|
1349
|
-
var
|
|
1383
|
+
var Rt = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
1350
1384
|
if (e == null || e === "") return null;
|
|
1351
1385
|
let r = t?.fields?.[n], i = r?.reference_to || r?.reference, a = {
|
|
1352
1386
|
name: n,
|
|
1353
1387
|
type: r?.type || (i ? "lookup" : "text"),
|
|
1354
1388
|
...i && { reference_to: i },
|
|
1355
1389
|
...r?.reference_field && { reference_field: r.reference_field }
|
|
1356
|
-
}, o =
|
|
1390
|
+
}, o = tt(a) || a.type;
|
|
1357
1391
|
if (o) {
|
|
1358
|
-
let t =
|
|
1392
|
+
let t = et(o);
|
|
1359
1393
|
if (t) return /* @__PURE__ */ Z("span", {
|
|
1360
1394
|
className: "inline-flex items-center [&_a]:text-inherit [&_a]:hover:underline",
|
|
1361
1395
|
children: /* @__PURE__ */ Z(t, {
|
|
@@ -1365,7 +1399,7 @@ var Ft = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1365
1399
|
});
|
|
1366
1400
|
}
|
|
1367
1401
|
return /* @__PURE__ */ Z("span", { children: String(e) });
|
|
1368
|
-
},
|
|
1402
|
+
}, zt = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
|
|
1369
1403
|
if (!t && !n) return null;
|
|
1370
1404
|
let o = n ? /* @__PURE__ */ Z(F, {
|
|
1371
1405
|
delayDuration: 200,
|
|
@@ -1374,11 +1408,11 @@ var Ft = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1374
1408
|
children: /* @__PURE__ */ Z("time", {
|
|
1375
1409
|
dateTime: n.toISOString(),
|
|
1376
1410
|
className: "cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2",
|
|
1377
|
-
children:
|
|
1411
|
+
children: It(n, a)
|
|
1378
1412
|
})
|
|
1379
1413
|
}), /* @__PURE__ */ Z(P, {
|
|
1380
1414
|
side: "top",
|
|
1381
|
-
children:
|
|
1415
|
+
children: Lt(n)
|
|
1382
1416
|
})] })
|
|
1383
1417
|
}) : null;
|
|
1384
1418
|
return /* @__PURE__ */ Q("span", {
|
|
@@ -1388,7 +1422,7 @@ var Ft = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1388
1422
|
className: "text-muted-foreground/70",
|
|
1389
1423
|
children: e
|
|
1390
1424
|
}),
|
|
1391
|
-
t ? /* @__PURE__ */ Z(
|
|
1425
|
+
t ? /* @__PURE__ */ Z(Rt, {
|
|
1392
1426
|
value: t,
|
|
1393
1427
|
objectSchema: r,
|
|
1394
1428
|
fieldName: i
|
|
@@ -1400,31 +1434,31 @@ var Ft = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1400
1434
|
o
|
|
1401
1435
|
]
|
|
1402
1436
|
});
|
|
1403
|
-
},
|
|
1437
|
+
}, Bt = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
|
|
1404
1438
|
let { t: i } = $();
|
|
1405
1439
|
if (!e) return null;
|
|
1406
|
-
let a =
|
|
1440
|
+
let a = Ft(e[Pt.createdAt]), o = Ft(e[Pt.updatedAt]), s = e[Pt.createdBy], c = e[Pt.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));
|
|
1407
1441
|
return !l && !d ? null : /* @__PURE__ */ Q("div", {
|
|
1408
1442
|
className: L("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),
|
|
1409
1443
|
"data-testid": "record-meta-footer",
|
|
1410
|
-
children: [l && /* @__PURE__ */ Z(
|
|
1444
|
+
children: [l && /* @__PURE__ */ Z(zt, {
|
|
1411
1445
|
label: i("detail.createdBy"),
|
|
1412
1446
|
user: s,
|
|
1413
1447
|
date: a,
|
|
1414
1448
|
objectSchema: t,
|
|
1415
|
-
userField:
|
|
1449
|
+
userField: Pt.createdBy,
|
|
1416
1450
|
t: i
|
|
1417
|
-
}), d && /* @__PURE__ */ Z(
|
|
1451
|
+
}), d && /* @__PURE__ */ Z(zt, {
|
|
1418
1452
|
label: i("detail.updatedBy"),
|
|
1419
1453
|
user: c,
|
|
1420
1454
|
date: o,
|
|
1421
1455
|
objectSchema: t,
|
|
1422
|
-
userField:
|
|
1456
|
+
userField: Pt.updatedBy,
|
|
1423
1457
|
t: i
|
|
1424
1458
|
})]
|
|
1425
1459
|
});
|
|
1426
|
-
},
|
|
1427
|
-
function
|
|
1460
|
+
}, Vt = 5;
|
|
1461
|
+
function Ht(e, t, n, r) {
|
|
1428
1462
|
if (e && typeof e == "object") {
|
|
1429
1463
|
if (t.primaryField) {
|
|
1430
1464
|
let n = e[t.primaryField];
|
|
@@ -1471,8 +1505,8 @@ function zt(e, t, n, r) {
|
|
|
1471
1505
|
}
|
|
1472
1506
|
return r;
|
|
1473
1507
|
}
|
|
1474
|
-
var
|
|
1475
|
-
let [m, _] = n.useState(e.data), [v, y] = n.useState(!e.data && !!(e.api && e.resourceId || r && e.objectName && e.resourceId)), [b, x] = n.useState(!1), [S, C] = n.useState(!1), [w, T] = n.useState({}), [E, D] = n.useState(null), [O,
|
|
1508
|
+
var Ut = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBack: s, inlineEdit: c = !1, onFieldSave: l, discussionSlot: u, rightRail: d, objectLabel: f, onDataLoaded: p }) => {
|
|
1509
|
+
let [m, _] = n.useState(e.data), [v, y] = n.useState(!e.data && !!(e.api && e.resourceId || r && e.objectName && e.resourceId)), [b, x] = n.useState(!1), [S, C] = n.useState(!1), [w, T] = n.useState({}), [E, D] = n.useState(null), [O, ne] = n.useState(!1), { t: z } = $(), { fieldOptionLabel: B } = Ze(), re = te(), V = it(), H = n.useMemo(() => {
|
|
1476
1510
|
if (!V?.isLoaded || !e.objectName) return e;
|
|
1477
1511
|
let t = (t) => V.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
|
|
1478
1512
|
let n = typeof e == "string" ? e : e?.name;
|
|
@@ -1491,7 +1525,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1491
1525
|
n.useEffect(() => {
|
|
1492
1526
|
m && p && p(m);
|
|
1493
1527
|
}, [m, p]);
|
|
1494
|
-
let
|
|
1528
|
+
let ie = n.useMemo(() => {
|
|
1495
1529
|
if (H.summaryFields && H.summaryFields.length > 0) return [];
|
|
1496
1530
|
let e = [...H.sections?.flatMap((e) => e.fields) || [], ...H.fields || []], t = {};
|
|
1497
1531
|
for (let n of e) t[n.name] || (t[n.name] = n);
|
|
@@ -1517,9 +1551,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1517
1551
|
H.fields,
|
|
1518
1552
|
E,
|
|
1519
1553
|
m
|
|
1520
|
-
]),
|
|
1554
|
+
]), U = H.summaryFields && H.summaryFields.length > 0 ? H.summaryFields : ie, ae = n.useCallback(() => {
|
|
1521
1555
|
H.resourceId && navigator.clipboard.writeText(String(H.resourceId)).then(() => {
|
|
1522
|
-
|
|
1556
|
+
ne(!0), setTimeout(() => ne(!1), 1500);
|
|
1523
1557
|
});
|
|
1524
1558
|
}, [H.resourceId]);
|
|
1525
1559
|
n.useEffect(() => {
|
|
@@ -1572,18 +1606,18 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1572
1606
|
H.sections,
|
|
1573
1607
|
H.fields
|
|
1574
1608
|
]);
|
|
1575
|
-
let
|
|
1609
|
+
let oe = n.useCallback(() => {
|
|
1576
1610
|
if (s) s();
|
|
1577
1611
|
else if (H.onNavigate) {
|
|
1578
1612
|
let e = H.backUrl || (H.objectName ? `/${H.objectName}` : "/");
|
|
1579
1613
|
H.onNavigate(e, { replace: !0 });
|
|
1580
1614
|
} else H.backUrl ? window.location.href = H.backUrl : window.history.back();
|
|
1581
|
-
}, [s, H]),
|
|
1615
|
+
}, [s, H]), se = n.useCallback(() => {
|
|
1582
1616
|
a ? a() : H.onNavigate && H.editUrl ? H.onNavigate(H.editUrl) : H.onNavigate && H.objectName && H.resourceId ? H.onNavigate(`/${H.objectName}/${H.resourceId}/edit`) : H.editUrl && (window.location.href = H.editUrl);
|
|
1583
|
-
}, [a, H]),
|
|
1617
|
+
}, [a, H]), ue = n.useCallback(() => {
|
|
1584
1618
|
let e = H.deleteConfirmation || z("detail.deleteConfirmation");
|
|
1585
1619
|
window.confirm(e) && (o?.(), H.onNavigate && H.objectName && H.onNavigate(`/${H.objectName}`, { replace: !0 }));
|
|
1586
|
-
}, [o, H]),
|
|
1620
|
+
}, [o, H]), de = n.useCallback(() => {
|
|
1587
1621
|
navigator.share && H.objectName && H.resourceId ? navigator.share({
|
|
1588
1622
|
title: H.title || z("detail.details"),
|
|
1589
1623
|
text: `${H.objectName} #${H.resourceId}`,
|
|
@@ -1591,9 +1625,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1591
1625
|
}).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
|
|
1592
1626
|
console.log("Link copied to clipboard");
|
|
1593
1627
|
});
|
|
1594
|
-
}, [H]),
|
|
1628
|
+
}, [H]), fe = n.useCallback(() => {
|
|
1595
1629
|
x(!b);
|
|
1596
|
-
}, [b]),
|
|
1630
|
+
}, [b]), pe = n.useCallback(() => {
|
|
1597
1631
|
if (S) {
|
|
1598
1632
|
let e = Object.entries(w);
|
|
1599
1633
|
if (e.length > 0) {
|
|
@@ -1613,9 +1647,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1613
1647
|
w,
|
|
1614
1648
|
m,
|
|
1615
1649
|
l
|
|
1616
|
-
]),
|
|
1650
|
+
]), ge = n.useCallback(() => {
|
|
1617
1651
|
T({}), C(!1);
|
|
1618
|
-
}, []),
|
|
1652
|
+
}, []), G = n.useCallback((e, t) => {
|
|
1619
1653
|
T((n) => ({
|
|
1620
1654
|
...n,
|
|
1621
1655
|
[e]: t
|
|
@@ -1629,28 +1663,28 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1629
1663
|
};
|
|
1630
1664
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
1631
1665
|
}, [H.recordNavigation]);
|
|
1632
|
-
let
|
|
1666
|
+
let _e = n.useMemo(() => H.related ?? [], [H.related]), ve = n.useMemo(() => {
|
|
1633
1667
|
let e = [];
|
|
1634
1668
|
return e.push({
|
|
1635
1669
|
name: "sys_share",
|
|
1636
1670
|
label: z("detail.share"),
|
|
1637
1671
|
icon: "share-2",
|
|
1638
1672
|
type: "script",
|
|
1639
|
-
onClick:
|
|
1673
|
+
onClick: de
|
|
1640
1674
|
}), H.showEdit && e.push({
|
|
1641
1675
|
name: "sys_edit_mobile",
|
|
1642
1676
|
label: z("detail.edit"),
|
|
1643
1677
|
icon: "edit",
|
|
1644
1678
|
type: "script",
|
|
1645
1679
|
className: "sm:hidden",
|
|
1646
|
-
onClick:
|
|
1680
|
+
onClick: se
|
|
1647
1681
|
}), c && e.push({
|
|
1648
1682
|
name: "sys_toggle_inline_edit_mobile",
|
|
1649
1683
|
label: z(S ? "detail.save" : "detail.editInline"),
|
|
1650
1684
|
icon: "edit",
|
|
1651
1685
|
type: "script",
|
|
1652
1686
|
className: "sm:hidden",
|
|
1653
|
-
onClick:
|
|
1687
|
+
onClick: pe
|
|
1654
1688
|
}), H.showDelete && e.push({
|
|
1655
1689
|
name: "sys_delete",
|
|
1656
1690
|
label: z("detail.delete"),
|
|
@@ -1658,7 +1692,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1658
1692
|
type: "script",
|
|
1659
1693
|
variant: "destructive",
|
|
1660
1694
|
tags: ["separator-before"],
|
|
1661
|
-
onClick:
|
|
1695
|
+
onClick: ue
|
|
1662
1696
|
}), e;
|
|
1663
1697
|
}, [
|
|
1664
1698
|
z,
|
|
@@ -1666,13 +1700,13 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1666
1700
|
H.showDelete,
|
|
1667
1701
|
c,
|
|
1668
1702
|
S,
|
|
1703
|
+
de,
|
|
1669
1704
|
se,
|
|
1670
|
-
|
|
1671
|
-
ue
|
|
1672
|
-
|
|
1673
|
-
]), he = n.useMemo(() => {
|
|
1705
|
+
pe,
|
|
1706
|
+
ue
|
|
1707
|
+
]), ye = n.useMemo(() => {
|
|
1674
1708
|
let e = H.actions ?? [];
|
|
1675
|
-
if (
|
|
1709
|
+
if (ve.length === 0) return e;
|
|
1676
1710
|
let t = !1, n = e.map((e) => {
|
|
1677
1711
|
let n = e;
|
|
1678
1712
|
if (n && typeof n == "object" && n.type === "action:bar" && (!n.location || n.location === "record_header")) {
|
|
@@ -1680,7 +1714,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1680
1714
|
let e = Array.isArray(n.systemActions) ? n.systemActions : [];
|
|
1681
1715
|
return {
|
|
1682
1716
|
...n,
|
|
1683
|
-
systemActions: [...e, ...
|
|
1717
|
+
systemActions: [...e, ...ve]
|
|
1684
1718
|
};
|
|
1685
1719
|
}
|
|
1686
1720
|
return e;
|
|
@@ -1688,9 +1722,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1688
1722
|
return t || n.push({
|
|
1689
1723
|
type: "action:bar",
|
|
1690
1724
|
location: "record_header",
|
|
1691
|
-
systemActions:
|
|
1725
|
+
systemActions: ve
|
|
1692
1726
|
}), n;
|
|
1693
|
-
}, [H.actions,
|
|
1727
|
+
}, [H.actions, ve]);
|
|
1694
1728
|
return v || H.loading ? /* @__PURE__ */ Q("div", {
|
|
1695
1729
|
className: L("space-y-4", i),
|
|
1696
1730
|
children: [
|
|
@@ -1712,9 +1746,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1712
1746
|
(H.showBack ?? !0) && /* @__PURE__ */ Q(g, {
|
|
1713
1747
|
variant: "outline",
|
|
1714
1748
|
size: "sm",
|
|
1715
|
-
onClick:
|
|
1749
|
+
onClick: oe,
|
|
1716
1750
|
className: "mt-4 gap-2",
|
|
1717
|
-
children: [/* @__PURE__ */ Z(
|
|
1751
|
+
children: [/* @__PURE__ */ Z(R, { className: "h-4 w-4" }), z("detail.goBack")]
|
|
1718
1752
|
})
|
|
1719
1753
|
]
|
|
1720
1754
|
}) : /* @__PURE__ */ Z(F, { children: /* @__PURE__ */ Q("div", {
|
|
@@ -1729,9 +1763,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1729
1763
|
children: /* @__PURE__ */ Z(g, {
|
|
1730
1764
|
variant: "ghost",
|
|
1731
1765
|
size: "icon",
|
|
1732
|
-
onClick:
|
|
1766
|
+
onClick: oe,
|
|
1733
1767
|
className: "shrink-0 mt-1",
|
|
1734
|
-
children: /* @__PURE__ */ Z(
|
|
1768
|
+
children: /* @__PURE__ */ Z(R, { className: "h-4 w-4" })
|
|
1735
1769
|
})
|
|
1736
1770
|
}), /* @__PURE__ */ Z(P, { children: z("detail.back") })] }), /* @__PURE__ */ Q("div", {
|
|
1737
1771
|
className: "flex-1 min-w-0",
|
|
@@ -1740,9 +1774,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1740
1774
|
children: [
|
|
1741
1775
|
/* @__PURE__ */ Z("h1", {
|
|
1742
1776
|
className: "text-xl sm:text-2xl font-bold truncate",
|
|
1743
|
-
children:
|
|
1777
|
+
children: Ht(m, H, E, z("detail.details"))
|
|
1744
1778
|
}),
|
|
1745
|
-
|
|
1779
|
+
U.map((e) => {
|
|
1746
1780
|
let t = m?.[e];
|
|
1747
1781
|
if (t == null || t === "") return null;
|
|
1748
1782
|
let n = (H.sections || []).flatMap((e) => e.fields).concat(H.fields || []).find((t) => t.name === e), r = E?.fields?.[e], i = n?.type || r?.type, a = String(t), o = null;
|
|
@@ -1776,7 +1810,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1776
1810
|
let e = i[String(t)];
|
|
1777
1811
|
e?.label && (o = e.label);
|
|
1778
1812
|
}
|
|
1779
|
-
a = H.objectName ?
|
|
1813
|
+
a = H.objectName ? B(H.objectName, e, String(t), o) : o;
|
|
1780
1814
|
}
|
|
1781
1815
|
} catch {}
|
|
1782
1816
|
return o === null ? /* @__PURE__ */ Z(h, {
|
|
@@ -1804,9 +1838,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1804
1838
|
variant: "ghost",
|
|
1805
1839
|
size: "icon",
|
|
1806
1840
|
className: "h-6 w-6 shrink-0",
|
|
1807
|
-
onClick:
|
|
1841
|
+
onClick: fe,
|
|
1808
1842
|
"aria-label": z(b ? "detail.removeFromFavorites" : "detail.addToFavorites"),
|
|
1809
|
-
children: b ? /* @__PURE__ */ Z(
|
|
1843
|
+
children: b ? /* @__PURE__ */ Z(Re, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z(Re, { className: "h-4 w-4 text-muted-foreground" })
|
|
1810
1844
|
})
|
|
1811
1845
|
}), /* @__PURE__ */ Z(P, { children: z(b ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
|
|
1812
1846
|
]
|
|
@@ -1821,9 +1855,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1821
1855
|
variant: "ghost",
|
|
1822
1856
|
size: "icon",
|
|
1823
1857
|
className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
|
|
1824
|
-
onClick:
|
|
1858
|
+
onClick: ae,
|
|
1825
1859
|
"aria-label": z("detail.copyRecordId", { defaultValue: "Copy record ID" }),
|
|
1826
|
-
children: O ? /* @__PURE__ */ Z(
|
|
1860
|
+
children: O ? /* @__PURE__ */ Z(W, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(me, { className: "h-3 w-3" })
|
|
1827
1861
|
})
|
|
1828
1862
|
}), /* @__PURE__ */ Z(P, { children: O ? z("detail.copied", { defaultValue: "Copied" }) : z("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
|
|
1829
1863
|
})]
|
|
@@ -1866,19 +1900,19 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1866
1900
|
let e = H.recordNavigation;
|
|
1867
1901
|
e.currentIndex < e.recordIds.length - 1 && e.onNavigate(e.recordIds[e.currentIndex + 1]);
|
|
1868
1902
|
},
|
|
1869
|
-
children: /* @__PURE__ */ Z(
|
|
1903
|
+
children: /* @__PURE__ */ Z(le, { className: "h-4 w-4" })
|
|
1870
1904
|
})
|
|
1871
1905
|
}), /* @__PURE__ */ Z(P, { children: z("detail.nextRecord") })] })
|
|
1872
1906
|
]
|
|
1873
1907
|
}),
|
|
1874
|
-
c && /* @__PURE__ */ Q(
|
|
1908
|
+
c && /* @__PURE__ */ Q(nt, { children: [S && /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
|
|
1875
1909
|
asChild: !0,
|
|
1876
1910
|
children: /* @__PURE__ */ Q(g, {
|
|
1877
1911
|
variant: "ghost",
|
|
1878
1912
|
size: "sm",
|
|
1879
|
-
onClick:
|
|
1913
|
+
onClick: ge,
|
|
1880
1914
|
className: "gap-2 hidden sm:inline-flex",
|
|
1881
|
-
children: [/* @__PURE__ */ Z(
|
|
1915
|
+
children: [/* @__PURE__ */ Z(Ve, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1882
1916
|
className: "hidden sm:inline",
|
|
1883
1917
|
children: z("detail.cancel")
|
|
1884
1918
|
})]
|
|
@@ -1888,12 +1922,12 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1888
1922
|
children: /* @__PURE__ */ Z(g, {
|
|
1889
1923
|
variant: S ? "default" : "outline",
|
|
1890
1924
|
size: "sm",
|
|
1891
|
-
onClick:
|
|
1925
|
+
onClick: pe,
|
|
1892
1926
|
className: "gap-2 hidden sm:inline-flex",
|
|
1893
|
-
children: S ? /* @__PURE__ */ Q(
|
|
1927
|
+
children: S ? /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z(W, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1894
1928
|
className: "hidden sm:inline",
|
|
1895
1929
|
children: z("detail.save")
|
|
1896
|
-
})] }) : /* @__PURE__ */ Q(
|
|
1930
|
+
})] }) : /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1897
1931
|
className: "hidden sm:inline",
|
|
1898
1932
|
children: z("detail.editInline")
|
|
1899
1933
|
})] })
|
|
@@ -1903,36 +1937,36 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1903
1937
|
asChild: !0,
|
|
1904
1938
|
children: /* @__PURE__ */ Q(g, {
|
|
1905
1939
|
variant: "default",
|
|
1906
|
-
onClick:
|
|
1940
|
+
onClick: se,
|
|
1907
1941
|
className: "gap-2 hidden sm:inline-flex",
|
|
1908
|
-
children: [/* @__PURE__ */ Z(
|
|
1942
|
+
children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1909
1943
|
className: "hidden sm:inline",
|
|
1910
1944
|
children: z("detail.edit")
|
|
1911
1945
|
})]
|
|
1912
1946
|
})
|
|
1913
1947
|
}), /* @__PURE__ */ Z(P, { children: z("detail.editRecord") })] }),
|
|
1914
|
-
|
|
1948
|
+
ye.map((e, t) => /* @__PURE__ */ Z(We, {
|
|
1915
1949
|
schema: e,
|
|
1916
1950
|
data: m
|
|
1917
1951
|
}, `header-action-${t}`))
|
|
1918
1952
|
]
|
|
1919
1953
|
})]
|
|
1920
1954
|
}),
|
|
1921
|
-
H.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(
|
|
1955
|
+
H.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(We, {
|
|
1922
1956
|
schema: H.header,
|
|
1923
1957
|
data: m
|
|
1924
1958
|
}) }),
|
|
1925
|
-
H.highlightFields && H.highlightFields.length > 0 && /* @__PURE__ */ Z(
|
|
1959
|
+
H.highlightFields && H.highlightFields.length > 0 && /* @__PURE__ */ Z(vt, {
|
|
1926
1960
|
fields: H.highlightFields,
|
|
1927
1961
|
data: m,
|
|
1928
1962
|
objectName: H.objectName,
|
|
1929
1963
|
objectSchema: E
|
|
1930
1964
|
}),
|
|
1931
1965
|
H.autoTabs && !H.tabs?.length ? (() => {
|
|
1932
|
-
let e =
|
|
1966
|
+
let e = _e.length > 0, t = !!H.activities && H.activities.length > 0, n = !!u, i = !!H.history, a = /* @__PURE__ */ Q("div", {
|
|
1933
1967
|
className: "space-y-3 sm:space-y-4",
|
|
1934
1968
|
children: [
|
|
1935
|
-
H.sectionGroups && H.sectionGroups.length > 0 && H.sectionGroups.map((e, t) => /* @__PURE__ */ Z(
|
|
1969
|
+
H.sectionGroups && H.sectionGroups.length > 0 && H.sectionGroups.map((e, t) => /* @__PURE__ */ Z(_t, {
|
|
1936
1970
|
group: e,
|
|
1937
1971
|
data: {
|
|
1938
1972
|
...m,
|
|
@@ -1941,9 +1975,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1941
1975
|
objectSchema: E,
|
|
1942
1976
|
objectName: H.objectName,
|
|
1943
1977
|
isEditing: S,
|
|
1944
|
-
onFieldChange:
|
|
1978
|
+
onFieldChange: G
|
|
1945
1979
|
}, t)),
|
|
1946
|
-
H.sections && H.sections.length > 0 && H.sections.map((e, t) => /* @__PURE__ */ Z(
|
|
1980
|
+
H.sections && H.sections.length > 0 && H.sections.map((e, t) => /* @__PURE__ */ Z(pt, {
|
|
1947
1981
|
section: e,
|
|
1948
1982
|
data: {
|
|
1949
1983
|
...m,
|
|
@@ -1952,9 +1986,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1952
1986
|
objectSchema: E,
|
|
1953
1987
|
objectName: H.objectName,
|
|
1954
1988
|
isEditing: S,
|
|
1955
|
-
onFieldChange:
|
|
1989
|
+
onFieldChange: G
|
|
1956
1990
|
}, t)),
|
|
1957
|
-
H.fields && H.fields.length > 0 && !H.sections?.length && /* @__PURE__ */ Z(
|
|
1991
|
+
H.fields && H.fields.length > 0 && !H.sections?.length && /* @__PURE__ */ Z(pt, {
|
|
1958
1992
|
section: {
|
|
1959
1993
|
fields: H.fields,
|
|
1960
1994
|
columns: H.columns
|
|
@@ -1966,9 +2000,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1966
2000
|
objectSchema: E,
|
|
1967
2001
|
objectName: H.objectName,
|
|
1968
2002
|
isEditing: S,
|
|
1969
|
-
onFieldChange:
|
|
2003
|
+
onFieldChange: G
|
|
1970
2004
|
}),
|
|
1971
|
-
H.comments && /* @__PURE__ */ Z(
|
|
2005
|
+
H.comments && /* @__PURE__ */ Z(bt, {
|
|
1972
2006
|
comments: H.comments,
|
|
1973
2007
|
onAddComment: H.onAddComment
|
|
1974
2008
|
})
|
|
@@ -1997,7 +2031,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1997
2031
|
children: [z("detail.related"), /* @__PURE__ */ Z(h, {
|
|
1998
2032
|
variant: "secondary",
|
|
1999
2033
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2000
|
-
children:
|
|
2034
|
+
children: _e.length
|
|
2001
2035
|
})]
|
|
2002
2036
|
})
|
|
2003
2037
|
}),
|
|
@@ -2042,7 +2076,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2042
2076
|
className: "mt-4",
|
|
2043
2077
|
children: /* @__PURE__ */ Z("div", {
|
|
2044
2078
|
className: "space-y-3",
|
|
2045
|
-
children:
|
|
2079
|
+
children: _e.map((e, t) => /* @__PURE__ */ Z(gt, {
|
|
2046
2080
|
title: e.title,
|
|
2047
2081
|
type: e.type,
|
|
2048
2082
|
api: e.api,
|
|
@@ -2058,14 +2092,15 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2058
2092
|
onRowEdit: e.onRowEdit,
|
|
2059
2093
|
onRowDelete: e.onRowDelete,
|
|
2060
2094
|
collapsible: !0,
|
|
2061
|
-
|
|
2095
|
+
defaultCollapsed: re && t > 0,
|
|
2096
|
+
pageSize: Vt
|
|
2062
2097
|
}, t))
|
|
2063
2098
|
})
|
|
2064
2099
|
}),
|
|
2065
2100
|
t && /* @__PURE__ */ Z(j, {
|
|
2066
2101
|
value: "activity",
|
|
2067
2102
|
className: "mt-4",
|
|
2068
|
-
children: /* @__PURE__ */ Z(
|
|
2103
|
+
children: /* @__PURE__ */ Z(Et, { activities: H.activities })
|
|
2069
2104
|
}),
|
|
2070
2105
|
n && /* @__PURE__ */ Z(j, {
|
|
2071
2106
|
value: "discussion",
|
|
@@ -2075,7 +2110,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2075
2110
|
i && /* @__PURE__ */ Z(j, {
|
|
2076
2111
|
value: "history",
|
|
2077
2112
|
className: "mt-4",
|
|
2078
|
-
children: /* @__PURE__ */ Z(
|
|
2113
|
+
children: /* @__PURE__ */ Z(Nt, {
|
|
2079
2114
|
entries: H.history.entries,
|
|
2080
2115
|
loading: H.history.loading,
|
|
2081
2116
|
emptyText: H.history.emptyText ?? z("detail.historyEmpty", { defaultValue: "No history yet" })
|
|
@@ -2083,10 +2118,10 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2083
2118
|
})
|
|
2084
2119
|
]
|
|
2085
2120
|
});
|
|
2086
|
-
})() : /* @__PURE__ */ Q(
|
|
2121
|
+
})() : /* @__PURE__ */ Q(nt, { children: [
|
|
2087
2122
|
H.sectionGroups && H.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2088
2123
|
className: "space-y-3 sm:space-y-4",
|
|
2089
|
-
children: H.sectionGroups.map((e, t) => /* @__PURE__ */ Z(
|
|
2124
|
+
children: H.sectionGroups.map((e, t) => /* @__PURE__ */ Z(_t, {
|
|
2090
2125
|
group: e,
|
|
2091
2126
|
data: {
|
|
2092
2127
|
...m,
|
|
@@ -2095,12 +2130,12 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2095
2130
|
objectSchema: E,
|
|
2096
2131
|
objectName: H.objectName,
|
|
2097
2132
|
isEditing: S,
|
|
2098
|
-
onFieldChange:
|
|
2133
|
+
onFieldChange: G
|
|
2099
2134
|
}, t))
|
|
2100
2135
|
}),
|
|
2101
2136
|
H.sections && H.sections.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2102
2137
|
className: "space-y-3 sm:space-y-4",
|
|
2103
|
-
children: H.sections.map((e, t) => /* @__PURE__ */ Z(
|
|
2138
|
+
children: H.sections.map((e, t) => /* @__PURE__ */ Z(pt, {
|
|
2104
2139
|
section: e,
|
|
2105
2140
|
data: {
|
|
2106
2141
|
...m,
|
|
@@ -2109,10 +2144,10 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2109
2144
|
objectSchema: E,
|
|
2110
2145
|
objectName: H.objectName,
|
|
2111
2146
|
isEditing: S,
|
|
2112
|
-
onFieldChange:
|
|
2147
|
+
onFieldChange: G
|
|
2113
2148
|
}, t))
|
|
2114
2149
|
}),
|
|
2115
|
-
H.fields && H.fields.length > 0 && !H.sections?.length && /* @__PURE__ */ Z(
|
|
2150
|
+
H.fields && H.fields.length > 0 && !H.sections?.length && /* @__PURE__ */ Z(pt, {
|
|
2116
2151
|
section: {
|
|
2117
2152
|
fields: H.fields,
|
|
2118
2153
|
columns: H.columns
|
|
@@ -2124,18 +2159,18 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2124
2159
|
objectSchema: E,
|
|
2125
2160
|
objectName: H.objectName,
|
|
2126
2161
|
isEditing: S,
|
|
2127
|
-
onFieldChange:
|
|
2162
|
+
onFieldChange: G
|
|
2128
2163
|
}),
|
|
2129
|
-
H.tabs && H.tabs.length > 0 && /* @__PURE__ */ Z(
|
|
2164
|
+
H.tabs && H.tabs.length > 0 && /* @__PURE__ */ Z(mt, {
|
|
2130
2165
|
tabs: H.tabs,
|
|
2131
2166
|
data: m
|
|
2132
2167
|
}),
|
|
2133
|
-
|
|
2168
|
+
_e.length > 0 && /* @__PURE__ */ Q("div", {
|
|
2134
2169
|
className: "space-y-3",
|
|
2135
2170
|
children: [/* @__PURE__ */ Z("h2", {
|
|
2136
2171
|
className: "text-lg font-semibold",
|
|
2137
2172
|
children: z("detail.related")
|
|
2138
|
-
}),
|
|
2173
|
+
}), _e.map((e, t) => /* @__PURE__ */ Z(gt, {
|
|
2139
2174
|
title: e.title,
|
|
2140
2175
|
type: e.type,
|
|
2141
2176
|
api: e.api,
|
|
@@ -2151,16 +2186,17 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2151
2186
|
onRowEdit: e.onRowEdit,
|
|
2152
2187
|
onRowDelete: e.onRowDelete,
|
|
2153
2188
|
collapsible: !0,
|
|
2154
|
-
|
|
2189
|
+
defaultCollapsed: re && t > 0,
|
|
2190
|
+
pageSize: Vt
|
|
2155
2191
|
}, t))]
|
|
2156
2192
|
}),
|
|
2157
|
-
H.comments && /* @__PURE__ */ Z(
|
|
2193
|
+
H.comments && /* @__PURE__ */ Z(bt, {
|
|
2158
2194
|
comments: H.comments,
|
|
2159
2195
|
onAddComment: H.onAddComment
|
|
2160
2196
|
}),
|
|
2161
|
-
H.activities && H.activities.length > 0 && /* @__PURE__ */ Z(
|
|
2197
|
+
H.activities && H.activities.length > 0 && /* @__PURE__ */ Z(Et, { activities: H.activities })
|
|
2162
2198
|
] }),
|
|
2163
|
-
/* @__PURE__ */ Z(
|
|
2199
|
+
/* @__PURE__ */ Z(Bt, {
|
|
2164
2200
|
data: {
|
|
2165
2201
|
...m,
|
|
2166
2202
|
...w
|
|
@@ -2168,13 +2204,13 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2168
2204
|
objectSchema: E,
|
|
2169
2205
|
objectName: H.objectName
|
|
2170
2206
|
}),
|
|
2171
|
-
H.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(
|
|
2207
|
+
H.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(We, {
|
|
2172
2208
|
schema: H.footer,
|
|
2173
2209
|
data: m
|
|
2174
2210
|
}) })
|
|
2175
2211
|
]
|
|
2176
2212
|
}) });
|
|
2177
|
-
},
|
|
2213
|
+
}, Wt = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name) || null, Gt = (e) => {
|
|
2178
2214
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2179
2215
|
return {
|
|
2180
2216
|
designer: {
|
|
@@ -2184,8 +2220,8 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2184
2220
|
},
|
|
2185
2221
|
rest: i
|
|
2186
2222
|
};
|
|
2187
|
-
},
|
|
2188
|
-
let r =
|
|
2223
|
+
}, Kt = ({ schema: e = {}, className: t, ...n }) => {
|
|
2224
|
+
let r = Ye(), { designer: i } = Gt(n);
|
|
2189
2225
|
if (!r) return /* @__PURE__ */ Z("div", {
|
|
2190
2226
|
className: t,
|
|
2191
2227
|
"data-record-details-placeholder": !0,
|
|
@@ -2195,7 +2231,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2195
2231
|
children: "record:details — bind a record to preview"
|
|
2196
2232
|
})
|
|
2197
2233
|
});
|
|
2198
|
-
let a = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", o = r.objectName || "", s =
|
|
2234
|
+
let a = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", o = r.objectName || "", s = it(), { readableFields: c } = rt(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2199
2235
|
if (l.length > 0 && o && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2200
2236
|
className: t,
|
|
2201
2237
|
...i,
|
|
@@ -2208,39 +2244,61 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2208
2244
|
});
|
|
2209
2245
|
let u = e.enforceFieldSecurity === !0, d = Array.isArray(e.redactFields) ? e.redactFields : [], f = (e) => {
|
|
2210
2246
|
if (!e || !u && d.length === 0) return e;
|
|
2211
|
-
let t = e.map(
|
|
2247
|
+
let t = e.map(Wt).filter((e) => !!e), n = new Set((u && o ? c(t) : t).filter((e) => !d.includes(e)));
|
|
2212
2248
|
return e.filter((e) => {
|
|
2213
|
-
let t =
|
|
2249
|
+
let t = Wt(e);
|
|
2214
2250
|
return t ? n.has(t) : !0;
|
|
2215
2251
|
});
|
|
2216
2252
|
}, p = (e) => typeof e == "string" ? { name: e } : e && typeof e == "object" && !e.name && e.field ? {
|
|
2217
2253
|
...e,
|
|
2218
2254
|
name: e.field
|
|
2219
|
-
} : e, m = (e) => Array.isArray(e) ? e.map(p) : e, h =
|
|
2255
|
+
} : e, m = (e) => Array.isArray(e) ? e.map(p) : e, h = qe(), g = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e : Wt(e)).filter((e) => !!e));
|
|
2256
|
+
for (let e of h) g.add(e);
|
|
2257
|
+
let _ = r.objectSchema, v = r.data ?? {}, y = [
|
|
2258
|
+
_?.primaryField,
|
|
2259
|
+
"name",
|
|
2260
|
+
"full_name",
|
|
2261
|
+
"title",
|
|
2262
|
+
"subject",
|
|
2263
|
+
"display_name",
|
|
2264
|
+
"label"
|
|
2265
|
+
].filter((e) => typeof e == "string" && e.length > 0);
|
|
2266
|
+
for (let e of y) if (v[e] !== void 0 && v[e] !== null && v[e] !== "") {
|
|
2267
|
+
g.add(e);
|
|
2268
|
+
break;
|
|
2269
|
+
}
|
|
2270
|
+
let b = (e) => !e || g.size === 0 ? e : e.filter((e) => {
|
|
2271
|
+
let t = Wt(e);
|
|
2272
|
+
return t ? !g.has(t) : !0;
|
|
2273
|
+
}), x = b(m(f(e.fields))), S = Array.isArray(e.sections) ? e.sections.map((e) => ({
|
|
2220
2274
|
...e,
|
|
2221
2275
|
title: e.title ?? e.label,
|
|
2222
|
-
|
|
2223
|
-
|
|
2276
|
+
showBorder: e.showBorder ?? !1,
|
|
2277
|
+
hideEmpty: e.hideEmpty ?? !0,
|
|
2278
|
+
fields: b(m(f(e.fields)))
|
|
2279
|
+
})) : e.sections, C = e.inlineEdit ?? !0, w = {
|
|
2224
2280
|
type: "detail-view",
|
|
2225
2281
|
objectName: r.objectName,
|
|
2226
2282
|
resourceId: r.recordId,
|
|
2227
2283
|
data: r.data,
|
|
2228
2284
|
layout: a,
|
|
2229
2285
|
columns: e.columns,
|
|
2230
|
-
sections:
|
|
2231
|
-
fields:
|
|
2286
|
+
sections: S,
|
|
2287
|
+
fields: x,
|
|
2232
2288
|
showBack: !1,
|
|
2233
|
-
showHeader: e.showHeader ?? !1
|
|
2289
|
+
showHeader: e.showHeader ?? !1,
|
|
2290
|
+
inlineEdit: C
|
|
2234
2291
|
};
|
|
2235
2292
|
return /* @__PURE__ */ Z("div", {
|
|
2236
2293
|
className: t,
|
|
2237
2294
|
...i,
|
|
2238
|
-
children: /* @__PURE__ */ Z(
|
|
2239
|
-
schema:
|
|
2240
|
-
dataSource: r.dataSource
|
|
2295
|
+
children: /* @__PURE__ */ Z(Ut, {
|
|
2296
|
+
schema: w,
|
|
2297
|
+
dataSource: r.dataSource,
|
|
2298
|
+
inlineEdit: C
|
|
2241
2299
|
})
|
|
2242
2300
|
});
|
|
2243
|
-
},
|
|
2301
|
+
}, qt = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name || e.key) || null, Jt = (e) => {
|
|
2244
2302
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2245
2303
|
return {
|
|
2246
2304
|
designer: {
|
|
@@ -2250,8 +2308,8 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2250
2308
|
},
|
|
2251
2309
|
rest: i
|
|
2252
2310
|
};
|
|
2253
|
-
},
|
|
2254
|
-
let r =
|
|
2311
|
+
}, Yt = ({ schema: e = {}, className: t, ...n }) => {
|
|
2312
|
+
let r = Ye(), { designer: i } = Jt(n), a = e.title || e.objectName || "Related", o = e.objectName;
|
|
2255
2313
|
if (!o) return /* @__PURE__ */ Z("div", {
|
|
2256
2314
|
className: t,
|
|
2257
2315
|
...i,
|
|
@@ -2260,7 +2318,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2260
2318
|
children: "record:related_list — missing objectName"
|
|
2261
2319
|
})
|
|
2262
2320
|
});
|
|
2263
|
-
let s =
|
|
2321
|
+
let s = it(), { readableFields: c } = rt(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2264
2322
|
if (l.length > 0 && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2265
2323
|
className: t,
|
|
2266
2324
|
...i,
|
|
@@ -2273,27 +2331,28 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2273
2331
|
});
|
|
2274
2332
|
let u = e.enforceFieldSecurity === !0, d = Array.isArray(e.redactFields) ? e.redactFields : [], f = Array.isArray(e.columns) ? e.columns : [], p = f;
|
|
2275
2333
|
if (u || d.length > 0) {
|
|
2276
|
-
let e = f.map(
|
|
2334
|
+
let e = f.map(qt).filter((e) => !!e), t = new Set((u ? c(e) : e).filter((e) => !d.includes(e)));
|
|
2277
2335
|
p = f.filter((e) => {
|
|
2278
|
-
let n =
|
|
2336
|
+
let n = qt(e);
|
|
2279
2337
|
return n ? t.has(n) : !0;
|
|
2280
2338
|
});
|
|
2281
2339
|
}
|
|
2282
2340
|
return /* @__PURE__ */ Z("div", {
|
|
2283
2341
|
className: t,
|
|
2284
2342
|
...i,
|
|
2285
|
-
children: /* @__PURE__ */ Z(
|
|
2343
|
+
children: /* @__PURE__ */ Z(gt, {
|
|
2286
2344
|
title: a,
|
|
2287
2345
|
type: "table",
|
|
2288
2346
|
api: o,
|
|
2289
2347
|
objectName: o,
|
|
2290
2348
|
referenceField: e.relationshipField,
|
|
2349
|
+
parentId: r?.recordId,
|
|
2291
2350
|
columns: p,
|
|
2292
2351
|
pageSize: e.limit,
|
|
2293
2352
|
dataSource: r?.dataSource
|
|
2294
2353
|
})
|
|
2295
2354
|
});
|
|
2296
|
-
},
|
|
2355
|
+
}, Xt = (e) => {
|
|
2297
2356
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2298
2357
|
return {
|
|
2299
2358
|
designer: {
|
|
@@ -2303,11 +2362,11 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2303
2362
|
},
|
|
2304
2363
|
rest: i
|
|
2305
2364
|
};
|
|
2306
|
-
},
|
|
2307
|
-
let
|
|
2308
|
-
if (
|
|
2365
|
+
}, Zt = ({ schema: e = {}, className: t, ...n }) => {
|
|
2366
|
+
let i = Ye(), { designer: a } = Xt(n), o = i?.objectName || "", s = it(), { readableFields: c } = rt(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2367
|
+
if (l.length > 0 && o && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2309
2368
|
className: t,
|
|
2310
|
-
...
|
|
2369
|
+
...a,
|
|
2311
2370
|
role: "status",
|
|
2312
2371
|
"aria-live": "polite",
|
|
2313
2372
|
children: /* @__PURE__ */ Z("p", {
|
|
@@ -2315,23 +2374,23 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2315
2374
|
children: "Insufficient permissions to view highlights."
|
|
2316
2375
|
})
|
|
2317
2376
|
});
|
|
2318
|
-
let
|
|
2377
|
+
let u = (Array.isArray(e.fields) ? e.fields : []).map((e) => typeof e == "string" ? { name: e } : {
|
|
2319
2378
|
name: e?.name,
|
|
2320
2379
|
label: e?.label,
|
|
2321
2380
|
icon: e?.icon,
|
|
2322
2381
|
type: e?.type
|
|
2323
|
-
}).filter((e) => typeof e.name == "string" && e.name.length > 0),
|
|
2324
|
-
return /* @__PURE__ */ Z("div", {
|
|
2382
|
+
}).filter((e) => typeof e.name == "string" && e.name.length > 0), d = e.enforceFieldSecurity === !0, f = Array.isArray(e.redactFields) ? e.redactFields : [], p = d && o ? new Set(c(u.map((e) => e.name))) : null, m = u.filter((e) => !(f.includes(e.name) || p && !p.has(e.name)));
|
|
2383
|
+
return Xe(r.useId(), m.map((e) => e.name)), /* @__PURE__ */ Z("div", {
|
|
2325
2384
|
className: t,
|
|
2326
|
-
...
|
|
2327
|
-
children: /* @__PURE__ */ Z(
|
|
2328
|
-
fields:
|
|
2329
|
-
data:
|
|
2330
|
-
objectName:
|
|
2331
|
-
objectSchema:
|
|
2385
|
+
...a,
|
|
2386
|
+
children: /* @__PURE__ */ Z(vt, {
|
|
2387
|
+
fields: m,
|
|
2388
|
+
data: i?.data,
|
|
2389
|
+
objectName: i?.objectName,
|
|
2390
|
+
objectSchema: i?.objectSchema
|
|
2332
2391
|
})
|
|
2333
2392
|
});
|
|
2334
|
-
},
|
|
2393
|
+
}, Qt = ({ change: e, className: t }) => {
|
|
2335
2394
|
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));
|
|
2336
2395
|
return /* @__PURE__ */ Q("div", {
|
|
2337
2396
|
className: L("flex items-center gap-1.5 text-sm flex-wrap", t),
|
|
@@ -2344,21 +2403,21 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2344
2403
|
className: "text-muted-foreground line-through",
|
|
2345
2404
|
children: r
|
|
2346
2405
|
}),
|
|
2347
|
-
/* @__PURE__ */ Z(
|
|
2406
|
+
/* @__PURE__ */ Z(z, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
2348
2407
|
/* @__PURE__ */ Z("span", {
|
|
2349
2408
|
className: "text-foreground",
|
|
2350
2409
|
children: i
|
|
2351
2410
|
})
|
|
2352
2411
|
]
|
|
2353
2412
|
});
|
|
2354
|
-
},
|
|
2413
|
+
}, $t = [
|
|
2355
2414
|
"👍",
|
|
2356
2415
|
"❤️",
|
|
2357
2416
|
"🎉",
|
|
2358
2417
|
"😂",
|
|
2359
2418
|
"😮",
|
|
2360
2419
|
"😢"
|
|
2361
|
-
],
|
|
2420
|
+
], en = ({ reactions: e, onToggleReaction: t, emojiOptions: r = $t, className: i }) => {
|
|
2362
2421
|
let [a, o] = n.useState(!1), s = n.useCallback((e) => {
|
|
2363
2422
|
t?.(e), o(!1);
|
|
2364
2423
|
}, [t]);
|
|
@@ -2379,7 +2438,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2379
2438
|
className: "h-6 w-6",
|
|
2380
2439
|
onClick: () => o(!a),
|
|
2381
2440
|
"aria-label": "Add reaction",
|
|
2382
|
-
children: /* @__PURE__ */ Z(
|
|
2441
|
+
children: /* @__PURE__ */ Z(Le, { className: "h-3.5 w-3.5" })
|
|
2383
2442
|
}), a && /* @__PURE__ */ Z("div", {
|
|
2384
2443
|
className: "absolute bottom-full mb-1 left-0 bg-popover border rounded-md shadow-md z-50 p-1.5 flex gap-1",
|
|
2385
2444
|
role: "listbox",
|
|
@@ -2398,7 +2457,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2398
2457
|
};
|
|
2399
2458
|
//#endregion
|
|
2400
2459
|
//#region src/ThreadedReplies.tsx
|
|
2401
|
-
function
|
|
2460
|
+
function tn(e) {
|
|
2402
2461
|
try {
|
|
2403
2462
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
2404
2463
|
if (r < 1) return "just now";
|
|
@@ -2411,7 +2470,7 @@ function Qt(e) {
|
|
|
2411
2470
|
return e;
|
|
2412
2471
|
}
|
|
2413
2472
|
}
|
|
2414
|
-
var
|
|
2473
|
+
var nn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, className: a }) => {
|
|
2415
2474
|
let { t: o } = $(), [s, c] = n.useState(!1), [l, u] = n.useState(""), [d, f] = n.useState(!1), p = n.useCallback(async () => {
|
|
2416
2475
|
let t = l.trim();
|
|
2417
2476
|
if (!(!t || !r)) {
|
|
@@ -2438,8 +2497,8 @@ var $t = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2438
2497
|
onClick: () => c(!s),
|
|
2439
2498
|
"aria-expanded": s,
|
|
2440
2499
|
children: [
|
|
2441
|
-
Z(s ? se :
|
|
2442
|
-
/* @__PURE__ */ Z(
|
|
2500
|
+
Z(s ? se : le, { className: "h-3 w-3" }),
|
|
2501
|
+
/* @__PURE__ */ Z(J, { className: "h-3 w-3" }),
|
|
2443
2502
|
/* @__PURE__ */ Z("span", { children: t.length === 1 ? o("detail.replyCount", { count: t.length }) : o("detail.replyCountPlural", { count: t.length }) })
|
|
2444
2503
|
]
|
|
2445
2504
|
}),
|
|
@@ -2466,7 +2525,7 @@ var $t = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2466
2525
|
children: e.actor
|
|
2467
2526
|
}), /* @__PURE__ */ Z("span", {
|
|
2468
2527
|
className: "text-[10px] text-muted-foreground",
|
|
2469
|
-
children:
|
|
2528
|
+
children: tn(e.createdAt)
|
|
2470
2529
|
})]
|
|
2471
2530
|
}), /* @__PURE__ */ Z("p", {
|
|
2472
2531
|
className: "text-xs whitespace-pre-wrap break-words",
|
|
@@ -2491,12 +2550,12 @@ var $t = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2491
2550
|
onClick: p,
|
|
2492
2551
|
disabled: !l.trim() || d,
|
|
2493
2552
|
"aria-label": "Send reply",
|
|
2494
|
-
children: /* @__PURE__ */ Z(
|
|
2553
|
+
children: /* @__PURE__ */ Z(X, { className: "h-3 w-3" })
|
|
2495
2554
|
})]
|
|
2496
2555
|
})
|
|
2497
2556
|
]
|
|
2498
2557
|
});
|
|
2499
|
-
},
|
|
2558
|
+
}, rn = ({ subscription: e, onToggle: t, className: r }) => {
|
|
2500
2559
|
let { t: i } = $(), [a, o] = n.useState(!1), s = n.useCallback(async () => {
|
|
2501
2560
|
if (t) {
|
|
2502
2561
|
o(!0);
|
|
@@ -2515,17 +2574,17 @@ var $t = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2515
2574
|
disabled: a || !t,
|
|
2516
2575
|
"aria-label": e.subscribed ? i("detail.unsubscribeAriaLabel") : i("detail.subscribeAriaLabel"),
|
|
2517
2576
|
title: e.subscribed ? i("detail.subscribedTooltip") : i("detail.unsubscribedTooltip"),
|
|
2518
|
-
children: e.subscribed ? /* @__PURE__ */ Z(
|
|
2577
|
+
children: e.subscribed ? /* @__PURE__ */ Z(H, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(ie, { className: "h-4 w-4 text-muted-foreground" })
|
|
2519
2578
|
});
|
|
2520
|
-
},
|
|
2521
|
-
comment:
|
|
2522
|
-
field_change:
|
|
2579
|
+
}, an = {
|
|
2580
|
+
comment: J,
|
|
2581
|
+
field_change: he,
|
|
2523
2582
|
task: oe,
|
|
2524
|
-
event:
|
|
2525
|
-
system:
|
|
2526
|
-
email:
|
|
2583
|
+
event: ae,
|
|
2584
|
+
system: He,
|
|
2585
|
+
email: Ee,
|
|
2527
2586
|
call: Ae
|
|
2528
|
-
},
|
|
2587
|
+
}, on = {
|
|
2529
2588
|
comment: "bg-purple-100 text-purple-600",
|
|
2530
2589
|
field_change: "bg-blue-100 text-blue-600",
|
|
2531
2590
|
task: "bg-green-100 text-green-600",
|
|
@@ -2534,7 +2593,7 @@ var $t = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2534
2593
|
email: "bg-indigo-100 text-indigo-600",
|
|
2535
2594
|
call: "bg-teal-100 text-teal-600"
|
|
2536
2595
|
};
|
|
2537
|
-
function
|
|
2596
|
+
function sn(e) {
|
|
2538
2597
|
return [
|
|
2539
2598
|
{
|
|
2540
2599
|
value: "all",
|
|
@@ -2554,7 +2613,7 @@ function rn(e) {
|
|
|
2554
2613
|
}
|
|
2555
2614
|
];
|
|
2556
2615
|
}
|
|
2557
|
-
function
|
|
2616
|
+
function cn(e) {
|
|
2558
2617
|
try {
|
|
2559
2618
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
2560
2619
|
if (r < 1) return "just now";
|
|
@@ -2567,7 +2626,7 @@ function an(e) {
|
|
|
2567
2626
|
return e;
|
|
2568
2627
|
}
|
|
2569
2628
|
}
|
|
2570
|
-
function
|
|
2629
|
+
function ln(e, t) {
|
|
2571
2630
|
switch (t) {
|
|
2572
2631
|
case "comments_only": return e.filter((e) => e.type === "comment");
|
|
2573
2632
|
case "changes_only": return e.filter((e) => e.type === "field_change");
|
|
@@ -2575,108 +2634,112 @@ function on(e, t) {
|
|
|
2575
2634
|
default: return e;
|
|
2576
2635
|
}
|
|
2577
2636
|
}
|
|
2578
|
-
var
|
|
2579
|
-
let { t:
|
|
2580
|
-
if (!
|
|
2637
|
+
var un = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a = !1, onLoadMore: o, loading: s = !1, onAddComment: c, onAddReply: l, onToggleReaction: u, subscription: d, onToggleSubscription: f, collapseWhenEmpty: p = !1, titleLabel: m, emptyLabel: h, className: _ }) => {
|
|
2638
|
+
let { t: v } = $(), [y, b] = n.useState("all"), [x, S] = n.useState(""), [C, w] = n.useState(!1), [T, E] = n.useState(!1), D = r ?? y, O = t?.showFilterToggle !== !1, k = t?.showCommentInput !== !1 && !!c, A = t?.enableReactions ?? !1, j = t?.enableThreading ?? !1, ee = t?.showSubscriptionToggle ?? !1, M = n.useMemo(() => ln(e, D), [e, D]), N = n.useMemo(() => j ? M.filter((e) => !e.parentId) : M, [M, j]), P = n.useMemo(() => {
|
|
2639
|
+
if (!j) return /* @__PURE__ */ new Map();
|
|
2581
2640
|
let e = /* @__PURE__ */ new Map();
|
|
2582
|
-
for (let t of
|
|
2641
|
+
for (let t of M) if (t.parentId) {
|
|
2583
2642
|
let n = e.get(t.parentId) ?? [];
|
|
2584
2643
|
n.push(t), e.set(t.parentId, n);
|
|
2585
2644
|
}
|
|
2586
2645
|
return e;
|
|
2587
|
-
}, [
|
|
2588
|
-
i ? i(e) :
|
|
2589
|
-
}, [i]),
|
|
2590
|
-
let e =
|
|
2646
|
+
}, [M, j]), F = n.useCallback((e) => {
|
|
2647
|
+
i ? i(e) : b(e);
|
|
2648
|
+
}, [i]), I = n.useCallback(async () => {
|
|
2649
|
+
let e = x.trim();
|
|
2591
2650
|
if (!(!e || !c)) {
|
|
2592
|
-
|
|
2651
|
+
w(!0);
|
|
2593
2652
|
try {
|
|
2594
|
-
await c(e),
|
|
2653
|
+
await c(e), S("");
|
|
2595
2654
|
} finally {
|
|
2596
|
-
|
|
2655
|
+
w(!1);
|
|
2597
2656
|
}
|
|
2598
2657
|
}
|
|
2599
|
-
}, [
|
|
2600
|
-
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(),
|
|
2601
|
-
}, [
|
|
2658
|
+
}, [x, c]), te = n.useCallback((e) => {
|
|
2659
|
+
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), I());
|
|
2660
|
+
}, [I]), R = n.useCallback(async () => {
|
|
2602
2661
|
if (o) {
|
|
2603
|
-
|
|
2662
|
+
E(!0);
|
|
2604
2663
|
try {
|
|
2605
2664
|
await o();
|
|
2606
2665
|
} finally {
|
|
2607
|
-
|
|
2666
|
+
E(!1);
|
|
2608
2667
|
}
|
|
2609
2668
|
}
|
|
2610
2669
|
}, [o]);
|
|
2611
|
-
return /* @__PURE__ */ Q(
|
|
2612
|
-
className: L("",
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
className: "
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2670
|
+
return /* @__PURE__ */ Q("section", {
|
|
2671
|
+
className: L("border-t border-border/60 pt-5", _),
|
|
2672
|
+
"aria-label": "Discussion",
|
|
2673
|
+
children: [/* @__PURE__ */ Z("header", {
|
|
2674
|
+
className: "mb-4",
|
|
2675
|
+
children: /* @__PURE__ */ Q("div", {
|
|
2676
|
+
className: "flex items-center justify-between",
|
|
2677
|
+
children: [/* @__PURE__ */ Q("h2", {
|
|
2678
|
+
className: "flex items-center gap-2 text-base font-semibold leading-none tracking-tight",
|
|
2679
|
+
children: [
|
|
2680
|
+
/* @__PURE__ */ Z(ne, { className: "h-4 w-4" }),
|
|
2681
|
+
m ?? v("detail.activity"),
|
|
2682
|
+
/* @__PURE__ */ Q("span", {
|
|
2683
|
+
className: "text-sm font-normal text-muted-foreground",
|
|
2684
|
+
children: [
|
|
2685
|
+
"(",
|
|
2686
|
+
M.length,
|
|
2687
|
+
")"
|
|
2688
|
+
]
|
|
2689
|
+
})
|
|
2690
|
+
]
|
|
2691
|
+
}), /* @__PURE__ */ Z("div", {
|
|
2692
|
+
className: "flex items-center gap-1",
|
|
2693
|
+
children: ee && d && /* @__PURE__ */ Z(rn, {
|
|
2694
|
+
subscription: d,
|
|
2695
|
+
onToggle: f
|
|
2627
2696
|
})
|
|
2628
|
-
]
|
|
2629
|
-
})
|
|
2630
|
-
|
|
2631
|
-
children: F && d && /* @__PURE__ */ Z(en, {
|
|
2632
|
-
subscription: d,
|
|
2633
|
-
onToggle: f
|
|
2634
|
-
})
|
|
2635
|
-
})]
|
|
2636
|
-
}) }), /* @__PURE__ */ Q(v, {
|
|
2697
|
+
})]
|
|
2698
|
+
})
|
|
2699
|
+
}), /* @__PURE__ */ Q("div", {
|
|
2637
2700
|
className: "space-y-4",
|
|
2638
2701
|
children: [
|
|
2639
|
-
|
|
2702
|
+
O && /* @__PURE__ */ Z("div", {
|
|
2640
2703
|
className: "flex items-center gap-2",
|
|
2641
2704
|
children: /* @__PURE__ */ Z("select", {
|
|
2642
2705
|
className: "rounded-md border border-input bg-background px-2.5 py-1.5 text-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
2643
|
-
value:
|
|
2644
|
-
onChange: (e) =>
|
|
2645
|
-
"aria-label":
|
|
2646
|
-
children:
|
|
2706
|
+
value: D,
|
|
2707
|
+
onChange: (e) => F(e.target.value),
|
|
2708
|
+
"aria-label": v("detail.filterActivity"),
|
|
2709
|
+
children: sn(v).map((e) => /* @__PURE__ */ Z("option", {
|
|
2647
2710
|
value: e.value,
|
|
2648
2711
|
children: e.label
|
|
2649
2712
|
}, e.value))
|
|
2650
2713
|
})
|
|
2651
2714
|
}),
|
|
2652
|
-
|
|
2715
|
+
k && /* @__PURE__ */ Q("div", {
|
|
2653
2716
|
className: "flex gap-2",
|
|
2654
2717
|
children: [/* @__PURE__ */ Z("textarea", {
|
|
2655
2718
|
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",
|
|
2656
|
-
placeholder:
|
|
2657
|
-
value:
|
|
2658
|
-
onChange: (e) =>
|
|
2659
|
-
onKeyDown:
|
|
2660
|
-
disabled:
|
|
2719
|
+
placeholder: v("detail.leaveCommentPlaceholder"),
|
|
2720
|
+
value: x,
|
|
2721
|
+
onChange: (e) => S(e.target.value),
|
|
2722
|
+
onKeyDown: te,
|
|
2723
|
+
disabled: C
|
|
2661
2724
|
}), /* @__PURE__ */ Q(g, {
|
|
2662
2725
|
variant: "default",
|
|
2663
|
-
onClick:
|
|
2664
|
-
disabled: !
|
|
2726
|
+
onClick: I,
|
|
2727
|
+
disabled: !x.trim() || C,
|
|
2665
2728
|
className: "shrink-0 self-end gap-1.5",
|
|
2666
|
-
"aria-label":
|
|
2667
|
-
title:
|
|
2668
|
-
children: [/* @__PURE__ */ Z(
|
|
2729
|
+
"aria-label": v("detail.submitComment"),
|
|
2730
|
+
title: v("detail.submitComment"),
|
|
2731
|
+
children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: v("detail.sendComment") })]
|
|
2669
2732
|
})]
|
|
2670
2733
|
}),
|
|
2671
|
-
|
|
2734
|
+
M.length === 0 ? p ? null : /* @__PURE__ */ Z("p", {
|
|
2672
2735
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
2673
|
-
children: h ??
|
|
2736
|
+
children: h ?? v("detail.noActivity")
|
|
2674
2737
|
}) : /* @__PURE__ */ Q("div", {
|
|
2675
2738
|
className: "relative",
|
|
2676
2739
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
2677
2740
|
className: "space-y-4",
|
|
2678
|
-
children:
|
|
2679
|
-
let t =
|
|
2741
|
+
children: N.map((e) => {
|
|
2742
|
+
let t = an[e.type] || He, n = on[e.type] || "bg-gray-100 text-gray-600", r = P.get(e.id) ?? [];
|
|
2680
2743
|
return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
|
|
2681
2744
|
className: "flex gap-3 relative",
|
|
2682
2745
|
children: [/* @__PURE__ */ Z("div", {
|
|
@@ -2698,19 +2761,19 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2698
2761
|
}),
|
|
2699
2762
|
e.source && /* @__PURE__ */ Z("span", {
|
|
2700
2763
|
className: "text-xs text-muted-foreground",
|
|
2701
|
-
children:
|
|
2764
|
+
children: v("detail.via", { source: e.source })
|
|
2702
2765
|
}),
|
|
2703
2766
|
/* @__PURE__ */ Z("span", {
|
|
2704
2767
|
className: "text-xs text-muted-foreground",
|
|
2705
|
-
children:
|
|
2768
|
+
children: cn(e.createdAt)
|
|
2706
2769
|
}),
|
|
2707
2770
|
e.edited && /* @__PURE__ */ Z("span", {
|
|
2708
2771
|
className: "text-xs text-muted-foreground italic",
|
|
2709
|
-
children:
|
|
2772
|
+
children: v("detail.edited")
|
|
2710
2773
|
}),
|
|
2711
2774
|
e.pinned && /* @__PURE__ */ Q("span", {
|
|
2712
2775
|
className: "text-xs text-amber-600",
|
|
2713
|
-
children: ["📌 ",
|
|
2776
|
+
children: ["📌 ", v("detail.pinned")]
|
|
2714
2777
|
})
|
|
2715
2778
|
]
|
|
2716
2779
|
}),
|
|
@@ -2720,25 +2783,25 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2720
2783
|
}),
|
|
2721
2784
|
e.type === "field_change" && e.fieldChanges && /* @__PURE__ */ Z("div", {
|
|
2722
2785
|
className: "space-y-1 mt-1",
|
|
2723
|
-
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(
|
|
2786
|
+
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(Qt, { change: e }, t))
|
|
2724
2787
|
}),
|
|
2725
|
-
|
|
2788
|
+
A && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2726
2789
|
className: "mt-1.5",
|
|
2727
|
-
children: /* @__PURE__ */ Z(
|
|
2790
|
+
children: /* @__PURE__ */ Z(en, {
|
|
2728
2791
|
reactions: e.reactions,
|
|
2729
2792
|
onToggleReaction: u ? (t) => u(e.id, t) : void 0
|
|
2730
2793
|
})
|
|
2731
2794
|
}),
|
|
2732
|
-
|
|
2795
|
+
A && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
|
|
2733
2796
|
className: "mt-1.5",
|
|
2734
|
-
children: /* @__PURE__ */ Z(
|
|
2797
|
+
children: /* @__PURE__ */ Z(en, {
|
|
2735
2798
|
reactions: [],
|
|
2736
2799
|
onToggleReaction: (t) => u(e.id, t)
|
|
2737
2800
|
})
|
|
2738
2801
|
})
|
|
2739
2802
|
]
|
|
2740
2803
|
})]
|
|
2741
|
-
}),
|
|
2804
|
+
}), j && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(nn, {
|
|
2742
2805
|
parentItem: e,
|
|
2743
2806
|
replies: r,
|
|
2744
2807
|
onAddReply: l,
|
|
@@ -2752,16 +2815,16 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2752
2815
|
children: /* @__PURE__ */ Q(g, {
|
|
2753
2816
|
variant: "ghost",
|
|
2754
2817
|
size: "sm",
|
|
2755
|
-
onClick:
|
|
2756
|
-
disabled:
|
|
2757
|
-
"aria-label":
|
|
2758
|
-
children: [
|
|
2818
|
+
onClick: R,
|
|
2819
|
+
disabled: T,
|
|
2820
|
+
"aria-label": v("detail.loadMore"),
|
|
2821
|
+
children: [T ? /* @__PURE__ */ Z(Te, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(se, { className: "h-4 w-4 mr-1" }), v("detail.loadMore")]
|
|
2759
2822
|
})
|
|
2760
2823
|
})
|
|
2761
2824
|
]
|
|
2762
2825
|
})]
|
|
2763
2826
|
});
|
|
2764
|
-
},
|
|
2827
|
+
}, dn = (e) => {
|
|
2765
2828
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2766
2829
|
return {
|
|
2767
2830
|
designer: {
|
|
@@ -2771,18 +2834,18 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2771
2834
|
},
|
|
2772
2835
|
rest: i
|
|
2773
2836
|
};
|
|
2774
|
-
},
|
|
2775
|
-
|
|
2776
|
-
let { designer: r } =
|
|
2837
|
+
}, fn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2838
|
+
Ye();
|
|
2839
|
+
let { designer: r } = dn(n);
|
|
2777
2840
|
return /* @__PURE__ */ Z("div", {
|
|
2778
2841
|
className: t,
|
|
2779
2842
|
...r,
|
|
2780
|
-
children: /* @__PURE__ */ Z(
|
|
2843
|
+
children: /* @__PURE__ */ Z(un, {
|
|
2781
2844
|
items: [],
|
|
2782
2845
|
config: e
|
|
2783
2846
|
})
|
|
2784
2847
|
});
|
|
2785
|
-
},
|
|
2848
|
+
}, pn = ({ config: e, items: t, hasMore: r, onLoadMore: i, loading: a, onAddComment: o, onAddReply: s, onToggleReaction: c, subscription: l, onToggleSubscription: u, filterMode: d, onFilterChange: f, collapseWhenEmpty: p = !1, className: m }) => {
|
|
2786
2849
|
let h = e?.position ?? "right", _ = e?.width ?? "360px", v = e?.collapsible ?? !0, y = p && t.length === 0 || (e?.defaultCollapsed ?? !1), { t: b } = $(), [x, S] = n.useState(y);
|
|
2787
2850
|
return h === "right" || h === "left" ? x && v ? /* @__PURE__ */ Z("div", {
|
|
2788
2851
|
className: L("flex items-start pt-4", h === "right" ? "border-l" : "border-r", m),
|
|
@@ -2792,7 +2855,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2792
2855
|
className: "h-8 w-8 mx-1",
|
|
2793
2856
|
onClick: () => S(!1),
|
|
2794
2857
|
"aria-label": b("detail.openDiscussion"),
|
|
2795
|
-
children: /* @__PURE__ */ Z(
|
|
2858
|
+
children: /* @__PURE__ */ Z(ke, { className: "h-4 w-4" })
|
|
2796
2859
|
})
|
|
2797
2860
|
}) : /* @__PURE__ */ Q("div", {
|
|
2798
2861
|
className: L("flex flex-col overflow-hidden", h === "right" ? "border-l" : "border-r", m),
|
|
@@ -2804,7 +2867,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2804
2867
|
className: "flex items-center justify-between px-4 py-3 border-b",
|
|
2805
2868
|
children: [/* @__PURE__ */ Q("div", {
|
|
2806
2869
|
className: "flex items-center gap-2",
|
|
2807
|
-
children: [/* @__PURE__ */ Z(
|
|
2870
|
+
children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2808
2871
|
className: "text-sm font-medium",
|
|
2809
2872
|
children: b("detail.discussion")
|
|
2810
2873
|
})]
|
|
@@ -2814,11 +2877,11 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2814
2877
|
className: "h-7 w-7",
|
|
2815
2878
|
onClick: () => S(!0),
|
|
2816
2879
|
"aria-label": b("detail.closeDiscussion"),
|
|
2817
|
-
children: /* @__PURE__ */ Z(
|
|
2880
|
+
children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
|
|
2818
2881
|
})]
|
|
2819
2882
|
}), /* @__PURE__ */ Z("div", {
|
|
2820
2883
|
className: "flex-1 overflow-y-auto",
|
|
2821
|
-
children: /* @__PURE__ */ Z(
|
|
2884
|
+
children: /* @__PURE__ */ Z(un, {
|
|
2822
2885
|
items: t,
|
|
2823
2886
|
config: e?.feed,
|
|
2824
2887
|
hasMore: r,
|
|
@@ -2844,21 +2907,21 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2844
2907
|
className: "w-full justify-start gap-2 text-muted-foreground",
|
|
2845
2908
|
onClick: () => S(!1),
|
|
2846
2909
|
"aria-label": b("detail.showDiscussion", { count: t.length }),
|
|
2847
|
-
children: [/* @__PURE__ */ Z(
|
|
2910
|
+
children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: b("detail.showDiscussion", { count: t.length }) })]
|
|
2848
2911
|
}) : /* @__PURE__ */ Q("div", { children: [v && /* @__PURE__ */ Q("div", {
|
|
2849
2912
|
className: "flex items-center justify-between mb-2",
|
|
2850
2913
|
children: [/* @__PURE__ */ Q("div", {
|
|
2851
2914
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
2852
|
-
children: [/* @__PURE__ */ Z(
|
|
2915
|
+
children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4" }), b("detail.discussion")]
|
|
2853
2916
|
}), /* @__PURE__ */ Z(g, {
|
|
2854
2917
|
variant: "ghost",
|
|
2855
2918
|
size: "icon",
|
|
2856
2919
|
className: "h-7 w-7",
|
|
2857
2920
|
onClick: () => S(!0),
|
|
2858
2921
|
"aria-label": b("detail.hideDiscussion"),
|
|
2859
|
-
children: /* @__PURE__ */ Z(
|
|
2922
|
+
children: /* @__PURE__ */ Z(Oe, { className: "h-3.5 w-3.5" })
|
|
2860
2923
|
})]
|
|
2861
|
-
}), /* @__PURE__ */ Z(
|
|
2924
|
+
}), /* @__PURE__ */ Z(un, {
|
|
2862
2925
|
items: t,
|
|
2863
2926
|
config: e?.feed,
|
|
2864
2927
|
hasMore: r,
|
|
@@ -2876,7 +2939,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2876
2939
|
emptyLabel: b("detail.noCommentsYet")
|
|
2877
2940
|
})] })
|
|
2878
2941
|
});
|
|
2879
|
-
},
|
|
2942
|
+
}, mn = (e) => {
|
|
2880
2943
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2881
2944
|
return {
|
|
2882
2945
|
designer: {
|
|
@@ -2886,18 +2949,30 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2886
2949
|
},
|
|
2887
2950
|
rest: i
|
|
2888
2951
|
};
|
|
2889
|
-
},
|
|
2890
|
-
|
|
2891
|
-
let { designer:
|
|
2952
|
+
}, hn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2953
|
+
Ye();
|
|
2954
|
+
let r = Ke(), { designer: i } = mn(n), a = {
|
|
2955
|
+
position: "bottom",
|
|
2956
|
+
collapsible: !1,
|
|
2957
|
+
feed: {
|
|
2958
|
+
enableReactions: !0,
|
|
2959
|
+
enableThreading: !0,
|
|
2960
|
+
showCommentInput: !0
|
|
2961
|
+
},
|
|
2962
|
+
...e
|
|
2963
|
+
};
|
|
2892
2964
|
return /* @__PURE__ */ Z("div", {
|
|
2893
2965
|
className: t,
|
|
2894
|
-
...
|
|
2895
|
-
children: /* @__PURE__ */ Z(
|
|
2896
|
-
items: [],
|
|
2897
|
-
config:
|
|
2966
|
+
...i,
|
|
2967
|
+
children: /* @__PURE__ */ Z(pn, {
|
|
2968
|
+
items: r?.items || [],
|
|
2969
|
+
config: a,
|
|
2970
|
+
onAddComment: r?.onAddComment,
|
|
2971
|
+
onAddReply: r?.onAddReply,
|
|
2972
|
+
onToggleReaction: r?.onToggleReaction
|
|
2898
2973
|
})
|
|
2899
2974
|
});
|
|
2900
|
-
},
|
|
2975
|
+
}, gn = (e) => {
|
|
2901
2976
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2902
2977
|
return {
|
|
2903
2978
|
designer: {
|
|
@@ -2907,37 +2982,80 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2907
2982
|
},
|
|
2908
2983
|
rest: i
|
|
2909
2984
|
};
|
|
2910
|
-
},
|
|
2911
|
-
let
|
|
2912
|
-
|
|
2985
|
+
}, _n = ({ schema: e = {}, className: t, ...n }) => {
|
|
2986
|
+
let i = Ye(), { translateOptions: a } = Ze(), { designer: o } = gn(n), s = Array.isArray(e.stages) ? e.stages : [], c = e.statusField, l = r.useMemo(() => {
|
|
2987
|
+
if (s.length === 0 || !c || !i?.objectName) return s;
|
|
2988
|
+
let e = a(i.objectName, c, s);
|
|
2989
|
+
return Array.isArray(e) && e.length === s.length ? e : s;
|
|
2990
|
+
}, [
|
|
2991
|
+
s,
|
|
2992
|
+
c,
|
|
2993
|
+
i?.objectName,
|
|
2994
|
+
a
|
|
2995
|
+
]), u = c && i?.data ? i.data[c] : void 0, d = l.findIndex((e) => e.value === u);
|
|
2996
|
+
if (d < 0 && (d = -1), l.length === 0) return /* @__PURE__ */ Z("div", {
|
|
2913
2997
|
className: t,
|
|
2914
|
-
...
|
|
2998
|
+
...o,
|
|
2915
2999
|
children: /* @__PURE__ */ Z("div", {
|
|
2916
3000
|
className: "text-xs text-muted-foreground italic px-3 py-2 border border-dashed rounded",
|
|
2917
3001
|
children: "record:path — no stages configured"
|
|
2918
3002
|
})
|
|
2919
|
-
}) : /* @__PURE__ */ Z("div", {
|
|
2920
|
-
className: L("flex w-full items-stretch gap-1", t),
|
|
2921
|
-
role: "list",
|
|
2922
|
-
"aria-label": e.aria?.label || "Record path",
|
|
2923
|
-
...i,
|
|
2924
|
-
children: a.map((e, t) => {
|
|
2925
|
-
let n = c >= 0 && t < c, r = t === c;
|
|
2926
|
-
return /* @__PURE__ */ Z("div", {
|
|
2927
|
-
role: "listitem",
|
|
2928
|
-
"aria-current": r ? "step" : void 0,
|
|
2929
|
-
className: L("relative flex-1 px-4 py-2 text-xs font-medium border text-center", "first:rounded-l-md last:rounded-r-md", r && "bg-primary text-primary-foreground border-primary", n && "bg-muted text-muted-foreground", !r && !n && "bg-background text-foreground/70"),
|
|
2930
|
-
children: /* @__PURE__ */ Q("span", {
|
|
2931
|
-
className: "inline-flex items-center gap-1.5",
|
|
2932
|
-
children: [n && /* @__PURE__ */ Z("span", {
|
|
2933
|
-
"aria-hidden": !0,
|
|
2934
|
-
children: "✓"
|
|
2935
|
-
}), e.label]
|
|
2936
|
-
})
|
|
2937
|
-
}, `${e.value}-${t}`);
|
|
2938
|
-
})
|
|
2939
3003
|
});
|
|
2940
|
-
|
|
3004
|
+
let f = (e, t) => {
|
|
3005
|
+
if (l.length !== 1) return e === 0 ? "polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%)" : e === t ? "polygon(0 0, 100% 0, 100% 100%, 0 100%, 14px 50%)" : "polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 14px 50%)";
|
|
3006
|
+
}, p = l.length - 1;
|
|
3007
|
+
return /* @__PURE__ */ Q("div", {
|
|
3008
|
+
className: L("w-full", t),
|
|
3009
|
+
...o,
|
|
3010
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
3011
|
+
className: "hidden sm:flex w-full items-stretch",
|
|
3012
|
+
role: "list",
|
|
3013
|
+
"aria-label": e.aria?.label || "Record path",
|
|
3014
|
+
children: l.map((e, t) => {
|
|
3015
|
+
let n = d >= 0 && t < d, r = t === d, i = f(t, p);
|
|
3016
|
+
return /* @__PURE__ */ Z("div", {
|
|
3017
|
+
role: "listitem",
|
|
3018
|
+
"aria-current": r ? "step" : void 0,
|
|
3019
|
+
style: i ? {
|
|
3020
|
+
clipPath: i,
|
|
3021
|
+
WebkitClipPath: i
|
|
3022
|
+
} : void 0,
|
|
3023
|
+
className: L("relative flex-1 min-w-0 px-5 py-2 text-xs font-medium text-center", t > 0 && "-ml-2", l.length === 1 && "rounded-md border", r && "bg-primary text-primary-foreground shadow-sm ring-1 ring-primary/40", n && "bg-muted text-muted-foreground", !r && !n && "bg-background text-foreground/70 border border-border/60"),
|
|
3024
|
+
children: /* @__PURE__ */ Q("span", {
|
|
3025
|
+
className: "inline-flex items-center gap-1.5 truncate",
|
|
3026
|
+
style: {
|
|
3027
|
+
paddingLeft: t === 0 ? 0 : `${14 / 2}px`,
|
|
3028
|
+
paddingRight: t === p ? 0 : `${14 / 2}px`
|
|
3029
|
+
},
|
|
3030
|
+
children: [n && /* @__PURE__ */ Z("span", {
|
|
3031
|
+
"aria-hidden": !0,
|
|
3032
|
+
children: "✓"
|
|
3033
|
+
}), e.label]
|
|
3034
|
+
})
|
|
3035
|
+
}, `${e.value}-${t}`);
|
|
3036
|
+
})
|
|
3037
|
+
}), /* @__PURE__ */ Z("div", {
|
|
3038
|
+
className: "flex sm:hidden w-full items-stretch gap-1 overflow-x-auto pb-1 -mx-1 px-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
3039
|
+
role: "list",
|
|
3040
|
+
"aria-label": e.aria?.label || "Record path",
|
|
3041
|
+
children: l.map((e, t) => {
|
|
3042
|
+
let n = d >= 0 && t < d, r = t === d;
|
|
3043
|
+
return /* @__PURE__ */ Z("div", {
|
|
3044
|
+
role: "listitem",
|
|
3045
|
+
"aria-current": r ? "step" : void 0,
|
|
3046
|
+
className: L("shrink-0 px-3 py-1.5 rounded-full text-xs font-medium border whitespace-nowrap", r && "bg-primary text-primary-foreground border-primary shadow-sm ring-1 ring-primary/40", n && "bg-muted text-muted-foreground border-transparent", !r && !n && "bg-background text-foreground/70 border-border/60"),
|
|
3047
|
+
children: /* @__PURE__ */ Q("span", {
|
|
3048
|
+
className: "inline-flex items-center gap-1",
|
|
3049
|
+
children: [n && /* @__PURE__ */ Z("span", {
|
|
3050
|
+
"aria-hidden": !0,
|
|
3051
|
+
children: "✓"
|
|
3052
|
+
}), e.label]
|
|
3053
|
+
})
|
|
3054
|
+
}, `${e.value}-${t}-m`);
|
|
3055
|
+
})
|
|
3056
|
+
})]
|
|
3057
|
+
});
|
|
3058
|
+
}, vn = (e) => {
|
|
2941
3059
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2942
3060
|
return {
|
|
2943
3061
|
designer: {
|
|
@@ -2947,8 +3065,8 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2947
3065
|
},
|
|
2948
3066
|
rest: i
|
|
2949
3067
|
};
|
|
2950
|
-
},
|
|
2951
|
-
let r =
|
|
3068
|
+
}, yn = ({ schema: e = {}, className: t, ...n }) => {
|
|
3069
|
+
let r = Ye(), { designer: i } = vn(n), a = it(), o = Array.isArray(e.actions) ? e.actions : Array.isArray(e.properties?.actions) ? e.properties.actions : [], s = r?.objectName || "", c = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2952
3070
|
if (c.length > 0 && s && !c.every((e) => a.can(s, e))) return /* @__PURE__ */ Z("div", {
|
|
2953
3071
|
className: t,
|
|
2954
3072
|
...i,
|
|
@@ -2959,7 +3077,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2959
3077
|
children: "Insufficient permissions to view quick actions."
|
|
2960
3078
|
})
|
|
2961
3079
|
});
|
|
2962
|
-
let l = e.location || "record_header", { getActionsForLocation: u, executeAction: d } =
|
|
3080
|
+
let l = e.location || "record_header", { getActionsForLocation: u, executeAction: d } = Ge({
|
|
2963
3081
|
actions: o,
|
|
2964
3082
|
context: {
|
|
2965
3083
|
record: r?.data,
|
|
@@ -2998,7 +3116,28 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2998
3116
|
}, t.name || `qa-${n}`);
|
|
2999
3117
|
})
|
|
3000
3118
|
});
|
|
3001
|
-
},
|
|
3119
|
+
}, bn = (e) => {
|
|
3120
|
+
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3121
|
+
return {
|
|
3122
|
+
designer: {
|
|
3123
|
+
"data-obj-id": t,
|
|
3124
|
+
"data-obj-type": n,
|
|
3125
|
+
style: r
|
|
3126
|
+
},
|
|
3127
|
+
rest: i
|
|
3128
|
+
};
|
|
3129
|
+
}, xn = ({ schema: e = {}, className: t, ...n }) => {
|
|
3130
|
+
let { designer: r } = bn(n), i = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : [], a = e.loading ?? e.properties?.loading ?? !1, o = e.emptyText ?? e.properties?.emptyText;
|
|
3131
|
+
return /* @__PURE__ */ Z("div", {
|
|
3132
|
+
className: t,
|
|
3133
|
+
...r,
|
|
3134
|
+
children: /* @__PURE__ */ Z(Nt, {
|
|
3135
|
+
entries: i,
|
|
3136
|
+
loading: a,
|
|
3137
|
+
emptyText: o
|
|
3138
|
+
})
|
|
3139
|
+
});
|
|
3140
|
+
}, Sn = new Set([
|
|
3002
3141
|
"id",
|
|
3003
3142
|
"_id",
|
|
3004
3143
|
"__v",
|
|
@@ -3013,15 +3152,15 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3013
3152
|
"owner_id",
|
|
3014
3153
|
"deleted_at",
|
|
3015
3154
|
"is_deleted"
|
|
3016
|
-
]),
|
|
3017
|
-
function
|
|
3155
|
+
]), Cn = 480, wn = 95;
|
|
3156
|
+
function Tn({ open: e, onClose: t, title: n, record: i, objectName: a, recordId: o, dataSource: s, objectSchema: c, width: l = "min(960px, 60vw)", columns: u = 2, systemFields: d = Sn, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
|
|
3018
3157
|
let { t: g } = $(), _ = `objectui.drawerWidth.${a}`, [v, y] = r.useState(() => {
|
|
3019
3158
|
if (typeof window > "u" || !m) return null;
|
|
3020
3159
|
try {
|
|
3021
3160
|
let e = window.localStorage.getItem(_);
|
|
3022
3161
|
if (e) {
|
|
3023
3162
|
let t = parseInt(e, 10);
|
|
3024
|
-
if (Number.isFinite(t) && t >=
|
|
3163
|
+
if (Number.isFinite(t) && t >= Cn) return t;
|
|
3025
3164
|
}
|
|
3026
3165
|
} catch {}
|
|
3027
3166
|
return null;
|
|
@@ -3043,7 +3182,7 @@ function bn({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
3043
3182
|
let n = (e) => {
|
|
3044
3183
|
let t = S.current;
|
|
3045
3184
|
if (!t) return;
|
|
3046
|
-
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth *
|
|
3185
|
+
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * wn / 100 : 1600, i = Math.min(r, Math.max(Cn, t.startWidth + n));
|
|
3047
3186
|
y(Math.round(i));
|
|
3048
3187
|
}, r = () => {
|
|
3049
3188
|
S.current, S.current = null, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r);
|
|
@@ -3099,7 +3238,7 @@ function bn({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
3099
3238
|
}),
|
|
3100
3239
|
/* @__PURE__ */ Z("div", {
|
|
3101
3240
|
className: "px-6 pt-6 pb-6",
|
|
3102
|
-
children: /* @__PURE__ */ Z(
|
|
3241
|
+
children: /* @__PURE__ */ Z(Ut, {
|
|
3103
3242
|
dataSource: s,
|
|
3104
3243
|
inlineEdit: !0,
|
|
3105
3244
|
schema: {
|
|
@@ -3142,14 +3281,14 @@ function bn({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
3142
3281
|
})
|
|
3143
3282
|
});
|
|
3144
3283
|
}
|
|
3145
|
-
function
|
|
3284
|
+
function En(e, t) {
|
|
3146
3285
|
if (typeof window > "u") return null;
|
|
3147
3286
|
let n = window.location.pathname, r = `/${e}`, i = n.indexOf(r);
|
|
3148
3287
|
return `${i >= 0 ? n.slice(0, i) : n.replace(/\/$/, "")}/${e}/record/${encodeURIComponent(String(t))}`;
|
|
3149
3288
|
}
|
|
3150
3289
|
//#endregion
|
|
3151
3290
|
//#region src/InlineCreateRelated.tsx
|
|
3152
|
-
var
|
|
3291
|
+
var Dn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
|
|
3153
3292
|
let [l, u] = n.useState(!1), [d, f] = n.useState("create"), [p, m] = n.useState({}), [h, x] = n.useState(""), [S, C] = n.useState(s), [T, E] = n.useState(!1), [D, O] = n.useState(!1), k = n.useMemo(() => {
|
|
3154
3293
|
if (!h.trim()) return S;
|
|
3155
3294
|
let e = h.toLowerCase();
|
|
@@ -3193,7 +3332,7 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3193
3332
|
E(!1);
|
|
3194
3333
|
}
|
|
3195
3334
|
}
|
|
3196
|
-
}, [a]),
|
|
3335
|
+
}, [a]), te = n.useMemo(() => r.filter((e) => e.required).every((e) => p[e.name]?.toString().trim()), [r, p]);
|
|
3197
3336
|
return l ? /* @__PURE__ */ Q(_, {
|
|
3198
3337
|
className: L("", c),
|
|
3199
3338
|
children: [/* @__PURE__ */ Z(y, {
|
|
@@ -3209,7 +3348,7 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3209
3348
|
size: "icon",
|
|
3210
3349
|
className: "h-6 w-6",
|
|
3211
3350
|
onClick: () => u(!1),
|
|
3212
|
-
children: /* @__PURE__ */ Z(
|
|
3351
|
+
children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
|
|
3213
3352
|
})]
|
|
3214
3353
|
})
|
|
3215
3354
|
}), /* @__PURE__ */ Z(v, { children: /* @__PURE__ */ Q(A, {
|
|
@@ -3225,7 +3364,7 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3225
3364
|
}), a && /* @__PURE__ */ Q(M, {
|
|
3226
3365
|
value: "link",
|
|
3227
3366
|
className: "flex-1 gap-1.5",
|
|
3228
|
-
children: [/* @__PURE__ */ Z(
|
|
3367
|
+
children: [/* @__PURE__ */ Z(Ce, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
3229
3368
|
})]
|
|
3230
3369
|
}),
|
|
3231
3370
|
i && /* @__PURE__ */ Q(j, {
|
|
@@ -3253,9 +3392,9 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3253
3392
|
}), /* @__PURE__ */ Q(g, {
|
|
3254
3393
|
size: "sm",
|
|
3255
3394
|
onClick: F,
|
|
3256
|
-
disabled: !
|
|
3395
|
+
disabled: !te || T,
|
|
3257
3396
|
className: "gap-1.5",
|
|
3258
|
-
children: [T && /* @__PURE__ */ Z(
|
|
3397
|
+
children: [T && /* @__PURE__ */ Z(Te, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
|
|
3259
3398
|
})]
|
|
3260
3399
|
})]
|
|
3261
3400
|
}),
|
|
@@ -3274,7 +3413,7 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3274
3413
|
className: "max-h-48 overflow-y-auto space-y-1",
|
|
3275
3414
|
children: D ? /* @__PURE__ */ Q("div", {
|
|
3276
3415
|
className: "flex items-center justify-center py-4 text-sm text-muted-foreground",
|
|
3277
|
-
children: [/* @__PURE__ */ Z(
|
|
3416
|
+
children: [/* @__PURE__ */ Z(Te, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
|
|
3278
3417
|
}) : k.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
3279
3418
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
3280
3419
|
children: h ? "No records found" : "Type to search records"
|
|
@@ -3316,17 +3455,17 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3316
3455
|
f("link"), u(!0);
|
|
3317
3456
|
},
|
|
3318
3457
|
className: "gap-1.5",
|
|
3319
|
-
children: [/* @__PURE__ */ Z(
|
|
3458
|
+
children: [/* @__PURE__ */ Z(Ce, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
3320
3459
|
})]
|
|
3321
3460
|
});
|
|
3322
3461
|
};
|
|
3323
3462
|
//#endregion
|
|
3324
3463
|
//#region src/RichTextCommentInput.tsx
|
|
3325
|
-
function
|
|
3464
|
+
function On(e) {
|
|
3326
3465
|
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/>");
|
|
3327
3466
|
return t = t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g, (e) => `<ul class="my-1">${e.replace(/<br\/>/g, "")}</ul>`), t;
|
|
3328
3467
|
}
|
|
3329
|
-
var
|
|
3468
|
+
var kn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], placeholder: a, className: o, disabled: s = !1 }) => {
|
|
3330
3469
|
let { t: c } = $(), [l, u] = n.useState(!1), [d, f] = n.useState(!1), [p, m] = n.useState(""), [h, _] = n.useState(0), v = n.useRef(null), y = n.useMemo(() => {
|
|
3331
3470
|
if (!p) return i;
|
|
3332
3471
|
let e = p.toLowerCase();
|
|
@@ -3398,7 +3537,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3398
3537
|
onClick: x,
|
|
3399
3538
|
disabled: s || l,
|
|
3400
3539
|
title: c("detail.bold"),
|
|
3401
|
-
children: /* @__PURE__ */ Z(
|
|
3540
|
+
children: /* @__PURE__ */ Z(U, { className: "h-3.5 w-3.5" })
|
|
3402
3541
|
}),
|
|
3403
3542
|
/* @__PURE__ */ Z(g, {
|
|
3404
3543
|
variant: "ghost",
|
|
@@ -3407,7 +3546,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3407
3546
|
onClick: S,
|
|
3408
3547
|
disabled: s || l,
|
|
3409
3548
|
title: c("detail.italic"),
|
|
3410
|
-
children: /* @__PURE__ */ Z(
|
|
3549
|
+
children: /* @__PURE__ */ Z(q, { className: "h-3.5 w-3.5" })
|
|
3411
3550
|
}),
|
|
3412
3551
|
/* @__PURE__ */ Z(g, {
|
|
3413
3552
|
variant: "ghost",
|
|
@@ -3416,7 +3555,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3416
3555
|
onClick: C,
|
|
3417
3556
|
disabled: s || l,
|
|
3418
3557
|
title: c("detail.listFormat"),
|
|
3419
|
-
children: /* @__PURE__ */ Z(
|
|
3558
|
+
children: /* @__PURE__ */ Z(we, { className: "h-3.5 w-3.5" })
|
|
3420
3559
|
}),
|
|
3421
3560
|
/* @__PURE__ */ Z(g, {
|
|
3422
3561
|
variant: "ghost",
|
|
@@ -3425,7 +3564,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3425
3564
|
onClick: w,
|
|
3426
3565
|
disabled: s || l,
|
|
3427
3566
|
title: c("detail.inlineCode"),
|
|
3428
|
-
children: /* @__PURE__ */ Z(
|
|
3567
|
+
children: /* @__PURE__ */ Z(fe, { className: "h-3.5 w-3.5" })
|
|
3429
3568
|
}),
|
|
3430
3569
|
/* @__PURE__ */ Z(g, {
|
|
3431
3570
|
variant: "ghost",
|
|
@@ -3434,7 +3573,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3434
3573
|
onClick: T,
|
|
3435
3574
|
disabled: s || l,
|
|
3436
3575
|
title: c("detail.mentionSomeone"),
|
|
3437
|
-
children: /* @__PURE__ */ Z(
|
|
3576
|
+
children: /* @__PURE__ */ Z(V, { className: "h-3.5 w-3.5" })
|
|
3438
3577
|
}),
|
|
3439
3578
|
/* @__PURE__ */ Z("div", { className: "flex-1" }),
|
|
3440
3579
|
/* @__PURE__ */ Z(g, {
|
|
@@ -3443,7 +3582,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3443
3582
|
className: "h-7 w-7",
|
|
3444
3583
|
onClick: () => u(!l),
|
|
3445
3584
|
title: c(l ? "detail.edit" : "detail.preview"),
|
|
3446
|
-
children: Z(l ?
|
|
3585
|
+
children: Z(l ? he : G, { className: "h-3.5 w-3.5" })
|
|
3447
3586
|
}),
|
|
3448
3587
|
r && /* @__PURE__ */ Z(g, {
|
|
3449
3588
|
variant: "ghost",
|
|
@@ -3452,15 +3591,15 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3452
3591
|
onClick: r,
|
|
3453
3592
|
disabled: s || !e.trim(),
|
|
3454
3593
|
title: c("detail.submitComment"),
|
|
3455
|
-
children: /* @__PURE__ */ Z(
|
|
3594
|
+
children: /* @__PURE__ */ Z(X, { className: "h-3.5 w-3.5" })
|
|
3456
3595
|
})
|
|
3457
3596
|
]
|
|
3458
3597
|
}), /* @__PURE__ */ Z("div", {
|
|
3459
3598
|
className: "relative",
|
|
3460
3599
|
children: l ? /* @__PURE__ */ Z("div", {
|
|
3461
3600
|
className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
|
|
3462
|
-
dangerouslySetInnerHTML: { __html:
|
|
3463
|
-
}) : /* @__PURE__ */ Q(
|
|
3601
|
+
dangerouslySetInnerHTML: { __html: On(e) }
|
|
3602
|
+
}) : /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z("textarea", {
|
|
3464
3603
|
ref: v,
|
|
3465
3604
|
className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
|
|
3466
3605
|
placeholder: a ?? c("detail.writeComment"),
|
|
@@ -3491,7 +3630,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3491
3630
|
};
|
|
3492
3631
|
//#endregion
|
|
3493
3632
|
//#region src/DiffView.tsx
|
|
3494
|
-
function
|
|
3633
|
+
function An(e, t) {
|
|
3495
3634
|
if (e == null) return ["(empty)"];
|
|
3496
3635
|
switch (t) {
|
|
3497
3636
|
case "json": try {
|
|
@@ -3510,7 +3649,7 @@ function Tn(e, t) {
|
|
|
3510
3649
|
default: return String(e).split("\n");
|
|
3511
3650
|
}
|
|
3512
3651
|
}
|
|
3513
|
-
function
|
|
3652
|
+
function jn(e, t) {
|
|
3514
3653
|
let n = [], r = Math.max(e.length, t.length);
|
|
3515
3654
|
for (let i = 0; i < r; i++) {
|
|
3516
3655
|
let r = i < e.length ? e[i] : void 0, a = i < t.length ? t[i] : void 0;
|
|
@@ -3527,16 +3666,16 @@ function En(e, t) {
|
|
|
3527
3666
|
}
|
|
3528
3667
|
return n;
|
|
3529
3668
|
}
|
|
3530
|
-
var
|
|
3669
|
+
var Mn = {
|
|
3531
3670
|
added: "bg-green-50 text-green-800 dark:bg-green-950/30 dark:text-green-300",
|
|
3532
3671
|
removed: "bg-red-50 text-red-800 dark:bg-red-950/30 dark:text-red-300",
|
|
3533
3672
|
unchanged: "text-muted-foreground"
|
|
3534
|
-
},
|
|
3673
|
+
}, Nn = {
|
|
3535
3674
|
added: "+",
|
|
3536
3675
|
removed: "-",
|
|
3537
3676
|
unchanged: " "
|
|
3538
|
-
},
|
|
3539
|
-
let { t: s } = $(), [c, l] = n.useState(a), u = n.useMemo(() =>
|
|
3677
|
+
}, Pn = ({ oldValue: e, newValue: t, fieldName: r, fieldType: i = "string", mode: a = "unified", className: o }) => {
|
|
3678
|
+
let { t: s } = $(), [c, l] = n.useState(a), u = n.useMemo(() => An(e, i), [e, i]), d = n.useMemo(() => An(t, i), [t, i]), f = n.useMemo(() => jn(u, d), [u, d]), p = f.some((e) => e.type !== "unchanged"), m = n.useMemo(() => {
|
|
3540
3679
|
if (c !== "side-by-side") return [];
|
|
3541
3680
|
let e = [], t = 0;
|
|
3542
3681
|
for (; t < f.length;) {
|
|
@@ -3585,7 +3724,7 @@ var Dn = {
|
|
|
3585
3724
|
className: "h-7 w-7",
|
|
3586
3725
|
onClick: () => l("side-by-side"),
|
|
3587
3726
|
title: s("detail.sideBySideDiff"),
|
|
3588
|
-
children: /* @__PURE__ */ Z(
|
|
3727
|
+
children: /* @__PURE__ */ Z(pe, { className: "h-3.5 w-3.5" })
|
|
3589
3728
|
})]
|
|
3590
3729
|
})]
|
|
3591
3730
|
})
|
|
@@ -3594,10 +3733,10 @@ var Dn = {
|
|
|
3594
3733
|
children: p ? c === "unified" ? /* @__PURE__ */ Z("div", {
|
|
3595
3734
|
className: "font-mono text-xs overflow-x-auto",
|
|
3596
3735
|
children: f.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
3597
|
-
className: L("px-4 py-0.5 whitespace-pre-wrap border-l-2",
|
|
3736
|
+
className: L("px-4 py-0.5 whitespace-pre-wrap border-l-2", Mn[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
|
|
3598
3737
|
children: [/* @__PURE__ */ Z("span", {
|
|
3599
3738
|
className: "select-none mr-2 inline-block w-3 text-center opacity-60",
|
|
3600
|
-
children:
|
|
3739
|
+
children: Nn[e.type]
|
|
3601
3740
|
}), e.value]
|
|
3602
3741
|
}, t))
|
|
3603
3742
|
}) : /* @__PURE__ */ Z("div", {
|
|
@@ -3614,10 +3753,10 @@ var Dn = {
|
|
|
3614
3753
|
children: s("detail.currentVersion")
|
|
3615
3754
|
}),
|
|
3616
3755
|
m.map((e, t) => /* @__PURE__ */ Q(n.Fragment, { children: [/* @__PURE__ */ Z("div", {
|
|
3617
|
-
className: L("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ?
|
|
3756
|
+
className: L("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? Mn[e.left.type] : "bg-muted/20"),
|
|
3618
3757
|
children: e.left?.value ?? ""
|
|
3619
3758
|
}), /* @__PURE__ */ Z("div", {
|
|
3620
|
-
className: L("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ?
|
|
3759
|
+
className: L("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? Mn[e.right.type] : "bg-muted/20"),
|
|
3621
3760
|
children: e.right?.value ?? ""
|
|
3622
3761
|
})] }, t))
|
|
3623
3762
|
]
|
|
@@ -3628,7 +3767,7 @@ var Dn = {
|
|
|
3628
3767
|
})
|
|
3629
3768
|
})]
|
|
3630
3769
|
});
|
|
3631
|
-
},
|
|
3770
|
+
}, Fn = ({ currentIndex: e, totalRecords: t, recordIds: r, onNavigate: i, onSearch: a, className: o }) => {
|
|
3632
3771
|
let { t: s } = $(), [c, l] = n.useState(""), [u, d] = n.useState(!1), f = n.useRef(null), p = e > 0, m = e > 0, h = e < t - 1, _ = e < t - 1, v = n.useCallback(() => {
|
|
3633
3772
|
p && i(r[0]);
|
|
3634
3773
|
}, [
|
|
@@ -3705,7 +3844,7 @@ var Dn = {
|
|
|
3705
3844
|
disabled: !p,
|
|
3706
3845
|
onClick: v,
|
|
3707
3846
|
title: s("detail.firstRecord"),
|
|
3708
|
-
children: /* @__PURE__ */ Z(
|
|
3847
|
+
children: /* @__PURE__ */ Z(ue, { className: "h-4 w-4" })
|
|
3709
3848
|
}),
|
|
3710
3849
|
/* @__PURE__ */ Z(g, {
|
|
3711
3850
|
variant: "outline",
|
|
@@ -3730,7 +3869,7 @@ var Dn = {
|
|
|
3730
3869
|
disabled: !h,
|
|
3731
3870
|
onClick: b,
|
|
3732
3871
|
title: s("detail.nextRecordKey"),
|
|
3733
|
-
children: /* @__PURE__ */ Z(
|
|
3872
|
+
children: /* @__PURE__ */ Z(le, { className: "h-4 w-4" })
|
|
3734
3873
|
}),
|
|
3735
3874
|
/* @__PURE__ */ Z(g, {
|
|
3736
3875
|
variant: "outline",
|
|
@@ -3739,9 +3878,9 @@ var Dn = {
|
|
|
3739
3878
|
disabled: !_,
|
|
3740
3879
|
onClick: x,
|
|
3741
3880
|
title: s("detail.lastRecord"),
|
|
3742
|
-
children: /* @__PURE__ */ Z(
|
|
3881
|
+
children: /* @__PURE__ */ Z(de, { className: "h-4 w-4" })
|
|
3743
3882
|
}),
|
|
3744
|
-
a && /* @__PURE__ */ Q(
|
|
3883
|
+
a && /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z(g, {
|
|
3745
3884
|
variant: u ? "secondary" : "ghost",
|
|
3746
3885
|
size: "icon",
|
|
3747
3886
|
className: "h-8 w-8",
|
|
@@ -3761,18 +3900,18 @@ var Dn = {
|
|
|
3761
3900
|
})] })
|
|
3762
3901
|
]
|
|
3763
3902
|
});
|
|
3764
|
-
},
|
|
3903
|
+
}, In = 28, Ln = [
|
|
3765
3904
|
"fill-primary stroke-primary",
|
|
3766
3905
|
"fill-blue-500 stroke-blue-500",
|
|
3767
3906
|
"fill-emerald-500 stroke-emerald-500",
|
|
3768
3907
|
"fill-amber-500 stroke-amber-500"
|
|
3769
|
-
],
|
|
3908
|
+
], Rn = [
|
|
3770
3909
|
"fill-primary-foreground",
|
|
3771
3910
|
"fill-white",
|
|
3772
3911
|
"fill-white",
|
|
3773
3912
|
"fill-white"
|
|
3774
3913
|
];
|
|
3775
|
-
function
|
|
3914
|
+
function zn(e, t, n, r, i) {
|
|
3776
3915
|
let a = [], o = [], s = /* @__PURE__ */ new Set(), c = r / 2, l = i / 2;
|
|
3777
3916
|
a.push({
|
|
3778
3917
|
id: e.id,
|
|
@@ -3836,10 +3975,10 @@ function Pn(e, t, n, r, i) {
|
|
|
3836
3975
|
edges: o
|
|
3837
3976
|
};
|
|
3838
3977
|
}
|
|
3839
|
-
function
|
|
3978
|
+
function Bn(e, t = 6) {
|
|
3840
3979
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
3841
3980
|
}
|
|
3842
|
-
var
|
|
3981
|
+
var Vn = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, className: a }) => {
|
|
3843
3982
|
let o = n.useRef(null), [s, c] = n.useState({
|
|
3844
3983
|
width: 500,
|
|
3845
3984
|
height: 400
|
|
@@ -3860,7 +3999,7 @@ var In = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
3860
3999
|
});
|
|
3861
4000
|
return n.observe(t), () => n.disconnect();
|
|
3862
4001
|
}, []);
|
|
3863
|
-
let { nodes: d, edges: f } = n.useMemo(() =>
|
|
4002
|
+
let { nodes: d, edges: f } = n.useMemo(() => zn(e, t, r, s.width, s.height), [
|
|
3864
4003
|
e,
|
|
3865
4004
|
t,
|
|
3866
4005
|
r,
|
|
@@ -3873,7 +4012,7 @@ var In = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
3873
4012
|
children: /* @__PURE__ */ Q(b, {
|
|
3874
4013
|
className: "flex items-center gap-2 text-base",
|
|
3875
4014
|
children: [
|
|
3876
|
-
/* @__PURE__ */ Z(
|
|
4015
|
+
/* @__PURE__ */ Z(De, { className: "h-4 w-4" }),
|
|
3877
4016
|
"Relationships",
|
|
3878
4017
|
/* @__PURE__ */ Q("span", {
|
|
3879
4018
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -3902,7 +4041,7 @@ var In = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
3902
4041
|
strokeWidth: 1.5,
|
|
3903
4042
|
strokeOpacity: .5
|
|
3904
4043
|
}, `edge-${t}`)), d.map((e) => {
|
|
3905
|
-
let t = l === e.id, n =
|
|
4044
|
+
let t = l === e.id, n = Ln[Math.min(e.level, Ln.length - 1)], r = Rn[Math.min(e.level, Rn.length - 1)], a = e.level === 0 ? In + 6 : In;
|
|
3906
4045
|
return /* @__PURE__ */ Q("g", {
|
|
3907
4046
|
className: L("cursor-pointer transition-transform", i && "hover:opacity-80"),
|
|
3908
4047
|
onClick: () => i?.(e.id),
|
|
@@ -3924,7 +4063,7 @@ var In = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
3924
4063
|
textAnchor: "middle",
|
|
3925
4064
|
dominantBaseline: "central",
|
|
3926
4065
|
className: L("text-[10px] font-medium pointer-events-none", r),
|
|
3927
|
-
children:
|
|
4066
|
+
children: Bn(e.label)
|
|
3928
4067
|
}),
|
|
3929
4068
|
e.type && /* @__PURE__ */ Z("text", {
|
|
3930
4069
|
x: e.x,
|
|
@@ -3933,7 +4072,7 @@ var In = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
3933
4072
|
className: "fill-muted-foreground text-[9px] pointer-events-none",
|
|
3934
4073
|
children: e.type
|
|
3935
4074
|
}),
|
|
3936
|
-
t && /* @__PURE__ */ Q(
|
|
4075
|
+
t && /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z("rect", {
|
|
3937
4076
|
x: e.x - 50,
|
|
3938
4077
|
y: e.y - a - 28,
|
|
3939
4078
|
width: 100,
|
|
@@ -3958,16 +4097,16 @@ var In = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
3958
4097
|
};
|
|
3959
4098
|
//#endregion
|
|
3960
4099
|
//#region src/CommentAttachment.tsx
|
|
3961
|
-
function
|
|
4100
|
+
function Hn(e) {
|
|
3962
4101
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
3963
4102
|
}
|
|
3964
|
-
function
|
|
4103
|
+
function Un(e) {
|
|
3965
4104
|
return e.startsWith("image/");
|
|
3966
4105
|
}
|
|
3967
|
-
function
|
|
3968
|
-
return
|
|
4106
|
+
function Wn(e) {
|
|
4107
|
+
return Un(e) ? xe : e.includes("pdf") || e.includes("document") || e.includes("text") ? K : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? ye : ve;
|
|
3969
4108
|
}
|
|
3970
|
-
var
|
|
4109
|
+
var Gn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a = !1 }) => {
|
|
3971
4110
|
let { t: o } = $(), [s, c] = n.useState(!1), l = n.useRef(null), u = n.useCallback((e) => {
|
|
3972
4111
|
e.preventDefault(), e.stopPropagation(), c(!0);
|
|
3973
4112
|
}, []), d = n.useCallback((e) => {
|
|
@@ -3991,7 +4130,7 @@ var Bn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3991
4130
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), l.current?.click());
|
|
3992
4131
|
},
|
|
3993
4132
|
children: [
|
|
3994
|
-
/* @__PURE__ */ Z(
|
|
4133
|
+
/* @__PURE__ */ Z(Be, { className: "h-5 w-5 mx-auto text-muted-foreground mb-1" }),
|
|
3995
4134
|
/* @__PURE__ */ Z("p", {
|
|
3996
4135
|
className: "text-xs text-muted-foreground",
|
|
3997
4136
|
children: o("detail.dropFilesToUpload")
|
|
@@ -4008,11 +4147,11 @@ var Bn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
4008
4147
|
className: "space-y-1.5",
|
|
4009
4148
|
children: [/* @__PURE__ */ Q("div", {
|
|
4010
4149
|
className: "flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
4011
|
-
children: [/* @__PURE__ */ Z(
|
|
4150
|
+
children: [/* @__PURE__ */ Z(Y, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: e.length === 1 ? o("detail.attachmentCount", { count: e.length }) : o("detail.attachmentCountPlural", { count: e.length }) })]
|
|
4012
4151
|
}), /* @__PURE__ */ Z("div", {
|
|
4013
4152
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
|
|
4014
4153
|
children: e.map((e) => {
|
|
4015
|
-
let t =
|
|
4154
|
+
let t = Un(e.type), n = Wn(e.type);
|
|
4016
4155
|
return /* @__PURE__ */ Q("div", {
|
|
4017
4156
|
className: "flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group",
|
|
4018
4157
|
children: [
|
|
@@ -4031,7 +4170,7 @@ var Bn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
4031
4170
|
children: e.name
|
|
4032
4171
|
}), /* @__PURE__ */ Z("p", {
|
|
4033
4172
|
className: "text-[10px] text-muted-foreground",
|
|
4034
|
-
children:
|
|
4173
|
+
children: Hn(e.size)
|
|
4035
4174
|
})]
|
|
4036
4175
|
}),
|
|
4037
4176
|
r && !a && /* @__PURE__ */ Z(g, {
|
|
@@ -4040,7 +4179,7 @@ var Bn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
4040
4179
|
className: "h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
4041
4180
|
onClick: () => r(e.id),
|
|
4042
4181
|
title: o("detail.removeAttachment"),
|
|
4043
|
-
children: /* @__PURE__ */ Z(
|
|
4182
|
+
children: /* @__PURE__ */ Z(Ve, { className: "h-3.5 w-3.5" })
|
|
4044
4183
|
})
|
|
4045
4184
|
]
|
|
4046
4185
|
}, e.id);
|
|
@@ -4051,7 +4190,7 @@ var Bn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
4051
4190
|
};
|
|
4052
4191
|
//#endregion
|
|
4053
4192
|
//#region src/PointInTimeRestore.tsx
|
|
4054
|
-
function
|
|
4193
|
+
function Kn(e) {
|
|
4055
4194
|
try {
|
|
4056
4195
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
4057
4196
|
if (r < 1) return "just now";
|
|
@@ -4062,7 +4201,7 @@ function Vn(e) {
|
|
|
4062
4201
|
return e;
|
|
4063
4202
|
}
|
|
4064
4203
|
}
|
|
4065
|
-
var
|
|
4204
|
+
var qn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
4066
4205
|
let [a, o] = n.useState(null), [s, c] = n.useState(!1), [l, u] = n.useState(!1), d = n.useMemo(() => t.find((e) => e.id === a) ?? null, [t, a]), f = n.useCallback(async () => {
|
|
4067
4206
|
if (!(!d || !r)) {
|
|
4068
4207
|
if (!s) {
|
|
@@ -4091,7 +4230,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4091
4230
|
children: /* @__PURE__ */ Q(b, {
|
|
4092
4231
|
className: "flex items-center gap-2 text-base",
|
|
4093
4232
|
children: [
|
|
4094
|
-
/* @__PURE__ */ Z(
|
|
4233
|
+
/* @__PURE__ */ Z(be, { className: "h-4 w-4" }),
|
|
4095
4234
|
"Revision History",
|
|
4096
4235
|
/* @__PURE__ */ Q("span", {
|
|
4097
4236
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -4124,7 +4263,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4124
4263
|
},
|
|
4125
4264
|
children: [/* @__PURE__ */ Z("div", {
|
|
4126
4265
|
className: L("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"),
|
|
4127
|
-
children: t && /* @__PURE__ */ Z(
|
|
4266
|
+
children: t && /* @__PURE__ */ Z(le, { className: "h-3 w-3 text-primary-foreground" })
|
|
4128
4267
|
}), /* @__PURE__ */ Q("div", {
|
|
4129
4268
|
className: "flex-1 min-w-0",
|
|
4130
4269
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -4134,7 +4273,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4134
4273
|
children: e.user
|
|
4135
4274
|
}), /* @__PURE__ */ Z("span", {
|
|
4136
4275
|
className: "text-xs text-muted-foreground",
|
|
4137
|
-
children:
|
|
4276
|
+
children: Kn(e.timestamp)
|
|
4138
4277
|
})]
|
|
4139
4278
|
}), /* @__PURE__ */ Q("p", {
|
|
4140
4279
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
@@ -4156,7 +4295,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4156
4295
|
children: [
|
|
4157
4296
|
/* @__PURE__ */ Q("div", {
|
|
4158
4297
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
4159
|
-
children: [/* @__PURE__ */ Z(
|
|
4298
|
+
children: [/* @__PURE__ */ Z(G, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
|
|
4160
4299
|
}),
|
|
4161
4300
|
/* @__PURE__ */ Z("div", {
|
|
4162
4301
|
className: "space-y-2",
|
|
@@ -4172,7 +4311,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4172
4311
|
className: "line-through text-red-600 dark:text-red-400 truncate max-w-[120px]",
|
|
4173
4312
|
children: e.oldValue == null ? "(empty)" : String(e.oldValue)
|
|
4174
4313
|
}),
|
|
4175
|
-
/* @__PURE__ */ Z(
|
|
4314
|
+
/* @__PURE__ */ Z(le, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
4176
4315
|
/* @__PURE__ */ Z("span", {
|
|
4177
4316
|
className: "text-green-600 dark:text-green-400 truncate max-w-[120px]",
|
|
4178
4317
|
children: e.newValue == null ? "(empty)" : String(e.newValue)
|
|
@@ -4202,12 +4341,12 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4202
4341
|
}),
|
|
4203
4342
|
r && /* @__PURE__ */ Z("div", {
|
|
4204
4343
|
className: "pt-1 space-y-2",
|
|
4205
|
-
children: s ? /* @__PURE__ */ Q(
|
|
4344
|
+
children: s ? /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Q("p", {
|
|
4206
4345
|
className: "text-xs text-amber-600 dark:text-amber-400",
|
|
4207
4346
|
children: [
|
|
4208
4347
|
"This will restore the record to its state at",
|
|
4209
4348
|
" ",
|
|
4210
|
-
|
|
4349
|
+
Kn(d.timestamp),
|
|
4211
4350
|
". Continue?"
|
|
4212
4351
|
]
|
|
4213
4352
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -4238,7 +4377,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4238
4377
|
})]
|
|
4239
4378
|
}) })]
|
|
4240
4379
|
});
|
|
4241
|
-
},
|
|
4380
|
+
}, Jn = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: r = !1, className: i }) => {
|
|
4242
4381
|
let [a, o] = n.useState(""), [s, c] = n.useState(!1), l = n.useCallback(async () => {
|
|
4243
4382
|
let t = a.trim();
|
|
4244
4383
|
if (t) {
|
|
@@ -4268,10 +4407,10 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4268
4407
|
disabled: !a.trim() || s || r,
|
|
4269
4408
|
className: "shrink-0 self-end",
|
|
4270
4409
|
"aria-label": "Submit comment",
|
|
4271
|
-
children: /* @__PURE__ */ Z(
|
|
4410
|
+
children: /* @__PURE__ */ Z(X, { className: "h-4 w-4" })
|
|
4272
4411
|
})]
|
|
4273
4412
|
});
|
|
4274
|
-
},
|
|
4413
|
+
}, Yn = ({ query: e, suggestions: t, onSelect: r, visible: i = !0, activeIndex: a = 0, className: o }) => {
|
|
4275
4414
|
let s = n.useMemo(() => {
|
|
4276
4415
|
if (!e) return t;
|
|
4277
4416
|
let n = e.toLowerCase();
|
|
@@ -4313,7 +4452,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4313
4452
|
}, e.id))
|
|
4314
4453
|
});
|
|
4315
4454
|
};
|
|
4316
|
-
function
|
|
4455
|
+
function Xn(e, t, n) {
|
|
4317
4456
|
return {
|
|
4318
4457
|
type: e.type,
|
|
4319
4458
|
id: e.id,
|
|
@@ -4322,7 +4461,188 @@ function Gn(e, t, n) {
|
|
|
4322
4461
|
length: n
|
|
4323
4462
|
};
|
|
4324
4463
|
}
|
|
4325
|
-
|
|
4464
|
+
//#endregion
|
|
4465
|
+
//#region src/synth/buildDefaultPageSchema.ts
|
|
4466
|
+
function Zn(e) {
|
|
4467
|
+
return e == null ? [] : Array.isArray(e) ? e.filter((e) => e != null) : [e];
|
|
4468
|
+
}
|
|
4469
|
+
function Qn(e) {
|
|
4470
|
+
if (!e) return null;
|
|
4471
|
+
if (e.stageField) return e.stageField;
|
|
4472
|
+
let t = e.fields || {};
|
|
4473
|
+
for (let e of [
|
|
4474
|
+
"status",
|
|
4475
|
+
"stage",
|
|
4476
|
+
"state",
|
|
4477
|
+
"phase"
|
|
4478
|
+
]) if (e in t) return e;
|
|
4479
|
+
for (let [e, n] of Object.entries(t)) {
|
|
4480
|
+
let t = (n?.type || "").toLowerCase();
|
|
4481
|
+
if (t === "status" || t === "stage") return e;
|
|
4482
|
+
}
|
|
4483
|
+
return null;
|
|
4484
|
+
}
|
|
4485
|
+
function $n(e, t) {
|
|
4486
|
+
if (!e || !t) return null;
|
|
4487
|
+
let n = e.fields?.[t]?.options;
|
|
4488
|
+
return !Array.isArray(n) || n.length === 0 ? null : n.map((e) => ({
|
|
4489
|
+
value: e.value,
|
|
4490
|
+
label: e.label
|
|
4491
|
+
}));
|
|
4492
|
+
}
|
|
4493
|
+
function er(e, t, n = 4) {
|
|
4494
|
+
if (!e) return [];
|
|
4495
|
+
if (Array.isArray(e.highlightFields) && e.highlightFields.length > 0) return e.highlightFields.slice(0, n);
|
|
4496
|
+
let r = new Set([
|
|
4497
|
+
"id",
|
|
4498
|
+
"_id",
|
|
4499
|
+
"created_at",
|
|
4500
|
+
"updated_at",
|
|
4501
|
+
"deleted_at",
|
|
4502
|
+
"created_by",
|
|
4503
|
+
"updated_by",
|
|
4504
|
+
"deleted_by",
|
|
4505
|
+
"organization_id",
|
|
4506
|
+
"workspace_id",
|
|
4507
|
+
"tenant_id",
|
|
4508
|
+
"org_id"
|
|
4509
|
+
]);
|
|
4510
|
+
t && r.add(t), e.primaryField && r.add(e.primaryField);
|
|
4511
|
+
for (let t of [
|
|
4512
|
+
"name",
|
|
4513
|
+
"full_name",
|
|
4514
|
+
"title",
|
|
4515
|
+
"subject",
|
|
4516
|
+
"display_name"
|
|
4517
|
+
]) t in (e.fields || {}) && r.add(t);
|
|
4518
|
+
let i = [
|
|
4519
|
+
"owner",
|
|
4520
|
+
"owner_id",
|
|
4521
|
+
"amount",
|
|
4522
|
+
"rating",
|
|
4523
|
+
"source",
|
|
4524
|
+
"priority",
|
|
4525
|
+
"industry",
|
|
4526
|
+
"phone",
|
|
4527
|
+
"email"
|
|
4528
|
+
], a = [], o = e.fields || {};
|
|
4529
|
+
for (let e of i) if (e in o && !r.has(e) && a.push(e), a.length >= n) return a;
|
|
4530
|
+
for (let e of Object.keys(o)) if (!(a.includes(e) || r.has(e)) && (a.push(e), a.length >= n)) break;
|
|
4531
|
+
return a;
|
|
4532
|
+
}
|
|
4533
|
+
function tr(e, t = {}) {
|
|
4534
|
+
return {
|
|
4535
|
+
type: "page:header",
|
|
4536
|
+
recordChrome: t.recordChrome !== !1,
|
|
4537
|
+
...Array.isArray(t.actions) && t.actions.length > 0 ? { actions: t.actions } : {}
|
|
4538
|
+
};
|
|
4539
|
+
}
|
|
4540
|
+
function nr(e, t) {
|
|
4541
|
+
return !Array.isArray(t) || t.length === 0 ? null : {
|
|
4542
|
+
type: "record:quick_actions",
|
|
4543
|
+
actions: t,
|
|
4544
|
+
location: "record_header"
|
|
4545
|
+
};
|
|
4546
|
+
}
|
|
4547
|
+
function rr(e, t = {}) {
|
|
4548
|
+
let n = t.statusField ?? Qn(e), r = t.stages ?? (n ? $n(e, n) : null), i = t.highlightFields ?? er(e, n), a = [];
|
|
4549
|
+
return !t.hideHighlights && i.length > 0 && a.push({
|
|
4550
|
+
type: "record:highlights",
|
|
4551
|
+
fields: i
|
|
4552
|
+
}), !t.hidePath && n && r && r.length > 0 && a.push({
|
|
4553
|
+
type: "record:path",
|
|
4554
|
+
statusField: n,
|
|
4555
|
+
stages: r
|
|
4556
|
+
}), a;
|
|
4557
|
+
}
|
|
4558
|
+
function ir(e, t, n) {
|
|
4559
|
+
return {
|
|
4560
|
+
type: "record:details",
|
|
4561
|
+
sections: t,
|
|
4562
|
+
...n && n.length > 0 ? { hideFields: n } : {}
|
|
4563
|
+
};
|
|
4564
|
+
}
|
|
4565
|
+
function ar(e, t = {}) {
|
|
4566
|
+
let n = t.statusField ?? Qn(e), r = t.highlightFields ?? er(e, n), i = [{
|
|
4567
|
+
label: "Details",
|
|
4568
|
+
children: [ir(e, t.sections, r)]
|
|
4569
|
+
}];
|
|
4570
|
+
return Array.isArray(t.related) && t.related.length > 0 && i.push({
|
|
4571
|
+
label: "Related",
|
|
4572
|
+
children: t.related.map((e) => ({
|
|
4573
|
+
type: "record:related_list",
|
|
4574
|
+
title: e.title,
|
|
4575
|
+
objectName: e.objectName,
|
|
4576
|
+
relationshipField: e.relationshipField,
|
|
4577
|
+
...e.columns ? { columns: e.columns } : {},
|
|
4578
|
+
...e.limit ? { limit: e.limit } : {},
|
|
4579
|
+
...e.icon ? { icon: e.icon } : {}
|
|
4580
|
+
}))
|
|
4581
|
+
}), t.showActivity && i.push({
|
|
4582
|
+
label: "Activity",
|
|
4583
|
+
children: [{ type: "record:activity" }]
|
|
4584
|
+
}), t.history && i.push({
|
|
4585
|
+
label: "History",
|
|
4586
|
+
children: [{
|
|
4587
|
+
type: "record:history",
|
|
4588
|
+
entries: t.history.entries,
|
|
4589
|
+
loading: t.history.loading,
|
|
4590
|
+
emptyText: t.history.emptyText
|
|
4591
|
+
}]
|
|
4592
|
+
}), {
|
|
4593
|
+
type: "page:tabs",
|
|
4594
|
+
items: i
|
|
4595
|
+
};
|
|
4596
|
+
}
|
|
4597
|
+
function or() {
|
|
4598
|
+
return { type: "record:discussion" };
|
|
4599
|
+
}
|
|
4600
|
+
function sr(e, t = {}) {
|
|
4601
|
+
let n = t.slots || {}, r = [];
|
|
4602
|
+
if ("header" in n && n.header !== void 0 ? r.push(...Zn(n.header)) : r.push(tr(e, {
|
|
4603
|
+
recordChrome: t.recordChrome,
|
|
4604
|
+
actions: t.headerActions
|
|
4605
|
+
})), "actions" in n && n.actions !== void 0 && r.push(...Zn(n.actions)), "highlights" in n && n.highlights !== void 0 ? r.push(...Zn(n.highlights)) : r.push(...rr(e, {
|
|
4606
|
+
highlightFields: t.highlightFields,
|
|
4607
|
+
statusField: t.statusField,
|
|
4608
|
+
stages: t.stages,
|
|
4609
|
+
hideHighlights: t.hideHighlights,
|
|
4610
|
+
hidePath: t.hidePath
|
|
4611
|
+
})), "tabs" in n && n.tabs !== void 0) r.push(...Zn(n.tabs));
|
|
4612
|
+
else if ("details" in n && n.details !== void 0) {
|
|
4613
|
+
let i = Zn(n.details), a = ar(e, {
|
|
4614
|
+
sections: t.sections,
|
|
4615
|
+
related: t.related,
|
|
4616
|
+
showActivity: t.showActivity,
|
|
4617
|
+
history: t.history,
|
|
4618
|
+
highlightFields: t.highlightFields,
|
|
4619
|
+
statusField: t.statusField
|
|
4620
|
+
});
|
|
4621
|
+
Array.isArray(a.items) && a.items.length > 0 && (a.items[0] = {
|
|
4622
|
+
...a.items[0],
|
|
4623
|
+
children: i
|
|
4624
|
+
}), r.push(a);
|
|
4625
|
+
} else r.push(ar(e, {
|
|
4626
|
+
sections: t.sections,
|
|
4627
|
+
related: t.related,
|
|
4628
|
+
showActivity: t.showActivity,
|
|
4629
|
+
history: t.history,
|
|
4630
|
+
highlightFields: t.highlightFields,
|
|
4631
|
+
statusField: t.statusField
|
|
4632
|
+
}));
|
|
4633
|
+
return "discussion" in n && n.discussion !== void 0 ? r.push(...Zn(n.discussion)) : t.hideDiscussion || r.push(or()), {
|
|
4634
|
+
type: "record",
|
|
4635
|
+
pageType: "record",
|
|
4636
|
+
object: e?.name,
|
|
4637
|
+
template: "full-width",
|
|
4638
|
+
regions: [{
|
|
4639
|
+
name: "main",
|
|
4640
|
+
width: "full",
|
|
4641
|
+
components: r
|
|
4642
|
+
}]
|
|
4643
|
+
};
|
|
4644
|
+
}
|
|
4645
|
+
e.register("detail-view", Ut, {
|
|
4326
4646
|
namespace: "plugin-detail",
|
|
4327
4647
|
label: "Detail View",
|
|
4328
4648
|
category: "Views",
|
|
@@ -4452,7 +4772,7 @@ e.register("detail-view", Bt, {
|
|
|
4452
4772
|
tabs: [],
|
|
4453
4773
|
related: []
|
|
4454
4774
|
}
|
|
4455
|
-
}), e.register("detail-section",
|
|
4775
|
+
}), e.register("detail-section", pt, {
|
|
4456
4776
|
namespace: "plugin-detail",
|
|
4457
4777
|
label: "Detail Section",
|
|
4458
4778
|
category: "Detail Components",
|
|
@@ -4503,7 +4823,7 @@ e.register("detail-view", Bt, {
|
|
|
4503
4823
|
label: "Header Color"
|
|
4504
4824
|
}
|
|
4505
4825
|
]
|
|
4506
|
-
}), e.register("related-list",
|
|
4826
|
+
}), e.register("related-list", gt, {
|
|
4507
4827
|
namespace: "plugin-detail",
|
|
4508
4828
|
label: "Related List",
|
|
4509
4829
|
category: "Detail Components",
|
|
@@ -4550,7 +4870,7 @@ e.register("detail-view", Bt, {
|
|
|
4550
4870
|
label: "Columns"
|
|
4551
4871
|
}
|
|
4552
4872
|
]
|
|
4553
|
-
}), e.register("detail",
|
|
4873
|
+
}), e.register("detail", Ut, {
|
|
4554
4874
|
namespace: "view",
|
|
4555
4875
|
category: "view",
|
|
4556
4876
|
label: "Detail",
|
|
@@ -4573,41 +4893,51 @@ e.register("detail-view", Bt, {
|
|
|
4573
4893
|
label: "Fields"
|
|
4574
4894
|
}
|
|
4575
4895
|
]
|
|
4576
|
-
}), e.register("record:details",
|
|
4896
|
+
}), e.register("record:details", Kt, {
|
|
4577
4897
|
namespace: "record",
|
|
4578
4898
|
category: "record",
|
|
4579
4899
|
label: "Record Details",
|
|
4580
4900
|
icon: "FileText"
|
|
4581
|
-
}), e.register("record:related_list",
|
|
4901
|
+
}), e.register("record:related_list", Yt, {
|
|
4582
4902
|
namespace: "record",
|
|
4583
4903
|
category: "record",
|
|
4584
4904
|
label: "Related List",
|
|
4585
4905
|
icon: "List"
|
|
4586
|
-
}), e.register("record:highlights",
|
|
4906
|
+
}), e.register("record:highlights", Zt, {
|
|
4587
4907
|
namespace: "record",
|
|
4588
4908
|
category: "record",
|
|
4589
4909
|
label: "Highlights Panel",
|
|
4590
4910
|
icon: "Star"
|
|
4591
|
-
}), e.register("record:activity",
|
|
4911
|
+
}), e.register("record:activity", fn, {
|
|
4592
4912
|
namespace: "record",
|
|
4593
4913
|
category: "record",
|
|
4594
4914
|
label: "Activity Timeline",
|
|
4595
4915
|
icon: "Activity"
|
|
4596
|
-
}), e.register("record:chatter",
|
|
4916
|
+
}), e.register("record:chatter", hn, {
|
|
4597
4917
|
namespace: "record",
|
|
4598
4918
|
category: "record",
|
|
4599
4919
|
label: "Chatter Feed",
|
|
4600
4920
|
icon: "MessageSquare"
|
|
4601
|
-
}), e.register("record:
|
|
4921
|
+
}), e.register("record:discussion", hn, {
|
|
4922
|
+
namespace: "record",
|
|
4923
|
+
category: "record",
|
|
4924
|
+
label: "Discussion",
|
|
4925
|
+
icon: "MessageSquare"
|
|
4926
|
+
}), e.register("record:path", _n, {
|
|
4602
4927
|
namespace: "record",
|
|
4603
4928
|
category: "record",
|
|
4604
4929
|
label: "Path / Stepper",
|
|
4605
4930
|
icon: "GitBranch"
|
|
4606
|
-
}), e.register("record:quick_actions",
|
|
4931
|
+
}), e.register("record:quick_actions", yn, {
|
|
4607
4932
|
namespace: "record",
|
|
4608
4933
|
category: "record",
|
|
4609
4934
|
label: "Quick Actions",
|
|
4610
4935
|
icon: "Zap"
|
|
4936
|
+
}), e.register("record:history", xn, {
|
|
4937
|
+
namespace: "record",
|
|
4938
|
+
category: "record",
|
|
4939
|
+
label: "History Timeline",
|
|
4940
|
+
icon: "Clock"
|
|
4611
4941
|
});
|
|
4612
4942
|
//#endregion
|
|
4613
|
-
export {
|
|
4943
|
+
export { Et as ActivityTimeline, Gn as CommentAttachment, Jn as CommentInput, dt as DETAIL_DEFAULT_TRANSLATIONS, pt as DetailSection, mt as DetailTabs, Ut as DetailView, Pn as DiffView, Qt as FieldChangeItem, vt as HeaderHighlight, Nt as HistoryTimeline, Dn as InlineCreateRelated, Yn as MentionAutocomplete, qn as PointInTimeRestore, en as ReactionPicker, fn as RecordActivityRenderer, un as RecordActivityTimeline, pn as RecordChatterPanel, hn as RecordChatterRenderer, bt as RecordComments, Tn as RecordDetailDrawer, Kt as RecordDetailsRenderer, Zt as RecordHighlightsRenderer, xn as RecordHistoryRenderer, Bt as RecordMetaFooter, Fn as RecordNavigationEnhanced, _n as RecordPathRenderer, yn as RecordQuickActionsRenderer, Yt as RecordRelatedListRenderer, gt as RelatedList, Vn as RelationshipGraph, kn as RichTextCommentInput, _t as SectionGroup, rn as SubscriptionToggle, nn as ThreadedReplies, ct as applyAutoSpan, lt as applyDetailAutoLayout, nr as buildDefaultActions, ir as buildDefaultDetails, or as buildDefaultDiscussion, tr as buildDefaultHeader, rr as buildDefaultHighlights, sr as buildDefaultPageSchema, ar as buildDefaultTabs, Xn as createMentionFromSuggestion, ut as createSafeTranslationHook, er as deriveHighlightFields, En as deriveRecordPageHref, $n as deriveStages, Qn as detectStatusField, st as inferDetailColumns, ot as isWideFieldType, $ as useDetailTranslation };
|