@nivaro/react 0.3.49 → 0.3.51
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/InlineGridField.js +166 -105
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +38 -4
- package/dist/shared/components/ItemEditForm.js +5258 -5034
- package/dist/shared/components/QueryTable.js +489 -347
- package/dist/shared/components/ReportView.js +105 -99
- package/dist/shared/components/alerts/AlertManagerView.js +327 -301
- package/dist/shared/components/item-edit/CatalogPickerField.js +1230 -1175
- package/dist/shared/components/item-edit/CloneDialog.js +192 -142
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
- package/dist/shared/components/item-edit/FieldRenderer.js +249 -244
- package/dist/shared/components/item-edit/FieldRow.js +402 -370
- package/dist/shared/components/item-edit/FilePickerField.js +315 -307
- package/dist/shared/components/item-edit/InlineGridField.js +92 -90
- package/dist/shared/components/item-edit/InlineTableField.js +3119 -2951
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
- package/dist/shared/components/item-edit/PlanGrid.js +162 -162
- package/dist/shared/components/item-edit/PolishFields.js +169 -162
- package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
- package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
- package/dist/shared/components/item-edit/RelationCombobox.js +198 -191
- package/dist/shared/components/item-edit/SummaryPanel.js +282 -259
- package/dist/shared/components/item-edit/UserChip.js +233 -200
- package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
- package/dist/shared/components/item-edit/header-midair.js +51 -0
- package/dist/shared/components/item-edit/helpers.js +181 -155
- package/dist/shared/components/item-edit/line-midair.js +207 -0
- package/dist/shared/components/item-edit/soft-rules.js +27 -0
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/panels/CommentPanel.js +290 -284
- package/dist/shared/components/panels/ItemLockBanner.js +414 -358
- package/dist/shared/components/panels/PipelinePanel.js +1241 -992
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- package/dist/shared/components/panels/TaskPanel.js +71 -61
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
- package/dist/shared/components/panels/requirement-side-effects.js +40 -0
- package/dist/shared/components/queue/QueueWorklist.js +925 -871
- package/dist/shared/components/queue/column-chooser.js +21 -0
- package/dist/shared/components/queue/live-state-aspect.js +6 -0
- package/dist/shared/components/ui/number-draft-input.js +93 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
- package/dist/shared/lib/draft-store.js +48 -34
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/query-stats.js +60 -60
- package/package.json +1 -1
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { Check as
|
|
4
|
-
import { useState as Q, useRef as
|
|
1
|
+
import { jsx as l, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as E } from "@tanstack/react-query";
|
|
3
|
+
import { Check as ue, Copy as fe, ChevronRight as ye, Loader2 as pe } from "lucide-react";
|
|
4
|
+
import { useState as Q, useRef as he, createContext as xe, useContext as be } from "react";
|
|
5
5
|
import { useNivaroClient as U } from "../../context.js";
|
|
6
6
|
import { get as K } from "../../lib/commands.js";
|
|
7
|
-
import { useRecordReader as
|
|
8
|
-
import { cn as M, titleCase as z, toLocalDateString as
|
|
9
|
-
import { useChangePulse as
|
|
10
|
-
import { SYSTEM_FIELDS as
|
|
11
|
-
import { RelatedItemLabel as
|
|
12
|
-
const
|
|
13
|
-
function
|
|
7
|
+
import { useRecordReader as ge } from "../../lib/record-loader.js";
|
|
8
|
+
import { cn as M, titleCase as z, toLocalDateString as _e, choiceLabel as ke } from "../../lib/utils.js";
|
|
9
|
+
import { useChangePulse as Ne } from "./GroupSection.js";
|
|
10
|
+
import { SYSTEM_FIELDS as Se, SENTINEL_FIELDS as we, applyDisplayTemplate as ne, parseJson as le, richTextToPlain as Z } from "./helpers.js";
|
|
11
|
+
import { RelatedItemLabel as ae } from "./RelationCombobox.js";
|
|
12
|
+
const re = xe({});
|
|
13
|
+
function qe(e, t) {
|
|
14
14
|
return t ? Object.entries(t).every(
|
|
15
|
-
([
|
|
15
|
+
([n, a]) => a !== null && typeof a == "object" || String(e[n] ?? "") === String(a ?? "")
|
|
16
16
|
) : !0;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function Te({
|
|
19
19
|
relation: e,
|
|
20
20
|
parentId: t,
|
|
21
|
-
allRelations:
|
|
22
|
-
staging:
|
|
23
|
-
maxValues:
|
|
21
|
+
allRelations: n,
|
|
22
|
+
staging: a,
|
|
23
|
+
maxValues: h
|
|
24
24
|
}) {
|
|
25
25
|
var b, w, J;
|
|
26
|
-
const y = U(),
|
|
27
|
-
const
|
|
26
|
+
const y = U(), c = e.many_field ?? "", u = e.junction_field ?? (() => {
|
|
27
|
+
const r = n.find(
|
|
28
28
|
($) => $.many_collection === e.many_collection && $.id !== e.id
|
|
29
29
|
);
|
|
30
|
-
return (
|
|
31
|
-
})(),
|
|
32
|
-
(
|
|
33
|
-
)) == null ? void 0 : b.one_collection) ?? null, { data:
|
|
30
|
+
return (r == null ? void 0 : r.many_field) ?? "";
|
|
31
|
+
})(), x = e.one_field ?? `${e.many_collection}.${u}`, _ = ((b = n.find(
|
|
32
|
+
(r) => r.many_collection === e.many_collection && r.many_field === u && r.id !== e.id
|
|
33
|
+
)) == null ? void 0 : b.one_collection) ?? null, { data: k } = E({
|
|
34
34
|
queryKey: ["summary-junction-relations", e.many_collection],
|
|
35
35
|
queryFn: () => y.request(
|
|
36
36
|
K(`/data-model/relations/for/${e.many_collection}`)
|
|
37
|
-
).then((
|
|
37
|
+
).then((r) => r.data ?? []).catch(() => []),
|
|
38
38
|
enabled: !_ && !!e.many_collection && !!u,
|
|
39
39
|
staleTime: 10 * 6e4
|
|
40
|
-
}),
|
|
41
|
-
(
|
|
42
|
-
)) == null ? void 0 : w.one_collection) ?? null, { data:
|
|
43
|
-
queryKey: ["m2m-items", e.many_collection,
|
|
40
|
+
}), s = _ ?? ((w = k == null ? void 0 : k.find(
|
|
41
|
+
(r) => r.many_collection === e.many_collection && r.many_field === u && !!r.one_collection
|
|
42
|
+
)) == null ? void 0 : w.one_collection) ?? null, { data: o = [] } = E({
|
|
43
|
+
queryKey: ["m2m-items", e.many_collection, c, t],
|
|
44
44
|
queryFn: () => y.request(
|
|
45
45
|
K(`/items/${e.many_collection}`, {
|
|
46
|
-
filter: JSON.stringify({ [
|
|
46
|
+
filter: JSON.stringify({ [c]: { _eq: t } }),
|
|
47
47
|
limit: 200,
|
|
48
48
|
fields: `id,${u}`
|
|
49
49
|
})
|
|
50
|
-
).then((
|
|
50
|
+
).then((r) => r.data ?? []),
|
|
51
51
|
staleTime: 3e4,
|
|
52
52
|
enabled: !!t && t !== "new"
|
|
53
|
-
}),
|
|
54
|
-
(
|
|
55
|
-
)) == null ? void 0 : J.one_collection_field) ?? null, { data:
|
|
56
|
-
queryKey: ["summary-m2a-items", e.many_collection,
|
|
53
|
+
}), d = s ? null : ((J = [...n, ...k ?? []].find(
|
|
54
|
+
(r) => r.many_collection === e.many_collection && r.many_field === u && !!r.one_collection_field
|
|
55
|
+
)) == null ? void 0 : J.one_collection_field) ?? null, { data: g = [] } = E({
|
|
56
|
+
queryKey: ["summary-m2a-items", e.many_collection, c, t, d],
|
|
57
57
|
queryFn: () => y.request(
|
|
58
58
|
K(`/items/${e.many_collection}`, {
|
|
59
|
-
filter: JSON.stringify({ [
|
|
59
|
+
filter: JSON.stringify({ [c]: { _eq: t } }),
|
|
60
60
|
limit: 200,
|
|
61
|
-
fields: `id,${u},${
|
|
61
|
+
fields: `id,${u},${d}`
|
|
62
62
|
})
|
|
63
|
-
).then((
|
|
63
|
+
).then((r) => r.data ?? []),
|
|
64
64
|
staleTime: 3e4,
|
|
65
|
-
enabled: !!
|
|
66
|
-
}),
|
|
67
|
-
queryKey: ["col-meta",
|
|
68
|
-
queryFn: () => y.request(K(`/collections/${
|
|
69
|
-
enabled: !!
|
|
65
|
+
enabled: !!d && !!t && t !== "new"
|
|
66
|
+
}), D = s === "nivaro_files" || s === "directus_files", { data: N } = E({
|
|
67
|
+
queryKey: ["col-meta", s],
|
|
68
|
+
queryFn: () => y.request(K(`/collections/${s}`)).then((r) => r.data),
|
|
69
|
+
enabled: !!s && !D,
|
|
70
70
|
staleTime: 3e5
|
|
71
|
-
}), C = (
|
|
71
|
+
}), C = (a == null ? void 0 : a.getStagedLinks(x)) ?? [], L = (a == null ? void 0 : a.getStagedUnlinks(x)) ?? /* @__PURE__ */ new Set(), R = o.filter((r) => !L.has(r.id)), S = [
|
|
72
72
|
...C,
|
|
73
|
-
...R.map((
|
|
73
|
+
...R.map((r) => r[u]).filter((r) => r != null)
|
|
74
74
|
];
|
|
75
75
|
if (S.length === 0)
|
|
76
|
-
return /* @__PURE__ */
|
|
77
|
-
if (
|
|
76
|
+
return /* @__PURE__ */ l("span", { className: "text-slate-400 dark:text-slate-500", children: "—" });
|
|
77
|
+
if (s) {
|
|
78
78
|
const $ = S.slice(0, 5), j = S.length - 5;
|
|
79
79
|
return /* @__PURE__ */ p("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
|
|
80
|
-
$.map((
|
|
81
|
-
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
|
|
80
|
+
$.map((i, v) => /* @__PURE__ */ p("span", { children: [
|
|
81
|
+
v > 0 && ", ",
|
|
82
|
+
/* @__PURE__ */ l(
|
|
83
|
+
ae,
|
|
84
84
|
{
|
|
85
|
-
collection:
|
|
86
|
-
id:
|
|
85
|
+
collection: s,
|
|
86
|
+
id: i,
|
|
87
87
|
displayTemplate: N == null ? void 0 : N.display_template
|
|
88
88
|
}
|
|
89
89
|
)
|
|
90
|
-
] }, String(
|
|
90
|
+
] }, String(i))),
|
|
91
91
|
j > 0 && /* @__PURE__ */ p("span", { className: "text-slate-400 dark:text-slate-500", children: [
|
|
92
92
|
" +",
|
|
93
93
|
j,
|
|
@@ -95,23 +95,23 @@ function qe({
|
|
|
95
95
|
] })
|
|
96
96
|
] });
|
|
97
97
|
}
|
|
98
|
-
const m =
|
|
98
|
+
const m = d ? g.filter((r) => !L.has(r.id) && r[u] != null && r[d]).slice(0, 5) : [];
|
|
99
99
|
if (m.length > 0 && C.length === 0) {
|
|
100
|
-
const
|
|
100
|
+
const r = S.length - m.length;
|
|
101
101
|
return /* @__PURE__ */ p("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
|
|
102
102
|
m.map(($, j) => /* @__PURE__ */ p("span", { children: [
|
|
103
103
|
j > 0 && ", ",
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
-
|
|
104
|
+
/* @__PURE__ */ l(
|
|
105
|
+
ie,
|
|
106
106
|
{
|
|
107
|
-
collection:
|
|
107
|
+
collection: $e(String($[d])),
|
|
108
108
|
id: $[u]
|
|
109
109
|
}
|
|
110
110
|
)
|
|
111
111
|
] }, String($.id))),
|
|
112
|
-
|
|
112
|
+
r > 0 && /* @__PURE__ */ p("span", { className: "text-slate-400 dark:text-slate-500", children: [
|
|
113
113
|
" +",
|
|
114
|
-
|
|
114
|
+
r,
|
|
115
115
|
" more"
|
|
116
116
|
] })
|
|
117
117
|
] });
|
|
@@ -122,110 +122,110 @@ function qe({
|
|
|
122
122
|
S.length !== 1 ? "s" : ""
|
|
123
123
|
] });
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function $e(e) {
|
|
126
126
|
return e === "directus_users" ? "nivaro_users" : e;
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function se(e) {
|
|
129
129
|
const t = U();
|
|
130
|
-
return
|
|
130
|
+
return E({
|
|
131
131
|
queryKey: ["summary-display-template", e],
|
|
132
|
-
queryFn: () => t.request(K(`/collections/${e}`)).then((
|
|
133
|
-
var
|
|
134
|
-
return ((
|
|
132
|
+
queryFn: () => t.request(K(`/collections/${e}`)).then((n) => {
|
|
133
|
+
var a;
|
|
134
|
+
return ((a = n.data) == null ? void 0 : a.display_template) ?? null;
|
|
135
135
|
}).catch(() => null),
|
|
136
136
|
enabled: !!e,
|
|
137
137
|
staleTime: 10 * 6e4
|
|
138
138
|
}).data;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
const
|
|
142
|
-
return /* @__PURE__ */
|
|
140
|
+
function ie({ collection: e, id: t }) {
|
|
141
|
+
const n = se(e);
|
|
142
|
+
return /* @__PURE__ */ l(ae, { collection: e, id: t, displayTemplate: n ?? void 0 });
|
|
143
143
|
}
|
|
144
|
-
const
|
|
145
|
-
function
|
|
144
|
+
const ve = ["name", "title", "label", "subject", "description", "line_number"], Ce = ["amount", "total", "cost", "price", "quantity"], V = 4, X = 200;
|
|
145
|
+
function je(e, t) {
|
|
146
146
|
if (t) {
|
|
147
|
-
const
|
|
148
|
-
if (
|
|
147
|
+
const n = ne(t, e).replace(/\s*[·|\-–—/]\s*(?=[·|\-–—/]|$)/g, "").replace(/^\s*[·|\-–—/]\s*/, "").trim();
|
|
148
|
+
if (n !== "") return n;
|
|
149
149
|
}
|
|
150
|
-
for (const
|
|
151
|
-
const
|
|
152
|
-
if (
|
|
150
|
+
for (const n of ve) {
|
|
151
|
+
const a = e[n];
|
|
152
|
+
if (a != null && String(a).trim() !== "") return String(a).trim();
|
|
153
153
|
}
|
|
154
154
|
return `#${String(e.id ?? "")}`;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function oe({
|
|
157
157
|
relatedCollection: e,
|
|
158
158
|
manyField: t,
|
|
159
|
-
parentId:
|
|
160
|
-
rowFilter:
|
|
161
|
-
expanded:
|
|
159
|
+
parentId: n,
|
|
160
|
+
rowFilter: a,
|
|
161
|
+
expanded: h
|
|
162
162
|
}) {
|
|
163
163
|
var R, S;
|
|
164
|
-
const y = U(),
|
|
164
|
+
const y = U(), c = be(re), u = a && Object.keys(a).length > 0 ? {
|
|
165
165
|
_and: [
|
|
166
|
-
{ [t]: { _eq:
|
|
166
|
+
{ [t]: { _eq: n } },
|
|
167
167
|
Object.fromEntries(
|
|
168
|
-
Object.entries(
|
|
168
|
+
Object.entries(a).map(([m, b]) => [
|
|
169
169
|
m,
|
|
170
170
|
b !== null && typeof b == "object" ? b : { _eq: b }
|
|
171
171
|
])
|
|
172
172
|
)
|
|
173
173
|
]
|
|
174
|
-
} : { [t]: { _eq:
|
|
174
|
+
} : { [t]: { _eq: n } }, { data: x, isLoading: _ } = E({
|
|
175
175
|
queryKey: [
|
|
176
176
|
"o2m-rows",
|
|
177
177
|
e,
|
|
178
178
|
t,
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
n,
|
|
180
|
+
a ? JSON.stringify(a) : ""
|
|
181
181
|
],
|
|
182
182
|
queryFn: () => y.request(
|
|
183
183
|
K(`/items/${e}`, {
|
|
184
184
|
filter: JSON.stringify(u),
|
|
185
|
-
limit:
|
|
185
|
+
limit: X
|
|
186
186
|
})
|
|
187
187
|
).then((m) => m.data ?? []),
|
|
188
|
-
enabled: !!
|
|
188
|
+
enabled: !!n && n !== "new",
|
|
189
189
|
staleTime: 3e4
|
|
190
|
-
}),
|
|
191
|
-
(m) =>
|
|
192
|
-
),
|
|
193
|
-
...(
|
|
194
|
-
...
|
|
190
|
+
}), k = se(e), s = `${e}.${t}`, o = (R = c.deletes) == null ? void 0 : R.get(s), d = (((S = c.rows) == null ? void 0 : S.get(s)) ?? []).filter(
|
|
191
|
+
(m) => qe(m, a)
|
|
192
|
+
), g = [
|
|
193
|
+
...(x ?? []).filter((m) => !(o != null && o.has(String(m.id)))),
|
|
194
|
+
...d
|
|
195
195
|
];
|
|
196
|
-
if (_ &&
|
|
197
|
-
return /* @__PURE__ */
|
|
198
|
-
if (
|
|
199
|
-
return /* @__PURE__ */
|
|
200
|
-
const
|
|
201
|
-
(m) =>
|
|
196
|
+
if (_ && d.length === 0)
|
|
197
|
+
return /* @__PURE__ */ l(pe, { className: "h-3 w-3 animate-spin text-slate-400 dark:text-slate-500" });
|
|
198
|
+
if (g.length === 0)
|
|
199
|
+
return /* @__PURE__ */ l("span", { className: "italic text-[11px] text-slate-400 dark:text-slate-500", children: "None yet" });
|
|
200
|
+
const D = ((x == null ? void 0 : x.length) ?? 0) >= X, N = Ce.find(
|
|
201
|
+
(m) => g.some(
|
|
202
202
|
(b) => typeof b[m] == "number" || typeof b[m] == "string" && b[m] !== "" && !Number.isNaN(Number(b[m]))
|
|
203
203
|
)
|
|
204
|
-
), C = N && !
|
|
204
|
+
), C = N && !D ? g.reduce((m, b) => {
|
|
205
205
|
const w = Number(b[N]);
|
|
206
206
|
return m + (Number.isFinite(w) ? w : 0);
|
|
207
207
|
}, 0) : null, L = N ? N !== "quantity" : !1;
|
|
208
208
|
return /* @__PURE__ */ p("span", { className: "block", children: [
|
|
209
209
|
/* @__PURE__ */ p("span", { className: "flex items-baseline gap-2", children: [
|
|
210
210
|
/* @__PURE__ */ p("span", { className: "text-slate-700 dark:text-slate-200", children: [
|
|
211
|
-
|
|
211
|
+
D ? `${X}+` : g.length,
|
|
212
212
|
" row",
|
|
213
|
-
|
|
213
|
+
g.length !== 1 ? "s" : ""
|
|
214
214
|
] }),
|
|
215
|
-
C !== null && /* @__PURE__ */
|
|
215
|
+
C !== null && /* @__PURE__ */ l("span", { className: "tabular-nums text-[11px] text-slate-500 dark:text-slate-400", children: L ? C.toLocaleString(void 0, {
|
|
216
216
|
style: "currency",
|
|
217
217
|
currency: "USD",
|
|
218
218
|
maximumFractionDigits: C % 1 === 0 ? 0 : 2
|
|
219
219
|
}) : C.toLocaleString() })
|
|
220
220
|
] }),
|
|
221
221
|
/* @__PURE__ */ p("span", { className: "mt-1 block space-y-0.5", children: [
|
|
222
|
-
(
|
|
222
|
+
(h ? g : g.slice(0, V)).map((m, b) => /* @__PURE__ */ p(
|
|
223
223
|
"span",
|
|
224
224
|
{
|
|
225
225
|
className: "flex items-baseline justify-between gap-2 text-[11px] text-slate-500 dark:text-slate-400",
|
|
226
226
|
children: [
|
|
227
|
-
/* @__PURE__ */
|
|
228
|
-
N && m[N] !== null && m[N] !== void 0 && /* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ l("span", { className: "truncate", children: je(m, k ?? null) }),
|
|
228
|
+
N && m[N] !== null && m[N] !== void 0 && /* @__PURE__ */ l("span", { className: "shrink-0 tabular-nums", children: (() => {
|
|
229
229
|
const w = Number(m[N]);
|
|
230
230
|
return Number.isFinite(w) ? L ? w.toLocaleString(void 0, {
|
|
231
231
|
style: "currency",
|
|
@@ -237,32 +237,32 @@ function se({
|
|
|
237
237
|
},
|
|
238
238
|
String(m.id ?? b)
|
|
239
239
|
)),
|
|
240
|
-
!
|
|
240
|
+
!h && g.length > V && /* @__PURE__ */ p("span", { className: "block text-[11px] italic text-slate-400 dark:text-slate-500", children: [
|
|
241
241
|
"+",
|
|
242
|
-
|
|
242
|
+
D ? `${g.length - V}+` : g.length - V,
|
|
243
243
|
" more"
|
|
244
244
|
] })
|
|
245
245
|
] })
|
|
246
246
|
] });
|
|
247
247
|
}
|
|
248
|
-
function
|
|
249
|
-
const t =
|
|
250
|
-
return /* @__PURE__ */
|
|
248
|
+
function Le(e) {
|
|
249
|
+
const t = Ne(e.val);
|
|
250
|
+
return /* @__PURE__ */ l("span", { className: M("inline-block max-w-full rounded-sm", t && "nvr-value-pulse-bg"), children: /* @__PURE__ */ l(Oe, { ...e }) });
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function Oe({
|
|
253
253
|
field: e,
|
|
254
254
|
val: t,
|
|
255
|
-
relations:
|
|
256
|
-
collection:
|
|
257
|
-
itemId:
|
|
255
|
+
relations: n,
|
|
256
|
+
collection: a,
|
|
257
|
+
itemId: h,
|
|
258
258
|
staging: y
|
|
259
259
|
}) {
|
|
260
|
-
const
|
|
261
|
-
if (!u.has(
|
|
262
|
-
const
|
|
263
|
-
(o) => !o.junction_field && (o.one_field === e.field || o.many_collection === e.field) && (o.one_collection ===
|
|
260
|
+
const c = e.interface ?? "", u = /* @__PURE__ */ new Set(["select-multiple-m2m", "files-m2m", "files", "relation-grouped"]);
|
|
261
|
+
if (!u.has(c) && h) {
|
|
262
|
+
const s = n.find(
|
|
263
|
+
(o) => !o.junction_field && (o.one_field === e.field || o.many_collection === e.field) && (o.one_collection === a || o.one_collection == null)
|
|
264
264
|
);
|
|
265
|
-
if (
|
|
265
|
+
if (s != null && s.many_collection && s.many_field) {
|
|
266
266
|
const o = (() => {
|
|
267
267
|
try {
|
|
268
268
|
return typeof e.options == "string" ? JSON.parse(e.options) : e.options ?? {};
|
|
@@ -270,64 +270,85 @@ function Le({
|
|
|
270
270
|
return {};
|
|
271
271
|
}
|
|
272
272
|
})();
|
|
273
|
-
return /* @__PURE__ */
|
|
274
|
-
|
|
273
|
+
return /* @__PURE__ */ l(
|
|
274
|
+
oe,
|
|
275
275
|
{
|
|
276
|
-
relatedCollection:
|
|
277
|
-
manyField:
|
|
278
|
-
parentId:
|
|
276
|
+
relatedCollection: s.many_collection,
|
|
277
|
+
manyField: s.many_field,
|
|
278
|
+
parentId: h,
|
|
279
279
|
rowFilter: o.row_filter && typeof o.row_filter == "object" ? o.row_filter : void 0
|
|
280
280
|
}
|
|
281
281
|
);
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
|
-
if (u.has(
|
|
285
|
-
const
|
|
286
|
-
(
|
|
287
|
-
), o =
|
|
288
|
-
const
|
|
289
|
-
(
|
|
284
|
+
if (u.has(c) && h) {
|
|
285
|
+
const s = n.find(
|
|
286
|
+
(d) => d.one_collection === a && (d.one_field === e.field || d.junction_field != null && d.many_collection === e.field)
|
|
287
|
+
), o = s ? s.junction_field ? s : (() => {
|
|
288
|
+
const d = n.find(
|
|
289
|
+
(g) => g.many_collection === s.many_collection && g.id !== s.id
|
|
290
290
|
);
|
|
291
|
-
return
|
|
291
|
+
return d ? { ...s, junction_field: d.many_field } : null;
|
|
292
292
|
})() : null;
|
|
293
293
|
if (o) {
|
|
294
|
-
const
|
|
295
|
-
return /* @__PURE__ */
|
|
296
|
-
|
|
294
|
+
const d = le(e.options);
|
|
295
|
+
return /* @__PURE__ */ l(
|
|
296
|
+
Te,
|
|
297
297
|
{
|
|
298
298
|
relation: o,
|
|
299
|
-
parentId:
|
|
300
|
-
allRelations:
|
|
299
|
+
parentId: h,
|
|
300
|
+
allRelations: n,
|
|
301
301
|
staging: y,
|
|
302
|
-
maxValues:
|
|
302
|
+
maxValues: d == null ? void 0 : d.max_values
|
|
303
303
|
}
|
|
304
304
|
);
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
const
|
|
308
|
-
if (
|
|
309
|
-
return /* @__PURE__ */
|
|
310
|
-
if (
|
|
311
|
-
if (
|
|
312
|
-
const
|
|
313
|
-
if (
|
|
314
|
-
return /* @__PURE__ */
|
|
307
|
+
const x = t == null || t === "";
|
|
308
|
+
if (x && e.type === "boolean")
|
|
309
|
+
return /* @__PURE__ */ l("span", { className: "text-slate-700 dark:text-slate-200", children: "No" });
|
|
310
|
+
if (x) return /* @__PURE__ */ l("span", { className: "text-slate-400 dark:text-slate-500", children: "—" });
|
|
311
|
+
if (c === "extension-editorjs" || c === "input-rich-text-html" || c === "rich_text" || c === "wysiwyg" || typeof t == "string") {
|
|
312
|
+
const s = De(t, c);
|
|
313
|
+
if (s !== null)
|
|
314
|
+
return /* @__PURE__ */ l("span", { className: "truncate text-slate-700 dark:text-slate-200", title: s, children: s || "—" });
|
|
315
315
|
}
|
|
316
316
|
if (typeof t == "boolean")
|
|
317
|
-
return /* @__PURE__ */
|
|
318
|
-
const _ =
|
|
319
|
-
(
|
|
317
|
+
return /* @__PURE__ */ l("span", { className: "text-slate-700 dark:text-slate-200", children: t ? "Yes" : "No" });
|
|
318
|
+
const _ = n.find(
|
|
319
|
+
(s) => s.many_collection === a && s.many_field === e.field && !s.junction_field
|
|
320
320
|
);
|
|
321
321
|
if (_ != null && _.one_collection)
|
|
322
|
-
return /* @__PURE__ */
|
|
322
|
+
return /* @__PURE__ */ l(ie, { collection: _.one_collection, id: t });
|
|
323
323
|
if (e.type === "datetime" || e.type === "date")
|
|
324
324
|
try {
|
|
325
|
-
return /* @__PURE__ */
|
|
325
|
+
return /* @__PURE__ */ l("span", { className: "text-slate-700 dark:text-slate-200", children: _e(t) });
|
|
326
326
|
} catch {
|
|
327
327
|
}
|
|
328
|
-
|
|
328
|
+
const k = Me(e.options, t);
|
|
329
|
+
return /* @__PURE__ */ l("span", { className: "truncate text-slate-700 dark:text-slate-200", children: k ?? String(t) });
|
|
329
330
|
}
|
|
330
|
-
function
|
|
331
|
+
function Me(e, t) {
|
|
332
|
+
var h;
|
|
333
|
+
if (t == null || typeof t == "object") return null;
|
|
334
|
+
const n = le(
|
|
335
|
+
e
|
|
336
|
+
), a = (h = n == null ? void 0 : n.choices) == null ? void 0 : h.find((y) => y && String(y.value) === String(t));
|
|
337
|
+
return (a == null ? void 0 : a.text) != null ? ke(a.text) : null;
|
|
338
|
+
}
|
|
339
|
+
const Ee = /* @__PURE__ */ new Set([
|
|
340
|
+
"extension-editorjs",
|
|
341
|
+
"input-rich-text-html",
|
|
342
|
+
"rich_text",
|
|
343
|
+
"wysiwyg"
|
|
344
|
+
]);
|
|
345
|
+
function De(e, t) {
|
|
346
|
+
if (typeof e != "string") return null;
|
|
347
|
+
if (Ee.has(t)) return Z(e);
|
|
348
|
+
const n = e.trim();
|
|
349
|
+
return n.startsWith("{") && /"blocks"\s*:/.test(n) ? Z(e) : null;
|
|
350
|
+
}
|
|
351
|
+
function Re(e) {
|
|
331
352
|
if (e == null || e === "") return "—";
|
|
332
353
|
if (typeof e == "boolean") return e ? "Yes" : "No";
|
|
333
354
|
const t = String(e);
|
|
@@ -338,138 +359,138 @@ function Oe(e) {
|
|
|
338
359
|
}
|
|
339
360
|
return t;
|
|
340
361
|
}
|
|
341
|
-
const
|
|
362
|
+
const ee = (e) => {
|
|
342
363
|
if (e == null || e === "") return "empty";
|
|
343
364
|
if (typeof e == "boolean") return e ? "Yes" : "No";
|
|
344
365
|
if (typeof e == "object") {
|
|
345
|
-
const
|
|
346
|
-
return
|
|
366
|
+
const n = e.id;
|
|
367
|
+
return n != null ? `#${String(n)}` : Array.isArray(e) ? `${e.length} items` : "a value";
|
|
347
368
|
}
|
|
348
369
|
const t = String(e).replace(/<[^>]+>/g, "").trim();
|
|
349
370
|
return t.length > 48 ? `${t.slice(0, 48)}…` : t;
|
|
350
371
|
};
|
|
351
|
-
function
|
|
352
|
-
const
|
|
372
|
+
function te(e, t) {
|
|
373
|
+
const n = U(), a = ge(), h = !!e && t != null && t !== "", { data: y } = E({
|
|
353
374
|
queryKey: ["cbv-collection-meta", e],
|
|
354
|
-
queryFn: () =>
|
|
355
|
-
enabled:
|
|
375
|
+
queryFn: () => n.request(K(`/collections/${e}`)).then((x) => x.data),
|
|
376
|
+
enabled: h,
|
|
356
377
|
staleTime: 10 * 6e4,
|
|
357
378
|
retry: !1
|
|
358
|
-
}), { data:
|
|
379
|
+
}), { data: c } = E({
|
|
359
380
|
queryKey: ["rrv-related", e, String(t)],
|
|
360
|
-
queryFn: () =>
|
|
361
|
-
enabled:
|
|
381
|
+
queryFn: () => a(e, t).catch(() => null),
|
|
382
|
+
enabled: h && !!y,
|
|
362
383
|
staleTime: 6e4,
|
|
363
384
|
retry: !1
|
|
364
385
|
});
|
|
365
|
-
if (!
|
|
366
|
-
if (!
|
|
367
|
-
const u =
|
|
386
|
+
if (!h) return null;
|
|
387
|
+
if (!c) return `#${String(t)}`;
|
|
388
|
+
const u = ne(y == null ? void 0 : y.display_template, c).trim();
|
|
368
389
|
if (u) return u;
|
|
369
|
-
for (const
|
|
390
|
+
for (const x of ["name", "title", "label", "number", "email"]) if (c[x]) return String(c[x]);
|
|
370
391
|
return `#${String(t)}`;
|
|
371
392
|
}
|
|
372
|
-
function
|
|
393
|
+
function Ae({
|
|
373
394
|
field: e,
|
|
374
395
|
from: t,
|
|
375
|
-
to:
|
|
376
|
-
detail:
|
|
377
|
-
relations:
|
|
396
|
+
to: n,
|
|
397
|
+
detail: a,
|
|
398
|
+
relations: h,
|
|
378
399
|
collection: y,
|
|
379
|
-
onRevert:
|
|
400
|
+
onRevert: c
|
|
380
401
|
}) {
|
|
381
|
-
var
|
|
382
|
-
const u = ((
|
|
383
|
-
(
|
|
384
|
-
)) == null ? void 0 :
|
|
385
|
-
return
|
|
402
|
+
var s;
|
|
403
|
+
const u = ((s = h.find(
|
|
404
|
+
(o) => o.many_collection === y && o.many_field === e.field && !!o.one_collection
|
|
405
|
+
)) == null ? void 0 : s.one_collection) ?? null, x = te(u, t), _ = te(u, n), k = a ? `Unsaved — ${a}` : `Unsaved — was ${x ?? ee(t)} → now ${_ ?? ee(n)}`;
|
|
406
|
+
return c ? (
|
|
386
407
|
// biome-ignore lint/a11y/useSemanticElements: nested inside the row's <button> — a real <button> is invalid there
|
|
387
|
-
/* @__PURE__ */
|
|
408
|
+
/* @__PURE__ */ l(
|
|
388
409
|
"span",
|
|
389
410
|
{
|
|
390
411
|
role: "button",
|
|
391
412
|
tabIndex: 0,
|
|
392
413
|
"data-summary-changed": !0,
|
|
393
|
-
"data-tip": `${
|
|
414
|
+
"data-tip": `${k} · click to revert`,
|
|
394
415
|
"aria-label": "Revert this change",
|
|
395
|
-
onClick: (
|
|
396
|
-
|
|
416
|
+
onClick: (o) => {
|
|
417
|
+
o.stopPropagation(), c();
|
|
397
418
|
},
|
|
398
|
-
onKeyDown: (
|
|
399
|
-
(
|
|
419
|
+
onKeyDown: (o) => {
|
|
420
|
+
(o.key === "Enter" || o.key === " ") && (o.preventDefault(), o.stopPropagation(), c());
|
|
400
421
|
},
|
|
401
422
|
className: "group/dot inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-full hover:bg-amber-100 dark:hover:bg-amber-500/20",
|
|
402
|
-
children: /* @__PURE__ */
|
|
423
|
+
children: /* @__PURE__ */ l("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 ring-2 ring-amber-100 group-hover/dot:ring-amber-200 dark:ring-amber-500/30" })
|
|
403
424
|
}
|
|
404
425
|
)
|
|
405
|
-
) : /* @__PURE__ */
|
|
426
|
+
) : /* @__PURE__ */ l(
|
|
406
427
|
"span",
|
|
407
428
|
{
|
|
408
429
|
"data-summary-changed": !0,
|
|
409
|
-
"data-tip":
|
|
430
|
+
"data-tip": k,
|
|
410
431
|
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400 ring-2 ring-amber-100 dark:ring-amber-500/30"
|
|
411
432
|
}
|
|
412
433
|
);
|
|
413
434
|
}
|
|
414
|
-
function
|
|
435
|
+
function Ge({
|
|
415
436
|
allSteps: e,
|
|
416
437
|
groupedMap: t,
|
|
417
|
-
ungroupedFields:
|
|
418
|
-
sectionGroups:
|
|
419
|
-
draft:
|
|
438
|
+
ungroupedFields: n,
|
|
439
|
+
sectionGroups: a,
|
|
440
|
+
draft: h,
|
|
420
441
|
relations: y,
|
|
421
|
-
collection:
|
|
442
|
+
collection: c,
|
|
422
443
|
itemId: u,
|
|
423
|
-
staging:
|
|
444
|
+
staging: x,
|
|
424
445
|
errors: _,
|
|
425
|
-
staleFields:
|
|
426
|
-
aliasEmptiness:
|
|
427
|
-
layoutFields:
|
|
428
|
-
changedFields:
|
|
429
|
-
onRevertChange:
|
|
430
|
-
onFieldClick:
|
|
446
|
+
staleFields: k,
|
|
447
|
+
aliasEmptiness: s,
|
|
448
|
+
layoutFields: o,
|
|
449
|
+
changedFields: d,
|
|
450
|
+
onRevertChange: g,
|
|
451
|
+
onFieldClick: D,
|
|
431
452
|
stagedO2MRows: N,
|
|
432
453
|
stagedO2MDeletes: C
|
|
433
454
|
}) {
|
|
434
|
-
const [L, R] = Q(null), [S, m] = Q(null), b =
|
|
435
|
-
...!e.some((
|
|
455
|
+
const [L, R] = Q(null), [S, m] = Q(null), b = he(/* @__PURE__ */ new Map()), r = [
|
|
456
|
+
...!e.some((i) => i.key === "__general__") && n.length > 0 ? [{ key: "__general__", label: "General" }] : [],
|
|
436
457
|
...e
|
|
437
|
-
].map((
|
|
438
|
-
const
|
|
439
|
-
return { step:
|
|
440
|
-
}).filter((
|
|
441
|
-
(
|
|
442
|
-
(!
|
|
458
|
+
].map((i) => {
|
|
459
|
+
const v = (i.key === "__general__" ? [...n, ...a.flatMap((q) => t[q.key] ?? [])] : t[i.key] ?? []).filter((q) => !q.hidden && !Se.has(q.field) && !we.has(q.field));
|
|
460
|
+
return { step: i, fields: v };
|
|
461
|
+
}).filter((i) => i.fields.length > 0), $ = new Set(r.flatMap((i) => i.fields.map((v) => v.field))), j = u && u !== "new" ? y.filter(
|
|
462
|
+
(i) => !i.junction_field && i.many_field && i.many_collection && (i.one_collection === c || i.one_collection == null) && i.one_field != null && !$.has(i.one_field) && // Off-layout aliases stay out — the sidebar summarizes THIS layout.
|
|
463
|
+
(!o || o.has(i.one_field))
|
|
443
464
|
) : [];
|
|
444
|
-
return
|
|
445
|
-
/* @__PURE__ */
|
|
446
|
-
|
|
447
|
-
/* @__PURE__ */
|
|
465
|
+
return r.length === 0 && j.length === 0 ? null : /* @__PURE__ */ l(re.Provider, { value: { rows: N, deletes: C }, children: /* @__PURE__ */ p("div", { className: "overflow-hidden bg-white dark:bg-card", children: [
|
|
466
|
+
/* @__PURE__ */ l("div", { className: "bg-slate-200 border-b border-slate-300 px-4 py-2.5 dark:bg-white/[0.1] dark:border-border", children: /* @__PURE__ */ l("span", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "Summary" }) }),
|
|
467
|
+
r.map(({ step: i, fields: v }, q) => /* @__PURE__ */ p("div", { children: [
|
|
468
|
+
/* @__PURE__ */ l(
|
|
448
469
|
"div",
|
|
449
470
|
{
|
|
450
471
|
className: M(
|
|
451
472
|
"bg-slate-100 px-4 py-2 border-b border-slate-200 dark:bg-white/[0.06] dark:border-border/80",
|
|
452
473
|
q > 0 && "border-t border-slate-200 dark:border-border/80"
|
|
453
474
|
),
|
|
454
|
-
children: /* @__PURE__ */
|
|
475
|
+
children: /* @__PURE__ */ l("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: i.label })
|
|
455
476
|
}
|
|
456
477
|
),
|
|
457
|
-
|
|
458
|
-
const
|
|
478
|
+
v.map((f, P) => {
|
|
479
|
+
const T = h[f.field], O = f.label ?? z(f.field), A = !!(_ != null && _[f.field]), F = s == null ? void 0 : s[f.field], ce = F !== void 0 ? F === !0 : T == null || typeof T == "string" && T.trim() === "" || Array.isArray(T) && T.length === 0, de = F === null, H = !!f.required && ce && !A && !de, I = (k == null ? void 0 : k.has(f.field)) ?? !1;
|
|
459
480
|
return /* @__PURE__ */ p(
|
|
460
481
|
"div",
|
|
461
482
|
{
|
|
462
483
|
className: M(
|
|
463
484
|
"group/row flex items-stretch",
|
|
464
|
-
P <
|
|
465
|
-
A ? "bg-red-50 dark:bg-red-900/10" : H ||
|
|
485
|
+
P < v.length - 1 && "border-b border-slate-100 dark:border-border/60",
|
|
486
|
+
A ? "bg-red-50 dark:bg-red-900/10" : H || I ? "bg-amber-50/70 dark:bg-amber-900/10" : ""
|
|
466
487
|
),
|
|
467
488
|
children: [
|
|
468
489
|
/* @__PURE__ */ p(
|
|
469
490
|
"button",
|
|
470
491
|
{
|
|
471
492
|
type: "button",
|
|
472
|
-
onClick: () =>
|
|
493
|
+
onClick: () => D(i.key, f.field),
|
|
473
494
|
className: M(
|
|
474
495
|
"flex flex-1 flex-col px-4 py-2 text-left transition-colors duration-150 min-w-0",
|
|
475
496
|
A ? "hover:bg-red-50 dark:hover:bg-red-900/15" : "hover:bg-slate-50 dark:hover:bg-white/[0.03]"
|
|
@@ -480,24 +501,24 @@ function We({
|
|
|
480
501
|
{
|
|
481
502
|
className: M(
|
|
482
503
|
"flex items-center gap-1 text-[10px] font-medium truncate",
|
|
483
|
-
A ? "text-red-500 dark:text-red-400" : H ||
|
|
504
|
+
A ? "text-red-500 dark:text-red-400" : H || I ? "text-amber-700 dark:text-amber-400" : "text-slate-400 dark:text-slate-500"
|
|
484
505
|
),
|
|
485
506
|
children: [
|
|
486
|
-
/* @__PURE__ */
|
|
487
|
-
(
|
|
488
|
-
|
|
507
|
+
/* @__PURE__ */ l("span", { className: "truncate", children: O }),
|
|
508
|
+
(d == null ? void 0 : d[f.field]) && /* @__PURE__ */ l(
|
|
509
|
+
Ae,
|
|
489
510
|
{
|
|
490
511
|
field: f,
|
|
491
|
-
from:
|
|
492
|
-
detail:
|
|
493
|
-
to:
|
|
512
|
+
from: d[f.field].from,
|
|
513
|
+
detail: d[f.field].detail,
|
|
514
|
+
to: T,
|
|
494
515
|
relations: y,
|
|
495
|
-
collection:
|
|
496
|
-
onRevert:
|
|
516
|
+
collection: c,
|
|
517
|
+
onRevert: g ? () => g(f.field) : void 0
|
|
497
518
|
}
|
|
498
519
|
),
|
|
499
|
-
H && /* @__PURE__ */
|
|
500
|
-
|
|
520
|
+
H && /* @__PURE__ */ l("span", { className: "shrink-0 rounded bg-amber-100 px-1 text-[9px] font-semibold uppercase tracking-wide text-amber-700 dark:bg-amber-900/30 dark:text-amber-400", children: "required" }),
|
|
521
|
+
I && /* @__PURE__ */ l(
|
|
501
522
|
"span",
|
|
502
523
|
{
|
|
503
524
|
title: "This value is no longer one of the available options",
|
|
@@ -508,22 +529,22 @@ function We({
|
|
|
508
529
|
]
|
|
509
530
|
}
|
|
510
531
|
),
|
|
511
|
-
/* @__PURE__ */
|
|
532
|
+
/* @__PURE__ */ l(
|
|
512
533
|
"span",
|
|
513
534
|
{
|
|
514
|
-
ref: (
|
|
515
|
-
b.current.set(f.field,
|
|
535
|
+
ref: (W) => {
|
|
536
|
+
b.current.set(f.field, W);
|
|
516
537
|
},
|
|
517
538
|
className: "mt-0.5 w-full text-[12px] min-w-0 overflow-hidden",
|
|
518
|
-
children: /* @__PURE__ */
|
|
519
|
-
|
|
539
|
+
children: /* @__PURE__ */ l(
|
|
540
|
+
Le,
|
|
520
541
|
{
|
|
521
542
|
field: f,
|
|
522
|
-
val:
|
|
543
|
+
val: T,
|
|
523
544
|
relations: y,
|
|
524
|
-
collection:
|
|
545
|
+
collection: c,
|
|
525
546
|
itemId: u,
|
|
526
|
-
staging:
|
|
547
|
+
staging: x
|
|
527
548
|
}
|
|
528
549
|
)
|
|
529
550
|
}
|
|
@@ -531,16 +552,16 @@ function We({
|
|
|
531
552
|
]
|
|
532
553
|
}
|
|
533
554
|
),
|
|
534
|
-
/* @__PURE__ */
|
|
555
|
+
/* @__PURE__ */ l(
|
|
535
556
|
"button",
|
|
536
557
|
{
|
|
537
558
|
type: "button",
|
|
538
559
|
title: "Copy value",
|
|
539
|
-
onClick: (
|
|
540
|
-
var
|
|
541
|
-
|
|
542
|
-
const
|
|
543
|
-
navigator.clipboard.writeText(
|
|
560
|
+
onClick: (W) => {
|
|
561
|
+
var Y, G;
|
|
562
|
+
W.stopPropagation();
|
|
563
|
+
const me = ((G = (Y = b.current.get(f.field)) == null ? void 0 : Y.textContent) == null ? void 0 : G.trim()) ?? Re(T);
|
|
564
|
+
navigator.clipboard.writeText(me).catch(() => {
|
|
544
565
|
}), R(f.field), setTimeout(
|
|
545
566
|
() => R((B) => B === f.field ? null : B),
|
|
546
567
|
1500
|
|
@@ -550,7 +571,7 @@ function We({
|
|
|
550
571
|
"flex items-center px-2 opacity-0 group-hover/row:opacity-100 transition-all duration-150",
|
|
551
572
|
L === f.field ? "text-emerald-500" : "text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300"
|
|
552
573
|
),
|
|
553
|
-
children: L === f.field ? /* @__PURE__ */
|
|
574
|
+
children: L === f.field ? /* @__PURE__ */ l(ue, { className: "h-3 w-3" }) : /* @__PURE__ */ l(fe, { className: "h-3 w-3" })
|
|
554
575
|
}
|
|
555
576
|
)
|
|
556
577
|
]
|
|
@@ -558,17 +579,17 @@ function We({
|
|
|
558
579
|
f.field
|
|
559
580
|
);
|
|
560
581
|
})
|
|
561
|
-
] },
|
|
582
|
+
] }, i.key)),
|
|
562
583
|
j.length > 0 && /* @__PURE__ */ p("div", { children: [
|
|
563
|
-
/* @__PURE__ */
|
|
564
|
-
j.map((
|
|
565
|
-
const q =
|
|
566
|
-
return /* @__PURE__ */
|
|
584
|
+
/* @__PURE__ */ l("div", { className: "bg-slate-100 px-4 py-2 border-y border-slate-200 dark:bg-white/[0.06] dark:border-border/80", children: /* @__PURE__ */ l("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: "Related" }) }),
|
|
585
|
+
j.map((i, v) => {
|
|
586
|
+
const q = i.one_field ?? i.many_collection ?? "", f = S === q;
|
|
587
|
+
return /* @__PURE__ */ l(
|
|
567
588
|
"div",
|
|
568
589
|
{
|
|
569
590
|
className: M(
|
|
570
591
|
"flex items-stretch",
|
|
571
|
-
|
|
592
|
+
v < j.length - 1 && "border-b border-slate-100 dark:border-border/60"
|
|
572
593
|
),
|
|
573
594
|
children: /* @__PURE__ */ p(
|
|
574
595
|
"button",
|
|
@@ -576,7 +597,7 @@ function We({
|
|
|
576
597
|
type: "button",
|
|
577
598
|
onClick: () => {
|
|
578
599
|
var A;
|
|
579
|
-
const P =
|
|
600
|
+
const P = i.many_collection ?? "", T = /(^|_)(notes?|comments?)$/i.test(P), O = document.querySelector(`[data-o2m-collection="${P}"]`) ?? (T ? document.querySelector('[data-panel="notes"]') : null);
|
|
580
601
|
if (!O) {
|
|
581
602
|
m((F) => F === q ? null : q);
|
|
582
603
|
return;
|
|
@@ -594,8 +615,8 @@ function We({
|
|
|
594
615
|
className: "flex flex-1 flex-col px-4 py-2 min-w-0 text-left transition-colors hover:bg-nvr-cyan/5",
|
|
595
616
|
children: [
|
|
596
617
|
/* @__PURE__ */ p("span", { className: "flex items-center gap-1 text-[10px] font-medium truncate text-slate-400 dark:text-slate-500", children: [
|
|
597
|
-
/* @__PURE__ */
|
|
598
|
-
|
|
618
|
+
/* @__PURE__ */ l(
|
|
619
|
+
ye,
|
|
599
620
|
{
|
|
600
621
|
className: M(
|
|
601
622
|
"h-3 w-3 shrink-0 transition-transform",
|
|
@@ -603,13 +624,13 @@ function We({
|
|
|
603
624
|
)
|
|
604
625
|
}
|
|
605
626
|
),
|
|
606
|
-
z(
|
|
627
|
+
z(i.one_field ?? i.many_collection ?? "")
|
|
607
628
|
] }),
|
|
608
|
-
/* @__PURE__ */
|
|
609
|
-
|
|
629
|
+
/* @__PURE__ */ l("span", { className: "mt-0.5 text-[12px]", children: /* @__PURE__ */ l(
|
|
630
|
+
oe,
|
|
610
631
|
{
|
|
611
|
-
relatedCollection:
|
|
612
|
-
manyField:
|
|
632
|
+
relatedCollection: i.many_collection ?? "",
|
|
633
|
+
manyField: i.many_field,
|
|
613
634
|
parentId: u,
|
|
614
635
|
expanded: f
|
|
615
636
|
}
|
|
@@ -618,14 +639,16 @@ function We({
|
|
|
618
639
|
}
|
|
619
640
|
)
|
|
620
641
|
},
|
|
621
|
-
|
|
642
|
+
i.id ?? `${i.many_collection}.${i.many_field}`
|
|
622
643
|
);
|
|
623
644
|
})
|
|
624
645
|
] })
|
|
625
646
|
] }) });
|
|
626
647
|
}
|
|
627
648
|
export {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
649
|
+
ie as M2OSummaryValue,
|
|
650
|
+
Le as SummaryFieldValue,
|
|
651
|
+
Ge as SummaryPanel,
|
|
652
|
+
Me as summaryChoiceLabel,
|
|
653
|
+
De as summaryPlainText
|
|
631
654
|
};
|