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