@declarion/react 0.31.1 → 0.32.0
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-BzaZQtiI.js → ActionRunner-CaSrGpBi.js} +264 -260
- package/dist-lib/{DraggableChildrenTable-DILqStHQ.js → DraggableChildrenTable-CAHg7paQ.js} +1 -1
- package/dist-lib/{Grid-BIsiUwPh.js → Grid-DDbBhqcl.js} +2 -2
- package/dist-lib/{LayoutRenderer-3RvIsC9M.js → LayoutRenderer-CelsqsZ6.js} +433 -433
- package/dist-lib/{MarkdownRenderer-CaHhWrfm.js → MarkdownRenderer-DThy2ixe.js} +1 -1
- package/dist-lib/RefreshControl-CorluL6r.js +582 -0
- package/dist-lib/{SmartDetailPage.impl--EO-9fos.js → SmartDetailPage.impl-USIxbl-8.js} +449 -411
- package/dist-lib/{SmartRecordListPage.impl-B1iws8yf.js → SmartRecordListPage.impl-BKIpTNK7.js} +210 -210
- package/dist-lib/api/data.d.ts +4 -4
- package/dist-lib/api/params.d.ts +1 -1
- package/dist-lib/components/layout/Rail.d.ts +5 -5
- package/dist-lib/components/layout/TopBar.d.ts +3 -1
- package/dist-lib/components/pages/auth/AuthShell.d.ts +1 -1
- package/dist-lib/components/pages/list/ListHeader.d.ts +1 -1
- package/dist-lib/components/primitives/BrandLogo.d.ts +1 -1
- package/dist-lib/components/shared/ActionRunner.d.ts +1 -0
- package/dist-lib/components/shared/ObjectActionBar.d.ts +29 -0
- package/dist-lib/components/shared/PageHeader.d.ts +1 -1
- package/dist-lib/components/shared/RecordHeader.d.ts +2 -1
- package/dist-lib/components/shared/RefreshControl.d.ts +6 -0
- package/dist-lib/hooks/useBranding.d.ts +8 -0
- package/dist-lib/hooks/useBrandingChrome.d.ts +6 -0
- package/dist-lib/hooks/useLiveObject.d.ts +9 -0
- package/dist-lib/hooks/useMutations.d.ts +3 -3
- package/dist-lib/hooks/useObject.d.ts +10 -0
- package/dist-lib/hooks/usePageStateRuntime.d.ts +1 -1
- package/dist-lib/hooks/useParams.d.ts +10 -1
- package/dist-lib/index.d.ts +11 -5
- package/dist-lib/index.js +1890 -1722
- package/dist-lib/lib/actions.d.ts +6 -2
- package/dist-lib/lib/branding.d.ts +10 -1
- package/dist-lib/{registry-2KliNTHB.js → registry-KQyyL5Gt.js} +1452 -1401
- package/dist-lib/testing.d.ts +5 -3
- package/dist-lib/testing.js +35 -31
- package/dist-lib/types/api.d.ts +70 -3
- package/dist-lib/types/schema.d.ts +1 -15
- package/dist-lib/{useProperties-Co3RdtuT.js → useProperties-D74hyWIa.js} +53 -53
- package/dist-lib/{value-BooGwUik.js → value-BfXXl5EE.js} +1 -1
- package/package.json +1 -1
- package/dist-lib/hooks/useEntityItem.d.ts +0 -10
- package/dist-lib/peekDraftStore-yyzMbaiI.js +0 -468
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { s as e, t } from "./DynamicIcon-DCRdxxZ7.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { $ as
|
|
5
|
-
import { n as
|
|
6
|
-
import { n as
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { useLocation as
|
|
9
|
-
import { useQuery as
|
|
10
|
-
import { Fragment as
|
|
2
|
+
import { $ as n, Bn as r, F as i, Fn as a, Hn as o, J as s, K as c, Kt as l, P as u, Vn as ee, an as d, b as f, cn as p, g as m, gn as h, in as g, kn as te, m as _, mt as v, n as y, nn as ne, on as b, ot as x, p as re, pt as ie, rn as ae, rt as S, st as C, tn as w, un as oe, v as se, z as ce } from "./ActionRunner-CaSrGpBi.js";
|
|
3
|
+
import { A as T, f as le, g as ue, i as de, k as E, l as fe, o as pe, t as me, v as he } from "./RefreshControl-CorluL6r.js";
|
|
4
|
+
import { $ as ge, D as _e, G as ve, H as ye, K as be, L as D, M as O, O as k, Q as xe, U as Se, W as Ce, X as A, Z as we, _ as Te, a as Ee, bt as j, dt as De, et as M, ft as Oe, i as ke, nt as Ae, q as je, s as Me, tt as Ne, vt as Pe, w as Fe, z as Ie } from "./registry-KQyyL5Gt.js";
|
|
5
|
+
import { n as Le, r as Re, t as ze } from "./dataTableStyles-vwD1mVOP.js";
|
|
6
|
+
import { n as Be, t as Ve } from "./LayoutRenderer-CelsqsZ6.js";
|
|
7
|
+
import { Fragment as He, useCallback as N, useEffect as P, useMemo as F, useRef as Ue, useState as I } from "react";
|
|
8
|
+
import { useLocation as We, useParams as Ge, useSearchParams as Ke } from "react-router-dom";
|
|
9
|
+
import { useQuery as qe } from "@tanstack/react-query";
|
|
10
|
+
import { Fragment as Je, jsx as L, jsxs as R } from "react/jsx-runtime";
|
|
11
11
|
//#region src/components/shared/AssociationTabs.tsx
|
|
12
|
-
function
|
|
13
|
-
let a =
|
|
12
|
+
function Ye({ entityCode: e, recordId: n, associations: r, schema: i }) {
|
|
13
|
+
let a = F(() => Object.entries(r), [r]), [o, s] = I(0);
|
|
14
14
|
if (a.length === 0) return null;
|
|
15
15
|
let [c, l] = a[o];
|
|
16
|
-
return /* @__PURE__ */ L(
|
|
16
|
+
return /* @__PURE__ */ L(j, {
|
|
17
17
|
title: /* @__PURE__ */ L("div", {
|
|
18
18
|
style: {
|
|
19
19
|
display: "flex",
|
|
@@ -46,13 +46,13 @@ function Ke({ entityCode: e, recordId: n, associations: r, schema: i }) {
|
|
|
46
46
|
children: [n.display?.icon && /* @__PURE__ */ L(t, {
|
|
47
47
|
name: n.display.icon,
|
|
48
48
|
size: 13
|
|
49
|
-
}),
|
|
49
|
+
}), b(n.display?.name) || e]
|
|
50
50
|
}, e);
|
|
51
51
|
})
|
|
52
52
|
}),
|
|
53
53
|
collapsible: !1,
|
|
54
54
|
padding: "0",
|
|
55
|
-
children: /* @__PURE__ */ L(
|
|
55
|
+
children: /* @__PURE__ */ L(Xe, {
|
|
56
56
|
entityCode: e,
|
|
57
57
|
recordId: n,
|
|
58
58
|
assocKey: c,
|
|
@@ -61,108 +61,108 @@ function Ke({ entityCode: e, recordId: n, associations: r, schema: i }) {
|
|
|
61
61
|
})
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
let
|
|
64
|
+
function Xe({ entityCode: t, recordId: n, assocKey: r, association: i, schema: a }) {
|
|
65
|
+
let s = De(), c = re(), l = `${t}.${r}`, { data: u, isLoading: ee } = qe({
|
|
66
66
|
queryKey: [
|
|
67
67
|
"association",
|
|
68
|
-
|
|
68
|
+
l,
|
|
69
69
|
n
|
|
70
70
|
],
|
|
71
|
-
queryFn: () =>
|
|
72
|
-
}),
|
|
71
|
+
queryFn: () => C(l, [n])
|
|
72
|
+
}), d = u?.target_entity ?? i.target, f = a.entities[d], p = F(() => u?.ids ?? [], [u?.ids]), m = F(() => f?.fields.names().find((e) => f.fields.get(e)?.primary) ?? "id", [f]), h = F(() => p.slice(0, 50), [p]), { data: g, isLoading: te } = qe({
|
|
73
73
|
queryKey: [
|
|
74
74
|
"association-records",
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
d,
|
|
76
|
+
h
|
|
77
77
|
],
|
|
78
|
-
queryFn: () =>
|
|
78
|
+
queryFn: () => x(d, {
|
|
79
79
|
per_page: 50,
|
|
80
80
|
filters: [{
|
|
81
|
-
field:
|
|
81
|
+
field: m,
|
|
82
82
|
op: "in",
|
|
83
|
-
value:
|
|
83
|
+
value: h
|
|
84
84
|
}]
|
|
85
85
|
}),
|
|
86
|
-
enabled:
|
|
87
|
-
}),
|
|
88
|
-
let t =
|
|
86
|
+
enabled: h.length > 0 && !!f
|
|
87
|
+
}), v = g?.data ?? [], y = g?.$refs, ne = F(() => f ? f.fields.names().filter((e) => {
|
|
88
|
+
let t = f.fields.get(e);
|
|
89
89
|
return t && !t.primary && !t.auto && t.display?.is_listable !== !1;
|
|
90
|
-
}).slice(0, 6) : [], [
|
|
91
|
-
let e =
|
|
90
|
+
}).slice(0, 6) : [], [f]), ie = () => {
|
|
91
|
+
let e = D(a, d);
|
|
92
92
|
if (!e) return;
|
|
93
|
-
let t =
|
|
93
|
+
let t = b(i.display?.name) || r, n = new URLSearchParams();
|
|
94
94
|
n.set("filters", JSON.stringify([{
|
|
95
|
-
field:
|
|
95
|
+
field: m,
|
|
96
96
|
op: "in",
|
|
97
|
-
value:
|
|
98
|
-
}])),
|
|
97
|
+
value: p
|
|
98
|
+
}])), s(e.route, {
|
|
99
99
|
title: t,
|
|
100
100
|
icon: i.display?.icon || e.icon,
|
|
101
101
|
search: n.toString()
|
|
102
102
|
});
|
|
103
|
-
},
|
|
103
|
+
}, S = {
|
|
104
104
|
fontSize: 12.5,
|
|
105
105
|
color: "var(--text-3)",
|
|
106
106
|
padding: "14px 16px"
|
|
107
107
|
};
|
|
108
108
|
if (ee || te) return /* @__PURE__ */ L("div", {
|
|
109
|
-
style:
|
|
109
|
+
style: S,
|
|
110
110
|
children: "Loading…"
|
|
111
111
|
});
|
|
112
|
-
if (!
|
|
113
|
-
style:
|
|
112
|
+
if (!f) return /* @__PURE__ */ L("div", {
|
|
113
|
+
style: S,
|
|
114
114
|
children: "Entity not found."
|
|
115
115
|
});
|
|
116
|
-
if (
|
|
117
|
-
style:
|
|
116
|
+
if (p.length === 0) return /* @__PURE__ */ L("div", {
|
|
117
|
+
style: S,
|
|
118
118
|
children: "No related records."
|
|
119
119
|
});
|
|
120
|
-
let
|
|
120
|
+
let w = D(a, d);
|
|
121
121
|
return /* @__PURE__ */ R("div", {
|
|
122
122
|
style: { padding: "8px 0" },
|
|
123
123
|
children: [
|
|
124
124
|
/* @__PURE__ */ R("table", {
|
|
125
|
-
style:
|
|
125
|
+
style: Re,
|
|
126
126
|
children: [/* @__PURE__ */ L("thead", { children: /* @__PURE__ */ L("tr", { children: ne.map((e) => /* @__PURE__ */ L("th", {
|
|
127
|
-
style:
|
|
128
|
-
children: ae(
|
|
129
|
-
}, e)) }) }), /* @__PURE__ */ L("tbody", { children:
|
|
130
|
-
let n =
|
|
127
|
+
style: Le,
|
|
128
|
+
children: ae(f.fields.get(e), e, a.entities)
|
|
129
|
+
}, e)) }) }), /* @__PURE__ */ L("tbody", { children: v.map((e, t) => /* @__PURE__ */ L("tr", { children: ne.map((t) => {
|
|
130
|
+
let n = f.fields.get(t);
|
|
131
131
|
return n ? /* @__PURE__ */ L("td", {
|
|
132
|
-
style:
|
|
133
|
-
children:
|
|
132
|
+
style: ze,
|
|
133
|
+
children: _({
|
|
134
134
|
field: n,
|
|
135
135
|
fieldName: t,
|
|
136
136
|
value: e[t],
|
|
137
137
|
mode: "display",
|
|
138
138
|
record: e,
|
|
139
|
-
refs:
|
|
140
|
-
locale:
|
|
139
|
+
refs: y,
|
|
140
|
+
locale: c
|
|
141
141
|
})
|
|
142
142
|
}, t) : /* @__PURE__ */ L("td", {}, t);
|
|
143
143
|
}) }, t)) })]
|
|
144
144
|
}),
|
|
145
|
-
|
|
145
|
+
w && u && u.count > v.length && /* @__PURE__ */ L("div", {
|
|
146
146
|
style: {
|
|
147
147
|
padding: "10px 16px",
|
|
148
148
|
textAlign: "center"
|
|
149
149
|
},
|
|
150
|
-
children: /* @__PURE__ */ R(
|
|
150
|
+
children: /* @__PURE__ */ R(o, {
|
|
151
151
|
icon: /* @__PURE__ */ L(e.external, { size: 12 }),
|
|
152
152
|
onClick: ie,
|
|
153
153
|
children: [
|
|
154
154
|
"View all ",
|
|
155
|
-
|
|
155
|
+
u.count,
|
|
156
156
|
" records"
|
|
157
157
|
]
|
|
158
158
|
})
|
|
159
159
|
}),
|
|
160
|
-
|
|
160
|
+
w && v.length > 0 && u && u.count <= v.length && /* @__PURE__ */ L("div", {
|
|
161
161
|
style: {
|
|
162
162
|
padding: "10px 16px",
|
|
163
163
|
textAlign: "center"
|
|
164
164
|
},
|
|
165
|
-
children: /* @__PURE__ */ L(
|
|
165
|
+
children: /* @__PURE__ */ L(o, {
|
|
166
166
|
kind: "ghost",
|
|
167
167
|
icon: /* @__PURE__ */ L(e.external, { size: 12 }),
|
|
168
168
|
onClick: ie,
|
|
@@ -174,7 +174,7 @@ function qe({ entityCode: t, recordId: n, assocKey: r, association: i, schema: s
|
|
|
174
174
|
}
|
|
175
175
|
//#endregion
|
|
176
176
|
//#region src/components/detail-layout/ErrorSummary.tsx
|
|
177
|
-
function
|
|
177
|
+
function Ze({ errors: t, onJump: n }) {
|
|
178
178
|
if (t.length === 0) return null;
|
|
179
179
|
let r = t.length !== 1;
|
|
180
180
|
return /* @__PURE__ */ R("div", {
|
|
@@ -261,7 +261,7 @@ function Je({ errors: t, onJump: n }) {
|
|
|
261
261
|
}
|
|
262
262
|
//#endregion
|
|
263
263
|
//#region src/components/shared/HighlightsStrip.tsx
|
|
264
|
-
function
|
|
264
|
+
function Qe({ items: e }) {
|
|
265
265
|
return e.length === 0 ? null : /* @__PURE__ */ L("div", {
|
|
266
266
|
style: {
|
|
267
267
|
display: "flex",
|
|
@@ -270,7 +270,7 @@ function Ye({ items: e }) {
|
|
|
270
270
|
gap: "6px 0",
|
|
271
271
|
fontSize: 12
|
|
272
272
|
},
|
|
273
|
-
children: e.map((e, t) => /* @__PURE__ */ R(
|
|
273
|
+
children: e.map((e, t) => /* @__PURE__ */ R(He, { children: [t > 0 && /* @__PURE__ */ L("span", { style: {
|
|
274
274
|
width: 1,
|
|
275
275
|
height: 12,
|
|
276
276
|
background: "var(--divider)",
|
|
@@ -297,20 +297,20 @@ function Ye({ items: e }) {
|
|
|
297
297
|
}
|
|
298
298
|
//#endregion
|
|
299
299
|
//#region src/components/detail-layout/DetailHighlights.tsx
|
|
300
|
-
function
|
|
300
|
+
function $e({ screen: e, entity: t, entityCode: n, record: i, refs: a, objectStatuses: o, schema: s, locale: c }) {
|
|
301
301
|
let l = e.highlights;
|
|
302
302
|
if (!l || l.length === 0) return null;
|
|
303
303
|
let u = [];
|
|
304
304
|
for (let e of l) {
|
|
305
305
|
let l = t.status_groups?.[e];
|
|
306
306
|
if (l) {
|
|
307
|
-
let t = o?.find((t) => t.group_code === e),
|
|
307
|
+
let t = o?.find((t) => t.group_code === e), n = t ? l.statuses.find((e) => e.code === t.status_code) : void 0;
|
|
308
308
|
u.push({
|
|
309
|
-
label:
|
|
310
|
-
value:
|
|
311
|
-
tone:
|
|
309
|
+
label: b(l.name),
|
|
310
|
+
value: n ? /* @__PURE__ */ L(r, {
|
|
311
|
+
tone: n.color ?? "slate",
|
|
312
312
|
size: "xs",
|
|
313
|
-
children:
|
|
313
|
+
children: b(n.name)
|
|
314
314
|
}) : /* @__PURE__ */ L("span", {
|
|
315
315
|
style: { color: "var(--text-4)" },
|
|
316
316
|
children: "—"
|
|
@@ -319,9 +319,9 @@ function Xe({ screen: e, entity: t, entityCode: r, record: i, refs: a, objectSta
|
|
|
319
319
|
continue;
|
|
320
320
|
}
|
|
321
321
|
if (t.fields.get(e) || t.files?.get(e)) {
|
|
322
|
-
let
|
|
322
|
+
let r = M({
|
|
323
323
|
entity: t,
|
|
324
|
-
entityCode:
|
|
324
|
+
entityCode: n,
|
|
325
325
|
fieldName: e,
|
|
326
326
|
record: i,
|
|
327
327
|
mode: "display",
|
|
@@ -332,21 +332,21 @@ function Xe({ screen: e, entity: t, entityCode: r, record: i, refs: a, objectSta
|
|
|
332
332
|
locale: c
|
|
333
333
|
});
|
|
334
334
|
u.push({
|
|
335
|
-
label:
|
|
336
|
-
value:
|
|
335
|
+
label: Ne(t, e, s.entities),
|
|
336
|
+
value: r
|
|
337
337
|
});
|
|
338
338
|
continue;
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
|
-
return u.length === 0 ? null : /* @__PURE__ */ L(
|
|
341
|
+
return u.length === 0 ? null : /* @__PURE__ */ L(Qe, { items: u });
|
|
342
342
|
}
|
|
343
343
|
//#endregion
|
|
344
344
|
//#region src/components/shared/AuditMetaStrip.tsx
|
|
345
|
-
function
|
|
345
|
+
function et(e) {
|
|
346
346
|
return e.by != null || e.at != null;
|
|
347
347
|
}
|
|
348
|
-
function
|
|
349
|
-
let t = e.filter(
|
|
348
|
+
function tt({ lines: e }) {
|
|
349
|
+
let t = e.filter(et);
|
|
350
350
|
return t.length === 0 ? null : /* @__PURE__ */ L("div", {
|
|
351
351
|
style: {
|
|
352
352
|
display: "flex",
|
|
@@ -359,10 +359,10 @@ function Qe({ lines: e }) {
|
|
|
359
359
|
fontSize: 11.5,
|
|
360
360
|
color: "var(--text-3)"
|
|
361
361
|
},
|
|
362
|
-
children: t.map((e, t) => /* @__PURE__ */ L(
|
|
362
|
+
children: t.map((e, t) => /* @__PURE__ */ L(nt, { line: e }, t))
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function nt({ line: e }) {
|
|
366
366
|
return /* @__PURE__ */ R("div", {
|
|
367
367
|
style: {
|
|
368
368
|
display: "flex",
|
|
@@ -404,13 +404,13 @@ function $e({ line: e }) {
|
|
|
404
404
|
}
|
|
405
405
|
//#endregion
|
|
406
406
|
//#region src/components/detail-layout/DetailAuditStrip.tsx
|
|
407
|
-
function
|
|
407
|
+
function rt({ screen: e, entity: t, entityCode: n, record: r, refs: i, schema: a, locale: o }) {
|
|
408
408
|
let s = e.audit;
|
|
409
409
|
if (s?.enabled === !1) return null;
|
|
410
410
|
let c = (e) => {
|
|
411
411
|
if (!e || !t.fields.get(e)) return;
|
|
412
412
|
let s = r[e];
|
|
413
|
-
if (!(s == null || s === "")) return
|
|
413
|
+
if (!(s == null || s === "")) return M({
|
|
414
414
|
entity: t,
|
|
415
415
|
entityCode: n,
|
|
416
416
|
fieldName: e,
|
|
@@ -423,8 +423,8 @@ function et({ screen: e, entity: t, entityCode: n, record: r, refs: i, schema: a
|
|
|
423
423
|
locale: o
|
|
424
424
|
});
|
|
425
425
|
};
|
|
426
|
-
return /* @__PURE__ */ L(
|
|
427
|
-
label:
|
|
426
|
+
return /* @__PURE__ */ L(tt, { lines: s?.lines && s.lines.length > 0 ? s.lines.map((e) => ({
|
|
427
|
+
label: b(e.label),
|
|
428
428
|
at: c(e.at),
|
|
429
429
|
by: c(e.by)
|
|
430
430
|
})) : [{
|
|
@@ -439,36 +439,36 @@ function et({ screen: e, entity: t, entityCode: n, record: r, refs: i, schema: a
|
|
|
439
439
|
}
|
|
440
440
|
//#endregion
|
|
441
441
|
//#region src/components/shared/RecordHeader.tsx
|
|
442
|
-
function
|
|
443
|
-
let
|
|
442
|
+
function it({ icon: t, avatarName: n, title: i, recordId: o, highlights: s, mode: c, dirty: l = !1, showBack: u = !1, onBack: d, right: f, showTitle: p = !0 }) {
|
|
443
|
+
let m = a(), h = m.category === "phone" || m.width <= 520;
|
|
444
444
|
return /* @__PURE__ */ R("div", {
|
|
445
445
|
style: {
|
|
446
446
|
display: "flex",
|
|
447
447
|
alignItems: "flex-start",
|
|
448
448
|
gap: 10,
|
|
449
|
-
flexWrap:
|
|
449
|
+
flexWrap: h ? "wrap" : "nowrap",
|
|
450
450
|
minWidth: 0
|
|
451
451
|
},
|
|
452
452
|
children: [
|
|
453
|
-
|
|
453
|
+
p && u && /* @__PURE__ */ L("div", {
|
|
454
454
|
style: {
|
|
455
455
|
paddingTop: 4,
|
|
456
456
|
flexShrink: 0
|
|
457
457
|
},
|
|
458
|
-
children: /* @__PURE__ */ L(
|
|
458
|
+
children: /* @__PURE__ */ L(ee, {
|
|
459
459
|
size: 26,
|
|
460
460
|
icon: /* @__PURE__ */ L(e.back, { size: 14 }),
|
|
461
461
|
title: "Back",
|
|
462
|
-
onClick:
|
|
462
|
+
onClick: d
|
|
463
463
|
})
|
|
464
464
|
}),
|
|
465
|
-
(
|
|
465
|
+
p && (n || t) && /* @__PURE__ */ L("div", {
|
|
466
466
|
style: {
|
|
467
467
|
flexShrink: 0,
|
|
468
468
|
paddingTop: 2
|
|
469
469
|
},
|
|
470
|
-
children:
|
|
471
|
-
name:
|
|
470
|
+
children: n ? /* @__PURE__ */ L(T, {
|
|
471
|
+
name: n,
|
|
472
472
|
size: 32
|
|
473
473
|
}) : /* @__PURE__ */ L("span", {
|
|
474
474
|
style: {
|
|
@@ -484,7 +484,7 @@ function z({ icon: t, avatarName: r, title: a, recordId: o, highlights: s, mode:
|
|
|
484
484
|
children: t
|
|
485
485
|
})
|
|
486
486
|
}),
|
|
487
|
-
/* @__PURE__ */ R("div", {
|
|
487
|
+
p && /* @__PURE__ */ R("div", {
|
|
488
488
|
style: {
|
|
489
489
|
flex: "1 1 0",
|
|
490
490
|
minWidth: 0
|
|
@@ -500,7 +500,7 @@ function z({ icon: t, avatarName: r, title: a, recordId: o, highlights: s, mode:
|
|
|
500
500
|
/* @__PURE__ */ L("h1", {
|
|
501
501
|
style: {
|
|
502
502
|
margin: 0,
|
|
503
|
-
fontSize:
|
|
503
|
+
fontSize: "var(--font-size-page-title, 19px)",
|
|
504
504
|
fontWeight: 600,
|
|
505
505
|
letterSpacing: 0,
|
|
506
506
|
lineHeight: 1.2,
|
|
@@ -508,11 +508,11 @@ function z({ icon: t, avatarName: r, title: a, recordId: o, highlights: s, mode:
|
|
|
508
508
|
minWidth: 0,
|
|
509
509
|
overflow: "hidden",
|
|
510
510
|
textOverflow: "ellipsis",
|
|
511
|
-
whiteSpace:
|
|
511
|
+
whiteSpace: h ? "normal" : "nowrap",
|
|
512
512
|
overflowWrap: "anywhere",
|
|
513
513
|
maxWidth: "100%"
|
|
514
514
|
},
|
|
515
|
-
children:
|
|
515
|
+
children: i
|
|
516
516
|
}),
|
|
517
517
|
o && /* @__PURE__ */ L(E, { value: o }),
|
|
518
518
|
c === "edit" && l && /* @__PURE__ */ R("span", {
|
|
@@ -530,7 +530,7 @@ function z({ icon: t, avatarName: r, title: a, recordId: o, highlights: s, mode:
|
|
|
530
530
|
background: "var(--warn)"
|
|
531
531
|
} }), "Unsaved"]
|
|
532
532
|
}),
|
|
533
|
-
c === "create" && /* @__PURE__ */ L(
|
|
533
|
+
c === "create" && /* @__PURE__ */ L(r, {
|
|
534
534
|
tone: "violet",
|
|
535
535
|
size: "xs",
|
|
536
536
|
dot: !0,
|
|
@@ -549,9 +549,9 @@ function z({ icon: t, avatarName: r, title: a, recordId: o, highlights: s, mode:
|
|
|
549
549
|
display: "flex",
|
|
550
550
|
alignItems: "center",
|
|
551
551
|
gap: 6,
|
|
552
|
-
flex:
|
|
552
|
+
flex: h ? "1 1 100%" : "0 0 auto",
|
|
553
553
|
flexWrap: "wrap",
|
|
554
|
-
justifyContent:
|
|
554
|
+
justifyContent: h ? "flex-start" : "flex-end",
|
|
555
555
|
minWidth: 0
|
|
556
556
|
},
|
|
557
557
|
children: f
|
|
@@ -561,7 +561,7 @@ function z({ icon: t, avatarName: r, title: a, recordId: o, highlights: s, mode:
|
|
|
561
561
|
}
|
|
562
562
|
//#endregion
|
|
563
563
|
//#region src/lib/children-validation.ts
|
|
564
|
-
function
|
|
564
|
+
function at(e, t, n) {
|
|
565
565
|
let r = [];
|
|
566
566
|
for (let [i, a] of e.fields) {
|
|
567
567
|
if (!a.required || a.auto || n && a.primary || e.tenant_key && i === e.tenant_key || a.default !== void 0 && a.default !== null) continue;
|
|
@@ -570,17 +570,17 @@ function tt(e, t, n) {
|
|
|
570
570
|
}
|
|
571
571
|
return r;
|
|
572
572
|
}
|
|
573
|
-
var
|
|
574
|
-
function
|
|
573
|
+
var ot = /^[^@\s]+@[^@\s]+\.[^@\s]+$/;
|
|
574
|
+
function st(e, t) {
|
|
575
575
|
let n = [];
|
|
576
576
|
for (let [r, i] of e.fields) {
|
|
577
577
|
if (i.type !== "email") continue;
|
|
578
578
|
let e = t[r];
|
|
579
|
-
typeof e == "string" && e !== "" && !
|
|
579
|
+
typeof e == "string" && e !== "" && !ot.test(e) && n.push(r);
|
|
580
580
|
}
|
|
581
581
|
return n;
|
|
582
582
|
}
|
|
583
|
-
function
|
|
583
|
+
function z(e, t) {
|
|
584
584
|
let n = /* @__PURE__ */ new Set();
|
|
585
585
|
for (let r of Object.values(t.entities)) if (r.children) {
|
|
586
586
|
for (let t of r.children) if (t.entity === e && t.foreign_key) {
|
|
@@ -590,13 +590,13 @@ function B(e, t) {
|
|
|
590
590
|
}
|
|
591
591
|
return n;
|
|
592
592
|
}
|
|
593
|
-
function
|
|
593
|
+
function ct(e, t) {
|
|
594
594
|
if (!e || !t) return {};
|
|
595
595
|
let n = {};
|
|
596
596
|
for (let [r, i] of Object.entries(e)) {
|
|
597
597
|
let e = t.entities[r];
|
|
598
598
|
if (!e) continue;
|
|
599
|
-
let a =
|
|
599
|
+
let a = z(r, t), o = [];
|
|
600
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
601
|
if (o.length !== 0) for (let e of i) {
|
|
602
602
|
if (e._deleted) continue;
|
|
@@ -612,34 +612,34 @@ function it(e, t) {
|
|
|
612
612
|
}
|
|
613
613
|
//#endregion
|
|
614
614
|
//#region src/components/pages/SmartDetailPage.impl.tsx
|
|
615
|
-
var
|
|
616
|
-
function
|
|
615
|
+
var lt = () => {};
|
|
616
|
+
function ut(e, t) {
|
|
617
617
|
return e.length === t.length ? JSON.stringify(e) === JSON.stringify(t) : !1;
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function dt(e, t) {
|
|
620
620
|
if (e) {
|
|
621
|
-
let n =
|
|
621
|
+
let n = oe(ne(e, t));
|
|
622
622
|
if (n.replace(/^\|+|\|+$/g, "")) return n;
|
|
623
623
|
}
|
|
624
624
|
return t.id == null ? crypto.randomUUID() : h(t.id);
|
|
625
625
|
}
|
|
626
|
-
function
|
|
627
|
-
return /* @__PURE__ */ L(m, { children: /* @__PURE__ */ L(
|
|
626
|
+
function ft({ screenCode: e }) {
|
|
627
|
+
return /* @__PURE__ */ L(m, { children: /* @__PURE__ */ L(B, { screenCode: e }) });
|
|
628
628
|
}
|
|
629
|
-
function
|
|
630
|
-
let { id: n } =
|
|
629
|
+
function B({ screenCode: t }) {
|
|
630
|
+
let { id: n } = Ge(), r = ce(), [o, m] = Ke(), { data: h } = ie(), te = v((e) => e.user), _ = se(), y = a(), x = h?.screens[t], S = x?.entity ? h?.entities[x.entity] : void 0, C = x?.entity, T = w(S, "create"), E = w(S, "update"), fe = w(S, "delete"), me = w(S, "restore"), _e = (() => {
|
|
631
631
|
if (!S || !S.singleton || !S.prefilter) return;
|
|
632
632
|
let e = d(S);
|
|
633
633
|
if (e.length !== 1) return;
|
|
634
634
|
let t = S.prefilter[e[0]];
|
|
635
|
-
if (t === "$caller.user_id") return
|
|
636
|
-
if (t === "$caller.tenant_id") return
|
|
637
|
-
})(), D =
|
|
635
|
+
if (t === "$caller.user_id") return te?.id;
|
|
636
|
+
if (t === "$caller.tenant_id") return te?.tenant?.id;
|
|
637
|
+
})(), D = _e !== void 0, O = D ? _e : n, k = !D && O === "new", j = F(() => {
|
|
638
638
|
if (!O || k) return;
|
|
639
639
|
if (!S) return O;
|
|
640
640
|
let e = d(S);
|
|
641
641
|
if (e.length === 1) return { [e[0]]: O };
|
|
642
|
-
let t =
|
|
642
|
+
let t = p(O, e.length);
|
|
643
643
|
if (!t) return;
|
|
644
644
|
let n = {};
|
|
645
645
|
for (let r = 0; r < e.length; r++) n[e[r]] = t[r] ?? "";
|
|
@@ -648,18 +648,18 @@ function V({ screenCode: t }) {
|
|
|
648
648
|
O,
|
|
649
649
|
k,
|
|
650
650
|
S
|
|
651
|
-
]),
|
|
652
|
-
if (
|
|
653
|
-
}, [
|
|
654
|
-
|
|
655
|
-
let
|
|
656
|
-
|
|
657
|
-
let [
|
|
658
|
-
let e = parseInt(
|
|
651
|
+
]), De = F(() => {
|
|
652
|
+
if (j) return typeof j == "string" ? j : oe(j);
|
|
653
|
+
}, [j]), M = Ee(C, j), { data: Ne, isLoading: Ie, error: Le } = M, Re = je((e) => e.degradedEntities), ze = C ? be(S?.realtime, Re, C) : !1;
|
|
654
|
+
le(ke(C, j), !k);
|
|
655
|
+
let He = ye(C ?? ""), qe = ve(C ?? ""), Xe = Se(C ?? ""), Qe = Ce(C ?? ""), et = Object.keys(S?.status_groups ?? {}).length > 0, tt = Ne?.data, nt = tt?.$statuses, it = tt?.$properties, ot = o.get("edit") === "true", [z, ft] = I(k || ot), [B, V] = I({}), [H, ht] = I({}), [U, gt] = I({}), [W, G] = I(void 0), [_t, vt] = I(!1), [yt, K] = I(void 0), [bt, xt] = I({ show: !1 }), [St, Ct] = I(!1), wt = k ? T : E, q = z && wt, Tt = s();
|
|
656
|
+
c(q && !k, Tt.enabled);
|
|
657
|
+
let [Et, Dt] = I(() => {
|
|
658
|
+
let e = parseInt(x?.sidebar_width || "380", 10);
|
|
659
659
|
return isNaN(e) ? 380 : e;
|
|
660
|
-
}),
|
|
660
|
+
}), Ot = Ue(null), J = Ue(null), kt = N((e) => {
|
|
661
661
|
e.preventDefault();
|
|
662
|
-
let t =
|
|
662
|
+
let t = Ot.current;
|
|
663
663
|
if (!t) return;
|
|
664
664
|
let n = t.offsetWidth;
|
|
665
665
|
J.current = {
|
|
@@ -671,28 +671,28 @@ function V({ screenCode: t }) {
|
|
|
671
671
|
let n = J.current.startX - e.clientX, r = Math.max(280, Math.min(800, J.current.startW + n));
|
|
672
672
|
t.style.width = `${r}px`;
|
|
673
673
|
}, i = () => {
|
|
674
|
-
J.current && t &&
|
|
674
|
+
J.current && t && Dt(parseInt(t.style.width, 10) || J.current.startW), J.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
|
|
675
675
|
};
|
|
676
676
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", i);
|
|
677
|
-
}, []), Y =
|
|
678
|
-
|
|
677
|
+
}, []), Y = Ne?.data, X = typeof Y?.$row_version == "string" ? Y.$row_version : void 0, At = Y?.$refs, jt = Ue(X);
|
|
678
|
+
P(() => {
|
|
679
679
|
if (!X) return;
|
|
680
|
-
let e =
|
|
681
|
-
|
|
680
|
+
let e = jt.current;
|
|
681
|
+
jt.current = X, e && e !== X && z && vt(!0);
|
|
682
682
|
}, [z, X]);
|
|
683
|
-
let
|
|
684
|
-
|
|
685
|
-
let
|
|
686
|
-
|
|
687
|
-
if (!
|
|
688
|
-
let e =
|
|
689
|
-
|
|
690
|
-
}, [
|
|
691
|
-
let { openTab:
|
|
692
|
-
|
|
693
|
-
if (!S || D ||
|
|
694
|
-
let e = Z.pathname, t = x
|
|
695
|
-
|
|
683
|
+
let Mt = !!S?.soft_delete, Nt = Mt && Y != null && Y[S.soft_delete] != null, Z = We(), Pt = Ue(null);
|
|
684
|
+
pe({ scrollElementRef: Pt });
|
|
685
|
+
let Ft = !k && Le instanceof l && Le.status === 404, It = Ue(null);
|
|
686
|
+
P(() => {
|
|
687
|
+
if (!Ft) return;
|
|
688
|
+
let e = ue(Z);
|
|
689
|
+
It.current !== e && (It.current = e, he.getState().kill(e));
|
|
690
|
+
}, [Ft, Z]);
|
|
691
|
+
let { openTab: Lt, updateTabTitle: Rt, findTabByPathname: zt } = Pe();
|
|
692
|
+
P(() => {
|
|
693
|
+
if (!S || D || Tt.enabled) return;
|
|
694
|
+
let e = Z.pathname, t = b(x?.display?.name) || b(S.display.name), n = x?.display?.icon || S.display.icon;
|
|
695
|
+
zt(e) || Lt({
|
|
696
696
|
pathname: e,
|
|
697
697
|
search: "",
|
|
698
698
|
title: k ? `New ${t}` : t,
|
|
@@ -701,19 +701,19 @@ function V({ screenCode: t }) {
|
|
|
701
701
|
});
|
|
702
702
|
}, [
|
|
703
703
|
Z.pathname,
|
|
704
|
-
|
|
704
|
+
x?.display?.name?.en,
|
|
705
705
|
S?.display.name?.en,
|
|
706
|
-
|
|
706
|
+
x?.display?.icon,
|
|
707
707
|
S?.display.icon,
|
|
708
708
|
k,
|
|
709
709
|
D,
|
|
710
|
-
|
|
711
|
-
]),
|
|
712
|
-
if (!Y || !S || D ||
|
|
713
|
-
let e =
|
|
710
|
+
Tt.enabled
|
|
711
|
+
]), P(() => {
|
|
712
|
+
if (!Y || !S || D || Tt.enabled) return;
|
|
713
|
+
let e = zt(Z.pathname);
|
|
714
714
|
if (e) {
|
|
715
|
-
let t = x
|
|
716
|
-
|
|
715
|
+
let t = b(x?.display?.name) || b(S.display.name), n = g(Y, S), r = n && !String(n).startsWith("/") ? String(n) : t;
|
|
716
|
+
Rt(e.id, r);
|
|
717
717
|
}
|
|
718
718
|
}, [
|
|
719
719
|
Y,
|
|
@@ -721,20 +721,20 @@ function V({ screenCode: t }) {
|
|
|
721
721
|
S?.display.display_field,
|
|
722
722
|
Z.pathname,
|
|
723
723
|
D,
|
|
724
|
-
|
|
724
|
+
Tt.enabled
|
|
725
725
|
]);
|
|
726
|
-
let
|
|
727
|
-
if (!S || !
|
|
726
|
+
let Bt = F(() => {
|
|
727
|
+
if (!S || !wt) return /* @__PURE__ */ new Set();
|
|
728
728
|
let e = /* @__PURE__ */ new Set();
|
|
729
729
|
for (let [t, n] of S.fields) !n.auto && !n.primary && e.add(t);
|
|
730
730
|
for (let [t] of S.files ?? []) e.add(t);
|
|
731
731
|
return e;
|
|
732
|
-
}, [S,
|
|
733
|
-
|
|
734
|
-
if (!(
|
|
735
|
-
if (z ||
|
|
736
|
-
let e = O ?
|
|
737
|
-
e &&
|
|
732
|
+
}, [S, wt]);
|
|
733
|
+
P(() => {
|
|
734
|
+
if (!(!ot || !Y || !S || !E)) {
|
|
735
|
+
if (z || ft(!0), Object.keys(B).length === 0) {
|
|
736
|
+
let e = O ? de(O) : null;
|
|
737
|
+
e && we(A({
|
|
738
738
|
entity: S,
|
|
739
739
|
formData: e,
|
|
740
740
|
record: void 0,
|
|
@@ -742,115 +742,115 @@ function V({ screenCode: t }) {
|
|
|
742
742
|
})).forEach((e) => {
|
|
743
743
|
_.registerDraft({
|
|
744
744
|
fileId: e,
|
|
745
|
-
discard: () =>
|
|
745
|
+
discard: () => f(e)
|
|
746
746
|
});
|
|
747
747
|
});
|
|
748
748
|
let t = {};
|
|
749
|
-
|
|
749
|
+
Bt.forEach((n) => {
|
|
750
750
|
let r = e ? e[n] : void 0;
|
|
751
751
|
if (r !== void 0) {
|
|
752
752
|
t[n] = r;
|
|
753
753
|
return;
|
|
754
754
|
}
|
|
755
|
-
let i =
|
|
756
|
-
t[n] =
|
|
757
|
-
}),
|
|
755
|
+
let i = ge(S, Y, n);
|
|
756
|
+
t[n] = xe(S, n) ? i ?? null : i ?? "";
|
|
757
|
+
}), V(t);
|
|
758
758
|
}
|
|
759
759
|
if (S.children !== void 0 && S.children.length > 0 && W === void 0) {
|
|
760
760
|
let e = Y.$children;
|
|
761
761
|
if (e && Object.keys(e).length > 0) {
|
|
762
762
|
let t = {};
|
|
763
763
|
for (let [n, r] of Object.entries(e)) {
|
|
764
|
-
let e =
|
|
764
|
+
let e = h?.entities[n];
|
|
765
765
|
t[n] = r.map((t) => ({
|
|
766
766
|
...t,
|
|
767
|
-
_key:
|
|
767
|
+
_key: dt(e, t)
|
|
768
768
|
}));
|
|
769
769
|
}
|
|
770
770
|
G(t), K(e);
|
|
771
771
|
} else G({}), K({});
|
|
772
772
|
}
|
|
773
|
-
|
|
773
|
+
m((e) => {
|
|
774
774
|
let t = new URLSearchParams(e);
|
|
775
775
|
return t.delete("edit"), t;
|
|
776
776
|
}, { replace: !0 });
|
|
777
777
|
}
|
|
778
778
|
}, [
|
|
779
|
-
|
|
779
|
+
ot,
|
|
780
780
|
Y,
|
|
781
|
-
|
|
781
|
+
Bt,
|
|
782
782
|
E,
|
|
783
783
|
S,
|
|
784
784
|
W,
|
|
785
|
-
|
|
786
|
-
]),
|
|
785
|
+
h
|
|
786
|
+
]), P(() => {
|
|
787
787
|
!k || !T || !S?.children || S.children.length === 0 || W === void 0 && (G({}), K({}));
|
|
788
788
|
}, [
|
|
789
789
|
k,
|
|
790
790
|
T,
|
|
791
791
|
S?.children
|
|
792
792
|
]);
|
|
793
|
-
let
|
|
794
|
-
await _.flushAllDrafts(), k ?
|
|
793
|
+
let Vt = N(async () => {
|
|
794
|
+
await _.flushAllDrafts(), k ? r(x?.route?.replace("/:id", "") ?? "/") : (ft(!1), V({}), ht({}), gt({}), G(void 0), K(void 0), Ct(!1));
|
|
795
795
|
}, [
|
|
796
796
|
_,
|
|
797
797
|
k,
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
]),
|
|
801
|
-
|
|
798
|
+
x,
|
|
799
|
+
r
|
|
800
|
+
]), Ht = N((e, t) => {
|
|
801
|
+
V((n) => ({
|
|
802
802
|
...n,
|
|
803
803
|
[e]: t
|
|
804
804
|
}));
|
|
805
|
-
}, []), Q =
|
|
806
|
-
if (!
|
|
807
|
-
let e =
|
|
805
|
+
}, []), Q = F(() => {
|
|
806
|
+
if (!x?.route) return "/";
|
|
807
|
+
let e = x.route.split("/");
|
|
808
808
|
return e.pop(), e.join("/") || "/";
|
|
809
|
-
}, [
|
|
810
|
-
if (!
|
|
811
|
-
|
|
809
|
+
}, [x]), Ut = F(() => !h?.screens || !Q || Q === "/" ? !1 : Object.values(h.screens).some((e) => e.route === Q), [h, Q]), Wt = Te({ fallback: N(() => {
|
|
810
|
+
if (!Ut) {
|
|
811
|
+
r("/");
|
|
812
812
|
return;
|
|
813
813
|
}
|
|
814
|
-
let e =
|
|
815
|
-
|
|
814
|
+
let e = zt(Q)?.search ?? "";
|
|
815
|
+
r(e ? `${Q}?${e}` : Q);
|
|
816
816
|
}, [
|
|
817
|
-
|
|
817
|
+
Ut,
|
|
818
818
|
Q,
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
]) }),
|
|
819
|
+
zt,
|
|
820
|
+
r
|
|
821
|
+
]) }), Gt = !D && (Wt.hasOriginBack || Wt.allowFallbackBack && !!Ut), Kt = re(), qt = F(() => {
|
|
822
822
|
if (!S) return {};
|
|
823
823
|
let e = {};
|
|
824
|
-
for (let t of
|
|
825
|
-
for (let t of
|
|
824
|
+
for (let t of at(S, B, k)) Bt.has(t) && (e[t] = "Required");
|
|
825
|
+
for (let t of st(S, B)) Bt.has(t) && (e[t] = "Invalid email address");
|
|
826
826
|
return e;
|
|
827
827
|
}, [
|
|
828
828
|
S,
|
|
829
829
|
B,
|
|
830
830
|
k,
|
|
831
|
-
|
|
832
|
-
]),
|
|
833
|
-
if (!
|
|
834
|
-
let e = {}, t =
|
|
831
|
+
Bt
|
|
832
|
+
]), Jt = Object.keys(qt).length > 0, Yt = N(() => {
|
|
833
|
+
if (!C || !S || k && !T || !k && !E || (Ct(!0), Jt)) return;
|
|
834
|
+
let e = {}, t = A({
|
|
835
835
|
entity: S,
|
|
836
836
|
formData: B,
|
|
837
837
|
record: Y,
|
|
838
838
|
isNew: k
|
|
839
|
-
}), n =
|
|
839
|
+
}), n = we(t);
|
|
840
840
|
if (k) for (let [t, n] of Object.entries(B)) {
|
|
841
841
|
if (S.files?.has(t)) continue;
|
|
842
|
-
let r =
|
|
842
|
+
let r = Ae(S, t, n);
|
|
843
843
|
r !== "" && r != null && (e[t] = r);
|
|
844
844
|
}
|
|
845
845
|
else {
|
|
846
846
|
for (let [t, n] of Object.entries(B)) {
|
|
847
847
|
if (S.files?.has(t)) continue;
|
|
848
|
-
let r = Y ?
|
|
848
|
+
let r = Y ? ge(S, Y, t) : void 0, i = Ae(S, t, n), a = Ae(S, t, r);
|
|
849
849
|
(i === "" ? null : i) !== (a === "" || a === void 0 ? null : a) && (e[t] = i);
|
|
850
850
|
}
|
|
851
851
|
X && (e.$row_version = X);
|
|
852
852
|
}
|
|
853
|
-
if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(
|
|
853
|
+
if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(H).length > 0 && (e.$statuses = Object.entries(H).map(([e, t]) => ({
|
|
854
854
|
status_group_code: e,
|
|
855
855
|
status_code: t
|
|
856
856
|
}))), Object.keys(U).length > 0 && (e.$properties = Object.entries(U).map(([e, t]) => ({
|
|
@@ -862,31 +862,31 @@ function V({ screenCode: t }) {
|
|
|
862
862
|
let r = n.filter((e) => !e._deleted).map((e) => {
|
|
863
863
|
let { _key: t, _deleted: n, _dirty: r, ...i } = e;
|
|
864
864
|
return i;
|
|
865
|
-
}), i =
|
|
866
|
-
(k || !
|
|
865
|
+
}), i = yt?.[e] ?? [];
|
|
866
|
+
(k || !ut(r, i)) && (t[e] = r);
|
|
867
867
|
}
|
|
868
868
|
Object.keys(t).length > 0 && (e.$children = t);
|
|
869
869
|
}
|
|
870
870
|
if (!k && Object.keys(e).length === 0) {
|
|
871
|
-
|
|
871
|
+
ft(!1), ht({}), gt({}), G(void 0), K(void 0), Ct(!1);
|
|
872
872
|
return;
|
|
873
873
|
}
|
|
874
|
-
let
|
|
875
|
-
|
|
874
|
+
let i = () => {
|
|
875
|
+
ft(!1), vt(!1), Ct(!1), ht({}), gt({}), G(void 0), K(void 0);
|
|
876
876
|
};
|
|
877
|
-
k ?
|
|
877
|
+
k ? He.mutate(e, { onSuccess: (e) => {
|
|
878
878
|
n.forEach((e) => _.markCommitted(e));
|
|
879
|
-
let t = e.data,
|
|
880
|
-
a
|
|
881
|
-
} }) :
|
|
882
|
-
pkValues:
|
|
879
|
+
let t = e.data, a = oe(S ? ne(S, t) : {});
|
|
880
|
+
r(a ? `${Q}/${encodeURIComponent(a)}` : Q, { replace: !0 }), i();
|
|
881
|
+
} }) : j && qe.mutate({
|
|
882
|
+
pkValues: j,
|
|
883
883
|
data: e
|
|
884
884
|
}, {
|
|
885
885
|
onSuccess: () => {
|
|
886
|
-
n.forEach((e) => _.markCommitted(e)),
|
|
886
|
+
n.forEach((e) => _.markCommitted(e)), i();
|
|
887
887
|
},
|
|
888
888
|
onError: (e) => {
|
|
889
|
-
e instanceof
|
|
889
|
+
e instanceof l && e.code === "STALE_OBJECT" && vt(!0);
|
|
890
890
|
}
|
|
891
891
|
});
|
|
892
892
|
}, [
|
|
@@ -894,49 +894,49 @@ function V({ screenCode: t }) {
|
|
|
894
894
|
k,
|
|
895
895
|
T,
|
|
896
896
|
E,
|
|
897
|
-
|
|
897
|
+
C,
|
|
898
898
|
B,
|
|
899
|
-
|
|
900
|
-
|
|
899
|
+
Jt,
|
|
900
|
+
H,
|
|
901
901
|
U,
|
|
902
902
|
W,
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
903
|
+
yt,
|
|
904
|
+
He,
|
|
905
|
+
qe,
|
|
906
906
|
S,
|
|
907
|
-
|
|
907
|
+
r,
|
|
908
908
|
Q,
|
|
909
909
|
Y,
|
|
910
910
|
X,
|
|
911
|
-
|
|
912
|
-
]),
|
|
911
|
+
j
|
|
912
|
+
]), Xt = N((e, t) => {
|
|
913
913
|
G((n) => ({
|
|
914
914
|
...n ?? {},
|
|
915
915
|
[e]: t
|
|
916
916
|
}));
|
|
917
|
-
}, []),
|
|
918
|
-
!
|
|
919
|
-
|
|
917
|
+
}, []), Zt = N(() => {
|
|
918
|
+
!j || k || !fe || Xe.mutate(j, { onSuccess: () => {
|
|
919
|
+
he.getState().kill(ue(Z)), r(Q, { replace: !0 });
|
|
920
920
|
} });
|
|
921
921
|
}, [
|
|
922
|
-
|
|
922
|
+
j,
|
|
923
923
|
k,
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
924
|
+
fe,
|
|
925
|
+
Xe,
|
|
926
|
+
r,
|
|
927
927
|
Q,
|
|
928
928
|
Z
|
|
929
|
-
]),
|
|
930
|
-
!
|
|
929
|
+
]), Qt = N(() => {
|
|
930
|
+
!j || k || !me || Qe.mutate(j);
|
|
931
931
|
}, [
|
|
932
|
-
|
|
932
|
+
j,
|
|
933
933
|
k,
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
]),
|
|
937
|
-
if (!
|
|
938
|
-
if (!k &&
|
|
939
|
-
if (!k && !Y ||
|
|
934
|
+
me,
|
|
935
|
+
Qe
|
|
936
|
+
]), $t = F(() => ct(W, h), [W, h]), en = Object.keys($t).length > 0;
|
|
937
|
+
if (!x || !S) return null;
|
|
938
|
+
if (!k && Ie) return /* @__PURE__ */ L(Fe, {});
|
|
939
|
+
if (!k && !Y || Ft) return /* @__PURE__ */ R("div", {
|
|
940
940
|
style: { padding: 24 },
|
|
941
941
|
children: [/* @__PURE__ */ R("div", {
|
|
942
942
|
style: {
|
|
@@ -945,9 +945,9 @@ function V({ screenCode: t }) {
|
|
|
945
945
|
gap: 8,
|
|
946
946
|
marginBottom: 8
|
|
947
947
|
},
|
|
948
|
-
children: [
|
|
948
|
+
children: [Gt && /* @__PURE__ */ L(ee, {
|
|
949
949
|
icon: /* @__PURE__ */ L(e.back, { size: 14 }),
|
|
950
|
-
onClick:
|
|
950
|
+
onClick: Wt.goBack,
|
|
951
951
|
title: "Back"
|
|
952
952
|
}), /* @__PURE__ */ L("h1", {
|
|
953
953
|
style: {
|
|
@@ -963,24 +963,24 @@ function V({ screenCode: t }) {
|
|
|
963
963
|
children: "Record not found."
|
|
964
964
|
})]
|
|
965
965
|
});
|
|
966
|
-
let
|
|
966
|
+
let tn = S.display, nn = b(x.display?.name) || b(tn.name), rn = g(Y, S), an = k ? `New ${nn}` : rn ? String(rn) : nn, on = He.isPending || qe.isPending, sn = x.responsive?.[y.category]?.layout, cn = sn?.tabs ?? (y.isPhone ? "sections" : void 0), ln = sn?.header_card === !0 ? Me({
|
|
967
967
|
entity: S,
|
|
968
|
-
screen:
|
|
968
|
+
screen: x
|
|
969
969
|
}) : void 0, $ = {
|
|
970
|
-
schema:
|
|
970
|
+
schema: h,
|
|
971
971
|
entity: S,
|
|
972
|
-
entityCode:
|
|
973
|
-
recordId:
|
|
972
|
+
entityCode: C,
|
|
973
|
+
recordId: De ?? O ?? "",
|
|
974
974
|
record: q ? {
|
|
975
975
|
...Y ?? {},
|
|
976
976
|
...B
|
|
977
977
|
} : Y ?? {},
|
|
978
978
|
isNew: k,
|
|
979
979
|
mode: q ? "edit" : "display",
|
|
980
|
-
onFieldChange: q ?
|
|
981
|
-
refs:
|
|
980
|
+
onFieldChange: q ? Ht : void 0,
|
|
981
|
+
refs: At,
|
|
982
982
|
objectProperties: (() => {
|
|
983
|
-
let e =
|
|
983
|
+
let e = it ?? [];
|
|
984
984
|
if (!q || Object.keys(U).length === 0) return e.length > 0 ? e : void 0;
|
|
985
985
|
let t = e.map((e) => U[e.property_code] === void 0 ? e : {
|
|
986
986
|
...e,
|
|
@@ -994,73 +994,80 @@ function V({ screenCode: t }) {
|
|
|
994
994
|
});
|
|
995
995
|
return t;
|
|
996
996
|
})(),
|
|
997
|
-
onSetProperty: k || !E ? void 0 : q ? (e, t) =>
|
|
997
|
+
onSetProperty: k || !E ? void 0 : q ? (e, t) => gt((n) => ({
|
|
998
998
|
...n,
|
|
999
999
|
[e]: t
|
|
1000
1000
|
})) : void 0,
|
|
1001
1001
|
isPropertyPending: !1,
|
|
1002
1002
|
objectStatuses: (() => {
|
|
1003
|
-
let e =
|
|
1004
|
-
if (!q || Object.keys(
|
|
1005
|
-
let t = e.map((e) =>
|
|
1003
|
+
let e = nt ?? [];
|
|
1004
|
+
if (!q || Object.keys(H).length === 0) return e.length > 0 ? e : void 0;
|
|
1005
|
+
let t = e.map((e) => H[e.group_code] === void 0 ? e : {
|
|
1006
1006
|
...e,
|
|
1007
|
-
status_code:
|
|
1007
|
+
status_code: H[e.group_code]
|
|
1008
1008
|
});
|
|
1009
|
-
for (let [n,
|
|
1009
|
+
for (let [n, r] of Object.entries(H)) e.some((e) => e.group_code === n) || t.push({
|
|
1010
1010
|
group_code: n,
|
|
1011
|
-
status_code:
|
|
1011
|
+
status_code: r,
|
|
1012
1012
|
status_name: {},
|
|
1013
|
-
set_at:
|
|
1013
|
+
set_at: i()
|
|
1014
1014
|
});
|
|
1015
1015
|
return t;
|
|
1016
1016
|
})(),
|
|
1017
|
-
onSetStatus: k || !E ? void 0 : q ? (e, t) =>
|
|
1017
|
+
onSetStatus: k || !E ? void 0 : q ? (e, t) => ht((n) => ({
|
|
1018
1018
|
...n,
|
|
1019
1019
|
[e]: t
|
|
1020
1020
|
})) : void 0,
|
|
1021
1021
|
isStatusPending: !1,
|
|
1022
1022
|
pendingChildren: q ? W : void 0,
|
|
1023
|
-
onChildrenChange: q ?
|
|
1024
|
-
childValidationErrors: q ?
|
|
1025
|
-
fieldErrors: q &&
|
|
1026
|
-
detailTabsPresentation:
|
|
1027
|
-
relatedRecordsPresentation:
|
|
1028
|
-
},
|
|
1029
|
-
screen:
|
|
1023
|
+
onChildrenChange: q ? Xt : void 0,
|
|
1024
|
+
childValidationErrors: q ? $t : void 0,
|
|
1025
|
+
fieldErrors: q && St ? qt : void 0,
|
|
1026
|
+
detailTabsPresentation: cn,
|
|
1027
|
+
relatedRecordsPresentation: sn?.related_records
|
|
1028
|
+
}, un = !!x.sidebar && x.sidebar.length > 0, dn = sn?.sidebar === "hidden", fn = un && !dn && !y.isDesktop, pn = un && !dn && y.isDesktop, mn = !k && Y ? /* @__PURE__ */ L($e, {
|
|
1029
|
+
screen: x,
|
|
1030
1030
|
entity: S,
|
|
1031
|
-
entityCode:
|
|
1031
|
+
entityCode: C,
|
|
1032
1032
|
record: Y,
|
|
1033
|
-
refs:
|
|
1034
|
-
objectStatuses:
|
|
1035
|
-
schema:
|
|
1036
|
-
locale:
|
|
1037
|
-
}) : void 0,
|
|
1038
|
-
title:
|
|
1033
|
+
refs: At,
|
|
1034
|
+
objectStatuses: nt,
|
|
1035
|
+
schema: h,
|
|
1036
|
+
locale: Kt
|
|
1037
|
+
}) : void 0, hn = /* @__PURE__ */ L(mt, {
|
|
1038
|
+
title: an,
|
|
1039
1039
|
recordId: O,
|
|
1040
1040
|
editing: q,
|
|
1041
1041
|
isNew: k,
|
|
1042
|
-
isRecordDeleted:
|
|
1042
|
+
isRecordDeleted: Nt,
|
|
1043
1043
|
dirty: z,
|
|
1044
|
-
isSaving:
|
|
1045
|
-
hasChildErrors:
|
|
1046
|
-
hasFieldErrors:
|
|
1047
|
-
canRestore:
|
|
1044
|
+
isSaving: on,
|
|
1045
|
+
hasChildErrors: en,
|
|
1046
|
+
hasFieldErrors: St && Jt,
|
|
1047
|
+
canRestore: me,
|
|
1048
1048
|
entity: S,
|
|
1049
|
-
screen:
|
|
1050
|
-
globalActions:
|
|
1051
|
-
entityCode:
|
|
1049
|
+
screen: x,
|
|
1050
|
+
globalActions: h?.actions,
|
|
1051
|
+
entityCode: C,
|
|
1052
1052
|
record: Y,
|
|
1053
1053
|
id: O,
|
|
1054
1054
|
listRoute: Q,
|
|
1055
|
-
listRouteExists: !!
|
|
1056
|
-
highlights:
|
|
1057
|
-
showBack:
|
|
1058
|
-
onBack:
|
|
1059
|
-
onCancelEdit:
|
|
1060
|
-
onSave:
|
|
1061
|
-
onRestore:
|
|
1062
|
-
isRestoring:
|
|
1063
|
-
|
|
1055
|
+
listRouteExists: !!Ut,
|
|
1056
|
+
highlights: mn,
|
|
1057
|
+
showBack: Gt,
|
|
1058
|
+
onBack: Wt.goBack,
|
|
1059
|
+
onCancelEdit: Vt,
|
|
1060
|
+
onSave: Yt,
|
|
1061
|
+
onRestore: Qt,
|
|
1062
|
+
isRestoring: Qe.isPending,
|
|
1063
|
+
refreshControl: {
|
|
1064
|
+
refetch: M.refetch,
|
|
1065
|
+
isFetching: M.isFetching,
|
|
1066
|
+
isLoading: M.isLoading,
|
|
1067
|
+
isLive: ze
|
|
1068
|
+
},
|
|
1069
|
+
isRealtimeEntity: S?.realtime === !0
|
|
1070
|
+
}), gn = Nt && /* @__PURE__ */ R("div", {
|
|
1064
1071
|
style: {
|
|
1065
1072
|
display: "flex",
|
|
1066
1073
|
alignItems: "center",
|
|
@@ -1073,8 +1080,8 @@ function V({ screenCode: t }) {
|
|
|
1073
1080
|
color: "var(--danger)",
|
|
1074
1081
|
fontSize: 12.5
|
|
1075
1082
|
},
|
|
1076
|
-
children: [/* @__PURE__ */ L(e.warning, { size: 14 }), /* @__PURE__ */ R("span", { children: ["This record was deleted on ",
|
|
1077
|
-
}),
|
|
1083
|
+
children: [/* @__PURE__ */ L(e.warning, { size: 14 }), /* @__PURE__ */ R("span", { children: ["This record was deleted on ", u(String(Y[S.soft_delete]))] })]
|
|
1084
|
+
}), _n = _t && /* @__PURE__ */ R("div", {
|
|
1078
1085
|
style: {
|
|
1079
1086
|
display: "flex",
|
|
1080
1087
|
alignItems: "center",
|
|
@@ -1088,71 +1095,71 @@ function V({ screenCode: t }) {
|
|
|
1088
1095
|
fontSize: 12.5
|
|
1089
1096
|
},
|
|
1090
1097
|
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
|
-
}),
|
|
1092
|
-
errors: Object.entries(
|
|
1098
|
+
}), vn = q && St && Jt && /* @__PURE__ */ L(Ze, {
|
|
1099
|
+
errors: Object.entries(qt).map(([e, t]) => {
|
|
1093
1100
|
let n = S.fields.get(e);
|
|
1094
1101
|
return {
|
|
1095
1102
|
name: e,
|
|
1096
|
-
label: n ? ae(n, e,
|
|
1103
|
+
label: n ? ae(n, e, h?.entities) : e,
|
|
1097
1104
|
message: t
|
|
1098
1105
|
};
|
|
1099
1106
|
}),
|
|
1100
1107
|
onJump: (e) => {
|
|
1101
|
-
let t = document.getElementById(`${
|
|
1108
|
+
let t = document.getElementById(`${C}-${e}`);
|
|
1102
1109
|
t && (t.scrollIntoView({
|
|
1103
1110
|
block: "center",
|
|
1104
1111
|
behavior: "smooth"
|
|
1105
1112
|
}), t.focus?.());
|
|
1106
1113
|
}
|
|
1107
|
-
}),
|
|
1114
|
+
}), yn = et && !k && !(x.items && x.items.length > 0) && /* @__PURE__ */ L("div", {
|
|
1108
1115
|
className: "mb-4",
|
|
1109
|
-
children: /* @__PURE__ */ L(
|
|
1116
|
+
children: /* @__PURE__ */ L(Be, {
|
|
1110
1117
|
statusGroups: S.status_groups ?? {},
|
|
1111
1118
|
objectStatuses: $.objectStatuses,
|
|
1112
|
-
onSetStatus: E && q ? (e, t) =>
|
|
1119
|
+
onSetStatus: E && q ? (e, t) => ht((n) => ({
|
|
1113
1120
|
...n,
|
|
1114
1121
|
[e]: t
|
|
1115
|
-
})) :
|
|
1122
|
+
})) : lt,
|
|
1116
1123
|
isPending: !1,
|
|
1117
1124
|
mode: q ? "edit" : "display"
|
|
1118
1125
|
})
|
|
1119
|
-
}),
|
|
1120
|
-
|
|
1121
|
-
card:
|
|
1126
|
+
}), bn = /* @__PURE__ */ R(Je, { children: [
|
|
1127
|
+
ln && (Y || k) && /* @__PURE__ */ L(pt, {
|
|
1128
|
+
card: ln,
|
|
1122
1129
|
entity: S,
|
|
1123
1130
|
record: $.record,
|
|
1124
1131
|
objectStatuses: $.objectStatuses,
|
|
1125
1132
|
objectProperties: $.objectProperties
|
|
1126
1133
|
}),
|
|
1127
|
-
|
|
1128
|
-
nodes:
|
|
1134
|
+
x.items && x.items.length > 0 && (Y || k) && h && /* @__PURE__ */ L(Ve, {
|
|
1135
|
+
nodes: x.items,
|
|
1129
1136
|
ctx: $
|
|
1130
1137
|
}),
|
|
1131
|
-
!k && O &&
|
|
1132
|
-
entityCode:
|
|
1133
|
-
recordId:
|
|
1138
|
+
!k && O && C && S.associations && Object.keys(S.associations).length > 0 && h && /* @__PURE__ */ L(Ye, {
|
|
1139
|
+
entityCode: C,
|
|
1140
|
+
recordId: De ?? O ?? "",
|
|
1134
1141
|
associations: S.associations,
|
|
1135
|
-
schema:
|
|
1142
|
+
schema: h
|
|
1136
1143
|
}),
|
|
1137
|
-
!k && Y &&
|
|
1138
|
-
screen:
|
|
1144
|
+
!k && Y && h && /* @__PURE__ */ L(rt, {
|
|
1145
|
+
screen: x,
|
|
1139
1146
|
entity: S,
|
|
1140
|
-
entityCode:
|
|
1147
|
+
entityCode: C,
|
|
1141
1148
|
record: Y,
|
|
1142
|
-
refs:
|
|
1143
|
-
schema:
|
|
1144
|
-
locale:
|
|
1149
|
+
refs: At,
|
|
1150
|
+
schema: h,
|
|
1151
|
+
locale: Kt
|
|
1145
1152
|
})
|
|
1146
|
-
] }),
|
|
1147
|
-
open:
|
|
1148
|
-
onOpenChange: (e) => !e &&
|
|
1149
|
-
title: `Delete ${
|
|
1150
|
-
description:
|
|
1153
|
+
] }), xn = /* @__PURE__ */ L(Oe, {
|
|
1154
|
+
open: bt.show,
|
|
1155
|
+
onOpenChange: (e) => !e && xt({ show: !1 }),
|
|
1156
|
+
title: `Delete ${nn}`,
|
|
1157
|
+
description: bt.confirmation ? bt.confirmation : Mt ? `Are you sure you want to delete this ${nn.toLowerCase()}? It can be restored later by an admin.` : `Are you sure you want to delete this ${nn.toLowerCase()}? This action cannot be undone.`,
|
|
1151
1158
|
confirmLabel: "Delete",
|
|
1152
|
-
onConfirm:
|
|
1159
|
+
onConfirm: Zt,
|
|
1153
1160
|
destructive: !0
|
|
1154
1161
|
});
|
|
1155
|
-
if (
|
|
1162
|
+
if (pn) return /* @__PURE__ */ R("div", {
|
|
1156
1163
|
style: {
|
|
1157
1164
|
height: "100%",
|
|
1158
1165
|
display: "flex",
|
|
@@ -1174,14 +1181,14 @@ function V({ screenCode: t }) {
|
|
|
1174
1181
|
padding: "14px 20px 8px"
|
|
1175
1182
|
},
|
|
1176
1183
|
children: [
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1184
|
+
hn,
|
|
1185
|
+
_n,
|
|
1186
|
+
gn,
|
|
1187
|
+
vn,
|
|
1188
|
+
yn
|
|
1182
1189
|
]
|
|
1183
1190
|
}), /* @__PURE__ */ L("div", {
|
|
1184
|
-
ref:
|
|
1191
|
+
ref: Pt,
|
|
1185
1192
|
style: {
|
|
1186
1193
|
flex: 1,
|
|
1187
1194
|
minHeight: 0,
|
|
@@ -1191,12 +1198,12 @@ function V({ screenCode: t }) {
|
|
|
1191
1198
|
flexDirection: "column",
|
|
1192
1199
|
gap: 16
|
|
1193
1200
|
},
|
|
1194
|
-
children:
|
|
1201
|
+
children: bn
|
|
1195
1202
|
})]
|
|
1196
1203
|
}),
|
|
1197
1204
|
/* @__PURE__ */ L("div", {
|
|
1198
1205
|
className: "detail-resize-handle",
|
|
1199
|
-
onMouseDown:
|
|
1206
|
+
onMouseDown: kt,
|
|
1200
1207
|
title: "Drag to resize",
|
|
1201
1208
|
children: /* @__PURE__ */ L("div", { style: {
|
|
1202
1209
|
position: "absolute",
|
|
@@ -1209,21 +1216,21 @@ function V({ screenCode: t }) {
|
|
|
1209
1216
|
} })
|
|
1210
1217
|
}),
|
|
1211
1218
|
/* @__PURE__ */ L("div", {
|
|
1212
|
-
ref:
|
|
1219
|
+
ref: Ot,
|
|
1213
1220
|
style: {
|
|
1214
1221
|
flexShrink: 0,
|
|
1215
1222
|
height: "100%",
|
|
1216
|
-
width: `${
|
|
1223
|
+
width: `${Et}px`
|
|
1217
1224
|
},
|
|
1218
|
-
children: (Y || k) &&
|
|
1219
|
-
nodes:
|
|
1225
|
+
children: (Y || k) && h && /* @__PURE__ */ L(Ve, {
|
|
1226
|
+
nodes: x.sidebar,
|
|
1220
1227
|
ctx: $
|
|
1221
1228
|
})
|
|
1222
1229
|
}),
|
|
1223
|
-
|
|
1230
|
+
xn
|
|
1224
1231
|
]
|
|
1225
1232
|
});
|
|
1226
|
-
let
|
|
1233
|
+
let Sn = y.isPhone ? 12 : 24;
|
|
1227
1234
|
return /* @__PURE__ */ R("div", {
|
|
1228
1235
|
style: {
|
|
1229
1236
|
height: "100%",
|
|
@@ -1236,30 +1243,30 @@ function V({ screenCode: t }) {
|
|
|
1236
1243
|
/* @__PURE__ */ R("div", {
|
|
1237
1244
|
style: {
|
|
1238
1245
|
flexShrink: 0,
|
|
1239
|
-
padding:
|
|
1246
|
+
padding: y.isPhone ? "14px 12px 8px" : "24px 24px 8px"
|
|
1240
1247
|
},
|
|
1241
1248
|
children: [
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1249
|
+
hn,
|
|
1250
|
+
_n,
|
|
1251
|
+
gn,
|
|
1252
|
+
vn,
|
|
1253
|
+
yn
|
|
1247
1254
|
]
|
|
1248
1255
|
}),
|
|
1249
1256
|
/* @__PURE__ */ R("div", {
|
|
1250
|
-
ref:
|
|
1257
|
+
ref: Pt,
|
|
1251
1258
|
style: {
|
|
1252
1259
|
flex: 1,
|
|
1253
1260
|
minHeight: 0,
|
|
1254
1261
|
overflowY: "auto",
|
|
1255
|
-
padding: `4px ${
|
|
1262
|
+
padding: `4px ${Sn}px calc(24px + var(--safe-bottom))`,
|
|
1256
1263
|
display: "flex",
|
|
1257
1264
|
flexDirection: "column",
|
|
1258
1265
|
gap: 16,
|
|
1259
1266
|
minWidth: 0,
|
|
1260
1267
|
WebkitOverflowScrolling: "touch"
|
|
1261
1268
|
},
|
|
1262
|
-
children: [
|
|
1269
|
+
children: [bn, fn && (Y || k) && h && /* @__PURE__ */ L("div", {
|
|
1263
1270
|
"data-testid": "detail-sidebar-inline",
|
|
1264
1271
|
style: {
|
|
1265
1272
|
display: "flex",
|
|
@@ -1267,24 +1274,24 @@ function V({ screenCode: t }) {
|
|
|
1267
1274
|
gap: 16,
|
|
1268
1275
|
minWidth: 0
|
|
1269
1276
|
},
|
|
1270
|
-
children: /* @__PURE__ */ L(
|
|
1271
|
-
nodes:
|
|
1277
|
+
children: /* @__PURE__ */ L(Ve, {
|
|
1278
|
+
nodes: x.sidebar,
|
|
1272
1279
|
ctx: $
|
|
1273
1280
|
})
|
|
1274
1281
|
})]
|
|
1275
1282
|
}),
|
|
1276
|
-
|
|
1283
|
+
xn
|
|
1277
1284
|
]
|
|
1278
1285
|
});
|
|
1279
1286
|
}
|
|
1280
|
-
function
|
|
1287
|
+
function pt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties: i }) {
|
|
1281
1288
|
let a = (e) => {
|
|
1282
|
-
let a =
|
|
1289
|
+
let a = V(t, e, n, r, i);
|
|
1283
1290
|
return a != null && h(a) !== "";
|
|
1284
|
-
}, o = (e) => h(
|
|
1291
|
+
}, o = (e) => h(V(t, e, n, r, i)) || /* @__PURE__ */ L("span", {
|
|
1285
1292
|
style: { color: "var(--text-3)" },
|
|
1286
1293
|
children: "-"
|
|
1287
|
-
}), s = h(e.titleUsesDisplay ? g(n, t) : e.titleField ?
|
|
1294
|
+
}), s = h(e.titleUsesDisplay ? g(n, t) : e.titleField ? V(t, e.titleField, n, r, i) : void 0) || b(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
1295
|
return /* @__PURE__ */ R("section", {
|
|
1289
1296
|
"data-testid": "detail-header-card",
|
|
1290
1297
|
style: {
|
|
@@ -1355,7 +1362,7 @@ function lt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
|
|
|
1355
1362
|
style: { display: "contents" },
|
|
1356
1363
|
children: [/* @__PURE__ */ L("dt", {
|
|
1357
1364
|
style: { color: "var(--text-3)" },
|
|
1358
|
-
children:
|
|
1365
|
+
children: H(t, e)
|
|
1359
1366
|
}), /* @__PURE__ */ L("dd", {
|
|
1360
1367
|
style: {
|
|
1361
1368
|
margin: 0,
|
|
@@ -1382,7 +1389,7 @@ function lt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
|
|
|
1382
1389
|
overflowWrap: "anywhere"
|
|
1383
1390
|
},
|
|
1384
1391
|
children: [
|
|
1385
|
-
|
|
1392
|
+
H(t, e),
|
|
1386
1393
|
": ",
|
|
1387
1394
|
o(e)
|
|
1388
1395
|
]
|
|
@@ -1391,104 +1398,135 @@ function lt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
|
|
|
1391
1398
|
]
|
|
1392
1399
|
});
|
|
1393
1400
|
}
|
|
1394
|
-
function
|
|
1401
|
+
function V(e, t, n, r, i) {
|
|
1395
1402
|
if (t.startsWith("$status.")) {
|
|
1396
1403
|
let e = t.slice(8), n = r?.find((t) => t.group_code === e);
|
|
1397
|
-
return
|
|
1404
|
+
return b(n?.status_name) || n?.status_code;
|
|
1398
1405
|
}
|
|
1399
1406
|
if (t.startsWith("$property.")) {
|
|
1400
1407
|
let e = t.slice(10);
|
|
1401
1408
|
return i?.find((t) => t.property_code === e)?.value;
|
|
1402
1409
|
}
|
|
1403
|
-
return
|
|
1410
|
+
return ge(e, n, t);
|
|
1404
1411
|
}
|
|
1405
|
-
function
|
|
1412
|
+
function H(e, t) {
|
|
1406
1413
|
if (t.startsWith("$status.")) return t.slice(8);
|
|
1407
1414
|
if (t.startsWith("$property.")) return t.slice(10);
|
|
1408
1415
|
let n = e.fields.get(t);
|
|
1409
1416
|
return n ? ae(n, t) : t;
|
|
1410
1417
|
}
|
|
1411
|
-
function
|
|
1412
|
-
let { run:
|
|
1413
|
-
if (!
|
|
1414
|
-
let e =
|
|
1418
|
+
function mt({ title: r, recordId: i, editing: a, isNew: s, isRecordDeleted: c, dirty: l, isSaving: u, hasChildErrors: ee, hasFieldErrors: d, canRestore: f, entity: p, screen: m, globalActions: h, entityCode: g, record: _, id: v, listRoute: ne, listRouteExists: x, highlights: ie, showBack: ae, onBack: C, onCancelEdit: w, onSave: oe, onRestore: se, isRestoring: T, refreshControl: le, isRealtimeEntity: de }) {
|
|
1419
|
+
let { run: E } = y(), pe = fe("detail"), ge = De(), ve = ce(), ye = re(), be = Ie(m?.action_layout, p?.action_layout, p?.actions, h, "detail_toolbar"), D = O(Ie(m?.action_layout, p?.action_layout, p?.actions, h, "detail"), p?.actions, h, _ ?? {}, []), xe = O(be, p?.actions, h, _ ?? {}, []), Se = F(() => {
|
|
1420
|
+
if (!p) return;
|
|
1421
|
+
let e = v ? [v] : [];
|
|
1415
1422
|
return {
|
|
1416
|
-
entity:
|
|
1417
|
-
entityCode:
|
|
1418
|
-
screen:
|
|
1419
|
-
screenRoute:
|
|
1420
|
-
selectedRows:
|
|
1423
|
+
entity: p,
|
|
1424
|
+
entityCode: g ?? "",
|
|
1425
|
+
screen: m,
|
|
1426
|
+
screenRoute: m?.route ?? "",
|
|
1427
|
+
selectedRows: _ ? [_] : [],
|
|
1421
1428
|
selectedIds: e,
|
|
1422
|
-
locale:
|
|
1423
|
-
tabNavigate: (e, t) =>
|
|
1429
|
+
locale: ye,
|
|
1430
|
+
tabNavigate: (e, t) => ge(e, {
|
|
1424
1431
|
title: t?.title,
|
|
1425
1432
|
icon: t?.icon,
|
|
1426
1433
|
search: t?.search
|
|
1427
1434
|
}),
|
|
1428
|
-
runActionApi: (e, t) =>
|
|
1435
|
+
runActionApi: (e, t) => S(e, t)
|
|
1429
1436
|
};
|
|
1430
1437
|
}, [
|
|
1438
|
+
p,
|
|
1439
|
+
g,
|
|
1431
1440
|
m,
|
|
1432
|
-
te,
|
|
1433
|
-
h,
|
|
1434
|
-
y,
|
|
1435
1441
|
v,
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1442
|
+
_,
|
|
1443
|
+
ye,
|
|
1444
|
+
ge
|
|
1445
|
+
]), Ce = (e, t) => {
|
|
1446
|
+
let r = _e(e, t, { row: _ ?? void 0 });
|
|
1447
|
+
if (r === null) return;
|
|
1448
|
+
let i = v ? [v] : [], a = e === "__delete" && x ? ne : null;
|
|
1449
|
+
return E({
|
|
1450
|
+
action: t,
|
|
1451
|
+
title: b(t.display?.name) || e,
|
|
1452
|
+
execute: (e) => S(r, n(e, i)),
|
|
1453
|
+
onSuccess: a ? () => {
|
|
1454
|
+
he.getState().kill(ue(location)), ve(a, { replace: !0 });
|
|
1455
|
+
} : void 0
|
|
1456
|
+
});
|
|
1457
|
+
}, A = pe.isVisible("show_actions") && !s && v && D.length > 0 ? /* @__PURE__ */ L(k, {
|
|
1458
|
+
layout: D,
|
|
1459
|
+
row: _,
|
|
1460
|
+
onRun: Ce,
|
|
1461
|
+
kind: "detail",
|
|
1462
|
+
entityActions: p?.actions,
|
|
1463
|
+
globalActions: h,
|
|
1464
|
+
reservedRightWidth: 0,
|
|
1465
|
+
widgetContext: Se
|
|
1466
|
+
}) : null, we = !s && v ? /* @__PURE__ */ L(me, {
|
|
1467
|
+
liveObject: le,
|
|
1468
|
+
realtime: de
|
|
1469
|
+
}) : null, Te = pe.isVisible("show_actions") && !s && v && xe.length > 0 ? /* @__PURE__ */ R("div", {
|
|
1470
|
+
style: {
|
|
1471
|
+
display: "flex",
|
|
1472
|
+
justifyContent: "flex-end",
|
|
1473
|
+
alignItems: "center",
|
|
1474
|
+
gap: 8,
|
|
1475
|
+
marginTop: 10
|
|
1476
|
+
},
|
|
1477
|
+
children: [A ? null : we, /* @__PURE__ */ L(k, {
|
|
1478
|
+
layout: xe,
|
|
1479
|
+
row: _,
|
|
1480
|
+
onRun: Ce,
|
|
1481
|
+
kind: "detail",
|
|
1482
|
+
entityActions: p?.actions,
|
|
1483
|
+
globalActions: h,
|
|
1484
|
+
reservedRightWidth: 0,
|
|
1485
|
+
widgetContext: Se,
|
|
1486
|
+
ariaLabel: A ? "Detail toolbar actions" : "Page actions"
|
|
1487
|
+
})]
|
|
1488
|
+
}) : null, Ee = c ? f ? /* @__PURE__ */ L(o, {
|
|
1439
1489
|
kind: "primary",
|
|
1440
|
-
icon: L(T ?
|
|
1441
|
-
onClick:
|
|
1490
|
+
icon: L(T ? te : e.refresh, { size: 13 }),
|
|
1491
|
+
onClick: se,
|
|
1442
1492
|
disabled: T,
|
|
1443
1493
|
children: T ? "Restoring…" : "Restore"
|
|
1444
|
-
}) : null :
|
|
1494
|
+
}) : null : a ? /* @__PURE__ */ R(Je, { children: [/* @__PURE__ */ L(o, {
|
|
1445
1495
|
icon: /* @__PURE__ */ L(e.x, { size: 13 }),
|
|
1446
|
-
onClick:
|
|
1496
|
+
onClick: w,
|
|
1447
1497
|
disabled: u,
|
|
1448
1498
|
children: "Cancel"
|
|
1449
|
-
}), /* @__PURE__ */ L(
|
|
1499
|
+
}), /* @__PURE__ */ L(o, {
|
|
1450
1500
|
kind: "primary",
|
|
1451
|
-
icon: L(u ?
|
|
1452
|
-
onClick:
|
|
1453
|
-
disabled: u ||
|
|
1454
|
-
title:
|
|
1501
|
+
icon: L(u ? te : e.save, { size: 13 }),
|
|
1502
|
+
onClick: oe,
|
|
1503
|
+
disabled: u || ee || d,
|
|
1504
|
+
title: ee ? "Fix errors in child rows" : d ? "Fix the highlighted fields" : void 0,
|
|
1455
1505
|
children: u ? "Saving…" : "Save"
|
|
1456
|
-
})] }) : !
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
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
|
-
});
|
|
1506
|
+
})] }) : !s && v && A ? /* @__PURE__ */ R("span", {
|
|
1507
|
+
style: {
|
|
1508
|
+
display: "inline-flex",
|
|
1509
|
+
alignItems: "center",
|
|
1510
|
+
gap: 8,
|
|
1511
|
+
flexWrap: "wrap"
|
|
1471
1512
|
},
|
|
1472
|
-
|
|
1473
|
-
entityActions: m?.actions,
|
|
1474
|
-
globalActions: g,
|
|
1475
|
-
reservedRightWidth: 0,
|
|
1476
|
-
widgetContext: be
|
|
1513
|
+
children: [we, A]
|
|
1477
1514
|
}) : null;
|
|
1478
|
-
return /* @__PURE__ */ L(
|
|
1479
|
-
icon:
|
|
1480
|
-
name:
|
|
1515
|
+
return /* @__PURE__ */ R(Je, { children: [/* @__PURE__ */ L(it, {
|
|
1516
|
+
icon: p?.display.icon ? /* @__PURE__ */ L(t, {
|
|
1517
|
+
name: p.display.icon,
|
|
1481
1518
|
size: 16
|
|
1482
1519
|
}) : void 0,
|
|
1483
|
-
title:
|
|
1484
|
-
recordId:
|
|
1485
|
-
highlights:
|
|
1486
|
-
mode:
|
|
1487
|
-
dirty:
|
|
1520
|
+
title: r,
|
|
1521
|
+
recordId: i,
|
|
1522
|
+
highlights: ie,
|
|
1523
|
+
mode: s ? "create" : a ? "edit" : "display",
|
|
1524
|
+
dirty: l,
|
|
1488
1525
|
showBack: ae,
|
|
1489
|
-
onBack:
|
|
1490
|
-
right:
|
|
1491
|
-
|
|
1526
|
+
onBack: C,
|
|
1527
|
+
right: Ee,
|
|
1528
|
+
showTitle: pe.isVisible("show_title")
|
|
1529
|
+
}), Te] });
|
|
1492
1530
|
}
|
|
1493
1531
|
//#endregion
|
|
1494
|
-
export {
|
|
1532
|
+
export { ft as SmartDetailPage };
|