@declarion/react 0.51.0 → 0.53.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 (37) hide show
  1. package/dist-lib/{DraggableChildrenTable-CJCjc_cd.js → DraggableChildrenTable-BQZTvZaU.js} +35 -35
  2. package/dist-lib/{Grid-DUjbQg3r.js → Grid-B9Tiytbd.js} +28 -28
  3. package/dist-lib/{LayoutRenderer-DbdxC-Bq.js → LayoutRenderer-D_v9OD_A.js} +920 -922
  4. package/dist-lib/{ListCardsBody-C8ofksQb.js → ListCardsBody-dRnXsQ7A.js} +14 -14
  5. package/dist-lib/{MarkdownRenderer-B9_5fwuE.js → MarkdownRenderer-BCyrsLrd.js} +10 -10
  6. package/dist-lib/{record-documents-key-8fdm7C10.js → RecordIdBadge-CGxPR-8q.js} +1 -4
  7. package/dist-lib/{RefreshControl-C-8UCyau.js → RefreshControl-CV8nGACW.js} +120 -122
  8. package/dist-lib/{SmartDetailPage.impl-DWjNQ052.js → SmartDetailPage.impl-DWprVNMb.js} +376 -377
  9. package/dist-lib/{SmartListPage.impl-yKBK7a8b.js → SmartListPage.impl-BwWURGwa.js} +1098 -1099
  10. package/dist-lib/{SmartRecordListPage.impl-DRpU_DOC.js → SmartRecordListPage.impl-BKKBShAg.js} +183 -183
  11. package/dist-lib/{SortHeaderMenu-CbihbEGd.js → SortHeaderMenu-pgi4sxMs.js} +1 -1
  12. package/dist-lib/{action-dispatch-C28UhXXA.js → action-dispatch-DlHTYag7.js} +382 -382
  13. package/dist-lib/api/events.d.ts +27 -5
  14. package/dist-lib/{cardProjection-Bp_ZPLUE.js → cardProjection-C7Orz841.js} +146 -204
  15. package/dist-lib/components/pages/DocumentsMenu.d.ts +1 -1
  16. package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +2 -2
  17. package/dist-lib/components/pages/list/useListQuery.d.ts +6 -1
  18. package/dist-lib/components/shared/RefreshControl.d.ts +7 -1
  19. package/dist-lib/components/shared/useOwnRefresh.d.ts +9 -0
  20. package/dist-lib/{field-classification-CeYJlsNq.js → field-classification-EY8CFF3P.js} +301 -320
  21. package/dist-lib/{format-count-C3N-WxEy.js → format-count-BHkaDr9V.js} +245 -245
  22. package/dist-lib/hooks/useMutations.d.ts +1 -1
  23. package/dist-lib/hooks/useSSE.d.ts +24 -4
  24. package/dist-lib/index.js +1541 -1832
  25. package/dist-lib/lib/document-templates.d.ts +1 -1
  26. package/dist-lib/lib/realtime-reconcile.d.ts +43 -0
  27. package/dist-lib/{peekDraftStore-D3sowXga.js → peekDraftStore-1pIajluX.js} +36 -36
  28. package/dist-lib/{registry-p6CejATt.js → registry-C5ug25M8.js} +507 -507
  29. package/dist-lib/stores/realtime.d.ts +20 -0
  30. package/dist-lib/testing.js +35 -35
  31. package/dist-lib/{useCurrentScreen-74x5yJNb.js → useCurrentScreen-BdnZq8vZ.js} +2504 -1557
  32. package/dist-lib/{useListQuery-D75bgLLz.js → useListQuery-BxgrPZIB.js} +13 -10
  33. package/dist-lib/{useProperties-C5fZp12D.js → useProperties-Bhi9Wn5O.js} +25 -25
  34. package/dist-lib/useTabSearchMirror-Dl5x0xKu.js +177 -0
  35. package/dist-lib/{value-DKekzcjz.js → value-Rp-5W3o8.js} +25 -25
  36. package/package.json +7 -7
  37. package/dist-lib/useTabSearchMirror-D_wzoYRz.js +0 -406
@@ -1,117 +1,117 @@
1
1
  import { s as e } from "./DynamicIcon-DW5krHuX.js";
