@nivaro/react 0.3.12 → 0.3.14
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/slots/pipeline/OwnersSection.js +79 -75
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +50 -2
- package/dist/index.js +601 -596
- package/dist/shared/components/CollectionBrowserView.js +2373 -2298
- package/dist/shared/components/DataTable.js +347 -335
- package/dist/shared/components/ItemEditForm.js +5278 -5149
- package/dist/shared/components/ListLoadError.js +33 -0
- package/dist/shared/components/PageRenderer.js +562 -529
- package/dist/shared/components/ProfileView.js +53 -51
- package/dist/shared/components/RecordReadView.js +119 -117
- package/dist/shared/components/ReportView.js +1268 -1241
- package/dist/shared/components/cbv/export-rows.js +69 -0
- package/dist/shared/components/cbv/saved-view-risk.js +35 -0
- package/dist/shared/components/cbv/unknown-fields.js +18 -0
- package/dist/shared/components/integrations/console/AlertsView.js +27 -25
- package/dist/shared/components/integrations/console/EventsView.js +244 -209
- package/dist/shared/components/item-edit/CatalogPickerField.js +946 -878
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +84 -57
- package/dist/shared/components/item-edit/FieldAffordances.js +63 -61
- package/dist/shared/components/item-edit/FieldRow.js +195 -179
- package/dist/shared/components/item-edit/FilePickerField.js +257 -254
- package/dist/shared/components/item-edit/HeaderTools.js +139 -95
- package/dist/shared/components/item-edit/InlineTableField.js +2087 -2075
- package/dist/shared/components/item-edit/RecordLiveSync.js +196 -181
- package/dist/shared/components/item-edit/RowComments.js +1 -3
- package/dist/shared/components/item-edit/SummaryPanel.js +62 -62
- package/dist/shared/components/item-edit/UserChip.js +113 -113
- package/dist/shared/components/item-edit/file-download.js +18 -0
- package/dist/shared/components/item-edit/line-qty.js +67 -32
- package/dist/shared/components/item-edit/save-refusal.js +23 -0
- package/dist/shared/components/monitoring/TrafficMiniMap.js +9 -9
- package/dist/shared/components/panels/CommentPanel.js +30 -30
- package/dist/shared/components/panels/ItemLockBanner.js +207 -185
- package/dist/shared/components/panels/PipelinePanel.js +915 -786
- package/dist/shared/components/pipeline/PipelineEditorView.js +45 -25
- package/dist/shared/components/profile/DelegationCard.js +1 -1
- package/dist/shared/components/profile/session-actions.js +24 -24
- package/dist/shared/components/queue/QueueItemSheet.js +18 -18
- package/dist/shared/components/queue/QueueWorklist.js +517 -504
- package/dist/shared/components/ui/dropdown-menu.js +8 -7
- package/dist/shared/context.js +71 -66
- package/dist/shared/lib/draft-store.js +60 -33
- package/dist/shared/lib/leave-guard.js +38 -0
- package/dist/shared/lib/load-error.js +38 -17
- package/dist/shared/lib/summary-mode.js +25 -25
- package/dist/shared/lib/table-pins.js +23 -0
- package/dist/shared/lib/validation-rules.js +55 -51
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
1
|
+
import { jsx as n, jsxs as p } from "react/jsx-runtime";
|
|
2
2
|
import * as e from "@radix-ui/react-dropdown-menu";
|
|
3
|
-
import { ChevronRight as c, Check as
|
|
3
|
+
import { ChevronRight as c, Check as l } from "lucide-react";
|
|
4
4
|
import * as s from "react";
|
|
5
5
|
import { cn as d } from "../../lib/utils.js";
|
|
6
|
-
const v = e.Root, C = e.Trigger,
|
|
6
|
+
const v = e.Root, C = e.Trigger, D = e.Group, i = s.forwardRef(({ className: o, inset: t, children: a, ...r }, m) => /* @__PURE__ */ p(
|
|
7
7
|
e.SubTrigger,
|
|
8
8
|
{
|
|
9
9
|
ref: m,
|
|
@@ -19,7 +19,7 @@ const v = e.Root, C = e.Trigger, p = s.forwardRef(({ className: o, inset: t, chi
|
|
|
19
19
|
]
|
|
20
20
|
}
|
|
21
21
|
));
|
|
22
|
-
|
|
22
|
+
i.displayName = e.SubTrigger.displayName;
|
|
23
23
|
const u = s.forwardRef(({ className: o, ...t }, a) => /* @__PURE__ */ n(
|
|
24
24
|
e.SubContent,
|
|
25
25
|
{
|
|
@@ -58,7 +58,7 @@ const g = s.forwardRef(({ className: o, inset: t, ...a }, r) => /* @__PURE__ */
|
|
|
58
58
|
}
|
|
59
59
|
));
|
|
60
60
|
g.displayName = e.Item.displayName;
|
|
61
|
-
const w = s.forwardRef(({ className: o, children: t, checked: a, ...r }, m) => /* @__PURE__ */
|
|
61
|
+
const w = s.forwardRef(({ className: o, children: t, checked: a, ...r }, m) => /* @__PURE__ */ p(
|
|
62
62
|
e.CheckboxItem,
|
|
63
63
|
{
|
|
64
64
|
ref: m,
|
|
@@ -69,7 +69,7 @@ const w = s.forwardRef(({ className: o, children: t, checked: a, ...r }, m) => /
|
|
|
69
69
|
checked: a,
|
|
70
70
|
...r,
|
|
71
71
|
children: [
|
|
72
|
-
/* @__PURE__ */ n("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ n(e.ItemIndicator, { children: /* @__PURE__ */ n(
|
|
72
|
+
/* @__PURE__ */ n("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ n(e.ItemIndicator, { children: /* @__PURE__ */ n(l, { className: "h-4 w-4" }) }) }),
|
|
73
73
|
t
|
|
74
74
|
]
|
|
75
75
|
}
|
|
@@ -97,10 +97,11 @@ export {
|
|
|
97
97
|
v as DropdownMenu,
|
|
98
98
|
w as DropdownMenuCheckboxItem,
|
|
99
99
|
f as DropdownMenuContent,
|
|
100
|
+
D as DropdownMenuGroup,
|
|
100
101
|
g as DropdownMenuItem,
|
|
101
102
|
b as DropdownMenuLabel,
|
|
102
103
|
N as DropdownMenuSeparator,
|
|
103
104
|
u as DropdownMenuSubContent,
|
|
104
|
-
|
|
105
|
+
i as DropdownMenuSubTrigger,
|
|
105
106
|
C as DropdownMenuTrigger
|
|
106
107
|
};
|
package/dist/shared/context.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { jsxs as b, jsx as f } from "react/jsx-runtime";
|
|
2
2
|
import { QueryClientContext as v, QueryClient as w, QueryClientProvider as g, useQueryClient as C } from "@tanstack/react-query";
|
|
3
3
|
import { createContext as i, useContext as l, useState as m, useMemo as x, useCallback as h, useEffect as y } from "react";
|
|
4
|
-
import { restoreMetadata as
|
|
5
|
-
import { isCoalesced as
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
return l(
|
|
4
|
+
import { restoreMetadata as S, startMetadataPersistence as I } from "./lib/metadata-persist.js";
|
|
5
|
+
import { isCoalesced as N, withGetCoalescing as O, releaseGatedReadsOnSharedFetch as P } from "./lib/request-gate.js";
|
|
6
|
+
const R = i(null);
|
|
7
|
+
function L() {
|
|
8
|
+
return l(R);
|
|
9
9
|
}
|
|
10
10
|
const p = i(null);
|
|
11
|
-
function
|
|
11
|
+
function F({ identity: e }) {
|
|
12
12
|
const t = C(), { userId: n, epoch: o, version: r } = e;
|
|
13
13
|
return y(() => {
|
|
14
14
|
let u = () => {
|
|
15
15
|
}, c = !1;
|
|
16
|
-
return
|
|
17
|
-
c || (u =
|
|
16
|
+
return S(t, { userId: n, epoch: o, version: r }).then(() => {
|
|
17
|
+
c || (u = I(t, { userId: n, epoch: o, version: r }));
|
|
18
18
|
}), () => {
|
|
19
19
|
c = !0, u();
|
|
20
20
|
};
|
|
21
21
|
}, [t, n, o, r]), null;
|
|
22
22
|
}
|
|
23
23
|
const d = /* @__PURE__ */ new WeakMap();
|
|
24
|
-
function
|
|
24
|
+
function $() {
|
|
25
25
|
const e = C();
|
|
26
26
|
return y(() => {
|
|
27
27
|
const t = e.getQueryCache(), n = d.get(t);
|
|
28
|
-
return n ? n.count++ : d.set(t, { count: 1, stop:
|
|
28
|
+
return n ? n.count++ : d.set(t, { count: 1, stop: P(t) }), () => {
|
|
29
29
|
const o = d.get(t);
|
|
30
30
|
o && (o.count--, o.count <= 0 && (o.stop(), d.delete(t)));
|
|
31
31
|
};
|
|
32
32
|
}, [e]), null;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function K({
|
|
35
35
|
client: e,
|
|
36
36
|
children: t,
|
|
37
37
|
batchReads: n = !1,
|
|
@@ -42,38 +42,38 @@ function L({
|
|
|
42
42
|
defaultOptions: { queries: { retry: 1, refetchOnWindowFocus: !1 } }
|
|
43
43
|
})
|
|
44
44
|
), c = x(
|
|
45
|
-
() =>
|
|
45
|
+
() => N(e) ? e : O(e, { batchReads: n }),
|
|
46
46
|
[e, n]
|
|
47
47
|
), s = /* @__PURE__ */ b(p.Provider, { value: { client: c }, children: [
|
|
48
|
-
o ? /* @__PURE__ */ f(
|
|
49
|
-
typeof e.setOpen == "function" ? /* @__PURE__ */ f(
|
|
48
|
+
o ? /* @__PURE__ */ f(F, { identity: o }) : null,
|
|
49
|
+
typeof e.setOpen == "function" ? /* @__PURE__ */ f($, {}) : null,
|
|
50
50
|
t
|
|
51
51
|
] });
|
|
52
52
|
return r ? s : /* @__PURE__ */ f(g, { client: u, children: s });
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function X() {
|
|
55
55
|
const e = l(p);
|
|
56
56
|
if (!e) throw new Error("useNivaroClient must be used within <NivaroProvider>");
|
|
57
57
|
return e.client;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function j() {
|
|
60
60
|
const e = l(p);
|
|
61
61
|
return (e == null ? void 0 : e.client) ?? null;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
const e =
|
|
63
|
+
function Y() {
|
|
64
|
+
const e = j(), t = e == null ? void 0 : e.getToken();
|
|
65
65
|
return {
|
|
66
66
|
apiBase: e ? `${e.url}/api` : "/api",
|
|
67
67
|
authHeaders: t ? { Authorization: `Bearer ${t}` } : {},
|
|
68
68
|
credentials: t ? "omit" : "include"
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
const
|
|
71
|
+
const D = i({
|
|
72
72
|
isAdmin: !1,
|
|
73
73
|
userId: ""
|
|
74
74
|
});
|
|
75
|
-
function
|
|
76
|
-
return l(
|
|
75
|
+
function Z() {
|
|
76
|
+
return l(D);
|
|
77
77
|
}
|
|
78
78
|
function A(e) {
|
|
79
79
|
const t = JSON.stringify(e), n = new TextEncoder().encode(t);
|
|
@@ -81,7 +81,7 @@ function A(e) {
|
|
|
81
81
|
for (const r of n) o += String.fromCharCode(r);
|
|
82
82
|
return encodeURIComponent(btoa(o));
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function ee(e) {
|
|
85
85
|
if (!e) return null;
|
|
86
86
|
try {
|
|
87
87
|
const t = atob(e.replace(/ /g, "+")), n = Uint8Array.from(t, (r) => r.charCodeAt(0)), o = JSON.parse(new TextDecoder().decode(n));
|
|
@@ -99,43 +99,46 @@ const Q = i({
|
|
|
99
99
|
navigate: (e) => {
|
|
100
100
|
window.location.href = e;
|
|
101
101
|
}
|
|
102
|
-
});
|
|
103
|
-
function
|
|
102
|
+
}), U = i({ active: !0 });
|
|
103
|
+
function te() {
|
|
104
|
+
return l(U);
|
|
105
|
+
}
|
|
106
|
+
function k() {
|
|
104
107
|
return l(Q);
|
|
105
108
|
}
|
|
106
|
-
function
|
|
109
|
+
function E(e) {
|
|
107
110
|
const t = `/collections/${e.collection}/${e.itemId}`, n = [];
|
|
108
111
|
e.layoutSlug && n.push(`layout=${encodeURIComponent(e.layoutSlug)}`), e.prefill && Object.keys(e.prefill).length && n.push(`prefill=${A(e.prefill)}`);
|
|
109
112
|
for (const [o, r] of Object.entries(e.query ?? {}))
|
|
110
113
|
n.push(`${encodeURIComponent(o)}=${encodeURIComponent(r)}`);
|
|
111
114
|
return n.length ? `${t}?${n.join("&")}` : t;
|
|
112
115
|
}
|
|
113
|
-
function
|
|
114
|
-
const e =
|
|
116
|
+
function ne() {
|
|
117
|
+
const e = k(), t = (o) => (e.itemUrl ?? E)(o);
|
|
115
118
|
return { urlFor: t, open: (o) => {
|
|
116
119
|
var r;
|
|
117
120
|
((r = e.openItem) == null ? void 0 : r.call(e, o)) !== !0 && e.navigate(t(o));
|
|
118
121
|
} };
|
|
119
122
|
}
|
|
120
|
-
const E = i(null);
|
|
121
|
-
function te() {
|
|
122
|
-
return l(E);
|
|
123
|
-
}
|
|
124
123
|
const G = i(null);
|
|
125
|
-
function
|
|
124
|
+
function oe() {
|
|
126
125
|
return l(G);
|
|
127
126
|
}
|
|
128
|
-
const M = i(
|
|
129
|
-
function
|
|
127
|
+
const M = i(null);
|
|
128
|
+
function re() {
|
|
130
129
|
return l(M);
|
|
131
130
|
}
|
|
132
|
-
const q = i(
|
|
133
|
-
function
|
|
131
|
+
const q = i({});
|
|
132
|
+
function le() {
|
|
134
133
|
return l(q);
|
|
135
134
|
}
|
|
136
135
|
const H = i(null);
|
|
137
|
-
function
|
|
138
|
-
|
|
136
|
+
function ie() {
|
|
137
|
+
return l(H);
|
|
138
|
+
}
|
|
139
|
+
const W = i(null);
|
|
140
|
+
function ue(e) {
|
|
141
|
+
const t = l(W), [n, o] = m([]), r = t ? t.get(e) ?? null : n[n.length - 1] ?? null, u = h(
|
|
139
142
|
(s) => {
|
|
140
143
|
t ? t.push(e, s) : o((a) => [...a, s]);
|
|
141
144
|
},
|
|
@@ -148,39 +151,41 @@ function le(e) {
|
|
|
148
151
|
);
|
|
149
152
|
return { value: r, push: u, back: c };
|
|
150
153
|
}
|
|
151
|
-
function
|
|
154
|
+
function se(e) {
|
|
152
155
|
var u;
|
|
153
156
|
const t = (u = e._overrides) == null ? void 0 : u.drilldown, n = t && typeof t == "object" ? t : null, o = e.interface === "relation-path";
|
|
154
157
|
return (n == null ? void 0 : n.enabled) ?? o ? { enabled: !0, layout_id: (n == null ? void 0 : n.layout_id) ?? null, width: (n == null ? void 0 : n.width) ?? null } : null;
|
|
155
158
|
}
|
|
156
|
-
const
|
|
159
|
+
const ce = i(null), J = i(null), ae = () => l(J);
|
|
157
160
|
export {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
161
|
+
H as DrilldownContext,
|
|
162
|
+
q as DrilldownViewsContext,
|
|
163
|
+
R as GridFlushContext,
|
|
164
|
+
D as ItemEditAuthContext,
|
|
162
165
|
Q as NavigationContext,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
K as NivaroProvider,
|
|
167
|
+
W as OverlayHistoryContext,
|
|
168
|
+
G as ParentDraftContext,
|
|
169
|
+
U as RecordSurfaceContext,
|
|
170
|
+
M as ReimportHandlerContext,
|
|
171
|
+
ce as RelationPathDataContext,
|
|
172
|
+
J as StaleFieldReportContext,
|
|
173
|
+
ee as decodePrefill,
|
|
174
|
+
E as defaultItemUrl,
|
|
171
175
|
A as encodePrefill,
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
176
|
+
se as fieldDrilldownConfig,
|
|
177
|
+
Y as useApiFetchConfig,
|
|
178
|
+
ie as useDrilldown,
|
|
179
|
+
le as useDrilldownViews,
|
|
180
|
+
L as useGridFlush,
|
|
181
|
+
Z as useItemEditAuth,
|
|
182
|
+
ne as useItemNavigation,
|
|
183
|
+
k as useNavigation,
|
|
184
|
+
X as useNivaroClient,
|
|
185
|
+
j as useOptionalNivaroClient,
|
|
186
|
+
ue as useOverlayState,
|
|
187
|
+
oe as useParentDraft,
|
|
188
|
+
te as useRecordSurface,
|
|
189
|
+
re as useReimportHandler,
|
|
190
|
+
ae as useStaleFieldReporter
|
|
186
191
|
};
|
|
@@ -1,51 +1,78 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
return `${
|
|
1
|
+
const i = "nivaro-drafts", c = "drafts";
|
|
2
|
+
function m(e, t, n) {
|
|
3
|
+
return `${e}:${t && t !== "new" ? t : "new"}:${n || "anon"}`;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
return new Promise((
|
|
5
|
+
function f() {
|
|
6
|
+
return new Promise((e) => {
|
|
7
7
|
try {
|
|
8
|
-
if (typeof indexedDB > "u") return
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
},
|
|
8
|
+
if (typeof indexedDB > "u") return e(null);
|
|
9
|
+
const t = indexedDB.open(i, 1);
|
|
10
|
+
t.onupgradeneeded = () => {
|
|
11
|
+
const n = t.result;
|
|
12
|
+
n.objectStoreNames.contains(c) || n.createObjectStore(c, { keyPath: "key" });
|
|
13
|
+
}, t.onsuccess = () => e(t.result), t.onerror = () => e(null), t.onblocked = () => e(null);
|
|
14
14
|
} catch {
|
|
15
|
-
|
|
15
|
+
e(null);
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
async function
|
|
20
|
-
const
|
|
21
|
-
return
|
|
19
|
+
async function l(e, t) {
|
|
20
|
+
const n = await f();
|
|
21
|
+
return n ? new Promise((o) => {
|
|
22
22
|
try {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const r = n.transaction(c, e), a = t(r.objectStore(c));
|
|
24
|
+
a.onsuccess = () => o(a.result), a.onerror = () => o(null), r.oncomplete = () => n.close(), r.onerror = () => {
|
|
25
|
+
n.close(), o(null);
|
|
26
26
|
};
|
|
27
27
|
} catch {
|
|
28
|
-
|
|
28
|
+
n.close(), o(null);
|
|
29
29
|
}
|
|
30
30
|
}) : null;
|
|
31
31
|
}
|
|
32
|
-
async function
|
|
33
|
-
return await
|
|
32
|
+
async function g(e) {
|
|
33
|
+
return await l("readwrite", (n) => n.put(e)) != null;
|
|
34
34
|
}
|
|
35
|
-
async function
|
|
36
|
-
const
|
|
37
|
-
return
|
|
35
|
+
async function b(e) {
|
|
36
|
+
const t = await l("readonly", (n) => n.get(e));
|
|
37
|
+
return t && typeof t == "object" && t.key === e ? t : null;
|
|
38
38
|
}
|
|
39
|
-
async function
|
|
40
|
-
await
|
|
39
|
+
async function y(e) {
|
|
40
|
+
await l("readwrite", (t) => t.delete(e));
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
const s = "nvr:draft-created:", d = 7 * 864e5;
|
|
43
|
+
function p(e, t, n = /* @__PURE__ */ new Date()) {
|
|
44
|
+
try {
|
|
45
|
+
localStorage.setItem(
|
|
46
|
+
s + e,
|
|
47
|
+
JSON.stringify({ id: t, at: n.toISOString() })
|
|
48
|
+
);
|
|
49
|
+
} catch {
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function w(e, t, n = /* @__PURE__ */ new Date()) {
|
|
53
|
+
try {
|
|
54
|
+
const o = localStorage.getItem(s + e);
|
|
55
|
+
if (!o) return null;
|
|
56
|
+
const r = JSON.parse(o);
|
|
57
|
+
if (!r || typeof r.id != "string" || typeof r.at != "string") return null;
|
|
58
|
+
const a = Date.parse(r.at);
|
|
59
|
+
if (!Number.isFinite(a) || n.getTime() - a > d)
|
|
60
|
+
return localStorage.removeItem(s + e), null;
|
|
61
|
+
const u = t ? Date.parse(t) : Number.NaN;
|
|
62
|
+
return !Number.isFinite(u) || u > a ? null : { id: r.id, at: r.at };
|
|
63
|
+
} catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function D(e) {
|
|
68
|
+
return Object.keys(e.fields ?? {}).length > 0 || Object.values(e.pending_rows ?? {}).some((t) => t.length > 0) || Object.values(e.pending_edits ?? {}).some((t) => Object.keys(t).length > 0) || Object.values(e.pending_deletes ?? {}).some((t) => t.length > 0) || Object.values(e.m2m_links ?? {}).some((t) => t.length > 0) || Object.values(e.m2m_unlinks ?? {}).some((t) => t.length > 0);
|
|
44
69
|
}
|
|
45
70
|
export {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
71
|
+
y as deleteDraft,
|
|
72
|
+
w as draftCreatedAs,
|
|
73
|
+
D as draftHasContent,
|
|
74
|
+
m as draftKey,
|
|
75
|
+
b as loadDraft,
|
|
76
|
+
p as markDraftCreated,
|
|
77
|
+
g as saveDraft
|
|
51
78
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useRef as o, useEffect as c } from "react";
|
|
2
|
+
function d(n, r, t, e) {
|
|
3
|
+
if (n.defaultPrevented || n.button !== 0 || n.metaKey || n.ctrlKey || n.shiftKey || n.altKey || !r || r.target && r.target !== "_self" || r.hasAttribute("download")) return !1;
|
|
4
|
+
let i;
|
|
5
|
+
try {
|
|
6
|
+
i = new URL(r.href, `${t.origin}${t.pathname}${t.search}`);
|
|
7
|
+
} catch {
|
|
8
|
+
return !1;
|
|
9
|
+
}
|
|
10
|
+
if (i.origin !== t.origin || i.pathname + i.search === t.pathname + t.search || e != null && e.contains(r)) return !1;
|
|
11
|
+
const a = r.closest('[role="dialog"]');
|
|
12
|
+
return !(a && !(e && a.contains(e)));
|
|
13
|
+
}
|
|
14
|
+
function m(n, r, t) {
|
|
15
|
+
const e = o(r);
|
|
16
|
+
e.current = r, c(() => {
|
|
17
|
+
if (!n) return;
|
|
18
|
+
let i = !1;
|
|
19
|
+
const a = (s) => {
|
|
20
|
+
var u, l;
|
|
21
|
+
if (i) return;
|
|
22
|
+
const f = (l = (u = s.target) == null ? void 0 : u.closest) == null ? void 0 : l.call(u, "a[href]");
|
|
23
|
+
!d(s, f, window.location, t == null ? void 0 : t.current) || !f || (s.preventDefault(), s.stopImmediatePropagation(), e.current(() => {
|
|
24
|
+
i = !0;
|
|
25
|
+
try {
|
|
26
|
+
f.click();
|
|
27
|
+
} finally {
|
|
28
|
+
i = !1;
|
|
29
|
+
}
|
|
30
|
+
}, f));
|
|
31
|
+
};
|
|
32
|
+
return document.addEventListener("click", a, !0), () => document.removeEventListener("click", a, !0);
|
|
33
|
+
}, [n, t]);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
d as isLeavingLink,
|
|
37
|
+
m as useLeaveLinkGuard
|
|
38
|
+
};
|
|
@@ -1,27 +1,48 @@
|
|
|
1
|
-
import { isCodeError as
|
|
2
|
-
function
|
|
1
|
+
import { isCodeError as f, SOMETHING_WENT_WRONG as l } from "./safe-error.js";
|
|
2
|
+
function o(n) {
|
|
3
3
|
var r;
|
|
4
|
-
const t =
|
|
5
|
-
return typeof
|
|
4
|
+
const t = n, e = (t == null ? void 0 : t.status) ?? ((r = t == null ? void 0 : t.response) == null ? void 0 : r.status);
|
|
5
|
+
return typeof e == "number" ? e : null;
|
|
6
6
|
}
|
|
7
|
-
function c(
|
|
8
|
-
const
|
|
9
|
-
if (
|
|
10
|
-
const r =
|
|
11
|
-
return /timed? ?out|timeout/i.test(r) || (
|
|
7
|
+
function c(n, t = "this") {
|
|
8
|
+
const e = o(n);
|
|
9
|
+
if (e == null) {
|
|
10
|
+
const r = n instanceof Error ? n.message : String(n ?? "");
|
|
11
|
+
return /timed? ?out|timeout/i.test(r) || (n == null ? void 0 : n.name) === "TimeoutError" ? `Couldn’t load ${t}: it is taking too long to answer.` : /network|failed to fetch|load failed/i.test(r) ? "Can’t reach the server. Check the connection." : f(n) ? l : `Couldn’t load ${t}.`;
|
|
12
12
|
}
|
|
13
|
-
return
|
|
13
|
+
return e === 502 || e === 503 || e === 504 ? "The service behind this is unavailable right now." : e === 401 ? "Your sign-in has ended. Sign in again to see it." : e === 403 ? "You don’t have access to this." : e === 404 ? `${t === "this" ? "This" : t[0].toUpperCase() + t.slice(1)} no longer exists.` : e === 429 ? "Too many requests just now. Try again in a moment." : e >= 500 ? `The server hit an error loading ${t}.` : `Couldn’t load ${t}.`;
|
|
14
14
|
}
|
|
15
15
|
const d = /^(service unavailable|internal server error|bad gateway|gateway timeout|not found|forbidden|unauthorized)$/i;
|
|
16
|
-
function
|
|
17
|
-
var
|
|
18
|
-
const t =
|
|
19
|
-
if (typeof
|
|
20
|
-
const r =
|
|
16
|
+
function m(n) {
|
|
17
|
+
var s, i, u;
|
|
18
|
+
const t = n, e = ((i = (s = t == null ? void 0 : t.response) == null ? void 0 : s.data) == null ? void 0 : i.error) ?? ((u = t == null ? void 0 : t.response) == null ? void 0 : u.error);
|
|
19
|
+
if (typeof e != "string") return null;
|
|
20
|
+
const r = e.trim();
|
|
21
21
|
return !r || d.test(r) ? null : r.length > 200 ? `${r.slice(0, 197)}…` : r;
|
|
22
22
|
}
|
|
23
|
+
function a(n) {
|
|
24
|
+
const t = n, e = t == null ? void 0 : t.response;
|
|
25
|
+
if (!e || typeof e != "object") return null;
|
|
26
|
+
const r = e.data;
|
|
27
|
+
return r && typeof r == "object" ? r : e;
|
|
28
|
+
}
|
|
29
|
+
function T(n) {
|
|
30
|
+
if (o(n) !== 503) return !1;
|
|
31
|
+
const t = a(n);
|
|
32
|
+
return (t == null ? void 0 : t.code) === "LIST_TIMEOUT" ? !0 : typeof (t == null ? void 0 : t.message) == "string" && /took too long/i.test(t.message);
|
|
33
|
+
}
|
|
34
|
+
function h(n) {
|
|
35
|
+
var t;
|
|
36
|
+
if (o(n) === 503) {
|
|
37
|
+
const e = (t = a(n)) == null ? void 0 : t.message;
|
|
38
|
+
return typeof e == "string" && e.trim() ? e.trim() : "The server is busy right now. Please try again in a few seconds.";
|
|
39
|
+
}
|
|
40
|
+
return c(n, "this list");
|
|
41
|
+
}
|
|
23
42
|
export {
|
|
24
|
-
|
|
43
|
+
T as isListTimeout,
|
|
44
|
+
h as listLoadErrorText,
|
|
45
|
+
o as loadErrorStatus,
|
|
25
46
|
c as loadErrorText,
|
|
26
|
-
|
|
47
|
+
m as serverErrorText
|
|
27
48
|
};
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { normalizeRecordConditions as a, recordMatchesAll as
|
|
2
|
-
const
|
|
1
|
+
import { normalizeRecordConditions as a, recordMatchesAll as d } from "./record-conditions.js";
|
|
2
|
+
const m = "__none__", c = { default: "edit", rules: [] };
|
|
3
3
|
function p(e) {
|
|
4
4
|
if (!e || typeof e != "object") return c;
|
|
5
|
-
const o = e,
|
|
5
|
+
const o = e, s = o.default === "summary" ? "summary" : "edit", r = [];
|
|
6
6
|
if (Array.isArray(o.rules))
|
|
7
7
|
for (const n of o.rules) {
|
|
8
8
|
if (!n || typeof n != "object") continue;
|
|
9
|
-
const
|
|
9
|
+
const t = n;
|
|
10
10
|
r.push({
|
|
11
|
-
roles: Array.isArray(
|
|
12
|
-
states: Array.isArray(
|
|
13
|
-
states_op:
|
|
14
|
-
conditions: a(
|
|
15
|
-
mode:
|
|
11
|
+
roles: Array.isArray(t.roles) ? t.roles.map(String) : null,
|
|
12
|
+
states: Array.isArray(t.states) ? t.states.map(String) : null,
|
|
13
|
+
states_op: t.states_op === "not_in" ? "not_in" : "in",
|
|
14
|
+
conditions: a(t.conditions),
|
|
15
|
+
mode: t.mode === "summary" ? "summary" : "edit"
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
return { default:
|
|
18
|
+
return { default: s, rules: r, ...o.edit_lock ? { edit_lock: o.edit_lock } : {} };
|
|
19
19
|
}
|
|
20
20
|
const f = (e) => !!(e != null && e.rules.some((o) => {
|
|
21
|
-
var
|
|
22
|
-
return (((
|
|
21
|
+
var s;
|
|
22
|
+
return (((s = o.roles) == null ? void 0 : s.length) ?? 0) > 0;
|
|
23
23
|
})), A = (e) => !!(e != null && e.rules.some((o) => {
|
|
24
|
-
var
|
|
25
|
-
return (((
|
|
24
|
+
var s;
|
|
25
|
+
return (((s = o.states) == null ? void 0 : s.length) ?? 0) > 0;
|
|
26
26
|
})), R = (e) => !!(e != null && e.rules.some((o) => {
|
|
27
|
-
var
|
|
28
|
-
return (((
|
|
27
|
+
var s;
|
|
28
|
+
return (((s = o.conditions) == null ? void 0 : s.length) ?? 0) > 0;
|
|
29
29
|
}));
|
|
30
30
|
function S(e, o) {
|
|
31
31
|
var n;
|
|
32
32
|
if (o.isNew || !e) return "edit";
|
|
33
|
-
const
|
|
34
|
-
for (const
|
|
35
|
-
const l =
|
|
36
|
-
if (l.length > 0 && (!
|
|
37
|
-
const u =
|
|
33
|
+
const s = o.role ? o.role.toLowerCase() : null, r = o.stateKey ?? m;
|
|
34
|
+
for (const t of e.rules) {
|
|
35
|
+
const l = t.roles ?? [];
|
|
36
|
+
if (l.length > 0 && (!s || !l.some((i) => i.toLowerCase() === s))) continue;
|
|
37
|
+
const u = t.states ?? [];
|
|
38
38
|
if (u.length > 0) {
|
|
39
39
|
const i = u.includes(r);
|
|
40
|
-
if (!(
|
|
40
|
+
if (!(t.states_op === "not_in" ? !i : i)) continue;
|
|
41
41
|
}
|
|
42
|
-
if (!((((n =
|
|
43
|
-
return
|
|
42
|
+
if (!((((n = t.conditions) == null ? void 0 : n.length) ?? 0) > 0 && (!o.record || !d(o.record, t.conditions))))
|
|
43
|
+
return t.mode;
|
|
44
44
|
}
|
|
45
45
|
return e.default;
|
|
46
46
|
}
|
|
47
47
|
export {
|
|
48
48
|
c as EMPTY_SUMMARY_RULES,
|
|
49
|
-
|
|
49
|
+
m as NO_STATE,
|
|
50
50
|
p as normalizeSummaryModeRules,
|
|
51
51
|
S as resolveSummaryMode,
|
|
52
52
|
R as summaryRulesNeedRecord,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const l = 0.6;
|
|
2
|
+
function b(f, e, c, k, u) {
|
|
3
|
+
if (u <= 0) return { left: f, right: e };
|
|
4
|
+
const r = u * 0.6;
|
|
5
|
+
let o = k;
|
|
6
|
+
const s = [];
|
|
7
|
+
for (const t of f) {
|
|
8
|
+
const n = c(t);
|
|
9
|
+
if (s.length > 0 && o + n > r) break;
|
|
10
|
+
s.push(t), o += n;
|
|
11
|
+
}
|
|
12
|
+
const i = [];
|
|
13
|
+
for (let t = e.length - 1; t >= 0; t--) {
|
|
14
|
+
const n = c(e[t]);
|
|
15
|
+
if (o + n > r) break;
|
|
16
|
+
i.unshift(e[t]), o += n;
|
|
17
|
+
}
|
|
18
|
+
return { left: s, right: i };
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
l as PIN_BUDGET,
|
|
22
|
+
b as fitPins
|
|
23
|
+
};
|