@nivaro/react 0.3.139 → 0.3.140
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/InlineGridField.js +95 -92
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +36 -2
- package/dist/shared/components/AudienceConfirmPanel.js +19 -19
- package/dist/shared/components/BroadcastView.js +213 -211
- package/dist/shared/components/CollectionBrowserView.js +2677 -2658
- package/dist/shared/components/ConfigHistory.js +45 -45
- package/dist/shared/components/ConformanceView.js +110 -110
- package/dist/shared/components/DataTable.js +51 -51
- package/dist/shared/components/FilePreviewLightbox.js +26 -25
- package/dist/shared/components/ItemEditForm.js +3038 -3027
- package/dist/shared/components/LiveCount.js +27 -23
- package/dist/shared/components/LiveTraceView.js +62 -61
- package/dist/shared/components/PageRenderer.js +422 -410
- package/dist/shared/components/ProfileView.js +199 -199
- package/dist/shared/components/QualityRulesView.js +70 -70
- package/dist/shared/components/QueryTable.js +131 -130
- package/dist/shared/components/RecordGraph.js +98 -98
- package/dist/shared/components/RecordReadView.js +287 -288
- package/dist/shared/components/ReportView.js +1279 -1259
- package/dist/shared/components/SlaRulesView.js +73 -74
- package/dist/shared/components/WidgetSlot.js +73 -73
- package/dist/shared/components/ai/AiChart.js +36 -32
- package/dist/shared/components/ai/AiMarkdown.js +136 -129
- package/dist/shared/components/ai/TaskDo.js +87 -87
- package/dist/shared/components/ai/answer-formats.js +37 -30
- package/dist/shared/components/ai/call-log/format.js +17 -16
- package/dist/shared/components/bulk/BulkActionButtons.js +66 -66
- package/dist/shared/components/bulk/BulkFieldUpdate.js +59 -59
- package/dist/shared/components/bulk/BulkSelectionNotices.js +34 -34
- package/dist/shared/components/bulk/MessageStakeholders.js +31 -29
- package/dist/shared/components/bulk/PushBulkButtons.js +83 -82
- package/dist/shared/components/bulk/bulk-field-options.js +10 -10
- package/dist/shared/components/cbv/column-totals.js +53 -51
- package/dist/shared/components/chat/ChatAnalyticsView.js +87 -87
- package/dist/shared/components/collections-directory/CollectionsToolbar.js +18 -18
- package/dist/shared/components/command-center/announce.js +7 -6
- package/dist/shared/components/command-center/panels/AttentionPanel.js +32 -31
- package/dist/shared/components/command-center/panels/FlowPanel.js +29 -28
- package/dist/shared/components/command-center/panels/PeoplePanel.js +39 -39
- package/dist/shared/components/delegation/DelegationConsoleView.js +27 -27
- package/dist/shared/components/imports/RunDetailSheet.js +1 -1
- package/dist/shared/components/integrations/IntegrationObligationsView.js +119 -119
- package/dist/shared/components/integrations/console/EventsView.js +35 -35
- package/dist/shared/components/integrations/console/FirefightView.js +15 -14
- package/dist/shared/components/integrations/console/PartnerDetail.js +78 -78
- package/dist/shared/components/integrations/console/ReadyToSendView.js +103 -103
- package/dist/shared/components/integrations/console/SignalCard.js +67 -67
- package/dist/shared/components/item-edit/CatalogPickerField.js +536 -527
- package/dist/shared/components/item-edit/ChangesTray.js +88 -74
- package/dist/shared/components/item-edit/FilePickerField.js +123 -123
- package/dist/shared/components/item-edit/GroupSection.js +301 -292
- package/dist/shared/components/item-edit/HeaderSummaryChip.js +54 -54
- package/dist/shared/components/item-edit/InlineGridField.js +45 -36
- package/dist/shared/components/item-edit/InlineTableField.js +1167 -1153
- package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
- package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
- package/dist/shared/components/monitoring/ApiRequestLog.js +35 -35
- package/dist/shared/components/notifications/NotificationCenterView.js +268 -268
- package/dist/shared/components/ops-report/format.js +37 -36
- package/dist/shared/components/panels/ReferencedByPanel.js +21 -20
- package/dist/shared/components/panels/RevisionsPanel.js +306 -305
- package/dist/shared/components/pipeline/OwnerMatrixVersionsCard.js +12 -12
- package/dist/shared/components/pipeline/PipelineEditorView.js +483 -482
- package/dist/shared/components/pipeline/PipelineHealthCards.js +33 -32
- package/dist/shared/components/pipeline/TeamsView.js +189 -130
- package/dist/shared/components/profile/AgentsPanel.js +6 -6
- package/dist/shared/components/profile/DelegationCard.js +13 -12
- package/dist/shared/components/profile/PersonActivity.js +48 -48
- package/dist/shared/components/profile/PersonExtras.js +107 -107
- package/dist/shared/components/profile/PersonWeek.js +9 -9
- package/dist/shared/components/queue/QueueBulkBar.js +19 -18
- package/dist/shared/components/queue/QueueBulkMove.js +21 -20
- package/dist/shared/components/queue/QueueItemSheet.js +136 -131
- package/dist/shared/components/queue/QueueWorklist.js +671 -670
- package/dist/shared/components/queue/worklist-helpers.js +36 -21
- package/dist/shared/components/support/RequestList.js +121 -121
- package/dist/shared/components/support/SupportAnalytics.js +29 -29
- package/dist/shared/lib/activity-sentence.js +251 -229
- package/dist/shared/lib/format-value.js +5 -4
- package/dist/shared/lib/number-format.js +87 -0
- package/dist/shared/lib/number-kind.js +133 -0
- package/dist/shared/lib/utils.js +24 -20
- package/dist/shared/lib/watch-list.js +1 -1
- package/dist/shared/lib/widget-value-format.js +26 -12
- package/package.json +1 -1
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
import { jsxs as r, jsx as t, Fragment as ee } from "react/jsx-runtime";
|
|
2
|
-
import { useSensors as
|
|
3
|
-
import { sortableKeyboardCoordinates as
|
|
4
|
-
import { CSS as
|
|
2
|
+
import { useSensors as jt, useSensor as Ze, PointerSensor as qt, KeyboardSensor as Pt, DndContext as Et, closestCenter as It } from "@dnd-kit/core";
|
|
3
|
+
import { sortableKeyboardCoordinates as Kt, SortableContext as Vt, verticalListSortingStrategy as zt, arrayMove as Bt, useSortable as Ut } from "@dnd-kit/sortable";
|
|
4
|
+
import { CSS as Wt } from "@dnd-kit/utilities";
|
|
5
5
|
import { useQuery as le, useQueryClient as Te, useMutation as je } from "@tanstack/react-query";
|
|
6
|
-
import { Clock as qe, List as
|
|
7
|
-
import { useState as A, useEffect as _e, useRef as Be, useMemo as M, useId as
|
|
6
|
+
import { Clock as qe, List as Ht, Table2 as Jt, Sigma as Se, Download as Xe, ChevronDown as Ve, FileSpreadsheet as Qt, GitCompareArrows as ht, ArrowRight as ze, X as ut, GripVertical as xt, Zap as Ae, Search as Gt, Columns3 as Yt, ChevronsUpDown as Zt, History as Xt, ChevronRight as Pe, MessageSquare as ea, RotateCcw as bt, Check as ta, ChevronLeft as aa, Pause as ra, Play as sa, CalendarClock as na } from "lucide-react";
|
|
7
|
+
import { useState as A, useEffect as _e, useRef as Be, useMemo as M, useId as la, createContext as oa, useContext as ft } from "react";
|
|
8
8
|
import { toast as ne } from "sonner";
|
|
9
|
-
import { useNivaroClient as ce, useItemEditAuth as
|
|
10
|
-
import { o2mSentence as
|
|
9
|
+
import { useNivaroClient as ce, useItemEditAuth as ia } from "../../context.js";
|
|
10
|
+
import { o2mSentence as da, o2mTotalsText as et, activityPredicate as ca, activityWhy as ma, actorName as pa } from "../../lib/activity-sentence.js";
|
|
11
11
|
import { get as X, post as Ne } from "../../lib/commands.js";
|
|
12
12
|
import { compareValueText as Ue } from "../../lib/compare-value.js";
|
|
13
|
-
import { isEditorJsValue as We, editorJsToText as
|
|
13
|
+
import { isEditorJsValue as We, editorJsToText as ha, editorJsToHtml as ua } from "../../lib/editorjs.js";
|
|
14
14
|
import { toastError as Oe } from "../../lib/error-toast.js";
|
|
15
|
-
import { useLiveRecordQueries as
|
|
15
|
+
import { useLiveRecordQueries as gt } from "../../lib/live.js";
|
|
16
|
+
import { formatGrouped as xa } from "../../lib/number-format.js";
|
|
16
17
|
import { restoreSkippedNote as tt } from "../../lib/restore-skipped.js";
|
|
17
|
-
import { useRevisionPrefs as
|
|
18
|
-
import { cn as P, 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
|
|
18
|
+
import { useRevisionPrefs as yt, useSharedColumnSets as ba } from "../../lib/revision-prefs.js";
|
|
19
|
+
import { cn as P, formatDateTime as Y, toLocalDateString as fe, formatNumber as at, titleCase as ye } from "../../lib/utils.js";
|
|
20
|
+
import { xlsxBlob as fa } from "../../lib/xlsx-lite.js";
|
|
21
|
+
import { useActivityLabels as kt } from "../ActivityEntry.js";
|
|
22
|
+
import { AgentBadge as ga } from "../AgentBadge.js";
|
|
23
|
+
import { HScrollProxy as ya } from "../HScrollProxy.js";
|
|
24
|
+
import { RelatedItemLabel as ka } from "../item-edit/RelationCombobox.js";
|
|
25
|
+
import { UserChip as va } from "../item-edit/UserChip.js";
|
|
26
|
+
import { UserAvatar as wa } from "../UserAvatar.js";
|
|
26
27
|
import { Button as ie } from "../ui/button.js";
|
|
27
28
|
import { Checkbox as Ee } from "../ui/checkbox.js";
|
|
28
|
-
import { Command as
|
|
29
|
-
import { DropdownMenu as
|
|
30
|
-
import { Popover as
|
|
31
|
-
import { Sheet as
|
|
29
|
+
import { Command as Na, CommandInput as Ca, CommandList as Sa, CommandEmpty as _a, CommandGroup as rt, CommandItem as st } from "../ui/command.js";
|
|
30
|
+
import { DropdownMenu as $a, DropdownMenuTrigger as Ta, DropdownMenuContent as Ra, DropdownMenuItem as nt } from "../ui/dropdown-menu.js";
|
|
31
|
+
import { Popover as Fa, PopoverTrigger as Da, PopoverContent as La } from "../ui/popover.js";
|
|
32
|
+
import { Sheet as Aa, SheetTrigger as Oa, SheetContent as Ma, SheetHeader as ja, SheetTitle as qa } from "../ui/sheet.js";
|
|
32
33
|
import { Skeleton as vt } from "../ui/skeleton.js";
|
|
33
|
-
import { IntegrationActivitySection as
|
|
34
|
-
import { buildSaveRows as
|
|
35
|
-
import { inDateRange as
|
|
36
|
-
const Ie = (e) => e.id != null && (e.action === "create" || e.action === "update" || e.action === "delete" || e.action === "restore"),
|
|
34
|
+
import { IntegrationActivitySection as Pa } from "./IntegrationActivitySection.js";
|
|
35
|
+
import { buildSaveRows as wt, withLinkLabels as Nt, valueAt as Ea, sameValue as Ia, matrixColumns as Ka, STEP_FIELD as ge, rowsChanging as Va, saveActionLabel as lt, deriveOf as za, matrixCsv as Ba, recalcReason as Ua, signedAmount as Wa } from "./revision-changes.js";
|
|
36
|
+
import { inDateRange as Ha, ColumnSetsMenu as Ja, PeopleFilter as Qa, DateRangeFilter as Ga, FieldTrend as Ya } from "./revision-table-parts.js";
|
|
37
|
+
const Ie = (e) => e.id != null && (e.action === "create" || e.action === "update" || e.action === "delete" || e.action === "restore"), Za = (e) => !Ie(e), oe = (e) => {
|
|
37
38
|
var n;
|
|
38
39
|
return e.id != null ? `r${e.id}` : `e${((n = e.event) == null ? void 0 : n.history_id) ?? ""}-${e.activity ?? ""}-${e.timestamp ?? ""}`;
|
|
39
|
-
},
|
|
40
|
+
}, Xa = /* @__PURE__ */ new Set([
|
|
40
41
|
"id",
|
|
41
42
|
"created",
|
|
42
43
|
"changed",
|
|
@@ -73,7 +74,7 @@ function He(e, n) {
|
|
|
73
74
|
var l;
|
|
74
75
|
const m = /* @__PURE__ */ new Map(), o = (b) => {
|
|
75
76
|
const c = ((a == null ? void 0 : a.relations) ?? []).find(
|
|
76
|
-
(
|
|
77
|
+
(k) => k.many_collection === e && k.many_field === b && k.junction_field == null
|
|
77
78
|
);
|
|
78
79
|
return c != null && c.one_collection ? c.one_collection === "directus_users" ? "nivaro_users" : c.one_collection : null;
|
|
79
80
|
}, u = /* @__PURE__ */ new Map();
|
|
@@ -87,7 +88,7 @@ function He(e, n) {
|
|
|
87
88
|
c.field.startsWith("__") || m.set(c.field, {
|
|
88
89
|
order: b,
|
|
89
90
|
section: c.group_key ? u.get(c.group_key) ?? null : null,
|
|
90
|
-
derive:
|
|
91
|
+
derive: za(c.computed_type, c.computed_formula),
|
|
91
92
|
cmp: {
|
|
92
93
|
field: c.field,
|
|
93
94
|
type: c.type ?? null,
|
|
@@ -99,7 +100,7 @@ function He(e, n) {
|
|
|
99
100
|
// Hidden fields are machine columns (e.g. the retired "workflow_state
|
|
100
101
|
// (legacy)" a save still writes) — folded with the system fields, not
|
|
101
102
|
// listed among what a person changed (army8 b01).
|
|
102
|
-
system:
|
|
103
|
+
system: Xa.has(c.field) || c.hidden === !0,
|
|
103
104
|
// layout_assigned is only stamped when the collection HAS an active
|
|
104
105
|
// layout — absent means there's no layout to be off of.
|
|
105
106
|
onLayout: c.layout_assigned !== !1,
|
|
@@ -117,7 +118,7 @@ function F(e, n) {
|
|
|
117
118
|
onLayout: !1
|
|
118
119
|
};
|
|
119
120
|
}
|
|
120
|
-
function
|
|
121
|
+
function er({ map: e, field: n }) {
|
|
121
122
|
const i = F(e, n);
|
|
122
123
|
return /* @__PURE__ */ t(
|
|
123
124
|
"span",
|
|
@@ -129,22 +130,22 @@ function Za({ map: e, field: n }) {
|
|
|
129
130
|
}
|
|
130
131
|
);
|
|
131
132
|
}
|
|
132
|
-
const
|
|
133
|
-
function
|
|
133
|
+
const ot = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/, tr = /^\d{4}-\d{2}-\d{2}(?:T00:00:00(?:\.0+)?Z)?$/;
|
|
134
|
+
function Ct(e, n = !1) {
|
|
134
135
|
if (e == null || e === "") return "";
|
|
135
136
|
if (typeof e == "boolean") return e ? "Yes" : "No";
|
|
136
|
-
if (typeof e == "string" && (
|
|
137
|
+
if (typeof e == "string" && (tr.test(e) || n && ot.test(e)))
|
|
137
138
|
return fe(e);
|
|
138
|
-
if (typeof e == "string" &&
|
|
139
|
+
if (typeof e == "string" && ot.test(e)) {
|
|
139
140
|
const i = new Date(e);
|
|
140
|
-
if (!Number.isNaN(i.getTime())) return
|
|
141
|
+
if (!Number.isNaN(i.getTime())) return Y(i);
|
|
141
142
|
}
|
|
142
|
-
return typeof e == "object" ? JSON.stringify(e) : String(e);
|
|
143
|
+
return typeof e == "object" ? JSON.stringify(e) : typeof e == "number" && Number.isFinite(e) && !Number.isInteger(e) ? xa(e, 2) : String(e);
|
|
143
144
|
}
|
|
144
145
|
function $e(e) {
|
|
145
146
|
return e == null ? "" : typeof e == "object" ? JSON.stringify(e) : String(e);
|
|
146
147
|
}
|
|
147
|
-
function
|
|
148
|
+
function St({ collection: e, id: n }) {
|
|
148
149
|
const i = ce(), { data: a } = le({
|
|
149
150
|
queryKey: ["col-meta", e],
|
|
150
151
|
queryFn: () => i.request(X(`/collections/${e}`)).then((m) => m.data),
|
|
@@ -152,7 +153,7 @@ function Ct({ collection: e, id: n }) {
|
|
|
152
153
|
retry: !1
|
|
153
154
|
});
|
|
154
155
|
return /* @__PURE__ */ t("span", { title: `${e} #${String(n)}`, children: /* @__PURE__ */ t(
|
|
155
|
-
|
|
156
|
+
ka,
|
|
156
157
|
{
|
|
157
158
|
collection: e,
|
|
158
159
|
id: n,
|
|
@@ -160,19 +161,19 @@ function Ct({ collection: e, id: n }) {
|
|
|
160
161
|
}
|
|
161
162
|
) });
|
|
162
163
|
}
|
|
163
|
-
function
|
|
164
|
-
return We(e) ?
|
|
164
|
+
function _t(e) {
|
|
165
|
+
return We(e) ? ha(e) : Ke(e).join(" ");
|
|
165
166
|
}
|
|
166
|
-
const
|
|
167
|
+
const it = 160;
|
|
167
168
|
function Me({
|
|
168
169
|
value: e,
|
|
169
170
|
tone: n,
|
|
170
171
|
dateOnly: i
|
|
171
172
|
}) {
|
|
172
|
-
const [a, m] = A(!1), o =
|
|
173
|
+
const [a, m] = A(!1), o = Ct(e, i);
|
|
173
174
|
if (o === "")
|
|
174
175
|
return /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" });
|
|
175
|
-
const u = o.length >
|
|
176
|
+
const u = o.length > it, l = a || !u ? o : `${o.slice(0, it)}…`;
|
|
176
177
|
return /* @__PURE__ */ r("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: [
|
|
177
178
|
typeof e == "object" ? /* @__PURE__ */ t("span", { className: "font-mono text-[11px]", children: l }) : l,
|
|
178
179
|
u && /* @__PURE__ */ t(
|
|
@@ -200,7 +201,7 @@ function we(e) {
|
|
|
200
201
|
}
|
|
201
202
|
return null;
|
|
202
203
|
}
|
|
203
|
-
function
|
|
204
|
+
function ar({
|
|
204
205
|
before: e,
|
|
205
206
|
after: n
|
|
206
207
|
}) {
|
|
@@ -220,7 +221,7 @@ function er({
|
|
|
220
221
|
l !== void 0 ? /* @__PURE__ */ t("span", { className: "text-emerald-700 dark:text-emerald-400", children: m(l) }) : /* @__PURE__ */ t("span", { className: "italic text-slate-400", children: " (removed)" })
|
|
221
222
|
] }, o)) });
|
|
222
223
|
}
|
|
223
|
-
function
|
|
224
|
+
function rr({ field: e, ctl: n }) {
|
|
224
225
|
return n.confirmField === e ? /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1", "data-revert-field-confirm": e, children: [
|
|
225
226
|
/* @__PURE__ */ t("span", { className: "text-[10.5px] text-slate-500", children: "Revert?" }),
|
|
226
227
|
/* @__PURE__ */ t(
|
|
@@ -251,36 +252,36 @@ function tr({ field: e, ctl: n }) {
|
|
|
251
252
|
title: "Set the field back to this revision’s value",
|
|
252
253
|
"data-revert-field": e,
|
|
253
254
|
children: [
|
|
254
|
-
/* @__PURE__ */ t(
|
|
255
|
+
/* @__PURE__ */ t(bt, { className: "h-3 w-3" }),
|
|
255
256
|
"Revert"
|
|
256
257
|
]
|
|
257
258
|
}
|
|
258
259
|
);
|
|
259
260
|
}
|
|
260
|
-
function
|
|
261
|
+
function ke(e) {
|
|
261
262
|
return typeof e == "string" && /<[a-z][^>]*>/i.test(e) || We(e);
|
|
262
263
|
}
|
|
263
264
|
function Ke(e) {
|
|
264
|
-
return String(We(e) ?
|
|
265
|
+
return String(We(e) ? ua(e) : e ?? "").replace(/<[^>]*>/g, " ").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").split(/\s+/).filter(Boolean);
|
|
265
266
|
}
|
|
266
|
-
function
|
|
267
|
+
function sr(e, n) {
|
|
267
268
|
const a = Ke(e).slice(0, 600), m = Ke(n).slice(0, 600), o = a.length, u = m.length, l = Array.from({ length: o + 1 }, () => new Array(u + 1).fill(0));
|
|
268
269
|
for (let f = o - 1; f >= 0; f--)
|
|
269
270
|
for (let p = u - 1; p >= 0; p--)
|
|
270
271
|
l[f][p] = a[f] === m[p] ? l[f + 1][p + 1] + 1 : Math.max(l[f + 1][p], l[f][p + 1]);
|
|
271
272
|
const b = [], c = (f, p) => {
|
|
272
|
-
const
|
|
273
|
-
|
|
273
|
+
const v = b[b.length - 1];
|
|
274
|
+
v && v.type === f ? v.text += ` ${p}` : b.push({ text: p, type: f });
|
|
274
275
|
};
|
|
275
|
-
let
|
|
276
|
-
for (;
|
|
277
|
-
a[
|
|
278
|
-
for (;
|
|
276
|
+
let k = 0, g = 0;
|
|
277
|
+
for (; k < o && g < u; )
|
|
278
|
+
a[k] === m[g] ? (c("same", a[k]), k++, g++) : l[k + 1][g] >= l[k][g + 1] ? (c("del", a[k]), k++) : (c("ins", m[g]), g++);
|
|
279
|
+
for (; k < o; ) c("del", a[k++]);
|
|
279
280
|
for (; g < u; ) c("ins", m[g++]);
|
|
280
281
|
return b;
|
|
281
282
|
}
|
|
282
|
-
function
|
|
283
|
-
const i =
|
|
283
|
+
function $t({ before: e, after: n }) {
|
|
284
|
+
const i = sr(e, n);
|
|
284
285
|
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
286
|
(a, m) => a.type === "same" ? (
|
|
286
287
|
// biome-ignore lint/suspicious/noArrayIndexKey: static segment list
|
|
@@ -317,19 +318,19 @@ function _t({ before: e, after: n }) {
|
|
|
317
318
|
)
|
|
318
319
|
) });
|
|
319
320
|
}
|
|
320
|
-
const
|
|
321
|
+
const nr = {
|
|
321
322
|
added: "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-400",
|
|
322
323
|
removed: "bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-400",
|
|
323
324
|
changed: "bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-400"
|
|
324
325
|
};
|
|
325
|
-
function
|
|
326
|
+
function Tt(e, n, i) {
|
|
326
327
|
const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(n)])), m = (l) => l == null || l === "", o = a.map((l) => {
|
|
327
328
|
const b = !(l in e) || m(e[l]), c = !(l in n) || m(n[l]);
|
|
328
329
|
if (b && c) return null;
|
|
329
|
-
const
|
|
330
|
+
const k = b ? "added" : c ? "removed" : $e(e[l]) !== $e(n[l]) ? "changed" : "unchanged";
|
|
330
331
|
return {
|
|
331
332
|
field: l,
|
|
332
|
-
status:
|
|
333
|
+
status: k,
|
|
333
334
|
before: e[l],
|
|
334
335
|
after: n[l],
|
|
335
336
|
system: F(i, l).system
|
|
@@ -347,9 +348,9 @@ function de({
|
|
|
347
348
|
meta: n,
|
|
348
349
|
tone: i
|
|
349
350
|
}) {
|
|
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(
|
|
351
|
+
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(St, { collection: n.relatedCollection, id: e }) }) : ke(e) ? /* @__PURE__ */ t(Me, { value: _t(e), tone: i }) : n.cmp && typeof e != "object" && !n.dateOnly ? /* @__PURE__ */ t(Me, { value: Ue(e, n.cmp), tone: i }) : /* @__PURE__ */ t(Me, { value: e, tone: i, dateOnly: n.dateOnly });
|
|
351
352
|
}
|
|
352
|
-
function
|
|
353
|
+
function lr({
|
|
353
354
|
row: e,
|
|
354
355
|
meta: n,
|
|
355
356
|
fieldRevert: i,
|
|
@@ -357,7 +358,7 @@ function sr({
|
|
|
357
358
|
hideStatusChips: m,
|
|
358
359
|
between: o
|
|
359
360
|
}) {
|
|
360
|
-
const u = e.status === "changed" && (
|
|
361
|
+
const u = e.status === "changed" && (ke(e.before) || ke(e.after)), l = e.status === "changed" && we(e.before) && we(e.after);
|
|
361
362
|
return /* @__PURE__ */ r(
|
|
362
363
|
"div",
|
|
363
364
|
{
|
|
@@ -368,23 +369,23 @@ function sr({
|
|
|
368
369
|
"data-field-row": e.field,
|
|
369
370
|
children: [
|
|
370
371
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
371
|
-
/* @__PURE__ */ t(
|
|
372
|
+
/* @__PURE__ */ t(er, { map: n, field: e.field }),
|
|
372
373
|
e.status !== "unchanged" && !m && /* @__PURE__ */ t(
|
|
373
374
|
"span",
|
|
374
375
|
{
|
|
375
376
|
className: P(
|
|
376
377
|
"rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide",
|
|
377
|
-
|
|
378
|
+
nr[e.status]
|
|
378
379
|
),
|
|
379
380
|
children: e.status === "added" ? "set" : e.status
|
|
380
381
|
}
|
|
381
382
|
),
|
|
382
383
|
(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
384
|
// not something to put back by hand (army11 f1 design review).
|
|
384
|
-
!o && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ t(
|
|
385
|
+
!o && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ t(rr, { field: e.field, ctl: i }) })
|
|
385
386
|
] }),
|
|
386
|
-
/* @__PURE__ */ t("div", { className: "mt-1", children: u ? /* @__PURE__ */ t("div", { "data-richtext-diff": !0, children: /* @__PURE__ */ t(
|
|
387
|
-
|
|
387
|
+
/* @__PURE__ */ t("div", { className: "mt-1", children: u ? /* @__PURE__ */ t("div", { "data-richtext-diff": !0, children: /* @__PURE__ */ t($t, { before: e.before, after: e.after }) }) : l ? /* @__PURE__ */ t(
|
|
388
|
+
ar,
|
|
388
389
|
{
|
|
389
390
|
before: we(e.before),
|
|
390
391
|
after: we(e.after)
|
|
@@ -398,7 +399,7 @@ function sr({
|
|
|
398
399
|
}
|
|
399
400
|
);
|
|
400
401
|
}
|
|
401
|
-
function
|
|
402
|
+
function Rt({
|
|
402
403
|
before: e,
|
|
403
404
|
after: n,
|
|
404
405
|
meta: i,
|
|
@@ -407,16 +408,16 @@ function Tt({
|
|
|
407
408
|
hideStatusChips: o,
|
|
408
409
|
ownFields: u
|
|
409
410
|
}) {
|
|
410
|
-
const [l, b] = A(!1), c = M(() =>
|
|
411
|
-
if (
|
|
411
|
+
const [l, b] = A(!1), c = M(() => Tt(e, n, i), [e, n, i]), k = m === "changes" ? c.filter((N) => N.status !== "unchanged") : c, g = l ? k : k.filter((N) => !N.system), f = (N) => !!u && m === "changes" && !N.system && !u.has(N.field), p = g.filter(f), v = [...g.filter((N) => !f(N)), ...p], _ = p.length ? v.length - p.length : -1, y = k.length - v.length;
|
|
412
|
+
if (k.length === 0)
|
|
412
413
|
return /* @__PURE__ */ t("p", { className: "px-3 py-3 text-[12px] text-slate-400", children: m === "changes" ? "No field changes recorded." : "No snapshot data available." });
|
|
413
|
-
const L =
|
|
414
|
+
const L = v.findIndex(
|
|
414
415
|
(N) => !f(N) && !F(i, N.field).onLayout && !F(i, N.field).system
|
|
415
|
-
), q =
|
|
416
|
+
), q = v.some(
|
|
416
417
|
(N) => !f(N) && F(i, N.field).onLayout && !F(i, N.field).system
|
|
417
418
|
);
|
|
418
419
|
return /* @__PURE__ */ r("div", { className: "overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
419
|
-
|
|
420
|
+
v.map((N, h) => /* @__PURE__ */ r("div", { children: [
|
|
420
421
|
h === _ && /* @__PURE__ */ r(
|
|
421
422
|
"div",
|
|
422
423
|
{
|
|
@@ -433,7 +434,7 @@ function Tt({
|
|
|
433
434
|
/* @__PURE__ */ t("p", { className: "text-[10.5px] text-slate-400", children: "Not on the form — written automatically by rules, computed fields or integrations." })
|
|
434
435
|
] }),
|
|
435
436
|
/* @__PURE__ */ t(
|
|
436
|
-
|
|
437
|
+
lr,
|
|
437
438
|
{
|
|
438
439
|
row: N,
|
|
439
440
|
meta: i,
|
|
@@ -460,7 +461,7 @@ function Tt({
|
|
|
460
461
|
]
|
|
461
462
|
}
|
|
462
463
|
),
|
|
463
|
-
y === 0 && l &&
|
|
464
|
+
y === 0 && l && k.some((N) => N.system) && /* @__PURE__ */ t(
|
|
464
465
|
"button",
|
|
465
466
|
{
|
|
466
467
|
type: "button",
|
|
@@ -471,22 +472,22 @@ function Tt({
|
|
|
471
472
|
)
|
|
472
473
|
] });
|
|
473
474
|
}
|
|
474
|
-
const
|
|
475
|
+
const or = {
|
|
475
476
|
create: "bg-emerald-500",
|
|
476
477
|
restore: "bg-emerald-500",
|
|
477
478
|
update: "bg-nvr-cyan",
|
|
478
479
|
delete: "bg-red-500"
|
|
479
|
-
}, Je =
|
|
480
|
+
}, Je = oa(void 0);
|
|
480
481
|
function te(e, n) {
|
|
481
482
|
var i;
|
|
482
|
-
return e.actor && e.actor.kind !== "person" ?
|
|
483
|
+
return e.actor && e.actor.kind !== "person" ? pa(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
484
|
}
|
|
484
|
-
function
|
|
485
|
+
function ir(e, n, i) {
|
|
485
486
|
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
487
|
}
|
|
487
|
-
function
|
|
488
|
-
var g, f, p,
|
|
489
|
-
const i =
|
|
488
|
+
function dr({ revision: e, isLast: n }) {
|
|
489
|
+
var g, f, p, v, _;
|
|
490
|
+
const i = ft(Je), a = e.event, m = (a == null ? void 0 : a.source) === "auto" || !e.user_id && (a == null ? void 0 : a.kind) === "transition", o = !m && ((g = a == null ? void 0 : a.on_behalf_of) != null && g.name) ? a.on_behalf_of.name : null, u = !m && ((f = a == null ? void 0 : a.acting_admin) != null && f.name) ? a.acting_admin.name : null, l = u ? `${u} as ${te(e, i)}` : te(e, i), b = m ? "Automatic rule" : o ? `${l}, for ${o}` : l;
|
|
490
491
|
let c;
|
|
491
492
|
(a == null ? void 0 : a.kind) === "transition" && a.addendum ? c = /* @__PURE__ */ r(ee, { children: [
|
|
492
493
|
"moved",
|
|
@@ -533,7 +534,7 @@ function or({ revision: e, isLast: n }) {
|
|
|
533
534
|
"started the pipeline",
|
|
534
535
|
e.comment ? ` — ${e.comment.replace(/^Started pipeline\s*[—-]?\s*/i, "")}` : ""
|
|
535
536
|
] }) : (p = e.action) != null && p.startsWith("o2m-") ? c = /* @__PURE__ */ t("span", { "data-revision-o2m": !0, children: e.o2m ? /* @__PURE__ */ r(ee, { children: [
|
|
536
|
-
|
|
537
|
+
da(e.o2m),
|
|
537
538
|
et(e.o2m) ? (
|
|
538
539
|
// Which totals on this record the row's write moved (audit: who changed the
|
|
539
540
|
// requisition amount — the person who wrote the line).
|
|
@@ -558,16 +559,16 @@ function or({ revision: e, isLast: n }) {
|
|
|
558
559
|
}
|
|
559
560
|
) : null
|
|
560
561
|
] }) : `${e.action === "o2m-create" ? "added" : e.action === "o2m-delete" ? "removed" : "changed"} related rows` }) : c = /* @__PURE__ */ r(ee, { children: [
|
|
561
|
-
|
|
562
|
+
ca({ ...e, item: null }, i),
|
|
562
563
|
e.comment ? ` — ${e.comment}` : ""
|
|
563
564
|
] });
|
|
564
|
-
const
|
|
565
|
+
const k = e.timestamp ? new Date(e.timestamp).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : "—";
|
|
565
566
|
return /* @__PURE__ */ r(
|
|
566
567
|
"div",
|
|
567
568
|
{
|
|
568
569
|
className: "relative pl-9",
|
|
569
570
|
"data-revision-event": (a == null ? void 0 : a.kind) ?? e.action ?? "",
|
|
570
|
-
"data-revision-on-behalf": o ? (
|
|
571
|
+
"data-revision-on-behalf": o ? (v = a == null ? void 0 : a.on_behalf_of) == null ? void 0 : v.id : void 0,
|
|
571
572
|
"data-revision-acting-admin": u ? (_ = a == null ? void 0 : a.acting_admin) == null ? void 0 : _.id : void 0,
|
|
572
573
|
children: [
|
|
573
574
|
/* @__PURE__ */ t(
|
|
@@ -610,8 +611,8 @@ function or({ revision: e, isLast: n }) {
|
|
|
610
611
|
"span",
|
|
611
612
|
{
|
|
612
613
|
className: "shrink-0 text-[11px] tabular-nums text-slate-400",
|
|
613
|
-
title: e.timestamp ?
|
|
614
|
-
children:
|
|
614
|
+
title: e.timestamp ? Y(e.timestamp) : void 0,
|
|
615
|
+
children: k
|
|
615
616
|
}
|
|
616
617
|
)
|
|
617
618
|
] })
|
|
@@ -619,7 +620,7 @@ function or({ revision: e, isLast: n }) {
|
|
|
619
620
|
}
|
|
620
621
|
);
|
|
621
622
|
}
|
|
622
|
-
function
|
|
623
|
+
function cr({
|
|
623
624
|
revision: e,
|
|
624
625
|
previousData: n,
|
|
625
626
|
meta: i,
|
|
@@ -627,12 +628,12 @@ function ir({
|
|
|
627
628
|
inlineTableFields: m,
|
|
628
629
|
isLast: o
|
|
629
630
|
}) {
|
|
630
|
-
const u = ce(), l =
|
|
631
|
+
const u = ce(), l = ft(Je), b = ma(e).reason, [c, k] = A(!1), [g, f] = A(!1), [p, v] = A("changes"), [_, y] = A(!1), [L, q] = A(null), N = e.action === "update", h = e.action === "create" || e.action === "restore", T = e.action === "delete", S = T ? e.data ?? {} : h ? {} : n ?? {}, E = T ? {} : e.data ?? {}, { humanDelta: j, systemDelta: w } = M(() => {
|
|
631
632
|
const O = e.delta ?? {};
|
|
632
633
|
let W = 0, Q = 0;
|
|
633
634
|
for (const ae of Object.keys(O)) {
|
|
634
|
-
const
|
|
635
|
-
N && n && $e(
|
|
635
|
+
const ve = n == null ? void 0 : n[ae], Fe = (e.data ?? {})[ae];
|
|
636
|
+
N && n && $e(ve) === $e(Fe) || (F(i, ae).system ? Q++ : W++);
|
|
636
637
|
}
|
|
637
638
|
return { humanDelta: W, systemDelta: Q };
|
|
638
639
|
}, [e, n, i, N]), R = M(() => new Set(Object.keys(e.delta ?? {})), [e]), K = N || h, [z, U] = A(null), J = Te(), [ue, x] = A(null), D = je({
|
|
@@ -684,7 +685,7 @@ function ir({
|
|
|
684
685
|
{
|
|
685
686
|
className: P(
|
|
686
687
|
"absolute left-[11px] top-[18px] h-2.5 w-2.5 rounded-full ring-4 ring-white dark:ring-card",
|
|
687
|
-
|
|
688
|
+
or[e.action ?? ""] ?? "bg-slate-300"
|
|
688
689
|
),
|
|
689
690
|
"aria-hidden": !0
|
|
690
691
|
}
|
|
@@ -702,14 +703,14 @@ function ir({
|
|
|
702
703
|
"button",
|
|
703
704
|
{
|
|
704
705
|
type: "button",
|
|
705
|
-
onClick: () =>
|
|
706
|
+
onClick: () => k((O) => !O),
|
|
706
707
|
"aria-expanded": c,
|
|
707
708
|
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
709
|
children: [
|
|
709
710
|
/* @__PURE__ */ r("span", { className: "min-w-0 flex-1 truncate text-[12.5px] text-slate-700 dark:text-slate-200", children: [
|
|
710
711
|
/* @__PURE__ */ t("span", { className: "font-medium", children: te(e, l) }),
|
|
711
712
|
" ",
|
|
712
|
-
/* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children:
|
|
713
|
+
/* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: ir(e, j, w) }),
|
|
713
714
|
b && /* @__PURE__ */ r(
|
|
714
715
|
"span",
|
|
715
716
|
{
|
|
@@ -723,12 +724,12 @@ function ir({
|
|
|
723
724
|
}
|
|
724
725
|
)
|
|
725
726
|
] }),
|
|
726
|
-
/* @__PURE__ */ t(
|
|
727
|
+
/* @__PURE__ */ t(ga, { label: e.via_agent }),
|
|
727
728
|
/* @__PURE__ */ t(
|
|
728
729
|
"span",
|
|
729
730
|
{
|
|
730
731
|
className: "shrink-0 text-[11px] tabular-nums text-slate-400",
|
|
731
|
-
title: e.timestamp ?
|
|
732
|
+
title: e.timestamp ? Y(e.timestamp) : void 0,
|
|
732
733
|
children: xe
|
|
733
734
|
}
|
|
734
735
|
),
|
|
@@ -746,7 +747,7 @@ function ir({
|
|
|
746
747
|
"button",
|
|
747
748
|
{
|
|
748
749
|
type: "button",
|
|
749
|
-
onClick: () =>
|
|
750
|
+
onClick: () => v(O),
|
|
750
751
|
className: P(
|
|
751
752
|
"px-2.5 py-1 text-[11.5px] transition-colors",
|
|
752
753
|
p === O ? "bg-nvr-cyan/10 font-medium text-nvr-navy dark:text-nvr-cyan" : "text-slate-400 hover:text-slate-600 dark:hover:text-slate-300"
|
|
@@ -766,7 +767,7 @@ function ir({
|
|
|
766
767
|
_ ? "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
768
|
),
|
|
768
769
|
children: [
|
|
769
|
-
/* @__PURE__ */ t(
|
|
770
|
+
/* @__PURE__ */ t(ea, { className: "h-3 w-3" }),
|
|
770
771
|
"Notes"
|
|
771
772
|
]
|
|
772
773
|
}
|
|
@@ -804,16 +805,16 @@ function ir({
|
|
|
804
805
|
onClick: () => f(!0),
|
|
805
806
|
title: "Set the whole record back to how it looked after this save",
|
|
806
807
|
children: [
|
|
807
|
-
/* @__PURE__ */ t(
|
|
808
|
+
/* @__PURE__ */ t(bt, { className: "h-3 w-3" }),
|
|
808
809
|
"Restore this version"
|
|
809
810
|
]
|
|
810
811
|
}
|
|
811
812
|
))
|
|
812
813
|
] })
|
|
813
814
|
] }),
|
|
814
|
-
_ && /* @__PURE__ */ t(
|
|
815
|
+
_ && /* @__PURE__ */ t(xr, { revisionId: e.id ?? "" }),
|
|
815
816
|
/* @__PURE__ */ t(
|
|
816
|
-
|
|
817
|
+
Rt,
|
|
817
818
|
{
|
|
818
819
|
before: S,
|
|
819
820
|
after: E,
|
|
@@ -843,23 +844,23 @@ function ir({
|
|
|
843
844
|
] })
|
|
844
845
|
] });
|
|
845
846
|
}
|
|
846
|
-
function
|
|
847
|
+
function mr({
|
|
847
848
|
data: e,
|
|
848
849
|
history: n,
|
|
849
850
|
meta: i,
|
|
850
851
|
labels: a,
|
|
851
852
|
focusSave: m
|
|
852
853
|
}) {
|
|
853
|
-
const [o, u] = A(m ? "replay" : null), [l, b] = A(""), [c,
|
|
854
|
+
const [o, u] = A(m ? "replay" : null), [l, b] = A(""), [c, k] = A(""), g = M(() => {
|
|
854
855
|
if (!l || !c || !e) return null;
|
|
855
|
-
const p = (/* @__PURE__ */ new Date(`${l}T23:59:59`)).getTime(),
|
|
856
|
-
if (
|
|
857
|
-
const _ = (S) => e.find((E) => E.timestamp && new Date(E.timestamp).getTime() <= S) ?? null, y = _(p), L = _(
|
|
856
|
+
const p = (/* @__PURE__ */ new Date(`${l}T23:59:59`)).getTime(), v = (/* @__PURE__ */ new Date(`${c}T23:59:59`)).getTime();
|
|
857
|
+
if (v <= p) return { error: "The second date must be after the first" };
|
|
858
|
+
const _ = (S) => e.find((E) => E.timestamp && new Date(E.timestamp).getTime() <= S) ?? null, y = _(p), L = _(v);
|
|
858
859
|
if (!L) return { error: "No snapshot exists at or before the second date" };
|
|
859
860
|
const q = (y == null ? void 0 : y.data) ?? {}, N = L.data ?? {}, h = /* @__PURE__ */ new Map();
|
|
860
861
|
for (const S of [...e].reverse()) {
|
|
861
862
|
const E = S.timestamp ? new Date(S.timestamp).getTime() : 0;
|
|
862
|
-
if (!(E <= p || E >
|
|
863
|
+
if (!(E <= p || E > v || !S.delta))
|
|
863
864
|
for (const j of Object.keys(S.delta))
|
|
864
865
|
h.set(j, { name: te(S), when: S.timestamp });
|
|
865
866
|
}
|
|
@@ -880,7 +881,7 @@ function dr({
|
|
|
880
881
|
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
882
|
),
|
|
882
883
|
children: [
|
|
883
|
-
/* @__PURE__ */ t(
|
|
884
|
+
/* @__PURE__ */ t(Xt, { className: "h-3.5 w-3.5" }),
|
|
884
885
|
"Replay the record"
|
|
885
886
|
]
|
|
886
887
|
}
|
|
@@ -895,14 +896,14 @@ function dr({
|
|
|
895
896
|
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
897
|
),
|
|
897
898
|
children: [
|
|
898
|
-
/* @__PURE__ */ t(
|
|
899
|
+
/* @__PURE__ */ t(ht, { className: "h-3.5 w-3.5" }),
|
|
899
900
|
"Compare two dates"
|
|
900
901
|
]
|
|
901
902
|
}
|
|
902
903
|
)
|
|
903
904
|
] }),
|
|
904
905
|
o === "replay" && /* @__PURE__ */ t(
|
|
905
|
-
|
|
906
|
+
wr,
|
|
906
907
|
{
|
|
907
908
|
snapshots: e,
|
|
908
909
|
history: n,
|
|
@@ -931,7 +932,7 @@ function dr({
|
|
|
931
932
|
{
|
|
932
933
|
type: "date",
|
|
933
934
|
value: c,
|
|
934
|
-
onChange: (p) =>
|
|
935
|
+
onChange: (p) => k(p.target.value),
|
|
935
936
|
className: f,
|
|
936
937
|
"aria-label": "Compare to date",
|
|
937
938
|
"data-diff-to": !0
|
|
@@ -942,7 +943,7 @@ function dr({
|
|
|
942
943
|
{
|
|
943
944
|
type: "button",
|
|
944
945
|
onClick: () => {
|
|
945
|
-
b(""),
|
|
946
|
+
b(""), k("");
|
|
946
947
|
},
|
|
947
948
|
className: "text-[11px] text-slate-400 hover:text-slate-600 dark:hover:text-slate-300",
|
|
948
949
|
children: "Clear"
|
|
@@ -999,7 +1000,7 @@ function dr({
|
|
|
999
1000
|
] })
|
|
1000
1001
|
] });
|
|
1001
1002
|
}
|
|
1002
|
-
function
|
|
1003
|
+
function pr(e) {
|
|
1003
1004
|
return e ? new Date(e).toLocaleDateString([], {
|
|
1004
1005
|
weekday: "short",
|
|
1005
1006
|
month: "short",
|
|
@@ -1007,7 +1008,7 @@ function cr(e) {
|
|
|
1007
1008
|
year: "numeric"
|
|
1008
1009
|
}) : "Unknown date";
|
|
1009
1010
|
}
|
|
1010
|
-
function
|
|
1011
|
+
function Ft(e, n) {
|
|
1011
1012
|
const i = ce(), { data: a } = le({
|
|
1012
1013
|
queryKey: ["revision-link-labels", e, n],
|
|
1013
1014
|
queryFn: () => i.request(X("/revisions/link-labels", { collection: e, item: n })).then((m) => m.data),
|
|
@@ -1015,7 +1016,7 @@ function Rt(e, n) {
|
|
|
1015
1016
|
});
|
|
1016
1017
|
return a;
|
|
1017
1018
|
}
|
|
1018
|
-
function
|
|
1019
|
+
function hr({
|
|
1019
1020
|
collection: e,
|
|
1020
1021
|
item: n,
|
|
1021
1022
|
onRollback: i,
|
|
@@ -1024,37 +1025,37 @@ function mr({
|
|
|
1024
1025
|
since: o,
|
|
1025
1026
|
onShowAll: u
|
|
1026
1027
|
}) {
|
|
1027
|
-
const l = ce(), b = He(e, !0), { data: c, isLoading:
|
|
1028
|
+
const l = ce(), b = He(e, !0), { data: c, isLoading: k } = le({
|
|
1028
1029
|
queryKey: ["revisions", e, n],
|
|
1029
1030
|
queryFn: () => l.request(X("/revisions", { collection: e, item: n })).then((w) => w.data ?? []),
|
|
1030
1031
|
staleTime: 3e4
|
|
1031
|
-
}), g =
|
|
1032
|
-
() => c &&
|
|
1032
|
+
}), g = Ft(e, n), f = M(
|
|
1033
|
+
() => c && Nt(c, g),
|
|
1033
1034
|
[c, g]
|
|
1034
|
-
), p = o ? Date.parse(o) : Number.NaN,
|
|
1035
|
+
), p = o ? Date.parse(o) : Number.NaN, v = M(
|
|
1035
1036
|
() => f && Number.isFinite(p) ? f.filter((w) => w.timestamp != null && Date.parse(w.timestamp) > p) : f,
|
|
1036
1037
|
[f, p]
|
|
1037
1038
|
), _ = Te();
|
|
1038
|
-
|
|
1039
|
+
gt(e, n, [["revisions", e, n]], { client: _ });
|
|
1039
1040
|
const y = Be(null), L = M(() => {
|
|
1040
|
-
if (!
|
|
1041
|
-
const w =
|
|
1041
|
+
if (!v) return /* @__PURE__ */ new Set();
|
|
1042
|
+
const w = v.map(oe);
|
|
1042
1043
|
if (!y.current)
|
|
1043
1044
|
return y.current = new Set(w), /* @__PURE__ */ new Set();
|
|
1044
1045
|
const R = y.current;
|
|
1045
1046
|
return new Set(w.filter((K) => !R.has(K)));
|
|
1046
|
-
}, [
|
|
1047
|
-
() => (
|
|
1048
|
-
[
|
|
1049
|
-
), S =
|
|
1047
|
+
}, [v]), q = (v == null ? void 0 : v.length) ?? 0, N = v !== f, h = M(() => (f ?? []).filter(Ie), [f]), T = M(
|
|
1048
|
+
() => (v ?? []).filter((w) => w.actor && w.actor.kind !== "person").map((w) => ({ action: w.action, user: w.user_id, actor: w.actor })),
|
|
1049
|
+
[v]
|
|
1050
|
+
), S = kt(T, { enabled: T.length > 0 }), E = M(() => {
|
|
1050
1051
|
const w = [];
|
|
1051
|
-
for (const R of
|
|
1052
|
-
const K =
|
|
1052
|
+
for (const R of v ?? []) {
|
|
1053
|
+
const K = pr(R.timestamp), z = w[w.length - 1];
|
|
1053
1054
|
z && z.day === K ? z.revisions.push(R) : w.push({ day: K, revisions: [R] });
|
|
1054
1055
|
}
|
|
1055
1056
|
return w;
|
|
1056
|
-
}, [
|
|
1057
|
-
if (
|
|
1057
|
+
}, [v]);
|
|
1058
|
+
if (k)
|
|
1058
1059
|
return /* @__PURE__ */ t("div", { className: "space-y-2 pt-3", children: [1, 2, 3, 4].map((w) => /* @__PURE__ */ t(vt, { className: "h-11 rounded-md" }, w)) });
|
|
1059
1060
|
const j = N ? /* @__PURE__ */ r(
|
|
1060
1061
|
"div",
|
|
@@ -1064,12 +1065,12 @@ function mr({
|
|
|
1064
1065
|
children: [
|
|
1065
1066
|
/* @__PURE__ */ r("span", { children: [
|
|
1066
1067
|
"Showing changes since ",
|
|
1067
|
-
o ?
|
|
1068
|
+
o ? Y(o) : "",
|
|
1068
1069
|
" — ",
|
|
1069
|
-
q,
|
|
1070
|
+
at(q),
|
|
1070
1071
|
" of",
|
|
1071
1072
|
" ",
|
|
1072
|
-
(f == null ? void 0 : f.length) ?? 0
|
|
1073
|
+
at((f == null ? void 0 : f.length) ?? 0)
|
|
1073
1074
|
] }),
|
|
1074
1075
|
/* @__PURE__ */ t(
|
|
1075
1076
|
"button",
|
|
@@ -1094,7 +1095,7 @@ function mr({
|
|
|
1094
1095
|
j,
|
|
1095
1096
|
/* @__PURE__ */ r("div", { className: "space-y-3 pt-3", children: [
|
|
1096
1097
|
/* @__PURE__ */ t(
|
|
1097
|
-
|
|
1098
|
+
mr,
|
|
1098
1099
|
{
|
|
1099
1100
|
data: h,
|
|
1100
1101
|
history: f ?? [],
|
|
@@ -1106,8 +1107,8 @@ function mr({
|
|
|
1106
1107
|
/* @__PURE__ */ t("div", { children: E.map((w) => /* @__PURE__ */ r("div", { children: [
|
|
1107
1108
|
/* @__PURE__ */ t("div", { className: "sticky top-0 z-10 -mx-6 border-b border-slate-100 bg-white px-6 py-1.5 dark:border-border/60 dark:bg-card", children: /* @__PURE__ */ t("span", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: w.day }) }),
|
|
1108
1109
|
w.revisions.map((R) => {
|
|
1109
|
-
const z = (
|
|
1110
|
-
if (
|
|
1110
|
+
const z = (v ?? []).indexOf(R) === ((v == null ? void 0 : v.length) ?? 1) - 1;
|
|
1111
|
+
if (Za(R))
|
|
1111
1112
|
return /* @__PURE__ */ r(
|
|
1112
1113
|
"div",
|
|
1113
1114
|
{
|
|
@@ -1116,8 +1117,8 @@ function mr({
|
|
|
1116
1117
|
L.has(oe(R)) && "rounded-md bg-nvr-cyan/[0.06]"
|
|
1117
1118
|
),
|
|
1118
1119
|
children: [
|
|
1119
|
-
L.has(oe(R)) && /* @__PURE__ */ t(
|
|
1120
|
-
/* @__PURE__ */ t(
|
|
1120
|
+
L.has(oe(R)) && /* @__PURE__ */ t(dt, {}),
|
|
1121
|
+
/* @__PURE__ */ t(dr, { revision: R, isLast: z })
|
|
1121
1122
|
]
|
|
1122
1123
|
},
|
|
1123
1124
|
oe(R)
|
|
@@ -1131,9 +1132,9 @@ function mr({
|
|
|
1131
1132
|
L.has(oe(R)) && "rounded-md bg-nvr-cyan/[0.06]"
|
|
1132
1133
|
),
|
|
1133
1134
|
children: [
|
|
1134
|
-
L.has(oe(R)) && /* @__PURE__ */ t(
|
|
1135
|
+
L.has(oe(R)) && /* @__PURE__ */ t(dt, {}),
|
|
1135
1136
|
/* @__PURE__ */ t(
|
|
1136
|
-
|
|
1137
|
+
cr,
|
|
1137
1138
|
{
|
|
1138
1139
|
revision: R,
|
|
1139
1140
|
previousData: (J == null ? void 0 : J.data) ?? null,
|
|
@@ -1152,7 +1153,7 @@ function mr({
|
|
|
1152
1153
|
] })
|
|
1153
1154
|
] });
|
|
1154
1155
|
}
|
|
1155
|
-
function
|
|
1156
|
+
function dt() {
|
|
1156
1157
|
return (
|
|
1157
1158
|
// Under the timeline dot, inside the row's 36px gutter.
|
|
1158
1159
|
/* @__PURE__ */ t(
|
|
@@ -1165,7 +1166,7 @@ function it() {
|
|
|
1165
1166
|
)
|
|
1166
1167
|
);
|
|
1167
1168
|
}
|
|
1168
|
-
function
|
|
1169
|
+
function ns({
|
|
1169
1170
|
collection: e,
|
|
1170
1171
|
item: n,
|
|
1171
1172
|
onRollback: i,
|
|
@@ -1177,7 +1178,7 @@ function as({
|
|
|
1177
1178
|
since: b,
|
|
1178
1179
|
onCloseAutoFocus: c
|
|
1179
1180
|
}) {
|
|
1180
|
-
const
|
|
1181
|
+
const k = o !== void 0, g = yt(e), [f, p] = A(() => b ? "timeline" : br()), [v, _] = A(b ?? null);
|
|
1181
1182
|
_e(() => {
|
|
1182
1183
|
b && (_(b), p("timeline"));
|
|
1183
1184
|
}, [b]);
|
|
@@ -1188,12 +1189,12 @@ function as({
|
|
|
1188
1189
|
const N = (h) => {
|
|
1189
1190
|
y.current = !0, q(null), p(h), g.setView(h);
|
|
1190
1191
|
try {
|
|
1191
|
-
localStorage.setItem(
|
|
1192
|
+
localStorage.setItem(Dt, h);
|
|
1192
1193
|
} catch {
|
|
1193
1194
|
}
|
|
1194
1195
|
};
|
|
1195
|
-
return /* @__PURE__ */ r(
|
|
1196
|
-
!
|
|
1196
|
+
return /* @__PURE__ */ r(Aa, { open: o, onOpenChange: u, children: [
|
|
1197
|
+
!k && /* @__PURE__ */ t(Oa, { asChild: !0, children: /* @__PURE__ */ r(
|
|
1197
1198
|
ie,
|
|
1198
1199
|
{
|
|
1199
1200
|
variant: l ? "ghost" : "outline",
|
|
@@ -1208,7 +1209,7 @@ function as({
|
|
|
1208
1209
|
}
|
|
1209
1210
|
) }),
|
|
1210
1211
|
/* @__PURE__ */ t(
|
|
1211
|
-
|
|
1212
|
+
Ma,
|
|
1212
1213
|
{
|
|
1213
1214
|
onCloseAutoFocus: c,
|
|
1214
1215
|
className: P(
|
|
@@ -1217,18 +1218,18 @@ function as({
|
|
|
1217
1218
|
f === "table" ? "w-[1320px]" : "w-[720px]"
|
|
1218
1219
|
),
|
|
1219
1220
|
children: /* @__PURE__ */ r("div", { className: "p-6", children: [
|
|
1220
|
-
/* @__PURE__ */ r(
|
|
1221
|
+
/* @__PURE__ */ r(ja, { children: [
|
|
1221
1222
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-2 pr-8", children: [
|
|
1222
|
-
/* @__PURE__ */ r(
|
|
1223
|
+
/* @__PURE__ */ r(qa, { className: "flex items-center gap-2 text-base", children: [
|
|
1223
1224
|
/* @__PURE__ */ t(qe, { className: "h-4 w-4 text-slate-400" }),
|
|
1224
1225
|
"Revision history"
|
|
1225
1226
|
] }),
|
|
1226
|
-
/* @__PURE__ */ t(
|
|
1227
|
+
/* @__PURE__ */ t(fr, { view: f, onChange: N })
|
|
1227
1228
|
] }),
|
|
1228
1229
|
/* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: f === "table" ? "Each save is a row and each field a column — read down a column to follow it over time, totals included." : "Who changed what, when — expand any entry to see the exact values, revert a single field, or restore the whole version." })
|
|
1229
1230
|
] }),
|
|
1230
1231
|
f === "table" ? /* @__PURE__ */ t(
|
|
1231
|
-
|
|
1232
|
+
vr,
|
|
1232
1233
|
{
|
|
1233
1234
|
collection: e,
|
|
1234
1235
|
item: n,
|
|
@@ -1237,17 +1238,17 @@ function as({
|
|
|
1237
1238
|
}
|
|
1238
1239
|
}
|
|
1239
1240
|
) : /* @__PURE__ */ r(ee, { children: [
|
|
1240
|
-
/* @__PURE__ */ t(
|
|
1241
|
-
/* @__PURE__ */ t(
|
|
1241
|
+
/* @__PURE__ */ t(ur, { collection: e, item: n }),
|
|
1242
|
+
/* @__PURE__ */ t(Pa, { collection: e, item: String(n) }),
|
|
1242
1243
|
/* @__PURE__ */ t(
|
|
1243
|
-
|
|
1244
|
+
hr,
|
|
1244
1245
|
{
|
|
1245
1246
|
collection: e,
|
|
1246
1247
|
item: n,
|
|
1247
1248
|
onRollback: i,
|
|
1248
1249
|
inlineTableFields: m,
|
|
1249
1250
|
focusSave: L,
|
|
1250
|
-
since:
|
|
1251
|
+
since: v,
|
|
1251
1252
|
onShowAll: () => _(null)
|
|
1252
1253
|
}
|
|
1253
1254
|
)
|
|
@@ -1257,22 +1258,22 @@ function as({
|
|
|
1257
1258
|
)
|
|
1258
1259
|
] });
|
|
1259
1260
|
}
|
|
1260
|
-
function
|
|
1261
|
+
function ur({ collection: e, item: n }) {
|
|
1261
1262
|
const i = ce(), a = He(e, !0), [m, o] = A(""), [u, l] = A(""), { data: b, isFetching: c } = le({
|
|
1262
1263
|
queryKey: ["rev-value-search", e, n, u],
|
|
1263
|
-
queryFn: () => i.request(X("/revisions/value-search", { collection: e, item: n, q: u })).then((
|
|
1264
|
+
queryFn: () => i.request(X("/revisions/value-search", { collection: e, item: n, q: u })).then((k) => k.data),
|
|
1264
1265
|
enabled: u.length >= 2
|
|
1265
1266
|
});
|
|
1266
1267
|
return /* @__PURE__ */ r("div", { className: "mt-3", children: [
|
|
1267
1268
|
/* @__PURE__ */ r("div", { className: "relative", children: [
|
|
1268
|
-
/* @__PURE__ */ t(
|
|
1269
|
+
/* @__PURE__ */ t(Gt, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
1269
1270
|
/* @__PURE__ */ t(
|
|
1270
1271
|
"input",
|
|
1271
1272
|
{
|
|
1272
1273
|
value: m,
|
|
1273
|
-
onChange: (
|
|
1274
|
-
onKeyDown: (
|
|
1275
|
-
|
|
1274
|
+
onChange: (k) => o(k.target.value),
|
|
1275
|
+
onKeyDown: (k) => {
|
|
1276
|
+
k.key === "Enter" && l(m.trim());
|
|
1276
1277
|
},
|
|
1277
1278
|
placeholder: "Search this record’s history for a value — who wrote it, and when",
|
|
1278
1279
|
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"
|
|
@@ -1287,7 +1288,7 @@ function pr({ collection: e, item: n }) {
|
|
|
1287
1288
|
},
|
|
1288
1289
|
className: "absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",
|
|
1289
1290
|
"aria-label": "Clear search",
|
|
1290
|
-
children: /* @__PURE__ */ t(
|
|
1291
|
+
children: /* @__PURE__ */ t(ut, { className: "h-3.5 w-3.5" })
|
|
1291
1292
|
}
|
|
1292
1293
|
)
|
|
1293
1294
|
] }),
|
|
@@ -1296,8 +1297,8 @@ function pr({ collection: e, item: n }) {
|
|
|
1296
1297
|
u,
|
|
1297
1298
|
"” never appears in this record’s recorded changes."
|
|
1298
1299
|
] }) : /* @__PURE__ */ r(ee, { children: [
|
|
1299
|
-
b == null ? void 0 : b.matches.map((
|
|
1300
|
-
/* @__PURE__ */ t("p", { className: "text-slate-600 dark:text-slate-300", children:
|
|
1300
|
+
b == null ? void 0 : b.matches.map((k) => /* @__PURE__ */ r("div", { className: "text-[11.5px]", children: [
|
|
1301
|
+
/* @__PURE__ */ t("p", { className: "text-slate-600 dark:text-slate-300", children: k.fields.map((g) => /* @__PURE__ */ r("span", { children: [
|
|
1301
1302
|
/* @__PURE__ */ t("span", { className: "font-medium", title: g.field, children: F(a, g.field).label }),
|
|
1302
1303
|
" ",
|
|
1303
1304
|
"→ “",
|
|
@@ -1306,19 +1307,19 @@ function pr({ collection: e, item: n }) {
|
|
|
1306
1307
|
" "
|
|
1307
1308
|
] }, g.field)) }),
|
|
1308
1309
|
/* @__PURE__ */ r("p", { className: "text-[10.5px] text-slate-400", children: [
|
|
1309
|
-
|
|
1310
|
+
k.user_name ?? "System",
|
|
1310
1311
|
" · ",
|
|
1311
|
-
|
|
1312
|
+
k.timestamp ? Y(k.timestamp) : "",
|
|
1312
1313
|
" ·",
|
|
1313
1314
|
" ",
|
|
1314
|
-
|
|
1315
|
+
k.action
|
|
1315
1316
|
] })
|
|
1316
|
-
] },
|
|
1317
|
+
] }, k.revision_id)),
|
|
1317
1318
|
(b == null ? void 0 : b.truncated) && /* @__PURE__ */ t("p", { className: "text-[10.5px] text-amber-600", children: "Showing the newest 200 matches." })
|
|
1318
1319
|
] }) })
|
|
1319
1320
|
] });
|
|
1320
1321
|
}
|
|
1321
|
-
function
|
|
1322
|
+
function xr({ revisionId: e }) {
|
|
1322
1323
|
const n = ce(), i = Te(), [a, m] = A(""), { data: o = [] } = le({
|
|
1323
1324
|
queryKey: ["revision-notes", String(e)],
|
|
1324
1325
|
queryFn: () => n.request(X("/comments", { collection: "nivaro_revisions", item: String(e) })).then((l) => l.data ?? []).catch(() => []),
|
|
@@ -1380,7 +1381,7 @@ function Re({
|
|
|
1380
1381
|
size: i = "md"
|
|
1381
1382
|
}) {
|
|
1382
1383
|
const a = i === "sm" ? "h-5 w-5 text-[9px]" : "h-6 w-6 text-[10px]", m = n.split(" ").map((u) => u[0]).filter(Boolean).slice(0, 2).join("").toUpperCase() || "·", o = /* @__PURE__ */ t(
|
|
1383
|
-
|
|
1384
|
+
wa,
|
|
1384
1385
|
{
|
|
1385
1386
|
userId: e,
|
|
1386
1387
|
className: a,
|
|
@@ -1396,7 +1397,7 @@ function Re({
|
|
|
1396
1397
|
)
|
|
1397
1398
|
}
|
|
1398
1399
|
);
|
|
1399
|
-
return e ? /* @__PURE__ */ t(
|
|
1400
|
+
return e ? /* @__PURE__ */ t(va, { userId: e, children: /* @__PURE__ */ t(
|
|
1400
1401
|
"button",
|
|
1401
1402
|
{
|
|
1402
1403
|
type: "button",
|
|
@@ -1408,15 +1409,15 @@ function Re({
|
|
|
1408
1409
|
}
|
|
1409
1410
|
) }) : /* @__PURE__ */ t("span", { className: "shrink-0", children: o });
|
|
1410
1411
|
}
|
|
1411
|
-
const
|
|
1412
|
-
function
|
|
1412
|
+
const Dt = "nvr:revisions-view";
|
|
1413
|
+
function br() {
|
|
1413
1414
|
try {
|
|
1414
|
-
return localStorage.getItem(
|
|
1415
|
+
return localStorage.getItem(Dt) === "table" ? "table" : "timeline";
|
|
1415
1416
|
} catch {
|
|
1416
1417
|
return "timeline";
|
|
1417
1418
|
}
|
|
1418
1419
|
}
|
|
1419
|
-
function
|
|
1420
|
+
function fr({
|
|
1420
1421
|
view: e,
|
|
1421
1422
|
onChange: n
|
|
1422
1423
|
}) {
|
|
@@ -1427,8 +1428,8 @@ function xr({
|
|
|
1427
1428
|
"data-revision-view-switch": !0,
|
|
1428
1429
|
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",
|
|
1429
1430
|
children: [
|
|
1430
|
-
{ v: "timeline", label: "Timeline", icon:
|
|
1431
|
-
{ v: "table", label: "Table", icon:
|
|
1431
|
+
{ v: "timeline", label: "Timeline", icon: Ht },
|
|
1432
|
+
{ v: "table", label: "Table", icon: Jt }
|
|
1432
1433
|
].map(({ v: a, label: m, icon: o }) => {
|
|
1433
1434
|
const u = e === a;
|
|
1434
1435
|
return /* @__PURE__ */ r(
|
|
@@ -1453,38 +1454,38 @@ function xr({
|
|
|
1453
1454
|
);
|
|
1454
1455
|
}
|
|
1455
1456
|
function be(e, n) {
|
|
1456
|
-
return e == null || e === "" ? "" :
|
|
1457
|
+
return e == null || e === "" ? "" : ke(e) ? _t(e) : n.cmp && typeof e != "object" && !n.dateOnly ? Ue(e, n.cmp) : Ct(e, n.dateOnly);
|
|
1457
1458
|
}
|
|
1458
1459
|
function Ce(e, n, i) {
|
|
1459
1460
|
const a = F(i, e);
|
|
1460
|
-
return
|
|
1461
|
+
return Ua(
|
|
1461
1462
|
e,
|
|
1462
1463
|
n,
|
|
1463
1464
|
a.derive ?? null,
|
|
1464
1465
|
(m, o) => m == null ? F(i, o ?? "").label : o ? ye(o.replace(/_/g, " ")) : ye(m.replace(/_/g, " ")),
|
|
1465
|
-
(m) =>
|
|
1466
|
+
(m) => gr(m, a)
|
|
1466
1467
|
);
|
|
1467
1468
|
}
|
|
1468
|
-
const
|
|
1469
|
-
function
|
|
1470
|
-
if (!n.cmp) return
|
|
1469
|
+
const ct = (e) => e == null || e === "", mt = (e) => ke(e) || typeof e == "string" && e.length > 60;
|
|
1470
|
+
function gr(e, n) {
|
|
1471
|
+
if (!n.cmp) return Wa(e);
|
|
1471
1472
|
const i = Ue(Math.abs(e), n.cmp);
|
|
1472
1473
|
return `${e > 0 ? "+" : e < 0 ? "−" : ""}${i}`;
|
|
1473
1474
|
}
|
|
1474
|
-
function
|
|
1475
|
+
function yr({
|
|
1475
1476
|
field: e,
|
|
1476
1477
|
label: n,
|
|
1477
1478
|
tag: i,
|
|
1478
1479
|
onRemove: a
|
|
1479
1480
|
}) {
|
|
1480
|
-
const { attributes: m, listeners: o, setNodeRef: u, transform: l, transition: b, isDragging: c } =
|
|
1481
|
+
const { attributes: m, listeners: o, setNodeRef: u, transform: l, transition: b, isDragging: c } = Ut({
|
|
1481
1482
|
id: e
|
|
1482
1483
|
});
|
|
1483
1484
|
return /* @__PURE__ */ r(
|
|
1484
1485
|
"div",
|
|
1485
1486
|
{
|
|
1486
1487
|
ref: u,
|
|
1487
|
-
style: { transform:
|
|
1488
|
+
style: { transform: Wt.Transform.toString(l), transition: b },
|
|
1488
1489
|
"data-shown-field": e,
|
|
1489
1490
|
className: P(
|
|
1490
1491
|
"flex items-center gap-2 rounded-sm px-2 py-1.5 text-[12px] hover:bg-slate-50 dark:hover:bg-muted/60",
|
|
@@ -1499,11 +1500,11 @@ function fr({
|
|
|
1499
1500
|
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",
|
|
1500
1501
|
...m,
|
|
1501
1502
|
...o,
|
|
1502
|
-
onKeyDown: (
|
|
1503
|
+
onKeyDown: (k) => {
|
|
1503
1504
|
var g;
|
|
1504
|
-
|
|
1505
|
+
k.stopPropagation(), (g = o == null ? void 0 : o.onKeyDown) == null || g.call(o, k);
|
|
1505
1506
|
},
|
|
1506
|
-
children: /* @__PURE__ */ t(
|
|
1507
|
+
children: /* @__PURE__ */ t(xt, { className: "h-3.5 w-3.5" })
|
|
1507
1508
|
}
|
|
1508
1509
|
),
|
|
1509
1510
|
/* @__PURE__ */ t(
|
|
@@ -1521,7 +1522,7 @@ function fr({
|
|
|
1521
1522
|
}
|
|
1522
1523
|
);
|
|
1523
1524
|
}
|
|
1524
|
-
function
|
|
1525
|
+
function kr({
|
|
1525
1526
|
columns: e,
|
|
1526
1527
|
meta: n,
|
|
1527
1528
|
order: i,
|
|
@@ -1531,13 +1532,13 @@ function gr({
|
|
|
1531
1532
|
onChange: u,
|
|
1532
1533
|
onReset: l
|
|
1533
1534
|
}) {
|
|
1534
|
-
const [b, c] = A(!1), [
|
|
1535
|
-
Ze(
|
|
1536
|
-
Ze(
|
|
1535
|
+
const [b, c] = A(!1), [k, g] = A(""), f = M(() => new Map(e.map((h) => [h.field, h])), [e]), p = i.filter((h) => f.has(h)), v = jt(
|
|
1536
|
+
Ze(qt, { activationConstraint: { distance: 4 } }),
|
|
1537
|
+
Ze(Pt, { coordinateGetter: Kt })
|
|
1537
1538
|
), _ = (h) => {
|
|
1538
1539
|
const T = p.indexOf(String(h.active.id)), S = h.over ? p.indexOf(String(h.over.id)) : -1;
|
|
1539
1540
|
if (T < 0 || S < 0 || T === S) return;
|
|
1540
|
-
const E =
|
|
1541
|
+
const E = Bt(p, T, S);
|
|
1541
1542
|
let j = 0;
|
|
1542
1543
|
u(i.map((w) => f.has(w) ? E[j++] : w));
|
|
1543
1544
|
}, y = (h) => u(a.has(h) ? i.filter((T) => T !== h) : [...i, h]), L = M(() => {
|
|
@@ -1572,7 +1573,7 @@ function gr({
|
|
|
1572
1573
|
"flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-sm border",
|
|
1573
1574
|
h ? "border-nvr-cyan bg-nvr-cyan text-white" : "border-slate-300 dark:border-slate-600"
|
|
1574
1575
|
),
|
|
1575
|
-
children: h && /* @__PURE__ */ t(
|
|
1576
|
+
children: h && /* @__PURE__ */ t(ta, { className: "h-3 w-3" })
|
|
1576
1577
|
}
|
|
1577
1578
|
), N = (h) => /* @__PURE__ */ r("span", { className: "ml-auto flex shrink-0 items-center gap-1.5 text-[11px] text-slate-400", children: [
|
|
1578
1579
|
F(n, h.field).derive && /* @__PURE__ */ t(Se, { className: "h-3 w-3", "aria-label": "Calculated" }),
|
|
@@ -1581,8 +1582,8 @@ function gr({
|
|
|
1581
1582
|
"×"
|
|
1582
1583
|
] })
|
|
1583
1584
|
] });
|
|
1584
|
-
return /* @__PURE__ */ r(
|
|
1585
|
-
/* @__PURE__ */ t(
|
|
1585
|
+
return /* @__PURE__ */ r(Fa, { open: b, onOpenChange: c, children: [
|
|
1586
|
+
/* @__PURE__ */ t(Da, { asChild: !0, children: /* @__PURE__ */ r(
|
|
1586
1587
|
"button",
|
|
1587
1588
|
{
|
|
1588
1589
|
type: "button",
|
|
@@ -1598,17 +1599,17 @@ function gr({
|
|
|
1598
1599
|
e.length
|
|
1599
1600
|
] })
|
|
1600
1601
|
] }),
|
|
1601
|
-
/* @__PURE__ */ t(
|
|
1602
|
+
/* @__PURE__ */ t(Zt, { className: "h-3.5 w-3.5 text-slate-400" })
|
|
1602
1603
|
]
|
|
1603
1604
|
}
|
|
1604
1605
|
) }),
|
|
1605
|
-
/* @__PURE__ */ t(
|
|
1606
|
+
/* @__PURE__ */ t(La, { align: "start", className: "w-[380px] p-0", children: /* @__PURE__ */ r(Na, { children: [
|
|
1606
1607
|
/* @__PURE__ */ t(
|
|
1607
|
-
|
|
1608
|
+
Ca,
|
|
1608
1609
|
{
|
|
1609
1610
|
placeholder: "Find a field…",
|
|
1610
1611
|
className: "text-[12px]",
|
|
1611
|
-
value:
|
|
1612
|
+
value: k,
|
|
1612
1613
|
onValueChange: g
|
|
1613
1614
|
}
|
|
1614
1615
|
),
|
|
@@ -1651,20 +1652,20 @@ function gr({
|
|
|
1651
1652
|
}
|
|
1652
1653
|
)
|
|
1653
1654
|
] }),
|
|
1654
|
-
/* @__PURE__ */ r(
|
|
1655
|
-
/* @__PURE__ */ t(
|
|
1656
|
-
p.length > 0 && !
|
|
1655
|
+
/* @__PURE__ */ r(Sa, { className: "max-h-[420px]", children: [
|
|
1656
|
+
/* @__PURE__ */ t(_a, { children: "No field by that name." }),
|
|
1657
|
+
p.length > 0 && !k.trim() && /* @__PURE__ */ r("div", { className: "px-1 pb-1", "data-shown-columns": !0, children: [
|
|
1657
1658
|
/* @__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" }),
|
|
1658
1659
|
/* @__PURE__ */ t(
|
|
1659
|
-
|
|
1660
|
+
Et,
|
|
1660
1661
|
{
|
|
1661
|
-
sensors:
|
|
1662
|
-
collisionDetection:
|
|
1662
|
+
sensors: v,
|
|
1663
|
+
collisionDetection: It,
|
|
1663
1664
|
onDragEnd: _,
|
|
1664
|
-
children: /* @__PURE__ */ t(
|
|
1665
|
+
children: /* @__PURE__ */ t(Vt, { items: p, strategy: zt, children: p.map((h) => {
|
|
1665
1666
|
const T = f.get(h);
|
|
1666
1667
|
return /* @__PURE__ */ t(
|
|
1667
|
-
|
|
1668
|
+
yr,
|
|
1668
1669
|
{
|
|
1669
1670
|
field: h,
|
|
1670
1671
|
label: T.label,
|
|
@@ -1677,10 +1678,10 @@ function gr({
|
|
|
1677
1678
|
}
|
|
1678
1679
|
)
|
|
1679
1680
|
] }),
|
|
1680
|
-
p.length > 0 &&
|
|
1681
|
+
p.length > 0 && k.trim() !== "" && /* @__PURE__ */ t(rt, { heading: "Shown", children: p.map((h) => {
|
|
1681
1682
|
const T = f.get(h);
|
|
1682
1683
|
return /* @__PURE__ */ r(
|
|
1683
|
-
|
|
1684
|
+
st,
|
|
1684
1685
|
{
|
|
1685
1686
|
value: `${T.label} ${h} shown`,
|
|
1686
1687
|
onSelect: () => y(h),
|
|
@@ -1694,8 +1695,8 @@ function gr({
|
|
|
1694
1695
|
`shown-${h}`
|
|
1695
1696
|
);
|
|
1696
1697
|
}) }),
|
|
1697
|
-
L.map((h) => /* @__PURE__ */ t(
|
|
1698
|
-
|
|
1698
|
+
L.map((h) => /* @__PURE__ */ t(rt, { heading: h.label, children: h.items.map((T) => /* @__PURE__ */ r(
|
|
1699
|
+
st,
|
|
1699
1700
|
{
|
|
1700
1701
|
value: `${T.label} ${T.field} ${h.label}`,
|
|
1701
1702
|
onSelect: () => y(T.field),
|
|
@@ -1713,35 +1714,35 @@ function gr({
|
|
|
1713
1714
|
] }) })
|
|
1714
1715
|
] });
|
|
1715
1716
|
}
|
|
1716
|
-
const
|
|
1717
|
+
const pt = {
|
|
1717
1718
|
created: "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",
|
|
1718
1719
|
changed: "bg-slate-100 text-slate-600 dark:bg-muted dark:text-slate-300",
|
|
1719
1720
|
deleted: "bg-red-50 text-red-700 dark:bg-red-500/10 dark:text-red-300",
|
|
1720
1721
|
restored: "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",
|
|
1721
1722
|
moved: "bg-violet-50 text-violet-700 dark:bg-violet-500/10 dark:text-violet-300"
|
|
1722
1723
|
};
|
|
1723
|
-
function
|
|
1724
|
+
function vr({
|
|
1724
1725
|
collection: e,
|
|
1725
1726
|
item: n,
|
|
1726
1727
|
onOpenSave: i
|
|
1727
1728
|
}) {
|
|
1728
|
-
var
|
|
1729
|
+
var Ge, Ye;
|
|
1729
1730
|
const a = ce(), m = He(e, !0), { data: o, isLoading: u } = le({
|
|
1730
1731
|
queryKey: ["revisions", e, n],
|
|
1731
1732
|
queryFn: () => a.request(X("/revisions", { collection: e, item: n })).then((s) => s.data ?? []),
|
|
1732
1733
|
staleTime: 3e4
|
|
1733
1734
|
}), l = Te();
|
|
1734
|
-
|
|
1735
|
+
gt(e, n, [["revisions", e, n]], { client: l });
|
|
1735
1736
|
const b = M(
|
|
1736
1737
|
() => (o ?? []).filter((s) => s.actor && s.actor.kind !== "person").map((s) => ({ action: s.action, user: s.user_id, actor: s.actor })),
|
|
1737
1738
|
[o]
|
|
1738
|
-
), c =
|
|
1739
|
-
() =>
|
|
1739
|
+
), c = kt(b, { enabled: b.length > 0 }), k = Ft(e, n), g = M(
|
|
1740
|
+
() => wt(Nt(o ?? [], k), {
|
|
1740
1741
|
name: (s) => te(s, c),
|
|
1741
1742
|
// Pipeline moves are rows of their own while the Pipeline step column is shown.
|
|
1742
1743
|
withMoves: !0
|
|
1743
1744
|
}),
|
|
1744
|
-
[o, c,
|
|
1745
|
+
[o, c, k]
|
|
1745
1746
|
), { data: f } = le({
|
|
1746
1747
|
queryKey: ["revision-child-columns", e, n],
|
|
1747
1748
|
queryFn: () => a.request(X("/revisions/child-columns", { collection: e, item: n })).then((s) => s.data),
|
|
@@ -1757,52 +1758,52 @@ function yr({
|
|
|
1757
1758
|
section: { key: `child:${d.collection}`, label: d.collection_label, sort: 1e5 }
|
|
1758
1759
|
});
|
|
1759
1760
|
return s;
|
|
1760
|
-
}, [m, f]),
|
|
1761
|
+
}, [m, f]), v = M(() => {
|
|
1761
1762
|
const s = (f == null ? void 0 : f.columns) ?? [];
|
|
1762
1763
|
if (!s.length) return g;
|
|
1763
1764
|
const d = g.map((C) => ({ ...C, values: { ...C.values }, changed: new Set(C.changed) }));
|
|
1764
1765
|
for (const C of s) {
|
|
1765
1766
|
const $ = (f == null ? void 0 : f.series[C.key]) ?? [];
|
|
1766
|
-
for (const B of d) B.values[C.key] =
|
|
1767
|
+
for (const B of d) B.values[C.key] = Ea($, B.timestamp);
|
|
1767
1768
|
for (let B = 0; B < d.length - 1; B++)
|
|
1768
|
-
|
|
1769
|
+
Ia(d[B].values[C.key], d[B + 1].values[C.key]) || d[B].changed.add(C.key);
|
|
1769
1770
|
}
|
|
1770
1771
|
return d;
|
|
1771
1772
|
}, [g, f]), _ = M(
|
|
1772
|
-
() =>
|
|
1773
|
-
[
|
|
1774
|
-
), y =
|
|
1773
|
+
() => Ka(v, (s) => F(p, s)),
|
|
1774
|
+
[v, p]
|
|
1775
|
+
), y = yt(e), L = ba(e), { isAdmin: q } = ia(), N = M(
|
|
1775
1776
|
() => _.filter((s) => s.changes > 0 && !s.field.startsWith("child:")).map((s) => s.field),
|
|
1776
1777
|
[_]
|
|
1777
|
-
), h = y.columns ?? ((
|
|
1778
|
+
), h = y.columns ?? ((Ge = L.roleDefault) == null ? void 0 : Ge.fields) ?? N, T = M(() => new Set(h), [h]), S = M(() => {
|
|
1778
1779
|
const s = new Map(_.map((d) => [d.field, d]));
|
|
1779
1780
|
return h.map((d) => s.get(d)).filter((d) => !!d);
|
|
1780
1781
|
}, [h, _]), E = (s) => y.setColumns([...new Set(s)]), [j, w] = A(null), [R, K] = A(null), z = (s, d) => {
|
|
1781
1782
|
if (s === d) return;
|
|
1782
1783
|
const C = h.filter((B) => B !== s), $ = C.indexOf(d);
|
|
1783
1784
|
E($ < 0 ? [...C, s] : [...C.slice(0, $), s, ...C.slice($)]);
|
|
1784
|
-
}, U = Be(null), [J, ue] = A(!0), x =
|
|
1785
|
+
}, U = Be(null), [J, ue] = A(!0), x = la(), [D, Z] = A(""), [V, me] = A(""), [xe, O] = A(/* @__PURE__ */ new Set()), W = M(() => {
|
|
1785
1786
|
const s = /* @__PURE__ */ new Map();
|
|
1786
|
-
for (const d of
|
|
1787
|
+
for (const d of v) s.set(d.who, (s.get(d.who) ?? 0) + 1);
|
|
1787
1788
|
return [...s].map(([d, C]) => ({ name: d, count: C })).sort((d, C) => C.count - d.count);
|
|
1788
|
-
}, [
|
|
1789
|
-
let s = T.has(ge) ?
|
|
1789
|
+
}, [v]), Q = M(() => {
|
|
1790
|
+
let s = T.has(ge) ? v : v.filter((d) => d.action !== "moved");
|
|
1790
1791
|
return s = s.filter(
|
|
1791
|
-
(d) =>
|
|
1792
|
-
), J ?
|
|
1792
|
+
(d) => Ha(d.timestamp, D, V) && (xe.size === 0 || xe.has(d.who))
|
|
1793
|
+
), J ? Va(
|
|
1793
1794
|
s,
|
|
1794
1795
|
S.map((d) => d.field)
|
|
1795
1796
|
) : s;
|
|
1796
|
-
}, [
|
|
1797
|
+
}, [v, S, T, J, D, V, xe]), [ae, ve] = A([]), Fe = (s) => ve((d) => d.includes(s) ? d.filter((C) => C !== s) : [...d, s].slice(-2)), re = M(() => {
|
|
1797
1798
|
if (ae.length !== 2) return null;
|
|
1798
|
-
const s = ae.map((C) =>
|
|
1799
|
+
const s = ae.map((C) => v.find(($) => $.key === C)).filter((C) => !!C);
|
|
1799
1800
|
if (s.length !== 2) return null;
|
|
1800
1801
|
const d = (C) => C.timestamp ? new Date(C.timestamp).getTime() : 0;
|
|
1801
1802
|
return s.sort((C, $) => d(C) - d($));
|
|
1802
|
-
}, [ae,
|
|
1803
|
+
}, [ae, v]), [se, Qe] = A(null), De = M(() => {
|
|
1803
1804
|
var C;
|
|
1804
1805
|
if (!se) return null;
|
|
1805
|
-
const s = F(p, se), d = [...
|
|
1806
|
+
const s = F(p, se), d = [...v].filter(($) => se === ge ? !0 : $.action !== "moved").reverse();
|
|
1806
1807
|
return {
|
|
1807
1808
|
label: ((C = S.find(($) => $.field === se)) == null ? void 0 : C.label) ?? s.label,
|
|
1808
1809
|
points: d.map(($) => ({
|
|
@@ -1811,39 +1812,39 @@ function yr({
|
|
|
1811
1812
|
text: be($.values[se], s)
|
|
1812
1813
|
}))
|
|
1813
1814
|
};
|
|
1814
|
-
}, [se,
|
|
1815
|
+
}, [se, v, p, S]), { data: Lt } = le({
|
|
1815
1816
|
queryKey: ["revision-sets-roles"],
|
|
1816
1817
|
queryFn: () => a.request(X("/roles")).then((s) => (s.data ?? []).map((d) => ({ id: String(d.id), name: String(d.name) }))),
|
|
1817
1818
|
enabled: q,
|
|
1818
1819
|
staleTime: 3e5
|
|
1819
|
-
}), Le = (s) => s.action === "moved" && !s.userId ? `Automatic${s.trigger ? ` (after ${s.trigger.name})` : ""}` : s.who,
|
|
1820
|
+
}), Le = (s) => s.action === "moved" && !s.userId ? `Automatic${s.trigger ? ` (after ${s.trigger.name})` : ""}` : s.who, At = () => {
|
|
1820
1821
|
const d = [["When", "Changed by", "Action", ...S.map((I) => I.label)].map((I) => ({ v: I, style: "header" }))], C = [
|
|
1821
1822
|
["When", "Field", "Value", "Moved by", "Why"].map((I) => ({ v: I, style: "header" }))
|
|
1822
1823
|
];
|
|
1823
1824
|
for (const I of Q) {
|
|
1824
|
-
const pe = I.timestamp ?
|
|
1825
|
+
const pe = I.timestamp ? Y(I.timestamp) : "";
|
|
1825
1826
|
d.push([
|
|
1826
1827
|
{ v: pe },
|
|
1827
1828
|
{ v: Le(I) },
|
|
1828
|
-
{ v:
|
|
1829
|
-
...S.map((
|
|
1830
|
-
const he = be(I.values[
|
|
1831
|
-
return { v: he, style:
|
|
1829
|
+
{ v: lt(I.action), style: "muted" },
|
|
1830
|
+
...S.map((G) => {
|
|
1831
|
+
const he = be(I.values[G.field], F(p, G.field)), Mt = I.recalculated.has(G.field) ? "recalculated" : I.changed.has(G.field) ? "changed" : "plain";
|
|
1832
|
+
return { v: he, style: Mt };
|
|
1832
1833
|
})
|
|
1833
1834
|
]);
|
|
1834
|
-
for (const
|
|
1835
|
-
if (!I.recalculated.has(
|
|
1836
|
-
const he = Ce(
|
|
1835
|
+
for (const G of S) {
|
|
1836
|
+
if (!I.recalculated.has(G.field)) continue;
|
|
1837
|
+
const he = Ce(G.field, I, p);
|
|
1837
1838
|
C.push([
|
|
1838
1839
|
{ v: pe },
|
|
1839
|
-
{ v:
|
|
1840
|
-
{ v: be(I.values[
|
|
1840
|
+
{ v: G.label },
|
|
1841
|
+
{ v: be(I.values[G.field], F(p, G.field)) },
|
|
1841
1842
|
{ v: he.because ?? "" },
|
|
1842
1843
|
{ v: he.why }
|
|
1843
1844
|
]);
|
|
1844
1845
|
}
|
|
1845
1846
|
}
|
|
1846
|
-
const $ =
|
|
1847
|
+
const $ = fa([
|
|
1847
1848
|
{
|
|
1848
1849
|
name: "History",
|
|
1849
1850
|
rows: d,
|
|
@@ -1858,8 +1859,8 @@ function yr({
|
|
|
1858
1859
|
{ name: "Recalculations", rows: C, widths: [20, 24, 18, 40, 50] }
|
|
1859
1860
|
]), B = URL.createObjectURL($), H = document.createElement("a");
|
|
1860
1861
|
H.href = B, H.download = `history-${e}-${n}.xlsx`, document.body.appendChild(H), H.click(), H.remove(), setTimeout(() => URL.revokeObjectURL(B), 1e3);
|
|
1861
|
-
},
|
|
1862
|
-
const s =
|
|
1862
|
+
}, Ot = () => {
|
|
1863
|
+
const s = Ba(
|
|
1863
1864
|
Q,
|
|
1864
1865
|
S,
|
|
1865
1866
|
(B, H) => be(H, F(p, B)),
|
|
@@ -1870,7 +1871,7 @@ function yr({
|
|
|
1870
1871
|
return u ? /* @__PURE__ */ t("div", { className: "space-y-2 pt-4", children: [1, 2, 3, 4, 5].map((s) => /* @__PURE__ */ t(vt, { className: "h-9 rounded-md" }, s)) }) : /* @__PURE__ */ r("div", { className: "pt-4", "data-revision-table-view": !0, children: [
|
|
1871
1872
|
/* @__PURE__ */ r("div", { className: "mb-3 flex items-center gap-2 overflow-x-auto pb-0.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", children: [
|
|
1872
1873
|
/* @__PURE__ */ t(
|
|
1873
|
-
|
|
1874
|
+
kr,
|
|
1874
1875
|
{
|
|
1875
1876
|
columns: _,
|
|
1876
1877
|
meta: p,
|
|
@@ -1883,13 +1884,13 @@ function yr({
|
|
|
1883
1884
|
}
|
|
1884
1885
|
),
|
|
1885
1886
|
/* @__PURE__ */ t(
|
|
1886
|
-
|
|
1887
|
+
Ja,
|
|
1887
1888
|
{
|
|
1888
1889
|
personal: y.personalSets,
|
|
1889
1890
|
shared: L.sets,
|
|
1890
|
-
roleDefaultName: ((
|
|
1891
|
+
roleDefaultName: ((Ye = L.roleDefault) == null ? void 0 : Ye.name) ?? null,
|
|
1891
1892
|
isAdmin: q,
|
|
1892
|
-
roles:
|
|
1893
|
+
roles: Lt ?? [],
|
|
1893
1894
|
onApply: (s) => E(s),
|
|
1894
1895
|
onSavePersonal: (s) => y.setPersonalSets([
|
|
1895
1896
|
...y.personalSets.filter((d) => d.name.toLowerCase() !== s.toLowerCase()),
|
|
@@ -1904,9 +1905,9 @@ function yr({
|
|
|
1904
1905
|
onDeleteShared: (s) => void L.save(L.sets.filter((d) => d.id !== s)).catch((d) => Oe(d, "The column set was not deleted"))
|
|
1905
1906
|
}
|
|
1906
1907
|
),
|
|
1907
|
-
/* @__PURE__ */ t(
|
|
1908
|
+
/* @__PURE__ */ t(Qa, { people: W, value: xe, onChange: O }),
|
|
1908
1909
|
/* @__PURE__ */ t(
|
|
1909
|
-
|
|
1910
|
+
Ga,
|
|
1910
1911
|
{
|
|
1911
1912
|
from: D,
|
|
1912
1913
|
to: V,
|
|
@@ -1954,8 +1955,8 @@ function yr({
|
|
|
1954
1955
|
}
|
|
1955
1956
|
)
|
|
1956
1957
|
] }),
|
|
1957
|
-
/* @__PURE__ */ r(
|
|
1958
|
-
/* @__PURE__ */ t(
|
|
1958
|
+
/* @__PURE__ */ r($a, { children: [
|
|
1959
|
+
/* @__PURE__ */ t(Ta, { asChild: !0, children: /* @__PURE__ */ r(
|
|
1959
1960
|
ie,
|
|
1960
1961
|
{
|
|
1961
1962
|
variant: "outline",
|
|
@@ -1970,15 +1971,15 @@ function yr({
|
|
|
1970
1971
|
]
|
|
1971
1972
|
}
|
|
1972
1973
|
) }),
|
|
1973
|
-
/* @__PURE__ */ r(
|
|
1974
|
-
/* @__PURE__ */ r(
|
|
1975
|
-
/* @__PURE__ */ t(
|
|
1974
|
+
/* @__PURE__ */ r(Ra, { align: "end", className: "w-[240px]", children: [
|
|
1975
|
+
/* @__PURE__ */ r(nt, { onSelect: At, className: "gap-2 text-[12px]", children: [
|
|
1976
|
+
/* @__PURE__ */ t(Qt, { className: "h-3.5 w-3.5" }),
|
|
1976
1977
|
/* @__PURE__ */ r("span", { className: "flex flex-col", children: [
|
|
1977
1978
|
"Excel",
|
|
1978
1979
|
/* @__PURE__ */ t("span", { className: "text-[11px] text-slate-500", children: "Changed cells shaded, a sheet of why values moved" })
|
|
1979
1980
|
] })
|
|
1980
1981
|
] }),
|
|
1981
|
-
/* @__PURE__ */ r(
|
|
1982
|
+
/* @__PURE__ */ r(nt, { onSelect: Ot, className: "gap-2 text-[12px]", children: [
|
|
1982
1983
|
/* @__PURE__ */ t(Xe, { className: "h-3.5 w-3.5" }),
|
|
1983
1984
|
/* @__PURE__ */ r("span", { className: "flex flex-col", children: [
|
|
1984
1985
|
"CSV",
|
|
@@ -1995,16 +1996,16 @@ function yr({
|
|
|
1995
1996
|
"data-revision-compare": !0,
|
|
1996
1997
|
children: [
|
|
1997
1998
|
/* @__PURE__ */ r("div", { className: "mb-2 flex items-center gap-2 text-[12.5px]", children: [
|
|
1998
|
-
/* @__PURE__ */ t(
|
|
1999
|
+
/* @__PURE__ */ t(ht, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
1999
2000
|
/* @__PURE__ */ r("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: [
|
|
2000
|
-
re[0].timestamp ?
|
|
2001
|
+
re[0].timestamp ? Y(re[0].timestamp) : "",
|
|
2001
2002
|
" ·",
|
|
2002
2003
|
" ",
|
|
2003
2004
|
Le(re[0])
|
|
2004
2005
|
] }),
|
|
2005
2006
|
/* @__PURE__ */ t(ze, { className: "h-3 w-3 text-slate-400" }),
|
|
2006
2007
|
/* @__PURE__ */ r("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: [
|
|
2007
|
-
re[1].timestamp ?
|
|
2008
|
+
re[1].timestamp ? Y(re[1].timestamp) : "",
|
|
2008
2009
|
" ·",
|
|
2009
2010
|
" ",
|
|
2010
2011
|
Le(re[1])
|
|
@@ -2013,15 +2014,15 @@ function yr({
|
|
|
2013
2014
|
"button",
|
|
2014
2015
|
{
|
|
2015
2016
|
type: "button",
|
|
2016
|
-
onClick: () =>
|
|
2017
|
+
onClick: () => ve([]),
|
|
2017
2018
|
"aria-label": "Close the comparison",
|
|
2018
2019
|
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",
|
|
2019
|
-
children: /* @__PURE__ */ t(
|
|
2020
|
+
children: /* @__PURE__ */ t(ut, { className: "h-3.5 w-3.5" })
|
|
2020
2021
|
}
|
|
2021
2022
|
)
|
|
2022
2023
|
] }),
|
|
2023
2024
|
/* @__PURE__ */ t("div", { className: "max-h-[320px] overflow-y-auto", children: /* @__PURE__ */ t(
|
|
2024
|
-
|
|
2025
|
+
Rt,
|
|
2025
2026
|
{
|
|
2026
2027
|
before: re[0].values,
|
|
2027
2028
|
after: re[1].values,
|
|
@@ -2032,7 +2033,7 @@ function yr({
|
|
|
2032
2033
|
]
|
|
2033
2034
|
}
|
|
2034
2035
|
),
|
|
2035
|
-
De && /* @__PURE__ */ t(
|
|
2036
|
+
De && /* @__PURE__ */ t(Ya, { label: De.label, points: De.points, onClose: () => Qe(null) }),
|
|
2036
2037
|
g.length === 0 ? /* @__PURE__ */ r("div", { className: "rounded-lg border border-dashed border-slate-200 py-12 text-center dark:border-border", children: [
|
|
2037
2038
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No saves yet" }),
|
|
2038
2039
|
/* @__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." })
|
|
@@ -2091,7 +2092,7 @@ function yr({
|
|
|
2091
2092
|
R === s.field && j !== s.field && "shadow-[inset_2px_0_0_0_rgb(var(--nvr-cyan-rgb,0_206_255))]"
|
|
2092
2093
|
),
|
|
2093
2094
|
children: /* @__PURE__ */ r("span", { className: "flex items-center gap-1", children: [
|
|
2094
|
-
/* @__PURE__ */ t(
|
|
2095
|
+
/* @__PURE__ */ t(xt, { className: "h-3 w-3 shrink-0 text-slate-300 opacity-0 transition-opacity group-hover/th:opacity-100 dark:text-slate-600" }),
|
|
2095
2096
|
s.label
|
|
2096
2097
|
] })
|
|
2097
2098
|
},
|
|
@@ -2159,9 +2160,9 @@ function yr({
|
|
|
2159
2160
|
{
|
|
2160
2161
|
className: P(
|
|
2161
2162
|
"mt-0.5 inline-block rounded px-1.5 py-px text-[10.5px] font-medium",
|
|
2162
|
-
|
|
2163
|
+
pt[s.action]
|
|
2163
2164
|
),
|
|
2164
|
-
children:
|
|
2165
|
+
children: lt(s.action)
|
|
2165
2166
|
}
|
|
2166
2167
|
),
|
|
2167
2168
|
s.autoMove && /* @__PURE__ */ r(
|
|
@@ -2169,7 +2170,7 @@ function yr({
|
|
|
2169
2170
|
{
|
|
2170
2171
|
className: P(
|
|
2171
2172
|
"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",
|
|
2172
|
-
|
|
2173
|
+
pt.moved
|
|
2173
2174
|
),
|
|
2174
2175
|
"data-tip": `This save moved it to ${s.autoMove.to ?? "the next step"} automatically (a step’s condition was met)`,
|
|
2175
2176
|
children: [
|
|
@@ -2181,7 +2182,7 @@ function yr({
|
|
|
2181
2182
|
] })
|
|
2182
2183
|
] }) }),
|
|
2183
2184
|
S.map((d) => {
|
|
2184
|
-
const C = F(p, d.field), $ = s.values[d.field], B = s.changed.has(d.field), H = s.recalculated.has(d.field), I = B || H, pe = H ? Ce(d.field, s, p) : null,
|
|
2185
|
+
const C = F(p, d.field), $ = s.values[d.field], B = s.changed.has(d.field), H = s.recalculated.has(d.field), I = B || H, pe = H ? Ce(d.field, s, p) : null, G = pe ? `Recalculated: ${pe.because ? `${pe.because}. ` : ""}${pe.why}` : d.field === ge && s.autoMove ? `Moved automatically by this save: ${s.autoMove.from ?? "—"} → ${s.autoMove.to ?? "—"} (a step’s condition was met)` : void 0, he = $ == null || $ === "";
|
|
2185
2186
|
return /* @__PURE__ */ t(
|
|
2186
2187
|
"td",
|
|
2187
2188
|
{
|
|
@@ -2217,8 +2218,8 @@ function yr({
|
|
|
2217
2218
|
"span",
|
|
2218
2219
|
{
|
|
2219
2220
|
className: "line-clamp-3 whitespace-pre-line break-words",
|
|
2220
|
-
"data-tip":
|
|
2221
|
-
children: he ? /* @__PURE__ */ t("span", { className: "font-normal italic text-slate-300 dark:text-slate-600", children: I ? "cleared" : "—" }) : C.relatedCollection && (typeof $ == "string" || typeof $ == "number") ? /* @__PURE__ */ t(
|
|
2221
|
+
"data-tip": G ?? (he ? void 0 : be($, C)),
|
|
2222
|
+
children: he ? /* @__PURE__ */ t("span", { className: "font-normal italic text-slate-300 dark:text-slate-600", children: I ? "cleared" : "—" }) : C.relatedCollection && (typeof $ == "string" || typeof $ == "number") ? /* @__PURE__ */ t(St, { collection: C.relatedCollection, id: $ }) : be($, C)
|
|
2222
2223
|
}
|
|
2223
2224
|
)
|
|
2224
2225
|
]
|
|
@@ -2232,12 +2233,12 @@ function yr({
|
|
|
2232
2233
|
] })
|
|
2233
2234
|
}
|
|
2234
2235
|
),
|
|
2235
|
-
/* @__PURE__ */ t(
|
|
2236
|
+
/* @__PURE__ */ t(ya, { scrollerRef: U })
|
|
2236
2237
|
] }),
|
|
2237
2238
|
g.length > 0 && /* @__PURE__ */ t("p", { className: "mt-2 text-[11.5px] text-slate-500 dark:text-slate-400", children: T.has(ge) ? "Line edits that changed no field on this record are in Timeline." : "Add Pipeline step from Fields to see each move as a row. Line edits that changed no field on this record are in Timeline." })
|
|
2238
2239
|
] });
|
|
2239
2240
|
}
|
|
2240
|
-
function
|
|
2241
|
+
function wr({
|
|
2241
2242
|
snapshots: e,
|
|
2242
2243
|
history: n,
|
|
2243
2244
|
meta: i,
|
|
@@ -2246,20 +2247,20 @@ function vr({
|
|
|
2246
2247
|
}) {
|
|
2247
2248
|
var U, J, ue;
|
|
2248
2249
|
const o = M(() => [...e].reverse(), [e]), u = M(
|
|
2249
|
-
() =>
|
|
2250
|
+
() => wt(n, {
|
|
2250
2251
|
name: (x) => te(x, a)
|
|
2251
2252
|
}),
|
|
2252
2253
|
[n, a]
|
|
2253
2254
|
), [l, b] = A(() => {
|
|
2254
2255
|
const x = m ? o.findIndex((D) => `${D.id}|${D.timestamp ?? ""}` === m) : -1;
|
|
2255
2256
|
return x >= 0 ? x : Math.max(0, o.length - 1);
|
|
2256
|
-
}), [c,
|
|
2257
|
+
}), [c, k] = A(!1), [g, f] = A(!1), [p, v] = A(""), _ = o.length - 1;
|
|
2257
2258
|
_e(() => {
|
|
2258
2259
|
l > _ && b(Math.max(0, _));
|
|
2259
2260
|
}, [l, _]), _e(() => {
|
|
2260
2261
|
if (!c) return;
|
|
2261
2262
|
if (l >= _) {
|
|
2262
|
-
|
|
2263
|
+
k(!1);
|
|
2263
2264
|
return;
|
|
2264
2265
|
}
|
|
2265
2266
|
const x = setTimeout(() => b((D) => D + 1), 1800);
|
|
@@ -2267,7 +2268,7 @@ function vr({
|
|
|
2267
2268
|
}, [c, l, _]);
|
|
2268
2269
|
const y = o[l], L = l > 0 ? o[l - 1] : null, q = M(() => {
|
|
2269
2270
|
if (!y) return [];
|
|
2270
|
-
const x =
|
|
2271
|
+
const x = Tt((L == null ? void 0 : L.data) ?? {}, y.data ?? {}, i).filter(
|
|
2271
2272
|
(V) => V.status !== "unchanged" && !V.system && V.field !== "id"
|
|
2272
2273
|
);
|
|
2273
2274
|
if (!L) return [];
|
|
@@ -2279,9 +2280,9 @@ function vr({
|
|
|
2279
2280
|
).sort(([x], [D]) => F(i, x).label.localeCompare(F(i, D).label)),
|
|
2280
2281
|
[y, i]
|
|
2281
2282
|
), j = (x) => {
|
|
2282
|
-
|
|
2283
|
+
k(!1), b(Math.min(_, Math.max(0, x)));
|
|
2283
2284
|
}, w = (x) => {
|
|
2284
|
-
if (
|
|
2285
|
+
if (v(x), !x) return;
|
|
2285
2286
|
const D = (/* @__PURE__ */ new Date(`${x}T23:59:59`)).getTime();
|
|
2286
2287
|
let Z = -1;
|
|
2287
2288
|
o.forEach((V, me) => {
|
|
@@ -2306,7 +2307,7 @@ function vr({
|
|
|
2306
2307
|
"aria-valuemin": 1,
|
|
2307
2308
|
"aria-valuemax": o.length,
|
|
2308
2309
|
"aria-valuenow": l + 1,
|
|
2309
|
-
"aria-valuetext": `${l + 1} of ${o.length}${y.timestamp ? `, ${
|
|
2310
|
+
"aria-valuetext": `${l + 1} of ${o.length}${y.timestamp ? `, ${Y(y.timestamp)}` : ""}, ${R}`,
|
|
2310
2311
|
onKeyDown: (x) => {
|
|
2311
2312
|
if (x.key === "ArrowLeft") j(l - 1);
|
|
2312
2313
|
else if (x.key === "ArrowRight") j(l + 1);
|
|
@@ -2340,8 +2341,8 @@ function vr({
|
|
|
2340
2341
|
type: "button",
|
|
2341
2342
|
tabIndex: -1,
|
|
2342
2343
|
onClick: () => j(D),
|
|
2343
|
-
"aria-label": `${x.timestamp ?
|
|
2344
|
-
"data-tip": `${x.timestamp ?
|
|
2344
|
+
"aria-label": `${x.timestamp ? Y(x.timestamp) : "Save"} — ${te(x, a)}`,
|
|
2345
|
+
"data-tip": `${x.timestamp ? Y(x.timestamp) : ""} · ${te(x, a)}`,
|
|
2345
2346
|
className: "absolute top-1/2 -translate-x-1/2 -translate-y-1/2 p-1",
|
|
2346
2347
|
style: { left: `calc(0.5rem + (100% - 1rem) * ${Z})` },
|
|
2347
2348
|
children: /* @__PURE__ */ t(
|
|
@@ -2386,7 +2387,7 @@ function vr({
|
|
|
2386
2387
|
onClick: () => j(l - 1),
|
|
2387
2388
|
disabled: l === 0,
|
|
2388
2389
|
"aria-label": "Previous save",
|
|
2389
|
-
children: /* @__PURE__ */ t(
|
|
2390
|
+
children: /* @__PURE__ */ t(aa, { className: "h-3.5 w-3.5" })
|
|
2390
2391
|
}
|
|
2391
2392
|
),
|
|
2392
2393
|
/* @__PURE__ */ r(
|
|
@@ -2395,12 +2396,12 @@ function vr({
|
|
|
2395
2396
|
size: "sm",
|
|
2396
2397
|
className: "h-7 gap-1.5 bg-nvr-cyan px-3 text-[12px] text-white hover:bg-nvr-cyan/90",
|
|
2397
2398
|
onClick: () => {
|
|
2398
|
-
!c && l >= _ && b(0),
|
|
2399
|
+
!c && l >= _ && b(0), k((x) => !x);
|
|
2399
2400
|
},
|
|
2400
2401
|
disabled: o.length < 2,
|
|
2401
2402
|
"data-replay-play": !0,
|
|
2402
2403
|
children: [
|
|
2403
|
-
c ? /* @__PURE__ */ t(
|
|
2404
|
+
c ? /* @__PURE__ */ t(ra, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(sa, { className: "h-3.5 w-3.5" }),
|
|
2404
2405
|
c ? "Pause" : l >= _ ? "Replay from the start" : "Play"
|
|
2405
2406
|
]
|
|
2406
2407
|
}
|
|
@@ -2425,7 +2426,7 @@ function vr({
|
|
|
2425
2426
|
l === _ ? " · current" : ""
|
|
2426
2427
|
] }),
|
|
2427
2428
|
/* @__PURE__ */ r("label", { className: "ml-auto inline-flex items-center gap-1.5 text-[11.5px] text-slate-500 dark:text-slate-400", children: [
|
|
2428
|
-
/* @__PURE__ */ t(
|
|
2429
|
+
/* @__PURE__ */ t(na, { className: "h-3.5 w-3.5" }),
|
|
2429
2430
|
"Jump to",
|
|
2430
2431
|
/* @__PURE__ */ t(
|
|
2431
2432
|
"input",
|
|
@@ -2448,7 +2449,7 @@ function vr({
|
|
|
2448
2449
|
" ",
|
|
2449
2450
|
/* @__PURE__ */ t("span", { className: "text-slate-500 dark:text-slate-400", children: K })
|
|
2450
2451
|
] }),
|
|
2451
|
-
/* @__PURE__ */ t("span", { className: "shrink-0 tabular-nums text-[11.5px] text-slate-400", children: y.timestamp ?
|
|
2452
|
+
/* @__PURE__ */ t("span", { className: "shrink-0 tabular-nums text-[11.5px] text-slate-400", children: y.timestamp ? Y(y.timestamp) : "" })
|
|
2452
2453
|
] }),
|
|
2453
2454
|
z && /* @__PURE__ */ t("p", { className: "mt-2 text-[12px] text-slate-500 dark:text-slate-400", children: "The record did not exist yet on that date — showing its first save." }),
|
|
2454
2455
|
q.length > 0 && /* @__PURE__ */ t("div", { className: "mt-3 overflow-hidden rounded-md border border-amber-200/80 dark:border-amber-900/50", children: q.map((x) => /* @__PURE__ */ r(
|
|
@@ -2474,18 +2475,18 @@ function vr({
|
|
|
2474
2475
|
}
|
|
2475
2476
|
)
|
|
2476
2477
|
] }),
|
|
2477
|
-
/* @__PURE__ */ t("span", { className: "min-w-0 text-[12px]", children:
|
|
2478
|
+
/* @__PURE__ */ t("span", { className: "min-w-0 text-[12px]", children: mt(x.before) || mt(x.after) ? (
|
|
2478
2479
|
// A paragraph that gained a sentence reads as the words that moved.
|
|
2479
|
-
/* @__PURE__ */ t("span", { className: "block break-words leading-relaxed text-slate-700 dark:text-slate-200", children: /* @__PURE__ */ t(
|
|
2480
|
+
/* @__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 }) })
|
|
2480
2481
|
) : /* @__PURE__ */ r("span", { className: "flex flex-wrap items-baseline gap-x-2", children: [
|
|
2481
2482
|
/* @__PURE__ */ t(
|
|
2482
2483
|
"span",
|
|
2483
2484
|
{
|
|
2484
2485
|
className: P(
|
|
2485
2486
|
"text-slate-400",
|
|
2486
|
-
!
|
|
2487
|
+
!ct(x.before) && "line-through decoration-slate-300 dark:decoration-slate-600"
|
|
2487
2488
|
),
|
|
2488
|
-
children:
|
|
2489
|
+
children: ct(x.before) ? "—" : /* @__PURE__ */ t(de, { value: x.before, meta: F(i, x.field), tone: "before" })
|
|
2489
2490
|
}
|
|
2490
2491
|
),
|
|
2491
2492
|
/* @__PURE__ */ t(ze, { className: "h-3 w-3 shrink-0 self-center text-slate-400" }),
|
|
@@ -2530,7 +2531,7 @@ function vr({
|
|
|
2530
2531
|
);
|
|
2531
2532
|
}
|
|
2532
2533
|
export {
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2534
|
+
Rt as FieldChangeList,
|
|
2535
|
+
ns as RevisionsPanel,
|
|
2536
|
+
Ct as displayValue
|
|
2536
2537
|
};
|