@nivaro/react 0.3.41 → 0.3.43
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/components/LayoutForm.js +100 -98
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +733 -15
- package/dist/index.js +820 -775
- package/dist/shared/components/ActivityEntry.js +154 -0
- package/dist/shared/components/AudienceConfirmPanel.js +98 -0
- package/dist/shared/components/BackgroundRunOffer.js +43 -31
- package/dist/shared/components/BroadcastView.js +225 -204
- package/dist/shared/components/CollectionBrowserView.js +3924 -3584
- package/dist/shared/components/ConfigHistory.js +153 -0
- package/dist/shared/components/ConfigReadBack.js +65 -0
- package/dist/shared/components/DataTable.js +379 -346
- package/dist/shared/components/ForceReloadBanner.js +47 -40
- package/dist/shared/components/IdleReloadWatcher.js +69 -0
- package/dist/shared/components/ItemEditForm.js +4041 -3853
- package/dist/shared/components/MyWorkView.js +278 -213
- package/dist/shared/components/NotificationBell.js +130 -121
- package/dist/shared/components/ProfileView.js +776 -1003
- package/dist/shared/components/RecentRecordsRail.js +34 -16
- package/dist/shared/components/RecordReadView.js +500 -477
- package/dist/shared/components/Skeletons.js +199 -0
- package/dist/shared/components/SlowNotice.js +63 -0
- package/dist/shared/components/Term.js +23 -0
- package/dist/shared/components/WidgetSlot.js +350 -353
- package/dist/shared/components/access/PermissionSummary.js +106 -0
- package/dist/shared/components/bulk/BulkActionButtons.js +76 -73
- package/dist/shared/components/chat/ChatPanel.js +902 -886
- package/dist/shared/components/chat/MemberPaging.js +70 -0
- package/dist/shared/components/chat/RoomParts.js +147 -117
- package/dist/shared/components/chat/ScreenClip.js +73 -69
- package/dist/shared/components/chat/chat-core.js +449 -396
- package/dist/shared/components/chat/huddle/huddle-store.js +48 -43
- package/dist/shared/components/help-videos/api.js +2 -5
- package/dist/shared/components/help-videos/viewer/HelpVideoMatchChip.js +79 -0
- package/dist/shared/components/help-videos/viewer/matchChip.js +50 -0
- package/dist/shared/components/imports/CollectionImportPanel.js +139 -133
- package/dist/shared/components/imports/RunDetailSheet.js +222 -227
- package/dist/shared/components/integrations/console/ErrorExplanation.js +121 -0
- package/dist/shared/components/integrations/console/PartnerDetail.js +175 -174
- package/dist/shared/components/integrations/console/SubmissionRow.js +36 -34
- package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +50 -48
- package/dist/shared/components/item-edit/FieldComments.js +212 -0
- package/dist/shared/components/item-edit/FieldRow.js +340 -336
- package/dist/shared/components/item-edit/RecordHeaderActions.js +23 -22
- package/dist/shared/components/item-edit/RelationCombobox.js +231 -222
- package/dist/shared/components/item-edit/RuleHiddenNotes.js +55 -0
- package/dist/shared/components/item-edit/field-comments-context.js +6 -0
- package/dist/shared/components/item-edit/field-sources.js +33 -0
- package/dist/shared/components/item-edit/rule-hidden.js +30 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +113 -96
- package/dist/shared/components/layout-editor/editors/cascade-filters.js +170 -145
- package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +22 -18
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +177 -159
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +35 -34
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +124 -111
- package/dist/shared/components/layout-editor/inspector/kit.js +292 -277
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/list/CopyListLinkButton.js +41 -0
- package/dist/shared/components/list/InlineEdit.js +363 -0
- package/dist/shared/components/notifications/NotificationCenterView.js +213 -181
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -82
- package/dist/shared/components/notifications/NotificationRulesEditor.js +515 -0
- package/dist/shared/components/notifications/TestMyRules.js +137 -0
- package/dist/shared/components/notifications/changes-lines.js +24 -0
- package/dist/shared/components/notifications/why-lines.js +64 -0
- package/dist/shared/components/panels/CommentPanel.js +316 -281
- package/dist/shared/components/panels/LegalHoldBanner.js +38 -0
- package/dist/shared/components/panels/PipelinePanel.js +201 -196
- package/dist/shared/components/panels/RevisionsPanel.js +496 -479
- package/dist/shared/components/pipeline/PipelineEditorView.js +1587 -1560
- package/dist/shared/components/pipeline/PipelineStateOwners.js +116 -103
- package/dist/shared/components/profile/PersonDidPanel.js +188 -0
- package/dist/shared/components/profile/PersonProfile.js +57 -52
- package/dist/shared/components/queue/QueueWorklist.js +1526 -1365
- package/dist/shared/hooks/useSlowReason.js +39 -0
- package/dist/shared/lib/activity-sentence.js +670 -0
- package/dist/shared/lib/config-sentences.js +418 -0
- package/dist/shared/lib/core-glossary.js +229 -0
- package/dist/shared/lib/error-hints.js +159 -0
- package/dist/shared/lib/error-message.js +105 -0
- package/dist/shared/lib/error-toast.js +22 -0
- package/dist/shared/lib/field-comments.js +25 -0
- package/dist/shared/lib/filter-sentence.js +261 -0
- package/dist/shared/lib/glossary.js +55 -48
- package/dist/shared/lib/idle-reload.js +138 -0
- package/dist/shared/lib/layout-resolve.js +42 -29
- package/dist/shared/lib/list-inline-edit.js +190 -0
- package/dist/shared/lib/list-link.js +147 -0
- package/dist/shared/lib/nav-trail.js +107 -0
- package/dist/shared/lib/prefetch.js +259 -106
- package/dist/shared/lib/record-ref.js +72 -0
- package/dist/shared/lib/reload-holds.js +25 -0
- package/dist/shared/lib/safe-error.js +52 -24
- package/dist/shared/lib/skeleton-shapes.js +72 -0
- package/dist/shared/lib/slow-reason.js +63 -0
- package/package.json +1 -1
|
@@ -1,64 +1,71 @@
|
|
|
1
|
-
import { useState as h, useEffect as
|
|
2
|
-
import { useOptionalNivaroClient as
|
|
1
|
+
import { useState as h, useEffect as p } from "react";
|
|
2
|
+
import { useOptionalNivaroClient as y } from "../context.js";
|
|
3
3
|
import { get as d } from "./commands.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
import { mergeGlossary as w, CORE_GLOSSARY as $ } from "./core-glossary.js";
|
|
5
|
+
const k = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), u = /* @__PURE__ */ new WeakMap();
|
|
6
|
+
function C(e) {
|
|
7
|
+
let t = u.get(e);
|
|
8
|
+
if (!t) {
|
|
9
|
+
const o = /* @__PURE__ */ new Map();
|
|
10
|
+
for (const n of e)
|
|
11
|
+
for (const s of [n.term, ...n.aliases ?? []]) {
|
|
12
|
+
const i = s.trim().toLowerCase();
|
|
13
|
+
i.length >= 2 && !o.has(i) && o.set(i, n);
|
|
13
14
|
}
|
|
14
|
-
const
|
|
15
|
-
|
|
15
|
+
const r = [...o.keys()].sort((n, s) => s.length - n.length);
|
|
16
|
+
t = { re: r.length ? new RegExp(`(?<![\\p{L}\\p{N}])(${r.map(k).join("|")})(?![\\p{L}\\p{N}])`, "giu") : /$^/g, byForm: o }, u.set(e, t);
|
|
16
17
|
}
|
|
17
|
-
return
|
|
18
|
+
return t;
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
-
if (!e || !
|
|
21
|
-
const { re:
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
for (const
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
20
|
+
function R(e, t, o = {}) {
|
|
21
|
+
if (!e || !t.length) return [{ text: e }];
|
|
22
|
+
const { re: r, byForm: a } = C(t), n = [];
|
|
23
|
+
let s = 0;
|
|
24
|
+
r.lastIndex = 0;
|
|
25
|
+
for (const i of e.matchAll(r)) {
|
|
26
|
+
const c = a.get(i[1].toLowerCase());
|
|
27
|
+
if (!c || o.collection !== void 0 && c.collection && c.collection !== o.collection)
|
|
27
28
|
continue;
|
|
28
|
-
if (
|
|
29
|
-
if (
|
|
30
|
-
|
|
29
|
+
if (o.once) {
|
|
30
|
+
if (o.once.has(c.id)) continue;
|
|
31
|
+
o.once.add(c.id);
|
|
31
32
|
}
|
|
32
|
-
const l =
|
|
33
|
-
l >
|
|
33
|
+
const l = i.index ?? 0;
|
|
34
|
+
l > s && n.push({ text: e.slice(s, l) }), n.push({ text: i[0], term: c }), s = l + i[0].length;
|
|
34
35
|
}
|
|
35
|
-
return
|
|
36
|
+
return s < e.length && n.push({ text: e.slice(s) }), n.length ? n : [{ text: e }];
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
+
function _(e) {
|
|
38
39
|
return `${e.term}: ${e.definition}${e.query_note ? ` (${e.query_note})` : ""}`;
|
|
39
40
|
}
|
|
40
|
-
const
|
|
41
|
-
function
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
const
|
|
45
|
-
return
|
|
41
|
+
const L = 5 * 6e4, m = /* @__PURE__ */ new WeakMap(), f = [];
|
|
42
|
+
function M(e) {
|
|
43
|
+
const t = m.get(e);
|
|
44
|
+
if (t && Date.now() - t.at < L) return t.promise;
|
|
45
|
+
const o = e.request(d("/ai-knowledge/glossary")).then((r) => Array.isArray(r == null ? void 0 : r.data) ? r.data : f).catch(() => f);
|
|
46
|
+
return m.set(e, { at: Date.now(), promise: o }), o;
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
const g = /* @__PURE__ */ new WeakMap();
|
|
49
|
+
function G(e) {
|
|
50
|
+
let t = g.get(e);
|
|
51
|
+
return t || (t = w($, e), g.set(e, t)), t;
|
|
52
|
+
}
|
|
53
|
+
function q(e = {}) {
|
|
54
|
+
const t = y(), [o, r] = h(f);
|
|
55
|
+
return p(() => {
|
|
56
|
+
if (!t) return;
|
|
57
|
+
let a = !0;
|
|
58
|
+
return M(t).then((n) => {
|
|
59
|
+
a && r(n);
|
|
54
60
|
}), () => {
|
|
55
|
-
|
|
61
|
+
a = !1;
|
|
56
62
|
};
|
|
57
|
-
}, [
|
|
63
|
+
}, [t]), e.withCore ? G(o) : o;
|
|
58
64
|
}
|
|
59
65
|
export {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
R as glossarySegments,
|
|
67
|
+
_ as glossaryTip,
|
|
68
|
+
M as loadGlossary,
|
|
69
|
+
q as useGlossary,
|
|
70
|
+
G as withCoreGlossary
|
|
64
71
|
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
const I = 60, b = 18e4, O = 9e5, C = 36e5, v = 9e5, M = 1;
|
|
2
|
+
function _(e) {
|
|
3
|
+
var t;
|
|
4
|
+
const n = Number((t = e == null ? void 0 : e.auto_reload) == null ? void 0 : t.idle_seconds);
|
|
5
|
+
return (Number.isFinite(n) && n > 0 ? n : 60) * 1e3;
|
|
6
|
+
}
|
|
7
|
+
function p(e, n) {
|
|
8
|
+
var t;
|
|
9
|
+
return e && !((t = e.auto_reload) != null && t.enabled) || n >= 36e5 ? 9e5 : 18e4;
|
|
10
|
+
}
|
|
11
|
+
function N(e) {
|
|
12
|
+
var o;
|
|
13
|
+
if (e.declined) return { action: "wait", reason: "declined" };
|
|
14
|
+
const n = e.now - e.lastInput;
|
|
15
|
+
if (n < _(e.status)) return { action: "wait", reason: "active" };
|
|
16
|
+
if (e.unsaved.length > 0) return { action: "wait", reason: "unsaved" };
|
|
17
|
+
if (e.holds.length > 0) return { action: "wait", reason: "held" };
|
|
18
|
+
const t = e.status;
|
|
19
|
+
return !t || e.now - e.statusAt >= p(t, n) ? { action: "check" } : (o = t.auto_reload) != null && o.enabled ? !t.older || !t.id ? { action: "wait", reason: "current" } : e.reloadedFor(t.id) >= 1 ? { action: "wait", reason: "already" } : { action: "reload", id: t.id } : { action: "wait", reason: "off" };
|
|
20
|
+
}
|
|
21
|
+
const S = ["keydown", "pointerdown", "touchstart", "wheel", "input"];
|
|
22
|
+
let f = Date.now(), d = !1;
|
|
23
|
+
function A() {
|
|
24
|
+
if (d || typeof window > "u") return;
|
|
25
|
+
d = !0;
|
|
26
|
+
const e = () => {
|
|
27
|
+
f = Date.now();
|
|
28
|
+
};
|
|
29
|
+
for (const n of S) window.addEventListener(n, e, { passive: !0, capture: !0 });
|
|
30
|
+
}
|
|
31
|
+
function T() {
|
|
32
|
+
return f;
|
|
33
|
+
}
|
|
34
|
+
const a = "nvr-idle-reload-scroll", L = 2 * 6e4, h = 8e3, y = 12;
|
|
35
|
+
function R(e) {
|
|
36
|
+
if (e.id) return `#${e.id}`;
|
|
37
|
+
const n = [];
|
|
38
|
+
let t = e;
|
|
39
|
+
for (; t && t !== document.body; ) {
|
|
40
|
+
const o = t.parentElement;
|
|
41
|
+
if (!o) return null;
|
|
42
|
+
n.unshift(Array.prototype.indexOf.call(o.children, t)), t = o;
|
|
43
|
+
}
|
|
44
|
+
return t === document.body ? `>${n.join(">")}` : null;
|
|
45
|
+
}
|
|
46
|
+
function m(e) {
|
|
47
|
+
if (e.startsWith("#")) return document.getElementById(e.slice(1));
|
|
48
|
+
if (!e.startsWith(">")) return null;
|
|
49
|
+
let n = document.body;
|
|
50
|
+
for (const t of e.slice(1).split(">")) {
|
|
51
|
+
const o = Number(t);
|
|
52
|
+
if (!n || t === "" || !Number.isInteger(o)) return null;
|
|
53
|
+
n = n.children[o] ?? null;
|
|
54
|
+
}
|
|
55
|
+
return n;
|
|
56
|
+
}
|
|
57
|
+
function w() {
|
|
58
|
+
return `${window.location.pathname}${window.location.search}`;
|
|
59
|
+
}
|
|
60
|
+
function g() {
|
|
61
|
+
try {
|
|
62
|
+
const e = [];
|
|
63
|
+
for (const t of document.querySelectorAll("body *")) {
|
|
64
|
+
if (e.length >= y) break;
|
|
65
|
+
if (t.scrollTop <= 0 && t.scrollLeft <= 0) continue;
|
|
66
|
+
const o = R(t);
|
|
67
|
+
o && e.push({ key: o, top: t.scrollTop, left: t.scrollLeft });
|
|
68
|
+
}
|
|
69
|
+
const n = {
|
|
70
|
+
path: w(),
|
|
71
|
+
at: Date.now(),
|
|
72
|
+
window: { x: window.scrollX, y: window.scrollY },
|
|
73
|
+
boxes: e
|
|
74
|
+
};
|
|
75
|
+
sessionStorage.setItem(a, JSON.stringify(n));
|
|
76
|
+
} catch {
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function D(e, n, t = Date.now()) {
|
|
80
|
+
if (!e) return null;
|
|
81
|
+
try {
|
|
82
|
+
const o = JSON.parse(e);
|
|
83
|
+
return !o || o.path !== n || typeof o.at != "number" || t - o.at > L || t < o.at - 5e3 ? null : { ...o, boxes: Array.isArray(o.boxes) ? o.boxes : [] };
|
|
84
|
+
} catch {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function F() {
|
|
89
|
+
if (typeof window > "u") return () => {
|
|
90
|
+
};
|
|
91
|
+
let e = null;
|
|
92
|
+
try {
|
|
93
|
+
e = D(sessionStorage.getItem(a), w()), sessionStorage.removeItem(a);
|
|
94
|
+
} catch {
|
|
95
|
+
e = null;
|
|
96
|
+
}
|
|
97
|
+
if (!e) return () => {
|
|
98
|
+
};
|
|
99
|
+
const n = e, t = new Map(n.boxes.map((r) => [r.key, r]));
|
|
100
|
+
let o = n.window.y <= 0 && n.window.x <= 0, s = !1;
|
|
101
|
+
const l = () => {
|
|
102
|
+
s = !0;
|
|
103
|
+
};
|
|
104
|
+
window.addEventListener("pointerdown", l, { once: !0, capture: !0 }), window.addEventListener("keydown", l, { once: !0, capture: !0 }), window.addEventListener("wheel", l, { once: !0, capture: !0, passive: !0 });
|
|
105
|
+
const E = Date.now(), u = () => {
|
|
106
|
+
if (!s) {
|
|
107
|
+
o || (window.scrollTo(n.window.x, n.window.y), o = Math.abs(window.scrollY - n.window.y) < 2);
|
|
108
|
+
for (const [r, c] of t) {
|
|
109
|
+
const i = m(r);
|
|
110
|
+
!i || i.scrollHeight - i.clientHeight < c.top - 1 || (i.scrollTop = c.top, i.scrollLeft = c.left, t.delete(r));
|
|
111
|
+
}
|
|
112
|
+
if (o && t.size === 0 || Date.now() - E > h) {
|
|
113
|
+
s = !0;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
setTimeout(u, 200);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
return setTimeout(u, 0), l;
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
O as CHECK_EVERY_LONG_IDLE_MS,
|
|
123
|
+
b as CHECK_EVERY_MS,
|
|
124
|
+
v as CHECK_EVERY_WHEN_OFF_MS,
|
|
125
|
+
I as DEFAULT_IDLE_SECONDS,
|
|
126
|
+
M as IDLE_RELOADS_PER_TARGET,
|
|
127
|
+
C as LONG_IDLE_MS,
|
|
128
|
+
p as checkEveryMs,
|
|
129
|
+
N as decideIdleReload,
|
|
130
|
+
R as domPathKey,
|
|
131
|
+
m as findByDomPathKey,
|
|
132
|
+
_ as idleMsFor,
|
|
133
|
+
T as lastIdleReloadInput,
|
|
134
|
+
F as restoreScrollAfterReload,
|
|
135
|
+
g as saveScrollForReload,
|
|
136
|
+
A as trackIdleReloadInput,
|
|
137
|
+
D as usableScroll
|
|
138
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const a = /^\d{4}-\d{2}-\d{2}$/,
|
|
1
|
+
const a = /^\d{4}-\d{2}-\d{2}$/, f = (t) => typeof t == "string" && a.test(t);
|
|
2
2
|
function o(t) {
|
|
3
3
|
let n = t;
|
|
4
4
|
if (typeof n == "string")
|
|
@@ -21,13 +21,13 @@ function w(t) {
|
|
|
21
21
|
var i;
|
|
22
22
|
const n = o((i = o(t)) == null ? void 0 : i.active_window);
|
|
23
23
|
if (!n) return null;
|
|
24
|
-
const e =
|
|
24
|
+
const e = f(n.from) ? n.from : null, r = f(n.until) ? n.until : null;
|
|
25
25
|
return e || r ? { from: e, until: r } : null;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function _(t, n) {
|
|
28
28
|
return t ? t.from && n < t.from ? "before" : t.until && n > t.until ? "after" : "open" : null;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function c(t) {
|
|
31
31
|
return (/* @__PURE__ */ new Date(`${t}T00:00:00Z`)).toLocaleDateString(void 0, {
|
|
32
32
|
day: "numeric",
|
|
33
33
|
month: "short",
|
|
@@ -35,10 +35,10 @@ function l(t) {
|
|
|
35
35
|
timeZone: "UTC"
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
return t.from && t.until ? `${
|
|
38
|
+
function O(t) {
|
|
39
|
+
return t.from && t.until ? `${c(t.from)} – ${c(t.until)}` : t.from ? `from ${c(t.from)}` : `until ${c(t.until)}`;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function x(t, n) {
|
|
42
42
|
const e = n.from || null, r = n.until || null;
|
|
43
43
|
return {
|
|
44
44
|
conditions: u(
|
|
@@ -53,10 +53,10 @@ function d(t) {
|
|
|
53
53
|
const n = Number((e = o(t)) == null ? void 0 : e.phone_of);
|
|
54
54
|
return Number.isInteger(n) && n > 0 ? n : null;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function S(t, n) {
|
|
57
57
|
return { conditions: u(t, "phone_of", n) };
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function h(t) {
|
|
60
60
|
var e;
|
|
61
61
|
const n = Number((e = o(t)) == null ? void 0 : e.tablet_of);
|
|
62
62
|
return Number.isInteger(n) && n > 0 ? n : null;
|
|
@@ -65,12 +65,12 @@ function v(t, n) {
|
|
|
65
65
|
return { conditions: u(t, "tablet_of", n) };
|
|
66
66
|
}
|
|
67
67
|
function z(t) {
|
|
68
|
-
return d(t) ??
|
|
68
|
+
return d(t) ?? h(t);
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function m(t) {
|
|
71
71
|
var e;
|
|
72
72
|
const n = o((e = o(t)) == null ? void 0 : e.freeze);
|
|
73
|
-
return !n || !
|
|
73
|
+
return !n || !f(n.until) ? null : {
|
|
74
74
|
until: n.until,
|
|
75
75
|
reason: typeof n.reason == "string" ? n.reason : "",
|
|
76
76
|
by: typeof n.by == "string" ? n.by : null,
|
|
@@ -79,10 +79,10 @@ function h(t) {
|
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
function $(t, n = s()) {
|
|
82
|
-
const e =
|
|
82
|
+
const e = m(t);
|
|
83
83
|
return e && n < e.until ? e : null;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function A(t, n) {
|
|
86
86
|
return { conditions: u(t, "freeze", n) };
|
|
87
87
|
}
|
|
88
88
|
function y(t) {
|
|
@@ -91,37 +91,50 @@ function y(t) {
|
|
|
91
91
|
return Array.isArray(n) ? [...new Set(n.filter((r) => typeof r == "string"))] : [];
|
|
92
92
|
}
|
|
93
93
|
function D(t, n, e) {
|
|
94
|
-
const r = y(t).filter((
|
|
94
|
+
const r = y(t).filter((l) => l !== n), i = e ? [...r, n] : r;
|
|
95
95
|
return { conditions: u(t, "lazy_sections", i.length ? i : null) };
|
|
96
96
|
}
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
function p(t) {
|
|
98
|
+
var e;
|
|
99
|
+
const n = (e = o(t)) == null ? void 0 : e.quiet_hidden_sections;
|
|
100
|
+
return Array.isArray(n) ? [...new Set(n.filter((r) => typeof r == "string"))] : [];
|
|
101
|
+
}
|
|
102
|
+
function P(t, n, e) {
|
|
103
|
+
const r = p(t).filter((l) => l !== n), i = e ? r : [...r, n];
|
|
104
|
+
return {
|
|
105
|
+
conditions: u(t, "quiet_hidden_sections", i.length ? i : null)
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const b = "(max-width: 639px)", g = "(min-width: 640px) and (max-width: 1023px), (min-width: 640px) and (max-width: 1366px) and (hover: none) and (pointer: coarse)";
|
|
109
|
+
function N() {
|
|
99
110
|
try {
|
|
100
|
-
return typeof window > "u" || !window.matchMedia ? null : window.matchMedia(
|
|
111
|
+
return typeof window > "u" || !window.matchMedia ? null : window.matchMedia(b).matches ? "phone" : window.matchMedia(g).matches ? "tablet" : null;
|
|
101
112
|
} catch {
|
|
102
113
|
return null;
|
|
103
114
|
}
|
|
104
115
|
}
|
|
105
116
|
export {
|
|
106
|
-
|
|
107
|
-
|
|
117
|
+
b as PHONE_QUERY,
|
|
118
|
+
g as TABLET_QUERY,
|
|
108
119
|
$ as activeFreeze,
|
|
109
120
|
w as activeWindowOf,
|
|
110
|
-
|
|
121
|
+
x as activeWindowPatch,
|
|
111
122
|
o as conditionsObject,
|
|
112
123
|
u as conditionsWithKey,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
124
|
+
N as currentViewport,
|
|
125
|
+
c as dayWords,
|
|
126
|
+
m as freezeOf,
|
|
127
|
+
A as freezePatch,
|
|
117
128
|
D as lazySectionPatch,
|
|
118
129
|
y as lazySectionsOf,
|
|
119
130
|
s as localDay,
|
|
120
131
|
d as phoneOf,
|
|
121
|
-
|
|
132
|
+
S as phoneOfPatch,
|
|
133
|
+
P as quietHiddenSectionPatch,
|
|
134
|
+
p as quietHiddenSectionsOf,
|
|
122
135
|
z as screenVersionOf,
|
|
123
|
-
|
|
136
|
+
h as tabletOf,
|
|
124
137
|
v as tabletOfPatch,
|
|
125
|
-
|
|
126
|
-
|
|
138
|
+
_ as windowState,
|
|
139
|
+
O as windowWords
|
|
127
140
|
};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
const f = { enabled: !1, fields: [] }, c = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
2
|
+
function A(t) {
|
|
3
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return f;
|
|
4
|
+
const n = t, r = Array.isArray(n.fields) ? [
|
|
5
|
+
...new Set(
|
|
6
|
+
n.fields.filter(
|
|
7
|
+
(e) => typeof e == "string" && c.test(e) && e !== "id" && !e.startsWith("__")
|
|
8
|
+
)
|
|
9
|
+
)
|
|
10
|
+
].slice(0, 200) : [];
|
|
11
|
+
return { enabled: n.enabled === !0, fields: r };
|
|
12
|
+
}
|
|
13
|
+
const m = /* @__PURE__ */ new Set([
|
|
14
|
+
"id",
|
|
15
|
+
"date_created",
|
|
16
|
+
"date_updated",
|
|
17
|
+
"user_created",
|
|
18
|
+
"user_updated",
|
|
19
|
+
"created_at",
|
|
20
|
+
"updated_at"
|
|
21
|
+
]), g = /* @__PURE__ */ new Set([
|
|
22
|
+
"alias",
|
|
23
|
+
"o2m",
|
|
24
|
+
"m2m",
|
|
25
|
+
"m2a",
|
|
26
|
+
"files",
|
|
27
|
+
"file",
|
|
28
|
+
"translations",
|
|
29
|
+
"group",
|
|
30
|
+
"no-data",
|
|
31
|
+
"date-created",
|
|
32
|
+
"date-updated",
|
|
33
|
+
"user-created",
|
|
34
|
+
"user-updated",
|
|
35
|
+
"cast-json",
|
|
36
|
+
"uuid",
|
|
37
|
+
"hash",
|
|
38
|
+
"conceal",
|
|
39
|
+
"auto-id"
|
|
40
|
+
]), p = /* @__PURE__ */ new Set([
|
|
41
|
+
"input-rich-text-html",
|
|
42
|
+
"input-rich-text-md",
|
|
43
|
+
"input-markdown",
|
|
44
|
+
"rich-text",
|
|
45
|
+
"wysiwyg",
|
|
46
|
+
"markdown",
|
|
47
|
+
"input-code",
|
|
48
|
+
"code",
|
|
49
|
+
"json",
|
|
50
|
+
"tags",
|
|
51
|
+
"list",
|
|
52
|
+
"map",
|
|
53
|
+
"file",
|
|
54
|
+
"file-image",
|
|
55
|
+
"files",
|
|
56
|
+
"image",
|
|
57
|
+
"checklist",
|
|
58
|
+
"repeater",
|
|
59
|
+
"matrix",
|
|
60
|
+
"address",
|
|
61
|
+
"signature",
|
|
62
|
+
"duration",
|
|
63
|
+
"color",
|
|
64
|
+
"rating",
|
|
65
|
+
"progress",
|
|
66
|
+
"auto-id",
|
|
67
|
+
"formula"
|
|
68
|
+
]), S = /* @__PURE__ */ new Set(["integer", "bigInteger", "int", "bigint", "smallint", "tinyint"]), y = /* @__PURE__ */ new Set([
|
|
69
|
+
"float",
|
|
70
|
+
"decimal",
|
|
71
|
+
"numeric",
|
|
72
|
+
"real",
|
|
73
|
+
"money",
|
|
74
|
+
"smallmoney",
|
|
75
|
+
"double",
|
|
76
|
+
"number"
|
|
77
|
+
]);
|
|
78
|
+
function _(t) {
|
|
79
|
+
const n = t.special;
|
|
80
|
+
return Array.isArray(n) ? n.map(String) : typeof n == "string" && n.trim() ? n.split(",").map((r) => r.trim()) : [];
|
|
81
|
+
}
|
|
82
|
+
function d(t) {
|
|
83
|
+
const n = t.options;
|
|
84
|
+
if (n && typeof n == "object" && !Array.isArray(n)) return n;
|
|
85
|
+
if (typeof n == "string" && n.trim().startsWith("{"))
|
|
86
|
+
try {
|
|
87
|
+
const r = JSON.parse(n);
|
|
88
|
+
return r && typeof r == "object" ? r : null;
|
|
89
|
+
} catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
function b(t) {
|
|
95
|
+
var r;
|
|
96
|
+
const n = (r = d(t)) == null ? void 0 : r.choices;
|
|
97
|
+
return Array.isArray(n) ? n.filter((e) => !!e && typeof e == "object").filter((e) => e.value != null && String(e.value) !== "").map((e) => ({ value: String(e.value), label: String(e.text ?? e.value) })) : [];
|
|
98
|
+
}
|
|
99
|
+
function h(t, n, r) {
|
|
100
|
+
const e = t.find(
|
|
101
|
+
(i) => i.many_collection === n && i.many_field === r && !i.junction_field && !!i.one_collection
|
|
102
|
+
);
|
|
103
|
+
return (e == null ? void 0 : e.one_collection) ?? null;
|
|
104
|
+
}
|
|
105
|
+
function N(t, n, r) {
|
|
106
|
+
var s;
|
|
107
|
+
if (!t || !c.test(t.field) || m.has(t.field) || t.readonly || t.computed_formula || t.computed_type) return null;
|
|
108
|
+
const e = String(t.type ?? "");
|
|
109
|
+
if (e === "alias" || _(t).some((a) => g.has(a)) || r.some((a) => a.one_collection === n && a.one_field === t.field)) return null;
|
|
110
|
+
const u = h(r, n, t.field);
|
|
111
|
+
if (u)
|
|
112
|
+
return u === "nivaro_files" || u === "directus_files" ? null : "m2o";
|
|
113
|
+
const l = String(t.interface ?? "");
|
|
114
|
+
return p.has(l) ? null : (l === "select-dropdown" || l === "radio-buttons") && b(t).length > 0 ? "choice" : e === "boolean" || l === "boolean" || l === "toggle" ? "boolean" : S.has(e) ? "integer" : y.has(e) ? "number" : e === "date" ? "date" : e === "datetime" || e === "dateTime" || e === "timestamp" ? ((s = d(t)) == null ? void 0 : s.date_mode) === "date" ? "date" : "datetime" : e === "string" ? l === "input-multiline" || l === "textarea" ? "longtext" : "text" : e === "text" ? "longtext" : null;
|
|
115
|
+
}
|
|
116
|
+
function E(t) {
|
|
117
|
+
const { config: n, key: r } = t;
|
|
118
|
+
return !n.enabled || !t.mayUpdate || !n.fields.includes(r) ? null : N(t.field, t.collection, t.relations);
|
|
119
|
+
}
|
|
120
|
+
const o = (t) => String(t).padStart(2, "0");
|
|
121
|
+
function I(t, n) {
|
|
122
|
+
if (n == null) return "";
|
|
123
|
+
if (t === "date") return String(n).slice(0, 10);
|
|
124
|
+
if (t === "datetime") {
|
|
125
|
+
const r = new Date(String(n));
|
|
126
|
+
return Number.isNaN(r.getTime()) ? "" : `${r.getFullYear()}-${o(r.getMonth() + 1)}-${o(r.getDate())}T${o(r.getHours())}:${o(r.getMinutes())}`;
|
|
127
|
+
}
|
|
128
|
+
return t === "boolean" ? n === !0 || n === 1 || n === "1" ? "true" : "false" : String(n);
|
|
129
|
+
}
|
|
130
|
+
function k(t, n) {
|
|
131
|
+
const r = n ?? "", e = r.trim();
|
|
132
|
+
switch (t) {
|
|
133
|
+
case "text":
|
|
134
|
+
return { ok: !0, value: e === "" ? null : r };
|
|
135
|
+
case "longtext":
|
|
136
|
+
return { ok: !0, value: e === "" ? null : r };
|
|
137
|
+
case "integer": {
|
|
138
|
+
if (e === "") return { ok: !0, value: null };
|
|
139
|
+
const i = e.replace(/,/g, "");
|
|
140
|
+
if (!/^-?\d+$/.test(i)) return { ok: !1, error: "Enter a whole number" };
|
|
141
|
+
const u = Number(i);
|
|
142
|
+
return Number.isSafeInteger(u) ? { ok: !0, value: u } : { ok: !1, error: "That number is too large" };
|
|
143
|
+
}
|
|
144
|
+
case "number": {
|
|
145
|
+
if (e === "") return { ok: !0, value: null };
|
|
146
|
+
const i = e.replace(/,/g, "").replace(/^\$/, ""), u = Number(i);
|
|
147
|
+
return i === "" || !Number.isFinite(u) ? { ok: !1, error: "Enter a number" } : { ok: !0, value: u };
|
|
148
|
+
}
|
|
149
|
+
case "date":
|
|
150
|
+
return e === "" ? { ok: !0, value: null } : /^\d{4}-\d{2}-\d{2}$/.test(e) ? { ok: !0, value: e } : { ok: !1, error: "Enter a date" };
|
|
151
|
+
case "datetime": {
|
|
152
|
+
if (e === "") return { ok: !0, value: null };
|
|
153
|
+
const i = new Date(e);
|
|
154
|
+
return Number.isNaN(i.getTime()) ? { ok: !1, error: "Enter a date and time" } : { ok: !0, value: i.toISOString() };
|
|
155
|
+
}
|
|
156
|
+
case "boolean":
|
|
157
|
+
return e === "" ? { ok: !0, value: null } : { ok: !0, value: e === "true" };
|
|
158
|
+
case "choice":
|
|
159
|
+
case "m2o":
|
|
160
|
+
return { ok: !0, value: e === "" ? null : r };
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function x(t, n, r) {
|
|
164
|
+
if (n == null && r == null) return !0;
|
|
165
|
+
if (n == null || r == null) return !1;
|
|
166
|
+
if (t === "datetime")
|
|
167
|
+
return new Date(String(n)).getTime() === new Date(String(r)).getTime();
|
|
168
|
+
if (t === "date") return String(n).slice(0, 10) === String(r).slice(0, 10);
|
|
169
|
+
if (t === "boolean") {
|
|
170
|
+
const e = (i) => i === !0 || i === 1 || i === "1" || i === "true";
|
|
171
|
+
return e(n) === e(r);
|
|
172
|
+
}
|
|
173
|
+
return t === "integer" || t === "number" ? Number(n) === Number(r) : String(n) === String(r);
|
|
174
|
+
}
|
|
175
|
+
function w(t, n, r) {
|
|
176
|
+
const e = t.indexOf(n);
|
|
177
|
+
return e < 0 ? null : t[e + r] ?? null;
|
|
178
|
+
}
|
|
179
|
+
export {
|
|
180
|
+
f as INLINE_EDIT_OFF,
|
|
181
|
+
b as inlineChoices,
|
|
182
|
+
E as inlineEditFor,
|
|
183
|
+
N as inlineEditorKind,
|
|
184
|
+
I as inlineInputValue,
|
|
185
|
+
h as inlineM2oTarget,
|
|
186
|
+
x as inlineValueUnchanged,
|
|
187
|
+
w as nextInlineKey,
|
|
188
|
+
A as normalizeInlineEdit,
|
|
189
|
+
k as parseInlineInput
|
|
190
|
+
};
|