@declarion/react 0.44.0 → 0.45.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.
@@ -1,84 +1,84 @@
1
1
  import { s as e } from "./DynamicIcon-DeRpAaXm.js";
2
- import { A as t, At as n, F as r, Gn as i, In as a, Jn as o, N as s, Nn as c, Sn as l, X as u, Xn as d, cr as ee, lr as f, nr as te, q as p, rt as m, wn as h, xn as g, yn as _ } from "./useCurrentScreen-CpQjVmrT.js";
3
- import { G as v, K as y, U as ne, W as b, Y as x, _ as re, a as S, c as C, k as w, q as T, s as E, w as ie } from "./registry-r4hiflwC.js";
4
- import { _ as D, c as O, f as k, h as A, m as ae, n as j, p as M, r as N, x as P } from "./useProperties-CULxrNT4.js";
5
- import { t as F } from "./LayoutRenderer-DX8pFS5A.js";
6
- import { useCallback as I, useEffect as L, useMemo as R, useRef as z, useState as oe } from "react";
7
- import { useSearchParams as se } from "react-router";
8
- import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
2
+ import { A as t, At as n, Cn as r, F as i, Kn as a, Ln as o, N as s, Pn as c, Sn as l, Tn as u, X as d, Yn as f, Zn as p, bn as m, lr as ee, q as h, rr as te, rt as g, ur as _ } from "./useCurrentScreen-A3xZDs7U.js";
3
+ import { G as v, K as y, U as b, W as x, Y as S, _ as ne, a as C, c as w, k as T, q as E, s as D, w as re } from "./registry-DJKp0yaV.js";
4
+ import { _ as O, c as k, f as A, h as j, m as ie, n as M, p as N, r as P, x as F } from "./useProperties-TlltWwLv.js";
5
+ import { t as I } from "./LayoutRenderer-BReuhVdX.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";
8
+ import { Fragment as se, jsx as V, jsxs as H } from "react/jsx-runtime";
9
9
  //#region src/components/pages/SmartRecordListPage.impl.tsx
