@nivaro/react 0.3.48 → 0.3.50
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/InlineGridField.js +166 -105
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +25 -1
- package/dist/shared/components/CellCopyLayer.js +81 -44
- package/dist/shared/components/CollectionBrowserView.js +306 -297
- package/dist/shared/components/DataTable.js +3 -3
- package/dist/shared/components/FulfilmentPill.js +98 -78
- package/dist/shared/components/ItemEditForm.js +4682 -4570
- package/dist/shared/components/NotificationSourcesCard.js +151 -147
- package/dist/shared/components/ProfileView.js +72 -70
- package/dist/shared/components/QueryTable.js +462 -333
- package/dist/shared/components/imports/ImportConsole.js +4 -4
- package/dist/shared/components/integrations/console/IntegrationsConsole.js +58 -50
- package/dist/shared/components/item-edit/CatalogPickerField.js +1144 -1127
- package/dist/shared/components/item-edit/CloneDialog.js +192 -142
- package/dist/shared/components/item-edit/FieldRenderer.js +127 -126
- package/dist/shared/components/item-edit/FieldRow.js +236 -226
- package/dist/shared/components/item-edit/HeaderTools.js +118 -113
- package/dist/shared/components/item-edit/InlineGridField.js +92 -90
- package/dist/shared/components/item-edit/InlineTableField.js +3091 -2942
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
- package/dist/shared/components/item-edit/PlanGrid.js +162 -162
- package/dist/shared/components/item-edit/PolishFields.js +169 -162
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -181
- package/dist/shared/components/item-edit/SummaryPanel.js +148 -135
- package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
- package/dist/shared/components/item-edit/helpers.js +181 -155
- package/dist/shared/components/item-edit/line-midair.js +201 -0
- package/dist/shared/components/item-edit/soft-rules.js +27 -0
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +65 -65
- package/dist/shared/components/layout-editor/settings/settings-registry.js +4 -4
- package/dist/shared/components/notifications/DeliveryChips.js +9 -9
- package/dist/shared/components/panels/ItemLockBanner.js +414 -358
- package/dist/shared/components/panels/PipelinePanel.js +1171 -975
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- package/dist/shared/components/panels/SlaBreachBanner.js +2 -2
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +384 -380
- package/dist/shared/components/profile/PersonProfile.js +23 -21
- package/dist/shared/components/profile/SignedInDevices.js +126 -0
- package/dist/shared/components/queue/QueueItemSheet.js +38 -37
- package/dist/shared/components/queue/QueueWorklist.js +870 -827
- package/dist/shared/components/queue/column-chooser.js +21 -0
- package/dist/shared/components/queue/live-state-aspect.js +6 -0
- package/dist/shared/components/support/SupportView.js +1 -1
- package/dist/shared/components/ui/number-draft-input.js +93 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
- package/dist/shared/lib/edit-lock-fields.js +7 -0
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/reimport-visibility.js +10 -0
- package/package.json +1 -1
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
import { jsxs as d, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Info as
|
|
4
|
-
import { memo as
|
|
2
|
+
import { useQueryClient as Ge, useQueries as bt, useQuery as re, useMutation as gt } from "@tanstack/react-query";
|
|
3
|
+
import { Info as vt, Loader2 as wt, Sparkles as kt, Lock as _t, SlidersHorizontal as Nt, History as Ft, BellRing as Ct, Bell as Lt, Sigma as Rt } from "lucide-react";
|
|
4
|
+
import { memo as St, useState as ve, useRef as S, useId as $t, useEffect as le, useCallback as He } from "react";
|
|
5
5
|
import { toast as oe } from "sonner";
|
|
6
|
-
import { useParentDraft as
|
|
7
|
-
import { showsAiButton as
|
|
8
|
-
import { get as K, del as
|
|
9
|
-
import { toastError as
|
|
6
|
+
import { useParentDraft as qt, useNivaroClient as ie } from "../../context.js";
|
|
7
|
+
import { showsAiButton as At, AUTOFILL_CHECK_KEY as Tt, readAiFill as Et } from "../../lib/ai-fill.js";
|
|
8
|
+
import { get as K, del as Pt, post as ge } from "../../lib/commands.js";
|
|
9
|
+
import { toastError as jt } from "../../lib/error-toast.js";
|
|
10
10
|
import { titleCase as Z, cn as j } from "../../lib/utils.js";
|
|
11
|
-
import { GlossaryLabel as
|
|
12
|
-
import { useFieldSource as
|
|
11
|
+
import { GlossaryLabel as We } from "../ai/GlossaryText.js";
|
|
12
|
+
import { useFieldSource as Bt, FieldSourceInfo as Ot } from "../ConfigReadBack.js";
|
|
13
13
|
import { Label as Dt } from "../ui/label.js";
|
|
14
14
|
import { TooltipProvider as I, Tooltip as ee, TooltipTrigger as te, TooltipContent as ne } from "../ui/tooltip.js";
|
|
15
|
-
import { useAddendumFields as
|
|
16
|
-
import { AutoIdPreviewField as
|
|
17
|
-
import { FOCUSABLE as
|
|
18
|
-
import { useFieldAffordances as
|
|
19
|
-
import { FieldCommentButton as
|
|
20
|
-
import { FieldRenderer as
|
|
21
|
-
import { FormHelpVideoButton as
|
|
22
|
-
import { getCascadeFilters as
|
|
23
|
-
import { isDerivedForRecord as
|
|
24
|
-
import { useM2MStaging as
|
|
25
|
-
import { personalDefaultSlotFor as
|
|
26
|
-
import { PersonalDefaultHint as
|
|
27
|
-
import { isDisplayFormulaRow as
|
|
28
|
-
import { keepIfEqual as
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
|
|
15
|
+
import { useAddendumFields as Mt } from "./AddendumFieldContext.js";
|
|
16
|
+
import { AutoIdPreviewField as Kt } from "./AutoIdPreviewField.js";
|
|
17
|
+
import { FOCUSABLE as Ve } from "./entry/entry-keys.js";
|
|
18
|
+
import { useFieldAffordances as Ut, useFieldContextMenu as Ht, usePresenceSoftLock as Wt, LockReasonBadge as Vt, PresenceSoftLockStrip as zt, RemoteChangeGhost as Gt } from "./FieldAffordances.js";
|
|
19
|
+
import { FieldCommentButton as Qt } from "./FieldComments.js";
|
|
20
|
+
import { FieldRenderer as Yt } from "./FieldRenderer.js";
|
|
21
|
+
import { FormHelpVideoButton as Jt } from "./FormHelpVideoButton.js";
|
|
22
|
+
import { getCascadeFilters as Xt, SYSTEM_FIELDS as Zt, parseJson as It, buildCascadeFilter as en, CascadeEffectController as tn } from "./helpers.js";
|
|
23
|
+
import { isDerivedForRecord as nn } from "./live-rollups.js";
|
|
24
|
+
import { useM2MStaging as rn } from "./M2MStagingContext.js";
|
|
25
|
+
import { personalDefaultSlotFor as ln, PersonalDefaultSlot as on } from "./PersonalDefaultControl.js";
|
|
26
|
+
import { PersonalDefaultHint as an } from "./PersonalDefaultPill.js";
|
|
27
|
+
import { isDisplayFormulaRow as ze, usePlacementTextContext as sn, placementFieldText as cn, fieldCounterConfig as dn, fieldIsRecommended as un, RecommendedMarker as mn, RepeatLastButton as pn, DisplayFormulaValue as hn, FieldCounter as xn } from "./placement-behaviour.js";
|
|
28
|
+
import { keepIfEqual as fn, jsonEqual as yn } from "./render-stability.js";
|
|
29
|
+
import { softRuleWarning as bn } from "./soft-rules.js";
|
|
30
|
+
import { usePersonalDefaultsApi as gn } from "./usePersonalDefaults.js";
|
|
31
|
+
import { resolveOptionFilterTokens as vn } from "../../lib/option-filter-tokens.js";
|
|
32
|
+
const wn = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger", "number"]), kn = /* @__PURE__ */ new Set(["string", "text", "richtext", "textarea", "markdown", "json", "csv"]), _n = /* @__PURE__ */ new Set([
|
|
32
33
|
"input",
|
|
33
34
|
"textarea",
|
|
34
35
|
"wysiwyg",
|
|
@@ -36,7 +37,7 @@ const bn = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger",
|
|
|
36
37
|
"input-rich-text-html",
|
|
37
38
|
"rich_text",
|
|
38
39
|
"extension-editorjs"
|
|
39
|
-
]),
|
|
40
|
+
]), Nn = /* @__PURE__ */ new Set([
|
|
40
41
|
"relation-m2o",
|
|
41
42
|
"relation-m2m",
|
|
42
43
|
"select-multiple-m2m",
|
|
@@ -47,71 +48,71 @@ const bn = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger",
|
|
|
47
48
|
"file",
|
|
48
49
|
"files",
|
|
49
50
|
"image"
|
|
50
|
-
]),
|
|
51
|
-
function
|
|
51
|
+
]), Fn = /* @__PURE__ */ new Set(["file", "file-image", "files-m2m", "files", "image"]);
|
|
52
|
+
function Cn(c) {
|
|
52
53
|
const e = c.interface ?? "";
|
|
53
|
-
return
|
|
54
|
+
return Nn.has(e) || e.startsWith("relation-") || e.endsWith("-m2o") || e.endsWith("-m2m") ? !1 : !!(kn.has(c.type ?? "") || _n.has(e) || !e && c.type && !wn.has(c.type));
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
-
const
|
|
56
|
+
function Ln(c, e, u, p) {
|
|
57
|
+
const f = ie();
|
|
57
58
|
return re({
|
|
58
|
-
queryKey: ["field-lineage", c, e,
|
|
59
|
-
queryFn: () =>
|
|
60
|
-
K(`/lineage/${c}/${encodeURIComponent(e)}/${
|
|
59
|
+
queryKey: ["field-lineage", c, e, u],
|
|
60
|
+
queryFn: () => f.request(
|
|
61
|
+
K(`/lineage/${c}/${encodeURIComponent(e)}/${u}`)
|
|
61
62
|
).then((a) => a.data),
|
|
62
63
|
enabled: p,
|
|
63
64
|
staleTime: 3e4
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
+
function cr(c, e = "rows") {
|
|
67
68
|
var l, _, b;
|
|
68
69
|
if (c && (c.kind === "write" || c.kind === "read") && c.formula) {
|
|
69
|
-
const
|
|
70
|
+
const m = (y) => typeof y == "number" ? y.toLocaleString(void 0, { maximumFractionDigits: 2 }) : y == null || y === "" ? "∅" : String(y);
|
|
70
71
|
return `= ${c.formula.replace(/item\.([A-Za-z_][A-Za-z0-9_]*)/g, (y, o) => {
|
|
71
|
-
var
|
|
72
|
-
return
|
|
72
|
+
var x;
|
|
73
|
+
return m((x = c.inputs) == null ? void 0 : x[o]);
|
|
73
74
|
}).replace(/\s*-\s*/g, " − ").replace(/\s*\*\s*/g, " × ").replace(/\s*\/\s*/g, " ÷ ")}`;
|
|
74
75
|
}
|
|
75
76
|
if (!c || c.kind !== "rollup") return null;
|
|
76
|
-
const
|
|
77
|
+
const u = (c.sources ?? []).reduce((m, i) => m + i.rows.length, 0), p = (c.sources ?? []).reduce((m, i) => {
|
|
77
78
|
var y;
|
|
78
|
-
return
|
|
79
|
-
}, 0),
|
|
79
|
+
return m + (((y = i.excluded) == null ? void 0 : y.length) ?? 0);
|
|
80
|
+
}, 0), f = (b = (_ = (l = (c.sources ?? []).find((m) => {
|
|
80
81
|
var i;
|
|
81
|
-
return (i =
|
|
82
|
-
})) == null ? void 0 : l.excluded) == null ? void 0 : _[0]) == null ? void 0 : b.reason, a = [`= ${
|
|
82
|
+
return (i = m.excluded) == null ? void 0 : i.length;
|
|
83
|
+
})) == null ? void 0 : l.excluded) == null ? void 0 : _[0]) == null ? void 0 : b.reason, a = [`= ${u} ${u === 1 ? e.replace(/s$/, "") : e}`];
|
|
83
84
|
return p && a.push(
|
|
84
|
-
`${p} excluded${
|
|
85
|
+
`${p} excluded${f ? ` (${f.replace(/^does not match: /, "")})` : ""}`
|
|
85
86
|
), a.join(" · ");
|
|
86
87
|
}
|
|
87
|
-
function
|
|
88
|
+
function Rn({
|
|
88
89
|
collection: c,
|
|
89
90
|
itemId: e,
|
|
90
|
-
field:
|
|
91
|
+
field: u
|
|
91
92
|
}) {
|
|
92
|
-
const [p,
|
|
93
|
+
const [p, f] = ve(!1), a = S(null), { data: l, isLoading: _ } = Ln(c, e, u, p);
|
|
93
94
|
le(() => {
|
|
94
95
|
if (!p) return;
|
|
95
96
|
const i = (y) => {
|
|
96
97
|
var o;
|
|
97
|
-
(o = a.current) != null && o.contains(y.target) ||
|
|
98
|
+
(o = a.current) != null && o.contains(y.target) || f(!1);
|
|
98
99
|
};
|
|
99
100
|
return window.addEventListener("mousedown", i), () => window.removeEventListener("mousedown", i);
|
|
100
101
|
}, [p]);
|
|
101
|
-
const b = (i) => i == null ? "—" : Number(i).toLocaleString(void 0, { maximumFractionDigits: 2 }),
|
|
102
|
+
const b = (i) => i == null ? "—" : Number(i).toLocaleString(void 0, { maximumFractionDigits: 2 }), m = (l == null ? void 0 : l.stored_value) != null ? Number(l.stored_value) : null;
|
|
102
103
|
return /* @__PURE__ */ d("div", { ref: a, className: "relative inline-flex", children: [
|
|
103
104
|
/* @__PURE__ */ n(
|
|
104
105
|
"button",
|
|
105
106
|
{
|
|
106
107
|
type: "button",
|
|
107
|
-
onClick: () =>
|
|
108
|
+
onClick: () => f((i) => !i),
|
|
108
109
|
title: "Where does this number come from?",
|
|
109
110
|
className: j(
|
|
110
111
|
"inline-flex items-center rounded p-0.5 transition-opacity",
|
|
111
112
|
p ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
|
|
112
113
|
),
|
|
113
114
|
"data-field-lineage": !0,
|
|
114
|
-
children: /* @__PURE__ */ n(
|
|
115
|
+
children: /* @__PURE__ */ n(Rt, { className: "h-3 w-3" })
|
|
115
116
|
}
|
|
116
117
|
),
|
|
117
118
|
p && /* @__PURE__ */ d("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: [
|
|
@@ -141,24 +142,24 @@ function Fn({
|
|
|
141
142
|
] }),
|
|
142
143
|
i.error && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-amber-600 dark:text-amber-400", children: i.error }),
|
|
143
144
|
i.note && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-slate-400", children: i.note }),
|
|
144
|
-
i.rows.length > 0 && /* @__PURE__ */ n("div", { className: "mt-0.5 space-y-px", children: i.rows.map((
|
|
145
|
+
i.rows.length > 0 && /* @__PURE__ */ n("div", { className: "mt-0.5 space-y-px", children: i.rows.map((x) => /* @__PURE__ */ d(
|
|
145
146
|
"div",
|
|
146
147
|
{
|
|
147
148
|
className: "flex items-baseline gap-2 rounded px-1 py-0.5 text-[11.5px] hover:bg-slate-50 dark:hover:bg-muted",
|
|
148
149
|
children: [
|
|
149
|
-
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children:
|
|
150
|
-
/* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums text-slate-800 dark:text-slate-100", children: b(
|
|
150
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: x.label }),
|
|
151
|
+
/* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums text-slate-800 dark:text-slate-100", children: b(x.value) }),
|
|
151
152
|
/* @__PURE__ */ n(
|
|
152
153
|
"span",
|
|
153
154
|
{
|
|
154
155
|
className: "w-[88px] shrink-0 truncate text-right text-[10px] text-slate-400",
|
|
155
|
-
"data-tip":
|
|
156
|
-
children:
|
|
156
|
+
"data-tip": x.updated_at ? `${x.updated_by ?? "unknown"} · ${new Date(x.updated_at).toLocaleString()}` : void 0,
|
|
157
|
+
children: x.updated_by ?? ""
|
|
157
158
|
}
|
|
158
159
|
)
|
|
159
160
|
]
|
|
160
161
|
},
|
|
161
|
-
|
|
162
|
+
x.id
|
|
162
163
|
)) }),
|
|
163
164
|
i.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." }),
|
|
164
165
|
i.subtotal != null && /* @__PURE__ */ d("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,16 +173,16 @@ function Fn({
|
|
|
172
173
|
" ",
|
|
173
174
|
i.excluded[0].reason.replace(/^does not match: /, "")
|
|
174
175
|
] }),
|
|
175
|
-
i.excluded.slice(0, 8).map((
|
|
176
|
+
i.excluded.slice(0, 8).map((x) => /* @__PURE__ */ d(
|
|
176
177
|
"div",
|
|
177
178
|
{
|
|
178
179
|
className: "flex items-baseline gap-2 px-0.5 text-[11px] text-slate-400",
|
|
179
180
|
children: [
|
|
180
|
-
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate line-through decoration-slate-300", children:
|
|
181
|
-
/* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums", children: b(
|
|
181
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate line-through decoration-slate-300", children: x.label }),
|
|
182
|
+
/* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums", children: b(x.value) })
|
|
182
183
|
]
|
|
183
184
|
},
|
|
184
|
-
|
|
185
|
+
x.id
|
|
185
186
|
)),
|
|
186
187
|
i.excluded.length > 8 && /* @__PURE__ */ d("p", { className: "px-0.5 text-[10.5px] text-slate-400", children: [
|
|
187
188
|
"+",
|
|
@@ -191,39 +192,39 @@ function Fn({
|
|
|
191
192
|
] })
|
|
192
193
|
] }, y);
|
|
193
194
|
}),
|
|
194
|
-
(l == null ? void 0 : l.kind) === "rollup" &&
|
|
195
|
+
(l == null ? void 0 : l.kind) === "rollup" && m != null && /* @__PURE__ */ d("p", { className: "px-1 pt-0.5 text-right text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
195
196
|
"stored ",
|
|
196
|
-
b(
|
|
197
|
+
b(m),
|
|
197
198
|
(() => {
|
|
198
|
-
const i = (l.sources ?? []).reduce((o,
|
|
199
|
-
return (l.sources ?? []).some((o) => o.truncated) ? null : Math.abs(i -
|
|
199
|
+
const i = (l.sources ?? []).reduce((o, x) => o + (x.subtotal ?? 0), 0);
|
|
200
|
+
return (l.sources ?? []).some((o) => o.truncated) ? null : Math.abs(i - m) < 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" });
|
|
200
201
|
})()
|
|
201
202
|
] })
|
|
202
203
|
] })
|
|
203
204
|
] });
|
|
204
205
|
}
|
|
205
|
-
function
|
|
206
|
+
function Sn({
|
|
206
207
|
collection: c,
|
|
207
208
|
itemId: e,
|
|
208
|
-
field:
|
|
209
|
+
field: u,
|
|
209
210
|
formatValue: p,
|
|
210
|
-
onRestore:
|
|
211
|
+
onRestore: f
|
|
211
212
|
}) {
|
|
212
|
-
const a = ie(), [l, _] = ve(!1), b =
|
|
213
|
-
queryKey: ["field-value-history", c, e,
|
|
214
|
-
queryFn: () => a.request(K(`/field-history/${c}/${encodeURIComponent(e)}/${
|
|
213
|
+
const a = ie(), [l, _] = ve(!1), b = S(null), { data: m, isLoading: i } = re({
|
|
214
|
+
queryKey: ["field-value-history", c, e, u],
|
|
215
|
+
queryFn: () => a.request(K(`/field-history/${c}/${encodeURIComponent(e)}/${u}`)).then((o) => o.data ?? []),
|
|
215
216
|
enabled: l,
|
|
216
217
|
staleTime: 6e4
|
|
217
218
|
});
|
|
218
219
|
le(() => {
|
|
219
220
|
if (!l) return;
|
|
220
|
-
const o = (
|
|
221
|
+
const o = (x) => {
|
|
221
222
|
var U;
|
|
222
|
-
(U = b.current) != null && U.contains(
|
|
223
|
+
(U = b.current) != null && U.contains(x.target) || _(!1);
|
|
223
224
|
};
|
|
224
225
|
return window.addEventListener("mousedown", o), () => window.removeEventListener("mousedown", o);
|
|
225
226
|
}, [l]);
|
|
226
|
-
const y = (o,
|
|
227
|
+
const y = (o, x) => x || (o == null || o === "" ? "—" : p ? p(o) : typeof o == "boolean" || o === "true" || o === "false" ? o === !0 || o === "true" ? "Yes" : "No" : typeof o == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(o) ? new Date(o).toLocaleString() : typeof o == "object" ? JSON.stringify(o).slice(0, 60) : String(o).slice(0, 80));
|
|
227
228
|
return /* @__PURE__ */ d("div", { ref: b, className: "relative inline-flex", children: [
|
|
228
229
|
/* @__PURE__ */ n(
|
|
229
230
|
"button",
|
|
@@ -236,24 +237,24 @@ function Cn({
|
|
|
236
237
|
l ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
|
|
237
238
|
),
|
|
238
239
|
"data-field-history": !0,
|
|
239
|
-
children: /* @__PURE__ */ n(
|
|
240
|
+
children: /* @__PURE__ */ n(Ft, { className: "h-3 w-3" })
|
|
240
241
|
}
|
|
241
242
|
),
|
|
242
243
|
l && /* @__PURE__ */ d("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: [
|
|
243
244
|
/* @__PURE__ */ n("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Value history" }),
|
|
244
|
-
i ? /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }) : (
|
|
245
|
+
i ? /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }) : (m ?? []).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: (m ?? []).map((o, x) => /* @__PURE__ */ d(
|
|
245
246
|
"div",
|
|
246
247
|
{
|
|
247
248
|
className: "rounded px-1 py-1 text-[11.5px] leading-snug hover:bg-slate-50 dark:hover:bg-muted",
|
|
248
249
|
children: [
|
|
249
250
|
/* @__PURE__ */ d("span", { className: "flex items-baseline justify-between gap-2", children: [
|
|
250
251
|
/* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: y(o.value, o.display) }),
|
|
251
|
-
|
|
252
|
+
f && x > 0 && /* @__PURE__ */ n(
|
|
252
253
|
"button",
|
|
253
254
|
{
|
|
254
255
|
type: "button",
|
|
255
256
|
onClick: () => {
|
|
256
|
-
|
|
257
|
+
f(o.value ?? null), _(!1);
|
|
257
258
|
},
|
|
258
259
|
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",
|
|
259
260
|
children: "Restore"
|
|
@@ -279,17 +280,17 @@ function Cn({
|
|
|
279
280
|
] })
|
|
280
281
|
]
|
|
281
282
|
},
|
|
282
|
-
|
|
283
|
+
x
|
|
283
284
|
)) })
|
|
284
285
|
] })
|
|
285
286
|
] });
|
|
286
287
|
}
|
|
287
|
-
function
|
|
288
|
+
function $n({
|
|
288
289
|
collection: c,
|
|
289
290
|
itemId: e,
|
|
290
|
-
field:
|
|
291
|
+
field: u
|
|
291
292
|
}) {
|
|
292
|
-
const p = ie(),
|
|
293
|
+
const p = ie(), f = Ge(), { data: a } = re({
|
|
293
294
|
queryKey: ["field-watch-config"],
|
|
294
295
|
queryFn: () => p.request(K("/field-watches/config")).then((i) => i.data).catch(() => ({ enabled: !1 })),
|
|
295
296
|
staleTime: 5 * 6e4
|
|
@@ -298,14 +299,14 @@ function Ln({
|
|
|
298
299
|
queryFn: () => p.request(K("/field-watches/self", { collection: c, item_id: e })).then((i) => i.data ?? []).catch(() => []),
|
|
299
300
|
enabled: !!(a != null && a.enabled),
|
|
300
301
|
staleTime: 6e4
|
|
301
|
-
}), b = _.includes(
|
|
302
|
+
}), b = _.includes(u), m = gt({
|
|
302
303
|
mutationFn: () => b ? p.request(
|
|
303
|
-
|
|
304
|
-
`/field-watches/self?collection=${encodeURIComponent(c)}&field=${encodeURIComponent(
|
|
304
|
+
Pt(
|
|
305
|
+
`/field-watches/self?collection=${encodeURIComponent(c)}&field=${encodeURIComponent(u)}&item_id=${encodeURIComponent(e)}`
|
|
305
306
|
)
|
|
306
|
-
) : p.request(ge("/field-watches/self", { collection: c, field:
|
|
307
|
+
) : p.request(ge("/field-watches/self", { collection: c, field: u, item_id: e })),
|
|
307
308
|
onSuccess: () => {
|
|
308
|
-
|
|
309
|
+
f.invalidateQueries({ queryKey: l }), oe.success(
|
|
309
310
|
b ? "No longer watching this field" : "Watching — you will be notified when it changes"
|
|
310
311
|
);
|
|
311
312
|
},
|
|
@@ -315,47 +316,47 @@ function Ln({
|
|
|
315
316
|
"button",
|
|
316
317
|
{
|
|
317
318
|
type: "button",
|
|
318
|
-
onClick: () =>
|
|
319
|
+
onClick: () => m.mutate(),
|
|
319
320
|
title: b ? "Stop watching this field on this record" : "Watch this field on this record",
|
|
320
|
-
"data-field-watch":
|
|
321
|
+
"data-field-watch": u,
|
|
321
322
|
className: `rounded p-0.5 transition-colors ${b ? "text-nvr-navy dark:text-nvr-cyan" : "text-slate-300 hover:text-slate-500"}`,
|
|
322
|
-
children: b ? /* @__PURE__ */ n(
|
|
323
|
+
children: b ? /* @__PURE__ */ n(Ct, { className: "h-3 w-3" }) : /* @__PURE__ */ n(Lt, { className: "h-3 w-3" })
|
|
323
324
|
}
|
|
324
325
|
) : null;
|
|
325
326
|
}
|
|
326
|
-
function
|
|
327
|
+
function qn(c) {
|
|
327
328
|
return c ? c.querySelector(
|
|
328
329
|
'input:not([type=hidden]), textarea, [role="combobox"], [contenteditable="true"]'
|
|
329
330
|
) ?? c.querySelector("button") : null;
|
|
330
331
|
}
|
|
331
|
-
const
|
|
332
|
+
const dr = St(function({
|
|
332
333
|
field: e,
|
|
333
|
-
draft:
|
|
334
|
+
draft: u,
|
|
334
335
|
onChange: p,
|
|
335
|
-
relations:
|
|
336
|
+
relations: f,
|
|
336
337
|
collection: a,
|
|
337
338
|
itemId: l,
|
|
338
339
|
error: _,
|
|
339
340
|
visible: b,
|
|
340
|
-
locked:
|
|
341
|
+
locked: m,
|
|
341
342
|
layoutAiEnabled: i,
|
|
342
343
|
renderField: y,
|
|
343
344
|
onCountChange: o,
|
|
344
|
-
swapButton:
|
|
345
|
+
swapButton: x,
|
|
345
346
|
swapContent: U,
|
|
346
|
-
forceVisible:
|
|
347
|
+
forceVisible: Qe,
|
|
347
348
|
autoFillTick: ae
|
|
348
349
|
}) {
|
|
349
|
-
var De,
|
|
350
|
-
const H =
|
|
350
|
+
var Oe, De, Me, Ke;
|
|
351
|
+
const H = Fn.has(e.interface ?? ""), N = qt(), g = rn(), we = Ge(), se = ie(), [ke, W] = ve(!1), s = Ut(), _e = Bt(e.field), V = S(null), z = $t(), ce = S(null), Ne = S(!1);
|
|
351
352
|
le(() => {
|
|
352
|
-
const t = Ne.current ?
|
|
353
|
+
const t = Ne.current ? qn(ce.current) : null;
|
|
353
354
|
if (!t || t.hasAttribute("aria-label")) return;
|
|
354
355
|
t.id || (t.id = `${z}-control`);
|
|
355
356
|
const r = t.tagName === "BUTTON" ? `${z} ${t.id}` : z;
|
|
356
357
|
t.getAttribute("aria-labelledby") !== r && t.setAttribute("aria-labelledby", r);
|
|
357
358
|
});
|
|
358
|
-
const Fe =
|
|
359
|
+
const Fe = m && !H, Ce = S(null);
|
|
359
360
|
le(() => {
|
|
360
361
|
const t = Ce.current;
|
|
361
362
|
if (!t) return;
|
|
@@ -366,36 +367,36 @@ const ir = Lt(function({
|
|
|
366
367
|
const r = typeof document < "u" ? document.activeElement : null;
|
|
367
368
|
r instanceof HTMLElement && t.contains(r) && r.blur(), t.setAttribute("inert", "");
|
|
368
369
|
}, [Fe, ae]);
|
|
369
|
-
const G = e.field, Le =
|
|
370
|
+
const G = e.field, Le = He(
|
|
370
371
|
(t) => {
|
|
371
|
-
|
|
372
|
+
m || p(G, t);
|
|
372
373
|
},
|
|
373
|
-
[
|
|
374
|
-
),
|
|
374
|
+
[m, p, G]
|
|
375
|
+
), Ye = He(
|
|
375
376
|
(t) => o == null ? void 0 : o(G, t),
|
|
376
377
|
[o, G]
|
|
377
|
-
),
|
|
378
|
-
onContextMenu:
|
|
379
|
-
onKeyDown:
|
|
380
|
-
menu:
|
|
381
|
-
confirmSaveFrom:
|
|
378
|
+
), Je = S(void 0), Re = S(void 0), Se = S(void 0), $e = !m && !e.readonly && !e.computed_formula && !(e.hidden && !e.layout_assigned) && !ze(e), {
|
|
379
|
+
onContextMenu: Xe,
|
|
380
|
+
onKeyDown: Ze,
|
|
381
|
+
menu: Ie,
|
|
382
|
+
confirmSaveFrom: et,
|
|
382
383
|
openedBy: de
|
|
383
|
-
} =
|
|
384
|
+
} = Ht({
|
|
384
385
|
wrapperRef: V,
|
|
385
386
|
field: e,
|
|
386
|
-
value:
|
|
387
|
-
relations:
|
|
387
|
+
value: u[e.field],
|
|
388
|
+
relations: f,
|
|
388
389
|
collection: a,
|
|
389
390
|
itemId: l,
|
|
390
391
|
openRelated: s == null ? void 0 : s.openRelated,
|
|
391
392
|
editable: $e
|
|
392
|
-
}), T =
|
|
393
|
+
}), T = Wt(V), tt = sn(), qe = s == null ? void 0 : s.remoteChanges[e.field], B = s == null ? void 0 : s.lockReasons[e.field], A = s == null ? void 0 : s.applyToLines[e.field], C = gn(), nt = (C == null ? void 0 : C.applied(e.field)) ?? !1, Ae = (C == null ? void 0 : C.hintFor(e.field)) ?? null, ue = ln(C, e.field, $e), me = () => {
|
|
393
394
|
var t, r;
|
|
394
|
-
return ((t = ce.current) == null ? void 0 : t.querySelector(
|
|
395
|
-
}, Q =
|
|
396
|
-
async function
|
|
395
|
+
return ((t = ce.current) == null ? void 0 : t.querySelector(Ve)) ?? ((r = V.current) == null ? void 0 : r.querySelector(Ve));
|
|
396
|
+
}, Q = At(e._overrides, i, Cn(e)), pe = !!(s != null && s.fromAutofill) && !!e._overrides && e._overrides[Tt] === !0;
|
|
397
|
+
async function rt() {
|
|
397
398
|
var t;
|
|
398
|
-
if (Q.perField) return
|
|
399
|
+
if (Q.perField) return lt();
|
|
399
400
|
W(!0);
|
|
400
401
|
try {
|
|
401
402
|
const r = await se.request(
|
|
@@ -411,10 +412,10 @@ const ir = Lt(function({
|
|
|
411
412
|
W(!1);
|
|
412
413
|
}
|
|
413
414
|
}
|
|
414
|
-
async function
|
|
415
|
+
async function lt() {
|
|
415
416
|
var r, h, w, P;
|
|
416
417
|
const t = {};
|
|
417
|
-
for (const k of ((r =
|
|
418
|
+
for (const k of ((r = Et(e._overrides)) == null ? void 0 : r.tokens) ?? []) k in u && (t[k] = u[k]);
|
|
418
419
|
W(!0);
|
|
419
420
|
try {
|
|
420
421
|
const k = await se.request(
|
|
@@ -425,25 +426,25 @@ const ir = Lt(function({
|
|
|
425
426
|
item_id: l && l !== "new" ? l : null,
|
|
426
427
|
values: t
|
|
427
428
|
})
|
|
428
|
-
),
|
|
429
|
-
typeof
|
|
429
|
+
), F = (h = k.data) == null ? void 0 : h.value;
|
|
430
|
+
typeof F == "string" && F !== "" ? p(e.field, F) : oe.info("The AI had nothing to write here"), (P = (w = k.data) == null ? void 0 : w.missing) != null && P.length && oe.info(`Filled without ${k.data.missing.join(", ")} (empty or not visible to you)`);
|
|
430
431
|
} catch (k) {
|
|
431
|
-
|
|
432
|
+
jt(k, "AI fill failed", { action: "Fill with AI" });
|
|
432
433
|
} finally {
|
|
433
434
|
W(!1);
|
|
434
435
|
}
|
|
435
436
|
}
|
|
436
|
-
const E =
|
|
437
|
-
const r =
|
|
437
|
+
const E = Xt(e.dependency_config), Te = E.flatMap((t) => {
|
|
438
|
+
const r = f.find(
|
|
438
439
|
(w) => w.one_collection === a && w.one_field === t.parent_field
|
|
439
440
|
);
|
|
440
441
|
if (!r) return [];
|
|
441
442
|
if (r.junction_field) return [{ rule: t, rel: r }];
|
|
442
|
-
const h =
|
|
443
|
+
const h = f.find(
|
|
443
444
|
(w) => w.many_collection === r.many_collection && w.id !== r.id
|
|
444
445
|
);
|
|
445
446
|
return h != null && h.many_field ? [{ rule: t, rel: { ...r, junction_field: h.many_field } }] : [];
|
|
446
|
-
}),
|
|
447
|
+
}), ot = bt({
|
|
447
448
|
queries: Te.map(({ rel: t }) => ({
|
|
448
449
|
queryKey: ["m2m-items", t.many_collection, t.many_field, l],
|
|
449
450
|
queryFn: () => se.request(
|
|
@@ -456,41 +457,41 @@ const ir = Lt(function({
|
|
|
456
457
|
enabled: !!l && l !== "new",
|
|
457
458
|
staleTime: 3e4
|
|
458
459
|
}))
|
|
459
|
-
}),
|
|
460
|
+
}), it = Object.fromEntries(
|
|
460
461
|
Te.map(({ rule: t, rel: r }, h) => {
|
|
461
462
|
var k;
|
|
462
463
|
const w = r.one_field ?? `${r.many_collection}.${r.junction_field}`, P = (g == null ? void 0 : g.getStagedUnlinks(w)) ?? /* @__PURE__ */ new Set();
|
|
463
464
|
return [
|
|
464
465
|
t.parent_field,
|
|
465
|
-
(((k =
|
|
466
|
+
(((k = ot[h]) == null ? void 0 : k.data) ?? []).filter((F) => !P.has(F.id)).map((F) => F[r.junction_field])
|
|
466
467
|
];
|
|
467
468
|
})
|
|
468
|
-
), Y =
|
|
469
|
-
if (!
|
|
469
|
+
), Y = Mt()[e.field] ?? [];
|
|
470
|
+
if (!Qe && (!b || !e.layout_assigned && (e.hidden || Zt.has(e.field))))
|
|
470
471
|
return null;
|
|
471
|
-
const he =
|
|
472
|
+
const he = u[e.field] ?? null, J = cn(e, tt), L = J.label ?? Z(e.field);
|
|
472
473
|
Ne.current = L !== "";
|
|
473
|
-
const
|
|
474
|
-
const t =
|
|
474
|
+
const $ = ze(e), Ee = $ ? null : dn(e), Pe = $ || !(l === "new" || !l || (Oe = N == null ? void 0 : N.dirtyFields) != null && Oe.has(e.field)) ? null : bn(e, u), at = !$ && !m && !e.readonly && ((De = e._overrides) == null ? void 0 : De.repeat_last) === !0, st = nn(e, u), ct = (Ke = (Me = It(e.options)) == null ? void 0 : Me.auto_id) == null ? void 0 : Ke.pattern, v = (() => {
|
|
475
|
+
const t = f.find(
|
|
475
476
|
(h) => h.one_collection === a && h.one_field === e.field
|
|
476
477
|
);
|
|
477
478
|
if (!t) return null;
|
|
478
479
|
if (t.junction_field) return t;
|
|
479
|
-
const r =
|
|
480
|
+
const r = f.find(
|
|
480
481
|
(h) => h.many_collection === t.many_collection && h.id !== t.id
|
|
481
482
|
);
|
|
482
483
|
return r ? { ...t, junction_field: r.many_field } : null;
|
|
483
|
-
})(),
|
|
484
|
+
})(), xe = v ? null : f.find((t) => t.many_collection === a && t.many_field === e.field) ?? null, fe = v ? f.find(
|
|
484
485
|
(t) => t.many_collection === v.many_collection && t.many_field === v.junction_field && t.id !== v.id
|
|
485
|
-
) ?? null : null,
|
|
486
|
+
) ?? null : null, O = v ? v.one_field ?? `${v.many_collection}.${v.junction_field}` : null, je = O ? (g == null ? void 0 : g.getStagedLinks(O)) ?? [] : [], dt = v ? (we.getQueryData([
|
|
486
487
|
"m2m-items",
|
|
487
488
|
v.many_collection,
|
|
488
489
|
v.many_field,
|
|
489
490
|
l
|
|
490
|
-
]) ?? []).map((t) => t[v.junction_field]) : [],
|
|
491
|
+
]) ?? []).map((t) => t[v.junction_field]) : [], ut = v ? je[0] ?? dt[0] ?? null : he, mt = (fe == null ? void 0 : fe.one_collection) ?? (xe == null ? void 0 : xe.one_collection) ?? void 0, X = (t) => {
|
|
491
492
|
var r;
|
|
492
|
-
return ((
|
|
493
|
-
},
|
|
493
|
+
return ((N == null ? void 0 : N.collection) === a ? (r = N == null ? void 0 : N.fieldLabels) == null ? void 0 : r[t] : void 0) ?? Z(String(t));
|
|
494
|
+
}, q = en({
|
|
494
495
|
rules: E,
|
|
495
496
|
// A parent whose value THIS field's own pick derived must not narrow this
|
|
496
497
|
// field's options — otherwise picking a region locks the region picker
|
|
@@ -501,43 +502,43 @@ const ir = Lt(function({
|
|
|
501
502
|
return ((r = g == null ? void 0 : g.getDerivedOrigin) == null ? void 0 : r.call(g, t)) === e.field;
|
|
502
503
|
},
|
|
503
504
|
parentValue: (t) => {
|
|
504
|
-
if (
|
|
505
|
-
const r =
|
|
505
|
+
if (u[t] != null) return u[t];
|
|
506
|
+
const r = f.find((R) => R.one_collection === a && R.one_field === t);
|
|
506
507
|
if (!r) return null;
|
|
507
508
|
let h = r;
|
|
508
509
|
if (!h.junction_field) {
|
|
509
|
-
const
|
|
510
|
-
(
|
|
510
|
+
const R = f.find(
|
|
511
|
+
(Ue) => Ue.many_collection === r.many_collection && Ue.id !== r.id
|
|
511
512
|
);
|
|
512
|
-
if (
|
|
513
|
+
if (R != null && R.many_field) h = { ...r, junction_field: R.many_field };
|
|
513
514
|
else return null;
|
|
514
515
|
}
|
|
515
|
-
const w = h.one_field ?? `${h.many_collection}.${h.junction_field}`, P = (g == null ? void 0 : g.getStagedLinks(w)) ?? [], k =
|
|
516
|
-
return
|
|
516
|
+
const w = h.one_field ?? `${h.many_collection}.${h.junction_field}`, P = (g == null ? void 0 : g.getStagedLinks(w)) ?? [], k = it[t] ?? [], F = [...new Set([...P, ...k].map((R) => String(R)))];
|
|
517
|
+
return F.length === 0 ? null : F.length === 1 ? F[0] : F;
|
|
517
518
|
},
|
|
518
519
|
parentOptionFilter: (t) => {
|
|
519
520
|
var h;
|
|
520
|
-
const r = (
|
|
521
|
-
return r ?
|
|
521
|
+
const r = (N == null ? void 0 : N.collection) === a ? (h = N.fieldOptionFilters) == null ? void 0 : h[t] : void 0;
|
|
522
|
+
return r ? vn(r, u, l) : void 0;
|
|
522
523
|
}
|
|
523
|
-
}),
|
|
524
|
-
function
|
|
525
|
-
const t =
|
|
524
|
+
}), D = q.filter ? fn(Je, q.filter, yn) : q.filter, M = q.satisfiedParents.map(X), ye = q.satisfiedParents, pt = q.unsatisfiedParents.length ? X(q.unsatisfiedParents[0]) : null, be = q.missingRequiredParents, Be = be.length ? X(be[0]) : null;
|
|
525
|
+
function ht() {
|
|
526
|
+
const t = Se.current;
|
|
526
527
|
if (t && t.src === e) return t.value;
|
|
527
528
|
const r = { ...e, readonly: !0 };
|
|
528
|
-
return
|
|
529
|
+
return Se.current = { src: e, value: r }, r;
|
|
529
530
|
}
|
|
530
|
-
function
|
|
531
|
-
const t = JSON.stringify([M, ye]), r =
|
|
531
|
+
function xt() {
|
|
532
|
+
const t = JSON.stringify([M, ye]), r = Re.current;
|
|
532
533
|
if (r && r.sig === t && r.onChange === p) return r.value;
|
|
533
534
|
const h = {
|
|
534
535
|
labels: M,
|
|
535
536
|
keys: ye,
|
|
536
537
|
onClear: (w) => p(w, null)
|
|
537
538
|
};
|
|
538
|
-
return
|
|
539
|
+
return Re.current = { sig: t, onChange: p, value: h }, h;
|
|
539
540
|
}
|
|
540
|
-
function
|
|
541
|
+
function ft() {
|
|
541
542
|
for (const t of ye) {
|
|
542
543
|
const r = document.querySelector(`[data-field="${t}"]`);
|
|
543
544
|
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(() => {
|
|
@@ -547,16 +548,16 @@ const ir = Lt(function({
|
|
|
547
548
|
}, 900));
|
|
548
549
|
}
|
|
549
550
|
}
|
|
550
|
-
const
|
|
551
|
-
if (v &&
|
|
552
|
-
for (const r of
|
|
551
|
+
const yt = () => {
|
|
552
|
+
if (v && O) {
|
|
553
|
+
for (const r of je) g == null || g.unstageLink(O, r);
|
|
553
554
|
const t = we.getQueryData([
|
|
554
555
|
"m2m-items",
|
|
555
556
|
v.many_collection,
|
|
556
557
|
v.many_field,
|
|
557
558
|
l
|
|
558
559
|
]) ?? [];
|
|
559
|
-
for (const r of t) g == null || g.stageUnlink(
|
|
560
|
+
for (const r of t) g == null || g.stageUnlink(O, r.id);
|
|
560
561
|
} else
|
|
561
562
|
p(e.field, null);
|
|
562
563
|
};
|
|
@@ -574,20 +575,20 @@ const ir = Lt(function({
|
|
|
574
575
|
"group/fieldrow space-y-1.5",
|
|
575
576
|
pe && "rounded-md bg-amber-50/60 p-1.5 ring-1 ring-amber-300 dark:bg-amber-500/10 dark:ring-amber-500/40"
|
|
576
577
|
),
|
|
577
|
-
onContextMenu:
|
|
578
|
-
onKeyDown:
|
|
578
|
+
onContextMenu: Xe,
|
|
579
|
+
onKeyDown: Ze,
|
|
579
580
|
onFocusCapture: T.onFocusCapture,
|
|
580
581
|
children: [
|
|
581
|
-
|
|
582
|
+
Ie,
|
|
582
583
|
E.length > 0 && /* @__PURE__ */ n(
|
|
583
|
-
|
|
584
|
+
tn,
|
|
584
585
|
{
|
|
585
586
|
cascadeRules: E,
|
|
586
|
-
cascadeFilter:
|
|
587
|
-
currentValue:
|
|
588
|
-
relatedCollection:
|
|
587
|
+
cascadeFilter: D,
|
|
588
|
+
currentValue: ut,
|
|
589
|
+
relatedCollection: mt,
|
|
589
590
|
missingRequiredParents: be,
|
|
590
|
-
onClear:
|
|
591
|
+
onClear: yt
|
|
591
592
|
}
|
|
592
593
|
),
|
|
593
594
|
(L !== "" || Y.length > 0) && /* @__PURE__ */ d(
|
|
@@ -597,17 +598,17 @@ const ir = Lt(function({
|
|
|
597
598
|
"data-pd-row": ue ? "" : void 0,
|
|
598
599
|
children: [
|
|
599
600
|
L !== "" && /* @__PURE__ */ d(Dt, { id: z, "data-field-label": !0, className: "text-sm font-medium", children: [
|
|
600
|
-
/* @__PURE__ */ n(
|
|
601
|
+
/* @__PURE__ */ n(We, { text: L, collection: a }),
|
|
601
602
|
e.required && /* @__PURE__ */ n("span", { className: "ml-0.5 text-destructive", children: "*" }),
|
|
602
|
-
|
|
603
|
+
un(e) && /* @__PURE__ */ n(mn, {})
|
|
603
604
|
] }),
|
|
604
605
|
J.note && /* @__PURE__ */ n(I, { delayDuration: 100, children: /* @__PURE__ */ d(ee, { children: [
|
|
605
|
-
/* @__PURE__ */ n(te, { asChild: !0, children: /* @__PURE__ */ n(
|
|
606
|
-
/* @__PURE__ */ n(ne, { side: "top", className: "max-w-[240px] text-[12px]", children: (s == null ? void 0 : s.glossaryHelp) === !1 ? J.note : /* @__PURE__ */ n(
|
|
606
|
+
/* @__PURE__ */ n(te, { asChild: !0, children: /* @__PURE__ */ n(vt, { className: "h-3.5 w-3.5 shrink-0 cursor-help text-slate-400 hover:text-slate-600" }) }),
|
|
607
|
+
/* @__PURE__ */ n(ne, { side: "top", className: "max-w-[240px] text-[12px]", children: (s == null ? void 0 : s.glossaryHelp) === !1 ? J.note : /* @__PURE__ */ n(We, { text: J.note, collection: a }) })
|
|
607
608
|
] }) }),
|
|
608
|
-
_e && /* @__PURE__ */ n(
|
|
609
|
-
|
|
610
|
-
|
|
609
|
+
_e && /* @__PURE__ */ n(Ot, { source: _e, label: L }),
|
|
610
|
+
!$ && l && l !== "new" && /* @__PURE__ */ n(
|
|
611
|
+
Sn,
|
|
611
612
|
{
|
|
612
613
|
collection: a,
|
|
613
614
|
itemId: l,
|
|
@@ -615,11 +616,11 @@ const ir = Lt(function({
|
|
|
615
616
|
onRestore: e.readonly ? void 0 : (t) => p(e.field, t)
|
|
616
617
|
}
|
|
617
618
|
),
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
l && l !== "new" &&
|
|
621
|
-
|
|
622
|
-
|
|
619
|
+
!$ && l && l !== "new" && /* @__PURE__ */ n($n, { collection: a, itemId: l, field: e.field }),
|
|
620
|
+
!$ && l && l !== "new" && /* @__PURE__ */ n(Qt, { field: e.field, label: L || Z(e.field) }),
|
|
621
|
+
l && l !== "new" && st && /* @__PURE__ */ n(Rn, { collection: a, itemId: l, field: e.field }),
|
|
622
|
+
at && /* @__PURE__ */ n(
|
|
623
|
+
pn,
|
|
623
624
|
{
|
|
624
625
|
collection: a,
|
|
625
626
|
itemId: l,
|
|
@@ -628,17 +629,17 @@ const ir = Lt(function({
|
|
|
628
629
|
onFill: (t) => p(e.field, t)
|
|
629
630
|
}
|
|
630
631
|
),
|
|
631
|
-
|
|
632
|
+
!$ && Q.show && !(Q.perField && (m || e.readonly)) && /* @__PURE__ */ d(
|
|
632
633
|
"button",
|
|
633
634
|
{
|
|
634
635
|
type: "button",
|
|
635
|
-
onClick:
|
|
636
|
+
onClick: rt,
|
|
636
637
|
disabled: ke,
|
|
637
638
|
"data-ai-fill": Q.perField ? e.field : void 0,
|
|
638
639
|
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",
|
|
639
640
|
title: "Generate with AI",
|
|
640
641
|
children: [
|
|
641
|
-
ke ? /* @__PURE__ */ n(
|
|
642
|
+
ke ? /* @__PURE__ */ n(wt, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(kt, { className: "h-3 w-3" }),
|
|
642
643
|
"AI"
|
|
643
644
|
]
|
|
644
645
|
}
|
|
@@ -651,18 +652,18 @@ const ir = Lt(function({
|
|
|
651
652
|
children: "Check this"
|
|
652
653
|
}
|
|
653
654
|
),
|
|
654
|
-
|
|
655
|
-
|
|
655
|
+
x,
|
|
656
|
+
A && !m && !e.readonly && /* @__PURE__ */ d(
|
|
656
657
|
"button",
|
|
657
658
|
{
|
|
658
659
|
type: "button",
|
|
659
|
-
onClick: () =>
|
|
660
|
-
disabled:
|
|
660
|
+
onClick: () => A.onApply(u[e.field] ?? null),
|
|
661
|
+
disabled: u[e.field] == null || u[e.field] === "" || A.count === 0,
|
|
661
662
|
"data-apply-to-lines": e.field,
|
|
662
|
-
"data-tip":
|
|
663
|
+
"data-tip": A.count === 0 ? "No lines yet — add lines first" : u[e.field] == null || u[e.field] === "" ? "Pick a value first" : A.count != null ? `Copy this value onto all ${A.count} lines (staged until you save)` : "Copy this value onto every line (staged until you save)",
|
|
663
664
|
className: "inline-flex items-center gap-1 rounded border border-nvr-cyan/40 px-1.5 py-0.5 text-[10.5px] font-medium text-[#0e7490] transition-colors hover:bg-nvr-cyan/10 disabled:cursor-not-allowed disabled:opacity-40 dark:text-nvr-cyan",
|
|
664
665
|
children: [
|
|
665
|
-
|
|
666
|
+
A.label ?? "Apply to lines",
|
|
666
667
|
" ↓"
|
|
667
668
|
]
|
|
668
669
|
}
|
|
@@ -690,7 +691,7 @@ const ir = Lt(function({
|
|
|
690
691
|
] })
|
|
691
692
|
] }) }),
|
|
692
693
|
/* @__PURE__ */ n(
|
|
693
|
-
|
|
694
|
+
Jt,
|
|
694
695
|
{
|
|
695
696
|
collection: a,
|
|
696
697
|
kind: "field",
|
|
@@ -698,12 +699,12 @@ const ir = Lt(function({
|
|
|
698
699
|
label: L
|
|
699
700
|
}
|
|
700
701
|
),
|
|
701
|
-
(
|
|
702
|
-
/* @__PURE__ */ n(te, { asChild: !0, children: /* @__PURE__ */ n("span", { className: "inline-flex items-center text-amber-400 dark:text-amber-500", children: /* @__PURE__ */ n(
|
|
702
|
+
(m || e.readonly) && B ? /* @__PURE__ */ n(Vt, { reason: B, onHover: s == null ? void 0 : s.onLockHover }) : m ? /* @__PURE__ */ n(I, { delayDuration: 200, children: /* @__PURE__ */ d(ee, { children: [
|
|
703
|
+
/* @__PURE__ */ n(te, { 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" }) }) }),
|
|
703
704
|
/* @__PURE__ */ n(ne, { side: "top", className: "text-[12px]", children: "This field is locked" })
|
|
704
705
|
] }) }) : null,
|
|
705
706
|
E.length > 0 && (() => {
|
|
706
|
-
const t = !!
|
|
707
|
+
const t = !!D && Object.keys(D).length > 0 && M.length > 0, r = E.map(
|
|
707
708
|
(h) => X(String(h.parent_field))
|
|
708
709
|
);
|
|
709
710
|
return /* @__PURE__ */ n(I, { delayDuration: 100, children: /* @__PURE__ */ d(ee, { children: [
|
|
@@ -712,12 +713,12 @@ const ir = Lt(function({
|
|
|
712
713
|
{
|
|
713
714
|
type: "button",
|
|
714
715
|
"aria-label": `Show the fields that narrow ${L || "this list"}`,
|
|
715
|
-
onClick:
|
|
716
|
+
onClick: ft,
|
|
716
717
|
className: j(
|
|
717
718
|
"inline-flex items-center transition-colors",
|
|
718
719
|
t ? "text-nvr-cyan hover:text-nvr-cyan" : "text-slate-300 hover:text-nvr-cyan dark:text-slate-600 dark:hover:text-nvr-cyan"
|
|
719
720
|
),
|
|
720
|
-
children: /* @__PURE__ */ n(
|
|
721
|
+
children: /* @__PURE__ */ n(Nt, { className: "h-3 w-3" })
|
|
721
722
|
}
|
|
722
723
|
) }),
|
|
723
724
|
/* @__PURE__ */ n(ne, { side: "top", className: "text-[12px]", children: t ? `Filtered by ${M.join(", ")} — click to highlight` : `Options filter by ${r.join(", ")} once set` })
|
|
@@ -728,7 +729,7 @@ const ir = Lt(function({
|
|
|
728
729
|
// Shift+F10 still open the field menu). The slot keeps one box whatever it shows,
|
|
729
730
|
// so nothing to its left moves.
|
|
730
731
|
/* @__PURE__ */ n("span", { className: "ml-auto inline-flex shrink-0 items-center gap-1", children: /* @__PURE__ */ n(
|
|
731
|
-
|
|
732
|
+
on,
|
|
732
733
|
{
|
|
733
734
|
field: e.field,
|
|
734
735
|
label: L,
|
|
@@ -736,7 +737,7 @@ const ir = Lt(function({
|
|
|
736
737
|
confirmOpen: de === "make" || de === "update" ? de : null,
|
|
737
738
|
onConfirm: (t, r) => (
|
|
738
739
|
// After a save the button becomes "Your default": focus goes to the field.
|
|
739
|
-
|
|
740
|
+
et(t, me, r)
|
|
740
741
|
),
|
|
741
742
|
onUndo: () => {
|
|
742
743
|
C == null || C.undo(e.field), requestAnimationFrame(() => {
|
|
@@ -756,8 +757,8 @@ const ir = Lt(function({
|
|
|
756
757
|
]
|
|
757
758
|
}
|
|
758
759
|
),
|
|
759
|
-
T.editor && !
|
|
760
|
-
|
|
760
|
+
T.editor && !m && /* @__PURE__ */ n(
|
|
761
|
+
zt,
|
|
761
762
|
{
|
|
762
763
|
editor: T.editor,
|
|
763
764
|
confirming: T.confirming,
|
|
@@ -769,9 +770,9 @@ const ir = Lt(function({
|
|
|
769
770
|
"div",
|
|
770
771
|
{
|
|
771
772
|
ref: ce,
|
|
772
|
-
className: j(
|
|
773
|
-
"data-tip": (
|
|
774
|
-
onPointerEnter: (
|
|
773
|
+
className: j(m && !H && "cursor-not-allowed"),
|
|
774
|
+
"data-tip": (m || e.readonly) && B ? B : void 0,
|
|
775
|
+
onPointerEnter: (m || e.readonly) && B ? s == null ? void 0 : s.onLockHover : void 0,
|
|
775
776
|
children: /* @__PURE__ */ n(
|
|
776
777
|
"div",
|
|
777
778
|
{
|
|
@@ -782,44 +783,44 @@ const ir = Lt(function({
|
|
|
782
783
|
// upload/replace/remove when readonly) — blocking pointer events
|
|
783
784
|
// made attachments unopenable on every locked form (addendum
|
|
784
785
|
// view, terminal states).
|
|
785
|
-
|
|
786
|
+
m && !H && "pointer-events-none opacity-60",
|
|
786
787
|
// The ring lands with a 2px shake so the eye finds the field;
|
|
787
788
|
// the animation runs once when the class is added.
|
|
788
789
|
_ && "nvr-shake ring-1 ring-red-400 rounded-md",
|
|
789
790
|
ae && "nvr-autofill-glow"
|
|
790
791
|
),
|
|
791
|
-
children:
|
|
792
|
-
|
|
792
|
+
children: $ ? /* @__PURE__ */ n(hn, { field: e, values: u }) : ct ? /* @__PURE__ */ n(
|
|
793
|
+
Kt,
|
|
793
794
|
{
|
|
794
795
|
collection: a,
|
|
795
796
|
field: e,
|
|
796
|
-
draft:
|
|
797
|
+
draft: u,
|
|
797
798
|
itemId: l
|
|
798
799
|
}
|
|
799
800
|
) : y ? y({
|
|
800
801
|
field: e,
|
|
801
802
|
value: he,
|
|
802
803
|
onChange: Le,
|
|
803
|
-
disabled:
|
|
804
|
+
disabled: m,
|
|
804
805
|
collection: a,
|
|
805
806
|
itemId: l,
|
|
806
|
-
relations:
|
|
807
|
-
cascadeFilter:
|
|
808
|
-
unsatisfiedParentLabel:
|
|
809
|
-
requiredParentLabel:
|
|
807
|
+
relations: f,
|
|
808
|
+
cascadeFilter: D,
|
|
809
|
+
unsatisfiedParentLabel: pt,
|
|
810
|
+
requiredParentLabel: Be
|
|
810
811
|
}) : /* @__PURE__ */ n(
|
|
811
|
-
|
|
812
|
+
Yt,
|
|
812
813
|
{
|
|
813
|
-
field:
|
|
814
|
+
field: m && H ? ht() : e,
|
|
814
815
|
value: he,
|
|
815
816
|
onChange: Le,
|
|
816
|
-
relations:
|
|
817
|
+
relations: f,
|
|
817
818
|
collection: a,
|
|
818
819
|
itemId: l,
|
|
819
|
-
cascadeFilter:
|
|
820
|
-
requiredParentLabel:
|
|
821
|
-
narrowedBy: M.length > 0 ?
|
|
822
|
-
onCountChange: o ?
|
|
820
|
+
cascadeFilter: D,
|
|
821
|
+
requiredParentLabel: Be,
|
|
822
|
+
narrowedBy: M.length > 0 ? xt() : void 0,
|
|
823
|
+
onCountChange: o ? Ye : void 0
|
|
823
824
|
}
|
|
824
825
|
)
|
|
825
826
|
},
|
|
@@ -827,10 +828,19 @@ const ir = Lt(function({
|
|
|
827
828
|
)
|
|
828
829
|
}
|
|
829
830
|
),
|
|
830
|
-
Ee && /* @__PURE__ */ n(
|
|
831
|
-
|
|
831
|
+
Ee && /* @__PURE__ */ n(xn, { value: u[e.field], config: Ee }),
|
|
832
|
+
!_ && Pe && // A soft (warning-only) rule the value breaks: said here, never blocks the save.
|
|
833
|
+
/* @__PURE__ */ n(
|
|
834
|
+
"p",
|
|
835
|
+
{
|
|
836
|
+
"data-field-warning": e.field,
|
|
837
|
+
className: "text-[11.5px] leading-snug text-amber-700 dark:text-amber-400",
|
|
838
|
+
children: Pe
|
|
839
|
+
}
|
|
840
|
+
),
|
|
841
|
+
Ae && !nt && /* @__PURE__ */ n(an, { field: e.field, text: Ae }),
|
|
832
842
|
qe && /* @__PURE__ */ n(
|
|
833
|
-
|
|
843
|
+
Gt,
|
|
834
844
|
{
|
|
835
845
|
change: qe,
|
|
836
846
|
onDismiss: () => s == null ? void 0 : s.dismissRemoteChange(e.field),
|
|
@@ -846,7 +856,7 @@ const ir = Lt(function({
|
|
|
846
856
|
);
|
|
847
857
|
});
|
|
848
858
|
export {
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
859
|
+
dr as FieldRow,
|
|
860
|
+
cr as lineageSummary,
|
|
861
|
+
Ln as useFieldLineage
|
|
852
862
|
};
|