@declarion/react 0.34.0 → 0.35.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist-lib/{ActionRunner-UGGvGypS.js → ActionRunner-Bkkb_YMa.js} +1176 -1287
  3. package/dist-lib/{DraggableChildrenTable-CljdYXd_.js → DraggableChildrenTable-TNni9y0Q.js} +39 -39
  4. package/dist-lib/{Grid-5Y_iPqNW.js → Grid-DOtBLx3n.js} +2 -2
  5. package/dist-lib/{JsonEditor-KelPV-OQ.js → JsonEditor-DoNmyrYd.js} +2 -2
  6. package/dist-lib/{LayoutRenderer-CoTMmvNW.js → LayoutRenderer-CMuVgKev.js} +407 -405
  7. package/dist-lib/{MarkdownRenderer-unbncYEV.js → MarkdownRenderer-DWOlvx8k.js} +1 -1
  8. package/dist-lib/{MonacoJson-DVjwsaBK.js → MonacoJson-BfpzZ1iT.js} +1 -1
  9. package/dist-lib/{RefreshControl-oeKhCjEC.js → RefreshControl-CgU8mNEp.js} +92 -94
  10. package/dist-lib/{SmartDetailPage.impl-Caxd97q6.js → SmartDetailPage.impl-Bjl7EFzU.js} +321 -318
  11. package/dist-lib/{SmartRecordListPage.impl-BF_ieDc2.js → SmartRecordListPage.impl-D2eE-g5J.js} +248 -248
  12. package/dist-lib/assets/OFL-Inter.txt +93 -0
  13. package/dist-lib/assets/OFL-JetBrainsMono.txt +93 -0
  14. package/dist-lib/assets/inter-latin-ext-wght-normal.woff2 +0 -0
  15. package/dist-lib/assets/inter-latin-wght-normal.woff2 +0 -0
  16. package/dist-lib/assets/jetbrains-mono-latin-ext-wght-normal.woff2 +0 -0
  17. package/dist-lib/assets/jetbrains-mono-latin-wght-normal.woff2 +0 -0
  18. package/dist-lib/components/fields/cells/factories/host-icons.d.ts +9 -1
  19. package/dist-lib/components/layout/TopBar.d.ts +2 -1
  20. package/dist-lib/components/pages/list/DataCell.d.ts +1 -2
  21. package/dist-lib/components/primitives/Btn.d.ts +1 -1
  22. package/dist-lib/declarion-react.css +1 -1
  23. package/dist-lib/embed/theme.d.ts +8 -8
  24. package/dist-lib/hooks/useBrandingChrome.d.ts +28 -2
  25. package/dist-lib/hooks/useResponsiveMode.d.ts +17 -1
  26. package/dist-lib/index.js +1971 -1936
  27. package/dist-lib/lib/brand-tokens.d.ts +43 -0
  28. package/dist-lib/lib/html-state.d.ts +11 -0
  29. package/dist-lib/lib/versionTracker.d.ts +6 -0
  30. package/dist-lib/{registry-DnPK3Msj.js → registry-GTwsJEYp.js} +1425 -1299
  31. package/dist-lib/stores/page-state.d.ts +1 -1
  32. package/dist-lib/stores/preferences.d.ts +37 -0
  33. package/dist-lib/testing.js +25 -25
  34. package/dist-lib/types/api.d.ts +96 -16
  35. package/dist-lib/types/schema.d.ts +15 -0
  36. package/dist-lib/{useProperties-CgRhBh0k.js → useProperties-oNGJ7HwM.js} +41 -41
  37. package/dist-lib/{value-GmL5BVFm.js → value-DNs5L0Ad.js} +97 -97
  38. package/dist-lib/vite/fingerprint-plugin.d.ts +1 -1
  39. package/package.json +17 -16
  40. package/dist-lib/stores/appearance.d.ts +0 -37
@@ -1,9 +1,9 @@
1
1
  import { s as e, t } from "./DynamicIcon-BWO6QtNF.js";
2
- import { F as n, Gn as r, H as i, L as a, Mn as o, P as s, R as c, Rn as l, Un as u, Wn as d, Y as f, Yt as p, Z as m, _t as h, an as g, b as _, cn as v, dn as y, g as b, gt as ee, in as x, ln as S, lt as C, m as w, n as T, nt as E, on as te, ot as D, p as ne, pn as re, sn as ie, ut as O, v as ae, yn as k } from "./ActionRunner-UGGvGypS.js";
3
- import { I as oe, N as se, P as ce, S as le, b as ue, f as A, g as de, i as fe, l as pe, o as me, p as j, t as M, u as N } from "./RefreshControl-oeKhCjEC.js";
4
- import { $ as he, D as ge, G as _e, H as ve, K as ye, L as P, M as be, O as xe, Q as Se, U as Ce, W as we, X as Te, Z as Ee, _ as De, a as Oe, bt as ke, dt as Ae, et as je, ft as Me, i as Ne, nt as Pe, q as Fe, s as Ie, tt as Le, vt as Re, w as ze, z as Be } from "./registry-DnPK3Msj.js";
2
+ import { F as n, H as r, Hn as i, Jt as a, L as o, Ln as s, P as c, R as l, Un as u, Wn as d, Y as f, Z as p, an as m, b as h, cn as g, ct as _, et as v, fn as y, g as b, ht as x, in as S, it as C, jn as w, m as T, mt as ee, n as E, on as D, p as te, rn as ne, sn as re, st as O, un as ie, v as ae, vn as k } from "./ActionRunner-Bkkb_YMa.js";
3
+ import { I as oe, N as se, P as ce, S as le, f as A, h as j, i as ue, l as de, o as fe, t as M, u as N, v as pe, w as me } from "./RefreshControl-CgU8mNEp.js";
4
+ import { $ as he, D as ge, G as _e, H as ve, K as ye, L as P, M as be, O as xe, Q as Se, St as Ce, U as we, W as Te, X as Ee, Z as De, _ as Oe, a as ke, dt as Ae, et as je, ft as Me, i as Ne, nt as Pe, q as Fe, s as Ie, tt as Le, vt as Re, w as ze, z as Be } from "./registry-GTwsJEYp.js";
5
5
  import { n as Ve, r as He, t as Ue } from "./dataTableStyles-vwD1mVOP.js";
6
- import { n as We, t as Ge } from "./LayoutRenderer-CoTMmvNW.js";
6
+ import { n as We, t as Ge } from "./LayoutRenderer-CMuVgKev.js";
7
7
  import { Fragment as Ke, useCallback as F, useEffect as I, useMemo as L, useRef as qe, useState as R } from "react";
8
8
  import { useLocation as Je, useParams as Ye, useSearchParams as Xe } from "react-router-dom";
9
9
  import { useQuery as Ze, useQueryClient as Qe } from "@tanstack/react-query";
@@ -13,7 +13,7 @@ function et({ entityCode: e, recordId: n, associations: r, schema: i }) {
13
13
  let a = L(() => Object.entries(r), [r]), [o, s] = R(0);
14
14
  if (a.length === 0) return null;
15
15
  let [c, l] = a[o];
16
- return /* @__PURE__ */ z(ke, {
16
+ return /* @__PURE__ */ z(Ce, {
17
17
  title: /* @__PURE__ */ z("div", {
18
18
  style: {
19
19
  display: "flex",
@@ -46,7 +46,7 @@ function et({ entityCode: e, recordId: n, associations: r, schema: i }) {
46
46
  children: [n.display?.icon && /* @__PURE__ */ z(t, {
47
47
  name: n.display.icon,
48
48
  size: 13
49
- }), S(n.display?.name) || e]
49
+ }), g(n.display?.name) || e]
50
50
  }, e);
51
51
  })
52
52
  }),
@@ -61,111 +61,111 @@ function et({ entityCode: e, recordId: n, associations: r, schema: i }) {
61
61
  })
62
62
  });
63
63
  }
