@nivaro/react 0.3.98 → 0.3.100
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/useFormSchema.js +82 -85
- package/dist/hooks/useSessionRecorder.js +206 -175
- package/dist/index.d.ts +38 -13
- package/dist/index.js +182 -180
- package/dist/lib/commands.js +15 -11
- package/dist/shared/components/CollectionBrowserView.js +516 -503
- package/dist/shared/components/ItemEditForm.js +3021 -3019
- package/dist/shared/components/JobsTray.js +20 -16
- package/dist/shared/components/MyWorkView.js +133 -126
- package/dist/shared/components/NotificationBell.js +314 -288
- package/dist/shared/components/RecordCompare.js +38 -40
- package/dist/shared/components/RecordReadView.js +119 -119
- package/dist/shared/components/cbv/FoundElsewhere.js +61 -0
- package/dist/shared/components/item-edit/InlineGridField.js +45 -45
- package/dist/shared/components/item-edit/InlineTableField.js +750 -749
- package/dist/shared/components/item-edit/QuickPickerDialog.js +44 -44
- package/dist/shared/components/item-edit/RawEditSheet.js +122 -114
- package/dist/shared/components/item-edit/RelationCombobox.js +454 -378
- package/dist/shared/components/item-edit/SummaryPanel.js +56 -48
- package/dist/shared/components/item-edit/related-missing.js +75 -19
- package/dist/shared/components/notifications/NotificationCenterView.js +249 -226
- package/dist/shared/components/panels/AccessDeniedPanel.js +31 -28
- package/dist/shared/components/panels/BackgroundMove.js +175 -0
- package/dist/shared/components/panels/MoveAdvisory.js +204 -0
- package/dist/shared/components/panels/PipelinePanel.js +1450 -1219
- package/dist/shared/components/panels/RecordIntegrityBanner.js +113 -112
- package/dist/shared/lib/commands.js +18 -14
- package/dist/shared/lib/error-hints.js +1 -1
- package/dist/shared/lib/job-failure-text.js +12 -0
- package/dist/shared/lib/move-failure.js +9 -0
- package/dist/shared/lib/obligation-banner.js +15 -14
- package/dist/shared/lib/partner-failure.js +71 -0
- package/dist/shared/lib/prefetch.js +73 -73
- package/dist/shared/lib/replay-checkout.js +18 -13
- package/dist/shared/lib/replay-context.js +90 -77
- package/dist/shared/lib/replay-idle.js +21 -0
- package/dist/shared/lib/replay-socket.js +21 -17
- package/dist/shared/lib/rum.js +56 -51
- package/dist/shared/lib/safe-error.js +17 -13
- package/dist/shared/lib/stale-chunk.js +69 -26
- package/dist/shared/lib/system-collections.js +20 -0
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as i, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import { useQueries as
|
|
3
|
-
import { X as
|
|
4
|
-
import { useRef as
|
|
2
|
+
import { useQueries as L, useQuery as M } from "@tanstack/react-query";
|
|
3
|
+
import { X as A } from "lucide-react";
|
|
4
|
+
import { useRef as D, useEffect as K, useState as O } from "react";
|
|
5
5
|
import { createPortal as B } from "react-dom";
|
|
6
6
|
import { useNivaroClient as I } from "../context.js";
|
|
7
|
-
import { get as
|
|
8
|
-
import { formSections as
|
|
9
|
-
import { friendlyIdOf as
|
|
10
|
-
import { cn as R, titleCase as
|
|
7
|
+
import { get as F, getActiveLayout as Q } from "../lib/commands.js";
|
|
8
|
+
import { formSections as X } from "../lib/form-sections.js";
|
|
9
|
+
import { friendlyIdOf as J, recordRefLabel as P } from "../lib/record-ref.js";
|
|
10
|
+
import { cn as R, titleCase as G } from "../lib/utils.js";
|
|
11
11
|
import { Skeleton as _ } from "./ui/skeleton.js";
|
|
12
|
-
function
|
|
12
|
+
function H(r) {
|
|
13
13
|
if (r == null || r === "") return "";
|
|
14
14
|
if (typeof r == "boolean") return r ? "true" : "false";
|
|
15
15
|
if (typeof r == "object")
|
|
@@ -21,7 +21,7 @@ function G(r) {
|
|
|
21
21
|
const a = String(r).trim(), u = Number(a);
|
|
22
22
|
return a !== "" && Number.isFinite(u) ? String(Math.round(u * 100) / 100) : a;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function U(r) {
|
|
25
25
|
const { records: a, forms: u, labels: y } = r, g = {
|
|
26
26
|
key: "__fields__",
|
|
27
27
|
label: "Fields",
|
|
@@ -51,11 +51,11 @@ function H(r) {
|
|
|
51
51
|
return { absent: h, value: h || !f ? null : f[n] };
|
|
52
52
|
}), b = d.filter((f) => !f.absent);
|
|
53
53
|
if (b.length === 0) return [];
|
|
54
|
-
const o = b.length > 1 && new Set(b.map((f) =>
|
|
54
|
+
const o = b.length > 1 && new Set(b.map((f) => H(f.value))).size > 1;
|
|
55
55
|
return [
|
|
56
56
|
{
|
|
57
57
|
field: n,
|
|
58
|
-
label: w.get(n) || y[n] ||
|
|
58
|
+
label: w.get(n) || y[n] || G(n),
|
|
59
59
|
cells: d,
|
|
60
60
|
differs: o
|
|
61
61
|
}
|
|
@@ -63,52 +63,50 @@ function H(r) {
|
|
|
63
63
|
})
|
|
64
64
|
})).filter((l) => l.rows.length > 0);
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
const m =
|
|
66
|
+
function V(r, a, u, y, g) {
|
|
67
|
+
const m = J(r, a);
|
|
68
68
|
if (m) return m;
|
|
69
69
|
if (r && a) {
|
|
70
|
-
const p =
|
|
70
|
+
const p = P(r, a, u, y);
|
|
71
71
|
if (p && p !== String(u)) return p;
|
|
72
72
|
}
|
|
73
73
|
return `Record ${g + 1}`;
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const W = {
|
|
76
76
|
record: "Not available",
|
|
77
77
|
form: "Not on this form",
|
|
78
78
|
hidden: "Not visible to you"
|
|
79
79
|
};
|
|
80
|
-
function
|
|
80
|
+
function de({
|
|
81
81
|
collection: r,
|
|
82
82
|
ids: a,
|
|
83
83
|
fields: u,
|
|
84
84
|
renderValue: y,
|
|
85
85
|
onClose: g
|
|
86
86
|
}) {
|
|
87
|
-
const m = I(), p =
|
|
87
|
+
const m = I(), p = L({
|
|
88
88
|
queries: a.map((e) => ({
|
|
89
89
|
queryKey: ["cbv-compare", r, String(e)],
|
|
90
|
-
queryFn: () => m.request(
|
|
90
|
+
queryFn: () => m.request(F(`/items/${r}/${e}`)).then((t) => t.data ?? null).catch(() => null),
|
|
91
91
|
staleTime: 3e4
|
|
92
92
|
}))
|
|
93
|
-
}), N =
|
|
93
|
+
}), N = L({
|
|
94
94
|
queries: a.map((e) => ({
|
|
95
95
|
queryKey: ["compare-form", r, String(e)],
|
|
96
|
-
queryFn: () => m.request(
|
|
97
|
-
$("/collection-layouts/active", { collection: r, item: String(e) })
|
|
98
|
-
).then((t) => t.data ?? null).catch(() => null),
|
|
96
|
+
queryFn: () => m.request(Q({ collection: r, item: String(e) })).then((t) => t.data ?? null).catch(() => null),
|
|
99
97
|
staleTime: 3e4
|
|
100
98
|
}))
|
|
101
|
-
}), k =
|
|
99
|
+
}), k = M({
|
|
102
100
|
queryKey: ["bulk-fields-config", r],
|
|
103
101
|
queryFn: () => m.request(
|
|
104
|
-
|
|
102
|
+
F(`/field-config/${r}`)
|
|
105
103
|
).then((e) => Array.isArray(e.data) ? e.data : []),
|
|
106
104
|
staleTime: 6e4
|
|
107
|
-
}), w =
|
|
105
|
+
}), w = M({
|
|
108
106
|
queryKey: ["cbv-collection-meta", r],
|
|
109
|
-
queryFn: () => m.request(
|
|
107
|
+
queryFn: () => m.request(F(`/collections/${r}`)).then((e) => e.data ?? null).catch(() => null),
|
|
110
108
|
staleTime: 10 * 6e4
|
|
111
|
-
}), S =
|
|
109
|
+
}), S = D(null);
|
|
112
110
|
K(() => {
|
|
113
111
|
var t;
|
|
114
112
|
const e = document.activeElement;
|
|
@@ -125,22 +123,22 @@ function ie({
|
|
|
125
123
|
const l = p.some((e) => e.isLoading) || N.some((e) => e.isLoading), n = p.map((e) => e.data ?? null), d = N.map((e) => e.data ?? null), b = {}, o = /* @__PURE__ */ new Map();
|
|
126
124
|
for (const e of k.data ?? [])
|
|
127
125
|
b[e.field] = e.label, o.set(e.field, e);
|
|
128
|
-
const f = (e) =>
|
|
126
|
+
const f = (e) => V(w.data ?? null, n[e], a[e], r, e), v = l ? [] : U({
|
|
129
127
|
records: n,
|
|
130
128
|
forms: d.map(
|
|
131
|
-
(e) => e ?
|
|
129
|
+
(e) => e ? X(e.groups ?? [], e.assignments ?? [], {
|
|
132
130
|
ungroupedSort: e.ungrouped_sort
|
|
133
131
|
}) : null
|
|
134
132
|
),
|
|
135
133
|
labels: b,
|
|
136
134
|
fallback: u.filter((e) => !e.hidden && e.field !== "id").map((e) => e.field)
|
|
137
|
-
}), [h, j] =
|
|
135
|
+
}), [h, j] = O(!1), q = v.reduce((e, t) => e + t.rows.filter((s) => s.differs).length, 0), C = h ? v.map((e) => ({ ...e, rows: e.rows.filter((t) => t.differs) })).filter((e) => e.rows.length > 0) : v, T = d.map((e) => {
|
|
138
136
|
var t;
|
|
139
137
|
return ((t = e == null ? void 0 : e.layout) == null ? void 0 : t.name) ?? null;
|
|
140
138
|
}), E = new Set(d.map((e) => {
|
|
141
139
|
var t;
|
|
142
140
|
return ((t = e == null ? void 0 : e.layout) == null ? void 0 : t.id) ?? null;
|
|
143
|
-
})).size === 1,
|
|
141
|
+
})).size === 1, $ = { gridTemplateColumns: `minmax(160px, 220px) repeat(${a.length}, minmax(0, 1fr))` };
|
|
144
142
|
return B(
|
|
145
143
|
// biome-ignore lint/a11y/noStaticElementInteractions: backdrop click closes; Escape is the keyboard path
|
|
146
144
|
/* @__PURE__ */ i(
|
|
@@ -188,7 +186,7 @@ function ie({
|
|
|
188
186
|
onClick: g,
|
|
189
187
|
"aria-label": "Close",
|
|
190
188
|
className: "rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
191
|
-
children: /* @__PURE__ */ i(
|
|
189
|
+
children: /* @__PURE__ */ i(A, { className: "h-4 w-4" })
|
|
192
190
|
}
|
|
193
191
|
)
|
|
194
192
|
] }),
|
|
@@ -197,7 +195,7 @@ function ie({
|
|
|
197
195
|
"div",
|
|
198
196
|
{
|
|
199
197
|
className: "sticky top-0 z-[1] grid border-b border-border bg-slate-50 dark:bg-background",
|
|
200
|
-
style:
|
|
198
|
+
style: $,
|
|
201
199
|
children: [
|
|
202
200
|
/* @__PURE__ */ i("span", { className: "px-3 py-2 text-[11.5px] font-medium text-muted-foreground", children: "Field" }),
|
|
203
201
|
a.map((e, t) => /* @__PURE__ */ c("span", { className: "min-w-0 px-3 py-2", children: [
|
|
@@ -214,7 +212,7 @@ function ie({
|
|
|
214
212
|
]
|
|
215
213
|
}
|
|
216
214
|
),
|
|
217
|
-
l ? /* @__PURE__ */ i("div", { className: "space-y-2 p-4", "aria-busy": "true", children: [0, 1, 2, 3, 4].map((e) => /* @__PURE__ */ c("div", { className: "grid gap-3", style:
|
|
215
|
+
l ? /* @__PURE__ */ i("div", { className: "space-y-2 p-4", "aria-busy": "true", children: [0, 1, 2, 3, 4].map((e) => /* @__PURE__ */ c("div", { className: "grid gap-3", style: $, children: [
|
|
218
216
|
/* @__PURE__ */ i(_, { className: "h-4 w-28" }),
|
|
219
217
|
a.map((t) => /* @__PURE__ */ i(_, { className: "h-4 w-full" }, String(t)))
|
|
220
218
|
] }, e)) }) : n.every((e) => e == null) ? /* @__PURE__ */ i("p", { className: "px-4 py-8 text-center text-[12.5px] text-muted-foreground", children: "These records could not be opened. They may have been deleted, or you may no longer have access." }) : C.length === 0 ? /* @__PURE__ */ i("p", { className: "px-4 py-8 text-center text-[12.5px] text-muted-foreground", children: h ? "Every field you can see holds the same value." : "Nothing to compare." }) : C.map((e) => {
|
|
@@ -237,7 +235,7 @@ function ie({
|
|
|
237
235
|
"grid border-b border-slate-100 text-[12.5px] dark:border-border/60",
|
|
238
236
|
s.differs && "bg-amber-50 dark:bg-amber-400/10"
|
|
239
237
|
),
|
|
240
|
-
style:
|
|
238
|
+
style: $,
|
|
241
239
|
children: [
|
|
242
240
|
/* @__PURE__ */ i("span", { className: "min-w-0 px-3 py-1.5 text-muted-foreground", children: s.label }),
|
|
243
241
|
s.cells.map((x, z) => /* @__PURE__ */ i(
|
|
@@ -247,7 +245,7 @@ function ie({
|
|
|
247
245
|
"min-w-0 break-words px-3 py-1.5 tabular-nums",
|
|
248
246
|
x.absent ? "text-[11.5px] italic text-muted-foreground" : s.differs ? "font-medium text-foreground" : "text-slate-600 dark:text-slate-300"
|
|
249
247
|
),
|
|
250
|
-
children: x.absent ?
|
|
248
|
+
children: x.absent ? W[x.absent] : x.value == null || x.value === "" ? /* @__PURE__ */ i("span", { className: "text-muted-foreground", children: "—" }) : y(s.field, x.value, o.get(s.field))
|
|
251
249
|
},
|
|
252
250
|
z
|
|
253
251
|
))
|
|
@@ -267,8 +265,8 @@ function ie({
|
|
|
267
265
|
);
|
|
268
266
|
}
|
|
269
267
|
export {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
268
|
+
de as RecordCompareDialog,
|
|
269
|
+
U as buildCompare,
|
|
270
|
+
H as compareKey,
|
|
271
|
+
V as compareSideName
|
|
274
272
|
};
|