@nivaro/react 0.3.15 → 0.3.16
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 +127 -6
- package/dist/index.js +736 -734
- package/dist/shared/components/CollectionBrowserView.js +2344 -2309
- package/dist/shared/components/ItemEditForm.js +3773 -3604
- package/dist/shared/components/RecordGridEditor.js +319 -282
- package/dist/shared/components/RecordReadView.js +202 -200
- package/dist/shared/components/cbv/unknown-fields.js +18 -8
- package/dist/shared/components/import/DocumentAutofillButton.js +148 -142
- package/dist/shared/components/item-edit/CatalogPickerField.js +264 -276
- package/dist/shared/components/item-edit/FieldRenderer.js +136 -133
- package/dist/shared/components/item-edit/FieldRow.js +198 -184
- package/dist/shared/components/item-edit/HeaderTools.js +107 -99
- package/dist/shared/components/item-edit/InlineTableField.js +138 -136
- package/dist/shared/components/item-edit/RecordLiveSync.js +1 -0
- package/dist/shared/components/item-edit/RelationCombobox.js +30 -23
- package/dist/shared/components/item-edit/SummaryPanel.js +334 -294
- package/dist/shared/components/item-edit/column-length.js +12 -0
- package/dist/shared/components/panels/AccessDeniedPanel.js +47 -37
- package/dist/shared/components/panels/ItemLockBanner.js +307 -285
- package/dist/shared/components/panels/PipelinePanel.js +486 -465
- package/dist/shared/components/panels/RevisionsPanel.js +210 -204
- package/dist/shared/components/profile/DelegationCard.js +178 -121
- package/dist/shared/components/profile/PersonActivity.js +152 -139
- package/dist/shared/components/queue/QueueWorklist.js +668 -659
- package/dist/shared/components/queue/transition-note.js +90 -0
- package/dist/shared/components/support/SupportRequestDialog.js +100 -89
- package/dist/shared/components/support/TicketDetailSheet.js +104 -91
- package/dist/shared/lib/autofill-runs.js +33 -26
- package/dist/shared/lib/draft-store.js +40 -24
- package/dist/shared/lib/live-queries.js +10 -9
- package/dist/shared/lib/restore-skipped.js +10 -0
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as c, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as k } from "@tanstack/react-query";
|
|
3
|
-
import { ChevronDown as Ne, Loader2 as ne, AlertTriangle as Ee, Search as
|
|
4
|
-
import { useState as q, useRef as X, useEffect as E, useLayoutEffect as Ke, useMemo as
|
|
3
|
+
import { ChevronDown as Ne, Loader2 as ne, AlertTriangle as Ee, Search as Ie, X as Oe, Check as ke } from "lucide-react";
|
|
4
|
+
import { useState as q, useRef as X, useEffect as E, useLayoutEffect as Ke, useMemo as A } from "react";
|
|
5
5
|
import { createPortal as Se } from "react-dom";
|
|
6
|
-
import { useNivaroClient as se, useItemEditAuth as
|
|
6
|
+
import { useNivaroClient as se, useItemEditAuth as Ue, useStaleFieldReporter as Ae } from "../../context.js";
|
|
7
7
|
import { get as $, post as Me } from "../../lib/commands.js";
|
|
8
8
|
import { useRecordReader as _e } from "../../lib/record-loader.js";
|
|
9
9
|
import { useOnlineUsers as Pe } from "../../lib/use-online-users.js";
|
|
@@ -52,7 +52,7 @@ function Xe({
|
|
|
52
52
|
pinned: p,
|
|
53
53
|
missPlacement: _
|
|
54
54
|
}) {
|
|
55
|
-
const j = se(), oe = _e(), [x,
|
|
55
|
+
const j = se(), oe = _e(), [x, I] = q(!1), [R, ie] = q(""), [T, le] = q(""), ae = X(null), P = X(null);
|
|
56
56
|
E(() => {
|
|
57
57
|
x ? setTimeout(() => {
|
|
58
58
|
var e;
|
|
@@ -66,7 +66,7 @@ function Xe({
|
|
|
66
66
|
const e = (o) => {
|
|
67
67
|
var l;
|
|
68
68
|
const t = o.target;
|
|
69
|
-
(l = t == null ? void 0 : t.closest) != null && l.call(t, "[data-nvr-combobox-panel]") || P.current && !P.current.contains(o.target) &&
|
|
69
|
+
(l = t == null ? void 0 : t.closest) != null && l.call(t, "[data-nvr-combobox-panel]") || P.current && !P.current.contains(o.target) && I(!1);
|
|
70
70
|
};
|
|
71
71
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
72
72
|
}, [x]);
|
|
@@ -114,7 +114,7 @@ function Xe({
|
|
|
114
114
|
),
|
|
115
115
|
enabled: !!(i != null && i.length),
|
|
116
116
|
staleTime: 10 * 6e4
|
|
117
|
-
}), $e =
|
|
117
|
+
}), $e = A(() => {
|
|
118
118
|
const e = {};
|
|
119
119
|
for (const o of i ?? []) {
|
|
120
120
|
const t = ue.find(
|
|
@@ -123,14 +123,14 @@ function Xe({
|
|
|
123
123
|
t != null && t.one_collection && (e[o.field] = t.one_collection);
|
|
124
124
|
}
|
|
125
125
|
return e;
|
|
126
|
-
}, [i, ue, s]), F = s === "nivaro_users", Le = Pe(F), me =
|
|
126
|
+
}, [i, ue, s]), F = s === "nivaro_users", Le = Pe(F), me = Ue().isAdmin, B = A(() => {
|
|
127
127
|
const e = [];
|
|
128
128
|
F && e.push(Je(me)), f && e.push(f);
|
|
129
129
|
for (const [o, t] of Object.entries(Z))
|
|
130
130
|
t != null && t !== "" && e.push({ [o]: { _eq: t } });
|
|
131
131
|
if (e.length !== 0)
|
|
132
132
|
return e.length === 1 ? e[0] : { _and: e };
|
|
133
|
-
}, [f, Z, me]), D = (V == null ? void 0 : V.display_template) ?? (F ? "{{first_name}} {{last_name}} ({{email}})" : null), y =
|
|
133
|
+
}, [f, Z, me]), D = (V == null ? void 0 : V.display_template) ?? (F ? "{{first_name}} {{last_name}} ({{email}})" : null), y = A(() => {
|
|
134
134
|
if (!D) return;
|
|
135
135
|
const e = [...D.matchAll(/\{\{([\w.]+)\}\}/g)].map((o) => o[1]);
|
|
136
136
|
if (e.length)
|
|
@@ -169,7 +169,7 @@ function Xe({
|
|
|
169
169
|
queryFn: () => oe(s, r, y),
|
|
170
170
|
enabled: !!r,
|
|
171
171
|
staleTime: 6e4
|
|
172
|
-
}), g = (p == null ? void 0 : p.id) != null && p.id !== "" ? String(p.id) : null, { data:
|
|
172
|
+
}), g = (p == null ? void 0 : p.id) != null && p.id !== "" ? String(p.id) : null, { data: O } = k({
|
|
173
173
|
queryKey: ["relation-single", s, g ?? "", y],
|
|
174
174
|
queryFn: () => oe(s, g, y).catch(
|
|
175
175
|
() => null
|
|
@@ -214,10 +214,10 @@ function Xe({
|
|
|
214
214
|
H.current = null;
|
|
215
215
|
}));
|
|
216
216
|
}, [m, h, Y, s, N]);
|
|
217
|
-
const w = D, fe = r && z ? v(w, z) : null, W =
|
|
217
|
+
const w = D, fe = r && z ? v(w, z) : null, W = A(
|
|
218
218
|
() => ze(b ?? [], (e) => v(w, e) || `#${e.id}`),
|
|
219
219
|
[b, w]
|
|
220
|
-
), { data:
|
|
220
|
+
), { data: U } = k({
|
|
221
221
|
queryKey: ["relation-opts-dups", s, W.join(",")],
|
|
222
222
|
queryFn: () => j.request(
|
|
223
223
|
$(`/items/${s}`, {
|
|
@@ -229,15 +229,15 @@ function Xe({
|
|
|
229
229
|
).then((e) => e.data ?? []),
|
|
230
230
|
enabled: x && W.length > 0 && !F,
|
|
231
231
|
staleTime: 6e4
|
|
232
|
-
}), be =
|
|
233
|
-
if (!(
|
|
232
|
+
}), be = A(() => {
|
|
233
|
+
if (!(U != null && U.length)) return /* @__PURE__ */ new Map();
|
|
234
234
|
const e = new Map(
|
|
235
235
|
(b ?? []).map((t) => [
|
|
236
236
|
String(t.id),
|
|
237
237
|
(v(w, t) || `#${t.id}`).trim().toLowerCase()
|
|
238
238
|
])
|
|
239
239
|
), o = /* @__PURE__ */ new Map();
|
|
240
|
-
for (const t of
|
|
240
|
+
for (const t of U) {
|
|
241
241
|
const l = e.get(String(t.id));
|
|
242
242
|
l !== void 0 && o.set(l, [...o.get(l) ?? [], t]);
|
|
243
243
|
}
|
|
@@ -245,7 +245,7 @@ function Xe({
|
|
|
245
245
|
[...o.values()],
|
|
246
246
|
((y == null ? void 0 : y.split(",")) ?? []).map((t) => t.split(".")[0])
|
|
247
247
|
);
|
|
248
|
-
}, [
|
|
248
|
+
}, [U, b, w, y]), Fe = !!r && je && !z, ge = We(K), re = Ae();
|
|
249
249
|
return E(() => {
|
|
250
250
|
!re || !C || Q === void 0 || re(C, K);
|
|
251
251
|
}, [re, C, K, Q]), L ? /* @__PURE__ */ c(
|
|
@@ -272,7 +272,7 @@ function Xe({
|
|
|
272
272
|
{
|
|
273
273
|
type: "button",
|
|
274
274
|
disabled: h,
|
|
275
|
-
onClick: () =>
|
|
275
|
+
onClick: () => I((e) => !e),
|
|
276
276
|
className: M(
|
|
277
277
|
"flex h-9 w-full items-center justify-between gap-2 rounded-md border bg-background px-3 text-sm text-left hover:bg-muted disabled:pointer-events-none disabled:opacity-50",
|
|
278
278
|
K ? "border-amber-300 dark:border-amber-600" : "border-input"
|
|
@@ -325,7 +325,7 @@ function Xe({
|
|
|
325
325
|
] }, e.field) : null;
|
|
326
326
|
}) }),
|
|
327
327
|
/* @__PURE__ */ c("div", { className: "flex items-center border-b px-3", children: [
|
|
328
|
-
/* @__PURE__ */ n(
|
|
328
|
+
/* @__PURE__ */ n(Ie, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
329
329
|
/* @__PURE__ */ n(
|
|
330
330
|
"input",
|
|
331
331
|
{
|
|
@@ -343,11 +343,11 @@ function Xe({
|
|
|
343
343
|
{
|
|
344
344
|
type: "button",
|
|
345
345
|
onClick: () => {
|
|
346
|
-
Te(),
|
|
346
|
+
Te(), I(!1);
|
|
347
347
|
},
|
|
348
348
|
className: "flex w-full items-center gap-2 px-3 py-1.5 text-[13px] text-slate-500 hover:bg-muted border-b border-slate-100 dark:text-slate-400 dark:border-border",
|
|
349
349
|
children: [
|
|
350
|
-
/* @__PURE__ */ n(
|
|
350
|
+
/* @__PURE__ */ n(Oe, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
351
351
|
"Clear selection"
|
|
352
352
|
]
|
|
353
353
|
}
|
|
@@ -358,7 +358,7 @@ function Xe({
|
|
|
358
358
|
type: "button",
|
|
359
359
|
"data-nvr-pinned-option": !0,
|
|
360
360
|
onClick: () => {
|
|
361
|
-
d((
|
|
361
|
+
d((O == null ? void 0 : O.id) ?? (p == null ? void 0 : p.id)), I(!1);
|
|
362
362
|
},
|
|
363
363
|
className: "flex w-full items-center gap-2 border-b border-slate-100 bg-nvr-cyan/5 px-3 py-1.5 text-left text-[13px] hover:bg-nvr-cyan/10 dark:border-border",
|
|
364
364
|
children: [
|
|
@@ -372,7 +372,7 @@ function Xe({
|
|
|
372
372
|
children: String(r) === g && /* @__PURE__ */ n(ke, { className: "h-2.5 w-2.5 text-white" })
|
|
373
373
|
}
|
|
374
374
|
),
|
|
375
|
-
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate", children:
|
|
375
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate", children: O ? v(w, O) || `#${g}` : `#${g}` }),
|
|
376
376
|
/* @__PURE__ */ n("span", { className: "shrink-0 rounded bg-nvr-cyan/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-slate-700 dark:text-foreground", children: (p == null ? void 0 : p.tag) ?? "Default" })
|
|
377
377
|
]
|
|
378
378
|
}
|
|
@@ -409,7 +409,7 @@ function Xe({
|
|
|
409
409
|
{
|
|
410
410
|
type: "button",
|
|
411
411
|
onClick: () => {
|
|
412
|
-
d(e.id),
|
|
412
|
+
d(e.id), I(!1);
|
|
413
413
|
},
|
|
414
414
|
className: "flex w-full items-center gap-2 px-3 py-1.5 text-[13px] text-left hover:bg-muted",
|
|
415
415
|
children: [
|
|
@@ -532,7 +532,14 @@ function ut({
|
|
|
532
532
|
return i.length > 0 ? ["id", ...i].join(",") : null;
|
|
533
533
|
})(), { data: u, isLoading: L } = k({
|
|
534
534
|
queryKey: ["relation-single", s, String(r), m ?? ""],
|
|
535
|
-
queryFn: () => f ?
|
|
535
|
+
queryFn: () => f ? (
|
|
536
|
+
// The file's row, not its bytes: GET /files/:id downloads the whole
|
|
537
|
+
// file (twice with the retry, 404 when storage lost it) only to read
|
|
538
|
+
// its name, and a missing object left the raw id as the label.
|
|
539
|
+
h.request(
|
|
540
|
+
$(`/files/${encodeURIComponent(String(r))}/meta`)
|
|
541
|
+
).then((i) => i.data)
|
|
542
|
+
) : S(s, r, m),
|
|
536
543
|
enabled: !!r && !!s,
|
|
537
544
|
staleTime: 6e4
|
|
538
545
|
});
|