@declarion/react 0.31.1 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist-lib/{ActionRunner-BzaZQtiI.js → ActionRunner-CaSrGpBi.js} +264 -260
  2. package/dist-lib/{DraggableChildrenTable-DILqStHQ.js → DraggableChildrenTable-CAHg7paQ.js} +1 -1
  3. package/dist-lib/{Grid-BIsiUwPh.js → Grid-DDbBhqcl.js} +2 -2
  4. package/dist-lib/{LayoutRenderer-3RvIsC9M.js → LayoutRenderer-CelsqsZ6.js} +433 -433
  5. package/dist-lib/{MarkdownRenderer-CaHhWrfm.js → MarkdownRenderer-DThy2ixe.js} +1 -1
  6. package/dist-lib/RefreshControl-CorluL6r.js +582 -0
  7. package/dist-lib/{SmartDetailPage.impl--EO-9fos.js → SmartDetailPage.impl-USIxbl-8.js} +449 -411
  8. package/dist-lib/{SmartRecordListPage.impl-B1iws8yf.js → SmartRecordListPage.impl-BKIpTNK7.js} +210 -210
  9. package/dist-lib/api/data.d.ts +4 -4
  10. package/dist-lib/api/params.d.ts +1 -1
  11. package/dist-lib/components/layout/Rail.d.ts +5 -5
  12. package/dist-lib/components/layout/TopBar.d.ts +3 -1
  13. package/dist-lib/components/pages/auth/AuthShell.d.ts +1 -1
  14. package/dist-lib/components/pages/list/ListHeader.d.ts +1 -1
  15. package/dist-lib/components/primitives/BrandLogo.d.ts +1 -1
  16. package/dist-lib/components/shared/ActionRunner.d.ts +1 -0
  17. package/dist-lib/components/shared/ObjectActionBar.d.ts +29 -0
  18. package/dist-lib/components/shared/PageHeader.d.ts +1 -1
  19. package/dist-lib/components/shared/RecordHeader.d.ts +2 -1
  20. package/dist-lib/components/shared/RefreshControl.d.ts +6 -0
  21. package/dist-lib/hooks/useBranding.d.ts +8 -0
  22. package/dist-lib/hooks/useBrandingChrome.d.ts +6 -0
  23. package/dist-lib/hooks/useLiveObject.d.ts +9 -0
  24. package/dist-lib/hooks/useMutations.d.ts +3 -3
  25. package/dist-lib/hooks/useObject.d.ts +10 -0
  26. package/dist-lib/hooks/usePageStateRuntime.d.ts +1 -1
  27. package/dist-lib/hooks/useParams.d.ts +10 -1
  28. package/dist-lib/index.d.ts +11 -5
  29. package/dist-lib/index.js +1890 -1722
  30. package/dist-lib/lib/actions.d.ts +6 -2
  31. package/dist-lib/lib/branding.d.ts +10 -1
  32. package/dist-lib/{registry-2KliNTHB.js → registry-KQyyL5Gt.js} +1452 -1401
  33. package/dist-lib/testing.d.ts +5 -3
  34. package/dist-lib/testing.js +35 -31
  35. package/dist-lib/types/api.d.ts +70 -3
  36. package/dist-lib/types/schema.d.ts +1 -15
  37. package/dist-lib/{useProperties-Co3RdtuT.js → useProperties-D74hyWIa.js} +53 -53
  38. package/dist-lib/{value-BooGwUik.js → value-BfXXl5EE.js} +1 -1
  39. package/package.json +1 -1
  40. package/dist-lib/hooks/useEntityItem.d.ts +0 -10
  41. package/dist-lib/peekDraftStore-yyzMbaiI.js +0 -468
@@ -1,105 +1,105 @@
1
1
  import { s as e } from "./DynamicIcon-DCRdxxZ7.js";
2
- import { $ as t, Dn as n, Fn as r, Hn as i, M as a, Vn as o, g as s, gn as c, hn as l, in as u, k as d, kn as f, on as p, p as m, pt as ee, rn as h, tn as g, v as _, wn as te } from "./ActionRunner-BzaZQtiI.js";
3
- import { $ as v, H as y, J as b, X as x, Y as S, Z as C, _ as w, a as T, c as E, q as D, s as O, w as ne } from "./registry-2KliNTHB.js";
4
- import { b as k, d as A, f as j, g as M, m as re, n as N, p as ie, r as P, s as F } from "./useProperties-Co3RdtuT.js";
5
- import { t as I } from "./LayoutRenderer-3RvIsC9M.js";
6
- import { useCallback as L, useEffect as R, useMemo as z, useRef as B, useState as ae } from "react";
7
- import { useSearchParams as oe } from "react-router-dom";
8
- import { Fragment as se, jsx as V, jsxs as H } from "react/jsx-runtime";
2
+ import { Dn as t, Fn as n, Hn as r, M as i, R as a, Vn as o, g as s, gn as c, hn as l, in as u, k as d, kn as f, on as p, p as m, pt as ee, rn as h, tn as g, v as _, wn as te } from "./ActionRunner-CaSrGpBi.js";
3
+ import { $ as v, G as ne, Q as re, X as y, Z as b, _ as ie, a as x, c as S, et as C, nt as w, s as T, w as ae } from "./registry-KQyyL5Gt.js";
4
+ import { b as E, d as D, f as O, g as k, m as oe, n as A, p as se, r as j, s as M } from "./useProperties-D74hyWIa.js";
5
+ import { t as N } from "./LayoutRenderer-CelsqsZ6.js";
6
+ import { useCallback as P, useEffect as F, useMemo as I, useRef as L, useState as ce } from "react";
7
+ import { useSearchParams as le } from "react-router-dom";
8
+ import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
9
9
  //#region src/components/pages/SmartRecordListPage.impl.tsx
