@nivaro/react 0.3.15 → 0.3.17
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 +127 -6
- package/dist/index.js +736 -734
- package/dist/shared/components/CollectionBrowserView.js +2344 -2309
- package/dist/shared/components/ItemEditForm.js +3773 -3604
- package/dist/shared/components/RecordGridEditor.js +319 -282
- package/dist/shared/components/RecordReadView.js +202 -200
- package/dist/shared/components/cbv/unknown-fields.js +18 -8
- package/dist/shared/components/chat/ChatAnalyticsView.js +2 -2
- package/dist/shared/components/import/DocumentAutofillButton.js +148 -142
- package/dist/shared/components/item-edit/CatalogPickerField.js +264 -276
- package/dist/shared/components/item-edit/FieldRenderer.js +136 -133
- package/dist/shared/components/item-edit/FieldRow.js +198 -184
- package/dist/shared/components/item-edit/HeaderTools.js +107 -99
- package/dist/shared/components/item-edit/InlineTableField.js +138 -136
- package/dist/shared/components/item-edit/RecordLiveSync.js +1 -0
- package/dist/shared/components/item-edit/RelationCombobox.js +30 -23
- package/dist/shared/components/item-edit/SummaryPanel.js +334 -294
- package/dist/shared/components/item-edit/column-length.js +12 -0
- package/dist/shared/components/panels/AccessDeniedPanel.js +47 -37
- package/dist/shared/components/panels/ItemLockBanner.js +307 -285
- package/dist/shared/components/panels/PipelinePanel.js +486 -465
- package/dist/shared/components/panels/RevisionsPanel.js +210 -204
- package/dist/shared/components/pipeline/PipelineEditorView.js +1672 -1568
- package/dist/shared/components/profile/DelegationCard.js +178 -121
- package/dist/shared/components/profile/PersonActivity.js +152 -139
- package/dist/shared/components/queue/QueueWorklist.js +668 -659
- package/dist/shared/components/queue/transition-note.js +90 -0
- package/dist/shared/components/support/SupportRequestDialog.js +100 -89
- package/dist/shared/components/support/TicketDetailSheet.js +104 -91
- package/dist/shared/lib/autofill-runs.js +33 -26
- package/dist/shared/lib/draft-store.js +40 -24
- package/dist/shared/lib/live-queries.js +10 -9
- package/dist/shared/lib/request-gate.js +140 -127
- package/dist/shared/lib/restore-skipped.js +10 -0
- package/package.json +1 -1
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { jsxs as d, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Info as
|
|
4
|
-
import { useState as
|
|
2
|
+
import { useQueryClient as qe, useQueries as Je, useQuery as te, useMutation as Xe } from "@tanstack/react-query";
|
|
3
|
+
import { Info as Ze, Loader2 as Ie, Sparkles as et, Lock as tt, SlidersHorizontal as nt, History as rt, BellRing as at, Bell as lt, Sigma as it } from "lucide-react";
|
|
4
|
+
import { useState as he, useRef as E, useId as ot, useEffect as ne } from "react";
|
|
5
5
|
import { toast as K } from "sonner";
|
|
6
|
-
import { useParentDraft as
|
|
7
|
-
import { showsAiButton as
|
|
8
|
-
import { get 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 { useFieldAffordances as
|
|
16
|
-
import { FieldRenderer as
|
|
17
|
-
import { FormHelpVideoButton as
|
|
18
|
-
import { getCascadeFilters as
|
|
19
|
-
import { isDerivedForRecord as
|
|
20
|
-
import { useM2MStaging as
|
|
21
|
-
import { usePlacementTextContext as
|
|
22
|
-
import { resolveOptionFilterTokens as
|
|
23
|
-
const
|
|
6
|
+
import { useParentDraft as st, useNivaroClient as re } from "../../context.js";
|
|
7
|
+
import { showsAiButton as dt, AUTOFILL_CHECK_KEY as ct, readAiFill as ut } from "../../lib/ai-fill.js";
|
|
8
|
+
import { get as B, del as mt, post as pe } from "../../lib/commands.js";
|
|
9
|
+
import { titleCase as me, cn as P } from "../../lib/utils.js";
|
|
10
|
+
import { GlossaryLabel as Te } from "../ai/GlossaryText.js";
|
|
11
|
+
import { Label as pt } from "../ui/label.js";
|
|
12
|
+
import { TooltipProvider as X, Tooltip as Z, TooltipTrigger as I, TooltipContent as ee } from "../ui/tooltip.js";
|
|
13
|
+
import { useAddendumFields as ht } from "./AddendumFieldContext.js";
|
|
14
|
+
import { AutoIdPreviewField as xt } from "./AutoIdPreviewField.js";
|
|
15
|
+
import { useFieldAffordances as ft, useFieldContextMenu as yt, usePresenceSoftLock as bt, LockReasonBadge as gt, PresenceSoftLockStrip as vt, RemoteChangeGhost as wt } from "./FieldAffordances.js";
|
|
16
|
+
import { FieldRenderer as kt } from "./FieldRenderer.js";
|
|
17
|
+
import { FormHelpVideoButton as _t } from "./FormHelpVideoButton.js";
|
|
18
|
+
import { getCascadeFilters as Nt, SYSTEM_FIELDS as Ct, parseJson as Ft, buildCascadeFilter as Lt, CascadeEffectController as Rt } from "./helpers.js";
|
|
19
|
+
import { isDerivedForRecord as $t } from "./live-rollups.js";
|
|
20
|
+
import { useM2MStaging as St } from "./M2MStagingContext.js";
|
|
21
|
+
import { usePlacementTextContext as Tt, placementFieldText as qt, isDisplayFormulaRow as At, fieldCounterConfig as jt, fieldIsRecommended as Et, RecommendedMarker as Pt, RepeatLastButton as Dt, DisplayFormulaValue as Mt, FieldCounter as Ot } from "./placement-behaviour.js";
|
|
22
|
+
import { resolveOptionFilterTokens as Kt } from "../../lib/option-filter-tokens.js";
|
|
23
|
+
const Bt = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger", "number"]), Ut = /* @__PURE__ */ new Set(["string", "text", "richtext", "textarea", "markdown", "json", "csv"]), Ht = /* @__PURE__ */ new Set([
|
|
24
24
|
"input",
|
|
25
25
|
"textarea",
|
|
26
26
|
"wysiwyg",
|
|
@@ -28,7 +28,7 @@ const Mt = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger",
|
|
|
28
28
|
"input-rich-text-html",
|
|
29
29
|
"rich_text",
|
|
30
30
|
"extension-editorjs"
|
|
31
|
-
]),
|
|
31
|
+
]), Wt = /* @__PURE__ */ new Set([
|
|
32
32
|
"relation-m2o",
|
|
33
33
|
"relation-m2m",
|
|
34
34
|
"select-multiple-m2m",
|
|
@@ -39,23 +39,23 @@ const Mt = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger",
|
|
|
39
39
|
"file",
|
|
40
40
|
"files",
|
|
41
41
|
"image"
|
|
42
|
-
]),
|
|
43
|
-
function
|
|
42
|
+
]), Vt = /* @__PURE__ */ new Set(["file", "file-image", "files-m2m", "files", "image"]);
|
|
43
|
+
function zt(e) {
|
|
44
44
|
const o = e.interface ?? "";
|
|
45
|
-
return
|
|
45
|
+
return Wt.has(o) || o.startsWith("relation-") || o.endsWith("-m2o") || o.endsWith("-m2m") ? !1 : !!(Ut.has(e.type ?? "") || Ht.has(o) || !o && e.type && !Bt.has(e.type));
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
const c =
|
|
49
|
-
return
|
|
47
|
+
function Gt(e, o, f, p) {
|
|
48
|
+
const c = re();
|
|
49
|
+
return te({
|
|
50
50
|
queryKey: ["field-lineage", e, o, f],
|
|
51
51
|
queryFn: () => c.request(
|
|
52
|
-
|
|
52
|
+
B(`/lineage/${e}/${encodeURIComponent(o)}/${f}`)
|
|
53
53
|
).then((i) => i.data),
|
|
54
54
|
enabled: p,
|
|
55
55
|
staleTime: 3e4
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function wn(e, o = "rows") {
|
|
59
59
|
var u, _, m;
|
|
60
60
|
if (e && (e.kind === "write" || e.kind === "read") && e.formula) {
|
|
61
61
|
const v = (y) => typeof y == "number" ? y.toLocaleString(void 0, { maximumFractionDigits: 2 }) : y == null || y === "" ? "∅" : String(y);
|
|
@@ -76,13 +76,13 @@ function bn(e, o = "rows") {
|
|
|
76
76
|
`${p} excluded${c ? ` (${c.replace(/^does not match: /, "")})` : ""}`
|
|
77
77
|
), i.join(" · ");
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function Qt({
|
|
80
80
|
collection: e,
|
|
81
81
|
itemId: o,
|
|
82
82
|
field: f
|
|
83
83
|
}) {
|
|
84
|
-
const [p, c] =
|
|
85
|
-
|
|
84
|
+
const [p, c] = he(!1), i = E(null), { data: u, isLoading: _ } = Gt(e, o, f, p);
|
|
85
|
+
ne(() => {
|
|
86
86
|
if (!p) return;
|
|
87
87
|
const l = (y) => {
|
|
88
88
|
var a;
|
|
@@ -103,7 +103,7 @@ function Vt({
|
|
|
103
103
|
p ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
|
|
104
104
|
),
|
|
105
105
|
"data-field-lineage": !0,
|
|
106
|
-
children: /* @__PURE__ */ n(
|
|
106
|
+
children: /* @__PURE__ */ n(it, { className: "h-3 w-3" })
|
|
107
107
|
}
|
|
108
108
|
),
|
|
109
109
|
p && /* @__PURE__ */ d("div", { className: "absolute left-0 top-full z-40 mt-1 max-h-[340px] w-[360px] overflow-y-auto rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
|
|
@@ -194,24 +194,24 @@ function Vt({
|
|
|
194
194
|
] })
|
|
195
195
|
] });
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function Yt({
|
|
198
198
|
collection: e,
|
|
199
199
|
itemId: o,
|
|
200
200
|
field: f,
|
|
201
201
|
formatValue: p,
|
|
202
202
|
onRestore: c
|
|
203
203
|
}) {
|
|
204
|
-
const i =
|
|
204
|
+
const i = re(), [u, _] = he(!1), m = E(null), { data: v, isLoading: l } = te({
|
|
205
205
|
queryKey: ["field-value-history", e, o, f],
|
|
206
|
-
queryFn: () => i.request(
|
|
206
|
+
queryFn: () => i.request(B(`/field-history/${e}/${encodeURIComponent(o)}/${f}`)).then((a) => a.data ?? []),
|
|
207
207
|
enabled: u,
|
|
208
208
|
staleTime: 6e4
|
|
209
209
|
});
|
|
210
|
-
|
|
210
|
+
ne(() => {
|
|
211
211
|
if (!u) return;
|
|
212
212
|
const a = (h) => {
|
|
213
|
-
var
|
|
214
|
-
(
|
|
213
|
+
var U;
|
|
214
|
+
(U = m.current) != null && U.contains(h.target) || _(!1);
|
|
215
215
|
};
|
|
216
216
|
return window.addEventListener("mousedown", a), () => window.removeEventListener("mousedown", a);
|
|
217
217
|
}, [u]);
|
|
@@ -228,7 +228,7 @@ function zt({
|
|
|
228
228
|
u ? "text-nvr-cyan opacity-100" : "text-slate-400 hover:text-nvr-cyan dark:text-slate-300 dark:hover:text-nvr-cyan"
|
|
229
229
|
),
|
|
230
230
|
"data-field-history": !0,
|
|
231
|
-
children: /* @__PURE__ */ n(
|
|
231
|
+
children: /* @__PURE__ */ n(rt, { className: "h-3 w-3" })
|
|
232
232
|
}
|
|
233
233
|
),
|
|
234
234
|
u && /* @__PURE__ */ d("div", { className: "absolute left-0 top-full z-40 mt-1 max-h-64 w-[300px] overflow-y-auto rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
|
|
@@ -276,26 +276,26 @@ function zt({
|
|
|
276
276
|
] })
|
|
277
277
|
] });
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function Jt({
|
|
280
280
|
collection: e,
|
|
281
281
|
itemId: o,
|
|
282
282
|
field: f
|
|
283
283
|
}) {
|
|
284
|
-
const p =
|
|
284
|
+
const p = re(), c = qe(), { data: i } = te({
|
|
285
285
|
queryKey: ["field-watch-config"],
|
|
286
|
-
queryFn: () => p.request(
|
|
286
|
+
queryFn: () => p.request(B("/field-watches/config")).then((l) => l.data).catch(() => ({ enabled: !1 })),
|
|
287
287
|
staleTime: 5 * 6e4
|
|
288
|
-
}), u = ["field-watch-self", e, o], { data: _ = [] } =
|
|
288
|
+
}), u = ["field-watch-self", e, o], { data: _ = [] } = te({
|
|
289
289
|
queryKey: u,
|
|
290
|
-
queryFn: () => p.request(
|
|
290
|
+
queryFn: () => p.request(B("/field-watches/self", { collection: e, item_id: o })).then((l) => l.data ?? []).catch(() => []),
|
|
291
291
|
enabled: !!(i != null && i.enabled),
|
|
292
292
|
staleTime: 6e4
|
|
293
|
-
}), m = _.includes(f), v =
|
|
293
|
+
}), m = _.includes(f), v = Xe({
|
|
294
294
|
mutationFn: () => m ? p.request(
|
|
295
|
-
|
|
295
|
+
mt(
|
|
296
296
|
`/field-watches/self?collection=${encodeURIComponent(e)}&field=${encodeURIComponent(f)}&item_id=${encodeURIComponent(o)}`
|
|
297
297
|
)
|
|
298
|
-
) : p.request(
|
|
298
|
+
) : p.request(pe("/field-watches/self", { collection: e, field: f, item_id: o })),
|
|
299
299
|
onSuccess: () => {
|
|
300
300
|
c.invalidateQueries({ queryKey: u }), K.success(
|
|
301
301
|
m ? "No longer watching this field" : "Watching — you will be notified when it changes"
|
|
@@ -311,16 +311,16 @@ function Gt({
|
|
|
311
311
|
title: m ? "Stop watching this field on this record" : "Watch this field on this record",
|
|
312
312
|
"data-field-watch": f,
|
|
313
313
|
className: `rounded p-0.5 transition-colors ${m ? "text-nvr-navy dark:text-nvr-cyan" : "text-slate-300 hover:text-slate-500"}`,
|
|
314
|
-
children: m ? /* @__PURE__ */ n(
|
|
314
|
+
children: m ? /* @__PURE__ */ n(at, { className: "h-3 w-3" }) : /* @__PURE__ */ n(lt, { className: "h-3 w-3" })
|
|
315
315
|
}
|
|
316
316
|
) : null;
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function Xt(e) {
|
|
319
319
|
return e ? e.querySelector(
|
|
320
320
|
'input:not([type=hidden]), textarea, [role="combobox"], [contenteditable="true"]'
|
|
321
321
|
) ?? e.querySelector("button") : null;
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function kn({
|
|
324
324
|
field: e,
|
|
325
325
|
draft: o,
|
|
326
326
|
onChange: f,
|
|
@@ -335,38 +335,51 @@ function gn({
|
|
|
335
335
|
onCountChange: y,
|
|
336
336
|
swapButton: a,
|
|
337
337
|
swapContent: h,
|
|
338
|
-
forceVisible:
|
|
339
|
-
autoFillTick:
|
|
338
|
+
forceVisible: U,
|
|
339
|
+
autoFillTick: ae
|
|
340
340
|
}) {
|
|
341
|
-
var
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
const t = be.current ?
|
|
341
|
+
var Re, $e, Se;
|
|
342
|
+
const H = Vt.has(e.interface ?? ""), F = st(), b = St(), xe = qe(), le = re(), [fe, W] = he(!1), s = ft(), ie = E(null), V = ot(), ye = E(null), be = E(!1);
|
|
343
|
+
ne(() => {
|
|
344
|
+
const t = be.current ? Xt(ye.current) : null;
|
|
345
345
|
if (!t || t.hasAttribute("aria-label")) return;
|
|
346
|
-
t.id || (t.id = `${
|
|
347
|
-
const r = t.tagName === "BUTTON" ? `${
|
|
346
|
+
t.id || (t.id = `${V}-control`);
|
|
347
|
+
const r = t.tagName === "BUTTON" ? `${V} ${t.id}` : V;
|
|
348
348
|
t.getAttribute("aria-labelledby") !== r && t.setAttribute("aria-labelledby", r);
|
|
349
349
|
});
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
350
|
+
const ge = m && !H, ve = E(null);
|
|
351
|
+
ne(() => {
|
|
352
|
+
const t = ve.current;
|
|
353
|
+
if (!t) return;
|
|
354
|
+
if (!ge) {
|
|
355
|
+
t.removeAttribute("inert");
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
const r = typeof document < "u" ? document.activeElement : null;
|
|
359
|
+
r instanceof HTMLElement && t.contains(r) && r.blur(), t.setAttribute("inert", "");
|
|
360
|
+
}, [ge, ae]);
|
|
361
|
+
const we = (t) => {
|
|
362
|
+
m || f(e.field, t);
|
|
363
|
+
}, {
|
|
364
|
+
onContextMenu: Ae,
|
|
365
|
+
onKeyDown: je,
|
|
366
|
+
menu: Ee
|
|
367
|
+
} = yt({
|
|
368
|
+
wrapperRef: ie,
|
|
356
369
|
field: e,
|
|
357
370
|
value: o[e.field],
|
|
358
371
|
relations: p,
|
|
359
372
|
collection: c,
|
|
360
373
|
itemId: i,
|
|
361
374
|
openRelated: s == null ? void 0 : s.openRelated
|
|
362
|
-
}), S =
|
|
363
|
-
async function
|
|
375
|
+
}), S = bt(ie), Pe = Tt(), ke = s == null ? void 0 : s.remoteChanges[e.field], D = s == null ? void 0 : s.lockReasons[e.field], L = s == null ? void 0 : s.applyToLines[e.field], z = dt(e._overrides, v, zt(e)), oe = !!(s != null && s.fromAutofill) && !!e._overrides && e._overrides[ct] === !0;
|
|
376
|
+
async function De() {
|
|
364
377
|
var t;
|
|
365
|
-
if (
|
|
366
|
-
|
|
378
|
+
if (z.perField) return Me();
|
|
379
|
+
W(!0);
|
|
367
380
|
try {
|
|
368
|
-
const r = await
|
|
369
|
-
|
|
381
|
+
const r = await le.request(
|
|
382
|
+
pe("/ai/generate", {
|
|
370
383
|
collection: c,
|
|
371
384
|
item_id: i !== "new" ? i : void 0,
|
|
372
385
|
field: e.field
|
|
@@ -375,17 +388,17 @@ function gn({
|
|
|
375
388
|
((t = r.data) == null ? void 0 : t.value) != null && f(e.field, r.data.value);
|
|
376
389
|
} catch {
|
|
377
390
|
} finally {
|
|
378
|
-
|
|
391
|
+
W(!1);
|
|
379
392
|
}
|
|
380
393
|
}
|
|
381
|
-
async function
|
|
382
|
-
var r, x, N,
|
|
394
|
+
async function Me() {
|
|
395
|
+
var r, x, N, j, $, C;
|
|
383
396
|
const t = {};
|
|
384
|
-
for (const g of ((r =
|
|
385
|
-
|
|
397
|
+
for (const g of ((r = ut(e._overrides)) == null ? void 0 : r.tokens) ?? []) g in o && (t[g] = o[g]);
|
|
398
|
+
W(!0);
|
|
386
399
|
try {
|
|
387
|
-
const g = await
|
|
388
|
-
|
|
400
|
+
const g = await le.request(
|
|
401
|
+
pe("/ai/field-fill", {
|
|
389
402
|
collection: c,
|
|
390
403
|
layout_id: (s == null ? void 0 : s.layoutId) ?? null,
|
|
391
404
|
field: e.field,
|
|
@@ -393,15 +406,15 @@ function gn({
|
|
|
393
406
|
values: t
|
|
394
407
|
})
|
|
395
408
|
), k = (x = g.data) == null ? void 0 : x.value;
|
|
396
|
-
typeof k == "string" && k !== "" ? f(e.field, k) : K.info("The AI had nothing to write here"), (
|
|
409
|
+
typeof k == "string" && k !== "" ? f(e.field, k) : K.info("The AI had nothing to write here"), (j = (N = g.data) == null ? void 0 : N.missing) != null && j.length && K.info(`Filled without ${g.data.missing.join(", ")} (empty or not visible to you)`);
|
|
397
410
|
} catch (g) {
|
|
398
411
|
const k = g;
|
|
399
412
|
K.error(((C = ($ = k == null ? void 0 : k.response) == null ? void 0 : $.data) == null ? void 0 : C.error) ?? (k == null ? void 0 : k.message) ?? "AI fill failed");
|
|
400
413
|
} finally {
|
|
401
|
-
|
|
414
|
+
W(!1);
|
|
402
415
|
}
|
|
403
416
|
}
|
|
404
|
-
const T =
|
|
417
|
+
const T = Nt(e.dependency_config), _e = T.flatMap((t) => {
|
|
405
418
|
const r = p.find(
|
|
406
419
|
(N) => N.one_collection === c && N.one_field === t.parent_field
|
|
407
420
|
);
|
|
@@ -411,11 +424,11 @@ function gn({
|
|
|
411
424
|
(N) => N.many_collection === r.many_collection && N.id !== r.id
|
|
412
425
|
);
|
|
413
426
|
return x != null && x.many_field ? [{ rule: t, rel: { ...r, junction_field: x.many_field } }] : [];
|
|
414
|
-
}),
|
|
415
|
-
queries:
|
|
427
|
+
}), Oe = Je({
|
|
428
|
+
queries: _e.map(({ rel: t }) => ({
|
|
416
429
|
queryKey: ["m2m-items", t.many_collection, t.many_field, i],
|
|
417
|
-
queryFn: () =>
|
|
418
|
-
|
|
430
|
+
queryFn: () => le.request(
|
|
431
|
+
B(`/items/${t.many_collection}`, {
|
|
419
432
|
filter: JSON.stringify({ [t.many_field]: { _eq: i } }),
|
|
420
433
|
limit: 200,
|
|
421
434
|
fields: `id,${t.junction_field}`
|
|
@@ -424,21 +437,21 @@ function gn({
|
|
|
424
437
|
enabled: !!i && i !== "new",
|
|
425
438
|
staleTime: 3e4
|
|
426
439
|
}))
|
|
427
|
-
}),
|
|
428
|
-
|
|
440
|
+
}), Ke = Object.fromEntries(
|
|
441
|
+
_e.map(({ rule: t, rel: r }, x) => {
|
|
429
442
|
var $;
|
|
430
|
-
const N = r.one_field ?? `${r.many_collection}.${r.junction_field}`,
|
|
443
|
+
const N = r.one_field ?? `${r.many_collection}.${r.junction_field}`, j = (b == null ? void 0 : b.getStagedUnlinks(N)) ?? /* @__PURE__ */ new Set();
|
|
431
444
|
return [
|
|
432
445
|
t.parent_field,
|
|
433
|
-
((($ =
|
|
446
|
+
((($ = Oe[x]) == null ? void 0 : $.data) ?? []).filter((C) => !j.has(C.id)).map((C) => C[r.junction_field])
|
|
434
447
|
];
|
|
435
448
|
})
|
|
436
|
-
),
|
|
437
|
-
if (!
|
|
449
|
+
), G = ht()[e.field] ?? [];
|
|
450
|
+
if (!U && (!_ || !e.layout_assigned && (e.hidden || Ct.has(e.field))))
|
|
438
451
|
return null;
|
|
439
|
-
const
|
|
452
|
+
const se = o[e.field] ?? null, Q = qt(e, Pe), R = Q.label ?? me(e.field);
|
|
440
453
|
be.current = R !== "";
|
|
441
|
-
const q =
|
|
454
|
+
const q = At(e), Ne = q ? null : jt(e), Be = !q && !m && !e.readonly && ((Re = e._overrides) == null ? void 0 : Re.repeat_last) === !0, Ue = $t(e, o), He = (Se = ($e = Ft(e.options)) == null ? void 0 : $e.auto_id) == null ? void 0 : Se.pattern, w = (() => {
|
|
442
455
|
const t = p.find(
|
|
443
456
|
(x) => x.one_collection === c && x.one_field === e.field
|
|
444
457
|
);
|
|
@@ -448,17 +461,17 @@ function gn({
|
|
|
448
461
|
(x) => x.many_collection === t.many_collection && x.id !== t.id
|
|
449
462
|
);
|
|
450
463
|
return r ? { ...t, junction_field: r.many_field } : null;
|
|
451
|
-
})(),
|
|
464
|
+
})(), de = w ? null : p.find((t) => t.many_collection === c && t.many_field === e.field) ?? null, ce = w ? p.find(
|
|
452
465
|
(t) => t.many_collection === w.many_collection && t.many_field === w.junction_field && t.id !== w.id
|
|
453
|
-
) ?? null : null,
|
|
466
|
+
) ?? null : null, M = w ? w.one_field ?? `${w.many_collection}.${w.junction_field}` : null, Ce = M ? (b == null ? void 0 : b.getStagedLinks(M)) ?? [] : [], We = w ? (xe.getQueryData([
|
|
454
467
|
"m2m-items",
|
|
455
468
|
w.many_collection,
|
|
456
469
|
w.many_field,
|
|
457
470
|
i
|
|
458
|
-
]) ?? []).map((t) => t[w.junction_field]) : [],
|
|
471
|
+
]) ?? []).map((t) => t[w.junction_field]) : [], Ve = w ? Ce[0] ?? We[0] ?? null : se, ze = (ce == null ? void 0 : ce.one_collection) ?? (de == null ? void 0 : de.one_collection) ?? void 0, Y = (t) => {
|
|
459
472
|
var r;
|
|
460
|
-
return ((F == null ? void 0 : F.collection) === c ? (r = F == null ? void 0 : F.fieldLabels) == null ? void 0 : r[t] : void 0) ??
|
|
461
|
-
},
|
|
473
|
+
return ((F == null ? void 0 : F.collection) === c ? (r = F == null ? void 0 : F.fieldLabels) == null ? void 0 : r[t] : void 0) ?? me(String(t));
|
|
474
|
+
}, A = Lt({
|
|
462
475
|
rules: T,
|
|
463
476
|
// A parent whose value THIS field's own pick derived must not narrow this
|
|
464
477
|
// field's options — otherwise picking a region locks the region picker
|
|
@@ -480,17 +493,17 @@ function gn({
|
|
|
480
493
|
if (g != null && g.many_field) x = { ...r, junction_field: g.many_field };
|
|
481
494
|
else return null;
|
|
482
495
|
}
|
|
483
|
-
const N = x.one_field ?? `${x.many_collection}.${x.junction_field}`,
|
|
496
|
+
const N = x.one_field ?? `${x.many_collection}.${x.junction_field}`, j = (b == null ? void 0 : b.getStagedLinks(N)) ?? [], $ = Ke[t] ?? [], C = [...new Set([...j, ...$].map((g) => String(g)))];
|
|
484
497
|
return C.length === 0 ? null : C.length === 1 ? C[0] : C;
|
|
485
498
|
},
|
|
486
499
|
parentOptionFilter: (t) => {
|
|
487
500
|
var x;
|
|
488
501
|
const r = (F == null ? void 0 : F.collection) === c ? (x = F.fieldOptionFilters) == null ? void 0 : x[t] : void 0;
|
|
489
|
-
return r ?
|
|
502
|
+
return r ? Kt(r, o, i) : void 0;
|
|
490
503
|
}
|
|
491
|
-
}),
|
|
492
|
-
function
|
|
493
|
-
for (const t of
|
|
504
|
+
}), O = A.filter, J = A.satisfiedParents.map(Y), Fe = A.satisfiedParents, Ge = A.unsatisfiedParents.length ? Y(A.unsatisfiedParents[0]) : null, ue = A.missingRequiredParents, Le = ue.length ? Y(ue[0]) : null;
|
|
505
|
+
function Qe() {
|
|
506
|
+
for (const t of Fe) {
|
|
494
507
|
const r = document.querySelector(`[data-field="${t}"]`);
|
|
495
508
|
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(() => {
|
|
496
509
|
r.style.boxShadow = "none", setTimeout(() => {
|
|
@@ -499,16 +512,16 @@ function gn({
|
|
|
499
512
|
}, 900));
|
|
500
513
|
}
|
|
501
514
|
}
|
|
502
|
-
const
|
|
503
|
-
if (w &&
|
|
504
|
-
for (const r of
|
|
515
|
+
const Ye = () => {
|
|
516
|
+
if (w && M) {
|
|
517
|
+
for (const r of Ce) b == null || b.unstageLink(M, r);
|
|
505
518
|
const t = xe.getQueryData([
|
|
506
519
|
"m2m-items",
|
|
507
520
|
w.many_collection,
|
|
508
521
|
w.many_field,
|
|
509
522
|
i
|
|
510
523
|
]) ?? [];
|
|
511
|
-
for (const r of t) b == null || b.stageUnlink(
|
|
524
|
+
for (const r of t) b == null || b.stageUnlink(M, r.id);
|
|
512
525
|
} else
|
|
513
526
|
f(e.field, null);
|
|
514
527
|
};
|
|
@@ -517,43 +530,43 @@ function gn({
|
|
|
517
530
|
/* @__PURE__ */ d(
|
|
518
531
|
"div",
|
|
519
532
|
{
|
|
520
|
-
ref:
|
|
533
|
+
ref: ie,
|
|
521
534
|
"data-field": e.field,
|
|
522
535
|
"data-field-collection": c,
|
|
523
536
|
"data-field-interface": e.interface ?? void 0,
|
|
524
|
-
"data-autofill-check":
|
|
537
|
+
"data-autofill-check": oe ? "" : void 0,
|
|
525
538
|
className: P(
|
|
526
539
|
"group/fieldrow space-y-1.5",
|
|
527
|
-
|
|
540
|
+
oe && "rounded-md bg-amber-50/60 p-1.5 ring-1 ring-amber-300 dark:bg-amber-500/10 dark:ring-amber-500/40"
|
|
528
541
|
),
|
|
529
|
-
onContextMenu:
|
|
530
|
-
onKeyDown:
|
|
542
|
+
onContextMenu: Ae,
|
|
543
|
+
onKeyDown: je,
|
|
531
544
|
onFocusCapture: S.onFocusCapture,
|
|
532
545
|
children: [
|
|
533
|
-
|
|
546
|
+
Ee,
|
|
534
547
|
T.length > 0 && /* @__PURE__ */ n(
|
|
535
|
-
|
|
548
|
+
Rt,
|
|
536
549
|
{
|
|
537
550
|
cascadeRules: T,
|
|
538
|
-
cascadeFilter:
|
|
539
|
-
currentValue:
|
|
540
|
-
relatedCollection:
|
|
541
|
-
missingRequiredParents:
|
|
542
|
-
onClear:
|
|
551
|
+
cascadeFilter: O,
|
|
552
|
+
currentValue: Ve,
|
|
553
|
+
relatedCollection: ze,
|
|
554
|
+
missingRequiredParents: ue,
|
|
555
|
+
onClear: Ye
|
|
543
556
|
}
|
|
544
557
|
),
|
|
545
|
-
(R !== "" ||
|
|
546
|
-
R !== "" && /* @__PURE__ */ d(
|
|
547
|
-
/* @__PURE__ */ n(
|
|
558
|
+
(R !== "" || G.length > 0) && /* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-1.5 min-h-[1.5rem]", children: [
|
|
559
|
+
R !== "" && /* @__PURE__ */ d(pt, { id: V, "data-field-label": !0, className: "text-sm font-medium", children: [
|
|
560
|
+
/* @__PURE__ */ n(Te, { text: R, collection: c }),
|
|
548
561
|
e.required && /* @__PURE__ */ n("span", { className: "ml-0.5 text-destructive", children: "*" }),
|
|
549
|
-
|
|
562
|
+
Et(e) && /* @__PURE__ */ n(Pt, {})
|
|
550
563
|
] }),
|
|
551
|
-
|
|
552
|
-
/* @__PURE__ */ n(
|
|
553
|
-
/* @__PURE__ */ n(
|
|
564
|
+
Q.note && /* @__PURE__ */ n(X, { delayDuration: 100, children: /* @__PURE__ */ d(Z, { children: [
|
|
565
|
+
/* @__PURE__ */ n(I, { asChild: !0, children: /* @__PURE__ */ n(Ze, { className: "h-3.5 w-3.5 shrink-0 cursor-help text-slate-400 hover:text-slate-600" }) }),
|
|
566
|
+
/* @__PURE__ */ n(ee, { side: "top", className: "max-w-[240px] text-[12px]", children: (s == null ? void 0 : s.glossaryHelp) === !1 ? Q.note : /* @__PURE__ */ n(Te, { text: Q.note, collection: c }) })
|
|
554
567
|
] }) }),
|
|
555
568
|
!q && i && i !== "new" && /* @__PURE__ */ n(
|
|
556
|
-
|
|
569
|
+
Yt,
|
|
557
570
|
{
|
|
558
571
|
collection: c,
|
|
559
572
|
itemId: i,
|
|
@@ -561,34 +574,34 @@ function gn({
|
|
|
561
574
|
onRestore: e.readonly ? void 0 : (t) => f(e.field, t)
|
|
562
575
|
}
|
|
563
576
|
),
|
|
564
|
-
!q && i && i !== "new" && /* @__PURE__ */ n(
|
|
565
|
-
i && i !== "new" &&
|
|
566
|
-
|
|
567
|
-
|
|
577
|
+
!q && i && i !== "new" && /* @__PURE__ */ n(Jt, { collection: c, itemId: i, field: e.field }),
|
|
578
|
+
i && i !== "new" && Ue && /* @__PURE__ */ n(Qt, { collection: c, itemId: i, field: e.field }),
|
|
579
|
+
Be && /* @__PURE__ */ n(
|
|
580
|
+
Dt,
|
|
568
581
|
{
|
|
569
582
|
collection: c,
|
|
570
583
|
itemId: i,
|
|
571
584
|
field: e.field,
|
|
572
|
-
label: R ||
|
|
585
|
+
label: R || me(e.field),
|
|
573
586
|
onFill: (t) => f(e.field, t)
|
|
574
587
|
}
|
|
575
588
|
),
|
|
576
|
-
!q &&
|
|
589
|
+
!q && z.show && !(z.perField && (m || e.readonly)) && /* @__PURE__ */ d(
|
|
577
590
|
"button",
|
|
578
591
|
{
|
|
579
592
|
type: "button",
|
|
580
|
-
onClick:
|
|
593
|
+
onClick: De,
|
|
581
594
|
disabled: fe,
|
|
582
|
-
"data-ai-fill":
|
|
595
|
+
"data-ai-fill": z.perField ? e.field : void 0,
|
|
583
596
|
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",
|
|
584
597
|
title: "Generate with AI",
|
|
585
598
|
children: [
|
|
586
|
-
fe ? /* @__PURE__ */ n(
|
|
599
|
+
fe ? /* @__PURE__ */ n(Ie, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ n(et, { className: "h-3 w-3" }),
|
|
587
600
|
"AI"
|
|
588
601
|
]
|
|
589
602
|
}
|
|
590
603
|
),
|
|
591
|
-
|
|
604
|
+
oe && /* @__PURE__ */ n(
|
|
592
605
|
"span",
|
|
593
606
|
{
|
|
594
607
|
"data-tip": "People often change what the AI read from the document here — check it",
|
|
@@ -612,18 +625,18 @@ function gn({
|
|
|
612
625
|
]
|
|
613
626
|
}
|
|
614
627
|
),
|
|
615
|
-
|
|
616
|
-
/* @__PURE__ */ n(
|
|
628
|
+
G.length > 0 && /* @__PURE__ */ n(X, { delayDuration: 100, children: /* @__PURE__ */ d(Z, { children: [
|
|
629
|
+
/* @__PURE__ */ n(I, { asChild: !0, children: /* @__PURE__ */ d("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: [
|
|
617
630
|
/* @__PURE__ */ n("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 shrink-0" }),
|
|
618
631
|
"addendum"
|
|
619
632
|
] }) }),
|
|
620
|
-
/* @__PURE__ */ d(
|
|
633
|
+
/* @__PURE__ */ d(ee, { side: "top", className: "max-w-[220px] text-[12px]", children: [
|
|
621
634
|
/* @__PURE__ */ d("p", { className: "font-medium mb-1", children: [
|
|
622
635
|
"In active addendum",
|
|
623
|
-
|
|
636
|
+
G.length > 1 ? "s" : "",
|
|
624
637
|
":"
|
|
625
638
|
] }),
|
|
626
|
-
|
|
639
|
+
G.map((t) => /* @__PURE__ */ d("p", { className: "text-slate-400", children: [
|
|
627
640
|
t.title,
|
|
628
641
|
" ",
|
|
629
642
|
/* @__PURE__ */ d("span", { className: "capitalize", children: [
|
|
@@ -635,7 +648,7 @@ function gn({
|
|
|
635
648
|
] })
|
|
636
649
|
] }) }),
|
|
637
650
|
/* @__PURE__ */ n(
|
|
638
|
-
|
|
651
|
+
_t,
|
|
639
652
|
{
|
|
640
653
|
collection: c,
|
|
641
654
|
kind: "field",
|
|
@@ -643,34 +656,34 @@ function gn({
|
|
|
643
656
|
label: R
|
|
644
657
|
}
|
|
645
658
|
),
|
|
646
|
-
(m || e.readonly) &&
|
|
647
|
-
/* @__PURE__ */ n(
|
|
648
|
-
/* @__PURE__ */ n(
|
|
659
|
+
(m || e.readonly) && D ? /* @__PURE__ */ n(gt, { reason: D, onHover: s == null ? void 0 : s.onLockHover }) : m ? /* @__PURE__ */ n(X, { delayDuration: 200, children: /* @__PURE__ */ d(Z, { children: [
|
|
660
|
+
/* @__PURE__ */ n(I, { asChild: !0, children: /* @__PURE__ */ n("span", { className: "inline-flex items-center text-amber-400 dark:text-amber-500", children: /* @__PURE__ */ n(tt, { className: "h-3 w-3" }) }) }),
|
|
661
|
+
/* @__PURE__ */ n(ee, { side: "top", className: "text-[12px]", children: "This field is locked" })
|
|
649
662
|
] }) }) : null,
|
|
650
663
|
T.length > 0 && (() => {
|
|
651
|
-
const t = !!
|
|
652
|
-
(x) =>
|
|
664
|
+
const t = !!O && Object.keys(O).length > 0 && J.length > 0, r = T.map(
|
|
665
|
+
(x) => Y(String(x.parent_field))
|
|
653
666
|
);
|
|
654
|
-
return /* @__PURE__ */ n(
|
|
655
|
-
/* @__PURE__ */ n(
|
|
667
|
+
return /* @__PURE__ */ n(X, { delayDuration: 100, children: /* @__PURE__ */ d(Z, { children: [
|
|
668
|
+
/* @__PURE__ */ n(I, { asChild: !0, children: /* @__PURE__ */ n(
|
|
656
669
|
"button",
|
|
657
670
|
{
|
|
658
671
|
type: "button",
|
|
659
672
|
"aria-label": `Show the fields that narrow ${R || "this list"}`,
|
|
660
|
-
onClick:
|
|
673
|
+
onClick: Qe,
|
|
661
674
|
className: P(
|
|
662
675
|
"inline-flex items-center transition-colors",
|
|
663
676
|
t ? "text-nvr-cyan hover:text-nvr-cyan" : "text-slate-300 hover:text-nvr-cyan dark:text-slate-600 dark:hover:text-nvr-cyan"
|
|
664
677
|
),
|
|
665
|
-
children: /* @__PURE__ */ n(
|
|
678
|
+
children: /* @__PURE__ */ n(nt, { className: "h-3 w-3" })
|
|
666
679
|
}
|
|
667
680
|
) }),
|
|
668
|
-
/* @__PURE__ */ n(
|
|
681
|
+
/* @__PURE__ */ n(ee, { side: "top", className: "text-[12px]", children: t ? `Filtered by ${J.join(", ")} — click to highlight` : `Options filter by ${r.join(", ")} once set` })
|
|
669
682
|
] }) });
|
|
670
683
|
})()
|
|
671
684
|
] }),
|
|
672
685
|
S.editor && !m && /* @__PURE__ */ n(
|
|
673
|
-
|
|
686
|
+
vt,
|
|
674
687
|
{
|
|
675
688
|
editor: S.editor,
|
|
676
689
|
confirming: S.confirming,
|
|
@@ -682,26 +695,27 @@ function gn({
|
|
|
682
695
|
"div",
|
|
683
696
|
{
|
|
684
697
|
ref: ye,
|
|
685
|
-
className: P(m && !
|
|
686
|
-
"data-tip": (m || e.readonly) &&
|
|
687
|
-
onPointerEnter: (m || e.readonly) &&
|
|
698
|
+
className: P(m && !H && "cursor-not-allowed"),
|
|
699
|
+
"data-tip": (m || e.readonly) && D ? D : void 0,
|
|
700
|
+
onPointerEnter: (m || e.readonly) && D ? s == null ? void 0 : s.onLockHover : void 0,
|
|
688
701
|
children: /* @__PURE__ */ n(
|
|
689
702
|
"div",
|
|
690
703
|
{
|
|
704
|
+
ref: ve,
|
|
691
705
|
className: P(
|
|
692
706
|
// A locked FILE field stays interactive: its chips keep the
|
|
693
707
|
// download link and preview click (the component itself hides
|
|
694
708
|
// upload/replace/remove when readonly) — blocking pointer events
|
|
695
709
|
// made attachments unopenable on every locked form (addendum
|
|
696
710
|
// view, terminal states).
|
|
697
|
-
m && !
|
|
711
|
+
m && !H && "pointer-events-none opacity-60",
|
|
698
712
|
// The ring lands with a 2px shake so the eye finds the field;
|
|
699
713
|
// the animation runs once when the class is added.
|
|
700
714
|
u && "nvr-shake ring-1 ring-red-400 rounded-md",
|
|
701
|
-
|
|
715
|
+
ae && "nvr-autofill-glow"
|
|
702
716
|
),
|
|
703
|
-
children: q ? /* @__PURE__ */ n(
|
|
704
|
-
|
|
717
|
+
children: q ? /* @__PURE__ */ n(Mt, { field: e, values: o }) : He ? /* @__PURE__ */ n(
|
|
718
|
+
xt,
|
|
705
719
|
{
|
|
706
720
|
collection: c,
|
|
707
721
|
field: e,
|
|
@@ -710,44 +724,44 @@ function gn({
|
|
|
710
724
|
}
|
|
711
725
|
) : l ? l({
|
|
712
726
|
field: e,
|
|
713
|
-
value:
|
|
714
|
-
onChange:
|
|
727
|
+
value: se,
|
|
728
|
+
onChange: we,
|
|
715
729
|
disabled: m,
|
|
716
730
|
collection: c,
|
|
717
731
|
itemId: i,
|
|
718
732
|
relations: p,
|
|
719
|
-
cascadeFilter:
|
|
720
|
-
unsatisfiedParentLabel:
|
|
721
|
-
requiredParentLabel:
|
|
733
|
+
cascadeFilter: O,
|
|
734
|
+
unsatisfiedParentLabel: Ge,
|
|
735
|
+
requiredParentLabel: Le
|
|
722
736
|
}) : /* @__PURE__ */ n(
|
|
723
|
-
|
|
737
|
+
kt,
|
|
724
738
|
{
|
|
725
|
-
field: m &&
|
|
726
|
-
value:
|
|
727
|
-
onChange:
|
|
739
|
+
field: m && H ? { ...e, readonly: !0 } : e,
|
|
740
|
+
value: se,
|
|
741
|
+
onChange: we,
|
|
728
742
|
relations: p,
|
|
729
743
|
collection: c,
|
|
730
744
|
itemId: i,
|
|
731
|
-
cascadeFilter:
|
|
732
|
-
requiredParentLabel:
|
|
733
|
-
narrowedBy:
|
|
734
|
-
labels:
|
|
735
|
-
keys:
|
|
745
|
+
cascadeFilter: O,
|
|
746
|
+
requiredParentLabel: Le,
|
|
747
|
+
narrowedBy: J.length > 0 ? {
|
|
748
|
+
labels: J,
|
|
749
|
+
keys: Fe,
|
|
736
750
|
onClear: (t) => f(t, null)
|
|
737
751
|
} : void 0,
|
|
738
752
|
onCountChange: y ? (t) => y(e.field, t) : void 0
|
|
739
753
|
}
|
|
740
754
|
)
|
|
741
755
|
},
|
|
742
|
-
|
|
756
|
+
ae ?? 0
|
|
743
757
|
)
|
|
744
758
|
}
|
|
745
759
|
),
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
760
|
+
Ne && /* @__PURE__ */ n(Ot, { value: o[e.field], config: Ne }),
|
|
761
|
+
ke && /* @__PURE__ */ n(
|
|
762
|
+
wt,
|
|
749
763
|
{
|
|
750
|
-
change:
|
|
764
|
+
change: ke,
|
|
751
765
|
onDismiss: () => s == null ? void 0 : s.dismissRemoteChange(e.field),
|
|
752
766
|
onTakeTheirs: s != null && s.takeRemoteChange ? () => {
|
|
753
767
|
var t;
|
|
@@ -761,7 +775,7 @@ function gn({
|
|
|
761
775
|
);
|
|
762
776
|
}
|
|
763
777
|
export {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
778
|
+
kn as FieldRow,
|
|
779
|
+
wn as lineageSummary,
|
|
780
|
+
Gt as useFieldLineage
|
|
767
781
|
};
|