@declarion/react 0.39.0 → 0.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,83 +1,83 @@
1
1
  import { s as e } from "./DynamicIcon-DeRpAaXm.js";
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 p, sn as m, un as h, v as g, yn as te, zn as ne } from "./useCurrentScreen-BA2lb-d7.js";
3
- import { _ as re, a as _, at as v, c as y, ct as ie, it as b, nt as x, ot as S, q as C, rt as w, s as T, w as ae } from "./registry-DXNFRlbB.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-Br2DeOQh.js";
5
- import { t as N } from "./LayoutRenderer-CwMERoPJ.js";
2
+ import { A as t, Cn as n, F as r, Fn as i, N as a, Pn as o, Sn as s, Tn as c, Wn as l, X as u, Yn as d, bn as f, cr as p, it as m, jt as ee, q as te, qn as h, sr as ne, tr as re } from "./useCurrentScreen-C33VZcNn.js";
3
+ import { G as g, K as _, U as ie, W as v, Y as y, _ as ae, a as b, c as x, k as S, q as C, s as w, w as oe } from "./registry-DbZX1hy8.js";
4
+ import { _ as T, c as E, f as D, h as O, m as se, n as k, p as A, r as j, x as M } from "./useProperties-BgAEk8X9.js";
5
+ import { t as N } from "./LayoutRenderer-Cbh-pY26.js";
6
6
  import { useCallback as P, useEffect as F, useMemo as I, useRef as L, useState as ce } from "react";
7
7
  import { useSearchParams as le } from "react-router-dom";
