@object-ui/plugin-detail 4.8.0 → 5.0.1
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 +383 -0
- package/dist/index.js +913 -601
- 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/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
|
@@ -2,13 +2,13 @@ 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
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
|
|
6
|
-
import { SchemaRenderer as We, useActionEngine as Ge,
|
|
7
|
-
import { BooleanField as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { useFieldPermissions as
|
|
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,9 +192,9 @@ 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 = te(), M = ee ? 3 :
|
|
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;
|
|
200
196
|
if (B.length === 0 && j === e.fields.length) return null;
|
|
201
|
-
let { fields: re, columns: V } =
|
|
197
|
+
let { fields: re, columns: V } = lt(B, e.columns), H = (e) => {
|
|
202
198
|
let n = t?.[e.name] ?? e.value;
|
|
203
199
|
if (e.render) return /* @__PURE__ */ Z(We, {
|
|
204
200
|
schema: e.render,
|
|
@@ -207,7 +203,7 @@ var ut = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
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 (re.length <=
|
|
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
|
-
|
|
305
|
+
ie,
|
|
310
306
|
re.length,
|
|
311
|
-
|
|
307
|
+
U
|
|
312
308
|
]);
|
|
313
|
-
let
|
|
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", {
|
|
314
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"),
|
|
315
|
-
children:
|
|
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
|
})]
|
|
@@ -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,
|
|
@@ -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 && Ue[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ||
|
|
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,
|
|
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,32 +446,46 @@ 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;
|
|
472
482
|
if (!e) continue;
|
|
473
483
|
let i = /* @__PURE__ */ new Set();
|
|
474
|
-
for (let e of
|
|
484
|
+
for (let e of B) {
|
|
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
|
-
|
|
518
|
-
|
|
527
|
+
me,
|
|
528
|
+
B
|
|
519
529
|
]);
|
|
520
|
-
let
|
|
521
|
-
if (!
|
|
522
|
-
let e =
|
|
523
|
-
return
|
|
524
|
-
}, [
|
|
530
|
+
let xe = n.useMemo(() => {
|
|
531
|
+
if (!fe) return B;
|
|
532
|
+
let e = fe.toLowerCase();
|
|
533
|
+
return B.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
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 ?
|
|
553
|
-
}), 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) =>
|
|
562
|
+
return n ? ke.checkField(e, String(n), "read") : !0;
|
|
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
|
-
return t ?
|
|
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,22 +623,22 @@ 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;
|
|
627
|
-
if (
|
|
628
|
-
let e =
|
|
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);
|
|
629
639
|
return {
|
|
630
640
|
type: "object-gallery",
|
|
631
|
-
data:
|
|
641
|
+
data: we,
|
|
632
642
|
objectName: r,
|
|
633
643
|
gallery: {
|
|
634
644
|
titleField: e || "name",
|
|
@@ -642,20 +652,20 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
642
652
|
case "grid":
|
|
643
653
|
case "table": return {
|
|
644
654
|
type: "data-table",
|
|
645
|
-
data:
|
|
646
|
-
columns:
|
|
655
|
+
data: we,
|
|
656
|
+
columns: Y,
|
|
647
657
|
pagination: !1,
|
|
648
|
-
pageSize:
|
|
658
|
+
pageSize: q || 10,
|
|
649
659
|
searchable: !1,
|
|
650
660
|
exportable: !1,
|
|
651
|
-
rowActions:
|
|
661
|
+
rowActions: Ae,
|
|
652
662
|
onRowEdit: D,
|
|
653
|
-
onRowDelete: O ?
|
|
663
|
+
onRowDelete: O ? De : void 0,
|
|
654
664
|
onRowClick: k
|
|
655
665
|
};
|
|
656
666
|
case "list": return {
|
|
657
667
|
type: "data-list",
|
|
658
|
-
data:
|
|
668
|
+
data: we
|
|
659
669
|
};
|
|
660
670
|
default: return {
|
|
661
671
|
type: "div",
|
|
@@ -664,74 +674,78 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
664
674
|
}
|
|
665
675
|
}, [
|
|
666
676
|
t,
|
|
667
|
-
|
|
668
|
-
X,
|
|
669
|
-
p,
|
|
677
|
+
we,
|
|
670
678
|
Y,
|
|
671
|
-
|
|
679
|
+
p,
|
|
680
|
+
q,
|
|
681
|
+
Ae,
|
|
672
682
|
D,
|
|
673
683
|
O,
|
|
674
|
-
|
|
684
|
+
De,
|
|
675
685
|
k,
|
|
676
|
-
|
|
686
|
+
je,
|
|
677
687
|
r
|
|
678
|
-
]),
|
|
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;
|
|
679
689
|
return /* @__PURE__ */ Q(_, {
|
|
680
|
-
className: L("shadow-none",
|
|
690
|
+
className: L("shadow-none border-border/60 bg-transparent", X && "bg-muted/10", x),
|
|
681
691
|
children: [
|
|
682
692
|
/* @__PURE__ */ Z(y, {
|
|
683
|
-
className: L("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0",
|
|
684
|
-
onClick:
|
|
693
|
+
className: L("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", Pe),
|
|
694
|
+
onClick: Fe,
|
|
685
695
|
children: /* @__PURE__ */ Q(b, {
|
|
686
696
|
className: "flex items-center justify-between gap-2 text-sm font-semibold",
|
|
687
697
|
children: [/* @__PURE__ */ Q("div", {
|
|
688
698
|
className: "flex items-center gap-2 min-w-0",
|
|
689
699
|
children: [
|
|
690
|
-
N && Z(
|
|
691
|
-
/* @__PURE__ */ Z(
|
|
700
|
+
N && Z(G ? le : se, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
|
|
701
|
+
/* @__PURE__ */ Z(Ie, {
|
|
692
702
|
className: "h-4 w-4 text-muted-foreground shrink-0",
|
|
693
703
|
"aria-hidden": !0
|
|
694
704
|
}),
|
|
695
705
|
/* @__PURE__ */ Z("span", {
|
|
696
|
-
className: "truncate",
|
|
706
|
+
className: L("truncate", X && "text-muted-foreground font-medium"),
|
|
697
707
|
children: e
|
|
698
708
|
}),
|
|
699
709
|
/* @__PURE__ */ Z(h, {
|
|
700
710
|
variant: "secondary",
|
|
701
|
-
className: L("text-xs font-normal h-5 px-1.5",
|
|
702
|
-
"aria-label": `${
|
|
703
|
-
children:
|
|
711
|
+
className: L("text-xs font-normal h-5 px-1.5", B.length === 0 && "bg-muted text-muted-foreground"),
|
|
712
|
+
"aria-label": `${B.length} records`,
|
|
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")
|
|
704
718
|
})
|
|
705
719
|
]
|
|
706
720
|
}), /* @__PURE__ */ Z("div", {
|
|
707
721
|
className: "flex items-center gap-1 shrink-0",
|
|
708
722
|
children: T && /* @__PURE__ */ Q(g, {
|
|
709
|
-
variant: "outline",
|
|
723
|
+
variant: X ? "ghost" : "outline",
|
|
710
724
|
size: "sm",
|
|
711
725
|
onClick: (e) => {
|
|
712
726
|
e.stopPropagation(), T();
|
|
713
727
|
},
|
|
714
728
|
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
715
|
-
children: [/* @__PURE__ */ Z(
|
|
729
|
+
children: [/* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5" }), K("detail.new")]
|
|
716
730
|
})
|
|
717
731
|
})]
|
|
718
732
|
})
|
|
719
733
|
}),
|
|
720
|
-
!
|
|
721
|
-
className: L("pt-0
|
|
734
|
+
!G && !X && /* @__PURE__ */ Q(v, {
|
|
735
|
+
className: L("pt-0 pb-4 px-4"),
|
|
722
736
|
children: [
|
|
723
|
-
|
|
737
|
+
Le && /* @__PURE__ */ Z("div", {
|
|
724
738
|
className: "mb-3",
|
|
725
739
|
children: /* @__PURE__ */ Z(w, {
|
|
726
|
-
placeholder:
|
|
727
|
-
value:
|
|
728
|
-
onChange: (e) =>
|
|
740
|
+
placeholder: K("detail.filterPlaceholder"),
|
|
741
|
+
value: fe,
|
|
742
|
+
onChange: (e) => pe(e.target.value),
|
|
729
743
|
className: "h-8 text-sm"
|
|
730
744
|
})
|
|
731
745
|
}),
|
|
732
|
-
ee &&
|
|
746
|
+
ee && Y && Y.length > 0 && B.length > 0 && /* @__PURE__ */ Z("div", {
|
|
733
747
|
className: "flex flex-wrap gap-1 mb-3",
|
|
734
|
-
children:
|
|
748
|
+
children: Y.map((e) => {
|
|
735
749
|
let t = e.accessorKey || e.field || e.name;
|
|
736
750
|
if (!t) return null;
|
|
737
751
|
let n = e.header || e.label || t, r = W === t;
|
|
@@ -739,39 +753,20 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
739
753
|
variant: r ? "secondary" : "ghost",
|
|
740
754
|
size: "sm",
|
|
741
755
|
className: "gap-1 h-7 text-xs",
|
|
742
|
-
onClick: () =>
|
|
756
|
+
onClick: () => Te(t),
|
|
743
757
|
children: [
|
|
744
758
|
/* @__PURE__ */ Z(re, { className: "h-3 w-3" }),
|
|
745
759
|
n,
|
|
746
|
-
r && (
|
|
760
|
+
r && (ue === "asc" ? " ↑" : " ↓")
|
|
747
761
|
]
|
|
748
762
|
}, t);
|
|
749
763
|
})
|
|
750
764
|
}),
|
|
751
|
-
|
|
765
|
+
H ? /* @__PURE__ */ Z("div", {
|
|
752
766
|
className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
|
|
753
|
-
children:
|
|
754
|
-
}) :
|
|
755
|
-
|
|
756
|
-
children: [
|
|
757
|
-
/* @__PURE__ */ Z(Pe, {
|
|
758
|
-
className: "h-8 w-8 text-muted-foreground/40",
|
|
759
|
-
"aria-hidden": !0
|
|
760
|
-
}),
|
|
761
|
-
/* @__PURE__ */ Z("span", {
|
|
762
|
-
className: "text-muted-foreground italic",
|
|
763
|
-
children: J("detail.noRelatedRecords")
|
|
764
|
-
}),
|
|
765
|
-
T && /* @__PURE__ */ Q(g, {
|
|
766
|
-
variant: "outline",
|
|
767
|
-
size: "sm",
|
|
768
|
-
onClick: T,
|
|
769
|
-
className: "gap-1 h-7 text-xs mt-1",
|
|
770
|
-
children: [/* @__PURE__ */ Z(je, { className: "h-3.5 w-3.5" }), J("detail.new")]
|
|
771
|
-
})
|
|
772
|
-
]
|
|
773
|
-
}) : /* @__PURE__ */ Z(We, { schema: Ae }),
|
|
774
|
-
Y > 0 && ye.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", {
|
|
775
770
|
className: "flex items-center justify-between mt-3 pt-3 border-t",
|
|
776
771
|
children: [
|
|
777
772
|
/* @__PURE__ */ Q(g, {
|
|
@@ -779,27 +774,27 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
779
774
|
size: "sm",
|
|
780
775
|
className: "h-7 text-xs gap-1",
|
|
781
776
|
disabled: U === 0,
|
|
782
|
-
onClick: () =>
|
|
783
|
-
children: [/* @__PURE__ */ Z(ce, { className: "h-3 w-3" }),
|
|
777
|
+
onClick: () => ae((e) => Math.max(0, e - 1)),
|
|
778
|
+
children: [/* @__PURE__ */ Z(ce, { className: "h-3 w-3" }), K("detail.previousPage")]
|
|
784
779
|
}),
|
|
785
780
|
/* @__PURE__ */ Z("span", {
|
|
786
781
|
className: "text-xs text-muted-foreground",
|
|
787
|
-
children:
|
|
782
|
+
children: K("detail.pageOf", {
|
|
788
783
|
current: U + 1,
|
|
789
|
-
total:
|
|
784
|
+
total: Ce
|
|
790
785
|
})
|
|
791
786
|
}),
|
|
792
787
|
/* @__PURE__ */ Q(g, {
|
|
793
788
|
variant: "outline",
|
|
794
789
|
size: "sm",
|
|
795
790
|
className: "h-7 text-xs gap-1",
|
|
796
|
-
disabled: U >=
|
|
797
|
-
onClick: () =>
|
|
798
|
-
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" })]
|
|
799
794
|
})
|
|
800
795
|
]
|
|
801
796
|
}),
|
|
802
|
-
E && !
|
|
797
|
+
E && !X && q > 0 && Se.length > q && /* @__PURE__ */ Z("div", {
|
|
803
798
|
className: "mt-3 pt-3 border-t flex justify-center",
|
|
804
799
|
children: /* @__PURE__ */ Q("button", {
|
|
805
800
|
type: "button",
|
|
@@ -807,28 +802,28 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
807
802
|
e.stopPropagation(), E();
|
|
808
803
|
},
|
|
809
804
|
className: "text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors",
|
|
810
|
-
children: [
|
|
805
|
+
children: [K("detail.viewAll"), /* @__PURE__ */ Z(ge, { className: "h-3 w-3" })]
|
|
811
806
|
})
|
|
812
807
|
})
|
|
813
808
|
]
|
|
814
809
|
}),
|
|
815
810
|
/* @__PURE__ */ Z(i, {
|
|
816
|
-
open:
|
|
811
|
+
open: Ee !== null,
|
|
817
812
|
onOpenChange: (e) => {
|
|
818
|
-
e ||
|
|
813
|
+
e || J(null);
|
|
819
814
|
},
|
|
820
|
-
children: /* @__PURE__ */ Q(s, { children: [/* @__PURE__ */ Q(u, { children: [/* @__PURE__ */ Z(d, { children:
|
|
821
|
-
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,
|
|
822
817
|
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
823
|
-
children:
|
|
818
|
+
children: K("detail.delete", { defaultValue: "Delete" })
|
|
824
819
|
})] })] })
|
|
825
820
|
})
|
|
826
821
|
]
|
|
827
822
|
});
|
|
828
|
-
},
|
|
823
|
+
}, _t = ({ group: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s }) => {
|
|
829
824
|
let c = e.collapsible ?? !0, [l, u] = n.useState(e.defaultCollapsed ?? !1), d = /* @__PURE__ */ Z("div", {
|
|
830
825
|
className: "space-y-3 sm:space-y-4",
|
|
831
|
-
children: e.sections.map((e, n) => /* @__PURE__ */ Z(
|
|
826
|
+
children: e.sections.map((e, n) => /* @__PURE__ */ Z(pt, {
|
|
832
827
|
section: e,
|
|
833
828
|
data: t,
|
|
834
829
|
objectSchema: i,
|
|
@@ -888,53 +883,51 @@ var pt = ({ title: e, type: t, api: r, data: f, schema: p, columns: m, className
|
|
|
888
883
|
d
|
|
889
884
|
]
|
|
890
885
|
});
|
|
891
|
-
},
|
|
892
|
-
let { fieldLabel: a } =
|
|
886
|
+
}, vt = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
|
|
887
|
+
let { fieldLabel: a } = Ze();
|
|
893
888
|
if (!e.length || !t) return null;
|
|
894
889
|
let o = e.filter((e) => {
|
|
895
890
|
let n = t?.[e.name];
|
|
896
891
|
return n != null && n !== "";
|
|
897
892
|
});
|
|
898
|
-
return o.length === 0 ? null : /* @__PURE__ */ Z(
|
|
899
|
-
className: L("
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
}, e.name);
|
|
930
|
-
})
|
|
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);
|
|
931
924
|
})
|
|
932
925
|
})
|
|
933
926
|
});
|
|
934
927
|
};
|
|
935
928
|
//#endregion
|
|
936
929
|
//#region src/RecordComments.tsx
|
|
937
|
-
function
|
|
930
|
+
function yt(e) {
|
|
938
931
|
try {
|
|
939
932
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
940
933
|
if (r < 1) return "just now";
|
|
@@ -947,7 +940,7 @@ function gt(e) {
|
|
|
947
940
|
return e;
|
|
948
941
|
}
|
|
949
942
|
}
|
|
950
|
-
var
|
|
943
|
+
var bt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, className: a }) => {
|
|
951
944
|
let { t: o } = $(), [s, c] = n.useState(""), [l, u] = n.useState(!1), [d, f] = n.useState(""), p = n.useCallback(async () => {
|
|
952
945
|
let e = s.trim();
|
|
953
946
|
if (!(!e || !t)) {
|
|
@@ -969,7 +962,7 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
969
962
|
children: [/* @__PURE__ */ Z(y, { children: /* @__PURE__ */ Q(b, {
|
|
970
963
|
className: "flex items-center gap-2 text-base",
|
|
971
964
|
children: [
|
|
972
|
-
/* @__PURE__ */ Z(
|
|
965
|
+
/* @__PURE__ */ Z(J, { className: "h-4 w-4" }),
|
|
973
966
|
o("detail.comments"),
|
|
974
967
|
/* @__PURE__ */ Q("span", {
|
|
975
968
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -988,7 +981,7 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
988
981
|
children: /* @__PURE__ */ Q("div", {
|
|
989
982
|
className: "relative flex-1",
|
|
990
983
|
children: [
|
|
991
|
-
/* @__PURE__ */ Z(
|
|
984
|
+
/* @__PURE__ */ Z(Ie, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
|
|
992
985
|
/* @__PURE__ */ Z("input", {
|
|
993
986
|
className: "w-full rounded-md border border-input bg-background pl-8 pr-8 py-1.5 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
994
987
|
placeholder: o("detail.searchComments"),
|
|
@@ -1021,7 +1014,7 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1021
1014
|
onClick: p,
|
|
1022
1015
|
disabled: !s.trim() || l,
|
|
1023
1016
|
className: "shrink-0 self-end",
|
|
1024
|
-
children: /* @__PURE__ */ Z(
|
|
1017
|
+
children: /* @__PURE__ */ Z(X, { className: "h-4 w-4" })
|
|
1025
1018
|
})]
|
|
1026
1019
|
}),
|
|
1027
1020
|
h.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
@@ -1053,11 +1046,11 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1053
1046
|
}),
|
|
1054
1047
|
/* @__PURE__ */ Z("span", {
|
|
1055
1048
|
className: "text-xs text-muted-foreground",
|
|
1056
|
-
children:
|
|
1049
|
+
children: yt(e.createdAt)
|
|
1057
1050
|
}),
|
|
1058
1051
|
e.pinned && /* @__PURE__ */ Q("span", {
|
|
1059
1052
|
className: "text-xs text-amber-600 flex items-center gap-0.5",
|
|
1060
|
-
children: [/* @__PURE__ */ Z(
|
|
1053
|
+
children: [/* @__PURE__ */ Z(je, { className: "h-3 w-3" }), o("detail.pinned")]
|
|
1061
1054
|
})
|
|
1062
1055
|
]
|
|
1063
1056
|
}),
|
|
@@ -1070,7 +1063,7 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1070
1063
|
className: "mt-1 text-xs text-muted-foreground hover:text-foreground flex items-center gap-1",
|
|
1071
1064
|
onClick: () => r(e.id),
|
|
1072
1065
|
"aria-label": e.pinned ? o("detail.unpin") : o("detail.pin"),
|
|
1073
|
-
children: [/* @__PURE__ */ Z(
|
|
1066
|
+
children: [/* @__PURE__ */ Z(je, { className: "h-3 w-3" }), e.pinned ? o("detail.unpin") : o("detail.pin")]
|
|
1074
1067
|
})
|
|
1075
1068
|
]
|
|
1076
1069
|
})]
|
|
@@ -1079,20 +1072,20 @@ var _t = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1079
1072
|
]
|
|
1080
1073
|
})]
|
|
1081
1074
|
});
|
|
1082
|
-
},
|
|
1083
|
-
field_change:
|
|
1084
|
-
create:
|
|
1075
|
+
}, xt = {
|
|
1076
|
+
field_change: he,
|
|
1077
|
+
create: Ne,
|
|
1085
1078
|
delete: ze,
|
|
1086
|
-
comment:
|
|
1079
|
+
comment: J,
|
|
1087
1080
|
status_change: B
|
|
1088
|
-
},
|
|
1081
|
+
}, St = {
|
|
1089
1082
|
field_change: "bg-blue-100 text-blue-600",
|
|
1090
1083
|
create: "bg-green-100 text-green-600",
|
|
1091
1084
|
delete: "bg-red-100 text-red-600",
|
|
1092
1085
|
comment: "bg-purple-100 text-purple-600",
|
|
1093
1086
|
status_change: "bg-amber-100 text-amber-600"
|
|
1094
1087
|
};
|
|
1095
|
-
function
|
|
1088
|
+
function Ct(e) {
|
|
1096
1089
|
try {
|
|
1097
1090
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1098
1091
|
if (r < 1) return "just now";
|
|
@@ -1105,24 +1098,24 @@ function bt(e) {
|
|
|
1105
1098
|
return e;
|
|
1106
1099
|
}
|
|
1107
1100
|
}
|
|
1108
|
-
function
|
|
1101
|
+
function wt(e) {
|
|
1109
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";
|
|
1110
1103
|
}
|
|
1111
|
-
var
|
|
1104
|
+
var Tt = {
|
|
1112
1105
|
all: "All",
|
|
1113
1106
|
field_change: "Field Changes",
|
|
1114
1107
|
create: "Creates",
|
|
1115
1108
|
delete: "Deletes",
|
|
1116
1109
|
comment: "Comments",
|
|
1117
1110
|
status_change: "Status Changes"
|
|
1118
|
-
},
|
|
1111
|
+
}, Et = ({ activities: e, filterable: t = !1, defaultFilter: r = "all", className: i }) => {
|
|
1119
1112
|
let [a, o] = n.useState(r), s = n.useMemo(() => a === "all" ? e : e.filter((e) => e.type === a), [e, a]);
|
|
1120
1113
|
return /* @__PURE__ */ Q(_, {
|
|
1121
1114
|
className: L("", i),
|
|
1122
1115
|
children: [/* @__PURE__ */ Z(y, { children: /* @__PURE__ */ Q(b, {
|
|
1123
1116
|
className: "flex items-center gap-2 text-base",
|
|
1124
1117
|
children: [
|
|
1125
|
-
/* @__PURE__ */ Z(
|
|
1118
|
+
/* @__PURE__ */ Z(ne, { className: "h-4 w-4" }),
|
|
1126
1119
|
"Activity",
|
|
1127
1120
|
/* @__PURE__ */ Q("span", {
|
|
1128
1121
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1137,12 +1130,12 @@ var St = {
|
|
|
1137
1130
|
className: "flex flex-wrap gap-1.5 mb-4",
|
|
1138
1131
|
role: "group",
|
|
1139
1132
|
"aria-label": "Activity type filter",
|
|
1140
|
-
children: Object.keys(
|
|
1133
|
+
children: Object.keys(Tt).map((e) => /* @__PURE__ */ Q("button", {
|
|
1141
1134
|
type: "button",
|
|
1142
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"),
|
|
1143
1136
|
onClick: () => o(e),
|
|
1144
1137
|
"aria-pressed": a === e,
|
|
1145
|
-
children: [e !== "all" && n.createElement(
|
|
1138
|
+
children: [e !== "all" && n.createElement(xt[e] || he, { className: "h-3 w-3" }), Tt[e]]
|
|
1146
1139
|
}, e))
|
|
1147
1140
|
}), s.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
1148
1141
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
@@ -1152,11 +1145,11 @@ var St = {
|
|
|
1152
1145
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
1153
1146
|
className: "space-y-4",
|
|
1154
1147
|
children: s.map((e) => {
|
|
1155
|
-
let t =
|
|
1148
|
+
let t = xt[e.type] || he;
|
|
1156
1149
|
return /* @__PURE__ */ Q("div", {
|
|
1157
1150
|
className: "flex gap-3 relative",
|
|
1158
1151
|
children: [/* @__PURE__ */ Z("div", {
|
|
1159
|
-
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"),
|
|
1160
1153
|
children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
|
|
1161
1154
|
}), /* @__PURE__ */ Q("div", {
|
|
1162
1155
|
className: "flex-1 min-w-0 pt-1",
|
|
@@ -1170,12 +1163,12 @@ var St = {
|
|
|
1170
1163
|
" ",
|
|
1171
1164
|
/* @__PURE__ */ Z("span", {
|
|
1172
1165
|
className: "text-muted-foreground",
|
|
1173
|
-
children:
|
|
1166
|
+
children: wt(e)
|
|
1174
1167
|
})
|
|
1175
1168
|
]
|
|
1176
1169
|
}), /* @__PURE__ */ Z("p", {
|
|
1177
1170
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
1178
|
-
children:
|
|
1171
|
+
children: Ct(e.timestamp)
|
|
1179
1172
|
})]
|
|
1180
1173
|
})]
|
|
1181
1174
|
}, e.id);
|
|
@@ -1183,7 +1176,7 @@ var St = {
|
|
|
1183
1176
|
})]
|
|
1184
1177
|
})] })]
|
|
1185
1178
|
});
|
|
1186
|
-
},
|
|
1179
|
+
}, Dt = {
|
|
1187
1180
|
create: "default",
|
|
1188
1181
|
update: "secondary",
|
|
1189
1182
|
delete: "destructive",
|
|
@@ -1195,12 +1188,12 @@ var St = {
|
|
|
1195
1188
|
export: "outline",
|
|
1196
1189
|
import: "outline"
|
|
1197
1190
|
};
|
|
1198
|
-
function
|
|
1191
|
+
function Ot(e) {
|
|
1199
1192
|
if (!e) return "";
|
|
1200
1193
|
let t = e instanceof Date ? e : new Date(e);
|
|
1201
1194
|
return Number.isNaN(t.getTime()) ? String(e) : t.toLocaleString();
|
|
1202
1195
|
}
|
|
1203
|
-
var
|
|
1196
|
+
var kt = [
|
|
1204
1197
|
[60, "second"],
|
|
1205
1198
|
[60, "minute"],
|
|
1206
1199
|
[24, "hour"],
|
|
@@ -1209,27 +1202,27 @@ var Et = [
|
|
|
1209
1202
|
[12, "month"],
|
|
1210
1203
|
[Infinity, "year"]
|
|
1211
1204
|
];
|
|
1212
|
-
function
|
|
1205
|
+
function At(e, t) {
|
|
1213
1206
|
if (!e) return "";
|
|
1214
1207
|
let n = e instanceof Date ? e : new Date(e);
|
|
1215
1208
|
if (Number.isNaN(n.getTime())) return String(e);
|
|
1216
1209
|
let r = (n.getTime() - Date.now()) / 1e3;
|
|
1217
|
-
for (let [n, i] of
|
|
1210
|
+
for (let [n, i] of kt) {
|
|
1218
1211
|
if (Math.abs(r) < n) try {
|
|
1219
1212
|
return new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(Math.round(r), i);
|
|
1220
1213
|
} catch {
|
|
1221
|
-
return
|
|
1214
|
+
return Ot(e);
|
|
1222
1215
|
}
|
|
1223
1216
|
r /= n;
|
|
1224
1217
|
}
|
|
1225
|
-
return
|
|
1218
|
+
return Ot(e);
|
|
1226
1219
|
}
|
|
1227
|
-
function
|
|
1220
|
+
function jt(e) {
|
|
1228
1221
|
if (!e) return "?";
|
|
1229
1222
|
let t = e.trim().split(/\s+/).filter(Boolean).slice(0, 2);
|
|
1230
1223
|
return t.length === 0 ? "?" : t.map((e) => e.charAt(0).toUpperCase()).join("");
|
|
1231
1224
|
}
|
|
1232
|
-
function
|
|
1225
|
+
function Mt(e) {
|
|
1233
1226
|
if (e == null || e === "") return "—";
|
|
1234
1227
|
if (typeof e == "string") return e;
|
|
1235
1228
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -1239,7 +1232,7 @@ function kt(e) {
|
|
|
1239
1232
|
return String(e);
|
|
1240
1233
|
}
|
|
1241
1234
|
}
|
|
1242
|
-
function
|
|
1235
|
+
function Nt({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
1243
1236
|
return t ? /* @__PURE__ */ Z("div", {
|
|
1244
1237
|
className: L("space-y-3", r),
|
|
1245
1238
|
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ Q("div", {
|
|
@@ -1257,17 +1250,17 @@ function At({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1257
1250
|
children: /* @__PURE__ */ Z("ol", {
|
|
1258
1251
|
className: L("space-y-4", r),
|
|
1259
1252
|
children: e.map((e, t) => {
|
|
1260
|
-
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;
|
|
1261
1254
|
return /* @__PURE__ */ Q("li", {
|
|
1262
1255
|
className: "flex items-start gap-3",
|
|
1263
1256
|
children: [/* @__PURE__ */ Q(f, {
|
|
1264
1257
|
className: "h-8 w-8 mt-0.5 shrink-0",
|
|
1265
|
-
children: [
|
|
1266
|
-
src:
|
|
1267
|
-
alt:
|
|
1258
|
+
children: [c ? /* @__PURE__ */ Z(m, {
|
|
1259
|
+
src: c,
|
|
1260
|
+
alt: a
|
|
1268
1261
|
}) : null, /* @__PURE__ */ Z(p, {
|
|
1269
1262
|
className: "text-[10px] font-medium",
|
|
1270
|
-
children:
|
|
1263
|
+
children: jt(e.user_name)
|
|
1271
1264
|
})]
|
|
1272
1265
|
}), /* @__PURE__ */ Q("div", {
|
|
1273
1266
|
className: "min-w-0 flex-1",
|
|
@@ -1277,28 +1270,53 @@ function At({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1277
1270
|
children: [
|
|
1278
1271
|
/* @__PURE__ */ Z("span", {
|
|
1279
1272
|
className: "text-sm font-medium text-foreground",
|
|
1280
|
-
children:
|
|
1273
|
+
children: a
|
|
1281
1274
|
}),
|
|
1282
1275
|
e.action && /* @__PURE__ */ Z(h, {
|
|
1283
|
-
variant:
|
|
1276
|
+
variant: r,
|
|
1284
1277
|
className: "text-[10px] uppercase tracking-wide",
|
|
1285
1278
|
children: e.action
|
|
1286
1279
|
}),
|
|
1287
|
-
|
|
1280
|
+
o && /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
|
|
1288
1281
|
asChild: !0,
|
|
1289
1282
|
children: /* @__PURE__ */ Z("span", {
|
|
1290
1283
|
className: "text-xs text-muted-foreground cursor-help",
|
|
1291
|
-
"aria-label":
|
|
1292
|
-
children:
|
|
1284
|
+
"aria-label": o,
|
|
1285
|
+
children: s || o
|
|
1293
1286
|
})
|
|
1294
|
-
}), /* @__PURE__ */ Z(P, { children:
|
|
1287
|
+
}), /* @__PURE__ */ Z(P, { children: o })] })
|
|
1295
1288
|
]
|
|
1296
1289
|
}),
|
|
1297
1290
|
e.summary && /* @__PURE__ */ Z("p", {
|
|
1298
1291
|
className: "mt-1 text-sm text-muted-foreground",
|
|
1299
1292
|
children: e.summary
|
|
1300
1293
|
}),
|
|
1301
|
-
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", {
|
|
1302
1320
|
className: "mt-1.5 space-y-0.5 text-xs text-muted-foreground",
|
|
1303
1321
|
children: e.changes.map((e) => /* @__PURE__ */ Q("li", {
|
|
1304
1322
|
className: "leading-relaxed",
|
|
@@ -1310,16 +1328,16 @@ function At({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1310
1328
|
": ",
|
|
1311
1329
|
/* @__PURE__ */ Z("span", {
|
|
1312
1330
|
className: "line-through opacity-70",
|
|
1313
|
-
children:
|
|
1331
|
+
children: Mt(e.from)
|
|
1314
1332
|
}),
|
|
1315
1333
|
" → ",
|
|
1316
1334
|
/* @__PURE__ */ Z("span", {
|
|
1317
1335
|
className: "text-foreground",
|
|
1318
|
-
children:
|
|
1336
|
+
children: Mt(e.to)
|
|
1319
1337
|
})
|
|
1320
1338
|
]
|
|
1321
1339
|
}, e.field))
|
|
1322
|
-
})
|
|
1340
|
+
}))
|
|
1323
1341
|
]
|
|
1324
1342
|
})]
|
|
1325
1343
|
}, e.id ?? t);
|
|
@@ -1329,13 +1347,13 @@ function At({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1329
1347
|
}
|
|
1330
1348
|
//#endregion
|
|
1331
1349
|
//#region src/RecordMetaFooter.tsx
|
|
1332
|
-
var
|
|
1350
|
+
var Pt = {
|
|
1333
1351
|
createdAt: "created_at",
|
|
1334
1352
|
createdBy: "created_by",
|
|
1335
1353
|
updatedAt: "updated_at",
|
|
1336
1354
|
updatedBy: "updated_by"
|
|
1337
1355
|
};
|
|
1338
|
-
function
|
|
1356
|
+
function Ft(e) {
|
|
1339
1357
|
if (!e) return null;
|
|
1340
1358
|
if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
|
|
1341
1359
|
if (typeof e == "string" || typeof e == "number") {
|
|
@@ -1344,7 +1362,7 @@ function Mt(e) {
|
|
|
1344
1362
|
}
|
|
1345
1363
|
return null;
|
|
1346
1364
|
}
|
|
1347
|
-
function
|
|
1365
|
+
function It(e, t) {
|
|
1348
1366
|
let n = Date.now() - e.getTime(), r = Math.max(0, Math.floor(n / 1e3));
|
|
1349
1367
|
if (r < 60) return t("detail.justNow");
|
|
1350
1368
|
let i = Math.floor(r / 60);
|
|
@@ -1352,7 +1370,7 @@ function Nt(e, t) {
|
|
|
1352
1370
|
let a = Math.floor(i / 60);
|
|
1353
1371
|
return a < 24 ? t("detail.hoursAgo", { count: a }) : t("detail.daysAgo", { count: Math.floor(a / 24) });
|
|
1354
1372
|
}
|
|
1355
|
-
function
|
|
1373
|
+
function Lt(e) {
|
|
1356
1374
|
try {
|
|
1357
1375
|
return new Intl.DateTimeFormat(void 0, {
|
|
1358
1376
|
dateStyle: "medium",
|
|
@@ -1362,16 +1380,16 @@ function Pt(e) {
|
|
|
1362
1380
|
return e.toISOString();
|
|
1363
1381
|
}
|
|
1364
1382
|
}
|
|
1365
|
-
var
|
|
1383
|
+
var Rt = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
1366
1384
|
if (e == null || e === "") return null;
|
|
1367
1385
|
let r = t?.fields?.[n], i = r?.reference_to || r?.reference, a = {
|
|
1368
1386
|
name: n,
|
|
1369
1387
|
type: r?.type || (i ? "lookup" : "text"),
|
|
1370
1388
|
...i && { reference_to: i },
|
|
1371
1389
|
...r?.reference_field && { reference_field: r.reference_field }
|
|
1372
|
-
}, o =
|
|
1390
|
+
}, o = tt(a) || a.type;
|
|
1373
1391
|
if (o) {
|
|
1374
|
-
let t =
|
|
1392
|
+
let t = et(o);
|
|
1375
1393
|
if (t) return /* @__PURE__ */ Z("span", {
|
|
1376
1394
|
className: "inline-flex items-center [&_a]:text-inherit [&_a]:hover:underline",
|
|
1377
1395
|
children: /* @__PURE__ */ Z(t, {
|
|
@@ -1381,7 +1399,7 @@ var Ft = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1381
1399
|
});
|
|
1382
1400
|
}
|
|
1383
1401
|
return /* @__PURE__ */ Z("span", { children: String(e) });
|
|
1384
|
-
},
|
|
1402
|
+
}, zt = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
|
|
1385
1403
|
if (!t && !n) return null;
|
|
1386
1404
|
let o = n ? /* @__PURE__ */ Z(F, {
|
|
1387
1405
|
delayDuration: 200,
|
|
@@ -1390,11 +1408,11 @@ var Ft = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1390
1408
|
children: /* @__PURE__ */ Z("time", {
|
|
1391
1409
|
dateTime: n.toISOString(),
|
|
1392
1410
|
className: "cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2",
|
|
1393
|
-
children:
|
|
1411
|
+
children: It(n, a)
|
|
1394
1412
|
})
|
|
1395
1413
|
}), /* @__PURE__ */ Z(P, {
|
|
1396
1414
|
side: "top",
|
|
1397
|
-
children:
|
|
1415
|
+
children: Lt(n)
|
|
1398
1416
|
})] })
|
|
1399
1417
|
}) : null;
|
|
1400
1418
|
return /* @__PURE__ */ Q("span", {
|
|
@@ -1404,7 +1422,7 @@ var Ft = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1404
1422
|
className: "text-muted-foreground/70",
|
|
1405
1423
|
children: e
|
|
1406
1424
|
}),
|
|
1407
|
-
t ? /* @__PURE__ */ Z(
|
|
1425
|
+
t ? /* @__PURE__ */ Z(Rt, {
|
|
1408
1426
|
value: t,
|
|
1409
1427
|
objectSchema: r,
|
|
1410
1428
|
fieldName: i
|
|
@@ -1416,31 +1434,31 @@ var Ft = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1416
1434
|
o
|
|
1417
1435
|
]
|
|
1418
1436
|
});
|
|
1419
|
-
},
|
|
1437
|
+
}, Bt = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
|
|
1420
1438
|
let { t: i } = $();
|
|
1421
1439
|
if (!e) return null;
|
|
1422
|
-
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));
|
|
1423
1441
|
return !l && !d ? null : /* @__PURE__ */ Q("div", {
|
|
1424
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),
|
|
1425
1443
|
"data-testid": "record-meta-footer",
|
|
1426
|
-
children: [l && /* @__PURE__ */ Z(
|
|
1444
|
+
children: [l && /* @__PURE__ */ Z(zt, {
|
|
1427
1445
|
label: i("detail.createdBy"),
|
|
1428
1446
|
user: s,
|
|
1429
1447
|
date: a,
|
|
1430
1448
|
objectSchema: t,
|
|
1431
|
-
userField:
|
|
1449
|
+
userField: Pt.createdBy,
|
|
1432
1450
|
t: i
|
|
1433
|
-
}), d && /* @__PURE__ */ Z(
|
|
1451
|
+
}), d && /* @__PURE__ */ Z(zt, {
|
|
1434
1452
|
label: i("detail.updatedBy"),
|
|
1435
1453
|
user: c,
|
|
1436
1454
|
date: o,
|
|
1437
1455
|
objectSchema: t,
|
|
1438
|
-
userField:
|
|
1456
|
+
userField: Pt.updatedBy,
|
|
1439
1457
|
t: i
|
|
1440
1458
|
})]
|
|
1441
1459
|
});
|
|
1442
|
-
},
|
|
1443
|
-
function
|
|
1460
|
+
}, Vt = 5;
|
|
1461
|
+
function Ht(e, t, n, r) {
|
|
1444
1462
|
if (e && typeof e == "object") {
|
|
1445
1463
|
if (t.primaryField) {
|
|
1446
1464
|
let n = e[t.primaryField];
|
|
@@ -1487,8 +1505,8 @@ function zt(e, t, n, r) {
|
|
|
1487
1505
|
}
|
|
1488
1506
|
return r;
|
|
1489
1507
|
}
|
|
1490
|
-
var
|
|
1491
|
-
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(() => {
|
|
1492
1510
|
if (!V?.isLoaded || !e.objectName) return e;
|
|
1493
1511
|
let t = (t) => V.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
|
|
1494
1512
|
let n = typeof e == "string" ? e : e?.name;
|
|
@@ -1507,7 +1525,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1507
1525
|
n.useEffect(() => {
|
|
1508
1526
|
m && p && p(m);
|
|
1509
1527
|
}, [m, p]);
|
|
1510
|
-
let
|
|
1528
|
+
let ie = n.useMemo(() => {
|
|
1511
1529
|
if (H.summaryFields && H.summaryFields.length > 0) return [];
|
|
1512
1530
|
let e = [...H.sections?.flatMap((e) => e.fields) || [], ...H.fields || []], t = {};
|
|
1513
1531
|
for (let n of e) t[n.name] || (t[n.name] = n);
|
|
@@ -1533,9 +1551,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1533
1551
|
H.fields,
|
|
1534
1552
|
E,
|
|
1535
1553
|
m
|
|
1536
|
-
]),
|
|
1554
|
+
]), U = H.summaryFields && H.summaryFields.length > 0 ? H.summaryFields : ie, ae = n.useCallback(() => {
|
|
1537
1555
|
H.resourceId && navigator.clipboard.writeText(String(H.resourceId)).then(() => {
|
|
1538
|
-
|
|
1556
|
+
ne(!0), setTimeout(() => ne(!1), 1500);
|
|
1539
1557
|
});
|
|
1540
1558
|
}, [H.resourceId]);
|
|
1541
1559
|
n.useEffect(() => {
|
|
@@ -1609,7 +1627,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1609
1627
|
});
|
|
1610
1628
|
}, [H]), fe = n.useCallback(() => {
|
|
1611
1629
|
x(!b);
|
|
1612
|
-
}, [b]),
|
|
1630
|
+
}, [b]), pe = n.useCallback(() => {
|
|
1613
1631
|
if (S) {
|
|
1614
1632
|
let e = Object.entries(w);
|
|
1615
1633
|
if (e.length > 0) {
|
|
@@ -1629,9 +1647,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1629
1647
|
w,
|
|
1630
1648
|
m,
|
|
1631
1649
|
l
|
|
1632
|
-
]),
|
|
1650
|
+
]), ge = n.useCallback(() => {
|
|
1633
1651
|
T({}), C(!1);
|
|
1634
|
-
}, []),
|
|
1652
|
+
}, []), G = n.useCallback((e, t) => {
|
|
1635
1653
|
T((n) => ({
|
|
1636
1654
|
...n,
|
|
1637
1655
|
[e]: t
|
|
@@ -1645,7 +1663,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1645
1663
|
};
|
|
1646
1664
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
1647
1665
|
}, [H.recordNavigation]);
|
|
1648
|
-
let
|
|
1666
|
+
let _e = n.useMemo(() => H.related ?? [], [H.related]), ve = n.useMemo(() => {
|
|
1649
1667
|
let e = [];
|
|
1650
1668
|
return e.push({
|
|
1651
1669
|
name: "sys_share",
|
|
@@ -1666,7 +1684,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1666
1684
|
icon: "edit",
|
|
1667
1685
|
type: "script",
|
|
1668
1686
|
className: "sm:hidden",
|
|
1669
|
-
onClick:
|
|
1687
|
+
onClick: pe
|
|
1670
1688
|
}), H.showDelete && e.push({
|
|
1671
1689
|
name: "sys_delete",
|
|
1672
1690
|
label: z("detail.delete"),
|
|
@@ -1684,11 +1702,11 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1684
1702
|
S,
|
|
1685
1703
|
de,
|
|
1686
1704
|
se,
|
|
1687
|
-
|
|
1705
|
+
pe,
|
|
1688
1706
|
ue
|
|
1689
|
-
]),
|
|
1707
|
+
]), ye = n.useMemo(() => {
|
|
1690
1708
|
let e = H.actions ?? [];
|
|
1691
|
-
if (
|
|
1709
|
+
if (ve.length === 0) return e;
|
|
1692
1710
|
let t = !1, n = e.map((e) => {
|
|
1693
1711
|
let n = e;
|
|
1694
1712
|
if (n && typeof n == "object" && n.type === "action:bar" && (!n.location || n.location === "record_header")) {
|
|
@@ -1696,7 +1714,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1696
1714
|
let e = Array.isArray(n.systemActions) ? n.systemActions : [];
|
|
1697
1715
|
return {
|
|
1698
1716
|
...n,
|
|
1699
|
-
systemActions: [...e, ...
|
|
1717
|
+
systemActions: [...e, ...ve]
|
|
1700
1718
|
};
|
|
1701
1719
|
}
|
|
1702
1720
|
return e;
|
|
@@ -1704,9 +1722,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1704
1722
|
return t || n.push({
|
|
1705
1723
|
type: "action:bar",
|
|
1706
1724
|
location: "record_header",
|
|
1707
|
-
systemActions:
|
|
1725
|
+
systemActions: ve
|
|
1708
1726
|
}), n;
|
|
1709
|
-
}, [H.actions,
|
|
1727
|
+
}, [H.actions, ve]);
|
|
1710
1728
|
return v || H.loading ? /* @__PURE__ */ Q("div", {
|
|
1711
1729
|
className: L("space-y-4", i),
|
|
1712
1730
|
children: [
|
|
@@ -1730,7 +1748,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1730
1748
|
size: "sm",
|
|
1731
1749
|
onClick: oe,
|
|
1732
1750
|
className: "mt-4 gap-2",
|
|
1733
|
-
children: [/* @__PURE__ */ Z(
|
|
1751
|
+
children: [/* @__PURE__ */ Z(R, { className: "h-4 w-4" }), z("detail.goBack")]
|
|
1734
1752
|
})
|
|
1735
1753
|
]
|
|
1736
1754
|
}) : /* @__PURE__ */ Z(F, { children: /* @__PURE__ */ Q("div", {
|
|
@@ -1747,7 +1765,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1747
1765
|
size: "icon",
|
|
1748
1766
|
onClick: oe,
|
|
1749
1767
|
className: "shrink-0 mt-1",
|
|
1750
|
-
children: /* @__PURE__ */ Z(
|
|
1768
|
+
children: /* @__PURE__ */ Z(R, { className: "h-4 w-4" })
|
|
1751
1769
|
})
|
|
1752
1770
|
}), /* @__PURE__ */ Z(P, { children: z("detail.back") })] }), /* @__PURE__ */ Q("div", {
|
|
1753
1771
|
className: "flex-1 min-w-0",
|
|
@@ -1756,9 +1774,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1756
1774
|
children: [
|
|
1757
1775
|
/* @__PURE__ */ Z("h1", {
|
|
1758
1776
|
className: "text-xl sm:text-2xl font-bold truncate",
|
|
1759
|
-
children:
|
|
1777
|
+
children: Ht(m, H, E, z("detail.details"))
|
|
1760
1778
|
}),
|
|
1761
|
-
|
|
1779
|
+
U.map((e) => {
|
|
1762
1780
|
let t = m?.[e];
|
|
1763
1781
|
if (t == null || t === "") return null;
|
|
1764
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;
|
|
@@ -1837,9 +1855,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1837
1855
|
variant: "ghost",
|
|
1838
1856
|
size: "icon",
|
|
1839
1857
|
className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
|
|
1840
|
-
onClick:
|
|
1858
|
+
onClick: ae,
|
|
1841
1859
|
"aria-label": z("detail.copyRecordId", { defaultValue: "Copy record ID" }),
|
|
1842
|
-
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" })
|
|
1843
1861
|
})
|
|
1844
1862
|
}), /* @__PURE__ */ Z(P, { children: O ? z("detail.copied", { defaultValue: "Copied" }) : z("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
|
|
1845
1863
|
})]
|
|
@@ -1887,12 +1905,12 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1887
1905
|
}), /* @__PURE__ */ Z(P, { children: z("detail.nextRecord") })] })
|
|
1888
1906
|
]
|
|
1889
1907
|
}),
|
|
1890
|
-
c && /* @__PURE__ */ Q(
|
|
1908
|
+
c && /* @__PURE__ */ Q(nt, { children: [S && /* @__PURE__ */ Q(N, { children: [/* @__PURE__ */ Z(I, {
|
|
1891
1909
|
asChild: !0,
|
|
1892
1910
|
children: /* @__PURE__ */ Q(g, {
|
|
1893
1911
|
variant: "ghost",
|
|
1894
1912
|
size: "sm",
|
|
1895
|
-
onClick:
|
|
1913
|
+
onClick: ge,
|
|
1896
1914
|
className: "gap-2 hidden sm:inline-flex",
|
|
1897
1915
|
children: [/* @__PURE__ */ Z(Ve, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1898
1916
|
className: "hidden sm:inline",
|
|
@@ -1904,12 +1922,12 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1904
1922
|
children: /* @__PURE__ */ Z(g, {
|
|
1905
1923
|
variant: S ? "default" : "outline",
|
|
1906
1924
|
size: "sm",
|
|
1907
|
-
onClick:
|
|
1925
|
+
onClick: pe,
|
|
1908
1926
|
className: "gap-2 hidden sm:inline-flex",
|
|
1909
|
-
children: S ? /* @__PURE__ */ Q(
|
|
1927
|
+
children: S ? /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z(W, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1910
1928
|
className: "hidden sm:inline",
|
|
1911
1929
|
children: z("detail.save")
|
|
1912
|
-
})] }) : /* @__PURE__ */ Q(
|
|
1930
|
+
})] }) : /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1913
1931
|
className: "hidden sm:inline",
|
|
1914
1932
|
children: z("detail.editInline")
|
|
1915
1933
|
})] })
|
|
@@ -1921,13 +1939,13 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1921
1939
|
variant: "default",
|
|
1922
1940
|
onClick: se,
|
|
1923
1941
|
className: "gap-2 hidden sm:inline-flex",
|
|
1924
|
-
children: [/* @__PURE__ */ Z(
|
|
1942
|
+
children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1925
1943
|
className: "hidden sm:inline",
|
|
1926
1944
|
children: z("detail.edit")
|
|
1927
1945
|
})]
|
|
1928
1946
|
})
|
|
1929
1947
|
}), /* @__PURE__ */ Z(P, { children: z("detail.editRecord") })] }),
|
|
1930
|
-
|
|
1948
|
+
ye.map((e, t) => /* @__PURE__ */ Z(We, {
|
|
1931
1949
|
schema: e,
|
|
1932
1950
|
data: m
|
|
1933
1951
|
}, `header-action-${t}`))
|
|
@@ -1938,17 +1956,17 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1938
1956
|
schema: H.header,
|
|
1939
1957
|
data: m
|
|
1940
1958
|
}) }),
|
|
1941
|
-
H.highlightFields && H.highlightFields.length > 0 && /* @__PURE__ */ Z(
|
|
1959
|
+
H.highlightFields && H.highlightFields.length > 0 && /* @__PURE__ */ Z(vt, {
|
|
1942
1960
|
fields: H.highlightFields,
|
|
1943
1961
|
data: m,
|
|
1944
1962
|
objectName: H.objectName,
|
|
1945
1963
|
objectSchema: E
|
|
1946
1964
|
}),
|
|
1947
1965
|
H.autoTabs && !H.tabs?.length ? (() => {
|
|
1948
|
-
let e =
|
|
1966
|
+
let e = _e.length > 0, t = !!H.activities && H.activities.length > 0, n = !!u, i = !!H.history, a = /* @__PURE__ */ Q("div", {
|
|
1949
1967
|
className: "space-y-3 sm:space-y-4",
|
|
1950
1968
|
children: [
|
|
1951
|
-
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, {
|
|
1952
1970
|
group: e,
|
|
1953
1971
|
data: {
|
|
1954
1972
|
...m,
|
|
@@ -1957,9 +1975,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1957
1975
|
objectSchema: E,
|
|
1958
1976
|
objectName: H.objectName,
|
|
1959
1977
|
isEditing: S,
|
|
1960
|
-
onFieldChange:
|
|
1978
|
+
onFieldChange: G
|
|
1961
1979
|
}, t)),
|
|
1962
|
-
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, {
|
|
1963
1981
|
section: e,
|
|
1964
1982
|
data: {
|
|
1965
1983
|
...m,
|
|
@@ -1968,9 +1986,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1968
1986
|
objectSchema: E,
|
|
1969
1987
|
objectName: H.objectName,
|
|
1970
1988
|
isEditing: S,
|
|
1971
|
-
onFieldChange:
|
|
1989
|
+
onFieldChange: G
|
|
1972
1990
|
}, t)),
|
|
1973
|
-
H.fields && H.fields.length > 0 && !H.sections?.length && /* @__PURE__ */ Z(
|
|
1991
|
+
H.fields && H.fields.length > 0 && !H.sections?.length && /* @__PURE__ */ Z(pt, {
|
|
1974
1992
|
section: {
|
|
1975
1993
|
fields: H.fields,
|
|
1976
1994
|
columns: H.columns
|
|
@@ -1982,9 +2000,9 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1982
2000
|
objectSchema: E,
|
|
1983
2001
|
objectName: H.objectName,
|
|
1984
2002
|
isEditing: S,
|
|
1985
|
-
onFieldChange:
|
|
2003
|
+
onFieldChange: G
|
|
1986
2004
|
}),
|
|
1987
|
-
H.comments && /* @__PURE__ */ Z(
|
|
2005
|
+
H.comments && /* @__PURE__ */ Z(bt, {
|
|
1988
2006
|
comments: H.comments,
|
|
1989
2007
|
onAddComment: H.onAddComment
|
|
1990
2008
|
})
|
|
@@ -2013,7 +2031,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2013
2031
|
children: [z("detail.related"), /* @__PURE__ */ Z(h, {
|
|
2014
2032
|
variant: "secondary",
|
|
2015
2033
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2016
|
-
children:
|
|
2034
|
+
children: _e.length
|
|
2017
2035
|
})]
|
|
2018
2036
|
})
|
|
2019
2037
|
}),
|
|
@@ -2058,7 +2076,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2058
2076
|
className: "mt-4",
|
|
2059
2077
|
children: /* @__PURE__ */ Z("div", {
|
|
2060
2078
|
className: "space-y-3",
|
|
2061
|
-
children:
|
|
2079
|
+
children: _e.map((e, t) => /* @__PURE__ */ Z(gt, {
|
|
2062
2080
|
title: e.title,
|
|
2063
2081
|
type: e.type,
|
|
2064
2082
|
api: e.api,
|
|
@@ -2075,14 +2093,14 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2075
2093
|
onRowDelete: e.onRowDelete,
|
|
2076
2094
|
collapsible: !0,
|
|
2077
2095
|
defaultCollapsed: re && t > 0,
|
|
2078
|
-
pageSize:
|
|
2096
|
+
pageSize: Vt
|
|
2079
2097
|
}, t))
|
|
2080
2098
|
})
|
|
2081
2099
|
}),
|
|
2082
2100
|
t && /* @__PURE__ */ Z(j, {
|
|
2083
2101
|
value: "activity",
|
|
2084
2102
|
className: "mt-4",
|
|
2085
|
-
children: /* @__PURE__ */ Z(
|
|
2103
|
+
children: /* @__PURE__ */ Z(Et, { activities: H.activities })
|
|
2086
2104
|
}),
|
|
2087
2105
|
n && /* @__PURE__ */ Z(j, {
|
|
2088
2106
|
value: "discussion",
|
|
@@ -2092,7 +2110,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2092
2110
|
i && /* @__PURE__ */ Z(j, {
|
|
2093
2111
|
value: "history",
|
|
2094
2112
|
className: "mt-4",
|
|
2095
|
-
children: /* @__PURE__ */ Z(
|
|
2113
|
+
children: /* @__PURE__ */ Z(Nt, {
|
|
2096
2114
|
entries: H.history.entries,
|
|
2097
2115
|
loading: H.history.loading,
|
|
2098
2116
|
emptyText: H.history.emptyText ?? z("detail.historyEmpty", { defaultValue: "No history yet" })
|
|
@@ -2100,10 +2118,10 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2100
2118
|
})
|
|
2101
2119
|
]
|
|
2102
2120
|
});
|
|
2103
|
-
})() : /* @__PURE__ */ Q(
|
|
2121
|
+
})() : /* @__PURE__ */ Q(nt, { children: [
|
|
2104
2122
|
H.sectionGroups && H.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2105
2123
|
className: "space-y-3 sm:space-y-4",
|
|
2106
|
-
children: H.sectionGroups.map((e, t) => /* @__PURE__ */ Z(
|
|
2124
|
+
children: H.sectionGroups.map((e, t) => /* @__PURE__ */ Z(_t, {
|
|
2107
2125
|
group: e,
|
|
2108
2126
|
data: {
|
|
2109
2127
|
...m,
|
|
@@ -2112,12 +2130,12 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2112
2130
|
objectSchema: E,
|
|
2113
2131
|
objectName: H.objectName,
|
|
2114
2132
|
isEditing: S,
|
|
2115
|
-
onFieldChange:
|
|
2133
|
+
onFieldChange: G
|
|
2116
2134
|
}, t))
|
|
2117
2135
|
}),
|
|
2118
2136
|
H.sections && H.sections.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2119
2137
|
className: "space-y-3 sm:space-y-4",
|
|
2120
|
-
children: H.sections.map((e, t) => /* @__PURE__ */ Z(
|
|
2138
|
+
children: H.sections.map((e, t) => /* @__PURE__ */ Z(pt, {
|
|
2121
2139
|
section: e,
|
|
2122
2140
|
data: {
|
|
2123
2141
|
...m,
|
|
@@ -2126,10 +2144,10 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2126
2144
|
objectSchema: E,
|
|
2127
2145
|
objectName: H.objectName,
|
|
2128
2146
|
isEditing: S,
|
|
2129
|
-
onFieldChange:
|
|
2147
|
+
onFieldChange: G
|
|
2130
2148
|
}, t))
|
|
2131
2149
|
}),
|
|
2132
|
-
H.fields && H.fields.length > 0 && !H.sections?.length && /* @__PURE__ */ Z(
|
|
2150
|
+
H.fields && H.fields.length > 0 && !H.sections?.length && /* @__PURE__ */ Z(pt, {
|
|
2133
2151
|
section: {
|
|
2134
2152
|
fields: H.fields,
|
|
2135
2153
|
columns: H.columns
|
|
@@ -2141,18 +2159,18 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2141
2159
|
objectSchema: E,
|
|
2142
2160
|
objectName: H.objectName,
|
|
2143
2161
|
isEditing: S,
|
|
2144
|
-
onFieldChange:
|
|
2162
|
+
onFieldChange: G
|
|
2145
2163
|
}),
|
|
2146
|
-
H.tabs && H.tabs.length > 0 && /* @__PURE__ */ Z(
|
|
2164
|
+
H.tabs && H.tabs.length > 0 && /* @__PURE__ */ Z(mt, {
|
|
2147
2165
|
tabs: H.tabs,
|
|
2148
2166
|
data: m
|
|
2149
2167
|
}),
|
|
2150
|
-
|
|
2168
|
+
_e.length > 0 && /* @__PURE__ */ Q("div", {
|
|
2151
2169
|
className: "space-y-3",
|
|
2152
2170
|
children: [/* @__PURE__ */ Z("h2", {
|
|
2153
2171
|
className: "text-lg font-semibold",
|
|
2154
2172
|
children: z("detail.related")
|
|
2155
|
-
}),
|
|
2173
|
+
}), _e.map((e, t) => /* @__PURE__ */ Z(gt, {
|
|
2156
2174
|
title: e.title,
|
|
2157
2175
|
type: e.type,
|
|
2158
2176
|
api: e.api,
|
|
@@ -2169,16 +2187,16 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2169
2187
|
onRowDelete: e.onRowDelete,
|
|
2170
2188
|
collapsible: !0,
|
|
2171
2189
|
defaultCollapsed: re && t > 0,
|
|
2172
|
-
pageSize:
|
|
2190
|
+
pageSize: Vt
|
|
2173
2191
|
}, t))]
|
|
2174
2192
|
}),
|
|
2175
|
-
H.comments && /* @__PURE__ */ Z(
|
|
2193
|
+
H.comments && /* @__PURE__ */ Z(bt, {
|
|
2176
2194
|
comments: H.comments,
|
|
2177
2195
|
onAddComment: H.onAddComment
|
|
2178
2196
|
}),
|
|
2179
|
-
H.activities && H.activities.length > 0 && /* @__PURE__ */ Z(
|
|
2197
|
+
H.activities && H.activities.length > 0 && /* @__PURE__ */ Z(Et, { activities: H.activities })
|
|
2180
2198
|
] }),
|
|
2181
|
-
/* @__PURE__ */ Z(
|
|
2199
|
+
/* @__PURE__ */ Z(Bt, {
|
|
2182
2200
|
data: {
|
|
2183
2201
|
...m,
|
|
2184
2202
|
...w
|
|
@@ -2192,7 +2210,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2192
2210
|
}) })
|
|
2193
2211
|
]
|
|
2194
2212
|
}) });
|
|
2195
|
-
},
|
|
2213
|
+
}, Wt = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name) || null, Gt = (e) => {
|
|
2196
2214
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2197
2215
|
return {
|
|
2198
2216
|
designer: {
|
|
@@ -2202,8 +2220,8 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2202
2220
|
},
|
|
2203
2221
|
rest: i
|
|
2204
2222
|
};
|
|
2205
|
-
},
|
|
2206
|
-
let r =
|
|
2223
|
+
}, Kt = ({ schema: e = {}, className: t, ...n }) => {
|
|
2224
|
+
let r = Ye(), { designer: i } = Gt(n);
|
|
2207
2225
|
if (!r) return /* @__PURE__ */ Z("div", {
|
|
2208
2226
|
className: t,
|
|
2209
2227
|
"data-record-details-placeholder": !0,
|
|
@@ -2213,7 +2231,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2213
2231
|
children: "record:details — bind a record to preview"
|
|
2214
2232
|
})
|
|
2215
2233
|
});
|
|
2216
|
-
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 : [];
|
|
2217
2235
|
if (l.length > 0 && o && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2218
2236
|
className: t,
|
|
2219
2237
|
...i,
|
|
@@ -2226,39 +2244,61 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2226
2244
|
});
|
|
2227
2245
|
let u = e.enforceFieldSecurity === !0, d = Array.isArray(e.redactFields) ? e.redactFields : [], f = (e) => {
|
|
2228
2246
|
if (!e || !u && d.length === 0) return e;
|
|
2229
|
-
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)));
|
|
2230
2248
|
return e.filter((e) => {
|
|
2231
|
-
let t =
|
|
2249
|
+
let t = Wt(e);
|
|
2232
2250
|
return t ? n.has(t) : !0;
|
|
2233
2251
|
});
|
|
2234
2252
|
}, p = (e) => typeof e == "string" ? { name: e } : e && typeof e == "object" && !e.name && e.field ? {
|
|
2235
2253
|
...e,
|
|
2236
2254
|
name: e.field
|
|
2237
|
-
} : 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) => ({
|
|
2238
2274
|
...e,
|
|
2239
2275
|
title: e.title ?? e.label,
|
|
2240
|
-
|
|
2241
|
-
|
|
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 = {
|
|
2242
2280
|
type: "detail-view",
|
|
2243
2281
|
objectName: r.objectName,
|
|
2244
2282
|
resourceId: r.recordId,
|
|
2245
2283
|
data: r.data,
|
|
2246
2284
|
layout: a,
|
|
2247
2285
|
columns: e.columns,
|
|
2248
|
-
sections:
|
|
2249
|
-
fields:
|
|
2286
|
+
sections: S,
|
|
2287
|
+
fields: x,
|
|
2250
2288
|
showBack: !1,
|
|
2251
|
-
showHeader: e.showHeader ?? !1
|
|
2289
|
+
showHeader: e.showHeader ?? !1,
|
|
2290
|
+
inlineEdit: C
|
|
2252
2291
|
};
|
|
2253
2292
|
return /* @__PURE__ */ Z("div", {
|
|
2254
2293
|
className: t,
|
|
2255
2294
|
...i,
|
|
2256
|
-
children: /* @__PURE__ */ Z(
|
|
2257
|
-
schema:
|
|
2258
|
-
dataSource: r.dataSource
|
|
2295
|
+
children: /* @__PURE__ */ Z(Ut, {
|
|
2296
|
+
schema: w,
|
|
2297
|
+
dataSource: r.dataSource,
|
|
2298
|
+
inlineEdit: C
|
|
2259
2299
|
})
|
|
2260
2300
|
});
|
|
2261
|
-
},
|
|
2301
|
+
}, qt = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name || e.key) || null, Jt = (e) => {
|
|
2262
2302
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2263
2303
|
return {
|
|
2264
2304
|
designer: {
|
|
@@ -2268,8 +2308,8 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2268
2308
|
},
|
|
2269
2309
|
rest: i
|
|
2270
2310
|
};
|
|
2271
|
-
},
|
|
2272
|
-
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;
|
|
2273
2313
|
if (!o) return /* @__PURE__ */ Z("div", {
|
|
2274
2314
|
className: t,
|
|
2275
2315
|
...i,
|
|
@@ -2278,7 +2318,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2278
2318
|
children: "record:related_list — missing objectName"
|
|
2279
2319
|
})
|
|
2280
2320
|
});
|
|
2281
|
-
let s =
|
|
2321
|
+
let s = it(), { readableFields: c } = rt(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2282
2322
|
if (l.length > 0 && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2283
2323
|
className: t,
|
|
2284
2324
|
...i,
|
|
@@ -2291,27 +2331,28 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2291
2331
|
});
|
|
2292
2332
|
let u = e.enforceFieldSecurity === !0, d = Array.isArray(e.redactFields) ? e.redactFields : [], f = Array.isArray(e.columns) ? e.columns : [], p = f;
|
|
2293
2333
|
if (u || d.length > 0) {
|
|
2294
|
-
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)));
|
|
2295
2335
|
p = f.filter((e) => {
|
|
2296
|
-
let n =
|
|
2336
|
+
let n = qt(e);
|
|
2297
2337
|
return n ? t.has(n) : !0;
|
|
2298
2338
|
});
|
|
2299
2339
|
}
|
|
2300
2340
|
return /* @__PURE__ */ Z("div", {
|
|
2301
2341
|
className: t,
|
|
2302
2342
|
...i,
|
|
2303
|
-
children: /* @__PURE__ */ Z(
|
|
2343
|
+
children: /* @__PURE__ */ Z(gt, {
|
|
2304
2344
|
title: a,
|
|
2305
2345
|
type: "table",
|
|
2306
2346
|
api: o,
|
|
2307
2347
|
objectName: o,
|
|
2308
2348
|
referenceField: e.relationshipField,
|
|
2349
|
+
parentId: r?.recordId,
|
|
2309
2350
|
columns: p,
|
|
2310
2351
|
pageSize: e.limit,
|
|
2311
2352
|
dataSource: r?.dataSource
|
|
2312
2353
|
})
|
|
2313
2354
|
});
|
|
2314
|
-
},
|
|
2355
|
+
}, Xt = (e) => {
|
|
2315
2356
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2316
2357
|
return {
|
|
2317
2358
|
designer: {
|
|
@@ -2321,11 +2362,11 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2321
2362
|
},
|
|
2322
2363
|
rest: i
|
|
2323
2364
|
};
|
|
2324
|
-
},
|
|
2325
|
-
let
|
|
2326
|
-
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", {
|
|
2327
2368
|
className: t,
|
|
2328
|
-
...
|
|
2369
|
+
...a,
|
|
2329
2370
|
role: "status",
|
|
2330
2371
|
"aria-live": "polite",
|
|
2331
2372
|
children: /* @__PURE__ */ Z("p", {
|
|
@@ -2333,23 +2374,23 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2333
2374
|
children: "Insufficient permissions to view highlights."
|
|
2334
2375
|
})
|
|
2335
2376
|
});
|
|
2336
|
-
let
|
|
2377
|
+
let u = (Array.isArray(e.fields) ? e.fields : []).map((e) => typeof e == "string" ? { name: e } : {
|
|
2337
2378
|
name: e?.name,
|
|
2338
2379
|
label: e?.label,
|
|
2339
2380
|
icon: e?.icon,
|
|
2340
2381
|
type: e?.type
|
|
2341
|
-
}).filter((e) => typeof e.name == "string" && e.name.length > 0),
|
|
2342
|
-
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", {
|
|
2343
2384
|
className: t,
|
|
2344
|
-
...
|
|
2345
|
-
children: /* @__PURE__ */ Z(
|
|
2346
|
-
fields:
|
|
2347
|
-
data:
|
|
2348
|
-
objectName:
|
|
2349
|
-
objectSchema:
|
|
2385
|
+
...a,
|
|
2386
|
+
children: /* @__PURE__ */ Z(vt, {
|
|
2387
|
+
fields: m,
|
|
2388
|
+
data: i?.data,
|
|
2389
|
+
objectName: i?.objectName,
|
|
2390
|
+
objectSchema: i?.objectSchema
|
|
2350
2391
|
})
|
|
2351
2392
|
});
|
|
2352
|
-
},
|
|
2393
|
+
}, Qt = ({ change: e, className: t }) => {
|
|
2353
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));
|
|
2354
2395
|
return /* @__PURE__ */ Q("div", {
|
|
2355
2396
|
className: L("flex items-center gap-1.5 text-sm flex-wrap", t),
|
|
@@ -2369,14 +2410,14 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2369
2410
|
})
|
|
2370
2411
|
]
|
|
2371
2412
|
});
|
|
2372
|
-
},
|
|
2413
|
+
}, $t = [
|
|
2373
2414
|
"👍",
|
|
2374
2415
|
"❤️",
|
|
2375
2416
|
"🎉",
|
|
2376
2417
|
"😂",
|
|
2377
2418
|
"😮",
|
|
2378
2419
|
"😢"
|
|
2379
|
-
],
|
|
2420
|
+
], en = ({ reactions: e, onToggleReaction: t, emojiOptions: r = $t, className: i }) => {
|
|
2380
2421
|
let [a, o] = n.useState(!1), s = n.useCallback((e) => {
|
|
2381
2422
|
t?.(e), o(!1);
|
|
2382
2423
|
}, [t]);
|
|
@@ -2416,7 +2457,7 @@ var Bt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2416
2457
|
};
|
|
2417
2458
|
//#endregion
|
|
2418
2459
|
//#region src/ThreadedReplies.tsx
|
|
2419
|
-
function
|
|
2460
|
+
function tn(e) {
|
|
2420
2461
|
try {
|
|
2421
2462
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
2422
2463
|
if (r < 1) return "just now";
|
|
@@ -2429,7 +2470,7 @@ function Qt(e) {
|
|
|
2429
2470
|
return e;
|
|
2430
2471
|
}
|
|
2431
2472
|
}
|
|
2432
|
-
var
|
|
2473
|
+
var nn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, className: a }) => {
|
|
2433
2474
|
let { t: o } = $(), [s, c] = n.useState(!1), [l, u] = n.useState(""), [d, f] = n.useState(!1), p = n.useCallback(async () => {
|
|
2434
2475
|
let t = l.trim();
|
|
2435
2476
|
if (!(!t || !r)) {
|
|
@@ -2457,7 +2498,7 @@ var $t = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2457
2498
|
"aria-expanded": s,
|
|
2458
2499
|
children: [
|
|
2459
2500
|
Z(s ? se : le, { className: "h-3 w-3" }),
|
|
2460
|
-
/* @__PURE__ */ Z(
|
|
2501
|
+
/* @__PURE__ */ Z(J, { className: "h-3 w-3" }),
|
|
2461
2502
|
/* @__PURE__ */ Z("span", { children: t.length === 1 ? o("detail.replyCount", { count: t.length }) : o("detail.replyCountPlural", { count: t.length }) })
|
|
2462
2503
|
]
|
|
2463
2504
|
}),
|
|
@@ -2484,7 +2525,7 @@ var $t = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2484
2525
|
children: e.actor
|
|
2485
2526
|
}), /* @__PURE__ */ Z("span", {
|
|
2486
2527
|
className: "text-[10px] text-muted-foreground",
|
|
2487
|
-
children:
|
|
2528
|
+
children: tn(e.createdAt)
|
|
2488
2529
|
})]
|
|
2489
2530
|
}), /* @__PURE__ */ Z("p", {
|
|
2490
2531
|
className: "text-xs whitespace-pre-wrap break-words",
|
|
@@ -2509,12 +2550,12 @@ var $t = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2509
2550
|
onClick: p,
|
|
2510
2551
|
disabled: !l.trim() || d,
|
|
2511
2552
|
"aria-label": "Send reply",
|
|
2512
|
-
children: /* @__PURE__ */ Z(
|
|
2553
|
+
children: /* @__PURE__ */ Z(X, { className: "h-3 w-3" })
|
|
2513
2554
|
})]
|
|
2514
2555
|
})
|
|
2515
2556
|
]
|
|
2516
2557
|
});
|
|
2517
|
-
},
|
|
2558
|
+
}, rn = ({ subscription: e, onToggle: t, className: r }) => {
|
|
2518
2559
|
let { t: i } = $(), [a, o] = n.useState(!1), s = n.useCallback(async () => {
|
|
2519
2560
|
if (t) {
|
|
2520
2561
|
o(!0);
|
|
@@ -2533,17 +2574,17 @@ var $t = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2533
2574
|
disabled: a || !t,
|
|
2534
2575
|
"aria-label": e.subscribed ? i("detail.unsubscribeAriaLabel") : i("detail.subscribeAriaLabel"),
|
|
2535
2576
|
title: e.subscribed ? i("detail.subscribedTooltip") : i("detail.unsubscribedTooltip"),
|
|
2536
|
-
children: e.subscribed ? /* @__PURE__ */ Z(H, { className: "h-4 w-4 text-primary" }) : /* @__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" })
|
|
2537
2578
|
});
|
|
2538
|
-
},
|
|
2539
|
-
comment:
|
|
2540
|
-
field_change:
|
|
2579
|
+
}, an = {
|
|
2580
|
+
comment: J,
|
|
2581
|
+
field_change: he,
|
|
2541
2582
|
task: oe,
|
|
2542
|
-
event:
|
|
2583
|
+
event: ae,
|
|
2543
2584
|
system: He,
|
|
2544
|
-
email:
|
|
2545
|
-
call:
|
|
2546
|
-
},
|
|
2585
|
+
email: Ee,
|
|
2586
|
+
call: Ae
|
|
2587
|
+
}, on = {
|
|
2547
2588
|
comment: "bg-purple-100 text-purple-600",
|
|
2548
2589
|
field_change: "bg-blue-100 text-blue-600",
|
|
2549
2590
|
task: "bg-green-100 text-green-600",
|
|
@@ -2552,7 +2593,7 @@ var $t = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2552
2593
|
email: "bg-indigo-100 text-indigo-600",
|
|
2553
2594
|
call: "bg-teal-100 text-teal-600"
|
|
2554
2595
|
};
|
|
2555
|
-
function
|
|
2596
|
+
function sn(e) {
|
|
2556
2597
|
return [
|
|
2557
2598
|
{
|
|
2558
2599
|
value: "all",
|
|
@@ -2572,7 +2613,7 @@ function rn(e) {
|
|
|
2572
2613
|
}
|
|
2573
2614
|
];
|
|
2574
2615
|
}
|
|
2575
|
-
function
|
|
2616
|
+
function cn(e) {
|
|
2576
2617
|
try {
|
|
2577
2618
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
2578
2619
|
if (r < 1) return "just now";
|
|
@@ -2585,7 +2626,7 @@ function an(e) {
|
|
|
2585
2626
|
return e;
|
|
2586
2627
|
}
|
|
2587
2628
|
}
|
|
2588
|
-
function
|
|
2629
|
+
function ln(e, t) {
|
|
2589
2630
|
switch (t) {
|
|
2590
2631
|
case "comments_only": return e.filter((e) => e.type === "comment");
|
|
2591
2632
|
case "changes_only": return e.filter((e) => e.type === "field_change");
|
|
@@ -2593,108 +2634,112 @@ function on(e, t) {
|
|
|
2593
2634
|
default: return e;
|
|
2594
2635
|
}
|
|
2595
2636
|
}
|
|
2596
|
-
var
|
|
2597
|
-
let { t:
|
|
2598
|
-
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();
|
|
2599
2640
|
let e = /* @__PURE__ */ new Map();
|
|
2600
|
-
for (let t of
|
|
2641
|
+
for (let t of M) if (t.parentId) {
|
|
2601
2642
|
let n = e.get(t.parentId) ?? [];
|
|
2602
2643
|
n.push(t), e.set(t.parentId, n);
|
|
2603
2644
|
}
|
|
2604
2645
|
return e;
|
|
2605
|
-
}, [
|
|
2606
|
-
i ? i(e) :
|
|
2607
|
-
}, [i]),
|
|
2608
|
-
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();
|
|
2609
2650
|
if (!(!e || !c)) {
|
|
2610
|
-
|
|
2651
|
+
w(!0);
|
|
2611
2652
|
try {
|
|
2612
|
-
await c(e),
|
|
2653
|
+
await c(e), S("");
|
|
2613
2654
|
} finally {
|
|
2614
|
-
|
|
2655
|
+
w(!1);
|
|
2615
2656
|
}
|
|
2616
2657
|
}
|
|
2617
|
-
}, [
|
|
2618
|
-
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(),
|
|
2619
|
-
}, [
|
|
2658
|
+
}, [x, c]), te = n.useCallback((e) => {
|
|
2659
|
+
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), I());
|
|
2660
|
+
}, [I]), R = n.useCallback(async () => {
|
|
2620
2661
|
if (o) {
|
|
2621
|
-
|
|
2662
|
+
E(!0);
|
|
2622
2663
|
try {
|
|
2623
2664
|
await o();
|
|
2624
2665
|
} finally {
|
|
2625
|
-
|
|
2666
|
+
E(!1);
|
|
2626
2667
|
}
|
|
2627
2668
|
}
|
|
2628
2669
|
}, [o]);
|
|
2629
|
-
return /* @__PURE__ */ Q(
|
|
2630
|
-
className: L("",
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
className: "
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
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
|
|
2645
2696
|
})
|
|
2646
|
-
]
|
|
2647
|
-
})
|
|
2648
|
-
|
|
2649
|
-
children: F && d && /* @__PURE__ */ Z(en, {
|
|
2650
|
-
subscription: d,
|
|
2651
|
-
onToggle: f
|
|
2652
|
-
})
|
|
2653
|
-
})]
|
|
2654
|
-
}) }), /* @__PURE__ */ Q(v, {
|
|
2697
|
+
})]
|
|
2698
|
+
})
|
|
2699
|
+
}), /* @__PURE__ */ Q("div", {
|
|
2655
2700
|
className: "space-y-4",
|
|
2656
2701
|
children: [
|
|
2657
|
-
|
|
2702
|
+
O && /* @__PURE__ */ Z("div", {
|
|
2658
2703
|
className: "flex items-center gap-2",
|
|
2659
2704
|
children: /* @__PURE__ */ Z("select", {
|
|
2660
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",
|
|
2661
|
-
value:
|
|
2662
|
-
onChange: (e) =>
|
|
2663
|
-
"aria-label":
|
|
2664
|
-
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", {
|
|
2665
2710
|
value: e.value,
|
|
2666
2711
|
children: e.label
|
|
2667
2712
|
}, e.value))
|
|
2668
2713
|
})
|
|
2669
2714
|
}),
|
|
2670
|
-
|
|
2715
|
+
k && /* @__PURE__ */ Q("div", {
|
|
2671
2716
|
className: "flex gap-2",
|
|
2672
2717
|
children: [/* @__PURE__ */ Z("textarea", {
|
|
2673
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",
|
|
2674
|
-
placeholder:
|
|
2675
|
-
value:
|
|
2676
|
-
onChange: (e) =>
|
|
2677
|
-
onKeyDown:
|
|
2678
|
-
disabled:
|
|
2719
|
+
placeholder: v("detail.leaveCommentPlaceholder"),
|
|
2720
|
+
value: x,
|
|
2721
|
+
onChange: (e) => S(e.target.value),
|
|
2722
|
+
onKeyDown: te,
|
|
2723
|
+
disabled: C
|
|
2679
2724
|
}), /* @__PURE__ */ Q(g, {
|
|
2680
2725
|
variant: "default",
|
|
2681
|
-
onClick:
|
|
2682
|
-
disabled: !
|
|
2726
|
+
onClick: I,
|
|
2727
|
+
disabled: !x.trim() || C,
|
|
2683
2728
|
className: "shrink-0 self-end gap-1.5",
|
|
2684
|
-
"aria-label":
|
|
2685
|
-
title:
|
|
2686
|
-
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") })]
|
|
2687
2732
|
})]
|
|
2688
2733
|
}),
|
|
2689
|
-
|
|
2734
|
+
M.length === 0 ? p ? null : /* @__PURE__ */ Z("p", {
|
|
2690
2735
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
2691
|
-
children: h ??
|
|
2736
|
+
children: h ?? v("detail.noActivity")
|
|
2692
2737
|
}) : /* @__PURE__ */ Q("div", {
|
|
2693
2738
|
className: "relative",
|
|
2694
2739
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
2695
2740
|
className: "space-y-4",
|
|
2696
|
-
children:
|
|
2697
|
-
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) ?? [];
|
|
2698
2743
|
return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
|
|
2699
2744
|
className: "flex gap-3 relative",
|
|
2700
2745
|
children: [/* @__PURE__ */ Z("div", {
|
|
@@ -2716,19 +2761,19 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2716
2761
|
}),
|
|
2717
2762
|
e.source && /* @__PURE__ */ Z("span", {
|
|
2718
2763
|
className: "text-xs text-muted-foreground",
|
|
2719
|
-
children:
|
|
2764
|
+
children: v("detail.via", { source: e.source })
|
|
2720
2765
|
}),
|
|
2721
2766
|
/* @__PURE__ */ Z("span", {
|
|
2722
2767
|
className: "text-xs text-muted-foreground",
|
|
2723
|
-
children:
|
|
2768
|
+
children: cn(e.createdAt)
|
|
2724
2769
|
}),
|
|
2725
2770
|
e.edited && /* @__PURE__ */ Z("span", {
|
|
2726
2771
|
className: "text-xs text-muted-foreground italic",
|
|
2727
|
-
children:
|
|
2772
|
+
children: v("detail.edited")
|
|
2728
2773
|
}),
|
|
2729
2774
|
e.pinned && /* @__PURE__ */ Q("span", {
|
|
2730
2775
|
className: "text-xs text-amber-600",
|
|
2731
|
-
children: ["📌 ",
|
|
2776
|
+
children: ["📌 ", v("detail.pinned")]
|
|
2732
2777
|
})
|
|
2733
2778
|
]
|
|
2734
2779
|
}),
|
|
@@ -2738,25 +2783,25 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2738
2783
|
}),
|
|
2739
2784
|
e.type === "field_change" && e.fieldChanges && /* @__PURE__ */ Z("div", {
|
|
2740
2785
|
className: "space-y-1 mt-1",
|
|
2741
|
-
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(
|
|
2786
|
+
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(Qt, { change: e }, t))
|
|
2742
2787
|
}),
|
|
2743
|
-
|
|
2788
|
+
A && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2744
2789
|
className: "mt-1.5",
|
|
2745
|
-
children: /* @__PURE__ */ Z(
|
|
2790
|
+
children: /* @__PURE__ */ Z(en, {
|
|
2746
2791
|
reactions: e.reactions,
|
|
2747
2792
|
onToggleReaction: u ? (t) => u(e.id, t) : void 0
|
|
2748
2793
|
})
|
|
2749
2794
|
}),
|
|
2750
|
-
|
|
2795
|
+
A && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
|
|
2751
2796
|
className: "mt-1.5",
|
|
2752
|
-
children: /* @__PURE__ */ Z(
|
|
2797
|
+
children: /* @__PURE__ */ Z(en, {
|
|
2753
2798
|
reactions: [],
|
|
2754
2799
|
onToggleReaction: (t) => u(e.id, t)
|
|
2755
2800
|
})
|
|
2756
2801
|
})
|
|
2757
2802
|
]
|
|
2758
2803
|
})]
|
|
2759
|
-
}),
|
|
2804
|
+
}), j && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(nn, {
|
|
2760
2805
|
parentItem: e,
|
|
2761
2806
|
replies: r,
|
|
2762
2807
|
onAddReply: l,
|
|
@@ -2770,16 +2815,16 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2770
2815
|
children: /* @__PURE__ */ Q(g, {
|
|
2771
2816
|
variant: "ghost",
|
|
2772
2817
|
size: "sm",
|
|
2773
|
-
onClick:
|
|
2774
|
-
disabled:
|
|
2775
|
-
"aria-label":
|
|
2776
|
-
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")]
|
|
2777
2822
|
})
|
|
2778
2823
|
})
|
|
2779
2824
|
]
|
|
2780
2825
|
})]
|
|
2781
2826
|
});
|
|
2782
|
-
},
|
|
2827
|
+
}, dn = (e) => {
|
|
2783
2828
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2784
2829
|
return {
|
|
2785
2830
|
designer: {
|
|
@@ -2789,18 +2834,18 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2789
2834
|
},
|
|
2790
2835
|
rest: i
|
|
2791
2836
|
};
|
|
2792
|
-
},
|
|
2793
|
-
|
|
2794
|
-
let { designer: r } =
|
|
2837
|
+
}, fn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2838
|
+
Ye();
|
|
2839
|
+
let { designer: r } = dn(n);
|
|
2795
2840
|
return /* @__PURE__ */ Z("div", {
|
|
2796
2841
|
className: t,
|
|
2797
2842
|
...r,
|
|
2798
|
-
children: /* @__PURE__ */ Z(
|
|
2843
|
+
children: /* @__PURE__ */ Z(un, {
|
|
2799
2844
|
items: [],
|
|
2800
2845
|
config: e
|
|
2801
2846
|
})
|
|
2802
2847
|
});
|
|
2803
|
-
},
|
|
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 }) => {
|
|
2804
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);
|
|
2805
2850
|
return h === "right" || h === "left" ? x && v ? /* @__PURE__ */ Z("div", {
|
|
2806
2851
|
className: L("flex items-start pt-4", h === "right" ? "border-l" : "border-r", m),
|
|
@@ -2810,7 +2855,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2810
2855
|
className: "h-8 w-8 mx-1",
|
|
2811
2856
|
onClick: () => S(!1),
|
|
2812
2857
|
"aria-label": b("detail.openDiscussion"),
|
|
2813
|
-
children: /* @__PURE__ */ Z(
|
|
2858
|
+
children: /* @__PURE__ */ Z(ke, { className: "h-4 w-4" })
|
|
2814
2859
|
})
|
|
2815
2860
|
}) : /* @__PURE__ */ Q("div", {
|
|
2816
2861
|
className: L("flex flex-col overflow-hidden", h === "right" ? "border-l" : "border-r", m),
|
|
@@ -2822,7 +2867,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2822
2867
|
className: "flex items-center justify-between px-4 py-3 border-b",
|
|
2823
2868
|
children: [/* @__PURE__ */ Q("div", {
|
|
2824
2869
|
className: "flex items-center gap-2",
|
|
2825
|
-
children: [/* @__PURE__ */ Z(
|
|
2870
|
+
children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2826
2871
|
className: "text-sm font-medium",
|
|
2827
2872
|
children: b("detail.discussion")
|
|
2828
2873
|
})]
|
|
@@ -2836,7 +2881,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2836
2881
|
})]
|
|
2837
2882
|
}), /* @__PURE__ */ Z("div", {
|
|
2838
2883
|
className: "flex-1 overflow-y-auto",
|
|
2839
|
-
children: /* @__PURE__ */ Z(
|
|
2884
|
+
children: /* @__PURE__ */ Z(un, {
|
|
2840
2885
|
items: t,
|
|
2841
2886
|
config: e?.feed,
|
|
2842
2887
|
hasMore: r,
|
|
@@ -2862,21 +2907,21 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2862
2907
|
className: "w-full justify-start gap-2 text-muted-foreground",
|
|
2863
2908
|
onClick: () => S(!1),
|
|
2864
2909
|
"aria-label": b("detail.showDiscussion", { count: t.length }),
|
|
2865
|
-
children: [/* @__PURE__ */ Z(
|
|
2910
|
+
children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: b("detail.showDiscussion", { count: t.length }) })]
|
|
2866
2911
|
}) : /* @__PURE__ */ Q("div", { children: [v && /* @__PURE__ */ Q("div", {
|
|
2867
2912
|
className: "flex items-center justify-between mb-2",
|
|
2868
2913
|
children: [/* @__PURE__ */ Q("div", {
|
|
2869
2914
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
2870
|
-
children: [/* @__PURE__ */ Z(
|
|
2915
|
+
children: [/* @__PURE__ */ Z(J, { className: "h-4 w-4" }), b("detail.discussion")]
|
|
2871
2916
|
}), /* @__PURE__ */ Z(g, {
|
|
2872
2917
|
variant: "ghost",
|
|
2873
2918
|
size: "icon",
|
|
2874
2919
|
className: "h-7 w-7",
|
|
2875
2920
|
onClick: () => S(!0),
|
|
2876
2921
|
"aria-label": b("detail.hideDiscussion"),
|
|
2877
|
-
children: /* @__PURE__ */ Z(
|
|
2922
|
+
children: /* @__PURE__ */ Z(Oe, { className: "h-3.5 w-3.5" })
|
|
2878
2923
|
})]
|
|
2879
|
-
}), /* @__PURE__ */ Z(
|
|
2924
|
+
}), /* @__PURE__ */ Z(un, {
|
|
2880
2925
|
items: t,
|
|
2881
2926
|
config: e?.feed,
|
|
2882
2927
|
hasMore: r,
|
|
@@ -2894,7 +2939,7 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2894
2939
|
emptyLabel: b("detail.noCommentsYet")
|
|
2895
2940
|
})] })
|
|
2896
2941
|
});
|
|
2897
|
-
},
|
|
2942
|
+
}, mn = (e) => {
|
|
2898
2943
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2899
2944
|
return {
|
|
2900
2945
|
designer: {
|
|
@@ -2904,18 +2949,30 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2904
2949
|
},
|
|
2905
2950
|
rest: i
|
|
2906
2951
|
};
|
|
2907
|
-
},
|
|
2908
|
-
|
|
2909
|
-
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
|
+
};
|
|
2910
2964
|
return /* @__PURE__ */ Z("div", {
|
|
2911
2965
|
className: t,
|
|
2912
|
-
...
|
|
2913
|
-
children: /* @__PURE__ */ Z(
|
|
2914
|
-
items: [],
|
|
2915
|
-
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
|
|
2916
2973
|
})
|
|
2917
2974
|
});
|
|
2918
|
-
},
|
|
2975
|
+
}, gn = (e) => {
|
|
2919
2976
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2920
2977
|
return {
|
|
2921
2978
|
designer: {
|
|
@@ -2925,37 +2982,80 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2925
2982
|
},
|
|
2926
2983
|
rest: i
|
|
2927
2984
|
};
|
|
2928
|
-
},
|
|
2929
|
-
let
|
|
2930
|
-
|
|
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", {
|
|
2931
2997
|
className: t,
|
|
2932
|
-
...
|
|
2998
|
+
...o,
|
|
2933
2999
|
children: /* @__PURE__ */ Z("div", {
|
|
2934
3000
|
className: "text-xs text-muted-foreground italic px-3 py-2 border border-dashed rounded",
|
|
2935
3001
|
children: "record:path — no stages configured"
|
|
2936
3002
|
})
|
|
2937
|
-
}) : /* @__PURE__ */ Z("div", {
|
|
2938
|
-
className: L("flex w-full items-stretch gap-1", t),
|
|
2939
|
-
role: "list",
|
|
2940
|
-
"aria-label": e.aria?.label || "Record path",
|
|
2941
|
-
...i,
|
|
2942
|
-
children: a.map((e, t) => {
|
|
2943
|
-
let n = c >= 0 && t < c, r = t === c;
|
|
2944
|
-
return /* @__PURE__ */ Z("div", {
|
|
2945
|
-
role: "listitem",
|
|
2946
|
-
"aria-current": r ? "step" : void 0,
|
|
2947
|
-
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"),
|
|
2948
|
-
children: /* @__PURE__ */ Q("span", {
|
|
2949
|
-
className: "inline-flex items-center gap-1.5",
|
|
2950
|
-
children: [n && /* @__PURE__ */ Z("span", {
|
|
2951
|
-
"aria-hidden": !0,
|
|
2952
|
-
children: "✓"
|
|
2953
|
-
}), e.label]
|
|
2954
|
-
})
|
|
2955
|
-
}, `${e.value}-${t}`);
|
|
2956
|
-
})
|
|
2957
3003
|
});
|
|
2958
|
-
|
|
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) => {
|
|
2959
3059
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2960
3060
|
return {
|
|
2961
3061
|
designer: {
|
|
@@ -2965,8 +3065,8 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
2965
3065
|
},
|
|
2966
3066
|
rest: i
|
|
2967
3067
|
};
|
|
2968
|
-
},
|
|
2969
|
-
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 : [];
|
|
2970
3070
|
if (c.length > 0 && s && !c.every((e) => a.can(s, e))) return /* @__PURE__ */ Z("div", {
|
|
2971
3071
|
className: t,
|
|
2972
3072
|
...i,
|
|
@@ -3016,7 +3116,28 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3016
3116
|
}, t.name || `qa-${n}`);
|
|
3017
3117
|
})
|
|
3018
3118
|
});
|
|
3019
|
-
},
|
|
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([
|
|
3020
3141
|
"id",
|
|
3021
3142
|
"_id",
|
|
3022
3143
|
"__v",
|
|
@@ -3031,15 +3152,15 @@ var sn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3031
3152
|
"owner_id",
|
|
3032
3153
|
"deleted_at",
|
|
3033
3154
|
"is_deleted"
|
|
3034
|
-
]),
|
|
3035
|
-
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 }) {
|
|
3036
3157
|
let { t: g } = $(), _ = `objectui.drawerWidth.${a}`, [v, y] = r.useState(() => {
|
|
3037
3158
|
if (typeof window > "u" || !m) return null;
|
|
3038
3159
|
try {
|
|
3039
3160
|
let e = window.localStorage.getItem(_);
|
|
3040
3161
|
if (e) {
|
|
3041
3162
|
let t = parseInt(e, 10);
|
|
3042
|
-
if (Number.isFinite(t) && t >=
|
|
3163
|
+
if (Number.isFinite(t) && t >= Cn) return t;
|
|
3043
3164
|
}
|
|
3044
3165
|
} catch {}
|
|
3045
3166
|
return null;
|
|
@@ -3061,7 +3182,7 @@ function bn({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
3061
3182
|
let n = (e) => {
|
|
3062
3183
|
let t = S.current;
|
|
3063
3184
|
if (!t) return;
|
|
3064
|
-
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));
|
|
3065
3186
|
y(Math.round(i));
|
|
3066
3187
|
}, r = () => {
|
|
3067
3188
|
S.current, S.current = null, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r);
|
|
@@ -3117,7 +3238,7 @@ function bn({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
3117
3238
|
}),
|
|
3118
3239
|
/* @__PURE__ */ Z("div", {
|
|
3119
3240
|
className: "px-6 pt-6 pb-6",
|
|
3120
|
-
children: /* @__PURE__ */ Z(
|
|
3241
|
+
children: /* @__PURE__ */ Z(Ut, {
|
|
3121
3242
|
dataSource: s,
|
|
3122
3243
|
inlineEdit: !0,
|
|
3123
3244
|
schema: {
|
|
@@ -3160,14 +3281,14 @@ function bn({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
3160
3281
|
})
|
|
3161
3282
|
});
|
|
3162
3283
|
}
|
|
3163
|
-
function
|
|
3284
|
+
function En(e, t) {
|
|
3164
3285
|
if (typeof window > "u") return null;
|
|
3165
3286
|
let n = window.location.pathname, r = `/${e}`, i = n.indexOf(r);
|
|
3166
3287
|
return `${i >= 0 ? n.slice(0, i) : n.replace(/\/$/, "")}/${e}/record/${encodeURIComponent(String(t))}`;
|
|
3167
3288
|
}
|
|
3168
3289
|
//#endregion
|
|
3169
3290
|
//#region src/InlineCreateRelated.tsx
|
|
3170
|
-
var
|
|
3291
|
+
var Dn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
|
|
3171
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(() => {
|
|
3172
3293
|
if (!h.trim()) return S;
|
|
3173
3294
|
let e = h.toLowerCase();
|
|
@@ -3239,11 +3360,11 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3239
3360
|
children: [i && /* @__PURE__ */ Q(M, {
|
|
3240
3361
|
value: "create",
|
|
3241
3362
|
className: "flex-1 gap-1.5",
|
|
3242
|
-
children: [/* @__PURE__ */ Z(
|
|
3363
|
+
children: [/* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5" }), "Create New"]
|
|
3243
3364
|
}), a && /* @__PURE__ */ Q(M, {
|
|
3244
3365
|
value: "link",
|
|
3245
3366
|
className: "flex-1 gap-1.5",
|
|
3246
|
-
children: [/* @__PURE__ */ Z(
|
|
3367
|
+
children: [/* @__PURE__ */ Z(Ce, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
3247
3368
|
})]
|
|
3248
3369
|
}),
|
|
3249
3370
|
i && /* @__PURE__ */ Q(j, {
|
|
@@ -3273,7 +3394,7 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3273
3394
|
onClick: F,
|
|
3274
3395
|
disabled: !te || T,
|
|
3275
3396
|
className: "gap-1.5",
|
|
3276
|
-
children: [T && /* @__PURE__ */ Z(
|
|
3397
|
+
children: [T && /* @__PURE__ */ Z(Te, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
|
|
3277
3398
|
})]
|
|
3278
3399
|
})]
|
|
3279
3400
|
}),
|
|
@@ -3282,7 +3403,7 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3282
3403
|
className: "space-y-3 mt-0",
|
|
3283
3404
|
children: [/* @__PURE__ */ Q("div", {
|
|
3284
3405
|
className: "relative",
|
|
3285
|
-
children: [/* @__PURE__ */ Z(
|
|
3406
|
+
children: [/* @__PURE__ */ Z(Ie, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }), /* @__PURE__ */ Z(w, {
|
|
3286
3407
|
placeholder: `Search ${e}…`,
|
|
3287
3408
|
value: h,
|
|
3288
3409
|
onChange: (e) => N(e.target.value),
|
|
@@ -3292,7 +3413,7 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3292
3413
|
className: "max-h-48 overflow-y-auto space-y-1",
|
|
3293
3414
|
children: D ? /* @__PURE__ */ Q("div", {
|
|
3294
3415
|
className: "flex items-center justify-center py-4 text-sm text-muted-foreground",
|
|
3295
|
-
children: [/* @__PURE__ */ Z(
|
|
3416
|
+
children: [/* @__PURE__ */ Z(Te, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
|
|
3296
3417
|
}) : k.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
3297
3418
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
3298
3419
|
children: h ? "No records found" : "Type to search records"
|
|
@@ -3323,7 +3444,7 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3323
3444
|
},
|
|
3324
3445
|
className: "gap-1.5",
|
|
3325
3446
|
children: [
|
|
3326
|
-
/* @__PURE__ */ Z(
|
|
3447
|
+
/* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5" }),
|
|
3327
3448
|
"New ",
|
|
3328
3449
|
e
|
|
3329
3450
|
]
|
|
@@ -3334,17 +3455,17 @@ var Sn = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
3334
3455
|
f("link"), u(!0);
|
|
3335
3456
|
},
|
|
3336
3457
|
className: "gap-1.5",
|
|
3337
|
-
children: [/* @__PURE__ */ Z(
|
|
3458
|
+
children: [/* @__PURE__ */ Z(Ce, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
3338
3459
|
})]
|
|
3339
3460
|
});
|
|
3340
3461
|
};
|
|
3341
3462
|
//#endregion
|
|
3342
3463
|
//#region src/RichTextCommentInput.tsx
|
|
3343
|
-
function
|
|
3464
|
+
function On(e) {
|
|
3344
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/>");
|
|
3345
3466
|
return t = t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g, (e) => `<ul class="my-1">${e.replace(/<br\/>/g, "")}</ul>`), t;
|
|
3346
3467
|
}
|
|
3347
|
-
var
|
|
3468
|
+
var kn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], placeholder: a, className: o, disabled: s = !1 }) => {
|
|
3348
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(() => {
|
|
3349
3470
|
if (!p) return i;
|
|
3350
3471
|
let e = p.toLowerCase();
|
|
@@ -3416,7 +3537,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3416
3537
|
onClick: x,
|
|
3417
3538
|
disabled: s || l,
|
|
3418
3539
|
title: c("detail.bold"),
|
|
3419
|
-
children: /* @__PURE__ */ Z(
|
|
3540
|
+
children: /* @__PURE__ */ Z(U, { className: "h-3.5 w-3.5" })
|
|
3420
3541
|
}),
|
|
3421
3542
|
/* @__PURE__ */ Z(g, {
|
|
3422
3543
|
variant: "ghost",
|
|
@@ -3425,7 +3546,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3425
3546
|
onClick: S,
|
|
3426
3547
|
disabled: s || l,
|
|
3427
3548
|
title: c("detail.italic"),
|
|
3428
|
-
children: /* @__PURE__ */ Z(
|
|
3549
|
+
children: /* @__PURE__ */ Z(q, { className: "h-3.5 w-3.5" })
|
|
3429
3550
|
}),
|
|
3430
3551
|
/* @__PURE__ */ Z(g, {
|
|
3431
3552
|
variant: "ghost",
|
|
@@ -3434,7 +3555,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3434
3555
|
onClick: C,
|
|
3435
3556
|
disabled: s || l,
|
|
3436
3557
|
title: c("detail.listFormat"),
|
|
3437
|
-
children: /* @__PURE__ */ Z(
|
|
3558
|
+
children: /* @__PURE__ */ Z(we, { className: "h-3.5 w-3.5" })
|
|
3438
3559
|
}),
|
|
3439
3560
|
/* @__PURE__ */ Z(g, {
|
|
3440
3561
|
variant: "ghost",
|
|
@@ -3461,7 +3582,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3461
3582
|
className: "h-7 w-7",
|
|
3462
3583
|
onClick: () => u(!l),
|
|
3463
3584
|
title: c(l ? "detail.edit" : "detail.preview"),
|
|
3464
|
-
children: Z(l ?
|
|
3585
|
+
children: Z(l ? he : G, { className: "h-3.5 w-3.5" })
|
|
3465
3586
|
}),
|
|
3466
3587
|
r && /* @__PURE__ */ Z(g, {
|
|
3467
3588
|
variant: "ghost",
|
|
@@ -3470,15 +3591,15 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3470
3591
|
onClick: r,
|
|
3471
3592
|
disabled: s || !e.trim(),
|
|
3472
3593
|
title: c("detail.submitComment"),
|
|
3473
|
-
children: /* @__PURE__ */ Z(
|
|
3594
|
+
children: /* @__PURE__ */ Z(X, { className: "h-3.5 w-3.5" })
|
|
3474
3595
|
})
|
|
3475
3596
|
]
|
|
3476
3597
|
}), /* @__PURE__ */ Z("div", {
|
|
3477
3598
|
className: "relative",
|
|
3478
3599
|
children: l ? /* @__PURE__ */ Z("div", {
|
|
3479
3600
|
className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
|
|
3480
|
-
dangerouslySetInnerHTML: { __html:
|
|
3481
|
-
}) : /* @__PURE__ */ Q(
|
|
3601
|
+
dangerouslySetInnerHTML: { __html: On(e) }
|
|
3602
|
+
}) : /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z("textarea", {
|
|
3482
3603
|
ref: v,
|
|
3483
3604
|
className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
|
|
3484
3605
|
placeholder: a ?? c("detail.writeComment"),
|
|
@@ -3509,7 +3630,7 @@ var wn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3509
3630
|
};
|
|
3510
3631
|
//#endregion
|
|
3511
3632
|
//#region src/DiffView.tsx
|
|
3512
|
-
function
|
|
3633
|
+
function An(e, t) {
|
|
3513
3634
|
if (e == null) return ["(empty)"];
|
|
3514
3635
|
switch (t) {
|
|
3515
3636
|
case "json": try {
|
|
@@ -3528,7 +3649,7 @@ function Tn(e, t) {
|
|
|
3528
3649
|
default: return String(e).split("\n");
|
|
3529
3650
|
}
|
|
3530
3651
|
}
|
|
3531
|
-
function
|
|
3652
|
+
function jn(e, t) {
|
|
3532
3653
|
let n = [], r = Math.max(e.length, t.length);
|
|
3533
3654
|
for (let i = 0; i < r; i++) {
|
|
3534
3655
|
let r = i < e.length ? e[i] : void 0, a = i < t.length ? t[i] : void 0;
|
|
@@ -3545,16 +3666,16 @@ function En(e, t) {
|
|
|
3545
3666
|
}
|
|
3546
3667
|
return n;
|
|
3547
3668
|
}
|
|
3548
|
-
var
|
|
3669
|
+
var Mn = {
|
|
3549
3670
|
added: "bg-green-50 text-green-800 dark:bg-green-950/30 dark:text-green-300",
|
|
3550
3671
|
removed: "bg-red-50 text-red-800 dark:bg-red-950/30 dark:text-red-300",
|
|
3551
3672
|
unchanged: "text-muted-foreground"
|
|
3552
|
-
},
|
|
3673
|
+
}, Nn = {
|
|
3553
3674
|
added: "+",
|
|
3554
3675
|
removed: "-",
|
|
3555
3676
|
unchanged: " "
|
|
3556
|
-
},
|
|
3557
|
-
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(() => {
|
|
3558
3679
|
if (c !== "side-by-side") return [];
|
|
3559
3680
|
let e = [], t = 0;
|
|
3560
3681
|
for (; t < f.length;) {
|
|
@@ -3596,14 +3717,14 @@ var Dn = {
|
|
|
3596
3717
|
className: "h-7 w-7",
|
|
3597
3718
|
onClick: () => l("unified"),
|
|
3598
3719
|
title: s("detail.unifiedDiff"),
|
|
3599
|
-
children: /* @__PURE__ */ Z(
|
|
3720
|
+
children: /* @__PURE__ */ Z(Fe, { className: "h-3.5 w-3.5" })
|
|
3600
3721
|
}), /* @__PURE__ */ Z(g, {
|
|
3601
3722
|
variant: c === "side-by-side" ? "secondary" : "ghost",
|
|
3602
3723
|
size: "icon",
|
|
3603
3724
|
className: "h-7 w-7",
|
|
3604
3725
|
onClick: () => l("side-by-side"),
|
|
3605
3726
|
title: s("detail.sideBySideDiff"),
|
|
3606
|
-
children: /* @__PURE__ */ Z(
|
|
3727
|
+
children: /* @__PURE__ */ Z(pe, { className: "h-3.5 w-3.5" })
|
|
3607
3728
|
})]
|
|
3608
3729
|
})]
|
|
3609
3730
|
})
|
|
@@ -3612,10 +3733,10 @@ var Dn = {
|
|
|
3612
3733
|
children: p ? c === "unified" ? /* @__PURE__ */ Z("div", {
|
|
3613
3734
|
className: "font-mono text-xs overflow-x-auto",
|
|
3614
3735
|
children: f.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
3615
|
-
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"),
|
|
3616
3737
|
children: [/* @__PURE__ */ Z("span", {
|
|
3617
3738
|
className: "select-none mr-2 inline-block w-3 text-center opacity-60",
|
|
3618
|
-
children:
|
|
3739
|
+
children: Nn[e.type]
|
|
3619
3740
|
}), e.value]
|
|
3620
3741
|
}, t))
|
|
3621
3742
|
}) : /* @__PURE__ */ Z("div", {
|
|
@@ -3632,10 +3753,10 @@ var Dn = {
|
|
|
3632
3753
|
children: s("detail.currentVersion")
|
|
3633
3754
|
}),
|
|
3634
3755
|
m.map((e, t) => /* @__PURE__ */ Q(n.Fragment, { children: [/* @__PURE__ */ Z("div", {
|
|
3635
|
-
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"),
|
|
3636
3757
|
children: e.left?.value ?? ""
|
|
3637
3758
|
}), /* @__PURE__ */ Z("div", {
|
|
3638
|
-
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"),
|
|
3639
3760
|
children: e.right?.value ?? ""
|
|
3640
3761
|
})] }, t))
|
|
3641
3762
|
]
|
|
@@ -3646,7 +3767,7 @@ var Dn = {
|
|
|
3646
3767
|
})
|
|
3647
3768
|
})]
|
|
3648
3769
|
});
|
|
3649
|
-
},
|
|
3770
|
+
}, Fn = ({ currentIndex: e, totalRecords: t, recordIds: r, onNavigate: i, onSearch: a, className: o }) => {
|
|
3650
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(() => {
|
|
3651
3772
|
p && i(r[0]);
|
|
3652
3773
|
}, [
|
|
@@ -3759,13 +3880,13 @@ var Dn = {
|
|
|
3759
3880
|
title: s("detail.lastRecord"),
|
|
3760
3881
|
children: /* @__PURE__ */ Z(de, { className: "h-4 w-4" })
|
|
3761
3882
|
}),
|
|
3762
|
-
a && /* @__PURE__ */ Q(
|
|
3883
|
+
a && /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z(g, {
|
|
3763
3884
|
variant: u ? "secondary" : "ghost",
|
|
3764
3885
|
size: "icon",
|
|
3765
3886
|
className: "h-8 w-8",
|
|
3766
3887
|
onClick: C,
|
|
3767
3888
|
title: s("detail.searchWhileNavigating"),
|
|
3768
|
-
children: /* @__PURE__ */ Z(
|
|
3889
|
+
children: /* @__PURE__ */ Z(Ie, { className: "h-4 w-4" })
|
|
3769
3890
|
}), u && /* @__PURE__ */ Z("div", {
|
|
3770
3891
|
className: "relative",
|
|
3771
3892
|
children: /* @__PURE__ */ Z(w, {
|
|
@@ -3779,18 +3900,18 @@ var Dn = {
|
|
|
3779
3900
|
})] })
|
|
3780
3901
|
]
|
|
3781
3902
|
});
|
|
3782
|
-
},
|
|
3903
|
+
}, In = 28, Ln = [
|
|
3783
3904
|
"fill-primary stroke-primary",
|
|
3784
3905
|
"fill-blue-500 stroke-blue-500",
|
|
3785
3906
|
"fill-emerald-500 stroke-emerald-500",
|
|
3786
3907
|
"fill-amber-500 stroke-amber-500"
|
|
3787
|
-
],
|
|
3908
|
+
], Rn = [
|
|
3788
3909
|
"fill-primary-foreground",
|
|
3789
3910
|
"fill-white",
|
|
3790
3911
|
"fill-white",
|
|
3791
3912
|
"fill-white"
|
|
3792
3913
|
];
|
|
3793
|
-
function
|
|
3914
|
+
function zn(e, t, n, r, i) {
|
|
3794
3915
|
let a = [], o = [], s = /* @__PURE__ */ new Set(), c = r / 2, l = i / 2;
|
|
3795
3916
|
a.push({
|
|
3796
3917
|
id: e.id,
|
|
@@ -3854,10 +3975,10 @@ function Pn(e, t, n, r, i) {
|
|
|
3854
3975
|
edges: o
|
|
3855
3976
|
};
|
|
3856
3977
|
}
|
|
3857
|
-
function
|
|
3978
|
+
function Bn(e, t = 6) {
|
|
3858
3979
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
3859
3980
|
}
|
|
3860
|
-
var
|
|
3981
|
+
var Vn = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, className: a }) => {
|
|
3861
3982
|
let o = n.useRef(null), [s, c] = n.useState({
|
|
3862
3983
|
width: 500,
|
|
3863
3984
|
height: 400
|
|
@@ -3878,7 +3999,7 @@ var In = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
3878
3999
|
});
|
|
3879
4000
|
return n.observe(t), () => n.disconnect();
|
|
3880
4001
|
}, []);
|
|
3881
|
-
let { nodes: d, edges: f } = n.useMemo(() =>
|
|
4002
|
+
let { nodes: d, edges: f } = n.useMemo(() => zn(e, t, r, s.width, s.height), [
|
|
3882
4003
|
e,
|
|
3883
4004
|
t,
|
|
3884
4005
|
r,
|
|
@@ -3891,7 +4012,7 @@ var In = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
3891
4012
|
children: /* @__PURE__ */ Q(b, {
|
|
3892
4013
|
className: "flex items-center gap-2 text-base",
|
|
3893
4014
|
children: [
|
|
3894
|
-
/* @__PURE__ */ Z(
|
|
4015
|
+
/* @__PURE__ */ Z(De, { className: "h-4 w-4" }),
|
|
3895
4016
|
"Relationships",
|
|
3896
4017
|
/* @__PURE__ */ Q("span", {
|
|
3897
4018
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -3920,7 +4041,7 @@ var In = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
3920
4041
|
strokeWidth: 1.5,
|
|
3921
4042
|
strokeOpacity: .5
|
|
3922
4043
|
}, `edge-${t}`)), d.map((e) => {
|
|
3923
|
-
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;
|
|
3924
4045
|
return /* @__PURE__ */ Q("g", {
|
|
3925
4046
|
className: L("cursor-pointer transition-transform", i && "hover:opacity-80"),
|
|
3926
4047
|
onClick: () => i?.(e.id),
|
|
@@ -3942,7 +4063,7 @@ var In = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
3942
4063
|
textAnchor: "middle",
|
|
3943
4064
|
dominantBaseline: "central",
|
|
3944
4065
|
className: L("text-[10px] font-medium pointer-events-none", r),
|
|
3945
|
-
children:
|
|
4066
|
+
children: Bn(e.label)
|
|
3946
4067
|
}),
|
|
3947
4068
|
e.type && /* @__PURE__ */ Z("text", {
|
|
3948
4069
|
x: e.x,
|
|
@@ -3951,7 +4072,7 @@ var In = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
3951
4072
|
className: "fill-muted-foreground text-[9px] pointer-events-none",
|
|
3952
4073
|
children: e.type
|
|
3953
4074
|
}),
|
|
3954
|
-
t && /* @__PURE__ */ Q(
|
|
4075
|
+
t && /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Z("rect", {
|
|
3955
4076
|
x: e.x - 50,
|
|
3956
4077
|
y: e.y - a - 28,
|
|
3957
4078
|
width: 100,
|
|
@@ -3976,16 +4097,16 @@ var In = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
3976
4097
|
};
|
|
3977
4098
|
//#endregion
|
|
3978
4099
|
//#region src/CommentAttachment.tsx
|
|
3979
|
-
function
|
|
4100
|
+
function Hn(e) {
|
|
3980
4101
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
3981
4102
|
}
|
|
3982
|
-
function
|
|
4103
|
+
function Un(e) {
|
|
3983
4104
|
return e.startsWith("image/");
|
|
3984
4105
|
}
|
|
3985
|
-
function
|
|
3986
|
-
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;
|
|
3987
4108
|
}
|
|
3988
|
-
var
|
|
4109
|
+
var Gn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a = !1 }) => {
|
|
3989
4110
|
let { t: o } = $(), [s, c] = n.useState(!1), l = n.useRef(null), u = n.useCallback((e) => {
|
|
3990
4111
|
e.preventDefault(), e.stopPropagation(), c(!0);
|
|
3991
4112
|
}, []), d = n.useCallback((e) => {
|
|
@@ -4026,11 +4147,11 @@ var Bn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
4026
4147
|
className: "space-y-1.5",
|
|
4027
4148
|
children: [/* @__PURE__ */ Q("div", {
|
|
4028
4149
|
className: "flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
4029
|
-
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 }) })]
|
|
4030
4151
|
}), /* @__PURE__ */ Z("div", {
|
|
4031
4152
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
|
|
4032
4153
|
children: e.map((e) => {
|
|
4033
|
-
let t =
|
|
4154
|
+
let t = Un(e.type), n = Wn(e.type);
|
|
4034
4155
|
return /* @__PURE__ */ Q("div", {
|
|
4035
4156
|
className: "flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group",
|
|
4036
4157
|
children: [
|
|
@@ -4049,7 +4170,7 @@ var Bn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
4049
4170
|
children: e.name
|
|
4050
4171
|
}), /* @__PURE__ */ Z("p", {
|
|
4051
4172
|
className: "text-[10px] text-muted-foreground",
|
|
4052
|
-
children:
|
|
4173
|
+
children: Hn(e.size)
|
|
4053
4174
|
})]
|
|
4054
4175
|
}),
|
|
4055
4176
|
r && !a && /* @__PURE__ */ Z(g, {
|
|
@@ -4069,7 +4190,7 @@ var Bn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
4069
4190
|
};
|
|
4070
4191
|
//#endregion
|
|
4071
4192
|
//#region src/PointInTimeRestore.tsx
|
|
4072
|
-
function
|
|
4193
|
+
function Kn(e) {
|
|
4073
4194
|
try {
|
|
4074
4195
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
4075
4196
|
if (r < 1) return "just now";
|
|
@@ -4080,7 +4201,7 @@ function Vn(e) {
|
|
|
4080
4201
|
return e;
|
|
4081
4202
|
}
|
|
4082
4203
|
}
|
|
4083
|
-
var
|
|
4204
|
+
var qn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
4084
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 () => {
|
|
4085
4206
|
if (!(!d || !r)) {
|
|
4086
4207
|
if (!s) {
|
|
@@ -4109,7 +4230,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4109
4230
|
children: /* @__PURE__ */ Q(b, {
|
|
4110
4231
|
className: "flex items-center gap-2 text-base",
|
|
4111
4232
|
children: [
|
|
4112
|
-
/* @__PURE__ */ Z(
|
|
4233
|
+
/* @__PURE__ */ Z(be, { className: "h-4 w-4" }),
|
|
4113
4234
|
"Revision History",
|
|
4114
4235
|
/* @__PURE__ */ Q("span", {
|
|
4115
4236
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -4152,7 +4273,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4152
4273
|
children: e.user
|
|
4153
4274
|
}), /* @__PURE__ */ Z("span", {
|
|
4154
4275
|
className: "text-xs text-muted-foreground",
|
|
4155
|
-
children:
|
|
4276
|
+
children: Kn(e.timestamp)
|
|
4156
4277
|
})]
|
|
4157
4278
|
}), /* @__PURE__ */ Q("p", {
|
|
4158
4279
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
@@ -4174,7 +4295,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4174
4295
|
children: [
|
|
4175
4296
|
/* @__PURE__ */ Q("div", {
|
|
4176
4297
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
4177
|
-
children: [/* @__PURE__ */ Z(
|
|
4298
|
+
children: [/* @__PURE__ */ Z(G, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
|
|
4178
4299
|
}),
|
|
4179
4300
|
/* @__PURE__ */ Z("div", {
|
|
4180
4301
|
className: "space-y-2",
|
|
@@ -4220,12 +4341,12 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4220
4341
|
}),
|
|
4221
4342
|
r && /* @__PURE__ */ Z("div", {
|
|
4222
4343
|
className: "pt-1 space-y-2",
|
|
4223
|
-
children: s ? /* @__PURE__ */ Q(
|
|
4344
|
+
children: s ? /* @__PURE__ */ Q(nt, { children: [/* @__PURE__ */ Q("p", {
|
|
4224
4345
|
className: "text-xs text-amber-600 dark:text-amber-400",
|
|
4225
4346
|
children: [
|
|
4226
4347
|
"This will restore the record to its state at",
|
|
4227
4348
|
" ",
|
|
4228
|
-
|
|
4349
|
+
Kn(d.timestamp),
|
|
4229
4350
|
". Continue?"
|
|
4230
4351
|
]
|
|
4231
4352
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -4236,7 +4357,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4236
4357
|
className: "gap-1.5 flex-1",
|
|
4237
4358
|
onClick: f,
|
|
4238
4359
|
disabled: l,
|
|
4239
|
-
children: [/* @__PURE__ */ Z(
|
|
4360
|
+
children: [/* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" }), l ? "Restoring…" : "Confirm Restore"]
|
|
4240
4361
|
}), /* @__PURE__ */ Z(g, {
|
|
4241
4362
|
variant: "ghost",
|
|
4242
4363
|
size: "sm",
|
|
@@ -4249,14 +4370,14 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4249
4370
|
size: "sm",
|
|
4250
4371
|
className: "w-full gap-1.5",
|
|
4251
4372
|
onClick: f,
|
|
4252
|
-
children: [/* @__PURE__ */ Z(
|
|
4373
|
+
children: [/* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" }), "Restore to this point"]
|
|
4253
4374
|
})
|
|
4254
4375
|
})
|
|
4255
4376
|
]
|
|
4256
4377
|
})]
|
|
4257
4378
|
}) })]
|
|
4258
4379
|
});
|
|
4259
|
-
},
|
|
4380
|
+
}, Jn = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: r = !1, className: i }) => {
|
|
4260
4381
|
let [a, o] = n.useState(""), [s, c] = n.useState(!1), l = n.useCallback(async () => {
|
|
4261
4382
|
let t = a.trim();
|
|
4262
4383
|
if (t) {
|
|
@@ -4286,10 +4407,10 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4286
4407
|
disabled: !a.trim() || s || r,
|
|
4287
4408
|
className: "shrink-0 self-end",
|
|
4288
4409
|
"aria-label": "Submit comment",
|
|
4289
|
-
children: /* @__PURE__ */ Z(
|
|
4410
|
+
children: /* @__PURE__ */ Z(X, { className: "h-4 w-4" })
|
|
4290
4411
|
})]
|
|
4291
4412
|
});
|
|
4292
|
-
},
|
|
4413
|
+
}, Yn = ({ query: e, suggestions: t, onSelect: r, visible: i = !0, activeIndex: a = 0, className: o }) => {
|
|
4293
4414
|
let s = n.useMemo(() => {
|
|
4294
4415
|
if (!e) return t;
|
|
4295
4416
|
let n = e.toLowerCase();
|
|
@@ -4331,7 +4452,7 @@ var Hn = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
4331
4452
|
}, e.id))
|
|
4332
4453
|
});
|
|
4333
4454
|
};
|
|
4334
|
-
function
|
|
4455
|
+
function Xn(e, t, n) {
|
|
4335
4456
|
return {
|
|
4336
4457
|
type: e.type,
|
|
4337
4458
|
id: e.id,
|
|
@@ -4340,7 +4461,188 @@ function Gn(e, t, n) {
|
|
|
4340
4461
|
length: n
|
|
4341
4462
|
};
|
|
4342
4463
|
}
|
|
4343
|
-
|
|
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, {
|
|
4344
4646
|
namespace: "plugin-detail",
|
|
4345
4647
|
label: "Detail View",
|
|
4346
4648
|
category: "Views",
|
|
@@ -4470,7 +4772,7 @@ e.register("detail-view", Bt, {
|
|
|
4470
4772
|
tabs: [],
|
|
4471
4773
|
related: []
|
|
4472
4774
|
}
|
|
4473
|
-
}), e.register("detail-section",
|
|
4775
|
+
}), e.register("detail-section", pt, {
|
|
4474
4776
|
namespace: "plugin-detail",
|
|
4475
4777
|
label: "Detail Section",
|
|
4476
4778
|
category: "Detail Components",
|
|
@@ -4521,7 +4823,7 @@ e.register("detail-view", Bt, {
|
|
|
4521
4823
|
label: "Header Color"
|
|
4522
4824
|
}
|
|
4523
4825
|
]
|
|
4524
|
-
}), e.register("related-list",
|
|
4826
|
+
}), e.register("related-list", gt, {
|
|
4525
4827
|
namespace: "plugin-detail",
|
|
4526
4828
|
label: "Related List",
|
|
4527
4829
|
category: "Detail Components",
|
|
@@ -4568,7 +4870,7 @@ e.register("detail-view", Bt, {
|
|
|
4568
4870
|
label: "Columns"
|
|
4569
4871
|
}
|
|
4570
4872
|
]
|
|
4571
|
-
}), e.register("detail",
|
|
4873
|
+
}), e.register("detail", Ut, {
|
|
4572
4874
|
namespace: "view",
|
|
4573
4875
|
category: "view",
|
|
4574
4876
|
label: "Detail",
|
|
@@ -4591,41 +4893,51 @@ e.register("detail-view", Bt, {
|
|
|
4591
4893
|
label: "Fields"
|
|
4592
4894
|
}
|
|
4593
4895
|
]
|
|
4594
|
-
}), e.register("record:details",
|
|
4896
|
+
}), e.register("record:details", Kt, {
|
|
4595
4897
|
namespace: "record",
|
|
4596
4898
|
category: "record",
|
|
4597
4899
|
label: "Record Details",
|
|
4598
4900
|
icon: "FileText"
|
|
4599
|
-
}), e.register("record:related_list",
|
|
4901
|
+
}), e.register("record:related_list", Yt, {
|
|
4600
4902
|
namespace: "record",
|
|
4601
4903
|
category: "record",
|
|
4602
4904
|
label: "Related List",
|
|
4603
4905
|
icon: "List"
|
|
4604
|
-
}), e.register("record:highlights",
|
|
4906
|
+
}), e.register("record:highlights", Zt, {
|
|
4605
4907
|
namespace: "record",
|
|
4606
4908
|
category: "record",
|
|
4607
4909
|
label: "Highlights Panel",
|
|
4608
4910
|
icon: "Star"
|
|
4609
|
-
}), e.register("record:activity",
|
|
4911
|
+
}), e.register("record:activity", fn, {
|
|
4610
4912
|
namespace: "record",
|
|
4611
4913
|
category: "record",
|
|
4612
4914
|
label: "Activity Timeline",
|
|
4613
4915
|
icon: "Activity"
|
|
4614
|
-
}), e.register("record:chatter",
|
|
4916
|
+
}), e.register("record:chatter", hn, {
|
|
4615
4917
|
namespace: "record",
|
|
4616
4918
|
category: "record",
|
|
4617
4919
|
label: "Chatter Feed",
|
|
4618
4920
|
icon: "MessageSquare"
|
|
4619
|
-
}), 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, {
|
|
4620
4927
|
namespace: "record",
|
|
4621
4928
|
category: "record",
|
|
4622
4929
|
label: "Path / Stepper",
|
|
4623
4930
|
icon: "GitBranch"
|
|
4624
|
-
}), e.register("record:quick_actions",
|
|
4931
|
+
}), e.register("record:quick_actions", yn, {
|
|
4625
4932
|
namespace: "record",
|
|
4626
4933
|
category: "record",
|
|
4627
4934
|
label: "Quick Actions",
|
|
4628
4935
|
icon: "Zap"
|
|
4936
|
+
}), e.register("record:history", xn, {
|
|
4937
|
+
namespace: "record",
|
|
4938
|
+
category: "record",
|
|
4939
|
+
label: "History Timeline",
|
|
4940
|
+
icon: "Clock"
|
|
4629
4941
|
});
|
|
4630
4942
|
//#endregion
|
|
4631
|
-
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 };
|