@nivaro/react 0.3.56 → 0.3.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/shared/components/CollectionBrowserView.js +2827 -2750
- package/dist/shared/components/DataTable.js +247 -236
- package/dist/shared/components/ItemEditForm.js +1693 -1668
- package/dist/shared/components/ProfileView.js +716 -715
- package/dist/shared/components/RecordReadView.js +367 -364
- package/dist/shared/components/ReportView.js +64 -39
- package/dist/shared/components/alerts/AlertManagerView.js +284 -271
- package/dist/shared/components/cbv/row-focus.js +19 -0
- package/dist/shared/components/help-videos/HelpVideoPlayer.js +152 -147
- package/dist/shared/components/integrations/console/SignalCard.js +59 -59
- package/dist/shared/components/integrations/console/tone.js +52 -30
- package/dist/shared/components/item-edit/CatalogPickerField.js +525 -505
- package/dist/shared/components/item-edit/FieldRow.js +175 -173
- package/dist/shared/components/item-edit/InlineTableField.js +407 -402
- package/dist/shared/components/item-edit/M2MCombobox.js +313 -291
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +1 -1
- package/dist/shared/components/item-edit/PlanGrid.js +826 -803
- package/dist/shared/components/item-edit/QuickCreateButton.js +115 -79
- package/dist/shared/components/item-edit/RecordLiveSync.js +77 -75
- package/dist/shared/components/item-edit/RelationCombobox.js +412 -328
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +147 -125
- package/dist/shared/components/item-edit/SummaryPanel.js +406 -392
- package/dist/shared/components/item-edit/option-disambiguate.js +44 -32
- package/dist/shared/components/item-edit/related-missing.js +45 -0
- package/dist/shared/components/item-edit/save-outcome.js +5 -5
- package/dist/shared/components/notifications/NotificationRulesEditor.js +130 -123
- package/dist/shared/components/panels/AccessDeniedPanel.js +52 -48
- package/dist/shared/components/panels/ItemLockBanner.js +2 -3
- package/dist/shared/components/panels/PipelinePanel.js +1027 -978
- package/dist/shared/components/panels/RevisionsPanel.js +4 -1
- package/dist/shared/components/panels/TaskPanel.js +265 -249
- package/dist/shared/components/panels/landing-state.js +27 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +86 -78
- package/dist/shared/components/profile/AiMemoryCard.js +12 -10
- package/dist/shared/components/queue/OwnerAvatars.js +80 -41
- package/dist/shared/components/queue/QueueItemSheet.js +111 -111
- package/dist/shared/components/queue/QueueQuickFilters.js +48 -48
- package/dist/shared/components/queue/QueueWorklist.js +975 -964
- package/dist/shared/components/queue/group-sums.js +27 -0
- package/dist/shared/components/queue/live-state-aspect.js +7 -3
- package/dist/shared/components/queue/path-label.js +14 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +186 -168
- package/dist/shared/lib/back-closes.js +25 -0
- package/dist/shared/lib/cbv-page-warm.js +36 -0
- package/dist/shared/lib/form-usage-beacon.js +7 -7
- package/dist/shared/lib/list-page-memory.js +41 -0
- package/dist/shared/lib/live.js +44 -44
- package/dist/shared/lib/own-writes.js +76 -28
- package/dist/shared/lib/record-ref.js +78 -53
- package/dist/shared/lib/request-gate.js +110 -109
- package/dist/shared/lib/validation-rules.js +34 -19
- package/package.json +1 -1
|
@@ -1,123 +1,149 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Plus as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import { userErrorMessage as
|
|
8
|
-
import { cn as
|
|
9
|
-
function
|
|
10
|
-
targetCollection:
|
|
11
|
-
config:
|
|
12
|
-
onCreated:
|
|
1
|
+
import { jsxs as d, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as A, useQuery as P } from "@tanstack/react-query";
|
|
3
|
+
import { Plus as Q, Loader2 as _ } from "lucide-react";
|
|
4
|
+
import { useState as x } from "react";
|
|
5
|
+
import { useNivaroClient as D, useParentDraft as F } from "../../context.js";
|
|
6
|
+
import { get as K, post as W } from "../../lib/commands.js";
|
|
7
|
+
import { userErrorMessage as L } from "../../lib/safe-error.js";
|
|
8
|
+
import { cn as z, titleCase as m } from "../../lib/utils.js";
|
|
9
|
+
function X({
|
|
10
|
+
targetCollection: t,
|
|
11
|
+
config: l,
|
|
12
|
+
onCreated: s
|
|
13
13
|
}) {
|
|
14
|
-
const
|
|
15
|
-
queryKey: ["quick-create-m2m",
|
|
16
|
-
queryFn: () =>
|
|
14
|
+
const i = D(), u = A(), y = F(), [g, h] = x(!1), [v, k] = x({}), [w, $] = x(!1), [S, f] = x(null), { data: b } = P({
|
|
15
|
+
queryKey: ["quick-create-m2m", t],
|
|
16
|
+
queryFn: () => i.request(K(`/collections/${t}`)).then(
|
|
17
17
|
(e) => {
|
|
18
|
-
var
|
|
18
|
+
var n;
|
|
19
19
|
return new Set(
|
|
20
|
-
(((
|
|
21
|
-
(
|
|
22
|
-
).map((
|
|
20
|
+
(((n = e.data) == null ? void 0 : n.relations) ?? []).filter(
|
|
21
|
+
(o) => o.one_collection === t && !!o.one_field && !!o.junction_field
|
|
22
|
+
).map((o) => String(o.one_field))
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
25
|
),
|
|
26
|
-
enabled:
|
|
26
|
+
enabled: g,
|
|
27
27
|
staleTime: 5 * 6e4
|
|
28
|
-
}),
|
|
29
|
-
var
|
|
30
|
-
return typeof e == "string" && e.startsWith("$parent.") ? ((
|
|
31
|
-
};
|
|
32
|
-
async function
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
}), N = (l.fields ?? []).filter((e) => e.from === void 0), q = (l.fields ?? []).filter((e) => e.from !== void 0), j = (e) => {
|
|
29
|
+
var n;
|
|
30
|
+
return typeof e == "string" && e.startsWith("$parent.") ? ((n = y == null ? void 0 : y.draft) == null ? void 0 : n[e.slice(8)]) ?? null : e;
|
|
31
|
+
}, p = B(q, j);
|
|
32
|
+
async function C() {
|
|
33
|
+
var n, o;
|
|
34
|
+
if (p.length > 0) return;
|
|
35
|
+
for (const r of N)
|
|
36
|
+
if (r.required && !(v[r.field] ?? "").trim()) {
|
|
37
|
+
f(`${r.label ?? m(r.field)} is required`);
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
+
$(!0), f(null);
|
|
40
41
|
const e = {};
|
|
41
|
-
for (const
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
const
|
|
45
|
-
|
|
42
|
+
for (const r of q) {
|
|
43
|
+
const a = j(r.from);
|
|
44
|
+
if (b != null && b.has(r.field)) {
|
|
45
|
+
const E = M(a);
|
|
46
|
+
E.length > 0 && (e[r.field] = E);
|
|
46
47
|
continue;
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
a != null && a !== "" && (e[r.field] = a);
|
|
49
50
|
}
|
|
50
|
-
for (const
|
|
51
|
-
const
|
|
52
|
-
|
|
51
|
+
for (const r of N) {
|
|
52
|
+
const a = (v[r.field] ?? "").trim();
|
|
53
|
+
a !== "" && (e[r.field] = a);
|
|
53
54
|
}
|
|
54
55
|
try {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
const r = await i.request(W(`/items/${t}`, e)), a = (n = r.data) == null ? void 0 : n.id;
|
|
57
|
+
if (a == null) throw new Error("Created record returned no id");
|
|
58
|
+
if (u.invalidateQueries({ queryKey: ["relation-opts", t] }), ((o = r.meta) == null ? void 0 : o.readable) === !1) {
|
|
59
|
+
f(
|
|
60
|
+
"Created, but it is outside what you can see, so it can't be selected here. Ask an administrator to check your access."
|
|
61
|
+
), k({});
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
s(a), h(!1), k({});
|
|
65
|
+
} catch (r) {
|
|
66
|
+
f(L(r, "Create failed"));
|
|
62
67
|
} finally {
|
|
63
|
-
|
|
68
|
+
$(!1);
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
|
-
return /* @__PURE__ */
|
|
67
|
-
/* @__PURE__ */
|
|
71
|
+
return /* @__PURE__ */ d("div", { className: "relative shrink-0", children: [
|
|
72
|
+
/* @__PURE__ */ d(
|
|
68
73
|
"button",
|
|
69
74
|
{
|
|
70
75
|
type: "button",
|
|
71
|
-
title:
|
|
72
|
-
onClick: () =>
|
|
73
|
-
className:
|
|
76
|
+
title: l.title ?? `New ${m(t)}`,
|
|
77
|
+
onClick: () => h((e) => !e),
|
|
78
|
+
className: z(
|
|
74
79
|
"inline-flex h-9 items-center gap-1 rounded-md border px-2.5 text-[12px] transition-colors",
|
|
75
|
-
|
|
80
|
+
g ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-input text-slate-600 hover:border-slate-400 hover:text-slate-800 dark:text-slate-300"
|
|
76
81
|
),
|
|
77
82
|
children: [
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
|
|
83
|
+
/* @__PURE__ */ c(Q, { className: "h-3.5 w-3.5" }),
|
|
84
|
+
l.label ?? "New"
|
|
80
85
|
]
|
|
81
86
|
}
|
|
82
87
|
),
|
|
83
|
-
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
g && /* @__PURE__ */ d("div", { className: "absolute right-0 z-50 mt-1 w-72 rounded-md border border-border bg-background p-3 shadow-md", children: [
|
|
89
|
+
/* @__PURE__ */ c("p", { className: "mb-2 text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: l.title ?? `New ${m(t)}` }),
|
|
90
|
+
p.length > 0 && /* @__PURE__ */ d(
|
|
91
|
+
"p",
|
|
92
|
+
{
|
|
93
|
+
"data-quick-create-missing": !0,
|
|
94
|
+
className: "mb-2 rounded border border-amber-200 bg-amber-50 px-2 py-1.5 text-[11.5px] leading-snug text-amber-800 dark:border-amber-500/40 dark:bg-[#2a2113] dark:text-amber-300",
|
|
95
|
+
children: [
|
|
96
|
+
"Pick ",
|
|
97
|
+
I(p),
|
|
98
|
+
" on the form first — the new",
|
|
99
|
+
" ",
|
|
100
|
+
(l.label ?? m(t)).replace(/^New\s+/i, "").toLowerCase(),
|
|
101
|
+
" ",
|
|
102
|
+
"takes ",
|
|
103
|
+
p.length === 1 ? "it" : "them",
|
|
104
|
+
" from there."
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
/* @__PURE__ */ c("div", { className: "flex flex-col gap-2", children: N.map((e) => /* @__PURE__ */ d("label", { className: "flex flex-col gap-1", children: [
|
|
109
|
+
/* @__PURE__ */ d("span", { className: "text-[11px] text-slate-500", children: [
|
|
110
|
+
e.label ?? m(e.field),
|
|
111
|
+
e.required && /* @__PURE__ */ c("span", { className: "ml-0.5 text-red-500", children: "*" })
|
|
89
112
|
] }),
|
|
90
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ c(
|
|
91
114
|
"input",
|
|
92
115
|
{
|
|
93
|
-
value:
|
|
94
|
-
onChange: (
|
|
116
|
+
value: v[e.field] ?? "",
|
|
117
|
+
onChange: (n) => k((o) => ({ ...o, [e.field]: n.target.value })),
|
|
118
|
+
onKeyDown: (n) => {
|
|
119
|
+
n.key === "Enter" ? (n.preventDefault(), C()) : n.key === "Escape" && (n.preventDefault(), n.stopPropagation(), h(!1), f(null));
|
|
120
|
+
},
|
|
95
121
|
className: "h-8 rounded border border-input bg-background px-2 text-[13px] outline-none focus:border-nvr-cyan"
|
|
96
122
|
}
|
|
97
123
|
)
|
|
98
124
|
] }, e.field)) }),
|
|
99
|
-
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */
|
|
125
|
+
S && /* @__PURE__ */ c("p", { className: "mt-2 text-[11px] text-red-600 dark:text-red-400", children: S }),
|
|
126
|
+
/* @__PURE__ */ d("div", { className: "mt-3 flex justify-end gap-2", children: [
|
|
127
|
+
/* @__PURE__ */ c(
|
|
102
128
|
"button",
|
|
103
129
|
{
|
|
104
130
|
type: "button",
|
|
105
131
|
onClick: () => {
|
|
106
|
-
|
|
132
|
+
h(!1), f(null);
|
|
107
133
|
},
|
|
108
134
|
className: "h-7 rounded px-2 text-[12px] text-slate-500 hover:text-slate-700",
|
|
109
135
|
children: "Cancel"
|
|
110
136
|
}
|
|
111
137
|
),
|
|
112
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ d(
|
|
113
139
|
"button",
|
|
114
140
|
{
|
|
115
141
|
type: "button",
|
|
116
|
-
disabled:
|
|
117
|
-
onClick: () => void
|
|
142
|
+
disabled: w || p.length > 0 || q.length > 0 && !b,
|
|
143
|
+
onClick: () => void C(),
|
|
118
144
|
className: "inline-flex h-7 items-center gap-1 rounded bg-nvr-cyan px-2.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",
|
|
119
145
|
children: [
|
|
120
|
-
|
|
146
|
+
w && /* @__PURE__ */ c(_, { className: "h-3 w-3 animate-spin" }),
|
|
121
147
|
"Create & select"
|
|
122
148
|
]
|
|
123
149
|
}
|
|
@@ -126,14 +152,24 @@ function H({
|
|
|
126
152
|
] })
|
|
127
153
|
] });
|
|
128
154
|
}
|
|
129
|
-
function
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
155
|
+
function B(t, l) {
|
|
156
|
+
return t.filter((s) => s.required && typeof s.from == "string" && s.from.startsWith("$parent.")).filter((s) => {
|
|
157
|
+
const i = l(s.from);
|
|
158
|
+
return i == null || i === "" || Array.isArray(i) && i.length === 0;
|
|
159
|
+
}).map((s) => s.label ?? m(String(s.from).slice(8)));
|
|
160
|
+
}
|
|
161
|
+
function I(t) {
|
|
162
|
+
return t.length <= 1 ? t[0] ?? "" : `${t.slice(0, -1).join(", ")} and ${t[t.length - 1]}`;
|
|
163
|
+
}
|
|
164
|
+
function M(t) {
|
|
165
|
+
const l = Array.isArray(t) ? t : [t], s = [];
|
|
166
|
+
for (const i of l) {
|
|
167
|
+
const u = i != null && typeof i == "object" ? i.id : i;
|
|
168
|
+
(typeof u == "string" && u !== "" || typeof u == "number") && s.push(u);
|
|
134
169
|
}
|
|
135
|
-
return
|
|
170
|
+
return s;
|
|
136
171
|
}
|
|
137
172
|
export {
|
|
138
|
-
|
|
173
|
+
X as QuickCreateButton,
|
|
174
|
+
B as missingRequiredSeeds
|
|
139
175
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as d, jsxs as m } from "react/jsx-runtime";
|
|
2
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
|
-
import { useState as w, useRef as
|
|
4
|
+
import { useState as w, useRef as v, useEffect as k } from "react";
|
|
5
5
|
import { toast as O } from "sonner";
|
|
6
6
|
import { useNivaroClient as ve, useRecordSurface as ye, useItemEditAuth as xe } from "../../context.js";
|
|
7
7
|
import { get as U, post as we } from "../../lib/commands.js";
|
|
8
|
-
import { useLiveRecord as ke, useLiveEvent as ee, useLiveRecordEvent as re, LIVE_ASPECTS as
|
|
8
|
+
import { useLiveRecord as ke, useLiveEvent as ee, useLiveRecordEvent as re, LIVE_ASPECTS as y, batchTouches as Se } from "../../lib/live.js";
|
|
9
9
|
import { useOptionalRealtime as Ne } from "../../lib/realtime.js";
|
|
10
10
|
import { useRecordTabsSignal as Re, useRecordTabs as Te } from "../../lib/record-tabs.js";
|
|
11
11
|
import { userErrorMessage as _e } from "../../lib/safe-error.js";
|
|
12
12
|
import { formatRelative as $e } from "../../lib/utils.js";
|
|
13
|
-
import { markLiveRecordWrite as
|
|
14
|
-
function
|
|
13
|
+
import { markLiveRecordWrite as Ke } from "./live-record-marks.js";
|
|
14
|
+
function Ee(e, r, u) {
|
|
15
15
|
var f;
|
|
16
16
|
if (u.active)
|
|
17
17
|
return { text: e ? `${e} moved this to ${r}` : `This record moved to ${r}` };
|
|
@@ -25,7 +25,7 @@ function De(e, r) {
|
|
|
25
25
|
const u = e == null ? void 0 : e.user_id;
|
|
26
26
|
return typeof u == "string" && !!r && u.toUpperCase() === String(r).toUpperCase();
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const Qe = 8e3, te = [
|
|
29
29
|
"item",
|
|
30
30
|
"rrv-record",
|
|
31
31
|
"revisions",
|
|
@@ -45,7 +45,7 @@ const Le = 8e3, te = [
|
|
|
45
45
|
"record-integrations",
|
|
46
46
|
"record-integrity"
|
|
47
47
|
];
|
|
48
|
-
function
|
|
48
|
+
function qe(e, r, u) {
|
|
49
49
|
const p = new Set(te), f = String(u);
|
|
50
50
|
e.removeQueries({
|
|
51
51
|
predicate: (c) => p.has(c.queryKey[0]) && c.queryKey[1] === r && String(c.queryKey[2]) === f
|
|
@@ -58,7 +58,7 @@ function Ge(e, r, u) {
|
|
|
58
58
|
predicate: (c) => p.has(c.queryKey[0]) && c.queryKey[1] === r && f.has(String(c.queryKey[2]))
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function Le({ onBack: e }) {
|
|
62
62
|
return /* @__PURE__ */ d("div", { className: "p-6", children: /* @__PURE__ */ m(
|
|
63
63
|
"div",
|
|
64
64
|
{
|
|
@@ -99,19 +99,19 @@ function Je({
|
|
|
99
99
|
loadDenied: p = !1,
|
|
100
100
|
onGoneChange: f
|
|
101
101
|
}) {
|
|
102
|
-
const c = Ne(), T = ve(),
|
|
102
|
+
const c = Ne(), T = ve(), b = ce(), [D, j] = w(!1), [Q, se] = w([]), [i, ne] = w(null), [ae, q] = w({}), [B, F] = w(!1), [P, Y] = w(!1), S = v(null), N = v(null), _ = v(Date.now()), L = v(null), $ = v(f);
|
|
103
103
|
$.current = f;
|
|
104
|
-
const x =
|
|
104
|
+
const x = v(null), W = ye(), H = v(W);
|
|
105
105
|
H.current = W;
|
|
106
106
|
const R = (s) => {
|
|
107
107
|
var t;
|
|
108
|
-
x.current = s, ne(s), (t = $.current) == null || t.call($, s), (s == null ? void 0 : s.kind) === "access" && setTimeout(() =>
|
|
108
|
+
x.current = s, ne(s), (t = $.current) == null || t.call($, s), (s == null ? void 0 : s.kind) === "access" && setTimeout(() => qe(b, e, r), 0);
|
|
109
109
|
};
|
|
110
110
|
k(() => {
|
|
111
|
-
_.current = Date.now(),
|
|
111
|
+
_.current = Date.now(), L.current = null, q({}), x.current && R(null);
|
|
112
112
|
}, [e, r]);
|
|
113
113
|
const l = (s) => {
|
|
114
|
-
for (const t of s)
|
|
114
|
+
for (const t of s) b.invalidateQueries({ queryKey: t });
|
|
115
115
|
}, A = async (s) => {
|
|
116
116
|
let t = null;
|
|
117
117
|
try {
|
|
@@ -121,8 +121,8 @@ function Je({
|
|
|
121
121
|
} catch {
|
|
122
122
|
t = null;
|
|
123
123
|
}
|
|
124
|
-
const
|
|
125
|
-
R(
|
|
124
|
+
const o = !!(t != null && t.deleted_at) && new Date(t.deleted_at).getTime() >= _.current - 6e4;
|
|
125
|
+
R(o || s === "deleted" && !t ? {
|
|
126
126
|
kind: "deleted",
|
|
127
127
|
by: (t == null ? void 0 : t.deleted_by_name) ?? null,
|
|
128
128
|
at: (t == null ? void 0 : t.deleted_at) ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -134,9 +134,9 @@ function Je({
|
|
|
134
134
|
try {
|
|
135
135
|
const t = (await T.request(
|
|
136
136
|
U(`/pipelines/instance/${e}/${r}`)
|
|
137
|
-
)).data,
|
|
138
|
-
if (!
|
|
139
|
-
const
|
|
137
|
+
)).data, o = (s = t == null ? void 0 : t.history) == null ? void 0 : s[0];
|
|
138
|
+
if (!o || o.id === L.current || o.timestamp && new Date(o.timestamp).getTime() < _.current - 5e3 || (L.current = o.id, typeof document < "u" && document.visibilityState === "hidden")) return;
|
|
139
|
+
const h = [o.first_name, o.last_name].filter(Boolean).join(" ") || o.user_email || null, a = o.to_state_label ?? "a new state", n = Ee(h, a, H.current);
|
|
140
140
|
O.info(
|
|
141
141
|
n.text,
|
|
142
142
|
n.open ? { action: { label: "Open", onClick: n.open } } : {}
|
|
@@ -144,40 +144,42 @@ function Je({
|
|
|
144
144
|
} catch {
|
|
145
145
|
}
|
|
146
146
|
}, ie = (s) => {
|
|
147
|
-
var
|
|
147
|
+
var o, h;
|
|
148
148
|
if (s.deleted) {
|
|
149
149
|
A("deleted");
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
152
|
if (x.current) return;
|
|
153
|
-
s.events.some((
|
|
154
|
-
const t = (
|
|
155
|
-
if (t(
|
|
153
|
+
s.events.some((a) => a.source === "import" && !a.own) && (Y(!0), S.current && clearTimeout(S.current), S.current = setTimeout(() => Y(!1), Qe));
|
|
154
|
+
const t = (a) => Se(s, a);
|
|
155
|
+
if (t(y.state) && (l([
|
|
156
156
|
["pipeline-instance", e, r],
|
|
157
157
|
["pipeline-all-owners", e, r],
|
|
158
158
|
["pipeline-instance-owners", e, r],
|
|
159
159
|
["pipeline-owners-resolved", e, r],
|
|
160
160
|
["approval-brief", e, r]
|
|
161
|
-
]), (
|
|
161
|
+
]), (o = s.changedFields) != null && o.includes(y.state) && oe()), t(y.addendums) && l([["addendums", e, r]]), t(y.comments) ? l([
|
|
162
162
|
["comments", e, r],
|
|
163
163
|
["comments-related", e, r]
|
|
164
|
-
]) : (t(
|
|
164
|
+
]) : (t(y.state) || t(y.integrations) || t(y.addendums) || !s.aspectsOnly) && l([["comments-related", e, r]]), t(y.tasks) && l([["tasks", e, r]]), t(y.integrations) && l([
|
|
165
165
|
["erp-submissions", e, r],
|
|
166
166
|
["record-integrations", e, r]
|
|
167
|
-
]),
|
|
168
|
-
predicate: (
|
|
167
|
+
]), b.invalidateQueries({
|
|
168
|
+
predicate: (a) => (a.queryKey[0] === "child-summary" || a.queryKey[0] === "field-lineage") && a.queryKey[1] === e && String(a.queryKey[2]) === String(r)
|
|
169
169
|
}), !s.aspectsOnly) {
|
|
170
|
-
if (s.ids.length > 0 && s.ids.every((
|
|
170
|
+
if (s.ids.length > 0 && s.ids.every((a) => a === "*")) {
|
|
171
171
|
l([
|
|
172
172
|
["item", e, r],
|
|
173
173
|
["pipeline-instance", e, r]
|
|
174
174
|
]);
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
|
-
|
|
177
|
+
b.invalidateQueries({
|
|
178
|
+
predicate: (a) => a.queryKey[0] === "o2m-rows" && String(a.queryKey[3]) === String(r) || a.queryKey[0] === "o2m-compare"
|
|
179
|
+
}), Ke(
|
|
178
180
|
e,
|
|
179
181
|
r,
|
|
180
|
-
((
|
|
182
|
+
((h = s.changedFields) == null ? void 0 : h.filter((a) => !a.startsWith("$"))) ?? null
|
|
181
183
|
), V(!0);
|
|
182
184
|
}
|
|
183
185
|
}, V = async (s) => {
|
|
@@ -189,12 +191,12 @@ function Je({
|
|
|
189
191
|
["revisions", e, r]
|
|
190
192
|
]);
|
|
191
193
|
const t = ["last-touch", e, String(r)];
|
|
192
|
-
await
|
|
193
|
-
}), !(!s || De(
|
|
194
|
+
await b.invalidateQueries({ queryKey: t }).catch(() => {
|
|
195
|
+
}), !(!s || De(b.getQueryData(t), z.current)) && (j(!0), N.current && clearTimeout(N.current), N.current = setTimeout(() => j(!1), 4e3));
|
|
194
196
|
};
|
|
195
197
|
ke(e, r, ie);
|
|
196
|
-
const { userId:
|
|
197
|
-
z.current =
|
|
198
|
+
const { userId: K } = xe(), z = v(K);
|
|
199
|
+
z.current = K, Re(K, "saved", e, r, () => {
|
|
198
200
|
x.current || (V(!1), l([
|
|
199
201
|
["pipeline-instance", e, r],
|
|
200
202
|
["comments", e, r],
|
|
@@ -225,21 +227,21 @@ function Je({
|
|
|
225
227
|
r,
|
|
226
228
|
() => l([["record-integrity", e, r]])
|
|
227
229
|
);
|
|
228
|
-
const G =
|
|
230
|
+
const G = v(/* @__PURE__ */ new Map());
|
|
229
231
|
re("record:automation", e, r, (s) => {
|
|
230
232
|
const t = String((s == null ? void 0 : s.flow_id) ?? "");
|
|
231
233
|
if (!t) return;
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
const { [t]:
|
|
234
|
+
const o = G.current, h = o.get(t);
|
|
235
|
+
h && clearTimeout(h), o.delete(t);
|
|
236
|
+
const a = () => q((n) => {
|
|
237
|
+
const { [t]: g, ...M } = n;
|
|
236
238
|
return M;
|
|
237
239
|
});
|
|
238
240
|
if ((s == null ? void 0 : s.state) === "end") {
|
|
239
|
-
|
|
241
|
+
a();
|
|
240
242
|
return;
|
|
241
243
|
}
|
|
242
|
-
|
|
244
|
+
q((n) => ({ ...n, [t]: String((s == null ? void 0 : s.flow_name) || "An automation") })), o.set(t, setTimeout(a, 5 * 6e4));
|
|
243
245
|
}), k(() => {
|
|
244
246
|
const s = G.current;
|
|
245
247
|
return () => {
|
|
@@ -256,8 +258,8 @@ function Je({
|
|
|
256
258
|
var t;
|
|
257
259
|
((t = x.current) == null ? void 0 : t.kind) === "access" && (R(null), l([["item", e, r]]));
|
|
258
260
|
}).catch((t) => {
|
|
259
|
-
const
|
|
260
|
-
(
|
|
261
|
+
const o = Ae(t);
|
|
262
|
+
(o === 403 || o === 404) && A("access");
|
|
261
263
|
});
|
|
262
264
|
},
|
|
263
265
|
Math.floor(Math.random() * 1500)
|
|
@@ -267,49 +269,49 @@ function Je({
|
|
|
267
269
|
), k(() => {
|
|
268
270
|
p && !x.current && A("access");
|
|
269
271
|
}, [p]);
|
|
270
|
-
const
|
|
272
|
+
const E = Te(e, r, u, K), [de, J] = w(!1);
|
|
271
273
|
k(() => {
|
|
272
|
-
|
|
273
|
-
}, [
|
|
274
|
+
E.otherDirty || J(!1);
|
|
275
|
+
}, [E.otherDirty]), k(() => {
|
|
274
276
|
if (!c) return;
|
|
275
277
|
const s = (n) => {
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
+
const g = n.detail;
|
|
279
|
+
g != null && g.name && c.emit("record:uploading", {
|
|
278
280
|
collection: e,
|
|
279
281
|
item: String(r),
|
|
280
|
-
name:
|
|
281
|
-
state:
|
|
282
|
+
name: g.name,
|
|
283
|
+
state: g.state
|
|
282
284
|
});
|
|
283
285
|
};
|
|
284
286
|
window.addEventListener("nvr:upload-state", s);
|
|
285
287
|
const t = (n) => {
|
|
286
288
|
if ((n == null ? void 0 : n.collection) !== e || String(n == null ? void 0 : n.item) !== String(r)) return;
|
|
287
|
-
const
|
|
289
|
+
const g = String(n.user_name ?? n.user ?? "Someone");
|
|
288
290
|
se((M) => {
|
|
289
|
-
const Z = M.filter((I) => !(I.user ===
|
|
290
|
-
return n.state === "start" ? [...Z, { user:
|
|
291
|
+
const Z = M.filter((I) => !(I.user === g && I.name === n.name));
|
|
292
|
+
return n.state === "start" ? [...Z, { user: g, name: String(n.name) }] : Z;
|
|
291
293
|
});
|
|
292
|
-
},
|
|
293
|
-
(n == null ? void 0 : n.collection) !== e || String(n == null ? void 0 : n.item) !== String(r) || (
|
|
294
|
-
}),
|
|
295
|
-
return window.addEventListener("nvr:record-uploading",
|
|
296
|
-
window.removeEventListener("nvr:upload-state", s), window.removeEventListener("nvr:record-uploading",
|
|
294
|
+
}, o = c.on("record:uploading", t), h = c.on("record:comment", (n) => {
|
|
295
|
+
(n == null ? void 0 : n.collection) !== e || String(n == null ? void 0 : n.item) !== String(r) || (b.invalidateQueries({ queryKey: ["comments", e, r] }), b.invalidateQueries({ queryKey: ["comments-related", e, r] }));
|
|
296
|
+
}), a = (n) => t(n.detail);
|
|
297
|
+
return window.addEventListener("nvr:record-uploading", a), () => {
|
|
298
|
+
window.removeEventListener("nvr:upload-state", s), window.removeEventListener("nvr:record-uploading", a), o(), h();
|
|
297
299
|
};
|
|
298
|
-
}, [c, e, r,
|
|
300
|
+
}, [c, e, r, b]);
|
|
299
301
|
const ue = async () => {
|
|
300
|
-
if (
|
|
302
|
+
if (i != null && i.trashId) {
|
|
301
303
|
F(!0);
|
|
302
304
|
try {
|
|
303
|
-
await T.request(we(`/trash/${
|
|
305
|
+
await T.request(we(`/trash/${i.trashId}/restore`, {})), R(null), _.current = Date.now(), l([["item", e, r]]), O.success("Record restored");
|
|
304
306
|
} catch (s) {
|
|
305
307
|
O.error(_e(s, "Restore failed"));
|
|
306
308
|
} finally {
|
|
307
309
|
F(!1);
|
|
308
310
|
}
|
|
309
311
|
}
|
|
310
|
-
}, C = Object.values(ae), X =
|
|
311
|
-
return !
|
|
312
|
-
(
|
|
312
|
+
}, C = Object.values(ae), X = E.otherDirty && !de && !u && !i;
|
|
313
|
+
return !i && C.length === 0 && !X && !P && (!c || !D && Q.length === 0) ? null : /* @__PURE__ */ m("div", { className: "space-y-2", children: [
|
|
314
|
+
(i == null ? void 0 : i.kind) === "deleted" && /* @__PURE__ */ m(
|
|
313
315
|
"div",
|
|
314
316
|
{
|
|
315
317
|
"data-record-gone": "deleted",
|
|
@@ -319,12 +321,12 @@ function Je({
|
|
|
319
321
|
/* @__PURE__ */ d(fe, { className: "h-4 w-4 shrink-0 text-rose-500" }),
|
|
320
322
|
/* @__PURE__ */ m("p", { className: "min-w-0 flex-1 text-[12px] text-rose-800 dark:text-rose-300", children: [
|
|
321
323
|
/* @__PURE__ */ d("span", { className: "font-semibold", children: "This record was deleted" }),
|
|
322
|
-
|
|
323
|
-
|
|
324
|
+
i.by ? ` by ${i.by}` : "",
|
|
325
|
+
i.at ? ` ${$e(i.at)}` : "",
|
|
324
326
|
". Saving is turned off",
|
|
325
|
-
|
|
327
|
+
i.canRestore ? " — restore it to keep working." : "."
|
|
326
328
|
] }),
|
|
327
|
-
|
|
329
|
+
i.canRestore && i.trashId != null && /* @__PURE__ */ d(
|
|
328
330
|
"button",
|
|
329
331
|
{
|
|
330
332
|
type: "button",
|
|
@@ -337,7 +339,7 @@ function Je({
|
|
|
337
339
|
]
|
|
338
340
|
}
|
|
339
341
|
),
|
|
340
|
-
(
|
|
342
|
+
(i == null ? void 0 : i.kind) === "access" && !f && /* @__PURE__ */ d(Le, { onBack: () => window.history.back() }),
|
|
341
343
|
X && /* @__PURE__ */ m(
|
|
342
344
|
"div",
|
|
343
345
|
{
|
|
@@ -350,7 +352,7 @@ function Je({
|
|
|
350
352
|
"button",
|
|
351
353
|
{
|
|
352
354
|
type: "button",
|
|
353
|
-
onClick:
|
|
355
|
+
onClick: E.focusOther,
|
|
354
356
|
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",
|
|
355
357
|
children: "Switch to that tab"
|
|
356
358
|
}
|
|
@@ -367,7 +369,7 @@ function Je({
|
|
|
367
369
|
]
|
|
368
370
|
}
|
|
369
371
|
),
|
|
370
|
-
P && !
|
|
372
|
+
P && !i && /* @__PURE__ */ m(
|
|
371
373
|
"div",
|
|
372
374
|
{
|
|
373
375
|
"data-record-importing": !0,
|
|
@@ -383,7 +385,7 @@ function Je({
|
|
|
383
385
|
]
|
|
384
386
|
}
|
|
385
387
|
),
|
|
386
|
-
C.length > 0 && !
|
|
388
|
+
C.length > 0 && !i && /* @__PURE__ */ m(
|
|
387
389
|
"div",
|
|
388
390
|
{
|
|
389
391
|
"data-record-automation": !0,
|
|
@@ -401,12 +403,12 @@ function Je({
|
|
|
401
403
|
]
|
|
402
404
|
}
|
|
403
405
|
),
|
|
404
|
-
c && (D ||
|
|
406
|
+
c && (D || Q.length > 0) && /* @__PURE__ */ m("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
405
407
|
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
408
|
/* @__PURE__ */ d("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
|
|
407
409
|
"Updated just now by someone else"
|
|
408
410
|
] }),
|
|
409
|
-
|
|
411
|
+
Q.map((s) => /* @__PURE__ */ m(
|
|
410
412
|
"span",
|
|
411
413
|
{
|
|
412
414
|
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",
|
|
@@ -425,10 +427,10 @@ function Je({
|
|
|
425
427
|
}
|
|
426
428
|
export {
|
|
427
429
|
te as RECORD_QUERY_HEADS,
|
|
428
|
-
|
|
430
|
+
Le as RecordAccessLostPanel,
|
|
429
431
|
Je as RecordLiveSync,
|
|
430
432
|
Ge as invalidateRecordQueries,
|
|
431
|
-
|
|
432
|
-
|
|
433
|
+
Ee as moveNotice,
|
|
434
|
+
qe as purgeRecordQueries,
|
|
433
435
|
De as writtenBySelf
|
|
434
436
|
};
|