@nivaro/react 0.3.41 → 0.3.42
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/LayoutForm.js +100 -98
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +644 -15
- package/dist/index.js +814 -775
- package/dist/shared/components/ActivityEntry.js +154 -0
- package/dist/shared/components/AudienceConfirmPanel.js +98 -0
- package/dist/shared/components/BackgroundRunOffer.js +43 -31
- package/dist/shared/components/BroadcastView.js +225 -204
- package/dist/shared/components/CollectionBrowserView.js +3924 -3584
- package/dist/shared/components/ConfigHistory.js +153 -0
- package/dist/shared/components/ConfigReadBack.js +65 -0
- package/dist/shared/components/DataTable.js +379 -346
- package/dist/shared/components/ForceReloadBanner.js +47 -40
- package/dist/shared/components/IdleReloadWatcher.js +69 -0
- package/dist/shared/components/ItemEditForm.js +4041 -3853
- package/dist/shared/components/MyWorkView.js +278 -213
- package/dist/shared/components/NotificationBell.js +130 -121
- package/dist/shared/components/ProfileView.js +776 -1003
- package/dist/shared/components/RecentRecordsRail.js +34 -16
- package/dist/shared/components/RecordReadView.js +500 -477
- package/dist/shared/components/Skeletons.js +199 -0
- package/dist/shared/components/SlowNotice.js +63 -0
- package/dist/shared/components/Term.js +23 -0
- package/dist/shared/components/WidgetSlot.js +350 -353
- package/dist/shared/components/access/PermissionSummary.js +106 -0
- package/dist/shared/components/bulk/BulkActionButtons.js +76 -73
- package/dist/shared/components/chat/ChatPanel.js +902 -886
- package/dist/shared/components/chat/MemberPaging.js +70 -0
- package/dist/shared/components/chat/RoomParts.js +147 -117
- package/dist/shared/components/chat/ScreenClip.js +73 -69
- package/dist/shared/components/chat/chat-core.js +449 -396
- package/dist/shared/components/chat/huddle/huddle-store.js +48 -43
- package/dist/shared/components/help-videos/api.js +2 -5
- package/dist/shared/components/help-videos/viewer/HelpVideoMatchChip.js +79 -0
- package/dist/shared/components/help-videos/viewer/matchChip.js +50 -0
- package/dist/shared/components/imports/CollectionImportPanel.js +139 -133
- package/dist/shared/components/imports/RunDetailSheet.js +222 -227
- package/dist/shared/components/integrations/console/ErrorExplanation.js +121 -0
- package/dist/shared/components/integrations/console/PartnerDetail.js +175 -174
- package/dist/shared/components/integrations/console/SubmissionRow.js +36 -34
- package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +50 -48
- package/dist/shared/components/item-edit/FieldComments.js +212 -0
- package/dist/shared/components/item-edit/FieldRow.js +340 -336
- package/dist/shared/components/item-edit/RecordHeaderActions.js +23 -22
- package/dist/shared/components/item-edit/RelationCombobox.js +231 -222
- package/dist/shared/components/item-edit/RuleHiddenNotes.js +55 -0
- package/dist/shared/components/item-edit/field-comments-context.js +6 -0
- package/dist/shared/components/item-edit/field-sources.js +33 -0
- package/dist/shared/components/item-edit/rule-hidden.js +30 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +113 -96
- package/dist/shared/components/layout-editor/editors/cascade-filters.js +170 -145
- package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +22 -18
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +177 -159
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +35 -34
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +124 -111
- package/dist/shared/components/layout-editor/inspector/kit.js +292 -277
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/list/CopyListLinkButton.js +41 -0
- package/dist/shared/components/list/InlineEdit.js +363 -0
- package/dist/shared/components/notifications/NotificationCenterView.js +213 -181
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -82
- package/dist/shared/components/notifications/NotificationRulesEditor.js +515 -0
- package/dist/shared/components/notifications/TestMyRules.js +137 -0
- package/dist/shared/components/notifications/changes-lines.js +24 -0
- package/dist/shared/components/notifications/why-lines.js +64 -0
- package/dist/shared/components/panels/CommentPanel.js +316 -281
- package/dist/shared/components/panels/LegalHoldBanner.js +38 -0
- package/dist/shared/components/panels/PipelinePanel.js +201 -196
- package/dist/shared/components/panels/RevisionsPanel.js +496 -479
- package/dist/shared/components/pipeline/PipelineEditorView.js +1587 -1560
- package/dist/shared/components/pipeline/PipelineStateOwners.js +116 -103
- package/dist/shared/components/profile/PersonDidPanel.js +188 -0
- package/dist/shared/components/profile/PersonProfile.js +57 -52
- package/dist/shared/components/queue/QueueWorklist.js +1526 -1365
- package/dist/shared/hooks/useSlowReason.js +39 -0
- package/dist/shared/lib/activity-sentence.js +670 -0
- package/dist/shared/lib/config-sentences.js +418 -0
- package/dist/shared/lib/core-glossary.js +229 -0
- package/dist/shared/lib/error-hints.js +159 -0
- package/dist/shared/lib/error-message.js +105 -0
- package/dist/shared/lib/error-toast.js +22 -0
- package/dist/shared/lib/field-comments.js +25 -0
- package/dist/shared/lib/filter-sentence.js +261 -0
- package/dist/shared/lib/glossary.js +55 -48
- package/dist/shared/lib/idle-reload.js +138 -0
- package/dist/shared/lib/layout-resolve.js +42 -29
- package/dist/shared/lib/list-inline-edit.js +190 -0
- package/dist/shared/lib/list-link.js +147 -0
- package/dist/shared/lib/prefetch.js +259 -106
- package/dist/shared/lib/record-ref.js +72 -0
- package/dist/shared/lib/reload-holds.js +25 -0
- package/dist/shared/lib/safe-error.js +52 -24
- package/dist/shared/lib/skeleton-shapes.js +72 -0
- package/dist/shared/lib/slow-reason.js +63 -0
- package/package.json +1 -1
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { Pencil as
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import { DrilldownContext as
|
|
6
|
-
import { useDebounced as
|
|
7
|
-
import { parseAllowedCollections as
|
|
8
|
-
import { get as
|
|
9
|
-
import { readGroupStructure as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
|
|
1
|
+
import { jsx as r, jsxs as f, Fragment as ce } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as V, useQueryClient as Mt } from "@tanstack/react-query";
|
|
3
|
+
import { Pencil as jt, ChevronDown as Kt } from "lucide-react";
|
|
4
|
+
import { useMemo as xe, useRef as Wt, useState as X, useEffect as ve, useCallback as ht, Fragment as It } from "react";
|
|
5
|
+
import { DrilldownContext as Ut, useNivaroClient as De, useApiFetchConfig as Vt, useDrilldown as xt } from "../context.js";
|
|
6
|
+
import { useDebounced as Ht } from "../hooks/useDebounced.js";
|
|
7
|
+
import { parseAllowedCollections as Bt } from "../lib/allowed-collections.js";
|
|
8
|
+
import { get as Q } from "../lib/commands.js";
|
|
9
|
+
import { readGroupStructure as Gt, isFolded as Jt, isEmptyValue as be, planFieldGrid as Qt } from "../lib/form-structure.js";
|
|
10
|
+
import { quietHiddenSectionsOf as Yt } from "../lib/layout-resolve.js";
|
|
11
|
+
import { useLiveRecord as zt } from "../lib/live.js";
|
|
12
|
+
import { isDisplayFormulaField as Re, resolvePlacementText as Xt, displayFormulaOf as Zt, formatDisplayValue as el } from "../lib/placement-behaviour.js";
|
|
13
|
+
import { useRecordReader as tl } from "../lib/record-loader.js";
|
|
14
|
+
import { sanitizeHtml as ll } from "../lib/sanitize-html.js";
|
|
15
|
+
import { titleCase as Ze, formatRelative as Ce } from "../lib/utils.js";
|
|
16
|
+
import { matchesVisibleWhen as rl } from "../lib/visible-when.js";
|
|
17
|
+
import { InboundRequestPopover as nl } from "./integrations/InboundRequest.js";
|
|
18
|
+
import { FileM2MField as al } from "./item-edit/FilePickerField.js";
|
|
19
|
+
import { useFieldTouches as il } from "./item-edit/HeaderFreshness.js";
|
|
20
|
+
import { richTextToPlain as sl } from "./item-edit/helpers.js";
|
|
21
|
+
import { PersonalDefaultMark as gt } from "./item-edit/PersonalDefaultControl.js";
|
|
22
|
+
import { usePlacementTextContext as dl, evaluateDisplayFormula as ol } from "./item-edit/placement-behaviour.js";
|
|
23
|
+
import { RuleHiddenNotes as cl } from "./item-edit/RuleHiddenNotes.js";
|
|
24
|
+
import { ruleHiddenGroups as ml, groupHasReadableField as ul } from "./item-edit/rule-hidden.js";
|
|
25
|
+
import { UserChip as vt } from "./item-edit/UserChip.js";
|
|
26
|
+
import { DesignNode as fl } from "./layout-editor/DesignNode.js";
|
|
27
|
+
import { DesignCanvas as pl } from "./layout-editor/design-canvas.js";
|
|
28
|
+
import { revealGroupKey as hl } from "./layout-editor/design-context.js";
|
|
29
|
+
import { choiceLabelsFrom as gl } from "./layout-editor/overview/describe-conditions.js";
|
|
30
|
+
import { useRecordIntegrity as bl, integrityByField as yl } from "./panels/RecordIntegrityBanner.js";
|
|
31
|
+
import { SimpleSelectXs as bt } from "./ui/SimpleSelect.js";
|
|
32
|
+
import { WidgetSlot as xl } from "./WidgetSlot.js";
|
|
33
|
+
const ye = (a) => {
|
|
30
34
|
if (!a) return {};
|
|
31
35
|
if (typeof a == "object") return a;
|
|
32
36
|
try {
|
|
@@ -34,8 +38,8 @@ const xe = (a) => {
|
|
|
34
38
|
} catch {
|
|
35
39
|
return {};
|
|
36
40
|
}
|
|
37
|
-
},
|
|
38
|
-
function
|
|
41
|
+
}, vl = 3;
|
|
42
|
+
function _l(a) {
|
|
39
43
|
let m = a;
|
|
40
44
|
if (typeof m == "string")
|
|
41
45
|
try {
|
|
@@ -44,30 +48,30 @@ function ul(a) {
|
|
|
44
48
|
m = m ? m.split(",").map((d) => d.trim()) : [];
|
|
45
49
|
}
|
|
46
50
|
if (!Array.isArray(m)) return [];
|
|
47
|
-
const
|
|
51
|
+
const y = [];
|
|
48
52
|
for (const d of m)
|
|
49
|
-
if (typeof d == "string" && d)
|
|
53
|
+
if (typeof d == "string" && d) y.push({ field: d, label: null });
|
|
50
54
|
else if (d && typeof d == "object" && typeof d.field == "string") {
|
|
51
55
|
const O = d.label;
|
|
52
|
-
|
|
56
|
+
y.push({
|
|
53
57
|
field: d.field,
|
|
54
58
|
label: typeof O == "string" && O.trim() ? O.trim() : null
|
|
55
59
|
});
|
|
56
60
|
}
|
|
57
|
-
return
|
|
61
|
+
return y.filter((d) => !d.field.startsWith("__"));
|
|
58
62
|
}
|
|
59
|
-
const
|
|
63
|
+
const _t = (a) => {
|
|
60
64
|
const m = String(a).match(/^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00:00(?:\.0+)?(?:Z|[+-]00:?00)?)?$/);
|
|
61
65
|
if (m) return `${m[2]}/${m[3]}/${m[1]}`;
|
|
62
|
-
const
|
|
63
|
-
return Number.isNaN(
|
|
64
|
-
},
|
|
66
|
+
const y = new Date(String(a));
|
|
67
|
+
return Number.isNaN(y.getTime()) ? String(a) : `${String(y.getMonth() + 1).padStart(2, "0")}/${String(y.getDate()).padStart(2, "0")}/${y.getFullYear()}`;
|
|
68
|
+
}, et = (a) => {
|
|
65
69
|
const m = Number(a);
|
|
66
70
|
return Number.isNaN(m) ? String(a) : `$${m.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
67
71
|
}, Ue = (a) => {
|
|
68
72
|
const m = Number(a);
|
|
69
73
|
return Number.isNaN(m) ? String(a) : m.toLocaleString("en-US");
|
|
70
|
-
}, Ie = "text-[11.5px] font-medium text-slate-500 dark:text-slate-400", le = () => /* @__PURE__ */
|
|
74
|
+
}, Ie = "text-[11.5px] font-medium text-slate-500 dark:text-slate-400", le = () => /* @__PURE__ */ r("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }), kl = `
|
|
71
75
|
[data-read-board]{grid-template-columns:minmax(0,1fr)}
|
|
72
76
|
[data-read-dl]{grid-template-columns:repeat(2,minmax(0,1fr))}
|
|
73
77
|
@media (min-width:640px){[data-read-dl="full"]{grid-template-columns:repeat(3,minmax(0,1fr))}}
|
|
@@ -86,43 +90,43 @@ function Ve({
|
|
|
86
90
|
value: a,
|
|
87
91
|
trueTone: m = "positive"
|
|
88
92
|
}) {
|
|
89
|
-
const
|
|
90
|
-
return /* @__PURE__ */
|
|
93
|
+
const y = a === !0 || a === 1 || a === "1" || a === "true";
|
|
94
|
+
return /* @__PURE__ */ r(
|
|
91
95
|
"span",
|
|
92
96
|
{
|
|
93
|
-
className: `inline-flex h-[18px] items-center rounded-full px-1.5 text-[10.5px] font-semibold ${
|
|
94
|
-
children:
|
|
97
|
+
className: `inline-flex h-[18px] items-center rounded-full px-1.5 text-[10.5px] font-semibold ${y ? m === "danger" ? "bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-400" : "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-400" : "bg-slate-100 text-slate-500 dark:bg-slate-800 dark:text-slate-400"}`,
|
|
98
|
+
children: y ? "Yes" : "No"
|
|
95
99
|
}
|
|
96
100
|
);
|
|
97
101
|
}
|
|
98
|
-
function
|
|
99
|
-
const
|
|
102
|
+
function Nl({ collection: a, id: m }) {
|
|
103
|
+
const y = De(), d = tl(), O = xt(), { data: S } = V({
|
|
100
104
|
queryKey: ["cbv-collection-meta", a],
|
|
101
|
-
queryFn: () =>
|
|
102
|
-
|
|
105
|
+
queryFn: () => y.request(
|
|
106
|
+
Q(`/collections/${a}`)
|
|
103
107
|
).then((A) => A.data).catch(() => ({ display_template: null, fields: [] })),
|
|
104
108
|
staleTime: 10 * 6e4,
|
|
105
109
|
retry: !1
|
|
106
|
-
}), { data: F, isPending: W } =
|
|
110
|
+
}), { data: F, isPending: W } = V({
|
|
107
111
|
queryKey: ["rrv-related", a, String(m)],
|
|
108
112
|
queryFn: () => d(a, m).catch(() => null),
|
|
109
113
|
enabled: m != null && !!S,
|
|
110
114
|
staleTime: 6e4,
|
|
111
115
|
retry: !1
|
|
112
116
|
});
|
|
113
|
-
if (m == null) return /* @__PURE__ */
|
|
117
|
+
if (m == null) return /* @__PURE__ */ r(le, {});
|
|
114
118
|
if (!F && (W || !S))
|
|
115
|
-
return /* @__PURE__ */
|
|
119
|
+
return /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 align-middle dark:bg-[hsl(var(--nvr-skeleton))]" });
|
|
116
120
|
if (!F) return /* @__PURE__ */ f("span", { className: "text-slate-400", children: [
|
|
117
121
|
"#",
|
|
118
122
|
String(m)
|
|
119
123
|
] });
|
|
120
|
-
let
|
|
124
|
+
let k = "";
|
|
121
125
|
const h = S == null ? void 0 : S.display_template;
|
|
122
|
-
if (h && (
|
|
123
|
-
const I = M.split(".").reduce((
|
|
126
|
+
if (h && (k = h.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (A, M) => {
|
|
127
|
+
const I = M.split(".").reduce((_, x) => _ == null ? void 0 : _[x], F);
|
|
124
128
|
return I == null ? "" : String(I);
|
|
125
|
-
}).trim()), !
|
|
129
|
+
}).trim()), !k) {
|
|
126
130
|
for (const A of [
|
|
127
131
|
"name",
|
|
128
132
|
"title",
|
|
@@ -134,38 +138,38 @@ function pl({ collection: a, id: m }) {
|
|
|
134
138
|
"filename"
|
|
135
139
|
])
|
|
136
140
|
if (F[A]) {
|
|
137
|
-
|
|
141
|
+
k = String(F[A]);
|
|
138
142
|
break;
|
|
139
143
|
}
|
|
140
144
|
}
|
|
141
|
-
return
|
|
145
|
+
return k || (k = `#${String(m)}`), O ? /* @__PURE__ */ r(
|
|
142
146
|
"button",
|
|
143
147
|
{
|
|
144
148
|
type: "button",
|
|
145
149
|
onClick: () => O.open({ collection: a, itemId: String(m) }),
|
|
146
150
|
className: "text-left underline decoration-slate-300 underline-offset-2 transition-colors hover:text-[#007a99] hover:decoration-[#007a99] dark:decoration-slate-600 dark:hover:text-nvr-cyan dark:hover:decoration-nvr-cyan",
|
|
147
|
-
children:
|
|
151
|
+
children: k
|
|
148
152
|
}
|
|
149
|
-
) : /* @__PURE__ */
|
|
153
|
+
) : /* @__PURE__ */ r(ce, { children: k });
|
|
150
154
|
}
|
|
151
|
-
function
|
|
152
|
-
const m = De(), { apiBase:
|
|
155
|
+
function wl({ id: a }) {
|
|
156
|
+
const m = De(), { apiBase: y } = Vt(), { data: d, isPending: O } = V({
|
|
153
157
|
queryKey: ["rrv-file-meta", String(a)],
|
|
154
158
|
queryFn: () => m.request(
|
|
155
|
-
|
|
159
|
+
Q(`/files/${a}/meta`)
|
|
156
160
|
).then((F) => F.data).catch(() => null),
|
|
157
161
|
enabled: a != null,
|
|
158
162
|
staleTime: 5 * 6e4,
|
|
159
163
|
retry: !1
|
|
160
164
|
});
|
|
161
|
-
if (a == null) return /* @__PURE__ */
|
|
165
|
+
if (a == null) return /* @__PURE__ */ r(le, {});
|
|
162
166
|
if (!d && O)
|
|
163
|
-
return /* @__PURE__ */
|
|
167
|
+
return /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-24 animate-pulse rounded bg-slate-100 align-middle dark:bg-[hsl(var(--nvr-skeleton))]" });
|
|
164
168
|
const S = (d == null ? void 0 : d.title) || (d == null ? void 0 : d.filename_download) || `#${String(a)}`;
|
|
165
|
-
return /* @__PURE__ */
|
|
169
|
+
return /* @__PURE__ */ r(
|
|
166
170
|
"a",
|
|
167
171
|
{
|
|
168
|
-
href: `${
|
|
172
|
+
href: `${y}/files/${a}`,
|
|
169
173
|
target: "_blank",
|
|
170
174
|
rel: "noreferrer",
|
|
171
175
|
className: "underline decoration-slate-300 underline-offset-2 transition-colors hover:text-[#007a99] hover:decoration-[#007a99] dark:decoration-slate-600 dark:hover:text-nvr-cyan dark:hover:decoration-nvr-cyan",
|
|
@@ -173,25 +177,25 @@ function hl({ id: a }) {
|
|
|
173
177
|
}
|
|
174
178
|
);
|
|
175
179
|
}
|
|
176
|
-
const
|
|
177
|
-
function
|
|
180
|
+
const tt = ({ collection: a, id: m }) => a === "nivaro_files" ? /* @__PURE__ */ r(wl, { id: m }) : /* @__PURE__ */ r(Nl, { collection: a, id: m });
|
|
181
|
+
function Sl({
|
|
178
182
|
junction: a,
|
|
179
183
|
parentFk: m,
|
|
180
|
-
junctionField:
|
|
184
|
+
junctionField: y,
|
|
181
185
|
parentId: d,
|
|
182
186
|
onCount: O,
|
|
183
187
|
onTarget: S,
|
|
184
188
|
relation: F
|
|
185
189
|
}) {
|
|
186
190
|
var j;
|
|
187
|
-
const W = De(), { data:
|
|
191
|
+
const W = De(), { data: k } = V({
|
|
188
192
|
queryKey: ["cbv-collection-meta", a],
|
|
189
|
-
queryFn: () => W.request(
|
|
193
|
+
queryFn: () => W.request(Q(`/collections/${a}`)).then((v) => v.data),
|
|
190
194
|
staleTime: 10 * 6e4,
|
|
191
195
|
retry: !1
|
|
192
|
-
}), h = ((
|
|
193
|
-
(v) => v.many_collection === a && v.many_field ===
|
|
194
|
-
), A =
|
|
196
|
+
}), h = ((k == null ? void 0 : k.relations) ?? []).find(
|
|
197
|
+
(v) => v.many_collection === a && v.many_field === y
|
|
198
|
+
), A = Bt(h == null ? void 0 : h.one_allowed_collections), M = !!h && !h.one_collection && (A.length > 0 || !!h.one_collection_field), I = (h == null ? void 0 : h.one_collection_field) ?? "collection", _ = (v) => v ? v === "directus_users" ? "nivaro_users" : v : null, x = (h == null ? void 0 : h.one_collection) ?? (M ? A.some((v) => v === "directus_users" || v === "nivaro_users") ? "nivaro_users" : _(A[0]) : null), { data: g } = V({
|
|
195
199
|
// Under the edit form's ['m2m-items', junction, parentFk, parentId] prefix (a longer key,
|
|
196
200
|
// so never the same cache entry): every link write that refreshes the form's list —
|
|
197
201
|
// a file upload, a picker change, the save itself — refreshes Summary's too. Its own
|
|
@@ -202,86 +206,86 @@ function gl({
|
|
|
202
206
|
m,
|
|
203
207
|
d,
|
|
204
208
|
"rrv",
|
|
205
|
-
|
|
209
|
+
y,
|
|
206
210
|
M ? I : ""
|
|
207
211
|
],
|
|
208
212
|
queryFn: () => W.request(
|
|
209
|
-
|
|
213
|
+
Q(`/items/${a}`, {
|
|
210
214
|
filter: JSON.stringify({ [m]: { _eq: d } }),
|
|
211
|
-
fields: M ? `id,${
|
|
215
|
+
fields: M ? `id,${y},${I}` : `id,${y}`,
|
|
212
216
|
limit: 200
|
|
213
217
|
})
|
|
214
218
|
).then(
|
|
215
|
-
(v) => (v.data ?? []).filter((w) => w[
|
|
216
|
-
const q = w[
|
|
219
|
+
(v) => (v.data ?? []).filter((w) => w[y] != null).map((w) => {
|
|
220
|
+
const q = w[y];
|
|
217
221
|
return {
|
|
218
222
|
id: String(typeof q == "object" ? q.id : q),
|
|
219
|
-
collection: M ?
|
|
223
|
+
collection: M ? _(w[I]) : null
|
|
220
224
|
};
|
|
221
225
|
})
|
|
222
226
|
).catch(() => []),
|
|
223
227
|
// The fields list depends on the companion leg — wait for it.
|
|
224
|
-
enabled: !!
|
|
228
|
+
enabled: !!k,
|
|
225
229
|
staleTime: 3e4,
|
|
226
230
|
retry: !1
|
|
227
|
-
}), R =
|
|
228
|
-
return
|
|
231
|
+
}), R = g == null ? void 0 : g.map((v) => v.id), N = x ?? (M ? ((j = g == null ? void 0 : g.find((v) => v.collection)) == null ? void 0 : j.collection) ?? null : null), C = R == null ? void 0 : R.length;
|
|
232
|
+
return ve(() => {
|
|
229
233
|
C !== void 0 && (O == null || O(C));
|
|
230
|
-
}, [C, O]),
|
|
234
|
+
}, [C, O]), ve(() => {
|
|
231
235
|
N && (S == null || S(N));
|
|
232
|
-
}, [N, S]),
|
|
233
|
-
|
|
236
|
+
}, [N, S]), k && !N && (!M || g) ? /* @__PURE__ */ r(le, {}) : !R || !N ? /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : R.length === 0 ? /* @__PURE__ */ r(le, {}) : N === "nivaro_files" && F ? /* @__PURE__ */ r("div", { className: "mt-1", children: /* @__PURE__ */ r(
|
|
237
|
+
al,
|
|
234
238
|
{
|
|
235
239
|
relation: F,
|
|
236
240
|
parentId: d,
|
|
237
241
|
allRelations: [],
|
|
238
242
|
disabled: !0
|
|
239
243
|
}
|
|
240
|
-
) }) : /* @__PURE__ */
|
|
244
|
+
) }) : /* @__PURE__ */ r("span", { className: "flex flex-wrap gap-x-1.5 gap-y-0.5", children: (g ?? []).map(({ id: v, collection: w }, q) => /* @__PURE__ */ f(
|
|
241
245
|
"span",
|
|
242
246
|
{
|
|
243
247
|
className: "inline-flex items-center whitespace-nowrap",
|
|
244
248
|
children: [
|
|
245
|
-
/* @__PURE__ */
|
|
246
|
-
q < R.length - 1 && /* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ r(tt, { collection: w ?? N, id: v }),
|
|
250
|
+
q < R.length - 1 && /* @__PURE__ */ r("span", { className: "text-slate-300 dark:text-slate-600", children: "," })
|
|
247
251
|
]
|
|
248
252
|
},
|
|
249
253
|
`${w ?? N}:${v}`
|
|
250
254
|
)) });
|
|
251
255
|
}
|
|
252
|
-
function
|
|
256
|
+
function $l({
|
|
253
257
|
collection: a,
|
|
254
258
|
fkField: m,
|
|
255
|
-
parentId:
|
|
259
|
+
parentId: y,
|
|
256
260
|
layoutId: d,
|
|
257
261
|
presets: O,
|
|
258
262
|
defaultPreset: S,
|
|
259
263
|
onCount: F
|
|
260
264
|
}) {
|
|
261
|
-
const W = De(),
|
|
265
|
+
const W = De(), k = xt(), h = (O ?? []).filter((t) => t && Array.isArray(t.columns)), [A, M] = X(
|
|
262
266
|
() => {
|
|
263
267
|
var t;
|
|
264
|
-
return h.length >= 2 ? ((t = h.find((
|
|
268
|
+
return h.length >= 2 ? ((t = h.find((s) => s.name === S)) == null ? void 0 : t.name) ?? h[0].name : "__all__";
|
|
265
269
|
}
|
|
266
|
-
), { data: I } =
|
|
270
|
+
), { data: I } = V({
|
|
267
271
|
queryKey: ["cbv-collection-meta", a],
|
|
268
|
-
queryFn: () => W.request(
|
|
272
|
+
queryFn: () => W.request(Q(`/collections/${a}`)).then((t) => t.data),
|
|
269
273
|
staleTime: 10 * 6e4,
|
|
270
274
|
retry: !1
|
|
271
|
-
}),
|
|
272
|
-
var
|
|
273
|
-
return ((
|
|
275
|
+
}), _ = (t) => {
|
|
276
|
+
var s;
|
|
277
|
+
return ((s = ((I == null ? void 0 : I.relations) ?? []).find(
|
|
274
278
|
(o) => o.many_collection === a && o.many_field === t && o.one_collection
|
|
275
|
-
)) == null ? void 0 :
|
|
276
|
-
}, { data: x } =
|
|
279
|
+
)) == null ? void 0 : s.one_collection) ?? null;
|
|
280
|
+
}, { data: x } = V({
|
|
277
281
|
queryKey: ["rrv-cols", a, d ?? null],
|
|
278
282
|
queryFn: () => W.request(
|
|
279
|
-
|
|
283
|
+
Q(`/field-config/${a}`, d ? { layout_id: d } : {})
|
|
280
284
|
).then((t) => ({
|
|
281
285
|
// Lines carry their own number — sort by it and show it first.
|
|
282
|
-
lineNo: (t.data ?? []).some((
|
|
286
|
+
lineNo: (t.data ?? []).some((s) => s.field === "line_number"),
|
|
283
287
|
cols: (t.data ?? []).filter(
|
|
284
|
-
(
|
|
288
|
+
(s) => !s.hidden && !s.field.startsWith("__") && (!s.field.includes(".") || s.interface === "relation-path") && s.field !== m && ((d ? s.layout_assigned : !0) ?? !0) && (s.interface === "relation-path" || [
|
|
285
289
|
"string",
|
|
286
290
|
"text",
|
|
287
291
|
"integer",
|
|
@@ -292,33 +296,33 @@ function bl({
|
|
|
292
296
|
"datetime",
|
|
293
297
|
"timestamp",
|
|
294
298
|
"uuid"
|
|
295
|
-
].includes(
|
|
296
|
-
).filter((
|
|
299
|
+
].includes(s.type ?? ""))
|
|
300
|
+
).filter((s, o, p) => p.findIndex((T) => T.field === s.field) === o)
|
|
297
301
|
})),
|
|
298
302
|
staleTime: 5 * 6e4,
|
|
299
303
|
retry: !1
|
|
300
|
-
}),
|
|
301
|
-
if (!N) return
|
|
302
|
-
const t = new Set(N.columns),
|
|
303
|
-
return
|
|
304
|
-
}, [
|
|
304
|
+
}), g = (x == null ? void 0 : x.cols) ?? [], R = !!(x != null && x.lineNo), N = A !== "__all__" ? h.find((t) => t.name === A) : null, C = xe(() => {
|
|
305
|
+
if (!N) return g;
|
|
306
|
+
const t = new Set(N.columns), s = g.filter((o) => t.has(o.field));
|
|
307
|
+
return s.length > 0 ? s : g;
|
|
308
|
+
}, [g, N]), [j, v] = X(""), [w, q] = X(1), [ie, H] = X({}), Z = Ht(ie, 350), Le = xe(() => {
|
|
305
309
|
const t = [
|
|
306
|
-
{ path: [m], op: "_eq", value:
|
|
310
|
+
{ path: [m], op: "_eq", value: y }
|
|
307
311
|
];
|
|
308
|
-
for (const [
|
|
312
|
+
for (const [s, o] of Object.entries(Z)) {
|
|
309
313
|
if (!(o != null && o.value.trim())) continue;
|
|
310
314
|
const p = o.value.trim(), T = Number(p), E = o.op === "_contains" ? p : p === "true" || p === "false" ? p === "true" : Number.isNaN(T) ? p : T;
|
|
311
|
-
t.push({ path: [
|
|
315
|
+
t.push({ path: [s], op: o.op, value: E });
|
|
312
316
|
}
|
|
313
317
|
return JSON.stringify(t);
|
|
314
|
-
}, [
|
|
315
|
-
data:
|
|
316
|
-
isLoading:
|
|
318
|
+
}, [Z, m, y]), u = 25, {
|
|
319
|
+
data: B,
|
|
320
|
+
isLoading: me,
|
|
317
321
|
isFetching: Ee
|
|
318
|
-
} =
|
|
319
|
-
queryKey: ["rrv-rows", a, m,
|
|
322
|
+
} = V({
|
|
323
|
+
queryKey: ["rrv-rows", a, m, y, j, R, w, Le],
|
|
320
324
|
queryFn: () => W.request(
|
|
321
|
-
|
|
325
|
+
Q(`/items/${a}`, {
|
|
322
326
|
limit: u,
|
|
323
327
|
page: w,
|
|
324
328
|
...j ? { sort: j } : R ? { sort: "line_number" } : {},
|
|
@@ -328,103 +332,103 @@ function bl({
|
|
|
328
332
|
placeholderData: (t) => t,
|
|
329
333
|
staleTime: 3e4,
|
|
330
334
|
retry: !1
|
|
331
|
-
}), D = (
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
}, [
|
|
335
|
-
const
|
|
335
|
+
}), D = (B == null ? void 0 : B.data) ?? [], ee = (B == null ? void 0 : B.total) ?? D.length, U = Object.values(Z).some((t) => !!(t != null && t.value.trim()));
|
|
336
|
+
ve(() => {
|
|
337
|
+
B && !U && (F == null || F(ee));
|
|
338
|
+
}, [B, U, ee, F]);
|
|
339
|
+
const ue = C.filter((t) => t.field.includes(".")), fe = D.map((t) => String(t.id)), { data: Y } = V({
|
|
336
340
|
queryKey: [
|
|
337
341
|
"rrv-resolve-paths",
|
|
338
342
|
a,
|
|
339
|
-
|
|
340
|
-
|
|
343
|
+
ue.map((t) => t.field).join(","),
|
|
344
|
+
fe.join(",")
|
|
341
345
|
],
|
|
342
346
|
queryFn: () => W.request(
|
|
343
|
-
|
|
344
|
-
ids:
|
|
345
|
-
paths:
|
|
347
|
+
Q(`/items/${a}/resolve-paths`, {
|
|
348
|
+
ids: fe.join(","),
|
|
349
|
+
paths: ue.map((t) => t.field).join(",")
|
|
346
350
|
})
|
|
347
351
|
).then((t) => t.data ?? { rows: {}, targets: {} }).catch(() => ({ rows: {}, targets: {} })),
|
|
348
|
-
enabled:
|
|
352
|
+
enabled: ue.length > 0 && fe.length > 0,
|
|
349
353
|
staleTime: 3e4
|
|
350
|
-
}), L = R && D.some((t) => t.line_number != null),
|
|
354
|
+
}), L = R && D.some((t) => t.line_number != null), _e = Math.max(1, Math.ceil(ee / u)), se = (t, s, o) => {
|
|
351
355
|
q(1), H((p) => {
|
|
352
356
|
const T = { ...p };
|
|
353
|
-
return o ? T[t] = { op:
|
|
357
|
+
return o ? T[t] = { op: s, value: o } : delete T[t], T;
|
|
354
358
|
});
|
|
355
|
-
},
|
|
356
|
-
q(1), v((
|
|
359
|
+
}, He = (t) => {
|
|
360
|
+
q(1), v((s) => s === t ? `-${t}` : s === `-${t}` ? "" : t);
|
|
357
361
|
};
|
|
358
|
-
if (
|
|
359
|
-
return /* @__PURE__ */
|
|
362
|
+
if (me)
|
|
363
|
+
return /* @__PURE__ */ r("div", { className: "space-y-1.5 py-2", children: [0, 1, 2].map((t) => /* @__PURE__ */ r(
|
|
360
364
|
"div",
|
|
361
365
|
{
|
|
362
366
|
className: "h-6 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]"
|
|
363
367
|
},
|
|
364
368
|
t
|
|
365
369
|
)) });
|
|
366
|
-
if (D.length === 0 && Object.keys(
|
|
367
|
-
return /* @__PURE__ */
|
|
368
|
-
const
|
|
370
|
+
if (D.length === 0 && Object.keys(Z).length === 0)
|
|
371
|
+
return /* @__PURE__ */ r("p", { className: "py-3 text-[12px] text-slate-400", children: "No records" });
|
|
372
|
+
const Be = (t, s) => {
|
|
369
373
|
var E, re;
|
|
370
|
-
if (
|
|
371
|
-
const ne = (E = Y == null ? void 0 : Y.rows[String(t.id)]) == null ? void 0 : E[
|
|
374
|
+
if (s.field.includes(".")) {
|
|
375
|
+
const ne = (E = Y == null ? void 0 : Y.rows[String(t.id)]) == null ? void 0 : E[s.field];
|
|
372
376
|
if (!Y)
|
|
373
|
-
return /* @__PURE__ */
|
|
374
|
-
if (!ne || ne.value === "") return /* @__PURE__ */
|
|
375
|
-
const Ke = Y.targets[
|
|
376
|
-
return
|
|
377
|
+
return /* @__PURE__ */ r("span", { className: "inline-block h-3 w-14 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" });
|
|
378
|
+
if (!ne || ne.value === "") return /* @__PURE__ */ r(le, {});
|
|
379
|
+
const Ke = Y.targets[s.field], $e = (re = ne.ids) == null ? void 0 : re[0];
|
|
380
|
+
return k && Ke && $e ? /* @__PURE__ */ r(
|
|
377
381
|
"button",
|
|
378
382
|
{
|
|
379
383
|
type: "button",
|
|
380
|
-
onClick: (
|
|
381
|
-
|
|
384
|
+
onClick: (Ge) => {
|
|
385
|
+
Ge.stopPropagation(), k.open({ collection: Ke, itemId: String($e) });
|
|
382
386
|
},
|
|
383
387
|
className: "text-left underline decoration-slate-300 underline-offset-2 hover:text-[#007a99] dark:decoration-slate-600 dark:hover:text-nvr-cyan",
|
|
384
388
|
children: ne.value
|
|
385
389
|
}
|
|
386
390
|
) : ne.value;
|
|
387
391
|
}
|
|
388
|
-
const o = t[
|
|
389
|
-
if (
|
|
390
|
-
if (o == null || o === "") return /* @__PURE__ */
|
|
391
|
-
const p =
|
|
392
|
+
const o = t[s.field];
|
|
393
|
+
if (s.type === "boolean" && o == null) return /* @__PURE__ */ r(Ve, { value: !1 });
|
|
394
|
+
if (o == null || o === "") return /* @__PURE__ */ r(le, {});
|
|
395
|
+
const p = _(s.field);
|
|
392
396
|
if (p === "nivaro_users")
|
|
393
|
-
return /* @__PURE__ */
|
|
394
|
-
if (p) return /* @__PURE__ */
|
|
395
|
-
if (
|
|
396
|
-
if (
|
|
397
|
-
if (
|
|
398
|
-
if (
|
|
397
|
+
return /* @__PURE__ */ r("span", { className: "inline-block", children: /* @__PURE__ */ r(vt, { userId: String(o), size: "compact" }) });
|
|
398
|
+
if (p) return /* @__PURE__ */ r(tt, { collection: p, id: o });
|
|
399
|
+
if (s.type === "boolean") return /* @__PURE__ */ r(Ve, { value: o });
|
|
400
|
+
if (s.type === "decimal" || s.type === "float") return et(o);
|
|
401
|
+
if (s.type === "integer") return Ue(o);
|
|
402
|
+
if (s.type === "date" || s.type === "datetime" || s.type === "timestamp") return _t(o);
|
|
399
403
|
const T = String(o);
|
|
400
404
|
return T.length > 48 ? `${T.slice(0, 48)}…` : T;
|
|
401
|
-
},
|
|
402
|
-
const
|
|
403
|
-
if (!
|
|
404
|
-
if (typeof
|
|
405
|
+
}, de = (t) => ["decimal", "float", "integer"].includes(t.type ?? "") && !_(t.field) && !t.field.includes("."), Pe = (t) => {
|
|
406
|
+
const s = t.options;
|
|
407
|
+
if (!s) return {};
|
|
408
|
+
if (typeof s == "string")
|
|
405
409
|
try {
|
|
406
|
-
return JSON.parse(
|
|
410
|
+
return JSON.parse(s);
|
|
407
411
|
} catch {
|
|
408
412
|
return {};
|
|
409
413
|
}
|
|
410
|
-
return
|
|
411
|
-
},
|
|
412
|
-
const
|
|
413
|
-
return typeof
|
|
414
|
-
}, Me = C.some((t) =>
|
|
415
|
-
const
|
|
416
|
-
if (!
|
|
414
|
+
return s;
|
|
415
|
+
}, ke = (t) => {
|
|
416
|
+
const s = Pe(t).aggregate;
|
|
417
|
+
return typeof s == "string" && ["sum", "avg", "min", "max", "count"].includes(s) ? s : null;
|
|
418
|
+
}, Me = C.some((t) => ke(t)), Ne = (t) => {
|
|
419
|
+
const s = ke(t);
|
|
420
|
+
if (!s) return null;
|
|
417
421
|
const o = D.map((E) => Number(E[t.field])).filter((E) => !Number.isNaN(E));
|
|
418
422
|
let p = null;
|
|
419
|
-
if (
|
|
423
|
+
if (s === "count" ? p = D.length : o.length > 0 && (s === "sum" ? p = o.reduce((E, re) => E + re, 0) : s === "avg" ? p = o.reduce((E, re) => E + re, 0) / o.length : s === "min" ? p = Math.min(...o) : s === "max" && (p = Math.max(...o))), p === null) return "—";
|
|
420
424
|
const T = Pe(t).format;
|
|
421
|
-
return
|
|
422
|
-
},
|
|
425
|
+
return s === "count" || T === "int" ? Ue(Math.round(p)) : T === "currency" || t.type === "decimal" || t.type === "float" ? et(p) : s === "avg" ? p.toFixed(2) : Ue(p);
|
|
426
|
+
}, we = (t) => !_(t.field) && !t.field.includes("."), je = (t) => _(t.field) || t.field.includes(".") ? null : t.type === "boolean" ? "bool" : ["integer", "decimal", "float"].includes(t.type ?? "") ? "num" : ["string", "text"].includes(t.type ?? "") ? "text" : null, Se = C.some((t) => je(t) != null);
|
|
423
427
|
return /* @__PURE__ */ f("div", { children: [
|
|
424
|
-
h.length >= 2 && /* @__PURE__ */
|
|
428
|
+
h.length >= 2 && /* @__PURE__ */ r("div", { className: "mb-1.5 flex flex-wrap items-center gap-1", "data-read-presets": !0, children: [
|
|
425
429
|
{ name: "__all__", label: "All" },
|
|
426
430
|
...h.map((t) => ({ name: t.name, label: t.name }))
|
|
427
|
-
].map((t) => /* @__PURE__ */
|
|
431
|
+
].map((t) => /* @__PURE__ */ r(
|
|
428
432
|
"button",
|
|
429
433
|
{
|
|
430
434
|
type: "button",
|
|
@@ -435,51 +439,51 @@ function bl({
|
|
|
435
439
|
},
|
|
436
440
|
t.name
|
|
437
441
|
)) }),
|
|
438
|
-
/* @__PURE__ */
|
|
442
|
+
/* @__PURE__ */ r(
|
|
439
443
|
"div",
|
|
440
444
|
{
|
|
441
|
-
className: `overflow-x-auto rounded-md border border-slate-200 dark:border-slate-700 ${Ee && !
|
|
445
|
+
className: `overflow-x-auto rounded-md border border-slate-200 dark:border-slate-700 ${Ee && !me ? "opacity-70" : ""}`,
|
|
442
446
|
children: /* @__PURE__ */ f("table", { className: "w-full", style: { fontVariantNumeric: "tabular-nums" }, children: [
|
|
443
447
|
/* @__PURE__ */ f("thead", { children: [
|
|
444
448
|
/* @__PURE__ */ f("tr", { className: "border-b border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800", children: [
|
|
445
|
-
L && /* @__PURE__ */
|
|
449
|
+
L && /* @__PURE__ */ r("th", { className: "h-7 w-8 px-2 text-right text-[9.5px] font-bold uppercase tracking-wider text-slate-400", children: "#" }),
|
|
446
450
|
C.map((t) => {
|
|
447
|
-
const
|
|
451
|
+
const s = j === t.field || j === `-${t.field}`;
|
|
448
452
|
return /* @__PURE__ */ f(
|
|
449
453
|
"th",
|
|
450
454
|
{
|
|
451
|
-
onClick: () =>
|
|
452
|
-
className: `h-7 select-none whitespace-nowrap px-2.5 text-[9.5px] font-bold uppercase tracking-wider text-slate-500 dark:text-slate-400 ${
|
|
455
|
+
onClick: () => we(t) && He(t.field),
|
|
456
|
+
className: `h-7 select-none whitespace-nowrap px-2.5 text-[9.5px] font-bold uppercase tracking-wider text-slate-500 dark:text-slate-400 ${de(t) ? "text-right" : "text-left"} ${we(t) ? "cursor-pointer hover:text-slate-700 dark:hover:text-slate-200" : ""}`,
|
|
453
457
|
children: [
|
|
454
|
-
t.label ||
|
|
455
|
-
|
|
458
|
+
t.label || Ze(t.field),
|
|
459
|
+
we(t) && /* @__PURE__ */ r("span", { className: s ? "ml-0.5 text-[#00a5cc]" : "ml-0.5 text-slate-300", children: s ? j.startsWith("-") ? "▼" : "▲" : "⇅" })
|
|
456
460
|
]
|
|
457
461
|
},
|
|
458
462
|
t.field
|
|
459
463
|
);
|
|
460
464
|
})
|
|
461
465
|
] }),
|
|
462
|
-
|
|
463
|
-
L && /* @__PURE__ */
|
|
466
|
+
Se && /* @__PURE__ */ f("tr", { className: "border-b border-slate-200 bg-slate-50 dark:border-slate-700 dark:bg-slate-800", children: [
|
|
467
|
+
L && /* @__PURE__ */ r("th", { className: "px-1.5 py-1" }),
|
|
464
468
|
C.map((t) => {
|
|
465
|
-
const
|
|
469
|
+
const s = je(t), o = ie[t.field];
|
|
466
470
|
return /* @__PURE__ */ f("th", { className: "px-1.5 py-1 font-normal", children: [
|
|
467
|
-
|
|
471
|
+
s === "text" && /* @__PURE__ */ r(
|
|
468
472
|
"input",
|
|
469
473
|
{
|
|
470
474
|
value: (o == null ? void 0 : o.value) ?? "",
|
|
471
|
-
onChange: (p) =>
|
|
475
|
+
onChange: (p) => se(t.field, "_contains", p.target.value),
|
|
472
476
|
placeholder: "Filter…",
|
|
473
477
|
"aria-label": `Filter ${t.field}`,
|
|
474
478
|
className: "h-6 w-full min-w-[56px] rounded border border-slate-200 bg-white px-1.5 text-[10.5px] font-normal normal-case tracking-normal outline-none focus:border-nvr-cyan/50 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100"
|
|
475
479
|
}
|
|
476
480
|
),
|
|
477
|
-
|
|
478
|
-
/* @__PURE__ */
|
|
479
|
-
|
|
481
|
+
s === "num" && /* @__PURE__ */ f("span", { className: "flex items-center gap-0.5", children: [
|
|
482
|
+
/* @__PURE__ */ r(
|
|
483
|
+
bt,
|
|
480
484
|
{
|
|
481
485
|
value: (o == null ? void 0 : o.op) ?? "_eq",
|
|
482
|
-
onChange: (p) =>
|
|
486
|
+
onChange: (p) => se(t.field, p, (o == null ? void 0 : o.value) ?? ""),
|
|
483
487
|
options: [
|
|
484
488
|
{ value: "_eq", label: "=" },
|
|
485
489
|
{ value: "_gte", label: "≥" },
|
|
@@ -488,22 +492,22 @@ function bl({
|
|
|
488
492
|
ariaLabel: `Filter op ${t.field}`
|
|
489
493
|
}
|
|
490
494
|
),
|
|
491
|
-
/* @__PURE__ */
|
|
495
|
+
/* @__PURE__ */ r(
|
|
492
496
|
"input",
|
|
493
497
|
{
|
|
494
498
|
type: "number",
|
|
495
499
|
value: (o == null ? void 0 : o.value) ?? "",
|
|
496
|
-
onChange: (p) =>
|
|
500
|
+
onChange: (p) => se(t.field, (o == null ? void 0 : o.op) ?? "_eq", p.target.value),
|
|
497
501
|
"aria-label": `Filter ${t.field}`,
|
|
498
502
|
className: "h-6 w-full min-w-[48px] rounded border border-slate-200 bg-white px-1 text-[10.5px] font-normal outline-none focus:border-nvr-cyan/50 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100"
|
|
499
503
|
}
|
|
500
504
|
)
|
|
501
505
|
] }),
|
|
502
|
-
|
|
503
|
-
|
|
506
|
+
s === "bool" && /* @__PURE__ */ r(
|
|
507
|
+
bt,
|
|
504
508
|
{
|
|
505
509
|
value: (o == null ? void 0 : o.value) ?? "",
|
|
506
|
-
onChange: (p) =>
|
|
510
|
+
onChange: (p) => se(t.field, "_eq", p),
|
|
507
511
|
options: [
|
|
508
512
|
{ value: "", label: "All" },
|
|
509
513
|
{ value: "true", label: "Yes" },
|
|
@@ -518,7 +522,7 @@ function bl({
|
|
|
518
522
|
] })
|
|
519
523
|
] }),
|
|
520
524
|
/* @__PURE__ */ f("tbody", { children: [
|
|
521
|
-
D.length === 0 && /* @__PURE__ */
|
|
525
|
+
D.length === 0 && /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r(
|
|
522
526
|
"td",
|
|
523
527
|
{
|
|
524
528
|
colSpan: C.length + (L ? 1 : 0),
|
|
@@ -529,39 +533,39 @@ function bl({
|
|
|
529
533
|
D.map((t) => /* @__PURE__ */ f(
|
|
530
534
|
"tr",
|
|
531
535
|
{
|
|
532
|
-
onClick:
|
|
533
|
-
className: `border-b border-slate-100 last:border-0 dark:border-slate-800 ${
|
|
536
|
+
onClick: k ? () => k.open({ collection: a, itemId: String(t.id) }) : void 0,
|
|
537
|
+
className: `border-b border-slate-100 last:border-0 dark:border-slate-800 ${k ? "cursor-pointer hover:bg-nvr-cyan/5 dark:hover:bg-nvr-cyan/10" : ""}`,
|
|
534
538
|
children: [
|
|
535
|
-
L && /* @__PURE__ */
|
|
536
|
-
C.map((
|
|
539
|
+
L && /* @__PURE__ */ r("td", { className: "px-2 py-1.5 text-right text-[11px] tabular-nums text-slate-400", children: t.line_number == null ? "" : String(t.line_number) }),
|
|
540
|
+
C.map((s) => /* @__PURE__ */ r(
|
|
537
541
|
"td",
|
|
538
542
|
{
|
|
539
|
-
className: `whitespace-nowrap px-2.5 py-1.5 text-[12px] text-slate-700 dark:text-slate-200 ${
|
|
540
|
-
children:
|
|
543
|
+
className: `whitespace-nowrap px-2.5 py-1.5 text-[12px] text-slate-700 dark:text-slate-200 ${de(s) ? "text-right" : ""}`,
|
|
544
|
+
children: Be(t, s)
|
|
541
545
|
},
|
|
542
|
-
|
|
546
|
+
s.field
|
|
543
547
|
))
|
|
544
548
|
]
|
|
545
549
|
},
|
|
546
550
|
String(t.id)
|
|
547
551
|
))
|
|
548
552
|
] }),
|
|
549
|
-
Me && D.length > 0 && /* @__PURE__ */
|
|
553
|
+
Me && D.length > 0 && /* @__PURE__ */ r("tfoot", { children: /* @__PURE__ */ f(
|
|
550
554
|
"tr",
|
|
551
555
|
{
|
|
552
556
|
"data-read-grid-footer": !0,
|
|
553
557
|
className: "border-t border-slate-200 bg-slate-50 text-[11px] font-medium text-slate-600 dark:border-slate-700 dark:bg-slate-800/60 dark:text-slate-300",
|
|
554
558
|
children: [
|
|
555
|
-
L && /* @__PURE__ */
|
|
559
|
+
L && /* @__PURE__ */ r("td", {}),
|
|
556
560
|
C.map((t) => {
|
|
557
|
-
const
|
|
558
|
-
return /* @__PURE__ */
|
|
561
|
+
const s = ke(t);
|
|
562
|
+
return /* @__PURE__ */ r(
|
|
559
563
|
"td",
|
|
560
564
|
{
|
|
561
|
-
className: `whitespace-nowrap px-2.5 py-1.5 ${
|
|
562
|
-
children:
|
|
563
|
-
/* @__PURE__ */
|
|
564
|
-
/* @__PURE__ */
|
|
565
|
+
className: `whitespace-nowrap px-2.5 py-1.5 ${de(t) ? "text-right" : ""}`,
|
|
566
|
+
children: s && /* @__PURE__ */ f(ce, { children: [
|
|
567
|
+
/* @__PURE__ */ r("span", { className: "mr-1 font-mono text-[10px] text-slate-400", children: s.toUpperCase() }),
|
|
568
|
+
/* @__PURE__ */ r("span", { className: "tabular-nums", children: Ne(t) })
|
|
565
569
|
] })
|
|
566
570
|
},
|
|
567
571
|
t.field
|
|
@@ -573,17 +577,17 @@ function bl({
|
|
|
573
577
|
] })
|
|
574
578
|
}
|
|
575
579
|
),
|
|
576
|
-
|
|
580
|
+
ee > u && /* @__PURE__ */ f("div", { className: "mt-1.5 flex items-center justify-between", children: [
|
|
577
581
|
/* @__PURE__ */ f("p", { className: "text-[11px] tabular-nums text-slate-400", children: [
|
|
578
582
|
((w - 1) * u + 1).toLocaleString("en-US"),
|
|
579
583
|
"–",
|
|
580
|
-
Math.min(w * u,
|
|
584
|
+
Math.min(w * u, ee).toLocaleString("en-US"),
|
|
581
585
|
" of",
|
|
582
586
|
" ",
|
|
583
|
-
|
|
587
|
+
ee.toLocaleString("en-US")
|
|
584
588
|
] }),
|
|
585
589
|
/* @__PURE__ */ f("span", { className: "flex items-center gap-0.5", children: [
|
|
586
|
-
/* @__PURE__ */
|
|
590
|
+
/* @__PURE__ */ r(
|
|
587
591
|
"button",
|
|
588
592
|
{
|
|
589
593
|
type: "button",
|
|
@@ -596,13 +600,13 @@ function bl({
|
|
|
596
600
|
/* @__PURE__ */ f("span", { className: "min-w-[48px] text-center text-[11px] tabular-nums text-slate-500", children: [
|
|
597
601
|
w,
|
|
598
602
|
" / ",
|
|
599
|
-
|
|
603
|
+
_e.toLocaleString("en-US")
|
|
600
604
|
] }),
|
|
601
|
-
/* @__PURE__ */
|
|
605
|
+
/* @__PURE__ */ r(
|
|
602
606
|
"button",
|
|
603
607
|
{
|
|
604
608
|
type: "button",
|
|
605
|
-
disabled: w >=
|
|
609
|
+
disabled: w >= _e,
|
|
606
610
|
onClick: () => q((t) => t + 1),
|
|
607
611
|
className: "h-6 rounded px-2 text-[11px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
|
|
608
612
|
children: "Next →"
|
|
@@ -612,45 +616,45 @@ function bl({
|
|
|
612
616
|
] })
|
|
613
617
|
] });
|
|
614
618
|
}
|
|
615
|
-
function
|
|
619
|
+
function yt({
|
|
616
620
|
collection: a,
|
|
617
621
|
itemId: m,
|
|
618
|
-
layoutData:
|
|
622
|
+
layoutData: y,
|
|
619
623
|
design: d,
|
|
620
624
|
flush: O,
|
|
621
625
|
renderSlot: S,
|
|
622
626
|
integrityMarks: F,
|
|
623
627
|
renderGrid: W,
|
|
624
|
-
onEditSection:
|
|
628
|
+
onEditSection: k,
|
|
625
629
|
gridCounts: h
|
|
626
630
|
}) {
|
|
627
|
-
var
|
|
628
|
-
const A = De(), M =
|
|
631
|
+
var dt;
|
|
632
|
+
const A = De(), M = dl(), I = d ? d.record ?? {} : null, _ = !!(d != null && d.context.showHidden), x = d ? String(((dt = d.record) == null ? void 0 : dt.id) ?? "") : m ?? "", g = xe(
|
|
629
633
|
() => d ? {
|
|
630
634
|
...d.layout,
|
|
631
635
|
layout: d.layout.layout ?? { id: 0, name: "" }
|
|
632
|
-
} :
|
|
633
|
-
[d,
|
|
636
|
+
} : y,
|
|
637
|
+
[d, y]
|
|
634
638
|
), R = (e) => ({
|
|
635
639
|
kind: Re(e.field) ? "slot" : "field",
|
|
636
640
|
field: e.field,
|
|
637
641
|
group_key: e.group_key ?? null
|
|
638
|
-
}), N = (e,
|
|
642
|
+
}), N = (e, l, i = !1) => d ? /* @__PURE__ */ r(fl, { target: e, children: i ? /* @__PURE__ */ r("div", { "data-design-hidden": !0, className: "opacity-40", children: l }) : l }) : l, C = xe(
|
|
639
643
|
() => [
|
|
640
644
|
...new Set(
|
|
641
|
-
(d ? [] : (
|
|
645
|
+
(d ? [] : (g == null ? void 0 : g.assignments) ?? []).map((e) => e.field).filter((e) => e && !e.startsWith("__") && !e.includes("."))
|
|
642
646
|
)
|
|
643
647
|
].sort(),
|
|
644
|
-
[
|
|
645
|
-
), { data: j } =
|
|
646
|
-
const
|
|
647
|
-
if (!
|
|
648
|
-
const
|
|
649
|
-
return
|
|
650
|
-
|
|
648
|
+
[g, d]
|
|
649
|
+
), { data: j } = il(a, x, C), v = (e) => {
|
|
650
|
+
const l = j == null ? void 0 : j[e];
|
|
651
|
+
if (!l) return null;
|
|
652
|
+
const i = l.via !== "user";
|
|
653
|
+
return l.caller && l.activity_id ? /* @__PURE__ */ r(
|
|
654
|
+
nl,
|
|
651
655
|
{
|
|
652
|
-
activityId:
|
|
653
|
-
callerName:
|
|
656
|
+
activityId: l.activity_id,
|
|
657
|
+
callerName: l.caller.name,
|
|
654
658
|
collection: a,
|
|
655
659
|
itemId: x,
|
|
656
660
|
children: /* @__PURE__ */ f(
|
|
@@ -658,202 +662,220 @@ function ht({
|
|
|
658
662
|
{
|
|
659
663
|
type: "button",
|
|
660
664
|
"data-field-touch": e,
|
|
661
|
-
"data-field-touch-caller":
|
|
662
|
-
"data-tip": `Changed ${Ce(
|
|
663
|
-
"aria-label": `Changed ${Ce(
|
|
665
|
+
"data-field-touch-caller": l.caller.key,
|
|
666
|
+
"data-tip": `Changed ${Ce(l.at)} by ${l.caller.name} (through the API) — click for the request`,
|
|
667
|
+
"aria-label": `Changed ${Ce(l.at)} by ${l.caller.name} through the API`,
|
|
664
668
|
className: "ml-1 inline-flex items-center gap-1 rounded-full bg-amber-50 px-1.5 align-middle text-[9.5px] font-medium leading-4 text-amber-800 hover:bg-amber-100 dark:bg-amber-400/10 dark:text-amber-300 dark:hover:bg-amber-400/20",
|
|
665
669
|
children: [
|
|
666
|
-
/* @__PURE__ */
|
|
667
|
-
|
|
670
|
+
/* @__PURE__ */ r("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400", "aria-hidden": !0 }),
|
|
671
|
+
l.caller.name,
|
|
668
672
|
" · ",
|
|
669
|
-
Ce(
|
|
673
|
+
Ce(l.at)
|
|
670
674
|
]
|
|
671
675
|
}
|
|
672
676
|
)
|
|
673
677
|
}
|
|
674
|
-
) : /* @__PURE__ */
|
|
678
|
+
) : /* @__PURE__ */ r(
|
|
675
679
|
"span",
|
|
676
680
|
{
|
|
677
681
|
"data-field-touch": e,
|
|
678
|
-
"data-tip": `Changed ${Ce(
|
|
682
|
+
"data-tip": `Changed ${Ce(l.at)} by ${l.who}${i ? ` · ${l.via}` : ""}`,
|
|
679
683
|
role: "img",
|
|
680
|
-
"aria-label": `Changed ${Ce(
|
|
681
|
-
className: `ml-1 inline-block h-1.5 w-1.5 rounded-full align-middle ${
|
|
684
|
+
"aria-label": `Changed ${Ce(l.at)} by ${l.who}`,
|
|
685
|
+
className: `ml-1 inline-block h-1.5 w-1.5 rounded-full align-middle ${i ? "bg-amber-400" : "bg-slate-300 dark:bg-slate-600"}`
|
|
682
686
|
}
|
|
683
687
|
);
|
|
684
|
-
}, { data: w } =
|
|
685
|
-
() => F && (w != null && w.enabled) ?
|
|
688
|
+
}, { data: w } = bl(a, x, !!F && !d), q = xe(
|
|
689
|
+
() => F && (w != null && w.enabled) ? yl(w.findings) : null,
|
|
686
690
|
[F, w]
|
|
687
|
-
),
|
|
688
|
-
const
|
|
689
|
-
if (!
|
|
690
|
-
const
|
|
691
|
+
), ie = ({ field: e }) => {
|
|
692
|
+
const l = q == null ? void 0 : q.get(e);
|
|
693
|
+
if (!l || l.length === 0) return null;
|
|
694
|
+
const i = l.map((c) => c.message || c.rule).join(`
|
|
691
695
|
`);
|
|
692
|
-
return /* @__PURE__ */
|
|
696
|
+
return /* @__PURE__ */ r(
|
|
693
697
|
"span",
|
|
694
698
|
{
|
|
695
699
|
"data-integrity-mark": e,
|
|
696
|
-
"data-tip":
|
|
700
|
+
"data-tip": i,
|
|
697
701
|
role: "img",
|
|
698
|
-
"aria-label": `${
|
|
702
|
+
"aria-label": `${l.length} data integrity issue${l.length === 1 ? "" : "s"}: ${i}`,
|
|
699
703
|
className: "ml-1.5 inline-flex h-[14px] min-w-[14px] items-center justify-center rounded-full bg-amber-400/90 px-1 align-middle text-[9px] font-bold leading-none text-amber-950 dark:bg-amber-400 dark:text-amber-950",
|
|
700
|
-
children:
|
|
704
|
+
children: l.length > 1 ? l.length : "!"
|
|
701
705
|
}
|
|
702
706
|
);
|
|
703
|
-
}, { data: H } =
|
|
707
|
+
}, { data: H } = V({
|
|
704
708
|
queryKey: ["cbv-collection-meta", a],
|
|
705
709
|
queryFn: () => A.request(
|
|
706
|
-
|
|
710
|
+
Q(`/collections/${a}`)
|
|
707
711
|
).then((e) => e.data),
|
|
708
712
|
staleTime: 10 * 6e4,
|
|
709
713
|
retry: !1
|
|
710
|
-
}),
|
|
714
|
+
}), Z = Mt(), { data: Le } = V({
|
|
711
715
|
queryKey: ["rrv-record", a, x],
|
|
712
716
|
enabled: !d,
|
|
713
|
-
queryFn: () => A.request(
|
|
714
|
-
initialData: () =>
|
|
717
|
+
queryFn: () => A.request(Q(`/items/${a}/${x}`)).then((e) => e.data),
|
|
718
|
+
initialData: () => Z.getQueryData(["item", a, x]) ?? void 0,
|
|
715
719
|
initialDataUpdatedAt: () => {
|
|
716
720
|
var e;
|
|
717
|
-
return (e =
|
|
721
|
+
return (e = Z.getQueryState(["item", a, x])) == null ? void 0 : e.dataUpdatedAt;
|
|
718
722
|
},
|
|
719
723
|
staleTime: 3e4,
|
|
720
724
|
retry: !1
|
|
721
725
|
}), u = I ?? Le;
|
|
722
|
-
|
|
723
|
-
e.aspectsOnly || e.deleted || (
|
|
726
|
+
zt(a, d ? null : x, (e) => {
|
|
727
|
+
e.aspectsOnly || e.deleted || (Z.invalidateQueries({ queryKey: ["rrv-record", a, x] }), Z.invalidateQueries({ queryKey: ["field-touch", a, x] }));
|
|
724
728
|
});
|
|
725
|
-
const
|
|
726
|
-
|
|
727
|
-
const e =
|
|
728
|
-
if (
|
|
729
|
-
const
|
|
729
|
+
const B = Wt(null), [me, Ee] = X(() => /* @__PURE__ */ new Set());
|
|
730
|
+
ve(() => {
|
|
731
|
+
const e = B.current;
|
|
732
|
+
if (B.current = u ?? null, d || !e || !u || e === u) return;
|
|
733
|
+
const l = Object.keys(u).filter(
|
|
730
734
|
(c) => !c.startsWith("__") && JSON.stringify(e[c]) !== JSON.stringify(u[c])
|
|
731
735
|
);
|
|
732
|
-
if (
|
|
733
|
-
Ee(new Set(
|
|
734
|
-
const
|
|
735
|
-
return () => clearTimeout(
|
|
736
|
+
if (l.length === 0) return;
|
|
737
|
+
Ee(new Set(l));
|
|
738
|
+
const i = setTimeout(() => Ee(/* @__PURE__ */ new Set()), 2400);
|
|
739
|
+
return () => clearTimeout(i);
|
|
736
740
|
}, [u, d]);
|
|
737
|
-
const D = (e) =>
|
|
738
|
-
queryKey: ["rrv-field-config", a,
|
|
741
|
+
const D = (e) => me.has(e) ? " nvr-value-pulse-bg rounded-sm" : "", { data: ee } = V({
|
|
742
|
+
queryKey: ["rrv-field-config", a, g.layout.id],
|
|
739
743
|
enabled: !d,
|
|
740
744
|
queryFn: () => A.request(
|
|
741
|
-
|
|
745
|
+
Q(`/field-config/${a}`, { layout_id: g.layout.id })
|
|
742
746
|
).then((e) => e.data ?? []).catch(() => null),
|
|
743
747
|
staleTime: 5 * 6e4,
|
|
744
748
|
retry: !1
|
|
745
|
-
}),
|
|
746
|
-
() => new Map((
|
|
747
|
-
[
|
|
748
|
-
),
|
|
749
|
-
var
|
|
750
|
-
return ((
|
|
751
|
-
(
|
|
752
|
-
)) == null ? void 0 :
|
|
753
|
-
}, Y = (e) =>
|
|
754
|
-
(
|
|
749
|
+
}), U = xe(
|
|
750
|
+
() => new Map((ee ?? (H == null ? void 0 : H.fields) ?? []).map((e) => [e.field, e])),
|
|
751
|
+
[ee, H]
|
|
752
|
+
), ue = (H == null ? void 0 : H.relations) ?? [], fe = (e) => {
|
|
753
|
+
var l;
|
|
754
|
+
return ((l = ue.find(
|
|
755
|
+
(i) => i.many_collection === a && i.many_field === e && i.one_collection
|
|
756
|
+
)) == null ? void 0 : l.one_collection) ?? null;
|
|
757
|
+
}, Y = (e) => ue.find(
|
|
758
|
+
(l) => l.one_collection === a && (l.one_field === e || l.many_collection === e)
|
|
755
759
|
) ?? null, L = (e) => {
|
|
756
|
-
var
|
|
757
|
-
return !((e.is_visible === void 0 || e.is_visible) &&
|
|
758
|
-
},
|
|
759
|
-
(e) => (!e.field.startsWith("__") || Re(e.field)) && (
|
|
760
|
-
),
|
|
761
|
-
(e) => e.field.startsWith("__widget_") && e.widget_id != null && (
|
|
762
|
-
),
|
|
760
|
+
var l;
|
|
761
|
+
return !((e.is_visible === void 0 || e.is_visible) && ye(e.overrides).hidden !== !0 && !((l = U.get(e.field)) != null && l.hidden));
|
|
762
|
+
}, _e = g.assignments.filter(
|
|
763
|
+
(e) => (!e.field.startsWith("__") || Re(e.field)) && (_ || !L(e))
|
|
764
|
+
), se = g.assignments.filter(
|
|
765
|
+
(e) => e.field.startsWith("__widget_") && e.widget_id != null && (_ || e.is_visible === void 0 || !!e.is_visible)
|
|
766
|
+
), He = (e) => {
|
|
763
767
|
if (!e.input_bindings) return [];
|
|
764
768
|
try {
|
|
765
769
|
return JSON.parse(String(e.input_bindings));
|
|
766
770
|
} catch {
|
|
767
771
|
return [];
|
|
768
772
|
}
|
|
769
|
-
},
|
|
770
|
-
(e) => e.field.startsWith("__") && !e.field.startsWith("__widget_") && !Re(e.field) && (
|
|
771
|
-
).sort((e,
|
|
772
|
-
(
|
|
773
|
+
}, Be = S || d ? g.assignments.filter(
|
|
774
|
+
(e) => e.field.startsWith("__") && !e.field.startsWith("__widget_") && !Re(e.field) && (_ || e.is_visible === void 0 || !!e.is_visible)
|
|
775
|
+
).sort((e, l) => e.sort - l.sort) : [], de = ["__pipeline__", "__addendums__"], Pe = new Set(de), ke = (e) => (S == null ? void 0 : S(e.field, e)) ?? (d ? /* @__PURE__ */ r("div", { className: "rounded-xl border border-dashed border-slate-300 bg-white px-5 py-3 text-[12px] font-medium text-slate-500 dark:border-slate-600 dark:bg-slate-900/40 dark:text-slate-400", children: e.label_override || Ze(e.field.replace(/^_+|_+$/g, "")) }) : null), Me = (e, l = "trailing") => S || d ? Be.filter(
|
|
776
|
+
(i) => e === null ? i.group_key == null && l === "leading" === Pe.has(i.field) : i.group_key === e
|
|
773
777
|
).sort(
|
|
774
|
-
(
|
|
775
|
-
).map((
|
|
776
|
-
const
|
|
777
|
-
return
|
|
778
|
+
(i, c) => l === "leading" && e === null ? de.indexOf(i.field) - de.indexOf(c.field) : 0
|
|
779
|
+
).map((i) => ({ key: i.field, a: i, node: ke(i) })).filter((i) => i.node != null) : [], Ne = (e, l = "trailing") => {
|
|
780
|
+
const i = Me(e, l);
|
|
781
|
+
return i.length === 0 ? null : /* @__PURE__ */ r(
|
|
778
782
|
"div",
|
|
779
783
|
{
|
|
780
|
-
className:
|
|
781
|
-
"data-read-live-slots":
|
|
782
|
-
children:
|
|
784
|
+
className: l === "leading" ? "mb-4 space-y-4" : "mt-3 space-y-4",
|
|
785
|
+
"data-read-live-slots": l,
|
|
786
|
+
children: i.map((c) => /* @__PURE__ */ r("div", { children: N(
|
|
783
787
|
{ kind: "slot", field: c.a.field, group_key: c.a.group_key ?? null },
|
|
784
788
|
c.node,
|
|
785
789
|
L(c.a)
|
|
786
790
|
) }, c.key))
|
|
787
791
|
}
|
|
788
792
|
);
|
|
789
|
-
}, [
|
|
790
|
-
(e) => (
|
|
793
|
+
}, [we, je] = X({}), Se = (e) => _ || we[e] === !0, [t, s] = X({}), o = ht(
|
|
794
|
+
(e) => (l) => s((i) => i[e] === l ? i : { ...i, [e]: l }),
|
|
791
795
|
[]
|
|
792
|
-
), [p, T] =
|
|
793
|
-
(e) => (
|
|
796
|
+
), [p, T] = X({}), E = ht(
|
|
797
|
+
(e) => (l) => T((i) => i[e] === l ? i : { ...i, [e]: l }),
|
|
794
798
|
[]
|
|
795
799
|
), re = (e) => {
|
|
796
|
-
const
|
|
797
|
-
if (
|
|
798
|
-
const
|
|
799
|
-
return /* @__PURE__ */
|
|
800
|
+
const l = se.filter((c) => c.group_key === e).sort((c, b) => c.sort - b.sort);
|
|
801
|
+
if (l.length === 0) return null;
|
|
802
|
+
const i = l.some((c) => Se(c.field));
|
|
803
|
+
return /* @__PURE__ */ r("div", { className: i ? "mt-3 space-y-4" : "hidden", "data-read-widgets": !0, children: l.map((c) => /* @__PURE__ */ r("div", { hidden: !Se(c.field), children: N(
|
|
800
804
|
{ kind: "slot", field: c.field, group_key: c.group_key ?? null },
|
|
801
|
-
/* @__PURE__ */
|
|
802
|
-
|
|
805
|
+
/* @__PURE__ */ r(
|
|
806
|
+
xl,
|
|
803
807
|
{
|
|
804
808
|
widgetId: c.widget_id,
|
|
805
|
-
inputBindings:
|
|
809
|
+
inputBindings: He(c),
|
|
806
810
|
itemDraft: u ?? {},
|
|
807
811
|
itemCollection: a,
|
|
808
812
|
ready: !!u,
|
|
809
813
|
label: c.label_override ?? void 0,
|
|
810
814
|
defaultExpanded: c.default_expanded == null ? !0 : !!c.default_expanded,
|
|
811
|
-
onContentChange: (
|
|
812
|
-
(K) => K[c.field] ===
|
|
815
|
+
onContentChange: (b) => je(
|
|
816
|
+
(K) => K[c.field] === b ? K : { ...K, [c.field]: b }
|
|
813
817
|
)
|
|
814
818
|
}
|
|
815
819
|
),
|
|
816
820
|
L(c)
|
|
817
821
|
) }, c.field)) });
|
|
818
|
-
}, ne
|
|
819
|
-
|
|
820
|
-
|
|
822
|
+
}, [ne, Ke] = X(() => /* @__PURE__ */ new Set()), $e = _ || !u ? [] : ml({
|
|
823
|
+
groups: g.groups.filter(
|
|
824
|
+
(e) => e.type !== "container" && e.visibility_mode !== "new_only"
|
|
825
|
+
),
|
|
826
|
+
values: u,
|
|
827
|
+
fields: [...U.values()],
|
|
828
|
+
choices: gl([...U.values()]),
|
|
829
|
+
quiet: Yt(g.layout.conditions),
|
|
830
|
+
readable: (e) => ul(
|
|
831
|
+
g.assignments.filter((l) => l.group_key === e).map((l) => l.field),
|
|
832
|
+
u,
|
|
833
|
+
!!d
|
|
834
|
+
)
|
|
835
|
+
}), Ge = (e) => Ke((l) => {
|
|
836
|
+
const i = new Set(l);
|
|
837
|
+
return i.has(e) ? i.delete(e) : i.add(e), i;
|
|
838
|
+
}), lt = [...g.groups].sort((e, l) => e.sort - l.sort).filter((e) => _ || e.visibility_mode !== "new_only").filter(
|
|
839
|
+
(e) => _ || !u || ne.has(e.key) || rl(e.visible_when, u)
|
|
840
|
+
), [kt, Je] = X(() => /* @__PURE__ */ new Set()), pe = (e) => !e.is_collapsed || kt.has(e.key), Nt = (e) => Je((l) => {
|
|
841
|
+
const i = new Set(l);
|
|
842
|
+
return i.has(e) ? i.delete(e) : i.add(e), i;
|
|
821
843
|
}), Fe = (d == null ? void 0 : d.context.fold) ?? null, qe = (d == null ? void 0 : d.context.reveal) ?? null;
|
|
822
|
-
|
|
823
|
-
Fe &&
|
|
824
|
-
}, [Fe == null ? void 0 : Fe.seq]),
|
|
825
|
-
const e = qe ?
|
|
826
|
-
e &&
|
|
844
|
+
ve(() => {
|
|
845
|
+
Fe && Je(Fe.open ? new Set(g.groups.map((e) => e.key)) : /* @__PURE__ */ new Set());
|
|
846
|
+
}, [Fe == null ? void 0 : Fe.seq]), ve(() => {
|
|
847
|
+
const e = qe ? hl(qe.target) : null;
|
|
848
|
+
e && Je((l) => l.has(e) ? l : new Set(l).add(e));
|
|
827
849
|
}, [qe == null ? void 0 : qe.seq]);
|
|
828
|
-
const
|
|
829
|
-
for (const e of
|
|
850
|
+
const Qe = [];
|
|
851
|
+
for (const e of lt) {
|
|
830
852
|
if (e.type === "container") {
|
|
831
|
-
for (const
|
|
832
|
-
|
|
853
|
+
for (const l of lt.filter((i) => i.container_id != null && i.container_id === e.id))
|
|
854
|
+
Qe.push(l);
|
|
833
855
|
continue;
|
|
834
856
|
}
|
|
835
|
-
e.container_id == null &&
|
|
857
|
+
e.container_id == null && Qe.push(e);
|
|
836
858
|
}
|
|
837
|
-
const
|
|
838
|
-
var
|
|
839
|
-
return !!((
|
|
840
|
-
},
|
|
841
|
-
var
|
|
842
|
-
const
|
|
843
|
-
|
|
859
|
+
const G = (e) => {
|
|
860
|
+
var l;
|
|
861
|
+
return !!((l = Y(e.field)) != null && l.junction_field);
|
|
862
|
+
}, rt = (e) => {
|
|
863
|
+
var i;
|
|
864
|
+
const l = String(
|
|
865
|
+
ye(e.overrides).interface ?? ((i = U.get(e.field)) == null ? void 0 : i.interface) ?? ""
|
|
844
866
|
);
|
|
845
|
-
return /rich|wysiwyg|editorjs/i.test(
|
|
867
|
+
return /rich|wysiwyg|editorjs/i.test(l);
|
|
846
868
|
}, Ae = (e) => {
|
|
847
|
-
const
|
|
869
|
+
const l = U.get(e.field), i = ye(e.overrides);
|
|
848
870
|
if (Re(e.field)) {
|
|
849
|
-
const P =
|
|
850
|
-
return /* @__PURE__ */
|
|
871
|
+
const P = Zt(i), oe = ol((P == null ? void 0 : P.expr) ?? "", u ?? {});
|
|
872
|
+
return /* @__PURE__ */ r("span", { "data-display-formula": e.field, className: "tabular-nums", children: oe.error ? "—" : el(oe.value, P ?? { format: "", currency: null }) });
|
|
851
873
|
}
|
|
852
874
|
const c = Y(e.field);
|
|
853
|
-
if (d && !x && (c != null && c.junction_field)) return /* @__PURE__ */
|
|
875
|
+
if (d && !x && (c != null && c.junction_field)) return /* @__PURE__ */ r(le, {});
|
|
854
876
|
if (c != null && c.junction_field && c.many_collection && c.many_field)
|
|
855
|
-
return /* @__PURE__ */
|
|
856
|
-
|
|
877
|
+
return /* @__PURE__ */ r(
|
|
878
|
+
Sl,
|
|
857
879
|
{
|
|
858
880
|
junction: c.many_collection,
|
|
859
881
|
parentFk: c.many_field,
|
|
@@ -864,98 +886,98 @@ function ht({
|
|
|
864
886
|
relation: c
|
|
865
887
|
}
|
|
866
888
|
);
|
|
867
|
-
const
|
|
868
|
-
if (K === "nivaro_users" &&
|
|
869
|
-
return /* @__PURE__ */
|
|
870
|
-
if (K) return /* @__PURE__ */
|
|
871
|
-
if ((
|
|
872
|
-
if (
|
|
873
|
-
if ((
|
|
874
|
-
return /* @__PURE__ */
|
|
889
|
+
const b = u == null ? void 0 : u[e.field], K = fe(e.field);
|
|
890
|
+
if (K === "nivaro_users" && b != null)
|
|
891
|
+
return /* @__PURE__ */ r("span", { className: "inline-block", children: /* @__PURE__ */ r(vt, { userId: String(b), size: "compact" }) });
|
|
892
|
+
if (K) return /* @__PURE__ */ r(tt, { collection: K, id: b });
|
|
893
|
+
if ((l == null ? void 0 : l.type) === "boolean" && (b == null || b === "")) return /* @__PURE__ */ r(Ve, { value: !1 });
|
|
894
|
+
if (b == null || b === "") return /* @__PURE__ */ r(le, {});
|
|
895
|
+
if ((l == null ? void 0 : l.type) === "boolean")
|
|
896
|
+
return /* @__PURE__ */ r(
|
|
875
897
|
Ve,
|
|
876
898
|
{
|
|
877
|
-
value:
|
|
878
|
-
trueTone: (
|
|
899
|
+
value: b,
|
|
900
|
+
trueTone: (i.options ?? {}).trueTone ?? "positive"
|
|
879
901
|
}
|
|
880
902
|
);
|
|
881
|
-
const
|
|
882
|
-
return
|
|
903
|
+
const te = i.options ?? {};
|
|
904
|
+
return rt(e) && typeof b == "string" ? /^\s*\{/.test(b) ? /* @__PURE__ */ r("div", { className: "min-w-0 whitespace-pre-wrap font-normal [overflow-wrap:anywhere]", children: sl(b) }) : /* @__PURE__ */ r(
|
|
883
905
|
"div",
|
|
884
906
|
{
|
|
885
907
|
className: "rrv-prose min-w-0 font-normal leading-relaxed [overflow-wrap:anywhere] [&_a]:underline [&_h1]:text-[15px] [&_h1]:font-semibold [&_h2]:text-[14px] [&_h2]:font-semibold [&_h3]:font-semibold [&_li]:ml-4 [&_ol]:list-decimal [&_p]:my-1 [&_ul]:list-disc",
|
|
886
|
-
dangerouslySetInnerHTML: { __html:
|
|
908
|
+
dangerouslySetInnerHTML: { __html: ll(b) }
|
|
887
909
|
}
|
|
888
|
-
) :
|
|
889
|
-
},
|
|
890
|
-
const
|
|
891
|
-
if (!(
|
|
892
|
-
if (d && !x) return /* @__PURE__ */
|
|
893
|
-
const c =
|
|
910
|
+
) : te.format === "currency" ? /* @__PURE__ */ r("span", { className: "tabular-nums", children: et(b) }) : (l == null ? void 0 : l.type) === "decimal" || (l == null ? void 0 : l.type) === "float" ? /* @__PURE__ */ r("span", { className: "tabular-nums", children: Ue(b) }) : (l == null ? void 0 : l.type) === "date" || (l == null ? void 0 : l.type) === "datetime" || (l == null ? void 0 : l.type) === "timestamp" ? _t(b) : String(b);
|
|
911
|
+
}, wt = (e) => {
|
|
912
|
+
const l = ye(e.overrides), i = Y(e.field);
|
|
913
|
+
if (!(i != null && i.many_collection) || !i.many_field) return null;
|
|
914
|
+
if (d && !x) return /* @__PURE__ */ r("p", { className: "py-3 text-[12px] text-slate-400", children: "No records" });
|
|
915
|
+
const c = l.options ?? {}, b = (() => {
|
|
894
916
|
var P;
|
|
895
|
-
const
|
|
896
|
-
if (!
|
|
897
|
-
if (typeof
|
|
917
|
+
const te = (P = U.get(e.field)) == null ? void 0 : P.options;
|
|
918
|
+
if (!te) return {};
|
|
919
|
+
if (typeof te == "string")
|
|
898
920
|
try {
|
|
899
|
-
return JSON.parse(
|
|
921
|
+
return JSON.parse(te);
|
|
900
922
|
} catch {
|
|
901
923
|
return {};
|
|
902
924
|
}
|
|
903
|
-
return
|
|
925
|
+
return te;
|
|
904
926
|
})(), K = c.layout_id ?? null;
|
|
905
|
-
return /* @__PURE__ */
|
|
906
|
-
|
|
927
|
+
return /* @__PURE__ */ r(
|
|
928
|
+
$l,
|
|
907
929
|
{
|
|
908
|
-
collection:
|
|
909
|
-
fkField:
|
|
930
|
+
collection: i.many_collection,
|
|
931
|
+
fkField: i.many_field,
|
|
910
932
|
parentId: x,
|
|
911
933
|
layoutId: K,
|
|
912
|
-
presets: c.column_presets ??
|
|
913
|
-
defaultPreset: c.default_preset ??
|
|
934
|
+
presets: c.column_presets ?? b.column_presets,
|
|
935
|
+
defaultPreset: c.default_preset ?? b.default_preset ?? null,
|
|
914
936
|
onCount: o(e.field)
|
|
915
937
|
},
|
|
916
938
|
e.field
|
|
917
939
|
);
|
|
918
|
-
}, z = (e) => !!Y(e.field) && !
|
|
919
|
-
if (!u ||
|
|
920
|
-
const
|
|
921
|
-
return
|
|
922
|
-
},
|
|
940
|
+
}, z = (e) => !!Y(e.field) && !G(e), St = !!g.layout.hide_empty, nt = Array.isArray(g.layout.header_fields) ? g.layout.header_fields.filter((e) => typeof e == "string") : [], $t = new Set(nt), Ft = (e) => {
|
|
941
|
+
if (!u || G(e)) return !1;
|
|
942
|
+
const l = u[e.field];
|
|
943
|
+
return l == null || l === "" || Array.isArray(l) && l.length === 0;
|
|
944
|
+
}, qt = (e) => _e.find((l) => l.field === e), he = (e) => {
|
|
923
945
|
var c;
|
|
924
|
-
const
|
|
925
|
-
return
|
|
926
|
-
},
|
|
927
|
-
const
|
|
946
|
+
const l = ye(e.overrides).label, i = M ? Xt(e.overrides, M).label : void 0;
|
|
947
|
+
return i !== void 0 ? i : Re(e.field) ? typeof l == "string" && l.trim() ? l : "Formula" : typeof l == "string" && l.trim() ? l : e.label_override || ((c = U.get(e.field)) == null ? void 0 : c.label) || Ze(e.field);
|
|
948
|
+
}, At = (e) => {
|
|
949
|
+
const l = Gt(e.swap_config), i = _e.filter((n) => n.group_key === e.key && !$t.has(n.field)).filter((n) => _ || !u || !Jt(n.overrides) || !be(u[n.field])).sort((n, $) => n.sort - $.sort), c = se.filter((n) => n.group_key === e.key), b = Me(e.key), K = i.length === 0 && c.length === 0 && b.length === 0;
|
|
928
950
|
if (K && !d) return null;
|
|
929
|
-
const
|
|
930
|
-
const $ =
|
|
931
|
-
return $ ? { a: $, label: n.label ||
|
|
951
|
+
const te = (n) => St && !_ && (z(n) || G(n)) && ((h == null ? void 0 : h[n.field]) ?? t[n.field]) === 0, P = i.filter((n) => !z(n)), oe = i.filter(z), We = c.filter((n) => Se(n.field)), Tt = !e.hide_when_empty && b.length === 0 && We.length === 0 && i.length > 0 && i.some((n) => z(n) || G(n)) && i.every(te), Ye = (n) => !Tt && te(n), Rt = i.filter((n) => !Ye(n)), ge = (n) => (h == null ? void 0 : h[n.field]) ?? t[n.field], Ct = !!e.hide_when_empty && !d && !_ && !!u && b.length === 0 && We.length === 0 && i.every((n) => z(n) || G(n) ? ge(n) === 0 : be(u[n.field])) || !K && Rt.length === 0 && b.length === 0 && We.length === 0, Dt = (n) => (h == null ? void 0 : h[n.field]) ?? t[n.field], ze = !!l.emptyText && !!u && !d && b.length === 0 && We.length === 0 && i.every((n) => z(n) || G(n) ? Dt(n) === 0 : be(u[n.field])), Lt = Qt(P, { rows: l.rows }).units, Xe = e.is_collapsed ? _l(e.summary_fields).map((n) => {
|
|
952
|
+
const $ = i.find((Oe) => Oe.field === n.field);
|
|
953
|
+
return $ ? { a: $, label: n.label || he($) } : null;
|
|
932
954
|
}).filter((n) => !!n).filter(
|
|
933
|
-
({ a: n }) => !e.summary_hide_empty || !u || (z(n) ||
|
|
934
|
-
).slice(0,
|
|
935
|
-
var
|
|
936
|
-
const $ =
|
|
937
|
-
return /* @__PURE__ */
|
|
955
|
+
({ a: n }) => !e.summary_hide_empty || !u || (z(n) || G(n) ? ge(n) !== 0 : !be(u[n.field]))
|
|
956
|
+
).slice(0, vl) : [], ot = e.read_width === "full" || e.read_width === "half" || e.read_width === "third" ? e.read_width : oe.length > 0 || c.length > 0 || b.length > 0 || P.length > 4 ? "full" : "half", Et = (n) => {
|
|
957
|
+
var ut, ft, pt;
|
|
958
|
+
const $ = Ye(n), J = !!(ye(n.overrides).options ?? {}).emphasis, Te = rt(n) || !!((ft = (ut = U.get(n.field)) == null ? void 0 : ut.interface) != null && ft.includes("rich-text")), ct = u == null ? void 0 : u[n.field], mt = !Te && !G(n) && !fe(n.field) && (String(((pt = U.get(n.field)) == null ? void 0 : pt.interface) ?? "").includes("textarea") || typeof ct == "string" && ct.length > 36);
|
|
959
|
+
return /* @__PURE__ */ r(
|
|
938
960
|
"div",
|
|
939
961
|
{
|
|
940
962
|
hidden: $,
|
|
941
|
-
className: `min-w-0 ${Te ||
|
|
963
|
+
className: `min-w-0 ${Te || G(n) && (p[n.field] === "nivaro_files" || (t[n.field] ?? 0) > 3) ? "col-span-full" : J || mt ? "col-span-2" : ""}`,
|
|
942
964
|
children: N(
|
|
943
965
|
R(n),
|
|
944
|
-
/* @__PURE__ */ f(
|
|
966
|
+
/* @__PURE__ */ f(ce, { children: [
|
|
945
967
|
/* @__PURE__ */ f("dt", { className: Ie, children: [
|
|
946
|
-
|
|
947
|
-
/* @__PURE__ */
|
|
948
|
-
/* @__PURE__ */
|
|
968
|
+
he(n),
|
|
969
|
+
/* @__PURE__ */ r(ie, { field: n.field }),
|
|
970
|
+
/* @__PURE__ */ r(gt, { field: n.field }),
|
|
949
971
|
v(n.field)
|
|
950
972
|
] }),
|
|
951
|
-
/* @__PURE__ */
|
|
973
|
+
/* @__PURE__ */ r(
|
|
952
974
|
"dd",
|
|
953
975
|
{
|
|
954
976
|
"data-replay-field": n.field,
|
|
955
977
|
"data-field-collection": a,
|
|
956
|
-
"data-remote-changed":
|
|
957
|
-
className: `mt-1 min-w-0${D(n.field)} ${J ? "text-[17px] font-semibold tracking-[-0.01em] text-slate-900 dark:text-white" : `${
|
|
958
|
-
children: u ? Ae(n) : /* @__PURE__ */
|
|
978
|
+
"data-remote-changed": me.has(n.field) || void 0,
|
|
979
|
+
className: `mt-1 min-w-0${D(n.field)} ${J ? "text-[17px] font-semibold tracking-[-0.01em] text-slate-900 dark:text-white" : `${G(n) || Te ? "" : mt ? "line-clamp-3 break-words " : "truncate "}text-[13px] font-medium text-slate-800 dark:text-slate-100`}`,
|
|
980
|
+
children: u ? Ae(n) : /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
|
|
959
981
|
}
|
|
960
982
|
)
|
|
961
983
|
] }),
|
|
@@ -964,20 +986,20 @@ function ht({
|
|
|
964
986
|
},
|
|
965
987
|
n.field
|
|
966
988
|
);
|
|
967
|
-
},
|
|
968
|
-
const Oe = u && !d ? $.filter((J) => !
|
|
989
|
+
}, Pt = (n, $) => {
|
|
990
|
+
const Oe = u && !d ? $.filter((J) => !be(u[J.field])) : $;
|
|
969
991
|
return /* @__PURE__ */ f(
|
|
970
992
|
"div",
|
|
971
993
|
{
|
|
972
994
|
"data-read-row": n.key,
|
|
973
995
|
className: `min-w-0 ${$.length > 2 ? "col-span-full" : "col-span-2"}`,
|
|
974
996
|
children: [
|
|
975
|
-
/* @__PURE__ */
|
|
976
|
-
/* @__PURE__ */
|
|
977
|
-
Te > 0 && /* @__PURE__ */
|
|
997
|
+
/* @__PURE__ */ r("dt", { className: Ie, children: n.label.trim() || $.map(he).join(" / ") }),
|
|
998
|
+
/* @__PURE__ */ r("dd", { className: "mt-1 flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-[13px] font-medium text-slate-800 dark:text-slate-100", children: u ? Oe.length === 0 ? /* @__PURE__ */ r(le, {}) : Oe.map((J, Te) => /* @__PURE__ */ f(It, { children: [
|
|
999
|
+
Te > 0 && /* @__PURE__ */ r("span", { "aria-hidden": !0, className: "text-slate-300 dark:text-slate-600", children: "·" }),
|
|
978
1000
|
N(
|
|
979
1001
|
R(J),
|
|
980
|
-
/* @__PURE__ */
|
|
1002
|
+
/* @__PURE__ */ r(
|
|
981
1003
|
"span",
|
|
982
1004
|
{
|
|
983
1005
|
"data-replay-field": J.field,
|
|
@@ -988,115 +1010,115 @@ function ht({
|
|
|
988
1010
|
),
|
|
989
1011
|
L(J)
|
|
990
1012
|
)
|
|
991
|
-
] }, J.field)) : /* @__PURE__ */
|
|
1013
|
+
] }, J.field)) : /* @__PURE__ */ r("span", { className: "inline-block h-3.5 w-28 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) })
|
|
992
1014
|
]
|
|
993
1015
|
},
|
|
994
1016
|
`row:${n.key}`
|
|
995
1017
|
);
|
|
996
1018
|
};
|
|
997
|
-
return /* @__PURE__ */
|
|
1019
|
+
return /* @__PURE__ */ r(
|
|
998
1020
|
"section",
|
|
999
1021
|
{
|
|
1000
|
-
hidden:
|
|
1022
|
+
hidden: Ct,
|
|
1001
1023
|
"data-read-section": e.key,
|
|
1002
|
-
"data-read-width":
|
|
1024
|
+
"data-read-width": ot,
|
|
1003
1025
|
className: "min-w-0 rounded-xl border border-slate-200 bg-white dark:border-slate-700/60 dark:bg-slate-900/40",
|
|
1004
1026
|
children: N(
|
|
1005
1027
|
{ kind: "group", key: e.key },
|
|
1006
|
-
/* @__PURE__ */ f(
|
|
1028
|
+
/* @__PURE__ */ f(ce, { children: [
|
|
1007
1029
|
/* @__PURE__ */ f(
|
|
1008
1030
|
"h3",
|
|
1009
1031
|
{
|
|
1010
1032
|
"data-read-head": "",
|
|
1011
|
-
className: `group/rs relative flex items-center justify-between gap-2 px-5 py-2.5 text-[12.5px] font-semibold text-slate-700 dark:text-slate-200 ${
|
|
1033
|
+
className: `group/rs relative flex items-center justify-between gap-2 px-5 py-2.5 text-[12.5px] font-semibold text-slate-700 dark:text-slate-200 ${pe(e) ? "border-b border-slate-100 dark:border-slate-800" : ""}`,
|
|
1012
1034
|
children: [
|
|
1013
|
-
e.is_collapsed ? /* @__PURE__ */ f(
|
|
1014
|
-
/* @__PURE__ */
|
|
1035
|
+
e.is_collapsed ? /* @__PURE__ */ f(ce, { children: [
|
|
1036
|
+
/* @__PURE__ */ r(
|
|
1015
1037
|
"button",
|
|
1016
1038
|
{
|
|
1017
1039
|
type: "button",
|
|
1018
|
-
onClick: () =>
|
|
1019
|
-
"aria-expanded":
|
|
1020
|
-
className: `min-w-0 text-left after:absolute after:inset-0 group-hover/rs:text-slate-900 dark:group-hover/rs:text-white ${
|
|
1040
|
+
onClick: () => Nt(e.key),
|
|
1041
|
+
"aria-expanded": pe(e),
|
|
1042
|
+
className: `min-w-0 text-left after:absolute after:inset-0 group-hover/rs:text-slate-900 dark:group-hover/rs:text-white ${Xe.length > 0 && !pe(e) ? "shrink-0" : "flex-1"}`,
|
|
1021
1043
|
children: e.label
|
|
1022
1044
|
}
|
|
1023
1045
|
),
|
|
1024
|
-
!
|
|
1046
|
+
!pe(e) && Xe.length > 0 && // #3195: two or three values while the section is closed. Not
|
|
1025
1047
|
// interactive: the heading's toggle covers the whole row.
|
|
1026
|
-
/* @__PURE__ */
|
|
1048
|
+
/* @__PURE__ */ r(
|
|
1027
1049
|
"span",
|
|
1028
1050
|
{
|
|
1029
1051
|
"data-read-collapsed-summary": e.key,
|
|
1030
1052
|
className: "pointer-events-none flex min-w-0 flex-1 items-baseline gap-x-3 overflow-hidden whitespace-nowrap text-[12px] font-normal",
|
|
1031
|
-
children:
|
|
1032
|
-
/* @__PURE__ */
|
|
1033
|
-
/* @__PURE__ */
|
|
1053
|
+
children: Xe.map(({ a: n, label: $ }) => /* @__PURE__ */ f("span", { className: "flex min-w-0 shrink items-baseline gap-1", children: [
|
|
1054
|
+
/* @__PURE__ */ r("span", { className: "shrink-0 text-[10px] font-semibold uppercase tracking-wider text-slate-400 dark:text-slate-500", children: $ }),
|
|
1055
|
+
/* @__PURE__ */ r("span", { className: "min-w-0 truncate font-medium text-slate-700 dark:text-slate-300", children: u ? z(n) || G(n) ? ge(n) == null ? "…" : `${ge(n)} ${z(n) ? ge(n) === 1 ? "row" : "rows" : ge(n) === 1 ? "item" : "items"}` : be(u[n.field]) ? /* @__PURE__ */ r("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) : Ae(n) : "…" })
|
|
1034
1056
|
] }, n.field))
|
|
1035
1057
|
}
|
|
1036
1058
|
)
|
|
1037
|
-
] }) : /* @__PURE__ */
|
|
1038
|
-
|
|
1059
|
+
] }) : /* @__PURE__ */ r("span", { className: "min-w-0 flex-1", children: e.label }),
|
|
1060
|
+
k && (P.length > 0 || oe.length > 0) && /* @__PURE__ */ r(
|
|
1039
1061
|
"button",
|
|
1040
1062
|
{
|
|
1041
1063
|
type: "button",
|
|
1042
1064
|
"data-read-edit-section": e.key,
|
|
1043
1065
|
onClick: () => {
|
|
1044
1066
|
var n, $;
|
|
1045
|
-
return
|
|
1067
|
+
return k(e.key, ((n = P[0]) == null ? void 0 : n.field) ?? (($ = oe[0]) == null ? void 0 : $.field) ?? null);
|
|
1046
1068
|
},
|
|
1047
1069
|
title: `Edit ${e.label}`,
|
|
1048
1070
|
"aria-label": `Edit ${e.label}`,
|
|
1049
1071
|
className: "relative -my-1 rounded p-1 text-slate-400 opacity-0 transition-opacity hover:bg-slate-100 hover:text-slate-700 focus-visible:opacity-100 group-hover/rs:opacity-100 dark:hover:bg-white/5 dark:hover:text-slate-200 motion-reduce:transition-none",
|
|
1050
|
-
children: /* @__PURE__ */
|
|
1072
|
+
children: /* @__PURE__ */ r(jt, { className: "h-3 w-3" })
|
|
1051
1073
|
}
|
|
1052
1074
|
),
|
|
1053
|
-
e.is_collapsed && /* @__PURE__ */
|
|
1054
|
-
|
|
1075
|
+
e.is_collapsed && /* @__PURE__ */ r(
|
|
1076
|
+
Kt,
|
|
1055
1077
|
{
|
|
1056
1078
|
"aria-hidden": "true",
|
|
1057
|
-
className: `pointer-events-none h-3.5 w-3.5 shrink-0 transition-transform group-hover/rs:text-slate-700 dark:group-hover/rs:text-slate-200 ${
|
|
1079
|
+
className: `pointer-events-none h-3.5 w-3.5 shrink-0 transition-transform group-hover/rs:text-slate-700 dark:group-hover/rs:text-slate-200 ${pe(e) ? "" : "-rotate-90"}`
|
|
1058
1080
|
}
|
|
1059
1081
|
)
|
|
1060
1082
|
]
|
|
1061
1083
|
}
|
|
1062
1084
|
),
|
|
1063
|
-
/* @__PURE__ */ f("div", { "data-read-body": "", className: "px-5 pb-5 pt-4", hidden: !
|
|
1064
|
-
|
|
1085
|
+
/* @__PURE__ */ f("div", { "data-read-body": "", className: "px-5 pb-5 pt-4", hidden: !pe(e), children: [
|
|
1086
|
+
ze && /* @__PURE__ */ r(
|
|
1065
1087
|
"p",
|
|
1066
1088
|
{
|
|
1067
1089
|
"data-read-empty": e.key,
|
|
1068
1090
|
className: "text-[13px] text-slate-500 dark:text-slate-400",
|
|
1069
|
-
children:
|
|
1091
|
+
children: l.emptyText
|
|
1070
1092
|
}
|
|
1071
1093
|
),
|
|
1072
1094
|
P.length > 0 && // One column rhythm for the whole page: every section's facts sit
|
|
1073
1095
|
// on the same 2 / 3 / 4 / 6 tracks, so values line up card to
|
|
1074
1096
|
// card instead of each card auto-filling its own grid. Hidden, not
|
|
1075
1097
|
// unrendered, under the empty text: its link facts must keep reporting.
|
|
1076
|
-
/* @__PURE__ */
|
|
1098
|
+
/* @__PURE__ */ r(
|
|
1077
1099
|
"dl",
|
|
1078
1100
|
{
|
|
1079
1101
|
className: "grid gap-x-6 gap-y-5",
|
|
1080
|
-
"data-read-dl":
|
|
1081
|
-
style:
|
|
1082
|
-
children:
|
|
1083
|
-
(n) => n.kind === "row" ?
|
|
1102
|
+
"data-read-dl": ot,
|
|
1103
|
+
style: ze ? { display: "none" } : void 0,
|
|
1104
|
+
children: Lt.map(
|
|
1105
|
+
(n) => n.kind === "row" ? Pt(n.row, n.members) : Et(n.field)
|
|
1084
1106
|
)
|
|
1085
1107
|
}
|
|
1086
1108
|
),
|
|
1087
|
-
|
|
1109
|
+
oe.map((n) => {
|
|
1088
1110
|
var $;
|
|
1089
|
-
return /* @__PURE__ */
|
|
1111
|
+
return /* @__PURE__ */ r(
|
|
1090
1112
|
"div",
|
|
1091
1113
|
{
|
|
1092
1114
|
className: P.length > 0 ? "mt-3" : "",
|
|
1093
|
-
hidden:
|
|
1115
|
+
hidden: Ye(n) || ze,
|
|
1094
1116
|
children: N(
|
|
1095
1117
|
R(n),
|
|
1096
|
-
/* @__PURE__ */ f(
|
|
1118
|
+
/* @__PURE__ */ f(ce, { children: [
|
|
1097
1119
|
($ = q == null ? void 0 : q.get(n.field)) != null && $.length ? /* @__PURE__ */ f("div", { className: "mb-1.5 flex items-center gap-1.5 text-[11px] font-medium text-amber-700 dark:text-amber-300", children: [
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1120
|
+
/* @__PURE__ */ r("span", { children: he(n) }),
|
|
1121
|
+
/* @__PURE__ */ r(ie, { field: n.field }),
|
|
1100
1122
|
/* @__PURE__ */ f("span", { className: "font-normal text-amber-700/80 dark:text-amber-300/80", children: [
|
|
1101
1123
|
"— ",
|
|
1102
1124
|
q.get(n.field).length,
|
|
@@ -1105,7 +1127,7 @@ function ht({
|
|
|
1105
1127
|
"; switch to Edit to fix"
|
|
1106
1128
|
] })
|
|
1107
1129
|
] }) : null,
|
|
1108
|
-
(W ? W(n) : null) ??
|
|
1130
|
+
(W ? W(n) : null) ?? wt(n)
|
|
1109
1131
|
] }),
|
|
1110
1132
|
L(n)
|
|
1111
1133
|
)
|
|
@@ -1114,8 +1136,8 @@ function ht({
|
|
|
1114
1136
|
);
|
|
1115
1137
|
}),
|
|
1116
1138
|
re(e.key),
|
|
1117
|
-
|
|
1118
|
-
K && d && /* @__PURE__ */
|
|
1139
|
+
Ne(e.key),
|
|
1140
|
+
K && d && /* @__PURE__ */ r(
|
|
1119
1141
|
"div",
|
|
1120
1142
|
{
|
|
1121
1143
|
"data-design-drop": e.key,
|
|
@@ -1130,53 +1152,53 @@ function ht({
|
|
|
1130
1152
|
},
|
|
1131
1153
|
e.key
|
|
1132
1154
|
);
|
|
1133
|
-
},
|
|
1155
|
+
}, at = Ne(null), Ot = Ne(null, "leading"), it = nt.map((e) => qt(e)).filter((e) => !!e && !z(e)).filter((e) => _ || !Ft(e)), [ae, ...st] = it;
|
|
1134
1156
|
return /* @__PURE__ */ f(
|
|
1135
1157
|
"div",
|
|
1136
1158
|
{
|
|
1137
1159
|
className: O ? "min-h-0 flex-1" : "min-h-0 flex-1 overflow-y-auto bg-slate-50/60 px-5 py-4 dark:bg-transparent",
|
|
1138
1160
|
children: [
|
|
1139
|
-
|
|
1140
|
-
|
|
1161
|
+
Ot,
|
|
1162
|
+
it.length > 0 && /* @__PURE__ */ f(
|
|
1141
1163
|
"div",
|
|
1142
1164
|
{
|
|
1143
1165
|
"data-read-header": !0,
|
|
1144
1166
|
className: "mb-4 rounded-xl border border-slate-200 bg-white px-5 py-4 dark:border-slate-700/60 dark:bg-slate-900/40",
|
|
1145
1167
|
children: [
|
|
1146
|
-
|
|
1147
|
-
{ kind: "header", field:
|
|
1168
|
+
ae && N(
|
|
1169
|
+
{ kind: "header", field: ae.field },
|
|
1148
1170
|
/* @__PURE__ */ f("div", { className: "min-w-0", children: [
|
|
1149
1171
|
/* @__PURE__ */ f("p", { className: Ie, children: [
|
|
1150
|
-
|
|
1151
|
-
/* @__PURE__ */
|
|
1172
|
+
he(ae),
|
|
1173
|
+
/* @__PURE__ */ r(ie, { field: ae.field })
|
|
1152
1174
|
] }),
|
|
1153
|
-
/* @__PURE__ */
|
|
1175
|
+
/* @__PURE__ */ r(
|
|
1154
1176
|
"p",
|
|
1155
1177
|
{
|
|
1156
|
-
"data-replay-field":
|
|
1178
|
+
"data-replay-field": ae.field,
|
|
1157
1179
|
"data-field-collection": a,
|
|
1158
|
-
className: `truncate text-[22px] font-semibold leading-tight tracking-[-0.015em] text-slate-900 dark:text-white${D(
|
|
1159
|
-
children: u ? Ae(
|
|
1180
|
+
className: `truncate text-[22px] font-semibold leading-tight tracking-[-0.015em] text-slate-900 dark:text-white${D(ae.field)}`,
|
|
1181
|
+
children: u ? Ae(ae) : "…"
|
|
1160
1182
|
}
|
|
1161
1183
|
)
|
|
1162
1184
|
] }),
|
|
1163
|
-
L(
|
|
1185
|
+
L(ae)
|
|
1164
1186
|
),
|
|
1165
|
-
|
|
1187
|
+
st.length > 0 && /* @__PURE__ */ r("dl", { className: "mt-3 flex flex-wrap gap-x-8 gap-y-2", children: st.map((e) => /* @__PURE__ */ r("div", { className: "min-w-0", children: N(
|
|
1166
1188
|
{ kind: "header", field: e.field },
|
|
1167
|
-
/* @__PURE__ */ f(
|
|
1189
|
+
/* @__PURE__ */ f(ce, { children: [
|
|
1168
1190
|
/* @__PURE__ */ f("dt", { className: Ie, children: [
|
|
1169
|
-
|
|
1170
|
-
/* @__PURE__ */
|
|
1171
|
-
/* @__PURE__ */
|
|
1191
|
+
he(e),
|
|
1192
|
+
/* @__PURE__ */ r(ie, { field: e.field }),
|
|
1193
|
+
/* @__PURE__ */ r(gt, { field: e.field }),
|
|
1172
1194
|
v(e.field)
|
|
1173
1195
|
] }),
|
|
1174
|
-
/* @__PURE__ */
|
|
1196
|
+
/* @__PURE__ */ r(
|
|
1175
1197
|
"dd",
|
|
1176
1198
|
{
|
|
1177
1199
|
"data-replay-field": e.field,
|
|
1178
1200
|
"data-field-collection": a,
|
|
1179
|
-
"data-remote-changed":
|
|
1201
|
+
"data-remote-changed": me.has(e.field) || void 0,
|
|
1180
1202
|
className: `mt-0.5 truncate text-[13px] font-medium text-slate-800 dark:text-slate-100${D(e.field)}`,
|
|
1181
1203
|
children: u ? Ae(e) : "…"
|
|
1182
1204
|
}
|
|
@@ -1187,22 +1209,23 @@ function ht({
|
|
|
1187
1209
|
]
|
|
1188
1210
|
}
|
|
1189
1211
|
),
|
|
1190
|
-
/* @__PURE__ */
|
|
1191
|
-
H
|
|
1192
|
-
|
|
1193
|
-
/* @__PURE__ */
|
|
1194
|
-
/* @__PURE__ */
|
|
1212
|
+
/* @__PURE__ */ r("style", { children: kl }),
|
|
1213
|
+
H && $e.length > 0 && /* @__PURE__ */ r("div", { className: "mb-3", children: /* @__PURE__ */ r(cl, { items: $e, revealed: ne, onToggle: Ge }) }),
|
|
1214
|
+
H ? /* @__PURE__ */ r("div", { className: "grid items-stretch gap-4", "data-read-board": !0, children: Qe.map(At) }) : /* @__PURE__ */ f("div", { className: "flex flex-col gap-4", "data-read-board-pending": !0, children: [
|
|
1215
|
+
/* @__PURE__ */ r("div", { className: "h-32 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
1216
|
+
/* @__PURE__ */ r("div", { className: "h-32 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
1217
|
+
/* @__PURE__ */ r("div", { className: "h-56 animate-pulse rounded-xl bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
|
|
1195
1218
|
] }),
|
|
1196
|
-
|
|
1219
|
+
at && /* @__PURE__ */ r("div", { className: "mt-4", children: at })
|
|
1197
1220
|
]
|
|
1198
1221
|
}
|
|
1199
1222
|
);
|
|
1200
1223
|
}
|
|
1201
|
-
function
|
|
1202
|
-
return a.design ? /* @__PURE__ */
|
|
1224
|
+
function dr(a) {
|
|
1225
|
+
return a.design ? /* @__PURE__ */ r(pl, { design: a.design.context, onRefusedWrite: a.design.onRefusedWrite, children: /* @__PURE__ */ r(Ut.Provider, { value: null, children: /* @__PURE__ */ r(yt, { ...a }) }) }) : /* @__PURE__ */ r(yt, { ...a });
|
|
1203
1226
|
}
|
|
1204
1227
|
export {
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1228
|
+
vl as COLLAPSED_SUMMARY_MAX,
|
|
1229
|
+
dr as RecordReadView,
|
|
1230
|
+
_l as collapsedSummaryEntries
|
|
1208
1231
|
};
|