@nivaro/react 0.3.122 → 0.3.124
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 +10 -0
- package/dist/shared/components/CollectionBrowserView.js +93 -91
- package/dist/shared/components/DataTable.js +240 -228
- package/dist/shared/components/ItemEditForm.js +2712 -2696
- package/dist/shared/components/RecordReadView.js +1 -1
- package/dist/shared/components/TipLayer.js +86 -63
- package/dist/shared/components/integrations/IntegrationDots.js +1 -0
- package/dist/shared/components/item-edit/HeaderRollupExplainer.js +156 -119
- package/dist/shared/components/item-edit/InlineGridField.js +1 -1
- package/dist/shared/components/item-edit/M2MCombobox.js +387 -376
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +154 -179
- package/dist/shared/components/item-edit/UserChip.js +248 -232
- package/dist/shared/components/item-edit/cascade-clear-notice.js +49 -41
- package/dist/shared/components/item-edit/staged-links.js +38 -37
- package/dist/shared/components/panels/PipelinePanel.js +252 -243
- package/dist/shared/components/panels/RevisionsPanel.js +1788 -662
- package/dist/shared/components/panels/revision-changes.js +229 -0
- package/dist/shared/components/panels/revision-table-parts.js +448 -0
- package/dist/shared/lib/activity-sentence.js +74 -68
- package/dist/shared/lib/editorjs.js +68 -0
- package/dist/shared/lib/error-hints.js +1 -1
- package/dist/shared/lib/revision-prefs.js +81 -0
- package/dist/shared/lib/xlsx-lite.js +125 -0
- package/package.json +1 -1
|
@@ -5,6 +5,11 @@ function M(e) {
|
|
|
5
5
|
const o = (e.changes ?? []).filter((s) => s && i(s.label)).map((s) => `${i(s.label)} ${i(s.from) || "—"} → ${i(s.to) || "—"}`);
|
|
6
6
|
return o.length ? `changed ${r}: ${o.join(", ")}` : `changed ${r}`;
|
|
7
7
|
}
|
|
8
|
+
function Ce(e) {
|
|
9
|
+
return (e.totals ?? []).filter((n) => n && i(n.label) && Number.isFinite(n.delta) && n.delta !== 0).map(
|
|
10
|
+
(n) => `${i(n.label)} ${n.delta > 0 ? "+" : "−"}${Math.abs(n.delta).toLocaleString("en-US", { maximumFractionDigits: 2 })}`
|
|
11
|
+
).join(", ");
|
|
12
|
+
}
|
|
8
13
|
const k = "a record you can't see", z = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, W = {
|
|
9
14
|
ai: "AI",
|
|
10
15
|
api: "API",
|
|
@@ -49,7 +54,7 @@ function q(e) {
|
|
|
49
54
|
function Q(e) {
|
|
50
55
|
return /ies$/i.test(e) ? e.replace(/ies$/i, (n) => n === "IES" ? "Y" : "y") : /(ss|us|is)$/i.test(e) ? e : /(x|ch|sh|ss|us)es$/i.test(e) ? e.replace(/es$/i, "") : /s$/i.test(e) && e.length > 1 ? e.slice(0, -1) : e;
|
|
51
56
|
}
|
|
52
|
-
function
|
|
57
|
+
function D(e) {
|
|
53
58
|
return /[^aeiou]y$/i.test(e) ? e.replace(/y$/i, (n) => n === "Y" ? "IES" : "ies") : /(s|x|z|ch|sh)$/i.test(e) && !/^[A-Z0-9]+$/.test(e) ? `${e}es` : `${e}s`;
|
|
54
59
|
}
|
|
55
60
|
function g(e) {
|
|
@@ -122,39 +127,39 @@ const se = {
|
|
|
122
127
|
nivaro_workflow_templates: "Pipeline",
|
|
123
128
|
nivaro_workflow_transitions: "Pipeline move"
|
|
124
129
|
}, ae = /^(nivaro|directus)_/i;
|
|
125
|
-
function
|
|
130
|
+
function C(e) {
|
|
126
131
|
const n = g(e);
|
|
127
132
|
return `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}`;
|
|
128
133
|
}
|
|
129
|
-
function
|
|
134
|
+
function N(e, n) {
|
|
130
135
|
var l;
|
|
131
136
|
const t = i(e);
|
|
132
137
|
if (!t) return { singular: "Record", plural: "Records" };
|
|
133
138
|
const r = (l = n == null ? void 0 : n.collections) == null ? void 0 : l[t], o = typeof r == "string" ? { plural: r } : r ?? {}, s = i(o.plural), a = i(o.singular);
|
|
134
139
|
if (a || s) {
|
|
135
|
-
const f = a ||
|
|
140
|
+
const f = a || y(s, Q), $ = s && s !== f ? s : y(f, D);
|
|
136
141
|
return { singular: f, plural: $ };
|
|
137
142
|
}
|
|
138
143
|
const c = se[t];
|
|
139
|
-
if (c) return { singular: c, plural: c === "Settings" ? c :
|
|
140
|
-
const u = q(t.replace(/^(nivaro|directus)_/, "")) || "Record", d =
|
|
141
|
-
return { singular: d, plural:
|
|
144
|
+
if (c) return { singular: c, plural: c === "Settings" ? c : y(c, D) };
|
|
145
|
+
const u = q(t.replace(/^(nivaro|directus)_/, "")) || "Record", d = y(u, Q);
|
|
146
|
+
return { singular: d, plural: y(d, D) };
|
|
142
147
|
}
|
|
143
|
-
function
|
|
148
|
+
function y(e, n) {
|
|
144
149
|
const t = e.split(" ");
|
|
145
150
|
return t[t.length - 1] = n(t[t.length - 1] ?? ""), t.join(" ");
|
|
146
151
|
}
|
|
147
152
|
function L(e, n, t) {
|
|
148
|
-
const { singular: r, plural: o } =
|
|
153
|
+
const { singular: r, plural: o } = N(n, t);
|
|
149
154
|
return `${e} ${g(e === 1 ? r : o)}`;
|
|
150
155
|
}
|
|
151
156
|
function ce(e, n) {
|
|
152
|
-
const t = e.user ?? e.user_id ?? null, r = t ?
|
|
157
|
+
const t = e.user ?? e.user_id ?? null, r = t ? T(t, n) : null;
|
|
153
158
|
if (r) return r;
|
|
154
159
|
const o = [i(e.first_name), i(e.last_name)].filter(Boolean).join(" ");
|
|
155
160
|
return o || (i(e.user_email) ? i(e.user_email) : null);
|
|
156
161
|
}
|
|
157
|
-
function
|
|
162
|
+
function T(e, n) {
|
|
158
163
|
if (!e || !(n != null && n.users)) return null;
|
|
159
164
|
const t = n.users;
|
|
160
165
|
return i(t[e] ?? t[ie(e)] ?? t[i(e).toLowerCase()]) || null;
|
|
@@ -220,12 +225,12 @@ function Y(e) {
|
|
|
220
225
|
};
|
|
221
226
|
}
|
|
222
227
|
function H(e, n) {
|
|
223
|
-
const t = Y(e), r = ce(e, n), o =
|
|
228
|
+
const t = Y(e), r = ce(e, n), o = T(t.on_behalf_of, n) ?? r;
|
|
224
229
|
switch (t.kind) {
|
|
225
230
|
case "person":
|
|
226
231
|
return r ?? "Someone";
|
|
227
232
|
case "view_as":
|
|
228
|
-
return `${(
|
|
233
|
+
return `${(T(t.id, n) ?? i(t.name) ?? "") || "An administrator"} as ${o ?? "someone"}`;
|
|
229
234
|
case "api_key":
|
|
230
235
|
return `API key “${i(t.name) || (t.id ? `#${t.id}` : "unnamed")}”`;
|
|
231
236
|
case "mcp": {
|
|
@@ -245,21 +250,21 @@ function H(e, n) {
|
|
|
245
250
|
function I(e, n, t) {
|
|
246
251
|
const r = i(n);
|
|
247
252
|
if (!r || !i(e)) return null;
|
|
248
|
-
const o = `${e}:${r}`, s = t == null ? void 0 : t.records, { singular: a } =
|
|
253
|
+
const o = `${e}:${r}`, s = t == null ? void 0 : t.records, { singular: a } = N(e, t), c = ae.test(i(e));
|
|
249
254
|
if (s && o in s) {
|
|
250
255
|
const u = s[o];
|
|
251
|
-
if (u == null) return c ?
|
|
256
|
+
if (u == null) return c ? C(a) : k;
|
|
252
257
|
const d = i(u);
|
|
253
|
-
return d ? c && (d === r || z.test(d)) ?
|
|
258
|
+
return d ? c && (d === r || z.test(d)) ? C(a) : d.toLowerCase().startsWith(a.toLowerCase()) ? d : `${a} ${d}` : c ? C(a) : a;
|
|
254
259
|
}
|
|
255
|
-
return c || z.test(r) ?
|
|
260
|
+
return c || z.test(r) ? C(a) : `${a} ${r}`;
|
|
256
261
|
}
|
|
257
262
|
function Z(e, n, t) {
|
|
258
263
|
var o;
|
|
259
264
|
const r = (o = t == null ? void 0 : t.fields) == null ? void 0 : o[`${e ?? ""}.${n}`];
|
|
260
265
|
return i(r) || q(n);
|
|
261
266
|
}
|
|
262
|
-
function
|
|
267
|
+
function P(e, n, t) {
|
|
263
268
|
const r = [...new Set(n)].map((o) => Z(e, o, t));
|
|
264
269
|
return r.length === 0 ? "" : r.length === 1 ? r[0] : r.length <= 3 ? `${r.slice(0, -1).join(", ")} and ${r[r.length - 1]}` : `${r.slice(0, 2).join(", ")} and ${r.length - 2} other fields`;
|
|
265
270
|
}
|
|
@@ -332,7 +337,7 @@ function J(e) {
|
|
|
332
337
|
}
|
|
333
338
|
return n;
|
|
334
339
|
}
|
|
335
|
-
const
|
|
340
|
+
const x = {
|
|
336
341
|
ack: "acknowledged",
|
|
337
342
|
acknowledge: "acknowledged",
|
|
338
343
|
acquire: "took",
|
|
@@ -473,12 +478,12 @@ function ee(e) {
|
|
|
473
478
|
if (n.length === 0) return { verb: null, past: null, noun: "" };
|
|
474
479
|
const t = n[n.length - 1];
|
|
475
480
|
let r = -1;
|
|
476
|
-
if (
|
|
477
|
-
else if (
|
|
478
|
-
else for (let a = n.length - 1; a >= 0; a--)
|
|
481
|
+
if (x[t]) r = n.length - 1;
|
|
482
|
+
else if (x[n[0]]) r = 0;
|
|
483
|
+
else for (let a = n.length - 1; a >= 0; a--) x[n[a]] && (r = a);
|
|
479
484
|
if (r < 0) return { verb: null, past: null, noun: n.map(U).join(" ") };
|
|
480
485
|
const o = n[r], s = [...n.slice(0, r), ...n.slice(r + 1)];
|
|
481
|
-
return { verb: o, past:
|
|
486
|
+
return { verb: o, past: x[o], noun: s.map(U).join(" ") };
|
|
482
487
|
}
|
|
483
488
|
function he(e, n) {
|
|
484
489
|
return n ? /s$/.test(n) && !/ss$/.test(n) ? n : e && ve.has(e) ? `${/^[aeiou]/i.test(n) ? "an" : "a"} ${n}` : `the ${n}` : "";
|
|
@@ -499,18 +504,18 @@ function ne(e) {
|
|
|
499
504
|
return `${/^[aeiou]/i.test(e) ? "an" : "a"} ${e}`;
|
|
500
505
|
}
|
|
501
506
|
function te(e, n) {
|
|
502
|
-
const t = g(
|
|
507
|
+
const t = g(N(e.parent_collection, n).singular), r = `${/^[aeiou]/i.test(t) ? "an" : "a"} ${t} record`;
|
|
503
508
|
if (!i(e.parent_id)) return r;
|
|
504
509
|
const o = I(e.parent_collection, e.parent_id, n);
|
|
505
510
|
return !o || o === k ? r : o;
|
|
506
511
|
}
|
|
507
|
-
function
|
|
512
|
+
function E(e) {
|
|
508
513
|
const n = i(e.value);
|
|
509
514
|
return n ? `${e.noun} ${n}` : ne(e.noun);
|
|
510
515
|
}
|
|
511
516
|
function re(e, n, t) {
|
|
512
517
|
const r = te(n, t);
|
|
513
|
-
return e === "create" ? `added ${
|
|
518
|
+
return e === "create" ? `added ${E(n)} to ${r}` : e === "delete" ? `removed ${E(n)} from ${r}` : `updated ${E(n)} on ${r}`;
|
|
514
519
|
}
|
|
515
520
|
function ke(e, n) {
|
|
516
521
|
var l;
|
|
@@ -553,13 +558,13 @@ function Se(e, n) {
|
|
|
553
558
|
return `changed ${r}: ${[...o.map(we), ...s].join("; ")}`;
|
|
554
559
|
}
|
|
555
560
|
const K = /* @__PURE__ */ new Set(["transition", "pipeline-transition"]);
|
|
556
|
-
function
|
|
561
|
+
function je(e) {
|
|
557
562
|
const n = i(e).toLowerCase();
|
|
558
563
|
return /approv/.test(n) ? "Approved" : /reject/.test(n) ? "Rejected" : /declin/.test(n) ? "Declined" : /send.?back|return/.test(n) ? "Sent back" : /submit/.test(n) ? "Submitted" : /cancel/.test(n) ? "Cancelled" : "Moved";
|
|
559
564
|
}
|
|
560
|
-
function
|
|
561
|
-
var $, _, h, v,
|
|
562
|
-
const t = i(e.action), r = e.collection ?? null, o = I(r, e.item, n), s =
|
|
565
|
+
function be(e, n) {
|
|
566
|
+
var $, _, h, v, b;
|
|
567
|
+
const t = i(e.action), r = e.collection ?? null, o = I(r, e.item, n), s = N(r, n), a = `${/^[aeiou]/i.test(s.singular) ? "an" : "a"} ${g(s.singular)}`, c = i(e.comment), u = o ? ` on ${o}` : "", d = S(e, n);
|
|
563
568
|
if (d && (t === "create" || t === "delete" || t === "update"))
|
|
564
569
|
return re(t, d, n);
|
|
565
570
|
if ((($ = e.event) == null ? void 0 : $.kind) === "start") {
|
|
@@ -584,14 +589,14 @@ function ye(e, n) {
|
|
|
584
589
|
return e.o2m ? `${M(e.o2m)}${u}` : `changed related rows${u}`;
|
|
585
590
|
const p = B(e);
|
|
586
591
|
if (r === "nivaro_settings")
|
|
587
|
-
return p.length ? `changed the ${
|
|
592
|
+
return p.length ? `changed the ${P(r, p, n)} setting${p.length === 1 ? "" : "s"}` : "changed the settings";
|
|
588
593
|
if (r === "nivaro_approval_instances" && ((v = e.why) != null && v.approval)) {
|
|
589
594
|
const m = e.why.approval, w = I(m.collection, m.item, n);
|
|
590
|
-
return `${(
|
|
595
|
+
return `${(x[i(m.decision).toLowerCase()] ?? i(m.decision).toLowerCase()) || "decided on"} ${w ?? o ?? "an approval"}${m.chain ? ` (${m.chain})` : ""}`;
|
|
591
596
|
}
|
|
592
597
|
if (p.length) {
|
|
593
|
-
const m = ((
|
|
594
|
-
return m && "value" in m && X(r, m.field, m.value, n) ? `set ${Z(r, m.field, n)} to ${V(r, m.field, m.value, n)}${u}` : `changed ${
|
|
598
|
+
const m = ((b = e.changes) == null ? void 0 : b.length) === 1 ? e.changes[0] : null;
|
|
599
|
+
return m && "value" in m && X(r, m.field, m.value, n) ? `set ${Z(r, m.field, n)} to ${V(r, m.field, m.value, n)}${u}` : `changed ${P(r, p, n)}${u}`;
|
|
595
600
|
}
|
|
596
601
|
return `updated ${o ?? a}`;
|
|
597
602
|
}
|
|
@@ -617,13 +622,13 @@ function ye(e, n) {
|
|
|
617
622
|
return `exported ${p.rows != null ? L(p.rows, r, n) : g(s.plural)}${p.format ? ` to ${p.format}` : ""}`;
|
|
618
623
|
}
|
|
619
624
|
case "masquerade-start":
|
|
620
|
-
return `started viewing as ${
|
|
625
|
+
return `started viewing as ${A(e, n, c)}`;
|
|
621
626
|
case "masquerade-stop":
|
|
622
|
-
return `stopped viewing as ${
|
|
627
|
+
return `stopped viewing as ${A(e, n, c)}`;
|
|
623
628
|
case "token.generate":
|
|
624
|
-
return `generated a static token for ${
|
|
629
|
+
return `generated a static token for ${A(e, n, "")}`;
|
|
625
630
|
case "token.revoke":
|
|
626
|
-
return `revoked the static token of ${
|
|
631
|
+
return `revoked the static token of ${A(e, n, "")}`;
|
|
627
632
|
case "api_key_created":
|
|
628
633
|
return `created ${o && o !== k ? o : "an API key"}`;
|
|
629
634
|
case "api_key_revoked":
|
|
@@ -633,7 +638,7 @@ function ye(e, n) {
|
|
|
633
638
|
case "api_key_simulate":
|
|
634
639
|
return `tested requests as ${o && o !== k ? o : "an API key"}`;
|
|
635
640
|
case "set_role":
|
|
636
|
-
return `changed the role of ${
|
|
641
|
+
return `changed the role of ${A(e, n, "")}`;
|
|
637
642
|
case "bulk-write":
|
|
638
643
|
case "bulk-action-execute": {
|
|
639
644
|
const p = /(\d+)\s+(?:item|row)/i.exec(c), m = p ? L(Number(p[1]), r, n) : g(s.plural), w = t === "bulk-action-execute" ? /^(.+?)\s*\([^)]*\)\s+on\s/.exec(c) : null;
|
|
@@ -685,14 +690,14 @@ function ye(e, n) {
|
|
|
685
690
|
const l = ee(t);
|
|
686
691
|
return /settings$/.test(l.noun) && !l.verb ? `changed the ${l.noun}` : l.past ? o && l.noun && g(s.singular).toLowerCase().includes(l.noun.toLowerCase()) ? `${l.past} ${o}` : l.noun ? `${l.past} ${he(l.verb, l.noun)}${u}` : `${l.past} ${o ?? "something"}` : `recorded “${G(t)}”${u}`;
|
|
687
692
|
}
|
|
688
|
-
function
|
|
689
|
-
const r = i(e.item), o =
|
|
693
|
+
function A(e, n, t) {
|
|
694
|
+
const r = i(e.item), o = T(r, n) ?? (t || null);
|
|
690
695
|
if (o) return o;
|
|
691
696
|
const s = e.collection === "nivaro_users" ? I(e.collection, e.item, n) : null;
|
|
692
697
|
return s && !z.test(r) ? s : "someone";
|
|
693
698
|
}
|
|
694
|
-
function
|
|
695
|
-
return `${H(e, n)} ${
|
|
699
|
+
function ye(e, n) {
|
|
700
|
+
return `${H(e, n)} ${be(e, n)}`;
|
|
696
701
|
}
|
|
697
702
|
function Re(e) {
|
|
698
703
|
var c, u, d, l;
|
|
@@ -702,11 +707,11 @@ function Re(e) {
|
|
|
702
707
|
const s = (l = e.why) == null ? void 0 : l.approval, a = s ? `${q(i(s.decision)) || "Decided"}${s.chain ? ` · ${s.chain}` : ""}${s.step != null && s.step !== "" ? ` · step ${s.step}` : ""}${i(s.comment) ? ` — “${i(s.comment)}”` : ""}` : null;
|
|
703
708
|
return { reason: r, note: o, approval: a };
|
|
704
709
|
}
|
|
705
|
-
const
|
|
706
|
-
function
|
|
710
|
+
const Ae = 6e4, xe = 5e3;
|
|
711
|
+
function j(e) {
|
|
707
712
|
return e.timestamp ? new Date(e.timestamp).getTime() : Number.NaN;
|
|
708
713
|
}
|
|
709
|
-
function
|
|
714
|
+
function R(e) {
|
|
710
715
|
const n = Y(e);
|
|
711
716
|
return `${n.kind}|${i(n.id)}|${i(e.user ?? e.user_id).toUpperCase()}`;
|
|
712
717
|
}
|
|
@@ -714,13 +719,13 @@ function Ie(e) {
|
|
|
714
719
|
const n = i(e.action);
|
|
715
720
|
return !i(e.item) && (n.startsWith("bulk-") || n === "import-complete");
|
|
716
721
|
}
|
|
717
|
-
function
|
|
718
|
-
const t = n.windowMs ??
|
|
722
|
+
function Le(e, n = {}) {
|
|
723
|
+
const t = n.windowMs ?? Ae, r = [], o = (s, a) => s.parent_collection === a.parent_collection && (!i(s.parent_id) || !i(a.parent_id) || i(s.parent_id) === i(a.parent_id));
|
|
719
724
|
for (const s of e) {
|
|
720
725
|
const a = r[r.length - 1], c = a == null ? void 0 : a.entries[a.entries.length - 1], u = i(s.group_key);
|
|
721
726
|
if (a && c && n.labels) {
|
|
722
727
|
const d = S(s, n.labels), l = S(c, n.labels);
|
|
723
|
-
if (d && l && a.entries.every((f) => S(f, n.labels)) && o(d, l) &&
|
|
728
|
+
if (d && l && a.entries.every((f) => S(f, n.labels)) && o(d, l) && R(s) === R(c) && Math.abs(j(c) - j(s)) <= xe) {
|
|
724
729
|
a.entries.push(s), a.by !== "group_key" && (a.by = "time");
|
|
725
730
|
continue;
|
|
726
731
|
}
|
|
@@ -731,7 +736,7 @@ function je(e, n = {}) {
|
|
|
731
736
|
a.entries.push(s), a.by = "group_key";
|
|
732
737
|
continue;
|
|
733
738
|
}
|
|
734
|
-
if (!u && !d && a.by !== "group_key" && i(s.action) === i(c.action) && i(s.collection) === i(c.collection) && i(s.collection) !== "" &&
|
|
739
|
+
if (!u && !d && a.by !== "group_key" && i(s.action) === i(c.action) && i(s.collection) === i(c.collection) && i(s.collection) !== "" && R(s) === R(c) && Math.abs(j(c) - j(s)) <= t) {
|
|
735
740
|
a.entries.push(s), a.by = "time";
|
|
736
741
|
continue;
|
|
737
742
|
}
|
|
@@ -740,10 +745,10 @@ function je(e, n = {}) {
|
|
|
740
745
|
}
|
|
741
746
|
return r;
|
|
742
747
|
}
|
|
743
|
-
function
|
|
748
|
+
function Te(e, n) {
|
|
744
749
|
if (e.length === 0) return "";
|
|
745
750
|
const t = e.filter((v) => !Ie(v)), r = t[0] ?? e[0];
|
|
746
|
-
if (t.length <= 1) return
|
|
751
|
+
if (t.length <= 1) return ye(r, n);
|
|
747
752
|
const o = H(r, n), s = Se(t, n);
|
|
748
753
|
if (s) return `${o} ${s}`;
|
|
749
754
|
const c = new Set(t.map((v) => i(v.collection))).size === 1 ? r.collection ?? null : null, u = new Set(t.map((v) => i(v.item))), d = u.size > 1 ? u.size : t.length, l = c ? u.size === 1 && i(r.item) ? I(c, r.item, n) ?? L(d, c, n) : L(d, c, n) : `${d} records`, f = u.size === 1 && t.length > 1 ? ` ${t.length} times` : "", $ = new Set(
|
|
@@ -757,11 +762,11 @@ function Le(e, n) {
|
|
|
757
762
|
var m;
|
|
758
763
|
return i(((m = p.event) == null ? void 0 : m.to_label) ?? J(p.comment).to);
|
|
759
764
|
})
|
|
760
|
-
),
|
|
761
|
-
return `${o} moved ${l}${
|
|
765
|
+
), b = v.size === 1 ? [...v][0] : "";
|
|
766
|
+
return `${o} moved ${l}${b ? ` to ${b}` : ""}${f}`;
|
|
762
767
|
}
|
|
763
768
|
if (_ === "update") {
|
|
764
|
-
const v =
|
|
769
|
+
const v = Ne(t, c, n);
|
|
765
770
|
return `${o} updated ${l}${f}${v ? `: ${v}` : ""}`;
|
|
766
771
|
}
|
|
767
772
|
if (_ === "create") return `${o} created ${l}`;
|
|
@@ -769,14 +774,14 @@ function Le(e, n) {
|
|
|
769
774
|
if (_ === "picker-exclude") return `${o} hid ${l} from pickers${f}`;
|
|
770
775
|
if (_ === "picker-include") return `${o} showed ${l} in pickers again${f}`;
|
|
771
776
|
const h = ee(_);
|
|
772
|
-
return h.past ? `${o} ${h.past} ${l}${h.noun && !g(
|
|
777
|
+
return h.past ? `${o} ${h.past} ${l}${h.noun && !g(N(c, n).plural).toLowerCase().includes(h.noun) ? ` (${h.noun})` : ""}${f}` : `${o} recorded “${G(_)}” on ${l}`;
|
|
773
778
|
}
|
|
774
|
-
function
|
|
779
|
+
function Ne(e, n, t) {
|
|
775
780
|
var c;
|
|
776
781
|
const r = ((c = e[0]) == null ? void 0 : c.changes) ?? null;
|
|
777
782
|
if (!(r != null && r.length)) {
|
|
778
783
|
const u = e.map((d) => B(d).sort().join(","));
|
|
779
|
-
return u[0] && u.every((d) => d === u[0]) ?
|
|
784
|
+
return u[0] && u.every((d) => d === u[0]) ? P(n, u[0].split(","), t) : "";
|
|
780
785
|
}
|
|
781
786
|
const o = (u) => JSON.stringify((u.changes ?? []).map((d) => [d.field, d.value ?? null]).sort());
|
|
782
787
|
if (e.every((u) => o(u) === o(e[0])) && r.length <= 2 && r.every((u) => X(n, u.field, u.value, t)))
|
|
@@ -784,7 +789,7 @@ function Ce(e, n, t) {
|
|
|
784
789
|
(u) => `${Z(n, u.field, t)} → ${V(n, u.field, u.value, t)}`
|
|
785
790
|
).join(", ");
|
|
786
791
|
const a = new Set(e.flatMap((u) => (u.changes ?? []).map((d) => d.field)));
|
|
787
|
-
return
|
|
792
|
+
return P(n, [...a], t);
|
|
788
793
|
}
|
|
789
794
|
function Pe(e) {
|
|
790
795
|
var a;
|
|
@@ -810,33 +815,34 @@ function Pe(e) {
|
|
|
810
815
|
};
|
|
811
816
|
}
|
|
812
817
|
export {
|
|
813
|
-
|
|
818
|
+
Ae as BURST_WINDOW_MS,
|
|
814
819
|
k as HIDDEN_RECORD,
|
|
815
|
-
|
|
820
|
+
xe as LINK_WRITE_WINDOW_MS,
|
|
816
821
|
ee as actionParts,
|
|
817
822
|
Pe as activityLabelRefs,
|
|
818
|
-
|
|
823
|
+
be as activityPredicate,
|
|
819
824
|
Re as activityWhy,
|
|
820
825
|
H as actorName,
|
|
821
826
|
Y as actorOf,
|
|
822
827
|
le as choiceText,
|
|
823
|
-
|
|
828
|
+
N as collectionNouns,
|
|
824
829
|
L as countNoun,
|
|
825
830
|
Z as fieldLabel,
|
|
826
|
-
|
|
827
|
-
|
|
831
|
+
P as fieldList,
|
|
832
|
+
Le as groupActivity,
|
|
828
833
|
S as junctionOf,
|
|
829
834
|
ke as linkChanges,
|
|
830
835
|
Se as linkGroupPredicate,
|
|
831
836
|
we as linkPairText,
|
|
832
837
|
M as o2mSentence,
|
|
838
|
+
Ce as o2mTotalsText,
|
|
833
839
|
de as parseActor,
|
|
834
840
|
J as parseTransitionComment,
|
|
835
841
|
G as readableTitle,
|
|
836
842
|
I as recordPhrase,
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
843
|
+
Te as renderActivityGroupSentence,
|
|
844
|
+
ye as renderActivitySentence,
|
|
845
|
+
je as transitionVerb,
|
|
840
846
|
X as valueShowable,
|
|
841
847
|
V as valueText
|
|
842
848
|
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
function a(t) {
|
|
2
|
+
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
3
|
+
}
|
|
4
|
+
function i(t) {
|
|
5
|
+
if (t && typeof t == "object" && !Array.isArray(t))
|
|
6
|
+
return Array.isArray(t.blocks) ? t : null;
|
|
7
|
+
if (typeof t != "string") return null;
|
|
8
|
+
const r = t.trimStart();
|
|
9
|
+
if (!r.startsWith("{") || !r.includes('"blocks"')) return null;
|
|
10
|
+
try {
|
|
11
|
+
const e = JSON.parse(r);
|
|
12
|
+
return Array.isArray(e == null ? void 0 : e.blocks) ? e : null;
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const d = (t) => i(t) !== null;
|
|
18
|
+
function y(t) {
|
|
19
|
+
const r = i(t);
|
|
20
|
+
return r ? (r.blocks ?? []).map((e) => {
|
|
21
|
+
const o = e.data ?? {}, n = a(String(o.text ?? "")), c = Math.max(1, Math.min(6, Number(o.level ?? 2)));
|
|
22
|
+
switch (e.type) {
|
|
23
|
+
case "paragraph":
|
|
24
|
+
return `<p>${n}</p>`;
|
|
25
|
+
case "header":
|
|
26
|
+
return `<h${c}>${n}</h${c}>`;
|
|
27
|
+
case "list": {
|
|
28
|
+
const s = (o.items ?? []).map((l) => `<li>${a(f(l))}</li>`).join("");
|
|
29
|
+
return o.style === "ordered" ? `<ol>${s}</ol>` : `<ul>${s}</ul>`;
|
|
30
|
+
}
|
|
31
|
+
case "quote":
|
|
32
|
+
return `<blockquote><p>${n}</p></blockquote>`;
|
|
33
|
+
default:
|
|
34
|
+
return n ? `<p>${n}</p>` : "";
|
|
35
|
+
}
|
|
36
|
+
}).join("") : typeof t == "string" && t ? `<p>${a(t)}</p>` : "";
|
|
37
|
+
}
|
|
38
|
+
function f(t) {
|
|
39
|
+
return typeof t == "string" ? t : t && typeof t == "object" && "content" in t ? String(t.content) : "";
|
|
40
|
+
}
|
|
41
|
+
const p = (t) => t.replace(/<br\s*\/?>/gi, `
|
|
42
|
+
`).replace(/<[^>]*>/g, "").replace(/ /g, " ").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&").trim();
|
|
43
|
+
function m(t) {
|
|
44
|
+
const r = i(t);
|
|
45
|
+
if (!r) return "";
|
|
46
|
+
const e = [];
|
|
47
|
+
for (const o of r.blocks ?? []) {
|
|
48
|
+
const n = o.data ?? {};
|
|
49
|
+
if (o.type === "list") {
|
|
50
|
+
const s = n.style === "ordered";
|
|
51
|
+
(n.items ?? []).forEach((l, g) => {
|
|
52
|
+
const u = p(f(l));
|
|
53
|
+
u && e.push(`${s ? `${g + 1}.` : "•"} ${u}`);
|
|
54
|
+
});
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const c = p(String(n.text ?? ""));
|
|
58
|
+
c && e.push(c);
|
|
59
|
+
}
|
|
60
|
+
return e.join(`
|
|
61
|
+
`);
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
i as editorJsDoc,
|
|
65
|
+
y as editorJsToHtml,
|
|
66
|
+
m as editorJsToText,
|
|
67
|
+
d as isEditorJsValue
|
|
68
|
+
};
|
|
@@ -26,7 +26,7 @@ const h = {
|
|
|
26
26
|
SYSTEM_COLLECTION: "System tables change only through their own admin pages.",
|
|
27
27
|
CLOUD_EXTENSIONS_LOCKED: "Extensions are managed by your hosting plan.",
|
|
28
28
|
// ── Records and forms ──────────────────────────────────────────────────────
|
|
29
|
-
OUT_OF_SCOPE: "Pick a value inside your own scope, or ask someone who covers that one to
|
|
29
|
+
OUT_OF_SCOPE: "Pick a value inside your own scope, or ask someone who covers that one to make the change.",
|
|
30
30
|
EDIT_LOCKED: "This record is locked at its current stage. Ask its owner or an administrator to change it.",
|
|
31
31
|
RECORD_LOCKED: "Someone else is editing this record. Wait until they finish, then reload.",
|
|
32
32
|
ITEM_LOCKED: "Someone else is editing this record. Wait until they finish, then reload.",
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useQueryClient as m, useQuery as c } from "@tanstack/react-query";
|
|
2
|
+
import { useOptionalNivaroClient as f } from "../context.js";
|
|
3
|
+
import { get as _, patch as p, put as A } from "./commands.js";
|
|
4
|
+
const v = ["nvr-profile-prefs"];
|
|
5
|
+
function q(e, t) {
|
|
6
|
+
const i = e == null ? void 0 : e.revision_personal_sets;
|
|
7
|
+
if (!i || typeof i != "object" || Array.isArray(i)) return [];
|
|
8
|
+
const r = i[t];
|
|
9
|
+
return Array.isArray(r) ? r.filter(
|
|
10
|
+
(o) => o && typeof o.name == "string" && Array.isArray(o.fields)
|
|
11
|
+
) : [];
|
|
12
|
+
}
|
|
13
|
+
function h(e) {
|
|
14
|
+
const t = f(), i = m(), r = ["revision-column-sets", e], { data: o } = c({
|
|
15
|
+
queryKey: r,
|
|
16
|
+
queryFn: () => t.request(_(`/revision-column-sets/${e}`)).then((l) => l.data),
|
|
17
|
+
enabled: !!t && !!e,
|
|
18
|
+
staleTime: 6e4,
|
|
19
|
+
retry: !1
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
sets: (o == null ? void 0 : o.sets) ?? [],
|
|
23
|
+
roleDefault: (o == null ? void 0 : o.role_default) ?? null,
|
|
24
|
+
/** Admins: replace the collection's shared sets. */
|
|
25
|
+
save: async (l) => {
|
|
26
|
+
t && (await t.request(A(`/revision-column-sets/${e}`, { sets: l })), await i.invalidateQueries({ queryKey: r }));
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function b(e, t) {
|
|
31
|
+
const i = e == null ? void 0 : e.revision_table_columns;
|
|
32
|
+
if (!i || typeof i != "object" || Array.isArray(i)) return null;
|
|
33
|
+
const r = i[t];
|
|
34
|
+
return Array.isArray(r) ? r.filter((o) => typeof o == "string") : null;
|
|
35
|
+
}
|
|
36
|
+
function K(e) {
|
|
37
|
+
const t = f(), i = m(), { data: r, isSuccess: o } = c({
|
|
38
|
+
queryKey: v,
|
|
39
|
+
queryFn: () => t.request(_("/users/me")).then((s) => {
|
|
40
|
+
var n;
|
|
41
|
+
return ((n = s.data) == null ? void 0 : n.preferences) ?? {};
|
|
42
|
+
}),
|
|
43
|
+
enabled: !!t,
|
|
44
|
+
staleTime: 6e4,
|
|
45
|
+
retry: !1
|
|
46
|
+
}), l = (r == null ? void 0 : r.revision_view) === "table" || (r == null ? void 0 : r.revision_view) === "timeline" ? r.revision_view : null, y = (s, n) => {
|
|
47
|
+
i.setQueryData(v, (u) => n({ ...u ?? {} })), t && t.request(p("/users/me/preferences", s)).catch(() => {
|
|
48
|
+
i.invalidateQueries({ queryKey: v });
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
return {
|
|
52
|
+
/** True once the person's stored choices have been read (or there is no client). */
|
|
53
|
+
loaded: o || !t,
|
|
54
|
+
view: l,
|
|
55
|
+
/** This collection's picked columns in order; null = never picked (use the default). */
|
|
56
|
+
columns: b(r, e),
|
|
57
|
+
/** The person's own named sets for this collection. */
|
|
58
|
+
personalSets: q(r, e),
|
|
59
|
+
setPersonalSets: (s) => y(
|
|
60
|
+
{
|
|
61
|
+
revision_personal_sets: {
|
|
62
|
+
collection: e,
|
|
63
|
+
sets: (s == null ? void 0 : s.map((n) => ({ name: n.name, fields: n.fields }))) ?? null
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
(n) => {
|
|
67
|
+
const u = n.revision_personal_sets, a = u && typeof u == "object" && !Array.isArray(u) ? { ...u } : {};
|
|
68
|
+
return s === null ? delete a[e] : a[e] = s, { ...n, revision_personal_sets: a };
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
setView: (s) => y({ revision_view: s }, (n) => ({ ...n, revision_view: s })),
|
|
72
|
+
setColumns: (s) => y({ revision_table_columns: { collection: e, fields: s } }, (n) => {
|
|
73
|
+
const u = n.revision_table_columns, a = u && typeof u == "object" && !Array.isArray(u) ? { ...u } : {};
|
|
74
|
+
return s === null ? delete a[e] : a[e] = s, { ...n, revision_table_columns: a };
|
|
75
|
+
})
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
K as useRevisionPrefs,
|
|
80
|
+
h as useSharedColumnSets
|
|
81
|
+
};
|