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