@nivaro/react 0.3.136 → 0.3.138
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/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +95 -4
- package/dist/index.js +748 -743
- package/dist/shared/components/CollectionBrowserView.js +392 -389
- package/dist/shared/components/DelegateCoverLine.js +80 -87
- package/dist/shared/components/ItemEditForm.js +589 -588
- package/dist/shared/components/MyWorkView.js +284 -286
- package/dist/shared/components/NotificationBell.js +251 -205
- package/dist/shared/components/ai/AiAnalyticsView.js +878 -417
- package/dist/shared/components/ai/AiPlanCard.js +164 -122
- package/dist/shared/components/ai/AiPlanUndo.js +291 -0
- package/dist/shared/components/ai/call-log/CallDrawer.js +357 -0
- package/dist/shared/components/ai/call-log/RawJson.js +126 -0
- package/dist/shared/components/ai/call-log/ThreadView.js +223 -0
- package/dist/shared/components/ai/call-log/TranscriptView.js +227 -0
- package/dist/shared/components/ai/call-log/controls.js +364 -0
- package/dist/shared/components/ai/call-log/format.js +46 -0
- package/dist/shared/components/ai/call-log/url.js +105 -0
- package/dist/shared/components/chat/ChatPanel.js +86 -86
- package/dist/shared/components/chat/chat-core.js +422 -346
- package/dist/shared/components/integrations/IntegrationObligationsView.js +98 -98
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +102 -93
- package/dist/shared/components/integrations/console/api.js +11 -1
- package/dist/shared/components/item-edit/HeaderRollupExplainer.js +5 -1
- package/dist/shared/components/item-edit/RecordLiveSync.js +241 -229
- package/dist/shared/components/item-edit/RecordRecapChanges.js +166 -0
- package/dist/shared/components/item-edit/RecordRecapStrip.js +254 -84
- package/dist/shared/components/item-edit/live-related.js +34 -18
- package/dist/shared/components/panels/RevisionsPanel.js +735 -683
- package/dist/shared/components/queue/QueueWorklist.js +323 -316
- package/dist/shared/components/support/SupportRequestDialog.js +198 -181
- package/dist/shared/components/trackers/use-tracker-link.js +74 -65
- package/dist/shared/lib/config-update-refresh.js +34 -0
- package/dist/shared/lib/config-watch.js +17 -17
- package/dist/shared/lib/gap-refresh.js +49 -0
- package/dist/shared/lib/integration-dots.js +8 -8
- package/dist/shared/lib/live-ops.js +26 -23
- package/dist/shared/lib/live-pickers.js +1 -1
- package/dist/shared/lib/live-queries.js +223 -195
- package/dist/shared/lib/live.js +56 -51
- package/dist/shared/lib/obligation-banner.js +11 -10
- package/dist/shared/lib/obligation-filters.js +22 -18
- package/dist/shared/lib/obligation-reason-text.js +18 -8
- package/dist/shared/lib/presence-hooks.js +133 -132
- package/dist/shared/lib/reconnect-resync.js +90 -0
- package/dist/shared/lib/record-room-holds.js +43 -0
- package/dist/shared/lib/socket-realtime.js +116 -105
- package/dist/shared/lib/user-sync.js +1 -6
- package/package.json +1 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { jsxs as r, jsx as t, Fragment as
|
|
1
|
+
import { jsxs as r, jsx as t, Fragment as ee } from "react/jsx-runtime";
|
|
2
2
|
import { useSensors as Mt, useSensor as Ze, PointerSensor as jt, KeyboardSensor as qt, DndContext as Pt, closestCenter as Et } from "@dnd-kit/core";
|
|
3
3
|
import { sortableKeyboardCoordinates as It, SortableContext as Kt, verticalListSortingStrategy as Vt, arrayMove as zt, useSortable as Bt } from "@dnd-kit/sortable";
|
|
4
4
|
import { CSS as Ut } from "@dnd-kit/utilities";
|
|
5
|
-
import { useQuery as
|
|
6
|
-
import { Clock as
|
|
7
|
-
import { useState as
|
|
8
|
-
import { toast as
|
|
5
|
+
import { useQuery as le, useQueryClient as Te, useMutation as je } from "@tanstack/react-query";
|
|
6
|
+
import { Clock as qe, List as Wt, Table2 as Ht, Sigma as Se, Download as Xe, ChevronDown as Ve, FileSpreadsheet as Jt, GitCompareArrows as pt, ArrowRight as ze, X as ht, GripVertical as ut, Zap as Ae, Search as Qt, Columns3 as Yt, ChevronsUpDown as Gt, History as Zt, ChevronRight as Pe, MessageSquare as Xt, RotateCcw as xt, Check as ea, ChevronLeft as ta, Pause as aa, Play as ra, CalendarClock as sa } from "lucide-react";
|
|
7
|
+
import { useState as A, useEffect as _e, useRef as Be, useMemo as M, useId as na, createContext as la, useContext as bt } from "react";
|
|
8
|
+
import { toast as ne } from "sonner";
|
|
9
9
|
import { useNivaroClient as ce, useItemEditAuth as oa } from "../../context.js";
|
|
10
10
|
import { o2mSentence as ia, o2mTotalsText as et, activityPredicate as da, activityWhy as ca, actorName as ma } from "../../lib/activity-sentence.js";
|
|
11
|
-
import { get as
|
|
11
|
+
import { get as X, post as Ne } from "../../lib/commands.js";
|
|
12
12
|
import { compareValueText as Ue } from "../../lib/compare-value.js";
|
|
13
|
-
import { isEditorJsValue as
|
|
14
|
-
import { toastError as
|
|
13
|
+
import { isEditorJsValue as We, editorJsToText as pa, editorJsToHtml as ha } from "../../lib/editorjs.js";
|
|
14
|
+
import { toastError as Oe } from "../../lib/error-toast.js";
|
|
15
15
|
import { useLiveRecordQueries as ft } from "../../lib/live.js";
|
|
16
16
|
import { restoreSkippedNote as tt } from "../../lib/restore-skipped.js";
|
|
17
17
|
import { useRevisionPrefs as gt, useSharedColumnSets as ua } from "../../lib/revision-prefs.js";
|
|
18
|
-
import { cn as
|
|
19
|
-
import { xlsxBlob as
|
|
18
|
+
import { cn as P, formatDateTime as G, toLocalDateString as fe, titleCase as ye } from "../../lib/utils.js";
|
|
19
|
+
import { xlsxBlob as xa } from "../../lib/xlsx-lite.js";
|
|
20
20
|
import { useActivityLabels as yt } from "../ActivityEntry.js";
|
|
21
|
-
import { AgentBadge as
|
|
21
|
+
import { AgentBadge as ba } from "../AgentBadge.js";
|
|
22
22
|
import { HScrollProxy as fa } from "../HScrollProxy.js";
|
|
23
23
|
import { RelatedItemLabel as ga } from "../item-edit/RelationCombobox.js";
|
|
24
24
|
import { UserChip as ya } from "../item-edit/UserChip.js";
|
|
@@ -32,7 +32,7 @@ import { Sheet as Da, SheetTrigger as La, SheetContent as Aa, SheetHeader as Oa,
|
|
|
32
32
|
import { Skeleton as vt } from "../ui/skeleton.js";
|
|
33
33
|
import { IntegrationActivitySection as ja } from "./IntegrationActivitySection.js";
|
|
34
34
|
import { buildSaveRows as kt, withLinkLabels as wt, valueAt as qa, sameValue as Pa, matrixColumns as Ea, STEP_FIELD as ge, rowsChanging as Ia, saveActionLabel as nt, deriveOf as Ka, matrixCsv as Va, recalcReason as za, signedAmount as Ba } from "./revision-changes.js";
|
|
35
|
-
import { inDateRange as Ua, ColumnSetsMenu as
|
|
35
|
+
import { inDateRange as Ua, ColumnSetsMenu as Wa, PeopleFilter as Ha, DateRangeFilter as Ja, FieldTrend as Qa } from "./revision-table-parts.js";
|
|
36
36
|
const Ie = (e) => e.id != null && (e.action === "create" || e.action === "update" || e.action === "delete" || e.action === "restore"), Ya = (e) => !Ie(e), oe = (e) => {
|
|
37
37
|
var n;
|
|
38
38
|
return e.id != null ? `r${e.id}` : `e${((n = e.event) == null ? void 0 : n.history_id) ?? ""}-${e.activity ?? ""}-${e.timestamp ?? ""}`;
|
|
@@ -48,45 +48,45 @@ const Ie = (e) => e.id != null && (e.action === "create" || e.action === "update
|
|
|
48
48
|
"updated_at",
|
|
49
49
|
"sort"
|
|
50
50
|
]);
|
|
51
|
-
function
|
|
52
|
-
const i = ce(), { data: a } =
|
|
51
|
+
function He(e, n) {
|
|
52
|
+
const i = ce(), { data: a } = le({
|
|
53
53
|
queryKey: ["revisions-field-meta", e],
|
|
54
54
|
enabled: n,
|
|
55
55
|
staleTime: 3e5,
|
|
56
56
|
queryFn: async () => {
|
|
57
|
-
const [
|
|
58
|
-
i.request(
|
|
57
|
+
const [m, o, u] = await Promise.all([
|
|
58
|
+
i.request(X(`/field-config/${e}`)).then((l) => l.data ?? []).catch(() => []),
|
|
59
59
|
i.request(
|
|
60
|
-
|
|
60
|
+
X(`/collections/${e}`)
|
|
61
61
|
).then((l) => {
|
|
62
|
-
var
|
|
63
|
-
return ((
|
|
62
|
+
var b;
|
|
63
|
+
return ((b = l.data) == null ? void 0 : b.relations) ?? [];
|
|
64
64
|
}).catch(() => []),
|
|
65
65
|
i.request(
|
|
66
|
-
|
|
66
|
+
X(`/field-groups/${e}`)
|
|
67
67
|
).then((l) => l.data ?? []).catch(() => [])
|
|
68
68
|
]);
|
|
69
|
-
return { fields:
|
|
69
|
+
return { fields: m, relations: o, groups: u };
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
return
|
|
72
|
+
return M(() => {
|
|
73
73
|
var l;
|
|
74
|
-
const
|
|
74
|
+
const m = /* @__PURE__ */ new Map(), o = (b) => {
|
|
75
75
|
const c = ((a == null ? void 0 : a.relations) ?? []).find(
|
|
76
|
-
(
|
|
76
|
+
(v) => v.many_collection === e && v.many_field === b && v.junction_field == null
|
|
77
77
|
);
|
|
78
78
|
return c != null && c.one_collection ? c.one_collection === "directus_users" ? "nivaro_users" : c.one_collection : null;
|
|
79
|
-
},
|
|
80
|
-
for (const [
|
|
81
|
-
|
|
79
|
+
}, u = /* @__PURE__ */ new Map();
|
|
80
|
+
for (const [b, c] of ((a == null ? void 0 : a.groups) ?? []).entries())
|
|
81
|
+
u.set(c.key, {
|
|
82
82
|
key: c.key,
|
|
83
83
|
label: ((l = c.label) == null ? void 0 : l.trim()) || ye(c.key.replace(/_/g, " ")),
|
|
84
|
-
sort: c.sort ??
|
|
84
|
+
sort: c.sort ?? b
|
|
85
85
|
});
|
|
86
|
-
for (const [
|
|
87
|
-
c.field.startsWith("__") ||
|
|
88
|
-
order:
|
|
89
|
-
section: c.group_key ?
|
|
86
|
+
for (const [b, c] of ((a == null ? void 0 : a.fields) ?? []).entries())
|
|
87
|
+
c.field.startsWith("__") || m.set(c.field, {
|
|
88
|
+
order: b,
|
|
89
|
+
section: c.group_key ? u.get(c.group_key) ?? null : null,
|
|
90
90
|
derive: Ka(c.computed_type, c.computed_formula),
|
|
91
91
|
cmp: {
|
|
92
92
|
field: c.field,
|
|
@@ -106,10 +106,10 @@ function We(e, n) {
|
|
|
106
106
|
relatedCollection: o(c.field),
|
|
107
107
|
dateOnly: String(c.type ?? "").toLowerCase() === "date"
|
|
108
108
|
});
|
|
109
|
-
return
|
|
109
|
+
return m;
|
|
110
110
|
}, [a, e]);
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function F(e, n) {
|
|
113
113
|
return e.get(n) ?? {
|
|
114
114
|
// Unknown to the form = machine column. Still labeled, still reachable.
|
|
115
115
|
label: ye(n.replace(/[_-]/g, " ")),
|
|
@@ -118,7 +118,7 @@ function T(e, n) {
|
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
function Za({ map: e, field: n }) {
|
|
121
|
-
const i =
|
|
121
|
+
const i = F(e, n);
|
|
122
122
|
return /* @__PURE__ */ t(
|
|
123
123
|
"span",
|
|
124
124
|
{
|
|
@@ -141,13 +141,13 @@ function Nt(e, n = !1) {
|
|
|
141
141
|
}
|
|
142
142
|
return typeof e == "object" ? JSON.stringify(e) : String(e);
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function $e(e) {
|
|
145
145
|
return e == null ? "" : typeof e == "object" ? JSON.stringify(e) : String(e);
|
|
146
146
|
}
|
|
147
147
|
function Ct({ collection: e, id: n }) {
|
|
148
|
-
const i = ce(), { data: a } =
|
|
148
|
+
const i = ce(), { data: a } = le({
|
|
149
149
|
queryKey: ["col-meta", e],
|
|
150
|
-
queryFn: () => i.request(
|
|
150
|
+
queryFn: () => i.request(X(`/collections/${e}`)).then((m) => m.data),
|
|
151
151
|
staleTime: 3e5,
|
|
152
152
|
retry: !1
|
|
153
153
|
});
|
|
@@ -161,26 +161,26 @@ function Ct({ collection: e, id: n }) {
|
|
|
161
161
|
) });
|
|
162
162
|
}
|
|
163
163
|
function St(e) {
|
|
164
|
-
return
|
|
164
|
+
return We(e) ? pa(e) : Ke(e).join(" ");
|
|
165
165
|
}
|
|
166
166
|
const ot = 160;
|
|
167
|
-
function
|
|
167
|
+
function Me({
|
|
168
168
|
value: e,
|
|
169
169
|
tone: n,
|
|
170
170
|
dateOnly: i
|
|
171
171
|
}) {
|
|
172
|
-
const [a,
|
|
172
|
+
const [a, m] = A(!1), o = Nt(e, i);
|
|
173
173
|
if (o === "")
|
|
174
174
|
return /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" });
|
|
175
|
-
const
|
|
175
|
+
const u = o.length > ot, l = a || !u ? o : `${o.slice(0, ot)}…`;
|
|
176
176
|
return /* @__PURE__ */ r("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: [
|
|
177
177
|
typeof e == "object" ? /* @__PURE__ */ t("span", { className: "font-mono text-[11px]", children: l }) : l,
|
|
178
|
-
|
|
178
|
+
u && /* @__PURE__ */ t(
|
|
179
179
|
"button",
|
|
180
180
|
{
|
|
181
181
|
type: "button",
|
|
182
|
-
onClick: () =>
|
|
183
|
-
className:
|
|
182
|
+
onClick: () => m((b) => !b),
|
|
183
|
+
className: P(
|
|
184
184
|
"ml-1 text-[10.5px] font-medium hover:underline",
|
|
185
185
|
n === "before" ? "text-rose-500" : "text-emerald-600"
|
|
186
186
|
),
|
|
@@ -205,19 +205,19 @@ function er({
|
|
|
205
205
|
after: n
|
|
206
206
|
}) {
|
|
207
207
|
const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(n)])).sort().map((o) => {
|
|
208
|
-
const
|
|
209
|
-
return
|
|
208
|
+
const u = o in e ? JSON.stringify(e[o]) : void 0, l = o in n ? JSON.stringify(n[o]) : void 0;
|
|
209
|
+
return u === l ? null : { k: o, b: u, a: l };
|
|
210
210
|
}).filter(Boolean);
|
|
211
211
|
if (a.length === 0)
|
|
212
212
|
return /* @__PURE__ */ t("span", { className: "text-[11px] italic text-slate-400", children: "keys reordered only" });
|
|
213
|
-
const
|
|
214
|
-
return /* @__PURE__ */ t("div", { className: "space-y-0.5", "data-json-diff": !0, children: a.map(({ k: o, b, a: l }) => /* @__PURE__ */ r("p", { className: "text-[11.5px]", children: [
|
|
213
|
+
const m = (o) => o == null ? void 0 : o.length > 80 ? `${o.slice(0, 80)}…` : o;
|
|
214
|
+
return /* @__PURE__ */ t("div", { className: "space-y-0.5", "data-json-diff": !0, children: a.map(({ k: o, b: u, a: l }) => /* @__PURE__ */ r("p", { className: "text-[11.5px]", children: [
|
|
215
215
|
/* @__PURE__ */ t("span", { className: "font-mono text-[10.5px] text-slate-500", children: o }),
|
|
216
216
|
":",
|
|
217
217
|
" ",
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
l !== void 0 ? /* @__PURE__ */ t("span", { className: "text-emerald-700 dark:text-emerald-400", children:
|
|
218
|
+
u !== void 0 && /* @__PURE__ */ t("span", { className: "text-rose-600 line-through dark:text-rose-400", children: m(u) }),
|
|
219
|
+
u !== void 0 && l !== void 0 && " → ",
|
|
220
|
+
l !== void 0 ? /* @__PURE__ */ t("span", { className: "text-emerald-700 dark:text-emerald-400", children: m(l) }) : /* @__PURE__ */ t("span", { className: "italic text-slate-400", children: " (removed)" })
|
|
221
221
|
] }, o)) });
|
|
222
222
|
}
|
|
223
223
|
function tr({ field: e, ctl: n }) {
|
|
@@ -251,43 +251,43 @@ function tr({ field: e, ctl: n }) {
|
|
|
251
251
|
title: "Set the field back to this revision’s value",
|
|
252
252
|
"data-revert-field": e,
|
|
253
253
|
children: [
|
|
254
|
-
/* @__PURE__ */ t(
|
|
254
|
+
/* @__PURE__ */ t(xt, { className: "h-3 w-3" }),
|
|
255
255
|
"Revert"
|
|
256
256
|
]
|
|
257
257
|
}
|
|
258
258
|
);
|
|
259
259
|
}
|
|
260
260
|
function ve(e) {
|
|
261
|
-
return typeof e == "string" && /<[a-z][^>]*>/i.test(e) ||
|
|
261
|
+
return typeof e == "string" && /<[a-z][^>]*>/i.test(e) || We(e);
|
|
262
262
|
}
|
|
263
263
|
function Ke(e) {
|
|
264
|
-
return String(
|
|
264
|
+
return String(We(e) ? ha(e) : e ?? "").replace(/<[^>]*>/g, " ").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").split(/\s+/).filter(Boolean);
|
|
265
265
|
}
|
|
266
266
|
function ar(e, n) {
|
|
267
|
-
const a = Ke(e).slice(0, 600),
|
|
268
|
-
for (let
|
|
269
|
-
for (let
|
|
270
|
-
l[
|
|
271
|
-
const
|
|
272
|
-
const
|
|
273
|
-
|
|
267
|
+
const a = Ke(e).slice(0, 600), m = Ke(n).slice(0, 600), o = a.length, u = m.length, l = Array.from({ length: o + 1 }, () => new Array(u + 1).fill(0));
|
|
268
|
+
for (let f = o - 1; f >= 0; f--)
|
|
269
|
+
for (let p = u - 1; p >= 0; p--)
|
|
270
|
+
l[f][p] = a[f] === m[p] ? l[f + 1][p + 1] + 1 : Math.max(l[f + 1][p], l[f][p + 1]);
|
|
271
|
+
const b = [], c = (f, p) => {
|
|
272
|
+
const k = b[b.length - 1];
|
|
273
|
+
k && k.type === f ? k.text += ` ${p}` : b.push({ text: p, type: f });
|
|
274
274
|
};
|
|
275
|
-
let
|
|
276
|
-
for (;
|
|
277
|
-
a[
|
|
278
|
-
for (;
|
|
279
|
-
for (;
|
|
280
|
-
return
|
|
275
|
+
let v = 0, g = 0;
|
|
276
|
+
for (; v < o && g < u; )
|
|
277
|
+
a[v] === m[g] ? (c("same", a[v]), v++, g++) : l[v + 1][g] >= l[v][g + 1] ? (c("del", a[v]), v++) : (c("ins", m[g]), g++);
|
|
278
|
+
for (; v < o; ) c("del", a[v++]);
|
|
279
|
+
for (; g < u; ) c("ins", m[g++]);
|
|
280
|
+
return b;
|
|
281
281
|
}
|
|
282
282
|
function _t({ before: e, after: n }) {
|
|
283
283
|
const i = ar(e, n);
|
|
284
284
|
return /* @__PURE__ */ t("p", { className: "whitespace-pre-wrap break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: i.map(
|
|
285
|
-
(a,
|
|
285
|
+
(a, m) => a.type === "same" ? (
|
|
286
286
|
// biome-ignore lint/suspicious/noArrayIndexKey: static segment list
|
|
287
287
|
/* @__PURE__ */ r("span", { children: [
|
|
288
288
|
a.text,
|
|
289
289
|
" "
|
|
290
|
-
] },
|
|
290
|
+
] }, m)
|
|
291
291
|
) : a.type === "del" ? (
|
|
292
292
|
// biome-ignore lint/suspicious/noArrayIndexKey: static segment list
|
|
293
293
|
/* @__PURE__ */ r(
|
|
@@ -299,7 +299,7 @@ function _t({ before: e, after: n }) {
|
|
|
299
299
|
" "
|
|
300
300
|
]
|
|
301
301
|
},
|
|
302
|
-
|
|
302
|
+
m
|
|
303
303
|
)
|
|
304
304
|
) : (
|
|
305
305
|
// biome-ignore lint/suspicious/noArrayIndexKey: static segment list
|
|
@@ -312,7 +312,7 @@ function _t({ before: e, after: n }) {
|
|
|
312
312
|
" "
|
|
313
313
|
]
|
|
314
314
|
},
|
|
315
|
-
|
|
315
|
+
m
|
|
316
316
|
)
|
|
317
317
|
)
|
|
318
318
|
) });
|
|
@@ -323,23 +323,23 @@ const rr = {
|
|
|
323
323
|
changed: "bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-400"
|
|
324
324
|
};
|
|
325
325
|
function $t(e, n, i) {
|
|
326
|
-
const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(n)])),
|
|
327
|
-
const
|
|
328
|
-
if (
|
|
329
|
-
const
|
|
326
|
+
const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(n)])), m = (l) => l == null || l === "", o = a.map((l) => {
|
|
327
|
+
const b = !(l in e) || m(e[l]), c = !(l in n) || m(n[l]);
|
|
328
|
+
if (b && c) return null;
|
|
329
|
+
const v = b ? "added" : c ? "removed" : $e(e[l]) !== $e(n[l]) ? "changed" : "unchanged";
|
|
330
330
|
return {
|
|
331
331
|
field: l,
|
|
332
|
-
status:
|
|
332
|
+
status: v,
|
|
333
333
|
before: e[l],
|
|
334
334
|
after: n[l],
|
|
335
|
-
system:
|
|
335
|
+
system: F(i, l).system
|
|
336
336
|
};
|
|
337
|
-
}).filter(Boolean),
|
|
338
|
-
const
|
|
339
|
-
return (
|
|
337
|
+
}).filter(Boolean), u = (l) => {
|
|
338
|
+
const b = F(i, l.field);
|
|
339
|
+
return (b.system ? 8 : b.onLayout ? 0 : 4) + (l.status === "unchanged" ? 2 : 0);
|
|
340
340
|
};
|
|
341
341
|
return o.sort(
|
|
342
|
-
(l,
|
|
342
|
+
(l, b) => u(l) - u(b) || F(i, l.field).label.localeCompare(F(i, b.field).label)
|
|
343
343
|
);
|
|
344
344
|
}
|
|
345
345
|
function de({
|
|
@@ -347,21 +347,21 @@ function de({
|
|
|
347
347
|
meta: n,
|
|
348
348
|
tone: i
|
|
349
349
|
}) {
|
|
350
|
-
return e == null || e === "" ? /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" }) : n.relatedCollection && (typeof e == "string" || typeof e == "number") ? /* @__PURE__ */ t("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: /* @__PURE__ */ t(Ct, { collection: n.relatedCollection, id: e }) }) : ve(e) ? /* @__PURE__ */ t(
|
|
350
|
+
return e == null || e === "" ? /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" }) : n.relatedCollection && (typeof e == "string" || typeof e == "number") ? /* @__PURE__ */ t("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: /* @__PURE__ */ t(Ct, { collection: n.relatedCollection, id: e }) }) : ve(e) ? /* @__PURE__ */ t(Me, { value: St(e), tone: i }) : n.cmp && typeof e != "object" && !n.dateOnly ? /* @__PURE__ */ t(Me, { value: Ue(e, n.cmp), tone: i }) : /* @__PURE__ */ t(Me, { value: e, tone: i, dateOnly: n.dateOnly });
|
|
351
351
|
}
|
|
352
352
|
function sr({
|
|
353
353
|
row: e,
|
|
354
354
|
meta: n,
|
|
355
355
|
fieldRevert: i,
|
|
356
356
|
mode: a,
|
|
357
|
-
hideStatusChips:
|
|
357
|
+
hideStatusChips: m,
|
|
358
358
|
between: o
|
|
359
359
|
}) {
|
|
360
|
-
const
|
|
360
|
+
const u = e.status === "changed" && (ve(e.before) || ve(e.after)), l = e.status === "changed" && we(e.before) && we(e.after);
|
|
361
361
|
return /* @__PURE__ */ r(
|
|
362
362
|
"div",
|
|
363
363
|
{
|
|
364
|
-
className:
|
|
364
|
+
className: P(
|
|
365
365
|
"group/frow border-b border-slate-100 px-3 py-2 last:border-0 dark:border-border/60",
|
|
366
366
|
e.system && "bg-slate-50/60 dark:bg-muted/20"
|
|
367
367
|
),
|
|
@@ -369,10 +369,10 @@ function sr({
|
|
|
369
369
|
children: [
|
|
370
370
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
371
371
|
/* @__PURE__ */ t(Za, { map: n, field: e.field }),
|
|
372
|
-
e.status !== "unchanged" && !
|
|
372
|
+
e.status !== "unchanged" && !m && /* @__PURE__ */ t(
|
|
373
373
|
"span",
|
|
374
374
|
{
|
|
375
|
-
className:
|
|
375
|
+
className: P(
|
|
376
376
|
"rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide",
|
|
377
377
|
rr[e.status]
|
|
378
378
|
),
|
|
@@ -383,17 +383,17 @@ function sr({
|
|
|
383
383
|
// not something to put back by hand (army11 f1 design review).
|
|
384
384
|
!o && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ t(tr, { field: e.field, ctl: i }) })
|
|
385
385
|
] }),
|
|
386
|
-
/* @__PURE__ */ t("div", { className: "mt-1", children:
|
|
386
|
+
/* @__PURE__ */ t("div", { className: "mt-1", children: u ? /* @__PURE__ */ t("div", { "data-richtext-diff": !0, children: /* @__PURE__ */ t(_t, { before: e.before, after: e.after }) }) : l ? /* @__PURE__ */ t(
|
|
387
387
|
er,
|
|
388
388
|
{
|
|
389
389
|
before: we(e.before),
|
|
390
390
|
after: we(e.after)
|
|
391
391
|
}
|
|
392
392
|
) : e.status === "changed" || e.status === "removed" ? /* @__PURE__ */ r("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-0.5", children: [
|
|
393
|
-
/* @__PURE__ */ t("span", { className: "max-w-full break-words text-[12px] text-rose-600 line-through decoration-rose-300 dark:text-rose-400", children: /* @__PURE__ */ t(de, { value: e.before, meta:
|
|
393
|
+
/* @__PURE__ */ t("span", { className: "max-w-full break-words text-[12px] text-rose-600 line-through decoration-rose-300 dark:text-rose-400", children: /* @__PURE__ */ t(de, { value: e.before, meta: F(n, e.field), tone: "before" }) }),
|
|
394
394
|
/* @__PURE__ */ t(ze, { className: "h-3 w-3 shrink-0 self-center text-slate-300 dark:text-slate-600" }),
|
|
395
|
-
/* @__PURE__ */ t(de, { value: e.after, meta:
|
|
396
|
-
] }) : /* @__PURE__ */ t(de, { value: e.after ?? e.before, meta:
|
|
395
|
+
/* @__PURE__ */ t(de, { value: e.after, meta: F(n, e.field), tone: "after" })
|
|
396
|
+
] }) : /* @__PURE__ */ t(de, { value: e.after ?? e.before, meta: F(n, e.field), tone: "after" }) })
|
|
397
397
|
]
|
|
398
398
|
}
|
|
399
399
|
);
|
|
@@ -403,21 +403,21 @@ function Tt({
|
|
|
403
403
|
after: n,
|
|
404
404
|
meta: i,
|
|
405
405
|
fieldRevert: a,
|
|
406
|
-
mode:
|
|
406
|
+
mode: m,
|
|
407
407
|
hideStatusChips: o,
|
|
408
|
-
ownFields:
|
|
408
|
+
ownFields: u
|
|
409
409
|
}) {
|
|
410
|
-
const [l,
|
|
411
|
-
if (
|
|
412
|
-
return /* @__PURE__ */ t("p", { className: "px-3 py-3 text-[12px] text-slate-400", children:
|
|
413
|
-
const L =
|
|
414
|
-
(
|
|
415
|
-
),
|
|
416
|
-
(
|
|
410
|
+
const [l, b] = A(!1), c = M(() => $t(e, n, i), [e, n, i]), v = m === "changes" ? c.filter((N) => N.status !== "unchanged") : c, g = l ? v : v.filter((N) => !N.system), f = (N) => !!u && m === "changes" && !N.system && !u.has(N.field), p = g.filter(f), k = [...g.filter((N) => !f(N)), ...p], _ = p.length ? k.length - p.length : -1, y = v.length - k.length;
|
|
411
|
+
if (v.length === 0)
|
|
412
|
+
return /* @__PURE__ */ t("p", { className: "px-3 py-3 text-[12px] text-slate-400", children: m === "changes" ? "No field changes recorded." : "No snapshot data available." });
|
|
413
|
+
const L = k.findIndex(
|
|
414
|
+
(N) => !f(N) && !F(i, N.field).onLayout && !F(i, N.field).system
|
|
415
|
+
), q = k.some(
|
|
416
|
+
(N) => !f(N) && F(i, N.field).onLayout && !F(i, N.field).system
|
|
417
417
|
);
|
|
418
418
|
return /* @__PURE__ */ r("div", { className: "overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
419
|
-
|
|
420
|
-
|
|
419
|
+
k.map((N, h) => /* @__PURE__ */ r("div", { children: [
|
|
420
|
+
h === _ && /* @__PURE__ */ r(
|
|
421
421
|
"div",
|
|
422
422
|
{
|
|
423
423
|
"data-recalculated-between": !0,
|
|
@@ -428,27 +428,27 @@ function Tt({
|
|
|
428
428
|
]
|
|
429
429
|
}
|
|
430
430
|
),
|
|
431
|
-
|
|
431
|
+
h === L && q && /* @__PURE__ */ r("div", { className: "border-b border-t border-slate-100 bg-slate-50/70 px-3 py-1.5 dark:border-border/60 dark:bg-muted/30", children: [
|
|
432
432
|
/* @__PURE__ */ t("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Behind the scenes" }),
|
|
433
433
|
/* @__PURE__ */ t("p", { className: "text-[10.5px] text-slate-400", children: "Not on the form — written automatically by rules, computed fields or integrations." })
|
|
434
434
|
] }),
|
|
435
435
|
/* @__PURE__ */ t(
|
|
436
436
|
sr,
|
|
437
437
|
{
|
|
438
|
-
row:
|
|
438
|
+
row: N,
|
|
439
439
|
meta: i,
|
|
440
440
|
fieldRevert: a,
|
|
441
|
-
mode:
|
|
441
|
+
mode: m,
|
|
442
442
|
hideStatusChips: o,
|
|
443
|
-
between:
|
|
443
|
+
between: f(N)
|
|
444
444
|
}
|
|
445
445
|
)
|
|
446
|
-
] },
|
|
446
|
+
] }, N.field)),
|
|
447
447
|
y > 0 && /* @__PURE__ */ r(
|
|
448
448
|
"button",
|
|
449
449
|
{
|
|
450
450
|
type: "button",
|
|
451
|
-
onClick: () =>
|
|
451
|
+
onClick: () => b(!0),
|
|
452
452
|
className: "w-full border-t border-slate-100 px-3 py-2 text-left text-[11.5px] text-slate-400 hover:text-slate-600 dark:border-border/60 dark:hover:text-slate-300",
|
|
453
453
|
"data-show-system": !0,
|
|
454
454
|
children: [
|
|
@@ -460,11 +460,11 @@ function Tt({
|
|
|
460
460
|
]
|
|
461
461
|
}
|
|
462
462
|
),
|
|
463
|
-
y === 0 && l &&
|
|
463
|
+
y === 0 && l && v.some((N) => N.system) && /* @__PURE__ */ t(
|
|
464
464
|
"button",
|
|
465
465
|
{
|
|
466
466
|
type: "button",
|
|
467
|
-
onClick: () =>
|
|
467
|
+
onClick: () => b(!1),
|
|
468
468
|
className: "w-full border-t border-slate-100 px-3 py-2 text-left text-[11.5px] text-slate-400 hover:text-slate-600 dark:border-border/60",
|
|
469
469
|
children: "Hide system fields"
|
|
470
470
|
}
|
|
@@ -477,7 +477,7 @@ const nr = {
|
|
|
477
477
|
update: "bg-nvr-cyan",
|
|
478
478
|
delete: "bg-red-500"
|
|
479
479
|
}, Je = la(void 0);
|
|
480
|
-
function
|
|
480
|
+
function te(e, n) {
|
|
481
481
|
var i;
|
|
482
482
|
return e.actor && e.actor.kind !== "person" ? ma(e, n) : e.first_name || e.last_name ? [e.first_name, e.last_name].filter(Boolean).join(" ") : e.user_email ?? ((i = e.user_id) == null ? void 0 : i.slice(0, 8)) ?? "System";
|
|
483
483
|
}
|
|
@@ -485,10 +485,10 @@ function lr(e, n, i) {
|
|
|
485
485
|
return e.action === "create" ? "created this record" : e.action === "restore" ? "restored this record from trash" : e.action === "delete" ? "deleted this record" : n > 0 ? `changed ${n} field${n === 1 ? "" : "s"}` : i > 0 ? "updated system fields" : "saved this record";
|
|
486
486
|
}
|
|
487
487
|
function or({ revision: e, isLast: n }) {
|
|
488
|
-
var
|
|
489
|
-
const i =
|
|
488
|
+
var g, f, p, k, _;
|
|
489
|
+
const i = bt(Je), a = e.event, m = (a == null ? void 0 : a.source) === "auto" || !e.user_id && (a == null ? void 0 : a.kind) === "transition", o = !m && ((g = a == null ? void 0 : a.on_behalf_of) != null && g.name) ? a.on_behalf_of.name : null, u = !m && ((f = a == null ? void 0 : a.acting_admin) != null && f.name) ? a.acting_admin.name : null, l = u ? `${u} as ${te(e, i)}` : te(e, i), b = m ? "Automatic rule" : o ? `${l}, for ${o}` : l;
|
|
490
490
|
let c;
|
|
491
|
-
(a == null ? void 0 : a.kind) === "transition" && a.addendum ? c = /* @__PURE__ */ r(
|
|
491
|
+
(a == null ? void 0 : a.kind) === "transition" && a.addendum ? c = /* @__PURE__ */ r(ee, { children: [
|
|
492
492
|
"moved",
|
|
493
493
|
" ",
|
|
494
494
|
/* @__PURE__ */ r("span", { className: "font-medium text-slate-700 dark:text-slate-200", "data-revision-addendum": !0, children: [
|
|
@@ -498,7 +498,7 @@ function or({ revision: e, isLast: n }) {
|
|
|
498
498
|
] }),
|
|
499
499
|
":",
|
|
500
500
|
" ",
|
|
501
|
-
a.from_label && /* @__PURE__ */ r(
|
|
501
|
+
a.from_label && /* @__PURE__ */ r(ee, { children: [
|
|
502
502
|
/* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.from_label }),
|
|
503
503
|
" ",
|
|
504
504
|
"→",
|
|
@@ -509,10 +509,10 @@ function or({ revision: e, isLast: n }) {
|
|
|
509
509
|
" · ",
|
|
510
510
|
a.transition_label
|
|
511
511
|
] })
|
|
512
|
-
] }) : (a == null ? void 0 : a.kind) === "transition" ? c = /* @__PURE__ */ r(
|
|
512
|
+
] }) : (a == null ? void 0 : a.kind) === "transition" ? c = /* @__PURE__ */ r(ee, { children: [
|
|
513
513
|
"moved it",
|
|
514
514
|
" ",
|
|
515
|
-
a.from_label && /* @__PURE__ */ r(
|
|
515
|
+
a.from_label && /* @__PURE__ */ r(ee, { children: [
|
|
516
516
|
"from",
|
|
517
517
|
" ",
|
|
518
518
|
/* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.from_label }),
|
|
@@ -525,14 +525,14 @@ function or({ revision: e, isLast: n }) {
|
|
|
525
525
|
" · ",
|
|
526
526
|
a.transition_label
|
|
527
527
|
] })
|
|
528
|
-
] }) : (a == null ? void 0 : a.kind) === "start" && a.to_label ? c = /* @__PURE__ */ r(
|
|
528
|
+
] }) : (a == null ? void 0 : a.kind) === "start" && a.to_label ? c = /* @__PURE__ */ r(ee, { children: [
|
|
529
529
|
"started it in",
|
|
530
530
|
" ",
|
|
531
531
|
/* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.to_label })
|
|
532
|
-
] }) : (a == null ? void 0 : a.kind) === "start" ? c = /* @__PURE__ */ r(
|
|
532
|
+
] }) : (a == null ? void 0 : a.kind) === "start" ? c = /* @__PURE__ */ r(ee, { children: [
|
|
533
533
|
"started the pipeline",
|
|
534
534
|
e.comment ? ` — ${e.comment.replace(/^Started pipeline\s*[—-]?\s*/i, "")}` : ""
|
|
535
|
-
] }) : (
|
|
535
|
+
] }) : (p = e.action) != null && p.startsWith("o2m-") ? c = /* @__PURE__ */ t("span", { "data-revision-o2m": !0, children: e.o2m ? /* @__PURE__ */ r(ee, { children: [
|
|
536
536
|
ia(e.o2m),
|
|
537
537
|
et(e.o2m) ? (
|
|
538
538
|
// Which totals on this record the row's write moved (audit: who changed the
|
|
@@ -557,23 +557,23 @@ function or({ revision: e, isLast: n }) {
|
|
|
557
557
|
children: "outside this record"
|
|
558
558
|
}
|
|
559
559
|
) : null
|
|
560
|
-
] }) : `${e.action === "o2m-create" ? "added" : e.action === "o2m-delete" ? "removed" : "changed"} related rows` }) : c = /* @__PURE__ */ r(
|
|
560
|
+
] }) : `${e.action === "o2m-create" ? "added" : e.action === "o2m-delete" ? "removed" : "changed"} related rows` }) : c = /* @__PURE__ */ r(ee, { children: [
|
|
561
561
|
da({ ...e, item: null }, i),
|
|
562
562
|
e.comment ? ` — ${e.comment}` : ""
|
|
563
563
|
] });
|
|
564
|
-
const
|
|
564
|
+
const v = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
|
|
565
565
|
return /* @__PURE__ */ r(
|
|
566
566
|
"div",
|
|
567
567
|
{
|
|
568
568
|
className: "relative pl-9",
|
|
569
569
|
"data-revision-event": (a == null ? void 0 : a.kind) ?? e.action ?? "",
|
|
570
|
-
"data-revision-on-behalf": o ? (
|
|
571
|
-
"data-revision-acting-admin":
|
|
570
|
+
"data-revision-on-behalf": o ? (k = a == null ? void 0 : a.on_behalf_of) == null ? void 0 : k.id : void 0,
|
|
571
|
+
"data-revision-acting-admin": u ? (_ = a == null ? void 0 : a.acting_admin) == null ? void 0 : _.id : void 0,
|
|
572
572
|
children: [
|
|
573
573
|
/* @__PURE__ */ t(
|
|
574
574
|
"span",
|
|
575
575
|
{
|
|
576
|
-
className:
|
|
576
|
+
className: P(
|
|
577
577
|
"absolute left-[11px] top-[18px] h-2.5 w-2.5 rounded-full ring-4 ring-white dark:ring-card",
|
|
578
578
|
(a == null ? void 0 : a.kind) === "transition" && a.addendum ? "bg-amber-500" : (a == null ? void 0 : a.kind) === "transition" ? "bg-violet-500" : (a == null ? void 0 : a.kind) === "start" ? "bg-violet-300" : "bg-slate-300"
|
|
579
579
|
),
|
|
@@ -588,9 +588,9 @@ function or({ revision: e, isLast: n }) {
|
|
|
588
588
|
}
|
|
589
589
|
),
|
|
590
590
|
/* @__PURE__ */ r("div", { className: "flex w-full items-start gap-2.5 rounded-md px-2 py-2.5 text-left", children: [
|
|
591
|
-
|
|
591
|
+
m ? /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-violet-500/10 text-[10px] font-semibold text-violet-700 dark:text-violet-300", children: "⚡" }) : /* @__PURE__ */ t(Re, { userId: e.user_id, name: b }),
|
|
592
592
|
/* @__PURE__ */ r("span", { className: "min-w-0 flex-1 text-[12.5px] text-slate-700 dark:text-slate-200", children: [
|
|
593
|
-
/* @__PURE__ */ t("span", { className: "font-medium", children:
|
|
593
|
+
/* @__PURE__ */ t("span", { className: "font-medium", children: b }),
|
|
594
594
|
" ",
|
|
595
595
|
/* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: c }),
|
|
596
596
|
(a == null ? void 0 : a.kind) === "transition" && e.comment && /* @__PURE__ */ r(
|
|
@@ -611,7 +611,7 @@ function or({ revision: e, isLast: n }) {
|
|
|
611
611
|
{
|
|
612
612
|
className: "shrink-0 text-[11px] tabular-nums text-slate-400",
|
|
613
613
|
title: e.timestamp ? G(e.timestamp) : void 0,
|
|
614
|
-
children:
|
|
614
|
+
children: v
|
|
615
615
|
}
|
|
616
616
|
)
|
|
617
617
|
] })
|
|
@@ -624,65 +624,65 @@ function ir({
|
|
|
624
624
|
previousData: n,
|
|
625
625
|
meta: i,
|
|
626
626
|
onRollback: a,
|
|
627
|
-
inlineTableFields:
|
|
627
|
+
inlineTableFields: m,
|
|
628
628
|
isLast: o
|
|
629
629
|
}) {
|
|
630
|
-
const
|
|
631
|
-
const
|
|
632
|
-
let
|
|
633
|
-
for (const
|
|
634
|
-
const ke = n == null ? void 0 : n[
|
|
635
|
-
|
|
630
|
+
const u = ce(), l = bt(Je), b = ca(e).reason, [c, v] = A(!1), [g, f] = A(!1), [p, k] = A("changes"), [_, y] = A(!1), [L, q] = A(null), N = e.action === "update", h = e.action === "create" || e.action === "restore", T = e.action === "delete", S = T ? e.data ?? {} : h ? {} : n ?? {}, E = T ? {} : e.data ?? {}, { humanDelta: j, systemDelta: w } = M(() => {
|
|
631
|
+
const O = e.delta ?? {};
|
|
632
|
+
let W = 0, Q = 0;
|
|
633
|
+
for (const ae of Object.keys(O)) {
|
|
634
|
+
const ke = n == null ? void 0 : n[ae], Fe = (e.data ?? {})[ae];
|
|
635
|
+
N && n && $e(ke) === $e(Fe) || (F(i, ae).system ? Q++ : W++);
|
|
636
636
|
}
|
|
637
|
-
return { humanDelta:
|
|
638
|
-
}, [e, n, i,
|
|
639
|
-
mutationFn: (
|
|
640
|
-
onSuccess: (
|
|
641
|
-
x(null),
|
|
637
|
+
return { humanDelta: W, systemDelta: Q };
|
|
638
|
+
}, [e, n, i, N]), R = M(() => new Set(Object.keys(e.delta ?? {})), [e]), K = N || h, [z, U] = A(null), J = Te(), [ue, x] = A(null), D = je({
|
|
639
|
+
mutationFn: (O) => u.request(Ne(`/revisions/${e.id}/revert-field`, { field: O })),
|
|
640
|
+
onSuccess: (O, W) => {
|
|
641
|
+
x(null), ne.success(`Reverted ${F(i, W).label} to this revision's value`), J.invalidateQueries({ queryKey: ["revisions", e.collection, e.item] }), a == null || a();
|
|
642
642
|
},
|
|
643
|
-
onError: () =>
|
|
644
|
-
}),
|
|
643
|
+
onError: () => ne.error("Failed to revert field")
|
|
644
|
+
}), Z = N || h ? {
|
|
645
645
|
confirmField: ue,
|
|
646
646
|
setConfirmField: x,
|
|
647
|
-
revert: (
|
|
648
|
-
pending:
|
|
649
|
-
} : void 0,
|
|
650
|
-
mutationFn: () =>
|
|
651
|
-
onSuccess: (
|
|
652
|
-
|
|
653
|
-
const
|
|
654
|
-
|
|
647
|
+
revert: (O) => D.mutate(O),
|
|
648
|
+
pending: D.isPending
|
|
649
|
+
} : void 0, V = je({
|
|
650
|
+
mutationFn: () => u.request(Ne(`/revisions/${e.id}/rollback`, {})),
|
|
651
|
+
onSuccess: (O) => {
|
|
652
|
+
f(!1), ne.success("Rolled back to this revision");
|
|
653
|
+
const W = tt(O);
|
|
654
|
+
W && ne.warning(W, { duration: 1e4 }), m != null && m.length && e.timestamp && U(e.timestamp), a == null || a();
|
|
655
655
|
},
|
|
656
|
-
onError: () =>
|
|
656
|
+
onError: () => ne.error("Failed to rollback")
|
|
657
657
|
});
|
|
658
|
-
async function me(
|
|
659
|
-
if (
|
|
660
|
-
|
|
658
|
+
async function me(O) {
|
|
659
|
+
if (z) {
|
|
660
|
+
q(O.field);
|
|
661
661
|
try {
|
|
662
|
-
const
|
|
662
|
+
const W = await u.request(
|
|
663
663
|
Ne("/revisions/o2m-restore", {
|
|
664
|
-
collection:
|
|
665
|
-
many_field:
|
|
666
|
-
parent_id:
|
|
667
|
-
target_timestamp:
|
|
664
|
+
collection: O.relatedCollection,
|
|
665
|
+
many_field: O.manyField,
|
|
666
|
+
parent_id: O.parentId,
|
|
667
|
+
target_timestamp: z
|
|
668
668
|
})
|
|
669
669
|
);
|
|
670
|
-
|
|
671
|
-
const
|
|
672
|
-
|
|
670
|
+
ne.success(`Restored ${O.label}`);
|
|
671
|
+
const Q = tt(W);
|
|
672
|
+
Q && ne.warning(Q, { duration: 1e4 });
|
|
673
673
|
} catch {
|
|
674
|
-
|
|
674
|
+
ne.error(`Failed to restore ${O.label}`);
|
|
675
675
|
} finally {
|
|
676
|
-
|
|
676
|
+
q(null);
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
679
|
}
|
|
680
|
-
const
|
|
680
|
+
const xe = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
|
|
681
681
|
return /* @__PURE__ */ r("div", { className: "relative pl-9", "data-revision-row": e.id, children: [
|
|
682
682
|
/* @__PURE__ */ t(
|
|
683
683
|
"span",
|
|
684
684
|
{
|
|
685
|
-
className:
|
|
685
|
+
className: P(
|
|
686
686
|
"absolute left-[11px] top-[18px] h-2.5 w-2.5 rounded-full ring-4 ring-white dark:ring-card",
|
|
687
687
|
nr[e.action ?? ""] ?? "bg-slate-300"
|
|
688
688
|
),
|
|
@@ -697,42 +697,42 @@ function ir({
|
|
|
697
697
|
}
|
|
698
698
|
),
|
|
699
699
|
/* @__PURE__ */ r("div", { className: "flex w-full items-center gap-2.5 rounded-md px-2 py-2.5 transition-colors hover:bg-slate-50 dark:hover:bg-muted/40", children: [
|
|
700
|
-
/* @__PURE__ */ t(
|
|
700
|
+
/* @__PURE__ */ t(Re, { userId: e.user_id, name: te(e, l) }),
|
|
701
701
|
/* @__PURE__ */ r(
|
|
702
702
|
"button",
|
|
703
703
|
{
|
|
704
704
|
type: "button",
|
|
705
|
-
onClick: () =>
|
|
705
|
+
onClick: () => v((O) => !O),
|
|
706
706
|
"aria-expanded": c,
|
|
707
707
|
className: "flex min-w-0 flex-1 items-center gap-2.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan rounded",
|
|
708
708
|
children: [
|
|
709
709
|
/* @__PURE__ */ r("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: [
|
|
710
|
-
/* @__PURE__ */ t("span", { className: "font-medium", children:
|
|
710
|
+
/* @__PURE__ */ t("span", { className: "font-medium", children: te(e, l) }),
|
|
711
711
|
" ",
|
|
712
|
-
/* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: lr(e,
|
|
713
|
-
|
|
712
|
+
/* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: lr(e, j, w) }),
|
|
713
|
+
b && /* @__PURE__ */ r(
|
|
714
714
|
"span",
|
|
715
715
|
{
|
|
716
716
|
className: "mt-0.5 block truncate text-[11.5px] text-slate-500 dark:text-slate-400",
|
|
717
717
|
"data-revision-reason": !0,
|
|
718
|
-
"data-tip":
|
|
718
|
+
"data-tip": b,
|
|
719
719
|
children: [
|
|
720
720
|
"Reason: ",
|
|
721
|
-
|
|
721
|
+
b
|
|
722
722
|
]
|
|
723
723
|
}
|
|
724
724
|
)
|
|
725
725
|
] }),
|
|
726
|
-
/* @__PURE__ */ t(
|
|
726
|
+
/* @__PURE__ */ t(ba, { label: e.via_agent }),
|
|
727
727
|
/* @__PURE__ */ t(
|
|
728
728
|
"span",
|
|
729
729
|
{
|
|
730
730
|
className: "shrink-0 text-[11px] tabular-nums text-slate-400",
|
|
731
731
|
title: e.timestamp ? G(e.timestamp) : void 0,
|
|
732
|
-
children:
|
|
732
|
+
children: xe
|
|
733
733
|
}
|
|
734
734
|
),
|
|
735
|
-
c ? /* @__PURE__ */ t(Ve, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }) : /* @__PURE__ */ t(
|
|
735
|
+
c ? /* @__PURE__ */ t(Ve, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }) : /* @__PURE__ */ t(Pe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
736
736
|
]
|
|
737
737
|
}
|
|
738
738
|
)
|
|
@@ -742,26 +742,26 @@ function ir({
|
|
|
742
742
|
/* @__PURE__ */ t("div", { className: "flex items-center overflow-hidden rounded-md border border-slate-200 dark:border-border", children: [
|
|
743
743
|
["changes", "What changed"],
|
|
744
744
|
["all", "Full record"]
|
|
745
|
-
].map(([
|
|
745
|
+
].map(([O, W]) => /* @__PURE__ */ t(
|
|
746
746
|
"button",
|
|
747
747
|
{
|
|
748
748
|
type: "button",
|
|
749
|
-
onClick: () =>
|
|
750
|
-
className:
|
|
749
|
+
onClick: () => k(O),
|
|
750
|
+
className: P(
|
|
751
751
|
"px-2.5 py-1 text-[11.5px] transition-colors",
|
|
752
|
-
|
|
752
|
+
p === O ? "bg-nvr-cyan/10 font-medium text-nvr-navy dark:text-nvr-cyan" : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-300"
|
|
753
753
|
),
|
|
754
|
-
children:
|
|
754
|
+
children: W
|
|
755
755
|
},
|
|
756
|
-
|
|
756
|
+
O
|
|
757
757
|
)) }),
|
|
758
758
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
|
|
759
759
|
/* @__PURE__ */ r(
|
|
760
760
|
"button",
|
|
761
761
|
{
|
|
762
762
|
type: "button",
|
|
763
|
-
onClick: () => y((
|
|
764
|
-
className:
|
|
763
|
+
onClick: () => y((O) => !O),
|
|
764
|
+
className: P(
|
|
765
765
|
"inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11.5px] transition-colors",
|
|
766
766
|
_ ? "border-nvr-cyan/40 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-400 hover:text-slate-600 dark:border-border dark:hover:text-slate-300"
|
|
767
767
|
),
|
|
@@ -771,7 +771,7 @@ function ir({
|
|
|
771
771
|
]
|
|
772
772
|
}
|
|
773
773
|
),
|
|
774
|
-
|
|
774
|
+
K && (g ? /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
775
775
|
/* @__PURE__ */ t("span", { className: "text-[11px] text-slate-500", children: "Restore this version?" }),
|
|
776
776
|
/* @__PURE__ */ t(
|
|
777
777
|
ie,
|
|
@@ -779,8 +779,8 @@ function ir({
|
|
|
779
779
|
size: "sm",
|
|
780
780
|
variant: "destructive",
|
|
781
781
|
className: "h-6 text-[11px]",
|
|
782
|
-
disabled:
|
|
783
|
-
onClick: () =>
|
|
782
|
+
disabled: V.isPending,
|
|
783
|
+
onClick: () => V.mutate(),
|
|
784
784
|
children: "Yes, restore"
|
|
785
785
|
}
|
|
786
786
|
),
|
|
@@ -790,7 +790,7 @@ function ir({
|
|
|
790
790
|
size: "sm",
|
|
791
791
|
variant: "outline",
|
|
792
792
|
className: "h-6 text-[11px]",
|
|
793
|
-
onClick: () =>
|
|
793
|
+
onClick: () => f(!1),
|
|
794
794
|
children: "Cancel"
|
|
795
795
|
}
|
|
796
796
|
)
|
|
@@ -800,11 +800,11 @@ function ir({
|
|
|
800
800
|
size: "sm",
|
|
801
801
|
variant: "outline",
|
|
802
802
|
className: "h-6 gap-1 text-[11px]",
|
|
803
|
-
disabled:
|
|
804
|
-
onClick: () =>
|
|
803
|
+
disabled: V.isPending,
|
|
804
|
+
onClick: () => f(!0),
|
|
805
805
|
title: "Set the whole record back to how it looked after this save",
|
|
806
806
|
children: [
|
|
807
|
-
/* @__PURE__ */ t(
|
|
807
|
+
/* @__PURE__ */ t(xt, { className: "h-3 w-3" }),
|
|
808
808
|
"Restore this version"
|
|
809
809
|
]
|
|
810
810
|
}
|
|
@@ -815,30 +815,30 @@ function ir({
|
|
|
815
815
|
/* @__PURE__ */ t(
|
|
816
816
|
Tt,
|
|
817
817
|
{
|
|
818
|
-
before:
|
|
819
|
-
after:
|
|
818
|
+
before: S,
|
|
819
|
+
after: E,
|
|
820
820
|
meta: i,
|
|
821
|
-
fieldRevert:
|
|
822
|
-
mode:
|
|
823
|
-
hideStatusChips:
|
|
824
|
-
ownFields:
|
|
821
|
+
fieldRevert: Z,
|
|
822
|
+
mode: p,
|
|
823
|
+
hideStatusChips: h,
|
|
824
|
+
ownFields: N && e.delta ? R : null
|
|
825
825
|
}
|
|
826
826
|
),
|
|
827
|
-
|
|
827
|
+
z && m && m.length > 0 && /* @__PURE__ */ r("div", { className: "space-y-1.5 rounded-md border border-slate-100 bg-slate-50 p-2 dark:border-border dark:bg-muted/30", children: [
|
|
828
828
|
/* @__PURE__ */ t("p", { className: "text-[10.5px] font-medium text-slate-500", children: "Also restore related rows?" }),
|
|
829
|
-
|
|
830
|
-
/* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children:
|
|
829
|
+
m.map((O) => /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-2", children: [
|
|
830
|
+
/* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: O.label }),
|
|
831
831
|
/* @__PURE__ */ t(
|
|
832
832
|
"button",
|
|
833
833
|
{
|
|
834
834
|
type: "button",
|
|
835
|
-
disabled: L ===
|
|
836
|
-
onClick: () => me(
|
|
835
|
+
disabled: L === O.field,
|
|
836
|
+
onClick: () => me(O),
|
|
837
837
|
className: "rounded border border-nvr-cyan/40 px-2 py-0.5 text-[10.5px] font-medium text-nvr-cyan hover:bg-nvr-cyan/10 disabled:opacity-40",
|
|
838
|
-
children: L ===
|
|
838
|
+
children: L === O.field ? "Restoring…" : "Restore"
|
|
839
839
|
}
|
|
840
840
|
)
|
|
841
|
-
] },
|
|
841
|
+
] }, O.field))
|
|
842
842
|
] })
|
|
843
843
|
] })
|
|
844
844
|
] });
|
|
@@ -848,34 +848,34 @@ function dr({
|
|
|
848
848
|
history: n,
|
|
849
849
|
meta: i,
|
|
850
850
|
labels: a,
|
|
851
|
-
focusSave:
|
|
851
|
+
focusSave: m
|
|
852
852
|
}) {
|
|
853
|
-
const [o,
|
|
853
|
+
const [o, u] = A(m ? "replay" : null), [l, b] = A(""), [c, v] = A(""), g = M(() => {
|
|
854
854
|
if (!l || !c || !e) return null;
|
|
855
|
-
const
|
|
856
|
-
if (
|
|
857
|
-
const _ = (
|
|
855
|
+
const p = (/* @__PURE__ */ new Date(`${l}T23:59:59`)).getTime(), k = (/* @__PURE__ */ new Date(`${c}T23:59:59`)).getTime();
|
|
856
|
+
if (k <= p) return { error: "The second date must be after the first" };
|
|
857
|
+
const _ = (S) => e.find((E) => E.timestamp && new Date(E.timestamp).getTime() <= S) ?? null, y = _(p), L = _(k);
|
|
858
858
|
if (!L) return { error: "No snapshot exists at or before the second date" };
|
|
859
|
-
const
|
|
860
|
-
for (const
|
|
861
|
-
const
|
|
862
|
-
if (!(
|
|
863
|
-
for (const
|
|
864
|
-
|
|
859
|
+
const q = (y == null ? void 0 : y.data) ?? {}, N = L.data ?? {}, h = /* @__PURE__ */ new Map();
|
|
860
|
+
for (const S of [...e].reverse()) {
|
|
861
|
+
const E = S.timestamp ? new Date(S.timestamp).getTime() : 0;
|
|
862
|
+
if (!(E <= p || E > k || !S.delta))
|
|
863
|
+
for (const j of Object.keys(S.delta))
|
|
864
|
+
h.set(j, { name: te(S), when: S.timestamp });
|
|
865
865
|
}
|
|
866
|
-
return { fields: [.../* @__PURE__ */ new Set([...Object.keys(
|
|
867
|
-
}, [l, c, e]),
|
|
866
|
+
return { fields: [.../* @__PURE__ */ new Set([...Object.keys(q), ...Object.keys(N)])].filter((S) => String(q[S] ?? "") !== String(N[S] ?? "")).map((S) => ({ field: S, from: q[S], to: N[S], by: h.get(S) ?? null })) };
|
|
867
|
+
}, [l, c, e]), f = "h-7 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card";
|
|
868
868
|
return /* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
869
869
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
|
|
870
870
|
/* @__PURE__ */ r(
|
|
871
871
|
"button",
|
|
872
872
|
{
|
|
873
873
|
type: "button",
|
|
874
|
-
onClick: () =>
|
|
874
|
+
onClick: () => u(o === "replay" ? null : "replay"),
|
|
875
875
|
disabled: e.length === 0,
|
|
876
876
|
"aria-expanded": o === "replay",
|
|
877
877
|
"data-history-replay-toggle": !0,
|
|
878
|
-
className:
|
|
878
|
+
className: P(
|
|
879
879
|
"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11.5px] transition-colors disabled:opacity-50",
|
|
880
880
|
o === "replay" ? "border-nvr-cyan/40 bg-nvr-cyan/5 font-medium text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400 dark:hover:text-slate-200"
|
|
881
881
|
),
|
|
@@ -889,8 +889,8 @@ function dr({
|
|
|
889
889
|
"button",
|
|
890
890
|
{
|
|
891
891
|
type: "button",
|
|
892
|
-
onClick: () =>
|
|
893
|
-
className:
|
|
892
|
+
onClick: () => u(o === "compare" ? null : "compare"),
|
|
893
|
+
className: P(
|
|
894
894
|
"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11.5px] transition-colors",
|
|
895
895
|
o === "compare" || l && c ? "border-nvr-cyan/40 bg-nvr-cyan/5 font-medium text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-border dark:text-slate-400 dark:hover:text-slate-200"
|
|
896
896
|
),
|
|
@@ -908,7 +908,7 @@ function dr({
|
|
|
908
908
|
history: n,
|
|
909
909
|
meta: i,
|
|
910
910
|
labels: a,
|
|
911
|
-
startKey:
|
|
911
|
+
startKey: m ?? null
|
|
912
912
|
}
|
|
913
913
|
),
|
|
914
914
|
o === "compare" && /* @__PURE__ */ r("div", { className: "rounded-lg border border-slate-200 bg-slate-50/60 p-2.5 dark:border-border dark:bg-muted/20", children: [
|
|
@@ -919,8 +919,8 @@ function dr({
|
|
|
919
919
|
{
|
|
920
920
|
type: "date",
|
|
921
921
|
value: l,
|
|
922
|
-
onChange: (
|
|
923
|
-
className:
|
|
922
|
+
onChange: (p) => b(p.target.value),
|
|
923
|
+
className: f,
|
|
924
924
|
"aria-label": "Compare from date",
|
|
925
925
|
"data-diff-from": !0
|
|
926
926
|
}
|
|
@@ -931,8 +931,8 @@ function dr({
|
|
|
931
931
|
{
|
|
932
932
|
type: "date",
|
|
933
933
|
value: c,
|
|
934
|
-
onChange: (
|
|
935
|
-
className:
|
|
934
|
+
onChange: (p) => v(p.target.value),
|
|
935
|
+
className: f,
|
|
936
936
|
"aria-label": "Compare to date",
|
|
937
937
|
"data-diff-to": !0
|
|
938
938
|
}
|
|
@@ -942,31 +942,31 @@ function dr({
|
|
|
942
942
|
{
|
|
943
943
|
type: "button",
|
|
944
944
|
onClick: () => {
|
|
945
|
-
|
|
945
|
+
b(""), v("");
|
|
946
946
|
},
|
|
947
947
|
className: "text-[11px] text-slate-400 hover:text-slate-600 dark:hover:text-slate-300",
|
|
948
948
|
children: "Clear"
|
|
949
949
|
}
|
|
950
950
|
)
|
|
951
951
|
] }),
|
|
952
|
-
(
|
|
953
|
-
(
|
|
952
|
+
(g == null ? void 0 : g.error) != null && /* @__PURE__ */ t("p", { className: "mt-2 text-[12px] text-amber-600 dark:text-amber-400", children: g == null ? void 0 : g.error }),
|
|
953
|
+
(g == null ? void 0 : g.fields) != null && /* @__PURE__ */ r(
|
|
954
954
|
"div",
|
|
955
955
|
{
|
|
956
956
|
className: "mt-2 overflow-hidden rounded-lg border border-nvr-cyan/40 bg-white dark:bg-card",
|
|
957
957
|
"data-between-diff": !0,
|
|
958
958
|
children: [
|
|
959
959
|
/* @__PURE__ */ t("div", { className: "border-b border-slate-200 bg-[#f0fbff] px-2.5 py-1.5 dark:border-border dark:bg-nvr-cyan/10", children: /* @__PURE__ */ r("span", { className: "text-[11.5px] font-semibold text-slate-700 dark:text-slate-200", children: [
|
|
960
|
-
|
|
960
|
+
g.fields.length,
|
|
961
961
|
" field",
|
|
962
|
-
|
|
962
|
+
g.fields.length === 1 ? "" : "s",
|
|
963
963
|
" changed between ",
|
|
964
964
|
l,
|
|
965
965
|
" and",
|
|
966
966
|
" ",
|
|
967
967
|
c
|
|
968
968
|
] }) }),
|
|
969
|
-
|
|
969
|
+
g.fields.length === 0 ? /* @__PURE__ */ t("p", { className: "px-2.5 py-3 text-[12px] text-slate-400", children: "Nothing changed in that window." }) : /* @__PURE__ */ t("div", { className: "max-h-80 overflow-y-auto", children: g.fields.map((p) => /* @__PURE__ */ r(
|
|
970
970
|
"div",
|
|
971
971
|
{
|
|
972
972
|
className: "border-b border-slate-100 px-2.5 py-1.5 last:border-0 dark:border-border/60",
|
|
@@ -976,22 +976,22 @@ function dr({
|
|
|
976
976
|
"span",
|
|
977
977
|
{
|
|
978
978
|
className: "text-[11.5px] font-medium text-slate-600 dark:text-slate-300",
|
|
979
|
-
title:
|
|
980
|
-
children:
|
|
979
|
+
title: p.field,
|
|
980
|
+
children: F(i, p.field).label
|
|
981
981
|
}
|
|
982
982
|
),
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
983
|
+
p.by && /* @__PURE__ */ r("span", { className: "shrink-0 text-[10.5px] text-slate-400", children: [
|
|
984
|
+
p.by.name,
|
|
985
|
+
p.by.when ? ` · ${fe(p.by.when)}` : ""
|
|
986
986
|
] })
|
|
987
987
|
] }),
|
|
988
988
|
/* @__PURE__ */ r("p", { className: "mt-0.5 flex flex-wrap items-baseline gap-x-2 break-words text-[11.5px]", children: [
|
|
989
|
-
/* @__PURE__ */ t("span", { className: "text-red-500 line-through dark:text-red-400", children: /* @__PURE__ */ t(de, { value:
|
|
990
|
-
/* @__PURE__ */ t("span", { className: "text-emerald-600 dark:text-emerald-400", children: /* @__PURE__ */ t(de, { value:
|
|
989
|
+
/* @__PURE__ */ t("span", { className: "text-red-500 line-through dark:text-red-400", children: /* @__PURE__ */ t(de, { value: p.from, meta: F(i, p.field), tone: "before" }) }),
|
|
990
|
+
/* @__PURE__ */ t("span", { className: "text-emerald-600 dark:text-emerald-400", children: /* @__PURE__ */ t(de, { value: p.to, meta: F(i, p.field), tone: "after" }) })
|
|
991
991
|
] })
|
|
992
992
|
]
|
|
993
993
|
},
|
|
994
|
-
|
|
994
|
+
p.field
|
|
995
995
|
)) })
|
|
996
996
|
]
|
|
997
997
|
}
|
|
@@ -1008,9 +1008,9 @@ function cr(e) {
|
|
|
1008
1008
|
}) : "Unknown date";
|
|
1009
1009
|
}
|
|
1010
1010
|
function Rt(e, n) {
|
|
1011
|
-
const i = ce(), { data: a } =
|
|
1011
|
+
const i = ce(), { data: a } = le({
|
|
1012
1012
|
queryKey: ["revision-link-labels", e, n],
|
|
1013
|
-
queryFn: () => i.request(
|
|
1013
|
+
queryFn: () => i.request(X("/revisions/link-labels", { collection: e, item: n })).then((m) => m.data),
|
|
1014
1014
|
staleTime: 3e4
|
|
1015
1015
|
});
|
|
1016
1016
|
return a;
|
|
@@ -1020,94 +1020,137 @@ function mr({
|
|
|
1020
1020
|
item: n,
|
|
1021
1021
|
onRollback: i,
|
|
1022
1022
|
inlineTableFields: a,
|
|
1023
|
-
focusSave:
|
|
1023
|
+
focusSave: m,
|
|
1024
|
+
since: o,
|
|
1025
|
+
onShowAll: u
|
|
1024
1026
|
}) {
|
|
1025
|
-
const
|
|
1027
|
+
const l = ce(), b = He(e, !0), { data: c, isLoading: v } = le({
|
|
1026
1028
|
queryKey: ["revisions", e, n],
|
|
1027
|
-
queryFn: () =>
|
|
1029
|
+
queryFn: () => l.request(X("/revisions", { collection: e, item: n })).then((w) => w.data ?? []),
|
|
1028
1030
|
staleTime: 3e4
|
|
1029
|
-
}),
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1031
|
+
}), g = Rt(e, n), f = M(
|
|
1032
|
+
() => c && wt(c, g),
|
|
1033
|
+
[c, g]
|
|
1034
|
+
), p = o ? Date.parse(o) : Number.NaN, k = M(
|
|
1035
|
+
() => f && Number.isFinite(p) ? f.filter((w) => w.timestamp != null && Date.parse(w.timestamp) > p) : f,
|
|
1036
|
+
[f, p]
|
|
1037
|
+
), _ = Te();
|
|
1038
|
+
ft(e, n, [["revisions", e, n]], { client: _ });
|
|
1039
|
+
const y = Be(null), L = M(() => {
|
|
1040
|
+
if (!k) return /* @__PURE__ */ new Set();
|
|
1041
|
+
const w = k.map(oe);
|
|
1042
|
+
if (!y.current)
|
|
1043
|
+
return y.current = new Set(w), /* @__PURE__ */ new Set();
|
|
1044
|
+
const R = y.current;
|
|
1045
|
+
return new Set(w.filter((K) => !R.has(K)));
|
|
1046
|
+
}, [k]), q = (k == null ? void 0 : k.length) ?? 0, N = k !== f, h = M(() => (f ?? []).filter(Ie), [f]), T = M(
|
|
1047
|
+
() => (k ?? []).filter((w) => w.actor && w.actor.kind !== "person").map((w) => ({ action: w.action, user: w.user_id, actor: w.actor })),
|
|
1048
|
+
[k]
|
|
1049
|
+
), S = yt(T, { enabled: T.length > 0 }), E = M(() => {
|
|
1050
|
+
const w = [];
|
|
1051
|
+
for (const R of k ?? []) {
|
|
1052
|
+
const K = cr(R.timestamp), z = w[w.length - 1];
|
|
1053
|
+
z && z.day === K ? z.revisions.push(R) : w.push({ day: K, revisions: [R] });
|
|
1046
1054
|
}
|
|
1047
|
-
return
|
|
1048
|
-
}, [
|
|
1049
|
-
|
|
1050
|
-
/* @__PURE__ */ t(
|
|
1055
|
+
return w;
|
|
1056
|
+
}, [k]);
|
|
1057
|
+
if (v)
|
|
1058
|
+
return /* @__PURE__ */ t("div", { className: "space-y-2 pt-3", children: [1, 2, 3, 4].map((w) => /* @__PURE__ */ t(vt, { className: "h-11 rounded-md" }, w)) });
|
|
1059
|
+
const j = N ? /* @__PURE__ */ r(
|
|
1060
|
+
"div",
|
|
1061
|
+
{
|
|
1062
|
+
className: "mt-3 flex flex-wrap items-center gap-x-2 gap-y-1 rounded-md border border-sky-200 bg-sky-50 px-3 py-1.5 text-[12px] text-sky-800 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300",
|
|
1063
|
+
"data-revisions-window": !0,
|
|
1064
|
+
children: [
|
|
1065
|
+
/* @__PURE__ */ r("span", { children: [
|
|
1066
|
+
"Showing changes since ",
|
|
1067
|
+
o ? G(o) : "",
|
|
1068
|
+
" — ",
|
|
1069
|
+
q,
|
|
1070
|
+
" of",
|
|
1071
|
+
" ",
|
|
1072
|
+
(f == null ? void 0 : f.length) ?? 0
|
|
1073
|
+
] }),
|
|
1074
|
+
/* @__PURE__ */ t(
|
|
1075
|
+
"button",
|
|
1076
|
+
{
|
|
1077
|
+
type: "button",
|
|
1078
|
+
onClick: u,
|
|
1079
|
+
className: "font-medium underline decoration-sky-300 underline-offset-2 hover:text-sky-900 dark:decoration-sky-500/50 dark:hover:text-sky-200",
|
|
1080
|
+
children: "Show all"
|
|
1081
|
+
}
|
|
1082
|
+
)
|
|
1083
|
+
]
|
|
1084
|
+
}
|
|
1085
|
+
) : null;
|
|
1086
|
+
return q === 0 && N ? /* @__PURE__ */ r("div", { children: [
|
|
1087
|
+
j,
|
|
1088
|
+
/* @__PURE__ */ t("p", { className: "py-10 text-center text-[12.5px] text-slate-500 dark:text-slate-400", children: "Nothing in the history after that moment." })
|
|
1089
|
+
] }) : q === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center py-16 text-center", children: [
|
|
1090
|
+
/* @__PURE__ */ t(qe, { className: "mb-2 h-8 w-8 text-slate-300 dark:text-slate-600" }),
|
|
1051
1091
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No history yet" }),
|
|
1052
1092
|
/* @__PURE__ */ t("p", { className: "mt-1 max-w-[38ch] text-[12px] text-slate-400", children: "Every save records who changed what — the trail will appear here." })
|
|
1053
|
-
] }) : /* @__PURE__ */
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1093
|
+
] }) : /* @__PURE__ */ r(Je.Provider, { value: S, children: [
|
|
1094
|
+
j,
|
|
1095
|
+
/* @__PURE__ */ r("div", { className: "space-y-3 pt-3", children: [
|
|
1096
|
+
/* @__PURE__ */ t(
|
|
1097
|
+
dr,
|
|
1098
|
+
{
|
|
1099
|
+
data: h,
|
|
1100
|
+
history: f ?? [],
|
|
1101
|
+
meta: b,
|
|
1102
|
+
labels: S,
|
|
1103
|
+
focusSave: m ?? null
|
|
1104
|
+
}
|
|
1105
|
+
),
|
|
1106
|
+
/* @__PURE__ */ t("div", { children: E.map((w) => /* @__PURE__ */ r("div", { children: [
|
|
1107
|
+
/* @__PURE__ */ t("div", { className: "sticky top-0 z-10 -mx-6 border-b border-slate-100 bg-white px-6 py-1.5 dark:border-border/60 dark:bg-card", children: /* @__PURE__ */ t("span", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: w.day }) }),
|
|
1108
|
+
w.revisions.map((R) => {
|
|
1109
|
+
const z = (k ?? []).indexOf(R) === ((k == null ? void 0 : k.length) ?? 1) - 1;
|
|
1110
|
+
if (Ya(R))
|
|
1111
|
+
return /* @__PURE__ */ r(
|
|
1112
|
+
"div",
|
|
1113
|
+
{
|
|
1114
|
+
className: P(
|
|
1115
|
+
"nvr-fade-in relative",
|
|
1116
|
+
L.has(oe(R)) && "rounded-md bg-nvr-cyan/[0.06]"
|
|
1117
|
+
),
|
|
1118
|
+
children: [
|
|
1119
|
+
L.has(oe(R)) && /* @__PURE__ */ t(it, {}),
|
|
1120
|
+
/* @__PURE__ */ t(or, { revision: R, isLast: z })
|
|
1121
|
+
]
|
|
1122
|
+
},
|
|
1123
|
+
oe(R)
|
|
1124
|
+
);
|
|
1125
|
+
const U = (f ?? []).indexOf(R), J = (f ?? []).slice(U + 1).find(Ie);
|
|
1069
1126
|
return /* @__PURE__ */ r(
|
|
1070
1127
|
"div",
|
|
1071
1128
|
{
|
|
1072
|
-
className:
|
|
1129
|
+
className: P(
|
|
1073
1130
|
"nvr-fade-in relative",
|
|
1074
|
-
|
|
1131
|
+
L.has(oe(R)) && "rounded-md bg-nvr-cyan/[0.06]"
|
|
1075
1132
|
),
|
|
1076
1133
|
children: [
|
|
1077
|
-
|
|
1078
|
-
/* @__PURE__ */ t(
|
|
1134
|
+
L.has(oe(R)) && /* @__PURE__ */ t(it, {}),
|
|
1135
|
+
/* @__PURE__ */ t(
|
|
1136
|
+
ir,
|
|
1137
|
+
{
|
|
1138
|
+
revision: R,
|
|
1139
|
+
previousData: (J == null ? void 0 : J.data) ?? null,
|
|
1140
|
+
meta: b,
|
|
1141
|
+
onRollback: i,
|
|
1142
|
+
inlineTableFields: a,
|
|
1143
|
+
isLast: z
|
|
1144
|
+
}
|
|
1145
|
+
)
|
|
1079
1146
|
]
|
|
1080
1147
|
},
|
|
1081
|
-
oe(
|
|
1148
|
+
oe(R)
|
|
1082
1149
|
);
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
className: j(
|
|
1088
|
-
"nvr-fade-in relative",
|
|
1089
|
-
u.has(oe(m)) && "rounded-md bg-nvr-cyan/[0.06]"
|
|
1090
|
-
),
|
|
1091
|
-
children: [
|
|
1092
|
-
u.has(oe(m)) && /* @__PURE__ */ t(it, {}),
|
|
1093
|
-
/* @__PURE__ */ t(
|
|
1094
|
-
ir,
|
|
1095
|
-
{
|
|
1096
|
-
revision: m,
|
|
1097
|
-
previousData: (M == null ? void 0 : M.data) ?? null,
|
|
1098
|
-
meta: b,
|
|
1099
|
-
onRollback: i,
|
|
1100
|
-
inlineTableFields: a,
|
|
1101
|
-
isLast: w
|
|
1102
|
-
}
|
|
1103
|
-
)
|
|
1104
|
-
]
|
|
1105
|
-
},
|
|
1106
|
-
oe(m)
|
|
1107
|
-
);
|
|
1108
|
-
})
|
|
1109
|
-
] }, f.day)) })
|
|
1110
|
-
] }) });
|
|
1150
|
+
})
|
|
1151
|
+
] }, w.day)) })
|
|
1152
|
+
] })
|
|
1153
|
+
] });
|
|
1111
1154
|
}
|
|
1112
1155
|
function it() {
|
|
1113
1156
|
return (
|
|
@@ -1127,24 +1170,30 @@ function as({
|
|
|
1127
1170
|
item: n,
|
|
1128
1171
|
onRollback: i,
|
|
1129
1172
|
triggerClassName: a,
|
|
1130
|
-
inlineTableFields:
|
|
1173
|
+
inlineTableFields: m,
|
|
1131
1174
|
open: o,
|
|
1132
|
-
onOpenChange:
|
|
1133
|
-
compact: l
|
|
1175
|
+
onOpenChange: u,
|
|
1176
|
+
compact: l,
|
|
1177
|
+
since: b,
|
|
1178
|
+
onCloseAutoFocus: c
|
|
1134
1179
|
}) {
|
|
1135
|
-
const
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
}, [
|
|
1139
|
-
const
|
|
1140
|
-
|
|
1180
|
+
const v = o !== void 0, g = gt(e), [f, p] = A(() => b ? "timeline" : ur()), [k, _] = A(b ?? null);
|
|
1181
|
+
_e(() => {
|
|
1182
|
+
b && (_(b), p("timeline"));
|
|
1183
|
+
}, [b]);
|
|
1184
|
+
const y = Be(!!b), [L, q] = A(null);
|
|
1185
|
+
_e(() => {
|
|
1186
|
+
y.current || !g.view || (y.current = !0, p(g.view));
|
|
1187
|
+
}, [g.view]);
|
|
1188
|
+
const N = (h) => {
|
|
1189
|
+
y.current = !0, q(null), p(h), g.setView(h);
|
|
1141
1190
|
try {
|
|
1142
|
-
localStorage.setItem(Ft,
|
|
1191
|
+
localStorage.setItem(Ft, h);
|
|
1143
1192
|
} catch {
|
|
1144
1193
|
}
|
|
1145
1194
|
};
|
|
1146
|
-
return /* @__PURE__ */ r(Da, { open: o, onOpenChange:
|
|
1147
|
-
!
|
|
1195
|
+
return /* @__PURE__ */ r(Da, { open: o, onOpenChange: u, children: [
|
|
1196
|
+
!v && /* @__PURE__ */ t(La, { asChild: !0, children: /* @__PURE__ */ r(
|
|
1148
1197
|
ie,
|
|
1149
1198
|
{
|
|
1150
1199
|
variant: l ? "ghost" : "outline",
|
|
@@ -1153,7 +1202,7 @@ function as({
|
|
|
1153
1202
|
"aria-label": "History",
|
|
1154
1203
|
className: a ?? (l ? "h-8 w-8 rounded-none p-0" : "gap-1.5"),
|
|
1155
1204
|
children: [
|
|
1156
|
-
/* @__PURE__ */ t(
|
|
1205
|
+
/* @__PURE__ */ t(qe, { className: l ? "h-4 w-4" : "h-3.5 w-3.5" }),
|
|
1157
1206
|
!l && "History"
|
|
1158
1207
|
]
|
|
1159
1208
|
}
|
|
@@ -1161,32 +1210,33 @@ function as({
|
|
|
1161
1210
|
/* @__PURE__ */ t(
|
|
1162
1211
|
Aa,
|
|
1163
1212
|
{
|
|
1164
|
-
|
|
1213
|
+
onCloseAutoFocus: c,
|
|
1214
|
+
className: P(
|
|
1165
1215
|
"overflow-y-auto p-0 transition-[width] duration-200 ease-out sm:max-w-[92vw]",
|
|
1166
1216
|
// The table lays the fields out as columns: it gets the room for them.
|
|
1167
|
-
|
|
1217
|
+
f === "table" ? "w-[1320px]" : "w-[720px]"
|
|
1168
1218
|
),
|
|
1169
1219
|
children: /* @__PURE__ */ r("div", { className: "p-6", children: [
|
|
1170
1220
|
/* @__PURE__ */ r(Oa, { children: [
|
|
1171
1221
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-2 pr-8", children: [
|
|
1172
1222
|
/* @__PURE__ */ r(Ma, { className: "flex items-center gap-2 text-base", children: [
|
|
1173
|
-
/* @__PURE__ */ t(
|
|
1223
|
+
/* @__PURE__ */ t(qe, { className: "h-4 w-4 text-slate-400" }),
|
|
1174
1224
|
"Revision history"
|
|
1175
1225
|
] }),
|
|
1176
|
-
/* @__PURE__ */ t(
|
|
1226
|
+
/* @__PURE__ */ t(xr, { view: f, onChange: N })
|
|
1177
1227
|
] }),
|
|
1178
|
-
/* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children:
|
|
1228
|
+
/* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: f === "table" ? "Each save is a row and each field a column — read down a column to follow it over time, totals included." : "Who changed what, when — expand any entry to see the exact values, revert a single field, or restore the whole version." })
|
|
1179
1229
|
] }),
|
|
1180
|
-
|
|
1230
|
+
f === "table" ? /* @__PURE__ */ t(
|
|
1181
1231
|
yr,
|
|
1182
1232
|
{
|
|
1183
1233
|
collection: e,
|
|
1184
1234
|
item: n,
|
|
1185
|
-
onOpenSave: (
|
|
1186
|
-
|
|
1235
|
+
onOpenSave: (h) => {
|
|
1236
|
+
q(h.startsWith("move|") ? null : h), p("timeline");
|
|
1187
1237
|
}
|
|
1188
1238
|
}
|
|
1189
|
-
) : /* @__PURE__ */ r(
|
|
1239
|
+
) : /* @__PURE__ */ r(ee, { children: [
|
|
1190
1240
|
/* @__PURE__ */ t(pr, { collection: e, item: n }),
|
|
1191
1241
|
/* @__PURE__ */ t(ja, { collection: e, item: String(n) }),
|
|
1192
1242
|
/* @__PURE__ */ t(
|
|
@@ -1195,8 +1245,10 @@ function as({
|
|
|
1195
1245
|
collection: e,
|
|
1196
1246
|
item: n,
|
|
1197
1247
|
onRollback: i,
|
|
1198
|
-
inlineTableFields:
|
|
1199
|
-
focusSave:
|
|
1248
|
+
inlineTableFields: m,
|
|
1249
|
+
focusSave: L,
|
|
1250
|
+
since: k,
|
|
1251
|
+
onShowAll: () => _(null)
|
|
1200
1252
|
}
|
|
1201
1253
|
)
|
|
1202
1254
|
] })
|
|
@@ -1206,10 +1258,10 @@ function as({
|
|
|
1206
1258
|
] });
|
|
1207
1259
|
}
|
|
1208
1260
|
function pr({ collection: e, item: n }) {
|
|
1209
|
-
const i = ce(), a =
|
|
1210
|
-
queryKey: ["rev-value-search", e, n,
|
|
1211
|
-
queryFn: () => i.request(
|
|
1212
|
-
enabled:
|
|
1261
|
+
const i = ce(), a = He(e, !0), [m, o] = A(""), [u, l] = A(""), { data: b, isFetching: c } = le({
|
|
1262
|
+
queryKey: ["rev-value-search", e, n, u],
|
|
1263
|
+
queryFn: () => i.request(X("/revisions/value-search", { collection: e, item: n, q: u })).then((v) => v.data),
|
|
1264
|
+
enabled: u.length >= 2
|
|
1213
1265
|
});
|
|
1214
1266
|
return /* @__PURE__ */ r("div", { className: "mt-3", children: [
|
|
1215
1267
|
/* @__PURE__ */ r("div", { className: "relative", children: [
|
|
@@ -1217,16 +1269,16 @@ function pr({ collection: e, item: n }) {
|
|
|
1217
1269
|
/* @__PURE__ */ t(
|
|
1218
1270
|
"input",
|
|
1219
1271
|
{
|
|
1220
|
-
value:
|
|
1221
|
-
onChange: (
|
|
1222
|
-
onKeyDown: (
|
|
1223
|
-
|
|
1272
|
+
value: m,
|
|
1273
|
+
onChange: (v) => o(v.target.value),
|
|
1274
|
+
onKeyDown: (v) => {
|
|
1275
|
+
v.key === "Enter" && l(m.trim());
|
|
1224
1276
|
},
|
|
1225
1277
|
placeholder: "Search this record’s history for a value — who wrote it, and when",
|
|
1226
1278
|
className: "h-8 w-full rounded-md border border-slate-200 bg-background pl-8 pr-8 text-[12.5px] outline-none focus:border-nvr-cyan dark:border-border"
|
|
1227
1279
|
}
|
|
1228
1280
|
),
|
|
1229
|
-
|
|
1281
|
+
u && /* @__PURE__ */ t(
|
|
1230
1282
|
"button",
|
|
1231
1283
|
{
|
|
1232
1284
|
type: "button",
|
|
@@ -1239,46 +1291,46 @@ function pr({ collection: e, item: n }) {
|
|
|
1239
1291
|
}
|
|
1240
1292
|
)
|
|
1241
1293
|
] }),
|
|
1242
|
-
|
|
1294
|
+
u && /* @__PURE__ */ t("div", { className: "mt-2 space-y-1.5 rounded-lg border border-slate-200 p-2.5 dark:border-border", children: c ? /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Searching…" }) : ((b == null ? void 0 : b.matches) ?? []).length === 0 ? /* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-400", children: [
|
|
1243
1295
|
"“",
|
|
1244
|
-
|
|
1296
|
+
u,
|
|
1245
1297
|
"” never appears in this record’s recorded changes."
|
|
1246
|
-
] }) : /* @__PURE__ */ r(
|
|
1247
|
-
|
|
1248
|
-
/* @__PURE__ */ t("p", { className: "text-slate-600 dark:text-slate-300", children:
|
|
1249
|
-
/* @__PURE__ */ t("span", { className: "font-medium", title:
|
|
1298
|
+
] }) : /* @__PURE__ */ r(ee, { children: [
|
|
1299
|
+
b == null ? void 0 : b.matches.map((v) => /* @__PURE__ */ r("div", { className: "text-[11.5px]", children: [
|
|
1300
|
+
/* @__PURE__ */ t("p", { className: "text-slate-600 dark:text-slate-300", children: v.fields.map((g) => /* @__PURE__ */ r("span", { children: [
|
|
1301
|
+
/* @__PURE__ */ t("span", { className: "font-medium", title: g.field, children: F(a, g.field).label }),
|
|
1250
1302
|
" ",
|
|
1251
1303
|
"→ “",
|
|
1252
|
-
|
|
1304
|
+
g.value.length > 60 ? `${g.value.slice(0, 60)}…` : g.value,
|
|
1253
1305
|
"”",
|
|
1254
1306
|
" "
|
|
1255
|
-
] },
|
|
1307
|
+
] }, g.field)) }),
|
|
1256
1308
|
/* @__PURE__ */ r("p", { className: "text-[10.5px] text-slate-400", children: [
|
|
1257
|
-
|
|
1309
|
+
v.user_name ?? "System",
|
|
1258
1310
|
" · ",
|
|
1259
|
-
|
|
1311
|
+
v.timestamp ? G(v.timestamp) : "",
|
|
1260
1312
|
" ·",
|
|
1261
1313
|
" ",
|
|
1262
|
-
|
|
1314
|
+
v.action
|
|
1263
1315
|
] })
|
|
1264
|
-
] },
|
|
1265
|
-
(
|
|
1316
|
+
] }, v.revision_id)),
|
|
1317
|
+
(b == null ? void 0 : b.truncated) && /* @__PURE__ */ t("p", { className: "text-[10.5px] text-amber-600", children: "Showing the newest 200 matches." })
|
|
1266
1318
|
] }) })
|
|
1267
1319
|
] });
|
|
1268
1320
|
}
|
|
1269
1321
|
function hr({ revisionId: e }) {
|
|
1270
|
-
const n = ce(), i =
|
|
1322
|
+
const n = ce(), i = Te(), [a, m] = A(""), { data: o = [] } = le({
|
|
1271
1323
|
queryKey: ["revision-notes", String(e)],
|
|
1272
|
-
queryFn: () => n.request(
|
|
1324
|
+
queryFn: () => n.request(X("/comments", { collection: "nivaro_revisions", item: String(e) })).then((l) => l.data ?? []).catch(() => []),
|
|
1273
1325
|
staleTime: 3e4
|
|
1274
|
-
}),
|
|
1326
|
+
}), u = je({
|
|
1275
1327
|
mutationFn: () => n.request(
|
|
1276
1328
|
Ne("/comments", { collection: "nivaro_revisions", item: String(e), text: a })
|
|
1277
1329
|
),
|
|
1278
1330
|
onSuccess: () => {
|
|
1279
|
-
|
|
1331
|
+
m(""), i.invalidateQueries({ queryKey: ["revision-notes", String(e)] });
|
|
1280
1332
|
},
|
|
1281
|
-
onError: () =>
|
|
1333
|
+
onError: () => ne.error("Note failed")
|
|
1282
1334
|
});
|
|
1283
1335
|
return /* @__PURE__ */ r("div", { className: "rounded-md border border-slate-100 bg-slate-50/60 p-2 dark:border-border/60 dark:bg-muted/30", children: [
|
|
1284
1336
|
o.map((l) => /* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: [
|
|
@@ -1295,7 +1347,7 @@ function hr({ revisionId: e }) {
|
|
|
1295
1347
|
"form",
|
|
1296
1348
|
{
|
|
1297
1349
|
onSubmit: (l) => {
|
|
1298
|
-
l.preventDefault(), a.trim() &&
|
|
1350
|
+
l.preventDefault(), a.trim() && u.mutate();
|
|
1299
1351
|
},
|
|
1300
1352
|
className: "mt-1 flex gap-1.5",
|
|
1301
1353
|
children: [
|
|
@@ -1303,7 +1355,7 @@ function hr({ revisionId: e }) {
|
|
|
1303
1355
|
"input",
|
|
1304
1356
|
{
|
|
1305
1357
|
value: a,
|
|
1306
|
-
onChange: (l) =>
|
|
1358
|
+
onChange: (l) => m(l.target.value),
|
|
1307
1359
|
placeholder: "Annotate this revision…",
|
|
1308
1360
|
className: "h-6 flex-1 rounded border border-slate-200 bg-transparent px-1.5 text-[11.5px] outline-none dark:border-border"
|
|
1309
1361
|
}
|
|
@@ -1312,7 +1364,7 @@ function hr({ revisionId: e }) {
|
|
|
1312
1364
|
"button",
|
|
1313
1365
|
{
|
|
1314
1366
|
type: "submit",
|
|
1315
|
-
disabled:
|
|
1367
|
+
disabled: u.isPending,
|
|
1316
1368
|
className: "rounded bg-nvr-cyan px-2 text-[11px] font-semibold text-white disabled:opacity-50",
|
|
1317
1369
|
children: "Add"
|
|
1318
1370
|
}
|
|
@@ -1322,12 +1374,12 @@ function hr({ revisionId: e }) {
|
|
|
1322
1374
|
)
|
|
1323
1375
|
] });
|
|
1324
1376
|
}
|
|
1325
|
-
function
|
|
1377
|
+
function Re({
|
|
1326
1378
|
userId: e,
|
|
1327
1379
|
name: n,
|
|
1328
1380
|
size: i = "md"
|
|
1329
1381
|
}) {
|
|
1330
|
-
const a = i === "sm" ? "h-5 w-5 text-[9px]" : "h-6 w-6 text-[10px]",
|
|
1382
|
+
const a = i === "sm" ? "h-5 w-5 text-[9px]" : "h-6 w-6 text-[10px]", m = n.split(" ").map((u) => u[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "·", o = /* @__PURE__ */ t(
|
|
1331
1383
|
va,
|
|
1332
1384
|
{
|
|
1333
1385
|
userId: e,
|
|
@@ -1335,11 +1387,11 @@ function Te({
|
|
|
1335
1387
|
fallback: /* @__PURE__ */ t(
|
|
1336
1388
|
"span",
|
|
1337
1389
|
{
|
|
1338
|
-
className:
|
|
1390
|
+
className: P(
|
|
1339
1391
|
"flex shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 font-semibold text-nvr-navy dark:text-nvr-cyan",
|
|
1340
1392
|
a
|
|
1341
1393
|
),
|
|
1342
|
-
children:
|
|
1394
|
+
children: m
|
|
1343
1395
|
}
|
|
1344
1396
|
)
|
|
1345
1397
|
}
|
|
@@ -1350,7 +1402,7 @@ function Te({
|
|
|
1350
1402
|
type: "button",
|
|
1351
1403
|
"aria-label": `${n} — open profile card`,
|
|
1352
1404
|
"data-revision-avatar": !0,
|
|
1353
|
-
onClick: (
|
|
1405
|
+
onClick: (u) => u.stopPropagation(),
|
|
1354
1406
|
className: "shrink-0 rounded-full transition-shadow hover:ring-2 hover:ring-nvr-cyan/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
1355
1407
|
children: o
|
|
1356
1408
|
}
|
|
@@ -1364,7 +1416,7 @@ function ur() {
|
|
|
1364
1416
|
return "timeline";
|
|
1365
1417
|
}
|
|
1366
1418
|
}
|
|
1367
|
-
function
|
|
1419
|
+
function xr({
|
|
1368
1420
|
view: e,
|
|
1369
1421
|
onChange: n
|
|
1370
1422
|
}) {
|
|
@@ -1375,23 +1427,23 @@ function br({
|
|
|
1375
1427
|
"data-revision-view-switch": !0,
|
|
1376
1428
|
className: "m-0 inline-flex min-w-0 shrink-0 rounded-lg border border-slate-200 bg-slate-100 p-0.5 dark:border-border dark:bg-muted",
|
|
1377
1429
|
children: [
|
|
1378
|
-
{ v: "timeline", label: "Timeline", icon:
|
|
1379
|
-
{ v: "table", label: "Table", icon:
|
|
1380
|
-
].map(({ v: a, label:
|
|
1381
|
-
const
|
|
1430
|
+
{ v: "timeline", label: "Timeline", icon: Wt },
|
|
1431
|
+
{ v: "table", label: "Table", icon: Ht }
|
|
1432
|
+
].map(({ v: a, label: m, icon: o }) => {
|
|
1433
|
+
const u = e === a;
|
|
1382
1434
|
return /* @__PURE__ */ r(
|
|
1383
1435
|
"button",
|
|
1384
1436
|
{
|
|
1385
1437
|
type: "button",
|
|
1386
|
-
"aria-pressed":
|
|
1438
|
+
"aria-pressed": u,
|
|
1387
1439
|
onClick: () => n(a),
|
|
1388
|
-
className:
|
|
1440
|
+
className: P(
|
|
1389
1441
|
"inline-flex h-7 items-center gap-1.5 rounded-md px-3 text-[12px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
1390
|
-
|
|
1442
|
+
u ? "bg-white text-slate-900 shadow-[0_1px_2px_rgba(15,23,42,0.08)] dark:bg-card dark:text-slate-100" : "text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-200"
|
|
1391
1443
|
),
|
|
1392
1444
|
children: [
|
|
1393
1445
|
/* @__PURE__ */ t(o, { className: "h-3.5 w-3.5" }),
|
|
1394
|
-
|
|
1446
|
+
m
|
|
1395
1447
|
]
|
|
1396
1448
|
},
|
|
1397
1449
|
a
|
|
@@ -1400,21 +1452,21 @@ function br({
|
|
|
1400
1452
|
}
|
|
1401
1453
|
);
|
|
1402
1454
|
}
|
|
1403
|
-
function
|
|
1455
|
+
function be(e, n) {
|
|
1404
1456
|
return e == null || e === "" ? "" : ve(e) ? St(e) : n.cmp && typeof e != "object" && !n.dateOnly ? Ue(e, n.cmp) : Nt(e, n.dateOnly);
|
|
1405
1457
|
}
|
|
1406
1458
|
function Ce(e, n, i) {
|
|
1407
|
-
const a =
|
|
1459
|
+
const a = F(i, e);
|
|
1408
1460
|
return za(
|
|
1409
1461
|
e,
|
|
1410
1462
|
n,
|
|
1411
1463
|
a.derive ?? null,
|
|
1412
|
-
(
|
|
1413
|
-
(
|
|
1464
|
+
(m, o) => m == null ? F(i, o ?? "").label : o ? ye(o.replace(/_/g, " ")) : ye(m.replace(/_/g, " ")),
|
|
1465
|
+
(m) => br(m, a)
|
|
1414
1466
|
);
|
|
1415
1467
|
}
|
|
1416
1468
|
const dt = (e) => e == null || e === "", ct = (e) => ve(e) || typeof e == "string" && e.length > 60;
|
|
1417
|
-
function
|
|
1469
|
+
function br(e, n) {
|
|
1418
1470
|
if (!n.cmp) return Ba(e);
|
|
1419
1471
|
const i = Ue(Math.abs(e), n.cmp);
|
|
1420
1472
|
return `${e > 0 ? "+" : e < 0 ? "−" : ""}${i}`;
|
|
@@ -1425,16 +1477,16 @@ function fr({
|
|
|
1425
1477
|
tag: i,
|
|
1426
1478
|
onRemove: a
|
|
1427
1479
|
}) {
|
|
1428
|
-
const { attributes:
|
|
1480
|
+
const { attributes: m, listeners: o, setNodeRef: u, transform: l, transition: b, isDragging: c } = Bt({
|
|
1429
1481
|
id: e
|
|
1430
1482
|
});
|
|
1431
1483
|
return /* @__PURE__ */ r(
|
|
1432
1484
|
"div",
|
|
1433
1485
|
{
|
|
1434
|
-
ref:
|
|
1435
|
-
style: { transform: Ut.Transform.toString(l), transition:
|
|
1486
|
+
ref: u,
|
|
1487
|
+
style: { transform: Ut.Transform.toString(l), transition: b },
|
|
1436
1488
|
"data-shown-field": e,
|
|
1437
|
-
className:
|
|
1489
|
+
className: P(
|
|
1438
1490
|
"flex items-center gap-2 rounded-sm px-2 py-1.5 text-[12px] hover:bg-slate-50 dark:hover:bg-muted/60",
|
|
1439
1491
|
c && "relative z-10 bg-white shadow-md ring-1 ring-slate-200 dark:bg-card dark:ring-border"
|
|
1440
1492
|
),
|
|
@@ -1445,11 +1497,11 @@ function fr({
|
|
|
1445
1497
|
type: "button",
|
|
1446
1498
|
"aria-label": `Drag to move ${n}`,
|
|
1447
1499
|
className: "cursor-grab touch-none rounded p-0.5 text-slate-400 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan active:cursor-grabbing dark:hover:text-slate-200",
|
|
1448
|
-
...
|
|
1500
|
+
...m,
|
|
1449
1501
|
...o,
|
|
1450
|
-
onKeyDown: (
|
|
1451
|
-
var
|
|
1452
|
-
|
|
1502
|
+
onKeyDown: (v) => {
|
|
1503
|
+
var g;
|
|
1504
|
+
v.stopPropagation(), (g = o == null ? void 0 : o.onKeyDown) == null || g.call(o, v);
|
|
1453
1505
|
},
|
|
1454
1506
|
children: /* @__PURE__ */ t(ut, { className: "h-3.5 w-3.5" })
|
|
1455
1507
|
}
|
|
@@ -1474,62 +1526,62 @@ function gr({
|
|
|
1474
1526
|
meta: n,
|
|
1475
1527
|
order: i,
|
|
1476
1528
|
shown: a,
|
|
1477
|
-
defaultOrder:
|
|
1529
|
+
defaultOrder: m,
|
|
1478
1530
|
saved: o,
|
|
1479
|
-
onChange:
|
|
1531
|
+
onChange: u,
|
|
1480
1532
|
onReset: l
|
|
1481
1533
|
}) {
|
|
1482
|
-
const [
|
|
1534
|
+
const [b, c] = A(!1), [v, g] = A(""), f = M(() => new Map(e.map((h) => [h.field, h])), [e]), p = i.filter((h) => f.has(h)), k = Mt(
|
|
1483
1535
|
Ze(jt, { activationConstraint: { distance: 4 } }),
|
|
1484
1536
|
Ze(qt, { coordinateGetter: It })
|
|
1485
|
-
), _ = (
|
|
1486
|
-
const
|
|
1487
|
-
if (
|
|
1488
|
-
const
|
|
1489
|
-
let
|
|
1490
|
-
|
|
1491
|
-
}, y = (
|
|
1492
|
-
const
|
|
1493
|
-
const
|
|
1494
|
-
for (const
|
|
1495
|
-
|
|
1537
|
+
), _ = (h) => {
|
|
1538
|
+
const T = p.indexOf(String(h.active.id)), S = h.over ? p.indexOf(String(h.over.id)) : -1;
|
|
1539
|
+
if (T < 0 || S < 0 || T === S) return;
|
|
1540
|
+
const E = zt(p, T, S);
|
|
1541
|
+
let j = 0;
|
|
1542
|
+
u(i.map((w) => f.has(w) ? E[j++] : w));
|
|
1543
|
+
}, y = (h) => u(a.has(h) ? i.filter((T) => T !== h) : [...i, h]), L = M(() => {
|
|
1544
|
+
const h = e.filter((w) => !a.has(w.field)), T = [], S = /* @__PURE__ */ new Set(), E = (w, R, K) => {
|
|
1545
|
+
const z = K.filter((U) => !S.has(U.field));
|
|
1546
|
+
for (const U of z) S.add(U.field);
|
|
1547
|
+
z.length && T.push({ key: w, label: R, items: z });
|
|
1496
1548
|
};
|
|
1497
|
-
|
|
1549
|
+
E(
|
|
1498
1550
|
"changed",
|
|
1499
1551
|
"Changed on this record",
|
|
1500
|
-
|
|
1501
|
-
),
|
|
1552
|
+
h.filter((w) => w.changes > 0 && !w.field.startsWith("child:")).sort((w, R) => R.changes - w.changes)
|
|
1553
|
+
), E(
|
|
1502
1554
|
"computed",
|
|
1503
1555
|
"Totals and calculated fields",
|
|
1504
|
-
|
|
1556
|
+
h.filter((w) => F(n, w.field).derive)
|
|
1505
1557
|
);
|
|
1506
|
-
const
|
|
1507
|
-
for (const
|
|
1508
|
-
const
|
|
1509
|
-
if (!
|
|
1510
|
-
const
|
|
1511
|
-
|
|
1558
|
+
const j = /* @__PURE__ */ new Map();
|
|
1559
|
+
for (const w of h) {
|
|
1560
|
+
const R = F(n, w.field).section;
|
|
1561
|
+
if (!R) continue;
|
|
1562
|
+
const K = j.get(R.key) ?? { label: R.label, sort: R.sort, items: [] };
|
|
1563
|
+
K.items.push(w), j.set(R.key, K);
|
|
1512
1564
|
}
|
|
1513
|
-
for (const [
|
|
1514
|
-
|
|
1515
|
-
return
|
|
1516
|
-
}, [e, a, n]),
|
|
1565
|
+
for (const [w, R] of [...j].sort((K, z) => K[1].sort - z[1].sort))
|
|
1566
|
+
E(`section:${w}`, R.label, R.items);
|
|
1567
|
+
return E("other", "Other fields", h), T;
|
|
1568
|
+
}, [e, a, n]), q = (h) => /* @__PURE__ */ t(
|
|
1517
1569
|
"span",
|
|
1518
1570
|
{
|
|
1519
|
-
className:
|
|
1571
|
+
className: P(
|
|
1520
1572
|
"flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-sm border",
|
|
1521
|
-
|
|
1573
|
+
h ? "border-nvr-cyan bg-nvr-cyan text-white" : "border-slate-300 dark:border-slate-600"
|
|
1522
1574
|
),
|
|
1523
|
-
children:
|
|
1575
|
+
children: h && /* @__PURE__ */ t(ea, { className: "h-3 w-3" })
|
|
1524
1576
|
}
|
|
1525
|
-
),
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1577
|
+
), N = (h) => /* @__PURE__ */ r("span", { className: "ml-auto flex shrink-0 items-center gap-1.5 text-[11px] text-slate-400", children: [
|
|
1578
|
+
F(n, h.field).derive && /* @__PURE__ */ t(Se, { className: "h-3 w-3", "aria-label": "Calculated" }),
|
|
1579
|
+
h.changes > 0 && /* @__PURE__ */ r("span", { className: "tabular-nums", children: [
|
|
1580
|
+
h.changes,
|
|
1529
1581
|
"×"
|
|
1530
1582
|
] })
|
|
1531
1583
|
] });
|
|
1532
|
-
return /* @__PURE__ */ r(Ta, { open:
|
|
1584
|
+
return /* @__PURE__ */ r(Ta, { open: b, onOpenChange: c, children: [
|
|
1533
1585
|
/* @__PURE__ */ t(Ra, { asChild: !0, children: /* @__PURE__ */ r(
|
|
1534
1586
|
"button",
|
|
1535
1587
|
{
|
|
@@ -1540,7 +1592,7 @@ function gr({
|
|
|
1540
1592
|
/* @__PURE__ */ t(Yt, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
1541
1593
|
/* @__PURE__ */ r("span", { children: [
|
|
1542
1594
|
"Fields ",
|
|
1543
|
-
/* @__PURE__ */ t("span", { className: "tabular-nums text-slate-400", children:
|
|
1595
|
+
/* @__PURE__ */ t("span", { className: "tabular-nums text-slate-400", children: p.length }),
|
|
1544
1596
|
/* @__PURE__ */ r("span", { className: "text-slate-400", children: [
|
|
1545
1597
|
" of ",
|
|
1546
1598
|
e.length
|
|
@@ -1556,8 +1608,8 @@ function gr({
|
|
|
1556
1608
|
{
|
|
1557
1609
|
placeholder: "Find a field…",
|
|
1558
1610
|
className: "text-[12px]",
|
|
1559
|
-
value:
|
|
1560
|
-
onValueChange:
|
|
1611
|
+
value: v,
|
|
1612
|
+
onValueChange: g
|
|
1561
1613
|
}
|
|
1562
1614
|
),
|
|
1563
1615
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-1 border-b border-slate-100 px-2 py-1.5 text-[11.5px] dark:border-border/60", children: [
|
|
@@ -1565,7 +1617,7 @@ function gr({
|
|
|
1565
1617
|
"button",
|
|
1566
1618
|
{
|
|
1567
1619
|
type: "button",
|
|
1568
|
-
onClick: () =>
|
|
1620
|
+
onClick: () => u(m),
|
|
1569
1621
|
className: "rounded px-2 py-0.5 text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-muted",
|
|
1570
1622
|
children: "Changed fields"
|
|
1571
1623
|
}
|
|
@@ -1574,7 +1626,7 @@ function gr({
|
|
|
1574
1626
|
"button",
|
|
1575
1627
|
{
|
|
1576
1628
|
type: "button",
|
|
1577
|
-
onClick: () =>
|
|
1629
|
+
onClick: () => u(e.map((h) => h.field)),
|
|
1578
1630
|
className: "rounded px-2 py-0.5 text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-muted",
|
|
1579
1631
|
children: "All"
|
|
1580
1632
|
}
|
|
@@ -1583,7 +1635,7 @@ function gr({
|
|
|
1583
1635
|
"button",
|
|
1584
1636
|
{
|
|
1585
1637
|
type: "button",
|
|
1586
|
-
onClick: () =>
|
|
1638
|
+
onClick: () => u([]),
|
|
1587
1639
|
className: "rounded px-2 py-0.5 text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-muted",
|
|
1588
1640
|
children: "None"
|
|
1589
1641
|
}
|
|
@@ -1601,61 +1653,61 @@ function gr({
|
|
|
1601
1653
|
] }),
|
|
1602
1654
|
/* @__PURE__ */ r(Na, { className: "max-h-[420px]", children: [
|
|
1603
1655
|
/* @__PURE__ */ t(Ca, { children: "No field by that name." }),
|
|
1604
|
-
|
|
1656
|
+
p.length > 0 && !v.trim() && /* @__PURE__ */ r("div", { className: "px-1 pb-1", "data-shown-columns": !0, children: [
|
|
1605
1657
|
/* @__PURE__ */ t("p", { className: "px-2 pb-1 pt-2 text-[11px] font-medium text-slate-500 dark:text-slate-400", children: "Shown, in this order — drag to move" }),
|
|
1606
1658
|
/* @__PURE__ */ t(
|
|
1607
1659
|
Pt,
|
|
1608
1660
|
{
|
|
1609
|
-
sensors:
|
|
1661
|
+
sensors: k,
|
|
1610
1662
|
collisionDetection: Et,
|
|
1611
1663
|
onDragEnd: _,
|
|
1612
|
-
children: /* @__PURE__ */ t(Kt, { items:
|
|
1613
|
-
const
|
|
1664
|
+
children: /* @__PURE__ */ t(Kt, { items: p, strategy: Vt, children: p.map((h) => {
|
|
1665
|
+
const T = f.get(h);
|
|
1614
1666
|
return /* @__PURE__ */ t(
|
|
1615
1667
|
fr,
|
|
1616
1668
|
{
|
|
1617
|
-
field:
|
|
1618
|
-
label:
|
|
1619
|
-
tag:
|
|
1620
|
-
onRemove: () => y(
|
|
1669
|
+
field: h,
|
|
1670
|
+
label: T.label,
|
|
1671
|
+
tag: N(T),
|
|
1672
|
+
onRemove: () => y(h)
|
|
1621
1673
|
},
|
|
1622
|
-
|
|
1674
|
+
h
|
|
1623
1675
|
);
|
|
1624
1676
|
}) })
|
|
1625
1677
|
}
|
|
1626
1678
|
)
|
|
1627
1679
|
] }),
|
|
1628
|
-
|
|
1629
|
-
const
|
|
1680
|
+
p.length > 0 && v.trim() !== "" && /* @__PURE__ */ t(at, { heading: "Shown", children: p.map((h) => {
|
|
1681
|
+
const T = f.get(h);
|
|
1630
1682
|
return /* @__PURE__ */ r(
|
|
1631
1683
|
rt,
|
|
1632
1684
|
{
|
|
1633
|
-
value: `${
|
|
1634
|
-
onSelect: () => y(
|
|
1685
|
+
value: `${T.label} ${h} shown`,
|
|
1686
|
+
onSelect: () => y(h),
|
|
1635
1687
|
className: "text-[12px]",
|
|
1636
1688
|
children: [
|
|
1637
|
-
|
|
1638
|
-
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children:
|
|
1639
|
-
|
|
1689
|
+
q(!0),
|
|
1690
|
+
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: T.label }),
|
|
1691
|
+
N(T)
|
|
1640
1692
|
]
|
|
1641
1693
|
},
|
|
1642
|
-
`shown-${
|
|
1694
|
+
`shown-${h}`
|
|
1643
1695
|
);
|
|
1644
1696
|
}) }),
|
|
1645
|
-
L.map((
|
|
1697
|
+
L.map((h) => /* @__PURE__ */ t(at, { heading: h.label, children: h.items.map((T) => /* @__PURE__ */ r(
|
|
1646
1698
|
rt,
|
|
1647
1699
|
{
|
|
1648
|
-
value: `${
|
|
1649
|
-
onSelect: () => y(
|
|
1700
|
+
value: `${T.label} ${T.field} ${h.label}`,
|
|
1701
|
+
onSelect: () => y(T.field),
|
|
1650
1702
|
className: "text-[12px]",
|
|
1651
1703
|
children: [
|
|
1652
|
-
|
|
1653
|
-
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children:
|
|
1654
|
-
|
|
1704
|
+
q(!1),
|
|
1705
|
+
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: T.label }),
|
|
1706
|
+
N(T)
|
|
1655
1707
|
]
|
|
1656
1708
|
},
|
|
1657
|
-
`${
|
|
1658
|
-
)) },
|
|
1709
|
+
`${h.key}-${T.field}`
|
|
1710
|
+
)) }, h.key))
|
|
1659
1711
|
] }),
|
|
1660
1712
|
/* @__PURE__ */ t("p", { className: "border-t border-slate-100 px-3 py-1.5 text-[11px] text-slate-500 dark:border-border/60 dark:text-slate-400", children: "Saved to your account for every record of this kind. Drag here or drag a column header to move it." })
|
|
1661
1713
|
] }) })
|
|
@@ -1674,29 +1726,29 @@ function yr({
|
|
|
1674
1726
|
onOpenSave: i
|
|
1675
1727
|
}) {
|
|
1676
1728
|
var Ye, Ge;
|
|
1677
|
-
const a = ce(),
|
|
1729
|
+
const a = ce(), m = He(e, !0), { data: o, isLoading: u } = le({
|
|
1678
1730
|
queryKey: ["revisions", e, n],
|
|
1679
|
-
queryFn: () => a.request(
|
|
1731
|
+
queryFn: () => a.request(X("/revisions", { collection: e, item: n })).then((s) => s.data ?? []),
|
|
1680
1732
|
staleTime: 3e4
|
|
1681
|
-
}), l =
|
|
1733
|
+
}), l = Te();
|
|
1682
1734
|
ft(e, n, [["revisions", e, n]], { client: l });
|
|
1683
|
-
const
|
|
1735
|
+
const b = M(
|
|
1684
1736
|
() => (o ?? []).filter((s) => s.actor && s.actor.kind !== "person").map((s) => ({ action: s.action, user: s.user_id, actor: s.actor })),
|
|
1685
1737
|
[o]
|
|
1686
|
-
), c = yt(
|
|
1687
|
-
() => kt(wt(o ?? [],
|
|
1688
|
-
name: (s) =>
|
|
1738
|
+
), c = yt(b, { enabled: b.length > 0 }), v = Rt(e, n), g = M(
|
|
1739
|
+
() => kt(wt(o ?? [], v), {
|
|
1740
|
+
name: (s) => te(s, c),
|
|
1689
1741
|
// Pipeline moves are rows of their own while the Pipeline step column is shown.
|
|
1690
1742
|
withMoves: !0
|
|
1691
1743
|
}),
|
|
1692
|
-
[o, c,
|
|
1693
|
-
), { data:
|
|
1744
|
+
[o, c, v]
|
|
1745
|
+
), { data: f } = le({
|
|
1694
1746
|
queryKey: ["revision-child-columns", e, n],
|
|
1695
|
-
queryFn: () => a.request(
|
|
1747
|
+
queryFn: () => a.request(X("/revisions/child-columns", { collection: e, item: n })).then((s) => s.data),
|
|
1696
1748
|
staleTime: 3e4
|
|
1697
|
-
}),
|
|
1698
|
-
const s = new Map(
|
|
1699
|
-
for (const d of (
|
|
1749
|
+
}), p = M(() => {
|
|
1750
|
+
const s = new Map(m);
|
|
1751
|
+
for (const d of (f == null ? void 0 : f.columns) ?? [])
|
|
1700
1752
|
s.set(d.key, {
|
|
1701
1753
|
label: `${d.row_label} · ${d.field_label}`,
|
|
1702
1754
|
system: !1,
|
|
@@ -1705,93 +1757,93 @@ function yr({
|
|
|
1705
1757
|
section: { key: `child:${d.collection}`, label: d.collection_label, sort: 1e5 }
|
|
1706
1758
|
});
|
|
1707
1759
|
return s;
|
|
1708
|
-
}, [
|
|
1709
|
-
const s = (
|
|
1710
|
-
if (!s.length) return
|
|
1711
|
-
const d =
|
|
1712
|
-
for (const
|
|
1713
|
-
const
|
|
1714
|
-
for (const
|
|
1715
|
-
for (let
|
|
1716
|
-
Pa(d[
|
|
1760
|
+
}, [m, f]), k = M(() => {
|
|
1761
|
+
const s = (f == null ? void 0 : f.columns) ?? [];
|
|
1762
|
+
if (!s.length) return g;
|
|
1763
|
+
const d = g.map((C) => ({ ...C, values: { ...C.values }, changed: new Set(C.changed) }));
|
|
1764
|
+
for (const C of s) {
|
|
1765
|
+
const $ = (f == null ? void 0 : f.series[C.key]) ?? [];
|
|
1766
|
+
for (const B of d) B.values[C.key] = qa($, B.timestamp);
|
|
1767
|
+
for (let B = 0; B < d.length - 1; B++)
|
|
1768
|
+
Pa(d[B].values[C.key], d[B + 1].values[C.key]) || d[B].changed.add(C.key);
|
|
1717
1769
|
}
|
|
1718
1770
|
return d;
|
|
1719
|
-
}, [
|
|
1720
|
-
() => Ea(
|
|
1721
|
-
[
|
|
1722
|
-
), y = gt(e), L = ua(e), { isAdmin:
|
|
1771
|
+
}, [g, f]), _ = M(
|
|
1772
|
+
() => Ea(k, (s) => F(p, s)),
|
|
1773
|
+
[k, p]
|
|
1774
|
+
), y = gt(e), L = ua(e), { isAdmin: q } = oa(), N = M(
|
|
1723
1775
|
() => _.filter((s) => s.changes > 0 && !s.field.startsWith("child:")).map((s) => s.field),
|
|
1724
1776
|
[_]
|
|
1725
|
-
),
|
|
1777
|
+
), h = y.columns ?? ((Ye = L.roleDefault) == null ? void 0 : Ye.fields) ?? N, T = M(() => new Set(h), [h]), S = M(() => {
|
|
1726
1778
|
const s = new Map(_.map((d) => [d.field, d]));
|
|
1727
|
-
return
|
|
1728
|
-
}, [
|
|
1779
|
+
return h.map((d) => s.get(d)).filter((d) => !!d);
|
|
1780
|
+
}, [h, _]), E = (s) => y.setColumns([...new Set(s)]), [j, w] = A(null), [R, K] = A(null), z = (s, d) => {
|
|
1729
1781
|
if (s === d) return;
|
|
1730
|
-
const
|
|
1731
|
-
|
|
1732
|
-
},
|
|
1782
|
+
const C = h.filter((B) => B !== s), $ = C.indexOf(d);
|
|
1783
|
+
E($ < 0 ? [...C, s] : [...C.slice(0, $), s, ...C.slice($)]);
|
|
1784
|
+
}, U = Be(null), [J, ue] = A(!0), x = na(), [D, Z] = A(""), [V, me] = A(""), [xe, O] = A(/* @__PURE__ */ new Set()), W = M(() => {
|
|
1733
1785
|
const s = /* @__PURE__ */ new Map();
|
|
1734
|
-
for (const d of
|
|
1735
|
-
return [...s].map(([d,
|
|
1736
|
-
}, [
|
|
1737
|
-
let s =
|
|
1786
|
+
for (const d of k) s.set(d.who, (s.get(d.who) ?? 0) + 1);
|
|
1787
|
+
return [...s].map(([d, C]) => ({ name: d, count: C })).sort((d, C) => C.count - d.count);
|
|
1788
|
+
}, [k]), Q = M(() => {
|
|
1789
|
+
let s = T.has(ge) ? k : k.filter((d) => d.action !== "moved");
|
|
1738
1790
|
return s = s.filter(
|
|
1739
|
-
(d) => Ua(d.timestamp,
|
|
1740
|
-
),
|
|
1791
|
+
(d) => Ua(d.timestamp, D, V) && (xe.size === 0 || xe.has(d.who))
|
|
1792
|
+
), J ? Ia(
|
|
1741
1793
|
s,
|
|
1742
|
-
|
|
1794
|
+
S.map((d) => d.field)
|
|
1743
1795
|
) : s;
|
|
1744
|
-
}, [
|
|
1745
|
-
if (
|
|
1746
|
-
const s =
|
|
1796
|
+
}, [k, S, T, J, D, V, xe]), [ae, ke] = A([]), Fe = (s) => ke((d) => d.includes(s) ? d.filter((C) => C !== s) : [...d, s].slice(-2)), re = M(() => {
|
|
1797
|
+
if (ae.length !== 2) return null;
|
|
1798
|
+
const s = ae.map((C) => k.find(($) => $.key === C)).filter((C) => !!C);
|
|
1747
1799
|
if (s.length !== 2) return null;
|
|
1748
|
-
const d = (
|
|
1749
|
-
return s.sort((
|
|
1750
|
-
}, [
|
|
1751
|
-
var
|
|
1752
|
-
if (!
|
|
1753
|
-
const s =
|
|
1800
|
+
const d = (C) => C.timestamp ? new Date(C.timestamp).getTime() : 0;
|
|
1801
|
+
return s.sort((C, $) => d(C) - d($));
|
|
1802
|
+
}, [ae, k]), [se, Qe] = A(null), De = M(() => {
|
|
1803
|
+
var C;
|
|
1804
|
+
if (!se) return null;
|
|
1805
|
+
const s = F(p, se), d = [...k].filter(($) => se === ge ? !0 : $.action !== "moved").reverse();
|
|
1754
1806
|
return {
|
|
1755
|
-
label: ((
|
|
1756
|
-
points: d.map((
|
|
1757
|
-
t:
|
|
1758
|
-
v:
|
|
1759
|
-
text:
|
|
1807
|
+
label: ((C = S.find(($) => $.field === se)) == null ? void 0 : C.label) ?? s.label,
|
|
1808
|
+
points: d.map(($) => ({
|
|
1809
|
+
t: $.timestamp,
|
|
1810
|
+
v: $.values[se],
|
|
1811
|
+
text: be($.values[se], s)
|
|
1760
1812
|
}))
|
|
1761
1813
|
};
|
|
1762
|
-
}, [
|
|
1814
|
+
}, [se, k, p, S]), { data: Dt } = le({
|
|
1763
1815
|
queryKey: ["revision-sets-roles"],
|
|
1764
|
-
queryFn: () => a.request(
|
|
1765
|
-
enabled:
|
|
1816
|
+
queryFn: () => a.request(X("/roles")).then((s) => (s.data ?? []).map((d) => ({ id: String(d.id), name: String(d.name) }))),
|
|
1817
|
+
enabled: q,
|
|
1766
1818
|
staleTime: 3e5
|
|
1767
|
-
}),
|
|
1768
|
-
const d = [["When", "Changed by", "Action", ...
|
|
1769
|
-
["When", "Field", "Value", "Moved by", "Why"].map((
|
|
1819
|
+
}), Le = (s) => s.action === "moved" && !s.userId ? `Automatic${s.trigger ? ` (after ${s.trigger.name})` : ""}` : s.who, Lt = () => {
|
|
1820
|
+
const d = [["When", "Changed by", "Action", ...S.map((I) => I.label)].map((I) => ({ v: I, style: "header" }))], C = [
|
|
1821
|
+
["When", "Field", "Value", "Moved by", "Why"].map((I) => ({ v: I, style: "header" }))
|
|
1770
1822
|
];
|
|
1771
|
-
for (const
|
|
1772
|
-
const pe =
|
|
1823
|
+
for (const I of Q) {
|
|
1824
|
+
const pe = I.timestamp ? G(I.timestamp) : "";
|
|
1773
1825
|
d.push([
|
|
1774
1826
|
{ v: pe },
|
|
1775
|
-
{ v:
|
|
1776
|
-
{ v: nt(
|
|
1777
|
-
...
|
|
1778
|
-
const he =
|
|
1827
|
+
{ v: Le(I) },
|
|
1828
|
+
{ v: nt(I.action), style: "muted" },
|
|
1829
|
+
...S.map((Y) => {
|
|
1830
|
+
const he = be(I.values[Y.field], F(p, Y.field)), Ot = I.recalculated.has(Y.field) ? "recalculated" : I.changed.has(Y.field) ? "changed" : "plain";
|
|
1779
1831
|
return { v: he, style: Ot };
|
|
1780
1832
|
})
|
|
1781
1833
|
]);
|
|
1782
|
-
for (const
|
|
1783
|
-
if (!
|
|
1784
|
-
const he = Ce(
|
|
1785
|
-
|
|
1834
|
+
for (const Y of S) {
|
|
1835
|
+
if (!I.recalculated.has(Y.field)) continue;
|
|
1836
|
+
const he = Ce(Y.field, I, p);
|
|
1837
|
+
C.push([
|
|
1786
1838
|
{ v: pe },
|
|
1787
|
-
{ v:
|
|
1788
|
-
{ v:
|
|
1839
|
+
{ v: Y.label },
|
|
1840
|
+
{ v: be(I.values[Y.field], F(p, Y.field)) },
|
|
1789
1841
|
{ v: he.because ?? "" },
|
|
1790
1842
|
{ v: he.why }
|
|
1791
1843
|
]);
|
|
1792
1844
|
}
|
|
1793
1845
|
}
|
|
1794
|
-
const
|
|
1846
|
+
const $ = xa([
|
|
1795
1847
|
{
|
|
1796
1848
|
name: "History",
|
|
1797
1849
|
rows: d,
|
|
@@ -1799,67 +1851,67 @@ function yr({
|
|
|
1799
1851
|
20,
|
|
1800
1852
|
26,
|
|
1801
1853
|
10,
|
|
1802
|
-
...
|
|
1854
|
+
...S.map((I) => Math.min(40, Math.max(14, I.label.length + 4)))
|
|
1803
1855
|
],
|
|
1804
1856
|
freezeColumns: 3
|
|
1805
1857
|
},
|
|
1806
|
-
{ name: "Recalculations", rows:
|
|
1807
|
-
]),
|
|
1808
|
-
H.href =
|
|
1858
|
+
{ name: "Recalculations", rows: C, widths: [20, 24, 18, 40, 50] }
|
|
1859
|
+
]), B = URL.createObjectURL($), H = document.createElement("a");
|
|
1860
|
+
H.href = B, H.download = `history-${e}-${n}.xlsx`, document.body.appendChild(H), H.click(), H.remove(), setTimeout(() => URL.revokeObjectURL(B), 1e3);
|
|
1809
1861
|
}, At = () => {
|
|
1810
1862
|
const s = Va(
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
(
|
|
1814
|
-
(
|
|
1815
|
-
), d = new Blob([s], { type: "text/csv;charset=utf-8" }),
|
|
1816
|
-
|
|
1863
|
+
Q,
|
|
1864
|
+
S,
|
|
1865
|
+
(B, H) => be(H, F(p, B)),
|
|
1866
|
+
(B, H) => Ce(B, H, p)
|
|
1867
|
+
), d = new Blob([s], { type: "text/csv;charset=utf-8" }), C = URL.createObjectURL(d), $ = document.createElement("a");
|
|
1868
|
+
$.href = C, $.download = `history-${e}-${n}.csv`, document.body.appendChild($), $.click(), $.remove(), setTimeout(() => URL.revokeObjectURL(C), 1e3);
|
|
1817
1869
|
};
|
|
1818
|
-
return
|
|
1870
|
+
return u ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-4", children: [1, 2, 3, 4, 5].map((s) => /* @__PURE__ */ t(vt, { className: "h-9 rounded-md" }, s)) }) : /* @__PURE__ */ r("div", { className: "pt-4", "data-revision-table-view": !0, children: [
|
|
1819
1871
|
/* @__PURE__ */ r("div", { className: "mb-3 flex items-center gap-2 overflow-x-auto pb-0.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", children: [
|
|
1820
1872
|
/* @__PURE__ */ t(
|
|
1821
1873
|
gr,
|
|
1822
1874
|
{
|
|
1823
1875
|
columns: _,
|
|
1824
|
-
meta:
|
|
1825
|
-
order:
|
|
1826
|
-
shown:
|
|
1827
|
-
defaultOrder:
|
|
1876
|
+
meta: p,
|
|
1877
|
+
order: h,
|
|
1878
|
+
shown: T,
|
|
1879
|
+
defaultOrder: N,
|
|
1828
1880
|
saved: y.columns != null,
|
|
1829
|
-
onChange:
|
|
1881
|
+
onChange: E,
|
|
1830
1882
|
onReset: () => y.setColumns(null)
|
|
1831
1883
|
}
|
|
1832
1884
|
),
|
|
1833
1885
|
/* @__PURE__ */ t(
|
|
1834
|
-
|
|
1886
|
+
Wa,
|
|
1835
1887
|
{
|
|
1836
1888
|
personal: y.personalSets,
|
|
1837
1889
|
shared: L.sets,
|
|
1838
1890
|
roleDefaultName: ((Ge = L.roleDefault) == null ? void 0 : Ge.name) ?? null,
|
|
1839
|
-
isAdmin:
|
|
1891
|
+
isAdmin: q,
|
|
1840
1892
|
roles: Dt ?? [],
|
|
1841
|
-
onApply: (s) =>
|
|
1893
|
+
onApply: (s) => E(s),
|
|
1842
1894
|
onSavePersonal: (s) => y.setPersonalSets([
|
|
1843
1895
|
...y.personalSets.filter((d) => d.name.toLowerCase() !== s.toLowerCase()),
|
|
1844
|
-
{ name: s, fields:
|
|
1896
|
+
{ name: s, fields: h }
|
|
1845
1897
|
]),
|
|
1846
1898
|
onDeletePersonal: (s) => y.setPersonalSets(y.personalSets.filter((d) => d.name !== s)),
|
|
1847
|
-
onShare: (s, d,
|
|
1848
|
-
...L.sets.filter((
|
|
1849
|
-
{ name: s, fields:
|
|
1850
|
-
]).catch((
|
|
1851
|
-
onSetDefault: (s) => void L.save(L.sets.map((d) => ({ ...d, is_default: s != null && d.id === s }))).catch((d) =>
|
|
1852
|
-
onDeleteShared: (s) => void L.save(L.sets.filter((d) => d.id !== s)).catch((d) =>
|
|
1899
|
+
onShare: (s, d, C) => void L.save([
|
|
1900
|
+
...L.sets.filter(($) => $.name.toLowerCase() !== s.toLowerCase()).map(($) => C ? { ...$, is_default: !1 } : $),
|
|
1901
|
+
{ name: s, fields: h, default_roles: d, is_default: C }
|
|
1902
|
+
]).catch(($) => Oe($, "The column set was not shared")),
|
|
1903
|
+
onSetDefault: (s) => void L.save(L.sets.map((d) => ({ ...d, is_default: s != null && d.id === s }))).catch((d) => Oe(d, "The default column set was not changed")),
|
|
1904
|
+
onDeleteShared: (s) => void L.save(L.sets.filter((d) => d.id !== s)).catch((d) => Oe(d, "The column set was not deleted"))
|
|
1853
1905
|
}
|
|
1854
1906
|
),
|
|
1855
|
-
/* @__PURE__ */ t(
|
|
1907
|
+
/* @__PURE__ */ t(Ha, { people: W, value: xe, onChange: O }),
|
|
1856
1908
|
/* @__PURE__ */ t(
|
|
1857
1909
|
Ja,
|
|
1858
1910
|
{
|
|
1859
|
-
from:
|
|
1860
|
-
to:
|
|
1911
|
+
from: D,
|
|
1912
|
+
to: V,
|
|
1861
1913
|
onChange: (s, d) => {
|
|
1862
|
-
|
|
1914
|
+
Z(s), me(d);
|
|
1863
1915
|
}
|
|
1864
1916
|
}
|
|
1865
1917
|
),
|
|
@@ -1868,7 +1920,7 @@ function yr({
|
|
|
1868
1920
|
Ee,
|
|
1869
1921
|
{
|
|
1870
1922
|
id: x,
|
|
1871
|
-
checked:
|
|
1923
|
+
checked: J,
|
|
1872
1924
|
onCheckedChange: (s) => ue(s === !0),
|
|
1873
1925
|
className: "h-3.5 w-3.5"
|
|
1874
1926
|
}
|
|
@@ -1898,7 +1950,7 @@ function yr({
|
|
|
1898
1950
|
className: "tabular-nums",
|
|
1899
1951
|
"aria-live": "polite",
|
|
1900
1952
|
"data-tip": "Tick two saves to compare them · click a column title to see it over time",
|
|
1901
|
-
children:
|
|
1953
|
+
children: ae.length === 1 ? "Tick one more to compare" : `${Q.length} save${Q.length === 1 ? "" : "s"}`
|
|
1902
1954
|
}
|
|
1903
1955
|
)
|
|
1904
1956
|
] }),
|
|
@@ -1909,7 +1961,7 @@ function yr({
|
|
|
1909
1961
|
variant: "outline",
|
|
1910
1962
|
size: "sm",
|
|
1911
1963
|
className: "h-8 shrink-0 gap-1.5 text-[12px]",
|
|
1912
|
-
disabled:
|
|
1964
|
+
disabled: Q.length === 0 || S.length === 0,
|
|
1913
1965
|
"data-revision-download": !0,
|
|
1914
1966
|
children: [
|
|
1915
1967
|
/* @__PURE__ */ t(Xe, { className: "h-3.5 w-3.5" }),
|
|
@@ -1936,7 +1988,7 @@ function yr({
|
|
|
1936
1988
|
] })
|
|
1937
1989
|
] })
|
|
1938
1990
|
] }),
|
|
1939
|
-
|
|
1991
|
+
re && /* @__PURE__ */ r(
|
|
1940
1992
|
"div",
|
|
1941
1993
|
{
|
|
1942
1994
|
className: "mb-3 rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
|
|
@@ -1945,17 +1997,17 @@ function yr({
|
|
|
1945
1997
|
/* @__PURE__ */ r("div", { className: "mb-2 flex items-center gap-2 text-[12.5px]", children: [
|
|
1946
1998
|
/* @__PURE__ */ t(pt, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
1947
1999
|
/* @__PURE__ */ r("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: [
|
|
1948
|
-
|
|
2000
|
+
re[0].timestamp ? G(re[0].timestamp) : "",
|
|
1949
2001
|
" ·",
|
|
1950
2002
|
" ",
|
|
1951
|
-
|
|
2003
|
+
Le(re[0])
|
|
1952
2004
|
] }),
|
|
1953
2005
|
/* @__PURE__ */ t(ze, { className: "h-3 w-3 text-slate-400" }),
|
|
1954
2006
|
/* @__PURE__ */ r("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: [
|
|
1955
|
-
|
|
2007
|
+
re[1].timestamp ? G(re[1].timestamp) : "",
|
|
1956
2008
|
" ·",
|
|
1957
2009
|
" ",
|
|
1958
|
-
|
|
2010
|
+
Le(re[1])
|
|
1959
2011
|
] }),
|
|
1960
2012
|
/* @__PURE__ */ t(
|
|
1961
2013
|
"button",
|
|
@@ -1971,20 +2023,20 @@ function yr({
|
|
|
1971
2023
|
/* @__PURE__ */ t("div", { className: "max-h-[320px] overflow-y-auto", children: /* @__PURE__ */ t(
|
|
1972
2024
|
Tt,
|
|
1973
2025
|
{
|
|
1974
|
-
before:
|
|
1975
|
-
after:
|
|
1976
|
-
meta:
|
|
2026
|
+
before: re[0].values,
|
|
2027
|
+
after: re[1].values,
|
|
2028
|
+
meta: p,
|
|
1977
2029
|
mode: "changes"
|
|
1978
2030
|
}
|
|
1979
2031
|
) })
|
|
1980
2032
|
]
|
|
1981
2033
|
}
|
|
1982
2034
|
),
|
|
1983
|
-
|
|
1984
|
-
|
|
2035
|
+
De && /* @__PURE__ */ t(Qa, { label: De.label, points: De.points, onClose: () => Qe(null) }),
|
|
2036
|
+
g.length === 0 ? /* @__PURE__ */ r("div", { className: "rounded-lg border border-dashed border-slate-200 py-12 text-center dark:border-border", children: [
|
|
1985
2037
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No saves yet" }),
|
|
1986
2038
|
/* @__PURE__ */ t("p", { className: "mx-auto mt-1 max-w-[42ch] text-[12px] text-slate-400", children: "Every save records the whole record — each one will be a row here." })
|
|
1987
|
-
] }) :
|
|
2039
|
+
] }) : S.length === 0 ? /* @__PURE__ */ r("div", { className: "rounded-lg border border-dashed border-slate-200 py-12 text-center dark:border-border", children: [
|
|
1988
2040
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No fields picked" }),
|
|
1989
2041
|
/* @__PURE__ */ t("p", { className: "mx-auto mt-1 max-w-[42ch] text-[12px] text-slate-400", children: "Choose the fields to show as columns from the Fields menu." })
|
|
1990
2042
|
] }) : /* @__PURE__ */ r("div", { className: "overflow-hidden rounded-lg border border-slate-200 dark:border-border", children: [
|
|
@@ -2005,38 +2057,38 @@ function yr({
|
|
|
2005
2057
|
/* @__PURE__ */ t(
|
|
2006
2058
|
"div",
|
|
2007
2059
|
{
|
|
2008
|
-
ref:
|
|
2060
|
+
ref: U,
|
|
2009
2061
|
className: "max-h-[calc(100vh-250px)] overflow-y-auto overflow-x-hidden",
|
|
2010
2062
|
"data-revision-table-scroll": !0,
|
|
2011
2063
|
children: /* @__PURE__ */ r("table", { className: "border-separate border-spacing-0 text-left text-[12px]", children: [
|
|
2012
2064
|
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ r("tr", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: [
|
|
2013
2065
|
/* @__PURE__ */ t("th", { className: "sticky left-0 top-0 z-[3] w-[112px] min-w-[112px] border-b border-r border-slate-200 bg-slate-50 px-3 py-2 font-medium dark:border-border dark:bg-muted", children: "When" }),
|
|
2014
2066
|
/* @__PURE__ */ t("th", { className: "sticky left-[112px] top-0 z-[3] w-[176px] min-w-[176px] border-b border-r border-slate-200 bg-slate-50 px-3 py-2 font-medium dark:border-border dark:bg-muted", children: "Changed by" }),
|
|
2015
|
-
|
|
2067
|
+
S.map((s) => /* @__PURE__ */ t(
|
|
2016
2068
|
"th",
|
|
2017
2069
|
{
|
|
2018
2070
|
draggable: !0,
|
|
2019
2071
|
onDragStart: (d) => {
|
|
2020
|
-
|
|
2072
|
+
w(s.field), d.dataTransfer.effectAllowed = "move", d.dataTransfer.setData("text/plain", s.field);
|
|
2021
2073
|
},
|
|
2022
2074
|
onDragOver: (d) => {
|
|
2023
|
-
|
|
2075
|
+
j && (d.preventDefault(), R !== s.field && K(s.field));
|
|
2024
2076
|
},
|
|
2025
|
-
onDragLeave: () =>
|
|
2077
|
+
onDragLeave: () => K((d) => d === s.field ? null : d),
|
|
2026
2078
|
onDrop: (d) => {
|
|
2027
|
-
d.preventDefault(),
|
|
2079
|
+
d.preventDefault(), j && z(j, s.field), w(null), K(null);
|
|
2028
2080
|
},
|
|
2029
2081
|
onDragEnd: () => {
|
|
2030
|
-
|
|
2082
|
+
w(null), K(null);
|
|
2031
2083
|
},
|
|
2032
2084
|
onClick: () => Qe((d) => d === s.field ? null : s.field),
|
|
2033
2085
|
"aria-sort": "none",
|
|
2034
2086
|
"data-tip": `${s.label} — click to see it over time, drag to move`,
|
|
2035
|
-
className:
|
|
2087
|
+
className: P(
|
|
2036
2088
|
"group/th sticky top-0 z-[2] min-w-[132px] max-w-[260px] cursor-grab border-b border-slate-200 bg-slate-50 px-3 py-2 font-medium active:cursor-grabbing dark:border-border dark:bg-muted",
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2089
|
+
se === s.field && "bg-[#e6faff] text-slate-800 dark:bg-[#0b2a33] dark:text-slate-100",
|
|
2090
|
+
j === s.field && "opacity-40",
|
|
2091
|
+
R === s.field && j !== s.field && "shadow-[inset_2px_0_0_0_rgb(var(--nvr-cyan-rgb,0_206_255))]"
|
|
2040
2092
|
),
|
|
2041
2093
|
children: /* @__PURE__ */ r("span", { className: "flex items-center gap-1", children: [
|
|
2042
2094
|
/* @__PURE__ */ t(ut, { className: "h-3 w-3 shrink-0 text-slate-300 opacity-0 transition-opacity group-hover/th:opacity-100 dark:text-slate-600" }),
|
|
@@ -2046,19 +2098,19 @@ function yr({
|
|
|
2046
2098
|
s.field
|
|
2047
2099
|
))
|
|
2048
2100
|
] }) }),
|
|
2049
|
-
/* @__PURE__ */ t("tbody", { children:
|
|
2101
|
+
/* @__PURE__ */ t("tbody", { children: Q.map((s) => /* @__PURE__ */ r("tr", { className: "group align-top", "data-save-action": s.action, children: [
|
|
2050
2102
|
/* @__PURE__ */ t(
|
|
2051
2103
|
"td",
|
|
2052
2104
|
{
|
|
2053
|
-
className:
|
|
2105
|
+
className: P(
|
|
2054
2106
|
"sticky left-0 z-[1] border-b border-r border-slate-100 bg-white px-2 py-2 group-hover:bg-slate-50 dark:border-border/50 dark:bg-card dark:group-hover:bg-muted"
|
|
2055
2107
|
),
|
|
2056
2108
|
children: s.timestamp && /* @__PURE__ */ r("span", { className: "flex items-start gap-1.5", children: [
|
|
2057
2109
|
/* @__PURE__ */ t(
|
|
2058
2110
|
Ee,
|
|
2059
2111
|
{
|
|
2060
|
-
checked:
|
|
2061
|
-
onCheckedChange: () =>
|
|
2112
|
+
checked: ae.includes(s.key),
|
|
2113
|
+
onCheckedChange: () => Fe(s.key),
|
|
2062
2114
|
"aria-label": "Compare this save",
|
|
2063
2115
|
className: "mt-0.5 h-3.5 w-3.5"
|
|
2064
2116
|
}
|
|
@@ -2089,9 +2141,9 @@ function yr({
|
|
|
2089
2141
|
{
|
|
2090
2142
|
className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-violet-500/10 text-violet-700 dark:text-violet-300",
|
|
2091
2143
|
"aria-hidden": !0,
|
|
2092
|
-
children: /* @__PURE__ */ t(
|
|
2144
|
+
children: /* @__PURE__ */ t(Ae, { className: "h-3 w-3" })
|
|
2093
2145
|
}
|
|
2094
|
-
) : /* @__PURE__ */ t(
|
|
2146
|
+
) : /* @__PURE__ */ t(Re, { userId: s.userId, name: s.who, size: "sm" }),
|
|
2095
2147
|
/* @__PURE__ */ r("span", { className: "min-w-0", children: [
|
|
2096
2148
|
/* @__PURE__ */ t("span", { className: "block truncate text-slate-700 dark:text-slate-200", children: s.who }),
|
|
2097
2149
|
s.action === "moved" && !s.userId && /* @__PURE__ */ t(
|
|
@@ -2105,7 +2157,7 @@ function yr({
|
|
|
2105
2157
|
s.action !== "changed" && /* @__PURE__ */ t(
|
|
2106
2158
|
"span",
|
|
2107
2159
|
{
|
|
2108
|
-
className:
|
|
2160
|
+
className: P(
|
|
2109
2161
|
"mt-0.5 inline-block rounded px-1.5 py-px text-[10.5px] font-medium",
|
|
2110
2162
|
mt[s.action]
|
|
2111
2163
|
),
|
|
@@ -2115,40 +2167,40 @@ function yr({
|
|
|
2115
2167
|
s.autoMove && /* @__PURE__ */ r(
|
|
2116
2168
|
"span",
|
|
2117
2169
|
{
|
|
2118
|
-
className:
|
|
2170
|
+
className: P(
|
|
2119
2171
|
"mt-0.5 ml-1 inline-flex items-center gap-0.5 rounded px-1.5 py-px text-[10.5px] font-medium first:ml-0",
|
|
2120
2172
|
mt.moved
|
|
2121
2173
|
),
|
|
2122
2174
|
"data-tip": `This save moved it to ${s.autoMove.to ?? "the next step"} automatically (a step’s condition was met)`,
|
|
2123
2175
|
children: [
|
|
2124
|
-
/* @__PURE__ */ t(
|
|
2176
|
+
/* @__PURE__ */ t(Ae, { className: "h-2.5 w-2.5" }),
|
|
2125
2177
|
"Moved"
|
|
2126
2178
|
]
|
|
2127
2179
|
}
|
|
2128
2180
|
)
|
|
2129
2181
|
] })
|
|
2130
2182
|
] }) }),
|
|
2131
|
-
|
|
2132
|
-
const
|
|
2183
|
+
S.map((d) => {
|
|
2184
|
+
const C = F(p, d.field), $ = s.values[d.field], B = s.changed.has(d.field), H = s.recalculated.has(d.field), I = B || H, pe = H ? Ce(d.field, s, p) : null, Y = pe ? `Recalculated: ${pe.because ? `${pe.because}. ` : ""}${pe.why}` : d.field === ge && s.autoMove ? `Moved automatically by this save: ${s.autoMove.from ?? "—"} → ${s.autoMove.to ?? "—"} (a step’s condition was met)` : void 0, he = $ == null || $ === "";
|
|
2133
2185
|
return /* @__PURE__ */ t(
|
|
2134
2186
|
"td",
|
|
2135
2187
|
{
|
|
2136
|
-
"data-cell-changed":
|
|
2137
|
-
className:
|
|
2188
|
+
"data-cell-changed": I || void 0,
|
|
2189
|
+
className: P(
|
|
2138
2190
|
"max-w-[260px] border-b border-slate-100 px-3 py-2 dark:border-border/50",
|
|
2139
|
-
|
|
2140
|
-
|
|
2191
|
+
se === d.field && "shadow-[inset_1px_0_0_0_rgba(0,206,255,0.35),inset_-1px_0_0_0_rgba(0,206,255,0.35)]",
|
|
2192
|
+
I ? "bg-amber-50 group-hover:bg-amber-100/70 dark:bg-amber-500/10 dark:group-hover:bg-amber-500/15" : "group-hover:bg-slate-50 dark:group-hover:bg-muted/40"
|
|
2141
2193
|
),
|
|
2142
2194
|
children: /* @__PURE__ */ r(
|
|
2143
2195
|
"span",
|
|
2144
2196
|
{
|
|
2145
|
-
className:
|
|
2197
|
+
className: P(
|
|
2146
2198
|
"flex items-start gap-1",
|
|
2147
|
-
|
|
2199
|
+
I ? "font-medium text-slate-900 dark:text-slate-50" : "text-slate-500 dark:text-slate-400"
|
|
2148
2200
|
),
|
|
2149
2201
|
children: [
|
|
2150
2202
|
d.field === ge && s.autoMove && /* @__PURE__ */ t(
|
|
2151
|
-
|
|
2203
|
+
Ae,
|
|
2152
2204
|
{
|
|
2153
2205
|
className: "mt-[3px] h-3 w-3 shrink-0 text-violet-600 dark:text-violet-300",
|
|
2154
2206
|
"aria-label": "Moved automatically by this save"
|
|
@@ -2165,8 +2217,8 @@ function yr({
|
|
|
2165
2217
|
"span",
|
|
2166
2218
|
{
|
|
2167
2219
|
className: "line-clamp-3 whitespace-pre-line break-words",
|
|
2168
|
-
"data-tip":
|
|
2169
|
-
children: he ? /* @__PURE__ */ t("span", { className: "font-normal italic text-slate-300 dark:text-slate-600", children:
|
|
2220
|
+
"data-tip": Y ?? (he ? void 0 : be($, C)),
|
|
2221
|
+
children: he ? /* @__PURE__ */ t("span", { className: "font-normal italic text-slate-300 dark:text-slate-600", children: I ? "cleared" : "—" }) : C.relatedCollection && (typeof $ == "string" || typeof $ == "number") ? /* @__PURE__ */ t(Ct, { collection: C.relatedCollection, id: $ }) : be($, C)
|
|
2170
2222
|
}
|
|
2171
2223
|
)
|
|
2172
2224
|
]
|
|
@@ -2180,9 +2232,9 @@ function yr({
|
|
|
2180
2232
|
] })
|
|
2181
2233
|
}
|
|
2182
2234
|
),
|
|
2183
|
-
/* @__PURE__ */ t(fa, { scrollerRef:
|
|
2235
|
+
/* @__PURE__ */ t(fa, { scrollerRef: U })
|
|
2184
2236
|
] }),
|
|
2185
|
-
|
|
2237
|
+
g.length > 0 && /* @__PURE__ */ t("p", { className: "mt-2 text-[11.5px] text-slate-500 dark:text-slate-400", children: T.has(ge) ? "Line edits that changed no field on this record are in Timeline." : "Add Pipeline step from Fields to see each move as a row. Line edits that changed no field on this record are in Timeline." })
|
|
2186
2238
|
] });
|
|
2187
2239
|
}
|
|
2188
2240
|
function vr({
|
|
@@ -2190,54 +2242,54 @@ function vr({
|
|
|
2190
2242
|
history: n,
|
|
2191
2243
|
meta: i,
|
|
2192
2244
|
labels: a,
|
|
2193
|
-
startKey:
|
|
2245
|
+
startKey: m
|
|
2194
2246
|
}) {
|
|
2195
|
-
var
|
|
2196
|
-
const o =
|
|
2247
|
+
var U, J, ue;
|
|
2248
|
+
const o = M(() => [...e].reverse(), [e]), u = M(
|
|
2197
2249
|
() => kt(n, {
|
|
2198
|
-
name: (x) =>
|
|
2250
|
+
name: (x) => te(x, a)
|
|
2199
2251
|
}),
|
|
2200
2252
|
[n, a]
|
|
2201
|
-
), [l,
|
|
2202
|
-
const x =
|
|
2253
|
+
), [l, b] = A(() => {
|
|
2254
|
+
const x = m ? o.findIndex((D) => `${D.id}|${D.timestamp ?? ""}` === m) : -1;
|
|
2203
2255
|
return x >= 0 ? x : Math.max(0, o.length - 1);
|
|
2204
|
-
}), [c,
|
|
2205
|
-
|
|
2206
|
-
l > _ &&
|
|
2207
|
-
}, [l, _]),
|
|
2256
|
+
}), [c, v] = A(!1), [g, f] = A(!1), [p, k] = A(""), _ = o.length - 1;
|
|
2257
|
+
_e(() => {
|
|
2258
|
+
l > _ && b(Math.max(0, _));
|
|
2259
|
+
}, [l, _]), _e(() => {
|
|
2208
2260
|
if (!c) return;
|
|
2209
2261
|
if (l >= _) {
|
|
2210
|
-
|
|
2262
|
+
v(!1);
|
|
2211
2263
|
return;
|
|
2212
2264
|
}
|
|
2213
|
-
const x = setTimeout(() =>
|
|
2265
|
+
const x = setTimeout(() => b((D) => D + 1), 1800);
|
|
2214
2266
|
return () => clearTimeout(x);
|
|
2215
2267
|
}, [c, l, _]);
|
|
2216
|
-
const y = o[l], L = l > 0 ? o[l - 1] : null,
|
|
2268
|
+
const y = o[l], L = l > 0 ? o[l - 1] : null, q = M(() => {
|
|
2217
2269
|
if (!y) return [];
|
|
2218
2270
|
const x = $t((L == null ? void 0 : L.data) ?? {}, y.data ?? {}, i).filter(
|
|
2219
|
-
(
|
|
2271
|
+
(V) => V.status !== "unchanged" && !V.system && V.field !== "id"
|
|
2220
2272
|
);
|
|
2221
2273
|
if (!L) return [];
|
|
2222
|
-
const
|
|
2223
|
-
return x.filter((
|
|
2224
|
-
}, [y, L, i]),
|
|
2274
|
+
const D = new Set(Object.keys(y.delta ?? {})), Z = L.data ?? {};
|
|
2275
|
+
return x.filter((V) => D.has(V.field) || V.field in Z).sort((V, me) => +!D.has(V.field) - +!D.has(me.field));
|
|
2276
|
+
}, [y, L, i]), N = new Set(Object.keys((y == null ? void 0 : y.delta) ?? {})), h = q.filter((x) => N.has(x.field)).length, T = q.length - h, S = u.find((x) => x.key === `${y == null ? void 0 : y.id}|${(y == null ? void 0 : y.timestamp) ?? ""}`), E = M(
|
|
2225
2277
|
() => Object.entries((y == null ? void 0 : y.data) ?? {}).filter(
|
|
2226
|
-
([x,
|
|
2227
|
-
).sort(([x], [
|
|
2278
|
+
([x, D]) => x !== "id" && D !== null && D !== void 0 && D !== "" && !F(i, x).system
|
|
2279
|
+
).sort(([x], [D]) => F(i, x).label.localeCompare(F(i, D).label)),
|
|
2228
2280
|
[y, i]
|
|
2229
|
-
),
|
|
2230
|
-
|
|
2231
|
-
},
|
|
2232
|
-
if (
|
|
2233
|
-
const
|
|
2234
|
-
let
|
|
2235
|
-
o.forEach((
|
|
2236
|
-
|
|
2237
|
-
}),
|
|
2281
|
+
), j = (x) => {
|
|
2282
|
+
v(!1), b(Math.min(_, Math.max(0, x)));
|
|
2283
|
+
}, w = (x) => {
|
|
2284
|
+
if (k(x), !x) return;
|
|
2285
|
+
const D = (/* @__PURE__ */ new Date(`${x}T23:59:59`)).getTime();
|
|
2286
|
+
let Z = -1;
|
|
2287
|
+
o.forEach((V, me) => {
|
|
2288
|
+
V.timestamp && new Date(V.timestamp).getTime() <= D && (Z = me);
|
|
2289
|
+
}), Z >= 0 && j(Z);
|
|
2238
2290
|
};
|
|
2239
2291
|
if (!y) return null;
|
|
2240
|
-
const
|
|
2292
|
+
const R = te(y, a), K = y.action === "create" ? "created the record" : y.action === "delete" ? "deleted the record" : y.action === "restore" ? "restored the record" : h ? `changed ${h} field${h === 1 ? "" : "s"}${T ? ` · ${T} recalculated` : ""}` : T ? `saved the record · ${T} recalculated` : "saved the record", z = p !== "" && ((U = o[0]) == null ? void 0 : U.timestamp) != null && (/* @__PURE__ */ new Date(`${p}T23:59:59`)).getTime() < new Date(o[0].timestamp).getTime();
|
|
2241
2293
|
return /* @__PURE__ */ r(
|
|
2242
2294
|
"div",
|
|
2243
2295
|
{
|
|
@@ -2254,12 +2306,12 @@ function vr({
|
|
|
2254
2306
|
"aria-valuemin": 1,
|
|
2255
2307
|
"aria-valuemax": o.length,
|
|
2256
2308
|
"aria-valuenow": l + 1,
|
|
2257
|
-
"aria-valuetext": `${l + 1} of ${o.length}${y.timestamp ? `, ${G(y.timestamp)}` : ""}, ${
|
|
2309
|
+
"aria-valuetext": `${l + 1} of ${o.length}${y.timestamp ? `, ${G(y.timestamp)}` : ""}, ${R}`,
|
|
2258
2310
|
onKeyDown: (x) => {
|
|
2259
|
-
if (x.key === "ArrowLeft")
|
|
2260
|
-
else if (x.key === "ArrowRight")
|
|
2261
|
-
else if (x.key === "Home")
|
|
2262
|
-
else if (x.key === "End")
|
|
2311
|
+
if (x.key === "ArrowLeft") j(l - 1);
|
|
2312
|
+
else if (x.key === "ArrowRight") j(l + 1);
|
|
2313
|
+
else if (x.key === "Home") j(0);
|
|
2314
|
+
else if (x.key === "End") j(_);
|
|
2263
2315
|
else return;
|
|
2264
2316
|
x.preventDefault();
|
|
2265
2317
|
},
|
|
@@ -2280,26 +2332,26 @@ function vr({
|
|
|
2280
2332
|
"aria-hidden": !0
|
|
2281
2333
|
}
|
|
2282
2334
|
),
|
|
2283
|
-
o.map((x,
|
|
2284
|
-
const
|
|
2335
|
+
o.map((x, D) => {
|
|
2336
|
+
const Z = _ > 0 ? D / _ : 0.5, V = D === l;
|
|
2285
2337
|
return /* @__PURE__ */ t(
|
|
2286
2338
|
"button",
|
|
2287
2339
|
{
|
|
2288
2340
|
type: "button",
|
|
2289
2341
|
tabIndex: -1,
|
|
2290
|
-
onClick: () =>
|
|
2291
|
-
"aria-label": `${x.timestamp ? G(x.timestamp) : "Save"} — ${
|
|
2292
|
-
"data-tip": `${x.timestamp ? G(x.timestamp) : ""} · ${
|
|
2342
|
+
onClick: () => j(D),
|
|
2343
|
+
"aria-label": `${x.timestamp ? G(x.timestamp) : "Save"} — ${te(x, a)}`,
|
|
2344
|
+
"data-tip": `${x.timestamp ? G(x.timestamp) : ""} · ${te(x, a)}`,
|
|
2293
2345
|
className: "absolute top-1/2 -translate-x-1/2 -translate-y-1/2 p-1",
|
|
2294
|
-
style: { left: `calc(0.5rem + (100% - 1rem) * ${
|
|
2346
|
+
style: { left: `calc(0.5rem + (100% - 1rem) * ${Z})` },
|
|
2295
2347
|
children: /* @__PURE__ */ t(
|
|
2296
2348
|
"span",
|
|
2297
2349
|
{
|
|
2298
|
-
className:
|
|
2350
|
+
className: P(
|
|
2299
2351
|
"block rounded-full transition-all",
|
|
2300
|
-
|
|
2352
|
+
V ? "h-3 w-3 bg-nvr-cyan ring-4 ring-nvr-cyan/20" : P(
|
|
2301
2353
|
"h-2 w-2 hover:scale-125",
|
|
2302
|
-
|
|
2354
|
+
D < l ? "bg-nvr-cyan/70" : "bg-slate-300 dark:bg-slate-600",
|
|
2303
2355
|
x.action === "create" && "bg-emerald-500"
|
|
2304
2356
|
)
|
|
2305
2357
|
)
|
|
@@ -2315,7 +2367,7 @@ function vr({
|
|
|
2315
2367
|
/* @__PURE__ */ r("div", { className: "mt-1 flex justify-between text-[10.5px] tabular-nums text-slate-400", children: [
|
|
2316
2368
|
/* @__PURE__ */ r("span", { children: [
|
|
2317
2369
|
"Save 1",
|
|
2318
|
-
(
|
|
2370
|
+
(J = o[0]) != null && J.timestamp ? ` · ${fe(o[0].timestamp)}` : ""
|
|
2319
2371
|
] }),
|
|
2320
2372
|
/* @__PURE__ */ r("span", { children: [
|
|
2321
2373
|
"Save ",
|
|
@@ -2331,7 +2383,7 @@ function vr({
|
|
|
2331
2383
|
variant: "outline",
|
|
2332
2384
|
size: "sm",
|
|
2333
2385
|
className: "h-7 w-7 p-0",
|
|
2334
|
-
onClick: () =>
|
|
2386
|
+
onClick: () => j(l - 1),
|
|
2335
2387
|
disabled: l === 0,
|
|
2336
2388
|
"aria-label": "Previous save",
|
|
2337
2389
|
children: /* @__PURE__ */ t(ta, { className: "h-3.5 w-3.5" })
|
|
@@ -2343,7 +2395,7 @@ function vr({
|
|
|
2343
2395
|
size: "sm",
|
|
2344
2396
|
className: "h-7 gap-1.5 bg-nvr-cyan px-3 text-[12px] text-white hover:bg-nvr-cyan/90",
|
|
2345
2397
|
onClick: () => {
|
|
2346
|
-
!c && l >= _ &&
|
|
2398
|
+
!c && l >= _ && b(0), v((x) => !x);
|
|
2347
2399
|
},
|
|
2348
2400
|
disabled: o.length < 2,
|
|
2349
2401
|
"data-replay-play": !0,
|
|
@@ -2359,10 +2411,10 @@ function vr({
|
|
|
2359
2411
|
variant: "outline",
|
|
2360
2412
|
size: "sm",
|
|
2361
2413
|
className: "h-7 w-7 p-0",
|
|
2362
|
-
onClick: () =>
|
|
2414
|
+
onClick: () => j(l + 1),
|
|
2363
2415
|
disabled: l >= _,
|
|
2364
2416
|
"aria-label": "Next save",
|
|
2365
|
-
children: /* @__PURE__ */ t(
|
|
2417
|
+
children: /* @__PURE__ */ t(Pe, { className: "h-3.5 w-3.5" })
|
|
2366
2418
|
}
|
|
2367
2419
|
),
|
|
2368
2420
|
/* @__PURE__ */ r("span", { className: "ml-1 tabular-nums text-[11.5px] text-slate-500 dark:text-slate-400", children: [
|
|
@@ -2379,8 +2431,8 @@ function vr({
|
|
|
2379
2431
|
"input",
|
|
2380
2432
|
{
|
|
2381
2433
|
type: "date",
|
|
2382
|
-
value:
|
|
2383
|
-
onChange: (x) =>
|
|
2434
|
+
value: p,
|
|
2435
|
+
onChange: (x) => w(x.target.value),
|
|
2384
2436
|
className: "h-7 rounded-md border border-slate-200 bg-white px-2 text-[12px] text-slate-700 dark:border-border dark:bg-card dark:text-slate-200",
|
|
2385
2437
|
"aria-label": "Jump to the record as it was on a date",
|
|
2386
2438
|
"data-as-of": !0
|
|
@@ -2390,30 +2442,30 @@ function vr({
|
|
|
2390
2442
|
] }),
|
|
2391
2443
|
/* @__PURE__ */ r("div", { className: "px-3 py-3", children: [
|
|
2392
2444
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
2393
|
-
/* @__PURE__ */ t(
|
|
2445
|
+
/* @__PURE__ */ t(Re, { userId: y.user_id, name: R }),
|
|
2394
2446
|
/* @__PURE__ */ r("p", { className: "min-w-0 flex-1 text-[12.5px] text-slate-700 dark:text-slate-200", children: [
|
|
2395
|
-
/* @__PURE__ */ t("span", { className: "font-medium", children:
|
|
2447
|
+
/* @__PURE__ */ t("span", { className: "font-medium", children: R }),
|
|
2396
2448
|
" ",
|
|
2397
|
-
/* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children:
|
|
2449
|
+
/* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: K })
|
|
2398
2450
|
] }),
|
|
2399
2451
|
/* @__PURE__ */ t("span", { className: "shrink-0 tabular-nums text-[11.5px] text-slate-400", children: y.timestamp ? G(y.timestamp) : "" })
|
|
2400
2452
|
] }),
|
|
2401
|
-
|
|
2402
|
-
|
|
2453
|
+
z && /* @__PURE__ */ t("p", { className: "mt-2 text-[12px] text-slate-500 dark:text-slate-400", children: "The record did not exist yet on that date — showing its first save." }),
|
|
2454
|
+
q.length > 0 && /* @__PURE__ */ t("div", { className: "mt-3 overflow-hidden rounded-md border border-amber-200/80 dark:border-amber-900/50", children: q.map((x) => /* @__PURE__ */ r(
|
|
2403
2455
|
"div",
|
|
2404
2456
|
{
|
|
2405
2457
|
className: "grid grid-cols-[minmax(120px,180px)_1fr] gap-3 border-b border-amber-100 bg-amber-50/60 px-2.5 py-1.5 last:border-0 dark:border-amber-900/30 dark:bg-amber-950/20",
|
|
2406
2458
|
"data-replay-changed": x.field,
|
|
2407
2459
|
children: [
|
|
2408
2460
|
/* @__PURE__ */ r("span", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: [
|
|
2409
|
-
|
|
2410
|
-
!
|
|
2461
|
+
F(i, x.field).label,
|
|
2462
|
+
!N.has(x.field) && y.action === "update" && /* @__PURE__ */ r(
|
|
2411
2463
|
"span",
|
|
2412
2464
|
{
|
|
2413
2465
|
className: "mt-0.5 flex w-fit cursor-help items-center gap-0.5 text-[10.5px] font-normal text-slate-500 dark:text-slate-400",
|
|
2414
|
-
"data-tip":
|
|
2415
|
-
const
|
|
2416
|
-
return `${
|
|
2466
|
+
"data-tip": S ? (() => {
|
|
2467
|
+
const D = Ce(x.field, S, i);
|
|
2468
|
+
return `${D.because ? `${D.because} — ` : ""}${D.why}`;
|
|
2417
2469
|
})() : void 0,
|
|
2418
2470
|
children: [
|
|
2419
2471
|
/* @__PURE__ */ t(Se, { className: "h-3 w-3 text-amber-700 dark:text-amber-300" }),
|
|
@@ -2429,15 +2481,15 @@ function vr({
|
|
|
2429
2481
|
/* @__PURE__ */ t(
|
|
2430
2482
|
"span",
|
|
2431
2483
|
{
|
|
2432
|
-
className:
|
|
2484
|
+
className: P(
|
|
2433
2485
|
"text-slate-400",
|
|
2434
2486
|
!dt(x.before) && "line-through decoration-slate-300 dark:decoration-slate-600"
|
|
2435
2487
|
),
|
|
2436
|
-
children: dt(x.before) ? "—" : /* @__PURE__ */ t(de, { value: x.before, meta:
|
|
2488
|
+
children: dt(x.before) ? "—" : /* @__PURE__ */ t(de, { value: x.before, meta: F(i, x.field), tone: "before" })
|
|
2437
2489
|
}
|
|
2438
2490
|
),
|
|
2439
2491
|
/* @__PURE__ */ t(ze, { className: "h-3 w-3 shrink-0 self-center text-slate-400" }),
|
|
2440
|
-
/* @__PURE__ */ t("span", { className: "font-medium text-slate-900 dark:text-slate-100", children: /* @__PURE__ */ t(de, { value: x.after, meta:
|
|
2492
|
+
/* @__PURE__ */ t("span", { className: "font-medium text-slate-900 dark:text-slate-100", children: /* @__PURE__ */ t(de, { value: x.after, meta: F(i, x.field), tone: "after" }) })
|
|
2441
2493
|
] }) })
|
|
2442
2494
|
]
|
|
2443
2495
|
},
|
|
@@ -2447,27 +2499,27 @@ function vr({
|
|
|
2447
2499
|
"button",
|
|
2448
2500
|
{
|
|
2449
2501
|
type: "button",
|
|
2450
|
-
onClick: () =>
|
|
2502
|
+
onClick: () => f((x) => !x),
|
|
2451
2503
|
className: "mt-3 inline-flex items-center gap-1 text-[12px] font-medium text-slate-600 hover:text-slate-900 dark:text-slate-300 dark:hover:text-slate-100",
|
|
2452
|
-
"aria-expanded":
|
|
2504
|
+
"aria-expanded": g,
|
|
2453
2505
|
children: [
|
|
2454
|
-
|
|
2506
|
+
g ? /* @__PURE__ */ t(Ve, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(Pe, { className: "h-3.5 w-3.5" }),
|
|
2455
2507
|
"The whole record at this save",
|
|
2456
2508
|
/* @__PURE__ */ r("span", { className: "font-normal text-slate-400", children: [
|
|
2457
2509
|
"(",
|
|
2458
|
-
|
|
2510
|
+
E.length,
|
|
2459
2511
|
" fields)"
|
|
2460
2512
|
] })
|
|
2461
2513
|
]
|
|
2462
2514
|
}
|
|
2463
2515
|
),
|
|
2464
|
-
|
|
2516
|
+
g && /* @__PURE__ */ t("div", { className: "mt-2 max-h-80 overflow-y-auto rounded-md border border-slate-200 dark:border-border", children: E.map(([x, D]) => /* @__PURE__ */ r(
|
|
2465
2517
|
"div",
|
|
2466
2518
|
{
|
|
2467
2519
|
className: "grid grid-cols-[minmax(120px,180px)_1fr] gap-3 border-b border-slate-100 px-2.5 py-1.5 last:border-0 dark:border-border/60",
|
|
2468
2520
|
children: [
|
|
2469
|
-
/* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500 dark:text-slate-400", title: x, children:
|
|
2470
|
-
/* @__PURE__ */ t("span", { className: "break-words text-[12px] text-slate-800 dark:text-slate-200", children: /* @__PURE__ */ t(de, { value:
|
|
2521
|
+
/* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500 dark:text-slate-400", title: x, children: F(i, x).label }),
|
|
2522
|
+
/* @__PURE__ */ t("span", { className: "break-words text-[12px] text-slate-800 dark:text-slate-200", children: /* @__PURE__ */ t(de, { value: D, meta: F(i, x), tone: "after" }) })
|
|
2471
2523
|
]
|
|
2472
2524
|
},
|
|
2473
2525
|
x
|