@nivaro/react 0.3.10 → 0.3.12
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 +109 -102
- 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/ProfileView.js +115 -109
- 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/chat/ChatPanel.js +492 -472
- 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/UserChip.js +301 -233
- 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/profile/PersonAdminTools.js +168 -144
- package/dist/shared/components/profile/PersonProfile.js +42 -41
- package/dist/shared/components/profile/session-actions.js +52 -0
- 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/replay-checkout.js +20 -0
- 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
|
@@ -1,49 +1,53 @@
|
|
|
1
1
|
import { jsx as l, jsxs as y } from "react/jsx-runtime";
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { useNivaroClient as
|
|
5
|
-
import { post as
|
|
6
|
-
import { matchRows as
|
|
7
|
-
import { colorPair as
|
|
8
|
-
const
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
return
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
|
|
2
|
+
import { useQuery as Q } from "@tanstack/react-query";
|
|
3
|
+
import { useRef as S, useState as C, useLayoutEffect as A, useId as G } from "react";
|
|
4
|
+
import { useNivaroClient as J } from "../context.js";
|
|
5
|
+
import { post as V } from "../lib/commands.js";
|
|
6
|
+
import { matchRows as H, statCoverage as X, statValue as Y, sumField as Z, fmtStat as z, compactStat as ee } from "../lib/query-stats.js";
|
|
7
|
+
import { colorPair as I } from "./QueryTable.js";
|
|
8
|
+
const te = /* @__PURE__ */ new Set(["ink", "muted"]), re = 150, P = 8;
|
|
9
|
+
function ne(e, c) {
|
|
10
|
+
const b = S(null), f = S(null);
|
|
11
|
+
return A(() => {
|
|
12
|
+
const d = b.current, o = f.current;
|
|
13
|
+
if (!d || !o) {
|
|
14
|
+
c(!0);
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
const x = () =>
|
|
17
|
+
const x = () => c(o.offsetWidth <= d.clientWidth);
|
|
18
18
|
if (x(), typeof ResizeObserver > "u") return;
|
|
19
19
|
const m = new ResizeObserver(x);
|
|
20
|
-
return m.observe(
|
|
21
|
-
}, [e]), { box:
|
|
20
|
+
return m.observe(d), () => m.disconnect();
|
|
21
|
+
}, [e]), { box: b, probe: f };
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function ae({
|
|
24
24
|
stat: e,
|
|
25
|
-
rows:
|
|
26
|
-
effectiveParams:
|
|
27
|
-
loading:
|
|
28
|
-
compact:
|
|
25
|
+
rows: c,
|
|
26
|
+
effectiveParams: b,
|
|
27
|
+
loading: f,
|
|
28
|
+
compact: d,
|
|
29
29
|
onFit: o
|
|
30
30
|
}) {
|
|
31
|
-
const x =
|
|
32
|
-
...
|
|
31
|
+
const x = J(), [m, p] = C(!1), k = G(), r = e.query, g = r ? {
|
|
32
|
+
...r.params ?? {},
|
|
33
33
|
...Object.fromEntries(
|
|
34
|
-
Object.entries(
|
|
34
|
+
Object.entries(r.param_from ?? {}).map(([t, K]) => [t, b[K]])
|
|
35
35
|
)
|
|
36
|
-
} : null, { data: N, isLoading: n } =
|
|
37
|
-
queryKey: ["query-stat",
|
|
36
|
+
} : null, { data: N, isLoading: n } = Q({
|
|
37
|
+
queryKey: ["query-stat", r == null ? void 0 : r.slug, JSON.stringify(g)],
|
|
38
38
|
queryFn: () => x.request(
|
|
39
|
-
|
|
40
|
-
).then((
|
|
41
|
-
enabled: !!
|
|
39
|
+
V(`/custom-queries/${r.slug}/execute`, { params: g })
|
|
40
|
+
).then((t) => t.data ?? []),
|
|
41
|
+
enabled: !!r,
|
|
42
42
|
staleTime: 6e4
|
|
43
|
-
}),
|
|
44
|
-
label: String(r
|
|
45
|
-
value: Number(r
|
|
46
|
-
})) : [] : (e.details ?? []).map((
|
|
43
|
+
}), u = H(c, e.row_match), s = r ? n : f, a = e.coverage && !s ? X(e, c) : null, _ = !!a && a.reporting === 0, R = e.requires_field, L = !!R && !f && !c.some((t) => t[R] != null && t[R] !== ""), i = s || _ || L ? null : Y(e, c, N ?? null), O = !s && (i == null || i === ""), M = e.format === "date" || e.format === "text", E = r ? r.label_field ? (N ?? []).map((t) => ({
|
|
44
|
+
label: String(t[r.label_field] ?? "—"),
|
|
45
|
+
value: Number(t[r.value_field]) || 0
|
|
46
|
+
})) : [] : (e.details ?? []).map((t) => ({ label: t.label, value: Z(u, t.field) })), $ = typeof i == "number" && i < 0 && (e.field_subtract || e.accent_negative), w = $ ? e.accent_negative ?? "negative" : e.accent, v = M || O || !w ? null : $ ? I(w) : I(w, e.accent_dark), B = v && !te.has(String(w).trim().toLowerCase()), j = typeof i == "number" && e.field_subtract && i > 0 ? "+" : "", h = `${j}${z(
|
|
47
|
+
i,
|
|
48
|
+
e.format,
|
|
49
|
+
L ? e.requires_label ?? e.empty_label : e.empty_label
|
|
50
|
+
)}`, F = typeof i == "number" && (e.format === void 0 || e.format === "currency" || e.format === "number"), { box: D, probe: U } = ne(F ? h : "", o), T = d && F ? `${j}${ee(i, e.format)}` : h, W = a && a.reporting > 0 && a.reporting < a.total, q = E.length > 0;
|
|
47
51
|
return (
|
|
48
52
|
// Hover is a mouse convenience; the label button below is the keyboard path.
|
|
49
53
|
// biome-ignore lint/a11y/noStaticElementInteractions: see above
|
|
@@ -52,11 +56,11 @@ function re({
|
|
|
52
56
|
{
|
|
53
57
|
className: "relative min-w-0 rounded-lg border border-slate-200 bg-white px-3 py-2 dark:border-border dark:bg-card",
|
|
54
58
|
style: v ? { "--qsa": v[0], "--qsad": v[1] } : void 0,
|
|
55
|
-
onMouseEnter:
|
|
56
|
-
onMouseLeave:
|
|
59
|
+
onMouseEnter: q ? () => p(!0) : void 0,
|
|
60
|
+
onMouseLeave: q ? () => p(!1) : void 0,
|
|
57
61
|
"data-stat-tile": e.label,
|
|
58
62
|
children: [
|
|
59
|
-
|
|
63
|
+
B && /* @__PURE__ */ l(
|
|
60
64
|
"span",
|
|
61
65
|
{
|
|
62
66
|
"aria-hidden": "true",
|
|
@@ -72,7 +76,7 @@ function re({
|
|
|
72
76
|
style: { backgroundColor: e.bg, filter: "saturate(2.2)" }
|
|
73
77
|
}
|
|
74
78
|
),
|
|
75
|
-
|
|
79
|
+
q ? (
|
|
76
80
|
// The breakdown is a disclosure: a real button so keyboard users reach it.
|
|
77
81
|
/* @__PURE__ */ l(
|
|
78
82
|
"button",
|
|
@@ -84,8 +88,8 @@ function re({
|
|
|
84
88
|
onFocus: () => p(!0),
|
|
85
89
|
onBlur: () => p(!1),
|
|
86
90
|
onClick: () => p(!0),
|
|
87
|
-
onKeyDown: (
|
|
88
|
-
|
|
91
|
+
onKeyDown: (t) => {
|
|
92
|
+
t.key === "Escape" && p(!1);
|
|
89
93
|
},
|
|
90
94
|
title: e.label,
|
|
91
95
|
children: e.label
|
|
@@ -96,16 +100,16 @@ function re({
|
|
|
96
100
|
s ? /* @__PURE__ */ l("div", { className: "mt-1 h-5 w-24 animate-pulse rounded bg-slate-200/60 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ y(
|
|
97
101
|
"p",
|
|
98
102
|
{
|
|
99
|
-
ref:
|
|
100
|
-
className: `relative mt-0.5 truncate leading-[22px] tabular-nums ${
|
|
101
|
-
title:
|
|
103
|
+
ref: D,
|
|
104
|
+
className: `relative mt-0.5 truncate leading-[22px] tabular-nums ${O ? "text-[13px] font-normal text-slate-500 dark:text-slate-400" : M ? "text-[13px] font-medium text-slate-600 dark:text-slate-300" : v ? "text-[15px] font-semibold text-[color:var(--qsa)] dark:text-[color:var(--qsad)]" : "text-[15px] font-semibold text-slate-800 dark:text-slate-100"}`,
|
|
105
|
+
title: T !== h ? h : void 0,
|
|
102
106
|
"data-stat-value": !0,
|
|
103
107
|
children: [
|
|
104
|
-
|
|
108
|
+
T,
|
|
105
109
|
/* @__PURE__ */ l(
|
|
106
110
|
"span",
|
|
107
111
|
{
|
|
108
|
-
ref:
|
|
112
|
+
ref: U,
|
|
109
113
|
"aria-hidden": "true",
|
|
110
114
|
className: "pointer-events-none invisible absolute left-0 top-0 whitespace-nowrap",
|
|
111
115
|
children: h
|
|
@@ -114,7 +118,7 @@ function re({
|
|
|
114
118
|
]
|
|
115
119
|
}
|
|
116
120
|
),
|
|
117
|
-
|
|
121
|
+
W && /* @__PURE__ */ y(
|
|
118
122
|
"p",
|
|
119
123
|
{
|
|
120
124
|
className: "truncate text-[11px] tabular-nums text-slate-500 dark:text-slate-400",
|
|
@@ -128,15 +132,15 @@ function re({
|
|
|
128
132
|
]
|
|
129
133
|
}
|
|
130
134
|
),
|
|
131
|
-
m &&
|
|
135
|
+
m && q && /* @__PURE__ */ l(
|
|
132
136
|
"div",
|
|
133
137
|
{
|
|
134
138
|
id: k,
|
|
135
139
|
className: "absolute left-0 top-full z-40 mt-1 min-w-[220px] rounded-md border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-popover",
|
|
136
|
-
children:
|
|
137
|
-
/* @__PURE__ */ l("span", { className: "text-slate-500 dark:text-slate-400", children:
|
|
138
|
-
/* @__PURE__ */ l("span", { className: "tabular-nums text-slate-700 dark:text-slate-200", children:
|
|
139
|
-
] },
|
|
140
|
+
children: E.map((t) => /* @__PURE__ */ y("div", { className: "flex justify-between gap-4 py-0.5 text-[12px]", children: [
|
|
141
|
+
/* @__PURE__ */ l("span", { className: "text-slate-500 dark:text-slate-400", children: t.label }),
|
|
142
|
+
/* @__PURE__ */ l("span", { className: "tabular-nums text-slate-700 dark:text-slate-200", children: z(t.value, e.format) })
|
|
143
|
+
] }, t.label))
|
|
140
144
|
}
|
|
141
145
|
)
|
|
142
146
|
]
|
|
@@ -144,40 +148,40 @@ function re({
|
|
|
144
148
|
)
|
|
145
149
|
);
|
|
146
150
|
}
|
|
147
|
-
function
|
|
151
|
+
function me({
|
|
148
152
|
stats: e,
|
|
149
|
-
rows:
|
|
150
|
-
effectiveParams:
|
|
151
|
-
loading:
|
|
153
|
+
rows: c,
|
|
154
|
+
effectiveParams: b,
|
|
155
|
+
loading: f
|
|
152
156
|
}) {
|
|
153
|
-
const
|
|
154
|
-
let
|
|
155
|
-
return
|
|
157
|
+
const d = S(null), o = e.length, [x, m] = C(o), [p, k] = C({}), r = Object.values(p).some(Boolean), g = S(/* @__PURE__ */ new Map()), N = (n) => {
|
|
158
|
+
let u = g.current.get(n);
|
|
159
|
+
return u || (u = (s) => k((a) => a[n] === !s ? a : { ...a, [n]: !s }), g.current.set(n, u)), u;
|
|
156
160
|
};
|
|
157
|
-
return
|
|
158
|
-
const n =
|
|
161
|
+
return A(() => {
|
|
162
|
+
const n = d.current;
|
|
159
163
|
if (!n || !o) return;
|
|
160
|
-
const
|
|
161
|
-
const a = Math.max(1, Math.floor((n.clientWidth +
|
|
164
|
+
const u = () => {
|
|
165
|
+
const a = Math.max(1, Math.floor((n.clientWidth + P) / (re + P))), _ = Math.ceil(o / a);
|
|
162
166
|
m(Math.ceil(o / _));
|
|
163
167
|
};
|
|
164
|
-
if (
|
|
165
|
-
const s = new ResizeObserver(
|
|
168
|
+
if (u(), typeof ResizeObserver > "u") return;
|
|
169
|
+
const s = new ResizeObserver(u);
|
|
166
170
|
return s.observe(n), () => s.disconnect();
|
|
167
171
|
}, [o]), o ? /* @__PURE__ */ l(
|
|
168
172
|
"div",
|
|
169
173
|
{
|
|
170
|
-
ref:
|
|
174
|
+
ref: d,
|
|
171
175
|
className: "grid gap-2 pb-3",
|
|
172
176
|
style: { gridTemplateColumns: `repeat(${x}, minmax(0, 1fr))` },
|
|
173
177
|
children: e.map((n) => /* @__PURE__ */ l(
|
|
174
|
-
|
|
178
|
+
ae,
|
|
175
179
|
{
|
|
176
180
|
stat: n,
|
|
177
|
-
rows:
|
|
178
|
-
effectiveParams:
|
|
179
|
-
loading:
|
|
180
|
-
compact:
|
|
181
|
+
rows: c,
|
|
182
|
+
effectiveParams: b,
|
|
183
|
+
loading: f,
|
|
184
|
+
compact: r,
|
|
181
185
|
onFit: N(n.label)
|
|
182
186
|
},
|
|
183
187
|
n.label
|
|
@@ -186,5 +190,5 @@ function de({
|
|
|
186
190
|
) : null;
|
|
187
191
|
}
|
|
188
192
|
export {
|
|
189
|
-
|
|
193
|
+
me as QueryStatStrip
|
|
190
194
|
};
|