@nivaro/react 0.3.52 → 0.3.54
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 +47 -3
- package/dist/shared/components/ItemEditForm.js +4196 -4163
- package/dist/shared/components/NotificationBell.js +163 -150
- package/dist/shared/components/PageRenderer.js +645 -593
- package/dist/shared/components/ProfileView.js +36 -34
- package/dist/shared/components/QueryStatStrip.js +96 -89
- package/dist/shared/components/QueryTable.js +214 -215
- package/dist/shared/components/ReportView.js +548 -529
- package/dist/shared/components/alerts/AlertManagerView.js +346 -320
- package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +52 -54
- package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
- package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
- package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
- package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +12 -11
- package/dist/shared/components/item-edit/PlanGrid.js +718 -705
- package/dist/shared/components/item-edit/RelationCombobox.js +23 -20
- package/dist/shared/components/item-edit/SummaryPanel.js +415 -361
- package/dist/shared/components/item-edit/line-qty.js +115 -53
- package/dist/shared/components/item-edit/save-outcome.js +48 -0
- package/dist/shared/components/item-edit/save-refusal.js +18 -18
- package/dist/shared/components/item-edit/stale-banner.js +13 -0
- package/dist/shared/components/item-edit/usePersonalDefaults.js +225 -220
- package/dist/shared/components/panels/CommentPanel.js +204 -197
- package/dist/shared/components/panels/ItemLockBanner.js +318 -291
- package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
- package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
- package/dist/shared/components/panels/RevisionsPanel.js +101 -106
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
- package/dist/shared/components/panels/requirement-side-effects.js +46 -29
- package/dist/shared/components/queue/QueueItemSheet.js +219 -146
- package/dist/shared/components/queue/QueueWorklist.js +738 -730
- package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
- package/dist/shared/lib/activity-sentence.js +236 -227
- package/dist/shared/lib/draft-store.js +35 -29
- package/dist/shared/lib/page-widget-access.js +11 -0
- package/dist/shared/lib/record-ref.js +43 -34
- package/package.json +1 -1
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { useState as q, useEffect as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { useDebounced as
|
|
7
|
-
import { get as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { jsx as t, jsxs as x, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as z, useQueryClient as He } from "@tanstack/react-query";
|
|
3
|
+
import { useState as q, useEffect as X, useRef as D, useMemo as Re, useCallback as Ye } from "react";
|
|
4
|
+
import { createPortal as Xe } from "react-dom";
|
|
5
|
+
import { useNivaroClient as K, useItemEditAuth as Ze, useDrilldown as Ae, useOverlayState as et, DrilldownContext as tt, useItemNavigation as rt } from "../context.js";
|
|
6
|
+
import { useDebounced as nt } from "../hooks/useDebounced.js";
|
|
7
|
+
import { get as Fe, post as Z } from "../lib/commands.js";
|
|
8
|
+
import { describeError as at } from "../lib/error-message.js";
|
|
9
|
+
import { visiblePageWidgets as lt } from "../lib/page-widget-access.js";
|
|
10
|
+
import { explicitAllUrlParams as st, initialFilterSelection as it, filterSelectionToSearch as ot } from "../lib/query-filter-seed.js";
|
|
11
|
+
import { userErrorMessage as Ee } from "../lib/safe-error.js";
|
|
12
|
+
import { safeLinkKind as dt } from "../lib/safe-href.js";
|
|
13
|
+
import { resolveSheetDef as ct } from "../lib/sheet-def.js";
|
|
14
|
+
import { uniqueByValue as ut } from "../lib/unique-options.js";
|
|
15
|
+
import { useMyScopes as mt, matchScopeDimension as Te, effectiveScopeSeedIds as pt, translateScopeValues as ht } from "../lib/use-my-scopes.js";
|
|
16
|
+
import { titleCase as F, formatRelative as xt, formatNumber as ft } from "../lib/utils.js";
|
|
17
|
+
import { CacheStamp as bt } from "./CacheStamp.js";
|
|
18
|
+
import { RelationCombobox as gt } from "./item-edit/RelationCombobox.js";
|
|
19
|
+
import { MatrixEditor as ce } from "./MatrixEditor.js";
|
|
20
|
+
import { QueryStatStrip as yt } from "./QueryStatStrip.js";
|
|
21
|
+
import { QueryTable as vt } from "./QueryTable.js";
|
|
22
|
+
import { RecordDrilldownSheet as kt } from "./RecordDrilldownSheet.js";
|
|
23
|
+
import { RecordGridEditor as We } from "./RecordGridEditor.js";
|
|
24
|
+
import { SheetHeaderBody as wt } from "./SheetHeaderBody.js";
|
|
25
|
+
const oe = 76;
|
|
26
|
+
function ee() {
|
|
25
27
|
return /* @__PURE__ */ t("div", { className: "space-y-1.5 p-3", children: [1, 2, 3].map((e) => /* @__PURE__ */ t(
|
|
26
28
|
"div",
|
|
27
29
|
{
|
|
@@ -30,153 +32,153 @@ function X() {
|
|
|
30
32
|
e
|
|
31
33
|
)) });
|
|
32
34
|
}
|
|
33
|
-
function
|
|
34
|
-
const
|
|
35
|
-
return /* @__PURE__ */ t("div", { className: "flex h-full items-center justify-center p-3 text-[12px] text-amber-600 dark:text-amber-500", children:
|
|
35
|
+
function te({ error: e, unresolved: r }) {
|
|
36
|
+
const n = Mt(e, r) ?? Ee(e, "Failed to load widget data");
|
|
37
|
+
return /* @__PURE__ */ t("div", { className: "flex h-full items-center justify-center p-3 text-[12px] text-amber-600 dark:text-amber-500", children: n });
|
|
36
38
|
}
|
|
37
|
-
function
|
|
39
|
+
function Nt(e) {
|
|
38
40
|
if (e == null) return "—";
|
|
39
41
|
if (typeof e == "boolean") return e ? "true" : "false";
|
|
40
42
|
const r = String(e);
|
|
41
43
|
return r.length > 80 ? `${r.slice(0, 80)}…` : r;
|
|
42
44
|
}
|
|
43
|
-
function
|
|
44
|
-
const n = [],
|
|
45
|
-
return e.split(
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
48
|
-
if (
|
|
49
|
-
n.push(/* @__PURE__ */ t("strong", { children:
|
|
50
|
-
else if (
|
|
51
|
-
n.push(/* @__PURE__ */ t("em", { children:
|
|
52
|
-
else if (
|
|
45
|
+
function de(e, r) {
|
|
46
|
+
const n = [], a = /(\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|\[[^\]]+\]\([^)]+\))/g;
|
|
47
|
+
return e.split(a).forEach((l, u) => {
|
|
48
|
+
const c = `${r}-${u}`;
|
|
49
|
+
if (l)
|
|
50
|
+
if (l.startsWith("**") && l.endsWith("**"))
|
|
51
|
+
n.push(/* @__PURE__ */ t("strong", { children: l.slice(2, -2) }, c));
|
|
52
|
+
else if (l.startsWith("*") && l.endsWith("*") && l.length > 2)
|
|
53
|
+
n.push(/* @__PURE__ */ t("em", { children: l.slice(1, -1) }, c));
|
|
54
|
+
else if (l.startsWith("`") && l.endsWith("`"))
|
|
53
55
|
n.push(
|
|
54
56
|
/* @__PURE__ */ t(
|
|
55
57
|
"code",
|
|
56
58
|
{
|
|
57
59
|
className: "rounded bg-slate-100 px-1 py-0.5 font-mono text-[0.9em] dark:bg-muted",
|
|
58
|
-
children:
|
|
60
|
+
children: l.slice(1, -1)
|
|
59
61
|
},
|
|
60
|
-
|
|
62
|
+
c
|
|
61
63
|
)
|
|
62
64
|
);
|
|
63
65
|
else {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
/* @__PURE__ */ t("a", { href:
|
|
67
|
-
) : n.push(
|
|
66
|
+
const i = l.match(/^\[([^\]]+)\]\(([^)]+)\)$/);
|
|
67
|
+
i && dt(i[2]) !== null ? n.push(
|
|
68
|
+
/* @__PURE__ */ t("a", { href: i[2], className: "text-nvr-cyan underline-offset-2 hover:underline", children: i[1] }, c)
|
|
69
|
+
) : n.push(l);
|
|
68
70
|
}
|
|
69
71
|
}), n;
|
|
70
72
|
}
|
|
71
|
-
function
|
|
73
|
+
function St({ content: e }) {
|
|
72
74
|
const r = [];
|
|
73
|
-
let n = [],
|
|
74
|
-
const
|
|
75
|
+
let n = [], a = [], l = !1;
|
|
76
|
+
const u = (i) => {
|
|
75
77
|
n.length && (r.push(
|
|
76
|
-
/* @__PURE__ */ t("p", { className: "leading-relaxed", children:
|
|
78
|
+
/* @__PURE__ */ t("p", { className: "leading-relaxed", children: de(n.join(" "), i) }, i)
|
|
77
79
|
), n = []);
|
|
78
|
-
},
|
|
79
|
-
if (!
|
|
80
|
-
const
|
|
80
|
+
}, c = (i) => {
|
|
81
|
+
if (!a.length) return;
|
|
82
|
+
const s = a.map((m, h) => /* @__PURE__ */ t("li", { children: de(m, `${i}-${h}`) }, `${i}-${h}`));
|
|
81
83
|
r.push(
|
|
82
|
-
|
|
83
|
-
),
|
|
84
|
+
l ? /* @__PURE__ */ t("ol", { className: "list-decimal space-y-0.5 pl-5", children: s }, i) : /* @__PURE__ */ t("ul", { className: "list-disc space-y-0.5 pl-5", children: s }, i)
|
|
85
|
+
), a = [];
|
|
84
86
|
};
|
|
85
87
|
return e.split(`
|
|
86
|
-
`).forEach((
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
const
|
|
88
|
+
`).forEach((i, s) => {
|
|
89
|
+
const m = `md-${s}`, h = i.match(/^(#{1,3})\s+(.*)$/), v = i.match(/^[-*]\s+(.*)$/), $ = i.match(/^\d+\.\s+(.*)$/);
|
|
90
|
+
if (h) {
|
|
91
|
+
c(`${m}-fl`), u(`${m}-fp`);
|
|
92
|
+
const N = h[1].length, j = N === 1 ? "text-[17px] font-semibold" : N === 2 ? "text-[15px] font-semibold" : "text-[13.5px] font-semibold";
|
|
91
93
|
r.push(
|
|
92
|
-
/* @__PURE__ */ t("div", { className: `${
|
|
94
|
+
/* @__PURE__ */ t("div", { className: `${j} text-slate-900 dark:text-slate-100`, children: de(h[2], `${m}-h`) }, m)
|
|
93
95
|
);
|
|
94
|
-
} else if (
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
} else
|
|
99
|
-
}),
|
|
96
|
+
} else if (v || $) {
|
|
97
|
+
u(`${m}-fp`);
|
|
98
|
+
const N = !!$;
|
|
99
|
+
a.length && l !== N && c(`${m}-fl`), l = N, a.push((v == null ? void 0 : v[1]) ?? ($ == null ? void 0 : $[1]));
|
|
100
|
+
} else i.trim() === "" ? (c(`${m}-fl`), u(`${m}-fp`)) : (c(`${m}-fl`), n.push(i.trim()));
|
|
101
|
+
}), c("md-end-l"), u("md-end-p"), /* @__PURE__ */ t("div", { className: "space-y-2 p-4 text-[13px] text-slate-700 dark:text-slate-300", children: r });
|
|
100
102
|
}
|
|
101
|
-
function
|
|
102
|
-
const
|
|
103
|
-
return
|
|
103
|
+
function ue(e, r, n) {
|
|
104
|
+
const a = K();
|
|
105
|
+
return z({
|
|
104
106
|
queryKey: ["page-renderer-widget-data", e, r.id],
|
|
105
|
-
queryFn: () =>
|
|
107
|
+
queryFn: () => a.request(Z(`/pages/${e}/widget-data`, { widget_id: r.id })).then((l) => l.data),
|
|
106
108
|
enabled: n,
|
|
107
109
|
retry: !1,
|
|
108
110
|
staleTime: 3e4
|
|
109
111
|
});
|
|
110
112
|
}
|
|
111
|
-
function
|
|
112
|
-
var
|
|
113
|
-
const n = r.config ?? {}, { data:
|
|
113
|
+
function $t({ slug: e, widget: r }) {
|
|
114
|
+
var m;
|
|
115
|
+
const n = r.config ?? {}, { data: a, isLoading: l, error: u } = ue(e, r, !!n.collection), c = rt();
|
|
114
116
|
if (!n.collection)
|
|
115
117
|
return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Select a collection" });
|
|
116
|
-
if (
|
|
117
|
-
if (
|
|
118
|
-
const
|
|
119
|
-
if (!
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
return
|
|
118
|
+
if (l) return /* @__PURE__ */ t(ee, {});
|
|
119
|
+
if (u) return /* @__PURE__ */ t(te, { error: u });
|
|
120
|
+
const i = (a == null ? void 0 : a.rows) ?? [];
|
|
121
|
+
if (!i.length) return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "No records" });
|
|
122
|
+
const s = (m = n.columns) != null && m.length ? n.columns : Object.keys(i[0]).filter((h) => {
|
|
123
|
+
const v = i[0][h];
|
|
124
|
+
return v === null || ["string", "number", "boolean"].includes(typeof v);
|
|
123
125
|
}).slice(0, 5);
|
|
124
|
-
return /* @__PURE__ */ t("div", { className: "h-full overflow-auto", children: /* @__PURE__ */
|
|
125
|
-
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100 dark:border-border", children:
|
|
126
|
+
return /* @__PURE__ */ t("div", { className: "h-full overflow-auto", children: /* @__PURE__ */ x("table", { className: "w-full text-[12px]", children: [
|
|
127
|
+
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100 dark:border-border", children: s.map((h) => /* @__PURE__ */ t(
|
|
126
128
|
"th",
|
|
127
129
|
{
|
|
128
130
|
className: "whitespace-nowrap px-3 py-1.5 text-left font-medium text-slate-400",
|
|
129
|
-
children:
|
|
131
|
+
children: F(h)
|
|
130
132
|
},
|
|
131
|
-
|
|
133
|
+
h
|
|
132
134
|
)) }) }),
|
|
133
|
-
/* @__PURE__ */ t("tbody", { children:
|
|
135
|
+
/* @__PURE__ */ t("tbody", { children: i.map((h, v) => /* @__PURE__ */ t(
|
|
134
136
|
"tr",
|
|
135
137
|
{
|
|
136
|
-
onClick:
|
|
137
|
-
className: `border-b border-slate-50 last:border-0 dark:border-border/50 ${
|
|
138
|
-
children:
|
|
138
|
+
onClick: h.id != null ? () => c.open({ collection: n.collection, itemId: String(h.id) }) : void 0,
|
|
139
|
+
className: `border-b border-slate-50 last:border-0 dark:border-border/50 ${h.id != null ? "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/40" : ""}`,
|
|
140
|
+
children: s.map(($) => /* @__PURE__ */ t(
|
|
139
141
|
"td",
|
|
140
142
|
{
|
|
141
143
|
className: "whitespace-nowrap px-3 py-1.5 text-slate-700 dark:text-slate-300",
|
|
142
|
-
children:
|
|
144
|
+
children: Nt(h[$])
|
|
143
145
|
},
|
|
144
146
|
$
|
|
145
147
|
))
|
|
146
148
|
},
|
|
147
|
-
|
|
149
|
+
h.id != null ? `${h.id}-${v}` : v
|
|
148
150
|
)) })
|
|
149
151
|
] }) });
|
|
150
152
|
}
|
|
151
|
-
function
|
|
152
|
-
const n = r.config ?? {}, { data:
|
|
153
|
-
return n.collection ?
|
|
154
|
-
|
|
153
|
+
function _t({ slug: e, widget: r }) {
|
|
154
|
+
const n = r.config ?? {}, { data: a, isLoading: l, error: u } = ue(e, r, !!n.collection);
|
|
155
|
+
return n.collection ? u ? /* @__PURE__ */ t(te, { error: u }) : /* @__PURE__ */ x("div", { className: "flex h-full flex-col items-start justify-center px-4", children: [
|
|
156
|
+
l ? /* @__PURE__ */ t("div", { className: "h-9 w-24 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ t("span", { className: "text-[32px] font-semibold leading-none tracking-tight text-slate-900 dark:text-slate-100", children: (a == null ? void 0 : a.value) != null ? ft(Number(a.value)) : "—" }),
|
|
155
157
|
/* @__PURE__ */ t("span", { className: "mt-1.5 text-[12px] text-slate-400", children: n.label || `${n.aggregate ?? "count"} of ${n.collection}` })
|
|
156
158
|
] }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Select a collection" });
|
|
157
159
|
}
|
|
158
|
-
function
|
|
159
|
-
const { data: n, isLoading:
|
|
160
|
-
if (
|
|
161
|
-
if (
|
|
162
|
-
const
|
|
163
|
-
return
|
|
160
|
+
function Ct({ slug: e, widget: r }) {
|
|
161
|
+
const { data: n, isLoading: a, error: l } = ue(e, r, !0);
|
|
162
|
+
if (a) return /* @__PURE__ */ t(ee, {});
|
|
163
|
+
if (l) return /* @__PURE__ */ t(te, { error: l });
|
|
164
|
+
const u = (n == null ? void 0 : n.rows) ?? [];
|
|
165
|
+
return u.length ? /* @__PURE__ */ t("div", { className: "h-full overflow-auto px-3 py-1.5", children: u.map((c) => /* @__PURE__ */ x(
|
|
164
166
|
"div",
|
|
165
167
|
{
|
|
166
168
|
className: "flex items-center gap-2 border-b border-slate-50 py-1.5 text-[12px] last:border-0 dark:border-border/50",
|
|
167
169
|
children: [
|
|
168
|
-
/* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-300", children:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
/* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-300", children: c.action }),
|
|
171
|
+
c.collection && /* @__PURE__ */ x("span", { className: "truncate font-mono text-[11px] text-slate-400", children: [
|
|
172
|
+
c.collection,
|
|
173
|
+
c.item ? ` · ${c.item}` : ""
|
|
172
174
|
] }),
|
|
173
|
-
/* @__PURE__ */ t("span", { className: "ml-auto shrink-0 text-[11px] text-slate-400", children:
|
|
175
|
+
/* @__PURE__ */ t("span", { className: "ml-auto shrink-0 text-[11px] text-slate-400", children: xt(c.timestamp) })
|
|
174
176
|
]
|
|
175
177
|
},
|
|
176
|
-
|
|
178
|
+
c.id
|
|
177
179
|
)) }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "No activity" });
|
|
178
180
|
}
|
|
179
|
-
function
|
|
181
|
+
function qt({ widget: e }) {
|
|
180
182
|
var n;
|
|
181
183
|
const r = String(((n = e.config) == null ? void 0 : n.url) ?? "");
|
|
182
184
|
return r ? /^https?:\/\//i.test(r) ? /* @__PURE__ */ t(
|
|
@@ -189,98 +191,118 @@ function yt({ widget: e }) {
|
|
|
189
191
|
}
|
|
190
192
|
) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-amber-600", children: "URL must start with http(s)://" }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Set an iframe URL" });
|
|
191
193
|
}
|
|
192
|
-
function
|
|
194
|
+
function Le({
|
|
193
195
|
config: e,
|
|
194
196
|
initialScope: r,
|
|
195
197
|
width: n,
|
|
196
|
-
title:
|
|
197
|
-
onClose:
|
|
198
|
+
title: a,
|
|
199
|
+
onClose: l
|
|
198
200
|
}) {
|
|
199
|
-
const
|
|
200
|
-
return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick:
|
|
201
|
+
const u = typeof n == "number" ? `${n}px` : n ?? "85%";
|
|
202
|
+
return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick: l, children: /* @__PURE__ */ x(
|
|
201
203
|
"div",
|
|
202
204
|
{
|
|
203
205
|
className: "flex h-full flex-col border-l border-slate-200 bg-white shadow-2xl dark:border-border dark:bg-background",
|
|
204
|
-
style: { width:
|
|
205
|
-
onClick: (
|
|
206
|
+
style: { width: u, maxWidth: "96%" },
|
|
207
|
+
onClick: (c) => c.stopPropagation(),
|
|
206
208
|
children: [
|
|
207
|
-
/* @__PURE__ */
|
|
208
|
-
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children:
|
|
209
|
+
/* @__PURE__ */ x("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
|
|
210
|
+
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: a ?? e.title ?? "Manage" }),
|
|
209
211
|
/* @__PURE__ */ t(
|
|
210
212
|
"button",
|
|
211
213
|
{
|
|
212
214
|
type: "button",
|
|
213
|
-
onClick:
|
|
215
|
+
onClick: l,
|
|
214
216
|
className: "rounded px-2 py-1 text-[12px] text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
|
|
215
217
|
children: "Close"
|
|
216
218
|
}
|
|
217
219
|
)
|
|
218
220
|
] }),
|
|
219
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(
|
|
221
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(ce, { config: e, initialScope: r }) })
|
|
220
222
|
]
|
|
221
223
|
}
|
|
222
224
|
) });
|
|
223
225
|
}
|
|
224
|
-
function
|
|
225
|
-
const r = e.config ?? {}, [n,
|
|
226
|
-
return !r.target_collection || !r.option_collection || !r.key_field || !r.value_field ? /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Matrix editor not configured" }) : r.display === "drawer" ? /* @__PURE__ */
|
|
226
|
+
function jt({ widget: e }) {
|
|
227
|
+
const r = e.config ?? {}, [n, a] = q(!1);
|
|
228
|
+
return !r.target_collection || !r.option_collection || !r.key_field || !r.value_field ? /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Matrix editor not configured" }) : r.display === "drawer" ? /* @__PURE__ */ x("div", { className: "flex h-full items-center", children: [
|
|
227
229
|
/* @__PURE__ */ t(
|
|
228
230
|
"button",
|
|
229
231
|
{
|
|
230
232
|
type: "button",
|
|
231
|
-
onClick: () =>
|
|
233
|
+
onClick: () => a(!0),
|
|
232
234
|
className: "inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-md border border-slate-200 bg-white px-3 text-[12.5px] font-medium text-slate-700 shadow-sm transition-colors hover:border-nvr-cyan hover:text-nvr-navy dark:border-border dark:bg-card dark:text-slate-200 dark:hover:text-nvr-cyan",
|
|
233
235
|
children: r.button_label ?? r.title ?? "Manage"
|
|
234
236
|
}
|
|
235
237
|
),
|
|
236
238
|
n && /* @__PURE__ */ t(
|
|
237
|
-
|
|
239
|
+
Le,
|
|
238
240
|
{
|
|
239
241
|
config: r,
|
|
240
242
|
width: r.sheet_width,
|
|
241
|
-
onClose: () =>
|
|
243
|
+
onClose: () => a(!1)
|
|
242
244
|
}
|
|
243
245
|
)
|
|
244
|
-
] }) : /* @__PURE__ */ t(
|
|
246
|
+
] }) : /* @__PURE__ */ t(ce, { config: r });
|
|
245
247
|
}
|
|
246
|
-
function
|
|
247
|
-
return
|
|
248
|
+
function Rt(e) {
|
|
249
|
+
return it(
|
|
248
250
|
e,
|
|
249
251
|
typeof window > "u" ? "" : window.location.search
|
|
250
252
|
);
|
|
251
253
|
}
|
|
252
|
-
function
|
|
254
|
+
function Me(e, r) {
|
|
255
|
+
const n = [...new Set(e.map((a) => a[r]).filter((a) => a != null && a !== ""))];
|
|
256
|
+
return n.length ? n.map(String).join(",") : void 0;
|
|
257
|
+
}
|
|
258
|
+
function Be(e, r, n, a, l, u, c) {
|
|
253
259
|
if (typeof e != "string") return e;
|
|
254
|
-
if (e.startsWith("$row."))
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
return a.length ? a.join(",") : void 0;
|
|
260
|
+
if (e.startsWith("$row.")) {
|
|
261
|
+
const i = e.slice(5);
|
|
262
|
+
return !r && c ? Me(c, i) : r == null ? void 0 : r[i];
|
|
258
263
|
}
|
|
259
|
-
if (e.startsWith("$
|
|
264
|
+
if (e.startsWith("$rows.")) return Me(n, e.slice(6));
|
|
265
|
+
if (e.startsWith("$param.")) return a[e.slice(7)];
|
|
260
266
|
if (e.startsWith("$filters.")) {
|
|
261
|
-
const
|
|
262
|
-
return
|
|
267
|
+
const i = e.slice(9), s = u == null ? void 0 : u.find((h) => h.param === i), m = l[i] ?? [];
|
|
268
|
+
return m.length ? m.map((h) => String(h[(s == null ? void 0 : s.value_field) ?? "id"] ?? "")).join(",") : void 0;
|
|
263
269
|
}
|
|
264
270
|
return e;
|
|
265
271
|
}
|
|
266
|
-
function
|
|
267
|
-
const
|
|
268
|
-
for (const [
|
|
269
|
-
const
|
|
270
|
-
|
|
272
|
+
function Tt(e, r, n, a, l, u, c) {
|
|
273
|
+
const i = {}, s = [];
|
|
274
|
+
for (const [m, h] of Object.entries(e.params ?? {})) {
|
|
275
|
+
const v = Be(h, r, n, a, l, u, c);
|
|
276
|
+
v !== void 0 ? i[m] = v : typeof h == "string" && (h.startsWith("$row.") || h.startsWith("$rows.")) && s.push(m);
|
|
271
277
|
}
|
|
272
|
-
return { ...e, params:
|
|
278
|
+
return { ...e, params: i, ...s.length ? { unresolved_params: s } : {} };
|
|
279
|
+
}
|
|
280
|
+
function Wt(e, r) {
|
|
281
|
+
var l, u;
|
|
282
|
+
let n = (l = e.row_noun) == null ? void 0 : l.trim();
|
|
283
|
+
if (!n) {
|
|
284
|
+
const c = (u = /\{\{\s*([a-z]+)_[\w.]*\s*\}\}/i.exec(e.title ?? "")) == null ? void 0 : u[1];
|
|
285
|
+
n = c ? `${c.toLowerCase()}s` : "rows";
|
|
286
|
+
}
|
|
287
|
+
const a = r === 1 && n.endsWith("s") ? n.slice(0, -1) : n;
|
|
288
|
+
return `Total of ${r.toLocaleString("en-US")} ${a}`;
|
|
289
|
+
}
|
|
290
|
+
function Mt(e, r) {
|
|
291
|
+
const n = at(e), a = [n.title, n.technical ?? ""].join(" "), l = /Missing required parameter:\s*([\w]+)/i.exec(a);
|
|
292
|
+
if (!l) return null;
|
|
293
|
+
const u = F(l[1]).toLowerCase();
|
|
294
|
+
return r != null && r.includes(l[1]) ? `Nothing to show: the row you opened has no ${u}.` : `Choose ${u} to see this view.`;
|
|
273
295
|
}
|
|
274
|
-
function
|
|
296
|
+
function Ot({
|
|
275
297
|
config: e,
|
|
276
298
|
stats: r,
|
|
277
299
|
asOf: n,
|
|
278
|
-
note:
|
|
300
|
+
note: a
|
|
279
301
|
}) {
|
|
280
|
-
const
|
|
281
|
-
queryKey: ["page-renderer-query", e.query_slug, JSON.stringify(
|
|
282
|
-
queryFn: () =>
|
|
283
|
-
|
|
302
|
+
const l = K(), u = e.params ?? {}, { data: c, isPending: i, isError: s } = z({
|
|
303
|
+
queryKey: ["page-renderer-query", e.query_slug, JSON.stringify(u)],
|
|
304
|
+
queryFn: () => l.request(
|
|
305
|
+
Z(`/custom-queries/${e.query_slug}/execute`, { params: u })
|
|
284
306
|
),
|
|
285
307
|
enabled: !!e.query_slug,
|
|
286
308
|
staleTime: 6e4
|
|
@@ -291,62 +313,63 @@ function Nt({
|
|
|
291
313
|
className: "shrink-0 border-b border-slate-200 bg-white px-4 py-3 dark:border-border dark:bg-card",
|
|
292
314
|
"data-sheet-header": !0,
|
|
293
315
|
children: /* @__PURE__ */ t(
|
|
294
|
-
|
|
316
|
+
wt,
|
|
295
317
|
{
|
|
296
318
|
stats: r,
|
|
297
|
-
rows: (
|
|
298
|
-
params:
|
|
299
|
-
loading:
|
|
300
|
-
error:
|
|
319
|
+
rows: (c == null ? void 0 : c.data) ?? [],
|
|
320
|
+
params: u,
|
|
321
|
+
loading: i && !s,
|
|
322
|
+
error: s,
|
|
301
323
|
asOf: n,
|
|
302
|
-
note:
|
|
324
|
+
note: a
|
|
303
325
|
}
|
|
304
326
|
)
|
|
305
327
|
}
|
|
306
328
|
);
|
|
307
329
|
}
|
|
308
|
-
function
|
|
330
|
+
function Pt({
|
|
309
331
|
def: e,
|
|
310
332
|
row: r,
|
|
311
|
-
|
|
333
|
+
totalCount: n,
|
|
334
|
+
onClose: a
|
|
312
335
|
}) {
|
|
313
|
-
const [l,
|
|
314
|
-
const
|
|
315
|
-
return
|
|
316
|
-
}) : "Details",
|
|
317
|
-
return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick:
|
|
336
|
+
const [l, u] = q(e.initialTab ?? 0), c = !r && n != null ? Wt(e, n) : e.title ? e.title.replace(/\{\{\s*([\w.]+)\s*\}\}/g, (m, h) => {
|
|
337
|
+
const v = r == null ? void 0 : r[h];
|
|
338
|
+
return v == null ? "" : String(v);
|
|
339
|
+
}) : "Details", i = typeof e.width == "number" ? `${e.width}px` : e.width ?? "90%", s = e.resolvedTabs[l];
|
|
340
|
+
return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick: a, children: /* @__PURE__ */ x(
|
|
318
341
|
"div",
|
|
319
342
|
{
|
|
320
343
|
className: "flex h-full flex-col border-l border-slate-200 bg-slate-50 shadow-2xl dark:border-border dark:bg-background",
|
|
321
|
-
style: { width:
|
|
322
|
-
onClick: (
|
|
344
|
+
style: { width: i, maxWidth: "96%" },
|
|
345
|
+
onClick: (m) => m.stopPropagation(),
|
|
323
346
|
children: [
|
|
324
|
-
/* @__PURE__ */
|
|
325
|
-
/* @__PURE__ */
|
|
326
|
-
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children:
|
|
327
|
-
e.resolvedTabs.length > 1 && /* @__PURE__ */ t("div", { className: "flex gap-1", children: e.resolvedTabs.map((
|
|
347
|
+
/* @__PURE__ */ x("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 bg-white px-4 py-2.5 dark:border-border dark:bg-card", children: [
|
|
348
|
+
/* @__PURE__ */ x("div", { className: "flex items-center gap-3", children: [
|
|
349
|
+
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: c }),
|
|
350
|
+
e.resolvedTabs.length > 1 && /* @__PURE__ */ t("div", { className: "flex gap-1", children: e.resolvedTabs.map((m, h) => /* @__PURE__ */ t(
|
|
328
351
|
"button",
|
|
329
352
|
{
|
|
330
353
|
type: "button",
|
|
331
|
-
onClick: () =>
|
|
332
|
-
className: `rounded-md px-2.5 py-1 text-[12px] font-medium transition-colors ${
|
|
333
|
-
children:
|
|
354
|
+
onClick: () => u(h),
|
|
355
|
+
className: `rounded-md px-2.5 py-1 text-[12px] font-medium transition-colors ${h === l ? "bg-nvr-cyan/10 text-slate-800 dark:text-slate-100" : "text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"}`,
|
|
356
|
+
children: m.label
|
|
334
357
|
},
|
|
335
|
-
|
|
358
|
+
m.label
|
|
336
359
|
)) })
|
|
337
360
|
] }),
|
|
338
361
|
/* @__PURE__ */ t(
|
|
339
362
|
"button",
|
|
340
363
|
{
|
|
341
364
|
type: "button",
|
|
342
|
-
onClick:
|
|
365
|
+
onClick: a,
|
|
343
366
|
className: "rounded px-2 py-1 text-[12px] text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
|
|
344
367
|
children: "Close"
|
|
345
368
|
}
|
|
346
369
|
)
|
|
347
370
|
] }),
|
|
348
371
|
e.header && /* @__PURE__ */ t(
|
|
349
|
-
|
|
372
|
+
Ot,
|
|
350
373
|
{
|
|
351
374
|
config: e.header.config,
|
|
352
375
|
stats: e.header.stats,
|
|
@@ -354,101 +377,101 @@ function St({
|
|
|
354
377
|
note: e.header.note
|
|
355
378
|
}
|
|
356
379
|
),
|
|
357
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children:
|
|
358
|
-
|
|
380
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: s != null && s.matrix ? /* @__PURE__ */ t(
|
|
381
|
+
ce,
|
|
359
382
|
{
|
|
360
|
-
config:
|
|
361
|
-
initialScope:
|
|
383
|
+
config: s.matrix.config,
|
|
384
|
+
initialScope: s.matrix.initialScope,
|
|
362
385
|
lockScope: !0
|
|
363
386
|
},
|
|
364
387
|
l
|
|
365
|
-
) :
|
|
366
|
-
|
|
388
|
+
) : s != null && s.config ? /* @__PURE__ */ x(B, { children: [
|
|
389
|
+
s.note && /* @__PURE__ */ t(
|
|
367
390
|
"p",
|
|
368
391
|
{
|
|
369
392
|
className: "border-b border-slate-200 bg-white px-4 py-1.5 text-[11.5px] text-slate-500 dark:border-border dark:bg-card dark:text-slate-400",
|
|
370
393
|
"data-sheet-tab-note": !0,
|
|
371
|
-
children:
|
|
394
|
+
children: s.note
|
|
372
395
|
}
|
|
373
396
|
),
|
|
374
|
-
/* @__PURE__ */ t(
|
|
397
|
+
/* @__PURE__ */ t(Ie, { config: s.config }, l)
|
|
375
398
|
] }) : /* @__PURE__ */ t("p", { className: "p-4 text-[12px] text-slate-400", children: "Sheet not configured" }) })
|
|
376
399
|
]
|
|
377
400
|
}
|
|
378
401
|
) });
|
|
379
402
|
}
|
|
380
|
-
function
|
|
403
|
+
function At(e, r, n, a) {
|
|
381
404
|
if (!e) return;
|
|
382
|
-
const
|
|
383
|
-
const
|
|
384
|
-
if (!
|
|
385
|
-
const
|
|
386
|
-
if (
|
|
387
|
-
const $ =
|
|
388
|
-
return
|
|
389
|
-
},
|
|
390
|
-
Object.entries(
|
|
391
|
-
) :
|
|
392
|
-
return Array.isArray(
|
|
405
|
+
const l = (s) => {
|
|
406
|
+
const m = /^\$filters\.(\w+)(?:\.(\w+))?$/.exec(s);
|
|
407
|
+
if (!m) return;
|
|
408
|
+
const h = a == null ? void 0 : a.find((N) => N.param === m[1]), v = (n == null ? void 0 : n[m[1]]) ?? [];
|
|
409
|
+
if (v.length === 0) return;
|
|
410
|
+
const $ = m[2] ?? (h == null ? void 0 : h.value_field) ?? "id";
|
|
411
|
+
return v.map((N) => N[$]);
|
|
412
|
+
}, u = (s) => typeof s == "string" && s.startsWith("$row.") ? r[s.slice(5)] : typeof s == "string" && s.startsWith("$filters.") ? l(s) : Array.isArray(s) ? s.map(u) : s && typeof s == "object" ? Object.fromEntries(
|
|
413
|
+
Object.entries(s).map(([m, h]) => [m, u(h)])
|
|
414
|
+
) : s, c = (s) => s === void 0 ? !0 : Array.isArray(s) ? s.some(c) : s && typeof s == "object" ? Object.values(s).some(c) : !1, i = u(e);
|
|
415
|
+
return Array.isArray(i._and) && (i._and = i._and.filter((s) => !c(s))), c(i) ? void 0 : i;
|
|
393
416
|
}
|
|
394
|
-
const
|
|
395
|
-
function
|
|
417
|
+
const Ft = 400, Et = 2500;
|
|
418
|
+
function Oe(e, r) {
|
|
396
419
|
return e.map((n) => String(n[r] ?? "")).sort().join("\0");
|
|
397
420
|
}
|
|
398
|
-
function
|
|
421
|
+
function Lt({
|
|
399
422
|
filter: e,
|
|
400
423
|
selected: r,
|
|
401
424
|
onChange: n,
|
|
402
|
-
allowedIds:
|
|
403
|
-
scopeDefault:
|
|
404
|
-
onOpenChange:
|
|
425
|
+
allowedIds: a,
|
|
426
|
+
scopeDefault: l,
|
|
427
|
+
onOpenChange: u
|
|
405
428
|
}) {
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
var
|
|
409
|
-
(
|
|
410
|
-
}, [
|
|
411
|
-
const [
|
|
412
|
-
queryKey: ["page-renderer-filter", e.collection,
|
|
413
|
-
queryFn: () =>
|
|
414
|
-
|
|
415
|
-
fields: [.../* @__PURE__ */ new Set(["id",
|
|
429
|
+
const c = K(), [i, s] = q(!1), m = D(u);
|
|
430
|
+
m.current = u, X(() => {
|
|
431
|
+
var k;
|
|
432
|
+
(k = m.current) == null || k.call(m, i);
|
|
433
|
+
}, [i]);
|
|
434
|
+
const [h, v] = q(""), $ = D(null), N = e.value_field ?? "id", j = e.label_field ?? N, { data: _ = [] } = z({
|
|
435
|
+
queryKey: ["page-renderer-filter", e.collection, N, j, e.sort],
|
|
436
|
+
queryFn: () => c.request(
|
|
437
|
+
Fe(`/items/${e.collection}`, {
|
|
438
|
+
fields: [.../* @__PURE__ */ new Set(["id", N, j])].join(","),
|
|
416
439
|
limit: e.limit ?? 500,
|
|
417
440
|
...e.sort ? { sort: e.sort } : {}
|
|
418
441
|
})
|
|
419
|
-
).then((
|
|
442
|
+
).then((k) => k.data ?? []),
|
|
420
443
|
staleTime: 6e4
|
|
421
444
|
});
|
|
422
|
-
|
|
423
|
-
if (!
|
|
424
|
-
const
|
|
425
|
-
$.current && !$.current.contains(
|
|
445
|
+
X(() => {
|
|
446
|
+
if (!i) return;
|
|
447
|
+
const k = (T) => {
|
|
448
|
+
$.current && !$.current.contains(T.target) && s(!1);
|
|
426
449
|
};
|
|
427
|
-
return window.addEventListener("mousedown",
|
|
428
|
-
}, [
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
(
|
|
450
|
+
return window.addEventListener("mousedown", k), () => window.removeEventListener("mousedown", k);
|
|
451
|
+
}, [i]);
|
|
452
|
+
const W = e.label ?? F(e.param), M = ut(
|
|
453
|
+
a != null && a.length ? _.filter((k) => a.some((T) => String(T) === String(k.id))) : _,
|
|
454
|
+
(k) => String(k[N] ?? "")
|
|
432
455
|
).filter(
|
|
433
|
-
(
|
|
434
|
-
), C =
|
|
456
|
+
(k) => h ? String(k[j] ?? "").toLowerCase().includes(h.toLowerCase()) : !0
|
|
457
|
+
), C = a != null && a.length ? {
|
|
435
458
|
label: "restricted",
|
|
436
459
|
cls: "bg-amber-500/15 text-amber-700 dark:text-amber-300",
|
|
437
|
-
title: `Options limited to your restricted ${
|
|
438
|
-
} :
|
|
460
|
+
title: `Options limited to your restricted ${W} scope${l ? "; selection seeded from your defaults" : ""}`
|
|
461
|
+
} : l && r.length > 0 ? {
|
|
439
462
|
label: "your default",
|
|
440
463
|
cls: "bg-nvr-cyan/[0.12] text-[#0284a8] dark:text-nvr-cyan",
|
|
441
|
-
title: `Pre-selected from your default ${
|
|
464
|
+
title: `Pre-selected from your default ${W} scope — adjust freely`
|
|
442
465
|
} : null;
|
|
443
|
-
return /* @__PURE__ */
|
|
444
|
-
/* @__PURE__ */
|
|
466
|
+
return /* @__PURE__ */ x("div", { ref: $, className: "relative", children: [
|
|
467
|
+
/* @__PURE__ */ x(
|
|
445
468
|
"button",
|
|
446
469
|
{
|
|
447
470
|
type: "button",
|
|
448
|
-
onClick: () =>
|
|
471
|
+
onClick: () => s((k) => !k),
|
|
449
472
|
className: `inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-[12px] transition-colors ${r.length > 0 ? "border-nvr-cyan bg-nvr-cyan/10 text-slate-700 dark:text-slate-200" : "border-slate-200 bg-white text-slate-600 hover:border-slate-400 dark:border-border dark:bg-card dark:text-slate-300"}`,
|
|
450
473
|
children: [
|
|
451
|
-
/* @__PURE__ */ t("span", { className: "font-medium", children:
|
|
474
|
+
/* @__PURE__ */ t("span", { className: "font-medium", children: W }),
|
|
452
475
|
C && /* @__PURE__ */ t(
|
|
453
476
|
"span",
|
|
454
477
|
{
|
|
@@ -457,22 +480,22 @@ function qt({
|
|
|
457
480
|
children: C.label
|
|
458
481
|
}
|
|
459
482
|
),
|
|
460
|
-
/* @__PURE__ */ t("span", { className: "text-slate-400", children: r.length === 0 ? "All" : r.length === 1 ? String(r[0][
|
|
483
|
+
/* @__PURE__ */ t("span", { className: "text-slate-400", children: r.length === 0 ? "All" : r.length === 1 ? String(r[0][j] ?? r[0][N] ?? "") : `${r.length} selected` }),
|
|
461
484
|
/* @__PURE__ */ t("span", { className: "text-slate-400", children: "⌃" })
|
|
462
485
|
]
|
|
463
486
|
}
|
|
464
487
|
),
|
|
465
|
-
|
|
488
|
+
i && /* @__PURE__ */ x("div", { className: "absolute left-0 top-9 z-40 w-56 rounded-md border border-slate-200 bg-white p-1 shadow-md dark:border-border dark:bg-popover", children: [
|
|
466
489
|
/* @__PURE__ */ t(
|
|
467
490
|
"input",
|
|
468
491
|
{
|
|
469
|
-
value:
|
|
470
|
-
onChange: (
|
|
492
|
+
value: h,
|
|
493
|
+
onChange: (k) => v(k.target.value),
|
|
471
494
|
placeholder: "Search…",
|
|
472
495
|
className: "mb-1 h-7 w-full rounded border border-slate-200 bg-white px-2 text-[12px] outline-none dark:border-border dark:bg-background"
|
|
473
496
|
}
|
|
474
497
|
),
|
|
475
|
-
/* @__PURE__ */
|
|
498
|
+
/* @__PURE__ */ x("div", { className: "max-h-64 overflow-y-auto", children: [
|
|
476
499
|
r.length > 0 && /* @__PURE__ */ t(
|
|
477
500
|
"button",
|
|
478
501
|
{
|
|
@@ -482,46 +505,46 @@ function qt({
|
|
|
482
505
|
children: "Clear selection"
|
|
483
506
|
}
|
|
484
507
|
),
|
|
485
|
-
|
|
486
|
-
const
|
|
487
|
-
return /* @__PURE__ */
|
|
508
|
+
M.map((k) => {
|
|
509
|
+
const T = String(k[N] ?? ""), d = r.some((g) => String(g[N] ?? "") === T);
|
|
510
|
+
return /* @__PURE__ */ x(
|
|
488
511
|
"button",
|
|
489
512
|
{
|
|
490
513
|
type: "button",
|
|
491
514
|
onClick: () => {
|
|
492
515
|
if (e.single) {
|
|
493
|
-
n(
|
|
516
|
+
n(d ? [] : [k]), s(!1);
|
|
494
517
|
return;
|
|
495
518
|
}
|
|
496
519
|
n(
|
|
497
|
-
|
|
520
|
+
d ? r.filter((g) => String(g[N] ?? "") !== T) : [...r, k]
|
|
498
521
|
);
|
|
499
522
|
},
|
|
500
523
|
className: "flex w-full items-center gap-2 rounded px-2 py-1 text-left text-[12px] text-slate-700 hover:bg-slate-100 dark:text-slate-200 dark:hover:bg-muted",
|
|
501
524
|
children: [
|
|
502
|
-
/* @__PURE__ */ t("span", { className: `w-3.5 shrink-0 text-nvr-cyan ${
|
|
503
|
-
/* @__PURE__ */ t("span", { className: "truncate", children: String(
|
|
525
|
+
/* @__PURE__ */ t("span", { className: `w-3.5 shrink-0 text-nvr-cyan ${d ? "" : "invisible"}`, children: "✓" }),
|
|
526
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: String(k[j] ?? T) })
|
|
504
527
|
]
|
|
505
528
|
},
|
|
506
|
-
|
|
529
|
+
T
|
|
507
530
|
);
|
|
508
531
|
}),
|
|
509
|
-
|
|
532
|
+
M.length === 0 && /* @__PURE__ */ t("p", { className: "px-2 py-1.5 text-[12px] text-slate-400", children: "No options" })
|
|
510
533
|
] })
|
|
511
534
|
] })
|
|
512
535
|
] });
|
|
513
536
|
}
|
|
514
|
-
function
|
|
515
|
-
return /* @__PURE__ */ t(
|
|
537
|
+
function Bt({ widget: e }) {
|
|
538
|
+
return /* @__PURE__ */ t(Ie, { config: e.config ?? {} });
|
|
516
539
|
}
|
|
517
|
-
function
|
|
518
|
-
const r = e.config ?? {}, [n,
|
|
519
|
-
return r.collection ? r.display === "drawer" ? /* @__PURE__ */
|
|
540
|
+
function It({ widget: e }) {
|
|
541
|
+
const r = e.config ?? {}, [n, a] = q(!1);
|
|
542
|
+
return r.collection ? r.display === "drawer" ? /* @__PURE__ */ x("div", { className: "flex h-full items-center", children: [
|
|
520
543
|
/* @__PURE__ */ t(
|
|
521
544
|
"button",
|
|
522
545
|
{
|
|
523
546
|
type: "button",
|
|
524
|
-
onClick: () =>
|
|
547
|
+
onClick: () => a(!0),
|
|
525
548
|
className: "inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-md border border-slate-200 bg-white px-3 text-[12.5px] font-medium text-slate-700 shadow-sm transition-colors hover:border-nvr-cyan hover:text-nvr-navy dark:border-border dark:bg-card dark:text-slate-200 dark:hover:text-nvr-cyan",
|
|
526
549
|
children: r.button_label ?? r.title ?? "Manage"
|
|
527
550
|
}
|
|
@@ -530,8 +553,8 @@ function Rt({ widget: e }) {
|
|
|
530
553
|
"div",
|
|
531
554
|
{
|
|
532
555
|
className: "fixed inset-0 z-50 flex justify-end bg-black/30",
|
|
533
|
-
onClick: () =>
|
|
534
|
-
children: /* @__PURE__ */
|
|
556
|
+
onClick: () => a(!1),
|
|
557
|
+
children: /* @__PURE__ */ x(
|
|
535
558
|
"div",
|
|
536
559
|
{
|
|
537
560
|
className: "flex h-full flex-col border-l border-slate-200 bg-white shadow-2xl dark:border-border dark:bg-background",
|
|
@@ -539,33 +562,33 @@ function Rt({ widget: e }) {
|
|
|
539
562
|
width: typeof r.sheet_width == "number" ? `${r.sheet_width}px` : r.sheet_width ?? "92%",
|
|
540
563
|
maxWidth: "96%"
|
|
541
564
|
},
|
|
542
|
-
onClick: (
|
|
565
|
+
onClick: (l) => l.stopPropagation(),
|
|
543
566
|
children: [
|
|
544
|
-
/* @__PURE__ */
|
|
567
|
+
/* @__PURE__ */ x("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
|
|
545
568
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: r.button_label ?? r.title ?? "Manage" }),
|
|
546
569
|
/* @__PURE__ */ t(
|
|
547
570
|
"button",
|
|
548
571
|
{
|
|
549
572
|
type: "button",
|
|
550
|
-
onClick: () =>
|
|
573
|
+
onClick: () => a(!1),
|
|
551
574
|
className: "rounded px-2 py-1 text-[12px] text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
|
|
552
575
|
children: "Close"
|
|
553
576
|
}
|
|
554
577
|
)
|
|
555
578
|
] }),
|
|
556
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(
|
|
579
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(We, { config: r }) })
|
|
557
580
|
]
|
|
558
581
|
}
|
|
559
582
|
)
|
|
560
583
|
}
|
|
561
584
|
)
|
|
562
|
-
] }) : /* @__PURE__ */ t(
|
|
585
|
+
] }) : /* @__PURE__ */ t(We, { config: r }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Configure the record grid (collection)" });
|
|
563
586
|
}
|
|
564
|
-
function
|
|
587
|
+
function Dt({
|
|
565
588
|
cfg: e
|
|
566
589
|
}) {
|
|
567
|
-
const [r, n] = q(!1),
|
|
568
|
-
return delete
|
|
590
|
+
const [r, n] = q(!1), a = { ...e };
|
|
591
|
+
return delete a.display, /* @__PURE__ */ x("div", { className: "flex h-full items-center", children: [
|
|
569
592
|
/* @__PURE__ */ t(
|
|
570
593
|
"button",
|
|
571
594
|
{
|
|
@@ -580,7 +603,7 @@ function Tt({
|
|
|
580
603
|
{
|
|
581
604
|
className: "fixed inset-0 z-50 flex justify-end bg-black/30",
|
|
582
605
|
onClick: () => n(!1),
|
|
583
|
-
children: /* @__PURE__ */
|
|
606
|
+
children: /* @__PURE__ */ x(
|
|
584
607
|
"div",
|
|
585
608
|
{
|
|
586
609
|
className: "flex h-full flex-col border-l border-slate-200 bg-slate-50 shadow-2xl dark:border-border dark:bg-background",
|
|
@@ -588,9 +611,9 @@ function Tt({
|
|
|
588
611
|
width: typeof e.sheet_width == "number" ? `${e.sheet_width}px` : e.sheet_width ?? "90%",
|
|
589
612
|
maxWidth: "96%"
|
|
590
613
|
},
|
|
591
|
-
onClick: (
|
|
614
|
+
onClick: (l) => l.stopPropagation(),
|
|
592
615
|
children: [
|
|
593
|
-
/* @__PURE__ */
|
|
616
|
+
/* @__PURE__ */ x("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 bg-white px-4 py-2.5 dark:border-border dark:bg-card", children: [
|
|
594
617
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: e.button_label ?? e.label ?? "View" }),
|
|
595
618
|
/* @__PURE__ */ t(
|
|
596
619
|
"button",
|
|
@@ -602,7 +625,7 @@ function Tt({
|
|
|
602
625
|
}
|
|
603
626
|
)
|
|
604
627
|
] }),
|
|
605
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(
|
|
628
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(De, { config: a }) })
|
|
606
629
|
]
|
|
607
630
|
}
|
|
608
631
|
)
|
|
@@ -610,332 +633,349 @@ function Tt({
|
|
|
610
633
|
)
|
|
611
634
|
] });
|
|
612
635
|
}
|
|
613
|
-
function
|
|
614
|
-
return e.display === "drawer" ? /* @__PURE__ */ t(
|
|
636
|
+
function Ie({ config: e }) {
|
|
637
|
+
return e.display === "drawer" ? /* @__PURE__ */ t(Dt, { cfg: e }) : /* @__PURE__ */ t(De, { config: e });
|
|
615
638
|
}
|
|
616
|
-
function
|
|
617
|
-
var
|
|
618
|
-
const r =
|
|
619
|
-
() =>
|
|
620
|
-
), [
|
|
621
|
-
() =>
|
|
622
|
-
), $ = (
|
|
623
|
-
const
|
|
624
|
-
if (f
|
|
625
|
-
const
|
|
626
|
-
|
|
639
|
+
function De({ config: e }) {
|
|
640
|
+
var ke, we, Ne, Se, $e, _e, Ce, qe, je;
|
|
641
|
+
const r = K(), n = Ae(), [a, l] = q(null), [u, c] = q(null), [i, s] = q(null), [m, h] = q(
|
|
642
|
+
() => Rt(e.filters)
|
|
643
|
+
), [v] = q(
|
|
644
|
+
() => st(e.filters, typeof window > "u" ? "" : window.location.search)
|
|
645
|
+
), $ = (o, p) => {
|
|
646
|
+
const f = { ...m, [o]: p };
|
|
647
|
+
if (h(f), typeof window > "u" || !(e.filters ?? []).some((y) => y.url_param)) return;
|
|
648
|
+
const b = ot(e.filters, f, window.location.search);
|
|
649
|
+
b !== window.location.search && window.history.replaceState(
|
|
627
650
|
window.history.state,
|
|
628
651
|
"",
|
|
629
|
-
`${window.location.pathname}${
|
|
652
|
+
`${window.location.pathname}${b}${window.location.hash}`
|
|
630
653
|
);
|
|
631
|
-
}, [
|
|
632
|
-
|
|
654
|
+
}, [N, j] = q(null), [_, W] = q(null), P = (_ == null ? void 0 : _.phase) === "running", M = He();
|
|
655
|
+
X(() => {
|
|
633
656
|
if ((_ == null ? void 0 : _.phase) !== "running") return;
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
(
|
|
657
|
+
const o = window.setInterval(() => {
|
|
658
|
+
W(
|
|
659
|
+
(p) => (p == null ? void 0 : p.phase) === "running" ? { ...p, elapsedMs: Date.now() - p.startedAt } : p
|
|
637
660
|
);
|
|
638
661
|
}, 250);
|
|
639
|
-
return () => window.clearInterval(
|
|
662
|
+
return () => window.clearInterval(o);
|
|
640
663
|
}, [_ == null ? void 0 : _.phase]);
|
|
641
|
-
const { scopes: C, ready:
|
|
642
|
-
|
|
643
|
-
if (
|
|
644
|
-
|
|
645
|
-
const
|
|
646
|
-
(
|
|
664
|
+
const { scopes: C, ready: k } = mt(), T = D(!1), [d, g] = q(!1), [E, Q] = q(/* @__PURE__ */ new Map());
|
|
665
|
+
X(() => {
|
|
666
|
+
if (T.current || !k) return;
|
|
667
|
+
T.current = !0;
|
|
668
|
+
const o = (e.filters ?? []).filter(
|
|
669
|
+
(p) => !(m[p.param] ?? []).length && !v.has(p.param)
|
|
647
670
|
);
|
|
648
|
-
if (!C || !
|
|
649
|
-
|
|
671
|
+
if (!C || !o.length) {
|
|
672
|
+
g(!0);
|
|
650
673
|
return;
|
|
651
674
|
}
|
|
652
675
|
(async () => {
|
|
653
676
|
try {
|
|
654
|
-
const
|
|
655
|
-
for (const
|
|
656
|
-
const
|
|
657
|
-
if (!
|
|
658
|
-
const
|
|
659
|
-
if (!
|
|
660
|
-
const
|
|
677
|
+
const p = {};
|
|
678
|
+
for (const f of o) {
|
|
679
|
+
const b = Te(C, { key: f.param, collection: f.collection });
|
|
680
|
+
if (!b) continue;
|
|
681
|
+
const y = pt(C, b.name);
|
|
682
|
+
if (!y.length) continue;
|
|
683
|
+
const S = f.value_field ?? "id", O = await ht(
|
|
661
684
|
r,
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
685
|
+
b,
|
|
686
|
+
y,
|
|
687
|
+
S
|
|
665
688
|
);
|
|
666
|
-
if (
|
|
667
|
-
const
|
|
668
|
-
|
|
689
|
+
if (O.length) {
|
|
690
|
+
const R = O.map((H, se) => ({ [S]: H, id: y[se] }));
|
|
691
|
+
p[f.param] = f.single ? R.slice(0, 1) : R;
|
|
669
692
|
}
|
|
670
693
|
}
|
|
671
|
-
Object.keys(
|
|
672
|
-
const
|
|
673
|
-
for (const [
|
|
674
|
-
(
|
|
675
|
-
return
|
|
676
|
-
}),
|
|
694
|
+
Object.keys(p).length && (h((f) => {
|
|
695
|
+
const b = { ...f };
|
|
696
|
+
for (const [y, S] of Object.entries(p))
|
|
697
|
+
(b[y] ?? []).length || (b[y] = S);
|
|
698
|
+
return b;
|
|
699
|
+
}), Q(
|
|
677
700
|
new Map(
|
|
678
|
-
Object.entries(
|
|
679
|
-
var
|
|
680
|
-
const
|
|
681
|
-
return [
|
|
701
|
+
Object.entries(p).map(([f, b]) => {
|
|
702
|
+
var S;
|
|
703
|
+
const y = ((S = (e.filters ?? []).find((O) => O.param === f)) == null ? void 0 : S.value_field) ?? "id";
|
|
704
|
+
return [f, Oe(b, y)];
|
|
682
705
|
})
|
|
683
706
|
)
|
|
684
707
|
));
|
|
685
708
|
} finally {
|
|
686
|
-
|
|
709
|
+
g(!0);
|
|
687
710
|
}
|
|
688
711
|
})();
|
|
689
|
-
}, [
|
|
690
|
-
const J =
|
|
691
|
-
const
|
|
692
|
-
for (const
|
|
693
|
-
const
|
|
694
|
-
|
|
712
|
+
}, [k, C, e.filters, m, r, v]);
|
|
713
|
+
const J = Re(() => {
|
|
714
|
+
const o = { ...e.params ?? {} };
|
|
715
|
+
for (const p of e.filters ?? []) {
|
|
716
|
+
const f = m[p.param] ?? [];
|
|
717
|
+
f.length > 0 && (o[p.param] = f.map((b) => String(b[p.value_field ?? "id"] ?? "")).join(","));
|
|
695
718
|
}
|
|
696
|
-
return
|
|
697
|
-
}, [e.params, e.filters,
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
),
|
|
701
|
-
() => JSON.parse(
|
|
702
|
-
[
|
|
703
|
-
),
|
|
704
|
-
data:
|
|
705
|
-
isPending:
|
|
706
|
-
error:
|
|
707
|
-
refetch:
|
|
708
|
-
isFetching:
|
|
709
|
-
|
|
710
|
-
|
|
719
|
+
return o;
|
|
720
|
+
}, [e.params, e.filters, m]), [U, V] = q(/* @__PURE__ */ new Set()), re = D(!1), me = JSON.stringify(J), ze = nt(
|
|
721
|
+
me,
|
|
722
|
+
re.current ? U.size > 0 ? Et : Ft : 0
|
|
723
|
+
), ne = re.current ? ze : me, L = Re(
|
|
724
|
+
() => JSON.parse(ne),
|
|
725
|
+
[ne]
|
|
726
|
+
), ae = D(!1), {
|
|
727
|
+
data: A,
|
|
728
|
+
isPending: pe,
|
|
729
|
+
error: he,
|
|
730
|
+
refetch: xe,
|
|
731
|
+
isFetching: fe,
|
|
732
|
+
isPlaceholderData: Ke
|
|
733
|
+
} = z({
|
|
734
|
+
queryKey: ["page-renderer-query", e.query_slug, ne],
|
|
711
735
|
queryFn: () => {
|
|
712
|
-
const
|
|
713
|
-
return
|
|
714
|
-
|
|
715
|
-
params:
|
|
716
|
-
...
|
|
736
|
+
const o = ae.current;
|
|
737
|
+
return ae.current = !1, r.request(
|
|
738
|
+
Z(`/custom-queries/${e.query_slug}/execute`, {
|
|
739
|
+
params: L,
|
|
740
|
+
...o ? { refresh: !0 } : {}
|
|
717
741
|
})
|
|
718
742
|
);
|
|
719
743
|
},
|
|
720
|
-
enabled: !!e.query_slug &&
|
|
721
|
-
staleTime: 6e4
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
744
|
+
enabled: !!e.query_slug && d,
|
|
745
|
+
staleTime: 6e4,
|
|
746
|
+
// A filter change (FY, zone) keeps the table on screen, dimmed, until the
|
|
747
|
+
// new answer lands: swapping it for the loader unmounted QueryTable and
|
|
748
|
+
// reset its view state — "Hide empty rows" switched itself off (L13).
|
|
749
|
+
// Only the same query's answer stands in; another slug starts fresh.
|
|
750
|
+
placeholderData: (o, p) => (p == null ? void 0 : p.queryKey[1]) === e.query_slug ? o : void 0
|
|
751
|
+
}), I = A == null ? void 0 : A.data, G = Ke && fe, Qe = Ye(() => {
|
|
752
|
+
ae.current = !0, xe();
|
|
753
|
+
}, [xe]), be = pe;
|
|
725
754
|
if (!e.query_slug) return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Set a query slug" });
|
|
726
|
-
const
|
|
727
|
-
var
|
|
728
|
-
const
|
|
729
|
-
for (const [
|
|
730
|
-
const
|
|
731
|
-
if (
|
|
732
|
-
|
|
755
|
+
const Je = (o) => {
|
|
756
|
+
var y;
|
|
757
|
+
const p = {};
|
|
758
|
+
for (const [S, O] of Object.entries(o.params ?? {})) {
|
|
759
|
+
const R = Be(O, null, I ?? [], L, m, e.filters);
|
|
760
|
+
if (R === void 0) {
|
|
761
|
+
j(`Select a value for "${S}" first`);
|
|
733
762
|
return;
|
|
734
763
|
}
|
|
735
|
-
|
|
764
|
+
p[S] = R;
|
|
736
765
|
}
|
|
737
|
-
const
|
|
738
|
-
action:
|
|
739
|
-
params:
|
|
740
|
-
phase:
|
|
741
|
-
confirmText:
|
|
766
|
+
const f = (y = o.confirm) == null ? void 0 : y.replace(/\{(\w+)\}/g, (S, O) => String(p[O] ?? "")), b = {
|
|
767
|
+
action: o,
|
|
768
|
+
params: p,
|
|
769
|
+
phase: f ? "confirm" : "running",
|
|
770
|
+
confirmText: f ?? null,
|
|
742
771
|
startedAt: Date.now(),
|
|
743
772
|
elapsedMs: 0
|
|
744
773
|
};
|
|
745
|
-
|
|
746
|
-
},
|
|
747
|
-
const
|
|
748
|
-
|
|
774
|
+
W(b), f || ge(b);
|
|
775
|
+
}, ge = async (o) => {
|
|
776
|
+
const p = Date.now();
|
|
777
|
+
W({ ...o, phase: "running", startedAt: p, elapsedMs: 0 });
|
|
749
778
|
try {
|
|
750
|
-
const
|
|
751
|
-
|
|
752
|
-
),
|
|
753
|
-
|
|
754
|
-
(
|
|
755
|
-
...
|
|
779
|
+
const f = await r.request(
|
|
780
|
+
Z(`/custom-queries/${o.action.query_slug}/execute`, { params: o.params })
|
|
781
|
+
), b = Array.isArray(f == null ? void 0 : f.data) ? f.data : [];
|
|
782
|
+
W(
|
|
783
|
+
(y) => y && y.action === o.action ? {
|
|
784
|
+
...y,
|
|
756
785
|
phase: "done",
|
|
757
|
-
elapsedMs: Date.now() -
|
|
758
|
-
resultRows:
|
|
759
|
-
resultSample:
|
|
760
|
-
} :
|
|
761
|
-
),
|
|
762
|
-
`${
|
|
763
|
-
),
|
|
764
|
-
} catch (
|
|
765
|
-
const
|
|
766
|
-
|
|
767
|
-
(
|
|
768
|
-
),
|
|
786
|
+
elapsedMs: Date.now() - p,
|
|
787
|
+
resultRows: b.length,
|
|
788
|
+
resultSample: b[0] ?? null
|
|
789
|
+
} : y
|
|
790
|
+
), j(
|
|
791
|
+
`${o.action.success_message ?? `${o.action.label} completed`} · ${Y(Date.now() - p)}`
|
|
792
|
+
), M.invalidateQueries({ queryKey: ["page-renderer-query", e.query_slug] });
|
|
793
|
+
} catch (f) {
|
|
794
|
+
const b = Ee(f, "unknown error");
|
|
795
|
+
W(
|
|
796
|
+
(y) => y && y.action === o.action ? { ...y, phase: "error", elapsedMs: Date.now() - p, error: b } : y
|
|
797
|
+
), j(`${o.action.label} failed: ${b}`);
|
|
769
798
|
}
|
|
770
|
-
},
|
|
771
|
-
|
|
799
|
+
}, Ue = /* @__PURE__ */ t(
|
|
800
|
+
bt,
|
|
772
801
|
{
|
|
773
|
-
envelope:
|
|
774
|
-
onRefresh:
|
|
775
|
-
refreshing:
|
|
802
|
+
envelope: A,
|
|
803
|
+
onRefresh: Qe,
|
|
804
|
+
refreshing: fe && !pe,
|
|
776
805
|
className: "ml-auto"
|
|
777
806
|
}
|
|
778
|
-
),
|
|
779
|
-
(e.filters ?? []).map((
|
|
780
|
-
const
|
|
807
|
+
), le = e.filters && e.filters.length > 0 || (ke = e.actions) != null && ke.length || A != null && A.cache_ttl ? /* @__PURE__ */ x("div", { className: "flex flex-wrap items-center gap-2 pb-2", children: [
|
|
808
|
+
(e.filters ?? []).map((o) => {
|
|
809
|
+
const p = Te(C, { key: o.param, collection: o.collection }), f = p ? (C == null ? void 0 : C.restricted[p.name]) ?? [] : [];
|
|
781
810
|
return /* @__PURE__ */ t(
|
|
782
|
-
|
|
811
|
+
Lt,
|
|
783
812
|
{
|
|
784
|
-
filter:
|
|
785
|
-
selected:
|
|
786
|
-
allowedIds:
|
|
787
|
-
scopeDefault:
|
|
788
|
-
onChange: (
|
|
789
|
-
|
|
813
|
+
filter: o,
|
|
814
|
+
selected: m[o.param] ?? [],
|
|
815
|
+
allowedIds: f.length > 0 ? f : void 0,
|
|
816
|
+
scopeDefault: E.has(o.param) && E.get(o.param) === Oe(m[o.param] ?? [], o.value_field ?? "id"),
|
|
817
|
+
onChange: (b) => {
|
|
818
|
+
re.current = !0, $(o.param, b);
|
|
790
819
|
},
|
|
791
|
-
onOpenChange: (
|
|
792
|
-
if (
|
|
793
|
-
const
|
|
794
|
-
return
|
|
820
|
+
onOpenChange: (b) => V((y) => {
|
|
821
|
+
if (y.has(o.param) === b) return y;
|
|
822
|
+
const S = new Set(y);
|
|
823
|
+
return b ? S.add(o.param) : S.delete(o.param), S;
|
|
795
824
|
})
|
|
796
825
|
},
|
|
797
|
-
|
|
826
|
+
o.param
|
|
798
827
|
);
|
|
799
828
|
}),
|
|
800
|
-
(e.actions ?? []).map((
|
|
829
|
+
(e.actions ?? []).map((o) => /* @__PURE__ */ t(
|
|
801
830
|
"button",
|
|
802
831
|
{
|
|
803
832
|
type: "button",
|
|
804
|
-
disabled:
|
|
805
|
-
onClick: () => void
|
|
833
|
+
disabled: P,
|
|
834
|
+
onClick: () => void Je(o),
|
|
806
835
|
className: "ml-auto inline-flex h-8 items-center rounded-md bg-nvr-cyan px-3 text-[12px] font-semibold text-white hover:opacity-90 disabled:opacity-50",
|
|
807
|
-
children:
|
|
836
|
+
children: P ? "Running…" : o.label
|
|
808
837
|
},
|
|
809
|
-
|
|
838
|
+
o.label
|
|
810
839
|
)),
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
] }) : null,
|
|
814
|
-
|
|
840
|
+
N && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: N }),
|
|
841
|
+
Ue
|
|
842
|
+
] }) : null, ye = (we = e.stats) != null && we.length ? /* @__PURE__ */ t(
|
|
843
|
+
yt,
|
|
815
844
|
{
|
|
816
845
|
stats: e.stats,
|
|
817
|
-
rows:
|
|
818
|
-
effectiveParams:
|
|
819
|
-
loading:
|
|
846
|
+
rows: I ?? [],
|
|
847
|
+
effectiveParams: L,
|
|
848
|
+
loading: be || G,
|
|
849
|
+
zeroDash: !!((Ne = e.table) != null && Ne.zero_dash)
|
|
820
850
|
}
|
|
821
851
|
) : null;
|
|
822
|
-
if (
|
|
823
|
-
return /* @__PURE__ */
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
/* @__PURE__ */ t(
|
|
852
|
+
if (be)
|
|
853
|
+
return /* @__PURE__ */ x("div", { className: "p-3", children: [
|
|
854
|
+
le,
|
|
855
|
+
ye,
|
|
856
|
+
/* @__PURE__ */ t(ee, {})
|
|
827
857
|
] });
|
|
828
|
-
if (
|
|
829
|
-
return /* @__PURE__ */
|
|
830
|
-
|
|
831
|
-
/* @__PURE__ */ t(
|
|
858
|
+
if (he)
|
|
859
|
+
return /* @__PURE__ */ x("div", { className: "p-3", children: [
|
|
860
|
+
le,
|
|
861
|
+
/* @__PURE__ */ t(te, { error: he, unresolved: e.unresolved_params })
|
|
832
862
|
] });
|
|
833
|
-
const
|
|
834
|
-
const
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
e.filters
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
863
|
+
const w = e.row_click, ve = (o, p, f) => {
|
|
864
|
+
const b = p ? null : f ?? I ?? [], S = ct(o, (R) => Tt(
|
|
865
|
+
R,
|
|
866
|
+
p,
|
|
867
|
+
I ?? [],
|
|
868
|
+
L,
|
|
869
|
+
m,
|
|
870
|
+
e.filters,
|
|
871
|
+
b
|
|
872
|
+
)), O = S.resolvedTabs.map((R) => {
|
|
873
|
+
if ("matrix" in R) {
|
|
874
|
+
const H = {};
|
|
875
|
+
for (const [se, ie] of Object.entries(R.matrix.scope))
|
|
876
|
+
H[se] = ie.startsWith("$row.") ? p == null ? void 0 : p[ie.slice(5)] : ie;
|
|
846
877
|
return {
|
|
847
|
-
label:
|
|
848
|
-
matrix: { config:
|
|
878
|
+
label: R.label,
|
|
879
|
+
matrix: { config: R.matrix.config, initialScope: H }
|
|
849
880
|
};
|
|
850
881
|
}
|
|
851
|
-
return { label:
|
|
882
|
+
return { label: R.label, note: R.note, config: R.config };
|
|
852
883
|
});
|
|
853
|
-
|
|
884
|
+
s({
|
|
854
885
|
def: {
|
|
855
|
-
...
|
|
856
|
-
resolvedTabs:
|
|
857
|
-
header:
|
|
858
|
-
config:
|
|
859
|
-
stats:
|
|
860
|
-
asOf:
|
|
861
|
-
note:
|
|
886
|
+
...o,
|
|
887
|
+
resolvedTabs: O,
|
|
888
|
+
header: S.header ? {
|
|
889
|
+
config: S.header.config,
|
|
890
|
+
stats: S.header.stats,
|
|
891
|
+
asOf: S.header.asOf,
|
|
892
|
+
note: S.header.note
|
|
862
893
|
} : null,
|
|
863
|
-
initialTab:
|
|
894
|
+
initialTab: S.initialTab
|
|
864
895
|
},
|
|
865
|
-
row:
|
|
896
|
+
row: p,
|
|
897
|
+
totalCount: b ? b.length : null
|
|
866
898
|
});
|
|
867
|
-
},
|
|
868
|
-
|
|
869
|
-
collection:
|
|
870
|
-
itemId: String(
|
|
871
|
-
layoutId:
|
|
872
|
-
width:
|
|
899
|
+
}, Ve = w ? (o) => {
|
|
900
|
+
w.picker ? l(o) : w.sheet ? ve(w.sheet, o) : w.matrix && o.id != null ? c(o.id) : w.drill && o.id != null && (n == null || n.open({
|
|
901
|
+
collection: w.drill.collection ?? "",
|
|
902
|
+
itemId: String(o.id),
|
|
903
|
+
layoutId: w.drill.layout_id,
|
|
904
|
+
width: w.drill.width
|
|
873
905
|
}));
|
|
874
|
-
} : void 0,
|
|
875
|
-
label:
|
|
876
|
-
onClick: (
|
|
906
|
+
} : void 0, Ge = (Se = e.row_actions) != null && Se.length ? e.row_actions.map((o) => ({
|
|
907
|
+
label: o.label,
|
|
908
|
+
onClick: (p, f) => ve(o.sheet, p, f)
|
|
877
909
|
})) : void 0;
|
|
878
|
-
return /* @__PURE__ */
|
|
910
|
+
return /* @__PURE__ */ x(
|
|
879
911
|
"div",
|
|
880
912
|
{
|
|
881
|
-
className: (
|
|
913
|
+
className: ($e = e.table) != null && $e.sticky ? (
|
|
882
914
|
// Sticky grids own their scroll: filters/stats stay pinned above a
|
|
883
915
|
// scrolling table region (header/first-column/totals pin inside it).
|
|
884
916
|
"flex h-full min-h-0 flex-col overflow-hidden p-3"
|
|
885
917
|
) : "h-full overflow-auto p-3",
|
|
886
918
|
children: [
|
|
887
|
-
|
|
888
|
-
|
|
919
|
+
le,
|
|
920
|
+
ye,
|
|
889
921
|
/* @__PURE__ */ t(
|
|
890
|
-
|
|
922
|
+
"div",
|
|
891
923
|
{
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
924
|
+
"data-qt-refetching": G ? "" : void 0,
|
|
925
|
+
"aria-busy": G || void 0,
|
|
926
|
+
className: `transition-opacity ${G ? "opacity-60" : ""} ${(_e = e.table) != null && _e.sticky ? "flex min-h-0 flex-1 flex-col" : ""}`.trim(),
|
|
927
|
+
children: /* @__PURE__ */ t(
|
|
928
|
+
vt,
|
|
929
|
+
{
|
|
930
|
+
rows: I ?? [],
|
|
931
|
+
config: (
|
|
932
|
+
// Current-month highlight only applies when the selected year param
|
|
933
|
+
// IS the current year — otherwise strip it.
|
|
934
|
+
(Ce = e.table) != null && Ce.highlight_group && e.table.highlight_year_param ? Number(
|
|
935
|
+
String(L[e.table.highlight_year_param] ?? "").split(",")[0]
|
|
936
|
+
) === (/* @__PURE__ */ new Date()).getFullYear() ? e.table : { ...e.table, highlight_group: void 0 } : e.table
|
|
937
|
+
),
|
|
938
|
+
onRowClick: Ve,
|
|
939
|
+
rowActions: Ge,
|
|
940
|
+
emptyText: e.empty_label,
|
|
941
|
+
pivotYear: (je = (qe = e.table) == null ? void 0 : qe.pivot) != null && je.year_param && Number(String(L[e.table.pivot.year_param] ?? "").split(",")[0]) || void 0
|
|
942
|
+
}
|
|
943
|
+
)
|
|
904
944
|
}
|
|
905
945
|
),
|
|
906
|
-
(
|
|
946
|
+
(w == null ? void 0 : w.picker) && a && /* @__PURE__ */ t(
|
|
907
947
|
"div",
|
|
908
948
|
{
|
|
909
949
|
className: "fixed inset-0 z-50 flex items-start justify-center bg-black/30 pt-32",
|
|
910
|
-
onClick: () =>
|
|
911
|
-
children: /* @__PURE__ */
|
|
950
|
+
onClick: () => l(null),
|
|
951
|
+
children: /* @__PURE__ */ x(
|
|
912
952
|
"div",
|
|
913
953
|
{
|
|
914
954
|
className: "w-[420px] rounded-lg border border-slate-200 bg-white p-4 shadow-xl dark:border-border dark:bg-background",
|
|
915
|
-
onClick: (
|
|
955
|
+
onClick: (o) => o.stopPropagation(),
|
|
916
956
|
children: [
|
|
917
|
-
/* @__PURE__ */ t("p", { className: "mb-2 text-[13px] font-semibold text-slate-700 dark:text-slate-200", children:
|
|
957
|
+
/* @__PURE__ */ t("p", { className: "mb-2 text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: w.picker.title ?? "Choose a record" }),
|
|
918
958
|
/* @__PURE__ */ t(
|
|
919
|
-
|
|
959
|
+
gt,
|
|
920
960
|
{
|
|
921
|
-
collection:
|
|
961
|
+
collection: w.picker.collection,
|
|
922
962
|
value: null,
|
|
923
|
-
onChange: (
|
|
924
|
-
var
|
|
925
|
-
if (
|
|
926
|
-
if (
|
|
927
|
-
|
|
963
|
+
onChange: (o) => {
|
|
964
|
+
var p, f, b, y;
|
|
965
|
+
if (l(null), o != null) {
|
|
966
|
+
if (w.matrix) {
|
|
967
|
+
c(o);
|
|
928
968
|
return;
|
|
929
969
|
}
|
|
930
970
|
n == null || n.open({
|
|
931
|
-
collection: ((
|
|
932
|
-
itemId: String(
|
|
933
|
-
layoutId: (
|
|
934
|
-
width: (
|
|
971
|
+
collection: ((p = w.drill) == null ? void 0 : p.collection) ?? ((f = w.picker) == null ? void 0 : f.collection) ?? "",
|
|
972
|
+
itemId: String(o),
|
|
973
|
+
layoutId: (b = w.drill) == null ? void 0 : b.layout_id,
|
|
974
|
+
width: (y = w.drill) == null ? void 0 : y.width
|
|
935
975
|
});
|
|
936
976
|
}
|
|
937
977
|
},
|
|
938
|
-
extraFilter:
|
|
978
|
+
extraFilter: At(w.picker.filter, a, m, e.filters),
|
|
939
979
|
placeholder: "Search…"
|
|
940
980
|
}
|
|
941
981
|
),
|
|
@@ -943,7 +983,7 @@ function Oe({ config: e }) {
|
|
|
943
983
|
"button",
|
|
944
984
|
{
|
|
945
985
|
type: "button",
|
|
946
|
-
onClick: () =>
|
|
986
|
+
onClick: () => l(null),
|
|
947
987
|
className: "mt-3 h-7 rounded px-2 text-[12px] text-slate-500 hover:text-slate-700",
|
|
948
988
|
children: "Cancel"
|
|
949
989
|
}
|
|
@@ -953,24 +993,32 @@ function Oe({ config: e }) {
|
|
|
953
993
|
)
|
|
954
994
|
}
|
|
955
995
|
),
|
|
956
|
-
(
|
|
957
|
-
|
|
996
|
+
(w == null ? void 0 : w.matrix) && u != null && /* @__PURE__ */ t(
|
|
997
|
+
Le,
|
|
998
|
+
{
|
|
999
|
+
config: w.matrix.config,
|
|
1000
|
+
initialScope: { [w.matrix.scope_field]: u },
|
|
1001
|
+
width: w.matrix.width,
|
|
1002
|
+
title: w.matrix.title,
|
|
1003
|
+
onClose: () => c(null)
|
|
1004
|
+
}
|
|
1005
|
+
),
|
|
1006
|
+
i && /* @__PURE__ */ t(
|
|
1007
|
+
Pt,
|
|
958
1008
|
{
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
onClose: () => d(null)
|
|
1009
|
+
def: i.def,
|
|
1010
|
+
row: i.row,
|
|
1011
|
+
totalCount: i.totalCount,
|
|
1012
|
+
onClose: () => s(null)
|
|
964
1013
|
}
|
|
965
1014
|
),
|
|
966
|
-
a && /* @__PURE__ */ t(St, { def: a.def, row: a.row, onClose: () => c(null) }),
|
|
967
1015
|
_ && /* @__PURE__ */ t(
|
|
968
|
-
|
|
1016
|
+
zt,
|
|
969
1017
|
{
|
|
970
1018
|
run: _,
|
|
971
|
-
onConfirm: () => void
|
|
1019
|
+
onConfirm: () => void ge(_),
|
|
972
1020
|
onClose: () => {
|
|
973
|
-
|
|
1021
|
+
W(null);
|
|
974
1022
|
}
|
|
975
1023
|
}
|
|
976
1024
|
)
|
|
@@ -978,15 +1026,15 @@ function Oe({ config: e }) {
|
|
|
978
1026
|
}
|
|
979
1027
|
);
|
|
980
1028
|
}
|
|
981
|
-
const
|
|
982
|
-
function
|
|
1029
|
+
const Y = (e) => e < 6e4 ? `${(e / 1e3).toFixed(e < 1e4 ? 1 : 0)}s` : `${Math.floor(e / 6e4)}m ${Math.round(e % 6e4 / 1e3)}s`;
|
|
1030
|
+
function zt({
|
|
983
1031
|
run: e,
|
|
984
1032
|
onConfirm: r,
|
|
985
1033
|
onClose: n
|
|
986
1034
|
}) {
|
|
987
|
-
const
|
|
988
|
-
return
|
|
989
|
-
/* @__PURE__ */
|
|
1035
|
+
const a = Object.entries(e.params);
|
|
1036
|
+
return Xe(
|
|
1037
|
+
/* @__PURE__ */ x(B, { children: [
|
|
990
1038
|
/* @__PURE__ */ t(
|
|
991
1039
|
"div",
|
|
992
1040
|
{
|
|
@@ -995,7 +1043,7 @@ function Wt({
|
|
|
995
1043
|
onClick: e.phase === "running" ? void 0 : n
|
|
996
1044
|
}
|
|
997
1045
|
),
|
|
998
|
-
/* @__PURE__ */
|
|
1046
|
+
/* @__PURE__ */ x(
|
|
999
1047
|
"div",
|
|
1000
1048
|
{
|
|
1001
1049
|
role: "dialog",
|
|
@@ -1004,13 +1052,13 @@ function Wt({
|
|
|
1004
1052
|
className: "fixed left-1/2 top-[24vh] z-50 w-[min(400px,92vw)] -translate-x-1/2 rounded-xl border border-slate-200 bg-white p-4 shadow-2xl dark:border-border dark:bg-card",
|
|
1005
1053
|
children: [
|
|
1006
1054
|
/* @__PURE__ */ t("p", { className: "text-[13.5px] font-semibold text-slate-900 dark:text-foreground", children: e.action.label }),
|
|
1007
|
-
|
|
1008
|
-
/* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children:
|
|
1009
|
-
/* @__PURE__ */ t("dd", { className: "ml-auto font-medium tabular-nums text-slate-800 dark:text-slate-100", children: String(
|
|
1010
|
-
] },
|
|
1011
|
-
e.phase === "confirm" && /* @__PURE__ */
|
|
1055
|
+
a.length > 0 && /* @__PURE__ */ t("dl", { className: "mt-2 space-y-0.5 rounded-lg bg-slate-50 px-2.5 py-1.5 text-[11.5px] dark:bg-muted", children: a.map(([l, u]) => /* @__PURE__ */ x("div", { className: "flex gap-2", children: [
|
|
1056
|
+
/* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children: F(l) }),
|
|
1057
|
+
/* @__PURE__ */ t("dd", { className: "ml-auto font-medium tabular-nums text-slate-800 dark:text-slate-100", children: String(u) })
|
|
1058
|
+
] }, l)) }),
|
|
1059
|
+
e.phase === "confirm" && /* @__PURE__ */ x(B, { children: [
|
|
1012
1060
|
/* @__PURE__ */ t("p", { className: "mt-2 text-[12.5px] text-slate-600 dark:text-slate-300", children: e.confirmText }),
|
|
1013
|
-
/* @__PURE__ */
|
|
1061
|
+
/* @__PURE__ */ x("div", { className: "mt-3 flex gap-2", children: [
|
|
1014
1062
|
/* @__PURE__ */ t(
|
|
1015
1063
|
"button",
|
|
1016
1064
|
{
|
|
@@ -1031,23 +1079,23 @@ function Wt({
|
|
|
1031
1079
|
)
|
|
1032
1080
|
] })
|
|
1033
1081
|
] }),
|
|
1034
|
-
e.phase === "running" && /* @__PURE__ */
|
|
1082
|
+
e.phase === "running" && /* @__PURE__ */ x("div", { className: "mt-3 flex items-center gap-2.5 text-[12.5px] text-slate-600 dark:text-slate-300", children: [
|
|
1035
1083
|
/* @__PURE__ */ t("span", { className: "h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-nvr-cyan border-t-transparent" }),
|
|
1036
1084
|
"Running… ",
|
|
1037
|
-
/* @__PURE__ */ t("span", { className: "tabular-nums", children:
|
|
1085
|
+
/* @__PURE__ */ t("span", { className: "tabular-nums", children: Y(e.elapsedMs) })
|
|
1038
1086
|
] }),
|
|
1039
|
-
e.phase === "done" && /* @__PURE__ */
|
|
1040
|
-
/* @__PURE__ */
|
|
1087
|
+
e.phase === "done" && /* @__PURE__ */ x(B, { children: [
|
|
1088
|
+
/* @__PURE__ */ x("p", { className: "mt-2 text-[12.5px] font-medium text-emerald-600 dark:text-emerald-400", children: [
|
|
1041
1089
|
e.action.success_message ?? "Completed",
|
|
1042
1090
|
" · ",
|
|
1043
|
-
|
|
1091
|
+
Y(e.elapsedMs)
|
|
1044
1092
|
] }),
|
|
1045
|
-
e.resultRows != null && e.resultRows > 0 && e.resultSample && /* @__PURE__ */
|
|
1046
|
-
Object.entries(e.resultSample).slice(0, 8).map(([
|
|
1047
|
-
/* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children:
|
|
1048
|
-
/* @__PURE__ */ t("dd", { className: "ml-auto font-medium tabular-nums text-slate-800 dark:text-slate-100", children: String(
|
|
1049
|
-
] },
|
|
1050
|
-
e.resultRows > 1 && /* @__PURE__ */
|
|
1093
|
+
e.resultRows != null && e.resultRows > 0 && e.resultSample && /* @__PURE__ */ x("dl", { className: "mt-2 max-h-40 space-y-0.5 overflow-y-auto rounded-lg bg-slate-50 px-2.5 py-1.5 text-[11.5px] dark:bg-muted", children: [
|
|
1094
|
+
Object.entries(e.resultSample).slice(0, 8).map(([l, u]) => /* @__PURE__ */ x("div", { className: "flex gap-2", children: [
|
|
1095
|
+
/* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children: F(l) }),
|
|
1096
|
+
/* @__PURE__ */ t("dd", { className: "ml-auto font-medium tabular-nums text-slate-800 dark:text-slate-100", children: String(u ?? "—") })
|
|
1097
|
+
] }, l)),
|
|
1098
|
+
e.resultRows > 1 && /* @__PURE__ */ x("p", { className: "pt-0.5 text-slate-400", children: [
|
|
1051
1099
|
"…",
|
|
1052
1100
|
e.resultRows,
|
|
1053
1101
|
" result rows"
|
|
@@ -1063,14 +1111,14 @@ function Wt({
|
|
|
1063
1111
|
}
|
|
1064
1112
|
)
|
|
1065
1113
|
] }),
|
|
1066
|
-
e.phase === "error" && /* @__PURE__ */
|
|
1067
|
-
/* @__PURE__ */
|
|
1114
|
+
e.phase === "error" && /* @__PURE__ */ x(B, { children: [
|
|
1115
|
+
/* @__PURE__ */ x("p", { className: "mt-2 text-[12.5px] font-medium text-red-600 dark:text-red-400", children: [
|
|
1068
1116
|
"Failed after ",
|
|
1069
|
-
|
|
1117
|
+
Y(e.elapsedMs),
|
|
1070
1118
|
": ",
|
|
1071
1119
|
e.error
|
|
1072
1120
|
] }),
|
|
1073
|
-
/* @__PURE__ */
|
|
1121
|
+
/* @__PURE__ */ x("div", { className: "mt-3 flex gap-2", children: [
|
|
1074
1122
|
/* @__PURE__ */ t(
|
|
1075
1123
|
"button",
|
|
1076
1124
|
{
|
|
@@ -1098,45 +1146,45 @@ function Wt({
|
|
|
1098
1146
|
document.body
|
|
1099
1147
|
);
|
|
1100
1148
|
}
|
|
1101
|
-
function
|
|
1149
|
+
function Pe({ slug: e, widget: r }) {
|
|
1102
1150
|
var n;
|
|
1103
1151
|
switch (r.type) {
|
|
1104
1152
|
case "table":
|
|
1105
|
-
return /* @__PURE__ */ t(
|
|
1153
|
+
return /* @__PURE__ */ t($t, { slug: e, widget: r });
|
|
1106
1154
|
case "kpi":
|
|
1107
|
-
return /* @__PURE__ */ t(
|
|
1155
|
+
return /* @__PURE__ */ t(_t, { slug: e, widget: r });
|
|
1108
1156
|
case "markdown":
|
|
1109
|
-
return /* @__PURE__ */ t(
|
|
1157
|
+
return /* @__PURE__ */ t(St, { content: String(((n = r.config) == null ? void 0 : n.content) ?? "") });
|
|
1110
1158
|
case "iframe":
|
|
1111
|
-
return /* @__PURE__ */ t(
|
|
1159
|
+
return /* @__PURE__ */ t(qt, { widget: r });
|
|
1112
1160
|
case "query":
|
|
1113
|
-
return /* @__PURE__ */ t(
|
|
1161
|
+
return /* @__PURE__ */ t(Bt, { widget: r });
|
|
1114
1162
|
case "matrix":
|
|
1115
|
-
return /* @__PURE__ */ t(
|
|
1163
|
+
return /* @__PURE__ */ t(jt, { widget: r });
|
|
1116
1164
|
case "record-grid":
|
|
1117
|
-
return /* @__PURE__ */ t(
|
|
1165
|
+
return /* @__PURE__ */ t(It, { widget: r });
|
|
1118
1166
|
case "recent-activity":
|
|
1119
|
-
return /* @__PURE__ */ t(
|
|
1167
|
+
return /* @__PURE__ */ t(Ct, { slug: e, widget: r });
|
|
1120
1168
|
default:
|
|
1121
1169
|
return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Unknown widget" });
|
|
1122
1170
|
}
|
|
1123
1171
|
}
|
|
1124
|
-
function
|
|
1125
|
-
var
|
|
1126
|
-
const l =
|
|
1127
|
-
data:
|
|
1128
|
-
isLoading:
|
|
1129
|
-
error:
|
|
1130
|
-
} =
|
|
1172
|
+
function hr({ slug: e, hideHeader: r, className: n }) {
|
|
1173
|
+
var k, T;
|
|
1174
|
+
const a = K(), { isAdmin: l } = Ze(), u = Ae(), c = et("drill.page"), i = c.value, {
|
|
1175
|
+
data: s,
|
|
1176
|
+
isLoading: m,
|
|
1177
|
+
error: h
|
|
1178
|
+
} = z({
|
|
1131
1179
|
queryKey: ["page-renderer", e],
|
|
1132
|
-
queryFn: () =>
|
|
1180
|
+
queryFn: () => a.request(Fe(`/pages/${e}`)).then((d) => d.data),
|
|
1133
1181
|
enabled: !!e,
|
|
1134
1182
|
retry: !1
|
|
1135
1183
|
});
|
|
1136
|
-
if (
|
|
1137
|
-
return /* @__PURE__ */ t("div", { className: n ?? "p-6", children: /* @__PURE__ */ t(
|
|
1138
|
-
if (
|
|
1139
|
-
return /* @__PURE__ */
|
|
1184
|
+
if (m)
|
|
1185
|
+
return /* @__PURE__ */ t("div", { className: n ?? "p-6", children: /* @__PURE__ */ t(ee, {}) });
|
|
1186
|
+
if (h || !s)
|
|
1187
|
+
return /* @__PURE__ */ x(
|
|
1140
1188
|
"div",
|
|
1141
1189
|
{
|
|
1142
1190
|
className: `flex flex-col items-center justify-center p-10 text-center ${n ?? ""}`,
|
|
@@ -1146,77 +1194,81 @@ function tr({ slug: e, hideHeader: r, className: n }) {
|
|
|
1146
1194
|
]
|
|
1147
1195
|
}
|
|
1148
1196
|
);
|
|
1149
|
-
const
|
|
1150
|
-
var
|
|
1151
|
-
return (
|
|
1152
|
-
},
|
|
1153
|
-
y:
|
|
1154
|
-
items:
|
|
1155
|
-
})),
|
|
1156
|
-
var
|
|
1157
|
-
return (
|
|
1158
|
-
}),
|
|
1159
|
-
!r && /* @__PURE__ */ t("div", { className: "shrink-0 pb-4", children: /* @__PURE__ */ t("h1", { className: "text-lg font-semibold text-slate-900 dark:text-slate-100", children:
|
|
1160
|
-
/* @__PURE__ */ t("div", { className: `min-h-0 flex-1 overflow-y-auto ${
|
|
1161
|
-
|
|
1197
|
+
const v = ((k = s.layout) == null ? void 0 : k.columns) ?? 12, $ = lt(((T = s.layout) == null ? void 0 : T.widgets) ?? [], l), N = (d) => {
|
|
1198
|
+
var g;
|
|
1199
|
+
return (d.type === "matrix" || d.type === "query" || d.type === "record-grid") && ((g = d.config) == null ? void 0 : g.display) === "drawer";
|
|
1200
|
+
}, j = [...new Set($.filter(N).map((d) => d.y))].filter((d) => $.every((g) => N(g) || d < g.y || d >= g.y + Math.max(g.h, 1))).sort((d, g) => d - g), _ = j.map((d) => ({
|
|
1201
|
+
y: d,
|
|
1202
|
+
items: $.filter((g) => g.y === d && N(g)).sort((g, E) => g.x - E.x)
|
|
1203
|
+
})), W = $.filter((d) => !(N(d) && j.includes(d.y))), P = (d) => d - j.filter((g) => g < d).length, M = W.find((d) => {
|
|
1204
|
+
var g;
|
|
1205
|
+
return (g = d.config) == null ? void 0 : g.full_height;
|
|
1206
|
+
}), C = /* @__PURE__ */ x("div", { className: `flex h-full min-h-0 flex-col ${n ?? ""}`, children: [
|
|
1207
|
+
!r && /* @__PURE__ */ t("div", { className: "shrink-0 pb-4", children: /* @__PURE__ */ t("h1", { className: "text-lg font-semibold text-slate-900 dark:text-slate-100", children: s.name }) }),
|
|
1208
|
+
/* @__PURE__ */ t("div", { className: `min-h-0 flex-1 overflow-y-auto ${M ? "flex flex-col" : ""}`, children: $.length === 0 ? /* @__PURE__ */ t("p", { className: "p-6 text-center text-[13px] text-slate-400", children: "This page has no widgets yet." }) : /* @__PURE__ */ x(B, { children: [
|
|
1209
|
+
_.map((d) => /* @__PURE__ */ t("div", { className: "mb-3 flex shrink-0 flex-wrap items-center gap-2", children: d.items.map((g) => /* @__PURE__ */ t(Pe, { slug: s.slug, widget: g }, g.id)) }, d.y)),
|
|
1162
1210
|
/* @__PURE__ */ t(
|
|
1163
1211
|
"div",
|
|
1164
1212
|
{
|
|
1165
|
-
className:
|
|
1213
|
+
className: M ? "grid min-h-0 flex-1 gap-4" : "grid gap-4",
|
|
1166
1214
|
style: {
|
|
1167
|
-
gridTemplateColumns: `repeat(${
|
|
1215
|
+
gridTemplateColumns: `repeat(${v}, minmax(0, 1fr))`,
|
|
1168
1216
|
// repeat(0, …) is INVALID CSS (count must be ≥1) and drops the
|
|
1169
1217
|
// whole declaration — a fill widget in the first row band emits
|
|
1170
1218
|
// just the stretching track.
|
|
1171
|
-
...
|
|
1172
|
-
gridTemplateRows: `${
|
|
1219
|
+
...M ? {
|
|
1220
|
+
gridTemplateRows: `${P(M.y) > 0 ? `repeat(${P(M.y)}, ${oe}px) ` : ""}minmax(${oe * 3}px, 1fr)`
|
|
1173
1221
|
} : {},
|
|
1174
|
-
gridAutoRows: `${
|
|
1222
|
+
gridAutoRows: `${oe}px`
|
|
1175
1223
|
},
|
|
1176
|
-
children:
|
|
1177
|
-
var
|
|
1178
|
-
const
|
|
1179
|
-
return /* @__PURE__ */
|
|
1224
|
+
children: W.map((d) => {
|
|
1225
|
+
var Q, J, U, V;
|
|
1226
|
+
const g = (d.type === "matrix" || d.type === "query" || d.type === "record-grid") && ((Q = d.config) == null ? void 0 : Q.display) === "drawer", E = d === M;
|
|
1227
|
+
return /* @__PURE__ */ x(
|
|
1180
1228
|
"div",
|
|
1181
1229
|
{
|
|
1182
|
-
className:
|
|
1230
|
+
className: g ? "flex min-h-0 flex-col" : "flex min-h-0 flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm dark:border-border dark:bg-card",
|
|
1183
1231
|
style: {
|
|
1184
|
-
gridColumn: `${Math.min(
|
|
1185
|
-
gridRow:
|
|
1232
|
+
gridColumn: `${Math.min(d.x, v - 1) + 1} / span ${Math.min(d.w, v)}`,
|
|
1233
|
+
gridRow: E ? `${P(d.y) + 1} / -1` : `${P(d.y) + 1} / span ${Math.max(d.h, 1)}`
|
|
1186
1234
|
},
|
|
1187
1235
|
children: [
|
|
1188
|
-
!
|
|
1189
|
-
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ t(
|
|
1236
|
+
!g && d.type !== "kpi" && d.type !== "markdown" && ((J = d.config) == null ? void 0 : J.hide_label) !== !0 && /* @__PURE__ */ t("div", { className: "shrink-0 border-b border-slate-100 px-3 py-1.5 text-[11px] font-medium uppercase tracking-wide text-slate-400 dark:border-border", children: String(((U = d.config) == null ? void 0 : U.label) ?? "") || (typeof ((V = d.config) == null ? void 0 : V.collection) == "string" ? F(String(d.config.collection)) : F(d.type)) }),
|
|
1237
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ t(Pe, { slug: s.slug, widget: d }) })
|
|
1190
1238
|
]
|
|
1191
1239
|
},
|
|
1192
|
-
|
|
1240
|
+
d.id
|
|
1193
1241
|
);
|
|
1194
1242
|
})
|
|
1195
1243
|
}
|
|
1196
1244
|
)
|
|
1197
1245
|
] }) })
|
|
1198
1246
|
] });
|
|
1199
|
-
return
|
|
1200
|
-
|
|
1201
|
-
|
|
1247
|
+
return u ? C : /* @__PURE__ */ x(tt.Provider, { value: { open: (d) => c.push([d]) }, children: [
|
|
1248
|
+
i != null && i.length ? /* @__PURE__ */ t(
|
|
1249
|
+
kt,
|
|
1202
1250
|
{
|
|
1203
|
-
collection:
|
|
1204
|
-
itemId:
|
|
1205
|
-
layoutId:
|
|
1206
|
-
width:
|
|
1207
|
-
title:
|
|
1208
|
-
stack:
|
|
1209
|
-
onPush: (
|
|
1210
|
-
onPop: () =>
|
|
1211
|
-
onClose: () =>
|
|
1251
|
+
collection: i[0].collection,
|
|
1252
|
+
itemId: i[0].itemId,
|
|
1253
|
+
layoutId: i[0].layoutId,
|
|
1254
|
+
width: i[0].width,
|
|
1255
|
+
title: i[0].title,
|
|
1256
|
+
stack: i,
|
|
1257
|
+
onPush: (d) => c.push([...i, d]),
|
|
1258
|
+
onPop: () => c.back(),
|
|
1259
|
+
onClose: () => c.back(i.length)
|
|
1212
1260
|
}
|
|
1213
1261
|
) : null,
|
|
1214
|
-
|
|
1262
|
+
C
|
|
1215
1263
|
] });
|
|
1216
1264
|
}
|
|
1217
1265
|
export {
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1266
|
+
hr as PageRenderer,
|
|
1267
|
+
Ie as QueryWidgetView,
|
|
1268
|
+
It as RecordGridWidgetBody,
|
|
1269
|
+
Mt as missingRowParamMessage,
|
|
1270
|
+
Tt as resolveSheetConfig,
|
|
1271
|
+
Be as resolveSheetValue,
|
|
1272
|
+
Oe as selectionSignature,
|
|
1273
|
+
Wt as totalSheetTitle
|
|
1222
1274
|
};
|