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