10
- function U({ screenCode: t }) {
11
- let [i, s] = oe(), { data: l } = ee(), u = r(), f = l?.screens[t], m = f?.entity ? l?.entities[f.entity] : void 0, g = f?.entity;
12
- re(f, m, i.toString()), M(f?.route);
13
- let _ = w(), v = i.get("selected") ?? null, y = i.get("search") ?? "", b = d(y, 300), x = i.get("sort") ?? f?.sort_default ?? "", S = z(() => {
14
- let e = A(i);
10
+ function V({ screenCode: r }) {
11
+ let [a, s] = le(), { data: l } = ee(), u = n(), f = l?.screens[r], m = f?.entity ? l?.entities[f.entity] : void 0, g = f?.entity;
12
+ oe(f, m, a.toString()), k(f?.route);
13
+ let _ = ie(), v = a.get("selected") ?? null, ne = a.get("search") ?? "", re = d(ne, 300), y = a.get("sort") ?? f?.sort_default ?? "", b = I(() => {
14
+ let e = D(a);
15
15
  return e.length > 0 ? e : void 0;
16
- }, [i]), C = z(() => f?.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) ?? [], [f?.columns, m]), T = z(() => {
16
+ }, [a]), x = I(() => f?.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) ?? [], [f?.columns, m]), C = I(() => {
17
17
  let e = f?.responsive?.[u.category]?.presentation;
18
18
  return u.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
19
- }, [f?.responsive, u.category]), D = z(() => {
19
+ }, [f?.responsive, u.category]), w = I(() => {
20
20
  let e = f?.responsive?.[u.category];
21
21
  return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation : u.category === "phone" ? "cards" : "table";
22
- }, [f?.responsive, u.category]), ne = f?.responsive?.[u.category]?.layout?.related_records, N = z(() => O({
22
+ }, [f?.responsive, u.category]), ae = f?.responsive?.[u.category]?.layout?.related_records, A = I(() => T({
23
23
  entity: m,
24
24
  screen: f
25
- }), [m, f]), P = z(() => E({
25
+ }), [m, f]), j = I(() => S({
26
26
  entity: m,
27
27
  screen: f,
28
- presentation: D,
29
- visibleColumns: C,
30
- card: N,
31
- sort: x
28
+ presentation: w,
29
+ visibleColumns: x,
30
+ card: A,
31
+ sort: y
32
32
  }), [
33
33
  m,
34
34
  f,
35
- D,
36
- C,
37
- N,
38
- x
39
- ]), I = m?.list_pagination === "cursor", { data: U, isLoading: W } = a(g, {
35
+ w,
36
+ x,
37
+ A,
38
+ y
39
+ ]), N = m?.list_pagination === "cursor", { data: V, isLoading: H } = i(g, {
40
40
  page: 1,
41
41
  per_page: 200,
42
- sort: x || void 0,
43
- search: b || void 0,
44
- filters: S,
45
- select: P.selectFields,
46
- expand: P.expandFields,
42
+ sort: y || void 0,
43
+ search: re || void 0,
44
+ filters: b,
45
+ select: j.selectFields,
46
+ expand: j.expandFields,
47
47
  preview: !0,
48
- screen: f?.fixed_filters ? t : void 0
49
- }, !I), G = k(g, {
50
- sort: x || void 0,
51
- search: b || void 0,
52
- filters: S,
53
- select: P.selectFields,
54
- expand: P.expandFields,
48
+ screen: f?.fixed_filters ? r : void 0
49
+ }, !N), U = E(g, {
50
+ sort: y || void 0,
51
+ search: re || void 0,
52
+ filters: b,
53
+ select: j.selectFields,
54
+ expand: j.expandFields,
55
55
  preview: !0,
56
- screen: f?.fixed_filters ? t : void 0,
56
+ screen: f?.fixed_filters ? r : void 0,
57
57
  limit: 200
58
- }, I), K = I ? G.rows : U?.data ?? [], J = I ? G.refs : U?.$refs, le = I ? G.isLoading : W, ue = z(() => m?.fields.names().find((e) => m.fields.get(e)?.primary) ?? "id", [m]), de = L((e, t) => {
58
+ }, N), W = N ? U.rows : V?.data ?? [], K = N ? U.refs : V?.$refs, q = N ? U.isLoading : H, de = I(() => m?.fields.names().find((e) => m.fields.get(e)?.primary) ?? "id", [m]), fe = P((e, t) => {
59
59
  s((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
- }, [s]), fe = L((e) => {
63
+ }, [s]), pe = P((e) => {
64
64
  s((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
- }, [s]), pe = L((e, t) => {
68
+ }, [s]), me = P((e, t) => {
69
69
  s((n) => {
70
- let r = new URLSearchParams(n), i = A(n), a;
71
- return a = t && t !== "__all__" ? [...j(i, e), F(e, t)] : j(i, e), ie(a, r), r;
70
+ let r = new URLSearchParams(n), i = D(n), a;
71
+ return a = t && t !== "__all__" ? [...O(i, e), M(e, t)] : O(i, e), se(a, r), r;
72
72
  }, { replace: !0 });
73
- }, [s]), Y = (f?.list_resizable ?? !1) && T === "split" && u.category !== "phone" && !u.touch, me = B(null), [X, Z] = ae(null), Q = B(!1), $ = f?.list_width;
74
- R(() => {
75
- !Y || !$?.endsWith("%") || Z(null);
73
+ }, [s]), J = (f?.list_resizable ?? !1) && C === "split" && u.category !== "phone" && !u.touch, Y = L(null), [X, Z] = ce(null), Q = L(!1), $ = f?.list_width;
74
+ F(() => {
75
+ !J || !$?.endsWith("%") || Z(null);
76
76
  }, [
77
- Y,
77
+ J,
78
78
  $,
79
79
  u.width,
80
80
  u.height
81
- ]), R(() => {
82
- if (!Y || X !== null) return;
83
- let e = me.current;
81
+ ]), F(() => {
82
+ if (!J || X !== null) return;
83
+ let e = Y.current;
84
84
  if (e) if ($ && $.endsWith("%")) {
85
85
  let t = parseFloat($) / 100;
86
86
  Z(Math.round(e.getBoundingClientRect().width * t));
87
87
  } else Z($ && parseInt($, 10) || 320);
88
88
  }, [
89
- Y,
89
+ J,
90
90
  $,
91
91
  X,
92
92
  m
93
93
  ]);
94
- let he = B(null);
95
- R(() => () => {
94
+ let he = L(null);
95
+ F(() => () => {
96
96
  he.current?.();
97
97
  }, []);
98
- let ge = L((e) => {
98
+ let ge = P((e) => {
99
99
  e.preventDefault(), Q.current = !0;
100
100
  let t = e.clientX, n = X ?? 320, r = (e) => {
101
101
  if (!Q.current) return;
102
- let r = (me.current?.getBoundingClientRect().width ?? window.innerWidth) - 300;
102
+ let r = (Y.current?.getBoundingClientRect().width ?? window.innerWidth) - 300;
103
103
  Z(Math.max(200, Math.min(r, n + e.clientX - t)));
104
104
  }, i = () => {
105
105
  Q.current = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i), document.body.style.cursor = "", document.body.style.userSelect = "", he.current = null;
@@ -107,32 +107,32 @@ function U({ screenCode: t }) {
107
107
  document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), he.current = i;
108
108
  }, [X]);
109
109
  if (!l || !f || !m) return null;
110
- let _e = S?.length ?? 0, ve = T === "split" || T === "stacked" || !v, ye = T === "split" || T === "stacked" || !!v, be = T !== "split" && v ? () => de(null, { replace: !0 }) : void 0, xe = T === "split" ? Y && X !== null ? X : f.list_width ?? "320px" : "100%";
111
- return /* @__PURE__ */ H("div", {
112
- ref: me,
113
- "data-record-list-presentation": T,
110
+ let _e = b?.length ?? 0, ve = C === "split" || C === "stacked" || !v, ye = C === "split" || C === "stacked" || !!v, be = C !== "split" && v ? () => fe(null, { replace: !0 }) : void 0, xe = C === "split" ? J && X !== null ? X : f.list_width ?? "320px" : "100%";
111
+ return /* @__PURE__ */ B("div", {
112
+ ref: Y,
113
+ "data-record-list-presentation": C,
114
114
  style: {
115
115
  display: "flex",
116
- flexDirection: T === "stacked" ? "column" : "row",
116
+ flexDirection: C === "stacked" ? "column" : "row",
117
117
  height: "100%",
118
118
  minWidth: 0,
119
119
  overflow: "hidden"
120
120
  },
121
121
  children: [
122
- ve && /* @__PURE__ */ H("div", {
122
+ ve && /* @__PURE__ */ B("div", {
123
123
  "data-testid": "record-list-panel",
124
124
  style: {
125
- flex: T === "split" ? "none" : "1 1 auto",
125
+ flex: C === "split" ? "none" : "1 1 auto",
126
126
  display: "flex",
127
127
  flexDirection: "column",
128
128
  overflow: "hidden",
129
- borderRight: T === "split" && !Y ? "1px solid var(--divider)" : "none",
130
- borderBottom: T === "stacked" ? "1px solid var(--divider)" : "none",
129
+ borderRight: C === "split" && !J ? "1px solid var(--divider)" : "none",
130
+ borderBottom: C === "stacked" ? "1px solid var(--divider)" : "none",
131
131
  width: xe,
132
132
  minWidth: 0,
133
- height: T === "stacked" ? "50%" : "100%"
133
+ height: C === "stacked" ? "50%" : "100%"
134
134
  },
135
- children: [/* @__PURE__ */ H("div", {
135
+ children: [/* @__PURE__ */ B("div", {
136
136
  style: {
137
137
  padding: 12,
138
138
  display: "flex",
@@ -141,17 +141,17 @@ function U({ screenCode: t }) {
141
141
  borderBottom: "1px solid var(--divider)"
142
142
  },
143
143
  children: [
144
- _.hasOriginBack && /* @__PURE__ */ H("div", {
144
+ _.hasOriginBack && /* @__PURE__ */ B("div", {
145
145
  style: {
146
146
  display: "flex",
147
147
  alignItems: "center",
148
148
  gap: 8
149
149
  },
150
- children: [/* @__PURE__ */ V(o, {
151
- icon: /* @__PURE__ */ V(e.back, { size: 14 }),
150
+ children: [/* @__PURE__ */ z(o, {
151
+ icon: /* @__PURE__ */ z(e.back, { size: 14 }),
152
152
  title: "Back",
153
153
  onClick: _.goBack
154
- }), /* @__PURE__ */ V("span", {
154
+ }), /* @__PURE__ */ z("span", {
155
155
  style: {
156
156
  fontSize: 12.5,
157
157
  fontWeight: 600,
@@ -160,13 +160,13 @@ function U({ screenCode: t }) {
160
160
  children: p(f.display?.name) || p(m.display.name_plural)
161
161
  })]
162
162
  }),
163
- /* @__PURE__ */ V(n, {
164
- value: y,
165
- onChange: fe,
163
+ /* @__PURE__ */ z(t, {
164
+ value: ne,
165
+ onChange: pe,
166
166
  placeholder: `Search ${p(m.display.name_plural)}…`,
167
- prefix: /* @__PURE__ */ V(e.search, { size: 13 })
167
+ prefix: /* @__PURE__ */ z(e.search, { size: 13 })
168
168
  }),
169
- f.filters && f.filters.length > 0 && /* @__PURE__ */ V("div", {
169
+ f.filters && f.filters.length > 0 && /* @__PURE__ */ z("div", {
170
170
  style: {
171
171
  display: "flex",
172
172
  flexWrap: "wrap",
@@ -175,10 +175,10 @@ function U({ screenCode: t }) {
175
175
  children: f.filters.map((e) => {
176
176
  let t = m.fields.get(e);
177
177
  if (!t?.values) return null;
178
- let n = S?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r = h(t, e, l.entities);
179
- return /* @__PURE__ */ V("div", {
178
+ let n = b?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r = h(t, e, l.entities);
179
+ return /* @__PURE__ */ z("div", {
180
180
  style: { minWidth: 120 },
181
- children: /* @__PURE__ */ V(te, {
181
+ children: /* @__PURE__ */ z(te, {
182
182
  value: n,
183
183
  options: [{
184
184
  value: "__all__",
@@ -187,13 +187,13 @@ function U({ screenCode: t }) {
187
187
  value: e.code,
188
188
  label: p(e.name) || e.code
189
189
  }))],
190
- onChange: (t) => pe(e, t),
190
+ onChange: (t) => me(e, t),
191
191
  placeholder: r
192
192
  })
193
193
  }, e);
194
194
  })
195
195
  }),
196
- /* @__PURE__ */ H("div", {
196
+ /* @__PURE__ */ B("div", {
197
197
  style: {
198
198
  display: "flex",
199
199
  alignItems: "center",
@@ -201,7 +201,7 @@ function U({ screenCode: t }) {
201
201
  fontSize: 11,
202
202
  color: "var(--text-3)"
203
203
  },
204
- children: [/* @__PURE__ */ V("span", { children: le ? "Loading…" : `${K.length} ${p(m.display.name_plural)}` }), _e > 0 && /* @__PURE__ */ V("button", {
204
+ children: [/* @__PURE__ */ z("span", { children: q ? "Loading…" : `${W.length} ${p(m.display.name_plural)}` }), _e > 0 && /* @__PURE__ */ z("button", {
205
205
  onClick: () => s((e) => {
206
206
  let t = new URLSearchParams(e);
207
207
  return t.delete("filters"), t;
@@ -219,28 +219,28 @@ function U({ screenCode: t }) {
219
219
  })]
220
220
  })
221
221
  ]
222
- }), /* @__PURE__ */ V("div", {
222
+ }), /* @__PURE__ */ z("div", {
223
223
  style: {
224
224
  flex: 1,
225
225
  overflowY: "auto",
226
- padding: D === "cards" ? 10 : 0,
227
- display: D === "cards" ? "flex" : "block",
226
+ padding: w === "cards" ? 10 : 0,
227
+ display: w === "cards" ? "flex" : "block",
228
228
  flexDirection: "column",
229
- gap: D === "cards" ? 10 : void 0
229
+ gap: w === "cards" ? 10 : void 0
230
230
  },
231
- children: le ? /* @__PURE__ */ V("div", {
231
+ children: q ? /* @__PURE__ */ z("div", {
232
232
  style: {
233
233
  padding: 12,
234
234
  display: "flex",
235
235
  flexDirection: "column",
236
236
  gap: 6
237
237
  },
238
- children: Array.from({ length: 8 }).map((e, t) => /* @__PURE__ */ V("div", { style: {
238
+ children: Array.from({ length: 8 }).map((e, t) => /* @__PURE__ */ z("div", { style: {
239
239
  height: 48,
240
240
  borderRadius: 6,
241
241
  background: "var(--surface-3)"
242
242
  } }, t))
243
- }) : K.length === 0 ? /* @__PURE__ */ V("div", {
243
+ }) : W.length === 0 ? /* @__PURE__ */ z("div", {
244
244
  style: {
245
245
  padding: 28,
246
246
  textAlign: "center",
@@ -248,23 +248,23 @@ function U({ screenCode: t }) {
248
248
  color: "var(--text-3)"
249
249
  },
250
250
  children: "No records found"
251
- }) : /* @__PURE__ */ H(se, { children: [K.map((e) => {
252
- let t = c(e[ue]);
253
- return /* @__PURE__ */ V(ce, {
251
+ }) : /* @__PURE__ */ B(R, { children: [W.map((e) => {
252
+ let t = c(e[de]);
253
+ return /* @__PURE__ */ z(ue, {
254
254
  record: e,
255
255
  entity: m,
256
- columns: C,
257
- card: N,
258
- presentation: D,
259
- refs: J,
256
+ columns: x,
257
+ card: A,
258
+ presentation: w,
259
+ refs: K,
260
260
  isSelected: t === v,
261
- onClick: () => de(t, { replace: T === "split" })
261
+ onClick: () => fe(t, { replace: C === "split" })
262
262
  }, t);
263
- }), I && G.hasMore && /* @__PURE__ */ V("button", {
263
+ }), N && U.hasMore && /* @__PURE__ */ z("button", {
264
264
  type: "button",
265
265
  "data-testid": "record-list-load-more",
266
- onClick: () => void G.fetchNextPage(),
267
- disabled: G.isFetchingNextPage,
266
+ onClick: () => void U.fetchNextPage(),
267
+ disabled: U.isFetchingNextPage,
268
268
  style: {
269
269
  width: "100%",
270
270
  padding: "8px 12px",
@@ -273,13 +273,13 @@ function U({ screenCode: t }) {
273
273
  border: "none",
274
274
  borderTop: "1px solid var(--divider)",
275
275
  color: "var(--text-2)",
276
- cursor: G.isFetchingNextPage ? "default" : "pointer"
276
+ cursor: U.isFetchingNextPage ? "default" : "pointer"
277
277
  },
278
- children: G.isFetchingNextPage ? "Loading…" : "Load more"
278
+ children: U.isFetchingNextPage ? "Loading…" : "Load more"
279
279
  })] })
280
280
  })]
281
281
  }),
282
- Y && /* @__PURE__ */ V("div", {
282
+ J && /* @__PURE__ */ z("div", {
283
283
  "data-testid": "record-list-resize-handle",
284
284
  onMouseDown: ge,
285
285
  style: {
@@ -292,23 +292,23 @@ function U({ screenCode: t }) {
292
292
  onMouseEnter: (e) => e.currentTarget.style.background = "var(--border-strong)",
293
293
  onMouseLeave: (e) => e.currentTarget.style.background = "var(--divider)"
294
294
  }),
295
- ye && /* @__PURE__ */ V("div", {
295
+ ye && /* @__PURE__ */ z("div", {
296
296
  "data-testid": "record-detail-panel",
297
297
  style: {
298
298
  flex: 1,
299
299
  minWidth: 0,
300
300
  overflow: "hidden",
301
- height: T === "stacked" ? "50%" : "100%"
301
+ height: C === "stacked" ? "50%" : "100%"
302
302
  },
303
- children: v ? /* @__PURE__ */ V(q, {
303
+ children: v ? /* @__PURE__ */ z(G, {
304
304
  entityCode: g,
305
305
  recordId: v,
306
306
  items: f.items,
307
307
  schema: l,
308
308
  entity: m,
309
309
  onBackToList: be,
310
- relatedRecordsPresentation: ne
311
- }, v) : /* @__PURE__ */ V("div", {
310
+ relatedRecordsPresentation: ae
311
+ }, v) : /* @__PURE__ */ z("div", {
312
312
  style: {
313
313
  display: "flex",
314
314
  alignItems: "center",
@@ -316,7 +316,7 @@ function U({ screenCode: t }) {
316
316
  height: "100%",
317
317
  color: "var(--text-3)"
318
318
  },
319
- children: /* @__PURE__ */ H("p", {
319
+ children: /* @__PURE__ */ B("p", {
320
320
  style: { fontSize: 12.5 },
321
321
  children: [
322
322
  "Select a ",
@@ -329,11 +329,11 @@ function U({ screenCode: t }) {
329
329
  ]
330
330
  });
331
331
  }
332
- function ce({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a, isSelected: o, onClick: s }) {
332
+ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a, isSelected: o, onClick: s }) {
333
333
  let c = m();
334
334
  if (i === "cards") {
335
- 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));
336
- return /* @__PURE__ */ H("button", {
335
+ let n = r.badgeFields.filter((n) => H(t, e, n)), i = r.bodyFields.filter((n) => H(t, e, n)), l = r.metaFields.filter((n) => H(t, e, n));
336
+ return /* @__PURE__ */ B("button", {
337
337
  type: "button",
338
338
  "data-testid": "record-list-card",
339
339
  "aria-current": o ? "true" : void 0,
@@ -353,13 +353,13 @@ function ce({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
353
353
  boxShadow: o ? "inset 3px 0 0 var(--accent)" : "none"
354
354
  },
355
355
  children: [
356
- /* @__PURE__ */ V(G, {
356
+ /* @__PURE__ */ z(U, {
357
357
  entity: t,
358
358
  record: e,
359
359
  field: r.titleField,
360
360
  refs: a
361
361
  }),
362
- r.subtitleField && /* @__PURE__ */ V("div", {
362
+ r.subtitleField && /* @__PURE__ */ z("div", {
363
363
  style: {
364
364
  fontSize: 12,
365
365
  color: "var(--text-3)",
@@ -374,13 +374,13 @@ function ce({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
374
374
  locale: c
375
375
  })
376
376
  }),
377
- n.length > 0 && /* @__PURE__ */ V("div", {
377
+ n.length > 0 && /* @__PURE__ */ z("div", {
378
378
  style: {
379
379
  display: "flex",
380
380
  flexWrap: "wrap",
381
381
  gap: 6
382
382
  },
383
- children: n.map((n) => /* @__PURE__ */ V("span", {
383
+ children: n.map((n) => /* @__PURE__ */ z("span", {
384
384
  style: {
385
385
  border: "1px solid var(--border)",
386
386
  borderRadius: 999,
@@ -400,14 +400,14 @@ function ce({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
400
400
  })
401
401
  }, n))
402
402
  }),
403
- i.length > 0 && /* @__PURE__ */ V("dl", {
403
+ i.length > 0 && /* @__PURE__ */ z("dl", {
404
404
  style: {
405
405
  display: "grid",
406
406
  gridTemplateColumns: "minmax(72px, max-content) minmax(0, 1fr)",
407
407
  gap: "5px 10px",
408
408
  margin: 0
409
409
  },
410
- children: i.map((n) => /* @__PURE__ */ V(K, {
410
+ children: i.map((n) => /* @__PURE__ */ z(W, {
411
411
  entity: t,
412
412
  record: e,
413
413
  fieldName: n,
@@ -415,7 +415,7 @@ function ce({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
415
415
  locale: c
416
416
  }, n))
417
417
  }),
418
- l.length > 0 && /* @__PURE__ */ V("div", {
418
+ l.length > 0 && /* @__PURE__ */ z("div", {
419
419
  style: {
420
420
  display: "flex",
421
421
  flexWrap: "wrap",
@@ -423,7 +423,7 @@ function ce({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
423
423
  fontSize: 11,
424
424
  color: "var(--text-3)"
425
425
  },
426
- children: l.map((n) => /* @__PURE__ */ V("span", {
426
+ children: l.map((n) => /* @__PURE__ */ z("span", {
427
427
  style: {
428
428
  minWidth: 0,
429
429
  overflowWrap: "anywhere"
@@ -442,7 +442,7 @@ function ce({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
442
442
  });
443
443
  }
444
444
  let l = n[0], u = n[1], d = n.slice(2, 4);
445
- return /* @__PURE__ */ H("button", {
445
+ return /* @__PURE__ */ B("button", {
446
446
  onClick: s,
447
447
  style: {
448
448
  width: "100%",
@@ -465,7 +465,7 @@ function ce({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
465
465
  onMouseLeave: (e) => {
466
466
  o || (e.currentTarget.style.background = "transparent");
467
467
  },
468
- children: [l && /* @__PURE__ */ V("div", {
468
+ children: [l && /* @__PURE__ */ z("div", {
469
469
  style: {
470
470
  fontSize: 12.5,
471
471
  fontWeight: 500,
@@ -482,13 +482,13 @@ function ce({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
482
482
  refs: a,
483
483
  locale: c
484
484
  })
485
- }), /* @__PURE__ */ H("div", {
485
+ }), /* @__PURE__ */ B("div", {
486
486
  style: {
487
487
  display: "flex",
488
488
  alignItems: "center",
489
489
  gap: 6
490
490
  },
491
- children: [u && /* @__PURE__ */ V("div", {
491
+ children: [u && /* @__PURE__ */ z("div", {
492
492
  style: {
493
493
  fontSize: 11,
494
494
  color: "var(--text-3)",
@@ -505,14 +505,14 @@ function ce({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
505
505
  refs: a,
506
506
  locale: c
507
507
  })
508
- }), /* @__PURE__ */ V("div", {
508
+ }), /* @__PURE__ */ z("div", {
509
509
  style: {
510
510
  display: "flex",
511
511
  alignItems: "center",
512
512
  gap: 4,
513
513
  flexShrink: 0
514
514
  },
515
- children: d.map((n) => x(t, e, n) == null ? null : /* @__PURE__ */ V("div", {
515
+ children: d.map((n) => v(t, e, n) == null ? null : /* @__PURE__ */ z("div", {
516
516
  style: { fontSize: 11 },
517
517
  children: C({
518
518
  entity: t,
@@ -527,13 +527,13 @@ function ce({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
527
527
  })]
528
528
  });
529
529
  }
530
- function W(e, t, n) {
531
- let r = x(e, t, n);
530
+ function H(e, t, n) {
531
+ let r = v(e, t, n);
532
532
  return !(r == null || r === "" || Array.isArray(r) && r.length === 0);
533
533
  }
534
- function G({ entity: e, record: t, field: n, refs: r }) {
534
+ function U({ entity: e, record: t, field: n, refs: r }) {
535
535
  let i = m(), a = u(t, e);
536
- return /* @__PURE__ */ V("div", {
536
+ return /* @__PURE__ */ z("div", {
537
537
  style: {
538
538
  fontSize: 13.5,
539
539
  fontWeight: 600,
@@ -550,11 +550,11 @@ function G({ entity: e, record: t, field: n, refs: r }) {
550
550
  }) : a) || p(e.display.name)
551
551
  });
552
552
  }
553
- function K({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
554
- let a = x(e, t, n);
553
+ function W({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
554
+ let a = v(e, t, n);
555
555
  if (a == null || a === "") return null;
556
556
  let o = e.fields.get(n);
557
- return o ? /* @__PURE__ */ H(se, { children: [/* @__PURE__ */ V("dt", {
557
+ return o ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("dt", {
558
558
  style: {
559
559
  color: "var(--text-3)",
560
560
  fontSize: 11.5,
@@ -562,7 +562,7 @@ function K({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
562
562
  overflowWrap: "anywhere"
563
563
  },
564
564
  children: h(o, n)
565
- }), /* @__PURE__ */ V("dd", {
565
+ }), /* @__PURE__ */ z("dd", {
566
566
  style: {
567
567
  margin: 0,
568
568
  color: "var(--text)",
@@ -580,8 +580,8 @@ function K({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
580
580
  })
581
581
  })] }) : null;
582
582
  }
583
- function q({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList: a, relatedRecordsPresentation: o }) {
584
- return /* @__PURE__ */ V(s, { children: /* @__PURE__ */ V(J, {
583
+ function G({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList: a, relatedRecordsPresentation: o }) {
584
+ return /* @__PURE__ */ z(s, { children: /* @__PURE__ */ z(K, {
585
585
  entityCode: e,
586
586
  recordId: t,
587
587
  items: n,
@@ -591,97 +591,97 @@ function q({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackT
591
591
  relatedRecordsPresentation: o
592
592
  }) });
593
593
  }
594
- function J({ entityCode: n, recordId: r, items: a, schema: s, entity: d, onBackToList: m, relatedRecordsPresentation: ee }) {
595
- let h = g(d, "update"), { data: te, isLoading: C } = T(n, z(() => r ? l(d, r) : void 0, [r, d])), w = y(n), E = _(), [O, k] = ae(!1), [A, j] = ae({}), M = te?.data, re = M?.$statuses, ie = M?.$properties, F = P(n, r), R = N(n, r), B = z(() => {
594
+ function K({ entityCode: t, recordId: n, items: i, schema: s, entity: d, onBackToList: m, relatedRecordsPresentation: ee }) {
595
+ let h = g(d, "update"), { data: te, isLoading: ie } = x(t, I(() => n ? l(d, n) : void 0, [n, d])), S = ne(t), C = _(), [T, E] = ce(!1), [D, O] = ce({}), k = te?.data, oe = k?.$statuses, se = k?.$properties, M = j(t, n), F = A(t, n), L = I(() => {
596
596
  let e = /* @__PURE__ */ new Set();
597
597
  for (let [t, n] of d.fields) !n.auto && !n.primary && e.add(t);
598
598
  for (let [t] of d.files ?? []) e.add(t);
599
599
  return e;
600
- }, [d]), oe = L(() => {
601
- if (M) {
600
+ }, [d]), le = P(() => {
601
+ if (k) {
602
602
  let e = {};
603
- B.forEach((t) => {
604
- let n = x(d, M, t);
605
- e[t] = S(d, t) ? n ?? null : n ?? "";
606
- }), j(e);
603
+ L.forEach((t) => {
604
+ let n = v(d, k, t);
605
+ e[t] = re(d, t) ? n ?? null : n ?? "";
606
+ }), O(e);
607
607
  }
608
- k(!0);
608
+ E(!0);
609
609
  }, [
610
- M,
611
- B,
610
+ k,
611
+ L,
612
612
  d
613
- ]), U = L(async () => {
614
- await E.flushAllDrafts(), k(!1), j({});
615
- }, [E]), ce = L(() => {
616
- let e = {}, n = D({
613
+ ]), V = P(async () => {
614
+ await C.flushAllDrafts(), E(!1), O({});
615
+ }, [C]), ue = P(() => {
616
+ let e = {}, t = y({
617
617
  entity: d,
618
- formData: A,
619
- record: M,
618
+ formData: D,
619
+ record: k,
620
620
  isNew: !1
621
- }), i = b(n);
622
- for (let [t, n] of Object.entries(A)) d.files?.has(t) || (e[t] = v(d, t, n));
623
- if (Object.keys(n).length > 0 && (e.$files = n), Object.keys(e).length === 0) {
624
- k(!1), j({});
621
+ }), r = b(t);
622
+ for (let [t, n] of Object.entries(D)) d.files?.has(t) || (e[t] = w(d, t, n));
623
+ if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0) {
624
+ E(!1), O({});
625
625
  return;
626
626
  }
627
- w.mutate({
628
- pkValues: r,
627
+ S.mutate({
628
+ pkValues: n,
629
629
  data: e
630
630
  }, {
631
631
  onSuccess: () => {
632
- i.forEach((e) => E.markCommitted(e)), k(!1), j({}), t.success("Saved");
632
+ r.forEach((e) => C.markCommitted(e)), E(!1), O({}), a.success("Saved");
633
633
  },
634
- onError: () => t.error("Failed to save")
634
+ onError: () => a.error("Failed to save")
635
635
  });
636
636
  }, [
637
- E,
638
- w,
639
- r,
637
+ C,
638
+ S,
639
+ n,
640
640
  d,
641
- A,
642
- M
643
- ]), W = L((e, t) => {
644
- j((n) => ({
641
+ D,
642
+ k
643
+ ]), H = P((e, t) => {
644
+ O((n) => ({
645
645
  ...n,
646
646
  [e]: t
647
647
  }));
648
648
  }, []);
649
- if (C) return /* @__PURE__ */ V(ne, {});
650
- if (!M) return null;
651
- let G = u(M, d), K = d.display?.display_field, q = G ? void 0 : K ? M[K] : M[d.fields.names()[0]], J = G || (q != null && typeof q != "object" ? c(q) : p(d.display.name)), le = M?.$refs, ue = {
649
+ if (ie) return /* @__PURE__ */ z(ae, {});
650
+ if (!k) return null;
651
+ let U = u(k, d), W = d.display?.display_field, G = U ? void 0 : W ? k[W] : k[d.fields.names()[0]], K = U || (G != null && typeof G != "object" ? c(G) : p(d.display.name)), q = k?.$refs, de = {
652
652
  schema: s,
653
653
  entity: d,
654
- entityCode: n,
655
- recordId: r,
656
- record: O ? {
657
- ...M,
658
- ...A
659
- } : M,
654
+ entityCode: t,
655
+ recordId: n,
656
+ record: T ? {
657
+ ...k,
658
+ ...D
659
+ } : k,
660
660
  isNew: !1,
661
- mode: O ? "edit" : "display",
662
- onFieldChange: O ? W : void 0,
663
- refs: le,
664
- objectProperties: ie ?? void 0,
665
- onSetProperty: h ? (e, t) => R.mutate({
661
+ mode: T ? "edit" : "display",
662
+ onFieldChange: T ? H : void 0,
663
+ refs: q,
664
+ objectProperties: se ?? void 0,
665
+ onSetProperty: h ? (e, t) => F.mutate({
666
666
  propertyCode: e,
667
667
  value: t
668
668
  }) : void 0,
669
- isPropertyPending: R.isPending,
670
- objectStatuses: re ?? void 0,
671
- onSetStatus: h ? (e, t) => F.mutate({
669
+ isPropertyPending: F.isPending,
670
+ objectStatuses: oe ?? void 0,
671
+ onSetStatus: h ? (e, t) => M.mutate({
672
672
  groupCode: e,
673
673
  statusCode: t
674
674
  }) : void 0,
675
- isStatusPending: F.isPending,
675
+ isStatusPending: M.isPending,
676
676
  relatedRecordsPresentation: ee
677
677
  };
678
- return /* @__PURE__ */ H("div", {
678
+ return /* @__PURE__ */ B("div", {
679
679
  style: {
680
680
  display: "flex",
681
681
  flexDirection: "column",
682
682
  height: "100%"
683
683
  },
684
- children: [/* @__PURE__ */ H("div", {
684
+ children: [/* @__PURE__ */ B("div", {
685
685
  style: {
686
686
  display: "flex",
687
687
  alignItems: "center",
@@ -693,7 +693,7 @@ function J({ entityCode: n, recordId: r, items: a, schema: s, entity: d, onBackT
693
693
  background: "var(--surface)",
694
694
  zIndex: 10
695
695
  },
696
- children: [/* @__PURE__ */ V("h2", {
696
+ children: [/* @__PURE__ */ z("h2", {
697
697
  style: {
698
698
  margin: 0,
699
699
  fontSize: 13,
@@ -703,37 +703,37 @@ function J({ entityCode: n, recordId: r, items: a, schema: s, entity: d, onBackT
703
703
  whiteSpace: "nowrap",
704
704
  color: "var(--text)"
705
705
  },
706
- children: J
707
- }), /* @__PURE__ */ H("div", {
706
+ children: K
707
+ }), /* @__PURE__ */ B("div", {
708
708
  style: {
709
709
  display: "flex",
710
710
  alignItems: "center",
711
711
  gap: 6
712
712
  },
713
- children: [m && /* @__PURE__ */ V(o, {
714
- icon: /* @__PURE__ */ V(e.back, { size: 14 }),
713
+ children: [m && /* @__PURE__ */ z(o, {
714
+ icon: /* @__PURE__ */ z(e.back, { size: 14 }),
715
715
  title: "Back to list",
716
716
  onClick: m
717
- }), h && (O ? /* @__PURE__ */ H(se, { children: [/* @__PURE__ */ V(i, {
717
+ }), h && (T ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(r, {
718
718
  size: "xs",
719
- icon: /* @__PURE__ */ V(e.x, { size: 12 }),
720
- onClick: U,
719
+ icon: /* @__PURE__ */ z(e.x, { size: 12 }),
720
+ onClick: V,
721
721
  children: "Cancel"
722
- }), /* @__PURE__ */ V(i, {
722
+ }), /* @__PURE__ */ z(r, {
723
723
  kind: "primary",
724
724
  size: "xs",
725
- icon: w.isPending ? /* @__PURE__ */ V(f, { size: 12 }) : /* @__PURE__ */ V(e.save, { size: 12 }),
726
- onClick: ce,
727
- disabled: w.isPending,
728
- children: w.isPending ? "Saving…" : "Save"
729
- })] }) : /* @__PURE__ */ V(i, {
725
+ icon: S.isPending ? /* @__PURE__ */ z(f, { size: 12 }) : /* @__PURE__ */ z(e.save, { size: 12 }),
726
+ onClick: ue,
727
+ disabled: S.isPending,
728
+ children: S.isPending ? "Saving…" : "Save"
729
+ })] }) : /* @__PURE__ */ z(r, {
730
730
  size: "xs",
731
- icon: /* @__PURE__ */ V(e.edit, { size: 12 }),
732
- onClick: oe,
731
+ icon: /* @__PURE__ */ z(e.edit, { size: 12 }),
732
+ onClick: le,
733
733
  children: "Edit"
734
734
  }))]
735
735
  })]
736
- }), /* @__PURE__ */ V("div", {
736
+ }), /* @__PURE__ */ z("div", {
737
737
  style: {
738
738
  flex: 1,
739
739
  overflowY: "auto",
@@ -742,17 +742,17 @@ function J({ entityCode: n, recordId: r, items: a, schema: s, entity: d, onBackT
742
742
  flexDirection: "column",
743
743
  gap: 12
744
744
  },
745
- children: a && a.length > 0 ? /* @__PURE__ */ V(I, {
746
- nodes: a,
747
- ctx: ue
748
- }) : /* @__PURE__ */ H("p", {
745
+ children: i && i.length > 0 ? /* @__PURE__ */ z(N, {
746
+ nodes: i,
747
+ ctx: de
748
+ }) : /* @__PURE__ */ B("p", {
749
749
  style: {
750
750
  fontSize: 12.5,
751
751
  color: "var(--text-3)"
752
752
  },
753
753
  children: [
754
754
  "No layout configured. Add ",
755
- /* @__PURE__ */ V("code", { children: "items:" }),
755
+ /* @__PURE__ */ z("code", { children: "items:" }),
756
756
  " to the screen definition."
757
757
  ]
758
758
  })
@@ -760,4 +760,4 @@ function J({ entityCode: n, recordId: r, items: a, schema: s, entity: d, onBackT
760
760
  });
761
761
  }
762
762
  //#endregion
763
- export { U as SmartRecordListPage };
763
+ export { V as SmartRecordListPage };