@nivaro/react 0.3.56 → 0.3.57
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/index.d.ts +4 -1
- package/dist/shared/components/CollectionBrowserView.js +2521 -2487
- package/dist/shared/components/queue/QueueItemSheet.js +111 -111
- package/dist/shared/components/queue/QueueWorklist.js +923 -911
- package/dist/shared/components/queue/live-state-aspect.js +7 -3
- package/dist/shared/components/queue/path-label.js +14 -0
- package/dist/shared/lib/cbv-page-warm.js +36 -0
- package/dist/shared/lib/record-ref.js +78 -53
- package/package.json +1 -1
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
function r(
|
|
2
|
-
return
|
|
1
|
+
function r(e, t) {
|
|
2
|
+
return e || t ? { refresh: !0, pill: 0, stats: !0 } : { refresh: !1, pill: 1, stats: !0 };
|
|
3
|
+
}
|
|
4
|
+
function l(e) {
|
|
5
|
+
return !e.table || e.busy || typeof e.liveTotal != "number" || typeof e.rowsTotal != "number" ? !1 : e.liveTotal !== e.rowsTotal;
|
|
3
6
|
}
|
|
4
7
|
export {
|
|
5
|
-
r as stateAspectEffect
|
|
8
|
+
r as stateAspectEffect,
|
|
9
|
+
l as statsOutrunRows
|
|
6
10
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const s = /* @__PURE__ */ new Set(["id", "name", "title", "label", "type", "code", "display_name"]);
|
|
2
|
+
function n(t) {
|
|
3
|
+
return t.replace(/_/g, " ").trim().replace(/\b\w/g, (e) => e.toUpperCase()).replace(/\bId\b/g, "ID");
|
|
4
|
+
}
|
|
5
|
+
function i(t) {
|
|
6
|
+
const e = t.split(".").filter(Boolean);
|
|
7
|
+
if (e.length === 0) return t;
|
|
8
|
+
if (e.length === 1) return n(e[0]);
|
|
9
|
+
const r = e[e.length - 1], o = e[e.length - 2], a = e.slice(0, -1);
|
|
10
|
+
return s.has(r.toLowerCase()) ? a.map(n).join(" → ") : r.toLowerCase().startsWith(`${o.toLowerCase()}_`) ? [...e.slice(0, -2), r].map(n).join(" → ") : e.map(n).join(" → ");
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
i as pathHeader
|
|
14
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const a = (e) => e.startsWith("directus_") || e.startsWith("nivaro_");
|
|
2
|
+
function d(e) {
|
|
3
|
+
var f;
|
|
4
|
+
const { qc: r, collection: l, rows: c } = e;
|
|
5
|
+
if (c.length !== 0) {
|
|
6
|
+
if (e.resolveList.length > 0) {
|
|
7
|
+
const i = c.map((n) => String(n.id)).join(",");
|
|
8
|
+
r.prefetchQuery({
|
|
9
|
+
queryKey: ["cbv-resolved", l, i, e.resolveList.join(",")],
|
|
10
|
+
queryFn: () => e.fetchResolved(i),
|
|
11
|
+
staleTime: 3e4
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
for (const i of e.columns) {
|
|
15
|
+
if (e.isResolvedCol(i)) continue;
|
|
16
|
+
const n = (f = e.relations.find(
|
|
17
|
+
(o) => o.many_collection === l && o.many_field === i && o.one_collection
|
|
18
|
+
)) == null ? void 0 : f.one_collection;
|
|
19
|
+
if (!n) continue;
|
|
20
|
+
const u = /* @__PURE__ */ new Set();
|
|
21
|
+
for (const o of c) {
|
|
22
|
+
const s = o[i];
|
|
23
|
+
if (s == null || s === "") continue;
|
|
24
|
+
const t = String(s);
|
|
25
|
+
u.has(t) || (u.add(t), n === "nivaro_users" ? r.prefetchQuery({ ...e.userCardQuery(t), staleTime: 12e4 }) : a(n) || r.prefetchQuery({
|
|
26
|
+
queryKey: ["cbv-relation-item", n, t],
|
|
27
|
+
queryFn: () => e.fetchRelation(n, t),
|
|
28
|
+
staleTime: 30 * 6e4
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
d as warmPageLookups
|
|
36
|
+
};
|
|
@@ -1,81 +1,106 @@
|
|
|
1
|
-
import { get as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
return typeof
|
|
1
|
+
import { get as y } from "./commands.js";
|
|
2
|
+
const s = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
3
|
+
function d(e) {
|
|
4
|
+
const n = e == null ? void 0 : e.friendly_id_field;
|
|
5
|
+
return typeof n == "string" && n !== "id" && s.test(n) ? n : null;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
if (
|
|
9
|
-
const
|
|
10
|
-
return
|
|
7
|
+
function f(e) {
|
|
8
|
+
if (e == null || typeof e == "object") return null;
|
|
9
|
+
const n = String(e).trim();
|
|
10
|
+
return n === "" ? null : n;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
return
|
|
12
|
+
function a(e, n) {
|
|
13
|
+
const t = d(e);
|
|
14
|
+
return t && n ? f(n[t]) : null;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const g = ["title", "name", "label", "subject", "description"];
|
|
17
|
+
function p(e) {
|
|
18
|
+
const n = String(e || "record").replace(/^nivaro_/, "").replace(/_/g, " ").trim().toLowerCase();
|
|
19
|
+
return /ies$/.test(n) ? `${n.slice(0, -3)}y` : /[^s]s$/.test(n) ? n.slice(0, -1) : n || "record";
|
|
20
|
+
}
|
|
21
|
+
function b(e, n, t, r) {
|
|
22
|
+
var c;
|
|
23
|
+
const i = a(e, n);
|
|
24
|
+
if (i) return i;
|
|
25
|
+
if ((t == null || t === "") && !n) return "";
|
|
26
|
+
const l = `No ${p(r)} number`, u = n ? (c = g.map((o) => f(n[o])).find((o) => o != null)) == null ? void 0 : c.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim() : void 0;
|
|
27
|
+
return u ? `${l} · ${u.length > 60 ? `${u.slice(0, 59)}…` : u}` : l;
|
|
28
|
+
}
|
|
29
|
+
function m(e) {
|
|
30
|
+
const n = e == null ? void 0 : e.url_alias_fields;
|
|
31
|
+
let t = n;
|
|
32
|
+
if (typeof n == "string")
|
|
20
33
|
try {
|
|
21
|
-
|
|
34
|
+
t = JSON.parse(n);
|
|
22
35
|
} catch {
|
|
23
|
-
|
|
36
|
+
t = [];
|
|
24
37
|
}
|
|
25
|
-
return Array.isArray(
|
|
38
|
+
return Array.isArray(t) ? t.filter((r) => typeof r == "string" && s.test(r)) : [];
|
|
26
39
|
}
|
|
27
|
-
function
|
|
28
|
-
if (!
|
|
29
|
-
const
|
|
30
|
-
let
|
|
31
|
-
if (
|
|
32
|
-
const i =
|
|
40
|
+
function S(e, n) {
|
|
41
|
+
if (!n) return null;
|
|
42
|
+
const t = m(e);
|
|
43
|
+
let r;
|
|
44
|
+
if (t.length > 0) {
|
|
45
|
+
const i = t.map((l) => f(n[l]));
|
|
33
46
|
if (i.some((l) => l == null)) return null;
|
|
34
|
-
|
|
47
|
+
r = i.join("-");
|
|
35
48
|
} else
|
|
36
|
-
|
|
37
|
-
return !
|
|
49
|
+
r = a(e, n);
|
|
50
|
+
return !r || /^\d+$/.test(r) || /^[0-9a-f]{8}-[0-9a-f]{4}-/i.test(r) || r === "new" || r.includes("/") ? null : r;
|
|
38
51
|
}
|
|
39
|
-
async function
|
|
40
|
-
var
|
|
41
|
-
const l =
|
|
52
|
+
async function I(e, n, t, r, i) {
|
|
53
|
+
var u;
|
|
54
|
+
const l = S(t, r);
|
|
42
55
|
if (!l) return String(i);
|
|
43
56
|
try {
|
|
44
|
-
const
|
|
45
|
-
|
|
57
|
+
const c = await e.request(
|
|
58
|
+
y(`/items/${n}/by-slug/${encodeURIComponent(l)}`, { fields: "id" })
|
|
46
59
|
);
|
|
47
|
-
return String(((
|
|
60
|
+
return String(((u = c == null ? void 0 : c.data) == null ? void 0 : u.id) ?? "") === String(i) ? l : String(i);
|
|
48
61
|
} catch {
|
|
49
62
|
return String(i);
|
|
50
63
|
}
|
|
51
64
|
}
|
|
52
|
-
async function
|
|
53
|
-
const
|
|
54
|
-
if (!
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
65
|
+
async function _(e) {
|
|
66
|
+
const n = typeof navigator < "u" ? navigator.clipboard : void 0;
|
|
67
|
+
if (!n) return;
|
|
68
|
+
const t = globalThis.ClipboardItem;
|
|
69
|
+
if (t && typeof n.write == "function")
|
|
57
70
|
try {
|
|
58
|
-
await
|
|
59
|
-
new
|
|
71
|
+
await n.write([
|
|
72
|
+
new t({ "text/plain": e.then((r) => new Blob([r], { type: "text/plain" })) })
|
|
60
73
|
]);
|
|
61
74
|
return;
|
|
62
75
|
} catch {
|
|
63
76
|
}
|
|
64
|
-
await
|
|
77
|
+
await n.writeText(await e);
|
|
78
|
+
}
|
|
79
|
+
function $(e) {
|
|
80
|
+
return /^No [\w ]+ number( · |$)/.test(String(e ?? ""));
|
|
65
81
|
}
|
|
66
|
-
function
|
|
67
|
-
|
|
82
|
+
function h(e) {
|
|
83
|
+
const n = String(e.label ?? "").trim();
|
|
84
|
+
return !n || $(n) ? null : n;
|
|
68
85
|
}
|
|
69
|
-
function
|
|
70
|
-
const
|
|
71
|
-
return
|
|
86
|
+
function N(e) {
|
|
87
|
+
const n = String(e.label ?? "").trim();
|
|
88
|
+
if (n) return { copy: h({ label: n }), name: n };
|
|
89
|
+
const t = a(e.meta, e.row);
|
|
90
|
+
return t ? { copy: t, name: t } : e.meta ? d(e.meta) ? {
|
|
91
|
+
copy: null,
|
|
92
|
+
name: b(e.meta, e.row, e.id, e.collection)
|
|
93
|
+
} : { copy: String(e.id), name: String(e.id) } : { copy: null, name: "this record" };
|
|
72
94
|
}
|
|
73
95
|
export {
|
|
74
|
-
|
|
96
|
+
S as aliasSegmentOf,
|
|
75
97
|
h as copyIdText,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
98
|
+
_ as copyWhenReady,
|
|
99
|
+
d as friendlyIdFieldOf,
|
|
100
|
+
a as friendlyIdOf,
|
|
101
|
+
$ as isNoNumberLabel,
|
|
102
|
+
p as recordNoun,
|
|
103
|
+
b as recordRefLabel,
|
|
104
|
+
N as rowMenuRef,
|
|
105
|
+
I as shareableRecordId
|
|
81
106
|
};
|