@declarion/react 0.44.0 → 0.47.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 (40) hide show
  1. package/dist-lib/{DraggableChildrenTable-G4Sw1XAD.js → DraggableChildrenTable-B6KjWkwD.js} +39 -39
  2. package/dist-lib/{DynamicIcon-DeRpAaXm.js → DynamicIcon-Dc2j-rg_.js} +19 -17
  3. package/dist-lib/{Grid-CXn-IK3H.js → Grid-OdquWJNX.js} +2 -2
  4. package/dist-lib/{LayoutRenderer-DX8pFS5A.js → LayoutRenderer-CzAdhjNT.js} +794 -787
  5. package/dist-lib/{MarkdownRenderer-CreI9x2m.js → MarkdownRenderer-C6bhrAIe.js} +10 -10
  6. package/dist-lib/{RefreshControl-DFh0-gCb.js → RefreshControl-F9Ib9asP.js} +179 -179
  7. package/dist-lib/{SmartDetailPage.impl-K6Jj1-9z.js → SmartDetailPage.impl-DdSu3kmW.js} +631 -593
  8. package/dist-lib/{SmartRecordListPage.impl-DQW_uVfL.js → SmartRecordListPage.impl-SkIp0_Rd.js} +220 -209
  9. package/dist-lib/api/agents.d.ts +39 -7
  10. package/dist-lib/components/agents/AgentChatPanel.d.ts +6 -1
  11. package/dist-lib/components/agents/transcript-runs.d.ts +29 -0
  12. package/dist-lib/components/file-widgets/host.d.ts +1 -0
  13. package/dist-lib/components/list/QuickPeek.d.ts +1 -1
  14. package/dist-lib/components/pages/exportRequest.d.ts +3 -3
  15. package/dist-lib/components/pages/list/ListFloatbar.d.ts +4 -2
  16. package/dist-lib/components/pages/list/cardProjection.d.ts +2 -1
  17. package/dist-lib/components/pages/list/filter-meta.d.ts +22 -8
  18. package/dist-lib/components/shared/RowActionsKebab.d.ts +3 -2
  19. package/dist-lib/components/views/ViewSwitcher.d.ts +2 -1
  20. package/dist-lib/hooks/useAgentConversation.d.ts +7 -19
  21. package/dist-lib/hooks/useCursorEntityData.d.ts +3 -2
  22. package/dist-lib/hooks/useFilters.d.ts +1 -0
  23. package/dist-lib/icons.js +1 -1
  24. package/dist-lib/index.d.ts +8 -1
  25. package/dist-lib/index.js +3246 -2984
  26. package/dist-lib/lib/actions.d.ts +1 -1
  27. package/dist-lib/lib/anchor.d.ts +37 -0
  28. package/dist-lib/lib/filter-evaluator.d.ts +16 -0
  29. package/dist-lib/lib/filters.d.ts +10 -4
  30. package/dist-lib/lib/messages.d.ts +1 -0
  31. package/dist-lib/lib/variants.d.ts +7 -0
  32. package/dist-lib/{registry-r4hiflwC.js → registry-C2VD-5MD.js} +1103 -879
  33. package/dist-lib/testing.js +10 -10
  34. package/dist-lib/types/api.d.ts +3 -10
  35. package/dist-lib/types/schema.d.ts +51 -13
  36. package/dist-lib/{useCurrentScreen-CpQjVmrT.js → useCurrentScreen-ow4r-nWa.js} +1130 -1054
  37. package/dist-lib/{useProperties-CULxrNT4.js → useProperties-lEKfzm2X.js} +114 -83
  38. package/dist-lib/{value-fUHxMV4r.js → value-CXohNH6a.js} +1 -1
  39. package/dist-lib/vite/index.js +23 -22
  40. package/package.json +12 -12
@@ -1,136 +1,135 @@
1
- import { s as e } from "./DynamicIcon-DeRpAaXm.js";
2
- import { A as t, At as n, F as r, Gn as i, In as a, Jn as o, N as s, Nn as c, Sn as l, X as u, Xn as d, cr as ee, lr as f, nr as te, q as p, rt as m, wn as h, xn as g, yn as _ } from "./useCurrentScreen-CpQjVmrT.js";
3
- import { G as v, K as y, U as ne, W as b, Y as x, _ as re, a as S, c as C, k as w, q as T, s as E, w as ie } from "./registry-r4hiflwC.js";
4
- import { _ as D, c as O, f as k, h as A, m as ae, n as j, p as M, r as N, x as P } from "./useProperties-CULxrNT4.js";
5
- import { t as F } from "./LayoutRenderer-DX8pFS5A.js";
1
+ import { s as e } from "./DynamicIcon-Dc2j-rg_.js";
2
+ import { A as t, At as n, Cn as r, F as i, Kn as a, Ln as o, N as s, Pn as c, Sn as l, Tn as u, X as d, Yn as f, Zn as p, bn as m, lr as ee, q as h, rr as te, rt as g, ur as _ } from "./useCurrentScreen-ow4r-nWa.js";
3
+ import { $ as v, A as y, Q as b, T as x, X as S, Z as C, a as w, c as ne, et as T, nt as E, s as D, v as O } from "./registry-C2VD-5MD.js";
4
+ import { S as k, c as A, f as j, g as M, h as N, m as re, n as ie, r as P, v as ae } from "./useProperties-lEKfzm2X.js";
5
+ import { t as F } from "./LayoutRenderer-CzAdhjNT.js";
6
6
  import { useCallback as I, useEffect as L, useMemo as R, useRef as z, useState as oe } from "react";
