@nivaro/react 0.3.64 → 0.3.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +62 -8
- package/dist/shared/components/CollectionBrowserView.js +3127 -3204
- package/dist/shared/components/ConformanceView.js +235 -221
- package/dist/shared/components/DataTable.js +478 -459
- package/dist/shared/components/ItemEditForm.js +4842 -4500
- package/dist/shared/components/MyWorkView.js +124 -113
- package/dist/shared/components/PageRenderer.js +146 -138
- package/dist/shared/components/ProfileView.js +483 -472
- package/dist/shared/components/RecordDrilldownSheet.js +73 -65
- package/dist/shared/components/ReportView.js +1100 -1094
- package/dist/shared/components/bulk/BulkActionButtons.js +72 -72
- package/dist/shared/components/bulk/BulkCompareButton.js +62 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +114 -103
- package/dist/shared/components/bulk/BulkFieldUpdateButton.js +73 -0
- package/dist/shared/components/bulk/MessageStakeholders.js +235 -0
- package/dist/shared/components/bulk/bulk-field-options.js +29 -23
- package/dist/shared/components/integrations/IntegrationObligationsView.js +191 -173
- package/dist/shared/components/integrations/IntegrationStatusLines.js +101 -85
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +11 -9
- package/dist/shared/components/integrations/SendCurrentData.js +126 -0
- package/dist/shared/components/item-edit/CatalogPickerField.js +1535 -1440
- package/dist/shared/components/item-edit/FieldRenderer.js +49 -45
- package/dist/shared/components/item-edit/FieldRow.js +413 -403
- package/dist/shared/components/item-edit/GroupSection.js +555 -538
- package/dist/shared/components/item-edit/InlineTableField.js +2903 -2816
- package/dist/shared/components/item-edit/M2MCombobox.js +407 -338
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +367 -116
- package/dist/shared/components/item-edit/NestedRelationEditor.js +171 -163
- package/dist/shared/components/item-edit/PlanGrid.js +783 -724
- package/dist/shared/components/item-edit/QuickCreateButton.js +291 -224
- package/dist/shared/components/item-edit/RecordInsights.js +113 -111
- package/dist/shared/components/item-edit/RecordLiveSync.js +4 -1
- package/dist/shared/components/item-edit/RelationCombobox.js +398 -364
- package/dist/shared/components/item-edit/SummaryPanel.js +146 -144
- package/dist/shared/components/item-edit/UserChip.js +264 -229
- package/dist/shared/components/item-edit/cascade-clear-notice.js +56 -0
- package/dist/shared/components/item-edit/collision-format.js +37 -0
- package/dist/shared/components/item-edit/field-a11y.js +25 -0
- package/dist/shared/components/item-edit/header-path-preview.js +52 -0
- package/dist/shared/components/item-edit/line-merge.js +84 -0
- package/dist/shared/components/item-edit/line-midair.js +94 -87
- package/dist/shared/components/item-edit/move-guard.js +17 -0
- package/dist/shared/components/item-edit/picker-search.js +27 -16
- package/dist/shared/components/item-edit/rail-width.js +8 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +126 -124
- package/dist/shared/components/panels/AccessDeniedPanel.js +96 -55
- package/dist/shared/components/panels/CommentPanel.js +142 -136
- package/dist/shared/components/panels/ItemLockBanner.js +246 -240
- package/dist/shared/components/panels/PipelinePanel.js +1366 -1194
- package/dist/shared/components/panels/RevisionsPanel.js +106 -102
- package/dist/shared/components/panels/SlaBreachBanner.js +16 -20
- package/dist/shared/components/panels/SlaClock.js +90 -68
- package/dist/shared/components/queue/QueueItemSheet.js +94 -87
- package/dist/shared/components/queue/QueueWorklist.js +1522 -1347
- package/dist/shared/components/queue/worklist-csv.js +75 -0
- package/dist/shared/components/queue/worklist-helpers.js +20 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +226 -207
- package/dist/shared/lib/bulk-copy.js +17 -0
- package/dist/shared/lib/cbv-export.js +122 -0
- package/dist/shared/lib/delete-offer.js +13 -0
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/leave-guard.js +41 -26
- package/dist/shared/lib/list-link.js +72 -56
- package/dist/shared/lib/live-queries.js +32 -30
- package/dist/shared/lib/moved-notice.js +25 -0
- package/dist/shared/lib/notification-target.js +56 -54
- package/dist/shared/lib/obligation-banner.js +11 -8
- package/dist/shared/lib/obligation-reason-text.js +6 -6
- package/dist/shared/lib/quick-filter-cascade.js +29 -19
- package/dist/shared/lib/sort-cycle.js +6 -0
- package/dist/shared/lib/summary-mode.js +59 -41
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as l, jsx as t, Fragment as L } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as P, useQueryClient as ee, useMutation as Q } from "@tanstack/react-query";
|
|
3
|
-
import { Clock as Y, Search as Ce, X as _e, CalendarClock as Te, GitCompareArrows as Re, ChevronDown as je, ChevronRight as Ae, MessageSquare as Le, RotateCcw as
|
|
3
|
+
import { Clock as Y, Search as Ce, X as _e, CalendarClock as Te, GitCompareArrows as Re, ChevronDown as je, ChevronRight as Ae, MessageSquare as Le, RotateCcw as oe, ArrowRight as $e } from "lucide-react";
|
|
4
4
|
import { useState as w, useRef as Oe, useMemo as R, createContext as De, useEffect as qe, useContext as ce } from "react";
|
|
5
5
|
import { toast as A } from "sonner";
|
|
6
6
|
import { useNivaroClient as F } from "../../context.js";
|
|
@@ -38,7 +38,7 @@ function ue(e, s) {
|
|
|
38
38
|
enabled: s,
|
|
39
39
|
staleTime: 3e5,
|
|
40
40
|
queryFn: async () => {
|
|
41
|
-
const [
|
|
41
|
+
const [i, o] = await Promise.all([
|
|
42
42
|
d.request(q(`/field-config/${e}`)).then((n) => n.data ?? []).catch(() => []),
|
|
43
43
|
d.request(
|
|
44
44
|
q(`/collections/${e}`)
|
|
@@ -47,18 +47,18 @@ function ue(e, s) {
|
|
|
47
47
|
return ((r = n.data) == null ? void 0 : r.relations) ?? [];
|
|
48
48
|
}).catch(() => [])
|
|
49
49
|
]);
|
|
50
|
-
return { fields:
|
|
50
|
+
return { fields: i, relations: o };
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
return R(() => {
|
|
54
|
-
const
|
|
54
|
+
const i = /* @__PURE__ */ new Map(), o = (n) => {
|
|
55
55
|
const r = ((a == null ? void 0 : a.relations) ?? []).find(
|
|
56
56
|
(m) => m.many_collection === e && m.many_field === n && m.junction_field == null
|
|
57
57
|
);
|
|
58
58
|
return r != null && r.one_collection ? r.one_collection === "directus_users" ? "nivaro_users" : r.one_collection : null;
|
|
59
59
|
};
|
|
60
60
|
for (const n of (a == null ? void 0 : a.fields) ?? [])
|
|
61
|
-
n.field.startsWith("__") ||
|
|
61
|
+
n.field.startsWith("__") || i.set(n.field, {
|
|
62
62
|
label: n.label || me(n.field.replace(/_/g, " ")),
|
|
63
63
|
// Hidden fields are machine columns (e.g. the retired "workflow_state
|
|
64
64
|
// (legacy)" a save still writes) — folded with the system fields, not
|
|
@@ -67,10 +67,10 @@ function ue(e, s) {
|
|
|
67
67
|
// layout_assigned is only stamped when the collection HAS an active
|
|
68
68
|
// layout — absent means there's no layout to be off of.
|
|
69
69
|
onLayout: n.layout_assigned !== !1,
|
|
70
|
-
relatedCollection:
|
|
70
|
+
relatedCollection: o(n.field),
|
|
71
71
|
dateOnly: String(n.type ?? "").toLowerCase() === "date"
|
|
72
72
|
});
|
|
73
|
-
return
|
|
73
|
+
return i;
|
|
74
74
|
}, [a, e]);
|
|
75
75
|
}
|
|
76
76
|
function k(e, s) {
|
|
@@ -111,7 +111,7 @@ function U(e) {
|
|
|
111
111
|
function rt({ collection: e, id: s }) {
|
|
112
112
|
const d = F(), { data: a } = P({
|
|
113
113
|
queryKey: ["col-meta", e],
|
|
114
|
-
queryFn: () => d.request(q(`/collections/${e}`)).then((
|
|
114
|
+
queryFn: () => d.request(q(`/collections/${e}`)).then((i) => i.data),
|
|
115
115
|
staleTime: 3e5,
|
|
116
116
|
retry: !1
|
|
117
117
|
});
|
|
@@ -133,17 +133,17 @@ function de({
|
|
|
133
133
|
tone: s,
|
|
134
134
|
dateOnly: d
|
|
135
135
|
}) {
|
|
136
|
-
const [a,
|
|
137
|
-
if (
|
|
136
|
+
const [a, i] = w(!1), o = at(e, d);
|
|
137
|
+
if (o === "")
|
|
138
138
|
return /* @__PURE__ */ t("span", { className: "text-[11.5px] italic text-slate-300 dark:text-slate-600", children: "empty" });
|
|
139
|
-
const n =
|
|
139
|
+
const n = o.length > le, r = a || !n ? o : `${o.slice(0, le)}…`;
|
|
140
140
|
return /* @__PURE__ */ l("span", { className: "break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: [
|
|
141
141
|
typeof e == "object" ? /* @__PURE__ */ t("span", { className: "font-mono text-[11px]", children: r }) : r,
|
|
142
142
|
n && /* @__PURE__ */ t(
|
|
143
143
|
"button",
|
|
144
144
|
{
|
|
145
145
|
type: "button",
|
|
146
|
-
onClick: () =>
|
|
146
|
+
onClick: () => i((m) => !m),
|
|
147
147
|
className: T(
|
|
148
148
|
"ml-1 text-[10.5px] font-medium hover:underline",
|
|
149
149
|
s === "before" ? "text-rose-500" : "text-emerald-600"
|
|
@@ -168,21 +168,21 @@ function nt({
|
|
|
168
168
|
before: e,
|
|
169
169
|
after: s
|
|
170
170
|
}) {
|
|
171
|
-
const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(s)])).sort().map((
|
|
172
|
-
const n =
|
|
173
|
-
return n === r ? null : { k:
|
|
171
|
+
const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(s)])).sort().map((o) => {
|
|
172
|
+
const n = o in e ? JSON.stringify(e[o]) : void 0, r = o in s ? JSON.stringify(s[o]) : void 0;
|
|
173
|
+
return n === r ? null : { k: o, b: n, a: r };
|
|
174
174
|
}).filter(Boolean);
|
|
175
175
|
if (a.length === 0)
|
|
176
176
|
return /* @__PURE__ */ t("span", { className: "text-[11px] italic text-slate-400", children: "keys reordered only" });
|
|
177
|
-
const
|
|
178
|
-
return /* @__PURE__ */ t("div", { className: "space-y-0.5", "data-json-diff": !0, children: a.map(({ k:
|
|
179
|
-
/* @__PURE__ */ t("span", { className: "font-mono text-[10.5px] text-slate-500", children:
|
|
177
|
+
const i = (o) => o == null ? void 0 : o.length > 80 ? `${o.slice(0, 80)}…` : o;
|
|
178
|
+
return /* @__PURE__ */ t("div", { className: "space-y-0.5", "data-json-diff": !0, children: a.map(({ k: o, b: n, a: r }) => /* @__PURE__ */ l("p", { className: "text-[11.5px]", children: [
|
|
179
|
+
/* @__PURE__ */ t("span", { className: "font-mono text-[10.5px] text-slate-500", children: o }),
|
|
180
180
|
":",
|
|
181
181
|
" ",
|
|
182
|
-
n !== void 0 && /* @__PURE__ */ t("span", { className: "text-rose-600 line-through dark:text-rose-400", children:
|
|
182
|
+
n !== void 0 && /* @__PURE__ */ t("span", { className: "text-rose-600 line-through dark:text-rose-400", children: i(n) }),
|
|
183
183
|
n !== void 0 && r !== void 0 && " → ",
|
|
184
|
-
r !== void 0 ? /* @__PURE__ */ t("span", { className: "text-emerald-700 dark:text-emerald-400", children:
|
|
185
|
-
] },
|
|
184
|
+
r !== void 0 ? /* @__PURE__ */ t("span", { className: "text-emerald-700 dark:text-emerald-400", children: i(r) }) : /* @__PURE__ */ t("span", { className: "italic text-slate-400", children: " (removed)" })
|
|
185
|
+
] }, o)) });
|
|
186
186
|
}
|
|
187
187
|
function lt({ field: e, ctl: s }) {
|
|
188
188
|
return s.confirmField === e ? /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1", "data-revert-field-confirm": e, children: [
|
|
@@ -215,7 +215,7 @@ function lt({ field: e, ctl: s }) {
|
|
|
215
215
|
title: "Set the field back to this revision’s value",
|
|
216
216
|
"data-revert-field": e,
|
|
217
217
|
children: [
|
|
218
|
-
/* @__PURE__ */ t(
|
|
218
|
+
/* @__PURE__ */ t(oe, { className: "h-3 w-3" }),
|
|
219
219
|
"Revert"
|
|
220
220
|
]
|
|
221
221
|
}
|
|
@@ -228,30 +228,30 @@ function Z(e) {
|
|
|
228
228
|
return String(e ?? "").replace(/<[^>]*>/g, " ").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").split(/\s+/).filter(Boolean);
|
|
229
229
|
}
|
|
230
230
|
function dt(e, s) {
|
|
231
|
-
const a = Z(e).slice(0, 600),
|
|
232
|
-
for (let g =
|
|
231
|
+
const a = Z(e).slice(0, 600), i = Z(s).slice(0, 600), o = a.length, n = i.length, r = Array.from({ length: o + 1 }, () => new Array(n + 1).fill(0));
|
|
232
|
+
for (let g = o - 1; g >= 0; g--)
|
|
233
233
|
for (let c = n - 1; c >= 0; c--)
|
|
234
|
-
r[g][c] = a[g] ===
|
|
234
|
+
r[g][c] = a[g] === i[c] ? r[g + 1][c + 1] + 1 : Math.max(r[g + 1][c], r[g][c + 1]);
|
|
235
235
|
const m = [], x = (g, c) => {
|
|
236
236
|
const y = m[m.length - 1];
|
|
237
237
|
y && y.type === g ? y.text += ` ${c}` : m.push({ text: c, type: g });
|
|
238
238
|
};
|
|
239
239
|
let p = 0, u = 0;
|
|
240
|
-
for (; p <
|
|
241
|
-
a[p] ===
|
|
242
|
-
for (; p <
|
|
243
|
-
for (; u < n; ) x("ins",
|
|
240
|
+
for (; p < o && u < n; )
|
|
241
|
+
a[p] === i[u] ? (x("same", a[p]), p++, u++) : r[p + 1][u] >= r[p][u + 1] ? (x("del", a[p]), p++) : (x("ins", i[u]), u++);
|
|
242
|
+
for (; p < o; ) x("del", a[p++]);
|
|
243
|
+
for (; u < n; ) x("ins", i[u++]);
|
|
244
244
|
return m;
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function it({ before: e, after: s }) {
|
|
247
247
|
const d = dt(e, s);
|
|
248
248
|
return /* @__PURE__ */ t("p", { className: "whitespace-pre-wrap break-words text-[12px] leading-relaxed text-slate-700 dark:text-slate-300", children: d.map(
|
|
249
|
-
(a,
|
|
249
|
+
(a, i) => a.type === "same" ? (
|
|
250
250
|
// biome-ignore lint/suspicious/noArrayIndexKey: static segment list
|
|
251
251
|
/* @__PURE__ */ l("span", { children: [
|
|
252
252
|
a.text,
|
|
253
253
|
" "
|
|
254
|
-
] },
|
|
254
|
+
] }, i)
|
|
255
255
|
) : a.type === "del" ? (
|
|
256
256
|
// biome-ignore lint/suspicious/noArrayIndexKey: static segment list
|
|
257
257
|
/* @__PURE__ */ l(
|
|
@@ -263,7 +263,7 @@ function ot({ before: e, after: s }) {
|
|
|
263
263
|
" "
|
|
264
264
|
]
|
|
265
265
|
},
|
|
266
|
-
|
|
266
|
+
i
|
|
267
267
|
)
|
|
268
268
|
) : (
|
|
269
269
|
// biome-ignore lint/suspicious/noArrayIndexKey: static segment list
|
|
@@ -276,19 +276,19 @@ function ot({ before: e, after: s }) {
|
|
|
276
276
|
" "
|
|
277
277
|
]
|
|
278
278
|
},
|
|
279
|
-
|
|
279
|
+
i
|
|
280
280
|
)
|
|
281
281
|
)
|
|
282
282
|
) });
|
|
283
283
|
}
|
|
284
|
-
const
|
|
284
|
+
const ot = {
|
|
285
285
|
added: "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-400",
|
|
286
286
|
removed: "bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-400",
|
|
287
287
|
changed: "bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-400"
|
|
288
288
|
};
|
|
289
289
|
function ct(e, s, d) {
|
|
290
|
-
const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(s)])),
|
|
291
|
-
const m = !(r in e) ||
|
|
290
|
+
const a = Array.from(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(s)])), i = (r) => r == null || r === "", o = a.map((r) => {
|
|
291
|
+
const m = !(r in e) || i(e[r]), x = !(r in s) || i(s[r]);
|
|
292
292
|
if (m && x) return null;
|
|
293
293
|
const p = m ? "added" : x ? "removed" : U(e[r]) !== U(s[r]) ? "changed" : "unchanged";
|
|
294
294
|
return {
|
|
@@ -302,7 +302,7 @@ function ct(e, s, d) {
|
|
|
302
302
|
const m = k(d, r.field);
|
|
303
303
|
return (m.system ? 8 : m.onLayout ? 0 : 4) + (r.status === "unchanged" ? 2 : 0);
|
|
304
304
|
};
|
|
305
|
-
return
|
|
305
|
+
return o.sort(
|
|
306
306
|
(r, m) => n(r) - n(m) || k(d, r.field).label.localeCompare(k(d, m.field).label)
|
|
307
307
|
);
|
|
308
308
|
}
|
|
@@ -318,9 +318,10 @@ function mt({
|
|
|
318
318
|
meta: s,
|
|
319
319
|
fieldRevert: d,
|
|
320
320
|
mode: a,
|
|
321
|
-
hideStatusChips:
|
|
321
|
+
hideStatusChips: i,
|
|
322
|
+
between: o
|
|
322
323
|
}) {
|
|
323
|
-
const
|
|
324
|
+
const n = e.status === "changed" && (X(e.before) || X(e.after)), r = e.status === "changed" && I(e.before) && I(e.after);
|
|
324
325
|
return /* @__PURE__ */ l(
|
|
325
326
|
"div",
|
|
326
327
|
{
|
|
@@ -332,19 +333,21 @@ function mt({
|
|
|
332
333
|
children: [
|
|
333
334
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
334
335
|
/* @__PURE__ */ t(et, { map: s, field: e.field }),
|
|
335
|
-
e.status !== "unchanged" && !
|
|
336
|
+
e.status !== "unchanged" && !i && /* @__PURE__ */ t(
|
|
336
337
|
"span",
|
|
337
338
|
{
|
|
338
339
|
className: T(
|
|
339
340
|
"rounded px-1 py-px text-[9px] font-semibold uppercase tracking-wide",
|
|
340
|
-
|
|
341
|
+
ot[e.status]
|
|
341
342
|
),
|
|
342
343
|
children: e.status === "added" ? "set" : e.status
|
|
343
344
|
}
|
|
344
345
|
),
|
|
345
|
-
(e.status === "changed" || a === "changes" && e.status === "added") && d && e.field !== "id" &&
|
|
346
|
+
(e.status === "changed" || a === "changes" && e.status === "added") && d && e.field !== "id" && // A value worked out between saves (a rollup, a forecast status) is
|
|
347
|
+
// not something to put back by hand (army11 f1 design review).
|
|
348
|
+
!o && /* @__PURE__ */ t("span", { className: "ml-auto shrink-0", children: /* @__PURE__ */ t(lt, { field: e.field, ctl: d }) })
|
|
346
349
|
] }),
|
|
347
|
-
/* @__PURE__ */ t("div", { className: "mt-1", children:
|
|
350
|
+
/* @__PURE__ */ t("div", { className: "mt-1", children: n ? /* @__PURE__ */ t("div", { "data-richtext-diff": !0, children: /* @__PURE__ */ t(it, { before: e.before, after: e.after }) }) : r ? /* @__PURE__ */ t(
|
|
348
351
|
nt,
|
|
349
352
|
{
|
|
350
353
|
before: I(e.before),
|
|
@@ -364,13 +367,13 @@ function pt({
|
|
|
364
367
|
after: s,
|
|
365
368
|
meta: d,
|
|
366
369
|
fieldRevert: a,
|
|
367
|
-
mode:
|
|
368
|
-
hideStatusChips:
|
|
370
|
+
mode: i,
|
|
371
|
+
hideStatusChips: o,
|
|
369
372
|
ownFields: n
|
|
370
373
|
}) {
|
|
371
|
-
const [r, m] = w(!1), x = R(() => ct(e, s, d), [e, s, d]), p =
|
|
374
|
+
const [r, m] = w(!1), x = R(() => ct(e, s, d), [e, s, d]), p = i === "changes" ? x.filter((h) => h.status !== "unchanged") : x, u = r ? p : p.filter((h) => !h.system), g = (h) => !!n && i === "changes" && !h.system && !n.has(h.field), c = u.filter(g), y = [...u.filter((h) => !g(h)), ...c], j = c.length ? y.length - c.length : -1, f = p.length - y.length;
|
|
372
375
|
if (p.length === 0)
|
|
373
|
-
return /* @__PURE__ */ t("p", { className: "px-3 py-3 text-[12px] text-slate-400", children:
|
|
376
|
+
return /* @__PURE__ */ t("p", { className: "px-3 py-3 text-[12px] text-slate-400", children: i === "changes" ? "No field changes recorded." : "No snapshot data available." });
|
|
374
377
|
const N = y.findIndex(
|
|
375
378
|
(h) => !g(h) && !k(d, h.field).onLayout && !k(d, h.field).system
|
|
376
379
|
), S = y.some(
|
|
@@ -399,8 +402,9 @@ function pt({
|
|
|
399
402
|
row: h,
|
|
400
403
|
meta: d,
|
|
401
404
|
fieldRevert: a,
|
|
402
|
-
mode:
|
|
403
|
-
hideStatusChips:
|
|
405
|
+
mode: i,
|
|
406
|
+
hideStatusChips: o,
|
|
407
|
+
between: g(h)
|
|
404
408
|
}
|
|
405
409
|
)
|
|
406
410
|
] }, h.field)),
|
|
@@ -446,7 +450,7 @@ function ht(e, s, d) {
|
|
|
446
450
|
}
|
|
447
451
|
function xt({ revision: e, isLast: s }) {
|
|
448
452
|
var x, p, u;
|
|
449
|
-
const d = ce(te), a = e.event,
|
|
453
|
+
const d = ce(te), a = e.event, i = (a == null ? void 0 : a.source) === "auto" || !e.user_id && (a == null ? void 0 : a.kind) === "transition", o = !i && ((x = a == null ? void 0 : a.on_behalf_of) != null && x.name) ? a.on_behalf_of.name : null, n = i ? "Automatic rule" : o ? `${B(e, d)}, for ${o}` : B(e, d);
|
|
450
454
|
let r;
|
|
451
455
|
(a == null ? void 0 : a.kind) === "transition" && a.addendum ? r = /* @__PURE__ */ l(L, { children: [
|
|
452
456
|
"moved",
|
|
@@ -502,7 +506,7 @@ function xt({ revision: e, isLast: s }) {
|
|
|
502
506
|
{
|
|
503
507
|
className: "relative pl-9",
|
|
504
508
|
"data-revision-event": (a == null ? void 0 : a.kind) ?? e.action ?? "",
|
|
505
|
-
"data-revision-on-behalf":
|
|
509
|
+
"data-revision-on-behalf": o ? (u = a == null ? void 0 : a.on_behalf_of) == null ? void 0 : u.id : void 0,
|
|
506
510
|
children: [
|
|
507
511
|
/* @__PURE__ */ t(
|
|
508
512
|
"span",
|
|
@@ -522,7 +526,7 @@ function xt({ revision: e, isLast: s }) {
|
|
|
522
526
|
}
|
|
523
527
|
),
|
|
524
528
|
/* @__PURE__ */ l("div", { className: "flex w-full items-start gap-2.5 rounded-md px-2 py-2.5 text-left", children: [
|
|
525
|
-
|
|
529
|
+
i ? /* @__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(
|
|
526
530
|
pe,
|
|
527
531
|
{
|
|
528
532
|
userId: e.user_id,
|
|
@@ -565,8 +569,8 @@ function ft({
|
|
|
565
569
|
previousData: s,
|
|
566
570
|
meta: d,
|
|
567
571
|
onRollback: a,
|
|
568
|
-
inlineTableFields:
|
|
569
|
-
isLast:
|
|
572
|
+
inlineTableFields: i,
|
|
573
|
+
isLast: o
|
|
570
574
|
}) {
|
|
571
575
|
const n = F(), r = ce(te), m = Be(e).reason, [x, p] = w(!1), [u, g] = w(!1), [c, y] = w("changes"), [j, f] = w(!1), [N, S] = w(null), h = e.action === "update", C = e.action === "create" || e.action === "restore", W = e.action === "delete", v = W ? e.data ?? {} : C ? {} : s ?? {}, $ = W ? {} : e.data ?? {}, { humanDelta: V, systemDelta: he } = R(() => {
|
|
572
576
|
const b = e.delta ?? {};
|
|
@@ -592,7 +596,7 @@ function ft({
|
|
|
592
596
|
onSuccess: (b) => {
|
|
593
597
|
g(!1), A.success("Rolled back to this revision");
|
|
594
598
|
const _ = se(b);
|
|
595
|
-
_ && A.warning(_, { duration: 1e4 }),
|
|
599
|
+
_ && A.warning(_, { duration: 1e4 }), i != null && i.length && e.timestamp && be(e.timestamp), a == null || a();
|
|
596
600
|
},
|
|
597
601
|
onError: () => A.error("Failed to rollback")
|
|
598
602
|
});
|
|
@@ -630,7 +634,7 @@ function ft({
|
|
|
630
634
|
"aria-hidden": !0
|
|
631
635
|
}
|
|
632
636
|
),
|
|
633
|
-
!
|
|
637
|
+
!o && /* @__PURE__ */ t(
|
|
634
638
|
"span",
|
|
635
639
|
{
|
|
636
640
|
className: "absolute bottom-0 left-[15.5px] top-[30px] w-px bg-slate-200 dark:bg-border",
|
|
@@ -749,7 +753,7 @@ function ft({
|
|
|
749
753
|
onClick: () => g(!0),
|
|
750
754
|
title: "Set the whole record back to how it looked after this save",
|
|
751
755
|
children: [
|
|
752
|
-
/* @__PURE__ */ t(
|
|
756
|
+
/* @__PURE__ */ t(oe, { className: "h-3 w-3" }),
|
|
753
757
|
"Restore this version"
|
|
754
758
|
]
|
|
755
759
|
}
|
|
@@ -769,9 +773,9 @@ function ft({
|
|
|
769
773
|
ownFields: h && e.delta ? xe : null
|
|
770
774
|
}
|
|
771
775
|
),
|
|
772
|
-
z &&
|
|
776
|
+
z && i && i.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: [
|
|
773
777
|
/* @__PURE__ */ t("p", { className: "text-[10.5px] font-medium text-slate-500", children: "Also restore related rows?" }),
|
|
774
|
-
|
|
778
|
+
i.map((b) => /* @__PURE__ */ l("div", { className: "flex items-center justify-between gap-2", children: [
|
|
775
779
|
/* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: b.label }),
|
|
776
780
|
/* @__PURE__ */ t(
|
|
777
781
|
"button",
|
|
@@ -789,11 +793,11 @@ function ft({
|
|
|
789
793
|
] });
|
|
790
794
|
}
|
|
791
795
|
function bt({ data: e, meta: s }) {
|
|
792
|
-
const [d, a] = w(null), [
|
|
793
|
-
if (!
|
|
794
|
-
const c = (/* @__PURE__ */ new Date(`${
|
|
796
|
+
const [d, a] = w(null), [i, o] = w(""), [n, r] = w(""), [m, x] = w(""), p = R(() => {
|
|
797
|
+
if (!i || !e) return null;
|
|
798
|
+
const c = (/* @__PURE__ */ new Date(`${i}T23:59:59`)).getTime();
|
|
795
799
|
return e.find((y) => y.timestamp && new Date(y.timestamp).getTime() <= c) ?? null;
|
|
796
|
-
}, [
|
|
800
|
+
}, [i, e]), u = R(() => {
|
|
797
801
|
if (!n || !m || !e) return null;
|
|
798
802
|
const c = (/* @__PURE__ */ new Date(`${n}T23:59:59`)).getTime(), y = (/* @__PURE__ */ new Date(`${m}T23:59:59`)).getTime();
|
|
799
803
|
if (y <= c) return { error: "The second date must be after the first" };
|
|
@@ -817,7 +821,7 @@ function bt({ data: e, meta: s }) {
|
|
|
817
821
|
onClick: () => a(d === "asof" ? null : "asof"),
|
|
818
822
|
className: T(
|
|
819
823
|
"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11.5px] transition-colors",
|
|
820
|
-
d === "asof" ||
|
|
824
|
+
d === "asof" || i ? "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"
|
|
821
825
|
),
|
|
822
826
|
children: [
|
|
823
827
|
/* @__PURE__ */ t(Te, { className: "h-3.5 w-3.5" }),
|
|
@@ -848,29 +852,29 @@ function bt({ data: e, meta: s }) {
|
|
|
848
852
|
"input",
|
|
849
853
|
{
|
|
850
854
|
type: "date",
|
|
851
|
-
value:
|
|
852
|
-
onChange: (c) =>
|
|
855
|
+
value: i,
|
|
856
|
+
onChange: (c) => o(c.target.value),
|
|
853
857
|
className: g,
|
|
854
858
|
"aria-label": "View record as of date",
|
|
855
859
|
"data-as-of": !0
|
|
856
860
|
}
|
|
857
861
|
),
|
|
858
|
-
|
|
862
|
+
i && /* @__PURE__ */ t(
|
|
859
863
|
"button",
|
|
860
864
|
{
|
|
861
865
|
type: "button",
|
|
862
|
-
onClick: () =>
|
|
866
|
+
onClick: () => o(""),
|
|
863
867
|
className: "text-[11px] text-slate-400 hover:text-slate-600 dark:hover:text-slate-300",
|
|
864
868
|
children: "Clear"
|
|
865
869
|
}
|
|
866
870
|
)
|
|
867
871
|
] }),
|
|
868
|
-
|
|
872
|
+
i && !p && /* @__PURE__ */ t("p", { className: "mt-2 text-[12px] text-slate-400", children: "No snapshot exists at or before that date — the record is newer." }),
|
|
869
873
|
p && /* @__PURE__ */ l("div", { className: "mt-2 overflow-hidden rounded-lg border border-nvr-cyan/40 bg-white dark:bg-card", children: [
|
|
870
874
|
/* @__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: [
|
|
871
875
|
"Record as of",
|
|
872
876
|
" ",
|
|
873
|
-
p.timestamp ? new Date(p.timestamp).toLocaleString() :
|
|
877
|
+
p.timestamp ? new Date(p.timestamp).toLocaleString() : i
|
|
874
878
|
] }) }),
|
|
875
879
|
/* @__PURE__ */ t("div", { className: "max-h-80 overflow-y-auto", children: Object.entries(p.data ?? {}).filter(([, c]) => c != null && c !== "").sort(([c], [y]) => k(s, c).label.localeCompare(k(s, y).label)).map(([c, y]) => /* @__PURE__ */ l(
|
|
876
880
|
"div",
|
|
@@ -994,9 +998,9 @@ function yt({
|
|
|
994
998
|
onRollback: d,
|
|
995
999
|
inlineTableFields: a
|
|
996
1000
|
}) {
|
|
997
|
-
const
|
|
1001
|
+
const i = F(), o = ue(e, !0), { data: n, isLoading: r } = P({
|
|
998
1002
|
queryKey: ["revisions", e, s],
|
|
999
|
-
queryFn: () =>
|
|
1003
|
+
queryFn: () => i.request(q("/revisions", { collection: e, item: s })).then((f) => f.data ?? []),
|
|
1000
1004
|
staleTime: 3e4
|
|
1001
1005
|
}), m = ee();
|
|
1002
1006
|
Ie(e, s, [["revisions", e, s]], { client: m });
|
|
@@ -1023,8 +1027,8 @@ function yt({
|
|
|
1023
1027
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-600 dark:text-slate-300", children: "No history yet" }),
|
|
1024
1028
|
/* @__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." })
|
|
1025
1029
|
] }) : /* @__PURE__ */ t(te.Provider, { value: y, children: /* @__PURE__ */ l("div", { className: "space-y-3 pt-3", children: [
|
|
1026
|
-
/* @__PURE__ */ t(bt, { data: g, meta:
|
|
1027
|
-
g.length >= 3 && /* @__PURE__ */ t(vt, { revisions: g, meta:
|
|
1030
|
+
/* @__PURE__ */ t(bt, { data: g, meta: o }),
|
|
1031
|
+
g.length >= 3 && /* @__PURE__ */ t(vt, { revisions: g, meta: o }),
|
|
1028
1032
|
/* @__PURE__ */ t("div", { children: j.map((f) => /* @__PURE__ */ l("div", { children: [
|
|
1029
1033
|
/* @__PURE__ */ t("div", { className: "sticky top-0 z-10 -mx-6 border-b border-slate-100 bg-white px-6 py-1.5 dark:border-border/60 dark:bg-card", children: /* @__PURE__ */ t("span", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: f.day }) }),
|
|
1030
1034
|
f.revisions.map((N) => {
|
|
@@ -1038,7 +1042,7 @@ function yt({
|
|
|
1038
1042
|
p.has(O(N)) && "rounded-md bg-nvr-cyan/[0.06]"
|
|
1039
1043
|
),
|
|
1040
1044
|
children: [
|
|
1041
|
-
p.has(O(N)) && /* @__PURE__ */ t(
|
|
1045
|
+
p.has(O(N)) && /* @__PURE__ */ t(ie, {}),
|
|
1042
1046
|
/* @__PURE__ */ t(xt, { revision: N, isLast: h })
|
|
1043
1047
|
]
|
|
1044
1048
|
},
|
|
@@ -1053,13 +1057,13 @@ function yt({
|
|
|
1053
1057
|
p.has(O(N)) && "rounded-md bg-nvr-cyan/[0.06]"
|
|
1054
1058
|
),
|
|
1055
1059
|
children: [
|
|
1056
|
-
p.has(O(N)) && /* @__PURE__ */ t(
|
|
1060
|
+
p.has(O(N)) && /* @__PURE__ */ t(ie, {}),
|
|
1057
1061
|
/* @__PURE__ */ t(
|
|
1058
1062
|
ft,
|
|
1059
1063
|
{
|
|
1060
1064
|
revision: N,
|
|
1061
1065
|
previousData: (C == null ? void 0 : C.data) ?? null,
|
|
1062
|
-
meta:
|
|
1066
|
+
meta: o,
|
|
1063
1067
|
onRollback: d,
|
|
1064
1068
|
inlineTableFields: a,
|
|
1065
1069
|
isLast: h
|
|
@@ -1073,7 +1077,7 @@ function yt({
|
|
|
1073
1077
|
] }, f.day)) })
|
|
1074
1078
|
] }) });
|
|
1075
1079
|
}
|
|
1076
|
-
function
|
|
1080
|
+
function ie() {
|
|
1077
1081
|
return (
|
|
1078
1082
|
// Under the timeline dot, inside the row's 36px gutter.
|
|
1079
1083
|
/* @__PURE__ */ t(
|
|
@@ -1091,13 +1095,13 @@ function Mt({
|
|
|
1091
1095
|
item: s,
|
|
1092
1096
|
onRollback: d,
|
|
1093
1097
|
triggerClassName: a,
|
|
1094
|
-
inlineTableFields:
|
|
1095
|
-
open:
|
|
1098
|
+
inlineTableFields: i,
|
|
1099
|
+
open: o,
|
|
1096
1100
|
onOpenChange: n,
|
|
1097
1101
|
compact: r
|
|
1098
1102
|
}) {
|
|
1099
|
-
return /* @__PURE__ */ l(Ve, { open:
|
|
1100
|
-
!(
|
|
1103
|
+
return /* @__PURE__ */ l(Ve, { open: o, onOpenChange: n, children: [
|
|
1104
|
+
!(o !== void 0) && /* @__PURE__ */ t(ze, { asChild: !0, children: /* @__PURE__ */ l(
|
|
1101
1105
|
M,
|
|
1102
1106
|
{
|
|
1103
1107
|
variant: r ? "ghost" : "outline",
|
|
@@ -1127,14 +1131,14 @@ function Mt({
|
|
|
1127
1131
|
collection: e,
|
|
1128
1132
|
item: s,
|
|
1129
1133
|
onRollback: d,
|
|
1130
|
-
inlineTableFields:
|
|
1134
|
+
inlineTableFields: i
|
|
1131
1135
|
}
|
|
1132
1136
|
)
|
|
1133
1137
|
] }) })
|
|
1134
1138
|
] });
|
|
1135
1139
|
}
|
|
1136
1140
|
function Nt({ collection: e, item: s }) {
|
|
1137
|
-
const d = F(), a = ue(e, !0), [
|
|
1141
|
+
const d = F(), a = ue(e, !0), [i, o] = w(""), [n, r] = w(""), { data: m, isFetching: x } = P({
|
|
1138
1142
|
queryKey: ["rev-value-search", e, s, n],
|
|
1139
1143
|
queryFn: () => d.request(q("/revisions/value-search", { collection: e, item: s, q: n })).then((p) => p.data),
|
|
1140
1144
|
enabled: n.length >= 2
|
|
@@ -1145,10 +1149,10 @@ function Nt({ collection: e, item: s }) {
|
|
|
1145
1149
|
/* @__PURE__ */ t(
|
|
1146
1150
|
"input",
|
|
1147
1151
|
{
|
|
1148
|
-
value:
|
|
1149
|
-
onChange: (p) =>
|
|
1152
|
+
value: i,
|
|
1153
|
+
onChange: (p) => o(p.target.value),
|
|
1150
1154
|
onKeyDown: (p) => {
|
|
1151
|
-
p.key === "Enter" && r(
|
|
1155
|
+
p.key === "Enter" && r(i.trim());
|
|
1152
1156
|
},
|
|
1153
1157
|
placeholder: "Search this record’s history for a value — who wrote it, and when",
|
|
1154
1158
|
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"
|
|
@@ -1159,7 +1163,7 @@ function Nt({ collection: e, item: s }) {
|
|
|
1159
1163
|
{
|
|
1160
1164
|
type: "button",
|
|
1161
1165
|
onClick: () => {
|
|
1162
|
-
|
|
1166
|
+
o(""), r("");
|
|
1163
1167
|
},
|
|
1164
1168
|
className: "absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",
|
|
1165
1169
|
"aria-label": "Clear search",
|
|
@@ -1195,7 +1199,7 @@ function Nt({ collection: e, item: s }) {
|
|
|
1195
1199
|
] });
|
|
1196
1200
|
}
|
|
1197
1201
|
function kt({ revisionId: e }) {
|
|
1198
|
-
const s = F(), d = ee(), [a,
|
|
1202
|
+
const s = F(), d = ee(), [a, i] = w(""), { data: o = [] } = P({
|
|
1199
1203
|
queryKey: ["revision-notes", String(e)],
|
|
1200
1204
|
queryFn: () => s.request(q("/comments", { collection: "nivaro_revisions", item: String(e) })).then((r) => r.data ?? []).catch(() => []),
|
|
1201
1205
|
staleTime: 3e4
|
|
@@ -1204,12 +1208,12 @@ function kt({ revisionId: e }) {
|
|
|
1204
1208
|
K("/comments", { collection: "nivaro_revisions", item: String(e), text: a })
|
|
1205
1209
|
),
|
|
1206
1210
|
onSuccess: () => {
|
|
1207
|
-
|
|
1211
|
+
i(""), d.invalidateQueries({ queryKey: ["revision-notes", String(e)] });
|
|
1208
1212
|
},
|
|
1209
1213
|
onError: () => A.error("Note failed")
|
|
1210
1214
|
});
|
|
1211
1215
|
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: [
|
|
1212
|
-
|
|
1216
|
+
o.map((r) => /* @__PURE__ */ l("p", { className: "text-[11.5px] text-slate-600 dark:text-slate-300", children: [
|
|
1213
1217
|
r.text,
|
|
1214
1218
|
" ",
|
|
1215
1219
|
/* @__PURE__ */ l("span", { className: "text-[10px] text-slate-400", children: [
|
|
@@ -1231,7 +1235,7 @@ function kt({ revisionId: e }) {
|
|
|
1231
1235
|
"input",
|
|
1232
1236
|
{
|
|
1233
1237
|
value: a,
|
|
1234
|
-
onChange: (r) =>
|
|
1238
|
+
onChange: (r) => i(r.target.value),
|
|
1235
1239
|
placeholder: "Annotate this revision…",
|
|
1236
1240
|
className: "h-6 flex-1 rounded border border-slate-200 bg-transparent px-1.5 text-[11.5px] outline-none dark:border-border"
|
|
1237
1241
|
}
|
|
@@ -1254,17 +1258,17 @@ function vt({
|
|
|
1254
1258
|
revisions: e,
|
|
1255
1259
|
meta: s
|
|
1256
1260
|
}) {
|
|
1257
|
-
const d = [...e].reverse(), [a,
|
|
1261
|
+
const d = [...e].reverse(), [a, i] = w(!1), [o, n] = w(0);
|
|
1258
1262
|
qe(() => {
|
|
1259
1263
|
if (!a) return;
|
|
1260
|
-
if (
|
|
1261
|
-
|
|
1264
|
+
if (o >= d.length - 1) {
|
|
1265
|
+
i(!1);
|
|
1262
1266
|
return;
|
|
1263
1267
|
}
|
|
1264
1268
|
const x = setTimeout(() => n((p) => p + 1), 1600);
|
|
1265
1269
|
return () => clearTimeout(x);
|
|
1266
|
-
}, [a,
|
|
1267
|
-
const r = d[
|
|
1270
|
+
}, [a, o, d.length]);
|
|
1271
|
+
const r = d[o], m = r != null && r.delta ? Object.keys(r.delta).slice(0, 5).map((x) => k(s, x).label) : [];
|
|
1268
1272
|
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: [
|
|
1269
1273
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1270
1274
|
/* @__PURE__ */ t(
|
|
@@ -1272,7 +1276,7 @@ function vt({
|
|
|
1272
1276
|
{
|
|
1273
1277
|
type: "button",
|
|
1274
1278
|
onClick: () => {
|
|
1275
|
-
!a &&
|
|
1279
|
+
!a && o >= d.length - 1 && n(0), i((x) => !x);
|
|
1276
1280
|
},
|
|
1277
1281
|
className: "rounded-md bg-nvr-cyan px-2.5 py-1 text-[11.5px] font-semibold text-white",
|
|
1278
1282
|
children: a ? "Pause" : "▶ Time-lapse"
|
|
@@ -1284,16 +1288,16 @@ function vt({
|
|
|
1284
1288
|
type: "range",
|
|
1285
1289
|
min: 0,
|
|
1286
1290
|
max: Math.max(0, d.length - 1),
|
|
1287
|
-
value:
|
|
1291
|
+
value: o,
|
|
1288
1292
|
onChange: (x) => {
|
|
1289
|
-
|
|
1293
|
+
i(!1), n(Number(x.target.value));
|
|
1290
1294
|
},
|
|
1291
1295
|
className: "flex-1 accent-nvr-cyan",
|
|
1292
1296
|
"aria-label": "History position"
|
|
1293
1297
|
}
|
|
1294
1298
|
),
|
|
1295
1299
|
/* @__PURE__ */ l("span", { className: "shrink-0 tabular-nums text-[11px] text-slate-400", children: [
|
|
1296
|
-
|
|
1300
|
+
o + 1,
|
|
1297
1301
|
"/",
|
|
1298
1302
|
d.length
|
|
1299
1303
|
] })
|