2
- import { $n as t, A as n, At as r, Dn as i, F as a, In as o, Jn as s, N as c, Sn as l, Tn as u, Zn as d, dr as f, fr as p, q as m, rr as ee, rt as h, wn as g, zn as te } from "./useCurrentScreen-74x5yJNb.js";
3
- import { a as _ } from "./registry-p6CejATt.js";
4
- import { O as ne, c as re, f as v } from "./field-classification-CeYJlsNq.js";
5
- import { f as y, h as b, p as x, u as S } from "./action-dispatch-C28UhXXA.js";
6
- import { d as C, m as w, n as T, p as E, t as D, u as O } from "./cardProjection-Bp_ZPLUE.js";
7
- import { c as k, f as A, h as j, m as M, n as ie, t as ae } from "./useTabSearchMirror-D_wzoYRz.js";
8
- import { n as oe, r as N } from "./useProperties-C5fZp12D.js";
9
- import { t as P } from "./LayoutRenderer-DbdxC-Bq.js";
10
- import { t as se } from "./useListQuery-D75bgLLz.js";
2
+ import { Cr as t, Dr as n, Fr as r, Ir as i, Jn as a, Kn as o, Mt as s, Yn as c, Zn as l, an as u, at as d, h as f, lr as ee, nt as p, or as m, st as h, vr as te, xr as g, yt as ne } from "./useCurrentScreen-BdnZq8vZ.js";
3
+ import { a as _ } from "./registry-C5ug25M8.js";
4
+ import { T as re, l as ie, p as v } from "./field-classification-EY8CFF3P.js";
5
+ import { f as y, h as b, p as x, u as S } from "./action-dispatch-DlHTYag7.js";
6
+ import { a as C, c as w, n as T, s as E, t as D } from "./cardProjection-C7Orz841.js";
7
+ import { n as ae, r as O } from "./useProperties-Bhi9Wn5O.js";
8
+ import { c as k, f as A, h as j, m as M, n as oe, t as se } from "./useTabSearchMirror-Dl5x0xKu.js";
9
+ import { t as N } from "./LayoutRenderer-D_v9OD_A.js";
10
+ import { t as P } from "./useListQuery-BxgrPZIB.js";
11
11
  import { useCallback as F, useEffect as I, useMemo as L, useRef as R, useState as z } from "react";
12
12
  import { useSearchParams as ce } from "react-router";
13
13
  import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
14
14
  //#region src/components/pages/SmartRecordListPage.impl.tsx
15
15
  var le = 200;
