@nivaro/react 0.3.94 → 0.3.96
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/shared/components/NotificationBell.js +1 -1
- package/dist/shared/components/chat/ChatMessageToast.js +248 -0
- package/dist/shared/components/chat/chat-core.js +415 -381
- package/dist/shared/components/item-edit/FieldAffordances.js +285 -278
- package/dist/shared/components/item-edit/FieldRow.js +53 -52
- package/dist/shared/components/item-edit/InlineTableField.js +1 -0
- package/dist/shared/components/item-edit/RuleProvenancePopover.js +61 -53
- package/dist/shared/components/item-edit/useRecordLabels.js +44 -0
- package/dist/shared/components/notifications/NotificationDetailBits.js +55 -55
- package/dist/shared/components/ops-report/SettingsPanel.js +44 -41
- package/dist/shared/components/ops-report/drill.js +263 -177
- package/dist/shared/components/panels/PipelinePanel.js +175 -178
- package/dist/shared/components/support/ReportProblem.js +10 -10
- package/dist/shared/components/support/SupportRequestDialog.js +11 -11
- package/dist/shared/components/support/TicketDetailSheet.js +114 -109
- package/dist/shared/components/support/support-context.js +14 -9
- package/package.json +1 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { jsxs as u, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
2
|
+
import { useQueryClient as et, useQueries as _t, useQuery as le, useMutation as Nt } from "@tanstack/react-query";
|
|
3
3
|
import { Info as Ft, Loader2 as Ct, Sparkles as Rt, Lock as Lt, SlidersHorizontal as St, History as $t, BellRing as qt, Bell as At, Sigma as Tt } from "lucide-react";
|
|
4
|
-
import { memo as Et, useState as ke, useRef as L, useId as Pt, useEffect as ae, useCallback as
|
|
4
|
+
import { memo as Et, useState as ke, useRef as L, useId as Pt, useEffect as ae, useCallback as Qe } from "react";
|
|
5
5
|
import { toast as oe } from "sonner";
|
|
6
6
|
import { useParentDraft as jt, useNivaroClient as ie } from "../../context.js";
|
|
7
7
|
import { showsAiButton as Bt, AUTOFILL_CHECK_KEY as Dt, readAiFill as Mt } from "../../lib/ai-fill.js";
|
|
8
8
|
import { get as H, del as Ot, post as ve } from "../../lib/commands.js";
|
|
9
9
|
import { toastError as Kt } from "../../lib/error-toast.js";
|
|
10
10
|
import { titleCase as U, cn as D, formatDateTime as we, toLocalDateString as Ut } from "../../lib/utils.js";
|
|
11
|
-
import { requiredByRules as
|
|
12
|
-
import { GlossaryLabel as
|
|
11
|
+
import { requiredByRules as Ye } from "../../lib/validation-rules.js";
|
|
12
|
+
import { GlossaryLabel as Je } from "../ai/GlossaryText.js";
|
|
13
13
|
import { useFieldSource as Ht, FieldSourceInfo as Wt } from "../ConfigReadBack.js";
|
|
14
14
|
import { Label as Vt } from "../ui/label.js";
|
|
15
15
|
import { TooltipProvider as ee, Tooltip as te, TooltipTrigger as ne, TooltipContent as re } from "../ui/tooltip.js";
|
|
16
16
|
import { useAddendumFields as zt } from "./AddendumFieldContext.js";
|
|
17
17
|
import { AutoIdPreviewField as Gt } from "./AutoIdPreviewField.js";
|
|
18
18
|
import { useCascadeClearNotifier as Qt } from "./cascade-clear-notice.js";
|
|
19
|
-
import { FOCUSABLE as
|
|
19
|
+
import { FOCUSABLE as Xe } from "./entry/entry-keys.js";
|
|
20
20
|
import { useFieldAffordances as Yt, useFieldContextMenu as Jt, usePresenceSoftLock as Xt, LockReasonBadge as Zt, PresenceSoftLockStrip as It, RemoteChangeGhost as en } from "./FieldAffordances.js";
|
|
21
21
|
import { FieldCommentButton as tn } from "./FieldComments.js";
|
|
22
22
|
import { FieldRenderer as nn } from "./FieldRenderer.js";
|
|
@@ -27,12 +27,12 @@ import { isDerivedForRecord as mn } from "./live-rollups.js";
|
|
|
27
27
|
import { useM2MStaging as pn } from "./M2MStagingContext.js";
|
|
28
28
|
import { personalDefaultSlotFor as hn, PersonalDefaultSlot as fn } from "./PersonalDefaultControl.js";
|
|
29
29
|
import { PersonalDefaultHint as xn } from "./PersonalDefaultPill.js";
|
|
30
|
-
import { isDisplayFormulaRow as
|
|
30
|
+
import { isDisplayFormulaRow as Ze, usePlacementTextContext as yn, placementFieldText as bn, fieldCounterConfig as gn, fieldIsRecommended as vn, RecommendedMarker as wn, RepeatLastButton as kn, DisplayFormulaValue as _n, FieldCounter as Nn } from "./placement-behaviour.js";
|
|
31
31
|
import { keepIfEqual as Fn, jsonEqual as Cn } from "./render-stability.js";
|
|
32
32
|
import { softRuleWarning as Rn } from "./soft-rules.js";
|
|
33
33
|
import { usePersonalDefaultsApi as Ln } from "./usePersonalDefaults.js";
|
|
34
34
|
import { resolveOptionFilterTokens as Sn } from "../../lib/option-filter-tokens.js";
|
|
35
|
-
const
|
|
35
|
+
const Ie = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger", "number"]), $n = /* @__PURE__ */ new Set(["string", "text", "richtext", "textarea", "markdown", "json", "csv"]), qn = /* @__PURE__ */ new Set([
|
|
36
36
|
"input",
|
|
37
37
|
"textarea",
|
|
38
38
|
"wysiwyg",
|
|
@@ -54,7 +54,7 @@ const Ze = /* @__PURE__ */ new Set(["integer", "float", "decimal", "bigInteger",
|
|
|
54
54
|
]), Tn = /* @__PURE__ */ new Set(["file", "file-image", "files-m2m", "files", "image"]);
|
|
55
55
|
function En(m) {
|
|
56
56
|
const e = m.interface ?? "";
|
|
57
|
-
return An.has(e) || e.startsWith("relation-") || e.endsWith("-m2o") || e.endsWith("-m2m") ||
|
|
57
|
+
return An.has(e) || e.startsWith("relation-") || e.endsWith("-m2o") || e.endsWith("-m2m") || Ie.has(m.type ?? "") ? !1 : !!($n.has(m.type ?? "") || qn.has(e) || !e && m.type && !Ie.has(m.type));
|
|
58
58
|
}
|
|
59
59
|
function Pn(m, e, i) {
|
|
60
60
|
return m.filter((h) => (i == null ? void 0 : i(h)) !== e);
|
|
@@ -296,7 +296,7 @@ function Mn({
|
|
|
296
296
|
itemId: e,
|
|
297
297
|
field: i
|
|
298
298
|
}) {
|
|
299
|
-
const h = ie(), x =
|
|
299
|
+
const h = ie(), x = et(), { data: s } = le({
|
|
300
300
|
queryKey: ["field-watch-config"],
|
|
301
301
|
queryFn: () => h.request(H("/field-watches/config")).then((o) => o.data).catch(() => ({ enabled: !1 })),
|
|
302
302
|
staleTime: 5 * 6e4
|
|
@@ -345,11 +345,11 @@ const wr = Et(function({
|
|
|
345
345
|
onCountChange: a,
|
|
346
346
|
swapButton: f,
|
|
347
347
|
swapContent: W,
|
|
348
|
-
forceVisible:
|
|
348
|
+
forceVisible: tt,
|
|
349
349
|
autoFillTick: se
|
|
350
350
|
}) {
|
|
351
|
-
var
|
|
352
|
-
const V = Tn.has(e.interface ?? ""), N = jt(), y = pn(), _e =
|
|
351
|
+
var He, We, Ve, ze;
|
|
352
|
+
const V = Tn.has(e.interface ?? ""), N = jt(), y = pn(), _e = et(), de = ie(), [Ne, z] = ke(!1), d = Yt(), ce = Qt(), Fe = Ht(e.field), G = L(null), P = Pt(), ue = L(null), Ce = L(!1), Re = L({
|
|
353
353
|
required: !1,
|
|
354
354
|
hasError: !1
|
|
355
355
|
});
|
|
@@ -371,19 +371,19 @@ const wr = Et(function({
|
|
|
371
371
|
const r = typeof document < "u" ? document.activeElement : null;
|
|
372
372
|
r instanceof HTMLElement && t.contains(r) && r.blur(), t.setAttribute("inert", "");
|
|
373
373
|
}, [Le, se]);
|
|
374
|
-
const Q = e.field, $e =
|
|
374
|
+
const Q = e.field, $e = Qe(
|
|
375
375
|
(t) => {
|
|
376
376
|
p || h(Q, t);
|
|
377
377
|
},
|
|
378
378
|
[p, h, Q]
|
|
379
|
-
),
|
|
379
|
+
), nt = Qe(
|
|
380
380
|
(t) => a == null ? void 0 : a(Q, t),
|
|
381
381
|
[a, Q]
|
|
382
|
-
),
|
|
383
|
-
onContextMenu:
|
|
384
|
-
onKeyDown:
|
|
385
|
-
menu:
|
|
386
|
-
confirmSaveFrom:
|
|
382
|
+
), rt = L(void 0), qe = L(void 0), Ae = L(void 0), Te = !p && !e.readonly && !e.computed_formula && !(e.hidden && !e.layout_assigned) && !Ze(e), {
|
|
383
|
+
onContextMenu: lt,
|
|
384
|
+
onKeyDown: at,
|
|
385
|
+
menu: ot,
|
|
386
|
+
confirmSaveFrom: it,
|
|
387
387
|
openedBy: me
|
|
388
388
|
} = Jt({
|
|
389
389
|
wrapperRef: G,
|
|
@@ -394,13 +394,13 @@ const wr = Et(function({
|
|
|
394
394
|
itemId: l,
|
|
395
395
|
openRelated: d == null ? void 0 : d.openRelated,
|
|
396
396
|
editable: Te
|
|
397
|
-
}), j = Xt(G),
|
|
397
|
+
}), j = Xt(G), st = yn(), Ee = d == null ? void 0 : d.remoteChanges[e.field], M = d == null ? void 0 : d.lockReasons[e.field], T = d == null ? void 0 : d.applyToLines[e.field], R = Ln(), dt = (R == null ? void 0 : R.applied(e.field)) ?? !1, Pe = (R == null ? void 0 : R.hintFor(e.field)) ?? null, pe = hn(R, e.field, Te), he = () => {
|
|
398
398
|
var t, r;
|
|
399
|
-
return ((t = ue.current) == null ? void 0 : t.querySelector(
|
|
399
|
+
return ((t = ue.current) == null ? void 0 : t.querySelector(Xe)) ?? ((r = G.current) == null ? void 0 : r.querySelector(Xe));
|
|
400
400
|
}, Y = Bt(e._overrides, o, En(e)), fe = !!(d != null && d.fromAutofill) && !!e._overrides && e._overrides[Dt] === !0;
|
|
401
|
-
async function
|
|
401
|
+
async function ct() {
|
|
402
402
|
var t;
|
|
403
|
-
if (Y.perField) return
|
|
403
|
+
if (Y.perField) return ut();
|
|
404
404
|
z(!0);
|
|
405
405
|
try {
|
|
406
406
|
const r = await de.request(
|
|
@@ -416,7 +416,7 @@ const wr = Et(function({
|
|
|
416
416
|
z(!1);
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
|
-
async function
|
|
419
|
+
async function ut() {
|
|
420
420
|
var r, c, k, S;
|
|
421
421
|
const t = {};
|
|
422
422
|
for (const _ of ((r = Mt(e._overrides)) == null ? void 0 : r.tokens) ?? []) _ in i && (t[_] = i[_]);
|
|
@@ -448,7 +448,7 @@ const wr = Et(function({
|
|
|
448
448
|
(k) => k.many_collection === r.many_collection && k.id !== r.id
|
|
449
449
|
);
|
|
450
450
|
return c != null && c.many_field ? [{ rule: t, rel: { ...r, junction_field: c.many_field } }] : [];
|
|
451
|
-
}),
|
|
451
|
+
}), mt = _t({
|
|
452
452
|
queries: je.map(({ rel: t }) => ({
|
|
453
453
|
queryKey: ["m2m-items", t.many_collection, t.many_field, l],
|
|
454
454
|
queryFn: () => de.request(
|
|
@@ -461,24 +461,24 @@ const wr = Et(function({
|
|
|
461
461
|
enabled: !!l && l !== "new",
|
|
462
462
|
staleTime: 3e4
|
|
463
463
|
}))
|
|
464
|
-
}),
|
|
464
|
+
}), pt = Object.fromEntries(
|
|
465
465
|
je.map(({ rule: t, rel: r }, c) => {
|
|
466
466
|
var _;
|
|
467
467
|
const k = r.one_field ?? `${r.many_collection}.${r.junction_field}`, S = (y == null ? void 0 : y.getStagedUnlinks(k)) ?? /* @__PURE__ */ new Set();
|
|
468
468
|
return [
|
|
469
469
|
t.parent_field,
|
|
470
|
-
(((_ =
|
|
470
|
+
(((_ = mt[c]) == null ? void 0 : _.data) ?? []).filter((F) => !S.has(F.id)).map((F) => F[r.junction_field])
|
|
471
471
|
];
|
|
472
472
|
})
|
|
473
473
|
), J = zt()[e.field] ?? [];
|
|
474
|
-
if (!
|
|
474
|
+
if (!tt && (!g || !e.layout_assigned && (e.hidden || sn.has(e.field))))
|
|
475
475
|
return null;
|
|
476
|
-
const xe = i[e.field] ?? null, X = bn(e,
|
|
476
|
+
const xe = i[e.field] ?? null, X = bn(e, st), C = X.label ?? U(e.field);
|
|
477
477
|
Ce.current = C !== "", Re.current = {
|
|
478
|
-
required: !!(e.required ||
|
|
478
|
+
required: !!(e.required || Ye(e.validation_rules, i)),
|
|
479
479
|
hasError: !!w
|
|
480
480
|
};
|
|
481
|
-
const q =
|
|
481
|
+
const q = Ze(e), Be = q ? null : gn(e), De = q || !(l === "new" || !l || (He = N == null ? void 0 : N.dirtyFields) != null && He.has(e.field)) ? null : Rn(e, i), ht = !q && !p && !e.readonly && ((We = e._overrides) == null ? void 0 : We.repeat_last) === !0, ft = mn(e, i), xt = (ze = (Ve = dn(e.options)) == null ? void 0 : Ve.auto_id) == null ? void 0 : ze.pattern, v = (() => {
|
|
482
482
|
const t = x.find(
|
|
483
483
|
(c) => c.one_collection === s && c.one_field === e.field
|
|
484
484
|
);
|
|
@@ -490,12 +490,12 @@ const wr = Et(function({
|
|
|
490
490
|
return r ? { ...t, junction_field: r.many_field } : null;
|
|
491
491
|
})(), ye = v ? null : x.find((t) => t.many_collection === s && t.many_field === e.field) ?? null, be = v ? x.find(
|
|
492
492
|
(t) => t.many_collection === v.many_collection && t.many_field === v.junction_field && t.id !== v.id
|
|
493
|
-
) ?? null : null, B = v ? v.one_field ?? `${v.many_collection}.${v.junction_field}` : null, Me = B ? (y == null ? void 0 : y.getStagedLinks(B)) ?? [] : [],
|
|
493
|
+
) ?? null : null, B = v ? v.one_field ?? `${v.many_collection}.${v.junction_field}` : null, Me = B ? (y == null ? void 0 : y.getStagedLinks(B)) ?? [] : [], yt = v ? (_e.getQueryData([
|
|
494
494
|
"m2m-items",
|
|
495
495
|
v.many_collection,
|
|
496
496
|
v.many_field,
|
|
497
497
|
l
|
|
498
|
-
]) ?? []).map((t) => t[v.junction_field]) : [], Oe = v ? Me[0] ??
|
|
498
|
+
]) ?? []).map((t) => t[v.junction_field]) : [], Oe = v ? Me[0] ?? yt[0] ?? null : xe, Ke = (be == null ? void 0 : be.one_collection) ?? (ye == null ? void 0 : ye.one_collection) ?? void 0, Z = (t) => {
|
|
499
499
|
var r;
|
|
500
500
|
return ((N == null ? void 0 : N.collection) === s ? (r = N == null ? void 0 : N.fieldLabels) == null ? void 0 : r[t] : void 0) ?? U(String(t));
|
|
501
501
|
}, A = cn({
|
|
@@ -515,12 +515,12 @@ const wr = Et(function({
|
|
|
515
515
|
let c = r;
|
|
516
516
|
if (!c.junction_field) {
|
|
517
517
|
const $ = x.find(
|
|
518
|
-
(
|
|
518
|
+
(Ge) => Ge.many_collection === r.many_collection && Ge.id !== r.id
|
|
519
519
|
);
|
|
520
520
|
if ($ != null && $.many_field) c = { ...r, junction_field: $.many_field };
|
|
521
521
|
else return null;
|
|
522
522
|
}
|
|
523
|
-
const k = c.one_field ?? `${c.many_collection}.${c.junction_field}`, S = (y == null ? void 0 : y.getStagedLinks(k)) ?? [], _ =
|
|
523
|
+
const k = c.one_field ?? `${c.many_collection}.${c.junction_field}`, S = (y == null ? void 0 : y.getStagedLinks(k)) ?? [], _ = pt[t] ?? [], F = [...new Set([...S, ..._].map(($) => String($)))];
|
|
524
524
|
return F.length === 0 ? null : F.length === 1 ? F[0] : F;
|
|
525
525
|
},
|
|
526
526
|
parentOptionFilter: (t) => {
|
|
@@ -528,7 +528,7 @@ const wr = Et(function({
|
|
|
528
528
|
const r = (N == null ? void 0 : N.collection) === s ? (c = N.fieldOptionFilters) == null ? void 0 : c[t] : void 0;
|
|
529
529
|
return r ? Sn(r, i, l) : void 0;
|
|
530
530
|
}
|
|
531
|
-
}), O = A.filter ? Fn(
|
|
531
|
+
}), O = A.filter ? Fn(rt, A.filter, Cn) : A.filter, K = A.satisfiedParents.map(Z), I = A.satisfiedParents, bt = A.unsatisfiedParents.length ? Z(A.unsatisfiedParents[0]) : null, ge = A.missingRequiredParents, Ue = ge.length ? Z(ge[0]) : null;
|
|
532
532
|
function gt() {
|
|
533
533
|
const t = Ae.current;
|
|
534
534
|
if (t && t.src === e) return t.value;
|
|
@@ -594,18 +594,18 @@ const wr = Et(function({
|
|
|
594
594
|
"group/fieldrow space-y-1.5",
|
|
595
595
|
fe && "rounded-md bg-amber-50/60 p-1.5 ring-1 ring-amber-300 dark:bg-amber-500/10 dark:ring-amber-500/40"
|
|
596
596
|
),
|
|
597
|
-
onContextMenu:
|
|
598
|
-
onKeyDown:
|
|
597
|
+
onContextMenu: lt,
|
|
598
|
+
onKeyDown: at,
|
|
599
599
|
onFocusCapture: j.onFocusCapture,
|
|
600
600
|
children: [
|
|
601
|
-
|
|
601
|
+
ot,
|
|
602
602
|
E.length > 0 && /* @__PURE__ */ n(
|
|
603
603
|
un,
|
|
604
604
|
{
|
|
605
605
|
cascadeRules: E,
|
|
606
606
|
cascadeFilter: O,
|
|
607
607
|
currentValue: Oe,
|
|
608
|
-
relatedCollection:
|
|
608
|
+
relatedCollection: Ke,
|
|
609
609
|
missingRequiredParents: ge,
|
|
610
610
|
onClear: kt
|
|
611
611
|
}
|
|
@@ -617,13 +617,13 @@ const wr = Et(function({
|
|
|
617
617
|
"data-pd-row": pe ? "" : void 0,
|
|
618
618
|
children: [
|
|
619
619
|
C !== "" && /* @__PURE__ */ u(Vt, { id: P, "data-field-label": !0, className: "text-sm font-medium", children: [
|
|
620
|
-
/* @__PURE__ */ n(
|
|
621
|
-
(e.required ||
|
|
620
|
+
/* @__PURE__ */ n(Je, { text: C, collection: s }),
|
|
621
|
+
(e.required || Ye(e.validation_rules, i)) && /* @__PURE__ */ n("span", { className: "ml-0.5 text-destructive", children: "*" }),
|
|
622
622
|
vn(e) && /* @__PURE__ */ n(wn, {})
|
|
623
623
|
] }),
|
|
624
624
|
X.note && /* @__PURE__ */ n(ee, { delayDuration: 100, children: /* @__PURE__ */ u(te, { children: [
|
|
625
625
|
/* @__PURE__ */ n(ne, { asChild: !0, children: /* @__PURE__ */ n(Ft, { className: "h-3.5 w-3.5 shrink-0 cursor-help text-slate-400 hover:text-slate-600" }) }),
|
|
626
|
-
/* @__PURE__ */ n(re, { side: "top", className: "max-w-[240px] text-[12px]", children: (d == null ? void 0 : d.glossaryHelp) === !1 ? X.note : /* @__PURE__ */ n(
|
|
626
|
+
/* @__PURE__ */ n(re, { side: "top", className: "max-w-[240px] text-[12px]", children: (d == null ? void 0 : d.glossaryHelp) === !1 ? X.note : /* @__PURE__ */ n(Je, { text: X.note, collection: s }) })
|
|
627
627
|
] }) }),
|
|
628
628
|
Fe && /* @__PURE__ */ n(Wt, { source: Fe, label: C }),
|
|
629
629
|
!q && l && l !== "new" && /* @__PURE__ */ n(
|
|
@@ -637,8 +637,8 @@ const wr = Et(function({
|
|
|
637
637
|
),
|
|
638
638
|
!q && l && l !== "new" && /* @__PURE__ */ n(Mn, { collection: s, itemId: l, field: e.field }),
|
|
639
639
|
!q && l && l !== "new" && /* @__PURE__ */ n(tn, { field: e.field, label: C || U(e.field) }),
|
|
640
|
-
l && l !== "new" &&
|
|
641
|
-
|
|
640
|
+
l && l !== "new" && ft && /* @__PURE__ */ n(Bn, { collection: s, itemId: l, field: e.field }),
|
|
641
|
+
ht && /* @__PURE__ */ n(
|
|
642
642
|
kn,
|
|
643
643
|
{
|
|
644
644
|
collection: s,
|
|
@@ -652,7 +652,7 @@ const wr = Et(function({
|
|
|
652
652
|
"button",
|
|
653
653
|
{
|
|
654
654
|
type: "button",
|
|
655
|
-
onClick:
|
|
655
|
+
onClick: ct,
|
|
656
656
|
disabled: Ne,
|
|
657
657
|
"data-ai-fill": Y.perField ? e.field : void 0,
|
|
658
658
|
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",
|
|
@@ -756,7 +756,7 @@ const wr = Et(function({
|
|
|
756
756
|
confirmOpen: me === "make" || me === "update" ? me : null,
|
|
757
757
|
onConfirm: (t, r) => (
|
|
758
758
|
// After a save the button becomes "Your default": focus goes to the field.
|
|
759
|
-
|
|
759
|
+
it(t, he, r)
|
|
760
760
|
),
|
|
761
761
|
onUndo: () => {
|
|
762
762
|
R == null || R.undo(e.field), requestAnimationFrame(() => {
|
|
@@ -808,7 +808,7 @@ const wr = Et(function({
|
|
|
808
808
|
w && "nvr-shake ring-1 ring-red-400 rounded-md",
|
|
809
809
|
se && "nvr-autofill-glow"
|
|
810
810
|
),
|
|
811
|
-
children: q ? /* @__PURE__ */ n(_n, { field: e, values: i }) :
|
|
811
|
+
children: q ? /* @__PURE__ */ n(_n, { field: e, values: i }) : xt ? /* @__PURE__ */ n(
|
|
812
812
|
Gt,
|
|
813
813
|
{
|
|
814
814
|
collection: s,
|
|
@@ -826,7 +826,7 @@ const wr = Et(function({
|
|
|
826
826
|
relations: x,
|
|
827
827
|
cascadeFilter: O,
|
|
828
828
|
unsatisfiedParentLabel: bt,
|
|
829
|
-
requiredParentLabel:
|
|
829
|
+
requiredParentLabel: Ue
|
|
830
830
|
}) : /* @__PURE__ */ n(
|
|
831
831
|
nn,
|
|
832
832
|
{
|
|
@@ -837,9 +837,9 @@ const wr = Et(function({
|
|
|
837
837
|
collection: s,
|
|
838
838
|
itemId: l,
|
|
839
839
|
cascadeFilter: O,
|
|
840
|
-
requiredParentLabel:
|
|
840
|
+
requiredParentLabel: Ue,
|
|
841
841
|
narrowedBy: K.length > 0 ? vt() : void 0,
|
|
842
|
-
onCountChange: a ?
|
|
842
|
+
onCountChange: a ? nt : void 0
|
|
843
843
|
}
|
|
844
844
|
)
|
|
845
845
|
},
|
|
@@ -870,11 +870,12 @@ const wr = Et(function({
|
|
|
870
870
|
children: De
|
|
871
871
|
}
|
|
872
872
|
),
|
|
873
|
-
Pe && !
|
|
873
|
+
Pe && !dt && /* @__PURE__ */ n(xn, { field: e.field, text: Pe }),
|
|
874
874
|
Ee && /* @__PURE__ */ n(
|
|
875
875
|
en,
|
|
876
876
|
{
|
|
877
877
|
change: Ee,
|
|
878
|
+
relatedCollection: Ke ?? null,
|
|
878
879
|
onDismiss: () => d == null ? void 0 : d.dismissRemoteChange(e.field),
|
|
879
880
|
onTakeTheirs: d != null && d.takeRemoteChange ? () => {
|
|
880
881
|
var t;
|
|
@@ -4275,6 +4275,7 @@ function zc({
|
|
|
4275
4275
|
provenance: (ie = f == null ? void 0 : f.provenance) == null ? void 0 : ie[t.field],
|
|
4276
4276
|
labelOf: E,
|
|
4277
4277
|
fieldLabel: X,
|
|
4278
|
+
relatedCollection: (T == null ? void 0 : T.one_collection) ?? null,
|
|
4278
4279
|
onReset: I === "overridden" && !L && !((V = f == null ? void 0 : f.locks) != null && V.includes(t.field)) ? () => ca(t.field) : void 0
|
|
4279
4280
|
}
|
|
4280
4281
|
);
|
|
@@ -1,116 +1,124 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Check as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { explainProvenance as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Popover as
|
|
7
|
-
|
|
1
|
+
import { jsx as t, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { Check as w, ChevronRight as N } from "lucide-react";
|
|
3
|
+
import { useState as h, useMemo as y } from "react";
|
|
4
|
+
import { explainProvenance as v } from "../../lib/rule-provenance.js";
|
|
5
|
+
import { cn as d } from "../../lib/utils.js";
|
|
6
|
+
import { Popover as C, PopoverTrigger as S, PopoverContent as P } from "../ui/popover.js";
|
|
7
|
+
import { useRecordLabels as T } from "./useRecordLabels.js";
|
|
8
|
+
function z({
|
|
8
9
|
kind: l,
|
|
9
|
-
provenance:
|
|
10
|
-
labelOf:
|
|
11
|
-
fieldLabel:
|
|
12
|
-
|
|
10
|
+
provenance: a,
|
|
11
|
+
labelOf: i,
|
|
12
|
+
fieldLabel: f,
|
|
13
|
+
relatedCollection: b,
|
|
14
|
+
onReset: c
|
|
13
15
|
}) {
|
|
14
|
-
const [
|
|
16
|
+
const [m, u] = h(!1), [n, p] = h(!1), g = y(
|
|
17
|
+
() => [a == null ? void 0 : a.value, ...((a == null ? void 0 : a.sources) ?? []).map((e) => e.value)],
|
|
18
|
+
[a]
|
|
19
|
+
), k = T(b, g, m), r = a ? v(a, { labelOf: (e) => {
|
|
20
|
+
const o = i == null ? void 0 : i(e);
|
|
21
|
+
return o != null && o !== String(e) ? o : k.get(String(e)) ?? o ?? String(e);
|
|
22
|
+
}, fieldLabel: f }) : null, x = /* @__PURE__ */ t(
|
|
15
23
|
"span",
|
|
16
24
|
{
|
|
17
|
-
className:
|
|
25
|
+
className: d(
|
|
18
26
|
"rounded px-1 py-px text-[9px] font-medium normal-case tracking-normal",
|
|
19
27
|
l === "auto" ? "bg-sky-50 text-sky-700 dark:bg-sky-400/10 dark:text-sky-300" : "bg-amber-50 text-amber-700 dark:bg-amber-400/10 dark:text-amber-300",
|
|
20
|
-
|
|
28
|
+
r && "cursor-pointer hover:underline decoration-dotted underline-offset-2"
|
|
21
29
|
),
|
|
22
|
-
"data-provenance-tip":
|
|
23
|
-
"data-tip":
|
|
30
|
+
"data-provenance-tip": r ? "full" : "basic",
|
|
31
|
+
"data-tip": r ? `${l === "auto" ? "Set by a rule" : "Differs from the rule"} — click to see how` : l === "auto" ? "Set automatically by a row rule" : "Differs from what the row rules would set",
|
|
24
32
|
children: l
|
|
25
33
|
}
|
|
26
34
|
);
|
|
27
|
-
return
|
|
28
|
-
|
|
35
|
+
return r ? /* @__PURE__ */ s(
|
|
36
|
+
C,
|
|
29
37
|
{
|
|
30
|
-
open:
|
|
31
|
-
onOpenChange: (
|
|
32
|
-
|
|
38
|
+
open: m,
|
|
39
|
+
onOpenChange: (e) => {
|
|
40
|
+
u(e), e || p(!1);
|
|
33
41
|
},
|
|
34
42
|
children: [
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
|
|
43
|
+
/* @__PURE__ */ t(S, { asChild: !0, children: /* @__PURE__ */ t("button", { type: "button", "data-provenance-chip-btn": !0, className: "inline-flex", children: x }) }),
|
|
44
|
+
/* @__PURE__ */ s(
|
|
45
|
+
P,
|
|
38
46
|
{
|
|
39
47
|
align: "start",
|
|
40
48
|
sideOffset: 6,
|
|
41
49
|
className: "w-[380px] max-w-[92vw] p-0 text-[12px]",
|
|
42
50
|
"data-provenance-popover": !0,
|
|
43
51
|
children: [
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ s("div", { className: "px-3.5 pt-3 pb-2.5", children: [
|
|
53
|
+
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold leading-snug text-slate-900 dark:text-slate-100", children: r.value }),
|
|
54
|
+
/* @__PURE__ */ t("p", { className: "mt-0.5 text-[11.5px] text-slate-500 dark:text-slate-400", children: r.rule })
|
|
47
55
|
] }),
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
|
|
56
|
+
/* @__PURE__ */ s("div", { className: "border-t border-slate-100 px-3.5 py-2.5 dark:border-border/60", children: [
|
|
57
|
+
/* @__PURE__ */ s("div", { className: "flex items-start gap-2", children: [
|
|
58
|
+
/* @__PURE__ */ t(
|
|
59
|
+
w,
|
|
52
60
|
{
|
|
53
|
-
className:
|
|
61
|
+
className: d(
|
|
54
62
|
"mt-0.5 h-3.5 w-3.5 shrink-0",
|
|
55
63
|
l === "auto" ? "text-emerald-600 dark:text-emerald-400" : "text-slate-400"
|
|
56
64
|
),
|
|
57
65
|
"aria-hidden": !0
|
|
58
66
|
}
|
|
59
67
|
),
|
|
60
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ t("p", { className: "leading-snug text-slate-800 dark:text-slate-200", "data-provenance-winner": !0, children: r.winner })
|
|
61
69
|
] }),
|
|
62
|
-
|
|
63
|
-
/* @__PURE__ */
|
|
70
|
+
r.tried.length > 0 && /* @__PURE__ */ s("div", { className: "mt-2 pl-[22px]", children: [
|
|
71
|
+
/* @__PURE__ */ s(
|
|
64
72
|
"button",
|
|
65
73
|
{
|
|
66
74
|
type: "button",
|
|
67
|
-
onClick: () =>
|
|
68
|
-
"aria-expanded":
|
|
75
|
+
onClick: () => p((e) => !e),
|
|
76
|
+
"aria-expanded": n,
|
|
69
77
|
className: "inline-flex items-center gap-1 text-[11.5px] text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-200",
|
|
70
78
|
children: [
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
|
|
79
|
+
/* @__PURE__ */ t(
|
|
80
|
+
N,
|
|
73
81
|
{
|
|
74
|
-
className:
|
|
82
|
+
className: d(
|
|
75
83
|
"h-3 w-3 transition-transform duration-150",
|
|
76
|
-
|
|
84
|
+
n && "rotate-90"
|
|
77
85
|
),
|
|
78
86
|
"aria-hidden": !0
|
|
79
87
|
}
|
|
80
88
|
),
|
|
81
89
|
"Checked first, no answer (",
|
|
82
|
-
|
|
90
|
+
r.tried.length,
|
|
83
91
|
")"
|
|
84
92
|
]
|
|
85
93
|
}
|
|
86
94
|
),
|
|
87
|
-
|
|
95
|
+
n && /* @__PURE__ */ t(
|
|
88
96
|
"ol",
|
|
89
97
|
{
|
|
90
98
|
className: "mt-1.5 space-y-1 text-[11.5px] leading-snug text-slate-500 dark:text-slate-400",
|
|
91
99
|
"data-provenance-tried": !0,
|
|
92
|
-
children:
|
|
93
|
-
/* @__PURE__ */
|
|
100
|
+
children: r.tried.map((e, o) => /* @__PURE__ */ s("li", { className: "flex gap-2", children: [
|
|
101
|
+
/* @__PURE__ */ t(
|
|
94
102
|
"span",
|
|
95
103
|
{
|
|
96
104
|
className: "mt-[7px] h-1 w-1 shrink-0 rounded-full bg-slate-300 dark:bg-slate-600",
|
|
97
105
|
"aria-hidden": !0
|
|
98
106
|
}
|
|
99
107
|
),
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
] }, `${
|
|
108
|
+
/* @__PURE__ */ t("span", { children: e })
|
|
109
|
+
] }, `${o}-${e}`))
|
|
102
110
|
}
|
|
103
111
|
)
|
|
104
112
|
] })
|
|
105
113
|
] }),
|
|
106
|
-
l === "overridden" &&
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */
|
|
114
|
+
l === "overridden" && c && /* @__PURE__ */ s("div", { className: "border-t border-slate-100 px-3.5 py-2 dark:border-border/60", children: [
|
|
115
|
+
/* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: "This row holds a different value than the rule would set." }),
|
|
116
|
+
/* @__PURE__ */ t(
|
|
109
117
|
"button",
|
|
110
118
|
{
|
|
111
119
|
type: "button",
|
|
112
120
|
onClick: () => {
|
|
113
|
-
|
|
121
|
+
u(!1), c();
|
|
114
122
|
},
|
|
115
123
|
className: "mt-1.5 text-[11.5px] font-medium text-nvr-cyan hover:underline",
|
|
116
124
|
children: "Put the rule's value back"
|
|
@@ -122,8 +130,8 @@ function $({
|
|
|
122
130
|
)
|
|
123
131
|
]
|
|
124
132
|
}
|
|
125
|
-
) :
|
|
133
|
+
) : x;
|
|
126
134
|
}
|
|
127
135
|
export {
|
|
128
|
-
|
|
136
|
+
z as RuleProvenanceChip
|
|
129
137
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useQueryClient as S, useQueries as b } from "@tanstack/react-query";
|
|
2
|
+
import { useMemo as p } from "react";
|
|
3
|
+
import { useNivaroClient as h } from "../../context.js";
|
|
4
|
+
import { get as c } from "../../lib/commands.js";
|
|
5
|
+
import { USER_SYSTEM_COLS as w, userDisplayLabel as $, renderDisplayTemplate as C } from "../pipeline/relations.js";
|
|
6
|
+
function N(n, i, y = !0) {
|
|
7
|
+
const m = h(), d = S(), a = p(
|
|
8
|
+
() => [
|
|
9
|
+
...new Set(
|
|
10
|
+
i.filter((e) => e != null && e !== "" && typeof e != "object").map(String).filter((e) => /^\d+$/.test(e) || /^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(e))
|
|
11
|
+
)
|
|
12
|
+
].slice(0, 20),
|
|
13
|
+
[i]
|
|
14
|
+
), q = b({
|
|
15
|
+
queries: a.map((e) => ({
|
|
16
|
+
queryKey: ["record-label", n, e],
|
|
17
|
+
enabled: y && !!n,
|
|
18
|
+
staleTime: 10 * 6e4,
|
|
19
|
+
retry: !1,
|
|
20
|
+
queryFn: async () => {
|
|
21
|
+
const t = n, s = w.has(t), r = await m.request(
|
|
22
|
+
s ? c(`/users/${e}`) : c(`/items/${t}/${encodeURIComponent(e)}`)
|
|
23
|
+
).then((u) => u.data).catch(() => null);
|
|
24
|
+
if (!r) return null;
|
|
25
|
+
if (s) return $(r);
|
|
26
|
+
const l = await d.fetchQuery({
|
|
27
|
+
queryKey: ["record-label-meta", t],
|
|
28
|
+
staleTime: 10 * 6e4,
|
|
29
|
+
queryFn: () => m.request(c(`/collections/${t}`)).then((u) => u.data).catch(() => null)
|
|
30
|
+
}), o = C((l == null ? void 0 : l.display_template) ?? null, r);
|
|
31
|
+
return o && o !== e ? o : r.name ?? null;
|
|
32
|
+
}
|
|
33
|
+
}))
|
|
34
|
+
}), f = JSON.stringify(q.map((e) => e.data ?? null));
|
|
35
|
+
return p(() => {
|
|
36
|
+
const e = JSON.parse(f), t = /* @__PURE__ */ new Map();
|
|
37
|
+
return a.forEach((s, r) => {
|
|
38
|
+
e[r] && t.set(s, e[r]);
|
|
39
|
+
}), t;
|
|
40
|
+
}, [a, f]);
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
N as useRecordLabels
|
|
44
|
+
};
|