@object-ui/plugin-detail 7.1.0 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/DetailSection.d.ts +2 -0
- package/dist/DetailSection.d.ts.map +1 -1
- package/dist/DetailView.d.ts.map +1 -1
- package/dist/RelatedList.d.ts +19 -0
- package/dist/RelatedList.d.ts.map +1 -1
- package/dist/SectionGroup.d.ts +2 -0
- package/dist/SectionGroup.d.ts.map +1 -1
- package/dist/index.js +710 -619
- package/dist/index.umd.cjs +3 -3
- package/dist/renderers/record-related-list.d.ts.map +1 -1
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ComponentRegistry as e, buildExpandFields as t } from "@object-ui/core";
|
|
2
2
|
import * as n from "react";
|
|
3
3
|
import r from "react";
|
|
4
|
-
import { Alert as i, AlertDescription as a, AlertDialog as o, AlertDialogAction as s, AlertDialogCancel as c, AlertDialogContent as l, AlertDialogDescription as u, AlertDialogFooter as d, AlertDialogHeader as f, AlertDialogTitle as p, AlertTitle as m, Avatar as h, AvatarFallback as g, AvatarImage as _, Badge as v, Button as y, Card as b, CardContent as x, CardHeader as S, CardTitle as C, Collapsible as w, CollapsibleContent as T, CollapsibleTrigger as E, DataEmptyState as D, Input as O, LazyIcon as k, Select as A, SelectContent as j, SelectItem as M, SelectTrigger as N, SelectValue as ee, Sheet as P, SheetContent as
|
|
5
|
-
import { Activity as oe, AlertTriangle as G, ArrowLeft as se, ArrowRight as ce, ArrowRightLeft as
|
|
4
|
+
import { Alert as i, AlertDescription as a, AlertDialog as o, AlertDialogAction as s, AlertDialogCancel as c, AlertDialogContent as l, AlertDialogDescription as u, AlertDialogFooter as d, AlertDialogHeader as f, AlertDialogTitle as p, AlertTitle as m, Avatar as h, AvatarFallback as g, AvatarImage as _, Badge as v, Button as y, Card as b, CardContent as x, CardHeader as S, CardTitle as C, Collapsible as w, CollapsibleContent as T, CollapsibleTrigger as E, DataEmptyState as D, Input as O, LazyIcon as k, Select as A, SelectContent as j, SelectItem as M, SelectTrigger as N, SelectValue as ee, Sheet as P, SheetContent as te, SheetHeader as F, SheetTitle as I, Skeleton as L, Tabs as ne, TabsContent as re, TabsList as R, TabsTrigger as z, Tooltip as B, TooltipContent as V, TooltipProvider as ie, TooltipTrigger as H, buttonVariants as U, cn as W, useIsMobile as ae } from "@object-ui/components";
|
|
5
|
+
import { Activity as oe, AlertTriangle as G, ArrowLeft as se, ArrowRight as ce, ArrowRightLeft as le, ArrowUpDown as ue, AtSign as K, Bell as q, BellOff as de, Bold as fe, Calendar as pe, Check as me, CheckSquare as he, ChevronDown as ge, ChevronLeft as _e, ChevronRight as ve, ChevronsLeft as ye, ChevronsRight as be, Code as xe, Columns2 as Se, Copy as Ce, Edit as we, ExternalLink as Te, Eye as Ee, EyeOff as J, File as De, FileArchive as Oe, FileText as ke, History as Y, Image as Ae, Inbox as je, Italic as Me, Link as Ne, List as Pe, Loader2 as Fe, Lock as Ie, Mail as Le, MessageSquare as X, Network as Re, PanelRightClose as ze, PanelRightOpen as Be, Paperclip as Ve, Phone as He, Pin as Ue, Plus as We, PlusCircle as Ge, RotateCcw as Ke, Rows3 as qe, Search as Je, Send as Ye, SmilePlus as Xe, Star as Ze, Trash2 as Qe, Upload as $e, X as et, Zap as tt, icons as nt } from "lucide-react";
|
|
6
6
|
import { SchemaRenderer as rt, toPredicateInput as it, useActionEngine as at, useCondition as ot, useDiscussionContext as st, useHighlightFieldNames as ct, useMetadataItem as lt, useObjectTranslation as ut, useRecordContext as dt, useRegisterHighlightFields as ft, useSafeFieldLabel as pt } from "@object-ui/react";
|
|
7
|
-
import { BooleanField as mt,
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { useFieldPermissions as
|
|
10
|
-
import { resolveFieldCurrency as
|
|
11
|
-
import { Link as
|
|
7
|
+
import { BooleanField as mt, LookupField as ht, RecordPickerDialog as gt, SelectField as _t, UserField as vt, coerceToSafeValue as yt, getCellRenderer as bt, humanizeLabel as xt, resolveCellRendererType as St } from "@object-ui/fields";
|
|
8
|
+
import { Fragment as Ct, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
9
|
+
import { useFieldPermissions as wt, usePermissions as Tt } from "@object-ui/permissions";
|
|
10
|
+
import { resolveFieldCurrency as Et, useLocalization as Dt } from "@object-ui/i18n";
|
|
11
|
+
import { Link as Ot, useParams as kt } from "react-router-dom";
|
|
12
12
|
//#region src/autoLayout.ts
|
|
13
|
-
var
|
|
13
|
+
var At = new Set([
|
|
14
14
|
"textarea",
|
|
15
15
|
"markdown",
|
|
16
16
|
"html",
|
|
@@ -22,33 +22,33 @@ var Et = new Set([
|
|
|
22
22
|
"field:grid",
|
|
23
23
|
"field:rich-text"
|
|
24
24
|
]);
|
|
25
|
-
function
|
|
26
|
-
return
|
|
25
|
+
function jt(e) {
|
|
26
|
+
return At.has(e);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function Mt(e, t) {
|
|
29
29
|
let n;
|
|
30
30
|
return n = e <= 3 ? 1 : 2, t !== void 0 && t < 640 ? Math.min(n, 1) : n;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type &&
|
|
32
|
+
function Nt(e, t) {
|
|
33
|
+
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && jt(e.type) ? {
|
|
34
34
|
...e,
|
|
35
35
|
span: t
|
|
36
36
|
} : e);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function Pt(e, t, n) {
|
|
39
39
|
if (t !== void 0) return {
|
|
40
|
-
fields:
|
|
40
|
+
fields: Nt(e, t),
|
|
41
41
|
columns: t
|
|
42
42
|
};
|
|
43
|
-
let r =
|
|
43
|
+
let r = Mt(e.length, n);
|
|
44
44
|
return {
|
|
45
|
-
fields:
|
|
45
|
+
fields: Nt(e, r),
|
|
46
46
|
columns: r
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/useDetailTranslation.ts
|
|
51
|
-
function
|
|
51
|
+
function Ft(e, t) {
|
|
52
52
|
return function() {
|
|
53
53
|
try {
|
|
54
54
|
let n = ut();
|
|
@@ -66,7 +66,7 @@ function jt(e, t) {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
var
|
|
69
|
+
var It = {
|
|
70
70
|
"detail.back": "Back",
|
|
71
71
|
"detail.edit": "Edit",
|
|
72
72
|
"detail.editInline": "Edit",
|
|
@@ -192,24 +192,39 @@ var Mt = {
|
|
|
192
192
|
"detail.concurrentUpdateReload": "Reload latest",
|
|
193
193
|
"detail.concurrentUpdateOverwrite": "Overwrite anyway",
|
|
194
194
|
"detail.concurrentUpdateCancel": "Cancel"
|
|
195
|
-
}, $ =
|
|
195
|
+
}, $ = Ft(It, "detail.back");
|
|
196
196
|
//#endregion
|
|
197
197
|
//#region src/DetailSection.tsx
|
|
198
|
-
function
|
|
198
|
+
function Lt(e, t) {
|
|
199
199
|
return !e || e <= 1 || t <= 1 ? "" : t === 2 ? e >= 2 ? "md:col-span-2" : "" : e === 2 ? "md:col-span-2" : e >= 3 ? "md:col-span-2 lg:col-span-3" : "";
|
|
200
200
|
}
|
|
201
|
-
var
|
|
202
|
-
|
|
201
|
+
var Rt = new Set([
|
|
202
|
+
"formula",
|
|
203
|
+
"summary",
|
|
204
|
+
"rollup",
|
|
205
|
+
"auto_number"
|
|
206
|
+
]);
|
|
207
|
+
function zt(e) {
|
|
208
|
+
if (e == null) return e;
|
|
209
|
+
if (Array.isArray(e)) return e.map(zt);
|
|
210
|
+
if (typeof e == "object") {
|
|
211
|
+
let t = e;
|
|
212
|
+
return t.id ?? t._id ?? t.value ?? "";
|
|
213
|
+
}
|
|
214
|
+
return e;
|
|
215
|
+
}
|
|
216
|
+
var Bt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s, dataSource: c, virtualScroll: l }) => {
|
|
217
|
+
let [u, d] = n.useState(e.defaultCollapsed ?? !1), [f, p] = n.useState(null), [m, h] = n.useState(void 0), [g, _] = n.useState(!1), { t: v } = $(), { fieldLabel: D, translateOptions: O } = pt(), k = n.useCallback((e, t) => {
|
|
203
218
|
let n = t == null ? "" : String(t);
|
|
204
219
|
navigator.clipboard.writeText(n).then(() => {
|
|
205
|
-
|
|
220
|
+
p(e), setTimeout(() => p(null), 2e3);
|
|
206
221
|
});
|
|
207
|
-
}, []),
|
|
222
|
+
}, []), A = n.useCallback((e) => {
|
|
208
223
|
let n = t?.[e.name] ?? e.value;
|
|
209
224
|
return n == null || n === "";
|
|
210
|
-
}, [t]),
|
|
211
|
-
if (F.length === 0 &&
|
|
212
|
-
let { fields: I, columns:
|
|
225
|
+
}, [t]), j = n.useMemo(() => e.fields.filter(A).length, [e.fields, A]), M = ae(), N = M ? 3 : 4, ee = M ? .2 : .25, P = e.fields.length - j, te = !e.hideEmpty && !o && e.fields.length >= N && j / e.fields.length >= ee && P > 0, F = !g && (e.hideEmpty || te) ? e.fields.filter((e) => !A(e)) : e.fields;
|
|
226
|
+
if (F.length === 0 && j === e.fields.length) return null;
|
|
227
|
+
let { fields: I, columns: L } = Pt(F, e.columns), ne = (e) => {
|
|
213
228
|
let n = t?.[e.name] ?? e.value;
|
|
214
229
|
if (e.render) return /* @__PURE__ */ Z(rt, {
|
|
215
230
|
schema: e.render,
|
|
@@ -218,77 +233,84 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
218
233
|
value: n
|
|
219
234
|
}
|
|
220
235
|
});
|
|
221
|
-
let r =
|
|
222
|
-
if (
|
|
223
|
-
!e.type &&
|
|
224
|
-
let t =
|
|
225
|
-
t && !
|
|
236
|
+
let r = Lt(e.span, L), l = i?.fields?.[e.name], u = { ...e };
|
|
237
|
+
if (l) {
|
|
238
|
+
!e.type && l.type && (u.type = l.type), l.options && !u.options && (u.options = l.options), l.currency && !u.currency && (u.currency = l.currency), l.precision !== void 0 && u.precision === void 0 && (u.precision = l.precision), l.format && !u.format && (u.format = l.format);
|
|
239
|
+
let t = l.reference_to || l.reference;
|
|
240
|
+
t && !u.reference_to && (u.reference_to = t), l.reference_field && !u.reference_field && (u.reference_field = l.reference_field);
|
|
226
241
|
}
|
|
227
|
-
a && Array.isArray(
|
|
228
|
-
let
|
|
242
|
+
a && Array.isArray(u.options) && u.options.length > 0 && (u.options = O(a, e.name, u.options));
|
|
243
|
+
let d = (() => {
|
|
229
244
|
if (n == null || n === "") return /* @__PURE__ */ Z("span", {
|
|
230
245
|
className: "text-muted-foreground/60 text-sm select-none",
|
|
231
|
-
"aria-label":
|
|
232
|
-
title:
|
|
246
|
+
"aria-label": v("detail.noValue", { defaultValue: "No value" }),
|
|
247
|
+
title: v("detail.noValue", { defaultValue: "No value" }),
|
|
233
248
|
children: "—"
|
|
234
249
|
});
|
|
235
|
-
let t =
|
|
250
|
+
let t = St(u) || e.type;
|
|
236
251
|
if (t) {
|
|
237
|
-
let e =
|
|
252
|
+
let e = bt(t);
|
|
238
253
|
if (e) return /* @__PURE__ */ Z(e, {
|
|
239
254
|
value: n,
|
|
240
|
-
field:
|
|
255
|
+
field: u
|
|
241
256
|
});
|
|
242
257
|
}
|
|
243
258
|
return String(n);
|
|
244
|
-
})(),
|
|
245
|
-
return
|
|
246
|
-
className: W("flex items-baseline justify-between gap-4 py-2.5 min-h-[44px] group",
|
|
247
|
-
onClick:
|
|
248
|
-
onKeyDown:
|
|
249
|
-
(t.key === "Enter" || t.key === " ") && (t.preventDefault(),
|
|
259
|
+
})(), p = n != null && n !== "", m = f === e.name, h = D(a || "", e.name, e.label || e.name);
|
|
260
|
+
return M && !(o && !e.readonly) ? /* @__PURE__ */ Q("div", {
|
|
261
|
+
className: W("flex items-baseline justify-between gap-4 py-2.5 min-h-[44px] group", p && "cursor-pointer active:bg-muted/40 transition-colors"),
|
|
262
|
+
onClick: p ? () => k(e.name, n) : void 0,
|
|
263
|
+
onKeyDown: p ? (t) => {
|
|
264
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), k(e.name, n));
|
|
250
265
|
} : void 0,
|
|
251
|
-
role:
|
|
252
|
-
tabIndex:
|
|
266
|
+
role: p ? "button" : void 0,
|
|
267
|
+
tabIndex: p ? 0 : void 0,
|
|
253
268
|
children: [/* @__PURE__ */ Z("span", {
|
|
254
269
|
className: "text-[15px] text-muted-foreground shrink-0",
|
|
255
|
-
children:
|
|
270
|
+
children: h
|
|
256
271
|
}), /* @__PURE__ */ Z("span", {
|
|
257
272
|
className: "text-[15px] text-foreground text-right break-words min-w-0 leading-snug",
|
|
258
|
-
children:
|
|
273
|
+
children: d
|
|
259
274
|
})]
|
|
260
275
|
}, e.name) : /* @__PURE__ */ Q("div", {
|
|
261
276
|
className: W("space-y-1.5 group", r),
|
|
262
277
|
children: [/* @__PURE__ */ Z("div", {
|
|
263
278
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
264
|
-
children:
|
|
279
|
+
children: D(a || "", e.name, e.label || e.name)
|
|
265
280
|
}), o && !e.readonly ? /* @__PURE__ */ Z("div", {
|
|
266
281
|
className: "min-h-[44px] sm:min-h-0",
|
|
267
282
|
children: (() => {
|
|
268
|
-
let t =
|
|
269
|
-
if (t === "select" && Array.isArray(
|
|
270
|
-
field:
|
|
283
|
+
let t = u.type || e.type;
|
|
284
|
+
if (t === "select" && Array.isArray(u.options) && u.options.length > 0) return /* @__PURE__ */ Z(_t, {
|
|
285
|
+
field: u,
|
|
271
286
|
value: n == null ? "" : String(n),
|
|
272
287
|
onChange: (t) => s?.(e.name, t)
|
|
273
288
|
});
|
|
274
289
|
if (t === "boolean") return /* @__PURE__ */ Z(mt, {
|
|
275
|
-
field:
|
|
290
|
+
field: u,
|
|
276
291
|
value: !!n,
|
|
277
292
|
onChange: (t) => s?.(e.name, t)
|
|
278
293
|
});
|
|
279
|
-
let r = t === "
|
|
294
|
+
let r = t === "user" || t === "owner", i = t === "lookup" || t === "master_detail" || t === "tree" || !!u.reference_to && !Rt.has(t);
|
|
295
|
+
if (r || i) return /* @__PURE__ */ Z(r ? vt : ht, {
|
|
296
|
+
field: u,
|
|
297
|
+
value: zt(n),
|
|
298
|
+
onChange: (t) => s?.(e.name, t),
|
|
299
|
+
dataSource: c
|
|
300
|
+
});
|
|
301
|
+
let a = t === "date" || t === "datetime";
|
|
280
302
|
return /* @__PURE__ */ Z("input", {
|
|
281
|
-
type: t === "number" ? "number" :
|
|
303
|
+
type: t === "number" ? "number" : a ? "date" : "text",
|
|
282
304
|
className: "w-full px-2 py-1.5 text-sm border rounded-md bg-background focus:outline-none focus:ring-2 focus:ring-ring",
|
|
283
|
-
value: n == null ? "" :
|
|
305
|
+
value: n == null ? "" : a ? (() => {
|
|
284
306
|
let e = String(n);
|
|
285
307
|
if (/^\d{4}-\d{2}-\d{2}/.test(e)) return e.slice(0, 10);
|
|
286
308
|
let t = new Date(e);
|
|
287
309
|
return isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-CA");
|
|
288
|
-
})() : String(n),
|
|
310
|
+
})() : String(typeof n == "object" ? yt(n) ?? "" : n),
|
|
289
311
|
onChange: (t) => {
|
|
290
312
|
let n = t.target.value;
|
|
291
|
-
if (
|
|
313
|
+
if (a && n) {
|
|
292
314
|
let t = (/* @__PURE__ */ new Date(n + "T00:00:00")).toISOString();
|
|
293
315
|
s?.(e.name, t);
|
|
294
316
|
} else s?.(e.name, n);
|
|
@@ -296,74 +318,74 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
296
318
|
});
|
|
297
319
|
})()
|
|
298
320
|
}) : /* @__PURE__ */ Q("div", {
|
|
299
|
-
className: W("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md",
|
|
300
|
-
onClick:
|
|
301
|
-
onKeyDown:
|
|
302
|
-
(t.key === "Enter" || t.key === " ") && (t.preventDefault(),
|
|
321
|
+
className: W("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md", p && "cursor-pointer active:bg-muted/60 transition-colors"),
|
|
322
|
+
onClick: p ? () => k(e.name, n) : void 0,
|
|
323
|
+
onKeyDown: p ? (t) => {
|
|
324
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), k(e.name, n));
|
|
303
325
|
} : void 0,
|
|
304
|
-
role:
|
|
305
|
-
tabIndex:
|
|
326
|
+
role: p ? "button" : void 0,
|
|
327
|
+
tabIndex: p ? 0 : void 0,
|
|
306
328
|
children: [/* @__PURE__ */ Z("div", {
|
|
307
329
|
className: "text-sm flex-1 break-words py-1",
|
|
308
|
-
children:
|
|
309
|
-
}),
|
|
330
|
+
children: d
|
|
331
|
+
}), p && /* @__PURE__ */ Z(ie, { children: /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
310
332
|
asChild: !0,
|
|
311
333
|
children: /* @__PURE__ */ Z(y, {
|
|
312
334
|
variant: "ghost",
|
|
313
335
|
size: "icon",
|
|
314
336
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",
|
|
315
337
|
onClick: (t) => {
|
|
316
|
-
t.stopPropagation(),
|
|
338
|
+
t.stopPropagation(), k(e.name, n);
|
|
317
339
|
},
|
|
318
|
-
children:
|
|
340
|
+
children: m ? /* @__PURE__ */ Z(me, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Ce, { className: "h-3 w-3" })
|
|
319
341
|
})
|
|
320
|
-
}), /* @__PURE__ */ Z(
|
|
342
|
+
}), /* @__PURE__ */ Z(V, { children: v(m ? "detail.copied" : "detail.copyToClipboard") })] }) })]
|
|
321
343
|
})]
|
|
322
344
|
}, e.name);
|
|
323
|
-
},
|
|
345
|
+
}, re = l?.enabled === !0, R = l?.batchSize ?? 20;
|
|
324
346
|
n.useEffect(() => {
|
|
325
|
-
if (!
|
|
326
|
-
|
|
347
|
+
if (!re) {
|
|
348
|
+
h(void 0);
|
|
327
349
|
return;
|
|
328
350
|
}
|
|
329
351
|
if (I.length <= R) {
|
|
330
|
-
|
|
352
|
+
h(void 0);
|
|
331
353
|
return;
|
|
332
354
|
}
|
|
333
|
-
|
|
334
|
-
let e = setTimeout(() =>
|
|
355
|
+
h(R);
|
|
356
|
+
let e = setTimeout(() => h(void 0), 100);
|
|
335
357
|
return () => clearTimeout(e);
|
|
336
358
|
}, [
|
|
337
|
-
|
|
359
|
+
re,
|
|
338
360
|
I.length,
|
|
339
361
|
R
|
|
340
362
|
]);
|
|
341
|
-
let z =
|
|
363
|
+
let z = m === void 0 ? I : I.slice(0, m), U = j > 0 && (e.hideEmpty || te), oe = /* @__PURE__ */ Q(Ct, { children: [M ? /* @__PURE__ */ Z("div", {
|
|
342
364
|
className: "flex flex-col divide-y divide-border/60",
|
|
343
|
-
children: z.map(
|
|
365
|
+
children: z.map(ne)
|
|
344
366
|
}) : /* @__PURE__ */ Z("div", {
|
|
345
|
-
className: W("grid gap-3 sm:gap-4",
|
|
346
|
-
children: z.map(
|
|
347
|
-
}),
|
|
367
|
+
className: W("grid gap-3 sm:gap-4", L === 1 ? "grid-cols-1" : L === 2 ? "grid-cols-1 md:grid-cols-2" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"),
|
|
368
|
+
children: z.map(ne)
|
|
369
|
+
}), U && /* @__PURE__ */ Z("div", {
|
|
348
370
|
className: "mt-3 -ml-2",
|
|
349
371
|
children: /* @__PURE__ */ Q(y, {
|
|
350
372
|
type: "button",
|
|
351
373
|
variant: "ghost",
|
|
352
374
|
size: "sm",
|
|
353
|
-
onClick: () =>
|
|
375
|
+
onClick: () => _((e) => !e),
|
|
354
376
|
className: "h-7 px-2 text-xs text-muted-foreground hover:text-foreground",
|
|
355
|
-
children: [Z(
|
|
356
|
-
count:
|
|
357
|
-
defaultValue: `Show ${
|
|
377
|
+
children: [Z(g ? J : Ee, { className: "h-3.5 w-3.5 mr-1.5" }), g ? v("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : v("detail.showEmptyFields", {
|
|
378
|
+
count: j,
|
|
379
|
+
defaultValue: `Show ${j} empty field${j === 1 ? "" : "s"}`
|
|
358
380
|
})]
|
|
359
381
|
})
|
|
360
382
|
})] });
|
|
361
383
|
return !e.title && !e.collapsible && e.showBorder === !1 ? /* @__PURE__ */ Z("div", {
|
|
362
384
|
className: W(r),
|
|
363
|
-
children:
|
|
385
|
+
children: oe
|
|
364
386
|
}) : e.collapsible ? /* @__PURE__ */ Z(w, {
|
|
365
|
-
open: !
|
|
366
|
-
onOpenChange: (e) =>
|
|
387
|
+
open: !u,
|
|
388
|
+
onOpenChange: (e) => d(!e),
|
|
367
389
|
className: r,
|
|
368
390
|
children: /* @__PURE__ */ Q(b, { children: [/* @__PURE__ */ Z(E, {
|
|
369
391
|
asChild: !0,
|
|
@@ -379,16 +401,16 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
379
401
|
}), /* @__PURE__ */ Z("span", { children: e.title })]
|
|
380
402
|
}), /* @__PURE__ */ Z("div", {
|
|
381
403
|
className: "flex items-center gap-2",
|
|
382
|
-
children: Z(
|
|
404
|
+
children: Z(u ? ve : ge, { className: "h-4 w-4 text-muted-foreground" })
|
|
383
405
|
})]
|
|
384
|
-
}), e.description && !
|
|
406
|
+
}), e.description && !u && /* @__PURE__ */ Z("p", {
|
|
385
407
|
className: "text-xs text-muted-foreground mt-1",
|
|
386
408
|
children: e.description
|
|
387
409
|
})]
|
|
388
410
|
})
|
|
389
411
|
}), /* @__PURE__ */ Z(T, { children: /* @__PURE__ */ Z(x, {
|
|
390
412
|
className: "pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5",
|
|
391
|
-
children:
|
|
413
|
+
children: oe
|
|
392
414
|
}) })] })
|
|
393
415
|
}) : /* @__PURE__ */ Q(b, {
|
|
394
416
|
className: W(e.showBorder === !1 ? "border-none shadow-none" : "", r),
|
|
@@ -409,18 +431,18 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
409
431
|
})]
|
|
410
432
|
}), /* @__PURE__ */ Z(x, {
|
|
411
433
|
className: "pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5",
|
|
412
|
-
children:
|
|
434
|
+
children: oe
|
|
413
435
|
})]
|
|
414
436
|
});
|
|
415
|
-
},
|
|
437
|
+
}, Vt = ({ tabs: e, data: t, className: r }) => {
|
|
416
438
|
let [i, a] = n.useState(e[0]?.key), o = e.filter((e) => typeof e.visible == "boolean" ? e.visible : (e.visible, !0));
|
|
417
439
|
return /* @__PURE__ */ Q(ne, {
|
|
418
440
|
value: i,
|
|
419
441
|
onValueChange: a,
|
|
420
442
|
className: r,
|
|
421
|
-
children: [/* @__PURE__ */ Z(
|
|
443
|
+
children: [/* @__PURE__ */ Z(R, {
|
|
422
444
|
className: "w-full justify-start border-b rounded-none bg-transparent p-0",
|
|
423
|
-
children: o.map((e) => /* @__PURE__ */ Z(
|
|
445
|
+
children: o.map((e) => /* @__PURE__ */ Z(z, {
|
|
424
446
|
value: e.key,
|
|
425
447
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
426
448
|
children: /* @__PURE__ */ Q("div", {
|
|
@@ -436,7 +458,7 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
436
458
|
]
|
|
437
459
|
})
|
|
438
460
|
}, e.key))
|
|
439
|
-
}), o.map((e) => /* @__PURE__ */ Z(
|
|
461
|
+
}), o.map((e) => /* @__PURE__ */ Z(re, {
|
|
440
462
|
value: e.key,
|
|
441
463
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
442
464
|
children: /* @__PURE__ */ Z(n.Suspense, {
|
|
@@ -457,19 +479,19 @@ var Pt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
457
479
|
};
|
|
458
480
|
//#endregion
|
|
459
481
|
//#region src/RelatedList.tsx
|
|
460
|
-
function
|
|
461
|
-
return e && nt[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] ||
|
|
482
|
+
function Ht(e) {
|
|
483
|
+
return e && nt[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || je;
|
|
462
484
|
}
|
|
463
|
-
var
|
|
464
|
-
let
|
|
485
|
+
var Ut = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className: h, dataSource: g, objectName: _, onNew: w, onViewAll: T, onRowEdit: E, onRowDelete: D, onRowClick: k, add: A, maxColumns: j = 6, pageSize: M, sortable: N = !1, filterable: ee = !1, collapsible: P = !1, defaultCollapsed: te = !1, referenceField: F, parentId: I, icon: L }) => {
|
|
486
|
+
let ne = i !== void 0, re = i ?? [], [R, z] = n.useState(re), [B, V] = n.useState(() => !!r && !ne), [ie, H] = n.useState(0), [U, oe] = n.useState(null), [G, se] = n.useState("asc"), [ce, le] = n.useState(""), [K, q] = n.useState(null), [de, fe] = n.useState(te), [pe, me] = n.useState(!1), [he, ye] = n.useState(!1), [be, xe] = n.useState(null), [Se, Ce] = n.useState(0), [we, Ee] = n.useState({}), { t: J } = $(), { fieldLabel: De } = pt();
|
|
465
487
|
n.useEffect(() => {
|
|
466
|
-
|
|
467
|
-
}, [i,
|
|
468
|
-
r && g?.getObjectSchema && g.getObjectSchema(r).then(
|
|
488
|
+
ne && z(i ?? []);
|
|
489
|
+
}, [i, ne]), n.useEffect(() => {
|
|
490
|
+
r && g?.getObjectSchema && g.getObjectSchema(r).then(q).catch((e) => {
|
|
469
491
|
console.warn(`[RelatedList] Failed to fetch schema for ${r}:`, e);
|
|
470
492
|
});
|
|
471
493
|
}, [r, g]), n.useEffect(() => {
|
|
472
|
-
if (r && !
|
|
494
|
+
if (r && !ne) {
|
|
473
495
|
if (!(F && I != null && I !== "")) {
|
|
474
496
|
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.`), z([]), V(!1);
|
|
475
497
|
return;
|
|
@@ -492,10 +514,11 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
492
514
|
}
|
|
493
515
|
}, [
|
|
494
516
|
r,
|
|
495
|
-
|
|
517
|
+
ne,
|
|
496
518
|
g,
|
|
497
519
|
F,
|
|
498
|
-
I
|
|
520
|
+
I,
|
|
521
|
+
Se
|
|
499
522
|
]), n.useEffect(() => {
|
|
500
523
|
if (!g?.find || !K?.fields || !R.length) return;
|
|
501
524
|
let e = K.fields, t = [];
|
|
@@ -508,7 +531,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
508
531
|
let t = e?.[n];
|
|
509
532
|
t != null && (typeof t == "string" && t ? i.add(t) : typeof t == "number" && i.add(String(t)));
|
|
510
533
|
}
|
|
511
|
-
let a =
|
|
534
|
+
let a = we[n] || {}, o = Array.from(i).filter((e) => !(e in a));
|
|
512
535
|
o.length > 0 && t.push({
|
|
513
536
|
fieldName: n,
|
|
514
537
|
target: e,
|
|
@@ -524,7 +547,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
524
547
|
let n = Array.isArray(t) ? t : t?.data || [], r = {};
|
|
525
548
|
for (let e of n) {
|
|
526
549
|
let t = e?.id || e?._id;
|
|
527
|
-
t && (r[String(t)] = e?.full_name || e?.fullname || e?.display_name || e?.name || e?.subject || e?.title || e?.label || e?.code || String(t));
|
|
550
|
+
t && (r[String(t)] = e?.full_name || e?.fullname || e?.display_name || e?.name || e?.subject || e?.title || e?.label || e?.code || e?.email || String(t));
|
|
528
551
|
}
|
|
529
552
|
return {
|
|
530
553
|
fieldName: e,
|
|
@@ -534,7 +557,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
534
557
|
fieldName: e,
|
|
535
558
|
map: {}
|
|
536
559
|
})))).then((e) => {
|
|
537
|
-
n ||
|
|
560
|
+
n || Ee((t) => {
|
|
538
561
|
let n = { ...t };
|
|
539
562
|
for (let { fieldName: t, map: r } of e) n[t] = {
|
|
540
563
|
...n[t] || {},
|
|
@@ -550,50 +573,80 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
550
573
|
K,
|
|
551
574
|
R
|
|
552
575
|
]);
|
|
553
|
-
let
|
|
554
|
-
if (!
|
|
555
|
-
let e =
|
|
576
|
+
let Oe = n.useMemo(() => {
|
|
577
|
+
if (!ce) return R;
|
|
578
|
+
let e = ce.toLowerCase();
|
|
556
579
|
return R.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
557
|
-
}, [R,
|
|
580
|
+
}, [R, ce]), ke = n.useMemo(() => U ? [...Oe].sort((e, t) => {
|
|
558
581
|
let n = e[U], r = t[U];
|
|
559
582
|
if (n == null && r == null) return 0;
|
|
560
583
|
if (n == null) return 1;
|
|
561
584
|
if (r == null) return -1;
|
|
562
585
|
let i = String(n).localeCompare(String(r), void 0, { numeric: !0 });
|
|
563
|
-
return
|
|
564
|
-
}) :
|
|
565
|
-
|
|
586
|
+
return G === "asc" ? i : -i;
|
|
587
|
+
}) : Oe, [
|
|
588
|
+
Oe,
|
|
566
589
|
U,
|
|
567
|
-
|
|
568
|
-
]),
|
|
590
|
+
G
|
|
591
|
+
]), Y = M && M > 0 ? M : 0, Ae = Y ? Math.max(1, Math.ceil(ke.length / Y)) : 1, je = Y ? ke.slice(ie * Y, (ie + 1) * Y) : ke;
|
|
569
592
|
n.useEffect(() => {
|
|
570
|
-
|
|
593
|
+
H(0);
|
|
571
594
|
}, [
|
|
572
|
-
|
|
595
|
+
ce,
|
|
573
596
|
U,
|
|
574
|
-
|
|
597
|
+
G
|
|
575
598
|
]);
|
|
576
|
-
let
|
|
577
|
-
U === e ?
|
|
578
|
-
}, [U]), [
|
|
579
|
-
|
|
580
|
-
}, []),
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
599
|
+
let Me = n.useCallback((e) => {
|
|
600
|
+
U === e ? se((e) => e === "asc" ? "desc" : "asc") : (oe(e), se("asc"));
|
|
601
|
+
}, [U]), [Ne, Pe] = n.useState(null), Fe = n.useCallback((e) => {
|
|
602
|
+
Pe(e);
|
|
603
|
+
}, []), Ie = n.useCallback(async () => {
|
|
604
|
+
if (Ne) try {
|
|
605
|
+
await D?.(Ne), Ce((e) => e + 1);
|
|
606
|
+
} catch (e) {
|
|
607
|
+
console.error("[RelatedList] remove failed", e);
|
|
608
|
+
}
|
|
609
|
+
Pe(null);
|
|
610
|
+
}, [Ne, D]), Le = n.useCallback(async (e) => {
|
|
611
|
+
if (!A || !g || !r || F == null || I == null) return;
|
|
612
|
+
let t = A.picker.valueField || "id";
|
|
613
|
+
ye(!0), xe(null);
|
|
614
|
+
try {
|
|
615
|
+
for (let n of e || []) {
|
|
616
|
+
let e = n?.[t] ?? n?.id;
|
|
617
|
+
e != null && (A.linkField ? await g.create?.(r, {
|
|
618
|
+
[F]: I,
|
|
619
|
+
[A.linkField]: e
|
|
620
|
+
}) : await g.update?.(A.picker.object, String(e), { [F]: I }));
|
|
621
|
+
}
|
|
622
|
+
Ce((e) => e + 1);
|
|
623
|
+
} catch (e) {
|
|
624
|
+
let t = e?.body?.error ?? e?.error ?? e?.message ?? String(e);
|
|
625
|
+
xe(typeof t == "string" ? t : "Failed to add");
|
|
626
|
+
} finally {
|
|
627
|
+
ye(!1), me(!1);
|
|
628
|
+
}
|
|
629
|
+
}, [
|
|
630
|
+
A,
|
|
631
|
+
g,
|
|
632
|
+
r,
|
|
633
|
+
F,
|
|
634
|
+
I
|
|
635
|
+
]), X = Tt(), Re = n.useMemo(() => {
|
|
636
|
+
let e = _ || r || "", t = (t) => !X?.isLoaded || !e ? t : t.filter((t) => {
|
|
584
637
|
let n = t?.accessorKey || t?.field || t?.name;
|
|
585
|
-
return n ?
|
|
638
|
+
return n ? X.checkField(e, String(n), "read") : !0;
|
|
586
639
|
}), 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) => R.length ? e.filter((e) => {
|
|
587
640
|
let t = e?.accessorKey || e?.field || e?.name;
|
|
588
641
|
return t ? R.some((e) => !a(e?.[t])) : !0;
|
|
589
642
|
}) : e, s = (e, t) => {
|
|
590
643
|
if (!t?.type) return;
|
|
591
|
-
let r =
|
|
644
|
+
let r = bt(St({
|
|
592
645
|
type: t.type,
|
|
593
646
|
format: t.format
|
|
594
647
|
}) || t.type);
|
|
595
648
|
if (!r) return;
|
|
596
|
-
let i = t.type === "lookup" || t.type === "master_detail" ?
|
|
649
|
+
let i = t.type === "lookup" || t.type === "master_detail" ? we[e] : void 0, a = i && Object.keys(i).length > 0 ? Object.entries(i).map(([e, t]) => ({
|
|
597
650
|
value: e,
|
|
598
651
|
label: t
|
|
599
652
|
})) : void 0, o = {
|
|
@@ -625,7 +678,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
625
678
|
}
|
|
626
679
|
let n = K?.fields?.[t], r = {
|
|
627
680
|
accessorKey: t,
|
|
628
|
-
header: n?.label ||
|
|
681
|
+
header: n?.label || De(e, t, n) || t,
|
|
629
682
|
fieldDef: n,
|
|
630
683
|
fieldType: n?.type
|
|
631
684
|
}, i = n ? s(t, n) : void 0;
|
|
@@ -649,7 +702,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
649
702
|
"label",
|
|
650
703
|
"code",
|
|
651
704
|
"number"
|
|
652
|
-
], f = Object.entries(K.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === F || t?.hidden || t?.type && u.has(t.type) ||
|
|
705
|
+
], f = Object.entries(K.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === F || t?.hidden || t?.type && u.has(t.type) || X?.isLoaded && l && !X.checkField(l, e, "read"))), p = new Set([
|
|
653
706
|
"created_at",
|
|
654
707
|
"updated_at",
|
|
655
708
|
"created_by",
|
|
@@ -667,32 +720,32 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
667
720
|
}), o(f.map(([e, t]) => {
|
|
668
721
|
let n = {
|
|
669
722
|
accessorKey: e,
|
|
670
|
-
header:
|
|
723
|
+
header: De(l, e, t.label || e)
|
|
671
724
|
};
|
|
672
725
|
if (t.type) {
|
|
673
726
|
let r = s(e, t);
|
|
674
727
|
r && (n.cell = r);
|
|
675
728
|
}
|
|
676
729
|
return n;
|
|
677
|
-
})).slice(0, Math.max(1,
|
|
730
|
+
})).slice(0, Math.max(1, j));
|
|
678
731
|
}, [
|
|
679
732
|
m,
|
|
680
733
|
K,
|
|
681
734
|
_,
|
|
682
735
|
r,
|
|
683
|
-
|
|
736
|
+
De,
|
|
684
737
|
F,
|
|
685
738
|
R,
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
]),
|
|
739
|
+
j,
|
|
740
|
+
we,
|
|
741
|
+
X
|
|
742
|
+
]), ze = !!E || !!D, Be = ae(), Ve = n.useMemo(() => {
|
|
690
743
|
if (a) return a;
|
|
691
|
-
if (
|
|
692
|
-
let e =
|
|
744
|
+
if (Be && (t === "grid" || t === "table")) {
|
|
745
|
+
let e = Re[0]?.accessorKey || Re[0]?.field || Re[0]?.name, t = Re.slice(1, 4).map((e) => e.accessorKey || e.field || e.name).filter(Boolean);
|
|
693
746
|
return {
|
|
694
747
|
type: "object-gallery",
|
|
695
|
-
data:
|
|
748
|
+
data: je,
|
|
696
749
|
objectName: r,
|
|
697
750
|
gallery: {
|
|
698
751
|
titleField: e || "name",
|
|
@@ -706,20 +759,20 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
706
759
|
case "grid":
|
|
707
760
|
case "table": return {
|
|
708
761
|
type: "data-table",
|
|
709
|
-
data:
|
|
710
|
-
columns:
|
|
762
|
+
data: je,
|
|
763
|
+
columns: Re,
|
|
711
764
|
pagination: !1,
|
|
712
|
-
pageSize:
|
|
765
|
+
pageSize: Y || 10,
|
|
713
766
|
searchable: !1,
|
|
714
767
|
exportable: !1,
|
|
715
|
-
rowActions:
|
|
768
|
+
rowActions: ze,
|
|
716
769
|
onRowEdit: E,
|
|
717
|
-
onRowDelete: D ?
|
|
770
|
+
onRowDelete: D ? Fe : void 0,
|
|
718
771
|
onRowClick: k
|
|
719
772
|
};
|
|
720
773
|
case "list": return {
|
|
721
774
|
type: "data-list",
|
|
722
|
-
data:
|
|
775
|
+
data: je
|
|
723
776
|
};
|
|
724
777
|
default: return {
|
|
725
778
|
type: "div",
|
|
@@ -728,36 +781,36 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
728
781
|
}
|
|
729
782
|
}, [
|
|
730
783
|
t,
|
|
731
|
-
|
|
732
|
-
|
|
784
|
+
je,
|
|
785
|
+
Re,
|
|
733
786
|
a,
|
|
734
|
-
|
|
735
|
-
|
|
787
|
+
Y,
|
|
788
|
+
ze,
|
|
736
789
|
E,
|
|
737
790
|
D,
|
|
738
|
-
|
|
791
|
+
Fe,
|
|
739
792
|
k,
|
|
740
|
-
|
|
793
|
+
Be,
|
|
741
794
|
r
|
|
742
|
-
]),
|
|
795
|
+
]), He = P ? "cursor-pointer select-none" : void 0, Ue = P ? () => fe((e) => !e) : void 0, Ge = Ht(L), Ke = !B && R.length === 0, qe = ee;
|
|
743
796
|
return /* @__PURE__ */ Q(b, {
|
|
744
|
-
className: W("shadow-none border-border/60 bg-transparent",
|
|
797
|
+
className: W("shadow-none border-border/60 bg-transparent", Ke && "bg-muted/10", h),
|
|
745
798
|
children: [
|
|
746
799
|
/* @__PURE__ */ Z(S, {
|
|
747
|
-
className: W("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0",
|
|
748
|
-
onClick:
|
|
800
|
+
className: W("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", He),
|
|
801
|
+
onClick: Ue,
|
|
749
802
|
children: /* @__PURE__ */ Q(C, {
|
|
750
803
|
className: "flex items-center justify-between gap-2 text-sm font-semibold",
|
|
751
804
|
children: [/* @__PURE__ */ Q("div", {
|
|
752
805
|
className: "flex items-center gap-2 min-w-0",
|
|
753
806
|
children: [
|
|
754
|
-
|
|
755
|
-
/* @__PURE__ */ Z(
|
|
807
|
+
P && Z(de ? ve : ge, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
|
|
808
|
+
/* @__PURE__ */ Z(Ge, {
|
|
756
809
|
className: "h-4 w-4 text-muted-foreground shrink-0",
|
|
757
810
|
"aria-hidden": !0
|
|
758
811
|
}),
|
|
759
812
|
/* @__PURE__ */ Z("span", {
|
|
760
|
-
className: W("truncate",
|
|
813
|
+
className: W("truncate", Ke && "text-muted-foreground font-medium"),
|
|
761
814
|
children: e
|
|
762
815
|
}),
|
|
763
816
|
/* @__PURE__ */ Z(v, {
|
|
@@ -766,40 +819,49 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
766
819
|
"aria-label": `${R.length} records`,
|
|
767
820
|
children: R.length
|
|
768
821
|
}),
|
|
769
|
-
|
|
822
|
+
Ke && /* @__PURE__ */ Z("span", {
|
|
770
823
|
className: "text-xs text-muted-foreground/70 italic ml-1 truncate",
|
|
771
824
|
children: J("detail.noRelatedRecords")
|
|
772
825
|
})
|
|
773
826
|
]
|
|
774
|
-
}), /* @__PURE__ */
|
|
827
|
+
}), /* @__PURE__ */ Q("div", {
|
|
775
828
|
className: "flex items-center gap-1 shrink-0",
|
|
776
|
-
children:
|
|
777
|
-
variant:
|
|
829
|
+
children: [A && /* @__PURE__ */ Q(y, {
|
|
830
|
+
variant: Ke ? "ghost" : "outline",
|
|
831
|
+
size: "sm",
|
|
832
|
+
disabled: he,
|
|
833
|
+
onClick: (e) => {
|
|
834
|
+
e.stopPropagation(), xe(null), me(!0);
|
|
835
|
+
},
|
|
836
|
+
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
837
|
+
children: [/* @__PURE__ */ Z(We, { className: "h-3.5 w-3.5" }), A.label || J("detail.add", { defaultValue: "Add" })]
|
|
838
|
+
}), w && /* @__PURE__ */ Q(y, {
|
|
839
|
+
variant: Ke ? "ghost" : "outline",
|
|
778
840
|
size: "sm",
|
|
779
841
|
onClick: (e) => {
|
|
780
842
|
e.stopPropagation(), w();
|
|
781
843
|
},
|
|
782
844
|
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
783
845
|
children: [/* @__PURE__ */ Z(We, { className: "h-3.5 w-3.5" }), J("detail.new")]
|
|
784
|
-
})
|
|
846
|
+
})]
|
|
785
847
|
})]
|
|
786
848
|
})
|
|
787
849
|
}),
|
|
788
|
-
!
|
|
850
|
+
!de && !Ke && /* @__PURE__ */ Q(x, {
|
|
789
851
|
className: W("pt-0 pb-4 px-4"),
|
|
790
852
|
children: [
|
|
791
|
-
|
|
853
|
+
qe && /* @__PURE__ */ Z("div", {
|
|
792
854
|
className: "mb-3",
|
|
793
855
|
children: /* @__PURE__ */ Z(O, {
|
|
794
856
|
placeholder: J("detail.filterPlaceholder"),
|
|
795
|
-
value:
|
|
796
|
-
onChange: (e) =>
|
|
857
|
+
value: ce,
|
|
858
|
+
onChange: (e) => le(e.target.value),
|
|
797
859
|
className: "h-8 text-sm"
|
|
798
860
|
})
|
|
799
861
|
}),
|
|
800
|
-
|
|
862
|
+
N && Re && Re.length > 0 && R.length > 0 && /* @__PURE__ */ Z("div", {
|
|
801
863
|
className: "flex flex-wrap gap-1 mb-3",
|
|
802
|
-
children:
|
|
864
|
+
children: Re.map((e) => {
|
|
803
865
|
let t = e.accessorKey || e.field || e.name;
|
|
804
866
|
if (!t) return null;
|
|
805
867
|
let n = e.header || e.label || t, r = U === t;
|
|
@@ -807,11 +869,11 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
807
869
|
variant: r ? "secondary" : "ghost",
|
|
808
870
|
size: "sm",
|
|
809
871
|
className: "gap-1 h-7 text-xs",
|
|
810
|
-
onClick: () =>
|
|
872
|
+
onClick: () => Me(t),
|
|
811
873
|
children: [
|
|
812
|
-
/* @__PURE__ */ Z(
|
|
874
|
+
/* @__PURE__ */ Z(ue, { className: "h-3 w-3" }),
|
|
813
875
|
n,
|
|
814
|
-
r && (
|
|
876
|
+
r && (G === "asc" ? " ↑" : " ↓")
|
|
815
877
|
]
|
|
816
878
|
}, t);
|
|
817
879
|
})
|
|
@@ -819,36 +881,36 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
819
881
|
B ? /* @__PURE__ */ Z("div", {
|
|
820
882
|
className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
|
|
821
883
|
children: J("detail.loading")
|
|
822
|
-
}) : /* @__PURE__ */ Z(rt, { schema:
|
|
823
|
-
|
|
884
|
+
}) : /* @__PURE__ */ Z(rt, { schema: Ve }),
|
|
885
|
+
Y > 0 && ke.length > Y && /* @__PURE__ */ Q("div", {
|
|
824
886
|
className: "flex items-center justify-between mt-3 pt-3 border-t",
|
|
825
887
|
children: [
|
|
826
888
|
/* @__PURE__ */ Q(y, {
|
|
827
889
|
variant: "outline",
|
|
828
890
|
size: "sm",
|
|
829
891
|
className: "h-7 text-xs gap-1",
|
|
830
|
-
disabled:
|
|
831
|
-
onClick: () =>
|
|
832
|
-
children: [/* @__PURE__ */ Z(
|
|
892
|
+
disabled: ie === 0,
|
|
893
|
+
onClick: () => H((e) => Math.max(0, e - 1)),
|
|
894
|
+
children: [/* @__PURE__ */ Z(_e, { className: "h-3 w-3" }), J("detail.previousPage")]
|
|
833
895
|
}),
|
|
834
896
|
/* @__PURE__ */ Z("span", {
|
|
835
897
|
className: "text-xs text-muted-foreground",
|
|
836
898
|
children: J("detail.pageOf", {
|
|
837
|
-
current:
|
|
838
|
-
total:
|
|
899
|
+
current: ie + 1,
|
|
900
|
+
total: Ae
|
|
839
901
|
})
|
|
840
902
|
}),
|
|
841
903
|
/* @__PURE__ */ Q(y, {
|
|
842
904
|
variant: "outline",
|
|
843
905
|
size: "sm",
|
|
844
906
|
className: "h-7 text-xs gap-1",
|
|
845
|
-
disabled:
|
|
846
|
-
onClick: () =>
|
|
847
|
-
children: [J("detail.nextPage"), /* @__PURE__ */ Z(
|
|
907
|
+
disabled: ie >= Ae - 1,
|
|
908
|
+
onClick: () => H((e) => Math.min(Ae - 1, e + 1)),
|
|
909
|
+
children: [J("detail.nextPage"), /* @__PURE__ */ Z(ve, { className: "h-3 w-3" })]
|
|
848
910
|
})
|
|
849
911
|
]
|
|
850
912
|
}),
|
|
851
|
-
T && !
|
|
913
|
+
T && !Ke && Y > 0 && ke.length > Y && /* @__PURE__ */ Z("div", {
|
|
852
914
|
className: "mt-3 pt-3 border-t flex justify-center",
|
|
853
915
|
children: /* @__PURE__ */ Q("button", {
|
|
854
916
|
type: "button",
|
|
@@ -856,39 +918,57 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
856
918
|
e.stopPropagation(), T();
|
|
857
919
|
},
|
|
858
920
|
className: "text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors",
|
|
859
|
-
children: [J("detail.viewAll"), /* @__PURE__ */ Z(
|
|
921
|
+
children: [J("detail.viewAll"), /* @__PURE__ */ Z(Te, { className: "h-3 w-3" })]
|
|
860
922
|
})
|
|
861
923
|
})
|
|
862
924
|
]
|
|
863
925
|
}),
|
|
864
926
|
/* @__PURE__ */ Z(o, {
|
|
865
|
-
open:
|
|
927
|
+
open: Ne !== null,
|
|
866
928
|
onOpenChange: (e) => {
|
|
867
|
-
e ||
|
|
929
|
+
e || Pe(null);
|
|
868
930
|
},
|
|
869
931
|
children: /* @__PURE__ */ Q(l, { children: [/* @__PURE__ */ Q(f, { children: [/* @__PURE__ */ Z(p, { children: J("detail.deleteRowTitle", { defaultValue: "Delete record" }) }), /* @__PURE__ */ Z(u, { children: J("detail.deleteRowConfirmation") })] }), /* @__PURE__ */ Q(d, { children: [/* @__PURE__ */ Z(c, { children: J("detail.cancel", { defaultValue: "Cancel" }) }), /* @__PURE__ */ Z(s, {
|
|
870
|
-
onClick:
|
|
932
|
+
onClick: Ie,
|
|
871
933
|
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
872
934
|
children: J("detail.delete", { defaultValue: "Delete" })
|
|
873
935
|
})] })] })
|
|
936
|
+
}),
|
|
937
|
+
be && /* @__PURE__ */ Z("div", {
|
|
938
|
+
className: "mx-4 mb-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
|
|
939
|
+
role: "alert",
|
|
940
|
+
children: be
|
|
941
|
+
}),
|
|
942
|
+
A && g && /* @__PURE__ */ Z(gt, {
|
|
943
|
+
open: pe,
|
|
944
|
+
onOpenChange: (e) => me(e),
|
|
945
|
+
multiple: !0,
|
|
946
|
+
dataSource: g,
|
|
947
|
+
objectName: A.picker.object,
|
|
948
|
+
title: A.label || J("detail.add", { defaultValue: "Add" }),
|
|
949
|
+
onSelect: () => {},
|
|
950
|
+
onSelectRecords: (e) => {
|
|
951
|
+
Le(e);
|
|
952
|
+
}
|
|
874
953
|
})
|
|
875
954
|
]
|
|
876
955
|
});
|
|
877
|
-
},
|
|
878
|
-
let
|
|
956
|
+
}, Wt = ({ group: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s, dataSource: c }) => {
|
|
957
|
+
let l = e.collapsible ?? !0, [u, d] = n.useState(e.defaultCollapsed ?? !1), f = /* @__PURE__ */ Z("div", {
|
|
879
958
|
className: "space-y-3 sm:space-y-4",
|
|
880
|
-
children: e.sections.map((e, n) => /* @__PURE__ */ Z(
|
|
959
|
+
children: e.sections.map((e, n) => /* @__PURE__ */ Z(Bt, {
|
|
881
960
|
section: e,
|
|
882
961
|
data: t,
|
|
883
962
|
objectSchema: i,
|
|
884
963
|
objectName: a,
|
|
885
964
|
isEditing: o,
|
|
886
|
-
onFieldChange: s
|
|
965
|
+
onFieldChange: s,
|
|
966
|
+
dataSource: c
|
|
887
967
|
}, n))
|
|
888
968
|
});
|
|
889
|
-
return
|
|
890
|
-
open: !
|
|
891
|
-
onOpenChange: (e) =>
|
|
969
|
+
return l ? /* @__PURE__ */ Q(w, {
|
|
970
|
+
open: !u,
|
|
971
|
+
onOpenChange: (e) => d(!e),
|
|
892
972
|
className: r,
|
|
893
973
|
children: [
|
|
894
974
|
/* @__PURE__ */ Z(E, {
|
|
@@ -896,7 +976,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
896
976
|
children: /* @__PURE__ */ Q("div", {
|
|
897
977
|
className: "flex items-center gap-2 pb-2 border-b cursor-pointer hover:bg-muted/50 transition-colors rounded-t-md px-2 py-1.5",
|
|
898
978
|
children: [
|
|
899
|
-
Z(
|
|
979
|
+
Z(u ? ve : ge, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
|
|
900
980
|
e.icon && /* @__PURE__ */ Z("span", {
|
|
901
981
|
className: "text-muted-foreground",
|
|
902
982
|
children: e.icon
|
|
@@ -908,13 +988,13 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
908
988
|
]
|
|
909
989
|
})
|
|
910
990
|
}),
|
|
911
|
-
e.description && !
|
|
991
|
+
e.description && !u && /* @__PURE__ */ Z("p", {
|
|
912
992
|
className: "text-sm text-muted-foreground mt-1",
|
|
913
993
|
children: e.description
|
|
914
994
|
}),
|
|
915
995
|
/* @__PURE__ */ Z(T, { children: /* @__PURE__ */ Z("div", {
|
|
916
996
|
className: "mt-3",
|
|
917
|
-
children:
|
|
997
|
+
children: f
|
|
918
998
|
}) })
|
|
919
999
|
]
|
|
920
1000
|
}) : /* @__PURE__ */ Q("div", {
|
|
@@ -934,10 +1014,10 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
934
1014
|
className: "text-sm text-muted-foreground",
|
|
935
1015
|
children: e.description
|
|
936
1016
|
}),
|
|
937
|
-
|
|
1017
|
+
f
|
|
938
1018
|
]
|
|
939
1019
|
});
|
|
940
|
-
},
|
|
1020
|
+
}, Gt = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
|
|
941
1021
|
let { fieldLabel: a } = pt();
|
|
942
1022
|
if (!e.length || !t) return null;
|
|
943
1023
|
let o = e.filter((e) => {
|
|
@@ -958,7 +1038,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
958
1038
|
...o?.currency && { currency: o.currency },
|
|
959
1039
|
...o?.precision !== void 0 && { precision: o.precision },
|
|
960
1040
|
...o?.format && { format: o.format }
|
|
961
|
-
}, l =
|
|
1041
|
+
}, l = bt(St(c) || s || "text"), u = s === "number" || s === "integer" || s === "currency" || s === "percent" || s === "decimal", d = s === "email" || s === "url" || s === "textarea", f = s === "boolean";
|
|
962
1042
|
return /* @__PURE__ */ Q("div", {
|
|
963
1043
|
className: W("flex flex-col gap-1 min-w-[8rem] basis-[10rem]", d ? "max-w-[24rem] basis-[16rem]" : "max-w-[16rem]"),
|
|
964
1044
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -966,7 +1046,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
966
1046
|
children: a(r || "", e.name, e.label)
|
|
967
1047
|
}), f ? n ? /* @__PURE__ */ Q("span", {
|
|
968
1048
|
className: "inline-flex items-center gap-1 self-start rounded-full bg-emerald-500/10 px-2 py-0.5 text-xs font-medium text-emerald-600 ring-1 ring-inset ring-emerald-500/30 dark:text-emerald-400",
|
|
969
|
-
children: [/* @__PURE__ */ Z(
|
|
1049
|
+
children: [/* @__PURE__ */ Z(me, {
|
|
970
1050
|
className: "h-3 w-3",
|
|
971
1051
|
"aria-hidden": !0
|
|
972
1052
|
}), "Yes"]
|
|
@@ -990,7 +1070,7 @@ var Lt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
990
1070
|
};
|
|
991
1071
|
//#endregion
|
|
992
1072
|
//#region src/RecordComments.tsx
|
|
993
|
-
function
|
|
1073
|
+
function Kt(e) {
|
|
994
1074
|
try {
|
|
995
1075
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
996
1076
|
if (r < 1) return "just now";
|
|
@@ -1003,7 +1083,7 @@ function Bt(e) {
|
|
|
1003
1083
|
return e;
|
|
1004
1084
|
}
|
|
1005
1085
|
}
|
|
1006
|
-
var
|
|
1086
|
+
var qt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, className: a }) => {
|
|
1007
1087
|
let { t: o } = $(), [s, c] = n.useState(""), [l, u] = n.useState(!1), [d, f] = n.useState(""), p = n.useCallback(async () => {
|
|
1008
1088
|
let e = s.trim();
|
|
1009
1089
|
if (!(!e || !t)) {
|
|
@@ -1025,7 +1105,7 @@ var Vt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1025
1105
|
children: [/* @__PURE__ */ Z(S, { children: /* @__PURE__ */ Q(C, {
|
|
1026
1106
|
className: "flex items-center gap-2 text-base",
|
|
1027
1107
|
children: [
|
|
1028
|
-
/* @__PURE__ */ Z(
|
|
1108
|
+
/* @__PURE__ */ Z(X, { className: "h-4 w-4" }),
|
|
1029
1109
|
o("detail.comments"),
|
|
1030
1110
|
/* @__PURE__ */ Q("span", {
|
|
1031
1111
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1109,7 +1189,7 @@ var Vt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1109
1189
|
}),
|
|
1110
1190
|
/* @__PURE__ */ Z("span", {
|
|
1111
1191
|
className: "text-xs text-muted-foreground",
|
|
1112
|
-
children:
|
|
1192
|
+
children: Kt(e.createdAt)
|
|
1113
1193
|
}),
|
|
1114
1194
|
e.pinned && /* @__PURE__ */ Q("span", {
|
|
1115
1195
|
className: "text-xs text-amber-600 flex items-center gap-0.5",
|
|
@@ -1135,20 +1215,20 @@ var Vt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1135
1215
|
]
|
|
1136
1216
|
})]
|
|
1137
1217
|
});
|
|
1138
|
-
},
|
|
1139
|
-
field_change:
|
|
1218
|
+
}, Jt = {
|
|
1219
|
+
field_change: we,
|
|
1140
1220
|
create: Ge,
|
|
1141
1221
|
delete: Qe,
|
|
1142
|
-
comment:
|
|
1143
|
-
status_change:
|
|
1144
|
-
},
|
|
1222
|
+
comment: X,
|
|
1223
|
+
status_change: le
|
|
1224
|
+
}, Yt = {
|
|
1145
1225
|
field_change: "bg-blue-100 text-blue-600",
|
|
1146
1226
|
create: "bg-green-100 text-green-600",
|
|
1147
1227
|
delete: "bg-red-100 text-red-600",
|
|
1148
1228
|
comment: "bg-purple-100 text-purple-600",
|
|
1149
1229
|
status_change: "bg-amber-100 text-amber-600"
|
|
1150
1230
|
};
|
|
1151
|
-
function
|
|
1231
|
+
function Xt(e) {
|
|
1152
1232
|
try {
|
|
1153
1233
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1154
1234
|
if (r < 1) return "just now";
|
|
@@ -1161,17 +1241,17 @@ function Wt(e) {
|
|
|
1161
1241
|
return e;
|
|
1162
1242
|
}
|
|
1163
1243
|
}
|
|
1164
|
-
function
|
|
1244
|
+
function Zt(e) {
|
|
1165
1245
|
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";
|
|
1166
1246
|
}
|
|
1167
|
-
var
|
|
1247
|
+
var Qt = {
|
|
1168
1248
|
all: "All",
|
|
1169
1249
|
field_change: "Field Changes",
|
|
1170
1250
|
create: "Creates",
|
|
1171
1251
|
delete: "Deletes",
|
|
1172
1252
|
comment: "Comments",
|
|
1173
1253
|
status_change: "Status Changes"
|
|
1174
|
-
},
|
|
1254
|
+
}, $t = ({ activities: e, filterable: t = !1, defaultFilter: r = "all", className: i }) => {
|
|
1175
1255
|
let [a, o] = n.useState(r), s = n.useMemo(() => a === "all" ? e : e.filter((e) => e.type === a), [e, a]);
|
|
1176
1256
|
return /* @__PURE__ */ Q(b, {
|
|
1177
1257
|
className: W("", i),
|
|
@@ -1193,12 +1273,12 @@ var Kt = {
|
|
|
1193
1273
|
className: "flex flex-wrap gap-1.5 mb-4",
|
|
1194
1274
|
role: "group",
|
|
1195
1275
|
"aria-label": "Activity type filter",
|
|
1196
|
-
children: Object.keys(
|
|
1276
|
+
children: Object.keys(Qt).map((e) => /* @__PURE__ */ Q("button", {
|
|
1197
1277
|
type: "button",
|
|
1198
1278
|
className: W("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"),
|
|
1199
1279
|
onClick: () => o(e),
|
|
1200
1280
|
"aria-pressed": a === e,
|
|
1201
|
-
children: [e !== "all" && n.createElement(
|
|
1281
|
+
children: [e !== "all" && n.createElement(Jt[e] || we, { className: "h-3 w-3" }), Qt[e]]
|
|
1202
1282
|
}, e))
|
|
1203
1283
|
}), s.length === 0 ? /* @__PURE__ */ Z(D, {
|
|
1204
1284
|
title: "No activity recorded",
|
|
@@ -1208,11 +1288,11 @@ var Kt = {
|
|
|
1208
1288
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
1209
1289
|
className: "space-y-4",
|
|
1210
1290
|
children: s.map((e) => {
|
|
1211
|
-
let t =
|
|
1291
|
+
let t = Jt[e.type] || we;
|
|
1212
1292
|
return /* @__PURE__ */ Q("div", {
|
|
1213
1293
|
className: "flex gap-3 relative",
|
|
1214
1294
|
children: [/* @__PURE__ */ Z("div", {
|
|
1215
|
-
className: W("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10",
|
|
1295
|
+
className: W("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", Yt[e.type] || "bg-gray-100 text-gray-600"),
|
|
1216
1296
|
children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
|
|
1217
1297
|
}), /* @__PURE__ */ Q("div", {
|
|
1218
1298
|
className: "flex-1 min-w-0 pt-1",
|
|
@@ -1226,12 +1306,12 @@ var Kt = {
|
|
|
1226
1306
|
" ",
|
|
1227
1307
|
/* @__PURE__ */ Z("span", {
|
|
1228
1308
|
className: "text-muted-foreground",
|
|
1229
|
-
children:
|
|
1309
|
+
children: Zt(e)
|
|
1230
1310
|
})
|
|
1231
1311
|
]
|
|
1232
1312
|
}), /* @__PURE__ */ Z("p", {
|
|
1233
1313
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
1234
|
-
children:
|
|
1314
|
+
children: Xt(e.timestamp)
|
|
1235
1315
|
})]
|
|
1236
1316
|
})]
|
|
1237
1317
|
}, e.id);
|
|
@@ -1239,7 +1319,7 @@ var Kt = {
|
|
|
1239
1319
|
})]
|
|
1240
1320
|
})] })]
|
|
1241
1321
|
});
|
|
1242
|
-
},
|
|
1322
|
+
}, en = {
|
|
1243
1323
|
create: "default",
|
|
1244
1324
|
update: "secondary",
|
|
1245
1325
|
delete: "destructive",
|
|
@@ -1251,12 +1331,12 @@ var Kt = {
|
|
|
1251
1331
|
export: "outline",
|
|
1252
1332
|
import: "outline"
|
|
1253
1333
|
};
|
|
1254
|
-
function
|
|
1334
|
+
function tn(e) {
|
|
1255
1335
|
if (!e) return "";
|
|
1256
1336
|
let t = e instanceof Date ? e : new Date(e);
|
|
1257
1337
|
return Number.isNaN(t.getTime()) ? String(e) : t.toLocaleString();
|
|
1258
1338
|
}
|
|
1259
|
-
var
|
|
1339
|
+
var nn = [
|
|
1260
1340
|
[60, "second"],
|
|
1261
1341
|
[60, "minute"],
|
|
1262
1342
|
[24, "hour"],
|
|
@@ -1265,27 +1345,27 @@ var Xt = [
|
|
|
1265
1345
|
[12, "month"],
|
|
1266
1346
|
[Infinity, "year"]
|
|
1267
1347
|
];
|
|
1268
|
-
function
|
|
1348
|
+
function rn(e, t) {
|
|
1269
1349
|
if (!e) return "";
|
|
1270
1350
|
let n = e instanceof Date ? e : new Date(e);
|
|
1271
1351
|
if (Number.isNaN(n.getTime())) return String(e);
|
|
1272
1352
|
let r = (n.getTime() - Date.now()) / 1e3;
|
|
1273
|
-
for (let [n, i] of
|
|
1353
|
+
for (let [n, i] of nn) {
|
|
1274
1354
|
if (Math.abs(r) < n) try {
|
|
1275
1355
|
return new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(Math.round(r), i);
|
|
1276
1356
|
} catch {
|
|
1277
|
-
return
|
|
1357
|
+
return tn(e);
|
|
1278
1358
|
}
|
|
1279
1359
|
r /= n;
|
|
1280
1360
|
}
|
|
1281
|
-
return
|
|
1361
|
+
return tn(e);
|
|
1282
1362
|
}
|
|
1283
|
-
function
|
|
1363
|
+
function an(e) {
|
|
1284
1364
|
if (!e) return "?";
|
|
1285
1365
|
let t = e.trim().split(/\s+/).filter(Boolean).slice(0, 2);
|
|
1286
1366
|
return t.length === 0 ? "?" : t.map((e) => e.charAt(0).toUpperCase()).join("");
|
|
1287
1367
|
}
|
|
1288
|
-
function
|
|
1368
|
+
function on(e) {
|
|
1289
1369
|
if (e == null || e === "") return "—";
|
|
1290
1370
|
if (typeof e == "string") return e;
|
|
1291
1371
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -1295,7 +1375,7 @@ function $t(e) {
|
|
|
1295
1375
|
return String(e);
|
|
1296
1376
|
}
|
|
1297
1377
|
}
|
|
1298
|
-
function
|
|
1378
|
+
function sn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
1299
1379
|
return t ? /* @__PURE__ */ Z("div", {
|
|
1300
1380
|
className: W("space-y-3", r),
|
|
1301
1381
|
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ Q("div", {
|
|
@@ -1308,12 +1388,12 @@ function en({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1308
1388
|
}) : !e || e.length === 0 ? /* @__PURE__ */ Z("div", {
|
|
1309
1389
|
className: W("flex items-center justify-center rounded-md border border-dashed py-10 text-sm text-muted-foreground", r),
|
|
1310
1390
|
children: n ?? "No history yet"
|
|
1311
|
-
}) : /* @__PURE__ */ Z(
|
|
1391
|
+
}) : /* @__PURE__ */ Z(ie, {
|
|
1312
1392
|
delayDuration: 150,
|
|
1313
1393
|
children: /* @__PURE__ */ Z("ol", {
|
|
1314
1394
|
className: W("space-y-4", r),
|
|
1315
1395
|
children: e.map((e, t) => {
|
|
1316
|
-
let n = (e.action ?? "").toLowerCase(), r =
|
|
1396
|
+
let n = (e.action ?? "").toLowerCase(), r = en[n] ?? "outline", a = typeof e.user_name == "string" && e.user_name.trim() || "Unknown user", o = tn(e.created_at), s = rn(e.created_at, i), c = typeof e.user_avatar == "string" ? e.user_avatar : void 0;
|
|
1317
1397
|
return /* @__PURE__ */ Q("li", {
|
|
1318
1398
|
className: "flex items-start gap-3",
|
|
1319
1399
|
children: [/* @__PURE__ */ Q(h, {
|
|
@@ -1323,7 +1403,7 @@ function en({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1323
1403
|
alt: a
|
|
1324
1404
|
}) : null, /* @__PURE__ */ Z(g, {
|
|
1325
1405
|
className: "text-[10px] font-medium",
|
|
1326
|
-
children:
|
|
1406
|
+
children: an(e.user_name)
|
|
1327
1407
|
})]
|
|
1328
1408
|
}), /* @__PURE__ */ Q("div", {
|
|
1329
1409
|
className: "min-w-0 flex-1",
|
|
@@ -1340,14 +1420,14 @@ function en({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1340
1420
|
className: "text-[10px] uppercase tracking-wide",
|
|
1341
1421
|
children: e.action
|
|
1342
1422
|
}),
|
|
1343
|
-
o && /* @__PURE__ */ Q(
|
|
1423
|
+
o && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
1344
1424
|
asChild: !0,
|
|
1345
1425
|
children: /* @__PURE__ */ Z("span", {
|
|
1346
1426
|
className: "text-xs text-muted-foreground cursor-help",
|
|
1347
1427
|
"aria-label": o,
|
|
1348
1428
|
children: s || o
|
|
1349
1429
|
})
|
|
1350
|
-
}), /* @__PURE__ */ Z(
|
|
1430
|
+
}), /* @__PURE__ */ Z(V, { children: o })] })
|
|
1351
1431
|
]
|
|
1352
1432
|
}),
|
|
1353
1433
|
e.summary && /* @__PURE__ */ Z("p", {
|
|
@@ -1374,7 +1454,7 @@ function en({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1374
1454
|
": ",
|
|
1375
1455
|
/* @__PURE__ */ Z("span", {
|
|
1376
1456
|
className: "text-foreground",
|
|
1377
|
-
children:
|
|
1457
|
+
children: on(e.to)
|
|
1378
1458
|
})
|
|
1379
1459
|
]
|
|
1380
1460
|
}, e.field))
|
|
@@ -1391,12 +1471,12 @@ function en({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1391
1471
|
": ",
|
|
1392
1472
|
/* @__PURE__ */ Z("span", {
|
|
1393
1473
|
className: "line-through opacity-70",
|
|
1394
|
-
children:
|
|
1474
|
+
children: on(e.from)
|
|
1395
1475
|
}),
|
|
1396
1476
|
" → ",
|
|
1397
1477
|
/* @__PURE__ */ Z("span", {
|
|
1398
1478
|
className: "text-foreground",
|
|
1399
|
-
children:
|
|
1479
|
+
children: on(e.to)
|
|
1400
1480
|
})
|
|
1401
1481
|
]
|
|
1402
1482
|
}, e.field))
|
|
@@ -1410,13 +1490,13 @@ function en({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1410
1490
|
}
|
|
1411
1491
|
//#endregion
|
|
1412
1492
|
//#region src/RecordMetaFooter.tsx
|
|
1413
|
-
var
|
|
1493
|
+
var cn = {
|
|
1414
1494
|
createdAt: "created_at",
|
|
1415
1495
|
createdBy: "created_by",
|
|
1416
1496
|
updatedAt: "updated_at",
|
|
1417
1497
|
updatedBy: "updated_by"
|
|
1418
1498
|
};
|
|
1419
|
-
function
|
|
1499
|
+
function ln(e) {
|
|
1420
1500
|
if (!e) return null;
|
|
1421
1501
|
if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
|
|
1422
1502
|
if (typeof e == "string" || typeof e == "number") {
|
|
@@ -1425,7 +1505,7 @@ function nn(e) {
|
|
|
1425
1505
|
}
|
|
1426
1506
|
return null;
|
|
1427
1507
|
}
|
|
1428
|
-
function
|
|
1508
|
+
function un(e, t) {
|
|
1429
1509
|
let n = Date.now() - e.getTime(), r = Math.max(0, Math.floor(n / 1e3));
|
|
1430
1510
|
if (r < 60) return t("detail.justNow");
|
|
1431
1511
|
let i = Math.floor(r / 60);
|
|
@@ -1433,7 +1513,7 @@ function rn(e, t) {
|
|
|
1433
1513
|
let a = Math.floor(i / 60);
|
|
1434
1514
|
return a < 24 ? t("detail.hoursAgo", { count: a }) : t("detail.daysAgo", { count: Math.floor(a / 24) });
|
|
1435
1515
|
}
|
|
1436
|
-
function
|
|
1516
|
+
function dn(e) {
|
|
1437
1517
|
try {
|
|
1438
1518
|
return new Intl.DateTimeFormat(void 0, {
|
|
1439
1519
|
dateStyle: "medium",
|
|
@@ -1443,16 +1523,16 @@ function an(e) {
|
|
|
1443
1523
|
return e.toISOString();
|
|
1444
1524
|
}
|
|
1445
1525
|
}
|
|
1446
|
-
var
|
|
1526
|
+
var fn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
1447
1527
|
if (e == null || e === "") return null;
|
|
1448
1528
|
let r = t?.fields?.[n], i = r?.reference_to || r?.reference, a = {
|
|
1449
1529
|
name: n,
|
|
1450
1530
|
type: r?.type || (i ? "lookup" : "text"),
|
|
1451
1531
|
...i && { reference_to: i },
|
|
1452
1532
|
...r?.reference_field && { reference_field: r.reference_field }
|
|
1453
|
-
}, o =
|
|
1533
|
+
}, o = St(a) || a.type;
|
|
1454
1534
|
if (o) {
|
|
1455
|
-
let t =
|
|
1535
|
+
let t = bt(o);
|
|
1456
1536
|
if (t) return /* @__PURE__ */ Z("span", {
|
|
1457
1537
|
className: "inline-flex items-center [&_a]:text-inherit [&_a]:hover:underline",
|
|
1458
1538
|
children: /* @__PURE__ */ Z(t, {
|
|
@@ -1462,20 +1542,20 @@ var on = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1462
1542
|
});
|
|
1463
1543
|
}
|
|
1464
1544
|
return /* @__PURE__ */ Z("span", { children: String(e) });
|
|
1465
|
-
},
|
|
1545
|
+
}, pn = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
|
|
1466
1546
|
if (!t && !n) return null;
|
|
1467
|
-
let o = n ? /* @__PURE__ */ Z(
|
|
1547
|
+
let o = n ? /* @__PURE__ */ Z(ie, {
|
|
1468
1548
|
delayDuration: 200,
|
|
1469
|
-
children: /* @__PURE__ */ Q(
|
|
1549
|
+
children: /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
1470
1550
|
asChild: !0,
|
|
1471
1551
|
children: /* @__PURE__ */ Z("time", {
|
|
1472
1552
|
dateTime: n.toISOString(),
|
|
1473
1553
|
className: "cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2",
|
|
1474
|
-
children:
|
|
1554
|
+
children: un(n, a)
|
|
1475
1555
|
})
|
|
1476
|
-
}), /* @__PURE__ */ Z(
|
|
1556
|
+
}), /* @__PURE__ */ Z(V, {
|
|
1477
1557
|
side: "top",
|
|
1478
|
-
children:
|
|
1558
|
+
children: dn(n)
|
|
1479
1559
|
})] })
|
|
1480
1560
|
}) : null;
|
|
1481
1561
|
return /* @__PURE__ */ Q("span", {
|
|
@@ -1485,7 +1565,7 @@ var on = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1485
1565
|
className: "text-muted-foreground/70",
|
|
1486
1566
|
children: e
|
|
1487
1567
|
}),
|
|
1488
|
-
t ? /* @__PURE__ */ Z(
|
|
1568
|
+
t ? /* @__PURE__ */ Z(fn, {
|
|
1489
1569
|
value: t,
|
|
1490
1570
|
objectSchema: r,
|
|
1491
1571
|
fieldName: i
|
|
@@ -1497,31 +1577,31 @@ var on = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1497
1577
|
o
|
|
1498
1578
|
]
|
|
1499
1579
|
});
|
|
1500
|
-
},
|
|
1580
|
+
}, mn = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
|
|
1501
1581
|
let { t: i } = $();
|
|
1502
1582
|
if (!e) return null;
|
|
1503
|
-
let a =
|
|
1583
|
+
let a = ln(e[cn.createdAt]), o = ln(e[cn.updatedAt]), s = e[cn.createdBy], c = e[cn.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));
|
|
1504
1584
|
return !l && !d ? null : /* @__PURE__ */ Q("div", {
|
|
1505
1585
|
className: W("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),
|
|
1506
1586
|
"data-testid": "record-meta-footer",
|
|
1507
|
-
children: [l && /* @__PURE__ */ Z(
|
|
1587
|
+
children: [l && /* @__PURE__ */ Z(pn, {
|
|
1508
1588
|
label: i("detail.createdBy"),
|
|
1509
1589
|
user: s,
|
|
1510
1590
|
date: a,
|
|
1511
1591
|
objectSchema: t,
|
|
1512
|
-
userField:
|
|
1592
|
+
userField: cn.createdBy,
|
|
1513
1593
|
t: i
|
|
1514
|
-
}), d && /* @__PURE__ */ Z(
|
|
1594
|
+
}), d && /* @__PURE__ */ Z(pn, {
|
|
1515
1595
|
label: i("detail.updatedBy"),
|
|
1516
1596
|
user: c,
|
|
1517
1597
|
date: o,
|
|
1518
1598
|
objectSchema: t,
|
|
1519
|
-
userField:
|
|
1599
|
+
userField: cn.updatedBy,
|
|
1520
1600
|
t: i
|
|
1521
1601
|
})]
|
|
1522
1602
|
});
|
|
1523
|
-
},
|
|
1524
|
-
function
|
|
1603
|
+
}, hn = 5;
|
|
1604
|
+
function gn(e, t, n, r) {
|
|
1525
1605
|
if (e && typeof e == "object") {
|
|
1526
1606
|
if (t.primaryField) {
|
|
1527
1607
|
let n = e[t.primaryField];
|
|
@@ -1568,10 +1648,10 @@ function un(e, t, n, r) {
|
|
|
1568
1648
|
}
|
|
1569
1649
|
return r;
|
|
1570
1650
|
}
|
|
1571
|
-
var
|
|
1572
|
-
let [g, _] = n.useState(e.data), [b, x] = n.useState(!e.data && !!(e.api && e.resourceId || r && e.objectName && e.resourceId)), [S, C] = n.useState(!1), w = m ?? S, [T, E] = n.useState(!1), [D, O] = n.useState({}), [k, A] = n.useState(!1), [j, M] = n.useState(null), [N, ee] = n.useState(null), [P,
|
|
1573
|
-
if (!
|
|
1574
|
-
let t = (t) =>
|
|
1651
|
+
var _n = ({ 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, isFavorite: m, onToggleFavorite: h }) => {
|
|
1652
|
+
let [g, _] = n.useState(e.data), [b, x] = n.useState(!e.data && !!(e.api && e.resourceId || r && e.objectName && e.resourceId)), [S, C] = n.useState(!1), w = m ?? S, [T, E] = n.useState(!1), [D, O] = n.useState({}), [k, A] = n.useState(!1), [j, M] = n.useState(null), [N, ee] = n.useState(null), [P, te] = n.useState(!1), [F, I] = n.useState(0), [U, oe] = n.useState(!1), { t: G } = $(), { currency: ce } = Dt(), { fieldOptionLabel: le } = pt(), ue = ae(), K = Tt(), q = n.useMemo(() => {
|
|
1653
|
+
if (!K?.isLoaded || !e.objectName) return e;
|
|
1654
|
+
let t = (t) => K.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
|
|
1575
1655
|
let n = typeof e == "string" ? e : e?.name;
|
|
1576
1656
|
return !n || t(n);
|
|
1577
1657
|
});
|
|
@@ -1584,7 +1664,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1584
1664
|
})),
|
|
1585
1665
|
summaryFields: n(e.summaryFields)
|
|
1586
1666
|
};
|
|
1587
|
-
}, [e,
|
|
1667
|
+
}, [e, K]);
|
|
1588
1668
|
n.useEffect(() => {
|
|
1589
1669
|
g && p && p(g);
|
|
1590
1670
|
}, [g, p]);
|
|
@@ -1616,7 +1696,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1616
1696
|
g
|
|
1617
1697
|
]), fe = q.summaryFields && q.summaryFields.length > 0 ? q.summaryFields : de, pe = n.useCallback(() => {
|
|
1618
1698
|
q.resourceId && navigator.clipboard.writeText(String(q.resourceId)).then(() => {
|
|
1619
|
-
|
|
1699
|
+
te(!0), setTimeout(() => te(!1), 1500);
|
|
1620
1700
|
});
|
|
1621
1701
|
}, [q.resourceId]);
|
|
1622
1702
|
n.useEffect(() => {
|
|
@@ -1669,17 +1749,17 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1669
1749
|
r,
|
|
1670
1750
|
q.sections,
|
|
1671
1751
|
q.fields,
|
|
1672
|
-
|
|
1752
|
+
F
|
|
1673
1753
|
]);
|
|
1674
|
-
let
|
|
1754
|
+
let he = n.useCallback(() => {
|
|
1675
1755
|
if (s) s();
|
|
1676
1756
|
else if (q.onNavigate) {
|
|
1677
1757
|
let e = q.backUrl || (q.objectName ? `/${q.objectName}` : "/");
|
|
1678
1758
|
q.onNavigate(e, { replace: !0 });
|
|
1679
1759
|
} else q.backUrl ? window.location.href = q.backUrl : window.history.back();
|
|
1680
|
-
}, [s, q]),
|
|
1760
|
+
}, [s, q]), ge = n.useCallback(() => {
|
|
1681
1761
|
a ? a() : q.onNavigate && q.editUrl ? q.onNavigate(q.editUrl) : q.onNavigate && q.objectName && q.resourceId ? q.onNavigate(`/${q.objectName}/${q.resourceId}/edit`) : q.editUrl && (window.location.href = q.editUrl);
|
|
1682
|
-
}, [a, q]),
|
|
1762
|
+
}, [a, q]), ye = n.useCallback(async () => {
|
|
1683
1763
|
if (!r?.cancelPendingApproval || !q.objectName || !q.resourceId) {
|
|
1684
1764
|
M(G("detail.cancelApprovalUnavailable"));
|
|
1685
1765
|
return;
|
|
@@ -1690,7 +1770,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1690
1770
|
let e = await r.findOne(String(q.objectName), String(q.resourceId));
|
|
1691
1771
|
e && _(e);
|
|
1692
1772
|
} catch {}
|
|
1693
|
-
|
|
1773
|
+
I((e) => e + 1);
|
|
1694
1774
|
try {
|
|
1695
1775
|
window.dispatchEvent(new CustomEvent("objectui:record-changed", { detail: {
|
|
1696
1776
|
objectName: String(q.objectName),
|
|
@@ -1709,10 +1789,10 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1709
1789
|
q.objectName,
|
|
1710
1790
|
q.resourceId,
|
|
1711
1791
|
G
|
|
1712
|
-
]),
|
|
1792
|
+
]), be = n.useCallback(() => {
|
|
1713
1793
|
let e = q.deleteConfirmation || G("detail.deleteConfirmation");
|
|
1714
1794
|
window.confirm(e) && (o?.(), q.onNavigate && q.objectName && q.onNavigate(`/${q.objectName}`, { replace: !0 }));
|
|
1715
|
-
}, [o, q]),
|
|
1795
|
+
}, [o, q]), xe = n.useCallback(() => {
|
|
1716
1796
|
navigator.share && q.objectName && q.resourceId ? navigator.share({
|
|
1717
1797
|
title: q.title || G("detail.details"),
|
|
1718
1798
|
text: `${q.objectName} #${q.resourceId}`,
|
|
@@ -1720,14 +1800,14 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1720
1800
|
}).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
|
|
1721
1801
|
console.log("Link copied to clipboard");
|
|
1722
1802
|
});
|
|
1723
|
-
}, [q]),
|
|
1803
|
+
}, [q]), Se = n.useCallback(() => {
|
|
1724
1804
|
let e = !w;
|
|
1725
1805
|
h && h(e), m === void 0 && C(e);
|
|
1726
1806
|
}, [
|
|
1727
1807
|
w,
|
|
1728
1808
|
m,
|
|
1729
1809
|
h
|
|
1730
|
-
]),
|
|
1810
|
+
]), Te = n.useCallback(async () => {
|
|
1731
1811
|
if (T) {
|
|
1732
1812
|
let e = Object.entries(D);
|
|
1733
1813
|
if (e.length > 0) {
|
|
@@ -1754,9 +1834,9 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1754
1834
|
D,
|
|
1755
1835
|
g,
|
|
1756
1836
|
l
|
|
1757
|
-
]),
|
|
1837
|
+
]), Ee = n.useCallback(() => {
|
|
1758
1838
|
O({}), E(!1), M(null);
|
|
1759
|
-
}, []),
|
|
1839
|
+
}, []), J = n.useCallback((e, t) => {
|
|
1760
1840
|
O((n) => ({
|
|
1761
1841
|
...n,
|
|
1762
1842
|
[e]: t
|
|
@@ -1773,7 +1853,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1773
1853
|
if (!c || q.showHeader !== !1) return;
|
|
1774
1854
|
let e = "objectui:record:inline-edit-toggle", t = (e) => {
|
|
1775
1855
|
let t = e.detail;
|
|
1776
|
-
t?.recordId && q.recordId && t.recordId !== q.recordId || t?.objectName && q.objectName && t.objectName !== q.objectName ||
|
|
1856
|
+
t?.recordId && q.recordId && t.recordId !== q.recordId || t?.objectName && q.objectName && t.objectName !== q.objectName || Te();
|
|
1777
1857
|
};
|
|
1778
1858
|
return window.addEventListener(e, t), () => window.removeEventListener(e, t);
|
|
1779
1859
|
}, [
|
|
@@ -1781,30 +1861,30 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1781
1861
|
q.showHeader,
|
|
1782
1862
|
q.recordId,
|
|
1783
1863
|
q.objectName,
|
|
1784
|
-
|
|
1864
|
+
Te
|
|
1785
1865
|
]);
|
|
1786
|
-
let
|
|
1866
|
+
let De = n.useMemo(() => q.related ?? [], [q.related]), Oe = n.useMemo(() => {
|
|
1787
1867
|
let e = [];
|
|
1788
1868
|
return e.push({
|
|
1789
1869
|
name: "sys_share",
|
|
1790
1870
|
label: G("detail.share"),
|
|
1791
1871
|
icon: "share-2",
|
|
1792
1872
|
type: "script",
|
|
1793
|
-
onClick:
|
|
1873
|
+
onClick: xe
|
|
1794
1874
|
}), q.showEdit && e.push({
|
|
1795
1875
|
name: "sys_edit_mobile",
|
|
1796
1876
|
label: G("detail.edit"),
|
|
1797
1877
|
icon: "edit",
|
|
1798
1878
|
type: "script",
|
|
1799
1879
|
className: "sm:hidden",
|
|
1800
|
-
onClick:
|
|
1880
|
+
onClick: ge
|
|
1801
1881
|
}), c && e.push({
|
|
1802
1882
|
name: "sys_toggle_inline_edit_mobile",
|
|
1803
1883
|
label: G(T ? "detail.save" : "detail.editInline"),
|
|
1804
1884
|
icon: "edit",
|
|
1805
1885
|
type: "script",
|
|
1806
1886
|
className: "sm:hidden",
|
|
1807
|
-
onClick:
|
|
1887
|
+
onClick: Te
|
|
1808
1888
|
}), q.showDelete && e.push({
|
|
1809
1889
|
name: "sys_delete",
|
|
1810
1890
|
label: G("detail.delete"),
|
|
@@ -1812,7 +1892,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1812
1892
|
type: "script",
|
|
1813
1893
|
variant: "destructive",
|
|
1814
1894
|
tags: ["separator-before"],
|
|
1815
|
-
onClick:
|
|
1895
|
+
onClick: be
|
|
1816
1896
|
}), e;
|
|
1817
1897
|
}, [
|
|
1818
1898
|
G,
|
|
@@ -1820,13 +1900,13 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1820
1900
|
q.showDelete,
|
|
1821
1901
|
c,
|
|
1822
1902
|
T,
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
]),
|
|
1903
|
+
xe,
|
|
1904
|
+
ge,
|
|
1905
|
+
Te,
|
|
1906
|
+
be
|
|
1907
|
+
]), ke = n.useMemo(() => {
|
|
1828
1908
|
let e = q.actions ?? [];
|
|
1829
|
-
if (
|
|
1909
|
+
if (Oe.length === 0) return e;
|
|
1830
1910
|
let t = !1, n = e.map((e) => {
|
|
1831
1911
|
let n = e;
|
|
1832
1912
|
if (n && typeof n == "object" && n.type === "action:bar" && (!n.location || n.location === "record_header")) {
|
|
@@ -1834,7 +1914,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1834
1914
|
let e = Array.isArray(n.systemActions) ? n.systemActions : [];
|
|
1835
1915
|
return {
|
|
1836
1916
|
...n,
|
|
1837
|
-
systemActions: [...e, ...
|
|
1917
|
+
systemActions: [...e, ...Oe]
|
|
1838
1918
|
};
|
|
1839
1919
|
}
|
|
1840
1920
|
return e;
|
|
@@ -1842,9 +1922,9 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1842
1922
|
return t || n.push({
|
|
1843
1923
|
type: "action:bar",
|
|
1844
1924
|
location: "record_header",
|
|
1845
|
-
systemActions:
|
|
1925
|
+
systemActions: Oe
|
|
1846
1926
|
}), n;
|
|
1847
|
-
}, [q.actions,
|
|
1927
|
+
}, [q.actions, Oe]);
|
|
1848
1928
|
return b || q.loading ? /* @__PURE__ */ Q("div", {
|
|
1849
1929
|
className: W("space-y-4", i),
|
|
1850
1930
|
children: [
|
|
@@ -1866,35 +1946,35 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1866
1946
|
(q.showBack ?? !0) && /* @__PURE__ */ Q(y, {
|
|
1867
1947
|
variant: "outline",
|
|
1868
1948
|
size: "sm",
|
|
1869
|
-
onClick:
|
|
1949
|
+
onClick: he,
|
|
1870
1950
|
className: "mt-4 gap-2",
|
|
1871
1951
|
children: [/* @__PURE__ */ Z(se, { className: "h-4 w-4" }), G("detail.goBack")]
|
|
1872
1952
|
})
|
|
1873
1953
|
]
|
|
1874
|
-
}) : /* @__PURE__ */ Z(
|
|
1954
|
+
}) : /* @__PURE__ */ Z(ie, { children: /* @__PURE__ */ Q("div", {
|
|
1875
1955
|
className: W("space-y-6", i),
|
|
1876
1956
|
children: [
|
|
1877
1957
|
q.showHeader !== !1 && /* @__PURE__ */ Q("div", {
|
|
1878
1958
|
className: "flex flex-col sm:flex-row items-start justify-between gap-3 sm:gap-4 pb-4 border-b",
|
|
1879
1959
|
children: [/* @__PURE__ */ Q("div", {
|
|
1880
1960
|
className: "flex items-start gap-2 sm:gap-3 flex-1 min-w-0",
|
|
1881
|
-
children: [(q.showBack ?? !0) && /* @__PURE__ */ Q(
|
|
1961
|
+
children: [(q.showBack ?? !0) && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
1882
1962
|
asChild: !0,
|
|
1883
1963
|
children: /* @__PURE__ */ Z(y, {
|
|
1884
1964
|
variant: "ghost",
|
|
1885
1965
|
size: "icon",
|
|
1886
|
-
onClick:
|
|
1966
|
+
onClick: he,
|
|
1887
1967
|
className: "shrink-0 mt-1",
|
|
1888
1968
|
children: /* @__PURE__ */ Z(se, { className: "h-4 w-4" })
|
|
1889
1969
|
})
|
|
1890
|
-
}), /* @__PURE__ */ Z(
|
|
1970
|
+
}), /* @__PURE__ */ Z(V, { children: G("detail.back") })] }), /* @__PURE__ */ Q("div", {
|
|
1891
1971
|
className: "flex-1 min-w-0",
|
|
1892
1972
|
children: [/* @__PURE__ */ Q("div", {
|
|
1893
1973
|
className: "flex items-center gap-2 flex-wrap",
|
|
1894
1974
|
children: [
|
|
1895
1975
|
/* @__PURE__ */ Z("h1", {
|
|
1896
1976
|
className: "text-xl sm:text-2xl font-bold truncate",
|
|
1897
|
-
children:
|
|
1977
|
+
children: gn(g, q, N, G("detail.details"))
|
|
1898
1978
|
}),
|
|
1899
1979
|
fe.map((e) => {
|
|
1900
1980
|
let t = g?.[e];
|
|
@@ -1904,7 +1984,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1904
1984
|
if (i === "currency") {
|
|
1905
1985
|
let e = Number(t);
|
|
1906
1986
|
if (!Number.isNaN(e)) {
|
|
1907
|
-
let t =
|
|
1987
|
+
let t = Et({
|
|
1908
1988
|
...r,
|
|
1909
1989
|
...n
|
|
1910
1990
|
}, ce);
|
|
@@ -1936,7 +2016,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1936
2016
|
let e = i[String(t)];
|
|
1937
2017
|
e?.label && (o = e.label);
|
|
1938
2018
|
}
|
|
1939
|
-
a = q.objectName ?
|
|
2019
|
+
a = q.objectName ? le(q.objectName, e, String(t), o) : o;
|
|
1940
2020
|
}
|
|
1941
2021
|
} catch {}
|
|
1942
2022
|
return o === null ? /* @__PURE__ */ Z(v, {
|
|
@@ -1958,24 +2038,24 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1958
2038
|
}), a]
|
|
1959
2039
|
}, e);
|
|
1960
2040
|
}),
|
|
1961
|
-
/* @__PURE__ */ Q(
|
|
2041
|
+
/* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
1962
2042
|
asChild: !0,
|
|
1963
2043
|
children: /* @__PURE__ */ Z(y, {
|
|
1964
2044
|
variant: "ghost",
|
|
1965
2045
|
size: "icon",
|
|
1966
2046
|
className: "h-6 w-6 shrink-0",
|
|
1967
|
-
onClick:
|
|
2047
|
+
onClick: Se,
|
|
1968
2048
|
"aria-label": G(w ? "detail.removeFromFavorites" : "detail.addToFavorites"),
|
|
1969
2049
|
children: w ? /* @__PURE__ */ Z(Ze, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z(Ze, { className: "h-4 w-4 text-muted-foreground" })
|
|
1970
2050
|
})
|
|
1971
|
-
}), /* @__PURE__ */ Z(
|
|
2051
|
+
}), /* @__PURE__ */ Z(V, { children: G(w ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
|
|
1972
2052
|
]
|
|
1973
2053
|
}), q.objectName && /* @__PURE__ */ Q("p", {
|
|
1974
2054
|
className: "text-sm text-muted-foreground mt-1 flex items-center gap-1",
|
|
1975
2055
|
children: [/* @__PURE__ */ Z("span", {
|
|
1976
2056
|
className: "font-medium",
|
|
1977
2057
|
children: f || q.objectName
|
|
1978
|
-
}), q.resourceId && /* @__PURE__ */ Q(
|
|
2058
|
+
}), q.resourceId && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
1979
2059
|
asChild: !0,
|
|
1980
2060
|
children: /* @__PURE__ */ Z(y, {
|
|
1981
2061
|
variant: "ghost",
|
|
@@ -1983,9 +2063,9 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1983
2063
|
className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
|
|
1984
2064
|
onClick: pe,
|
|
1985
2065
|
"aria-label": G("detail.copyRecordId", { defaultValue: "Copy record ID" }),
|
|
1986
|
-
children: P ? /* @__PURE__ */ Z(
|
|
2066
|
+
children: P ? /* @__PURE__ */ Z(me, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Ce, { className: "h-3 w-3" })
|
|
1987
2067
|
})
|
|
1988
|
-
}), /* @__PURE__ */ Z(
|
|
2068
|
+
}), /* @__PURE__ */ Z(V, { children: P ? G("detail.copied", { defaultValue: "Copied" }) : G("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
|
|
1989
2069
|
})]
|
|
1990
2070
|
})]
|
|
1991
2071
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -1994,7 +2074,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1994
2074
|
q.recordNavigation && /* @__PURE__ */ Q("div", {
|
|
1995
2075
|
className: "flex items-center gap-1 mr-2",
|
|
1996
2076
|
children: [
|
|
1997
|
-
/* @__PURE__ */ Q(
|
|
2077
|
+
/* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
1998
2078
|
asChild: !0,
|
|
1999
2079
|
children: /* @__PURE__ */ Z(y, {
|
|
2000
2080
|
variant: "outline",
|
|
@@ -2005,9 +2085,9 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2005
2085
|
let e = q.recordNavigation;
|
|
2006
2086
|
e.currentIndex > 0 && e.onNavigate(e.recordIds[e.currentIndex - 1]);
|
|
2007
2087
|
},
|
|
2008
|
-
children: /* @__PURE__ */ Z(
|
|
2088
|
+
children: /* @__PURE__ */ Z(_e, { className: "h-4 w-4" })
|
|
2009
2089
|
})
|
|
2010
|
-
}), /* @__PURE__ */ Z(
|
|
2090
|
+
}), /* @__PURE__ */ Z(V, { children: G("detail.previousRecord") })] }),
|
|
2011
2091
|
/* @__PURE__ */ Z("span", {
|
|
2012
2092
|
className: "text-xs text-muted-foreground whitespace-nowrap px-1",
|
|
2013
2093
|
children: G("detail.recordOf", {
|
|
@@ -2015,7 +2095,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2015
2095
|
total: q.recordNavigation.recordIds.length
|
|
2016
2096
|
})
|
|
2017
2097
|
}),
|
|
2018
|
-
/* @__PURE__ */ Q(
|
|
2098
|
+
/* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2019
2099
|
asChild: !0,
|
|
2020
2100
|
children: /* @__PURE__ */ Z(y, {
|
|
2021
2101
|
variant: "outline",
|
|
@@ -2026,52 +2106,52 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2026
2106
|
let e = q.recordNavigation;
|
|
2027
2107
|
e.currentIndex < e.recordIds.length - 1 && e.onNavigate(e.recordIds[e.currentIndex + 1]);
|
|
2028
2108
|
},
|
|
2029
|
-
children: /* @__PURE__ */ Z(
|
|
2109
|
+
children: /* @__PURE__ */ Z(ve, { className: "h-4 w-4" })
|
|
2030
2110
|
})
|
|
2031
|
-
}), /* @__PURE__ */ Z(
|
|
2111
|
+
}), /* @__PURE__ */ Z(V, { children: G("detail.nextRecord") })] })
|
|
2032
2112
|
]
|
|
2033
2113
|
}),
|
|
2034
|
-
c && /* @__PURE__ */ Q(
|
|
2114
|
+
c && /* @__PURE__ */ Q(Ct, { children: [T && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2035
2115
|
asChild: !0,
|
|
2036
2116
|
children: /* @__PURE__ */ Q(y, {
|
|
2037
2117
|
variant: "ghost",
|
|
2038
2118
|
size: "sm",
|
|
2039
|
-
onClick:
|
|
2119
|
+
onClick: Ee,
|
|
2040
2120
|
className: "gap-2 hidden sm:inline-flex",
|
|
2041
2121
|
children: [/* @__PURE__ */ Z(et, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2042
2122
|
className: "hidden sm:inline",
|
|
2043
2123
|
children: G("detail.cancel")
|
|
2044
2124
|
})]
|
|
2045
2125
|
})
|
|
2046
|
-
}), /* @__PURE__ */ Z(
|
|
2126
|
+
}), /* @__PURE__ */ Z(V, { children: G("detail.cancelEdit") })] }), /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2047
2127
|
asChild: !0,
|
|
2048
2128
|
children: /* @__PURE__ */ Z(y, {
|
|
2049
2129
|
variant: T ? "default" : "outline",
|
|
2050
2130
|
size: "sm",
|
|
2051
|
-
onClick:
|
|
2131
|
+
onClick: Te,
|
|
2052
2132
|
className: "gap-2 hidden sm:inline-flex",
|
|
2053
|
-
children: T ? /* @__PURE__ */ Q(
|
|
2133
|
+
children: T ? /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Z(me, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2054
2134
|
className: "hidden sm:inline",
|
|
2055
2135
|
children: G("detail.save")
|
|
2056
|
-
})] }) : /* @__PURE__ */ Q(
|
|
2136
|
+
})] }) : /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Z(we, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2057
2137
|
className: "hidden sm:inline",
|
|
2058
2138
|
children: G("detail.editInline")
|
|
2059
2139
|
})] })
|
|
2060
2140
|
})
|
|
2061
|
-
}), /* @__PURE__ */ Z(
|
|
2062
|
-
q.showEdit && /* @__PURE__ */ Q(
|
|
2141
|
+
}), /* @__PURE__ */ Z(V, { children: G(T ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
|
|
2142
|
+
q.showEdit && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2063
2143
|
asChild: !0,
|
|
2064
2144
|
children: /* @__PURE__ */ Q(y, {
|
|
2065
2145
|
variant: "default",
|
|
2066
|
-
onClick:
|
|
2146
|
+
onClick: ge,
|
|
2067
2147
|
className: "gap-2 hidden sm:inline-flex",
|
|
2068
|
-
children: [/* @__PURE__ */ Z(
|
|
2148
|
+
children: [/* @__PURE__ */ Z(we, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2069
2149
|
className: "hidden sm:inline",
|
|
2070
2150
|
children: G("detail.edit")
|
|
2071
2151
|
})]
|
|
2072
2152
|
})
|
|
2073
|
-
}), /* @__PURE__ */ Z(
|
|
2074
|
-
|
|
2153
|
+
}), /* @__PURE__ */ Z(V, { children: G("detail.editRecord") })] }),
|
|
2154
|
+
ke.map((e, t) => /* @__PURE__ */ Z(rt, {
|
|
2075
2155
|
schema: e,
|
|
2076
2156
|
data: g
|
|
2077
2157
|
}, `header-action-${t}`))
|
|
@@ -2082,7 +2162,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2082
2162
|
schema: q.header,
|
|
2083
2163
|
data: g
|
|
2084
2164
|
}) }),
|
|
2085
|
-
q.highlightFields && q.highlightFields.length > 0 && /* @__PURE__ */ Z(
|
|
2165
|
+
q.highlightFields && q.highlightFields.length > 0 && /* @__PURE__ */ Z(Gt, {
|
|
2086
2166
|
fields: q.highlightFields,
|
|
2087
2167
|
data: g,
|
|
2088
2168
|
objectName: q.objectName,
|
|
@@ -2095,24 +2175,24 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2095
2175
|
children: [/* @__PURE__ */ Q("div", {
|
|
2096
2176
|
className: "flex items-center justify-end gap-2",
|
|
2097
2177
|
children: [
|
|
2098
|
-
t && !T && /* @__PURE__ */ Q(
|
|
2178
|
+
t && !T && /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Q("span", {
|
|
2099
2179
|
role: "status",
|
|
2100
2180
|
className: "inline-flex items-center gap-1 rounded-md border border-amber-300 bg-amber-50 px-2 py-1 text-xs text-amber-800",
|
|
2101
2181
|
title: G("detail.lockedTooltip"),
|
|
2102
|
-
children: [/* @__PURE__ */ Z(
|
|
2182
|
+
children: [/* @__PURE__ */ Z(Ie, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: G("detail.lockedByApproval") })]
|
|
2103
2183
|
}), r?.cancelPendingApproval && /* @__PURE__ */ Q(y, {
|
|
2104
2184
|
variant: "outline",
|
|
2105
2185
|
size: "sm",
|
|
2106
|
-
onClick:
|
|
2107
|
-
disabled:
|
|
2186
|
+
onClick: ye,
|
|
2187
|
+
disabled: U,
|
|
2108
2188
|
className: "gap-2 border-amber-300 text-amber-800 hover:bg-amber-50",
|
|
2109
2189
|
title: G("detail.cancelApprovalTooltip"),
|
|
2110
|
-
children: [/* @__PURE__ */ Z(et, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G(
|
|
2190
|
+
children: [/* @__PURE__ */ Z(et, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G(U ? "detail.cancelApprovalInFlight" : "detail.cancelApproval") })]
|
|
2111
2191
|
})] }),
|
|
2112
2192
|
T && /* @__PURE__ */ Q(y, {
|
|
2113
2193
|
variant: "ghost",
|
|
2114
2194
|
size: "sm",
|
|
2115
|
-
onClick:
|
|
2195
|
+
onClick: Ee,
|
|
2116
2196
|
className: "gap-2",
|
|
2117
2197
|
disabled: k,
|
|
2118
2198
|
children: [/* @__PURE__ */ Z(et, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G("detail.cancel") })]
|
|
@@ -2120,11 +2200,11 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2120
2200
|
/* @__PURE__ */ Q(y, {
|
|
2121
2201
|
variant: T ? "default" : "outline",
|
|
2122
2202
|
size: "sm",
|
|
2123
|
-
onClick:
|
|
2203
|
+
onClick: Te,
|
|
2124
2204
|
className: "gap-2",
|
|
2125
2205
|
disabled: k || t && !T,
|
|
2126
2206
|
title: t && !T ? G("detail.lockedTooltip") : void 0,
|
|
2127
|
-
children: [Z(T ?
|
|
2207
|
+
children: [Z(T ? me : we, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G(k ? "detail.saving" : T ? "detail.save" : "detail.editFieldsInline") })]
|
|
2128
2208
|
})
|
|
2129
2209
|
]
|
|
2130
2210
|
}), j && /* @__PURE__ */ Z("div", {
|
|
@@ -2135,10 +2215,10 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2135
2215
|
});
|
|
2136
2216
|
})(),
|
|
2137
2217
|
q.autoTabs && !q.tabs?.length ? (() => {
|
|
2138
|
-
let e =
|
|
2218
|
+
let e = De.length > 0, t = !!q.activities && q.activities.length > 0, n = !!u, i = !!q.history, a = /* @__PURE__ */ Q("div", {
|
|
2139
2219
|
className: "space-y-3 sm:space-y-4",
|
|
2140
2220
|
children: [
|
|
2141
|
-
q.sectionGroups && q.sectionGroups.length > 0 && q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(
|
|
2221
|
+
q.sectionGroups && q.sectionGroups.length > 0 && q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Wt, {
|
|
2142
2222
|
group: e,
|
|
2143
2223
|
data: {
|
|
2144
2224
|
...g,
|
|
@@ -2147,9 +2227,10 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2147
2227
|
objectSchema: N,
|
|
2148
2228
|
objectName: q.objectName,
|
|
2149
2229
|
isEditing: T,
|
|
2150
|
-
onFieldChange:
|
|
2230
|
+
onFieldChange: J,
|
|
2231
|
+
dataSource: r
|
|
2151
2232
|
}, t)),
|
|
2152
|
-
q.sections && q.sections.length > 0 && q.sections.map((e, t) => /* @__PURE__ */ Z(
|
|
2233
|
+
q.sections && q.sections.length > 0 && q.sections.map((e, t) => /* @__PURE__ */ Z(Bt, {
|
|
2153
2234
|
section: e,
|
|
2154
2235
|
data: {
|
|
2155
2236
|
...g,
|
|
@@ -2158,9 +2239,10 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2158
2239
|
objectSchema: N,
|
|
2159
2240
|
objectName: q.objectName,
|
|
2160
2241
|
isEditing: T,
|
|
2161
|
-
onFieldChange:
|
|
2242
|
+
onFieldChange: J,
|
|
2243
|
+
dataSource: r
|
|
2162
2244
|
}, t)),
|
|
2163
|
-
q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(
|
|
2245
|
+
q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(Bt, {
|
|
2164
2246
|
section: {
|
|
2165
2247
|
fields: q.fields,
|
|
2166
2248
|
columns: q.columns
|
|
@@ -2172,9 +2254,10 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2172
2254
|
objectSchema: N,
|
|
2173
2255
|
objectName: q.objectName,
|
|
2174
2256
|
isEditing: T,
|
|
2175
|
-
onFieldChange:
|
|
2257
|
+
onFieldChange: J,
|
|
2258
|
+
dataSource: r
|
|
2176
2259
|
}),
|
|
2177
|
-
q.comments && /* @__PURE__ */ Z(
|
|
2260
|
+
q.comments && /* @__PURE__ */ Z(qt, {
|
|
2178
2261
|
comments: q.comments,
|
|
2179
2262
|
onAddComment: q.onAddComment
|
|
2180
2263
|
})
|
|
@@ -2187,15 +2270,15 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2187
2270
|
defaultValue: "details",
|
|
2188
2271
|
className: "w-full",
|
|
2189
2272
|
children: [
|
|
2190
|
-
/* @__PURE__ */ Q(
|
|
2273
|
+
/* @__PURE__ */ Q(R, {
|
|
2191
2274
|
className: "w-full justify-start border-b rounded-none bg-transparent p-0",
|
|
2192
2275
|
children: [
|
|
2193
|
-
/* @__PURE__ */ Z(
|
|
2276
|
+
/* @__PURE__ */ Z(z, {
|
|
2194
2277
|
value: "details",
|
|
2195
2278
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2196
2279
|
children: G("detail.details")
|
|
2197
2280
|
}),
|
|
2198
|
-
e && /* @__PURE__ */ Z(
|
|
2281
|
+
e && /* @__PURE__ */ Z(z, {
|
|
2199
2282
|
value: "related",
|
|
2200
2283
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2201
2284
|
children: /* @__PURE__ */ Q("span", {
|
|
@@ -2203,11 +2286,11 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2203
2286
|
children: [G("detail.related"), /* @__PURE__ */ Z(v, {
|
|
2204
2287
|
variant: "secondary",
|
|
2205
2288
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2206
|
-
children:
|
|
2289
|
+
children: De.length
|
|
2207
2290
|
})]
|
|
2208
2291
|
})
|
|
2209
2292
|
}),
|
|
2210
|
-
t && /* @__PURE__ */ Z(
|
|
2293
|
+
t && /* @__PURE__ */ Z(z, {
|
|
2211
2294
|
value: "activity",
|
|
2212
2295
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2213
2296
|
children: /* @__PURE__ */ Q("span", {
|
|
@@ -2219,12 +2302,12 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2219
2302
|
})]
|
|
2220
2303
|
})
|
|
2221
2304
|
}),
|
|
2222
|
-
n && /* @__PURE__ */ Z(
|
|
2305
|
+
n && /* @__PURE__ */ Z(z, {
|
|
2223
2306
|
value: "discussion",
|
|
2224
2307
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2225
2308
|
children: G("detail.discussion", { defaultValue: "Discussion" })
|
|
2226
2309
|
}),
|
|
2227
|
-
i && /* @__PURE__ */ Z(
|
|
2310
|
+
i && /* @__PURE__ */ Z(z, {
|
|
2228
2311
|
value: "history",
|
|
2229
2312
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2230
2313
|
children: /* @__PURE__ */ Q("span", {
|
|
@@ -2238,17 +2321,17 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2238
2321
|
})
|
|
2239
2322
|
]
|
|
2240
2323
|
}),
|
|
2241
|
-
/* @__PURE__ */ Z(
|
|
2324
|
+
/* @__PURE__ */ Z(re, {
|
|
2242
2325
|
value: "details",
|
|
2243
2326
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2244
2327
|
children: a
|
|
2245
2328
|
}),
|
|
2246
|
-
e && /* @__PURE__ */ Z(
|
|
2329
|
+
e && /* @__PURE__ */ Z(re, {
|
|
2247
2330
|
value: "related",
|
|
2248
2331
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2249
2332
|
children: /* @__PURE__ */ Z("div", {
|
|
2250
2333
|
className: "space-y-3",
|
|
2251
|
-
children:
|
|
2334
|
+
children: De.map((e, t) => /* @__PURE__ */ Z(Ut, {
|
|
2252
2335
|
title: e.title,
|
|
2253
2336
|
type: e.type,
|
|
2254
2337
|
api: e.api,
|
|
@@ -2264,25 +2347,25 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2264
2347
|
onRowEdit: e.onRowEdit,
|
|
2265
2348
|
onRowDelete: e.onRowDelete,
|
|
2266
2349
|
collapsible: !0,
|
|
2267
|
-
defaultCollapsed:
|
|
2268
|
-
pageSize:
|
|
2350
|
+
defaultCollapsed: ue && t > 0,
|
|
2351
|
+
pageSize: hn
|
|
2269
2352
|
}, t))
|
|
2270
2353
|
})
|
|
2271
2354
|
}),
|
|
2272
|
-
t && /* @__PURE__ */ Z(
|
|
2355
|
+
t && /* @__PURE__ */ Z(re, {
|
|
2273
2356
|
value: "activity",
|
|
2274
2357
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2275
|
-
children: /* @__PURE__ */ Z(
|
|
2358
|
+
children: /* @__PURE__ */ Z($t, { activities: q.activities })
|
|
2276
2359
|
}),
|
|
2277
|
-
n && /* @__PURE__ */ Z(
|
|
2360
|
+
n && /* @__PURE__ */ Z(re, {
|
|
2278
2361
|
value: "discussion",
|
|
2279
2362
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2280
2363
|
children: u
|
|
2281
2364
|
}),
|
|
2282
|
-
i && /* @__PURE__ */ Z(
|
|
2365
|
+
i && /* @__PURE__ */ Z(re, {
|
|
2283
2366
|
value: "history",
|
|
2284
2367
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2285
|
-
children: /* @__PURE__ */ Z(
|
|
2368
|
+
children: /* @__PURE__ */ Z(sn, {
|
|
2286
2369
|
entries: q.history.entries,
|
|
2287
2370
|
loading: q.history.loading,
|
|
2288
2371
|
emptyText: q.history.emptyText ?? G("detail.historyEmpty", { defaultValue: "No history yet" })
|
|
@@ -2290,10 +2373,10 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2290
2373
|
})
|
|
2291
2374
|
]
|
|
2292
2375
|
});
|
|
2293
|
-
})() : /* @__PURE__ */ Q(
|
|
2376
|
+
})() : /* @__PURE__ */ Q(Ct, { children: [
|
|
2294
2377
|
q.sectionGroups && q.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2295
2378
|
className: "space-y-3 sm:space-y-4",
|
|
2296
|
-
children: q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(
|
|
2379
|
+
children: q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Wt, {
|
|
2297
2380
|
group: e,
|
|
2298
2381
|
data: {
|
|
2299
2382
|
...g,
|
|
@@ -2302,12 +2385,13 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2302
2385
|
objectSchema: N,
|
|
2303
2386
|
objectName: q.objectName,
|
|
2304
2387
|
isEditing: T,
|
|
2305
|
-
onFieldChange:
|
|
2388
|
+
onFieldChange: J,
|
|
2389
|
+
dataSource: r
|
|
2306
2390
|
}, t))
|
|
2307
2391
|
}),
|
|
2308
2392
|
q.sections && q.sections.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2309
2393
|
className: "space-y-3 sm:space-y-4",
|
|
2310
|
-
children: q.sections.map((e, t) => /* @__PURE__ */ Z(
|
|
2394
|
+
children: q.sections.map((e, t) => /* @__PURE__ */ Z(Bt, {
|
|
2311
2395
|
section: e,
|
|
2312
2396
|
data: {
|
|
2313
2397
|
...g,
|
|
@@ -2316,10 +2400,11 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2316
2400
|
objectSchema: N,
|
|
2317
2401
|
objectName: q.objectName,
|
|
2318
2402
|
isEditing: T,
|
|
2319
|
-
onFieldChange:
|
|
2403
|
+
onFieldChange: J,
|
|
2404
|
+
dataSource: r
|
|
2320
2405
|
}, t))
|
|
2321
2406
|
}),
|
|
2322
|
-
q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(
|
|
2407
|
+
q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(Bt, {
|
|
2323
2408
|
section: {
|
|
2324
2409
|
fields: q.fields,
|
|
2325
2410
|
columns: q.columns
|
|
@@ -2331,18 +2416,19 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2331
2416
|
objectSchema: N,
|
|
2332
2417
|
objectName: q.objectName,
|
|
2333
2418
|
isEditing: T,
|
|
2334
|
-
onFieldChange:
|
|
2419
|
+
onFieldChange: J,
|
|
2420
|
+
dataSource: r
|
|
2335
2421
|
}),
|
|
2336
|
-
q.tabs && q.tabs.length > 0 && /* @__PURE__ */ Z(
|
|
2422
|
+
q.tabs && q.tabs.length > 0 && /* @__PURE__ */ Z(Vt, {
|
|
2337
2423
|
tabs: q.tabs,
|
|
2338
2424
|
data: g
|
|
2339
2425
|
}),
|
|
2340
|
-
|
|
2426
|
+
De.length > 0 && /* @__PURE__ */ Q("div", {
|
|
2341
2427
|
className: "space-y-3",
|
|
2342
2428
|
children: [/* @__PURE__ */ Z("h2", {
|
|
2343
2429
|
className: "text-lg font-semibold",
|
|
2344
2430
|
children: G("detail.related")
|
|
2345
|
-
}),
|
|
2431
|
+
}), De.map((e, t) => /* @__PURE__ */ Z(Ut, {
|
|
2346
2432
|
title: e.title,
|
|
2347
2433
|
type: e.type,
|
|
2348
2434
|
api: e.api,
|
|
@@ -2358,17 +2444,17 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2358
2444
|
onRowEdit: e.onRowEdit,
|
|
2359
2445
|
onRowDelete: e.onRowDelete,
|
|
2360
2446
|
collapsible: !0,
|
|
2361
|
-
defaultCollapsed:
|
|
2362
|
-
pageSize:
|
|
2447
|
+
defaultCollapsed: ue && t > 0,
|
|
2448
|
+
pageSize: hn
|
|
2363
2449
|
}, t))]
|
|
2364
2450
|
}),
|
|
2365
|
-
q.comments && /* @__PURE__ */ Z(
|
|
2451
|
+
q.comments && /* @__PURE__ */ Z(qt, {
|
|
2366
2452
|
comments: q.comments,
|
|
2367
2453
|
onAddComment: q.onAddComment
|
|
2368
2454
|
}),
|
|
2369
|
-
q.activities && q.activities.length > 0 && /* @__PURE__ */ Z(
|
|
2455
|
+
q.activities && q.activities.length > 0 && /* @__PURE__ */ Z($t, { activities: q.activities })
|
|
2370
2456
|
] }),
|
|
2371
|
-
/* @__PURE__ */ Z(
|
|
2457
|
+
/* @__PURE__ */ Z(mn, {
|
|
2372
2458
|
data: {
|
|
2373
2459
|
...g,
|
|
2374
2460
|
...D
|
|
@@ -2382,7 +2468,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2382
2468
|
}) })
|
|
2383
2469
|
]
|
|
2384
2470
|
}) });
|
|
2385
|
-
},
|
|
2471
|
+
}, vn = (e) => {
|
|
2386
2472
|
if (e == null) return "—";
|
|
2387
2473
|
if (typeof e == "string") return e.length > 0 ? e : "\"\"";
|
|
2388
2474
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -2391,7 +2477,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2391
2477
|
} catch {
|
|
2392
2478
|
return String(e);
|
|
2393
2479
|
}
|
|
2394
|
-
},
|
|
2480
|
+
}, yn = (e) => {
|
|
2395
2481
|
if (typeof e != "string" || e.length === 0) return null;
|
|
2396
2482
|
let t = /\d{4}-\d{2}-\d{2}[ T]/.test(e) ? e.replace(" ", "T") : e, n = new Date(t);
|
|
2397
2483
|
if (Number.isNaN(n.getTime())) return null;
|
|
@@ -2400,13 +2486,13 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2400
2486
|
} catch {
|
|
2401
2487
|
return n.toISOString();
|
|
2402
2488
|
}
|
|
2403
|
-
},
|
|
2404
|
-
let { t: s } = $(), c = t?.label || t?.field || "", m = t ?
|
|
2489
|
+
}, bn = ({ open: e, conflict: t, onReload: n, onOverwrite: r, onCancel: i, busy: a = !1 }) => {
|
|
2490
|
+
let { t: s } = $(), c = t?.label || t?.field || "", m = t ? vn(t.pendingValue) : "", h = t ? vn(t.currentValue) : "", g = t?.currentRecord ?? {}, _ = (() => {
|
|
2405
2491
|
let e = [g.updated_by_name, g.updated_by_label];
|
|
2406
2492
|
for (let t of e) if (typeof t == "string" && t.length > 0) return t;
|
|
2407
2493
|
let t = g.updated_by;
|
|
2408
2494
|
return typeof t != "string" || t.length === 0 || t.length >= 16 && !/\s/.test(t) && /^[A-Za-z0-9_-]+$/.test(t) ? null : t;
|
|
2409
|
-
})(), v =
|
|
2495
|
+
})(), v = yn(g.updated_at ?? t?.currentVersion), [y, b] = s("detail.concurrentUpdateDescription", { field: "{{field}}" }).split("{{field}}");
|
|
2410
2496
|
return /* @__PURE__ */ Z(o, {
|
|
2411
2497
|
open: e,
|
|
2412
2498
|
onOpenChange: (e) => {
|
|
@@ -2475,14 +2561,14 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2475
2561
|
type: "button",
|
|
2476
2562
|
disabled: a,
|
|
2477
2563
|
onClick: i,
|
|
2478
|
-
className: W(
|
|
2564
|
+
className: W(U({ variant: "ghost" }), "mt-2 sm:mt-0"),
|
|
2479
2565
|
children: s("detail.concurrentUpdateCancel")
|
|
2480
2566
|
}),
|
|
2481
2567
|
/* @__PURE__ */ Z("button", {
|
|
2482
2568
|
type: "button",
|
|
2483
2569
|
disabled: a,
|
|
2484
2570
|
onClick: r,
|
|
2485
|
-
className: W(
|
|
2571
|
+
className: W(U({ variant: "outline" }), "mt-2 sm:mt-0 text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive"),
|
|
2486
2572
|
children: s("detail.concurrentUpdateOverwrite")
|
|
2487
2573
|
}),
|
|
2488
2574
|
/* @__PURE__ */ Z("button", {
|
|
@@ -2490,7 +2576,7 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2490
2576
|
disabled: a,
|
|
2491
2577
|
onClick: n,
|
|
2492
2578
|
autoFocus: !0,
|
|
2493
|
-
className: W(
|
|
2579
|
+
className: W(U({ variant: "default" }), "mt-2 sm:mt-0"),
|
|
2494
2580
|
children: s("detail.concurrentUpdateReload")
|
|
2495
2581
|
})
|
|
2496
2582
|
]
|
|
@@ -2499,14 +2585,14 @@ var dn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2499
2585
|
})
|
|
2500
2586
|
});
|
|
2501
2587
|
};
|
|
2502
|
-
function
|
|
2588
|
+
function xn(e) {
|
|
2503
2589
|
if (!e || typeof e != "object") return !1;
|
|
2504
2590
|
let t = e;
|
|
2505
2591
|
return t.code === "CONCURRENT_UPDATE" || t.name === "ConcurrentUpdateError";
|
|
2506
2592
|
}
|
|
2507
2593
|
//#endregion
|
|
2508
2594
|
//#region src/renderers/record-details.tsx
|
|
2509
|
-
var
|
|
2595
|
+
var Sn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name) || null, Cn = (e) => {
|
|
2510
2596
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2511
2597
|
return {
|
|
2512
2598
|
designer: {
|
|
@@ -2516,8 +2602,8 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2516
2602
|
},
|
|
2517
2603
|
rest: i
|
|
2518
2604
|
};
|
|
2519
|
-
},
|
|
2520
|
-
let i = dt(), { designer: a } =
|
|
2605
|
+
}, wn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2606
|
+
let i = dt(), { designer: a } = Cn(n);
|
|
2521
2607
|
if (!i) return /* @__PURE__ */ Z("div", {
|
|
2522
2608
|
className: t,
|
|
2523
2609
|
"data-record-details-placeholder": !0,
|
|
@@ -2527,7 +2613,7 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2527
2613
|
children: "record:details — bind a record to preview"
|
|
2528
2614
|
})
|
|
2529
2615
|
});
|
|
2530
|
-
let o = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", s = i.objectName || "", c =
|
|
2616
|
+
let o = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", s = i.objectName || "", c = Tt(), { readableFields: l } = wt(s), { sectionLabel: u } = pt(), d = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2531
2617
|
if (d.length > 0 && s && !d.every((e) => c.can(s, e))) return /* @__PURE__ */ Z("div", {
|
|
2532
2618
|
className: t,
|
|
2533
2619
|
...a,
|
|
@@ -2540,15 +2626,15 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2540
2626
|
});
|
|
2541
2627
|
let f = e.enforceFieldSecurity === !0, p = Array.isArray(e.redactFields) ? e.redactFields : [], m = (e) => {
|
|
2542
2628
|
if (!e || !f && p.length === 0) return e;
|
|
2543
|
-
let t = e.map(
|
|
2629
|
+
let t = e.map(Sn).filter((e) => !!e), n = new Set((f && s ? l(t) : t).filter((e) => !p.includes(e)));
|
|
2544
2630
|
return e.filter((e) => {
|
|
2545
|
-
let t =
|
|
2631
|
+
let t = Sn(e);
|
|
2546
2632
|
return t ? n.has(t) : !0;
|
|
2547
2633
|
});
|
|
2548
2634
|
}, h = (e) => typeof e == "string" ? { name: e } : e && typeof e == "object" && !e.name && e.field ? {
|
|
2549
2635
|
...e,
|
|
2550
2636
|
name: e.field
|
|
2551
|
-
} : e, g = (e) => Array.isArray(e) ? e.map(h) : e, _ = ct(), v = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e :
|
|
2637
|
+
} : e, g = (e) => Array.isArray(e) ? e.map(h) : e, _ = ct(), v = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e : Sn(e)).filter((e) => !!e));
|
|
2552
2638
|
for (let e of _) v.add(e);
|
|
2553
2639
|
let y = i.objectSchema, b = i.data ?? {}, x = [
|
|
2554
2640
|
y?.primaryField,
|
|
@@ -2564,7 +2650,7 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2564
2650
|
break;
|
|
2565
2651
|
}
|
|
2566
2652
|
let S = (e) => !e || v.size === 0 ? e : e.filter((e) => {
|
|
2567
|
-
let t =
|
|
2653
|
+
let t = Sn(e);
|
|
2568
2654
|
return t ? !v.has(t) : !0;
|
|
2569
2655
|
}), C = S(g(m(e.fields))), w = Array.isArray(e.sections) ? e.sections.map((e) => {
|
|
2570
2656
|
let t = e.title ?? e.label, n = e.name && s ? u(s, e.name, t ?? e.name) : t;
|
|
@@ -2592,7 +2678,7 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2592
2678
|
}
|
|
2593
2679
|
typeof i.refresh == "function" && await i.refresh();
|
|
2594
2680
|
} catch (n) {
|
|
2595
|
-
if (
|
|
2681
|
+
if (xn(n)) {
|
|
2596
2682
|
let r = n.currentRecord ?? null;
|
|
2597
2683
|
throw D({
|
|
2598
2684
|
field: e,
|
|
@@ -2663,12 +2749,12 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2663
2749
|
return /* @__PURE__ */ Q("div", {
|
|
2664
2750
|
className: t,
|
|
2665
2751
|
...a,
|
|
2666
|
-
children: [/* @__PURE__ */ Z(
|
|
2752
|
+
children: [/* @__PURE__ */ Z(_n, {
|
|
2667
2753
|
schema: P,
|
|
2668
2754
|
dataSource: i.dataSource,
|
|
2669
2755
|
inlineEdit: T,
|
|
2670
2756
|
onFieldSave: j
|
|
2671
|
-
}), /* @__PURE__ */ Z(
|
|
2757
|
+
}), /* @__PURE__ */ Z(bn, {
|
|
2672
2758
|
open: !!E,
|
|
2673
2759
|
conflict: E,
|
|
2674
2760
|
busy: O,
|
|
@@ -2677,7 +2763,7 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2677
2763
|
onOverwrite: ee
|
|
2678
2764
|
})]
|
|
2679
2765
|
});
|
|
2680
|
-
},
|
|
2766
|
+
}, Tn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name || e.key) || null, En = (e) => {
|
|
2681
2767
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2682
2768
|
return {
|
|
2683
2769
|
designer: {
|
|
@@ -2687,11 +2773,11 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2687
2773
|
},
|
|
2688
2774
|
rest: i
|
|
2689
2775
|
};
|
|
2690
|
-
},
|
|
2691
|
-
let r = dt(), { designer: i } =
|
|
2776
|
+
}, Dn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2777
|
+
let r = dt(), { designer: i } = En(n), a = pt(), o = e.objectName, s = o && a.objectLabel ? a.objectLabel({
|
|
2692
2778
|
name: o,
|
|
2693
|
-
label:
|
|
2694
|
-
}) : o ?
|
|
2779
|
+
label: xt(o)
|
|
2780
|
+
}) : o ? xt(o) : "", c = e.title || s || "Related";
|
|
2695
2781
|
if (!o) return /* @__PURE__ */ Z("div", {
|
|
2696
2782
|
className: t,
|
|
2697
2783
|
...i,
|
|
@@ -2700,7 +2786,7 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2700
2786
|
children: "record:related_list — missing objectName"
|
|
2701
2787
|
})
|
|
2702
2788
|
});
|
|
2703
|
-
let l =
|
|
2789
|
+
let l = Tt(), { readableFields: u } = wt(o), d = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2704
2790
|
if (d.length > 0 && !d.every((e) => l.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2705
2791
|
className: t,
|
|
2706
2792
|
...i,
|
|
@@ -2713,16 +2799,16 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2713
2799
|
});
|
|
2714
2800
|
let f = e.enforceFieldSecurity === !0, p = Array.isArray(e.redactFields) ? e.redactFields : [], m = Array.isArray(e.columns) ? e.columns : [], h = m;
|
|
2715
2801
|
if (f || p.length > 0) {
|
|
2716
|
-
let e = m.map(
|
|
2802
|
+
let e = m.map(Tn).filter((e) => !!e), t = new Set((f ? u(e) : e).filter((e) => !p.includes(e)));
|
|
2717
2803
|
h = m.filter((e) => {
|
|
2718
|
-
let n =
|
|
2804
|
+
let n = Tn(e);
|
|
2719
2805
|
return n ? t.has(n) : !0;
|
|
2720
2806
|
});
|
|
2721
2807
|
}
|
|
2722
2808
|
return /* @__PURE__ */ Z("div", {
|
|
2723
2809
|
className: t,
|
|
2724
2810
|
...i,
|
|
2725
|
-
children: /* @__PURE__ */ Z(
|
|
2811
|
+
children: /* @__PURE__ */ Z(Ut, {
|
|
2726
2812
|
title: c,
|
|
2727
2813
|
type: "table",
|
|
2728
2814
|
api: o,
|
|
@@ -2731,10 +2817,15 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2731
2817
|
parentId: r?.recordId,
|
|
2732
2818
|
columns: h,
|
|
2733
2819
|
pageSize: e.limit,
|
|
2734
|
-
dataSource: r?.dataSource
|
|
2820
|
+
dataSource: r?.dataSource,
|
|
2821
|
+
add: e.add,
|
|
2822
|
+
onRowDelete: e.add && r?.dataSource ? async (e) => {
|
|
2823
|
+
let t = e?.id ?? e?._id;
|
|
2824
|
+
t != null && await r.dataSource.delete?.(o, String(t));
|
|
2825
|
+
} : void 0
|
|
2735
2826
|
})
|
|
2736
2827
|
});
|
|
2737
|
-
},
|
|
2828
|
+
}, On = (e) => {
|
|
2738
2829
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2739
2830
|
return {
|
|
2740
2831
|
designer: {
|
|
@@ -2744,8 +2835,8 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2744
2835
|
},
|
|
2745
2836
|
rest: i
|
|
2746
2837
|
};
|
|
2747
|
-
},
|
|
2748
|
-
let i = dt(), { designer: a } =
|
|
2838
|
+
}, kn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2839
|
+
let i = dt(), { designer: a } = On(n), o = i?.objectName || "", s = Tt(), { readableFields: c } = wt(o), l = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2749
2840
|
if (l.length > 0 && o && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2750
2841
|
className: t,
|
|
2751
2842
|
...a,
|
|
@@ -2765,14 +2856,14 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2765
2856
|
return ft(r.useId(), m.map((e) => e.name)), /* @__PURE__ */ Z("div", {
|
|
2766
2857
|
className: t,
|
|
2767
2858
|
...a,
|
|
2768
|
-
children: /* @__PURE__ */ Z(
|
|
2859
|
+
children: /* @__PURE__ */ Z(Gt, {
|
|
2769
2860
|
fields: m,
|
|
2770
2861
|
data: i?.data,
|
|
2771
2862
|
objectName: i?.objectName,
|
|
2772
2863
|
objectSchema: i?.objectSchema
|
|
2773
2864
|
})
|
|
2774
2865
|
});
|
|
2775
|
-
},
|
|
2866
|
+
}, An = ({ change: e, className: t }) => {
|
|
2776
2867
|
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));
|
|
2777
2868
|
return /* @__PURE__ */ Q("div", {
|
|
2778
2869
|
className: W("flex items-center gap-1.5 text-sm flex-wrap", t),
|
|
@@ -2792,14 +2883,14 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2792
2883
|
})
|
|
2793
2884
|
]
|
|
2794
2885
|
});
|
|
2795
|
-
},
|
|
2886
|
+
}, jn = [
|
|
2796
2887
|
"👍",
|
|
2797
2888
|
"❤️",
|
|
2798
2889
|
"🎉",
|
|
2799
2890
|
"😂",
|
|
2800
2891
|
"😮",
|
|
2801
2892
|
"😢"
|
|
2802
|
-
],
|
|
2893
|
+
], Mn = ({ reactions: e, onToggleReaction: t, emojiOptions: r = jn, className: i }) => {
|
|
2803
2894
|
let [a, o] = n.useState(!1), s = n.useCallback((e) => {
|
|
2804
2895
|
t?.(e), o(!1);
|
|
2805
2896
|
}, [t]);
|
|
@@ -2839,7 +2930,7 @@ var gn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2839
2930
|
};
|
|
2840
2931
|
//#endregion
|
|
2841
2932
|
//#region src/ThreadedReplies.tsx
|
|
2842
|
-
function
|
|
2933
|
+
function Nn(e, t) {
|
|
2843
2934
|
try {
|
|
2844
2935
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
2845
2936
|
if (i < 1) return t("detail.justNow");
|
|
@@ -2852,7 +2943,7 @@ function Dn(e, t) {
|
|
|
2852
2943
|
return e;
|
|
2853
2944
|
}
|
|
2854
2945
|
}
|
|
2855
|
-
var
|
|
2946
|
+
var Pn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, className: a }) => {
|
|
2856
2947
|
let { t: o } = $(), [s, c] = n.useState(!1), [l, u] = n.useState(""), [d, f] = n.useState(!1), p = n.useCallback(async () => {
|
|
2857
2948
|
let t = l.trim();
|
|
2858
2949
|
if (!(!t || !r)) {
|
|
@@ -2879,8 +2970,8 @@ var On = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2879
2970
|
onClick: () => c(!s),
|
|
2880
2971
|
"aria-expanded": s,
|
|
2881
2972
|
children: [
|
|
2882
|
-
Z(s ?
|
|
2883
|
-
/* @__PURE__ */ Z(
|
|
2973
|
+
Z(s ? ge : ve, { className: "h-3 w-3" }),
|
|
2974
|
+
/* @__PURE__ */ Z(X, { className: "h-3 w-3" }),
|
|
2884
2975
|
/* @__PURE__ */ Z("span", { children: t.length === 1 ? o("detail.replyCount", { count: t.length }) : o("detail.replyCountPlural", { count: t.length }) })
|
|
2885
2976
|
]
|
|
2886
2977
|
}),
|
|
@@ -2907,7 +2998,7 @@ var On = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2907
2998
|
children: e.actor
|
|
2908
2999
|
}), /* @__PURE__ */ Z("span", {
|
|
2909
3000
|
className: "text-[10px] text-muted-foreground",
|
|
2910
|
-
children:
|
|
3001
|
+
children: Nn(e.createdAt, o)
|
|
2911
3002
|
})]
|
|
2912
3003
|
}), /* @__PURE__ */ Z("p", {
|
|
2913
3004
|
className: "text-xs whitespace-pre-wrap break-words",
|
|
@@ -2937,7 +3028,7 @@ var On = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2937
3028
|
})
|
|
2938
3029
|
]
|
|
2939
3030
|
});
|
|
2940
|
-
},
|
|
3031
|
+
}, Fn = ({ subscription: e, onToggle: t, className: r }) => {
|
|
2941
3032
|
let { t: i } = $(), [a, o] = n.useState(!1), s = n.useCallback(async () => {
|
|
2942
3033
|
if (t) {
|
|
2943
3034
|
o(!0);
|
|
@@ -2961,11 +3052,11 @@ var On = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2961
3052
|
};
|
|
2962
3053
|
//#endregion
|
|
2963
3054
|
//#region src/RichTextCommentInput.tsx
|
|
2964
|
-
function
|
|
3055
|
+
function In(e) {
|
|
2965
3056
|
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/>");
|
|
2966
3057
|
return t = t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g, (e) => `<ul class="my-1">${e.replace(/<br\/>/g, "")}</ul>`), t;
|
|
2967
3058
|
}
|
|
2968
|
-
var
|
|
3059
|
+
var Ln = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], placeholder: a, className: o, disabled: s = !1, extraSlot: c, canSubmitEmpty: l = !1 }) => {
|
|
2969
3060
|
let { t: u } = $(), [d, f] = n.useState(!1), [p, m] = n.useState(!1), [h, g] = n.useState(""), [_, v] = n.useState(0), b = n.useRef(null), x = n.useMemo(() => {
|
|
2970
3061
|
if (!h) return i;
|
|
2971
3062
|
let e = h.toLowerCase();
|
|
@@ -3047,7 +3138,7 @@ var jn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3047
3138
|
onClick: w,
|
|
3048
3139
|
disabled: s || d,
|
|
3049
3140
|
title: u("detail.italic"),
|
|
3050
|
-
children: /* @__PURE__ */ Z(
|
|
3141
|
+
children: /* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5" })
|
|
3051
3142
|
}),
|
|
3052
3143
|
/* @__PURE__ */ Z(y, {
|
|
3053
3144
|
variant: "ghost",
|
|
@@ -3056,7 +3147,7 @@ var jn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3056
3147
|
onClick: T,
|
|
3057
3148
|
disabled: s || d,
|
|
3058
3149
|
title: u("detail.listFormat"),
|
|
3059
|
-
children: /* @__PURE__ */ Z(
|
|
3150
|
+
children: /* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" })
|
|
3060
3151
|
}),
|
|
3061
3152
|
/* @__PURE__ */ Z(y, {
|
|
3062
3153
|
variant: "ghost",
|
|
@@ -3065,7 +3156,7 @@ var jn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3065
3156
|
onClick: E,
|
|
3066
3157
|
disabled: s || d,
|
|
3067
3158
|
title: u("detail.inlineCode"),
|
|
3068
|
-
children: /* @__PURE__ */ Z(
|
|
3159
|
+
children: /* @__PURE__ */ Z(xe, { className: "h-3.5 w-3.5" })
|
|
3069
3160
|
}),
|
|
3070
3161
|
/* @__PURE__ */ Z(y, {
|
|
3071
3162
|
variant: "ghost",
|
|
@@ -3074,7 +3165,7 @@ var jn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3074
3165
|
onClick: D,
|
|
3075
3166
|
disabled: s || d,
|
|
3076
3167
|
title: u("detail.mentionSomeone"),
|
|
3077
|
-
children: /* @__PURE__ */ Z(
|
|
3168
|
+
children: /* @__PURE__ */ Z(K, { className: "h-3.5 w-3.5" })
|
|
3078
3169
|
}),
|
|
3079
3170
|
/* @__PURE__ */ Z("div", { className: "flex-1" }),
|
|
3080
3171
|
/* @__PURE__ */ Z(y, {
|
|
@@ -3083,7 +3174,7 @@ var jn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3083
3174
|
className: "h-7 w-7",
|
|
3084
3175
|
onClick: () => f(!d),
|
|
3085
3176
|
title: u(d ? "detail.edit" : "detail.preview"),
|
|
3086
|
-
children: Z(d ?
|
|
3177
|
+
children: Z(d ? we : Ee, { className: "h-3.5 w-3.5" })
|
|
3087
3178
|
}),
|
|
3088
3179
|
r && /* @__PURE__ */ Z(y, {
|
|
3089
3180
|
variant: "ghost",
|
|
@@ -3100,8 +3191,8 @@ var jn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3100
3191
|
className: "relative",
|
|
3101
3192
|
children: d ? /* @__PURE__ */ Z("div", {
|
|
3102
3193
|
className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
|
|
3103
|
-
dangerouslySetInnerHTML: { __html:
|
|
3104
|
-
}) : /* @__PURE__ */ Q(
|
|
3194
|
+
dangerouslySetInnerHTML: { __html: In(e) }
|
|
3195
|
+
}) : /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Z("textarea", {
|
|
3105
3196
|
ref: b,
|
|
3106
3197
|
className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
|
|
3107
3198
|
placeholder: a ?? u("detail.writeComment"),
|
|
@@ -3137,16 +3228,16 @@ var jn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3137
3228
|
};
|
|
3138
3229
|
//#endregion
|
|
3139
3230
|
//#region src/CommentAttachment.tsx
|
|
3140
|
-
function
|
|
3231
|
+
function Rn(e) {
|
|
3141
3232
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
3142
3233
|
}
|
|
3143
|
-
function
|
|
3234
|
+
function zn(e) {
|
|
3144
3235
|
return e.startsWith("image/");
|
|
3145
3236
|
}
|
|
3146
|
-
function
|
|
3147
|
-
return
|
|
3237
|
+
function Bn(e) {
|
|
3238
|
+
return zn(e) ? Ae : e.includes("pdf") || e.includes("document") || e.includes("text") ? ke : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? Oe : De;
|
|
3148
3239
|
}
|
|
3149
|
-
var
|
|
3240
|
+
var Vn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a = !1 }) => {
|
|
3150
3241
|
let { t: o } = $(), [s, c] = n.useState(!1), l = n.useRef(null), u = n.useCallback((e) => {
|
|
3151
3242
|
e.preventDefault(), e.stopPropagation(), c(!0);
|
|
3152
3243
|
}, []), d = n.useCallback((e) => {
|
|
@@ -3191,7 +3282,7 @@ var Fn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3191
3282
|
}), /* @__PURE__ */ Z("div", {
|
|
3192
3283
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
|
|
3193
3284
|
children: e.map((e) => {
|
|
3194
|
-
let t =
|
|
3285
|
+
let t = zn(e.type), n = Bn(e.type);
|
|
3195
3286
|
return /* @__PURE__ */ Q("div", {
|
|
3196
3287
|
className: "flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group",
|
|
3197
3288
|
children: [
|
|
@@ -3210,7 +3301,7 @@ var Fn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3210
3301
|
children: e.name
|
|
3211
3302
|
}), /* @__PURE__ */ Z("p", {
|
|
3212
3303
|
className: "text-[10px] text-muted-foreground",
|
|
3213
|
-
children:
|
|
3304
|
+
children: Rn(e.size)
|
|
3214
3305
|
})]
|
|
3215
3306
|
}),
|
|
3216
3307
|
r && !a && /* @__PURE__ */ Z(y, {
|
|
@@ -3227,15 +3318,15 @@ var Fn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3227
3318
|
})]
|
|
3228
3319
|
})]
|
|
3229
3320
|
});
|
|
3230
|
-
},
|
|
3231
|
-
comment:
|
|
3232
|
-
field_change:
|
|
3233
|
-
task:
|
|
3321
|
+
}, Hn = {
|
|
3322
|
+
comment: X,
|
|
3323
|
+
field_change: we,
|
|
3324
|
+
task: he,
|
|
3234
3325
|
event: pe,
|
|
3235
3326
|
system: tt,
|
|
3236
|
-
email:
|
|
3327
|
+
email: Le,
|
|
3237
3328
|
call: He
|
|
3238
|
-
},
|
|
3329
|
+
}, Un = {
|
|
3239
3330
|
comment: "bg-purple-100 text-purple-600",
|
|
3240
3331
|
field_change: "bg-blue-100 text-blue-600",
|
|
3241
3332
|
task: "bg-green-100 text-green-600",
|
|
@@ -3244,7 +3335,7 @@ var Fn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3244
3335
|
email: "bg-indigo-100 text-indigo-600",
|
|
3245
3336
|
call: "bg-teal-100 text-teal-600"
|
|
3246
3337
|
};
|
|
3247
|
-
function
|
|
3338
|
+
function Wn(e) {
|
|
3248
3339
|
return [
|
|
3249
3340
|
{
|
|
3250
3341
|
value: "all",
|
|
@@ -3264,7 +3355,7 @@ function Rn(e) {
|
|
|
3264
3355
|
}
|
|
3265
3356
|
];
|
|
3266
3357
|
}
|
|
3267
|
-
function
|
|
3358
|
+
function Gn(e, t) {
|
|
3268
3359
|
try {
|
|
3269
3360
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
3270
3361
|
if (i < 1) return t("detail.justNow");
|
|
@@ -3277,7 +3368,7 @@ function zn(e, t) {
|
|
|
3277
3368
|
return e;
|
|
3278
3369
|
}
|
|
3279
3370
|
}
|
|
3280
|
-
function
|
|
3371
|
+
function Kn(e, t) {
|
|
3281
3372
|
switch (t) {
|
|
3282
3373
|
case "comments_only": return e.filter((e) => e.type === "comment");
|
|
3283
3374
|
case "changes_only": return e.filter((e) => e.type === "field_change");
|
|
@@ -3285,23 +3376,23 @@ function Bn(e, t) {
|
|
|
3285
3376
|
default: return e;
|
|
3286
3377
|
}
|
|
3287
3378
|
}
|
|
3288
|
-
var
|
|
3289
|
-
let { t: b } = $(), [x, S] = n.useState("all"), [C, w] = n.useState(""), [T, E] = n.useState(!1), [O, k] = n.useState(!1), [P,
|
|
3290
|
-
if (!
|
|
3379
|
+
var qn = ({ 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, mentionSuggestions: m, onUploadAttachments: h, titleLabel: g, emptyLabel: _, className: v }) => {
|
|
3380
|
+
let { t: b } = $(), [x, S] = n.useState("all"), [C, w] = n.useState(""), [T, E] = n.useState(!1), [O, k] = n.useState(!1), [P, te] = n.useState([]), [F, I] = n.useState(!1), L = r ?? x, ne = t?.showFilterToggle !== !1, re = t?.showCommentInput !== !1 && !!c, R = t?.enableReactions ?? !1, z = t?.enableThreading ?? !1, B = t?.showSubscriptionToggle ?? !1, V = n.useMemo(() => Kn(e, L), [e, L]), ie = n.useMemo(() => z ? V.filter((e) => !e.parentId) : V, [V, z]), H = n.useMemo(() => {
|
|
3381
|
+
if (!z) return /* @__PURE__ */ new Map();
|
|
3291
3382
|
let e = /* @__PURE__ */ new Map();
|
|
3292
|
-
for (let t of
|
|
3383
|
+
for (let t of V) if (t.parentId) {
|
|
3293
3384
|
let n = e.get(t.parentId) ?? [];
|
|
3294
3385
|
n.push(t), e.set(t.parentId, n);
|
|
3295
3386
|
}
|
|
3296
3387
|
return e;
|
|
3297
|
-
}, [
|
|
3388
|
+
}, [V, z]), U = n.useCallback((e) => {
|
|
3298
3389
|
i ? i(e) : S(e);
|
|
3299
3390
|
}, [i]), ae = n.useCallback(async () => {
|
|
3300
3391
|
let e = C.trim();
|
|
3301
3392
|
if (c && !(!e && P.length === 0)) {
|
|
3302
3393
|
E(!0);
|
|
3303
3394
|
try {
|
|
3304
|
-
await c(e, P.length > 0 ? P : void 0), w(""),
|
|
3395
|
+
await c(e, P.length > 0 ? P : void 0), w(""), te([]);
|
|
3305
3396
|
} finally {
|
|
3306
3397
|
E(!1);
|
|
3307
3398
|
}
|
|
@@ -3312,16 +3403,16 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3312
3403
|
c
|
|
3313
3404
|
]), G = n.useCallback(async (e) => {
|
|
3314
3405
|
if (!(!h || e.length === 0)) {
|
|
3315
|
-
|
|
3406
|
+
I(!0);
|
|
3316
3407
|
try {
|
|
3317
3408
|
let t = await h(e);
|
|
3318
|
-
Array.isArray(t) && t.length > 0 &&
|
|
3409
|
+
Array.isArray(t) && t.length > 0 && te((e) => [...e, ...t]);
|
|
3319
3410
|
} finally {
|
|
3320
|
-
|
|
3411
|
+
I(!1);
|
|
3321
3412
|
}
|
|
3322
3413
|
}
|
|
3323
3414
|
}, [h]), se = n.useCallback((e) => {
|
|
3324
|
-
|
|
3415
|
+
te((t) => t.filter((t) => t.id !== e));
|
|
3325
3416
|
}, []), ce = n.useCallback(async () => {
|
|
3326
3417
|
if (o) {
|
|
3327
3418
|
k(!0);
|
|
@@ -3348,14 +3439,14 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3348
3439
|
className: "text-sm font-normal text-muted-foreground",
|
|
3349
3440
|
children: [
|
|
3350
3441
|
"(",
|
|
3351
|
-
|
|
3442
|
+
V.length,
|
|
3352
3443
|
")"
|
|
3353
3444
|
]
|
|
3354
3445
|
})
|
|
3355
3446
|
]
|
|
3356
3447
|
}), /* @__PURE__ */ Z("div", {
|
|
3357
3448
|
className: "flex items-center gap-1",
|
|
3358
|
-
children:
|
|
3449
|
+
children: B && d && /* @__PURE__ */ Z(Fn, {
|
|
3359
3450
|
subscription: d,
|
|
3360
3451
|
onToggle: f
|
|
3361
3452
|
})
|
|
@@ -3368,18 +3459,18 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3368
3459
|
className: "flex items-center gap-2",
|
|
3369
3460
|
children: /* @__PURE__ */ Q(A, {
|
|
3370
3461
|
value: L,
|
|
3371
|
-
onValueChange: (e) =>
|
|
3462
|
+
onValueChange: (e) => U(e),
|
|
3372
3463
|
children: [/* @__PURE__ */ Z(N, {
|
|
3373
3464
|
"aria-label": b("detail.filterActivity"),
|
|
3374
3465
|
className: "h-8 w-auto min-w-[140px] py-1 text-sm",
|
|
3375
3466
|
children: /* @__PURE__ */ Z(ee, {})
|
|
3376
|
-
}), /* @__PURE__ */ Z(j, { children:
|
|
3467
|
+
}), /* @__PURE__ */ Z(j, { children: Wn(b).map((e) => /* @__PURE__ */ Z(M, {
|
|
3377
3468
|
value: e.value,
|
|
3378
3469
|
children: e.label
|
|
3379
3470
|
}, e.value)) })]
|
|
3380
3471
|
})
|
|
3381
3472
|
}),
|
|
3382
|
-
|
|
3473
|
+
re && /* @__PURE__ */ Z(Ln, {
|
|
3383
3474
|
value: C,
|
|
3384
3475
|
onChange: w,
|
|
3385
3476
|
onSubmit: ae,
|
|
@@ -3387,26 +3478,26 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3387
3478
|
placeholder: b("detail.leaveCommentPlaceholder"),
|
|
3388
3479
|
disabled: T,
|
|
3389
3480
|
canSubmitEmpty: P.length > 0,
|
|
3390
|
-
extraSlot: h ? /* @__PURE__ */ Z(
|
|
3481
|
+
extraSlot: h ? /* @__PURE__ */ Z(Vn, {
|
|
3391
3482
|
attachments: P,
|
|
3392
3483
|
onUpload: G,
|
|
3393
3484
|
onRemove: se,
|
|
3394
|
-
readOnly: T ||
|
|
3395
|
-
}) : P.length > 0 ? /* @__PURE__ */ Z(
|
|
3485
|
+
readOnly: T || F
|
|
3486
|
+
}) : P.length > 0 ? /* @__PURE__ */ Z(Vn, {
|
|
3396
3487
|
attachments: P,
|
|
3397
3488
|
onRemove: se,
|
|
3398
3489
|
readOnly: T
|
|
3399
3490
|
}) : void 0
|
|
3400
3491
|
}),
|
|
3401
|
-
|
|
3492
|
+
V.length === 0 ? p ? null : /* @__PURE__ */ Z(D, {
|
|
3402
3493
|
title: _ ?? b("detail.noActivity"),
|
|
3403
3494
|
className: "py-6"
|
|
3404
3495
|
}) : /* @__PURE__ */ Q("div", {
|
|
3405
3496
|
className: "relative",
|
|
3406
3497
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
3407
3498
|
className: "space-y-4",
|
|
3408
|
-
children:
|
|
3409
|
-
let t =
|
|
3499
|
+
children: ie.map((e) => {
|
|
3500
|
+
let t = Hn[e.type] || tt, n = Un[e.type] || "bg-gray-100 text-gray-600", r = H.get(e.id) ?? [];
|
|
3410
3501
|
return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
|
|
3411
3502
|
className: "flex gap-3 relative",
|
|
3412
3503
|
children: [/* @__PURE__ */ Z("div", {
|
|
@@ -3432,7 +3523,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3432
3523
|
}),
|
|
3433
3524
|
/* @__PURE__ */ Z("span", {
|
|
3434
3525
|
className: "text-xs text-muted-foreground",
|
|
3435
|
-
children:
|
|
3526
|
+
children: Gn(e.createdAt, b)
|
|
3436
3527
|
}),
|
|
3437
3528
|
e.edited && /* @__PURE__ */ Z("span", {
|
|
3438
3529
|
className: "text-xs text-muted-foreground italic",
|
|
@@ -3459,25 +3550,25 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3459
3550
|
}),
|
|
3460
3551
|
e.type === "field_change" && e.fieldChanges && /* @__PURE__ */ Z("div", {
|
|
3461
3552
|
className: "space-y-1 mt-1",
|
|
3462
|
-
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(
|
|
3553
|
+
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(An, { change: e }, t))
|
|
3463
3554
|
}),
|
|
3464
|
-
|
|
3555
|
+
R && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
|
|
3465
3556
|
className: "mt-1.5",
|
|
3466
|
-
children: /* @__PURE__ */ Z(
|
|
3557
|
+
children: /* @__PURE__ */ Z(Mn, {
|
|
3467
3558
|
reactions: e.reactions,
|
|
3468
3559
|
onToggleReaction: u ? (t) => u(e.id, t) : void 0
|
|
3469
3560
|
})
|
|
3470
3561
|
}),
|
|
3471
|
-
|
|
3562
|
+
R && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
|
|
3472
3563
|
className: "mt-1.5",
|
|
3473
|
-
children: /* @__PURE__ */ Z(
|
|
3564
|
+
children: /* @__PURE__ */ Z(Mn, {
|
|
3474
3565
|
reactions: [],
|
|
3475
3566
|
onToggleReaction: (t) => u(e.id, t)
|
|
3476
3567
|
})
|
|
3477
3568
|
})
|
|
3478
3569
|
]
|
|
3479
3570
|
})]
|
|
3480
|
-
}),
|
|
3571
|
+
}), z && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(Pn, {
|
|
3481
3572
|
parentItem: e,
|
|
3482
3573
|
replies: r,
|
|
3483
3574
|
onAddReply: l,
|
|
@@ -3494,13 +3585,13 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3494
3585
|
onClick: ce,
|
|
3495
3586
|
disabled: O,
|
|
3496
3587
|
"aria-label": b("detail.loadMore"),
|
|
3497
|
-
children: [O ? /* @__PURE__ */ Z(
|
|
3588
|
+
children: [O ? /* @__PURE__ */ Z(Fe, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(ge, { className: "h-4 w-4 mr-1" }), b("detail.loadMore")]
|
|
3498
3589
|
})
|
|
3499
3590
|
})
|
|
3500
3591
|
]
|
|
3501
3592
|
})]
|
|
3502
3593
|
});
|
|
3503
|
-
},
|
|
3594
|
+
}, Jn = (e) => {
|
|
3504
3595
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3505
3596
|
return {
|
|
3506
3597
|
designer: {
|
|
@@ -3510,18 +3601,18 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3510
3601
|
},
|
|
3511
3602
|
rest: i
|
|
3512
3603
|
};
|
|
3513
|
-
},
|
|
3604
|
+
}, Yn = ({ schema: e = {}, className: t, ...n }) => {
|
|
3514
3605
|
dt();
|
|
3515
|
-
let { designer: r } =
|
|
3606
|
+
let { designer: r } = Jn(n);
|
|
3516
3607
|
return /* @__PURE__ */ Z("div", {
|
|
3517
3608
|
className: t,
|
|
3518
3609
|
...r,
|
|
3519
|
-
children: /* @__PURE__ */ Z(
|
|
3610
|
+
children: /* @__PURE__ */ Z(qn, {
|
|
3520
3611
|
items: [],
|
|
3521
3612
|
config: e
|
|
3522
3613
|
})
|
|
3523
3614
|
});
|
|
3524
|
-
},
|
|
3615
|
+
}, Xn = ({ 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, mentionSuggestions: m, onUploadAttachments: h, className: g }) => {
|
|
3525
3616
|
let _ = e?.position ?? "right", v = e?.width ?? "360px", b = e?.collapsible ?? !0, x = p && t.length === 0 || (e?.defaultCollapsed ?? !1), { t: S } = $(), [C, w] = n.useState(x);
|
|
3526
3617
|
return _ === "right" || _ === "left" ? C && b ? /* @__PURE__ */ Z("div", {
|
|
3527
3618
|
className: W("flex items-start pt-4", _ === "right" ? "border-l" : "border-r", g),
|
|
@@ -3543,7 +3634,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3543
3634
|
className: "flex items-center justify-between px-4 py-3 border-b",
|
|
3544
3635
|
children: [/* @__PURE__ */ Q("div", {
|
|
3545
3636
|
className: "flex items-center gap-2",
|
|
3546
|
-
children: [/* @__PURE__ */ Z(
|
|
3637
|
+
children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
3547
3638
|
className: "text-sm font-medium",
|
|
3548
3639
|
children: S("detail.discussion")
|
|
3549
3640
|
})]
|
|
@@ -3557,7 +3648,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3557
3648
|
})]
|
|
3558
3649
|
}), /* @__PURE__ */ Z("div", {
|
|
3559
3650
|
className: "flex-1 overflow-y-auto",
|
|
3560
|
-
children: /* @__PURE__ */ Z(
|
|
3651
|
+
children: /* @__PURE__ */ Z(qn, {
|
|
3561
3652
|
items: t,
|
|
3562
3653
|
config: e?.feed,
|
|
3563
3654
|
hasMore: r,
|
|
@@ -3585,12 +3676,12 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3585
3676
|
className: "w-full justify-start gap-2 text-muted-foreground",
|
|
3586
3677
|
onClick: () => w(!1),
|
|
3587
3678
|
"aria-label": S("detail.showDiscussion", { count: t.length }),
|
|
3588
|
-
children: [/* @__PURE__ */ Z(
|
|
3679
|
+
children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: S("detail.showDiscussion", { count: t.length }) })]
|
|
3589
3680
|
}) : /* @__PURE__ */ Q("div", { children: [b && /* @__PURE__ */ Q("div", {
|
|
3590
3681
|
className: "flex items-center justify-between mb-2",
|
|
3591
3682
|
children: [/* @__PURE__ */ Q("div", {
|
|
3592
3683
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
3593
|
-
children: [/* @__PURE__ */ Z(
|
|
3684
|
+
children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), S("detail.discussion")]
|
|
3594
3685
|
}), /* @__PURE__ */ Z(y, {
|
|
3595
3686
|
variant: "ghost",
|
|
3596
3687
|
size: "icon",
|
|
@@ -3599,7 +3690,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3599
3690
|
"aria-label": S("detail.hideDiscussion"),
|
|
3600
3691
|
children: /* @__PURE__ */ Z(ze, { className: "h-3.5 w-3.5" })
|
|
3601
3692
|
})]
|
|
3602
|
-
}), /* @__PURE__ */ Z(
|
|
3693
|
+
}), /* @__PURE__ */ Z(qn, {
|
|
3603
3694
|
items: t,
|
|
3604
3695
|
config: e?.feed,
|
|
3605
3696
|
hasMore: r,
|
|
@@ -3619,7 +3710,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3619
3710
|
emptyLabel: S("detail.noCommentsYet")
|
|
3620
3711
|
})] })
|
|
3621
3712
|
});
|
|
3622
|
-
},
|
|
3713
|
+
}, Zn = (e) => {
|
|
3623
3714
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3624
3715
|
return {
|
|
3625
3716
|
designer: {
|
|
@@ -3629,9 +3720,9 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3629
3720
|
},
|
|
3630
3721
|
rest: i
|
|
3631
3722
|
};
|
|
3632
|
-
},
|
|
3723
|
+
}, Qn = ({ schema: e = {}, className: t, ...n }) => {
|
|
3633
3724
|
dt();
|
|
3634
|
-
let r = st(), { designer: i } =
|
|
3725
|
+
let r = st(), { designer: i } = Zn(n), a = {
|
|
3635
3726
|
position: "bottom",
|
|
3636
3727
|
collapsible: !1,
|
|
3637
3728
|
feed: {
|
|
@@ -3644,7 +3735,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3644
3735
|
return /* @__PURE__ */ Z("div", {
|
|
3645
3736
|
className: t,
|
|
3646
3737
|
...i,
|
|
3647
|
-
children: /* @__PURE__ */ Z(
|
|
3738
|
+
children: /* @__PURE__ */ Z(Xn, {
|
|
3648
3739
|
items: r?.items || [],
|
|
3649
3740
|
config: a,
|
|
3650
3741
|
onAddComment: r?.onAddComment,
|
|
@@ -3654,7 +3745,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3654
3745
|
onUploadAttachments: r?.onUploadAttachments
|
|
3655
3746
|
})
|
|
3656
3747
|
});
|
|
3657
|
-
},
|
|
3748
|
+
}, $n = (e) => {
|
|
3658
3749
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3659
3750
|
return {
|
|
3660
3751
|
designer: {
|
|
@@ -3664,8 +3755,8 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3664
3755
|
},
|
|
3665
3756
|
rest: i
|
|
3666
3757
|
};
|
|
3667
|
-
},
|
|
3668
|
-
let i = dt(), { translateOptions: a } = pt(), { designer: o } =
|
|
3758
|
+
}, er = ({ schema: e = {}, className: t, ...n }) => {
|
|
3759
|
+
let i = dt(), { translateOptions: a } = pt(), { designer: o } = $n(n), s = Array.isArray(e.stages) ? e.stages : [], c = e.statusField, l = r.useMemo(() => {
|
|
3669
3760
|
if (s.length === 0 || !c || !i?.objectName) return s;
|
|
3670
3761
|
let e = a(i.objectName, c, s);
|
|
3671
3762
|
return Array.isArray(e) && e.length === s.length ? s.map((t, n) => ({
|
|
@@ -3777,7 +3868,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3777
3868
|
})
|
|
3778
3869
|
})]
|
|
3779
3870
|
});
|
|
3780
|
-
},
|
|
3871
|
+
}, tr = (e) => {
|
|
3781
3872
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3782
3873
|
return {
|
|
3783
3874
|
designer: {
|
|
@@ -3787,8 +3878,8 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3787
3878
|
},
|
|
3788
3879
|
rest: i
|
|
3789
3880
|
};
|
|
3790
|
-
},
|
|
3791
|
-
let r = dt(), { designer: i } =
|
|
3881
|
+
}, nr = ({ schema: e = {}, className: t, ...n }) => {
|
|
3882
|
+
let r = dt(), { designer: i } = tr(n), a = Tt(), o = Array.isArray(e.actions) ? e.actions : Array.isArray(e.properties?.actions) ? e.properties.actions : [], s = Array.isArray(e.actionNames) ? e.actionNames : Array.isArray(e.properties?.actionNames) ? e.properties.actionNames : [], c = r?.objectName || "", l = s.length > 0 ? s : Array.isArray(o) && o.every((e) => typeof e == "string") ? o : [], u = l.length > 0 && !!c, { item: d } = lt("object", u ? c : null), f = u ? (() => {
|
|
3792
3883
|
let e = Array.isArray(d?.actions) ? d.actions : [], t = new Map(e.map((e) => [e.name, e]));
|
|
3793
3884
|
return l.map((e) => t.get(e)).filter((e) => !!e);
|
|
3794
3885
|
})() : Array.isArray(o) ? o : [], p = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
@@ -3824,7 +3915,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3824
3915
|
role: "toolbar",
|
|
3825
3916
|
"aria-label": e.aria?.label || "Quick actions",
|
|
3826
3917
|
...i,
|
|
3827
|
-
children: _.map((t, n) => /* @__PURE__ */ Z(
|
|
3918
|
+
children: _.map((t, n) => /* @__PURE__ */ Z(rr, {
|
|
3828
3919
|
action: t,
|
|
3829
3920
|
record: r?.data,
|
|
3830
3921
|
variant: t.variant || e.variant || "default",
|
|
@@ -3836,7 +3927,7 @@ var Vn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3836
3927
|
}, t.name || `qa-${n}`))
|
|
3837
3928
|
});
|
|
3838
3929
|
};
|
|
3839
|
-
function
|
|
3930
|
+
function rr({ action: e, record: t, variant: n, size: i, label: a, onRun: o }) {
|
|
3840
3931
|
let [s, c] = r.useState(!1), l = r.useMemo(() => ({ record: t || {} }), [t]), u = it(e.disabled), d = ot(typeof u == "string" ? u : void 0, l);
|
|
3841
3932
|
return /* @__PURE__ */ Q(y, {
|
|
3842
3933
|
variant: n,
|
|
@@ -3850,12 +3941,12 @@ function Zn({ action: e, record: t, variant: n, size: i, label: a, onRun: o }) {
|
|
|
3850
3941
|
c(!1);
|
|
3851
3942
|
}
|
|
3852
3943
|
},
|
|
3853
|
-
children: [s && /* @__PURE__ */ Z(
|
|
3944
|
+
children: [s && /* @__PURE__ */ Z(Fe, { className: "mr-2 h-4 w-4 animate-spin" }), a]
|
|
3854
3945
|
});
|
|
3855
3946
|
}
|
|
3856
3947
|
//#endregion
|
|
3857
3948
|
//#region src/renderers/record-history.tsx
|
|
3858
|
-
var
|
|
3949
|
+
var ir = (e) => {
|
|
3859
3950
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3860
3951
|
return {
|
|
3861
3952
|
designer: {
|
|
@@ -3865,14 +3956,14 @@ var Qn = (e) => {
|
|
|
3865
3956
|
},
|
|
3866
3957
|
rest: i
|
|
3867
3958
|
};
|
|
3868
|
-
},
|
|
3959
|
+
}, ar = new Set([
|
|
3869
3960
|
"created",
|
|
3870
3961
|
"updated",
|
|
3871
3962
|
"assigned",
|
|
3872
3963
|
"shared",
|
|
3873
3964
|
"deleted"
|
|
3874
|
-
]),
|
|
3875
|
-
let { designer: i } =
|
|
3965
|
+
]), or = ({ schema: e = {}, className: t, ...n }) => {
|
|
3966
|
+
let { designer: i } = ir(n), a = dt(), o = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : void 0, s = e.loading ?? e.properties?.loading, c = e.emptyText ?? e.properties?.emptyText, l = Number(e.limit ?? e.properties?.limit ?? 50) || 50, u = a?.objectName, d = a?.data?.id ?? a?.data?._id ?? a?.recordId, f = a?.dataSource, p = o === void 0 && !!f?.find && !!u && d != null, [m, h] = r.useState(null), [g, _] = r.useState(!1);
|
|
3876
3967
|
r.useEffect(() => {
|
|
3877
3968
|
if (!p) return;
|
|
3878
3969
|
let e = !1;
|
|
@@ -3884,7 +3975,7 @@ var Qn = (e) => {
|
|
|
3884
3975
|
$orderby: { timestamp: "desc" },
|
|
3885
3976
|
$top: Math.max(1, l)
|
|
3886
3977
|
})).then((t) => {
|
|
3887
|
-
e || h((t?.data ?? t?.records ?? []).filter((e) =>
|
|
3978
|
+
e || h((t?.data ?? t?.records ?? []).filter((e) => ar.has(e?.type)).map((e) => {
|
|
3888
3979
|
let t = e.timestamp;
|
|
3889
3980
|
return (!t || t === "NOW()" || Number.isNaN(Date.parse(t))) && (t = e.created_at), {
|
|
3890
3981
|
id: e.id,
|
|
@@ -3913,13 +4004,13 @@ var Qn = (e) => {
|
|
|
3913
4004
|
return /* @__PURE__ */ Z("div", {
|
|
3914
4005
|
className: t,
|
|
3915
4006
|
...i,
|
|
3916
|
-
children: /* @__PURE__ */ Z(
|
|
4007
|
+
children: /* @__PURE__ */ Z(sn, {
|
|
3917
4008
|
entries: v,
|
|
3918
4009
|
loading: y,
|
|
3919
4010
|
emptyText: c
|
|
3920
4011
|
})
|
|
3921
4012
|
});
|
|
3922
|
-
},
|
|
4013
|
+
}, sr = (e) => {
|
|
3923
4014
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3924
4015
|
return {
|
|
3925
4016
|
designer: {
|
|
@@ -3929,8 +4020,8 @@ var Qn = (e) => {
|
|
|
3929
4020
|
},
|
|
3930
4021
|
rest: i
|
|
3931
4022
|
};
|
|
3932
|
-
},
|
|
3933
|
-
let i = dt(), a = pt(), { t: o } = $(), { designer: s } =
|
|
4023
|
+
}, cr = (e) => e.replace(/[_-]+/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()).trim(), lr = (e, t) => t && e?.[t] != null && e[t] !== "" ? String(e[t]) : e?.name || e?.title || e?.subject || e?.label || e?.email || e?.username || e?.code || e?.slug || e?.provider_id || e?.user_agent || e?.ip_address || e?.id || "—", ur = ({ schema: e = {}, className: t, ...n }) => {
|
|
4024
|
+
let i = dt(), a = pt(), { t: o } = $(), { designer: s } = sr(n), c = kt().appName, l = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : [], u = i?.recordId, d = i?.dataSource, [f, p] = r.useState({}), m = r.useRef(null), [h, g] = r.useState(!1), _ = r.useRef(!0);
|
|
3934
4025
|
r.useEffect(() => (_.current = !0, () => {
|
|
3935
4026
|
_.current = !1;
|
|
3936
4027
|
}), []);
|
|
@@ -4010,8 +4101,8 @@ var Qn = (e) => {
|
|
|
4010
4101
|
return T && t && !t.loading && !t.error && t.total === 0;
|
|
4011
4102
|
}).map((e) => e.objectName)), k = l.filter((e) => E || !O.has(e.objectName)), A = l.filter((e) => O.has(e.objectName)).map((e) => e.title || (a?.objectLabel ? a.objectLabel({
|
|
4012
4103
|
name: e.objectName,
|
|
4013
|
-
label:
|
|
4014
|
-
}) :
|
|
4104
|
+
label: cr(e.objectName)
|
|
4105
|
+
}) : cr(e.objectName)));
|
|
4015
4106
|
return /* @__PURE__ */ Q("div", {
|
|
4016
4107
|
ref: m,
|
|
4017
4108
|
className: W("flex flex-col gap-3", e.className, t),
|
|
@@ -4030,15 +4121,15 @@ var Qn = (e) => {
|
|
|
4030
4121
|
className: "text-sm font-semibold tracking-tight truncate",
|
|
4031
4122
|
children: e.title || (a?.objectLabel ? a.objectLabel({
|
|
4032
4123
|
name: e.objectName,
|
|
4033
|
-
label:
|
|
4034
|
-
}) :
|
|
4124
|
+
label: cr(e.objectName)
|
|
4125
|
+
}) : cr(e.objectName))
|
|
4035
4126
|
}), /* @__PURE__ */ Q("div", {
|
|
4036
4127
|
className: "flex items-center gap-2 shrink-0",
|
|
4037
4128
|
children: [!n.loading && /* @__PURE__ */ Z(v, {
|
|
4038
4129
|
variant: "secondary",
|
|
4039
4130
|
className: "tabular-nums",
|
|
4040
4131
|
children: n.total
|
|
4041
|
-
}), c && u && /* @__PURE__ */ Z(
|
|
4132
|
+
}), c && u && /* @__PURE__ */ Z(Ot, {
|
|
4042
4133
|
to: `/apps/${c}/${e.objectName}?filter%5B${e.relationshipField}%5D=${encodeURIComponent(String(u))}`,
|
|
4043
4134
|
className: "text-[11px] font-medium text-muted-foreground hover:text-foreground transition-colors",
|
|
4044
4135
|
title: o("detail.viewAll", { defaultValue: "View all" }),
|
|
@@ -4060,16 +4151,16 @@ var Qn = (e) => {
|
|
|
4060
4151
|
}) : /* @__PURE__ */ Z("ul", {
|
|
4061
4152
|
className: "divide-y",
|
|
4062
4153
|
children: n.items.map((t) => {
|
|
4063
|
-
let n = t.id || t._id, r =
|
|
4154
|
+
let n = t.id || t._id, r = lr(t, e.displayField), i = n ? `../${e.objectName}/record/${encodeURIComponent(String(n))}` : void 0;
|
|
4064
4155
|
return /* @__PURE__ */ Z("li", {
|
|
4065
4156
|
className: "px-4 py-2",
|
|
4066
|
-
children: i ? /* @__PURE__ */ Q(
|
|
4157
|
+
children: i ? /* @__PURE__ */ Q(Ot, {
|
|
4067
4158
|
to: i,
|
|
4068
4159
|
className: "group flex items-center justify-between gap-2 text-xs hover:text-foreground text-muted-foreground transition-colors",
|
|
4069
4160
|
children: [/* @__PURE__ */ Z("span", {
|
|
4070
4161
|
className: "truncate",
|
|
4071
4162
|
children: r
|
|
4072
|
-
}), /* @__PURE__ */ Z(
|
|
4163
|
+
}), /* @__PURE__ */ Z(ve, { className: "h-3 w-3 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity" })]
|
|
4073
4164
|
}) : /* @__PURE__ */ Z("span", {
|
|
4074
4165
|
className: "block truncate text-xs text-muted-foreground",
|
|
4075
4166
|
children: r
|
|
@@ -4097,7 +4188,7 @@ var Qn = (e) => {
|
|
|
4097
4188
|
})]
|
|
4098
4189
|
})]
|
|
4099
4190
|
});
|
|
4100
|
-
},
|
|
4191
|
+
}, dr = {
|
|
4101
4192
|
info: {
|
|
4102
4193
|
wrap: "border-blue-300/60 bg-blue-50 text-blue-900 dark:border-blue-700/40 dark:bg-blue-950/30 dark:text-blue-100 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-300",
|
|
4103
4194
|
icon: "Info"
|
|
@@ -4115,20 +4206,20 @@ var Qn = (e) => {
|
|
|
4115
4206
|
icon: "CheckCircle2"
|
|
4116
4207
|
}
|
|
4117
4208
|
};
|
|
4118
|
-
function
|
|
4209
|
+
function fr(e) {
|
|
4119
4210
|
let t = e?.properties ?? {};
|
|
4120
4211
|
return {
|
|
4121
4212
|
...e,
|
|
4122
4213
|
...t
|
|
4123
4214
|
};
|
|
4124
4215
|
}
|
|
4125
|
-
var
|
|
4126
|
-
let r =
|
|
4216
|
+
var pr = ({ schema: e = {}, className: t }) => {
|
|
4217
|
+
let r = fr(e), o = dt(), s = o?.data, c = o?.objectName || "", l = o?.recordId ?? s?.id, u = [
|
|
4127
4218
|
"info",
|
|
4128
4219
|
"warning",
|
|
4129
4220
|
"error",
|
|
4130
4221
|
"success"
|
|
4131
|
-
].includes(r.severity) ? r.severity : "info", d =
|
|
4222
|
+
].includes(r.severity) ? r.severity : "info", d = dr[u], f = r.icon || d.icon, p = it(r.visible), h = ot(p, { record: s }), g = n.useMemo(() => {
|
|
4132
4223
|
if (!r.dismissible) return null;
|
|
4133
4224
|
let e = r.dismissKey || r.title || u;
|
|
4134
4225
|
return `os.record-alert:${c}:${l ?? "_"}:${e}`;
|
|
@@ -4195,7 +4286,7 @@ var sr = ({ schema: e = {}, className: t }) => {
|
|
|
4195
4286
|
}) : null
|
|
4196
4287
|
]
|
|
4197
4288
|
});
|
|
4198
|
-
},
|
|
4289
|
+
}, mr = new Set([
|
|
4199
4290
|
"id",
|
|
4200
4291
|
"_id",
|
|
4201
4292
|
"__v",
|
|
@@ -4210,15 +4301,15 @@ var sr = ({ schema: e = {}, className: t }) => {
|
|
|
4210
4301
|
"owner_id",
|
|
4211
4302
|
"deleted_at",
|
|
4212
4303
|
"is_deleted"
|
|
4213
|
-
]),
|
|
4214
|
-
function
|
|
4304
|
+
]), hr = 480, gr = 95;
|
|
4305
|
+
function _r({ 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 = mr, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
|
|
4215
4306
|
let { t: g } = $(), _ = `objectui.drawerWidth.${a}`, [v, y] = r.useState(() => {
|
|
4216
4307
|
if (typeof window > "u" || !m) return null;
|
|
4217
4308
|
try {
|
|
4218
4309
|
let e = window.localStorage.getItem(_);
|
|
4219
4310
|
if (e) {
|
|
4220
4311
|
let t = parseInt(e, 10);
|
|
4221
|
-
if (Number.isFinite(t) && t >=
|
|
4312
|
+
if (Number.isFinite(t) && t >= hr) return t;
|
|
4222
4313
|
}
|
|
4223
4314
|
} catch {}
|
|
4224
4315
|
return null;
|
|
@@ -4240,7 +4331,7 @@ function dr({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
4240
4331
|
let n = (e) => {
|
|
4241
4332
|
let t = S.current;
|
|
4242
4333
|
if (!t) return;
|
|
4243
|
-
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth *
|
|
4334
|
+
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * gr / 100 : 1600, i = Math.min(r, Math.max(hr, t.startWidth + n));
|
|
4244
4335
|
y(Math.round(i));
|
|
4245
4336
|
}, r = () => {
|
|
4246
4337
|
S.current, S.current = null, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r);
|
|
@@ -4277,7 +4368,7 @@ function dr({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
4277
4368
|
onOpenChange: (e) => {
|
|
4278
4369
|
e || t();
|
|
4279
4370
|
},
|
|
4280
|
-
children: /* @__PURE__ */ Q(
|
|
4371
|
+
children: /* @__PURE__ */ Q(te, {
|
|
4281
4372
|
side: "right",
|
|
4282
4373
|
className: "w-full overflow-y-auto p-0 sm:!max-w-none",
|
|
4283
4374
|
style: x,
|
|
@@ -4290,13 +4381,13 @@ function dr({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
4290
4381
|
onPointerDown: C,
|
|
4291
4382
|
className: "hidden sm:block absolute left-0 top-0 h-full w-1.5 cursor-col-resize select-none bg-transparent hover:bg-primary/30 active:bg-primary/50 transition-colors z-10"
|
|
4292
4383
|
}),
|
|
4293
|
-
/* @__PURE__ */ Z(
|
|
4384
|
+
/* @__PURE__ */ Z(F, {
|
|
4294
4385
|
className: "sr-only",
|
|
4295
|
-
children: /* @__PURE__ */ Z(
|
|
4386
|
+
children: /* @__PURE__ */ Z(I, { children: n })
|
|
4296
4387
|
}),
|
|
4297
4388
|
/* @__PURE__ */ Z("div", {
|
|
4298
4389
|
className: "px-6 pt-6 pb-6",
|
|
4299
|
-
children: /* @__PURE__ */ Z(
|
|
4390
|
+
children: /* @__PURE__ */ Z(_n, {
|
|
4300
4391
|
dataSource: s,
|
|
4301
4392
|
inlineEdit: !0,
|
|
4302
4393
|
schema: {
|
|
@@ -4339,14 +4430,14 @@ function dr({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
4339
4430
|
})
|
|
4340
4431
|
});
|
|
4341
4432
|
}
|
|
4342
|
-
function
|
|
4433
|
+
function vr(e, t) {
|
|
4343
4434
|
if (typeof window > "u") return null;
|
|
4344
4435
|
let n = window.location.pathname, r = `/${e}`, i = n.indexOf(r);
|
|
4345
4436
|
return `${i >= 0 ? n.slice(0, i) : n.replace(/\/$/, "")}/${e}/record/${encodeURIComponent(String(t))}`;
|
|
4346
4437
|
}
|
|
4347
4438
|
//#endregion
|
|
4348
4439
|
//#region src/InlineCreateRelated.tsx
|
|
4349
|
-
var
|
|
4440
|
+
var yr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
|
|
4350
4441
|
let [l, u] = n.useState(!1), [d, f] = n.useState("create"), [p, m] = n.useState({}), [h, g] = n.useState(""), [_, v] = n.useState(s), [w, T] = n.useState(!1), [E, D] = n.useState(!1), k = n.useMemo(() => {
|
|
4351
4442
|
if (!h.trim()) return _;
|
|
4352
4443
|
let e = h.toLowerCase();
|
|
@@ -4413,19 +4504,19 @@ var pr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
4413
4504
|
value: d,
|
|
4414
4505
|
onValueChange: f,
|
|
4415
4506
|
children: [
|
|
4416
|
-
/* @__PURE__ */ Q(
|
|
4507
|
+
/* @__PURE__ */ Q(R, {
|
|
4417
4508
|
className: "mb-3 w-full",
|
|
4418
|
-
children: [i && /* @__PURE__ */ Q(
|
|
4509
|
+
children: [i && /* @__PURE__ */ Q(z, {
|
|
4419
4510
|
value: "create",
|
|
4420
4511
|
className: "flex-1 gap-1.5",
|
|
4421
4512
|
children: [/* @__PURE__ */ Z(We, { className: "h-3.5 w-3.5" }), "Create New"]
|
|
4422
|
-
}), a && /* @__PURE__ */ Q(
|
|
4513
|
+
}), a && /* @__PURE__ */ Q(z, {
|
|
4423
4514
|
value: "link",
|
|
4424
4515
|
className: "flex-1 gap-1.5",
|
|
4425
|
-
children: [/* @__PURE__ */ Z(
|
|
4516
|
+
children: [/* @__PURE__ */ Z(Ne, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
4426
4517
|
})]
|
|
4427
4518
|
}),
|
|
4428
|
-
i && /* @__PURE__ */ Q(
|
|
4519
|
+
i && /* @__PURE__ */ Q(re, {
|
|
4429
4520
|
value: "create",
|
|
4430
4521
|
className: "space-y-3 mt-0",
|
|
4431
4522
|
children: [r.map((e) => /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("label", {
|
|
@@ -4452,11 +4543,11 @@ var pr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
4452
4543
|
onClick: M,
|
|
4453
4544
|
disabled: !ee || w,
|
|
4454
4545
|
className: "gap-1.5",
|
|
4455
|
-
children: [w && /* @__PURE__ */ Z(
|
|
4546
|
+
children: [w && /* @__PURE__ */ Z(Fe, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
|
|
4456
4547
|
})]
|
|
4457
4548
|
})]
|
|
4458
4549
|
}),
|
|
4459
|
-
a && /* @__PURE__ */ Q(
|
|
4550
|
+
a && /* @__PURE__ */ Q(re, {
|
|
4460
4551
|
value: "link",
|
|
4461
4552
|
className: "space-y-3 mt-0",
|
|
4462
4553
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -4471,7 +4562,7 @@ var pr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
4471
4562
|
className: "max-h-48 overflow-y-auto space-y-1",
|
|
4472
4563
|
children: E ? /* @__PURE__ */ Q("div", {
|
|
4473
4564
|
className: "flex items-center justify-center py-4 text-sm text-muted-foreground",
|
|
4474
|
-
children: [/* @__PURE__ */ Z(
|
|
4565
|
+
children: [/* @__PURE__ */ Z(Fe, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
|
|
4475
4566
|
}) : k.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
4476
4567
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
4477
4568
|
children: h ? "No records found" : "Type to search records"
|
|
@@ -4513,13 +4604,13 @@ var pr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
4513
4604
|
f("link"), u(!0);
|
|
4514
4605
|
},
|
|
4515
4606
|
className: "gap-1.5",
|
|
4516
|
-
children: [/* @__PURE__ */ Z(
|
|
4607
|
+
children: [/* @__PURE__ */ Z(Ne, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
4517
4608
|
})]
|
|
4518
4609
|
});
|
|
4519
4610
|
};
|
|
4520
4611
|
//#endregion
|
|
4521
4612
|
//#region src/DiffView.tsx
|
|
4522
|
-
function
|
|
4613
|
+
function br(e, t) {
|
|
4523
4614
|
if (e == null) return ["(empty)"];
|
|
4524
4615
|
switch (t) {
|
|
4525
4616
|
case "json": try {
|
|
@@ -4538,7 +4629,7 @@ function mr(e, t) {
|
|
|
4538
4629
|
default: return String(e).split("\n");
|
|
4539
4630
|
}
|
|
4540
4631
|
}
|
|
4541
|
-
function
|
|
4632
|
+
function xr(e, t) {
|
|
4542
4633
|
let n = [], r = Math.max(e.length, t.length);
|
|
4543
4634
|
for (let i = 0; i < r; i++) {
|
|
4544
4635
|
let r = i < e.length ? e[i] : void 0, a = i < t.length ? t[i] : void 0;
|
|
@@ -4555,16 +4646,16 @@ function hr(e, t) {
|
|
|
4555
4646
|
}
|
|
4556
4647
|
return n;
|
|
4557
4648
|
}
|
|
4558
|
-
var
|
|
4649
|
+
var Sr = {
|
|
4559
4650
|
added: "bg-green-50 text-green-800 dark:bg-green-950/30 dark:text-green-300",
|
|
4560
4651
|
removed: "bg-red-50 text-red-800 dark:bg-red-950/30 dark:text-red-300",
|
|
4561
4652
|
unchanged: "text-muted-foreground"
|
|
4562
|
-
},
|
|
4653
|
+
}, Cr = {
|
|
4563
4654
|
added: "+",
|
|
4564
4655
|
removed: "-",
|
|
4565
4656
|
unchanged: " "
|
|
4566
|
-
},
|
|
4567
|
-
let { t: s } = $(), [c, l] = n.useState(a), u = n.useMemo(() =>
|
|
4657
|
+
}, wr = ({ oldValue: e, newValue: t, fieldName: r, fieldType: i = "string", mode: a = "unified", className: o }) => {
|
|
4658
|
+
let { t: s } = $(), [c, l] = n.useState(a), u = n.useMemo(() => br(e, i), [e, i]), d = n.useMemo(() => br(t, i), [t, i]), f = n.useMemo(() => xr(u, d), [u, d]), p = f.some((e) => e.type !== "unchanged"), m = n.useMemo(() => {
|
|
4568
4659
|
if (c !== "side-by-side") return [];
|
|
4569
4660
|
let e = [], t = 0;
|
|
4570
4661
|
for (; t < f.length;) {
|
|
@@ -4613,7 +4704,7 @@ var gr = {
|
|
|
4613
4704
|
className: "h-7 w-7",
|
|
4614
4705
|
onClick: () => l("side-by-side"),
|
|
4615
4706
|
title: s("detail.sideBySideDiff"),
|
|
4616
|
-
children: /* @__PURE__ */ Z(
|
|
4707
|
+
children: /* @__PURE__ */ Z(Se, { className: "h-3.5 w-3.5" })
|
|
4617
4708
|
})]
|
|
4618
4709
|
})]
|
|
4619
4710
|
})
|
|
@@ -4622,10 +4713,10 @@ var gr = {
|
|
|
4622
4713
|
children: p ? c === "unified" ? /* @__PURE__ */ Z("div", {
|
|
4623
4714
|
className: "font-mono text-xs overflow-x-auto",
|
|
4624
4715
|
children: f.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
4625
|
-
className: W("px-4 py-0.5 whitespace-pre-wrap border-l-2",
|
|
4716
|
+
className: W("px-4 py-0.5 whitespace-pre-wrap border-l-2", Sr[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
|
|
4626
4717
|
children: [/* @__PURE__ */ Z("span", {
|
|
4627
4718
|
className: "select-none mr-2 inline-block w-3 text-center opacity-60",
|
|
4628
|
-
children:
|
|
4719
|
+
children: Cr[e.type]
|
|
4629
4720
|
}), e.value]
|
|
4630
4721
|
}, t))
|
|
4631
4722
|
}) : /* @__PURE__ */ Z("div", {
|
|
@@ -4642,10 +4733,10 @@ var gr = {
|
|
|
4642
4733
|
children: s("detail.currentVersion")
|
|
4643
4734
|
}),
|
|
4644
4735
|
m.map((e, t) => /* @__PURE__ */ Q(n.Fragment, { children: [/* @__PURE__ */ Z("div", {
|
|
4645
|
-
className: W("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ?
|
|
4736
|
+
className: W("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? Sr[e.left.type] : "bg-muted/20"),
|
|
4646
4737
|
children: e.left?.value ?? ""
|
|
4647
4738
|
}), /* @__PURE__ */ Z("div", {
|
|
4648
|
-
className: W("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ?
|
|
4739
|
+
className: W("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? Sr[e.right.type] : "bg-muted/20"),
|
|
4649
4740
|
children: e.right?.value ?? ""
|
|
4650
4741
|
})] }, t))
|
|
4651
4742
|
]
|
|
@@ -4656,7 +4747,7 @@ var gr = {
|
|
|
4656
4747
|
})
|
|
4657
4748
|
})]
|
|
4658
4749
|
});
|
|
4659
|
-
},
|
|
4750
|
+
}, Tr = ({ currentIndex: e, totalRecords: t, recordIds: r, onNavigate: i, onSearch: a, className: o }) => {
|
|
4660
4751
|
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, g = e < t - 1, _ = n.useCallback(() => {
|
|
4661
4752
|
p && i(r[0]);
|
|
4662
4753
|
}, [
|
|
@@ -4733,7 +4824,7 @@ var gr = {
|
|
|
4733
4824
|
disabled: !p,
|
|
4734
4825
|
onClick: _,
|
|
4735
4826
|
title: s("detail.firstRecord"),
|
|
4736
|
-
children: /* @__PURE__ */ Z(
|
|
4827
|
+
children: /* @__PURE__ */ Z(ye, { className: "h-4 w-4" })
|
|
4737
4828
|
}),
|
|
4738
4829
|
/* @__PURE__ */ Z(y, {
|
|
4739
4830
|
variant: "outline",
|
|
@@ -4742,7 +4833,7 @@ var gr = {
|
|
|
4742
4833
|
disabled: !m,
|
|
4743
4834
|
onClick: v,
|
|
4744
4835
|
title: s("detail.previousRecordKey"),
|
|
4745
|
-
children: /* @__PURE__ */ Z(
|
|
4836
|
+
children: /* @__PURE__ */ Z(_e, { className: "h-4 w-4" })
|
|
4746
4837
|
}),
|
|
4747
4838
|
/* @__PURE__ */ Z("span", {
|
|
4748
4839
|
className: "text-xs text-muted-foreground whitespace-nowrap px-1.5 tabular-nums",
|
|
@@ -4758,7 +4849,7 @@ var gr = {
|
|
|
4758
4849
|
disabled: !h,
|
|
4759
4850
|
onClick: b,
|
|
4760
4851
|
title: s("detail.nextRecordKey"),
|
|
4761
|
-
children: /* @__PURE__ */ Z(
|
|
4852
|
+
children: /* @__PURE__ */ Z(ve, { className: "h-4 w-4" })
|
|
4762
4853
|
}),
|
|
4763
4854
|
/* @__PURE__ */ Z(y, {
|
|
4764
4855
|
variant: "outline",
|
|
@@ -4767,9 +4858,9 @@ var gr = {
|
|
|
4767
4858
|
disabled: !g,
|
|
4768
4859
|
onClick: x,
|
|
4769
4860
|
title: s("detail.lastRecord"),
|
|
4770
|
-
children: /* @__PURE__ */ Z(
|
|
4861
|
+
children: /* @__PURE__ */ Z(be, { className: "h-4 w-4" })
|
|
4771
4862
|
}),
|
|
4772
|
-
a && /* @__PURE__ */ Q(
|
|
4863
|
+
a && /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Z(y, {
|
|
4773
4864
|
variant: u ? "secondary" : "ghost",
|
|
4774
4865
|
size: "icon",
|
|
4775
4866
|
className: "h-8 w-8",
|
|
@@ -4789,18 +4880,18 @@ var gr = {
|
|
|
4789
4880
|
})] })
|
|
4790
4881
|
]
|
|
4791
4882
|
});
|
|
4792
|
-
},
|
|
4883
|
+
}, Er = 28, Dr = [
|
|
4793
4884
|
"fill-primary stroke-primary",
|
|
4794
4885
|
"fill-blue-500 stroke-blue-500",
|
|
4795
4886
|
"fill-emerald-500 stroke-emerald-500",
|
|
4796
4887
|
"fill-amber-500 stroke-amber-500"
|
|
4797
|
-
],
|
|
4888
|
+
], Or = [
|
|
4798
4889
|
"fill-primary-foreground",
|
|
4799
4890
|
"fill-white",
|
|
4800
4891
|
"fill-white",
|
|
4801
4892
|
"fill-white"
|
|
4802
4893
|
];
|
|
4803
|
-
function
|
|
4894
|
+
function kr(e, t, n, r, i) {
|
|
4804
4895
|
let a = [], o = [], s = /* @__PURE__ */ new Set(), c = r / 2, l = i / 2;
|
|
4805
4896
|
a.push({
|
|
4806
4897
|
id: e.id,
|
|
@@ -4864,10 +4955,10 @@ function Cr(e, t, n, r, i) {
|
|
|
4864
4955
|
edges: o
|
|
4865
4956
|
};
|
|
4866
4957
|
}
|
|
4867
|
-
function
|
|
4958
|
+
function Ar(e, t = 6) {
|
|
4868
4959
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
4869
4960
|
}
|
|
4870
|
-
var
|
|
4961
|
+
var jr = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, className: a }) => {
|
|
4871
4962
|
let o = n.useRef(null), [s, c] = n.useState({
|
|
4872
4963
|
width: 500,
|
|
4873
4964
|
height: 400
|
|
@@ -4888,7 +4979,7 @@ var Tr = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
4888
4979
|
});
|
|
4889
4980
|
return n.observe(t), () => n.disconnect();
|
|
4890
4981
|
}, []);
|
|
4891
|
-
let { nodes: d, edges: f } = n.useMemo(() =>
|
|
4982
|
+
let { nodes: d, edges: f } = n.useMemo(() => kr(e, t, r, s.width, s.height), [
|
|
4892
4983
|
e,
|
|
4893
4984
|
t,
|
|
4894
4985
|
r,
|
|
@@ -4930,7 +5021,7 @@ var Tr = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
4930
5021
|
strokeWidth: 1.5,
|
|
4931
5022
|
strokeOpacity: .5
|
|
4932
5023
|
}, `edge-${t}`)), d.map((e) => {
|
|
4933
|
-
let t = l === e.id, n =
|
|
5024
|
+
let t = l === e.id, n = Dr[Math.min(e.level, Dr.length - 1)], r = Or[Math.min(e.level, Or.length - 1)], a = e.level === 0 ? 34 : Er;
|
|
4934
5025
|
return /* @__PURE__ */ Q("g", {
|
|
4935
5026
|
className: W("cursor-pointer transition-transform", i && "hover:opacity-80"),
|
|
4936
5027
|
onClick: () => i?.(e.id),
|
|
@@ -4952,7 +5043,7 @@ var Tr = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
4952
5043
|
textAnchor: "middle",
|
|
4953
5044
|
dominantBaseline: "central",
|
|
4954
5045
|
className: W("text-[10px] font-medium pointer-events-none", r),
|
|
4955
|
-
children:
|
|
5046
|
+
children: Ar(e.label)
|
|
4956
5047
|
}),
|
|
4957
5048
|
e.type && /* @__PURE__ */ Z("text", {
|
|
4958
5049
|
x: e.x,
|
|
@@ -4961,7 +5052,7 @@ var Tr = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
4961
5052
|
className: "fill-muted-foreground text-[9px] pointer-events-none",
|
|
4962
5053
|
children: e.type
|
|
4963
5054
|
}),
|
|
4964
|
-
t && /* @__PURE__ */ Q(
|
|
5055
|
+
t && /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Z("rect", {
|
|
4965
5056
|
x: e.x - 50,
|
|
4966
5057
|
y: e.y - a - 28,
|
|
4967
5058
|
width: 100,
|
|
@@ -4986,7 +5077,7 @@ var Tr = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
4986
5077
|
};
|
|
4987
5078
|
//#endregion
|
|
4988
5079
|
//#region src/PointInTimeRestore.tsx
|
|
4989
|
-
function
|
|
5080
|
+
function Mr(e) {
|
|
4990
5081
|
try {
|
|
4991
5082
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
4992
5083
|
if (r < 1) return "just now";
|
|
@@ -4997,7 +5088,7 @@ function Er(e) {
|
|
|
4997
5088
|
return e;
|
|
4998
5089
|
}
|
|
4999
5090
|
}
|
|
5000
|
-
var
|
|
5091
|
+
var Nr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
5001
5092
|
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 () => {
|
|
5002
5093
|
if (!(!d || !r)) {
|
|
5003
5094
|
if (!s) {
|
|
@@ -5026,7 +5117,7 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5026
5117
|
children: /* @__PURE__ */ Q(C, {
|
|
5027
5118
|
className: "flex items-center gap-2 text-base",
|
|
5028
5119
|
children: [
|
|
5029
|
-
/* @__PURE__ */ Z(
|
|
5120
|
+
/* @__PURE__ */ Z(Y, { className: "h-4 w-4" }),
|
|
5030
5121
|
"Revision History",
|
|
5031
5122
|
/* @__PURE__ */ Q("span", {
|
|
5032
5123
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -5059,7 +5150,7 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5059
5150
|
},
|
|
5060
5151
|
children: [/* @__PURE__ */ Z("div", {
|
|
5061
5152
|
className: W("shrink-0 h-6 w-6 rounded-full border-2 flex items-center justify-center z-10 mt-0.5", t ? "border-primary bg-primary" : "border-border bg-background"),
|
|
5062
|
-
children: t && /* @__PURE__ */ Z(
|
|
5153
|
+
children: t && /* @__PURE__ */ Z(ve, { className: "h-3 w-3 text-primary-foreground" })
|
|
5063
5154
|
}), /* @__PURE__ */ Q("div", {
|
|
5064
5155
|
className: "flex-1 min-w-0",
|
|
5065
5156
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -5069,7 +5160,7 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5069
5160
|
children: e.user
|
|
5070
5161
|
}), /* @__PURE__ */ Z("span", {
|
|
5071
5162
|
className: "text-xs text-muted-foreground",
|
|
5072
|
-
children:
|
|
5163
|
+
children: Mr(e.timestamp)
|
|
5073
5164
|
})]
|
|
5074
5165
|
}), /* @__PURE__ */ Q("p", {
|
|
5075
5166
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
@@ -5091,7 +5182,7 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5091
5182
|
children: [
|
|
5092
5183
|
/* @__PURE__ */ Q("div", {
|
|
5093
5184
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
5094
|
-
children: [/* @__PURE__ */ Z(
|
|
5185
|
+
children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
|
|
5095
5186
|
}),
|
|
5096
5187
|
/* @__PURE__ */ Z("div", {
|
|
5097
5188
|
className: "space-y-2",
|
|
@@ -5107,7 +5198,7 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5107
5198
|
className: "line-through text-red-600 dark:text-red-400 truncate max-w-[120px]",
|
|
5108
5199
|
children: e.oldValue == null ? "(empty)" : String(e.oldValue)
|
|
5109
5200
|
}),
|
|
5110
|
-
/* @__PURE__ */ Z(
|
|
5201
|
+
/* @__PURE__ */ Z(ve, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
5111
5202
|
/* @__PURE__ */ Z("span", {
|
|
5112
5203
|
className: "text-green-600 dark:text-green-400 truncate max-w-[120px]",
|
|
5113
5204
|
children: e.newValue == null ? "(empty)" : String(e.newValue)
|
|
@@ -5137,12 +5228,12 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5137
5228
|
}),
|
|
5138
5229
|
r && /* @__PURE__ */ Z("div", {
|
|
5139
5230
|
className: "pt-1 space-y-2",
|
|
5140
|
-
children: s ? /* @__PURE__ */ Q(
|
|
5231
|
+
children: s ? /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Q("p", {
|
|
5141
5232
|
className: "text-xs text-amber-600 dark:text-amber-400",
|
|
5142
5233
|
children: [
|
|
5143
5234
|
"This will restore the record to its state at",
|
|
5144
5235
|
" ",
|
|
5145
|
-
|
|
5236
|
+
Mr(d.timestamp),
|
|
5146
5237
|
". Continue?"
|
|
5147
5238
|
]
|
|
5148
5239
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -5173,7 +5264,7 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5173
5264
|
})]
|
|
5174
5265
|
}) })]
|
|
5175
5266
|
});
|
|
5176
|
-
},
|
|
5267
|
+
}, Pr = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: r = !1, className: i }) => {
|
|
5177
5268
|
let [a, o] = n.useState(""), [s, c] = n.useState(!1), l = n.useCallback(async () => {
|
|
5178
5269
|
let t = a.trim();
|
|
5179
5270
|
if (t) {
|
|
@@ -5206,7 +5297,7 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5206
5297
|
children: /* @__PURE__ */ Z(Ye, { className: "h-4 w-4" })
|
|
5207
5298
|
})]
|
|
5208
5299
|
});
|
|
5209
|
-
},
|
|
5300
|
+
}, Fr = ({ query: e, suggestions: t, onSelect: r, visible: i = !0, activeIndex: a = 0, className: o }) => {
|
|
5210
5301
|
let s = n.useMemo(() => {
|
|
5211
5302
|
if (!e) return t;
|
|
5212
5303
|
let n = e.toLowerCase();
|
|
@@ -5248,7 +5339,7 @@ var Dr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5248
5339
|
}, e.id))
|
|
5249
5340
|
});
|
|
5250
5341
|
};
|
|
5251
|
-
function
|
|
5342
|
+
function Ir(e, t, n) {
|
|
5252
5343
|
return {
|
|
5253
5344
|
type: e.type,
|
|
5254
5345
|
id: e.id,
|
|
@@ -5259,7 +5350,7 @@ function Ar(e, t, n) {
|
|
|
5259
5350
|
}
|
|
5260
5351
|
//#endregion
|
|
5261
5352
|
//#region src/extractMentions.ts
|
|
5262
|
-
function
|
|
5353
|
+
function Lr(e, t) {
|
|
5263
5354
|
if (!e || !t.length) return [];
|
|
5264
5355
|
let n = [...t].sort((e, t) => t.label.length - e.label.length), r = e, i = /* @__PURE__ */ new Set();
|
|
5265
5356
|
for (let e of n) {
|
|
@@ -5271,10 +5362,10 @@ function jr(e, t) {
|
|
|
5271
5362
|
}
|
|
5272
5363
|
//#endregion
|
|
5273
5364
|
//#region src/synth/buildDefaultPageSchema.ts
|
|
5274
|
-
function
|
|
5365
|
+
function Rr(e) {
|
|
5275
5366
|
return e == null ? [] : Array.isArray(e) ? e.filter((e) => e != null) : [e];
|
|
5276
5367
|
}
|
|
5277
|
-
function
|
|
5368
|
+
function zr(e) {
|
|
5278
5369
|
if (!e) return null;
|
|
5279
5370
|
if (e.stageField) return e.stageField;
|
|
5280
5371
|
let t = e.fields || {};
|
|
@@ -5290,7 +5381,7 @@ function Nr(e) {
|
|
|
5290
5381
|
}
|
|
5291
5382
|
return null;
|
|
5292
5383
|
}
|
|
5293
|
-
function
|
|
5384
|
+
function Br(e, t) {
|
|
5294
5385
|
if (!e || !t) return null;
|
|
5295
5386
|
let n = e.fields?.[t]?.options;
|
|
5296
5387
|
return !Array.isArray(n) || n.length === 0 ? null : n.map((e) => ({
|
|
@@ -5298,7 +5389,7 @@ function Pr(e, t) {
|
|
|
5298
5389
|
label: e.label
|
|
5299
5390
|
}));
|
|
5300
5391
|
}
|
|
5301
|
-
function
|
|
5392
|
+
function Vr(e, t, n = 4) {
|
|
5302
5393
|
if (!e) return [];
|
|
5303
5394
|
if (Array.isArray(e.highlightFields) && e.highlightFields.length > 0) return e.highlightFields.slice(0, n);
|
|
5304
5395
|
let r = new Set([
|
|
@@ -5372,22 +5463,22 @@ function Fr(e, t, n = 4) {
|
|
|
5372
5463
|
}
|
|
5373
5464
|
return o;
|
|
5374
5465
|
}
|
|
5375
|
-
function
|
|
5466
|
+
function Hr(e, t = {}) {
|
|
5376
5467
|
return {
|
|
5377
5468
|
type: "page:header",
|
|
5378
5469
|
recordChrome: t.recordChrome !== !1,
|
|
5379
5470
|
...Array.isArray(t.actions) && t.actions.length > 0 ? { actions: t.actions } : {}
|
|
5380
5471
|
};
|
|
5381
5472
|
}
|
|
5382
|
-
function
|
|
5473
|
+
function Ur(e, t) {
|
|
5383
5474
|
return !Array.isArray(t) || t.length === 0 ? null : {
|
|
5384
5475
|
type: "record:quick_actions",
|
|
5385
5476
|
actions: t,
|
|
5386
5477
|
location: "record_header"
|
|
5387
5478
|
};
|
|
5388
5479
|
}
|
|
5389
|
-
function
|
|
5390
|
-
let n = t.statusField ??
|
|
5480
|
+
function Wr(e, t = {}) {
|
|
5481
|
+
let n = t.statusField ?? zr(e), r = t.stages ?? (n ? Br(e, n) : null), i = t.highlightFields ?? Vr(e, n), a = [];
|
|
5391
5482
|
return !t.hideHighlights && i.length > 0 && a.push({
|
|
5392
5483
|
type: "record:highlights",
|
|
5393
5484
|
fields: i
|
|
@@ -5397,17 +5488,17 @@ function Rr(e, t = {}) {
|
|
|
5397
5488
|
stages: r
|
|
5398
5489
|
}), a;
|
|
5399
5490
|
}
|
|
5400
|
-
function
|
|
5491
|
+
function Gr(e, t, n) {
|
|
5401
5492
|
return {
|
|
5402
5493
|
type: "record:details",
|
|
5403
5494
|
sections: t,
|
|
5404
5495
|
...n && n.length > 0 ? { hideFields: n } : {}
|
|
5405
5496
|
};
|
|
5406
5497
|
}
|
|
5407
|
-
function
|
|
5408
|
-
let n = t.statusField ??
|
|
5498
|
+
function Kr(e, t = {}) {
|
|
5499
|
+
let n = t.statusField ?? zr(e), r = t.highlightFields ?? Vr(e, n), i = [{
|
|
5409
5500
|
label: "Details",
|
|
5410
|
-
children: [
|
|
5501
|
+
children: [Gr(e, t.sections, r)]
|
|
5411
5502
|
}];
|
|
5412
5503
|
return !t.hideRelatedTab && Array.isArray(t.related) && t.related.length > 0 && i.push({
|
|
5413
5504
|
label: "Related",
|
|
@@ -5436,15 +5527,15 @@ function Br(e, t = {}) {
|
|
|
5436
5527
|
items: i
|
|
5437
5528
|
};
|
|
5438
5529
|
}
|
|
5439
|
-
function
|
|
5530
|
+
function qr() {
|
|
5440
5531
|
return { type: "record:discussion" };
|
|
5441
5532
|
}
|
|
5442
|
-
function
|
|
5533
|
+
function Jr(e, t = {}) {
|
|
5443
5534
|
let n = t.slots || {}, r = [];
|
|
5444
|
-
"header" in n && n.header !== void 0 ? r.push(...
|
|
5535
|
+
"header" in n && n.header !== void 0 ? r.push(...Rr(n.header)) : r.push(Hr(e, {
|
|
5445
5536
|
recordChrome: t.recordChrome,
|
|
5446
5537
|
actions: t.headerActions
|
|
5447
|
-
})), "actions" in n && n.actions !== void 0 && r.push(...
|
|
5538
|
+
})), "actions" in n && n.actions !== void 0 && r.push(...Rr(n.actions)), "alerts" in n && n.alerts !== void 0 && r.push(...Rr(n.alerts)), "highlights" in n && n.highlights !== void 0 ? r.push(...Rr(n.highlights)) : r.push(...Wr(e, {
|
|
5448
5539
|
highlightFields: t.highlightFields,
|
|
5449
5540
|
statusField: t.statusField,
|
|
5450
5541
|
stages: t.stages,
|
|
@@ -5452,9 +5543,9 @@ function Hr(e, t = {}) {
|
|
|
5452
5543
|
hidePath: t.hidePath
|
|
5453
5544
|
}));
|
|
5454
5545
|
let i = t.showReferenceRail === !0 && !t.hideReferenceRail && Array.isArray(t.related) && t.related.length >= 2, a = t.hideRelatedTab ?? i;
|
|
5455
|
-
if ("tabs" in n && n.tabs !== void 0) r.push(...
|
|
5546
|
+
if ("tabs" in n && n.tabs !== void 0) r.push(...Rr(n.tabs));
|
|
5456
5547
|
else if ("details" in n && n.details !== void 0) {
|
|
5457
|
-
let i =
|
|
5548
|
+
let i = Rr(n.details), o = Kr(e, {
|
|
5458
5549
|
sections: t.sections,
|
|
5459
5550
|
related: t.related,
|
|
5460
5551
|
showActivity: t.showActivity,
|
|
@@ -5467,7 +5558,7 @@ function Hr(e, t = {}) {
|
|
|
5467
5558
|
...o.items[0],
|
|
5468
5559
|
children: i
|
|
5469
5560
|
}), r.push(o);
|
|
5470
|
-
} else r.push(
|
|
5561
|
+
} else r.push(Kr(e, {
|
|
5471
5562
|
sections: t.sections,
|
|
5472
5563
|
related: t.related,
|
|
5473
5564
|
showActivity: t.showActivity,
|
|
@@ -5476,12 +5567,12 @@ function Hr(e, t = {}) {
|
|
|
5476
5567
|
statusField: t.statusField,
|
|
5477
5568
|
hideRelatedTab: a
|
|
5478
5569
|
}));
|
|
5479
|
-
"discussion" in n && n.discussion !== void 0 ? r.push(...
|
|
5570
|
+
"discussion" in n && n.discussion !== void 0 ? r.push(...Rr(n.discussion)) : t.hideDiscussion || r.push(qr());
|
|
5480
5571
|
let o = [{
|
|
5481
5572
|
name: "main",
|
|
5482
5573
|
width: "full",
|
|
5483
5574
|
components: r
|
|
5484
|
-
}], s =
|
|
5575
|
+
}], s = Rr(n.rightRail);
|
|
5485
5576
|
if (i || s.length > 0) {
|
|
5486
5577
|
let e = [];
|
|
5487
5578
|
i && e.push({
|
|
@@ -5509,7 +5600,7 @@ function Hr(e, t = {}) {
|
|
|
5509
5600
|
regions: o
|
|
5510
5601
|
};
|
|
5511
5602
|
}
|
|
5512
|
-
e.register("detail-view",
|
|
5603
|
+
e.register("detail-view", _n, {
|
|
5513
5604
|
namespace: "plugin-detail",
|
|
5514
5605
|
label: "Detail View",
|
|
5515
5606
|
category: "Views",
|
|
@@ -5639,7 +5730,7 @@ e.register("detail-view", dn, {
|
|
|
5639
5730
|
tabs: [],
|
|
5640
5731
|
related: []
|
|
5641
5732
|
}
|
|
5642
|
-
}), e.register("detail-section",
|
|
5733
|
+
}), e.register("detail-section", Bt, {
|
|
5643
5734
|
namespace: "plugin-detail",
|
|
5644
5735
|
label: "Detail Section",
|
|
5645
5736
|
category: "Detail Components",
|
|
@@ -5690,7 +5781,7 @@ e.register("detail-view", dn, {
|
|
|
5690
5781
|
label: "Header Color"
|
|
5691
5782
|
}
|
|
5692
5783
|
]
|
|
5693
|
-
}), e.register("related-list",
|
|
5784
|
+
}), e.register("related-list", Ut, {
|
|
5694
5785
|
namespace: "plugin-detail",
|
|
5695
5786
|
label: "Related List",
|
|
5696
5787
|
category: "Detail Components",
|
|
@@ -5737,7 +5828,7 @@ e.register("detail-view", dn, {
|
|
|
5737
5828
|
label: "Columns"
|
|
5738
5829
|
}
|
|
5739
5830
|
]
|
|
5740
|
-
}), e.register("detail",
|
|
5831
|
+
}), e.register("detail", _n, {
|
|
5741
5832
|
namespace: "view",
|
|
5742
5833
|
category: "view",
|
|
5743
5834
|
label: "Detail",
|
|
@@ -5760,61 +5851,61 @@ e.register("detail-view", dn, {
|
|
|
5760
5851
|
label: "Fields"
|
|
5761
5852
|
}
|
|
5762
5853
|
]
|
|
5763
|
-
}), e.register("record:details",
|
|
5854
|
+
}), e.register("record:details", wn, {
|
|
5764
5855
|
namespace: "record",
|
|
5765
5856
|
category: "record",
|
|
5766
5857
|
label: "Record Details",
|
|
5767
5858
|
icon: "FileText"
|
|
5768
|
-
}), e.register("record:related_list",
|
|
5859
|
+
}), e.register("record:related_list", Dn, {
|
|
5769
5860
|
namespace: "record",
|
|
5770
5861
|
category: "record",
|
|
5771
5862
|
label: "Related List",
|
|
5772
5863
|
icon: "List"
|
|
5773
|
-
}), e.register("record:highlights",
|
|
5864
|
+
}), e.register("record:highlights", kn, {
|
|
5774
5865
|
namespace: "record",
|
|
5775
5866
|
category: "record",
|
|
5776
5867
|
label: "Highlights Panel",
|
|
5777
5868
|
icon: "Star"
|
|
5778
|
-
}), e.register("record:activity",
|
|
5869
|
+
}), e.register("record:activity", Yn, {
|
|
5779
5870
|
namespace: "record",
|
|
5780
5871
|
category: "record",
|
|
5781
5872
|
label: "Activity Timeline",
|
|
5782
5873
|
icon: "Activity"
|
|
5783
|
-
}), e.register("record:chatter",
|
|
5874
|
+
}), e.register("record:chatter", Qn, {
|
|
5784
5875
|
namespace: "record",
|
|
5785
5876
|
category: "record",
|
|
5786
5877
|
label: "Chatter Feed",
|
|
5787
5878
|
icon: "MessageSquare"
|
|
5788
|
-
}), e.register("record:discussion",
|
|
5879
|
+
}), e.register("record:discussion", Qn, {
|
|
5789
5880
|
namespace: "record",
|
|
5790
5881
|
category: "record",
|
|
5791
5882
|
label: "Discussion",
|
|
5792
5883
|
icon: "MessageSquare"
|
|
5793
|
-
}), e.register("record:path",
|
|
5884
|
+
}), e.register("record:path", er, {
|
|
5794
5885
|
namespace: "record",
|
|
5795
5886
|
category: "record",
|
|
5796
5887
|
label: "Path / Stepper",
|
|
5797
5888
|
icon: "GitBranch"
|
|
5798
|
-
}), e.register("record:quick_actions",
|
|
5889
|
+
}), e.register("record:quick_actions", nr, {
|
|
5799
5890
|
namespace: "record",
|
|
5800
5891
|
category: "record",
|
|
5801
5892
|
label: "Quick Actions",
|
|
5802
5893
|
icon: "Zap"
|
|
5803
|
-
}), e.register("record:history",
|
|
5894
|
+
}), e.register("record:history", or, {
|
|
5804
5895
|
namespace: "record",
|
|
5805
5896
|
category: "record",
|
|
5806
5897
|
label: "History Timeline",
|
|
5807
5898
|
icon: "Clock"
|
|
5808
|
-
}), e.register("record:reference_rail",
|
|
5899
|
+
}), e.register("record:reference_rail", ur, {
|
|
5809
5900
|
namespace: "record",
|
|
5810
5901
|
category: "record",
|
|
5811
5902
|
label: "Reference Rail",
|
|
5812
5903
|
icon: "PanelRight"
|
|
5813
|
-
}), e.register("record:alert",
|
|
5904
|
+
}), e.register("record:alert", pr, {
|
|
5814
5905
|
namespace: "record",
|
|
5815
5906
|
category: "record",
|
|
5816
5907
|
label: "Alert Banner",
|
|
5817
5908
|
icon: "AlertTriangle"
|
|
5818
5909
|
});
|
|
5819
5910
|
//#endregion
|
|
5820
|
-
export {
|
|
5911
|
+
export { $t as ActivityTimeline, Vn as CommentAttachment, Pr as CommentInput, bn as ConcurrentUpdateDialog, It as DETAIL_DEFAULT_TRANSLATIONS, Bt as DetailSection, Vt as DetailTabs, _n as DetailView, wr as DiffView, An as FieldChangeItem, Gt as HeaderHighlight, sn as HistoryTimeline, yr as InlineCreateRelated, Fr as MentionAutocomplete, Nr as PointInTimeRestore, Mn as ReactionPicker, Yn as RecordActivityRenderer, qn as RecordActivityTimeline, pr as RecordAlertRenderer, Xn as RecordChatterPanel, Qn as RecordChatterRenderer, qt as RecordComments, _r as RecordDetailDrawer, wn as RecordDetailsRenderer, kn as RecordHighlightsRenderer, or as RecordHistoryRenderer, mn as RecordMetaFooter, Tr as RecordNavigationEnhanced, er as RecordPathRenderer, nr as RecordQuickActionsRenderer, ur as RecordReferenceRailRenderer, Dn as RecordRelatedListRenderer, Ut as RelatedList, jr as RelationshipGraph, Ln as RichTextCommentInput, Wt as SectionGroup, Fn as SubscriptionToggle, Pn as ThreadedReplies, Nt as applyAutoSpan, Pt as applyDetailAutoLayout, Ur as buildDefaultActions, Gr as buildDefaultDetails, qr as buildDefaultDiscussion, Hr as buildDefaultHeader, Wr as buildDefaultHighlights, Jr as buildDefaultPageSchema, Kr as buildDefaultTabs, Ir as createMentionFromSuggestion, Ft as createSafeTranslationHook, Vr as deriveHighlightFields, vr as deriveRecordPageHref, Br as deriveStages, zr as detectStatusField, Lr as extractMentions, Mt as inferDetailColumns, xn as isConcurrentUpdateError, jt as isWideFieldType, $ as useDetailTranslation };
|