@nivaro/react 0.3.32 → 0.3.34
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 +89 -8
- package/dist/index.js +338 -328
- package/dist/shared/components/ForceReloadBanner.js +56 -46
- package/dist/shared/components/ItemEditForm.js +5637 -5442
- package/dist/shared/components/ProfileView.js +46 -44
- package/dist/shared/components/ReportView.js +208 -205
- package/dist/shared/components/SearchHighlight.js +30 -0
- package/dist/shared/components/TipLayer.js +39 -37
- package/dist/shared/components/item-edit/CatalogPickerField.js +1484 -1232
- package/dist/shared/components/item-edit/FieldAffordances.js +370 -203
- package/dist/shared/components/item-edit/FieldRow.js +396 -354
- package/dist/shared/components/item-edit/PersonalDefaultPill.js +50 -0
- package/dist/shared/components/item-edit/RelationCombobox.js +42 -41
- package/dist/shared/components/item-edit/catalog-search.js +34 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +34 -34
- package/dist/shared/components/item-edit/personal-default-checks.js +134 -0
- package/dist/shared/components/item-edit/usePersonalDefaults.js +358 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +130 -111
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +76 -75
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/profile/MyDefaultsCard.js +667 -0
- package/dist/shared/components/profile/PersonProfile.js +42 -40
- package/dist/shared/components/profile/my-defaults-labels.js +76 -0
- package/dist/shared/components/profile/primitives.js +72 -67
- package/dist/shared/lib/personal-defaults.js +76 -0
- package/dist/shared/lib/request-gate.js +78 -76
- package/dist/shared/lib/search-text.js +111 -0
- package/dist/shared/lib/unsaved-work.js +86 -38
- package/package.json +1 -1
|
@@ -1,41 +1,51 @@
|
|
|
1
|
-
import { jsxs as c, jsx as
|
|
2
|
-
import { PauseCircle as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { markReloadFor as
|
|
5
|
-
import { shouldObeyForceReload as
|
|
6
|
-
import { subscribeUnsavedWork as
|
|
7
|
-
const
|
|
8
|
-
function
|
|
9
|
-
const [
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
1
|
+
import { jsxs as c, jsx as d, Fragment as k } from "react/jsx-runtime";
|
|
2
|
+
import { PauseCircle as T, RotateCw as C } from "lucide-react";
|
|
3
|
+
import { useState as p, useRef as b, useEffect as E } from "react";
|
|
4
|
+
import { markReloadFor as R } from "../lib/client-version.js";
|
|
5
|
+
import { shouldObeyForceReload as D, thisTabForReload as M } from "../lib/force-reload.js";
|
|
6
|
+
import { subscribeUnsavedWork as O, prepareForReload as y, beginReloadForUpdate as L, unsavedWorkLabels as S } from "../lib/unsaved-work.js";
|
|
7
|
+
const F = "nvr:force-refresh";
|
|
8
|
+
function B() {
|
|
9
|
+
const [r, N] = p(null), [j, g] = p(() => Date.now()), [w, l] = p([]), n = b(!1), m = b(!1), v = b(/* @__PURE__ */ new Set());
|
|
10
|
+
E(() => {
|
|
11
|
+
const o = (s) => {
|
|
12
|
+
const e = s.detail ?? {}, t = typeof e.id == "string" && e.id ? e.id : null;
|
|
13
|
+
if (t && v.current.has(t) || !D(e, M())) return;
|
|
14
|
+
t && v.current.add(t), m.current = !1, l([]);
|
|
15
|
+
const h = Math.max(5, Number(e.seconds) || 30), i = Date.now();
|
|
16
|
+
N({ deadline: i + h * 1e3, message: String(e.message ?? ""), id: t }), g(i);
|
|
17
17
|
};
|
|
18
|
-
return window.addEventListener(
|
|
19
|
-
}, []),
|
|
20
|
-
if (!
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
return window.addEventListener(F, o), () => window.removeEventListener(F, o);
|
|
19
|
+
}, []), E(() => {
|
|
20
|
+
if (!r) return;
|
|
21
|
+
const o = () => {
|
|
22
|
+
n.current || (n.current = !0, r.id && R(r.id), window.location.reload(), setTimeout(() => {
|
|
23
|
+
n.current = !1, m.current = !0, l(["unsaved changes on this page"]);
|
|
24
24
|
}, 1500));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
};
|
|
26
|
+
let s = !1;
|
|
27
|
+
const e = () => {
|
|
28
|
+
const i = Date.now();
|
|
29
|
+
if (g(i), !(i < r.deadline || n.current || m.current || s)) {
|
|
30
|
+
if (S().length === 0) {
|
|
31
|
+
l((a) => a.length ? [] : a), o();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
s = !0, y().then((a) => {
|
|
35
|
+
l((x) => x.join("|") === a.join("|") ? x : a), a.length === 0 && (L(), o());
|
|
36
|
+
}).finally(() => {
|
|
37
|
+
s = !1;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}, t = setInterval(e, 1e3);
|
|
41
|
+
document.addEventListener("visibilitychange", e), window.addEventListener("focus", e), window.addEventListener("pageshow", e);
|
|
42
|
+
const h = O(() => setTimeout(e, 0));
|
|
33
43
|
return () => {
|
|
34
|
-
clearInterval(t), document.removeEventListener("visibilitychange",
|
|
44
|
+
clearInterval(t), document.removeEventListener("visibilitychange", e), window.removeEventListener("focus", e), window.removeEventListener("pageshow", e), h();
|
|
35
45
|
};
|
|
36
|
-
}, [
|
|
37
|
-
const u =
|
|
38
|
-
return
|
|
46
|
+
}, [r]);
|
|
47
|
+
const u = r ? Math.max(0, Math.ceil((r.deadline - j) / 1e3)) : 0, f = u === 0 && w.length > 0;
|
|
48
|
+
return r ? /* @__PURE__ */ c(
|
|
39
49
|
"div",
|
|
40
50
|
{
|
|
41
51
|
role: "alert",
|
|
@@ -44,27 +54,27 @@ function W() {
|
|
|
44
54
|
"data-nvr-recording-hide": !0,
|
|
45
55
|
className: "fixed inset-x-0 top-0 z-[150] flex items-center justify-center gap-3 border-b border-amber-300 bg-amber-50 px-4 py-2.5 text-[13px] text-amber-900 dark:border-amber-500/40 dark:bg-[#3a2e10] dark:text-amber-200",
|
|
46
56
|
children: [
|
|
47
|
-
f ? /* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
57
|
+
f ? /* @__PURE__ */ d(T, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ d(C, { className: "h-4 w-4 shrink-0 animate-spin" }),
|
|
58
|
+
/* @__PURE__ */ d("span", { children: f ? /* @__PURE__ */ c(k, { children: [
|
|
59
|
+
/* @__PURE__ */ d("span", { className: "font-semibold", children: "A reload is waiting" }),
|
|
50
60
|
" — save or discard your changes (",
|
|
51
|
-
|
|
61
|
+
w.join(", ").toLowerCase(),
|
|
52
62
|
") and the page reloads."
|
|
53
|
-
] }) : /* @__PURE__ */ c(
|
|
63
|
+
] }) : /* @__PURE__ */ c(k, { children: [
|
|
54
64
|
/* @__PURE__ */ c("span", { className: "font-semibold", children: [
|
|
55
65
|
"This page will reload in ",
|
|
56
66
|
u,
|
|
57
67
|
"s"
|
|
58
68
|
] }),
|
|
59
|
-
|
|
69
|
+
r.message ? ` — ${r.message}` : " — an administrator pushed an update."
|
|
60
70
|
] }) }),
|
|
61
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ d(
|
|
62
72
|
"button",
|
|
63
73
|
{
|
|
64
74
|
type: "button",
|
|
65
|
-
onClick: () => {
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
onClick: async () => {
|
|
76
|
+
n.current = !0, r.id && R(r.id), (await y()).length === 0 && L(), window.location.reload(), setTimeout(() => {
|
|
77
|
+
n.current = !1;
|
|
68
78
|
}, 1500);
|
|
69
79
|
},
|
|
70
80
|
className: "shrink-0 rounded-md border border-amber-400 bg-white px-2.5 py-1 text-[12px] font-medium text-amber-800 hover:bg-amber-100 dark:bg-transparent dark:text-amber-200",
|
|
@@ -76,6 +86,6 @@ function W() {
|
|
|
76
86
|
) : null;
|
|
77
87
|
}
|
|
78
88
|
export {
|
|
79
|
-
|
|
80
|
-
|
|
89
|
+
F as FORCE_RELOAD_EVENT,
|
|
90
|
+
B as ForceReloadBanner
|
|
81
91
|
};
|