7
7
  import { useSearchParams as se } from "react-router";
8
8
  import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
9
9
  //#region src/components/pages/SmartRecordListPage.impl.tsx
10
10
  function U({ screenCode: t }) {
11
- let [r, s] = se(), { data: c } = n(), l = te(), d = c?.screens[t], f = d?.entity ? c?.entities[d.entity] : void 0, m = d?.entity;
12
- A(d, f, r.toString()), D(d?.route);
13
- let _ = re(), v = r.get("selected") ?? null, y = r.get("search") ?? "", ne = p(y, 300), b = r.get("sort") ?? d?.sort_default ?? "", x = R(() => {
14
- let e = k(r);
15
- return e.length > 0 ? e : void 0;
16
- }, [r]), S = R(() => d?.columns ?? f?.fields.names().filter((e) => !f.fields.get(e)?.primary && !f.fields.get(e)?.auto && f.fields.get(e)?.display?.is_listable !== !1).slice(0, 4) ?? [], [d?.columns, f]), w = R(() => {
17
- let e = d?.responsive?.[l.category]?.presentation;
18
- return l.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
19
- }, [d?.responsive, l.category]), T = R(() => {
20
- let e = d?.responsive?.[l.category];
21
- return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation : l.category === "phone" ? "cards" : "table";
22
- }, [d?.responsive, l.category]), ie = d?.responsive?.[l.category]?.layout?.related_records, j = R(() => E({
23
- entity: f,
24
- screen: d
25
- }), [f, d]), N = R(() => C({
26
- entity: f,
27
- screen: d,
28
- presentation: T,
29
- visibleColumns: S,
30
- card: j,
31
- sort: b
11
+ let [r, i] = se(), { data: s } = n(), c = te(), p = s?.screens[t], m = p?.entity ? s?.entities[p.entity] : void 0, g = p?.entity;
12
+ M(p, m, r.toString()), ae(p?.route);
13
+ let _ = O(), v = r.get("selected") ?? null, y = r.get("search") ?? "", b = h(y, 300), x = r.get("sort") ?? p?.sort_default ?? "", S = R(() => j(r), [r]), C = S.filters.length > 0 ? S.filters : void 0, w = R(() => p?.columns ?? m?.fields.names().filter((e) => !m.fields.get(e)?.primary && !m.fields.get(e)?.auto && m.fields.get(e)?.display?.is_listable !== !1).slice(0, 4) ?? [], [p?.columns, m]), T = R(() => {
14
+ let e = p?.responsive?.[c.category]?.presentation;
15
+ return c.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
16
+ }, [p?.responsive, c.category]), E = R(() => {
17
+ let e = p?.responsive?.[c.category];
18
+ 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";
19
+ }, [p?.responsive, c.category]), ie = p?.responsive?.[c.category]?.layout?.related_records, P = R(() => D({
20
+ entity: m,
21
+ screen: p
22
+ }), [m, p]), F = R(() => ne({
23
+ entity: m,
24
+ screen: p,
25
+ presentation: E,
26
+ visibleColumns: w,
27
+ card: P,
28
+ sort: x
32
29
  }), [
33
- f,
34
- d,
35
- T,
36
- S,
37
- j,
38
- b
39
- ]), F = f?.list_pagination === "cursor", { data: U, isLoading: W } = u(m, {
30
+ m,
31
+ p,
32
+ E,
33
+ w,
34
+ P,
35
+ x
36
+ ]), U = m?.list_pagination === "cursor", { data: W, isLoading: G } = d(g, {
40
37
  page: 1,
41
38
  per_page: 200,
42
- sort: b || void 0,
43
- search: ne || void 0,
44
- filters: x,
45
- select: N.selectFields,
46
- expand: N.expandFields,
39
+ sort: x || void 0,
40
+ search: b || void 0,
41
+ filters: S.error ? void 0 : C,
42
+ select: F.selectFields,
43
+ expand: F.expandFields,
47
44
  preview: !0,
48
- screen: d?.fixed_filters ? t : void 0
49
- }, !F), G = P(m, {
50
- sort: b || void 0,
51
- search: ne || void 0,
52
- filters: x,
53
- select: N.selectFields,
54
- expand: N.expandFields,
45
+ screen: p?.fixed_filters ? t : void 0
46
+ }, !U), K = k(g, {
47
+ sort: x || void 0,
48
+ search: b || void 0,
49
+ filters: S.error ? void 0 : C,
50
+ select: F.selectFields,
51
+ expand: F.expandFields,
55
52
  preview: !0,
56
- screen: d?.fixed_filters ? t : void 0,
53
+ screen: p?.fixed_filters ? t : void 0,
57
54
  limit: 200
58
- }, F), K = F ? G.rows : U?.data ?? [], J = F ? G.refs : U?.$refs, le = F ? G.isLoading : W, ue = R(() => f?.fields.names().find((e) => f.fields.get(e)?.primary) ?? "id", [f]), de = I((e, t) => {
59
- s((t) => {
55
+ }, U), J = U ? K.rows : W?.data ?? [], le = U ? K.refs : W?.$refs, ue = U ? K.isLoading : G, de = R(() => m?.fields.names().find((e) => m.fields.get(e)?.primary) ?? "id", [m]), fe = I((e, t) => {
56
+ i((t) => {
60
57
  let n = new URLSearchParams(t);
61
58
  return e ? n.set("selected", e) : n.delete("selected"), n;
62
59
  }, { replace: t?.replace ?? !0 });
63
- }, [s]), fe = I((e) => {
64
- s((t) => {
60
+ }, [i]), pe = I((e) => {
61
+ i((t) => {
65
62
  let n = new URLSearchParams(t);
66
63
  return e ? n.set("search", e) : n.delete("search"), n;
67
64
  }, { replace: !0 });
68
- }, [s]), pe = I((e, t) => {
69
- s((n) => {
70
- let r = new URLSearchParams(n), i = k(n), a;
71
- return a = t && t !== "__all__" ? [...M(i, e), O(e, t)] : M(i, e), ae(a, r), r;
65
+ }, [i]), me = I((e, t) => {
66
+ i((n) => {
67
+ let r = new URLSearchParams(n), i = j(n).filters, a;
68
+ return a = t && t !== "__all__" ? [...re(i, e), A(e, t)] : re(i, e), N(a, r), r;
72
69
  }, { replace: !0 });
73
- }, [s]), Y = (d?.list_resizable ?? !1) && w === "split" && l.category !== "phone" && !l.touch, me = z(null), [X, Z] = oe(null), Q = z(!1), $ = d?.list_width;
70
+ }, [i]), Y = (p?.list_resizable ?? !1) && T === "split" && c.category !== "phone" && !c.touch, he = z(null), [X, Z] = oe(null), Q = z(!1), $ = p?.list_width;
74
71
  L(() => {
75
72
  !Y || !$?.endsWith("%") || Z(null);
76
73
  }, [
77
74
  Y,
78
75
  $,
79
- l.width,
80
- l.height
76
+ c.width,
77
+ c.height
81
78
  ]), L(() => {
82
79
  if (!Y || X !== null) return;
83
- let e = me.current;
84
- if (e) if ($ && $.endsWith("%")) {
85
- let t = parseFloat($) / 100;
86
- Z(Math.round(e.getBoundingClientRect().width * t));
87
- } else Z($ && parseInt($, 10) || 320);
80
+ let e = he.current;
81
+ if (e) {
82
+ if ($ && $.endsWith("%")) {
83
+ let t = parseFloat($) / 100;
84
+ Z(Math.round(e.getBoundingClientRect().width * t));
85
+ } else Z($ && parseInt($, 10) || 320);
86
+ }
88
87
  }, [
89
88
  Y,
90
89
  $,
91
90
  X,
92
- f
91
+ m
93
92
  ]);
94
- let he = z(null);
93
+ let ge = z(null);
95
94
  L(() => () => {
96
- he.current?.();
95
+ ge.current?.();
97
96
  }, []);
98
- let ge = I((e) => {
97
+ let _e = I((e) => {
99
98
  e.preventDefault(), Q.current = !0;
100
99
  let t = e.clientX, n = X ?? 320, r = (e) => {
101
100
  if (!Q.current) return;
102
- let r = (me.current?.getBoundingClientRect().width ?? window.innerWidth) - 300, i = Math.max(200, Math.min(r, n + e.clientX - t));
101
+ let r = (he.current?.getBoundingClientRect().width ?? window.innerWidth) - 300, i = Math.max(200, Math.min(r, n + e.clientX - t));
103
102
  Z(i);
104
103
  }, i = () => {
105
- Q.current = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i), document.body.style.cursor = "", document.body.style.userSelect = "", he.current = null;
104
+ Q.current = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i), document.body.style.cursor = "", document.body.style.userSelect = "", ge.current = null;
106
105
  };
107
- document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), he.current = i;
106
+ document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), ge.current = i;
108
107
  }, [X]);
109
- if (!c || !d || !f) return null;
110
- let _e = x?.length ?? 0, ve = w === "split" || w === "stacked" || !v, ye = w === "split" || w === "stacked" || !!v, be = w !== "split" && v ? () => de(null, { replace: !0 }) : void 0, xe = w === "split" ? Y && X !== null ? X : d.list_width ?? "320px" : "100%";
108
+ if (!s || !p || !m) return null;
109
+ let ve = C?.length ?? 0, ye = T === "split" || T === "stacked" || !v, be = T === "split" || T === "stacked" || !!v, xe = T !== "split" && v ? () => fe(null, { replace: !0 }) : void 0, Se = T === "split" ? Y && X !== null ? X : p.list_width ?? "320px" : "100%";
111
110
  return /* @__PURE__ */ H("div", {
112
- ref: me,
113
- "data-record-list-presentation": w,
111
+ ref: he,
112
+ "data-record-list-presentation": T,
114
113
  style: {
115
114
  display: "flex",
116
- flexDirection: w === "stacked" ? "column" : "row",
115
+ flexDirection: T === "stacked" ? "column" : "row",
117
116
  height: "100%",
118
117
  minWidth: 0,
119
118
  overflow: "hidden"
120
119
  },
121
120
  children: [
122
- ve && /* @__PURE__ */ H("div", {
121
+ ye && /* @__PURE__ */ H("div", {
123
122
  "data-testid": "record-list-panel",
124
123
  style: {
125
- flex: w === "split" ? "none" : "1 1 auto",
124
+ flex: T === "split" ? "none" : "1 1 auto",
126
125
  display: "flex",
127
126
  flexDirection: "column",
128
127
  overflow: "hidden",
129
- borderRight: w === "split" && !Y ? "1px solid var(--divider)" : "none",
130
- borderBottom: w === "stacked" ? "1px solid var(--divider)" : "none",
131
- width: xe,
128
+ borderRight: T === "split" && !Y ? "1px solid var(--divider)" : "none",
129
+ borderBottom: T === "stacked" ? "1px solid var(--divider)" : "none",
130
+ width: Se,
132
131
  minWidth: 0,
133
- height: w === "stacked" ? "50%" : "100%"
132
+ height: T === "stacked" ? "50%" : "100%"
134
133
  },
135
134
  children: [/* @__PURE__ */ H("div", {
136
135
  style: {
@@ -157,37 +156,49 @@ function U({ screenCode: t }) {
157
156
  fontWeight: 600,
158
157
  color: "var(--text)"
159
158
  },
160
- children: h(d.display?.name) || h(f.display.name_plural)
159
+ children: u(p.display?.name) || u(m.display.name_plural)
161
160
  })]
162
161
  }),
163
- /* @__PURE__ */ V(o, {
162
+ /* @__PURE__ */ V(f, {
164
163
  value: y,
165
- onChange: fe,
166
- placeholder: `Search ${h(f.display.name_plural)}…`,
164
+ onChange: pe,
165
+ placeholder: `Search ${u(m.display.name_plural)}…`,
167
166
  prefix: /* @__PURE__ */ V(e.search, { size: 13 })
168
167
  }),
169
- d.filters && d.filters.length > 0 && /* @__PURE__ */ V("div", {
168
+ S.error && /* @__PURE__ */ H("div", {
169
+ role: "alert",
170
+ "data-testid": "record-list-filter-url-error",
171
+ style: {
172
+ padding: "7px 9px",
173
+ border: "1px solid var(--danger)",
174
+ borderRadius: 6,
175
+ color: "var(--danger)",
176
+ fontSize: 11.5
177
+ },
178
+ children: [S.error, " Showing this list without URL filters."]
179
+ }),
180
+ p.filters && p.filters.length > 0 && /* @__PURE__ */ V("div", {
170
181
  style: {
171
182
  display: "flex",
172
183
  flexWrap: "wrap",
173
184
  gap: 6
174
185
  },
175
- children: d.filters.map((e) => {
176
- let t = f.fields.get(e);
186
+ children: p.filters.map((e) => {
187
+ let t = m.fields.get(e);
177
188
  if (!t?.values) return null;
178
- let n = x?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r = g(t, e, c.entities);
189
+ let n = C?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r = l(t, e, s.entities), i = [{
190
+ value: "__all__",
191
+ label: `All ${r}`
192
+ }, ...t.values.map((e) => ({
193
+ value: e.code,
194
+ label: u(e.name) || e.code
195
+ }))];
179
196
  return /* @__PURE__ */ V("div", {
180
197
  style: { minWidth: 120 },
181
- children: /* @__PURE__ */ V(i, {
198
+ children: /* @__PURE__ */ V(a, {
182
199
  value: n,
183
- options: [{
184
- value: "__all__",
185
- label: `All ${r}`
186
- }, ...t.values.map((e) => ({
187
- value: e.code,
188
- label: h(e.name) || e.code
189
- }))],
190
- onChange: (t) => pe(e, t),
200
+ options: i,
201
+ onChange: (t) => me(e, t),
191
202
  placeholder: r
192
203
  })
193
204
  }, e);
@@ -201,8 +212,8 @@ function U({ screenCode: t }) {
201
212
  fontSize: 11,
202
213
  color: "var(--text-3)"
203
214
  },
204
- children: [/* @__PURE__ */ V("span", { children: le ? "Loading…" : `${K.length} ${h(f.display.name_plural)}` }), _e > 0 && /* @__PURE__ */ V("button", {
205
- onClick: () => s((e) => {
215
+ children: [/* @__PURE__ */ V("span", { children: ue ? "Loading…" : `${J.length} ${u(m.display.name_plural)}` }), ve > 0 && /* @__PURE__ */ V("button", {
216
+ onClick: () => i((e) => {
206
217
  let t = new URLSearchParams(e);
207
218
  return t.delete("filters"), t;
208
219
  }, { replace: !0 }),
@@ -223,12 +234,12 @@ function U({ screenCode: t }) {
223
234
  style: {
224
235
  flex: 1,
225
236
  overflowY: "auto",
226
- padding: T === "cards" ? 10 : 0,
227
- display: T === "cards" ? "flex" : "block",
237
+ padding: E === "cards" ? 10 : 0,
238
+ display: E === "cards" ? "flex" : "block",
228
239
  flexDirection: "column",
229
- gap: T === "cards" ? 10 : void 0
240
+ gap: E === "cards" ? 10 : void 0
230
241
  },
231
- children: le ? /* @__PURE__ */ V("div", {
242
+ children: ue ? /* @__PURE__ */ V("div", {
232
243
  style: {
233
244
  padding: 12,
234
245
  display: "flex",
@@ -240,7 +251,7 @@ function U({ screenCode: t }) {
240
251
  borderRadius: 6,
241
252
  background: "var(--surface-3)"
242
253
  } }, t))
243
- }) : K.length === 0 ? /* @__PURE__ */ V("div", {
254
+ }) : J.length === 0 ? /* @__PURE__ */ V("div", {
244
255
  style: {
245
256
  padding: 28,
246
257
  textAlign: "center",
@@ -248,23 +259,23 @@ function U({ screenCode: t }) {
248
259
  color: "var(--text-3)"
249
260
  },
250
261
  children: "No records found"
251
- }) : /* @__PURE__ */ H(B, { children: [K.map((e) => {
252
- let t = a(e[ue]);
262
+ }) : /* @__PURE__ */ H(B, { children: [J.map((e) => {
263
+ let t = o(e[de]);
253
264
  return /* @__PURE__ */ V(ce, {
254
265
  record: e,
255
- entity: f,
256
- columns: S,
257
- card: j,
258
- presentation: T,
259
- refs: J,
266
+ entity: m,
267
+ columns: w,
268
+ card: P,
269
+ presentation: E,
270
+ refs: le,
260
271
  isSelected: t === v,
261
- onClick: () => de(t, { replace: w === "split" })
272
+ onClick: () => fe(t, { replace: T === "split" })
262
273
  }, t);
263
- }), F && G.hasMore && /* @__PURE__ */ V("button", {
274
+ }), U && K.hasMore && /* @__PURE__ */ V("button", {
264
275
  type: "button",
265
276
  "data-testid": "record-list-load-more",
266
- onClick: () => void G.fetchNextPage(),
267
- disabled: G.isFetchingNextPage,
277
+ onClick: () => void K.fetchNextPage(),
278
+ disabled: K.isFetchingNextPage,
268
279
  style: {
269
280
  width: "100%",
270
281
  padding: "8px 12px",
@@ -273,15 +284,15 @@ function U({ screenCode: t }) {
273
284
  border: "none",
274
285
  borderTop: "1px solid var(--divider)",
275
286
  color: "var(--text-2)",
276
- cursor: G.isFetchingNextPage ? "default" : "pointer"
287
+ cursor: K.isFetchingNextPage ? "default" : "pointer"
277
288
  },
278
- children: G.isFetchingNextPage ? "Loading…" : "Load more"
289
+ children: K.isFetchingNextPage ? "Loading…" : "Load more"
279
290
  })] })
280
291
  })]
281
292
  }),
282
293
  Y && /* @__PURE__ */ V("div", {
283
294
  "data-testid": "record-list-resize-handle",
284
- onMouseDown: ge,
295
+ onMouseDown: _e,
285
296
  style: {
286
297
  flex: "none",
287
298
  width: 1,
@@ -292,21 +303,21 @@ function U({ screenCode: t }) {
292
303
  onMouseEnter: (e) => e.currentTarget.style.background = "var(--border-strong)",
293
304
  onMouseLeave: (e) => e.currentTarget.style.background = "var(--divider)"
294
305
  }),
295
- ye && /* @__PURE__ */ V("div", {
306
+ be && /* @__PURE__ */ V("div", {
296
307
  "data-testid": "record-detail-panel",
297
308
  style: {
298
309
  flex: 1,
299
310
  minWidth: 0,
300
311
  overflow: "hidden",
301
- height: w === "stacked" ? "50%" : "100%"
312
+ height: T === "stacked" ? "50%" : "100%"
302
313
  },
303
314
  children: v ? /* @__PURE__ */ V(q, {
304
- entityCode: m,
315
+ entityCode: g,
305
316
  recordId: v,
306
- items: d.items,
307
- schema: c,
308
- entity: f,
309
- onBackToList: be,
317
+ items: p.items,
318
+ schema: s,
319
+ entity: m,
320
+ onBackToList: xe,
310
321
  relatedRecordsPresentation: ie
311
322
  }, v) : /* @__PURE__ */ V("div", {
312
323
  style: {
@@ -320,7 +331,7 @@ function U({ screenCode: t }) {
320
331
  style: { fontSize: 12.5 },
321
332
  children: [
322
333
  "Select a ",
323
- h(f.display.name),
334
+ u(m.display.name),
324
335
  " to view details"
325
336
  ]
326
337
  })
@@ -441,7 +452,7 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
441
452
  ]
442
453
  });
443
454
  }
444
- let u = r[0], d = r[1], ee = r.slice(2, 4);
455
+ let u = r[0], d = r[1], f = r.slice(2, 4);
445
456
  return /* @__PURE__ */ H("button", {
446
457
  onClick: c,
447
458
  style: {
@@ -512,7 +523,7 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
512
523
  gap: 4,
513
524
  flexShrink: 0
514
525
  },
515
- children: ee.map((t) => y(n, e, t) == null ? null : /* @__PURE__ */ V("div", {
526
+ children: f.map((t) => v(n, e, t) == null ? null : /* @__PURE__ */ V("div", {
516
527
  style: { fontSize: 11 },
517
528
  children: T({
518
529
  entity: n,
@@ -528,11 +539,18 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
528
539
  });
529
540
  }
530
541
  function W(e, t, n) {
531
- let r = y(e, t, n);
542
+ let r = v(e, t, n);
532
543
  return !(r == null || r === "" || Array.isArray(r) && r.length === 0);
533
544
  }
534
- function G({ entity: e, record: n, field: r, refs: i }) {
535
- let a = t(), o = l(n, e);
545
+ function G({ entity: e, record: n, field: i, refs: a }) {
546
+ let o = t(), s = r(n, e), c = i ? T({
547
+ entity: e,
548
+ fieldName: i,
549
+ record: n,
550
+ mode: "display",
551
+ refs: a,
552
+ locale: o
553
+ }) : s;
536
554
  return /* @__PURE__ */ V("div", {
537
555
  style: {
538
556
  fontSize: 13.5,
@@ -540,18 +558,11 @@ function G({ entity: e, record: n, field: r, refs: i }) {
540
558
  color: "var(--text)",
541
559
  overflowWrap: "anywhere"
542
560
  },
543
- children: (r ? T({
544
- entity: e,
545
- fieldName: r,
546
- record: n,
547
- mode: "display",
548
- refs: i,
549
- locale: a
550
- }) : o) || h(e.display.name)
561
+ children: c || u(e.display.name)
551
562
  });
552
563
  }
553
564
  function K({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
554
- let a = y(e, t, n);
565
+ let a = v(e, t, n);
555
566
  if (a == null || a === "") return null;
556
567
  let o = e.fields.get(n);
557
568
  return o ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("dt", {
@@ -561,7 +572,7 @@ function K({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
561
572
  minWidth: 0,
562
573
  overflowWrap: "anywhere"
563
574
  },
564
- children: g(o, n)
575
+ children: l(o, n)
565
576
  }), /* @__PURE__ */ V("dd", {
566
577
  style: {
567
578
  margin: 0,
@@ -591,89 +602,89 @@ function q({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackT
591
602
  relatedRecordsPresentation: o
592
603
  }) });
593
604
  }
594
- function J({ entityCode: t, recordId: n, items: i, schema: o, entity: s, onBackToList: u, relatedRecordsPresentation: te }) {
595
- let p = _(s, "update"), { data: g, isLoading: re } = S(t, R(() => n ? c(s, n) : void 0, [n, s])), C = w(t), T = r(), [E, D] = oe(!1), [O, k] = oe({}), A = g?.data, ae = A?.$statuses, M = A?.$properties, P = N(t, n), L = j(t, n), z = R(() => {
605
+ function J({ entityCode: t, recordId: n, items: a, schema: s, entity: l, onBackToList: d, relatedRecordsPresentation: f }) {
606
+ let h = m(l, "update"), te = R(() => n ? c(l, n) : void 0, [n, l]), { data: ne, isLoading: T } = w(t, te), D = y(t), O = i(), [k, A] = oe(!1), [j, M] = oe({}), N = ne?.data, re = N?.$statuses, ae = N?.$properties, L = P(t, n), z = ie(t, n), se = R(() => {
596
607
  let e = /* @__PURE__ */ new Set();
597
- for (let [t, n] of s.fields) !n.auto && !n.primary && e.add(t);
598
- for (let [t] of s.files ?? []) e.add(t);
608
+ for (let [t, n] of l.fields) !n.auto && !n.primary && e.add(t);
609
+ for (let [t] of l.files ?? []) e.add(t);
599
610
  return e;
600
- }, [s]), se = I(() => {
601
- if (A) {
611
+ }, [l]), U = I(() => {
612
+ if (N) {
602
613
  let e = {};
603
- z.forEach((t) => {
604
- let n = y(s, A, t);
605
- e[t] = v(s, t) ? n ?? null : n ?? "";
606
- }), k(e);
614
+ se.forEach((t) => {
615
+ let n = v(l, N, t);
616
+ e[t] = b(l, t) ? n ?? null : n ?? "";
617
+ }), M(e);
607
618
  }
608
- D(!0);
619
+ A(!0);
609
620
  }, [
610
- A,
611
- z,
612
- s
613
- ]), U = I(async () => {
614
- await T.flushAllDrafts(), D(!1), k({});
615
- }, [T]), ce = I(() => {
616
- let e = {}, t = ne({
617
- entity: s,
618
- formData: O,
619
- record: A,
621
+ N,
622
+ se,
623
+ l
624
+ ]), ce = I(async () => {
625
+ await O.flushAllDrafts(), A(!1), M({});
626
+ }, [O]), W = I(() => {
627
+ let e = {}, t = S({
628
+ entity: l,
629
+ formData: j,
630
+ record: N,
620
631
  isNew: !1
621
- }), r = b(t);
622
- for (let [t, n] of Object.entries(O)) s.files?.has(t) || (e[t] = x(s, t, n));
632
+ }), r = C(t);
633
+ for (let [t, n] of Object.entries(j)) l.files?.has(t) || (e[t] = E(l, t, n));
623
634
  if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0) {
624
- D(!1), k({});
635
+ A(!1), M({});
625
636
  return;
626
637
  }
627
- C.mutate({
638
+ D.mutate({
628
639
  pkValues: n,
629
640
  data: e
630
641
  }, {
631
642
  onSuccess: () => {
632
- r.forEach((e) => T.markCommitted(e)), D(!1), k({}), m.success("Saved");
643
+ r.forEach((e) => O.markCommitted(e)), A(!1), M({}), g.success("Saved");
633
644
  },
634
- onError: () => m.error("Failed to save")
645
+ onError: () => g.error("Failed to save")
635
646
  });
636
647
  }, [
637
- T,
638
- C,
639
- n,
640
- s,
641
648
  O,
642
- A
643
- ]), W = I((e, t) => {
644
- k((n) => ({
649
+ D,
650
+ n,
651
+ l,
652
+ j,
653
+ N
654
+ ]), G = I((e, t) => {
655
+ M((n) => ({
645
656
  ...n,
646
657
  [e]: t
647
658
  }));
648
659
  }, []);
649
- if (re) return /* @__PURE__ */ V(ie, {});
650
- if (!A) return null;
651
- let G = l(A, s), K = s.display?.display_field, q = G ? void 0 : K ? A[K] : A[s.fields.names()[0]], J = G || (q != null && typeof q != "object" ? a(q) : h(s.display.name)), le = A?.$refs, ue = {
652
- schema: o,
653
- entity: s,
660
+ if (T) return /* @__PURE__ */ V(x, {});
661
+ if (!N) return null;
662
+ let K = r(N, l), q = l.display?.display_field, J = K ? void 0 : q ? N[q] : N[l.fields.names()[0]], le = K || (J != null && typeof J != "object" ? o(J) : u(l.display.name)), ue = N?.$refs, de = {
663
+ schema: s,
664
+ entity: l,
654
665
  entityCode: t,
655
666
  recordId: n,
656
- record: E ? {
657
- ...A,
658
- ...O
659
- } : A,
667
+ record: k ? {
668
+ ...N,
669
+ ...j
670
+ } : N,
660
671
  isNew: !1,
661
- mode: E ? "edit" : "display",
662
- onFieldChange: E ? W : void 0,
663
- refs: le,
664
- objectProperties: M ?? void 0,
665
- onSetProperty: p ? (e, t) => L.mutate({
672
+ mode: k ? "edit" : "display",
673
+ onFieldChange: k ? G : void 0,
674
+ refs: ue,
675
+ objectProperties: ae ?? void 0,
676
+ onSetProperty: h ? (e, t) => z.mutate({
666
677
  propertyCode: e,
667
678
  value: t
668
679
  }) : void 0,
669
- isPropertyPending: L.isPending,
670
- objectStatuses: ae ?? void 0,
671
- onSetStatus: p ? (e, t) => P.mutate({
680
+ isPropertyPending: z.isPending,
681
+ objectStatuses: re ?? void 0,
682
+ onSetStatus: h ? (e, t) => L.mutate({
672
683
  groupCode: e,
673
684
  statusCode: t
674
685
  }) : void 0,
675
- isStatusPending: P.isPending,
676
- relatedRecordsPresentation: te
686
+ isStatusPending: L.isPending,
687
+ relatedRecordsPresentation: f
677
688
  };
678
689
  return /* @__PURE__ */ H("div", {
679
690
  style: {
@@ -703,33 +714,33 @@ function J({ entityCode: t, recordId: n, items: i, schema: o, entity: s, onBackT
703
714
  whiteSpace: "nowrap",
704
715
  color: "var(--text)"
705
716
  },
706
- children: J
717
+ children: le
707
718
  }), /* @__PURE__ */ H("div", {
708
719
  style: {
709
720
  display: "flex",
710
721
  alignItems: "center",
711
722
  gap: 6
712
723
  },
713
- children: [u && /* @__PURE__ */ V(ee, {
724
+ children: [d && /* @__PURE__ */ V(ee, {
714
725
  icon: /* @__PURE__ */ V(e.back, { size: 14 }),
715
726
  title: "Back to list",
716
- onClick: u
717
- }), p && (E ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(f, {
727
+ onClick: d
728
+ }), h && (k ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(_, {
718
729
  size: "xs",
719
730
  icon: /* @__PURE__ */ V(e.x, { size: 12 }),
720
- onClick: U,
731
+ onClick: ce,
721
732
  children: "Cancel"
722
- }), /* @__PURE__ */ V(f, {
733
+ }), /* @__PURE__ */ V(_, {
723
734
  kind: "primary",
724
735
  size: "xs",
725
- icon: C.isPending ? /* @__PURE__ */ V(d, { size: 12 }) : /* @__PURE__ */ V(e.save, { size: 12 }),
726
- onClick: ce,
727
- disabled: C.isPending,
728
- children: C.isPending ? "Saving…" : "Save"
729
- })] }) : /* @__PURE__ */ V(f, {
736
+ icon: D.isPending ? /* @__PURE__ */ V(p, { size: 12 }) : /* @__PURE__ */ V(e.save, { size: 12 }),
737
+ onClick: W,
738
+ disabled: D.isPending,
739
+ children: D.isPending ? "Saving…" : "Save"
740
+ })] }) : /* @__PURE__ */ V(_, {
730
741
  size: "xs",
731
742
  icon: /* @__PURE__ */ V(e.edit, { size: 12 }),
732
- onClick: se,
743
+ onClick: U,
733
744
  children: "Edit"
734
745
  }))]
735
746
  })]
@@ -742,9 +753,9 @@ function J({ entityCode: t, recordId: n, items: i, schema: o, entity: s, onBackT
742
753
  flexDirection: "column",
743
754
  gap: 12
744
755
  },
745
- children: i && i.length > 0 ? /* @__PURE__ */ V(F, {
746
- nodes: i,
747
- ctx: ue
756
+ children: a && a.length > 0 ? /* @__PURE__ */ V(F, {
757
+ nodes: a,
758
+ ctx: de
748
759
  }) : /* @__PURE__ */ H("p", {
749
760
  style: {
750
761
  fontSize: 12.5,