8
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 V({ screenCode: r }) {
11
- let [a, s] = le(), { data: c } = ee(), l = ne(), d = c?.screens[r], f = d?.entity ? c?.entities[d.entity] : void 0, g = d?.entity;
12
- oe(d, f, a.toString()), k(d?.route);
13
- let te = re(), _ = a.get("selected") ?? null, v = a.get("search") ?? "", ie = i(v, 300), b = a.get("sort") ?? d?.sort_default ?? "", x = I(() => {
14
- let e = D(a);
10
+ function V({ screenCode: t }) {
11
+ let [n, r] = le(), { data: a } = ee(), o = re(), d = a?.screens[t], f = d?.entity ? a?.entities[d.entity] : void 0, p = d?.entity;
12
+ O(d, f, n.toString()), T(d?.route);
13
+ let m = ae(), g = n.get("selected") ?? null, _ = n.get("search") ?? "", ie = te(_, 300), v = n.get("sort") ?? d?.sort_default ?? "", y = I(() => {
14
+ let e = D(n);
15
15
  return e.length > 0 ? e : void 0;
16
- }, [a]), S = 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({
16
+ }, [n]), b = 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]), S = I(() => {
17
+ let e = d?.responsive?.[o.category]?.presentation;
18
+ return o.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
19
+ }, [d?.responsive, o.category]), C = I(() => {
20
+ let e = d?.responsive?.[o.category];
21
+ return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation : o.category === "phone" ? "cards" : "table";
22
+ }, [d?.responsive, o.category]), oe = d?.responsive?.[o.category]?.layout?.related_records, k = I(() => w({
23
23
  entity: f,
24
24
  screen: d
25
- }), [f, d]), j = I(() => y({
25
+ }), [f, d]), j = I(() => x({
26
26
  entity: f,
27
27
  screen: d,
28
- presentation: w,
29
- visibleColumns: S,
30
- card: A,
31
- sort: b
28
+ presentation: C,
29
+ visibleColumns: b,
30
+ card: k,
31
+ sort: v
32
32
  }), [
33
33
  f,
34
34
  d,
35
- w,
36
- S,
37
- A,
38
- b
39
- ]), N = f?.list_pagination === "cursor", { data: V, isLoading: H } = t(g, {
35
+ C,
36
+ b,
37
+ k,
38
+ v
39
+ ]), N = f?.list_pagination === "cursor", { data: V, isLoading: H } = u(p, {
40
40
  page: 1,
41
41
  per_page: 200,
42
- sort: b || void 0,
42
+ sort: v || void 0,
43
43
  search: ie || void 0,
44
- filters: x,
44
+ filters: y,
45
45
  select: j.selectFields,
46
46
  expand: j.expandFields,
47
47
  preview: !0,
48
- screen: d?.fixed_filters ? r : void 0
49
- }, !N), U = E(g, {
50
- sort: b || void 0,
48
+ screen: d?.fixed_filters ? t : void 0
49
+ }, !N), U = M(p, {
50
+ sort: v || void 0,
51
51
  search: ie || void 0,
52
- filters: x,
52
+ filters: y,
53
53
  select: j.selectFields,
54
54
  expand: j.expandFields,
55
55
  preview: !0,
56
- screen: d?.fixed_filters ? r : void 0,
56
+ screen: d?.fixed_filters ? t : void 0,
57
57
  limit: 200
58
58
  }, N), W = N ? U.rows : V?.data ?? [], K = N ? U.refs : V?.$refs, q = N ? U.isLoading : H, de = I(() => f?.fields.names().find((e) => f.fields.get(e)?.primary) ?? "id", [f]), fe = P((e, t) => {
59
- s((t) => {
59
+ r((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]), pe = P((e) => {
64
- s((t) => {
63
+ }, [r]), pe = P((e) => {
64
+ r((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]), me = P((e, t) => {
69
- s((n) => {
68
+ }, [r]), me = P((e, t) => {
69
+ r((n) => {
70
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;
71
+ return a = t && t !== "__all__" ? [...A(i, e), E(e, t)] : A(i, e), se(a, r), r;
72
72
  }, { replace: !0 });
73
- }, [s]), J = (d?.list_resizable ?? !1) && C === "split" && l.category !== "phone" && !l.touch, Y = L(null), [X, Z] = ce(null), Q = L(!1), $ = d?.list_width;
73
+ }, [r]), J = (d?.list_resizable ?? !1) && S === "split" && o.category !== "phone" && !o.touch, Y = L(null), [X, Z] = ce(null), Q = L(!1), $ = d?.list_width;
74
74
  F(() => {
75
75
  !J || !$?.endsWith("%") || Z(null);
76
76
  }, [
77
77
  J,
78
78
  $,
79
- l.width,
80
- l.height
79
+ o.width,
80
+ o.height
81
81
  ]), F(() => {
82
82
  if (!J || X !== null) return;
83
83
  let e = Y.current;
@@ -106,14 +106,14 @@ function V({ screenCode: r }) {
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 (!c || !d || !f) return null;
110
- let _e = x?.length ?? 0, ve = C === "split" || C === "stacked" || !_, ye = C === "split" || C === "stacked" || !!_, be = C !== "split" && _ ? () => fe(null, { replace: !0 }) : void 0, xe = C === "split" ? J && X !== null ? X : d.list_width ?? "320px" : "100%";
109
+ if (!a || !d || !f) return null;
110
+ let _e = y?.length ?? 0, ve = S === "split" || S === "stacked" || !g, ye = S === "split" || S === "stacked" || !!g, be = S !== "split" && g ? () => fe(null, { replace: !0 }) : void 0, xe = S === "split" ? J && X !== null ? X : d.list_width ?? "320px" : "100%";
111
111
  return /* @__PURE__ */ B("div", {
112
112
  ref: Y,
113
- "data-record-list-presentation": C,
113
+ "data-record-list-presentation": S,
114
114
  style: {
115
115
  display: "flex",
116
- flexDirection: C === "stacked" ? "column" : "row",
116
+ flexDirection: S === "stacked" ? "column" : "row",
117
117
  height: "100%",
118
118
  minWidth: 0,
119
119
  overflow: "hidden"
@@ -122,15 +122,15 @@ function V({ screenCode: r }) {
122
122
  ve && /* @__PURE__ */ B("div", {
123
123
  "data-testid": "record-list-panel",
124
124
  style: {
125
- flex: C === "split" ? "none" : "1 1 auto",
125
+ flex: S === "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",
130
- borderBottom: C === "stacked" ? "1px solid var(--divider)" : "none",
129
+ borderRight: S === "split" && !J ? "1px solid var(--divider)" : "none",
130
+ borderBottom: S === "stacked" ? "1px solid var(--divider)" : "none",
131
131
  width: xe,
132
132
  minWidth: 0,
133
- height: C === "stacked" ? "50%" : "100%"
133
+ height: S === "stacked" ? "50%" : "100%"
134
134
  },
135
135
  children: [/* @__PURE__ */ B("div", {
136
136
  style: {
@@ -141,29 +141,29 @@ function V({ screenCode: r }) {
141
141
  borderBottom: "1px solid var(--divider)"
142
142
  },
143
143
  children: [
144
- te.hasOriginBack && /* @__PURE__ */ B("div", {
144
+ m.hasOriginBack && /* @__PURE__ */ B("div", {
145
145
  style: {
146
146
  display: "flex",
147
147
  alignItems: "center",
148
148
  gap: 8
149
149
  },
150
- children: [/* @__PURE__ */ z(n, {
150
+ children: [/* @__PURE__ */ z(ne, {
151
151
  icon: /* @__PURE__ */ z(e.back, { size: 14 }),
152
152
  title: "Back",
153
- onClick: te.goBack
153
+ onClick: m.goBack
154
154
  }), /* @__PURE__ */ z("span", {
155
155
  style: {
156
156
  fontSize: 12.5,
157
157
  fontWeight: 600,
158
158
  color: "var(--text)"
159
159
  },
160
- children: h(d.display?.name) || h(f.display.name_plural)
160
+ children: c(d.display?.name) || c(f.display.name_plural)
161
161
  })]
162
162
  }),
163
- /* @__PURE__ */ z(p, {
164
- value: v,
163
+ /* @__PURE__ */ z(h, {
164
+ value: _,
165
165
  onChange: pe,
166
- placeholder: `Search ${h(f.display.name_plural)}…`,
166
+ placeholder: `Search ${c(f.display.name_plural)}…`,
167
167
  prefix: /* @__PURE__ */ z(e.search, { size: 13 })
168
168
  }),
169
169
  d.filters && d.filters.length > 0 && /* @__PURE__ */ z("div", {
@@ -175,17 +175,17 @@ function V({ screenCode: r }) {
175
175
  children: d.filters.map((e) => {
176
176
  let t = f.fields.get(e);
177
177
  if (!t?.values) return null;
178
- let n = x?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r = m(t, e, c.entities);
178
+ let n = y?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r = s(t, e, a.entities);
179
179
  return /* @__PURE__ */ z("div", {
180
180
  style: { minWidth: 120 },
181
- children: /* @__PURE__ */ z(o, {
181
+ children: /* @__PURE__ */ z(l, {
182
182
  value: n,
183
183
  options: [{
184
184
  value: "__all__",
185
185
  label: `All ${r}`
186
186
  }, ...t.values.map((e) => ({
187
187
  value: e.code,
188
- label: h(e.name) || e.code
188
+ label: c(e.name) || e.code
189
189
  }))],
190
190
  onChange: (t) => me(e, t),
191
191
  placeholder: r
@@ -201,8 +201,8 @@ function V({ screenCode: r }) {
201
201
  fontSize: 11,
202
202
  color: "var(--text-3)"
203
203
  },
204
- children: [/* @__PURE__ */ z("span", { children: q ? "Loading…" : `${W.length} ${h(f.display.name_plural)}` }), _e > 0 && /* @__PURE__ */ z("button", {
205
- onClick: () => s((e) => {
204
+ children: [/* @__PURE__ */ z("span", { children: q ? "Loading…" : `${W.length} ${c(f.display.name_plural)}` }), _e > 0 && /* @__PURE__ */ z("button", {
205
+ onClick: () => r((e) => {
206
206
  let t = new URLSearchParams(e);
207
207
  return t.delete("filters"), t;
208
208
  }, { replace: !0 }),
@@ -223,10 +223,10 @@ function V({ screenCode: r }) {
223
223
  style: {
224
224
  flex: 1,
225
225
  overflowY: "auto",
226
- padding: w === "cards" ? 10 : 0,
227
- display: w === "cards" ? "flex" : "block",
226
+ padding: C === "cards" ? 10 : 0,
227
+ display: C === "cards" ? "flex" : "block",
228
228
  flexDirection: "column",
229
- gap: w === "cards" ? 10 : void 0
229
+ gap: C === "cards" ? 10 : void 0
230
230
  },
231
231
  children: q ? /* @__PURE__ */ z("div", {
232
232
  style: {
@@ -249,16 +249,16 @@ function V({ screenCode: r }) {
249
249
  },
250
250
  children: "No records found"
251
251
  }) : /* @__PURE__ */ B(R, { children: [W.map((e) => {
252
- let t = u(e[de]);
252
+ let t = i(e[de]);
253
253
  return /* @__PURE__ */ z(ue, {
254
254
  record: e,
255
255
  entity: f,
256
- columns: S,
257
- card: A,
258
- presentation: w,
256
+ columns: b,
257
+ card: k,
258
+ presentation: C,
259
259
  refs: K,
260
- isSelected: t === _,
261
- onClick: () => fe(t, { replace: C === "split" })
260
+ isSelected: t === g,
261
+ onClick: () => fe(t, { replace: S === "split" })
262
262
  }, t);
263
263
  }), N && U.hasMore && /* @__PURE__ */ z("button", {
264
264
  type: "button",
@@ -298,17 +298,17 @@ function V({ screenCode: r }) {
298
298
  flex: 1,
299
299
  minWidth: 0,
300
300
  overflow: "hidden",
301
- height: C === "stacked" ? "50%" : "100%"
301
+ height: S === "stacked" ? "50%" : "100%"
302
302
  },
303
- children: _ ? /* @__PURE__ */ z(G, {
304
- entityCode: g,
305
- recordId: _,
303
+ children: g ? /* @__PURE__ */ z(G, {
304
+ entityCode: p,
305
+ recordId: g,
306
306
  items: d.items,
307
- schema: c,
307
+ schema: a,
308
308
  entity: f,
309
309
  onBackToList: be,
310
- relatedRecordsPresentation: ae
311
- }, _) : /* @__PURE__ */ z("div", {
310
+ relatedRecordsPresentation: oe
311
+ }, g) : /* @__PURE__ */ z("div", {
312
312
  style: {
313
313
  display: "flex",
314
314
  alignItems: "center",
@@ -320,7 +320,7 @@ function V({ screenCode: r }) {
320
320
  style: { fontSize: 12.5 },
321
321
  children: [
322
322
  "Select a ",
323
- h(f.display.name),
323
+ c(f.display.name),
324
324
  " to view details"
325
325
  ]
326
326
  })
@@ -329,58 +329,58 @@ function V({ screenCode: r }) {
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 = f();
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));
332
+ function ue({ record: e, entity: n, columns: r, card: i, presentation: a, refs: o, isSelected: s, onClick: c }) {
333
+ let l = t();
334
+ if (a === "cards") {
335
+ let t = i.badgeFields.filter((t) => H(n, e, t)), r = i.bodyFields.filter((t) => H(n, e, t)), a = i.metaFields.filter((t) => H(n, e, t));
336
336
  return /* @__PURE__ */ B("button", {
337
337
  type: "button",
338
338
  "data-testid": "record-list-card",
339
- "aria-current": o ? "true" : void 0,
340
- onClick: s,
339
+ "aria-current": s ? "true" : void 0,
340
+ onClick: c,
341
341
  style: {
342
342
  width: "100%",
343
343
  textAlign: "left",
344
344
  padding: 12,
345
345
  border: "1px solid var(--border)",
346
346
  borderRadius: 8,
347
- background: o ? "var(--row-selected-bg)" : "var(--surface)",
347
+ background: s ? "var(--row-selected-bg)" : "var(--surface)",
348
348
  color: "var(--text)",
349
349
  cursor: "pointer",
350
350
  display: "flex",
351
351
  flexDirection: "column",
352
352
  gap: 8,
353
- boxShadow: o ? "inset 3px 0 0 var(--accent)" : "none"
353
+ boxShadow: s ? "inset 3px 0 0 var(--accent)" : "none"
354
354
  },
355
355
  children: [
356
356
  /* @__PURE__ */ z(U, {
357
- entity: t,
357
+ entity: n,
358
358
  record: e,
359
- field: r.titleField,
360
- refs: a
359
+ field: i.titleField,
360
+ refs: o
361
361
  }),
362
- r.subtitleField && /* @__PURE__ */ z("div", {
362
+ i.subtitleField && /* @__PURE__ */ z("div", {
363
363
  style: {
364
364
  fontSize: 12,
365
365
  color: "var(--text-3)",
366
366
  overflowWrap: "anywhere"
367
367
  },
368
- children: S({
369
- entity: t,
370
- fieldName: r.subtitleField,
368
+ children: C({
369
+ entity: n,
370
+ fieldName: i.subtitleField,
371
371
  record: e,
372
372
  mode: "display",
373
- refs: a,
374
- locale: c
373
+ refs: o,
374
+ locale: l
375
375
  })
376
376
  }),
377
- n.length > 0 && /* @__PURE__ */ z("div", {
377
+ t.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__ */ z("span", {
383
+ children: t.map((t) => /* @__PURE__ */ z("span", {
384
384
  style: {
385
385
  border: "1px solid var(--border)",
386
386
  borderRadius: 999,
@@ -390,32 +390,32 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
390
390
  maxWidth: "100%",
391
391
  overflowWrap: "anywhere"
392
392
  },
393
- children: S({
394
- entity: t,
395
- fieldName: n,
393
+ children: C({
394
+ entity: n,
395
+ fieldName: t,
396
396
  record: e,
397
397
  mode: "display",
398
- refs: a,
399
- locale: c
398
+ refs: o,
399
+ locale: l
400
400
  })
401
- }, n))
401
+ }, t))
402
402
  }),
403
- i.length > 0 && /* @__PURE__ */ z("dl", {
403
+ r.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__ */ z(W, {
411
- entity: t,
410
+ children: r.map((t) => /* @__PURE__ */ z(W, {
411
+ entity: n,
412
412
  record: e,
413
- fieldName: n,
414
- refs: a,
415
- locale: c
416
- }, n))
413
+ fieldName: t,
414
+ refs: o,
415
+ locale: l
416
+ }, t))
417
417
  }),
418
- l.length > 0 && /* @__PURE__ */ z("div", {
418
+ a.length > 0 && /* @__PURE__ */ z("div", {
419
419
  style: {
420
420
  display: "flex",
421
421
  flexWrap: "wrap",
@@ -423,34 +423,34 @@ 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: a.map((t) => /* @__PURE__ */ z("span", {
427
427
  style: {
428
428
  minWidth: 0,
429
429
  overflowWrap: "anywhere"
430
430
  },
431
- children: S({
432
- entity: t,
433
- fieldName: n,
431
+ children: C({
432
+ entity: n,
433
+ fieldName: t,
434
434
  record: e,
435
435
  mode: "display",
436
- refs: a,
437
- locale: c
436
+ refs: o,
437
+ locale: l
438
438
  })
439
- }, n))
439
+ }, t))
440
440
  })
441
441
  ]
442
442
  });
443
443
  }
444
- let l = n[0], u = n[1], d = n.slice(2, 4);
444
+ let u = r[0], d = r[1], f = r.slice(2, 4);
445
445
  return /* @__PURE__ */ B("button", {
446
- onClick: s,
446
+ onClick: c,
447
447
  style: {
448
448
  width: "100%",
449
449
  textAlign: "left",
450
450
  padding: "10px 12px",
451
451
  borderBottom: "1px solid var(--divider)",
452
- background: o ? "var(--row-selected-bg)" : "transparent",
453
- borderLeft: o ? "2px solid var(--accent)" : "2px solid transparent",
452
+ background: s ? "var(--row-selected-bg)" : "transparent",
453
+ borderLeft: s ? "2px solid var(--accent)" : "2px solid transparent",
454
454
  cursor: "pointer",
455
455
  transition: "background-color .12s",
456
456
  display: "flex",
@@ -460,12 +460,12 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
460
460
  borderBottomColor: "var(--divider)"
461
461
  },
462
462
  onMouseEnter: (e) => {
463
- o || (e.currentTarget.style.background = "var(--surface-3)");
463
+ s || (e.currentTarget.style.background = "var(--surface-3)");
464
464
  },
465
465
  onMouseLeave: (e) => {
466
- o || (e.currentTarget.style.background = "transparent");
466
+ s || (e.currentTarget.style.background = "transparent");
467
467
  },
468
- children: [l && /* @__PURE__ */ z("div", {
468
+ children: [u && /* @__PURE__ */ z("div", {
469
469
  style: {
470
470
  fontSize: 12.5,
471
471
  fontWeight: 500,
@@ -474,13 +474,13 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
474
474
  whiteSpace: "nowrap",
475
475
  color: "var(--text)"
476
476
  },
477
- children: S({
478
- entity: t,
479
- fieldName: l,
477
+ children: C({
478
+ entity: n,
479
+ fieldName: u,
480
480
  record: e,
481
481
  mode: "display",
482
- refs: a,
483
- locale: c
482
+ refs: o,
483
+ locale: l
484
484
  })
485
485
  }), /* @__PURE__ */ B("div", {
486
486
  style: {
@@ -488,7 +488,7 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
488
488
  alignItems: "center",
489
489
  gap: 6
490
490
  },
491
- children: [u && /* @__PURE__ */ z("div", {
491
+ children: [d && /* @__PURE__ */ z("div", {
492
492
  style: {
493
493
  fontSize: 11,
494
494
  color: "var(--text-3)",
@@ -497,13 +497,13 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
497
497
  textOverflow: "ellipsis",
498
498
  whiteSpace: "nowrap"
499
499
  },
500
- children: S({
501
- entity: t,
502
- fieldName: u,
500
+ children: C({
501
+ entity: n,
502
+ fieldName: d,
503
503
  record: e,
504
504
  mode: "display",
505
- refs: a,
506
- locale: c
505
+ refs: o,
506
+ locale: l
507
507
  })
508
508
  }), /* @__PURE__ */ z("div", {
509
509
  style: {
@@ -512,27 +512,27 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
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: f.map((t) => _(n, e, t) == null ? null : /* @__PURE__ */ z("div", {
516
516
  style: { fontSize: 11 },
517
- children: S({
518
- entity: t,
519
- fieldName: n,
517
+ children: C({
518
+ entity: n,
519
+ fieldName: t,
520
520
  record: e,
521
521
  mode: "display",
522
- refs: a,
523
- locale: c
522
+ refs: o,
523
+ locale: l
524
524
  })
525
- }, n))
525
+ }, t))
526
526
  })]
527
527
  })]
528
528
  });
529
529
  }
530
530
  function H(e, t, n) {
531
- let r = v(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 = f(), a = d(t, e);
534
+ function U({ entity: e, record: r, field: i, refs: a }) {
535
+ let o = t(), s = n(r, e);
536
536
  return /* @__PURE__ */ z("div", {
537
537
  style: {
538
538
  fontSize: 13.5,
@@ -540,18 +540,18 @@ function U({ entity: e, record: t, field: n, refs: r }) {
540
540
  color: "var(--text)",
541
541
  overflowWrap: "anywhere"
542
542
  },
543
- children: (n ? S({
543
+ children: (i ? C({
544
544
  entity: e,
545
- fieldName: n,
546
- record: t,
545
+ fieldName: i,
546
+ record: r,
547
547
  mode: "display",
548
- refs: r,
549
- locale: i
550
- }) : a) || h(e.display.name)
548
+ refs: a,
549
+ locale: o
550
+ }) : s) || c(e.display.name)
551
551
  });
552
552
  }
553
553
  function W({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
554
- let a = v(e, t, n);
554
+ let a = _(e, t, n);
555
555
  if (a == null || a === "") return null;
556
556
  let o = e.fields.get(n);
557
557
  return o ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("dt", {
@@ -561,7 +561,7 @@ function W({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
561
561
  minWidth: 0,
562
562
  overflowWrap: "anywhere"
563
563
  },
564
- children: m(o, n)
564
+ children: s(o, n)
565
565
  }), /* @__PURE__ */ z("dd", {
566
566
  style: {
567
567
  margin: 0,
@@ -570,7 +570,7 @@ function W({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
570
570
  minWidth: 0,
571
571
  overflowWrap: "anywhere"
572
572
  },
573
- children: S({
573
+ children: C({
574
574
  entity: e,
575
575
  fieldName: n,
576
576
  record: t,
@@ -580,100 +580,100 @@ 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(g, { children: /* @__PURE__ */ z(K, {
583
+ function G({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList: o, relatedRecordsPresentation: s }) {
584
+ return /* @__PURE__ */ z(a, { children: /* @__PURE__ */ z(K, {
585
585
  entityCode: e,
586
586
  recordId: t,
587
587
  items: n,
588
588
  schema: r,
589
589
  entity: i,
590
- onBackToList: a,
591
- relatedRecordsPresentation: o
590
+ onBackToList: o,
591
+ relatedRecordsPresentation: s
592
592
  }) });
593
593
  }
594
- function K({ entityCode: t, recordId: i, items: o, schema: ee, entity: f, onBackToList: p, relatedRecordsPresentation: m }) {
595
- let g = c(f, "update"), { data: ne, isLoading: re } = _(t, I(() => i ? te(f, i) : void 0, [i, f])), y = C(t), S = l(), [T, E] = ce(!1), [D, O] = ce({}), k = ne?.data, oe = k?.$statuses, se = k?.$properties, M = j(t, i), F = A(t, i), L = I(() => {
594
+ function K({ entityCode: t, recordId: a, items: s, schema: l, entity: u, onBackToList: ee, relatedRecordsPresentation: te }) {
595
+ let h = f(u, "update"), { data: re, isLoading: ae } = b(t, I(() => a ? o(u, a) : void 0, [a, u])), x = S(t), C = r(), [w, T] = ce(!1), [E, D] = ce({}), O = re?.data, se = O?.$statuses, A = O?.$properties, M = j(t, a), F = k(t, a), L = I(() => {
596
596
  let e = /* @__PURE__ */ new Set();
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);
597
+ for (let [t, n] of u.fields) !n.auto && !n.primary && e.add(t);
598
+ for (let [t] of u.files ?? []) e.add(t);
599
599
  return e;
600
- }, [f]), le = P(() => {
601
- if (k) {
600
+ }, [u]), le = P(() => {
601
+ if (O) {
602
602
  let e = {};
603
603
  L.forEach((t) => {
604
- let n = v(f, k, t);
605
- e[t] = b(f, t) ? n ?? null : n ?? "";
606
- }), O(e);
604
+ let n = _(u, O, t);
605
+ e[t] = g(u, t) ? n ?? null : n ?? "";
606
+ }), D(e);
607
607
  }
608
- E(!0);
608
+ T(!0);
609
609
  }, [
610
- k,
610
+ O,
611
611
  L,
612
- f
612
+ u
613
613
  ]), V = P(async () => {
614
- await S.flushAllDrafts(), E(!1), O({});
615
- }, [S]), ue = P(() => {
616
- let e = {}, t = x({
617
- entity: f,
618
- formData: D,
619
- record: k,
614
+ await C.flushAllDrafts(), T(!1), D({});
615
+ }, [C]), ue = P(() => {
616
+ let e = {}, t = ie({
617
+ entity: u,
618
+ formData: E,
619
+ record: O,
620
620
  isNew: !1
621
- }), n = w(t);
622
- for (let [t, n] of Object.entries(D)) f.files?.has(t) || (e[t] = ie(f, t, n));
621
+ }), n = v(t);
622
+ for (let [t, n] of Object.entries(E)) u.files?.has(t) || (e[t] = y(u, t, n));
623
623
  if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0) {
624
- E(!1), O({});
624
+ T(!1), D({});
625
625
  return;
626
626
  }
627
- y.mutate({
628
- pkValues: i,
627
+ x.mutate({
628
+ pkValues: a,
629
629
  data: e
630
630
  }, {
631
631
  onSuccess: () => {
632
- n.forEach((e) => S.markCommitted(e)), E(!1), O({}), s.success("Saved");
632
+ n.forEach((e) => C.markCommitted(e)), T(!1), D({}), m.success("Saved");
633
633
  },
634
- onError: () => s.error("Failed to save")
634
+ onError: () => m.error("Failed to save")
635
635
  });
636
636
  }, [
637
- S,
638
- y,
639
- i,
640
- f,
641
- D,
642
- k
637
+ C,
638
+ x,
639
+ a,
640
+ u,
641
+ E,
642
+ O
643
643
  ]), H = P((e, t) => {
644
- O((n) => ({
644
+ D((n) => ({
645
645
  ...n,
646
646
  [e]: t
647
647
  }));
648
648
  }, []);
649
- if (re) return /* @__PURE__ */ z(ae, {});
650
- if (!k) return null;
651
- let U = d(k, f), W = f.display?.display_field, G = U ? void 0 : W ? k[W] : k[f.fields.names()[0]], K = U || (G != null && typeof G != "object" ? u(G) : h(f.display.name)), q = k?.$refs, de = {
652
- schema: ee,
653
- entity: f,
649
+ if (ae) return /* @__PURE__ */ z(oe, {});
650
+ if (!O) return null;
651
+ let U = n(O, u), W = u.display?.display_field, G = U ? void 0 : W ? O[W] : O[u.fields.names()[0]], K = U || (G != null && typeof G != "object" ? i(G) : c(u.display.name)), q = O?.$refs, de = {
652
+ schema: l,
653
+ entity: u,
654
654
  entityCode: t,
655
- recordId: i,
656
- record: T ? {
657
- ...k,
658
- ...D
659
- } : k,
655
+ recordId: a,
656
+ record: w ? {
657
+ ...O,
658
+ ...E
659
+ } : O,
660
660
  isNew: !1,
661
- mode: T ? "edit" : "display",
662
- onFieldChange: T ? H : void 0,
661
+ mode: w ? "edit" : "display",
662
+ onFieldChange: w ? H : void 0,
663
663
  refs: q,
664
- objectProperties: se ?? void 0,
665
- onSetProperty: g ? (e, t) => F.mutate({
664
+ objectProperties: A ?? void 0,
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
- objectStatuses: oe ?? void 0,
671
- onSetStatus: g ? (e, t) => M.mutate({
670
+ objectStatuses: se ?? void 0,
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: m
676
+ relatedRecordsPresentation: te
677
677
  };
678
678
  return /* @__PURE__ */ B("div", {
679
679
  style: {
@@ -710,23 +710,23 @@ function K({ entityCode: t, recordId: i, items: o, schema: ee, entity: f, onBack
710
710
  alignItems: "center",
711
711
  gap: 6
712
712
  },
713
- children: [p && /* @__PURE__ */ z(n, {
713
+ children: [ee && /* @__PURE__ */ z(ne, {
714
714
  icon: /* @__PURE__ */ z(e.back, { size: 14 }),
715
715
  title: "Back to list",
716
- onClick: p
717
- }), g && (T ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(r, {
716
+ onClick: ee
717
+ }), h && (w ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(p, {
718
718
  size: "xs",
719
719
  icon: /* @__PURE__ */ z(e.x, { size: 12 }),
720
720
  onClick: V,
721
721
  children: "Cancel"
722
- }), /* @__PURE__ */ z(r, {
722
+ }), /* @__PURE__ */ z(p, {
723
723
  kind: "primary",
724
724
  size: "xs",
725
- icon: y.isPending ? /* @__PURE__ */ z(a, { size: 12 }) : /* @__PURE__ */ z(e.save, { size: 12 }),
725
+ icon: x.isPending ? /* @__PURE__ */ z(d, { size: 12 }) : /* @__PURE__ */ z(e.save, { size: 12 }),
726
726
  onClick: ue,
727
- disabled: y.isPending,
728
- children: y.isPending ? "Saving…" : "Save"
729
- })] }) : /* @__PURE__ */ z(r, {
727
+ disabled: x.isPending,
728
+ children: x.isPending ? "Saving…" : "Save"
729
+ })] }) : /* @__PURE__ */ z(p, {
730
730
  size: "xs",
731
731
  icon: /* @__PURE__ */ z(e.edit, { size: 12 }),
732
732
  onClick: le,
@@ -742,8 +742,8 @@ function K({ entityCode: t, recordId: i, items: o, schema: ee, entity: f, onBack
742
742
  flexDirection: "column",
743
743
  gap: 12
744
744
  },
745
- children: o && o.length > 0 ? /* @__PURE__ */ z(N, {
746
- nodes: o,
745
+ children: s && s.length > 0 ? /* @__PURE__ */ z(N, {
746
+ nodes: s,
747
747
  ctx: de
748
748
  }) : /* @__PURE__ */ B("p", {
749
749
  style: {