@object-ui/plugin-detail 7.2.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -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/SectionGroup.d.ts +2 -0
- package/dist/SectionGroup.d.ts.map +1 -1
- package/dist/index.js +863 -834
- package/dist/index.umd.cjs +3 -3
- 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 te, SheetHeader as F, SheetTitle as I, Skeleton as L, Tabs as ne, TabsContent as
|
|
5
|
-
import { Activity 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 Dt = 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 Mt(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 Nt = {
|
|
|
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 (
|
|
212
|
-
let { fields:
|
|
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 Ft = ({ 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:
|
|
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
|
-
className:
|
|
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,79 +318,79 @@ var Ft = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, i
|
|
|
296
318
|
});
|
|
297
319
|
})()
|
|
298
320
|
}) : /* @__PURE__ */ Q("div", {
|
|
299
|
-
className:
|
|
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
|
-
if (
|
|
330
|
-
|
|
351
|
+
if (I.length <= R) {
|
|
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
|
-
|
|
338
|
-
|
|
359
|
+
re,
|
|
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:
|
|
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
|
-
className:
|
|
363
|
-
children:
|
|
384
|
+
className: W(r),
|
|
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,
|
|
370
392
|
children: /* @__PURE__ */ Q(S, {
|
|
371
|
-
className:
|
|
393
|
+
className: W("py-3 px-4 sm:py-4 sm:px-6 cursor-pointer hover:bg-muted/50 transition-colors", e.headerColor && `bg-${e.headerColor}`),
|
|
372
394
|
children: [/* @__PURE__ */ Q(C, {
|
|
373
395
|
className: "flex items-center justify-between text-base font-semibold tracking-tight",
|
|
374
396
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -379,21 +401,21 @@ var Ft = ({ 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
|
-
className:
|
|
416
|
+
className: W(e.showBorder === !1 ? "border-none shadow-none" : "", r),
|
|
395
417
|
children: [e.title && /* @__PURE__ */ Q(S, {
|
|
396
|
-
className:
|
|
418
|
+
className: W("py-3 px-4 sm:py-4 sm:px-6", e.headerColor && `bg-${e.headerColor}`),
|
|
397
419
|
children: [/* @__PURE__ */ Z(C, {
|
|
398
420
|
className: "flex items-center justify-between text-base font-semibold tracking-tight",
|
|
399
421
|
children: /* @__PURE__ */ Q("div", {
|
|
@@ -409,18 +431,18 @@ var Ft = ({ 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 Ft = ({ 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,37 +479,37 @@ var Ft = ({ 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 ne = i !== void 0,
|
|
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
|
-
ne &&
|
|
488
|
+
ne && z(i ?? []);
|
|
467
489
|
}, [i, ne]), n.useEffect(() => {
|
|
468
|
-
r && g?.getObjectSchema && g.getObjectSchema(r).then(
|
|
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
494
|
if (r && !ne) {
|
|
473
495
|
if (!(F && I != null && I !== "")) {
|
|
474
|
-
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.`),
|
|
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;
|
|
476
498
|
}
|
|
477
|
-
|
|
499
|
+
V(!0);
|
|
478
500
|
let e = { [F]: I };
|
|
479
501
|
if (g && typeof g.find == "function") g.find(r, { $filter: e }).then((e) => {
|
|
480
|
-
|
|
502
|
+
z(Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : []), V(!1);
|
|
481
503
|
}).catch((e) => {
|
|
482
|
-
console.error("Failed to fetch related data:", e),
|
|
504
|
+
console.error("Failed to fetch related data:", e), V(!1);
|
|
483
505
|
});
|
|
484
506
|
else {
|
|
485
507
|
let e = new URLSearchParams({ [`filter[${F}]`]: String(I) }).toString();
|
|
486
508
|
fetch(`${r}?${e}`).then((e) => e.json()).then((e) => {
|
|
487
|
-
|
|
509
|
+
z(Array.isArray(e) ? e : e?.data || []);
|
|
488
510
|
}).catch((e) => {
|
|
489
511
|
console.error("Failed to fetch related data:", e);
|
|
490
|
-
}).finally(() =>
|
|
512
|
+
}).finally(() => V(!1));
|
|
491
513
|
}
|
|
492
514
|
}
|
|
493
515
|
}, [
|
|
@@ -496,20 +518,20 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
496
518
|
g,
|
|
497
519
|
F,
|
|
498
520
|
I,
|
|
499
|
-
|
|
521
|
+
Se
|
|
500
522
|
]), n.useEffect(() => {
|
|
501
|
-
if (!g?.find || !
|
|
502
|
-
let e =
|
|
523
|
+
if (!g?.find || !K?.fields || !R.length) return;
|
|
524
|
+
let e = K.fields, t = [];
|
|
503
525
|
for (let [n, r] of Object.entries(e)) {
|
|
504
526
|
if (!r || r.type !== "lookup" && r.type !== "master_detail") continue;
|
|
505
527
|
let e = r.reference_to || r.reference;
|
|
506
528
|
if (!e) continue;
|
|
507
529
|
let i = /* @__PURE__ */ new Set();
|
|
508
|
-
for (let e of
|
|
530
|
+
for (let e of R) {
|
|
509
531
|
let t = e?.[n];
|
|
510
532
|
t != null && (typeof t == "string" && t ? i.add(t) : typeof t == "number" && i.add(String(t)));
|
|
511
533
|
}
|
|
512
|
-
let a =
|
|
534
|
+
let a = we[n] || {}, o = Array.from(i).filter((e) => !(e in a));
|
|
513
535
|
o.length > 0 && t.push({
|
|
514
536
|
fieldName: n,
|
|
515
537
|
target: e,
|
|
@@ -535,7 +557,7 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
535
557
|
fieldName: e,
|
|
536
558
|
map: {}
|
|
537
559
|
})))).then((e) => {
|
|
538
|
-
n ||
|
|
560
|
+
n || Ee((t) => {
|
|
539
561
|
let n = { ...t };
|
|
540
562
|
for (let { fieldName: t, map: r } of e) n[t] = {
|
|
541
563
|
...n[t] || {},
|
|
@@ -548,47 +570,47 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
548
570
|
};
|
|
549
571
|
}, [
|
|
550
572
|
g,
|
|
551
|
-
|
|
552
|
-
|
|
573
|
+
K,
|
|
574
|
+
R
|
|
553
575
|
]);
|
|
554
|
-
let
|
|
555
|
-
if (!
|
|
556
|
-
let e =
|
|
557
|
-
return
|
|
558
|
-
}, [
|
|
559
|
-
let n = e[
|
|
576
|
+
let Oe = n.useMemo(() => {
|
|
577
|
+
if (!ce) return R;
|
|
578
|
+
let e = ce.toLowerCase();
|
|
579
|
+
return R.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
580
|
+
}, [R, ce]), ke = n.useMemo(() => U ? [...Oe].sort((e, t) => {
|
|
581
|
+
let n = e[U], r = t[U];
|
|
560
582
|
if (n == null && r == null) return 0;
|
|
561
583
|
if (n == null) return 1;
|
|
562
584
|
if (r == null) return -1;
|
|
563
585
|
let i = String(n).localeCompare(String(r), void 0, { numeric: !0 });
|
|
564
|
-
return
|
|
565
|
-
}) :
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
]),
|
|
586
|
+
return G === "asc" ? i : -i;
|
|
587
|
+
}) : Oe, [
|
|
588
|
+
Oe,
|
|
589
|
+
U,
|
|
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;
|
|
570
592
|
n.useEffect(() => {
|
|
571
|
-
|
|
593
|
+
H(0);
|
|
572
594
|
}, [
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
595
|
+
ce,
|
|
596
|
+
U,
|
|
597
|
+
G
|
|
576
598
|
]);
|
|
577
|
-
let
|
|
578
|
-
|
|
579
|
-
}, [
|
|
580
|
-
|
|
581
|
-
}, []),
|
|
582
|
-
if (
|
|
583
|
-
await D?.(
|
|
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);
|
|
584
606
|
} catch (e) {
|
|
585
607
|
console.error("[RelatedList] remove failed", e);
|
|
586
608
|
}
|
|
587
|
-
|
|
588
|
-
}, [
|
|
609
|
+
Pe(null);
|
|
610
|
+
}, [Ne, D]), Le = n.useCallback(async (e) => {
|
|
589
611
|
if (!A || !g || !r || F == null || I == null) return;
|
|
590
612
|
let t = A.picker.valueField || "id";
|
|
591
|
-
|
|
613
|
+
ye(!0), xe(null);
|
|
592
614
|
try {
|
|
593
615
|
for (let n of e || []) {
|
|
594
616
|
let e = n?.[t] ?? n?.id;
|
|
@@ -597,12 +619,12 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
597
619
|
[A.linkField]: e
|
|
598
620
|
}) : await g.update?.(A.picker.object, String(e), { [F]: I }));
|
|
599
621
|
}
|
|
600
|
-
|
|
622
|
+
Ce((e) => e + 1);
|
|
601
623
|
} catch (e) {
|
|
602
624
|
let t = e?.body?.error ?? e?.error ?? e?.message ?? String(e);
|
|
603
|
-
|
|
625
|
+
xe(typeof t == "string" ? t : "Failed to add");
|
|
604
626
|
} finally {
|
|
605
|
-
|
|
627
|
+
ye(!1), me(!1);
|
|
606
628
|
}
|
|
607
629
|
}, [
|
|
608
630
|
A,
|
|
@@ -610,21 +632,21 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
610
632
|
r,
|
|
611
633
|
F,
|
|
612
634
|
I
|
|
613
|
-
]),
|
|
614
|
-
let e = _ || r || "", t = (t) => !
|
|
635
|
+
]), X = Tt(), Re = n.useMemo(() => {
|
|
636
|
+
let e = _ || r || "", t = (t) => !X?.isLoaded || !e ? t : t.filter((t) => {
|
|
615
637
|
let n = t?.accessorKey || t?.field || t?.name;
|
|
616
|
-
return n ?
|
|
617
|
-
}), 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) =>
|
|
638
|
+
return n ? X.checkField(e, String(n), "read") : !0;
|
|
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) => {
|
|
618
640
|
let t = e?.accessorKey || e?.field || e?.name;
|
|
619
|
-
return t ?
|
|
641
|
+
return t ? R.some((e) => !a(e?.[t])) : !0;
|
|
620
642
|
}) : e, s = (e, t) => {
|
|
621
643
|
if (!t?.type) return;
|
|
622
|
-
let r =
|
|
644
|
+
let r = bt(St({
|
|
623
645
|
type: t.type,
|
|
624
646
|
format: t.format
|
|
625
647
|
}) || t.type);
|
|
626
648
|
if (!r) return;
|
|
627
|
-
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]) => ({
|
|
628
650
|
value: e,
|
|
629
651
|
label: t
|
|
630
652
|
})) : void 0, o = {
|
|
@@ -646,7 +668,7 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
646
668
|
if (typeof t != "string") {
|
|
647
669
|
let e = t?.accessorKey || t?.field || t?.name;
|
|
648
670
|
if (t && !t.cell && !t.render && e) {
|
|
649
|
-
let n =
|
|
671
|
+
let n = K?.fields?.[e], r = n ? s(String(e), n) : void 0;
|
|
650
672
|
if (r) return {
|
|
651
673
|
...t,
|
|
652
674
|
cell: r
|
|
@@ -654,16 +676,16 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
654
676
|
}
|
|
655
677
|
return t;
|
|
656
678
|
}
|
|
657
|
-
let n =
|
|
679
|
+
let n = K?.fields?.[t], r = {
|
|
658
680
|
accessorKey: t,
|
|
659
|
-
header: n?.label ||
|
|
681
|
+
header: n?.label || De(e, t, n) || t,
|
|
660
682
|
fieldDef: n,
|
|
661
683
|
fieldType: n?.type
|
|
662
684
|
}, i = n ? s(t, n) : void 0;
|
|
663
685
|
return i && (r.cell = i), r;
|
|
664
686
|
};
|
|
665
687
|
if (m && m.length > 0) return o(t(i(m.map(c))));
|
|
666
|
-
if (!
|
|
688
|
+
if (!K?.fields) return [];
|
|
667
689
|
let l = e, u = new Set([
|
|
668
690
|
"image",
|
|
669
691
|
"file",
|
|
@@ -680,7 +702,7 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
680
702
|
"label",
|
|
681
703
|
"code",
|
|
682
704
|
"number"
|
|
683
|
-
], f = Object.entries(
|
|
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([
|
|
684
706
|
"created_at",
|
|
685
707
|
"updated_at",
|
|
686
708
|
"created_by",
|
|
@@ -698,7 +720,7 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
698
720
|
}), o(f.map(([e, t]) => {
|
|
699
721
|
let n = {
|
|
700
722
|
accessorKey: e,
|
|
701
|
-
header:
|
|
723
|
+
header: De(l, e, t.label || e)
|
|
702
724
|
};
|
|
703
725
|
if (t.type) {
|
|
704
726
|
let r = s(e, t);
|
|
@@ -708,22 +730,22 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
708
730
|
})).slice(0, Math.max(1, j));
|
|
709
731
|
}, [
|
|
710
732
|
m,
|
|
711
|
-
|
|
733
|
+
K,
|
|
712
734
|
_,
|
|
713
735
|
r,
|
|
714
|
-
|
|
736
|
+
De,
|
|
715
737
|
F,
|
|
716
|
-
|
|
738
|
+
R,
|
|
717
739
|
j,
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
]), ze = !!E || !!D, Be =
|
|
740
|
+
we,
|
|
741
|
+
X
|
|
742
|
+
]), ze = !!E || !!D, Be = ae(), Ve = n.useMemo(() => {
|
|
721
743
|
if (a) return a;
|
|
722
744
|
if (Be && (t === "grid" || t === "table")) {
|
|
723
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);
|
|
724
746
|
return {
|
|
725
747
|
type: "object-gallery",
|
|
726
|
-
data:
|
|
748
|
+
data: je,
|
|
727
749
|
objectName: r,
|
|
728
750
|
gallery: {
|
|
729
751
|
titleField: e || "name",
|
|
@@ -737,20 +759,20 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
737
759
|
case "grid":
|
|
738
760
|
case "table": return {
|
|
739
761
|
type: "data-table",
|
|
740
|
-
data:
|
|
762
|
+
data: je,
|
|
741
763
|
columns: Re,
|
|
742
764
|
pagination: !1,
|
|
743
|
-
pageSize:
|
|
765
|
+
pageSize: Y || 10,
|
|
744
766
|
searchable: !1,
|
|
745
767
|
exportable: !1,
|
|
746
768
|
rowActions: ze,
|
|
747
769
|
onRowEdit: E,
|
|
748
|
-
onRowDelete: D ?
|
|
770
|
+
onRowDelete: D ? Fe : void 0,
|
|
749
771
|
onRowClick: k
|
|
750
772
|
};
|
|
751
773
|
case "list": return {
|
|
752
774
|
type: "data-list",
|
|
753
|
-
data:
|
|
775
|
+
data: je
|
|
754
776
|
};
|
|
755
777
|
default: return {
|
|
756
778
|
type: "div",
|
|
@@ -759,47 +781,47 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
759
781
|
}
|
|
760
782
|
}, [
|
|
761
783
|
t,
|
|
762
|
-
|
|
784
|
+
je,
|
|
763
785
|
Re,
|
|
764
786
|
a,
|
|
765
|
-
|
|
787
|
+
Y,
|
|
766
788
|
ze,
|
|
767
789
|
E,
|
|
768
790
|
D,
|
|
769
|
-
|
|
791
|
+
Fe,
|
|
770
792
|
k,
|
|
771
793
|
Be,
|
|
772
794
|
r
|
|
773
|
-
]), He = P ? "cursor-pointer select-none" : void 0, Ue = P ? () =>
|
|
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;
|
|
774
796
|
return /* @__PURE__ */ Q(b, {
|
|
775
|
-
className:
|
|
797
|
+
className: W("shadow-none border-border/60 bg-transparent", Ke && "bg-muted/10", h),
|
|
776
798
|
children: [
|
|
777
799
|
/* @__PURE__ */ Z(S, {
|
|
778
|
-
className:
|
|
800
|
+
className: W("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", He),
|
|
779
801
|
onClick: Ue,
|
|
780
802
|
children: /* @__PURE__ */ Q(C, {
|
|
781
803
|
className: "flex items-center justify-between gap-2 text-sm font-semibold",
|
|
782
804
|
children: [/* @__PURE__ */ Q("div", {
|
|
783
805
|
className: "flex items-center gap-2 min-w-0",
|
|
784
806
|
children: [
|
|
785
|
-
P && Z(
|
|
807
|
+
P && Z(de ? ve : ge, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
|
|
786
808
|
/* @__PURE__ */ Z(Ge, {
|
|
787
809
|
className: "h-4 w-4 text-muted-foreground shrink-0",
|
|
788
810
|
"aria-hidden": !0
|
|
789
811
|
}),
|
|
790
812
|
/* @__PURE__ */ Z("span", {
|
|
791
|
-
className:
|
|
813
|
+
className: W("truncate", Ke && "text-muted-foreground font-medium"),
|
|
792
814
|
children: e
|
|
793
815
|
}),
|
|
794
816
|
/* @__PURE__ */ Z(v, {
|
|
795
817
|
variant: "secondary",
|
|
796
|
-
className:
|
|
797
|
-
"aria-label": `${
|
|
798
|
-
children:
|
|
818
|
+
className: W("text-xs font-normal h-5 px-1.5", R.length === 0 && "bg-muted text-muted-foreground"),
|
|
819
|
+
"aria-label": `${R.length} records`,
|
|
820
|
+
children: R.length
|
|
799
821
|
}),
|
|
800
822
|
Ke && /* @__PURE__ */ Z("span", {
|
|
801
823
|
className: "text-xs text-muted-foreground/70 italic ml-1 truncate",
|
|
802
|
-
children:
|
|
824
|
+
children: J("detail.noRelatedRecords")
|
|
803
825
|
})
|
|
804
826
|
]
|
|
805
827
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -807,12 +829,12 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
807
829
|
children: [A && /* @__PURE__ */ Q(y, {
|
|
808
830
|
variant: Ke ? "ghost" : "outline",
|
|
809
831
|
size: "sm",
|
|
810
|
-
disabled:
|
|
832
|
+
disabled: he,
|
|
811
833
|
onClick: (e) => {
|
|
812
|
-
e.stopPropagation(),
|
|
834
|
+
e.stopPropagation(), xe(null), me(!0);
|
|
813
835
|
},
|
|
814
836
|
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
815
|
-
children: [/* @__PURE__ */ Z(We, { className: "h-3.5 w-3.5" }), A.label ||
|
|
837
|
+
children: [/* @__PURE__ */ Z(We, { className: "h-3.5 w-3.5" }), A.label || J("detail.add", { defaultValue: "Add" })]
|
|
816
838
|
}), w && /* @__PURE__ */ Q(y, {
|
|
817
839
|
variant: Ke ? "ghost" : "outline",
|
|
818
840
|
size: "sm",
|
|
@@ -820,75 +842,75 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
820
842
|
e.stopPropagation(), w();
|
|
821
843
|
},
|
|
822
844
|
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
823
|
-
children: [/* @__PURE__ */ Z(We, { className: "h-3.5 w-3.5" }),
|
|
845
|
+
children: [/* @__PURE__ */ Z(We, { className: "h-3.5 w-3.5" }), J("detail.new")]
|
|
824
846
|
})]
|
|
825
847
|
})]
|
|
826
848
|
})
|
|
827
849
|
}),
|
|
828
|
-
!
|
|
829
|
-
className:
|
|
850
|
+
!de && !Ke && /* @__PURE__ */ Q(x, {
|
|
851
|
+
className: W("pt-0 pb-4 px-4"),
|
|
830
852
|
children: [
|
|
831
853
|
qe && /* @__PURE__ */ Z("div", {
|
|
832
854
|
className: "mb-3",
|
|
833
855
|
children: /* @__PURE__ */ Z(O, {
|
|
834
|
-
placeholder:
|
|
835
|
-
value:
|
|
836
|
-
onChange: (e) =>
|
|
856
|
+
placeholder: J("detail.filterPlaceholder"),
|
|
857
|
+
value: ce,
|
|
858
|
+
onChange: (e) => le(e.target.value),
|
|
837
859
|
className: "h-8 text-sm"
|
|
838
860
|
})
|
|
839
861
|
}),
|
|
840
|
-
N && Re && Re.length > 0 &&
|
|
862
|
+
N && Re && Re.length > 0 && R.length > 0 && /* @__PURE__ */ Z("div", {
|
|
841
863
|
className: "flex flex-wrap gap-1 mb-3",
|
|
842
864
|
children: Re.map((e) => {
|
|
843
865
|
let t = e.accessorKey || e.field || e.name;
|
|
844
866
|
if (!t) return null;
|
|
845
|
-
let n = e.header || e.label || t, r =
|
|
867
|
+
let n = e.header || e.label || t, r = U === t;
|
|
846
868
|
return /* @__PURE__ */ Q(y, {
|
|
847
869
|
variant: r ? "secondary" : "ghost",
|
|
848
870
|
size: "sm",
|
|
849
871
|
className: "gap-1 h-7 text-xs",
|
|
850
|
-
onClick: () =>
|
|
872
|
+
onClick: () => Me(t),
|
|
851
873
|
children: [
|
|
852
|
-
/* @__PURE__ */ Z(
|
|
874
|
+
/* @__PURE__ */ Z(ue, { className: "h-3 w-3" }),
|
|
853
875
|
n,
|
|
854
|
-
r && (
|
|
876
|
+
r && (G === "asc" ? " ↑" : " ↓")
|
|
855
877
|
]
|
|
856
878
|
}, t);
|
|
857
879
|
})
|
|
858
880
|
}),
|
|
859
|
-
|
|
881
|
+
B ? /* @__PURE__ */ Z("div", {
|
|
860
882
|
className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
|
|
861
|
-
children:
|
|
883
|
+
children: J("detail.loading")
|
|
862
884
|
}) : /* @__PURE__ */ Z(rt, { schema: Ve }),
|
|
863
|
-
|
|
885
|
+
Y > 0 && ke.length > Y && /* @__PURE__ */ Q("div", {
|
|
864
886
|
className: "flex items-center justify-between mt-3 pt-3 border-t",
|
|
865
887
|
children: [
|
|
866
888
|
/* @__PURE__ */ Q(y, {
|
|
867
889
|
variant: "outline",
|
|
868
890
|
size: "sm",
|
|
869
891
|
className: "h-7 text-xs gap-1",
|
|
870
|
-
disabled:
|
|
871
|
-
onClick: () =>
|
|
872
|
-
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")]
|
|
873
895
|
}),
|
|
874
896
|
/* @__PURE__ */ Z("span", {
|
|
875
897
|
className: "text-xs text-muted-foreground",
|
|
876
|
-
children:
|
|
877
|
-
current:
|
|
878
|
-
total:
|
|
898
|
+
children: J("detail.pageOf", {
|
|
899
|
+
current: ie + 1,
|
|
900
|
+
total: Ae
|
|
879
901
|
})
|
|
880
902
|
}),
|
|
881
903
|
/* @__PURE__ */ Q(y, {
|
|
882
904
|
variant: "outline",
|
|
883
905
|
size: "sm",
|
|
884
906
|
className: "h-7 text-xs gap-1",
|
|
885
|
-
disabled:
|
|
886
|
-
onClick: () =>
|
|
887
|
-
children: [
|
|
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" })]
|
|
888
910
|
})
|
|
889
911
|
]
|
|
890
912
|
}),
|
|
891
|
-
T && !Ke &&
|
|
913
|
+
T && !Ke && Y > 0 && ke.length > Y && /* @__PURE__ */ Z("div", {
|
|
892
914
|
className: "mt-3 pt-3 border-t flex justify-center",
|
|
893
915
|
children: /* @__PURE__ */ Q("button", {
|
|
894
916
|
type: "button",
|
|
@@ -896,56 +918,57 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
896
918
|
e.stopPropagation(), T();
|
|
897
919
|
},
|
|
898
920
|
className: "text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors",
|
|
899
|
-
children: [
|
|
921
|
+
children: [J("detail.viewAll"), /* @__PURE__ */ Z(Te, { className: "h-3 w-3" })]
|
|
900
922
|
})
|
|
901
923
|
})
|
|
902
924
|
]
|
|
903
925
|
}),
|
|
904
926
|
/* @__PURE__ */ Z(o, {
|
|
905
|
-
open:
|
|
927
|
+
open: Ne !== null,
|
|
906
928
|
onOpenChange: (e) => {
|
|
907
|
-
e ||
|
|
929
|
+
e || Pe(null);
|
|
908
930
|
},
|
|
909
|
-
children: /* @__PURE__ */ Q(l, { children: [/* @__PURE__ */ Q(f, { children: [/* @__PURE__ */ Z(p, { children:
|
|
910
|
-
onClick:
|
|
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, {
|
|
932
|
+
onClick: Ie,
|
|
911
933
|
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
912
|
-
children:
|
|
934
|
+
children: J("detail.delete", { defaultValue: "Delete" })
|
|
913
935
|
})] })] })
|
|
914
936
|
}),
|
|
915
|
-
|
|
937
|
+
be && /* @__PURE__ */ Z("div", {
|
|
916
938
|
className: "mx-4 mb-3 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
|
|
917
939
|
role: "alert",
|
|
918
|
-
children:
|
|
940
|
+
children: be
|
|
919
941
|
}),
|
|
920
|
-
A && g && /* @__PURE__ */ Z(
|
|
921
|
-
open:
|
|
922
|
-
onOpenChange: (e) =>
|
|
942
|
+
A && g && /* @__PURE__ */ Z(gt, {
|
|
943
|
+
open: pe,
|
|
944
|
+
onOpenChange: (e) => me(e),
|
|
923
945
|
multiple: !0,
|
|
924
946
|
dataSource: g,
|
|
925
947
|
objectName: A.picker.object,
|
|
926
|
-
title: A.label ||
|
|
948
|
+
title: A.label || J("detail.add", { defaultValue: "Add" }),
|
|
927
949
|
onSelect: () => {},
|
|
928
950
|
onSelectRecords: (e) => {
|
|
929
|
-
|
|
951
|
+
Le(e);
|
|
930
952
|
}
|
|
931
953
|
})
|
|
932
954
|
]
|
|
933
955
|
});
|
|
934
|
-
},
|
|
935
|
-
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", {
|
|
936
958
|
className: "space-y-3 sm:space-y-4",
|
|
937
|
-
children: e.sections.map((e, n) => /* @__PURE__ */ Z(
|
|
959
|
+
children: e.sections.map((e, n) => /* @__PURE__ */ Z(Bt, {
|
|
938
960
|
section: e,
|
|
939
961
|
data: t,
|
|
940
962
|
objectSchema: i,
|
|
941
963
|
objectName: a,
|
|
942
964
|
isEditing: o,
|
|
943
|
-
onFieldChange: s
|
|
965
|
+
onFieldChange: s,
|
|
966
|
+
dataSource: c
|
|
944
967
|
}, n))
|
|
945
968
|
});
|
|
946
|
-
return
|
|
947
|
-
open: !
|
|
948
|
-
onOpenChange: (e) =>
|
|
969
|
+
return l ? /* @__PURE__ */ Q(w, {
|
|
970
|
+
open: !u,
|
|
971
|
+
onOpenChange: (e) => d(!e),
|
|
949
972
|
className: r,
|
|
950
973
|
children: [
|
|
951
974
|
/* @__PURE__ */ Z(E, {
|
|
@@ -953,7 +976,7 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
953
976
|
children: /* @__PURE__ */ Q("div", {
|
|
954
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",
|
|
955
978
|
children: [
|
|
956
|
-
Z(
|
|
979
|
+
Z(u ? ve : ge, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
|
|
957
980
|
e.icon && /* @__PURE__ */ Z("span", {
|
|
958
981
|
className: "text-muted-foreground",
|
|
959
982
|
children: e.icon
|
|
@@ -965,17 +988,17 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
965
988
|
]
|
|
966
989
|
})
|
|
967
990
|
}),
|
|
968
|
-
e.description && !
|
|
991
|
+
e.description && !u && /* @__PURE__ */ Z("p", {
|
|
969
992
|
className: "text-sm text-muted-foreground mt-1",
|
|
970
993
|
children: e.description
|
|
971
994
|
}),
|
|
972
995
|
/* @__PURE__ */ Z(T, { children: /* @__PURE__ */ Z("div", {
|
|
973
996
|
className: "mt-3",
|
|
974
|
-
children:
|
|
997
|
+
children: f
|
|
975
998
|
}) })
|
|
976
999
|
]
|
|
977
1000
|
}) : /* @__PURE__ */ Q("div", {
|
|
978
|
-
className:
|
|
1001
|
+
className: W("space-y-3", r),
|
|
979
1002
|
children: [
|
|
980
1003
|
/* @__PURE__ */ Q("div", {
|
|
981
1004
|
className: "flex items-center gap-2 pb-2 border-b",
|
|
@@ -991,10 +1014,10 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
991
1014
|
className: "text-sm text-muted-foreground",
|
|
992
1015
|
children: e.description
|
|
993
1016
|
}),
|
|
994
|
-
|
|
1017
|
+
f
|
|
995
1018
|
]
|
|
996
1019
|
});
|
|
997
|
-
},
|
|
1020
|
+
}, Gt = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
|
|
998
1021
|
let { fieldLabel: a } = pt();
|
|
999
1022
|
if (!e.length || !t) return null;
|
|
1000
1023
|
let o = e.filter((e) => {
|
|
@@ -1002,10 +1025,10 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
1002
1025
|
return n != null && n !== "";
|
|
1003
1026
|
});
|
|
1004
1027
|
return o.length === 0 ? null : /* @__PURE__ */ Z("section", {
|
|
1005
|
-
className:
|
|
1028
|
+
className: W("@container border-b border-border/60 pb-4", n),
|
|
1006
1029
|
"aria-label": "Record highlights",
|
|
1007
1030
|
children: /* @__PURE__ */ Z("div", {
|
|
1008
|
-
className:
|
|
1031
|
+
className: W("flex flex-wrap gap-x-8 gap-y-3"),
|
|
1009
1032
|
children: o.map((e) => {
|
|
1010
1033
|
let n = t[e.name], o = i?.fields?.[e.name], s = e.type || o?.type, c = {
|
|
1011
1034
|
name: e.name,
|
|
@@ -1015,15 +1038,15 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
1015
1038
|
...o?.currency && { currency: o.currency },
|
|
1016
1039
|
...o?.precision !== void 0 && { precision: o.precision },
|
|
1017
1040
|
...o?.format && { format: o.format }
|
|
1018
|
-
}, 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";
|
|
1019
1042
|
return /* @__PURE__ */ Q("div", {
|
|
1020
|
-
className:
|
|
1043
|
+
className: W("flex flex-col gap-1 min-w-[8rem] basis-[10rem]", d ? "max-w-[24rem] basis-[16rem]" : "max-w-[16rem]"),
|
|
1021
1044
|
children: [/* @__PURE__ */ Z("span", {
|
|
1022
1045
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
1023
1046
|
children: a(r || "", e.name, e.label)
|
|
1024
1047
|
}), f ? n ? /* @__PURE__ */ Q("span", {
|
|
1025
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",
|
|
1026
|
-
children: [/* @__PURE__ */ Z(
|
|
1049
|
+
children: [/* @__PURE__ */ Z(me, {
|
|
1027
1050
|
className: "h-3 w-3",
|
|
1028
1051
|
"aria-hidden": !0
|
|
1029
1052
|
}), "Yes"]
|
|
@@ -1034,7 +1057,7 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
1034
1057
|
"aria-hidden": !0
|
|
1035
1058
|
}), "No"]
|
|
1036
1059
|
}) : /* @__PURE__ */ Z("span", {
|
|
1037
|
-
className:
|
|
1060
|
+
className: W("block min-w-0 truncate", u ? "text-xl md:text-2xl font-semibold leading-tight tabular-nums tracking-tight" : "text-sm font-semibold"),
|
|
1038
1061
|
children: /* @__PURE__ */ Z(l, {
|
|
1039
1062
|
value: n,
|
|
1040
1063
|
field: c
|
|
@@ -1047,7 +1070,7 @@ var Rt = ({ title: e, type: t, api: r, data: i, schema: a, columns: m, className
|
|
|
1047
1070
|
};
|
|
1048
1071
|
//#endregion
|
|
1049
1072
|
//#region src/RecordComments.tsx
|
|
1050
|
-
function
|
|
1073
|
+
function Kt(e) {
|
|
1051
1074
|
try {
|
|
1052
1075
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1053
1076
|
if (r < 1) return "just now";
|
|
@@ -1060,7 +1083,7 @@ function Vt(e) {
|
|
|
1060
1083
|
return e;
|
|
1061
1084
|
}
|
|
1062
1085
|
}
|
|
1063
|
-
var
|
|
1086
|
+
var qt = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, className: a }) => {
|
|
1064
1087
|
let { t: o } = $(), [s, c] = n.useState(""), [l, u] = n.useState(!1), [d, f] = n.useState(""), p = n.useCallback(async () => {
|
|
1065
1088
|
let e = s.trim();
|
|
1066
1089
|
if (!(!e || !t)) {
|
|
@@ -1078,11 +1101,11 @@ var Ht = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1078
1101
|
return e.text.toLowerCase().includes(t) || e.author.toLowerCase().includes(t);
|
|
1079
1102
|
}) : e].sort((e, t) => e.pinned && !t.pinned ? -1 : !e.pinned && t.pinned ? 1 : 0), [e, d]);
|
|
1080
1103
|
return /* @__PURE__ */ Q(b, {
|
|
1081
|
-
className:
|
|
1104
|
+
className: W("", a),
|
|
1082
1105
|
children: [/* @__PURE__ */ Z(S, { children: /* @__PURE__ */ Q(C, {
|
|
1083
1106
|
className: "flex items-center gap-2 text-base",
|
|
1084
1107
|
children: [
|
|
1085
|
-
/* @__PURE__ */ Z(
|
|
1108
|
+
/* @__PURE__ */ Z(X, { className: "h-4 w-4" }),
|
|
1086
1109
|
o("detail.comments"),
|
|
1087
1110
|
/* @__PURE__ */ Q("span", {
|
|
1088
1111
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1143,7 +1166,7 @@ var Ht = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1143
1166
|
}) : /* @__PURE__ */ Z("div", {
|
|
1144
1167
|
className: "space-y-3",
|
|
1145
1168
|
children: h.map((e) => /* @__PURE__ */ Q("div", {
|
|
1146
|
-
className:
|
|
1169
|
+
className: W("flex gap-3", e.pinned && "bg-muted/40 rounded-md p-2 -mx-2"),
|
|
1147
1170
|
children: [/* @__PURE__ */ Z("div", {
|
|
1148
1171
|
className: "shrink-0",
|
|
1149
1172
|
children: e.avatarUrl ? /* @__PURE__ */ Z("img", {
|
|
@@ -1166,7 +1189,7 @@ var Ht = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1166
1189
|
}),
|
|
1167
1190
|
/* @__PURE__ */ Z("span", {
|
|
1168
1191
|
className: "text-xs text-muted-foreground",
|
|
1169
|
-
children:
|
|
1192
|
+
children: Kt(e.createdAt)
|
|
1170
1193
|
}),
|
|
1171
1194
|
e.pinned && /* @__PURE__ */ Q("span", {
|
|
1172
1195
|
className: "text-xs text-amber-600 flex items-center gap-0.5",
|
|
@@ -1192,20 +1215,20 @@ var Ht = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, cl
|
|
|
1192
1215
|
]
|
|
1193
1216
|
})]
|
|
1194
1217
|
});
|
|
1195
|
-
},
|
|
1196
|
-
field_change:
|
|
1218
|
+
}, Jt = {
|
|
1219
|
+
field_change: we,
|
|
1197
1220
|
create: Ge,
|
|
1198
1221
|
delete: Qe,
|
|
1199
|
-
comment:
|
|
1200
|
-
status_change:
|
|
1201
|
-
},
|
|
1222
|
+
comment: X,
|
|
1223
|
+
status_change: le
|
|
1224
|
+
}, Yt = {
|
|
1202
1225
|
field_change: "bg-blue-100 text-blue-600",
|
|
1203
1226
|
create: "bg-green-100 text-green-600",
|
|
1204
1227
|
delete: "bg-red-100 text-red-600",
|
|
1205
1228
|
comment: "bg-purple-100 text-purple-600",
|
|
1206
1229
|
status_change: "bg-amber-100 text-amber-600"
|
|
1207
1230
|
};
|
|
1208
|
-
function
|
|
1231
|
+
function Xt(e) {
|
|
1209
1232
|
try {
|
|
1210
1233
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1211
1234
|
if (r < 1) return "just now";
|
|
@@ -1218,24 +1241,24 @@ function Gt(e) {
|
|
|
1218
1241
|
return e;
|
|
1219
1242
|
}
|
|
1220
1243
|
}
|
|
1221
|
-
function
|
|
1244
|
+
function Zt(e) {
|
|
1222
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";
|
|
1223
1246
|
}
|
|
1224
|
-
var
|
|
1247
|
+
var Qt = {
|
|
1225
1248
|
all: "All",
|
|
1226
1249
|
field_change: "Field Changes",
|
|
1227
1250
|
create: "Creates",
|
|
1228
1251
|
delete: "Deletes",
|
|
1229
1252
|
comment: "Comments",
|
|
1230
1253
|
status_change: "Status Changes"
|
|
1231
|
-
},
|
|
1254
|
+
}, $t = ({ activities: e, filterable: t = !1, defaultFilter: r = "all", className: i }) => {
|
|
1232
1255
|
let [a, o] = n.useState(r), s = n.useMemo(() => a === "all" ? e : e.filter((e) => e.type === a), [e, a]);
|
|
1233
1256
|
return /* @__PURE__ */ Q(b, {
|
|
1234
|
-
className:
|
|
1257
|
+
className: W("", i),
|
|
1235
1258
|
children: [/* @__PURE__ */ Z(S, { children: /* @__PURE__ */ Q(C, {
|
|
1236
1259
|
className: "flex items-center gap-2 text-base",
|
|
1237
1260
|
children: [
|
|
1238
|
-
/* @__PURE__ */ Z(
|
|
1261
|
+
/* @__PURE__ */ Z(oe, { className: "h-4 w-4" }),
|
|
1239
1262
|
"Activity",
|
|
1240
1263
|
/* @__PURE__ */ Q("span", {
|
|
1241
1264
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1250,12 +1273,12 @@ var qt = {
|
|
|
1250
1273
|
className: "flex flex-wrap gap-1.5 mb-4",
|
|
1251
1274
|
role: "group",
|
|
1252
1275
|
"aria-label": "Activity type filter",
|
|
1253
|
-
children: Object.keys(
|
|
1276
|
+
children: Object.keys(Qt).map((e) => /* @__PURE__ */ Q("button", {
|
|
1254
1277
|
type: "button",
|
|
1255
|
-
className:
|
|
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"),
|
|
1256
1279
|
onClick: () => o(e),
|
|
1257
1280
|
"aria-pressed": a === e,
|
|
1258
|
-
children: [e !== "all" && n.createElement(
|
|
1281
|
+
children: [e !== "all" && n.createElement(Jt[e] || we, { className: "h-3 w-3" }), Qt[e]]
|
|
1259
1282
|
}, e))
|
|
1260
1283
|
}), s.length === 0 ? /* @__PURE__ */ Z(D, {
|
|
1261
1284
|
title: "No activity recorded",
|
|
@@ -1265,11 +1288,11 @@ var qt = {
|
|
|
1265
1288
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
1266
1289
|
className: "space-y-4",
|
|
1267
1290
|
children: s.map((e) => {
|
|
1268
|
-
let t =
|
|
1291
|
+
let t = Jt[e.type] || we;
|
|
1269
1292
|
return /* @__PURE__ */ Q("div", {
|
|
1270
1293
|
className: "flex gap-3 relative",
|
|
1271
1294
|
children: [/* @__PURE__ */ Z("div", {
|
|
1272
|
-
className:
|
|
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"),
|
|
1273
1296
|
children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
|
|
1274
1297
|
}), /* @__PURE__ */ Q("div", {
|
|
1275
1298
|
className: "flex-1 min-w-0 pt-1",
|
|
@@ -1283,12 +1306,12 @@ var qt = {
|
|
|
1283
1306
|
" ",
|
|
1284
1307
|
/* @__PURE__ */ Z("span", {
|
|
1285
1308
|
className: "text-muted-foreground",
|
|
1286
|
-
children:
|
|
1309
|
+
children: Zt(e)
|
|
1287
1310
|
})
|
|
1288
1311
|
]
|
|
1289
1312
|
}), /* @__PURE__ */ Z("p", {
|
|
1290
1313
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
1291
|
-
children:
|
|
1314
|
+
children: Xt(e.timestamp)
|
|
1292
1315
|
})]
|
|
1293
1316
|
})]
|
|
1294
1317
|
}, e.id);
|
|
@@ -1296,7 +1319,7 @@ var qt = {
|
|
|
1296
1319
|
})]
|
|
1297
1320
|
})] })]
|
|
1298
1321
|
});
|
|
1299
|
-
},
|
|
1322
|
+
}, en = {
|
|
1300
1323
|
create: "default",
|
|
1301
1324
|
update: "secondary",
|
|
1302
1325
|
delete: "destructive",
|
|
@@ -1308,12 +1331,12 @@ var qt = {
|
|
|
1308
1331
|
export: "outline",
|
|
1309
1332
|
import: "outline"
|
|
1310
1333
|
};
|
|
1311
|
-
function
|
|
1334
|
+
function tn(e) {
|
|
1312
1335
|
if (!e) return "";
|
|
1313
1336
|
let t = e instanceof Date ? e : new Date(e);
|
|
1314
1337
|
return Number.isNaN(t.getTime()) ? String(e) : t.toLocaleString();
|
|
1315
1338
|
}
|
|
1316
|
-
var
|
|
1339
|
+
var nn = [
|
|
1317
1340
|
[60, "second"],
|
|
1318
1341
|
[60, "minute"],
|
|
1319
1342
|
[24, "hour"],
|
|
@@ -1322,27 +1345,27 @@ var Zt = [
|
|
|
1322
1345
|
[12, "month"],
|
|
1323
1346
|
[Infinity, "year"]
|
|
1324
1347
|
];
|
|
1325
|
-
function
|
|
1348
|
+
function rn(e, t) {
|
|
1326
1349
|
if (!e) return "";
|
|
1327
1350
|
let n = e instanceof Date ? e : new Date(e);
|
|
1328
1351
|
if (Number.isNaN(n.getTime())) return String(e);
|
|
1329
1352
|
let r = (n.getTime() - Date.now()) / 1e3;
|
|
1330
|
-
for (let [n, i] of
|
|
1353
|
+
for (let [n, i] of nn) {
|
|
1331
1354
|
if (Math.abs(r) < n) try {
|
|
1332
1355
|
return new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(Math.round(r), i);
|
|
1333
1356
|
} catch {
|
|
1334
|
-
return
|
|
1357
|
+
return tn(e);
|
|
1335
1358
|
}
|
|
1336
1359
|
r /= n;
|
|
1337
1360
|
}
|
|
1338
|
-
return
|
|
1361
|
+
return tn(e);
|
|
1339
1362
|
}
|
|
1340
|
-
function
|
|
1363
|
+
function an(e) {
|
|
1341
1364
|
if (!e) return "?";
|
|
1342
1365
|
let t = e.trim().split(/\s+/).filter(Boolean).slice(0, 2);
|
|
1343
1366
|
return t.length === 0 ? "?" : t.map((e) => e.charAt(0).toUpperCase()).join("");
|
|
1344
1367
|
}
|
|
1345
|
-
function
|
|
1368
|
+
function on(e) {
|
|
1346
1369
|
if (e == null || e === "") return "—";
|
|
1347
1370
|
if (typeof e == "string") return e;
|
|
1348
1371
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -1352,9 +1375,9 @@ function en(e) {
|
|
|
1352
1375
|
return String(e);
|
|
1353
1376
|
}
|
|
1354
1377
|
}
|
|
1355
|
-
function
|
|
1378
|
+
function sn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
1356
1379
|
return t ? /* @__PURE__ */ Z("div", {
|
|
1357
|
-
className:
|
|
1380
|
+
className: W("space-y-3", r),
|
|
1358
1381
|
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ Q("div", {
|
|
1359
1382
|
className: "flex items-start gap-3",
|
|
1360
1383
|
children: [/* @__PURE__ */ Z(L, { className: "h-8 w-8 rounded-full" }), /* @__PURE__ */ Q("div", {
|
|
@@ -1363,14 +1386,14 @@ function tn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1363
1386
|
})]
|
|
1364
1387
|
}, t))
|
|
1365
1388
|
}) : !e || e.length === 0 ? /* @__PURE__ */ Z("div", {
|
|
1366
|
-
className:
|
|
1389
|
+
className: W("flex items-center justify-center rounded-md border border-dashed py-10 text-sm text-muted-foreground", r),
|
|
1367
1390
|
children: n ?? "No history yet"
|
|
1368
|
-
}) : /* @__PURE__ */ Z(
|
|
1391
|
+
}) : /* @__PURE__ */ Z(ie, {
|
|
1369
1392
|
delayDuration: 150,
|
|
1370
1393
|
children: /* @__PURE__ */ Z("ol", {
|
|
1371
|
-
className:
|
|
1394
|
+
className: W("space-y-4", r),
|
|
1372
1395
|
children: e.map((e, t) => {
|
|
1373
|
-
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;
|
|
1374
1397
|
return /* @__PURE__ */ Q("li", {
|
|
1375
1398
|
className: "flex items-start gap-3",
|
|
1376
1399
|
children: [/* @__PURE__ */ Q(h, {
|
|
@@ -1380,7 +1403,7 @@ function tn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1380
1403
|
alt: a
|
|
1381
1404
|
}) : null, /* @__PURE__ */ Z(g, {
|
|
1382
1405
|
className: "text-[10px] font-medium",
|
|
1383
|
-
children:
|
|
1406
|
+
children: an(e.user_name)
|
|
1384
1407
|
})]
|
|
1385
1408
|
}), /* @__PURE__ */ Q("div", {
|
|
1386
1409
|
className: "min-w-0 flex-1",
|
|
@@ -1397,14 +1420,14 @@ function tn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1397
1420
|
className: "text-[10px] uppercase tracking-wide",
|
|
1398
1421
|
children: e.action
|
|
1399
1422
|
}),
|
|
1400
|
-
o && /* @__PURE__ */ Q(
|
|
1423
|
+
o && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
1401
1424
|
asChild: !0,
|
|
1402
1425
|
children: /* @__PURE__ */ Z("span", {
|
|
1403
1426
|
className: "text-xs text-muted-foreground cursor-help",
|
|
1404
1427
|
"aria-label": o,
|
|
1405
1428
|
children: s || o
|
|
1406
1429
|
})
|
|
1407
|
-
}), /* @__PURE__ */ Z(
|
|
1430
|
+
}), /* @__PURE__ */ Z(V, { children: o })] })
|
|
1408
1431
|
]
|
|
1409
1432
|
}),
|
|
1410
1433
|
e.summary && /* @__PURE__ */ Z("p", {
|
|
@@ -1431,7 +1454,7 @@ function tn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1431
1454
|
": ",
|
|
1432
1455
|
/* @__PURE__ */ Z("span", {
|
|
1433
1456
|
className: "text-foreground",
|
|
1434
|
-
children:
|
|
1457
|
+
children: on(e.to)
|
|
1435
1458
|
})
|
|
1436
1459
|
]
|
|
1437
1460
|
}, e.field))
|
|
@@ -1448,12 +1471,12 @@ function tn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1448
1471
|
": ",
|
|
1449
1472
|
/* @__PURE__ */ Z("span", {
|
|
1450
1473
|
className: "line-through opacity-70",
|
|
1451
|
-
children:
|
|
1474
|
+
children: on(e.from)
|
|
1452
1475
|
}),
|
|
1453
1476
|
" → ",
|
|
1454
1477
|
/* @__PURE__ */ Z("span", {
|
|
1455
1478
|
className: "text-foreground",
|
|
1456
|
-
children:
|
|
1479
|
+
children: on(e.to)
|
|
1457
1480
|
})
|
|
1458
1481
|
]
|
|
1459
1482
|
}, e.field))
|
|
@@ -1467,13 +1490,13 @@ function tn({ entries: e, loading: t, emptyText: n, className: r, locale: i }) {
|
|
|
1467
1490
|
}
|
|
1468
1491
|
//#endregion
|
|
1469
1492
|
//#region src/RecordMetaFooter.tsx
|
|
1470
|
-
var
|
|
1493
|
+
var cn = {
|
|
1471
1494
|
createdAt: "created_at",
|
|
1472
1495
|
createdBy: "created_by",
|
|
1473
1496
|
updatedAt: "updated_at",
|
|
1474
1497
|
updatedBy: "updated_by"
|
|
1475
1498
|
};
|
|
1476
|
-
function
|
|
1499
|
+
function ln(e) {
|
|
1477
1500
|
if (!e) return null;
|
|
1478
1501
|
if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
|
|
1479
1502
|
if (typeof e == "string" || typeof e == "number") {
|
|
@@ -1482,7 +1505,7 @@ function rn(e) {
|
|
|
1482
1505
|
}
|
|
1483
1506
|
return null;
|
|
1484
1507
|
}
|
|
1485
|
-
function
|
|
1508
|
+
function un(e, t) {
|
|
1486
1509
|
let n = Date.now() - e.getTime(), r = Math.max(0, Math.floor(n / 1e3));
|
|
1487
1510
|
if (r < 60) return t("detail.justNow");
|
|
1488
1511
|
let i = Math.floor(r / 60);
|
|
@@ -1490,7 +1513,7 @@ function an(e, t) {
|
|
|
1490
1513
|
let a = Math.floor(i / 60);
|
|
1491
1514
|
return a < 24 ? t("detail.hoursAgo", { count: a }) : t("detail.daysAgo", { count: Math.floor(a / 24) });
|
|
1492
1515
|
}
|
|
1493
|
-
function
|
|
1516
|
+
function dn(e) {
|
|
1494
1517
|
try {
|
|
1495
1518
|
return new Intl.DateTimeFormat(void 0, {
|
|
1496
1519
|
dateStyle: "medium",
|
|
@@ -1500,16 +1523,16 @@ function on(e) {
|
|
|
1500
1523
|
return e.toISOString();
|
|
1501
1524
|
}
|
|
1502
1525
|
}
|
|
1503
|
-
var
|
|
1526
|
+
var fn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
1504
1527
|
if (e == null || e === "") return null;
|
|
1505
1528
|
let r = t?.fields?.[n], i = r?.reference_to || r?.reference, a = {
|
|
1506
1529
|
name: n,
|
|
1507
1530
|
type: r?.type || (i ? "lookup" : "text"),
|
|
1508
1531
|
...i && { reference_to: i },
|
|
1509
1532
|
...r?.reference_field && { reference_field: r.reference_field }
|
|
1510
|
-
}, o =
|
|
1533
|
+
}, o = St(a) || a.type;
|
|
1511
1534
|
if (o) {
|
|
1512
|
-
let t =
|
|
1535
|
+
let t = bt(o);
|
|
1513
1536
|
if (t) return /* @__PURE__ */ Z("span", {
|
|
1514
1537
|
className: "inline-flex items-center [&_a]:text-inherit [&_a]:hover:underline",
|
|
1515
1538
|
children: /* @__PURE__ */ Z(t, {
|
|
@@ -1519,20 +1542,20 @@ var sn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1519
1542
|
});
|
|
1520
1543
|
}
|
|
1521
1544
|
return /* @__PURE__ */ Z("span", { children: String(e) });
|
|
1522
|
-
},
|
|
1545
|
+
}, pn = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
|
|
1523
1546
|
if (!t && !n) return null;
|
|
1524
|
-
let o = n ? /* @__PURE__ */ Z(
|
|
1547
|
+
let o = n ? /* @__PURE__ */ Z(ie, {
|
|
1525
1548
|
delayDuration: 200,
|
|
1526
|
-
children: /* @__PURE__ */ Q(
|
|
1549
|
+
children: /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
1527
1550
|
asChild: !0,
|
|
1528
1551
|
children: /* @__PURE__ */ Z("time", {
|
|
1529
1552
|
dateTime: n.toISOString(),
|
|
1530
1553
|
className: "cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2",
|
|
1531
|
-
children:
|
|
1554
|
+
children: un(n, a)
|
|
1532
1555
|
})
|
|
1533
|
-
}), /* @__PURE__ */ Z(
|
|
1556
|
+
}), /* @__PURE__ */ Z(V, {
|
|
1534
1557
|
side: "top",
|
|
1535
|
-
children:
|
|
1558
|
+
children: dn(n)
|
|
1536
1559
|
})] })
|
|
1537
1560
|
}) : null;
|
|
1538
1561
|
return /* @__PURE__ */ Q("span", {
|
|
@@ -1542,7 +1565,7 @@ var sn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1542
1565
|
className: "text-muted-foreground/70",
|
|
1543
1566
|
children: e
|
|
1544
1567
|
}),
|
|
1545
|
-
t ? /* @__PURE__ */ Z(
|
|
1568
|
+
t ? /* @__PURE__ */ Z(fn, {
|
|
1546
1569
|
value: t,
|
|
1547
1570
|
objectSchema: r,
|
|
1548
1571
|
fieldName: i
|
|
@@ -1554,31 +1577,31 @@ var sn = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1554
1577
|
o
|
|
1555
1578
|
]
|
|
1556
1579
|
});
|
|
1557
|
-
},
|
|
1580
|
+
}, mn = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
|
|
1558
1581
|
let { t: i } = $();
|
|
1559
1582
|
if (!e) return null;
|
|
1560
|
-
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));
|
|
1561
1584
|
return !l && !d ? null : /* @__PURE__ */ Q("div", {
|
|
1562
|
-
className:
|
|
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),
|
|
1563
1586
|
"data-testid": "record-meta-footer",
|
|
1564
|
-
children: [l && /* @__PURE__ */ Z(
|
|
1587
|
+
children: [l && /* @__PURE__ */ Z(pn, {
|
|
1565
1588
|
label: i("detail.createdBy"),
|
|
1566
1589
|
user: s,
|
|
1567
1590
|
date: a,
|
|
1568
1591
|
objectSchema: t,
|
|
1569
|
-
userField:
|
|
1592
|
+
userField: cn.createdBy,
|
|
1570
1593
|
t: i
|
|
1571
|
-
}), d && /* @__PURE__ */ Z(
|
|
1594
|
+
}), d && /* @__PURE__ */ Z(pn, {
|
|
1572
1595
|
label: i("detail.updatedBy"),
|
|
1573
1596
|
user: c,
|
|
1574
1597
|
date: o,
|
|
1575
1598
|
objectSchema: t,
|
|
1576
|
-
userField:
|
|
1599
|
+
userField: cn.updatedBy,
|
|
1577
1600
|
t: i
|
|
1578
1601
|
})]
|
|
1579
1602
|
});
|
|
1580
|
-
},
|
|
1581
|
-
function
|
|
1603
|
+
}, hn = 5;
|
|
1604
|
+
function gn(e, t, n, r) {
|
|
1582
1605
|
if (e && typeof e == "object") {
|
|
1583
1606
|
if (t.primaryField) {
|
|
1584
1607
|
let n = e[t.primaryField];
|
|
@@ -1625,10 +1648,10 @@ function dn(e, t, n, r) {
|
|
|
1625
1648
|
}
|
|
1626
1649
|
return r;
|
|
1627
1650
|
}
|
|
1628
|
-
var
|
|
1629
|
-
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), [
|
|
1630
|
-
if (!
|
|
1631
|
-
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) => {
|
|
1632
1655
|
let n = typeof e == "string" ? e : e?.name;
|
|
1633
1656
|
return !n || t(n);
|
|
1634
1657
|
});
|
|
@@ -1641,13 +1664,13 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1641
1664
|
})),
|
|
1642
1665
|
summaryFields: n(e.summaryFields)
|
|
1643
1666
|
};
|
|
1644
|
-
}, [e,
|
|
1667
|
+
}, [e, K]);
|
|
1645
1668
|
n.useEffect(() => {
|
|
1646
1669
|
g && p && p(g);
|
|
1647
1670
|
}, [g, p]);
|
|
1648
|
-
let
|
|
1649
|
-
if (
|
|
1650
|
-
let e = [...
|
|
1671
|
+
let de = n.useMemo(() => {
|
|
1672
|
+
if (q.summaryFields && q.summaryFields.length > 0) return [];
|
|
1673
|
+
let e = [...q.sections?.flatMap((e) => e.fields) || [], ...q.fields || []], t = {};
|
|
1651
1674
|
for (let n of e) t[n.name] || (t[n.name] = n);
|
|
1652
1675
|
if (N?.fields) for (let [e, n] of Object.entries(N.fields)) t[e] = {
|
|
1653
1676
|
...t[e] || {},
|
|
@@ -1666,26 +1689,26 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1666
1689
|
let o = Object.keys(t).find((e) => (t[e]?.type === "date" || t[e]?.type === "datetime") && /close|due|start|end|expected/i.test(e) && n(e));
|
|
1667
1690
|
return o && !r.includes(o) && r.push(o), r;
|
|
1668
1691
|
}, [
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1692
|
+
q.summaryFields,
|
|
1693
|
+
q.sections,
|
|
1694
|
+
q.fields,
|
|
1672
1695
|
N,
|
|
1673
1696
|
g
|
|
1674
|
-
]),
|
|
1675
|
-
|
|
1697
|
+
]), fe = q.summaryFields && q.summaryFields.length > 0 ? q.summaryFields : de, pe = n.useCallback(() => {
|
|
1698
|
+
q.resourceId && navigator.clipboard.writeText(String(q.resourceId)).then(() => {
|
|
1676
1699
|
te(!0), setTimeout(() => te(!1), 1500);
|
|
1677
1700
|
});
|
|
1678
|
-
}, [
|
|
1701
|
+
}, [q.resourceId]);
|
|
1679
1702
|
n.useEffect(() => {
|
|
1680
1703
|
let e = !0;
|
|
1681
|
-
if (
|
|
1704
|
+
if (q.data) return _(q.data), x(!1), r?.getObjectSchema && q.objectName && r.getObjectSchema(q.objectName).then((t) => {
|
|
1682
1705
|
e && ee(t);
|
|
1683
1706
|
}).catch(() => {}), () => {
|
|
1684
1707
|
e = !1;
|
|
1685
1708
|
};
|
|
1686
|
-
if (r &&
|
|
1709
|
+
if (r && q.objectName && q.resourceId) {
|
|
1687
1710
|
x(!0), ee(null), _(null);
|
|
1688
|
-
let n =
|
|
1711
|
+
let n = q.objectName, i = q.resourceId, a = `${n}-`, o = [...q.sections?.flatMap((e) => e.fields) || [], ...q.fields || []];
|
|
1689
1712
|
(r.getObjectSchema ? r.getObjectSchema(n).catch(() => null) : Promise.resolve(null)).then((s) => {
|
|
1690
1713
|
if (!e) return;
|
|
1691
1714
|
ee(s);
|
|
@@ -1709,7 +1732,7 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1709
1732
|
}).catch((t) => {
|
|
1710
1733
|
e && (console.error("Failed to fetch detail data:", t), x(!1));
|
|
1711
1734
|
});
|
|
1712
|
-
} else
|
|
1735
|
+
} else q.api && q.resourceId && (x(!0), fetch(`${q.api}/${q.resourceId}`).then((e) => e.json()).then((t) => {
|
|
1713
1736
|
e && _(t?.data || t);
|
|
1714
1737
|
}).catch((e) => {
|
|
1715
1738
|
console.error("Failed to fetch detail data:", e);
|
|
@@ -1720,71 +1743,71 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1720
1743
|
e = !1;
|
|
1721
1744
|
};
|
|
1722
1745
|
}, [
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1746
|
+
q.api,
|
|
1747
|
+
q.resourceId,
|
|
1748
|
+
q.objectName,
|
|
1726
1749
|
r,
|
|
1727
|
-
|
|
1728
|
-
|
|
1750
|
+
q.sections,
|
|
1751
|
+
q.fields,
|
|
1729
1752
|
F
|
|
1730
1753
|
]);
|
|
1731
|
-
let
|
|
1754
|
+
let he = n.useCallback(() => {
|
|
1732
1755
|
if (s) s();
|
|
1733
|
-
else if (
|
|
1734
|
-
let e =
|
|
1735
|
-
|
|
1736
|
-
} else
|
|
1737
|
-
}, [s,
|
|
1738
|
-
a ? a() :
|
|
1739
|
-
}, [a,
|
|
1740
|
-
if (!r?.cancelPendingApproval || !
|
|
1741
|
-
M(
|
|
1756
|
+
else if (q.onNavigate) {
|
|
1757
|
+
let e = q.backUrl || (q.objectName ? `/${q.objectName}` : "/");
|
|
1758
|
+
q.onNavigate(e, { replace: !0 });
|
|
1759
|
+
} else q.backUrl ? window.location.href = q.backUrl : window.history.back();
|
|
1760
|
+
}, [s, q]), ge = n.useCallback(() => {
|
|
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);
|
|
1762
|
+
}, [a, q]), ye = n.useCallback(async () => {
|
|
1763
|
+
if (!r?.cancelPendingApproval || !q.objectName || !q.resourceId) {
|
|
1764
|
+
M(G("detail.cancelApprovalUnavailable"));
|
|
1742
1765
|
return;
|
|
1743
1766
|
}
|
|
1744
|
-
|
|
1767
|
+
oe(!0), M(null);
|
|
1745
1768
|
try {
|
|
1746
|
-
if (await r.cancelPendingApproval(String(
|
|
1747
|
-
let e = await r.findOne(String(
|
|
1769
|
+
if (await r.cancelPendingApproval(String(q.objectName), String(q.resourceId)), r.findOne) try {
|
|
1770
|
+
let e = await r.findOne(String(q.objectName), String(q.resourceId));
|
|
1748
1771
|
e && _(e);
|
|
1749
1772
|
} catch {}
|
|
1750
1773
|
I((e) => e + 1);
|
|
1751
1774
|
try {
|
|
1752
1775
|
window.dispatchEvent(new CustomEvent("objectui:record-changed", { detail: {
|
|
1753
|
-
objectName: String(
|
|
1754
|
-
recordId: String(
|
|
1776
|
+
objectName: String(q.objectName),
|
|
1777
|
+
recordId: String(q.resourceId),
|
|
1755
1778
|
reason: "approval-recalled"
|
|
1756
1779
|
} }));
|
|
1757
1780
|
} catch {}
|
|
1758
1781
|
} catch (e) {
|
|
1759
1782
|
let t = (e?.message || e?.error || String(e ?? "Cancel failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
|
|
1760
|
-
M(`${
|
|
1783
|
+
M(`${G("detail.cancelApprovalFailed")}: ${t}`);
|
|
1761
1784
|
} finally {
|
|
1762
|
-
|
|
1785
|
+
oe(!1);
|
|
1763
1786
|
}
|
|
1764
1787
|
}, [
|
|
1765
1788
|
r,
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
]),
|
|
1770
|
-
let e =
|
|
1771
|
-
window.confirm(e) && (o?.(),
|
|
1772
|
-
}, [o,
|
|
1773
|
-
navigator.share &&
|
|
1774
|
-
title:
|
|
1775
|
-
text: `${
|
|
1789
|
+
q.objectName,
|
|
1790
|
+
q.resourceId,
|
|
1791
|
+
G
|
|
1792
|
+
]), be = n.useCallback(() => {
|
|
1793
|
+
let e = q.deleteConfirmation || G("detail.deleteConfirmation");
|
|
1794
|
+
window.confirm(e) && (o?.(), q.onNavigate && q.objectName && q.onNavigate(`/${q.objectName}`, { replace: !0 }));
|
|
1795
|
+
}, [o, q]), xe = n.useCallback(() => {
|
|
1796
|
+
navigator.share && q.objectName && q.resourceId ? navigator.share({
|
|
1797
|
+
title: q.title || G("detail.details"),
|
|
1798
|
+
text: `${q.objectName} #${q.resourceId}`,
|
|
1776
1799
|
url: window.location.href
|
|
1777
1800
|
}).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
|
|
1778
1801
|
console.log("Link copied to clipboard");
|
|
1779
1802
|
});
|
|
1780
|
-
}, [
|
|
1803
|
+
}, [q]), Se = n.useCallback(() => {
|
|
1781
1804
|
let e = !w;
|
|
1782
1805
|
h && h(e), m === void 0 && C(e);
|
|
1783
1806
|
}, [
|
|
1784
1807
|
w,
|
|
1785
1808
|
m,
|
|
1786
1809
|
h
|
|
1787
|
-
]),
|
|
1810
|
+
]), Te = n.useCallback(async () => {
|
|
1788
1811
|
if (T) {
|
|
1789
1812
|
let e = Object.entries(D);
|
|
1790
1813
|
if (e.length > 0) {
|
|
@@ -1811,79 +1834,79 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1811
1834
|
D,
|
|
1812
1835
|
g,
|
|
1813
1836
|
l
|
|
1814
|
-
]),
|
|
1837
|
+
]), Ee = n.useCallback(() => {
|
|
1815
1838
|
O({}), E(!1), M(null);
|
|
1816
|
-
}, []),
|
|
1839
|
+
}, []), J = n.useCallback((e, t) => {
|
|
1817
1840
|
O((n) => ({
|
|
1818
1841
|
...n,
|
|
1819
1842
|
[e]: t
|
|
1820
1843
|
}));
|
|
1821
1844
|
}, []);
|
|
1822
1845
|
n.useEffect(() => {
|
|
1823
|
-
if (!
|
|
1824
|
-
let e =
|
|
1846
|
+
if (!q.recordNavigation) return;
|
|
1847
|
+
let e = q.recordNavigation, t = (t) => {
|
|
1825
1848
|
let n = t.target?.tagName;
|
|
1826
1849
|
n === "INPUT" || n === "TEXTAREA" || t.target?.isContentEditable || (t.key === "ArrowLeft" && e.currentIndex > 0 ? (t.preventDefault(), e.onNavigate(e.recordIds[e.currentIndex - 1])) : t.key === "ArrowRight" && e.currentIndex < e.recordIds.length - 1 && (t.preventDefault(), e.onNavigate(e.recordIds[e.currentIndex + 1])));
|
|
1827
1850
|
};
|
|
1828
1851
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
1829
|
-
}, [
|
|
1830
|
-
if (!c ||
|
|
1852
|
+
}, [q.recordNavigation]), n.useEffect(() => {
|
|
1853
|
+
if (!c || q.showHeader !== !1) return;
|
|
1831
1854
|
let e = "objectui:record:inline-edit-toggle", t = (e) => {
|
|
1832
1855
|
let t = e.detail;
|
|
1833
|
-
t?.recordId &&
|
|
1856
|
+
t?.recordId && q.recordId && t.recordId !== q.recordId || t?.objectName && q.objectName && t.objectName !== q.objectName || Te();
|
|
1834
1857
|
};
|
|
1835
1858
|
return window.addEventListener(e, t), () => window.removeEventListener(e, t);
|
|
1836
1859
|
}, [
|
|
1837
1860
|
c,
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1861
|
+
q.showHeader,
|
|
1862
|
+
q.recordId,
|
|
1863
|
+
q.objectName,
|
|
1864
|
+
Te
|
|
1842
1865
|
]);
|
|
1843
|
-
let
|
|
1866
|
+
let De = n.useMemo(() => q.related ?? [], [q.related]), Oe = n.useMemo(() => {
|
|
1844
1867
|
let e = [];
|
|
1845
1868
|
return e.push({
|
|
1846
1869
|
name: "sys_share",
|
|
1847
|
-
label:
|
|
1870
|
+
label: G("detail.share"),
|
|
1848
1871
|
icon: "share-2",
|
|
1849
1872
|
type: "script",
|
|
1850
|
-
onClick:
|
|
1851
|
-
}),
|
|
1873
|
+
onClick: xe
|
|
1874
|
+
}), q.showEdit && e.push({
|
|
1852
1875
|
name: "sys_edit_mobile",
|
|
1853
|
-
label:
|
|
1876
|
+
label: G("detail.edit"),
|
|
1854
1877
|
icon: "edit",
|
|
1855
1878
|
type: "script",
|
|
1856
1879
|
className: "sm:hidden",
|
|
1857
|
-
onClick:
|
|
1880
|
+
onClick: ge
|
|
1858
1881
|
}), c && e.push({
|
|
1859
1882
|
name: "sys_toggle_inline_edit_mobile",
|
|
1860
|
-
label:
|
|
1883
|
+
label: G(T ? "detail.save" : "detail.editInline"),
|
|
1861
1884
|
icon: "edit",
|
|
1862
1885
|
type: "script",
|
|
1863
1886
|
className: "sm:hidden",
|
|
1864
|
-
onClick:
|
|
1865
|
-
}),
|
|
1887
|
+
onClick: Te
|
|
1888
|
+
}), q.showDelete && e.push({
|
|
1866
1889
|
name: "sys_delete",
|
|
1867
|
-
label:
|
|
1890
|
+
label: G("detail.delete"),
|
|
1868
1891
|
icon: "trash-2",
|
|
1869
1892
|
type: "script",
|
|
1870
1893
|
variant: "destructive",
|
|
1871
1894
|
tags: ["separator-before"],
|
|
1872
|
-
onClick:
|
|
1895
|
+
onClick: be
|
|
1873
1896
|
}), e;
|
|
1874
1897
|
}, [
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1898
|
+
G,
|
|
1899
|
+
q.showEdit,
|
|
1900
|
+
q.showDelete,
|
|
1878
1901
|
c,
|
|
1879
1902
|
T,
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
]),
|
|
1885
|
-
let e =
|
|
1886
|
-
if (
|
|
1903
|
+
xe,
|
|
1904
|
+
ge,
|
|
1905
|
+
Te,
|
|
1906
|
+
be
|
|
1907
|
+
]), ke = n.useMemo(() => {
|
|
1908
|
+
let e = q.actions ?? [];
|
|
1909
|
+
if (Oe.length === 0) return e;
|
|
1887
1910
|
let t = !1, n = e.map((e) => {
|
|
1888
1911
|
let n = e;
|
|
1889
1912
|
if (n && typeof n == "object" && n.type === "action:bar" && (!n.location || n.location === "record_header")) {
|
|
@@ -1891,7 +1914,7 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1891
1914
|
let e = Array.isArray(n.systemActions) ? n.systemActions : [];
|
|
1892
1915
|
return {
|
|
1893
1916
|
...n,
|
|
1894
|
-
systemActions: [...e, ...
|
|
1917
|
+
systemActions: [...e, ...Oe]
|
|
1895
1918
|
};
|
|
1896
1919
|
}
|
|
1897
1920
|
return e;
|
|
@@ -1899,72 +1922,72 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1899
1922
|
return t || n.push({
|
|
1900
1923
|
type: "action:bar",
|
|
1901
1924
|
location: "record_header",
|
|
1902
|
-
systemActions:
|
|
1925
|
+
systemActions: Oe
|
|
1903
1926
|
}), n;
|
|
1904
|
-
}, [
|
|
1905
|
-
return b ||
|
|
1906
|
-
className:
|
|
1927
|
+
}, [q.actions, Oe]);
|
|
1928
|
+
return b || q.loading ? /* @__PURE__ */ Q("div", {
|
|
1929
|
+
className: W("space-y-4", i),
|
|
1907
1930
|
children: [
|
|
1908
1931
|
/* @__PURE__ */ Z(L, { className: "h-10 w-full" }),
|
|
1909
1932
|
/* @__PURE__ */ Z(L, { className: "h-64 w-full" }),
|
|
1910
1933
|
/* @__PURE__ */ Z(L, { className: "h-48 w-full" })
|
|
1911
1934
|
]
|
|
1912
|
-
}) : !g && !
|
|
1913
|
-
className:
|
|
1935
|
+
}) : !g && !q.data ? /* @__PURE__ */ Q("div", {
|
|
1936
|
+
className: W("flex flex-col items-center justify-center py-16 text-center", i),
|
|
1914
1937
|
children: [
|
|
1915
1938
|
/* @__PURE__ */ Z("p", {
|
|
1916
1939
|
className: "text-lg font-semibold",
|
|
1917
|
-
children:
|
|
1940
|
+
children: G("detail.recordNotFound")
|
|
1918
1941
|
}),
|
|
1919
1942
|
/* @__PURE__ */ Z("p", {
|
|
1920
1943
|
className: "text-sm text-muted-foreground mt-1",
|
|
1921
|
-
children:
|
|
1944
|
+
children: G("detail.recordNotFoundDescription")
|
|
1922
1945
|
}),
|
|
1923
|
-
(
|
|
1946
|
+
(q.showBack ?? !0) && /* @__PURE__ */ Q(y, {
|
|
1924
1947
|
variant: "outline",
|
|
1925
1948
|
size: "sm",
|
|
1926
|
-
onClick:
|
|
1949
|
+
onClick: he,
|
|
1927
1950
|
className: "mt-4 gap-2",
|
|
1928
|
-
children: [/* @__PURE__ */ Z(
|
|
1951
|
+
children: [/* @__PURE__ */ Z(se, { className: "h-4 w-4" }), G("detail.goBack")]
|
|
1929
1952
|
})
|
|
1930
1953
|
]
|
|
1931
|
-
}) : /* @__PURE__ */ Z(
|
|
1932
|
-
className:
|
|
1954
|
+
}) : /* @__PURE__ */ Z(ie, { children: /* @__PURE__ */ Q("div", {
|
|
1955
|
+
className: W("space-y-6", i),
|
|
1933
1956
|
children: [
|
|
1934
|
-
|
|
1957
|
+
q.showHeader !== !1 && /* @__PURE__ */ Q("div", {
|
|
1935
1958
|
className: "flex flex-col sm:flex-row items-start justify-between gap-3 sm:gap-4 pb-4 border-b",
|
|
1936
1959
|
children: [/* @__PURE__ */ Q("div", {
|
|
1937
1960
|
className: "flex items-start gap-2 sm:gap-3 flex-1 min-w-0",
|
|
1938
|
-
children: [(
|
|
1961
|
+
children: [(q.showBack ?? !0) && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
1939
1962
|
asChild: !0,
|
|
1940
1963
|
children: /* @__PURE__ */ Z(y, {
|
|
1941
1964
|
variant: "ghost",
|
|
1942
1965
|
size: "icon",
|
|
1943
|
-
onClick:
|
|
1966
|
+
onClick: he,
|
|
1944
1967
|
className: "shrink-0 mt-1",
|
|
1945
|
-
children: /* @__PURE__ */ Z(
|
|
1968
|
+
children: /* @__PURE__ */ Z(se, { className: "h-4 w-4" })
|
|
1946
1969
|
})
|
|
1947
|
-
}), /* @__PURE__ */ Z(
|
|
1970
|
+
}), /* @__PURE__ */ Z(V, { children: G("detail.back") })] }), /* @__PURE__ */ Q("div", {
|
|
1948
1971
|
className: "flex-1 min-w-0",
|
|
1949
1972
|
children: [/* @__PURE__ */ Q("div", {
|
|
1950
1973
|
className: "flex items-center gap-2 flex-wrap",
|
|
1951
1974
|
children: [
|
|
1952
1975
|
/* @__PURE__ */ Z("h1", {
|
|
1953
1976
|
className: "text-xl sm:text-2xl font-bold truncate",
|
|
1954
|
-
children:
|
|
1977
|
+
children: gn(g, q, N, G("detail.details"))
|
|
1955
1978
|
}),
|
|
1956
|
-
|
|
1979
|
+
fe.map((e) => {
|
|
1957
1980
|
let t = g?.[e];
|
|
1958
1981
|
if (t == null || t === "") return null;
|
|
1959
|
-
let n = (
|
|
1982
|
+
let n = (q.sections || []).flatMap((e) => e.fields).concat(q.fields || []).find((t) => t.name === e), r = N?.fields?.[e], i = n?.type || r?.type, a = String(t), o = null;
|
|
1960
1983
|
try {
|
|
1961
1984
|
if (i === "currency") {
|
|
1962
1985
|
let e = Number(t);
|
|
1963
1986
|
if (!Number.isNaN(e)) {
|
|
1964
|
-
let t =
|
|
1987
|
+
let t = Et({
|
|
1965
1988
|
...r,
|
|
1966
1989
|
...n
|
|
1967
|
-
},
|
|
1990
|
+
}, ce);
|
|
1968
1991
|
a = t ? new Intl.NumberFormat(void 0, {
|
|
1969
1992
|
style: "currency",
|
|
1970
1993
|
currency: t,
|
|
@@ -1993,7 +2016,7 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
1993
2016
|
let e = i[String(t)];
|
|
1994
2017
|
e?.label && (o = e.label);
|
|
1995
2018
|
}
|
|
1996
|
-
a =
|
|
2019
|
+
a = q.objectName ? le(q.objectName, e, String(t), o) : o;
|
|
1997
2020
|
}
|
|
1998
2021
|
} catch {}
|
|
1999
2022
|
return o === null ? /* @__PURE__ */ Z(v, {
|
|
@@ -2015,173 +2038,173 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2015
2038
|
}), a]
|
|
2016
2039
|
}, e);
|
|
2017
2040
|
}),
|
|
2018
|
-
/* @__PURE__ */ Q(
|
|
2041
|
+
/* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2019
2042
|
asChild: !0,
|
|
2020
2043
|
children: /* @__PURE__ */ Z(y, {
|
|
2021
2044
|
variant: "ghost",
|
|
2022
2045
|
size: "icon",
|
|
2023
2046
|
className: "h-6 w-6 shrink-0",
|
|
2024
|
-
onClick:
|
|
2025
|
-
"aria-label":
|
|
2047
|
+
onClick: Se,
|
|
2048
|
+
"aria-label": G(w ? "detail.removeFromFavorites" : "detail.addToFavorites"),
|
|
2026
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" })
|
|
2027
2050
|
})
|
|
2028
|
-
}), /* @__PURE__ */ Z(
|
|
2051
|
+
}), /* @__PURE__ */ Z(V, { children: G(w ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
|
|
2029
2052
|
]
|
|
2030
|
-
}),
|
|
2053
|
+
}), q.objectName && /* @__PURE__ */ Q("p", {
|
|
2031
2054
|
className: "text-sm text-muted-foreground mt-1 flex items-center gap-1",
|
|
2032
2055
|
children: [/* @__PURE__ */ Z("span", {
|
|
2033
2056
|
className: "font-medium",
|
|
2034
|
-
children: f ||
|
|
2035
|
-
}),
|
|
2057
|
+
children: f || q.objectName
|
|
2058
|
+
}), q.resourceId && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2036
2059
|
asChild: !0,
|
|
2037
2060
|
children: /* @__PURE__ */ Z(y, {
|
|
2038
2061
|
variant: "ghost",
|
|
2039
2062
|
size: "icon",
|
|
2040
2063
|
className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
|
|
2041
|
-
onClick:
|
|
2042
|
-
"aria-label":
|
|
2043
|
-
children: P ? /* @__PURE__ */ Z(
|
|
2064
|
+
onClick: pe,
|
|
2065
|
+
"aria-label": G("detail.copyRecordId", { defaultValue: "Copy record ID" }),
|
|
2066
|
+
children: P ? /* @__PURE__ */ Z(me, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Ce, { className: "h-3 w-3" })
|
|
2044
2067
|
})
|
|
2045
|
-
}), /* @__PURE__ */ Z(
|
|
2068
|
+
}), /* @__PURE__ */ Z(V, { children: P ? G("detail.copied", { defaultValue: "Copied" }) : G("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
|
|
2046
2069
|
})]
|
|
2047
2070
|
})]
|
|
2048
2071
|
}), /* @__PURE__ */ Q("div", {
|
|
2049
2072
|
className: "flex flex-wrap items-center gap-1.5 shrink-0 w-full sm:w-auto",
|
|
2050
2073
|
children: [
|
|
2051
|
-
|
|
2074
|
+
q.recordNavigation && /* @__PURE__ */ Q("div", {
|
|
2052
2075
|
className: "flex items-center gap-1 mr-2",
|
|
2053
2076
|
children: [
|
|
2054
|
-
/* @__PURE__ */ Q(
|
|
2077
|
+
/* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2055
2078
|
asChild: !0,
|
|
2056
2079
|
children: /* @__PURE__ */ Z(y, {
|
|
2057
2080
|
variant: "outline",
|
|
2058
2081
|
size: "icon",
|
|
2059
2082
|
className: "h-8 w-8",
|
|
2060
|
-
disabled:
|
|
2083
|
+
disabled: q.recordNavigation.currentIndex <= 0,
|
|
2061
2084
|
onClick: () => {
|
|
2062
|
-
let e =
|
|
2085
|
+
let e = q.recordNavigation;
|
|
2063
2086
|
e.currentIndex > 0 && e.onNavigate(e.recordIds[e.currentIndex - 1]);
|
|
2064
2087
|
},
|
|
2065
|
-
children: /* @__PURE__ */ Z(
|
|
2088
|
+
children: /* @__PURE__ */ Z(_e, { className: "h-4 w-4" })
|
|
2066
2089
|
})
|
|
2067
|
-
}), /* @__PURE__ */ Z(
|
|
2090
|
+
}), /* @__PURE__ */ Z(V, { children: G("detail.previousRecord") })] }),
|
|
2068
2091
|
/* @__PURE__ */ Z("span", {
|
|
2069
2092
|
className: "text-xs text-muted-foreground whitespace-nowrap px-1",
|
|
2070
|
-
children:
|
|
2071
|
-
current:
|
|
2072
|
-
total:
|
|
2093
|
+
children: G("detail.recordOf", {
|
|
2094
|
+
current: q.recordNavigation.currentIndex + 1,
|
|
2095
|
+
total: q.recordNavigation.recordIds.length
|
|
2073
2096
|
})
|
|
2074
2097
|
}),
|
|
2075
|
-
/* @__PURE__ */ Q(
|
|
2098
|
+
/* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2076
2099
|
asChild: !0,
|
|
2077
2100
|
children: /* @__PURE__ */ Z(y, {
|
|
2078
2101
|
variant: "outline",
|
|
2079
2102
|
size: "icon",
|
|
2080
2103
|
className: "h-8 w-8",
|
|
2081
|
-
disabled:
|
|
2104
|
+
disabled: q.recordNavigation.currentIndex >= q.recordNavigation.recordIds.length - 1,
|
|
2082
2105
|
onClick: () => {
|
|
2083
|
-
let e =
|
|
2106
|
+
let e = q.recordNavigation;
|
|
2084
2107
|
e.currentIndex < e.recordIds.length - 1 && e.onNavigate(e.recordIds[e.currentIndex + 1]);
|
|
2085
2108
|
},
|
|
2086
|
-
children: /* @__PURE__ */ Z(
|
|
2109
|
+
children: /* @__PURE__ */ Z(ve, { className: "h-4 w-4" })
|
|
2087
2110
|
})
|
|
2088
|
-
}), /* @__PURE__ */ Z(
|
|
2111
|
+
}), /* @__PURE__ */ Z(V, { children: G("detail.nextRecord") })] })
|
|
2089
2112
|
]
|
|
2090
2113
|
}),
|
|
2091
|
-
c && /* @__PURE__ */ Q(
|
|
2114
|
+
c && /* @__PURE__ */ Q(Ct, { children: [T && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2092
2115
|
asChild: !0,
|
|
2093
2116
|
children: /* @__PURE__ */ Q(y, {
|
|
2094
2117
|
variant: "ghost",
|
|
2095
2118
|
size: "sm",
|
|
2096
|
-
onClick:
|
|
2119
|
+
onClick: Ee,
|
|
2097
2120
|
className: "gap-2 hidden sm:inline-flex",
|
|
2098
2121
|
children: [/* @__PURE__ */ Z(et, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2099
2122
|
className: "hidden sm:inline",
|
|
2100
|
-
children:
|
|
2123
|
+
children: G("detail.cancel")
|
|
2101
2124
|
})]
|
|
2102
2125
|
})
|
|
2103
|
-
}), /* @__PURE__ */ Z(
|
|
2126
|
+
}), /* @__PURE__ */ Z(V, { children: G("detail.cancelEdit") })] }), /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2104
2127
|
asChild: !0,
|
|
2105
2128
|
children: /* @__PURE__ */ Z(y, {
|
|
2106
2129
|
variant: T ? "default" : "outline",
|
|
2107
2130
|
size: "sm",
|
|
2108
|
-
onClick:
|
|
2131
|
+
onClick: Te,
|
|
2109
2132
|
className: "gap-2 hidden sm:inline-flex",
|
|
2110
|
-
children: T ? /* @__PURE__ */ Q(
|
|
2133
|
+
children: T ? /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Z(me, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2111
2134
|
className: "hidden sm:inline",
|
|
2112
|
-
children:
|
|
2113
|
-
})] }) : /* @__PURE__ */ Q(
|
|
2135
|
+
children: G("detail.save")
|
|
2136
|
+
})] }) : /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Z(we, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2114
2137
|
className: "hidden sm:inline",
|
|
2115
|
-
children:
|
|
2138
|
+
children: G("detail.editInline")
|
|
2116
2139
|
})] })
|
|
2117
2140
|
})
|
|
2118
|
-
}), /* @__PURE__ */ Z(
|
|
2119
|
-
|
|
2141
|
+
}), /* @__PURE__ */ Z(V, { children: G(T ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
|
|
2142
|
+
q.showEdit && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2120
2143
|
asChild: !0,
|
|
2121
2144
|
children: /* @__PURE__ */ Q(y, {
|
|
2122
2145
|
variant: "default",
|
|
2123
|
-
onClick:
|
|
2146
|
+
onClick: ge,
|
|
2124
2147
|
className: "gap-2 hidden sm:inline-flex",
|
|
2125
|
-
children: [/* @__PURE__ */ Z(
|
|
2148
|
+
children: [/* @__PURE__ */ Z(we, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2126
2149
|
className: "hidden sm:inline",
|
|
2127
|
-
children:
|
|
2150
|
+
children: G("detail.edit")
|
|
2128
2151
|
})]
|
|
2129
2152
|
})
|
|
2130
|
-
}), /* @__PURE__ */ Z(
|
|
2131
|
-
|
|
2153
|
+
}), /* @__PURE__ */ Z(V, { children: G("detail.editRecord") })] }),
|
|
2154
|
+
ke.map((e, t) => /* @__PURE__ */ Z(rt, {
|
|
2132
2155
|
schema: e,
|
|
2133
2156
|
data: g
|
|
2134
2157
|
}, `header-action-${t}`))
|
|
2135
2158
|
]
|
|
2136
2159
|
})]
|
|
2137
2160
|
}),
|
|
2138
|
-
|
|
2139
|
-
schema:
|
|
2161
|
+
q.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(rt, {
|
|
2162
|
+
schema: q.header,
|
|
2140
2163
|
data: g
|
|
2141
2164
|
}) }),
|
|
2142
|
-
|
|
2143
|
-
fields:
|
|
2165
|
+
q.highlightFields && q.highlightFields.length > 0 && /* @__PURE__ */ Z(Gt, {
|
|
2166
|
+
fields: q.highlightFields,
|
|
2144
2167
|
data: g,
|
|
2145
|
-
objectName:
|
|
2168
|
+
objectName: q.objectName,
|
|
2146
2169
|
objectSchema: N
|
|
2147
2170
|
}),
|
|
2148
|
-
c &&
|
|
2171
|
+
c && q.showHeader === !1 && (() => {
|
|
2149
2172
|
let e = g?.approval_status, t = e === "pending" || e === "in_approval";
|
|
2150
2173
|
return !T && !k && !j && !t ? null : /* @__PURE__ */ Q("div", {
|
|
2151
2174
|
className: "flex flex-col items-end gap-1",
|
|
2152
2175
|
children: [/* @__PURE__ */ Q("div", {
|
|
2153
2176
|
className: "flex items-center justify-end gap-2",
|
|
2154
2177
|
children: [
|
|
2155
|
-
t && !T && /* @__PURE__ */ Q(
|
|
2178
|
+
t && !T && /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Q("span", {
|
|
2156
2179
|
role: "status",
|
|
2157
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",
|
|
2158
|
-
title:
|
|
2159
|
-
children: [/* @__PURE__ */ Z(
|
|
2181
|
+
title: G("detail.lockedTooltip"),
|
|
2182
|
+
children: [/* @__PURE__ */ Z(Ie, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: G("detail.lockedByApproval") })]
|
|
2160
2183
|
}), r?.cancelPendingApproval && /* @__PURE__ */ Q(y, {
|
|
2161
2184
|
variant: "outline",
|
|
2162
2185
|
size: "sm",
|
|
2163
|
-
onClick:
|
|
2164
|
-
disabled:
|
|
2186
|
+
onClick: ye,
|
|
2187
|
+
disabled: U,
|
|
2165
2188
|
className: "gap-2 border-amber-300 text-amber-800 hover:bg-amber-50",
|
|
2166
|
-
title:
|
|
2167
|
-
children: [/* @__PURE__ */ Z(et, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children:
|
|
2189
|
+
title: G("detail.cancelApprovalTooltip"),
|
|
2190
|
+
children: [/* @__PURE__ */ Z(et, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G(U ? "detail.cancelApprovalInFlight" : "detail.cancelApproval") })]
|
|
2168
2191
|
})] }),
|
|
2169
2192
|
T && /* @__PURE__ */ Q(y, {
|
|
2170
2193
|
variant: "ghost",
|
|
2171
2194
|
size: "sm",
|
|
2172
|
-
onClick:
|
|
2195
|
+
onClick: Ee,
|
|
2173
2196
|
className: "gap-2",
|
|
2174
2197
|
disabled: k,
|
|
2175
|
-
children: [/* @__PURE__ */ Z(et, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children:
|
|
2198
|
+
children: [/* @__PURE__ */ Z(et, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G("detail.cancel") })]
|
|
2176
2199
|
}),
|
|
2177
2200
|
/* @__PURE__ */ Q(y, {
|
|
2178
2201
|
variant: T ? "default" : "outline",
|
|
2179
2202
|
size: "sm",
|
|
2180
|
-
onClick:
|
|
2203
|
+
onClick: Te,
|
|
2181
2204
|
className: "gap-2",
|
|
2182
2205
|
disabled: k || t && !T,
|
|
2183
|
-
title: t && !T ?
|
|
2184
|
-
children: [Z(T ?
|
|
2206
|
+
title: t && !T ? G("detail.lockedTooltip") : void 0,
|
|
2207
|
+
children: [Z(T ? me : we, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: G(k ? "detail.saving" : T ? "detail.save" : "detail.editFieldsInline") })]
|
|
2185
2208
|
})
|
|
2186
2209
|
]
|
|
2187
2210
|
}), j && /* @__PURE__ */ Z("div", {
|
|
@@ -2191,49 +2214,52 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2191
2214
|
})]
|
|
2192
2215
|
});
|
|
2193
2216
|
})(),
|
|
2194
|
-
|
|
2195
|
-
let e =
|
|
2217
|
+
q.autoTabs && !q.tabs?.length ? (() => {
|
|
2218
|
+
let e = De.length > 0, t = !!q.activities && q.activities.length > 0, n = !!u, i = !!q.history, a = /* @__PURE__ */ Q("div", {
|
|
2196
2219
|
className: "space-y-3 sm:space-y-4",
|
|
2197
2220
|
children: [
|
|
2198
|
-
|
|
2221
|
+
q.sectionGroups && q.sectionGroups.length > 0 && q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Wt, {
|
|
2199
2222
|
group: e,
|
|
2200
2223
|
data: {
|
|
2201
2224
|
...g,
|
|
2202
2225
|
...D
|
|
2203
2226
|
},
|
|
2204
2227
|
objectSchema: N,
|
|
2205
|
-
objectName:
|
|
2228
|
+
objectName: q.objectName,
|
|
2206
2229
|
isEditing: T,
|
|
2207
|
-
onFieldChange:
|
|
2230
|
+
onFieldChange: J,
|
|
2231
|
+
dataSource: r
|
|
2208
2232
|
}, t)),
|
|
2209
|
-
|
|
2233
|
+
q.sections && q.sections.length > 0 && q.sections.map((e, t) => /* @__PURE__ */ Z(Bt, {
|
|
2210
2234
|
section: e,
|
|
2211
2235
|
data: {
|
|
2212
2236
|
...g,
|
|
2213
2237
|
...D
|
|
2214
2238
|
},
|
|
2215
2239
|
objectSchema: N,
|
|
2216
|
-
objectName:
|
|
2240
|
+
objectName: q.objectName,
|
|
2217
2241
|
isEditing: T,
|
|
2218
|
-
onFieldChange:
|
|
2242
|
+
onFieldChange: J,
|
|
2243
|
+
dataSource: r
|
|
2219
2244
|
}, t)),
|
|
2220
|
-
|
|
2245
|
+
q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(Bt, {
|
|
2221
2246
|
section: {
|
|
2222
|
-
fields:
|
|
2223
|
-
columns:
|
|
2247
|
+
fields: q.fields,
|
|
2248
|
+
columns: q.columns
|
|
2224
2249
|
},
|
|
2225
2250
|
data: {
|
|
2226
2251
|
...g,
|
|
2227
2252
|
...D
|
|
2228
2253
|
},
|
|
2229
2254
|
objectSchema: N,
|
|
2230
|
-
objectName:
|
|
2255
|
+
objectName: q.objectName,
|
|
2231
2256
|
isEditing: T,
|
|
2232
|
-
onFieldChange:
|
|
2257
|
+
onFieldChange: J,
|
|
2258
|
+
dataSource: r
|
|
2233
2259
|
}),
|
|
2234
|
-
|
|
2235
|
-
comments:
|
|
2236
|
-
onAddComment:
|
|
2260
|
+
q.comments && /* @__PURE__ */ Z(qt, {
|
|
2261
|
+
comments: q.comments,
|
|
2262
|
+
onAddComment: q.onAddComment
|
|
2237
2263
|
})
|
|
2238
2264
|
]
|
|
2239
2265
|
});
|
|
@@ -2244,68 +2270,68 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2244
2270
|
defaultValue: "details",
|
|
2245
2271
|
className: "w-full",
|
|
2246
2272
|
children: [
|
|
2247
|
-
/* @__PURE__ */ Q(
|
|
2273
|
+
/* @__PURE__ */ Q(R, {
|
|
2248
2274
|
className: "w-full justify-start border-b rounded-none bg-transparent p-0",
|
|
2249
2275
|
children: [
|
|
2250
|
-
/* @__PURE__ */ Z(
|
|
2276
|
+
/* @__PURE__ */ Z(z, {
|
|
2251
2277
|
value: "details",
|
|
2252
2278
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2253
|
-
children:
|
|
2279
|
+
children: G("detail.details")
|
|
2254
2280
|
}),
|
|
2255
|
-
e && /* @__PURE__ */ Z(
|
|
2281
|
+
e && /* @__PURE__ */ Z(z, {
|
|
2256
2282
|
value: "related",
|
|
2257
2283
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2258
2284
|
children: /* @__PURE__ */ Q("span", {
|
|
2259
2285
|
className: "flex items-center gap-1.5",
|
|
2260
|
-
children: [
|
|
2286
|
+
children: [G("detail.related"), /* @__PURE__ */ Z(v, {
|
|
2261
2287
|
variant: "secondary",
|
|
2262
2288
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2263
|
-
children:
|
|
2289
|
+
children: De.length
|
|
2264
2290
|
})]
|
|
2265
2291
|
})
|
|
2266
2292
|
}),
|
|
2267
|
-
t && /* @__PURE__ */ Z(
|
|
2293
|
+
t && /* @__PURE__ */ Z(z, {
|
|
2268
2294
|
value: "activity",
|
|
2269
2295
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2270
2296
|
children: /* @__PURE__ */ Q("span", {
|
|
2271
2297
|
className: "flex items-center gap-1.5",
|
|
2272
|
-
children: [
|
|
2298
|
+
children: [G("detail.activity"), /* @__PURE__ */ Z(v, {
|
|
2273
2299
|
variant: "secondary",
|
|
2274
2300
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2275
|
-
children:
|
|
2301
|
+
children: q.activities.length
|
|
2276
2302
|
})]
|
|
2277
2303
|
})
|
|
2278
2304
|
}),
|
|
2279
|
-
n && /* @__PURE__ */ Z(
|
|
2305
|
+
n && /* @__PURE__ */ Z(z, {
|
|
2280
2306
|
value: "discussion",
|
|
2281
2307
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2282
|
-
children:
|
|
2308
|
+
children: G("detail.discussion", { defaultValue: "Discussion" })
|
|
2283
2309
|
}),
|
|
2284
|
-
i && /* @__PURE__ */ Z(
|
|
2310
|
+
i && /* @__PURE__ */ Z(z, {
|
|
2285
2311
|
value: "history",
|
|
2286
2312
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2287
2313
|
children: /* @__PURE__ */ Q("span", {
|
|
2288
2314
|
className: "flex items-center gap-1.5",
|
|
2289
|
-
children: [
|
|
2315
|
+
children: [G("detail.history", { defaultValue: "History" }), !q.history.loading && q.history.entries.length > 0 && /* @__PURE__ */ Z(v, {
|
|
2290
2316
|
variant: "secondary",
|
|
2291
2317
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2292
|
-
children:
|
|
2318
|
+
children: q.history.entries.length
|
|
2293
2319
|
})]
|
|
2294
2320
|
})
|
|
2295
2321
|
})
|
|
2296
2322
|
]
|
|
2297
2323
|
}),
|
|
2298
|
-
/* @__PURE__ */ Z(
|
|
2324
|
+
/* @__PURE__ */ Z(re, {
|
|
2299
2325
|
value: "details",
|
|
2300
2326
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2301
2327
|
children: a
|
|
2302
2328
|
}),
|
|
2303
|
-
e && /* @__PURE__ */ Z(
|
|
2329
|
+
e && /* @__PURE__ */ Z(re, {
|
|
2304
2330
|
value: "related",
|
|
2305
2331
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2306
2332
|
children: /* @__PURE__ */ Z("div", {
|
|
2307
2333
|
className: "space-y-3",
|
|
2308
|
-
children:
|
|
2334
|
+
children: De.map((e, t) => /* @__PURE__ */ Z(Ut, {
|
|
2309
2335
|
title: e.title,
|
|
2310
2336
|
type: e.type,
|
|
2311
2337
|
api: e.api,
|
|
@@ -2321,85 +2347,88 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2321
2347
|
onRowEdit: e.onRowEdit,
|
|
2322
2348
|
onRowDelete: e.onRowDelete,
|
|
2323
2349
|
collapsible: !0,
|
|
2324
|
-
defaultCollapsed:
|
|
2325
|
-
pageSize:
|
|
2350
|
+
defaultCollapsed: ue && t > 0,
|
|
2351
|
+
pageSize: hn
|
|
2326
2352
|
}, t))
|
|
2327
2353
|
})
|
|
2328
2354
|
}),
|
|
2329
|
-
t && /* @__PURE__ */ Z(
|
|
2355
|
+
t && /* @__PURE__ */ Z(re, {
|
|
2330
2356
|
value: "activity",
|
|
2331
2357
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2332
|
-
children: /* @__PURE__ */ Z(
|
|
2358
|
+
children: /* @__PURE__ */ Z($t, { activities: q.activities })
|
|
2333
2359
|
}),
|
|
2334
|
-
n && /* @__PURE__ */ Z(
|
|
2360
|
+
n && /* @__PURE__ */ Z(re, {
|
|
2335
2361
|
value: "discussion",
|
|
2336
2362
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2337
2363
|
children: u
|
|
2338
2364
|
}),
|
|
2339
|
-
i && /* @__PURE__ */ Z(
|
|
2365
|
+
i && /* @__PURE__ */ Z(re, {
|
|
2340
2366
|
value: "history",
|
|
2341
2367
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2342
|
-
children: /* @__PURE__ */ Z(
|
|
2343
|
-
entries:
|
|
2344
|
-
loading:
|
|
2345
|
-
emptyText:
|
|
2368
|
+
children: /* @__PURE__ */ Z(sn, {
|
|
2369
|
+
entries: q.history.entries,
|
|
2370
|
+
loading: q.history.loading,
|
|
2371
|
+
emptyText: q.history.emptyText ?? G("detail.historyEmpty", { defaultValue: "No history yet" })
|
|
2346
2372
|
})
|
|
2347
2373
|
})
|
|
2348
2374
|
]
|
|
2349
2375
|
});
|
|
2350
|
-
})() : /* @__PURE__ */ Q(
|
|
2351
|
-
|
|
2376
|
+
})() : /* @__PURE__ */ Q(Ct, { children: [
|
|
2377
|
+
q.sectionGroups && q.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2352
2378
|
className: "space-y-3 sm:space-y-4",
|
|
2353
|
-
children:
|
|
2379
|
+
children: q.sectionGroups.map((e, t) => /* @__PURE__ */ Z(Wt, {
|
|
2354
2380
|
group: e,
|
|
2355
2381
|
data: {
|
|
2356
2382
|
...g,
|
|
2357
2383
|
...D
|
|
2358
2384
|
},
|
|
2359
2385
|
objectSchema: N,
|
|
2360
|
-
objectName:
|
|
2386
|
+
objectName: q.objectName,
|
|
2361
2387
|
isEditing: T,
|
|
2362
|
-
onFieldChange:
|
|
2388
|
+
onFieldChange: J,
|
|
2389
|
+
dataSource: r
|
|
2363
2390
|
}, t))
|
|
2364
2391
|
}),
|
|
2365
|
-
|
|
2392
|
+
q.sections && q.sections.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2366
2393
|
className: "space-y-3 sm:space-y-4",
|
|
2367
|
-
children:
|
|
2394
|
+
children: q.sections.map((e, t) => /* @__PURE__ */ Z(Bt, {
|
|
2368
2395
|
section: e,
|
|
2369
2396
|
data: {
|
|
2370
2397
|
...g,
|
|
2371
2398
|
...D
|
|
2372
2399
|
},
|
|
2373
2400
|
objectSchema: N,
|
|
2374
|
-
objectName:
|
|
2401
|
+
objectName: q.objectName,
|
|
2375
2402
|
isEditing: T,
|
|
2376
|
-
onFieldChange:
|
|
2403
|
+
onFieldChange: J,
|
|
2404
|
+
dataSource: r
|
|
2377
2405
|
}, t))
|
|
2378
2406
|
}),
|
|
2379
|
-
|
|
2407
|
+
q.fields && q.fields.length > 0 && !q.sections?.length && /* @__PURE__ */ Z(Bt, {
|
|
2380
2408
|
section: {
|
|
2381
|
-
fields:
|
|
2382
|
-
columns:
|
|
2409
|
+
fields: q.fields,
|
|
2410
|
+
columns: q.columns
|
|
2383
2411
|
},
|
|
2384
2412
|
data: {
|
|
2385
2413
|
...g,
|
|
2386
2414
|
...D
|
|
2387
2415
|
},
|
|
2388
2416
|
objectSchema: N,
|
|
2389
|
-
objectName:
|
|
2417
|
+
objectName: q.objectName,
|
|
2390
2418
|
isEditing: T,
|
|
2391
|
-
onFieldChange:
|
|
2419
|
+
onFieldChange: J,
|
|
2420
|
+
dataSource: r
|
|
2392
2421
|
}),
|
|
2393
|
-
|
|
2394
|
-
tabs:
|
|
2422
|
+
q.tabs && q.tabs.length > 0 && /* @__PURE__ */ Z(Vt, {
|
|
2423
|
+
tabs: q.tabs,
|
|
2395
2424
|
data: g
|
|
2396
2425
|
}),
|
|
2397
|
-
|
|
2426
|
+
De.length > 0 && /* @__PURE__ */ Q("div", {
|
|
2398
2427
|
className: "space-y-3",
|
|
2399
2428
|
children: [/* @__PURE__ */ Z("h2", {
|
|
2400
2429
|
className: "text-lg font-semibold",
|
|
2401
|
-
children:
|
|
2402
|
-
}),
|
|
2430
|
+
children: G("detail.related")
|
|
2431
|
+
}), De.map((e, t) => /* @__PURE__ */ Z(Ut, {
|
|
2403
2432
|
title: e.title,
|
|
2404
2433
|
type: e.type,
|
|
2405
2434
|
api: e.api,
|
|
@@ -2415,31 +2444,31 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2415
2444
|
onRowEdit: e.onRowEdit,
|
|
2416
2445
|
onRowDelete: e.onRowDelete,
|
|
2417
2446
|
collapsible: !0,
|
|
2418
|
-
defaultCollapsed:
|
|
2419
|
-
pageSize:
|
|
2447
|
+
defaultCollapsed: ue && t > 0,
|
|
2448
|
+
pageSize: hn
|
|
2420
2449
|
}, t))]
|
|
2421
2450
|
}),
|
|
2422
|
-
|
|
2423
|
-
comments:
|
|
2424
|
-
onAddComment:
|
|
2451
|
+
q.comments && /* @__PURE__ */ Z(qt, {
|
|
2452
|
+
comments: q.comments,
|
|
2453
|
+
onAddComment: q.onAddComment
|
|
2425
2454
|
}),
|
|
2426
|
-
|
|
2455
|
+
q.activities && q.activities.length > 0 && /* @__PURE__ */ Z($t, { activities: q.activities })
|
|
2427
2456
|
] }),
|
|
2428
|
-
/* @__PURE__ */ Z(
|
|
2457
|
+
/* @__PURE__ */ Z(mn, {
|
|
2429
2458
|
data: {
|
|
2430
2459
|
...g,
|
|
2431
2460
|
...D
|
|
2432
2461
|
},
|
|
2433
2462
|
objectSchema: N,
|
|
2434
|
-
objectName:
|
|
2463
|
+
objectName: q.objectName
|
|
2435
2464
|
}),
|
|
2436
|
-
|
|
2437
|
-
schema:
|
|
2465
|
+
q.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(rt, {
|
|
2466
|
+
schema: q.footer,
|
|
2438
2467
|
data: g
|
|
2439
2468
|
}) })
|
|
2440
2469
|
]
|
|
2441
2470
|
}) });
|
|
2442
|
-
},
|
|
2471
|
+
}, vn = (e) => {
|
|
2443
2472
|
if (e == null) return "—";
|
|
2444
2473
|
if (typeof e == "string") return e.length > 0 ? e : "\"\"";
|
|
2445
2474
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -2448,7 +2477,7 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2448
2477
|
} catch {
|
|
2449
2478
|
return String(e);
|
|
2450
2479
|
}
|
|
2451
|
-
},
|
|
2480
|
+
}, yn = (e) => {
|
|
2452
2481
|
if (typeof e != "string" || e.length === 0) return null;
|
|
2453
2482
|
let t = /\d{4}-\d{2}-\d{2}[ T]/.test(e) ? e.replace(" ", "T") : e, n = new Date(t);
|
|
2454
2483
|
if (Number.isNaN(n.getTime())) return null;
|
|
@@ -2457,13 +2486,13 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2457
2486
|
} catch {
|
|
2458
2487
|
return n.toISOString();
|
|
2459
2488
|
}
|
|
2460
|
-
},
|
|
2461
|
-
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 ?? {}, _ = (() => {
|
|
2462
2491
|
let e = [g.updated_by_name, g.updated_by_label];
|
|
2463
2492
|
for (let t of e) if (typeof t == "string" && t.length > 0) return t;
|
|
2464
2493
|
let t = g.updated_by;
|
|
2465
2494
|
return typeof t != "string" || t.length === 0 || t.length >= 16 && !/\s/.test(t) && /^[A-Za-z0-9_-]+$/.test(t) ? null : t;
|
|
2466
|
-
})(), v =
|
|
2495
|
+
})(), v = yn(g.updated_at ?? t?.currentVersion), [y, b] = s("detail.concurrentUpdateDescription", { field: "{{field}}" }).split("{{field}}");
|
|
2467
2496
|
return /* @__PURE__ */ Z(o, {
|
|
2468
2497
|
open: e,
|
|
2469
2498
|
onOpenChange: (e) => {
|
|
@@ -2477,7 +2506,7 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2477
2506
|
children: [/* @__PURE__ */ Z("span", {
|
|
2478
2507
|
className: "inline-flex h-9 w-9 flex-none items-center justify-center rounded-full bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-300",
|
|
2479
2508
|
"aria-hidden": "true",
|
|
2480
|
-
children: /* @__PURE__ */ Z(
|
|
2509
|
+
children: /* @__PURE__ */ Z(G, { className: "h-5 w-5" })
|
|
2481
2510
|
}), /* @__PURE__ */ Q("div", {
|
|
2482
2511
|
className: "flex-1",
|
|
2483
2512
|
children: [/* @__PURE__ */ Z(p, { children: s("detail.concurrentUpdateTitle") }), /* @__PURE__ */ Q(u, {
|
|
@@ -2532,14 +2561,14 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2532
2561
|
type: "button",
|
|
2533
2562
|
disabled: a,
|
|
2534
2563
|
onClick: i,
|
|
2535
|
-
className:
|
|
2564
|
+
className: W(U({ variant: "ghost" }), "mt-2 sm:mt-0"),
|
|
2536
2565
|
children: s("detail.concurrentUpdateCancel")
|
|
2537
2566
|
}),
|
|
2538
2567
|
/* @__PURE__ */ Z("button", {
|
|
2539
2568
|
type: "button",
|
|
2540
2569
|
disabled: a,
|
|
2541
2570
|
onClick: r,
|
|
2542
|
-
className:
|
|
2571
|
+
className: W(U({ variant: "outline" }), "mt-2 sm:mt-0 text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive"),
|
|
2543
2572
|
children: s("detail.concurrentUpdateOverwrite")
|
|
2544
2573
|
}),
|
|
2545
2574
|
/* @__PURE__ */ Z("button", {
|
|
@@ -2547,7 +2576,7 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2547
2576
|
disabled: a,
|
|
2548
2577
|
onClick: n,
|
|
2549
2578
|
autoFocus: !0,
|
|
2550
|
-
className:
|
|
2579
|
+
className: W(U({ variant: "default" }), "mt-2 sm:mt-0"),
|
|
2551
2580
|
children: s("detail.concurrentUpdateReload")
|
|
2552
2581
|
})
|
|
2553
2582
|
]
|
|
@@ -2556,14 +2585,14 @@ var fn = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBa
|
|
|
2556
2585
|
})
|
|
2557
2586
|
});
|
|
2558
2587
|
};
|
|
2559
|
-
function
|
|
2588
|
+
function xn(e) {
|
|
2560
2589
|
if (!e || typeof e != "object") return !1;
|
|
2561
2590
|
let t = e;
|
|
2562
2591
|
return t.code === "CONCURRENT_UPDATE" || t.name === "ConcurrentUpdateError";
|
|
2563
2592
|
}
|
|
2564
2593
|
//#endregion
|
|
2565
2594
|
//#region src/renderers/record-details.tsx
|
|
2566
|
-
var
|
|
2595
|
+
var Sn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name) || null, Cn = (e) => {
|
|
2567
2596
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2568
2597
|
return {
|
|
2569
2598
|
designer: {
|
|
@@ -2573,8 +2602,8 @@ var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2573
2602
|
},
|
|
2574
2603
|
rest: i
|
|
2575
2604
|
};
|
|
2576
|
-
},
|
|
2577
|
-
let i = dt(), { designer: a } =
|
|
2605
|
+
}, wn = ({ schema: e = {}, className: t, ...n }) => {
|
|
2606
|
+
let i = dt(), { designer: a } = Cn(n);
|
|
2578
2607
|
if (!i) return /* @__PURE__ */ Z("div", {
|
|
2579
2608
|
className: t,
|
|
2580
2609
|
"data-record-details-placeholder": !0,
|
|
@@ -2584,7 +2613,7 @@ var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2584
2613
|
children: "record:details — bind a record to preview"
|
|
2585
2614
|
})
|
|
2586
2615
|
});
|
|
2587
|
-
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 : [];
|
|
2588
2617
|
if (d.length > 0 && s && !d.every((e) => c.can(s, e))) return /* @__PURE__ */ Z("div", {
|
|
2589
2618
|
className: t,
|
|
2590
2619
|
...a,
|
|
@@ -2597,15 +2626,15 @@ var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2597
2626
|
});
|
|
2598
2627
|
let f = e.enforceFieldSecurity === !0, p = Array.isArray(e.redactFields) ? e.redactFields : [], m = (e) => {
|
|
2599
2628
|
if (!e || !f && p.length === 0) return e;
|
|
2600
|
-
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)));
|
|
2601
2630
|
return e.filter((e) => {
|
|
2602
|
-
let t =
|
|
2631
|
+
let t = Sn(e);
|
|
2603
2632
|
return t ? n.has(t) : !0;
|
|
2604
2633
|
});
|
|
2605
2634
|
}, h = (e) => typeof e == "string" ? { name: e } : e && typeof e == "object" && !e.name && e.field ? {
|
|
2606
2635
|
...e,
|
|
2607
2636
|
name: e.field
|
|
2608
|
-
} : 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));
|
|
2609
2638
|
for (let e of _) v.add(e);
|
|
2610
2639
|
let y = i.objectSchema, b = i.data ?? {}, x = [
|
|
2611
2640
|
y?.primaryField,
|
|
@@ -2621,7 +2650,7 @@ var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2621
2650
|
break;
|
|
2622
2651
|
}
|
|
2623
2652
|
let S = (e) => !e || v.size === 0 ? e : e.filter((e) => {
|
|
2624
|
-
let t =
|
|
2653
|
+
let t = Sn(e);
|
|
2625
2654
|
return t ? !v.has(t) : !0;
|
|
2626
2655
|
}), C = S(g(m(e.fields))), w = Array.isArray(e.sections) ? e.sections.map((e) => {
|
|
2627
2656
|
let t = e.title ?? e.label, n = e.name && s ? u(s, e.name, t ?? e.name) : t;
|
|
@@ -2649,7 +2678,7 @@ var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2649
2678
|
}
|
|
2650
2679
|
typeof i.refresh == "function" && await i.refresh();
|
|
2651
2680
|
} catch (n) {
|
|
2652
|
-
if (
|
|
2681
|
+
if (xn(n)) {
|
|
2653
2682
|
let r = n.currentRecord ?? null;
|
|
2654
2683
|
throw D({
|
|
2655
2684
|
field: e,
|
|
@@ -2720,12 +2749,12 @@ var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2720
2749
|
return /* @__PURE__ */ Q("div", {
|
|
2721
2750
|
className: t,
|
|
2722
2751
|
...a,
|
|
2723
|
-
children: [/* @__PURE__ */ Z(
|
|
2752
|
+
children: [/* @__PURE__ */ Z(_n, {
|
|
2724
2753
|
schema: P,
|
|
2725
2754
|
dataSource: i.dataSource,
|
|
2726
2755
|
inlineEdit: T,
|
|
2727
2756
|
onFieldSave: j
|
|
2728
|
-
}), /* @__PURE__ */ Z(
|
|
2757
|
+
}), /* @__PURE__ */ Z(bn, {
|
|
2729
2758
|
open: !!E,
|
|
2730
2759
|
conflict: E,
|
|
2731
2760
|
busy: O,
|
|
@@ -2734,7 +2763,7 @@ var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2734
2763
|
onOverwrite: ee
|
|
2735
2764
|
})]
|
|
2736
2765
|
});
|
|
2737
|
-
},
|
|
2766
|
+
}, Tn = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field || e.name || e.key) || null, En = (e) => {
|
|
2738
2767
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2739
2768
|
return {
|
|
2740
2769
|
designer: {
|
|
@@ -2744,11 +2773,11 @@ var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2744
2773
|
},
|
|
2745
2774
|
rest: i
|
|
2746
2775
|
};
|
|
2747
|
-
},
|
|
2748
|
-
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({
|
|
2749
2778
|
name: o,
|
|
2750
|
-
label:
|
|
2751
|
-
}) : o ?
|
|
2779
|
+
label: xt(o)
|
|
2780
|
+
}) : o ? xt(o) : "", c = e.title || s || "Related";
|
|
2752
2781
|
if (!o) return /* @__PURE__ */ Z("div", {
|
|
2753
2782
|
className: t,
|
|
2754
2783
|
...i,
|
|
@@ -2757,7 +2786,7 @@ var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2757
2786
|
children: "record:related_list — missing objectName"
|
|
2758
2787
|
})
|
|
2759
2788
|
});
|
|
2760
|
-
let l =
|
|
2789
|
+
let l = Tt(), { readableFields: u } = wt(o), d = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
2761
2790
|
if (d.length > 0 && !d.every((e) => l.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2762
2791
|
className: t,
|
|
2763
2792
|
...i,
|
|
@@ -2770,16 +2799,16 @@ var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2770
2799
|
});
|
|
2771
2800
|
let f = e.enforceFieldSecurity === !0, p = Array.isArray(e.redactFields) ? e.redactFields : [], m = Array.isArray(e.columns) ? e.columns : [], h = m;
|
|
2772
2801
|
if (f || p.length > 0) {
|
|
2773
|
-
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)));
|
|
2774
2803
|
h = m.filter((e) => {
|
|
2775
|
-
let n =
|
|
2804
|
+
let n = Tn(e);
|
|
2776
2805
|
return n ? t.has(n) : !0;
|
|
2777
2806
|
});
|
|
2778
2807
|
}
|
|
2779
2808
|
return /* @__PURE__ */ Z("div", {
|
|
2780
2809
|
className: t,
|
|
2781
2810
|
...i,
|
|
2782
|
-
children: /* @__PURE__ */ Z(
|
|
2811
|
+
children: /* @__PURE__ */ Z(Ut, {
|
|
2783
2812
|
title: c,
|
|
2784
2813
|
type: "table",
|
|
2785
2814
|
api: o,
|
|
@@ -2796,7 +2825,7 @@ var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2796
2825
|
} : void 0
|
|
2797
2826
|
})
|
|
2798
2827
|
});
|
|
2799
|
-
},
|
|
2828
|
+
}, On = (e) => {
|
|
2800
2829
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2801
2830
|
return {
|
|
2802
2831
|
designer: {
|
|
@@ -2806,8 +2835,8 @@ var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2806
2835
|
},
|
|
2807
2836
|
rest: i
|
|
2808
2837
|
};
|
|
2809
|
-
},
|
|
2810
|
-
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 : [];
|
|
2811
2840
|
if (l.length > 0 && o && !l.every((e) => s.can(o, e))) return /* @__PURE__ */ Z("div", {
|
|
2812
2841
|
className: t,
|
|
2813
2842
|
...a,
|
|
@@ -2827,17 +2856,17 @@ var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2827
2856
|
return ft(r.useId(), m.map((e) => e.name)), /* @__PURE__ */ Z("div", {
|
|
2828
2857
|
className: t,
|
|
2829
2858
|
...a,
|
|
2830
|
-
children: /* @__PURE__ */ Z(
|
|
2859
|
+
children: /* @__PURE__ */ Z(Gt, {
|
|
2831
2860
|
fields: m,
|
|
2832
2861
|
data: i?.data,
|
|
2833
2862
|
objectName: i?.objectName,
|
|
2834
2863
|
objectSchema: i?.objectSchema
|
|
2835
2864
|
})
|
|
2836
2865
|
});
|
|
2837
|
-
},
|
|
2866
|
+
}, An = ({ change: e, className: t }) => {
|
|
2838
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));
|
|
2839
2868
|
return /* @__PURE__ */ Q("div", {
|
|
2840
|
-
className:
|
|
2869
|
+
className: W("flex items-center gap-1.5 text-sm flex-wrap", t),
|
|
2841
2870
|
children: [
|
|
2842
2871
|
/* @__PURE__ */ Z("span", {
|
|
2843
2872
|
className: "font-medium text-foreground",
|
|
@@ -2847,29 +2876,29 @@ var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2847
2876
|
className: "text-muted-foreground line-through",
|
|
2848
2877
|
children: r
|
|
2849
2878
|
}),
|
|
2850
|
-
/* @__PURE__ */ Z(
|
|
2879
|
+
/* @__PURE__ */ Z(ce, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
2851
2880
|
/* @__PURE__ */ Z("span", {
|
|
2852
2881
|
className: "text-foreground",
|
|
2853
2882
|
children: i
|
|
2854
2883
|
})
|
|
2855
2884
|
]
|
|
2856
2885
|
});
|
|
2857
|
-
},
|
|
2886
|
+
}, jn = [
|
|
2858
2887
|
"👍",
|
|
2859
2888
|
"❤️",
|
|
2860
2889
|
"🎉",
|
|
2861
2890
|
"😂",
|
|
2862
2891
|
"😮",
|
|
2863
2892
|
"😢"
|
|
2864
|
-
],
|
|
2893
|
+
], Mn = ({ reactions: e, onToggleReaction: t, emojiOptions: r = jn, className: i }) => {
|
|
2865
2894
|
let [a, o] = n.useState(!1), s = n.useCallback((e) => {
|
|
2866
2895
|
t?.(e), o(!1);
|
|
2867
2896
|
}, [t]);
|
|
2868
2897
|
return /* @__PURE__ */ Q("div", {
|
|
2869
|
-
className:
|
|
2898
|
+
className: W("flex items-center gap-1 flex-wrap", i),
|
|
2870
2899
|
children: [e.map((e) => /* @__PURE__ */ Q("button", {
|
|
2871
2900
|
type: "button",
|
|
2872
|
-
className:
|
|
2901
|
+
className: W("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs border transition-colors", e.reacted ? "bg-primary/10 border-primary/30 text-primary" : "bg-muted border-border text-muted-foreground hover:bg-muted/80"),
|
|
2873
2902
|
onClick: () => s(e.emoji),
|
|
2874
2903
|
disabled: !t,
|
|
2875
2904
|
"aria-label": `${e.emoji} ${e.count} reaction${e.count === 1 ? "" : "s"}`,
|
|
@@ -2901,7 +2930,7 @@ var _n = (e) => typeof e == "string" ? e : e && typeof e == "object" && (e.field
|
|
|
2901
2930
|
};
|
|
2902
2931
|
//#endregion
|
|
2903
2932
|
//#region src/ThreadedReplies.tsx
|
|
2904
|
-
function
|
|
2933
|
+
function Nn(e, t) {
|
|
2905
2934
|
try {
|
|
2906
2935
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
2907
2936
|
if (i < 1) return t("detail.justNow");
|
|
@@ -2914,7 +2943,7 @@ function On(e, t) {
|
|
|
2914
2943
|
return e;
|
|
2915
2944
|
}
|
|
2916
2945
|
}
|
|
2917
|
-
var
|
|
2946
|
+
var Pn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, className: a }) => {
|
|
2918
2947
|
let { t: o } = $(), [s, c] = n.useState(!1), [l, u] = n.useState(""), [d, f] = n.useState(!1), p = n.useCallback(async () => {
|
|
2919
2948
|
let t = l.trim();
|
|
2920
2949
|
if (!(!t || !r)) {
|
|
@@ -2933,7 +2962,7 @@ var kn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2933
2962
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), p());
|
|
2934
2963
|
}, [p]);
|
|
2935
2964
|
return t.length === 0 && !i ? null : /* @__PURE__ */ Q("div", {
|
|
2936
|
-
className:
|
|
2965
|
+
className: W("ml-10 mt-1", a),
|
|
2937
2966
|
children: [
|
|
2938
2967
|
t.length > 0 && /* @__PURE__ */ Q("button", {
|
|
2939
2968
|
type: "button",
|
|
@@ -2941,8 +2970,8 @@ var kn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2941
2970
|
onClick: () => c(!s),
|
|
2942
2971
|
"aria-expanded": s,
|
|
2943
2972
|
children: [
|
|
2944
|
-
Z(s ?
|
|
2945
|
-
/* @__PURE__ */ Z(
|
|
2973
|
+
Z(s ? ge : ve, { className: "h-3 w-3" }),
|
|
2974
|
+
/* @__PURE__ */ Z(X, { className: "h-3 w-3" }),
|
|
2946
2975
|
/* @__PURE__ */ Z("span", { children: t.length === 1 ? o("detail.replyCount", { count: t.length }) : o("detail.replyCountPlural", { count: t.length }) })
|
|
2947
2976
|
]
|
|
2948
2977
|
}),
|
|
@@ -2969,7 +2998,7 @@ var kn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2969
2998
|
children: e.actor
|
|
2970
2999
|
}), /* @__PURE__ */ Z("span", {
|
|
2971
3000
|
className: "text-[10px] text-muted-foreground",
|
|
2972
|
-
children:
|
|
3001
|
+
children: Nn(e.createdAt, o)
|
|
2973
3002
|
})]
|
|
2974
3003
|
}), /* @__PURE__ */ Z("p", {
|
|
2975
3004
|
className: "text-xs whitespace-pre-wrap break-words",
|
|
@@ -2999,7 +3028,7 @@ var kn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
2999
3028
|
})
|
|
3000
3029
|
]
|
|
3001
3030
|
});
|
|
3002
|
-
},
|
|
3031
|
+
}, Fn = ({ subscription: e, onToggle: t, className: r }) => {
|
|
3003
3032
|
let { t: i } = $(), [a, o] = n.useState(!1), s = n.useCallback(async () => {
|
|
3004
3033
|
if (t) {
|
|
3005
3034
|
o(!0);
|
|
@@ -3013,21 +3042,21 @@ var kn = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, cl
|
|
|
3013
3042
|
return /* @__PURE__ */ Z(y, {
|
|
3014
3043
|
variant: "ghost",
|
|
3015
3044
|
size: "icon",
|
|
3016
|
-
className:
|
|
3045
|
+
className: W("h-8 w-8", r),
|
|
3017
3046
|
onClick: s,
|
|
3018
3047
|
disabled: a || !t,
|
|
3019
3048
|
"aria-label": e.subscribed ? i("detail.unsubscribeAriaLabel") : i("detail.subscribeAriaLabel"),
|
|
3020
3049
|
title: e.subscribed ? i("detail.subscribedTooltip") : i("detail.unsubscribedTooltip"),
|
|
3021
|
-
children: e.subscribed ? /* @__PURE__ */ Z(
|
|
3050
|
+
children: e.subscribed ? /* @__PURE__ */ Z(q, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(de, { className: "h-4 w-4 text-muted-foreground" })
|
|
3022
3051
|
});
|
|
3023
3052
|
};
|
|
3024
3053
|
//#endregion
|
|
3025
3054
|
//#region src/RichTextCommentInput.tsx
|
|
3026
|
-
function
|
|
3055
|
+
function In(e) {
|
|
3027
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/>");
|
|
3028
3057
|
return t = t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g, (e) => `<ul class="my-1">${e.replace(/<br\/>/g, "")}</ul>`), t;
|
|
3029
3058
|
}
|
|
3030
|
-
var
|
|
3059
|
+
var Ln = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], placeholder: a, className: o, disabled: s = !1, extraSlot: c, canSubmitEmpty: l = !1 }) => {
|
|
3031
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(() => {
|
|
3032
3061
|
if (!h) return i;
|
|
3033
3062
|
let e = h.toLowerCase();
|
|
@@ -3088,7 +3117,7 @@ var Mn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3088
3117
|
r
|
|
3089
3118
|
]);
|
|
3090
3119
|
return /* @__PURE__ */ Q("div", {
|
|
3091
|
-
className:
|
|
3120
|
+
className: W("border rounded-md", o),
|
|
3092
3121
|
children: [
|
|
3093
3122
|
/* @__PURE__ */ Q("div", {
|
|
3094
3123
|
className: "flex items-center gap-0.5 px-2 py-1.5 border-b bg-muted/30",
|
|
@@ -3100,7 +3129,7 @@ var Mn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3100
3129
|
onClick: C,
|
|
3101
3130
|
disabled: s || d,
|
|
3102
3131
|
title: u("detail.bold"),
|
|
3103
|
-
children: /* @__PURE__ */ Z(
|
|
3132
|
+
children: /* @__PURE__ */ Z(fe, { className: "h-3.5 w-3.5" })
|
|
3104
3133
|
}),
|
|
3105
3134
|
/* @__PURE__ */ Z(y, {
|
|
3106
3135
|
variant: "ghost",
|
|
@@ -3109,7 +3138,7 @@ var Mn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3109
3138
|
onClick: w,
|
|
3110
3139
|
disabled: s || d,
|
|
3111
3140
|
title: u("detail.italic"),
|
|
3112
|
-
children: /* @__PURE__ */ Z(
|
|
3141
|
+
children: /* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5" })
|
|
3113
3142
|
}),
|
|
3114
3143
|
/* @__PURE__ */ Z(y, {
|
|
3115
3144
|
variant: "ghost",
|
|
@@ -3118,7 +3147,7 @@ var Mn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3118
3147
|
onClick: T,
|
|
3119
3148
|
disabled: s || d,
|
|
3120
3149
|
title: u("detail.listFormat"),
|
|
3121
|
-
children: /* @__PURE__ */ Z(
|
|
3150
|
+
children: /* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" })
|
|
3122
3151
|
}),
|
|
3123
3152
|
/* @__PURE__ */ Z(y, {
|
|
3124
3153
|
variant: "ghost",
|
|
@@ -3127,7 +3156,7 @@ var Mn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3127
3156
|
onClick: E,
|
|
3128
3157
|
disabled: s || d,
|
|
3129
3158
|
title: u("detail.inlineCode"),
|
|
3130
|
-
children: /* @__PURE__ */ Z(
|
|
3159
|
+
children: /* @__PURE__ */ Z(xe, { className: "h-3.5 w-3.5" })
|
|
3131
3160
|
}),
|
|
3132
3161
|
/* @__PURE__ */ Z(y, {
|
|
3133
3162
|
variant: "ghost",
|
|
@@ -3136,7 +3165,7 @@ var Mn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3136
3165
|
onClick: D,
|
|
3137
3166
|
disabled: s || d,
|
|
3138
3167
|
title: u("detail.mentionSomeone"),
|
|
3139
|
-
children: /* @__PURE__ */ Z(
|
|
3168
|
+
children: /* @__PURE__ */ Z(K, { className: "h-3.5 w-3.5" })
|
|
3140
3169
|
}),
|
|
3141
3170
|
/* @__PURE__ */ Z("div", { className: "flex-1" }),
|
|
3142
3171
|
/* @__PURE__ */ Z(y, {
|
|
@@ -3145,7 +3174,7 @@ var Mn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3145
3174
|
className: "h-7 w-7",
|
|
3146
3175
|
onClick: () => f(!d),
|
|
3147
3176
|
title: u(d ? "detail.edit" : "detail.preview"),
|
|
3148
|
-
children: Z(d ?
|
|
3177
|
+
children: Z(d ? we : Ee, { className: "h-3.5 w-3.5" })
|
|
3149
3178
|
}),
|
|
3150
3179
|
r && /* @__PURE__ */ Z(y, {
|
|
3151
3180
|
variant: "ghost",
|
|
@@ -3162,8 +3191,8 @@ var Mn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3162
3191
|
className: "relative",
|
|
3163
3192
|
children: d ? /* @__PURE__ */ Z("div", {
|
|
3164
3193
|
className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
|
|
3165
|
-
dangerouslySetInnerHTML: { __html:
|
|
3166
|
-
}) : /* @__PURE__ */ Q(
|
|
3194
|
+
dangerouslySetInnerHTML: { __html: In(e) }
|
|
3195
|
+
}) : /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Z("textarea", {
|
|
3167
3196
|
ref: b,
|
|
3168
3197
|
className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
|
|
3169
3198
|
placeholder: a ?? u("detail.writeComment"),
|
|
@@ -3175,7 +3204,7 @@ var Mn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3175
3204
|
className: "absolute left-2 bottom-full mb-1 w-56 bg-popover border rounded-md shadow-md z-50 max-h-40 overflow-y-auto",
|
|
3176
3205
|
children: x.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
3177
3206
|
type: "button",
|
|
3178
|
-
className:
|
|
3207
|
+
className: W("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === _ && "bg-accent"),
|
|
3179
3208
|
onMouseDown: (t) => {
|
|
3180
3209
|
t.preventDefault(), O(e);
|
|
3181
3210
|
},
|
|
@@ -3199,16 +3228,16 @@ var Mn = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], plac
|
|
|
3199
3228
|
};
|
|
3200
3229
|
//#endregion
|
|
3201
3230
|
//#region src/CommentAttachment.tsx
|
|
3202
|
-
function
|
|
3231
|
+
function Rn(e) {
|
|
3203
3232
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
3204
3233
|
}
|
|
3205
|
-
function
|
|
3234
|
+
function zn(e) {
|
|
3206
3235
|
return e.startsWith("image/");
|
|
3207
3236
|
}
|
|
3208
|
-
function
|
|
3209
|
-
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;
|
|
3210
3239
|
}
|
|
3211
|
-
var
|
|
3240
|
+
var Vn = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a = !1 }) => {
|
|
3212
3241
|
let { t: o } = $(), [s, c] = n.useState(!1), l = n.useRef(null), u = n.useCallback((e) => {
|
|
3213
3242
|
e.preventDefault(), e.stopPropagation(), c(!0);
|
|
3214
3243
|
}, []), d = n.useCallback((e) => {
|
|
@@ -3219,9 +3248,9 @@ var In = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3219
3248
|
t && e.target.files && e.target.files.length > 0 && (t(e.target.files), e.target.value = "");
|
|
3220
3249
|
}, [t]);
|
|
3221
3250
|
return /* @__PURE__ */ Q("div", {
|
|
3222
|
-
className:
|
|
3251
|
+
className: W("space-y-2", i),
|
|
3223
3252
|
children: [t && !a && /* @__PURE__ */ Q("div", {
|
|
3224
|
-
className:
|
|
3253
|
+
className: W("border-2 border-dashed rounded-md px-4 py-3 text-center transition-colors cursor-pointer", s ? "border-primary bg-primary/5" : "border-muted-foreground/25 hover:border-muted-foreground/40"),
|
|
3225
3254
|
onDragOver: u,
|
|
3226
3255
|
onDragLeave: d,
|
|
3227
3256
|
onDrop: f,
|
|
@@ -3253,7 +3282,7 @@ var In = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3253
3282
|
}), /* @__PURE__ */ Z("div", {
|
|
3254
3283
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
|
|
3255
3284
|
children: e.map((e) => {
|
|
3256
|
-
let t =
|
|
3285
|
+
let t = zn(e.type), n = Bn(e.type);
|
|
3257
3286
|
return /* @__PURE__ */ Q("div", {
|
|
3258
3287
|
className: "flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group",
|
|
3259
3288
|
children: [
|
|
@@ -3272,7 +3301,7 @@ var In = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3272
3301
|
children: e.name
|
|
3273
3302
|
}), /* @__PURE__ */ Z("p", {
|
|
3274
3303
|
className: "text-[10px] text-muted-foreground",
|
|
3275
|
-
children:
|
|
3304
|
+
children: Rn(e.size)
|
|
3276
3305
|
})]
|
|
3277
3306
|
}),
|
|
3278
3307
|
r && !a && /* @__PURE__ */ Z(y, {
|
|
@@ -3289,15 +3318,15 @@ var In = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3289
3318
|
})]
|
|
3290
3319
|
})]
|
|
3291
3320
|
});
|
|
3292
|
-
},
|
|
3293
|
-
comment:
|
|
3294
|
-
field_change:
|
|
3295
|
-
task:
|
|
3296
|
-
event:
|
|
3321
|
+
}, Hn = {
|
|
3322
|
+
comment: X,
|
|
3323
|
+
field_change: we,
|
|
3324
|
+
task: he,
|
|
3325
|
+
event: pe,
|
|
3297
3326
|
system: tt,
|
|
3298
|
-
email:
|
|
3327
|
+
email: Le,
|
|
3299
3328
|
call: He
|
|
3300
|
-
},
|
|
3329
|
+
}, Un = {
|
|
3301
3330
|
comment: "bg-purple-100 text-purple-600",
|
|
3302
3331
|
field_change: "bg-blue-100 text-blue-600",
|
|
3303
3332
|
task: "bg-green-100 text-green-600",
|
|
@@ -3306,7 +3335,7 @@ var In = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a
|
|
|
3306
3335
|
email: "bg-indigo-100 text-indigo-600",
|
|
3307
3336
|
call: "bg-teal-100 text-teal-600"
|
|
3308
3337
|
};
|
|
3309
|
-
function
|
|
3338
|
+
function Wn(e) {
|
|
3310
3339
|
return [
|
|
3311
3340
|
{
|
|
3312
3341
|
value: "all",
|
|
@@ -3326,7 +3355,7 @@ function zn(e) {
|
|
|
3326
3355
|
}
|
|
3327
3356
|
];
|
|
3328
3357
|
}
|
|
3329
|
-
function
|
|
3358
|
+
function Gn(e, t) {
|
|
3330
3359
|
try {
|
|
3331
3360
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
3332
3361
|
if (i < 1) return t("detail.justNow");
|
|
@@ -3339,7 +3368,7 @@ function Bn(e, t) {
|
|
|
3339
3368
|
return e;
|
|
3340
3369
|
}
|
|
3341
3370
|
}
|
|
3342
|
-
function
|
|
3371
|
+
function Kn(e, t) {
|
|
3343
3372
|
switch (t) {
|
|
3344
3373
|
case "comments_only": return e.filter((e) => e.type === "comment");
|
|
3345
3374
|
case "changes_only": return e.filter((e) => e.type === "field_change");
|
|
@@ -3347,18 +3376,18 @@ function Vn(e, t) {
|
|
|
3347
3376
|
default: return e;
|
|
3348
3377
|
}
|
|
3349
3378
|
}
|
|
3350
|
-
var
|
|
3351
|
-
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,
|
|
3352
|
-
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();
|
|
3353
3382
|
let e = /* @__PURE__ */ new Map();
|
|
3354
|
-
for (let t of
|
|
3383
|
+
for (let t of V) if (t.parentId) {
|
|
3355
3384
|
let n = e.get(t.parentId) ?? [];
|
|
3356
3385
|
n.push(t), e.set(t.parentId, n);
|
|
3357
3386
|
}
|
|
3358
3387
|
return e;
|
|
3359
|
-
}, [
|
|
3388
|
+
}, [V, z]), U = n.useCallback((e) => {
|
|
3360
3389
|
i ? i(e) : S(e);
|
|
3361
|
-
}, [i]),
|
|
3390
|
+
}, [i]), ae = n.useCallback(async () => {
|
|
3362
3391
|
let e = C.trim();
|
|
3363
3392
|
if (c && !(!e && P.length === 0)) {
|
|
3364
3393
|
E(!0);
|
|
@@ -3372,7 +3401,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3372
3401
|
C,
|
|
3373
3402
|
P,
|
|
3374
3403
|
c
|
|
3375
|
-
]),
|
|
3404
|
+
]), G = n.useCallback(async (e) => {
|
|
3376
3405
|
if (!(!h || e.length === 0)) {
|
|
3377
3406
|
I(!0);
|
|
3378
3407
|
try {
|
|
@@ -3382,9 +3411,9 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3382
3411
|
I(!1);
|
|
3383
3412
|
}
|
|
3384
3413
|
}
|
|
3385
|
-
}, [h]),
|
|
3414
|
+
}, [h]), se = n.useCallback((e) => {
|
|
3386
3415
|
te((t) => t.filter((t) => t.id !== e));
|
|
3387
|
-
}, []),
|
|
3416
|
+
}, []), ce = n.useCallback(async () => {
|
|
3388
3417
|
if (o) {
|
|
3389
3418
|
k(!0);
|
|
3390
3419
|
try {
|
|
@@ -3395,7 +3424,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3395
3424
|
}
|
|
3396
3425
|
}, [o]);
|
|
3397
3426
|
return /* @__PURE__ */ Q("section", {
|
|
3398
|
-
className:
|
|
3427
|
+
className: W("border-t border-border/60 pt-5", v),
|
|
3399
3428
|
"aria-label": "Discussion",
|
|
3400
3429
|
children: [/* @__PURE__ */ Z("header", {
|
|
3401
3430
|
className: "mb-4",
|
|
@@ -3404,20 +3433,20 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3404
3433
|
children: [/* @__PURE__ */ Q("h2", {
|
|
3405
3434
|
className: "flex items-center gap-2 text-base font-semibold leading-none tracking-tight",
|
|
3406
3435
|
children: [
|
|
3407
|
-
/* @__PURE__ */ Z(
|
|
3436
|
+
/* @__PURE__ */ Z(oe, { className: "h-4 w-4" }),
|
|
3408
3437
|
g ?? b("detail.activity"),
|
|
3409
3438
|
/* @__PURE__ */ Q("span", {
|
|
3410
3439
|
className: "text-sm font-normal text-muted-foreground",
|
|
3411
3440
|
children: [
|
|
3412
3441
|
"(",
|
|
3413
|
-
|
|
3442
|
+
V.length,
|
|
3414
3443
|
")"
|
|
3415
3444
|
]
|
|
3416
3445
|
})
|
|
3417
3446
|
]
|
|
3418
3447
|
}), /* @__PURE__ */ Z("div", {
|
|
3419
3448
|
className: "flex items-center gap-1",
|
|
3420
|
-
children:
|
|
3449
|
+
children: B && d && /* @__PURE__ */ Z(Fn, {
|
|
3421
3450
|
subscription: d,
|
|
3422
3451
|
onToggle: f
|
|
3423
3452
|
})
|
|
@@ -3430,49 +3459,49 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3430
3459
|
className: "flex items-center gap-2",
|
|
3431
3460
|
children: /* @__PURE__ */ Q(A, {
|
|
3432
3461
|
value: L,
|
|
3433
|
-
onValueChange: (e) =>
|
|
3462
|
+
onValueChange: (e) => U(e),
|
|
3434
3463
|
children: [/* @__PURE__ */ Z(N, {
|
|
3435
3464
|
"aria-label": b("detail.filterActivity"),
|
|
3436
3465
|
className: "h-8 w-auto min-w-[140px] py-1 text-sm",
|
|
3437
3466
|
children: /* @__PURE__ */ Z(ee, {})
|
|
3438
|
-
}), /* @__PURE__ */ Z(j, { children:
|
|
3467
|
+
}), /* @__PURE__ */ Z(j, { children: Wn(b).map((e) => /* @__PURE__ */ Z(M, {
|
|
3439
3468
|
value: e.value,
|
|
3440
3469
|
children: e.label
|
|
3441
3470
|
}, e.value)) })]
|
|
3442
3471
|
})
|
|
3443
3472
|
}),
|
|
3444
|
-
|
|
3473
|
+
re && /* @__PURE__ */ Z(Ln, {
|
|
3445
3474
|
value: C,
|
|
3446
3475
|
onChange: w,
|
|
3447
|
-
onSubmit:
|
|
3476
|
+
onSubmit: ae,
|
|
3448
3477
|
mentionSuggestions: m,
|
|
3449
3478
|
placeholder: b("detail.leaveCommentPlaceholder"),
|
|
3450
3479
|
disabled: T,
|
|
3451
3480
|
canSubmitEmpty: P.length > 0,
|
|
3452
|
-
extraSlot: h ? /* @__PURE__ */ Z(
|
|
3481
|
+
extraSlot: h ? /* @__PURE__ */ Z(Vn, {
|
|
3453
3482
|
attachments: P,
|
|
3454
|
-
onUpload:
|
|
3455
|
-
onRemove:
|
|
3483
|
+
onUpload: G,
|
|
3484
|
+
onRemove: se,
|
|
3456
3485
|
readOnly: T || F
|
|
3457
|
-
}) : P.length > 0 ? /* @__PURE__ */ Z(
|
|
3486
|
+
}) : P.length > 0 ? /* @__PURE__ */ Z(Vn, {
|
|
3458
3487
|
attachments: P,
|
|
3459
|
-
onRemove:
|
|
3488
|
+
onRemove: se,
|
|
3460
3489
|
readOnly: T
|
|
3461
3490
|
}) : void 0
|
|
3462
3491
|
}),
|
|
3463
|
-
|
|
3492
|
+
V.length === 0 ? p ? null : /* @__PURE__ */ Z(D, {
|
|
3464
3493
|
title: _ ?? b("detail.noActivity"),
|
|
3465
3494
|
className: "py-6"
|
|
3466
3495
|
}) : /* @__PURE__ */ Q("div", {
|
|
3467
3496
|
className: "relative",
|
|
3468
3497
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
3469
3498
|
className: "space-y-4",
|
|
3470
|
-
children:
|
|
3471
|
-
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) ?? [];
|
|
3472
3501
|
return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
|
|
3473
3502
|
className: "flex gap-3 relative",
|
|
3474
3503
|
children: [/* @__PURE__ */ Z("div", {
|
|
3475
|
-
className:
|
|
3504
|
+
className: W("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", n),
|
|
3476
3505
|
children: e.actorAvatarUrl ? /* @__PURE__ */ Z("img", {
|
|
3477
3506
|
src: e.actorAvatarUrl,
|
|
3478
3507
|
alt: e.actor,
|
|
@@ -3494,7 +3523,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3494
3523
|
}),
|
|
3495
3524
|
/* @__PURE__ */ Z("span", {
|
|
3496
3525
|
className: "text-xs text-muted-foreground",
|
|
3497
|
-
children:
|
|
3526
|
+
children: Gn(e.createdAt, b)
|
|
3498
3527
|
}),
|
|
3499
3528
|
e.edited && /* @__PURE__ */ Z("span", {
|
|
3500
3529
|
className: "text-xs text-muted-foreground italic",
|
|
@@ -3521,25 +3550,25 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3521
3550
|
}),
|
|
3522
3551
|
e.type === "field_change" && e.fieldChanges && /* @__PURE__ */ Z("div", {
|
|
3523
3552
|
className: "space-y-1 mt-1",
|
|
3524
|
-
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(
|
|
3553
|
+
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(An, { change: e }, t))
|
|
3525
3554
|
}),
|
|
3526
|
-
|
|
3555
|
+
R && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
|
|
3527
3556
|
className: "mt-1.5",
|
|
3528
|
-
children: /* @__PURE__ */ Z(
|
|
3557
|
+
children: /* @__PURE__ */ Z(Mn, {
|
|
3529
3558
|
reactions: e.reactions,
|
|
3530
3559
|
onToggleReaction: u ? (t) => u(e.id, t) : void 0
|
|
3531
3560
|
})
|
|
3532
3561
|
}),
|
|
3533
|
-
|
|
3562
|
+
R && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
|
|
3534
3563
|
className: "mt-1.5",
|
|
3535
|
-
children: /* @__PURE__ */ Z(
|
|
3564
|
+
children: /* @__PURE__ */ Z(Mn, {
|
|
3536
3565
|
reactions: [],
|
|
3537
3566
|
onToggleReaction: (t) => u(e.id, t)
|
|
3538
3567
|
})
|
|
3539
3568
|
})
|
|
3540
3569
|
]
|
|
3541
3570
|
})]
|
|
3542
|
-
}),
|
|
3571
|
+
}), z && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(Pn, {
|
|
3543
3572
|
parentItem: e,
|
|
3544
3573
|
replies: r,
|
|
3545
3574
|
onAddReply: l,
|
|
@@ -3553,16 +3582,16 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3553
3582
|
children: /* @__PURE__ */ Q(y, {
|
|
3554
3583
|
variant: "ghost",
|
|
3555
3584
|
size: "sm",
|
|
3556
|
-
onClick:
|
|
3585
|
+
onClick: ce,
|
|
3557
3586
|
disabled: O,
|
|
3558
3587
|
"aria-label": b("detail.loadMore"),
|
|
3559
|
-
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")]
|
|
3560
3589
|
})
|
|
3561
3590
|
})
|
|
3562
3591
|
]
|
|
3563
3592
|
})]
|
|
3564
3593
|
});
|
|
3565
|
-
},
|
|
3594
|
+
}, Jn = (e) => {
|
|
3566
3595
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3567
3596
|
return {
|
|
3568
3597
|
designer: {
|
|
@@ -3572,21 +3601,21 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3572
3601
|
},
|
|
3573
3602
|
rest: i
|
|
3574
3603
|
};
|
|
3575
|
-
},
|
|
3604
|
+
}, Yn = ({ schema: e = {}, className: t, ...n }) => {
|
|
3576
3605
|
dt();
|
|
3577
|
-
let { designer: r } =
|
|
3606
|
+
let { designer: r } = Jn(n);
|
|
3578
3607
|
return /* @__PURE__ */ Z("div", {
|
|
3579
3608
|
className: t,
|
|
3580
3609
|
...r,
|
|
3581
|
-
children: /* @__PURE__ */ Z(
|
|
3610
|
+
children: /* @__PURE__ */ Z(qn, {
|
|
3582
3611
|
items: [],
|
|
3583
3612
|
config: e
|
|
3584
3613
|
})
|
|
3585
3614
|
});
|
|
3586
|
-
},
|
|
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 }) => {
|
|
3587
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);
|
|
3588
3617
|
return _ === "right" || _ === "left" ? C && b ? /* @__PURE__ */ Z("div", {
|
|
3589
|
-
className:
|
|
3618
|
+
className: W("flex items-start pt-4", _ === "right" ? "border-l" : "border-r", g),
|
|
3590
3619
|
children: /* @__PURE__ */ Z(y, {
|
|
3591
3620
|
variant: "ghost",
|
|
3592
3621
|
size: "icon",
|
|
@@ -3596,7 +3625,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3596
3625
|
children: /* @__PURE__ */ Z(Be, { className: "h-4 w-4" })
|
|
3597
3626
|
})
|
|
3598
3627
|
}) : /* @__PURE__ */ Q("div", {
|
|
3599
|
-
className:
|
|
3628
|
+
className: W("flex flex-col overflow-hidden", _ === "right" ? "border-l" : "border-r", g),
|
|
3600
3629
|
style: {
|
|
3601
3630
|
width: v,
|
|
3602
3631
|
minWidth: v
|
|
@@ -3605,7 +3634,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3605
3634
|
className: "flex items-center justify-between px-4 py-3 border-b",
|
|
3606
3635
|
children: [/* @__PURE__ */ Q("div", {
|
|
3607
3636
|
className: "flex items-center gap-2",
|
|
3608
|
-
children: [/* @__PURE__ */ Z(
|
|
3637
|
+
children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
3609
3638
|
className: "text-sm font-medium",
|
|
3610
3639
|
children: S("detail.discussion")
|
|
3611
3640
|
})]
|
|
@@ -3619,7 +3648,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3619
3648
|
})]
|
|
3620
3649
|
}), /* @__PURE__ */ Z("div", {
|
|
3621
3650
|
className: "flex-1 overflow-y-auto",
|
|
3622
|
-
children: /* @__PURE__ */ Z(
|
|
3651
|
+
children: /* @__PURE__ */ Z(qn, {
|
|
3623
3652
|
items: t,
|
|
3624
3653
|
config: e?.feed,
|
|
3625
3654
|
hasMore: r,
|
|
@@ -3641,18 +3670,18 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3641
3670
|
})
|
|
3642
3671
|
})]
|
|
3643
3672
|
}) : /* @__PURE__ */ Z("div", {
|
|
3644
|
-
className:
|
|
3673
|
+
className: W("", g),
|
|
3645
3674
|
children: b && C ? /* @__PURE__ */ Q(y, {
|
|
3646
3675
|
variant: "ghost",
|
|
3647
3676
|
className: "w-full justify-start gap-2 text-muted-foreground",
|
|
3648
3677
|
onClick: () => w(!1),
|
|
3649
3678
|
"aria-label": S("detail.showDiscussion", { count: t.length }),
|
|
3650
|
-
children: [/* @__PURE__ */ Z(
|
|
3679
|
+
children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: S("detail.showDiscussion", { count: t.length }) })]
|
|
3651
3680
|
}) : /* @__PURE__ */ Q("div", { children: [b && /* @__PURE__ */ Q("div", {
|
|
3652
3681
|
className: "flex items-center justify-between mb-2",
|
|
3653
3682
|
children: [/* @__PURE__ */ Q("div", {
|
|
3654
3683
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
3655
|
-
children: [/* @__PURE__ */ Z(
|
|
3684
|
+
children: [/* @__PURE__ */ Z(X, { className: "h-4 w-4" }), S("detail.discussion")]
|
|
3656
3685
|
}), /* @__PURE__ */ Z(y, {
|
|
3657
3686
|
variant: "ghost",
|
|
3658
3687
|
size: "icon",
|
|
@@ -3661,7 +3690,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3661
3690
|
"aria-label": S("detail.hideDiscussion"),
|
|
3662
3691
|
children: /* @__PURE__ */ Z(ze, { className: "h-3.5 w-3.5" })
|
|
3663
3692
|
})]
|
|
3664
|
-
}), /* @__PURE__ */ Z(
|
|
3693
|
+
}), /* @__PURE__ */ Z(qn, {
|
|
3665
3694
|
items: t,
|
|
3666
3695
|
config: e?.feed,
|
|
3667
3696
|
hasMore: r,
|
|
@@ -3681,7 +3710,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3681
3710
|
emptyLabel: S("detail.noCommentsYet")
|
|
3682
3711
|
})] })
|
|
3683
3712
|
});
|
|
3684
|
-
},
|
|
3713
|
+
}, Zn = (e) => {
|
|
3685
3714
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3686
3715
|
return {
|
|
3687
3716
|
designer: {
|
|
@@ -3691,9 +3720,9 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3691
3720
|
},
|
|
3692
3721
|
rest: i
|
|
3693
3722
|
};
|
|
3694
|
-
},
|
|
3723
|
+
}, Qn = ({ schema: e = {}, className: t, ...n }) => {
|
|
3695
3724
|
dt();
|
|
3696
|
-
let r = st(), { designer: i } =
|
|
3725
|
+
let r = st(), { designer: i } = Zn(n), a = {
|
|
3697
3726
|
position: "bottom",
|
|
3698
3727
|
collapsible: !1,
|
|
3699
3728
|
feed: {
|
|
@@ -3706,7 +3735,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3706
3735
|
return /* @__PURE__ */ Z("div", {
|
|
3707
3736
|
className: t,
|
|
3708
3737
|
...i,
|
|
3709
|
-
children: /* @__PURE__ */ Z(
|
|
3738
|
+
children: /* @__PURE__ */ Z(Xn, {
|
|
3710
3739
|
items: r?.items || [],
|
|
3711
3740
|
config: a,
|
|
3712
3741
|
onAddComment: r?.onAddComment,
|
|
@@ -3716,7 +3745,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3716
3745
|
onUploadAttachments: r?.onUploadAttachments
|
|
3717
3746
|
})
|
|
3718
3747
|
});
|
|
3719
|
-
},
|
|
3748
|
+
}, $n = (e) => {
|
|
3720
3749
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3721
3750
|
return {
|
|
3722
3751
|
designer: {
|
|
@@ -3726,8 +3755,8 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3726
3755
|
},
|
|
3727
3756
|
rest: i
|
|
3728
3757
|
};
|
|
3729
|
-
},
|
|
3730
|
-
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(() => {
|
|
3731
3760
|
if (s.length === 0 || !c || !i?.objectName) return s;
|
|
3732
3761
|
let e = a(i.objectName, c, s);
|
|
3733
3762
|
return Array.isArray(e) && e.length === s.length ? s.map((t, n) => ({
|
|
@@ -3757,7 +3786,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3757
3786
|
});
|
|
3758
3787
|
let b = h.length - 1;
|
|
3759
3788
|
return /* @__PURE__ */ Q("div", {
|
|
3760
|
-
className:
|
|
3789
|
+
className: W("w-full", t),
|
|
3761
3790
|
...o,
|
|
3762
3791
|
children: [/* @__PURE__ */ Q("div", {
|
|
3763
3792
|
className: "hidden sm:flex w-full items-stretch gap-2",
|
|
@@ -3770,7 +3799,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3770
3799
|
return /* @__PURE__ */ Z("div", {
|
|
3771
3800
|
role: "listitem",
|
|
3772
3801
|
"aria-current": r ? "step" : void 0,
|
|
3773
|
-
className:
|
|
3802
|
+
className: W("relative flex-1 min-w-0 px-4 py-2 text-xs font-medium text-center rounded-xl", r && "bg-primary text-primary-foreground shadow-sm", n && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200", !r && !n && i && "bg-emerald-500/10 text-emerald-700/85 dark:text-emerald-300/85", !r && !n && !i && "bg-muted text-muted-foreground"),
|
|
3774
3803
|
children: /* @__PURE__ */ Q("span", {
|
|
3775
3804
|
className: "inline-flex items-center justify-center gap-1.5 truncate",
|
|
3776
3805
|
children: [
|
|
@@ -3797,7 +3826,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3797
3826
|
return /* @__PURE__ */ Z("div", {
|
|
3798
3827
|
role: "listitem",
|
|
3799
3828
|
"aria-current": n ? "step" : void 0,
|
|
3800
|
-
className:
|
|
3829
|
+
className: W("shrink-0 px-3 py-2 text-xs font-medium rounded-md border whitespace-nowrap", n && "bg-destructive text-destructive-foreground border-destructive shadow-sm ring-1 ring-destructive/40", !n && "bg-destructive/5 text-destructive/85 border-destructive/20"),
|
|
3801
3830
|
children: /* @__PURE__ */ Q("span", {
|
|
3802
3831
|
className: "inline-flex items-center gap-1",
|
|
3803
3832
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -3818,7 +3847,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3818
3847
|
return /* @__PURE__ */ Z("div", {
|
|
3819
3848
|
role: "listitem",
|
|
3820
3849
|
"aria-current": i ? "step" : void 0,
|
|
3821
|
-
className:
|
|
3850
|
+
className: W("shrink-0 px-3 py-1.5 rounded-full text-xs font-medium border whitespace-nowrap", n && i && "bg-destructive text-destructive-foreground border-destructive shadow-sm", n && !i && "bg-destructive/5 text-destructive/85 border-destructive/20", !n && i && "bg-primary text-primary-foreground border-primary shadow-sm ring-1 ring-primary/40", !n && r && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200 border-emerald-500/30", !n && !i && !r && "bg-background text-foreground/85 border-border/60"),
|
|
3822
3851
|
children: /* @__PURE__ */ Q("span", {
|
|
3823
3852
|
className: "inline-flex items-center gap-1",
|
|
3824
3853
|
children: [
|
|
@@ -3839,7 +3868,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3839
3868
|
})
|
|
3840
3869
|
})]
|
|
3841
3870
|
});
|
|
3842
|
-
},
|
|
3871
|
+
}, tr = (e) => {
|
|
3843
3872
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3844
3873
|
return {
|
|
3845
3874
|
designer: {
|
|
@@ -3849,8 +3878,8 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3849
3878
|
},
|
|
3850
3879
|
rest: i
|
|
3851
3880
|
};
|
|
3852
|
-
},
|
|
3853
|
-
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 ? (() => {
|
|
3854
3883
|
let e = Array.isArray(d?.actions) ? d.actions : [], t = new Map(e.map((e) => [e.name, e]));
|
|
3855
3884
|
return l.map((e) => t.get(e)).filter((e) => !!e);
|
|
3856
3885
|
})() : Array.isArray(o) ? o : [], p = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [];
|
|
@@ -3882,11 +3911,11 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3882
3911
|
});
|
|
3883
3912
|
let v = e.align || "end", y = v === "start" ? "justify-start" : v === "center" ? "justify-center" : "justify-end";
|
|
3884
3913
|
return /* @__PURE__ */ Z("div", {
|
|
3885
|
-
className:
|
|
3914
|
+
className: W("flex flex-wrap items-center gap-2", m === "record_header" && !e.inline && "-mt-12 sm:-mt-14 mb-2 relative z-10", y, t),
|
|
3886
3915
|
role: "toolbar",
|
|
3887
3916
|
"aria-label": e.aria?.label || "Quick actions",
|
|
3888
3917
|
...i,
|
|
3889
|
-
children: _.map((t, n) => /* @__PURE__ */ Z(
|
|
3918
|
+
children: _.map((t, n) => /* @__PURE__ */ Z(rr, {
|
|
3890
3919
|
action: t,
|
|
3891
3920
|
record: r?.data,
|
|
3892
3921
|
variant: t.variant || e.variant || "default",
|
|
@@ -3898,7 +3927,7 @@ var Hn = ({ items: e, config: t, filterMode: r, onFilterChange: i, hasMore: a =
|
|
|
3898
3927
|
}, t.name || `qa-${n}`))
|
|
3899
3928
|
});
|
|
3900
3929
|
};
|
|
3901
|
-
function
|
|
3930
|
+
function rr({ action: e, record: t, variant: n, size: i, label: a, onRun: o }) {
|
|
3902
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);
|
|
3903
3932
|
return /* @__PURE__ */ Q(y, {
|
|
3904
3933
|
variant: n,
|
|
@@ -3912,12 +3941,12 @@ function Qn({ action: e, record: t, variant: n, size: i, label: a, onRun: o }) {
|
|
|
3912
3941
|
c(!1);
|
|
3913
3942
|
}
|
|
3914
3943
|
},
|
|
3915
|
-
children: [s && /* @__PURE__ */ Z(
|
|
3944
|
+
children: [s && /* @__PURE__ */ Z(Fe, { className: "mr-2 h-4 w-4 animate-spin" }), a]
|
|
3916
3945
|
});
|
|
3917
3946
|
}
|
|
3918
3947
|
//#endregion
|
|
3919
3948
|
//#region src/renderers/record-history.tsx
|
|
3920
|
-
var
|
|
3949
|
+
var ir = (e) => {
|
|
3921
3950
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3922
3951
|
return {
|
|
3923
3952
|
designer: {
|
|
@@ -3927,14 +3956,14 @@ var $n = (e) => {
|
|
|
3927
3956
|
},
|
|
3928
3957
|
rest: i
|
|
3929
3958
|
};
|
|
3930
|
-
},
|
|
3959
|
+
}, ar = new Set([
|
|
3931
3960
|
"created",
|
|
3932
3961
|
"updated",
|
|
3933
3962
|
"assigned",
|
|
3934
3963
|
"shared",
|
|
3935
3964
|
"deleted"
|
|
3936
|
-
]),
|
|
3937
|
-
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);
|
|
3938
3967
|
r.useEffect(() => {
|
|
3939
3968
|
if (!p) return;
|
|
3940
3969
|
let e = !1;
|
|
@@ -3946,7 +3975,7 @@ var $n = (e) => {
|
|
|
3946
3975
|
$orderby: { timestamp: "desc" },
|
|
3947
3976
|
$top: Math.max(1, l)
|
|
3948
3977
|
})).then((t) => {
|
|
3949
|
-
e || h((t?.data ?? t?.records ?? []).filter((e) =>
|
|
3978
|
+
e || h((t?.data ?? t?.records ?? []).filter((e) => ar.has(e?.type)).map((e) => {
|
|
3950
3979
|
let t = e.timestamp;
|
|
3951
3980
|
return (!t || t === "NOW()" || Number.isNaN(Date.parse(t))) && (t = e.created_at), {
|
|
3952
3981
|
id: e.id,
|
|
@@ -3975,13 +4004,13 @@ var $n = (e) => {
|
|
|
3975
4004
|
return /* @__PURE__ */ Z("div", {
|
|
3976
4005
|
className: t,
|
|
3977
4006
|
...i,
|
|
3978
|
-
children: /* @__PURE__ */ Z(
|
|
4007
|
+
children: /* @__PURE__ */ Z(sn, {
|
|
3979
4008
|
entries: v,
|
|
3980
4009
|
loading: y,
|
|
3981
4010
|
emptyText: c
|
|
3982
4011
|
})
|
|
3983
4012
|
});
|
|
3984
|
-
},
|
|
4013
|
+
}, sr = (e) => {
|
|
3985
4014
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3986
4015
|
return {
|
|
3987
4016
|
designer: {
|
|
@@ -3991,8 +4020,8 @@ var $n = (e) => {
|
|
|
3991
4020
|
},
|
|
3992
4021
|
rest: i
|
|
3993
4022
|
};
|
|
3994
|
-
},
|
|
3995
|
-
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);
|
|
3996
4025
|
r.useEffect(() => (_.current = !0, () => {
|
|
3997
4026
|
_.current = !1;
|
|
3998
4027
|
}), []);
|
|
@@ -4072,11 +4101,11 @@ var $n = (e) => {
|
|
|
4072
4101
|
return T && t && !t.loading && !t.error && t.total === 0;
|
|
4073
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({
|
|
4074
4103
|
name: e.objectName,
|
|
4075
|
-
label:
|
|
4076
|
-
}) :
|
|
4104
|
+
label: cr(e.objectName)
|
|
4105
|
+
}) : cr(e.objectName)));
|
|
4077
4106
|
return /* @__PURE__ */ Q("div", {
|
|
4078
4107
|
ref: m,
|
|
4079
|
-
className:
|
|
4108
|
+
className: W("flex flex-col gap-3", e.className, t),
|
|
4080
4109
|
...s,
|
|
4081
4110
|
children: [k.map((e) => {
|
|
4082
4111
|
let t = e.objectName, n = f[t] || {
|
|
@@ -4092,15 +4121,15 @@ var $n = (e) => {
|
|
|
4092
4121
|
className: "text-sm font-semibold tracking-tight truncate",
|
|
4093
4122
|
children: e.title || (a?.objectLabel ? a.objectLabel({
|
|
4094
4123
|
name: e.objectName,
|
|
4095
|
-
label:
|
|
4096
|
-
}) :
|
|
4124
|
+
label: cr(e.objectName)
|
|
4125
|
+
}) : cr(e.objectName))
|
|
4097
4126
|
}), /* @__PURE__ */ Q("div", {
|
|
4098
4127
|
className: "flex items-center gap-2 shrink-0",
|
|
4099
4128
|
children: [!n.loading && /* @__PURE__ */ Z(v, {
|
|
4100
4129
|
variant: "secondary",
|
|
4101
4130
|
className: "tabular-nums",
|
|
4102
4131
|
children: n.total
|
|
4103
|
-
}), c && u && /* @__PURE__ */ Z(
|
|
4132
|
+
}), c && u && /* @__PURE__ */ Z(Ot, {
|
|
4104
4133
|
to: `/apps/${c}/${e.objectName}?filter%5B${e.relationshipField}%5D=${encodeURIComponent(String(u))}`,
|
|
4105
4134
|
className: "text-[11px] font-medium text-muted-foreground hover:text-foreground transition-colors",
|
|
4106
4135
|
title: o("detail.viewAll", { defaultValue: "View all" }),
|
|
@@ -4122,16 +4151,16 @@ var $n = (e) => {
|
|
|
4122
4151
|
}) : /* @__PURE__ */ Z("ul", {
|
|
4123
4152
|
className: "divide-y",
|
|
4124
4153
|
children: n.items.map((t) => {
|
|
4125
|
-
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;
|
|
4126
4155
|
return /* @__PURE__ */ Z("li", {
|
|
4127
4156
|
className: "px-4 py-2",
|
|
4128
|
-
children: i ? /* @__PURE__ */ Q(
|
|
4157
|
+
children: i ? /* @__PURE__ */ Q(Ot, {
|
|
4129
4158
|
to: i,
|
|
4130
4159
|
className: "group flex items-center justify-between gap-2 text-xs hover:text-foreground text-muted-foreground transition-colors",
|
|
4131
4160
|
children: [/* @__PURE__ */ Z("span", {
|
|
4132
4161
|
className: "truncate",
|
|
4133
4162
|
children: r
|
|
4134
|
-
}), /* @__PURE__ */ Z(
|
|
4163
|
+
}), /* @__PURE__ */ Z(ve, { className: "h-3 w-3 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity" })]
|
|
4135
4164
|
}) : /* @__PURE__ */ Z("span", {
|
|
4136
4165
|
className: "block truncate text-xs text-muted-foreground",
|
|
4137
4166
|
children: r
|
|
@@ -4159,7 +4188,7 @@ var $n = (e) => {
|
|
|
4159
4188
|
})]
|
|
4160
4189
|
})]
|
|
4161
4190
|
});
|
|
4162
|
-
},
|
|
4191
|
+
}, dr = {
|
|
4163
4192
|
info: {
|
|
4164
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",
|
|
4165
4194
|
icon: "Info"
|
|
@@ -4177,20 +4206,20 @@ var $n = (e) => {
|
|
|
4177
4206
|
icon: "CheckCircle2"
|
|
4178
4207
|
}
|
|
4179
4208
|
};
|
|
4180
|
-
function
|
|
4209
|
+
function fr(e) {
|
|
4181
4210
|
let t = e?.properties ?? {};
|
|
4182
4211
|
return {
|
|
4183
4212
|
...e,
|
|
4184
4213
|
...t
|
|
4185
4214
|
};
|
|
4186
4215
|
}
|
|
4187
|
-
var
|
|
4188
|
-
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 = [
|
|
4189
4218
|
"info",
|
|
4190
4219
|
"warning",
|
|
4191
4220
|
"error",
|
|
4192
4221
|
"success"
|
|
4193
|
-
].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(() => {
|
|
4194
4223
|
if (!r.dismissible) return null;
|
|
4195
4224
|
let e = r.dismissKey || r.title || u;
|
|
4196
4225
|
return `os.record-alert:${c}:${l ?? "_"}:${e}`;
|
|
@@ -4219,7 +4248,7 @@ var cr = ({ schema: e = {}, className: t }) => {
|
|
|
4219
4248
|
}
|
|
4220
4249
|
});
|
|
4221
4250
|
return _ || !s || Object.keys(s).length === 0 || p !== void 0 && !h ? null : /* @__PURE__ */ Q(i, {
|
|
4222
|
-
className:
|
|
4251
|
+
className: W("relative pr-12", d.wrap, t),
|
|
4223
4252
|
role: u === "error" ? "alert" : "status",
|
|
4224
4253
|
"aria-live": u === "error" ? "assertive" : "polite",
|
|
4225
4254
|
children: [
|
|
@@ -4257,7 +4286,7 @@ var cr = ({ schema: e = {}, className: t }) => {
|
|
|
4257
4286
|
}) : null
|
|
4258
4287
|
]
|
|
4259
4288
|
});
|
|
4260
|
-
},
|
|
4289
|
+
}, mr = new Set([
|
|
4261
4290
|
"id",
|
|
4262
4291
|
"_id",
|
|
4263
4292
|
"__v",
|
|
@@ -4272,15 +4301,15 @@ var cr = ({ schema: e = {}, className: t }) => {
|
|
|
4272
4301
|
"owner_id",
|
|
4273
4302
|
"deleted_at",
|
|
4274
4303
|
"is_deleted"
|
|
4275
|
-
]),
|
|
4276
|
-
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 }) {
|
|
4277
4306
|
let { t: g } = $(), _ = `objectui.drawerWidth.${a}`, [v, y] = r.useState(() => {
|
|
4278
4307
|
if (typeof window > "u" || !m) return null;
|
|
4279
4308
|
try {
|
|
4280
4309
|
let e = window.localStorage.getItem(_);
|
|
4281
4310
|
if (e) {
|
|
4282
4311
|
let t = parseInt(e, 10);
|
|
4283
|
-
if (Number.isFinite(t) && t >=
|
|
4312
|
+
if (Number.isFinite(t) && t >= hr) return t;
|
|
4284
4313
|
}
|
|
4285
4314
|
} catch {}
|
|
4286
4315
|
return null;
|
|
@@ -4302,7 +4331,7 @@ function fr({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
4302
4331
|
let n = (e) => {
|
|
4303
4332
|
let t = S.current;
|
|
4304
4333
|
if (!t) return;
|
|
4305
|
-
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));
|
|
4306
4335
|
y(Math.round(i));
|
|
4307
4336
|
}, r = () => {
|
|
4308
4337
|
S.current, S.current = null, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r);
|
|
@@ -4358,7 +4387,7 @@ function fr({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
4358
4387
|
}),
|
|
4359
4388
|
/* @__PURE__ */ Z("div", {
|
|
4360
4389
|
className: "px-6 pt-6 pb-6",
|
|
4361
|
-
children: /* @__PURE__ */ Z(
|
|
4390
|
+
children: /* @__PURE__ */ Z(_n, {
|
|
4362
4391
|
dataSource: s,
|
|
4363
4392
|
inlineEdit: !0,
|
|
4364
4393
|
schema: {
|
|
@@ -4401,14 +4430,14 @@ function fr({ open: e, onClose: t, title: n, record: i, objectName: a, recordId:
|
|
|
4401
4430
|
})
|
|
4402
4431
|
});
|
|
4403
4432
|
}
|
|
4404
|
-
function
|
|
4433
|
+
function vr(e, t) {
|
|
4405
4434
|
if (typeof window > "u") return null;
|
|
4406
4435
|
let n = window.location.pathname, r = `/${e}`, i = n.indexOf(r);
|
|
4407
4436
|
return `${i >= 0 ? n.slice(0, i) : n.replace(/\/$/, "")}/${e}/record/${encodeURIComponent(String(t))}`;
|
|
4408
4437
|
}
|
|
4409
4438
|
//#endregion
|
|
4410
4439
|
//#region src/InlineCreateRelated.tsx
|
|
4411
|
-
var
|
|
4440
|
+
var yr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
|
|
4412
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(() => {
|
|
4413
4442
|
if (!h.trim()) return _;
|
|
4414
4443
|
let e = h.toLowerCase();
|
|
@@ -4454,7 +4483,7 @@ var mr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
4454
4483
|
}
|
|
4455
4484
|
}, [a]), ee = n.useMemo(() => r.filter((e) => e.required).every((e) => p[e.name]?.toString().trim()), [r, p]);
|
|
4456
4485
|
return l ? /* @__PURE__ */ Q(b, {
|
|
4457
|
-
className:
|
|
4486
|
+
className: W("", c),
|
|
4458
4487
|
children: [/* @__PURE__ */ Z(S, {
|
|
4459
4488
|
className: "pb-3",
|
|
4460
4489
|
children: /* @__PURE__ */ Q(C, {
|
|
@@ -4475,19 +4504,19 @@ var mr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
4475
4504
|
value: d,
|
|
4476
4505
|
onValueChange: f,
|
|
4477
4506
|
children: [
|
|
4478
|
-
/* @__PURE__ */ Q(
|
|
4507
|
+
/* @__PURE__ */ Q(R, {
|
|
4479
4508
|
className: "mb-3 w-full",
|
|
4480
|
-
children: [i && /* @__PURE__ */ Q(
|
|
4509
|
+
children: [i && /* @__PURE__ */ Q(z, {
|
|
4481
4510
|
value: "create",
|
|
4482
4511
|
className: "flex-1 gap-1.5",
|
|
4483
4512
|
children: [/* @__PURE__ */ Z(We, { className: "h-3.5 w-3.5" }), "Create New"]
|
|
4484
|
-
}), a && /* @__PURE__ */ Q(
|
|
4513
|
+
}), a && /* @__PURE__ */ Q(z, {
|
|
4485
4514
|
value: "link",
|
|
4486
4515
|
className: "flex-1 gap-1.5",
|
|
4487
|
-
children: [/* @__PURE__ */ Z(
|
|
4516
|
+
children: [/* @__PURE__ */ Z(Ne, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
4488
4517
|
})]
|
|
4489
4518
|
}),
|
|
4490
|
-
i && /* @__PURE__ */ Q(
|
|
4519
|
+
i && /* @__PURE__ */ Q(re, {
|
|
4491
4520
|
value: "create",
|
|
4492
4521
|
className: "space-y-3 mt-0",
|
|
4493
4522
|
children: [r.map((e) => /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("label", {
|
|
@@ -4514,11 +4543,11 @@ var mr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
4514
4543
|
onClick: M,
|
|
4515
4544
|
disabled: !ee || w,
|
|
4516
4545
|
className: "gap-1.5",
|
|
4517
|
-
children: [w && /* @__PURE__ */ Z(
|
|
4546
|
+
children: [w && /* @__PURE__ */ Z(Fe, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
|
|
4518
4547
|
})]
|
|
4519
4548
|
})]
|
|
4520
4549
|
}),
|
|
4521
|
-
a && /* @__PURE__ */ Q(
|
|
4550
|
+
a && /* @__PURE__ */ Q(re, {
|
|
4522
4551
|
value: "link",
|
|
4523
4552
|
className: "space-y-3 mt-0",
|
|
4524
4553
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -4533,7 +4562,7 @@ var mr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
4533
4562
|
className: "max-h-48 overflow-y-auto space-y-1",
|
|
4534
4563
|
children: E ? /* @__PURE__ */ Q("div", {
|
|
4535
4564
|
className: "flex items-center justify-center py-4 text-sm text-muted-foreground",
|
|
4536
|
-
children: [/* @__PURE__ */ Z(
|
|
4565
|
+
children: [/* @__PURE__ */ Z(Fe, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
|
|
4537
4566
|
}) : k.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
4538
4567
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
4539
4568
|
children: h ? "No records found" : "Type to search records"
|
|
@@ -4555,7 +4584,7 @@ var mr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
4555
4584
|
]
|
|
4556
4585
|
}) })]
|
|
4557
4586
|
}) : /* @__PURE__ */ Q("div", {
|
|
4558
|
-
className:
|
|
4587
|
+
className: W("flex gap-2", c),
|
|
4559
4588
|
children: [i && /* @__PURE__ */ Q(y, {
|
|
4560
4589
|
variant: "outline",
|
|
4561
4590
|
size: "sm",
|
|
@@ -4575,13 +4604,13 @@ var mr = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, o
|
|
|
4575
4604
|
f("link"), u(!0);
|
|
4576
4605
|
},
|
|
4577
4606
|
className: "gap-1.5",
|
|
4578
|
-
children: [/* @__PURE__ */ Z(
|
|
4607
|
+
children: [/* @__PURE__ */ Z(Ne, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
4579
4608
|
})]
|
|
4580
4609
|
});
|
|
4581
4610
|
};
|
|
4582
4611
|
//#endregion
|
|
4583
4612
|
//#region src/DiffView.tsx
|
|
4584
|
-
function
|
|
4613
|
+
function br(e, t) {
|
|
4585
4614
|
if (e == null) return ["(empty)"];
|
|
4586
4615
|
switch (t) {
|
|
4587
4616
|
case "json": try {
|
|
@@ -4600,7 +4629,7 @@ function hr(e, t) {
|
|
|
4600
4629
|
default: return String(e).split("\n");
|
|
4601
4630
|
}
|
|
4602
4631
|
}
|
|
4603
|
-
function
|
|
4632
|
+
function xr(e, t) {
|
|
4604
4633
|
let n = [], r = Math.max(e.length, t.length);
|
|
4605
4634
|
for (let i = 0; i < r; i++) {
|
|
4606
4635
|
let r = i < e.length ? e[i] : void 0, a = i < t.length ? t[i] : void 0;
|
|
@@ -4617,16 +4646,16 @@ function gr(e, t) {
|
|
|
4617
4646
|
}
|
|
4618
4647
|
return n;
|
|
4619
4648
|
}
|
|
4620
|
-
var
|
|
4649
|
+
var Sr = {
|
|
4621
4650
|
added: "bg-green-50 text-green-800 dark:bg-green-950/30 dark:text-green-300",
|
|
4622
4651
|
removed: "bg-red-50 text-red-800 dark:bg-red-950/30 dark:text-red-300",
|
|
4623
4652
|
unchanged: "text-muted-foreground"
|
|
4624
|
-
},
|
|
4653
|
+
}, Cr = {
|
|
4625
4654
|
added: "+",
|
|
4626
4655
|
removed: "-",
|
|
4627
4656
|
unchanged: " "
|
|
4628
|
-
},
|
|
4629
|
-
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(() => {
|
|
4630
4659
|
if (c !== "side-by-side") return [];
|
|
4631
4660
|
let e = [], t = 0;
|
|
4632
4661
|
for (; t < f.length;) {
|
|
@@ -4652,7 +4681,7 @@ var _r = {
|
|
|
4652
4681
|
return e;
|
|
4653
4682
|
}, [c, f]);
|
|
4654
4683
|
return /* @__PURE__ */ Q(b, {
|
|
4655
|
-
className:
|
|
4684
|
+
className: W("overflow-hidden", o),
|
|
4656
4685
|
children: [/* @__PURE__ */ Z(S, {
|
|
4657
4686
|
className: "pb-2",
|
|
4658
4687
|
children: /* @__PURE__ */ Q(C, {
|
|
@@ -4675,7 +4704,7 @@ var _r = {
|
|
|
4675
4704
|
className: "h-7 w-7",
|
|
4676
4705
|
onClick: () => l("side-by-side"),
|
|
4677
4706
|
title: s("detail.sideBySideDiff"),
|
|
4678
|
-
children: /* @__PURE__ */ Z(
|
|
4707
|
+
children: /* @__PURE__ */ Z(Se, { className: "h-3.5 w-3.5" })
|
|
4679
4708
|
})]
|
|
4680
4709
|
})]
|
|
4681
4710
|
})
|
|
@@ -4684,10 +4713,10 @@ var _r = {
|
|
|
4684
4713
|
children: p ? c === "unified" ? /* @__PURE__ */ Z("div", {
|
|
4685
4714
|
className: "font-mono text-xs overflow-x-auto",
|
|
4686
4715
|
children: f.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
4687
|
-
className:
|
|
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"),
|
|
4688
4717
|
children: [/* @__PURE__ */ Z("span", {
|
|
4689
4718
|
className: "select-none mr-2 inline-block w-3 text-center opacity-60",
|
|
4690
|
-
children:
|
|
4719
|
+
children: Cr[e.type]
|
|
4691
4720
|
}), e.value]
|
|
4692
4721
|
}, t))
|
|
4693
4722
|
}) : /* @__PURE__ */ Z("div", {
|
|
@@ -4704,10 +4733,10 @@ var _r = {
|
|
|
4704
4733
|
children: s("detail.currentVersion")
|
|
4705
4734
|
}),
|
|
4706
4735
|
m.map((e, t) => /* @__PURE__ */ Q(n.Fragment, { children: [/* @__PURE__ */ Z("div", {
|
|
4707
|
-
className:
|
|
4736
|
+
className: W("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? Sr[e.left.type] : "bg-muted/20"),
|
|
4708
4737
|
children: e.left?.value ?? ""
|
|
4709
4738
|
}), /* @__PURE__ */ Z("div", {
|
|
4710
|
-
className:
|
|
4739
|
+
className: W("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? Sr[e.right.type] : "bg-muted/20"),
|
|
4711
4740
|
children: e.right?.value ?? ""
|
|
4712
4741
|
})] }, t))
|
|
4713
4742
|
]
|
|
@@ -4718,7 +4747,7 @@ var _r = {
|
|
|
4718
4747
|
})
|
|
4719
4748
|
})]
|
|
4720
4749
|
});
|
|
4721
|
-
},
|
|
4750
|
+
}, Tr = ({ currentIndex: e, totalRecords: t, recordIds: r, onNavigate: i, onSearch: a, className: o }) => {
|
|
4722
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(() => {
|
|
4723
4752
|
p && i(r[0]);
|
|
4724
4753
|
}, [
|
|
@@ -4786,7 +4815,7 @@ var _r = {
|
|
|
4786
4815
|
i,
|
|
4787
4816
|
a
|
|
4788
4817
|
]), /* @__PURE__ */ Q("div", {
|
|
4789
|
-
className:
|
|
4818
|
+
className: W("flex items-center gap-1.5", o),
|
|
4790
4819
|
children: [
|
|
4791
4820
|
/* @__PURE__ */ Z(y, {
|
|
4792
4821
|
variant: "outline",
|
|
@@ -4795,7 +4824,7 @@ var _r = {
|
|
|
4795
4824
|
disabled: !p,
|
|
4796
4825
|
onClick: _,
|
|
4797
4826
|
title: s("detail.firstRecord"),
|
|
4798
|
-
children: /* @__PURE__ */ Z(
|
|
4827
|
+
children: /* @__PURE__ */ Z(ye, { className: "h-4 w-4" })
|
|
4799
4828
|
}),
|
|
4800
4829
|
/* @__PURE__ */ Z(y, {
|
|
4801
4830
|
variant: "outline",
|
|
@@ -4804,7 +4833,7 @@ var _r = {
|
|
|
4804
4833
|
disabled: !m,
|
|
4805
4834
|
onClick: v,
|
|
4806
4835
|
title: s("detail.previousRecordKey"),
|
|
4807
|
-
children: /* @__PURE__ */ Z(
|
|
4836
|
+
children: /* @__PURE__ */ Z(_e, { className: "h-4 w-4" })
|
|
4808
4837
|
}),
|
|
4809
4838
|
/* @__PURE__ */ Z("span", {
|
|
4810
4839
|
className: "text-xs text-muted-foreground whitespace-nowrap px-1.5 tabular-nums",
|
|
@@ -4820,7 +4849,7 @@ var _r = {
|
|
|
4820
4849
|
disabled: !h,
|
|
4821
4850
|
onClick: b,
|
|
4822
4851
|
title: s("detail.nextRecordKey"),
|
|
4823
|
-
children: /* @__PURE__ */ Z(
|
|
4852
|
+
children: /* @__PURE__ */ Z(ve, { className: "h-4 w-4" })
|
|
4824
4853
|
}),
|
|
4825
4854
|
/* @__PURE__ */ Z(y, {
|
|
4826
4855
|
variant: "outline",
|
|
@@ -4829,9 +4858,9 @@ var _r = {
|
|
|
4829
4858
|
disabled: !g,
|
|
4830
4859
|
onClick: x,
|
|
4831
4860
|
title: s("detail.lastRecord"),
|
|
4832
|
-
children: /* @__PURE__ */ Z(
|
|
4861
|
+
children: /* @__PURE__ */ Z(be, { className: "h-4 w-4" })
|
|
4833
4862
|
}),
|
|
4834
|
-
a && /* @__PURE__ */ Q(
|
|
4863
|
+
a && /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Z(y, {
|
|
4835
4864
|
variant: u ? "secondary" : "ghost",
|
|
4836
4865
|
size: "icon",
|
|
4837
4866
|
className: "h-8 w-8",
|
|
@@ -4851,18 +4880,18 @@ var _r = {
|
|
|
4851
4880
|
})] })
|
|
4852
4881
|
]
|
|
4853
4882
|
});
|
|
4854
|
-
},
|
|
4883
|
+
}, Er = 28, Dr = [
|
|
4855
4884
|
"fill-primary stroke-primary",
|
|
4856
4885
|
"fill-blue-500 stroke-blue-500",
|
|
4857
4886
|
"fill-emerald-500 stroke-emerald-500",
|
|
4858
4887
|
"fill-amber-500 stroke-amber-500"
|
|
4859
|
-
],
|
|
4888
|
+
], Or = [
|
|
4860
4889
|
"fill-primary-foreground",
|
|
4861
4890
|
"fill-white",
|
|
4862
4891
|
"fill-white",
|
|
4863
4892
|
"fill-white"
|
|
4864
4893
|
];
|
|
4865
|
-
function
|
|
4894
|
+
function kr(e, t, n, r, i) {
|
|
4866
4895
|
let a = [], o = [], s = /* @__PURE__ */ new Set(), c = r / 2, l = i / 2;
|
|
4867
4896
|
a.push({
|
|
4868
4897
|
id: e.id,
|
|
@@ -4926,10 +4955,10 @@ function wr(e, t, n, r, i) {
|
|
|
4926
4955
|
edges: o
|
|
4927
4956
|
};
|
|
4928
4957
|
}
|
|
4929
|
-
function
|
|
4958
|
+
function Ar(e, t = 6) {
|
|
4930
4959
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
4931
4960
|
}
|
|
4932
|
-
var
|
|
4961
|
+
var jr = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, className: a }) => {
|
|
4933
4962
|
let o = n.useRef(null), [s, c] = n.useState({
|
|
4934
4963
|
width: 500,
|
|
4935
4964
|
height: 400
|
|
@@ -4950,14 +4979,14 @@ var Er = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
4950
4979
|
});
|
|
4951
4980
|
return n.observe(t), () => n.disconnect();
|
|
4952
4981
|
}, []);
|
|
4953
|
-
let { nodes: d, edges: f } = n.useMemo(() =>
|
|
4982
|
+
let { nodes: d, edges: f } = n.useMemo(() => kr(e, t, r, s.width, s.height), [
|
|
4954
4983
|
e,
|
|
4955
4984
|
t,
|
|
4956
4985
|
r,
|
|
4957
4986
|
s
|
|
4958
4987
|
]);
|
|
4959
4988
|
return /* @__PURE__ */ Q(b, {
|
|
4960
|
-
className:
|
|
4989
|
+
className: W("overflow-hidden", a),
|
|
4961
4990
|
children: [/* @__PURE__ */ Z(S, {
|
|
4962
4991
|
className: "pb-2",
|
|
4963
4992
|
children: /* @__PURE__ */ Q(C, {
|
|
@@ -4992,9 +5021,9 @@ var Er = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
4992
5021
|
strokeWidth: 1.5,
|
|
4993
5022
|
strokeOpacity: .5
|
|
4994
5023
|
}, `edge-${t}`)), d.map((e) => {
|
|
4995
|
-
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;
|
|
4996
5025
|
return /* @__PURE__ */ Q("g", {
|
|
4997
|
-
className:
|
|
5026
|
+
className: W("cursor-pointer transition-transform", i && "hover:opacity-80"),
|
|
4998
5027
|
onClick: () => i?.(e.id),
|
|
4999
5028
|
onMouseEnter: () => u(e.id),
|
|
5000
5029
|
onMouseLeave: () => u(null),
|
|
@@ -5013,8 +5042,8 @@ var Er = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
5013
5042
|
y: e.y,
|
|
5014
5043
|
textAnchor: "middle",
|
|
5015
5044
|
dominantBaseline: "central",
|
|
5016
|
-
className:
|
|
5017
|
-
children:
|
|
5045
|
+
className: W("text-[10px] font-medium pointer-events-none", r),
|
|
5046
|
+
children: Ar(e.label)
|
|
5018
5047
|
}),
|
|
5019
5048
|
e.type && /* @__PURE__ */ Z("text", {
|
|
5020
5049
|
x: e.x,
|
|
@@ -5023,7 +5052,7 @@ var Er = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
5023
5052
|
className: "fill-muted-foreground text-[9px] pointer-events-none",
|
|
5024
5053
|
children: e.type
|
|
5025
5054
|
}),
|
|
5026
|
-
t && /* @__PURE__ */ Q(
|
|
5055
|
+
t && /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Z("rect", {
|
|
5027
5056
|
x: e.x - 50,
|
|
5028
5057
|
y: e.y - a - 28,
|
|
5029
5058
|
width: 100,
|
|
@@ -5048,7 +5077,7 @@ var Er = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
5048
5077
|
};
|
|
5049
5078
|
//#endregion
|
|
5050
5079
|
//#region src/PointInTimeRestore.tsx
|
|
5051
|
-
function
|
|
5080
|
+
function Mr(e) {
|
|
5052
5081
|
try {
|
|
5053
5082
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
5054
5083
|
if (r < 1) return "just now";
|
|
@@ -5059,7 +5088,7 @@ function Dr(e) {
|
|
|
5059
5088
|
return e;
|
|
5060
5089
|
}
|
|
5061
5090
|
}
|
|
5062
|
-
var
|
|
5091
|
+
var Nr = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
5063
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 () => {
|
|
5064
5093
|
if (!(!d || !r)) {
|
|
5065
5094
|
if (!s) {
|
|
@@ -5082,13 +5111,13 @@ var Or = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5082
5111
|
c(!1);
|
|
5083
5112
|
}, []);
|
|
5084
5113
|
return /* @__PURE__ */ Q(b, {
|
|
5085
|
-
className:
|
|
5114
|
+
className: W("", i),
|
|
5086
5115
|
children: [/* @__PURE__ */ Z(S, {
|
|
5087
5116
|
className: "pb-3",
|
|
5088
5117
|
children: /* @__PURE__ */ Q(C, {
|
|
5089
5118
|
className: "flex items-center gap-2 text-base",
|
|
5090
5119
|
children: [
|
|
5091
|
-
/* @__PURE__ */ Z(
|
|
5120
|
+
/* @__PURE__ */ Z(Y, { className: "h-4 w-4" }),
|
|
5092
5121
|
"Revision History",
|
|
5093
5122
|
/* @__PURE__ */ Q("span", {
|
|
5094
5123
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -5115,13 +5144,13 @@ var Or = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5115
5144
|
let t = e.id === a;
|
|
5116
5145
|
return /* @__PURE__ */ Q("button", {
|
|
5117
5146
|
type: "button",
|
|
5118
|
-
className:
|
|
5147
|
+
className: W("w-full text-left flex items-start gap-3 py-2 px-2 rounded-md transition-colors relative", t ? "bg-accent" : "hover:bg-accent/50"),
|
|
5119
5148
|
onClick: () => {
|
|
5120
5149
|
o(e.id), c(!1);
|
|
5121
5150
|
},
|
|
5122
5151
|
children: [/* @__PURE__ */ Z("div", {
|
|
5123
|
-
className:
|
|
5124
|
-
children: t && /* @__PURE__ */ Z(
|
|
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"),
|
|
5153
|
+
children: t && /* @__PURE__ */ Z(ve, { className: "h-3 w-3 text-primary-foreground" })
|
|
5125
5154
|
}), /* @__PURE__ */ Q("div", {
|
|
5126
5155
|
className: "flex-1 min-w-0",
|
|
5127
5156
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -5131,7 +5160,7 @@ var Or = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5131
5160
|
children: e.user
|
|
5132
5161
|
}), /* @__PURE__ */ Z("span", {
|
|
5133
5162
|
className: "text-xs text-muted-foreground",
|
|
5134
|
-
children:
|
|
5163
|
+
children: Mr(e.timestamp)
|
|
5135
5164
|
})]
|
|
5136
5165
|
}), /* @__PURE__ */ Q("p", {
|
|
5137
5166
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
@@ -5153,7 +5182,7 @@ var Or = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5153
5182
|
children: [
|
|
5154
5183
|
/* @__PURE__ */ Q("div", {
|
|
5155
5184
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
5156
|
-
children: [/* @__PURE__ */ Z(
|
|
5185
|
+
children: [/* @__PURE__ */ Z(Ee, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
|
|
5157
5186
|
}),
|
|
5158
5187
|
/* @__PURE__ */ Z("div", {
|
|
5159
5188
|
className: "space-y-2",
|
|
@@ -5169,7 +5198,7 @@ var Or = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5169
5198
|
className: "line-through text-red-600 dark:text-red-400 truncate max-w-[120px]",
|
|
5170
5199
|
children: e.oldValue == null ? "(empty)" : String(e.oldValue)
|
|
5171
5200
|
}),
|
|
5172
|
-
/* @__PURE__ */ Z(
|
|
5201
|
+
/* @__PURE__ */ Z(ve, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
5173
5202
|
/* @__PURE__ */ Z("span", {
|
|
5174
5203
|
className: "text-green-600 dark:text-green-400 truncate max-w-[120px]",
|
|
5175
5204
|
children: e.newValue == null ? "(empty)" : String(e.newValue)
|
|
@@ -5199,12 +5228,12 @@ var Or = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5199
5228
|
}),
|
|
5200
5229
|
r && /* @__PURE__ */ Z("div", {
|
|
5201
5230
|
className: "pt-1 space-y-2",
|
|
5202
|
-
children: s ? /* @__PURE__ */ Q(
|
|
5231
|
+
children: s ? /* @__PURE__ */ Q(Ct, { children: [/* @__PURE__ */ Q("p", {
|
|
5203
5232
|
className: "text-xs text-amber-600 dark:text-amber-400",
|
|
5204
5233
|
children: [
|
|
5205
5234
|
"This will restore the record to its state at",
|
|
5206
5235
|
" ",
|
|
5207
|
-
|
|
5236
|
+
Mr(d.timestamp),
|
|
5208
5237
|
". Continue?"
|
|
5209
5238
|
]
|
|
5210
5239
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -5235,7 +5264,7 @@ var Or = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5235
5264
|
})]
|
|
5236
5265
|
}) })]
|
|
5237
5266
|
});
|
|
5238
|
-
},
|
|
5267
|
+
}, Pr = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: r = !1, className: i }) => {
|
|
5239
5268
|
let [a, o] = n.useState(""), [s, c] = n.useState(!1), l = n.useCallback(async () => {
|
|
5240
5269
|
let t = a.trim();
|
|
5241
5270
|
if (t) {
|
|
@@ -5250,7 +5279,7 @@ var Or = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5250
5279
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), l());
|
|
5251
5280
|
}, [l]);
|
|
5252
5281
|
return /* @__PURE__ */ Q("div", {
|
|
5253
|
-
className:
|
|
5282
|
+
className: W("flex gap-2", i),
|
|
5254
5283
|
children: [/* @__PURE__ */ Z("textarea", {
|
|
5255
5284
|
className: "flex-1 min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-none",
|
|
5256
5285
|
placeholder: t,
|
|
@@ -5268,21 +5297,21 @@ var Or = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5268
5297
|
children: /* @__PURE__ */ Z(Ye, { className: "h-4 w-4" })
|
|
5269
5298
|
})]
|
|
5270
5299
|
});
|
|
5271
|
-
},
|
|
5300
|
+
}, Fr = ({ query: e, suggestions: t, onSelect: r, visible: i = !0, activeIndex: a = 0, className: o }) => {
|
|
5272
5301
|
let s = n.useMemo(() => {
|
|
5273
5302
|
if (!e) return t;
|
|
5274
5303
|
let n = e.toLowerCase();
|
|
5275
5304
|
return t.filter((e) => e.name.toLowerCase().includes(n) || e.id.toLowerCase().includes(n));
|
|
5276
5305
|
}, [e, t]);
|
|
5277
5306
|
return !i || s.length === 0 ? null : /* @__PURE__ */ Z("div", {
|
|
5278
|
-
className:
|
|
5307
|
+
className: W("bg-popover border rounded-md shadow-md z-50 max-h-48 overflow-y-auto w-56", o),
|
|
5279
5308
|
role: "listbox",
|
|
5280
5309
|
"aria-label": "Mention suggestions",
|
|
5281
5310
|
children: s.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
5282
5311
|
type: "button",
|
|
5283
5312
|
role: "option",
|
|
5284
5313
|
"aria-selected": t === a,
|
|
5285
|
-
className:
|
|
5314
|
+
className: W("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === a && "bg-accent"),
|
|
5286
5315
|
onMouseDown: (t) => {
|
|
5287
5316
|
t.preventDefault(), r(e);
|
|
5288
5317
|
},
|
|
@@ -5310,7 +5339,7 @@ var Or = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
|
5310
5339
|
}, e.id))
|
|
5311
5340
|
});
|
|
5312
5341
|
};
|
|
5313
|
-
function
|
|
5342
|
+
function Ir(e, t, n) {
|
|
5314
5343
|
return {
|
|
5315
5344
|
type: e.type,
|
|
5316
5345
|
id: e.id,
|
|
@@ -5321,7 +5350,7 @@ function jr(e, t, n) {
|
|
|
5321
5350
|
}
|
|
5322
5351
|
//#endregion
|
|
5323
5352
|
//#region src/extractMentions.ts
|
|
5324
|
-
function
|
|
5353
|
+
function Lr(e, t) {
|
|
5325
5354
|
if (!e || !t.length) return [];
|
|
5326
5355
|
let n = [...t].sort((e, t) => t.label.length - e.label.length), r = e, i = /* @__PURE__ */ new Set();
|
|
5327
5356
|
for (let e of n) {
|
|
@@ -5333,10 +5362,10 @@ function Mr(e, t) {
|
|
|
5333
5362
|
}
|
|
5334
5363
|
//#endregion
|
|
5335
5364
|
//#region src/synth/buildDefaultPageSchema.ts
|
|
5336
|
-
function
|
|
5365
|
+
function Rr(e) {
|
|
5337
5366
|
return e == null ? [] : Array.isArray(e) ? e.filter((e) => e != null) : [e];
|
|
5338
5367
|
}
|
|
5339
|
-
function
|
|
5368
|
+
function zr(e) {
|
|
5340
5369
|
if (!e) return null;
|
|
5341
5370
|
if (e.stageField) return e.stageField;
|
|
5342
5371
|
let t = e.fields || {};
|
|
@@ -5352,7 +5381,7 @@ function Pr(e) {
|
|
|
5352
5381
|
}
|
|
5353
5382
|
return null;
|
|
5354
5383
|
}
|
|
5355
|
-
function
|
|
5384
|
+
function Br(e, t) {
|
|
5356
5385
|
if (!e || !t) return null;
|
|
5357
5386
|
let n = e.fields?.[t]?.options;
|
|
5358
5387
|
return !Array.isArray(n) || n.length === 0 ? null : n.map((e) => ({
|
|
@@ -5360,7 +5389,7 @@ function Fr(e, t) {
|
|
|
5360
5389
|
label: e.label
|
|
5361
5390
|
}));
|
|
5362
5391
|
}
|
|
5363
|
-
function
|
|
5392
|
+
function Vr(e, t, n = 4) {
|
|
5364
5393
|
if (!e) return [];
|
|
5365
5394
|
if (Array.isArray(e.highlightFields) && e.highlightFields.length > 0) return e.highlightFields.slice(0, n);
|
|
5366
5395
|
let r = new Set([
|
|
@@ -5434,22 +5463,22 @@ function Ir(e, t, n = 4) {
|
|
|
5434
5463
|
}
|
|
5435
5464
|
return o;
|
|
5436
5465
|
}
|
|
5437
|
-
function
|
|
5466
|
+
function Hr(e, t = {}) {
|
|
5438
5467
|
return {
|
|
5439
5468
|
type: "page:header",
|
|
5440
5469
|
recordChrome: t.recordChrome !== !1,
|
|
5441
5470
|
...Array.isArray(t.actions) && t.actions.length > 0 ? { actions: t.actions } : {}
|
|
5442
5471
|
};
|
|
5443
5472
|
}
|
|
5444
|
-
function
|
|
5473
|
+
function Ur(e, t) {
|
|
5445
5474
|
return !Array.isArray(t) || t.length === 0 ? null : {
|
|
5446
5475
|
type: "record:quick_actions",
|
|
5447
5476
|
actions: t,
|
|
5448
5477
|
location: "record_header"
|
|
5449
5478
|
};
|
|
5450
5479
|
}
|
|
5451
|
-
function
|
|
5452
|
-
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 = [];
|
|
5453
5482
|
return !t.hideHighlights && i.length > 0 && a.push({
|
|
5454
5483
|
type: "record:highlights",
|
|
5455
5484
|
fields: i
|
|
@@ -5459,17 +5488,17 @@ function zr(e, t = {}) {
|
|
|
5459
5488
|
stages: r
|
|
5460
5489
|
}), a;
|
|
5461
5490
|
}
|
|
5462
|
-
function
|
|
5491
|
+
function Gr(e, t, n) {
|
|
5463
5492
|
return {
|
|
5464
5493
|
type: "record:details",
|
|
5465
5494
|
sections: t,
|
|
5466
5495
|
...n && n.length > 0 ? { hideFields: n } : {}
|
|
5467
5496
|
};
|
|
5468
5497
|
}
|
|
5469
|
-
function
|
|
5470
|
-
let n = t.statusField ??
|
|
5498
|
+
function Kr(e, t = {}) {
|
|
5499
|
+
let n = t.statusField ?? zr(e), r = t.highlightFields ?? Vr(e, n), i = [{
|
|
5471
5500
|
label: "Details",
|
|
5472
|
-
children: [
|
|
5501
|
+
children: [Gr(e, t.sections, r)]
|
|
5473
5502
|
}];
|
|
5474
5503
|
return !t.hideRelatedTab && Array.isArray(t.related) && t.related.length > 0 && i.push({
|
|
5475
5504
|
label: "Related",
|
|
@@ -5498,15 +5527,15 @@ function Vr(e, t = {}) {
|
|
|
5498
5527
|
items: i
|
|
5499
5528
|
};
|
|
5500
5529
|
}
|
|
5501
|
-
function
|
|
5530
|
+
function qr() {
|
|
5502
5531
|
return { type: "record:discussion" };
|
|
5503
5532
|
}
|
|
5504
|
-
function
|
|
5533
|
+
function Jr(e, t = {}) {
|
|
5505
5534
|
let n = t.slots || {}, r = [];
|
|
5506
|
-
"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, {
|
|
5507
5536
|
recordChrome: t.recordChrome,
|
|
5508
5537
|
actions: t.headerActions
|
|
5509
|
-
})), "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, {
|
|
5510
5539
|
highlightFields: t.highlightFields,
|
|
5511
5540
|
statusField: t.statusField,
|
|
5512
5541
|
stages: t.stages,
|
|
@@ -5514,9 +5543,9 @@ function Ur(e, t = {}) {
|
|
|
5514
5543
|
hidePath: t.hidePath
|
|
5515
5544
|
}));
|
|
5516
5545
|
let i = t.showReferenceRail === !0 && !t.hideReferenceRail && Array.isArray(t.related) && t.related.length >= 2, a = t.hideRelatedTab ?? i;
|
|
5517
|
-
if ("tabs" in n && n.tabs !== void 0) r.push(...
|
|
5546
|
+
if ("tabs" in n && n.tabs !== void 0) r.push(...Rr(n.tabs));
|
|
5518
5547
|
else if ("details" in n && n.details !== void 0) {
|
|
5519
|
-
let i =
|
|
5548
|
+
let i = Rr(n.details), o = Kr(e, {
|
|
5520
5549
|
sections: t.sections,
|
|
5521
5550
|
related: t.related,
|
|
5522
5551
|
showActivity: t.showActivity,
|
|
@@ -5529,7 +5558,7 @@ function Ur(e, t = {}) {
|
|
|
5529
5558
|
...o.items[0],
|
|
5530
5559
|
children: i
|
|
5531
5560
|
}), r.push(o);
|
|
5532
|
-
} else r.push(
|
|
5561
|
+
} else r.push(Kr(e, {
|
|
5533
5562
|
sections: t.sections,
|
|
5534
5563
|
related: t.related,
|
|
5535
5564
|
showActivity: t.showActivity,
|
|
@@ -5538,12 +5567,12 @@ function Ur(e, t = {}) {
|
|
|
5538
5567
|
statusField: t.statusField,
|
|
5539
5568
|
hideRelatedTab: a
|
|
5540
5569
|
}));
|
|
5541
|
-
"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());
|
|
5542
5571
|
let o = [{
|
|
5543
5572
|
name: "main",
|
|
5544
5573
|
width: "full",
|
|
5545
5574
|
components: r
|
|
5546
|
-
}], s =
|
|
5575
|
+
}], s = Rr(n.rightRail);
|
|
5547
5576
|
if (i || s.length > 0) {
|
|
5548
5577
|
let e = [];
|
|
5549
5578
|
i && e.push({
|
|
@@ -5571,7 +5600,7 @@ function Ur(e, t = {}) {
|
|
|
5571
5600
|
regions: o
|
|
5572
5601
|
};
|
|
5573
5602
|
}
|
|
5574
|
-
e.register("detail-view",
|
|
5603
|
+
e.register("detail-view", _n, {
|
|
5575
5604
|
namespace: "plugin-detail",
|
|
5576
5605
|
label: "Detail View",
|
|
5577
5606
|
category: "Views",
|
|
@@ -5701,7 +5730,7 @@ e.register("detail-view", fn, {
|
|
|
5701
5730
|
tabs: [],
|
|
5702
5731
|
related: []
|
|
5703
5732
|
}
|
|
5704
|
-
}), e.register("detail-section",
|
|
5733
|
+
}), e.register("detail-section", Bt, {
|
|
5705
5734
|
namespace: "plugin-detail",
|
|
5706
5735
|
label: "Detail Section",
|
|
5707
5736
|
category: "Detail Components",
|
|
@@ -5752,7 +5781,7 @@ e.register("detail-view", fn, {
|
|
|
5752
5781
|
label: "Header Color"
|
|
5753
5782
|
}
|
|
5754
5783
|
]
|
|
5755
|
-
}), e.register("related-list",
|
|
5784
|
+
}), e.register("related-list", Ut, {
|
|
5756
5785
|
namespace: "plugin-detail",
|
|
5757
5786
|
label: "Related List",
|
|
5758
5787
|
category: "Detail Components",
|
|
@@ -5799,7 +5828,7 @@ e.register("detail-view", fn, {
|
|
|
5799
5828
|
label: "Columns"
|
|
5800
5829
|
}
|
|
5801
5830
|
]
|
|
5802
|
-
}), e.register("detail",
|
|
5831
|
+
}), e.register("detail", _n, {
|
|
5803
5832
|
namespace: "view",
|
|
5804
5833
|
category: "view",
|
|
5805
5834
|
label: "Detail",
|
|
@@ -5822,61 +5851,61 @@ e.register("detail-view", fn, {
|
|
|
5822
5851
|
label: "Fields"
|
|
5823
5852
|
}
|
|
5824
5853
|
]
|
|
5825
|
-
}), e.register("record:details",
|
|
5854
|
+
}), e.register("record:details", wn, {
|
|
5826
5855
|
namespace: "record",
|
|
5827
5856
|
category: "record",
|
|
5828
5857
|
label: "Record Details",
|
|
5829
5858
|
icon: "FileText"
|
|
5830
|
-
}), e.register("record:related_list",
|
|
5859
|
+
}), e.register("record:related_list", Dn, {
|
|
5831
5860
|
namespace: "record",
|
|
5832
5861
|
category: "record",
|
|
5833
5862
|
label: "Related List",
|
|
5834
5863
|
icon: "List"
|
|
5835
|
-
}), e.register("record:highlights",
|
|
5864
|
+
}), e.register("record:highlights", kn, {
|
|
5836
5865
|
namespace: "record",
|
|
5837
5866
|
category: "record",
|
|
5838
5867
|
label: "Highlights Panel",
|
|
5839
5868
|
icon: "Star"
|
|
5840
|
-
}), e.register("record:activity",
|
|
5869
|
+
}), e.register("record:activity", Yn, {
|
|
5841
5870
|
namespace: "record",
|
|
5842
5871
|
category: "record",
|
|
5843
5872
|
label: "Activity Timeline",
|
|
5844
5873
|
icon: "Activity"
|
|
5845
|
-
}), e.register("record:chatter",
|
|
5874
|
+
}), e.register("record:chatter", Qn, {
|
|
5846
5875
|
namespace: "record",
|
|
5847
5876
|
category: "record",
|
|
5848
5877
|
label: "Chatter Feed",
|
|
5849
5878
|
icon: "MessageSquare"
|
|
5850
|
-
}), e.register("record:discussion",
|
|
5879
|
+
}), e.register("record:discussion", Qn, {
|
|
5851
5880
|
namespace: "record",
|
|
5852
5881
|
category: "record",
|
|
5853
5882
|
label: "Discussion",
|
|
5854
5883
|
icon: "MessageSquare"
|
|
5855
|
-
}), e.register("record:path",
|
|
5884
|
+
}), e.register("record:path", er, {
|
|
5856
5885
|
namespace: "record",
|
|
5857
5886
|
category: "record",
|
|
5858
5887
|
label: "Path / Stepper",
|
|
5859
5888
|
icon: "GitBranch"
|
|
5860
|
-
}), e.register("record:quick_actions",
|
|
5889
|
+
}), e.register("record:quick_actions", nr, {
|
|
5861
5890
|
namespace: "record",
|
|
5862
5891
|
category: "record",
|
|
5863
5892
|
label: "Quick Actions",
|
|
5864
5893
|
icon: "Zap"
|
|
5865
|
-
}), e.register("record:history",
|
|
5894
|
+
}), e.register("record:history", or, {
|
|
5866
5895
|
namespace: "record",
|
|
5867
5896
|
category: "record",
|
|
5868
5897
|
label: "History Timeline",
|
|
5869
5898
|
icon: "Clock"
|
|
5870
|
-
}), e.register("record:reference_rail",
|
|
5899
|
+
}), e.register("record:reference_rail", ur, {
|
|
5871
5900
|
namespace: "record",
|
|
5872
5901
|
category: "record",
|
|
5873
5902
|
label: "Reference Rail",
|
|
5874
5903
|
icon: "PanelRight"
|
|
5875
|
-
}), e.register("record:alert",
|
|
5904
|
+
}), e.register("record:alert", pr, {
|
|
5876
5905
|
namespace: "record",
|
|
5877
5906
|
category: "record",
|
|
5878
5907
|
label: "Alert Banner",
|
|
5879
5908
|
icon: "AlertTriangle"
|
|
5880
5909
|
});
|
|
5881
5910
|
//#endregion
|
|
5882
|
-
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 };
|