@declarion/react 0.36.3 → 0.36.5

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.
@@ -1,42 +1,42 @@
1
1
  import { s as e } from "./DynamicIcon-BWO6QtNF.js";
2
- import { A as t, En as n, Ln as r, N as i, Un as a, V as o, Wn as s, _n as c, an as l, cn as u, g as d, jn as f, kn as ee, mt as p, on as m, p as h, rn as g, v as _, vn as te } from "./ActionRunner-BrXXs8ga.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-D_zbJrLC.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-C_1KM72K.js";
5
- import { t as N } from "./LayoutRenderer-0UKE3pp6.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";
2
+ import { F as t, Gn as n, Kn as r, M as i, Nn as a, On as o, U as s, an as c, b as l, bn as u, cn as d, gt as ee, h as f, jn as te, sn as p, un as m, v as h, yn as g, zn as ne } from "./useCurrentScreen-Bgp6_vne.js";
3
+ import { $ as _, G as v, 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-KMbQkTF6.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-DMT162ot.js";
5
+ import { t as N } from "./LayoutRenderer-BGeN0rwC.js";
6
+ import { useCallback as P, useEffect as F, useMemo as I, useRef as L, useState as R } from "react";
7
+ import { useSearchParams as ce } from "react-router-dom";
8
+ import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
9
9
  //#region src/components/pages/SmartRecordListPage.impl.tsx
10
- function V({ screenCode: o }) {
11
- let [s, c] = le(), { data: d } = p(), f = r(), m = d?.screens[o], h = m?.entity ? d?.entities[m.entity] : void 0, g = m?.entity;
12
- oe(m, h, s.toString()), k(m?.route);
13
- let _ = ie(), v = s.get("selected") ?? null, ne = s.get("search") ?? "", re = t(ne, 300), y = s.get("sort") ?? m?.sort_default ?? "", b = I(() => {
14
- let e = D(s);
10
+ function H({ screenCode: r }) {
11
+ let [a, s] = ce(), { data: c } = ee(), l = ne(), d = c?.screens[r], f = d?.entity ? c?.entities[d.entity] : void 0, h = d?.entity;
12
+ oe(d, f, a.toString()), k(d?.route);
13
+ let g = ie(), _ = a.get("selected") ?? null, v = a.get("search") ?? "", re = i(v, 300), y = a.get("sort") ?? d?.sort_default ?? "", b = I(() => {
14
+ let e = D(a);
15
15
  return e.length > 0 ? e : void 0;
16
- }, [s]), x = I(() => m?.columns ?? h?.fields.names().filter((e) => !h.fields.get(e)?.primary && !h.fields.get(e)?.auto && h.fields.get(e)?.display?.is_listable !== !1).slice(0, 4) ?? [], [m?.columns, h]), C = I(() => {
17
- let e = m?.responsive?.[f.category]?.presentation;
18
- return f.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
19
- }, [m?.responsive, f.category]), w = I(() => {
20
- let e = m?.responsive?.[f.category];
21
- return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation : f.category === "phone" ? "cards" : "table";
22
- }, [m?.responsive, f.category]), ae = m?.responsive?.[f.category]?.layout?.related_records, A = I(() => T({
23
- entity: h,
24
- screen: m
25
- }), [h, m]), j = I(() => S({
26
- entity: h,
27
- screen: m,
16
+ }, [a]), x = I(() => 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]), C = I(() => {
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]), w = I(() => {
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]), ae = d?.responsive?.[l.category]?.layout?.related_records, A = I(() => T({
23
+ entity: f,
24
+ screen: d
25
+ }), [f, d]), j = I(() => S({
26
+ entity: f,
27
+ screen: d,
28
28
  presentation: w,
29
29
  visibleColumns: x,
30
30
  card: A,
31
31
  sort: y
32
32
  }), [
33
- h,
34
- m,
33
+ f,
34
+ d,
35
35
  w,
36
36
  x,
37
37
  A,
38
38
  y
39
- ]), N = h?.list_pagination === "cursor", { data: V, isLoading: H } = i(g, {
39
+ ]), N = f?.list_pagination === "cursor", { data: H, isLoading: U } = t(h, {
40
40
  page: 1,
41
41
  per_page: 200,
42
42
  sort: y || void 0,
@@ -45,51 +45,51 @@ function V({ screenCode: o }) {
45
45
  select: j.selectFields,
46
46
  expand: j.expandFields,
47
47
  preview: !0,
48
- screen: m?.fixed_filters ? o : void 0
49
- }, !N), U = E(g, {
48
+ screen: d?.fixed_filters ? r : void 0
49
+ }, !N), W = E(h, {
50
50
  sort: y || void 0,
51
51
  search: re || void 0,
52
52
  filters: b,
53
53
  select: j.selectFields,
54
54
  expand: j.expandFields,
55
55
  preview: !0,
56
- screen: m?.fixed_filters ? o : void 0,
56
+ screen: d?.fixed_filters ? r : void 0,
57
57
  limit: 200
58
- }, N), W = N ? U.rows : V?.data ?? [], K = N ? U.refs : V?.$refs, q = N ? U.isLoading : H, de = I(() => h?.fields.names().find((e) => h.fields.get(e)?.primary) ?? "id", [h]), fe = P((e, t) => {
59
- c((t) => {
58
+ }, N), G = N ? W.rows : H?.data ?? [], q = N ? W.refs : H?.$refs, J = N ? W.isLoading : U, ue = I(() => f?.fields.names().find((e) => f.fields.get(e)?.primary) ?? "id", [f]), de = P((e, t) => {
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
- }, [c]), pe = P((e) => {
64
- c((t) => {
63
+ }, [s]), fe = P((e) => {
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
- }, [c]), me = P((e, t) => {
69
- c((n) => {
68
+ }, [s]), pe = P((e, t) => {
69
+ s((n) => {
70
70
  let r = new URLSearchParams(n), i = D(n), a;
71
71
  return a = t && t !== "__all__" ? [...O(i, e), M(e, t)] : O(i, e), se(a, r), r;
72
72
  }, { replace: !0 });
73
- }, [c]), J = (m?.list_resizable ?? !1) && C === "split" && f.category !== "phone" && !f.touch, Y = L(null), [X, Z] = ce(null), Q = L(!1), $ = m?.list_width;
73
+ }, [s]), Y = (d?.list_resizable ?? !1) && C === "split" && l.category !== "phone" && !l.touch, me = L(null), [X, Z] = R(null), Q = L(!1), $ = d?.list_width;
74
74
  F(() => {
75
- !J || !$?.endsWith("%") || Z(null);
75
+ !Y || !$?.endsWith("%") || Z(null);
76
76
  }, [
77
- J,
77
+ Y,
78
78
  $,
79
- f.width,
80
- f.height
79
+ l.width,
80
+ l.height
81
81
  ]), F(() => {
82
- if (!J || X !== null) return;
83
- let e = Y.current;
82
+ if (!Y || X !== null) return;
83
+ let e = me.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
- J,
89
+ Y,
90
90
  $,
91
91
  X,
92
- h
92
+ f
93
93
  ]);
94
94
  let he = L(null);
95
95
  F(() => () => {
@@ -99,17 +99,17 @@ function V({ screenCode: o }) {
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 = (Y.current?.getBoundingClientRect().width ?? window.innerWidth) - 300, i = Math.max(200, Math.min(r, n + e.clientX - t));
102
+ let r = (me.current?.getBoundingClientRect().width ?? window.innerWidth) - 300, i = Math.max(200, Math.min(r, n + e.clientX - t));
103
103
  Z(i);
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;
106
106
  };
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
- if (!d || !m || !h) return null;
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 : m.list_width ?? "320px" : "100%";
111
- return /* @__PURE__ */ B("div", {
112
- ref: Y,
109
+ if (!c || !d || !f) return null;
110
+ let _e = b?.length ?? 0, ve = C === "split" || C === "stacked" || !_, ye = C === "split" || C === "stacked" || !!_, be = C !== "split" && _ ? () => de(null, { replace: !0 }) : void 0, xe = C === "split" ? Y && X !== null ? X : d.list_width ?? "320px" : "100%";
111
+ return /* @__PURE__ */ V("div", {
112
+ ref: me,
113
113
  "data-record-list-presentation": C,
114
114
  style: {
115
115
  display: "flex",
@@ -119,20 +119,20 @@ function V({ screenCode: o }) {
119
119
  overflow: "hidden"
120
120
  },
121
121
  children: [
122
- ve && /* @__PURE__ */ B("div", {
122
+ ve && /* @__PURE__ */ V("div", {
123
123
  "data-testid": "record-list-panel",
124
124
  style: {
125
125
  flex: C === "split" ? "none" : "1 1 auto",
126
126
  display: "flex",
127
127
  flexDirection: "column",
128
128
  overflow: "hidden",
129
- borderRight: C === "split" && !J ? "1px solid var(--divider)" : "none",
129
+ borderRight: C === "split" && !Y ? "1px solid var(--divider)" : "none",
130
130
  borderBottom: C === "stacked" ? "1px solid var(--divider)" : "none",
131
131
  width: xe,
132
132
  minWidth: 0,
133
133
  height: C === "stacked" ? "50%" : "100%"
134
134
  },
135
- children: [/* @__PURE__ */ B("div", {
135
+ children: [/* @__PURE__ */ V("div", {
136
136
  style: {
137
137
  padding: 12,
138
138
  display: "flex",
@@ -141,59 +141,59 @@ function V({ screenCode: o }) {
141
141
  borderBottom: "1px solid var(--divider)"
142
142
  },
143
143
  children: [
144
- _.hasOriginBack && /* @__PURE__ */ B("div", {
144
+ g.hasOriginBack && /* @__PURE__ */ V("div", {
145
145
  style: {
146
146
  display: "flex",
147
147
  alignItems: "center",
148
148
  gap: 8
149
149
  },
150
- children: [/* @__PURE__ */ z(a, {
151
- icon: /* @__PURE__ */ z(e.back, { size: 14 }),
150
+ children: [/* @__PURE__ */ B(n, {
151
+ icon: /* @__PURE__ */ B(e.back, { size: 14 }),
152
152
  title: "Back",
153
- onClick: _.goBack
154
- }), /* @__PURE__ */ z("span", {
153
+ onClick: g.goBack
154
+ }), /* @__PURE__ */ B("span", {
155
155
  style: {
156
156
  fontSize: 12.5,
157
157
  fontWeight: 600,
158
158
  color: "var(--text)"
159
159
  },
160
- children: u(m.display?.name) || u(h.display.name_plural)
160
+ children: m(d.display?.name) || m(f.display.name_plural)
161
161
  })]
162
162
  }),
163
- /* @__PURE__ */ z(ee, {
164
- value: ne,
165
- onChange: pe,
166
- placeholder: `Search ${u(h.display.name_plural)}…`,
167
- prefix: /* @__PURE__ */ z(e.search, { size: 13 })
163
+ /* @__PURE__ */ B(te, {
164
+ value: v,
165
+ onChange: fe,
166
+ placeholder: `Search ${m(f.display.name_plural)}…`,
167
+ prefix: /* @__PURE__ */ B(e.search, { size: 13 })
168
168
  }),
169
- m.filters && m.filters.length > 0 && /* @__PURE__ */ z("div", {
169
+ d.filters && d.filters.length > 0 && /* @__PURE__ */ B("div", {
170
170
  style: {
171
171
  display: "flex",
172
172
  flexWrap: "wrap",
173
173
  gap: 6
174
174
  },
175
- children: m.filters.map((e) => {
176
- let t = h.fields.get(e);
175
+ children: d.filters.map((e) => {
176
+ let t = f.fields.get(e);
177
177
  if (!t?.values) return null;
178
- let r = b?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", i = l(t, e, d.entities);
179
- return /* @__PURE__ */ z("div", {
178
+ let n = b?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r = p(t, e, c.entities);
179
+ return /* @__PURE__ */ B("div", {
180
180
  style: { minWidth: 120 },
181
- children: /* @__PURE__ */ z(n, {
182
- value: r,
181
+ children: /* @__PURE__ */ B(o, {
182
+ value: n,
183
183
  options: [{
184
184
  value: "__all__",
185
- label: `All ${i}`
185
+ label: `All ${r}`
186
186
  }, ...t.values.map((e) => ({
187
187
  value: e.code,
188
- label: u(e.name) || e.code
188
+ label: m(e.name) || e.code
189
189
  }))],
190
- onChange: (t) => me(e, t),
191
- placeholder: i
190
+ onChange: (t) => pe(e, t),
191
+ placeholder: r
192
192
  })
193
193
  }, e);
194
194
  })
195
195
  }),
196
- /* @__PURE__ */ B("div", {
196
+ /* @__PURE__ */ V("div", {
197
197
  style: {
198
198
  display: "flex",
199
199
  alignItems: "center",
@@ -201,8 +201,8 @@ function V({ screenCode: o }) {
201
201
  fontSize: 11,
202
202
  color: "var(--text-3)"
203
203
  },
204
- children: [/* @__PURE__ */ z("span", { children: q ? "Loading…" : `${W.length} ${u(h.display.name_plural)}` }), _e > 0 && /* @__PURE__ */ z("button", {
205
- onClick: () => c((e) => {
204
+ children: [/* @__PURE__ */ B("span", { children: J ? "Loading…" : `${G.length} ${m(f.display.name_plural)}` }), _e > 0 && /* @__PURE__ */ B("button", {
205
+ onClick: () => s((e) => {
206
206
  let t = new URLSearchParams(e);
207
207
  return t.delete("filters"), t;
208
208
  }, { replace: !0 }),
@@ -219,7 +219,7 @@ function V({ screenCode: o }) {
219
219
  })]
220
220
  })
221
221
  ]
222
- }), /* @__PURE__ */ z("div", {
222
+ }), /* @__PURE__ */ B("div", {
223
223
  style: {
224
224
  flex: 1,
225
225
  overflowY: "auto",
@@ -228,19 +228,19 @@ function V({ screenCode: o }) {
228
228
  flexDirection: "column",
229
229
  gap: w === "cards" ? 10 : void 0
230
230
  },
231
- children: q ? /* @__PURE__ */ z("div", {
231
+ children: J ? /* @__PURE__ */ B("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__ */ z("div", { style: {
238
+ children: Array.from({ length: 8 }).map((e, t) => /* @__PURE__ */ B("div", { style: {
239
239
  height: 48,
240
240
  borderRadius: 6,
241
241
  background: "var(--surface-3)"
242
242
  } }, t))
243
- }) : W.length === 0 ? /* @__PURE__ */ z("div", {
243
+ }) : G.length === 0 ? /* @__PURE__ */ B("div", {
244
244
  style: {
245
245
  padding: 28,
246
246
  textAlign: "center",
@@ -248,23 +248,23 @@ function V({ screenCode: o }) {
248
248
  color: "var(--text-3)"
249
249
  },
250
250
  children: "No records found"
251
- }) : /* @__PURE__ */ B(R, { children: [W.map((e) => {
252
- let t = te(e[de]);
253
- return /* @__PURE__ */ z(ue, {
251
+ }) : /* @__PURE__ */ V(z, { children: [G.map((e) => {
252
+ let t = u(e[ue]);
253
+ return /* @__PURE__ */ B(le, {
254
254
  record: e,
255
- entity: h,
255
+ entity: f,
256
256
  columns: x,
257
257
  card: A,
258
258
  presentation: w,
259
- refs: K,
260
- isSelected: t === v,
261
- onClick: () => fe(t, { replace: C === "split" })
259
+ refs: q,
260
+ isSelected: t === _,
261
+ onClick: () => de(t, { replace: C === "split" })
262
262
  }, t);
263
- }), N && U.hasMore && /* @__PURE__ */ z("button", {
263
+ }), N && W.hasMore && /* @__PURE__ */ B("button", {
264
264
  type: "button",
265
265
  "data-testid": "record-list-load-more",
266
- onClick: () => void U.fetchNextPage(),
267
- disabled: U.isFetchingNextPage,
266
+ onClick: () => void W.fetchNextPage(),
267
+ disabled: W.isFetchingNextPage,
268
268
  style: {
269
269
  width: "100%",
270
270
  padding: "8px 12px",
@@ -273,13 +273,13 @@ function V({ screenCode: o }) {
273
273
  border: "none",
274
274
  borderTop: "1px solid var(--divider)",
275
275
  color: "var(--text-2)",
276
- cursor: U.isFetchingNextPage ? "default" : "pointer"
276
+ cursor: W.isFetchingNextPage ? "default" : "pointer"
277
277
  },
278
- children: U.isFetchingNextPage ? "Loading…" : "Load more"
278
+ children: W.isFetchingNextPage ? "Loading…" : "Load more"
279
279
  })] })
280
280
  })]
281
281
  }),
282
- J && /* @__PURE__ */ z("div", {
282
+ Y && /* @__PURE__ */ B("div", {
283
283
  "data-testid": "record-list-resize-handle",
284
284
  onMouseDown: ge,
285
285
  style: {
@@ -292,7 +292,7 @@ function V({ screenCode: o }) {
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__ */ z("div", {
295
+ ye && /* @__PURE__ */ B("div", {
296
296
  "data-testid": "record-detail-panel",
297
297
  style: {
298
298
  flex: 1,
@@ -300,15 +300,15 @@ function V({ screenCode: o }) {
300
300
  overflow: "hidden",
301
301
  height: C === "stacked" ? "50%" : "100%"
302
302
  },
303
- children: v ? /* @__PURE__ */ z(G, {
304
- entityCode: g,
305
- recordId: v,
306
- items: m.items,
307
- schema: d,
308
- entity: h,
303
+ children: _ ? /* @__PURE__ */ B(K, {
304
+ entityCode: h,
305
+ recordId: _,
306
+ items: d.items,
307
+ schema: c,
308
+ entity: f,
309
309
  onBackToList: be,
310
310
  relatedRecordsPresentation: ae
311
- }, v) : /* @__PURE__ */ z("div", {
311
+ }, _) : /* @__PURE__ */ B("div", {
312
312
  style: {
313
313
  display: "flex",
314
314
  alignItems: "center",
@@ -316,11 +316,11 @@ function V({ screenCode: o }) {
316
316
  height: "100%",
317
317
  color: "var(--text-3)"
318
318
  },
319
- children: /* @__PURE__ */ B("p", {
319
+ children: /* @__PURE__ */ V("p", {
320
320
  style: { fontSize: 12.5 },
321
321
  children: [
322
322
  "Select a ",
323
- u(h.display.name),
323
+ m(f.display.name),
324
324
  " to view details"
325
325
  ]
326
326
  })
@@ -329,11 +329,11 @@ function V({ screenCode: o }) {
329
329
  ]
330
330
  });
331
331
  }
332
- function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a, isSelected: o, onClick: s }) {
333
- let c = h();
332
+ function le({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a, isSelected: o, onClick: s }) {
333
+ let c = f();
334
334
  if (i === "cards") {
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", {
335
+ let n = r.badgeFields.filter((n) => U(t, e, n)), i = r.bodyFields.filter((n) => U(t, e, n)), l = r.metaFields.filter((n) => U(t, e, n));
336
+ return /* @__PURE__ */ V("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 ue({ 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__ */ z(U, {
356
+ /* @__PURE__ */ B(W, {
357
357
  entity: t,
358
358
  record: e,
359
359
  field: r.titleField,
360
360
  refs: a
361
361
  }),
362
- r.subtitleField && /* @__PURE__ */ z("div", {
362
+ r.subtitleField && /* @__PURE__ */ B("div", {
363
363
  style: {
364
364
  fontSize: 12,
365
365
  color: "var(--text-3)",
@@ -374,13 +374,13 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
374
374
  locale: c
375
375
  })
376
376
  }),
377
- n.length > 0 && /* @__PURE__ */ z("div", {
377
+ n.length > 0 && /* @__PURE__ */ B("div", {
378
378
  style: {
379
379
  display: "flex",
380
380
  flexWrap: "wrap",
381
381
  gap: 6
382
382
  },
383
- children: n.map((n) => /* @__PURE__ */ z("span", {
383
+ children: n.map((n) => /* @__PURE__ */ B("span", {
384
384
  style: {
385
385
  border: "1px solid var(--border)",
386
386
  borderRadius: 999,
@@ -400,14 +400,14 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
400
400
  })
401
401
  }, n))
402
402
  }),
403
- i.length > 0 && /* @__PURE__ */ z("dl", {
403
+ i.length > 0 && /* @__PURE__ */ B("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__ */ z(W, {
410
+ children: i.map((n) => /* @__PURE__ */ B(G, {
411
411
  entity: t,
412
412
  record: e,
413
413
  fieldName: n,
@@ -415,7 +415,7 @@ function ue({ 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__ */ z("div", {
418
+ l.length > 0 && /* @__PURE__ */ B("div", {
419
419
  style: {
420
420
  display: "flex",
421
421
  flexWrap: "wrap",
@@ -423,7 +423,7 @@ function ue({ 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__ */ z("span", {
426
+ children: l.map((n) => /* @__PURE__ */ B("span", {
427
427
  style: {
428
428
  minWidth: 0,
429
429
  overflowWrap: "anywhere"
@@ -442,7 +442,7 @@ function ue({ 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__ */ B("button", {
445
+ return /* @__PURE__ */ V("button", {
446
446
  onClick: s,
447
447
  style: {
448
448
  width: "100%",
@@ -465,7 +465,7 @@ function ue({ 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__ */ z("div", {
468
+ children: [l && /* @__PURE__ */ B("div", {
469
469
  style: {
470
470
  fontSize: 12.5,
471
471
  fontWeight: 500,
@@ -482,13 +482,13 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
482
482
  refs: a,
483
483
  locale: c
484
484
  })
485
- }), /* @__PURE__ */ B("div", {
485
+ }), /* @__PURE__ */ V("div", {
486
486
  style: {
487
487
  display: "flex",
488
488
  alignItems: "center",
489
489
  gap: 6
490
490
  },
491
- children: [u && /* @__PURE__ */ z("div", {
491
+ children: [u && /* @__PURE__ */ B("div", {
492
492
  style: {
493
493
  fontSize: 11,
494
494
  color: "var(--text-3)",
@@ -505,14 +505,14 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
505
505
  refs: a,
506
506
  locale: c
507
507
  })
508
- }), /* @__PURE__ */ z("div", {
508
+ }), /* @__PURE__ */ B("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) => v(t, e, n) == null ? null : /* @__PURE__ */ z("div", {
515
+ children: d.map((n) => _(t, e, n) == null ? null : /* @__PURE__ */ B("div", {
516
516
  style: { fontSize: 11 },
517
517
  children: C({
518
518
  entity: t,
@@ -527,13 +527,13 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
527
527
  })]
528
528
  });
529
529
  }
530
- function H(e, t, n) {
531
- let r = v(e, t, n);
530
+ function U(e, t, n) {
531
+ let r = _(e, t, n);
532
532
  return !(r == null || r === "" || Array.isArray(r) && r.length === 0);
533
533
  }
534
- function U({ entity: e, record: t, field: n, refs: r }) {
535
- let i = h(), a = m(t, e);
536
- return /* @__PURE__ */ z("div", {
534
+ function W({ entity: e, record: t, field: n, refs: r }) {
535
+ let i = f(), a = d(t, e);
536
+ return /* @__PURE__ */ B("div", {
537
537
  style: {
538
538
  fontSize: 13.5,
539
539
  fontWeight: 600,
@@ -547,22 +547,22 @@ function U({ entity: e, record: t, field: n, refs: r }) {
547
547
  mode: "display",
548
548
  refs: r,
549
549
  locale: i
550
- }) : a) || u(e.display.name)
550
+ }) : a) || m(e.display.name)
551
551
  });
552
552
  }
553
- function W({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
554
- let a = v(e, t, n);
553
+ function G({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
554
+ let a = _(e, t, n);
555
555
  if (a == null || a === "") return null;
556
556
  let o = e.fields.get(n);
557
- return o ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("dt", {
557
+ return o ? /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("dt", {
558
558
  style: {
559
559
  color: "var(--text-3)",
560
560
  fontSize: 11.5,
561
561
  minWidth: 0,
562
562
  overflowWrap: "anywhere"
563
563
  },
564
- children: l(o, n)
565
- }), /* @__PURE__ */ z("dd", {
564
+ children: p(o, n)
565
+ }), /* @__PURE__ */ B("dd", {
566
566
  style: {
567
567
  margin: 0,
568
568
  color: "var(--text)",
@@ -580,8 +580,8 @@ function W({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
580
580
  })
581
581
  })] }) : null;
582
582
  }
583
- function G({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList: a, relatedRecordsPresentation: o }) {
584
- return /* @__PURE__ */ z(d, { children: /* @__PURE__ */ z(K, {
583
+ function K({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList: a, relatedRecordsPresentation: o }) {
584
+ return /* @__PURE__ */ B(h, { children: /* @__PURE__ */ B(q, {
585
585
  entityCode: e,
586
586
  recordId: t,
587
587
  items: n,
@@ -591,97 +591,97 @@ function G({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackT
591
591
  relatedRecordsPresentation: o
592
592
  }) });
593
593
  }
594
- function K({ entityCode: t, recordId: n, items: r, schema: i, entity: l, onBackToList: d, relatedRecordsPresentation: ee }) {
595
- let p = g(l, "update"), { data: h, isLoading: ie } = x(t, I(() => n ? c(l, n) : void 0, [n, l])), S = ne(t), C = _(), [T, E] = ce(!1), [D, O] = ce({}), k = h?.data, oe = k?.$statuses, se = k?.$properties, M = j(t, n), F = A(t, n), L = I(() => {
594
+ function q({ entityCode: t, recordId: i, items: o, schema: ee, entity: f, onBackToList: te, relatedRecordsPresentation: p }) {
595
+ let h = c(f, "update"), { data: ne, isLoading: ie } = x(t, I(() => i ? g(f, i) : void 0, [i, f])), S = v(t), C = l(), [T, E] = R(!1), [D, O] = R({}), k = ne?.data, oe = k?.$statuses, se = k?.$properties, M = j(t, i), F = A(t, i), L = I(() => {
596
596
  let e = /* @__PURE__ */ new Set();
597
- for (let [t, n] of l.fields) !n.auto && !n.primary && e.add(t);
598
- for (let [t] of l.files ?? []) e.add(t);
597
+ for (let [t, n] of f.fields) !n.auto && !n.primary && e.add(t);
598
+ for (let [t] of f.files ?? []) e.add(t);
599
599
  return e;
600
- }, [l]), le = P(() => {
600
+ }, [f]), ce = P(() => {
601
601
  if (k) {
602
602
  let e = {};
603
603
  L.forEach((t) => {
604
- let n = v(l, k, t);
605
- e[t] = re(l, t) ? n ?? null : n ?? "";
604
+ let n = _(f, k, t);
605
+ e[t] = re(f, t) ? n ?? null : n ?? "";
606
606
  }), O(e);
607
607
  }
608
608
  E(!0);
609
609
  }, [
610
610
  k,
611
611
  L,
612
- l
613
- ]), V = P(async () => {
612
+ f
613
+ ]), H = P(async () => {
614
614
  await C.flushAllDrafts(), E(!1), O({});
615
- }, [C]), ue = P(() => {
615
+ }, [C]), le = P(() => {
616
616
  let e = {}, t = y({
617
- entity: l,
617
+ entity: f,
618
618
  formData: D,
619
619
  record: k,
620
620
  isNew: !1
621
- }), r = b(t);
622
- for (let [t, n] of Object.entries(D)) l.files?.has(t) || (e[t] = w(l, t, n));
621
+ }), n = b(t);
622
+ for (let [t, n] of Object.entries(D)) f.files?.has(t) || (e[t] = w(f, t, n));
623
623
  if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0) {
624
624
  E(!1), O({});
625
625
  return;
626
626
  }
627
627
  S.mutate({
628
- pkValues: n,
628
+ pkValues: i,
629
629
  data: e
630
630
  }, {
631
631
  onSuccess: () => {
632
- r.forEach((e) => C.markCommitted(e)), E(!1), O({}), o.success("Saved");
632
+ n.forEach((e) => C.markCommitted(e)), E(!1), O({}), s.success("Saved");
633
633
  },
634
- onError: () => o.error("Failed to save")
634
+ onError: () => s.error("Failed to save")
635
635
  });
636
636
  }, [
637
637
  C,
638
638
  S,
639
- n,
640
- l,
639
+ i,
640
+ f,
641
641
  D,
642
642
  k
643
- ]), H = P((e, t) => {
643
+ ]), U = P((e, t) => {
644
644
  O((n) => ({
645
645
  ...n,
646
646
  [e]: t
647
647
  }));
648
648
  }, []);
649
- if (ie) return /* @__PURE__ */ z(ae, {});
649
+ if (ie) return /* @__PURE__ */ B(ae, {});
650
650
  if (!k) return null;
651
- let U = m(k, l), W = l.display?.display_field, G = U ? void 0 : W ? k[W] : k[l.fields.names()[0]], K = U || (G != null && typeof G != "object" ? te(G) : u(l.display.name)), q = k?.$refs, de = {
652
- schema: i,
653
- entity: l,
651
+ let W = d(k, f), G = f.display?.display_field, K = W ? void 0 : G ? k[G] : k[f.fields.names()[0]], q = W || (K != null && typeof K != "object" ? u(K) : m(f.display.name)), J = k?.$refs, ue = {
652
+ schema: ee,
653
+ entity: f,
654
654
  entityCode: t,
655
- recordId: n,
655
+ recordId: i,
656
656
  record: T ? {
657
657
  ...k,
658
658
  ...D
659
659
  } : k,
660
660
  isNew: !1,
661
661
  mode: T ? "edit" : "display",
662
- onFieldChange: T ? H : void 0,
663
- refs: q,
662
+ onFieldChange: T ? U : void 0,
663
+ refs: J,
664
664
  objectProperties: se ?? void 0,
665
- onSetProperty: p ? (e, t) => F.mutate({
665
+ onSetProperty: h ? (e, t) => F.mutate({
666
666
  propertyCode: e,
667
667
  value: t
668
668
  }) : void 0,
669
669
  isPropertyPending: F.isPending,
670
670
  objectStatuses: oe ?? void 0,
671
- onSetStatus: p ? (e, t) => M.mutate({
671
+ onSetStatus: h ? (e, t) => M.mutate({
672
672
  groupCode: e,
673
673
  statusCode: t
674
674
  }) : void 0,
675
675
  isStatusPending: M.isPending,
676
- relatedRecordsPresentation: ee
676
+ relatedRecordsPresentation: p
677
677
  };
678
- return /* @__PURE__ */ B("div", {
678
+ return /* @__PURE__ */ V("div", {
679
679
  style: {
680
680
  display: "flex",
681
681
  flexDirection: "column",
682
682
  height: "100%"
683
683
  },
684
- children: [/* @__PURE__ */ B("div", {
684
+ children: [/* @__PURE__ */ V("div", {
685
685
  style: {
686
686
  display: "flex",
687
687
  alignItems: "center",
@@ -693,7 +693,7 @@ function K({ entityCode: t, recordId: n, items: r, schema: i, entity: l, onBackT
693
693
  background: "var(--surface)",
694
694
  zIndex: 10
695
695
  },
696
- children: [/* @__PURE__ */ z("h2", {
696
+ children: [/* @__PURE__ */ B("h2", {
697
697
  style: {
698
698
  margin: 0,
699
699
  fontSize: 13,
@@ -703,37 +703,37 @@ function K({ entityCode: t, recordId: n, items: r, schema: i, entity: l, onBackT
703
703
  whiteSpace: "nowrap",
704
704
  color: "var(--text)"
705
705
  },
706
- children: K
707
- }), /* @__PURE__ */ B("div", {
706
+ children: q
707
+ }), /* @__PURE__ */ V("div", {
708
708
  style: {
709
709
  display: "flex",
710
710
  alignItems: "center",
711
711
  gap: 6
712
712
  },
713
- children: [d && /* @__PURE__ */ z(a, {
714
- icon: /* @__PURE__ */ z(e.back, { size: 14 }),
713
+ children: [te && /* @__PURE__ */ B(n, {
714
+ icon: /* @__PURE__ */ B(e.back, { size: 14 }),
715
715
  title: "Back to list",
716
- onClick: d
717
- }), p && (T ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(s, {
716
+ onClick: te
717
+ }), h && (T ? /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B(r, {
718
718
  size: "xs",
719
- icon: /* @__PURE__ */ z(e.x, { size: 12 }),
720
- onClick: V,
719
+ icon: /* @__PURE__ */ B(e.x, { size: 12 }),
720
+ onClick: H,
721
721
  children: "Cancel"
722
- }), /* @__PURE__ */ z(s, {
722
+ }), /* @__PURE__ */ B(r, {
723
723
  kind: "primary",
724
724
  size: "xs",
725
- icon: S.isPending ? /* @__PURE__ */ z(f, { size: 12 }) : /* @__PURE__ */ z(e.save, { size: 12 }),
726
- onClick: ue,
725
+ icon: S.isPending ? /* @__PURE__ */ B(a, { size: 12 }) : /* @__PURE__ */ B(e.save, { size: 12 }),
726
+ onClick: le,
727
727
  disabled: S.isPending,
728
728
  children: S.isPending ? "Saving…" : "Save"
729
- })] }) : /* @__PURE__ */ z(s, {
729
+ })] }) : /* @__PURE__ */ B(r, {
730
730
  size: "xs",
731
- icon: /* @__PURE__ */ z(e.edit, { size: 12 }),
732
- onClick: le,
731
+ icon: /* @__PURE__ */ B(e.edit, { size: 12 }),
732
+ onClick: ce,
733
733
  children: "Edit"
734
734
  }))]
735
735
  })]
736
- }), /* @__PURE__ */ z("div", {
736
+ }), /* @__PURE__ */ B("div", {
737
737
  style: {
738
738
  flex: 1,
739
739
  overflowY: "auto",
@@ -742,17 +742,17 @@ function K({ entityCode: t, recordId: n, items: r, schema: i, entity: l, onBackT
742
742
  flexDirection: "column",
743
743
  gap: 12
744
744
  },
745
- children: r && r.length > 0 ? /* @__PURE__ */ z(N, {
746
- nodes: r,
747
- ctx: de
748
- }) : /* @__PURE__ */ B("p", {
745
+ children: o && o.length > 0 ? /* @__PURE__ */ B(N, {
746
+ nodes: o,
747
+ ctx: ue
748
+ }) : /* @__PURE__ */ V("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__ */ z("code", { children: "items:" }),
755
+ /* @__PURE__ */ B("code", { children: "items:" }),
756
756
  " to the screen definition."
757
757
  ]
758
758
  })
@@ -760,4 +760,4 @@ function K({ entityCode: t, recordId: n, items: r, schema: i, entity: l, onBackT
760
760
  });
761
761
  }
762
762
  //#endregion
763
- export { V as SmartRecordListPage };
763
+ export { H as SmartRecordListPage };