@object-ui/plugin-detail 17.1.0 → 17.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +190 -0
- package/dist/DetailView.d.ts.map +1 -1
- package/dist/RecordActivityTimeline.d.ts +19 -2
- package/dist/RecordActivityTimeline.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1004 -798
- package/dist/index.umd.cjs +3 -3
- package/dist/renderers/record-activity.d.ts +10 -2
- package/dist/renderers/record-activity.d.ts.map +1 -1
- package/dist/renderers/recordActivityFeed.d.ts +93 -0
- package/dist/renderers/recordActivityFeed.d.ts.map +1 -0
- package/dist/synth/buildDefaultPageSchema.d.ts +17 -2
- package/dist/synth/buildDefaultPageSchema.d.ts.map +1 -1
- package/dist/useDetailTranslation.d.ts.map +1 -1
- package/package.json +15 -15
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ComponentRegistry as e, buildExpandFields as t, columnIdentity as n, compareSortValues as r, formatTitleTemplate as i, getRecordDisplayName as a, getSortValue as o, isExpandableFieldType as s, isObjectInlineEditable as c, userActionPredicates as l } from "@object-ui/core";
|
|
2
2
|
import * as u from "react";
|
|
3
3
|
import d from "react";
|
|
4
|
-
import { Alert as f, AlertDescription as p, AlertDialog as m, AlertDialogAction as h, AlertDialogCancel as g, AlertDialogContent as _, AlertDialogDescription as v, AlertDialogFooter as y, AlertDialogHeader as b, AlertDialogTitle as x, AlertTitle as S, Avatar as C, AvatarFallback as w, AvatarImage as T, Badge as E, Button as D, Card as O, CardContent as k, CardHeader as A, CardTitle as j, Collapsible as M, CollapsibleContent as
|
|
5
|
-
import { Activity as
|
|
6
|
-
import { InlineEditProvider as
|
|
7
|
-
import { AvatarField as
|
|
8
|
-
import { createSafeTranslation as
|
|
9
|
-
import { Link as
|
|
10
|
-
import { Fragment as
|
|
11
|
-
import { useFieldPermissions as
|
|
12
|
-
import { ACTION_LOCATIONS as
|
|
13
|
-
import { deriveFieldGroupLayout as
|
|
4
|
+
import { Alert as f, AlertDescription as p, AlertDialog as m, AlertDialogAction as h, AlertDialogCancel as g, AlertDialogContent as _, AlertDialogDescription as v, AlertDialogFooter as y, AlertDialogHeader as b, AlertDialogTitle as x, AlertTitle as S, Avatar as C, AvatarFallback as w, AvatarImage as T, Badge as E, Button as D, Card as O, CardContent as k, CardHeader as A, CardTitle as j, Collapsible as M, CollapsibleContent as N, CollapsibleTrigger as ee, DataEmptyState as te, Input as ne, LazyIcon as re, Select as ie, SelectContent as P, SelectItem as ae, SelectTrigger as oe, SelectValue as se, Sheet as F, SheetContent as ce, SheetHeader as I, SheetTitle as le, Skeleton as L, Tabs as R, TabsContent as ue, TabsList as z, TabsTrigger as de, Tooltip as B, TooltipContent as V, TooltipProvider as fe, TooltipTrigger as H, buttonVariants as U, cn as W, useIsMobile as pe } from "@object-ui/components";
|
|
5
|
+
import { Activity as me, AlertTriangle as G, ArrowLeft as he, ArrowRight as K, ArrowRightLeft as ge, ArrowUpDown as _e, AtSign as ve, BadgeCheck as ye, Bell as be, BellOff as xe, Bold as Se, Calendar as Ce, Check as q, CheckSquare as we, ChevronDown as Te, ChevronLeft as Ee, ChevronRight as De, ChevronsLeft as Oe, ChevronsRight as ke, Circle as Ae, Clock as je, Code as Me, Columns2 as Ne, Copy as Pe, Edit as Fe, ExternalLink as Ie, Eye as Le, EyeOff as Re, File as ze, FileArchive as Be, FileText as J, History as Ve, Image as Y, Inbox as He, Italic as X, Link as Ue, List as We, Loader2 as Ge, Lock as Ke, Mail as qe, MessageSquare as Je, Network as Ye, PanelRightClose as Xe, PanelRightOpen as Ze, Paperclip as Qe, Pencil as $e, Phone as et, Pin as tt, Plus as nt, PlusCircle as rt, RotateCcw as it, Rows3 as at, Search as ot, Send as st, Share2 as ct, SmilePlus as lt, Star as ut, StickyNote as dt, Trash2 as ft, Upload as pt, X as mt, Zap as ht, icons as gt } from "lucide-react";
|
|
6
|
+
import { InlineEditProvider as _t, SchemaRenderer as vt, SchemaRendererContext as yt, toPredicateInput as bt, useActionEngine as xt, useCondition as St, useDataInvalidation as Ct, useDiscussionContext as wt, useHighlightFieldNames as Tt, useInlineEdit as Et, useMetadataItem as Dt, useRecordContext as Ot, useRegisterHighlightFields as kt, useRelatedRecordActions as At, useSafeFieldLabel as jt } from "@object-ui/react";
|
|
7
|
+
import { AvatarField as Mt, BooleanField as Nt, CapabilityMultiSelectField as Pt, CurrencyField as Ft, FileField as It, ImageField as Lt, LookupField as Rt, NumberField as zt, PercentField as Bt, RecordPickerDialog as Vt, SelectField as Ht, SignatureField as Ut, UserField as Wt, coerceToSafeValue as Gt, getCellRenderer as Kt, humanizeLabel as qt, parseCapabilityNames as Jt, resolveCellRendererType as Yt } from "@object-ui/fields";
|
|
8
|
+
import { createSafeTranslation as Xt, pickLocalized as Zt, resolveFieldCurrency as Qt, useLocalization as $t, useObjectTranslation as en, useSafeTranslate as tn } from "@object-ui/i18n";
|
|
9
|
+
import { Link as nn, useParams as rn } from "react-router-dom";
|
|
10
|
+
import { Fragment as an, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
11
|
+
import { useFieldPermissions as on, usePermissions as sn } from "@object-ui/permissions";
|
|
12
|
+
import { ACTION_LOCATIONS as cn, AUDIT_FIELD_BY_ROLE as ln, SYSTEM_MANAGED_FIELD_NAMES as un, detectStatusField as dn } from "@object-ui/types";
|
|
13
|
+
import { FeedFilterMode as fn, FeedItemType as pn, deriveFieldGroupLayout as mn } from "@objectstack/spec/data";
|
|
14
14
|
//#region src/autoLayout.ts
|
|
15
|
-
var
|
|
15
|
+
var hn = /* @__PURE__ */ new Set([
|
|
16
16
|
"textarea",
|
|
17
17
|
"markdown",
|
|
18
18
|
"html",
|
|
@@ -24,33 +24,33 @@ var dn = /* @__PURE__ */ new Set([
|
|
|
24
24
|
"field:grid",
|
|
25
25
|
"field:rich-text"
|
|
26
26
|
]);
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function gn(e) {
|
|
28
|
+
return hn.has(e);
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function _n(e, t) {
|
|
31
31
|
let n;
|
|
32
32
|
return n = e <= 3 ? 1 : e <= 8 ? 2 : e <= 15 ? 3 : 4, t !== void 0 && t < 640 ? Math.min(n, 1) : n;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type &&
|
|
34
|
+
function vn(e, t) {
|
|
35
|
+
return t <= 1 ? e : e.map((e) => e.span === void 0 && e.type && gn(e.type) ? {
|
|
36
36
|
...e,
|
|
37
37
|
span: t
|
|
38
38
|
} : e);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function yn(e, t, n) {
|
|
41
41
|
if (t !== void 0) return {
|
|
42
|
-
fields:
|
|
42
|
+
fields: vn(e, t),
|
|
43
43
|
columns: t
|
|
44
44
|
};
|
|
45
|
-
let r =
|
|
45
|
+
let r = _n(e.length, n);
|
|
46
46
|
return {
|
|
47
|
-
fields:
|
|
47
|
+
fields: vn(e, r),
|
|
48
48
|
columns: r
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
//#endregion
|
|
52
52
|
//#region src/useDetailTranslation.ts
|
|
53
|
-
var
|
|
53
|
+
var bn = Xt, xn = {
|
|
54
54
|
"detail.back": "Back",
|
|
55
55
|
"detail.edit": "Edit",
|
|
56
56
|
"detail.editInline": "Edit",
|
|
@@ -183,16 +183,19 @@ var gn = Yt, _n = {
|
|
|
183
183
|
"detail.lockedTooltip": "This record has a pending approval request; editing is locked",
|
|
184
184
|
"detail.approvalPendingEditable": "In approval · editable",
|
|
185
185
|
"detail.approvalPendingTooltip": "This record has a pending approval request; this step still allows editing",
|
|
186
|
+
"detail.approvalProgress": "Approvals — {{got}} of {{need}}",
|
|
187
|
+
"detail.approvalProgressGroups": "Sign-off — {{got}} of {{need}} groups",
|
|
188
|
+
"detail.approvalProgressLabel": "Approval progress",
|
|
186
189
|
"detail.cancelApproval": "Recall approval",
|
|
187
190
|
"detail.cancelApprovalInFlight": "Recalling…",
|
|
188
191
|
"detail.cancelApprovalTooltip": "Recall the pending approval request to unlock this record",
|
|
189
192
|
"detail.cancelApprovalTooltipUnlocked": "Recall the pending approval request",
|
|
190
193
|
"detail.cancelApprovalFailed": "Failed to recall approval",
|
|
191
194
|
"detail.cancelApprovalUnavailable": "Recalling approvals is not supported on this data source"
|
|
192
|
-
}, $ =
|
|
195
|
+
}, $ = bn(xn, "detail.back");
|
|
193
196
|
//#endregion
|
|
194
197
|
//#region src/renderers/PermissionFacetLink.tsx
|
|
195
|
-
function
|
|
198
|
+
function Sn(e) {
|
|
196
199
|
if (typeof e == "string") {
|
|
197
200
|
let t = e.trim();
|
|
198
201
|
if (!t) return null;
|
|
@@ -204,12 +207,12 @@ function vn(e) {
|
|
|
204
207
|
}
|
|
205
208
|
return e ?? null;
|
|
206
209
|
}
|
|
207
|
-
function
|
|
208
|
-
let t =
|
|
210
|
+
function Cn(e) {
|
|
211
|
+
let t = Sn(e);
|
|
209
212
|
return t == null || t === "" ? 0 : Array.isArray(t) ? t.length : typeof t == "object" ? Object.keys(t).length : 1;
|
|
210
213
|
}
|
|
211
|
-
function
|
|
212
|
-
let { t: n } = $(), r =
|
|
214
|
+
function wn({ value: e, field: t }) {
|
|
215
|
+
let { t: n } = $(), r = Ot(), { appName: i } = rn(), a = t?.name || "", o = r?.data?.name, s = i && o ? `/apps/${i}/metadata/permission/${encodeURIComponent(String(o))}` : null, c = Cn(e), l = c === 0;
|
|
213
216
|
return /* @__PURE__ */ Q("span", {
|
|
214
217
|
className: "inline-flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",
|
|
215
218
|
children: [(() => {
|
|
@@ -218,7 +221,7 @@ function bn({ value: e, field: t }) {
|
|
|
218
221
|
children: n("perm.facet.none", { defaultValue: "None" })
|
|
219
222
|
});
|
|
220
223
|
if (a === "system_permissions") {
|
|
221
|
-
let t =
|
|
224
|
+
let t = Jt(e), r = t.slice(0, 6), i = t.length - r.length;
|
|
222
225
|
return /* @__PURE__ */ Q("span", {
|
|
223
226
|
className: "inline-flex flex-wrap items-center gap-1",
|
|
224
227
|
children: [r.map((e) => /* @__PURE__ */ Z(E, {
|
|
@@ -258,7 +261,7 @@ function bn({ value: e, field: t }) {
|
|
|
258
261
|
}
|
|
259
262
|
})()
|
|
260
263
|
});
|
|
261
|
-
})(), s ? /* @__PURE__ */ Z(
|
|
264
|
+
})(), s ? /* @__PURE__ */ Z(nn, {
|
|
262
265
|
to: s,
|
|
263
266
|
className: "text-primary hover:underline whitespace-nowrap",
|
|
264
267
|
children: n("perm.facet.designInStudio", { defaultValue: "Design in Studio →" })
|
|
@@ -270,7 +273,7 @@ function bn({ value: e, field: t }) {
|
|
|
270
273
|
}
|
|
271
274
|
//#endregion
|
|
272
275
|
//#region src/systemFields.ts
|
|
273
|
-
var
|
|
276
|
+
var Tn = /* @__PURE__ */ new Set([
|
|
274
277
|
"id",
|
|
275
278
|
"_id",
|
|
276
279
|
"__v",
|
|
@@ -287,91 +290,91 @@ var xn = /* @__PURE__ */ new Set([
|
|
|
287
290
|
"is_deleted",
|
|
288
291
|
"deleted",
|
|
289
292
|
"instance_state"
|
|
290
|
-
]),
|
|
293
|
+
]), En = /* @__PURE__ */ new Set([
|
|
291
294
|
"formula",
|
|
292
295
|
"summary",
|
|
293
296
|
"rollup",
|
|
294
297
|
"auto_number"
|
|
295
298
|
]);
|
|
296
|
-
function
|
|
299
|
+
function Dn(e) {
|
|
297
300
|
if (e == null) return e;
|
|
298
|
-
if (Array.isArray(e)) return e.map(
|
|
301
|
+
if (Array.isArray(e)) return e.map(Dn);
|
|
299
302
|
if (typeof e == "object") {
|
|
300
303
|
let t = e;
|
|
301
304
|
return t.id ?? t._id ?? t.value ?? "";
|
|
302
305
|
}
|
|
303
306
|
return e;
|
|
304
307
|
}
|
|
305
|
-
var
|
|
308
|
+
var On = ({ field: e, value: t, onChange: n, dataSource: r, autoFocus: i }) => {
|
|
306
309
|
let a = e.type, o = e.widget;
|
|
307
|
-
if (o === "permission-facet-link") return /* @__PURE__ */ Z(
|
|
310
|
+
if (o === "permission-facet-link") return /* @__PURE__ */ Z(wn, {
|
|
308
311
|
value: t,
|
|
309
312
|
field: e
|
|
310
313
|
});
|
|
311
|
-
if (o === "capability-multiselect") return /* @__PURE__ */ Z(
|
|
314
|
+
if (o === "capability-multiselect") return /* @__PURE__ */ Z(Pt, {
|
|
312
315
|
value: t,
|
|
313
316
|
onChange: (e) => n(e),
|
|
314
317
|
field: e,
|
|
315
318
|
dataSource: r
|
|
316
319
|
});
|
|
317
320
|
let s = a === "multiselect" || !!e.multiple;
|
|
318
|
-
if ((a === "select" || a === "multiselect") && Array.isArray(e.options) && e.options.length > 0) return s ? /* @__PURE__ */ Z(
|
|
321
|
+
if ((a === "select" || a === "multiselect") && Array.isArray(e.options) && e.options.length > 0) return s ? /* @__PURE__ */ Z(Ht, {
|
|
319
322
|
field: {
|
|
320
323
|
...e,
|
|
321
324
|
multiple: !0
|
|
322
325
|
},
|
|
323
326
|
value: Array.isArray(t) ? t : t == null || t === "" ? [] : [t],
|
|
324
327
|
onChange: (e) => n(e)
|
|
325
|
-
}) : /* @__PURE__ */ Z(
|
|
328
|
+
}) : /* @__PURE__ */ Z(Ht, {
|
|
326
329
|
field: e,
|
|
327
330
|
value: t == null ? "" : String(t),
|
|
328
331
|
onChange: (e) => n(e)
|
|
329
332
|
});
|
|
330
|
-
if (a === "boolean") return /* @__PURE__ */ Z(
|
|
333
|
+
if (a === "boolean") return /* @__PURE__ */ Z(Nt, {
|
|
331
334
|
field: e,
|
|
332
335
|
value: !!t,
|
|
333
336
|
onChange: (e) => n(e)
|
|
334
337
|
});
|
|
335
|
-
if (a === "image") return /* @__PURE__ */ Z(
|
|
338
|
+
if (a === "image") return /* @__PURE__ */ Z(Lt, {
|
|
336
339
|
field: e,
|
|
337
340
|
value: t,
|
|
338
341
|
onChange: (e) => n(e)
|
|
339
342
|
});
|
|
340
|
-
if (a === "avatar") return /* @__PURE__ */ Z(
|
|
343
|
+
if (a === "avatar") return /* @__PURE__ */ Z(Mt, {
|
|
341
344
|
field: e,
|
|
342
345
|
value: t,
|
|
343
346
|
onChange: (e) => n(e)
|
|
344
347
|
});
|
|
345
|
-
if (a === "signature") return /* @__PURE__ */ Z(
|
|
348
|
+
if (a === "signature") return /* @__PURE__ */ Z(Ut, {
|
|
346
349
|
field: e,
|
|
347
350
|
value: t,
|
|
348
351
|
onChange: (e) => n(e)
|
|
349
352
|
});
|
|
350
|
-
if (a === "file" || a === "video" || a === "audio") return /* @__PURE__ */ Z(
|
|
353
|
+
if (a === "file" || a === "video" || a === "audio") return /* @__PURE__ */ Z(It, {
|
|
351
354
|
field: e,
|
|
352
355
|
value: t,
|
|
353
356
|
onChange: (e) => n(e)
|
|
354
357
|
});
|
|
355
|
-
let c = a === "user" || a === "owner", l = a === "lookup" || a === "master_detail" || a === "tree" || !!e.reference_to && !
|
|
356
|
-
if (c || l) return /* @__PURE__ */ Z(c ?
|
|
358
|
+
let c = a === "user" || a === "owner", l = a === "lookup" || a === "master_detail" || a === "tree" || !!e.reference_to && !En.has(a);
|
|
359
|
+
if (c || l) return /* @__PURE__ */ Z(c ? Wt : Rt, {
|
|
357
360
|
field: e,
|
|
358
361
|
value: t,
|
|
359
362
|
onChange: (e) => n(e),
|
|
360
363
|
dataSource: r
|
|
361
364
|
});
|
|
362
|
-
if (a === "number") return /* @__PURE__ */ Z(
|
|
365
|
+
if (a === "number") return /* @__PURE__ */ Z(zt, {
|
|
363
366
|
field: e,
|
|
364
367
|
value: t,
|
|
365
368
|
onChange: (e) => n(e),
|
|
366
369
|
autoFocus: i
|
|
367
370
|
});
|
|
368
|
-
if (a === "currency") return /* @__PURE__ */ Z(
|
|
371
|
+
if (a === "currency") return /* @__PURE__ */ Z(Ft, {
|
|
369
372
|
field: e,
|
|
370
373
|
value: t,
|
|
371
374
|
onChange: (e) => n(e),
|
|
372
375
|
autoFocus: i
|
|
373
376
|
});
|
|
374
|
-
if (a === "percent") return /* @__PURE__ */ Z(
|
|
377
|
+
if (a === "percent") return /* @__PURE__ */ Z(Bt, {
|
|
375
378
|
field: e,
|
|
376
379
|
value: t,
|
|
377
380
|
onChange: (e) => n(e),
|
|
@@ -387,18 +390,18 @@ var wn = ({ field: e, value: t, onChange: n, dataSource: r, autoFocus: i }) => {
|
|
|
387
390
|
if (/^\d{4}-\d{2}-\d{2}/.test(e)) return e.slice(0, 10);
|
|
388
391
|
let n = new Date(e);
|
|
389
392
|
return isNaN(n.getTime()) ? "" : n.toLocaleDateString("en-CA");
|
|
390
|
-
})() : String(typeof t == "object" ?
|
|
393
|
+
})() : String(typeof t == "object" ? Gt(t) ?? "" : t),
|
|
391
394
|
onChange: (e) => {
|
|
392
395
|
let t = e.target.value;
|
|
393
396
|
n(u && t ? (/* @__PURE__ */ new Date(t + "T00:00:00")).toISOString() : t);
|
|
394
397
|
}
|
|
395
398
|
});
|
|
396
|
-
},
|
|
397
|
-
function
|
|
399
|
+
}, kn = /* @__PURE__ */ "options.currency.currencyConfig.precision.scale.min.max.step.format.widget.dueLike.multiple.reference_field.display_field.displayField.description_field.descriptionField.id_field.allow_create.allowCreate.lookup_columns.lookupColumns.lookup_page_size.lookupPageSize.lookup_filters.lookupFilters.picker.subtitle.avatar_field.avatarField.depends_on.dependsOn".split(".");
|
|
400
|
+
function An(e, t) {
|
|
398
401
|
let n = { ...e };
|
|
399
402
|
if (!t) return n;
|
|
400
403
|
!n.type && t.type && (n.type = t.type);
|
|
401
|
-
for (let e of
|
|
404
|
+
for (let e of kn) {
|
|
402
405
|
let r = t[e];
|
|
403
406
|
r !== void 0 && n[e] === void 0 && (n[e] = r);
|
|
404
407
|
}
|
|
@@ -407,7 +410,7 @@ function En(e, t) {
|
|
|
407
410
|
}
|
|
408
411
|
//#endregion
|
|
409
412
|
//#region src/DetailSection.tsx
|
|
410
|
-
var
|
|
413
|
+
var jn = ({ name: e }) => /^[a-z0-9][a-z0-9-]*$/i.test(e) ? /* @__PURE__ */ Z(re, {
|
|
411
414
|
name: e,
|
|
412
415
|
className: "h-4 w-4 shrink-0 text-muted-foreground",
|
|
413
416
|
"aria-hidden": !0
|
|
@@ -415,11 +418,11 @@ var Dn = ({ name: e }) => /^[a-z0-9][a-z0-9-]*$/i.test(e) ? /* @__PURE__ */ Z(ie
|
|
|
415
418
|
className: "text-muted-foreground",
|
|
416
419
|
children: e
|
|
417
420
|
});
|
|
418
|
-
function
|
|
421
|
+
function Mn(e, t) {
|
|
419
422
|
return !e || e <= 1 || t <= 1 ? "" : t === 2 ? e >= 2 ? "md:col-span-2" : "" : t === 3 ? e === 2 ? "md:col-span-2" : e >= 3 ? "md:col-span-2 lg:col-span-3" : "" : e === 2 ? "md:col-span-2" : e === 3 ? "md:col-span-2 lg:col-span-3" : e >= 4 ? "md:col-span-2 lg:col-span-3 xl:col-span-4" : "";
|
|
420
423
|
}
|
|
421
|
-
var
|
|
422
|
-
let [f, p] = u.useState(e.defaultCollapsed ?? !1), [m, h] = u.useState(null), [g, _] = u.useState(void 0), [v, y] = u.useState(!1), { t: b } = $(), { fieldLabel: x, translateOptions: S } =
|
|
424
|
+
var Nn = ({ section: e, data: t, className: n, objectSchema: r, objectName: i, isEditing: a = !1, onFieldChange: o, onEnterInlineEdit: s, autoFocusField: c, dataSource: l, virtualScroll: d }) => {
|
|
425
|
+
let [f, p] = u.useState(e.defaultCollapsed ?? !1), [m, h] = u.useState(null), [g, _] = u.useState(void 0), [v, y] = u.useState(!1), { t: b } = $(), { fieldLabel: x, translateOptions: S } = jt(), C = u.useCallback((e, t) => {
|
|
423
426
|
let n = t == null ? "" : String(t);
|
|
424
427
|
navigator.clipboard.writeText(n).then(() => {
|
|
425
428
|
h(e), setTimeout(() => h(null), 2e3);
|
|
@@ -427,19 +430,19 @@ var kn = ({ section: e, data: t, className: n, objectSchema: r, objectName: i, i
|
|
|
427
430
|
}, []), w = u.useCallback((e) => {
|
|
428
431
|
let n = t?.[e.name] ?? e.value;
|
|
429
432
|
return n == null || n === "";
|
|
430
|
-
}, [t]), T = u.useMemo(() => e.fields.filter(w).length, [e.fields, w]), E =
|
|
433
|
+
}, [t]), T = u.useMemo(() => e.fields.filter(w).length, [e.fields, w]), E = pe(), te = E ? 3 : 4, ne = E ? .2 : .25, re = e.fields.length - T, ie = !e.hideEmpty && !a && e.fields.length >= te && T / e.fields.length >= ne && re > 0, P = !v && (e.hideEmpty || ie) ? e.fields.filter((e) => !w(e)) : e.fields, { fields: ae, columns: oe } = yn(P, e.columns), se = Math.min(oe, Math.max(1, P.length)), F = (e) => {
|
|
431
434
|
let n = t?.[e.name] ?? e.value;
|
|
432
|
-
if (e.render) return /* @__PURE__ */ Z(
|
|
435
|
+
if (e.render) return /* @__PURE__ */ Z(vt, {
|
|
433
436
|
schema: e.render,
|
|
434
437
|
data: {
|
|
435
438
|
...t,
|
|
436
439
|
value: n
|
|
437
440
|
}
|
|
438
441
|
});
|
|
439
|
-
let u =
|
|
442
|
+
let u = Mn(e.span, se), d = r?.fields?.[e.name], f = An(e, d);
|
|
440
443
|
i && Array.isArray(f.options) && f.options.length > 0 && (f.options = S(i, e.name, f.options));
|
|
441
|
-
let p = f.type || e.type, h =
|
|
442
|
-
if ((f.widget || e.widget) === "permission-facet-link") return /* @__PURE__ */ Z(
|
|
444
|
+
let p = f.type || e.type, h = En.has(p), g = e.readonly === !0 || d?.readonly === !0, _ = Tn.has(e.name), v = !g && !h && !_, y = v && !!s, w = (() => {
|
|
445
|
+
if ((f.widget || e.widget) === "permission-facet-link") return /* @__PURE__ */ Z(wn, {
|
|
443
446
|
value: n,
|
|
444
447
|
field: f
|
|
445
448
|
});
|
|
@@ -449,9 +452,9 @@ var kn = ({ section: e, data: t, className: n, objectSchema: r, objectName: i, i
|
|
|
449
452
|
title: b("detail.noValue", { defaultValue: "No value" }),
|
|
450
453
|
children: "—"
|
|
451
454
|
});
|
|
452
|
-
let t =
|
|
455
|
+
let t = Yt(f) || e.type;
|
|
453
456
|
if (t) {
|
|
454
|
-
let e =
|
|
457
|
+
let e = Kt(t);
|
|
455
458
|
if (e) return /* @__PURE__ */ Z(e, {
|
|
456
459
|
value: n,
|
|
457
460
|
field: f
|
|
@@ -460,7 +463,7 @@ var kn = ({ section: e, data: t, className: n, objectSchema: r, objectName: i, i
|
|
|
460
463
|
return String(n);
|
|
461
464
|
})(), T = n != null && n !== "", O = T && !y, k = m === e.name, A = x(i || "", e.name, e.label || e.name);
|
|
462
465
|
return E && !(a && v) ? /* @__PURE__ */ Q("div", {
|
|
463
|
-
className:
|
|
466
|
+
className: W("flex items-baseline justify-between gap-4 py-2.5 min-h-[44px] group", T && "cursor-pointer active:bg-muted/40 transition-colors"),
|
|
464
467
|
onClick: T ? () => C(e.name, n) : void 0,
|
|
465
468
|
onKeyDown: T ? (t) => {
|
|
466
469
|
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), C(e.name, n));
|
|
@@ -475,13 +478,13 @@ var kn = ({ section: e, data: t, className: n, objectSchema: r, objectName: i, i
|
|
|
475
478
|
children: w
|
|
476
479
|
})]
|
|
477
480
|
}, e.name) : /* @__PURE__ */ Q("div", {
|
|
478
|
-
className:
|
|
481
|
+
className: W("space-y-1.5 group min-w-0", u),
|
|
479
482
|
children: [/* @__PURE__ */ Z("div", {
|
|
480
483
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
481
484
|
children: x(i || "", e.name, e.label || e.name)
|
|
482
485
|
}), a && v ? /* @__PURE__ */ Z("div", {
|
|
483
486
|
className: "min-h-[44px] sm:min-h-0",
|
|
484
|
-
children: /* @__PURE__ */ Z(
|
|
487
|
+
children: /* @__PURE__ */ Z(On, {
|
|
485
488
|
field: f,
|
|
486
489
|
value: n,
|
|
487
490
|
onChange: (t) => o?.(e.name, t),
|
|
@@ -489,7 +492,7 @@ var kn = ({ section: e, data: t, className: n, objectSchema: r, objectName: i, i
|
|
|
489
492
|
autoFocus: c === e.name
|
|
490
493
|
})
|
|
491
494
|
}) : /* @__PURE__ */ Q("div", {
|
|
492
|
-
className:
|
|
495
|
+
className: W("flex items-start justify-between gap-2 min-h-[44px] sm:min-h-0 rounded-md", O && "cursor-pointer active:bg-muted/60 transition-colors", y && "cursor-pointer hover:bg-muted/40 transition-colors -mx-1.5 px-1.5"),
|
|
493
496
|
onClick: O ? () => C(e.name, n) : void 0,
|
|
494
497
|
onDoubleClick: y ? () => s?.(e.name) : void 0,
|
|
495
498
|
onKeyDown: O ? (t) => {
|
|
@@ -501,7 +504,7 @@ var kn = ({ section: e, data: t, className: n, objectSchema: r, objectName: i, i
|
|
|
501
504
|
children: [/* @__PURE__ */ Z("div", {
|
|
502
505
|
className: "text-sm flex-1 min-w-0 break-words py-1",
|
|
503
506
|
children: w
|
|
504
|
-
}), y ? /* @__PURE__ */ Z(
|
|
507
|
+
}), y ? /* @__PURE__ */ Z(fe, { children: /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
505
508
|
asChild: !0,
|
|
506
509
|
children: /* @__PURE__ */ Z(D, {
|
|
507
510
|
variant: "ghost",
|
|
@@ -511,9 +514,9 @@ var kn = ({ section: e, data: t, className: n, objectSchema: r, objectName: i, i
|
|
|
511
514
|
onClick: (t) => {
|
|
512
515
|
t.stopPropagation(), s?.(e.name);
|
|
513
516
|
},
|
|
514
|
-
children: /* @__PURE__ */ Z(
|
|
517
|
+
children: /* @__PURE__ */ Z($e, { className: "h-3 w-3" })
|
|
515
518
|
})
|
|
516
|
-
}), /* @__PURE__ */ Z(
|
|
519
|
+
}), /* @__PURE__ */ Z(V, { children: b("detail.editInlineHint") })] }) }) : T ? /* @__PURE__ */ Z(fe, { children: /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
517
520
|
asChild: !0,
|
|
518
521
|
children: /* @__PURE__ */ Z(D, {
|
|
519
522
|
variant: "ghost",
|
|
@@ -522,36 +525,36 @@ var kn = ({ section: e, data: t, className: n, objectSchema: r, objectName: i, i
|
|
|
522
525
|
onClick: (t) => {
|
|
523
526
|
t.stopPropagation(), C(e.name, n);
|
|
524
527
|
},
|
|
525
|
-
children: k ? /* @__PURE__ */ Z(q, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(
|
|
528
|
+
children: k ? /* @__PURE__ */ Z(q, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Pe, { className: "h-3 w-3" })
|
|
526
529
|
})
|
|
527
|
-
}), /* @__PURE__ */ Z(
|
|
530
|
+
}), /* @__PURE__ */ Z(V, { children: b(k ? "detail.copied" : "detail.copyToClipboard") })] }) }) : null]
|
|
528
531
|
})]
|
|
529
532
|
}, e.name);
|
|
530
|
-
},
|
|
533
|
+
}, ce = d?.enabled === !0, I = d?.batchSize ?? 20;
|
|
531
534
|
if (u.useEffect(() => {
|
|
532
|
-
if (!
|
|
535
|
+
if (!ce) {
|
|
533
536
|
_(void 0);
|
|
534
537
|
return;
|
|
535
538
|
}
|
|
536
|
-
if (
|
|
539
|
+
if (ae.length <= I) {
|
|
537
540
|
_(void 0);
|
|
538
541
|
return;
|
|
539
542
|
}
|
|
540
|
-
_(
|
|
543
|
+
_(I);
|
|
541
544
|
let e = setTimeout(() => _(void 0), 100);
|
|
542
545
|
return () => clearTimeout(e);
|
|
543
546
|
}, [
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
]),
|
|
548
|
-
let
|
|
547
|
+
ce,
|
|
548
|
+
ae.length,
|
|
549
|
+
I
|
|
550
|
+
]), P.length === 0 && T === e.fields.length) return null;
|
|
551
|
+
let le = g === void 0 ? ae : ae.slice(0, g), L = T > 0 && (e.hideEmpty || ie), R = /* @__PURE__ */ Q(an, { children: [E ? /* @__PURE__ */ Z("div", {
|
|
549
552
|
className: "flex flex-col divide-y divide-border/60",
|
|
550
|
-
children:
|
|
553
|
+
children: le.map(F)
|
|
551
554
|
}) : /* @__PURE__ */ Z("div", {
|
|
552
|
-
className:
|
|
553
|
-
children:
|
|
554
|
-
}),
|
|
555
|
+
className: W("grid gap-3 sm:gap-4", se === 1 ? "grid-cols-1" : se === 2 ? "grid-cols-1 md:grid-cols-2" : se === 3 ? "grid-cols-1 md:grid-cols-2 lg:grid-cols-3" : "grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"),
|
|
556
|
+
children: le.map(F)
|
|
557
|
+
}), L && /* @__PURE__ */ Z("div", {
|
|
555
558
|
className: "mt-3 -ml-2",
|
|
556
559
|
children: /* @__PURE__ */ Q(D, {
|
|
557
560
|
type: "button",
|
|
@@ -559,28 +562,28 @@ var kn = ({ section: e, data: t, className: n, objectSchema: r, objectName: i, i
|
|
|
559
562
|
size: "sm",
|
|
560
563
|
onClick: () => y((e) => !e),
|
|
561
564
|
className: "h-7 px-2 text-xs text-muted-foreground hover:text-foreground",
|
|
562
|
-
children: [Z(v ?
|
|
565
|
+
children: [Z(v ? Re : Le, { className: "h-3.5 w-3.5 mr-1.5" }), v ? b("detail.hideEmptyFields", { defaultValue: "Hide empty fields" }) : b("detail.showEmptyFields", {
|
|
563
566
|
count: T,
|
|
564
567
|
defaultValue: `Show ${T} empty field${T === 1 ? "" : "s"}`
|
|
565
568
|
})]
|
|
566
569
|
})
|
|
567
570
|
})] });
|
|
568
571
|
return !e.title && !e.collapsible && e.showBorder === !1 ? /* @__PURE__ */ Z("div", {
|
|
569
|
-
className:
|
|
570
|
-
children:
|
|
572
|
+
className: W(n),
|
|
573
|
+
children: R
|
|
571
574
|
}) : e.collapsible ? /* @__PURE__ */ Z(M, {
|
|
572
575
|
open: !f,
|
|
573
576
|
onOpenChange: (e) => p(!e),
|
|
574
577
|
className: n,
|
|
575
|
-
children: /* @__PURE__ */ Q(O, { children: [/* @__PURE__ */ Z(
|
|
578
|
+
children: /* @__PURE__ */ Q(O, { children: [/* @__PURE__ */ Z(ee, {
|
|
576
579
|
asChild: !0,
|
|
577
580
|
children: /* @__PURE__ */ Q(A, {
|
|
578
|
-
className:
|
|
581
|
+
className: W("py-3 px-4 sm:py-4 sm:px-6 cursor-pointer hover:bg-muted/50 transition-colors", e.headerColor && `bg-${e.headerColor}`),
|
|
579
582
|
children: [/* @__PURE__ */ Q(j, {
|
|
580
583
|
className: "flex items-center justify-between text-base font-semibold tracking-tight",
|
|
581
584
|
children: [/* @__PURE__ */ Q("div", {
|
|
582
585
|
className: "flex items-center gap-2",
|
|
583
|
-
children: [e.icon && /* @__PURE__ */ Z(
|
|
586
|
+
children: [e.icon && /* @__PURE__ */ Z(jn, { name: e.icon }), /* @__PURE__ */ Z("span", { children: e.title })]
|
|
584
587
|
}), /* @__PURE__ */ Z("div", {
|
|
585
588
|
className: "flex items-center gap-2",
|
|
586
589
|
children: Z(f ? De : Te, { className: "h-4 w-4 text-muted-foreground" })
|
|
@@ -590,19 +593,19 @@ var kn = ({ section: e, data: t, className: n, objectSchema: r, objectName: i, i
|
|
|
590
593
|
children: e.description
|
|
591
594
|
})]
|
|
592
595
|
})
|
|
593
|
-
}), /* @__PURE__ */ Z(
|
|
596
|
+
}), /* @__PURE__ */ Z(N, { children: /* @__PURE__ */ Z(k, {
|
|
594
597
|
className: "pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5",
|
|
595
|
-
children:
|
|
598
|
+
children: R
|
|
596
599
|
}) })] })
|
|
597
600
|
}) : /* @__PURE__ */ Q(O, {
|
|
598
|
-
className:
|
|
601
|
+
className: W(e.showBorder === !1 ? "border-none shadow-none" : "", n),
|
|
599
602
|
children: [e.title && /* @__PURE__ */ Q(A, {
|
|
600
|
-
className:
|
|
603
|
+
className: W("py-3 px-4 sm:py-4 sm:px-6", e.headerColor && `bg-${e.headerColor}`),
|
|
601
604
|
children: [/* @__PURE__ */ Z(j, {
|
|
602
605
|
className: "flex items-center justify-between text-base font-semibold tracking-tight",
|
|
603
606
|
children: /* @__PURE__ */ Q("div", {
|
|
604
607
|
className: "flex items-center gap-2",
|
|
605
|
-
children: [e.icon && /* @__PURE__ */ Z(
|
|
608
|
+
children: [e.icon && /* @__PURE__ */ Z(jn, { name: e.icon }), /* @__PURE__ */ Z("span", { children: e.title })]
|
|
606
609
|
})
|
|
607
610
|
}), e.description && /* @__PURE__ */ Z("p", {
|
|
608
611
|
className: "text-xs text-muted-foreground mt-1",
|
|
@@ -610,18 +613,18 @@ var kn = ({ section: e, data: t, className: n, objectSchema: r, objectName: i, i
|
|
|
610
613
|
})]
|
|
611
614
|
}), /* @__PURE__ */ Z(k, {
|
|
612
615
|
className: "pt-3 sm:pt-4 px-3 sm:px-6 pb-4 sm:pb-5",
|
|
613
|
-
children:
|
|
616
|
+
children: R
|
|
614
617
|
})]
|
|
615
618
|
});
|
|
616
|
-
},
|
|
619
|
+
}, Pn = ({ tabs: e, data: t, className: n }) => {
|
|
617
620
|
let [r, i] = u.useState(e[0]?.key), a = e.filter((e) => typeof e.visible == "boolean" ? e.visible : (e.visible, !0));
|
|
618
|
-
return /* @__PURE__ */ Q(
|
|
621
|
+
return /* @__PURE__ */ Q(R, {
|
|
619
622
|
value: r,
|
|
620
623
|
onValueChange: i,
|
|
621
624
|
className: n,
|
|
622
|
-
children: [/* @__PURE__ */ Z(
|
|
625
|
+
children: [/* @__PURE__ */ Z(z, {
|
|
623
626
|
className: "w-full justify-start border-b rounded-none bg-transparent p-0",
|
|
624
|
-
children: a.map((e) => /* @__PURE__ */ Z(
|
|
627
|
+
children: a.map((e) => /* @__PURE__ */ Z(de, {
|
|
625
628
|
value: e.key,
|
|
626
629
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
627
630
|
children: /* @__PURE__ */ Q("div", {
|
|
@@ -637,18 +640,18 @@ var kn = ({ section: e, data: t, className: n, objectSchema: r, objectName: i, i
|
|
|
637
640
|
]
|
|
638
641
|
})
|
|
639
642
|
}, e.key))
|
|
640
|
-
}), a.map((e) => /* @__PURE__ */ Z(
|
|
643
|
+
}), a.map((e) => /* @__PURE__ */ Z(ue, {
|
|
641
644
|
value: e.key,
|
|
642
645
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
643
646
|
children: /* @__PURE__ */ Z(u.Suspense, {
|
|
644
647
|
fallback: null,
|
|
645
648
|
children: Array.isArray(e.content) ? /* @__PURE__ */ Z("div", {
|
|
646
649
|
className: "space-y-4",
|
|
647
|
-
children: e.content.map((e, n) => /* @__PURE__ */ Z(
|
|
650
|
+
children: e.content.map((e, n) => /* @__PURE__ */ Z(vt, {
|
|
648
651
|
schema: e,
|
|
649
652
|
data: t
|
|
650
653
|
}, n))
|
|
651
|
-
}) : /* @__PURE__ */ Z(
|
|
654
|
+
}) : /* @__PURE__ */ Z(vt, {
|
|
652
655
|
schema: e.content,
|
|
653
656
|
data: t
|
|
654
657
|
})
|
|
@@ -658,10 +661,10 @@ var kn = ({ section: e, data: t, className: n, objectSchema: r, objectName: i, i
|
|
|
658
661
|
};
|
|
659
662
|
//#endregion
|
|
660
663
|
//#region src/RelatedList.tsx
|
|
661
|
-
function
|
|
662
|
-
return e &&
|
|
664
|
+
function Fn(e) {
|
|
665
|
+
return e && gt[e.split(/[-_\s]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")] || He;
|
|
663
666
|
}
|
|
664
|
-
function
|
|
667
|
+
function In(e) {
|
|
665
668
|
if (!e) return [];
|
|
666
669
|
if (typeof e == "string") {
|
|
667
670
|
let t = e.trim();
|
|
@@ -675,10 +678,10 @@ function Mn(e) {
|
|
|
675
678
|
}
|
|
676
679
|
return e.filter((e) => !!e?.field);
|
|
677
680
|
}
|
|
678
|
-
var
|
|
679
|
-
let n = e.visible, r =
|
|
681
|
+
var Ln = ({ action: e, onToolbarAction: t }) => {
|
|
682
|
+
let n = e.visible, r = St(bt(n));
|
|
680
683
|
if (n && !r) return null;
|
|
681
|
-
let i = e.icon ?
|
|
684
|
+
let i = e.icon ? Fn(e.icon) : null;
|
|
682
685
|
return /* @__PURE__ */ Q(D, {
|
|
683
686
|
variant: e.variant === "primary" ? "default" : "outline",
|
|
684
687
|
size: "sm",
|
|
@@ -689,23 +692,23 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
689
692
|
"data-testid": `related-toolbar-action-${e.name}`,
|
|
690
693
|
children: [i && /* @__PURE__ */ Z(i, { className: "h-3.5 w-3.5" }), e.label || e.name]
|
|
691
694
|
});
|
|
692
|
-
},
|
|
693
|
-
let
|
|
695
|
+
}, Rn = ({ title: e, type: t, api: i, data: a, schema: c, columns: d, className: f, dataSource: p, objectName: S, onNew: C, onViewAll: w, onRowEdit: T, onRowDelete: M, onRowClick: N, rowActions: ee, onRowAction: te, toolbarActions: re, onToolbarAction: ie, add: P, maxColumns: ae = 6, pageSize: oe, defaultSort: se, sortable: F = !1, filterable: ce = !1, collapsible: I = !1, defaultCollapsed: le = !1, referenceField: L, parentId: R, icon: ue }) => {
|
|
696
|
+
let z = a !== void 0, de = a ?? [], [B, V] = u.useState(de), [fe, H] = u.useState(() => !!i && !z), [U, me] = u.useState(0), [G, he] = u.useState(null), [K, ge] = u.useState("asc"), [ve, ye] = u.useState(""), [be, xe] = u.useState(null), [Se, Ce] = u.useState(!1), [q, we] = u.useState(null), [Oe, ke] = u.useState(le), [Ae, je] = u.useState(!1), [Me, Ne] = u.useState(!1), [Pe, Fe] = u.useState(null), [Le, Re] = u.useState(0), [ze, Be] = u.useState({}), { t: J } = $(), { fieldLabel: Ve } = jt(), Y = oe && oe > 0 ? oe : 0, He = ce && ve !== "", X = !z && !!i && Y > 0 && !!p && typeof p.find == "function" && !He, Ue = X ? U : 0, We = X ? G : null, Ge = X ? K : "asc", Ke = JSON.stringify(se ?? null), qe = u.useMemo(() => In(se), [Ke]);
|
|
694
697
|
u.useEffect(() => {
|
|
695
|
-
|
|
696
|
-
}, [a,
|
|
698
|
+
z && V(a ?? []);
|
|
699
|
+
}, [a, z]), u.useEffect(() => {
|
|
697
700
|
i && p?.getObjectSchema && p.getObjectSchema(i).then(we).catch((e) => {
|
|
698
701
|
console.warn(`[RelatedList] Failed to fetch schema for ${i}:`, e);
|
|
699
702
|
});
|
|
700
703
|
}, [i, p]), u.useEffect(() => {
|
|
701
704
|
let e = !1;
|
|
702
|
-
if (i && !
|
|
703
|
-
if (!(
|
|
704
|
-
i && (
|
|
705
|
+
if (i && !z) {
|
|
706
|
+
if (!(L && R != null && R !== "")) {
|
|
707
|
+
i && (R == null || R === "") && !L && console.warn(`[RelatedList] "${i}" has no referenceField/parentId — refusing to fetch all rows. Pass relationshipField + parentId to scope the query.`), V([]), xe(null), Ce(!1), H(!1);
|
|
705
708
|
return;
|
|
706
709
|
}
|
|
707
|
-
|
|
708
|
-
let t = { [
|
|
710
|
+
H(!0);
|
|
711
|
+
let t = { [L]: R };
|
|
709
712
|
if (p && typeof p.find == "function") {
|
|
710
713
|
let n = { $filter: t };
|
|
711
714
|
if (X) {
|
|
@@ -719,24 +722,24 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
719
722
|
p.find(i, n).then((t) => {
|
|
720
723
|
if (e) return;
|
|
721
724
|
let n = Array.isArray(t), r = n ? t : Array.isArray(t?.data) ? t.data : [];
|
|
722
|
-
if (
|
|
725
|
+
if (V(r), X) {
|
|
723
726
|
let e = !n && typeof t?.total == "number" ? t.total : null;
|
|
724
727
|
xe(e), Ce(!n && typeof t?.hasMore == "boolean" ? t.hasMore : r.length === Y);
|
|
725
728
|
} else xe(null), Ce(!1);
|
|
726
|
-
|
|
729
|
+
H(!1);
|
|
727
730
|
}).catch((t) => {
|
|
728
|
-
console.error("Failed to fetch related data:", t), e ||
|
|
731
|
+
console.error("Failed to fetch related data:", t), e || H(!1);
|
|
729
732
|
});
|
|
730
733
|
} else {
|
|
731
|
-
let t = new URLSearchParams({ [`filter[${
|
|
734
|
+
let t = new URLSearchParams({ [`filter[${L}]`]: String(R) }).toString();
|
|
732
735
|
fetch(`${i}?${t}`).then((e) => e.json()).then((t) => {
|
|
733
736
|
if (e) return;
|
|
734
737
|
let n = Array.isArray(t) ? t : t?.data || [];
|
|
735
|
-
|
|
738
|
+
V(n), xe(null), Ce(!1);
|
|
736
739
|
}).catch((e) => {
|
|
737
740
|
console.error("Failed to fetch related data:", e);
|
|
738
741
|
}).finally(() => {
|
|
739
|
-
e ||
|
|
742
|
+
e || H(!1);
|
|
740
743
|
});
|
|
741
744
|
}
|
|
742
745
|
}
|
|
@@ -745,10 +748,10 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
745
748
|
};
|
|
746
749
|
}, [
|
|
747
750
|
i,
|
|
748
|
-
|
|
751
|
+
z,
|
|
749
752
|
p,
|
|
750
|
-
I,
|
|
751
753
|
L,
|
|
754
|
+
R,
|
|
752
755
|
Le,
|
|
753
756
|
X,
|
|
754
757
|
Y,
|
|
@@ -757,34 +760,34 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
757
760
|
Ge,
|
|
758
761
|
qe
|
|
759
762
|
]), u.useEffect(() => {
|
|
760
|
-
!X ||
|
|
763
|
+
!X || fe || U > 0 && B.length === 0 && me((e) => Math.max(0, e - 1));
|
|
761
764
|
}, [
|
|
762
765
|
X,
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
+
fe,
|
|
767
|
+
B,
|
|
768
|
+
U
|
|
766
769
|
]), u.useEffect(() => {
|
|
767
|
-
|
|
770
|
+
me(0);
|
|
768
771
|
}, [
|
|
769
772
|
i,
|
|
770
|
-
|
|
771
|
-
|
|
773
|
+
L,
|
|
774
|
+
R
|
|
772
775
|
]), u.useEffect(() => {
|
|
773
|
-
if (!i ||
|
|
776
|
+
if (!i || z) return;
|
|
774
777
|
let e = (e) => {
|
|
775
778
|
let t = e.detail || {};
|
|
776
779
|
t.objectName && t.objectName !== i || Re((e) => e + 1);
|
|
777
780
|
};
|
|
778
781
|
return window.addEventListener("objectui:related-changed", e), () => window.removeEventListener("objectui:related-changed", e);
|
|
779
|
-
}, [i,
|
|
780
|
-
if (!p?.find || !q?.fields || !
|
|
782
|
+
}, [i, z]), u.useEffect(() => {
|
|
783
|
+
if (!p?.find || !q?.fields || !B.length) return;
|
|
781
784
|
let e = q.fields, t = [];
|
|
782
785
|
for (let [n, r] of Object.entries(e)) {
|
|
783
786
|
if (!r || r.type !== "lookup" && r.type !== "master_detail") continue;
|
|
784
787
|
let e = r.reference_to || r.reference;
|
|
785
788
|
if (!e) continue;
|
|
786
789
|
let i = /* @__PURE__ */ new Set();
|
|
787
|
-
for (let e of
|
|
790
|
+
for (let e of B) {
|
|
788
791
|
let t = e?.[n];
|
|
789
792
|
t != null && (typeof t == "string" && t ? i.add(t) : typeof t == "number" && i.add(String(t)));
|
|
790
793
|
}
|
|
@@ -828,14 +831,14 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
828
831
|
}, [
|
|
829
832
|
p,
|
|
830
833
|
q,
|
|
831
|
-
|
|
834
|
+
B
|
|
832
835
|
]);
|
|
833
836
|
let Je = u.useMemo(() => {
|
|
834
|
-
if (X || !ve) return
|
|
837
|
+
if (X || !ve) return B;
|
|
835
838
|
let e = ve.toLowerCase();
|
|
836
|
-
return
|
|
839
|
+
return B.filter((t) => Object.values(t).some((t) => t != null && String(t).toLowerCase().includes(e)));
|
|
837
840
|
}, [
|
|
838
|
-
|
|
841
|
+
B,
|
|
839
842
|
ve,
|
|
840
843
|
X
|
|
841
844
|
]), Ye = u.useMemo(() => {
|
|
@@ -854,17 +857,17 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
854
857
|
K,
|
|
855
858
|
X,
|
|
856
859
|
ze
|
|
857
|
-
]), Xe = Y && !X ? Ye.slice(
|
|
860
|
+
]), Xe = Y && !X ? Ye.slice(U * Y, (U + 1) * Y) : Ye, Ze = Y ? X ? be == null ? U + (Se ? 2 : 1) : Math.max(1, Math.ceil(be / Y)) : Math.max(1, Math.ceil(Ye.length / Y)) : 1, Qe = X ? be == null ? Se : (U + 1) * Y < be : U < Ze - 1, $e = Y > 0 && (X ? U > 0 || Qe : Ye.length > Y);
|
|
858
861
|
u.useEffect(() => {
|
|
859
|
-
|
|
862
|
+
me(0);
|
|
860
863
|
}, [
|
|
861
864
|
ve,
|
|
862
865
|
G,
|
|
863
866
|
K
|
|
864
867
|
]);
|
|
865
868
|
let et = u.useCallback((e) => {
|
|
866
|
-
|
|
867
|
-
}, [G]),
|
|
869
|
+
me(0), G === e ? ge((e) => e === "asc" ? "desc" : "asc") : (he(e), ge("asc"));
|
|
870
|
+
}, [G]), tt = u.useMemo(() => G ? [{
|
|
868
871
|
field: G,
|
|
869
872
|
order: K
|
|
870
873
|
}] : qe, [
|
|
@@ -873,7 +876,7 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
873
876
|
qe
|
|
874
877
|
]), rt = u.useCallback((e) => {
|
|
875
878
|
let t = e[0];
|
|
876
|
-
t && (
|
|
879
|
+
t && (me(0), he(t.field), ge(t.order));
|
|
877
880
|
}, []), [it, at] = u.useState(null), ot = u.useCallback((e) => {
|
|
878
881
|
at(e);
|
|
879
882
|
}, []), st = u.useCallback(async () => {
|
|
@@ -884,40 +887,40 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
884
887
|
}
|
|
885
888
|
at(null);
|
|
886
889
|
}, [it, M]), ct = u.useCallback(async (e) => {
|
|
887
|
-
if (!
|
|
888
|
-
let t =
|
|
889
|
-
Ne(!0),
|
|
890
|
+
if (!P || !p || !i || L == null || R == null) return;
|
|
891
|
+
let t = P.picker.valueField || "id";
|
|
892
|
+
Ne(!0), Fe(null);
|
|
890
893
|
try {
|
|
891
894
|
for (let n of e || []) {
|
|
892
895
|
let e = n?.[t] ?? n?.id;
|
|
893
|
-
e != null && (
|
|
894
|
-
[
|
|
895
|
-
[
|
|
896
|
-
}) : await p.update?.(
|
|
896
|
+
e != null && (P.linkField ? await p.create?.(i, {
|
|
897
|
+
[L]: R,
|
|
898
|
+
[P.linkField]: e
|
|
899
|
+
}) : await p.update?.(P.picker.object, String(e), { [L]: R }));
|
|
897
900
|
}
|
|
898
901
|
Re((e) => e + 1);
|
|
899
902
|
} catch (e) {
|
|
900
903
|
let t = e?.body?.error ?? e?.error ?? e?.message ?? String(e);
|
|
901
|
-
|
|
904
|
+
Fe(typeof t == "string" ? t : "Failed to add");
|
|
902
905
|
} finally {
|
|
903
906
|
Ne(!1), je(!1);
|
|
904
907
|
}
|
|
905
908
|
}, [
|
|
906
|
-
|
|
909
|
+
P,
|
|
907
910
|
p,
|
|
908
911
|
i,
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
]), lt =
|
|
912
|
+
L,
|
|
913
|
+
R
|
|
914
|
+
]), lt = sn(), ut = u.useMemo(() => {
|
|
912
915
|
let e = S || i || "", t = (t) => !lt?.isLoaded || !e ? t : t.filter((t) => {
|
|
913
916
|
let r = t?.accessorKey || n(t);
|
|
914
917
|
return !r || lt.checkField(e, String(r), "read");
|
|
915
|
-
}), r = (e) =>
|
|
918
|
+
}), r = (e) => L ? e.filter((e) => (e?.accessorKey || n(e)) !== L) : e, a = (e) => e == null || typeof e == "string" && e.trim() === "" || Array.isArray(e) && e.length === 0, o = (e) => B.length ? e.filter((e) => {
|
|
916
919
|
let t = e?.accessorKey || n(e);
|
|
917
|
-
return !t ||
|
|
920
|
+
return !t || B.some((e) => !a(e?.[t]));
|
|
918
921
|
}) : e, s = (e, t) => {
|
|
919
922
|
if (!t?.type) return;
|
|
920
|
-
let n =
|
|
923
|
+
let n = Kt(Yt({
|
|
921
924
|
type: t.type,
|
|
922
925
|
format: t.format
|
|
923
926
|
}) || t.type);
|
|
@@ -966,7 +969,7 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
966
969
|
let l = Array.isArray(q.highlightFields) ? q.highlightFields.filter((e) => typeof e == "string" && e.length > 0) : [];
|
|
967
970
|
if (l.length > 0) {
|
|
968
971
|
let e = o(t(r(l.map(c))));
|
|
969
|
-
if (e.length > 0) return e.slice(0, Math.max(1,
|
|
972
|
+
if (e.length > 0) return e.slice(0, Math.max(1, ae));
|
|
970
973
|
}
|
|
971
974
|
let f = e, p = /* @__PURE__ */ new Set([
|
|
972
975
|
"rich_text",
|
|
@@ -981,7 +984,7 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
981
984
|
"label",
|
|
982
985
|
"code",
|
|
983
986
|
"number"
|
|
984
|
-
], h = Object.entries(q.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e ===
|
|
987
|
+
], h = Object.entries(q.fields).filter(([e, t]) => !(e.startsWith("_") || e === "id" || e === L || t?.hidden || t?.type && p.has(t.type) || lt?.isLoaded && f && !lt.checkField(f, e, "read"))), g = /* @__PURE__ */ new Set([
|
|
985
988
|
"created_at",
|
|
986
989
|
"updated_at",
|
|
987
990
|
"created_by",
|
|
@@ -1006,16 +1009,16 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1006
1009
|
r && (n.cell = r);
|
|
1007
1010
|
}
|
|
1008
1011
|
return n;
|
|
1009
|
-
})).slice(0, Math.max(1,
|
|
1012
|
+
})).slice(0, Math.max(1, ae));
|
|
1010
1013
|
}, [
|
|
1011
1014
|
d,
|
|
1012
1015
|
q,
|
|
1013
1016
|
S,
|
|
1014
1017
|
i,
|
|
1015
1018
|
Ve,
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
+
L,
|
|
1020
|
+
B,
|
|
1021
|
+
ae,
|
|
1019
1022
|
ze,
|
|
1020
1023
|
lt
|
|
1021
1024
|
]), dt = u.useMemo(() => X ? ut.map((e) => {
|
|
@@ -1028,7 +1031,7 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1028
1031
|
ut,
|
|
1029
1032
|
X,
|
|
1030
1033
|
q
|
|
1031
|
-
]), ft = !c && (t === "grid" || t === "table"), pt = Array.isArray(
|
|
1034
|
+
]), ft = !c && (t === "grid" || t === "table"), pt = Array.isArray(ee) && ee.length > 0, mt = !!T || !!M || pt, ht = pe(), gt = u.useMemo(() => {
|
|
1032
1035
|
if (c) return c;
|
|
1033
1036
|
if (ht && (t === "grid" || t === "table")) {
|
|
1034
1037
|
let e = ut[0]?.accessorKey || n(ut[0]), t = ut.slice(1, 4).map((e) => e.accessorKey || n(e)).filter(Boolean);
|
|
@@ -1041,7 +1044,7 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1041
1044
|
visibleFields: t,
|
|
1042
1045
|
cardSize: "medium"
|
|
1043
1046
|
},
|
|
1044
|
-
onRowClick:
|
|
1047
|
+
onRowClick: N
|
|
1045
1048
|
};
|
|
1046
1049
|
}
|
|
1047
1050
|
let e = l(q?.userActions?.edit), r = l(q?.userActions?.delete);
|
|
@@ -1056,16 +1059,16 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1056
1059
|
searchable: !1,
|
|
1057
1060
|
exportable: !1,
|
|
1058
1061
|
manualSorting: !0,
|
|
1059
|
-
sort:
|
|
1062
|
+
sort: tt,
|
|
1060
1063
|
onSortChange: rt,
|
|
1061
1064
|
rowActions: mt,
|
|
1062
1065
|
onRowEdit: T,
|
|
1063
1066
|
onRowDelete: M ? ot : void 0,
|
|
1064
1067
|
rowEditPredicates: e,
|
|
1065
1068
|
rowDeletePredicates: r,
|
|
1066
|
-
onRowClick:
|
|
1067
|
-
rowActionDefs: pt ?
|
|
1068
|
-
onRowActionDef: pt ?
|
|
1069
|
+
onRowClick: N,
|
|
1070
|
+
rowActionDefs: pt ? ee : void 0,
|
|
1071
|
+
onRowActionDef: pt ? te : void 0
|
|
1069
1072
|
};
|
|
1070
1073
|
case "list": return {
|
|
1071
1074
|
type: "data-list",
|
|
@@ -1085,41 +1088,41 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1085
1088
|
Y,
|
|
1086
1089
|
mt,
|
|
1087
1090
|
pt,
|
|
1091
|
+
ee,
|
|
1088
1092
|
te,
|
|
1089
|
-
ne,
|
|
1090
1093
|
T,
|
|
1091
1094
|
M,
|
|
1092
1095
|
ot,
|
|
1093
|
-
|
|
1096
|
+
N,
|
|
1094
1097
|
ht,
|
|
1095
1098
|
i,
|
|
1096
1099
|
q,
|
|
1097
|
-
|
|
1100
|
+
tt,
|
|
1098
1101
|
rt
|
|
1099
|
-
]),
|
|
1102
|
+
]), _t = I ? "cursor-pointer select-none" : void 0, yt = I ? () => ke((e) => !e) : void 0, bt = Fn(ue), xt = X && be != null ? be : B.length, St = !fe && B.length === 0 && (!X || U === 0), Ct = ce;
|
|
1100
1103
|
return /* @__PURE__ */ Q(O, {
|
|
1101
|
-
className:
|
|
1104
|
+
className: W("shadow-none border-border/60 bg-transparent", St && "bg-muted/10", f),
|
|
1102
1105
|
children: [
|
|
1103
1106
|
/* @__PURE__ */ Z(A, {
|
|
1104
|
-
className:
|
|
1107
|
+
className: W("py-3 px-4 sm:py-3 min-h-12 sm:min-h-0", _t),
|
|
1105
1108
|
onClick: yt,
|
|
1106
1109
|
children: /* @__PURE__ */ Q(j, {
|
|
1107
1110
|
className: "flex items-center justify-between gap-2 text-sm font-semibold",
|
|
1108
1111
|
children: [/* @__PURE__ */ Q("div", {
|
|
1109
1112
|
className: "flex items-center gap-2 min-w-0",
|
|
1110
1113
|
children: [
|
|
1111
|
-
|
|
1114
|
+
I && Z(Oe ? De : Te, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
|
|
1112
1115
|
/* @__PURE__ */ Z(bt, {
|
|
1113
1116
|
className: "h-4 w-4 text-muted-foreground shrink-0",
|
|
1114
1117
|
"aria-hidden": !0
|
|
1115
1118
|
}),
|
|
1116
1119
|
/* @__PURE__ */ Z("span", {
|
|
1117
|
-
className:
|
|
1120
|
+
className: W("truncate", St && "text-muted-foreground font-medium"),
|
|
1118
1121
|
children: e
|
|
1119
1122
|
}),
|
|
1120
1123
|
/* @__PURE__ */ Z(E, {
|
|
1121
1124
|
variant: "secondary",
|
|
1122
|
-
className:
|
|
1125
|
+
className: W("text-xs font-normal h-5 px-1.5", xt === 0 && "bg-muted text-muted-foreground"),
|
|
1123
1126
|
"aria-label": `${xt} records`,
|
|
1124
1127
|
children: xt
|
|
1125
1128
|
}),
|
|
@@ -1131,19 +1134,19 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1131
1134
|
}), /* @__PURE__ */ Q("div", {
|
|
1132
1135
|
className: "flex items-center gap-1 shrink-0",
|
|
1133
1136
|
children: [
|
|
1134
|
-
|
|
1137
|
+
ie && (re ?? []).map((e) => /* @__PURE__ */ Z(Ln, {
|
|
1135
1138
|
action: e,
|
|
1136
|
-
onToolbarAction:
|
|
1139
|
+
onToolbarAction: ie
|
|
1137
1140
|
}, e.name)),
|
|
1138
|
-
|
|
1141
|
+
P && /* @__PURE__ */ Q(D, {
|
|
1139
1142
|
variant: St ? "ghost" : "outline",
|
|
1140
1143
|
size: "sm",
|
|
1141
1144
|
disabled: Me,
|
|
1142
1145
|
onClick: (e) => {
|
|
1143
|
-
e.stopPropagation(),
|
|
1146
|
+
e.stopPropagation(), Fe(null), je(!0);
|
|
1144
1147
|
},
|
|
1145
1148
|
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
1146
|
-
children: [/* @__PURE__ */ Z(
|
|
1149
|
+
children: [/* @__PURE__ */ Z(nt, { className: "h-3.5 w-3.5" }), P.label || J("detail.add", { defaultValue: "Add" })]
|
|
1147
1150
|
}),
|
|
1148
1151
|
C && /* @__PURE__ */ Q(D, {
|
|
1149
1152
|
variant: St ? "ghost" : "outline",
|
|
@@ -1152,25 +1155,25 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1152
1155
|
e.stopPropagation(), C();
|
|
1153
1156
|
},
|
|
1154
1157
|
className: "gap-1 h-9 sm:h-7 text-xs shadow-none",
|
|
1155
|
-
children: [/* @__PURE__ */ Z(
|
|
1158
|
+
children: [/* @__PURE__ */ Z(nt, { className: "h-3.5 w-3.5" }), J("detail.new")]
|
|
1156
1159
|
})
|
|
1157
1160
|
]
|
|
1158
1161
|
})]
|
|
1159
1162
|
})
|
|
1160
1163
|
}),
|
|
1161
1164
|
!Oe && !St && /* @__PURE__ */ Q(k, {
|
|
1162
|
-
className:
|
|
1165
|
+
className: W("pt-0 pb-4 px-4"),
|
|
1163
1166
|
children: [
|
|
1164
1167
|
Ct && /* @__PURE__ */ Z("div", {
|
|
1165
1168
|
className: "mb-3",
|
|
1166
|
-
children: /* @__PURE__ */ Z(
|
|
1169
|
+
children: /* @__PURE__ */ Z(ne, {
|
|
1167
1170
|
placeholder: J("detail.filterPlaceholder"),
|
|
1168
1171
|
value: ve,
|
|
1169
1172
|
onChange: (e) => ye(e.target.value),
|
|
1170
1173
|
className: "h-8 text-sm"
|
|
1171
1174
|
})
|
|
1172
1175
|
}),
|
|
1173
|
-
|
|
1176
|
+
F && !ft && ut && ut.length > 0 && B.length > 0 && /* @__PURE__ */ Z("div", {
|
|
1174
1177
|
className: "flex flex-wrap gap-1 mb-3",
|
|
1175
1178
|
children: ut.map((e) => {
|
|
1176
1179
|
let t = e.accessorKey || n(e);
|
|
@@ -1189,12 +1192,12 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1189
1192
|
}, t);
|
|
1190
1193
|
})
|
|
1191
1194
|
}),
|
|
1192
|
-
|
|
1195
|
+
fe && B.length === 0 ? /* @__PURE__ */ Z("div", {
|
|
1193
1196
|
className: "flex items-center justify-center py-6 text-muted-foreground text-sm",
|
|
1194
1197
|
children: J("detail.loading")
|
|
1195
1198
|
}) : /* @__PURE__ */ Z("div", {
|
|
1196
|
-
className:
|
|
1197
|
-
children: /* @__PURE__ */ Z(
|
|
1199
|
+
className: W(fe && "opacity-60 pointer-events-none transition-opacity"),
|
|
1200
|
+
children: /* @__PURE__ */ Z(vt, { schema: gt })
|
|
1198
1201
|
}),
|
|
1199
1202
|
$e && /* @__PURE__ */ Q("div", {
|
|
1200
1203
|
className: "flex items-center justify-between mt-3 pt-3 border-t",
|
|
@@ -1203,14 +1206,14 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1203
1206
|
variant: "outline",
|
|
1204
1207
|
size: "sm",
|
|
1205
1208
|
className: "h-7 text-xs gap-1",
|
|
1206
|
-
disabled:
|
|
1207
|
-
onClick: () =>
|
|
1209
|
+
disabled: U === 0,
|
|
1210
|
+
onClick: () => me((e) => Math.max(0, e - 1)),
|
|
1208
1211
|
children: [/* @__PURE__ */ Z(Ee, { className: "h-3 w-3" }), J("detail.previousPage")]
|
|
1209
1212
|
}),
|
|
1210
1213
|
/* @__PURE__ */ Z("span", {
|
|
1211
1214
|
className: "text-xs text-muted-foreground",
|
|
1212
1215
|
children: J("detail.pageOf", {
|
|
1213
|
-
current:
|
|
1216
|
+
current: U + 1,
|
|
1214
1217
|
total: Ze
|
|
1215
1218
|
})
|
|
1216
1219
|
}),
|
|
@@ -1219,7 +1222,7 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1219
1222
|
size: "sm",
|
|
1220
1223
|
className: "h-7 text-xs gap-1",
|
|
1221
1224
|
disabled: !Qe,
|
|
1222
|
-
onClick: () =>
|
|
1225
|
+
onClick: () => me((e) => Qe ? e + 1 : e),
|
|
1223
1226
|
children: [J("detail.nextPage"), /* @__PURE__ */ Z(De, { className: "h-3 w-3" })]
|
|
1224
1227
|
})
|
|
1225
1228
|
]
|
|
@@ -1232,7 +1235,7 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1232
1235
|
e.stopPropagation(), w();
|
|
1233
1236
|
},
|
|
1234
1237
|
className: "text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 transition-colors",
|
|
1235
|
-
children: [J("detail.viewAll"), /* @__PURE__ */ Z(
|
|
1238
|
+
children: [J("detail.viewAll"), /* @__PURE__ */ Z(Ie, { className: "h-3 w-3" })]
|
|
1236
1239
|
})
|
|
1237
1240
|
})
|
|
1238
1241
|
]
|
|
@@ -1253,13 +1256,13 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1253
1256
|
role: "alert",
|
|
1254
1257
|
children: Pe
|
|
1255
1258
|
}),
|
|
1256
|
-
|
|
1259
|
+
P && p && /* @__PURE__ */ Z(Vt, {
|
|
1257
1260
|
open: Ae,
|
|
1258
1261
|
onOpenChange: (e) => je(e),
|
|
1259
1262
|
multiple: !0,
|
|
1260
1263
|
dataSource: p,
|
|
1261
|
-
objectName:
|
|
1262
|
-
title:
|
|
1264
|
+
objectName: P.picker.object,
|
|
1265
|
+
title: P.label || J("detail.add", { defaultValue: "Add" }),
|
|
1263
1266
|
onSelect: () => {},
|
|
1264
1267
|
onSelectRecords: (e) => {
|
|
1265
1268
|
ct(e);
|
|
@@ -1267,10 +1270,10 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1267
1270
|
})
|
|
1268
1271
|
]
|
|
1269
1272
|
});
|
|
1270
|
-
},
|
|
1273
|
+
}, zn = ({ group: e, data: t, className: n, objectSchema: r, objectName: i, isEditing: a = !1, onFieldChange: o, onEnterInlineEdit: s, autoFocusField: c, dataSource: l }) => {
|
|
1271
1274
|
let d = e.collapsible ?? !0, [f, p] = u.useState(e.defaultCollapsed ?? !1), m = /* @__PURE__ */ Z("div", {
|
|
1272
1275
|
className: "space-y-3 sm:space-y-4",
|
|
1273
|
-
children: e.sections.map((e, n) => /* @__PURE__ */ Z(
|
|
1276
|
+
children: e.sections.map((e, n) => /* @__PURE__ */ Z(Nn, {
|
|
1274
1277
|
section: e,
|
|
1275
1278
|
data: t,
|
|
1276
1279
|
objectSchema: r,
|
|
@@ -1287,7 +1290,7 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1287
1290
|
onOpenChange: (e) => p(!e),
|
|
1288
1291
|
className: n,
|
|
1289
1292
|
children: [
|
|
1290
|
-
/* @__PURE__ */ Z(
|
|
1293
|
+
/* @__PURE__ */ Z(ee, {
|
|
1291
1294
|
asChild: !0,
|
|
1292
1295
|
children: /* @__PURE__ */ Q("div", {
|
|
1293
1296
|
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",
|
|
@@ -1308,13 +1311,13 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1308
1311
|
className: "text-sm text-muted-foreground mt-1",
|
|
1309
1312
|
children: e.description
|
|
1310
1313
|
}),
|
|
1311
|
-
/* @__PURE__ */ Z(
|
|
1314
|
+
/* @__PURE__ */ Z(N, { children: /* @__PURE__ */ Z("div", {
|
|
1312
1315
|
className: "mt-3",
|
|
1313
1316
|
children: m
|
|
1314
1317
|
}) })
|
|
1315
1318
|
]
|
|
1316
1319
|
}) : /* @__PURE__ */ Q("div", {
|
|
1317
|
-
className:
|
|
1320
|
+
className: W("space-y-3", n),
|
|
1318
1321
|
children: [
|
|
1319
1322
|
/* @__PURE__ */ Q("div", {
|
|
1320
1323
|
className: "flex items-center gap-2 pb-2 border-b",
|
|
@@ -1333,37 +1336,37 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1333
1336
|
m
|
|
1334
1337
|
]
|
|
1335
1338
|
});
|
|
1336
|
-
},
|
|
1337
|
-
let { fieldLabel: o } =
|
|
1339
|
+
}, Bn = ({ fields: e, data: t, className: n, objectName: r, objectSchema: i, dataSource: a }) => {
|
|
1340
|
+
let { fieldLabel: o } = jt(), { t: s } = $(), c = Et(), l = c?.editing ?? !1, u = c?.canEdit ?? !1;
|
|
1338
1341
|
if (!e.length || !t) return null;
|
|
1339
1342
|
let d = l ? e : e.filter((e) => {
|
|
1340
1343
|
let n = t?.[e.name];
|
|
1341
1344
|
return n != null && n !== "";
|
|
1342
1345
|
});
|
|
1343
|
-
return d.length === 0 ? null : /* @__PURE__ */ Z(
|
|
1344
|
-
className:
|
|
1346
|
+
return d.length === 0 ? null : /* @__PURE__ */ Z(fe, { children: /* @__PURE__ */ Z("section", {
|
|
1347
|
+
className: W("@container border-b border-border/60 pb-4", n),
|
|
1345
1348
|
"aria-label": "Record highlights",
|
|
1346
1349
|
children: /* @__PURE__ */ Z("div", {
|
|
1347
|
-
className:
|
|
1350
|
+
className: W("flex flex-wrap gap-y-4"),
|
|
1348
1351
|
children: d.map((e) => {
|
|
1349
|
-
let n = t[e.name], d = i?.fields?.[e.name], f = e.type || d?.type, p =
|
|
1352
|
+
let n = t[e.name], d = i?.fields?.[e.name], f = e.type || d?.type, p = An({
|
|
1350
1353
|
name: e.name,
|
|
1351
1354
|
label: e.label,
|
|
1352
1355
|
type: f || "text"
|
|
1353
|
-
}, d), m = c?.draft?.[e.name], h = m === void 0 ? n : m, g =
|
|
1356
|
+
}, d), m = c?.draft?.[e.name], h = m === void 0 ? n : m, g = En.has(f), _ = e.readonly === !0 || d?.readonly === !0, v = Tn.has(e.name), y = u && !g && !_ && !v, b = l && y, x = Kt(Yt(p) || f || "text"), S = f === "number" || f === "integer" || f === "currency" || f === "percent" || f === "decimal", C = f === "email" || f === "url" || f === "textarea" || f === "reference" || f === "lookup" || f === "master_detail", w = f === "boolean", T = h == null || h === "";
|
|
1354
1357
|
return /* @__PURE__ */ Q("div", {
|
|
1355
|
-
className:
|
|
1358
|
+
className: W("group flex flex-col gap-1 min-w-[7rem] px-5 border-l border-border/60 first:border-l-0 first:pl-0", C || b ? "basis-[16rem] max-w-[24rem]" : "basis-[9rem] max-w-[16rem]"),
|
|
1356
1359
|
children: [/* @__PURE__ */ Z("span", {
|
|
1357
1360
|
className: "text-xs font-medium text-muted-foreground",
|
|
1358
1361
|
children: o(r || "", e.name, e.label)
|
|
1359
|
-
}), b ? /* @__PURE__ */ Z(
|
|
1362
|
+
}), b ? /* @__PURE__ */ Z(On, {
|
|
1360
1363
|
field: p,
|
|
1361
1364
|
value: h,
|
|
1362
1365
|
onChange: (t) => c.setField(e.name, t),
|
|
1363
1366
|
dataSource: a,
|
|
1364
1367
|
autoFocus: c.autoFocusField === e.name
|
|
1365
1368
|
}) : /* @__PURE__ */ Q("div", {
|
|
1366
|
-
className:
|
|
1369
|
+
className: W("flex items-start justify-between gap-1", y && "cursor-pointer rounded-md -mx-1.5 px-1.5 hover:bg-muted/40 transition-colors"),
|
|
1367
1370
|
onDoubleClick: y ? () => c.enter(e.name) : void 0,
|
|
1368
1371
|
title: y ? s("detail.editInlineHint") : void 0,
|
|
1369
1372
|
children: [/* @__PURE__ */ Z("div", {
|
|
@@ -1376,7 +1379,7 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1376
1379
|
}), "Yes"]
|
|
1377
1380
|
}) : /* @__PURE__ */ Q("span", {
|
|
1378
1381
|
className: "inline-flex items-center gap-1 self-start rounded-full bg-amber-500/10 px-2 py-0.5 text-xs font-medium text-amber-700 ring-1 ring-inset ring-amber-500/30 dark:text-amber-400",
|
|
1379
|
-
children: [/* @__PURE__ */ Z(
|
|
1382
|
+
children: [/* @__PURE__ */ Z(mt, {
|
|
1380
1383
|
className: "h-3 w-3",
|
|
1381
1384
|
"aria-hidden": !0
|
|
1382
1385
|
}), "No"]
|
|
@@ -1386,13 +1389,13 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1386
1389
|
children: "—"
|
|
1387
1390
|
}) : /* @__PURE__ */ Z("span", {
|
|
1388
1391
|
title: (Array.isArray(p.options) ? p.options.find((e) => e?.value === h)?.label : void 0) ?? (typeof h == "string" || typeof h == "number" ? String(h) : void 0),
|
|
1389
|
-
className:
|
|
1392
|
+
className: W("block min-w-0 truncate text-sm font-semibold", S && "tabular-nums tracking-tight"),
|
|
1390
1393
|
children: /* @__PURE__ */ Z(x, {
|
|
1391
1394
|
value: h,
|
|
1392
1395
|
field: p
|
|
1393
1396
|
})
|
|
1394
1397
|
})
|
|
1395
|
-
}), y && /* @__PURE__ */ Q(
|
|
1398
|
+
}), y && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
1396
1399
|
asChild: !0,
|
|
1397
1400
|
children: /* @__PURE__ */ Z(D, {
|
|
1398
1401
|
variant: "ghost",
|
|
@@ -1402,9 +1405,9 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1402
1405
|
onClick: (t) => {
|
|
1403
1406
|
t.stopPropagation(), c.enter(e.name);
|
|
1404
1407
|
},
|
|
1405
|
-
children: /* @__PURE__ */ Z(
|
|
1408
|
+
children: /* @__PURE__ */ Z($e, { className: "h-3 w-3" })
|
|
1406
1409
|
})
|
|
1407
|
-
}), /* @__PURE__ */ Z(
|
|
1410
|
+
}), /* @__PURE__ */ Z(V, { children: s("detail.editInlineHint") })] })]
|
|
1408
1411
|
})]
|
|
1409
1412
|
}, e.name);
|
|
1410
1413
|
})
|
|
@@ -1413,7 +1416,7 @@ var Nn = ({ action: e, onToolbarAction: t }) => {
|
|
|
1413
1416
|
};
|
|
1414
1417
|
//#endregion
|
|
1415
1418
|
//#region src/RecordComments.tsx
|
|
1416
|
-
function
|
|
1419
|
+
function Vn(e) {
|
|
1417
1420
|
try {
|
|
1418
1421
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1419
1422
|
if (r < 1) return "just now";
|
|
@@ -1426,7 +1429,7 @@ function Ln(e) {
|
|
|
1426
1429
|
return e;
|
|
1427
1430
|
}
|
|
1428
1431
|
}
|
|
1429
|
-
var
|
|
1432
|
+
var Hn = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, className: i }) => {
|
|
1430
1433
|
let { t: a } = $(), [o, s] = u.useState(""), [c, l] = u.useState(!1), [d, f] = u.useState(""), p = u.useCallback(async () => {
|
|
1431
1434
|
let e = o.trim();
|
|
1432
1435
|
if (!(!e || !t)) {
|
|
@@ -1444,11 +1447,11 @@ var Rn = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1444
1447
|
return e.text.toLowerCase().includes(t) || e.author.toLowerCase().includes(t);
|
|
1445
1448
|
}) : e].sort((e, t) => e.pinned && !t.pinned ? -1 : !e.pinned && t.pinned ? 1 : 0), [e, d]);
|
|
1446
1449
|
return /* @__PURE__ */ Q(O, {
|
|
1447
|
-
className:
|
|
1450
|
+
className: W("", i),
|
|
1448
1451
|
children: [/* @__PURE__ */ Z(A, { children: /* @__PURE__ */ Q(j, {
|
|
1449
1452
|
className: "flex items-center gap-2 text-base",
|
|
1450
1453
|
children: [
|
|
1451
|
-
/* @__PURE__ */ Z(
|
|
1454
|
+
/* @__PURE__ */ Z(Je, { className: "h-4 w-4" }),
|
|
1452
1455
|
a("detail.comments"),
|
|
1453
1456
|
/* @__PURE__ */ Q("span", {
|
|
1454
1457
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1467,7 +1470,7 @@ var Rn = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1467
1470
|
children: /* @__PURE__ */ Q("div", {
|
|
1468
1471
|
className: "relative flex-1",
|
|
1469
1472
|
children: [
|
|
1470
|
-
/* @__PURE__ */ Z(
|
|
1473
|
+
/* @__PURE__ */ Z(ot, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }),
|
|
1471
1474
|
/* @__PURE__ */ Z("input", {
|
|
1472
1475
|
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",
|
|
1473
1476
|
placeholder: a("detail.searchComments"),
|
|
@@ -1480,7 +1483,7 @@ var Rn = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1480
1483
|
onClick: () => f(""),
|
|
1481
1484
|
"aria-label": a("detail.clearSearch"),
|
|
1482
1485
|
type: "button",
|
|
1483
|
-
children: /* @__PURE__ */ Z(
|
|
1486
|
+
children: /* @__PURE__ */ Z(mt, { className: "h-3.5 w-3.5" })
|
|
1484
1487
|
})
|
|
1485
1488
|
]
|
|
1486
1489
|
})
|
|
@@ -1500,7 +1503,7 @@ var Rn = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1500
1503
|
onClick: p,
|
|
1501
1504
|
disabled: !o.trim() || c,
|
|
1502
1505
|
className: "shrink-0 self-end",
|
|
1503
|
-
children: /* @__PURE__ */ Z(
|
|
1506
|
+
children: /* @__PURE__ */ Z(st, { className: "h-4 w-4" })
|
|
1504
1507
|
})]
|
|
1505
1508
|
}),
|
|
1506
1509
|
h.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
@@ -1509,7 +1512,7 @@ var Rn = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1509
1512
|
}) : /* @__PURE__ */ Z("div", {
|
|
1510
1513
|
className: "space-y-3",
|
|
1511
1514
|
children: h.map((e) => /* @__PURE__ */ Q("div", {
|
|
1512
|
-
className:
|
|
1515
|
+
className: W("flex gap-3", e.pinned && "bg-muted/40 rounded-md p-2 -mx-2"),
|
|
1513
1516
|
children: [/* @__PURE__ */ Z("div", {
|
|
1514
1517
|
className: "shrink-0",
|
|
1515
1518
|
children: e.avatarUrl ? /* @__PURE__ */ Z("img", {
|
|
@@ -1532,11 +1535,11 @@ var Rn = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1532
1535
|
}),
|
|
1533
1536
|
/* @__PURE__ */ Z("span", {
|
|
1534
1537
|
className: "text-xs text-muted-foreground",
|
|
1535
|
-
children:
|
|
1538
|
+
children: Vn(e.createdAt)
|
|
1536
1539
|
}),
|
|
1537
1540
|
e.pinned && /* @__PURE__ */ Q("span", {
|
|
1538
1541
|
className: "text-xs text-amber-600 flex items-center gap-0.5",
|
|
1539
|
-
children: [/* @__PURE__ */ Z(
|
|
1542
|
+
children: [/* @__PURE__ */ Z(tt, { className: "h-3 w-3" }), a("detail.pinned")]
|
|
1540
1543
|
})
|
|
1541
1544
|
]
|
|
1542
1545
|
}),
|
|
@@ -1549,7 +1552,7 @@ var Rn = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1549
1552
|
className: "mt-1 text-xs text-muted-foreground hover:text-foreground flex items-center gap-1",
|
|
1550
1553
|
onClick: () => n(e.id),
|
|
1551
1554
|
"aria-label": e.pinned ? a("detail.unpin") : a("detail.pin"),
|
|
1552
|
-
children: [/* @__PURE__ */ Z(
|
|
1555
|
+
children: [/* @__PURE__ */ Z(tt, { className: "h-3 w-3" }), e.pinned ? a("detail.unpin") : a("detail.pin")]
|
|
1553
1556
|
})
|
|
1554
1557
|
]
|
|
1555
1558
|
})]
|
|
@@ -1558,20 +1561,20 @@ var Rn = ({ comments: e, onAddComment: t, onTogglePin: n, searchable: r = !1, cl
|
|
|
1558
1561
|
]
|
|
1559
1562
|
})]
|
|
1560
1563
|
});
|
|
1561
|
-
},
|
|
1562
|
-
field_change:
|
|
1563
|
-
create:
|
|
1564
|
-
delete:
|
|
1565
|
-
comment:
|
|
1564
|
+
}, Un = {
|
|
1565
|
+
field_change: Fe,
|
|
1566
|
+
create: rt,
|
|
1567
|
+
delete: ft,
|
|
1568
|
+
comment: Je,
|
|
1566
1569
|
status_change: ge
|
|
1567
|
-
},
|
|
1570
|
+
}, Wn = {
|
|
1568
1571
|
field_change: "bg-blue-100 text-blue-600",
|
|
1569
1572
|
create: "bg-green-100 text-green-600",
|
|
1570
1573
|
delete: "bg-red-100 text-red-600",
|
|
1571
1574
|
comment: "bg-purple-100 text-purple-600",
|
|
1572
1575
|
status_change: "bg-amber-100 text-amber-600"
|
|
1573
1576
|
};
|
|
1574
|
-
function
|
|
1577
|
+
function Gn(e) {
|
|
1575
1578
|
try {
|
|
1576
1579
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
1577
1580
|
if (r < 1) return "just now";
|
|
@@ -1584,24 +1587,24 @@ function Vn(e) {
|
|
|
1584
1587
|
return e;
|
|
1585
1588
|
}
|
|
1586
1589
|
}
|
|
1587
|
-
function
|
|
1590
|
+
function Kn(e) {
|
|
1588
1591
|
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";
|
|
1589
1592
|
}
|
|
1590
|
-
var
|
|
1593
|
+
var qn = {
|
|
1591
1594
|
all: "All",
|
|
1592
1595
|
field_change: "Field Changes",
|
|
1593
1596
|
create: "Creates",
|
|
1594
1597
|
delete: "Deletes",
|
|
1595
1598
|
comment: "Comments",
|
|
1596
1599
|
status_change: "Status Changes"
|
|
1597
|
-
},
|
|
1600
|
+
}, Jn = ({ activities: e, filterable: t = !1, defaultFilter: n = "all", className: r }) => {
|
|
1598
1601
|
let [i, a] = u.useState(n), o = u.useMemo(() => i === "all" ? e : e.filter((e) => e.type === i), [e, i]);
|
|
1599
1602
|
return /* @__PURE__ */ Q(O, {
|
|
1600
|
-
className:
|
|
1603
|
+
className: W("", r),
|
|
1601
1604
|
children: [/* @__PURE__ */ Z(A, { children: /* @__PURE__ */ Q(j, {
|
|
1602
1605
|
className: "flex items-center gap-2 text-base",
|
|
1603
1606
|
children: [
|
|
1604
|
-
/* @__PURE__ */ Z(
|
|
1607
|
+
/* @__PURE__ */ Z(me, { className: "h-4 w-4" }),
|
|
1605
1608
|
"Activity",
|
|
1606
1609
|
/* @__PURE__ */ Q("span", {
|
|
1607
1610
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -1616,14 +1619,14 @@ var Un = {
|
|
|
1616
1619
|
className: "flex flex-wrap gap-1.5 mb-4",
|
|
1617
1620
|
role: "group",
|
|
1618
1621
|
"aria-label": "Activity type filter",
|
|
1619
|
-
children: Object.keys(
|
|
1622
|
+
children: Object.keys(qn).map((e) => /* @__PURE__ */ Q("button", {
|
|
1620
1623
|
type: "button",
|
|
1621
|
-
className:
|
|
1624
|
+
className: W("inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors", i === e ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-muted/80"),
|
|
1622
1625
|
onClick: () => a(e),
|
|
1623
1626
|
"aria-pressed": i === e,
|
|
1624
|
-
children: [e !== "all" && u.createElement(
|
|
1627
|
+
children: [e !== "all" && u.createElement(Un[e] || Fe, { className: "h-3 w-3" }), qn[e]]
|
|
1625
1628
|
}, e))
|
|
1626
|
-
}), o.length === 0 ? /* @__PURE__ */ Z(
|
|
1629
|
+
}), o.length === 0 ? /* @__PURE__ */ Z(te, {
|
|
1627
1630
|
title: "No activity recorded",
|
|
1628
1631
|
className: "py-6"
|
|
1629
1632
|
}) : /* @__PURE__ */ Q("div", {
|
|
@@ -1631,11 +1634,11 @@ var Un = {
|
|
|
1631
1634
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
1632
1635
|
className: "space-y-4",
|
|
1633
1636
|
children: o.map((e) => {
|
|
1634
|
-
let t =
|
|
1637
|
+
let t = Un[e.type] || Fe;
|
|
1635
1638
|
return /* @__PURE__ */ Q("div", {
|
|
1636
1639
|
className: "flex gap-3 relative",
|
|
1637
1640
|
children: [/* @__PURE__ */ Z("div", {
|
|
1638
|
-
className:
|
|
1641
|
+
className: W("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", Wn[e.type] || "bg-gray-100 text-gray-600"),
|
|
1639
1642
|
children: /* @__PURE__ */ Z(t, { className: "h-3.5 w-3.5" })
|
|
1640
1643
|
}), /* @__PURE__ */ Q("div", {
|
|
1641
1644
|
className: "flex-1 min-w-0 pt-1",
|
|
@@ -1649,12 +1652,12 @@ var Un = {
|
|
|
1649
1652
|
" ",
|
|
1650
1653
|
/* @__PURE__ */ Z("span", {
|
|
1651
1654
|
className: "text-muted-foreground",
|
|
1652
|
-
children:
|
|
1655
|
+
children: Kn(e)
|
|
1653
1656
|
})
|
|
1654
1657
|
]
|
|
1655
1658
|
}), /* @__PURE__ */ Z("p", {
|
|
1656
1659
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
1657
|
-
children:
|
|
1660
|
+
children: Gn(e.timestamp)
|
|
1658
1661
|
})]
|
|
1659
1662
|
})]
|
|
1660
1663
|
}, e.id);
|
|
@@ -1662,7 +1665,7 @@ var Un = {
|
|
|
1662
1665
|
})]
|
|
1663
1666
|
})] })]
|
|
1664
1667
|
});
|
|
1665
|
-
},
|
|
1668
|
+
}, Yn = {
|
|
1666
1669
|
create: "default",
|
|
1667
1670
|
update: "secondary",
|
|
1668
1671
|
delete: "destructive",
|
|
@@ -1674,12 +1677,12 @@ var Un = {
|
|
|
1674
1677
|
export: "outline",
|
|
1675
1678
|
import: "outline"
|
|
1676
1679
|
};
|
|
1677
|
-
function
|
|
1680
|
+
function Xn(e) {
|
|
1678
1681
|
if (!e) return "";
|
|
1679
1682
|
let t = e instanceof Date ? e : new Date(e);
|
|
1680
1683
|
return Number.isNaN(t.getTime()) ? String(e) : t.toLocaleString();
|
|
1681
1684
|
}
|
|
1682
|
-
var
|
|
1685
|
+
var Zn = [
|
|
1683
1686
|
[60, "second"],
|
|
1684
1687
|
[60, "minute"],
|
|
1685
1688
|
[24, "hour"],
|
|
@@ -1688,27 +1691,27 @@ var qn = [
|
|
|
1688
1691
|
[12, "month"],
|
|
1689
1692
|
[Infinity, "year"]
|
|
1690
1693
|
];
|
|
1691
|
-
function
|
|
1694
|
+
function Qn(e, t) {
|
|
1692
1695
|
if (!e) return "";
|
|
1693
1696
|
let n = e instanceof Date ? e : new Date(e);
|
|
1694
1697
|
if (Number.isNaN(n.getTime())) return String(e);
|
|
1695
1698
|
let r = (n.getTime() - Date.now()) / 1e3;
|
|
1696
|
-
for (let [n, i] of
|
|
1699
|
+
for (let [n, i] of Zn) {
|
|
1697
1700
|
if (Math.abs(r) < n) try {
|
|
1698
1701
|
return new Intl.RelativeTimeFormat(t, { numeric: "auto" }).format(Math.round(r), i);
|
|
1699
1702
|
} catch {
|
|
1700
|
-
return
|
|
1703
|
+
return Xn(e);
|
|
1701
1704
|
}
|
|
1702
1705
|
r /= n;
|
|
1703
1706
|
}
|
|
1704
|
-
return
|
|
1707
|
+
return Xn(e);
|
|
1705
1708
|
}
|
|
1706
|
-
function
|
|
1709
|
+
function $n(e) {
|
|
1707
1710
|
if (!e) return "?";
|
|
1708
1711
|
let t = e.trim().split(/\s+/).filter(Boolean).slice(0, 2);
|
|
1709
1712
|
return t.length === 0 ? "?" : t.map((e) => e.charAt(0).toUpperCase()).join("");
|
|
1710
1713
|
}
|
|
1711
|
-
function
|
|
1714
|
+
function er(e) {
|
|
1712
1715
|
if (e == null || e === "") return "—";
|
|
1713
1716
|
if (typeof e == "string") return e;
|
|
1714
1717
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -1718,25 +1721,25 @@ function Xn(e) {
|
|
|
1718
1721
|
return String(e);
|
|
1719
1722
|
}
|
|
1720
1723
|
}
|
|
1721
|
-
function
|
|
1724
|
+
function tr({ entries: e, loading: t, emptyText: n, unknownUserText: r, className: i, locale: a }) {
|
|
1722
1725
|
return t ? /* @__PURE__ */ Z("div", {
|
|
1723
|
-
className:
|
|
1726
|
+
className: W("space-y-3", i),
|
|
1724
1727
|
children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ Q("div", {
|
|
1725
1728
|
className: "flex items-start gap-3",
|
|
1726
|
-
children: [/* @__PURE__ */ Z(
|
|
1729
|
+
children: [/* @__PURE__ */ Z(L, { className: "h-8 w-8 rounded-full" }), /* @__PURE__ */ Q("div", {
|
|
1727
1730
|
className: "flex-1 space-y-2",
|
|
1728
|
-
children: [/* @__PURE__ */ Z(
|
|
1731
|
+
children: [/* @__PURE__ */ Z(L, { className: "h-4 w-1/3" }), /* @__PURE__ */ Z(L, { className: "h-3 w-1/2" })]
|
|
1729
1732
|
})]
|
|
1730
1733
|
}, t))
|
|
1731
1734
|
}) : !e || e.length === 0 ? /* @__PURE__ */ Z("div", {
|
|
1732
|
-
className:
|
|
1735
|
+
className: W("flex items-center justify-center rounded-md border border-dashed py-10 text-sm text-muted-foreground", i),
|
|
1733
1736
|
children: n ?? "No history yet"
|
|
1734
|
-
}) : /* @__PURE__ */ Z(
|
|
1737
|
+
}) : /* @__PURE__ */ Z(fe, {
|
|
1735
1738
|
delayDuration: 150,
|
|
1736
1739
|
children: /* @__PURE__ */ Z("ol", {
|
|
1737
|
-
className:
|
|
1740
|
+
className: W("space-y-4", i),
|
|
1738
1741
|
children: e.map((e, t) => {
|
|
1739
|
-
let n = (e.action ?? "").toLowerCase(), i =
|
|
1742
|
+
let n = (e.action ?? "").toLowerCase(), i = Yn[n] ?? "outline", o = typeof e.user_name == "string" && e.user_name.trim() || r || "Unknown user", s = Xn(e.created_at), c = Qn(e.created_at, a), l = typeof e.user_avatar == "string" ? e.user_avatar : void 0;
|
|
1740
1743
|
return /* @__PURE__ */ Q("li", {
|
|
1741
1744
|
className: "flex items-start gap-3",
|
|
1742
1745
|
children: [/* @__PURE__ */ Q(C, {
|
|
@@ -1746,7 +1749,7 @@ function Zn({ entries: e, loading: t, emptyText: n, unknownUserText: r, classNam
|
|
|
1746
1749
|
alt: o
|
|
1747
1750
|
}) : null, /* @__PURE__ */ Z(w, {
|
|
1748
1751
|
className: "text-[10px] font-medium",
|
|
1749
|
-
children:
|
|
1752
|
+
children: $n(e.user_name)
|
|
1750
1753
|
})]
|
|
1751
1754
|
}), /* @__PURE__ */ Q("div", {
|
|
1752
1755
|
className: "min-w-0 flex-1",
|
|
@@ -1763,14 +1766,14 @@ function Zn({ entries: e, loading: t, emptyText: n, unknownUserText: r, classNam
|
|
|
1763
1766
|
className: "text-[10px] uppercase tracking-wide",
|
|
1764
1767
|
children: e.action
|
|
1765
1768
|
}),
|
|
1766
|
-
s && /* @__PURE__ */ Q(
|
|
1769
|
+
s && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
1767
1770
|
asChild: !0,
|
|
1768
1771
|
children: /* @__PURE__ */ Z("span", {
|
|
1769
1772
|
className: "text-xs text-muted-foreground cursor-help",
|
|
1770
1773
|
"aria-label": s,
|
|
1771
1774
|
children: c || s
|
|
1772
1775
|
})
|
|
1773
|
-
}), /* @__PURE__ */ Z(
|
|
1776
|
+
}), /* @__PURE__ */ Z(V, { children: s })] })
|
|
1774
1777
|
]
|
|
1775
1778
|
}),
|
|
1776
1779
|
e.summary && /* @__PURE__ */ Z("p", {
|
|
@@ -1797,7 +1800,7 @@ function Zn({ entries: e, loading: t, emptyText: n, unknownUserText: r, classNam
|
|
|
1797
1800
|
": ",
|
|
1798
1801
|
/* @__PURE__ */ Z("span", {
|
|
1799
1802
|
className: "text-foreground",
|
|
1800
|
-
children:
|
|
1803
|
+
children: er(e.to)
|
|
1801
1804
|
})
|
|
1802
1805
|
]
|
|
1803
1806
|
}, e.field))
|
|
@@ -1814,12 +1817,12 @@ function Zn({ entries: e, loading: t, emptyText: n, unknownUserText: r, classNam
|
|
|
1814
1817
|
": ",
|
|
1815
1818
|
/* @__PURE__ */ Z("span", {
|
|
1816
1819
|
className: "line-through opacity-70",
|
|
1817
|
-
children:
|
|
1820
|
+
children: er(e.from)
|
|
1818
1821
|
}),
|
|
1819
1822
|
" → ",
|
|
1820
1823
|
/* @__PURE__ */ Z("span", {
|
|
1821
1824
|
className: "text-foreground",
|
|
1822
|
-
children:
|
|
1825
|
+
children: er(e.to)
|
|
1823
1826
|
})
|
|
1824
1827
|
]
|
|
1825
1828
|
}, e.field))
|
|
@@ -1833,8 +1836,8 @@ function Zn({ entries: e, loading: t, emptyText: n, unknownUserText: r, classNam
|
|
|
1833
1836
|
}
|
|
1834
1837
|
//#endregion
|
|
1835
1838
|
//#region src/RecordMetaFooter.tsx
|
|
1836
|
-
var
|
|
1837
|
-
function
|
|
1839
|
+
var nr = ln;
|
|
1840
|
+
function rr(e) {
|
|
1838
1841
|
if (!e) return null;
|
|
1839
1842
|
if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
|
|
1840
1843
|
if (typeof e == "string" || typeof e == "number") {
|
|
@@ -1843,7 +1846,7 @@ function $n(e) {
|
|
|
1843
1846
|
}
|
|
1844
1847
|
return null;
|
|
1845
1848
|
}
|
|
1846
|
-
function
|
|
1849
|
+
function ir(e, t) {
|
|
1847
1850
|
let n = Date.now() - e.getTime(), r = Math.max(0, Math.floor(n / 1e3));
|
|
1848
1851
|
if (r < 60) return t("detail.justNow");
|
|
1849
1852
|
let i = Math.floor(r / 60);
|
|
@@ -1851,7 +1854,7 @@ function er(e, t) {
|
|
|
1851
1854
|
let a = Math.floor(i / 60);
|
|
1852
1855
|
return a < 24 ? t("detail.hoursAgo", { count: a }) : t("detail.daysAgo", { count: Math.floor(a / 24) });
|
|
1853
1856
|
}
|
|
1854
|
-
function
|
|
1857
|
+
function ar(e) {
|
|
1855
1858
|
try {
|
|
1856
1859
|
return new Intl.DateTimeFormat(void 0, {
|
|
1857
1860
|
dateStyle: "medium",
|
|
@@ -1861,16 +1864,16 @@ function tr(e) {
|
|
|
1861
1864
|
return e.toISOString();
|
|
1862
1865
|
}
|
|
1863
1866
|
}
|
|
1864
|
-
var
|
|
1867
|
+
var or = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
1865
1868
|
if (e == null || e === "") return null;
|
|
1866
1869
|
let r = t?.fields?.[n], i = r?.reference_to || r?.reference || "sys_user", a = {
|
|
1867
1870
|
name: n,
|
|
1868
1871
|
type: r?.type || "lookup",
|
|
1869
1872
|
reference_to: i,
|
|
1870
1873
|
...r?.reference_field && { reference_field: r.reference_field }
|
|
1871
|
-
}, o =
|
|
1874
|
+
}, o = Yt(a) || a.type;
|
|
1872
1875
|
if (o) {
|
|
1873
|
-
let t =
|
|
1876
|
+
let t = Kt(o);
|
|
1874
1877
|
if (t) return /* @__PURE__ */ Z("span", {
|
|
1875
1878
|
className: "inline-flex items-center [&_a]:text-inherit [&_a]:hover:underline",
|
|
1876
1879
|
children: u.createElement(t, {
|
|
@@ -1880,20 +1883,20 @@ var nr = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1880
1883
|
});
|
|
1881
1884
|
}
|
|
1882
1885
|
return /* @__PURE__ */ Z("span", { children: String(e) });
|
|
1883
|
-
},
|
|
1886
|
+
}, sr = ({ label: e, user: t, date: n, objectSchema: r, userField: i, t: a }) => {
|
|
1884
1887
|
if (!t && !n) return null;
|
|
1885
|
-
let o = n ? /* @__PURE__ */ Z(
|
|
1888
|
+
let o = n ? /* @__PURE__ */ Z(fe, {
|
|
1886
1889
|
delayDuration: 200,
|
|
1887
|
-
children: /* @__PURE__ */ Q(
|
|
1890
|
+
children: /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
1888
1891
|
asChild: !0,
|
|
1889
1892
|
children: /* @__PURE__ */ Z("time", {
|
|
1890
1893
|
dateTime: n.toISOString(),
|
|
1891
1894
|
className: "cursor-default underline decoration-dotted decoration-muted-foreground/40 underline-offset-2",
|
|
1892
|
-
children:
|
|
1895
|
+
children: ir(n, a)
|
|
1893
1896
|
})
|
|
1894
|
-
}), /* @__PURE__ */ Z(
|
|
1897
|
+
}), /* @__PURE__ */ Z(V, {
|
|
1895
1898
|
side: "top",
|
|
1896
|
-
children:
|
|
1899
|
+
children: ar(n)
|
|
1897
1900
|
})] })
|
|
1898
1901
|
}) : null;
|
|
1899
1902
|
return /* @__PURE__ */ Q("span", {
|
|
@@ -1903,7 +1906,7 @@ var nr = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1903
1906
|
className: "text-muted-foreground/70",
|
|
1904
1907
|
children: e
|
|
1905
1908
|
}),
|
|
1906
|
-
t ? /* @__PURE__ */ Z(
|
|
1909
|
+
t ? /* @__PURE__ */ Z(or, {
|
|
1907
1910
|
value: t,
|
|
1908
1911
|
objectSchema: r,
|
|
1909
1912
|
fieldName: i
|
|
@@ -1915,39 +1918,39 @@ var nr = ({ value: e, objectSchema: t, fieldName: n }) => {
|
|
|
1915
1918
|
o
|
|
1916
1919
|
]
|
|
1917
1920
|
});
|
|
1918
|
-
},
|
|
1921
|
+
}, cr = ({ data: e, objectSchema: t, objectName: n, className: r }) => {
|
|
1919
1922
|
let { t: i } = $();
|
|
1920
1923
|
if (!e) return null;
|
|
1921
|
-
let a =
|
|
1924
|
+
let a = rr(e[nr.createdAt]), o = rr(e[nr.updatedAt]), s = e[nr.createdBy], c = e[nr.updatedBy], l = !!(a || s), u = a && o && Math.abs(o.getTime() - a.getTime()) < 2e3, d = !!(o || c) && !(u && (s != null && c != null && String(s) === String(c) || !c));
|
|
1922
1925
|
return !l && !d ? null : /* @__PURE__ */ Q("div", {
|
|
1923
|
-
className:
|
|
1926
|
+
className: W("mt-6 pt-3 border-t border-border/40", "flex flex-wrap items-center gap-x-4 gap-y-1", "text-xs text-muted-foreground", r),
|
|
1924
1927
|
"data-testid": "record-meta-footer",
|
|
1925
|
-
children: [l && /* @__PURE__ */ Z(
|
|
1928
|
+
children: [l && /* @__PURE__ */ Z(sr, {
|
|
1926
1929
|
label: i(s ? "detail.createdBy" : "detail.created"),
|
|
1927
1930
|
user: s,
|
|
1928
1931
|
date: a,
|
|
1929
1932
|
objectSchema: t,
|
|
1930
|
-
userField:
|
|
1933
|
+
userField: nr.createdBy,
|
|
1931
1934
|
t: i
|
|
1932
|
-
}), d && /* @__PURE__ */ Z(
|
|
1935
|
+
}), d && /* @__PURE__ */ Z(sr, {
|
|
1933
1936
|
label: i(c ? "detail.updatedBy" : "detail.updated"),
|
|
1934
1937
|
user: c,
|
|
1935
1938
|
date: o,
|
|
1936
1939
|
objectSchema: t,
|
|
1937
|
-
userField:
|
|
1940
|
+
userField: nr.updatedBy,
|
|
1938
1941
|
t: i
|
|
1939
1942
|
})]
|
|
1940
1943
|
});
|
|
1941
|
-
},
|
|
1942
|
-
function
|
|
1943
|
-
let i = e && t ? `${e}:${t}:${n}` : "", [a, o] = u.useState(() => i &&
|
|
1944
|
+
}, lr = /* @__PURE__ */ new Map();
|
|
1945
|
+
function ur(e, t, n = "update", r = !0) {
|
|
1946
|
+
let i = e && t ? `${e}:${t}:${n}` : "", [a, o] = u.useState(() => i && lr.has(i) ? lr.get(i) : !0), s = u.useContext(yt)?.apiFetch;
|
|
1944
1947
|
return u.useEffect(() => {
|
|
1945
1948
|
if (!r || !i) {
|
|
1946
1949
|
o(!0);
|
|
1947
1950
|
return;
|
|
1948
1951
|
}
|
|
1949
|
-
if (
|
|
1950
|
-
o(
|
|
1952
|
+
if (lr.has(i)) {
|
|
1953
|
+
o(lr.get(i));
|
|
1951
1954
|
return;
|
|
1952
1955
|
}
|
|
1953
1956
|
let a = !1;
|
|
@@ -1966,7 +1969,7 @@ function or(e, t, n = "update", r = !0) {
|
|
|
1966
1969
|
if (!r.ok) return;
|
|
1967
1970
|
let c = (await r.json())?.record?.visible;
|
|
1968
1971
|
if (typeof c != "boolean") return;
|
|
1969
|
-
|
|
1972
|
+
lr.set(i, c), a || o(c);
|
|
1970
1973
|
} catch {}
|
|
1971
1974
|
})(), () => {
|
|
1972
1975
|
a = !0;
|
|
@@ -1980,13 +1983,13 @@ function or(e, t, n = "update", r = !0) {
|
|
|
1980
1983
|
s
|
|
1981
1984
|
]), a;
|
|
1982
1985
|
}
|
|
1983
|
-
function
|
|
1984
|
-
|
|
1986
|
+
function dr() {
|
|
1987
|
+
lr.clear();
|
|
1985
1988
|
}
|
|
1986
1989
|
//#endregion
|
|
1987
1990
|
//#region src/DetailView.tsx
|
|
1988
|
-
var
|
|
1989
|
-
function
|
|
1991
|
+
var fr = 5, pr = {};
|
|
1992
|
+
function mr(e, t, n, r) {
|
|
1990
1993
|
if (e && typeof e == "object") {
|
|
1991
1994
|
if (t.primaryField) {
|
|
1992
1995
|
let n = e[t.primaryField];
|
|
@@ -2010,10 +2013,10 @@ function ur(e, t, n, r) {
|
|
|
2010
2013
|
}
|
|
2011
2014
|
return r;
|
|
2012
2015
|
}
|
|
2013
|
-
var
|
|
2014
|
-
let [h, g] = u.useState(e.data), [_, v] = u.useState(!e.data && !!(e.api && e.resourceId || n && e.objectName && e.resourceId)), [y, b] = u.useState(!1), x = p ?? y, S =
|
|
2015
|
-
if (!
|
|
2016
|
-
let t = (t) =>
|
|
2016
|
+
var hr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBack: o, inlineEdit: s = !1, discussionSlot: c, rightRail: l, objectLabel: d, onDataLoaded: f, isFavorite: p, onToggleFavorite: m }) => {
|
|
2017
|
+
let [h, g] = u.useState(e.data), [_, v] = u.useState(!e.data && !!(e.api && e.resourceId || n && e.objectName && e.resourceId)), [y, b] = u.useState(!1), x = p ?? y, S = Et(), C = S?.editing ?? !1, w = S?.draft ?? pr, T = S?.autoFocusField ?? null, [O, k] = u.useState(null), [A, j] = u.useState(null), [M, N] = u.useState(!1), [ee, te] = u.useState(0), ne = Ct(e.objectName || void 0, e.resourceId == null ? void 0 : String(e.resourceId)), [re, ie] = u.useState(!1), { t: P } = $(), { currency: ae } = $t(), { fieldOptionLabel: oe } = jt(), se = pe(), F = sn(), ce = u.useMemo(() => {
|
|
2018
|
+
if (!F?.isLoaded || !e.objectName) return e;
|
|
2019
|
+
let t = (t) => F.checkField(e.objectName, t, "read"), n = (e) => e && e.filter((e) => {
|
|
2017
2020
|
let n = typeof e == "string" ? e : e?.name;
|
|
2018
2021
|
return !n || t(n);
|
|
2019
2022
|
});
|
|
@@ -2026,15 +2029,15 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2026
2029
|
})),
|
|
2027
2030
|
summaryFields: n(e.summaryFields)
|
|
2028
2031
|
};
|
|
2029
|
-
}, [e,
|
|
2030
|
-
...
|
|
2031
|
-
showEdit:
|
|
2032
|
-
showDelete:
|
|
2032
|
+
}, [e, F]), I = u.useMemo(() => !F?.isLoaded || !e.objectName || F.can(e.objectName, "update"), [F, e.objectName]), le = u.useMemo(() => !F?.isLoaded || !e.objectName || F.can(e.objectName, "delete"), [F, e.objectName]), U = e.resourceId == null ? void 0 : String(e.resourceId), me = ur(e.objectName, U, "update", I), G = ur(e.objectName, U, "delete", le), K = u.useMemo(() => ({
|
|
2033
|
+
...ce,
|
|
2034
|
+
showEdit: ce.showEdit && I && me,
|
|
2035
|
+
showDelete: ce.showDelete && le && G
|
|
2033
2036
|
}), [
|
|
2037
|
+
ce,
|
|
2038
|
+
I,
|
|
2039
|
+
me,
|
|
2034
2040
|
le,
|
|
2035
|
-
F,
|
|
2036
|
-
W,
|
|
2037
|
-
ue,
|
|
2038
2041
|
G
|
|
2039
2042
|
]);
|
|
2040
2043
|
u.useEffect(() => {
|
|
@@ -2068,7 +2071,7 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2068
2071
|
h
|
|
2069
2072
|
]), _e = K.summaryFields && K.summaryFields.length > 0 ? K.summaryFields : ge, ve = u.useCallback(() => {
|
|
2070
2073
|
K.resourceId && navigator.clipboard.writeText(String(K.resourceId)).then(() => {
|
|
2071
|
-
|
|
2074
|
+
N(!0), setTimeout(() => N(!1), 1500);
|
|
2072
2075
|
});
|
|
2073
2076
|
}, [K.resourceId]);
|
|
2074
2077
|
u.useEffect(() => {
|
|
@@ -2121,8 +2124,8 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2121
2124
|
n,
|
|
2122
2125
|
K.sections,
|
|
2123
2126
|
K.fields,
|
|
2124
|
-
|
|
2125
|
-
|
|
2127
|
+
ee,
|
|
2128
|
+
ne
|
|
2126
2129
|
]);
|
|
2127
2130
|
let ye = u.useCallback(() => {
|
|
2128
2131
|
if (o) o();
|
|
@@ -2134,16 +2137,16 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2134
2137
|
i ? i() : K.onNavigate && K.editUrl ? K.onNavigate(K.editUrl) : K.onNavigate && K.objectName && K.resourceId ? K.onNavigate(`/${K.objectName}/${K.resourceId}/edit`) : K.editUrl && (window.location.href = K.editUrl);
|
|
2135
2138
|
}, [i, K]), xe = u.useCallback(async () => {
|
|
2136
2139
|
if (!n?.cancelPendingApproval || !K.objectName || !K.resourceId) {
|
|
2137
|
-
k(
|
|
2140
|
+
k(P("detail.cancelApprovalUnavailable"));
|
|
2138
2141
|
return;
|
|
2139
2142
|
}
|
|
2140
|
-
|
|
2143
|
+
ie(!0), k(null);
|
|
2141
2144
|
try {
|
|
2142
2145
|
if (await n.cancelPendingApproval(String(K.objectName), String(K.resourceId)), n.findOne) try {
|
|
2143
2146
|
let e = await n.findOne(String(K.objectName), String(K.resourceId));
|
|
2144
2147
|
e && g(e);
|
|
2145
2148
|
} catch {}
|
|
2146
|
-
|
|
2149
|
+
te((e) => e + 1);
|
|
2147
2150
|
try {
|
|
2148
2151
|
window.dispatchEvent(new CustomEvent("objectui:record-changed", { detail: {
|
|
2149
2152
|
objectName: String(K.objectName),
|
|
@@ -2153,21 +2156,21 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2153
2156
|
} catch {}
|
|
2154
2157
|
} catch (e) {
|
|
2155
2158
|
let t = (e?.message || e?.error || String(e ?? "Cancel failed")).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
|
|
2156
|
-
k(`${
|
|
2159
|
+
k(`${P("detail.cancelApprovalFailed")}: ${t}`);
|
|
2157
2160
|
} finally {
|
|
2158
|
-
|
|
2161
|
+
ie(!1);
|
|
2159
2162
|
}
|
|
2160
2163
|
}, [
|
|
2161
2164
|
n,
|
|
2162
2165
|
K.objectName,
|
|
2163
2166
|
K.resourceId,
|
|
2164
|
-
|
|
2167
|
+
P
|
|
2165
2168
|
]), Se = u.useCallback(() => {
|
|
2166
|
-
let e = K.deleteConfirmation ||
|
|
2169
|
+
let e = K.deleteConfirmation || P("detail.deleteConfirmation");
|
|
2167
2170
|
window.confirm(e) && (a?.(), K.onNavigate && K.objectName && K.onNavigate(`/${K.objectName}`, { replace: !0 }));
|
|
2168
2171
|
}, [a, K]), Ce = u.useCallback(() => {
|
|
2169
2172
|
navigator.share && K.objectName && K.resourceId ? navigator.share({
|
|
2170
|
-
title: K.title ||
|
|
2173
|
+
title: K.title || P("detail.details"),
|
|
2171
2174
|
text: `${K.objectName} #${K.resourceId}`,
|
|
2172
2175
|
url: window.location.href
|
|
2173
2176
|
}).catch((e) => console.log("Share failed:", e)) : navigator.clipboard.writeText(window.location.href).then(() => {
|
|
@@ -2189,24 +2192,24 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2189
2192
|
};
|
|
2190
2193
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
2191
2194
|
}, [K.recordNavigation]);
|
|
2192
|
-
let ke = u.useMemo(() => K.related ?? [], [K.related]),
|
|
2195
|
+
let ke = u.useMemo(() => K.related ?? [], [K.related]), Me = u.useMemo(() => {
|
|
2193
2196
|
let e = [];
|
|
2194
2197
|
return e.push({
|
|
2195
2198
|
name: "sys_share",
|
|
2196
|
-
label:
|
|
2199
|
+
label: P("detail.share"),
|
|
2197
2200
|
icon: "share-2",
|
|
2198
2201
|
type: "script",
|
|
2199
2202
|
onClick: Ce
|
|
2200
2203
|
}), K.showEdit && e.push({
|
|
2201
2204
|
name: "sys_edit_mobile",
|
|
2202
|
-
label:
|
|
2205
|
+
label: P("detail.edit"),
|
|
2203
2206
|
icon: "edit",
|
|
2204
2207
|
type: "script",
|
|
2205
2208
|
className: "sm:hidden",
|
|
2206
2209
|
onClick: be
|
|
2207
2210
|
}), K.showDelete && e.push({
|
|
2208
2211
|
name: "sys_delete",
|
|
2209
|
-
label:
|
|
2212
|
+
label: P("detail.delete"),
|
|
2210
2213
|
icon: "trash-2",
|
|
2211
2214
|
type: "script",
|
|
2212
2215
|
variant: "destructive",
|
|
@@ -2214,15 +2217,15 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2214
2217
|
onClick: Se
|
|
2215
2218
|
}), e;
|
|
2216
2219
|
}, [
|
|
2217
|
-
|
|
2220
|
+
P,
|
|
2218
2221
|
K.showEdit,
|
|
2219
2222
|
K.showDelete,
|
|
2220
2223
|
Ce,
|
|
2221
2224
|
be,
|
|
2222
2225
|
Se
|
|
2223
|
-
]),
|
|
2226
|
+
]), Ne = u.useMemo(() => {
|
|
2224
2227
|
let e = K.actions ?? [];
|
|
2225
|
-
if (
|
|
2228
|
+
if (Me.length === 0) return e;
|
|
2226
2229
|
let t = !1, n = e.map((e) => {
|
|
2227
2230
|
let n = e;
|
|
2228
2231
|
if (n && typeof n == "object" && n.type === "action:bar" && (!n.location || n.location === "record_header")) {
|
|
@@ -2230,7 +2233,7 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2230
2233
|
let e = Array.isArray(n.systemActions) ? n.systemActions : [];
|
|
2231
2234
|
return {
|
|
2232
2235
|
...n,
|
|
2233
|
-
systemActions: [...e, ...
|
|
2236
|
+
systemActions: [...e, ...Me]
|
|
2234
2237
|
};
|
|
2235
2238
|
}
|
|
2236
2239
|
return e;
|
|
@@ -2238,43 +2241,43 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2238
2241
|
return t || n.push({
|
|
2239
2242
|
type: "action:bar",
|
|
2240
2243
|
location: "record_header",
|
|
2241
|
-
systemActions:
|
|
2244
|
+
systemActions: Me
|
|
2242
2245
|
}), n;
|
|
2243
|
-
}, [K.actions,
|
|
2246
|
+
}, [K.actions, Me]);
|
|
2244
2247
|
return _ || K.loading ? /* @__PURE__ */ Q("div", {
|
|
2245
|
-
className:
|
|
2248
|
+
className: W("space-y-4", r),
|
|
2246
2249
|
children: [
|
|
2247
|
-
/* @__PURE__ */ Z(
|
|
2248
|
-
/* @__PURE__ */ Z(
|
|
2249
|
-
/* @__PURE__ */ Z(
|
|
2250
|
+
/* @__PURE__ */ Z(L, { className: "h-10 w-full" }),
|
|
2251
|
+
/* @__PURE__ */ Z(L, { className: "h-64 w-full" }),
|
|
2252
|
+
/* @__PURE__ */ Z(L, { className: "h-48 w-full" })
|
|
2250
2253
|
]
|
|
2251
2254
|
}) : !h && !K.data ? /* @__PURE__ */ Q("div", {
|
|
2252
|
-
className:
|
|
2255
|
+
className: W("flex flex-col items-center justify-center py-16 text-center", r),
|
|
2253
2256
|
children: [
|
|
2254
2257
|
/* @__PURE__ */ Z("p", {
|
|
2255
2258
|
className: "text-lg font-semibold",
|
|
2256
|
-
children:
|
|
2259
|
+
children: P("detail.recordNotFound")
|
|
2257
2260
|
}),
|
|
2258
2261
|
/* @__PURE__ */ Z("p", {
|
|
2259
2262
|
className: "text-sm text-muted-foreground mt-1",
|
|
2260
|
-
children:
|
|
2263
|
+
children: P("detail.recordNotFoundDescription")
|
|
2261
2264
|
}),
|
|
2262
2265
|
(K.showBack ?? !0) && /* @__PURE__ */ Q(D, {
|
|
2263
2266
|
variant: "outline",
|
|
2264
2267
|
size: "sm",
|
|
2265
2268
|
onClick: ye,
|
|
2266
2269
|
className: "mt-4 gap-2",
|
|
2267
|
-
children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4" }),
|
|
2270
|
+
children: [/* @__PURE__ */ Z(he, { className: "h-4 w-4" }), P("detail.goBack")]
|
|
2268
2271
|
})
|
|
2269
2272
|
]
|
|
2270
|
-
}) : /* @__PURE__ */ Z(
|
|
2271
|
-
className:
|
|
2273
|
+
}) : /* @__PURE__ */ Z(fe, { children: /* @__PURE__ */ Q("div", {
|
|
2274
|
+
className: W("space-y-6", r),
|
|
2272
2275
|
children: [
|
|
2273
2276
|
K.showHeader !== !1 && /* @__PURE__ */ Q("div", {
|
|
2274
2277
|
className: "flex flex-col sm:flex-row items-start justify-between gap-3 sm:gap-4 pb-4 border-b",
|
|
2275
2278
|
children: [/* @__PURE__ */ Q("div", {
|
|
2276
2279
|
className: "flex items-start gap-2 sm:gap-3 flex-1 min-w-0",
|
|
2277
|
-
children: [(K.showBack ?? !0) && /* @__PURE__ */ Q(
|
|
2280
|
+
children: [(K.showBack ?? !0) && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2278
2281
|
asChild: !0,
|
|
2279
2282
|
children: /* @__PURE__ */ Z(D, {
|
|
2280
2283
|
variant: "ghost",
|
|
@@ -2283,14 +2286,14 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2283
2286
|
className: "shrink-0 mt-1",
|
|
2284
2287
|
children: /* @__PURE__ */ Z(he, { className: "h-4 w-4" })
|
|
2285
2288
|
})
|
|
2286
|
-
}), /* @__PURE__ */ Z(
|
|
2289
|
+
}), /* @__PURE__ */ Z(V, { children: P("detail.back") })] }), /* @__PURE__ */ Q("div", {
|
|
2287
2290
|
className: "flex-1 min-w-0",
|
|
2288
2291
|
children: [/* @__PURE__ */ Q("div", {
|
|
2289
2292
|
className: "flex items-center gap-2 flex-wrap",
|
|
2290
2293
|
children: [
|
|
2291
2294
|
/* @__PURE__ */ Z("h1", {
|
|
2292
2295
|
className: "text-xl sm:text-2xl font-bold truncate",
|
|
2293
|
-
children:
|
|
2296
|
+
children: mr(h, K, A, P("detail.details"))
|
|
2294
2297
|
}),
|
|
2295
2298
|
_e.map((e) => {
|
|
2296
2299
|
let t = h?.[e];
|
|
@@ -2300,10 +2303,10 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2300
2303
|
if (i === "currency") {
|
|
2301
2304
|
let e = Number(t);
|
|
2302
2305
|
if (!Number.isNaN(e)) {
|
|
2303
|
-
let t =
|
|
2306
|
+
let t = Qt({
|
|
2304
2307
|
...r,
|
|
2305
2308
|
...n
|
|
2306
|
-
},
|
|
2309
|
+
}, ae);
|
|
2307
2310
|
a = t ? new Intl.NumberFormat(void 0, {
|
|
2308
2311
|
style: "currency",
|
|
2309
2312
|
currency: t,
|
|
@@ -2332,7 +2335,7 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2332
2335
|
let e = i[String(t)];
|
|
2333
2336
|
e?.label && (o = e.label);
|
|
2334
2337
|
}
|
|
2335
|
-
a = K.objectName ?
|
|
2338
|
+
a = K.objectName ? oe(K.objectName, e, String(t), o) : o;
|
|
2336
2339
|
}
|
|
2337
2340
|
} catch {}
|
|
2338
2341
|
return o === null ? /* @__PURE__ */ Z(E, {
|
|
@@ -2354,34 +2357,34 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2354
2357
|
}), a]
|
|
2355
2358
|
}, e);
|
|
2356
2359
|
}),
|
|
2357
|
-
/* @__PURE__ */ Q(
|
|
2360
|
+
/* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2358
2361
|
asChild: !0,
|
|
2359
2362
|
children: /* @__PURE__ */ Z(D, {
|
|
2360
2363
|
variant: "ghost",
|
|
2361
2364
|
size: "icon",
|
|
2362
2365
|
className: "h-6 w-6 shrink-0",
|
|
2363
2366
|
onClick: we,
|
|
2364
|
-
"aria-label":
|
|
2365
|
-
children: x ? /* @__PURE__ */ Z(
|
|
2367
|
+
"aria-label": P(x ? "detail.removeFromFavorites" : "detail.addToFavorites"),
|
|
2368
|
+
children: x ? /* @__PURE__ */ Z(ut, { className: "h-4 w-4 fill-yellow-400 text-yellow-400" }) : /* @__PURE__ */ Z(ut, { className: "h-4 w-4 text-muted-foreground" })
|
|
2366
2369
|
})
|
|
2367
|
-
}), /* @__PURE__ */ Z(
|
|
2370
|
+
}), /* @__PURE__ */ Z(V, { children: P(x ? "detail.removeFromFavorites" : "detail.addToFavorites") })] })
|
|
2368
2371
|
]
|
|
2369
2372
|
}), K.objectName && /* @__PURE__ */ Q("p", {
|
|
2370
2373
|
className: "text-sm text-muted-foreground mt-1 flex items-center gap-1",
|
|
2371
2374
|
children: [/* @__PURE__ */ Z("span", {
|
|
2372
2375
|
className: "font-medium",
|
|
2373
2376
|
children: d || K.objectName
|
|
2374
|
-
}), K.resourceId && /* @__PURE__ */ Q(
|
|
2377
|
+
}), K.resourceId && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2375
2378
|
asChild: !0,
|
|
2376
2379
|
children: /* @__PURE__ */ Z(D, {
|
|
2377
2380
|
variant: "ghost",
|
|
2378
2381
|
size: "icon",
|
|
2379
2382
|
className: "h-5 w-5 shrink-0 text-muted-foreground/60 hover:text-foreground",
|
|
2380
2383
|
onClick: ve,
|
|
2381
|
-
"aria-label":
|
|
2382
|
-
children: M ? /* @__PURE__ */ Z(q, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(
|
|
2384
|
+
"aria-label": P("detail.copyRecordId", { defaultValue: "Copy record ID" }),
|
|
2385
|
+
children: M ? /* @__PURE__ */ Z(q, { className: "h-3 w-3 text-green-600" }) : /* @__PURE__ */ Z(Pe, { className: "h-3 w-3" })
|
|
2383
2386
|
})
|
|
2384
|
-
}), /* @__PURE__ */ Z(
|
|
2387
|
+
}), /* @__PURE__ */ Z(V, { children: M ? P("detail.copied", { defaultValue: "Copied" }) : P("detail.copyRecordId", { defaultValue: "Copy record ID" }) })] })]
|
|
2385
2388
|
})]
|
|
2386
2389
|
})]
|
|
2387
2390
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -2390,7 +2393,7 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2390
2393
|
K.recordNavigation && /* @__PURE__ */ Q("div", {
|
|
2391
2394
|
className: "flex items-center gap-1 mr-2",
|
|
2392
2395
|
children: [
|
|
2393
|
-
/* @__PURE__ */ Q(
|
|
2396
|
+
/* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2394
2397
|
asChild: !0,
|
|
2395
2398
|
children: /* @__PURE__ */ Z(D, {
|
|
2396
2399
|
variant: "outline",
|
|
@@ -2403,15 +2406,15 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2403
2406
|
},
|
|
2404
2407
|
children: /* @__PURE__ */ Z(Ee, { className: "h-4 w-4" })
|
|
2405
2408
|
})
|
|
2406
|
-
}), /* @__PURE__ */ Z(
|
|
2409
|
+
}), /* @__PURE__ */ Z(V, { children: P("detail.previousRecord") })] }),
|
|
2407
2410
|
/* @__PURE__ */ Z("span", {
|
|
2408
2411
|
className: "text-xs text-muted-foreground whitespace-nowrap px-1",
|
|
2409
|
-
children:
|
|
2412
|
+
children: P("detail.recordOf", {
|
|
2410
2413
|
current: K.recordNavigation.currentIndex + 1,
|
|
2411
2414
|
total: K.recordNavigation.recordIds.length
|
|
2412
2415
|
})
|
|
2413
2416
|
}),
|
|
2414
|
-
/* @__PURE__ */ Q(
|
|
2417
|
+
/* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2415
2418
|
asChild: !0,
|
|
2416
2419
|
children: /* @__PURE__ */ Z(D, {
|
|
2417
2420
|
variant: "outline",
|
|
@@ -2424,63 +2427,100 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2424
2427
|
},
|
|
2425
2428
|
children: /* @__PURE__ */ Z(De, { className: "h-4 w-4" })
|
|
2426
2429
|
})
|
|
2427
|
-
}), /* @__PURE__ */ Z(
|
|
2430
|
+
}), /* @__PURE__ */ Z(V, { children: P("detail.nextRecord") })] })
|
|
2428
2431
|
]
|
|
2429
2432
|
}),
|
|
2430
|
-
K.showEdit && /* @__PURE__ */ Q(
|
|
2433
|
+
K.showEdit && /* @__PURE__ */ Q(B, { children: [/* @__PURE__ */ Z(H, {
|
|
2431
2434
|
asChild: !0,
|
|
2432
2435
|
children: /* @__PURE__ */ Q(D, {
|
|
2433
2436
|
variant: "default",
|
|
2434
2437
|
onClick: be,
|
|
2435
2438
|
className: "gap-2 hidden sm:inline-flex",
|
|
2436
|
-
children: [/* @__PURE__ */ Z(
|
|
2439
|
+
children: [/* @__PURE__ */ Z(Fe, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2437
2440
|
className: "hidden sm:inline",
|
|
2438
|
-
children:
|
|
2441
|
+
children: P("detail.edit")
|
|
2439
2442
|
})]
|
|
2440
2443
|
})
|
|
2441
|
-
}), /* @__PURE__ */ Z(
|
|
2442
|
-
|
|
2444
|
+
}), /* @__PURE__ */ Z(V, { children: P("detail.editRecord") })] }),
|
|
2445
|
+
Ne.map((e, t) => /* @__PURE__ */ Z(vt, {
|
|
2443
2446
|
schema: e,
|
|
2444
2447
|
data: h
|
|
2445
2448
|
}, `header-action-${t}`))
|
|
2446
2449
|
]
|
|
2447
2450
|
})]
|
|
2448
2451
|
}),
|
|
2449
|
-
K.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(
|
|
2452
|
+
K.header && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(vt, {
|
|
2450
2453
|
schema: K.header,
|
|
2451
2454
|
data: h
|
|
2452
2455
|
}) }),
|
|
2453
|
-
K.highlightFields && K.highlightFields.length > 0 && /* @__PURE__ */ Z(
|
|
2456
|
+
K.highlightFields && K.highlightFields.length > 0 && /* @__PURE__ */ Z(Bn, {
|
|
2454
2457
|
fields: K.highlightFields,
|
|
2455
2458
|
data: h,
|
|
2456
2459
|
objectName: K.objectName,
|
|
2457
2460
|
objectSchema: A
|
|
2458
2461
|
}),
|
|
2459
2462
|
s && K.showHeader === !1 && (() => {
|
|
2460
|
-
let e = h?.approval_status, t = e === "pending" || e === "in_approval", r = S?.approvalPending ?? !1, i = r && !(S?.locked ?? !1) ? !1 : (S?.locked ?? !1) || t, a = i || r || t;
|
|
2463
|
+
let e = h?.approval_status, t = e === "pending" || e === "in_approval", r = S?.approvalPending ?? !1, i = r && !(S?.locked ?? !1) ? !1 : (S?.locked ?? !1) || t, a = i || r || t, o = a ? S?.approvalProgress : void 0, s = !!o && o.need > 0 && o.need <= 12;
|
|
2461
2464
|
return !a && !O ? null : /* @__PURE__ */ Q("div", {
|
|
2462
2465
|
className: "flex flex-col items-end gap-1",
|
|
2463
|
-
children: [
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2466
|
+
children: [
|
|
2467
|
+
a && /* @__PURE__ */ Q("div", {
|
|
2468
|
+
className: "flex items-center justify-end gap-2",
|
|
2469
|
+
children: [/* @__PURE__ */ Q("span", {
|
|
2470
|
+
role: "status",
|
|
2471
|
+
className: i ? "inline-flex items-center gap-1 rounded-md border border-amber-300 bg-amber-50 px-2 py-1 text-xs text-amber-800" : "inline-flex items-center gap-1 rounded-md border border-sky-300 bg-sky-50 px-2 py-1 text-xs text-sky-800",
|
|
2472
|
+
title: i ? S?.lockedReason ?? P("detail.lockedTooltip") : P("detail.approvalPendingTooltip"),
|
|
2473
|
+
children: [Z(i ? Ke : je, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: P(i ? "detail.lockedByApproval" : "detail.approvalPendingEditable") })]
|
|
2474
|
+
}), n?.cancelPendingApproval && /* @__PURE__ */ Q(D, {
|
|
2475
|
+
variant: "outline",
|
|
2476
|
+
size: "sm",
|
|
2477
|
+
onClick: xe,
|
|
2478
|
+
disabled: re,
|
|
2479
|
+
className: i ? "gap-2 border-amber-300 text-amber-800 hover:bg-amber-50" : "gap-2 border-sky-300 text-sky-800 hover:bg-sky-50",
|
|
2480
|
+
title: P(i ? "detail.cancelApprovalTooltip" : "detail.cancelApprovalTooltipUnlocked"),
|
|
2481
|
+
children: [/* @__PURE__ */ Z(mt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: P(re ? "detail.cancelApprovalInFlight" : "detail.cancelApproval") })]
|
|
2482
|
+
})]
|
|
2483
|
+
}),
|
|
2484
|
+
o && /* @__PURE__ */ Q("div", {
|
|
2485
|
+
className: "flex flex-col items-end gap-1 max-w-[16rem]",
|
|
2486
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
2487
|
+
role: "progressbar",
|
|
2488
|
+
"aria-valuemin": 0,
|
|
2489
|
+
"aria-valuemax": o.need,
|
|
2490
|
+
"aria-valuenow": Math.min(o.got, o.need),
|
|
2491
|
+
"aria-label": P("detail.approvalProgressLabel"),
|
|
2492
|
+
className: "flex items-center gap-2 w-full justify-end",
|
|
2493
|
+
children: [/* @__PURE__ */ Z("span", {
|
|
2494
|
+
className: "text-[11px] text-muted-foreground whitespace-nowrap",
|
|
2495
|
+
children: o.behavior === "per_group" ? P("detail.approvalProgressGroups", {
|
|
2496
|
+
got: o.got,
|
|
2497
|
+
need: o.need
|
|
2498
|
+
}) : P("detail.approvalProgress", {
|
|
2499
|
+
got: o.got,
|
|
2500
|
+
need: o.need
|
|
2501
|
+
})
|
|
2502
|
+
}), s && /* @__PURE__ */ Z("span", {
|
|
2503
|
+
className: "flex items-center gap-1 w-20 shrink-0",
|
|
2504
|
+
children: Array.from({ length: o.need }).map((e, t) => /* @__PURE__ */ Z("span", {
|
|
2505
|
+
"aria-hidden": "true",
|
|
2506
|
+
className: W("h-1.5 flex-1 rounded-full", t < o.got ? "bg-emerald-500" : "bg-muted")
|
|
2507
|
+
}, t))
|
|
2508
|
+
})]
|
|
2509
|
+
}), o.groups && o.groups.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2510
|
+
className: "flex flex-wrap justify-end gap-1",
|
|
2511
|
+
children: o.groups.map((e) => /* @__PURE__ */ Q("span", {
|
|
2512
|
+
title: `${e.got}/${e.need}`,
|
|
2513
|
+
className: W("inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px]", e.satisfied ? "border-emerald-300 text-emerald-700" : "border-border text-muted-foreground"),
|
|
2514
|
+
children: [e.satisfied ? /* @__PURE__ */ Z(q, { className: "h-3 w-3" }) : /* @__PURE__ */ Z(Ae, { className: "h-2.5 w-2.5" }), /* @__PURE__ */ Z("span", { children: `${e.group} ${e.got}/${e.need}` })]
|
|
2515
|
+
}, e.group))
|
|
2516
|
+
})]
|
|
2517
|
+
}),
|
|
2518
|
+
O && /* @__PURE__ */ Z("div", {
|
|
2519
|
+
role: "alert",
|
|
2520
|
+
className: "text-xs text-destructive bg-destructive/10 border border-destructive/20 rounded-md px-2 py-1 max-w-md text-right",
|
|
2521
|
+
children: O
|
|
2522
|
+
})
|
|
2523
|
+
]
|
|
2484
2524
|
});
|
|
2485
2525
|
})(),
|
|
2486
2526
|
K.autoTabs && !K.tabs?.length ? (() => {
|
|
@@ -2493,7 +2533,7 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2493
2533
|
], o = K.defaultTab, l = o && a.includes(o) ? o : "details", u = K.onTabChange, d = /* @__PURE__ */ Q("div", {
|
|
2494
2534
|
className: "space-y-3 sm:space-y-4",
|
|
2495
2535
|
children: [
|
|
2496
|
-
K.sectionGroups && K.sectionGroups.length > 0 && K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(
|
|
2536
|
+
K.sectionGroups && K.sectionGroups.length > 0 && K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(zn, {
|
|
2497
2537
|
group: e,
|
|
2498
2538
|
data: {
|
|
2499
2539
|
...h,
|
|
@@ -2507,7 +2547,7 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2507
2547
|
autoFocusField: T,
|
|
2508
2548
|
dataSource: n
|
|
2509
2549
|
}, t)),
|
|
2510
|
-
K.sections && K.sections.length > 0 && K.sections.map((e, t) => /* @__PURE__ */ Z(
|
|
2550
|
+
K.sections && K.sections.length > 0 && K.sections.map((e, t) => /* @__PURE__ */ Z(Nn, {
|
|
2511
2551
|
section: e,
|
|
2512
2552
|
data: {
|
|
2513
2553
|
...h,
|
|
@@ -2521,7 +2561,7 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2521
2561
|
autoFocusField: T,
|
|
2522
2562
|
dataSource: n
|
|
2523
2563
|
}, t)),
|
|
2524
|
-
K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(
|
|
2564
|
+
K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(Nn, {
|
|
2525
2565
|
section: {
|
|
2526
2566
|
fields: K.fields,
|
|
2527
2567
|
columns: K.columns
|
|
@@ -2538,7 +2578,7 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2538
2578
|
autoFocusField: T,
|
|
2539
2579
|
dataSource: n
|
|
2540
2580
|
}),
|
|
2541
|
-
K.comments && /* @__PURE__ */ Z(
|
|
2581
|
+
K.comments && /* @__PURE__ */ Z(Hn, {
|
|
2542
2582
|
comments: K.comments,
|
|
2543
2583
|
onAddComment: K.onAddComment
|
|
2544
2584
|
})
|
|
@@ -2547,54 +2587,54 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2547
2587
|
return !e && !t && !r && !i ? /* @__PURE__ */ Z("div", {
|
|
2548
2588
|
className: "mt-2",
|
|
2549
2589
|
children: d
|
|
2550
|
-
}) : /* @__PURE__ */ Q(
|
|
2590
|
+
}) : /* @__PURE__ */ Q(R, {
|
|
2551
2591
|
defaultValue: l,
|
|
2552
2592
|
onValueChange: u,
|
|
2553
2593
|
className: "w-full",
|
|
2554
2594
|
children: [
|
|
2555
|
-
/* @__PURE__ */ Q(
|
|
2595
|
+
/* @__PURE__ */ Q(z, {
|
|
2556
2596
|
className: "w-full justify-start border-b rounded-none bg-transparent p-0",
|
|
2557
2597
|
children: [
|
|
2558
|
-
/* @__PURE__ */ Z(
|
|
2598
|
+
/* @__PURE__ */ Z(de, {
|
|
2559
2599
|
value: "details",
|
|
2560
2600
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2561
|
-
children:
|
|
2601
|
+
children: P("detail.details")
|
|
2562
2602
|
}),
|
|
2563
|
-
e && /* @__PURE__ */ Z(
|
|
2603
|
+
e && /* @__PURE__ */ Z(de, {
|
|
2564
2604
|
value: "related",
|
|
2565
2605
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2566
2606
|
children: /* @__PURE__ */ Q("span", {
|
|
2567
2607
|
className: "flex items-center gap-1.5",
|
|
2568
|
-
children: [
|
|
2608
|
+
children: [P("detail.related"), /* @__PURE__ */ Z(E, {
|
|
2569
2609
|
variant: "secondary",
|
|
2570
2610
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2571
2611
|
children: ke.length
|
|
2572
2612
|
})]
|
|
2573
2613
|
})
|
|
2574
2614
|
}),
|
|
2575
|
-
t && /* @__PURE__ */ Z(
|
|
2615
|
+
t && /* @__PURE__ */ Z(de, {
|
|
2576
2616
|
value: "activity",
|
|
2577
2617
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2578
2618
|
children: /* @__PURE__ */ Q("span", {
|
|
2579
2619
|
className: "flex items-center gap-1.5",
|
|
2580
|
-
children: [
|
|
2620
|
+
children: [P("detail.activity"), /* @__PURE__ */ Z(E, {
|
|
2581
2621
|
variant: "secondary",
|
|
2582
2622
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2583
2623
|
children: K.activities.length
|
|
2584
2624
|
})]
|
|
2585
2625
|
})
|
|
2586
2626
|
}),
|
|
2587
|
-
r && /* @__PURE__ */ Z(
|
|
2627
|
+
r && /* @__PURE__ */ Z(de, {
|
|
2588
2628
|
value: "discussion",
|
|
2589
2629
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2590
|
-
children:
|
|
2630
|
+
children: P("detail.discussion", { defaultValue: "Discussion" })
|
|
2591
2631
|
}),
|
|
2592
|
-
i && /* @__PURE__ */ Z(
|
|
2632
|
+
i && /* @__PURE__ */ Z(de, {
|
|
2593
2633
|
value: "history",
|
|
2594
2634
|
className: "relative rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent",
|
|
2595
2635
|
children: /* @__PURE__ */ Q("span", {
|
|
2596
2636
|
className: "flex items-center gap-1.5",
|
|
2597
|
-
children: [
|
|
2637
|
+
children: [P("detail.history", { defaultValue: "History" }), !K.history.loading && K.history.entries.length > 0 && /* @__PURE__ */ Z(E, {
|
|
2598
2638
|
variant: "secondary",
|
|
2599
2639
|
className: "text-xs bg-primary/10 text-primary border-transparent",
|
|
2600
2640
|
children: K.history.entries.length
|
|
@@ -2603,17 +2643,17 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2603
2643
|
})
|
|
2604
2644
|
]
|
|
2605
2645
|
}),
|
|
2606
|
-
/* @__PURE__ */ Z(
|
|
2646
|
+
/* @__PURE__ */ Z(ue, {
|
|
2607
2647
|
value: "details",
|
|
2608
2648
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2609
2649
|
children: d
|
|
2610
2650
|
}),
|
|
2611
|
-
e && /* @__PURE__ */ Z(
|
|
2651
|
+
e && /* @__PURE__ */ Z(ue, {
|
|
2612
2652
|
value: "related",
|
|
2613
2653
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2614
2654
|
children: /* @__PURE__ */ Z("div", {
|
|
2615
2655
|
className: "space-y-3",
|
|
2616
|
-
children: ke.map((e, t) => /* @__PURE__ */ Z(
|
|
2656
|
+
children: ke.map((e, t) => /* @__PURE__ */ Z(Rn, {
|
|
2617
2657
|
title: e.title,
|
|
2618
2658
|
type: e.type,
|
|
2619
2659
|
api: e.api,
|
|
@@ -2629,36 +2669,36 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2629
2669
|
onRowEdit: e.onRowEdit,
|
|
2630
2670
|
onRowDelete: e.onRowDelete,
|
|
2631
2671
|
collapsible: !0,
|
|
2632
|
-
defaultCollapsed:
|
|
2633
|
-
pageSize:
|
|
2672
|
+
defaultCollapsed: se && t > 0,
|
|
2673
|
+
pageSize: fr
|
|
2634
2674
|
}, t))
|
|
2635
2675
|
})
|
|
2636
2676
|
}),
|
|
2637
|
-
t && /* @__PURE__ */ Z(
|
|
2677
|
+
t && /* @__PURE__ */ Z(ue, {
|
|
2638
2678
|
value: "activity",
|
|
2639
2679
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2640
|
-
children: /* @__PURE__ */ Z(
|
|
2680
|
+
children: /* @__PURE__ */ Z(Jn, { activities: K.activities })
|
|
2641
2681
|
}),
|
|
2642
|
-
r && /* @__PURE__ */ Z(
|
|
2682
|
+
r && /* @__PURE__ */ Z(ue, {
|
|
2643
2683
|
value: "discussion",
|
|
2644
2684
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2645
2685
|
children: c
|
|
2646
2686
|
}),
|
|
2647
|
-
i && /* @__PURE__ */ Z(
|
|
2687
|
+
i && /* @__PURE__ */ Z(ue, {
|
|
2648
2688
|
value: "history",
|
|
2649
2689
|
className: "mt-4 motion-safe:data-[state=active]:animate-in motion-safe:data-[state=active]:fade-in-0 motion-safe:duration-150",
|
|
2650
|
-
children: /* @__PURE__ */ Z(
|
|
2690
|
+
children: /* @__PURE__ */ Z(tr, {
|
|
2651
2691
|
entries: K.history.entries,
|
|
2652
2692
|
loading: K.history.loading,
|
|
2653
|
-
emptyText: K.history.emptyText ??
|
|
2693
|
+
emptyText: K.history.emptyText ?? P("detail.historyEmpty", { defaultValue: "No history yet" })
|
|
2654
2694
|
})
|
|
2655
2695
|
})
|
|
2656
2696
|
]
|
|
2657
2697
|
});
|
|
2658
|
-
})() : /* @__PURE__ */ Q(
|
|
2698
|
+
})() : /* @__PURE__ */ Q(an, { children: [
|
|
2659
2699
|
K.sectionGroups && K.sectionGroups.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2660
2700
|
className: "space-y-3 sm:space-y-4",
|
|
2661
|
-
children: K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(
|
|
2701
|
+
children: K.sectionGroups.map((e, t) => /* @__PURE__ */ Z(zn, {
|
|
2662
2702
|
group: e,
|
|
2663
2703
|
data: {
|
|
2664
2704
|
...h,
|
|
@@ -2675,7 +2715,7 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2675
2715
|
}),
|
|
2676
2716
|
K.sections && K.sections.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2677
2717
|
className: "space-y-3 sm:space-y-4",
|
|
2678
|
-
children: K.sections.map((e, t) => /* @__PURE__ */ Z(
|
|
2718
|
+
children: K.sections.map((e, t) => /* @__PURE__ */ Z(Nn, {
|
|
2679
2719
|
section: e,
|
|
2680
2720
|
data: {
|
|
2681
2721
|
...h,
|
|
@@ -2690,7 +2730,7 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2690
2730
|
dataSource: n
|
|
2691
2731
|
}, t))
|
|
2692
2732
|
}),
|
|
2693
|
-
K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(
|
|
2733
|
+
K.fields && K.fields.length > 0 && !K.sections?.length && /* @__PURE__ */ Z(Nn, {
|
|
2694
2734
|
section: {
|
|
2695
2735
|
fields: K.fields,
|
|
2696
2736
|
columns: K.columns
|
|
@@ -2707,7 +2747,7 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2707
2747
|
autoFocusField: T,
|
|
2708
2748
|
dataSource: n
|
|
2709
2749
|
}),
|
|
2710
|
-
K.tabs && K.tabs.length > 0 && /* @__PURE__ */ Z(
|
|
2750
|
+
K.tabs && K.tabs.length > 0 && /* @__PURE__ */ Z(Pn, {
|
|
2711
2751
|
tabs: K.tabs,
|
|
2712
2752
|
data: h
|
|
2713
2753
|
}),
|
|
@@ -2715,8 +2755,8 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2715
2755
|
className: "space-y-3",
|
|
2716
2756
|
children: [/* @__PURE__ */ Z("h2", {
|
|
2717
2757
|
className: "text-lg font-semibold",
|
|
2718
|
-
children:
|
|
2719
|
-
}), ke.map((e, t) => /* @__PURE__ */ Z(
|
|
2758
|
+
children: P("detail.related")
|
|
2759
|
+
}), ke.map((e, t) => /* @__PURE__ */ Z(Rn, {
|
|
2720
2760
|
title: e.title,
|
|
2721
2761
|
type: e.type,
|
|
2722
2762
|
api: e.api,
|
|
@@ -2732,17 +2772,17 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2732
2772
|
onRowEdit: e.onRowEdit,
|
|
2733
2773
|
onRowDelete: e.onRowDelete,
|
|
2734
2774
|
collapsible: !0,
|
|
2735
|
-
defaultCollapsed:
|
|
2736
|
-
pageSize:
|
|
2775
|
+
defaultCollapsed: se && t > 0,
|
|
2776
|
+
pageSize: fr
|
|
2737
2777
|
}, t))]
|
|
2738
2778
|
}),
|
|
2739
|
-
K.comments && /* @__PURE__ */ Z(
|
|
2779
|
+
K.comments && /* @__PURE__ */ Z(Hn, {
|
|
2740
2780
|
comments: K.comments,
|
|
2741
2781
|
onAddComment: K.onAddComment
|
|
2742
2782
|
}),
|
|
2743
|
-
K.activities && K.activities.length > 0 && /* @__PURE__ */ Z(
|
|
2783
|
+
K.activities && K.activities.length > 0 && /* @__PURE__ */ Z(Jn, { activities: K.activities })
|
|
2744
2784
|
] }),
|
|
2745
|
-
/* @__PURE__ */ Z(
|
|
2785
|
+
/* @__PURE__ */ Z(cr, {
|
|
2746
2786
|
data: {
|
|
2747
2787
|
...h,
|
|
2748
2788
|
...w
|
|
@@ -2750,13 +2790,13 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2750
2790
|
objectSchema: A,
|
|
2751
2791
|
objectName: K.objectName
|
|
2752
2792
|
}),
|
|
2753
|
-
K.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(
|
|
2793
|
+
K.footer && /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(vt, {
|
|
2754
2794
|
schema: K.footer,
|
|
2755
2795
|
data: h
|
|
2756
2796
|
}) })
|
|
2757
2797
|
]
|
|
2758
2798
|
}) });
|
|
2759
|
-
},
|
|
2799
|
+
}, gr = (e) => n(e) ?? null, _r = (e) => {
|
|
2760
2800
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2761
2801
|
return {
|
|
2762
2802
|
designer: {
|
|
@@ -2766,8 +2806,8 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2766
2806
|
},
|
|
2767
2807
|
rest: i
|
|
2768
2808
|
};
|
|
2769
|
-
},
|
|
2770
|
-
let r =
|
|
2809
|
+
}, vr = ({ schema: e = {}, className: t, ...n }) => {
|
|
2810
|
+
let r = Ot(), { designer: i } = _r(n), a = r?.objectName || "", o = sn(), { readableFields: s } = on(a), { sectionLabel: l } = jt(), { language: u } = en(), d = Tt();
|
|
2771
2811
|
if (!r) return /* @__PURE__ */ Z("div", {
|
|
2772
2812
|
className: t,
|
|
2773
2813
|
"data-record-details-placeholder": !0,
|
|
@@ -2790,15 +2830,15 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2790
2830
|
});
|
|
2791
2831
|
let p = e.layout === "inline" || e.layout === "compact" ? "horizontal" : "vertical", m = e.enforceFieldSecurity === !0, h = Array.isArray(e.redactFields) ? e.redactFields : [], g = (e) => {
|
|
2792
2832
|
if (!e || !m && h.length === 0) return e;
|
|
2793
|
-
let t = e.map(
|
|
2833
|
+
let t = e.map(gr).filter((e) => !!e), n = new Set((m && a ? s(t) : t).filter((e) => !h.includes(e)));
|
|
2794
2834
|
return e.filter((e) => {
|
|
2795
|
-
let t =
|
|
2835
|
+
let t = gr(e);
|
|
2796
2836
|
return !t || n.has(t);
|
|
2797
2837
|
});
|
|
2798
2838
|
}, _ = (e) => typeof e == "string" ? { name: e } : e && typeof e == "object" && !e.name && e.field ? {
|
|
2799
2839
|
...e,
|
|
2800
2840
|
name: e.field
|
|
2801
|
-
} : e, v = (e) => Array.isArray(e) ? e.map(_) : e, y = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e :
|
|
2841
|
+
} : e, v = (e) => Array.isArray(e) ? e.map(_) : e, y = new Set((Array.isArray(e.hideFields) ? e.hideFields : []).map((e) => typeof e == "string" ? e : gr(e)).filter((e) => !!e));
|
|
2802
2842
|
for (let e of d) y.add(e);
|
|
2803
2843
|
let b = r.objectSchema, x = r.data ?? {}, S = [
|
|
2804
2844
|
b?.primaryField,
|
|
@@ -2814,10 +2854,10 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2814
2854
|
break;
|
|
2815
2855
|
}
|
|
2816
2856
|
let C = (e) => !e || y.size === 0 ? e : e.filter((e) => {
|
|
2817
|
-
let t =
|
|
2857
|
+
let t = gr(e);
|
|
2818
2858
|
return !t || !y.has(t);
|
|
2819
2859
|
}), w = C(v(g(e.fields))), T = Array.isArray(e.sections) ? e.sections.map((e) => {
|
|
2820
|
-
let t = e.title ?? e.label, n = t == null ? void 0 :
|
|
2860
|
+
let t = e.title ?? e.label, n = t == null ? void 0 : Zt(t, u), r = e.name && a ? l(a, e.name, n ?? e.name) : n;
|
|
2821
2861
|
return {
|
|
2822
2862
|
...e,
|
|
2823
2863
|
title: r,
|
|
@@ -2841,13 +2881,13 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2841
2881
|
return /* @__PURE__ */ Z("div", {
|
|
2842
2882
|
className: t,
|
|
2843
2883
|
...i,
|
|
2844
|
-
children: /* @__PURE__ */ Z(
|
|
2884
|
+
children: /* @__PURE__ */ Z(hr, {
|
|
2845
2885
|
schema: O,
|
|
2846
2886
|
dataSource: r.dataSource,
|
|
2847
2887
|
inlineEdit: D
|
|
2848
2888
|
})
|
|
2849
2889
|
});
|
|
2850
|
-
},
|
|
2890
|
+
}, yr = (e) => n(e) || (e && typeof e == "object" ? e.key : null) || null, br = (e) => e?.id ?? e?._id ?? null, xr = 5, Sr = (e) => {
|
|
2851
2891
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2852
2892
|
return {
|
|
2853
2893
|
designer: {
|
|
@@ -2857,11 +2897,11 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2857
2897
|
},
|
|
2858
2898
|
rest: i
|
|
2859
2899
|
};
|
|
2860
|
-
},
|
|
2861
|
-
let r =
|
|
2900
|
+
}, Cr = ({ schema: e = {}, className: t, ...n }) => {
|
|
2901
|
+
let r = Ot(), { designer: i } = Sr(n), a = jt(), { language: o } = en(), s = e.objectName, c = s && a.objectLabel ? a.objectLabel({
|
|
2862
2902
|
name: s,
|
|
2863
|
-
label:
|
|
2864
|
-
}) : s ?
|
|
2903
|
+
label: qt(s)
|
|
2904
|
+
}) : s ? qt(s) : "", l = Zt(e.title, o) || c || "Related", u = sn(), { readableFields: f } = on(s || ""), p = e.relationshipValueField || "id", m = p === "id" ? r?.recordId ?? null : r?.data?.[p] ?? null, h = At(), g = d.useMemo(() => h?.resolve({
|
|
2865
2905
|
objectName: s,
|
|
2866
2906
|
relationshipField: e.relationshipField,
|
|
2867
2907
|
parentId: m
|
|
@@ -2893,16 +2933,16 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2893
2933
|
});
|
|
2894
2934
|
let v = e.enforceFieldSecurity === !0, y = Array.isArray(e.redactFields) ? e.redactFields : [], b = Array.isArray(e.columns) ? e.columns : [], x = b;
|
|
2895
2935
|
if (v || y.length > 0) {
|
|
2896
|
-
let e = b.map(
|
|
2936
|
+
let e = b.map(yr).filter((e) => !!e), t = new Set((v ? f(e) : e).filter((e) => !y.includes(e)));
|
|
2897
2937
|
x = b.filter((e) => {
|
|
2898
|
-
let n =
|
|
2938
|
+
let n = yr(e);
|
|
2899
2939
|
return !n || t.has(n);
|
|
2900
2940
|
});
|
|
2901
2941
|
}
|
|
2902
2942
|
return /* @__PURE__ */ Z("div", {
|
|
2903
2943
|
className: t,
|
|
2904
2944
|
...i,
|
|
2905
|
-
children: /* @__PURE__ */ Z(
|
|
2945
|
+
children: /* @__PURE__ */ Z(Rn, {
|
|
2906
2946
|
title: l,
|
|
2907
2947
|
type: "table",
|
|
2908
2948
|
api: s,
|
|
@@ -2910,12 +2950,12 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2910
2950
|
referenceField: e.relationshipField,
|
|
2911
2951
|
parentId: m,
|
|
2912
2952
|
columns: x,
|
|
2913
|
-
pageSize: typeof e.limit == "number" && e.limit > 0 ? e.limit :
|
|
2953
|
+
pageSize: typeof e.limit == "number" && e.limit > 0 ? e.limit : xr,
|
|
2914
2954
|
defaultSort: e.sort,
|
|
2915
2955
|
dataSource: r?.dataSource,
|
|
2916
2956
|
add: e.add ? {
|
|
2917
2957
|
...e.add,
|
|
2918
|
-
label:
|
|
2958
|
+
label: Zt(e.add.label, o) || void 0
|
|
2919
2959
|
} : void 0,
|
|
2920
2960
|
rowActions: g?.rowActions,
|
|
2921
2961
|
onRowAction: g?.onRowAction,
|
|
@@ -2923,15 +2963,15 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2923
2963
|
onToolbarAction: g?.onToolbarAction,
|
|
2924
2964
|
onNew: g?.onCreate,
|
|
2925
2965
|
onRowClick: g?.onView ? (e) => {
|
|
2926
|
-
let t =
|
|
2966
|
+
let t = br(e);
|
|
2927
2967
|
t != null && g.onView(t, e);
|
|
2928
2968
|
} : void 0,
|
|
2929
2969
|
onRowEdit: g?.onEdit ? (e) => {
|
|
2930
|
-
let t =
|
|
2970
|
+
let t = br(e);
|
|
2931
2971
|
t != null && g.onEdit(t, e);
|
|
2932
2972
|
} : void 0,
|
|
2933
2973
|
onRowDelete: g?.onDelete ? (e) => {
|
|
2934
|
-
let t =
|
|
2974
|
+
let t = br(e);
|
|
2935
2975
|
if (t != null) return g.onDelete(t, e);
|
|
2936
2976
|
} : e.add && r?.dataSource ? async (e) => {
|
|
2937
2977
|
let t = e?.id ?? e?._id;
|
|
@@ -2939,7 +2979,7 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2939
2979
|
} : void 0
|
|
2940
2980
|
})
|
|
2941
2981
|
});
|
|
2942
|
-
},
|
|
2982
|
+
}, wr = (e) => {
|
|
2943
2983
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
2944
2984
|
return {
|
|
2945
2985
|
designer: {
|
|
@@ -2949,17 +2989,17 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2949
2989
|
},
|
|
2950
2990
|
rest: i
|
|
2951
2991
|
};
|
|
2952
|
-
},
|
|
2953
|
-
let r =
|
|
2992
|
+
}, Tr = ({ schema: e = {}, className: t, ...n }) => {
|
|
2993
|
+
let r = Ot(), { designer: i } = wr(n), a = r?.objectName || "", o = sn(), { readableFields: s } = on(a), c = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [], l = !(c.length > 0 && a) || c.every((e) => o.can(a, e)), u = (Array.isArray(e.fields) ? e.fields : []).map((e) => typeof e == "string" ? { name: e } : {
|
|
2954
2994
|
name: e?.name,
|
|
2955
2995
|
label: e?.label,
|
|
2956
2996
|
icon: e?.icon,
|
|
2957
2997
|
type: e?.type
|
|
2958
2998
|
}).filter((e) => typeof e.name == "string" && e.name.length > 0), f = e.enforceFieldSecurity === !0, p = Array.isArray(e.redactFields) ? e.redactFields : [], m = f && a ? new Set(s(u.map((e) => e.name))) : null, h = u.filter((e) => !(p.includes(e.name) || m && !m.has(e.name)));
|
|
2959
|
-
return
|
|
2999
|
+
return kt(d.useId(), l ? h.map((e) => e.name) : []), l ? /* @__PURE__ */ Z("div", {
|
|
2960
3000
|
className: t,
|
|
2961
3001
|
...i,
|
|
2962
|
-
children: /* @__PURE__ */ Z(
|
|
3002
|
+
children: /* @__PURE__ */ Z(Bn, {
|
|
2963
3003
|
fields: h,
|
|
2964
3004
|
data: r?.data,
|
|
2965
3005
|
objectName: r?.objectName,
|
|
@@ -2976,10 +3016,10 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2976
3016
|
children: "Insufficient permissions to view highlights."
|
|
2977
3017
|
})
|
|
2978
3018
|
});
|
|
2979
|
-
},
|
|
3019
|
+
}, Er = ({ change: e, className: t }) => {
|
|
2980
3020
|
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));
|
|
2981
3021
|
return /* @__PURE__ */ Q("div", {
|
|
2982
|
-
className:
|
|
3022
|
+
className: W("flex items-center gap-1.5 text-sm flex-wrap", t),
|
|
2983
3023
|
children: [
|
|
2984
3024
|
/* @__PURE__ */ Z("span", {
|
|
2985
3025
|
className: "font-medium text-foreground",
|
|
@@ -2996,22 +3036,22 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
2996
3036
|
})
|
|
2997
3037
|
]
|
|
2998
3038
|
});
|
|
2999
|
-
},
|
|
3039
|
+
}, Dr = [
|
|
3000
3040
|
"👍",
|
|
3001
3041
|
"❤️",
|
|
3002
3042
|
"🎉",
|
|
3003
3043
|
"😂",
|
|
3004
3044
|
"😮",
|
|
3005
3045
|
"😢"
|
|
3006
|
-
],
|
|
3046
|
+
], Or = ({ reactions: e, onToggleReaction: t, emojiOptions: n = Dr, className: r }) => {
|
|
3007
3047
|
let [i, a] = u.useState(!1), o = u.useCallback((e) => {
|
|
3008
3048
|
t?.(e), a(!1);
|
|
3009
3049
|
}, [t]);
|
|
3010
3050
|
return /* @__PURE__ */ Q("div", {
|
|
3011
|
-
className:
|
|
3051
|
+
className: W("flex items-center gap-1 flex-wrap", r),
|
|
3012
3052
|
children: [e.map((e) => /* @__PURE__ */ Q("button", {
|
|
3013
3053
|
type: "button",
|
|
3014
|
-
className:
|
|
3054
|
+
className: W("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs border transition-colors", e.reacted ? "bg-primary/10 border-primary/30 text-primary" : "bg-muted border-border text-muted-foreground hover:bg-muted/80"),
|
|
3015
3055
|
onClick: () => o(e.emoji),
|
|
3016
3056
|
disabled: !t,
|
|
3017
3057
|
"aria-label": `${e.emoji} ${e.count} reaction${e.count === 1 ? "" : "s"}`,
|
|
@@ -3024,7 +3064,7 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
3024
3064
|
className: "h-6 w-6",
|
|
3025
3065
|
onClick: () => a(!i),
|
|
3026
3066
|
"aria-label": "Add reaction",
|
|
3027
|
-
children: /* @__PURE__ */ Z(
|
|
3067
|
+
children: /* @__PURE__ */ Z(lt, { className: "h-3.5 w-3.5" })
|
|
3028
3068
|
}), i && /* @__PURE__ */ Z("div", {
|
|
3029
3069
|
className: "absolute bottom-full mb-1 left-0 bg-popover border rounded-md shadow-md z-50 p-1.5 flex gap-1",
|
|
3030
3070
|
role: "listbox",
|
|
@@ -3043,7 +3083,7 @@ var dr = ({ schema: e, dataSource: n, className: r, onEdit: i, onDelete: a, onBa
|
|
|
3043
3083
|
};
|
|
3044
3084
|
//#endregion
|
|
3045
3085
|
//#region src/ThreadedReplies.tsx
|
|
3046
|
-
function
|
|
3086
|
+
function kr(e, t) {
|
|
3047
3087
|
try {
|
|
3048
3088
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
3049
3089
|
if (i < 1) return t("detail.justNow");
|
|
@@ -3056,7 +3096,7 @@ function Tr(e, t) {
|
|
|
3056
3096
|
return e;
|
|
3057
3097
|
}
|
|
3058
3098
|
}
|
|
3059
|
-
var
|
|
3099
|
+
var Ar = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, className: i }) => {
|
|
3060
3100
|
let { t: a } = $(), [o, s] = u.useState(!1), [c, l] = u.useState(""), [d, f] = u.useState(!1), p = u.useCallback(async () => {
|
|
3061
3101
|
let t = c.trim();
|
|
3062
3102
|
if (!(!t || !n)) {
|
|
@@ -3075,7 +3115,7 @@ var Er = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3075
3115
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), p());
|
|
3076
3116
|
}, [p]);
|
|
3077
3117
|
return t.length === 0 && !r ? null : /* @__PURE__ */ Q("div", {
|
|
3078
|
-
className:
|
|
3118
|
+
className: W("ml-10 mt-1", i),
|
|
3079
3119
|
children: [
|
|
3080
3120
|
t.length > 0 && /* @__PURE__ */ Q("button", {
|
|
3081
3121
|
type: "button",
|
|
@@ -3084,7 +3124,7 @@ var Er = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3084
3124
|
"aria-expanded": o,
|
|
3085
3125
|
children: [
|
|
3086
3126
|
Z(o ? Te : De, { className: "h-3 w-3" }),
|
|
3087
|
-
/* @__PURE__ */ Z(
|
|
3127
|
+
/* @__PURE__ */ Z(Je, { className: "h-3 w-3" }),
|
|
3088
3128
|
/* @__PURE__ */ Z("span", { children: t.length === 1 ? a("detail.replyCount", { count: t.length }) : a("detail.replyCountPlural", { count: t.length }) })
|
|
3089
3129
|
]
|
|
3090
3130
|
}),
|
|
@@ -3111,7 +3151,7 @@ var Er = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3111
3151
|
children: e.actor
|
|
3112
3152
|
}), /* @__PURE__ */ Z("span", {
|
|
3113
3153
|
className: "text-[10px] text-muted-foreground",
|
|
3114
|
-
children:
|
|
3154
|
+
children: kr(e.createdAt, a)
|
|
3115
3155
|
})]
|
|
3116
3156
|
}), /* @__PURE__ */ Z("p", {
|
|
3117
3157
|
className: "text-xs whitespace-pre-wrap break-words",
|
|
@@ -3136,12 +3176,12 @@ var Er = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3136
3176
|
onClick: p,
|
|
3137
3177
|
disabled: !c.trim() || d,
|
|
3138
3178
|
"aria-label": "Send reply",
|
|
3139
|
-
children: /* @__PURE__ */ Z(
|
|
3179
|
+
children: /* @__PURE__ */ Z(st, { className: "h-3 w-3" })
|
|
3140
3180
|
})]
|
|
3141
3181
|
})
|
|
3142
3182
|
]
|
|
3143
3183
|
});
|
|
3144
|
-
},
|
|
3184
|
+
}, jr = ({ subscription: e, onToggle: t, className: n }) => {
|
|
3145
3185
|
let { t: r } = $(), [i, a] = u.useState(!1), o = u.useCallback(async () => {
|
|
3146
3186
|
if (t) {
|
|
3147
3187
|
a(!0);
|
|
@@ -3155,7 +3195,7 @@ var Er = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3155
3195
|
return /* @__PURE__ */ Z(D, {
|
|
3156
3196
|
variant: "ghost",
|
|
3157
3197
|
size: "icon",
|
|
3158
|
-
className:
|
|
3198
|
+
className: W("h-8 w-8", n),
|
|
3159
3199
|
onClick: o,
|
|
3160
3200
|
disabled: i || !t,
|
|
3161
3201
|
"aria-label": e.subscribed ? r("detail.unsubscribeAriaLabel") : r("detail.subscribeAriaLabel"),
|
|
@@ -3165,11 +3205,11 @@ var Er = ({ parentItem: e, replies: t, onAddReply: n, showReplyInput: r = !0, cl
|
|
|
3165
3205
|
};
|
|
3166
3206
|
//#endregion
|
|
3167
3207
|
//#region src/RichTextCommentInput.tsx
|
|
3168
|
-
function
|
|
3208
|
+
function Mr(e) {
|
|
3169
3209
|
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/>");
|
|
3170
3210
|
return t = t.replace(/(<li[^>]*>.*?<\/li>(?:<br\/>)?)+/g, (e) => `<ul class="my-1">${e.replace(/<br\/>/g, "")}</ul>`), t;
|
|
3171
3211
|
}
|
|
3172
|
-
var
|
|
3212
|
+
var Nr = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], placeholder: i, className: a, disabled: o = !1, extraSlot: s, canSubmitEmpty: c = !1 }) => {
|
|
3173
3213
|
let { t: l } = $(), [d, f] = u.useState(!1), [p, m] = u.useState(!1), [h, g] = u.useState(""), [_, v] = u.useState(0), y = u.useRef(null), b = u.useMemo(() => {
|
|
3174
3214
|
if (!h) return r;
|
|
3175
3215
|
let e = h.toLowerCase();
|
|
@@ -3230,7 +3270,7 @@ var kr = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3230
3270
|
n
|
|
3231
3271
|
]);
|
|
3232
3272
|
return /* @__PURE__ */ Q("div", {
|
|
3233
|
-
className:
|
|
3273
|
+
className: W("border rounded-md", a),
|
|
3234
3274
|
children: [
|
|
3235
3275
|
/* @__PURE__ */ Q("div", {
|
|
3236
3276
|
className: "flex items-center gap-0.5 px-2 py-1.5 border-b bg-muted/30",
|
|
@@ -3251,7 +3291,7 @@ var kr = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3251
3291
|
onClick: C,
|
|
3252
3292
|
disabled: o || d,
|
|
3253
3293
|
title: l("detail.italic"),
|
|
3254
|
-
children: /* @__PURE__ */ Z(
|
|
3294
|
+
children: /* @__PURE__ */ Z(X, { className: "h-3.5 w-3.5" })
|
|
3255
3295
|
}),
|
|
3256
3296
|
/* @__PURE__ */ Z(D, {
|
|
3257
3297
|
variant: "ghost",
|
|
@@ -3260,7 +3300,7 @@ var kr = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3260
3300
|
onClick: w,
|
|
3261
3301
|
disabled: o || d,
|
|
3262
3302
|
title: l("detail.listFormat"),
|
|
3263
|
-
children: /* @__PURE__ */ Z(
|
|
3303
|
+
children: /* @__PURE__ */ Z(We, { className: "h-3.5 w-3.5" })
|
|
3264
3304
|
}),
|
|
3265
3305
|
/* @__PURE__ */ Z(D, {
|
|
3266
3306
|
variant: "ghost",
|
|
@@ -3269,7 +3309,7 @@ var kr = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3269
3309
|
onClick: T,
|
|
3270
3310
|
disabled: o || d,
|
|
3271
3311
|
title: l("detail.inlineCode"),
|
|
3272
|
-
children: /* @__PURE__ */ Z(
|
|
3312
|
+
children: /* @__PURE__ */ Z(Me, { className: "h-3.5 w-3.5" })
|
|
3273
3313
|
}),
|
|
3274
3314
|
/* @__PURE__ */ Z(D, {
|
|
3275
3315
|
variant: "ghost",
|
|
@@ -3287,7 +3327,7 @@ var kr = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3287
3327
|
className: "h-7 w-7",
|
|
3288
3328
|
onClick: () => f(!d),
|
|
3289
3329
|
title: l(d ? "detail.edit" : "detail.preview"),
|
|
3290
|
-
children: Z(d ?
|
|
3330
|
+
children: Z(d ? Fe : Le, { className: "h-3.5 w-3.5" })
|
|
3291
3331
|
}),
|
|
3292
3332
|
n && /* @__PURE__ */ Z(D, {
|
|
3293
3333
|
variant: "ghost",
|
|
@@ -3296,7 +3336,7 @@ var kr = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3296
3336
|
onClick: n,
|
|
3297
3337
|
disabled: o || !c && !e.trim(),
|
|
3298
3338
|
title: l("detail.submitComment"),
|
|
3299
|
-
children: /* @__PURE__ */ Z(
|
|
3339
|
+
children: /* @__PURE__ */ Z(st, { className: "h-3.5 w-3.5" })
|
|
3300
3340
|
})
|
|
3301
3341
|
]
|
|
3302
3342
|
}),
|
|
@@ -3304,8 +3344,8 @@ var kr = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3304
3344
|
className: "relative",
|
|
3305
3345
|
children: d ? /* @__PURE__ */ Z("div", {
|
|
3306
3346
|
className: "min-h-[80px] px-3 py-2 text-sm prose prose-sm max-w-none",
|
|
3307
|
-
dangerouslySetInnerHTML: { __html:
|
|
3308
|
-
}) : /* @__PURE__ */ Q(
|
|
3347
|
+
dangerouslySetInnerHTML: { __html: Mr(e) }
|
|
3348
|
+
}) : /* @__PURE__ */ Q(an, { children: [/* @__PURE__ */ Z("textarea", {
|
|
3309
3349
|
ref: y,
|
|
3310
3350
|
className: "w-full min-h-[80px] px-3 py-2 text-sm bg-transparent resize-none focus:outline-none placeholder:text-muted-foreground",
|
|
3311
3351
|
placeholder: i ?? l("detail.writeComment"),
|
|
@@ -3317,7 +3357,7 @@ var kr = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3317
3357
|
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",
|
|
3318
3358
|
children: b.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
3319
3359
|
type: "button",
|
|
3320
|
-
className:
|
|
3360
|
+
className: W("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === _ && "bg-accent"),
|
|
3321
3361
|
onMouseDown: (t) => {
|
|
3322
3362
|
t.preventDefault(), O(e);
|
|
3323
3363
|
},
|
|
@@ -3341,16 +3381,16 @@ var kr = ({ value: e, onChange: t, onSubmit: n, mentionSuggestions: r = [], plac
|
|
|
3341
3381
|
};
|
|
3342
3382
|
//#endregion
|
|
3343
3383
|
//#region src/CommentAttachment.tsx
|
|
3344
|
-
function
|
|
3384
|
+
function Pr(e) {
|
|
3345
3385
|
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
3346
3386
|
}
|
|
3347
|
-
function
|
|
3387
|
+
function Fr(e) {
|
|
3348
3388
|
return e.startsWith("image/");
|
|
3349
3389
|
}
|
|
3350
|
-
function
|
|
3351
|
-
return
|
|
3390
|
+
function Ir(e) {
|
|
3391
|
+
return Fr(e) ? Y : e.includes("pdf") || e.includes("document") || e.includes("text") ? J : e.includes("zip") || e.includes("archive") || e.includes("compressed") ? Be : ze;
|
|
3352
3392
|
}
|
|
3353
|
-
var
|
|
3393
|
+
var Lr = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: i = !1 }) => {
|
|
3354
3394
|
let { t: a } = $(), [o, s] = u.useState(!1), c = u.useRef(null), l = u.useCallback((e) => {
|
|
3355
3395
|
e.preventDefault(), e.stopPropagation(), s(!0);
|
|
3356
3396
|
}, []), d = u.useCallback((e) => {
|
|
@@ -3361,9 +3401,9 @@ var Nr = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: i
|
|
|
3361
3401
|
t && e.target.files && e.target.files.length > 0 && (t(e.target.files), e.target.value = "");
|
|
3362
3402
|
}, [t]);
|
|
3363
3403
|
return /* @__PURE__ */ Q("div", {
|
|
3364
|
-
className:
|
|
3404
|
+
className: W("space-y-2", r),
|
|
3365
3405
|
children: [t && !i && /* @__PURE__ */ Q("div", {
|
|
3366
|
-
className:
|
|
3406
|
+
className: W("border-2 border-dashed rounded-md px-4 py-3 text-center transition-colors cursor-pointer", o ? "border-primary bg-primary/5" : "border-muted-foreground/25 hover:border-muted-foreground/40"),
|
|
3367
3407
|
onDragOver: l,
|
|
3368
3408
|
onDragLeave: d,
|
|
3369
3409
|
onDrop: f,
|
|
@@ -3374,7 +3414,7 @@ var Nr = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: i
|
|
|
3374
3414
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), c.current?.click());
|
|
3375
3415
|
},
|
|
3376
3416
|
children: [
|
|
3377
|
-
/* @__PURE__ */ Z(
|
|
3417
|
+
/* @__PURE__ */ Z(pt, { className: "h-5 w-5 mx-auto text-muted-foreground mb-1" }),
|
|
3378
3418
|
/* @__PURE__ */ Z("p", {
|
|
3379
3419
|
className: "text-xs text-muted-foreground",
|
|
3380
3420
|
children: a("detail.dropFilesToUpload")
|
|
@@ -3391,11 +3431,11 @@ var Nr = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: i
|
|
|
3391
3431
|
className: "space-y-1.5",
|
|
3392
3432
|
children: [/* @__PURE__ */ Q("div", {
|
|
3393
3433
|
className: "flex items-center gap-1.5 text-xs text-muted-foreground",
|
|
3394
|
-
children: [/* @__PURE__ */ Z(
|
|
3434
|
+
children: [/* @__PURE__ */ Z(Qe, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", { children: e.length === 1 ? a("detail.attachmentCount", { count: e.length }) : a("detail.attachmentCountPlural", { count: e.length }) })]
|
|
3395
3435
|
}), /* @__PURE__ */ Z("div", {
|
|
3396
3436
|
className: "grid grid-cols-1 sm:grid-cols-2 gap-2",
|
|
3397
3437
|
children: e.map((e) => {
|
|
3398
|
-
let t =
|
|
3438
|
+
let t = Fr(e.type), r = Ir(e.type);
|
|
3399
3439
|
return /* @__PURE__ */ Q("div", {
|
|
3400
3440
|
className: "flex items-center gap-2 rounded-md border px-2.5 py-2 bg-muted/30 group",
|
|
3401
3441
|
children: [
|
|
@@ -3414,7 +3454,7 @@ var Nr = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: i
|
|
|
3414
3454
|
children: e.name
|
|
3415
3455
|
}), /* @__PURE__ */ Z("p", {
|
|
3416
3456
|
className: "text-[10px] text-muted-foreground",
|
|
3417
|
-
children:
|
|
3457
|
+
children: Pr(e.size)
|
|
3418
3458
|
})]
|
|
3419
3459
|
}),
|
|
3420
3460
|
n && !i && /* @__PURE__ */ Z(D, {
|
|
@@ -3423,7 +3463,7 @@ var Nr = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: i
|
|
|
3423
3463
|
className: "h-6 w-6 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
3424
3464
|
onClick: () => n(e.id),
|
|
3425
3465
|
title: a("detail.removeAttachment"),
|
|
3426
|
-
children: /* @__PURE__ */ Z(
|
|
3466
|
+
children: /* @__PURE__ */ Z(mt, { className: "h-3.5 w-3.5" })
|
|
3427
3467
|
})
|
|
3428
3468
|
]
|
|
3429
3469
|
}, e.id);
|
|
@@ -3431,21 +3471,21 @@ var Nr = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: i
|
|
|
3431
3471
|
})]
|
|
3432
3472
|
})]
|
|
3433
3473
|
});
|
|
3434
|
-
},
|
|
3435
|
-
comment:
|
|
3436
|
-
field_change:
|
|
3474
|
+
}, Rr = {
|
|
3475
|
+
comment: Je,
|
|
3476
|
+
field_change: Fe,
|
|
3437
3477
|
task: we,
|
|
3438
3478
|
event: Ce,
|
|
3439
|
-
system:
|
|
3440
|
-
email:
|
|
3441
|
-
call:
|
|
3442
|
-
note:
|
|
3443
|
-
file:
|
|
3444
|
-
sharing:
|
|
3445
|
-
record_create:
|
|
3446
|
-
record_delete:
|
|
3479
|
+
system: ht,
|
|
3480
|
+
email: qe,
|
|
3481
|
+
call: et,
|
|
3482
|
+
note: dt,
|
|
3483
|
+
file: J,
|
|
3484
|
+
sharing: ct,
|
|
3485
|
+
record_create: rt,
|
|
3486
|
+
record_delete: ft,
|
|
3447
3487
|
approval: ye
|
|
3448
|
-
},
|
|
3488
|
+
}, zr = {
|
|
3449
3489
|
comment: "bg-purple-100 text-purple-600",
|
|
3450
3490
|
field_change: "bg-blue-100 text-blue-600",
|
|
3451
3491
|
task: "bg-green-100 text-green-600",
|
|
@@ -3460,7 +3500,7 @@ var Nr = ({ attachments: e, onUpload: t, onRemove: n, className: r, readOnly: i
|
|
|
3460
3500
|
record_delete: "bg-red-100 text-red-600",
|
|
3461
3501
|
approval: "bg-violet-100 text-violet-600"
|
|
3462
3502
|
};
|
|
3463
|
-
function
|
|
3503
|
+
function Br(e) {
|
|
3464
3504
|
return [
|
|
3465
3505
|
{
|
|
3466
3506
|
value: "all",
|
|
@@ -3480,7 +3520,7 @@ function Ir(e) {
|
|
|
3480
3520
|
}
|
|
3481
3521
|
];
|
|
3482
3522
|
}
|
|
3483
|
-
function
|
|
3523
|
+
function Vr(e, t) {
|
|
3484
3524
|
try {
|
|
3485
3525
|
let n = new Date(e), r = (/* @__PURE__ */ new Date()).getTime() - n.getTime(), i = Math.floor(r / 6e4);
|
|
3486
3526
|
if (i < 1) return t("detail.justNow");
|
|
@@ -3493,7 +3533,7 @@ function Lr(e, t) {
|
|
|
3493
3533
|
return e;
|
|
3494
3534
|
}
|
|
3495
3535
|
}
|
|
3496
|
-
function
|
|
3536
|
+
function Hr(e, t) {
|
|
3497
3537
|
switch (t) {
|
|
3498
3538
|
case "comments_only": return e.filter((e) => e.type === "comment");
|
|
3499
3539
|
case "changes_only": return e.filter((e) => e.type === "field_change");
|
|
@@ -3501,18 +3541,18 @@ function Rr(e, t) {
|
|
|
3501
3541
|
default: return e;
|
|
3502
3542
|
}
|
|
3503
3543
|
}
|
|
3504
|
-
var
|
|
3505
|
-
let { t: y } = $(), [b, x] = u.useState("all"), [S, C] = u.useState(""), [w, T] = u.useState(!1), [E, O] = u.useState(!1), [k, A] = u.useState([]), [j, M] = u.useState(!1),
|
|
3506
|
-
if (!
|
|
3544
|
+
var Ur = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i = !1, onLoadMore: a, loading: o = !1, onAddComment: s, onAddReply: c, onToggleReaction: l, subscription: d, onToggleSubscription: f, collapseWhenEmpty: p = !1, mentionSuggestions: m, onUploadAttachments: h, titleLabel: g, emptyLabel: _, className: v }) => {
|
|
3545
|
+
let { t: y } = $(), [b, x] = u.useState("all"), [S, C] = u.useState(""), [w, T] = u.useState(!1), [E, O] = u.useState(!1), [k, A] = u.useState([]), [j, M] = u.useState(!1), N = n ?? b, ee = t?.showFilterToggle !== !1, ne = t?.showCommentInput !== !1 && !!s, re = t?.enableReactions ?? !1, F = t?.enableThreading ?? !1, ce = t?.showSubscriptionToggle ?? !1, I = u.useMemo(() => Hr(e, N), [e, N]), le = u.useMemo(() => F ? I.filter((e) => !e.parentId) : I, [I, F]), L = u.useMemo(() => {
|
|
3546
|
+
if (!F) return /* @__PURE__ */ new Map();
|
|
3507
3547
|
let e = /* @__PURE__ */ new Map();
|
|
3508
|
-
for (let t of
|
|
3548
|
+
for (let t of I) if (t.parentId) {
|
|
3509
3549
|
let n = e.get(t.parentId) ?? [];
|
|
3510
3550
|
n.push(t), e.set(t.parentId, n);
|
|
3511
3551
|
}
|
|
3512
3552
|
return e;
|
|
3513
|
-
}, [
|
|
3553
|
+
}, [I, F]), R = u.useCallback((e) => {
|
|
3514
3554
|
r ? r(e) : x(e);
|
|
3515
|
-
}, [r]),
|
|
3555
|
+
}, [r]), ue = u.useCallback(async () => {
|
|
3516
3556
|
let e = S.trim();
|
|
3517
3557
|
if (s && !(!e && k.length === 0)) {
|
|
3518
3558
|
T(!0);
|
|
@@ -3526,7 +3566,7 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3526
3566
|
S,
|
|
3527
3567
|
k,
|
|
3528
3568
|
s
|
|
3529
|
-
]),
|
|
3569
|
+
]), z = u.useCallback(async (e) => {
|
|
3530
3570
|
if (!(!h || e.length === 0)) {
|
|
3531
3571
|
M(!0);
|
|
3532
3572
|
try {
|
|
@@ -3536,9 +3576,9 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3536
3576
|
M(!1);
|
|
3537
3577
|
}
|
|
3538
3578
|
}
|
|
3539
|
-
}, [h]),
|
|
3579
|
+
}, [h]), de = u.useCallback((e) => {
|
|
3540
3580
|
A((t) => t.filter((t) => t.id !== e));
|
|
3541
|
-
}, []),
|
|
3581
|
+
}, []), B = u.useCallback(async () => {
|
|
3542
3582
|
if (a) {
|
|
3543
3583
|
O(!0);
|
|
3544
3584
|
try {
|
|
@@ -3549,7 +3589,7 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3549
3589
|
}
|
|
3550
3590
|
}, [a]);
|
|
3551
3591
|
return /* @__PURE__ */ Q("section", {
|
|
3552
|
-
className:
|
|
3592
|
+
className: W("border-t border-border/60 pt-5", v),
|
|
3553
3593
|
"aria-label": "Discussion",
|
|
3554
3594
|
children: [/* @__PURE__ */ Z("header", {
|
|
3555
3595
|
className: "mb-4",
|
|
@@ -3558,20 +3598,20 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3558
3598
|
children: [/* @__PURE__ */ Q("h2", {
|
|
3559
3599
|
className: "flex items-center gap-2 text-base font-semibold leading-none tracking-tight",
|
|
3560
3600
|
children: [
|
|
3561
|
-
/* @__PURE__ */ Z(
|
|
3601
|
+
/* @__PURE__ */ Z(me, { className: "h-4 w-4" }),
|
|
3562
3602
|
g ?? y("detail.activity"),
|
|
3563
3603
|
/* @__PURE__ */ Q("span", {
|
|
3564
3604
|
className: "text-sm font-normal text-muted-foreground",
|
|
3565
3605
|
children: [
|
|
3566
3606
|
"(",
|
|
3567
|
-
|
|
3607
|
+
I.length,
|
|
3568
3608
|
")"
|
|
3569
3609
|
]
|
|
3570
3610
|
})
|
|
3571
3611
|
]
|
|
3572
3612
|
}), /* @__PURE__ */ Z("div", {
|
|
3573
3613
|
className: "flex items-center gap-1",
|
|
3574
|
-
children:
|
|
3614
|
+
children: ce && d && /* @__PURE__ */ Z(jr, {
|
|
3575
3615
|
subscription: d,
|
|
3576
3616
|
onToggle: f
|
|
3577
3617
|
})
|
|
@@ -3580,53 +3620,59 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3580
3620
|
}), /* @__PURE__ */ Q("div", {
|
|
3581
3621
|
className: "space-y-4",
|
|
3582
3622
|
children: [
|
|
3583
|
-
|
|
3623
|
+
ee && /* @__PURE__ */ Z("div", {
|
|
3584
3624
|
className: "flex items-center gap-2",
|
|
3585
|
-
children: /* @__PURE__ */ Q(
|
|
3586
|
-
value:
|
|
3587
|
-
onValueChange: (e) =>
|
|
3588
|
-
children: [/* @__PURE__ */ Z(
|
|
3625
|
+
children: /* @__PURE__ */ Q(ie, {
|
|
3626
|
+
value: N,
|
|
3627
|
+
onValueChange: (e) => R(e),
|
|
3628
|
+
children: [/* @__PURE__ */ Z(oe, {
|
|
3589
3629
|
"aria-label": y("detail.filterActivity"),
|
|
3590
3630
|
className: "h-8 w-auto min-w-[140px] py-1 text-sm",
|
|
3591
|
-
children: /* @__PURE__ */ Z(
|
|
3592
|
-
}), /* @__PURE__ */ Z(
|
|
3631
|
+
children: /* @__PURE__ */ Z(se, {})
|
|
3632
|
+
}), /* @__PURE__ */ Z(P, { children: Br(y).map((e) => /* @__PURE__ */ Z(ae, {
|
|
3593
3633
|
value: e.value,
|
|
3594
3634
|
children: e.label
|
|
3595
3635
|
}, e.value)) })]
|
|
3596
3636
|
})
|
|
3597
3637
|
}),
|
|
3598
|
-
|
|
3638
|
+
ne && /* @__PURE__ */ Z(Nr, {
|
|
3599
3639
|
value: S,
|
|
3600
3640
|
onChange: C,
|
|
3601
|
-
onSubmit:
|
|
3641
|
+
onSubmit: ue,
|
|
3602
3642
|
mentionSuggestions: m,
|
|
3603
3643
|
placeholder: y("detail.leaveCommentPlaceholder"),
|
|
3604
3644
|
disabled: w,
|
|
3605
3645
|
canSubmitEmpty: k.length > 0,
|
|
3606
|
-
extraSlot: h ? /* @__PURE__ */ Z(
|
|
3646
|
+
extraSlot: h ? /* @__PURE__ */ Z(Lr, {
|
|
3607
3647
|
attachments: k,
|
|
3608
|
-
onUpload:
|
|
3609
|
-
onRemove:
|
|
3648
|
+
onUpload: z,
|
|
3649
|
+
onRemove: de,
|
|
3610
3650
|
readOnly: w || j
|
|
3611
|
-
}) : k.length > 0 ? /* @__PURE__ */ Z(
|
|
3651
|
+
}) : k.length > 0 ? /* @__PURE__ */ Z(Lr, {
|
|
3612
3652
|
attachments: k,
|
|
3613
|
-
onRemove:
|
|
3653
|
+
onRemove: de,
|
|
3614
3654
|
readOnly: w
|
|
3615
3655
|
}) : void 0
|
|
3616
3656
|
}),
|
|
3617
|
-
|
|
3657
|
+
o && I.length === 0 ? /* @__PURE__ */ Q("div", {
|
|
3658
|
+
role: "status",
|
|
3659
|
+
"aria-live": "polite",
|
|
3660
|
+
"data-testid": "activity-loading",
|
|
3661
|
+
className: "flex items-center justify-center gap-2 py-6 text-sm text-muted-foreground",
|
|
3662
|
+
children: [/* @__PURE__ */ Z(Ge, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Z("span", { children: y("detail.loading") })]
|
|
3663
|
+
}) : I.length === 0 ? p ? null : /* @__PURE__ */ Z(te, {
|
|
3618
3664
|
title: _ ?? y("detail.noActivity"),
|
|
3619
3665
|
className: "py-6"
|
|
3620
3666
|
}) : /* @__PURE__ */ Q("div", {
|
|
3621
3667
|
className: "relative",
|
|
3622
3668
|
children: [/* @__PURE__ */ Z("div", { className: "absolute left-4 top-2 bottom-2 w-px bg-border" }), /* @__PURE__ */ Z("div", {
|
|
3623
3669
|
className: "space-y-4",
|
|
3624
|
-
children:
|
|
3625
|
-
let t =
|
|
3670
|
+
children: le.map((e) => {
|
|
3671
|
+
let t = Rr[e.type] || ht, n = zr[e.type] || "bg-gray-100 text-gray-600", r = L.get(e.id) ?? [];
|
|
3626
3672
|
return /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("div", {
|
|
3627
3673
|
className: "flex gap-3 relative",
|
|
3628
3674
|
children: [/* @__PURE__ */ Z("div", {
|
|
3629
|
-
className:
|
|
3675
|
+
className: W("shrink-0 h-8 w-8 rounded-full flex items-center justify-center z-10", n),
|
|
3630
3676
|
children: e.actorAvatarUrl ? /* @__PURE__ */ Z("img", {
|
|
3631
3677
|
src: e.actorAvatarUrl,
|
|
3632
3678
|
alt: e.actor,
|
|
@@ -3648,7 +3694,7 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3648
3694
|
}),
|
|
3649
3695
|
/* @__PURE__ */ Z("span", {
|
|
3650
3696
|
className: "text-xs text-muted-foreground",
|
|
3651
|
-
children:
|
|
3697
|
+
children: Vr(e.createdAt, y)
|
|
3652
3698
|
}),
|
|
3653
3699
|
e.edited && /* @__PURE__ */ Z("span", {
|
|
3654
3700
|
className: "text-xs text-muted-foreground italic",
|
|
@@ -3675,25 +3721,25 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3675
3721
|
}),
|
|
3676
3722
|
e.type === "field_change" && e.fieldChanges && /* @__PURE__ */ Z("div", {
|
|
3677
3723
|
className: "space-y-1 mt-1",
|
|
3678
|
-
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(
|
|
3724
|
+
children: e.fieldChanges.map((e, t) => /* @__PURE__ */ Z(Er, { change: e }, t))
|
|
3679
3725
|
}),
|
|
3680
|
-
|
|
3726
|
+
re && e.reactions && e.reactions.length > 0 && /* @__PURE__ */ Z("div", {
|
|
3681
3727
|
className: "mt-1.5",
|
|
3682
|
-
children: /* @__PURE__ */ Z(
|
|
3728
|
+
children: /* @__PURE__ */ Z(Or, {
|
|
3683
3729
|
reactions: e.reactions,
|
|
3684
3730
|
onToggleReaction: l ? (t) => l(e.id, t) : void 0
|
|
3685
3731
|
})
|
|
3686
3732
|
}),
|
|
3687
|
-
|
|
3733
|
+
re && (!e.reactions || e.reactions.length === 0) && l && /* @__PURE__ */ Z("div", {
|
|
3688
3734
|
className: "mt-1.5",
|
|
3689
|
-
children: /* @__PURE__ */ Z(
|
|
3735
|
+
children: /* @__PURE__ */ Z(Or, {
|
|
3690
3736
|
reactions: [],
|
|
3691
3737
|
onToggleReaction: (t) => l(e.id, t)
|
|
3692
3738
|
})
|
|
3693
3739
|
})
|
|
3694
3740
|
]
|
|
3695
3741
|
})]
|
|
3696
|
-
}),
|
|
3742
|
+
}), F && (e.replyCount ?? 0) > 0 && /* @__PURE__ */ Z(Ar, {
|
|
3697
3743
|
parentItem: e,
|
|
3698
3744
|
replies: r,
|
|
3699
3745
|
onAddReply: c,
|
|
@@ -3707,16 +3753,83 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3707
3753
|
children: /* @__PURE__ */ Q(D, {
|
|
3708
3754
|
variant: "ghost",
|
|
3709
3755
|
size: "sm",
|
|
3710
|
-
onClick:
|
|
3756
|
+
onClick: B,
|
|
3711
3757
|
disabled: E,
|
|
3712
3758
|
"aria-label": y("detail.loadMore"),
|
|
3713
|
-
children: [E ? /* @__PURE__ */ Z(
|
|
3759
|
+
children: [E ? /* @__PURE__ */ Z(Ge, { className: "h-4 w-4 animate-spin mr-1" }) : /* @__PURE__ */ Z(Te, { className: "h-4 w-4 mr-1" }), y("detail.loadMore")]
|
|
3714
3760
|
})
|
|
3715
3761
|
})
|
|
3716
3762
|
]
|
|
3717
3763
|
})]
|
|
3718
3764
|
});
|
|
3719
|
-
},
|
|
3765
|
+
}, Wr = fn.options, Gr = pn.options, Kr = {
|
|
3766
|
+
created: "field_change",
|
|
3767
|
+
updated: "field_change",
|
|
3768
|
+
deleted: "field_change",
|
|
3769
|
+
assigned: "field_change",
|
|
3770
|
+
shared: "field_change",
|
|
3771
|
+
system: "system",
|
|
3772
|
+
completed: "task",
|
|
3773
|
+
commented: void 0,
|
|
3774
|
+
mentioned: void 0,
|
|
3775
|
+
login: void 0,
|
|
3776
|
+
logout: void 0
|
|
3777
|
+
}, qr = /* @__PURE__ */ new Set(["task"]);
|
|
3778
|
+
function Jr(e) {
|
|
3779
|
+
return typeof e == "string" && Wr.includes(e) ? e : "all";
|
|
3780
|
+
}
|
|
3781
|
+
function Yr(e) {
|
|
3782
|
+
if (!Array.isArray(e)) return;
|
|
3783
|
+
let t = e.filter((e) => typeof e == "string" && Gr.includes(e));
|
|
3784
|
+
return t.length > 0 ? t : void 0;
|
|
3785
|
+
}
|
|
3786
|
+
function Xr(e) {
|
|
3787
|
+
let t = Math.floor(Number(e));
|
|
3788
|
+
return Number.isFinite(t) && t > 0 ? t : 20;
|
|
3789
|
+
}
|
|
3790
|
+
function Zr(e) {
|
|
3791
|
+
let t = e.timestamp;
|
|
3792
|
+
return String(!t || t === "NOW()" || Number.isNaN(Date.parse(String(t))) ? e.created_at ?? "" : t);
|
|
3793
|
+
}
|
|
3794
|
+
function Qr(e, t) {
|
|
3795
|
+
let n = Kr[String(e?.type)];
|
|
3796
|
+
return n ? {
|
|
3797
|
+
id: e.id,
|
|
3798
|
+
type: n,
|
|
3799
|
+
actor: e.actor_name ?? t,
|
|
3800
|
+
actorAvatarUrl: e.actor_avatar_url ?? void 0,
|
|
3801
|
+
body: e.summary ?? "",
|
|
3802
|
+
createdAt: Zr(e),
|
|
3803
|
+
sourceObject: e.source_object ?? void 0,
|
|
3804
|
+
sourceId: e.source_id ?? void 0
|
|
3805
|
+
} : null;
|
|
3806
|
+
}
|
|
3807
|
+
function $r(e, t, n) {
|
|
3808
|
+
let r = e.slice();
|
|
3809
|
+
t.unifiedTimeline === !1 && (r = r.filter((e) => e.type !== "field_change")), t.showCompleted !== !0 && (r = r.filter((e) => !qr.has(e.type)));
|
|
3810
|
+
let i = Yr(t.types);
|
|
3811
|
+
if (i) {
|
|
3812
|
+
let e = new Set(i);
|
|
3813
|
+
r = r.filter((t) => e.has(t.type));
|
|
3814
|
+
}
|
|
3815
|
+
let a = r.length, o = Math.max(1, Math.floor(n) || 20);
|
|
3816
|
+
return {
|
|
3817
|
+
items: a > o ? r.slice(a - o) : r,
|
|
3818
|
+
total: a,
|
|
3819
|
+
hasMore: a > o
|
|
3820
|
+
};
|
|
3821
|
+
}
|
|
3822
|
+
function ei(...e) {
|
|
3823
|
+
let t = /* @__PURE__ */ new Map();
|
|
3824
|
+
for (let n of e) for (let e of n) t.set(String(e.id), e);
|
|
3825
|
+
return Array.from(t.values()).sort((e, t) => {
|
|
3826
|
+
let n = e.createdAt ? Date.parse(e.createdAt) : 0, r = t.createdAt ? Date.parse(t.createdAt) : 0;
|
|
3827
|
+
return (Number.isNaN(n) ? 0 : n) - (Number.isNaN(r) ? 0 : r);
|
|
3828
|
+
});
|
|
3829
|
+
}
|
|
3830
|
+
//#endregion
|
|
3831
|
+
//#region src/renderers/record-activity.tsx
|
|
3832
|
+
var ti = (e) => {
|
|
3720
3833
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3721
3834
|
return {
|
|
3722
3835
|
designer: {
|
|
@@ -3726,31 +3839,104 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3726
3839
|
},
|
|
3727
3840
|
rest: i
|
|
3728
3841
|
};
|
|
3729
|
-
},
|
|
3730
|
-
|
|
3731
|
-
|
|
3842
|
+
}, ni = ({ schema: e = {}, className: t, ...n }) => {
|
|
3843
|
+
let { designer: r } = ti(n), i = Ot(), a = wt(), o = tn(), s = e.properties ?? {}, c = (t) => e[t] ?? s[t], l = Xr(c("limit")), u = Jr(c("filterMode")), f = c("types"), p = c("showCompleted"), m = c("unifiedTimeline"), h = {
|
|
3844
|
+
types: f,
|
|
3845
|
+
filterMode: u,
|
|
3846
|
+
showFilterToggle: c("showFilterToggle"),
|
|
3847
|
+
limit: l,
|
|
3848
|
+
showCompleted: p,
|
|
3849
|
+
unifiedTimeline: m,
|
|
3850
|
+
showCommentInput: c("showCommentInput"),
|
|
3851
|
+
enableMentions: c("enableMentions"),
|
|
3852
|
+
enableReactions: c("enableReactions"),
|
|
3853
|
+
enableThreading: c("enableThreading"),
|
|
3854
|
+
showSubscriptionToggle: c("showSubscriptionToggle")
|
|
3855
|
+
}, g = Array.isArray(e.items) ? e.items : Array.isArray(s.items) ? s.items : void 0, _ = e.loading ?? s.loading, v = i?.objectName, y = i?.data?.id ?? i?.data?._id ?? i?.recordId, b = i?.dataSource, x = g === void 0 && !a && typeof b?.find == "function" && !!v && y != null, [S, C] = d.useState(0), w = l * (S + 1), [T, E] = d.useState(null), [D, O] = d.useState(!1), [k, A] = d.useState(!1), j = o("detail.systemActor", "System");
|
|
3856
|
+
d.useEffect(() => {
|
|
3857
|
+
if (!x) return;
|
|
3858
|
+
let e = !1;
|
|
3859
|
+
return A(!0), Promise.resolve(b.find("sys_activity", {
|
|
3860
|
+
$filter: {
|
|
3861
|
+
object_name: v,
|
|
3862
|
+
record_id: y
|
|
3863
|
+
},
|
|
3864
|
+
$orderby: { timestamp: "desc" },
|
|
3865
|
+
$top: Math.max(1, w) + 1
|
|
3866
|
+
})).then((t) => {
|
|
3867
|
+
if (e) return;
|
|
3868
|
+
let n = t?.data ?? t?.records ?? [], r = Array.isArray(n) ? n : [], i = [];
|
|
3869
|
+
for (let e of r) {
|
|
3870
|
+
let t = Qr(e, j);
|
|
3871
|
+
t && i.push(t);
|
|
3872
|
+
}
|
|
3873
|
+
O(r.length > Math.max(1, w)), E(ei(i));
|
|
3874
|
+
}).catch(() => {
|
|
3875
|
+
e || (E([]), O(!1));
|
|
3876
|
+
}).finally(() => {
|
|
3877
|
+
e || A(!1);
|
|
3878
|
+
}), () => {
|
|
3879
|
+
e = !0;
|
|
3880
|
+
};
|
|
3881
|
+
}, [
|
|
3882
|
+
x,
|
|
3883
|
+
b,
|
|
3884
|
+
v,
|
|
3885
|
+
y,
|
|
3886
|
+
w,
|
|
3887
|
+
j
|
|
3888
|
+
]);
|
|
3889
|
+
let M = a?.items, N = d.useMemo(() => $r(g ?? M ?? T ?? [], {
|
|
3890
|
+
types: f,
|
|
3891
|
+
showCompleted: p,
|
|
3892
|
+
unifiedTimeline: m
|
|
3893
|
+
}, w), [
|
|
3894
|
+
g,
|
|
3895
|
+
M,
|
|
3896
|
+
T,
|
|
3897
|
+
f,
|
|
3898
|
+
p,
|
|
3899
|
+
m,
|
|
3900
|
+
w
|
|
3901
|
+
]), ee = N.items, te = N.hasMore || x && D, ne = _ ?? a?.loading ?? (x && T === null ? !0 : k), [re, ie] = d.useState(u);
|
|
3902
|
+
d.useEffect(() => {
|
|
3903
|
+
ie(u);
|
|
3904
|
+
}, [u]);
|
|
3905
|
+
let P = d.useCallback(() => {
|
|
3906
|
+
C((e) => e + 1);
|
|
3907
|
+
}, []), ae = h.enableMentions !== !1;
|
|
3732
3908
|
return /* @__PURE__ */ Z("div", {
|
|
3733
3909
|
className: t,
|
|
3734
3910
|
...r,
|
|
3735
|
-
children: /* @__PURE__ */ Z(
|
|
3736
|
-
items:
|
|
3737
|
-
config:
|
|
3911
|
+
children: /* @__PURE__ */ Z(Ur, {
|
|
3912
|
+
items: ee,
|
|
3913
|
+
config: h,
|
|
3914
|
+
loading: ne,
|
|
3915
|
+
filterMode: re,
|
|
3916
|
+
onFilterChange: ie,
|
|
3917
|
+
hasMore: te,
|
|
3918
|
+
onLoadMore: P,
|
|
3919
|
+
onAddComment: a?.onAddComment,
|
|
3920
|
+
onAddReply: a?.onAddReply,
|
|
3921
|
+
onToggleReaction: a?.onToggleReaction,
|
|
3922
|
+
mentionSuggestions: ae ? a?.mentionSuggestions : void 0,
|
|
3923
|
+
onUploadAttachments: a?.onUploadAttachments
|
|
3738
3924
|
})
|
|
3739
3925
|
});
|
|
3740
|
-
},
|
|
3926
|
+
}, ri = ({ config: e, items: t, hasMore: n, onLoadMore: r, loading: i, onAddComment: a, onAddReply: o, onToggleReaction: s, subscription: c, onToggleSubscription: l, filterMode: d, onFilterChange: f, collapseWhenEmpty: p = !1, mentionSuggestions: m, onUploadAttachments: h, className: g }) => {
|
|
3741
3927
|
let _ = e?.position ?? "right", v = e?.width ?? "360px", y = e?.collapsible ?? !0, b = p && t.length === 0 || (e?.defaultCollapsed ?? !1), { t: x } = $(), [S, C] = u.useState(b);
|
|
3742
3928
|
return _ === "right" || _ === "left" ? S && y ? /* @__PURE__ */ Z("div", {
|
|
3743
|
-
className:
|
|
3929
|
+
className: W("flex items-start pt-4", _ === "right" ? "border-l" : "border-r", g),
|
|
3744
3930
|
children: /* @__PURE__ */ Z(D, {
|
|
3745
3931
|
variant: "ghost",
|
|
3746
3932
|
size: "icon",
|
|
3747
3933
|
className: "h-8 w-8 mx-1",
|
|
3748
3934
|
onClick: () => C(!1),
|
|
3749
3935
|
"aria-label": x("detail.openDiscussion"),
|
|
3750
|
-
children: /* @__PURE__ */ Z(
|
|
3936
|
+
children: /* @__PURE__ */ Z(Ze, { className: "h-4 w-4" })
|
|
3751
3937
|
})
|
|
3752
3938
|
}) : /* @__PURE__ */ Q("div", {
|
|
3753
|
-
className:
|
|
3939
|
+
className: W("flex flex-col overflow-hidden", _ === "right" ? "border-l" : "border-r", g),
|
|
3754
3940
|
style: {
|
|
3755
3941
|
width: v,
|
|
3756
3942
|
minWidth: v
|
|
@@ -3759,7 +3945,7 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3759
3945
|
className: "flex items-center justify-between px-4 py-3 border-b",
|
|
3760
3946
|
children: [/* @__PURE__ */ Q("div", {
|
|
3761
3947
|
className: "flex items-center gap-2",
|
|
3762
|
-
children: [/* @__PURE__ */ Z(
|
|
3948
|
+
children: [/* @__PURE__ */ Z(Je, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
3763
3949
|
className: "text-sm font-medium",
|
|
3764
3950
|
children: x("detail.discussion")
|
|
3765
3951
|
})]
|
|
@@ -3769,11 +3955,11 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3769
3955
|
className: "h-7 w-7",
|
|
3770
3956
|
onClick: () => C(!0),
|
|
3771
3957
|
"aria-label": x("detail.closeDiscussion"),
|
|
3772
|
-
children: /* @__PURE__ */ Z(
|
|
3958
|
+
children: /* @__PURE__ */ Z(mt, { className: "h-3.5 w-3.5" })
|
|
3773
3959
|
})]
|
|
3774
3960
|
}), /* @__PURE__ */ Z("div", {
|
|
3775
3961
|
className: "flex-1 overflow-y-auto",
|
|
3776
|
-
children: /* @__PURE__ */ Z(
|
|
3962
|
+
children: /* @__PURE__ */ Z(Ur, {
|
|
3777
3963
|
items: t,
|
|
3778
3964
|
config: e?.feed,
|
|
3779
3965
|
hasMore: n,
|
|
@@ -3795,27 +3981,27 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3795
3981
|
})
|
|
3796
3982
|
})]
|
|
3797
3983
|
}) : /* @__PURE__ */ Z("div", {
|
|
3798
|
-
className:
|
|
3984
|
+
className: W("", g),
|
|
3799
3985
|
children: y && S ? /* @__PURE__ */ Q(D, {
|
|
3800
3986
|
variant: "ghost",
|
|
3801
3987
|
className: "w-full justify-start gap-2 text-muted-foreground",
|
|
3802
3988
|
onClick: () => C(!1),
|
|
3803
3989
|
"aria-label": x("detail.showDiscussion", { count: t.length }),
|
|
3804
|
-
children: [/* @__PURE__ */ Z(
|
|
3990
|
+
children: [/* @__PURE__ */ Z(Je, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: x("detail.showDiscussion", { count: t.length }) })]
|
|
3805
3991
|
}) : /* @__PURE__ */ Q("div", { children: [y && /* @__PURE__ */ Q("div", {
|
|
3806
3992
|
className: "flex items-center justify-between mb-2",
|
|
3807
3993
|
children: [/* @__PURE__ */ Q("div", {
|
|
3808
3994
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
3809
|
-
children: [/* @__PURE__ */ Z(
|
|
3995
|
+
children: [/* @__PURE__ */ Z(Je, { className: "h-4 w-4" }), x("detail.discussion")]
|
|
3810
3996
|
}), /* @__PURE__ */ Z(D, {
|
|
3811
3997
|
variant: "ghost",
|
|
3812
3998
|
size: "icon",
|
|
3813
3999
|
className: "h-7 w-7",
|
|
3814
4000
|
onClick: () => C(!0),
|
|
3815
4001
|
"aria-label": x("detail.hideDiscussion"),
|
|
3816
|
-
children: /* @__PURE__ */ Z(
|
|
4002
|
+
children: /* @__PURE__ */ Z(Xe, { className: "h-3.5 w-3.5" })
|
|
3817
4003
|
})]
|
|
3818
|
-
}), /* @__PURE__ */ Z(
|
|
4004
|
+
}), /* @__PURE__ */ Z(Ur, {
|
|
3819
4005
|
items: t,
|
|
3820
4006
|
config: e?.feed,
|
|
3821
4007
|
hasMore: n,
|
|
@@ -3835,7 +4021,7 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3835
4021
|
emptyLabel: x("detail.noCommentsYet")
|
|
3836
4022
|
})] })
|
|
3837
4023
|
});
|
|
3838
|
-
},
|
|
4024
|
+
}, ii = (e) => {
|
|
3839
4025
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3840
4026
|
return {
|
|
3841
4027
|
designer: {
|
|
@@ -3845,9 +4031,9 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3845
4031
|
},
|
|
3846
4032
|
rest: i
|
|
3847
4033
|
};
|
|
3848
|
-
},
|
|
3849
|
-
|
|
3850
|
-
let r =
|
|
4034
|
+
}, ai = ({ schema: e = {}, className: t, ...n }) => {
|
|
4035
|
+
Ot();
|
|
4036
|
+
let r = wt(), { designer: i } = ii(n), a = {
|
|
3851
4037
|
position: "bottom",
|
|
3852
4038
|
collapsible: !1,
|
|
3853
4039
|
feed: {
|
|
@@ -3860,7 +4046,7 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3860
4046
|
return /* @__PURE__ */ Z("div", {
|
|
3861
4047
|
className: t,
|
|
3862
4048
|
...i,
|
|
3863
|
-
children: /* @__PURE__ */ Z(
|
|
4049
|
+
children: /* @__PURE__ */ Z(ri, {
|
|
3864
4050
|
items: r?.items || [],
|
|
3865
4051
|
config: a,
|
|
3866
4052
|
onAddComment: r?.onAddComment,
|
|
@@ -3870,7 +4056,7 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3870
4056
|
onUploadAttachments: r?.onUploadAttachments
|
|
3871
4057
|
})
|
|
3872
4058
|
});
|
|
3873
|
-
},
|
|
4059
|
+
}, oi = (e) => {
|
|
3874
4060
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3875
4061
|
return {
|
|
3876
4062
|
designer: {
|
|
@@ -3880,8 +4066,8 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3880
4066
|
},
|
|
3881
4067
|
rest: i
|
|
3882
4068
|
};
|
|
3883
|
-
},
|
|
3884
|
-
let r =
|
|
4069
|
+
}, si = ({ schema: e = {}, className: t, ...n }) => {
|
|
4070
|
+
let r = Ot(), { translateOptions: i } = jt(), { designer: a } = oi(n), o = Array.isArray(e.stages) ? e.stages : [], s = e.statusField, c = d.useMemo(() => {
|
|
3885
4071
|
if (o.length === 0 || !s || !r?.objectName) return o;
|
|
3886
4072
|
let e = i(r.objectName, s, o);
|
|
3887
4073
|
return Array.isArray(e) && e.length === o.length ? o.map((t, n) => ({
|
|
@@ -3911,7 +4097,7 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3911
4097
|
});
|
|
3912
4098
|
let b = h.length - 1;
|
|
3913
4099
|
return /* @__PURE__ */ Q("div", {
|
|
3914
|
-
className:
|
|
4100
|
+
className: W("w-full", t),
|
|
3915
4101
|
...a,
|
|
3916
4102
|
children: [/* @__PURE__ */ Q("div", {
|
|
3917
4103
|
className: "hidden sm:flex w-full items-stretch gap-2",
|
|
@@ -3924,7 +4110,7 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3924
4110
|
return /* @__PURE__ */ Z("div", {
|
|
3925
4111
|
role: "listitem",
|
|
3926
4112
|
"aria-current": r ? "step" : void 0,
|
|
3927
|
-
className:
|
|
4113
|
+
className: W("relative flex-1 min-w-0 px-4 py-2 text-xs font-medium text-center rounded-xl", r && "bg-primary text-primary-foreground shadow-sm", n && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200", !r && !n && i && "bg-emerald-500/10 text-emerald-700/85 dark:text-emerald-300/85", !r && !n && !i && "bg-muted text-muted-foreground"),
|
|
3928
4114
|
children: /* @__PURE__ */ Q("span", {
|
|
3929
4115
|
className: "inline-flex items-center justify-center gap-1.5 truncate",
|
|
3930
4116
|
children: [
|
|
@@ -3951,7 +4137,7 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3951
4137
|
return /* @__PURE__ */ Z("div", {
|
|
3952
4138
|
role: "listitem",
|
|
3953
4139
|
"aria-current": n ? "step" : void 0,
|
|
3954
|
-
className:
|
|
4140
|
+
className: W("shrink-0 px-3 py-2 text-xs font-medium rounded-md border whitespace-nowrap", n && "bg-destructive text-destructive-foreground border-destructive shadow-sm ring-1 ring-destructive/40", !n && "bg-destructive/5 text-destructive/85 border-destructive/20"),
|
|
3955
4141
|
children: /* @__PURE__ */ Q("span", {
|
|
3956
4142
|
className: "inline-flex items-center gap-1",
|
|
3957
4143
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -3972,7 +4158,7 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3972
4158
|
return /* @__PURE__ */ Z("div", {
|
|
3973
4159
|
role: "listitem",
|
|
3974
4160
|
"aria-current": i ? "step" : void 0,
|
|
3975
|
-
className:
|
|
4161
|
+
className: W("shrink-0 px-3 py-1.5 rounded-full text-xs font-medium border whitespace-nowrap", n && i && "bg-destructive text-destructive-foreground border-destructive shadow-sm", n && !i && "bg-destructive/5 text-destructive/85 border-destructive/20", !n && i && "bg-primary text-primary-foreground border-primary shadow-sm ring-1 ring-primary/40", !n && r && "bg-emerald-500/15 text-emerald-800 dark:text-emerald-200 border-emerald-500/30", !n && !i && !r && "bg-background text-foreground/85 border-border/60"),
|
|
3976
4162
|
children: /* @__PURE__ */ Q("span", {
|
|
3977
4163
|
className: "inline-flex items-center gap-1",
|
|
3978
4164
|
children: [
|
|
@@ -3993,7 +4179,7 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
3993
4179
|
})
|
|
3994
4180
|
})]
|
|
3995
4181
|
});
|
|
3996
|
-
},
|
|
4182
|
+
}, ci = (e) => {
|
|
3997
4183
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
3998
4184
|
return {
|
|
3999
4185
|
designer: {
|
|
@@ -4003,11 +4189,11 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
4003
4189
|
},
|
|
4004
4190
|
rest: i
|
|
4005
4191
|
};
|
|
4006
|
-
},
|
|
4007
|
-
let r =
|
|
4192
|
+
}, li = ({ schema: e = {}, className: t, ...n }) => {
|
|
4193
|
+
let r = Ot(), { designer: i } = ci(n), a = sn(), { language: o } = en(), s = jt(), c = Array.isArray(e.actions) ? e.actions : Array.isArray(e.properties?.actions) ? e.properties.actions : [], l = Array.isArray(e.actionNames) ? e.actionNames : Array.isArray(e.properties?.actionNames) ? e.properties.actionNames : [], u = r?.objectName || "", d = l.length > 0 ? l : Array.isArray(c) && c.every((e) => typeof e == "string") ? c : [], f = d.length > 0 && !!u, { item: p } = Dt("object", f ? u : null), m = f ? (() => {
|
|
4008
4194
|
let e = Array.isArray(p?.actions) ? p.actions : [], t = new Map(e.map((e) => [e.name, e]));
|
|
4009
4195
|
return d.map((e) => t.get(e)).filter((e) => !!e);
|
|
4010
|
-
})() : Array.isArray(c) ? c : [], h = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [], g = e.location || "record_header", { getActionsForLocation: _, executeAction: v } =
|
|
4196
|
+
})() : Array.isArray(c) ? c : [], h = Array.isArray(e.requiredPermissions) ? e.requiredPermissions : [], g = e.location || "record_header", { getActionsForLocation: _, executeAction: v } = xt({
|
|
4011
4197
|
actions: m,
|
|
4012
4198
|
context: {
|
|
4013
4199
|
record: r?.data,
|
|
@@ -4036,17 +4222,17 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
4036
4222
|
});
|
|
4037
4223
|
let b = e.align || "end", x = b === "start" ? "justify-start" : b === "center" ? "justify-center" : "justify-end";
|
|
4038
4224
|
return /* @__PURE__ */ Z("div", {
|
|
4039
|
-
className:
|
|
4225
|
+
className: W("flex flex-wrap items-center gap-2", g === "record_header" && !e.inline && "-mt-12 sm:-mt-14 mb-2 relative z-10", x, t),
|
|
4040
4226
|
role: "toolbar",
|
|
4041
4227
|
"aria-label": e.aria?.label || "Quick actions",
|
|
4042
4228
|
...i,
|
|
4043
|
-
children: y.map((t, n) => /* @__PURE__ */ Z(
|
|
4229
|
+
children: y.map((t, n) => /* @__PURE__ */ Z(ui, {
|
|
4044
4230
|
action: t,
|
|
4045
4231
|
record: r?.data,
|
|
4046
4232
|
variant: t.variant || e.variant || "default",
|
|
4047
4233
|
size: t.size || e.size || "sm",
|
|
4048
4234
|
label: (() => {
|
|
4049
|
-
let e =
|
|
4235
|
+
let e = Zt(t.label, o) || t.name || `Action ${n + 1}`;
|
|
4050
4236
|
return t.name ? s.actionLabel(u || void 0, t.name, e) : e;
|
|
4051
4237
|
})(),
|
|
4052
4238
|
onRun: async () => {
|
|
@@ -4055,8 +4241,8 @@ var zr = ({ items: e, config: t, filterMode: n, onFilterChange: r, hasMore: i =
|
|
|
4055
4241
|
}, t.name || `qa-${n}`))
|
|
4056
4242
|
});
|
|
4057
4243
|
};
|
|
4058
|
-
function
|
|
4059
|
-
let [o, s] = d.useState(!1), c = d.useMemo(() => ({ record: t || {} }), [t]), l =
|
|
4244
|
+
function ui({ action: e, record: t, variant: n, size: r, label: i, onRun: a }) {
|
|
4245
|
+
let [o, s] = d.useState(!1), c = d.useMemo(() => ({ record: t || {} }), [t]), l = St(bt(e.disabled), c);
|
|
4060
4246
|
return /* @__PURE__ */ Q(D, {
|
|
4061
4247
|
variant: n,
|
|
4062
4248
|
size: r,
|
|
@@ -4069,12 +4255,12 @@ function Yr({ action: e, record: t, variant: n, size: r, label: i, onRun: a }) {
|
|
|
4069
4255
|
s(!1);
|
|
4070
4256
|
}
|
|
4071
4257
|
},
|
|
4072
|
-
children: [o && /* @__PURE__ */ Z(
|
|
4258
|
+
children: [o && /* @__PURE__ */ Z(Ge, { className: "mr-2 h-4 w-4 animate-spin" }), i]
|
|
4073
4259
|
});
|
|
4074
4260
|
}
|
|
4075
4261
|
//#endregion
|
|
4076
4262
|
//#region src/renderers/record-history.tsx
|
|
4077
|
-
var
|
|
4263
|
+
var di = (e) => {
|
|
4078
4264
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
4079
4265
|
return {
|
|
4080
4266
|
designer: {
|
|
@@ -4084,14 +4270,14 @@ var Xr = (e) => {
|
|
|
4084
4270
|
},
|
|
4085
4271
|
rest: i
|
|
4086
4272
|
};
|
|
4087
|
-
},
|
|
4273
|
+
}, fi = /* @__PURE__ */ new Set([
|
|
4088
4274
|
"created",
|
|
4089
4275
|
"updated",
|
|
4090
4276
|
"assigned",
|
|
4091
4277
|
"shared",
|
|
4092
4278
|
"deleted"
|
|
4093
|
-
]),
|
|
4094
|
-
let { designer: r } =
|
|
4279
|
+
]), pi = ({ schema: e = {}, className: t, ...n }) => {
|
|
4280
|
+
let { designer: r } = di(n), i = Ot(), a = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : void 0, o = e.loading ?? e.properties?.loading, s = e.emptyText ?? e.properties?.emptyText, c = e.unknownUserText ?? e.properties?.unknownUserText, l = Number(e.limit ?? e.properties?.limit ?? 50) || 50, u = i?.objectName, f = i?.data?.id ?? i?.data?._id ?? i?.recordId, p = i?.dataSource, m = a === void 0 && !!p?.find && !!u && f != null, [h, g] = d.useState(null), [_, v] = d.useState(!1);
|
|
4095
4281
|
d.useEffect(() => {
|
|
4096
4282
|
if (!m) return;
|
|
4097
4283
|
let e = !1;
|
|
@@ -4104,7 +4290,7 @@ var Xr = (e) => {
|
|
|
4104
4290
|
$top: Math.max(1, l)
|
|
4105
4291
|
})).then((t) => {
|
|
4106
4292
|
if (e) return;
|
|
4107
|
-
let n = (t?.data ?? t?.records ?? []).filter((e) =>
|
|
4293
|
+
let n = (t?.data ?? t?.records ?? []).filter((e) => fi.has(e?.type)).map((e) => {
|
|
4108
4294
|
let t = e.timestamp;
|
|
4109
4295
|
return (!t || t === "NOW()" || Number.isNaN(Date.parse(t))) && (t = e.created_at), {
|
|
4110
4296
|
id: e.id,
|
|
@@ -4134,14 +4320,14 @@ var Xr = (e) => {
|
|
|
4134
4320
|
return /* @__PURE__ */ Z("div", {
|
|
4135
4321
|
className: t,
|
|
4136
4322
|
...r,
|
|
4137
|
-
children: /* @__PURE__ */ Z(
|
|
4323
|
+
children: /* @__PURE__ */ Z(tr, {
|
|
4138
4324
|
entries: y,
|
|
4139
4325
|
loading: b,
|
|
4140
4326
|
emptyText: s,
|
|
4141
4327
|
unknownUserText: c
|
|
4142
4328
|
})
|
|
4143
4329
|
});
|
|
4144
|
-
},
|
|
4330
|
+
}, mi = (e) => {
|
|
4145
4331
|
let { "data-obj-id": t, "data-obj-type": n, style: r, ...i } = e || {};
|
|
4146
4332
|
return {
|
|
4147
4333
|
designer: {
|
|
@@ -4151,8 +4337,8 @@ var Xr = (e) => {
|
|
|
4151
4337
|
},
|
|
4152
4338
|
rest: i
|
|
4153
4339
|
};
|
|
4154
|
-
},
|
|
4155
|
-
let r =
|
|
4340
|
+
}, hi = (e) => e.replace(/[_-]+/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()).trim(), gi = (e, t) => t && e?.[t] != null && e[t] !== "" ? String(e[t]) : e?.name || e?.title || e?.subject || e?.label || e?.email || e?.username || e?.code || e?.slug || e?.provider_id || e?.user_agent || e?.ip_address || e?.id || "—", _i = ({ schema: e = {}, className: t, ...n }) => {
|
|
4341
|
+
let r = Ot(), i = jt(), { t: a } = $(), { designer: o } = mi(n), s = rn().appName, c = Array.isArray(e.entries) ? e.entries : Array.isArray(e.properties?.entries) ? e.properties.entries : [], l = r?.recordId, u = r?.dataSource, [f, p] = d.useState({}), m = d.useRef(null), [h, g] = d.useState(!1), _ = d.useRef(!0);
|
|
4156
4342
|
d.useEffect(() => (_.current = !0, () => {
|
|
4157
4343
|
_.current = !1;
|
|
4158
4344
|
}), []);
|
|
@@ -4234,11 +4420,11 @@ var Xr = (e) => {
|
|
|
4234
4420
|
return S && t && !t.loading && !t.error && t.total === 0;
|
|
4235
4421
|
}).map((e) => e.objectName)), w = c.filter((e) => b || !C.has(e.objectName)), T = c.filter((e) => C.has(e.objectName)).map((e) => e.title || (i?.objectLabel ? i.objectLabel({
|
|
4236
4422
|
name: e.objectName,
|
|
4237
|
-
label:
|
|
4238
|
-
}) :
|
|
4423
|
+
label: hi(e.objectName)
|
|
4424
|
+
}) : hi(e.objectName)));
|
|
4239
4425
|
return /* @__PURE__ */ Q("div", {
|
|
4240
4426
|
ref: m,
|
|
4241
|
-
className:
|
|
4427
|
+
className: W("flex flex-col gap-3", e.className, t),
|
|
4242
4428
|
...o,
|
|
4243
4429
|
children: [w.map((e) => {
|
|
4244
4430
|
let t = e.objectName, n = f[t] || {
|
|
@@ -4254,15 +4440,15 @@ var Xr = (e) => {
|
|
|
4254
4440
|
className: "text-sm font-semibold tracking-tight truncate",
|
|
4255
4441
|
children: e.title || (i?.objectLabel ? i.objectLabel({
|
|
4256
4442
|
name: e.objectName,
|
|
4257
|
-
label:
|
|
4258
|
-
}) :
|
|
4443
|
+
label: hi(e.objectName)
|
|
4444
|
+
}) : hi(e.objectName))
|
|
4259
4445
|
}), /* @__PURE__ */ Q("div", {
|
|
4260
4446
|
className: "flex items-center gap-2 shrink-0",
|
|
4261
4447
|
children: [!n.loading && /* @__PURE__ */ Z(E, {
|
|
4262
4448
|
variant: "secondary",
|
|
4263
4449
|
className: "tabular-nums",
|
|
4264
4450
|
children: n.total
|
|
4265
|
-
}), s && l && /* @__PURE__ */ Z(
|
|
4451
|
+
}), s && l && /* @__PURE__ */ Z(nn, {
|
|
4266
4452
|
to: `/apps/${s}/${e.objectName}?filter%5B${e.relationshipField}%5D=${encodeURIComponent(String(l))}`,
|
|
4267
4453
|
className: "text-[11px] font-medium text-muted-foreground hover:text-foreground transition-colors",
|
|
4268
4454
|
title: a("detail.viewAll", { defaultValue: "View all" }),
|
|
@@ -4274,9 +4460,9 @@ var Xr = (e) => {
|
|
|
4274
4460
|
children: n.loading ? /* @__PURE__ */ Q("div", {
|
|
4275
4461
|
className: "space-y-1.5 p-3",
|
|
4276
4462
|
children: [
|
|
4277
|
-
/* @__PURE__ */ Z(
|
|
4278
|
-
/* @__PURE__ */ Z(
|
|
4279
|
-
/* @__PURE__ */ Z(
|
|
4463
|
+
/* @__PURE__ */ Z(L, { className: "h-3.5 w-4/5" }),
|
|
4464
|
+
/* @__PURE__ */ Z(L, { className: "h-3.5 w-3/5" }),
|
|
4465
|
+
/* @__PURE__ */ Z(L, { className: "h-3.5 w-2/3" })
|
|
4280
4466
|
]
|
|
4281
4467
|
}) : n.items.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
4282
4468
|
className: "px-4 py-3 text-xs text-muted-foreground",
|
|
@@ -4284,10 +4470,10 @@ var Xr = (e) => {
|
|
|
4284
4470
|
}) : /* @__PURE__ */ Z("ul", {
|
|
4285
4471
|
className: "divide-y",
|
|
4286
4472
|
children: n.items.map((t) => {
|
|
4287
|
-
let n = t.id || t._id, r =
|
|
4473
|
+
let n = t.id || t._id, r = gi(t, e.displayField), i = n ? `../${e.objectName}/record/${encodeURIComponent(String(n))}` : void 0;
|
|
4288
4474
|
return /* @__PURE__ */ Z("li", {
|
|
4289
4475
|
className: "px-4 py-2",
|
|
4290
|
-
children: i ? /* @__PURE__ */ Q(
|
|
4476
|
+
children: i ? /* @__PURE__ */ Q(nn, {
|
|
4291
4477
|
to: i,
|
|
4292
4478
|
className: "group flex items-center justify-between gap-2 text-xs hover:text-foreground text-muted-foreground transition-colors",
|
|
4293
4479
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -4321,7 +4507,7 @@ var Xr = (e) => {
|
|
|
4321
4507
|
})]
|
|
4322
4508
|
})]
|
|
4323
4509
|
});
|
|
4324
|
-
},
|
|
4510
|
+
}, vi = {
|
|
4325
4511
|
info: {
|
|
4326
4512
|
wrap: "border-blue-300/60 bg-blue-50 text-blue-900 dark:border-blue-700/40 dark:bg-blue-950/30 dark:text-blue-100 [&>svg]:text-blue-600 dark:[&>svg]:text-blue-300",
|
|
4327
4513
|
icon: "Info"
|
|
@@ -4339,22 +4525,22 @@ var Xr = (e) => {
|
|
|
4339
4525
|
icon: "CheckCircle2"
|
|
4340
4526
|
}
|
|
4341
4527
|
};
|
|
4342
|
-
function
|
|
4528
|
+
function yi(e) {
|
|
4343
4529
|
let t = e?.properties ?? {};
|
|
4344
4530
|
return {
|
|
4345
4531
|
...e,
|
|
4346
4532
|
...t
|
|
4347
4533
|
};
|
|
4348
4534
|
}
|
|
4349
|
-
var
|
|
4350
|
-
let n =
|
|
4535
|
+
var bi = ({ schema: e = {}, className: t }) => {
|
|
4536
|
+
let n = yi(e), r = Ot(), i = r?.data, a = r?.objectName || "", o = r?.recordId ?? i?.id, { language: s } = en(), c = Zt(n.title, s), l = Zt(n.body, s), d = Zt(n.action?.label, s), m = [
|
|
4351
4537
|
"info",
|
|
4352
4538
|
"warning",
|
|
4353
4539
|
"error",
|
|
4354
4540
|
"success"
|
|
4355
|
-
].includes(n.severity) ? n.severity : "info", h =
|
|
4541
|
+
].includes(n.severity) ? n.severity : "info", h = vi[m], g = n.icon || h.icon, _ = bt(n.visible), v = St(_, { record: i }), y = u.useMemo(() => {
|
|
4356
4542
|
if (!n.dismissible) return null;
|
|
4357
|
-
let e = n.dismissKey ||
|
|
4543
|
+
let e = n.dismissKey || Zt(n.title, "en") || m;
|
|
4358
4544
|
return `os.record-alert:${a}:${o ?? "_"}:${e}`;
|
|
4359
4545
|
}, [
|
|
4360
4546
|
n.dismissible,
|
|
@@ -4370,9 +4556,9 @@ var ai = ({ schema: e = {}, className: t }) => {
|
|
|
4370
4556
|
} catch {
|
|
4371
4557
|
return !1;
|
|
4372
4558
|
}
|
|
4373
|
-
}), C = n.action?.actionName, { item: w } =
|
|
4559
|
+
}), C = n.action?.actionName, { item: w } = Dt("object", C && a ? a : null), T = u.useMemo(() => {
|
|
4374
4560
|
if (!(!C || !w?.actions)) return w.actions.find((e) => e.name === C);
|
|
4375
|
-
}, [C, w]), { executeAction: E } =
|
|
4561
|
+
}, [C, w]), { executeAction: E } = xt({
|
|
4376
4562
|
actions: u.useMemo(() => T ? [T] : [], [T]),
|
|
4377
4563
|
context: {
|
|
4378
4564
|
record: i,
|
|
@@ -4381,11 +4567,11 @@ var ai = ({ schema: e = {}, className: t }) => {
|
|
|
4381
4567
|
}
|
|
4382
4568
|
});
|
|
4383
4569
|
return b || !i || Object.keys(i).length === 0 || _ !== void 0 && !v ? null : /* @__PURE__ */ Q(f, {
|
|
4384
|
-
className:
|
|
4570
|
+
className: W("relative pr-12", h.wrap, t),
|
|
4385
4571
|
role: m === "error" ? "alert" : "status",
|
|
4386
4572
|
"aria-live": m === "error" ? "assertive" : "polite",
|
|
4387
4573
|
children: [
|
|
4388
|
-
/* @__PURE__ */ Z(
|
|
4574
|
+
/* @__PURE__ */ Z(re, {
|
|
4389
4575
|
name: g,
|
|
4390
4576
|
className: "h-4 w-4",
|
|
4391
4577
|
"aria-hidden": "true"
|
|
@@ -4411,7 +4597,7 @@ var ai = ({ schema: e = {}, className: t }) => {
|
|
|
4411
4597
|
},
|
|
4412
4598
|
"aria-label": "Dismiss",
|
|
4413
4599
|
className: "absolute right-3 top-3 inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground/80 hover:bg-foreground/5 hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring",
|
|
4414
|
-
children: /* @__PURE__ */ Z(
|
|
4600
|
+
children: /* @__PURE__ */ Z(re, {
|
|
4415
4601
|
name: "X",
|
|
4416
4602
|
className: "h-4 w-4",
|
|
4417
4603
|
"aria-hidden": "true"
|
|
@@ -4419,7 +4605,7 @@ var ai = ({ schema: e = {}, className: t }) => {
|
|
|
4419
4605
|
}) : null
|
|
4420
4606
|
]
|
|
4421
4607
|
});
|
|
4422
|
-
},
|
|
4608
|
+
}, xi = (e) => {
|
|
4423
4609
|
if (e == null) return "—";
|
|
4424
4610
|
if (typeof e == "string") return e.length > 0 ? e : "\"\"";
|
|
4425
4611
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
@@ -4428,7 +4614,7 @@ var ai = ({ schema: e = {}, className: t }) => {
|
|
|
4428
4614
|
} catch {
|
|
4429
4615
|
return String(e);
|
|
4430
4616
|
}
|
|
4431
|
-
},
|
|
4617
|
+
}, Si = (e) => {
|
|
4432
4618
|
if (typeof e != "string" || e.length === 0) return null;
|
|
4433
4619
|
let t = /\d{4}-\d{2}-\d{2}[ T]/.test(e) ? e.replace(" ", "T") : e, n = new Date(t);
|
|
4434
4620
|
if (Number.isNaN(n.getTime())) return null;
|
|
@@ -4437,13 +4623,13 @@ var ai = ({ schema: e = {}, className: t }) => {
|
|
|
4437
4623
|
} catch {
|
|
4438
4624
|
return n.toISOString();
|
|
4439
4625
|
}
|
|
4440
|
-
},
|
|
4441
|
-
let { t: o } = $(), s = t?.label || t?.field || "", c = t ?
|
|
4626
|
+
}, Ci = ({ open: e, conflict: t, onReload: n, onOverwrite: r, onCancel: i, busy: a = !1 }) => {
|
|
4627
|
+
let { t: o } = $(), s = t?.label || t?.field || "", c = t ? xi(t.pendingValue) : "", l = t ? xi(t.currentValue) : "", u = t?.currentRecord ?? {}, d = (() => {
|
|
4442
4628
|
let e = [u.updated_by_name, u.updated_by_label];
|
|
4443
4629
|
for (let t of e) if (typeof t == "string" && t.length > 0) return t;
|
|
4444
4630
|
let t = u.updated_by;
|
|
4445
4631
|
return typeof t != "string" || t.length === 0 || t.length >= 16 && !/\s/.test(t) && /^[A-Za-z0-9_-]+$/.test(t) ? null : t;
|
|
4446
|
-
})(), f =
|
|
4632
|
+
})(), f = Si(u.updated_at ?? t?.currentVersion), [p, h] = o("detail.concurrentUpdateDescription", { field: "{{field}}" }).split("{{field}}");
|
|
4447
4633
|
return /* @__PURE__ */ Z(m, {
|
|
4448
4634
|
open: e,
|
|
4449
4635
|
onOpenChange: (e) => {
|
|
@@ -4512,14 +4698,14 @@ var ai = ({ schema: e = {}, className: t }) => {
|
|
|
4512
4698
|
type: "button",
|
|
4513
4699
|
disabled: a,
|
|
4514
4700
|
onClick: i,
|
|
4515
|
-
className: U(
|
|
4701
|
+
className: W(U({ variant: "ghost" }), "mt-2 sm:mt-0"),
|
|
4516
4702
|
children: o("detail.concurrentUpdateCancel")
|
|
4517
4703
|
}),
|
|
4518
4704
|
/* @__PURE__ */ Z("button", {
|
|
4519
4705
|
type: "button",
|
|
4520
4706
|
disabled: a,
|
|
4521
4707
|
onClick: r,
|
|
4522
|
-
className: U(
|
|
4708
|
+
className: W(U({ variant: "outline" }), "mt-2 sm:mt-0 text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive"),
|
|
4523
4709
|
children: o("detail.concurrentUpdateOverwrite")
|
|
4524
4710
|
}),
|
|
4525
4711
|
/* @__PURE__ */ Z("button", {
|
|
@@ -4527,7 +4713,7 @@ var ai = ({ schema: e = {}, className: t }) => {
|
|
|
4527
4713
|
disabled: a,
|
|
4528
4714
|
onClick: n,
|
|
4529
4715
|
autoFocus: !0,
|
|
4530
|
-
className: U(
|
|
4716
|
+
className: W(U({ variant: "default" }), "mt-2 sm:mt-0"),
|
|
4531
4717
|
children: o("detail.concurrentUpdateReload")
|
|
4532
4718
|
})
|
|
4533
4719
|
]
|
|
@@ -4536,25 +4722,25 @@ var ai = ({ schema: e = {}, className: t }) => {
|
|
|
4536
4722
|
})
|
|
4537
4723
|
});
|
|
4538
4724
|
};
|
|
4539
|
-
function
|
|
4725
|
+
function wi(e) {
|
|
4540
4726
|
if (!e || typeof e != "object") return !1;
|
|
4541
4727
|
let t = e;
|
|
4542
4728
|
return t.code === "CONCURRENT_UPDATE" || t.name === "ConcurrentUpdateError";
|
|
4543
4729
|
}
|
|
4544
4730
|
//#endregion
|
|
4545
4731
|
//#region src/InlineEditSaveBar.tsx
|
|
4546
|
-
function
|
|
4732
|
+
function Ti(e) {
|
|
4547
4733
|
let t = e?.message || e?.error || String(e ?? "Save failed");
|
|
4548
4734
|
return String(t).replace(/^\[[^\]]+\]\s*/, "").replace(/^[A-Z][A-Z0-9_]+:\s*/, "");
|
|
4549
4735
|
}
|
|
4550
|
-
async function
|
|
4736
|
+
async function Ei(e, t, n, r, i) {
|
|
4551
4737
|
if (typeof e?.update == "function") await e.update(t, n, r, i);
|
|
4552
4738
|
else if (typeof e?.updateOne == "function") await e.updateOne(t, n, r, i);
|
|
4553
4739
|
else if (typeof e?.patch == "function") await e.patch(t, n, r, i);
|
|
4554
4740
|
else throw Error("[InlineEditSaveBar] DataSource exposes no update/updateOne/patch method; cannot persist inline edit");
|
|
4555
4741
|
}
|
|
4556
|
-
var
|
|
4557
|
-
let { t: d } = $(), f =
|
|
4742
|
+
var Di = ({ dataSource: e, objectName: t, recordId: n, data: r, refresh: i, fieldLabelFor: a, onFieldSave: o, locked: s = !1, lockedHint: c, className: l }) => {
|
|
4743
|
+
let { t: d } = $(), f = Et(), [p, m] = u.useState(null), [h, g] = u.useState(!1), _ = !!e && !!t && n != null, v = u.useCallback((e, t) => {
|
|
4558
4744
|
let n = Object.keys(e), r = t?.currentRecord ?? null;
|
|
4559
4745
|
if (n.length === 1) {
|
|
4560
4746
|
let i = n[0];
|
|
@@ -4588,11 +4774,11 @@ var fi = ({ dataSource: e, objectName: t, recordId: n, data: r, refresh: i, fiel
|
|
|
4588
4774
|
if (o) for (let [e, t] of s) await o(e, t);
|
|
4589
4775
|
else if (_) {
|
|
4590
4776
|
let o = typeof r?.updated_at == "string" ? r.updated_at : void 0;
|
|
4591
|
-
await
|
|
4777
|
+
await Ei(e, t, n, a, o ? { ifMatch: o } : void 0), await i?.();
|
|
4592
4778
|
}
|
|
4593
4779
|
f.reset();
|
|
4594
4780
|
} catch (e) {
|
|
4595
|
-
|
|
4781
|
+
wi(e) && _ ? m(v(a, e)) : f.setError(Ti(e));
|
|
4596
4782
|
} finally {
|
|
4597
4783
|
f.setSaving(!1);
|
|
4598
4784
|
}
|
|
@@ -4626,9 +4812,9 @@ var fi = ({ dataSource: e, objectName: t, recordId: n, data: r, refresh: i, fiel
|
|
|
4626
4812
|
}
|
|
4627
4813
|
g(!0);
|
|
4628
4814
|
try {
|
|
4629
|
-
await
|
|
4815
|
+
await Ei(e, t, n, f?.draft ?? {}, p.currentVersion ? { ifMatch: p.currentVersion } : void 0), await i?.(), f?.reset();
|
|
4630
4816
|
} catch (e) {
|
|
4631
|
-
f?.setError(
|
|
4817
|
+
f?.setError(Ti(e));
|
|
4632
4818
|
} finally {
|
|
4633
4819
|
b();
|
|
4634
4820
|
}
|
|
@@ -4663,8 +4849,8 @@ var fi = ({ dataSource: e, objectName: t, recordId: n, data: r, refresh: i, fiel
|
|
|
4663
4849
|
E,
|
|
4664
4850
|
y,
|
|
4665
4851
|
T
|
|
4666
|
-
]), !f || !f.editing ? null : /* @__PURE__ */ Q(
|
|
4667
|
-
className:
|
|
4852
|
+
]), !f || !f.editing ? null : /* @__PURE__ */ Q(an, { children: [/* @__PURE__ */ Q("div", {
|
|
4853
|
+
className: W("sticky bottom-0 z-30 mt-4 flex flex-wrap items-center justify-end gap-2 rounded-md border bg-background/95 px-3 py-2 shadow-sm backdrop-blur supports-[backdrop-filter]:bg-background/80", l),
|
|
4668
4854
|
role: "region",
|
|
4669
4855
|
"aria-label": d("detail.editFieldsInline"),
|
|
4670
4856
|
children: [
|
|
@@ -4679,7 +4865,7 @@ var fi = ({ dataSource: e, objectName: t, recordId: n, data: r, refresh: i, fiel
|
|
|
4679
4865
|
onClick: f.cancel,
|
|
4680
4866
|
disabled: f.saving,
|
|
4681
4867
|
className: "gap-2",
|
|
4682
|
-
children: [/* @__PURE__ */ Z(
|
|
4868
|
+
children: [/* @__PURE__ */ Z(mt, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: d("detail.cancel") })]
|
|
4683
4869
|
}),
|
|
4684
4870
|
/* @__PURE__ */ Q(D, {
|
|
4685
4871
|
variant: "default",
|
|
@@ -4688,10 +4874,10 @@ var fi = ({ dataSource: e, objectName: t, recordId: n, data: r, refresh: i, fiel
|
|
|
4688
4874
|
disabled: f.saving || s,
|
|
4689
4875
|
className: "gap-2",
|
|
4690
4876
|
title: s ? c : void 0,
|
|
4691
|
-
children: [f.saving ? /* @__PURE__ */ Z(
|
|
4877
|
+
children: [f.saving ? /* @__PURE__ */ Z(Ge, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ Z(q, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", { children: f.saving ? d("detail.saving") : d("detail.save") })]
|
|
4692
4878
|
})
|
|
4693
4879
|
]
|
|
4694
|
-
}), /* @__PURE__ */ Z(
|
|
4880
|
+
}), /* @__PURE__ */ Z(Ci, {
|
|
4695
4881
|
open: !!p,
|
|
4696
4882
|
conflict: p,
|
|
4697
4883
|
busy: h,
|
|
@@ -4699,15 +4885,15 @@ var fi = ({ dataSource: e, objectName: t, recordId: n, data: r, refresh: i, fiel
|
|
|
4699
4885
|
onReload: x,
|
|
4700
4886
|
onOverwrite: S
|
|
4701
4887
|
})] });
|
|
4702
|
-
},
|
|
4703
|
-
function
|
|
4888
|
+
}, Oi = new Set(un), ki = 480, Ai = 95;
|
|
4889
|
+
function ji({ open: e, onClose: t, title: n, record: r, objectName: i, recordId: a, dataSource: o, objectSchema: s, width: c = "min(960px, 60vw)", columns: l = 2, systemFields: u = Oi, onFieldSave: f, onDelete: p, resizable: m = !0, fullPageHref: h }) {
|
|
4704
4890
|
let { t: g } = $(), _ = `objectui.drawerWidth.${i}`, [v, y] = d.useState(() => {
|
|
4705
4891
|
if (typeof window > "u" || !m) return null;
|
|
4706
4892
|
try {
|
|
4707
4893
|
let e = window.localStorage.getItem(_);
|
|
4708
4894
|
if (e) {
|
|
4709
4895
|
let t = parseInt(e, 10);
|
|
4710
|
-
if (Number.isFinite(t) && t >=
|
|
4896
|
+
if (Number.isFinite(t) && t >= ki) return t;
|
|
4711
4897
|
}
|
|
4712
4898
|
} catch {}
|
|
4713
4899
|
return null;
|
|
@@ -4729,7 +4915,7 @@ function gi({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4729
4915
|
let n = (e) => {
|
|
4730
4916
|
let t = S.current;
|
|
4731
4917
|
if (!t) return;
|
|
4732
|
-
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth *
|
|
4918
|
+
let n = t.startX - e.clientX, r = typeof window < "u" ? window.innerWidth * Ai / 100 : 1600, i = Math.min(r, Math.max(ki, t.startWidth + n));
|
|
4733
4919
|
y(Math.round(i));
|
|
4734
4920
|
}, r = () => {
|
|
4735
4921
|
S.current, S.current = null, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", r);
|
|
@@ -4762,12 +4948,12 @@ function gi({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4762
4948
|
description: t.description
|
|
4763
4949
|
};
|
|
4764
4950
|
});
|
|
4765
|
-
return /* @__PURE__ */ Z(
|
|
4951
|
+
return /* @__PURE__ */ Z(F, {
|
|
4766
4952
|
open: e,
|
|
4767
4953
|
onOpenChange: (e) => {
|
|
4768
4954
|
e || t();
|
|
4769
4955
|
},
|
|
4770
|
-
children: /* @__PURE__ */ Q(
|
|
4956
|
+
children: /* @__PURE__ */ Q(ce, {
|
|
4771
4957
|
side: "right",
|
|
4772
4958
|
className: "w-full overflow-y-auto p-0 sm:!max-w-none",
|
|
4773
4959
|
style: x,
|
|
@@ -4780,15 +4966,15 @@ function gi({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4780
4966
|
onPointerDown: C,
|
|
4781
4967
|
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"
|
|
4782
4968
|
}),
|
|
4783
|
-
/* @__PURE__ */ Z(
|
|
4969
|
+
/* @__PURE__ */ Z(I, {
|
|
4784
4970
|
className: "sr-only",
|
|
4785
|
-
children: /* @__PURE__ */ Z(
|
|
4971
|
+
children: /* @__PURE__ */ Z(le, { children: n })
|
|
4786
4972
|
}),
|
|
4787
4973
|
/* @__PURE__ */ Z("div", {
|
|
4788
4974
|
className: "px-6 pt-6 pb-6",
|
|
4789
|
-
children: /* @__PURE__ */ Q(
|
|
4975
|
+
children: /* @__PURE__ */ Q(_t, {
|
|
4790
4976
|
canEdit: !!f,
|
|
4791
|
-
children: [/* @__PURE__ */ Z(
|
|
4977
|
+
children: [/* @__PURE__ */ Z(hr, {
|
|
4792
4978
|
dataSource: o,
|
|
4793
4979
|
inlineEdit: !!f,
|
|
4794
4980
|
schema: {
|
|
@@ -4818,7 +5004,7 @@ function gi({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4818
5004
|
console.error("[RecordDetailDrawer] delete failed:", e);
|
|
4819
5005
|
}
|
|
4820
5006
|
} : void 0
|
|
4821
|
-
}), /* @__PURE__ */ Z(
|
|
5007
|
+
}), /* @__PURE__ */ Z(Di, { onFieldSave: f ? async (e, t) => {
|
|
4822
5008
|
try {
|
|
4823
5009
|
await f(e, t);
|
|
4824
5010
|
} catch (e) {
|
|
@@ -4831,14 +5017,14 @@ function gi({ open: e, onClose: t, title: n, record: r, objectName: i, recordId:
|
|
|
4831
5017
|
})
|
|
4832
5018
|
});
|
|
4833
5019
|
}
|
|
4834
|
-
function
|
|
5020
|
+
function Mi(e, t) {
|
|
4835
5021
|
if (typeof window > "u") return null;
|
|
4836
5022
|
let n = window.location.pathname, r = `/${e}`, i = n.indexOf(r);
|
|
4837
5023
|
return `${i >= 0 ? n.slice(0, i) : n.replace(/\/$/, "")}/${e}/record/${encodeURIComponent(String(t))}`;
|
|
4838
5024
|
}
|
|
4839
5025
|
//#endregion
|
|
4840
5026
|
//#region src/InlineCreateRelated.tsx
|
|
4841
|
-
var
|
|
5027
|
+
var Ni = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, onLinkRecord: i, onSearch: a, existingRecords: o = [], className: s }) => {
|
|
4842
5028
|
let [c, l] = u.useState(!1), [d, f] = u.useState("create"), [p, m] = u.useState({}), [h, g] = u.useState(""), [_, v] = u.useState(o), [y, b] = u.useState(!1), [x, S] = u.useState(!1), C = u.useMemo(() => {
|
|
4843
5029
|
if (!h.trim()) return _;
|
|
4844
5030
|
let e = h.toLowerCase();
|
|
@@ -4883,9 +5069,9 @@ var vi = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4883
5069
|
b(!1);
|
|
4884
5070
|
}
|
|
4885
5071
|
}
|
|
4886
|
-
}, [i]),
|
|
5072
|
+
}, [i]), N = u.useMemo(() => n.filter((e) => e.required).every((e) => p[e.name]?.toString().trim()), [n, p]);
|
|
4887
5073
|
return c ? /* @__PURE__ */ Q(O, {
|
|
4888
|
-
className:
|
|
5074
|
+
className: W("", s),
|
|
4889
5075
|
children: [/* @__PURE__ */ Z(A, {
|
|
4890
5076
|
className: "pb-3",
|
|
4891
5077
|
children: /* @__PURE__ */ Q(j, {
|
|
@@ -4899,26 +5085,26 @@ var vi = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4899
5085
|
size: "icon",
|
|
4900
5086
|
className: "h-6 w-6",
|
|
4901
5087
|
onClick: () => l(!1),
|
|
4902
|
-
children: /* @__PURE__ */ Z(
|
|
5088
|
+
children: /* @__PURE__ */ Z(mt, { className: "h-3.5 w-3.5" })
|
|
4903
5089
|
})]
|
|
4904
5090
|
})
|
|
4905
|
-
}), /* @__PURE__ */ Z(k, { children: /* @__PURE__ */ Q(
|
|
5091
|
+
}), /* @__PURE__ */ Z(k, { children: /* @__PURE__ */ Q(R, {
|
|
4906
5092
|
value: d,
|
|
4907
5093
|
onValueChange: f,
|
|
4908
5094
|
children: [
|
|
4909
|
-
/* @__PURE__ */ Q(
|
|
5095
|
+
/* @__PURE__ */ Q(z, {
|
|
4910
5096
|
className: "mb-3 w-full",
|
|
4911
|
-
children: [r && /* @__PURE__ */ Q(
|
|
5097
|
+
children: [r && /* @__PURE__ */ Q(de, {
|
|
4912
5098
|
value: "create",
|
|
4913
5099
|
className: "flex-1 gap-1.5",
|
|
4914
|
-
children: [/* @__PURE__ */ Z(
|
|
4915
|
-
}), i && /* @__PURE__ */ Q(
|
|
5100
|
+
children: [/* @__PURE__ */ Z(nt, { className: "h-3.5 w-3.5" }), "Create New"]
|
|
5101
|
+
}), i && /* @__PURE__ */ Q(de, {
|
|
4916
5102
|
value: "link",
|
|
4917
5103
|
className: "flex-1 gap-1.5",
|
|
4918
|
-
children: [/* @__PURE__ */ Z(
|
|
5104
|
+
children: [/* @__PURE__ */ Z(Ue, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
4919
5105
|
})]
|
|
4920
5106
|
}),
|
|
4921
|
-
r && /* @__PURE__ */ Q(
|
|
5107
|
+
r && /* @__PURE__ */ Q(ue, {
|
|
4922
5108
|
value: "create",
|
|
4923
5109
|
className: "space-y-3 mt-0",
|
|
4924
5110
|
children: [n.map((e) => /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Q("label", {
|
|
@@ -4927,7 +5113,7 @@ var vi = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4927
5113
|
className: "text-destructive ml-0.5",
|
|
4928
5114
|
children: "*"
|
|
4929
5115
|
})]
|
|
4930
|
-
}), /* @__PURE__ */ Z(
|
|
5116
|
+
}), /* @__PURE__ */ Z(ne, {
|
|
4931
5117
|
type: e.type === "number" ? "number" : e.type === "date" ? "date" : "text",
|
|
4932
5118
|
placeholder: e.placeholder || `Enter ${e.label.toLowerCase()}`,
|
|
4933
5119
|
value: p[e.name] || "",
|
|
@@ -4943,18 +5129,18 @@ var vi = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4943
5129
|
}), /* @__PURE__ */ Q(D, {
|
|
4944
5130
|
size: "sm",
|
|
4945
5131
|
onClick: E,
|
|
4946
|
-
disabled: !
|
|
5132
|
+
disabled: !N || y,
|
|
4947
5133
|
className: "gap-1.5",
|
|
4948
|
-
children: [y && /* @__PURE__ */ Z(
|
|
5134
|
+
children: [y && /* @__PURE__ */ Z(Ge, { className: "h-3.5 w-3.5 animate-spin" }), "Create"]
|
|
4949
5135
|
})]
|
|
4950
5136
|
})]
|
|
4951
5137
|
}),
|
|
4952
|
-
i && /* @__PURE__ */ Q(
|
|
5138
|
+
i && /* @__PURE__ */ Q(ue, {
|
|
4953
5139
|
value: "link",
|
|
4954
5140
|
className: "space-y-3 mt-0",
|
|
4955
5141
|
children: [/* @__PURE__ */ Q("div", {
|
|
4956
5142
|
className: "relative",
|
|
4957
|
-
children: [/* @__PURE__ */ Z(
|
|
5143
|
+
children: [/* @__PURE__ */ Z(ot, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" }), /* @__PURE__ */ Z(ne, {
|
|
4958
5144
|
placeholder: `Search ${e}…`,
|
|
4959
5145
|
value: h,
|
|
4960
5146
|
onChange: (e) => w(e.target.value),
|
|
@@ -4964,7 +5150,7 @@ var vi = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4964
5150
|
className: "max-h-48 overflow-y-auto space-y-1",
|
|
4965
5151
|
children: x ? /* @__PURE__ */ Q("div", {
|
|
4966
5152
|
className: "flex items-center justify-center py-4 text-sm text-muted-foreground",
|
|
4967
|
-
children: [/* @__PURE__ */ Z(
|
|
5153
|
+
children: [/* @__PURE__ */ Z(Ge, { className: "h-4 w-4 animate-spin mr-2" }), "Searching…"]
|
|
4968
5154
|
}) : C.length === 0 ? /* @__PURE__ */ Z("p", {
|
|
4969
5155
|
className: "text-sm text-muted-foreground text-center py-4",
|
|
4970
5156
|
children: h ? "No records found" : "Type to search records"
|
|
@@ -4986,7 +5172,7 @@ var vi = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4986
5172
|
]
|
|
4987
5173
|
}) })]
|
|
4988
5174
|
}) : /* @__PURE__ */ Q("div", {
|
|
4989
|
-
className:
|
|
5175
|
+
className: W("flex gap-2", s),
|
|
4990
5176
|
children: [r && /* @__PURE__ */ Q(D, {
|
|
4991
5177
|
variant: "outline",
|
|
4992
5178
|
size: "sm",
|
|
@@ -4995,7 +5181,7 @@ var vi = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
4995
5181
|
},
|
|
4996
5182
|
className: "gap-1.5",
|
|
4997
5183
|
children: [
|
|
4998
|
-
/* @__PURE__ */ Z(
|
|
5184
|
+
/* @__PURE__ */ Z(nt, { className: "h-3.5 w-3.5" }),
|
|
4999
5185
|
"New ",
|
|
5000
5186
|
e
|
|
5001
5187
|
]
|
|
@@ -5006,13 +5192,13 @@ var vi = ({ objectName: e, relationshipField: t, fields: n, onCreateRecord: r, o
|
|
|
5006
5192
|
f("link"), l(!0);
|
|
5007
5193
|
},
|
|
5008
5194
|
className: "gap-1.5",
|
|
5009
|
-
children: [/* @__PURE__ */ Z(
|
|
5195
|
+
children: [/* @__PURE__ */ Z(Ue, { className: "h-3.5 w-3.5" }), "Link Existing"]
|
|
5010
5196
|
})]
|
|
5011
5197
|
});
|
|
5012
5198
|
};
|
|
5013
5199
|
//#endregion
|
|
5014
5200
|
//#region src/DiffView.tsx
|
|
5015
|
-
function
|
|
5201
|
+
function Pi(e, t) {
|
|
5016
5202
|
if (e == null) return ["(empty)"];
|
|
5017
5203
|
switch (t) {
|
|
5018
5204
|
case "json": try {
|
|
@@ -5031,7 +5217,7 @@ function yi(e, t) {
|
|
|
5031
5217
|
default: return String(e).split("\n");
|
|
5032
5218
|
}
|
|
5033
5219
|
}
|
|
5034
|
-
function
|
|
5220
|
+
function Fi(e, t) {
|
|
5035
5221
|
let n = [], r = Math.max(e.length, t.length);
|
|
5036
5222
|
for (let i = 0; i < r; i++) {
|
|
5037
5223
|
let r = i < e.length ? e[i] : void 0, a = i < t.length ? t[i] : void 0;
|
|
@@ -5048,16 +5234,16 @@ function bi(e, t) {
|
|
|
5048
5234
|
}
|
|
5049
5235
|
return n;
|
|
5050
5236
|
}
|
|
5051
|
-
var
|
|
5237
|
+
var Ii = {
|
|
5052
5238
|
added: "bg-green-50 text-green-800 dark:bg-green-950/30 dark:text-green-300",
|
|
5053
5239
|
removed: "bg-red-50 text-red-800 dark:bg-red-950/30 dark:text-red-300",
|
|
5054
5240
|
unchanged: "text-muted-foreground"
|
|
5055
|
-
},
|
|
5241
|
+
}, Li = {
|
|
5056
5242
|
added: "+",
|
|
5057
5243
|
removed: "-",
|
|
5058
5244
|
unchanged: " "
|
|
5059
|
-
},
|
|
5060
|
-
let { t: o } = $(), [s, c] = u.useState(i), l = u.useMemo(() =>
|
|
5245
|
+
}, Ri = ({ oldValue: e, newValue: t, fieldName: n, fieldType: r = "string", mode: i = "unified", className: a }) => {
|
|
5246
|
+
let { t: o } = $(), [s, c] = u.useState(i), l = u.useMemo(() => Pi(e, r), [e, r]), d = u.useMemo(() => Pi(t, r), [t, r]), f = u.useMemo(() => Fi(l, d), [l, d]), p = f.some((e) => e.type !== "unchanged"), m = u.useMemo(() => {
|
|
5061
5247
|
if (s !== "side-by-side") return [];
|
|
5062
5248
|
let e = [], t = 0;
|
|
5063
5249
|
for (; t < f.length;) {
|
|
@@ -5083,7 +5269,7 @@ var xi = {
|
|
|
5083
5269
|
return e;
|
|
5084
5270
|
}, [s, f]);
|
|
5085
5271
|
return /* @__PURE__ */ Q(O, {
|
|
5086
|
-
className:
|
|
5272
|
+
className: W("overflow-hidden", a),
|
|
5087
5273
|
children: [/* @__PURE__ */ Z(A, {
|
|
5088
5274
|
className: "pb-2",
|
|
5089
5275
|
children: /* @__PURE__ */ Q(j, {
|
|
@@ -5099,14 +5285,14 @@ var xi = {
|
|
|
5099
5285
|
className: "h-7 w-7",
|
|
5100
5286
|
onClick: () => c("unified"),
|
|
5101
5287
|
title: o("detail.unifiedDiff"),
|
|
5102
|
-
children: /* @__PURE__ */ Z(
|
|
5288
|
+
children: /* @__PURE__ */ Z(at, { className: "h-3.5 w-3.5" })
|
|
5103
5289
|
}), /* @__PURE__ */ Z(D, {
|
|
5104
5290
|
variant: s === "side-by-side" ? "secondary" : "ghost",
|
|
5105
5291
|
size: "icon",
|
|
5106
5292
|
className: "h-7 w-7",
|
|
5107
5293
|
onClick: () => c("side-by-side"),
|
|
5108
5294
|
title: o("detail.sideBySideDiff"),
|
|
5109
|
-
children: /* @__PURE__ */ Z(
|
|
5295
|
+
children: /* @__PURE__ */ Z(Ne, { className: "h-3.5 w-3.5" })
|
|
5110
5296
|
})]
|
|
5111
5297
|
})]
|
|
5112
5298
|
})
|
|
@@ -5115,10 +5301,10 @@ var xi = {
|
|
|
5115
5301
|
children: p ? s === "unified" ? /* @__PURE__ */ Z("div", {
|
|
5116
5302
|
className: "font-mono text-xs overflow-x-auto",
|
|
5117
5303
|
children: f.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
5118
|
-
className:
|
|
5304
|
+
className: W("px-4 py-0.5 whitespace-pre-wrap border-l-2", Ii[e.type], e.type === "added" && "border-l-green-500", e.type === "removed" && "border-l-red-500", e.type === "unchanged" && "border-l-transparent"),
|
|
5119
5305
|
children: [/* @__PURE__ */ Z("span", {
|
|
5120
5306
|
className: "select-none mr-2 inline-block w-3 text-center opacity-60",
|
|
5121
|
-
children:
|
|
5307
|
+
children: Li[e.type]
|
|
5122
5308
|
}), e.value]
|
|
5123
5309
|
}, t))
|
|
5124
5310
|
}) : /* @__PURE__ */ Z("div", {
|
|
@@ -5135,10 +5321,10 @@ var xi = {
|
|
|
5135
5321
|
children: o("detail.currentVersion")
|
|
5136
5322
|
}),
|
|
5137
5323
|
m.map((e, t) => /* @__PURE__ */ Q(u.Fragment, { children: [/* @__PURE__ */ Z("div", {
|
|
5138
|
-
className:
|
|
5324
|
+
className: W("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.left ? Ii[e.left.type] : "bg-muted/20"),
|
|
5139
5325
|
children: e.left?.value ?? ""
|
|
5140
5326
|
}), /* @__PURE__ */ Z("div", {
|
|
5141
|
-
className:
|
|
5327
|
+
className: W("px-3 py-0.5 whitespace-pre-wrap min-h-[1.5em]", e.right ? Ii[e.right.type] : "bg-muted/20"),
|
|
5142
5328
|
children: e.right?.value ?? ""
|
|
5143
5329
|
})] }, t))
|
|
5144
5330
|
]
|
|
@@ -5149,7 +5335,7 @@ var xi = {
|
|
|
5149
5335
|
})
|
|
5150
5336
|
})]
|
|
5151
5337
|
});
|
|
5152
|
-
},
|
|
5338
|
+
}, zi = ({ currentIndex: e, totalRecords: t, recordIds: n, onNavigate: r, onSearch: i, className: a }) => {
|
|
5153
5339
|
let { t: o } = $(), [s, c] = u.useState(""), [l, d] = u.useState(!1), f = u.useRef(null), p = e > 0, m = e > 0, h = e < t - 1, g = e < t - 1, _ = u.useCallback(() => {
|
|
5154
5340
|
p && r(n[0]);
|
|
5155
5341
|
}, [
|
|
@@ -5217,7 +5403,7 @@ var xi = {
|
|
|
5217
5403
|
r,
|
|
5218
5404
|
i
|
|
5219
5405
|
]), /* @__PURE__ */ Q("div", {
|
|
5220
|
-
className:
|
|
5406
|
+
className: W("flex items-center gap-1.5", a),
|
|
5221
5407
|
children: [
|
|
5222
5408
|
/* @__PURE__ */ Z(D, {
|
|
5223
5409
|
variant: "outline",
|
|
@@ -5262,16 +5448,16 @@ var xi = {
|
|
|
5262
5448
|
title: o("detail.lastRecord"),
|
|
5263
5449
|
children: /* @__PURE__ */ Z(ke, { className: "h-4 w-4" })
|
|
5264
5450
|
}),
|
|
5265
|
-
i && /* @__PURE__ */ Q(
|
|
5451
|
+
i && /* @__PURE__ */ Q(an, { children: [/* @__PURE__ */ Z(D, {
|
|
5266
5452
|
variant: l ? "secondary" : "ghost",
|
|
5267
5453
|
size: "icon",
|
|
5268
5454
|
className: "h-8 w-8",
|
|
5269
5455
|
onClick: S,
|
|
5270
5456
|
title: o("detail.searchWhileNavigating"),
|
|
5271
|
-
children: /* @__PURE__ */ Z(
|
|
5457
|
+
children: /* @__PURE__ */ Z(ot, { className: "h-4 w-4" })
|
|
5272
5458
|
}), l && /* @__PURE__ */ Z("div", {
|
|
5273
5459
|
className: "relative",
|
|
5274
|
-
children: /* @__PURE__ */ Z(
|
|
5460
|
+
children: /* @__PURE__ */ Z(ne, {
|
|
5275
5461
|
ref: f,
|
|
5276
5462
|
type: "text",
|
|
5277
5463
|
placeholder: o("detail.searchRecords"),
|
|
@@ -5282,18 +5468,18 @@ var xi = {
|
|
|
5282
5468
|
})] })
|
|
5283
5469
|
]
|
|
5284
5470
|
});
|
|
5285
|
-
},
|
|
5471
|
+
}, Bi = 28, Vi = [
|
|
5286
5472
|
"fill-primary stroke-primary",
|
|
5287
5473
|
"fill-blue-500 stroke-blue-500",
|
|
5288
5474
|
"fill-emerald-500 stroke-emerald-500",
|
|
5289
5475
|
"fill-amber-500 stroke-amber-500"
|
|
5290
|
-
],
|
|
5476
|
+
], Hi = [
|
|
5291
5477
|
"fill-primary-foreground",
|
|
5292
5478
|
"fill-white",
|
|
5293
5479
|
"fill-white",
|
|
5294
5480
|
"fill-white"
|
|
5295
5481
|
];
|
|
5296
|
-
function
|
|
5482
|
+
function Ui(e, t, n, r, i) {
|
|
5297
5483
|
let a = [], o = [], s = /* @__PURE__ */ new Set(), c = r / 2, l = i / 2;
|
|
5298
5484
|
a.push({
|
|
5299
5485
|
id: e.id,
|
|
@@ -5357,10 +5543,10 @@ function Oi(e, t, n, r, i) {
|
|
|
5357
5543
|
edges: o
|
|
5358
5544
|
};
|
|
5359
5545
|
}
|
|
5360
|
-
function
|
|
5546
|
+
function Wi(e, t = 6) {
|
|
5361
5547
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
5362
5548
|
}
|
|
5363
|
-
var
|
|
5549
|
+
var Gi = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, className: i }) => {
|
|
5364
5550
|
let a = u.useRef(null), [o, s] = u.useState({
|
|
5365
5551
|
width: 500,
|
|
5366
5552
|
height: 400
|
|
@@ -5381,20 +5567,20 @@ var Ai = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5381
5567
|
});
|
|
5382
5568
|
return n.observe(t), () => n.disconnect();
|
|
5383
5569
|
}, []);
|
|
5384
|
-
let { nodes: d, edges: f } = u.useMemo(() =>
|
|
5570
|
+
let { nodes: d, edges: f } = u.useMemo(() => Ui(e, t, n, o.width, o.height), [
|
|
5385
5571
|
e,
|
|
5386
5572
|
t,
|
|
5387
5573
|
n,
|
|
5388
5574
|
o
|
|
5389
5575
|
]);
|
|
5390
5576
|
return /* @__PURE__ */ Q(O, {
|
|
5391
|
-
className:
|
|
5577
|
+
className: W("overflow-hidden", i),
|
|
5392
5578
|
children: [/* @__PURE__ */ Z(A, {
|
|
5393
5579
|
className: "pb-2",
|
|
5394
5580
|
children: /* @__PURE__ */ Q(j, {
|
|
5395
5581
|
className: "flex items-center gap-2 text-base",
|
|
5396
5582
|
children: [
|
|
5397
|
-
/* @__PURE__ */ Z(
|
|
5583
|
+
/* @__PURE__ */ Z(Ye, { className: "h-4 w-4" }),
|
|
5398
5584
|
"Relationships",
|
|
5399
5585
|
/* @__PURE__ */ Q("span", {
|
|
5400
5586
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -5423,9 +5609,9 @@ var Ai = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5423
5609
|
strokeWidth: 1.5,
|
|
5424
5610
|
strokeOpacity: .5
|
|
5425
5611
|
}, `edge-${t}`)), d.map((e) => {
|
|
5426
|
-
let t = c === e.id, n =
|
|
5612
|
+
let t = c === e.id, n = Vi[Math.min(e.level, Vi.length - 1)], i = Hi[Math.min(e.level, Hi.length - 1)], a = e.level === 0 ? 34 : Bi;
|
|
5427
5613
|
return /* @__PURE__ */ Q("g", {
|
|
5428
|
-
className:
|
|
5614
|
+
className: W("cursor-pointer transition-transform", r && "hover:opacity-80"),
|
|
5429
5615
|
onClick: () => r?.(e.id),
|
|
5430
5616
|
onMouseEnter: () => l(e.id),
|
|
5431
5617
|
onMouseLeave: () => l(null),
|
|
@@ -5444,8 +5630,8 @@ var Ai = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5444
5630
|
y: e.y,
|
|
5445
5631
|
textAnchor: "middle",
|
|
5446
5632
|
dominantBaseline: "central",
|
|
5447
|
-
className:
|
|
5448
|
-
children:
|
|
5633
|
+
className: W("text-[10px] font-medium pointer-events-none", i),
|
|
5634
|
+
children: Wi(e.label)
|
|
5449
5635
|
}),
|
|
5450
5636
|
e.type && /* @__PURE__ */ Z("text", {
|
|
5451
5637
|
x: e.x,
|
|
@@ -5454,7 +5640,7 @@ var Ai = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5454
5640
|
className: "fill-muted-foreground text-[9px] pointer-events-none",
|
|
5455
5641
|
children: e.type
|
|
5456
5642
|
}),
|
|
5457
|
-
t && /* @__PURE__ */ Q(
|
|
5643
|
+
t && /* @__PURE__ */ Q(an, { children: [/* @__PURE__ */ Z("rect", {
|
|
5458
5644
|
x: e.x - 50,
|
|
5459
5645
|
y: e.y - a - 28,
|
|
5460
5646
|
width: 100,
|
|
@@ -5479,7 +5665,7 @@ var Ai = ({ record: e, relatedRecords: t, levels: n = 1, onNodeClick: r, classNa
|
|
|
5479
5665
|
};
|
|
5480
5666
|
//#endregion
|
|
5481
5667
|
//#region src/PointInTimeRestore.tsx
|
|
5482
|
-
function
|
|
5668
|
+
function Ki(e) {
|
|
5483
5669
|
try {
|
|
5484
5670
|
let t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
|
|
5485
5671
|
if (r < 1) return "just now";
|
|
@@ -5490,7 +5676,7 @@ function ji(e) {
|
|
|
5490
5676
|
return e;
|
|
5491
5677
|
}
|
|
5492
5678
|
}
|
|
5493
|
-
var
|
|
5679
|
+
var qi = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
5494
5680
|
let [i, a] = u.useState(null), [o, s] = u.useState(!1), [c, l] = u.useState(!1), d = u.useMemo(() => t.find((e) => e.id === i) ?? null, [t, i]), f = u.useCallback(async () => {
|
|
5495
5681
|
if (!(!d || !n)) {
|
|
5496
5682
|
if (!o) {
|
|
@@ -5513,13 +5699,13 @@ var Mi = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5513
5699
|
s(!1);
|
|
5514
5700
|
}, []);
|
|
5515
5701
|
return /* @__PURE__ */ Q(O, {
|
|
5516
|
-
className:
|
|
5702
|
+
className: W("", r),
|
|
5517
5703
|
children: [/* @__PURE__ */ Z(A, {
|
|
5518
5704
|
className: "pb-3",
|
|
5519
5705
|
children: /* @__PURE__ */ Q(j, {
|
|
5520
5706
|
className: "flex items-center gap-2 text-base",
|
|
5521
5707
|
children: [
|
|
5522
|
-
/* @__PURE__ */ Z(
|
|
5708
|
+
/* @__PURE__ */ Z(Ve, { className: "h-4 w-4" }),
|
|
5523
5709
|
"Revision History",
|
|
5524
5710
|
/* @__PURE__ */ Q("span", {
|
|
5525
5711
|
className: "text-sm font-normal text-muted-foreground",
|
|
@@ -5546,12 +5732,12 @@ var Mi = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5546
5732
|
let t = e.id === i;
|
|
5547
5733
|
return /* @__PURE__ */ Q("button", {
|
|
5548
5734
|
type: "button",
|
|
5549
|
-
className:
|
|
5735
|
+
className: W("w-full text-left flex items-start gap-3 py-2 px-2 rounded-md transition-colors relative", t ? "bg-accent" : "hover:bg-accent/50"),
|
|
5550
5736
|
onClick: () => {
|
|
5551
5737
|
a(e.id), s(!1);
|
|
5552
5738
|
},
|
|
5553
5739
|
children: [/* @__PURE__ */ Z("div", {
|
|
5554
|
-
className:
|
|
5740
|
+
className: W("shrink-0 h-6 w-6 rounded-full border-2 flex items-center justify-center z-10 mt-0.5", t ? "border-primary bg-primary" : "border-border bg-background"),
|
|
5555
5741
|
children: t && /* @__PURE__ */ Z(De, { className: "h-3 w-3 text-primary-foreground" })
|
|
5556
5742
|
}), /* @__PURE__ */ Q("div", {
|
|
5557
5743
|
className: "flex-1 min-w-0",
|
|
@@ -5562,7 +5748,7 @@ var Mi = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5562
5748
|
children: e.user
|
|
5563
5749
|
}), /* @__PURE__ */ Z("span", {
|
|
5564
5750
|
className: "text-xs text-muted-foreground",
|
|
5565
|
-
children:
|
|
5751
|
+
children: Ki(e.timestamp)
|
|
5566
5752
|
})]
|
|
5567
5753
|
}), /* @__PURE__ */ Q("p", {
|
|
5568
5754
|
className: "text-xs text-muted-foreground mt-0.5",
|
|
@@ -5584,7 +5770,7 @@ var Mi = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5584
5770
|
children: [
|
|
5585
5771
|
/* @__PURE__ */ Q("div", {
|
|
5586
5772
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
5587
|
-
children: [/* @__PURE__ */ Z(
|
|
5773
|
+
children: [/* @__PURE__ */ Z(Le, { className: "h-4 w-4 text-muted-foreground" }), "Revision Preview"]
|
|
5588
5774
|
}),
|
|
5589
5775
|
/* @__PURE__ */ Z("div", {
|
|
5590
5776
|
className: "space-y-2",
|
|
@@ -5630,12 +5816,12 @@ var Mi = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5630
5816
|
}),
|
|
5631
5817
|
n && /* @__PURE__ */ Z("div", {
|
|
5632
5818
|
className: "pt-1 space-y-2",
|
|
5633
|
-
children: o ? /* @__PURE__ */ Q(
|
|
5819
|
+
children: o ? /* @__PURE__ */ Q(an, { children: [/* @__PURE__ */ Q("p", {
|
|
5634
5820
|
className: "text-xs text-amber-600 dark:text-amber-400",
|
|
5635
5821
|
children: [
|
|
5636
5822
|
"This will restore the record to its state at",
|
|
5637
5823
|
" ",
|
|
5638
|
-
|
|
5824
|
+
Ki(d.timestamp),
|
|
5639
5825
|
". Continue?"
|
|
5640
5826
|
]
|
|
5641
5827
|
}), /* @__PURE__ */ Q("div", {
|
|
@@ -5646,7 +5832,7 @@ var Mi = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5646
5832
|
className: "gap-1.5 flex-1",
|
|
5647
5833
|
onClick: f,
|
|
5648
5834
|
disabled: c,
|
|
5649
|
-
children: [/* @__PURE__ */ Z(
|
|
5835
|
+
children: [/* @__PURE__ */ Z(it, { className: "h-3.5 w-3.5" }), c ? "Restoring…" : "Confirm Restore"]
|
|
5650
5836
|
}), /* @__PURE__ */ Z(D, {
|
|
5651
5837
|
variant: "ghost",
|
|
5652
5838
|
size: "sm",
|
|
@@ -5659,14 +5845,14 @@ var Mi = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5659
5845
|
size: "sm",
|
|
5660
5846
|
className: "w-full gap-1.5",
|
|
5661
5847
|
onClick: f,
|
|
5662
|
-
children: [/* @__PURE__ */ Z(
|
|
5848
|
+
children: [/* @__PURE__ */ Z(it, { className: "h-3.5 w-3.5" }), "Restore to this point"]
|
|
5663
5849
|
})
|
|
5664
5850
|
})
|
|
5665
5851
|
]
|
|
5666
5852
|
})]
|
|
5667
5853
|
}) })]
|
|
5668
5854
|
});
|
|
5669
|
-
},
|
|
5855
|
+
}, Ji = ({ onSubmit: e, placeholder: t = "Leave a comment…", disabled: n = !1, className: r }) => {
|
|
5670
5856
|
let [i, a] = u.useState(""), [o, s] = u.useState(!1), c = u.useCallback(async () => {
|
|
5671
5857
|
let t = i.trim();
|
|
5672
5858
|
if (t) {
|
|
@@ -5681,7 +5867,7 @@ var Mi = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5681
5867
|
e.key === "Enter" && (e.ctrlKey || e.metaKey) && (e.preventDefault(), c());
|
|
5682
5868
|
}, [c]);
|
|
5683
5869
|
return /* @__PURE__ */ Q("div", {
|
|
5684
|
-
className:
|
|
5870
|
+
className: W("flex gap-2", r),
|
|
5685
5871
|
children: [/* @__PURE__ */ Z("textarea", {
|
|
5686
5872
|
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",
|
|
5687
5873
|
placeholder: t,
|
|
@@ -5696,24 +5882,24 @@ var Mi = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5696
5882
|
disabled: !i.trim() || o || n,
|
|
5697
5883
|
className: "shrink-0 self-end",
|
|
5698
5884
|
"aria-label": "Submit comment",
|
|
5699
|
-
children: /* @__PURE__ */ Z(
|
|
5885
|
+
children: /* @__PURE__ */ Z(st, { className: "h-4 w-4" })
|
|
5700
5886
|
})]
|
|
5701
5887
|
});
|
|
5702
|
-
},
|
|
5888
|
+
}, Yi = ({ query: e, suggestions: t, onSelect: n, visible: r = !0, activeIndex: i = 0, className: a }) => {
|
|
5703
5889
|
let o = u.useMemo(() => {
|
|
5704
5890
|
if (!e) return t;
|
|
5705
5891
|
let n = e.toLowerCase();
|
|
5706
5892
|
return t.filter((e) => e.name.toLowerCase().includes(n) || e.id.toLowerCase().includes(n));
|
|
5707
5893
|
}, [e, t]);
|
|
5708
5894
|
return !r || o.length === 0 ? null : /* @__PURE__ */ Z("div", {
|
|
5709
|
-
className:
|
|
5895
|
+
className: W("bg-popover border rounded-md shadow-md z-50 max-h-48 overflow-y-auto w-56", a),
|
|
5710
5896
|
role: "listbox",
|
|
5711
5897
|
"aria-label": "Mention suggestions",
|
|
5712
5898
|
children: o.map((e, t) => /* @__PURE__ */ Q("button", {
|
|
5713
5899
|
type: "button",
|
|
5714
5900
|
role: "option",
|
|
5715
5901
|
"aria-selected": t === i,
|
|
5716
|
-
className:
|
|
5902
|
+
className: W("w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 hover:bg-accent transition-colors", t === i && "bg-accent"),
|
|
5717
5903
|
onMouseDown: (t) => {
|
|
5718
5904
|
t.preventDefault(), n(e);
|
|
5719
5905
|
},
|
|
@@ -5741,7 +5927,7 @@ var Mi = ({ recordId: e, revisions: t, onRestore: n, className: r }) => {
|
|
|
5741
5927
|
}, e.id))
|
|
5742
5928
|
});
|
|
5743
5929
|
};
|
|
5744
|
-
function
|
|
5930
|
+
function Xi(e, t, n) {
|
|
5745
5931
|
return {
|
|
5746
5932
|
type: e.type,
|
|
5747
5933
|
id: e.id,
|
|
@@ -5752,7 +5938,7 @@ function Fi(e, t, n) {
|
|
|
5752
5938
|
}
|
|
5753
5939
|
//#endregion
|
|
5754
5940
|
//#region src/extractMentions.ts
|
|
5755
|
-
function
|
|
5941
|
+
function Zi(e, t) {
|
|
5756
5942
|
if (!e || !t.length) return [];
|
|
5757
5943
|
let n = [...t].sort((e, t) => t.label.length - e.label.length), r = e, i = /* @__PURE__ */ new Set();
|
|
5758
5944
|
for (let e of n) {
|
|
@@ -5764,10 +5950,10 @@ function Ii(e, t) {
|
|
|
5764
5950
|
}
|
|
5765
5951
|
//#endregion
|
|
5766
5952
|
//#region src/synth/buildDefaultPageSchema.ts
|
|
5767
|
-
function
|
|
5953
|
+
function Qi(e) {
|
|
5768
5954
|
return e == null ? [] : Array.isArray(e) ? e.filter((e) => e != null) : [e];
|
|
5769
5955
|
}
|
|
5770
|
-
function
|
|
5956
|
+
function $i(e, t) {
|
|
5771
5957
|
if (!e || !t) return null;
|
|
5772
5958
|
let n = e.fields?.[t]?.options;
|
|
5773
5959
|
return !Array.isArray(n) || n.length === 0 ? null : n.map((e) => ({
|
|
@@ -5775,7 +5961,7 @@ function Ri(e, t) {
|
|
|
5775
5961
|
label: e.label
|
|
5776
5962
|
}));
|
|
5777
5963
|
}
|
|
5778
|
-
function
|
|
5964
|
+
function ea(e) {
|
|
5779
5965
|
if (!e) return null;
|
|
5780
5966
|
let t = e.fields || {};
|
|
5781
5967
|
for (let n of [
|
|
@@ -5792,11 +5978,11 @@ function zi(e) {
|
|
|
5792
5978
|
]) if (e in t) return e;
|
|
5793
5979
|
return null;
|
|
5794
5980
|
}
|
|
5795
|
-
function
|
|
5981
|
+
function ta(e, t, n = 4) {
|
|
5796
5982
|
if (!e) return [];
|
|
5797
5983
|
let r = Array.isArray(e.highlightFields) && e.highlightFields.length > 0 ? e.highlightFields : null;
|
|
5798
5984
|
if (r) {
|
|
5799
|
-
let t =
|
|
5985
|
+
let t = ea(e);
|
|
5800
5986
|
return r.filter((e) => typeof e == "string" && e.length > 0 && e !== t).slice(0, n);
|
|
5801
5987
|
}
|
|
5802
5988
|
let i = /* @__PURE__ */ new Set([
|
|
@@ -5870,22 +6056,22 @@ function Bi(e, t, n = 4) {
|
|
|
5870
6056
|
}
|
|
5871
6057
|
return s;
|
|
5872
6058
|
}
|
|
5873
|
-
function
|
|
6059
|
+
function na(e, t = {}) {
|
|
5874
6060
|
return {
|
|
5875
6061
|
type: "page:header",
|
|
5876
6062
|
recordChrome: t.recordChrome !== !1,
|
|
5877
6063
|
...Array.isArray(t.actions) && t.actions.length > 0 ? { actions: t.actions } : {}
|
|
5878
6064
|
};
|
|
5879
6065
|
}
|
|
5880
|
-
function
|
|
6066
|
+
function ra(e, t) {
|
|
5881
6067
|
return !Array.isArray(t) || t.length === 0 ? null : {
|
|
5882
6068
|
type: "record:quick_actions",
|
|
5883
6069
|
actions: t,
|
|
5884
6070
|
location: "record_header"
|
|
5885
6071
|
};
|
|
5886
6072
|
}
|
|
5887
|
-
function
|
|
5888
|
-
let n = t.statusField ??
|
|
6073
|
+
function ia(e, t = {}) {
|
|
6074
|
+
let n = t.statusField ?? dn(e), r = t.stages ?? (n ? $i(e, n) : null), i = t.highlightFields ?? ta(e, n), a = [];
|
|
5889
6075
|
return !t.hideHighlights && i.length > 0 && a.push({
|
|
5890
6076
|
type: "record:highlights",
|
|
5891
6077
|
fields: i
|
|
@@ -5895,9 +6081,9 @@ function Ui(e, t = {}) {
|
|
|
5895
6081
|
stages: r
|
|
5896
6082
|
}), a;
|
|
5897
6083
|
}
|
|
5898
|
-
function
|
|
6084
|
+
function aa(e) {
|
|
5899
6085
|
if (!e) return null;
|
|
5900
|
-
let t =
|
|
6086
|
+
let t = mn(e);
|
|
5901
6087
|
if (!t) return null;
|
|
5902
6088
|
let n = e.fields || {}, r = (e) => {
|
|
5903
6089
|
let t = n[e] || {};
|
|
@@ -5911,7 +6097,7 @@ function Wi(e) {
|
|
|
5911
6097
|
...t.currency ? { currency: t.currency } : {},
|
|
5912
6098
|
...t.currencyConfig ? { currencyConfig: t.currencyConfig } : {}
|
|
5913
6099
|
};
|
|
5914
|
-
}, i =
|
|
6100
|
+
}, i = _n(t.reduce((e, t) => e + t.fields.length, 0));
|
|
5915
6101
|
return t.map((e) => ({
|
|
5916
6102
|
...e.key === void 0 ? {} : {
|
|
5917
6103
|
name: e.key,
|
|
@@ -5925,21 +6111,21 @@ function Wi(e) {
|
|
|
5925
6111
|
fields: e.fields.map(r)
|
|
5926
6112
|
}));
|
|
5927
6113
|
}
|
|
5928
|
-
function
|
|
5929
|
-
return Array.isArray(t) && t.length > 0 ? t :
|
|
6114
|
+
function oa(e, t) {
|
|
6115
|
+
return Array.isArray(t) && t.length > 0 ? t : aa(e) ?? void 0;
|
|
5930
6116
|
}
|
|
5931
|
-
function
|
|
6117
|
+
function sa(e, t, n) {
|
|
5932
6118
|
return {
|
|
5933
6119
|
type: "record:details",
|
|
5934
|
-
sections:
|
|
6120
|
+
sections: oa(e, t),
|
|
5935
6121
|
...n && n.length > 0 ? { hideFields: n } : {}
|
|
5936
6122
|
};
|
|
5937
6123
|
}
|
|
5938
|
-
function
|
|
5939
|
-
let n = t.statusField ??
|
|
6124
|
+
function ca(e, t = {}) {
|
|
6125
|
+
let n = t.statusField ?? dn(e), r = t.highlightFields ?? ta(e, n), i = [{
|
|
5940
6126
|
label: "Details",
|
|
5941
6127
|
value: "details",
|
|
5942
|
-
children: [
|
|
6128
|
+
children: [sa(e, t.sections, r)]
|
|
5943
6129
|
}];
|
|
5944
6130
|
if (!t.hideRelatedTab && Array.isArray(t.related) && t.related.length > 0) {
|
|
5945
6131
|
let e = (e) => ({
|
|
@@ -5975,7 +6161,7 @@ function qi(e, t = {}) {
|
|
|
5975
6161
|
return e?.enable?.files === !0 && !t.hideAttachments && i.push({
|
|
5976
6162
|
label: "Attachments",
|
|
5977
6163
|
value: "attachments",
|
|
5978
|
-
children: [
|
|
6164
|
+
children: [ua()]
|
|
5979
6165
|
}), t.showActivity && i.push({
|
|
5980
6166
|
label: "Activity",
|
|
5981
6167
|
value: "activity",
|
|
@@ -5995,18 +6181,18 @@ function qi(e, t = {}) {
|
|
|
5995
6181
|
items: i
|
|
5996
6182
|
};
|
|
5997
6183
|
}
|
|
5998
|
-
function
|
|
6184
|
+
function la() {
|
|
5999
6185
|
return { type: "record:discussion" };
|
|
6000
6186
|
}
|
|
6001
|
-
function
|
|
6187
|
+
function ua() {
|
|
6002
6188
|
return { type: "record:attachments" };
|
|
6003
6189
|
}
|
|
6004
|
-
function
|
|
6190
|
+
function da(e, t = {}) {
|
|
6005
6191
|
let n = t.slots || {}, r = [];
|
|
6006
|
-
"header" in n && n.header !== void 0 ? r.push(...
|
|
6192
|
+
"header" in n && n.header !== void 0 ? r.push(...Qi(n.header)) : r.push(na(e, {
|
|
6007
6193
|
recordChrome: t.recordChrome,
|
|
6008
6194
|
actions: t.headerActions
|
|
6009
|
-
})), "actions" in n && n.actions !== void 0 && r.push(...
|
|
6195
|
+
})), "actions" in n && n.actions !== void 0 && r.push(...Qi(n.actions)), "alerts" in n && n.alerts !== void 0 && r.push(...Qi(n.alerts)), "highlights" in n && n.highlights !== void 0 ? r.push(...Qi(n.highlights)) : r.push(...ia(e, {
|
|
6010
6196
|
highlightFields: t.highlightFields,
|
|
6011
6197
|
statusField: t.statusField,
|
|
6012
6198
|
stages: t.stages,
|
|
@@ -6014,9 +6200,9 @@ function Xi(e, t = {}) {
|
|
|
6014
6200
|
hidePath: t.hidePath
|
|
6015
6201
|
}));
|
|
6016
6202
|
let i = t.showReferenceRail === !0 && !t.hideReferenceRail && Array.isArray(t.related) && t.related.length >= 2, a = t.hideRelatedTab ?? i;
|
|
6017
|
-
if ("tabs" in n && n.tabs !== void 0) r.push(...
|
|
6203
|
+
if ("tabs" in n && n.tabs !== void 0) r.push(...Qi(n.tabs));
|
|
6018
6204
|
else if ("details" in n && n.details !== void 0) {
|
|
6019
|
-
let i =
|
|
6205
|
+
let i = Qi(n.details), o = ca(e, {
|
|
6020
6206
|
sections: t.sections,
|
|
6021
6207
|
related: t.related,
|
|
6022
6208
|
showActivity: t.showActivity,
|
|
@@ -6031,7 +6217,7 @@ function Xi(e, t = {}) {
|
|
|
6031
6217
|
...o.items[0],
|
|
6032
6218
|
children: i
|
|
6033
6219
|
}), r.push(o);
|
|
6034
|
-
} else r.push(
|
|
6220
|
+
} else r.push(ca(e, {
|
|
6035
6221
|
sections: t.sections,
|
|
6036
6222
|
related: t.related,
|
|
6037
6223
|
showActivity: t.showActivity,
|
|
@@ -6042,12 +6228,12 @@ function Xi(e, t = {}) {
|
|
|
6042
6228
|
relatedLayout: t.relatedLayout,
|
|
6043
6229
|
hideAttachments: t.hideAttachments
|
|
6044
6230
|
}));
|
|
6045
|
-
"discussion" in n && n.discussion !== void 0 ? r.push(...
|
|
6231
|
+
"discussion" in n && n.discussion !== void 0 ? r.push(...Qi(n.discussion)) : t.hideDiscussion || r.push(la());
|
|
6046
6232
|
let o = [{
|
|
6047
6233
|
name: "main",
|
|
6048
6234
|
width: "full",
|
|
6049
6235
|
components: r
|
|
6050
|
-
}], s =
|
|
6236
|
+
}], s = Qi(n.rightRail);
|
|
6051
6237
|
if (i || s.length > 0) {
|
|
6052
6238
|
let e = [];
|
|
6053
6239
|
i && e.push({
|
|
@@ -6075,7 +6261,7 @@ function Xi(e, t = {}) {
|
|
|
6075
6261
|
regions: o
|
|
6076
6262
|
};
|
|
6077
6263
|
}
|
|
6078
|
-
e.register("detail-view",
|
|
6264
|
+
e.register("detail-view", hr, {
|
|
6079
6265
|
namespace: "plugin-detail",
|
|
6080
6266
|
label: "Detail View",
|
|
6081
6267
|
category: "Views",
|
|
@@ -6205,7 +6391,7 @@ e.register("detail-view", dr, {
|
|
|
6205
6391
|
tabs: [],
|
|
6206
6392
|
related: []
|
|
6207
6393
|
}
|
|
6208
|
-
}), e.register("detail-section",
|
|
6394
|
+
}), e.register("detail-section", Nn, {
|
|
6209
6395
|
namespace: "plugin-detail",
|
|
6210
6396
|
label: "Detail Section",
|
|
6211
6397
|
category: "Detail Components",
|
|
@@ -6256,7 +6442,7 @@ e.register("detail-view", dr, {
|
|
|
6256
6442
|
label: "Header Color"
|
|
6257
6443
|
}
|
|
6258
6444
|
]
|
|
6259
|
-
}), e.register("related-list",
|
|
6445
|
+
}), e.register("related-list", Rn, {
|
|
6260
6446
|
namespace: "plugin-detail",
|
|
6261
6447
|
label: "Related List",
|
|
6262
6448
|
category: "Detail Components",
|
|
@@ -6303,7 +6489,7 @@ e.register("detail-view", dr, {
|
|
|
6303
6489
|
label: "Columns"
|
|
6304
6490
|
}
|
|
6305
6491
|
]
|
|
6306
|
-
}), e.register("detail",
|
|
6492
|
+
}), e.register("detail", hr, {
|
|
6307
6493
|
namespace: "view",
|
|
6308
6494
|
category: "view",
|
|
6309
6495
|
label: "Detail",
|
|
@@ -6326,7 +6512,7 @@ e.register("detail-view", dr, {
|
|
|
6326
6512
|
label: "Fields"
|
|
6327
6513
|
}
|
|
6328
6514
|
]
|
|
6329
|
-
}), e.register("details",
|
|
6515
|
+
}), e.register("details", vr, {
|
|
6330
6516
|
namespace: "record",
|
|
6331
6517
|
skipFallback: !0,
|
|
6332
6518
|
category: "record",
|
|
@@ -6367,7 +6553,7 @@ e.register("detail-view", dr, {
|
|
|
6367
6553
|
description: "Explicit field list (overrides highlightFields)"
|
|
6368
6554
|
}
|
|
6369
6555
|
]
|
|
6370
|
-
}), e.register("related_list",
|
|
6556
|
+
}), e.register("related_list", Cr, {
|
|
6371
6557
|
namespace: "record",
|
|
6372
6558
|
skipFallback: !0,
|
|
6373
6559
|
category: "record",
|
|
@@ -6431,7 +6617,7 @@ e.register("detail-view", dr, {
|
|
|
6431
6617
|
description: "Action IDs available for related records"
|
|
6432
6618
|
}
|
|
6433
6619
|
]
|
|
6434
|
-
}), e.register("highlights",
|
|
6620
|
+
}), e.register("highlights", Tr, {
|
|
6435
6621
|
namespace: "record",
|
|
6436
6622
|
skipFallback: !0,
|
|
6437
6623
|
category: "record",
|
|
@@ -6451,7 +6637,7 @@ e.register("detail-view", dr, {
|
|
|
6451
6637
|
defaultValue: "horizontal",
|
|
6452
6638
|
description: "Layout orientation for highlight fields"
|
|
6453
6639
|
}]
|
|
6454
|
-
}), e.register("activity",
|
|
6640
|
+
}), e.register("activity", ni, {
|
|
6455
6641
|
namespace: "record",
|
|
6456
6642
|
skipFallback: !0,
|
|
6457
6643
|
category: "record",
|
|
@@ -6462,66 +6648,86 @@ e.register("detail-view", dr, {
|
|
|
6462
6648
|
name: "types",
|
|
6463
6649
|
type: "array",
|
|
6464
6650
|
label: "Activity Types",
|
|
6465
|
-
description: "
|
|
6651
|
+
description: "Allow-list of feed item types to show (comment, field_change, task, event, email, call, note, file, record_create, record_delete, approval, sharing, system). Omit for all; unrecognised entries are ignored."
|
|
6466
6652
|
},
|
|
6467
6653
|
{
|
|
6468
6654
|
name: "filterMode",
|
|
6469
|
-
type: "
|
|
6655
|
+
type: "enum",
|
|
6470
6656
|
label: "Filter Mode",
|
|
6471
|
-
|
|
6657
|
+
enum: [
|
|
6658
|
+
"all",
|
|
6659
|
+
"comments_only",
|
|
6660
|
+
"changes_only",
|
|
6661
|
+
"tasks_only"
|
|
6662
|
+
],
|
|
6663
|
+
defaultValue: "all",
|
|
6664
|
+
description: "Filter the timeline dropdown starts on. The user can still change it; an unrecognised value falls back to \"all\"."
|
|
6472
6665
|
},
|
|
6473
6666
|
{
|
|
6474
6667
|
name: "showFilterToggle",
|
|
6475
6668
|
type: "boolean",
|
|
6476
6669
|
label: "Show Filter Toggle",
|
|
6477
|
-
|
|
6670
|
+
defaultValue: !0,
|
|
6671
|
+
description: "Expose the activity-type filter dropdown in the panel header"
|
|
6478
6672
|
},
|
|
6479
6673
|
{
|
|
6480
6674
|
name: "limit",
|
|
6481
6675
|
type: "number",
|
|
6482
6676
|
label: "Limit",
|
|
6483
|
-
|
|
6677
|
+
defaultValue: 20,
|
|
6678
|
+
description: "Items per page. Also caps the scoped sys_activity read; \"Load more\" grows the window by this much."
|
|
6484
6679
|
},
|
|
6485
6680
|
{
|
|
6486
6681
|
name: "showCompleted",
|
|
6487
6682
|
type: "boolean",
|
|
6488
6683
|
label: "Show Completed",
|
|
6489
|
-
|
|
6684
|
+
defaultValue: !1,
|
|
6685
|
+
description: "Include completed activities (sys_activity type \"completed\", which surfaces as a task item). Off by default."
|
|
6490
6686
|
},
|
|
6491
6687
|
{
|
|
6492
6688
|
name: "unifiedTimeline",
|
|
6493
6689
|
type: "boolean",
|
|
6494
6690
|
label: "Unified Timeline",
|
|
6495
|
-
|
|
6691
|
+
defaultValue: !0,
|
|
6692
|
+
description: "Mix field changes and comments in one timeline (Airtable style). Off keeps the panel a discussion stream — field changes stay in record:history."
|
|
6496
6693
|
},
|
|
6497
6694
|
{
|
|
6498
6695
|
name: "showCommentInput",
|
|
6499
6696
|
type: "boolean",
|
|
6500
|
-
label: "Show Comment Input"
|
|
6697
|
+
label: "Show Comment Input",
|
|
6698
|
+
defaultValue: !0,
|
|
6699
|
+
description: "Show the composer. Requires a host discussion context to persist the comment (record detail pages provide one); without it the feed is read-only."
|
|
6501
6700
|
},
|
|
6502
6701
|
{
|
|
6503
6702
|
name: "enableMentions",
|
|
6504
6703
|
type: "boolean",
|
|
6505
|
-
label: "Enable @mentions"
|
|
6704
|
+
label: "Enable @mentions",
|
|
6705
|
+
defaultValue: !0,
|
|
6706
|
+
description: "Offer @-mention autocomplete in the composer, from the host discussion context's user list. Off withholds the suggestions."
|
|
6506
6707
|
},
|
|
6507
6708
|
{
|
|
6508
6709
|
name: "enableReactions",
|
|
6509
6710
|
type: "boolean",
|
|
6510
|
-
label: "Enable Reactions"
|
|
6711
|
+
label: "Enable Reactions",
|
|
6712
|
+
defaultValue: !1,
|
|
6713
|
+
description: "Show emoji reactions on feed items. Toggling one requires a host discussion context; without it existing reactions still render, read-only."
|
|
6511
6714
|
},
|
|
6512
6715
|
{
|
|
6513
6716
|
name: "enableThreading",
|
|
6514
6717
|
type: "boolean",
|
|
6515
|
-
label: "Enable Threaded Replies"
|
|
6718
|
+
label: "Enable Threaded Replies",
|
|
6719
|
+
defaultValue: !1,
|
|
6720
|
+
description: "Group replies under their parent comment. Posting a reply requires a host discussion context."
|
|
6516
6721
|
},
|
|
6517
6722
|
{
|
|
6518
6723
|
name: "showSubscriptionToggle",
|
|
6519
6724
|
type: "boolean",
|
|
6520
|
-
label: "Show Subscribe Toggle"
|
|
6725
|
+
label: "Show Subscribe Toggle",
|
|
6726
|
+
description: "NOT IMPLEMENTED — no record-subscription backend exists yet, so this renders nothing whatever it is set to. Declared for spec parity only (objectui#3165)."
|
|
6521
6727
|
}
|
|
6522
6728
|
]
|
|
6523
6729
|
});
|
|
6524
|
-
var
|
|
6730
|
+
var fa = [
|
|
6525
6731
|
{
|
|
6526
6732
|
name: "position",
|
|
6527
6733
|
type: "enum",
|
|
@@ -6558,21 +6764,21 @@ var Zi = [
|
|
|
6558
6764
|
description: "Activity-feed config nested inside the panel — same shape as record:activity"
|
|
6559
6765
|
}
|
|
6560
6766
|
];
|
|
6561
|
-
e.register("chatter",
|
|
6767
|
+
e.register("chatter", ai, {
|
|
6562
6768
|
namespace: "record",
|
|
6563
6769
|
skipFallback: !0,
|
|
6564
6770
|
category: "record",
|
|
6565
6771
|
label: "Chatter Feed",
|
|
6566
6772
|
icon: "MessageSquare",
|
|
6567
|
-
inputs:
|
|
6568
|
-
}), e.register("discussion",
|
|
6773
|
+
inputs: fa
|
|
6774
|
+
}), e.register("discussion", ai, {
|
|
6569
6775
|
namespace: "record",
|
|
6570
6776
|
skipFallback: !0,
|
|
6571
6777
|
category: "record",
|
|
6572
6778
|
label: "Discussion",
|
|
6573
6779
|
icon: "MessageSquare",
|
|
6574
|
-
inputs:
|
|
6575
|
-
}), e.register("path",
|
|
6780
|
+
inputs: fa
|
|
6781
|
+
}), e.register("path", si, {
|
|
6576
6782
|
namespace: "record",
|
|
6577
6783
|
skipFallback: !0,
|
|
6578
6784
|
category: "record",
|
|
@@ -6590,7 +6796,7 @@ e.register("chatter", Wr, {
|
|
|
6590
6796
|
label: "Stages",
|
|
6591
6797
|
description: "Explicit stage definitions [{ value, label }] (else derived from field metadata)"
|
|
6592
6798
|
}]
|
|
6593
|
-
}), e.register("quick_actions",
|
|
6799
|
+
}), e.register("quick_actions", li, {
|
|
6594
6800
|
namespace: "record",
|
|
6595
6801
|
skipFallback: !0,
|
|
6596
6802
|
category: "record",
|
|
@@ -6613,7 +6819,7 @@ e.register("chatter", Wr, {
|
|
|
6613
6819
|
name: "location",
|
|
6614
6820
|
type: "enum",
|
|
6615
6821
|
label: "Location",
|
|
6616
|
-
enum: [...
|
|
6822
|
+
enum: [...cn],
|
|
6617
6823
|
defaultValue: "record_header",
|
|
6618
6824
|
description: "Which declared action location this bar renders"
|
|
6619
6825
|
},
|
|
@@ -6649,7 +6855,7 @@ e.register("chatter", Wr, {
|
|
|
6649
6855
|
description: "Passed to the Button primitive; a per-action size overrides it"
|
|
6650
6856
|
}
|
|
6651
6857
|
]
|
|
6652
|
-
}), e.register("history",
|
|
6858
|
+
}), e.register("history", pi, {
|
|
6653
6859
|
namespace: "record",
|
|
6654
6860
|
skipFallback: !0,
|
|
6655
6861
|
category: "record",
|
|
@@ -6676,7 +6882,7 @@ e.register("chatter", Wr, {
|
|
|
6676
6882
|
description: "Copy substituted when an entry has no resolvable actor"
|
|
6677
6883
|
}
|
|
6678
6884
|
]
|
|
6679
|
-
}), e.register("reference_rail",
|
|
6885
|
+
}), e.register("reference_rail", _i, {
|
|
6680
6886
|
namespace: "record",
|
|
6681
6887
|
skipFallback: !0,
|
|
6682
6888
|
category: "record",
|
|
@@ -6689,7 +6895,7 @@ e.register("chatter", Wr, {
|
|
|
6689
6895
|
defaultValue: !0,
|
|
6690
6896
|
description: "Drop the rail entirely when no entries resolve"
|
|
6691
6897
|
}]
|
|
6692
|
-
}), e.register("alert",
|
|
6898
|
+
}), e.register("alert", bi, {
|
|
6693
6899
|
namespace: "record",
|
|
6694
6900
|
skipFallback: !0,
|
|
6695
6901
|
category: "record",
|
|
@@ -6750,9 +6956,9 @@ e.register("chatter", Wr, {
|
|
|
6750
6956
|
description: "Stable key the dismissal is remembered under"
|
|
6751
6957
|
}
|
|
6752
6958
|
]
|
|
6753
|
-
}), e.register("permission-facet-link",
|
|
6959
|
+
}), e.register("permission-facet-link", wn, {
|
|
6754
6960
|
namespace: "field",
|
|
6755
6961
|
skipFallback: !0
|
|
6756
6962
|
});
|
|
6757
6963
|
//#endregion
|
|
6758
|
-
export {
|
|
6964
|
+
export { Jn as ActivityTimeline, Lr as CommentAttachment, Ji as CommentInput, Ci as ConcurrentUpdateDialog, xn as DETAIL_DEFAULT_TRANSLATIONS, Nn as DetailSection, Pn as DetailTabs, hr as DetailView, Ri as DiffView, Er as FieldChangeItem, Bn as HeaderHighlight, tr as HistoryTimeline, Ni as InlineCreateRelated, Di as InlineEditSaveBar, On as InlineFieldInput, Yi as MentionAutocomplete, qi as PointInTimeRestore, Or as ReactionPicker, ni as RecordActivityRenderer, Ur as RecordActivityTimeline, bi as RecordAlertRenderer, ri as RecordChatterPanel, ai as RecordChatterRenderer, Hn as RecordComments, ji as RecordDetailDrawer, vr as RecordDetailsRenderer, Tr as RecordHighlightsRenderer, pi as RecordHistoryRenderer, cr as RecordMetaFooter, zi as RecordNavigationEnhanced, si as RecordPathRenderer, li as RecordQuickActionsRenderer, _i as RecordReferenceRailRenderer, Cr as RecordRelatedListRenderer, Rn as RelatedList, Gi as RelationshipGraph, Nr as RichTextCommentInput, zn as SectionGroup, jr as SubscriptionToggle, En as TEXTUAL_REF_FALLBACK_TYPES, Ar as ThreadedReplies, dr as __clearRecordEditableCache, vn as applyAutoSpan, yn as applyDetailAutoLayout, ra as buildDefaultActions, sa as buildDefaultDetails, la as buildDefaultDiscussion, na as buildDefaultHeader, ia as buildDefaultHighlights, da as buildDefaultPageSchema, ca as buildDefaultTabs, Xi as createMentionFromSuggestion, bn as createSafeTranslationHook, aa as deriveFieldGroupDetailSections, ta as deriveHighlightFields, Mi as deriveRecordPageHref, $i as deriveStages, dn as detectStatusField, Dn as extractLookupId, Zi as extractMentions, _n as inferDetailColumns, wi as isConcurrentUpdateError, gn as isWideFieldType, oa as resolveDetailSections, ea as resolveTitleField, $ as useDetailTranslation, ur as useRecordEditable };
|