@nivaro/react 0.3.110 → 0.3.112
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 +170 -2
- package/dist/index.js +745 -728
- package/dist/shared/components/CollectionBrowserView.js +3097 -2972
- package/dist/shared/components/CollectionImportBanner.js +135 -0
- package/dist/shared/components/ItemEditForm.js +2235 -2218
- package/dist/shared/components/JobsTray.js +54 -47
- package/dist/shared/components/TipLayer.js +61 -54
- package/dist/shared/components/ViewAsPersonButton.js +109 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +228 -150
- package/dist/shared/components/bulk/BulkFieldUpdateButton.js +35 -41
- package/dist/shared/components/bulk/BulkLinksValue.js +91 -0
- package/dist/shared/components/bulk/bulk-field-options.js +20 -19
- package/dist/shared/components/bulk/bulk-update-preview.js +39 -0
- package/dist/shared/components/cbv/ColumnHeaderMenu.js +113 -0
- package/dist/shared/components/cbv/column-totals.js +66 -0
- package/dist/shared/components/collections-directory/CollectionHoverCard.js +108 -81
- package/dist/shared/components/collections-directory/CollectionRow.js +164 -148
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +167 -166
- package/dist/shared/components/collections-directory/directory-data.js +70 -58
- package/dist/shared/components/imports/CollectionImportPanel.js +120 -118
- package/dist/shared/components/imports/DefinitionsPanel.js +24 -24
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +65 -0
- package/dist/shared/components/item-edit/CatalogPickerField.js +631 -639
- package/dist/shared/components/item-edit/DuplicateNotice.js +168 -0
- package/dist/shared/components/item-edit/FieldRow.js +248 -246
- package/dist/shared/components/item-edit/InlineGridField.js +34 -33
- package/dist/shared/components/item-edit/InlineTableField.js +3064 -2882
- package/dist/shared/components/item-edit/MembershipSetField.js +165 -169
- package/dist/shared/components/item-edit/NestedRelationEditor.js +184 -189
- package/dist/shared/components/item-edit/PlanGrid.js +2 -1
- package/dist/shared/components/item-edit/QuickPickerDialog.js +35 -34
- package/dist/shared/components/item-edit/RecordLiveSync.js +32 -30
- package/dist/shared/components/item-edit/RelationCombobox.js +101 -100
- package/dist/shared/components/item-edit/RowHistorySheet.js +28 -27
- package/dist/shared/components/item-edit/SummaryPanel.js +133 -135
- package/dist/shared/components/item-edit/ViewAsRole.js +129 -52
- package/dist/shared/components/item-edit/grid-search.js +345 -0
- package/dist/shared/components/item-edit/render-stability.js +61 -54
- package/dist/shared/components/notifications/NotificationRulesEditor.js +25 -20
- package/dist/shared/components/ops-report/DigestSections.js +163 -144
- package/dist/shared/components/ops-report/drill.js +97 -97
- package/dist/shared/components/panels/AddendumLinesDiff.js +52 -51
- package/dist/shared/components/panels/AddendumPanel.js +92 -91
- package/dist/shared/components/panels/AsyncUserPicker.js +108 -0
- package/dist/shared/components/panels/BlockedMove.js +73 -0
- package/dist/shared/components/panels/CommentPanel.js +265 -252
- package/dist/shared/components/panels/OwnersSlot.js +47 -35
- package/dist/shared/components/panels/PipelineInsight.js +186 -0
- package/dist/shared/components/panels/PipelinePanel.js +1573 -1475
- package/dist/shared/components/panels/RecordIntegrityBanner.js +39 -38
- package/dist/shared/components/panels/RevisionsPanel.js +261 -260
- package/dist/shared/components/pipeline/FieldPicker.js +41 -40
- package/dist/shared/components/pipeline/OwnerMatrix.js +829 -700
- package/dist/shared/components/pipeline/OwnerRecordTrial.js +362 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +483 -467
- package/dist/shared/components/pipeline/PipelineStateOwners.js +65 -64
- package/dist/shared/components/pipeline/owner-matrix-draft.js +178 -0
- package/dist/shared/components/profile/MyDefaultsCard.js +36 -35
- package/dist/shared/components/profile/PersonHeader.js +29 -29
- package/dist/shared/components/profile/PersonProfile.js +30 -28
- package/dist/shared/components/profile/SlowScreensCard.js +286 -0
- package/dist/shared/components/queue/QueueWorklist.js +1090 -1071
- package/dist/shared/components/quick-filters/useQuickFilterEditing.js +45 -44
- package/dist/shared/components/support/TicketDetailSheet.js +25 -16
- package/dist/shared/components/support/TicketSlowScreens.js +32 -0
- package/dist/shared/lib/activity-sentence.js +224 -178
- package/dist/shared/lib/collection-import-banner.js +27 -0
- package/dist/shared/lib/crash-report.js +112 -0
- package/dist/shared/lib/export-runs.js +99 -0
- package/dist/shared/lib/jobs-tray.js +89 -67
- package/dist/shared/lib/list-link.js +76 -69
- package/dist/shared/lib/nav-trail.js +180 -76
- package/dist/shared/lib/query-keys.js +26 -0
- package/dist/shared/lib/view-as.js +16 -11
- package/package.json +1 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { X as m } from "lucide-react";
|
|
3
|
+
import { resolveOptionFilterTokens as b } from "../../lib/option-filter-tokens.js";
|
|
4
|
+
import { cn as h } from "../../lib/utils.js";
|
|
5
|
+
import { parseJson as g } from "../item-edit/helpers.js";
|
|
6
|
+
import { RelatedItemLabel as v, RelationCombobox as x } from "../item-edit/RelationCombobox.js";
|
|
7
|
+
const k = [
|
|
8
|
+
{ value: "append", label: "Add", hint: "Add these links; links a record already has stay" },
|
|
9
|
+
{ value: "replace", label: "Replace", hint: "Each record’s links become exactly these" },
|
|
10
|
+
{ value: "remove", label: "Remove", hint: "Take these links off; the rest stay" }
|
|
11
|
+
];
|
|
12
|
+
function R({
|
|
13
|
+
related: i,
|
|
14
|
+
fieldLabel: l,
|
|
15
|
+
fieldOptions: u,
|
|
16
|
+
mode: a,
|
|
17
|
+
ids: n,
|
|
18
|
+
onMode: d,
|
|
19
|
+
onIds: s
|
|
20
|
+
}) {
|
|
21
|
+
const o = g(
|
|
22
|
+
u
|
|
23
|
+
), p = b(
|
|
24
|
+
o != null && o.option_filter && typeof o.option_filter == "object" ? o.option_filter : void 0,
|
|
25
|
+
void 0,
|
|
26
|
+
"new"
|
|
27
|
+
), f = (e) => n.some((t) => String(t).toLowerCase() === String(e).toLowerCase());
|
|
28
|
+
return /* @__PURE__ */ c("div", { className: "space-y-2", "data-bulk-links": !0, children: [
|
|
29
|
+
/* @__PURE__ */ r(
|
|
30
|
+
"fieldset",
|
|
31
|
+
{
|
|
32
|
+
"aria-label": `How to change ${l}`,
|
|
33
|
+
className: "m-0 grid min-w-0 grid-cols-3 gap-0.5 rounded-md border-0 bg-muted p-0.5",
|
|
34
|
+
children: k.map((e) => /* @__PURE__ */ r(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
type: "button",
|
|
38
|
+
"aria-pressed": a === e.value,
|
|
39
|
+
"data-bulk-links-mode": e.value,
|
|
40
|
+
"data-tip": e.hint,
|
|
41
|
+
onClick: () => d(e.value),
|
|
42
|
+
className: h(
|
|
43
|
+
"h-7 rounded-[5px] text-[12.5px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
44
|
+
a === e.value ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
|
|
45
|
+
),
|
|
46
|
+
children: e.label
|
|
47
|
+
},
|
|
48
|
+
e.value
|
|
49
|
+
))
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
n.length > 0 && /* @__PURE__ */ r("ul", { className: "flex flex-wrap gap-1", "aria-label": `Picked ${l}`, children: n.map((e) => /* @__PURE__ */ c(
|
|
53
|
+
"li",
|
|
54
|
+
{
|
|
55
|
+
"data-bulk-links-chip": String(e),
|
|
56
|
+
className: "inline-flex max-w-full items-center gap-1 rounded-full border border-border bg-muted/60 py-0.5 pl-2 pr-1 text-[12px] text-foreground",
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ r("span", { className: "min-w-0 truncate", children: /* @__PURE__ */ r(v, { collection: i, id: e }) }),
|
|
59
|
+
/* @__PURE__ */ r(
|
|
60
|
+
"button",
|
|
61
|
+
{
|
|
62
|
+
type: "button",
|
|
63
|
+
onClick: () => s(n.filter((t) => t !== e)),
|
|
64
|
+
"aria-label": "Remove from the list",
|
|
65
|
+
className: "rounded-full p-0.5 text-muted-foreground hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
66
|
+
children: /* @__PURE__ */ r(m, { className: "h-3 w-3" })
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
String(e)
|
|
72
|
+
)) }),
|
|
73
|
+
/* @__PURE__ */ r(
|
|
74
|
+
x,
|
|
75
|
+
{
|
|
76
|
+
collection: i,
|
|
77
|
+
value: null,
|
|
78
|
+
onChange: (e) => {
|
|
79
|
+
const t = e && typeof e == "object" ? e.id : e;
|
|
80
|
+
(typeof t == "string" || typeof t == "number") && t !== "" && !f(t) && s([...n, t]);
|
|
81
|
+
},
|
|
82
|
+
extraFilter: p ?? void 0,
|
|
83
|
+
optionSort: typeof (o == null ? void 0 : o.option_sort) == "string" && o.option_sort ? o.option_sort : void 0,
|
|
84
|
+
placeholder: n.length ? "Add another…" : `Pick ${l}…`
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
] });
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
R as BulkLinksValue
|
|
91
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { formSections as s, mergeFormSections as a, HEADER_SECTION_KEY as d } from "../../lib/form-sections.js";
|
|
2
2
|
import { titleCase as c } from "../../lib/utils.js";
|
|
3
3
|
function b(e, n = {}) {
|
|
4
|
-
const
|
|
4
|
+
const r = e.forms.map(
|
|
5
5
|
(f) => s(f.groups, f.placements, { ungroupedSort: f.ungrouped_sort })
|
|
6
6
|
);
|
|
7
7
|
if (e.no_form > 0) {
|
|
8
|
-
const f = new Set(
|
|
9
|
-
i.length &&
|
|
8
|
+
const f = new Set(r.flat().flatMap((o) => o.fields.map((t) => t.field))), i = Object.keys(e.fields).filter((o) => !f.has(o)).sort((o, t) => (n[o] || o).localeCompare(n[t] || t));
|
|
9
|
+
i.length && r.push([
|
|
10
10
|
{
|
|
11
11
|
key: "__no_form__",
|
|
12
12
|
label: e.forms.length ? "Other fields" : "Fields",
|
|
@@ -15,35 +15,36 @@ function b(e, n = {}) {
|
|
|
15
15
|
]);
|
|
16
16
|
}
|
|
17
17
|
const l = [];
|
|
18
|
-
for (const f of a(
|
|
18
|
+
for (const f of a(r)) {
|
|
19
19
|
const i = f.fields.flatMap((o) => {
|
|
20
|
-
const
|
|
21
|
-
return
|
|
20
|
+
const t = e.fields[o.field];
|
|
21
|
+
return t ? [
|
|
22
22
|
{
|
|
23
23
|
field: o.field,
|
|
24
24
|
label: o.label || n[o.field] || c(o.field),
|
|
25
|
-
writable: Math.max(0,
|
|
26
|
-
offForm: Math.max(0, e.readable -
|
|
27
|
-
locked:
|
|
28
|
-
reason:
|
|
29
|
-
required:
|
|
25
|
+
writable: Math.max(0, t.records - t.locked),
|
|
26
|
+
offForm: Math.max(0, e.readable - t.records),
|
|
27
|
+
locked: t.locked,
|
|
28
|
+
reason: t.reason,
|
|
29
|
+
required: t.required === !0,
|
|
30
|
+
...t.m2m ? { m2m: t.m2m } : {}
|
|
30
31
|
}
|
|
31
32
|
] : [];
|
|
32
33
|
});
|
|
33
34
|
i.length && l.push({ key: f.key, label: f.label, options: i });
|
|
34
35
|
}
|
|
35
|
-
return
|
|
36
|
+
return m(l);
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
const n = (l) => l.key === d ? "Record header" : l.label.split(" › ").pop() ?? l.label,
|
|
39
|
-
for (const l of e)
|
|
40
|
-
return e.map((l) => ({ ...l, label: (
|
|
38
|
+
function m(e) {
|
|
39
|
+
const n = (l) => l.key === d ? "Record header" : l.label.split(" › ").pop() ?? l.label, r = /* @__PURE__ */ new Map();
|
|
40
|
+
for (const l of e) r.set(n(l), (r.get(n(l)) ?? 0) + 1);
|
|
41
|
+
return e.map((l) => ({ ...l, label: (r.get(n(l)) ?? 0) > 1 ? l.label : n(l) }));
|
|
41
42
|
}
|
|
42
43
|
function h(e, n) {
|
|
43
|
-
const
|
|
44
|
-
return e.locked > 0 &&
|
|
44
|
+
const r = [];
|
|
45
|
+
return e.locked > 0 && r.push(
|
|
45
46
|
e.writable === 0 && e.offForm === 0 ? e.reason ?? "Locked" : `locked on ${e.locked}`
|
|
46
|
-
), e.offForm > 0 &&
|
|
47
|
+
), e.offForm > 0 && r.push(`not on the form of ${e.offForm}`), r.length === 0 ? null : e.writable === 0 && e.offForm === 0 ? r[0] : `${e.writable} of ${n} — ${r.join(", ")}`;
|
|
47
48
|
}
|
|
48
49
|
export {
|
|
49
50
|
h as bulkFieldNote,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { plainErrorText as a } from "../../lib/safe-error.js";
|
|
2
|
+
function l(e, o) {
|
|
3
|
+
const n = /* @__PURE__ */ new Set(), s = o.filter((r) => {
|
|
4
|
+
const i = String(r).toLowerCase();
|
|
5
|
+
return n.has(i) ? !1 : (n.add(i), !0);
|
|
6
|
+
});
|
|
7
|
+
return e === "replace" ? { set: s } : e === "remove" ? { delete: s } : { create: s };
|
|
8
|
+
}
|
|
9
|
+
const d = (e, o, n = `${o}s`) => `${e.toLocaleString()} ${e === 1 ? o : n}`;
|
|
10
|
+
function u(e, o = {}) {
|
|
11
|
+
const n = [];
|
|
12
|
+
let s;
|
|
13
|
+
const r = e.links_added ?? 0, i = e.links_removed ?? 0;
|
|
14
|
+
return o.mode && !e.links_unknown ? (e.would_update === 0 ? s = "Nothing would change" : o.mode === "append" ? s = `Adds ${d(r, "link")} to ${d(e.would_update, "record")}` : o.mode === "remove" ? s = `Removes ${d(i, "link")} from ${d(e.would_update, "record")}` : s = r && i ? `Removes ${d(i, "link")} and adds ${r.toLocaleString()} across ${d(e.would_update, "record")}` : r ? `Adds ${d(r, "link")} across ${d(e.would_update, "record")}` : `Removes ${d(i, "link")} across ${d(e.would_update, "record")}`, e.skipped && n.push(
|
|
15
|
+
o.mode === "remove" ? `${d(e.skipped, "record")} ${e.skipped === 1 ? "has" : "have"} none of them` : o.mode === "append" ? `${d(e.skipped, "record")} already ${e.skipped === 1 ? "has" : "have"} them` : `${d(e.skipped, "record")} already ${e.skipped === 1 ? "matches" : "match"}`
|
|
16
|
+
)) : (s = e.would_update === 0 ? "Nothing would change" : `Changes ${d(e.would_update, "record")}`, e.links_unknown && n.push("you cannot read the current links, so this counts every record"), e.skipped && n.push(`${d(e.skipped, "record")} already ${e.skipped === 1 ? "holds" : "hold"} it`)), e.refused && n.push(
|
|
17
|
+
`${d(e.refused, "record")} refused${e.refused_reason ? ` — ${e.refused_reason}` : ""}`
|
|
18
|
+
), e.unreadable && n.push(`${d(e.unreadable, "record")} you cannot open`), { headline: s, notes: n };
|
|
19
|
+
}
|
|
20
|
+
function c(e) {
|
|
21
|
+
var n, s;
|
|
22
|
+
const o = [`Updated ${d(e.updated, "record")}`];
|
|
23
|
+
if (e.links_added || e.links_removed) {
|
|
24
|
+
const r = [];
|
|
25
|
+
e.links_added && r.push(`${d(e.links_added, "link")} added`), e.links_removed && r.push(`${d(e.links_removed, "link")} removed`), o[0] += ` (${r.join(", ")})`;
|
|
26
|
+
}
|
|
27
|
+
if (e.skipped && o.push(`${e.skipped.toLocaleString()} already there`), e.refused && o.push(
|
|
28
|
+
`${e.refused.toLocaleString()} refused — ${a(e.refused_reason ?? "locked on its form", "locked on its form")}`
|
|
29
|
+
), e.failed) {
|
|
30
|
+
const r = (s = (n = e.failures) == null ? void 0 : n[0]) == null ? void 0 : s.reason, i = r ? a(r, "could not be changed") : null;
|
|
31
|
+
o.push(`${e.failed.toLocaleString()} not changed${i ? ` — ${i}` : ""}`);
|
|
32
|
+
}
|
|
33
|
+
return o.join(" · ");
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
l as bulkLinksValue,
|
|
37
|
+
u as bulkPreviewSentence,
|
|
38
|
+
c as bulkUpdateOutcome
|
|
39
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsxs as t, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { Sigma as p, ChevronDown as b, PenLine as h, Check as x } from "lucide-react";
|
|
3
|
+
import { useState as g } from "react";
|
|
4
|
+
import { cn as i } from "../../lib/utils.js";
|
|
5
|
+
import { Popover as v, PopoverTrigger as w, PopoverContent as N } from "../ui/popover.js";
|
|
6
|
+
import { TOTAL_FNS as y } from "./column-totals.js";
|
|
7
|
+
function j({
|
|
8
|
+
label: u,
|
|
9
|
+
selectedCount: r,
|
|
10
|
+
onSetSelected: s,
|
|
11
|
+
setUnavailable: a,
|
|
12
|
+
totals: o
|
|
13
|
+
}) {
|
|
14
|
+
const [m, c] = g(!1);
|
|
15
|
+
if (!s && !o) return null;
|
|
16
|
+
const l = (e) => e.stopPropagation(), d = !!(o != null && o.fn);
|
|
17
|
+
return /* @__PURE__ */ t(v, { open: m, onOpenChange: c, children: [
|
|
18
|
+
/* @__PURE__ */ n(w, { asChild: !0, children: /* @__PURE__ */ n(
|
|
19
|
+
"button",
|
|
20
|
+
{
|
|
21
|
+
type: "button",
|
|
22
|
+
onClick: l,
|
|
23
|
+
onKeyDown: l,
|
|
24
|
+
"aria-label": `${u} column menu`,
|
|
25
|
+
"data-cbv-col-menu": !0,
|
|
26
|
+
"data-tip": "Column menu",
|
|
27
|
+
className: i(
|
|
28
|
+
"ml-1 inline-flex h-4 w-4 items-center justify-center rounded align-middle transition-opacity focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
29
|
+
m || d ? "text-[#00a5cc] opacity-100" : "text-slate-400 opacity-0 hover:text-slate-600 group-hover/hcell:opacity-100 dark:text-slate-500 dark:hover:text-slate-300"
|
|
30
|
+
),
|
|
31
|
+
children: d ? /* @__PURE__ */ n(p, { className: "h-3 w-3" }) : /* @__PURE__ */ n(b, { className: "h-3 w-3" })
|
|
32
|
+
}
|
|
33
|
+
) }),
|
|
34
|
+
/* @__PURE__ */ t(
|
|
35
|
+
N,
|
|
36
|
+
{
|
|
37
|
+
align: "start",
|
|
38
|
+
sideOffset: 6,
|
|
39
|
+
className: "w-64 p-1 normal-case tracking-normal",
|
|
40
|
+
onClick: l,
|
|
41
|
+
onKeyDown: l,
|
|
42
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
43
|
+
"data-cbv-col-menu-panel": !0,
|
|
44
|
+
children: [
|
|
45
|
+
s && /* @__PURE__ */ n("div", { className: i(o && "border-b border-border pb-1"), children: /* @__PURE__ */ t(
|
|
46
|
+
"button",
|
|
47
|
+
{
|
|
48
|
+
type: "button",
|
|
49
|
+
disabled: r === 0 || !!a,
|
|
50
|
+
onClick: () => {
|
|
51
|
+
c(!1), setTimeout(s, 0);
|
|
52
|
+
},
|
|
53
|
+
"data-cbv-col-set": !0,
|
|
54
|
+
className: "flex w-full items-start gap-2 rounded-sm px-2 py-1.5 text-left text-[12.5px] text-foreground hover:bg-muted focus-visible:bg-muted focus-visible:outline-none disabled:cursor-default disabled:hover:bg-transparent",
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ n(h, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
57
|
+
/* @__PURE__ */ t("span", { className: "min-w-0", children: [
|
|
58
|
+
/* @__PURE__ */ t(
|
|
59
|
+
"span",
|
|
60
|
+
{
|
|
61
|
+
className: i(
|
|
62
|
+
"block",
|
|
63
|
+
(r === 0 || a) && "text-muted-foreground"
|
|
64
|
+
),
|
|
65
|
+
children: [
|
|
66
|
+
"Set ",
|
|
67
|
+
u,
|
|
68
|
+
" on",
|
|
69
|
+
" ",
|
|
70
|
+
r > 0 ? `${r.toLocaleString()} selected row${r === 1 ? "" : "s"}` : "selected rows",
|
|
71
|
+
"…"
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
(a || r === 0) && /* @__PURE__ */ n("span", { className: "block text-[11px] leading-4 text-muted-foreground", children: a ?? "Tick the rows to change first." })
|
|
76
|
+
] })
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
) }),
|
|
80
|
+
o && /* @__PURE__ */ t("fieldset", { className: i("m-0 min-w-0 border-0 p-0", s && "pt-1"), children: [
|
|
81
|
+
/* @__PURE__ */ n("legend", { className: "px-2 pb-0.5 pt-1 text-[10.5px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Σ Totals row" }),
|
|
82
|
+
[
|
|
83
|
+
{ fn: null, label: "Off" },
|
|
84
|
+
...y
|
|
85
|
+
].map((e) => {
|
|
86
|
+
const f = (o.fn ?? null) === e.fn;
|
|
87
|
+
return /* @__PURE__ */ t(
|
|
88
|
+
"button",
|
|
89
|
+
{
|
|
90
|
+
type: "button",
|
|
91
|
+
"aria-pressed": f,
|
|
92
|
+
"data-cbv-col-total": e.fn ?? "off",
|
|
93
|
+
onClick: () => {
|
|
94
|
+
o.onChange(e.fn), c(!1);
|
|
95
|
+
},
|
|
96
|
+
className: "flex w-full items-center gap-2 rounded-sm px-2 py-1 text-left text-[12.5px] text-foreground hover:bg-muted focus-visible:bg-muted focus-visible:outline-none",
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ n(x, { className: i("h-3.5 w-3.5 text-[#00a5cc]", !f && "invisible") }),
|
|
99
|
+
e.label
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
e.fn ?? "off"
|
|
103
|
+
);
|
|
104
|
+
})
|
|
105
|
+
] })
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
] });
|
|
110
|
+
}
|
|
111
|
+
export {
|
|
112
|
+
j as ColumnHeaderMenu
|
|
113
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { formatValue as s } from "../../lib/format-value.js";
|
|
2
|
+
const u = [
|
|
3
|
+
{ fn: "sum", label: "Sum", short: "Sum" },
|
|
4
|
+
{ fn: "avg", label: "Average", short: "Avg" },
|
|
5
|
+
{ fn: "min", label: "Minimum", short: "Min" },
|
|
6
|
+
{ fn: "max", label: "Maximum", short: "Max" },
|
|
7
|
+
{ fn: "count", label: "Count (filled in)", short: "Count" }
|
|
8
|
+
];
|
|
9
|
+
function f(t) {
|
|
10
|
+
return typeof t == "string" && u.some((e) => e.fn === t);
|
|
11
|
+
}
|
|
12
|
+
function m(t) {
|
|
13
|
+
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(t);
|
|
14
|
+
}
|
|
15
|
+
function g(t, e, n) {
|
|
16
|
+
return {
|
|
17
|
+
[e]: t,
|
|
18
|
+
...n.search ? { search: n.search } : {},
|
|
19
|
+
...n.conditions ? { conditions: n.conditions } : {}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function h(t, e, n) {
|
|
23
|
+
var a, c, l;
|
|
24
|
+
const o = (l = (c = (a = t == null ? void 0 : t.data) == null ? void 0 : a[0]) == null ? void 0 : c[n]) == null ? void 0 : l[e];
|
|
25
|
+
if (o == null || o === "") return null;
|
|
26
|
+
const r = Number(o);
|
|
27
|
+
return Number.isFinite(r) ? r : null;
|
|
28
|
+
}
|
|
29
|
+
function b(t, e, n) {
|
|
30
|
+
return e === "count" ? Math.round(t).toLocaleString("en-US") : (n == null ? void 0 : n.type) === "number" ? s(String(t), n) : (Math.round(t * 100) / 100).toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
31
|
+
}
|
|
32
|
+
const i = (t) => `nvr_cbv_totals_${t}`;
|
|
33
|
+
function S(t) {
|
|
34
|
+
try {
|
|
35
|
+
const e = localStorage.getItem(i(t)), n = e ? JSON.parse(e) : null;
|
|
36
|
+
if (!n || typeof n != "object") return {};
|
|
37
|
+
const o = {};
|
|
38
|
+
for (const [r, a] of Object.entries(n))
|
|
39
|
+
m(r) && f(a) && (o[r] = a);
|
|
40
|
+
return o;
|
|
41
|
+
} catch {
|
|
42
|
+
return {};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function p(t, e) {
|
|
46
|
+
try {
|
|
47
|
+
Object.keys(e).length === 0 ? localStorage.removeItem(i(t)) : localStorage.setItem(i(t), JSON.stringify(e));
|
|
48
|
+
} catch {
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function y(t, e, n) {
|
|
52
|
+
var a;
|
|
53
|
+
const o = ((a = u.find((c) => c.fn === t)) == null ? void 0 : a.label.toLowerCase()) ?? t, r = n == null ? "all matching records" : `all ${n.toLocaleString("en-US")} matching records`;
|
|
54
|
+
return t === "count" ? `Records with ${e} filled in, across ${r}` : `${o.charAt(0).toUpperCase()}${o.slice(1)} of ${e} across ${r}`;
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
u as TOTAL_FNS,
|
|
58
|
+
b as formatTotal,
|
|
59
|
+
f as isTotalFn,
|
|
60
|
+
S as loadRememberedTotals,
|
|
61
|
+
h as readTotal,
|
|
62
|
+
p as rememberTotals,
|
|
63
|
+
y as totalTip,
|
|
64
|
+
m as totalsEligibleKey,
|
|
65
|
+
g as totalsParams
|
|
66
|
+
};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { jsxs as l, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { ArrowRight as k, ArrowLeft as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { titleCase as f, formatRelative as
|
|
5
|
-
import { Popover as
|
|
2
|
+
import { AlertTriangle as b, ArrowRight as k, ArrowLeft as w, Workflow as y, LayoutTemplate as v } from "lucide-react";
|
|
3
|
+
import { useState as C, useRef as _, useCallback as d, useEffect as u } from "react";
|
|
4
|
+
import { formatNumber as h, titleCase as f, formatRelative as P, formatDateTime as $ } from "../../lib/utils.js";
|
|
5
|
+
import { Popover as A, PopoverAnchor as S, PopoverContent as E } from "../ui/popover.js";
|
|
6
6
|
import { Skeleton as c } from "../ui/skeleton.js";
|
|
7
|
-
import { useCollectionSummary as
|
|
8
|
-
const
|
|
9
|
-
function
|
|
10
|
-
const [n, i] =
|
|
11
|
-
|
|
7
|
+
import { useCollectionSummary as L } from "./directory-data.js";
|
|
8
|
+
const T = 400, O = 150, N = 6;
|
|
9
|
+
function U(s, e = T) {
|
|
10
|
+
const [n, i] = C(!1), o = _(null), t = d(() => {
|
|
11
|
+
o.current && clearTimeout(o.current), o.current = null;
|
|
12
12
|
}, []), m = d(() => {
|
|
13
|
-
s && (
|
|
14
|
-
}, [s,
|
|
15
|
-
|
|
16
|
-
}, [
|
|
17
|
-
|
|
18
|
-
}, [
|
|
19
|
-
return u(() =>
|
|
20
|
-
s ||
|
|
21
|
-
}, [s,
|
|
13
|
+
s && (t(), o.current = setTimeout(() => i(!0), e));
|
|
14
|
+
}, [s, t, e]), p = d(() => {
|
|
15
|
+
t(), o.current = setTimeout(() => i(!1), O);
|
|
16
|
+
}, [t]), r = d(() => {
|
|
17
|
+
t(), i(!1);
|
|
18
|
+
}, [t]);
|
|
19
|
+
return u(() => t, [t]), u(() => {
|
|
20
|
+
s || r();
|
|
21
|
+
}, [s, r]), { open: n, show: m, hide: p, cancel: t, close: r };
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function g({ items: s }) {
|
|
24
24
|
if (s.length === 0)
|
|
25
25
|
return /* @__PURE__ */ a("p", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: "None" });
|
|
26
|
-
const
|
|
26
|
+
const e = s.slice(0, N), n = s.slice(N);
|
|
27
27
|
return /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1", children: [
|
|
28
|
-
|
|
28
|
+
e.map((i) => /* @__PURE__ */ a(
|
|
29
29
|
"span",
|
|
30
30
|
{
|
|
31
31
|
"data-tip": i.tip,
|
|
@@ -47,131 +47,158 @@ function N({ items: s }) {
|
|
|
47
47
|
)
|
|
48
48
|
] });
|
|
49
49
|
}
|
|
50
|
-
function x({ icon: s, children:
|
|
50
|
+
function x({ icon: s, children: e }) {
|
|
51
51
|
return /* @__PURE__ */ l("p", { className: "mb-1 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400 dark:text-slate-500", children: [
|
|
52
52
|
s,
|
|
53
|
-
|
|
53
|
+
e
|
|
54
54
|
] });
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
|
|
56
|
+
function j({ flag: s }) {
|
|
57
|
+
return /* @__PURE__ */ l(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
"data-heavy-list-note": !0,
|
|
61
|
+
className: "flex gap-2 rounded-md bg-amber-50 px-2 py-1.5 text-[11.5px] leading-snug text-amber-800 ring-1 ring-inset ring-amber-200 dark:bg-amber-400/10 dark:text-amber-200 dark:ring-amber-400/25",
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ a(b, { className: "mt-px h-3.5 w-3.5 shrink-0", "aria-hidden": "true" }),
|
|
64
|
+
/* @__PURE__ */ l("div", { className: "min-w-0", children: [
|
|
65
|
+
/* @__PURE__ */ a("p", { className: "font-medium", children: "Heavy list columns" }),
|
|
66
|
+
/* @__PURE__ */ a("ul", { className: "mt-0.5 space-y-px", children: s.fields.map((e) => /* @__PURE__ */ l("li", { children: [
|
|
67
|
+
e.label,
|
|
68
|
+
": up to ",
|
|
69
|
+
h(e.max),
|
|
70
|
+
" per record (avg",
|
|
71
|
+
" ",
|
|
72
|
+
h(Math.round(e.avg)),
|
|
73
|
+
")"
|
|
74
|
+
] }, e.field)) }),
|
|
75
|
+
/* @__PURE__ */ a("p", { className: "mt-0.5 text-amber-700/90 dark:text-amber-300/80", children: "The list opens on them. Fix it in Data model → Collection Browser." })
|
|
76
|
+
] })
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
function D({ collection: s }) {
|
|
82
|
+
const { data: e, isLoading: n, isError: i } = L(s, !0);
|
|
58
83
|
if (n)
|
|
59
84
|
return /* @__PURE__ */ l("div", { className: "space-y-2", role: "status", "aria-busy": "true", "aria-label": "Loading summary", children: [
|
|
60
85
|
/* @__PURE__ */ a(c, { className: "h-3 w-24" }),
|
|
61
|
-
[0, 1, 2, 3, 4].map((
|
|
86
|
+
[0, 1, 2, 3, 4].map((t) => /* @__PURE__ */ l("div", { className: "flex justify-between gap-4", children: [
|
|
62
87
|
/* @__PURE__ */ a(c, { className: "h-3 w-32" }),
|
|
63
88
|
/* @__PURE__ */ a(c, { className: "h-3 w-12" })
|
|
64
|
-
] },
|
|
89
|
+
] }, t)),
|
|
65
90
|
/* @__PURE__ */ a(c, { className: "h-3 w-20" }),
|
|
66
91
|
/* @__PURE__ */ a(c, { className: "h-4 w-full" })
|
|
67
92
|
] });
|
|
68
|
-
if (i || !
|
|
93
|
+
if (i || !e)
|
|
69
94
|
return /* @__PURE__ */ a("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: "Couldn't load this collection's summary." });
|
|
70
|
-
const
|
|
95
|
+
const o = Math.max(0, e.field_count - e.fields.length);
|
|
71
96
|
return /* @__PURE__ */ l("div", { className: "space-y-3", children: [
|
|
72
97
|
/* @__PURE__ */ l("div", { children: [
|
|
73
98
|
/* @__PURE__ */ l(x, { children: [
|
|
74
|
-
|
|
99
|
+
e.field_count,
|
|
75
100
|
" field",
|
|
76
|
-
|
|
101
|
+
e.field_count === 1 ? "" : "s"
|
|
77
102
|
] }),
|
|
78
|
-
|
|
103
|
+
e.fields.length === 0 ? /* @__PURE__ */ a("p", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: "No fields yet" }) : /* @__PURE__ */ a("ul", { className: "space-y-0.5", children: e.fields.slice(0, 8).map((t) => /* @__PURE__ */ l("li", { className: "flex items-baseline justify-between gap-3 text-[12px]", children: [
|
|
79
104
|
/* @__PURE__ */ a(
|
|
80
105
|
"span",
|
|
81
106
|
{
|
|
82
107
|
className: "truncate text-slate-700 dark:text-slate-200",
|
|
83
|
-
"data-tip":
|
|
84
|
-
children:
|
|
108
|
+
"data-tip": t.label !== t.field ? t.field : void 0,
|
|
109
|
+
children: t.label || t.field
|
|
85
110
|
}
|
|
86
111
|
),
|
|
87
|
-
/* @__PURE__ */ a("span", { className: "shrink-0 font-mono text-[10px] text-slate-400 dark:text-slate-500", children:
|
|
88
|
-
] },
|
|
89
|
-
|
|
112
|
+
/* @__PURE__ */ a("span", { className: "shrink-0 font-mono text-[10px] text-slate-400 dark:text-slate-500", children: t.type })
|
|
113
|
+
] }, t.field)) }),
|
|
114
|
+
o > 0 && /* @__PURE__ */ l("p", { className: "mt-0.5 text-[11px] text-slate-400 dark:text-slate-500", children: [
|
|
90
115
|
"and ",
|
|
91
|
-
|
|
116
|
+
o,
|
|
92
117
|
" more"
|
|
93
118
|
] })
|
|
94
119
|
] }),
|
|
95
120
|
/* @__PURE__ */ l("div", { children: [
|
|
96
121
|
/* @__PURE__ */ a(x, { icon: /* @__PURE__ */ a(k, { className: "h-2.5 w-2.5" }), children: "Points to" }),
|
|
97
122
|
/* @__PURE__ */ a(
|
|
98
|
-
|
|
123
|
+
g,
|
|
99
124
|
{
|
|
100
|
-
items:
|
|
101
|
-
key: `${
|
|
102
|
-
label: f(
|
|
103
|
-
tip: `${
|
|
125
|
+
items: e.relations_out.map((t) => ({
|
|
126
|
+
key: `${t.field}:${t.collection}`,
|
|
127
|
+
label: f(t.collection),
|
|
128
|
+
tip: `${t.field} → ${t.collection}`
|
|
104
129
|
}))
|
|
105
130
|
}
|
|
106
131
|
)
|
|
107
132
|
] }),
|
|
108
133
|
/* @__PURE__ */ l("div", { children: [
|
|
109
|
-
/* @__PURE__ */ a(x, { icon: /* @__PURE__ */ a(
|
|
134
|
+
/* @__PURE__ */ a(x, { icon: /* @__PURE__ */ a(w, { className: "h-2.5 w-2.5" }), children: "Used by" }),
|
|
110
135
|
/* @__PURE__ */ a(
|
|
111
|
-
|
|
136
|
+
g,
|
|
112
137
|
{
|
|
113
|
-
items:
|
|
114
|
-
key: `${
|
|
115
|
-
label: f(
|
|
116
|
-
tip: `${
|
|
138
|
+
items: e.relations_in.map((t) => ({
|
|
139
|
+
key: `${t.collection}:${t.field}`,
|
|
140
|
+
label: f(t.collection),
|
|
141
|
+
tip: `${t.collection}.${t.field}`
|
|
117
142
|
}))
|
|
118
143
|
}
|
|
119
144
|
)
|
|
120
145
|
] }),
|
|
121
|
-
(
|
|
122
|
-
|
|
123
|
-
/* @__PURE__ */ a(w, { className: "h-3 w-3 shrink-0 text-slate-400 dark:text-slate-500" }),
|
|
124
|
-
/* @__PURE__ */ a("span", { className: "truncate", children: t.pipeline })
|
|
125
|
-
] }),
|
|
126
|
-
t.forms > 0 && /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1", children: [
|
|
146
|
+
(e.pipeline || e.forms > 0) && /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-slate-600 dark:text-slate-300", children: [
|
|
147
|
+
e.pipeline && /* @__PURE__ */ l("span", { className: "inline-flex min-w-0 items-center gap-1", children: [
|
|
127
148
|
/* @__PURE__ */ a(y, { className: "h-3 w-3 shrink-0 text-slate-400 dark:text-slate-500" }),
|
|
128
|
-
|
|
149
|
+
/* @__PURE__ */ a("span", { className: "truncate", children: e.pipeline })
|
|
150
|
+
] }),
|
|
151
|
+
e.forms > 0 && /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1", children: [
|
|
152
|
+
/* @__PURE__ */ a(v, { className: "h-3 w-3 shrink-0 text-slate-400 dark:text-slate-500" }),
|
|
153
|
+
e.forms,
|
|
129
154
|
" form",
|
|
130
|
-
|
|
155
|
+
e.forms === 1 ? "" : "s"
|
|
131
156
|
] })
|
|
132
157
|
] }),
|
|
133
|
-
/* @__PURE__ */ a("p", { className: "border-t border-slate-100 pt-2 text-[11px] text-slate-500 dark:border-white/[0.06] dark:text-slate-400", children:
|
|
158
|
+
/* @__PURE__ */ a("p", { className: "border-t border-slate-100 pt-2 text-[11px] text-slate-500 dark:border-white/[0.06] dark:text-slate-400", children: e.last_edit ? /* @__PURE__ */ l("span", { "data-tip": $(e.last_edit.at), children: [
|
|
134
159
|
"Edited ",
|
|
135
|
-
|
|
136
|
-
|
|
160
|
+
P(e.last_edit.at),
|
|
161
|
+
e.last_edit.user ? ` by ${e.last_edit.user}` : ""
|
|
137
162
|
] }) : "No edits in the last 90 days" })
|
|
138
163
|
] });
|
|
139
164
|
}
|
|
140
|
-
function
|
|
165
|
+
function W({
|
|
141
166
|
collection: s,
|
|
142
|
-
title:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
167
|
+
title: e,
|
|
168
|
+
heavyList: n,
|
|
169
|
+
open: i,
|
|
170
|
+
onClose: o,
|
|
171
|
+
onCardEnter: t,
|
|
172
|
+
onCardLeave: m,
|
|
173
|
+
children: p
|
|
148
174
|
}) {
|
|
149
|
-
return /* @__PURE__ */ l(
|
|
150
|
-
/* @__PURE__ */ a(
|
|
151
|
-
|
|
152
|
-
|
|
175
|
+
return /* @__PURE__ */ l(A, { open: i, onOpenChange: (r) => !r && o(), children: [
|
|
176
|
+
/* @__PURE__ */ a(S, { asChild: !0, children: p }),
|
|
177
|
+
i && /* @__PURE__ */ l(
|
|
178
|
+
E,
|
|
153
179
|
{
|
|
154
180
|
side: "right",
|
|
155
181
|
align: "start",
|
|
156
182
|
sideOffset: 12,
|
|
157
183
|
collisionPadding: 12,
|
|
158
184
|
avoidCollisions: !0,
|
|
159
|
-
onOpenAutoFocus: (
|
|
160
|
-
onCloseAutoFocus: (
|
|
161
|
-
onPointerEnter:
|
|
162
|
-
onPointerLeave:
|
|
163
|
-
onClick: (
|
|
164
|
-
"aria-label": `${
|
|
185
|
+
onOpenAutoFocus: (r) => r.preventDefault(),
|
|
186
|
+
onCloseAutoFocus: (r) => r.preventDefault(),
|
|
187
|
+
onPointerEnter: t,
|
|
188
|
+
onPointerLeave: m,
|
|
189
|
+
onClick: (r) => r.stopPropagation(),
|
|
190
|
+
"aria-label": `${e} summary`,
|
|
165
191
|
className: "w-[320px] p-3 motion-reduce:animate-none",
|
|
166
192
|
children: [
|
|
167
|
-
/* @__PURE__ */ a("p", { className: "mb-2 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children:
|
|
168
|
-
/* @__PURE__ */ a(
|
|
193
|
+
/* @__PURE__ */ a("p", { className: "mb-2 truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: e }),
|
|
194
|
+
n && n.fields.length > 0 && /* @__PURE__ */ a("div", { className: "mb-2.5", children: /* @__PURE__ */ a(j, { flag: n }) }),
|
|
195
|
+
/* @__PURE__ */ a(D, { collection: s })
|
|
169
196
|
]
|
|
170
197
|
}
|
|
171
198
|
)
|
|
172
199
|
] });
|
|
173
200
|
}
|
|
174
201
|
export {
|
|
175
|
-
|
|
176
|
-
|
|
202
|
+
W as CollectionHoverCard,
|
|
203
|
+
U as useHoverIntent
|
|
177
204
|
};
|