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