@declarion/react 0.32.0 → 0.35.1
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/README.md +1 -1
- package/dist-lib/{ActionRunner-CaSrGpBi.js → ActionRunner-Bkkb_YMa.js} +1332 -1310
- package/dist-lib/{DraggableChildrenTable-CAHg7paQ.js → DraggableChildrenTable-TNni9y0Q.js} +55 -55
- package/dist-lib/DynamicIcon-BWO6QtNF.js +261 -0
- package/dist-lib/{Grid-DDbBhqcl.js → Grid-DOtBLx3n.js} +2 -2
- package/dist-lib/{JsonEditor-KelPV-OQ.js → JsonEditor-DoNmyrYd.js} +2 -2
- package/dist-lib/{LayoutRenderer-CelsqsZ6.js → LayoutRenderer-CMuVgKev.js} +748 -746
- package/dist-lib/{MarkdownRenderer-DThy2ixe.js → MarkdownRenderer-DWOlvx8k.js} +1 -1
- package/dist-lib/{MonacoJson-DVjwsaBK.js → MonacoJson-BfpzZ1iT.js} +1 -1
- package/dist-lib/RefreshControl-CgU8mNEp.js +835 -0
- package/dist-lib/SmartDetailPage.impl-Bjl7EFzU.js +1774 -0
- package/dist-lib/{SmartRecordListPage.impl-BKIpTNK7.js → SmartRecordListPage.impl-D2eE-g5J.js} +91 -91
- package/dist-lib/assets/OFL-Inter.txt +93 -0
- package/dist-lib/assets/OFL-JetBrainsMono.txt +93 -0
- package/dist-lib/assets/inter-latin-ext-wght-normal.woff2 +0 -0
- package/dist-lib/assets/inter-latin-wght-normal.woff2 +0 -0
- package/dist-lib/assets/jetbrains-mono-latin-ext-wght-normal.woff2 +0 -0
- package/dist-lib/assets/jetbrains-mono-latin-wght-normal.woff2 +0 -0
- package/dist-lib/components/fields/cells/factories/host-icons.d.ts +9 -1
- package/dist-lib/components/layout/TopBar.d.ts +2 -1
- package/dist-lib/components/pages/DocumentsMenu.d.ts +22 -0
- package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +42 -0
- package/dist-lib/components/pages/list/DataCell.d.ts +1 -2
- package/dist-lib/components/pages/list/ListHeader.d.ts +1 -11
- package/dist-lib/components/primitives/Btn.d.ts +1 -1
- package/dist-lib/components/primitives/Icons.d.ts +1 -0
- package/dist-lib/components/primitives/Tooltip.d.ts +30 -0
- package/dist-lib/components/primitives/index.d.ts +2 -0
- package/dist-lib/components/shared/ActionResultDialog.d.ts +4 -0
- package/dist-lib/components/shared/RecordHeader.d.ts +2 -1
- package/dist-lib/components/shared/ResponsiveActionBar.d.ts +9 -1
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/embed/theme.d.ts +8 -8
- package/dist-lib/hooks/useBrandingChrome.d.ts +28 -2
- package/dist-lib/hooks/useResponsiveMode.d.ts +17 -1
- package/dist-lib/icons.js +1 -1
- package/dist-lib/index.js +2430 -2441
- package/dist-lib/lib/brand-tokens.d.ts +43 -0
- package/dist-lib/lib/document-templates.d.ts +12 -0
- package/dist-lib/lib/download.d.ts +20 -0
- package/dist-lib/lib/html-state.d.ts +11 -0
- package/dist-lib/lib/record-documents-key.d.ts +1 -0
- package/dist-lib/lib/versionTracker.d.ts +6 -0
- package/dist-lib/{registry-KQyyL5Gt.js → registry-GTwsJEYp.js} +1469 -1343
- package/dist-lib/stores/page-state.d.ts +1 -1
- package/dist-lib/stores/preferences.d.ts +37 -0
- package/dist-lib/testing.js +5 -5
- package/dist-lib/types/api.d.ts +95 -23
- package/dist-lib/types/schema.d.ts +32 -1
- package/dist-lib/{useProperties-D74hyWIa.js → useProperties-oNGJ7HwM.js} +67 -67
- package/dist-lib/{value-BfXXl5EE.js → value-DNs5L0Ad.js} +82 -82
- package/dist-lib/vite/fingerprint-plugin.d.ts +1 -1
- package/package.json +17 -16
- package/dist-lib/DynamicIcon-DCRdxxZ7.js +0 -260
- package/dist-lib/RefreshControl-CorluL6r.js +0 -582
- package/dist-lib/SmartDetailPage.impl-USIxbl-8.js +0 -1532
- package/dist-lib/stores/appearance.d.ts +0 -37
|
@@ -0,0 +1,1774 @@
|
|
|
1
|
+
import { s as e, t } from "./DynamicIcon-BWO6QtNF.js";
|
|
2
|
+
import { F as n, H as r, Hn as i, Jt as a, L as o, Ln as s, P as c, R as l, Un as u, Wn as d, Y as f, Z as p, an as m, b as h, cn as g, ct as _, et as v, fn as y, g as b, ht as x, in as S, it as C, jn as w, m as T, mt as ee, n as E, on as D, p as te, rn as ne, sn as re, st as O, un as ie, v as ae, vn as k } from "./ActionRunner-Bkkb_YMa.js";
|
|
3
|
+
import { I as oe, N as se, P as ce, S as le, f as A, h as j, i as ue, l as de, o as fe, t as M, u as N, v as pe, w as me } from "./RefreshControl-CgU8mNEp.js";
|
|
4
|
+
import { $ as he, D as ge, G as _e, H as ve, K as ye, L as P, M as be, O as xe, Q as Se, St as Ce, U as we, W as Te, X as Ee, Z as De, _ as Oe, a as ke, dt as Ae, et as je, ft as Me, i as Ne, nt as Pe, q as Fe, s as Ie, tt as Le, vt as Re, w as ze, z as Be } from "./registry-GTwsJEYp.js";
|
|
5
|
+
import { n as Ve, r as He, t as Ue } from "./dataTableStyles-vwD1mVOP.js";
|
|
6
|
+
import { n as We, t as Ge } from "./LayoutRenderer-CMuVgKev.js";
|
|
7
|
+
import { Fragment as Ke, useCallback as F, useEffect as I, useMemo as L, useRef as qe, useState as R } from "react";
|
|
8
|
+
import { useLocation as Je, useParams as Ye, useSearchParams as Xe } from "react-router-dom";
|
|
9
|
+
import { useQuery as Ze, useQueryClient as Qe } from "@tanstack/react-query";
|
|
10
|
+
import { Fragment as $e, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/shared/AssociationTabs.tsx
|
|
12
|
+
function et({ entityCode: e, recordId: n, associations: r, schema: i }) {
|
|
13
|
+
let a = L(() => Object.entries(r), [r]), [o, s] = R(0);
|
|
14
|
+
if (a.length === 0) return null;
|
|
15
|
+
let [c, l] = a[o];
|
|
16
|
+
return /* @__PURE__ */ z(Ce, {
|
|
17
|
+
title: /* @__PURE__ */ z("div", {
|
|
18
|
+
style: {
|
|
19
|
+
display: "flex",
|
|
20
|
+
alignItems: "center",
|
|
21
|
+
gap: 4,
|
|
22
|
+
borderBottom: "1px solid var(--divider)",
|
|
23
|
+
margin: "-10px -14px 0 -14px",
|
|
24
|
+
padding: "0 14px"
|
|
25
|
+
},
|
|
26
|
+
children: a.map(([e, n], r) => {
|
|
27
|
+
let i = r === o;
|
|
28
|
+
return /* @__PURE__ */ B("button", {
|
|
29
|
+
onClick: (e) => {
|
|
30
|
+
e.stopPropagation(), s(r);
|
|
31
|
+
},
|
|
32
|
+
style: {
|
|
33
|
+
display: "inline-flex",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
gap: 6,
|
|
36
|
+
padding: "10px 12px",
|
|
37
|
+
fontSize: 12.5,
|
|
38
|
+
background: "transparent",
|
|
39
|
+
border: 0,
|
|
40
|
+
borderBottom: `2px solid ${i ? "var(--accent)" : "transparent"}`,
|
|
41
|
+
marginBottom: -1,
|
|
42
|
+
color: i ? "var(--text)" : "var(--text-3)",
|
|
43
|
+
cursor: "pointer",
|
|
44
|
+
fontWeight: i ? 600 : 500
|
|
45
|
+
},
|
|
46
|
+
children: [n.display?.icon && /* @__PURE__ */ z(t, {
|
|
47
|
+
name: n.display.icon,
|
|
48
|
+
size: 13
|
|
49
|
+
}), g(n.display?.name) || e]
|
|
50
|
+
}, e);
|
|
51
|
+
})
|
|
52
|
+
}),
|
|
53
|
+
collapsible: !1,
|
|
54
|
+
padding: "0",
|
|
55
|
+
children: /* @__PURE__ */ z(tt, {
|
|
56
|
+
entityCode: e,
|
|
57
|
+
recordId: n,
|
|
58
|
+
assocKey: c,
|
|
59
|
+
association: l,
|
|
60
|
+
schema: i
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function tt({ entityCode: t, recordId: n, assocKey: r, association: i, schema: a }) {
|
|
65
|
+
let o = Ae(), s = te(), c = `${t}.${r}`, { data: l, isLoading: u } = Ze({
|
|
66
|
+
queryKey: [
|
|
67
|
+
"association",
|
|
68
|
+
c,
|
|
69
|
+
n
|
|
70
|
+
],
|
|
71
|
+
queryFn: () => _(c, [n])
|
|
72
|
+
}), f = l?.target_entity ?? i.target, p = a.entities[f], h = L(() => l?.ids ?? [], [l?.ids]), v = L(() => p?.fields.names().find((e) => p.fields.get(e)?.primary) ?? "id", [p]), y = L(() => h.slice(0, 50), [h]), { data: b, isLoading: x } = Ze({
|
|
73
|
+
queryKey: [
|
|
74
|
+
"association-records",
|
|
75
|
+
f,
|
|
76
|
+
y
|
|
77
|
+
],
|
|
78
|
+
queryFn: () => O(f, {
|
|
79
|
+
per_page: 50,
|
|
80
|
+
filters: [{
|
|
81
|
+
field: v,
|
|
82
|
+
op: "in",
|
|
83
|
+
value: y
|
|
84
|
+
}]
|
|
85
|
+
}),
|
|
86
|
+
enabled: y.length > 0 && !!p
|
|
87
|
+
}), S = b?.data ?? [], C = b?.$refs, w = L(() => p ? p.fields.names().filter((e) => {
|
|
88
|
+
let t = p.fields.get(e);
|
|
89
|
+
return t && !t.primary && !t.auto && t.display?.is_listable !== !1;
|
|
90
|
+
}).slice(0, 6) : [], [p]), ee = () => {
|
|
91
|
+
let e = P(a, f);
|
|
92
|
+
if (!e) return;
|
|
93
|
+
let t = g(i.display?.name) || r, n = new URLSearchParams();
|
|
94
|
+
n.set("filters", JSON.stringify([{
|
|
95
|
+
field: v,
|
|
96
|
+
op: "in",
|
|
97
|
+
value: h
|
|
98
|
+
}])), o(e.route, {
|
|
99
|
+
title: t,
|
|
100
|
+
icon: i.display?.icon || e.icon,
|
|
101
|
+
search: n.toString()
|
|
102
|
+
});
|
|
103
|
+
}, E = {
|
|
104
|
+
fontSize: 12.5,
|
|
105
|
+
color: "var(--text-3)",
|
|
106
|
+
padding: "14px 16px"
|
|
107
|
+
};
|
|
108
|
+
if (u || x) return /* @__PURE__ */ z("div", {
|
|
109
|
+
style: E,
|
|
110
|
+
children: "Loading…"
|
|
111
|
+
});
|
|
112
|
+
if (!p) return /* @__PURE__ */ z("div", {
|
|
113
|
+
style: E,
|
|
114
|
+
children: "Entity not found."
|
|
115
|
+
});
|
|
116
|
+
if (h.length === 0) return /* @__PURE__ */ z("div", {
|
|
117
|
+
style: E,
|
|
118
|
+
children: "No related records."
|
|
119
|
+
});
|
|
120
|
+
let D = P(a, f);
|
|
121
|
+
return /* @__PURE__ */ B("div", {
|
|
122
|
+
style: { padding: "8px 0" },
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ B("table", {
|
|
125
|
+
style: He,
|
|
126
|
+
children: [/* @__PURE__ */ z("thead", { children: /* @__PURE__ */ z("tr", { children: w.map((e) => /* @__PURE__ */ z("th", {
|
|
127
|
+
style: Ve,
|
|
128
|
+
children: m(p.fields.get(e), e, a.entities)
|
|
129
|
+
}, e)) }) }), /* @__PURE__ */ z("tbody", { children: S.map((e, t) => /* @__PURE__ */ z("tr", { children: w.map((t) => {
|
|
130
|
+
let n = p.fields.get(t);
|
|
131
|
+
return n ? /* @__PURE__ */ z("td", {
|
|
132
|
+
style: Ue,
|
|
133
|
+
children: T({
|
|
134
|
+
field: n,
|
|
135
|
+
fieldName: t,
|
|
136
|
+
value: e[t],
|
|
137
|
+
mode: "display",
|
|
138
|
+
record: e,
|
|
139
|
+
refs: C,
|
|
140
|
+
locale: s
|
|
141
|
+
})
|
|
142
|
+
}, t) : /* @__PURE__ */ z("td", {}, t);
|
|
143
|
+
}) }, t)) })]
|
|
144
|
+
}),
|
|
145
|
+
D && l && l.count > S.length && /* @__PURE__ */ z("div", {
|
|
146
|
+
style: {
|
|
147
|
+
padding: "10px 16px",
|
|
148
|
+
textAlign: "center"
|
|
149
|
+
},
|
|
150
|
+
children: /* @__PURE__ */ B(d, {
|
|
151
|
+
icon: /* @__PURE__ */ z(e.external, { size: 12 }),
|
|
152
|
+
onClick: ee,
|
|
153
|
+
children: [
|
|
154
|
+
"View all ",
|
|
155
|
+
l.count,
|
|
156
|
+
" records"
|
|
157
|
+
]
|
|
158
|
+
})
|
|
159
|
+
}),
|
|
160
|
+
D && S.length > 0 && l && l.count <= S.length && /* @__PURE__ */ z("div", {
|
|
161
|
+
style: {
|
|
162
|
+
padding: "10px 16px",
|
|
163
|
+
textAlign: "center"
|
|
164
|
+
},
|
|
165
|
+
children: /* @__PURE__ */ z(d, {
|
|
166
|
+
kind: "ghost",
|
|
167
|
+
icon: /* @__PURE__ */ z(e.external, { size: 12 }),
|
|
168
|
+
onClick: ee,
|
|
169
|
+
children: "Open in list view"
|
|
170
|
+
})
|
|
171
|
+
})
|
|
172
|
+
]
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/components/pages/RecordDocumentsPanel.tsx
|
|
177
|
+
var nt = 4e3;
|
|
178
|
+
function rt(e) {
|
|
179
|
+
return e?.some((e) => e.status === "pending") ? nt : !1;
|
|
180
|
+
}
|
|
181
|
+
function it({ entityCode: t, objectId: n, canGenerateOne: r, canManageTemplates: i }) {
|
|
182
|
+
let { data: a, isLoading: o, error: s } = Ze({
|
|
183
|
+
queryKey: [
|
|
184
|
+
j,
|
|
185
|
+
t,
|
|
186
|
+
n
|
|
187
|
+
],
|
|
188
|
+
queryFn: async () => (await C("document.object_links", {
|
|
189
|
+
entity: t,
|
|
190
|
+
object_id: n
|
|
191
|
+
})).result?.documents ?? [],
|
|
192
|
+
enabled: !!(t && n) && (!!r || !!i),
|
|
193
|
+
refetchInterval: (e) => rt(e.state.data)
|
|
194
|
+
}), c = (a?.length ?? 0) > 0;
|
|
195
|
+
return !r && !c ? null : /* @__PURE__ */ B(Ce, {
|
|
196
|
+
title: /* @__PURE__ */ z(V, {}),
|
|
197
|
+
collapsible: !1,
|
|
198
|
+
padding: "0",
|
|
199
|
+
children: [
|
|
200
|
+
o && /* @__PURE__ */ z(H, {
|
|
201
|
+
icon: /* @__PURE__ */ z(e.loader, { size: 14 }),
|
|
202
|
+
text: "Loading documents..."
|
|
203
|
+
}),
|
|
204
|
+
s && /* @__PURE__ */ z(H, {
|
|
205
|
+
icon: /* @__PURE__ */ z(e.warning, { size: 14 }),
|
|
206
|
+
text: s instanceof Error ? s.message : String(s)
|
|
207
|
+
}),
|
|
208
|
+
!o && !s && (a?.length ?? 0) === 0 && /* @__PURE__ */ z(H, {
|
|
209
|
+
icon: /* @__PURE__ */ z(e.file, { size: 14 }),
|
|
210
|
+
text: "No generated documents"
|
|
211
|
+
}),
|
|
212
|
+
!o && !s && a && a.length > 0 && /* @__PURE__ */ z("div", {
|
|
213
|
+
style: {
|
|
214
|
+
display: "flex",
|
|
215
|
+
flexDirection: "column"
|
|
216
|
+
},
|
|
217
|
+
children: a.map((e) => /* @__PURE__ */ z(at, {
|
|
218
|
+
entityCode: t,
|
|
219
|
+
objectId: n,
|
|
220
|
+
doc: e
|
|
221
|
+
}, e.generated_document_id))
|
|
222
|
+
})
|
|
223
|
+
]
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function V() {
|
|
227
|
+
return /* @__PURE__ */ B("div", {
|
|
228
|
+
style: {
|
|
229
|
+
display: "flex",
|
|
230
|
+
alignItems: "center",
|
|
231
|
+
gap: 6,
|
|
232
|
+
margin: "-10px -14px 0 -14px",
|
|
233
|
+
padding: "10px 14px",
|
|
234
|
+
fontSize: 12.5,
|
|
235
|
+
fontWeight: 600,
|
|
236
|
+
color: "var(--text)"
|
|
237
|
+
},
|
|
238
|
+
children: [/* @__PURE__ */ z(e.file, { size: 13 }), "Documents"]
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
function at({ entityCode: t, objectId: n, doc: r }) {
|
|
242
|
+
let i = Qe(), [a, s] = R(!1), [c, u] = R(!1), [f, p] = R(!1), [m, h] = R(!1), [_, v] = R(null), y = g(r.title) || r.filename || r.template_code, b = r.status === "ready" && r.download_url && !m;
|
|
243
|
+
async function x() {
|
|
244
|
+
s(!0), v(null);
|
|
245
|
+
try {
|
|
246
|
+
let e = (await C("document.download_format", {
|
|
247
|
+
generated_document_id: r.generated_document_id,
|
|
248
|
+
format: "pdf"
|
|
249
|
+
})).result;
|
|
250
|
+
e?.download_url && await o(e.download_url, e.filename);
|
|
251
|
+
} catch (e) {
|
|
252
|
+
l(e) ? (h(!0), v("Artifact unavailable")) : v(e instanceof Error ? e.message : String(e));
|
|
253
|
+
} finally {
|
|
254
|
+
s(!1);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
async function S() {
|
|
258
|
+
if (r.download_url) {
|
|
259
|
+
u(!0), v(null);
|
|
260
|
+
try {
|
|
261
|
+
await o(r.download_url, r.filename);
|
|
262
|
+
} catch (e) {
|
|
263
|
+
l(e) ? (h(!0), v("Artifact unavailable")) : v(e instanceof Error ? e.message : String(e));
|
|
264
|
+
} finally {
|
|
265
|
+
u(!1);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
async function w() {
|
|
270
|
+
p(!0), v(null);
|
|
271
|
+
try {
|
|
272
|
+
await C("document.generate", {
|
|
273
|
+
...r.input ?? {},
|
|
274
|
+
template_code: r.template_code,
|
|
275
|
+
template_source: r.template_source,
|
|
276
|
+
output_format: r.output_format
|
|
277
|
+
}), await i.invalidateQueries({ queryKey: [
|
|
278
|
+
j,
|
|
279
|
+
t,
|
|
280
|
+
n
|
|
281
|
+
] });
|
|
282
|
+
} catch (e) {
|
|
283
|
+
v(e instanceof Error ? e.message : String(e));
|
|
284
|
+
} finally {
|
|
285
|
+
p(!1);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return /* @__PURE__ */ B("div", {
|
|
289
|
+
style: {
|
|
290
|
+
display: "grid",
|
|
291
|
+
gridTemplateColumns: "minmax(0, 1fr) auto",
|
|
292
|
+
gap: 12,
|
|
293
|
+
alignItems: "center",
|
|
294
|
+
padding: "11px 14px",
|
|
295
|
+
borderTop: "1px solid var(--divider)"
|
|
296
|
+
},
|
|
297
|
+
children: [/* @__PURE__ */ B("div", {
|
|
298
|
+
style: { minWidth: 0 },
|
|
299
|
+
children: [
|
|
300
|
+
/* @__PURE__ */ z("div", {
|
|
301
|
+
style: {
|
|
302
|
+
fontSize: 13,
|
|
303
|
+
fontWeight: 600,
|
|
304
|
+
color: "var(--text)",
|
|
305
|
+
overflow: "hidden",
|
|
306
|
+
textOverflow: "ellipsis",
|
|
307
|
+
whiteSpace: "nowrap"
|
|
308
|
+
},
|
|
309
|
+
children: y
|
|
310
|
+
}),
|
|
311
|
+
/* @__PURE__ */ B("div", {
|
|
312
|
+
style: {
|
|
313
|
+
marginTop: 3,
|
|
314
|
+
display: "flex",
|
|
315
|
+
gap: 8,
|
|
316
|
+
alignItems: "center",
|
|
317
|
+
color: "var(--text-3)",
|
|
318
|
+
fontSize: 11.5
|
|
319
|
+
},
|
|
320
|
+
children: [
|
|
321
|
+
/* @__PURE__ */ z("span", { children: r.output_format.toUpperCase() }),
|
|
322
|
+
/* @__PURE__ */ z("span", { children: m ? "artifact unavailable" : r.status }),
|
|
323
|
+
/* @__PURE__ */ z("span", { children: r.ready_at || r.created_at })
|
|
324
|
+
]
|
|
325
|
+
}),
|
|
326
|
+
r.status === "failed" && r.error_text && /* @__PURE__ */ z("div", {
|
|
327
|
+
style: {
|
|
328
|
+
marginTop: 5,
|
|
329
|
+
color: "var(--danger)",
|
|
330
|
+
fontSize: 12
|
|
331
|
+
},
|
|
332
|
+
children: r.error_text
|
|
333
|
+
}),
|
|
334
|
+
_ && /* @__PURE__ */ z("div", {
|
|
335
|
+
style: {
|
|
336
|
+
marginTop: 5,
|
|
337
|
+
color: "var(--danger)",
|
|
338
|
+
fontSize: 12
|
|
339
|
+
},
|
|
340
|
+
children: _
|
|
341
|
+
})
|
|
342
|
+
]
|
|
343
|
+
}), b ? /* @__PURE__ */ B("div", {
|
|
344
|
+
style: {
|
|
345
|
+
display: "flex",
|
|
346
|
+
gap: 6
|
|
347
|
+
},
|
|
348
|
+
children: [/* @__PURE__ */ z(d, {
|
|
349
|
+
kind: "ghost",
|
|
350
|
+
size: "sm",
|
|
351
|
+
icon: z(a ? e.loader : e.file, { size: 12 }),
|
|
352
|
+
onClick: x,
|
|
353
|
+
disabled: a,
|
|
354
|
+
children: "PDF"
|
|
355
|
+
}), /* @__PURE__ */ z(d, {
|
|
356
|
+
kind: "default",
|
|
357
|
+
size: "sm",
|
|
358
|
+
icon: z(c ? e.loader : e.download, { size: 12 }),
|
|
359
|
+
onClick: S,
|
|
360
|
+
disabled: c,
|
|
361
|
+
children: "Download"
|
|
362
|
+
})]
|
|
363
|
+
}) : m ? /* @__PURE__ */ z(d, {
|
|
364
|
+
kind: "ghost",
|
|
365
|
+
size: "sm",
|
|
366
|
+
icon: z(f ? e.loader : e.file, { size: 12 }),
|
|
367
|
+
onClick: w,
|
|
368
|
+
disabled: f,
|
|
369
|
+
children: "Regenerate"
|
|
370
|
+
}) : /* @__PURE__ */ z(d, {
|
|
371
|
+
kind: "ghost",
|
|
372
|
+
size: "sm",
|
|
373
|
+
disabled: !0,
|
|
374
|
+
children: r.status === "pending" ? "Pending" : "Unavailable"
|
|
375
|
+
})]
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
function H({ icon: e, text: t }) {
|
|
379
|
+
return /* @__PURE__ */ B("div", {
|
|
380
|
+
style: {
|
|
381
|
+
display: "flex",
|
|
382
|
+
alignItems: "center",
|
|
383
|
+
gap: 8,
|
|
384
|
+
padding: "14px",
|
|
385
|
+
color: "var(--text-3)",
|
|
386
|
+
fontSize: 12.5
|
|
387
|
+
},
|
|
388
|
+
children: [e, t]
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/components/detail-layout/ErrorSummary.tsx
|
|
393
|
+
function ot({ errors: t, onJump: n }) {
|
|
394
|
+
if (t.length === 0) return null;
|
|
395
|
+
let r = t.length !== 1;
|
|
396
|
+
return /* @__PURE__ */ B("div", {
|
|
397
|
+
role: "alert",
|
|
398
|
+
style: {
|
|
399
|
+
display: "flex",
|
|
400
|
+
gap: 10,
|
|
401
|
+
padding: "10px 12px",
|
|
402
|
+
marginBottom: 12,
|
|
403
|
+
borderRadius: 8,
|
|
404
|
+
background: "var(--danger-soft)",
|
|
405
|
+
border: "1px solid var(--danger-border)",
|
|
406
|
+
color: "var(--text)"
|
|
407
|
+
},
|
|
408
|
+
children: [/* @__PURE__ */ z("span", {
|
|
409
|
+
style: {
|
|
410
|
+
color: "var(--danger)",
|
|
411
|
+
marginTop: 1,
|
|
412
|
+
display: "flex"
|
|
413
|
+
},
|
|
414
|
+
children: /* @__PURE__ */ z(e.warning, { size: 14 })
|
|
415
|
+
}), /* @__PURE__ */ B("div", {
|
|
416
|
+
style: {
|
|
417
|
+
flex: 1,
|
|
418
|
+
minWidth: 0
|
|
419
|
+
},
|
|
420
|
+
children: [/* @__PURE__ */ B("div", {
|
|
421
|
+
style: {
|
|
422
|
+
fontSize: 12.5,
|
|
423
|
+
fontWeight: 600,
|
|
424
|
+
marginBottom: 4
|
|
425
|
+
},
|
|
426
|
+
children: [
|
|
427
|
+
t.length,
|
|
428
|
+
" ",
|
|
429
|
+
r ? "fields need" : "field needs",
|
|
430
|
+
" attention"
|
|
431
|
+
]
|
|
432
|
+
}), /* @__PURE__ */ z("ul", {
|
|
433
|
+
style: {
|
|
434
|
+
margin: 0,
|
|
435
|
+
padding: 0,
|
|
436
|
+
listStyle: "none",
|
|
437
|
+
display: "flex",
|
|
438
|
+
flexDirection: "column",
|
|
439
|
+
gap: 2
|
|
440
|
+
},
|
|
441
|
+
children: t.map((e) => /* @__PURE__ */ z("li", { children: /* @__PURE__ */ B("button", {
|
|
442
|
+
type: "button",
|
|
443
|
+
onClick: n ? () => n(e.name) : void 0,
|
|
444
|
+
style: {
|
|
445
|
+
background: "transparent",
|
|
446
|
+
border: 0,
|
|
447
|
+
padding: 0,
|
|
448
|
+
cursor: n ? "pointer" : "default",
|
|
449
|
+
fontSize: 12,
|
|
450
|
+
textAlign: "left",
|
|
451
|
+
fontFamily: "inherit"
|
|
452
|
+
},
|
|
453
|
+
children: [
|
|
454
|
+
/* @__PURE__ */ z("span", {
|
|
455
|
+
style: {
|
|
456
|
+
color: "var(--danger)",
|
|
457
|
+
marginRight: 6
|
|
458
|
+
},
|
|
459
|
+
children: "•"
|
|
460
|
+
}),
|
|
461
|
+
/* @__PURE__ */ z("span", {
|
|
462
|
+
style: {
|
|
463
|
+
fontWeight: 500,
|
|
464
|
+
color: "var(--text-2)"
|
|
465
|
+
},
|
|
466
|
+
children: e.label
|
|
467
|
+
}),
|
|
468
|
+
/* @__PURE__ */ B("span", {
|
|
469
|
+
style: { color: "var(--text-3)" },
|
|
470
|
+
children: [" - ", e.message]
|
|
471
|
+
})
|
|
472
|
+
]
|
|
473
|
+
}) }, e.name))
|
|
474
|
+
})]
|
|
475
|
+
})]
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region src/components/shared/HighlightsStrip.tsx
|
|
480
|
+
function st({ items: e }) {
|
|
481
|
+
return e.length === 0 ? null : /* @__PURE__ */ z("div", {
|
|
482
|
+
style: {
|
|
483
|
+
display: "flex",
|
|
484
|
+
alignItems: "center",
|
|
485
|
+
flexWrap: "wrap",
|
|
486
|
+
gap: "6px 0",
|
|
487
|
+
fontSize: 12
|
|
488
|
+
},
|
|
489
|
+
children: e.map((e, t) => /* @__PURE__ */ B(Ke, { children: [t > 0 && /* @__PURE__ */ z("span", { style: {
|
|
490
|
+
width: 1,
|
|
491
|
+
height: 12,
|
|
492
|
+
background: "var(--divider)",
|
|
493
|
+
marginInline: 12
|
|
494
|
+
} }), /* @__PURE__ */ B("span", {
|
|
495
|
+
style: {
|
|
496
|
+
display: "inline-flex",
|
|
497
|
+
alignItems: "center",
|
|
498
|
+
gap: 6,
|
|
499
|
+
lineHeight: 1.3
|
|
500
|
+
},
|
|
501
|
+
children: [/* @__PURE__ */ z("span", {
|
|
502
|
+
style: {
|
|
503
|
+
color: "var(--text-3)",
|
|
504
|
+
fontSize: 11.5
|
|
505
|
+
},
|
|
506
|
+
children: e.label
|
|
507
|
+
}), /* @__PURE__ */ z("span", {
|
|
508
|
+
style: { color: "var(--text)" },
|
|
509
|
+
children: e.value
|
|
510
|
+
})]
|
|
511
|
+
})] }, t))
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
//#endregion
|
|
515
|
+
//#region src/components/detail-layout/DetailHighlights.tsx
|
|
516
|
+
function ct({ screen: e, entity: t, entityCode: n, record: r, refs: a, objectStatuses: o, schema: s, locale: c }) {
|
|
517
|
+
let l = e.highlights;
|
|
518
|
+
if (!l || l.length === 0) return null;
|
|
519
|
+
let u = [];
|
|
520
|
+
for (let e of l) {
|
|
521
|
+
let l = t.status_groups?.[e];
|
|
522
|
+
if (l) {
|
|
523
|
+
let t = o?.find((t) => t.group_code === e), n = t ? l.statuses.find((e) => e.code === t.status_code) : void 0;
|
|
524
|
+
u.push({
|
|
525
|
+
label: g(l.name),
|
|
526
|
+
value: n ? /* @__PURE__ */ z(i, {
|
|
527
|
+
tone: n.color ?? "slate",
|
|
528
|
+
size: "xs",
|
|
529
|
+
children: g(n.name)
|
|
530
|
+
}) : /* @__PURE__ */ z("span", {
|
|
531
|
+
style: { color: "var(--text-4)" },
|
|
532
|
+
children: "—"
|
|
533
|
+
})
|
|
534
|
+
});
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
if (t.fields.get(e) || t.files?.get(e)) {
|
|
538
|
+
let i = je({
|
|
539
|
+
entity: t,
|
|
540
|
+
entityCode: n,
|
|
541
|
+
fieldName: e,
|
|
542
|
+
record: r,
|
|
543
|
+
mode: "display",
|
|
544
|
+
refs: a,
|
|
545
|
+
entities: s.entities,
|
|
546
|
+
screens: s.screens,
|
|
547
|
+
surface: "list",
|
|
548
|
+
locale: c
|
|
549
|
+
});
|
|
550
|
+
u.push({
|
|
551
|
+
label: Le(t, e, s.entities),
|
|
552
|
+
value: i
|
|
553
|
+
});
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
return u.length === 0 ? null : /* @__PURE__ */ z(st, { items: u });
|
|
558
|
+
}
|
|
559
|
+
//#endregion
|
|
560
|
+
//#region src/components/shared/AuditMetaStrip.tsx
|
|
561
|
+
function U(e) {
|
|
562
|
+
return e.by != null || e.at != null;
|
|
563
|
+
}
|
|
564
|
+
function lt({ lines: e }) {
|
|
565
|
+
let t = e.filter(U);
|
|
566
|
+
return t.length === 0 ? null : /* @__PURE__ */ z("div", {
|
|
567
|
+
style: {
|
|
568
|
+
display: "flex",
|
|
569
|
+
flexWrap: "wrap",
|
|
570
|
+
gap: "8px 24px",
|
|
571
|
+
padding: "10px 14px",
|
|
572
|
+
background: "var(--surface-2)",
|
|
573
|
+
border: "1px solid var(--border)",
|
|
574
|
+
borderRadius: 8,
|
|
575
|
+
fontSize: 11.5,
|
|
576
|
+
color: "var(--text-3)"
|
|
577
|
+
},
|
|
578
|
+
children: t.map((e, t) => /* @__PURE__ */ z(W, { line: e }, t))
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
function W({ line: e }) {
|
|
582
|
+
return /* @__PURE__ */ B("div", {
|
|
583
|
+
style: {
|
|
584
|
+
display: "flex",
|
|
585
|
+
alignItems: "center",
|
|
586
|
+
gap: 8,
|
|
587
|
+
minWidth: 0
|
|
588
|
+
},
|
|
589
|
+
children: [/* @__PURE__ */ z("span", {
|
|
590
|
+
style: {
|
|
591
|
+
fontSize: 11,
|
|
592
|
+
fontWeight: 600,
|
|
593
|
+
color: "var(--text-4)",
|
|
594
|
+
flexShrink: 0
|
|
595
|
+
},
|
|
596
|
+
children: e.label
|
|
597
|
+
}), /* @__PURE__ */ B("span", {
|
|
598
|
+
style: {
|
|
599
|
+
display: "inline-flex",
|
|
600
|
+
alignItems: "center",
|
|
601
|
+
gap: 6,
|
|
602
|
+
minWidth: 0
|
|
603
|
+
},
|
|
604
|
+
children: [
|
|
605
|
+
e.by != null && /* @__PURE__ */ z("span", {
|
|
606
|
+
style: { color: "var(--text-2)" },
|
|
607
|
+
children: e.by
|
|
608
|
+
}),
|
|
609
|
+
e.by != null && e.at != null && /* @__PURE__ */ z("span", {
|
|
610
|
+
style: { color: "var(--text-4)" },
|
|
611
|
+
children: "·"
|
|
612
|
+
}),
|
|
613
|
+
e.at != null && /* @__PURE__ */ z("span", {
|
|
614
|
+
className: "num",
|
|
615
|
+
children: e.at
|
|
616
|
+
})
|
|
617
|
+
]
|
|
618
|
+
})]
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region src/components/detail-layout/DetailAuditStrip.tsx
|
|
623
|
+
function ut({ screen: e, entity: t, entityCode: n, record: r, refs: i, schema: a, locale: o }) {
|
|
624
|
+
let s = e.audit;
|
|
625
|
+
if (s?.enabled === !1) return null;
|
|
626
|
+
let c = (e) => {
|
|
627
|
+
if (!e || !t.fields.get(e)) return;
|
|
628
|
+
let s = r[e];
|
|
629
|
+
if (!(s == null || s === "")) return je({
|
|
630
|
+
entity: t,
|
|
631
|
+
entityCode: n,
|
|
632
|
+
fieldName: e,
|
|
633
|
+
record: r,
|
|
634
|
+
mode: "display",
|
|
635
|
+
refs: i,
|
|
636
|
+
entities: a.entities,
|
|
637
|
+
screens: a.screens,
|
|
638
|
+
surface: "list",
|
|
639
|
+
locale: o
|
|
640
|
+
});
|
|
641
|
+
};
|
|
642
|
+
return /* @__PURE__ */ z(lt, { lines: s?.lines && s.lines.length > 0 ? s.lines.map((e) => ({
|
|
643
|
+
label: g(e.label),
|
|
644
|
+
at: c(e.at),
|
|
645
|
+
by: c(e.by)
|
|
646
|
+
})) : [{
|
|
647
|
+
label: "Created",
|
|
648
|
+
at: c("created_at"),
|
|
649
|
+
by: c("created_by")
|
|
650
|
+
}, {
|
|
651
|
+
label: "Updated",
|
|
652
|
+
at: c("updated_at"),
|
|
653
|
+
by: c("updated_by")
|
|
654
|
+
}] });
|
|
655
|
+
}
|
|
656
|
+
//#endregion
|
|
657
|
+
//#region src/components/shared/RecordHeader.tsx
|
|
658
|
+
function G({ icon: t, avatarName: n, title: r, recordId: a, description: o, highlights: c, mode: l, dirty: d = !1, showBack: f = !1, onBack: p, right: m, showTitle: h = !0 }) {
|
|
659
|
+
let g = s(), _ = g.category === "phone" || g.width <= 520;
|
|
660
|
+
return /* @__PURE__ */ B("div", {
|
|
661
|
+
style: {
|
|
662
|
+
display: "flex",
|
|
663
|
+
alignItems: "flex-start",
|
|
664
|
+
gap: 10,
|
|
665
|
+
flexWrap: _ ? "wrap" : "nowrap",
|
|
666
|
+
minWidth: 0
|
|
667
|
+
},
|
|
668
|
+
children: [
|
|
669
|
+
h && f && /* @__PURE__ */ z("div", {
|
|
670
|
+
style: {
|
|
671
|
+
paddingTop: 4,
|
|
672
|
+
flexShrink: 0
|
|
673
|
+
},
|
|
674
|
+
children: /* @__PURE__ */ z(u, {
|
|
675
|
+
size: 26,
|
|
676
|
+
icon: /* @__PURE__ */ z(e.back, { size: 14 }),
|
|
677
|
+
title: "Back",
|
|
678
|
+
onClick: p
|
|
679
|
+
})
|
|
680
|
+
}),
|
|
681
|
+
h && (n || t) && /* @__PURE__ */ z("div", {
|
|
682
|
+
style: {
|
|
683
|
+
flexShrink: 0,
|
|
684
|
+
paddingTop: 2
|
|
685
|
+
},
|
|
686
|
+
children: n ? /* @__PURE__ */ z(oe, {
|
|
687
|
+
name: n,
|
|
688
|
+
size: 32
|
|
689
|
+
}) : /* @__PURE__ */ z("span", {
|
|
690
|
+
style: {
|
|
691
|
+
width: 32,
|
|
692
|
+
height: 32,
|
|
693
|
+
borderRadius: 8,
|
|
694
|
+
background: "var(--accent-soft)",
|
|
695
|
+
color: "var(--accent)",
|
|
696
|
+
display: "flex",
|
|
697
|
+
alignItems: "center",
|
|
698
|
+
justifyContent: "center"
|
|
699
|
+
},
|
|
700
|
+
children: t
|
|
701
|
+
})
|
|
702
|
+
}),
|
|
703
|
+
h && /* @__PURE__ */ B("div", {
|
|
704
|
+
style: {
|
|
705
|
+
flex: "1 1 0",
|
|
706
|
+
minWidth: 0
|
|
707
|
+
},
|
|
708
|
+
children: [/* @__PURE__ */ B("div", {
|
|
709
|
+
style: {
|
|
710
|
+
display: "flex",
|
|
711
|
+
alignItems: "center",
|
|
712
|
+
gap: 8,
|
|
713
|
+
flexWrap: "wrap"
|
|
714
|
+
},
|
|
715
|
+
children: [
|
|
716
|
+
/* @__PURE__ */ z("h1", {
|
|
717
|
+
style: {
|
|
718
|
+
margin: 0,
|
|
719
|
+
fontSize: "var(--page-title-size, var(--page-title-size-detail))",
|
|
720
|
+
fontWeight: 600,
|
|
721
|
+
letterSpacing: 0,
|
|
722
|
+
lineHeight: "var(--page-title-line-height, var(--page-title-line-height-detail))",
|
|
723
|
+
color: "var(--text)",
|
|
724
|
+
minWidth: 0,
|
|
725
|
+
overflow: "hidden",
|
|
726
|
+
textOverflow: "ellipsis",
|
|
727
|
+
whiteSpace: _ ? "normal" : "nowrap",
|
|
728
|
+
overflowWrap: "anywhere",
|
|
729
|
+
maxWidth: "100%"
|
|
730
|
+
},
|
|
731
|
+
children: r
|
|
732
|
+
}),
|
|
733
|
+
a && /* @__PURE__ */ z(se, { value: a }),
|
|
734
|
+
o && /* @__PURE__ */ z(ce, {
|
|
735
|
+
label: o,
|
|
736
|
+
"data-testid": "detail-description-info"
|
|
737
|
+
}),
|
|
738
|
+
l === "edit" && d && /* @__PURE__ */ B("span", {
|
|
739
|
+
style: {
|
|
740
|
+
display: "inline-flex",
|
|
741
|
+
alignItems: "center",
|
|
742
|
+
gap: 5,
|
|
743
|
+
fontSize: 11,
|
|
744
|
+
color: "var(--warn)"
|
|
745
|
+
},
|
|
746
|
+
children: [/* @__PURE__ */ z("span", { style: {
|
|
747
|
+
width: 6,
|
|
748
|
+
height: 6,
|
|
749
|
+
borderRadius: 999,
|
|
750
|
+
background: "var(--warn)"
|
|
751
|
+
} }), "Unsaved"]
|
|
752
|
+
}),
|
|
753
|
+
l === "create" && /* @__PURE__ */ z(i, {
|
|
754
|
+
tone: "violet",
|
|
755
|
+
size: "xs",
|
|
756
|
+
dot: !0,
|
|
757
|
+
children: "New record"
|
|
758
|
+
})
|
|
759
|
+
]
|
|
760
|
+
}), c && l === "display" && /* @__PURE__ */ z("div", {
|
|
761
|
+
style: { marginTop: 8 },
|
|
762
|
+
children: c
|
|
763
|
+
})]
|
|
764
|
+
}),
|
|
765
|
+
m && /* @__PURE__ */ z("div", {
|
|
766
|
+
role: "toolbar",
|
|
767
|
+
"aria-label": "Page actions",
|
|
768
|
+
style: {
|
|
769
|
+
display: "flex",
|
|
770
|
+
alignItems: "center",
|
|
771
|
+
gap: 6,
|
|
772
|
+
flex: _ ? "1 1 100%" : "0 0 auto",
|
|
773
|
+
flexWrap: "wrap",
|
|
774
|
+
justifyContent: _ ? "flex-start" : "flex-end",
|
|
775
|
+
minWidth: 0
|
|
776
|
+
},
|
|
777
|
+
children: m
|
|
778
|
+
})
|
|
779
|
+
]
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
//#endregion
|
|
783
|
+
//#region src/lib/children-validation.ts
|
|
784
|
+
function dt(e, t, n) {
|
|
785
|
+
let r = [];
|
|
786
|
+
for (let [i, a] of e.fields) {
|
|
787
|
+
if (!a.required || a.auto || n && a.primary || e.tenant_key && i === e.tenant_key || a.default !== void 0 && a.default !== null) continue;
|
|
788
|
+
let o = t[i];
|
|
789
|
+
(o == null || o === "") && r.push(i);
|
|
790
|
+
}
|
|
791
|
+
return r;
|
|
792
|
+
}
|
|
793
|
+
var ft = /^[^@\s]+@[^@\s]+\.[^@\s]+$/;
|
|
794
|
+
function pt(e, t) {
|
|
795
|
+
let n = [];
|
|
796
|
+
for (let [r, i] of e.fields) {
|
|
797
|
+
if (i.type !== "email") continue;
|
|
798
|
+
let e = t[r];
|
|
799
|
+
typeof e == "string" && e !== "" && !ft.test(e) && n.push(r);
|
|
800
|
+
}
|
|
801
|
+
return n;
|
|
802
|
+
}
|
|
803
|
+
function mt(e, t) {
|
|
804
|
+
let n = /* @__PURE__ */ new Set();
|
|
805
|
+
for (let r of Object.values(t.entities)) if (r.children) {
|
|
806
|
+
for (let t of r.children) if (t.entity === e && t.foreign_key) {
|
|
807
|
+
let e = Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key];
|
|
808
|
+
for (let t of e) n.add(t);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
return n;
|
|
812
|
+
}
|
|
813
|
+
function ht(e, t) {
|
|
814
|
+
if (!e || !t) return {};
|
|
815
|
+
let n = {};
|
|
816
|
+
for (let [r, i] of Object.entries(e)) {
|
|
817
|
+
let e = t.entities[r];
|
|
818
|
+
if (!e) continue;
|
|
819
|
+
let a = mt(r, t), o = [];
|
|
820
|
+
for (let [t, n] of e.fields) e.tenant_key && t === e.tenant_key || n.required && !n.auto && !n.primary && !a.has(t) && o.push(t);
|
|
821
|
+
if (o.length !== 0) for (let e of i) {
|
|
822
|
+
if (e._deleted) continue;
|
|
823
|
+
let t = [];
|
|
824
|
+
for (let n of o) {
|
|
825
|
+
let r = e[n];
|
|
826
|
+
(r == null || r === "") && t.push(n);
|
|
827
|
+
}
|
|
828
|
+
t.length > 0 && (n[r] || (n[r] = {}), n[r][e._key] = t);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
return n;
|
|
832
|
+
}
|
|
833
|
+
//#endregion
|
|
834
|
+
//#region src/components/pages/SmartDetailPage.impl.tsx
|
|
835
|
+
var gt = () => {};
|
|
836
|
+
function _t(e, t) {
|
|
837
|
+
return e.length === t.length ? JSON.stringify(e) === JSON.stringify(t) : !1;
|
|
838
|
+
}
|
|
839
|
+
function vt(e, t) {
|
|
840
|
+
if (e) {
|
|
841
|
+
let n = y(S(e, t));
|
|
842
|
+
if (n.replace(/^\|+|\|+$/g, "")) return n;
|
|
843
|
+
}
|
|
844
|
+
return t.id == null ? crypto.randomUUID() : k(t.id);
|
|
845
|
+
}
|
|
846
|
+
function yt({ screenCode: e }) {
|
|
847
|
+
return /* @__PURE__ */ z(b, { children: /* @__PURE__ */ z(K, { screenCode: e }) });
|
|
848
|
+
}
|
|
849
|
+
function K({ screenCode: t }) {
|
|
850
|
+
let { id: i } = Ye(), o = r(), [l, d] = Xe(), { data: _ } = ee(), v = x((e) => e.user), b = ae(), C = s(), w = _?.screens[t], T = w?.entity ? _?.entities[w.entity] : void 0, E = w?.entity, O = ne(T, "create"), k = ne(T, "update"), oe = ne(T, "delete"), se = ne(T, "restore"), ce = (() => {
|
|
851
|
+
if (!T || !T.singleton || !T.prefilter) return;
|
|
852
|
+
let e = re(T);
|
|
853
|
+
if (e.length !== 1) return;
|
|
854
|
+
let t = T.prefilter[e[0]];
|
|
855
|
+
if (t === "$caller.user_id") return v?.id;
|
|
856
|
+
if (t === "$caller.tenant_id") return v?.tenant?.id;
|
|
857
|
+
})(), A = ce !== void 0, j = A ? ce : i, M = !A && j === "new", N = L(() => {
|
|
858
|
+
if (!j || M) return;
|
|
859
|
+
if (!T) return j;
|
|
860
|
+
let e = re(T);
|
|
861
|
+
if (e.length === 1) return { [e[0]]: j };
|
|
862
|
+
let t = ie(j, e.length);
|
|
863
|
+
if (!t) return;
|
|
864
|
+
let n = {};
|
|
865
|
+
for (let r = 0; r < e.length; r++) n[e[r]] = t[r] ?? "";
|
|
866
|
+
return n;
|
|
867
|
+
}, [
|
|
868
|
+
j,
|
|
869
|
+
M,
|
|
870
|
+
T
|
|
871
|
+
]), ge = L(() => {
|
|
872
|
+
if (N) return typeof N == "string" ? N : y(N);
|
|
873
|
+
}, [N]), P = ke(E, N), { data: be, isLoading: xe, error: Ce } = P, Ae = Fe((e) => e.degradedEntities), je = E ? ye(T?.realtime, Ae, E) : !1;
|
|
874
|
+
pe(Ne(E, N), !M);
|
|
875
|
+
let Le = ve(E ?? ""), Be = _e(E ?? ""), Ve = we(E ?? ""), He = Te(E ?? ""), Ue = Object.keys(T?.status_groups ?? {}).length > 0, Ke = be?.data, Ze = Ke?.$statuses, Qe = Ke?.$properties, tt = l.get("edit") === "true", [nt, rt] = R(M || tt), [V, at] = R({}), [H, st] = R({}), [U, lt] = R({}), [W, G] = R(void 0), [ft, mt] = R(!1), [yt, K] = R(void 0), [xt, St] = R({ show: !1 }), [wt, Tt] = R(!1), Et = M ? O : k, q = nt && Et, Dt = p();
|
|
876
|
+
f(q && !M, Dt.enabled);
|
|
877
|
+
let [Ot, kt] = R(() => {
|
|
878
|
+
let e = parseInt(w?.sidebar_width || "380", 10);
|
|
879
|
+
return isNaN(e) ? 380 : e;
|
|
880
|
+
}), At = qe(null), J = qe(null), jt = F((e) => {
|
|
881
|
+
e.preventDefault();
|
|
882
|
+
let t = At.current;
|
|
883
|
+
if (!t) return;
|
|
884
|
+
let n = t.offsetWidth;
|
|
885
|
+
J.current = {
|
|
886
|
+
startX: e.clientX,
|
|
887
|
+
startW: n
|
|
888
|
+
};
|
|
889
|
+
let r = (e) => {
|
|
890
|
+
if (!J.current) return;
|
|
891
|
+
let n = J.current.startX - e.clientX, r = Math.max(280, Math.min(800, J.current.startW + n));
|
|
892
|
+
t.style.width = `${r}px`;
|
|
893
|
+
}, i = () => {
|
|
894
|
+
J.current && t && kt(parseInt(t.style.width, 10) || J.current.startW), J.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
|
|
895
|
+
};
|
|
896
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
|
|
897
|
+
}, []), Y = be?.data, X = typeof Y?.$row_version == "string" ? Y.$row_version : void 0, Mt = Y?.$refs, Nt = qe(X);
|
|
898
|
+
I(() => {
|
|
899
|
+
if (!X) return;
|
|
900
|
+
let e = Nt.current;
|
|
901
|
+
Nt.current = X, e && e !== X && nt && mt(!0);
|
|
902
|
+
}, [nt, X]);
|
|
903
|
+
let Pt = !!T?.soft_delete, Ft = Pt && Y != null && Y[T.soft_delete] != null, Z = Je(), It = qe(null);
|
|
904
|
+
fe({ scrollElementRef: It });
|
|
905
|
+
let Lt = !M && Ce instanceof a && Ce.status === 404, Rt = qe(null);
|
|
906
|
+
I(() => {
|
|
907
|
+
if (!Lt) return;
|
|
908
|
+
let e = le(Z);
|
|
909
|
+
Rt.current !== e && (Rt.current = e, me.getState().kill(e));
|
|
910
|
+
}, [Lt, Z]);
|
|
911
|
+
let { openTab: zt, updateTabTitle: Bt, findTabByPathname: Vt } = Re();
|
|
912
|
+
I(() => {
|
|
913
|
+
if (!T || A || Dt.enabled) return;
|
|
914
|
+
let e = Z.pathname, t = g(w?.display?.name) || g(T.display.name), n = w?.display?.icon || T.display.icon;
|
|
915
|
+
Vt(e) || zt({
|
|
916
|
+
pathname: e,
|
|
917
|
+
search: "",
|
|
918
|
+
title: M ? `New ${t}` : t,
|
|
919
|
+
icon: n,
|
|
920
|
+
closable: !0
|
|
921
|
+
});
|
|
922
|
+
}, [
|
|
923
|
+
Z.pathname,
|
|
924
|
+
w?.display?.name?.en,
|
|
925
|
+
T?.display.name?.en,
|
|
926
|
+
w?.display?.icon,
|
|
927
|
+
T?.display.icon,
|
|
928
|
+
M,
|
|
929
|
+
A,
|
|
930
|
+
Dt.enabled
|
|
931
|
+
]), I(() => {
|
|
932
|
+
if (!Y || !T || A || Dt.enabled) return;
|
|
933
|
+
let e = Vt(Z.pathname);
|
|
934
|
+
if (e) {
|
|
935
|
+
let t = g(w?.display?.name) || g(T.display.name), n = D(Y, T), r = n && !String(n).startsWith("/") ? String(n) : t;
|
|
936
|
+
Bt(e.id, r);
|
|
937
|
+
}
|
|
938
|
+
}, [
|
|
939
|
+
Y,
|
|
940
|
+
T?.display.name?.en,
|
|
941
|
+
T?.display.display_field,
|
|
942
|
+
Z.pathname,
|
|
943
|
+
A,
|
|
944
|
+
Dt.enabled
|
|
945
|
+
]);
|
|
946
|
+
let Ht = L(() => {
|
|
947
|
+
if (!T || !Et) return /* @__PURE__ */ new Set();
|
|
948
|
+
let e = /* @__PURE__ */ new Set();
|
|
949
|
+
for (let [t, n] of T.fields) !n.auto && !n.primary && e.add(t);
|
|
950
|
+
for (let [t] of T.files ?? []) e.add(t);
|
|
951
|
+
return e;
|
|
952
|
+
}, [T, Et]);
|
|
953
|
+
I(() => {
|
|
954
|
+
if (!(!tt || !Y || !T || !k)) {
|
|
955
|
+
if (nt || rt(!0), Object.keys(V).length === 0) {
|
|
956
|
+
let e = j ? ue(j) : null;
|
|
957
|
+
e && De(Ee({
|
|
958
|
+
entity: T,
|
|
959
|
+
formData: e,
|
|
960
|
+
record: void 0,
|
|
961
|
+
isNew: !0
|
|
962
|
+
})).forEach((e) => {
|
|
963
|
+
b.registerDraft({
|
|
964
|
+
fileId: e,
|
|
965
|
+
discard: () => h(e)
|
|
966
|
+
});
|
|
967
|
+
});
|
|
968
|
+
let t = {};
|
|
969
|
+
Ht.forEach((n) => {
|
|
970
|
+
let r = e ? e[n] : void 0;
|
|
971
|
+
if (r !== void 0) {
|
|
972
|
+
t[n] = r;
|
|
973
|
+
return;
|
|
974
|
+
}
|
|
975
|
+
let i = he(T, Y, n);
|
|
976
|
+
t[n] = Se(T, n) ? i ?? null : i ?? "";
|
|
977
|
+
}), at(t);
|
|
978
|
+
}
|
|
979
|
+
if (T.children !== void 0 && T.children.length > 0 && W === void 0) {
|
|
980
|
+
let e = Y.$children;
|
|
981
|
+
if (e && Object.keys(e).length > 0) {
|
|
982
|
+
let t = {};
|
|
983
|
+
for (let [n, r] of Object.entries(e)) {
|
|
984
|
+
let e = _?.entities[n];
|
|
985
|
+
t[n] = r.map((t) => ({
|
|
986
|
+
...t,
|
|
987
|
+
_key: vt(e, t)
|
|
988
|
+
}));
|
|
989
|
+
}
|
|
990
|
+
G(t), K(e);
|
|
991
|
+
} else G({}), K({});
|
|
992
|
+
}
|
|
993
|
+
d((e) => {
|
|
994
|
+
let t = new URLSearchParams(e);
|
|
995
|
+
return t.delete("edit"), t;
|
|
996
|
+
}, { replace: !0 });
|
|
997
|
+
}
|
|
998
|
+
}, [
|
|
999
|
+
tt,
|
|
1000
|
+
Y,
|
|
1001
|
+
Ht,
|
|
1002
|
+
k,
|
|
1003
|
+
T,
|
|
1004
|
+
W,
|
|
1005
|
+
_
|
|
1006
|
+
]), I(() => {
|
|
1007
|
+
!M || !O || !T?.children || T.children.length === 0 || W === void 0 && (G({}), K({}));
|
|
1008
|
+
}, [
|
|
1009
|
+
M,
|
|
1010
|
+
O,
|
|
1011
|
+
T?.children
|
|
1012
|
+
]);
|
|
1013
|
+
let Ut = F(async () => {
|
|
1014
|
+
if (await b.flushAllDrafts(), M) {
|
|
1015
|
+
let e = w?.route?.replace("/:id", "") ?? "/";
|
|
1016
|
+
o(e);
|
|
1017
|
+
} else rt(!1), at({}), st({}), lt({}), G(void 0), K(void 0), Tt(!1);
|
|
1018
|
+
}, [
|
|
1019
|
+
b,
|
|
1020
|
+
M,
|
|
1021
|
+
w,
|
|
1022
|
+
o
|
|
1023
|
+
]), Wt = F((e, t) => {
|
|
1024
|
+
at((n) => ({
|
|
1025
|
+
...n,
|
|
1026
|
+
[e]: t
|
|
1027
|
+
}));
|
|
1028
|
+
}, []), Q = L(() => {
|
|
1029
|
+
if (!w?.route) return "/";
|
|
1030
|
+
let e = w.route.split("/");
|
|
1031
|
+
return e.pop(), e.join("/") || "/";
|
|
1032
|
+
}, [w]), Gt = L(() => !_?.screens || !Q || Q === "/" ? !1 : Object.values(_.screens).some((e) => e.route === Q), [_, Q]), Kt = Oe({ fallback: F(() => {
|
|
1033
|
+
if (!Gt) {
|
|
1034
|
+
o("/");
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
let e = Vt(Q)?.search ?? "";
|
|
1038
|
+
o(e ? `${Q}?${e}` : Q);
|
|
1039
|
+
}, [
|
|
1040
|
+
Gt,
|
|
1041
|
+
Q,
|
|
1042
|
+
Vt,
|
|
1043
|
+
o
|
|
1044
|
+
]) }), qt = !A && (Kt.hasOriginBack || Kt.allowFallbackBack && !!Gt), Jt = te(), Yt = L(() => {
|
|
1045
|
+
if (!T) return {};
|
|
1046
|
+
let e = {};
|
|
1047
|
+
for (let t of dt(T, V, M)) Ht.has(t) && (e[t] = "Required");
|
|
1048
|
+
for (let t of pt(T, V)) Ht.has(t) && (e[t] = "Invalid email address");
|
|
1049
|
+
return e;
|
|
1050
|
+
}, [
|
|
1051
|
+
T,
|
|
1052
|
+
V,
|
|
1053
|
+
M,
|
|
1054
|
+
Ht
|
|
1055
|
+
]), Xt = Object.keys(Yt).length > 0, Zt = F(() => {
|
|
1056
|
+
if (!E || !T || M && !O || !M && !k || (Tt(!0), Xt)) return;
|
|
1057
|
+
let e = {}, t = Ee({
|
|
1058
|
+
entity: T,
|
|
1059
|
+
formData: V,
|
|
1060
|
+
record: Y,
|
|
1061
|
+
isNew: M
|
|
1062
|
+
}), n = De(t);
|
|
1063
|
+
if (M) for (let [t, n] of Object.entries(V)) {
|
|
1064
|
+
if (T.files?.has(t)) continue;
|
|
1065
|
+
let r = Pe(T, t, n);
|
|
1066
|
+
r !== "" && r != null && (e[t] = r);
|
|
1067
|
+
}
|
|
1068
|
+
else {
|
|
1069
|
+
for (let [t, n] of Object.entries(V)) {
|
|
1070
|
+
if (T.files?.has(t)) continue;
|
|
1071
|
+
let r = Y ? he(T, Y, t) : void 0, i = Pe(T, t, n), a = Pe(T, t, r);
|
|
1072
|
+
(i === "" ? null : i) !== (a === "" || a === void 0 ? null : a) && (e[t] = i);
|
|
1073
|
+
}
|
|
1074
|
+
X && (e.$row_version = X);
|
|
1075
|
+
}
|
|
1076
|
+
if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(H).length > 0 && (e.$statuses = Object.entries(H).map(([e, t]) => ({
|
|
1077
|
+
status_group_code: e,
|
|
1078
|
+
status_code: t
|
|
1079
|
+
}))), Object.keys(U).length > 0 && (e.$properties = Object.entries(U).map(([e, t]) => ({
|
|
1080
|
+
property_code: e,
|
|
1081
|
+
value: t
|
|
1082
|
+
}))), W) {
|
|
1083
|
+
let t = {};
|
|
1084
|
+
for (let [e, n] of Object.entries(W)) {
|
|
1085
|
+
let r = n.filter((e) => !e._deleted).map((e) => {
|
|
1086
|
+
let { _key: t, _deleted: n, _dirty: r, ...i } = e;
|
|
1087
|
+
return i;
|
|
1088
|
+
}), i = yt?.[e] ?? [];
|
|
1089
|
+
(M || !_t(r, i)) && (t[e] = r);
|
|
1090
|
+
}
|
|
1091
|
+
Object.keys(t).length > 0 && (e.$children = t);
|
|
1092
|
+
}
|
|
1093
|
+
if (!M && Object.keys(e).length === 0) {
|
|
1094
|
+
rt(!1), st({}), lt({}), G(void 0), K(void 0), Tt(!1);
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
let r = () => {
|
|
1098
|
+
rt(!1), mt(!1), Tt(!1), st({}), lt({}), G(void 0), K(void 0);
|
|
1099
|
+
};
|
|
1100
|
+
M ? Le.mutate(e, { onSuccess: (e) => {
|
|
1101
|
+
n.forEach((e) => b.markCommitted(e));
|
|
1102
|
+
let t = e.data, i = y(T ? S(T, t) : {});
|
|
1103
|
+
o(i ? `${Q}/${encodeURIComponent(i)}` : Q, { replace: !0 }), r();
|
|
1104
|
+
} }) : N && Be.mutate({
|
|
1105
|
+
pkValues: N,
|
|
1106
|
+
data: e
|
|
1107
|
+
}, {
|
|
1108
|
+
onSuccess: () => {
|
|
1109
|
+
n.forEach((e) => b.markCommitted(e)), r();
|
|
1110
|
+
},
|
|
1111
|
+
onError: (e) => {
|
|
1112
|
+
e instanceof a && e.code === "STALE_OBJECT" && mt(!0);
|
|
1113
|
+
}
|
|
1114
|
+
});
|
|
1115
|
+
}, [
|
|
1116
|
+
b,
|
|
1117
|
+
M,
|
|
1118
|
+
O,
|
|
1119
|
+
k,
|
|
1120
|
+
E,
|
|
1121
|
+
V,
|
|
1122
|
+
Xt,
|
|
1123
|
+
H,
|
|
1124
|
+
U,
|
|
1125
|
+
W,
|
|
1126
|
+
yt,
|
|
1127
|
+
Le,
|
|
1128
|
+
Be,
|
|
1129
|
+
T,
|
|
1130
|
+
o,
|
|
1131
|
+
Q,
|
|
1132
|
+
Y,
|
|
1133
|
+
X,
|
|
1134
|
+
N
|
|
1135
|
+
]), Qt = F((e, t) => {
|
|
1136
|
+
G((n) => ({
|
|
1137
|
+
...n ?? {},
|
|
1138
|
+
[e]: t
|
|
1139
|
+
}));
|
|
1140
|
+
}, []), $t = F(() => {
|
|
1141
|
+
!N || M || !oe || Ve.mutate(N, { onSuccess: () => {
|
|
1142
|
+
me.getState().kill(le(Z)), o(Q, { replace: !0 });
|
|
1143
|
+
} });
|
|
1144
|
+
}, [
|
|
1145
|
+
N,
|
|
1146
|
+
M,
|
|
1147
|
+
oe,
|
|
1148
|
+
Ve,
|
|
1149
|
+
o,
|
|
1150
|
+
Q,
|
|
1151
|
+
Z
|
|
1152
|
+
]), en = F(() => {
|
|
1153
|
+
!N || M || !se || He.mutate(N);
|
|
1154
|
+
}, [
|
|
1155
|
+
N,
|
|
1156
|
+
M,
|
|
1157
|
+
se,
|
|
1158
|
+
He
|
|
1159
|
+
]), tn = L(() => ht(W, _), [W, _]), nn = Object.keys(tn).length > 0;
|
|
1160
|
+
if (!w || !T) return null;
|
|
1161
|
+
if (!M && xe) return /* @__PURE__ */ z(ze, {});
|
|
1162
|
+
if (!M && !Y || Lt) return /* @__PURE__ */ B("div", {
|
|
1163
|
+
style: { padding: 24 },
|
|
1164
|
+
children: [/* @__PURE__ */ B("div", {
|
|
1165
|
+
style: {
|
|
1166
|
+
display: "flex",
|
|
1167
|
+
alignItems: "center",
|
|
1168
|
+
gap: 8,
|
|
1169
|
+
marginBottom: 8
|
|
1170
|
+
},
|
|
1171
|
+
children: [qt && /* @__PURE__ */ z(u, {
|
|
1172
|
+
icon: /* @__PURE__ */ z(e.back, { size: 14 }),
|
|
1173
|
+
onClick: Kt.goBack,
|
|
1174
|
+
title: "Back"
|
|
1175
|
+
}), /* @__PURE__ */ z("h1", {
|
|
1176
|
+
style: {
|
|
1177
|
+
margin: 0,
|
|
1178
|
+
fontSize: 18,
|
|
1179
|
+
fontWeight: 600,
|
|
1180
|
+
color: "var(--text)"
|
|
1181
|
+
},
|
|
1182
|
+
children: "Not Found"
|
|
1183
|
+
})]
|
|
1184
|
+
}), /* @__PURE__ */ z("p", {
|
|
1185
|
+
style: { color: "var(--text-3)" },
|
|
1186
|
+
children: "Record not found."
|
|
1187
|
+
})]
|
|
1188
|
+
});
|
|
1189
|
+
let rn = T.display, an = g(w.display?.name) || g(rn.name), on = D(Y, T), sn = M ? `New ${an}` : on ? String(on) : an, cn = Le.isPending || Be.isPending, ln = w.responsive?.[C.category]?.layout, un = ln?.tabs ?? (C.isPhone ? "sections" : void 0), dn = ln?.header_card === !0 ? Ie({
|
|
1190
|
+
entity: T,
|
|
1191
|
+
screen: w
|
|
1192
|
+
}) : void 0, $ = {
|
|
1193
|
+
schema: _,
|
|
1194
|
+
entity: T,
|
|
1195
|
+
entityCode: E,
|
|
1196
|
+
recordId: ge ?? j ?? "",
|
|
1197
|
+
record: q ? {
|
|
1198
|
+
...Y ?? {},
|
|
1199
|
+
...V
|
|
1200
|
+
} : Y ?? {},
|
|
1201
|
+
isNew: M,
|
|
1202
|
+
mode: q ? "edit" : "display",
|
|
1203
|
+
onFieldChange: q ? Wt : void 0,
|
|
1204
|
+
refs: Mt,
|
|
1205
|
+
objectProperties: (() => {
|
|
1206
|
+
let e = Qe ?? [];
|
|
1207
|
+
if (!q || Object.keys(U).length === 0) return e.length > 0 ? e : void 0;
|
|
1208
|
+
let t = e.map((e) => U[e.property_code] === void 0 ? e : {
|
|
1209
|
+
...e,
|
|
1210
|
+
value: U[e.property_code]
|
|
1211
|
+
});
|
|
1212
|
+
for (let [n, r] of Object.entries(U)) e.some((e) => e.property_code === n) || t.push({
|
|
1213
|
+
property_code: n,
|
|
1214
|
+
name: {},
|
|
1215
|
+
type: "string",
|
|
1216
|
+
value: r
|
|
1217
|
+
});
|
|
1218
|
+
return t;
|
|
1219
|
+
})(),
|
|
1220
|
+
onSetProperty: M || !k ? void 0 : q ? (e, t) => lt((n) => ({
|
|
1221
|
+
...n,
|
|
1222
|
+
[e]: t
|
|
1223
|
+
})) : void 0,
|
|
1224
|
+
isPropertyPending: !1,
|
|
1225
|
+
objectStatuses: (() => {
|
|
1226
|
+
let e = Ze ?? [];
|
|
1227
|
+
if (!q || Object.keys(H).length === 0) return e.length > 0 ? e : void 0;
|
|
1228
|
+
let t = e.map((e) => H[e.group_code] === void 0 ? e : {
|
|
1229
|
+
...e,
|
|
1230
|
+
status_code: H[e.group_code]
|
|
1231
|
+
});
|
|
1232
|
+
for (let [r, i] of Object.entries(H)) e.some((e) => e.group_code === r) || t.push({
|
|
1233
|
+
group_code: r,
|
|
1234
|
+
status_code: i,
|
|
1235
|
+
status_name: {},
|
|
1236
|
+
set_at: n()
|
|
1237
|
+
});
|
|
1238
|
+
return t;
|
|
1239
|
+
})(),
|
|
1240
|
+
onSetStatus: M || !k ? void 0 : q ? (e, t) => st((n) => ({
|
|
1241
|
+
...n,
|
|
1242
|
+
[e]: t
|
|
1243
|
+
})) : void 0,
|
|
1244
|
+
isStatusPending: !1,
|
|
1245
|
+
pendingChildren: q ? W : void 0,
|
|
1246
|
+
onChildrenChange: q ? Qt : void 0,
|
|
1247
|
+
childValidationErrors: q ? tn : void 0,
|
|
1248
|
+
fieldErrors: q && wt ? Yt : void 0,
|
|
1249
|
+
detailTabsPresentation: un,
|
|
1250
|
+
relatedRecordsPresentation: ln?.related_records
|
|
1251
|
+
}, fn = !!w.sidebar && w.sidebar.length > 0, pn = ln?.sidebar === "hidden", mn = fn && !pn && !C.isDesktop, hn = fn && !pn && C.isDesktop, gn = !M && Y ? /* @__PURE__ */ z(ct, {
|
|
1252
|
+
screen: w,
|
|
1253
|
+
entity: T,
|
|
1254
|
+
entityCode: E,
|
|
1255
|
+
record: Y,
|
|
1256
|
+
refs: Mt,
|
|
1257
|
+
objectStatuses: Ze,
|
|
1258
|
+
schema: _,
|
|
1259
|
+
locale: Jt
|
|
1260
|
+
}) : void 0, _n = /* @__PURE__ */ z(Ct, {
|
|
1261
|
+
title: sn,
|
|
1262
|
+
recordId: j,
|
|
1263
|
+
editing: q,
|
|
1264
|
+
isNew: M,
|
|
1265
|
+
isRecordDeleted: Ft,
|
|
1266
|
+
dirty: nt,
|
|
1267
|
+
isSaving: cn,
|
|
1268
|
+
hasChildErrors: nn,
|
|
1269
|
+
hasFieldErrors: wt && Xt,
|
|
1270
|
+
canRestore: se,
|
|
1271
|
+
entity: T,
|
|
1272
|
+
screen: w,
|
|
1273
|
+
globalActions: _?.actions,
|
|
1274
|
+
entityCode: E,
|
|
1275
|
+
record: Y,
|
|
1276
|
+
id: j,
|
|
1277
|
+
listRoute: Q,
|
|
1278
|
+
listRouteExists: !!Gt,
|
|
1279
|
+
highlights: gn,
|
|
1280
|
+
showBack: qt,
|
|
1281
|
+
onBack: Kt.goBack,
|
|
1282
|
+
onCancelEdit: Ut,
|
|
1283
|
+
onSave: Zt,
|
|
1284
|
+
onRestore: en,
|
|
1285
|
+
isRestoring: He.isPending,
|
|
1286
|
+
refreshControl: {
|
|
1287
|
+
refetch: P.refetch,
|
|
1288
|
+
isFetching: P.isFetching,
|
|
1289
|
+
isLoading: P.isLoading,
|
|
1290
|
+
isLive: je
|
|
1291
|
+
},
|
|
1292
|
+
isRealtimeEntity: T?.realtime === !0,
|
|
1293
|
+
canManageTemplates: de(_)
|
|
1294
|
+
}), vn = Ft && /* @__PURE__ */ B("div", {
|
|
1295
|
+
style: {
|
|
1296
|
+
display: "flex",
|
|
1297
|
+
alignItems: "center",
|
|
1298
|
+
gap: 8,
|
|
1299
|
+
padding: "10px 14px",
|
|
1300
|
+
marginBottom: 12,
|
|
1301
|
+
borderRadius: 8,
|
|
1302
|
+
border: "1px solid var(--danger)",
|
|
1303
|
+
background: "var(--danger-soft)",
|
|
1304
|
+
color: "var(--danger)",
|
|
1305
|
+
fontSize: 12.5
|
|
1306
|
+
},
|
|
1307
|
+
children: [/* @__PURE__ */ z(e.warning, { size: 14 }), /* @__PURE__ */ B("span", { children: ["This record was deleted on ", c(String(Y[T.soft_delete]))] })]
|
|
1308
|
+
}), yn = ft && /* @__PURE__ */ B("div", {
|
|
1309
|
+
style: {
|
|
1310
|
+
display: "flex",
|
|
1311
|
+
alignItems: "center",
|
|
1312
|
+
gap: 8,
|
|
1313
|
+
padding: "10px 14px",
|
|
1314
|
+
marginBottom: 12,
|
|
1315
|
+
borderRadius: 8,
|
|
1316
|
+
border: "1px solid var(--warn)",
|
|
1317
|
+
background: "var(--warn-soft)",
|
|
1318
|
+
color: "var(--warn)",
|
|
1319
|
+
fontSize: 12.5
|
|
1320
|
+
},
|
|
1321
|
+
children: [/* @__PURE__ */ z(e.warning, { size: 14 }), /* @__PURE__ */ z("span", { children: "This record changed on the server while you were viewing or editing it." })]
|
|
1322
|
+
}), bn = q && wt && Xt && /* @__PURE__ */ z(ot, {
|
|
1323
|
+
errors: Object.entries(Yt).map(([e, t]) => {
|
|
1324
|
+
let n = T.fields.get(e);
|
|
1325
|
+
return {
|
|
1326
|
+
name: e,
|
|
1327
|
+
label: n ? m(n, e, _?.entities) : e,
|
|
1328
|
+
message: t
|
|
1329
|
+
};
|
|
1330
|
+
}),
|
|
1331
|
+
onJump: (e) => {
|
|
1332
|
+
let t = document.getElementById(`${E}-${e}`);
|
|
1333
|
+
t && (t.scrollIntoView({
|
|
1334
|
+
block: "center",
|
|
1335
|
+
behavior: "smooth"
|
|
1336
|
+
}), t.focus?.());
|
|
1337
|
+
}
|
|
1338
|
+
}), xn = Ue && !M && !(w.items && w.items.length > 0) && /* @__PURE__ */ z("div", {
|
|
1339
|
+
className: "mb-4",
|
|
1340
|
+
children: /* @__PURE__ */ z(We, {
|
|
1341
|
+
statusGroups: T.status_groups ?? {},
|
|
1342
|
+
objectStatuses: $.objectStatuses,
|
|
1343
|
+
onSetStatus: k && q ? (e, t) => st((n) => ({
|
|
1344
|
+
...n,
|
|
1345
|
+
[e]: t
|
|
1346
|
+
})) : gt,
|
|
1347
|
+
isPending: !1,
|
|
1348
|
+
mode: q ? "edit" : "display"
|
|
1349
|
+
})
|
|
1350
|
+
}), Sn = /* @__PURE__ */ B($e, { children: [
|
|
1351
|
+
dn && (Y || M) && /* @__PURE__ */ z(bt, {
|
|
1352
|
+
card: dn,
|
|
1353
|
+
entity: T,
|
|
1354
|
+
record: $.record,
|
|
1355
|
+
objectStatuses: $.objectStatuses,
|
|
1356
|
+
objectProperties: $.objectProperties
|
|
1357
|
+
}),
|
|
1358
|
+
w.items && w.items.length > 0 && (Y || M) && _ && /* @__PURE__ */ z(Ge, {
|
|
1359
|
+
nodes: w.items,
|
|
1360
|
+
ctx: $
|
|
1361
|
+
}),
|
|
1362
|
+
!M && j && E && T.associations && Object.keys(T.associations).length > 0 && _ && /* @__PURE__ */ z(et, {
|
|
1363
|
+
entityCode: E,
|
|
1364
|
+
recordId: ge ?? j ?? "",
|
|
1365
|
+
associations: T.associations,
|
|
1366
|
+
schema: _
|
|
1367
|
+
}),
|
|
1368
|
+
!M && j && E && /* @__PURE__ */ z(it, {
|
|
1369
|
+
entityCode: E,
|
|
1370
|
+
objectId: ge ?? j,
|
|
1371
|
+
canGenerateOne: !!T?.documents?.generate_one,
|
|
1372
|
+
canManageTemplates: de(_)
|
|
1373
|
+
}),
|
|
1374
|
+
!M && Y && _ && /* @__PURE__ */ z(ut, {
|
|
1375
|
+
screen: w,
|
|
1376
|
+
entity: T,
|
|
1377
|
+
entityCode: E,
|
|
1378
|
+
record: Y,
|
|
1379
|
+
refs: Mt,
|
|
1380
|
+
schema: _,
|
|
1381
|
+
locale: Jt
|
|
1382
|
+
})
|
|
1383
|
+
] }), Cn = /* @__PURE__ */ z(Me, {
|
|
1384
|
+
open: xt.show,
|
|
1385
|
+
onOpenChange: (e) => !e && St({ show: !1 }),
|
|
1386
|
+
title: `Delete ${an}`,
|
|
1387
|
+
description: xt.confirmation ? xt.confirmation : Pt ? `Are you sure you want to delete this ${an.toLowerCase()}? It can be restored later by an admin.` : `Are you sure you want to delete this ${an.toLowerCase()}? This action cannot be undone.`,
|
|
1388
|
+
confirmLabel: "Delete",
|
|
1389
|
+
onConfirm: $t,
|
|
1390
|
+
destructive: !0
|
|
1391
|
+
});
|
|
1392
|
+
if (hn) return /* @__PURE__ */ B("div", {
|
|
1393
|
+
style: {
|
|
1394
|
+
height: "100%",
|
|
1395
|
+
display: "flex",
|
|
1396
|
+
overflow: "hidden",
|
|
1397
|
+
background: "var(--background)"
|
|
1398
|
+
},
|
|
1399
|
+
children: [
|
|
1400
|
+
/* @__PURE__ */ B("div", {
|
|
1401
|
+
style: {
|
|
1402
|
+
flex: 1,
|
|
1403
|
+
minWidth: 0,
|
|
1404
|
+
display: "flex",
|
|
1405
|
+
flexDirection: "column",
|
|
1406
|
+
height: "100%"
|
|
1407
|
+
},
|
|
1408
|
+
children: [/* @__PURE__ */ B("div", {
|
|
1409
|
+
style: {
|
|
1410
|
+
flexShrink: 0,
|
|
1411
|
+
padding: "14px 20px 8px"
|
|
1412
|
+
},
|
|
1413
|
+
children: [
|
|
1414
|
+
_n,
|
|
1415
|
+
yn,
|
|
1416
|
+
vn,
|
|
1417
|
+
bn,
|
|
1418
|
+
xn
|
|
1419
|
+
]
|
|
1420
|
+
}), /* @__PURE__ */ z("div", {
|
|
1421
|
+
ref: It,
|
|
1422
|
+
style: {
|
|
1423
|
+
flex: 1,
|
|
1424
|
+
minHeight: 0,
|
|
1425
|
+
overflowY: "auto",
|
|
1426
|
+
padding: "4px 20px 24px",
|
|
1427
|
+
display: "flex",
|
|
1428
|
+
flexDirection: "column",
|
|
1429
|
+
gap: 16
|
|
1430
|
+
},
|
|
1431
|
+
children: Sn
|
|
1432
|
+
})]
|
|
1433
|
+
}),
|
|
1434
|
+
/* @__PURE__ */ z("div", {
|
|
1435
|
+
className: "detail-resize-handle",
|
|
1436
|
+
onMouseDown: jt,
|
|
1437
|
+
title: "Drag to resize",
|
|
1438
|
+
children: /* @__PURE__ */ z("div", { style: {
|
|
1439
|
+
position: "absolute",
|
|
1440
|
+
top: 0,
|
|
1441
|
+
bottom: 0,
|
|
1442
|
+
left: "50%",
|
|
1443
|
+
transform: "translateX(-50%)",
|
|
1444
|
+
width: 1,
|
|
1445
|
+
background: "var(--border)"
|
|
1446
|
+
} })
|
|
1447
|
+
}),
|
|
1448
|
+
/* @__PURE__ */ z("div", {
|
|
1449
|
+
ref: At,
|
|
1450
|
+
style: {
|
|
1451
|
+
flexShrink: 0,
|
|
1452
|
+
height: "100%",
|
|
1453
|
+
width: `${Ot}px`
|
|
1454
|
+
},
|
|
1455
|
+
children: (Y || M) && _ && /* @__PURE__ */ z(Ge, {
|
|
1456
|
+
nodes: w.sidebar,
|
|
1457
|
+
ctx: $
|
|
1458
|
+
})
|
|
1459
|
+
}),
|
|
1460
|
+
Cn
|
|
1461
|
+
]
|
|
1462
|
+
});
|
|
1463
|
+
let wn = C.isPhone ? 12 : 24;
|
|
1464
|
+
return /* @__PURE__ */ B("div", {
|
|
1465
|
+
style: {
|
|
1466
|
+
height: "100%",
|
|
1467
|
+
display: "flex",
|
|
1468
|
+
flexDirection: "column",
|
|
1469
|
+
overflow: "hidden",
|
|
1470
|
+
background: "var(--background)"
|
|
1471
|
+
},
|
|
1472
|
+
children: [
|
|
1473
|
+
/* @__PURE__ */ B("div", {
|
|
1474
|
+
style: {
|
|
1475
|
+
flexShrink: 0,
|
|
1476
|
+
padding: C.isPhone ? "14px 12px 8px" : "24px 24px 8px"
|
|
1477
|
+
},
|
|
1478
|
+
children: [
|
|
1479
|
+
_n,
|
|
1480
|
+
yn,
|
|
1481
|
+
vn,
|
|
1482
|
+
bn,
|
|
1483
|
+
xn
|
|
1484
|
+
]
|
|
1485
|
+
}),
|
|
1486
|
+
/* @__PURE__ */ B("div", {
|
|
1487
|
+
ref: It,
|
|
1488
|
+
style: {
|
|
1489
|
+
flex: 1,
|
|
1490
|
+
minHeight: 0,
|
|
1491
|
+
overflowY: "auto",
|
|
1492
|
+
padding: `4px ${wn}px calc(24px + var(--safe-area-bottom, 0px))`,
|
|
1493
|
+
display: "flex",
|
|
1494
|
+
flexDirection: "column",
|
|
1495
|
+
gap: 16,
|
|
1496
|
+
minWidth: 0,
|
|
1497
|
+
WebkitOverflowScrolling: "touch"
|
|
1498
|
+
},
|
|
1499
|
+
children: [Sn, mn && (Y || M) && _ && /* @__PURE__ */ z("div", {
|
|
1500
|
+
"data-testid": "detail-sidebar-inline",
|
|
1501
|
+
style: {
|
|
1502
|
+
display: "flex",
|
|
1503
|
+
flexDirection: "column",
|
|
1504
|
+
gap: 16,
|
|
1505
|
+
minWidth: 0
|
|
1506
|
+
},
|
|
1507
|
+
children: /* @__PURE__ */ z(Ge, {
|
|
1508
|
+
nodes: w.sidebar,
|
|
1509
|
+
ctx: $
|
|
1510
|
+
})
|
|
1511
|
+
})]
|
|
1512
|
+
}),
|
|
1513
|
+
Cn
|
|
1514
|
+
]
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
function bt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties: i }) {
|
|
1518
|
+
let a = (e) => {
|
|
1519
|
+
let a = xt(t, e, n, r, i);
|
|
1520
|
+
return a != null && k(a) !== "";
|
|
1521
|
+
}, o = (e) => k(xt(t, e, n, r, i)) || /* @__PURE__ */ z("span", {
|
|
1522
|
+
style: { color: "var(--text-3)" },
|
|
1523
|
+
children: "-"
|
|
1524
|
+
}), s = k(e.titleUsesDisplay ? D(n, t) : e.titleField ? xt(t, e.titleField, n, r, i) : void 0) || g(t.display?.name) || "Record", c = e.badgeFields.filter((t) => !e.hideEmptyFields || a(t)), l = e.bodyFields.filter((t) => !e.hideEmptyFields || a(t)), u = e.metaFields.filter((t) => !e.hideEmptyFields || a(t));
|
|
1525
|
+
return /* @__PURE__ */ B("section", {
|
|
1526
|
+
"data-testid": "detail-header-card",
|
|
1527
|
+
style: {
|
|
1528
|
+
width: "100%",
|
|
1529
|
+
minWidth: 0,
|
|
1530
|
+
border: "1px solid var(--border)",
|
|
1531
|
+
borderRadius: 8,
|
|
1532
|
+
background: "var(--surface)",
|
|
1533
|
+
boxShadow: "var(--shadow-xs)",
|
|
1534
|
+
padding: 14,
|
|
1535
|
+
boxSizing: "border-box"
|
|
1536
|
+
},
|
|
1537
|
+
children: [
|
|
1538
|
+
/* @__PURE__ */ B("div", {
|
|
1539
|
+
style: { minWidth: 0 },
|
|
1540
|
+
children: [/* @__PURE__ */ z("div", {
|
|
1541
|
+
style: {
|
|
1542
|
+
fontSize: 15,
|
|
1543
|
+
lineHeight: 1.25,
|
|
1544
|
+
fontWeight: 700,
|
|
1545
|
+
color: "var(--text)",
|
|
1546
|
+
overflowWrap: "anywhere"
|
|
1547
|
+
},
|
|
1548
|
+
children: s
|
|
1549
|
+
}), e.subtitleField && /* @__PURE__ */ z("div", {
|
|
1550
|
+
style: {
|
|
1551
|
+
marginTop: 4,
|
|
1552
|
+
fontSize: 12.5,
|
|
1553
|
+
lineHeight: 1.35,
|
|
1554
|
+
color: "var(--text-3)",
|
|
1555
|
+
overflowWrap: "anywhere"
|
|
1556
|
+
},
|
|
1557
|
+
children: o(e.subtitleField)
|
|
1558
|
+
})]
|
|
1559
|
+
}),
|
|
1560
|
+
c.length > 0 && /* @__PURE__ */ z("div", {
|
|
1561
|
+
style: {
|
|
1562
|
+
display: "flex",
|
|
1563
|
+
flexWrap: "wrap",
|
|
1564
|
+
gap: 6,
|
|
1565
|
+
marginTop: 10
|
|
1566
|
+
},
|
|
1567
|
+
children: c.map((e) => /* @__PURE__ */ z("span", {
|
|
1568
|
+
style: {
|
|
1569
|
+
minWidth: 0,
|
|
1570
|
+
maxWidth: "100%",
|
|
1571
|
+
borderRadius: 999,
|
|
1572
|
+
background: "var(--surface-2)",
|
|
1573
|
+
color: "var(--text-2)",
|
|
1574
|
+
padding: "2px 8px",
|
|
1575
|
+
fontSize: 12,
|
|
1576
|
+
lineHeight: 1.4,
|
|
1577
|
+
overflowWrap: "anywhere"
|
|
1578
|
+
},
|
|
1579
|
+
children: o(e)
|
|
1580
|
+
}, e))
|
|
1581
|
+
}),
|
|
1582
|
+
l.length > 0 && /* @__PURE__ */ z("dl", {
|
|
1583
|
+
style: {
|
|
1584
|
+
display: "grid",
|
|
1585
|
+
gridTemplateColumns: "minmax(84px, max-content) minmax(0, 1fr)",
|
|
1586
|
+
gap: "6px 10px",
|
|
1587
|
+
margin: "12px 0 0",
|
|
1588
|
+
fontSize: 12.5,
|
|
1589
|
+
lineHeight: 1.35
|
|
1590
|
+
},
|
|
1591
|
+
children: l.map((e) => /* @__PURE__ */ B("div", {
|
|
1592
|
+
style: { display: "contents" },
|
|
1593
|
+
children: [/* @__PURE__ */ z("dt", {
|
|
1594
|
+
style: { color: "var(--text-3)" },
|
|
1595
|
+
children: St(t, e)
|
|
1596
|
+
}), /* @__PURE__ */ z("dd", {
|
|
1597
|
+
style: {
|
|
1598
|
+
margin: 0,
|
|
1599
|
+
color: "var(--text-2)",
|
|
1600
|
+
minWidth: 0,
|
|
1601
|
+
overflowWrap: "anywhere"
|
|
1602
|
+
},
|
|
1603
|
+
children: o(e)
|
|
1604
|
+
})]
|
|
1605
|
+
}, e))
|
|
1606
|
+
}),
|
|
1607
|
+
u.length > 0 && /* @__PURE__ */ z("div", {
|
|
1608
|
+
style: {
|
|
1609
|
+
display: "flex",
|
|
1610
|
+
flexWrap: "wrap",
|
|
1611
|
+
gap: 10,
|
|
1612
|
+
marginTop: 10,
|
|
1613
|
+
color: "var(--text-3)",
|
|
1614
|
+
fontSize: 11.5
|
|
1615
|
+
},
|
|
1616
|
+
children: u.map((e) => /* @__PURE__ */ B("span", {
|
|
1617
|
+
style: {
|
|
1618
|
+
minWidth: 0,
|
|
1619
|
+
overflowWrap: "anywhere"
|
|
1620
|
+
},
|
|
1621
|
+
children: [
|
|
1622
|
+
St(t, e),
|
|
1623
|
+
": ",
|
|
1624
|
+
o(e)
|
|
1625
|
+
]
|
|
1626
|
+
}, e))
|
|
1627
|
+
})
|
|
1628
|
+
]
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
function xt(e, t, n, r, i) {
|
|
1632
|
+
if (t.startsWith("$status.")) {
|
|
1633
|
+
let e = t.slice(8), n = r?.find((t) => t.group_code === e);
|
|
1634
|
+
return g(n?.status_name) || n?.status_code;
|
|
1635
|
+
}
|
|
1636
|
+
if (t.startsWith("$property.")) {
|
|
1637
|
+
let e = t.slice(10);
|
|
1638
|
+
return i?.find((t) => t.property_code === e)?.value;
|
|
1639
|
+
}
|
|
1640
|
+
return he(e, n, t);
|
|
1641
|
+
}
|
|
1642
|
+
function St(e, t) {
|
|
1643
|
+
if (t.startsWith("$status.")) return t.slice(8);
|
|
1644
|
+
if (t.startsWith("$property.")) return t.slice(10);
|
|
1645
|
+
let n = e.fields.get(t);
|
|
1646
|
+
return n ? m(n, t) : t;
|
|
1647
|
+
}
|
|
1648
|
+
function Ct({ title: n, recordId: i, editing: a, isNew: o, isRecordDeleted: s, dirty: c, isSaving: l, hasChildErrors: u, hasFieldErrors: f, canRestore: p, entity: m, screen: h, globalActions: _, entityCode: y, record: b, id: x, listRoute: S, listRouteExists: T, highlights: ee, showBack: D, onBack: ne, onCancelEdit: re, onSave: O, onRestore: ie, isRestoring: ae, refreshControl: k, isRealtimeEntity: oe, canManageTemplates: se }) {
|
|
1649
|
+
let { run: ce } = E(), j = A("detail"), ue = Ae(), de = r(), fe = te(), pe = Be(h?.action_layout, m?.action_layout, m?.actions, _, "detail_toolbar"), he = be(Be(h?.action_layout, m?.action_layout, m?.actions, _, "detail"), m?.actions, _, b ?? {}, []), _e = be(pe, m?.actions, _, b ?? {}, []), ve = L(() => {
|
|
1650
|
+
if (!m) return;
|
|
1651
|
+
let e = x ? [x] : [];
|
|
1652
|
+
return {
|
|
1653
|
+
entity: m,
|
|
1654
|
+
entityCode: y ?? "",
|
|
1655
|
+
screen: h,
|
|
1656
|
+
screenRoute: h?.route ?? "",
|
|
1657
|
+
selectedRows: b ? [b] : [],
|
|
1658
|
+
selectedIds: e,
|
|
1659
|
+
locale: fe,
|
|
1660
|
+
tabNavigate: (e, t) => ue(e, {
|
|
1661
|
+
title: t?.title,
|
|
1662
|
+
icon: t?.icon,
|
|
1663
|
+
search: t?.search
|
|
1664
|
+
}),
|
|
1665
|
+
runActionApi: (e, t) => C(e, t)
|
|
1666
|
+
};
|
|
1667
|
+
}, [
|
|
1668
|
+
m,
|
|
1669
|
+
y,
|
|
1670
|
+
h,
|
|
1671
|
+
x,
|
|
1672
|
+
b,
|
|
1673
|
+
fe,
|
|
1674
|
+
ue
|
|
1675
|
+
]), ye = (e, t) => {
|
|
1676
|
+
let n = ge(e, t, { row: b ?? void 0 });
|
|
1677
|
+
if (n === null) return;
|
|
1678
|
+
let r = x ? [x] : [], i = e === "__delete" && T ? S : null;
|
|
1679
|
+
return ce({
|
|
1680
|
+
action: t,
|
|
1681
|
+
title: g(t.display?.name) || e,
|
|
1682
|
+
execute: (e) => C(n, v(e, r)),
|
|
1683
|
+
onSuccess: i ? () => {
|
|
1684
|
+
me.getState().kill(le(location)), de(i, { replace: !0 });
|
|
1685
|
+
} : void 0
|
|
1686
|
+
});
|
|
1687
|
+
}, P = j.isVisible("show_actions") && !o && x && he.length > 0 ? /* @__PURE__ */ z(xe, {
|
|
1688
|
+
layout: he,
|
|
1689
|
+
row: b,
|
|
1690
|
+
onRun: ye,
|
|
1691
|
+
kind: "detail",
|
|
1692
|
+
entityActions: m?.actions,
|
|
1693
|
+
globalActions: _,
|
|
1694
|
+
reservedRightWidth: 0,
|
|
1695
|
+
widgetContext: ve,
|
|
1696
|
+
fillContainer: !1
|
|
1697
|
+
}) : null, Se = !o && x ? /* @__PURE__ */ z(M, {
|
|
1698
|
+
liveObject: k,
|
|
1699
|
+
realtime: oe
|
|
1700
|
+
}) : null, Ce = j.isVisible("show_actions") && !o && x && _e.length > 0 ? /* @__PURE__ */ B("div", {
|
|
1701
|
+
style: {
|
|
1702
|
+
display: "flex",
|
|
1703
|
+
justifyContent: "flex-end",
|
|
1704
|
+
alignItems: "center",
|
|
1705
|
+
gap: 8,
|
|
1706
|
+
marginTop: 10
|
|
1707
|
+
},
|
|
1708
|
+
children: [P ? null : Se, /* @__PURE__ */ z(xe, {
|
|
1709
|
+
layout: _e,
|
|
1710
|
+
row: b,
|
|
1711
|
+
onRun: ye,
|
|
1712
|
+
kind: "detail",
|
|
1713
|
+
entityActions: m?.actions,
|
|
1714
|
+
globalActions: _,
|
|
1715
|
+
reservedRightWidth: 0,
|
|
1716
|
+
widgetContext: ve,
|
|
1717
|
+
ariaLabel: P ? "Detail toolbar actions" : "Page actions"
|
|
1718
|
+
})]
|
|
1719
|
+
}) : null, we = j.isVisible("show_actions") && !o && x && y ? /* @__PURE__ */ z(N, {
|
|
1720
|
+
entityCode: y,
|
|
1721
|
+
scope: "detail",
|
|
1722
|
+
objectIds: [x],
|
|
1723
|
+
capability: m?.documents,
|
|
1724
|
+
canManageTemplates: se
|
|
1725
|
+
}) : null, Te = s ? p ? /* @__PURE__ */ z(d, {
|
|
1726
|
+
kind: "primary",
|
|
1727
|
+
icon: z(ae ? w : e.refresh, { size: 13 }),
|
|
1728
|
+
onClick: ie,
|
|
1729
|
+
disabled: ae,
|
|
1730
|
+
children: ae ? "Restoring…" : "Restore"
|
|
1731
|
+
}) : null : a ? /* @__PURE__ */ B($e, { children: [/* @__PURE__ */ z(d, {
|
|
1732
|
+
icon: /* @__PURE__ */ z(e.x, { size: 13 }),
|
|
1733
|
+
onClick: re,
|
|
1734
|
+
disabled: l,
|
|
1735
|
+
children: "Cancel"
|
|
1736
|
+
}), /* @__PURE__ */ z(d, {
|
|
1737
|
+
kind: "primary",
|
|
1738
|
+
icon: z(l ? w : e.save, { size: 13 }),
|
|
1739
|
+
onClick: O,
|
|
1740
|
+
disabled: l || u || f,
|
|
1741
|
+
title: u ? "Fix errors in child rows" : f ? "Fix the highlighted fields" : void 0,
|
|
1742
|
+
children: l ? "Saving…" : "Save"
|
|
1743
|
+
})] }) : !o && x ? P ? /* @__PURE__ */ B("span", {
|
|
1744
|
+
style: {
|
|
1745
|
+
display: "inline-flex",
|
|
1746
|
+
alignItems: "center",
|
|
1747
|
+
gap: 8,
|
|
1748
|
+
flexWrap: "nowrap"
|
|
1749
|
+
},
|
|
1750
|
+
children: [
|
|
1751
|
+
we,
|
|
1752
|
+
Se,
|
|
1753
|
+
P
|
|
1754
|
+
]
|
|
1755
|
+
}) : we : null;
|
|
1756
|
+
return /* @__PURE__ */ B($e, { children: [/* @__PURE__ */ z(G, {
|
|
1757
|
+
icon: m?.display.icon ? /* @__PURE__ */ z(t, {
|
|
1758
|
+
name: m.display.icon,
|
|
1759
|
+
size: 16
|
|
1760
|
+
}) : void 0,
|
|
1761
|
+
title: n,
|
|
1762
|
+
description: g(h?.display?.description) || g(m?.display?.description),
|
|
1763
|
+
recordId: i,
|
|
1764
|
+
highlights: ee,
|
|
1765
|
+
mode: o ? "create" : a ? "edit" : "display",
|
|
1766
|
+
dirty: c,
|
|
1767
|
+
showBack: D,
|
|
1768
|
+
onBack: ne,
|
|
1769
|
+
right: Te,
|
|
1770
|
+
showTitle: j.isVisible("show_title")
|
|
1771
|
+
}), Ce] });
|
|
1772
|
+
}
|
|
1773
|
+
//#endregion
|
|
1774
|
+
export { yt as SmartDetailPage };
|