@nivaro/react 0.3.10 → 0.3.11
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/useNivaroForm.js +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +34 -3
- package/dist/shared/components/CollectionBrowserView.js +1546 -1477
- package/dist/shared/components/ItemEditForm.js +4332 -4195
- package/dist/shared/components/PageRenderer.js +512 -465
- package/dist/shared/components/QueryStatStrip.js +74 -70
- package/dist/shared/components/ReportView.js +818 -827
- package/dist/shared/components/SheetHeaderBody.js +16 -14
- package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
- package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
- package/dist/shared/components/item-edit/FieldRow.js +20 -19
- package/dist/shared/components/item-edit/FilePickerField.js +52 -40
- package/dist/shared/components/item-edit/GroupSection.js +221 -221
- package/dist/shared/components/item-edit/InlineGridField.js +41 -41
- package/dist/shared/components/item-edit/InlineTableField.js +2249 -2238
- package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
- package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
- package/dist/shared/components/item-edit/QuickPicker.js +263 -216
- package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
- package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
- package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
- package/dist/shared/components/item-edit/helpers.js +133 -134
- package/dist/shared/components/item-edit/line-qty.js +57 -0
- package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
- package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
- package/dist/shared/components/panels/CommentPanel.js +350 -315
- package/dist/shared/components/panels/ItemLockBanner.js +297 -230
- package/dist/shared/components/panels/PipelinePanel.js +719 -701
- package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
- package/dist/shared/components/queue/QueueWorklist.js +1005 -935
- package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
- package/dist/shared/lib/obligation-banner.js +14 -13
- package/dist/shared/lib/obligation-reason-text.js +13 -0
- package/dist/shared/lib/query-filter-seed.js +34 -11
- package/dist/shared/lib/sanitize-html.js +24 -15
- package/dist/shared/lib/sheet-def.js +38 -22
- package/dist/shared/lib/unique-options.js +10 -0
- package/dist/shared/lib/utils.js +57 -43
- package/dist/shared/lib/validation-rules.js +58 -34
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import F from "@tiptap/extension-placeholder";
|
|
|
5
5
|
import J from "@tiptap/extension-underline";
|
|
6
6
|
import { useEditor as P, EditorContent as K } from "@tiptap/react";
|
|
7
7
|
import W from "@tiptap/starter-kit";
|
|
8
|
-
import { Bold as z, Italic as Q, UnderlineIcon as V, Strikethrough as X, Heading1 as G, Heading2 as Y, Heading3 as Z, List as ee, ListOrdered as te, Quote as re, Code as ie, Minus as ne, Link as
|
|
8
|
+
import { Bold as z, Italic as Q, UnderlineIcon as V, Strikethrough as X, Heading1 as G, Heading2 as Y, Heading3 as Z, List as ee, ListOrdered as te, Quote as re, Code as ie, Minus as ne, Link as ae, Link2Off as oe, FileSymlink as E, Check as le, X as I, Loader2 as se } from "lucide-react";
|
|
9
9
|
import { useState as v, useRef as T, useMemo as ce, useEffect as R } from "react";
|
|
10
10
|
import { useApiFetchConfig as de, useItemNavigation as pe } from "../../context.js";
|
|
11
11
|
import { cn as j } from "../../lib/utils.js";
|
|
@@ -16,20 +16,20 @@ function S(i) {
|
|
|
16
16
|
function B(i) {
|
|
17
17
|
try {
|
|
18
18
|
return (JSON.parse(i || "{}").blocks ?? []).map((l) => {
|
|
19
|
-
const
|
|
19
|
+
const a = S(String(l.data.text ?? "")), o = Math.max(1, Math.min(6, Number(l.data.level ?? 2)));
|
|
20
20
|
switch (l.type) {
|
|
21
21
|
case "paragraph":
|
|
22
|
-
return `<p>${
|
|
22
|
+
return `<p>${a}</p>`;
|
|
23
23
|
case "header":
|
|
24
|
-
return `<h${
|
|
24
|
+
return `<h${o}>${a}</h${o}>`;
|
|
25
25
|
case "list": {
|
|
26
26
|
const c = (l.data.items ?? []).map((m) => `<li>${S(m)}</li>`).join("");
|
|
27
27
|
return l.data.style === "ordered" ? `<ol>${c}</ol>` : `<ul>${c}</ul>`;
|
|
28
28
|
}
|
|
29
29
|
case "quote":
|
|
30
|
-
return `<blockquote><p>${
|
|
30
|
+
return `<blockquote><p>${a}</p></blockquote>`;
|
|
31
31
|
default:
|
|
32
|
-
return
|
|
32
|
+
return a ? `<p>${a}</p>` : "";
|
|
33
33
|
}
|
|
34
34
|
}).join("");
|
|
35
35
|
} catch {
|
|
@@ -40,21 +40,21 @@ function s({
|
|
|
40
40
|
active: i,
|
|
41
41
|
title: u,
|
|
42
42
|
onClick: l,
|
|
43
|
-
children:
|
|
43
|
+
children: a
|
|
44
44
|
}) {
|
|
45
45
|
return /* @__PURE__ */ e(
|
|
46
46
|
"button",
|
|
47
47
|
{
|
|
48
48
|
type: "button",
|
|
49
49
|
title: u,
|
|
50
|
-
onMouseDown: (
|
|
51
|
-
|
|
50
|
+
onMouseDown: (o) => {
|
|
51
|
+
o.preventDefault(), l();
|
|
52
52
|
},
|
|
53
53
|
className: j(
|
|
54
54
|
"flex h-6 w-6 items-center justify-center rounded text-slate-500 transition-colors hover:bg-slate-200 hover:text-slate-700 dark:text-slate-300 dark:hover:bg-[#334155] dark:hover:text-white",
|
|
55
55
|
i && "bg-slate-200 text-slate-900 dark:bg-[#334155] dark:text-white"
|
|
56
56
|
),
|
|
57
|
-
children:
|
|
57
|
+
children: a
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
60
|
}
|
|
@@ -65,26 +65,36 @@ function De({
|
|
|
65
65
|
value: i,
|
|
66
66
|
onChange: u,
|
|
67
67
|
placeholder: l,
|
|
68
|
-
disabled:
|
|
69
|
-
pastePlain:
|
|
68
|
+
disabled: a,
|
|
69
|
+
pastePlain: o
|
|
70
70
|
}) {
|
|
71
71
|
const [c, m] = v(!1), [g, _] = v(""), [k, y] = v(!1), w = T(null), f = de(), N = pe(), h = ce(() => i ? i.trimStart().startsWith('{"time":') && i.includes('"blocks":') ? B(i) : i : "", [i]), t = P({
|
|
72
72
|
immediatelyRender: !1,
|
|
73
73
|
extensions: [
|
|
74
|
-
|
|
74
|
+
// StarterKit 3 bundles its own Link (autolink on) and Underline; they are
|
|
75
|
+
// registered below with this editor's options, so the kit's copies stay out.
|
|
76
|
+
W.configure({
|
|
77
|
+
bulletList: { keepMarks: !0 },
|
|
78
|
+
orderedList: { keepMarks: !0 },
|
|
79
|
+
link: !1,
|
|
80
|
+
underline: !1
|
|
81
|
+
}),
|
|
75
82
|
J,
|
|
76
83
|
F.configure({ placeholder: l ?? "Start writing…" }),
|
|
77
84
|
// 'record' protocol (#666): record://<collection>/<id> links survive the
|
|
78
85
|
// Link extension's allowed-URI validation and render as record chips.
|
|
79
|
-
|
|
86
|
+
// No autolink while typing: EFP site codes read like domains (byron.il,
|
|
87
|
+
// oswego.il) and every one became a bogus http:// link in notes that go
|
|
88
|
+
// to suppliers. Links are explicit — the toolbar, or pasting a URL.
|
|
89
|
+
U.configure({ openOnClick: !1, autolink: !1, protocols: ["record"] })
|
|
80
90
|
],
|
|
81
91
|
content: h,
|
|
82
|
-
editable: !
|
|
92
|
+
editable: !a,
|
|
83
93
|
// NEVER undefined: an explicit `editorProps: undefined` overrides tiptap's
|
|
84
94
|
// `{}` default in the options merge, and 3.26's createView reads
|
|
85
95
|
// `editorProps.dispatchTransaction` unguarded — every non-pastePlain
|
|
86
96
|
// editor crashed at mount ("Cannot read properties of undefined").
|
|
87
|
-
editorProps:
|
|
97
|
+
editorProps: o ? {
|
|
88
98
|
handlePaste(n, d) {
|
|
89
99
|
var L;
|
|
90
100
|
const C = (L = d.clipboardData) == null ? void 0 : L.getData("text/plain");
|
|
@@ -117,10 +127,10 @@ function De({
|
|
|
117
127
|
{
|
|
118
128
|
className: j(
|
|
119
129
|
"overflow-hidden rounded-md border border-slate-200 bg-background focus-within:ring-1 focus-within:ring-nvr-cyan focus-within:border-nvr-cyan dark:border-border",
|
|
120
|
-
|
|
130
|
+
a && "opacity-60"
|
|
121
131
|
),
|
|
122
132
|
children: [
|
|
123
|
-
!
|
|
133
|
+
!a && /* @__PURE__ */ b(O, { children: [
|
|
124
134
|
/* @__PURE__ */ b("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-slate-200 bg-slate-50 px-2 py-1.5 dark:border-border dark:bg-muted", children: [
|
|
125
135
|
/* @__PURE__ */ e(
|
|
126
136
|
s,
|
|
@@ -239,7 +249,7 @@ function De({
|
|
|
239
249
|
title: "Link",
|
|
240
250
|
active: t.isActive("link"),
|
|
241
251
|
onClick: p,
|
|
242
|
-
children: /* @__PURE__ */ e(
|
|
252
|
+
children: /* @__PURE__ */ e(ae, { className: "h-3.5 w-3.5" })
|
|
243
253
|
}
|
|
244
254
|
),
|
|
245
255
|
t.isActive("link") && /* @__PURE__ */ e(
|
|
@@ -247,7 +257,7 @@ function De({
|
|
|
247
257
|
{
|
|
248
258
|
title: "Remove link",
|
|
249
259
|
onClick: () => t.chain().focus().unsetLink().run(),
|
|
250
|
-
children: /* @__PURE__ */ e(
|
|
260
|
+
children: /* @__PURE__ */ e(oe, { className: "h-3.5 w-3.5" })
|
|
251
261
|
}
|
|
252
262
|
),
|
|
253
263
|
/* @__PURE__ */ e(
|
|
@@ -349,18 +359,18 @@ function De({
|
|
|
349
359
|
);
|
|
350
360
|
}
|
|
351
361
|
function he(i, u) {
|
|
352
|
-
return i ? i.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (l,
|
|
353
|
-
if (
|
|
354
|
-
const
|
|
355
|
-
return
|
|
362
|
+
return i ? i.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (l, a) => {
|
|
363
|
+
if (a.includes(".")) return "";
|
|
364
|
+
const o = u[a];
|
|
365
|
+
return o == null ? "" : String(o);
|
|
356
366
|
}).replace(/\s+/g, " ").trim() : "";
|
|
357
367
|
}
|
|
358
368
|
function me(i, u) {
|
|
359
369
|
const l = he(u, i);
|
|
360
370
|
if (l) return l;
|
|
361
|
-
for (const
|
|
362
|
-
const
|
|
363
|
-
if (typeof
|
|
371
|
+
for (const a of ["name", "title", "label", "subject"]) {
|
|
372
|
+
const o = i[a];
|
|
373
|
+
if (typeof o == "string" && o.trim()) return o.trim();
|
|
364
374
|
}
|
|
365
375
|
return `#${String(i.id ?? "")}`;
|
|
366
376
|
}
|
|
@@ -368,8 +378,8 @@ function fe({
|
|
|
368
378
|
apiBase: i,
|
|
369
379
|
authHeaders: u,
|
|
370
380
|
credentials: l,
|
|
371
|
-
onInsert:
|
|
372
|
-
onClose:
|
|
381
|
+
onInsert: a,
|
|
382
|
+
onClose: o
|
|
373
383
|
}) {
|
|
374
384
|
const [c, m] = v(""), [g, _] = v(""), [k, y] = v("");
|
|
375
385
|
R(() => {
|
|
@@ -422,7 +432,7 @@ function fe({
|
|
|
422
432
|
{
|
|
423
433
|
value: g,
|
|
424
434
|
onChange: (r) => _(r.target.value),
|
|
425
|
-
onKeyDown: (r) => r.key === "Escape" &&
|
|
435
|
+
onKeyDown: (r) => r.key === "Escape" && o(),
|
|
426
436
|
placeholder: c ? "Search records…" : "Pick a collection first",
|
|
427
437
|
disabled: !c,
|
|
428
438
|
"aria-label": "Search records",
|
|
@@ -436,7 +446,7 @@ function fe({
|
|
|
436
446
|
type: "button",
|
|
437
447
|
title: "Close",
|
|
438
448
|
onMouseDown: (r) => {
|
|
439
|
-
r.preventDefault(),
|
|
449
|
+
r.preventDefault(), o();
|
|
440
450
|
},
|
|
441
451
|
className: "flex h-5 w-5 items-center justify-center rounded text-slate-400 hover:bg-slate-100",
|
|
442
452
|
children: /* @__PURE__ */ e(I, { className: "h-3.5 w-3.5" })
|
|
@@ -451,7 +461,7 @@ function fe({
|
|
|
451
461
|
{
|
|
452
462
|
type: "button",
|
|
453
463
|
onMouseDown: (A) => {
|
|
454
|
-
A.preventDefault(), x &&
|
|
464
|
+
A.preventDefault(), x && a(p, `record://${c}/${x}`);
|
|
455
465
|
},
|
|
456
466
|
className: "flex w-full items-center gap-1.5 px-2 py-1 text-left text-[12px] text-slate-700 hover:bg-muted",
|
|
457
467
|
children: [
|