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