@nivaro/react 0.3.73 → 0.3.75
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/hooks/useSessionRecorder.js +1 -1
- package/dist/shared/components/CollectionBrowserView.js +2490 -2399
- package/dist/shared/components/DataTable.js +315 -289
- package/dist/shared/components/RecordReadView.js +661 -573
- package/dist/shared/components/item-edit/RecordLiveSync.js +46 -46
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +183 -165
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +47 -46
- package/dist/shared/lib/record-loader.js +30 -24
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as d, jsxs as m } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as ce } from "@tanstack/react-query";
|
|
3
|
-
import { EyeOff as me, ArrowLeft as le, Trash2 as
|
|
3
|
+
import { EyeOff as me, ArrowLeft as le, Trash2 as pe, Copy as fe, FileUp as be, Bot as he, UploadCloud as ge } from "lucide-react";
|
|
4
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";
|
|
@@ -12,12 +12,12 @@ import { userErrorMessage as _e } from "../../lib/safe-error.js";
|
|
|
12
12
|
import { formatRelative as $e } from "../../lib/utils.js";
|
|
13
13
|
import { markLiveRecordWrite as Ke } from "./live-record-marks.js";
|
|
14
14
|
function Ee(e, r, u) {
|
|
15
|
-
var
|
|
15
|
+
var p;
|
|
16
16
|
if (u.active)
|
|
17
17
|
return { text: e ? `${e} moved this to ${r}` : `This record moved to ${r}` };
|
|
18
|
-
const
|
|
18
|
+
const f = ((p = u.label) == null ? void 0 : p.trim()) || "A record in your tabs";
|
|
19
19
|
return {
|
|
20
|
-
text: e ? `${e} moved ${
|
|
20
|
+
text: e ? `${e} moved ${f} to ${r}` : `${f} moved to ${r}`,
|
|
21
21
|
open: u.open
|
|
22
22
|
};
|
|
23
23
|
}
|
|
@@ -49,16 +49,16 @@ const Qe = 8e3, te = [
|
|
|
49
49
|
"ext-item-actions"
|
|
50
50
|
];
|
|
51
51
|
function qe(e, r, u) {
|
|
52
|
-
const
|
|
52
|
+
const f = new Set(te), p = String(u);
|
|
53
53
|
e.removeQueries({
|
|
54
|
-
predicate: (c) =>
|
|
54
|
+
predicate: (c) => f.has(c.queryKey[0]) && c.queryKey[1] === r && String(c.queryKey[2]) === p
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
function Ge(e, r, u) {
|
|
58
58
|
if (!r || u.length === 0) return;
|
|
59
|
-
const
|
|
59
|
+
const f = new Set(te), p = new Set(u.map(String));
|
|
60
60
|
e.invalidateQueries({
|
|
61
|
-
predicate: (c) =>
|
|
61
|
+
predicate: (c) => f.has(c.queryKey[0]) && c.queryKey[1] === r && p.has(String(c.queryKey[2]))
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
function Le({ onBack: e }) {
|
|
@@ -99,16 +99,16 @@ function Je({
|
|
|
99
99
|
collection: e,
|
|
100
100
|
itemId: r,
|
|
101
101
|
dirty: u = !1,
|
|
102
|
-
loadDenied:
|
|
103
|
-
onGoneChange:
|
|
102
|
+
loadDenied: f = !1,
|
|
103
|
+
onGoneChange: p
|
|
104
104
|
}) {
|
|
105
|
-
const c = Ne(), T = ve(), b = ce(), [D, j] = w(!1), [Q, se] = w([]), [i,
|
|
106
|
-
$.current =
|
|
105
|
+
const c = Ne(), T = ve(), b = ce(), [D, j] = w(!1), [Q, se] = w([]), [i, ae] = w(null), [ne, q] = w({}), [B, F] = w(!1), [P, Y] = w(!1), S = v(null), N = v(null), _ = v(Date.now()), L = v(null), $ = v(p);
|
|
106
|
+
$.current = p;
|
|
107
107
|
const x = v(null), W = ye(), H = v(W);
|
|
108
108
|
H.current = W;
|
|
109
109
|
const R = (s) => {
|
|
110
110
|
var t;
|
|
111
|
-
x.current = s,
|
|
111
|
+
x.current = s, ae(s), (t = $.current) == null || t.call($, s), (s == null ? void 0 : s.kind) === "access" && setTimeout(() => qe(b, e, r), 0);
|
|
112
112
|
};
|
|
113
113
|
k(() => {
|
|
114
114
|
_.current = Date.now(), L.current = null, q({}), x.current && R(null);
|
|
@@ -139,10 +139,10 @@ function Je({
|
|
|
139
139
|
U(`/pipelines/instance/${e}/${r}`)
|
|
140
140
|
)).data, o = (s = t == null ? void 0 : t.history) == null ? void 0 : s[0];
|
|
141
141
|
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;
|
|
142
|
-
const h = [o.first_name, o.last_name].filter(Boolean).join(" ") || o.user_email || null,
|
|
142
|
+
const h = [o.first_name, o.last_name].filter(Boolean).join(" ") || o.user_email || null, n = o.to_state_label ?? "a new state", a = Ee(h, n, H.current);
|
|
143
143
|
O.info(
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
a.text,
|
|
145
|
+
a.open ? { action: { label: "Open", onClick: a.open } } : {}
|
|
146
146
|
);
|
|
147
147
|
} catch {
|
|
148
148
|
}
|
|
@@ -153,8 +153,8 @@ function Je({
|
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
155
|
if (x.current) return;
|
|
156
|
-
s.events.some((
|
|
157
|
-
const t = (
|
|
156
|
+
s.events.some((n) => n.source === "import" && !n.own) && (Y(!0), S.current && clearTimeout(S.current), S.current = setTimeout(() => Y(!1), Qe));
|
|
157
|
+
const t = (n) => Se(s, n);
|
|
158
158
|
if (t(y.state) && (l([
|
|
159
159
|
["pipeline-instance", e, r],
|
|
160
160
|
["pipeline-all-owners", e, r],
|
|
@@ -168,9 +168,9 @@ function Je({
|
|
|
168
168
|
["erp-submissions", e, r],
|
|
169
169
|
["record-integrations", e, r]
|
|
170
170
|
]), b.invalidateQueries({
|
|
171
|
-
predicate: (
|
|
171
|
+
predicate: (n) => (n.queryKey[0] === "child-summary" || n.queryKey[0] === "field-lineage") && n.queryKey[1] === e && String(n.queryKey[2]) === String(r)
|
|
172
172
|
}), !s.aspectsOnly) {
|
|
173
|
-
if (s.ids.length > 0 && s.ids.every((
|
|
173
|
+
if (s.ids.length > 0 && s.ids.every((n) => n === "*")) {
|
|
174
174
|
l([
|
|
175
175
|
["item", e, r],
|
|
176
176
|
["pipeline-instance", e, r]
|
|
@@ -178,11 +178,11 @@ function Je({
|
|
|
178
178
|
return;
|
|
179
179
|
}
|
|
180
180
|
b.invalidateQueries({
|
|
181
|
-
predicate: (
|
|
181
|
+
predicate: (n) => n.queryKey[0] === "o2m-rows" && String(n.queryKey[3]) === String(r) || n.queryKey[0] === "o2m-compare"
|
|
182
182
|
}), Ke(
|
|
183
183
|
e,
|
|
184
184
|
r,
|
|
185
|
-
((h = s.changedFields) == null ? void 0 : h.filter((
|
|
185
|
+
((h = s.changedFields) == null ? void 0 : h.filter((n) => !n.startsWith("$"))) ?? null
|
|
186
186
|
), V(!0);
|
|
187
187
|
}
|
|
188
188
|
}, V = async (s) => {
|
|
@@ -236,15 +236,15 @@ function Je({
|
|
|
236
236
|
if (!t) return;
|
|
237
237
|
const o = G.current, h = o.get(t);
|
|
238
238
|
h && clearTimeout(h), o.delete(t);
|
|
239
|
-
const
|
|
240
|
-
const { [t]: g, ...M } =
|
|
239
|
+
const n = () => q((a) => {
|
|
240
|
+
const { [t]: g, ...M } = a;
|
|
241
241
|
return M;
|
|
242
242
|
});
|
|
243
243
|
if ((s == null ? void 0 : s.state) === "end") {
|
|
244
|
-
|
|
244
|
+
n();
|
|
245
245
|
return;
|
|
246
246
|
}
|
|
247
|
-
q((
|
|
247
|
+
q((a) => ({ ...a, [t]: String((s == null ? void 0 : s.flow_name) || "An automation") })), o.set(t, setTimeout(n, 5 * 6e4));
|
|
248
248
|
}), k(() => {
|
|
249
249
|
const s = G.current;
|
|
250
250
|
return () => {
|
|
@@ -270,15 +270,15 @@ function Je({
|
|
|
270
270
|
},
|
|
271
271
|
{ debounceMs: 300 }
|
|
272
272
|
), k(() => {
|
|
273
|
-
|
|
274
|
-
}, [
|
|
273
|
+
f && !x.current && A("access");
|
|
274
|
+
}, [f]);
|
|
275
275
|
const E = Te(e, r, u, K), [de, J] = w(!1);
|
|
276
276
|
k(() => {
|
|
277
277
|
E.otherDirty || J(!1);
|
|
278
278
|
}, [E.otherDirty]), k(() => {
|
|
279
279
|
if (!c) return;
|
|
280
|
-
const s = (
|
|
281
|
-
const g =
|
|
280
|
+
const s = (a) => {
|
|
281
|
+
const g = a.detail;
|
|
282
282
|
g != null && g.name && c.emit("record:uploading", {
|
|
283
283
|
collection: e,
|
|
284
284
|
item: String(r),
|
|
@@ -287,18 +287,18 @@ function Je({
|
|
|
287
287
|
});
|
|
288
288
|
};
|
|
289
289
|
window.addEventListener("nvr:upload-state", s);
|
|
290
|
-
const t = (
|
|
291
|
-
if ((
|
|
292
|
-
const g = String(
|
|
290
|
+
const t = (a) => {
|
|
291
|
+
if ((a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(r)) return;
|
|
292
|
+
const g = String(a.user_name ?? a.user ?? "Someone");
|
|
293
293
|
se((M) => {
|
|
294
|
-
const Z = M.filter((I) => !(I.user === g && I.name ===
|
|
295
|
-
return
|
|
294
|
+
const Z = M.filter((I) => !(I.user === g && I.name === a.name));
|
|
295
|
+
return a.state === "start" ? [...Z, { user: g, name: String(a.name) }] : Z;
|
|
296
296
|
});
|
|
297
|
-
}, o = c.on("record:uploading", t), h = c.on("record:comment", (
|
|
298
|
-
(
|
|
299
|
-
}),
|
|
300
|
-
return window.addEventListener("nvr:record-uploading",
|
|
301
|
-
window.removeEventListener("nvr:upload-state", s), window.removeEventListener("nvr:record-uploading",
|
|
297
|
+
}, o = c.on("record:uploading", t), h = c.on("record:comment", (a) => {
|
|
298
|
+
(a == null ? void 0 : a.collection) !== e || String(a == null ? void 0 : a.item) !== String(r) || (b.invalidateQueries({ queryKey: ["comments", e, r] }), b.invalidateQueries({ queryKey: ["comments-related", e, r] }));
|
|
299
|
+
}), n = (a) => t(a.detail);
|
|
300
|
+
return window.addEventListener("nvr:record-uploading", n), () => {
|
|
301
|
+
window.removeEventListener("nvr:upload-state", s), window.removeEventListener("nvr:record-uploading", n), o(), h();
|
|
302
302
|
};
|
|
303
303
|
}, [c, e, r, b]);
|
|
304
304
|
const ue = async () => {
|
|
@@ -312,7 +312,7 @@ function Je({
|
|
|
312
312
|
F(!1);
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
|
-
}, C = Object.values(
|
|
315
|
+
}, C = Object.values(ne), X = E.otherDirty && !de && !u && !i;
|
|
316
316
|
return !i && C.length === 0 && !X && !P && (!c || !D && Q.length === 0) ? null : /* @__PURE__ */ m("div", { className: "space-y-2", children: [
|
|
317
317
|
(i == null ? void 0 : i.kind) === "deleted" && /* @__PURE__ */ m(
|
|
318
318
|
"div",
|
|
@@ -321,7 +321,7 @@ function Je({
|
|
|
321
321
|
role: "alert",
|
|
322
322
|
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",
|
|
323
323
|
children: [
|
|
324
|
-
/* @__PURE__ */ d(
|
|
324
|
+
/* @__PURE__ */ d(pe, { className: "h-4 w-4 shrink-0 text-rose-500" }),
|
|
325
325
|
/* @__PURE__ */ m("p", { className: "min-w-0 flex-1 text-[12px] text-rose-800 dark:text-rose-300", children: [
|
|
326
326
|
/* @__PURE__ */ d("span", { className: "font-semibold", children: "This record was deleted" }),
|
|
327
327
|
i.by ? ` by ${i.by}` : "",
|
|
@@ -342,14 +342,14 @@ function Je({
|
|
|
342
342
|
]
|
|
343
343
|
}
|
|
344
344
|
),
|
|
345
|
-
(i == null ? void 0 : i.kind) === "access" && !
|
|
345
|
+
(i == null ? void 0 : i.kind) === "access" && !p && /* @__PURE__ */ d(Le, { onBack: () => window.history.back() }),
|
|
346
346
|
X && /* @__PURE__ */ m(
|
|
347
347
|
"div",
|
|
348
348
|
{
|
|
349
349
|
"data-record-other-tab": !0,
|
|
350
350
|
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",
|
|
351
351
|
children: [
|
|
352
|
-
/* @__PURE__ */ d(
|
|
352
|
+
/* @__PURE__ */ d(fe, { className: "h-4 w-4 shrink-0 text-amber-500" }),
|
|
353
353
|
/* @__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." }),
|
|
354
354
|
/* @__PURE__ */ d(
|
|
355
355
|
"button",
|
|
@@ -396,7 +396,7 @@ function Je({
|
|
|
396
396
|
className: "flex items-center gap-3 rounded-lg border border-nvr-cyan/40 bg-nvr-cyan/10 px-3.5 py-2.5",
|
|
397
397
|
children: [
|
|
398
398
|
/* @__PURE__ */ d(he, { className: "h-4 w-4 shrink-0 animate-pulse text-nvr-cyan" }),
|
|
399
|
-
/* @__PURE__ */ m("p", { className: "min-w-0 flex-1 text-[12px] text-[#0e7490] dark:text-
|
|
399
|
+
/* @__PURE__ */ m("p", { className: "min-w-0 flex-1 text-[12px] text-[#0e7490] dark:text-slate-200", children: [
|
|
400
400
|
/* @__PURE__ */ d("span", { className: "font-semibold", children: "Automation is updating this record" }),
|
|
401
401
|
" —",
|
|
402
402
|
" ",
|
|
@@ -407,7 +407,7 @@ function Je({
|
|
|
407
407
|
}
|
|
408
408
|
),
|
|
409
409
|
c && (D || Q.length > 0) && /* @__PURE__ */ m("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
410
|
-
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-
|
|
410
|
+
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-slate-200", children: [
|
|
411
411
|
/* @__PURE__ */ d("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
|
|
412
412
|
"Updated just now by someone else"
|
|
413
413
|
] }),
|