@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.
Files changed (41) hide show
  1. package/dist-lib/{ActionRunner-BzaZQtiI.js → ActionRunner-CaSrGpBi.js} +264 -260
  2. package/dist-lib/{DraggableChildrenTable-DILqStHQ.js → DraggableChildrenTable-CAHg7paQ.js} +1 -1
  3. package/dist-lib/{Grid-BIsiUwPh.js → Grid-DDbBhqcl.js} +2 -2
  4. package/dist-lib/{LayoutRenderer-3RvIsC9M.js → LayoutRenderer-CelsqsZ6.js} +433 -433
  5. package/dist-lib/{MarkdownRenderer-CaHhWrfm.js → MarkdownRenderer-DThy2ixe.js} +1 -1
  6. package/dist-lib/RefreshControl-CorluL6r.js +582 -0
  7. package/dist-lib/{SmartDetailPage.impl--EO-9fos.js → SmartDetailPage.impl-USIxbl-8.js} +449 -411
  8. package/dist-lib/{SmartRecordListPage.impl-B1iws8yf.js → SmartRecordListPage.impl-BKIpTNK7.js} +210 -210
  9. package/dist-lib/api/data.d.ts +4 -4
  10. package/dist-lib/api/params.d.ts +1 -1
  11. package/dist-lib/components/layout/Rail.d.ts +5 -5
  12. package/dist-lib/components/layout/TopBar.d.ts +3 -1
  13. package/dist-lib/components/pages/auth/AuthShell.d.ts +1 -1
  14. package/dist-lib/components/pages/list/ListHeader.d.ts +1 -1
  15. package/dist-lib/components/primitives/BrandLogo.d.ts +1 -1
  16. package/dist-lib/components/shared/ActionRunner.d.ts +1 -0
  17. package/dist-lib/components/shared/ObjectActionBar.d.ts +29 -0
  18. package/dist-lib/components/shared/PageHeader.d.ts +1 -1
  19. package/dist-lib/components/shared/RecordHeader.d.ts +2 -1
  20. package/dist-lib/components/shared/RefreshControl.d.ts +6 -0
  21. package/dist-lib/hooks/useBranding.d.ts +8 -0
  22. package/dist-lib/hooks/useBrandingChrome.d.ts +6 -0
  23. package/dist-lib/hooks/useLiveObject.d.ts +9 -0
  24. package/dist-lib/hooks/useMutations.d.ts +3 -3
  25. package/dist-lib/hooks/useObject.d.ts +10 -0
  26. package/dist-lib/hooks/usePageStateRuntime.d.ts +1 -1
  27. package/dist-lib/hooks/useParams.d.ts +10 -1
  28. package/dist-lib/index.d.ts +11 -5
  29. package/dist-lib/index.js +1890 -1722
  30. package/dist-lib/lib/actions.d.ts +6 -2
  31. package/dist-lib/lib/branding.d.ts +10 -1
  32. package/dist-lib/{registry-2KliNTHB.js → registry-KQyyL5Gt.js} +1452 -1401
  33. package/dist-lib/testing.d.ts +5 -3
  34. package/dist-lib/testing.js +35 -31
  35. package/dist-lib/types/api.d.ts +70 -3
  36. package/dist-lib/types/schema.d.ts +1 -15
  37. package/dist-lib/{useProperties-Co3RdtuT.js → useProperties-D74hyWIa.js} +53 -53
  38. package/dist-lib/{value-BooGwUik.js → value-BfXXl5EE.js} +1 -1
  39. package/package.json +1 -1
  40. package/dist-lib/hooks/useEntityItem.d.ts +0 -10
  41. 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 { 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";
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 Ke({ entityCode: e, recordId: n, associations: r, schema: i }) {
13
- let a = N(() => Object.entries(r), [r]), [o, s] = F(0);
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(Ee, {
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
- }), x(n.display?.name) || e]
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(qe, {
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 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({
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
- u,
68
+ l,
69
69
  n
70
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({
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
- f,
76
- g
75
+ d,
76
+ h
77
77
  ],
78
- queryFn: () => o(f, {
78
+ queryFn: () => x(d, {
79
79
  per_page: 50,
80
80
  filters: [{
81
- field: h,
81
+ field: m,
82
82
  op: "in",
83
- value: g
83
+ value: h
84
84
  }]
85
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);
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) : [], [p]), ie = () => {
91
- let e = be(s, f);
90
+ }).slice(0, 6) : [], [f]), ie = () => {
91
+ let e = D(a, d);
92
92
  if (!e) return;
93
- let t = x(i.display?.name) || r, n = new URLSearchParams();
93
+ let t = b(i.display?.name) || r, n = new URLSearchParams();
94
94
  n.set("filters", JSON.stringify([{
95
- field: h,
95
+ field: m,
96
96
  op: "in",
97
- value: m
98
- }])), c(e.route, {
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
- }, oe = {
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: oe,
109
+ style: S,
110
110
  children: "Loading…"
111
111
  });
112
- if (!p) return /* @__PURE__ */ L("div", {
113
- style: oe,
112
+ if (!f) return /* @__PURE__ */ L("div", {
113
+ style: S,
114
114
  children: "Entity not found."
115
115
  });
116
- if (m.length === 0) return /* @__PURE__ */ L("div", {
117
- style: oe,
116
+ if (p.length === 0) return /* @__PURE__ */ L("div", {
117
+ style: S,
118
118
  children: "No related records."
119
119
  });
120
- let C = be(s, f);
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: Le,
125
+ style: Re,
126
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);
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: Re,
133
- children: v({
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: b,
140
- locale: l
139
+ refs: y,
140
+ locale: c
141
141
  })
142
142
  }, t) : /* @__PURE__ */ L("td", {}, t);
143
143
  }) }, t)) })]
