@nivaro/react 0.3.53 → 0.3.55
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/shared/components/ItemEditForm.js +3350 -3347
- package/dist/shared/components/PageRenderer.js +397 -396
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +52 -54
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +12 -11
- package/dist/shared/components/item-edit/RelationCombobox.js +23 -20
- package/dist/shared/components/item-edit/SummaryPanel.js +358 -318
- package/dist/shared/components/item-edit/save-outcome.js +48 -0
- package/dist/shared/components/item-edit/stale-banner.js +13 -0
- package/dist/shared/components/item-edit/usePersonalDefaults.js +116 -114
- package/dist/shared/lib/draft-store.js +35 -29
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/page-widget-access.js +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
function r(e) {
|
|
2
|
+
return e.childFailed === !0 || e.reasonWaiting === !0;
|
|
3
|
+
}
|
|
4
|
+
function a(e, s) {
|
|
5
|
+
const { isNew: t } = s, i = s.noun.toLowerCase();
|
|
6
|
+
if (e.childFailed) {
|
|
7
|
+
const n = e.childErrors ?? [];
|
|
8
|
+
return n.length === 0 && e.linkProblems.length > 0 ? null : {
|
|
9
|
+
kind: "error",
|
|
10
|
+
text: n.length > 0 ? `Not everything saved — ${n.join(" · ")}` : "Not everything saved — some lines did not save",
|
|
11
|
+
duration: 2e4
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
if (e.reasonWaiting)
|
|
15
|
+
return {
|
|
16
|
+
kind: "warning",
|
|
17
|
+
text: "Not saved yet — give a reason for the change to finish saving",
|
|
18
|
+
duration: 1e4
|
|
19
|
+
};
|
|
20
|
+
if (e.hidden) {
|
|
21
|
+
const n = e.hidden.reason ? ` (${e.hidden.reason})` : "";
|
|
22
|
+
return {
|
|
23
|
+
kind: "warning",
|
|
24
|
+
text: t ? `The new ${i} was created, but it’s outside what you can see${n}.` : `Saved, but this ${i} is now outside what you can see${n}.`,
|
|
25
|
+
duration: 15e3
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (e.lineConflicts) {
|
|
29
|
+
const n = e.lineConflicts;
|
|
30
|
+
return {
|
|
31
|
+
kind: "warning",
|
|
32
|
+
text: `Saved, except ${n} ${n === 1 ? "line" : "lines"} someone else changed — pick which value wins`,
|
|
33
|
+
duration: 1e4
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (!t && e.keptTheirs) {
|
|
37
|
+
const n = e.keptTheirs;
|
|
38
|
+
return {
|
|
39
|
+
kind: "success",
|
|
40
|
+
text: e.noFieldWrite && e.onlyMain ? `Kept the newer ${n === 1 ? "value" : "values"} — nothing of yours left to save` : `Changes saved — kept the newer ${n === 1 ? "value" : "values"} for ${n} ${n === 1 ? "field" : "fields"}`
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return !t && e.noFieldWrite && e.onlyMain ? { kind: "plain", text: "Nothing to save — no changes" } : { kind: "success", text: t ? "Record created" : "Changes saved" };
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
a as saveClosingMessage,
|
|
47
|
+
r as saveLeftWorkStaged
|
|
48
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function n(r, f, t, i) {
|
|
2
|
+
for (const e of r)
|
|
3
|
+
if (!e.startsWith("__") && (!t || !i(f[e], t[e])))
|
|
4
|
+
return !0;
|
|
5
|
+
return !1;
|
|
6
|
+
}
|
|
7
|
+
function u(r) {
|
|
8
|
+
return r.dirty ? r.editsDiffer ? "review" : "refresh" : "auto-refresh";
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
u as staleBannerMode,
|
|
12
|
+
n as touchedEditsDiffer
|
|
13
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useQueryClient as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useNivaroClient as
|
|
4
|
-
import { get as
|
|
5
|
-
import { isEmptyValue as v, pickDefault as le, cascadeParents as K, orderTopDown as
|
|
6
|
-
import { titleCase as
|
|
7
|
-
const
|
|
8
|
-
function
|
|
9
|
-
return
|
|
1
|
+
import { useQueryClient as Ie, useQuery as Ue } from "@tanstack/react-query";
|
|
2
|
+
import { useRef as S, useMemo as Ce, useState as ae, useEffect as I, useCallback as l, createContext as _e, useContext as Je } from "react";
|
|
3
|
+
import { useNivaroClient as We } from "../../context.js";
|
|
4
|
+
import { get as Ge, put as ie, del as Xe } from "../../lib/commands.js";
|
|
5
|
+
import { isEmptyValue as v, pickDefault as le, cascadeParents as K, orderTopDown as Ze, captureContext as et } from "../../lib/personal-defaults.js";
|
|
6
|
+
import { titleCase as Ve } from "../../lib/utils.js";
|
|
7
|
+
const tt = _e(null);
|
|
8
|
+
function yt() {
|
|
9
|
+
return Je(tt);
|
|
10
10
|
}
|
|
11
11
|
function Q(i) {
|
|
12
12
|
return ["field-defaults", i];
|
|
@@ -14,73 +14,73 @@ function Q(i) {
|
|
|
14
14
|
function L(i) {
|
|
15
15
|
return Array.isArray(i) ? i.map(L) : i && typeof i == "object" && "id" in i ? i.id : i;
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
function
|
|
17
|
+
const rt = /* @__PURE__ */ new Set(["integer", "bigInteger", "float", "decimal", "number", "double"]), nt = /* @__PURE__ */ new Set(["date"]), st = /* @__PURE__ */ new Set(["dateTime", "datetime", "timestamp", "time"]);
|
|
18
|
+
function N(i, f, F) {
|
|
19
19
|
if (v(i) && v(f)) return !0;
|
|
20
|
-
if (
|
|
20
|
+
if (F && !Array.isArray(i) && !Array.isArray(f) && !v(i) && !v(f)) {
|
|
21
21
|
const M = L(i), k = L(f);
|
|
22
|
-
if (
|
|
23
|
-
const p = Number(M),
|
|
24
|
-
if (Number.isFinite(p) && Number.isFinite(
|
|
25
|
-
} else if (
|
|
22
|
+
if (rt.has(F)) {
|
|
23
|
+
const p = Number(M), h = Number(k);
|
|
24
|
+
if (Number.isFinite(p) && Number.isFinite(h)) return p === h;
|
|
25
|
+
} else if (nt.has(F)) {
|
|
26
26
|
const p = (q) => {
|
|
27
27
|
var Y;
|
|
28
28
|
return (Y = /^(\d{4}-\d{2}-\d{2})/.exec(String(q))) == null ? void 0 : Y[1];
|
|
29
|
-
},
|
|
30
|
-
if (
|
|
31
|
-
} else if (
|
|
32
|
-
const p = Date.parse(String(M)),
|
|
33
|
-
if (Number.isFinite(p) && Number.isFinite(
|
|
29
|
+
}, h = p(M), d = p(k);
|
|
30
|
+
if (h && d) return h === d;
|
|
31
|
+
} else if (st.has(F)) {
|
|
32
|
+
const p = Date.parse(String(M)), h = Date.parse(String(k));
|
|
33
|
+
if (Number.isFinite(p) && Number.isFinite(h)) return p === h;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const E = (M) => {
|
|
37
37
|
const k = L(M);
|
|
38
38
|
return Array.isArray(k) ? k.map((p) => String(p)).sort() : String(k);
|
|
39
39
|
};
|
|
40
|
-
return JSON.stringify(
|
|
40
|
+
return JSON.stringify(E(i)) === JSON.stringify(E(f));
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
let
|
|
44
|
-
for (const [
|
|
45
|
-
const k = f.get(
|
|
46
|
-
for (const p of M) k != null && k.has(String(p)) ||
|
|
42
|
+
function pt(i, f) {
|
|
43
|
+
let F = 0;
|
|
44
|
+
for (const [E, M] of i) {
|
|
45
|
+
const k = f.get(E);
|
|
46
|
+
for (const p of M) k != null && k.has(String(p)) || F++;
|
|
47
47
|
}
|
|
48
|
-
return
|
|
48
|
+
return F;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function ct(i) {
|
|
51
51
|
return Array.isArray(i) ? i : v(i) ? [] : [i];
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
const { collection: f, isNew:
|
|
53
|
+
function wt(i) {
|
|
54
|
+
const { collection: f, isNew: F, disabled: E, enabled: M = !0, ready: k = !0 } = i, p = We(), h = Ie(), d = S(i);
|
|
55
55
|
d.current = i;
|
|
56
|
-
const { data: q, isError: Y } =
|
|
56
|
+
const { data: q, isError: Y } = Ue({
|
|
57
57
|
queryKey: Q(f),
|
|
58
|
-
queryFn: () => p.request(
|
|
58
|
+
queryFn: () => p.request(Ge("/field-defaults/mine", { collection: f })).then((e) => e.data ?? []),
|
|
59
59
|
staleTime: 5 * 6e4,
|
|
60
60
|
enabled: !!f && M
|
|
61
|
-
}), U =
|
|
61
|
+
}), U = Ce(() => {
|
|
62
62
|
const e = /* @__PURE__ */ new Map();
|
|
63
63
|
for (const t of q ?? []) {
|
|
64
64
|
const r = e.get(t.field) ?? [];
|
|
65
65
|
r.push(t), e.set(t.field, r);
|
|
66
66
|
}
|
|
67
67
|
return e;
|
|
68
|
-
}, [q]), ee =
|
|
68
|
+
}, [q]), ee = S(U);
|
|
69
69
|
ee.current = U;
|
|
70
|
-
const
|
|
70
|
+
const m = S(/* @__PURE__ */ new Map()), [_, Ke] = ae(() => /* @__PURE__ */ new Map()), A = S(/* @__PURE__ */ new Map()), [te, Le] = ae(() => /* @__PURE__ */ new Map()), T = S(/* @__PURE__ */ new Set()), H = S(/* @__PURE__ */ new Map()), J = S(!0);
|
|
71
71
|
I(() => (J.current = !0, () => {
|
|
72
72
|
J.current = !1;
|
|
73
73
|
}), []);
|
|
74
|
-
const fe =
|
|
74
|
+
const fe = S(_), de = S(te), b = l(() => {
|
|
75
75
|
if (!J.current) return;
|
|
76
76
|
const e = (t, r) => t.size === r.size && [...r].every(([n, s]) => t.get(n) === s);
|
|
77
|
-
if (!e(fe.current,
|
|
78
|
-
const t = new Map(
|
|
79
|
-
fe.current = t,
|
|
77
|
+
if (!e(fe.current, m.current)) {
|
|
78
|
+
const t = new Map(m.current);
|
|
79
|
+
fe.current = t, Ke(t);
|
|
80
80
|
}
|
|
81
81
|
if (!e(de.current, A.current)) {
|
|
82
82
|
const t = new Map(A.current);
|
|
83
|
-
de.current = t,
|
|
83
|
+
de.current = t, Le(t);
|
|
84
84
|
}
|
|
85
85
|
}, []), o = l((e) => {
|
|
86
86
|
var n;
|
|
@@ -95,7 +95,7 @@ function pt(i) {
|
|
|
95
95
|
[o]
|
|
96
96
|
), D = l(async (e, t) => {
|
|
97
97
|
const r = d.current, s = (await Promise.all(
|
|
98
|
-
|
|
98
|
+
ct(L(t)).map(async (u) => {
|
|
99
99
|
if (!r.valueLabel) return String(u);
|
|
100
100
|
try {
|
|
101
101
|
return await r.valueLabel(e, u) ?? null;
|
|
@@ -105,7 +105,7 @@ function pt(i) {
|
|
|
105
105
|
})
|
|
106
106
|
)).filter((u) => !!u);
|
|
107
107
|
return s.length > 0 ? s.join(", ") : null;
|
|
108
|
-
}, []), $ =
|
|
108
|
+
}, []), $ = S(0), W = l(
|
|
109
109
|
async (e, t, r) => {
|
|
110
110
|
const n = await t;
|
|
111
111
|
$.current === r && (A.current.set(e, n), b());
|
|
@@ -121,49 +121,49 @@ function pt(i) {
|
|
|
121
121
|
), G = l((e, t, r) => {
|
|
122
122
|
const n = d.current;
|
|
123
123
|
if (n.setFieldValue(e, t, r), v(t)) {
|
|
124
|
-
|
|
124
|
+
m.current.delete(e);
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
|
-
|
|
127
|
+
m.current.set(e, t), A.current.delete(e), n.markAutoFilled([e]);
|
|
128
128
|
}, []), ye = l(
|
|
129
129
|
async (e, t) => {
|
|
130
|
-
var
|
|
130
|
+
var Me, qe, De, Ee, Ne, Te;
|
|
131
131
|
const r = d.current, n = () => $.current !== t, s = ee.current.get(e) ?? [];
|
|
132
132
|
if (s.length === 0 || !r.layoutAllows(e)) return [];
|
|
133
|
-
if (T.current.has(e) || !(((
|
|
133
|
+
if (T.current.has(e) || !(((Me = r.canFill) == null ? void 0 : Me.call(r, e)) ?? !0)) return [];
|
|
134
134
|
const u = o(e), y = !v(u);
|
|
135
|
-
if (y && !(((
|
|
135
|
+
if (y && !(((qe = r.replaceable) == null ? void 0 : qe.call(r, e, u)) ?? !1)) return [];
|
|
136
136
|
const R = new Set(s.flatMap((a) => Object.keys(a.context ?? {}))), w = O(R), { pick: c, fillParents: g, blockedBy: C } = le(s, w);
|
|
137
137
|
if (!c) {
|
|
138
138
|
if (C) {
|
|
139
|
-
const a = (
|
|
140
|
-
(x) => x.context && C in x.context && !
|
|
141
|
-
)) == null ? void 0 :
|
|
139
|
+
const a = (De = s.find(
|
|
140
|
+
(x) => x.context && C in x.context && !N(x.context[C], w[C])
|
|
141
|
+
)) == null ? void 0 : De.context[C];
|
|
142
142
|
await W(e, re(C, a), t);
|
|
143
143
|
}
|
|
144
144
|
return [];
|
|
145
145
|
}
|
|
146
|
-
const V = K(e, r.rulesFor).reverse(),
|
|
146
|
+
const V = K(e, r.rulesFor).reverse(), Be = [
|
|
147
147
|
...V.filter((a) => a in g),
|
|
148
148
|
...Object.keys(g).filter((a) => !V.includes(a))
|
|
149
149
|
], Z = [], j = () => {
|
|
150
150
|
for (const [a, x] of Z.reverse())
|
|
151
|
-
|
|
151
|
+
N(o(a), x) ? G(a, null, x) : m.current.delete(a);
|
|
152
152
|
};
|
|
153
|
-
for (const a of
|
|
154
|
-
const x = g[a],
|
|
153
|
+
for (const a of Be) {
|
|
154
|
+
const x = g[a], Oe = r.layoutAllows(a) && !T.current.has(a) && (((Ee = r.canFill) == null ? void 0 : Ee.call(r, a)) ?? !0) ? await r.revalidate(a, x) : !1;
|
|
155
155
|
if (n()) return [];
|
|
156
|
-
if (
|
|
156
|
+
if (Oe === null)
|
|
157
157
|
return j(), [];
|
|
158
|
-
if (!
|
|
158
|
+
if (!Oe || !v(o(a)))
|
|
159
159
|
return j(), await W(e, re(a, x), t), [];
|
|
160
160
|
G(a, x), Z.push([a, x]);
|
|
161
161
|
}
|
|
162
|
-
const
|
|
162
|
+
const Pe = await r.revalidate(e, c.value);
|
|
163
163
|
if (n()) return [];
|
|
164
|
-
if (
|
|
164
|
+
if (Pe === null)
|
|
165
165
|
return j(), [];
|
|
166
|
-
if (!
|
|
166
|
+
if (!Pe)
|
|
167
167
|
return j(), await W(
|
|
168
168
|
e,
|
|
169
169
|
D(e, c.value).then(
|
|
@@ -171,10 +171,10 @@ function pt(i) {
|
|
|
171
171
|
),
|
|
172
172
|
t
|
|
173
173
|
), [];
|
|
174
|
-
if (!
|
|
174
|
+
if (!N(o(e), u) || !(((Ne = r.canFill) == null ? void 0 : Ne.call(r, e)) ?? !0))
|
|
175
175
|
return j(), [];
|
|
176
|
-
const
|
|
177
|
-
return ((
|
|
176
|
+
const Re = le(s, O(R));
|
|
177
|
+
return ((Te = Re.pick) == null ? void 0 : Te.id) !== c.id || Object.keys(Re.fillParents).length > 0 ? (j(), "stale") : (G(e, c.value, y ? u : void 0), H.current.set(
|
|
178
178
|
e,
|
|
179
179
|
Z.map(([a]) => a)
|
|
180
180
|
), [...Z.map(([a]) => a), e]);
|
|
@@ -200,39 +200,39 @@ function pt(i) {
|
|
|
200
200
|
}
|
|
201
201
|
if ($.current === t) {
|
|
202
202
|
for (const u of r)
|
|
203
|
-
|
|
203
|
+
m.current.has(u) && ((s = (n = d.current).afterApply) == null || s.call(n, u, m.current.get(u)));
|
|
204
204
|
b();
|
|
205
205
|
}
|
|
206
206
|
},
|
|
207
207
|
[pe, b]
|
|
208
208
|
), se = l(() => {
|
|
209
209
|
const e = d.current;
|
|
210
|
-
return
|
|
210
|
+
return Ze(
|
|
211
211
|
[...ee.current.keys()].filter((t) => e.layoutAllows(t)),
|
|
212
212
|
e.rulesFor
|
|
213
213
|
);
|
|
214
|
-
}, []), ce =
|
|
214
|
+
}, []), ce = S(!1);
|
|
215
215
|
I(() => {
|
|
216
|
-
!
|
|
217
|
-
}, [
|
|
216
|
+
!F || E || !k || ce.current || q === void 0 || (ce.current = !0, ne(se()));
|
|
217
|
+
}, [F, E, k, q, ne, se]), I(() => {
|
|
218
218
|
let e = !1;
|
|
219
|
-
for (const [t, r] of
|
|
220
|
-
|
|
219
|
+
for (const [t, r] of m.current)
|
|
220
|
+
N(o(t), r) || (m.current.delete(t), e = !0);
|
|
221
221
|
for (const t of A.current.keys())
|
|
222
222
|
v(o(t)) || (A.current.delete(t), e = !0);
|
|
223
223
|
e && b();
|
|
224
224
|
});
|
|
225
|
-
const z =
|
|
225
|
+
const z = S(/* @__PURE__ */ new Set()), B = S(/* @__PURE__ */ new Map()), [Ye, $e] = ae(0), je = l(
|
|
226
226
|
(e) => {
|
|
227
|
-
let t =
|
|
227
|
+
let t = m.current.delete(e);
|
|
228
228
|
if (A.current.delete(e) && (t = !0), T.current.delete(e), B.current.delete(e), !d.current.isNew) {
|
|
229
229
|
t && b();
|
|
230
230
|
return;
|
|
231
231
|
}
|
|
232
232
|
const r = d.current.rulesFor;
|
|
233
|
-
for (const [n, s] of [...
|
|
234
|
-
K(n, r).includes(e) && (B.current.set(n, s),
|
|
235
|
-
t && b(), z.current.add(e),
|
|
233
|
+
for (const [n, s] of [...m.current])
|
|
234
|
+
K(n, r).includes(e) && (B.current.set(n, s), m.current.delete(n), t = !0);
|
|
235
|
+
t && b(), z.current.add(e), $e((n) => n + 1);
|
|
236
236
|
},
|
|
237
237
|
[b]
|
|
238
238
|
);
|
|
@@ -246,7 +246,7 @@ function pt(i) {
|
|
|
246
246
|
for (const s of se()) {
|
|
247
247
|
if (t.has(s)) {
|
|
248
248
|
const y = t.get(s), R = o(s);
|
|
249
|
-
if (
|
|
249
|
+
if (N(R, y)) r.setFieldValue(s, null, y);
|
|
250
250
|
else if (!v(R)) continue;
|
|
251
251
|
n.push(s);
|
|
252
252
|
continue;
|
|
@@ -255,11 +255,11 @@ function pt(i) {
|
|
|
255
255
|
e.some((y) => u.includes(y)) && A.current.has(s) && v(o(s)) && (A.current.delete(s), n.push(s));
|
|
256
256
|
}
|
|
257
257
|
b(), n.length > 0 && ne(n);
|
|
258
|
-
}, [
|
|
258
|
+
}, [Ye]);
|
|
259
259
|
const oe = l(
|
|
260
260
|
(e) => {
|
|
261
261
|
var R;
|
|
262
|
-
const t = d.current, r =
|
|
262
|
+
const t = d.current, r = m.current;
|
|
263
263
|
if (!r.has(e)) return;
|
|
264
264
|
const n = (w) => K(w, t.rulesFor), s = /* @__PURE__ */ new Set([e]);
|
|
265
265
|
for (let w = !0; w; ) {
|
|
@@ -277,23 +277,23 @@ function pt(i) {
|
|
|
277
277
|
const u = (w) => n(w).length, y = [];
|
|
278
278
|
for (const w of [...s].sort((c, g) => u(g) - u(c))) {
|
|
279
279
|
const c = r.get(w);
|
|
280
|
-
|
|
280
|
+
N(o(w), c) && (t.setFieldValue(w, null, c), y.push(w)), r.delete(w), H.current.delete(w), T.current.add(w);
|
|
281
281
|
}
|
|
282
282
|
y.length && ((R = t.onUndone) == null || R.call(t, y)), b();
|
|
283
283
|
},
|
|
284
284
|
[o, b]
|
|
285
|
-
),
|
|
285
|
+
), Qe = l(
|
|
286
286
|
(e) => {
|
|
287
|
-
if (!
|
|
288
|
-
const t =
|
|
289
|
-
|
|
287
|
+
if (!m.current.has(e)) return;
|
|
288
|
+
const t = m.current.get(e);
|
|
289
|
+
N(o(e), t) && d.current.setFieldValue(e, null, t), m.current.delete(e), T.current.add(e), b();
|
|
290
290
|
},
|
|
291
291
|
[o, b]
|
|
292
|
-
), X = `${f}|${
|
|
292
|
+
), X = `${f}|${F ? "new" : "saved"}|${i.resetKey ?? ""}`, we = S(X);
|
|
293
293
|
I(() => {
|
|
294
|
-
we.current !== X && (we.current = X,
|
|
294
|
+
we.current !== X && (we.current = X, m.current.clear(), A.current.clear(), T.current.clear(), H.current.clear(), B.current.clear(), z.current.clear(), ce.current = !1, $.current += 1, b());
|
|
295
295
|
}, [X, b]);
|
|
296
|
-
const ue = l((e) => te.get(e) ?? null, [te]),
|
|
296
|
+
const ue = l((e) => te.get(e) ?? null, [te]), He = l(() => m.current, []), P = l(
|
|
297
297
|
(e) => {
|
|
298
298
|
const t = U.get(e) ?? [];
|
|
299
299
|
if (t.length === 0) return null;
|
|
@@ -301,9 +301,9 @@ function pt(i) {
|
|
|
301
301
|
return le(t, O(r)).pick;
|
|
302
302
|
},
|
|
303
303
|
[U, O]
|
|
304
|
-
),
|
|
305
|
-
|
|
306
|
-
}, [
|
|
304
|
+
), he = l(() => {
|
|
305
|
+
h.invalidateQueries({ queryKey: Q(f) });
|
|
306
|
+
}, [h, f]), me = l(
|
|
307
307
|
(e) => !v(o(e)),
|
|
308
308
|
[o]
|
|
309
309
|
), ge = l(
|
|
@@ -312,7 +312,7 @@ function pt(i) {
|
|
|
312
312
|
const t = o(e);
|
|
313
313
|
if (v(t)) return !1;
|
|
314
314
|
const r = P(e);
|
|
315
|
-
return !!r &&
|
|
315
|
+
return !!r && N(r.value, t, (s = (n = d.current).fieldType) == null ? void 0 : s.call(n, e));
|
|
316
316
|
},
|
|
317
317
|
[o, P]
|
|
318
318
|
), be = l(
|
|
@@ -326,7 +326,7 @@ function pt(i) {
|
|
|
326
326
|
r.map(
|
|
327
327
|
async (n) => {
|
|
328
328
|
var s;
|
|
329
|
-
return await D(n, o(n)) ?? ((s = t.fieldLabel) == null ? void 0 : s.call(t, n)) ??
|
|
329
|
+
return await D(n, o(n)) ?? ((s = t.fieldLabel) == null ? void 0 : s.call(t, n)) ?? Ve(n);
|
|
330
330
|
}
|
|
331
331
|
)
|
|
332
332
|
);
|
|
@@ -341,7 +341,7 @@ function pt(i) {
|
|
|
341
341
|
collection: f,
|
|
342
342
|
field: y,
|
|
343
343
|
value: L(s[y]),
|
|
344
|
-
context:
|
|
344
|
+
context: et(y, s, t.rulesFor)
|
|
345
345
|
})
|
|
346
346
|
);
|
|
347
347
|
try {
|
|
@@ -349,10 +349,10 @@ function pt(i) {
|
|
|
349
349
|
for (const y of [...n].reverse())
|
|
350
350
|
t.layoutAllows(y) && !v(s[y]) && await u(y);
|
|
351
351
|
} finally {
|
|
352
|
-
await
|
|
352
|
+
await h.invalidateQueries({ queryKey: Q(f) });
|
|
353
353
|
}
|
|
354
354
|
},
|
|
355
|
-
[p,
|
|
355
|
+
[p, h, f, o, O]
|
|
356
356
|
), ke = l(
|
|
357
357
|
async (e) => {
|
|
358
358
|
const t = P(e);
|
|
@@ -369,10 +369,10 @@ function pt(i) {
|
|
|
369
369
|
})
|
|
370
370
|
);
|
|
371
371
|
} finally {
|
|
372
|
-
await
|
|
372
|
+
await h.invalidateQueries({ queryKey: Q(f) });
|
|
373
373
|
}
|
|
374
374
|
},
|
|
375
|
-
[p,
|
|
375
|
+
[p, h, f, o, P]
|
|
376
376
|
), Fe = l(
|
|
377
377
|
async (e) => {
|
|
378
378
|
const t = d.current, r = P(e), n = (r == null ? void 0 : r.context) ?? {}, s = [...K(e, t.rulesFor)].reverse(), u = [
|
|
@@ -380,7 +380,7 @@ function pt(i) {
|
|
|
380
380
|
...Object.keys(n).filter((c) => !s.includes(c))
|
|
381
381
|
], y = (c) => {
|
|
382
382
|
var g;
|
|
383
|
-
return ((g = t.fieldLabel) == null ? void 0 : g.call(t, c)) ??
|
|
383
|
+
return ((g = t.fieldLabel) == null ? void 0 : g.call(t, c)) ?? Ve(c);
|
|
384
384
|
}, [R, ...w] = await Promise.all([
|
|
385
385
|
D(e, o(e)).then((c) => c ?? y(e)),
|
|
386
386
|
...u.map((c) => D(c, n[c]).then((g) => g ?? y(c)))
|
|
@@ -391,9 +391,9 @@ function pt(i) {
|
|
|
391
391
|
), Se = l(
|
|
392
392
|
async (e) => {
|
|
393
393
|
const t = P(e);
|
|
394
|
-
return t ? (await p.request(
|
|
394
|
+
return t ? (await p.request(Xe(`/field-defaults/mine/${t.id}`)), m.current.delete(e) && (T.current.add(e), b()), await h.invalidateQueries({ queryKey: Q(f) }), t) : null;
|
|
395
395
|
},
|
|
396
|
-
[p,
|
|
396
|
+
[p, h, f, P, b]
|
|
397
397
|
), xe = l(
|
|
398
398
|
async (e) => {
|
|
399
399
|
await p.request(
|
|
@@ -403,10 +403,10 @@ function pt(i) {
|
|
|
403
403
|
value: e.value,
|
|
404
404
|
context: e.context ?? {}
|
|
405
405
|
})
|
|
406
|
-
), await
|
|
406
|
+
), await h.invalidateQueries({ queryKey: Q(f) });
|
|
407
407
|
},
|
|
408
|
-
[p,
|
|
409
|
-
),
|
|
408
|
+
[p, h, f]
|
|
409
|
+
), Ae = F && !E && !k, ze = Ce(
|
|
410
410
|
() => ({
|
|
411
411
|
allowed: (e) => (d.current.enabled ?? !0) && d.current.layoutAllows(e),
|
|
412
412
|
manageable: (e) => {
|
|
@@ -415,7 +415,8 @@ function pt(i) {
|
|
|
415
415
|
},
|
|
416
416
|
loaded: q !== void 0 || Y,
|
|
417
417
|
failed: q === void 0 && Y,
|
|
418
|
-
isNew:
|
|
418
|
+
isNew: F,
|
|
419
|
+
held: Ae,
|
|
419
420
|
defaultFor: P,
|
|
420
421
|
isDefault: ge,
|
|
421
422
|
save: ve,
|
|
@@ -423,8 +424,8 @@ function pt(i) {
|
|
|
423
424
|
describeUpdate: Fe,
|
|
424
425
|
clear: Se,
|
|
425
426
|
restore: xe,
|
|
426
|
-
refresh:
|
|
427
|
-
hasValue:
|
|
427
|
+
refresh: he,
|
|
428
|
+
hasValue: me,
|
|
428
429
|
describeSave: be,
|
|
429
430
|
applied: (e) => _.has(e),
|
|
430
431
|
hintFor: ue,
|
|
@@ -433,7 +434,8 @@ function pt(i) {
|
|
|
433
434
|
[
|
|
434
435
|
q,
|
|
435
436
|
Y,
|
|
436
|
-
|
|
437
|
+
F,
|
|
438
|
+
Ae,
|
|
437
439
|
P,
|
|
438
440
|
ge,
|
|
439
441
|
ve,
|
|
@@ -441,21 +443,21 @@ function pt(i) {
|
|
|
441
443
|
Fe,
|
|
442
444
|
Se,
|
|
443
445
|
xe,
|
|
444
|
-
me,
|
|
445
446
|
he,
|
|
447
|
+
me,
|
|
446
448
|
be,
|
|
447
449
|
_,
|
|
448
450
|
ue,
|
|
449
451
|
oe
|
|
450
452
|
]
|
|
451
453
|
);
|
|
452
|
-
return { ledger: _, hintFor: ue, undo: oe, onPersonChange:
|
|
454
|
+
return { ledger: _, hintFor: ue, undo: oe, onPersonChange: je, release: Qe, appliedNow: He, context: ze };
|
|
453
455
|
}
|
|
454
456
|
export {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
+
tt as PersonalDefaultsContext,
|
|
458
|
+
pt as linksBeyond,
|
|
457
459
|
Q as personalDefaultsKey,
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
460
|
+
N as sameDefaultValue,
|
|
461
|
+
wt as usePersonalDefaults,
|
|
462
|
+
yt as usePersonalDefaultsApi
|
|
461
463
|
};
|