10
10
  function U({ screenCode: t }) {
11
- let [r, s] = se(), { data: c } = n(), l = te(), d = c?.screens[t], f = d?.entity ? c?.entities[d.entity] : void 0, m = d?.entity;
12
- A(d, f, r.toString()), D(d?.route);
13
- let _ = re(), v = r.get("selected") ?? null, y = r.get("search") ?? "", ne = p(y, 300), b = r.get("sort") ?? d?.sort_default ?? "", x = R(() => {
14
- let e = k(r);
11
+ let [r, i] = oe(), { data: s } = n(), c = te(), p = s?.screens[t], m = p?.entity ? s?.entities[p.entity] : void 0, g = p?.entity;
12
+ j(p, m, r.toString()), O(p?.route);
13
+ let _ = ne(), v = r.get("selected") ?? null, y = r.get("search") ?? "", b = h(y, 300), x = r.get("sort") ?? p?.sort_default ?? "", S = z(() => {
14
+ let e = A(r);
15
15
  return e.length > 0 ? e : void 0;
16
- }, [r]), S = R(() => d?.columns ?? f?.fields.names().filter((e) => !f.fields.get(e)?.primary && !f.fields.get(e)?.auto && f.fields.get(e)?.display?.is_listable !== !1).slice(0, 4) ?? [], [d?.columns, f]), w = R(() => {
17
- let e = d?.responsive?.[l.category]?.presentation;
18
- return l.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
19
- }, [d?.responsive, l.category]), T = R(() => {
20
- let e = d?.responsive?.[l.category];
21
- return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation : l.category === "phone" ? "cards" : "table";
22
- }, [d?.responsive, l.category]), ie = d?.responsive?.[l.category]?.layout?.related_records, j = R(() => E({
23
- entity: f,
24
- screen: d
25
- }), [f, d]), N = R(() => C({
26
- entity: f,
27
- screen: d,
28
- presentation: T,
29
- visibleColumns: S,
30
- card: j,
31
- sort: b
16
+ }, [r]), C = z(() => p?.columns ?? m?.fields.names().filter((e) => !m.fields.get(e)?.primary && !m.fields.get(e)?.auto && m.fields.get(e)?.display?.is_listable !== !1).slice(0, 4) ?? [], [p?.columns, m]), T = z(() => {
17
+ let e = p?.responsive?.[c.category]?.presentation;
18
+ return c.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
19
+ }, [p?.responsive, c.category]), E = z(() => {
20
+ let e = p?.responsive?.[c.category];
21
+ return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation : c.category === "phone" ? "cards" : "table";
22
+ }, [p?.responsive, c.category]), re = p?.responsive?.[c.category]?.layout?.related_records, M = z(() => D({
23
+ entity: m,
24
+ screen: p
25
+ }), [m, p]), P = z(() => w({
26
+ entity: m,
27
+ screen: p,
28
+ presentation: E,
29
+ visibleColumns: C,
30
+ card: M,
31
+ sort: x
32
32
  }), [
33
- f,
34
- d,
35
- T,
36
- S,
37
- j,
38
- b
39
- ]), F = f?.list_pagination === "cursor", { data: U, isLoading: W } = u(m, {
33
+ m,
34
+ p,
35
+ E,
36
+ C,
37
+ M,
38
+ x
39
+ ]), I = m?.list_pagination === "cursor", { data: U, isLoading: W } = d(g, {
40
40
  page: 1,
41
41
  per_page: 200,
42
- sort: b || void 0,
43
- search: ne || void 0,
44
- filters: x,
45
- select: N.selectFields,
46
- expand: N.expandFields,
42
+ sort: x || void 0,
43
+ search: b || void 0,
44
+ filters: S,
45
+ select: P.selectFields,
46
+ expand: P.expandFields,
47
47
  preview: !0,
48
- screen: d?.fixed_filters ? t : void 0
49
- }, !F), G = P(m, {
50
- sort: b || void 0,
51
- search: ne || void 0,
52
- filters: x,
53
- select: N.selectFields,
54
- expand: N.expandFields,
48
+ screen: p?.fixed_filters ? t : void 0
49
+ }, !I), G = F(g, {
50
+ sort: x || void 0,
51
+ search: b || void 0,
52
+ filters: S,
53
+ select: P.selectFields,
54
+ expand: P.expandFields,
55
55
  preview: !0,
56
- screen: d?.fixed_filters ? t : void 0,
56
+ screen: p?.fixed_filters ? t : void 0,
57
57
  limit: 200
58
- }, F), K = F ? G.rows : U?.data ?? [], J = F ? G.refs : U?.$refs, le = F ? G.isLoading : W, ue = R(() => f?.fields.names().find((e) => f.fields.get(e)?.primary) ?? "id", [f]), de = I((e, t) => {
59
- s((t) => {
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) => {
59
+ i((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 = I((e) => {
64
- s((t) => {
63
+ }, [i]), fe = L((e) => {
64
+ i((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 = I((e, t) => {
69
- s((n) => {
70
- let r = new URLSearchParams(n), i = k(n), a;
71
- return a = t && t !== "__all__" ? [...M(i, e), O(e, t)] : M(i, e), ae(a, r), r;
68
+ }, [i]), pe = L((e, t) => {
69
+ i((n) => {
70
+ let r = new URLSearchParams(n), i = A(n), a;
71
+ return a = t && t !== "__all__" ? [...N(i, e), k(e, t)] : N(i, e), ie(a, r), r;
72
72
  }, { replace: !0 });
73
- }, [s]), Y = (d?.list_resizable ?? !1) && w === "split" && l.category !== "phone" && !l.touch, me = z(null), [X, Z] = oe(null), Q = z(!1), $ = d?.list_width;
74
- L(() => {
73
+ }, [i]), Y = (p?.list_resizable ?? !1) && T === "split" && c.category !== "phone" && !c.touch, me = B(null), [X, Z] = ae(null), Q = B(!1), $ = p?.list_width;
74
+ R(() => {
75
75
  !Y || !$?.endsWith("%") || Z(null);
76
76
  }, [
77
77
  Y,
78
78
  $,
79
- l.width,
80
- l.height
81
- ]), L(() => {
79
+ c.width,
80
+ c.height
81
+ ]), R(() => {
82
82
  if (!Y || X !== null) return;
83
83
  let e = me.current;
84
84
  if (e) if ($ && $.endsWith("%")) {
@@ -89,13 +89,13 @@ function U({ screenCode: t }) {
89
89
  Y,
90
90
  $,
91
91
  X,
92
- f
92
+ m
93
93
  ]);
94
- let he = z(null);
95
- L(() => () => {
94
+ let he = B(null);
95
+ R(() => () => {
96
96
  he.current?.();
97
97
  }, []);
98
- let ge = I((e) => {
98
+ let ge = L((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;
@@ -106,14 +106,14 @@ function U({ screenCode: t }) {
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 = w === "split" || w === "stacked" || !v, ye = w === "split" || w === "stacked" || !!v, be = w !== "split" && v ? () => de(null, { replace: !0 }) : void 0, xe = w === "split" ? Y && X !== null ? X : d.list_width ?? "320px" : "100%";
109
+ if (!s || !p || !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 : p.list_width ?? "320px" : "100%";
111
111
  return /* @__PURE__ */ H("div", {
112
112
  ref: me,
113
- "data-record-list-presentation": w,
113
+ "data-record-list-presentation": T,
114
114
  style: {
115
115
  display: "flex",
116
- flexDirection: w === "stacked" ? "column" : "row",
116
+ flexDirection: T === "stacked" ? "column" : "row",
117
117
  height: "100%",
118
118
  minWidth: 0,
119
119
  overflow: "hidden"
@@ -122,15 +122,15 @@ function U({ screenCode: t }) {
122
122
  ve && /* @__PURE__ */ H("div", {
123
123
  "data-testid": "record-list-panel",
124
124
  style: {
125
- flex: w === "split" ? "none" : "1 1 auto",
125
+ flex: T === "split" ? "none" : "1 1 auto",
126
126
  display: "flex",
127
127
  flexDirection: "column",
128
128
  overflow: "hidden",
129
- borderRight: w === "split" && !Y ? "1px solid var(--divider)" : "none",
130
- borderBottom: w === "stacked" ? "1px solid var(--divider)" : "none",
129
+ borderRight: T === "split" && !Y ? "1px solid var(--divider)" : "none",
130
+ borderBottom: T === "stacked" ? "1px solid var(--divider)" : "none",
131
131
  width: xe,
132
132
  minWidth: 0,
133
- height: w === "stacked" ? "50%" : "100%"
133
+ height: T === "stacked" ? "50%" : "100%"
134
134
  },
135
135
  children: [/* @__PURE__ */ H("div", {
136
136
  style: {
@@ -157,35 +157,35 @@ function U({ screenCode: t }) {
157
157
  fontWeight: 600,
158
158
  color: "var(--text)"
159
159
  },
160
- children: h(d.display?.name) || h(f.display.name_plural)
160
+ children: u(p.display?.name) || u(m.display.name_plural)
161
161
  })]
162
162
  }),
163
- /* @__PURE__ */ V(o, {
163
+ /* @__PURE__ */ V(f, {
164
164
  value: y,
165
165
  onChange: fe,
166
- placeholder: `Search ${h(f.display.name_plural)}…`,
166
+ placeholder: `Search ${u(m.display.name_plural)}…`,
167
167
  prefix: /* @__PURE__ */ V(e.search, { size: 13 })
168
168
  }),
169
- d.filters && d.filters.length > 0 && /* @__PURE__ */ V("div", {
169
+ p.filters && p.filters.length > 0 && /* @__PURE__ */ V("div", {
170
170
  style: {
171
171
  display: "flex",
172
172
  flexWrap: "wrap",
173
173
  gap: 6
174
174
  },
175
- children: d.filters.map((e) => {
176
- let t = f.fields.get(e);
175
+ children: p.filters.map((e) => {
176
+ let t = m.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 = g(t, e, c.entities);
178
+ let n = S?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r = l(t, e, s.entities);
179
179
  return /* @__PURE__ */ V("div", {
180
180
  style: { minWidth: 120 },
181
- children: /* @__PURE__ */ V(i, {
181
+ children: /* @__PURE__ */ V(a, {
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: u(e.name) || e.code
189
189
  }))],
190
190
  onChange: (t) => pe(e, t),
191
191
  placeholder: r
@@ -201,8 +201,8 @@ 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} ${h(f.display.name_plural)}` }), _e > 0 && /* @__PURE__ */ V("button", {
205
- onClick: () => s((e) => {
204
+ children: [/* @__PURE__ */ V("span", { children: le ? "Loading…" : `${K.length} ${u(m.display.name_plural)}` }), _e > 0 && /* @__PURE__ */ V("button", {
205
+ onClick: () => i((e) => {
206
206
  let t = new URLSearchParams(e);
207
207
  return t.delete("filters"), t;
208
208
  }, { replace: !0 }),
@@ -223,10 +223,10 @@ function U({ screenCode: t }) {
223
223
  style: {
224
224
  flex: 1,
225
225
  overflowY: "auto",
226
- padding: T === "cards" ? 10 : 0,
227
- display: T === "cards" ? "flex" : "block",
226
+ padding: E === "cards" ? 10 : 0,
227
+ display: E === "cards" ? "flex" : "block",
228
228
  flexDirection: "column",
229
- gap: T === "cards" ? 10 : void 0
229
+ gap: E === "cards" ? 10 : void 0
230
230
  },
231
231
  children: le ? /* @__PURE__ */ V("div", {
232
232
  style: {
@@ -248,19 +248,19 @@ function U({ screenCode: t }) {
248
248
  color: "var(--text-3)"
249
249
  },
250
250
  children: "No records found"
251
- }) : /* @__PURE__ */ H(B, { children: [K.map((e) => {
252
- let t = a(e[ue]);
251
+ }) : /* @__PURE__ */ H(se, { children: [K.map((e) => {
252
+ let t = o(e[ue]);
253
253
  return /* @__PURE__ */ V(ce, {
254
254
  record: e,
255
- entity: f,
256
- columns: S,
257
- card: j,
258
- presentation: T,
255
+ entity: m,
256
+ columns: C,
257
+ card: M,
258
+ presentation: E,
259
259
  refs: J,
260
260
  isSelected: t === v,
261
- onClick: () => de(t, { replace: w === "split" })
261
+ onClick: () => de(t, { replace: T === "split" })
262
262
  }, t);
263
- }), F && G.hasMore && /* @__PURE__ */ V("button", {
263
+ }), I && G.hasMore && /* @__PURE__ */ V("button", {
264
264
  type: "button",
265
265
  "data-testid": "record-list-load-more",
266
266
  onClick: () => void G.fetchNextPage(),
@@ -298,16 +298,16 @@ function U({ screenCode: t }) {
298
298
  flex: 1,
299
299
  minWidth: 0,
300
300
  overflow: "hidden",
301
- height: w === "stacked" ? "50%" : "100%"
301
+ height: T === "stacked" ? "50%" : "100%"
302
302
  },
303
303
  children: v ? /* @__PURE__ */ V(q, {
304
- entityCode: m,
304
+ entityCode: g,
305
305
  recordId: v,
306
- items: d.items,
307
- schema: c,
308
- entity: f,
306
+ items: p.items,
307
+ schema: s,
308
+ entity: m,
309
309
  onBackToList: be,
310
- relatedRecordsPresentation: ie
310
+ relatedRecordsPresentation: re
311
311
  }, v) : /* @__PURE__ */ V("div", {
312
312
  style: {
313
313
  display: "flex",
@@ -320,7 +320,7 @@ function U({ screenCode: t }) {
320
320
  style: { fontSize: 12.5 },
321
321
  children: [
322
322
  "Select a ",
323
- h(f.display.name),
323
+ u(m.display.name),
324
324
  " to view details"
325
325
  ]
326
326
  })
@@ -365,7 +365,7 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
365
365
  color: "var(--text-3)",
366
366
  overflowWrap: "anywhere"
367
367
  },
368
- children: T({
368
+ children: E({
369
369
  entity: n,
370
370
  fieldName: i.subtitleField,
371
371
  record: e,
@@ -390,7 +390,7 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
390
390
  maxWidth: "100%",
391
391
  overflowWrap: "anywhere"
392
392
  },
393
- children: T({
393
+ children: E({
394
394
  entity: n,
395
395
  fieldName: t,
396
396
  record: e,
@@ -428,7 +428,7 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
428
428
  minWidth: 0,
429
429
  overflowWrap: "anywhere"
430
430
  },
431
- children: T({
431
+ children: E({
432
432
  entity: n,
433
433
  fieldName: t,
434
434
  record: e,
@@ -441,7 +441,7 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
441
441
  ]
442
442
  });
443
443
  }
444
- let u = r[0], d = r[1], ee = r.slice(2, 4);
444
+ let u = r[0], d = r[1], f = r.slice(2, 4);
445
445
  return /* @__PURE__ */ H("button", {
446
446
  onClick: c,
447
447
  style: {
@@ -474,7 +474,7 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
474
474
  whiteSpace: "nowrap",
475
475
  color: "var(--text)"
476
476
  },
477
- children: T({
477
+ children: E({
478
478
  entity: n,
479
479
  fieldName: u,
480
480
  record: e,
@@ -497,7 +497,7 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
497
497
  textOverflow: "ellipsis",
498
498
  whiteSpace: "nowrap"
499
499
  },
500
- children: T({
500
+ children: E({
501
501
  entity: n,
502
502
  fieldName: d,
503
503
  record: e,
@@ -512,9 +512,9 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
512
512
  gap: 4,
513
513
  flexShrink: 0
514
514
  },
515
- children: ee.map((t) => y(n, e, t) == null ? null : /* @__PURE__ */ V("div", {
515
+ children: f.map((t) => y(n, e, t) == null ? null : /* @__PURE__ */ V("div", {
516
516
  style: { fontSize: 11 },
517
- children: T({
517
+ children: E({
518
518
  entity: n,
519
519
  fieldName: t,
520
520
  record: e,
@@ -531,8 +531,8 @@ function W(e, t, n) {
531
531
  let r = y(e, t, n);
532
532
  return !(r == null || r === "" || Array.isArray(r) && r.length === 0);
533
533
  }
534
- function G({ entity: e, record: n, field: r, refs: i }) {
535
- let a = t(), o = l(n, e);
534
+ function G({ entity: e, record: n, field: i, refs: a }) {
535
+ let o = t(), s = r(n, e);
536
536
  return /* @__PURE__ */ V("div", {
537
537
  style: {
538
538
  fontSize: 13.5,
@@ -540,28 +540,28 @@ function G({ entity: e, record: n, field: r, refs: i }) {
540
540
  color: "var(--text)",
541
541
  overflowWrap: "anywhere"
542
542
  },
543
- children: (r ? T({
543
+ children: (i ? E({
544
544
  entity: e,
545
- fieldName: r,
545
+ fieldName: i,
546
546
  record: n,
547
547
  mode: "display",
548
- refs: i,
549
- locale: a
550
- }) : o) || h(e.display.name)
548
+ refs: a,
549
+ locale: o
550
+ }) : s) || u(e.display.name)
551
551
  });
552
552
  }
553
553
  function K({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
554
554
  let a = y(e, t, n);
555
555
  if (a == null || a === "") return null;
556
556
  let o = e.fields.get(n);
557
- return o ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("dt", {
557
+ return o ? /* @__PURE__ */ H(se, { children: [/* @__PURE__ */ V("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: g(o, n)
564
+ children: l(o, n)
565
565
  }), /* @__PURE__ */ V("dd", {
566
566
  style: {
567
567
  margin: 0,
@@ -570,7 +570,7 @@ function K({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
570
570
  minWidth: 0,
571
571
  overflowWrap: "anywhere"
572
572
  },
573
- children: T({
573
+ children: E({
574
574
  entity: e,
575
575
  fieldName: n,
576
576
  record: t,
@@ -591,89 +591,89 @@ 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: t, recordId: n, items: i, schema: o, entity: s, onBackToList: u, relatedRecordsPresentation: te }) {
595
- let p = _(s, "update"), { data: g, isLoading: re } = S(t, R(() => n ? c(s, n) : void 0, [n, s])), C = w(t), T = r(), [E, D] = oe(!1), [O, k] = oe({}), A = g?.data, ae = A?.$statuses, M = A?.$properties, P = N(t, n), L = j(t, n), z = R(() => {
594
+ function J({ entityCode: t, recordId: n, items: a, schema: s, entity: l, onBackToList: d, relatedRecordsPresentation: f }) {
595
+ let h = m(l, "update"), { data: te, isLoading: ne } = C(t, z(() => n ? c(l, n) : void 0, [n, l])), w = T(t), E = i(), [D, O] = ae(!1), [k, A] = ae({}), j = te?.data, ie = j?.$statuses, N = j?.$properties, F = P(t, n), R = M(t, n), B = z(() => {
596
596
  let e = /* @__PURE__ */ new Set();
597
- for (let [t, n] of s.fields) !n.auto && !n.primary && e.add(t);
598
- for (let [t] of s.files ?? []) e.add(t);
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);
599
599
  return e;
600
- }, [s]), se = I(() => {
601
- if (A) {
600
+ }, [l]), oe = L(() => {
601
+ if (j) {
602
602
  let e = {};
603
- z.forEach((t) => {
604
- let n = y(s, A, t);
605
- e[t] = v(s, t) ? n ?? null : n ?? "";
606
- }), k(e);
603
+ B.forEach((t) => {
604
+ let n = y(l, j, t);
605
+ e[t] = v(l, t) ? n ?? null : n ?? "";
606
+ }), A(e);
607
607
  }
608
- D(!0);
608
+ O(!0);
609
609
  }, [
610
- A,
611
- z,
612
- s
613
- ]), U = I(async () => {
614
- await T.flushAllDrafts(), D(!1), k({});
615
- }, [T]), ce = I(() => {
616
- let e = {}, t = ne({
617
- entity: s,
618
- formData: O,
619
- record: A,
610
+ j,
611
+ B,
612
+ l
613
+ ]), U = L(async () => {
614
+ await E.flushAllDrafts(), O(!1), A({});
615
+ }, [E]), ce = L(() => {
616
+ let e = {}, t = b({
617
+ entity: l,
618
+ formData: k,
619
+ record: j,
620
620
  isNew: !1
621
- }), r = b(t);
622
- for (let [t, n] of Object.entries(O)) s.files?.has(t) || (e[t] = x(s, t, n));
621
+ }), r = x(t);
622
+ for (let [t, n] of Object.entries(k)) l.files?.has(t) || (e[t] = S(l, t, n));
623
623
  if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0) {
624
- D(!1), k({});
624
+ O(!1), A({});
625
625
  return;
626
626
  }
627
- C.mutate({
627
+ w.mutate({
628
628
  pkValues: n,
629
629
  data: e
630
630
  }, {
631
631
  onSuccess: () => {
632
- r.forEach((e) => T.markCommitted(e)), D(!1), k({}), m.success("Saved");
632
+ r.forEach((e) => E.markCommitted(e)), O(!1), A({}), g.success("Saved");
633
633
  },
634
- onError: () => m.error("Failed to save")
634
+ onError: () => g.error("Failed to save")
635
635
  });
636
636
  }, [
637
- T,
638
- C,
637
+ E,
638
+ w,
639
639
  n,
640
- s,
641
- O,
642
- A
643
- ]), W = I((e, t) => {
644
- k((n) => ({
640
+ l,
641
+ k,
642
+ j
643
+ ]), W = L((e, t) => {
644
+ A((n) => ({
645
645
  ...n,
646
646
  [e]: t
647
647
  }));
648
648
  }, []);
649
- if (re) return /* @__PURE__ */ V(ie, {});
650
- if (!A) return null;
651
- let G = l(A, s), K = s.display?.display_field, q = G ? void 0 : K ? A[K] : A[s.fields.names()[0]], J = G || (q != null && typeof q != "object" ? a(q) : h(s.display.name)), le = A?.$refs, ue = {
652
- schema: o,
653
- entity: s,
649
+ if (ne) return /* @__PURE__ */ V(re, {});
650
+ if (!j) return null;
651
+ let G = r(j, l), K = l.display?.display_field, q = G ? void 0 : K ? j[K] : j[l.fields.names()[0]], J = G || (q != null && typeof q != "object" ? o(q) : u(l.display.name)), le = j?.$refs, ue = {
652
+ schema: s,
653
+ entity: l,
654
654
  entityCode: t,
655
655
  recordId: n,
656
- record: E ? {
657
- ...A,
658
- ...O
659
- } : A,
656
+ record: D ? {
657
+ ...j,
658
+ ...k
659
+ } : j,
660
660
  isNew: !1,
661
- mode: E ? "edit" : "display",
662
- onFieldChange: E ? W : void 0,
661
+ mode: D ? "edit" : "display",
662
+ onFieldChange: D ? W : void 0,
663
663
  refs: le,
664
- objectProperties: M ?? void 0,
665
- onSetProperty: p ? (e, t) => L.mutate({
664
+ objectProperties: N ?? void 0,
665
+ onSetProperty: h ? (e, t) => R.mutate({
666
666
  propertyCode: e,
667
667
  value: t
668
668
  }) : void 0,
669
- isPropertyPending: L.isPending,
670
- objectStatuses: ae ?? void 0,
671
- onSetStatus: p ? (e, t) => P.mutate({
669
+ isPropertyPending: R.isPending,
670
+ objectStatuses: ie ?? void 0,
671
+ onSetStatus: h ? (e, t) => F.mutate({
672
672
  groupCode: e,
673
673
  statusCode: t
674
674
  }) : void 0,
675
- isStatusPending: P.isPending,
676
- relatedRecordsPresentation: te
675
+ isStatusPending: F.isPending,
676
+ relatedRecordsPresentation: f
677
677
  };
678
678
  return /* @__PURE__ */ H("div", {
679
679
  style: {
@@ -710,26 +710,26 @@ function J({ entityCode: t, recordId: n, items: i, schema: o, entity: s, onBackT
710
710
  alignItems: "center",
711
711
  gap: 6
712
712
  },
713
- children: [u && /* @__PURE__ */ V(ee, {
713
+ children: [d && /* @__PURE__ */ V(ee, {
714
714
  icon: /* @__PURE__ */ V(e.back, { size: 14 }),
715
715
  title: "Back to list",
716
- onClick: u
717
- }), p && (E ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(f, {
716
+ onClick: d
717
+ }), h && (D ? /* @__PURE__ */ H(se, { children: [/* @__PURE__ */ V(_, {
718
718
  size: "xs",
719
719
  icon: /* @__PURE__ */ V(e.x, { size: 12 }),
720
720
  onClick: U,
721
721
  children: "Cancel"
722
- }), /* @__PURE__ */ V(f, {
722
+ }), /* @__PURE__ */ V(_, {
723
723
  kind: "primary",
724
724
  size: "xs",
725
- icon: C.isPending ? /* @__PURE__ */ V(d, { size: 12 }) : /* @__PURE__ */ V(e.save, { size: 12 }),
725
+ icon: w.isPending ? /* @__PURE__ */ V(p, { size: 12 }) : /* @__PURE__ */ V(e.save, { size: 12 }),
726
726
  onClick: ce,
727
- disabled: C.isPending,
728
- children: C.isPending ? "Saving…" : "Save"
729
- })] }) : /* @__PURE__ */ V(f, {
727
+ disabled: w.isPending,
728
+ children: w.isPending ? "Saving…" : "Save"
729
+ })] }) : /* @__PURE__ */ V(_, {
730
730
  size: "xs",
731
731
  icon: /* @__PURE__ */ V(e.edit, { size: 12 }),
732
- onClick: se,
732
+ onClick: oe,
733
733
  children: "Edit"
734
734
  }))]
735
735
  })]
@@ -742,8 +742,8 @@ function J({ entityCode: t, recordId: n, items: i, schema: o, entity: s, onBackT
742
742
  flexDirection: "column",
743
743
  gap: 12
744
744
  },
745
- children: i && i.length > 0 ? /* @__PURE__ */ V(F, {
746
- nodes: i,
745
+ children: a && a.length > 0 ? /* @__PURE__ */ V(I, {
746
+ nodes: a,
747
747
  ctx: ue
748
748
  }) : /* @__PURE__ */ H("p", {
749
749
  style: {
@@ -1,9 +1,9 @@
1
- import type { FilterNodeParam } from "../../types/api";
1
+ import type { FilterNode } from "../../lib/filters";
2
2
  /** ExportQuery mirrors the Go ExportQuery struct (server/handlers/data_export.go).
3
3
  * Field order matches; semantics match parseListParams 1:1. */
4
4
  export interface ExportQuery {
5
5
  screen?: string;
6
- filters?: FilterNodeParam[];
6
+ filters?: FilterNode[];
7
7
  search?: string;
8
8
  sort?: string;
9
9
  include_deleted?: boolean;
@@ -34,7 +34,7 @@ export interface ListViewState {
34
34
  /** Active screen code, when the list is rendered through a screen. */
35
35
  screenCode?: string;
36
36
  /** JSON filter tree (the same shape sent in the `filters` URL param). */
37
- jsonFilters?: FilterNodeParam[];
37
+ jsonFilters?: FilterNode[];
38
38
  /** Debounced search value from the toolbar. */
39
39
  search?: string;
40
40
  /** "field:asc" / "field:desc" sort spec. */