144
144
  }),
145
- C && d && d.count > y.length && /* @__PURE__ */ L("div", {
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(a, {
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
- d.count,
155
+ u.count,
156
156
  " records"
157
157
  ]
158
158
  })
159
159
  }),
160
- C && y.length > 0 && d && d.count <= y.length && /* @__PURE__ */ L("div", {
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(a, {
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 Je({ errors: t, onJump: n }) {
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 Ye({ items: e }) {
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(Ve, { children: [t > 0 && /* @__PURE__ */ L("span", { style: {
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 Xe({ screen: e, entity: t, entityCode: r, record: i, refs: a, objectStatuses: o, schema: s, locale: c }) {
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), r = t ? l.statuses.find((e) => e.code === t.status_code) : void 0;
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: x(l.name),
310
- value: r ? /* @__PURE__ */ L(n, {
311
- tone: r.color ?? "slate",
309
+ label: b(l.name),
310
+ value: n ? /* @__PURE__ */ L(r, {
311
+ tone: n.color ?? "slate",
312
312
  size: "xs",
313
- children: x(r.name)
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 n = we({
322
+ let r = M({
323
323
  entity: t,
324
- entityCode: r,
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: A(t, e, s.entities),
336
- value: n
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(Ye, { items: u });
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 Ze(e) {
345
+ function et(e) {
346
346
  return e.by != null || e.at != null;
347
347
  }
348
- function Qe({ lines: e }) {
349
- let t = e.filter(Ze);
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($e, { line: e }, t))
362
+ children: t.map((e, t) => /* @__PURE__ */ L(nt, { line: e }, t))
363
363
  });
364
364
  }
365
- function $e({ line: e }) {
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 et({ screen: e, entity: t, entityCode: n, record: r, refs: i, schema: a, locale: o }) {
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 we({
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(Qe, { lines: s?.lines && s.lines.length > 0 ? s.lines.map((e) => ({
427
- label: x(e.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 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;
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: m ? "wrap" : "nowrap",
449
+ flexWrap: h ? "wrap" : "nowrap",
450
450
  minWidth: 0
451
451
  },
452
452
  children: [
453
- d && /* @__PURE__ */ L("div", {
453
+ p && u && /* @__PURE__ */ L("div", {
454
454
  style: {
455
455
  paddingTop: 4,
456
456
  flexShrink: 0
457
457
  },
458
- children: /* @__PURE__ */ L(u, {
458
+ children: /* @__PURE__ */ L(ee, {
459
459
  size: 26,
460
460
  icon: /* @__PURE__ */ L(e.back, { size: 14 }),
461
461
  title: "Back",
462
- onClick: ee
462
+ onClick: d
463
463
  })
464
464
  }),
465
- (r || t) && /* @__PURE__ */ L("div", {
465
+ p && (n || t) && /* @__PURE__ */ L("div", {
466
466
  style: {
467
467
  flexShrink: 0,
468
468
  paddingTop: 2
469
469
  },
470
- children: r ? /* @__PURE__ */ L(T, {
471
- name: r,
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: 19,
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: m ? "normal" : "nowrap",
511
+ whiteSpace: h ? "normal" : "nowrap",
512
512
  overflowWrap: "anywhere",
513
513
  maxWidth: "100%"
514
514
  },
515
- children: a
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(n, {
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: m ? "1 1 100%" : "0 0 auto",
552
+ flex: h ? "1 1 100%" : "0 0 auto",
553
553
  flexWrap: "wrap",
554
- justifyContent: m ? "flex-start" : "flex-end",
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 tt(e, t, n) {
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 nt = /^[^@\s]+@[^@\s]+\.[^@\s]+$/;
574
- function rt(e, t) {
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 !== "" && !nt.test(e) && n.push(r);
579
+ typeof e == "string" && e !== "" && !ot.test(e) && n.push(r);
580
580
  }
581
581
  return n;
582
582
  }
583
- function B(e, t) {
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 it(e, t) {
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 = B(r, t), o = [];
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 at = () => {};
616
- function ot(e, t) {
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 st(e, t) {
619
+ function dt(e, t) {
620
620
  if (e) {
621
- let n = se(ne(e, t));
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 ct({ screenCode: e }) {
627
- return /* @__PURE__ */ L(m, { children: /* @__PURE__ */ L(V, { screenCode: e }) });
626
+ function ft({ screenCode: e }) {
627
+ return /* @__PURE__ */ L(m, { children: /* @__PURE__ */ L(B, { screenCode: e }) });
628
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 = (() => {
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 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(() => {
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 = f(O, e.length);
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
- ]), 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);
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
- }), Ct = P(null), J = P(null), wt = j((e) => {
660
+ }), Ot = Ue(null), J = Ue(null), kt = N((e) => {
661
661
  e.preventDefault();
662
- let t = Ct.current;
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 && St(parseInt(t.style.width, 10) || J.current.startW), J.current = null, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i);
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 = Ee?.data, X = typeof Y?.$row_version == "string" ? Y.$row_version : void 0, Tt = Y?.$refs, Et = P(X);
678
- M(() => {
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 = Et.current;
681
- Et.current = X, e && e !== X && z && pt(!0);
680
+ let e = jt.current;
681
+ jt.current = X, e && e !== X && z && vt(!0);
682
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({
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
- b?.display?.name?.en,
704
+ x?.display?.name?.en,
705
705
  S?.display.name?.en,
706
- b?.display?.icon,
706
+ x?.display?.icon,
707
707
  S?.display.icon,
708
708
  k,
709
709
  D,
710
- bt.enabled
711
- ]), M(() => {
712
- if (!Y || !S || D || bt.enabled) return;
713
- let e = Pt(Z.pathname);
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(b?.display?.name) || x(S.display.name), n = g(Y, S), r = n && !String(n).startsWith("/") ? String(n) : t;
716
- Nt(e.id, r);
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
- bt.enabled
724
+ Tt.enabled
725
725
  ]);
726
- let Ft = N(() => {
727
- if (!S || !yt) return /* @__PURE__ */ new Set();
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, 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({
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: () => ee(e)
745
+ discard: () => f(e)
746
746
  });
747
747
  });
748
748
  let t = {};
749
- Ft.forEach((n) => {
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 = Se(S, Y, n);
756
- t[n] = Ce(S, n) ? i ?? null : i ?? "";
757
- }), ct(t);
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 = m?.entities[n];
764
+ let e = h?.entities[n];
765
765
  t[n] = r.map((t) => ({
766
766
  ...t,
767
- _key: st(e, t)
767
+ _key: dt(e, t)
768
768
  }));
769
769
  }
770
770
  G(t), K(e);
771
771
  } else G({}), K({});
772
772
  }
773
- l((e) => {
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
- $e,
779
+ ot,
780
780
  Y,
781
- Ft,
781
+ Bt,
782
782
  E,
783
783
  S,
784
784
  W,
785
- m
786
- ]), M(() => {
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 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));
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
- b,
799
- a
800
- ]), Lt = j((e, t) => {
801
- ct((n) => ({
798
+ x,
799
+ r
800
+ ]), Ht = N((e, t) => {
801
+ V((n) => ({
802
802
  ...n,
803
803
  [e]: t
804
804
  }));
805
- }, []), Q = N(() => {
806
- if (!b?.route) return "/";
807
- let e = b.route.split("/");
805
+ }, []), Q = F(() => {
806
+ if (!x?.route) return "/";
807
+ let e = x.route.split("/");
808
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("/");
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 = Pt(Q)?.search ?? "";
815
- a(e ? `${Q}?${e}` : Q);
814
+ let e = zt(Q)?.search ?? "";
815
+ r(e ? `${Q}?${e}` : Q);
816
816
  }, [
817
- Rt,
817
+ Ut,
818
818
  Q,
819
- Pt,
820
- a
821
- ]) }), Bt = !D && (zt.hasOriginBack || zt.allowFallbackBack && !!Rt), Vt = re(), Ht = N(() => {
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 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");
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
- 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({
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 = ye(t);
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 = me(S, t, n);
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 ? Se(S, Y, t) : void 0, i = me(S, t, n), a = me(S, t, r);
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(V).length > 0 && (e.$statuses = Object.entries(V).map(([e, t]) => ({
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 = mt?.[e] ?? [];
866
- (k || !ot(r, i)) && (t[e] = r);
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
- nt(!1), H({}), dt({}), G(void 0), K(void 0), vt(!1);
871
+ ft(!1), ht({}), gt({}), G(void 0), K(void 0), Ct(!1);
872
872
  return;
873
873
  }
874
- let r = () => {
875
- nt(!1), pt(!1), vt(!1), H({}), dt({}), G(void 0), K(void 0);
874
+ let i = () => {
875
+ ft(!1), vt(!1), Ct(!1), ht({}), gt({}), G(void 0), K(void 0);
876
876
  };
877
- k ? Le.mutate(e, { onSuccess: (e) => {
877
+ k ? He.mutate(e, { onSuccess: (e) => {
878
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,
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)), r();
886
+ n.forEach((e) => _.markCommitted(e)), i();
887
887
  },
888
888
  onError: (e) => {
889
- e instanceof s && e.code === "STALE_OBJECT" && pt(!0);
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
- w,
897
+ C,
898
898
  B,
899
- Ut,
900
- V,
899
+ Jt,
900
+ H,
901
901
  U,
902
902
  W,
903
- mt,
904
- Le,
905
- Re,
903
+ yt,
904
+ He,
905
+ qe,
906
906
  S,
907
- a,
907
+ r,
908
908
  Q,
909
909
  Y,
910
910
  X,
911
- A
912
- ]), Gt = j((e, t) => {
911
+ j
912
+ ]), Xt = N((e, t) => {
913
913
  G((n) => ({
914
914
  ...n ?? {},
915
915
  [e]: t
916
916
  }));
917
- }, []), Kt = j(() => {
918
- !A || k || !ge || Ve.mutate(A, { onSuccess: () => {
919
- ue.getState().kill(de(Z)), a(Q, { replace: !0 });
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
- A,
922
+ j,
923
923
  k,
924
- ge,
925
- Ve,
926
- a,
924
+ fe,
925
+ Xe,
926
+ r,
927
927
  Q,
928
928
  Z
929
- ]), qt = j(() => {
930
- !A || k || !_e || I.mutate(A);
929
+ ]), Qt = N(() => {
930
+ !j || k || !me || Qe.mutate(j);
931
931
  }, [
932
- A,
932
+ j,
933
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", {
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: [Bt && /* @__PURE__ */ L(u, {
948
+ children: [Gt && /* @__PURE__ */ L(ee, {
949
949
  icon: /* @__PURE__ */ L(e.back, { size: 14 }),
950
- onClick: zt.goBack,
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 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({
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: b
968
+ screen: x
969
969
  }) : void 0, $ = {
970
- schema: m,
970
+ schema: h,
971
971
  entity: S,
972
- entityCode: w,
973
- recordId: we ?? O ?? "",
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 ? Lt : void 0,
981
- refs: Tt,
980
+ onFieldChange: q ? Ht : void 0,
981
+ refs: At,
982
982
  objectProperties: (() => {
983
- let e = Qe ?? [];
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) => dt((n) => ({
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 = 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 : {
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: V[e.group_code]
1007
+ status_code: H[e.group_code]
1008
1008
  });
1009
- for (let [n, i] of Object.entries(V)) e.some((e) => e.group_code === n) || t.push({
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: i,
1011
+ status_code: r,
1012
1012
  status_name: {},
1013
- set_at: r()
1013
+ set_at: i()
1014
1014
  });
1015
1015
  return t;
1016
1016
  })(),
1017
- onSetStatus: k || !E ? void 0 : q ? (e, t) => H((n) => ({
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 ? 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,
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: w,
1031
+ entityCode: C,
1032
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,
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: Ot,
1042
+ isRecordDeleted: Nt,
1043
1043
  dirty: z,
1044
- isSaving: en,
1045
- hasChildErrors: Yt,
1046
- hasFieldErrors: _t && Ut,
1047
- canRestore: _e,
1044
+ isSaving: on,
1045
+ hasChildErrors: en,
1046
+ hasFieldErrors: St && Jt,
1047
+ canRestore: me,
1048
1048
  entity: S,
1049
- screen: b,
1050
- globalActions: m?.actions,
1051
- entityCode: w,
1049
+ screen: x,
1050
+ globalActions: h?.actions,
1051
+ entityCode: C,
1052
1052
  record: Y,
1053
1053
  id: O,
1054
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", {
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 ", c(String(Y[S.soft_delete]))] })]
1077
- }), fn = ft && /* @__PURE__ */ R("div", {
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
- }), pn = q && _t && Ut && /* @__PURE__ */ L(Je, {
1092
- errors: Object.entries(Ht).map(([e, t]) => {
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, m?.entities) : 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(`${w}-${e}`);
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
- }), mn = qe && !k && !(b.items && b.items.length > 0) && /* @__PURE__ */ L("div", {
1114
+ }), yn = et && !k && !(x.items && x.items.length > 0) && /* @__PURE__ */ L("div", {
1108
1115
  className: "mb-4",
1109
- children: /* @__PURE__ */ L(ze, {
1116
+ children: /* @__PURE__ */ L(Be, {
1110
1117
  statusGroups: S.status_groups ?? {},
1111
1118
  objectStatuses: $.objectStatuses,
1112
- onSetStatus: E && q ? (e, t) => H((n) => ({
1119
+ onSetStatus: E && q ? (e, t) => ht((n) => ({
1113
1120
  ...n,
1114
1121
  [e]: t
1115
- })) : at,
1122
+ })) : lt,
1116
1123
  isPending: !1,
1117
1124
  mode: q ? "edit" : "display"
1118
1125
  })
1119
- }), hn = /* @__PURE__ */ R(Ge, { children: [
1120
- rn && (Y || k) && /* @__PURE__ */ L(lt, {
1121
- card: rn,
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
- b.items && b.items.length > 0 && (Y || k) && m && /* @__PURE__ */ L(Be, {
1128
- nodes: b.items,
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 && w && S.associations && Object.keys(S.associations).length > 0 && m && /* @__PURE__ */ L(Ke, {
1132
- entityCode: w,
1133
- recordId: we ?? O ?? "",
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: m
1142
+ schema: h
1136
1143
  }),
1137
- !k && Y && m && /* @__PURE__ */ L(et, {
1138
- screen: b,
1144
+ !k && Y && h && /* @__PURE__ */ L(rt, {
1145
+ screen: x,
1139
1146
  entity: S,
1140
- entityCode: w,
1147
+ entityCode: C,
1141
1148
  record: Y,
1142
- refs: Tt,
1143
- schema: m,
1144
- locale: Vt
1149
+ refs: At,
1150
+ schema: h,
1151
+ locale: Kt
1145
1152
  })
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.`,
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: Kt,
1159
+ onConfirm: Zt,
1153
1160
  destructive: !0
1154
1161
  });
1155
- if (cn) return /* @__PURE__ */ R("div", {
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
- un,
1178
- fn,
1179
- dn,
1180
- pn,
1181
- mn
1184
+ hn,
1185
+ _n,
1186
+ gn,
1187
+ vn,
1188
+ yn
1182
1189
  ]
1183
1190
  }), /* @__PURE__ */ L("div", {
1184
- ref: kt,
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: hn
1201
+ children: bn
1195
1202
  })]
1196
1203
  }),
1197
1204
  /* @__PURE__ */ L("div", {
1198
1205
  className: "detail-resize-handle",
1199
- onMouseDown: wt,
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: Ct,
1219
+ ref: Ot,
1213
1220
  style: {
1214
1221
  flexShrink: 0,
1215
1222
  height: "100%",
1216
- width: `${xt}px`
1223
+ width: `${Et}px`
1217
1224
  },
1218
- children: (Y || k) && m && /* @__PURE__ */ L(Be, {
1219
- nodes: b.sidebar,
1225
+ children: (Y || k) && h && /* @__PURE__ */ L(Ve, {
1226
+ nodes: x.sidebar,
1220
1227
  ctx: $
1221
1228
  })
1222
1229
  }),
1223
- gn
1230
+ xn
1224
1231
  ]
1225
1232
  });
1226
- let _n = v.isPhone ? 12 : 24;
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: v.isPhone ? "14px 12px 8px" : "24px 24px 8px"
1246
+ padding: y.isPhone ? "14px 12px 8px" : "24px 24px 8px"
1240
1247
  },
1241
1248
  children: [
1242
- un,
1243
- fn,
1244
- dn,
1245
- pn,
1246
- mn
1249
+ hn,
1250
+ _n,
1251
+ gn,
1252
+ vn,
1253
+ yn
1247
1254
  ]
1248
1255
  }),
1249
1256
  /* @__PURE__ */ R("div", {
1250
- ref: kt,
1257
+ ref: Pt,
1251
1258
  style: {
1252
1259
  flex: 1,
1253
1260
  minHeight: 0,
1254
1261
  overflowY: "auto",
1255
- padding: `4px ${_n}px calc(24px + var(--safe-bottom))`,
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: [hn, sn && (Y || k) && m && /* @__PURE__ */ L("div", {
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(Be, {
1271
- nodes: b.sidebar,
1277
+ children: /* @__PURE__ */ L(Ve, {
1278
+ nodes: x.sidebar,
1272
1279
  ctx: $
1273
1280
  })
1274
1281
  })]
1275
1282
  }),
1276
- gn
1283
+ xn
1277
1284
  ]
1278
1285
  });
1279
1286
  }
1280
- function lt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties: i }) {
1287
+ function pt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties: i }) {
1281
1288
  let a = (e) => {
1282
- let a = H(t, e, n, r, i);
1289
+ let a = V(t, e, n, r, i);
1283
1290
  return a != null && h(a) !== "";
1284
- }, o = (e) => h(H(t, e, n, r, i)) || /* @__PURE__ */ L("span", {
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 ? 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));
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: U(t, e)
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
- U(t, e),
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 H(e, t, n, r, i) {
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 x(n?.status_name) || n?.status_code;
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 Se(e, n, t);
1410
+ return ge(e, n, t);
1404
1411
  }
1405
- function U(e, t) {
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 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] : [];
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: m,
1417
- entityCode: te ?? "",
1418
- screen: h,
1419
- screenRoute: h?.route ?? "",
1420
- selectedRows: v ? [v] : [],
1423
+ entity: p,
1424
+ entityCode: g ?? "",
1425
+ screen: m,
1426
+ screenRoute: m?.route ?? "",
1427
+ selectedRows: _ ? [_] : [],
1421
1428
  selectedIds: e,
1422
- locale: E,
1423
- tabNavigate: (e, t) => fe(e, {
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) => l(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
- E,
1437
- fe
1438
- ]), A = s ? f ? /* @__PURE__ */ L(a, {
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 ? _ : e.refresh, { size: 13 }),
1441
- onClick: ce,
1490
+ icon: L(T ? te : e.refresh, { size: 13 }),
1491
+ onClick: se,
1442
1492
  disabled: T,
1443
1493
  children: T ? "Restoring…" : "Restore"
1444
- }) : null : i ? /* @__PURE__ */ R(Ge, { children: [/* @__PURE__ */ L(a, {
1494
+ }) : null : a ? /* @__PURE__ */ R(Je, { children: [/* @__PURE__ */ L(o, {
1445
1495
  icon: /* @__PURE__ */ L(e.x, { size: 13 }),
1446
- onClick: C,
1496
+ onClick: w,
1447
1497
  disabled: u,
1448
1498
  children: "Cancel"
1449
- }), /* @__PURE__ */ L(a, {
1499
+ }), /* @__PURE__ */ L(o, {
1450
1500
  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,
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
- })] }) : !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
- });
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
- kind: "detail",
1473
- entityActions: m?.actions,
1474
- globalActions: g,
1475
- reservedRightWidth: 0,
1476
- widgetContext: be
1513
+ children: [we, A]
1477
1514
  }) : null;
1478
- return /* @__PURE__ */ L(z, {
1479
- icon: m?.display.icon ? /* @__PURE__ */ L(t, {
1480
- name: m.display.icon,
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: n,
1484
- recordId: r,
1485
- highlights: S,
1486
- mode: o ? "create" : i ? "edit" : "display",
1487
- dirty: c,
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: oe,
1490
- right: A
1491
- });
1526
+ onBack: C,
1527
+ right: Ee,
1528
+ showTitle: pe.isVisible("show_title")
1529
+ }), Te] });
1492
1530
  }
1493
1531
  //#endregion
1494
- export { ct as SmartDetailPage };
1532
+ export { ft as SmartDetailPage };