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