@nivaro/react 0.3.32 → 0.3.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +89 -8
- package/dist/index.js +338 -328
- package/dist/shared/components/ForceReloadBanner.js +56 -46
- package/dist/shared/components/ItemEditForm.js +5637 -5442
- package/dist/shared/components/ProfileView.js +46 -44
- package/dist/shared/components/ReportView.js +208 -205
- package/dist/shared/components/SearchHighlight.js +30 -0
- package/dist/shared/components/TipLayer.js +39 -37
- package/dist/shared/components/item-edit/CatalogPickerField.js +1484 -1232
- package/dist/shared/components/item-edit/FieldAffordances.js +370 -203
- package/dist/shared/components/item-edit/FieldRow.js +396 -354
- package/dist/shared/components/item-edit/PersonalDefaultPill.js +50 -0
- package/dist/shared/components/item-edit/RelationCombobox.js +42 -41
- package/dist/shared/components/item-edit/catalog-search.js +34 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +34 -34
- package/dist/shared/components/item-edit/personal-default-checks.js +134 -0
- package/dist/shared/components/item-edit/usePersonalDefaults.js +358 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +130 -111
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +76 -75
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/profile/MyDefaultsCard.js +667 -0
- package/dist/shared/components/profile/PersonProfile.js +42 -40
- package/dist/shared/components/profile/my-defaults-labels.js +76 -0
- package/dist/shared/components/profile/primitives.js +72 -67
- package/dist/shared/lib/personal-defaults.js +76 -0
- package/dist/shared/lib/request-gate.js +78 -76
- package/dist/shared/lib/search-text.js +111 -0
- package/dist/shared/lib/unsaved-work.js +86 -38
- package/package.json +1 -1
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
import { jsxs as c, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Info as
|
|
4
|
-
import { memo as
|
|
2
|
+
import { useQueryClient as Ke, useQueries as pt, useQuery as ie, useMutation as ht } from "@tanstack/react-query";
|
|
3
|
+
import { Info as xt, Loader2 as ft, Sparkles as yt, Lock as bt, SlidersHorizontal as gt, MoreHorizontal as vt, History as wt, BellRing as kt, Bell as _t, Sigma as Nt } from "lucide-react";
|
|
4
|
+
import { memo as Ft, useState as be, useRef as R, useId as Ct, useEffect as ae, useCallback as Oe } from "react";
|
|
5
5
|
import { toast as K } from "sonner";
|
|
6
|
-
import { useParentDraft as
|
|
7
|
-
import { showsAiButton as
|
|
8
|
-
import { get as U, del as
|
|
9
|
-
import { titleCase as
|
|
10
|
-
import { GlossaryLabel as
|
|
11
|
-
import { Label as
|
|
12
|
-
import { TooltipProvider as
|
|
13
|
-
import { useAddendumFields as
|
|
14
|
-
import { AutoIdPreviewField as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
6
|
+
import { useParentDraft as Lt, useNivaroClient as oe } from "../../context.js";
|
|
7
|
+
import { showsAiButton as Rt, AUTOFILL_CHECK_KEY as St, readAiFill as $t } from "../../lib/ai-fill.js";
|
|
8
|
+
import { get as U, del as Tt, post as ye } from "../../lib/commands.js";
|
|
9
|
+
import { titleCase as fe, cn as A } from "../../lib/utils.js";
|
|
10
|
+
import { GlossaryLabel as De } from "../ai/GlossaryText.js";
|
|
11
|
+
import { Label as qt } from "../ui/label.js";
|
|
12
|
+
import { TooltipProvider as ee, Tooltip as te, TooltipTrigger as ne, TooltipContent as re } from "../ui/tooltip.js";
|
|
13
|
+
import { useAddendumFields as At } from "./AddendumFieldContext.js";
|
|
14
|
+
import { AutoIdPreviewField as Pt } from "./AutoIdPreviewField.js";
|
|
15
|
+
import { FOCUSABLE as Be } from "./entry/entry-keys.js";
|
|
16
|
+
import { useFieldAffordances as Et, useFieldContextMenu as jt, usePresenceSoftLock as Mt, LockReasonBadge as Ot, PresenceSoftLockStrip as Dt, RemoteChangeGhost as Bt } from "./FieldAffordances.js";
|
|
17
|
+
import { FieldRenderer as Ht } from "./FieldRenderer.js";
|
|
18
|
+
import { FormHelpVideoButton as Kt } from "./FormHelpVideoButton.js";
|
|
19
|
+
import { getCascadeFilters as Ut, SYSTEM_FIELDS as Wt, parseJson as zt, buildCascadeFilter as Vt, CascadeEffectController as Gt } from "./helpers.js";
|
|
20
|
+
import { isDerivedForRecord as Qt } from "./live-rollups.js";
|
|
21
|
+
import { useM2MStaging as Yt } from "./M2MStagingContext.js";
|
|
22
|
+
import { PersonalDefaultPill as Jt, PersonalDefaultHint as It } from "./PersonalDefaultPill.js";
|
|
23
|
+
import { isDisplayFormulaRow as He, usePlacementTextContext as Xt, placementFieldText as Zt, fieldCounterConfig as en, fieldIsRecommended as tn, RecommendedMarker as nn, RepeatLastButton as rn, DisplayFormulaValue as an, FieldCounter as on } from "./placement-behaviour.js";
|
|
24
|
+
import { keepIfEqual as ln, jsonEqual as sn } from "./render-stability.js";
|
|
25
|
+
import { usePersonalDefaultsApi as dn } from "./usePersonalDefaults.js";
|
|
26
|
+
import { resolveOptionFilterTokens as cn } from "../../lib/option-filter-tokens.js";
|
|
27
|
+
const un = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger", "number"]), mn = /* @__PURE__ */ new Set(["string", "text", "richtext", "textarea", "markdown", "json", "csv"]), pn = /* @__PURE__ */ new Set([
|
|
25
28
|
"input",
|
|
26
29
|
"textarea",
|
|
27
30
|
"wysiwyg",
|
|
@@ -29,7 +32,7 @@ const It = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger",
|
|
|
29
32
|
"input-rich-text-html",
|
|
30
33
|
"rich_text",
|
|
31
34
|
"extension-editorjs"
|
|
32
|
-
]),
|
|
35
|
+
]), hn = /* @__PURE__ */ new Set([
|
|
33
36
|
"relation-m2o",
|
|
34
37
|
"relation-m2m",
|
|
35
38
|
"select-multiple-m2m",
|
|
@@ -40,101 +43,101 @@ const It = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger",
|
|
|
40
43
|
"file",
|
|
41
44
|
"files",
|
|
42
45
|
"image"
|
|
43
|
-
]),
|
|
44
|
-
function
|
|
46
|
+
]), xn = /* @__PURE__ */ new Set(["file", "file-image", "files-m2m", "files", "image"]);
|
|
47
|
+
function fn(d) {
|
|
45
48
|
const e = d.interface ?? "";
|
|
46
|
-
return
|
|
49
|
+
return hn.has(e) || e.startsWith("relation-") || e.endsWith("-m2o") || e.endsWith("-m2m") ? !1 : !!(mn.has(d.type ?? "") || pn.has(e) || !e && d.type && !un.has(d.type));
|
|
47
50
|
}
|
|
48
|
-
function
|
|
49
|
-
const f =
|
|
50
|
-
return
|
|
51
|
-
queryKey: ["field-lineage", d, e,
|
|
51
|
+
function yn(d, e, m, h) {
|
|
52
|
+
const f = oe();
|
|
53
|
+
return ie({
|
|
54
|
+
queryKey: ["field-lineage", d, e, m],
|
|
52
55
|
queryFn: () => f.request(
|
|
53
|
-
U(`/lineage/${d}/${encodeURIComponent(e)}/${
|
|
54
|
-
).then((
|
|
55
|
-
enabled:
|
|
56
|
+
U(`/lineage/${d}/${encodeURIComponent(e)}/${m}`)
|
|
57
|
+
).then((l) => l.data),
|
|
58
|
+
enabled: h,
|
|
56
59
|
staleTime: 3e4
|
|
57
60
|
});
|
|
58
61
|
}
|
|
59
|
-
function
|
|
60
|
-
var
|
|
62
|
+
function Qn(d, e = "rows") {
|
|
63
|
+
var i, N, b;
|
|
61
64
|
if (d && (d.kind === "write" || d.kind === "read") && d.formula) {
|
|
62
|
-
const
|
|
65
|
+
const u = (y) => typeof y == "number" ? y.toLocaleString(void 0, { maximumFractionDigits: 2 }) : y == null || y === "" ? "∅" : String(y);
|
|
63
66
|
return `= ${d.formula.replace(/item\.([A-Za-z_][A-Za-z0-9_]*)/g, (y, a) => {
|
|
64
67
|
var x;
|
|
65
|
-
return
|
|
68
|
+
return u((x = d.inputs) == null ? void 0 : x[a]);
|
|
66
69
|
}).replace(/\s*-\s*/g, " − ").replace(/\s*\*\s*/g, " × ").replace(/\s*\/\s*/g, " ÷ ")}`;
|
|
67
70
|
}
|
|
68
71
|
if (!d || d.kind !== "rollup") return null;
|
|
69
|
-
const
|
|
72
|
+
const m = (d.sources ?? []).reduce((u, o) => u + o.rows.length, 0), h = (d.sources ?? []).reduce((u, o) => {
|
|
70
73
|
var y;
|
|
71
|
-
return
|
|
72
|
-
}, 0), f = (b = (N = (
|
|
73
|
-
var
|
|
74
|
-
return (
|
|
75
|
-
})) == null ? void 0 :
|
|
76
|
-
return
|
|
77
|
-
`${
|
|
78
|
-
),
|
|
74
|
+
return u + (((y = o.excluded) == null ? void 0 : y.length) ?? 0);
|
|
75
|
+
}, 0), f = (b = (N = (i = (d.sources ?? []).find((u) => {
|
|
76
|
+
var o;
|
|
77
|
+
return (o = u.excluded) == null ? void 0 : o.length;
|
|
78
|
+
})) == null ? void 0 : i.excluded) == null ? void 0 : N[0]) == null ? void 0 : b.reason, l = [`= ${m} ${m === 1 ? e.replace(/s$/, "") : e}`];
|
|
79
|
+
return h && l.push(
|
|
80
|
+
`${h} excluded${f ? ` (${f.replace(/^does not match: /, "")})` : ""}`
|
|
81
|
+
), l.join(" · ");
|
|
79
82
|
}
|
|
80
|
-
function
|
|
83
|
+
function bn({
|
|
81
84
|
collection: d,
|
|
82
85
|
itemId: e,
|
|
83
|
-
field:
|
|
86
|
+
field: m
|
|
84
87
|
}) {
|
|
85
|
-
const [
|
|
86
|
-
|
|
87
|
-
if (!
|
|
88
|
-
const
|
|
88
|
+
const [h, f] = be(!1), l = R(null), { data: i, isLoading: N } = yn(d, e, m, h);
|
|
89
|
+
ae(() => {
|
|
90
|
+
if (!h) return;
|
|
91
|
+
const o = (y) => {
|
|
89
92
|
var a;
|
|
90
|
-
(a =
|
|
93
|
+
(a = l.current) != null && a.contains(y.target) || f(!1);
|
|
91
94
|
};
|
|
92
|
-
return window.addEventListener("mousedown",
|
|
93
|
-
}, [
|
|
94
|
-
const b = (
|
|
95
|
-
return /* @__PURE__ */ c("div", { ref:
|
|
95
|
+
return window.addEventListener("mousedown", o), () => window.removeEventListener("mousedown", o);
|
|
96
|
+
}, [h]);
|
|
97
|
+
const b = (o) => o == null ? "—" : Number(o).toLocaleString(void 0, { maximumFractionDigits: 2 }), u = (i == null ? void 0 : i.stored_value) != null ? Number(i.stored_value) : null;
|
|
98
|
+
return /* @__PURE__ */ c("div", { ref: l, className: "relative inline-flex", children: [
|
|
96
99
|
/* @__PURE__ */ n(
|
|
97
100
|
"button",
|
|
98
101
|
{
|
|
99
102
|
type: "button",
|
|
100
|
-
onClick: () => f((
|
|
103
|
+
onClick: () => f((o) => !o),
|
|
101
104
|
title: "Where does this number come from?",
|
|
102
|
-
className:
|
|
105
|
+
className: A(
|
|
103
106
|
"inline-flex items-center rounded p-0.5 transition-opacity",
|
|
104
|
-
|
|
107
|
+
h ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
|
|
105
108
|
),
|
|
106
109
|
"data-field-lineage": !0,
|
|
107
|
-
children: /* @__PURE__ */ n(
|
|
110
|
+
children: /* @__PURE__ */ n(Nt, { className: "h-3 w-3" })
|
|
108
111
|
}
|
|
109
112
|
),
|
|
110
|
-
|
|
113
|
+
h && /* @__PURE__ */ c("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: [
|
|
111
114
|
/* @__PURE__ */ n("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Where this number comes from" }),
|
|
112
115
|
N && /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }),
|
|
113
|
-
(
|
|
114
|
-
/* @__PURE__ */ n("p", { className: "font-mono text-[11px] text-slate-600 dark:text-slate-300", children:
|
|
115
|
-
Object.entries(
|
|
116
|
-
/* @__PURE__ */ n("span", { className: "font-mono", children:
|
|
116
|
+
(i == null ? void 0 : i.kind) === "write" && /* @__PURE__ */ c("div", { className: "space-y-1 px-1 py-1", children: [
|
|
117
|
+
/* @__PURE__ */ n("p", { className: "font-mono text-[11px] text-slate-600 dark:text-slate-300", children: i.formula }),
|
|
118
|
+
Object.entries(i.inputs ?? {}).map(([o, y]) => /* @__PURE__ */ c("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
119
|
+
/* @__PURE__ */ n("span", { className: "font-mono", children: o }),
|
|
117
120
|
" = ",
|
|
118
121
|
b(y)
|
|
119
|
-
] },
|
|
122
|
+
] }, o)),
|
|
120
123
|
/* @__PURE__ */ c("p", { className: "pt-1 text-[11.5px] font-medium text-slate-700 dark:text-slate-200", children: [
|
|
121
124
|
"= ",
|
|
122
|
-
b(
|
|
125
|
+
b(i.stored_value)
|
|
123
126
|
] })
|
|
124
127
|
] }),
|
|
125
|
-
(
|
|
128
|
+
(i == null ? void 0 : i.kind) === "rollup" && (i.sources ?? []).map((o, y) => {
|
|
126
129
|
var a;
|
|
127
130
|
return /* @__PURE__ */ c("div", { className: "mb-1.5", children: [
|
|
128
131
|
/* @__PURE__ */ c("p", { className: "px-1 text-[10.5px] text-slate-400", children: [
|
|
129
|
-
(
|
|
130
|
-
|
|
132
|
+
(o.aggregate ?? "sum").toUpperCase(),
|
|
133
|
+
o.value_field ? ` of ${o.value_field}` : "",
|
|
131
134
|
" across ",
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
o.collection,
|
|
136
|
+
o.filtered ? " (filtered)" : ""
|
|
134
137
|
] }),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
o.error && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-amber-600 dark:text-amber-400", children: o.error }),
|
|
139
|
+
o.note && /* @__PURE__ */ n("p", { className: "px-1 py-1 text-[11.5px] text-slate-400", children: o.note }),
|
|
140
|
+
o.rows.length > 0 && /* @__PURE__ */ n("div", { className: "mt-0.5 space-y-px", children: o.rows.map((x) => /* @__PURE__ */ c(
|
|
138
141
|
"div",
|
|
139
142
|
{
|
|
140
143
|
className: "flex items-baseline gap-2 rounded px-1 py-0.5 text-[11.5px] hover:bg-slate-50 dark:hover:bg-muted",
|
|
@@ -153,19 +156,19 @@ function on({
|
|
|
153
156
|
},
|
|
154
157
|
x.id
|
|
155
158
|
)) }),
|
|
156
|
-
|
|
157
|
-
|
|
159
|
+
o.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." }),
|
|
160
|
+
o.subtotal != null && /* @__PURE__ */ c("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: [
|
|
158
161
|
"subtotal ",
|
|
159
|
-
b(
|
|
162
|
+
b(o.subtotal)
|
|
160
163
|
] }),
|
|
161
|
-
(((a =
|
|
164
|
+
(((a = o.excluded) == null ? void 0 : a.length) ?? 0) > 0 && /* @__PURE__ */ c("div", { className: "mt-1 rounded bg-slate-50 px-1 py-1 dark:bg-muted/40", children: [
|
|
162
165
|
/* @__PURE__ */ c("p", { className: "text-[10.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
163
|
-
|
|
166
|
+
o.excluded.length,
|
|
164
167
|
" excluded —",
|
|
165
168
|
" ",
|
|
166
|
-
|
|
169
|
+
o.excluded[0].reason.replace(/^does not match: /, "")
|
|
167
170
|
] }),
|
|
168
|
-
|
|
171
|
+
o.excluded.slice(0, 8).map((x) => /* @__PURE__ */ c(
|
|
169
172
|
"div",
|
|
170
173
|
{
|
|
171
174
|
className: "flex items-baseline gap-2 px-0.5 text-[11px] text-slate-400",
|
|
@@ -176,47 +179,47 @@ function on({
|
|
|
176
179
|
},
|
|
177
180
|
x.id
|
|
178
181
|
)),
|
|
179
|
-
|
|
182
|
+
o.excluded.length > 8 && /* @__PURE__ */ c("p", { className: "px-0.5 text-[10.5px] text-slate-400", children: [
|
|
180
183
|
"+",
|
|
181
|
-
|
|
184
|
+
o.excluded.length - 8,
|
|
182
185
|
" more"
|
|
183
186
|
] })
|
|
184
187
|
] })
|
|
185
188
|
] }, y);
|
|
186
189
|
}),
|
|
187
|
-
(
|
|
190
|
+
(i == null ? void 0 : i.kind) === "rollup" && u != null && /* @__PURE__ */ c("p", { className: "px-1 pt-0.5 text-right text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
188
191
|
"stored ",
|
|
189
|
-
b(
|
|
192
|
+
b(u),
|
|
190
193
|
(() => {
|
|
191
|
-
const
|
|
192
|
-
return (
|
|
194
|
+
const o = (i.sources ?? []).reduce((a, x) => a + (x.subtotal ?? 0), 0);
|
|
195
|
+
return (i.sources ?? []).some((a) => a.truncated) ? null : Math.abs(o - u) < 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" });
|
|
193
196
|
})()
|
|
194
197
|
] })
|
|
195
198
|
] })
|
|
196
199
|
] });
|
|
197
200
|
}
|
|
198
|
-
function
|
|
201
|
+
function gn({
|
|
199
202
|
collection: d,
|
|
200
203
|
itemId: e,
|
|
201
|
-
field:
|
|
202
|
-
formatValue:
|
|
204
|
+
field: m,
|
|
205
|
+
formatValue: h,
|
|
203
206
|
onRestore: f
|
|
204
207
|
}) {
|
|
205
|
-
const
|
|
206
|
-
queryKey: ["field-value-history", d, e,
|
|
207
|
-
queryFn: () =>
|
|
208
|
-
enabled:
|
|
208
|
+
const l = oe(), [i, N] = be(!1), b = R(null), { data: u, isLoading: o } = ie({
|
|
209
|
+
queryKey: ["field-value-history", d, e, m],
|
|
210
|
+
queryFn: () => l.request(U(`/field-history/${d}/${encodeURIComponent(e)}/${m}`)).then((a) => a.data ?? []),
|
|
211
|
+
enabled: i,
|
|
209
212
|
staleTime: 6e4
|
|
210
213
|
});
|
|
211
|
-
|
|
212
|
-
if (!
|
|
214
|
+
ae(() => {
|
|
215
|
+
if (!i) return;
|
|
213
216
|
const a = (x) => {
|
|
214
|
-
var
|
|
215
|
-
(
|
|
217
|
+
var W;
|
|
218
|
+
(W = b.current) != null && W.contains(x.target) || N(!1);
|
|
216
219
|
};
|
|
217
220
|
return window.addEventListener("mousedown", a), () => window.removeEventListener("mousedown", a);
|
|
218
|
-
}, [
|
|
219
|
-
const y = (a, x) => x || (a == null || a === "" ? "—" :
|
|
221
|
+
}, [i]);
|
|
222
|
+
const y = (a, x) => x || (a == null || a === "" ? "—" : h ? h(a) : typeof a == "boolean" || a === "true" || a === "false" ? a === !0 || a === "true" ? "Yes" : "No" : typeof a == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(a) ? new Date(a).toLocaleString() : typeof a == "object" ? JSON.stringify(a).slice(0, 60) : String(a).slice(0, 80));
|
|
220
223
|
return /* @__PURE__ */ c("div", { ref: b, className: "relative inline-flex", children: [
|
|
221
224
|
/* @__PURE__ */ n(
|
|
222
225
|
"button",
|
|
@@ -224,17 +227,17 @@ function sn({
|
|
|
224
227
|
type: "button",
|
|
225
228
|
onClick: () => N((a) => !a),
|
|
226
229
|
title: "Value history",
|
|
227
|
-
className:
|
|
230
|
+
className: A(
|
|
228
231
|
"inline-flex items-center rounded p-0.5 transition-opacity",
|
|
229
|
-
|
|
232
|
+
i ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
|
|
230
233
|
),
|
|
231
234
|
"data-field-history": !0,
|
|
232
|
-
children: /* @__PURE__ */ n(
|
|
235
|
+
children: /* @__PURE__ */ n(wt, { className: "h-3 w-3" })
|
|
233
236
|
}
|
|
234
237
|
),
|
|
235
|
-
|
|
238
|
+
i && /* @__PURE__ */ c("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: [
|
|
236
239
|
/* @__PURE__ */ n("p", { className: "mb-1 px-1 text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "Value history" }),
|
|
237
|
-
|
|
240
|
+
o ? /* @__PURE__ */ n("p", { className: "px-1 py-2 text-[11.5px] text-slate-400", children: "Loading…" }) : (u ?? []).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: (u ?? []).map((a, x) => /* @__PURE__ */ c(
|
|
238
241
|
"div",
|
|
239
242
|
{
|
|
240
243
|
className: "rounded px-1 py-1 text-[11.5px] leading-snug hover:bg-slate-50 dark:hover:bg-muted",
|
|
@@ -277,209 +280,214 @@ function sn({
|
|
|
277
280
|
] })
|
|
278
281
|
] });
|
|
279
282
|
}
|
|
280
|
-
function
|
|
283
|
+
function vn({
|
|
281
284
|
collection: d,
|
|
282
285
|
itemId: e,
|
|
283
|
-
field:
|
|
286
|
+
field: m
|
|
284
287
|
}) {
|
|
285
|
-
const
|
|
288
|
+
const h = oe(), f = Ke(), { data: l } = ie({
|
|
286
289
|
queryKey: ["field-watch-config"],
|
|
287
|
-
queryFn: () =>
|
|
290
|
+
queryFn: () => h.request(U("/field-watches/config")).then((o) => o.data).catch(() => ({ enabled: !1 })),
|
|
288
291
|
staleTime: 5 * 6e4
|
|
289
|
-
}),
|
|
290
|
-
queryKey:
|
|
291
|
-
queryFn: () =>
|
|
292
|
-
enabled: !!(
|
|
292
|
+
}), i = ["field-watch-self", d, e], { data: N = [] } = ie({
|
|
293
|
+
queryKey: i,
|
|
294
|
+
queryFn: () => h.request(U("/field-watches/self", { collection: d, item_id: e })).then((o) => o.data ?? []).catch(() => []),
|
|
295
|
+
enabled: !!(l != null && l.enabled),
|
|
293
296
|
staleTime: 6e4
|
|
294
|
-
}), b = N.includes(
|
|
295
|
-
mutationFn: () => b ?
|
|
296
|
-
|
|
297
|
-
`/field-watches/self?collection=${encodeURIComponent(d)}&field=${encodeURIComponent(
|
|
297
|
+
}), b = N.includes(m), u = ht({
|
|
298
|
+
mutationFn: () => b ? h.request(
|
|
299
|
+
Tt(
|
|
300
|
+
`/field-watches/self?collection=${encodeURIComponent(d)}&field=${encodeURIComponent(m)}&item_id=${encodeURIComponent(e)}`
|
|
298
301
|
)
|
|
299
|
-
) :
|
|
302
|
+
) : h.request(ye("/field-watches/self", { collection: d, field: m, item_id: e })),
|
|
300
303
|
onSuccess: () => {
|
|
301
|
-
f.invalidateQueries({ queryKey:
|
|
304
|
+
f.invalidateQueries({ queryKey: i }), K.success(
|
|
302
305
|
b ? "No longer watching this field" : "Watching — you will be notified when it changes"
|
|
303
306
|
);
|
|
304
307
|
},
|
|
305
308
|
onError: () => K.error("Could not update the watch")
|
|
306
309
|
});
|
|
307
|
-
return
|
|
310
|
+
return l != null && l.enabled ? /* @__PURE__ */ n(
|
|
308
311
|
"button",
|
|
309
312
|
{
|
|
310
313
|
type: "button",
|
|
311
|
-
onClick: () =>
|
|
314
|
+
onClick: () => u.mutate(),
|
|
312
315
|
title: b ? "Stop watching this field on this record" : "Watch this field on this record",
|
|
313
|
-
"data-field-watch":
|
|
316
|
+
"data-field-watch": m,
|
|
314
317
|
className: `rounded p-0.5 transition-colors ${b ? "text-nvr-navy dark:text-nvr-cyan" : "text-slate-300 hover:text-slate-500"}`,
|
|
315
|
-
children: b ? /* @__PURE__ */ n(
|
|
318
|
+
children: b ? /* @__PURE__ */ n(kt, { className: "h-3 w-3" }) : /* @__PURE__ */ n(_t, { className: "h-3 w-3" })
|
|
316
319
|
}
|
|
317
320
|
) : null;
|
|
318
321
|
}
|
|
319
|
-
function
|
|
322
|
+
function wn(d) {
|
|
320
323
|
return d ? d.querySelector(
|
|
321
324
|
'input:not([type=hidden]), textarea, [role="combobox"], [contenteditable="true"]'
|
|
322
325
|
) ?? d.querySelector("button") : null;
|
|
323
326
|
}
|
|
324
|
-
const
|
|
327
|
+
const Yn = Ft(function({
|
|
325
328
|
field: e,
|
|
326
|
-
draft:
|
|
327
|
-
onChange:
|
|
329
|
+
draft: m,
|
|
330
|
+
onChange: h,
|
|
328
331
|
relations: f,
|
|
329
|
-
collection:
|
|
330
|
-
itemId:
|
|
332
|
+
collection: l,
|
|
333
|
+
itemId: i,
|
|
331
334
|
error: N,
|
|
332
335
|
visible: b,
|
|
333
|
-
locked:
|
|
334
|
-
layoutAiEnabled:
|
|
336
|
+
locked: u,
|
|
337
|
+
layoutAiEnabled: o,
|
|
335
338
|
renderField: y,
|
|
336
339
|
onCountChange: a,
|
|
337
340
|
swapButton: x,
|
|
338
|
-
swapContent:
|
|
339
|
-
forceVisible:
|
|
340
|
-
autoFillTick:
|
|
341
|
+
swapContent: W,
|
|
342
|
+
forceVisible: Ue,
|
|
343
|
+
autoFillTick: le
|
|
341
344
|
}) {
|
|
342
|
-
var
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
const t =
|
|
345
|
+
var Ee, je, Me;
|
|
346
|
+
const z = xn.has(e.interface ?? ""), C = Lt(), g = Yt(), ge = Ke(), se = oe(), [ve, V] = be(!1), s = Et(), G = R(null), Q = Ct(), de = R(null), we = R(!1);
|
|
347
|
+
ae(() => {
|
|
348
|
+
const t = we.current ? wn(de.current) : null;
|
|
346
349
|
if (!t || t.hasAttribute("aria-label")) return;
|
|
347
|
-
t.id || (t.id = `${
|
|
348
|
-
const r = t.tagName === "BUTTON" ? `${
|
|
350
|
+
t.id || (t.id = `${Q}-control`);
|
|
351
|
+
const r = t.tagName === "BUTTON" ? `${Q} ${t.id}` : Q;
|
|
349
352
|
t.getAttribute("aria-labelledby") !== r && t.setAttribute("aria-labelledby", r);
|
|
350
353
|
});
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
const t =
|
|
354
|
+
const ke = u && !z, _e = R(null);
|
|
355
|
+
ae(() => {
|
|
356
|
+
const t = _e.current;
|
|
354
357
|
if (!t) return;
|
|
355
|
-
if (!
|
|
358
|
+
if (!ke) {
|
|
356
359
|
t.removeAttribute("inert");
|
|
357
360
|
return;
|
|
358
361
|
}
|
|
359
362
|
const r = typeof document < "u" ? document.activeElement : null;
|
|
360
363
|
r instanceof HTMLElement && t.contains(r) && r.blur(), t.setAttribute("inert", "");
|
|
361
|
-
}, [
|
|
362
|
-
const
|
|
364
|
+
}, [ke, le]);
|
|
365
|
+
const Y = e.field, Ne = Oe(
|
|
363
366
|
(t) => {
|
|
364
|
-
|
|
367
|
+
u || h(Y, t);
|
|
365
368
|
},
|
|
366
|
-
[
|
|
367
|
-
),
|
|
368
|
-
(t) => a == null ? void 0 : a(
|
|
369
|
-
[a,
|
|
370
|
-
),
|
|
371
|
-
onContextMenu:
|
|
372
|
-
onKeyDown:
|
|
373
|
-
menu:
|
|
374
|
-
|
|
375
|
-
|
|
369
|
+
[u, h, Y]
|
|
370
|
+
), We = Oe(
|
|
371
|
+
(t) => a == null ? void 0 : a(Y, t),
|
|
372
|
+
[a, Y]
|
|
373
|
+
), ze = R(void 0), Fe = R(void 0), Ce = R(void 0), {
|
|
374
|
+
onContextMenu: Ve,
|
|
375
|
+
onKeyDown: Ge,
|
|
376
|
+
menu: Qe,
|
|
377
|
+
openFrom: Ye,
|
|
378
|
+
isOpen: Le,
|
|
379
|
+
hasFieldItems: Je
|
|
380
|
+
} = jt({
|
|
381
|
+
wrapperRef: G,
|
|
376
382
|
field: e,
|
|
377
|
-
value:
|
|
383
|
+
value: m[e.field],
|
|
378
384
|
relations: f,
|
|
379
|
-
collection:
|
|
380
|
-
itemId:
|
|
381
|
-
openRelated: s == null ? void 0 : s.openRelated
|
|
382
|
-
|
|
383
|
-
|
|
385
|
+
collection: l,
|
|
386
|
+
itemId: i,
|
|
387
|
+
openRelated: s == null ? void 0 : s.openRelated,
|
|
388
|
+
// Only a field the person can edit here may carry a personal default.
|
|
389
|
+
editable: !u && !e.readonly && !e.computed_formula && !(e.hidden && !e.layout_assigned) && !He(e)
|
|
390
|
+
}), P = Mt(G), Ie = Xt(), Re = s == null ? void 0 : s.remoteChanges[e.field], O = s == null ? void 0 : s.lockReasons[e.field], T = s == null ? void 0 : s.applyToLines[e.field], L = dn(), Se = (L == null ? void 0 : L.applied(e.field)) ?? !1, $e = (L == null ? void 0 : L.hintFor(e.field)) ?? null, J = Rt(e._overrides, o, fn(e)), ce = !!(s != null && s.fromAutofill) && !!e._overrides && e._overrides[St] === !0;
|
|
391
|
+
async function Xe() {
|
|
384
392
|
var t;
|
|
385
|
-
if (
|
|
393
|
+
if (J.perField) return Ze();
|
|
386
394
|
V(!0);
|
|
387
395
|
try {
|
|
388
|
-
const r = await
|
|
389
|
-
|
|
390
|
-
collection:
|
|
391
|
-
item_id:
|
|
396
|
+
const r = await se.request(
|
|
397
|
+
ye("/ai/generate", {
|
|
398
|
+
collection: l,
|
|
399
|
+
item_id: i !== "new" ? i : void 0,
|
|
392
400
|
field: e.field
|
|
393
401
|
})
|
|
394
402
|
);
|
|
395
|
-
((t = r.data) == null ? void 0 : t.value) != null &&
|
|
403
|
+
((t = r.data) == null ? void 0 : t.value) != null && h(e.field, r.data.value);
|
|
396
404
|
} catch {
|
|
397
405
|
} finally {
|
|
398
406
|
V(!1);
|
|
399
407
|
}
|
|
400
408
|
}
|
|
401
|
-
async function
|
|
402
|
-
var r,
|
|
409
|
+
async function Ze() {
|
|
410
|
+
var r, p, k, M, q, F;
|
|
403
411
|
const t = {};
|
|
404
|
-
for (const v of ((r =
|
|
412
|
+
for (const v of ((r = $t(e._overrides)) == null ? void 0 : r.tokens) ?? []) v in m && (t[v] = m[v]);
|
|
405
413
|
V(!0);
|
|
406
414
|
try {
|
|
407
|
-
const v = await
|
|
408
|
-
|
|
409
|
-
collection:
|
|
415
|
+
const v = await se.request(
|
|
416
|
+
ye("/ai/field-fill", {
|
|
417
|
+
collection: l,
|
|
410
418
|
layout_id: (s == null ? void 0 : s.layoutId) ?? null,
|
|
411
419
|
field: e.field,
|
|
412
|
-
item_id:
|
|
420
|
+
item_id: i && i !== "new" ? i : null,
|
|
413
421
|
values: t
|
|
414
422
|
})
|
|
415
|
-
), _ = (
|
|
416
|
-
typeof _ == "string" && _ !== "" ?
|
|
423
|
+
), _ = (p = v.data) == null ? void 0 : p.value;
|
|
424
|
+
typeof _ == "string" && _ !== "" ? h(e.field, _) : K.info("The AI had nothing to write here"), (M = (k = v.data) == null ? void 0 : k.missing) != null && M.length && K.info(`Filled without ${v.data.missing.join(", ")} (empty or not visible to you)`);
|
|
417
425
|
} catch (v) {
|
|
418
426
|
const _ = v;
|
|
419
|
-
K.error(((F = (
|
|
427
|
+
K.error(((F = (q = _ == null ? void 0 : _.response) == null ? void 0 : q.data) == null ? void 0 : F.error) ?? (_ == null ? void 0 : _.message) ?? "AI fill failed");
|
|
420
428
|
} finally {
|
|
421
429
|
V(!1);
|
|
422
430
|
}
|
|
423
431
|
}
|
|
424
|
-
const
|
|
432
|
+
const E = Ut(e.dependency_config), Te = E.flatMap((t) => {
|
|
425
433
|
const r = f.find(
|
|
426
|
-
(k) => k.one_collection ===
|
|
434
|
+
(k) => k.one_collection === l && k.one_field === t.parent_field
|
|
427
435
|
);
|
|
428
436
|
if (!r) return [];
|
|
429
437
|
if (r.junction_field) return [{ rule: t, rel: r }];
|
|
430
|
-
const
|
|
438
|
+
const p = f.find(
|
|
431
439
|
(k) => k.many_collection === r.many_collection && k.id !== r.id
|
|
432
440
|
);
|
|
433
|
-
return
|
|
434
|
-
}),
|
|
435
|
-
queries:
|
|
436
|
-
queryKey: ["m2m-items", t.many_collection, t.many_field,
|
|
437
|
-
queryFn: () =>
|
|
441
|
+
return p != null && p.many_field ? [{ rule: t, rel: { ...r, junction_field: p.many_field } }] : [];
|
|
442
|
+
}), et = pt({
|
|
443
|
+
queries: Te.map(({ rel: t }) => ({
|
|
444
|
+
queryKey: ["m2m-items", t.many_collection, t.many_field, i],
|
|
445
|
+
queryFn: () => se.request(
|
|
438
446
|
U(`/items/${t.many_collection}`, {
|
|
439
|
-
filter: JSON.stringify({ [t.many_field]: { _eq:
|
|
447
|
+
filter: JSON.stringify({ [t.many_field]: { _eq: i } }),
|
|
440
448
|
limit: 200,
|
|
441
449
|
fields: `id,${t.junction_field}`
|
|
442
450
|
})
|
|
443
451
|
).then((r) => r.data ?? []),
|
|
444
|
-
enabled: !!
|
|
452
|
+
enabled: !!i && i !== "new",
|
|
445
453
|
staleTime: 3e4
|
|
446
454
|
}))
|
|
447
|
-
}),
|
|
448
|
-
|
|
449
|
-
var
|
|
450
|
-
const k = r.one_field ?? `${r.many_collection}.${r.junction_field}`,
|
|
455
|
+
}), tt = Object.fromEntries(
|
|
456
|
+
Te.map(({ rule: t, rel: r }, p) => {
|
|
457
|
+
var q;
|
|
458
|
+
const k = r.one_field ?? `${r.many_collection}.${r.junction_field}`, M = (g == null ? void 0 : g.getStagedUnlinks(k)) ?? /* @__PURE__ */ new Set();
|
|
451
459
|
return [
|
|
452
460
|
t.parent_field,
|
|
453
|
-
(((
|
|
461
|
+
(((q = et[p]) == null ? void 0 : q.data) ?? []).filter((F) => !M.has(F.id)).map((F) => F[r.junction_field])
|
|
454
462
|
];
|
|
455
463
|
})
|
|
456
|
-
),
|
|
457
|
-
if (!
|
|
464
|
+
), I = At()[e.field] ?? [];
|
|
465
|
+
if (!Ue && (!b || !e.layout_assigned && (e.hidden || Wt.has(e.field))))
|
|
458
466
|
return null;
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
const
|
|
467
|
+
const ue = m[e.field] ?? null, X = Zt(e, Ie), S = X.label ?? fe(e.field);
|
|
468
|
+
we.current = S !== "";
|
|
469
|
+
const j = He(e), qe = j ? null : en(e), nt = !j && !u && !e.readonly && ((Ee = e._overrides) == null ? void 0 : Ee.repeat_last) === !0, rt = Qt(e, m), it = (Me = (je = zt(e.options)) == null ? void 0 : je.auto_id) == null ? void 0 : Me.pattern, w = (() => {
|
|
462
470
|
const t = f.find(
|
|
463
|
-
(
|
|
471
|
+
(p) => p.one_collection === l && p.one_field === e.field
|
|
464
472
|
);
|
|
465
473
|
if (!t) return null;
|
|
466
474
|
if (t.junction_field) return t;
|
|
467
475
|
const r = f.find(
|
|
468
|
-
(
|
|
476
|
+
(p) => p.many_collection === t.many_collection && p.id !== t.id
|
|
469
477
|
);
|
|
470
478
|
return r ? { ...t, junction_field: r.many_field } : null;
|
|
471
|
-
})(),
|
|
479
|
+
})(), me = w ? null : f.find((t) => t.many_collection === l && t.many_field === e.field) ?? null, pe = w ? f.find(
|
|
472
480
|
(t) => t.many_collection === w.many_collection && t.many_field === w.junction_field && t.id !== w.id
|
|
473
|
-
) ?? null : null,
|
|
481
|
+
) ?? null : null, D = w ? w.one_field ?? `${w.many_collection}.${w.junction_field}` : null, Ae = D ? (g == null ? void 0 : g.getStagedLinks(D)) ?? [] : [], at = w ? (ge.getQueryData([
|
|
474
482
|
"m2m-items",
|
|
475
483
|
w.many_collection,
|
|
476
484
|
w.many_field,
|
|
477
|
-
|
|
478
|
-
]) ?? []).map((t) => t[w.junction_field]) : [],
|
|
485
|
+
i
|
|
486
|
+
]) ?? []).map((t) => t[w.junction_field]) : [], ot = w ? Ae[0] ?? at[0] ?? null : ue, lt = (pe == null ? void 0 : pe.one_collection) ?? (me == null ? void 0 : me.one_collection) ?? void 0, Z = (t) => {
|
|
479
487
|
var r;
|
|
480
|
-
return ((C == null ? void 0 : C.collection) ===
|
|
481
|
-
},
|
|
482
|
-
rules:
|
|
488
|
+
return ((C == null ? void 0 : C.collection) === l ? (r = C == null ? void 0 : C.fieldLabels) == null ? void 0 : r[t] : void 0) ?? fe(String(t));
|
|
489
|
+
}, $ = Vt({
|
|
490
|
+
rules: E,
|
|
483
491
|
// A parent whose value THIS field's own pick derived must not narrow this
|
|
484
492
|
// field's options — otherwise picking a region locks the region picker
|
|
485
493
|
// into the zone the pick itself filled, and cross-zone changes read as
|
|
@@ -489,44 +497,44 @@ const jn = ft(function({
|
|
|
489
497
|
return ((r = g == null ? void 0 : g.getDerivedOrigin) == null ? void 0 : r.call(g, t)) === e.field;
|
|
490
498
|
},
|
|
491
499
|
parentValue: (t) => {
|
|
492
|
-
if (
|
|
493
|
-
const r = f.find((v) => v.one_collection ===
|
|
500
|
+
if (m[t] != null) return m[t];
|
|
501
|
+
const r = f.find((v) => v.one_collection === l && v.one_field === t);
|
|
494
502
|
if (!r) return null;
|
|
495
|
-
let
|
|
496
|
-
if (!
|
|
503
|
+
let p = r;
|
|
504
|
+
if (!p.junction_field) {
|
|
497
505
|
const v = f.find(
|
|
498
506
|
(_) => _.many_collection === r.many_collection && _.id !== r.id
|
|
499
507
|
);
|
|
500
|
-
if (v != null && v.many_field)
|
|
508
|
+
if (v != null && v.many_field) p = { ...r, junction_field: v.many_field };
|
|
501
509
|
else return null;
|
|
502
510
|
}
|
|
503
|
-
const k =
|
|
511
|
+
const k = p.one_field ?? `${p.many_collection}.${p.junction_field}`, M = (g == null ? void 0 : g.getStagedLinks(k)) ?? [], q = tt[t] ?? [], F = [...new Set([...M, ...q].map((v) => String(v)))];
|
|
504
512
|
return F.length === 0 ? null : F.length === 1 ? F[0] : F;
|
|
505
513
|
},
|
|
506
514
|
parentOptionFilter: (t) => {
|
|
507
|
-
var
|
|
508
|
-
const r = (C == null ? void 0 : C.collection) ===
|
|
509
|
-
return r ?
|
|
515
|
+
var p;
|
|
516
|
+
const r = (C == null ? void 0 : C.collection) === l ? (p = C.fieldOptionFilters) == null ? void 0 : p[t] : void 0;
|
|
517
|
+
return r ? cn(r, m, i) : void 0;
|
|
510
518
|
}
|
|
511
|
-
}),
|
|
512
|
-
function
|
|
513
|
-
const t =
|
|
519
|
+
}), B = $.filter ? ln(ze, $.filter, sn) : $.filter, H = $.satisfiedParents.map(Z), he = $.satisfiedParents, st = $.unsatisfiedParents.length ? Z($.unsatisfiedParents[0]) : null, xe = $.missingRequiredParents, Pe = xe.length ? Z(xe[0]) : null;
|
|
520
|
+
function dt() {
|
|
521
|
+
const t = Ce.current;
|
|
514
522
|
if (t && t.src === e) return t.value;
|
|
515
523
|
const r = { ...e, readonly: !0 };
|
|
516
|
-
return
|
|
524
|
+
return Ce.current = { src: e, value: r }, r;
|
|
517
525
|
}
|
|
518
|
-
function
|
|
519
|
-
const t = JSON.stringify([
|
|
520
|
-
if (r && r.sig === t && r.onChange ===
|
|
521
|
-
const
|
|
522
|
-
labels:
|
|
523
|
-
keys:
|
|
524
|
-
onClear: (k) =>
|
|
526
|
+
function ct() {
|
|
527
|
+
const t = JSON.stringify([H, he]), r = Fe.current;
|
|
528
|
+
if (r && r.sig === t && r.onChange === h) return r.value;
|
|
529
|
+
const p = {
|
|
530
|
+
labels: H,
|
|
531
|
+
keys: he,
|
|
532
|
+
onClear: (k) => h(k, null)
|
|
525
533
|
};
|
|
526
|
-
return
|
|
534
|
+
return Fe.current = { sig: t, onChange: h, value: p }, p;
|
|
527
535
|
}
|
|
528
|
-
function
|
|
529
|
-
for (const t of
|
|
536
|
+
function ut() {
|
|
537
|
+
for (const t of he) {
|
|
530
538
|
const r = document.querySelector(`[data-field="${t}"]`);
|
|
531
539
|
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(() => {
|
|
532
540
|
r.style.boxShadow = "none", setTimeout(() => {
|
|
@@ -535,96 +543,96 @@ const jn = ft(function({
|
|
|
535
543
|
}, 900));
|
|
536
544
|
}
|
|
537
545
|
}
|
|
538
|
-
const
|
|
539
|
-
if (w &&
|
|
540
|
-
for (const r of
|
|
541
|
-
const t =
|
|
546
|
+
const mt = () => {
|
|
547
|
+
if (w && D) {
|
|
548
|
+
for (const r of Ae) g == null || g.unstageLink(D, r);
|
|
549
|
+
const t = ge.getQueryData([
|
|
542
550
|
"m2m-items",
|
|
543
551
|
w.many_collection,
|
|
544
552
|
w.many_field,
|
|
545
|
-
|
|
553
|
+
i
|
|
546
554
|
]) ?? [];
|
|
547
|
-
for (const r of t) g == null || g.stageUnlink(
|
|
555
|
+
for (const r of t) g == null || g.stageUnlink(D, r.id);
|
|
548
556
|
} else
|
|
549
|
-
|
|
557
|
+
h(e.field, null);
|
|
550
558
|
};
|
|
551
559
|
return (
|
|
552
560
|
// biome-ignore lint/a11y/noStaticElementInteractions: the wrapper only hosts the field context menu (right-click / Shift+F10); the inputs inside stay the controls
|
|
553
561
|
/* @__PURE__ */ c(
|
|
554
562
|
"div",
|
|
555
563
|
{
|
|
556
|
-
ref:
|
|
564
|
+
ref: G,
|
|
557
565
|
"data-field": e.field,
|
|
558
|
-
"data-field-collection":
|
|
566
|
+
"data-field-collection": l,
|
|
559
567
|
"data-field-interface": e.interface ?? void 0,
|
|
560
|
-
"data-autofill-check":
|
|
561
|
-
className:
|
|
568
|
+
"data-autofill-check": ce ? "" : void 0,
|
|
569
|
+
className: A(
|
|
562
570
|
"group/fieldrow space-y-1.5",
|
|
563
|
-
|
|
571
|
+
ce && "rounded-md bg-amber-50/60 p-1.5 ring-1 ring-amber-300 dark:bg-amber-500/10 dark:ring-amber-500/40"
|
|
564
572
|
),
|
|
565
|
-
onContextMenu:
|
|
566
|
-
onKeyDown:
|
|
567
|
-
onFocusCapture:
|
|
573
|
+
onContextMenu: Ve,
|
|
574
|
+
onKeyDown: Ge,
|
|
575
|
+
onFocusCapture: P.onFocusCapture,
|
|
568
576
|
children: [
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
577
|
+
Qe,
|
|
578
|
+
E.length > 0 && /* @__PURE__ */ n(
|
|
579
|
+
Gt,
|
|
572
580
|
{
|
|
573
|
-
cascadeRules:
|
|
574
|
-
cascadeFilter:
|
|
575
|
-
currentValue:
|
|
576
|
-
relatedCollection:
|
|
577
|
-
missingRequiredParents:
|
|
578
|
-
onClear:
|
|
581
|
+
cascadeRules: E,
|
|
582
|
+
cascadeFilter: B,
|
|
583
|
+
currentValue: ot,
|
|
584
|
+
relatedCollection: lt,
|
|
585
|
+
missingRequiredParents: xe,
|
|
586
|
+
onClear: mt
|
|
579
587
|
}
|
|
580
588
|
),
|
|
581
|
-
(S !== "" ||
|
|
582
|
-
S !== "" && /* @__PURE__ */ c(
|
|
583
|
-
/* @__PURE__ */ n(
|
|
589
|
+
(S !== "" || I.length > 0) && /* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-1.5 min-h-[1.5rem]", children: [
|
|
590
|
+
S !== "" && /* @__PURE__ */ c(qt, { id: Q, "data-field-label": !0, className: "text-sm font-medium", children: [
|
|
591
|
+
/* @__PURE__ */ n(De, { text: S, collection: l }),
|
|
584
592
|
e.required && /* @__PURE__ */ n("span", { className: "ml-0.5 text-destructive", children: "*" }),
|
|
585
|
-
|
|
593
|
+
tn(e) && /* @__PURE__ */ n(nn, {})
|
|
586
594
|
] }),
|
|
587
|
-
|
|
588
|
-
/* @__PURE__ */ n(
|
|
589
|
-
/* @__PURE__ */ n(
|
|
595
|
+
X.note && /* @__PURE__ */ n(ee, { delayDuration: 100, children: /* @__PURE__ */ c(te, { children: [
|
|
596
|
+
/* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ n(xt, { className: "h-3.5 w-3.5 shrink-0 cursor-help text-slate-400 hover:text-slate-600" }) }),
|
|
597
|
+
/* @__PURE__ */ n(re, { side: "top", className: "max-w-[240px] text-[12px]", children: (s == null ? void 0 : s.glossaryHelp) === !1 ? X.note : /* @__PURE__ */ n(De, { text: X.note, collection: l }) })
|
|
590
598
|
] }) }),
|
|
591
|
-
!
|
|
592
|
-
|
|
599
|
+
!j && i && i !== "new" && /* @__PURE__ */ n(
|
|
600
|
+
gn,
|
|
593
601
|
{
|
|
594
|
-
collection:
|
|
595
|
-
itemId:
|
|
602
|
+
collection: l,
|
|
603
|
+
itemId: i,
|
|
596
604
|
field: e.field,
|
|
597
|
-
onRestore: e.readonly ? void 0 : (t) =>
|
|
605
|
+
onRestore: e.readonly ? void 0 : (t) => h(e.field, t)
|
|
598
606
|
}
|
|
599
607
|
),
|
|
600
|
-
!
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
608
|
+
!j && i && i !== "new" && /* @__PURE__ */ n(vn, { collection: l, itemId: i, field: e.field }),
|
|
609
|
+
i && i !== "new" && rt && /* @__PURE__ */ n(bn, { collection: l, itemId: i, field: e.field }),
|
|
610
|
+
nt && /* @__PURE__ */ n(
|
|
611
|
+
rn,
|
|
604
612
|
{
|
|
605
|
-
collection:
|
|
606
|
-
itemId:
|
|
613
|
+
collection: l,
|
|
614
|
+
itemId: i,
|
|
607
615
|
field: e.field,
|
|
608
|
-
label: S ||
|
|
609
|
-
onFill: (t) =>
|
|
616
|
+
label: S || fe(e.field),
|
|
617
|
+
onFill: (t) => h(e.field, t)
|
|
610
618
|
}
|
|
611
619
|
),
|
|
612
|
-
!
|
|
620
|
+
!j && J.show && !(J.perField && (u || e.readonly)) && /* @__PURE__ */ c(
|
|
613
621
|
"button",
|
|
614
622
|
{
|
|
615
623
|
type: "button",
|
|
616
|
-
onClick:
|
|
617
|
-
disabled:
|
|
618
|
-
"data-ai-fill":
|
|
624
|
+
onClick: Xe,
|
|
625
|
+
disabled: ve,
|
|
626
|
+
"data-ai-fill": J.perField ? e.field : void 0,
|
|
619
627
|
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",
|
|
620
628
|
title: "Generate with AI",
|
|
621
629
|
children: [
|
|
622
|
-
|
|
630
|
+
ve ? /* @__PURE__ */ n(ft, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(yt, { className: "h-3 w-3" }),
|
|
623
631
|
"AI"
|
|
624
632
|
]
|
|
625
633
|
}
|
|
626
634
|
),
|
|
627
|
-
|
|
635
|
+
ce && /* @__PURE__ */ n(
|
|
628
636
|
"span",
|
|
629
637
|
{
|
|
630
638
|
"data-tip": "People often change what the AI read from the document here — check it",
|
|
@@ -632,34 +640,48 @@ const jn = ft(function({
|
|
|
632
640
|
children: "Check this"
|
|
633
641
|
}
|
|
634
642
|
),
|
|
643
|
+
Se && /* @__PURE__ */ n(
|
|
644
|
+
Jt,
|
|
645
|
+
{
|
|
646
|
+
field: e.field,
|
|
647
|
+
label: S,
|
|
648
|
+
onUndo: () => {
|
|
649
|
+
L == null || L.undo(e.field), requestAnimationFrame(() => {
|
|
650
|
+
var r, p;
|
|
651
|
+
const t = ((r = de.current) == null ? void 0 : r.querySelector(Be)) ?? ((p = G.current) == null ? void 0 : p.querySelector(Be));
|
|
652
|
+
t == null || t.focus();
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
),
|
|
635
657
|
x,
|
|
636
|
-
|
|
658
|
+
T && !u && !e.readonly && /* @__PURE__ */ c(
|
|
637
659
|
"button",
|
|
638
660
|
{
|
|
639
661
|
type: "button",
|
|
640
|
-
onClick: () =>
|
|
641
|
-
disabled:
|
|
662
|
+
onClick: () => T.onApply(m[e.field] ?? null),
|
|
663
|
+
disabled: m[e.field] == null || m[e.field] === "" || T.count === 0,
|
|
642
664
|
"data-apply-to-lines": e.field,
|
|
643
|
-
"data-tip":
|
|
665
|
+
"data-tip": T.count === 0 ? "No lines yet — add lines first" : m[e.field] == null || m[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)",
|
|
644
666
|
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",
|
|
645
667
|
children: [
|
|
646
|
-
|
|
668
|
+
T.label ?? "Apply to lines",
|
|
647
669
|
" ↓"
|
|
648
670
|
]
|
|
649
671
|
}
|
|
650
672
|
),
|
|
651
|
-
|
|
652
|
-
/* @__PURE__ */ n(
|
|
673
|
+
I.length > 0 && /* @__PURE__ */ n(ee, { delayDuration: 100, children: /* @__PURE__ */ c(te, { children: [
|
|
674
|
+
/* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ c("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: [
|
|
653
675
|
/* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 shrink-0" }),
|
|
654
676
|
"addendum"
|
|
655
677
|
] }) }),
|
|
656
|
-
/* @__PURE__ */ c(
|
|
678
|
+
/* @__PURE__ */ c(re, { side: "top", className: "max-w-[220px] text-[12px]", children: [
|
|
657
679
|
/* @__PURE__ */ c("p", { className: "font-medium mb-1", children: [
|
|
658
680
|
"In active addendum",
|
|
659
|
-
|
|
681
|
+
I.length > 1 ? "s" : "",
|
|
660
682
|
":"
|
|
661
683
|
] }),
|
|
662
|
-
|
|
684
|
+
I.map((t) => /* @__PURE__ */ c("p", { className: "text-slate-400", children: [
|
|
663
685
|
t.title,
|
|
664
686
|
" ",
|
|
665
687
|
/* @__PURE__ */ c("span", { className: "capitalize", children: [
|
|
@@ -671,116 +693,136 @@ const jn = ft(function({
|
|
|
671
693
|
] })
|
|
672
694
|
] }) }),
|
|
673
695
|
/* @__PURE__ */ n(
|
|
674
|
-
|
|
696
|
+
Kt,
|
|
675
697
|
{
|
|
676
|
-
collection:
|
|
698
|
+
collection: l,
|
|
677
699
|
kind: "field",
|
|
678
700
|
name: e.field,
|
|
679
701
|
label: S
|
|
680
702
|
}
|
|
681
703
|
),
|
|
682
|
-
(
|
|
683
|
-
/* @__PURE__ */ n(
|
|
684
|
-
/* @__PURE__ */ n(
|
|
704
|
+
(u || e.readonly) && O ? /* @__PURE__ */ n(Ot, { reason: O, onHover: s == null ? void 0 : s.onLockHover }) : u ? /* @__PURE__ */ n(ee, { delayDuration: 200, children: /* @__PURE__ */ c(te, { children: [
|
|
705
|
+
/* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ n("span", { className: "inline-flex items-center text-amber-400 dark:text-amber-500", children: /* @__PURE__ */ n(bt, { className: "h-3 w-3" }) }) }),
|
|
706
|
+
/* @__PURE__ */ n(re, { side: "top", className: "text-[12px]", children: "This field is locked" })
|
|
685
707
|
] }) }) : null,
|
|
686
|
-
|
|
687
|
-
const t = !!
|
|
688
|
-
(
|
|
708
|
+
E.length > 0 && (() => {
|
|
709
|
+
const t = !!B && Object.keys(B).length > 0 && H.length > 0, r = E.map(
|
|
710
|
+
(p) => Z(String(p.parent_field))
|
|
689
711
|
);
|
|
690
|
-
return /* @__PURE__ */ n(
|
|
691
|
-
/* @__PURE__ */ n(
|
|
712
|
+
return /* @__PURE__ */ n(ee, { delayDuration: 100, children: /* @__PURE__ */ c(te, { children: [
|
|
713
|
+
/* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ n(
|
|
692
714
|
"button",
|
|
693
715
|
{
|
|
694
716
|
type: "button",
|
|
695
717
|
"aria-label": `Show the fields that narrow ${S || "this list"}`,
|
|
696
|
-
onClick:
|
|
697
|
-
className:
|
|
718
|
+
onClick: ut,
|
|
719
|
+
className: A(
|
|
698
720
|
"inline-flex items-center transition-colors",
|
|
699
721
|
t ? "text-nvr-cyan hover:text-nvr-cyan" : "text-slate-300 hover:text-nvr-cyan dark:text-slate-600 dark:hover:text-nvr-cyan"
|
|
700
722
|
),
|
|
701
|
-
children: /* @__PURE__ */ n(
|
|
723
|
+
children: /* @__PURE__ */ n(gt, { className: "h-3 w-3" })
|
|
702
724
|
}
|
|
703
725
|
) }),
|
|
704
|
-
/* @__PURE__ */ n(
|
|
726
|
+
/* @__PURE__ */ n(re, { side: "top", className: "text-[12px]", children: t ? `Filtered by ${H.join(", ")} — click to highlight` : `Options filter by ${r.join(", ")} once set` })
|
|
705
727
|
] }) });
|
|
706
|
-
})()
|
|
728
|
+
})(),
|
|
729
|
+
Je && // The field menu for touch and pointer people (right-click / Shift+F10 still work).
|
|
730
|
+
// Shown on hover, focus and touch; opacity (not `hidden`) keeps its slot and its tab stop.
|
|
731
|
+
/* @__PURE__ */ n(
|
|
732
|
+
"button",
|
|
733
|
+
{
|
|
734
|
+
type: "button",
|
|
735
|
+
"data-field-menu-trigger": e.field,
|
|
736
|
+
"aria-label": "Field options",
|
|
737
|
+
"aria-haspopup": "menu",
|
|
738
|
+
"aria-expanded": Le,
|
|
739
|
+
"data-tip": "Field options",
|
|
740
|
+
onClick: (t) => Ye(t.currentTarget),
|
|
741
|
+
className: A(
|
|
742
|
+
"inline-flex h-5 w-5 items-center justify-center rounded text-slate-500 opacity-0 transition-[opacity,color,background-color] duration-150 hover:bg-muted hover:text-slate-800 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/40 group-hover/fieldrow:opacity-100 group-focus-within/fieldrow:opacity-100 [@media(hover:none)]:opacity-100 dark:text-slate-400 dark:hover:text-slate-100",
|
|
743
|
+
Le && "opacity-100"
|
|
744
|
+
),
|
|
745
|
+
children: /* @__PURE__ */ n(vt, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
746
|
+
}
|
|
747
|
+
)
|
|
707
748
|
] }),
|
|
708
|
-
|
|
709
|
-
|
|
749
|
+
P.editor && !u && /* @__PURE__ */ n(
|
|
750
|
+
Dt,
|
|
710
751
|
{
|
|
711
|
-
editor:
|
|
712
|
-
confirming:
|
|
713
|
-
onConfirm:
|
|
714
|
-
onCancel:
|
|
752
|
+
editor: P.editor,
|
|
753
|
+
confirming: P.confirming,
|
|
754
|
+
onConfirm: P.confirm,
|
|
755
|
+
onCancel: P.cancel
|
|
715
756
|
}
|
|
716
757
|
),
|
|
717
|
-
|
|
758
|
+
W ?? /* @__PURE__ */ n(
|
|
718
759
|
"div",
|
|
719
760
|
{
|
|
720
|
-
ref:
|
|
721
|
-
className:
|
|
722
|
-
"data-tip": (
|
|
723
|
-
onPointerEnter: (
|
|
761
|
+
ref: de,
|
|
762
|
+
className: A(u && !z && "cursor-not-allowed"),
|
|
763
|
+
"data-tip": (u || e.readonly) && O ? O : void 0,
|
|
764
|
+
onPointerEnter: (u || e.readonly) && O ? s == null ? void 0 : s.onLockHover : void 0,
|
|
724
765
|
children: /* @__PURE__ */ n(
|
|
725
766
|
"div",
|
|
726
767
|
{
|
|
727
|
-
ref:
|
|
728
|
-
className:
|
|
768
|
+
ref: _e,
|
|
769
|
+
className: A(
|
|
729
770
|
// A locked FILE field stays interactive: its chips keep the
|
|
730
771
|
// download link and preview click (the component itself hides
|
|
731
772
|
// upload/replace/remove when readonly) — blocking pointer events
|
|
732
773
|
// made attachments unopenable on every locked form (addendum
|
|
733
774
|
// view, terminal states).
|
|
734
|
-
|
|
775
|
+
u && !z && "pointer-events-none opacity-60",
|
|
735
776
|
// The ring lands with a 2px shake so the eye finds the field;
|
|
736
777
|
// the animation runs once when the class is added.
|
|
737
778
|
N && "nvr-shake ring-1 ring-red-400 rounded-md",
|
|
738
|
-
|
|
779
|
+
le && "nvr-autofill-glow"
|
|
739
780
|
),
|
|
740
|
-
children:
|
|
741
|
-
|
|
781
|
+
children: j ? /* @__PURE__ */ n(an, { field: e, values: m }) : it ? /* @__PURE__ */ n(
|
|
782
|
+
Pt,
|
|
742
783
|
{
|
|
743
|
-
collection:
|
|
784
|
+
collection: l,
|
|
744
785
|
field: e,
|
|
745
|
-
draft:
|
|
746
|
-
itemId:
|
|
786
|
+
draft: m,
|
|
787
|
+
itemId: i
|
|
747
788
|
}
|
|
748
789
|
) : y ? y({
|
|
749
790
|
field: e,
|
|
750
|
-
value:
|
|
751
|
-
onChange:
|
|
752
|
-
disabled:
|
|
753
|
-
collection:
|
|
754
|
-
itemId:
|
|
791
|
+
value: ue,
|
|
792
|
+
onChange: Ne,
|
|
793
|
+
disabled: u,
|
|
794
|
+
collection: l,
|
|
795
|
+
itemId: i,
|
|
755
796
|
relations: f,
|
|
756
|
-
cascadeFilter:
|
|
757
|
-
unsatisfiedParentLabel:
|
|
758
|
-
requiredParentLabel:
|
|
797
|
+
cascadeFilter: B,
|
|
798
|
+
unsatisfiedParentLabel: st,
|
|
799
|
+
requiredParentLabel: Pe
|
|
759
800
|
}) : /* @__PURE__ */ n(
|
|
760
|
-
|
|
801
|
+
Ht,
|
|
761
802
|
{
|
|
762
|
-
field:
|
|
763
|
-
value:
|
|
764
|
-
onChange:
|
|
803
|
+
field: u && z ? dt() : e,
|
|
804
|
+
value: ue,
|
|
805
|
+
onChange: Ne,
|
|
765
806
|
relations: f,
|
|
766
|
-
collection:
|
|
767
|
-
itemId:
|
|
768
|
-
cascadeFilter:
|
|
769
|
-
requiredParentLabel:
|
|
770
|
-
narrowedBy:
|
|
771
|
-
onCountChange: a ?
|
|
807
|
+
collection: l,
|
|
808
|
+
itemId: i,
|
|
809
|
+
cascadeFilter: B,
|
|
810
|
+
requiredParentLabel: Pe,
|
|
811
|
+
narrowedBy: H.length > 0 ? ct() : void 0,
|
|
812
|
+
onCountChange: a ? We : void 0
|
|
772
813
|
}
|
|
773
814
|
)
|
|
774
815
|
},
|
|
775
|
-
|
|
816
|
+
le ?? 0
|
|
776
817
|
)
|
|
777
818
|
}
|
|
778
819
|
),
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
820
|
+
qe && /* @__PURE__ */ n(on, { value: m[e.field], config: qe }),
|
|
821
|
+
$e && !Se && /* @__PURE__ */ n(It, { field: e.field, text: $e }),
|
|
822
|
+
Re && /* @__PURE__ */ n(
|
|
823
|
+
Bt,
|
|
782
824
|
{
|
|
783
|
-
change:
|
|
825
|
+
change: Re,
|
|
784
826
|
onDismiss: () => s == null ? void 0 : s.dismissRemoteChange(e.field),
|
|
785
827
|
onTakeTheirs: s != null && s.takeRemoteChange ? () => {
|
|
786
828
|
var t;
|
|
@@ -794,7 +836,7 @@ const jn = ft(function({
|
|
|
794
836
|
);
|
|
795
837
|
});
|
|
796
838
|
export {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
839
|
+
Yn as FieldRow,
|
|
840
|
+
Qn as lineageSummary,
|
|
841
|
+
yn as useFieldLineage
|
|
800
842
|
};
|