@nivaro/react 0.3.49 → 0.3.51
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/InlineGridField.js +166 -105
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +38 -4
- package/dist/shared/components/ItemEditForm.js +5258 -5034
- package/dist/shared/components/QueryTable.js +489 -347
- package/dist/shared/components/ReportView.js +105 -99
- package/dist/shared/components/alerts/AlertManagerView.js +327 -301
- package/dist/shared/components/item-edit/CatalogPickerField.js +1230 -1175
- package/dist/shared/components/item-edit/CloneDialog.js +192 -142
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
- package/dist/shared/components/item-edit/FieldRenderer.js +249 -244
- package/dist/shared/components/item-edit/FieldRow.js +402 -370
- package/dist/shared/components/item-edit/FilePickerField.js +315 -307
- package/dist/shared/components/item-edit/InlineGridField.js +92 -90
- package/dist/shared/components/item-edit/InlineTableField.js +3119 -2951
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
- package/dist/shared/components/item-edit/PlanGrid.js +162 -162
- package/dist/shared/components/item-edit/PolishFields.js +169 -162
- package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
- package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
- package/dist/shared/components/item-edit/RelationCombobox.js +198 -191
- package/dist/shared/components/item-edit/SummaryPanel.js +282 -259
- package/dist/shared/components/item-edit/UserChip.js +233 -200
- package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
- package/dist/shared/components/item-edit/header-midair.js +51 -0
- package/dist/shared/components/item-edit/helpers.js +181 -155
- package/dist/shared/components/item-edit/line-midair.js +207 -0
- package/dist/shared/components/item-edit/soft-rules.js +27 -0
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/panels/CommentPanel.js +290 -284
- package/dist/shared/components/panels/ItemLockBanner.js +414 -358
- package/dist/shared/components/panels/PipelinePanel.js +1241 -992
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- package/dist/shared/components/panels/TaskPanel.js +71 -61
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
- package/dist/shared/components/panels/requirement-side-effects.js +40 -0
- package/dist/shared/components/queue/QueueWorklist.js +925 -871
- package/dist/shared/components/queue/column-chooser.js +21 -0
- package/dist/shared/components/queue/live-state-aspect.js +6 -0
- package/dist/shared/components/ui/number-draft-input.js +93 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
- package/dist/shared/lib/draft-store.js +48 -34
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/query-stats.js +60 -60
- package/package.json +1 -1
|
@@ -1,64 +1,65 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { Play as
|
|
4
|
-
import { useMemo as y, useState as
|
|
1
|
+
import { jsx as s, Fragment as w, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as q, useQueryClient as R, useMutation as C } from "@tanstack/react-query";
|
|
3
|
+
import { Play as N, Pause as $, Zap as F } from "lucide-react";
|
|
4
|
+
import { useMemo as y, useState as j } from "react";
|
|
5
5
|
import { toast as p } from "sonner";
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as
|
|
8
|
-
import { errorToastOptions as
|
|
9
|
-
import { userErrorMessage as
|
|
10
|
-
import { cn as
|
|
11
|
-
import { useAvailableBulkActions as
|
|
12
|
-
import { Button as
|
|
13
|
-
import { Dialog as
|
|
14
|
-
import { Textarea as
|
|
6
|
+
import { useNivaroClient as x } from "../../context.js";
|
|
7
|
+
import { get as A, post as v } from "../../lib/commands.js";
|
|
8
|
+
import { errorToastOptions as S } from "../../lib/error-toast.js";
|
|
9
|
+
import { userErrorMessage as T } from "../../lib/safe-error.js";
|
|
10
|
+
import { cn as B } from "../../lib/utils.js";
|
|
11
|
+
import { useAvailableBulkActions as P, guardMatches as D } from "../bulk/BulkActionButtons.js";
|
|
12
|
+
import { Button as k } from "../ui/button.js";
|
|
13
|
+
import { Dialog as H, DialogContent as M, DialogHeader as Q, DialogTitle as _, DialogDescription as E, DialogBody as J, DialogFooter as K } from "../ui/dialog.js";
|
|
14
|
+
import { Textarea as L } from "../ui/textarea.js";
|
|
15
15
|
import { invalidateRecordQueries as O } from "./RecordLiveSync.js";
|
|
16
|
-
function
|
|
17
|
-
const
|
|
16
|
+
function de(e, n, t, m = {}) {
|
|
17
|
+
const f = x(), h = !!n && n !== "new", { data: u } = P(h ? [e] : []), a = y(
|
|
18
18
|
() => ((u == null ? void 0 : u[e]) ?? []).filter(
|
|
19
|
-
(
|
|
19
|
+
(r) => r.header === !0 && (r.kind === "update_fields" || r.kind === "transition")
|
|
20
20
|
),
|
|
21
21
|
[u, e]
|
|
22
|
-
),
|
|
23
|
-
const
|
|
24
|
-
for (const
|
|
25
|
-
for (const
|
|
26
|
-
|
|
27
|
-
return [...
|
|
28
|
-
}, [
|
|
29
|
-
queryKey: ["record-header-action-guard", e, String(n),
|
|
30
|
-
queryFn: () =>
|
|
31
|
-
|
|
32
|
-
fields:
|
|
22
|
+
), d = y(() => {
|
|
23
|
+
const r = /* @__PURE__ */ new Set();
|
|
24
|
+
for (const i of a)
|
|
25
|
+
for (const o of i.guard ?? [])
|
|
26
|
+
o && typeof o.field == "string" && !(t && o.field in t) && r.add(o.field);
|
|
27
|
+
return [...r].sort();
|
|
28
|
+
}, [a, t]), { data: l } = q({
|
|
29
|
+
queryKey: ["record-header-action-guard", e, String(n), d.join(",")],
|
|
30
|
+
queryFn: () => f.request(
|
|
31
|
+
A(`/items/${encodeURIComponent(e)}/${encodeURIComponent(String(n))}`, {
|
|
32
|
+
fields: d.join(",")
|
|
33
33
|
})
|
|
34
|
-
).then((
|
|
35
|
-
enabled:
|
|
34
|
+
).then((r) => r.data ?? {}).catch(() => ({})),
|
|
35
|
+
enabled: h && d.length > 0,
|
|
36
36
|
staleTime: 0
|
|
37
|
-
});
|
|
37
|
+
}), c = m.fieldsLocked === !0;
|
|
38
38
|
return y(() => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const r = c ? a.filter((o) => o.kind !== "update_fields") : a;
|
|
40
|
+
if (d.length > 0 && !l) return r.filter((o) => {
|
|
41
|
+
var b;
|
|
42
|
+
return !((b = o.guard) != null && b.length);
|
|
42
43
|
});
|
|
43
|
-
const
|
|
44
|
-
return
|
|
45
|
-
}, [
|
|
44
|
+
const i = { ...l ?? {}, ...t ?? {} };
|
|
45
|
+
return r.filter((o) => D(o.guard, i) !== !1);
|
|
46
|
+
}, [a, d, l, t, c]);
|
|
46
47
|
}
|
|
47
48
|
function U(e) {
|
|
48
|
-
return /remove-hold|unhold/i.test(e.key) ? /* @__PURE__ */
|
|
49
|
+
return /remove-hold|unhold/i.test(e.key) ? /* @__PURE__ */ s(N, { className: "h-3.5 w-3.5" }) : /hold/i.test(e.key) ? /* @__PURE__ */ s($, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ s(F, { className: "h-3.5 w-3.5" });
|
|
49
50
|
}
|
|
50
51
|
function W(e) {
|
|
51
52
|
const n = e.summary && e.summary !== "Built-in" ? e.summary : e.label;
|
|
52
53
|
return e.require_reason ? `${n}. You’ll be asked for a justification, saved as a note on the record.` : `${n}.`;
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
+
function ue({
|
|
55
56
|
actions: e,
|
|
56
57
|
onPick: n
|
|
57
58
|
}) {
|
|
58
|
-
return e.length === 0 ? null : /* @__PURE__ */
|
|
59
|
+
return e.length === 0 ? null : /* @__PURE__ */ s(w, { children: e.map((t) => (
|
|
59
60
|
// Same Button, size and type as the pipeline's transition buttons beside them.
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
|
|
61
|
+
/* @__PURE__ */ g(
|
|
62
|
+
k,
|
|
62
63
|
{
|
|
63
64
|
type: "button",
|
|
64
65
|
size: "sm",
|
|
@@ -66,7 +67,7 @@ function de({
|
|
|
66
67
|
"data-record-header-action": t.key,
|
|
67
68
|
"data-tip": W(t),
|
|
68
69
|
onClick: () => n(t),
|
|
69
|
-
className:
|
|
70
|
+
className: B(
|
|
70
71
|
"shrink-0 gap-1.5 text-[12px]",
|
|
71
72
|
t.variant === "danger" && "border-red-300 text-red-600 hover:bg-red-50 hover:text-red-700 dark:border-red-500/40 dark:text-red-400 dark:hover:bg-red-500/10"
|
|
72
73
|
),
|
|
@@ -79,59 +80,59 @@ function de({
|
|
|
79
80
|
)
|
|
80
81
|
)) });
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
+
function le({
|
|
83
84
|
action: e,
|
|
84
85
|
collection: n,
|
|
85
86
|
itemId: t,
|
|
86
|
-
onClose:
|
|
87
|
-
onDone:
|
|
87
|
+
onClose: m,
|
|
88
|
+
onDone: f
|
|
88
89
|
}) {
|
|
89
|
-
const
|
|
90
|
+
const h = x(), u = R(), [a, d] = j(""), l = !!(e != null && e.require_reason), c = C({
|
|
90
91
|
mutationFn: async (r) => {
|
|
91
|
-
const
|
|
92
|
-
return { a: r, result:
|
|
92
|
+
const i = { collection: n, ids: [t], reason: a.trim() || null }, o = r.source === "db" ? await h.request(v("/bulk-actions/run", { ...i, key: r.key })) : await h.request(v(`/bulk-actions/${r.key}/execute`, i));
|
|
93
|
+
return { a: r, result: o.data ?? {} };
|
|
93
94
|
},
|
|
94
|
-
onSuccess: ({ a: r, result:
|
|
95
|
-
var
|
|
96
|
-
(
|
|
95
|
+
onSuccess: ({ a: r, result: i }) => {
|
|
96
|
+
var o;
|
|
97
|
+
(o = i.errors) != null && o.length ? p.error(i.errors[0].error) : !i.succeeded && i.skipped ? p.info(`${r.label}: nothing to change on this record`) : p.success(`${r.label} — done`), O(u, n, [t]), u.invalidateQueries({ queryKey: ["record-header-action-guard", n] }), d(""), f == null || f(), m();
|
|
97
98
|
},
|
|
98
|
-
onError: (r) => p.error(
|
|
99
|
+
onError: (r) => p.error(T(r, "The action did not run"), S(r))
|
|
99
100
|
});
|
|
100
|
-
return /* @__PURE__ */
|
|
101
|
-
|
|
101
|
+
return /* @__PURE__ */ s(
|
|
102
|
+
H,
|
|
102
103
|
{
|
|
103
104
|
open: !!e,
|
|
104
105
|
onOpenChange: (r) => {
|
|
105
|
-
r || (
|
|
106
|
+
r || (d(""), m());
|
|
106
107
|
},
|
|
107
|
-
children: /* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
/* @__PURE__ */
|
|
108
|
+
children: /* @__PURE__ */ g(M, { className: "sm:max-w-md", "data-record-header-action-dialog": "", children: [
|
|
109
|
+
/* @__PURE__ */ g(Q, { children: [
|
|
110
|
+
/* @__PURE__ */ s(_, { children: e == null ? void 0 : e.label }),
|
|
111
|
+
/* @__PURE__ */ s(E, { children: l ? "Say why — your justification is saved as a note on this record." : "Runs on this record. A justification, if you add one, is saved as a note." })
|
|
111
112
|
] }),
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
-
|
|
113
|
+
/* @__PURE__ */ g(J, { className: "space-y-1.5", children: [
|
|
114
|
+
/* @__PURE__ */ s("label", { htmlFor: "record-header-action-reason", className: "text-[12.5px] font-medium", children: l ? "Justification (required)" : "Justification (optional)" }),
|
|
115
|
+
/* @__PURE__ */ s(
|
|
116
|
+
L,
|
|
116
117
|
{
|
|
117
118
|
id: "record-header-action-reason",
|
|
118
119
|
autoFocus: !0,
|
|
119
120
|
rows: 4,
|
|
120
|
-
value:
|
|
121
|
-
onChange: (r) =>
|
|
121
|
+
value: a,
|
|
122
|
+
onChange: (r) => d(r.target.value),
|
|
122
123
|
placeholder: "Why?"
|
|
123
124
|
}
|
|
124
125
|
)
|
|
125
126
|
] }),
|
|
126
|
-
/* @__PURE__ */
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
|
|
127
|
+
/* @__PURE__ */ g(K, { children: [
|
|
128
|
+
/* @__PURE__ */ s(k, { variant: "outline", onClick: m, disabled: c.isPending, children: "Cancel" }),
|
|
129
|
+
/* @__PURE__ */ s(
|
|
130
|
+
k,
|
|
130
131
|
{
|
|
131
|
-
onClick: () => e &&
|
|
132
|
-
disabled: !e ||
|
|
132
|
+
onClick: () => e && c.mutate(e),
|
|
133
|
+
disabled: !e || c.isPending || l && !a.trim(),
|
|
133
134
|
className: "bg-nvr-cyan text-white hover:bg-nvr-cyan/90",
|
|
134
|
-
children:
|
|
135
|
+
children: c.isPending ? "Working…" : e == null ? void 0 : e.label
|
|
135
136
|
}
|
|
136
137
|
)
|
|
137
138
|
] })
|
|
@@ -140,7 +141,7 @@ function ue({
|
|
|
140
141
|
);
|
|
141
142
|
}
|
|
142
143
|
export {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
ue as RecordHeaderActionButtons,
|
|
145
|
+
le as RecordHeaderActionDialog,
|
|
146
|
+
de as useRecordHeaderActions
|
|
146
147
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useQueryClient as
|
|
1
|
+
import { jsx as d, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as ce } from "@tanstack/react-query";
|
|
3
3
|
import { EyeOff as me, ArrowLeft as le, Trash2 as fe, Copy as pe, FileUp as be, Bot as he, UploadCloud as ge } from "lucide-react";
|
|
4
4
|
import { useState as w, useRef as g, useEffect as k } from "react";
|
|
5
5
|
import { toast as O } from "sonner";
|
|
@@ -11,21 +11,21 @@ import { useRecordTabsSignal as Re, useRecordTabs as Te } from "../../lib/record
|
|
|
11
11
|
import { userErrorMessage as _e } from "../../lib/safe-error.js";
|
|
12
12
|
import { formatRelative as $e } from "../../lib/utils.js";
|
|
13
13
|
import { markLiveRecordWrite as Ee } from "./live-record-marks.js";
|
|
14
|
-
function
|
|
14
|
+
function Ke(e, r, u) {
|
|
15
15
|
var f;
|
|
16
|
-
if (
|
|
16
|
+
if (u.active)
|
|
17
17
|
return { text: e ? `${e} moved this to ${r}` : `This record moved to ${r}` };
|
|
18
|
-
const p = ((f =
|
|
18
|
+
const p = ((f = u.label) == null ? void 0 : f.trim()) || "A record in your tabs";
|
|
19
19
|
return {
|
|
20
20
|
text: e ? `${e} moved ${p} to ${r}` : `${p} moved to ${r}`,
|
|
21
|
-
open:
|
|
21
|
+
open: u.open
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
const
|
|
26
|
-
return typeof
|
|
24
|
+
function De(e, r) {
|
|
25
|
+
const u = e == null ? void 0 : e.user_id;
|
|
26
|
+
return typeof u == "string" && !!r && u.toUpperCase() === String(r).toUpperCase();
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const Le = 8e3, te = [
|
|
29
29
|
"item",
|
|
30
30
|
"rrv-record",
|
|
31
31
|
"revisions",
|
|
@@ -45,30 +45,30 @@ const Ae = 8e3, te = [
|
|
|
45
45
|
"record-integrations",
|
|
46
46
|
"record-integrity"
|
|
47
47
|
];
|
|
48
|
-
function
|
|
49
|
-
const p = new Set(te), f = String(
|
|
48
|
+
function Qe(e, r, u) {
|
|
49
|
+
const p = new Set(te), f = String(u);
|
|
50
50
|
e.removeQueries({
|
|
51
|
-
predicate: (
|
|
51
|
+
predicate: (c) => p.has(c.queryKey[0]) && c.queryKey[1] === r && String(c.queryKey[2]) === f
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
function Ge(e, r,
|
|
55
|
-
if (!r ||
|
|
56
|
-
const p = new Set(te), f = new Set(
|
|
54
|
+
function Ge(e, r, u) {
|
|
55
|
+
if (!r || u.length === 0) return;
|
|
56
|
+
const p = new Set(te), f = new Set(u.map(String));
|
|
57
57
|
e.invalidateQueries({
|
|
58
|
-
predicate: (
|
|
58
|
+
predicate: (c) => p.has(c.queryKey[0]) && c.queryKey[1] === r && f.has(String(c.queryKey[2]))
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
return /* @__PURE__ */
|
|
61
|
+
function qe({ onBack: e }) {
|
|
62
|
+
return /* @__PURE__ */ d("div", { className: "p-6", children: /* @__PURE__ */ m(
|
|
63
63
|
"div",
|
|
64
64
|
{
|
|
65
65
|
"data-record-gone": "access",
|
|
66
66
|
role: "alert",
|
|
67
67
|
className: "flex items-center gap-3 rounded-lg border border-amber-300 bg-amber-50 px-3.5 py-2.5 dark:border-amber-500/40 dark:bg-amber-500/10",
|
|
68
68
|
children: [
|
|
69
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ d(me, { className: "h-4 w-4 shrink-0 text-amber-500" }),
|
|
70
70
|
/* @__PURE__ */ m("p", { className: "min-w-0 flex-1 text-[12px] text-amber-800 dark:text-amber-300", children: [
|
|
71
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ d("span", { className: "font-semibold", children: "You no longer have access to this record." }),
|
|
72
72
|
" A role, scope or filter change hid it while you had it open."
|
|
73
73
|
] }),
|
|
74
74
|
/* @__PURE__ */ m(
|
|
@@ -79,7 +79,7 @@ function Qe({ onBack: e }) {
|
|
|
79
79
|
"data-record-gone-back": !0,
|
|
80
80
|
className: "inline-flex h-7 shrink-0 items-center gap-1 rounded-md border border-amber-300 bg-white px-2.5 text-[11.5px] font-medium text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-300 dark:hover:bg-amber-500/10",
|
|
81
81
|
children: [
|
|
82
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ d(le, { className: "h-3.5 w-3.5" }),
|
|
83
83
|
"Back"
|
|
84
84
|
]
|
|
85
85
|
}
|
|
@@ -88,31 +88,31 @@ function Qe({ onBack: e }) {
|
|
|
88
88
|
}
|
|
89
89
|
) });
|
|
90
90
|
}
|
|
91
|
-
const
|
|
91
|
+
const Ae = (e) => {
|
|
92
92
|
var r;
|
|
93
93
|
return (e == null ? void 0 : e.status) ?? ((r = e == null ? void 0 : e.response) == null ? void 0 : r.status);
|
|
94
94
|
};
|
|
95
95
|
function Je({
|
|
96
96
|
collection: e,
|
|
97
97
|
itemId: r,
|
|
98
|
-
dirty:
|
|
98
|
+
dirty: u = !1,
|
|
99
99
|
loadDenied: p = !1,
|
|
100
100
|
onGoneChange: f
|
|
101
101
|
}) {
|
|
102
|
-
const
|
|
102
|
+
const c = Ne(), T = ve(), y = ce(), [D, j] = w(!1), [L, se] = w([]), [o, ne] = w(null), [ae, Q] = w({}), [B, F] = w(!1), [P, Y] = w(!1), S = g(null), N = g(null), _ = g(Date.now()), q = g(null), $ = g(f);
|
|
103
103
|
$.current = f;
|
|
104
|
-
const
|
|
104
|
+
const x = g(null), W = ye(), H = g(W);
|
|
105
105
|
H.current = W;
|
|
106
106
|
const R = (s) => {
|
|
107
107
|
var t;
|
|
108
|
-
|
|
108
|
+
x.current = s, ne(s), (t = $.current) == null || t.call($, s), (s == null ? void 0 : s.kind) === "access" && setTimeout(() => Qe(y, e, r), 0);
|
|
109
109
|
};
|
|
110
110
|
k(() => {
|
|
111
|
-
_.current = Date.now(),
|
|
111
|
+
_.current = Date.now(), q.current = null, Q({}), x.current && R(null);
|
|
112
112
|
}, [e, r]);
|
|
113
113
|
const l = (s) => {
|
|
114
|
-
for (const t of s)
|
|
115
|
-
},
|
|
114
|
+
for (const t of s) y.invalidateQueries({ queryKey: t });
|
|
115
|
+
}, A = async (s) => {
|
|
116
116
|
let t = null;
|
|
117
117
|
try {
|
|
118
118
|
t = (await T.request(
|
|
@@ -135,8 +135,8 @@ function Je({
|
|
|
135
135
|
const t = (await T.request(
|
|
136
136
|
U(`/pipelines/instance/${e}/${r}`)
|
|
137
137
|
)).data, a = (s = t == null ? void 0 : t.history) == null ? void 0 : s[0];
|
|
138
|
-
if (!a || a.id ===
|
|
139
|
-
const b = [a.first_name, a.last_name].filter(Boolean).join(" ") || a.user_email || null,
|
|
138
|
+
if (!a || a.id === q.current || a.timestamp && new Date(a.timestamp).getTime() < _.current - 5e3 || (q.current = a.id, typeof document < "u" && document.visibilityState === "hidden")) return;
|
|
139
|
+
const b = [a.first_name, a.last_name].filter(Boolean).join(" ") || a.user_email || null, i = a.to_state_label ?? "a new state", n = Ke(b, i, H.current);
|
|
140
140
|
O.info(
|
|
141
141
|
n.text,
|
|
142
142
|
n.open ? { action: { label: "Open", onClick: n.open } } : {}
|
|
@@ -146,12 +146,12 @@ function Je({
|
|
|
146
146
|
}, ie = (s) => {
|
|
147
147
|
var a, b;
|
|
148
148
|
if (s.deleted) {
|
|
149
|
-
|
|
149
|
+
A("deleted");
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
|
-
if (
|
|
153
|
-
s.events.some((
|
|
154
|
-
const t = (
|
|
152
|
+
if (x.current) return;
|
|
153
|
+
s.events.some((i) => i.source === "import" && !i.own) && (Y(!0), S.current && clearTimeout(S.current), S.current = setTimeout(() => Y(!1), Le));
|
|
154
|
+
const t = (i) => Se(s, i);
|
|
155
155
|
if (t(v.state) && (l([
|
|
156
156
|
["pipeline-instance", e, r],
|
|
157
157
|
["pipeline-all-owners", e, r],
|
|
@@ -164,8 +164,10 @@ function Je({
|
|
|
164
164
|
]) : (t(v.state) || t(v.integrations) || t(v.addendums) || !s.aspectsOnly) && l([["comments-related", e, r]]), t(v.tasks) && l([["tasks", e, r]]), t(v.integrations) && l([
|
|
165
165
|
["erp-submissions", e, r],
|
|
166
166
|
["record-integrations", e, r]
|
|
167
|
-
]),
|
|
168
|
-
|
|
167
|
+
]), y.invalidateQueries({
|
|
168
|
+
predicate: (i) => (i.queryKey[0] === "child-summary" || i.queryKey[0] === "field-lineage") && i.queryKey[1] === e && String(i.queryKey[2]) === String(r)
|
|
169
|
+
}), !s.aspectsOnly) {
|
|
170
|
+
if (s.ids.length > 0 && s.ids.every((i) => i === "*")) {
|
|
169
171
|
l([
|
|
170
172
|
["item", e, r],
|
|
171
173
|
["pipeline-instance", e, r]
|
|
@@ -175,7 +177,7 @@ function Je({
|
|
|
175
177
|
Ee(
|
|
176
178
|
e,
|
|
177
179
|
r,
|
|
178
|
-
((b = s.changedFields) == null ? void 0 : b.filter((
|
|
180
|
+
((b = s.changedFields) == null ? void 0 : b.filter((i) => !i.startsWith("$"))) ?? null
|
|
179
181
|
), V(!0);
|
|
180
182
|
}
|
|
181
183
|
}, V = async (s) => {
|
|
@@ -187,13 +189,13 @@ function Je({
|
|
|
187
189
|
["revisions", e, r]
|
|
188
190
|
]);
|
|
189
191
|
const t = ["last-touch", e, String(r)];
|
|
190
|
-
await
|
|
191
|
-
}), !(!s ||
|
|
192
|
+
await y.invalidateQueries({ queryKey: t }).catch(() => {
|
|
193
|
+
}), !(!s || De(y.getQueryData(t), z.current)) && (j(!0), N.current && clearTimeout(N.current), N.current = setTimeout(() => j(!1), 4e3));
|
|
192
194
|
};
|
|
193
195
|
ke(e, r, ie);
|
|
194
196
|
const { userId: E } = xe(), z = g(E);
|
|
195
197
|
z.current = E, Re(E, "saved", e, r, () => {
|
|
196
|
-
|
|
198
|
+
x.current || (V(!1), l([
|
|
197
199
|
["pipeline-instance", e, r],
|
|
198
200
|
["comments", e, r],
|
|
199
201
|
["tasks", e, r],
|
|
@@ -209,7 +211,7 @@ function Je({
|
|
|
209
211
|
), ee(
|
|
210
212
|
"owners:changed",
|
|
211
213
|
() => {
|
|
212
|
-
|
|
214
|
+
x.current || l([
|
|
213
215
|
["pipeline-instance-owners", e, r],
|
|
214
216
|
["pipeline-owners-resolved", e, r],
|
|
215
217
|
["pipeline-all-owners", e, r],
|
|
@@ -229,15 +231,15 @@ function Je({
|
|
|
229
231
|
if (!t) return;
|
|
230
232
|
const a = G.current, b = a.get(t);
|
|
231
233
|
b && clearTimeout(b), a.delete(t);
|
|
232
|
-
const
|
|
234
|
+
const i = () => Q((n) => {
|
|
233
235
|
const { [t]: h, ...M } = n;
|
|
234
236
|
return M;
|
|
235
237
|
});
|
|
236
238
|
if ((s == null ? void 0 : s.state) === "end") {
|
|
237
|
-
|
|
239
|
+
i();
|
|
238
240
|
return;
|
|
239
241
|
}
|
|
240
|
-
|
|
242
|
+
Q((n) => ({ ...n, [t]: String((s == null ? void 0 : s.flow_name) || "An automation") })), a.set(t, setTimeout(i, 5 * 6e4));
|
|
241
243
|
}), k(() => {
|
|
242
244
|
const s = G.current;
|
|
243
245
|
return () => {
|
|
@@ -250,12 +252,12 @@ function Je({
|
|
|
250
252
|
setTimeout(
|
|
251
253
|
() => {
|
|
252
254
|
var s;
|
|
253
|
-
((s =
|
|
255
|
+
((s = x.current) == null ? void 0 : s.kind) !== "deleted" && T.request(U(`/items/${e}/${r}`, { fields: "id" })).then(() => {
|
|
254
256
|
var t;
|
|
255
|
-
((t =
|
|
257
|
+
((t = x.current) == null ? void 0 : t.kind) === "access" && (R(null), l([["item", e, r]]));
|
|
256
258
|
}).catch((t) => {
|
|
257
|
-
const a =
|
|
258
|
-
(a === 403 || a === 404) &&
|
|
259
|
+
const a = Ae(t);
|
|
260
|
+
(a === 403 || a === 404) && A("access");
|
|
259
261
|
});
|
|
260
262
|
},
|
|
261
263
|
Math.floor(Math.random() * 1500)
|
|
@@ -263,16 +265,16 @@ function Je({
|
|
|
263
265
|
},
|
|
264
266
|
{ debounceMs: 300 }
|
|
265
267
|
), k(() => {
|
|
266
|
-
p && !
|
|
268
|
+
p && !x.current && A("access");
|
|
267
269
|
}, [p]);
|
|
268
|
-
const
|
|
270
|
+
const K = Te(e, r, u, E), [de, J] = w(!1);
|
|
269
271
|
k(() => {
|
|
270
|
-
|
|
271
|
-
}, [
|
|
272
|
-
if (!
|
|
272
|
+
K.otherDirty || J(!1);
|
|
273
|
+
}, [K.otherDirty]), k(() => {
|
|
274
|
+
if (!c) return;
|
|
273
275
|
const s = (n) => {
|
|
274
276
|
const h = n.detail;
|
|
275
|
-
h != null && h.name &&
|
|
277
|
+
h != null && h.name && c.emit("record:uploading", {
|
|
276
278
|
collection: e,
|
|
277
279
|
item: String(r),
|
|
278
280
|
name: h.name,
|
|
@@ -287,14 +289,14 @@ function Je({
|
|
|
287
289
|
const Z = M.filter((I) => !(I.user === h && I.name === n.name));
|
|
288
290
|
return n.state === "start" ? [...Z, { user: h, name: String(n.name) }] : Z;
|
|
289
291
|
});
|
|
290
|
-
}, a =
|
|
291
|
-
(n == null ? void 0 : n.collection) !== e || String(n == null ? void 0 : n.item) !== String(r) || (
|
|
292
|
-
}),
|
|
293
|
-
return window.addEventListener("nvr:record-uploading",
|
|
294
|
-
window.removeEventListener("nvr:upload-state", s), window.removeEventListener("nvr:record-uploading",
|
|
292
|
+
}, a = c.on("record:uploading", t), b = c.on("record:comment", (n) => {
|
|
293
|
+
(n == null ? void 0 : n.collection) !== e || String(n == null ? void 0 : n.item) !== String(r) || (y.invalidateQueries({ queryKey: ["comments", e, r] }), y.invalidateQueries({ queryKey: ["comments-related", e, r] }));
|
|
294
|
+
}), i = (n) => t(n.detail);
|
|
295
|
+
return window.addEventListener("nvr:record-uploading", i), () => {
|
|
296
|
+
window.removeEventListener("nvr:upload-state", s), window.removeEventListener("nvr:record-uploading", i), a(), b();
|
|
295
297
|
};
|
|
296
|
-
}, [
|
|
297
|
-
const
|
|
298
|
+
}, [c, e, r, y]);
|
|
299
|
+
const ue = async () => {
|
|
298
300
|
if (o != null && o.trashId) {
|
|
299
301
|
F(!0);
|
|
300
302
|
try {
|
|
@@ -305,8 +307,8 @@ function Je({
|
|
|
305
307
|
F(!1);
|
|
306
308
|
}
|
|
307
309
|
}
|
|
308
|
-
},
|
|
309
|
-
return !o &&
|
|
310
|
+
}, C = Object.values(ae), X = K.otherDirty && !de && !u && !o;
|
|
311
|
+
return !o && C.length === 0 && !X && !P && (!c || !D && L.length === 0) ? null : /* @__PURE__ */ m("div", { className: "space-y-2", children: [
|
|
310
312
|
(o == null ? void 0 : o.kind) === "deleted" && /* @__PURE__ */ m(
|
|
311
313
|
"div",
|
|
312
314
|
{
|
|
@@ -314,19 +316,19 @@ function Je({
|
|
|
314
316
|
role: "alert",
|
|
315
317
|
className: "flex items-center gap-3 rounded-lg border border-rose-300 bg-rose-50 px-3.5 py-2.5 dark:border-rose-500/40 dark:bg-rose-500/10",
|
|
316
318
|
children: [
|
|
317
|
-
/* @__PURE__ */
|
|
319
|
+
/* @__PURE__ */ d(fe, { className: "h-4 w-4 shrink-0 text-rose-500" }),
|
|
318
320
|
/* @__PURE__ */ m("p", { className: "min-w-0 flex-1 text-[12px] text-rose-800 dark:text-rose-300", children: [
|
|
319
|
-
/* @__PURE__ */
|
|
321
|
+
/* @__PURE__ */ d("span", { className: "font-semibold", children: "This record was deleted" }),
|
|
320
322
|
o.by ? ` by ${o.by}` : "",
|
|
321
323
|
o.at ? ` ${$e(o.at)}` : "",
|
|
322
324
|
". Saving is turned off",
|
|
323
325
|
o.canRestore ? " — restore it to keep working." : "."
|
|
324
326
|
] }),
|
|
325
|
-
o.canRestore && o.trashId != null && /* @__PURE__ */
|
|
327
|
+
o.canRestore && o.trashId != null && /* @__PURE__ */ d(
|
|
326
328
|
"button",
|
|
327
329
|
{
|
|
328
330
|
type: "button",
|
|
329
|
-
onClick: () => void
|
|
331
|
+
onClick: () => void ue(),
|
|
330
332
|
disabled: B,
|
|
331
333
|
className: "h-7 shrink-0 rounded-md border border-rose-300 bg-white px-2.5 text-[11.5px] font-medium text-rose-700 hover:bg-rose-100 disabled:opacity-50 dark:border-rose-500/40 dark:bg-transparent dark:text-rose-300 dark:hover:bg-rose-500/10",
|
|
332
334
|
children: B ? "Restoring…" : "Restore"
|
|
@@ -335,25 +337,25 @@ function Je({
|
|
|
335
337
|
]
|
|
336
338
|
}
|
|
337
339
|
),
|
|
338
|
-
(o == null ? void 0 : o.kind) === "access" && !f && /* @__PURE__ */
|
|
340
|
+
(o == null ? void 0 : o.kind) === "access" && !f && /* @__PURE__ */ d(qe, { onBack: () => window.history.back() }),
|
|
339
341
|
X && /* @__PURE__ */ m(
|
|
340
342
|
"div",
|
|
341
343
|
{
|
|
342
344
|
"data-record-other-tab": !0,
|
|
343
345
|
className: "flex items-center gap-3 rounded-lg border border-amber-300 bg-amber-50 px-3.5 py-2.5 dark:border-amber-500/40 dark:bg-amber-500/10",
|
|
344
346
|
children: [
|
|
345
|
-
/* @__PURE__ */
|
|
346
|
-
/* @__PURE__ */
|
|
347
|
-
/* @__PURE__ */
|
|
347
|
+
/* @__PURE__ */ d(pe, { className: "h-4 w-4 shrink-0 text-amber-500" }),
|
|
348
|
+
/* @__PURE__ */ d("p", { className: "min-w-0 flex-1 text-[12px] text-amber-800 dark:text-amber-300", children: "This record is open with unsaved changes in another tab — editing it here too may overwrite them." }),
|
|
349
|
+
/* @__PURE__ */ d(
|
|
348
350
|
"button",
|
|
349
351
|
{
|
|
350
352
|
type: "button",
|
|
351
|
-
onClick:
|
|
353
|
+
onClick: K.focusOther,
|
|
352
354
|
className: "h-7 shrink-0 rounded-md border border-amber-300 bg-white px-2.5 text-[11.5px] font-medium text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-300 dark:hover:bg-amber-500/10",
|
|
353
355
|
children: "Switch to that tab"
|
|
354
356
|
}
|
|
355
357
|
),
|
|
356
|
-
/* @__PURE__ */
|
|
358
|
+
/* @__PURE__ */ d(
|
|
357
359
|
"button",
|
|
358
360
|
{
|
|
359
361
|
type: "button",
|
|
@@ -372,44 +374,44 @@ function Je({
|
|
|
372
374
|
role: "status",
|
|
373
375
|
className: "flex items-center gap-3 rounded-lg border border-amber-300 bg-amber-50 px-3.5 py-2.5 dark:border-amber-500/40 dark:bg-amber-500/10",
|
|
374
376
|
children: [
|
|
375
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ d(be, { className: "h-4 w-4 shrink-0 animate-pulse text-amber-500" }),
|
|
376
378
|
/* @__PURE__ */ m("p", { className: "min-w-0 flex-1 text-[12px] text-amber-800 dark:text-amber-300", children: [
|
|
377
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ d("span", { className: "font-semibold", children: "An import is updating this record" }),
|
|
378
380
|
" — the changed fields refresh here as it goes.",
|
|
379
|
-
|
|
381
|
+
u ? " Your unsaved edits may be out of date; check them before saving." : ""
|
|
380
382
|
] })
|
|
381
383
|
]
|
|
382
384
|
}
|
|
383
385
|
),
|
|
384
|
-
|
|
386
|
+
C.length > 0 && !o && /* @__PURE__ */ m(
|
|
385
387
|
"div",
|
|
386
388
|
{
|
|
387
389
|
"data-record-automation": !0,
|
|
388
390
|
role: "status",
|
|
389
391
|
className: "flex items-center gap-3 rounded-lg border border-nvr-cyan/40 bg-nvr-cyan/10 px-3.5 py-2.5",
|
|
390
392
|
children: [
|
|
391
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ d(he, { className: "h-4 w-4 shrink-0 animate-pulse text-nvr-cyan" }),
|
|
392
394
|
/* @__PURE__ */ m("p", { className: "min-w-0 flex-1 text-[12px] text-[#0e7490] dark:text-[#67e8f9]", children: [
|
|
393
|
-
/* @__PURE__ */
|
|
395
|
+
/* @__PURE__ */ d("span", { className: "font-semibold", children: "Automation is updating this record" }),
|
|
394
396
|
" —",
|
|
395
397
|
" ",
|
|
396
|
-
|
|
398
|
+
C.join(", "),
|
|
397
399
|
". Its changes appear here when it finishes."
|
|
398
400
|
] })
|
|
399
401
|
]
|
|
400
402
|
}
|
|
401
403
|
),
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
/* @__PURE__ */
|
|
404
|
+
c && (D || L.length > 0) && /* @__PURE__ */ m("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
405
|
+
D && /* @__PURE__ */ m("span", { className: "inline-flex items-center gap-1.5 rounded-full border border-nvr-cyan/40 bg-nvr-cyan/10 px-2.5 py-0.5 text-[11px] font-medium text-[#0e7490] dark:text-[#67e8f9]", children: [
|
|
406
|
+
/* @__PURE__ */ d("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
|
|
405
407
|
"Updated just now by someone else"
|
|
406
408
|
] }),
|
|
407
|
-
|
|
409
|
+
L.map((s) => /* @__PURE__ */ m(
|
|
408
410
|
"span",
|
|
409
411
|
{
|
|
410
412
|
className: "inline-flex items-center gap-1.5 rounded-full border border-slate-200 bg-white px-2.5 py-0.5 text-[11px] text-slate-600 dark:border-border dark:bg-card dark:text-slate-300",
|
|
411
413
|
children: [
|
|
412
|
-
/* @__PURE__ */
|
|
414
|
+
/* @__PURE__ */ d(ge, { className: "h-3 w-3 animate-pulse text-nvr-cyan" }),
|
|
413
415
|
s.user,
|
|
414
416
|
" is uploading “",
|
|
415
417
|
s.name.length > 32 ? `${s.name.slice(0, 32)}…` : s.name,
|
|
@@ -423,10 +425,10 @@ function Je({
|
|
|
423
425
|
}
|
|
424
426
|
export {
|
|
425
427
|
te as RECORD_QUERY_HEADS,
|
|
426
|
-
|
|
428
|
+
qe as RecordAccessLostPanel,
|
|
427
429
|
Je as RecordLiveSync,
|
|
428
430
|
Ge as invalidateRecordQueries,
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
431
|
+
Ke as moveNotice,
|
|
432
|
+
Qe as purgeRecordQueries,
|
|
433
|
+
De as writtenBySelf
|
|
432
434
|
};
|