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