@nivaro/react 0.3.40 → 0.3.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/LayoutForm.js +100 -98
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +645 -16
- package/dist/index.js +814 -775
- package/dist/shared/components/ActivityEntry.js +154 -0
- package/dist/shared/components/AudienceConfirmPanel.js +98 -0
- package/dist/shared/components/BackgroundRunOffer.js +43 -31
- package/dist/shared/components/BroadcastView.js +225 -204
- package/dist/shared/components/CollectionBrowserView.js +3924 -3584
- package/dist/shared/components/ConfigHistory.js +153 -0
- package/dist/shared/components/ConfigReadBack.js +65 -0
- package/dist/shared/components/DataTable.js +379 -346
- package/dist/shared/components/ForceReloadBanner.js +47 -40
- package/dist/shared/components/IdleReloadWatcher.js +69 -0
- package/dist/shared/components/ItemEditForm.js +4041 -3853
- package/dist/shared/components/MyWorkView.js +278 -213
- package/dist/shared/components/NotificationBell.js +130 -121
- package/dist/shared/components/PickerExcludedRows.js +3 -3
- package/dist/shared/components/ProfileView.js +776 -1003
- package/dist/shared/components/RecentRecordsRail.js +34 -16
- package/dist/shared/components/RecordReadView.js +500 -477
- package/dist/shared/components/Skeletons.js +199 -0
- package/dist/shared/components/SlowNotice.js +63 -0
- package/dist/shared/components/Term.js +23 -0
- package/dist/shared/components/WidgetSlot.js +350 -353
- package/dist/shared/components/access/PermissionSummary.js +106 -0
- package/dist/shared/components/bulk/BulkActionButtons.js +76 -73
- package/dist/shared/components/chat/ChatPanel.js +902 -886
- package/dist/shared/components/chat/MemberPaging.js +70 -0
- package/dist/shared/components/chat/RoomParts.js +147 -117
- package/dist/shared/components/chat/ScreenClip.js +73 -69
- package/dist/shared/components/chat/chat-core.js +449 -396
- package/dist/shared/components/chat/huddle/huddle-store.js +48 -43
- package/dist/shared/components/help-videos/api.js +2 -5
- package/dist/shared/components/help-videos/viewer/HelpVideoMatchChip.js +79 -0
- package/dist/shared/components/help-videos/viewer/matchChip.js +50 -0
- package/dist/shared/components/imports/CollectionImportPanel.js +139 -133
- package/dist/shared/components/imports/RunDetailSheet.js +222 -227
- package/dist/shared/components/integrations/console/ErrorExplanation.js +121 -0
- package/dist/shared/components/integrations/console/PartnerDetail.js +175 -174
- package/dist/shared/components/integrations/console/SubmissionRow.js +36 -34
- package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +50 -48
- package/dist/shared/components/item-edit/FieldComments.js +212 -0
- package/dist/shared/components/item-edit/FieldRow.js +340 -336
- package/dist/shared/components/item-edit/RecordGrantTools.js +28 -28
- package/dist/shared/components/item-edit/RecordHeaderActions.js +23 -22
- package/dist/shared/components/item-edit/RelationCombobox.js +231 -222
- package/dist/shared/components/item-edit/RuleHiddenNotes.js +55 -0
- package/dist/shared/components/item-edit/field-comments-context.js +6 -0
- package/dist/shared/components/item-edit/field-sources.js +33 -0
- package/dist/shared/components/item-edit/rule-hidden.js +30 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +113 -96
- package/dist/shared/components/layout-editor/editors/cascade-filters.js +170 -145
- package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +22 -18
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +177 -159
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +35 -34
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +124 -111
- package/dist/shared/components/layout-editor/inspector/kit.js +292 -277
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/settings/settings-registry.js +1 -1
- package/dist/shared/components/list/CopyListLinkButton.js +41 -0
- package/dist/shared/components/list/InlineEdit.js +363 -0
- package/dist/shared/components/notifications/NotificationCenterView.js +213 -181
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -82
- package/dist/shared/components/notifications/NotificationRulesEditor.js +515 -0
- package/dist/shared/components/notifications/TestMyRules.js +137 -0
- package/dist/shared/components/notifications/changes-lines.js +24 -0
- package/dist/shared/components/notifications/why-lines.js +64 -0
- package/dist/shared/components/panels/CommentPanel.js +316 -281
- package/dist/shared/components/panels/LegalHoldBanner.js +38 -0
- package/dist/shared/components/panels/PipelinePanel.js +201 -196
- package/dist/shared/components/panels/RevisionsPanel.js +496 -479
- package/dist/shared/components/pipeline/PipelineEditorView.js +1587 -1560
- package/dist/shared/components/pipeline/PipelineStateOwners.js +116 -103
- package/dist/shared/components/profile/PersonDidPanel.js +188 -0
- package/dist/shared/components/profile/PersonProfile.js +57 -52
- package/dist/shared/components/queue/QueueWorklist.js +1526 -1365
- package/dist/shared/hooks/useSlowReason.js +39 -0
- package/dist/shared/lib/activity-sentence.js +670 -0
- package/dist/shared/lib/config-sentences.js +418 -0
- package/dist/shared/lib/core-glossary.js +229 -0
- package/dist/shared/lib/error-hints.js +159 -0
- package/dist/shared/lib/error-message.js +105 -0
- package/dist/shared/lib/error-toast.js +22 -0
- package/dist/shared/lib/field-comments.js +25 -0
- package/dist/shared/lib/filter-sentence.js +261 -0
- package/dist/shared/lib/glossary.js +55 -48
- package/dist/shared/lib/idle-reload.js +138 -0
- package/dist/shared/lib/layout-resolve.js +42 -29
- package/dist/shared/lib/list-inline-edit.js +190 -0
- package/dist/shared/lib/list-link.js +147 -0
- package/dist/shared/lib/prefetch.js +259 -106
- package/dist/shared/lib/record-ref.js +72 -0
- package/dist/shared/lib/reload-holds.js +25 -0
- package/dist/shared/lib/safe-error.js +52 -24
- package/dist/shared/lib/skeleton-shapes.js +72 -0
- package/dist/shared/lib/slow-reason.js +63 -0
- package/package.json +1 -1
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import { jsxs as l, jsx as t, Fragment as
|
|
2
|
-
import { useQuery as B, useQueryClient as
|
|
3
|
-
import { Clock as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { toast as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
1
|
+
import { jsxs as l, jsx as t, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as B, useQueryClient as ee, useMutation as Q } from "@tanstack/react-query";
|
|
3
|
+
import { Clock as Y, Search as Se, X as Ce, CalendarClock as _e, GitCompareArrows as Te, ChevronDown as Re, ChevronRight as je, MessageSquare as Ae, RotateCcw as de, ArrowRight as Le } from "lucide-react";
|
|
4
|
+
import { useState as v, useRef as $e, useMemo as L, createContext as Oe, useEffect as qe, useContext as ce } from "react";
|
|
5
|
+
import { toast as A } from "sonner";
|
|
6
|
+
import { useNivaroClient as F } from "../../context.js";
|
|
7
|
+
import { activityPredicate as De, activityWhy as Fe, actorName as Ee } from "../../lib/activity-sentence.js";
|
|
8
|
+
import { get as D, post as K } from "../../lib/commands.js";
|
|
9
|
+
import { useLiveRecordQueries as Pe } from "../../lib/live.js";
|
|
10
|
+
import { restoreSkippedNote as se } from "../../lib/restore-skipped.js";
|
|
11
|
+
import { cn as T, titleCase as me, toLocalDateString as Be } from "../../lib/utils.js";
|
|
12
|
+
import { useActivityLabels as Ie } from "../ActivityEntry.js";
|
|
13
|
+
import { AgentBadge as Ke } from "../AgentBadge.js";
|
|
14
|
+
import { RelatedItemLabel as Me } from "../item-edit/RelationCombobox.js";
|
|
15
|
+
import { UserAvatar as pe } from "../UserAvatar.js";
|
|
14
16
|
import { Button as M } from "../ui/button.js";
|
|
15
|
-
import { Sheet as
|
|
16
|
-
import { Skeleton as
|
|
17
|
-
import { IntegrationActivitySection as
|
|
18
|
-
const
|
|
19
|
-
var
|
|
20
|
-
return e.id != null ? `r${e.id}` : `e${((
|
|
21
|
-
},
|
|
17
|
+
import { Sheet as Ue, SheetTrigger as We, SheetContent as Ve, SheetHeader as ze, SheetTitle as He } from "../ui/sheet.js";
|
|
18
|
+
import { Skeleton as Je } from "../ui/skeleton.js";
|
|
19
|
+
import { IntegrationActivitySection as Qe } from "./IntegrationActivitySection.js";
|
|
20
|
+
const G = (e) => e.id != null && (e.action === "create" || e.action === "update" || e.action === "delete" || e.action === "restore"), Ye = (e) => !G(e), O = (e) => {
|
|
21
|
+
var s;
|
|
22
|
+
return e.id != null ? `r${e.id}` : `e${((s = e.event) == null ? void 0 : s.history_id) ?? ""}-${e.activity ?? ""}-${e.timestamp ?? ""}`;
|
|
23
|
+
}, Ge = /* @__PURE__ */ new Set([
|
|
22
24
|
"id",
|
|
23
25
|
"created",
|
|
24
26
|
"changed",
|
|
@@ -30,120 +32,120 @@ const Y = (e) => e.id != null && (e.action === "create" || e.action === "update"
|
|
|
30
32
|
"updated_at",
|
|
31
33
|
"sort"
|
|
32
34
|
]);
|
|
33
|
-
function
|
|
34
|
-
const
|
|
35
|
+
function ue(e, s) {
|
|
36
|
+
const i = F(), { data: a } = B({
|
|
35
37
|
queryKey: ["revisions-field-meta", e],
|
|
36
|
-
enabled:
|
|
38
|
+
enabled: s,
|
|
37
39
|
staleTime: 3e5,
|
|
38
40
|
queryFn: async () => {
|
|
39
|
-
const [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const [o, d] = await Promise.all([
|
|
42
|
+
i.request(D(`/field-config/${e}`)).then((n) => n.data ?? []).catch(() => []),
|
|
43
|
+
i.request(
|
|
44
|
+
D(`/collections/${e}`)
|
|
43
45
|
).then((n) => {
|
|
44
|
-
var
|
|
45
|
-
return ((
|
|
46
|
+
var r;
|
|
47
|
+
return ((r = n.data) == null ? void 0 : r.relations) ?? [];
|
|
46
48
|
}).catch(() => [])
|
|
47
49
|
]);
|
|
48
|
-
return { fields:
|
|
50
|
+
return { fields: o, relations: d };
|
|
49
51
|
}
|
|
50
52
|
});
|
|
51
|
-
return
|
|
52
|
-
const
|
|
53
|
-
const
|
|
53
|
+
return L(() => {
|
|
54
|
+
const o = /* @__PURE__ */ new Map(), d = (n) => {
|
|
55
|
+
const r = ((a == null ? void 0 : a.relations) ?? []).find(
|
|
54
56
|
(m) => m.many_collection === e && m.many_field === n && m.junction_field == null
|
|
55
57
|
);
|
|
56
|
-
return
|
|
58
|
+
return r != null && r.one_collection ? r.one_collection === "directus_users" ? "nivaro_users" : r.one_collection : null;
|
|
57
59
|
};
|
|
58
|
-
for (const n of (
|
|
59
|
-
n.field.startsWith("__") ||
|
|
60
|
-
label: n.label ||
|
|
61
|
-
system:
|
|
60
|
+
for (const n of (a == null ? void 0 : a.fields) ?? [])
|
|
61
|
+
n.field.startsWith("__") || o.set(n.field, {
|
|
62
|
+
label: n.label || me(n.field.replace(/_/g, " ")),
|
|
63
|
+
system: Ge.has(n.field),
|
|
62
64
|
// layout_assigned is only stamped when the collection HAS an active
|
|
63
65
|
// layout — absent means there's no layout to be off of.
|
|
64
66
|
onLayout: n.layout_assigned !== !1,
|
|
65
|
-
relatedCollection:
|
|
67
|
+
relatedCollection: d(n.field),
|
|
66
68
|
dateOnly: String(n.type ?? "").toLowerCase() === "date"
|
|
67
69
|
});
|
|
68
|
-
return
|
|
69
|
-
}, [
|
|
70
|
+
return o;
|
|
71
|
+
}, [a, e]);
|
|
70
72
|
}
|
|
71
|
-
function
|
|
72
|
-
return e.get(
|
|
73
|
+
function y(e, s) {
|
|
74
|
+
return e.get(s) ?? {
|
|
73
75
|
// Unknown to the form = machine column. Still labeled, still reachable.
|
|
74
|
-
label:
|
|
76
|
+
label: me(s.replace(/[_-]/g, " ")),
|
|
75
77
|
system: !0,
|
|
76
78
|
onLayout: !1
|
|
77
79
|
};
|
|
78
80
|
}
|
|
79
|
-
function
|
|
80
|
-
const
|
|
81
|
+
function Xe({ map: e, field: s }) {
|
|
82
|
+
const i = y(e, s);
|
|
81
83
|
return /* @__PURE__ */ t(
|
|
82
84
|
"span",
|
|
83
85
|
{
|
|
84
86
|
className: "text-[12px] font-medium text-slate-700 dark:text-slate-200",
|
|
85
|
-
"data-tip":
|
|
86
|
-
title:
|
|
87
|
-
children:
|
|
87
|
+
"data-tip": s,
|
|
88
|
+
title: s,
|
|
89
|
+
children: i.label
|
|
88
90
|
}
|
|
89
91
|
);
|
|
90
92
|
}
|
|
91
|
-
const
|
|
92
|
-
function
|
|
93
|
+
const ne = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, Ze = /^\d{4}-\d{2}-\d{2}(?:T00:00:00(?:\.0+)?Z)?$/;
|
|
94
|
+
function et(e, s = !1) {
|
|
93
95
|
if (e == null || e === "") return "";
|
|
94
96
|
if (typeof e == "boolean") return e ? "Yes" : "No";
|
|
95
|
-
if (typeof e == "string" && (
|
|
96
|
-
return
|
|
97
|
-
if (typeof e == "string" &&
|
|
98
|
-
const
|
|
99
|
-
if (!Number.isNaN(
|
|
97
|
+
if (typeof e == "string" && (Ze.test(e) || s && ne.test(e)))
|
|
98
|
+
return Be(e);
|
|
99
|
+
if (typeof e == "string" && ne.test(e)) {
|
|
100
|
+
const i = new Date(e);
|
|
101
|
+
if (!Number.isNaN(i.getTime())) return i.toLocaleString();
|
|
100
102
|
}
|
|
101
103
|
return typeof e == "object" ? JSON.stringify(e) : String(e);
|
|
102
104
|
}
|
|
103
105
|
function U(e) {
|
|
104
106
|
return e == null ? "" : typeof e == "object" ? JSON.stringify(e) : String(e);
|
|
105
107
|
}
|
|
106
|
-
function
|
|
107
|
-
const
|
|
108
|
+
function tt({ collection: e, id: s }) {
|
|
109
|
+
const i = F(), { data: a } = B({
|
|
108
110
|
queryKey: ["col-meta", e],
|
|
109
|
-
queryFn: () =>
|
|
111
|
+
queryFn: () => i.request(D(`/collections/${e}`)).then((o) => o.data),
|
|
110
112
|
staleTime: 3e5,
|
|
111
113
|
retry: !1
|
|
112
114
|
});
|
|
113
|
-
return /* @__PURE__ */ t("span", { title: `${e} #${String(
|
|
114
|
-
|
|
115
|
+
return /* @__PURE__ */ t("span", { title: `${e} #${String(s)}`, children: /* @__PURE__ */ t(
|
|
116
|
+
Me,
|
|
115
117
|
{
|
|
116
118
|
collection: e,
|
|
117
|
-
id:
|
|
118
|
-
displayTemplate:
|
|
119
|
+
id: s,
|
|
120
|
+
displayTemplate: a == null ? void 0 : a.display_template
|
|
119
121
|
}
|
|
120
122
|
) });
|
|
121
123
|
}
|
|
122
|
-
function
|
|
123
|
-
return
|
|
124
|
+
function at(e) {
|
|
125
|
+
return Z(e).join(" ");
|
|
124
126
|
}
|
|
125
|
-
const
|
|
126
|
-
function
|
|
127
|
+
const le = 160;
|
|
128
|
+
function ie({
|
|
127
129
|
value: e,
|
|
128
|
-
tone:
|
|
129
|
-
dateOnly:
|
|
130
|
+
tone: s,
|
|
131
|
+
dateOnly: i
|
|
130
132
|
}) {
|
|
131
|
-
const [
|
|
132
|
-
if (
|
|
133
|
+
const [a, o] = v(!1), d = et(e, i);
|
|
134
|
+
if (d === "")
|
|
133
135
|
return /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" });
|
|
134
|
-
const n =
|
|
136
|
+
const n = d.length > le, r = a || !n ? d : `${d.slice(0, le)}…`;
|
|
135
137
|
return /* @__PURE__ */ l("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: [
|
|
136
|
-
typeof e == "object" ? /* @__PURE__ */ t("span", { className: "font-mono text-[11px]", children:
|
|
138
|
+
typeof e == "object" ? /* @__PURE__ */ t("span", { className: "font-mono text-[11px]", children: r }) : r,
|
|
137
139
|
n && /* @__PURE__ */ t(
|
|
138
140
|
"button",
|
|
139
141
|
{
|
|
140
142
|
type: "button",
|
|
141
|
-
onClick: () =>
|
|
142
|
-
className:
|
|
143
|
+
onClick: () => o((m) => !m),
|
|
144
|
+
className: T(
|
|
143
145
|
"ml-1 text-[10.5px] font-medium hover:underline",
|
|
144
|
-
|
|
146
|
+
s === "before" ? "text-rose-500" : "text-emerald-600"
|
|
145
147
|
),
|
|
146
|
-
children:
|
|
148
|
+
children: a ? "less" : "more"
|
|
147
149
|
}
|
|
148
150
|
)
|
|
149
151
|
] });
|
|
@@ -152,42 +154,42 @@ function I(e) {
|
|
|
152
154
|
if (e && typeof e == "object" && !Array.isArray(e)) return e;
|
|
153
155
|
if (typeof e == "string" && e.trim().startsWith("{"))
|
|
154
156
|
try {
|
|
155
|
-
const
|
|
156
|
-
return
|
|
157
|
+
const s = JSON.parse(e);
|
|
158
|
+
return s && typeof s == "object" && !Array.isArray(s) ? s : null;
|
|
157
159
|
} catch {
|
|
158
160
|
return null;
|
|
159
161
|
}
|
|
160
162
|
return null;
|
|
161
163
|
}
|
|
162
|
-
function
|
|
164
|
+
function rt({
|
|
163
165
|
before: e,
|
|
164
|
-
after:
|
|
166
|
+
after: s
|
|
165
167
|
}) {
|
|
166
|
-
const
|
|
167
|
-
const n =
|
|
168
|
-
return n ===
|
|
168
|
+
const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(s)])).sort().map((d) => {
|
|
169
|
+
const n = d in e ? JSON.stringify(e[d]) : void 0, r = d in s ? JSON.stringify(s[d]) : void 0;
|
|
170
|
+
return n === r ? null : { k: d, b: n, a: r };
|
|
169
171
|
}).filter(Boolean);
|
|
170
|
-
if (
|
|
172
|
+
if (a.length === 0)
|
|
171
173
|
return /* @__PURE__ */ t("span", { className: "text-[11px] italic text-slate-400", children: "keys reordered only" });
|
|
172
|
-
const
|
|
173
|
-
return /* @__PURE__ */ t("div", { className: "space-y-0.5", "data-json-diff": !0, children:
|
|
174
|
-
/* @__PURE__ */ t("span", { className: "font-mono text-[10.5px] text-slate-500", children:
|
|
174
|
+
const o = (d) => d == null ? void 0 : d.length > 80 ? `${d.slice(0, 80)}…` : d;
|
|
175
|
+
return /* @__PURE__ */ t("div", { className: "space-y-0.5", "data-json-diff": !0, children: a.map(({ k: d, b: n, a: r }) => /* @__PURE__ */ l("p", { className: "text-[11.5px]", children: [
|
|
176
|
+
/* @__PURE__ */ t("span", { className: "font-mono text-[10.5px] text-slate-500", children: d }),
|
|
175
177
|
":",
|
|
176
178
|
" ",
|
|
177
|
-
n !== void 0 && /* @__PURE__ */ t("span", { className: "text-rose-600 line-through dark:text-rose-400", children:
|
|
178
|
-
n !== void 0 &&
|
|
179
|
-
|
|
180
|
-
] },
|
|
179
|
+
n !== void 0 && /* @__PURE__ */ t("span", { className: "text-rose-600 line-through dark:text-rose-400", children: o(n) }),
|
|
180
|
+
n !== void 0 && r !== void 0 && " → ",
|
|
181
|
+
r !== void 0 ? /* @__PURE__ */ t("span", { className: "text-emerald-700 dark:text-emerald-400", children: o(r) }) : /* @__PURE__ */ t("span", { className: "italic text-slate-400", children: " (removed)" })
|
|
182
|
+
] }, d)) });
|
|
181
183
|
}
|
|
182
|
-
function
|
|
183
|
-
return
|
|
184
|
+
function st({ field: e, ctl: s }) {
|
|
185
|
+
return s.confirmField === e ? /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1", "data-revert-field-confirm": e, children: [
|
|
184
186
|
/* @__PURE__ */ t("span", { className: "text-[10.5px] text-slate-500", children: "Revert?" }),
|
|
185
187
|
/* @__PURE__ */ t(
|
|
186
188
|
"button",
|
|
187
189
|
{
|
|
188
190
|
type: "button",
|
|
189
|
-
disabled:
|
|
190
|
-
onClick: () =>
|
|
191
|
+
disabled: s.pending,
|
|
192
|
+
onClick: () => s.revert(e),
|
|
191
193
|
className: "rounded bg-nvr-cyan px-1.5 py-px text-[10.5px] font-semibold text-white disabled:opacity-50",
|
|
192
194
|
children: "Yes"
|
|
193
195
|
}
|
|
@@ -196,7 +198,7 @@ function Qe({ field: e, ctl: r }) {
|
|
|
196
198
|
"button",
|
|
197
199
|
{
|
|
198
200
|
type: "button",
|
|
199
|
-
onClick: () =>
|
|
201
|
+
onClick: () => s.setConfirmField(null),
|
|
200
202
|
className: "rounded border border-slate-200 px-1.5 py-px text-[10.5px] text-slate-500 dark:border-border",
|
|
201
203
|
children: "Cancel"
|
|
202
204
|
}
|
|
@@ -205,7 +207,7 @@ function Qe({ field: e, ctl: r }) {
|
|
|
205
207
|
"button",
|
|
206
208
|
{
|
|
207
209
|
type: "button",
|
|
208
|
-
onClick: () =>
|
|
210
|
+
onClick: () => s.setConfirmField(e),
|
|
209
211
|
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",
|
|
210
212
|
title: "Set the field back to this revision’s value",
|
|
211
213
|
"data-revert-field": e,
|
|
@@ -216,49 +218,49 @@ function Qe({ field: e, ctl: r }) {
|
|
|
216
218
|
}
|
|
217
219
|
);
|
|
218
220
|
}
|
|
219
|
-
function
|
|
221
|
+
function X(e) {
|
|
220
222
|
return typeof e == "string" && /<[a-z][^>]*>/i.test(e);
|
|
221
223
|
}
|
|
222
|
-
function
|
|
224
|
+
function Z(e) {
|
|
223
225
|
return String(e ?? "").replace(/<[^>]*>/g, " ").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").split(/\s+/).filter(Boolean);
|
|
224
226
|
}
|
|
225
|
-
function
|
|
226
|
-
const
|
|
227
|
-
for (let
|
|
227
|
+
function nt(e, s) {
|
|
228
|
+
const a = Z(e).slice(0, 600), o = Z(s).slice(0, 600), d = a.length, n = o.length, r = Array.from({ length: d + 1 }, () => new Array(n + 1).fill(0));
|
|
229
|
+
for (let g = d - 1; g >= 0; g--)
|
|
228
230
|
for (let c = n - 1; c >= 0; c--)
|
|
229
|
-
|
|
230
|
-
const m = [],
|
|
231
|
-
const
|
|
232
|
-
|
|
231
|
+
r[g][c] = a[g] === o[c] ? r[g + 1][c + 1] + 1 : Math.max(r[g + 1][c], r[g][c + 1]);
|
|
232
|
+
const m = [], h = (g, c) => {
|
|
233
|
+
const x = m[m.length - 1];
|
|
234
|
+
x && x.type === g ? x.text += ` ${c}` : m.push({ text: c, type: g });
|
|
233
235
|
};
|
|
234
|
-
let p = 0,
|
|
235
|
-
for (; p <
|
|
236
|
-
|
|
237
|
-
for (; p <
|
|
238
|
-
for (;
|
|
236
|
+
let p = 0, u = 0;
|
|
237
|
+
for (; p < d && u < n; )
|
|
238
|
+
a[p] === o[u] ? (h("same", a[p]), p++, u++) : r[p + 1][u] >= r[p][u + 1] ? (h("del", a[p]), p++) : (h("ins", o[u]), u++);
|
|
239
|
+
for (; p < d; ) h("del", a[p++]);
|
|
240
|
+
for (; u < n; ) h("ins", o[u++]);
|
|
239
241
|
return m;
|
|
240
242
|
}
|
|
241
|
-
function
|
|
242
|
-
const
|
|
243
|
-
return /* @__PURE__ */ t("p", { className: "whitespace-pre-wrap break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children:
|
|
244
|
-
(
|
|
243
|
+
function lt({ before: e, after: s }) {
|
|
244
|
+
const i = nt(e, s);
|
|
245
|
+
return /* @__PURE__ */ t("p", { className: "whitespace-pre-wrap break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: i.map(
|
|
246
|
+
(a, o) => a.type === "same" ? (
|
|
245
247
|
// biome-ignore lint/suspicious/noArrayIndexKey: static segment list
|
|
246
248
|
/* @__PURE__ */ l("span", { children: [
|
|
247
|
-
|
|
249
|
+
a.text,
|
|
248
250
|
" "
|
|
249
|
-
] },
|
|
250
|
-
) :
|
|
251
|
+
] }, o)
|
|
252
|
+
) : a.type === "del" ? (
|
|
251
253
|
// biome-ignore lint/suspicious/noArrayIndexKey: static segment list
|
|
252
254
|
/* @__PURE__ */ l(
|
|
253
255
|
"del",
|
|
254
256
|
{
|
|
255
257
|
className: "rounded bg-red-100 px-0.5 text-red-700 no-underline line-through dark:bg-red-900/40 dark:text-red-400",
|
|
256
258
|
children: [
|
|
257
|
-
|
|
259
|
+
a.text,
|
|
258
260
|
" "
|
|
259
261
|
]
|
|
260
262
|
},
|
|
261
|
-
|
|
263
|
+
o
|
|
262
264
|
)
|
|
263
265
|
) : (
|
|
264
266
|
// biome-ignore lint/suspicious/noArrayIndexKey: static segment list
|
|
@@ -267,171 +269,171 @@ function Ge({ before: e, after: r }) {
|
|
|
267
269
|
{
|
|
268
270
|
className: "rounded bg-emerald-100 px-0.5 text-emerald-700 no-underline dark:bg-emerald-900/40 dark:text-emerald-400",
|
|
269
271
|
children: [
|
|
270
|
-
|
|
272
|
+
a.text,
|
|
271
273
|
" "
|
|
272
274
|
]
|
|
273
275
|
},
|
|
274
|
-
|
|
276
|
+
o
|
|
275
277
|
)
|
|
276
278
|
)
|
|
277
279
|
) });
|
|
278
280
|
}
|
|
279
|
-
const
|
|
281
|
+
const it = {
|
|
280
282
|
added: "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-400",
|
|
281
283
|
removed: "bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-400",
|
|
282
284
|
changed: "bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-400"
|
|
283
285
|
};
|
|
284
|
-
function
|
|
285
|
-
const
|
|
286
|
-
const m = !(
|
|
287
|
-
if (m &&
|
|
288
|
-
const p = m ? "added" :
|
|
286
|
+
function ot(e, s, i) {
|
|
287
|
+
const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(s)])), o = (r) => r == null || r === "", d = a.map((r) => {
|
|
288
|
+
const m = !(r in e) || o(e[r]), h = !(r in s) || o(s[r]);
|
|
289
|
+
if (m && h) return null;
|
|
290
|
+
const p = m ? "added" : h ? "removed" : U(e[r]) !== U(s[r]) ? "changed" : "unchanged";
|
|
289
291
|
return {
|
|
290
|
-
field:
|
|
292
|
+
field: r,
|
|
291
293
|
status: p,
|
|
292
|
-
before: e[
|
|
293
|
-
after: r
|
|
294
|
-
system:
|
|
294
|
+
before: e[r],
|
|
295
|
+
after: s[r],
|
|
296
|
+
system: y(i, r).system
|
|
295
297
|
};
|
|
296
|
-
}).filter(Boolean), n = (
|
|
297
|
-
const m =
|
|
298
|
-
return (m.system ? 8 : m.onLayout ? 0 : 4) + (
|
|
298
|
+
}).filter(Boolean), n = (r) => {
|
|
299
|
+
const m = y(i, r.field);
|
|
300
|
+
return (m.system ? 8 : m.onLayout ? 0 : 4) + (r.status === "unchanged" ? 2 : 0);
|
|
299
301
|
};
|
|
300
|
-
return
|
|
301
|
-
(
|
|
302
|
+
return d.sort(
|
|
303
|
+
(r, m) => n(r) - n(m) || y(i, r.field).label.localeCompare(y(i, m.field).label)
|
|
302
304
|
);
|
|
303
305
|
}
|
|
304
|
-
function
|
|
306
|
+
function q({
|
|
305
307
|
value: e,
|
|
306
|
-
meta:
|
|
307
|
-
tone:
|
|
308
|
+
meta: s,
|
|
309
|
+
tone: i
|
|
308
310
|
}) {
|
|
309
|
-
return e == null || e === "" ? /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" }) :
|
|
311
|
+
return e == null || e === "" ? /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" }) : s.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(tt, { collection: s.relatedCollection, id: e }) }) : X(e) ? /* @__PURE__ */ t(ie, { value: at(e), tone: i }) : /* @__PURE__ */ t(ie, { value: e, tone: i, dateOnly: s.dateOnly });
|
|
310
312
|
}
|
|
311
|
-
function
|
|
313
|
+
function dt({
|
|
312
314
|
row: e,
|
|
313
|
-
meta:
|
|
314
|
-
fieldRevert:
|
|
315
|
-
mode:
|
|
316
|
-
hideStatusChips:
|
|
315
|
+
meta: s,
|
|
316
|
+
fieldRevert: i,
|
|
317
|
+
mode: a,
|
|
318
|
+
hideStatusChips: o
|
|
317
319
|
}) {
|
|
318
|
-
const
|
|
320
|
+
const d = e.status === "changed" && (X(e.before) || X(e.after)), n = e.status === "changed" && I(e.before) && I(e.after);
|
|
319
321
|
return /* @__PURE__ */ l(
|
|
320
322
|
"div",
|
|
321
323
|
{
|
|
322
|
-
className:
|
|
324
|
+
className: T(
|
|
323
325
|
"group/frow border-b border-slate-100 px-3 py-2 last:border-0 dark:border-border/60",
|
|
324
326
|
e.system && "bg-slate-50/60 dark:bg-muted/20"
|
|
325
327
|
),
|
|
326
328
|
"data-field-row": e.field,
|
|
327
329
|
children: [
|
|
328
330
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
329
|
-
/* @__PURE__ */ t(
|
|
330
|
-
e.status !== "unchanged" && !
|
|
331
|
+
/* @__PURE__ */ t(Xe, { map: s, field: e.field }),
|
|
332
|
+
e.status !== "unchanged" && !o && /* @__PURE__ */ t(
|
|
331
333
|
"span",
|
|
332
334
|
{
|
|
333
|
-
className:
|
|
335
|
+
className: T(
|
|
334
336
|
"rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide",
|
|
335
|
-
|
|
337
|
+
it[e.status]
|
|
336
338
|
),
|
|
337
339
|
children: e.status === "added" ? "set" : e.status
|
|
338
340
|
}
|
|
339
341
|
),
|
|
340
|
-
(e.status === "changed" ||
|
|
342
|
+
(e.status === "changed" || a === "changes" && e.status === "added") && i && e.field !== "id" && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ t(st, { field: e.field, ctl: i }) })
|
|
341
343
|
] }),
|
|
342
|
-
/* @__PURE__ */ t("div", { className: "mt-1", children:
|
|
343
|
-
|
|
344
|
+
/* @__PURE__ */ t("div", { className: "mt-1", children: d ? /* @__PURE__ */ t("div", { "data-richtext-diff": !0, children: /* @__PURE__ */ t(lt, { before: e.before, after: e.after }) }) : n ? /* @__PURE__ */ t(
|
|
345
|
+
rt,
|
|
344
346
|
{
|
|
345
347
|
before: I(e.before),
|
|
346
348
|
after: I(e.after)
|
|
347
349
|
}
|
|
348
350
|
) : e.status === "changed" || e.status === "removed" ? /* @__PURE__ */ l("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-0.5", children: [
|
|
349
|
-
/* @__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(
|
|
350
|
-
/* @__PURE__ */ t(
|
|
351
|
-
/* @__PURE__ */ t(
|
|
352
|
-
] }) : /* @__PURE__ */ t(
|
|
351
|
+
/* @__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(q, { value: e.before, meta: y(s, e.field), tone: "before" }) }),
|
|
352
|
+
/* @__PURE__ */ t(Le, { className: "h-3 w-3 shrink-0 self-center text-slate-300 dark:text-slate-600" }),
|
|
353
|
+
/* @__PURE__ */ t(q, { value: e.after, meta: y(s, e.field), tone: "after" })
|
|
354
|
+
] }) : /* @__PURE__ */ t(q, { value: e.after ?? e.before, meta: y(s, e.field), tone: "after" }) })
|
|
353
355
|
]
|
|
354
356
|
}
|
|
355
357
|
);
|
|
356
358
|
}
|
|
357
|
-
function
|
|
359
|
+
function ct({
|
|
358
360
|
before: e,
|
|
359
|
-
after:
|
|
360
|
-
meta:
|
|
361
|
-
fieldRevert:
|
|
362
|
-
mode:
|
|
363
|
-
hideStatusChips:
|
|
361
|
+
after: s,
|
|
362
|
+
meta: i,
|
|
363
|
+
fieldRevert: a,
|
|
364
|
+
mode: o,
|
|
365
|
+
hideStatusChips: d
|
|
364
366
|
}) {
|
|
365
|
-
const [n,
|
|
366
|
-
if (
|
|
367
|
-
return /* @__PURE__ */ t("p", { className: "px-3 py-3 text-[12px] text-slate-400", children:
|
|
368
|
-
const
|
|
369
|
-
(
|
|
367
|
+
const [n, r] = v(!1), m = L(() => ot(e, s, i), [e, s, i]), h = o === "changes" ? m.filter((x) => x.status !== "unchanged") : m, p = n ? h : h.filter((x) => !x.system), u = h.length - p.length;
|
|
368
|
+
if (h.length === 0)
|
|
369
|
+
return /* @__PURE__ */ t("p", { className: "px-3 py-3 text-[12px] text-slate-400", children: o === "changes" ? "No field changes recorded." : "No snapshot data available." });
|
|
370
|
+
const g = p.findIndex(
|
|
371
|
+
(x) => !y(i, x.field).onLayout && !y(i, x.field).system
|
|
370
372
|
), c = p.some(
|
|
371
|
-
(
|
|
373
|
+
(x) => y(i, x.field).onLayout && !y(i, x.field).system
|
|
372
374
|
);
|
|
373
375
|
return /* @__PURE__ */ l("div", { className: "overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
374
|
-
p.map((
|
|
375
|
-
|
|
376
|
+
p.map((x, R) => /* @__PURE__ */ l("div", { children: [
|
|
377
|
+
R === g && c && /* @__PURE__ */ l("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: [
|
|
376
378
|
/* @__PURE__ */ t("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Behind the scenes" }),
|
|
377
379
|
/* @__PURE__ */ t("p", { className: "text-[10.5px] text-slate-400", children: "Not on the form — written automatically by rules, computed fields or integrations." })
|
|
378
380
|
] }),
|
|
379
381
|
/* @__PURE__ */ t(
|
|
380
|
-
|
|
382
|
+
dt,
|
|
381
383
|
{
|
|
382
|
-
row:
|
|
383
|
-
meta:
|
|
384
|
-
fieldRevert:
|
|
385
|
-
mode:
|
|
386
|
-
hideStatusChips:
|
|
384
|
+
row: x,
|
|
385
|
+
meta: i,
|
|
386
|
+
fieldRevert: a,
|
|
387
|
+
mode: o,
|
|
388
|
+
hideStatusChips: d
|
|
387
389
|
}
|
|
388
390
|
)
|
|
389
|
-
] },
|
|
390
|
-
|
|
391
|
+
] }, x.field)),
|
|
392
|
+
u > 0 && /* @__PURE__ */ l(
|
|
391
393
|
"button",
|
|
392
394
|
{
|
|
393
395
|
type: "button",
|
|
394
|
-
onClick: () =>
|
|
396
|
+
onClick: () => r(!0),
|
|
395
397
|
className: "w-full border-t border-slate-100 px-3 py-2 text-left text-[11.5px] text-slate-400 hover:text-slate-600 dark:border-border/60 dark:hover:text-slate-300",
|
|
396
398
|
"data-show-system": !0,
|
|
397
399
|
children: [
|
|
398
400
|
"Show ",
|
|
399
|
-
|
|
401
|
+
u,
|
|
400
402
|
" system field",
|
|
401
|
-
|
|
403
|
+
u === 1 ? "" : "s",
|
|
402
404
|
" (ids, timestamps, machine columns)"
|
|
403
405
|
]
|
|
404
406
|
}
|
|
405
407
|
),
|
|
406
|
-
|
|
408
|
+
u === 0 && n && h.some((x) => x.system) && /* @__PURE__ */ t(
|
|
407
409
|
"button",
|
|
408
410
|
{
|
|
409
411
|
type: "button",
|
|
410
|
-
onClick: () =>
|
|
412
|
+
onClick: () => r(!1),
|
|
411
413
|
className: "w-full border-t border-slate-100 px-3 py-2 text-left text-[11.5px] text-slate-400 hover:text-slate-600 dark:border-border/60",
|
|
412
414
|
children: "Hide system fields"
|
|
413
415
|
}
|
|
414
416
|
)
|
|
415
417
|
] });
|
|
416
418
|
}
|
|
417
|
-
const
|
|
419
|
+
const mt = {
|
|
418
420
|
create: "bg-emerald-500",
|
|
419
421
|
restore: "bg-emerald-500",
|
|
420
422
|
update: "bg-nvr-cyan",
|
|
421
423
|
delete: "bg-red-500"
|
|
422
|
-
};
|
|
423
|
-
function
|
|
424
|
-
var
|
|
425
|
-
return e.first_name || e.last_name ? [e.first_name, e.last_name].filter(Boolean).join(" ") : e.user_email ?? ((
|
|
424
|
+
}, te = Oe(void 0);
|
|
425
|
+
function P(e, s) {
|
|
426
|
+
var i;
|
|
427
|
+
return e.actor && e.actor.kind !== "person" ? Ee(e, s) : 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";
|
|
426
428
|
}
|
|
427
|
-
function
|
|
428
|
-
return e.action === "create" ? "created this record" : e.action === "restore" ? "restored this record from trash" : e.action === "delete" ? "deleted this record" :
|
|
429
|
+
function pt(e, s, i) {
|
|
430
|
+
return e.action === "create" ? "created this record" : e.action === "restore" ? "restored this record from trash" : e.action === "delete" ? "deleted this record" : s > 0 ? `changed ${s} field${s === 1 ? "" : "s"}` : i > 0 ? "updated system fields" : "saved this record";
|
|
429
431
|
}
|
|
430
|
-
function
|
|
431
|
-
var
|
|
432
|
-
const a = e.event,
|
|
433
|
-
let
|
|
434
|
-
(a == null ? void 0 : a.kind) === "transition" && a.addendum ?
|
|
432
|
+
function ut({ revision: e, isLast: s }) {
|
|
433
|
+
var h, p, u;
|
|
434
|
+
const i = ce(te), a = e.event, o = (a == null ? void 0 : a.source) === "auto" || !e.user_id && (a == null ? void 0 : a.kind) === "transition", d = !o && ((h = a == null ? void 0 : a.on_behalf_of) != null && h.name) ? a.on_behalf_of.name : null, n = o ? "Automatic rule" : d ? `${P(e, i)}, for ${d}` : P(e, i);
|
|
435
|
+
let r;
|
|
436
|
+
(a == null ? void 0 : a.kind) === "transition" && a.addendum ? r = /* @__PURE__ */ l(j, { children: [
|
|
435
437
|
"moved",
|
|
436
438
|
" ",
|
|
437
439
|
/* @__PURE__ */ l("span", { className: "font-medium text-slate-700 dark:text-slate-200", "data-revision-addendum": !0, children: [
|
|
@@ -441,7 +443,7 @@ function st({ revision: e, isLast: r }) {
|
|
|
441
443
|
] }),
|
|
442
444
|
":",
|
|
443
445
|
" ",
|
|
444
|
-
a.from_label && /* @__PURE__ */ l(
|
|
446
|
+
a.from_label && /* @__PURE__ */ l(j, { children: [
|
|
445
447
|
/* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.from_label }),
|
|
446
448
|
" ",
|
|
447
449
|
"→",
|
|
@@ -452,10 +454,10 @@ function st({ revision: e, isLast: r }) {
|
|
|
452
454
|
" · ",
|
|
453
455
|
a.transition_label
|
|
454
456
|
] })
|
|
455
|
-
] }) : (a == null ? void 0 : a.kind) === "transition" ?
|
|
457
|
+
] }) : (a == null ? void 0 : a.kind) === "transition" ? r = /* @__PURE__ */ l(j, { children: [
|
|
456
458
|
"moved it",
|
|
457
459
|
" ",
|
|
458
|
-
a.from_label && /* @__PURE__ */ l(
|
|
460
|
+
a.from_label && /* @__PURE__ */ l(j, { children: [
|
|
459
461
|
"from",
|
|
460
462
|
" ",
|
|
461
463
|
/* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.from_label }),
|
|
@@ -468,41 +470,41 @@ function st({ revision: e, isLast: r }) {
|
|
|
468
470
|
" · ",
|
|
469
471
|
a.transition_label
|
|
470
472
|
] })
|
|
471
|
-
] }) : (a == null ? void 0 : a.kind) === "start" && a.to_label ?
|
|
473
|
+
] }) : (a == null ? void 0 : a.kind) === "start" && a.to_label ? r = /* @__PURE__ */ l(j, { children: [
|
|
472
474
|
"started it in",
|
|
473
475
|
" ",
|
|
474
476
|
/* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: a.to_label })
|
|
475
|
-
] }) : (a == null ? void 0 : a.kind) === "start" ?
|
|
477
|
+
] }) : (a == null ? void 0 : a.kind) === "start" ? r = /* @__PURE__ */ l(j, { children: [
|
|
476
478
|
"started the pipeline",
|
|
477
479
|
e.comment ? ` — ${e.comment.replace(/^Started pipeline\s*[—-]?\s*/i, "")}` : ""
|
|
478
|
-
] }) : (
|
|
480
|
+
] }) : (p = e.action) != null && p.startsWith("o2m-") ? r = /* @__PURE__ */ l(j, { children: [
|
|
479
481
|
e.action === "o2m-create" ? "added" : e.action === "o2m-delete" ? "removed" : "changed",
|
|
480
482
|
" ",
|
|
481
483
|
"related rows",
|
|
482
484
|
e.comment ? ` — ${e.comment}` : ""
|
|
483
|
-
] }) :
|
|
484
|
-
e
|
|
485
|
+
] }) : r = /* @__PURE__ */ l(j, { children: [
|
|
486
|
+
De({ ...e, item: null }, i),
|
|
485
487
|
e.comment ? ` — ${e.comment}` : ""
|
|
486
488
|
] });
|
|
487
|
-
const
|
|
489
|
+
const m = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
|
|
488
490
|
return /* @__PURE__ */ l(
|
|
489
491
|
"div",
|
|
490
492
|
{
|
|
491
493
|
className: "relative pl-9",
|
|
492
494
|
"data-revision-event": (a == null ? void 0 : a.kind) ?? e.action ?? "",
|
|
493
|
-
"data-revision-on-behalf": d ? (
|
|
495
|
+
"data-revision-on-behalf": d ? (u = a == null ? void 0 : a.on_behalf_of) == null ? void 0 : u.id : void 0,
|
|
494
496
|
children: [
|
|
495
497
|
/* @__PURE__ */ t(
|
|
496
498
|
"span",
|
|
497
499
|
{
|
|
498
|
-
className:
|
|
500
|
+
className: T(
|
|
499
501
|
"absolute left-[11px] top-[18px] h-2.5 w-2.5 rounded-full ring-4 ring-white dark:ring-card",
|
|
500
502
|
(a == null ? void 0 : a.kind) === "transition" && a.addendum ? "bg-amber-500" : (a == null ? void 0 : a.kind) === "transition" ? "bg-violet-500" : (a == null ? void 0 : a.kind) === "start" ? "bg-violet-300" : "bg-slate-300"
|
|
501
503
|
),
|
|
502
504
|
"aria-hidden": !0
|
|
503
505
|
}
|
|
504
506
|
),
|
|
505
|
-
!
|
|
507
|
+
!s && /* @__PURE__ */ t(
|
|
506
508
|
"span",
|
|
507
509
|
{
|
|
508
510
|
className: "absolute bottom-0 left-[15.5px] top-[30px] w-px bg-slate-200 dark:bg-border",
|
|
@@ -510,18 +512,18 @@ function st({ revision: e, isLast: r }) {
|
|
|
510
512
|
}
|
|
511
513
|
),
|
|
512
514
|
/* @__PURE__ */ l("div", { className: "flex w-full items-start gap-2.5 rounded-md px-2 py-2.5 text-left", children: [
|
|
513
|
-
|
|
514
|
-
|
|
515
|
+
o ? /* @__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(
|
|
516
|
+
pe,
|
|
515
517
|
{
|
|
516
518
|
userId: e.user_id,
|
|
517
519
|
className: "h-6 w-6",
|
|
518
|
-
fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children:
|
|
520
|
+
fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: n.split(" ").map((g) => g[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() })
|
|
519
521
|
}
|
|
520
522
|
),
|
|
521
523
|
/* @__PURE__ */ l("span", { className: "min-w-0 flex-1 text-[12.5px] text-slate-700 dark:text-slate-200", children: [
|
|
522
|
-
/* @__PURE__ */ t("span", { className: "font-medium", children:
|
|
524
|
+
/* @__PURE__ */ t("span", { className: "font-medium", children: n }),
|
|
523
525
|
" ",
|
|
524
|
-
/* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children:
|
|
526
|
+
/* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: r }),
|
|
525
527
|
(a == null ? void 0 : a.kind) === "transition" && e.comment && /* @__PURE__ */ l(
|
|
526
528
|
"span",
|
|
527
529
|
{
|
|
@@ -540,7 +542,7 @@ function st({ revision: e, isLast: r }) {
|
|
|
540
542
|
{
|
|
541
543
|
className: "shrink-0 text-[11px] tabular-nums text-slate-400",
|
|
542
544
|
title: e.timestamp ? new Date(e.timestamp).toLocaleString() : void 0,
|
|
543
|
-
children:
|
|
545
|
+
children: m
|
|
544
546
|
}
|
|
545
547
|
)
|
|
546
548
|
] })
|
|
@@ -548,77 +550,77 @@ function st({ revision: e, isLast: r }) {
|
|
|
548
550
|
}
|
|
549
551
|
);
|
|
550
552
|
}
|
|
551
|
-
function
|
|
553
|
+
function ht({
|
|
552
554
|
revision: e,
|
|
553
|
-
previousData:
|
|
554
|
-
meta:
|
|
555
|
-
onRollback:
|
|
556
|
-
inlineTableFields:
|
|
557
|
-
isLast:
|
|
555
|
+
previousData: s,
|
|
556
|
+
meta: i,
|
|
557
|
+
onRollback: a,
|
|
558
|
+
inlineTableFields: o,
|
|
559
|
+
isLast: d
|
|
558
560
|
}) {
|
|
559
|
-
const n =
|
|
561
|
+
const n = F(), r = ce(te), m = Fe(e).reason, [h, p] = v(!1), [u, g] = v(!1), [c, x] = v("changes"), [R, b] = v(!1), [N, S] = v(null), w = e.action === "update", C = e.action === "create" || e.action === "restore", W = e.action === "delete", k = W ? e.data ?? {} : C ? {} : s ?? {}, $ = W ? {} : e.data ?? {}, { humanDelta: V, systemDelta: he } = L(() => {
|
|
560
562
|
const f = e.delta ?? {};
|
|
561
|
-
let
|
|
562
|
-
for (const
|
|
563
|
-
const
|
|
564
|
-
w &&
|
|
563
|
+
let _ = 0, E = 0;
|
|
564
|
+
for (const J of Object.keys(f)) {
|
|
565
|
+
const ve = s == null ? void 0 : s[J], we = (e.data ?? {})[J];
|
|
566
|
+
w && s && U(ve) === U(we) || (y(i, J).system ? E++ : _++);
|
|
565
567
|
}
|
|
566
|
-
return { humanDelta:
|
|
567
|
-
}, [e,
|
|
568
|
+
return { humanDelta: _, systemDelta: E };
|
|
569
|
+
}, [e, s, i, w]), xe = w || C, [z, fe] = v(null), be = ee(), [ge, ae] = v(null), re = Q({
|
|
568
570
|
mutationFn: (f) => n.request(K(`/revisions/${e.id}/revert-field`, { field: f })),
|
|
569
|
-
onSuccess: (f,
|
|
570
|
-
|
|
571
|
+
onSuccess: (f, _) => {
|
|
572
|
+
ae(null), A.success(`Reverted ${y(i, _).label} to this revision's value`), be.invalidateQueries({ queryKey: ["revisions", e.collection, e.item] }), a == null || a();
|
|
571
573
|
},
|
|
572
|
-
onError: () =>
|
|
573
|
-
}),
|
|
574
|
-
confirmField:
|
|
575
|
-
setConfirmField:
|
|
576
|
-
revert: (f) =>
|
|
577
|
-
pending:
|
|
578
|
-
} : void 0,
|
|
574
|
+
onError: () => A.error("Failed to revert field")
|
|
575
|
+
}), ye = w || C ? {
|
|
576
|
+
confirmField: ge,
|
|
577
|
+
setConfirmField: ae,
|
|
578
|
+
revert: (f) => re.mutate(f),
|
|
579
|
+
pending: re.isPending
|
|
580
|
+
} : void 0, H = Q({
|
|
579
581
|
mutationFn: () => n.request(K(`/revisions/${e.id}/rollback`, {})),
|
|
580
582
|
onSuccess: (f) => {
|
|
581
|
-
|
|
582
|
-
const
|
|
583
|
-
|
|
583
|
+
g(!1), A.success("Rolled back to this revision");
|
|
584
|
+
const _ = se(f);
|
|
585
|
+
_ && A.warning(_, { duration: 1e4 }), o != null && o.length && e.timestamp && fe(e.timestamp), a == null || a();
|
|
584
586
|
},
|
|
585
|
-
onError: () =>
|
|
587
|
+
onError: () => A.error("Failed to rollback")
|
|
586
588
|
});
|
|
587
|
-
async function
|
|
588
|
-
if (
|
|
589
|
-
|
|
589
|
+
async function Ne(f) {
|
|
590
|
+
if (z) {
|
|
591
|
+
S(f.field);
|
|
590
592
|
try {
|
|
591
|
-
const
|
|
593
|
+
const _ = await n.request(
|
|
592
594
|
K("/revisions/o2m-restore", {
|
|
593
595
|
collection: f.relatedCollection,
|
|
594
596
|
many_field: f.manyField,
|
|
595
597
|
parent_id: f.parentId,
|
|
596
|
-
target_timestamp:
|
|
598
|
+
target_timestamp: z
|
|
597
599
|
})
|
|
598
600
|
);
|
|
599
|
-
|
|
600
|
-
const
|
|
601
|
-
|
|
601
|
+
A.success(`Restored ${f.label}`);
|
|
602
|
+
const E = se(_);
|
|
603
|
+
E && A.warning(E, { duration: 1e4 });
|
|
602
604
|
} catch {
|
|
603
|
-
|
|
605
|
+
A.error(`Failed to restore ${f.label}`);
|
|
604
606
|
} finally {
|
|
605
|
-
|
|
607
|
+
S(null);
|
|
606
608
|
}
|
|
607
609
|
}
|
|
608
610
|
}
|
|
609
|
-
const
|
|
611
|
+
const ke = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
|
|
610
612
|
return /* @__PURE__ */ l("div", { className: "relative pl-9", "data-revision-row": e.id, children: [
|
|
611
613
|
/* @__PURE__ */ t(
|
|
612
614
|
"span",
|
|
613
615
|
{
|
|
614
|
-
className:
|
|
616
|
+
className: T(
|
|
615
617
|
"absolute left-[11px] top-[18px] h-2.5 w-2.5 rounded-full ring-4 ring-white dark:ring-card",
|
|
616
|
-
|
|
618
|
+
mt[e.action ?? ""] ?? "bg-slate-300"
|
|
617
619
|
),
|
|
618
620
|
"aria-hidden": !0
|
|
619
621
|
}
|
|
620
622
|
),
|
|
621
|
-
!
|
|
623
|
+
!d && /* @__PURE__ */ t(
|
|
622
624
|
"span",
|
|
623
625
|
{
|
|
624
626
|
className: "absolute bottom-0 left-[15.5px] top-[30px] w-px bg-slate-200 dark:bg-border",
|
|
@@ -629,50 +631,62 @@ function nt({
|
|
|
629
631
|
"button",
|
|
630
632
|
{
|
|
631
633
|
type: "button",
|
|
632
|
-
onClick: () =>
|
|
634
|
+
onClick: () => p((f) => !f),
|
|
633
635
|
className: "flex w-full items-center gap-2.5 rounded-md px-2 py-2.5 text-left transition-colors hover:bg-slate-50 dark:hover:bg-muted/40",
|
|
634
636
|
children: [
|
|
635
637
|
/* @__PURE__ */ t(
|
|
636
|
-
|
|
638
|
+
pe,
|
|
637
639
|
{
|
|
638
640
|
userId: e.user_id,
|
|
639
641
|
className: "h-6 w-6",
|
|
640
|
-
fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children:
|
|
642
|
+
fallback: /* @__PURE__ */ t("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy dark:text-nvr-cyan", children: P(e, r).split(" ").map((f) => f[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() })
|
|
641
643
|
}
|
|
642
644
|
),
|
|
643
645
|
/* @__PURE__ */ l("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: [
|
|
644
|
-
/* @__PURE__ */ t("span", { className: "font-medium", children:
|
|
646
|
+
/* @__PURE__ */ t("span", { className: "font-medium", children: P(e, r) }),
|
|
645
647
|
" ",
|
|
646
|
-
/* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children:
|
|
648
|
+
/* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: pt(e, V, he) }),
|
|
649
|
+
m && /* @__PURE__ */ l(
|
|
650
|
+
"span",
|
|
651
|
+
{
|
|
652
|
+
className: "mt-0.5 block truncate text-[11.5px] text-slate-500 dark:text-slate-400",
|
|
653
|
+
"data-revision-reason": !0,
|
|
654
|
+
"data-tip": m,
|
|
655
|
+
children: [
|
|
656
|
+
"Reason: ",
|
|
657
|
+
m
|
|
658
|
+
]
|
|
659
|
+
}
|
|
660
|
+
)
|
|
647
661
|
] }),
|
|
648
|
-
/* @__PURE__ */ t(
|
|
662
|
+
/* @__PURE__ */ t(Ke, { label: e.via_agent }),
|
|
649
663
|
/* @__PURE__ */ t(
|
|
650
664
|
"span",
|
|
651
665
|
{
|
|
652
666
|
className: "shrink-0 text-[11px] tabular-nums text-slate-400",
|
|
653
667
|
title: e.timestamp ? new Date(e.timestamp).toLocaleString() : void 0,
|
|
654
|
-
children:
|
|
668
|
+
children: ke
|
|
655
669
|
}
|
|
656
670
|
),
|
|
657
|
-
|
|
671
|
+
h ? /* @__PURE__ */ t(Re, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }) : /* @__PURE__ */ t(je, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
658
672
|
]
|
|
659
673
|
}
|
|
660
674
|
),
|
|
661
|
-
|
|
675
|
+
h && /* @__PURE__ */ l("div", { className: "space-y-2.5 px-2 pb-4 pt-1", children: [
|
|
662
676
|
/* @__PURE__ */ l("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
663
677
|
/* @__PURE__ */ t("div", { className: "flex items-center overflow-hidden rounded-md border border-slate-200 dark:border-border", children: [
|
|
664
678
|
["changes", "What changed"],
|
|
665
679
|
["all", "Full record"]
|
|
666
|
-
].map(([f,
|
|
680
|
+
].map(([f, _]) => /* @__PURE__ */ t(
|
|
667
681
|
"button",
|
|
668
682
|
{
|
|
669
683
|
type: "button",
|
|
670
|
-
onClick: () =>
|
|
671
|
-
className:
|
|
684
|
+
onClick: () => x(f),
|
|
685
|
+
className: T(
|
|
672
686
|
"px-2.5 py-1 text-[11.5px] transition-colors",
|
|
673
|
-
|
|
687
|
+
c === 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"
|
|
674
688
|
),
|
|
675
|
-
children:
|
|
689
|
+
children: _
|
|
676
690
|
},
|
|
677
691
|
f
|
|
678
692
|
)) }),
|
|
@@ -681,18 +695,18 @@ function nt({
|
|
|
681
695
|
"button",
|
|
682
696
|
{
|
|
683
697
|
type: "button",
|
|
684
|
-
onClick: () =>
|
|
685
|
-
className:
|
|
698
|
+
onClick: () => b((f) => !f),
|
|
699
|
+
className: T(
|
|
686
700
|
"inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11.5px] transition-colors",
|
|
687
|
-
|
|
701
|
+
R ? "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"
|
|
688
702
|
),
|
|
689
703
|
children: [
|
|
690
|
-
/* @__PURE__ */ t(
|
|
704
|
+
/* @__PURE__ */ t(Ae, { className: "h-3 w-3" }),
|
|
691
705
|
"Notes"
|
|
692
706
|
]
|
|
693
707
|
}
|
|
694
708
|
),
|
|
695
|
-
|
|
709
|
+
xe && (u ? /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
696
710
|
/* @__PURE__ */ t("span", { className: "text-[11px] text-slate-500", children: "Restore this version?" }),
|
|
697
711
|
/* @__PURE__ */ t(
|
|
698
712
|
M,
|
|
@@ -700,8 +714,8 @@ function nt({
|
|
|
700
714
|
size: "sm",
|
|
701
715
|
variant: "destructive",
|
|
702
716
|
className: "h-6 text-[11px]",
|
|
703
|
-
disabled:
|
|
704
|
-
onClick: () =>
|
|
717
|
+
disabled: H.isPending,
|
|
718
|
+
onClick: () => H.mutate(),
|
|
705
719
|
children: "Yes, restore"
|
|
706
720
|
}
|
|
707
721
|
),
|
|
@@ -711,7 +725,7 @@ function nt({
|
|
|
711
725
|
size: "sm",
|
|
712
726
|
variant: "outline",
|
|
713
727
|
className: "h-6 text-[11px]",
|
|
714
|
-
onClick: () =>
|
|
728
|
+
onClick: () => g(!1),
|
|
715
729
|
children: "Cancel"
|
|
716
730
|
}
|
|
717
731
|
)
|
|
@@ -721,8 +735,8 @@ function nt({
|
|
|
721
735
|
size: "sm",
|
|
722
736
|
variant: "outline",
|
|
723
737
|
className: "h-6 gap-1 text-[11px]",
|
|
724
|
-
disabled:
|
|
725
|
-
onClick: () =>
|
|
738
|
+
disabled: H.isPending,
|
|
739
|
+
onClick: () => g(!0),
|
|
726
740
|
title: "Set the whole record back to how it looked after this save",
|
|
727
741
|
children: [
|
|
728
742
|
/* @__PURE__ */ t(de, { className: "h-3 w-3" }),
|
|
@@ -732,30 +746,30 @@ function nt({
|
|
|
732
746
|
))
|
|
733
747
|
] })
|
|
734
748
|
] }),
|
|
735
|
-
|
|
749
|
+
R && /* @__PURE__ */ t(yt, { revisionId: e.id ?? "" }),
|
|
736
750
|
/* @__PURE__ */ t(
|
|
737
|
-
|
|
751
|
+
ct,
|
|
738
752
|
{
|
|
739
|
-
before:
|
|
740
|
-
after:
|
|
741
|
-
meta:
|
|
742
|
-
fieldRevert:
|
|
743
|
-
mode:
|
|
744
|
-
hideStatusChips:
|
|
753
|
+
before: k,
|
|
754
|
+
after: $,
|
|
755
|
+
meta: i,
|
|
756
|
+
fieldRevert: ye,
|
|
757
|
+
mode: c,
|
|
758
|
+
hideStatusChips: C
|
|
745
759
|
}
|
|
746
760
|
),
|
|
747
|
-
|
|
761
|
+
z && o && o.length > 0 && /* @__PURE__ */ l("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: [
|
|
748
762
|
/* @__PURE__ */ t("p", { className: "text-[10.5px] font-medium text-slate-500", children: "Also restore related rows?" }),
|
|
749
|
-
|
|
763
|
+
o.map((f) => /* @__PURE__ */ l("div", { className: "flex items-center justify-between gap-2", children: [
|
|
750
764
|
/* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: f.label }),
|
|
751
765
|
/* @__PURE__ */ t(
|
|
752
766
|
"button",
|
|
753
767
|
{
|
|
754
768
|
type: "button",
|
|
755
|
-
disabled:
|
|
756
|
-
onClick: () =>
|
|
769
|
+
disabled: N === f.field,
|
|
770
|
+
onClick: () => Ne(f),
|
|
757
771
|
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",
|
|
758
|
-
children:
|
|
772
|
+
children: N === f.field ? "Restoring…" : "Restore"
|
|
759
773
|
}
|
|
760
774
|
)
|
|
761
775
|
] }, f.field))
|
|
@@ -763,39 +777,39 @@ function nt({
|
|
|
763
777
|
] })
|
|
764
778
|
] });
|
|
765
779
|
}
|
|
766
|
-
function
|
|
767
|
-
const [
|
|
768
|
-
if (!
|
|
769
|
-
const c = (/* @__PURE__ */ new Date(`${
|
|
770
|
-
return e.find((
|
|
771
|
-
}, [
|
|
780
|
+
function xt({ data: e, meta: s }) {
|
|
781
|
+
const [i, a] = v(null), [o, d] = v(""), [n, r] = v(""), [m, h] = v(""), p = L(() => {
|
|
782
|
+
if (!o || !e) return null;
|
|
783
|
+
const c = (/* @__PURE__ */ new Date(`${o}T23:59:59`)).getTime();
|
|
784
|
+
return e.find((x) => x.timestamp && new Date(x.timestamp).getTime() <= c) ?? null;
|
|
785
|
+
}, [o, e]), u = L(() => {
|
|
772
786
|
if (!n || !m || !e) return null;
|
|
773
|
-
const c = (/* @__PURE__ */ new Date(`${n}T23:59:59`)).getTime(),
|
|
774
|
-
if (
|
|
775
|
-
const
|
|
776
|
-
if (!
|
|
777
|
-
const S = (
|
|
778
|
-
for (const
|
|
779
|
-
const
|
|
780
|
-
if (!(
|
|
781
|
-
for (const V of Object.keys(
|
|
782
|
-
|
|
787
|
+
const c = (/* @__PURE__ */ new Date(`${n}T23:59:59`)).getTime(), x = (/* @__PURE__ */ new Date(`${m}T23:59:59`)).getTime();
|
|
788
|
+
if (x <= c) return { error: "The second date must be after the first" };
|
|
789
|
+
const R = (k) => e.find(($) => $.timestamp && new Date($.timestamp).getTime() <= k) ?? null, b = R(c), N = R(x);
|
|
790
|
+
if (!N) return { error: "No snapshot exists at or before the second date" };
|
|
791
|
+
const S = (b == null ? void 0 : b.data) ?? {}, w = N.data ?? {}, C = /* @__PURE__ */ new Map();
|
|
792
|
+
for (const k of [...e].reverse()) {
|
|
793
|
+
const $ = k.timestamp ? new Date(k.timestamp).getTime() : 0;
|
|
794
|
+
if (!($ <= c || $ > x || !k.delta))
|
|
795
|
+
for (const V of Object.keys(k.delta))
|
|
796
|
+
C.set(V, { name: P(k), when: k.timestamp });
|
|
783
797
|
}
|
|
784
|
-
return { fields: [.../* @__PURE__ */ new Set([...Object.keys(S), ...Object.keys(
|
|
785
|
-
}, [n, m, e]),
|
|
798
|
+
return { fields: [.../* @__PURE__ */ new Set([...Object.keys(S), ...Object.keys(w)])].filter((k) => String(S[k] ?? "") !== String(w[k] ?? "")).map((k) => ({ field: k, from: S[k], to: w[k], by: C.get(k) ?? null })) };
|
|
799
|
+
}, [n, m, e]), g = "h-7 rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card";
|
|
786
800
|
return /* @__PURE__ */ l("div", { className: "space-y-2", children: [
|
|
787
801
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
|
|
788
802
|
/* @__PURE__ */ l(
|
|
789
803
|
"button",
|
|
790
804
|
{
|
|
791
805
|
type: "button",
|
|
792
|
-
onClick: () => i
|
|
793
|
-
className:
|
|
806
|
+
onClick: () => a(i === "asof" ? null : "asof"),
|
|
807
|
+
className: T(
|
|
794
808
|
"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11.5px] transition-colors",
|
|
795
|
-
|
|
809
|
+
i === "asof" || o ? "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"
|
|
796
810
|
),
|
|
797
811
|
children: [
|
|
798
|
-
/* @__PURE__ */ t(
|
|
812
|
+
/* @__PURE__ */ t(_e, { className: "h-3.5 w-3.5" }),
|
|
799
813
|
"View as of a date"
|
|
800
814
|
]
|
|
801
815
|
}
|
|
@@ -804,50 +818,50 @@ function lt({ data: e, meta: r }) {
|
|
|
804
818
|
"button",
|
|
805
819
|
{
|
|
806
820
|
type: "button",
|
|
807
|
-
onClick: () => i
|
|
808
|
-
className:
|
|
821
|
+
onClick: () => a(i === "compare" ? null : "compare"),
|
|
822
|
+
className: T(
|
|
809
823
|
"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11.5px] transition-colors",
|
|
810
|
-
|
|
824
|
+
i === "compare" || n && m ? "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"
|
|
811
825
|
),
|
|
812
826
|
children: [
|
|
813
|
-
/* @__PURE__ */ t(
|
|
827
|
+
/* @__PURE__ */ t(Te, { className: "h-3.5 w-3.5" }),
|
|
814
828
|
"Compare two dates"
|
|
815
829
|
]
|
|
816
830
|
}
|
|
817
831
|
)
|
|
818
832
|
] }),
|
|
819
|
-
|
|
833
|
+
i === "asof" && /* @__PURE__ */ l("div", { className: "rounded-lg border border-slate-200 bg-slate-50/60 p-2.5 dark:border-border dark:bg-muted/20", children: [
|
|
820
834
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
821
835
|
/* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: "Show the record exactly as it was on" }),
|
|
822
836
|
/* @__PURE__ */ t(
|
|
823
837
|
"input",
|
|
824
838
|
{
|
|
825
839
|
type: "date",
|
|
826
|
-
value:
|
|
827
|
-
onChange: (c) =>
|
|
828
|
-
className:
|
|
840
|
+
value: o,
|
|
841
|
+
onChange: (c) => d(c.target.value),
|
|
842
|
+
className: g,
|
|
829
843
|
"aria-label": "View record as of date",
|
|
830
844
|
"data-as-of": !0
|
|
831
845
|
}
|
|
832
846
|
),
|
|
833
|
-
|
|
847
|
+
o && /* @__PURE__ */ t(
|
|
834
848
|
"button",
|
|
835
849
|
{
|
|
836
850
|
type: "button",
|
|
837
|
-
onClick: () =>
|
|
851
|
+
onClick: () => d(""),
|
|
838
852
|
className: "text-[11px] text-slate-400 hover:text-slate-600 dark:hover:text-slate-300",
|
|
839
853
|
children: "Clear"
|
|
840
854
|
}
|
|
841
855
|
)
|
|
842
856
|
] }),
|
|
843
|
-
|
|
857
|
+
o && !p && /* @__PURE__ */ t("p", { className: "mt-2 text-[12px] text-slate-400", children: "No snapshot exists at or before that date — the record is newer." }),
|
|
844
858
|
p && /* @__PURE__ */ l("div", { className: "mt-2 overflow-hidden rounded-lg border border-nvr-cyan/40 bg-white dark:bg-card", children: [
|
|
845
859
|
/* @__PURE__ */ t("div", { className: "border-b border-slate-200 bg-[#f0fbff] px-2.5 py-1.5 dark:border-border dark:bg-nvr-cyan/10", children: /* @__PURE__ */ l("span", { className: "text-[11.5px] font-semibold text-slate-700 dark:text-slate-200", children: [
|
|
846
860
|
"Record as of",
|
|
847
861
|
" ",
|
|
848
|
-
p.timestamp ? new Date(p.timestamp).toLocaleString() :
|
|
862
|
+
p.timestamp ? new Date(p.timestamp).toLocaleString() : o
|
|
849
863
|
] }) }),
|
|
850
|
-
/* @__PURE__ */ t("div", { className: "max-h-80 overflow-y-auto", children: Object.entries(p.data ?? {}).filter(([, c]) => c != null && c !== "").sort(([c], [
|
|
864
|
+
/* @__PURE__ */ t("div", { className: "max-h-80 overflow-y-auto", children: Object.entries(p.data ?? {}).filter(([, c]) => c != null && c !== "").sort(([c], [x]) => y(s, c).label.localeCompare(y(s, x).label)).map(([c, x]) => /* @__PURE__ */ l(
|
|
851
865
|
"div",
|
|
852
866
|
{
|
|
853
867
|
className: "flex items-start gap-3 border-b border-slate-100 px-2.5 py-1.5 last:border-0 dark:border-border/60",
|
|
@@ -857,17 +871,17 @@ function lt({ data: e, meta: r }) {
|
|
|
857
871
|
{
|
|
858
872
|
className: "w-[200px] shrink-0 text-[11.5px] font-medium text-slate-600 dark:text-slate-300",
|
|
859
873
|
title: c,
|
|
860
|
-
children:
|
|
874
|
+
children: y(s, c).label
|
|
861
875
|
}
|
|
862
876
|
),
|
|
863
|
-
/* @__PURE__ */ t("span", { className: "break-words text-[11.5px] text-slate-700 dark:text-slate-300", children: /* @__PURE__ */ t(
|
|
877
|
+
/* @__PURE__ */ t("span", { className: "break-words text-[11.5px] text-slate-700 dark:text-slate-300", children: /* @__PURE__ */ t(q, { value: x, meta: y(s, c), tone: "after" }) })
|
|
864
878
|
]
|
|
865
879
|
},
|
|
866
880
|
c
|
|
867
881
|
)) })
|
|
868
882
|
] })
|
|
869
883
|
] }),
|
|
870
|
-
|
|
884
|
+
i === "compare" && /* @__PURE__ */ l("div", { className: "rounded-lg border border-slate-200 bg-slate-50/60 p-2.5 dark:border-border dark:bg-muted/20", children: [
|
|
871
885
|
/* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
872
886
|
/* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: "What changed between" }),
|
|
873
887
|
/* @__PURE__ */ t(
|
|
@@ -875,8 +889,8 @@ function lt({ data: e, meta: r }) {
|
|
|
875
889
|
{
|
|
876
890
|
type: "date",
|
|
877
891
|
value: n,
|
|
878
|
-
onChange: (c) =>
|
|
879
|
-
className:
|
|
892
|
+
onChange: (c) => r(c.target.value),
|
|
893
|
+
className: g,
|
|
880
894
|
"aria-label": "Compare from date",
|
|
881
895
|
"data-diff-from": !0
|
|
882
896
|
}
|
|
@@ -887,8 +901,8 @@ function lt({ data: e, meta: r }) {
|
|
|
887
901
|
{
|
|
888
902
|
type: "date",
|
|
889
903
|
value: m,
|
|
890
|
-
onChange: (c) =>
|
|
891
|
-
className:
|
|
904
|
+
onChange: (c) => h(c.target.value),
|
|
905
|
+
className: g,
|
|
892
906
|
"aria-label": "Compare to date",
|
|
893
907
|
"data-diff-to": !0
|
|
894
908
|
}
|
|
@@ -898,31 +912,31 @@ function lt({ data: e, meta: r }) {
|
|
|
898
912
|
{
|
|
899
913
|
type: "button",
|
|
900
914
|
onClick: () => {
|
|
901
|
-
|
|
915
|
+
r(""), h("");
|
|
902
916
|
},
|
|
903
917
|
className: "text-[11px] text-slate-400 hover:text-slate-600 dark:hover:text-slate-300",
|
|
904
918
|
children: "Clear"
|
|
905
919
|
}
|
|
906
920
|
)
|
|
907
921
|
] }),
|
|
908
|
-
(
|
|
909
|
-
(
|
|
922
|
+
(u == null ? void 0 : u.error) != null && /* @__PURE__ */ t("p", { className: "mt-2 text-[12px] text-amber-600 dark:text-amber-400", children: u == null ? void 0 : u.error }),
|
|
923
|
+
(u == null ? void 0 : u.fields) != null && /* @__PURE__ */ l(
|
|
910
924
|
"div",
|
|
911
925
|
{
|
|
912
926
|
className: "mt-2 overflow-hidden rounded-lg border border-nvr-cyan/40 bg-white dark:bg-card",
|
|
913
927
|
"data-between-diff": !0,
|
|
914
928
|
children: [
|
|
915
929
|
/* @__PURE__ */ t("div", { className: "border-b border-slate-200 bg-[#f0fbff] px-2.5 py-1.5 dark:border-border dark:bg-nvr-cyan/10", children: /* @__PURE__ */ l("span", { className: "text-[11.5px] font-semibold text-slate-700 dark:text-slate-200", children: [
|
|
916
|
-
|
|
930
|
+
u.fields.length,
|
|
917
931
|
" field",
|
|
918
|
-
|
|
932
|
+
u.fields.length === 1 ? "" : "s",
|
|
919
933
|
" changed between ",
|
|
920
934
|
n,
|
|
921
935
|
" and",
|
|
922
936
|
" ",
|
|
923
937
|
m
|
|
924
938
|
] }) }),
|
|
925
|
-
|
|
939
|
+
u.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: u.fields.map((c) => /* @__PURE__ */ l(
|
|
926
940
|
"div",
|
|
927
941
|
{
|
|
928
942
|
className: "border-b border-slate-100 px-2.5 py-1.5 last:border-0 dark:border-border/60",
|
|
@@ -933,7 +947,7 @@ function lt({ data: e, meta: r }) {
|
|
|
933
947
|
{
|
|
934
948
|
className: "text-[11.5px] font-medium text-slate-600 dark:text-slate-300",
|
|
935
949
|
title: c.field,
|
|
936
|
-
children:
|
|
950
|
+
children: y(s, c.field).label
|
|
937
951
|
}
|
|
938
952
|
),
|
|
939
953
|
c.by && /* @__PURE__ */ l("span", { className: "shrink-0 text-[10.5px] text-slate-400", children: [
|
|
@@ -942,8 +956,8 @@ function lt({ data: e, meta: r }) {
|
|
|
942
956
|
] })
|
|
943
957
|
] }),
|
|
944
958
|
/* @__PURE__ */ l("p", { className: "mt-0.5 flex flex-wrap items-baseline gap-x-2 break-words text-[11.5px]", children: [
|
|
945
|
-
/* @__PURE__ */ t("span", { className: "text-red-500 line-through dark:text-red-400", children: /* @__PURE__ */ t(
|
|
946
|
-
/* @__PURE__ */ t("span", { className: "text-emerald-600 dark:text-emerald-400", children: /* @__PURE__ */ t(
|
|
959
|
+
/* @__PURE__ */ t("span", { className: "text-red-500 line-through dark:text-red-400", children: /* @__PURE__ */ t(q, { value: c.from, meta: y(s, c.field), tone: "before" }) }),
|
|
960
|
+
/* @__PURE__ */ t("span", { className: "text-emerald-600 dark:text-emerald-400", children: /* @__PURE__ */ t(q, { value: c.to, meta: y(s, c.field), tone: "after" }) })
|
|
947
961
|
] })
|
|
948
962
|
]
|
|
949
963
|
},
|
|
@@ -955,7 +969,7 @@ function lt({ data: e, meta: r }) {
|
|
|
955
969
|
] })
|
|
956
970
|
] });
|
|
957
971
|
}
|
|
958
|
-
function
|
|
972
|
+
function ft(e) {
|
|
959
973
|
return e ? new Date(e).toLocaleDateString([], {
|
|
960
974
|
weekday: "short",
|
|
961
975
|
month: "short",
|
|
@@ -963,89 +977,92 @@ function it(e) {
|
|
|
963
977
|
year: "numeric"
|
|
964
978
|
}) : "Unknown date";
|
|
965
979
|
}
|
|
966
|
-
function
|
|
980
|
+
function bt({
|
|
967
981
|
collection: e,
|
|
968
|
-
item:
|
|
969
|
-
onRollback:
|
|
970
|
-
inlineTableFields:
|
|
982
|
+
item: s,
|
|
983
|
+
onRollback: i,
|
|
984
|
+
inlineTableFields: a
|
|
971
985
|
}) {
|
|
972
|
-
const
|
|
973
|
-
queryKey: ["revisions", e,
|
|
974
|
-
queryFn: () =>
|
|
986
|
+
const o = F(), d = ue(e, !0), { data: n, isLoading: r } = B({
|
|
987
|
+
queryKey: ["revisions", e, s],
|
|
988
|
+
queryFn: () => o.request(D("/revisions", { collection: e, item: s })).then((b) => b.data ?? []),
|
|
975
989
|
staleTime: 3e4
|
|
976
|
-
}), m =
|
|
977
|
-
|
|
978
|
-
const
|
|
990
|
+
}), m = ee();
|
|
991
|
+
Pe(e, s, [["revisions", e, s]], { client: m });
|
|
992
|
+
const h = $e(null), p = L(() => {
|
|
979
993
|
if (!n) return /* @__PURE__ */ new Set();
|
|
980
|
-
const
|
|
981
|
-
if (!
|
|
982
|
-
return
|
|
983
|
-
const
|
|
984
|
-
return new Set(
|
|
985
|
-
}, [n]),
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
994
|
+
const b = n.map(O);
|
|
995
|
+
if (!h.current)
|
|
996
|
+
return h.current = new Set(b), /* @__PURE__ */ new Set();
|
|
997
|
+
const N = h.current;
|
|
998
|
+
return new Set(b.filter((S) => !N.has(S)));
|
|
999
|
+
}, [n]), u = (n == null ? void 0 : n.length) ?? 0, g = L(() => (n ?? []).filter(G), [n]), c = L(
|
|
1000
|
+
() => (n ?? []).filter((b) => b.actor && b.actor.kind !== "person").map((b) => ({ action: b.action, user: b.user_id, actor: b.actor })),
|
|
1001
|
+
[n]
|
|
1002
|
+
), x = Ie(c, { enabled: c.length > 0 }), R = L(() => {
|
|
1003
|
+
const b = [];
|
|
1004
|
+
for (const N of n ?? []) {
|
|
1005
|
+
const S = ft(N.timestamp), w = b[b.length - 1];
|
|
1006
|
+
w && w.day === S ? w.revisions.push(N) : b.push({ day: S, revisions: [N] });
|
|
990
1007
|
}
|
|
991
|
-
return
|
|
1008
|
+
return b;
|
|
992
1009
|
}, [n]);
|
|
993
|
-
return
|
|
994
|
-
/* @__PURE__ */ t(
|
|
1010
|
+
return r ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-3", children: [1, 2, 3, 4].map((b) => /* @__PURE__ */ t(Je, { className: "h-11 rounded-md" }, b)) }) : u === 0 ? /* @__PURE__ */ l("div", { className: "flex flex-col items-center py-16 text-center", children: [
|
|
1011
|
+
/* @__PURE__ */ t(Y, { className: "mb-2 h-8 w-8 text-slate-300 dark:text-slate-600" }),
|
|
995
1012
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No history yet" }),
|
|
996
1013
|
/* @__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." })
|
|
997
|
-
] }) : /* @__PURE__ */ l("div", { className: "space-y-3 pt-3", children: [
|
|
998
|
-
/* @__PURE__ */ t(
|
|
999
|
-
|
|
1000
|
-
/* @__PURE__ */ t("div", { children:
|
|
1001
|
-
/* @__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:
|
|
1002
|
-
|
|
1003
|
-
const
|
|
1004
|
-
if (
|
|
1014
|
+
] }) : /* @__PURE__ */ t(te.Provider, { value: x, children: /* @__PURE__ */ l("div", { className: "space-y-3 pt-3", children: [
|
|
1015
|
+
/* @__PURE__ */ t(xt, { data: g, meta: d }),
|
|
1016
|
+
g.length >= 3 && /* @__PURE__ */ t(Nt, { revisions: g, meta: d }),
|
|
1017
|
+
/* @__PURE__ */ t("div", { children: R.map((b) => /* @__PURE__ */ l("div", { children: [
|
|
1018
|
+
/* @__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: b.day }) }),
|
|
1019
|
+
b.revisions.map((N) => {
|
|
1020
|
+
const S = (n ?? []).indexOf(N), w = S === ((n == null ? void 0 : n.length) ?? 1) - 1;
|
|
1021
|
+
if (Ye(N))
|
|
1005
1022
|
return /* @__PURE__ */ l(
|
|
1006
1023
|
"div",
|
|
1007
1024
|
{
|
|
1008
|
-
className:
|
|
1025
|
+
className: T(
|
|
1009
1026
|
"nvr-fade-in relative",
|
|
1010
|
-
p.has(
|
|
1027
|
+
p.has(O(N)) && "rounded-md bg-nvr-cyan/[0.06]"
|
|
1011
1028
|
),
|
|
1012
1029
|
children: [
|
|
1013
|
-
p.has(
|
|
1014
|
-
/* @__PURE__ */ t(
|
|
1030
|
+
p.has(O(N)) && /* @__PURE__ */ t(oe, {}),
|
|
1031
|
+
/* @__PURE__ */ t(ut, { revision: N, isLast: w })
|
|
1015
1032
|
]
|
|
1016
1033
|
},
|
|
1017
|
-
|
|
1034
|
+
O(N)
|
|
1018
1035
|
);
|
|
1019
|
-
const
|
|
1036
|
+
const C = (n ?? []).slice(S + 1).find(G);
|
|
1020
1037
|
return /* @__PURE__ */ l(
|
|
1021
1038
|
"div",
|
|
1022
1039
|
{
|
|
1023
|
-
className:
|
|
1040
|
+
className: T(
|
|
1024
1041
|
"nvr-fade-in relative",
|
|
1025
|
-
p.has(
|
|
1042
|
+
p.has(O(N)) && "rounded-md bg-nvr-cyan/[0.06]"
|
|
1026
1043
|
),
|
|
1027
1044
|
children: [
|
|
1028
|
-
p.has(
|
|
1045
|
+
p.has(O(N)) && /* @__PURE__ */ t(oe, {}),
|
|
1029
1046
|
/* @__PURE__ */ t(
|
|
1030
|
-
|
|
1047
|
+
ht,
|
|
1031
1048
|
{
|
|
1032
|
-
revision:
|
|
1033
|
-
previousData: (
|
|
1034
|
-
meta:
|
|
1035
|
-
onRollback:
|
|
1036
|
-
inlineTableFields:
|
|
1049
|
+
revision: N,
|
|
1050
|
+
previousData: (C == null ? void 0 : C.data) ?? null,
|
|
1051
|
+
meta: d,
|
|
1052
|
+
onRollback: i,
|
|
1053
|
+
inlineTableFields: a,
|
|
1037
1054
|
isLast: w
|
|
1038
1055
|
}
|
|
1039
1056
|
)
|
|
1040
1057
|
]
|
|
1041
1058
|
},
|
|
1042
|
-
|
|
1059
|
+
O(N)
|
|
1043
1060
|
);
|
|
1044
1061
|
})
|
|
1045
|
-
] },
|
|
1046
|
-
] });
|
|
1062
|
+
] }, b.day)) })
|
|
1063
|
+
] }) });
|
|
1047
1064
|
}
|
|
1048
|
-
function
|
|
1065
|
+
function oe() {
|
|
1049
1066
|
return (
|
|
1050
1067
|
// Under the timeline dot, inside the row's 36px gutter.
|
|
1051
1068
|
/* @__PURE__ */ t(
|
|
@@ -1058,69 +1075,69 @@ function ie() {
|
|
|
1058
1075
|
)
|
|
1059
1076
|
);
|
|
1060
1077
|
}
|
|
1061
|
-
function
|
|
1078
|
+
function It({
|
|
1062
1079
|
collection: e,
|
|
1063
|
-
item:
|
|
1064
|
-
onRollback:
|
|
1065
|
-
triggerClassName:
|
|
1066
|
-
inlineTableFields:
|
|
1067
|
-
open:
|
|
1080
|
+
item: s,
|
|
1081
|
+
onRollback: i,
|
|
1082
|
+
triggerClassName: a,
|
|
1083
|
+
inlineTableFields: o,
|
|
1084
|
+
open: d,
|
|
1068
1085
|
onOpenChange: n,
|
|
1069
|
-
compact:
|
|
1086
|
+
compact: r
|
|
1070
1087
|
}) {
|
|
1071
|
-
return /* @__PURE__ */ l(
|
|
1072
|
-
!(
|
|
1088
|
+
return /* @__PURE__ */ l(Ue, { open: d, onOpenChange: n, children: [
|
|
1089
|
+
!(d !== void 0) && /* @__PURE__ */ t(We, { asChild: !0, children: /* @__PURE__ */ l(
|
|
1073
1090
|
M,
|
|
1074
1091
|
{
|
|
1075
|
-
variant:
|
|
1092
|
+
variant: r ? "ghost" : "outline",
|
|
1076
1093
|
size: "sm",
|
|
1077
|
-
title:
|
|
1094
|
+
title: r ? "History — revisions of this record" : void 0,
|
|
1078
1095
|
"aria-label": "History",
|
|
1079
|
-
className:
|
|
1096
|
+
className: a ?? (r ? "h-8 w-8 rounded-none p-0" : "gap-1.5"),
|
|
1080
1097
|
children: [
|
|
1081
|
-
/* @__PURE__ */ t(
|
|
1082
|
-
!
|
|
1098
|
+
/* @__PURE__ */ t(Y, { className: r ? "h-4 w-4" : "h-3.5 w-3.5" }),
|
|
1099
|
+
!r && "History"
|
|
1083
1100
|
]
|
|
1084
1101
|
}
|
|
1085
1102
|
) }),
|
|
1086
|
-
/* @__PURE__ */ t(
|
|
1087
|
-
/* @__PURE__ */ l(
|
|
1088
|
-
/* @__PURE__ */ l(
|
|
1089
|
-
/* @__PURE__ */ t(
|
|
1103
|
+
/* @__PURE__ */ t(Ve, { className: "w-[720px] overflow-y-auto p-0 sm:max-w-[92vw]", children: /* @__PURE__ */ l("div", { className: "p-6", children: [
|
|
1104
|
+
/* @__PURE__ */ l(ze, { children: [
|
|
1105
|
+
/* @__PURE__ */ l(He, { className: "flex items-center gap-2 text-base", children: [
|
|
1106
|
+
/* @__PURE__ */ t(Y, { className: "h-4 w-4 text-slate-400" }),
|
|
1090
1107
|
"Revision history"
|
|
1091
1108
|
] }),
|
|
1092
1109
|
/* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "Who changed what, when — expand any entry to see the exact values, revert a single field, or restore the whole version." })
|
|
1093
1110
|
] }),
|
|
1094
|
-
/* @__PURE__ */ t(
|
|
1095
|
-
/* @__PURE__ */ t(
|
|
1111
|
+
/* @__PURE__ */ t(gt, { collection: e, item: s }),
|
|
1112
|
+
/* @__PURE__ */ t(Qe, { collection: e, item: String(s) }),
|
|
1096
1113
|
/* @__PURE__ */ t(
|
|
1097
|
-
|
|
1114
|
+
bt,
|
|
1098
1115
|
{
|
|
1099
1116
|
collection: e,
|
|
1100
|
-
item:
|
|
1101
|
-
onRollback:
|
|
1102
|
-
inlineTableFields:
|
|
1117
|
+
item: s,
|
|
1118
|
+
onRollback: i,
|
|
1119
|
+
inlineTableFields: o
|
|
1103
1120
|
}
|
|
1104
1121
|
)
|
|
1105
1122
|
] }) })
|
|
1106
1123
|
] });
|
|
1107
1124
|
}
|
|
1108
|
-
function
|
|
1109
|
-
const
|
|
1110
|
-
queryKey: ["rev-value-search", e,
|
|
1111
|
-
queryFn: () =>
|
|
1125
|
+
function gt({ collection: e, item: s }) {
|
|
1126
|
+
const i = F(), a = ue(e, !0), [o, d] = v(""), [n, r] = v(""), { data: m, isFetching: h } = B({
|
|
1127
|
+
queryKey: ["rev-value-search", e, s, n],
|
|
1128
|
+
queryFn: () => i.request(D("/revisions/value-search", { collection: e, item: s, q: n })).then((p) => p.data),
|
|
1112
1129
|
enabled: n.length >= 2
|
|
1113
1130
|
});
|
|
1114
1131
|
return /* @__PURE__ */ l("div", { className: "mt-3", children: [
|
|
1115
1132
|
/* @__PURE__ */ l("div", { className: "relative", children: [
|
|
1116
|
-
/* @__PURE__ */ t(
|
|
1133
|
+
/* @__PURE__ */ t(Se, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
1117
1134
|
/* @__PURE__ */ t(
|
|
1118
1135
|
"input",
|
|
1119
1136
|
{
|
|
1120
|
-
value:
|
|
1121
|
-
onChange: (p) =>
|
|
1137
|
+
value: o,
|
|
1138
|
+
onChange: (p) => d(p.target.value),
|
|
1122
1139
|
onKeyDown: (p) => {
|
|
1123
|
-
p.key === "Enter" &&
|
|
1140
|
+
p.key === "Enter" && r(o.trim());
|
|
1124
1141
|
},
|
|
1125
1142
|
placeholder: "Search this record’s history for a value — who wrote it, and when",
|
|
1126
1143
|
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"
|
|
@@ -1131,28 +1148,28 @@ function ot({ collection: e, item: r }) {
|
|
|
1131
1148
|
{
|
|
1132
1149
|
type: "button",
|
|
1133
1150
|
onClick: () => {
|
|
1134
|
-
|
|
1151
|
+
d(""), r("");
|
|
1135
1152
|
},
|
|
1136
1153
|
className: "absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",
|
|
1137
1154
|
"aria-label": "Clear search",
|
|
1138
|
-
children: /* @__PURE__ */ t(
|
|
1155
|
+
children: /* @__PURE__ */ t(Ce, { className: "h-3.5 w-3.5" })
|
|
1139
1156
|
}
|
|
1140
1157
|
)
|
|
1141
1158
|
] }),
|
|
1142
|
-
n && /* @__PURE__ */ t("div", { className: "mt-2 space-y-1.5 rounded-lg border border-slate-200 p-2.5 dark:border-border", children:
|
|
1159
|
+
n && /* @__PURE__ */ t("div", { className: "mt-2 space-y-1.5 rounded-lg border border-slate-200 p-2.5 dark:border-border", children: h ? /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-400", children: "Searching…" }) : ((m == null ? void 0 : m.matches) ?? []).length === 0 ? /* @__PURE__ */ l("p", { className: "text-[11.5px] text-slate-400", children: [
|
|
1143
1160
|
"“",
|
|
1144
1161
|
n,
|
|
1145
1162
|
"” never appears in this record’s recorded changes."
|
|
1146
|
-
] }) : /* @__PURE__ */ l(
|
|
1163
|
+
] }) : /* @__PURE__ */ l(j, { children: [
|
|
1147
1164
|
m == null ? void 0 : m.matches.map((p) => /* @__PURE__ */ l("div", { className: "text-[11.5px]", children: [
|
|
1148
|
-
/* @__PURE__ */ t("p", { className: "text-slate-600 dark:text-slate-300", children: p.fields.map((
|
|
1149
|
-
/* @__PURE__ */ t("span", { className: "font-medium", title:
|
|
1165
|
+
/* @__PURE__ */ t("p", { className: "text-slate-600 dark:text-slate-300", children: p.fields.map((u) => /* @__PURE__ */ l("span", { children: [
|
|
1166
|
+
/* @__PURE__ */ t("span", { className: "font-medium", title: u.field, children: y(a, u.field).label }),
|
|
1150
1167
|
" ",
|
|
1151
1168
|
"→ “",
|
|
1152
|
-
|
|
1169
|
+
u.value.length > 60 ? `${u.value.slice(0, 60)}…` : u.value,
|
|
1153
1170
|
"”",
|
|
1154
1171
|
" "
|
|
1155
|
-
] },
|
|
1172
|
+
] }, u.field)) }),
|
|
1156
1173
|
/* @__PURE__ */ l("p", { className: "text-[10.5px] text-slate-400", children: [
|
|
1157
1174
|
p.user_name ?? "System",
|
|
1158
1175
|
" ·",
|
|
@@ -1166,49 +1183,49 @@ function ot({ collection: e, item: r }) {
|
|
|
1166
1183
|
] }) })
|
|
1167
1184
|
] });
|
|
1168
1185
|
}
|
|
1169
|
-
function
|
|
1170
|
-
const
|
|
1186
|
+
function yt({ revisionId: e }) {
|
|
1187
|
+
const s = F(), i = ee(), [a, o] = v(""), { data: d = [] } = B({
|
|
1171
1188
|
queryKey: ["revision-notes", String(e)],
|
|
1172
|
-
queryFn: () =>
|
|
1189
|
+
queryFn: () => s.request(D("/comments", { collection: "nivaro_revisions", item: String(e) })).then((r) => r.data ?? []).catch(() => []),
|
|
1173
1190
|
staleTime: 3e4
|
|
1174
|
-
}), n =
|
|
1175
|
-
mutationFn: () =>
|
|
1176
|
-
K("/comments", { collection: "nivaro_revisions", item: String(e), text:
|
|
1191
|
+
}), n = Q({
|
|
1192
|
+
mutationFn: () => s.request(
|
|
1193
|
+
K("/comments", { collection: "nivaro_revisions", item: String(e), text: a })
|
|
1177
1194
|
),
|
|
1178
1195
|
onSuccess: () => {
|
|
1179
|
-
|
|
1196
|
+
o(""), i.invalidateQueries({ queryKey: ["revision-notes", String(e)] });
|
|
1180
1197
|
},
|
|
1181
|
-
onError: () =>
|
|
1198
|
+
onError: () => A.error("Note failed")
|
|
1182
1199
|
});
|
|
1183
1200
|
return /* @__PURE__ */ l("div", { className: "rounded-md border border-slate-100 bg-slate-50/60 p-2 dark:border-border/60 dark:bg-muted/30", children: [
|
|
1184
|
-
|
|
1185
|
-
|
|
1201
|
+
d.map((r) => /* @__PURE__ */ l("p", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: [
|
|
1202
|
+
r.text,
|
|
1186
1203
|
" ",
|
|
1187
1204
|
/* @__PURE__ */ l("span", { className: "text-[10px] text-slate-400", children: [
|
|
1188
1205
|
"— ",
|
|
1189
|
-
|
|
1206
|
+
r.user_name ?? "someone",
|
|
1190
1207
|
" · ",
|
|
1191
|
-
new Date(
|
|
1208
|
+
new Date(r.created_at).toLocaleDateString()
|
|
1192
1209
|
] })
|
|
1193
|
-
] },
|
|
1210
|
+
] }, r.id)),
|
|
1194
1211
|
/* @__PURE__ */ l(
|
|
1195
1212
|
"form",
|
|
1196
1213
|
{
|
|
1197
|
-
onSubmit: (
|
|
1198
|
-
|
|
1214
|
+
onSubmit: (r) => {
|
|
1215
|
+
r.preventDefault(), a.trim() && n.mutate();
|
|
1199
1216
|
},
|
|
1200
1217
|
className: "mt-1 flex gap-1.5",
|
|
1201
1218
|
children: [
|
|
1202
1219
|
/* @__PURE__ */ t(
|
|
1203
1220
|
"input",
|
|
1204
1221
|
{
|
|
1205
|
-
value:
|
|
1206
|
-
onChange: (
|
|
1222
|
+
value: a,
|
|
1223
|
+
onChange: (r) => o(r.target.value),
|
|
1207
1224
|
placeholder: "Annotate this revision…",
|
|
1208
1225
|
className: "h-6 flex-1 rounded border border-slate-200 bg-transparent px-1.5 text-[11.5px] outline-none dark:border-border"
|
|
1209
1226
|
}
|
|
1210
1227
|
),
|
|
1211
|
-
|
|
1228
|
+
a.trim() && /* @__PURE__ */ t(
|
|
1212
1229
|
"button",
|
|
1213
1230
|
{
|
|
1214
1231
|
type: "submit",
|
|
@@ -1222,21 +1239,21 @@ function ct({ revisionId: e }) {
|
|
|
1222
1239
|
)
|
|
1223
1240
|
] });
|
|
1224
1241
|
}
|
|
1225
|
-
function
|
|
1242
|
+
function Nt({
|
|
1226
1243
|
revisions: e,
|
|
1227
|
-
meta:
|
|
1244
|
+
meta: s
|
|
1228
1245
|
}) {
|
|
1229
|
-
const
|
|
1230
|
-
|
|
1231
|
-
if (!
|
|
1232
|
-
if (
|
|
1233
|
-
|
|
1246
|
+
const i = [...e].reverse(), [a, o] = v(!1), [d, n] = v(0);
|
|
1247
|
+
qe(() => {
|
|
1248
|
+
if (!a) return;
|
|
1249
|
+
if (d >= i.length - 1) {
|
|
1250
|
+
o(!1);
|
|
1234
1251
|
return;
|
|
1235
1252
|
}
|
|
1236
|
-
const
|
|
1237
|
-
return () => clearTimeout(
|
|
1238
|
-
}, [
|
|
1239
|
-
const
|
|
1253
|
+
const h = setTimeout(() => n((p) => p + 1), 1600);
|
|
1254
|
+
return () => clearTimeout(h);
|
|
1255
|
+
}, [a, d, i.length]);
|
|
1256
|
+
const r = i[d], m = r != null && r.delta ? Object.keys(r.delta).slice(0, 5).map((h) => y(s, h).label) : [];
|
|
1240
1257
|
return /* @__PURE__ */ l("div", { className: "rounded-md border border-slate-200 bg-slate-50/70 p-2 dark:border-border dark:bg-muted/30", children: [
|
|
1241
1258
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1242
1259
|
/* @__PURE__ */ t(
|
|
@@ -1244,10 +1261,10 @@ function mt({
|
|
|
1244
1261
|
{
|
|
1245
1262
|
type: "button",
|
|
1246
1263
|
onClick: () => {
|
|
1247
|
-
!
|
|
1264
|
+
!a && d >= i.length - 1 && n(0), o((h) => !h);
|
|
1248
1265
|
},
|
|
1249
1266
|
className: "rounded-md bg-nvr-cyan px-2.5 py-1 text-[11.5px] font-semibold text-white",
|
|
1250
|
-
children:
|
|
1267
|
+
children: a ? "Pause" : "▶ Time-lapse"
|
|
1251
1268
|
}
|
|
1252
1269
|
),
|
|
1253
1270
|
/* @__PURE__ */ t(
|
|
@@ -1255,25 +1272,25 @@ function mt({
|
|
|
1255
1272
|
{
|
|
1256
1273
|
type: "range",
|
|
1257
1274
|
min: 0,
|
|
1258
|
-
max: Math.max(0,
|
|
1259
|
-
value:
|
|
1260
|
-
onChange: (
|
|
1261
|
-
|
|
1275
|
+
max: Math.max(0, i.length - 1),
|
|
1276
|
+
value: d,
|
|
1277
|
+
onChange: (h) => {
|
|
1278
|
+
o(!1), n(Number(h.target.value));
|
|
1262
1279
|
},
|
|
1263
1280
|
className: "flex-1 accent-nvr-cyan",
|
|
1264
1281
|
"aria-label": "History position"
|
|
1265
1282
|
}
|
|
1266
1283
|
),
|
|
1267
1284
|
/* @__PURE__ */ l("span", { className: "shrink-0 tabular-nums text-[11px] text-slate-400", children: [
|
|
1268
|
-
|
|
1285
|
+
d + 1,
|
|
1269
1286
|
"/",
|
|
1270
|
-
|
|
1287
|
+
i.length
|
|
1271
1288
|
] })
|
|
1272
1289
|
] }),
|
|
1273
|
-
|
|
1274
|
-
/* @__PURE__ */ t("span", { className: "font-medium capitalize", children:
|
|
1275
|
-
|
|
1276
|
-
|
|
1290
|
+
r && /* @__PURE__ */ l("p", { className: "mt-1 text-[11.5px] text-slate-600 dark:text-slate-300", children: [
|
|
1291
|
+
/* @__PURE__ */ t("span", { className: "font-medium capitalize", children: r.action ?? "change" }),
|
|
1292
|
+
r.timestamp ? ` · ${new Date(r.timestamp).toLocaleString()}` : "",
|
|
1293
|
+
r.user_name ? ` · ${r.user_name}` : "",
|
|
1277
1294
|
m.length > 0 && /* @__PURE__ */ l("span", { className: "ml-1 text-[10.5px] text-slate-400", children: [
|
|
1278
1295
|
"changed: ",
|
|
1279
1296
|
m.join(", ")
|
|
@@ -1282,6 +1299,6 @@ function mt({
|
|
|
1282
1299
|
] });
|
|
1283
1300
|
}
|
|
1284
1301
|
export {
|
|
1285
|
-
|
|
1286
|
-
|
|
1302
|
+
It as RevisionsPanel,
|
|
1303
|
+
et as displayValue
|
|
1287
1304
|
};
|