@object-ui/plugin-detail 4.0.6 → 4.0.8
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 +29 -0
- package/dist/index.js +1493 -1228
- package/dist/index.umd.cjs +3 -3
- package/dist/packages/plugin-detail/src/DetailSection.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/DetailView.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/HeaderHighlight.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/RecordDetailDrawer.d.ts +83 -0
- package/dist/packages/plugin-detail/src/RecordDetailDrawer.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/RelatedList.d.ts +4 -0
- package/dist/packages/plugin-detail/src/RelatedList.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/index.d.ts +2 -0
- package/dist/packages/plugin-detail/src/index.d.ts.map +1 -1
- package/dist/packages/plugin-detail/src/useDetailTranslation.d.ts.map +1 -1
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ComponentRegistry as e, buildExpandFields as t } from "@object-ui/core";
|
|
2
2
|
import * as n from "react";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import r from "react";
|
|
4
|
+
import { AlertDialog as i, AlertDialogAction as a, AlertDialogCancel as o, AlertDialogContent as s, AlertDialogDescription as c, AlertDialogFooter as l, AlertDialogHeader as u, AlertDialogTitle as d, Badge as f, Button as p, Card as m, CardContent as h, CardHeader as g, CardTitle as _, Collapsible as v, CollapsibleContent as y, CollapsibleTrigger as b, Input as x, Sheet as S, SheetContent as C, SheetHeader as w, SheetTitle as T, Skeleton as E, Tabs as D, TabsContent as O, TabsList as k, TabsTrigger as A, Tooltip as j, TooltipContent as M, TooltipProvider as N, TooltipTrigger as P, cn as F, useIsMobile as I } from "@object-ui/components";
|
|
5
|
+
import { Activity as L, ArrowLeft as ee, ArrowRight as R, ArrowRightLeft as te, ArrowUpDown as z, AtSign as B, Bell as ne, BellOff as re, Bold as V, Calendar as H, Check as ie, CheckSquare as U, ChevronDown as ae, ChevronLeft as oe, ChevronRight as W, ChevronsLeft as se, ChevronsRight as ce, Code as le, Columns2 as ue, Copy as de, Edit as G, ExternalLink as fe, Eye as K, EyeOff as pe, File as me, FileArchive as he, FileText as ge, History as q, Image as _e, Inbox as ve, Italic as ye, Link as J, List as be, Loader2 as xe, Mail as Se, MessageSquare as Y, Network as Ce, PanelRightClose as we, PanelRightOpen as Te, Paperclip as Ee, Phone as De, Pin as Oe, Plus as ke, PlusCircle as Ae, RotateCcw as je, Rows3 as Me, Search as Ne, Send as Pe, SmilePlus as Fe, Star as Ie, Trash2 as Le, Upload as Re, X as ze, Zap as Be, icons as Ve } from "lucide-react";
|
|
6
|
+
import { SchemaRenderer as He, useObjectTranslation as Ue, useSafeFieldLabel as We } from "@object-ui/react";
|
|
7
|
+
import { BooleanField as Ge, SelectField as Ke, getCellRenderer as qe, resolveCellRendererType as Je } from "@object-ui/fields";
|
|
7
8
|
import { Fragment as X, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
8
9
|
//#region src/autoLayout.ts
|
|
9
|
-
var
|
|
10
|
+
var Ye = new Set([
|
|
10
11
|
"textarea",
|
|
11
12
|
"markdown",
|
|
12
13
|
"html",
|
|
@@ -18,10 +19,10 @@ var Pe = new Set([
|
|
|
18
19
|
"field:grid",
|
|
19
20
|
"field:rich-text"
|
|
20
21
|
]);
|
|
21
|
-
function
|
|
22
|
-
return
|
|
22
|
+
function Xe(e) {
|
|
23
|
+
return Ye.has(e);
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
+
function Ze(e, t) {
|
|
25
26
|
let n;
|
|
26
27
|
if (n = e <= 3 ? 1 : e <= 10 ? 2 : 3, t !== void 0) {
|
|
27
28
|
if (t < 640) return Math.min(n, 1);
|
|
@@ -29,29 +30,29 @@ function Ie(e, t) {
|
|
|
29
30
|
}
|
|
30
31
|
return n;
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
-
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type &&
|
|
33
|
+
function Qe(e, t) {
|
|
34
|
+
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && Xe(e.type) ? {
|
|
34
35
|
...e,
|
|
35
36
|
span: t
|
|
36
37
|
} : e);
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function $e(e, t, n) {
|
|
39
40
|
if (t !== void 0) return {
|
|
40
|
-
fields:
|
|
41
|
+
fields: Qe(e, t),
|
|
41
42
|
columns: t
|
|
42
43
|
};
|
|
43
|
-
let r =
|
|
44
|
+
let r = Ze(e.length, n);
|
|
44
45
|
return {
|
|
45
|
-
fields:
|
|
46
|
+
fields: Qe(e, r),
|
|
46
47
|
columns: r
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
50
|
//#endregion
|
|
50
51
|
//#region src/useDetailTranslation.ts
|
|
51
|
-
function
|
|
52
|
+
function et(e, t) {
|
|
52
53
|
return function() {
|
|
53
54
|
try {
|
|
54
|
-
let n =
|
|
55
|
+
let n = Ue();
|
|
55
56
|
return n.t(t) === t ? { t: (t, n) => {
|
|
56
57
|
let r = e[t] || t;
|
|
57
58
|
if (n) for (let [e, t] of Object.entries(n)) r = r.replace(`{{${e}}}`, String(t));
|
|
@@ -66,13 +67,16 @@ function ze(e, t) {
|
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
|
-
var
|
|
70
|
+
var tt = {
|
|
70
71
|
"detail.back": "Back",
|
|
71
72
|
"detail.edit": "Edit",
|
|
72
|
-
"detail.editInline": "Edit
|
|
73
|
+
"detail.editInline": "Edit",
|
|
73
74
|
"detail.save": "Save",
|
|
74
75
|
"detail.saveChanges": "Save changes",
|
|
75
76
|
"detail.editFieldsInline": "Edit fields inline",
|
|
77
|
+
"detail.cancel": "Cancel",
|
|
78
|
+
"detail.cancelEdit": "Discard changes",
|
|
79
|
+
"detail.openInNewTab": "Open in new tab",
|
|
76
80
|
"detail.share": "Share",
|
|
77
81
|
"detail.duplicate": "Duplicate",
|
|
78
82
|
"detail.export": "Export",
|
|
@@ -173,137 +177,164 @@ var Be = {
|
|
|
173
177
|
"detail.subscribeAriaLabel": "Subscribe to notifications",
|
|
174
178
|
"detail.unsubscribeAriaLabel": "Unsubscribe from notifications",
|
|
175
179
|
"detail.clearSearch": "Clear search"
|
|
176
|
-
}, $ =
|
|
180
|
+
}, $ = et(tt, "detail.back");
|
|
177
181
|
//#endregion
|
|
178
182
|
//#region src/DetailSection.tsx
|
|
179
|
-
function
|
|
183
|
+
function nt(e, t) {
|
|
180
184
|
return !e || e <= 1 || t <= 1 ? "" : t === 2 ? e >= 2 ? "md:col-span-2" : "" : e === 2 ? "md:col-span-2" : e >= 3 ? "md:col-span-2 lg:col-span-3" : "";
|
|
181
185
|
}
|
|
182
|
-
var
|
|
183
|
-
let [
|
|
186
|
+
var rt = ({ section: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s, virtualScroll: c }) => {
|
|
187
|
+
let [l, u] = n.useState(e.defaultCollapsed ?? !1), [d, x] = n.useState(null), [S, C] = n.useState(void 0), [w, T] = n.useState(!1), { t: E } = $(), { fieldLabel: D, translateOptions: O } = We(), k = n.useCallback((e, t) => {
|
|
184
188
|
let n = t == null ? "" : String(t);
|
|
185
189
|
navigator.clipboard.writeText(n).then(() => {
|
|
186
|
-
|
|
190
|
+
x(e), setTimeout(() => x(null), 2e3);
|
|
187
191
|
});
|
|
188
|
-
}, []),
|
|
192
|
+
}, []), A = n.useCallback((e) => {
|
|
189
193
|
let n = t?.[e.name] ?? e.value;
|
|
190
194
|
return n == null || n === "";
|
|
191
|
-
}, [t]),
|
|
192
|
-
if (
|
|
193
|
-
let { fields:
|
|
195
|
+
}, [t]), L = n.useMemo(() => e.fields.filter(A).length, [e.fields, A]), ee = I(), R = ee ? 3 : 6, te = ee ? .2 : .5, z = e.fields.length - L, B = !e.hideEmpty && !o && e.fields.length >= R && L / e.fields.length >= te && z > 0, ne = !w && (e.hideEmpty || B) ? e.fields.filter((e) => !A(e)) : e.fields;
|
|
196
|
+
if (ne.length === 0 && L === e.fields.length) return null;
|
|
197
|
+
let { fields: re, columns: V } = $e(ne, e.columns), H = (e) => {
|
|
194
198
|
let n = t?.[e.name] ?? e.value;
|
|
195
|
-
if (e.render) return /* @__PURE__ */ Z(
|
|
199
|
+
if (e.render) return /* @__PURE__ */ Z(He, {
|
|
196
200
|
schema: e.render,
|
|
197
201
|
data: {
|
|
198
202
|
...t,
|
|
199
203
|
value: n
|
|
200
204
|
}
|
|
201
205
|
});
|
|
202
|
-
let r =
|
|
206
|
+
let r = nt(e.span, V), c = i?.fields?.[e.name], l = { ...e };
|
|
207
|
+
if (c) {
|
|
208
|
+
!e.type && c.type && (l.type = c.type), c.options && !l.options && (l.options = c.options), c.currency && !l.currency && (l.currency = c.currency), c.precision !== void 0 && l.precision === void 0 && (l.precision = c.precision), c.format && !l.format && (l.format = c.format);
|
|
209
|
+
let t = c.reference_to || c.reference;
|
|
210
|
+
t && !l.reference_to && (l.reference_to = t), c.reference_field && !l.reference_field && (l.reference_field = c.reference_field);
|
|
211
|
+
}
|
|
212
|
+
a && Array.isArray(l.options) && l.options.length > 0 && (l.options = O(a, e.name, l.options));
|
|
213
|
+
let u = (() => {
|
|
203
214
|
if (n == null) return /* @__PURE__ */ Z("span", {
|
|
204
215
|
className: "text-muted-foreground/50 text-xs italic",
|
|
205
216
|
children: "—"
|
|
206
217
|
});
|
|
207
|
-
let t =
|
|
218
|
+
let t = Je(l) || e.type;
|
|
208
219
|
if (t) {
|
|
209
|
-
|
|
210
|
-
let n = t.reference_to || t.reference;
|
|
211
|
-
n && !i.reference_to && (i.reference_to = n), t.reference_field && !i.reference_field && (i.reference_field = t.reference_field);
|
|
212
|
-
}
|
|
213
|
-
if (r) {
|
|
214
|
-
let e = Ne(r);
|
|
220
|
+
let e = qe(t);
|
|
215
221
|
if (e) return /* @__PURE__ */ Z(e, {
|
|
216
222
|
value: n,
|
|
217
|
-
field:
|
|
223
|
+
field: l
|
|
218
224
|
});
|
|
219
225
|
}
|
|
220
226
|
return String(n);
|
|
221
|
-
})(),
|
|
227
|
+
})(), f = n != null && n !== "", m = d === e.name;
|
|
222
228
|
return /* @__PURE__ */ Q("div", {
|
|
223
|
-
className:
|
|
229
|
+
className: F("space-y-1.5 group", r),
|
|
224
230
|
children: [/* @__PURE__ */ Z("div", {
|
|
225
231
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
226
|
-
children:
|
|
227
|
-
}),
|
|
232
|
+
children: D(a || "", e.name, e.label || e.name)
|
|
233
|
+
}), o && !e.readonly ? /* @__PURE__ */ Z("div", {
|
|
228
234
|
className: "min-h-[44px] sm:min-h-0",
|
|
229
|
-
children:
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
+
children: (() => {
|
|
236
|
+
let t = l.type || e.type;
|
|
237
|
+
if (t === "select" && Array.isArray(l.options) && l.options.length > 0) return /* @__PURE__ */ Z(Ke, {
|
|
238
|
+
field: l,
|
|
239
|
+
value: n == null ? "" : String(n),
|
|
240
|
+
onChange: (t) => s?.(e.name, t)
|
|
241
|
+
});
|
|
242
|
+
if (t === "boolean") return /* @__PURE__ */ Z(Ge, {
|
|
243
|
+
field: l,
|
|
244
|
+
value: !!n,
|
|
245
|
+
onChange: (t) => s?.(e.name, t)
|
|
246
|
+
});
|
|
247
|
+
let r = t === "date" || t === "datetime";
|
|
248
|
+
return /* @__PURE__ */ Z("input", {
|
|
249
|
+
type: t === "number" ? "number" : r ? "date" : "text",
|
|
250
|
+
className: "w-full px-2 py-1.5 text-sm border rounded-md bg-background focus:outline-none focus:ring-2 focus:ring-ring",
|
|
251
|
+
value: n == null ? "" : r ? (() => {
|
|
252
|
+
let e = String(n);
|
|
253
|
+
if (/^\d{4}-\d{2}-\d{2}/.test(e)) return e.slice(0, 10);
|
|
254
|
+
let t = new Date(e);
|
|
255
|
+
return isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-CA");
|
|
256
|
+
})() : String(n),
|
|
257
|
+
onChange: (t) => {
|
|
258
|
+
let n = t.target.value;
|
|
259
|
+
if (r && n) {
|
|
260
|
+
let t = (/* @__PURE__ */ new Date(n + "T00:00:00")).toISOString();
|
|
261
|
+
s?.(e.name, t);
|
|
262
|
+
} else s?.(e.name, n);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
})()
|
|
235
266
|
}) : /* @__PURE__ */ Q("div", {
|
|
236
|
-
className:
|
|
237
|
-
onClick:
|
|
238
|
-
onKeyDown:
|
|
239
|
-
(t.key === "Enter" || t.key === " ") && (t.preventDefault(),
|
|
267
|
+
className: F("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md", f && "cursor-pointer active:bg-muted/60 transition-colors"),
|
|
268
|
+
onClick: f ? () => k(e.name, n) : void 0,
|
|
269
|
+
onKeyDown: f ? (t) => {
|
|
270
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), k(e.name, n));
|
|
240
271
|
} : void 0,
|
|
241
|
-
role:
|
|
242
|
-
tabIndex:
|
|
272
|
+
role: f ? "button" : void 0,
|
|
273
|
+
tabIndex: f ? 0 : void 0,
|
|
243
274
|
children: [/* @__PURE__ */ Z("div", {
|
|
244
275
|
className: "text-sm flex-1 break-words py-1",
|
|
245
|
-
children:
|
|
246
|
-
}),
|
|
276
|
+
children: u
|
|
277
|
+
}), f && /* @__PURE__ */ Z(N, { children: /* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
|
|
247
278
|
asChild: !0,
|
|
248
|
-
children: /* @__PURE__ */ Z(
|
|
279
|
+
children: /* @__PURE__ */ Z(p, {
|
|
249
280
|
variant: "ghost",
|
|
250
281
|
size: "icon",
|
|
251
282
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",
|
|
252
283
|
onClick: (t) => {
|
|
253
|
-
t.stopPropagation(),
|
|
284
|
+
t.stopPropagation(), k(e.name, n);
|
|
254
285
|
},
|
|
255
|
-
children:
|
|
286
|
+
children: m ? /* @__PURE__ */ Z(ie, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(de, { className: "h-3 w-3" })
|
|
256
287
|
})
|
|
257
|
-
}), /* @__PURE__ */ Z(
|
|
288
|
+
}), /* @__PURE__ */ Z(M, { children: E(m ? "detail.copied" : "detail.copyToClipboard") })] }) })]
|
|
258
289
|
})]
|
|
259
290
|
}, e.name);
|
|
260
|
-
},
|
|
291
|
+
}, U = c?.enabled === !0, oe = c?.batchSize ?? 20;
|
|
261
292
|
n.useEffect(() => {
|
|
262
|
-
if (!
|
|
263
|
-
|
|
293
|
+
if (!U) {
|
|
294
|
+
C(void 0);
|
|
264
295
|
return;
|
|
265
296
|
}
|
|
266
|
-
if (
|
|
267
|
-
|
|
297
|
+
if (re.length <= oe) {
|
|
298
|
+
C(void 0);
|
|
268
299
|
return;
|
|
269
300
|
}
|
|
270
|
-
|
|
271
|
-
let e = setTimeout(() =>
|
|
301
|
+
C(oe);
|
|
302
|
+
let e = setTimeout(() => C(void 0), 100);
|
|
272
303
|
return () => clearTimeout(e);
|
|
273
304
|
}, [
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
305
|
+
U,
|
|
306
|
+
re.length,
|
|
307
|
+
oe
|
|
277
308
|
]);
|
|
278
|
-
let
|
|
279
|
-
className:
|
|
280
|
-
children:
|
|
281
|
-
}),
|
|
309
|
+
let se = S === void 0 ? re : re.slice(0, S), ce = L > 0 && (e.hideEmpty || B), le = /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("div", {
|
|
310
|
+
className: F("grid gap-3 sm:gap-4", V === 1 ? "grid-cols-1" : V === 2 ? "grid-cols-1 md:grid-cols-2" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"),
|
|
311
|
+
children: se.map(H)
|
|
312
|
+
}), ce && /* @__PURE__ */ Z("div", {
|
|
282
313
|
className: "mt-3 -ml-2",
|
|
283
|
-
children: /* @__PURE__ */ Q(
|
|
314
|
+
children: /* @__PURE__ */ Q(p, {
|
|
284
315
|
type: "button",
|
|
285
316
|
variant: "ghost",
|
|
286
317
|
size: "sm",
|
|
287
|
-
onClick: () =>
|
|
318
|
+
onClick: () => T((e) => !e),
|
|
288
319
|
className: "h-7 px-2 text-xs text-muted-foreground hover:text-foreground",
|
|
289
|
-
children: [Z(
|
|
290
|
-
count:
|
|
291
|
-
defaultValue: `Show ${
|
|
320
|
+
children: [Z(w ? pe : K, { className: "h-3.5 w-3.5 mr-1.5" }), w ? E("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : E("detail.showEmptyFields", {
|
|
321
|
+
count: L,
|
|
322
|
+
defaultValue: `Show ${L} empty field${L === 1 ? "" : "s"}`
|
|
292
323
|
})]
|
|
293
324
|
})
|
|
294
325
|
})] });
|
|
295
326
|
return !e.title && !e.collapsible && e.showBorder === !1 ? /* @__PURE__ */ Z("div", {
|
|
296
|
-
className:
|
|
297
|
-
children:
|
|
298
|
-
}) : e.collapsible ? /* @__PURE__ */ Z(
|
|
299
|
-
open: !
|
|
300
|
-
onOpenChange: (e) =>
|
|
301
|
-
className:
|
|
302
|
-
children: /* @__PURE__ */ Q(
|
|
327
|
+
className: F(r),
|
|
328
|
+
children: le
|
|
329
|
+
}) : e.collapsible ? /* @__PURE__ */ Z(v, {
|
|
330
|
+
open: !l,
|
|
331
|
+
onOpenChange: (e) => u(!e),
|
|
332
|
+
className: r,
|
|
333
|
+
children: /* @__PURE__ */ Q(m, { children: [/* @__PURE__ */ Z(b, {
|
|
303
334
|
asChild: !0,
|
|
304
|
-
children: /* @__PURE__ */ Q(
|
|
305
|
-
className:
|
|
306
|
-
children: [/* @__PURE__ */ Q(
|
|
335
|
+
children: /* @__PURE__ */ Q(g, {
|
|
336
|
+
className: F("cursor-pointer hover:bg-muted/50 transition-colors", e.headerColor && `bg-${e.headerColor}`),
|
|
337
|
+
children: [/* @__PURE__ */ Q(_, {
|
|
307
338
|
className: "flex items-center justify-between",
|
|
308
339
|
children: [/* @__PURE__ */ Q("div", {
|
|
309
340
|
className: "flex items-center gap-2",
|
|
@@ -313,7 +344,7 @@ var He = ({ section: e, data: t, className: f, objectSchema: p, objectName: m, i
|
|
|
313
344
|
children: e.icon
|
|
314
345
|
}),
|
|
315
346
|
/* @__PURE__ */ Z("span", { children: e.title }),
|
|
316
|
-
e.fields && /* @__PURE__ */ Z(
|
|
347
|
+
e.fields && /* @__PURE__ */ Z(f, {
|
|
317
348
|
variant: "secondary",
|
|
318
349
|
className: "ml-2 text-xs",
|
|
319
350
|
children: e.fields.length
|
|
@@ -321,22 +352,22 @@ var He = ({ section: e, data: t, className: f, objectSchema: p, objectName: m, i
|
|
|
321
352
|
]
|
|
322
353
|
}), /* @__PURE__ */ Z("div", {
|
|
323
354
|
className: "flex items-center gap-2",
|
|
324
|
-
children: Z(
|
|
355
|
+
children: Z(l ? W : ae, { className: "h-4 w-4 text-muted-foreground" })
|
|
325
356
|
})]
|
|
326
|
-
}), e.description && !
|
|
357
|
+
}), e.description && !l && /* @__PURE__ */ Z("p", {
|
|
327
358
|
className: "text-sm text-muted-foreground mt-1.5",
|
|
328
359
|
children: e.description
|
|
329
360
|
})]
|
|
330
361
|
})
|
|
331
|
-
}), /* @__PURE__ */ Z(
|
|
362
|
+
}), /* @__PURE__ */ Z(y, { children: /* @__PURE__ */ Z(h, {
|
|
332
363
|
className: "pt-4 sm:pt-6 px-3 sm:px-6",
|
|
333
|
-
children:
|
|
364
|
+
children: le
|
|
334
365
|
}) })] })
|
|
335
|
-
}) : /* @__PURE__ */ Q(
|
|
336
|
-
className:
|
|
337
|
-
children: [e.title && /* @__PURE__ */ Q(
|
|
338
|
-
className:
|
|
339
|
-
children: [/* @__PURE__ */ Z(
|
|
366
|
+
}) : /* @__PURE__ */ Q(m, {
|
|
367
|
+
className: F(e.showBorder === !1 ? "border-none shadow-none" : "", r),
|
|
368
|
+
children: [e.title && /* @__PURE__ */ Q(g, {
|
|
369
|
+
className: F(e.headerColor && `bg-${e.headerColor}`),
|
|
370
|
+
children: [/* @__PURE__ */ Z(_, {
|
|
340
371
|
className: "flex items-center justify-between",
|
|
341
372
|
children: /* @__PURE__ */ Q("div", {
|
|
342
373
|
className: "flex items-center gap-2",
|
|
@@ -349,20 +380,20 @@ var He = ({ section: e, data: t, className: f, objectSchema: p, objectName: m, i
|
|
|
349
380
|
className: "text-sm text-muted-foreground mt-1.5",
|
|
350
381
|
children: e.description
|
|
351
382
|
})]
|
|
352
|
-
}), /* @__PURE__ */ Z(
|
|
383
|
+
}), /* @__PURE__ */ Z(h, {
|
|
353
384
|
className: "pt-4 sm:pt-6 px-3 sm:px-6",
|
|
354
|
-
children:
|
|
385
|
+
children: le
|
|
355
386
|
})]
|
|
356
387
|
});
|
|
357
|
-
},
|
|
358
|
-
let [
|
|
359
|
-
return /* @__PURE__ */ Q(
|
|
360
|
-
value:
|
|
361
|
-
onValueChange:
|
|
362
|
-
className:
|
|
363
|
-
children: [/* @__PURE__ */ Z(
|
|
388
|
+
}, it = ({ tabs: e, data: t, className: r }) => {
|
|
389
|
+
let [i, a] = n.useState(e[0]?.key), o = e.filter((e) => typeof e.visible == "boolean" ? e.visible : (e.visible, !0));
|
|
390
|
+
return /* @__PURE__ */ Q(D, {
|
|
391
|
+
value: i,
|
|
392
|
+
onValueChange: a,
|
|
393
|
+
className: r,
|
|
394
|
+
children: [/* @__PURE__ */ Z(k, {
|
|
364
395
|
className: "w-full justify-start border-b rounded-none bg-transparent p-0",
|
|
365
|
-
children:
|
|
396
|
+
children: o.map((e) => /* @__PURE__ */ Z(A, {
|
|
366
397
|
value: e.key,
|
|
367
398
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
368
399
|
children: /* @__PURE__ */ Q("div", {
|
|
@@ -370,7 +401,7 @@ var He = ({ section: e, data: t, className: f, objectSchema: p, objectName: m, i
|
|
|
370
401
|
children: [
|
|
371
402
|
e.icon && /* @__PURE__ */ Z("span", { children: e.icon }),
|
|
372
403
|
/* @__PURE__ */ Z("span", { children: e.label }),
|
|
373
|
-
e.badge && /* @__PURE__ */ Z(
|
|
404
|
+
e.badge && /* @__PURE__ */ Z(f, {
|
|
374
405
|
variant: "secondary",
|
|
375
406
|
className: "ml-1",
|
|
376
407
|
children: e.badge
|
|
@@ -378,18 +409,18 @@ var He = ({ section: e, data: t, className: f, objectSchema: p, objectName: m, i
|
|
|
378
409
|
]
|
|
379
410
|
})
|
|
380
411
|
}, e.key))
|
|
381
|
-
}),
|
|
412
|
+
}), o.map((e) => /* @__PURE__ */ Z(O, {
|
|
382
413
|
value: e.key,
|
|
383
414
|
className: "mt-4",
|
|
384
415
|
children: /* @__PURE__ */ Z(n.Suspense, {
|
|
385
416
|
fallback: null,
|
|
386
417
|
children: Array.isArray(e.content) ? /* @__PURE__ */ Z("div", {
|
|
387
418
|
className: "space-y-4",
|
|
388
|
-
children: e.content.map((e, n) => /* @__PURE__ */ Z(
|
|
419
|
+
children: e.content.map((e, n) => /* @__PURE__ */ Z(He, {
|
|
389
420
|
schema: e,
|
|
390
421
|
data: t
|
|
391
422
|
}, n))
|
|
392
|
-
}) : /* @__PURE__ */ Z(
|
|
423
|
+
}) : /* @__PURE__ */ Z(He, {
|
|
393
424
|
schema: e.content,
|
|
394
425
|
data: t
|
|
395
426
|
})
|
|
@@ -399,118 +430,210 @@ var He = ({ section: e, data: t, className: f, objectSchema: p, objectName: m, i
|
|
|
399
430
|
};
|
|
400
431
|
//#endregion
|
|
401
432
|
//#region src/RelatedList.tsx
|
|
402
|
-
function
|
|
403
|
-
return e &&
|
|
433
|
+
function at(e) {
|
|
434
|
+
return e && Ve[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || ve;
|
|
404
435
|
}
|
|
405
|
-
var
|
|
406
|
-
let [
|
|
436
|
+
var ot = ({ title: e, type: t, api: r, data: v, schema: y, columns: b, className: S, dataSource: C, objectName: w, onNew: T, onViewAll: E, onRowEdit: D, onRowDelete: O, onRowClick: k, maxColumns: A = 6, pageSize: j, sortable: M = !1, filterable: N = !1, collapsible: P = !1, defaultCollapsed: I = !1, referenceField: L, icon: ee }) => {
|
|
437
|
+
let R = v !== void 0, te = v ?? [], [B, ne] = n.useState(te), [re, V] = n.useState(!1), [H, ie] = n.useState(0), [U, se] = n.useState(null), [ce, le] = n.useState("asc"), [ue, de] = n.useState(""), [G, K] = n.useState(null), [pe, me] = n.useState(I), [he, ge] = n.useState({}), { t: q } = $(), { fieldLabel: _e } = We();
|
|
407
438
|
n.useEffect(() => {
|
|
408
|
-
|
|
409
|
-
}, [
|
|
410
|
-
|
|
411
|
-
console.warn(`[RelatedList] Failed to fetch schema for ${
|
|
439
|
+
R && ne(v ?? []);
|
|
440
|
+
}, [v, R]), n.useEffect(() => {
|
|
441
|
+
r && C?.getObjectSchema && !b?.length && C.getObjectSchema(r).then(K).catch((e) => {
|
|
442
|
+
console.warn(`[RelatedList] Failed to fetch schema for ${r}:`, e);
|
|
412
443
|
});
|
|
413
444
|
}, [
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
445
|
+
r,
|
|
446
|
+
C,
|
|
447
|
+
b
|
|
417
448
|
]), n.useEffect(() => {
|
|
418
|
-
|
|
419
|
-
|
|
449
|
+
r && !R && (V(!0), C && typeof C.find == "function" ? C.find(r).then((e) => {
|
|
450
|
+
ne(Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : []), V(!1);
|
|
420
451
|
}).catch((e) => {
|
|
421
|
-
console.error("Failed to fetch related data:", e),
|
|
422
|
-
}) : fetch(
|
|
423
|
-
|
|
452
|
+
console.error("Failed to fetch related data:", e), V(!1);
|
|
453
|
+
}) : fetch(r).then((e) => e.json()).then((e) => {
|
|
454
|
+
ne(Array.isArray(e) ? e : e?.data || []);
|
|
424
455
|
}).catch((e) => {
|
|
425
456
|
console.error("Failed to fetch related data:", e);
|
|
426
|
-
}).finally(() =>
|
|
457
|
+
}).finally(() => V(!1)));
|
|
427
458
|
}, [
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
459
|
+
r,
|
|
460
|
+
R,
|
|
461
|
+
C
|
|
462
|
+
]), n.useEffect(() => {
|
|
463
|
+
if (!C?.find || !G?.fields || !B.length) return;
|
|
464
|
+
let e = G.fields, t = [];
|
|
465
|
+
for (let [n, r] of Object.entries(e)) {
|
|
466
|
+
if (!r || r.type !== "lookup" && r.type !== "master_detail") continue;
|
|
467
|
+
let e = r.reference_to || r.reference;
|
|
468
|
+
if (!e) continue;
|
|
469
|
+
let i = /* @__PURE__ */ new Set();
|
|
470
|
+
for (let e of B) {
|
|
471
|
+
let t = e?.[n];
|
|
472
|
+
t != null && (typeof t == "string" && t ? i.add(t) : typeof t == "number" && i.add(String(t)));
|
|
473
|
+
}
|
|
474
|
+
let a = he[n] || {}, o = Array.from(i).filter((e) => !(e in a));
|
|
475
|
+
o.length > 0 && t.push({
|
|
476
|
+
fieldName: n,
|
|
477
|
+
target: e,
|
|
478
|
+
ids: o
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
if (t.length === 0) return;
|
|
482
|
+
let n = !1;
|
|
483
|
+
return Promise.all(t.map(({ fieldName: e, target: t, ids: n }) => C.find(t, {
|
|
484
|
+
$filter: { id: { $in: n } },
|
|
485
|
+
$top: n.length
|
|
486
|
+
}).then((t) => {
|
|
487
|
+
let n = Array.isArray(t) ? t : t?.data || [], r = {};
|
|
488
|
+
for (let e of n) {
|
|
489
|
+
let t = e?.id || e?._id;
|
|
490
|
+
t && (r[String(t)] = e?.full_name || e?.fullname || e?.display_name || e?.name || e?.subject || e?.title || e?.label || e?.code || String(t));
|
|
491
|
+
}
|
|
492
|
+
return {
|
|
493
|
+
fieldName: e,
|
|
494
|
+
map: r
|
|
495
|
+
};
|
|
496
|
+
}).catch((t) => (console.warn(`[RelatedList] Failed to resolve lookups for ${e}:`, t), {
|
|
497
|
+
fieldName: e,
|
|
498
|
+
map: {}
|
|
499
|
+
})))).then((e) => {
|
|
500
|
+
n || ge((t) => {
|
|
501
|
+
let n = { ...t };
|
|
502
|
+
for (let { fieldName: t, map: r } of e) n[t] = {
|
|
503
|
+
...n[t] || {},
|
|
504
|
+
...r
|
|
505
|
+
};
|
|
506
|
+
return n;
|
|
507
|
+
});
|
|
508
|
+
}), () => {
|
|
509
|
+
n = !0;
|
|
510
|
+
};
|
|
511
|
+
}, [
|
|
512
|
+
C,
|
|
513
|
+
G,
|
|
514
|
+
B
|
|
431
515
|
]);
|
|
432
|
-
let
|
|
433
|
-
if (!
|
|
434
|
-
let e =
|
|
435
|
-
return
|
|
436
|
-
}, [
|
|
437
|
-
let n = e[
|
|
516
|
+
let ve = n.useMemo(() => {
|
|
517
|
+
if (!ue) return B;
|
|
518
|
+
let e = ue.toLowerCase();
|
|
519
|
+
return B.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
520
|
+
}, [B, ue]), ye = n.useMemo(() => U ? [...ve].sort((e, t) => {
|
|
521
|
+
let n = e[U], r = t[U];
|
|
438
522
|
if (n == null && r == null) return 0;
|
|
439
523
|
if (n == null) return 1;
|
|
440
524
|
if (r == null) return -1;
|
|
441
525
|
let i = String(n).localeCompare(String(r), void 0, { numeric: !0 });
|
|
442
|
-
return
|
|
443
|
-
}) :
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
]),
|
|
526
|
+
return ce === "asc" ? i : -i;
|
|
527
|
+
}) : ve, [
|
|
528
|
+
ve,
|
|
529
|
+
U,
|
|
530
|
+
ce
|
|
531
|
+
]), J = j && j > 0 ? j : 0, be = J ? Math.max(1, Math.ceil(ye.length / J)) : 1, xe = J ? ye.slice(H * J, (H + 1) * J) : ye;
|
|
448
532
|
n.useEffect(() => {
|
|
449
|
-
|
|
533
|
+
ie(0);
|
|
450
534
|
}, [
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
535
|
+
ue,
|
|
536
|
+
U,
|
|
537
|
+
ce
|
|
454
538
|
]);
|
|
455
|
-
let
|
|
456
|
-
|
|
457
|
-
}, [
|
|
458
|
-
|
|
459
|
-
}, [
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
539
|
+
let Se = n.useCallback((e) => {
|
|
540
|
+
U === e ? le((e) => e === "asc" ? "desc" : "asc") : (se(e), le("asc"));
|
|
541
|
+
}, [U]), [Y, Ce] = n.useState(null), we = n.useCallback((e) => {
|
|
542
|
+
Ce(e);
|
|
543
|
+
}, []), Te = n.useCallback(() => {
|
|
544
|
+
Y && O?.(Y), Ce(null);
|
|
545
|
+
}, [Y, O]), Ee = n.useMemo(() => {
|
|
546
|
+
let e = (e) => L ? e.filter((e) => (e?.accessorKey || e?.field || e?.name) !== L) : e, t = (e) => e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0, i = (e) => B.length ? e.filter((e) => {
|
|
547
|
+
let n = e?.accessorKey || e?.field || e?.name;
|
|
548
|
+
return n ? B.some((e) => !t(e?.[n])) : !0;
|
|
549
|
+
}) : e;
|
|
550
|
+
if (b && b.length > 0) return i(e(b));
|
|
551
|
+
if (!G?.fields) return [];
|
|
552
|
+
let a = w || r || "", o = new Set([
|
|
553
|
+
"image",
|
|
554
|
+
"file",
|
|
555
|
+
"attachment",
|
|
556
|
+
"rich_text",
|
|
557
|
+
"html",
|
|
558
|
+
"json"
|
|
559
|
+
]), s = [
|
|
560
|
+
"name",
|
|
561
|
+
"full_name",
|
|
562
|
+
"fullname",
|
|
563
|
+
"title",
|
|
564
|
+
"subject",
|
|
565
|
+
"label",
|
|
566
|
+
"code",
|
|
567
|
+
"number"
|
|
568
|
+
], c = Object.entries(G.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === L || t?.hidden || t?.type && o.has(t.type)));
|
|
569
|
+
return c.sort(([e, t], [n, r]) => {
|
|
570
|
+
let i = s.indexOf(e), a = s.indexOf(n), o = i >= 0 ? i : 100, c = a >= 0 ? a : 100;
|
|
571
|
+
if (o !== c) return o - c;
|
|
572
|
+
let l = t?.type === "select" || e.includes("status");
|
|
573
|
+
return l === (r?.type === "select" || n.includes("status")) ? 0 : l ? -1 : 1;
|
|
574
|
+
}), i(c.map(([e, t]) => {
|
|
575
|
+
let r = {
|
|
466
576
|
accessorKey: e,
|
|
467
|
-
header:
|
|
577
|
+
header: _e(a, e, t.label || e)
|
|
468
578
|
};
|
|
469
|
-
if (
|
|
470
|
-
let
|
|
471
|
-
|
|
472
|
-
|
|
579
|
+
if (t.type) {
|
|
580
|
+
let i = qe(Je({
|
|
581
|
+
type: t.type,
|
|
582
|
+
format: t.format
|
|
583
|
+
}) || t.type);
|
|
584
|
+
if (i) {
|
|
585
|
+
let a = t.type === "lookup" || t.type === "master_detail" ? he[e] : void 0, o = a && Object.keys(a).length > 0 ? Object.entries(a).map(([e, t]) => ({
|
|
586
|
+
value: e,
|
|
587
|
+
label: t
|
|
588
|
+
})) : void 0, s = {
|
|
473
589
|
name: e,
|
|
474
|
-
label:
|
|
475
|
-
type:
|
|
476
|
-
...
|
|
477
|
-
...
|
|
478
|
-
...
|
|
479
|
-
...
|
|
480
|
-
...(
|
|
481
|
-
...
|
|
590
|
+
label: t.label || e,
|
|
591
|
+
type: t.type,
|
|
592
|
+
...(o || t.options) && { options: o || t.options },
|
|
593
|
+
...t.currency && { currency: t.currency },
|
|
594
|
+
...t.precision !== void 0 && { precision: t.precision },
|
|
595
|
+
...t.format && { format: t.format },
|
|
596
|
+
...(t.reference_to || t.reference) && { reference_to: t.reference_to || t.reference },
|
|
597
|
+
...t.reference_field && { reference_field: t.reference_field }
|
|
482
598
|
};
|
|
483
|
-
|
|
599
|
+
r.cell = (e) => e == null ? n.createElement("span", { className: "text-muted-foreground/50 text-xs italic" }, "—") : n.createElement(i, {
|
|
484
600
|
value: e,
|
|
485
|
-
field:
|
|
601
|
+
field: s
|
|
486
602
|
});
|
|
487
603
|
}
|
|
488
604
|
}
|
|
489
|
-
return
|
|
490
|
-
});
|
|
605
|
+
return r;
|
|
606
|
+
})).slice(0, Math.max(1, A));
|
|
491
607
|
}, [
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
608
|
+
b,
|
|
609
|
+
G,
|
|
610
|
+
w,
|
|
611
|
+
r,
|
|
612
|
+
_e,
|
|
613
|
+
L,
|
|
614
|
+
B,
|
|
615
|
+
A,
|
|
616
|
+
he
|
|
617
|
+
]), De = !!D || !!O, Oe = n.useMemo(() => {
|
|
618
|
+
if (y) return y;
|
|
500
619
|
switch (t) {
|
|
501
620
|
case "grid":
|
|
502
621
|
case "table": return {
|
|
503
622
|
type: "data-table",
|
|
504
|
-
data:
|
|
505
|
-
columns:
|
|
623
|
+
data: xe,
|
|
624
|
+
columns: Ee,
|
|
506
625
|
pagination: !1,
|
|
507
|
-
pageSize:
|
|
626
|
+
pageSize: J || 10,
|
|
508
627
|
searchable: !1,
|
|
509
|
-
exportable: !1
|
|
628
|
+
exportable: !1,
|
|
629
|
+
rowActions: De,
|
|
630
|
+
onRowEdit: D,
|
|
631
|
+
onRowDelete: O ? we : void 0,
|
|
632
|
+
onRowClick: k
|
|
510
633
|
};
|
|
511
634
|
case "list": return {
|
|
512
635
|
type: "data-list",
|
|
513
|
-
data:
|
|
636
|
+
data: xe
|
|
514
637
|
};
|
|
515
638
|
default: return {
|
|
516
639
|
type: "div",
|
|
@@ -519,159 +642,169 @@ var Ge = ({ title: e, type: t, api: l, data: u = [], schema: d, columns: p, clas
|
|
|
519
642
|
}
|
|
520
643
|
}, [
|
|
521
644
|
t,
|
|
645
|
+
xe,
|
|
646
|
+
Ee,
|
|
647
|
+
y,
|
|
522
648
|
J,
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
className: "
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
"
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
649
|
+
De,
|
|
650
|
+
D,
|
|
651
|
+
O,
|
|
652
|
+
we,
|
|
653
|
+
k
|
|
654
|
+
]), Ae = P ? "cursor-pointer select-none" : void 0, je = P ? () => me((e) => !e) : void 0, Me = at(ee), Ne = !re && B.length === 0, Pe = N;
|
|
655
|
+
return /* @__PURE__ */ Q(m, {
|
|
656
|
+
className: F("shadow-none", Ne && "bg-muted/20", S),
|
|
657
|
+
children: [
|
|
658
|
+
/* @__PURE__ */ Z(g, {
|
|
659
|
+
className: F("py-3 px-4", Ae),
|
|
660
|
+
onClick: je,
|
|
661
|
+
children: /* @__PURE__ */ Q(_, {
|
|
662
|
+
className: "flex items-center justify-between gap-2 text-sm font-semibold",
|
|
663
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
664
|
+
className: "flex items-center gap-2 min-w-0",
|
|
665
|
+
children: [
|
|
666
|
+
P && Z(pe ? W : ae, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
|
|
667
|
+
/* @__PURE__ */ Z(Me, {
|
|
668
|
+
className: "h-4 w-4 text-muted-foreground shrink-0",
|
|
669
|
+
"aria-hidden": !0
|
|
670
|
+
}),
|
|
671
|
+
/* @__PURE__ */ Z("span", {
|
|
672
|
+
className: "truncate",
|
|
673
|
+
children: e
|
|
674
|
+
}),
|
|
675
|
+
/* @__PURE__ */ Z(f, {
|
|
676
|
+
variant: "secondary",
|
|
677
|
+
className: F("text-xs font-normal h-5 px-1.5", B.length === 0 && "bg-muted text-muted-foreground"),
|
|
678
|
+
"aria-label": `${B.length} records`,
|
|
679
|
+
children: B.length
|
|
680
|
+
})
|
|
681
|
+
]
|
|
682
|
+
}), /* @__PURE__ */ Z("div", {
|
|
683
|
+
className: "flex items-center gap-1 shrink-0",
|
|
684
|
+
children: T && /* @__PURE__ */ Q(p, {
|
|
685
|
+
variant: "outline",
|
|
686
|
+
size: "sm",
|
|
687
|
+
onClick: (e) => {
|
|
688
|
+
e.stopPropagation(), T();
|
|
689
|
+
},
|
|
690
|
+
className: "gap-1 h-7 text-xs shadow-none",
|
|
691
|
+
children: [/* @__PURE__ */ Z(ke, { className: "h-3.5 w-3.5" }), q("detail.new")]
|
|
551
692
|
})
|
|
552
|
-
]
|
|
553
|
-
}), /* @__PURE__ */ Q("div", {
|
|
554
|
-
className: "flex items-center gap-1 shrink-0",
|
|
555
|
-
children: [_ && /* @__PURE__ */ Q(i, {
|
|
556
|
-
variant: "ghost",
|
|
557
|
-
size: "sm",
|
|
558
|
-
onClick: (e) => {
|
|
559
|
-
e.stopPropagation(), _();
|
|
560
|
-
},
|
|
561
|
-
className: "gap-1 h-7 text-xs",
|
|
562
|
-
children: [/* @__PURE__ */ Z(ge, { className: "h-3.5 w-3.5" }), W("detail.new")]
|
|
563
|
-
}), v && /* @__PURE__ */ Q(i, {
|
|
564
|
-
variant: "ghost",
|
|
565
|
-
size: "sm",
|
|
566
|
-
onClick: (e) => {
|
|
567
|
-
e.stopPropagation(), v();
|
|
568
|
-
},
|
|
569
|
-
className: "gap-1 h-7 text-xs",
|
|
570
|
-
children: [W("detail.viewAll"), /* @__PURE__ */ Z(ne, { className: "h-3 w-3" })]
|
|
571
693
|
})]
|
|
572
|
-
})
|
|
573
|
-
})
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
size: "sm",
|
|
595
|
-
className: "gap-1 h-7 text-xs",
|
|
596
|
-
onClick: () => le(t),
|
|
597
|
-
children: [
|
|
598
|
-
/* @__PURE__ */ Z(O, { className: "h-3 w-3" }),
|
|
599
|
-
n,
|
|
600
|
-
r && (B === "asc" ? " ↑" : " ↓")
|
|
601
|
-
]
|
|
602
|
-
}, t);
|
|
603
|
-
})
|
|
604
|
-
}),
|
|
605
|
-
M ? /* @__PURE__ */ Z("div", {
|
|
606
|
-
className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
|
|
607
|
-
children: W("detail.loading")
|
|
608
|
-
}) : _e ? /* @__PURE__ */ Q("div", {
|
|
609
|
-
className: "flex items-center justify-between gap-2 py-2 text-sm",
|
|
610
|
-
children: [/* @__PURE__ */ Z("span", {
|
|
611
|
-
className: "text-muted-foreground italic",
|
|
612
|
-
children: W("detail.noRelatedRecords")
|
|
613
|
-
}), _ === void 0 && /* @__PURE__ */ Z("span", { className: "text-xs text-muted-foreground/70" })]
|
|
614
|
-
}) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(Ae, { schema: de }), fe && J.length > 0 && /* @__PURE__ */ Z("div", {
|
|
615
|
-
className: "mt-2 space-y-1",
|
|
616
|
-
"data-testid": "row-actions",
|
|
617
|
-
children: J.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
618
|
-
className: "flex items-center justify-between px-2 py-1 text-xs border-b last:border-b-0",
|
|
619
|
-
children: [/* @__PURE__ */ Z("span", {
|
|
620
|
-
className: "truncate text-muted-foreground",
|
|
621
|
-
children: e.name || e.title || e.id || `Row ${t + 1}`
|
|
622
|
-
}), /* @__PURE__ */ Q("div", {
|
|
623
|
-
className: "flex items-center gap-1",
|
|
624
|
-
children: [y && /* @__PURE__ */ Q(i, {
|
|
625
|
-
variant: "ghost",
|
|
694
|
+
})
|
|
695
|
+
}),
|
|
696
|
+
!pe && /* @__PURE__ */ Q(h, {
|
|
697
|
+
className: F("pt-0", Ne ? "pb-3 px-4" : "pb-4 px-4"),
|
|
698
|
+
children: [
|
|
699
|
+
Pe && /* @__PURE__ */ Z("div", {
|
|
700
|
+
className: "mb-3",
|
|
701
|
+
children: /* @__PURE__ */ Z(x, {
|
|
702
|
+
placeholder: q("detail.filterPlaceholder"),
|
|
703
|
+
value: ue,
|
|
704
|
+
onChange: (e) => de(e.target.value),
|
|
705
|
+
className: "h-8 text-sm"
|
|
706
|
+
})
|
|
707
|
+
}),
|
|
708
|
+
M && Ee && Ee.length > 0 && B.length > 0 && /* @__PURE__ */ Z("div", {
|
|
709
|
+
className: "flex flex-wrap gap-1 mb-3",
|
|
710
|
+
children: Ee.map((e) => {
|
|
711
|
+
let t = e.accessorKey || e.field || e.name;
|
|
712
|
+
if (!t) return null;
|
|
713
|
+
let n = e.header || e.label || t, r = U === t;
|
|
714
|
+
return /* @__PURE__ */ Q(p, {
|
|
715
|
+
variant: r ? "secondary" : "ghost",
|
|
626
716
|
size: "sm",
|
|
627
|
-
className: "h-
|
|
628
|
-
onClick: () =>
|
|
629
|
-
children: [
|
|
630
|
-
|
|
631
|
-
|
|
717
|
+
className: "gap-1 h-7 text-xs",
|
|
718
|
+
onClick: () => Se(t),
|
|
719
|
+
children: [
|
|
720
|
+
/* @__PURE__ */ Z(z, { className: "h-3 w-3" }),
|
|
721
|
+
n,
|
|
722
|
+
r && (ce === "asc" ? " ↑" : " ↓")
|
|
723
|
+
]
|
|
724
|
+
}, t);
|
|
725
|
+
})
|
|
726
|
+
}),
|
|
727
|
+
re ? /* @__PURE__ */ Z("div", {
|
|
728
|
+
className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
|
|
729
|
+
children: q("detail.loading")
|
|
730
|
+
}) : Ne ? /* @__PURE__ */ Q("div", {
|
|
731
|
+
className: "flex flex-col items-center justify-center gap-2 py-6 text-sm",
|
|
732
|
+
children: [
|
|
733
|
+
/* @__PURE__ */ Z(Me, {
|
|
734
|
+
className: "h-8 w-8 text-muted-foreground/40",
|
|
735
|
+
"aria-hidden": !0
|
|
736
|
+
}),
|
|
737
|
+
/* @__PURE__ */ Z("span", {
|
|
738
|
+
className: "text-muted-foreground italic",
|
|
739
|
+
children: q("detail.noRelatedRecords")
|
|
740
|
+
}),
|
|
741
|
+
T && /* @__PURE__ */ Q(p, {
|
|
742
|
+
variant: "outline",
|
|
632
743
|
size: "sm",
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
children: [/* @__PURE__ */ Z(
|
|
636
|
-
})]
|
|
637
|
-
})]
|
|
638
|
-
}, e.id || t))
|
|
639
|
-
})] }),
|
|
640
|
-
K > 0 && ce.length > K && /* @__PURE__ */ Q("div", {
|
|
641
|
-
className: "flex items-center justify-between mt-3 pt-3 border-t",
|
|
642
|
-
children: [
|
|
643
|
-
/* @__PURE__ */ Q(i, {
|
|
644
|
-
variant: "outline",
|
|
645
|
-
size: "sm",
|
|
646
|
-
className: "h-7 text-xs gap-1",
|
|
647
|
-
disabled: P === 0,
|
|
648
|
-
onClick: () => F((e) => Math.max(0, e - 1)),
|
|
649
|
-
children: [/* @__PURE__ */ Z(ee, { className: "h-3 w-3" }), W("detail.previousPage")]
|
|
650
|
-
}),
|
|
651
|
-
/* @__PURE__ */ Z("span", {
|
|
652
|
-
className: "text-xs text-muted-foreground",
|
|
653
|
-
children: W("detail.pageOf", {
|
|
654
|
-
current: P + 1,
|
|
655
|
-
total: q
|
|
744
|
+
onClick: T,
|
|
745
|
+
className: "gap-1 h-7 text-xs mt-1",
|
|
746
|
+
children: [/* @__PURE__ */ Z(ke, { className: "h-3.5 w-3.5" }), q("detail.new")]
|
|
656
747
|
})
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
748
|
+
]
|
|
749
|
+
}) : /* @__PURE__ */ Z(He, { schema: Oe }),
|
|
750
|
+
J > 0 && ye.length > J && /* @__PURE__ */ Q("div", {
|
|
751
|
+
className: "flex items-center justify-between mt-3 pt-3 border-t",
|
|
752
|
+
children: [
|
|
753
|
+
/* @__PURE__ */ Q(p, {
|
|
754
|
+
variant: "outline",
|
|
755
|
+
size: "sm",
|
|
756
|
+
className: "h-7 text-xs gap-1",
|
|
757
|
+
disabled: H === 0,
|
|
758
|
+
onClick: () => ie((e) => Math.max(0, e - 1)),
|
|
759
|
+
children: [/* @__PURE__ */ Z(oe, { className: "h-3 w-3" }), q("detail.previousPage")]
|
|
760
|
+
}),
|
|
761
|
+
/* @__PURE__ */ Z("span", {
|
|
762
|
+
className: "text-xs text-muted-foreground",
|
|
763
|
+
children: q("detail.pageOf", {
|
|
764
|
+
current: H + 1,
|
|
765
|
+
total: be
|
|
766
|
+
})
|
|
767
|
+
}),
|
|
768
|
+
/* @__PURE__ */ Q(p, {
|
|
769
|
+
variant: "outline",
|
|
770
|
+
size: "sm",
|
|
771
|
+
className: "h-7 text-xs gap-1",
|
|
772
|
+
disabled: H >= be - 1,
|
|
773
|
+
onClick: () => ie((e) => Math.min(be - 1, e + 1)),
|
|
774
|
+
children: [q("detail.nextPage"), /* @__PURE__ */ Z(W, { className: "h-3 w-3" })]
|
|
775
|
+
})
|
|
776
|
+
]
|
|
777
|
+
}),
|
|
778
|
+
E && !Ne && J > 0 && ye.length > J && /* @__PURE__ */ Z("div", {
|
|
779
|
+
className: "mt-3 pt-3 border-t flex justify-center",
|
|
780
|
+
children: /* @__PURE__ */ Q("button", {
|
|
781
|
+
type: "button",
|
|
782
|
+
onClick: (e) => {
|
|
783
|
+
e.stopPropagation(), E();
|
|
784
|
+
},
|
|
785
|
+
className: "text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors",
|
|
786
|
+
children: [q("detail.viewAll"), /* @__PURE__ */ Z(fe, { className: "h-3 w-3" })]
|
|
665
787
|
})
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
788
|
+
})
|
|
789
|
+
]
|
|
790
|
+
}),
|
|
791
|
+
/* @__PURE__ */ Z(i, {
|
|
792
|
+
open: Y !== null,
|
|
793
|
+
onOpenChange: (e) => {
|
|
794
|
+
e || Ce(null);
|
|
795
|
+
},
|
|
796
|
+
children: /* @__PURE__ */ Q(s, { children: [/* @__PURE__ */ Q(u, { children: [/* @__PURE__ */ Z(d, { children: q("detail.deleteRowTitle", { defaultValue: "Delete record" }) }), /* @__PURE__ */ Z(c, { children: q("detail.deleteRowConfirmation") })] }), /* @__PURE__ */ Q(l, { children: [/* @__PURE__ */ Z(o, { children: q("detail.cancel", { defaultValue: "Cancel" }) }), /* @__PURE__ */ Z(a, {
|
|
797
|
+
onClick: Te,
|
|
798
|
+
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
799
|
+
children: q("detail.delete", { defaultValue: "Delete" })
|
|
800
|
+
})] })] })
|
|
801
|
+
})
|
|
802
|
+
]
|
|
670
803
|
});
|
|
671
|
-
},
|
|
672
|
-
let c = e.collapsible ?? !0, [
|
|
804
|
+
}, st = ({ group: e, data: t, className: r, objectSchema: i, objectName: a, isEditing: o = !1, onFieldChange: s }) => {
|
|
805
|
+
let c = e.collapsible ?? !0, [l, u] = n.useState(e.defaultCollapsed ?? !1), d = /* @__PURE__ */ Z("div", {
|
|
673
806
|
className: "space-y-3 sm:space-y-4",
|
|
674
|
-
children: e.sections.map((e, n) => /* @__PURE__ */ Z(
|
|
807
|
+
children: e.sections.map((e, n) => /* @__PURE__ */ Z(rt, {
|
|
675
808
|
section: e,
|
|
676
809
|
data: t,
|
|
677
810
|
objectSchema: i,
|
|
@@ -680,17 +813,17 @@ var Ge = ({ title: e, type: t, api: l, data: u = [], schema: d, columns: p, clas
|
|
|
680
813
|
onFieldChange: s
|
|
681
814
|
}, n))
|
|
682
815
|
});
|
|
683
|
-
return c ? /* @__PURE__ */ Q(
|
|
684
|
-
open: !
|
|
685
|
-
onOpenChange: (e) =>
|
|
816
|
+
return c ? /* @__PURE__ */ Q(v, {
|
|
817
|
+
open: !l,
|
|
818
|
+
onOpenChange: (e) => u(!e),
|
|
686
819
|
className: r,
|
|
687
820
|
children: [
|
|
688
|
-
/* @__PURE__ */ Z(
|
|
821
|
+
/* @__PURE__ */ Z(b, {
|
|
689
822
|
asChild: !0,
|
|
690
823
|
children: /* @__PURE__ */ Q("div", {
|
|
691
824
|
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",
|
|
692
825
|
children: [
|
|
693
|
-
Z(
|
|
826
|
+
Z(l ? W : ae, { className: "h-4 w-4 text-muted-foreground shrink-0" }),
|
|
694
827
|
e.icon && /* @__PURE__ */ Z("span", {
|
|
695
828
|
className: "text-muted-foreground",
|
|
696
829
|
children: e.icon
|
|
@@ -702,17 +835,17 @@ var Ge = ({ title: e, type: t, api: l, data: u = [], schema: d, columns: p, clas
|
|
|
702
835
|
]
|
|
703
836
|
})
|
|
704
837
|
}),
|
|
705
|
-
e.description && !
|
|
838
|
+
e.description && !l && /* @__PURE__ */ Z("p", {
|
|
706
839
|
className: "text-sm text-muted-foreground mt-1",
|
|
707
840
|
children: e.description
|
|
708
841
|
}),
|
|
709
|
-
/* @__PURE__ */ Z(
|
|
842
|
+
/* @__PURE__ */ Z(y, { children: /* @__PURE__ */ Z("div", {
|
|
710
843
|
className: "mt-3",
|
|
711
|
-
children:
|
|
844
|
+
children: d
|
|
712
845
|
}) })
|
|
713
846
|
]
|
|
714
847
|
}) : /* @__PURE__ */ Q("div", {
|
|
715
|
-
className:
|
|
848
|
+
className: F("space-y-3", r),
|
|
716
849
|
children: [
|
|
717
850
|
/* @__PURE__ */ Q("div", {
|
|
718
851
|
className: "flex items-center gap-2 pb-2 border-b",
|
|
@@ -728,32 +861,32 @@ var Ge = ({ title: e, type: t, api: l, data: u = [], schema: d, columns: p, clas
|
|
|
728
861
|
className: "text-sm text-muted-foreground",
|
|
729
862
|
children: e.description
|
|
730
863
|
}),
|
|
731
|
-
|
|
864
|
+
d
|
|
732
865
|
]
|
|
733
866
|
});
|
|
734
|
-
},
|
|
735
|
-
let { fieldLabel:
|
|
867
|
+
}, ct = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i }) => {
|
|
868
|
+
let { fieldLabel: a } = We();
|
|
736
869
|
if (!e.length || !t) return null;
|
|
737
|
-
let
|
|
870
|
+
let o = e.filter((e) => {
|
|
738
871
|
let n = t?.[e.name];
|
|
739
872
|
return n != null && n !== "";
|
|
740
873
|
});
|
|
741
|
-
return
|
|
742
|
-
className:
|
|
743
|
-
children: /* @__PURE__ */ Z(
|
|
874
|
+
return o.length === 0 ? null : /* @__PURE__ */ Z(m, {
|
|
875
|
+
className: F("bg-muted/30 border-dashed", n),
|
|
876
|
+
children: /* @__PURE__ */ Z(h, {
|
|
744
877
|
className: "py-3 px-4",
|
|
745
878
|
children: /* @__PURE__ */ Z("div", {
|
|
746
|
-
className:
|
|
747
|
-
children:
|
|
748
|
-
let n = t[e.name],
|
|
879
|
+
className: F("grid gap-4", o.length === 1 ? "grid-cols-1" : o.length === 2 ? "grid-cols-2" : o.length === 3 ? "grid-cols-3" : "grid-cols-2 md:grid-cols-4"),
|
|
880
|
+
children: o.map((e) => {
|
|
881
|
+
let n = t[e.name], o = i?.fields?.[e.name], s = e.type || o?.type, c = {
|
|
749
882
|
name: e.name,
|
|
750
883
|
label: e.label,
|
|
751
|
-
type:
|
|
752
|
-
...
|
|
753
|
-
...
|
|
754
|
-
...
|
|
755
|
-
...
|
|
756
|
-
}, l =
|
|
884
|
+
type: s || "text",
|
|
885
|
+
...o?.options && { options: o.options },
|
|
886
|
+
...o?.currency && { currency: o.currency },
|
|
887
|
+
...o?.precision !== void 0 && { precision: o.precision },
|
|
888
|
+
...o?.format && { format: o.format }
|
|
889
|
+
}, l = qe(Je(c) || s || "text");
|
|
757
890
|
return /* @__PURE__ */ Q("div", {
|
|
758
891
|
className: "flex flex-col gap-0.5",
|
|
759
892
|
children: [/* @__PURE__ */ Q("span", {
|
|
@@ -761,7 +894,7 @@ var Ge = ({ title: e, type: t, api: l, data: u = [], schema: d, columns: p, clas
|
|
|
761
894
|
children: [e.icon && /* @__PURE__ */ Z("span", {
|
|
762
895
|
className: "mr-1",
|
|
763
896
|
children: e.icon
|
|
764
|
-
}),
|
|
897
|
+
}), a(r || "", e.name, e.label)]
|
|
765
898
|
}), /* @__PURE__ */ Z("span", {
|
|
766
899
|
className: "text-sm font-semibold truncate",
|
|
767
900
|
children: /* @__PURE__ */ Z(l, {
|
|
@@ -777,7 +910,7 @@ var Ge = ({ title: e, type: t, api: l, data: u = [], schema: d, columns: p, clas
|
|
|
777
910
|
};
|
|
778
911
|
//#endregion
|
|
779
912
|
//#region src/RecordComments.tsx
|
|
780
|
-
function
|
|
913
|
+
function lt(e) {
|
|
781
914
|
try {
|
|
782
915
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
783
916
|
if (r < 1) return "just now";
|
|
@@ -790,30 +923,30 @@ function Je(e) {
|
|
|
790
923
|
return e;
|
|
791
924
|
}
|
|
792
925
|
}
|
|
793
|
-
var
|
|
794
|
-
let { t:
|
|
795
|
-
let e =
|
|
926
|
+
var ut = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: i = !1, className: a }) => {
|
|
927
|
+
let { t: o } = $(), [s, c] = n.useState(""), [l, u] = n.useState(!1), [d, f] = n.useState(""), v = n.useCallback(async () => {
|
|
928
|
+
let e = s.trim();
|
|
796
929
|
if (!(!e || !t)) {
|
|
797
|
-
|
|
930
|
+
u(!0);
|
|
798
931
|
try {
|
|
799
|
-
await t(e),
|
|
932
|
+
await t(e), c("");
|
|
800
933
|
} finally {
|
|
801
|
-
|
|
934
|
+
u(!1);
|
|
802
935
|
}
|
|
803
936
|
}
|
|
804
|
-
}, [
|
|
937
|
+
}, [s, t]), y = n.useCallback((e) => {
|
|
805
938
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), v());
|
|
806
|
-
}, [v]), b = n.useMemo(() => [...
|
|
807
|
-
let t =
|
|
939
|
+
}, [v]), b = n.useMemo(() => [...d.trim() ? e.filter((e) => {
|
|
940
|
+
let t = d.trim().toLowerCase();
|
|
808
941
|
return e.text.toLowerCase().includes(t) || e.author.toLowerCase().includes(t);
|
|
809
|
-
}) : e].sort((e, t) => e.pinned && !t.pinned ? -1 : !e.pinned && t.pinned ? 1 : 0), [e,
|
|
810
|
-
return /* @__PURE__ */ Q(
|
|
811
|
-
className:
|
|
812
|
-
children: [/* @__PURE__ */ Z(
|
|
942
|
+
}) : e].sort((e, t) => e.pinned && !t.pinned ? -1 : !e.pinned && t.pinned ? 1 : 0), [e, d]);
|
|
943
|
+
return /* @__PURE__ */ Q(m, {
|
|
944
|
+
className: F("", a),
|
|
945
|
+
children: [/* @__PURE__ */ Z(g, { children: /* @__PURE__ */ Q(_, {
|
|
813
946
|
className: "flex items-center gap-2 text-base",
|
|
814
947
|
children: [
|
|
815
948
|
/* @__PURE__ */ Z(Y, { className: "h-4 w-4" }),
|
|
816
|
-
|
|
949
|
+
o("detail.comments"),
|
|
817
950
|
/* @__PURE__ */ Q("span", {
|
|
818
951
|
className: "text-sm font-normal text-muted-foreground",
|
|
819
952
|
children: [
|
|
@@ -823,28 +956,28 @@ var Ye = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: l = !1, cl
|
|
|
823
956
|
]
|
|
824
957
|
})
|
|
825
958
|
]
|
|
826
|
-
}) }), /* @__PURE__ */ Q(
|
|
959
|
+
}) }), /* @__PURE__ */ Q(h, {
|
|
827
960
|
className: "space-y-4",
|
|
828
961
|
children: [
|
|
829
|
-
|
|
962
|
+
i && /* @__PURE__ */ Z("div", {
|
|
830
963
|
className: "flex items-center gap-2",
|
|
831
964
|
children: /* @__PURE__ */ Q("div", {
|
|
832
965
|
className: "relative flex-1",
|
|
833
966
|
children: [
|
|
834
|
-
/* @__PURE__ */ Z(
|
|
967
|
+
/* @__PURE__ */ Z(Ne, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
|
|
835
968
|
/* @__PURE__ */ Z("input", {
|
|
836
969
|
className: "w-full rounded-md border border-input bg-background pl-8 pr-8 py-1.5 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
837
|
-
placeholder:
|
|
838
|
-
value:
|
|
839
|
-
onChange: (e) =>
|
|
840
|
-
"aria-label":
|
|
970
|
+
placeholder: o("detail.searchComments"),
|
|
971
|
+
value: d,
|
|
972
|
+
onChange: (e) => f(e.target.value),
|
|
973
|
+
"aria-label": o("detail.searchComments")
|
|
841
974
|
}),
|
|
842
|
-
|
|
975
|
+
d && /* @__PURE__ */ Z("button", {
|
|
843
976
|
className: "absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
|
|
844
|
-
onClick: () =>
|
|
845
|
-
"aria-label":
|
|
977
|
+
onClick: () => f(""),
|
|
978
|
+
"aria-label": o("detail.clearSearch"),
|
|
846
979
|
type: "button",
|
|
847
|
-
children: /* @__PURE__ */ Z(
|
|
980
|
+
children: /* @__PURE__ */ Z(ze, { className: "h-3.5 w-3.5" })
|
|
848
981
|
})
|
|
849
982
|
]
|
|
850
983
|
})
|
|
@@ -853,27 +986,27 @@ var Ye = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: l = !1, cl
|
|
|
853
986
|
className: "flex gap-2",
|
|
854
987
|
children: [/* @__PURE__ */ Z("textarea", {
|
|
855
988
|
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",
|
|
856
|
-
placeholder:
|
|
857
|
-
value:
|
|
858
|
-
onChange: (e) =>
|
|
989
|
+
placeholder: o("detail.addCommentPlaceholder"),
|
|
990
|
+
value: s,
|
|
991
|
+
onChange: (e) => c(e.target.value),
|
|
859
992
|
onKeyDown: y,
|
|
860
|
-
disabled:
|
|
861
|
-
}), /* @__PURE__ */ Z(
|
|
993
|
+
disabled: l
|
|
994
|
+
}), /* @__PURE__ */ Z(p, {
|
|
862
995
|
size: "icon",
|
|
863
996
|
variant: "default",
|
|
864
997
|
onClick: v,
|
|
865
|
-
disabled: !
|
|
998
|
+
disabled: !s.trim() || l,
|
|
866
999
|
className: "shrink-0 self-end",
|
|
867
|
-
children: /* @__PURE__ */ Z(
|
|
1000
|
+
children: /* @__PURE__ */ Z(Pe, { className: "h-4 w-4" })
|
|
868
1001
|
})]
|
|
869
1002
|
}),
|
|
870
1003
|
b.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
871
1004
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
872
|
-
children:
|
|
1005
|
+
children: d.trim() ? o("detail.noMatchingComments") : o("detail.noCommentsYet")
|
|
873
1006
|
}) : /* @__PURE__ */ Z("div", {
|
|
874
1007
|
className: "space-y-3",
|
|
875
1008
|
children: b.map((e) => /* @__PURE__ */ Q("div", {
|
|
876
|
-
className:
|
|
1009
|
+
className: F("flex gap-3", e.pinned && "bg-muted/40 rounded-md p-2 -mx-2"),
|
|
877
1010
|
children: [/* @__PURE__ */ Z("div", {
|
|
878
1011
|
className: "shrink-0",
|
|
879
1012
|
children: e.avatarUrl ? /* @__PURE__ */ Z("img", {
|
|
@@ -896,11 +1029,11 @@ var Ye = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: l = !1, cl
|
|
|
896
1029
|
}),
|
|
897
1030
|
/* @__PURE__ */ Z("span", {
|
|
898
1031
|
className: "text-xs text-muted-foreground",
|
|
899
|
-
children:
|
|
1032
|
+
children: lt(e.createdAt)
|
|
900
1033
|
}),
|
|
901
1034
|
e.pinned && /* @__PURE__ */ Q("span", {
|
|
902
1035
|
className: "text-xs text-amber-600 flex items-center gap-0.5",
|
|
903
|
-
children: [/* @__PURE__ */ Z(
|
|
1036
|
+
children: [/* @__PURE__ */ Z(Oe, { className: "h-3 w-3" }), o("detail.pinned")]
|
|
904
1037
|
})
|
|
905
1038
|
]
|
|
906
1039
|
}),
|
|
@@ -912,8 +1045,8 @@ var Ye = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: l = !1, cl
|
|
|
912
1045
|
type: "button",
|
|
913
1046
|
className: "mt-1 text-xs text-muted-foreground hover:text-foreground flex items-center gap-1",
|
|
914
1047
|
onClick: () => r(e.id),
|
|
915
|
-
"aria-label": e.pinned ?
|
|
916
|
-
children: [/* @__PURE__ */ Z(
|
|
1048
|
+
"aria-label": e.pinned ? o("detail.unpin") : o("detail.pin"),
|
|
1049
|
+
children: [/* @__PURE__ */ Z(Oe, { className: "h-3 w-3" }), e.pinned ? o("detail.unpin") : o("detail.pin")]
|
|
917
1050
|
})
|
|
918
1051
|
]
|
|
919
1052
|
})]
|
|
@@ -922,20 +1055,20 @@ var Ye = ({ comments: e, onAddComment: t, onTogglePin: r, searchable: l = !1, cl
|
|
|
922
1055
|
]
|
|
923
1056
|
})]
|
|
924
1057
|
});
|
|
925
|
-
},
|
|
926
|
-
field_change:
|
|
927
|
-
create:
|
|
928
|
-
delete:
|
|
1058
|
+
}, dt = {
|
|
1059
|
+
field_change: G,
|
|
1060
|
+
create: Ae,
|
|
1061
|
+
delete: Le,
|
|
929
1062
|
comment: Y,
|
|
930
|
-
status_change:
|
|
931
|
-
},
|
|
1063
|
+
status_change: te
|
|
1064
|
+
}, ft = {
|
|
932
1065
|
field_change: "bg-blue-100 text-blue-600",
|
|
933
1066
|
create: "bg-green-100 text-green-600",
|
|
934
1067
|
delete: "bg-red-100 text-red-600",
|
|
935
1068
|
comment: "bg-purple-100 text-purple-600",
|
|
936
1069
|
status_change: "bg-amber-100 text-amber-600"
|
|
937
1070
|
};
|
|
938
|
-
function
|
|
1071
|
+
function pt(e) {
|
|
939
1072
|
try {
|
|
940
1073
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
941
1074
|
if (r < 1) return "just now";
|
|
@@ -948,58 +1081,58 @@ function Qe(e) {
|
|
|
948
1081
|
return e;
|
|
949
1082
|
}
|
|
950
1083
|
}
|
|
951
|
-
function
|
|
1084
|
+
function mt(e) {
|
|
952
1085
|
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";
|
|
953
1086
|
}
|
|
954
|
-
var
|
|
1087
|
+
var ht = {
|
|
955
1088
|
all: "All",
|
|
956
1089
|
field_change: "Field Changes",
|
|
957
1090
|
create: "Creates",
|
|
958
1091
|
delete: "Deletes",
|
|
959
1092
|
comment: "Comments",
|
|
960
1093
|
status_change: "Status Changes"
|
|
961
|
-
},
|
|
962
|
-
let [
|
|
963
|
-
return /* @__PURE__ */ Q(
|
|
964
|
-
className:
|
|
965
|
-
children: [/* @__PURE__ */ Z(
|
|
1094
|
+
}, gt = ({ activities: e, filterable: t = !1, defaultFilter: r = "all", className: i }) => {
|
|
1095
|
+
let [a, o] = n.useState(r), s = n.useMemo(() => a === "all" ? e : e.filter((e) => e.type === a), [e, a]);
|
|
1096
|
+
return /* @__PURE__ */ Q(m, {
|
|
1097
|
+
className: F("", i),
|
|
1098
|
+
children: [/* @__PURE__ */ Z(g, { children: /* @__PURE__ */ Q(_, {
|
|
966
1099
|
className: "flex items-center gap-2 text-base",
|
|
967
1100
|
children: [
|
|
968
|
-
/* @__PURE__ */ Z(
|
|
1101
|
+
/* @__PURE__ */ Z(L, { className: "h-4 w-4" }),
|
|
969
1102
|
"Activity",
|
|
970
1103
|
/* @__PURE__ */ Q("span", {
|
|
971
1104
|
className: "text-sm font-normal text-muted-foreground",
|
|
972
1105
|
children: [
|
|
973
1106
|
"(",
|
|
974
|
-
|
|
1107
|
+
s.length,
|
|
975
1108
|
")"
|
|
976
1109
|
]
|
|
977
1110
|
})
|
|
978
1111
|
]
|
|
979
|
-
}) }), /* @__PURE__ */ Q(
|
|
1112
|
+
}) }), /* @__PURE__ */ Q(h, { children: [t && /* @__PURE__ */ Z("div", {
|
|
980
1113
|
className: "flex flex-wrap gap-1.5 mb-4",
|
|
981
1114
|
role: "group",
|
|
982
1115
|
"aria-label": "Activity type filter",
|
|
983
|
-
children: Object.keys(
|
|
1116
|
+
children: Object.keys(ht).map((e) => /* @__PURE__ */ Q("button", {
|
|
984
1117
|
type: "button",
|
|
985
|
-
className:
|
|
986
|
-
onClick: () =>
|
|
987
|
-
"aria-pressed":
|
|
988
|
-
children: [e !== "all" && n.createElement(
|
|
1118
|
+
className: F("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"),
|
|
1119
|
+
onClick: () => o(e),
|
|
1120
|
+
"aria-pressed": a === e,
|
|
1121
|
+
children: [e !== "all" && n.createElement(dt[e] || G, { className: "h-3 w-3" }), ht[e]]
|
|
989
1122
|
}, e))
|
|
990
|
-
}),
|
|
1123
|
+
}), s.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
991
1124
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
992
1125
|
children: "No activity recorded"
|
|
993
1126
|
}) : /* @__PURE__ */ Q("div", {
|
|
994
1127
|
className: "relative",
|
|
995
1128
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
996
1129
|
className: "space-y-4",
|
|
997
|
-
children:
|
|
998
|
-
let t =
|
|
1130
|
+
children: s.map((e) => {
|
|
1131
|
+
let t = dt[e.type] || G;
|
|
999
1132
|
return /* @__PURE__ */ Q("div", {
|
|
1000
1133
|
className: "flex gap-3 relative",
|
|
1001
1134
|
children: [/* @__PURE__ */ Z("div", {
|
|
1002
|
-
className:
|
|
1135
|
+
className: F("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", ft[e.type] || "bg-gray-100 text-gray-600"),
|
|
1003
1136
|
children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
|
|
1004
1137
|
}), /* @__PURE__ */ Q("div", {
|
|
1005
1138
|
className: "flex-1 min-w-0 pt-1",
|
|
@@ -1013,12 +1146,12 @@ var et = {
|
|
|
1013
1146
|
" ",
|
|
1014
1147
|
/* @__PURE__ */ Z("span", {
|
|
1015
1148
|
className: "text-muted-foreground",
|
|
1016
|
-
children:
|
|
1149
|
+
children: mt(e)
|
|
1017
1150
|
})
|
|
1018
1151
|
]
|
|
1019
1152
|
}), /* @__PURE__ */ Z("p", {
|
|
1020
1153
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
1021
|
-
children:
|
|
1154
|
+
children: pt(e.timestamp)
|
|
1022
1155
|
})]
|
|
1023
1156
|
})]
|
|
1024
1157
|
}, e.id);
|
|
@@ -1026,21 +1159,21 @@ var et = {
|
|
|
1026
1159
|
})]
|
|
1027
1160
|
})] })]
|
|
1028
1161
|
});
|
|
1029
|
-
},
|
|
1030
|
-
function
|
|
1162
|
+
}, _t = 5;
|
|
1163
|
+
function vt(e, t, n, r) {
|
|
1031
1164
|
if (e && typeof e == "object") {
|
|
1032
1165
|
if (t.primaryField) {
|
|
1033
1166
|
let n = e[t.primaryField];
|
|
1034
1167
|
if (n != null && n !== "") return String(n);
|
|
1035
1168
|
}
|
|
1036
|
-
let r = n?.titleFormat;
|
|
1037
|
-
if (
|
|
1038
|
-
let t = "[-\\u2013\\u2014|/·,:]", n = !1,
|
|
1169
|
+
let r = n?.titleFormat, i = typeof r == "string" ? r : r && typeof r == "object" && typeof r.source == "string" ? r.source : void 0;
|
|
1170
|
+
if (i) {
|
|
1171
|
+
let t = "[-\\u2013\\u2014|/·,:]", n = !1, r = i.replace(/\{([^{}]+)\}/g, (t, r) => {
|
|
1039
1172
|
let i = e[r.trim()];
|
|
1040
1173
|
return i != null && i !== "" ? (n = !0, String(i)) : "\0";
|
|
1041
1174
|
});
|
|
1042
1175
|
if (n) {
|
|
1043
|
-
let e =
|
|
1176
|
+
let e = r.replace(RegExp(`\\s*${t}\\s*`, "g"), "").replace(RegExp(`\\s*${t}\\s*`, "g"), "").replace(RegExp("\0", "g"), "").replace(/\s+/g, " ").trim();
|
|
1044
1177
|
if (e) return e;
|
|
1045
1178
|
}
|
|
1046
1179
|
}
|
|
@@ -1062,21 +1195,21 @@ function rt(e, t, n, r) {
|
|
|
1062
1195
|
}
|
|
1063
1196
|
return r;
|
|
1064
1197
|
}
|
|
1065
|
-
var
|
|
1066
|
-
let [
|
|
1198
|
+
var yt = ({ schema: e, dataSource: r, className: i, onEdit: a, onDelete: o, onBack: s, inlineEdit: c = !1, onFieldSave: l, discussionSlot: u, rightRail: d, objectLabel: m, onDataLoaded: h }) => {
|
|
1199
|
+
let [g, _] = n.useState(e.data), [v, y] = n.useState(!e.data && !!(e.api && e.resourceId || r && e.objectName && e.resourceId)), [b, x] = n.useState(!1), [S, C] = n.useState(!1), [w, T] = n.useState({}), [I, L] = n.useState(null), [R, te] = n.useState(!1), { t: z } = $(), { fieldOptionLabel: B } = We();
|
|
1067
1200
|
n.useEffect(() => {
|
|
1068
|
-
|
|
1069
|
-
}, [
|
|
1070
|
-
let
|
|
1201
|
+
g && h && h(g);
|
|
1202
|
+
}, [g, h]);
|
|
1203
|
+
let ne = n.useMemo(() => {
|
|
1071
1204
|
if (e.summaryFields && e.summaryFields.length > 0) return [];
|
|
1072
1205
|
let t = [...e.sections?.flatMap((e) => e.fields) || [], ...e.fields || []], n = {};
|
|
1073
1206
|
for (let e of t) n[e.name] || (n[e.name] = e);
|
|
1074
|
-
if (
|
|
1207
|
+
if (I?.fields) for (let [e, t] of Object.entries(I.fields)) n[e] = {
|
|
1075
1208
|
...n[e] || {},
|
|
1076
1209
|
...t,
|
|
1077
1210
|
name: e
|
|
1078
1211
|
};
|
|
1079
|
-
let r = (e) =>
|
|
1212
|
+
let r = (e) => g?.[e] !== void 0 && g?.[e] !== null && g?.[e] !== "", i = [], a = [
|
|
1080
1213
|
"status",
|
|
1081
1214
|
"stage",
|
|
1082
1215
|
"state",
|
|
@@ -1091,51 +1224,51 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
|
|
|
1091
1224
|
e.summaryFields,
|
|
1092
1225
|
e.sections,
|
|
1093
1226
|
e.fields,
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
]),
|
|
1227
|
+
I,
|
|
1228
|
+
g
|
|
1229
|
+
]), re = e.summaryFields && e.summaryFields.length > 0 ? e.summaryFields : ne, V = n.useCallback(() => {
|
|
1097
1230
|
e.resourceId && navigator.clipboard.writeText(String(e.resourceId)).then(() => {
|
|
1098
|
-
|
|
1231
|
+
te(!0), setTimeout(() => te(!1), 1500);
|
|
1099
1232
|
});
|
|
1100
1233
|
}, [e.resourceId]);
|
|
1101
1234
|
n.useEffect(() => {
|
|
1102
1235
|
let n = !0;
|
|
1103
1236
|
if (e.data) {
|
|
1104
|
-
|
|
1237
|
+
_(e.data), y(!1);
|
|
1105
1238
|
return;
|
|
1106
1239
|
}
|
|
1107
|
-
if (
|
|
1108
|
-
|
|
1109
|
-
let
|
|
1110
|
-
(
|
|
1240
|
+
if (r && e.objectName && e.resourceId) {
|
|
1241
|
+
y(!0), L(null), _(null);
|
|
1242
|
+
let i = e.objectName, a = e.resourceId, o = `${i}-`, s = [...e.sections?.flatMap((e) => e.fields) || [], ...e.fields || []];
|
|
1243
|
+
(r.getObjectSchema ? r.getObjectSchema(i).catch(() => null) : Promise.resolve(null)).then((e) => {
|
|
1111
1244
|
if (!n) return;
|
|
1112
|
-
|
|
1113
|
-
let c = t(e?.fields, s), l = c.length > 0 ? { $expand: c } : void 0, u = l ?
|
|
1114
|
-
let e = String(
|
|
1115
|
-
return (l ?
|
|
1116
|
-
n && (
|
|
1245
|
+
L(e);
|
|
1246
|
+
let c = t(e?.fields, s), l = c.length > 0 ? { $expand: c } : void 0, u = l ? r.findOne(i, a, l) : r.findOne(i, a), d = () => {
|
|
1247
|
+
let e = String(a), t = e.startsWith(o) ? e.slice(o.length) : `${o}${e}`;
|
|
1248
|
+
return (l ? r.findOne(i, t, l) : r.findOne(i, t)).then((e) => {
|
|
1249
|
+
n && (_(e), y(!1));
|
|
1117
1250
|
}).catch(() => {
|
|
1118
|
-
n && (
|
|
1251
|
+
n && (_(null), y(!1));
|
|
1119
1252
|
});
|
|
1120
1253
|
};
|
|
1121
1254
|
return u.catch(() => null).then((e) => {
|
|
1122
1255
|
if (n) {
|
|
1123
1256
|
if (e) {
|
|
1124
|
-
|
|
1257
|
+
_(e), y(!1);
|
|
1125
1258
|
return;
|
|
1126
1259
|
}
|
|
1127
1260
|
return d();
|
|
1128
1261
|
}
|
|
1129
1262
|
});
|
|
1130
1263
|
}).catch((e) => {
|
|
1131
|
-
n && (console.error("Failed to fetch detail data:", e),
|
|
1264
|
+
n && (console.error("Failed to fetch detail data:", e), y(!1));
|
|
1132
1265
|
});
|
|
1133
|
-
} else e.api && e.resourceId && (
|
|
1134
|
-
n &&
|
|
1266
|
+
} else e.api && e.resourceId && (y(!0), fetch(`${e.api}/${e.resourceId}`).then((e) => e.json()).then((e) => {
|
|
1267
|
+
n && _(e?.data || e);
|
|
1135
1268
|
}).catch((e) => {
|
|
1136
1269
|
console.error("Failed to fetch detail data:", e);
|
|
1137
1270
|
}).finally(() => {
|
|
1138
|
-
n &&
|
|
1271
|
+
n && y(!1);
|
|
1139
1272
|
}));
|
|
1140
1273
|
return () => {
|
|
1141
1274
|
n = !1;
|
|
@@ -1144,59 +1277,55 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
|
|
|
1144
1277
|
e.api,
|
|
1145
1278
|
e.resourceId,
|
|
1146
1279
|
e.objectName,
|
|
1147
|
-
|
|
1280
|
+
r,
|
|
1148
1281
|
e.sections,
|
|
1149
1282
|
e.fields
|
|
1150
1283
|
]);
|
|
1151
|
-
let
|
|
1152
|
-
if (
|
|
1284
|
+
let H = n.useCallback(() => {
|
|
1285
|
+
if (s) s();
|
|
1153
1286
|
else if (e.onNavigate) {
|
|
1154
1287
|
let t = e.backUrl || (e.objectName ? `/${e.objectName}` : "/");
|
|
1155
1288
|
e.onNavigate(t, { replace: !0 });
|
|
1156
1289
|
} else e.backUrl ? window.location.href = e.backUrl : window.history.back();
|
|
1157
|
-
}, [
|
|
1158
|
-
|
|
1159
|
-
}, [
|
|
1160
|
-
let t = e.deleteConfirmation ||
|
|
1161
|
-
window.confirm(t) && (
|
|
1162
|
-
}, [
|
|
1290
|
+
}, [s, e]), U = n.useCallback(() => {
|
|
1291
|
+
a ? a() : e.onNavigate && e.editUrl ? e.onNavigate(e.editUrl) : e.onNavigate && e.objectName && e.resourceId ? e.onNavigate(`/${e.objectName}/${e.resourceId}/edit`) : e.editUrl && (window.location.href = e.editUrl);
|
|
1292
|
+
}, [a, e]), ae = n.useCallback(() => {
|
|
1293
|
+
let t = e.deleteConfirmation || z("detail.deleteConfirmation");
|
|
1294
|
+
window.confirm(t) && (o?.(), e.onNavigate && e.objectName && e.onNavigate(`/${e.objectName}`, { replace: !0 }));
|
|
1295
|
+
}, [o, e]), se = n.useCallback(() => {
|
|
1163
1296
|
navigator.share && e.objectName && e.resourceId ? navigator.share({
|
|
1164
|
-
title: e.title ||
|
|
1297
|
+
title: e.title || z("detail.details"),
|
|
1165
1298
|
text: `${e.objectName} #${e.resourceId}`,
|
|
1166
1299
|
url: window.location.href
|
|
1167
1300
|
}).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
|
|
1168
1301
|
console.log("Link copied to clipboard");
|
|
1169
1302
|
});
|
|
1170
1303
|
}, [e]), ce = n.useCallback(() => {
|
|
1171
|
-
|
|
1172
|
-
}, [
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
console.log("View history for record:", e.resourceId);
|
|
1176
|
-
}, [e]), J = n.useCallback(() => {
|
|
1177
|
-
M(!j);
|
|
1178
|
-
}, [j]), le = n.useCallback(() => {
|
|
1179
|
-
if (N) {
|
|
1180
|
-
let e = Object.entries(I);
|
|
1304
|
+
x(!b);
|
|
1305
|
+
}, [b]), le = n.useCallback(() => {
|
|
1306
|
+
if (S) {
|
|
1307
|
+
let e = Object.entries(w);
|
|
1181
1308
|
if (e.length > 0) {
|
|
1182
1309
|
let t = {
|
|
1183
|
-
...
|
|
1184
|
-
...
|
|
1310
|
+
...g,
|
|
1311
|
+
...w
|
|
1185
1312
|
};
|
|
1186
|
-
|
|
1187
|
-
|
|
1313
|
+
_(t), e.forEach(([e, n]) => {
|
|
1314
|
+
l?.(e, n, t);
|
|
1188
1315
|
});
|
|
1189
1316
|
}
|
|
1190
|
-
|
|
1317
|
+
T({});
|
|
1191
1318
|
}
|
|
1192
|
-
|
|
1319
|
+
C(!S);
|
|
1193
1320
|
}, [
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
]),
|
|
1199
|
-
|
|
1321
|
+
S,
|
|
1322
|
+
w,
|
|
1323
|
+
g,
|
|
1324
|
+
l
|
|
1325
|
+
]), ue = n.useCallback(() => {
|
|
1326
|
+
T({}), C(!1);
|
|
1327
|
+
}, []), fe = n.useCallback((e, t) => {
|
|
1328
|
+
T((n) => ({
|
|
1200
1329
|
...n,
|
|
1201
1330
|
[e]: t
|
|
1202
1331
|
}));
|
|
@@ -1209,97 +1338,50 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
|
|
|
1209
1338
|
};
|
|
1210
1339
|
return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
|
|
1211
1340
|
}, [e.recordNavigation]);
|
|
1212
|
-
let
|
|
1213
|
-
if (!e.autoDiscoverRelated || !z?.fields || e.related && e.related.length > 0) return [];
|
|
1214
|
-
let t = [], n = z.fields;
|
|
1215
|
-
for (let [e, r] of Object.entries(n)) {
|
|
1216
|
-
let n = r?.reference_to || r?.reference;
|
|
1217
|
-
r && (r.type === "lookup" || r.type === "master_detail") && n && t.push({
|
|
1218
|
-
title: r.label || e.charAt(0).toUpperCase() + e.slice(1),
|
|
1219
|
-
type: "table",
|
|
1220
|
-
objectName: n,
|
|
1221
|
-
referenceField: e
|
|
1222
|
-
});
|
|
1223
|
-
}
|
|
1224
|
-
return t;
|
|
1225
|
-
}, [
|
|
1226
|
-
e.autoDiscoverRelated,
|
|
1227
|
-
e.related,
|
|
1228
|
-
z
|
|
1229
|
-
]), de = n.useMemo(() => e.related && e.related.length > 0 ? e.related : ue.map((e) => ({
|
|
1230
|
-
title: e.title,
|
|
1231
|
-
type: e.type,
|
|
1232
|
-
api: e.objectName,
|
|
1233
|
-
data: [],
|
|
1234
|
-
referenceField: e.referenceField
|
|
1235
|
-
})), [e.related, ue]), fe = n.useMemo(() => {
|
|
1341
|
+
let K = n.useMemo(() => e.related ?? [], [e.related]), pe = n.useMemo(() => {
|
|
1236
1342
|
let t = [];
|
|
1237
|
-
t.push({
|
|
1343
|
+
return t.push({
|
|
1238
1344
|
name: "sys_share",
|
|
1239
|
-
label:
|
|
1345
|
+
label: z("detail.share"),
|
|
1240
1346
|
icon: "share-2",
|
|
1241
1347
|
type: "script",
|
|
1242
|
-
onClick:
|
|
1348
|
+
onClick: se
|
|
1243
1349
|
}), e.showEdit && t.push({
|
|
1244
1350
|
name: "sys_edit_mobile",
|
|
1245
|
-
label:
|
|
1351
|
+
label: z("detail.edit"),
|
|
1246
1352
|
icon: "edit",
|
|
1247
1353
|
type: "script",
|
|
1248
1354
|
className: "sm:hidden",
|
|
1249
|
-
onClick:
|
|
1250
|
-
}),
|
|
1355
|
+
onClick: U
|
|
1356
|
+
}), c && t.push({
|
|
1251
1357
|
name: "sys_toggle_inline_edit_mobile",
|
|
1252
|
-
label:
|
|
1358
|
+
label: z(S ? "detail.save" : "detail.editInline"),
|
|
1253
1359
|
icon: "edit",
|
|
1254
1360
|
type: "script",
|
|
1255
1361
|
className: "sm:hidden",
|
|
1256
1362
|
onClick: le
|
|
1257
|
-
});
|
|
1258
|
-
let n = t.length > 0 ? ["separator-before"] : void 0;
|
|
1259
|
-
return t.push({
|
|
1260
|
-
name: "sys_duplicate",
|
|
1261
|
-
label: U("detail.duplicate"),
|
|
1262
|
-
icon: "copy",
|
|
1263
|
-
type: "script",
|
|
1264
|
-
...n && { tags: n },
|
|
1265
|
-
onClick: ce
|
|
1266
|
-
}), t.push({
|
|
1267
|
-
name: "sys_export",
|
|
1268
|
-
label: U("detail.export"),
|
|
1269
|
-
icon: "download",
|
|
1270
|
-
type: "script",
|
|
1271
|
-
onClick: K
|
|
1272
|
-
}), t.push({
|
|
1273
|
-
name: "sys_view_history",
|
|
1274
|
-
label: U("detail.viewHistory"),
|
|
1275
|
-
icon: "history",
|
|
1276
|
-
type: "script",
|
|
1277
|
-
onClick: q
|
|
1278
1363
|
}), e.showDelete && t.push({
|
|
1279
1364
|
name: "sys_delete",
|
|
1280
|
-
label:
|
|
1365
|
+
label: z("detail.delete"),
|
|
1281
1366
|
icon: "trash-2",
|
|
1282
1367
|
type: "script",
|
|
1283
1368
|
variant: "destructive",
|
|
1284
1369
|
tags: ["separator-before"],
|
|
1285
|
-
onClick:
|
|
1370
|
+
onClick: ae
|
|
1286
1371
|
}), t;
|
|
1287
1372
|
}, [
|
|
1288
|
-
|
|
1373
|
+
z,
|
|
1289
1374
|
e.showEdit,
|
|
1290
1375
|
e.showDelete,
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1376
|
+
c,
|
|
1377
|
+
S,
|
|
1378
|
+
se,
|
|
1379
|
+
U,
|
|
1295
1380
|
le,
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
q,
|
|
1299
|
-
se
|
|
1300
|
-
]), pe = n.useMemo(() => {
|
|
1381
|
+
ae
|
|
1382
|
+
]), me = n.useMemo(() => {
|
|
1301
1383
|
let t = e.actions ?? [];
|
|
1302
|
-
if (
|
|
1384
|
+
if (pe.length === 0) return t;
|
|
1303
1385
|
let n = !1, r = t.map((e) => {
|
|
1304
1386
|
let t = e;
|
|
1305
1387
|
if (t && typeof t == "object" && t.type === "action:bar" && (!t.location || t.location === "record_header")) {
|
|
@@ -1307,7 +1389,7 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
|
|
|
1307
1389
|
let e = Array.isArray(t.systemActions) ? t.systemActions : [];
|
|
1308
1390
|
return {
|
|
1309
1391
|
...t,
|
|
1310
|
-
systemActions: [...e, ...
|
|
1392
|
+
systemActions: [...e, ...pe]
|
|
1311
1393
|
};
|
|
1312
1394
|
}
|
|
1313
1395
|
return e;
|
|
@@ -1315,134 +1397,144 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
|
|
|
1315
1397
|
return n || r.push({
|
|
1316
1398
|
type: "action:bar",
|
|
1317
1399
|
location: "record_header",
|
|
1318
|
-
systemActions:
|
|
1400
|
+
systemActions: pe
|
|
1319
1401
|
}), r;
|
|
1320
|
-
}, [e.actions,
|
|
1321
|
-
return
|
|
1322
|
-
className:
|
|
1402
|
+
}, [e.actions, pe]);
|
|
1403
|
+
return v || e.loading ? /* @__PURE__ */ Q("div", {
|
|
1404
|
+
className: F("space-y-4", i),
|
|
1323
1405
|
children: [
|
|
1324
|
-
/* @__PURE__ */ Z(
|
|
1325
|
-
/* @__PURE__ */ Z(
|
|
1326
|
-
/* @__PURE__ */ Z(
|
|
1406
|
+
/* @__PURE__ */ Z(E, { className: "h-10 w-full" }),
|
|
1407
|
+
/* @__PURE__ */ Z(E, { className: "h-64 w-full" }),
|
|
1408
|
+
/* @__PURE__ */ Z(E, { className: "h-48 w-full" })
|
|
1327
1409
|
]
|
|
1328
|
-
}) : !
|
|
1329
|
-
className:
|
|
1410
|
+
}) : !g && !e.data ? /* @__PURE__ */ Q("div", {
|
|
1411
|
+
className: F("flex flex-col items-center justify-center py-16 text-center", i),
|
|
1330
1412
|
children: [
|
|
1331
1413
|
/* @__PURE__ */ Z("p", {
|
|
1332
1414
|
className: "text-lg font-semibold",
|
|
1333
|
-
children:
|
|
1415
|
+
children: z("detail.recordNotFound")
|
|
1334
1416
|
}),
|
|
1335
1417
|
/* @__PURE__ */ Z("p", {
|
|
1336
1418
|
className: "text-sm text-muted-foreground mt-1",
|
|
1337
|
-
children:
|
|
1419
|
+
children: z("detail.recordNotFoundDescription")
|
|
1338
1420
|
}),
|
|
1339
|
-
(e.showBack ?? !0) && /* @__PURE__ */ Q(
|
|
1421
|
+
(e.showBack ?? !0) && /* @__PURE__ */ Q(p, {
|
|
1340
1422
|
variant: "outline",
|
|
1341
1423
|
size: "sm",
|
|
1342
|
-
onClick:
|
|
1424
|
+
onClick: H,
|
|
1343
1425
|
className: "mt-4 gap-2",
|
|
1344
|
-
children: [/* @__PURE__ */ Z(
|
|
1426
|
+
children: [/* @__PURE__ */ Z(ee, { className: "h-4 w-4" }), z("detail.goBack")]
|
|
1345
1427
|
})
|
|
1346
1428
|
]
|
|
1347
|
-
}) : /* @__PURE__ */ Z(
|
|
1348
|
-
className:
|
|
1429
|
+
}) : /* @__PURE__ */ Z(N, { children: /* @__PURE__ */ Q("div", {
|
|
1430
|
+
className: F("space-y-6", i),
|
|
1349
1431
|
children: [
|
|
1350
1432
|
/* @__PURE__ */ Q("div", {
|
|
1351
1433
|
className: "flex flex-col sm:flex-row items-start justify-between gap-3 sm:gap-4 pb-4 border-b",
|
|
1352
1434
|
children: [/* @__PURE__ */ Q("div", {
|
|
1353
1435
|
className: "flex items-start gap-2 sm:gap-3 flex-1 min-w-0",
|
|
1354
|
-
children: [(e.showBack ?? !0) && /* @__PURE__ */ Q(
|
|
1436
|
+
children: [(e.showBack ?? !0) && /* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
|
|
1355
1437
|
asChild: !0,
|
|
1356
|
-
children: /* @__PURE__ */ Z(
|
|
1438
|
+
children: /* @__PURE__ */ Z(p, {
|
|
1357
1439
|
variant: "ghost",
|
|
1358
1440
|
size: "icon",
|
|
1359
|
-
onClick:
|
|
1441
|
+
onClick: H,
|
|
1360
1442
|
className: "shrink-0 mt-1",
|
|
1361
|
-
children: /* @__PURE__ */ Z(
|
|
1443
|
+
children: /* @__PURE__ */ Z(ee, { className: "h-4 w-4" })
|
|
1362
1444
|
})
|
|
1363
|
-
}), /* @__PURE__ */ Z(
|
|
1445
|
+
}), /* @__PURE__ */ Z(M, { children: z("detail.back") })] }), /* @__PURE__ */ Q("div", {
|
|
1364
1446
|
className: "flex-1 min-w-0",
|
|
1365
1447
|
children: [/* @__PURE__ */ Q("div", {
|
|
1366
1448
|
className: "flex items-center gap-2 flex-wrap",
|
|
1367
1449
|
children: [
|
|
1368
1450
|
/* @__PURE__ */ Z("h1", {
|
|
1369
1451
|
className: "text-xl sm:text-2xl font-bold truncate",
|
|
1370
|
-
children:
|
|
1452
|
+
children: vt(g, e, I, z("detail.details"))
|
|
1371
1453
|
}),
|
|
1372
|
-
|
|
1373
|
-
let n =
|
|
1454
|
+
re.map((t) => {
|
|
1455
|
+
let n = g?.[t];
|
|
1374
1456
|
if (n == null || n === "") return null;
|
|
1375
|
-
let
|
|
1457
|
+
let r = (e.sections || []).flatMap((e) => e.fields).concat(e.fields || []).find((e) => e.name === t), i = I?.fields?.[t], a = r?.type || i?.type, o = String(n), s = null;
|
|
1376
1458
|
try {
|
|
1377
|
-
if (
|
|
1459
|
+
if (a === "currency") {
|
|
1378
1460
|
let e = Number(n);
|
|
1379
|
-
Number.isNaN(e) || (
|
|
1461
|
+
Number.isNaN(e) || (o = new Intl.NumberFormat(void 0, {
|
|
1380
1462
|
style: "currency",
|
|
1381
|
-
currency:
|
|
1463
|
+
currency: r?.currency || i?.currency || "USD",
|
|
1382
1464
|
maximumFractionDigits: 0
|
|
1383
1465
|
}).format(e));
|
|
1384
|
-
} else if (
|
|
1466
|
+
} else if (a === "date" || a === "datetime") {
|
|
1385
1467
|
let e = new Date(n);
|
|
1386
|
-
Number.isNaN(e.getTime()) || (
|
|
1468
|
+
Number.isNaN(e.getTime()) || (o = a === "datetime" ? e.toLocaleString(void 0, {
|
|
1387
1469
|
dateStyle: "medium",
|
|
1388
1470
|
timeStyle: "short"
|
|
1389
1471
|
}) : e.toLocaleDateString(void 0, { dateStyle: "medium" }));
|
|
1390
|
-
} else if (
|
|
1472
|
+
} else if (a === "percent") {
|
|
1391
1473
|
let e = Number(n);
|
|
1392
1474
|
if (!Number.isNaN(e)) {
|
|
1393
|
-
|
|
1475
|
+
o = `${e}%`;
|
|
1394
1476
|
let t = e <= 1 ? e * 100 : e;
|
|
1395
|
-
|
|
1477
|
+
s = Math.max(0, Math.min(100, t));
|
|
1478
|
+
}
|
|
1479
|
+
} else if (a === "select" || a === "status" || a === "multiselect") {
|
|
1480
|
+
let a = r?.options || i?.options, s = String(n);
|
|
1481
|
+
if (Array.isArray(a)) {
|
|
1482
|
+
let e = a.find((e) => String(e?.value ?? e) === String(n));
|
|
1483
|
+
e?.label && (s = e.label);
|
|
1484
|
+
} else if (a && typeof a == "object") {
|
|
1485
|
+
let e = a[String(n)];
|
|
1486
|
+
e?.label && (s = e.label);
|
|
1396
1487
|
}
|
|
1488
|
+
o = e.objectName ? B(e.objectName, t, String(n), s) : s;
|
|
1397
1489
|
}
|
|
1398
1490
|
} catch {}
|
|
1399
|
-
return
|
|
1491
|
+
return s === null ? /* @__PURE__ */ Z(f, {
|
|
1400
1492
|
variant: "secondary",
|
|
1401
1493
|
className: "text-xs bg-primary/10 text-primary border-transparent hover:bg-primary/15",
|
|
1402
|
-
"aria-label": `${t}: ${
|
|
1403
|
-
children:
|
|
1404
|
-
}, t) : /* @__PURE__ */ Q(
|
|
1494
|
+
"aria-label": `${t}: ${o}`,
|
|
1495
|
+
children: o
|
|
1496
|
+
}, t) : /* @__PURE__ */ Q(f, {
|
|
1405
1497
|
variant: "secondary",
|
|
1406
1498
|
className: "text-xs bg-primary/10 text-primary border-transparent hover:bg-primary/15 gap-1.5 pl-2 pr-2",
|
|
1407
|
-
"aria-label": `${t}: ${
|
|
1499
|
+
"aria-label": `${t}: ${o}`,
|
|
1408
1500
|
children: [/* @__PURE__ */ Z("span", {
|
|
1409
1501
|
className: "relative inline-block h-1.5 w-12 rounded-full bg-primary/20 overflow-hidden",
|
|
1410
1502
|
"aria-hidden": !0,
|
|
1411
1503
|
children: /* @__PURE__ */ Z("span", {
|
|
1412
1504
|
className: "absolute inset-y-0 left-0 rounded-full bg-primary",
|
|
1413
|
-
style: { width: `${
|
|
1505
|
+
style: { width: `${s}%` }
|
|
1414
1506
|
})
|
|
1415
|
-
}),
|
|
1507
|
+
}), o]
|
|
1416
1508
|
}, t);
|
|
1417
1509
|
}),
|
|
1418
|
-
/* @__PURE__ */ Q(
|
|
1510
|
+
/* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
|
|
1419
1511
|
asChild: !0,
|
|
1420
|
-
children: /* @__PURE__ */ Z(
|
|
1512
|
+
children: /* @__PURE__ */ Z(p, {
|
|
1421
1513
|
variant: "ghost",
|
|
1422
1514
|
size: "icon",
|
|
1423
1515
|
className: "h-6 w-6 shrink-0",
|
|
1424
|
-
onClick:
|
|
1425
|
-
"aria-label":
|
|
1426
|
-
children:
|
|
1516
|
+
onClick: ce,
|
|
1517
|
+
"aria-label": z(b ? "detail.removeFromFavorites" : "detail.addToFavorites"),
|
|
1518
|
+
children: b ? /* @__PURE__ */ Z(Ie, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z(Ie, { className: "h-4 w-4 text-muted-foreground" })
|
|
1427
1519
|
})
|
|
1428
|
-
}), /* @__PURE__ */ Z(
|
|
1520
|
+
}), /* @__PURE__ */ Z(M, { children: z(b ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
|
|
1429
1521
|
]
|
|
1430
1522
|
}), e.objectName && /* @__PURE__ */ Q("p", {
|
|
1431
1523
|
className: "text-sm text-muted-foreground mt-1 flex items-center gap-1",
|
|
1432
1524
|
children: [/* @__PURE__ */ Z("span", {
|
|
1433
1525
|
className: "font-medium",
|
|
1434
|
-
children:
|
|
1435
|
-
}), e.resourceId && /* @__PURE__ */ Q(
|
|
1526
|
+
children: m || e.objectName
|
|
1527
|
+
}), e.resourceId && /* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
|
|
1436
1528
|
asChild: !0,
|
|
1437
|
-
children: /* @__PURE__ */ Z(
|
|
1529
|
+
children: /* @__PURE__ */ Z(p, {
|
|
1438
1530
|
variant: "ghost",
|
|
1439
1531
|
size: "icon",
|
|
1440
1532
|
className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
|
|
1441
|
-
onClick:
|
|
1442
|
-
"aria-label":
|
|
1443
|
-
children:
|
|
1533
|
+
onClick: V,
|
|
1534
|
+
"aria-label": z("detail.copyRecordId", { defaultValue: "Copy record ID" }),
|
|
1535
|
+
children: R ? /* @__PURE__ */ Z(ie, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(de, { className: "h-3 w-3" })
|
|
1444
1536
|
})
|
|
1445
|
-
}), /* @__PURE__ */ Z(
|
|
1537
|
+
}), /* @__PURE__ */ Z(M, { children: R ? z("detail.copied", { defaultValue: "Copied" }) : z("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
|
|
1446
1538
|
})]
|
|
1447
1539
|
})]
|
|
1448
1540
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -1451,9 +1543,9 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
|
|
|
1451
1543
|
e.recordNavigation && /* @__PURE__ */ Q("div", {
|
|
1452
1544
|
className: "flex items-center gap-1 mr-2",
|
|
1453
1545
|
children: [
|
|
1454
|
-
/* @__PURE__ */ Q(
|
|
1546
|
+
/* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
|
|
1455
1547
|
asChild: !0,
|
|
1456
|
-
children: /* @__PURE__ */ Z(
|
|
1548
|
+
children: /* @__PURE__ */ Z(p, {
|
|
1457
1549
|
variant: "outline",
|
|
1458
1550
|
size: "icon",
|
|
1459
1551
|
className: "h-8 w-8",
|
|
@@ -1462,19 +1554,19 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
|
|
|
1462
1554
|
let t = e.recordNavigation;
|
|
1463
1555
|
t.currentIndex > 0 && t.onNavigate(t.recordIds[t.currentIndex - 1]);
|
|
1464
1556
|
},
|
|
1465
|
-
children: /* @__PURE__ */ Z(
|
|
1557
|
+
children: /* @__PURE__ */ Z(oe, { className: "h-4 w-4" })
|
|
1466
1558
|
})
|
|
1467
|
-
}), /* @__PURE__ */ Z(
|
|
1559
|
+
}), /* @__PURE__ */ Z(M, { children: z("detail.previousRecord") })] }),
|
|
1468
1560
|
/* @__PURE__ */ Z("span", {
|
|
1469
1561
|
className: "text-xs text-muted-foreground whitespace-nowrap px-1",
|
|
1470
|
-
children:
|
|
1562
|
+
children: z("detail.recordOf", {
|
|
1471
1563
|
current: e.recordNavigation.currentIndex + 1,
|
|
1472
1564
|
total: e.recordNavigation.recordIds.length
|
|
1473
1565
|
})
|
|
1474
1566
|
}),
|
|
1475
|
-
/* @__PURE__ */ Q(
|
|
1567
|
+
/* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
|
|
1476
1568
|
asChild: !0,
|
|
1477
|
-
children: /* @__PURE__ */ Z(
|
|
1569
|
+
children: /* @__PURE__ */ Z(p, {
|
|
1478
1570
|
variant: "outline",
|
|
1479
1571
|
size: "icon",
|
|
1480
1572
|
className: "h-8 w-8",
|
|
@@ -1483,97 +1575,109 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
|
|
|
1483
1575
|
let t = e.recordNavigation;
|
|
1484
1576
|
t.currentIndex < t.recordIds.length - 1 && t.onNavigate(t.recordIds[t.currentIndex + 1]);
|
|
1485
1577
|
},
|
|
1486
|
-
children: /* @__PURE__ */ Z(
|
|
1578
|
+
children: /* @__PURE__ */ Z(W, { className: "h-4 w-4" })
|
|
1487
1579
|
})
|
|
1488
|
-
}), /* @__PURE__ */ Z(
|
|
1580
|
+
}), /* @__PURE__ */ Z(M, { children: z("detail.nextRecord") })] })
|
|
1489
1581
|
]
|
|
1490
1582
|
}),
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1583
|
+
c && /* @__PURE__ */ Q(X, { children: [S && /* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
|
|
1584
|
+
asChild: !0,
|
|
1585
|
+
children: /* @__PURE__ */ Q(p, {
|
|
1586
|
+
variant: "ghost",
|
|
1587
|
+
size: "sm",
|
|
1588
|
+
onClick: ue,
|
|
1589
|
+
className: "gap-2 hidden sm:inline-flex",
|
|
1590
|
+
children: [/* @__PURE__ */ Z(ze, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1591
|
+
className: "hidden sm:inline",
|
|
1592
|
+
children: z("detail.cancel")
|
|
1593
|
+
})]
|
|
1594
|
+
})
|
|
1595
|
+
}), /* @__PURE__ */ Z(M, { children: z("detail.cancelEdit") })] }), /* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
|
|
1496
1596
|
asChild: !0,
|
|
1497
|
-
children: /* @__PURE__ */ Z(
|
|
1498
|
-
variant:
|
|
1597
|
+
children: /* @__PURE__ */ Z(p, {
|
|
1598
|
+
variant: S ? "default" : "outline",
|
|
1499
1599
|
size: "sm",
|
|
1500
1600
|
onClick: le,
|
|
1501
1601
|
className: "gap-2 hidden sm:inline-flex",
|
|
1502
|
-
children:
|
|
1602
|
+
children: S ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(ie, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1503
1603
|
className: "hidden sm:inline",
|
|
1504
|
-
children:
|
|
1505
|
-
})] }) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(
|
|
1604
|
+
children: z("detail.save")
|
|
1605
|
+
})] }) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(G, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1506
1606
|
className: "hidden sm:inline",
|
|
1507
|
-
children:
|
|
1607
|
+
children: z("detail.editInline")
|
|
1508
1608
|
})] })
|
|
1509
1609
|
})
|
|
1510
|
-
}), /* @__PURE__ */ Z(
|
|
1511
|
-
e.showEdit && /* @__PURE__ */ Q(
|
|
1610
|
+
}), /* @__PURE__ */ Z(M, { children: z(S ? "detail.saveChanges" : "detail.editFieldsInline") })] })] }),
|
|
1611
|
+
e.showEdit && /* @__PURE__ */ Q(j, { children: [/* @__PURE__ */ Z(P, {
|
|
1512
1612
|
asChild: !0,
|
|
1513
|
-
children: /* @__PURE__ */ Q(
|
|
1613
|
+
children: /* @__PURE__ */ Q(p, {
|
|
1514
1614
|
variant: "default",
|
|
1515
|
-
onClick:
|
|
1615
|
+
onClick: U,
|
|
1516
1616
|
className: "gap-2 hidden sm:inline-flex",
|
|
1517
|
-
children: [/* @__PURE__ */ Z(
|
|
1617
|
+
children: [/* @__PURE__ */ Z(G, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
1518
1618
|
className: "hidden sm:inline",
|
|
1519
|
-
children:
|
|
1619
|
+
children: z("detail.edit")
|
|
1520
1620
|
})]
|
|
1521
1621
|
})
|
|
1522
|
-
}), /* @__PURE__ */ Z(
|
|
1622
|
+
}), /* @__PURE__ */ Z(M, { children: z("detail.editRecord") })] }),
|
|
1623
|
+
me.map((e, t) => /* @__PURE__ */ Z(He, {
|
|
1624
|
+
schema: e,
|
|
1625
|
+
data: g
|
|
1626
|
+
}, `header-action-${t}`))
|
|
1523
1627
|
]
|
|
1524
1628
|
})]
|
|
1525
1629
|
}),
|
|
1526
|
-
e.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(
|
|
1630
|
+
e.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(He, {
|
|
1527
1631
|
schema: e.header,
|
|
1528
|
-
data:
|
|
1632
|
+
data: g
|
|
1529
1633
|
}) }),
|
|
1530
|
-
e.highlightFields && e.highlightFields.length > 0 && /* @__PURE__ */ Z(
|
|
1634
|
+
e.highlightFields && e.highlightFields.length > 0 && /* @__PURE__ */ Z(ct, {
|
|
1531
1635
|
fields: e.highlightFields,
|
|
1532
|
-
data:
|
|
1636
|
+
data: g,
|
|
1533
1637
|
objectName: e.objectName,
|
|
1534
|
-
objectSchema:
|
|
1638
|
+
objectSchema: I
|
|
1535
1639
|
}),
|
|
1536
1640
|
e.autoTabs && !e.tabs?.length ? (() => {
|
|
1537
|
-
let t =
|
|
1641
|
+
let t = K.length > 0, n = !!e.activities && e.activities.length > 0, i = !!u, a = /* @__PURE__ */ Q("div", {
|
|
1538
1642
|
className: "space-y-3 sm:space-y-4",
|
|
1539
1643
|
children: [
|
|
1540
|
-
e.sectionGroups && e.sectionGroups.length > 0 && e.sectionGroups.map((t, n) => /* @__PURE__ */ Z(
|
|
1644
|
+
e.sectionGroups && e.sectionGroups.length > 0 && e.sectionGroups.map((t, n) => /* @__PURE__ */ Z(st, {
|
|
1541
1645
|
group: t,
|
|
1542
1646
|
data: {
|
|
1543
|
-
...
|
|
1544
|
-
...
|
|
1647
|
+
...g,
|
|
1648
|
+
...w
|
|
1545
1649
|
},
|
|
1546
|
-
objectSchema:
|
|
1650
|
+
objectSchema: I,
|
|
1547
1651
|
objectName: e.objectName,
|
|
1548
|
-
isEditing:
|
|
1549
|
-
onFieldChange:
|
|
1652
|
+
isEditing: S,
|
|
1653
|
+
onFieldChange: fe
|
|
1550
1654
|
}, n)),
|
|
1551
|
-
e.sections && e.sections.length > 0 && e.sections.map((t, n) => /* @__PURE__ */ Z(
|
|
1655
|
+
e.sections && e.sections.length > 0 && e.sections.map((t, n) => /* @__PURE__ */ Z(rt, {
|
|
1552
1656
|
section: t,
|
|
1553
1657
|
data: {
|
|
1554
|
-
...
|
|
1555
|
-
...
|
|
1658
|
+
...g,
|
|
1659
|
+
...w
|
|
1556
1660
|
},
|
|
1557
|
-
objectSchema:
|
|
1661
|
+
objectSchema: I,
|
|
1558
1662
|
objectName: e.objectName,
|
|
1559
|
-
isEditing:
|
|
1560
|
-
onFieldChange:
|
|
1663
|
+
isEditing: S,
|
|
1664
|
+
onFieldChange: fe
|
|
1561
1665
|
}, n)),
|
|
1562
|
-
e.fields && e.fields.length > 0 && !e.sections?.length && /* @__PURE__ */ Z(
|
|
1666
|
+
e.fields && e.fields.length > 0 && !e.sections?.length && /* @__PURE__ */ Z(rt, {
|
|
1563
1667
|
section: {
|
|
1564
1668
|
fields: e.fields,
|
|
1565
1669
|
columns: e.columns
|
|
1566
1670
|
},
|
|
1567
1671
|
data: {
|
|
1568
|
-
...
|
|
1569
|
-
...
|
|
1672
|
+
...g,
|
|
1673
|
+
...w
|
|
1570
1674
|
},
|
|
1571
|
-
objectSchema:
|
|
1675
|
+
objectSchema: I,
|
|
1572
1676
|
objectName: e.objectName,
|
|
1573
|
-
isEditing:
|
|
1574
|
-
onFieldChange:
|
|
1677
|
+
isEditing: S,
|
|
1678
|
+
onFieldChange: fe
|
|
1575
1679
|
}),
|
|
1576
|
-
e.comments && /* @__PURE__ */ Z(
|
|
1680
|
+
e.comments && /* @__PURE__ */ Z(ut, {
|
|
1577
1681
|
comments: e.comments,
|
|
1578
1682
|
onAddComment: e.onAddComment
|
|
1579
1683
|
})
|
|
@@ -1581,245 +1685,406 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
|
|
|
1581
1685
|
});
|
|
1582
1686
|
return !t && !n && !i ? /* @__PURE__ */ Z("div", {
|
|
1583
1687
|
className: "mt-2",
|
|
1584
|
-
children:
|
|
1585
|
-
}) : /* @__PURE__ */ Q(
|
|
1688
|
+
children: a
|
|
1689
|
+
}) : /* @__PURE__ */ Q(D, {
|
|
1586
1690
|
defaultValue: "details",
|
|
1587
1691
|
className: "w-full",
|
|
1588
1692
|
children: [
|
|
1589
|
-
/* @__PURE__ */ Q(
|
|
1693
|
+
/* @__PURE__ */ Q(k, {
|
|
1590
1694
|
className: "w-full justify-start border-b rounded-none bg-transparent p-0",
|
|
1591
1695
|
children: [
|
|
1592
|
-
/* @__PURE__ */ Z(
|
|
1696
|
+
/* @__PURE__ */ Z(A, {
|
|
1593
1697
|
value: "details",
|
|
1594
1698
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
1595
|
-
children:
|
|
1699
|
+
children: z("detail.details")
|
|
1596
1700
|
}),
|
|
1597
|
-
t && /* @__PURE__ */ Z(
|
|
1701
|
+
t && /* @__PURE__ */ Z(A, {
|
|
1598
1702
|
value: "related",
|
|
1599
1703
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
1600
1704
|
children: /* @__PURE__ */ Q("span", {
|
|
1601
1705
|
className: "flex items-center gap-1.5",
|
|
1602
|
-
children: [
|
|
1706
|
+
children: [z("detail.related"), /* @__PURE__ */ Z(f, {
|
|
1603
1707
|
variant: "secondary",
|
|
1604
1708
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
1605
|
-
children:
|
|
1709
|
+
children: K.length
|
|
1606
1710
|
})]
|
|
1607
1711
|
})
|
|
1608
1712
|
}),
|
|
1609
|
-
n && /* @__PURE__ */ Z(
|
|
1713
|
+
n && /* @__PURE__ */ Z(A, {
|
|
1610
1714
|
value: "activity",
|
|
1611
1715
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
1612
1716
|
children: /* @__PURE__ */ Q("span", {
|
|
1613
1717
|
className: "flex items-center gap-1.5",
|
|
1614
|
-
children: [
|
|
1718
|
+
children: [z("detail.activity"), /* @__PURE__ */ Z(f, {
|
|
1615
1719
|
variant: "secondary",
|
|
1616
1720
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
1617
1721
|
children: e.activities.length
|
|
1618
1722
|
})]
|
|
1619
1723
|
})
|
|
1620
1724
|
}),
|
|
1621
|
-
i && /* @__PURE__ */ Z(
|
|
1725
|
+
i && /* @__PURE__ */ Z(A, {
|
|
1622
1726
|
value: "discussion",
|
|
1623
1727
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
1624
|
-
children:
|
|
1728
|
+
children: z("detail.discussion", { defaultValue: "Discussion" })
|
|
1625
1729
|
})
|
|
1626
1730
|
]
|
|
1627
1731
|
}),
|
|
1628
|
-
/* @__PURE__ */ Z(
|
|
1732
|
+
/* @__PURE__ */ Z(O, {
|
|
1629
1733
|
value: "details",
|
|
1630
1734
|
className: "mt-4",
|
|
1631
|
-
children:
|
|
1735
|
+
children: a
|
|
1632
1736
|
}),
|
|
1633
|
-
t && /* @__PURE__ */ Z(
|
|
1737
|
+
t && /* @__PURE__ */ Z(O, {
|
|
1634
1738
|
value: "related",
|
|
1635
1739
|
className: "mt-4",
|
|
1636
1740
|
children: /* @__PURE__ */ Z("div", {
|
|
1637
1741
|
className: "space-y-3",
|
|
1638
|
-
children:
|
|
1742
|
+
children: K.map((e, t) => /* @__PURE__ */ Z(ot, {
|
|
1639
1743
|
title: e.title,
|
|
1640
1744
|
type: e.type,
|
|
1641
1745
|
api: e.api,
|
|
1642
1746
|
data: e.data,
|
|
1643
1747
|
columns: e.columns,
|
|
1644
|
-
dataSource:
|
|
1748
|
+
dataSource: r,
|
|
1645
1749
|
objectName: e.api,
|
|
1646
1750
|
referenceField: e.referenceField,
|
|
1647
1751
|
icon: e.icon,
|
|
1752
|
+
onNew: e.onNew,
|
|
1753
|
+
onViewAll: e.onViewAll,
|
|
1754
|
+
onRowClick: e.onRowClick,
|
|
1755
|
+
onRowEdit: e.onRowEdit,
|
|
1756
|
+
onRowDelete: e.onRowDelete,
|
|
1648
1757
|
collapsible: !0,
|
|
1649
|
-
pageSize:
|
|
1758
|
+
pageSize: _t
|
|
1650
1759
|
}, t))
|
|
1651
1760
|
})
|
|
1652
1761
|
}),
|
|
1653
|
-
n && /* @__PURE__ */ Z(
|
|
1762
|
+
n && /* @__PURE__ */ Z(O, {
|
|
1654
1763
|
value: "activity",
|
|
1655
1764
|
className: "mt-4",
|
|
1656
|
-
children: /* @__PURE__ */ Z(
|
|
1765
|
+
children: /* @__PURE__ */ Z(gt, { activities: e.activities })
|
|
1657
1766
|
}),
|
|
1658
|
-
i && /* @__PURE__ */ Z(
|
|
1767
|
+
i && /* @__PURE__ */ Z(O, {
|
|
1659
1768
|
value: "discussion",
|
|
1660
1769
|
className: "mt-4",
|
|
1661
|
-
children:
|
|
1770
|
+
children: u
|
|
1662
1771
|
})
|
|
1663
1772
|
]
|
|
1664
1773
|
});
|
|
1665
1774
|
})() : /* @__PURE__ */ Q(X, { children: [
|
|
1666
1775
|
e.sectionGroups && e.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
|
|
1667
1776
|
className: "space-y-3 sm:space-y-4",
|
|
1668
|
-
children: e.sectionGroups.map((t, n) => /* @__PURE__ */ Z(
|
|
1777
|
+
children: e.sectionGroups.map((t, n) => /* @__PURE__ */ Z(st, {
|
|
1669
1778
|
group: t,
|
|
1670
1779
|
data: {
|
|
1671
|
-
...
|
|
1672
|
-
...
|
|
1780
|
+
...g,
|
|
1781
|
+
...w
|
|
1673
1782
|
},
|
|
1674
|
-
objectSchema:
|
|
1783
|
+
objectSchema: I,
|
|
1675
1784
|
objectName: e.objectName,
|
|
1676
|
-
isEditing:
|
|
1677
|
-
onFieldChange:
|
|
1785
|
+
isEditing: S,
|
|
1786
|
+
onFieldChange: fe
|
|
1678
1787
|
}, n))
|
|
1679
1788
|
}),
|
|
1680
1789
|
e.sections && e.sections.length > 0 && /* @__PURE__ */ Z("div", {
|
|
1681
1790
|
className: "space-y-3 sm:space-y-4",
|
|
1682
|
-
children: e.sections.map((t, n) => /* @__PURE__ */ Z(
|
|
1791
|
+
children: e.sections.map((t, n) => /* @__PURE__ */ Z(rt, {
|
|
1683
1792
|
section: t,
|
|
1684
1793
|
data: {
|
|
1685
|
-
...
|
|
1686
|
-
...
|
|
1794
|
+
...g,
|
|
1795
|
+
...w
|
|
1687
1796
|
},
|
|
1688
|
-
objectSchema:
|
|
1797
|
+
objectSchema: I,
|
|
1689
1798
|
objectName: e.objectName,
|
|
1690
|
-
isEditing:
|
|
1691
|
-
onFieldChange:
|
|
1799
|
+
isEditing: S,
|
|
1800
|
+
onFieldChange: fe
|
|
1692
1801
|
}, n))
|
|
1693
1802
|
}),
|
|
1694
|
-
e.fields && e.fields.length > 0 && !e.sections?.length && /* @__PURE__ */ Z(
|
|
1803
|
+
e.fields && e.fields.length > 0 && !e.sections?.length && /* @__PURE__ */ Z(rt, {
|
|
1695
1804
|
section: {
|
|
1696
1805
|
fields: e.fields,
|
|
1697
1806
|
columns: e.columns
|
|
1698
1807
|
},
|
|
1699
1808
|
data: {
|
|
1700
|
-
...
|
|
1701
|
-
...
|
|
1809
|
+
...g,
|
|
1810
|
+
...w
|
|
1702
1811
|
},
|
|
1703
|
-
objectSchema:
|
|
1812
|
+
objectSchema: I,
|
|
1704
1813
|
objectName: e.objectName,
|
|
1705
|
-
isEditing:
|
|
1706
|
-
onFieldChange:
|
|
1814
|
+
isEditing: S,
|
|
1815
|
+
onFieldChange: fe
|
|
1707
1816
|
}),
|
|
1708
|
-
e.tabs && e.tabs.length > 0 && /* @__PURE__ */ Z(
|
|
1817
|
+
e.tabs && e.tabs.length > 0 && /* @__PURE__ */ Z(it, {
|
|
1709
1818
|
tabs: e.tabs,
|
|
1710
|
-
data:
|
|
1819
|
+
data: g
|
|
1711
1820
|
}),
|
|
1712
|
-
|
|
1821
|
+
K.length > 0 && /* @__PURE__ */ Q("div", {
|
|
1713
1822
|
className: "space-y-3",
|
|
1714
1823
|
children: [/* @__PURE__ */ Z("h2", {
|
|
1715
1824
|
className: "text-lg font-semibold",
|
|
1716
|
-
children:
|
|
1717
|
-
}),
|
|
1825
|
+
children: z("detail.related")
|
|
1826
|
+
}), K.map((e, t) => /* @__PURE__ */ Z(ot, {
|
|
1718
1827
|
title: e.title,
|
|
1719
1828
|
type: e.type,
|
|
1720
1829
|
api: e.api,
|
|
1721
1830
|
data: e.data,
|
|
1722
1831
|
columns: e.columns,
|
|
1723
|
-
dataSource:
|
|
1832
|
+
dataSource: r,
|
|
1724
1833
|
objectName: e.api,
|
|
1725
1834
|
referenceField: e.referenceField,
|
|
1726
1835
|
icon: e.icon,
|
|
1836
|
+
onNew: e.onNew,
|
|
1837
|
+
onViewAll: e.onViewAll,
|
|
1838
|
+
onRowClick: e.onRowClick,
|
|
1839
|
+
onRowEdit: e.onRowEdit,
|
|
1840
|
+
onRowDelete: e.onRowDelete,
|
|
1727
1841
|
collapsible: !0,
|
|
1728
|
-
pageSize:
|
|
1842
|
+
pageSize: _t
|
|
1729
1843
|
}, t))]
|
|
1730
1844
|
}),
|
|
1731
|
-
e.comments && /* @__PURE__ */ Z(
|
|
1845
|
+
e.comments && /* @__PURE__ */ Z(ut, {
|
|
1732
1846
|
comments: e.comments,
|
|
1733
1847
|
onAddComment: e.onAddComment
|
|
1734
1848
|
}),
|
|
1735
|
-
e.activities && e.activities.length > 0 && /* @__PURE__ */ Z(
|
|
1849
|
+
e.activities && e.activities.length > 0 && /* @__PURE__ */ Z(gt, { activities: e.activities })
|
|
1736
1850
|
] }),
|
|
1737
|
-
e.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(
|
|
1851
|
+
e.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(He, {
|
|
1738
1852
|
schema: e.footer,
|
|
1739
|
-
data:
|
|
1853
|
+
data: g
|
|
1740
1854
|
}) })
|
|
1741
1855
|
]
|
|
1742
1856
|
}) });
|
|
1743
|
-
},
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1857
|
+
}, bt = new Set([
|
|
1858
|
+
"id",
|
|
1859
|
+
"_id",
|
|
1860
|
+
"__v",
|
|
1861
|
+
"created_at",
|
|
1862
|
+
"updated_at",
|
|
1863
|
+
"createdAt",
|
|
1864
|
+
"updatedAt",
|
|
1865
|
+
"created_by",
|
|
1866
|
+
"updated_by",
|
|
1867
|
+
"organization_id",
|
|
1868
|
+
"tenant_id",
|
|
1869
|
+
"owner_id",
|
|
1870
|
+
"deleted_at",
|
|
1871
|
+
"is_deleted"
|
|
1872
|
+
]), xt = 480, St = 95;
|
|
1873
|
+
function Ct({ 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 = bt, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
|
|
1874
|
+
let { t: g } = $(), _ = `objectui.drawerWidth.${a}`, [v, y] = r.useState(() => {
|
|
1875
|
+
if (typeof window > "u" || !m) return null;
|
|
1876
|
+
try {
|
|
1877
|
+
let e = window.localStorage.getItem(_);
|
|
1878
|
+
if (e) {
|
|
1879
|
+
let t = parseInt(e, 10);
|
|
1880
|
+
if (Number.isFinite(t) && t >= xt) return t;
|
|
1881
|
+
}
|
|
1882
|
+
} catch {}
|
|
1883
|
+
return null;
|
|
1884
|
+
}), b = r.useMemo(() => m && v != null ? `${v}px` : typeof l == "number" ? `${l}px` : l, [
|
|
1885
|
+
m,
|
|
1886
|
+
v,
|
|
1887
|
+
l
|
|
1888
|
+
]), x = b ? {
|
|
1889
|
+
width: b,
|
|
1890
|
+
maxWidth: b
|
|
1891
|
+
} : void 0, E = r.useRef(null), D = r.useCallback((e) => {
|
|
1892
|
+
if (!m) return;
|
|
1893
|
+
e.preventDefault();
|
|
1894
|
+
let t = v ?? (typeof window < "u" ? Math.min(window.innerWidth * .6, 960) : 720);
|
|
1895
|
+
E.current = {
|
|
1896
|
+
startX: e.clientX,
|
|
1897
|
+
startWidth: t
|
|
1898
|
+
};
|
|
1899
|
+
let n = (e) => {
|
|
1900
|
+
let t = E.current;
|
|
1901
|
+
if (!t) return;
|
|
1902
|
+
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * St / 100 : 1600, i = Math.min(r, Math.max(xt, t.startWidth + n));
|
|
1903
|
+
y(Math.round(i));
|
|
1904
|
+
}, r = () => {
|
|
1905
|
+
E.current, E.current = null, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r);
|
|
1906
|
+
try {
|
|
1907
|
+
y((e) => (e != null && window.localStorage.setItem(_, String(e)), e));
|
|
1908
|
+
} catch {}
|
|
1909
|
+
};
|
|
1910
|
+
window.addEventListener("pointermove", n), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", r);
|
|
1911
|
+
}, [
|
|
1912
|
+
m,
|
|
1913
|
+
v,
|
|
1914
|
+
_
|
|
1915
|
+
]), O = c?.fields ?? {}, k = (Object.keys(O).length ? Object.keys(O) : Object.keys(i)).filter((e) => !d.has(e) && !e.startsWith("__")).filter((e) => e in i).map((e) => {
|
|
1916
|
+
let t = O[e] || {}, n = t.type === "lookup" || t.type === "master_detail" || t.type === "reference";
|
|
1917
|
+
return {
|
|
1918
|
+
name: e,
|
|
1919
|
+
label: t.label,
|
|
1920
|
+
type: t.type,
|
|
1921
|
+
readonly: !!t.readonly || n,
|
|
1922
|
+
options: t.options,
|
|
1923
|
+
currency: t.currency,
|
|
1924
|
+
precision: t.precision,
|
|
1925
|
+
format: t.format,
|
|
1926
|
+
reference_to: t.reference_to ?? t.referenceTo ?? t.target,
|
|
1927
|
+
reference_field: t.reference_field ?? t.referenceField,
|
|
1928
|
+
required: t.required,
|
|
1929
|
+
validation: t.validation,
|
|
1930
|
+
placeholder: t.placeholder,
|
|
1931
|
+
description: t.description
|
|
1932
|
+
};
|
|
1933
|
+
});
|
|
1934
|
+
return /* @__PURE__ */ Z(S, {
|
|
1935
|
+
open: e,
|
|
1936
|
+
onOpenChange: (e) => {
|
|
1937
|
+
e || t();
|
|
1938
|
+
},
|
|
1939
|
+
children: /* @__PURE__ */ Q(C, {
|
|
1940
|
+
side: "right",
|
|
1941
|
+
className: "w-full overflow-y-auto p-0 sm:!max-w-none",
|
|
1942
|
+
style: x,
|
|
1943
|
+
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
1944
|
+
children: [
|
|
1945
|
+
m && /* @__PURE__ */ Z("div", {
|
|
1946
|
+
role: "separator",
|
|
1947
|
+
"aria-orientation": "vertical",
|
|
1948
|
+
"aria-label": "Resize drawer",
|
|
1949
|
+
onPointerDown: D,
|
|
1950
|
+
className: "hidden sm:block absolute left-0 top-0 h-full w-1.5 cursor-col-resize select-none bg-transparent hover:bg-primary/30 active:bg-primary/50 transition-colors z-10"
|
|
1951
|
+
}),
|
|
1952
|
+
/* @__PURE__ */ Z(w, {
|
|
1953
|
+
className: "sr-only",
|
|
1954
|
+
children: /* @__PURE__ */ Z(T, { children: n })
|
|
1955
|
+
}),
|
|
1956
|
+
/* @__PURE__ */ Z("div", {
|
|
1957
|
+
className: "px-6 pt-6 pb-6",
|
|
1958
|
+
children: /* @__PURE__ */ Z(yt, {
|
|
1959
|
+
dataSource: s,
|
|
1960
|
+
inlineEdit: !0,
|
|
1961
|
+
schema: {
|
|
1962
|
+
type: "detail-view",
|
|
1963
|
+
objectName: a,
|
|
1964
|
+
resourceId: String(o),
|
|
1965
|
+
data: i,
|
|
1966
|
+
showDelete: !0,
|
|
1967
|
+
columns: u,
|
|
1968
|
+
fields: k,
|
|
1969
|
+
actions: h ? [{
|
|
1970
|
+
type: "action:bar",
|
|
1971
|
+
location: "record_header",
|
|
1972
|
+
systemActions: [{
|
|
1973
|
+
name: "sys_open_new_tab",
|
|
1974
|
+
label: g("detail.openInNewTab"),
|
|
1975
|
+
icon: "external-link",
|
|
1976
|
+
type: "script",
|
|
1977
|
+
onClick: () => window.open(h, "_blank", "noopener")
|
|
1978
|
+
}]
|
|
1979
|
+
}] : void 0
|
|
1980
|
+
},
|
|
1981
|
+
onFieldSave: async (e, t) => {
|
|
1982
|
+
try {
|
|
1983
|
+
await f?.(e, t);
|
|
1984
|
+
} catch (e) {
|
|
1985
|
+
console.error("[RecordDetailDrawer] inline field save failed:", e);
|
|
1986
|
+
}
|
|
1987
|
+
},
|
|
1988
|
+
onDelete: async () => {
|
|
1989
|
+
try {
|
|
1990
|
+
await p?.(), t();
|
|
1991
|
+
} catch (e) {
|
|
1992
|
+
console.error("[RecordDetailDrawer] delete failed:", e);
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
})
|
|
1996
|
+
})
|
|
1997
|
+
]
|
|
1998
|
+
})
|
|
1999
|
+
});
|
|
2000
|
+
}
|
|
2001
|
+
function wt(e, t) {
|
|
2002
|
+
if (typeof window > "u") return null;
|
|
2003
|
+
let n = window.location.pathname, r = `/${e}`, i = n.indexOf(r);
|
|
2004
|
+
return `${i >= 0 ? n.slice(0, i) : n.replace(/\/$/, "")}/${e}/record/${encodeURIComponent(String(t))}`;
|
|
2005
|
+
}
|
|
2006
|
+
//#endregion
|
|
2007
|
+
//#region src/InlineCreateRelated.tsx
|
|
2008
|
+
var Tt = ({ objectName: e, relationshipField: t, fields: r, onCreateRecord: i, onLinkRecord: a, onSearch: o, existingRecords: s = [], className: c }) => {
|
|
2009
|
+
let [l, u] = n.useState(!1), [d, f] = n.useState("create"), [v, y] = n.useState({}), [b, S] = n.useState(""), [C, w] = n.useState(s), [T, E] = n.useState(!1), [j, M] = n.useState(!1), N = n.useMemo(() => {
|
|
2010
|
+
if (!b.trim()) return C;
|
|
2011
|
+
let e = b.toLowerCase();
|
|
2012
|
+
return C.filter((t) => t.label.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e));
|
|
2013
|
+
}, [b, C]), P = n.useCallback(async (e) => {
|
|
2014
|
+
if (S(e), o && e.trim().length >= 2) {
|
|
2015
|
+
M(!0);
|
|
1751
2016
|
try {
|
|
1752
|
-
|
|
2017
|
+
w(await o(e));
|
|
1753
2018
|
} finally {
|
|
1754
|
-
|
|
2019
|
+
M(!1);
|
|
1755
2020
|
}
|
|
1756
2021
|
}
|
|
1757
|
-
}, [
|
|
1758
|
-
|
|
2022
|
+
}, [o]), I = n.useCallback((e, t) => {
|
|
2023
|
+
y((n) => ({
|
|
1759
2024
|
...n,
|
|
1760
2025
|
[e]: t
|
|
1761
2026
|
}));
|
|
1762
|
-
}, []),
|
|
1763
|
-
if (
|
|
1764
|
-
|
|
2027
|
+
}, []), L = n.useCallback(async () => {
|
|
2028
|
+
if (i) {
|
|
2029
|
+
E(!0);
|
|
1765
2030
|
try {
|
|
1766
|
-
await
|
|
1767
|
-
...
|
|
2031
|
+
await i({
|
|
2032
|
+
...v,
|
|
1768
2033
|
[t]: !0
|
|
1769
|
-
}),
|
|
2034
|
+
}), y({}), u(!1);
|
|
1770
2035
|
} finally {
|
|
1771
|
-
|
|
2036
|
+
E(!1);
|
|
1772
2037
|
}
|
|
1773
2038
|
}
|
|
1774
2039
|
}, [
|
|
1775
|
-
|
|
1776
|
-
|
|
2040
|
+
i,
|
|
2041
|
+
v,
|
|
1777
2042
|
t
|
|
1778
|
-
]),
|
|
1779
|
-
if (
|
|
1780
|
-
|
|
2043
|
+
]), ee = n.useCallback(async (e) => {
|
|
2044
|
+
if (a) {
|
|
2045
|
+
E(!0);
|
|
1781
2046
|
try {
|
|
1782
|
-
await
|
|
2047
|
+
await a(e), S(""), u(!1);
|
|
1783
2048
|
} finally {
|
|
1784
|
-
|
|
2049
|
+
E(!1);
|
|
1785
2050
|
}
|
|
1786
2051
|
}
|
|
1787
|
-
}, [
|
|
1788
|
-
return
|
|
1789
|
-
className:
|
|
1790
|
-
children: [/* @__PURE__ */ Z(
|
|
2052
|
+
}, [a]), R = n.useMemo(() => r.filter((e) => e.required).every((e) => v[e.name]?.toString().trim()), [r, v]);
|
|
2053
|
+
return l ? /* @__PURE__ */ Q(m, {
|
|
2054
|
+
className: F("", c),
|
|
2055
|
+
children: [/* @__PURE__ */ Z(g, {
|
|
1791
2056
|
className: "pb-3",
|
|
1792
|
-
children: /* @__PURE__ */ Q(
|
|
2057
|
+
children: /* @__PURE__ */ Q(_, {
|
|
1793
2058
|
className: "flex items-center justify-between text-sm",
|
|
1794
2059
|
children: [/* @__PURE__ */ Q("span", { children: [
|
|
1795
|
-
|
|
2060
|
+
d === "create" ? "Create" : "Link",
|
|
1796
2061
|
" ",
|
|
1797
2062
|
e
|
|
1798
|
-
] }), /* @__PURE__ */ Z(
|
|
2063
|
+
] }), /* @__PURE__ */ Z(p, {
|
|
1799
2064
|
variant: "ghost",
|
|
1800
2065
|
size: "icon",
|
|
1801
2066
|
className: "h-6 w-6",
|
|
1802
|
-
onClick: () =>
|
|
1803
|
-
children: /* @__PURE__ */ Z(
|
|
2067
|
+
onClick: () => u(!1),
|
|
2068
|
+
children: /* @__PURE__ */ Z(ze, { className: "h-3.5 w-3.5" })
|
|
1804
2069
|
})]
|
|
1805
2070
|
})
|
|
1806
|
-
}), /* @__PURE__ */ Z(
|
|
1807
|
-
value:
|
|
1808
|
-
onValueChange:
|
|
2071
|
+
}), /* @__PURE__ */ Z(h, { children: /* @__PURE__ */ Q(D, {
|
|
2072
|
+
value: d,
|
|
2073
|
+
onValueChange: f,
|
|
1809
2074
|
children: [
|
|
1810
|
-
/* @__PURE__ */ Q(
|
|
2075
|
+
/* @__PURE__ */ Q(k, {
|
|
1811
2076
|
className: "mb-3 w-full",
|
|
1812
|
-
children: [
|
|
2077
|
+
children: [i && /* @__PURE__ */ Q(A, {
|
|
1813
2078
|
value: "create",
|
|
1814
2079
|
className: "flex-1 gap-1.5",
|
|
1815
|
-
children: [/* @__PURE__ */ Z(
|
|
1816
|
-
}),
|
|
2080
|
+
children: [/* @__PURE__ */ Z(ke, { className: "h-3.5 w-3.5" }), "Create New"]
|
|
2081
|
+
}), a && /* @__PURE__ */ Q(A, {
|
|
1817
2082
|
value: "link",
|
|
1818
2083
|
className: "flex-1 gap-1.5",
|
|
1819
|
-
children: [/* @__PURE__ */ Z(
|
|
2084
|
+
children: [/* @__PURE__ */ Z(J, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
1820
2085
|
})]
|
|
1821
2086
|
}),
|
|
1822
|
-
|
|
2087
|
+
i && /* @__PURE__ */ Q(O, {
|
|
1823
2088
|
value: "create",
|
|
1824
2089
|
className: "space-y-3 mt-0",
|
|
1825
2090
|
children: [r.map((e) => /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("label", {
|
|
@@ -1828,52 +2093,52 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
|
|
|
1828
2093
|
className: "text-destructive ml-0.5",
|
|
1829
2094
|
children: "*"
|
|
1830
2095
|
})]
|
|
1831
|
-
}), /* @__PURE__ */ Z(
|
|
2096
|
+
}), /* @__PURE__ */ Z(x, {
|
|
1832
2097
|
type: e.type === "number" ? "number" : e.type === "date" ? "date" : "text",
|
|
1833
2098
|
placeholder: e.placeholder || `Enter ${e.label.toLowerCase()}`,
|
|
1834
|
-
value:
|
|
2099
|
+
value: v[e.name] || "",
|
|
1835
2100
|
onChange: (t) => I(e.name, t.target.value),
|
|
1836
2101
|
className: "h-8 text-sm"
|
|
1837
2102
|
})] }, e.name)), /* @__PURE__ */ Q("div", {
|
|
1838
2103
|
className: "flex justify-end gap-2 pt-1",
|
|
1839
|
-
children: [/* @__PURE__ */ Z(
|
|
2104
|
+
children: [/* @__PURE__ */ Z(p, {
|
|
1840
2105
|
variant: "ghost",
|
|
1841
2106
|
size: "sm",
|
|
1842
|
-
onClick: () =>
|
|
2107
|
+
onClick: () => u(!1),
|
|
1843
2108
|
children: "Cancel"
|
|
1844
|
-
}), /* @__PURE__ */ Q(
|
|
2109
|
+
}), /* @__PURE__ */ Q(p, {
|
|
1845
2110
|
size: "sm",
|
|
1846
|
-
onClick:
|
|
1847
|
-
disabled: !R ||
|
|
2111
|
+
onClick: L,
|
|
2112
|
+
disabled: !R || T,
|
|
1848
2113
|
className: "gap-1.5",
|
|
1849
|
-
children: [
|
|
2114
|
+
children: [T && /* @__PURE__ */ Z(xe, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
|
|
1850
2115
|
})]
|
|
1851
2116
|
})]
|
|
1852
2117
|
}),
|
|
1853
|
-
|
|
2118
|
+
a && /* @__PURE__ */ Q(O, {
|
|
1854
2119
|
value: "link",
|
|
1855
2120
|
className: "space-y-3 mt-0",
|
|
1856
2121
|
children: [/* @__PURE__ */ Q("div", {
|
|
1857
2122
|
className: "relative",
|
|
1858
|
-
children: [/* @__PURE__ */ Z(
|
|
2123
|
+
children: [/* @__PURE__ */ Z(Ne, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }), /* @__PURE__ */ Z(x, {
|
|
1859
2124
|
placeholder: `Search ${e}…`,
|
|
1860
|
-
value:
|
|
1861
|
-
onChange: (e) =>
|
|
2125
|
+
value: b,
|
|
2126
|
+
onChange: (e) => P(e.target.value),
|
|
1862
2127
|
className: "h-8 text-sm pl-8"
|
|
1863
2128
|
})]
|
|
1864
2129
|
}), /* @__PURE__ */ Z("div", {
|
|
1865
2130
|
className: "max-h-48 overflow-y-auto space-y-1",
|
|
1866
|
-
children:
|
|
2131
|
+
children: j ? /* @__PURE__ */ Q("div", {
|
|
1867
2132
|
className: "flex items-center justify-center py-4 text-sm text-muted-foreground",
|
|
1868
|
-
children: [/* @__PURE__ */ Z(
|
|
1869
|
-
}) :
|
|
2133
|
+
children: [/* @__PURE__ */ Z(xe, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
|
|
2134
|
+
}) : N.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
1870
2135
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
1871
|
-
children:
|
|
1872
|
-
}) :
|
|
2136
|
+
children: b ? "No records found" : "Type to search records"
|
|
2137
|
+
}) : N.map((e) => /* @__PURE__ */ Q("button", {
|
|
1873
2138
|
type: "button",
|
|
1874
2139
|
className: "w-full text-left px-3 py-2 rounded-md hover:bg-accent text-sm transition-colors",
|
|
1875
|
-
onClick: () =>
|
|
1876
|
-
disabled:
|
|
2140
|
+
onClick: () => ee(e.id),
|
|
2141
|
+
disabled: T,
|
|
1877
2142
|
children: [/* @__PURE__ */ Z("span", {
|
|
1878
2143
|
className: "font-medium",
|
|
1879
2144
|
children: e.label
|
|
@@ -1887,42 +2152,42 @@ var it = ({ schema: e, dataSource: a, className: o, onEdit: s, onDelete: c, onBa
|
|
|
1887
2152
|
]
|
|
1888
2153
|
}) })]
|
|
1889
2154
|
}) : /* @__PURE__ */ Q("div", {
|
|
1890
|
-
className:
|
|
1891
|
-
children: [
|
|
2155
|
+
className: F("flex gap-2", c),
|
|
2156
|
+
children: [i && /* @__PURE__ */ Q(p, {
|
|
1892
2157
|
variant: "outline",
|
|
1893
2158
|
size: "sm",
|
|
1894
2159
|
onClick: () => {
|
|
1895
|
-
|
|
2160
|
+
f("create"), u(!0);
|
|
1896
2161
|
},
|
|
1897
2162
|
className: "gap-1.5",
|
|
1898
2163
|
children: [
|
|
1899
|
-
/* @__PURE__ */ Z(
|
|
2164
|
+
/* @__PURE__ */ Z(ke, { className: "h-3.5 w-3.5" }),
|
|
1900
2165
|
"New ",
|
|
1901
2166
|
e
|
|
1902
2167
|
]
|
|
1903
|
-
}),
|
|
2168
|
+
}), a && /* @__PURE__ */ Q(p, {
|
|
1904
2169
|
variant: "outline",
|
|
1905
2170
|
size: "sm",
|
|
1906
2171
|
onClick: () => {
|
|
1907
|
-
|
|
2172
|
+
f("link"), u(!0);
|
|
1908
2173
|
},
|
|
1909
2174
|
className: "gap-1.5",
|
|
1910
|
-
children: [/* @__PURE__ */ Z(
|
|
2175
|
+
children: [/* @__PURE__ */ Z(J, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
1911
2176
|
})]
|
|
1912
2177
|
});
|
|
1913
2178
|
};
|
|
1914
2179
|
//#endregion
|
|
1915
2180
|
//#region src/RichTextCommentInput.tsx
|
|
1916
|
-
function
|
|
2181
|
+
function Et(e) {
|
|
1917
2182
|
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/>");
|
|
1918
2183
|
return t = t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g, (e) => `<ul class="my-1">${e.replace(/<br\/>/g, "")}</ul>`), t;
|
|
1919
2184
|
}
|
|
1920
|
-
var
|
|
1921
|
-
let { t:
|
|
1922
|
-
if (!m) return
|
|
2185
|
+
var Dt = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: i = [], placeholder: a, className: o, disabled: s = !1 }) => {
|
|
2186
|
+
let { t: c } = $(), [l, u] = n.useState(!1), [d, f] = n.useState(!1), [m, h] = n.useState(""), [g, _] = n.useState(0), v = n.useRef(null), y = n.useMemo(() => {
|
|
2187
|
+
if (!m) return i;
|
|
1923
2188
|
let e = m.toLowerCase();
|
|
1924
|
-
return
|
|
1925
|
-
}, [m,
|
|
2189
|
+
return i.filter((t) => t.label.toLowerCase().includes(e));
|
|
2190
|
+
}, [m, i]), b = n.useCallback((n, r = "") => {
|
|
1926
2191
|
let i = v.current;
|
|
1927
2192
|
if (!i) return;
|
|
1928
2193
|
let a = i.selectionStart, o = i.selectionEnd, s = e.slice(a, o);
|
|
@@ -1931,27 +2196,27 @@ var st = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: a = [], plac
|
|
|
1931
2196
|
let e = a + n.length + s.length;
|
|
1932
2197
|
i.setSelectionRange(e, e);
|
|
1933
2198
|
});
|
|
1934
|
-
}, [e, t]), x = n.useCallback(() => b("**", "**"), [b]),
|
|
1935
|
-
b("@", ""),
|
|
1936
|
-
}, [b]),
|
|
2199
|
+
}, [e, t]), x = n.useCallback(() => b("**", "**"), [b]), S = n.useCallback(() => b("*", "*"), [b]), C = n.useCallback(() => b("\n- ", ""), [b]), w = n.useCallback(() => b("`", "`"), [b]), T = n.useCallback(() => {
|
|
2200
|
+
b("@", ""), f(!0), h(""), _(0);
|
|
2201
|
+
}, [b]), E = n.useCallback((n) => {
|
|
1937
2202
|
let r = v.current;
|
|
1938
2203
|
if (!r) return;
|
|
1939
2204
|
let i = r.selectionStart, a = e.slice(0, i).lastIndexOf("@");
|
|
1940
|
-
a !== -1 && t(e.slice(0, a) + `@${n.label} ` + e.slice(i)),
|
|
1941
|
-
}, [e, t]),
|
|
2205
|
+
a !== -1 && t(e.slice(0, a) + `@${n.label} ` + e.slice(i)), f(!1), h(""), requestAnimationFrame(() => r.focus());
|
|
2206
|
+
}, [e, t]), D = n.useCallback((e) => {
|
|
1942
2207
|
let n = e.target.value;
|
|
1943
2208
|
t(n);
|
|
1944
2209
|
let r = e.target.selectionStart, i = n.slice(0, r), a = i.lastIndexOf("@");
|
|
1945
2210
|
if (a !== -1) {
|
|
1946
2211
|
let e = i.slice(a + 1), t = a > 0 ? i[a - 1] : " ";
|
|
1947
2212
|
if (/\s/.test(t) && !/\s/.test(e)) {
|
|
1948
|
-
|
|
2213
|
+
f(!0), h(e), _(0);
|
|
1949
2214
|
return;
|
|
1950
2215
|
}
|
|
1951
2216
|
}
|
|
1952
|
-
|
|
1953
|
-
}, [t]),
|
|
1954
|
-
if (
|
|
2217
|
+
f(!1);
|
|
2218
|
+
}, [t]), O = n.useCallback((e) => {
|
|
2219
|
+
if (d && y.length > 0) {
|
|
1955
2220
|
if (e.key === "ArrowDown") {
|
|
1956
2221
|
e.preventDefault(), _((e) => e < y.length - 1 ? e + 1 : 0);
|
|
1957
2222
|
return;
|
|
@@ -1961,111 +2226,111 @@ var st = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: a = [], plac
|
|
|
1961
2226
|
return;
|
|
1962
2227
|
}
|
|
1963
2228
|
if (e.key === "Enter" || e.key === "Tab") {
|
|
1964
|
-
e.preventDefault(),
|
|
2229
|
+
e.preventDefault(), E(y[g]);
|
|
1965
2230
|
return;
|
|
1966
2231
|
}
|
|
1967
2232
|
if (e.key === "Escape") {
|
|
1968
|
-
|
|
2233
|
+
f(!1);
|
|
1969
2234
|
return;
|
|
1970
2235
|
}
|
|
1971
2236
|
}
|
|
1972
2237
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), r?.());
|
|
1973
2238
|
}, [
|
|
1974
|
-
|
|
2239
|
+
d,
|
|
1975
2240
|
y,
|
|
1976
2241
|
g,
|
|
1977
|
-
|
|
2242
|
+
E,
|
|
1978
2243
|
r
|
|
1979
2244
|
]);
|
|
1980
2245
|
return /* @__PURE__ */ Q("div", {
|
|
1981
|
-
className:
|
|
2246
|
+
className: F("border rounded-md", o),
|
|
1982
2247
|
children: [/* @__PURE__ */ Q("div", {
|
|
1983
2248
|
className: "flex items-center gap-0.5 px-2 py-1.5 border-b bg-muted/30",
|
|
1984
2249
|
children: [
|
|
1985
|
-
/* @__PURE__ */ Z(
|
|
2250
|
+
/* @__PURE__ */ Z(p, {
|
|
1986
2251
|
variant: "ghost",
|
|
1987
2252
|
size: "icon",
|
|
1988
2253
|
className: "h-7 w-7",
|
|
1989
2254
|
onClick: x,
|
|
1990
|
-
disabled:
|
|
1991
|
-
title:
|
|
1992
|
-
children: /* @__PURE__ */ Z(
|
|
2255
|
+
disabled: s || l,
|
|
2256
|
+
title: c("detail.bold"),
|
|
2257
|
+
children: /* @__PURE__ */ Z(V, { className: "h-3.5 w-3.5" })
|
|
1993
2258
|
}),
|
|
1994
|
-
/* @__PURE__ */ Z(
|
|
2259
|
+
/* @__PURE__ */ Z(p, {
|
|
1995
2260
|
variant: "ghost",
|
|
1996
2261
|
size: "icon",
|
|
1997
2262
|
className: "h-7 w-7",
|
|
1998
|
-
onClick:
|
|
1999
|
-
disabled:
|
|
2000
|
-
title:
|
|
2001
|
-
children: /* @__PURE__ */ Z(
|
|
2263
|
+
onClick: S,
|
|
2264
|
+
disabled: s || l,
|
|
2265
|
+
title: c("detail.italic"),
|
|
2266
|
+
children: /* @__PURE__ */ Z(ye, { className: "h-3.5 w-3.5" })
|
|
2002
2267
|
}),
|
|
2003
|
-
/* @__PURE__ */ Z(
|
|
2268
|
+
/* @__PURE__ */ Z(p, {
|
|
2004
2269
|
variant: "ghost",
|
|
2005
2270
|
size: "icon",
|
|
2006
2271
|
className: "h-7 w-7",
|
|
2007
|
-
onClick:
|
|
2008
|
-
disabled:
|
|
2009
|
-
title:
|
|
2010
|
-
children: /* @__PURE__ */ Z(
|
|
2272
|
+
onClick: C,
|
|
2273
|
+
disabled: s || l,
|
|
2274
|
+
title: c("detail.listFormat"),
|
|
2275
|
+
children: /* @__PURE__ */ Z(be, { className: "h-3.5 w-3.5" })
|
|
2011
2276
|
}),
|
|
2012
|
-
/* @__PURE__ */ Z(
|
|
2277
|
+
/* @__PURE__ */ Z(p, {
|
|
2013
2278
|
variant: "ghost",
|
|
2014
2279
|
size: "icon",
|
|
2015
2280
|
className: "h-7 w-7",
|
|
2016
|
-
onClick:
|
|
2017
|
-
disabled:
|
|
2018
|
-
title:
|
|
2019
|
-
children: /* @__PURE__ */ Z(
|
|
2281
|
+
onClick: w,
|
|
2282
|
+
disabled: s || l,
|
|
2283
|
+
title: c("detail.inlineCode"),
|
|
2284
|
+
children: /* @__PURE__ */ Z(le, { className: "h-3.5 w-3.5" })
|
|
2020
2285
|
}),
|
|
2021
|
-
/* @__PURE__ */ Z(
|
|
2286
|
+
/* @__PURE__ */ Z(p, {
|
|
2022
2287
|
variant: "ghost",
|
|
2023
2288
|
size: "icon",
|
|
2024
2289
|
className: "h-7 w-7",
|
|
2025
|
-
onClick:
|
|
2026
|
-
disabled:
|
|
2027
|
-
title:
|
|
2028
|
-
children: /* @__PURE__ */ Z(
|
|
2290
|
+
onClick: T,
|
|
2291
|
+
disabled: s || l,
|
|
2292
|
+
title: c("detail.mentionSomeone"),
|
|
2293
|
+
children: /* @__PURE__ */ Z(B, { className: "h-3.5 w-3.5" })
|
|
2029
2294
|
}),
|
|
2030
2295
|
/* @__PURE__ */ Z("div", { className: "flex-1" }),
|
|
2031
|
-
/* @__PURE__ */ Z(
|
|
2296
|
+
/* @__PURE__ */ Z(p, {
|
|
2032
2297
|
variant: "ghost",
|
|
2033
2298
|
size: "icon",
|
|
2034
2299
|
className: "h-7 w-7",
|
|
2035
|
-
onClick: () =>
|
|
2036
|
-
title: l
|
|
2037
|
-
children: Z(
|
|
2300
|
+
onClick: () => u(!l),
|
|
2301
|
+
title: c(l ? "detail.edit" : "detail.preview"),
|
|
2302
|
+
children: Z(l ? G : K, { className: "h-3.5 w-3.5" })
|
|
2038
2303
|
}),
|
|
2039
|
-
r && /* @__PURE__ */ Z(
|
|
2304
|
+
r && /* @__PURE__ */ Z(p, {
|
|
2040
2305
|
variant: "ghost",
|
|
2041
2306
|
size: "icon",
|
|
2042
2307
|
className: "h-7 w-7",
|
|
2043
2308
|
onClick: r,
|
|
2044
|
-
disabled:
|
|
2045
|
-
title:
|
|
2046
|
-
children: /* @__PURE__ */ Z(
|
|
2309
|
+
disabled: s || !e.trim(),
|
|
2310
|
+
title: c("detail.submitComment"),
|
|
2311
|
+
children: /* @__PURE__ */ Z(Pe, { className: "h-3.5 w-3.5" })
|
|
2047
2312
|
})
|
|
2048
2313
|
]
|
|
2049
2314
|
}), /* @__PURE__ */ Z("div", {
|
|
2050
2315
|
className: "relative",
|
|
2051
|
-
children:
|
|
2316
|
+
children: l ? /* @__PURE__ */ Z("div", {
|
|
2052
2317
|
className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
|
|
2053
|
-
dangerouslySetInnerHTML: { __html:
|
|
2318
|
+
dangerouslySetInnerHTML: { __html: Et(e) }
|
|
2054
2319
|
}) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("textarea", {
|
|
2055
2320
|
ref: v,
|
|
2056
2321
|
className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
|
|
2057
|
-
placeholder:
|
|
2322
|
+
placeholder: a ?? c("detail.writeComment"),
|
|
2058
2323
|
value: e,
|
|
2059
|
-
onChange:
|
|
2060
|
-
onKeyDown:
|
|
2061
|
-
disabled:
|
|
2062
|
-
}),
|
|
2324
|
+
onChange: D,
|
|
2325
|
+
onKeyDown: O,
|
|
2326
|
+
disabled: s
|
|
2327
|
+
}), d && y.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2063
2328
|
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",
|
|
2064
2329
|
children: y.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
2065
2330
|
type: "button",
|
|
2066
|
-
className:
|
|
2331
|
+
className: F("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === g && "bg-accent"),
|
|
2067
2332
|
onMouseDown: (t) => {
|
|
2068
|
-
t.preventDefault(),
|
|
2333
|
+
t.preventDefault(), E(e);
|
|
2069
2334
|
},
|
|
2070
2335
|
children: [e.avatarUrl ? /* @__PURE__ */ Z("img", {
|
|
2071
2336
|
src: e.avatarUrl,
|
|
@@ -2082,7 +2347,7 @@ var st = ({ value: e, onChange: t, onSubmit: r, mentionSuggestions: a = [], plac
|
|
|
2082
2347
|
};
|
|
2083
2348
|
//#endregion
|
|
2084
2349
|
//#region src/DiffView.tsx
|
|
2085
|
-
function
|
|
2350
|
+
function Ot(e, t) {
|
|
2086
2351
|
if (e == null) return ["(empty)"];
|
|
2087
2352
|
switch (t) {
|
|
2088
2353
|
case "json": try {
|
|
@@ -2101,7 +2366,7 @@ function ct(e, t) {
|
|
|
2101
2366
|
default: return String(e).split("\n");
|
|
2102
2367
|
}
|
|
2103
2368
|
}
|
|
2104
|
-
function
|
|
2369
|
+
function kt(e, t) {
|
|
2105
2370
|
let n = [], r = Math.max(e.length, t.length);
|
|
2106
2371
|
for (let i = 0; i < r; i++) {
|
|
2107
2372
|
let r = i < e.length ? e[i] : void 0, a = i < t.length ? t[i] : void 0;
|
|
@@ -2118,26 +2383,26 @@ function lt(e, t) {
|
|
|
2118
2383
|
}
|
|
2119
2384
|
return n;
|
|
2120
2385
|
}
|
|
2121
|
-
var
|
|
2386
|
+
var At = {
|
|
2122
2387
|
added: "bg-green-50 text-green-800 dark:bg-green-950/30 dark:text-green-300",
|
|
2123
2388
|
removed: "bg-red-50 text-red-800 dark:bg-red-950/30 dark:text-red-300",
|
|
2124
2389
|
unchanged: "text-muted-foreground"
|
|
2125
|
-
},
|
|
2390
|
+
}, jt = {
|
|
2126
2391
|
added: "+",
|
|
2127
2392
|
removed: "-",
|
|
2128
2393
|
unchanged: " "
|
|
2129
|
-
},
|
|
2130
|
-
let { t:
|
|
2131
|
-
if (
|
|
2394
|
+
}, Mt = ({ oldValue: e, newValue: t, fieldName: r, fieldType: i = "string", mode: a = "unified", className: o }) => {
|
|
2395
|
+
let { t: s } = $(), [c, l] = n.useState(a), u = n.useMemo(() => Ot(e, i), [e, i]), d = n.useMemo(() => Ot(t, i), [t, i]), f = n.useMemo(() => kt(u, d), [u, d]), v = f.some((e) => e.type !== "unchanged"), y = n.useMemo(() => {
|
|
2396
|
+
if (c !== "side-by-side") return [];
|
|
2132
2397
|
let e = [], t = 0;
|
|
2133
|
-
for (; t <
|
|
2134
|
-
let n =
|
|
2398
|
+
for (; t < f.length;) {
|
|
2399
|
+
let n = f[t];
|
|
2135
2400
|
if (n.type === "unchanged") e.push({
|
|
2136
2401
|
left: n,
|
|
2137
2402
|
right: n
|
|
2138
2403
|
}), t++;
|
|
2139
2404
|
else if (n.type === "removed") {
|
|
2140
|
-
let r = t + 1 <
|
|
2405
|
+
let r = t + 1 < f.length ? f[t + 1] : null;
|
|
2141
2406
|
r && r.type === "added" ? (e.push({
|
|
2142
2407
|
left: n,
|
|
2143
2408
|
right: r
|
|
@@ -2151,44 +2416,44 @@ var ut = {
|
|
|
2151
2416
|
}), t++;
|
|
2152
2417
|
}
|
|
2153
2418
|
return e;
|
|
2154
|
-
}, [
|
|
2155
|
-
return /* @__PURE__ */ Q(
|
|
2156
|
-
className:
|
|
2157
|
-
children: [/* @__PURE__ */ Z(
|
|
2419
|
+
}, [c, f]);
|
|
2420
|
+
return /* @__PURE__ */ Q(m, {
|
|
2421
|
+
className: F("overflow-hidden", o),
|
|
2422
|
+
children: [/* @__PURE__ */ Z(g, {
|
|
2158
2423
|
className: "pb-2",
|
|
2159
|
-
children: /* @__PURE__ */ Q(
|
|
2424
|
+
children: /* @__PURE__ */ Q(_, {
|
|
2160
2425
|
className: "flex items-center justify-between text-sm",
|
|
2161
2426
|
children: [/* @__PURE__ */ Z("span", {
|
|
2162
2427
|
className: "font-medium",
|
|
2163
2428
|
children: r
|
|
2164
2429
|
}), /* @__PURE__ */ Q("div", {
|
|
2165
2430
|
className: "flex items-center gap-1",
|
|
2166
|
-
children: [/* @__PURE__ */ Z(
|
|
2167
|
-
variant:
|
|
2431
|
+
children: [/* @__PURE__ */ Z(p, {
|
|
2432
|
+
variant: c === "unified" ? "secondary" : "ghost",
|
|
2168
2433
|
size: "icon",
|
|
2169
2434
|
className: "h-7 w-7",
|
|
2170
|
-
onClick: () =>
|
|
2171
|
-
title:
|
|
2172
|
-
children: /* @__PURE__ */ Z(
|
|
2173
|
-
}), /* @__PURE__ */ Z(
|
|
2174
|
-
variant:
|
|
2435
|
+
onClick: () => l("unified"),
|
|
2436
|
+
title: s("detail.unifiedDiff"),
|
|
2437
|
+
children: /* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5" })
|
|
2438
|
+
}), /* @__PURE__ */ Z(p, {
|
|
2439
|
+
variant: c === "side-by-side" ? "secondary" : "ghost",
|
|
2175
2440
|
size: "icon",
|
|
2176
2441
|
className: "h-7 w-7",
|
|
2177
|
-
onClick: () =>
|
|
2178
|
-
title:
|
|
2179
|
-
children: /* @__PURE__ */ Z(
|
|
2442
|
+
onClick: () => l("side-by-side"),
|
|
2443
|
+
title: s("detail.sideBySideDiff"),
|
|
2444
|
+
children: /* @__PURE__ */ Z(ue, { className: "h-3.5 w-3.5" })
|
|
2180
2445
|
})]
|
|
2181
2446
|
})]
|
|
2182
2447
|
})
|
|
2183
|
-
}), /* @__PURE__ */ Z(
|
|
2448
|
+
}), /* @__PURE__ */ Z(h, {
|
|
2184
2449
|
className: "p-0",
|
|
2185
|
-
children: v ?
|
|
2450
|
+
children: v ? c === "unified" ? /* @__PURE__ */ Z("div", {
|
|
2186
2451
|
className: "font-mono text-xs overflow-x-auto",
|
|
2187
|
-
children:
|
|
2188
|
-
className:
|
|
2452
|
+
children: f.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
2453
|
+
className: F("px-4 py-0.5 whitespace-pre-wrap border-l-2", At[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
|
|
2189
2454
|
children: [/* @__PURE__ */ Z("span", {
|
|
2190
2455
|
className: "select-none mr-2 inline-block w-3 text-center opacity-60",
|
|
2191
|
-
children:
|
|
2456
|
+
children: jt[e.type]
|
|
2192
2457
|
}), e.value]
|
|
2193
2458
|
}, t))
|
|
2194
2459
|
}) : /* @__PURE__ */ Z("div", {
|
|
@@ -2198,80 +2463,80 @@ var ut = {
|
|
|
2198
2463
|
children: [
|
|
2199
2464
|
/* @__PURE__ */ Z("div", {
|
|
2200
2465
|
className: "px-3 py-1.5 text-xs font-medium text-muted-foreground bg-muted/50",
|
|
2201
|
-
children:
|
|
2466
|
+
children: s("detail.previousVersion")
|
|
2202
2467
|
}),
|
|
2203
2468
|
/* @__PURE__ */ Z("div", {
|
|
2204
2469
|
className: "px-3 py-1.5 text-xs font-medium text-muted-foreground bg-muted/50",
|
|
2205
|
-
children:
|
|
2470
|
+
children: s("detail.currentVersion")
|
|
2206
2471
|
}),
|
|
2207
2472
|
y.map((e, t) => /* @__PURE__ */ Q(n.Fragment, { children: [/* @__PURE__ */ Z("div", {
|
|
2208
|
-
className:
|
|
2473
|
+
className: F("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? At[e.left.type] : "bg-muted/20"),
|
|
2209
2474
|
children: e.left?.value ?? ""
|
|
2210
2475
|
}), /* @__PURE__ */ Z("div", {
|
|
2211
|
-
className:
|
|
2476
|
+
className: F("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? At[e.right.type] : "bg-muted/20"),
|
|
2212
2477
|
children: e.right?.value ?? ""
|
|
2213
2478
|
})] }, t))
|
|
2214
2479
|
]
|
|
2215
2480
|
})
|
|
2216
2481
|
}) : /* @__PURE__ */ Z("p", {
|
|
2217
2482
|
className: "px-4 py-3 text-sm text-muted-foreground",
|
|
2218
|
-
children:
|
|
2483
|
+
children: s("detail.noChanges")
|
|
2219
2484
|
})
|
|
2220
2485
|
})]
|
|
2221
2486
|
});
|
|
2222
|
-
},
|
|
2223
|
-
let { t:
|
|
2224
|
-
|
|
2487
|
+
}, Nt = ({ currentIndex: e, totalRecords: t, recordIds: r, onNavigate: i, onSearch: a, className: o }) => {
|
|
2488
|
+
let { t: s } = $(), [c, l] = n.useState(""), [u, d] = n.useState(!1), f = n.useRef(null), m = e > 0, h = e > 0, g = e < t - 1, _ = e < t - 1, v = n.useCallback(() => {
|
|
2489
|
+
m && i(r[0]);
|
|
2225
2490
|
}, [
|
|
2226
|
-
|
|
2227
|
-
|
|
2491
|
+
m,
|
|
2492
|
+
i,
|
|
2228
2493
|
r
|
|
2229
|
-
]),
|
|
2230
|
-
|
|
2494
|
+
]), y = n.useCallback(() => {
|
|
2495
|
+
h && i(r[e - 1]);
|
|
2231
2496
|
}, [
|
|
2232
|
-
|
|
2233
|
-
|
|
2497
|
+
h,
|
|
2498
|
+
i,
|
|
2234
2499
|
r,
|
|
2235
2500
|
e
|
|
2236
|
-
]),
|
|
2237
|
-
|
|
2501
|
+
]), b = n.useCallback(() => {
|
|
2502
|
+
g && i(r[e + 1]);
|
|
2238
2503
|
}, [
|
|
2239
|
-
|
|
2240
|
-
|
|
2504
|
+
g,
|
|
2505
|
+
i,
|
|
2241
2506
|
r,
|
|
2242
2507
|
e
|
|
2243
|
-
]),
|
|
2244
|
-
|
|
2508
|
+
]), S = n.useCallback(() => {
|
|
2509
|
+
_ && i(r[r.length - 1]);
|
|
2245
2510
|
}, [
|
|
2246
|
-
|
|
2247
|
-
|
|
2511
|
+
_,
|
|
2512
|
+
i,
|
|
2248
2513
|
r
|
|
2249
|
-
]),
|
|
2514
|
+
]), C = n.useCallback((e) => {
|
|
2250
2515
|
let t = e.target.value;
|
|
2251
|
-
|
|
2252
|
-
}, [
|
|
2253
|
-
|
|
2254
|
-
}, [
|
|
2516
|
+
l(t), a?.(t);
|
|
2517
|
+
}, [a]), w = n.useCallback(() => {
|
|
2518
|
+
d((e) => (e ? (l(""), a?.("")) : requestAnimationFrame(() => f.current?.focus()), !e));
|
|
2519
|
+
}, [a]);
|
|
2255
2520
|
return n.useEffect(() => {
|
|
2256
2521
|
let t = (t) => {
|
|
2257
2522
|
let n = t.target?.tagName;
|
|
2258
|
-
if (!((n === "INPUT" || n === "TEXTAREA" || t.target?.isContentEditable) && t.target !==
|
|
2259
|
-
if (t.target ===
|
|
2260
|
-
t.key === "Escape" && (t.preventDefault(),
|
|
2523
|
+
if (!((n === "INPUT" || n === "TEXTAREA" || t.target?.isContentEditable) && t.target !== f.current)) {
|
|
2524
|
+
if (t.target === f.current) {
|
|
2525
|
+
t.key === "Escape" && (t.preventDefault(), d(!1), l(""), a?.(""), t.target.blur());
|
|
2261
2526
|
return;
|
|
2262
2527
|
}
|
|
2263
2528
|
switch (t.key) {
|
|
2264
2529
|
case "Home":
|
|
2265
|
-
t.preventDefault(),
|
|
2530
|
+
t.preventDefault(), m && i(r[0]);
|
|
2266
2531
|
break;
|
|
2267
2532
|
case "End":
|
|
2268
|
-
t.preventDefault(),
|
|
2533
|
+
t.preventDefault(), _ && i(r[r.length - 1]);
|
|
2269
2534
|
break;
|
|
2270
2535
|
case "ArrowLeft":
|
|
2271
|
-
t.preventDefault(),
|
|
2536
|
+
t.preventDefault(), h && i(r[e - 1]);
|
|
2272
2537
|
break;
|
|
2273
2538
|
case "ArrowRight":
|
|
2274
|
-
t.preventDefault(),
|
|
2539
|
+
t.preventDefault(), g && i(r[e + 1]);
|
|
2275
2540
|
break;
|
|
2276
2541
|
}
|
|
2277
2542
|
}
|
|
@@ -2280,90 +2545,90 @@ var ut = {
|
|
|
2280
2545
|
}, [
|
|
2281
2546
|
e,
|
|
2282
2547
|
r,
|
|
2548
|
+
m,
|
|
2283
2549
|
h,
|
|
2284
2550
|
g,
|
|
2285
2551
|
_,
|
|
2286
|
-
|
|
2287
|
-
a
|
|
2288
|
-
o
|
|
2552
|
+
i,
|
|
2553
|
+
a
|
|
2289
2554
|
]), /* @__PURE__ */ Q("div", {
|
|
2290
|
-
className:
|
|
2555
|
+
className: F("flex items-center gap-1.5", o),
|
|
2291
2556
|
children: [
|
|
2292
|
-
/* @__PURE__ */ Z(
|
|
2557
|
+
/* @__PURE__ */ Z(p, {
|
|
2293
2558
|
variant: "outline",
|
|
2294
2559
|
size: "icon",
|
|
2295
2560
|
className: "h-8 w-8",
|
|
2296
|
-
disabled: !
|
|
2297
|
-
onClick:
|
|
2298
|
-
title:
|
|
2299
|
-
children: /* @__PURE__ */ Z(
|
|
2561
|
+
disabled: !m,
|
|
2562
|
+
onClick: v,
|
|
2563
|
+
title: s("detail.firstRecord"),
|
|
2564
|
+
children: /* @__PURE__ */ Z(se, { className: "h-4 w-4" })
|
|
2300
2565
|
}),
|
|
2301
|
-
/* @__PURE__ */ Z(
|
|
2566
|
+
/* @__PURE__ */ Z(p, {
|
|
2302
2567
|
variant: "outline",
|
|
2303
2568
|
size: "icon",
|
|
2304
2569
|
className: "h-8 w-8",
|
|
2305
|
-
disabled: !
|
|
2306
|
-
onClick:
|
|
2307
|
-
title:
|
|
2308
|
-
children: /* @__PURE__ */ Z(
|
|
2570
|
+
disabled: !h,
|
|
2571
|
+
onClick: y,
|
|
2572
|
+
title: s("detail.previousRecordKey"),
|
|
2573
|
+
children: /* @__PURE__ */ Z(oe, { className: "h-4 w-4" })
|
|
2309
2574
|
}),
|
|
2310
2575
|
/* @__PURE__ */ Z("span", {
|
|
2311
2576
|
className: "text-xs text-muted-foreground whitespace-nowrap px-1.5 tabular-nums",
|
|
2312
|
-
children: t > 0 ?
|
|
2577
|
+
children: t > 0 ? s("detail.recordOf", {
|
|
2313
2578
|
current: e + 1,
|
|
2314
2579
|
total: t
|
|
2315
|
-
}) :
|
|
2580
|
+
}) : s("detail.noRecords")
|
|
2316
2581
|
}),
|
|
2317
|
-
/* @__PURE__ */ Z(
|
|
2582
|
+
/* @__PURE__ */ Z(p, {
|
|
2318
2583
|
variant: "outline",
|
|
2319
2584
|
size: "icon",
|
|
2320
2585
|
className: "h-8 w-8",
|
|
2321
|
-
disabled: !
|
|
2322
|
-
onClick:
|
|
2323
|
-
title:
|
|
2324
|
-
children: /* @__PURE__ */ Z(
|
|
2586
|
+
disabled: !g,
|
|
2587
|
+
onClick: b,
|
|
2588
|
+
title: s("detail.nextRecordKey"),
|
|
2589
|
+
children: /* @__PURE__ */ Z(W, { className: "h-4 w-4" })
|
|
2325
2590
|
}),
|
|
2326
|
-
/* @__PURE__ */ Z(
|
|
2591
|
+
/* @__PURE__ */ Z(p, {
|
|
2327
2592
|
variant: "outline",
|
|
2328
2593
|
size: "icon",
|
|
2329
2594
|
className: "h-8 w-8",
|
|
2330
|
-
disabled: !
|
|
2331
|
-
onClick:
|
|
2332
|
-
title:
|
|
2333
|
-
children: /* @__PURE__ */ Z(
|
|
2595
|
+
disabled: !_,
|
|
2596
|
+
onClick: S,
|
|
2597
|
+
title: s("detail.lastRecord"),
|
|
2598
|
+
children: /* @__PURE__ */ Z(ce, { className: "h-4 w-4" })
|
|
2334
2599
|
}),
|
|
2335
|
-
|
|
2336
|
-
variant:
|
|
2600
|
+
a && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(p, {
|
|
2601
|
+
variant: u ? "secondary" : "ghost",
|
|
2337
2602
|
size: "icon",
|
|
2338
2603
|
className: "h-8 w-8",
|
|
2339
|
-
onClick:
|
|
2340
|
-
title:
|
|
2341
|
-
children: /* @__PURE__ */ Z(
|
|
2342
|
-
}),
|
|
2604
|
+
onClick: w,
|
|
2605
|
+
title: s("detail.searchWhileNavigating"),
|
|
2606
|
+
children: /* @__PURE__ */ Z(Ne, { className: "h-4 w-4" })
|
|
2607
|
+
}), u && /* @__PURE__ */ Z("div", {
|
|
2343
2608
|
className: "relative",
|
|
2344
|
-
children: /* @__PURE__ */ Z(
|
|
2345
|
-
ref:
|
|
2609
|
+
children: /* @__PURE__ */ Z(x, {
|
|
2610
|
+
ref: f,
|
|
2346
2611
|
type: "text",
|
|
2347
|
-
placeholder:
|
|
2348
|
-
value:
|
|
2349
|
-
onChange:
|
|
2612
|
+
placeholder: s("detail.searchRecords"),
|
|
2613
|
+
value: c,
|
|
2614
|
+
onChange: C,
|
|
2350
2615
|
className: "h-8 w-48 text-sm"
|
|
2351
2616
|
})
|
|
2352
2617
|
})] })
|
|
2353
2618
|
]
|
|
2354
2619
|
});
|
|
2355
|
-
},
|
|
2620
|
+
}, Pt = 28, Ft = [
|
|
2356
2621
|
"fill-primary stroke-primary",
|
|
2357
2622
|
"fill-blue-500 stroke-blue-500",
|
|
2358
2623
|
"fill-emerald-500 stroke-emerald-500",
|
|
2359
2624
|
"fill-amber-500 stroke-amber-500"
|
|
2360
|
-
],
|
|
2625
|
+
], It = [
|
|
2361
2626
|
"fill-primary-foreground",
|
|
2362
2627
|
"fill-white",
|
|
2363
2628
|
"fill-white",
|
|
2364
2629
|
"fill-white"
|
|
2365
2630
|
];
|
|
2366
|
-
function
|
|
2631
|
+
function Lt(e, t, n, r, i) {
|
|
2367
2632
|
let a = [], o = [], s = /* @__PURE__ */ new Set(), c = r / 2, l = i / 2;
|
|
2368
2633
|
a.push({
|
|
2369
2634
|
id: e.id,
|
|
@@ -2427,23 +2692,23 @@ function _t(e, t, n, r, i) {
|
|
|
2427
2692
|
edges: o
|
|
2428
2693
|
};
|
|
2429
2694
|
}
|
|
2430
|
-
function
|
|
2695
|
+
function Rt(e, t = 6) {
|
|
2431
2696
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
2432
2697
|
}
|
|
2433
|
-
var
|
|
2434
|
-
let
|
|
2698
|
+
var zt = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, className: a }) => {
|
|
2699
|
+
let o = n.useRef(null), [s, c] = n.useState({
|
|
2435
2700
|
width: 500,
|
|
2436
2701
|
height: 400
|
|
2437
|
-
}), [
|
|
2702
|
+
}), [l, u] = n.useState(null);
|
|
2438
2703
|
n.useEffect(() => {
|
|
2439
|
-
let e =
|
|
2704
|
+
let e = o.current;
|
|
2440
2705
|
if (!e) return;
|
|
2441
2706
|
let t = e.parentElement;
|
|
2442
2707
|
if (!t) return;
|
|
2443
2708
|
let n = new ResizeObserver((e) => {
|
|
2444
2709
|
for (let t of e) {
|
|
2445
2710
|
let { width: e } = t.contentRect;
|
|
2446
|
-
e > 0 &&
|
|
2711
|
+
e > 0 && c({
|
|
2447
2712
|
width: e,
|
|
2448
2713
|
height: Math.max(300, e * .7)
|
|
2449
2714
|
});
|
|
@@ -2451,20 +2716,20 @@ var yt = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
2451
2716
|
});
|
|
2452
2717
|
return n.observe(t), () => n.disconnect();
|
|
2453
2718
|
}, []);
|
|
2454
|
-
let { nodes:
|
|
2719
|
+
let { nodes: d, edges: f } = n.useMemo(() => Lt(e, t, r, s.width, s.height), [
|
|
2455
2720
|
e,
|
|
2456
2721
|
t,
|
|
2457
2722
|
r,
|
|
2458
|
-
|
|
2723
|
+
s
|
|
2459
2724
|
]);
|
|
2460
|
-
return /* @__PURE__ */ Q(
|
|
2461
|
-
className:
|
|
2462
|
-
children: [/* @__PURE__ */ Z(
|
|
2725
|
+
return /* @__PURE__ */ Q(m, {
|
|
2726
|
+
className: F("overflow-hidden", a),
|
|
2727
|
+
children: [/* @__PURE__ */ Z(g, {
|
|
2463
2728
|
className: "pb-2",
|
|
2464
|
-
children: /* @__PURE__ */ Q(
|
|
2729
|
+
children: /* @__PURE__ */ Q(_, {
|
|
2465
2730
|
className: "flex items-center gap-2 text-base",
|
|
2466
2731
|
children: [
|
|
2467
|
-
/* @__PURE__ */ Z(
|
|
2732
|
+
/* @__PURE__ */ Z(Ce, { className: "h-4 w-4" }),
|
|
2468
2733
|
"Relationships",
|
|
2469
2734
|
/* @__PURE__ */ Q("span", {
|
|
2470
2735
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -2476,15 +2741,15 @@ var yt = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
2476
2741
|
})
|
|
2477
2742
|
]
|
|
2478
2743
|
})
|
|
2479
|
-
}), /* @__PURE__ */ Z(
|
|
2744
|
+
}), /* @__PURE__ */ Z(h, {
|
|
2480
2745
|
className: "p-0",
|
|
2481
2746
|
children: /* @__PURE__ */ Q("svg", {
|
|
2482
|
-
ref:
|
|
2747
|
+
ref: o,
|
|
2483
2748
|
width: "100%",
|
|
2484
|
-
height:
|
|
2485
|
-
viewBox: `0 0 ${
|
|
2749
|
+
height: s.height,
|
|
2750
|
+
viewBox: `0 0 ${s.width} ${s.height}`,
|
|
2486
2751
|
className: "select-none",
|
|
2487
|
-
children: [
|
|
2752
|
+
children: [f.map((e, t) => /* @__PURE__ */ Z("line", {
|
|
2488
2753
|
x1: e.fromX,
|
|
2489
2754
|
y1: e.fromY,
|
|
2490
2755
|
x2: e.toX,
|
|
@@ -2492,13 +2757,13 @@ var yt = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
2492
2757
|
className: "stroke-border",
|
|
2493
2758
|
strokeWidth: 1.5,
|
|
2494
2759
|
strokeOpacity: .5
|
|
2495
|
-
}, `edge-${t}`)),
|
|
2496
|
-
let t =
|
|
2760
|
+
}, `edge-${t}`)), d.map((e) => {
|
|
2761
|
+
let t = l === e.id, n = Ft[Math.min(e.level, Ft.length - 1)], r = It[Math.min(e.level, It.length - 1)], a = e.level === 0 ? Pt + 6 : Pt;
|
|
2497
2762
|
return /* @__PURE__ */ Q("g", {
|
|
2498
|
-
className:
|
|
2763
|
+
className: F("cursor-pointer transition-transform", i && "hover:opacity-80"),
|
|
2499
2764
|
onClick: () => i?.(e.id),
|
|
2500
|
-
onMouseEnter: () =>
|
|
2501
|
-
onMouseLeave: () =>
|
|
2765
|
+
onMouseEnter: () => u(e.id),
|
|
2766
|
+
onMouseLeave: () => u(null),
|
|
2502
2767
|
children: [
|
|
2503
2768
|
/* @__PURE__ */ Z("circle", {
|
|
2504
2769
|
cx: e.x,
|
|
@@ -2514,8 +2779,8 @@ var yt = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
2514
2779
|
y: e.y,
|
|
2515
2780
|
textAnchor: "middle",
|
|
2516
2781
|
dominantBaseline: "central",
|
|
2517
|
-
className:
|
|
2518
|
-
children:
|
|
2782
|
+
className: F("text-[10px] font-medium pointer-events-none", r),
|
|
2783
|
+
children: Rt(e.label)
|
|
2519
2784
|
}),
|
|
2520
2785
|
e.type && /* @__PURE__ */ Z("text", {
|
|
2521
2786
|
x: e.x,
|
|
@@ -2549,46 +2814,46 @@ var yt = ({ record: e, relatedRecords: t, levels: r = 1, onNodeClick: i, classNa
|
|
|
2549
2814
|
};
|
|
2550
2815
|
//#endregion
|
|
2551
2816
|
//#region src/CommentAttachment.tsx
|
|
2552
|
-
function
|
|
2817
|
+
function Bt(e) {
|
|
2553
2818
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
2554
2819
|
}
|
|
2555
|
-
function
|
|
2820
|
+
function Vt(e) {
|
|
2556
2821
|
return e.startsWith("image/");
|
|
2557
2822
|
}
|
|
2558
|
-
function
|
|
2559
|
-
return
|
|
2823
|
+
function Ht(e) {
|
|
2824
|
+
return Vt(e) ? _e : e.includes("pdf") || e.includes("document") || e.includes("text") ? ge : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? he : me;
|
|
2560
2825
|
}
|
|
2561
|
-
var
|
|
2562
|
-
let { t:
|
|
2563
|
-
e.preventDefault(), e.stopPropagation(),
|
|
2826
|
+
var Ut = ({ attachments: e, onUpload: t, onRemove: r, className: i, readOnly: a = !1 }) => {
|
|
2827
|
+
let { t: o } = $(), [s, c] = n.useState(!1), l = n.useRef(null), u = n.useCallback((e) => {
|
|
2828
|
+
e.preventDefault(), e.stopPropagation(), c(!0);
|
|
2829
|
+
}, []), d = n.useCallback((e) => {
|
|
2830
|
+
e.preventDefault(), e.stopPropagation(), c(!1);
|
|
2564
2831
|
}, []), f = n.useCallback((e) => {
|
|
2565
|
-
e.preventDefault(), e.stopPropagation(),
|
|
2566
|
-
}, []), p = n.useCallback((e) => {
|
|
2567
|
-
e.preventDefault(), e.stopPropagation(), l(!1), t && e.dataTransfer.files.length > 0 && t(e.dataTransfer.files);
|
|
2832
|
+
e.preventDefault(), e.stopPropagation(), c(!1), t && e.dataTransfer.files.length > 0 && t(e.dataTransfer.files);
|
|
2568
2833
|
}, [t]), m = n.useCallback((e) => {
|
|
2569
2834
|
t && e.target.files && e.target.files.length > 0 && (t(e.target.files), e.target.value = "");
|
|
2570
2835
|
}, [t]);
|
|
2571
2836
|
return /* @__PURE__ */ Q("div", {
|
|
2572
|
-
className:
|
|
2573
|
-
children: [t && !
|
|
2574
|
-
className:
|
|
2575
|
-
onDragOver:
|
|
2576
|
-
onDragLeave:
|
|
2577
|
-
onDrop:
|
|
2578
|
-
onClick: () =>
|
|
2837
|
+
className: F("space-y-2", i),
|
|
2838
|
+
children: [t && !a && /* @__PURE__ */ Q("div", {
|
|
2839
|
+
className: F("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"),
|
|
2840
|
+
onDragOver: u,
|
|
2841
|
+
onDragLeave: d,
|
|
2842
|
+
onDrop: f,
|
|
2843
|
+
onClick: () => l.current?.click(),
|
|
2579
2844
|
role: "button",
|
|
2580
2845
|
tabIndex: 0,
|
|
2581
2846
|
onKeyDown: (e) => {
|
|
2582
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
2847
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), l.current?.click());
|
|
2583
2848
|
},
|
|
2584
2849
|
children: [
|
|
2585
|
-
/* @__PURE__ */ Z(
|
|
2850
|
+
/* @__PURE__ */ Z(Re, { className: "h-5 w-5 mx-auto text-muted-foreground mb-1" }),
|
|
2586
2851
|
/* @__PURE__ */ Z("p", {
|
|
2587
2852
|
className: "text-xs text-muted-foreground",
|
|
2588
|
-
children:
|
|
2853
|
+
children: o("detail.dropFilesToUpload")
|
|
2589
2854
|
}),
|
|
2590
2855
|
/* @__PURE__ */ Z("input", {
|
|
2591
|
-
ref:
|
|
2856
|
+
ref: l,
|
|
2592
2857
|
type: "file",
|
|
2593
2858
|
multiple: !0,
|
|
2594
2859
|
className: "hidden",
|
|
@@ -2599,11 +2864,11 @@ var Ct = ({ attachments: e, onUpload: t, onRemove: r, className: a, readOnly: o
|
|
|
2599
2864
|
className: "space-y-1.5",
|
|
2600
2865
|
children: [/* @__PURE__ */ Q("div", {
|
|
2601
2866
|
className: "flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
2602
|
-
children: [/* @__PURE__ */ Z(
|
|
2867
|
+
children: [/* @__PURE__ */ Z(Ee, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: e.length === 1 ? o("detail.attachmentCount", { count: e.length }) : o("detail.attachmentCountPlural", { count: e.length }) })]
|
|
2603
2868
|
}), /* @__PURE__ */ Z("div", {
|
|
2604
2869
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
|
|
2605
2870
|
children: e.map((e) => {
|
|
2606
|
-
let t =
|
|
2871
|
+
let t = Vt(e.type), n = Ht(e.type);
|
|
2607
2872
|
return /* @__PURE__ */ Q("div", {
|
|
2608
2873
|
className: "flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group",
|
|
2609
2874
|
children: [
|
|
@@ -2622,16 +2887,16 @@ var Ct = ({ attachments: e, onUpload: t, onRemove: r, className: a, readOnly: o
|
|
|
2622
2887
|
children: e.name
|
|
2623
2888
|
}), /* @__PURE__ */ Z("p", {
|
|
2624
2889
|
className: "text-[10px] text-muted-foreground",
|
|
2625
|
-
children:
|
|
2890
|
+
children: Bt(e.size)
|
|
2626
2891
|
})]
|
|
2627
2892
|
}),
|
|
2628
|
-
r && !
|
|
2893
|
+
r && !a && /* @__PURE__ */ Z(p, {
|
|
2629
2894
|
variant: "ghost",
|
|
2630
2895
|
size: "icon",
|
|
2631
2896
|
className: "h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
2632
2897
|
onClick: () => r(e.id),
|
|
2633
|
-
title:
|
|
2634
|
-
children: /* @__PURE__ */ Z(
|
|
2898
|
+
title: o("detail.removeAttachment"),
|
|
2899
|
+
children: /* @__PURE__ */ Z(ze, { className: "h-3.5 w-3.5" })
|
|
2635
2900
|
})
|
|
2636
2901
|
]
|
|
2637
2902
|
}, e.id);
|
|
@@ -2642,7 +2907,7 @@ var Ct = ({ attachments: e, onUpload: t, onRemove: r, className: a, readOnly: o
|
|
|
2642
2907
|
};
|
|
2643
2908
|
//#endregion
|
|
2644
2909
|
//#region src/PointInTimeRestore.tsx
|
|
2645
|
-
function
|
|
2910
|
+
function Wt(e) {
|
|
2646
2911
|
try {
|
|
2647
2912
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
2648
2913
|
if (r < 1) return "just now";
|
|
@@ -2653,36 +2918,36 @@ function wt(e) {
|
|
|
2653
2918
|
return e;
|
|
2654
2919
|
}
|
|
2655
2920
|
}
|
|
2656
|
-
var
|
|
2657
|
-
let [
|
|
2658
|
-
if (!(!
|
|
2659
|
-
if (!
|
|
2660
|
-
|
|
2921
|
+
var Gt = ({ recordId: e, revisions: t, onRestore: r, className: i }) => {
|
|
2922
|
+
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 () => {
|
|
2923
|
+
if (!(!d || !r)) {
|
|
2924
|
+
if (!s) {
|
|
2925
|
+
c(!0);
|
|
2661
2926
|
return;
|
|
2662
2927
|
}
|
|
2663
|
-
|
|
2928
|
+
u(!0);
|
|
2664
2929
|
try {
|
|
2665
|
-
let e =
|
|
2666
|
-
await r(
|
|
2930
|
+
let e = d.snapshot ?? {};
|
|
2931
|
+
await r(d.id, e), c(!1), o(null);
|
|
2667
2932
|
} finally {
|
|
2668
|
-
|
|
2933
|
+
u(!1);
|
|
2669
2934
|
}
|
|
2670
2935
|
}
|
|
2671
2936
|
}, [
|
|
2672
|
-
|
|
2937
|
+
d,
|
|
2673
2938
|
r,
|
|
2674
|
-
|
|
2939
|
+
s
|
|
2675
2940
|
]), v = n.useCallback(() => {
|
|
2676
|
-
|
|
2941
|
+
c(!1);
|
|
2677
2942
|
}, []);
|
|
2678
|
-
return /* @__PURE__ */ Q(
|
|
2679
|
-
className:
|
|
2680
|
-
children: [/* @__PURE__ */ Z(
|
|
2943
|
+
return /* @__PURE__ */ Q(m, {
|
|
2944
|
+
className: F("", i),
|
|
2945
|
+
children: [/* @__PURE__ */ Z(g, {
|
|
2681
2946
|
className: "pb-3",
|
|
2682
|
-
children: /* @__PURE__ */ Q(
|
|
2947
|
+
children: /* @__PURE__ */ Q(_, {
|
|
2683
2948
|
className: "flex items-center gap-2 text-base",
|
|
2684
2949
|
children: [
|
|
2685
|
-
/* @__PURE__ */ Z(
|
|
2950
|
+
/* @__PURE__ */ Z(q, { className: "h-4 w-4" }),
|
|
2686
2951
|
"Revision History",
|
|
2687
2952
|
/* @__PURE__ */ Q("span", {
|
|
2688
2953
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -2694,7 +2959,7 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
|
|
|
2694
2959
|
})
|
|
2695
2960
|
]
|
|
2696
2961
|
})
|
|
2697
|
-
}), /* @__PURE__ */ Z(
|
|
2962
|
+
}), /* @__PURE__ */ Z(h, { children: t.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
2698
2963
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
2699
2964
|
children: "No revisions recorded"
|
|
2700
2965
|
}) : /* @__PURE__ */ Q("div", {
|
|
@@ -2706,16 +2971,16 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
|
|
|
2706
2971
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-3 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
2707
2972
|
className: "space-y-1",
|
|
2708
2973
|
children: t.map((e) => {
|
|
2709
|
-
let t = e.id ===
|
|
2974
|
+
let t = e.id === a;
|
|
2710
2975
|
return /* @__PURE__ */ Q("button", {
|
|
2711
2976
|
type: "button",
|
|
2712
|
-
className:
|
|
2977
|
+
className: F("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"),
|
|
2713
2978
|
onClick: () => {
|
|
2714
|
-
|
|
2979
|
+
o(e.id), c(!1);
|
|
2715
2980
|
},
|
|
2716
2981
|
children: [/* @__PURE__ */ Z("div", {
|
|
2717
|
-
className:
|
|
2718
|
-
children: t && /* @__PURE__ */ Z(
|
|
2982
|
+
className: F("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"),
|
|
2983
|
+
children: t && /* @__PURE__ */ Z(W, { className: "h-3 w-3 text-primary-foreground" })
|
|
2719
2984
|
}), /* @__PURE__ */ Q("div", {
|
|
2720
2985
|
className: "flex-1 min-w-0",
|
|
2721
2986
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -2725,7 +2990,7 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
|
|
|
2725
2990
|
children: e.user
|
|
2726
2991
|
}), /* @__PURE__ */ Z("span", {
|
|
2727
2992
|
className: "text-xs text-muted-foreground",
|
|
2728
|
-
children:
|
|
2993
|
+
children: Wt(e.timestamp)
|
|
2729
2994
|
})]
|
|
2730
2995
|
}), /* @__PURE__ */ Q("p", {
|
|
2731
2996
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
@@ -2742,16 +3007,16 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
|
|
|
2742
3007
|
})
|
|
2743
3008
|
})]
|
|
2744
3009
|
})
|
|
2745
|
-
}),
|
|
3010
|
+
}), d && /* @__PURE__ */ Q("div", {
|
|
2746
3011
|
className: "lg:w-80 border rounded-md p-3 space-y-3",
|
|
2747
3012
|
children: [
|
|
2748
3013
|
/* @__PURE__ */ Q("div", {
|
|
2749
3014
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
2750
|
-
children: [/* @__PURE__ */ Z(
|
|
3015
|
+
children: [/* @__PURE__ */ Z(K, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
|
|
2751
3016
|
}),
|
|
2752
3017
|
/* @__PURE__ */ Z("div", {
|
|
2753
3018
|
className: "space-y-2",
|
|
2754
|
-
children:
|
|
3019
|
+
children: d.changes.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
2755
3020
|
className: "text-xs",
|
|
2756
3021
|
children: [/* @__PURE__ */ Z("span", {
|
|
2757
3022
|
className: "font-medium text-muted-foreground",
|
|
@@ -2763,7 +3028,7 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
|
|
|
2763
3028
|
className: "line-through text-red-600 dark:text-red-400 truncate max-w-[120px]",
|
|
2764
3029
|
children: e.oldValue == null ? "(empty)" : String(e.oldValue)
|
|
2765
3030
|
}),
|
|
2766
|
-
/* @__PURE__ */ Z(
|
|
3031
|
+
/* @__PURE__ */ Z(W, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
2767
3032
|
/* @__PURE__ */ Z("span", {
|
|
2768
3033
|
className: "text-green-600 dark:text-green-400 truncate max-w-[120px]",
|
|
2769
3034
|
children: e.newValue == null ? "(empty)" : String(e.newValue)
|
|
@@ -2772,14 +3037,14 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
|
|
|
2772
3037
|
})]
|
|
2773
3038
|
}, t))
|
|
2774
3039
|
}),
|
|
2775
|
-
|
|
3040
|
+
d.snapshot && /* @__PURE__ */ Q("div", {
|
|
2776
3041
|
className: "border-t pt-2 space-y-1",
|
|
2777
3042
|
children: [/* @__PURE__ */ Z("p", {
|
|
2778
3043
|
className: "text-xs font-medium text-muted-foreground",
|
|
2779
3044
|
children: "Record state at this point"
|
|
2780
3045
|
}), /* @__PURE__ */ Z("div", {
|
|
2781
3046
|
className: "max-h-40 overflow-y-auto space-y-1",
|
|
2782
|
-
children: Object.entries(
|
|
3047
|
+
children: Object.entries(d.snapshot).map(([e, t]) => /* @__PURE__ */ Q("div", {
|
|
2783
3048
|
className: "flex justify-between text-xs gap-2",
|
|
2784
3049
|
children: [/* @__PURE__ */ Z("span", {
|
|
2785
3050
|
className: "text-muted-foreground truncate",
|
|
@@ -2793,46 +3058,46 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
|
|
|
2793
3058
|
}),
|
|
2794
3059
|
r && /* @__PURE__ */ Z("div", {
|
|
2795
3060
|
className: "pt-1 space-y-2",
|
|
2796
|
-
children:
|
|
3061
|
+
children: s ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Q("p", {
|
|
2797
3062
|
className: "text-xs text-amber-600 dark:text-amber-400",
|
|
2798
3063
|
children: [
|
|
2799
3064
|
"This will restore the record to its state at",
|
|
2800
3065
|
" ",
|
|
2801
|
-
|
|
3066
|
+
Wt(d.timestamp),
|
|
2802
3067
|
". Continue?"
|
|
2803
3068
|
]
|
|
2804
3069
|
}), /* @__PURE__ */ Q("div", {
|
|
2805
3070
|
className: "flex gap-2",
|
|
2806
|
-
children: [/* @__PURE__ */ Q(
|
|
3071
|
+
children: [/* @__PURE__ */ Q(p, {
|
|
2807
3072
|
variant: "destructive",
|
|
2808
3073
|
size: "sm",
|
|
2809
3074
|
className: "gap-1.5 flex-1",
|
|
2810
|
-
onClick:
|
|
2811
|
-
disabled:
|
|
2812
|
-
children: [/* @__PURE__ */ Z(
|
|
2813
|
-
}), /* @__PURE__ */ Z(
|
|
3075
|
+
onClick: f,
|
|
3076
|
+
disabled: l,
|
|
3077
|
+
children: [/* @__PURE__ */ Z(je, { className: "h-3.5 w-3.5" }), l ? "Restoring…" : "Confirm Restore"]
|
|
3078
|
+
}), /* @__PURE__ */ Z(p, {
|
|
2814
3079
|
variant: "ghost",
|
|
2815
3080
|
size: "sm",
|
|
2816
3081
|
onClick: v,
|
|
2817
|
-
disabled:
|
|
3082
|
+
disabled: l,
|
|
2818
3083
|
children: "Cancel"
|
|
2819
3084
|
})]
|
|
2820
|
-
})] }) : /* @__PURE__ */ Q(
|
|
3085
|
+
})] }) : /* @__PURE__ */ Q(p, {
|
|
2821
3086
|
variant: "outline",
|
|
2822
3087
|
size: "sm",
|
|
2823
3088
|
className: "w-full gap-1.5",
|
|
2824
|
-
onClick:
|
|
2825
|
-
children: [/* @__PURE__ */ Z(
|
|
3089
|
+
onClick: f,
|
|
3090
|
+
children: [/* @__PURE__ */ Z(je, { className: "h-3.5 w-3.5" }), "Restore to this point"]
|
|
2826
3091
|
})
|
|
2827
3092
|
})
|
|
2828
3093
|
]
|
|
2829
3094
|
})]
|
|
2830
3095
|
}) })]
|
|
2831
3096
|
});
|
|
2832
|
-
},
|
|
3097
|
+
}, Kt = ({ change: e, className: t }) => {
|
|
2833
3098
|
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));
|
|
2834
3099
|
return /* @__PURE__ */ Q("div", {
|
|
2835
|
-
className:
|
|
3100
|
+
className: F("flex items-center gap-1.5 text-sm flex-wrap", t),
|
|
2836
3101
|
children: [
|
|
2837
3102
|
/* @__PURE__ */ Z("span", {
|
|
2838
3103
|
className: "font-medium text-foreground",
|
|
@@ -2842,50 +3107,50 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
|
|
|
2842
3107
|
className: "text-muted-foreground line-through",
|
|
2843
3108
|
children: r
|
|
2844
3109
|
}),
|
|
2845
|
-
/* @__PURE__ */ Z(
|
|
3110
|
+
/* @__PURE__ */ Z(R, { className: "h-3 w-3 text-muted-foreground shrink-0" }),
|
|
2846
3111
|
/* @__PURE__ */ Z("span", {
|
|
2847
3112
|
className: "text-foreground",
|
|
2848
3113
|
children: i
|
|
2849
3114
|
})
|
|
2850
3115
|
]
|
|
2851
3116
|
});
|
|
2852
|
-
},
|
|
3117
|
+
}, qt = [
|
|
2853
3118
|
"👍",
|
|
2854
3119
|
"❤️",
|
|
2855
3120
|
"🎉",
|
|
2856
3121
|
"😂",
|
|
2857
3122
|
"😮",
|
|
2858
3123
|
"😢"
|
|
2859
|
-
],
|
|
2860
|
-
let [
|
|
2861
|
-
t?.(e),
|
|
3124
|
+
], Jt = ({ reactions: e, onToggleReaction: t, emojiOptions: r = qt, className: i }) => {
|
|
3125
|
+
let [a, o] = n.useState(!1), s = n.useCallback((e) => {
|
|
3126
|
+
t?.(e), o(!1);
|
|
2862
3127
|
}, [t]);
|
|
2863
3128
|
return /* @__PURE__ */ Q("div", {
|
|
2864
|
-
className:
|
|
3129
|
+
className: F("flex items-center gap-1 flex-wrap", i),
|
|
2865
3130
|
children: [e.map((e) => /* @__PURE__ */ Q("button", {
|
|
2866
3131
|
type: "button",
|
|
2867
|
-
className:
|
|
2868
|
-
onClick: () =>
|
|
3132
|
+
className: F("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"),
|
|
3133
|
+
onClick: () => s(e.emoji),
|
|
2869
3134
|
disabled: !t,
|
|
2870
3135
|
"aria-label": `${e.emoji} ${e.count} reaction${e.count === 1 ? "" : "s"}`,
|
|
2871
3136
|
children: [/* @__PURE__ */ Z("span", { children: e.emoji }), /* @__PURE__ */ Z("span", { children: e.count })]
|
|
2872
3137
|
}, e.emoji)), t && /* @__PURE__ */ Q("div", {
|
|
2873
3138
|
className: "relative",
|
|
2874
|
-
children: [/* @__PURE__ */ Z(
|
|
3139
|
+
children: [/* @__PURE__ */ Z(p, {
|
|
2875
3140
|
variant: "ghost",
|
|
2876
3141
|
size: "icon",
|
|
2877
3142
|
className: "h-6 w-6",
|
|
2878
|
-
onClick: () =>
|
|
3143
|
+
onClick: () => o(!a),
|
|
2879
3144
|
"aria-label": "Add reaction",
|
|
2880
|
-
children: /* @__PURE__ */ Z(
|
|
2881
|
-
}),
|
|
3145
|
+
children: /* @__PURE__ */ Z(Fe, { className: "h-3.5 w-3.5" })
|
|
3146
|
+
}), a && /* @__PURE__ */ Z("div", {
|
|
2882
3147
|
className: "absolute bottom-full mb-1 left-0 bg-popover border rounded-md shadow-md z-50 p-1.5 flex gap-1",
|
|
2883
3148
|
role: "listbox",
|
|
2884
3149
|
"aria-label": "Emoji picker",
|
|
2885
3150
|
children: r.map((t) => /* @__PURE__ */ Z("button", {
|
|
2886
3151
|
type: "button",
|
|
2887
3152
|
className: "hover:bg-accent rounded p-1 text-base transition-colors",
|
|
2888
|
-
onClick: () =>
|
|
3153
|
+
onClick: () => s(t),
|
|
2889
3154
|
role: "option",
|
|
2890
3155
|
"aria-selected": e.some((e) => e.emoji === t && e.reacted),
|
|
2891
3156
|
children: t
|
|
@@ -2896,7 +3161,7 @@ var Tt = ({ recordId: e, revisions: t, onRestore: r, className: l }) => {
|
|
|
2896
3161
|
};
|
|
2897
3162
|
//#endregion
|
|
2898
3163
|
//#region src/ThreadedReplies.tsx
|
|
2899
|
-
function
|
|
3164
|
+
function Yt(e) {
|
|
2900
3165
|
try {
|
|
2901
3166
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
2902
3167
|
if (r < 1) return "just now";
|
|
@@ -2909,39 +3174,39 @@ function kt(e) {
|
|
|
2909
3174
|
return e;
|
|
2910
3175
|
}
|
|
2911
3176
|
}
|
|
2912
|
-
var
|
|
2913
|
-
let { t:
|
|
2914
|
-
let t =
|
|
3177
|
+
var Xt = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: i = !0, className: a }) => {
|
|
3178
|
+
let { t: o } = $(), [s, c] = n.useState(!1), [l, u] = n.useState(""), [d, f] = n.useState(!1), m = n.useCallback(async () => {
|
|
3179
|
+
let t = l.trim();
|
|
2915
3180
|
if (!(!t || !r)) {
|
|
2916
|
-
|
|
3181
|
+
f(!0);
|
|
2917
3182
|
try {
|
|
2918
|
-
await r(e.id, t),
|
|
3183
|
+
await r(e.id, t), u("");
|
|
2919
3184
|
} finally {
|
|
2920
|
-
|
|
3185
|
+
f(!1);
|
|
2921
3186
|
}
|
|
2922
3187
|
}
|
|
2923
3188
|
}, [
|
|
2924
|
-
|
|
3189
|
+
l,
|
|
2925
3190
|
r,
|
|
2926
3191
|
e.id
|
|
2927
3192
|
]), h = n.useCallback((e) => {
|
|
2928
3193
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), m());
|
|
2929
3194
|
}, [m]);
|
|
2930
|
-
return t.length === 0 && !
|
|
2931
|
-
className:
|
|
3195
|
+
return t.length === 0 && !i ? null : /* @__PURE__ */ Q("div", {
|
|
3196
|
+
className: F("ml-10 mt-1", a),
|
|
2932
3197
|
children: [
|
|
2933
3198
|
t.length > 0 && /* @__PURE__ */ Q("button", {
|
|
2934
3199
|
type: "button",
|
|
2935
3200
|
className: "flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors mb-1",
|
|
2936
|
-
onClick: () =>
|
|
2937
|
-
"aria-expanded":
|
|
3201
|
+
onClick: () => c(!s),
|
|
3202
|
+
"aria-expanded": s,
|
|
2938
3203
|
children: [
|
|
2939
|
-
Z(
|
|
3204
|
+
Z(s ? ae : W, { className: "h-3 w-3" }),
|
|
2940
3205
|
/* @__PURE__ */ Z(Y, { className: "h-3 w-3" }),
|
|
2941
|
-
/* @__PURE__ */ Z("span", { children: t.length === 1 ?
|
|
3206
|
+
/* @__PURE__ */ Z("span", { children: t.length === 1 ? o("detail.replyCount", { count: t.length }) : o("detail.replyCountPlural", { count: t.length }) })
|
|
2942
3207
|
]
|
|
2943
3208
|
}),
|
|
2944
|
-
|
|
3209
|
+
s && /* @__PURE__ */ Z("div", {
|
|
2945
3210
|
className: "space-y-2 border-l-2 border-border pl-3",
|
|
2946
3211
|
children: t.map((e) => /* @__PURE__ */ Q("div", {
|
|
2947
3212
|
className: "flex gap-2",
|
|
@@ -2964,7 +3229,7 @@ var At = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: a = !0, cl
|
|
|
2964
3229
|
children: e.actor
|
|
2965
3230
|
}), /* @__PURE__ */ Z("span", {
|
|
2966
3231
|
className: "text-[10px] text-muted-foreground",
|
|
2967
|
-
children:
|
|
3232
|
+
children: Yt(e.createdAt)
|
|
2968
3233
|
})]
|
|
2969
3234
|
}), /* @__PURE__ */ Z("p", {
|
|
2970
3235
|
className: "text-xs whitespace-pre-wrap break-words",
|
|
@@ -2973,57 +3238,57 @@ var At = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: a = !0, cl
|
|
|
2973
3238
|
})]
|
|
2974
3239
|
}, e.id))
|
|
2975
3240
|
}),
|
|
2976
|
-
|
|
3241
|
+
i && r && /* @__PURE__ */ Q("div", {
|
|
2977
3242
|
className: "flex gap-1.5 mt-1.5",
|
|
2978
3243
|
children: [/* @__PURE__ */ Z("input", {
|
|
2979
3244
|
className: "flex-1 rounded-md border border-input bg-background px-2 py-1 text-xs placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
2980
|
-
placeholder:
|
|
2981
|
-
value:
|
|
2982
|
-
onChange: (e) =>
|
|
3245
|
+
placeholder: o("detail.replyPlaceholder"),
|
|
3246
|
+
value: l,
|
|
3247
|
+
onChange: (e) => u(e.target.value),
|
|
2983
3248
|
onKeyDown: h,
|
|
2984
|
-
disabled:
|
|
2985
|
-
}), /* @__PURE__ */ Z(
|
|
3249
|
+
disabled: d
|
|
3250
|
+
}), /* @__PURE__ */ Z(p, {
|
|
2986
3251
|
variant: "ghost",
|
|
2987
3252
|
size: "icon",
|
|
2988
3253
|
className: "h-6 w-6 shrink-0",
|
|
2989
3254
|
onClick: m,
|
|
2990
|
-
disabled: !
|
|
3255
|
+
disabled: !l.trim() || d,
|
|
2991
3256
|
"aria-label": "Send reply",
|
|
2992
|
-
children: /* @__PURE__ */ Z(
|
|
3257
|
+
children: /* @__PURE__ */ Z(Pe, { className: "h-3 w-3" })
|
|
2993
3258
|
})]
|
|
2994
3259
|
})
|
|
2995
3260
|
]
|
|
2996
3261
|
});
|
|
2997
|
-
},
|
|
2998
|
-
let { t:
|
|
3262
|
+
}, Zt = ({ subscription: e, onToggle: t, className: r }) => {
|
|
3263
|
+
let { t: i } = $(), [a, o] = n.useState(!1), s = n.useCallback(async () => {
|
|
2999
3264
|
if (t) {
|
|
3000
|
-
|
|
3265
|
+
o(!0);
|
|
3001
3266
|
try {
|
|
3002
3267
|
await t(!e.subscribed);
|
|
3003
3268
|
} finally {
|
|
3004
|
-
|
|
3269
|
+
o(!1);
|
|
3005
3270
|
}
|
|
3006
3271
|
}
|
|
3007
3272
|
}, [t, e.subscribed]);
|
|
3008
|
-
return /* @__PURE__ */ Z(
|
|
3273
|
+
return /* @__PURE__ */ Z(p, {
|
|
3009
3274
|
variant: "ghost",
|
|
3010
3275
|
size: "icon",
|
|
3011
|
-
className:
|
|
3012
|
-
onClick:
|
|
3013
|
-
disabled:
|
|
3014
|
-
"aria-label": e.subscribed ?
|
|
3015
|
-
title: e.subscribed ?
|
|
3016
|
-
children: e.subscribed ? /* @__PURE__ */ Z(
|
|
3276
|
+
className: F("h-8 w-8", r),
|
|
3277
|
+
onClick: s,
|
|
3278
|
+
disabled: a || !t,
|
|
3279
|
+
"aria-label": e.subscribed ? i("detail.unsubscribeAriaLabel") : i("detail.subscribeAriaLabel"),
|
|
3280
|
+
title: e.subscribed ? i("detail.subscribedTooltip") : i("detail.unsubscribedTooltip"),
|
|
3281
|
+
children: e.subscribed ? /* @__PURE__ */ Z(ne, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ Z(re, { className: "h-4 w-4 text-muted-foreground" })
|
|
3017
3282
|
});
|
|
3018
|
-
},
|
|
3283
|
+
}, Qt = {
|
|
3019
3284
|
comment: Y,
|
|
3020
|
-
field_change:
|
|
3021
|
-
task:
|
|
3022
|
-
event:
|
|
3023
|
-
system:
|
|
3024
|
-
email:
|
|
3025
|
-
call:
|
|
3026
|
-
},
|
|
3285
|
+
field_change: G,
|
|
3286
|
+
task: U,
|
|
3287
|
+
event: H,
|
|
3288
|
+
system: Be,
|
|
3289
|
+
email: Se,
|
|
3290
|
+
call: De
|
|
3291
|
+
}, $t = {
|
|
3027
3292
|
comment: "bg-purple-100 text-purple-600",
|
|
3028
3293
|
field_change: "bg-blue-100 text-blue-600",
|
|
3029
3294
|
task: "bg-green-100 text-green-600",
|
|
@@ -3032,7 +3297,7 @@ var At = ({ parentItem: e, replies: t, onAddReply: r, showReplyInput: a = !0, cl
|
|
|
3032
3297
|
email: "bg-indigo-100 text-indigo-600",
|
|
3033
3298
|
call: "bg-teal-100 text-teal-600"
|
|
3034
3299
|
};
|
|
3035
|
-
function
|
|
3300
|
+
function en(e) {
|
|
3036
3301
|
return [
|
|
3037
3302
|
{
|
|
3038
3303
|
value: "all",
|
|
@@ -3052,7 +3317,7 @@ function Pt(e) {
|
|
|
3052
3317
|
}
|
|
3053
3318
|
];
|
|
3054
3319
|
}
|
|
3055
|
-
function
|
|
3320
|
+
function tn(e) {
|
|
3056
3321
|
try {
|
|
3057
3322
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
3058
3323
|
if (r < 1) return "just now";
|
|
@@ -3065,7 +3330,7 @@ function Ft(e) {
|
|
|
3065
3330
|
return e;
|
|
3066
3331
|
}
|
|
3067
3332
|
}
|
|
3068
|
-
function
|
|
3333
|
+
function nn(e, t) {
|
|
3069
3334
|
switch (t) {
|
|
3070
3335
|
case "comments_only": return e.filter((e) => e.type === "comment");
|
|
3071
3336
|
case "changes_only": return e.filter((e) => e.type === "field_change");
|
|
@@ -3073,112 +3338,112 @@ function It(e, t) {
|
|
|
3073
3338
|
default: return e;
|
|
3074
3339
|
}
|
|
3075
3340
|
}
|
|
3076
|
-
var
|
|
3077
|
-
let { t: b } = $(), [x,
|
|
3078
|
-
if (!
|
|
3341
|
+
var rn = ({ 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: v = !1, className: y }) => {
|
|
3342
|
+
let { t: b } = $(), [x, S] = n.useState("all"), [C, w] = n.useState(""), [T, E] = n.useState(!1), [D, O] = n.useState(!1), k = r ?? x, A = t?.showFilterToggle !== !1, j = t?.showCommentInput !== !1 && !!c, M = t?.enableReactions ?? !1, N = t?.enableThreading ?? !1, P = t?.showSubscriptionToggle ?? !1, I = n.useMemo(() => nn(e, k), [e, k]), ee = n.useMemo(() => N ? I.filter((e) => !e.parentId) : I, [I, N]), R = n.useMemo(() => {
|
|
3343
|
+
if (!N) return /* @__PURE__ */ new Map();
|
|
3079
3344
|
let e = /* @__PURE__ */ new Map();
|
|
3080
|
-
for (let t of
|
|
3345
|
+
for (let t of I) if (t.parentId) {
|
|
3081
3346
|
let n = e.get(t.parentId) ?? [];
|
|
3082
3347
|
n.push(t), e.set(t.parentId, n);
|
|
3083
3348
|
}
|
|
3084
3349
|
return e;
|
|
3085
|
-
}, [
|
|
3086
|
-
|
|
3087
|
-
}, [
|
|
3088
|
-
let e =
|
|
3089
|
-
if (!(!e || !
|
|
3090
|
-
|
|
3350
|
+
}, [I, N]), te = n.useCallback((e) => {
|
|
3351
|
+
i ? i(e) : S(e);
|
|
3352
|
+
}, [i]), z = n.useCallback(async () => {
|
|
3353
|
+
let e = C.trim();
|
|
3354
|
+
if (!(!e || !c)) {
|
|
3355
|
+
E(!0);
|
|
3091
3356
|
try {
|
|
3092
|
-
await
|
|
3357
|
+
await c(e), w("");
|
|
3093
3358
|
} finally {
|
|
3094
|
-
|
|
3359
|
+
E(!1);
|
|
3095
3360
|
}
|
|
3096
3361
|
}
|
|
3097
|
-
}, [
|
|
3098
|
-
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(),
|
|
3099
|
-
}, [
|
|
3100
|
-
if (
|
|
3101
|
-
|
|
3362
|
+
}, [C, c]), B = n.useCallback((e) => {
|
|
3363
|
+
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), z());
|
|
3364
|
+
}, [z]), ne = n.useCallback(async () => {
|
|
3365
|
+
if (o) {
|
|
3366
|
+
O(!0);
|
|
3102
3367
|
try {
|
|
3103
|
-
await
|
|
3368
|
+
await o();
|
|
3104
3369
|
} finally {
|
|
3105
|
-
|
|
3370
|
+
O(!1);
|
|
3106
3371
|
}
|
|
3107
3372
|
}
|
|
3108
|
-
}, [
|
|
3109
|
-
return /* @__PURE__ */ Q(
|
|
3110
|
-
className:
|
|
3111
|
-
children: [/* @__PURE__ */ Z(
|
|
3373
|
+
}, [o]);
|
|
3374
|
+
return /* @__PURE__ */ Q(m, {
|
|
3375
|
+
className: F("", y),
|
|
3376
|
+
children: [/* @__PURE__ */ Z(g, { children: /* @__PURE__ */ Q("div", {
|
|
3112
3377
|
className: "flex items-center justify-between",
|
|
3113
|
-
children: [/* @__PURE__ */ Q(
|
|
3378
|
+
children: [/* @__PURE__ */ Q(_, {
|
|
3114
3379
|
className: "flex items-center gap-2 text-base",
|
|
3115
3380
|
children: [
|
|
3116
|
-
/* @__PURE__ */ Z(
|
|
3381
|
+
/* @__PURE__ */ Z(L, { className: "h-4 w-4" }),
|
|
3117
3382
|
b("detail.activity"),
|
|
3118
3383
|
/* @__PURE__ */ Q("span", {
|
|
3119
3384
|
className: "text-sm font-normal text-muted-foreground",
|
|
3120
3385
|
children: [
|
|
3121
3386
|
"(",
|
|
3122
|
-
|
|
3387
|
+
I.length,
|
|
3123
3388
|
")"
|
|
3124
3389
|
]
|
|
3125
3390
|
})
|
|
3126
3391
|
]
|
|
3127
3392
|
}), /* @__PURE__ */ Z("div", {
|
|
3128
3393
|
className: "flex items-center gap-1",
|
|
3129
|
-
children:
|
|
3130
|
-
subscription:
|
|
3131
|
-
onToggle:
|
|
3394
|
+
children: P && d && /* @__PURE__ */ Z(Zt, {
|
|
3395
|
+
subscription: d,
|
|
3396
|
+
onToggle: f
|
|
3132
3397
|
})
|
|
3133
3398
|
})]
|
|
3134
|
-
}) }), /* @__PURE__ */ Q(
|
|
3399
|
+
}) }), /* @__PURE__ */ Q(h, {
|
|
3135
3400
|
className: "space-y-4",
|
|
3136
3401
|
children: [
|
|
3137
|
-
|
|
3402
|
+
A && /* @__PURE__ */ Z("div", {
|
|
3138
3403
|
className: "flex items-center gap-2",
|
|
3139
3404
|
children: /* @__PURE__ */ Z("select", {
|
|
3140
3405
|
className: "rounded-md border border-input bg-background px-2.5 py-1.5 text-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
3141
|
-
value:
|
|
3142
|
-
onChange: (e) =>
|
|
3406
|
+
value: k,
|
|
3407
|
+
onChange: (e) => te(e.target.value),
|
|
3143
3408
|
"aria-label": b("detail.filterActivity"),
|
|
3144
|
-
children:
|
|
3409
|
+
children: en(b).map((e) => /* @__PURE__ */ Z("option", {
|
|
3145
3410
|
value: e.value,
|
|
3146
3411
|
children: e.label
|
|
3147
3412
|
}, e.value))
|
|
3148
3413
|
})
|
|
3149
3414
|
}),
|
|
3150
|
-
|
|
3415
|
+
j && /* @__PURE__ */ Q("div", {
|
|
3151
3416
|
className: "flex gap-2",
|
|
3152
3417
|
children: [/* @__PURE__ */ Z("textarea", {
|
|
3153
3418
|
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",
|
|
3154
3419
|
placeholder: b("detail.leaveCommentPlaceholder"),
|
|
3155
|
-
value:
|
|
3156
|
-
onChange: (e) =>
|
|
3157
|
-
onKeyDown:
|
|
3158
|
-
disabled:
|
|
3159
|
-
}), /* @__PURE__ */ Z(
|
|
3420
|
+
value: C,
|
|
3421
|
+
onChange: (e) => w(e.target.value),
|
|
3422
|
+
onKeyDown: B,
|
|
3423
|
+
disabled: T
|
|
3424
|
+
}), /* @__PURE__ */ Z(p, {
|
|
3160
3425
|
size: "icon",
|
|
3161
3426
|
variant: "default",
|
|
3162
|
-
onClick:
|
|
3163
|
-
disabled: !
|
|
3427
|
+
onClick: z,
|
|
3428
|
+
disabled: !C.trim() || T,
|
|
3164
3429
|
className: "shrink-0 self-end",
|
|
3165
3430
|
"aria-label": b("detail.submitComment"),
|
|
3166
3431
|
children: /* @__PURE__ */ Z(Y, { className: "h-4 w-4" })
|
|
3167
3432
|
})]
|
|
3168
3433
|
}),
|
|
3169
|
-
|
|
3434
|
+
I.length === 0 ? v ? null : /* @__PURE__ */ Z("p", {
|
|
3170
3435
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
3171
3436
|
children: b("detail.noActivity")
|
|
3172
3437
|
}) : /* @__PURE__ */ Q("div", {
|
|
3173
3438
|
className: "relative",
|
|
3174
3439
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
3175
3440
|
className: "space-y-4",
|
|
3176
|
-
children:
|
|
3177
|
-
let t =
|
|
3441
|
+
children: ee.map((e) => {
|
|
3442
|
+
let t = Qt[e.type] || Be, n = $t[e.type] || "bg-gray-100 text-gray-600", r = R.get(e.id) ?? [];
|
|
3178
3443
|
return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
|
|
3179
3444
|
className: "flex gap-3 relative",
|
|
3180
3445
|
children: [/* @__PURE__ */ Z("div", {
|
|
3181
|
-
className:
|
|
3446
|
+
className: F("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", n),
|
|
3182
3447
|
children: e.actorAvatarUrl ? /* @__PURE__ */ Z("img", {
|
|
3183
3448
|
src: e.actorAvatarUrl,
|
|
3184
3449
|
alt: e.actor,
|
|
@@ -3200,7 +3465,7 @@ var Lt = ({ items: e, config: t, filterMode: r, onFilterChange: l, hasMore: u =
|
|
|
3200
3465
|
}),
|
|
3201
3466
|
/* @__PURE__ */ Z("span", {
|
|
3202
3467
|
className: "text-xs text-muted-foreground",
|
|
3203
|
-
children:
|
|
3468
|
+
children: tn(e.createdAt)
|
|
3204
3469
|
}),
|
|
3205
3470
|
e.edited && /* @__PURE__ */ Z("span", {
|
|
3206
3471
|
className: "text-xs text-muted-foreground italic",
|
|
@@ -3218,61 +3483,61 @@ var Lt = ({ items: e, config: t, filterMode: r, onFilterChange: l, hasMore: u =
|
|
|
3218
3483
|
}),
|
|
3219
3484
|
e.type === "field_change" && e.fieldChanges && /* @__PURE__ */ Z("div", {
|
|
3220
3485
|
className: "space-y-1 mt-1",
|
|
3221
|
-
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(
|
|
3486
|
+
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(Kt, { change: e }, t))
|
|
3222
3487
|
}),
|
|
3223
|
-
|
|
3488
|
+
M && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
|
|
3224
3489
|
className: "mt-1.5",
|
|
3225
|
-
children: /* @__PURE__ */ Z(
|
|
3490
|
+
children: /* @__PURE__ */ Z(Jt, {
|
|
3226
3491
|
reactions: e.reactions,
|
|
3227
|
-
onToggleReaction:
|
|
3492
|
+
onToggleReaction: u ? (t) => u(e.id, t) : void 0
|
|
3228
3493
|
})
|
|
3229
3494
|
}),
|
|
3230
|
-
|
|
3495
|
+
M && (!e.reactions || e.reactions.length === 0) && u && /* @__PURE__ */ Z("div", {
|
|
3231
3496
|
className: "mt-1.5",
|
|
3232
|
-
children: /* @__PURE__ */ Z(
|
|
3497
|
+
children: /* @__PURE__ */ Z(Jt, {
|
|
3233
3498
|
reactions: [],
|
|
3234
|
-
onToggleReaction: (t) =>
|
|
3499
|
+
onToggleReaction: (t) => u(e.id, t)
|
|
3235
3500
|
})
|
|
3236
3501
|
})
|
|
3237
3502
|
]
|
|
3238
3503
|
})]
|
|
3239
|
-
}),
|
|
3504
|
+
}), N && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(Xt, {
|
|
3240
3505
|
parentItem: e,
|
|
3241
3506
|
replies: r,
|
|
3242
|
-
onAddReply:
|
|
3243
|
-
showReplyInput: !!
|
|
3507
|
+
onAddReply: l,
|
|
3508
|
+
showReplyInput: !!l
|
|
3244
3509
|
})] }, e.id);
|
|
3245
3510
|
})
|
|
3246
3511
|
})]
|
|
3247
3512
|
}),
|
|
3248
|
-
|
|
3513
|
+
a && /* @__PURE__ */ Z("div", {
|
|
3249
3514
|
className: "text-center pt-2",
|
|
3250
|
-
children: /* @__PURE__ */ Q(
|
|
3515
|
+
children: /* @__PURE__ */ Q(p, {
|
|
3251
3516
|
variant: "ghost",
|
|
3252
3517
|
size: "sm",
|
|
3253
|
-
onClick:
|
|
3254
|
-
disabled:
|
|
3518
|
+
onClick: ne,
|
|
3519
|
+
disabled: D,
|
|
3255
3520
|
"aria-label": b("detail.loadMore"),
|
|
3256
|
-
children: [
|
|
3521
|
+
children: [D ? /* @__PURE__ */ Z(xe, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(ae, { className: "h-4 w-4 mr-1" }), b("detail.loadMore")]
|
|
3257
3522
|
})
|
|
3258
3523
|
})
|
|
3259
3524
|
]
|
|
3260
3525
|
})]
|
|
3261
3526
|
});
|
|
3262
|
-
},
|
|
3263
|
-
let g = e?.position ?? "right", _ = e?.width ?? "360px", v = e?.collapsible ?? !0, y = m && t.length === 0 || (e?.defaultCollapsed ?? !1), { t: b } = $(), [x,
|
|
3527
|
+
}, an = ({ 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: m = !1, className: h }) => {
|
|
3528
|
+
let g = e?.position ?? "right", _ = e?.width ?? "360px", v = e?.collapsible ?? !0, y = m && t.length === 0 || (e?.defaultCollapsed ?? !1), { t: b } = $(), [x, S] = n.useState(y);
|
|
3264
3529
|
return g === "right" || g === "left" ? x && v ? /* @__PURE__ */ Z("div", {
|
|
3265
|
-
className:
|
|
3266
|
-
children: /* @__PURE__ */ Z(
|
|
3530
|
+
className: F("flex items-start pt-4", g === "right" ? "border-l" : "border-r", h),
|
|
3531
|
+
children: /* @__PURE__ */ Z(p, {
|
|
3267
3532
|
variant: "ghost",
|
|
3268
3533
|
size: "icon",
|
|
3269
3534
|
className: "h-8 w-8 mx-1",
|
|
3270
|
-
onClick: () =>
|
|
3535
|
+
onClick: () => S(!1),
|
|
3271
3536
|
"aria-label": b("detail.openDiscussion"),
|
|
3272
|
-
children: /* @__PURE__ */ Z(
|
|
3537
|
+
children: /* @__PURE__ */ Z(Te, { className: "h-4 w-4" })
|
|
3273
3538
|
})
|
|
3274
3539
|
}) : /* @__PURE__ */ Q("div", {
|
|
3275
|
-
className:
|
|
3540
|
+
className: F("flex flex-col overflow-hidden", g === "right" ? "border-l" : "border-r", h),
|
|
3276
3541
|
style: {
|
|
3277
3542
|
width: _,
|
|
3278
3543
|
minWidth: _
|
|
@@ -3285,39 +3550,39 @@ var Lt = ({ items: e, config: t, filterMode: r, onFilterChange: l, hasMore: u =
|
|
|
3285
3550
|
className: "text-sm font-medium",
|
|
3286
3551
|
children: b("detail.discussion")
|
|
3287
3552
|
})]
|
|
3288
|
-
}), v && /* @__PURE__ */ Z(
|
|
3553
|
+
}), v && /* @__PURE__ */ Z(p, {
|
|
3289
3554
|
variant: "ghost",
|
|
3290
3555
|
size: "icon",
|
|
3291
3556
|
className: "h-7 w-7",
|
|
3292
|
-
onClick: () =>
|
|
3557
|
+
onClick: () => S(!0),
|
|
3293
3558
|
"aria-label": b("detail.closeDiscussion"),
|
|
3294
|
-
children: /* @__PURE__ */ Z(
|
|
3559
|
+
children: /* @__PURE__ */ Z(ze, { className: "h-3.5 w-3.5" })
|
|
3295
3560
|
})]
|
|
3296
3561
|
}), /* @__PURE__ */ Z("div", {
|
|
3297
3562
|
className: "flex-1 overflow-y-auto",
|
|
3298
|
-
children: /* @__PURE__ */ Z(
|
|
3563
|
+
children: /* @__PURE__ */ Z(rn, {
|
|
3299
3564
|
items: t,
|
|
3300
3565
|
config: e?.feed,
|
|
3301
3566
|
hasMore: r,
|
|
3302
|
-
onLoadMore:
|
|
3303
|
-
loading:
|
|
3304
|
-
onAddComment:
|
|
3305
|
-
onAddReply:
|
|
3306
|
-
onToggleReaction:
|
|
3307
|
-
subscription:
|
|
3308
|
-
onToggleSubscription:
|
|
3309
|
-
filterMode:
|
|
3310
|
-
onFilterChange:
|
|
3567
|
+
onLoadMore: i,
|
|
3568
|
+
loading: a,
|
|
3569
|
+
onAddComment: o,
|
|
3570
|
+
onAddReply: s,
|
|
3571
|
+
onToggleReaction: c,
|
|
3572
|
+
subscription: l,
|
|
3573
|
+
onToggleSubscription: u,
|
|
3574
|
+
filterMode: d,
|
|
3575
|
+
onFilterChange: f,
|
|
3311
3576
|
collapseWhenEmpty: m,
|
|
3312
3577
|
className: "border-0 shadow-none"
|
|
3313
3578
|
})
|
|
3314
3579
|
})]
|
|
3315
3580
|
}) : /* @__PURE__ */ Z("div", {
|
|
3316
|
-
className:
|
|
3317
|
-
children: v && x ? /* @__PURE__ */ Q(
|
|
3581
|
+
className: F("", h),
|
|
3582
|
+
children: v && x ? /* @__PURE__ */ Q(p, {
|
|
3318
3583
|
variant: "ghost",
|
|
3319
3584
|
className: "w-full justify-start gap-2 text-muted-foreground",
|
|
3320
|
-
onClick: () =>
|
|
3585
|
+
onClick: () => S(!1),
|
|
3321
3586
|
"aria-label": b("detail.showDiscussion", { count: t.length }),
|
|
3322
3587
|
children: [/* @__PURE__ */ Z(Y, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: b("detail.showDiscussion", { count: t.length }) })]
|
|
3323
3588
|
}) : /* @__PURE__ */ Q("div", { children: [v && /* @__PURE__ */ Q("div", {
|
|
@@ -3325,78 +3590,78 @@ var Lt = ({ items: e, config: t, filterMode: r, onFilterChange: l, hasMore: u =
|
|
|
3325
3590
|
children: [/* @__PURE__ */ Q("div", {
|
|
3326
3591
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
3327
3592
|
children: [/* @__PURE__ */ Z(Y, { className: "h-4 w-4" }), b("detail.discussion")]
|
|
3328
|
-
}), /* @__PURE__ */ Z(
|
|
3593
|
+
}), /* @__PURE__ */ Z(p, {
|
|
3329
3594
|
variant: "ghost",
|
|
3330
3595
|
size: "icon",
|
|
3331
3596
|
className: "h-7 w-7",
|
|
3332
|
-
onClick: () =>
|
|
3597
|
+
onClick: () => S(!0),
|
|
3333
3598
|
"aria-label": b("detail.hideDiscussion"),
|
|
3334
|
-
children: /* @__PURE__ */ Z(
|
|
3599
|
+
children: /* @__PURE__ */ Z(we, { className: "h-3.5 w-3.5" })
|
|
3335
3600
|
})]
|
|
3336
|
-
}), /* @__PURE__ */ Z(
|
|
3601
|
+
}), /* @__PURE__ */ Z(rn, {
|
|
3337
3602
|
items: t,
|
|
3338
3603
|
config: e?.feed,
|
|
3339
3604
|
hasMore: r,
|
|
3340
|
-
onLoadMore:
|
|
3341
|
-
loading:
|
|
3342
|
-
onAddComment:
|
|
3343
|
-
onAddReply:
|
|
3344
|
-
onToggleReaction:
|
|
3345
|
-
subscription:
|
|
3346
|
-
onToggleSubscription:
|
|
3347
|
-
filterMode:
|
|
3348
|
-
onFilterChange:
|
|
3605
|
+
onLoadMore: i,
|
|
3606
|
+
loading: a,
|
|
3607
|
+
onAddComment: o,
|
|
3608
|
+
onAddReply: s,
|
|
3609
|
+
onToggleReaction: c,
|
|
3610
|
+
subscription: l,
|
|
3611
|
+
onToggleSubscription: u,
|
|
3612
|
+
filterMode: d,
|
|
3613
|
+
onFilterChange: f,
|
|
3349
3614
|
collapseWhenEmpty: m
|
|
3350
3615
|
})] })
|
|
3351
3616
|
});
|
|
3352
|
-
},
|
|
3353
|
-
let [
|
|
3354
|
-
let t =
|
|
3617
|
+
}, on = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: r = !1, className: i }) => {
|
|
3618
|
+
let [a, o] = n.useState(""), [s, c] = n.useState(!1), l = n.useCallback(async () => {
|
|
3619
|
+
let t = a.trim();
|
|
3355
3620
|
if (t) {
|
|
3356
|
-
|
|
3621
|
+
c(!0);
|
|
3357
3622
|
try {
|
|
3358
|
-
await e(t),
|
|
3623
|
+
await e(t), o("");
|
|
3359
3624
|
} finally {
|
|
3360
|
-
|
|
3625
|
+
c(!1);
|
|
3361
3626
|
}
|
|
3362
3627
|
}
|
|
3363
|
-
}, [
|
|
3364
|
-
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(),
|
|
3365
|
-
}, [
|
|
3628
|
+
}, [a, e]), u = n.useCallback((e) => {
|
|
3629
|
+
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), l());
|
|
3630
|
+
}, [l]);
|
|
3366
3631
|
return /* @__PURE__ */ Q("div", {
|
|
3367
|
-
className:
|
|
3632
|
+
className: F("flex gap-2", i),
|
|
3368
3633
|
children: [/* @__PURE__ */ Z("textarea", {
|
|
3369
3634
|
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",
|
|
3370
3635
|
placeholder: t,
|
|
3371
|
-
value:
|
|
3372
|
-
onChange: (e) =>
|
|
3373
|
-
onKeyDown:
|
|
3374
|
-
disabled: r ||
|
|
3375
|
-
}), /* @__PURE__ */ Z(
|
|
3636
|
+
value: a,
|
|
3637
|
+
onChange: (e) => o(e.target.value),
|
|
3638
|
+
onKeyDown: u,
|
|
3639
|
+
disabled: r || s
|
|
3640
|
+
}), /* @__PURE__ */ Z(p, {
|
|
3376
3641
|
size: "icon",
|
|
3377
3642
|
variant: "default",
|
|
3378
|
-
onClick:
|
|
3379
|
-
disabled: !
|
|
3643
|
+
onClick: l,
|
|
3644
|
+
disabled: !a.trim() || s || r,
|
|
3380
3645
|
className: "shrink-0 self-end",
|
|
3381
3646
|
"aria-label": "Submit comment",
|
|
3382
|
-
children: /* @__PURE__ */ Z(
|
|
3647
|
+
children: /* @__PURE__ */ Z(Pe, { className: "h-4 w-4" })
|
|
3383
3648
|
})]
|
|
3384
3649
|
});
|
|
3385
|
-
},
|
|
3650
|
+
}, sn = ({ query: e, suggestions: t, onSelect: r, visible: i = !0, activeIndex: a = 0, className: o }) => {
|
|
3386
3651
|
let s = n.useMemo(() => {
|
|
3387
3652
|
if (!e) return t;
|
|
3388
3653
|
let n = e.toLowerCase();
|
|
3389
3654
|
return t.filter((e) => e.name.toLowerCase().includes(n) || e.id.toLowerCase().includes(n));
|
|
3390
3655
|
}, [e, t]);
|
|
3391
3656
|
return !i || s.length === 0 ? null : /* @__PURE__ */ Z("div", {
|
|
3392
|
-
className:
|
|
3657
|
+
className: F("bg-popover border rounded-md shadow-md z-50 max-h-48 overflow-y-auto w-56", o),
|
|
3393
3658
|
role: "listbox",
|
|
3394
3659
|
"aria-label": "Mention suggestions",
|
|
3395
3660
|
children: s.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
3396
3661
|
type: "button",
|
|
3397
3662
|
role: "option",
|
|
3398
3663
|
"aria-selected": t === a,
|
|
3399
|
-
className:
|
|
3664
|
+
className: F("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"),
|
|
3400
3665
|
onMouseDown: (t) => {
|
|
3401
3666
|
t.preventDefault(), r(e);
|
|
3402
3667
|
},
|
|
@@ -3424,7 +3689,7 @@ var Lt = ({ items: e, config: t, filterMode: r, onFilterChange: l, hasMore: u =
|
|
|
3424
3689
|
}, e.id))
|
|
3425
3690
|
});
|
|
3426
3691
|
};
|
|
3427
|
-
function
|
|
3692
|
+
function cn(e, t, n) {
|
|
3428
3693
|
return {
|
|
3429
3694
|
type: e.type,
|
|
3430
3695
|
id: e.id,
|
|
@@ -3433,7 +3698,7 @@ function Vt(e, t, n) {
|
|
|
3433
3698
|
length: n
|
|
3434
3699
|
};
|
|
3435
3700
|
}
|
|
3436
|
-
e.register("detail-view",
|
|
3701
|
+
e.register("detail-view", yt, {
|
|
3437
3702
|
namespace: "plugin-detail",
|
|
3438
3703
|
label: "Detail View",
|
|
3439
3704
|
category: "Views",
|
|
@@ -3563,7 +3828,7 @@ e.register("detail-view", it, {
|
|
|
3563
3828
|
tabs: [],
|
|
3564
3829
|
related: []
|
|
3565
3830
|
}
|
|
3566
|
-
}), e.register("detail-section",
|
|
3831
|
+
}), e.register("detail-section", rt, {
|
|
3567
3832
|
namespace: "plugin-detail",
|
|
3568
3833
|
label: "Detail Section",
|
|
3569
3834
|
category: "Detail Components",
|
|
@@ -3614,7 +3879,7 @@ e.register("detail-view", it, {
|
|
|
3614
3879
|
label: "Header Color"
|
|
3615
3880
|
}
|
|
3616
3881
|
]
|
|
3617
|
-
}), e.register("related-list",
|
|
3882
|
+
}), e.register("related-list", ot, {
|
|
3618
3883
|
namespace: "plugin-detail",
|
|
3619
3884
|
label: "Related List",
|
|
3620
3885
|
category: "Detail Components",
|
|
@@ -3661,7 +3926,7 @@ e.register("detail-view", it, {
|
|
|
3661
3926
|
label: "Columns"
|
|
3662
3927
|
}
|
|
3663
3928
|
]
|
|
3664
|
-
}), e.register("detail",
|
|
3929
|
+
}), e.register("detail", yt, {
|
|
3665
3930
|
namespace: "view",
|
|
3666
3931
|
category: "view",
|
|
3667
3932
|
label: "Detail",
|
|
@@ -3686,4 +3951,4 @@ e.register("detail-view", it, {
|
|
|
3686
3951
|
]
|
|
3687
3952
|
});
|
|
3688
3953
|
//#endregion
|
|
3689
|
-
export {
|
|
3954
|
+
export { gt as ActivityTimeline, Ut as CommentAttachment, on as CommentInput, tt as DETAIL_DEFAULT_TRANSLATIONS, rt as DetailSection, it as DetailTabs, yt as DetailView, Mt as DiffView, Kt as FieldChangeItem, ct as HeaderHighlight, Tt as InlineCreateRelated, sn as MentionAutocomplete, Gt as PointInTimeRestore, Jt as ReactionPicker, rn as RecordActivityTimeline, an as RecordChatterPanel, ut as RecordComments, Ct as RecordDetailDrawer, Nt as RecordNavigationEnhanced, ot as RelatedList, zt as RelationshipGraph, Dt as RichTextCommentInput, st as SectionGroup, Zt as SubscriptionToggle, Xt as ThreadedReplies, Qe as applyAutoSpan, $e as applyDetailAutoLayout, cn as createMentionFromSuggestion, et as createSafeTranslationHook, wt as deriveRecordPageHref, Ze as inferDetailColumns, Xe as isWideFieldType, $ as useDetailTranslation };
|