@nivaro/react 0.3.49 → 0.3.51
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 +38 -4
- package/dist/shared/components/ItemEditForm.js +5258 -5034
- package/dist/shared/components/QueryTable.js +489 -347
- package/dist/shared/components/ReportView.js +105 -99
- package/dist/shared/components/alerts/AlertManagerView.js +327 -301
- package/dist/shared/components/item-edit/CatalogPickerField.js +1230 -1175
- package/dist/shared/components/item-edit/CloneDialog.js +192 -142
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
- package/dist/shared/components/item-edit/FieldRenderer.js +249 -244
- package/dist/shared/components/item-edit/FieldRow.js +402 -370
- package/dist/shared/components/item-edit/FilePickerField.js +315 -307
- package/dist/shared/components/item-edit/InlineGridField.js +92 -90
- package/dist/shared/components/item-edit/InlineTableField.js +3119 -2951
- 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/RecordHeaderActions.js +76 -75
- package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
- package/dist/shared/components/item-edit/RelationCombobox.js +198 -191
- package/dist/shared/components/item-edit/SummaryPanel.js +282 -259
- package/dist/shared/components/item-edit/UserChip.js +233 -200
- package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
- package/dist/shared/components/item-edit/header-midair.js +51 -0
- package/dist/shared/components/item-edit/helpers.js +181 -155
- package/dist/shared/components/item-edit/line-midair.js +207 -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/panels/CommentPanel.js +290 -284
- package/dist/shared/components/panels/ItemLockBanner.js +414 -358
- package/dist/shared/components/panels/PipelinePanel.js +1241 -992
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- package/dist/shared/components/panels/TaskPanel.js +71 -61
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
- package/dist/shared/components/panels/requirement-side-effects.js +40 -0
- package/dist/shared/components/queue/QueueWorklist.js +925 -871
- 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/ui/number-draft-input.js +93 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
- package/dist/shared/lib/draft-store.js +48 -34
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/query-stats.js +60 -60
- package/package.json +1 -1
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import { jsxs as
|
|
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 K, del as
|
|
9
|
-
import { toastError as
|
|
10
|
-
import { titleCase as
|
|
11
|
-
import { GlossaryLabel as
|
|
12
|
-
import { useFieldSource as
|
|
13
|
-
import { Label as
|
|
14
|
-
import { TooltipProvider as
|
|
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
|
-
|
|
1
|
+
import { jsxs as u, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as Ge, useQueries as bt, useQuery as le, 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 $, useId as $t, useEffect as oe, useCallback as He } from "react";
|
|
5
|
+
import { toast as ae } from "sonner";
|
|
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
|
+
import { titleCase as I, cn as j } from "../../lib/utils.js";
|
|
11
|
+
import { GlossaryLabel as We } from "../ai/GlossaryText.js";
|
|
12
|
+
import { useFieldSource as Bt, FieldSourceInfo as Dt } from "../ConfigReadBack.js";
|
|
13
|
+
import { Label as Mt } from "../ui/label.js";
|
|
14
|
+
import { TooltipProvider as ee, Tooltip as te, TooltipTrigger as ne, TooltipContent as re } from "../ui/tooltip.js";
|
|
15
|
+
import { useAddendumFields as Ot } 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,220 +48,223 @@ 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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
function Ln(c, e, i) {
|
|
57
|
+
return c.filter((p) => (i == null ? void 0 : i(p)) !== e);
|
|
58
|
+
}
|
|
59
|
+
function Rn(c, e, i, p) {
|
|
60
|
+
const f = ie();
|
|
61
|
+
return le({
|
|
62
|
+
queryKey: ["field-lineage", c, e, i],
|
|
63
|
+
queryFn: () => f.request(
|
|
64
|
+
K(`/lineage/${c}/${encodeURIComponent(e)}/${i}`)
|
|
65
|
+
).then((s) => s.data),
|
|
62
66
|
enabled: p,
|
|
63
67
|
staleTime: 3e4
|
|
64
68
|
});
|
|
65
69
|
}
|
|
66
|
-
function
|
|
67
|
-
var l,
|
|
70
|
+
function dr(c, e = "rows") {
|
|
71
|
+
var l, w, g;
|
|
68
72
|
if (c && (c.kind === "write" || c.kind === "read") && c.formula) {
|
|
69
|
-
const
|
|
70
|
-
return `= ${c.formula.replace(/item\.([A-Za-z_][A-Za-z0-9_]*)/g, (
|
|
71
|
-
var
|
|
72
|
-
return
|
|
73
|
+
const m = (b) => typeof b == "number" ? b.toLocaleString(void 0, { maximumFractionDigits: 2 }) : b == null || b === "" ? "∅" : String(b);
|
|
74
|
+
return `= ${c.formula.replace(/item\.([A-Za-z_][A-Za-z0-9_]*)/g, (b, o) => {
|
|
75
|
+
var x;
|
|
76
|
+
return m((x = c.inputs) == null ? void 0 : x[o]);
|
|
73
77
|
}).replace(/\s*-\s*/g, " − ").replace(/\s*\*\s*/g, " × ").replace(/\s*\/\s*/g, " ÷ ")}`;
|
|
74
78
|
}
|
|
75
79
|
if (!c || c.kind !== "rollup") return null;
|
|
76
|
-
const
|
|
77
|
-
var
|
|
78
|
-
return
|
|
79
|
-
}, 0),
|
|
80
|
-
var
|
|
81
|
-
return (
|
|
82
|
-
})) == null ? void 0 : l.excluded) == null ? void 0 :
|
|
83
|
-
return p &&
|
|
84
|
-
`${p} excluded${
|
|
85
|
-
),
|
|
80
|
+
const i = (c.sources ?? []).reduce((m, a) => m + a.rows.length, 0), p = (c.sources ?? []).reduce((m, a) => {
|
|
81
|
+
var b;
|
|
82
|
+
return m + (((b = a.excluded) == null ? void 0 : b.length) ?? 0);
|
|
83
|
+
}, 0), f = (g = (w = (l = (c.sources ?? []).find((m) => {
|
|
84
|
+
var a;
|
|
85
|
+
return (a = m.excluded) == null ? void 0 : a.length;
|
|
86
|
+
})) == null ? void 0 : l.excluded) == null ? void 0 : w[0]) == null ? void 0 : g.reason, s = [`= ${i} ${i === 1 ? e.replace(/s$/, "") : e}`];
|
|
87
|
+
return p && s.push(
|
|
88
|
+
`${p} excluded${f ? ` (${f.replace(/^does not match: /, "")})` : ""}`
|
|
89
|
+
), s.join(" · ");
|
|
86
90
|
}
|
|
87
|
-
function
|
|
91
|
+
function Sn({
|
|
88
92
|
collection: c,
|
|
89
93
|
itemId: e,
|
|
90
|
-
field:
|
|
94
|
+
field: i
|
|
91
95
|
}) {
|
|
92
|
-
const [p,
|
|
93
|
-
|
|
96
|
+
const [p, f] = ve(!1), s = $(null), { data: l, isLoading: w } = Rn(c, e, i, p);
|
|
97
|
+
oe(() => {
|
|
94
98
|
if (!p) return;
|
|
95
|
-
const
|
|
99
|
+
const a = (b) => {
|
|
96
100
|
var o;
|
|
97
|
-
(o =
|
|
101
|
+
(o = s.current) != null && o.contains(b.target) || f(!1);
|
|
98
102
|
};
|
|
99
|
-
return window.addEventListener("mousedown",
|
|
103
|
+
return window.addEventListener("mousedown", a), () => window.removeEventListener("mousedown", a);
|
|
100
104
|
}, [p]);
|
|
101
|
-
const
|
|
102
|
-
return /* @__PURE__ */
|
|
105
|
+
const g = (a) => a == null ? "—" : Number(a).toLocaleString(void 0, { maximumFractionDigits: 2 }), m = (l == null ? void 0 : l.stored_value) != null ? Number(l.stored_value) : null;
|
|
106
|
+
return /* @__PURE__ */ u("div", { ref: s, className: "relative inline-flex", children: [
|
|
103
107
|
/* @__PURE__ */ n(
|
|
104
108
|
"button",
|
|
105
109
|
{
|
|
106
110
|
type: "button",
|
|
107
|
-
onClick: () =>
|
|
111
|
+
onClick: () => f((a) => !a),
|
|
108
112
|
title: "Where does this number come from?",
|
|
109
113
|
className: j(
|
|
110
114
|
"inline-flex items-center rounded p-0.5 transition-opacity",
|
|
111
115
|
p ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
|
|
112
116
|
),
|
|
113
117
|
"data-field-lineage": !0,
|
|
114
|
-
children: /* @__PURE__ */ n(
|
|
118
|
+
children: /* @__PURE__ */ n(Rt, { className: "h-3 w-3" })
|
|
115
119
|
}
|
|
116
120
|
),
|
|
117
|
-
p && /* @__PURE__ */
|
|
121
|
+
p && /* @__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: [
|
|
118
122
|
/* @__PURE__ */ n("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Where this number comes from" }),
|
|
119
|
-
|
|
120
|
-
(l == null ? void 0 : l.kind) === "write" && /* @__PURE__ */
|
|
123
|
+
w && /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }),
|
|
124
|
+
(l == null ? void 0 : l.kind) === "write" && /* @__PURE__ */ u("div", { className: "space-y-1 px-1 py-1", children: [
|
|
121
125
|
/* @__PURE__ */ n("p", { className: "font-mono text-[11px] text-slate-600 dark:text-slate-300", children: l.formula }),
|
|
122
|
-
Object.entries(l.inputs ?? {}).map(([
|
|
123
|
-
/* @__PURE__ */ n("span", { className: "font-mono", children:
|
|
126
|
+
Object.entries(l.inputs ?? {}).map(([a, b]) => /* @__PURE__ */ u("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
127
|
+
/* @__PURE__ */ n("span", { className: "font-mono", children: a }),
|
|
124
128
|
" = ",
|
|
125
|
-
b
|
|
126
|
-
] },
|
|
127
|
-
/* @__PURE__ */
|
|
129
|
+
g(b)
|
|
130
|
+
] }, a)),
|
|
131
|
+
/* @__PURE__ */ u("p", { className: "pt-1 text-[11.5px] font-medium text-slate-700 dark:text-slate-200", children: [
|
|
128
132
|
"= ",
|
|
129
|
-
|
|
133
|
+
g(l.stored_value)
|
|
130
134
|
] })
|
|
131
135
|
] }),
|
|
132
|
-
(l == null ? void 0 : l.kind) === "rollup" && (l.sources ?? []).map((
|
|
136
|
+
(l == null ? void 0 : l.kind) === "rollup" && (l.sources ?? []).map((a, b) => {
|
|
133
137
|
var o;
|
|
134
|
-
return /* @__PURE__ */
|
|
135
|
-
/* @__PURE__ */
|
|
136
|
-
(
|
|
137
|
-
|
|
138
|
+
return /* @__PURE__ */ u("div", { className: "mb-1.5", children: [
|
|
139
|
+
/* @__PURE__ */ u("p", { className: "px-1 text-[10.5px] text-slate-400", children: [
|
|
140
|
+
(a.aggregate ?? "sum").toUpperCase(),
|
|
141
|
+
a.value_field ? ` of ${a.value_field}` : "",
|
|
138
142
|
" across ",
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
a.collection,
|
|
144
|
+
a.filtered ? " (filtered)" : ""
|
|
141
145
|
] }),
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
146
|
+
a.error && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-amber-600 dark:text-amber-400", children: a.error }),
|
|
147
|
+
a.note && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-slate-400", children: a.note }),
|
|
148
|
+
a.rows.length > 0 && /* @__PURE__ */ n("div", { className: "mt-0.5 space-y-px", children: a.rows.map((x) => /* @__PURE__ */ u(
|
|
145
149
|
"div",
|
|
146
150
|
{
|
|
147
151
|
className: "flex items-baseline gap-2 rounded px-1 py-0.5 text-[11.5px] hover:bg-slate-50 dark:hover:bg-muted",
|
|
148
152
|
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:
|
|
153
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate text-slate-600 dark:text-slate-300", children: x.label }),
|
|
154
|
+
/* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums text-slate-800 dark:text-slate-100", children: g(x.value) }),
|
|
151
155
|
/* @__PURE__ */ n(
|
|
152
156
|
"span",
|
|
153
157
|
{
|
|
154
158
|
className: "w-[88px] shrink-0 truncate text-right text-[10px] text-slate-400",
|
|
155
|
-
"data-tip":
|
|
156
|
-
children:
|
|
159
|
+
"data-tip": x.updated_at ? `${x.updated_by ?? "unknown"} · ${new Date(x.updated_at).toLocaleString()}` : void 0,
|
|
160
|
+
children: x.updated_by ?? ""
|
|
157
161
|
}
|
|
158
162
|
)
|
|
159
163
|
]
|
|
160
164
|
},
|
|
161
|
-
|
|
165
|
+
x.id
|
|
162
166
|
)) }),
|
|
163
|
-
|
|
164
|
-
|
|
167
|
+
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." }),
|
|
168
|
+
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: [
|
|
165
169
|
"subtotal ",
|
|
166
|
-
|
|
170
|
+
g(a.subtotal)
|
|
167
171
|
] }),
|
|
168
|
-
(((o =
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
|
|
172
|
+
(((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: [
|
|
173
|
+
/* @__PURE__ */ u("p", { className: "text-[10.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
174
|
+
a.excluded.length,
|
|
171
175
|
" excluded —",
|
|
172
176
|
" ",
|
|
173
|
-
|
|
177
|
+
a.excluded[0].reason.replace(/^does not match: /, "")
|
|
174
178
|
] }),
|
|
175
|
-
|
|
179
|
+
a.excluded.slice(0, 8).map((x) => /* @__PURE__ */ u(
|
|
176
180
|
"div",
|
|
177
181
|
{
|
|
178
182
|
className: "flex items-baseline gap-2 px-0.5 text-[11px] text-slate-400",
|
|
179
183
|
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:
|
|
184
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate line-through decoration-slate-300", children: x.label }),
|
|
185
|
+
/* @__PURE__ */ n("span", { className: "shrink-0 font-mono tabular-nums", children: g(x.value) })
|
|
182
186
|
]
|
|
183
187
|
},
|
|
184
|
-
|
|
188
|
+
x.id
|
|
185
189
|
)),
|
|
186
|
-
|
|
190
|
+
a.excluded.length > 8 && /* @__PURE__ */ u("p", { className: "px-0.5 text-[10.5px] text-slate-400", children: [
|
|
187
191
|
"+",
|
|
188
|
-
|
|
192
|
+
a.excluded.length - 8,
|
|
189
193
|
" more"
|
|
190
194
|
] })
|
|
191
195
|
] })
|
|
192
|
-
] },
|
|
196
|
+
] }, b);
|
|
193
197
|
}),
|
|
194
|
-
(l == null ? void 0 : l.kind) === "rollup" &&
|
|
198
|
+
(l == null ? void 0 : l.kind) === "rollup" && m != null && /* @__PURE__ */ u("p", { className: "px-1 pt-0.5 text-right text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
195
199
|
"stored ",
|
|
196
|
-
|
|
200
|
+
g(m),
|
|
197
201
|
(() => {
|
|
198
|
-
const
|
|
199
|
-
return (l.sources ?? []).some((o) => o.truncated) ? null : Math.abs(
|
|
202
|
+
const a = (l.sources ?? []).reduce((o, x) => o + (x.subtotal ?? 0), 0);
|
|
203
|
+
return (l.sources ?? []).some((o) => o.truncated) ? null : Math.abs(a - 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
204
|
})()
|
|
201
205
|
] })
|
|
202
206
|
] })
|
|
203
207
|
] });
|
|
204
208
|
}
|
|
205
|
-
function
|
|
209
|
+
function $n({
|
|
206
210
|
collection: c,
|
|
207
211
|
itemId: e,
|
|
208
|
-
field:
|
|
212
|
+
field: i,
|
|
209
213
|
formatValue: p,
|
|
210
|
-
onRestore:
|
|
214
|
+
onRestore: f
|
|
211
215
|
}) {
|
|
212
|
-
const
|
|
213
|
-
queryKey: ["field-value-history", c, e,
|
|
214
|
-
queryFn: () =>
|
|
216
|
+
const s = ie(), [l, w] = ve(!1), g = $(null), { data: m, isLoading: a } = le({
|
|
217
|
+
queryKey: ["field-value-history", c, e, i],
|
|
218
|
+
queryFn: () => s.request(K(`/field-history/${c}/${encodeURIComponent(e)}/${i}`)).then((o) => o.data ?? []),
|
|
215
219
|
enabled: l,
|
|
216
220
|
staleTime: 6e4
|
|
217
221
|
});
|
|
218
|
-
|
|
222
|
+
oe(() => {
|
|
219
223
|
if (!l) return;
|
|
220
|
-
const o = (
|
|
224
|
+
const o = (x) => {
|
|
221
225
|
var U;
|
|
222
|
-
(U =
|
|
226
|
+
(U = g.current) != null && U.contains(x.target) || w(!1);
|
|
223
227
|
};
|
|
224
228
|
return window.addEventListener("mousedown", o), () => window.removeEventListener("mousedown", o);
|
|
225
229
|
}, [l]);
|
|
226
|
-
const
|
|
227
|
-
return /* @__PURE__ */
|
|
230
|
+
const b = (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));
|
|
231
|
+
return /* @__PURE__ */ u("div", { ref: g, className: "relative inline-flex", children: [
|
|
228
232
|
/* @__PURE__ */ n(
|
|
229
233
|
"button",
|
|
230
234
|
{
|
|
231
235
|
type: "button",
|
|
232
|
-
onClick: () =>
|
|
236
|
+
onClick: () => w((o) => !o),
|
|
233
237
|
title: "Value history",
|
|
234
238
|
className: j(
|
|
235
239
|
"inline-flex items-center rounded p-0.5 transition-opacity",
|
|
236
240
|
l ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
|
|
237
241
|
),
|
|
238
242
|
"data-field-history": !0,
|
|
239
|
-
children: /* @__PURE__ */ n(
|
|
243
|
+
children: /* @__PURE__ */ n(Ft, { className: "h-3 w-3" })
|
|
240
244
|
}
|
|
241
245
|
),
|
|
242
|
-
l && /* @__PURE__ */
|
|
246
|
+
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: [
|
|
243
247
|
/* @__PURE__ */ n("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Value history" }),
|
|
244
|
-
|
|
248
|
+
a ? /* @__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__ */ u(
|
|
245
249
|
"div",
|
|
246
250
|
{
|
|
247
251
|
className: "rounded px-1 py-1 text-[11.5px] leading-snug hover:bg-slate-50 dark:hover:bg-muted",
|
|
248
252
|
children: [
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
/* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-slate-200", children:
|
|
251
|
-
|
|
253
|
+
/* @__PURE__ */ u("span", { className: "flex items-baseline justify-between gap-2", children: [
|
|
254
|
+
/* @__PURE__ */ n("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: b(o.value, o.display) }),
|
|
255
|
+
f && x > 0 && /* @__PURE__ */ n(
|
|
252
256
|
"button",
|
|
253
257
|
{
|
|
254
258
|
type: "button",
|
|
255
259
|
onClick: () => {
|
|
256
|
-
|
|
260
|
+
f(o.value ?? null), w(!1);
|
|
257
261
|
},
|
|
258
262
|
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
263
|
children: "Restore"
|
|
260
264
|
}
|
|
261
265
|
)
|
|
262
266
|
] }),
|
|
263
|
-
/* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ u("span", { className: "block text-[10.5px] text-slate-400", children: [
|
|
264
268
|
o.action === "create" ? "initial value" : "changed",
|
|
265
269
|
o.timestamp ? ` · ${new Date(o.timestamp).toLocaleString()}` : "",
|
|
266
270
|
o.user_name ? ` · ${o.user_name}` : "",
|
|
@@ -272,91 +276,91 @@ function Cn({
|
|
|
272
276
|
}
|
|
273
277
|
)
|
|
274
278
|
] }),
|
|
275
|
-
o.note && /* @__PURE__ */
|
|
279
|
+
o.note && /* @__PURE__ */ u("span", { className: "block text-[10.5px] italic text-slate-500 dark:text-slate-400", children: [
|
|
276
280
|
"“",
|
|
277
281
|
o.note,
|
|
278
282
|
"”"
|
|
279
283
|
] })
|
|
280
284
|
]
|
|
281
285
|
},
|
|
282
|
-
|
|
286
|
+
x
|
|
283
287
|
)) })
|
|
284
288
|
] })
|
|
285
289
|
] });
|
|
286
290
|
}
|
|
287
|
-
function
|
|
291
|
+
function qn({
|
|
288
292
|
collection: c,
|
|
289
293
|
itemId: e,
|
|
290
|
-
field:
|
|
294
|
+
field: i
|
|
291
295
|
}) {
|
|
292
|
-
const p = ie(),
|
|
296
|
+
const p = ie(), f = Ge(), { data: s } = le({
|
|
293
297
|
queryKey: ["field-watch-config"],
|
|
294
|
-
queryFn: () => p.request(K("/field-watches/config")).then((
|
|
298
|
+
queryFn: () => p.request(K("/field-watches/config")).then((a) => a.data).catch(() => ({ enabled: !1 })),
|
|
295
299
|
staleTime: 5 * 6e4
|
|
296
|
-
}), l = ["field-watch-self", c, e], { data:
|
|
300
|
+
}), l = ["field-watch-self", c, e], { data: w = [] } = le({
|
|
297
301
|
queryKey: l,
|
|
298
|
-
queryFn: () => p.request(K("/field-watches/self", { collection: c, item_id: e })).then((
|
|
299
|
-
enabled: !!(
|
|
302
|
+
queryFn: () => p.request(K("/field-watches/self", { collection: c, item_id: e })).then((a) => a.data ?? []).catch(() => []),
|
|
303
|
+
enabled: !!(s != null && s.enabled),
|
|
300
304
|
staleTime: 6e4
|
|
301
|
-
}),
|
|
302
|
-
mutationFn: () =>
|
|
303
|
-
|
|
304
|
-
`/field-watches/self?collection=${encodeURIComponent(c)}&field=${encodeURIComponent(
|
|
305
|
+
}), g = w.includes(i), m = gt({
|
|
306
|
+
mutationFn: () => g ? p.request(
|
|
307
|
+
Pt(
|
|
308
|
+
`/field-watches/self?collection=${encodeURIComponent(c)}&field=${encodeURIComponent(i)}&item_id=${encodeURIComponent(e)}`
|
|
305
309
|
)
|
|
306
|
-
) : p.request(ge("/field-watches/self", { collection: c, field:
|
|
310
|
+
) : p.request(ge("/field-watches/self", { collection: c, field: i, item_id: e })),
|
|
307
311
|
onSuccess: () => {
|
|
308
|
-
|
|
309
|
-
|
|
312
|
+
f.invalidateQueries({ queryKey: l }), ae.success(
|
|
313
|
+
g ? "No longer watching this field" : "Watching — you will be notified when it changes"
|
|
310
314
|
);
|
|
311
315
|
},
|
|
312
|
-
onError: () =>
|
|
316
|
+
onError: () => ae.error("Could not update the watch")
|
|
313
317
|
});
|
|
314
|
-
return
|
|
318
|
+
return s != null && s.enabled ? /* @__PURE__ */ n(
|
|
315
319
|
"button",
|
|
316
320
|
{
|
|
317
321
|
type: "button",
|
|
318
|
-
onClick: () =>
|
|
319
|
-
title:
|
|
320
|
-
"data-field-watch":
|
|
321
|
-
className: `rounded p-0.5 transition-colors ${
|
|
322
|
-
children:
|
|
322
|
+
onClick: () => m.mutate(),
|
|
323
|
+
title: g ? "Stop watching this field on this record" : "Watch this field on this record",
|
|
324
|
+
"data-field-watch": i,
|
|
325
|
+
className: `rounded p-0.5 transition-colors ${g ? "text-nvr-navy dark:text-nvr-cyan" : "text-slate-300 hover:text-slate-500"}`,
|
|
326
|
+
children: g ? /* @__PURE__ */ n(Ct, { className: "h-3 w-3" }) : /* @__PURE__ */ n(Lt, { className: "h-3 w-3" })
|
|
323
327
|
}
|
|
324
328
|
) : null;
|
|
325
329
|
}
|
|
326
|
-
function
|
|
330
|
+
function An(c) {
|
|
327
331
|
return c ? c.querySelector(
|
|
328
332
|
'input:not([type=hidden]), textarea, [role="combobox"], [contenteditable="true"]'
|
|
329
333
|
) ?? c.querySelector("button") : null;
|
|
330
334
|
}
|
|
331
|
-
const
|
|
335
|
+
const ur = St(function({
|
|
332
336
|
field: e,
|
|
333
|
-
draft:
|
|
337
|
+
draft: i,
|
|
334
338
|
onChange: p,
|
|
335
|
-
relations:
|
|
336
|
-
collection:
|
|
339
|
+
relations: f,
|
|
340
|
+
collection: s,
|
|
337
341
|
itemId: l,
|
|
338
|
-
error:
|
|
339
|
-
visible:
|
|
340
|
-
locked:
|
|
341
|
-
layoutAiEnabled:
|
|
342
|
-
renderField:
|
|
342
|
+
error: w,
|
|
343
|
+
visible: g,
|
|
344
|
+
locked: m,
|
|
345
|
+
layoutAiEnabled: a,
|
|
346
|
+
renderField: b,
|
|
343
347
|
onCountChange: o,
|
|
344
|
-
swapButton:
|
|
348
|
+
swapButton: x,
|
|
345
349
|
swapContent: U,
|
|
346
|
-
forceVisible:
|
|
347
|
-
autoFillTick:
|
|
350
|
+
forceVisible: Qe,
|
|
351
|
+
autoFillTick: se
|
|
348
352
|
}) {
|
|
349
|
-
var De,
|
|
350
|
-
const H =
|
|
351
|
-
|
|
352
|
-
const t = Ne.current ?
|
|
353
|
+
var De, Me, Oe, Ke;
|
|
354
|
+
const H = Fn.has(e.interface ?? ""), N = qt(), y = rn(), we = Ge(), ce = ie(), [ke, W] = ve(!1), d = Ut(), _e = Bt(e.field), V = $(null), z = $t(), de = $(null), Ne = $(!1);
|
|
355
|
+
oe(() => {
|
|
356
|
+
const t = Ne.current ? An(de.current) : null;
|
|
353
357
|
if (!t || t.hasAttribute("aria-label")) return;
|
|
354
358
|
t.id || (t.id = `${z}-control`);
|
|
355
359
|
const r = t.tagName === "BUTTON" ? `${z} ${t.id}` : z;
|
|
356
360
|
t.getAttribute("aria-labelledby") !== r && t.setAttribute("aria-labelledby", r);
|
|
357
361
|
});
|
|
358
|
-
const Fe =
|
|
359
|
-
|
|
362
|
+
const Fe = m && !H, Ce = $(null);
|
|
363
|
+
oe(() => {
|
|
360
364
|
const t = Ce.current;
|
|
361
365
|
if (!t) return;
|
|
362
366
|
if (!Fe) {
|
|
@@ -365,42 +369,42 @@ const ir = Lt(function({
|
|
|
365
369
|
}
|
|
366
370
|
const r = typeof document < "u" ? document.activeElement : null;
|
|
367
371
|
r instanceof HTMLElement && t.contains(r) && r.blur(), t.setAttribute("inert", "");
|
|
368
|
-
}, [Fe,
|
|
369
|
-
const G = e.field, Le =
|
|
372
|
+
}, [Fe, se]);
|
|
373
|
+
const G = e.field, Le = He(
|
|
370
374
|
(t) => {
|
|
371
|
-
|
|
375
|
+
m || p(G, t);
|
|
372
376
|
},
|
|
373
|
-
[
|
|
374
|
-
),
|
|
377
|
+
[m, p, G]
|
|
378
|
+
), Ye = He(
|
|
375
379
|
(t) => o == null ? void 0 : o(G, t),
|
|
376
380
|
[o, G]
|
|
377
|
-
),
|
|
378
|
-
onContextMenu:
|
|
379
|
-
onKeyDown:
|
|
380
|
-
menu:
|
|
381
|
-
confirmSaveFrom:
|
|
382
|
-
openedBy:
|
|
383
|
-
} =
|
|
381
|
+
), Je = $(void 0), Re = $(void 0), Se = $(void 0), $e = !m && !e.readonly && !e.computed_formula && !(e.hidden && !e.layout_assigned) && !ze(e), {
|
|
382
|
+
onContextMenu: Xe,
|
|
383
|
+
onKeyDown: Ze,
|
|
384
|
+
menu: Ie,
|
|
385
|
+
confirmSaveFrom: et,
|
|
386
|
+
openedBy: ue
|
|
387
|
+
} = Ht({
|
|
384
388
|
wrapperRef: V,
|
|
385
389
|
field: e,
|
|
386
|
-
value:
|
|
387
|
-
relations:
|
|
388
|
-
collection:
|
|
390
|
+
value: i[e.field],
|
|
391
|
+
relations: f,
|
|
392
|
+
collection: s,
|
|
389
393
|
itemId: l,
|
|
390
|
-
openRelated:
|
|
394
|
+
openRelated: d == null ? void 0 : d.openRelated,
|
|
391
395
|
editable: $e
|
|
392
|
-
}),
|
|
396
|
+
}), E = Wt(V), tt = sn(), qe = d == null ? void 0 : d.remoteChanges[e.field], B = d == null ? void 0 : d.lockReasons[e.field], T = d == null ? void 0 : d.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, me = ln(C, e.field, $e), pe = () => {
|
|
393
397
|
var t, r;
|
|
394
|
-
return ((t =
|
|
395
|
-
}, Q =
|
|
396
|
-
async function
|
|
398
|
+
return ((t = de.current) == null ? void 0 : t.querySelector(Ve)) ?? ((r = V.current) == null ? void 0 : r.querySelector(Ve));
|
|
399
|
+
}, Q = At(e._overrides, a, Cn(e)), he = !!(d != null && d.fromAutofill) && !!e._overrides && e._overrides[Tt] === !0;
|
|
400
|
+
async function rt() {
|
|
397
401
|
var t;
|
|
398
|
-
if (Q.perField) return
|
|
402
|
+
if (Q.perField) return lt();
|
|
399
403
|
W(!0);
|
|
400
404
|
try {
|
|
401
|
-
const r = await
|
|
405
|
+
const r = await ce.request(
|
|
402
406
|
ge("/ai/generate", {
|
|
403
|
-
collection:
|
|
407
|
+
collection: s,
|
|
404
408
|
item_id: l !== "new" ? l : void 0,
|
|
405
409
|
field: e.field
|
|
406
410
|
})
|
|
@@ -411,42 +415,42 @@ const ir = Lt(function({
|
|
|
411
415
|
W(!1);
|
|
412
416
|
}
|
|
413
417
|
}
|
|
414
|
-
async function
|
|
415
|
-
var r, h,
|
|
418
|
+
async function lt() {
|
|
419
|
+
var r, h, k, R;
|
|
416
420
|
const t = {};
|
|
417
|
-
for (const
|
|
421
|
+
for (const _ of ((r = Et(e._overrides)) == null ? void 0 : r.tokens) ?? []) _ in i && (t[_] = i[_]);
|
|
418
422
|
W(!0);
|
|
419
423
|
try {
|
|
420
|
-
const
|
|
424
|
+
const _ = await ce.request(
|
|
421
425
|
ge("/ai/field-fill", {
|
|
422
|
-
collection:
|
|
423
|
-
layout_id: (
|
|
426
|
+
collection: s,
|
|
427
|
+
layout_id: (d == null ? void 0 : d.layoutId) ?? null,
|
|
424
428
|
field: e.field,
|
|
425
429
|
item_id: l && l !== "new" ? l : null,
|
|
426
430
|
values: t
|
|
427
431
|
})
|
|
428
|
-
),
|
|
429
|
-
typeof
|
|
430
|
-
} catch (
|
|
431
|
-
|
|
432
|
+
), F = (h = _.data) == null ? void 0 : h.value;
|
|
433
|
+
typeof F == "string" && F !== "" ? p(e.field, F) : ae.info("The AI had nothing to write here"), (R = (k = _.data) == null ? void 0 : k.missing) != null && R.length && ae.info(`Filled without ${_.data.missing.join(", ")} (empty or not visible to you)`);
|
|
434
|
+
} catch (_) {
|
|
435
|
+
jt(_, "AI fill failed", { action: "Fill with AI" });
|
|
432
436
|
} finally {
|
|
433
437
|
W(!1);
|
|
434
438
|
}
|
|
435
439
|
}
|
|
436
|
-
const
|
|
437
|
-
const r =
|
|
438
|
-
(
|
|
440
|
+
const P = Xt(e.dependency_config), Te = P.flatMap((t) => {
|
|
441
|
+
const r = f.find(
|
|
442
|
+
(k) => k.one_collection === s && k.one_field === t.parent_field
|
|
439
443
|
);
|
|
440
444
|
if (!r) return [];
|
|
441
445
|
if (r.junction_field) return [{ rule: t, rel: r }];
|
|
442
|
-
const h =
|
|
443
|
-
(
|
|
446
|
+
const h = f.find(
|
|
447
|
+
(k) => k.many_collection === r.many_collection && k.id !== r.id
|
|
444
448
|
);
|
|
445
449
|
return h != null && h.many_field ? [{ rule: t, rel: { ...r, junction_field: h.many_field } }] : [];
|
|
446
|
-
}),
|
|
450
|
+
}), ot = bt({
|
|
447
451
|
queries: Te.map(({ rel: t }) => ({
|
|
448
452
|
queryKey: ["m2m-items", t.many_collection, t.many_field, l],
|
|
449
|
-
queryFn: () =>
|
|
453
|
+
queryFn: () => ce.request(
|
|
450
454
|
K(`/items/${t.many_collection}`, {
|
|
451
455
|
filter: JSON.stringify({ [t.many_field]: { _eq: l } }),
|
|
452
456
|
limit: 200,
|
|
@@ -456,89 +460,96 @@ const ir = Lt(function({
|
|
|
456
460
|
enabled: !!l && l !== "new",
|
|
457
461
|
staleTime: 3e4
|
|
458
462
|
}))
|
|
459
|
-
}),
|
|
463
|
+
}), at = Object.fromEntries(
|
|
460
464
|
Te.map(({ rule: t, rel: r }, h) => {
|
|
461
|
-
var
|
|
462
|
-
const
|
|
465
|
+
var _;
|
|
466
|
+
const k = r.one_field ?? `${r.many_collection}.${r.junction_field}`, R = (y == null ? void 0 : y.getStagedUnlinks(k)) ?? /* @__PURE__ */ new Set();
|
|
463
467
|
return [
|
|
464
468
|
t.parent_field,
|
|
465
|
-
(((
|
|
469
|
+
(((_ = ot[h]) == null ? void 0 : _.data) ?? []).filter((F) => !R.has(F.id)).map((F) => F[r.junction_field])
|
|
466
470
|
];
|
|
467
471
|
})
|
|
468
|
-
), Y =
|
|
469
|
-
if (!
|
|
472
|
+
), Y = Ot()[e.field] ?? [];
|
|
473
|
+
if (!Qe && (!g || !e.layout_assigned && (e.hidden || Zt.has(e.field))))
|
|
470
474
|
return null;
|
|
471
|
-
const
|
|
475
|
+
const xe = i[e.field] ?? null, J = cn(e, tt), L = J.label ?? I(e.field);
|
|
472
476
|
Ne.current = L !== "";
|
|
473
|
-
const
|
|
474
|
-
const t =
|
|
475
|
-
(h) => h.one_collection ===
|
|
477
|
+
const q = ze(e), Ee = q ? null : dn(e), Pe = q || !(l === "new" || !l || (De = N == null ? void 0 : N.dirtyFields) != null && De.has(e.field)) ? null : bn(e, i), it = !q && !m && !e.readonly && ((Me = e._overrides) == null ? void 0 : Me.repeat_last) === !0, st = nn(e, i), ct = (Ke = (Oe = It(e.options)) == null ? void 0 : Oe.auto_id) == null ? void 0 : Ke.pattern, v = (() => {
|
|
478
|
+
const t = f.find(
|
|
479
|
+
(h) => h.one_collection === s && h.one_field === e.field
|
|
476
480
|
);
|
|
477
481
|
if (!t) return null;
|
|
478
482
|
if (t.junction_field) return t;
|
|
479
|
-
const r =
|
|
483
|
+
const r = f.find(
|
|
480
484
|
(h) => h.many_collection === t.many_collection && h.id !== t.id
|
|
481
485
|
);
|
|
482
486
|
return r ? { ...t, junction_field: r.many_field } : null;
|
|
483
|
-
})(), fe = v ? null :
|
|
487
|
+
})(), fe = v ? null : f.find((t) => t.many_collection === s && t.many_field === e.field) ?? null, ye = v ? f.find(
|
|
484
488
|
(t) => t.many_collection === v.many_collection && t.many_field === v.junction_field && t.id !== v.id
|
|
485
|
-
) ?? null : null,
|
|
489
|
+
) ?? null : null, D = v ? v.one_field ?? `${v.many_collection}.${v.junction_field}` : null, je = D ? (y == null ? void 0 : y.getStagedLinks(D)) ?? [] : [], dt = v ? (we.getQueryData([
|
|
486
490
|
"m2m-items",
|
|
487
491
|
v.many_collection,
|
|
488
492
|
v.many_field,
|
|
489
493
|
l
|
|
490
|
-
]) ?? []).map((t) => t[v.junction_field]) : [],
|
|
494
|
+
]) ?? []).map((t) => t[v.junction_field]) : [], ut = v ? je[0] ?? dt[0] ?? null : xe, mt = (ye == null ? void 0 : ye.one_collection) ?? (fe == null ? void 0 : fe.one_collection) ?? void 0, X = (t) => {
|
|
491
495
|
var r;
|
|
492
|
-
return ((
|
|
493
|
-
},
|
|
494
|
-
rules:
|
|
496
|
+
return ((N == null ? void 0 : N.collection) === s ? (r = N == null ? void 0 : N.fieldLabels) == null ? void 0 : r[t] : void 0) ?? I(String(t));
|
|
497
|
+
}, A = en({
|
|
498
|
+
rules: P,
|
|
495
499
|
// A parent whose value THIS field's own pick derived must not narrow this
|
|
496
500
|
// field's options — otherwise picking a region locks the region picker
|
|
497
501
|
// into the zone the pick itself filled, and cross-zone changes read as
|
|
498
502
|
// "No results".
|
|
499
503
|
skipParent: (t) => {
|
|
500
504
|
var r;
|
|
501
|
-
return ((r =
|
|
505
|
+
return ((r = y == null ? void 0 : y.getDerivedOrigin) == null ? void 0 : r.call(y, t)) === e.field;
|
|
502
506
|
},
|
|
503
507
|
parentValue: (t) => {
|
|
504
|
-
if (
|
|
505
|
-
const r =
|
|
508
|
+
if (i[t] != null) return i[t];
|
|
509
|
+
const r = f.find((S) => S.one_collection === s && S.one_field === t);
|
|
506
510
|
if (!r) return null;
|
|
507
511
|
let h = r;
|
|
508
512
|
if (!h.junction_field) {
|
|
509
|
-
const S =
|
|
510
|
-
(
|
|
513
|
+
const S = f.find(
|
|
514
|
+
(Ue) => Ue.many_collection === r.many_collection && Ue.id !== r.id
|
|
511
515
|
);
|
|
512
516
|
if (S != null && S.many_field) h = { ...r, junction_field: S.many_field };
|
|
513
517
|
else return null;
|
|
514
518
|
}
|
|
515
|
-
const
|
|
516
|
-
return
|
|
519
|
+
const k = h.one_field ?? `${h.many_collection}.${h.junction_field}`, R = (y == null ? void 0 : y.getStagedLinks(k)) ?? [], _ = at[t] ?? [], F = [...new Set([...R, ..._].map((S) => String(S)))];
|
|
520
|
+
return F.length === 0 ? null : F.length === 1 ? F[0] : F;
|
|
517
521
|
},
|
|
518
522
|
parentOptionFilter: (t) => {
|
|
519
523
|
var h;
|
|
520
|
-
const r = (
|
|
521
|
-
return r ?
|
|
524
|
+
const r = (N == null ? void 0 : N.collection) === s ? (h = N.fieldOptionFilters) == null ? void 0 : h[t] : void 0;
|
|
525
|
+
return r ? vn(r, i, l) : void 0;
|
|
522
526
|
}
|
|
523
|
-
}),
|
|
524
|
-
function
|
|
525
|
-
const t =
|
|
527
|
+
}), M = A.filter ? fn(Je, A.filter, yn) : A.filter, O = A.satisfiedParents.map(X), Z = A.satisfiedParents, pt = A.unsatisfiedParents.length ? X(A.unsatisfiedParents[0]) : null, be = A.missingRequiredParents, Be = be.length ? X(be[0]) : null;
|
|
528
|
+
function ht() {
|
|
529
|
+
const t = Se.current;
|
|
526
530
|
if (t && t.src === e) return t.value;
|
|
527
531
|
const r = { ...e, readonly: !0 };
|
|
528
|
-
return
|
|
532
|
+
return Se.current = { src: e, value: r }, r;
|
|
529
533
|
}
|
|
530
|
-
function
|
|
531
|
-
const t =
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
534
|
+
function xt() {
|
|
535
|
+
const t = Ln(
|
|
536
|
+
Z,
|
|
537
|
+
e.field,
|
|
538
|
+
y == null ? void 0 : y.getDerivedOrigin
|
|
539
|
+
), r = JSON.stringify([O, Z, t]), h = Re.current;
|
|
540
|
+
if (h && h.sig === r && h.onChange === p) return h.value;
|
|
541
|
+
const k = {
|
|
542
|
+
labels: O,
|
|
543
|
+
keys: Z,
|
|
544
|
+
clearable: t,
|
|
545
|
+
onClear: t.length > 0 ? (R) => {
|
|
546
|
+
t.includes(R) && p(R, null);
|
|
547
|
+
} : void 0
|
|
537
548
|
};
|
|
538
|
-
return
|
|
549
|
+
return Re.current = { sig: r, onChange: p, value: k }, k;
|
|
539
550
|
}
|
|
540
|
-
function
|
|
541
|
-
for (const t of
|
|
551
|
+
function ft() {
|
|
552
|
+
for (const t of Z) {
|
|
542
553
|
const r = document.querySelector(`[data-field="${t}"]`);
|
|
543
554
|
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(() => {
|
|
544
555
|
r.style.boxShadow = "none", setTimeout(() => {
|
|
@@ -547,103 +558,103 @@ const ir = Lt(function({
|
|
|
547
558
|
}, 900));
|
|
548
559
|
}
|
|
549
560
|
}
|
|
550
|
-
const
|
|
551
|
-
if (v &&
|
|
552
|
-
for (const r of
|
|
561
|
+
const yt = () => {
|
|
562
|
+
if (v && D) {
|
|
563
|
+
for (const r of je) y == null || y.unstageLink(D, r);
|
|
553
564
|
const t = we.getQueryData([
|
|
554
565
|
"m2m-items",
|
|
555
566
|
v.many_collection,
|
|
556
567
|
v.many_field,
|
|
557
568
|
l
|
|
558
569
|
]) ?? [];
|
|
559
|
-
for (const r of t)
|
|
570
|
+
for (const r of t) y == null || y.stageUnlink(D, r.id);
|
|
560
571
|
} else
|
|
561
572
|
p(e.field, null);
|
|
562
573
|
};
|
|
563
574
|
return (
|
|
564
575
|
// biome-ignore lint/a11y/noStaticElementInteractions: the wrapper only hosts the field context menu (right-click / Shift+F10); the inputs inside stay the controls
|
|
565
|
-
/* @__PURE__ */
|
|
576
|
+
/* @__PURE__ */ u(
|
|
566
577
|
"div",
|
|
567
578
|
{
|
|
568
579
|
ref: V,
|
|
569
580
|
"data-field": e.field,
|
|
570
|
-
"data-field-collection":
|
|
581
|
+
"data-field-collection": s,
|
|
571
582
|
"data-field-interface": e.interface ?? void 0,
|
|
572
|
-
"data-autofill-check":
|
|
583
|
+
"data-autofill-check": he ? "" : void 0,
|
|
573
584
|
className: j(
|
|
574
585
|
"group/fieldrow space-y-1.5",
|
|
575
|
-
|
|
586
|
+
he && "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
587
|
),
|
|
577
|
-
onContextMenu:
|
|
578
|
-
onKeyDown:
|
|
579
|
-
onFocusCapture:
|
|
588
|
+
onContextMenu: Xe,
|
|
589
|
+
onKeyDown: Ze,
|
|
590
|
+
onFocusCapture: E.onFocusCapture,
|
|
580
591
|
children: [
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
592
|
+
Ie,
|
|
593
|
+
P.length > 0 && /* @__PURE__ */ n(
|
|
594
|
+
tn,
|
|
584
595
|
{
|
|
585
|
-
cascadeRules:
|
|
586
|
-
cascadeFilter:
|
|
587
|
-
currentValue:
|
|
588
|
-
relatedCollection:
|
|
596
|
+
cascadeRules: P,
|
|
597
|
+
cascadeFilter: M,
|
|
598
|
+
currentValue: ut,
|
|
599
|
+
relatedCollection: mt,
|
|
589
600
|
missingRequiredParents: be,
|
|
590
|
-
onClear:
|
|
601
|
+
onClear: yt
|
|
591
602
|
}
|
|
592
603
|
),
|
|
593
|
-
(L !== "" || Y.length > 0) && /* @__PURE__ */
|
|
604
|
+
(L !== "" || Y.length > 0) && /* @__PURE__ */ u(
|
|
594
605
|
"div",
|
|
595
606
|
{
|
|
596
607
|
className: "flex flex-wrap items-center gap-1.5 min-h-[1.5rem]",
|
|
597
|
-
"data-pd-row":
|
|
608
|
+
"data-pd-row": me ? "" : void 0,
|
|
598
609
|
children: [
|
|
599
|
-
L !== "" && /* @__PURE__ */
|
|
600
|
-
/* @__PURE__ */ n(
|
|
610
|
+
L !== "" && /* @__PURE__ */ u(Mt, { id: z, "data-field-label": !0, className: "text-sm font-medium", children: [
|
|
611
|
+
/* @__PURE__ */ n(We, { text: L, collection: s }),
|
|
601
612
|
e.required && /* @__PURE__ */ n("span", { className: "ml-0.5 text-destructive", children: "*" }),
|
|
602
|
-
|
|
613
|
+
un(e) && /* @__PURE__ */ n(mn, {})
|
|
603
614
|
] }),
|
|
604
|
-
J.note && /* @__PURE__ */ n(
|
|
605
|
-
/* @__PURE__ */ n(
|
|
606
|
-
/* @__PURE__ */ n(
|
|
615
|
+
J.note && /* @__PURE__ */ n(ee, { delayDuration: 100, children: /* @__PURE__ */ u(te, { children: [
|
|
616
|
+
/* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ n(vt, { className: "h-3.5 w-3.5 shrink-0 cursor-help text-slate-400 hover:text-slate-600" }) }),
|
|
617
|
+
/* @__PURE__ */ n(re, { side: "top", className: "max-w-[240px] text-[12px]", children: (d == null ? void 0 : d.glossaryHelp) === !1 ? J.note : /* @__PURE__ */ n(We, { text: J.note, collection: s }) })
|
|
607
618
|
] }) }),
|
|
608
|
-
_e && /* @__PURE__ */ n(
|
|
609
|
-
!
|
|
610
|
-
|
|
619
|
+
_e && /* @__PURE__ */ n(Dt, { source: _e, label: L }),
|
|
620
|
+
!q && l && l !== "new" && /* @__PURE__ */ n(
|
|
621
|
+
$n,
|
|
611
622
|
{
|
|
612
|
-
collection:
|
|
623
|
+
collection: s,
|
|
613
624
|
itemId: l,
|
|
614
625
|
field: e.field,
|
|
615
626
|
onRestore: e.readonly ? void 0 : (t) => p(e.field, t)
|
|
616
627
|
}
|
|
617
628
|
),
|
|
618
|
-
!
|
|
619
|
-
!
|
|
620
|
-
l && l !== "new" &&
|
|
621
|
-
|
|
622
|
-
|
|
629
|
+
!q && l && l !== "new" && /* @__PURE__ */ n(qn, { collection: s, itemId: l, field: e.field }),
|
|
630
|
+
!q && l && l !== "new" && /* @__PURE__ */ n(Qt, { field: e.field, label: L || I(e.field) }),
|
|
631
|
+
l && l !== "new" && st && /* @__PURE__ */ n(Sn, { collection: s, itemId: l, field: e.field }),
|
|
632
|
+
it && /* @__PURE__ */ n(
|
|
633
|
+
pn,
|
|
623
634
|
{
|
|
624
|
-
collection:
|
|
635
|
+
collection: s,
|
|
625
636
|
itemId: l,
|
|
626
637
|
field: e.field,
|
|
627
|
-
label: L ||
|
|
638
|
+
label: L || I(e.field),
|
|
628
639
|
onFill: (t) => p(e.field, t)
|
|
629
640
|
}
|
|
630
641
|
),
|
|
631
|
-
!
|
|
642
|
+
!q && Q.show && !(Q.perField && (m || e.readonly)) && /* @__PURE__ */ u(
|
|
632
643
|
"button",
|
|
633
644
|
{
|
|
634
645
|
type: "button",
|
|
635
|
-
onClick:
|
|
646
|
+
onClick: rt,
|
|
636
647
|
disabled: ke,
|
|
637
648
|
"data-ai-fill": Q.perField ? e.field : void 0,
|
|
638
649
|
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
650
|
title: "Generate with AI",
|
|
640
651
|
children: [
|
|
641
|
-
ke ? /* @__PURE__ */ n(
|
|
652
|
+
ke ? /* @__PURE__ */ n(wt, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(kt, { className: "h-3 w-3" }),
|
|
642
653
|
"AI"
|
|
643
654
|
]
|
|
644
655
|
}
|
|
645
656
|
),
|
|
646
|
-
|
|
657
|
+
he && /* @__PURE__ */ n(
|
|
647
658
|
"span",
|
|
648
659
|
{
|
|
649
660
|
"data-tip": "People often change what the AI read from the document here — check it",
|
|
@@ -651,37 +662,37 @@ const ir = Lt(function({
|
|
|
651
662
|
children: "Check this"
|
|
652
663
|
}
|
|
653
664
|
),
|
|
654
|
-
|
|
655
|
-
|
|
665
|
+
x,
|
|
666
|
+
T && !m && !e.readonly && /* @__PURE__ */ u(
|
|
656
667
|
"button",
|
|
657
668
|
{
|
|
658
669
|
type: "button",
|
|
659
|
-
onClick: () =>
|
|
660
|
-
disabled:
|
|
670
|
+
onClick: () => T.onApply(i[e.field] ?? null),
|
|
671
|
+
disabled: i[e.field] == null || i[e.field] === "" || T.count === 0,
|
|
661
672
|
"data-apply-to-lines": e.field,
|
|
662
|
-
"data-tip":
|
|
673
|
+
"data-tip": T.count === 0 ? "No lines yet — add lines first" : i[e.field] == null || i[e.field] === "" ? "Pick a value first" : T.count != null ? `Copy this value onto all ${T.count} lines (staged until you save)` : "Copy this value onto every line (staged until you save)",
|
|
663
674
|
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
675
|
children: [
|
|
665
|
-
|
|
676
|
+
T.label ?? "Apply to lines",
|
|
666
677
|
" ↓"
|
|
667
678
|
]
|
|
668
679
|
}
|
|
669
680
|
),
|
|
670
|
-
Y.length > 0 && /* @__PURE__ */ n(
|
|
671
|
-
/* @__PURE__ */ n(
|
|
681
|
+
Y.length > 0 && /* @__PURE__ */ n(ee, { delayDuration: 100, children: /* @__PURE__ */ u(te, { children: [
|
|
682
|
+
/* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ u("span", { className: "inline-flex items-center gap-1 rounded-full bg-amber-50 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-400 dark:border-amber-500/20 cursor-default", children: [
|
|
672
683
|
/* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 shrink-0" }),
|
|
673
684
|
"addendum"
|
|
674
685
|
] }) }),
|
|
675
|
-
/* @__PURE__ */
|
|
676
|
-
/* @__PURE__ */
|
|
686
|
+
/* @__PURE__ */ u(re, { side: "top", className: "max-w-[220px] text-[12px]", children: [
|
|
687
|
+
/* @__PURE__ */ u("p", { className: "font-medium mb-1", children: [
|
|
677
688
|
"In active addendum",
|
|
678
689
|
Y.length > 1 ? "s" : "",
|
|
679
690
|
":"
|
|
680
691
|
] }),
|
|
681
|
-
Y.map((t) => /* @__PURE__ */
|
|
692
|
+
Y.map((t) => /* @__PURE__ */ u("p", { className: "text-slate-400", children: [
|
|
682
693
|
t.title,
|
|
683
694
|
" ",
|
|
684
|
-
/* @__PURE__ */
|
|
695
|
+
/* @__PURE__ */ u("span", { className: "capitalize", children: [
|
|
685
696
|
"(",
|
|
686
697
|
t.status,
|
|
687
698
|
")"
|
|
@@ -690,65 +701,65 @@ const ir = Lt(function({
|
|
|
690
701
|
] })
|
|
691
702
|
] }) }),
|
|
692
703
|
/* @__PURE__ */ n(
|
|
693
|
-
|
|
704
|
+
Jt,
|
|
694
705
|
{
|
|
695
|
-
collection:
|
|
706
|
+
collection: s,
|
|
696
707
|
kind: "field",
|
|
697
708
|
name: e.field,
|
|
698
709
|
label: L
|
|
699
710
|
}
|
|
700
711
|
),
|
|
701
|
-
(
|
|
702
|
-
/* @__PURE__ */ n(
|
|
703
|
-
/* @__PURE__ */ n(
|
|
712
|
+
(m || e.readonly) && B ? /* @__PURE__ */ n(Vt, { reason: B, onHover: d == null ? void 0 : d.onLockHover }) : m ? /* @__PURE__ */ n(ee, { delayDuration: 200, children: /* @__PURE__ */ u(te, { children: [
|
|
713
|
+
/* @__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" }) }) }),
|
|
714
|
+
/* @__PURE__ */ n(re, { side: "top", className: "text-[12px]", children: "This field is locked" })
|
|
704
715
|
] }) }) : null,
|
|
705
|
-
|
|
706
|
-
const t = !!
|
|
716
|
+
P.length > 0 && (() => {
|
|
717
|
+
const t = !!M && Object.keys(M).length > 0 && O.length > 0, r = P.map(
|
|
707
718
|
(h) => X(String(h.parent_field))
|
|
708
719
|
);
|
|
709
|
-
return /* @__PURE__ */ n(
|
|
710
|
-
/* @__PURE__ */ n(
|
|
720
|
+
return /* @__PURE__ */ n(ee, { delayDuration: 100, children: /* @__PURE__ */ u(te, { children: [
|
|
721
|
+
/* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ n(
|
|
711
722
|
"button",
|
|
712
723
|
{
|
|
713
724
|
type: "button",
|
|
714
725
|
"aria-label": `Show the fields that narrow ${L || "this list"}`,
|
|
715
|
-
onClick:
|
|
726
|
+
onClick: ft,
|
|
716
727
|
className: j(
|
|
717
728
|
"inline-flex items-center transition-colors",
|
|
718
729
|
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
730
|
),
|
|
720
|
-
children: /* @__PURE__ */ n(
|
|
731
|
+
children: /* @__PURE__ */ n(Nt, { className: "h-3 w-3" })
|
|
721
732
|
}
|
|
722
733
|
) }),
|
|
723
|
-
/* @__PURE__ */ n(
|
|
734
|
+
/* @__PURE__ */ n(re, { side: "top", className: "text-[12px]", children: t ? `Filtered by ${O.join(", ")} — click to highlight` : `Options filter by ${r.join(", ")} once set` })
|
|
724
735
|
] }) });
|
|
725
736
|
})(),
|
|
726
|
-
|
|
737
|
+
me && // Right-anchored: the personal-default control flush with the field's right edge
|
|
727
738
|
// (it carries Make / Update / Clear itself — no ⋯ button; right-click and
|
|
728
739
|
// Shift+F10 still open the field menu). The slot keeps one box whatever it shows,
|
|
729
740
|
// so nothing to its left moves.
|
|
730
741
|
/* @__PURE__ */ n("span", { className: "ml-auto inline-flex shrink-0 items-center gap-1", children: /* @__PURE__ */ n(
|
|
731
|
-
|
|
742
|
+
on,
|
|
732
743
|
{
|
|
733
744
|
field: e.field,
|
|
734
745
|
label: L,
|
|
735
|
-
state:
|
|
736
|
-
confirmOpen:
|
|
746
|
+
state: me,
|
|
747
|
+
confirmOpen: ue === "make" || ue === "update" ? ue : null,
|
|
737
748
|
onConfirm: (t, r) => (
|
|
738
749
|
// After a save the button becomes "Your default": focus goes to the field.
|
|
739
|
-
|
|
750
|
+
et(t, pe, r)
|
|
740
751
|
),
|
|
741
752
|
onUndo: () => {
|
|
742
753
|
C == null || C.undo(e.field), requestAnimationFrame(() => {
|
|
743
754
|
var t;
|
|
744
|
-
return (t =
|
|
755
|
+
return (t = pe()) == null ? void 0 : t.focus();
|
|
745
756
|
});
|
|
746
757
|
},
|
|
747
758
|
onCleared: () => (
|
|
748
759
|
// The Clear button is gone (and not a tab stop): focus goes to the field.
|
|
749
760
|
requestAnimationFrame(() => {
|
|
750
761
|
var t;
|
|
751
|
-
return (t =
|
|
762
|
+
return (t = pe()) == null ? void 0 : t.focus();
|
|
752
763
|
})
|
|
753
764
|
)
|
|
754
765
|
}
|
|
@@ -756,22 +767,22 @@ const ir = Lt(function({
|
|
|
756
767
|
]
|
|
757
768
|
}
|
|
758
769
|
),
|
|
759
|
-
|
|
760
|
-
|
|
770
|
+
E.editor && !m && /* @__PURE__ */ n(
|
|
771
|
+
zt,
|
|
761
772
|
{
|
|
762
|
-
editor:
|
|
763
|
-
confirming:
|
|
764
|
-
onConfirm:
|
|
765
|
-
onCancel:
|
|
773
|
+
editor: E.editor,
|
|
774
|
+
confirming: E.confirming,
|
|
775
|
+
onConfirm: E.confirm,
|
|
776
|
+
onCancel: E.cancel
|
|
766
777
|
}
|
|
767
778
|
),
|
|
768
779
|
U ?? /* @__PURE__ */ n(
|
|
769
780
|
"div",
|
|
770
781
|
{
|
|
771
|
-
ref:
|
|
772
|
-
className: j(
|
|
773
|
-
"data-tip": (
|
|
774
|
-
onPointerEnter: (
|
|
782
|
+
ref: de,
|
|
783
|
+
className: j(m && !H && "cursor-not-allowed"),
|
|
784
|
+
"data-tip": (m || e.readonly) && B ? B : void 0,
|
|
785
|
+
onPointerEnter: (m || e.readonly) && B ? d == null ? void 0 : d.onLockHover : void 0,
|
|
775
786
|
children: /* @__PURE__ */ n(
|
|
776
787
|
"div",
|
|
777
788
|
{
|
|
@@ -782,61 +793,81 @@ const ir = Lt(function({
|
|
|
782
793
|
// upload/replace/remove when readonly) — blocking pointer events
|
|
783
794
|
// made attachments unopenable on every locked form (addendum
|
|
784
795
|
// view, terminal states).
|
|
785
|
-
|
|
796
|
+
m && !H && "pointer-events-none opacity-60",
|
|
786
797
|
// The ring lands with a 2px shake so the eye finds the field;
|
|
787
798
|
// the animation runs once when the class is added.
|
|
788
|
-
|
|
789
|
-
|
|
799
|
+
w && "nvr-shake ring-1 ring-red-400 rounded-md",
|
|
800
|
+
se && "nvr-autofill-glow"
|
|
790
801
|
),
|
|
791
|
-
children:
|
|
792
|
-
|
|
802
|
+
children: q ? /* @__PURE__ */ n(hn, { field: e, values: i }) : ct ? /* @__PURE__ */ n(
|
|
803
|
+
Kt,
|
|
793
804
|
{
|
|
794
|
-
collection:
|
|
805
|
+
collection: s,
|
|
795
806
|
field: e,
|
|
796
|
-
draft:
|
|
807
|
+
draft: i,
|
|
797
808
|
itemId: l
|
|
798
809
|
}
|
|
799
|
-
) :
|
|
810
|
+
) : b ? b({
|
|
800
811
|
field: e,
|
|
801
|
-
value:
|
|
812
|
+
value: xe,
|
|
802
813
|
onChange: Le,
|
|
803
|
-
disabled:
|
|
804
|
-
collection:
|
|
814
|
+
disabled: m,
|
|
815
|
+
collection: s,
|
|
805
816
|
itemId: l,
|
|
806
|
-
relations:
|
|
807
|
-
cascadeFilter:
|
|
808
|
-
unsatisfiedParentLabel:
|
|
809
|
-
requiredParentLabel:
|
|
817
|
+
relations: f,
|
|
818
|
+
cascadeFilter: M,
|
|
819
|
+
unsatisfiedParentLabel: pt,
|
|
820
|
+
requiredParentLabel: Be
|
|
810
821
|
}) : /* @__PURE__ */ n(
|
|
811
|
-
|
|
822
|
+
Yt,
|
|
812
823
|
{
|
|
813
|
-
field:
|
|
814
|
-
value:
|
|
824
|
+
field: m && H ? ht() : e,
|
|
825
|
+
value: xe,
|
|
815
826
|
onChange: Le,
|
|
816
|
-
relations:
|
|
817
|
-
collection:
|
|
827
|
+
relations: f,
|
|
828
|
+
collection: s,
|
|
818
829
|
itemId: l,
|
|
819
|
-
cascadeFilter:
|
|
820
|
-
requiredParentLabel:
|
|
821
|
-
narrowedBy:
|
|
822
|
-
onCountChange: o ?
|
|
830
|
+
cascadeFilter: M,
|
|
831
|
+
requiredParentLabel: Be,
|
|
832
|
+
narrowedBy: O.length > 0 ? xt() : void 0,
|
|
833
|
+
onCountChange: o ? Ye : void 0
|
|
823
834
|
}
|
|
824
835
|
)
|
|
825
836
|
},
|
|
826
|
-
|
|
837
|
+
se ?? 0
|
|
827
838
|
)
|
|
828
839
|
}
|
|
829
840
|
),
|
|
830
|
-
Ee && /* @__PURE__ */ n(
|
|
831
|
-
|
|
841
|
+
Ee && /* @__PURE__ */ n(xn, { value: i[e.field], config: Ee }),
|
|
842
|
+
w && // The message under the field: a red border alone never said WHY (Service End before
|
|
843
|
+
// Start, b01-N5). The form's summary at the top lists it too.
|
|
844
|
+
/* @__PURE__ */ n(
|
|
845
|
+
"p",
|
|
846
|
+
{
|
|
847
|
+
role: "alert",
|
|
848
|
+
"data-field-error": e.field,
|
|
849
|
+
className: "text-[11.5px] leading-snug text-red-600 dark:text-red-400",
|
|
850
|
+
children: w
|
|
851
|
+
}
|
|
852
|
+
),
|
|
853
|
+
!w && Pe && // A soft (warning-only) rule the value breaks: said here, never blocks the save.
|
|
854
|
+
/* @__PURE__ */ n(
|
|
855
|
+
"p",
|
|
856
|
+
{
|
|
857
|
+
"data-field-warning": e.field,
|
|
858
|
+
className: "text-[11.5px] leading-snug text-amber-700 dark:text-amber-400",
|
|
859
|
+
children: Pe
|
|
860
|
+
}
|
|
861
|
+
),
|
|
862
|
+
Ae && !nt && /* @__PURE__ */ n(an, { field: e.field, text: Ae }),
|
|
832
863
|
qe && /* @__PURE__ */ n(
|
|
833
|
-
|
|
864
|
+
Gt,
|
|
834
865
|
{
|
|
835
866
|
change: qe,
|
|
836
|
-
onDismiss: () =>
|
|
837
|
-
onTakeTheirs:
|
|
867
|
+
onDismiss: () => d == null ? void 0 : d.dismissRemoteChange(e.field),
|
|
868
|
+
onTakeTheirs: d != null && d.takeRemoteChange ? () => {
|
|
838
869
|
var t;
|
|
839
|
-
return (t =
|
|
870
|
+
return (t = d.takeRemoteChange) == null ? void 0 : t.call(d, e.field);
|
|
840
871
|
} : void 0
|
|
841
872
|
}
|
|
842
873
|
)
|
|
@@ -846,7 +877,8 @@ const ir = Lt(function({
|
|
|
846
877
|
);
|
|
847
878
|
});
|
|
848
879
|
export {
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
880
|
+
ur as FieldRow,
|
|
881
|
+
Ln as clearableParents,
|
|
882
|
+
dr as lineageSummary,
|
|
883
|
+
Rn as useFieldLineage
|
|
852
884
|
};
|