64
- function tt({ entityCode: t, recordId: n, assocKey: i, association: a, schema: o }) {
65
- let s = Ae(), c = ne(), l = `${t}.${i}`, { data: u, isLoading: d } = Ze({
64
+ function tt({ entityCode: t, recordId: n, assocKey: r, association: i, schema: a }) {
65
+ let o = Ae(), s = te(), c = `${t}.${r}`, { data: l, isLoading: u } = Ze({
66
66
  queryKey: [
67
67
  "association",
68
- l,
68
+ c,
69
69
  n
70
70
  ],
71
- queryFn: () => O(l, [n])
72
- }), f = u?.target_entity ?? a.target, p = o.entities[f], m = L(() => u?.ids ?? [], [u?.ids]), h = L(() => p?.fields.names().find((e) => p.fields.get(e)?.primary) ?? "id", [p]), g = L(() => m.slice(0, 50), [m]), { data: _, isLoading: v } = Ze({
71
+ queryFn: () => _(c, [n])
72
+ }), f = l?.target_entity ?? i.target, p = a.entities[f], h = L(() => l?.ids ?? [], [l?.ids]), v = L(() => p?.fields.names().find((e) => p.fields.get(e)?.primary) ?? "id", [p]), y = L(() => h.slice(0, 50), [h]), { data: b, isLoading: x } = Ze({
73
73
  queryKey: [
74
74
  "association-records",
75
75
  f,
76
- g
76
+ y
77
77
  ],
78
- queryFn: () => C(f, {
78
+ queryFn: () => O(f, {
79
79
  per_page: 50,
80
80
  filters: [{
81
- field: h,
81
+ field: v,
82
82
  op: "in",
83
- value: g
83
+ value: y
84
84
  }]
85
85
  }),
86
- enabled: g.length > 0 && !!p
87
- }), y = _?.data ?? [], b = _?.$refs, ee = L(() => p ? p.fields.names().filter((e) => {
86
+ enabled: y.length > 0 && !!p
87
+ }), S = b?.data ?? [], C = b?.$refs, w = L(() => p ? p.fields.names().filter((e) => {
88
88
  let t = p.fields.get(e);
89
89
  return t && !t.primary && !t.auto && t.display?.is_listable !== !1;
90
- }).slice(0, 6) : [], [p]), x = () => {
91
- let e = P(o, f);
90
+ }).slice(0, 6) : [], [p]), ee = () => {
91
+ let e = P(a, f);
92
92
  if (!e) return;
93
- let t = S(a.display?.name) || i, n = new URLSearchParams();
93
+ let t = g(i.display?.name) || r, n = new URLSearchParams();
94
94
  n.set("filters", JSON.stringify([{
95
- field: h,
95
+ field: v,
96
96
  op: "in",
97
- value: m
98
- }])), s(e.route, {
97
+ value: h
98
+ }])), o(e.route, {
99
99
  title: t,
100
- icon: a.display?.icon || e.icon,
100
+ icon: i.display?.icon || e.icon,
101
101
  search: n.toString()
102
102
  });
103
- }, T = {
103
+ }, E = {
104
104
  fontSize: 12.5,
105
105
  color: "var(--text-3)",
106
106
  padding: "14px 16px"
107
107
  };
108
- if (d || v) return /* @__PURE__ */ z("div", {
109
- style: T,
108
+ if (u || x) return /* @__PURE__ */ z("div", {
109
+ style: E,
110
110
  children: "Loading…"
111
111
  });
112
112
  if (!p) return /* @__PURE__ */ z("div", {
113
- style: T,
113
+ style: E,
114
114
  children: "Entity not found."
115
115
  });
116
- if (m.length === 0) return /* @__PURE__ */ z("div", {
117
- style: T,
116
+ if (h.length === 0) return /* @__PURE__ */ z("div", {
117
+ style: E,
118
118
  children: "No related records."
119
119
  });
120
- let E = P(o, f);
120
+ let D = P(a, f);
121
121
  return /* @__PURE__ */ B("div", {
122
122
  style: { padding: "8px 0" },
123
123
  children: [
124
124
  /* @__PURE__ */ B("table", {
125
125
  style: He,
126
- children: [/* @__PURE__ */ z("thead", { children: /* @__PURE__ */ z("tr", { children: ee.map((e) => /* @__PURE__ */ z("th", {
126
+ children: [/* @__PURE__ */ z("thead", { children: /* @__PURE__ */ z("tr", { children: w.map((e) => /* @__PURE__ */ z("th", {
127
127
  style: Ve,
128
- children: te(p.fields.get(e), e, o.entities)
129
- }, e)) }) }), /* @__PURE__ */ z("tbody", { children: y.map((e, t) => /* @__PURE__ */ z("tr", { children: ee.map((t) => {
128
+ children: m(p.fields.get(e), e, a.entities)
129
+ }, e)) }) }), /* @__PURE__ */ z("tbody", { children: S.map((e, t) => /* @__PURE__ */ z("tr", { children: w.map((t) => {
130
130
  let n = p.fields.get(t);
131
131
  return n ? /* @__PURE__ */ z("td", {
132
132
  style: Ue,
133
- children: w({
133
+ children: T({
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: c
139
+ refs: C,
140
+ locale: s
141
141
  })
142
142
  }, t) : /* @__PURE__ */ z("td", {}, t);
143
143
  }) }, t)) })]
144
144
  }),
145
- E && u && u.count > y.length && /* @__PURE__ */ z("div", {
145
+ D && l && l.count > S.length && /* @__PURE__ */ z("div", {
146
146
  style: {
147
147
  padding: "10px 16px",
148
148
  textAlign: "center"
149
149
  },
150
- children: /* @__PURE__ */ B(r, {
150
+ children: /* @__PURE__ */ B(d, {
151
151
  icon: /* @__PURE__ */ z(e.external, { size: 12 }),
152
- onClick: x,
152
+ onClick: ee,
153
153
  children: [
154
154
  "View all ",
155
- u.count,
155
+ l.count,
156
156
  " records"
157
157
  ]
158
158
  })
159
159
  }),
160
- E && y.length > 0 && u && u.count <= y.length && /* @__PURE__ */ z("div", {
160
+ D && S.length > 0 && l && l.count <= S.length && /* @__PURE__ */ z("div", {
161
161
  style: {
162
162
  padding: "10px 16px",
163
163
  textAlign: "center"
164
164
  },
165
- children: /* @__PURE__ */ z(r, {
165
+ children: /* @__PURE__ */ z(d, {
166
166
  kind: "ghost",
167
167
  icon: /* @__PURE__ */ z(e.external, { size: 12 }),
168
- onClick: x,
168
+ onClick: ee,
169
169
  children: "Open in list view"
170
170
  })
171
171
  })
@@ -185,14 +185,14 @@ function it({ entityCode: t, objectId: n, canGenerateOne: r, canManageTemplates:
185
185
  t,
186
186
  n
187
187
  ],
188
- queryFn: async () => (await D("document.object_links", {
188
+ queryFn: async () => (await C("document.object_links", {
189
189
  entity: t,
190
190
  object_id: n
191
191
  })).result?.documents ?? [],
192
192
  enabled: !!(t && n) && (!!r || !!i),
193
193
  refetchInterval: (e) => rt(e.state.data)
194
194
  }), c = (a?.length ?? 0) > 0;
195
- return !r && !c ? null : /* @__PURE__ */ B(ke, {
195
+ return !r && !c ? null : /* @__PURE__ */ B(Ce, {
196
196
  title: /* @__PURE__ */ z(V, {}),
197
197
  collapsible: !1,
198
198
  padding: "0",
@@ -238,49 +238,49 @@ function V() {
238
238
  children: [/* @__PURE__ */ z(e.file, { size: 13 }), "Documents"]
239
239
  });
240
240
  }
241
- function at({ entityCode: t, objectId: n, doc: i }) {
242
- let o = Qe(), [s, l] = R(!1), [u, d] = R(!1), [f, p] = R(!1), [m, h] = R(!1), [g, _] = R(null), v = S(i.title) || i.filename || i.template_code, y = i.status === "ready" && i.download_url && !m;
243
- async function b() {
244
- l(!0), _(null);
241
+ function at({ entityCode: t, objectId: n, doc: r }) {
242
+ let i = Qe(), [a, s] = R(!1), [c, u] = R(!1), [f, p] = R(!1), [m, h] = R(!1), [_, v] = R(null), y = g(r.title) || r.filename || r.template_code, b = r.status === "ready" && r.download_url && !m;
243
+ async function x() {
244
+ s(!0), v(null);
245
245
  try {
246
- let e = (await D("document.download_format", {
247
- generated_document_id: i.generated_document_id,
246
+ let e = (await C("document.download_format", {
247
+ generated_document_id: r.generated_document_id,
248
248
  format: "pdf"
249
249
  })).result;
250
- e?.download_url && await a(e.download_url, e.filename);
250
+ e?.download_url && await o(e.download_url, e.filename);
251
251
  } catch (e) {
252
- c(e) ? (h(!0), _("Artifact unavailable")) : _(e instanceof Error ? e.message : String(e));
252
+ l(e) ? (h(!0), v("Artifact unavailable")) : v(e instanceof Error ? e.message : String(e));
253
253
  } finally {
254
- l(!1);
254
+ s(!1);
255
255
  }
256
256
  }
257
- async function ee() {
258
- if (i.download_url) {
259
- d(!0), _(null);
257
+ async function S() {
258
+ if (r.download_url) {
259
+ u(!0), v(null);
260
260
  try {
261
- await a(i.download_url, i.filename);
261
+ await o(r.download_url, r.filename);
262
262
  } catch (e) {
263
- c(e) ? (h(!0), _("Artifact unavailable")) : _(e instanceof Error ? e.message : String(e));
263
+ l(e) ? (h(!0), v("Artifact unavailable")) : v(e instanceof Error ? e.message : String(e));
264
264
  } finally {
265
- d(!1);
265
+ u(!1);
266
266
  }
267
267
  }
268
268
  }
269
- async function x() {
270
- p(!0), _(null);
269
+ async function w() {
270
+ p(!0), v(null);
271
271
  try {
272
- await D("document.generate", {
273
- ...i.input ?? {},
274
- template_code: i.template_code,
275
- template_source: i.template_source,
276
- output_format: i.output_format
277
- }), await o.invalidateQueries({ queryKey: [
272
+ await C("document.generate", {
273
+ ...r.input ?? {},
274
+ template_code: r.template_code,
275
+ template_source: r.template_source,
276
+ output_format: r.output_format
277
+ }), await i.invalidateQueries({ queryKey: [
278
278
  j,
279
279
  t,
280
280
  n
281
281
  ] });
282
282
  } catch (e) {
283
- _(e instanceof Error ? e.message : String(e));
283
+ v(e instanceof Error ? e.message : String(e));
284
284
  } finally {
285
285
  p(!1);
286
286
  }
@@ -306,7 +306,7 @@ function at({ entityCode: t, objectId: n, doc: i }) {
306
306
  textOverflow: "ellipsis",
307
307
  whiteSpace: "nowrap"
308
308
  },
309
- children: v
309
+ children: y
310
310
  }),
311
311
  /* @__PURE__ */ B("div", {
312
312
  style: {
@@ -318,60 +318,60 @@ function at({ entityCode: t, objectId: n, doc: i }) {
318
318
  fontSize: 11.5
319
319
  },
320
320
  children: [
321
- /* @__PURE__ */ z("span", { children: i.output_format.toUpperCase() }),
322
- /* @__PURE__ */ z("span", { children: m ? "artifact unavailable" : i.status }),
323
- /* @__PURE__ */ z("span", { children: i.ready_at || i.created_at })
321
+ /* @__PURE__ */ z("span", { children: r.output_format.toUpperCase() }),
322
+ /* @__PURE__ */ z("span", { children: m ? "artifact unavailable" : r.status }),
323
+ /* @__PURE__ */ z("span", { children: r.ready_at || r.created_at })
324
324
  ]
325
325
  }),
326
- i.status === "failed" && i.error_text && /* @__PURE__ */ z("div", {
326
+ r.status === "failed" && r.error_text && /* @__PURE__ */ z("div", {
327
327
  style: {
328
328
  marginTop: 5,
329
329
  color: "var(--danger)",
330
330
  fontSize: 12
331
331
  },
332
- children: i.error_text
332
+ children: r.error_text
333
333
  }),
334
- g && /* @__PURE__ */ z("div", {
334
+ _ && /* @__PURE__ */ z("div", {
335
335
  style: {
336
336
  marginTop: 5,
337
337
  color: "var(--danger)",
338
338
  fontSize: 12
339
339
  },
340
- children: g
340
+ children: _
341
341
  })
342
342
  ]
343
- }), y ? /* @__PURE__ */ B("div", {
343
+ }), b ? /* @__PURE__ */ B("div", {
344
344
  style: {
345
345
  display: "flex",
346
346
  gap: 6
347
347
  },
348
- children: [/* @__PURE__ */ z(r, {
348
+ children: [/* @__PURE__ */ z(d, {
349
349
  kind: "ghost",
350
350
  size: "sm",
351
- icon: z(s ? e.loader : e.file, { size: 12 }),
352
- onClick: b,
353
- disabled: s,
351
+ icon: z(a ? e.loader : e.file, { size: 12 }),
352
+ onClick: x,
353
+ disabled: a,
354
354
  children: "PDF"
355
- }), /* @__PURE__ */ z(r, {
355
+ }), /* @__PURE__ */ z(d, {
356
356
  kind: "default",
357
357
  size: "sm",
358
- icon: z(u ? e.loader : e.download, { size: 12 }),
359
- onClick: ee,
360
- disabled: u,
358
+ icon: z(c ? e.loader : e.download, { size: 12 }),
359
+ onClick: S,
360
+ disabled: c,
361
361
  children: "Download"
362
362
  })]
363
- }) : m ? /* @__PURE__ */ z(r, {
363
+ }) : m ? /* @__PURE__ */ z(d, {
364
364
  kind: "ghost",
365
365
  size: "sm",
366
366
  icon: z(f ? e.loader : e.file, { size: 12 }),
367
- onClick: x,
367
+ onClick: w,
368
368
  disabled: f,
369
369
  children: "Regenerate"
370
- }) : /* @__PURE__ */ z(r, {
370
+ }) : /* @__PURE__ */ z(d, {
371
371
  kind: "ghost",
372
372
  size: "sm",
373
373
  disabled: !0,
374
- children: i.status === "pending" ? "Pending" : "Unavailable"
374
+ children: r.status === "pending" ? "Pending" : "Unavailable"
375
375
  })]
376
376
  });
377
377
  }
@@ -513,20 +513,20 @@ function st({ items: e }) {
513
513
  }
514
514
  //#endregion
515
515
  //#region src/components/detail-layout/DetailHighlights.tsx
516
- function ct({ screen: e, entity: t, entityCode: n, record: r, refs: i, objectStatuses: a, schema: o, locale: s }) {
517
- let c = e.highlights;
518
- if (!c || c.length === 0) return null;
519
- let l = [];
520
- for (let e of c) {
521
- let c = t.status_groups?.[e];
522
- if (c) {
523
- let t = a?.find((t) => t.group_code === e), n = t ? c.statuses.find((e) => e.code === t.status_code) : void 0;
524
- l.push({
525
- label: S(c.name),
526
- value: n ? /* @__PURE__ */ z(u, {
516
+ function ct({ screen: e, entity: t, entityCode: n, record: r, refs: a, objectStatuses: o, schema: s, locale: c }) {
517
+ let l = e.highlights;
518
+ if (!l || l.length === 0) return null;
519
+ let u = [];
520
+ for (let e of l) {
521
+ let l = t.status_groups?.[e];
522
+ if (l) {
523
+ let t = o?.find((t) => t.group_code === e), n = t ? l.statuses.find((e) => e.code === t.status_code) : void 0;
524
+ u.push({
525
+ label: g(l.name),
526
+ value: n ? /* @__PURE__ */ z(i, {
527
527
  tone: n.color ?? "slate",
528
528
  size: "xs",
529
- children: S(n.name)
529
+ children: g(n.name)
530
530
  }) : /* @__PURE__ */ z("span", {
531
531
  style: { color: "var(--text-4)" },
532
532
  children: "—"
@@ -535,26 +535,26 @@ function ct({ screen: e, entity: t, entityCode: n, record: r, refs: i, objectSta
535
535
  continue;
536
536
  }
537
537
  if (t.fields.get(e) || t.files?.get(e)) {
538
- let a = je({
538
+ let i = je({
539
539
  entity: t,
540
540
  entityCode: n,
541
541
  fieldName: e,
542
542
  record: r,
543
543
  mode: "display",
544
- refs: i,
545
- entities: o.entities,
546
- screens: o.screens,
544
+ refs: a,
545
+ entities: s.entities,
546
+ screens: s.screens,
547
547
  surface: "list",
548
- locale: s
548
+ locale: c
549
549
  });
550
- l.push({
551
- label: Le(t, e, o.entities),
552
- value: a
550
+ u.push({
551
+ label: Le(t, e, s.entities),
552
+ value: i
553
553
  });
554
554
  continue;
555
555
  }
556
556
  }
557
- return l.length === 0 ? null : /* @__PURE__ */ z(st, { items: l });
557
+ return u.length === 0 ? null : /* @__PURE__ */ z(st, { items: u });
558
558
  }
559
559
  //#endregion
560
560
  //#region src/components/shared/AuditMetaStrip.tsx
@@ -640,7 +640,7 @@ function ut({ screen: e, entity: t, entityCode: n, record: r, refs: i, schema: a
640
640
  });
641
641
  };
642
642
  return /* @__PURE__ */ z(lt, { lines: s?.lines && s.lines.length > 0 ? s.lines.map((e) => ({
643
- label: S(e.label),
643
+ label: g(e.label),
644
644
  at: c(e.at),
645
645
  by: c(e.by)
646
646
  })) : [{
@@ -655,8 +655,8 @@ function ut({ screen: e, entity: t, entityCode: n, record: r, refs: i, schema: a
655
655
  }
656
656
  //#endregion
657
657
  //#region src/components/shared/RecordHeader.tsx
658
- function G({ icon: t, avatarName: n, title: r, recordId: i, description: a, highlights: o, mode: s, dirty: c = !1, showBack: f = !1, onBack: p, right: m, showTitle: h = !0 }) {
659
- let g = l(), _ = g.category === "phone" || g.width <= 520;
658
+ function G({ icon: t, avatarName: n, title: r, recordId: a, description: o, highlights: c, mode: l, dirty: d = !1, showBack: f = !1, onBack: p, right: m, showTitle: h = !0 }) {
659
+ let g = s(), _ = g.category === "phone" || g.width <= 520;
660
660
  return /* @__PURE__ */ B("div", {
661
661
  style: {
662
662
  display: "flex",
@@ -671,7 +671,7 @@ function G({ icon: t, avatarName: n, title: r, recordId: i, description: a, high
671
671
  paddingTop: 4,
672
672
  flexShrink: 0
673
673
  },
674
- children: /* @__PURE__ */ z(d, {
674
+ children: /* @__PURE__ */ z(u, {
675
675
  size: 26,
676
676
  icon: /* @__PURE__ */ z(e.back, { size: 14 }),
677
677
  title: "Back",
@@ -716,10 +716,10 @@ function G({ icon: t, avatarName: n, title: r, recordId: i, description: a, high
716
716
  /* @__PURE__ */ z("h1", {
717
717
  style: {
718
718
  margin: 0,
719
- fontSize: "var(--font-size-page-title, 19px)",
719
+ fontSize: "var(--page-title-size, var(--page-title-size-detail))",
720
720
  fontWeight: 600,
721
721
  letterSpacing: 0,
722
- lineHeight: 1.2,
722
+ lineHeight: "var(--page-title-line-height, var(--page-title-line-height-detail))",
723
723
  color: "var(--text)",
724
724
  minWidth: 0,
725
725
  overflow: "hidden",
@@ -730,12 +730,12 @@ function G({ icon: t, avatarName: n, title: r, recordId: i, description: a, high
730
730
  },
731
731
  children: r
732
732
  }),
733
- i && /* @__PURE__ */ z(se, { value: i }),
734
- a && /* @__PURE__ */ z(ce, {
735
- label: a,
733
+ a && /* @__PURE__ */ z(se, { value: a }),
734
+ o && /* @__PURE__ */ z(ce, {
735
+ label: o,
736
736
  "data-testid": "detail-description-info"
737
737
  }),
738
- s === "edit" && c && /* @__PURE__ */ B("span", {
738
+ l === "edit" && d && /* @__PURE__ */ B("span", {
739
739
  style: {
740
740
  display: "inline-flex",
741
741
  alignItems: "center",
@@ -750,16 +750,16 @@ function G({ icon: t, avatarName: n, title: r, recordId: i, description: a, high
750
750
  background: "var(--warn)"
751
751
  } }), "Unsaved"]
752
752
  }),
753
- s === "create" && /* @__PURE__ */ z(u, {
753
+ l === "create" && /* @__PURE__ */ z(i, {
754
754
  tone: "violet",
755
755
  size: "xs",
756
756
  dot: !0,
757
757
  children: "New record"
758
758
  })
759
759
  ]
760
- }), o && s === "display" && /* @__PURE__ */ z("div", {
760
+ }), c && l === "display" && /* @__PURE__ */ z("div", {
761
761
  style: { marginTop: 8 },
762
- children: o
762
+ children: c
763
763
  })]
764
764
  }),
765
765
  m && /* @__PURE__ */ z("div", {
@@ -838,7 +838,7 @@ function _t(e, t) {
838
838
  }
839
839
  function vt(e, t) {
840
840
  if (e) {
841
- let n = re(g(e, t));
841
+ let n = y(S(e, t));
842
842
  if (n.replace(/^\|+|\|+$/g, "")) return n;
843
843
  }
844
844
  return t.id == null ? crypto.randomUUID() : k(t.id);
@@ -847,19 +847,19 @@ function yt({ screenCode: e }) {
847
847
  return /* @__PURE__ */ z(b, { children: /* @__PURE__ */ z(K, { screenCode: e }) });
848
848
  }
849
849
  function K({ screenCode: t }) {
850
- let { id: r } = Ye(), a = i(), [o, c] = Xe(), { data: u } = ee(), b = h((e) => e.user), C = ae(), w = l(), T = u?.screens[t], E = T?.entity ? u?.entities[T.entity] : void 0, D = T?.entity, O = x(E, "create"), k = x(E, "update"), oe = x(E, "delete"), se = x(E, "restore"), ce = (() => {
851
- if (!E || !E.singleton || !E.prefilter) return;
852
- let e = v(E);
850
+ let { id: i } = Ye(), o = r(), [l, d] = Xe(), { data: _ } = ee(), v = x((e) => e.user), b = ae(), C = s(), w = _?.screens[t], T = w?.entity ? _?.entities[w.entity] : void 0, E = w?.entity, O = ne(T, "create"), k = ne(T, "update"), oe = ne(T, "delete"), se = ne(T, "restore"), ce = (() => {
851
+ if (!T || !T.singleton || !T.prefilter) return;
852
+ let e = re(T);
853
853
  if (e.length !== 1) return;
854
- let t = E.prefilter[e[0]];
855
- if (t === "$caller.user_id") return b?.id;
856
- if (t === "$caller.tenant_id") return b?.tenant?.id;
857
- })(), A = ce !== void 0, j = A ? ce : r, M = !A && j === "new", N = L(() => {
854
+ let t = T.prefilter[e[0]];
855
+ if (t === "$caller.user_id") return v?.id;
856
+ if (t === "$caller.tenant_id") return v?.tenant?.id;
857
+ })(), A = ce !== void 0, j = A ? ce : i, M = !A && j === "new", N = L(() => {
858
858
  if (!j || M) return;
859
- if (!E) return j;
860
- let e = v(E);
859
+ if (!T) return j;
860
+ let e = re(T);
861
861
  if (e.length === 1) return { [e[0]]: j };
862
- let t = y(j, e.length);
862
+ let t = ie(j, e.length);
863
863
  if (!t) return;
864
864
  let n = {};
865
865
  for (let r = 0; r < e.length; r++) n[e[r]] = t[r] ?? "";
@@ -867,15 +867,15 @@ function K({ screenCode: t }) {
867
867
  }, [
868
868
  j,
869
869
  M,
870
- E
870
+ T
871
871
  ]), ge = L(() => {
872
- if (N) return typeof N == "string" ? N : re(N);
873
- }, [N]), P = Oe(D, N), { data: be, isLoading: xe, error: ke } = P, Ae = Fe((e) => e.degradedEntities), je = D ? ye(E?.realtime, Ae, D) : !1;
874
- de(Ne(D, N), !M);
875
- let Le = ve(D ?? ""), Be = _e(D ?? ""), Ve = Ce(D ?? ""), He = we(D ?? ""), Ue = Object.keys(E?.status_groups ?? {}).length > 0, Ke = be?.data, Ze = Ke?.$statuses, Qe = Ke?.$properties, tt = o.get("edit") === "true", [nt, rt] = R(M || tt), [V, at] = R({}), [H, st] = R({}), [U, lt] = R({}), [W, G] = R(void 0), [ft, mt] = R(!1), [yt, K] = R(void 0), [xt, St] = R({ show: !1 }), [wt, Tt] = R(!1), Et = M ? O : k, q = nt && Et, Dt = m();
872
+ if (N) return typeof N == "string" ? N : y(N);
873
+ }, [N]), P = ke(E, N), { data: be, isLoading: xe, error: Ce } = P, Ae = Fe((e) => e.degradedEntities), je = E ? ye(T?.realtime, Ae, E) : !1;
874
+ pe(Ne(E, N), !M);
875
+ let Le = ve(E ?? ""), Be = _e(E ?? ""), Ve = we(E ?? ""), He = Te(E ?? ""), Ue = Object.keys(T?.status_groups ?? {}).length > 0, Ke = be?.data, Ze = Ke?.$statuses, Qe = Ke?.$properties, tt = l.get("edit") === "true", [nt, rt] = R(M || tt), [V, at] = R({}), [H, st] = R({}), [U, lt] = R({}), [W, G] = R(void 0), [ft, mt] = R(!1), [yt, K] = R(void 0), [xt, St] = R({ show: !1 }), [wt, Tt] = R(!1), Et = M ? O : k, q = nt && Et, Dt = p();
876
876
  f(q && !M, Dt.enabled);
877
877
  let [Ot, kt] = R(() => {
878
- let e = parseInt(T?.sidebar_width || "380", 10);
878
+ let e = parseInt(w?.sidebar_width || "380", 10);
879
879
  return isNaN(e) ? 380 : e;
880
880
  }), At = qe(null), J = qe(null), jt = F((e) => {
881
881
  e.preventDefault();
@@ -900,18 +900,18 @@ function K({ screenCode: t }) {
900
900
  let e = Nt.current;
901
901
  Nt.current = X, e && e !== X && nt && mt(!0);
902
902
  }, [nt, X]);
903
- let Pt = !!E?.soft_delete, Ft = Pt && Y != null && Y[E.soft_delete] != null, Z = Je(), It = qe(null);
904
- me({ scrollElementRef: It });
905
- let Lt = !M && ke instanceof p && ke.status === 404, Rt = qe(null);
903
+ let Pt = !!T?.soft_delete, Ft = Pt && Y != null && Y[T.soft_delete] != null, Z = Je(), It = qe(null);
904
+ fe({ scrollElementRef: It });
905
+ let Lt = !M && Ce instanceof a && Ce.status === 404, Rt = qe(null);
906
906
  I(() => {
907
907
  if (!Lt) return;
908
- let e = ue(Z);
909
- Rt.current !== e && (Rt.current = e, le.getState().kill(e));
908
+ let e = le(Z);
909
+ Rt.current !== e && (Rt.current = e, me.getState().kill(e));
910
910
  }, [Lt, Z]);
911
911
  let { openTab: zt, updateTabTitle: Bt, findTabByPathname: Vt } = Re();
912
912
  I(() => {
913
- if (!E || A || Dt.enabled) return;
914
- let e = Z.pathname, t = S(T?.display?.name) || S(E.display.name), n = T?.display?.icon || E.display.icon;
913
+ if (!T || A || Dt.enabled) return;
914
+ let e = Z.pathname, t = g(w?.display?.name) || g(T.display.name), n = w?.display?.icon || T.display.icon;
915
915
  Vt(e) || zt({
916
916
  pathname: e,
917
917
  search: "",
@@ -921,48 +921,48 @@ function K({ screenCode: t }) {
921
921
  });
922
922
  }, [
923
923
  Z.pathname,
924
- T?.display?.name?.en,
925
- E?.display.name?.en,
926
- T?.display?.icon,
927
- E?.display.icon,
924
+ w?.display?.name?.en,
925
+ T?.display.name?.en,
926
+ w?.display?.icon,
927
+ T?.display.icon,
928
928
  M,
929
929
  A,
930
930
  Dt.enabled
931
931
  ]), I(() => {
932
- if (!Y || !E || A || Dt.enabled) return;
932
+ if (!Y || !T || A || Dt.enabled) return;
933
933
  let e = Vt(Z.pathname);
934
934
  if (e) {
935
- let t = S(T?.display?.name) || S(E.display.name), n = ie(Y, E), r = n && !String(n).startsWith("/") ? String(n) : t;
935
+ let t = g(w?.display?.name) || g(T.display.name), n = D(Y, T), r = n && !String(n).startsWith("/") ? String(n) : t;
936
936
  Bt(e.id, r);
937
937
  }
938
938
  }, [
939
939
  Y,
940
- E?.display.name?.en,
941
- E?.display.display_field,
940
+ T?.display.name?.en,
941
+ T?.display.display_field,
942
942
  Z.pathname,
943
943
  A,
944
944
  Dt.enabled
945
945
  ]);
946
946
  let Ht = L(() => {
947
- if (!E || !Et) return /* @__PURE__ */ new Set();
947
+ if (!T || !Et) return /* @__PURE__ */ new Set();
948
948
  let e = /* @__PURE__ */ new Set();
949
- for (let [t, n] of E.fields) !n.auto && !n.primary && e.add(t);
950
- for (let [t] of E.files ?? []) e.add(t);
949
+ for (let [t, n] of T.fields) !n.auto && !n.primary && e.add(t);
950
+ for (let [t] of T.files ?? []) e.add(t);
951
951
  return e;
952
- }, [E, Et]);
952
+ }, [T, Et]);
953
953
  I(() => {
954
- if (!(!tt || !Y || !E || !k)) {
954
+ if (!(!tt || !Y || !T || !k)) {
955
955
  if (nt || rt(!0), Object.keys(V).length === 0) {
956
- let e = j ? fe(j) : null;
957
- e && Ee(Te({
958
- entity: E,
956
+ let e = j ? ue(j) : null;
957
+ e && De(Ee({
958
+ entity: T,
959
959
  formData: e,
960
960
  record: void 0,
961
961
  isNew: !0
962
962
  })).forEach((e) => {
963
- C.registerDraft({
963
+ b.registerDraft({
964
964
  fileId: e,
965
- discard: () => _(e)
965
+ discard: () => h(e)
966
966
  });
967
967
  });
968
968
  let t = {};
@@ -972,16 +972,16 @@ function K({ screenCode: t }) {
972
972
  t[n] = r;
973
973
  return;
974
974
  }
975
- let i = he(E, Y, n);
976
- t[n] = Se(E, n) ? i ?? null : i ?? "";
975
+ let i = he(T, Y, n);
976
+ t[n] = Se(T, n) ? i ?? null : i ?? "";
977
977
  }), at(t);
978
978
  }
979
- if (E.children !== void 0 && E.children.length > 0 && W === void 0) {
979
+ if (T.children !== void 0 && T.children.length > 0 && W === void 0) {
980
980
  let e = Y.$children;
981
981
  if (e && Object.keys(e).length > 0) {
982
982
  let t = {};
983
983
  for (let [n, r] of Object.entries(e)) {
984
- let e = u?.entities[n];
984
+ let e = _?.entities[n];
985
985
  t[n] = r.map((t) => ({
986
986
  ...t,
987
987
  _key: vt(e, t)
@@ -990,7 +990,7 @@ function K({ screenCode: t }) {
990
990
  G(t), K(e);
991
991
  } else G({}), K({});
992
992
  }
993
- c((e) => {
993
+ d((e) => {
994
994
  let t = new URLSearchParams(e);
995
995
  return t.delete("edit"), t;
996
996
  }, { replace: !0 });
@@ -1000,72 +1000,75 @@ function K({ screenCode: t }) {
1000
1000
  Y,
1001
1001
  Ht,
1002
1002
  k,
1003
- E,
1003
+ T,
1004
1004
  W,
1005
- u
1005
+ _
1006
1006
  ]), I(() => {
1007
- !M || !O || !E?.children || E.children.length === 0 || W === void 0 && (G({}), K({}));
1007
+ !M || !O || !T?.children || T.children.length === 0 || W === void 0 && (G({}), K({}));
1008
1008
  }, [
1009
1009
  M,
1010
1010
  O,
1011
- E?.children
1011
+ T?.children
1012
1012
  ]);
1013
1013
  let Ut = F(async () => {
1014
- await C.flushAllDrafts(), M ? a(T?.route?.replace("/:id", "") ?? "/") : (rt(!1), at({}), st({}), lt({}), G(void 0), K(void 0), Tt(!1));
1014
+ if (await b.flushAllDrafts(), M) {
1015
+ let e = w?.route?.replace("/:id", "") ?? "/";
1016
+ o(e);
1017
+ } else rt(!1), at({}), st({}), lt({}), G(void 0), K(void 0), Tt(!1);
1015
1018
  }, [
1016
- C,
1019
+ b,
1017
1020
  M,
1018
- T,
1019
- a
1021
+ w,
1022
+ o
1020
1023
  ]), Wt = F((e, t) => {
1021
1024
  at((n) => ({
1022
1025
  ...n,
1023
1026
  [e]: t
1024
1027
  }));
1025
1028
  }, []), Q = L(() => {
1026
- if (!T?.route) return "/";
1027
- let e = T.route.split("/");
1029
+ if (!w?.route) return "/";
1030
+ let e = w.route.split("/");
1028
1031
  return e.pop(), e.join("/") || "/";
1029
- }, [T]), Gt = L(() => !u?.screens || !Q || Q === "/" ? !1 : Object.values(u.screens).some((e) => e.route === Q), [u, Q]), Kt = De({ fallback: F(() => {
1032
+ }, [w]), Gt = L(() => !_?.screens || !Q || Q === "/" ? !1 : Object.values(_.screens).some((e) => e.route === Q), [_, Q]), Kt = Oe({ fallback: F(() => {
1030
1033
  if (!Gt) {
1031
- a("/");
1034
+ o("/");
1032
1035
  return;
1033
1036
  }
1034
1037
  let e = Vt(Q)?.search ?? "";
1035
- a(e ? `${Q}?${e}` : Q);
1038
+ o(e ? `${Q}?${e}` : Q);
1036
1039
  }, [
1037
1040
  Gt,
1038
1041
  Q,
1039
1042
  Vt,
1040
- a
1041
- ]) }), qt = !A && (Kt.hasOriginBack || Kt.allowFallbackBack && !!Gt), Jt = ne(), Yt = L(() => {
1042
- if (!E) return {};
1043
+ o
1044
+ ]) }), qt = !A && (Kt.hasOriginBack || Kt.allowFallbackBack && !!Gt), Jt = te(), Yt = L(() => {
1045
+ if (!T) return {};
1043
1046
  let e = {};
1044
- for (let t of dt(E, V, M)) Ht.has(t) && (e[t] = "Required");
1045
- for (let t of pt(E, V)) Ht.has(t) && (e[t] = "Invalid email address");
1047
+ for (let t of dt(T, V, M)) Ht.has(t) && (e[t] = "Required");
1048
+ for (let t of pt(T, V)) Ht.has(t) && (e[t] = "Invalid email address");
1046
1049
  return e;
1047
1050
  }, [
1048
- E,
1051
+ T,
1049
1052
  V,
1050
1053
  M,
1051
1054
  Ht
1052
1055
  ]), Xt = Object.keys(Yt).length > 0, Zt = F(() => {
1053
- if (!D || !E || M && !O || !M && !k || (Tt(!0), Xt)) return;
1054
- let e = {}, t = Te({
1055
- entity: E,
1056
+ if (!E || !T || M && !O || !M && !k || (Tt(!0), Xt)) return;
1057
+ let e = {}, t = Ee({
1058
+ entity: T,
1056
1059
  formData: V,
1057
1060
  record: Y,
1058
1061
  isNew: M
1059
- }), n = Ee(t);
1062
+ }), n = De(t);
1060
1063
  if (M) for (let [t, n] of Object.entries(V)) {
1061
- if (E.files?.has(t)) continue;
1062
- let r = Pe(E, t, n);
1064
+ if (T.files?.has(t)) continue;
1065
+ let r = Pe(T, t, n);
1063
1066
  r !== "" && r != null && (e[t] = r);
1064
1067
  }
1065
1068
  else {
1066
1069
  for (let [t, n] of Object.entries(V)) {
1067
- if (E.files?.has(t)) continue;
1068
- let r = Y ? he(E, Y, t) : void 0, i = Pe(E, t, n), a = Pe(E, t, r);
1070
+ if (T.files?.has(t)) continue;
1071
+ let r = Y ? he(T, Y, t) : void 0, i = Pe(T, t, n), a = Pe(T, t, r);
1069
1072
  (i === "" ? null : i) !== (a === "" || a === void 0 ? null : a) && (e[t] = i);
1070
1073
  }
1071
1074
  X && (e.$row_version = X);
@@ -1095,26 +1098,26 @@ function K({ screenCode: t }) {
1095
1098
  rt(!1), mt(!1), Tt(!1), st({}), lt({}), G(void 0), K(void 0);
1096
1099
  };
1097
1100
  M ? Le.mutate(e, { onSuccess: (e) => {
1098
- n.forEach((e) => C.markCommitted(e));
1099
- let t = e.data, i = re(E ? g(E, t) : {});
1100
- a(i ? `${Q}/${encodeURIComponent(i)}` : Q, { replace: !0 }), r();
1101
+ n.forEach((e) => b.markCommitted(e));
1102
+ let t = e.data, i = y(T ? S(T, t) : {});
1103
+ o(i ? `${Q}/${encodeURIComponent(i)}` : Q, { replace: !0 }), r();
1101
1104
  } }) : N && Be.mutate({
1102
1105
  pkValues: N,
1103
1106
  data: e
1104
1107
  }, {
1105
1108
  onSuccess: () => {
1106
- n.forEach((e) => C.markCommitted(e)), r();
1109
+ n.forEach((e) => b.markCommitted(e)), r();
1107
1110
  },
1108
1111
  onError: (e) => {
1109
- e instanceof p && e.code === "STALE_OBJECT" && mt(!0);
1112
+ e instanceof a && e.code === "STALE_OBJECT" && mt(!0);
1110
1113
  }
1111
1114
  });
1112
1115
  }, [
1113
- C,
1116
+ b,
1114
1117
  M,
1115
1118
  O,
1116
1119
  k,
1117
- D,
1120
+ E,
1118
1121
  V,
1119
1122
  Xt,
1120
1123
  H,
@@ -1123,8 +1126,8 @@ function K({ screenCode: t }) {
1123
1126
  yt,
1124
1127
  Le,
1125
1128
  Be,
1126
- E,
1127
- a,
1129
+ T,
1130
+ o,
1128
1131
  Q,
1129
1132
  Y,
1130
1133
  X,
@@ -1136,14 +1139,14 @@ function K({ screenCode: t }) {
1136
1139
  }));
1137
1140
  }, []), $t = F(() => {
1138
1141
  !N || M || !oe || Ve.mutate(N, { onSuccess: () => {
1139
- le.getState().kill(ue(Z)), a(Q, { replace: !0 });
1142
+ me.getState().kill(le(Z)), o(Q, { replace: !0 });
1140
1143
  } });
1141
1144
  }, [
1142
1145
  N,
1143
1146
  M,
1144
1147
  oe,
1145
1148
  Ve,
1146
- a,
1149
+ o,
1147
1150
  Q,
1148
1151
  Z
1149
1152
  ]), en = F(() => {
@@ -1153,8 +1156,8 @@ function K({ screenCode: t }) {
1153
1156
  M,
1154
1157
  se,
1155
1158
  He
1156
- ]), tn = L(() => ht(W, u), [W, u]), nn = Object.keys(tn).length > 0;
1157
- if (!T || !E) return null;
1159
+ ]), tn = L(() => ht(W, _), [W, _]), nn = Object.keys(tn).length > 0;
1160
+ if (!w || !T) return null;
1158
1161
  if (!M && xe) return /* @__PURE__ */ z(ze, {});
1159
1162
  if (!M && !Y || Lt) return /* @__PURE__ */ B("div", {
1160
1163
  style: { padding: 24 },
@@ -1165,7 +1168,7 @@ function K({ screenCode: t }) {
1165
1168
  gap: 8,
1166
1169
  marginBottom: 8
1167
1170
  },
1168
- children: [qt && /* @__PURE__ */ z(d, {
1171
+ children: [qt && /* @__PURE__ */ z(u, {
1169
1172
  icon: /* @__PURE__ */ z(e.back, { size: 14 }),
1170
1173
  onClick: Kt.goBack,
1171
1174
  title: "Back"
@@ -1183,13 +1186,13 @@ function K({ screenCode: t }) {
1183
1186
  children: "Record not found."
1184
1187
  })]
1185
1188
  });
1186
- let rn = E.display, an = S(T.display?.name) || S(rn.name), on = ie(Y, E), sn = M ? `New ${an}` : on ? String(on) : an, cn = Le.isPending || Be.isPending, ln = T.responsive?.[w.category]?.layout, un = ln?.tabs ?? (w.isPhone ? "sections" : void 0), dn = ln?.header_card === !0 ? Ie({
1187
- entity: E,
1188
- screen: T
1189
+ let rn = T.display, an = g(w.display?.name) || g(rn.name), on = D(Y, T), sn = M ? `New ${an}` : on ? String(on) : an, cn = Le.isPending || Be.isPending, ln = w.responsive?.[C.category]?.layout, un = ln?.tabs ?? (C.isPhone ? "sections" : void 0), dn = ln?.header_card === !0 ? Ie({
1190
+ entity: T,
1191
+ screen: w
1189
1192
  }) : void 0, $ = {
1190
- schema: u,
1191
- entity: E,
1192
- entityCode: D,
1193
+ schema: _,
1194
+ entity: T,
1195
+ entityCode: E,
1193
1196
  recordId: ge ?? j ?? "",
1194
1197
  record: q ? {
1195
1198
  ...Y ?? {},
@@ -1245,14 +1248,14 @@ function K({ screenCode: t }) {
1245
1248
  fieldErrors: q && wt ? Yt : void 0,
1246
1249
  detailTabsPresentation: un,
1247
1250
  relatedRecordsPresentation: ln?.related_records
1248
- }, fn = !!T.sidebar && T.sidebar.length > 0, pn = ln?.sidebar === "hidden", mn = fn && !pn && !w.isDesktop, hn = fn && !pn && w.isDesktop, gn = !M && Y ? /* @__PURE__ */ z(ct, {
1249
- screen: T,
1250
- entity: E,
1251
- entityCode: D,
1251
+ }, fn = !!w.sidebar && w.sidebar.length > 0, pn = ln?.sidebar === "hidden", mn = fn && !pn && !C.isDesktop, hn = fn && !pn && C.isDesktop, gn = !M && Y ? /* @__PURE__ */ z(ct, {
1252
+ screen: w,
1253
+ entity: T,
1254
+ entityCode: E,
1252
1255
  record: Y,
1253
1256
  refs: Mt,
1254
1257
  objectStatuses: Ze,
1255
- schema: u,
1258
+ schema: _,
1256
1259
  locale: Jt
1257
1260
  }) : void 0, _n = /* @__PURE__ */ z(Ct, {
1258
1261
  title: sn,
@@ -1265,10 +1268,10 @@ function K({ screenCode: t }) {
1265
1268
  hasChildErrors: nn,
1266
1269
  hasFieldErrors: wt && Xt,
1267
1270
  canRestore: se,
1268
- entity: E,
1269
- screen: T,
1270
- globalActions: u?.actions,
1271
- entityCode: D,
1271
+ entity: T,
1272
+ screen: w,
1273
+ globalActions: _?.actions,
1274
+ entityCode: E,
1272
1275
  record: Y,
1273
1276
  id: j,
1274
1277
  listRoute: Q,
@@ -1286,8 +1289,8 @@ function K({ screenCode: t }) {
1286
1289
  isLoading: P.isLoading,
1287
1290
  isLive: je
1288
1291
  },
1289
- isRealtimeEntity: E?.realtime === !0,
1290
- canManageTemplates: pe(u)
1292
+ isRealtimeEntity: T?.realtime === !0,
1293
+ canManageTemplates: de(_)
1291
1294
  }), vn = Ft && /* @__PURE__ */ B("div", {
1292
1295
  style: {
1293
1296
  display: "flex",
@@ -1301,7 +1304,7 @@ function K({ screenCode: t }) {
1301
1304
  color: "var(--danger)",
1302
1305
  fontSize: 12.5
1303
1306
  },
1304
- children: [/* @__PURE__ */ z(e.warning, { size: 14 }), /* @__PURE__ */ B("span", { children: ["This record was deleted on ", s(String(Y[E.soft_delete]))] })]
1307
+ children: [/* @__PURE__ */ z(e.warning, { size: 14 }), /* @__PURE__ */ B("span", { children: ["This record was deleted on ", c(String(Y[T.soft_delete]))] })]
1305
1308
  }), yn = ft && /* @__PURE__ */ B("div", {
1306
1309
  style: {
1307
1310
  display: "flex",
@@ -1318,24 +1321,24 @@ function K({ screenCode: t }) {
1318
1321
  children: [/* @__PURE__ */ z(e.warning, { size: 14 }), /* @__PURE__ */ z("span", { children: "This record changed on the server while you were viewing or editing it." })]
1319
1322
  }), bn = q && wt && Xt && /* @__PURE__ */ z(ot, {
1320
1323
  errors: Object.entries(Yt).map(([e, t]) => {
1321
- let n = E.fields.get(e);
1324
+ let n = T.fields.get(e);
1322
1325
  return {
1323
1326
  name: e,
1324
- label: n ? te(n, e, u?.entities) : e,
1327
+ label: n ? m(n, e, _?.entities) : e,
1325
1328
  message: t
1326
1329
  };
1327
1330
  }),
1328
1331
  onJump: (e) => {
1329
- let t = document.getElementById(`${D}-${e}`);
1332
+ let t = document.getElementById(`${E}-${e}`);
1330
1333
  t && (t.scrollIntoView({
1331
1334
  block: "center",
1332
1335
  behavior: "smooth"
1333
1336
  }), t.focus?.());
1334
1337
  }
1335
- }), xn = Ue && !M && !(T.items && T.items.length > 0) && /* @__PURE__ */ z("div", {
1338
+ }), xn = Ue && !M && !(w.items && w.items.length > 0) && /* @__PURE__ */ z("div", {
1336
1339
  className: "mb-4",
1337
1340
  children: /* @__PURE__ */ z(We, {
1338
- statusGroups: E.status_groups ?? {},
1341
+ statusGroups: T.status_groups ?? {},
1339
1342
  objectStatuses: $.objectStatuses,
1340
1343
  onSetStatus: k && q ? (e, t) => st((n) => ({
1341
1344
  ...n,
@@ -1347,34 +1350,34 @@ function K({ screenCode: t }) {
1347
1350
  }), Sn = /* @__PURE__ */ B($e, { children: [
1348
1351
  dn && (Y || M) && /* @__PURE__ */ z(bt, {
1349
1352
  card: dn,
1350
- entity: E,
1353
+ entity: T,
1351
1354
  record: $.record,
1352
1355
  objectStatuses: $.objectStatuses,
1353
1356
  objectProperties: $.objectProperties
1354
1357
  }),
1355
- T.items && T.items.length > 0 && (Y || M) && u && /* @__PURE__ */ z(Ge, {
1356
- nodes: T.items,
1358
+ w.items && w.items.length > 0 && (Y || M) && _ && /* @__PURE__ */ z(Ge, {
1359
+ nodes: w.items,
1357
1360
  ctx: $
1358
1361
  }),
1359
- !M && j && D && E.associations && Object.keys(E.associations).length > 0 && u && /* @__PURE__ */ z(et, {
1360
- entityCode: D,
1362
+ !M && j && E && T.associations && Object.keys(T.associations).length > 0 && _ && /* @__PURE__ */ z(et, {
1363
+ entityCode: E,
1361
1364
  recordId: ge ?? j ?? "",
1362
- associations: E.associations,
1363
- schema: u
1365
+ associations: T.associations,
1366
+ schema: _
1364
1367
  }),
1365
- !M && j && D && /* @__PURE__ */ z(it, {
1366
- entityCode: D,
1368
+ !M && j && E && /* @__PURE__ */ z(it, {
1369
+ entityCode: E,
1367
1370
  objectId: ge ?? j,
1368
- canGenerateOne: !!E?.documents?.generate_one,
1369
- canManageTemplates: pe(u)
1371
+ canGenerateOne: !!T?.documents?.generate_one,
1372
+ canManageTemplates: de(_)
1370
1373
  }),
1371
- !M && Y && u && /* @__PURE__ */ z(ut, {
1372
- screen: T,
1373
- entity: E,
1374
- entityCode: D,
1374
+ !M && Y && _ && /* @__PURE__ */ z(ut, {
1375
+ screen: w,
1376
+ entity: T,
1377
+ entityCode: E,
1375
1378
  record: Y,
1376
1379
  refs: Mt,
1377
- schema: u,
1380
+ schema: _,
1378
1381
  locale: Jt
1379
1382
  })
1380
1383
  ] }), Cn = /* @__PURE__ */ z(Me, {
@@ -1391,7 +1394,7 @@ function K({ screenCode: t }) {
1391
1394
  height: "100%",
1392
1395
  display: "flex",
1393
1396
  overflow: "hidden",
1394
- background: "var(--bg)"
1397
+ background: "var(--background)"
1395
1398
  },
1396
1399
  children: [
1397
1400
  /* @__PURE__ */ B("div", {
@@ -1449,28 +1452,28 @@ function K({ screenCode: t }) {
1449
1452
  height: "100%",
1450
1453
  width: `${Ot}px`
1451
1454
  },
1452
- children: (Y || M) && u && /* @__PURE__ */ z(Ge, {
1453
- nodes: T.sidebar,
1455
+ children: (Y || M) && _ && /* @__PURE__ */ z(Ge, {
1456
+ nodes: w.sidebar,
1454
1457
  ctx: $
1455
1458
  })
1456
1459
  }),
1457
1460
  Cn
1458
1461
  ]
1459
1462
  });
1460
- let wn = w.isPhone ? 12 : 24;
1463
+ let wn = C.isPhone ? 12 : 24;
1461
1464
  return /* @__PURE__ */ B("div", {
1462
1465
  style: {
1463
1466
  height: "100%",
1464
1467
  display: "flex",
1465
1468
  flexDirection: "column",
1466
1469
  overflow: "hidden",
1467
- background: "var(--bg)"
1470
+ background: "var(--background)"
1468
1471
  },
1469
1472
  children: [
1470
1473
  /* @__PURE__ */ B("div", {
1471
1474
  style: {
1472
1475
  flexShrink: 0,
1473
- padding: w.isPhone ? "14px 12px 8px" : "24px 24px 8px"
1476
+ padding: C.isPhone ? "14px 12px 8px" : "24px 24px 8px"
1474
1477
  },
1475
1478
  children: [
1476
1479
  _n,
@@ -1493,7 +1496,7 @@ function K({ screenCode: t }) {
1493
1496
  minWidth: 0,
1494
1497
  WebkitOverflowScrolling: "touch"
1495
1498
  },
1496
- children: [Sn, mn && (Y || M) && u && /* @__PURE__ */ z("div", {
1499
+ children: [Sn, mn && (Y || M) && _ && /* @__PURE__ */ z("div", {
1497
1500
  "data-testid": "detail-sidebar-inline",
1498
1501
  style: {
1499
1502
  display: "flex",
@@ -1502,7 +1505,7 @@ function K({ screenCode: t }) {
1502
1505
  minWidth: 0
1503
1506
  },
1504
1507
  children: /* @__PURE__ */ z(Ge, {
1505
- nodes: T.sidebar,
1508
+ nodes: w.sidebar,
1506
1509
  ctx: $
1507
1510
  })
1508
1511
  })]
@@ -1518,7 +1521,7 @@ function bt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
1518
1521
  }, o = (e) => k(xt(t, e, n, r, i)) || /* @__PURE__ */ z("span", {
1519
1522
  style: { color: "var(--text-3)" },
1520
1523
  children: "-"
1521
- }), s = k(e.titleUsesDisplay ? ie(n, t) : e.titleField ? xt(t, e.titleField, n, r, i) : void 0) || S(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));
1524
+ }), s = k(e.titleUsesDisplay ? D(n, t) : e.titleField ? xt(t, e.titleField, n, r, i) : void 0) || g(t.display?.name) || "Record", c = e.badgeFields.filter((t) => !e.hideEmptyFields || a(t)), l = e.bodyFields.filter((t) => !e.hideEmptyFields || a(t)), u = e.metaFields.filter((t) => !e.hideEmptyFields || a(t));
1522
1525
  return /* @__PURE__ */ B("section", {
1523
1526
  "data-testid": "detail-header-card",
1524
1527
  style: {
@@ -1628,7 +1631,7 @@ function bt({ card: e, entity: t, record: n, objectStatuses: r, objectProperties
1628
1631
  function xt(e, t, n, r, i) {
1629
1632
  if (t.startsWith("$status.")) {
1630
1633
  let e = t.slice(8), n = r?.find((t) => t.group_code === e);
1631
- return S(n?.status_name) || n?.status_code;
1634
+ return g(n?.status_name) || n?.status_code;
1632
1635
  }
1633
1636
  if (t.startsWith("$property.")) {
1634
1637
  let e = t.slice(10);
@@ -1640,61 +1643,61 @@ function St(e, t) {
1640
1643
  if (t.startsWith("$status.")) return t.slice(8);
1641
1644
  if (t.startsWith("$property.")) return t.slice(10);
1642
1645
  let n = e.fields.get(t);
1643
- return n ? te(n, t) : t;
1646
+ return n ? m(n, t) : t;
1644
1647
  }
1645
- function Ct({ title: n, recordId: a, editing: s, isNew: c, isRecordDeleted: l, dirty: u, isSaving: d, hasChildErrors: f, hasFieldErrors: p, canRestore: m, entity: h, screen: g, globalActions: _, entityCode: v, record: y, id: b, listRoute: ee, listRouteExists: x, highlights: C, showBack: w, onBack: te, onCancelEdit: re, onSave: ie, onRestore: O, isRestoring: ae, refreshControl: k, isRealtimeEntity: oe, canManageTemplates: se }) {
1646
- let { run: ce } = T(), de = A("detail"), fe = Ae(), pe = i(), me = ne(), j = Be(g?.action_layout, h?.action_layout, h?.actions, _, "detail_toolbar"), he = be(Be(g?.action_layout, h?.action_layout, h?.actions, _, "detail"), h?.actions, _, y ?? {}, []), _e = be(j, h?.actions, _, y ?? {}, []), ve = L(() => {
1647
- if (!h) return;
1648
- let e = b ? [b] : [];
1648
+ function Ct({ title: n, recordId: i, editing: a, isNew: o, isRecordDeleted: s, dirty: c, isSaving: l, hasChildErrors: u, hasFieldErrors: f, canRestore: p, entity: m, screen: h, globalActions: _, entityCode: y, record: b, id: x, listRoute: S, listRouteExists: T, highlights: ee, showBack: D, onBack: ne, onCancelEdit: re, onSave: O, onRestore: ie, isRestoring: ae, refreshControl: k, isRealtimeEntity: oe, canManageTemplates: se }) {
1649
+ let { run: ce } = E(), j = A("detail"), ue = Ae(), de = r(), fe = te(), pe = Be(h?.action_layout, m?.action_layout, m?.actions, _, "detail_toolbar"), he = be(Be(h?.action_layout, m?.action_layout, m?.actions, _, "detail"), m?.actions, _, b ?? {}, []), _e = be(pe, m?.actions, _, b ?? {}, []), ve = L(() => {
1650
+ if (!m) return;
1651
+ let e = x ? [x] : [];
1649
1652
  return {
1650
- entity: h,
1651
- entityCode: v ?? "",
1652
- screen: g,
1653
- screenRoute: g?.route ?? "",
1654
- selectedRows: y ? [y] : [],
1653
+ entity: m,
1654
+ entityCode: y ?? "",
1655
+ screen: h,
1656
+ screenRoute: h?.route ?? "",
1657
+ selectedRows: b ? [b] : [],
1655
1658
  selectedIds: e,
1656
- locale: me,
1657
- tabNavigate: (e, t) => fe(e, {
1659
+ locale: fe,
1660
+ tabNavigate: (e, t) => ue(e, {
1658
1661
  title: t?.title,
1659
1662
  icon: t?.icon,
1660
1663
  search: t?.search
1661
1664
  }),
1662
- runActionApi: (e, t) => D(e, t)
1665
+ runActionApi: (e, t) => C(e, t)
1663
1666
  };
1664
1667
  }, [
1668
+ m,
1669
+ y,
1665
1670
  h,
1666
- v,
1667
- g,
1671
+ x,
1668
1672
  b,
1669
- y,
1670
- me,
1671
- fe
1673
+ fe,
1674
+ ue
1672
1675
  ]), ye = (e, t) => {
1673
- let n = ge(e, t, { row: y ?? void 0 });
1676
+ let n = ge(e, t, { row: b ?? void 0 });
1674
1677
  if (n === null) return;
1675
- let r = b ? [b] : [], i = e === "__delete" && x ? ee : null;
1678
+ let r = x ? [x] : [], i = e === "__delete" && T ? S : null;
1676
1679
  return ce({
1677
1680
  action: t,
1678
- title: S(t.display?.name) || e,
1679
- execute: (e) => D(n, E(e, r)),
1681
+ title: g(t.display?.name) || e,
1682
+ execute: (e) => C(n, v(e, r)),
1680
1683
  onSuccess: i ? () => {
1681
- le.getState().kill(ue(location)), pe(i, { replace: !0 });
1684
+ me.getState().kill(le(location)), de(i, { replace: !0 });
1682
1685
  } : void 0
1683
1686
  });
1684
- }, P = de.isVisible("show_actions") && !c && b && he.length > 0 ? /* @__PURE__ */ z(xe, {
1687
+ }, P = j.isVisible("show_actions") && !o && x && he.length > 0 ? /* @__PURE__ */ z(xe, {
1685
1688
  layout: he,
1686
- row: y,
1689
+ row: b,
1687
1690
  onRun: ye,
1688
1691
  kind: "detail",
1689
- entityActions: h?.actions,
1692
+ entityActions: m?.actions,
1690
1693
  globalActions: _,
1691
1694
  reservedRightWidth: 0,
1692
1695
  widgetContext: ve,
1693
1696
  fillContainer: !1
1694
- }) : null, Se = !c && b ? /* @__PURE__ */ z(M, {
1697
+ }) : null, Se = !o && x ? /* @__PURE__ */ z(M, {
1695
1698
  liveObject: k,
1696
1699
  realtime: oe
1697
- }) : null, Ce = de.isVisible("show_actions") && !c && b && _e.length > 0 ? /* @__PURE__ */ B("div", {
1700
+ }) : null, Ce = j.isVisible("show_actions") && !o && x && _e.length > 0 ? /* @__PURE__ */ B("div", {
1698
1701
  style: {
1699
1702
  display: "flex",
1700
1703
  justifyContent: "flex-end",
@@ -1704,40 +1707,40 @@ function Ct({ title: n, recordId: a, editing: s, isNew: c, isRecordDeleted: l, d
1704
1707
  },
1705
1708
  children: [P ? null : Se, /* @__PURE__ */ z(xe, {
1706
1709
  layout: _e,
1707
- row: y,
1710
+ row: b,
1708
1711
  onRun: ye,
1709
1712
  kind: "detail",
1710
- entityActions: h?.actions,
1713
+ entityActions: m?.actions,
1711
1714
  globalActions: _,
1712
1715
  reservedRightWidth: 0,
1713
1716
  widgetContext: ve,
1714
1717
  ariaLabel: P ? "Detail toolbar actions" : "Page actions"
1715
1718
  })]
1716
- }) : null, we = de.isVisible("show_actions") && !c && b && v ? /* @__PURE__ */ z(N, {
1717
- entityCode: v,
1719
+ }) : null, we = j.isVisible("show_actions") && !o && x && y ? /* @__PURE__ */ z(N, {
1720
+ entityCode: y,
1718
1721
  scope: "detail",
1719
- objectIds: [b],
1720
- capability: h?.documents,
1722
+ objectIds: [x],
1723
+ capability: m?.documents,
1721
1724
  canManageTemplates: se
1722
- }) : null, Te = l ? m ? /* @__PURE__ */ z(r, {
1725
+ }) : null, Te = s ? p ? /* @__PURE__ */ z(d, {
1723
1726
  kind: "primary",
1724
- icon: z(ae ? o : e.refresh, { size: 13 }),
1725
- onClick: O,
1727
+ icon: z(ae ? w : e.refresh, { size: 13 }),
1728
+ onClick: ie,
1726
1729
  disabled: ae,
1727
1730
  children: ae ? "Restoring…" : "Restore"
1728
- }) : null : s ? /* @__PURE__ */ B($e, { children: [/* @__PURE__ */ z(r, {
1731
+ }) : null : a ? /* @__PURE__ */ B($e, { children: [/* @__PURE__ */ z(d, {
1729
1732
  icon: /* @__PURE__ */ z(e.x, { size: 13 }),
1730
1733
  onClick: re,
1731
- disabled: d,
1734
+ disabled: l,
1732
1735
  children: "Cancel"
1733
- }), /* @__PURE__ */ z(r, {
1736
+ }), /* @__PURE__ */ z(d, {
1734
1737
  kind: "primary",
1735
- icon: z(d ? o : e.save, { size: 13 }),
1736
- onClick: ie,
1737
- disabled: d || f || p,
1738
- title: f ? "Fix errors in child rows" : p ? "Fix the highlighted fields" : void 0,
1739
- children: d ? "Saving…" : "Save"
1740
- })] }) : !c && b ? P ? /* @__PURE__ */ B("span", {
1738
+ icon: z(l ? w : e.save, { size: 13 }),
1739
+ onClick: O,
1740
+ disabled: l || u || f,
1741
+ title: u ? "Fix errors in child rows" : f ? "Fix the highlighted fields" : void 0,
1742
+ children: l ? "Saving…" : "Save"
1743
+ })] }) : !o && x ? P ? /* @__PURE__ */ B("span", {
1741
1744
  style: {
1742
1745
  display: "inline-flex",
1743
1746
  alignItems: "center",
@@ -1751,20 +1754,20 @@ function Ct({ title: n, recordId: a, editing: s, isNew: c, isRecordDeleted: l, d
1751
1754
  ]
1752
1755
  }) : we : null;
1753
1756
  return /* @__PURE__ */ B($e, { children: [/* @__PURE__ */ z(G, {
1754
- icon: h?.display.icon ? /* @__PURE__ */ z(t, {
1755
- name: h.display.icon,
1757
+ icon: m?.display.icon ? /* @__PURE__ */ z(t, {
1758
+ name: m.display.icon,
1756
1759
  size: 16
1757
1760
  }) : void 0,
1758
1761
  title: n,
1759
- description: S(g?.display?.description) || S(h?.display?.description),
1760
- recordId: a,
1761
- highlights: C,
1762
- mode: c ? "create" : s ? "edit" : "display",
1763
- dirty: u,
1764
- showBack: w,
1765
- onBack: te,
1762
+ description: g(h?.display?.description) || g(m?.display?.description),
1763
+ recordId: i,
1764
+ highlights: ee,
1765
+ mode: o ? "create" : a ? "edit" : "display",
1766
+ dirty: c,
1767
+ showBack: D,
1768
+ onBack: ne,
1766
1769
  right: Te,
1767
- showTitle: de.isVisible("show_title")
1770
+ showTitle: j.isVisible("show_title")
1768
1771
  }), Ce] });
1769
1772
  }
1770
1773
  //#endregion