@nivaro/react 0.3.98 → 0.3.100
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/useFormSchema.js +82 -85
- package/dist/hooks/useSessionRecorder.js +206 -175
- package/dist/index.d.ts +38 -13
- package/dist/index.js +182 -180
- package/dist/lib/commands.js +15 -11
- package/dist/shared/components/CollectionBrowserView.js +516 -503
- package/dist/shared/components/ItemEditForm.js +3021 -3019
- package/dist/shared/components/JobsTray.js +20 -16
- package/dist/shared/components/MyWorkView.js +133 -126
- package/dist/shared/components/NotificationBell.js +314 -288
- package/dist/shared/components/RecordCompare.js +38 -40
- package/dist/shared/components/RecordReadView.js +119 -119
- package/dist/shared/components/cbv/FoundElsewhere.js +61 -0
- package/dist/shared/components/item-edit/InlineGridField.js +45 -45
- package/dist/shared/components/item-edit/InlineTableField.js +750 -749
- package/dist/shared/components/item-edit/QuickPickerDialog.js +44 -44
- package/dist/shared/components/item-edit/RawEditSheet.js +122 -114
- package/dist/shared/components/item-edit/RelationCombobox.js +454 -378
- package/dist/shared/components/item-edit/SummaryPanel.js +56 -48
- package/dist/shared/components/item-edit/related-missing.js +75 -19
- package/dist/shared/components/notifications/NotificationCenterView.js +249 -226
- package/dist/shared/components/panels/AccessDeniedPanel.js +31 -28
- package/dist/shared/components/panels/BackgroundMove.js +175 -0
- package/dist/shared/components/panels/MoveAdvisory.js +204 -0
- package/dist/shared/components/panels/PipelinePanel.js +1450 -1219
- package/dist/shared/components/panels/RecordIntegrityBanner.js +113 -112
- package/dist/shared/lib/commands.js +18 -14
- package/dist/shared/lib/error-hints.js +1 -1
- package/dist/shared/lib/job-failure-text.js +12 -0
- package/dist/shared/lib/move-failure.js +9 -0
- package/dist/shared/lib/obligation-banner.js +15 -14
- package/dist/shared/lib/partner-failure.js +71 -0
- package/dist/shared/lib/prefetch.js +73 -73
- package/dist/shared/lib/replay-checkout.js +18 -13
- package/dist/shared/lib/replay-context.js +90 -77
- package/dist/shared/lib/replay-idle.js +21 -0
- package/dist/shared/lib/replay-socket.js +21 -17
- package/dist/shared/lib/rum.js +56 -51
- package/dist/shared/lib/safe-error.js +17 -13
- package/dist/shared/lib/stale-chunk.js +69 -26
- package/dist/shared/lib/system-collections.js +20 -0
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsx as p, Fragment as
|
|
1
|
+
import { jsx as p, Fragment as Q, jsxs as g } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as _ } from "@tanstack/react-query";
|
|
3
|
-
import { useState as
|
|
3
|
+
import { useState as N, useMemo as b, useCallback as F } from "react";
|
|
4
4
|
import { useNivaroClient as D } from "../../context.js";
|
|
5
|
-
import { get as
|
|
6
|
-
import { titleCase as
|
|
7
|
-
import { Dialog as
|
|
8
|
-
import { Popover as
|
|
9
|
-
import { QuickPicker as
|
|
10
|
-
function
|
|
5
|
+
import { get as P, getActiveLayout as T } from "../../lib/commands.js";
|
|
6
|
+
import { titleCase as I } from "../../lib/utils.js";
|
|
7
|
+
import { Dialog as S, DialogContent as H, DialogHeader as J, DialogTitle as R } from "../ui/dialog.js";
|
|
8
|
+
import { Popover as z, PopoverAnchor as B, PopoverContent as E } from "../ui/popover.js";
|
|
9
|
+
import { QuickPicker as G } from "./QuickPicker.js";
|
|
10
|
+
function U(n, l) {
|
|
11
11
|
var c;
|
|
12
12
|
const o = D(), { data: r, isLoading: h } = _({
|
|
13
13
|
queryKey: ["active-layout", n ?? "", l ?? null, "new"],
|
|
14
14
|
queryFn: () => o.request(
|
|
15
|
-
|
|
15
|
+
T({
|
|
16
16
|
collection: n,
|
|
17
17
|
...l ? { slug: l } : {}
|
|
18
18
|
})
|
|
@@ -26,7 +26,7 @@ function G(n, l) {
|
|
|
26
26
|
return Array.isArray(s) ? s.filter((d) => typeof d == "string") : [];
|
|
27
27
|
}, [r]), layoutId: ((c = r == null ? void 0 : r.layout) == null ? void 0 : c.id) ?? null, loading: h };
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function re({
|
|
30
30
|
collection: n,
|
|
31
31
|
layoutSlug: l,
|
|
32
32
|
open: o,
|
|
@@ -35,22 +35,22 @@ function ie({
|
|
|
35
35
|
noun: y = "record",
|
|
36
36
|
anchorEl: c
|
|
37
37
|
}) {
|
|
38
|
-
const s = D(), { steps: f, layoutId: d } =
|
|
38
|
+
const s = D(), { steps: f, layoutId: d } = U(o ? n : null, l), { data: a = [] } = _({
|
|
39
39
|
queryKey: ["field-config", n, d],
|
|
40
40
|
queryFn: () => s.request(
|
|
41
|
-
|
|
41
|
+
P(`/field-config/${n}`, d ? { layout_id: String(d) } : {})
|
|
42
42
|
).then((e) => e.data ?? []),
|
|
43
43
|
enabled: o && !!n,
|
|
44
44
|
staleTime: 6e4
|
|
45
45
|
}), { data: u = [] } = _({
|
|
46
46
|
queryKey: ["relations-for", n],
|
|
47
|
-
queryFn: () => s.request(
|
|
47
|
+
queryFn: () => s.request(P(`/data-model/relations/for/${n}`)).then((e) => e.data ?? []),
|
|
48
48
|
enabled: o && !!n,
|
|
49
49
|
staleTime: 3e5
|
|
50
|
-
}), [
|
|
51
|
-
() => Object.fromEntries(a.map((e) => [e.field, e.label ||
|
|
50
|
+
}), [x, q] = N({}), [k, C] = N({}), L = b(
|
|
51
|
+
() => Object.fromEntries(a.map((e) => [e.field, e.label || I(e.field)])),
|
|
52
52
|
[a]
|
|
53
|
-
),
|
|
53
|
+
), M = b(() => {
|
|
54
54
|
const e = {};
|
|
55
55
|
for (const t of a)
|
|
56
56
|
try {
|
|
@@ -59,48 +59,48 @@ function ie({
|
|
|
59
59
|
} catch {
|
|
60
60
|
}
|
|
61
61
|
return e;
|
|
62
|
-
}, [a]),
|
|
62
|
+
}, [a]), $ = F(
|
|
63
63
|
(e) => {
|
|
64
|
-
var
|
|
64
|
+
var v;
|
|
65
65
|
const t = u.find(
|
|
66
66
|
(m) => m.one_collection === n && m.one_field === e
|
|
67
67
|
);
|
|
68
68
|
if (!t) return e;
|
|
69
|
-
const i = t.junction_field ?? ((
|
|
69
|
+
const i = t.junction_field ?? ((v = u.find((m) => m.many_collection === t.many_collection && m.id !== t.id)) == null ? void 0 : v.many_field);
|
|
70
70
|
return t.one_field ?? `${t.many_collection}.${i ?? ""}`;
|
|
71
71
|
},
|
|
72
72
|
[u, n]
|
|
73
|
-
),
|
|
74
|
-
|
|
75
|
-
},
|
|
73
|
+
), A = F((e) => k[e] ?? [], [k]), w = () => {
|
|
74
|
+
q({}), C({});
|
|
75
|
+
}, K = () => {
|
|
76
76
|
const e = {};
|
|
77
77
|
for (const [t, i] of Object.entries(k))
|
|
78
|
-
i.length && (e[
|
|
79
|
-
h({ ...
|
|
80
|
-
},
|
|
81
|
-
|
|
78
|
+
i.length && (e[$(t)] = i);
|
|
79
|
+
h({ ...x, ...Object.keys(e).length ? { __links: e } : {} }), w();
|
|
80
|
+
}, O = /* @__PURE__ */ p(Q, { children: f.length > 0 && a.length > 0 && u.length > 0 && /* @__PURE__ */ p(
|
|
81
|
+
G,
|
|
82
82
|
{
|
|
83
83
|
collection: n,
|
|
84
84
|
itemId: "new",
|
|
85
85
|
steps: f,
|
|
86
86
|
fieldConfig: a,
|
|
87
87
|
relations: u,
|
|
88
|
-
draft:
|
|
89
|
-
getM2M:
|
|
90
|
-
onChange: (e, t) =>
|
|
91
|
-
onM2MChange: (e, t) =>
|
|
92
|
-
fieldLabels:
|
|
93
|
-
fieldOptionFilters:
|
|
94
|
-
onFinish:
|
|
88
|
+
draft: x,
|
|
89
|
+
getM2M: A,
|
|
90
|
+
onChange: (e, t) => q((i) => ({ ...i, [e]: t })),
|
|
91
|
+
onM2MChange: (e, t) => C((i) => ({ ...i, [e]: t })),
|
|
92
|
+
fieldLabels: L,
|
|
93
|
+
fieldOptionFilters: M,
|
|
94
|
+
onFinish: K,
|
|
95
95
|
finishLabel: `Create ${y}`
|
|
96
96
|
}
|
|
97
|
-
) }),
|
|
98
|
-
e ||
|
|
97
|
+
) }), j = (e) => {
|
|
98
|
+
e || w(), r(e);
|
|
99
99
|
};
|
|
100
|
-
return c ? /* @__PURE__ */ g(
|
|
101
|
-
/* @__PURE__ */ p(
|
|
100
|
+
return c ? /* @__PURE__ */ g(z, { open: o, onOpenChange: j, children: [
|
|
101
|
+
/* @__PURE__ */ p(B, { virtualRef: { current: c } }),
|
|
102
102
|
/* @__PURE__ */ g(
|
|
103
|
-
|
|
103
|
+
E,
|
|
104
104
|
{
|
|
105
105
|
align: "end",
|
|
106
106
|
sideOffset: 6,
|
|
@@ -111,19 +111,19 @@ function ie({
|
|
|
111
111
|
"New ",
|
|
112
112
|
y
|
|
113
113
|
] }),
|
|
114
|
-
|
|
114
|
+
O
|
|
115
115
|
]
|
|
116
116
|
}
|
|
117
117
|
)
|
|
118
|
-
] }) : /* @__PURE__ */ p(
|
|
119
|
-
/* @__PURE__ */ p(
|
|
118
|
+
] }) : /* @__PURE__ */ p(S, { open: o, onOpenChange: j, children: /* @__PURE__ */ g(H, { className: "max-w-[540px]", "data-quick-picker-dialog": !0, children: [
|
|
119
|
+
/* @__PURE__ */ p(J, { children: /* @__PURE__ */ g(R, { className: "text-[15px]", children: [
|
|
120
120
|
"New ",
|
|
121
121
|
y
|
|
122
122
|
] }) }),
|
|
123
|
-
|
|
123
|
+
O
|
|
124
124
|
] }) });
|
|
125
125
|
}
|
|
126
126
|
export {
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
re as QuickPickerDialog,
|
|
128
|
+
U as useQuickPickerSteps
|
|
129
129
|
};
|
|
@@ -1,175 +1,183 @@
|
|
|
1
1
|
import { jsx as l, jsxs as f } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Wrench as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { toast as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as $, patch as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
2
|
+
import { useQueryClient as Z, useQuery as U } from "@tanstack/react-query";
|
|
3
|
+
import { Wrench as I, ShieldAlert as ee, Loader2 as P } from "lucide-react";
|
|
4
|
+
import { useState as _, useMemo as Q } from "react";
|
|
5
|
+
import { toast as T } from "sonner";
|
|
6
|
+
import { useNivaroClient as te } from "../../context.js";
|
|
7
|
+
import { get as $, patch as ne, del as ie, post as ae } from "../../lib/commands.js";
|
|
8
|
+
import { isFileCollection as re } from "../../lib/system-collections.js";
|
|
9
|
+
import { titleCase as W } from "../../lib/utils.js";
|
|
10
|
+
import { Button as D } from "../ui/button.js";
|
|
11
|
+
import { Sheet as se, SheetContent as le, SheetHeader as oe, SheetTitle as ce } from "../ui/sheet.js";
|
|
12
|
+
import { ChangeReasonDialog as de, changeReasonChallenge as me } from "./ChangeReasonDialog.js";
|
|
13
|
+
import { FieldRenderer as fe } from "./FieldRenderer.js";
|
|
14
|
+
import { M2MCombobox as ue, m2aAllowedCount as pe, m2aWriteMeta as he } from "./M2MCombobox.js";
|
|
15
|
+
import { M2MStagingContext as E } from "./M2MStagingContext.js";
|
|
16
|
+
import { invalidateM2MFor as ge } from "./m2m-invalidate.js";
|
|
17
|
+
import { RawM2ALinks as ye } from "./RawM2ALinks.js";
|
|
18
|
+
function J(r, s) {
|
|
18
19
|
const u = (p) => p == null || p === "";
|
|
19
|
-
return u(
|
|
20
|
+
return u(r) && u(s) ? !0 : typeof r == "number" || typeof s == "number" ? Number(r) === Number(s) : typeof r == "boolean" || typeof s == "boolean" ? String(r) === String(s) : typeof r == "object" || typeof s == "object" ? JSON.stringify(r) === JSON.stringify(s) : String(r) === String(s);
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
if (
|
|
23
|
-
const s = typeof
|
|
22
|
+
function R(r) {
|
|
23
|
+
if (r == null || r === "") return "∅";
|
|
24
|
+
const s = typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
24
25
|
return s.length > 60 ? `${s.slice(0, 57)}…` : s;
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
collection:
|
|
27
|
+
function Ae({
|
|
28
|
+
collection: r,
|
|
28
29
|
itemId: s,
|
|
29
30
|
open: u,
|
|
30
31
|
onClose: p,
|
|
31
32
|
onSaved: S
|
|
32
33
|
}) {
|
|
33
|
-
const h =
|
|
34
|
-
queryKey: ["raw-edit-config",
|
|
34
|
+
const h = te(), M = Z(), [m, j] = _({}), [g, v] = _(/* @__PURE__ */ new Map()), [y, k] = _(/* @__PURE__ */ new Map()), [N, L] = _(!1), [B, C] = _(null), { data: c } = U({
|
|
35
|
+
queryKey: ["raw-edit-config", r],
|
|
35
36
|
queryFn: async () => {
|
|
36
|
-
const [e,
|
|
37
|
-
h.request($(`/field-config/${
|
|
38
|
-
h.request($(`/collections/${
|
|
37
|
+
const [e, t] = await Promise.all([
|
|
38
|
+
h.request($(`/field-config/${r}`)).then((n) => n.data ?? []),
|
|
39
|
+
h.request($(`/collections/${r}`)).then((n) => n.data)
|
|
39
40
|
]);
|
|
40
|
-
return { fields: e, relations:
|
|
41
|
+
return { fields: e, relations: t.relations ?? [] };
|
|
41
42
|
},
|
|
42
43
|
enabled: u,
|
|
43
44
|
staleTime: 6e4
|
|
44
45
|
}), { data: o, isLoading: H } = U({
|
|
45
|
-
queryKey: ["raw-edit-record",
|
|
46
|
-
queryFn: () => h.request($(`/items/${
|
|
46
|
+
queryKey: ["raw-edit-record", r, s],
|
|
47
|
+
queryFn: () => h.request($(`/items/${r}/${s}`)).then((e) => e.data),
|
|
47
48
|
enabled: u,
|
|
48
49
|
staleTime: 0
|
|
49
|
-
}), G =
|
|
50
|
-
const e = (c == null ? void 0 : c.fields) ?? [],
|
|
51
|
-
return e.filter((
|
|
50
|
+
}), G = Q(() => {
|
|
51
|
+
const e = (c == null ? void 0 : c.fields) ?? [], t = (c == null ? void 0 : c.relations) ?? [], n = (i) => t.some((a) => a.one_collection === r && a.one_field === i.field);
|
|
52
|
+
return e.filter((i) => !i.field.startsWith("__")).map((i) => ({
|
|
52
53
|
// Strip every conditional/curation config — raw mode ignores them all
|
|
53
54
|
field: {
|
|
54
|
-
...
|
|
55
|
+
...i,
|
|
55
56
|
hidden: !1,
|
|
56
57
|
readonly: !1,
|
|
57
58
|
visibility_rules: null,
|
|
58
59
|
lock_condition: null,
|
|
59
60
|
dependency_config: null
|
|
60
61
|
},
|
|
61
|
-
alias:
|
|
62
|
-
m2mRel:
|
|
63
|
-
(a) => a.one_collection ===
|
|
62
|
+
alias: n(i),
|
|
63
|
+
m2mRel: t.find(
|
|
64
|
+
(a) => a.one_collection === r && a.one_field === i.field && a.junction_field != null
|
|
64
65
|
)
|
|
65
|
-
})).sort((
|
|
66
|
-
}, [c,
|
|
67
|
-
(
|
|
68
|
-
),
|
|
69
|
-
const
|
|
70
|
-
(
|
|
66
|
+
})).sort((i, a) => (i.field.sort ?? 0) - (a.field.sort ?? 0));
|
|
67
|
+
}, [c, r]), x = (c == null ? void 0 : c.relations) ?? [], O = (e) => x.find(
|
|
68
|
+
(t) => t.one_collection === r && t.one_field === e && t.junction_field != null
|
|
69
|
+
), F = (e) => {
|
|
70
|
+
const t = x.find(
|
|
71
|
+
(n) => n.many_collection === e.many_collection && n.many_field === e.junction_field && n.id !== e.id
|
|
71
72
|
);
|
|
72
|
-
return !
|
|
73
|
-
},
|
|
73
|
+
return !t || t.one_collection || pe(t) < 2 ? null : t.one_collection_field || "collection";
|
|
74
|
+
}, V = (e) => {
|
|
75
|
+
var t;
|
|
76
|
+
return re(
|
|
77
|
+
(t = x.find(
|
|
78
|
+
(n) => n.many_collection === e.many_collection && n.many_field === e.junction_field && n.id !== e.id
|
|
79
|
+
)) == null ? void 0 : t.one_collection
|
|
80
|
+
);
|
|
81
|
+
}, z = Q(
|
|
74
82
|
() => ({
|
|
75
83
|
getStagedLinks: (e) => g.get(e) ?? [],
|
|
76
84
|
getStagedUnlinks: (e) => y.get(e) ?? /* @__PURE__ */ new Set(),
|
|
77
|
-
stageLink: (e,
|
|
78
|
-
const
|
|
79
|
-
return
|
|
85
|
+
stageLink: (e, t) => v((n) => {
|
|
86
|
+
const i = new Map(n);
|
|
87
|
+
return i.set(e, [...i.get(e) ?? [], t]), i;
|
|
80
88
|
}),
|
|
81
|
-
unstageLink: (e,
|
|
82
|
-
const
|
|
83
|
-
return
|
|
89
|
+
unstageLink: (e, t) => v((n) => {
|
|
90
|
+
const i = new Map(n);
|
|
91
|
+
return i.set(
|
|
84
92
|
e,
|
|
85
|
-
(
|
|
86
|
-
),
|
|
93
|
+
(i.get(e) ?? []).filter((a) => String(a) !== String(t))
|
|
94
|
+
), i;
|
|
87
95
|
}),
|
|
88
|
-
stageUnlink: (e,
|
|
89
|
-
const
|
|
90
|
-
return a.add(
|
|
96
|
+
stageUnlink: (e, t) => k((n) => {
|
|
97
|
+
const i = new Map(n), a = new Set(i.get(e) ?? []);
|
|
98
|
+
return a.add(t), i.set(e, a), i;
|
|
91
99
|
}),
|
|
92
|
-
unstageUnlink: (e,
|
|
93
|
-
const
|
|
94
|
-
return a.delete(
|
|
100
|
+
unstageUnlink: (e, t) => k((n) => {
|
|
101
|
+
const i = new Map(n), a = new Set(i.get(e) ?? []);
|
|
102
|
+
return a.delete(t), i.set(e, a), i;
|
|
95
103
|
})
|
|
96
104
|
}),
|
|
97
105
|
[g, y]
|
|
98
|
-
),
|
|
99
|
-
var
|
|
106
|
+
), X = [...g.values()].some((e) => e.length > 0) || [...y.values()].some((e) => e.size > 0), A = Object.keys(m).length > 0 || X, K = async (e) => {
|
|
107
|
+
var t;
|
|
100
108
|
L(!0);
|
|
101
109
|
try {
|
|
102
110
|
if (Object.keys(m).length > 0) {
|
|
103
|
-
const
|
|
104
|
-
e && (
|
|
111
|
+
const i = { ...m };
|
|
112
|
+
e && (i._change_reason = e), await h.request(ne(`/items/${r}/${s}`, i));
|
|
105
113
|
}
|
|
106
|
-
const
|
|
107
|
-
for (const [
|
|
114
|
+
const n = [];
|
|
115
|
+
for (const [i, a] of y.entries()) {
|
|
108
116
|
if (!a.size) continue;
|
|
109
|
-
const d = O(
|
|
117
|
+
const d = O(i);
|
|
110
118
|
if (d)
|
|
111
|
-
for (const
|
|
112
|
-
|
|
119
|
+
for (const b of a)
|
|
120
|
+
n.push(h.request(ie(`/items/${d.many_collection}/${b}`)).catch(() => {
|
|
113
121
|
}));
|
|
114
122
|
}
|
|
115
|
-
for (const [
|
|
123
|
+
for (const [i, a] of g.entries()) {
|
|
116
124
|
if (!a.length) continue;
|
|
117
|
-
const d = O(
|
|
125
|
+
const d = O(i);
|
|
118
126
|
if (!d) continue;
|
|
119
|
-
const
|
|
120
|
-
(
|
|
121
|
-
),
|
|
122
|
-
for (const
|
|
123
|
-
|
|
127
|
+
const b = x.find(
|
|
128
|
+
(w) => w.many_collection === d.many_collection && w.many_field === d.junction_field && w.id !== d.id
|
|
129
|
+
), q = he(b), Y = q ? { [q.field]: q.value } : {};
|
|
130
|
+
for (const w of a)
|
|
131
|
+
n.push(
|
|
124
132
|
h.request(
|
|
125
133
|
ae(`/items/${d.many_collection}`, {
|
|
126
134
|
[d.many_field ?? ""]: s,
|
|
127
|
-
[d.junction_field ?? ""]:
|
|
128
|
-
...
|
|
135
|
+
[d.junction_field ?? ""]: w,
|
|
136
|
+
...Y
|
|
129
137
|
})
|
|
130
138
|
).catch(() => {
|
|
131
139
|
})
|
|
132
140
|
);
|
|
133
141
|
}
|
|
134
|
-
await Promise.all(
|
|
135
|
-
} catch (
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
138
|
-
|
|
142
|
+
await Promise.all(n), T.success("Raw changes saved"), j({}), v(/* @__PURE__ */ new Map()), k(/* @__PURE__ */ new Map()), M.invalidateQueries({ queryKey: ["item", r, String(s)] }), M.invalidateQueries({ queryKey: ["raw-edit-record", r, s] }), ge(M, [s]), S == null || S(), p();
|
|
143
|
+
} catch (n) {
|
|
144
|
+
const i = me(n);
|
|
145
|
+
if (i) {
|
|
146
|
+
C(i);
|
|
139
147
|
return;
|
|
140
148
|
}
|
|
141
|
-
const a =
|
|
142
|
-
|
|
149
|
+
const a = n == null ? void 0 : n.response;
|
|
150
|
+
T.error(((t = a == null ? void 0 : a.data) == null ? void 0 : t.error) ?? (a == null ? void 0 : a.error) ?? "Save failed");
|
|
143
151
|
} finally {
|
|
144
152
|
L(!1);
|
|
145
153
|
}
|
|
146
154
|
};
|
|
147
155
|
return /* @__PURE__ */ l(
|
|
148
|
-
|
|
156
|
+
se,
|
|
149
157
|
{
|
|
150
158
|
open: u,
|
|
151
159
|
onOpenChange: (e) => {
|
|
152
|
-
e ||
|
|
160
|
+
e || N || (j({}), v(/* @__PURE__ */ new Map()), k(/* @__PURE__ */ new Map()), p());
|
|
153
161
|
},
|
|
154
162
|
children: /* @__PURE__ */ f(
|
|
155
|
-
|
|
163
|
+
le,
|
|
156
164
|
{
|
|
157
165
|
side: "right",
|
|
158
166
|
className: "flex w-[1040px] max-w-[94vw] flex-col p-0 sm:max-w-[94vw]",
|
|
159
167
|
children: [
|
|
160
|
-
/* @__PURE__ */ l(
|
|
161
|
-
/* @__PURE__ */ l(
|
|
168
|
+
/* @__PURE__ */ l(oe, { className: "shrink-0 border-b border-slate-200 px-5 py-3 dark:border-border", children: /* @__PURE__ */ f(ce, { className: "flex items-center gap-2 text-[14px]", children: [
|
|
169
|
+
/* @__PURE__ */ l(I, { className: "h-4 w-4 text-nvr-cyan" }),
|
|
162
170
|
"Raw edit — ",
|
|
163
|
-
|
|
171
|
+
W(r),
|
|
164
172
|
" #",
|
|
165
173
|
s
|
|
166
174
|
] }) }),
|
|
167
175
|
/* @__PURE__ */ f("p", { className: "flex shrink-0 items-center gap-2 border-b border-amber-200 bg-amber-50 px-5 py-2 text-[12px] text-amber-800 dark:border-amber-500/20 dark:bg-amber-500/10 dark:text-amber-300", children: [
|
|
168
|
-
/* @__PURE__ */ l(
|
|
176
|
+
/* @__PURE__ */ l(ee, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
169
177
|
"Admin raw mode — visibility rules, locks, cascades and layout restrictions are bypassed. Server-side validation still applies. Every change is recorded in the revision history."
|
|
170
178
|
] }),
|
|
171
|
-
/* @__PURE__ */ l("div", { className: "min-h-0 flex-1 overflow-y-auto px-5 py-4", children: H || !c ? /* @__PURE__ */ l("div", { className: "flex justify-center py-10", children: /* @__PURE__ */ l(
|
|
172
|
-
const
|
|
179
|
+
/* @__PURE__ */ l("div", { className: "min-h-0 flex-1 overflow-y-auto px-5 py-4", children: H || !c ? /* @__PURE__ */ l("div", { className: "flex justify-center py-10", children: /* @__PURE__ */ l(P, { className: "h-5 w-5 animate-spin text-slate-400" }) }) : /* @__PURE__ */ l("div", { className: "space-y-3", children: G.map(({ field: e, alias: t, m2mRel: n }) => {
|
|
180
|
+
const i = e.field in m ? m[e.field] : o == null ? void 0 : o[e.field], a = e.field in m && !J(m[e.field], o == null ? void 0 : o[e.field]);
|
|
173
181
|
return /* @__PURE__ */ f(
|
|
174
182
|
"div",
|
|
175
183
|
{
|
|
@@ -179,7 +187,7 @@ function Oe({
|
|
|
179
187
|
children: [
|
|
180
188
|
/* @__PURE__ */ f("div", { className: "pt-1.5", children: [
|
|
181
189
|
/* @__PURE__ */ f("p", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: [
|
|
182
|
-
e.label ||
|
|
190
|
+
e.label || W(e.field),
|
|
183
191
|
a && /* @__PURE__ */ l("span", { className: "ml-1.5 rounded bg-amber-200/70 px-1 text-[9px] font-semibold uppercase tracking-wide text-amber-900 dark:bg-amber-500/20 dark:text-amber-200", children: "changed" })
|
|
184
192
|
] }),
|
|
185
193
|
/* @__PURE__ */ l("p", { className: "font-mono text-[10.5px] text-slate-400", children: e.field }),
|
|
@@ -187,35 +195,35 @@ function Oe({
|
|
|
187
195
|
"p",
|
|
188
196
|
{
|
|
189
197
|
className: "mt-0.5 truncate text-[10.5px] text-slate-400",
|
|
190
|
-
"data-tip": `Was: ${
|
|
198
|
+
"data-tip": `Was: ${R(o == null ? void 0 : o[e.field])}`,
|
|
191
199
|
children: [
|
|
192
200
|
"was ",
|
|
193
|
-
|
|
201
|
+
R(o == null ? void 0 : o[e.field])
|
|
194
202
|
]
|
|
195
203
|
}
|
|
196
204
|
)
|
|
197
205
|
] }),
|
|
198
|
-
e.field === "id" ? /* @__PURE__ */ l("p", { className: "pt-1.5 font-mono text-[12px] text-slate-500", children: String(
|
|
206
|
+
e.field === "id" ? /* @__PURE__ */ l("p", { className: "pt-1.5 font-mono text-[12px] text-slate-500", children: String(i ?? "") }) : t && n && F(n) ? (
|
|
199
207
|
// A ship-to contact is a person OR an external email: the
|
|
200
208
|
// plain picker read every link as a person, so an external
|
|
201
209
|
// email showed "Record not found". List each link as it is.
|
|
202
|
-
/* @__PURE__ */ l(
|
|
203
|
-
|
|
210
|
+
/* @__PURE__ */ l(E.Provider, { value: z, children: /* @__PURE__ */ l(
|
|
211
|
+
ye,
|
|
204
212
|
{
|
|
205
|
-
collection:
|
|
213
|
+
collection: r,
|
|
206
214
|
itemId: s,
|
|
207
215
|
field: e.field,
|
|
208
|
-
discriminator:
|
|
216
|
+
discriminator: F(n)
|
|
209
217
|
}
|
|
210
218
|
) })
|
|
211
|
-
) : n &&
|
|
212
|
-
|
|
219
|
+
) : t && n && V(n) ? /* @__PURE__ */ l("p", { className: "pt-1.5 text-[11.5px] italic text-slate-500 dark:text-slate-400", children: "Files — edit through the normal form" }) : t && n ? /* @__PURE__ */ l(E.Provider, { value: z, children: /* @__PURE__ */ l(ue, { relation: n, parentId: s, allRelations: x }) }) : t ? /* @__PURE__ */ l("p", { className: "pt-1.5 text-[11.5px] italic text-slate-500 dark:text-slate-400", children: "Child rows (one-to-many) — edit through the normal form" }) : /* @__PURE__ */ l(
|
|
220
|
+
fe,
|
|
213
221
|
{
|
|
214
222
|
field: e,
|
|
215
|
-
value:
|
|
216
|
-
onChange: (d) => j((
|
|
223
|
+
value: i,
|
|
224
|
+
onChange: (d) => j((b) => ({ ...b, [e.field]: d })),
|
|
217
225
|
relations: c.relations,
|
|
218
|
-
collection:
|
|
226
|
+
collection: r,
|
|
219
227
|
itemId: s
|
|
220
228
|
}
|
|
221
229
|
)
|
|
@@ -226,22 +234,22 @@ function Oe({
|
|
|
226
234
|
}) }) }),
|
|
227
235
|
/* @__PURE__ */ f("div", { className: "flex shrink-0 items-center justify-between gap-3 border-t border-slate-200 px-5 py-3 dark:border-border", children: [
|
|
228
236
|
/* @__PURE__ */ l("span", { className: "text-[11.5px] text-slate-400", children: (() => {
|
|
229
|
-
if (!
|
|
230
|
-
const e = Object.keys(m).filter((
|
|
237
|
+
if (!A) return "No changes yet";
|
|
238
|
+
const e = Object.keys(m).filter((t) => !J(m[t], o == null ? void 0 : o[t])).length + [...g.values()].filter((t) => t.length > 0).length + [...y.values()].filter((t) => t.size > 0).length;
|
|
231
239
|
return e === 0 ? "No changes yet" : `${e} field${e !== 1 ? "s" : ""} changed`;
|
|
232
240
|
})() }),
|
|
233
241
|
/* @__PURE__ */ f("div", { className: "flex gap-2", children: [
|
|
234
|
-
/* @__PURE__ */ l(
|
|
235
|
-
/* @__PURE__ */ l(
|
|
242
|
+
/* @__PURE__ */ l(D, { variant: "outline", size: "sm", onClick: p, disabled: N, children: "Cancel" }),
|
|
243
|
+
/* @__PURE__ */ l(D, { size: "sm", onClick: () => void K(), disabled: !A || N, children: N ? /* @__PURE__ */ l(P, { className: "h-3.5 w-3.5 animate-spin" }) : "Save raw changes" })
|
|
236
244
|
] })
|
|
237
245
|
] }),
|
|
238
246
|
/* @__PURE__ */ l(
|
|
239
|
-
|
|
247
|
+
de,
|
|
240
248
|
{
|
|
241
249
|
challenge: B,
|
|
242
|
-
onCancel: () =>
|
|
250
|
+
onCancel: () => C(null),
|
|
243
251
|
onSubmit: (e) => {
|
|
244
|
-
|
|
252
|
+
C(null), K(e);
|
|
245
253
|
}
|
|
246
254
|
}
|
|
247
255
|
)
|
|
@@ -252,5 +260,5 @@ function Oe({
|
|
|
252
260
|
);
|
|
253
261
|
}
|
|
254
262
|
export {
|
|
255
|
-
|
|
263
|
+
Ae as RawEditSheet
|
|
256
264
|
};
|