@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
|
@@ -4,10 +4,10 @@ import { Loader2 as ie, X as W, ChevronRight as le } from "lucide-react";
|
|
|
4
4
|
import { useState as k, useMemo as Z } from "react";
|
|
5
5
|
import { useNivaroClient as de } from "../../context.js";
|
|
6
6
|
import { get as V, patch as oe, del as ce, post as pe } from "../../lib/commands.js";
|
|
7
|
-
import { titleCase as G, cn as ue } from "../../lib/utils.js";
|
|
8
|
-
import { useAddendumO2M as
|
|
9
|
-
import { useO2MStaging as
|
|
10
|
-
const
|
|
7
|
+
import { titleCase as G, cn as ue, toLocalDateString as me } from "../../lib/utils.js";
|
|
8
|
+
import { useAddendumO2M as xe, useAddendumView as he } from "./AddendumFieldContext.js";
|
|
9
|
+
import { useO2MStaging as be } from "./O2MStagingContext.js";
|
|
10
|
+
const fe = /* @__PURE__ */ new Set([
|
|
11
11
|
"alias",
|
|
12
12
|
"o2m",
|
|
13
13
|
"m2m",
|
|
@@ -16,7 +16,7 @@ const be = /* @__PURE__ */ new Set([
|
|
|
16
16
|
"group",
|
|
17
17
|
"divider"
|
|
18
18
|
]);
|
|
19
|
-
function
|
|
19
|
+
function Ee({
|
|
20
20
|
relatedCollection: l,
|
|
21
21
|
manyField: c,
|
|
22
22
|
parentId: m,
|
|
@@ -25,7 +25,7 @@ function Ce({
|
|
|
25
25
|
emptyLabel: S
|
|
26
26
|
}) {
|
|
27
27
|
var L;
|
|
28
|
-
const f = de(),
|
|
28
|
+
const f = de(), _ = ae(), x = be(), d = m === "new", B = xe()[F ?? ""] ?? [], [q, C] = k(null), [D, I] = k({}), [E, v] = k(!1), [R, y] = k({}), [g, $] = k(!1), N = he(), { data: u } = Y({
|
|
29
29
|
queryKey: ["active-layout", l, b ?? null],
|
|
30
30
|
queryFn: () => f.request(
|
|
31
31
|
V("/collection-layouts/active", {
|
|
@@ -45,7 +45,7 @@ function Ce({
|
|
|
45
45
|
).then((e) => e.data ?? []),
|
|
46
46
|
staleTime: 6e4,
|
|
47
47
|
enabled: !b || u !== void 0
|
|
48
|
-
}), { data:
|
|
48
|
+
}), { data: w = [], isLoading: te } = Y({
|
|
49
49
|
queryKey: ["o2m-rows", l, c, m],
|
|
50
50
|
queryFn: () => f.request(
|
|
51
51
|
V(`/items/${l}`, {
|
|
@@ -56,7 +56,7 @@ function Ce({
|
|
|
56
56
|
enabled: !d,
|
|
57
57
|
staleTime: 3e4
|
|
58
58
|
}), J = d && x ? x.getPendingRows(l, c) : [], o = ee.filter(
|
|
59
|
-
(e) => !e.hidden && !
|
|
59
|
+
(e) => !e.hidden && !fe.has(e.type) && e.field !== c && e.field !== "id"
|
|
60
60
|
), A = Z(
|
|
61
61
|
() => ((u == null ? void 0 : u.groups) ?? []).filter((e) => e.type === "section").sort((e, r) => e.sort - r.sort),
|
|
62
62
|
[u]
|
|
@@ -72,7 +72,7 @@ function Ce({
|
|
|
72
72
|
async function X(e) {
|
|
73
73
|
$(!0);
|
|
74
74
|
try {
|
|
75
|
-
await f.request(oe(`/items/${l}/${e}`,
|
|
75
|
+
await f.request(oe(`/items/${l}/${e}`, D)), _.invalidateQueries({ queryKey: ["o2m-rows", l, c, m] }), C(null);
|
|
76
76
|
} catch {
|
|
77
77
|
} finally {
|
|
78
78
|
$(!1);
|
|
@@ -80,14 +80,14 @@ function Ce({
|
|
|
80
80
|
}
|
|
81
81
|
async function z() {
|
|
82
82
|
if (d && x) {
|
|
83
|
-
x.queueRow(l, c, { ...R }),
|
|
83
|
+
x.queueRow(l, c, { ...R }), v(!1), y({});
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
$(!0);
|
|
87
87
|
try {
|
|
88
88
|
await f.request(
|
|
89
89
|
pe(`/items/${l}`, { ...R, [c]: m })
|
|
90
|
-
),
|
|
90
|
+
), _.invalidateQueries({ queryKey: ["o2m-rows", l, c, m] }), v(!1), y({});
|
|
91
91
|
} catch {
|
|
92
92
|
} finally {
|
|
93
93
|
$(!1);
|
|
@@ -95,7 +95,7 @@ function Ce({
|
|
|
95
95
|
}
|
|
96
96
|
async function re(e) {
|
|
97
97
|
try {
|
|
98
|
-
await f.request(ce(`/items/${l}/${e}`)),
|
|
98
|
+
await f.request(ce(`/items/${l}/${e}`)), _.invalidateQueries({ queryKey: ["o2m-rows", l, c, m] });
|
|
99
99
|
} catch {
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -105,7 +105,7 @@ function Ce({
|
|
|
105
105
|
return /* @__PURE__ */ t("span", { className: r ? "text-emerald-600" : "text-slate-400", children: r ? "Yes" : "No" });
|
|
106
106
|
if (e.type === "datetime" || e.type === "date")
|
|
107
107
|
try {
|
|
108
|
-
return /* @__PURE__ */ t("span", { children:
|
|
108
|
+
return /* @__PURE__ */ t("span", { children: me(r) });
|
|
109
109
|
} catch {
|
|
110
110
|
}
|
|
111
111
|
return /* @__PURE__ */ t("span", { className: "truncate", children: String(r) });
|
|
@@ -155,7 +155,7 @@ function Ce({
|
|
|
155
155
|
);
|
|
156
156
|
}
|
|
157
157
|
function H(e, r, n, s, i) {
|
|
158
|
-
const
|
|
158
|
+
const M = (h == null ? void 0 : h.get(null)) ?? [];
|
|
159
159
|
return /* @__PURE__ */ a("div", { className: "border border-slate-200 rounded-lg bg-white overflow-hidden", children: [
|
|
160
160
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-between border-b border-slate-100 px-3 py-2 bg-slate-50", children: [
|
|
161
161
|
/* @__PURE__ */ t("span", { className: "text-[11px] font-semibold text-slate-600 uppercase tracking-wide", children: i }),
|
|
@@ -173,27 +173,27 @@ function Ce({
|
|
|
173
173
|
"button",
|
|
174
174
|
{
|
|
175
175
|
type: "button",
|
|
176
|
-
disabled:
|
|
176
|
+
disabled: g,
|
|
177
177
|
onClick: n,
|
|
178
178
|
className: "text-[11px] font-medium bg-nvr-cyan text-white px-2.5 py-0.5 rounded hover:brightness-110 disabled:opacity-50",
|
|
179
|
-
children:
|
|
179
|
+
children: g ? "…" : "Save"
|
|
180
180
|
}
|
|
181
181
|
)
|
|
182
182
|
] })
|
|
183
183
|
] }),
|
|
184
184
|
/* @__PURE__ */ a("div", { className: "p-3 space-y-4", children: [
|
|
185
|
-
|
|
185
|
+
M.length > 0 && /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-x-4 gap-y-2", children: M.map((p) => /* @__PURE__ */ a("div", { children: [
|
|
186
186
|
/* @__PURE__ */ t("label", { className: "block text-[11px] font-medium text-slate-500 mb-1", children: p.label ?? G(p.field) }),
|
|
187
187
|
O(p, e, r)
|
|
188
188
|
] }, p.field)) }),
|
|
189
189
|
A.map((p) => {
|
|
190
|
-
const
|
|
191
|
-
return
|
|
190
|
+
const P = (h == null ? void 0 : h.get(p.key)) ?? [];
|
|
191
|
+
return P.length ? /* @__PURE__ */ a("div", { children: [
|
|
192
192
|
/* @__PURE__ */ t("div", { className: "text-[10px] font-semibold uppercase tracking-wider text-slate-400 mb-2 pb-1 border-b border-slate-100", children: p.label }),
|
|
193
|
-
/* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-x-4 gap-y-2", children:
|
|
194
|
-
/* @__PURE__ */ t("label", { className: "block text-[11px] font-medium text-slate-500 mb-1", children:
|
|
195
|
-
O(
|
|
196
|
-
] },
|
|
193
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-x-4 gap-y-2", children: P.map((Q) => /* @__PURE__ */ a("div", { children: [
|
|
194
|
+
/* @__PURE__ */ t("label", { className: "block text-[11px] font-medium text-slate-500 mb-1", children: Q.label ?? G(Q.field) }),
|
|
195
|
+
O(Q, e, r)
|
|
196
|
+
] }, Q.field)) })
|
|
197
197
|
] }, p.key) : null;
|
|
198
198
|
})
|
|
199
199
|
] })
|
|
@@ -204,7 +204,7 @@ function Ce({
|
|
|
204
204
|
}
|
|
205
205
|
if (!d && te)
|
|
206
206
|
return /* @__PURE__ */ t("div", { className: "py-3 text-center text-[12px] text-slate-400", children: /* @__PURE__ */ t(ie, { className: "h-4 w-4 animate-spin inline" }) });
|
|
207
|
-
const se = d ? J :
|
|
207
|
+
const se = d ? J : w, j = !!h && A.length > 0;
|
|
208
208
|
return (
|
|
209
209
|
// The flat grid shows every displayable child column (a wide legacy table
|
|
210
210
|
// has dozens) — it scrolls inside its card rather than running off a
|
|
@@ -237,7 +237,7 @@ function Ce({
|
|
|
237
237
|
}
|
|
238
238
|
) })
|
|
239
239
|
] }, r)),
|
|
240
|
-
!d && N === "original" &&
|
|
240
|
+
!d && N === "original" && w.map((e, r) => {
|
|
241
241
|
const n = String(e.id), s = q === n && !j;
|
|
242
242
|
return /* @__PURE__ */ a(
|
|
243
243
|
"tr",
|
|
@@ -249,18 +249,18 @@ function Ce({
|
|
|
249
249
|
children: [
|
|
250
250
|
o.map((i) => /* @__PURE__ */ t("td", { className: "px-3 py-1.5", children: s ? O(
|
|
251
251
|
i,
|
|
252
|
-
|
|
253
|
-
(
|
|
252
|
+
D,
|
|
253
|
+
(M, p) => I((P) => ({ ...P, [M]: p }))
|
|
254
254
|
) : K(i, e[i.field]) }, i.field)),
|
|
255
255
|
/* @__PURE__ */ t("td", { className: "px-2 py-1.5", children: /* @__PURE__ */ t("div", { className: "flex items-center gap-1 justify-end", children: s ? /* @__PURE__ */ a(U, { children: [
|
|
256
256
|
/* @__PURE__ */ t(
|
|
257
257
|
"button",
|
|
258
258
|
{
|
|
259
259
|
type: "button",
|
|
260
|
-
disabled:
|
|
260
|
+
disabled: g,
|
|
261
261
|
onClick: () => X(n),
|
|
262
262
|
className: "rounded px-1.5 py-0.5 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
|
|
263
|
-
children:
|
|
263
|
+
children: g ? "…" : "Save"
|
|
264
264
|
}
|
|
265
265
|
),
|
|
266
266
|
/* @__PURE__ */ t(
|
|
@@ -311,30 +311,30 @@ function Ce({
|
|
|
311
311
|
) }) : e.rows.map((r, n) => /* @__PURE__ */ a("tr", { className: "border-b border-amber-100 bg-amber-50/60", children: [
|
|
312
312
|
o.map((s) => /* @__PURE__ */ t("td", { className: "px-3 py-1.5 text-[11px] text-amber-900", children: K(s, r[s.field]) }, s.field)),
|
|
313
313
|
/* @__PURE__ */ t("td", { className: "px-2 py-1.5 text-right", children: /* @__PURE__ */ t("span", { className: "text-[10px] font-medium uppercase tracking-wide text-amber-400", children: "Proposed" }) })
|
|
314
|
-
] }, n)) :
|
|
314
|
+
] }, n)) : w.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t(
|
|
315
315
|
"td",
|
|
316
316
|
{
|
|
317
317
|
colSpan: o.length + 1,
|
|
318
318
|
className: "px-3 py-4 text-center text-[11px] text-slate-400",
|
|
319
319
|
children: S ? `No ${S.toLowerCase()} yet` : "No rows"
|
|
320
320
|
}
|
|
321
|
-
) }) :
|
|
321
|
+
) }) : w.map((r, n) => /* @__PURE__ */ a("tr", { className: "border-b border-slate-100", children: [
|
|
322
322
|
o.map((s) => /* @__PURE__ */ t("td", { className: "px-3 py-1.5 text-[11px] text-slate-700", children: K(s, r[s.field]) }, s.field)),
|
|
323
323
|
/* @__PURE__ */ t("td", { className: "px-2 py-1.5" })
|
|
324
324
|
] }, n));
|
|
325
325
|
})(),
|
|
326
326
|
N === "original" && E && !j && /* @__PURE__ */ a("tr", { className: "border-b border-slate-100 bg-nvr-cyan/5", children: [
|
|
327
327
|
d && /* @__PURE__ */ t("td", { className: "px-3 py-1.5" }),
|
|
328
|
-
ne(R, (e, r) =>
|
|
328
|
+
ne(R, (e, r) => y((n) => ({ ...n, [e]: r }))),
|
|
329
329
|
/* @__PURE__ */ t("td", { className: "px-2 py-1.5", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-1 justify-end", children: [
|
|
330
330
|
/* @__PURE__ */ t(
|
|
331
331
|
"button",
|
|
332
332
|
{
|
|
333
333
|
type: "button",
|
|
334
|
-
disabled:
|
|
334
|
+
disabled: g,
|
|
335
335
|
onClick: z,
|
|
336
336
|
className: "rounded px-1.5 py-0.5 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
|
|
337
|
-
children:
|
|
337
|
+
children: g ? "…" : "Add"
|
|
338
338
|
}
|
|
339
339
|
),
|
|
340
340
|
/* @__PURE__ */ t(
|
|
@@ -342,7 +342,7 @@ function Ce({
|
|
|
342
342
|
{
|
|
343
343
|
type: "button",
|
|
344
344
|
onClick: () => {
|
|
345
|
-
|
|
345
|
+
v(!1), y({});
|
|
346
346
|
},
|
|
347
347
|
className: "rounded px-1.5 py-0.5 text-slate-400 hover:text-slate-700 text-[11px]",
|
|
348
348
|
children: "Cancel"
|
|
@@ -360,8 +360,8 @@ function Ce({
|
|
|
360
360
|
) })
|
|
361
361
|
] })
|
|
362
362
|
] }),
|
|
363
|
-
q && j && (
|
|
364
|
-
|
|
363
|
+
q && j && (w.find((r) => String(r.id) === q) ? /* @__PURE__ */ t("div", { className: "border-t border-slate-200 p-3", children: H(
|
|
364
|
+
D,
|
|
365
365
|
(r, n) => I((s) => ({ ...s, [r]: n })),
|
|
366
366
|
() => X(q),
|
|
367
367
|
() => C(null),
|
|
@@ -369,10 +369,10 @@ function Ce({
|
|
|
369
369
|
) }) : null),
|
|
370
370
|
E && j && /* @__PURE__ */ t("div", { className: "border-t border-slate-200 p-3", children: H(
|
|
371
371
|
R,
|
|
372
|
-
(e, r) =>
|
|
372
|
+
(e, r) => y((n) => ({ ...n, [e]: r })),
|
|
373
373
|
z,
|
|
374
374
|
() => {
|
|
375
|
-
|
|
375
|
+
v(!1), y({});
|
|
376
376
|
},
|
|
377
377
|
"New Row"
|
|
378
378
|
) }),
|
|
@@ -380,7 +380,7 @@ function Ce({
|
|
|
380
380
|
"button",
|
|
381
381
|
{
|
|
382
382
|
type: "button",
|
|
383
|
-
onClick: () =>
|
|
383
|
+
onClick: () => v(!0),
|
|
384
384
|
className: "text-[11px] font-medium text-nvr-cyan hover:underline",
|
|
385
385
|
children: "+ Add row"
|
|
386
386
|
}
|
|
@@ -389,5 +389,5 @@ function Ce({
|
|
|
389
389
|
);
|
|
390
390
|
}
|
|
391
391
|
export {
|
|
392
|
-
|
|
392
|
+
Ee as InlineGridField
|
|
393
393
|
};
|