16
16
  function U({ screenCode: t }) {
17
- let [n, a] = ce(), { data: o } = r(), c = ee(), l = o?.screens[t], u = l?.entity ? o?.entities[l.entity] : void 0, p = l?.entity;
18
- ie(l, u, n.toString()), ae(l?.route);
19
- let h = re(), _ = n.get("selected") ?? null, v = n.get("search") ?? "", y = m(v, 300), b = n.get("sort") ?? l?.sort_default ?? "", x = L(() => A(n), [n]), S = x.filters.length > 0 ? x.filters : void 0, C = L(() => l?.columns ?? u?.fields.names().filter((e) => !u.fields.get(e)?.primary && !u.fields.get(e)?.auto && u.fields.get(e)?.display?.is_listable !== !1).slice(0, 4) ?? [], [l?.columns, u]), w = L(() => {
20
- let e = l?.responsive?.[c.category]?.presentation;
17
+ let [i, o] = ce(), { data: s } = u(), c = n(), d = s?.screens[t], p = d?.entity ? s?.entities[d.entity] : void 0, m = d?.entity;
18
+ oe(d, p, i.toString()), se(d?.route);
19
+ let h = ie(), _ = i.get("selected") ?? null, v = i.get("search") ?? "", y = ne(v, 300), b = i.get("sort") ?? d?.sort_default ?? "", x = L(() => A(i), [i]), S = x.filters.length > 0 ? x.filters : void 0, C = L(() => d?.columns ?? p?.fields.names().filter((e) => !p.fields.get(e)?.primary && !p.fields.get(e)?.auto && p.fields.get(e)?.display?.is_listable !== !1).slice(0, 4) ?? [], [d?.columns, p]), w = L(() => {
20
+ let e = d?.responsive?.[c.category]?.presentation;
21
21
  return c.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
22
- }, [l?.responsive, c.category]), E = L(() => {
23
- let e = l?.responsive?.[c.category];
22
+ }, [d?.responsive, c.category]), E = L(() => {
23
+ let e = d?.responsive?.[c.category];
24
24
  return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation : c.category === "phone" ? "cards" : "table";
25
- }, [l?.responsive, c.category]), oe = l?.responsive?.[c.category]?.layout?.related_records, N = L(() => D({
26
- entity: u,
27
- screen: l
28
- }), [u, l]), P = L(() => T({
29
- entity: u,
30
- screen: l,
25
+ }, [d?.responsive, c.category]), ae = d?.responsive?.[c.category]?.layout?.related_records, O = L(() => D({
26
+ entity: p,
27
+ screen: d
28
+ }), [p, d]), N = L(() => T({
29
+ entity: p,
30
+ screen: d,
31
31
  presentation: E,
32
32
  visibleColumns: C,
33
- card: N,
33
+ card: O,
34
34
  sort: b
35
35
  }), [
36
- u,
37
- l,
36
+ p,
37
+ d,
38
38
  E,
39
39
  C,
40
- N,
40
+ O,
41
41
  b
42
- ]), U = se({
43
- entity: u,
44
- entityCode: p,
45
- screen: l,
42
+ ]), U = P({
43
+ entity: p,
44
+ entityCode: m,
45
+ screen: d,
46
46
  screenCode: t,
47
47
  page: 1,
48
48
  perPage: le,
49
- sortForRequest: O(b),
49
+ sortForRequest: f(b),
50
50
  debouncedSearch: y,
51
51
  filters: x.filters,
52
52
  filterError: !!x.error,
53
53
  includeDeleted: !1,
54
- expand: P.expandFields,
55
- select: P.selectFields,
54
+ expand: N.expandFields,
55
+ select: N.selectFields,
56
56
  runCountQuery: !1,
57
- urlKey: `${p ?? ""}|${n.toString()}`
58
- }), W = U.rows, G = U.refs, K = U.isLoading, q = L(() => u?.fields.names().find((e) => u.fields.get(e)?.primary) ?? "id", [u]), J = F((e, t) => {
59
- a((t) => {
57
+ urlKey: `${m ?? ""}|${i.toString()}`
58
+ }), W = U.rows, G = U.refs, K = U.isLoading, q = L(() => p?.fields.names().find((e) => p.fields.get(e)?.primary) ?? "id", [p]), J = F((e, t) => {
59
+ o((t) => {
60
60
  let n = new URLSearchParams(t);
61
61
  return e ? n.set("selected", e) : n.delete("selected"), n;
62
62
  }, { replace: t?.replace ?? !0 });
63
- }, [a]), fe = F((e) => {
64
- a((t) => {
63
+ }, [o]), fe = F((e) => {
64
+ o((t) => {
65
65
  let n = new URLSearchParams(t);
66
66
  return e ? n.set("search", e) : n.delete("search"), n;
67
67
  }, { replace: !0 });
68
- }, [a]), pe = F((e, t) => {
69
- a((n) => {
68
+ }, [o]), pe = F((e, t) => {
69
+ o((n) => {
70
70
  let r = new URLSearchParams(n), i = A(n).filters, a;
71
71
  return a = t && t !== "__all__" ? [...M(i, e), k(e, t)] : M(i, e), j(a, r), r;
72
72
  }, { replace: !0 });
73
- }, [a]), Y = (l?.list_resizable ?? !1) && w === "split" && c.category !== "phone" && !c.touch, me = R(null), [X, Z] = z(null), he = R(!1), Q = l?.list_width;
73
+ }, [o]), Y = (d?.list_resizable ?? !1) && w === "split" && c.category !== "phone" && !c.touch, X = R(null), [Z, Q] = z(null), me = R(!1), $ = d?.list_width;
74
74
  I(() => {
75
- !Y || !Q?.endsWith("%") || Z(null);
75
+ !Y || !$?.endsWith("%") || Q(null);
76
76
  }, [
77
77
  Y,
78
- Q,
78
+ $,
79
79
  c.width,
80
80
  c.height
81
81
  ]), I(() => {
82
- if (!Y || X !== null) return;
83
- let e = me.current;
82
+ if (!Y || Z !== null) return;
83
+ let e = X.current;
84
84
  if (e) {
85
- if (Q && Q.endsWith("%")) {
86
- let t = parseFloat(Q) / 100;
87
- Z(Math.round(e.getBoundingClientRect().width * t));
88
- } else Z(Q && parseInt(Q, 10) || 320);
85
+ if ($ && $.endsWith("%")) {
86
+ let t = parseFloat($) / 100;
87
+ Q(Math.round(e.getBoundingClientRect().width * t));
88
+ } else Q($ && parseInt($, 10) || 320);
89
89
  }
90
90
  }, [
91
91
  Y,
92
- Q,
93
- X,
94
- u
92
+ $,
93
+ Z,
94
+ p
95
95
  ]);
96
- let $ = R(null);
96
+ let he = R(null);
97
97
  I(() => () => {
98
- $.current?.();
98
+ he.current?.();
99
99
  }, []);
100
100
  let ge = F((e) => {
101
- e.preventDefault(), he.current = !0;
102
- let t = e.clientX, n = X ?? 320, r = (e) => {
103
- if (!he.current) return;
104
- let r = (me.current?.getBoundingClientRect().width ?? window.innerWidth) - 300, i = Math.max(200, Math.min(r, n + e.clientX - t));
105
- Z(i);
101
+ e.preventDefault(), me.current = !0;
102
+ let t = e.clientX, n = Z ?? 320, r = (e) => {
103
+ if (!me.current) return;
104
+ let r = (X.current?.getBoundingClientRect().width ?? window.innerWidth) - 300, i = Math.max(200, Math.min(r, n + e.clientX - t));
105
+ Q(i);
106
106
  }, i = () => {
107
- he.current = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i), document.body.style.cursor = "", document.body.style.userSelect = "", $.current = null;
107
+ me.current = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i), document.body.style.cursor = "", document.body.style.userSelect = "", he.current = null;
108
108
  };
109
- document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), $.current = i;
110
- }, [X]);
111
- if (!o || !l || !u) return null;
112
- let _e = S?.length ?? 0, ve = w === "split" || w === "stacked" || !_, ye = w === "split" || w === "stacked" || !!_, be = w !== "split" && _ ? () => J(null, { replace: !0 }) : void 0, xe = w === "split" ? Y && X !== null ? X : l.list_width ?? "320px" : "100%";
109
+ document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), he.current = i;
110
+ }, [Z]);
111
+ if (!s || !d || !p) return null;
112
+ let _e = S?.length ?? 0, ve = w === "split" || w === "stacked" || !_, ye = w === "split" || w === "stacked" || !!_, be = w !== "split" && _ ? () => J(null, { replace: !0 }) : void 0, xe = w === "split" ? Y && Z !== null ? Z : d.list_width ?? "320px" : "100%";
113
113
  return /* @__PURE__ */ H("div", {
114
- ref: me,
114
+ ref: X,
115
115
  "data-record-list-presentation": w,
116
116
  style: {
117
117
  display: "flex",
@@ -138,7 +138,7 @@ function U({ screenCode: t }) {
138
138
  style: {
139
139
  paddingTop: 12,
140
140
  paddingBottom: 12,
141
- ...ne(12),
141
+ ...re(12),
142
142
  display: "flex",
143
143
  flexDirection: "column",
144
144
  gap: 8,
@@ -151,7 +151,7 @@ function U({ screenCode: t }) {
151
151
  alignItems: "center",
152
152
  gap: 8
153
153
  },
154
- children: [/* @__PURE__ */ V(f, {
154
+ children: [/* @__PURE__ */ V(r, {
155
155
  icon: /* @__PURE__ */ V(e.back, { size: 14 }),
156
156
  title: "Back",
157
157
  onClick: h.goBack
@@ -161,13 +161,13 @@ function U({ screenCode: t }) {
161
161
  fontWeight: 600,
162
162
  color: "var(--text)"
163
163
  },
164
- children: i(l.display?.name) || i(u.display.name_plural)
164
+ children: l(d.display?.name) || l(p.display.name_plural)
165
165
  })]
166
166
  }),
167
- /* @__PURE__ */ V(d, {
167
+ /* @__PURE__ */ V(g, {
168
168
  value: v,
169
169
  onChange: fe,
170
- placeholder: `Search ${i(u.display.name_plural)}…`,
170
+ placeholder: `Search ${l(p.display.name_plural)}…`,
171
171
  prefix: /* @__PURE__ */ V(e.search, { size: 13 })
172
172
  }),
173
173
  x.error && /* @__PURE__ */ H("div", {
@@ -182,27 +182,27 @@ function U({ screenCode: t }) {
182
182
  },
183
183
  children: [x.error, " Showing this list without URL filters."]
184
184
  }),
185
- l.filters && l.filters.length > 0 && /* @__PURE__ */ V("div", {
185
+ d.filters && d.filters.length > 0 && /* @__PURE__ */ V("div", {
186
186
  style: {
187
187
  display: "flex",
188
188
  flexWrap: "wrap",
189
189
  gap: 6
190
190
  },
191
- children: l.filters.map((e) => {
192
- let t = u.fields.get(e);
191
+ children: d.filters.map((e) => {
192
+ let t = p.fields.get(e);
193
193
  if (!t?.values) return null;
194
- let n = S?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r = g(t, e, o.entities), a = [{
194
+ let n = S?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r = a(t, e, s.entities), i = [{
195
195
  value: "__all__",
196
196
  label: `All ${r}`
197
197
  }, ...t.values.map((e) => ({
198
198
  value: e.code,
199
- label: i(e.name) || e.code
199
+ label: l(e.name) || e.code
200
200
  }))];
201
201
  return /* @__PURE__ */ V("div", {
202
202
  style: { minWidth: 120 },
203
- children: /* @__PURE__ */ V(s, {
203
+ children: /* @__PURE__ */ V(te, {
204
204
  value: n,
205
- options: a,
205
+ options: i,
206
206
  onChange: (t) => pe(e, t),
207
207
  placeholder: r
208
208
  })
@@ -217,8 +217,8 @@ function U({ screenCode: t }) {
217
217
  fontSize: 11,
218
218
  color: "var(--text-3)"
219
219
  },
220
- children: [/* @__PURE__ */ V("span", { children: K ? "Loading…" : `${W.length} ${i(u.display.name_plural)}` }), _e > 0 && /* @__PURE__ */ V("button", {
221
- onClick: () => a((e) => {
220
+ children: [/* @__PURE__ */ V("span", { children: K ? "Loading…" : `${W.length} ${l(p.display.name_plural)}` }), _e > 0 && /* @__PURE__ */ V("button", {
221
+ onClick: () => o((e) => {
222
222
  let t = new URLSearchParams(e);
223
223
  return t.delete("filters"), t;
224
224
  }, { replace: !0 }),
@@ -265,12 +265,12 @@ function U({ screenCode: t }) {
265
265
  },
266
266
  children: "No records found"
267
267
  }) : /* @__PURE__ */ H(B, { children: [W.map((e) => {
268
- let t = te(e[q]);
268
+ let t = ee(e[q]);
269
269
  return /* @__PURE__ */ V(ue, {
270
270
  record: e,
271
- entity: u,
271
+ entity: p,
272
272
  columns: C,
273
- card: N,
273
+ card: O,
274
274
  presentation: E,
275
275
  refs: G,
276
276
  isSelected: t === _,
@@ -317,13 +317,13 @@ function U({ screenCode: t }) {
317
317
  height: w === "stacked" ? "50%" : "100%"
318
318
  },
319
319
  children: _ ? /* @__PURE__ */ V(de, {
320
- entityCode: p,
320
+ entityCode: m,
321
321
  recordId: _,
322
- items: l.items,
323
- schema: o,
324
- entity: u,
322
+ items: d.items,
323
+ schema: s,
324
+ entity: p,
325
325
  onBackToList: be,
326
- relatedRecordsPresentation: oe
326
+ relatedRecordsPresentation: ae
327
327
  }, _) : /* @__PURE__ */ V("div", {
328
328
  style: {
329
329
  display: "flex",
@@ -336,7 +336,7 @@ function U({ screenCode: t }) {
336
336
  style: { fontSize: 12.5 },
337
337
  children: [
338
338
  "Select a ",
339
- i(u.display.name),
339
+ l(p.display.name),
340
340
  " to view details"
341
341
  ]
342
342
  })
@@ -345,37 +345,37 @@ function U({ screenCode: t }) {
345
345
  ]
346
346
  });
347
347
  }
348
- function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs: o, isSelected: s, onClick: c }) {
349
- let l = n();
350
- if (a === "cards") {
351
- let n = i.badgeFields.filter((n) => W(t, e, n)), r = i.bodyFields.filter((n) => W(t, e, n)), a = i.metaFields.filter((n) => W(t, e, n));
348
+ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a, isSelected: o, onClick: s }) {
349
+ let c = p();
350
+ if (i === "cards") {
351
+ let n = r.badgeFields.filter((n) => W(t, e, n)), i = r.bodyFields.filter((n) => W(t, e, n)), l = r.metaFields.filter((n) => W(t, e, n));
352
352
  return /* @__PURE__ */ H("button", {
353
353
  type: "button",
354
354
  "data-testid": "record-list-card",
355
- "aria-current": s ? "true" : void 0,
356
- onClick: c,
355
+ "aria-current": o ? "true" : void 0,
356
+ onClick: s,
357
357
  style: {
358
358
  width: "100%",
359
359
  textAlign: "left",
360
360
  padding: 12,
361
361
  border: "1px solid var(--border)",
362
362
  borderRadius: 8,
363
- background: s ? "var(--row-selected-bg)" : "var(--surface)",
363
+ background: o ? "var(--row-selected-bg)" : "var(--surface)",
364
364
  color: "var(--text)",
365
365
  cursor: "pointer",
366
366
  display: "flex",
367
367
  flexDirection: "column",
368
368
  gap: 8,
369
- boxShadow: s ? "inset 3px 0 0 var(--accent)" : "none"
369
+ boxShadow: o ? "inset 3px 0 0 var(--accent)" : "none"
370
370
  },
371
371
  children: [
372
372
  /* @__PURE__ */ V(G, {
373
373
  entity: t,
374
374
  record: e,
375
- field: i.titleField,
376
- refs: o
375
+ field: r.titleField,
376
+ refs: a
377
377
  }),
378
- i.subtitleField && /* @__PURE__ */ V("div", {
378
+ r.subtitleField && /* @__PURE__ */ V("div", {
379
379
  style: {
380
380
  fontSize: 12,
381
381
  color: "var(--text-3)",
@@ -383,11 +383,11 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
383
383
  },
384
384
  children: x({
385
385
  entity: t,
386
- fieldName: i.subtitleField,
386
+ fieldName: r.subtitleField,
387
387
  record: e,
388
388
  mode: "display",
389
- refs: o,
390
- locale: l
389
+ refs: a,
390
+ locale: c
391
391
  })
392
392
  }),
393
393
  n.length > 0 && /* @__PURE__ */ V("div", {
@@ -411,27 +411,27 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
411
411
  fieldName: n,
412
412
  record: e,
413
413
  mode: "display",
414
- refs: o,
415
- locale: l
414
+ refs: a,
415
+ locale: c
416
416
  })
417
417
  }, n))
418
418
  }),
419
- r.length > 0 && /* @__PURE__ */ V("dl", {
419
+ i.length > 0 && /* @__PURE__ */ V("dl", {
420
420
  style: {
421
421
  display: "grid",
422
422
  gridTemplateColumns: "minmax(72px, max-content) minmax(0, 1fr)",
423
423
  gap: "5px 10px",
424
424
  margin: 0
425
425
  },
426
- children: r.map((n) => /* @__PURE__ */ V(K, {
426
+ children: i.map((n) => /* @__PURE__ */ V(K, {
427
427
  entity: t,
428
428
  record: e,
429
429
  fieldName: n,
430
- refs: o,
431
- locale: l
430
+ refs: a,
431
+ locale: c
432
432
  }, n))
433
433
  }),
434
- a.length > 0 && /* @__PURE__ */ V("div", {
434
+ l.length > 0 && /* @__PURE__ */ V("div", {
435
435
  style: {
436
436
  display: "flex",
437
437
  flexWrap: "wrap",
@@ -439,7 +439,7 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
439
439
  fontSize: 11,
440
440
  color: "var(--text-3)"
441
441
  },
442
- children: a.map((n) => /* @__PURE__ */ V("span", {
442
+ children: l.map((n) => /* @__PURE__ */ V("span", {
443
443
  style: {
444
444
  minWidth: 0,
445
445
  overflowWrap: "anywhere"
@@ -449,24 +449,24 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
449
449
  fieldName: n,
450
450
  record: e,
451
451
  mode: "display",
452
- refs: o,
453
- locale: l
452
+ refs: a,
453
+ locale: c
454
454
  })
455
455
  }, n))
456
456
  })
457
457
  ]
458
458
  });
459
459
  }
460
- let u = r[0], d = r[1], f = r.slice(2, 4);
460
+ let l = n[0], u = n[1], d = n.slice(2, 4);
461
461
  return /* @__PURE__ */ H("button", {
462
- onClick: c,
462
+ onClick: s,
463
463
  style: {
464
464
  width: "100%",
465
465
  textAlign: "left",
466
466
  padding: "10px 12px",
467
467
  borderBottom: "1px solid var(--divider)",
468
- background: s ? "var(--row-selected-bg)" : "transparent",
469
- borderLeft: s ? "2px solid var(--accent)" : "2px solid transparent",
468
+ background: o ? "var(--row-selected-bg)" : "transparent",
469
+ borderLeft: o ? "2px solid var(--accent)" : "2px solid transparent",
470
470
  cursor: "pointer",
471
471
  transition: "background-color .12s",
472
472
  display: "flex",
@@ -476,12 +476,12 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
476
476
  borderBottomColor: "var(--divider)"
477
477
  },
478
478
  onMouseEnter: (e) => {
479
- s || (e.currentTarget.style.background = "var(--surface-3)");
479
+ o || (e.currentTarget.style.background = "var(--surface-3)");
480
480
  },
481
481
  onMouseLeave: (e) => {
482
- s || (e.currentTarget.style.background = "transparent");
482
+ o || (e.currentTarget.style.background = "transparent");
483
483
  },
484
- children: [u && /* @__PURE__ */ V("div", {
484
+ children: [l && /* @__PURE__ */ V("div", {
485
485
  style: {
486
486
  fontSize: 12.5,
487
487
  fontWeight: 500,
@@ -492,11 +492,11 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
492
492
  },
493
493
  children: x({
494
494
  entity: t,
495
- fieldName: u,
495
+ fieldName: l,
496
496
  record: e,
497
497
  mode: "display",
498
- refs: o,
499
- locale: l
498
+ refs: a,
499
+ locale: c
500
500
  })
501
501
  }), /* @__PURE__ */ H("div", {
502
502
  style: {
@@ -504,7 +504,7 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
504
504
  alignItems: "center",
505
505
  gap: 6
506
506
  },
507
- children: [d && /* @__PURE__ */ V("div", {
507
+ children: [u && /* @__PURE__ */ V("div", {
508
508
  style: {
509
509
  fontSize: 11,
510
510
  color: "var(--text-3)",
@@ -515,11 +515,11 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
515
515
  },
516
516
  children: x({
517
517
  entity: t,
518
- fieldName: d,
518
+ fieldName: u,
519
519
  record: e,
520
520
  mode: "display",
521
- refs: o,
522
- locale: l
521
+ refs: a,
522
+ locale: c
523
523
  })
524
524
  }), /* @__PURE__ */ V("div", {
525
525
  style: {
@@ -528,15 +528,15 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
528
528
  gap: 4,
529
529
  flexShrink: 0
530
530
  },
531
- children: f.map((n) => y(t, e, n) == null ? null : /* @__PURE__ */ V("div", {
531
+ children: d.map((n) => y(t, e, n) == null ? null : /* @__PURE__ */ V("div", {
532
532
  style: { fontSize: 11 },
533
533
  children: x({
534
534
  entity: t,
535
535
  fieldName: n,
536
536
  record: e,
537
537
  mode: "display",
538
- refs: o,
539
- locale: l
538
+ refs: a,
539
+ locale: c
540
540
  })
541
541
  }, n))
542
542
  })]
@@ -547,15 +547,15 @@ function W(e, t, n) {
547
547
  let r = y(e, t, n);
548
548
  return !(r == null || r === "" || Array.isArray(r) && r.length === 0);
549
549
  }
550
- function G({ entity: e, record: t, field: r, refs: a }) {
551
- let o = n(), s = u(t, e), c = r ? x({
550
+ function G({ entity: e, record: t, field: n, refs: r }) {
551
+ let i = p(), a = c(t, e), o = n ? x({
552
552
  entity: e,
553
- fieldName: r,
553
+ fieldName: n,
554
554
  record: t,
555
555
  mode: "display",
556
- refs: a,
557
- locale: o
558
- }) : s;
556
+ refs: r,
557
+ locale: i
558
+ }) : a;
559
559
  return /* @__PURE__ */ V("div", {
560
560
  style: {
561
561
  fontSize: 13.5,
@@ -563,21 +563,21 @@ function G({ entity: e, record: t, field: r, refs: a }) {
563
563
  color: "var(--text)",
564
564
  overflowWrap: "anywhere"
565
565
  },
566
- children: c || i(e.display.name)
566
+ children: o || l(e.display.name)
567
567
  });
568
568
  }
569
569
  function K({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
570
- let a = y(e, t, n);
571
- if (a == null || a === "") return null;
572
- let o = e.fields.get(n);
573
- return o ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("dt", {
570
+ let o = y(e, t, n);
571
+ if (o == null || o === "") return null;
572
+ let s = e.fields.get(n);
573
+ return s ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("dt", {
574
574
  style: {
575
575
  color: "var(--text-3)",
576
576
  fontSize: 11.5,
577
577
  minWidth: 0,
578
578
  overflowWrap: "anywhere"
579
579
  },
580
- children: g(o, n)
580
+ children: a(s, n)
581
581
  }), /* @__PURE__ */ V("dd", {
582
582
  style: {
583
583
  margin: 0,
@@ -597,7 +597,7 @@ function K({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
597
597
  })] }) : null;
598
598
  }
599
599
  function de({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList: a, relatedRecordsPresentation: o }) {
600
- return /* @__PURE__ */ V(c, { children: /* @__PURE__ */ V(q, {
600
+ return /* @__PURE__ */ V(d, { children: /* @__PURE__ */ V(q, {
601
601
  entityCode: e,
602
602
  recordId: t,
603
603
  items: n,
@@ -607,53 +607,53 @@ function de({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBack
607
607
  relatedRecordsPresentation: o
608
608
  }) });
609
609
  }
610
- function q({ entityCode: n, recordId: r, items: s, schema: c, entity: d, onBackToList: m, relatedRecordsPresentation: ee }) {
611
- let g = l(d, "update"), ne = L(() => r ? o(d, r) : void 0, [r, d]), { data: re, isLoading: x } = _(n, ne), T = v(n), D = a(), [O, k] = z(!1), [A, j] = z({}), M = re?.data, ie = M?.$statuses, ae = M?.$properties, se = N(n, r), I = oe(n, r), R = L(() => {
610
+ function q({ entityCode: n, recordId: a, items: u, schema: d, entity: f, onBackToList: p, relatedRecordsPresentation: te }) {
611
+ let g = o(f, "update"), ne = L(() => a ? m(f, a) : void 0, [a, f]), { data: re, isLoading: ie } = _(n, ne), x = v(n), T = h(), [D, k] = z(!1), [A, j] = z({}), M = re?.data, oe = M?.$statuses, se = M?.$properties, P = O(n, a), I = ae(n, a), R = L(() => {
612
612
  let e = /* @__PURE__ */ new Set();
613
- for (let [t, n] of d.fields) !n.auto && !n.primary && e.add(t);
614
- for (let [t] of d.files ?? []) e.add(t);
613
+ for (let [t, n] of f.fields) !n.auto && !n.primary && e.add(t);
614
+ for (let [t] of f.files ?? []) e.add(t);
615
615
  return e;
616
- }, [d]), ce = F(() => {
616
+ }, [f]), ce = F(() => {
617
617
  if (M) {
618
618
  let e = {};
619
619
  R.forEach((t) => {
620
- let n = y(d, M, t);
621
- e[t] = S(d, t) ? n ?? null : n ?? "";
620
+ let n = y(f, M, t);
621
+ e[t] = S(f, t) ? n ?? null : n ?? "";
622
622
  }), j(e);
623
623
  }
624
624
  k(!0);
625
625
  }, [
626
626
  M,
627
627
  R,
628
- d
628
+ f
629
629
  ]), le = F(async () => {
630
- await D.flushAllDrafts(), k(!1), j({});
631
- }, [D]), U = F(() => {
630
+ await T.flushAllDrafts(), k(!1), j({});
631
+ }, [T]), U = F(() => {
632
632
  let e = {}, t = E({
633
- entity: d,
633
+ entity: f,
634
634
  formData: A,
635
635
  record: M,
636
636
  isNew: !1
637
637
  }), n = w(t);
638
- for (let [t, n] of Object.entries(A)) d.files?.has(t) || (e[t] = b(d, t, n));
638
+ for (let [t, n] of Object.entries(A)) f.files?.has(t) || (e[t] = b(f, t, n));
639
639
  if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0) {
640
640
  k(!1), j({});
641
641
  return;
642
642
  }
643
- T.mutate({
644
- pkValues: r,
643
+ x.mutate({
644
+ pkValues: a,
645
645
  data: e
646
646
  }, {
647
647
  onSuccess: () => {
648
- n.forEach((e) => D.markCommitted(e)), k(!1), j({}), h.success("Saved");
648
+ n.forEach((e) => T.markCommitted(e)), k(!1), j({}), s.success("Saved");
649
649
  },
650
- onError: () => h.error("Failed to save")
650
+ onError: () => s.error("Failed to save")
651
651
  });
652
652
  }, [
653
- D,
654
653
  T,
655
- r,
656
- d,
654
+ x,
655
+ a,
656
+ f,
657
657
  A,
658
658
  M
659
659
  ]), ue = F((e, t) => {
@@ -662,34 +662,34 @@ function q({ entityCode: n, recordId: r, items: s, schema: c, entity: d, onBackT
662
662
  [e]: t
663
663
  }));
664
664
  }, []);
665
- if (x) return /* @__PURE__ */ V(C, {});
665
+ if (ie) return /* @__PURE__ */ V(C, {});
666
666
  if (!M) return null;
667
- let W = u(M, d), G = d.display?.display_field, K = W ? void 0 : G ? M[G] : M[d.fields.names()[0]], de = W || (K != null && typeof K != "object" ? te(K) : i(d.display.name)), q = M?.$refs, J = {
668
- schema: c,
669
- entity: d,
667
+ let W = c(M, f), G = f.display?.display_field, K = W ? void 0 : G ? M[G] : M[f.fields.names()[0]], de = W || (K != null && typeof K != "object" ? ee(K) : l(f.display.name)), q = M?.$refs, J = {
668
+ schema: d,
669
+ entity: f,
670
670
  entityCode: n,
671
- recordId: r,
672
- record: O ? {
671
+ recordId: a,
672
+ record: D ? {
673
673
  ...M,
674
674
  ...A
675
675
  } : M,
676
676
  isNew: !1,
677
- mode: O ? "edit" : "display",
678
- onFieldChange: O ? ue : void 0,
677
+ mode: D ? "edit" : "display",
678
+ onFieldChange: D ? ue : void 0,
679
679
  refs: q,
680
- objectProperties: ae ?? void 0,
680
+ objectProperties: se ?? void 0,
681
681
  onSetProperty: g ? (e, t) => I.mutate({
682
682
  propertyCode: e,
683
683
  value: t
684
684
  }) : void 0,
685
685
  isPropertyPending: I.isPending,
686
- objectStatuses: ie ?? void 0,
687
- onSetStatus: g ? (e, t) => se.mutate({
686
+ objectStatuses: oe ?? void 0,
687
+ onSetStatus: g ? (e, t) => P.mutate({
688
688
  groupCode: e,
689
689
  statusCode: t
690
690
  }) : void 0,
691
- isStatusPending: se.isPending,
692
- relatedRecordsPresentation: ee
691
+ isStatusPending: P.isPending,
692
+ relatedRecordsPresentation: te
693
693
  };
694
694
  return /* @__PURE__ */ H("div", {
695
695
  style: {
@@ -726,23 +726,23 @@ function q({ entityCode: n, recordId: r, items: s, schema: c, entity: d, onBackT
726
726
  alignItems: "center",
727
727
  gap: 6
728
728
  },
729
- children: [m && /* @__PURE__ */ V(f, {
729
+ children: [p && /* @__PURE__ */ V(r, {
730
730
  icon: /* @__PURE__ */ V(e.back, { size: 14 }),
731
731
  title: "Back to list",
732
- onClick: m
733
- }), g && (O ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(p, {
732
+ onClick: p
733
+ }), g && (D ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(i, {
734
734
  size: "xs",
735
735
  icon: /* @__PURE__ */ V(e.x, { size: 12 }),
736
736
  onClick: le,
737
737
  children: "Cancel"
738
- }), /* @__PURE__ */ V(p, {
738
+ }), /* @__PURE__ */ V(i, {
739
739
  kind: "primary",
740
740
  size: "xs",
741
- icon: T.isPending ? /* @__PURE__ */ V(t, { size: 12 }) : /* @__PURE__ */ V(e.save, { size: 12 }),
741
+ icon: x.isPending ? /* @__PURE__ */ V(t, { size: 12 }) : /* @__PURE__ */ V(e.save, { size: 12 }),
742
742
  onClick: U,
743
- disabled: T.isPending,
744
- children: T.isPending ? "Saving…" : "Save"
745
- })] }) : /* @__PURE__ */ V(p, {
743
+ disabled: x.isPending,
744
+ children: x.isPending ? "Saving…" : "Save"
745
+ })] }) : /* @__PURE__ */ V(i, {
746
746
  size: "xs",
747
747
  icon: /* @__PURE__ */ V(e.edit, { size: 12 }),
748
748
  onClick: ce,
@@ -758,8 +758,8 @@ function q({ entityCode: n, recordId: r, items: s, schema: c, entity: d, onBackT
758
758
  flexDirection: "column",
759
759
  gap: 12
760
760
  },
761
- children: s && s.length > 0 ? /* @__PURE__ */ V(P, {
762
- nodes: s,
761
+ children: u && u.length > 0 ? /* @__PURE__ */ V(N, {
762
+ nodes: u,
763
763
  ctx: J
764
764
  }) : /* @__PURE__ */ H("p", {
765
765
  style: {