@nivaro/react 0.3.111 → 0.3.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +207 -3
- package/dist/index.js +745 -728
- package/dist/shared/components/CollectionBrowserView.js +3133 -2954
- package/dist/shared/components/CollectionImportBanner.js +135 -0
- package/dist/shared/components/ItemEditForm.js +2235 -2218
- package/dist/shared/components/JobsTray.js +54 -47
- package/dist/shared/components/ViewAsPersonButton.js +109 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +228 -150
- package/dist/shared/components/bulk/BulkFieldUpdateButton.js +35 -41
- package/dist/shared/components/bulk/BulkLinksValue.js +91 -0
- package/dist/shared/components/bulk/bulk-field-options.js +20 -19
- package/dist/shared/components/bulk/bulk-update-preview.js +39 -0
- package/dist/shared/components/cbv/ColumnHeaderMenu.js +130 -0
- package/dist/shared/components/cbv/column-totals.js +163 -0
- package/dist/shared/components/collections-directory/CollectionHoverCard.js +108 -81
- package/dist/shared/components/collections-directory/CollectionRow.js +164 -148
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +167 -166
- package/dist/shared/components/collections-directory/directory-data.js +70 -58
- package/dist/shared/components/imports/CollectionImportPanel.js +120 -118
- package/dist/shared/components/imports/DefinitionsPanel.js +24 -24
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +65 -0
- package/dist/shared/components/item-edit/CatalogPickerField.js +631 -639
- package/dist/shared/components/item-edit/DuplicateNotice.js +168 -0
- package/dist/shared/components/item-edit/FieldRow.js +248 -246
- package/dist/shared/components/item-edit/InlineGridField.js +34 -33
- package/dist/shared/components/item-edit/InlineTableField.js +3002 -2825
- package/dist/shared/components/item-edit/MembershipSetField.js +165 -169
- package/dist/shared/components/item-edit/NestedRelationEditor.js +184 -189
- package/dist/shared/components/item-edit/PlanGrid.js +2 -1
- package/dist/shared/components/item-edit/QuickPickerDialog.js +35 -34
- package/dist/shared/components/item-edit/RecordLiveSync.js +32 -30
- package/dist/shared/components/item-edit/RelationCombobox.js +101 -100
- package/dist/shared/components/item-edit/RowHistorySheet.js +28 -27
- package/dist/shared/components/item-edit/SummaryPanel.js +133 -135
- package/dist/shared/components/item-edit/UserChip.js +262 -239
- package/dist/shared/components/item-edit/ViewAsRole.js +129 -52
- package/dist/shared/components/item-edit/grid-search.js +375 -0
- package/dist/shared/components/item-edit/render-stability.js +61 -54
- package/dist/shared/components/notifications/NotificationRulesEditor.js +25 -20
- package/dist/shared/components/ops-report/DigestSections.js +163 -144
- package/dist/shared/components/ops-report/drill.js +97 -97
- package/dist/shared/components/panels/AddendumLinesDiff.js +52 -51
- package/dist/shared/components/panels/AddendumPanel.js +92 -91
- package/dist/shared/components/panels/AsyncUserPicker.js +108 -0
- package/dist/shared/components/panels/CommentPanel.js +265 -252
- package/dist/shared/components/panels/OwnersSlot.js +47 -35
- package/dist/shared/components/panels/PipelineInsight.js +186 -0
- package/dist/shared/components/panels/PipelinePanel.js +1440 -1397
- package/dist/shared/components/panels/RecordIntegrityBanner.js +39 -38
- package/dist/shared/components/panels/RevisionsPanel.js +261 -260
- package/dist/shared/components/panels/StandInReason.js +69 -0
- package/dist/shared/components/pipeline/FieldPicker.js +41 -40
- package/dist/shared/components/pipeline/OwnerMatrix.js +829 -700
- package/dist/shared/components/pipeline/OwnerRecordTrial.js +362 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +483 -467
- package/dist/shared/components/pipeline/PipelineStateOwners.js +65 -64
- package/dist/shared/components/pipeline/owner-matrix-draft.js +178 -0
- package/dist/shared/components/profile/MyDefaultsCard.js +36 -35
- package/dist/shared/components/profile/PersonHeader.js +29 -29
- package/dist/shared/components/profile/PersonProfile.js +30 -28
- package/dist/shared/components/profile/SlowScreensCard.js +286 -0
- package/dist/shared/components/queue/QueueWorklist.js +1090 -1071
- package/dist/shared/components/quick-filters/useQuickFilterEditing.js +45 -44
- package/dist/shared/components/support/TicketDetailSheet.js +25 -16
- package/dist/shared/components/support/TicketSlowScreens.js +32 -0
- package/dist/shared/lib/activity-sentence.js +224 -178
- package/dist/shared/lib/collection-import-banner.js +27 -0
- package/dist/shared/lib/crash-report.js +112 -0
- package/dist/shared/lib/export-runs.js +99 -0
- package/dist/shared/lib/jobs-tray.js +89 -67
- package/dist/shared/lib/list-link.js +76 -69
- package/dist/shared/lib/nav-trail.js +180 -76
- package/dist/shared/lib/query-keys.js +26 -0
- package/dist/shared/lib/view-as.js +16 -11
- package/package.json +1 -1
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import { jsxs as u, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Info as
|
|
4
|
-
import { memo as
|
|
5
|
-
import { toast as
|
|
6
|
-
import { useParentDraft as
|
|
7
|
-
import { showsAiButton as
|
|
8
|
-
import { get as
|
|
9
|
-
import { toastError as
|
|
10
|
-
import { titleCase as
|
|
11
|
-
import { requiredByRules as
|
|
12
|
-
import { GlossaryLabel as
|
|
13
|
-
import { useFieldSource as
|
|
14
|
-
import { Label as
|
|
2
|
+
import { useQueryClient as nt, useQueries as Ft, useQuery as le, useMutation as Ct } from "@tanstack/react-query";
|
|
3
|
+
import { Info as Rt, Loader2 as Lt, Sparkles as St, Lock as $t, SlidersHorizontal as qt, History as At, BellRing as Tt, Bell as Et, Sigma as Pt } from "lucide-react";
|
|
4
|
+
import { memo as jt, useState as ke, useRef as L, useId as Bt, useEffect as oe, useCallback as Je } from "react";
|
|
5
|
+
import { toast as ae } from "sonner";
|
|
6
|
+
import { useParentDraft as Dt, useNivaroClient as ie } from "../../context.js";
|
|
7
|
+
import { showsAiButton as Mt, AUTOFILL_CHECK_KEY as Ot, readAiFill as Ht } from "../../lib/ai-fill.js";
|
|
8
|
+
import { get as U, del as Kt, post as ve } from "../../lib/commands.js";
|
|
9
|
+
import { toastError as Ut } from "../../lib/error-toast.js";
|
|
10
|
+
import { titleCase as K, cn as D, formatDateTime as we, toLocalDateString as Wt } from "../../lib/utils.js";
|
|
11
|
+
import { requiredByRules as Xe } from "../../lib/validation-rules.js";
|
|
12
|
+
import { GlossaryLabel as Ze } from "../ai/GlossaryText.js";
|
|
13
|
+
import { useFieldSource as Vt, FieldSourceInfo as zt } from "../ConfigReadBack.js";
|
|
14
|
+
import { Label as Gt } from "../ui/label.js";
|
|
15
15
|
import { TooltipProvider as ee, Tooltip as te, TooltipTrigger as ne, TooltipContent as re } from "../ui/tooltip.js";
|
|
16
|
-
import { useAddendumFields as
|
|
17
|
-
import { AutoIdPreviewField as
|
|
18
|
-
import { useCascadeClearNotifier as
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
|
|
16
|
+
import { useAddendumFields as Qt } from "./AddendumFieldContext.js";
|
|
17
|
+
import { AutoIdPreviewField as Yt } from "./AutoIdPreviewField.js";
|
|
18
|
+
import { useCascadeClearNotifier as Jt } from "./cascade-clear-notice.js";
|
|
19
|
+
import { DuplicateNotice as Xt } from "./DuplicateNotice.js";
|
|
20
|
+
import { FOCUSABLE as Ie } from "./entry/entry-keys.js";
|
|
21
|
+
import { useFieldAffordances as Zt, useFieldContextMenu as It, usePresenceSoftLock as en, LockReasonBadge as tn, PresenceSoftLockStrip as nn, RemoteChangeGhost as rn } from "./FieldAffordances.js";
|
|
22
|
+
import { FieldCommentButton as ln } from "./FieldComments.js";
|
|
23
|
+
import { FieldRenderer as on } from "./FieldRenderer.js";
|
|
24
|
+
import { FormHelpVideoButton as an } from "./FormHelpVideoButton.js";
|
|
25
|
+
import { primaryControl as sn, applyFieldA11y as dn } from "./field-a11y.js";
|
|
26
|
+
import { getCascadeFilters as cn, SYSTEM_FIELDS as un, parseJson as mn, buildCascadeFilter as pn, CascadeEffectController as hn } from "./helpers.js";
|
|
27
|
+
import { isDerivedForRecord as fn } from "./live-rollups.js";
|
|
28
|
+
import { useM2MStaging as xn } from "./M2MStagingContext.js";
|
|
29
|
+
import { personalDefaultSlotFor as yn, PersonalDefaultSlot as bn } from "./PersonalDefaultControl.js";
|
|
30
|
+
import { PersonalDefaultHint as gn } from "./PersonalDefaultPill.js";
|
|
31
|
+
import { isDisplayFormulaRow as et, usePlacementTextContext as vn, placementFieldText as wn, fieldCounterConfig as kn, fieldIsRecommended as _n, RecommendedMarker as Nn, RepeatLastButton as Fn, DisplayFormulaValue as Cn, FieldCounter as Rn } from "./placement-behaviour.js";
|
|
32
|
+
import { keepIfEqual as Ln, jsonEqual as Sn } from "./render-stability.js";
|
|
33
|
+
import { softRuleWarning as $n } from "./soft-rules.js";
|
|
34
|
+
import { usePersonalDefaultsApi as qn } from "./usePersonalDefaults.js";
|
|
35
|
+
import { resolveOptionFilterTokens as An } from "../../lib/option-filter-tokens.js";
|
|
36
|
+
const tt = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger", "number"]), Tn = /* @__PURE__ */ new Set(["string", "text", "richtext", "textarea", "markdown", "json", "csv"]), En = /* @__PURE__ */ new Set([
|
|
36
37
|
"input",
|
|
37
38
|
"textarea",
|
|
38
39
|
"wysiwyg",
|
|
@@ -40,7 +41,7 @@ const Ie = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger",
|
|
|
40
41
|
"input-rich-text-html",
|
|
41
42
|
"rich_text",
|
|
42
43
|
"extension-editorjs"
|
|
43
|
-
]),
|
|
44
|
+
]), Pn = /* @__PURE__ */ new Set([
|
|
44
45
|
"relation-m2o",
|
|
45
46
|
"relation-m2m",
|
|
46
47
|
"select-multiple-m2m",
|
|
@@ -51,74 +52,74 @@ const Ie = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger",
|
|
|
51
52
|
"file",
|
|
52
53
|
"files",
|
|
53
54
|
"image"
|
|
54
|
-
]),
|
|
55
|
-
function
|
|
55
|
+
]), jn = /* @__PURE__ */ new Set(["file", "file-image", "files-m2m", "files", "image"]);
|
|
56
|
+
function Bn(m) {
|
|
56
57
|
const e = m.interface ?? "";
|
|
57
|
-
return
|
|
58
|
+
return Pn.has(e) || e.startsWith("relation-") || e.endsWith("-m2o") || e.endsWith("-m2m") || tt.has(m.type ?? "") ? !1 : !!(Tn.has(m.type ?? "") || En.has(e) || !e && m.type && !tt.has(m.type));
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
+
function Dn(m, e, i) {
|
|
60
61
|
return m.filter((h) => (i == null ? void 0 : i(h)) !== e);
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function Mn(m, e, i, h) {
|
|
63
64
|
const x = ie();
|
|
64
65
|
return le({
|
|
65
66
|
queryKey: ["field-lineage", m, e, i],
|
|
66
67
|
queryFn: () => x.request(
|
|
67
|
-
|
|
68
|
-
).then((
|
|
68
|
+
U(`/lineage/${m}/${encodeURIComponent(e)}/${i}`)
|
|
69
|
+
).then((d) => d.data),
|
|
69
70
|
enabled: h,
|
|
70
71
|
staleTime: 3e4
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
+
function Nr(m, e = "rows") {
|
|
74
75
|
var l, w, g;
|
|
75
76
|
if (m && (m.kind === "write" || m.kind === "read") && m.formula) {
|
|
76
77
|
const p = (b) => typeof b == "number" ? b.toLocaleString(void 0, { maximumFractionDigits: 2 }) : b == null || b === "" ? "0" : String(b);
|
|
77
|
-
return `= ${m.formula.replace(/item\.([A-Za-z_][A-Za-z0-9_]*)/g, (b,
|
|
78
|
+
return `= ${m.formula.replace(/item\.([A-Za-z_][A-Za-z0-9_]*)/g, (b, o) => {
|
|
78
79
|
var f;
|
|
79
|
-
return p((f = m.inputs) == null ? void 0 : f[
|
|
80
|
+
return p((f = m.inputs) == null ? void 0 : f[o]);
|
|
80
81
|
}).replace(/\s*-\s*/g, " − ").replace(/\s*\*\s*/g, " × ").replace(/\s*\/\s*/g, " ÷ ")}`;
|
|
81
82
|
}
|
|
82
83
|
if (!m || m.kind !== "rollup") return null;
|
|
83
|
-
const i = (m.sources ?? []).reduce((p,
|
|
84
|
+
const i = (m.sources ?? []).reduce((p, a) => p + a.rows.length, 0), h = (m.sources ?? []).reduce((p, a) => {
|
|
84
85
|
var b;
|
|
85
|
-
return p + (((b =
|
|
86
|
+
return p + (((b = a.excluded) == null ? void 0 : b.length) ?? 0);
|
|
86
87
|
}, 0), x = (g = (w = (l = (m.sources ?? []).find((p) => {
|
|
87
|
-
var
|
|
88
|
-
return (
|
|
89
|
-
})) == null ? void 0 : l.excluded) == null ? void 0 : w[0]) == null ? void 0 : g.reason,
|
|
90
|
-
return h &&
|
|
88
|
+
var a;
|
|
89
|
+
return (a = p.excluded) == null ? void 0 : a.length;
|
|
90
|
+
})) == null ? void 0 : l.excluded) == null ? void 0 : w[0]) == null ? void 0 : g.reason, d = [`= ${i} ${i === 1 ? e.replace(/s$/, "") : e}`];
|
|
91
|
+
return h && d.push(
|
|
91
92
|
`${h} excluded${x ? ` (${x.replace(/^does not match: /, "")})` : ""}`
|
|
92
|
-
),
|
|
93
|
+
), d.join(" · ");
|
|
93
94
|
}
|
|
94
|
-
function
|
|
95
|
+
function On({
|
|
95
96
|
collection: m,
|
|
96
97
|
itemId: e,
|
|
97
98
|
field: i
|
|
98
99
|
}) {
|
|
99
|
-
const [h, x] = ke(!1),
|
|
100
|
-
|
|
100
|
+
const [h, x] = ke(!1), d = L(null), { data: l, isLoading: w } = Mn(m, e, i, h);
|
|
101
|
+
oe(() => {
|
|
101
102
|
if (!h) return;
|
|
102
|
-
const
|
|
103
|
-
var
|
|
104
|
-
(
|
|
103
|
+
const a = (b) => {
|
|
104
|
+
var o;
|
|
105
|
+
(o = d.current) != null && o.contains(b.target) || x(!1);
|
|
105
106
|
};
|
|
106
|
-
return window.addEventListener("mousedown",
|
|
107
|
+
return window.addEventListener("mousedown", a), () => window.removeEventListener("mousedown", a);
|
|
107
108
|
}, [h]);
|
|
108
|
-
const g = (
|
|
109
|
-
return /* @__PURE__ */ u("div", { ref:
|
|
109
|
+
const g = (a) => a == null ? "—" : Number(a).toLocaleString(void 0, { maximumFractionDigits: 2 }), p = (l == null ? void 0 : l.stored_value) != null ? Number(l.stored_value) : null;
|
|
110
|
+
return /* @__PURE__ */ u("div", { ref: d, className: "relative inline-flex", children: [
|
|
110
111
|
/* @__PURE__ */ n(
|
|
111
112
|
"button",
|
|
112
113
|
{
|
|
113
114
|
type: "button",
|
|
114
|
-
onClick: () => x((
|
|
115
|
+
onClick: () => x((a) => !a),
|
|
115
116
|
title: "Where does this number come from?",
|
|
116
117
|
className: D(
|
|
117
118
|
"inline-flex items-center rounded p-0.5 transition-opacity",
|
|
118
119
|
h ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
|
|
119
120
|
),
|
|
120
121
|
"data-field-lineage": !0,
|
|
121
|
-
children: /* @__PURE__ */ n(
|
|
122
|
+
children: /* @__PURE__ */ n(Pt, { className: "h-3 w-3" })
|
|
122
123
|
}
|
|
123
124
|
),
|
|
124
125
|
h && /* @__PURE__ */ u("div", { className: "absolute left-0 top-full z-40 mt-1 max-h-[340px] w-[360px] overflow-y-auto rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
|
|
@@ -126,29 +127,29 @@ function Bn({
|
|
|
126
127
|
w && /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }),
|
|
127
128
|
(l == null ? void 0 : l.kind) === "write" && /* @__PURE__ */ u("div", { className: "space-y-1 px-1 py-1", children: [
|
|
128
129
|
/* @__PURE__ */ n("p", { className: "font-mono text-[11px] text-slate-600 dark:text-slate-300", children: l.formula }),
|
|
129
|
-
Object.entries(l.inputs ?? {}).map(([
|
|
130
|
-
/* @__PURE__ */ n("span", { className: "font-mono", children:
|
|
130
|
+
Object.entries(l.inputs ?? {}).map(([a, b]) => /* @__PURE__ */ u("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
131
|
+
/* @__PURE__ */ n("span", { className: "font-mono", children: a }),
|
|
131
132
|
" = ",
|
|
132
133
|
g(b)
|
|
133
|
-
] },
|
|
134
|
+
] }, a)),
|
|
134
135
|
/* @__PURE__ */ u("p", { className: "pt-1 text-[11.5px] font-medium text-slate-700 dark:text-slate-200", children: [
|
|
135
136
|
"= ",
|
|
136
137
|
g(l.stored_value)
|
|
137
138
|
] })
|
|
138
139
|
] }),
|
|
139
|
-
(l == null ? void 0 : l.kind) === "rollup" && (l.sources ?? []).map((
|
|
140
|
-
var
|
|
140
|
+
(l == null ? void 0 : l.kind) === "rollup" && (l.sources ?? []).map((a, b) => {
|
|
141
|
+
var o;
|
|
141
142
|
return /* @__PURE__ */ u("div", { className: "mb-1.5", children: [
|
|
142
143
|
/* @__PURE__ */ u("p", { className: "px-1 text-[10.5px] text-slate-400", children: [
|
|
143
|
-
(
|
|
144
|
-
|
|
144
|
+
(a.aggregate ?? "sum").toUpperCase(),
|
|
145
|
+
a.value_field ? ` of ${a.value_field}` : "",
|
|
145
146
|
" across ",
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
a.collection,
|
|
148
|
+
a.filtered ? " (filtered)" : ""
|
|
148
149
|
] }),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
a.error && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-amber-600 dark:text-amber-400", children: a.error }),
|
|
151
|
+
a.note && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-slate-400", children: a.note }),
|
|
152
|
+
a.rows.length > 0 && /* @__PURE__ */ n("div", { className: "mt-0.5 space-y-px", children: a.rows.map((f) => /* @__PURE__ */ u(
|
|
152
153
|
"div",
|
|
153
154
|
{
|
|
154
155
|
className: "flex items-baseline gap-2 rounded px-1 py-0.5 text-[11.5px] hover:bg-slate-50 dark:hover:bg-muted",
|
|
@@ -167,19 +168,19 @@ function Bn({
|
|
|
167
168
|
},
|
|
168
169
|
f.id
|
|
169
170
|
)) }),
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
a.truncated && /* @__PURE__ */ n("p", { className: "px-1 pt-0.5 text-[10.5px] text-amber-600 dark:text-amber-400", children: "Showing the first 200 rows — the subtotal covers only these." }),
|
|
172
|
+
a.subtotal != null && /* @__PURE__ */ u("p", { className: "border-t border-slate-100 px-1 pt-1 text-right text-[11.5px] font-medium text-slate-700 dark:border-border dark:text-slate-200", children: [
|
|
172
173
|
"subtotal ",
|
|
173
|
-
g(
|
|
174
|
+
g(a.subtotal)
|
|
174
175
|
] }),
|
|
175
|
-
(((
|
|
176
|
+
(((o = a.excluded) == null ? void 0 : o.length) ?? 0) > 0 && /* @__PURE__ */ u("div", { className: "mt-1 rounded bg-slate-50 px-1 py-1 dark:bg-muted/40", children: [
|
|
176
177
|
/* @__PURE__ */ u("p", { className: "text-[10.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
177
|
-
|
|
178
|
+
a.excluded.length,
|
|
178
179
|
" excluded —",
|
|
179
180
|
" ",
|
|
180
|
-
|
|
181
|
+
a.excluded[0].reason.replace(/^does not match: /, "")
|
|
181
182
|
] }),
|
|
182
|
-
|
|
183
|
+
a.excluded.slice(0, 8).map((f) => /* @__PURE__ */ u(
|
|
183
184
|
"div",
|
|
184
185
|
{
|
|
185
186
|
className: "flex items-baseline gap-2 px-0.5 text-[11px] text-slate-400",
|
|
@@ -190,9 +191,9 @@ function Bn({
|
|
|
190
191
|
},
|
|
191
192
|
f.id
|
|
192
193
|
)),
|
|
193
|
-
|
|
194
|
+
a.excluded.length > 8 && /* @__PURE__ */ u("p", { className: "px-0.5 text-[10.5px] text-slate-400", children: [
|
|
194
195
|
"+",
|
|
195
|
-
|
|
196
|
+
a.excluded.length - 8,
|
|
196
197
|
" more"
|
|
197
198
|
] })
|
|
198
199
|
] })
|
|
@@ -202,65 +203,65 @@ function Bn({
|
|
|
202
203
|
"stored ",
|
|
203
204
|
g(p),
|
|
204
205
|
(() => {
|
|
205
|
-
const
|
|
206
|
-
return (l.sources ?? []).some((
|
|
206
|
+
const a = (l.sources ?? []).reduce((o, f) => o + (f.subtotal ?? 0), 0);
|
|
207
|
+
return (l.sources ?? []).some((o) => o.truncated) ? null : Math.abs(a - p) < 0.01 ? /* @__PURE__ */ n("span", { className: "ml-1 text-emerald-600 dark:text-emerald-400", children: "✓ matches" }) : /* @__PURE__ */ n("span", { className: "ml-1 text-amber-600 dark:text-amber-400", children: "✕ differs from contributions" });
|
|
207
208
|
})()
|
|
208
209
|
] })
|
|
209
210
|
] })
|
|
210
211
|
] });
|
|
211
212
|
}
|
|
212
|
-
function
|
|
213
|
+
function Hn({
|
|
213
214
|
collection: m,
|
|
214
215
|
itemId: e,
|
|
215
216
|
field: i,
|
|
216
217
|
formatValue: h,
|
|
217
218
|
onRestore: x
|
|
218
219
|
}) {
|
|
219
|
-
const
|
|
220
|
+
const d = ie(), [l, w] = ke(!1), g = L(null), { data: p, isLoading: a } = le({
|
|
220
221
|
queryKey: ["field-value-history", m, e, i],
|
|
221
|
-
queryFn: () =>
|
|
222
|
+
queryFn: () => d.request(U(`/field-history/${m}/${encodeURIComponent(e)}/${i}`)).then((o) => o.data ?? []),
|
|
222
223
|
enabled: l,
|
|
223
224
|
staleTime: 6e4
|
|
224
225
|
});
|
|
225
|
-
|
|
226
|
+
oe(() => {
|
|
226
227
|
if (!l) return;
|
|
227
|
-
const
|
|
228
|
+
const o = (f) => {
|
|
228
229
|
var W;
|
|
229
230
|
(W = g.current) != null && W.contains(f.target) || w(!1);
|
|
230
231
|
};
|
|
231
|
-
return window.addEventListener("mousedown",
|
|
232
|
+
return window.addEventListener("mousedown", o), () => window.removeEventListener("mousedown", o);
|
|
232
233
|
}, [l]);
|
|
233
|
-
const b = (
|
|
234
|
+
const b = (o, f) => f || (o == null || o === "" ? "—" : h ? h(o) : typeof o == "boolean" || o === "true" || o === "false" ? o === !0 || o === "true" ? "Yes" : "No" : typeof o == "string" && /^\d{4}-\d{2}-\d{2}$/.test(o) ? Wt(o) : typeof o == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(o) ? we(o) : typeof o == "object" ? JSON.stringify(o).slice(0, 60) : String(o).slice(0, 80));
|
|
234
235
|
return /* @__PURE__ */ u("div", { ref: g, className: "relative inline-flex", children: [
|
|
235
236
|
/* @__PURE__ */ n(
|
|
236
237
|
"button",
|
|
237
238
|
{
|
|
238
239
|
type: "button",
|
|
239
|
-
onClick: () => w((
|
|
240
|
+
onClick: () => w((o) => !o),
|
|
240
241
|
title: "Value history",
|
|
241
242
|
className: D(
|
|
242
243
|
"inline-flex items-center rounded p-0.5 transition-opacity",
|
|
243
244
|
l ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
|
|
244
245
|
),
|
|
245
246
|
"data-field-history": !0,
|
|
246
|
-
children: /* @__PURE__ */ n(
|
|
247
|
+
children: /* @__PURE__ */ n(At, { className: "h-3 w-3" })
|
|
247
248
|
}
|
|
248
249
|
),
|
|
249
250
|
l && /* @__PURE__ */ u("div", { className: "absolute left-0 top-full z-40 mt-1 max-h-64 w-[300px] overflow-y-auto rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
|
|
250
251
|
/* @__PURE__ */ n("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Value history" }),
|
|
251
|
-
|
|
252
|
+
a ? /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }) : (p ?? []).length === 0 ? /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "No recorded changes for this field." }) : /* @__PURE__ */ n("div", { className: "space-y-1", children: (p ?? []).map((o, f) => /* @__PURE__ */ u(
|
|
252
253
|
"div",
|
|
253
254
|
{
|
|
254
255
|
className: "rounded px-1 py-1 text-[11.5px] leading-snug hover:bg-slate-50 dark:hover:bg-muted",
|
|
255
256
|
children: [
|
|
256
257
|
/* @__PURE__ */ u("span", { className: "flex items-baseline justify-between gap-2", children: [
|
|
257
|
-
/* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: b(
|
|
258
|
+
/* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: b(o.value, o.display) }),
|
|
258
259
|
x && f > 0 && /* @__PURE__ */ n(
|
|
259
260
|
"button",
|
|
260
261
|
{
|
|
261
262
|
type: "button",
|
|
262
263
|
onClick: () => {
|
|
263
|
-
x(
|
|
264
|
+
x(o.value ?? null), w(!1);
|
|
264
265
|
},
|
|
265
266
|
className: "shrink-0 rounded border border-slate-200 px-1.5 py-px text-[10px] text-slate-500 hover:border-nvr-cyan/60 hover:text-nvr-navy dark:border-border dark:hover:text-nvr-cyan",
|
|
266
267
|
children: "Restore"
|
|
@@ -268,20 +269,20 @@ function Dn({
|
|
|
268
269
|
)
|
|
269
270
|
] }),
|
|
270
271
|
/* @__PURE__ */ u("span", { className: "block text-[10.5px] text-slate-400", children: [
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
o.action === "create" ? "initial value" : "changed",
|
|
273
|
+
o.timestamp ? ` · ${we(o.timestamp)}` : "",
|
|
274
|
+
o.user_name ? ` · ${o.user_name}` : "",
|
|
275
|
+
o.origin && o.origin.kind !== "user" && /* @__PURE__ */ n(
|
|
275
276
|
"span",
|
|
276
277
|
{
|
|
277
|
-
className:
|
|
278
|
-
children:
|
|
278
|
+
className: o.origin.kind === "integration" ? "ml-1 rounded bg-purple-500/10 px-1 py-px text-[9.5px] font-medium text-purple-700 dark:text-purple-400" : o.origin.kind === "import" ? "ml-1 rounded bg-sky-500/10 px-1 py-px text-[9.5px] font-medium text-sky-700 dark:text-sky-400" : "ml-1 rounded bg-amber-500/10 px-1 py-px text-[9.5px] font-medium text-amber-700 dark:text-amber-400",
|
|
279
|
+
children: o.origin.label ?? o.origin.kind
|
|
279
280
|
}
|
|
280
281
|
)
|
|
281
282
|
] }),
|
|
282
|
-
|
|
283
|
+
o.note && /* @__PURE__ */ u("span", { className: "block text-[10.5px] italic text-slate-500 dark:text-slate-400", children: [
|
|
283
284
|
"“",
|
|
284
|
-
|
|
285
|
+
o.note,
|
|
285
286
|
"”"
|
|
286
287
|
] })
|
|
287
288
|
]
|
|
@@ -291,34 +292,34 @@ function Dn({
|
|
|
291
292
|
] })
|
|
292
293
|
] });
|
|
293
294
|
}
|
|
294
|
-
function
|
|
295
|
+
function Kn({
|
|
295
296
|
collection: m,
|
|
296
297
|
itemId: e,
|
|
297
298
|
field: i
|
|
298
299
|
}) {
|
|
299
|
-
const h = ie(), x =
|
|
300
|
+
const h = ie(), x = nt(), { data: d } = le({
|
|
300
301
|
queryKey: ["field-watch-config"],
|
|
301
|
-
queryFn: () => h.request(
|
|
302
|
+
queryFn: () => h.request(U("/field-watches/config")).then((a) => a.data).catch(() => ({ enabled: !1 })),
|
|
302
303
|
staleTime: 5 * 6e4
|
|
303
304
|
}), l = ["field-watch-self", m, e], { data: w = [] } = le({
|
|
304
305
|
queryKey: l,
|
|
305
|
-
queryFn: () => h.request(
|
|
306
|
-
enabled: !!(
|
|
306
|
+
queryFn: () => h.request(U("/field-watches/self", { collection: m, item_id: e })).then((a) => a.data ?? []).catch(() => []),
|
|
307
|
+
enabled: !!(d != null && d.enabled),
|
|
307
308
|
staleTime: 6e4
|
|
308
|
-
}), g = w.includes(i), p =
|
|
309
|
+
}), g = w.includes(i), p = Ct({
|
|
309
310
|
mutationFn: () => g ? h.request(
|
|
310
|
-
|
|
311
|
+
Kt(
|
|
311
312
|
`/field-watches/self?collection=${encodeURIComponent(m)}&field=${encodeURIComponent(i)}&item_id=${encodeURIComponent(e)}`
|
|
312
313
|
)
|
|
313
314
|
) : h.request(ve("/field-watches/self", { collection: m, field: i, item_id: e })),
|
|
314
315
|
onSuccess: () => {
|
|
315
|
-
x.invalidateQueries({ queryKey: l }),
|
|
316
|
+
x.invalidateQueries({ queryKey: l }), ae.success(
|
|
316
317
|
g ? "No longer watching this field" : "Watching — you will be notified when it changes"
|
|
317
318
|
);
|
|
318
319
|
},
|
|
319
|
-
onError: () =>
|
|
320
|
+
onError: () => ae.error("Could not update the watch")
|
|
320
321
|
});
|
|
321
|
-
return
|
|
322
|
+
return d != null && d.enabled ? /* @__PURE__ */ n(
|
|
322
323
|
"button",
|
|
323
324
|
{
|
|
324
325
|
type: "button",
|
|
@@ -326,42 +327,42 @@ function Mn({
|
|
|
326
327
|
title: g ? "Stop watching this field on this record" : "Watch this field on this record",
|
|
327
328
|
"data-field-watch": i,
|
|
328
329
|
className: `rounded p-0.5 transition-colors ${g ? "text-nvr-navy dark:text-nvr-cyan" : "text-slate-300 hover:text-slate-500"}`,
|
|
329
|
-
children: g ? /* @__PURE__ */ n(
|
|
330
|
+
children: g ? /* @__PURE__ */ n(Tt, { className: "h-3 w-3" }) : /* @__PURE__ */ n(Et, { className: "h-3 w-3" })
|
|
330
331
|
}
|
|
331
332
|
) : null;
|
|
332
333
|
}
|
|
333
|
-
const
|
|
334
|
+
const Fr = jt(function({
|
|
334
335
|
field: e,
|
|
335
336
|
draft: i,
|
|
336
337
|
onChange: h,
|
|
337
338
|
relations: x,
|
|
338
|
-
collection:
|
|
339
|
+
collection: d,
|
|
339
340
|
itemId: l,
|
|
340
341
|
error: w,
|
|
341
342
|
visible: g,
|
|
342
343
|
locked: p,
|
|
343
|
-
layoutAiEnabled:
|
|
344
|
+
layoutAiEnabled: a,
|
|
344
345
|
renderField: b,
|
|
345
|
-
onCountChange:
|
|
346
|
+
onCountChange: o,
|
|
346
347
|
swapButton: f,
|
|
347
348
|
swapContent: W,
|
|
348
|
-
forceVisible:
|
|
349
|
+
forceVisible: rt,
|
|
349
350
|
autoFillTick: se
|
|
350
351
|
}) {
|
|
351
|
-
var
|
|
352
|
-
const V =
|
|
352
|
+
var We, Ve, ze, Ge, Qe;
|
|
353
|
+
const V = jn.has(e.interface ?? ""), N = Dt(), y = xn(), _e = nt(), de = ie(), [Ne, z] = ke(!1), s = Zt(), ce = Jt(), Fe = Vt(e.field), G = L(null), P = Bt(), ue = L(null), Ce = L(!1), Re = L({
|
|
353
354
|
required: !1,
|
|
354
355
|
hasError: !1
|
|
355
356
|
});
|
|
356
|
-
|
|
357
|
-
const t = Ce.current ?
|
|
358
|
-
if (!t || (
|
|
357
|
+
oe(() => {
|
|
358
|
+
const t = Ce.current ? sn(ue.current) : null;
|
|
359
|
+
if (!t || (dn(t, { ...Re.current, errorId: `${P}-error` }), t.hasAttribute("aria-label"))) return;
|
|
359
360
|
t.id || (t.id = `${P}-control`);
|
|
360
361
|
const r = t.tagName === "BUTTON" ? `${P} ${t.id}` : P;
|
|
361
362
|
t.getAttribute("aria-labelledby") !== r && t.setAttribute("aria-labelledby", r);
|
|
362
363
|
});
|
|
363
364
|
const Le = p && !V, Se = L(null);
|
|
364
|
-
|
|
365
|
+
oe(() => {
|
|
365
366
|
const t = Se.current;
|
|
366
367
|
if (!t) return;
|
|
367
368
|
if (!Le) {
|
|
@@ -371,41 +372,41 @@ const wr = Et(function({
|
|
|
371
372
|
const r = typeof document < "u" ? document.activeElement : null;
|
|
372
373
|
r instanceof HTMLElement && t.contains(r) && r.blur(), t.setAttribute("inert", "");
|
|
373
374
|
}, [Le, se]);
|
|
374
|
-
const Q = e.field, $e =
|
|
375
|
+
const Q = e.field, $e = Je(
|
|
375
376
|
(t) => {
|
|
376
377
|
p || h(Q, t);
|
|
377
378
|
},
|
|
378
379
|
[p, h, Q]
|
|
379
|
-
),
|
|
380
|
-
(t) =>
|
|
381
|
-
[
|
|
382
|
-
),
|
|
383
|
-
onContextMenu:
|
|
384
|
-
onKeyDown:
|
|
385
|
-
menu:
|
|
386
|
-
confirmSaveFrom:
|
|
380
|
+
), lt = Je(
|
|
381
|
+
(t) => o == null ? void 0 : o(Q, t),
|
|
382
|
+
[o, Q]
|
|
383
|
+
), ot = L(void 0), qe = L(void 0), Ae = L(void 0), Te = !p && !e.readonly && !e.computed_formula && !(e.hidden && !e.layout_assigned) && !et(e), {
|
|
384
|
+
onContextMenu: at,
|
|
385
|
+
onKeyDown: it,
|
|
386
|
+
menu: st,
|
|
387
|
+
confirmSaveFrom: dt,
|
|
387
388
|
openedBy: me
|
|
388
|
-
} =
|
|
389
|
+
} = It({
|
|
389
390
|
wrapperRef: G,
|
|
390
391
|
field: e,
|
|
391
392
|
value: i[e.field],
|
|
392
393
|
relations: x,
|
|
393
|
-
collection:
|
|
394
|
+
collection: d,
|
|
394
395
|
itemId: l,
|
|
395
|
-
openRelated:
|
|
396
|
+
openRelated: s == null ? void 0 : s.openRelated,
|
|
396
397
|
editable: Te
|
|
397
|
-
}), j =
|
|
398
|
+
}), j = en(G), ct = vn(), Ee = s == null ? void 0 : s.remoteChanges[e.field], M = s == null ? void 0 : s.lockReasons[e.field], T = s == null ? void 0 : s.applyToLines[e.field], Pe = (We = s == null ? void 0 : s.duplicates) == null ? void 0 : We[e.field], R = qn(), ut = (R == null ? void 0 : R.applied(e.field)) ?? !1, je = (R == null ? void 0 : R.hintFor(e.field)) ?? null, pe = yn(R, e.field, Te), he = () => {
|
|
398
399
|
var t, r;
|
|
399
|
-
return ((t = ue.current) == null ? void 0 : t.querySelector(
|
|
400
|
-
}, Y =
|
|
401
|
-
async function
|
|
400
|
+
return ((t = ue.current) == null ? void 0 : t.querySelector(Ie)) ?? ((r = G.current) == null ? void 0 : r.querySelector(Ie));
|
|
401
|
+
}, Y = Mt(e._overrides, a, Bn(e)), fe = !!(s != null && s.fromAutofill) && !!e._overrides && e._overrides[Ot] === !0;
|
|
402
|
+
async function mt() {
|
|
402
403
|
var t;
|
|
403
|
-
if (Y.perField) return
|
|
404
|
+
if (Y.perField) return pt();
|
|
404
405
|
z(!0);
|
|
405
406
|
try {
|
|
406
407
|
const r = await de.request(
|
|
407
408
|
ve("/ai/generate", {
|
|
408
|
-
collection:
|
|
409
|
+
collection: d,
|
|
409
410
|
item_id: l !== "new" ? l : void 0,
|
|
410
411
|
field: e.field
|
|
411
412
|
})
|
|
@@ -416,31 +417,31 @@ const wr = Et(function({
|
|
|
416
417
|
z(!1);
|
|
417
418
|
}
|
|
418
419
|
}
|
|
419
|
-
async function
|
|
420
|
+
async function pt() {
|
|
420
421
|
var r, c, k, S;
|
|
421
422
|
const t = {};
|
|
422
|
-
for (const _ of ((r =
|
|
423
|
+
for (const _ of ((r = Ht(e._overrides)) == null ? void 0 : r.tokens) ?? []) _ in i && (t[_] = i[_]);
|
|
423
424
|
z(!0);
|
|
424
425
|
try {
|
|
425
426
|
const _ = await de.request(
|
|
426
427
|
ve("/ai/field-fill", {
|
|
427
|
-
collection:
|
|
428
|
-
layout_id: (
|
|
428
|
+
collection: d,
|
|
429
|
+
layout_id: (s == null ? void 0 : s.layoutId) ?? null,
|
|
429
430
|
field: e.field,
|
|
430
431
|
item_id: l && l !== "new" ? l : null,
|
|
431
432
|
values: t
|
|
432
433
|
})
|
|
433
434
|
), F = (c = _.data) == null ? void 0 : c.value;
|
|
434
|
-
typeof F == "string" && F !== "" ? h(e.field, F) :
|
|
435
|
+
typeof F == "string" && F !== "" ? h(e.field, F) : ae.info("The AI had nothing to write here"), (S = (k = _.data) == null ? void 0 : k.missing) != null && S.length && ae.info(`Filled without ${_.data.missing.join(", ")} (empty or not visible to you)`);
|
|
435
436
|
} catch (_) {
|
|
436
|
-
|
|
437
|
+
Ut(_, "AI fill failed", { action: "Fill with AI" });
|
|
437
438
|
} finally {
|
|
438
439
|
z(!1);
|
|
439
440
|
}
|
|
440
441
|
}
|
|
441
|
-
const E =
|
|
442
|
+
const E = cn(e.dependency_config), Be = E.flatMap((t) => {
|
|
442
443
|
const r = x.find(
|
|
443
|
-
(k) => k.one_collection ===
|
|
444
|
+
(k) => k.one_collection === d && k.one_field === t.parent_field
|
|
444
445
|
);
|
|
445
446
|
if (!r) return [];
|
|
446
447
|
if (r.junction_field) return [{ rule: t, rel: r }];
|
|
@@ -448,11 +449,11 @@ const wr = Et(function({
|
|
|
448
449
|
(k) => k.many_collection === r.many_collection && k.id !== r.id
|
|
449
450
|
);
|
|
450
451
|
return c != null && c.many_field ? [{ rule: t, rel: { ...r, junction_field: c.many_field } }] : [];
|
|
451
|
-
}),
|
|
452
|
-
queries:
|
|
452
|
+
}), ht = Ft({
|
|
453
|
+
queries: Be.map(({ rel: t }) => ({
|
|
453
454
|
queryKey: ["m2m-items", t.many_collection, t.many_field, l],
|
|
454
455
|
queryFn: () => de.request(
|
|
455
|
-
|
|
456
|
+
U(`/items/${t.many_collection}`, {
|
|
456
457
|
filter: JSON.stringify({ [t.many_field]: { _eq: l } }),
|
|
457
458
|
limit: 200,
|
|
458
459
|
fields: `id,${t.junction_field}`
|
|
@@ -461,26 +462,26 @@ const wr = Et(function({
|
|
|
461
462
|
enabled: !!l && l !== "new",
|
|
462
463
|
staleTime: 3e4
|
|
463
464
|
}))
|
|
464
|
-
}),
|
|
465
|
-
|
|
465
|
+
}), ft = Object.fromEntries(
|
|
466
|
+
Be.map(({ rule: t, rel: r }, c) => {
|
|
466
467
|
var _;
|
|
467
468
|
const k = r.one_field ?? `${r.many_collection}.${r.junction_field}`, S = (y == null ? void 0 : y.getStagedUnlinks(k)) ?? /* @__PURE__ */ new Set();
|
|
468
469
|
return [
|
|
469
470
|
t.parent_field,
|
|
470
|
-
(((_ =
|
|
471
|
+
(((_ = ht[c]) == null ? void 0 : _.data) ?? []).filter((F) => !S.has(F.id)).map((F) => F[r.junction_field])
|
|
471
472
|
];
|
|
472
473
|
})
|
|
473
|
-
), J =
|
|
474
|
-
if (!
|
|
474
|
+
), J = Qt()[e.field] ?? [];
|
|
475
|
+
if (!rt && (!g || !e.layout_assigned && (e.hidden || un.has(e.field))))
|
|
475
476
|
return null;
|
|
476
|
-
const xe = i[e.field] ?? null, X =
|
|
477
|
+
const xe = i[e.field] ?? null, X = wn(e, ct), C = X.label ?? K(e.field);
|
|
477
478
|
Ce.current = C !== "", Re.current = {
|
|
478
|
-
required: !!(e.required ||
|
|
479
|
+
required: !!(e.required || Xe(e.validation_rules, i)),
|
|
479
480
|
hasError: !!w
|
|
480
481
|
};
|
|
481
|
-
const q =
|
|
482
|
+
const q = et(e), De = q ? null : kn(e), Me = q || !(l === "new" || !l || (Ve = N == null ? void 0 : N.dirtyFields) != null && Ve.has(e.field)) ? null : $n(e, i), xt = !q && !p && !e.readonly && ((ze = e._overrides) == null ? void 0 : ze.repeat_last) === !0, yt = fn(e, i), bt = (Qe = (Ge = mn(e.options)) == null ? void 0 : Ge.auto_id) == null ? void 0 : Qe.pattern, v = (() => {
|
|
482
483
|
const t = x.find(
|
|
483
|
-
(c) => c.one_collection ===
|
|
484
|
+
(c) => c.one_collection === d && c.one_field === e.field
|
|
484
485
|
);
|
|
485
486
|
if (!t) return null;
|
|
486
487
|
if (t.junction_field) return t;
|
|
@@ -488,17 +489,17 @@ const wr = Et(function({
|
|
|
488
489
|
(c) => c.many_collection === t.many_collection && c.id !== t.id
|
|
489
490
|
);
|
|
490
491
|
return r ? { ...t, junction_field: r.many_field } : null;
|
|
491
|
-
})(), ye = v ? null : x.find((t) => t.many_collection ===
|
|
492
|
+
})(), ye = v ? null : x.find((t) => t.many_collection === d && t.many_field === e.field) ?? null, be = v ? x.find(
|
|
492
493
|
(t) => t.many_collection === v.many_collection && t.many_field === v.junction_field && t.id !== v.id
|
|
493
|
-
) ?? null : null, B = v ? v.one_field ?? `${v.many_collection}.${v.junction_field}` : null,
|
|
494
|
+
) ?? null : null, B = v ? v.one_field ?? `${v.many_collection}.${v.junction_field}` : null, Oe = B ? (y == null ? void 0 : y.getStagedLinks(B)) ?? [] : [], gt = v ? (_e.getQueryData([
|
|
494
495
|
"m2m-items",
|
|
495
496
|
v.many_collection,
|
|
496
497
|
v.many_field,
|
|
497
498
|
l
|
|
498
|
-
]) ?? []).map((t) => t[v.junction_field]) : [],
|
|
499
|
+
]) ?? []).map((t) => t[v.junction_field]) : [], He = v ? Oe[0] ?? gt[0] ?? null : xe, Ke = (be == null ? void 0 : be.one_collection) ?? (ye == null ? void 0 : ye.one_collection) ?? void 0, Z = (t) => {
|
|
499
500
|
var r;
|
|
500
|
-
return ((N == null ? void 0 : N.collection) ===
|
|
501
|
-
}, A =
|
|
501
|
+
return ((N == null ? void 0 : N.collection) === d ? (r = N == null ? void 0 : N.fieldLabels) == null ? void 0 : r[t] : void 0) ?? K(String(t));
|
|
502
|
+
}, A = pn({
|
|
502
503
|
rules: E,
|
|
503
504
|
// A parent whose value THIS field's own pick derived must not narrow this
|
|
504
505
|
// field's options — otherwise picking a region locks the region picker
|
|
@@ -510,40 +511,40 @@ const wr = Et(function({
|
|
|
510
511
|
},
|
|
511
512
|
parentValue: (t) => {
|
|
512
513
|
if (i[t] != null) return i[t];
|
|
513
|
-
const r = x.find(($) => $.one_collection ===
|
|
514
|
+
const r = x.find(($) => $.one_collection === d && $.one_field === t);
|
|
514
515
|
if (!r) return null;
|
|
515
516
|
let c = r;
|
|
516
517
|
if (!c.junction_field) {
|
|
517
518
|
const $ = x.find(
|
|
518
|
-
(
|
|
519
|
+
(Ye) => Ye.many_collection === r.many_collection && Ye.id !== r.id
|
|
519
520
|
);
|
|
520
521
|
if ($ != null && $.many_field) c = { ...r, junction_field: $.many_field };
|
|
521
522
|
else return null;
|
|
522
523
|
}
|
|
523
|
-
const k = c.one_field ?? `${c.many_collection}.${c.junction_field}`, S = (y == null ? void 0 : y.getStagedLinks(k)) ?? [], _ =
|
|
524
|
+
const k = c.one_field ?? `${c.many_collection}.${c.junction_field}`, S = (y == null ? void 0 : y.getStagedLinks(k)) ?? [], _ = ft[t] ?? [], F = [...new Set([...S, ..._].map(($) => String($)))];
|
|
524
525
|
return F.length === 0 ? null : F.length === 1 ? F[0] : F;
|
|
525
526
|
},
|
|
526
527
|
parentOptionFilter: (t) => {
|
|
527
528
|
var c;
|
|
528
|
-
const r = (N == null ? void 0 : N.collection) ===
|
|
529
|
-
return r ?
|
|
529
|
+
const r = (N == null ? void 0 : N.collection) === d ? (c = N.fieldOptionFilters) == null ? void 0 : c[t] : void 0;
|
|
530
|
+
return r ? An(r, i, l) : void 0;
|
|
530
531
|
}
|
|
531
|
-
}), O = A.filter ?
|
|
532
|
-
function
|
|
532
|
+
}), O = A.filter ? Ln(ot, A.filter, Sn) : A.filter, H = A.satisfiedParents.map(Z), I = A.satisfiedParents, vt = A.unsatisfiedParents.length ? Z(A.unsatisfiedParents[0]) : null, ge = A.missingRequiredParents, Ue = ge.length ? Z(ge[0]) : null;
|
|
533
|
+
function wt() {
|
|
533
534
|
const t = Ae.current;
|
|
534
535
|
if (t && t.src === e) return t.value;
|
|
535
536
|
const r = { ...e, readonly: !0 };
|
|
536
537
|
return Ae.current = { src: e, value: r }, r;
|
|
537
538
|
}
|
|
538
|
-
function
|
|
539
|
-
const t =
|
|
539
|
+
function kt() {
|
|
540
|
+
const t = Dn(
|
|
540
541
|
I,
|
|
541
542
|
e.field,
|
|
542
543
|
y == null ? void 0 : y.getDerivedOrigin
|
|
543
|
-
), r = JSON.stringify([
|
|
544
|
+
), r = JSON.stringify([H, I, t]), c = qe.current;
|
|
544
545
|
if (c && c.sig === r && c.onChange === h) return c.value;
|
|
545
546
|
const k = {
|
|
546
|
-
labels:
|
|
547
|
+
labels: H,
|
|
547
548
|
keys: I,
|
|
548
549
|
clearable: t,
|
|
549
550
|
onClear: t.length > 0 ? (S) => {
|
|
@@ -552,7 +553,7 @@ const wr = Et(function({
|
|
|
552
553
|
};
|
|
553
554
|
return qe.current = { sig: r, onChange: h, value: k }, k;
|
|
554
555
|
}
|
|
555
|
-
function
|
|
556
|
+
function _t() {
|
|
556
557
|
for (const t of I) {
|
|
557
558
|
const r = document.querySelector(`[data-field="${t}"]`);
|
|
558
559
|
r && (r.scrollIntoView({ behavior: "smooth", block: "center" }), r.style.transition = "box-shadow 0.15s ease", r.style.boxShadow = "0 0 0 2px rgb(var(--nvr-cyan-rgb, 0 206 255)), 0 0 0 5px rgb(var(--nvr-cyan-rgb, 0 206 255) / 0.25)", r.style.borderRadius = "12px", setTimeout(() => {
|
|
@@ -562,14 +563,14 @@ const wr = Et(function({
|
|
|
562
563
|
}, 900));
|
|
563
564
|
}
|
|
564
565
|
}
|
|
565
|
-
const
|
|
566
|
-
const t = v && B ?
|
|
566
|
+
const Nt = () => {
|
|
567
|
+
const t = v && B ? He : i[e.field];
|
|
567
568
|
if (t != null && t !== "" && !(Array.isArray(t) && !t.length) && (ce == null || ce({
|
|
568
569
|
field: e.field,
|
|
569
|
-
label: C ||
|
|
570
|
+
label: C || K(e.field),
|
|
570
571
|
parents: E.map((r) => r.parent_field).filter(Boolean)
|
|
571
572
|
})), v && B) {
|
|
572
|
-
for (const c of
|
|
573
|
+
for (const c of Oe) y == null || y.unstageLink(B, c);
|
|
573
574
|
const r = _e.getQueryData([
|
|
574
575
|
"m2m-items",
|
|
575
576
|
v.many_collection,
|
|
@@ -587,27 +588,27 @@ const wr = Et(function({
|
|
|
587
588
|
{
|
|
588
589
|
ref: G,
|
|
589
590
|
"data-field": e.field,
|
|
590
|
-
"data-field-collection":
|
|
591
|
+
"data-field-collection": d,
|
|
591
592
|
"data-field-interface": e.interface ?? void 0,
|
|
592
593
|
"data-autofill-check": fe ? "" : void 0,
|
|
593
594
|
className: D(
|
|
594
595
|
"group/fieldrow space-y-1.5",
|
|
595
596
|
fe && "rounded-md bg-amber-50/60 p-1.5 ring-1 ring-amber-300 dark:bg-amber-500/10 dark:ring-amber-500/40"
|
|
596
597
|
),
|
|
597
|
-
onContextMenu:
|
|
598
|
-
onKeyDown:
|
|
598
|
+
onContextMenu: at,
|
|
599
|
+
onKeyDown: it,
|
|
599
600
|
onFocusCapture: j.onFocusCapture,
|
|
600
601
|
children: [
|
|
601
|
-
|
|
602
|
+
st,
|
|
602
603
|
E.length > 0 && /* @__PURE__ */ n(
|
|
603
|
-
|
|
604
|
+
hn,
|
|
604
605
|
{
|
|
605
606
|
cascadeRules: E,
|
|
606
607
|
cascadeFilter: O,
|
|
607
|
-
currentValue:
|
|
608
|
+
currentValue: He,
|
|
608
609
|
relatedCollection: Ke,
|
|
609
610
|
missingRequiredParents: ge,
|
|
610
|
-
onClear:
|
|
611
|
+
onClear: Nt
|
|
611
612
|
}
|
|
612
613
|
),
|
|
613
614
|
(C !== "" || J.length > 0) && /* @__PURE__ */ u(
|
|
@@ -616,35 +617,35 @@ const wr = Et(function({
|
|
|
616
617
|
className: "flex flex-wrap items-center gap-1.5 min-h-[1.5rem]",
|
|
617
618
|
"data-pd-row": pe ? "" : void 0,
|
|
618
619
|
children: [
|
|
619
|
-
C !== "" && /* @__PURE__ */ u(
|
|
620
|
-
/* @__PURE__ */ n(
|
|
621
|
-
(e.required ||
|
|
622
|
-
|
|
620
|
+
C !== "" && /* @__PURE__ */ u(Gt, { id: P, "data-field-label": !0, className: "text-sm font-medium", children: [
|
|
621
|
+
/* @__PURE__ */ n(Ze, { text: C, collection: d }),
|
|
622
|
+
(e.required || Xe(e.validation_rules, i)) && /* @__PURE__ */ n("span", { className: "ml-0.5 text-destructive", children: "*" }),
|
|
623
|
+
_n(e) && /* @__PURE__ */ n(Nn, {})
|
|
623
624
|
] }),
|
|
624
625
|
X.note && /* @__PURE__ */ n(ee, { delayDuration: 100, children: /* @__PURE__ */ u(te, { children: [
|
|
625
|
-
/* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ n(
|
|
626
|
-
/* @__PURE__ */ n(re, { side: "top", className: "max-w-[240px] text-[12px]", children: (
|
|
626
|
+
/* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ n(Rt, { className: "h-3.5 w-3.5 shrink-0 cursor-help text-slate-400 hover:text-slate-600" }) }),
|
|
627
|
+
/* @__PURE__ */ n(re, { side: "top", className: "max-w-[240px] text-[12px]", children: (s == null ? void 0 : s.glossaryHelp) === !1 ? X.note : /* @__PURE__ */ n(Ze, { text: X.note, collection: d }) })
|
|
627
628
|
] }) }),
|
|
628
|
-
Fe && /* @__PURE__ */ n(
|
|
629
|
+
Fe && /* @__PURE__ */ n(zt, { source: Fe, label: C }),
|
|
629
630
|
!q && l && l !== "new" && /* @__PURE__ */ n(
|
|
630
|
-
|
|
631
|
+
Hn,
|
|
631
632
|
{
|
|
632
|
-
collection:
|
|
633
|
+
collection: d,
|
|
633
634
|
itemId: l,
|
|
634
635
|
field: e.field,
|
|
635
636
|
onRestore: e.readonly ? void 0 : (t) => h(e.field, t)
|
|
636
637
|
}
|
|
637
638
|
),
|
|
638
|
-
!q && l && l !== "new" && /* @__PURE__ */ n(
|
|
639
|
-
!q && l && l !== "new" && /* @__PURE__ */ n(
|
|
640
|
-
l && l !== "new" &&
|
|
641
|
-
|
|
642
|
-
|
|
639
|
+
!q && l && l !== "new" && /* @__PURE__ */ n(Kn, { collection: d, itemId: l, field: e.field }),
|
|
640
|
+
!q && l && l !== "new" && /* @__PURE__ */ n(ln, { field: e.field, label: C || K(e.field) }),
|
|
641
|
+
l && l !== "new" && yt && /* @__PURE__ */ n(On, { collection: d, itemId: l, field: e.field }),
|
|
642
|
+
xt && /* @__PURE__ */ n(
|
|
643
|
+
Fn,
|
|
643
644
|
{
|
|
644
|
-
collection:
|
|
645
|
+
collection: d,
|
|
645
646
|
itemId: l,
|
|
646
647
|
field: e.field,
|
|
647
|
-
label: C ||
|
|
648
|
+
label: C || K(e.field),
|
|
648
649
|
onFill: (t) => h(e.field, t)
|
|
649
650
|
}
|
|
650
651
|
),
|
|
@@ -652,13 +653,13 @@ const wr = Et(function({
|
|
|
652
653
|
"button",
|
|
653
654
|
{
|
|
654
655
|
type: "button",
|
|
655
|
-
onClick:
|
|
656
|
+
onClick: mt,
|
|
656
657
|
disabled: Ne,
|
|
657
658
|
"data-ai-fill": Y.perField ? e.field : void 0,
|
|
658
659
|
className: "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[10px] font-medium text-nvr-cyan hover:bg-nvr-cyan/10 disabled:opacity-50 transition-colors",
|
|
659
660
|
title: "Generate with AI",
|
|
660
661
|
children: [
|
|
661
|
-
Ne ? /* @__PURE__ */ n(
|
|
662
|
+
Ne ? /* @__PURE__ */ n(Lt, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(St, { className: "h-3 w-3" }),
|
|
662
663
|
"AI"
|
|
663
664
|
]
|
|
664
665
|
}
|
|
@@ -710,20 +711,20 @@ const wr = Et(function({
|
|
|
710
711
|
] })
|
|
711
712
|
] }) }),
|
|
712
713
|
/* @__PURE__ */ n(
|
|
713
|
-
|
|
714
|
+
an,
|
|
714
715
|
{
|
|
715
|
-
collection:
|
|
716
|
+
collection: d,
|
|
716
717
|
kind: "field",
|
|
717
718
|
name: e.field,
|
|
718
719
|
label: C
|
|
719
720
|
}
|
|
720
721
|
),
|
|
721
|
-
(p || e.readonly) && M ? /* @__PURE__ */ n(
|
|
722
|
-
/* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ n("span", { className: "inline-flex items-center text-amber-400 dark:text-amber-500", children: /* @__PURE__ */ n(
|
|
722
|
+
(p || e.readonly) && M ? /* @__PURE__ */ n(tn, { reason: M, onHover: s == null ? void 0 : s.onLockHover }) : p ? /* @__PURE__ */ n(ee, { delayDuration: 200, children: /* @__PURE__ */ u(te, { children: [
|
|
723
|
+
/* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ n("span", { className: "inline-flex items-center text-amber-400 dark:text-amber-500", children: /* @__PURE__ */ n($t, { className: "h-3 w-3" }) }) }),
|
|
723
724
|
/* @__PURE__ */ n(re, { side: "top", className: "text-[12px]", children: "This field is locked" })
|
|
724
725
|
] }) }) : null,
|
|
725
726
|
E.length > 0 && (() => {
|
|
726
|
-
const t = !!O && Object.keys(O).length > 0 &&
|
|
727
|
+
const t = !!O && Object.keys(O).length > 0 && H.length > 0, r = E.map(
|
|
727
728
|
(c) => Z(String(c.parent_field))
|
|
728
729
|
);
|
|
729
730
|
return /* @__PURE__ */ n(ee, { delayDuration: 100, children: /* @__PURE__ */ u(te, { children: [
|
|
@@ -732,15 +733,15 @@ const wr = Et(function({
|
|
|
732
733
|
{
|
|
733
734
|
type: "button",
|
|
734
735
|
"aria-label": `Show the fields that narrow ${C || "this list"}`,
|
|
735
|
-
onClick:
|
|
736
|
+
onClick: _t,
|
|
736
737
|
className: D(
|
|
737
738
|
"inline-flex items-center transition-colors",
|
|
738
739
|
t ? "text-nvr-cyan hover:text-nvr-cyan" : "text-slate-300 hover:text-nvr-cyan dark:text-slate-600 dark:hover:text-nvr-cyan"
|
|
739
740
|
),
|
|
740
|
-
children: /* @__PURE__ */ n(
|
|
741
|
+
children: /* @__PURE__ */ n(qt, { className: "h-3 w-3" })
|
|
741
742
|
}
|
|
742
743
|
) }),
|
|
743
|
-
/* @__PURE__ */ n(re, { side: "top", className: "text-[12px]", children: t ? `Filtered by ${
|
|
744
|
+
/* @__PURE__ */ n(re, { side: "top", className: "text-[12px]", children: t ? `Filtered by ${H.join(", ")} — click to highlight` : `Options filter by ${r.join(", ")} once set` })
|
|
744
745
|
] }) });
|
|
745
746
|
})(),
|
|
746
747
|
pe && // Right-anchored: the personal-default control flush with the field's right edge
|
|
@@ -748,7 +749,7 @@ const wr = Et(function({
|
|
|
748
749
|
// Shift+F10 still open the field menu). The slot keeps one box whatever it shows,
|
|
749
750
|
// so nothing to its left moves.
|
|
750
751
|
/* @__PURE__ */ n("span", { className: "ml-auto inline-flex shrink-0 items-center gap-1", children: /* @__PURE__ */ n(
|
|
751
|
-
|
|
752
|
+
bn,
|
|
752
753
|
{
|
|
753
754
|
field: e.field,
|
|
754
755
|
label: C,
|
|
@@ -756,7 +757,7 @@ const wr = Et(function({
|
|
|
756
757
|
confirmOpen: me === "make" || me === "update" ? me : null,
|
|
757
758
|
onConfirm: (t, r) => (
|
|
758
759
|
// After a save the button becomes "Your default": focus goes to the field.
|
|
759
|
-
|
|
760
|
+
dt(t, he, r)
|
|
760
761
|
),
|
|
761
762
|
onUndo: () => {
|
|
762
763
|
R == null || R.undo(e.field), requestAnimationFrame(() => {
|
|
@@ -777,7 +778,7 @@ const wr = Et(function({
|
|
|
777
778
|
}
|
|
778
779
|
),
|
|
779
780
|
j.editor && !p && /* @__PURE__ */ n(
|
|
780
|
-
|
|
781
|
+
nn,
|
|
781
782
|
{
|
|
782
783
|
editor: j.editor,
|
|
783
784
|
confirming: j.confirming,
|
|
@@ -791,7 +792,7 @@ const wr = Et(function({
|
|
|
791
792
|
ref: ue,
|
|
792
793
|
className: D(p && !V && "cursor-not-allowed"),
|
|
793
794
|
"data-tip": (p || e.readonly) && M ? M : void 0,
|
|
794
|
-
onPointerEnter: (p || e.readonly) && M ?
|
|
795
|
+
onPointerEnter: (p || e.readonly) && M ? s == null ? void 0 : s.onLockHover : void 0,
|
|
795
796
|
children: /* @__PURE__ */ n(
|
|
796
797
|
"div",
|
|
797
798
|
{
|
|
@@ -808,10 +809,10 @@ const wr = Et(function({
|
|
|
808
809
|
w && "nvr-shake ring-1 ring-red-400 rounded-md",
|
|
809
810
|
se && "nvr-autofill-glow"
|
|
810
811
|
),
|
|
811
|
-
children: q ? /* @__PURE__ */ n(
|
|
812
|
-
|
|
812
|
+
children: q ? /* @__PURE__ */ n(Cn, { field: e, values: i }) : bt ? /* @__PURE__ */ n(
|
|
813
|
+
Yt,
|
|
813
814
|
{
|
|
814
|
-
collection:
|
|
815
|
+
collection: d,
|
|
815
816
|
field: e,
|
|
816
817
|
draft: i,
|
|
817
818
|
itemId: l
|
|
@@ -821,25 +822,25 @@ const wr = Et(function({
|
|
|
821
822
|
value: xe,
|
|
822
823
|
onChange: $e,
|
|
823
824
|
disabled: p,
|
|
824
|
-
collection:
|
|
825
|
+
collection: d,
|
|
825
826
|
itemId: l,
|
|
826
827
|
relations: x,
|
|
827
828
|
cascadeFilter: O,
|
|
828
|
-
unsatisfiedParentLabel:
|
|
829
|
+
unsatisfiedParentLabel: vt,
|
|
829
830
|
requiredParentLabel: Ue
|
|
830
831
|
}) : /* @__PURE__ */ n(
|
|
831
|
-
|
|
832
|
+
on,
|
|
832
833
|
{
|
|
833
|
-
field: p && V ?
|
|
834
|
+
field: p && V ? wt() : e,
|
|
834
835
|
value: xe,
|
|
835
836
|
onChange: $e,
|
|
836
837
|
relations: x,
|
|
837
|
-
collection:
|
|
838
|
+
collection: d,
|
|
838
839
|
itemId: l,
|
|
839
840
|
cascadeFilter: O,
|
|
840
841
|
requiredParentLabel: Ue,
|
|
841
|
-
narrowedBy:
|
|
842
|
-
onCountChange:
|
|
842
|
+
narrowedBy: H.length > 0 ? kt() : void 0,
|
|
843
|
+
onCountChange: o ? lt : void 0
|
|
843
844
|
}
|
|
844
845
|
)
|
|
845
846
|
},
|
|
@@ -847,7 +848,7 @@ const wr = Et(function({
|
|
|
847
848
|
)
|
|
848
849
|
}
|
|
849
850
|
),
|
|
850
|
-
|
|
851
|
+
De && /* @__PURE__ */ n(Rn, { value: i[e.field], config: De }),
|
|
851
852
|
w && // The message under the field: a red border alone never said WHY (Service End before
|
|
852
853
|
// Start, b01-N5). The form's summary at the top lists it too — and is
|
|
853
854
|
// the ONE live announcement (army11 f3: ten role=alert regions fired at
|
|
@@ -861,25 +862,26 @@ const wr = Et(function({
|
|
|
861
862
|
children: w
|
|
862
863
|
}
|
|
863
864
|
),
|
|
864
|
-
!w &&
|
|
865
|
+
!w && Me && // A soft (warning-only) rule the value breaks: said here, never blocks the save.
|
|
865
866
|
/* @__PURE__ */ n(
|
|
866
867
|
"p",
|
|
867
868
|
{
|
|
868
869
|
"data-field-warning": e.field,
|
|
869
870
|
className: "text-[11.5px] leading-snug text-amber-700 dark:text-amber-400",
|
|
870
|
-
children:
|
|
871
|
+
children: Me
|
|
871
872
|
}
|
|
872
873
|
),
|
|
873
|
-
|
|
874
|
+
je && !ut && /* @__PURE__ */ n(gn, { field: e.field, text: je }),
|
|
875
|
+
Pe && /* @__PURE__ */ n(Xt, { field: e.field, hint: Pe }),
|
|
874
876
|
Ee && /* @__PURE__ */ n(
|
|
875
|
-
|
|
877
|
+
rn,
|
|
876
878
|
{
|
|
877
879
|
change: Ee,
|
|
878
880
|
relatedCollection: Ke ?? null,
|
|
879
|
-
onDismiss: () =>
|
|
880
|
-
onTakeTheirs:
|
|
881
|
+
onDismiss: () => s == null ? void 0 : s.dismissRemoteChange(e.field),
|
|
882
|
+
onTakeTheirs: s != null && s.takeRemoteChange ? () => {
|
|
881
883
|
var t;
|
|
882
|
-
return (t =
|
|
884
|
+
return (t = s.takeRemoteChange) == null ? void 0 : t.call(s, e.field);
|
|
883
885
|
} : void 0
|
|
884
886
|
}
|
|
885
887
|
)
|
|
@@ -889,9 +891,9 @@ const wr = Et(function({
|
|
|
889
891
|
);
|
|
890
892
|
});
|
|
891
893
|
export {
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
894
|
+
Fr as FieldRow,
|
|
895
|
+
Dn as clearableParents,
|
|
896
|
+
Bn as isAiEligible,
|
|
897
|
+
Nr as lineageSummary,
|
|
898
|
+
Mn as useFieldLineage
|
|
897
899
|
};
|