@nivaro/react 0.3.123 → 0.3.124
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 +10 -0
- package/dist/shared/components/CollectionBrowserView.js +93 -91
- package/dist/shared/components/DataTable.js +240 -228
- package/dist/shared/components/RecordReadView.js +1 -1
- package/dist/shared/components/TipLayer.js +86 -63
- package/dist/shared/components/integrations/IntegrationDots.js +1 -0
- package/dist/shared/components/item-edit/HeaderRollupExplainer.js +156 -119
- package/dist/shared/components/item-edit/InlineGridField.js +1 -1
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +154 -179
- package/dist/shared/components/item-edit/UserChip.js +248 -232
- package/dist/shared/components/panels/PipelinePanel.js +252 -243
- package/dist/shared/components/panels/RevisionsPanel.js +1788 -662
- package/dist/shared/components/panels/revision-changes.js +229 -0
- package/dist/shared/components/panels/revision-table-parts.js +448 -0
- package/dist/shared/lib/activity-sentence.js +74 -68
- package/dist/shared/lib/editorjs.js +68 -0
- package/dist/shared/lib/revision-prefs.js +81 -0
- package/dist/shared/lib/xlsx-lite.js +125 -0
- package/package.json +1 -1
|
@@ -1101,7 +1101,7 @@ function _t({
|
|
|
1101
1101
|
{ kind: "group", key: e.key },
|
|
1102
1102
|
/* @__PURE__ */ p(me, { children: [
|
|
1103
1103
|
/* @__PURE__ */ p(
|
|
1104
|
-
"
|
|
1104
|
+
"h2",
|
|
1105
1105
|
{
|
|
1106
1106
|
"data-read-head": "",
|
|
1107
1107
|
className: `group/rs relative flex items-center justify-between gap-2 px-5 py-2.5 text-[12.5px] font-semibold text-slate-700 dark:text-slate-200 ${ye(e) ? "border-b border-slate-100 dark:border-slate-800" : ""}`,
|
|
@@ -1,81 +1,103 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsx as L } from "react/jsx-runtime";
|
|
2
|
+
import { useState as x, useRef as A, useEffect as y, useLayoutEffect as E } from "react";
|
|
3
|
+
import { createPortal as M } from "react-dom";
|
|
4
|
+
const g = [], O = '[data-nvr-header-menu-panel], [role="menu"], [data-rail-menu]', v = 6;
|
|
5
|
+
function W(t) {
|
|
6
|
+
var d;
|
|
7
|
+
const r = (d = t.getAttribute("data-tip")) == null ? void 0 : d.trim();
|
|
8
|
+
if (!r) return;
|
|
9
|
+
const o = t.getAttribute("data-tip-a11y");
|
|
10
|
+
if (o === "label" || o === "desc") {
|
|
11
|
+
t.setAttribute(o === "label" ? "aria-label" : "aria-description", r);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const l = (t.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
15
|
+
if (l === r.replace(/\s+/g, " ")) return;
|
|
16
|
+
if (!(!!l || t.hasAttribute("aria-label") || t.hasAttribute("aria-labelledby") || !!t.querySelector('img[alt]:not([alt=""])'))) {
|
|
17
|
+
t.setAttribute("aria-label", r), t.setAttribute("data-tip-a11y", "label");
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
!t.hasAttribute("aria-description") && !t.hasAttribute("aria-describedby") && (t.setAttribute("aria-description", r), t.setAttribute("data-tip-a11y", "desc"));
|
|
21
|
+
}
|
|
22
|
+
function T() {
|
|
23
|
+
const [t, r] = x(null), [o, l] = x(!1), b = A(null);
|
|
24
|
+
return y(() => (g.push(l), g[0] === l && l(!0), () => {
|
|
8
25
|
var e;
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
}), []),
|
|
12
|
-
if (!
|
|
13
|
-
const
|
|
14
|
-
var
|
|
15
|
-
const i = (
|
|
16
|
-
if (!i || !
|
|
17
|
-
|
|
26
|
+
const d = g.indexOf(l);
|
|
27
|
+
d < 0 || (g.splice(d, 1), d === 0 && ((e = g[0]) == null || e.call(g, !0)));
|
|
28
|
+
}), []), y(() => {
|
|
29
|
+
if (!o) return;
|
|
30
|
+
const d = (a) => {
|
|
31
|
+
var p;
|
|
32
|
+
const i = (p = a == null ? void 0 : a.closest) == null ? void 0 : p.call(a, "[data-tip]"), h = i == null ? void 0 : i.getAttribute("data-tip");
|
|
33
|
+
if (!i || !h || i.getAttribute("aria-expanded") === "true") {
|
|
34
|
+
r((f) => f && null);
|
|
18
35
|
return;
|
|
19
36
|
}
|
|
20
37
|
const n = i.getBoundingClientRect(), m = i.closest(O);
|
|
21
38
|
if (m && m !== i) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
x:
|
|
39
|
+
const f = m.getBoundingClientRect();
|
|
40
|
+
r({
|
|
41
|
+
x: f.left,
|
|
25
42
|
y: n.top,
|
|
26
|
-
text:
|
|
27
|
-
beside: { left:
|
|
43
|
+
text: h,
|
|
44
|
+
beside: { left: f.left, right: f.right, rowTop: n.top, rowHeight: n.height }
|
|
28
45
|
});
|
|
29
46
|
return;
|
|
30
47
|
}
|
|
31
48
|
if (i.getAttribute("data-tip-side") === "right") {
|
|
32
|
-
|
|
33
|
-
x: n.right +
|
|
49
|
+
r({
|
|
50
|
+
x: n.right + v,
|
|
34
51
|
y: n.top,
|
|
35
|
-
text:
|
|
52
|
+
text: h,
|
|
36
53
|
rightOf: { left: n.left, right: n.right, top: n.top, height: n.height }
|
|
37
54
|
});
|
|
38
55
|
return;
|
|
39
56
|
}
|
|
40
57
|
if (i.getAttribute("data-tip-side") === "top") {
|
|
41
|
-
|
|
58
|
+
r({ x: n.left, y: n.top, text: h, above: { top: n.top, bottom: n.bottom } });
|
|
42
59
|
return;
|
|
43
60
|
}
|
|
44
|
-
|
|
45
|
-
}, e = (
|
|
46
|
-
var
|
|
47
|
-
const i = (
|
|
48
|
-
i &&
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
r({ x: n.left, y: n.bottom + 4, text: h });
|
|
62
|
+
}, e = (a) => d(a.target), c = () => r(null), u = (a) => {
|
|
63
|
+
var n, m, p, f;
|
|
64
|
+
const i = (m = (n = a.target) == null ? void 0 : n.closest) == null ? void 0 : m.call(n, "[data-tip]");
|
|
65
|
+
i && W(i);
|
|
66
|
+
const h = (f = (p = a.target) == null ? void 0 : p.closest) == null ? void 0 : f.call(p, "[data-tip-focus]");
|
|
67
|
+
h && d(h);
|
|
68
|
+
}, s = (a) => {
|
|
69
|
+
a.key === "Escape" && r((i) => i && null);
|
|
70
|
+
}, w = (a) => {
|
|
71
|
+
var i, h;
|
|
72
|
+
(h = (i = a.target) == null ? void 0 : i.closest) != null && h.call(i, "[data-tip-focus]") && r(null);
|
|
52
73
|
};
|
|
53
|
-
return window.addEventListener("mouseover", e), window.addEventListener("focusin",
|
|
54
|
-
window.removeEventListener("mouseover", e), window.removeEventListener("focusin",
|
|
74
|
+
return window.addEventListener("mouseover", e), window.addEventListener("focusin", u), window.addEventListener("focusout", w), window.addEventListener("keydown", s), window.addEventListener("pointerdown", c, !0), window.addEventListener("scroll", c, !0), () => {
|
|
75
|
+
window.removeEventListener("mouseover", e), window.removeEventListener("focusin", u), window.removeEventListener("focusout", w), window.removeEventListener("keydown", s), window.removeEventListener("pointerdown", c, !0), window.removeEventListener("scroll", c, !0);
|
|
55
76
|
};
|
|
56
|
-
}, [
|
|
77
|
+
}, [o]), E(() => {
|
|
57
78
|
if (!t) return;
|
|
58
|
-
const
|
|
59
|
-
if (!
|
|
60
|
-
const e =
|
|
61
|
-
let { x:
|
|
79
|
+
const d = b.current;
|
|
80
|
+
if (!d) return;
|
|
81
|
+
const e = d.getBoundingClientRect();
|
|
82
|
+
let { x: c, y: u } = t;
|
|
62
83
|
if (t.rightOf) {
|
|
63
|
-
const
|
|
64
|
-
|
|
84
|
+
const s = t.rightOf, w = s.right + v;
|
|
85
|
+
c = w + e.width <= window.innerWidth - 8 ? w : Math.max(8, s.left - v - e.width), u = Math.round(s.top + (s.height - e.height) / 2), u = Math.max(8, Math.min(u, window.innerHeight - e.height - 8));
|
|
65
86
|
} else if (t.beside) {
|
|
66
|
-
const
|
|
67
|
-
|
|
87
|
+
const s = t.beside, w = s.left - v - e.width;
|
|
88
|
+
c = w >= 8 ? w : Math.min(s.right + v, Math.max(8, window.innerWidth - e.width - 8)), u = Math.round(s.rowTop + (s.rowHeight - e.height) / 2), u = Math.max(8, Math.min(u, window.innerHeight - e.height - 8));
|
|
68
89
|
} else if (t.above) {
|
|
69
|
-
const
|
|
70
|
-
|
|
90
|
+
const s = t.above.top - v - e.height;
|
|
91
|
+
u = s >= 8 ? s : t.above.bottom + 4, c + e.width > window.innerWidth - 8 && (c = Math.max(8, window.innerWidth - e.width - 8));
|
|
71
92
|
} else
|
|
72
|
-
e.right > window.innerWidth - 8 && (
|
|
73
|
-
(
|
|
74
|
-
}, [t]), !
|
|
75
|
-
/* @__PURE__ */
|
|
93
|
+
e.right > window.innerWidth - 8 && (c = Math.max(8, window.innerWidth - e.width - 8)), e.bottom > window.innerHeight - 8 && (u = Math.max(8, t.y - e.height - 30));
|
|
94
|
+
(c !== t.x || u !== t.y) && r({ ...t, x: c, y: u });
|
|
95
|
+
}, [t]), !o || !t ? null : M(
|
|
96
|
+
/* @__PURE__ */ L(
|
|
76
97
|
"div",
|
|
77
98
|
{
|
|
78
|
-
ref:
|
|
99
|
+
ref: b,
|
|
100
|
+
role: "tooltip",
|
|
79
101
|
style: { position: "fixed", left: t.x, top: t.y, zIndex: 120 },
|
|
80
102
|
className: "pointer-events-none max-w-[340px] whitespace-pre-wrap break-words rounded-md bg-[#0f172a] px-2 py-1 text-[11px] font-medium leading-snug text-white shadow-lg dark:bg-[#334155] dark:ring-1 dark:ring-white/10",
|
|
81
103
|
children: t.text
|
|
@@ -84,20 +106,21 @@ function R() {
|
|
|
84
106
|
document.body
|
|
85
107
|
);
|
|
86
108
|
}
|
|
87
|
-
function
|
|
88
|
-
const
|
|
109
|
+
function C(t) {
|
|
110
|
+
const r = A(null);
|
|
89
111
|
return E(() => {
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
92
|
-
const
|
|
93
|
-
(
|
|
112
|
+
const o = r.current;
|
|
113
|
+
if (!o) return;
|
|
114
|
+
const l = () => {
|
|
115
|
+
(o.scrollWidth > o.clientWidth + 1 || o.scrollHeight > o.clientHeight + 1) && t ? o.setAttribute("data-tip", t) : o.removeAttribute("data-tip");
|
|
94
116
|
};
|
|
95
|
-
if (
|
|
96
|
-
const
|
|
97
|
-
return
|
|
98
|
-
}, [t]),
|
|
117
|
+
if (l(), typeof ResizeObserver > "u") return;
|
|
118
|
+
const b = new ResizeObserver(l);
|
|
119
|
+
return b.observe(o), () => b.disconnect();
|
|
120
|
+
}, [t]), r;
|
|
99
121
|
}
|
|
100
122
|
export {
|
|
101
|
-
|
|
102
|
-
|
|
123
|
+
T as TipLayer,
|
|
124
|
+
W as describeTipTarget,
|
|
125
|
+
C as useOverflowTip
|
|
103
126
|
};
|
|
@@ -19,6 +19,7 @@ function f({ rows: i, className: l }) {
|
|
|
19
19
|
"span",
|
|
20
20
|
{
|
|
21
21
|
"data-integration-dots": !0,
|
|
22
|
+
role: "img",
|
|
22
23
|
"aria-label": t.map((e) => `${e.api}: ${r[e.tone]}`).join(", "),
|
|
23
24
|
className: `inline-flex items-center gap-1 ${l ?? ""}`.trim(),
|
|
24
25
|
children: t.map((e) => {
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { Sigma as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
1
|
+
import { jsxs as s, jsx as n, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as C } from "@tanstack/react-query";
|
|
3
|
+
import { Sigma as O } from "lucide-react";
|
|
4
|
+
import { useState as L } from "react";
|
|
5
|
+
import { useNivaroClient as T } from "../../context.js";
|
|
6
|
+
import { get as D } from "../../lib/commands.js";
|
|
7
|
+
import { compareValueText as $ } from "../../lib/compare-value.js";
|
|
8
|
+
import { useAfterIdle as q } from "../../lib/defer.js";
|
|
9
|
+
import { queryKeys as A } from "../../lib/query-keys.js";
|
|
10
|
+
import { cn as w, titleCase as N } from "../../lib/utils.js";
|
|
11
|
+
import { Popover as W, PopoverTrigger as H, PopoverContent as P } from "../ui/popover.js";
|
|
12
|
+
import { useFieldLineage as j, lineageSummary as E } from "./FieldRow.js";
|
|
13
|
+
const S = [
|
|
12
14
|
{ label: "24h", hours: 24 },
|
|
13
15
|
{ label: "7d", hours: 168 },
|
|
14
16
|
{ label: "30d", hours: 720 }
|
|
15
|
-
],
|
|
17
|
+
], K = {
|
|
16
18
|
created: "added",
|
|
17
19
|
changed: "changed",
|
|
18
20
|
deleted: "removed",
|
|
@@ -20,217 +22,252 @@ const N = [
|
|
|
20
22
|
moved_out: "moved away",
|
|
21
23
|
parent: "set"
|
|
22
24
|
};
|
|
23
|
-
function
|
|
24
|
-
collection:
|
|
25
|
-
itemId:
|
|
26
|
-
field:
|
|
27
|
-
enabled:
|
|
25
|
+
function z({
|
|
26
|
+
collection: d,
|
|
27
|
+
itemId: b,
|
|
28
|
+
field: c,
|
|
29
|
+
enabled: y
|
|
28
30
|
}) {
|
|
29
|
-
var
|
|
30
|
-
const
|
|
31
|
-
queryKey: ["number-trail",
|
|
32
|
-
queryFn: () =>
|
|
33
|
-
|
|
34
|
-
`/lineage/${
|
|
31
|
+
var h;
|
|
32
|
+
const p = T(), [u, k] = L(24), { data: a, isLoading: _ } = C({
|
|
33
|
+
queryKey: ["number-trail", d, b, c, u],
|
|
34
|
+
queryFn: () => p.request(
|
|
35
|
+
D(
|
|
36
|
+
`/lineage/${d}/${encodeURIComponent(b)}/${c}/changes?hours=${u}`
|
|
35
37
|
)
|
|
36
|
-
).then((
|
|
37
|
-
enabled:
|
|
38
|
+
).then((t) => t.data),
|
|
39
|
+
enabled: y,
|
|
38
40
|
staleTime: 3e4
|
|
39
|
-
}),
|
|
40
|
-
const
|
|
41
|
-
return (Date.now() -
|
|
41
|
+
}), x = (t) => t == null ? "—" : t.toLocaleString(void 0, { maximumFractionDigits: 2 }), f = (t) => t == null ? "" : `${t > 0 ? "+" : t < 0 ? "−" : ""}${Math.abs(t).toLocaleString(void 0, { maximumFractionDigits: 2 })}`, o = (t) => {
|
|
42
|
+
const m = new Date(t);
|
|
43
|
+
return (Date.now() - m.getTime()) / 36e5 < 24 ? m.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" }) : m.toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
42
44
|
};
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
45
|
+
return /* @__PURE__ */ s("div", { className: "mt-2 border-t border-slate-100 pt-1.5 dark:border-border", "data-number-trail": !0, children: [
|
|
46
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-2 px-1", children: [
|
|
47
|
+
/* @__PURE__ */ n("p", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "What changed it" }),
|
|
48
|
+
/* @__PURE__ */ n("div", { className: "ml-auto flex gap-0.5", children: S.map((t) => /* @__PURE__ */ n(
|
|
47
49
|
"button",
|
|
48
50
|
{
|
|
49
51
|
type: "button",
|
|
50
|
-
onClick: () =>
|
|
51
|
-
"data-trail-window":
|
|
52
|
-
className:
|
|
52
|
+
onClick: () => k(t.hours),
|
|
53
|
+
"data-trail-window": t.label,
|
|
54
|
+
className: w(
|
|
53
55
|
"rounded px-1.5 py-px text-[10.5px]",
|
|
54
|
-
|
|
56
|
+
u === t.hours ? "bg-nvr-cyan text-white" : "text-slate-500 hover:bg-slate-100 dark:hover:bg-muted"
|
|
55
57
|
),
|
|
56
|
-
children:
|
|
58
|
+
children: t.label
|
|
57
59
|
},
|
|
58
|
-
|
|
60
|
+
t.hours
|
|
59
61
|
)) })
|
|
60
62
|
] }),
|
|
61
|
-
|
|
62
|
-
a && a.events.length === 0 && /* @__PURE__ */
|
|
63
|
+
_ && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-slate-400", children: "Reading the trail…" }),
|
|
64
|
+
a && a.events.length === 0 && /* @__PURE__ */ s("p", { className: "px-1 py-1 text-slate-400", children: [
|
|
63
65
|
"Nothing moved this figure in the last ",
|
|
64
|
-
(
|
|
66
|
+
(h = S.find((t) => t.hours === u)) == null ? void 0 : h.label,
|
|
65
67
|
"."
|
|
66
68
|
] }),
|
|
67
|
-
a && a.events.length > 0 && /* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
+
a && a.events.length > 0 && /* @__PURE__ */ s(F, { children: [
|
|
70
|
+
/* @__PURE__ */ s(
|
|
69
71
|
"p",
|
|
70
72
|
{
|
|
71
73
|
className: "px-1 py-1 text-[11px] text-slate-600 dark:text-slate-300",
|
|
72
74
|
"data-trail-net": a.net,
|
|
73
75
|
children: [
|
|
74
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ n("span", { className: "font-medium tabular-nums", children: f(a.net) }),
|
|
75
77
|
" across",
|
|
76
78
|
" ",
|
|
77
79
|
a.events.length,
|
|
78
80
|
" change",
|
|
79
81
|
a.events.length === 1 ? "" : "s",
|
|
80
|
-
a.value_then_estimate != null && /* @__PURE__ */
|
|
82
|
+
a.value_then_estimate != null && /* @__PURE__ */ s("span", { className: "text-slate-400", children: [
|
|
81
83
|
" ",
|
|
82
84
|
"· was about ",
|
|
83
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ n("span", { className: "tabular-nums", children: x(a.value_then_estimate) })
|
|
84
86
|
] })
|
|
85
87
|
]
|
|
86
88
|
}
|
|
87
89
|
),
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
var
|
|
90
|
-
return /* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ n("div", { className: "max-h-[200px] space-y-px overflow-y-auto", children: a.events.map((t, m) => {
|
|
91
|
+
var g;
|
|
92
|
+
return /* @__PURE__ */ s(
|
|
91
93
|
"div",
|
|
92
94
|
{
|
|
93
95
|
className: "flex items-baseline gap-2 rounded px-1 py-0.5 hover:bg-slate-50 dark:hover:bg-muted",
|
|
94
|
-
title:
|
|
95
|
-
"data-trail-event":
|
|
96
|
+
title: t.comment ?? void 0,
|
|
97
|
+
"data-trail-event": t.action,
|
|
96
98
|
children: [
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ n("span", { className: "w-12 shrink-0 text-[10.5px] tabular-nums text-slate-400", children: o(t.at) }),
|
|
100
|
+
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: [
|
|
101
|
+
/* @__PURE__ */ n("span", { className: "text-slate-400", children: ((g = t.by) == null ? void 0 : g.name) ?? (t.via_import ? "an import" : "system") }),
|
|
100
102
|
" ",
|
|
101
|
-
|
|
103
|
+
K[t.action] ?? t.action,
|
|
102
104
|
" ",
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
|
|
105
|
+
/* @__PURE__ */ n("span", { className: "text-slate-800 dark:text-slate-100", children: t.label }),
|
|
106
|
+
t.action === "changed" && t.from != null && t.to != null && /* @__PURE__ */ s("span", { className: "text-slate-400", children: [
|
|
105
107
|
" ",
|
|
106
|
-
|
|
108
|
+
x(t.from),
|
|
107
109
|
" → ",
|
|
108
|
-
|
|
110
|
+
x(t.to)
|
|
109
111
|
] }),
|
|
110
|
-
|
|
112
|
+
t.via_import && /* @__PURE__ */ n("span", { className: "ml-1 rounded bg-slate-100 px-1 text-[9.5px] uppercase text-slate-500 dark:bg-muted", children: "import" })
|
|
111
113
|
] }),
|
|
112
|
-
/* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ n(
|
|
113
115
|
"span",
|
|
114
116
|
{
|
|
115
|
-
className:
|
|
117
|
+
className: w(
|
|
116
118
|
"shrink-0 font-mono tabular-nums",
|
|
117
|
-
(
|
|
119
|
+
(t.delta ?? 0) > 0 ? "text-[#15803d] dark:text-[#9fbf8a]" : (t.delta ?? 0) < 0 ? "text-[#b91c1c] dark:text-[#e08383]" : "text-slate-400"
|
|
118
120
|
),
|
|
119
|
-
children:
|
|
121
|
+
children: f(t.delta)
|
|
120
122
|
}
|
|
121
123
|
)
|
|
122
124
|
]
|
|
123
125
|
},
|
|
124
|
-
|
|
126
|
+
m
|
|
125
127
|
);
|
|
126
128
|
}) }),
|
|
127
|
-
a.truncated && /* @__PURE__ */
|
|
128
|
-
a.note && /* @__PURE__ */
|
|
129
|
+
a.truncated && /* @__PURE__ */ n("p", { className: "px-1 pt-1 text-[10.5px] text-slate-400", children: "Only the first 300 changes are shown." }),
|
|
130
|
+
a.note && /* @__PURE__ */ n("p", { className: "px-1 pt-1 text-[10.5px] text-slate-400", children: a.note })
|
|
129
131
|
] })
|
|
130
132
|
] });
|
|
131
133
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
const G = {
|
|
135
|
+
sum: "Sum",
|
|
136
|
+
count: "Count",
|
|
137
|
+
avg: "Average",
|
|
138
|
+
min: "Lowest",
|
|
139
|
+
max: "Highest",
|
|
140
|
+
median: "Median",
|
|
141
|
+
distinct_count: "Distinct count",
|
|
142
|
+
weighted_avg: "Weighted average"
|
|
143
|
+
};
|
|
144
|
+
function te({
|
|
145
|
+
collection: d,
|
|
146
|
+
itemId: b,
|
|
147
|
+
field: c,
|
|
148
|
+
noun: y = "lines"
|
|
137
149
|
}) {
|
|
138
|
-
const [
|
|
139
|
-
|
|
140
|
-
|
|
150
|
+
const [p, u] = L(!1), k = q(1500), { data: a, isLoading: _ } = j(d, b, c, k), x = E(a, y), f = T(), { data: o } = C({
|
|
151
|
+
queryKey: A.fieldConfig(d),
|
|
152
|
+
queryFn: () => f.request(D(`/field-config/${d}`)).then((e) => e.data ?? []),
|
|
153
|
+
enabled: p && !!d,
|
|
154
|
+
staleTime: 12e4
|
|
155
|
+
}), h = (e) => {
|
|
156
|
+
var i, r;
|
|
157
|
+
return ((r = (i = o == null ? void 0 : o.find((l) => l.field === e)) == null ? void 0 : i.label) == null ? void 0 : r.trim()) || N(e.replace(/_/g, " "));
|
|
158
|
+
}, t = (e) => {
|
|
159
|
+
const i = /* @__PURE__ */ new Set([
|
|
160
|
+
...(o ?? []).map((r) => r.field),
|
|
161
|
+
...Object.keys((a == null ? void 0 : a.inputs) ?? {})
|
|
162
|
+
]);
|
|
163
|
+
return e.replace(/\{\{\s*([A-Za-z_]\w*)\s*\}\}/g, (r, l) => h(l)).replace(/\b(?:item\.)?([A-Za-z_]\w*)\b/g, (r, l) => i.has(l) ? h(l) : r);
|
|
164
|
+
}, m = (e) => e == null ? "—" : Number(e).toLocaleString(void 0, { maximumFractionDigits: 2 }), g = (e, i) => {
|
|
165
|
+
if (e == null || e === "") return "—";
|
|
166
|
+
const r = i ? o == null ? void 0 : o.find((l) => l.field === i) : void 0;
|
|
167
|
+
return r ? $(e, r) : m(e);
|
|
168
|
+
}, v = (e) => g(e, c);
|
|
169
|
+
return !x && !_ ? null : /* @__PURE__ */ s(W, { open: p, onOpenChange: u, children: [
|
|
170
|
+
/* @__PURE__ */ n(H, { asChild: !0, children: /* @__PURE__ */ s(
|
|
141
171
|
"button",
|
|
142
172
|
{
|
|
143
173
|
type: "button",
|
|
144
174
|
"data-copy-skip": !0,
|
|
145
|
-
onClick: (
|
|
146
|
-
className:
|
|
175
|
+
onClick: (e) => e.stopPropagation(),
|
|
176
|
+
className: w(
|
|
147
177
|
// The Σ alone carries the affordance in every format (Rob,
|
|
148
178
|
// 2026-09-25: the inline formula ate the band's width); the
|
|
149
179
|
// formula is the hover tip, the breakdown is the click.
|
|
150
180
|
"inline-flex shrink-0 items-center self-center text-[11px] font-medium leading-none text-slate-400 hover:text-nvr-cyan dark:text-slate-500",
|
|
151
|
-
|
|
181
|
+
p && "text-nvr-cyan"
|
|
152
182
|
),
|
|
153
183
|
"data-tip": "Where this number comes from",
|
|
154
184
|
children: [
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ n(O, { className: "h-2.5 w-2.5 shrink-0", "aria-hidden": "true" }),
|
|
186
|
+
/* @__PURE__ */ n("span", { className: "sr-only", children: x ?? "Where this number comes from" })
|
|
157
187
|
]
|
|
158
188
|
}
|
|
159
189
|
) }),
|
|
160
|
-
/* @__PURE__ */
|
|
161
|
-
|
|
190
|
+
/* @__PURE__ */ s(
|
|
191
|
+
P,
|
|
162
192
|
{
|
|
163
193
|
align: "start",
|
|
164
194
|
className: "w-[380px] p-2 text-[11.5px]",
|
|
165
|
-
onClick: (
|
|
195
|
+
onClick: (e) => e.stopPropagation(),
|
|
166
196
|
children: [
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
-
a && (a.kind === "read" || a.kind === "write") && /* @__PURE__ */
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
197
|
+
/* @__PURE__ */ n("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Where this number comes from" }),
|
|
198
|
+
a && (a.kind === "read" || a.kind === "write") && /* @__PURE__ */ s("div", { className: "mb-1.5 px-1", "data-lineage-formula": !0, children: [
|
|
199
|
+
/* @__PURE__ */ n(
|
|
200
|
+
"p",
|
|
201
|
+
{
|
|
202
|
+
className: "text-[11.5px] font-medium text-slate-700 dark:text-foreground",
|
|
203
|
+
"data-tip": a.formula,
|
|
204
|
+
children: t(String(a.formula ?? ""))
|
|
205
|
+
}
|
|
206
|
+
),
|
|
207
|
+
/* @__PURE__ */ n("p", { className: "mt-0.5 text-[10.5px] text-slate-400", children: a.kind === "read" ? "Computed on read from" : "Stored on save from" }),
|
|
208
|
+
/* @__PURE__ */ n("dl", { className: "mt-1 grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5", children: Object.entries(a.inputs ?? {}).map(([e, i]) => /* @__PURE__ */ s("div", { className: "contents", children: [
|
|
209
|
+
/* @__PURE__ */ n("dt", { className: "text-[11px] text-slate-500", "data-tip": e, children: h(e) }),
|
|
210
|
+
/* @__PURE__ */ n("dd", { className: "text-right tabular-nums text-slate-800 dark:text-foreground", children: g(i, e) })
|
|
211
|
+
] }, e)) })
|
|
175
212
|
] }),
|
|
176
|
-
((a == null ? void 0 : a.sources) ?? []).map((
|
|
177
|
-
var
|
|
178
|
-
return /* @__PURE__ */
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
-
(
|
|
181
|
-
|
|
213
|
+
((a == null ? void 0 : a.sources) ?? []).map((e, i) => {
|
|
214
|
+
var r;
|
|
215
|
+
return /* @__PURE__ */ s("div", { className: "mb-1.5", children: [
|
|
216
|
+
/* @__PURE__ */ s("p", { className: "px-1 text-[10.5px] text-slate-400", children: [
|
|
217
|
+
G[e.aggregate ?? "sum"] ?? N(e.aggregate ?? "sum"),
|
|
218
|
+
e.value_field ? ` of ${N(e.value_field.replace(/_/g, " "))}` : "",
|
|
182
219
|
" across",
|
|
183
220
|
" ",
|
|
184
|
-
|
|
221
|
+
N(e.collection.replace(/_/g, " "))
|
|
185
222
|
] }),
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
/* @__PURE__ */
|
|
223
|
+
e.note && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-slate-400", children: e.note }),
|
|
224
|
+
e.error && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-amber-600", children: e.error }),
|
|
225
|
+
/* @__PURE__ */ n("div", { className: "mt-0.5 max-h-[220px] space-y-px overflow-y-auto", children: e.rows.map((l) => /* @__PURE__ */ s(
|
|
189
226
|
"div",
|
|
190
227
|
{
|
|
191
228
|
className: "flex items-baseline gap-2 rounded px-1 py-0.5 hover:bg-slate-50 dark:hover:bg-muted",
|
|
192
229
|
children: [
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: l.label }),
|
|
231
|
+
/* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums text-slate-800 dark:text-slate-100", children: e.aggregate === "count" ? m(l.value) : v(l.value) })
|
|
195
232
|
]
|
|
196
233
|
},
|
|
197
|
-
|
|
234
|
+
l.id
|
|
198
235
|
)) }),
|
|
199
|
-
|
|
236
|
+
e.subtotal != null && /* @__PURE__ */ s("p", { className: "border-t border-slate-100 px-1 pt-1 text-right font-medium text-slate-700 dark:border-border dark:text-slate-200", children: [
|
|
200
237
|
"subtotal ",
|
|
201
|
-
|
|
238
|
+
v(e.subtotal)
|
|
202
239
|
] }),
|
|
203
|
-
(((
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
-
|
|
240
|
+
(((r = e.excluded) == null ? void 0 : r.length) ?? 0) > 0 && /* @__PURE__ */ s("div", { className: "mt-1 rounded bg-slate-50 px-1 py-1 dark:bg-muted/40", children: [
|
|
241
|
+
/* @__PURE__ */ s("p", { className: "text-[10.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
242
|
+
e.excluded.length,
|
|
206
243
|
" excluded —",
|
|
207
244
|
" ",
|
|
208
|
-
|
|
245
|
+
e.excluded[0].reason.replace(/^does not match: /, "")
|
|
209
246
|
] }),
|
|
210
|
-
|
|
247
|
+
e.excluded.slice(0, 8).map((l) => /* @__PURE__ */ s(
|
|
211
248
|
"div",
|
|
212
249
|
{
|
|
213
250
|
className: "flex items-baseline gap-2 px-0.5 text-[11px] text-slate-400",
|
|
214
251
|
children: [
|
|
215
|
-
/* @__PURE__ */
|
|
216
|
-
/* @__PURE__ */
|
|
252
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate line-through decoration-slate-300", children: l.label }),
|
|
253
|
+
/* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums", children: v(l.value) })
|
|
217
254
|
]
|
|
218
255
|
},
|
|
219
|
-
|
|
256
|
+
l.id
|
|
220
257
|
))
|
|
221
258
|
] })
|
|
222
|
-
] },
|
|
259
|
+
] }, i);
|
|
223
260
|
}),
|
|
224
|
-
(a == null ? void 0 : a.stored_value) != null && /* @__PURE__ */
|
|
261
|
+
(a == null ? void 0 : a.stored_value) != null && /* @__PURE__ */ s("p", { className: "px-1 pt-1 text-right text-[11px] text-slate-500", children: [
|
|
225
262
|
"stored ",
|
|
226
|
-
|
|
263
|
+
v(a.stored_value)
|
|
227
264
|
] }),
|
|
228
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ n(z, { collection: d, itemId: b, field: c, enabled: p })
|
|
229
266
|
]
|
|
230
267
|
}
|
|
231
268
|
)
|
|
232
269
|
] });
|
|
233
270
|
}
|
|
234
271
|
export {
|
|
235
|
-
|
|
272
|
+
te as HeaderRollupExplainer
|
|
236
273
|
};
|
|
@@ -223,7 +223,7 @@ const we = /* @__PURE__ */ new Set([
|
|
|
223
223
|
},
|
|
224
224
|
e.field
|
|
225
225
|
)),
|
|
226
|
-
/* @__PURE__ */ t("th", { className: "w-16" })
|
|
226
|
+
/* @__PURE__ */ t("th", { className: "w-16", children: /* @__PURE__ */ t("span", { className: "sr-only", children: "Actions" }) })
|
|
227
227
|
] }) }),
|
|
228
228
|
/* @__PURE__ */ a("tbody", { children: [
|
|
229
229
|
d && G.map((e, r) => /* @__PURE__ */ a("tr", { className: "border-b border-slate-100 bg-amber-50/40", children: [
|