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