@nivaro/react 0.3.112 → 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/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +37 -1
- package/dist/shared/components/CollectionBrowserView.js +2559 -2505
- package/dist/shared/components/cbv/ColumnHeaderMenu.js +56 -39
- package/dist/shared/components/cbv/column-totals.js +137 -40
- package/dist/shared/components/item-edit/InlineTableField.js +858 -863
- package/dist/shared/components/item-edit/UserChip.js +262 -239
- package/dist/shared/components/item-edit/grid-search.js +164 -134
- package/dist/shared/components/panels/PipelinePanel.js +1136 -1130
- package/dist/shared/components/panels/StandInReason.js +69 -0
- package/package.json +1 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { jsxs as t, jsx as
|
|
2
|
-
import { Sigma as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { cn as
|
|
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
5
|
import { Popover as v, PopoverTrigger as w, PopoverContent as N } from "../ui/popover.js";
|
|
6
6
|
import { TOTAL_FNS as y } from "./column-totals.js";
|
|
7
7
|
function j({
|
|
8
8
|
label: u,
|
|
9
9
|
selectedCount: r,
|
|
10
|
-
onSetSelected:
|
|
11
|
-
setUnavailable:
|
|
12
|
-
totals:
|
|
10
|
+
onSetSelected: l,
|
|
11
|
+
setUnavailable: i,
|
|
12
|
+
totals: e
|
|
13
13
|
}) {
|
|
14
|
-
const [
|
|
15
|
-
if (!
|
|
16
|
-
const
|
|
17
|
-
return /* @__PURE__ */ t(v, { open:
|
|
18
|
-
/* @__PURE__ */
|
|
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
19
|
"button",
|
|
20
20
|
{
|
|
21
21
|
type: "button",
|
|
22
|
-
onClick:
|
|
23
|
-
onKeyDown:
|
|
22
|
+
onClick: c,
|
|
23
|
+
onKeyDown: c,
|
|
24
24
|
"aria-label": `${u} column menu`,
|
|
25
25
|
"data-cbv-col-menu": !0,
|
|
26
26
|
"data-tip": "Column menu",
|
|
27
|
-
className:
|
|
27
|
+
className: a(
|
|
28
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
|
-
|
|
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
30
|
),
|
|
31
|
-
children:
|
|
31
|
+
children: m ? /* @__PURE__ */ o(f, { className: "h-3 w-3" }) : /* @__PURE__ */ o(b, { className: "h-3 w-3" })
|
|
32
32
|
}
|
|
33
33
|
) }),
|
|
34
34
|
/* @__PURE__ */ t(
|
|
@@ -37,30 +37,30 @@ function j({
|
|
|
37
37
|
align: "start",
|
|
38
38
|
sideOffset: 6,
|
|
39
39
|
className: "w-64 p-1 normal-case tracking-normal",
|
|
40
|
-
onClick:
|
|
41
|
-
onKeyDown:
|
|
42
|
-
onCloseAutoFocus: (
|
|
40
|
+
onClick: c,
|
|
41
|
+
onKeyDown: c,
|
|
42
|
+
onCloseAutoFocus: (n) => n.preventDefault(),
|
|
43
43
|
"data-cbv-col-menu-panel": !0,
|
|
44
44
|
children: [
|
|
45
|
-
|
|
45
|
+
l && /* @__PURE__ */ o("div", { className: a(e && "border-b border-border pb-1"), children: /* @__PURE__ */ t(
|
|
46
46
|
"button",
|
|
47
47
|
{
|
|
48
48
|
type: "button",
|
|
49
|
-
disabled: r === 0 || !!
|
|
49
|
+
disabled: r === 0 || !!i,
|
|
50
50
|
onClick: () => {
|
|
51
|
-
|
|
51
|
+
s(!1), setTimeout(l, 0);
|
|
52
52
|
},
|
|
53
53
|
"data-cbv-col-set": !0,
|
|
54
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
55
|
children: [
|
|
56
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ o(x, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
57
57
|
/* @__PURE__ */ t("span", { className: "min-w-0", children: [
|
|
58
58
|
/* @__PURE__ */ t(
|
|
59
59
|
"span",
|
|
60
60
|
{
|
|
61
|
-
className:
|
|
61
|
+
className: a(
|
|
62
62
|
"block",
|
|
63
|
-
(r === 0 ||
|
|
63
|
+
(r === 0 || i) && "text-muted-foreground"
|
|
64
64
|
),
|
|
65
65
|
children: [
|
|
66
66
|
"Set ",
|
|
@@ -72,34 +72,51 @@ function j({
|
|
|
72
72
|
]
|
|
73
73
|
}
|
|
74
74
|
),
|
|
75
|
-
(
|
|
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
76
|
] })
|
|
77
77
|
]
|
|
78
78
|
}
|
|
79
79
|
) }),
|
|
80
|
-
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
|
|
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 ? [] : [
|
|
83
100
|
{ fn: null, label: "Off" },
|
|
84
|
-
...y
|
|
85
|
-
].map((
|
|
86
|
-
const
|
|
101
|
+
...y.filter((n) => !e.only || e.only.includes(n.fn))
|
|
102
|
+
]).map((n) => {
|
|
103
|
+
const p = (e.fn ?? null) === n.fn;
|
|
87
104
|
return /* @__PURE__ */ t(
|
|
88
105
|
"button",
|
|
89
106
|
{
|
|
90
107
|
type: "button",
|
|
91
|
-
"aria-pressed":
|
|
92
|
-
"data-cbv-col-total":
|
|
108
|
+
"aria-pressed": p,
|
|
109
|
+
"data-cbv-col-total": n.fn ?? "off",
|
|
93
110
|
onClick: () => {
|
|
94
|
-
|
|
111
|
+
e.onChange(n.fn), s(!1);
|
|
95
112
|
},
|
|
96
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",
|
|
97
114
|
children: [
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
|
|
115
|
+
/* @__PURE__ */ o(g, { className: a("h-3.5 w-3.5 text-[#00a5cc]", !p && "invisible") }),
|
|
116
|
+
n.label
|
|
100
117
|
]
|
|
101
118
|
},
|
|
102
|
-
|
|
119
|
+
n.fn ?? "off"
|
|
103
120
|
);
|
|
104
121
|
})
|
|
105
122
|
] })
|
|
@@ -1,66 +1,163 @@
|
|
|
1
|
-
import { formatValue as
|
|
2
|
-
const
|
|
1
|
+
import { formatValue as S } from "../../lib/format-value.js";
|
|
2
|
+
const p = [
|
|
3
3
|
{ fn: "sum", label: "Sum", short: "Sum" },
|
|
4
4
|
{ fn: "avg", label: "Average", short: "Avg" },
|
|
5
5
|
{ fn: "min", label: "Minimum", short: "Min" },
|
|
6
6
|
{ fn: "max", label: "Maximum", short: "Max" },
|
|
7
7
|
{ fn: "count", label: "Count (filled in)", short: "Count" }
|
|
8
8
|
];
|
|
9
|
-
function
|
|
10
|
-
return typeof
|
|
9
|
+
function b(e) {
|
|
10
|
+
return typeof e == "string" && p.some((n) => n.fn === e);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(
|
|
12
|
+
function v(e) {
|
|
13
|
+
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(e);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function O(e, n, t) {
|
|
16
16
|
return {
|
|
17
|
-
[
|
|
18
|
-
...
|
|
19
|
-
...
|
|
17
|
+
[n]: e,
|
|
18
|
+
...t.search ? { search: t.search } : {},
|
|
19
|
+
...t.conditions ? { conditions: t.conditions } : {}
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
var
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
return Number.isFinite(
|
|
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
28
|
}
|
|
29
|
-
function
|
|
30
|
-
return
|
|
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
31
|
}
|
|
32
|
-
const
|
|
33
|
-
function
|
|
32
|
+
const d = (e) => `nvr_cbv_totals_${e}`, _ = (e) => e === "off" || b(e);
|
|
33
|
+
function w(e) {
|
|
34
34
|
try {
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
37
|
-
const o = {};
|
|
38
|
-
for (const [
|
|
39
|
-
m(r) && f(a) && (o[r] = a);
|
|
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);
|
|
40
39
|
return o;
|
|
41
40
|
} catch {
|
|
42
41
|
return {};
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
|
-
function
|
|
44
|
+
function M(e, n) {
|
|
46
45
|
try {
|
|
47
|
-
Object.keys(
|
|
46
|
+
Object.keys(n).length === 0 ? localStorage.removeItem(d(e)) : localStorage.setItem(d(e), JSON.stringify({ v: 2, o: n }));
|
|
48
47
|
} catch {
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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}`;
|
|
55
145
|
}
|
|
56
146
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
|
66
163
|
};
|