@nivaro/react 0.3.111 → 0.3.113
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 +207 -3
- package/dist/index.js +745 -728
- package/dist/shared/components/CollectionBrowserView.js +3133 -2954
- 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/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 +130 -0
- package/dist/shared/components/cbv/column-totals.js +163 -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 +3002 -2825
- 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/UserChip.js +262 -239
- package/dist/shared/components/item-edit/ViewAsRole.js +129 -52
- package/dist/shared/components/item-edit/grid-search.js +375 -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/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 +1440 -1397
- package/dist/shared/components/panels/RecordIntegrityBanner.js +39 -38
- package/dist/shared/components/panels/RevisionsPanel.js +261 -260
- package/dist/shared/components/panels/StandInReason.js +69 -0
- 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,130 @@
|
|
|
1
|
+
import { jsxs as t, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Sigma as f, ChevronDown as b, PenLine as x, Check as g } from "lucide-react";
|
|
3
|
+
import { useState as h } from "react";
|
|
4
|
+
import { cn as a } 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: l,
|
|
11
|
+
setUnavailable: i,
|
|
12
|
+
totals: e
|
|
13
|
+
}) {
|
|
14
|
+
const [d, s] = h(!1);
|
|
15
|
+
if (!l && !e) return null;
|
|
16
|
+
const c = (n) => n.stopPropagation(), m = !!(e != null && e.fn);
|
|
17
|
+
return /* @__PURE__ */ t(v, { open: d, onOpenChange: s, children: [
|
|
18
|
+
/* @__PURE__ */ o(w, { asChild: !0, children: /* @__PURE__ */ o(
|
|
19
|
+
"button",
|
|
20
|
+
{
|
|
21
|
+
type: "button",
|
|
22
|
+
onClick: c,
|
|
23
|
+
onKeyDown: c,
|
|
24
|
+
"aria-label": `${u} column menu`,
|
|
25
|
+
"data-cbv-col-menu": !0,
|
|
26
|
+
"data-tip": "Column menu",
|
|
27
|
+
className: a(
|
|
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
|
+
d || m ? "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: m ? /* @__PURE__ */ o(f, { className: "h-3 w-3" }) : /* @__PURE__ */ o(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: c,
|
|
41
|
+
onKeyDown: c,
|
|
42
|
+
onCloseAutoFocus: (n) => n.preventDefault(),
|
|
43
|
+
"data-cbv-col-menu-panel": !0,
|
|
44
|
+
children: [
|
|
45
|
+
l && /* @__PURE__ */ o("div", { className: a(e && "border-b border-border pb-1"), children: /* @__PURE__ */ t(
|
|
46
|
+
"button",
|
|
47
|
+
{
|
|
48
|
+
type: "button",
|
|
49
|
+
disabled: r === 0 || !!i,
|
|
50
|
+
onClick: () => {
|
|
51
|
+
s(!1), setTimeout(l, 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__ */ o(x, { 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: a(
|
|
62
|
+
"block",
|
|
63
|
+
(r === 0 || i) && "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
|
+
(i || r === 0) && /* @__PURE__ */ o("span", { className: "block text-[11px] leading-4 text-muted-foreground", children: i ?? "Tick the rows to change first." })
|
|
76
|
+
] })
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
) }),
|
|
80
|
+
e && /* @__PURE__ */ t("fieldset", { className: a("m-0 min-w-0 border-0 p-0", l && "pt-1"), children: [
|
|
81
|
+
/* @__PURE__ */ o("legend", { className: "px-2 pb-0.5 pt-1 text-[10.5px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Σ Totals row" }),
|
|
82
|
+
e.unavailable ? /* @__PURE__ */ o(
|
|
83
|
+
"p",
|
|
84
|
+
{
|
|
85
|
+
"data-cbv-col-total-unavailable": !0,
|
|
86
|
+
"data-tip": e.unavailable,
|
|
87
|
+
className: "cursor-help px-2 py-1 text-[12px] leading-snug text-muted-foreground underline decoration-dotted underline-offset-2",
|
|
88
|
+
children: "No total for this column"
|
|
89
|
+
}
|
|
90
|
+
) : null,
|
|
91
|
+
e.note && !e.unavailable ? /* @__PURE__ */ o(
|
|
92
|
+
"p",
|
|
93
|
+
{
|
|
94
|
+
"data-cbv-col-total-note": !0,
|
|
95
|
+
className: "px-2 pb-1 text-[11.5px] leading-snug text-muted-foreground",
|
|
96
|
+
children: e.note
|
|
97
|
+
}
|
|
98
|
+
) : null,
|
|
99
|
+
(e.unavailable ? [] : [
|
|
100
|
+
{ fn: null, label: "Off" },
|
|
101
|
+
...y.filter((n) => !e.only || e.only.includes(n.fn))
|
|
102
|
+
]).map((n) => {
|
|
103
|
+
const p = (e.fn ?? null) === n.fn;
|
|
104
|
+
return /* @__PURE__ */ t(
|
|
105
|
+
"button",
|
|
106
|
+
{
|
|
107
|
+
type: "button",
|
|
108
|
+
"aria-pressed": p,
|
|
109
|
+
"data-cbv-col-total": n.fn ?? "off",
|
|
110
|
+
onClick: () => {
|
|
111
|
+
e.onChange(n.fn), s(!1);
|
|
112
|
+
},
|
|
113
|
+
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",
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ o(g, { className: a("h-3.5 w-3.5 text-[#00a5cc]", !p && "invisible") }),
|
|
116
|
+
n.label
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
n.fn ?? "off"
|
|
120
|
+
);
|
|
121
|
+
})
|
|
122
|
+
] })
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
] });
|
|
127
|
+
}
|
|
128
|
+
export {
|
|
129
|
+
j as ColumnHeaderMenu
|
|
130
|
+
};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { formatValue as S } from "../../lib/format-value.js";
|
|
2
|
+
const p = [
|
|
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 b(e) {
|
|
10
|
+
return typeof e == "string" && p.some((n) => n.fn === e);
|
|
11
|
+
}
|
|
12
|
+
function v(e) {
|
|
13
|
+
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(e);
|
|
14
|
+
}
|
|
15
|
+
function O(e, n, t) {
|
|
16
|
+
return {
|
|
17
|
+
[n]: e,
|
|
18
|
+
...t.search ? { search: t.search } : {},
|
|
19
|
+
...t.conditions ? { conditions: t.conditions } : {}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function x(e, n, t) {
|
|
23
|
+
var s, l, a;
|
|
24
|
+
const r = (a = (l = (s = e == null ? void 0 : e.data) == null ? void 0 : s[0]) == null ? void 0 : l[t]) == null ? void 0 : a[n];
|
|
25
|
+
if (r == null || r === "") return null;
|
|
26
|
+
const o = Number(r);
|
|
27
|
+
return Number.isFinite(o) ? o : null;
|
|
28
|
+
}
|
|
29
|
+
function k(e, n, t) {
|
|
30
|
+
return n === "count" ? Math.round(e).toLocaleString("en-US") : (t == null ? void 0 : t.type) === "number" ? S(String(e), t) : (Math.round(e * 100) / 100).toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
31
|
+
}
|
|
32
|
+
const d = (e) => `nvr_cbv_totals_${e}`, _ = (e) => e === "off" || b(e);
|
|
33
|
+
function w(e) {
|
|
34
|
+
try {
|
|
35
|
+
const n = localStorage.getItem(d(e)), t = n ? JSON.parse(n) : null;
|
|
36
|
+
if (!t || typeof t != "object") return {};
|
|
37
|
+
const r = t.v === 2 && t.o && typeof t.o == "object" ? t.o : t, o = {};
|
|
38
|
+
for (const [s, l] of Object.entries(r)) v(s) && _(l) && (o[s] = l);
|
|
39
|
+
return o;
|
|
40
|
+
} catch {
|
|
41
|
+
return {};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function M(e, n) {
|
|
45
|
+
try {
|
|
46
|
+
Object.keys(n).length === 0 ? localStorage.removeItem(d(e)) : localStorage.setItem(d(e), JSON.stringify({ v: 2, o: n }));
|
|
47
|
+
} catch {
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function $(e, n) {
|
|
51
|
+
const t = { ...e };
|
|
52
|
+
for (const [r, o] of Object.entries(n))
|
|
53
|
+
o === "off" ? delete t[r] : t[r] = o;
|
|
54
|
+
return t;
|
|
55
|
+
}
|
|
56
|
+
function z(e, n, t) {
|
|
57
|
+
return { ...e, [n]: t ?? "off" };
|
|
58
|
+
}
|
|
59
|
+
function j(e, n) {
|
|
60
|
+
const t = {};
|
|
61
|
+
for (const [r, o] of Object.entries(e))
|
|
62
|
+
(o === "off" ? !n[r] : n[r] === o) || (t[r] = o);
|
|
63
|
+
return t;
|
|
64
|
+
}
|
|
65
|
+
function g(e) {
|
|
66
|
+
return !e.computed_formula || !!e.computed_store;
|
|
67
|
+
}
|
|
68
|
+
const y = /* @__PURE__ */ new Set(["integer", "bigInteger", "biginteger", "decimal", "float"]);
|
|
69
|
+
function T(e) {
|
|
70
|
+
const n = String(e ?? "").trim();
|
|
71
|
+
if (!n) return null;
|
|
72
|
+
let t = 0;
|
|
73
|
+
const r = () => {
|
|
74
|
+
for (; t < n.length && /\s/.test(n[t]); ) t++;
|
|
75
|
+
}, o = () => {
|
|
76
|
+
r();
|
|
77
|
+
const u = n.slice(t), i = /^item\.([A-Za-z_][A-Za-z0-9_]*)/.exec(u);
|
|
78
|
+
if (i)
|
|
79
|
+
return t += i[0].length, i[1];
|
|
80
|
+
const c = /^\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/.exec(u);
|
|
81
|
+
if (c)
|
|
82
|
+
return t += c[0].length, c[1];
|
|
83
|
+
const f = /^coalesce\s*\(/i.exec(u);
|
|
84
|
+
if (f) {
|
|
85
|
+
t += f[0].length;
|
|
86
|
+
const m = o(), h = /^\s*,\s*0(?:\.0+)?\s*\)/.exec(n.slice(t));
|
|
87
|
+
return !m || !h ? null : (t += h[0].length, m);
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}, s = /* @__PURE__ */ new Map(), l = (u) => {
|
|
91
|
+
let i = !0;
|
|
92
|
+
for (; ; ) {
|
|
93
|
+
r();
|
|
94
|
+
let c = u;
|
|
95
|
+
if (n[t] === "+" || n[t] === "-")
|
|
96
|
+
n[t] === "-" && (c = c === 1 ? -1 : 1), t++, r();
|
|
97
|
+
else if (!i) return !1;
|
|
98
|
+
if (i = !1, n[t] === "(") {
|
|
99
|
+
if (t++, !l(c) || (r(), n[t] !== ")")) return !1;
|
|
100
|
+
t++;
|
|
101
|
+
} else {
|
|
102
|
+
const f = o();
|
|
103
|
+
if (!f) return !1;
|
|
104
|
+
s.set(f, (s.get(f) ?? 0) + c);
|
|
105
|
+
}
|
|
106
|
+
if (r(), t >= n.length || n[t] === ")") return !0;
|
|
107
|
+
if (n[t] !== "+" && n[t] !== "-") return !1;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
if (!l(1) || (r(), t !== n.length)) return null;
|
|
111
|
+
const a = [];
|
|
112
|
+
for (const [u, i] of s)
|
|
113
|
+
if (i === 1 || i === -1) a.push({ field: u, sign: i });
|
|
114
|
+
else if (i !== 0) return null;
|
|
115
|
+
return a.length ? a : null;
|
|
116
|
+
}
|
|
117
|
+
function N(e, n) {
|
|
118
|
+
if (g(e)) return { kind: "server" };
|
|
119
|
+
if (e.computed_type !== "rollup") {
|
|
120
|
+
const t = T(e.computed_formula ?? "");
|
|
121
|
+
if (t != null && t.every((r) => {
|
|
122
|
+
const o = n(r.field);
|
|
123
|
+
return !!o && g(o) && y.has(String(o.type ?? ""));
|
|
124
|
+
}))
|
|
125
|
+
return { kind: "derived", terms: t };
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
kind: "none",
|
|
129
|
+
why: e.computed_type === "rollup" ? "Worked out from linked records each time the list is read, so it has no total." : "Calculated each time the list is read from a formula that does more than add and subtract stored columns, so it has no total."
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function Z(e, n) {
|
|
133
|
+
let t = 0;
|
|
134
|
+
for (const r of e) {
|
|
135
|
+
const o = n(r.field);
|
|
136
|
+
if (o == null) return null;
|
|
137
|
+
t += r.sign * o;
|
|
138
|
+
}
|
|
139
|
+
return Math.round(t * 1e6) / 1e6;
|
|
140
|
+
}
|
|
141
|
+
function C(e, n, t) {
|
|
142
|
+
var s;
|
|
143
|
+
const r = ((s = p.find((l) => l.fn === e)) == null ? void 0 : s.label.toLowerCase()) ?? e, o = t == null ? "all matching records" : `all ${t.toLocaleString("en-US")} matching records`;
|
|
144
|
+
return e === "count" ? `Records with ${n} filled in, across ${o}` : `${r.charAt(0).toUpperCase()}${r.slice(1)} of ${n} across ${o}`;
|
|
145
|
+
}
|
|
146
|
+
export {
|
|
147
|
+
p as TOTAL_FNS,
|
|
148
|
+
Z as combineTerms,
|
|
149
|
+
k as formatTotal,
|
|
150
|
+
g as isStoredField,
|
|
151
|
+
b as isTotalFn,
|
|
152
|
+
T as linearSumTerms,
|
|
153
|
+
w as loadTotalOverrides,
|
|
154
|
+
j as overridesAfterSave,
|
|
155
|
+
x as readTotal,
|
|
156
|
+
M as rememberTotalOverrides,
|
|
157
|
+
z as setOverride,
|
|
158
|
+
$ as shownTotals,
|
|
159
|
+
C as totalTip,
|
|
160
|
+
v as totalsEligibleKey,
|
|
161
|
+
O as totalsParams,
|
|
162
|
+
N as totalsSupport
|
|
163
|
+
};
|