@declarion/react 0.104.0 → 0.109.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 (34) hide show
  1. package/dist-lib/api/agents.js +8 -7
  2. package/dist-lib/api/client.js +48 -49
  3. package/dist-lib/components/agents/AgentChatPanel.impl.js +362 -301
  4. package/dist-lib/components/agents/ChatAttachments.js +144 -0
  5. package/dist-lib/components/agents/transcript-runs.js +1 -1
  6. package/dist-lib/components/chrome/AssociationTabs.js +89 -75
  7. package/dist-lib/components/detail-layout/AssociatedBlock.js +243 -235
  8. package/dist-lib/components/detail-layout/ChildrenCards.js +57 -55
  9. package/dist-lib/components/detail-layout/ChildrenList.js +45 -43
  10. package/dist-lib/components/detail-layout/ChildrenTable.js +93 -91
  11. package/dist-lib/components/detail-layout/ChildrenTimeline.js +160 -155
  12. package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +127 -121
  13. package/dist-lib/components/fields/RefCombobox.js +53 -48
  14. package/dist-lib/components/fields/index.js +1 -0
  15. package/dist-lib/components/file-widgets/useFileSelection.js +152 -0
  16. package/dist-lib/components/pages/SmartDetailPage.impl.js +506 -482
  17. package/dist-lib/components/pages/SmartRecordListPage.impl.js +335 -300
  18. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +112 -109
  19. package/dist-lib/components/params/ParamsBlock.js +18 -15
  20. package/dist-lib/components/params/param-editors.js +60 -54
  21. package/dist-lib/components/primitives/RetryButton.js +14 -0
  22. package/dist-lib/components/primitives/StatTile.js +42 -34
  23. package/dist-lib/hooks/useAgentConversation.js +18 -13
  24. package/dist-lib/hooks/useParams.js +54 -52
  25. package/dist-lib/hooks/useSchema.js +5 -2
  26. package/dist-lib/hooks/useTimelineData.js +26 -24
  27. package/dist-lib/index.d.ts +89 -5
  28. package/dist-lib/index.js +95 -93
  29. package/dist-lib/lib/read-display-state.js +19 -0
  30. package/dist-lib/stores/auth.js +1 -0
  31. package/dist-lib/testing.d.ts +1 -1
  32. package/dist-lib/types/fieldType.js +1 -1
  33. package/dist-lib/{useResponsiveMode-ECv1AEhv.d.ts → useResponsiveMode-DODbtSrY.d.ts} +3 -0
  34. package/package.json +1 -1
@@ -3,207 +3,210 @@ import { fieldDisplayName as t, getDisplayValue as n, isUserEditableField as r,
3
3
  import { useFirstScreenSettled as o } from "../../lib/capabilityPrefetch.js";
4
4
  import { useSchema as s } from "../../hooks/useSchema.js";
5
5
  import { textWithNodes as c } from "../../lib/language.js";
6
- import { Icon as l } from "../primitives/Icons.js";
7
- import { Btn as u } from "../primitives/Btn.js";
8
- import { IconBtn as d } from "../primitives/IconBtn.js";
6
+ import { failureTitle as l } from "../../lib/failure.js";
7
+ import { Icon as u } from "../primitives/Icons.js";
8
+ import { Btn as d } from "../primitives/Btn.js";
9
+ import { IconBtn as ee } from "../primitives/IconBtn.js";
9
10
  import { useText as f } from "../../hooks/useText.js";
10
- import { useResponsiveMode as ee } from "../../hooks/useResponsiveMode.js";
11
- import { Spinner as te } from "../primitives/Spinner.js";
12
- import { TextInput as p } from "../primitives/Fields.js";
13
- import { pageInsetX as ne } from "../../lib/page-inset.js";
14
- import { readableSort as re } from "../../lib/field-classification.js";
15
- import { stripUnsupportedSortSegments as ie } from "../../lib/sort.js";
16
- import { useObject as m } from "../../hooks/useObject.js";
17
- import { useDebounce as ae } from "../../hooks/useDebounce.js";
18
- import { FileDraftScope as h, useFileDraftScope as g } from "../file-widgets/draft-scope.js";
19
- import { getEntityFileField as _, getSchemaFieldValue as v, renderSchemaField as y, schemaFieldHasValue as b, serializeSchemaFieldValue as x } from "../file-widgets/host.js";
20
- import { buildFilesPayload as oe, collectCommittedFileIds as se } from "../file-widgets/payload.js";
21
- import { useUpdateObject as S } from "../../hooks/useMutations.js";
22
- import { useSetStatus as C } from "../../hooks/useObjectStatus.js";
23
- import { useSetProperty as w } from "../../hooks/useProperties.js";
24
- import { countActiveFilters as ce, parseFilterURLState as le, removeFilterAtPath as T, setFiltersInURL as E } from "../../lib/filters.js";
25
- import { useScreenBack as D } from "../../hooks/useScreenBack.js";
26
- import { useRegisterScreenTab as O } from "../../hooks/useRegisterScreenTab.js";
27
- import { useTabSearchMirror as k } from "../../hooks/useTabSearchMirror.js";
28
- import { DetailSkeleton as ue } from "../shared/LoadingSkeleton.js";
29
- import { FilterDrawer as A } from "../filters/FilterDrawer.js";
30
- import { FilterChips as j } from "../filters/FilterChips.js";
31
- import { useRowTenant as M } from "../../hooks/useRowTenant.js";
32
- import { LayoutRenderer as de } from "../detail-layout/LayoutRenderer.js";
33
- import { resolveCard as N, resolveListProjection as fe } from "./list/cardProjection.js";
34
- import { useListFilterPresentation as pe } from "./list/useListFilterPresentation.js";
35
- import { FilterOmittedNotice as P } from "../filters/FilterOmittedNotice.js";
36
- import { useListQuery as me } from "./list/useListQuery.js";
37
- import { listLoadErrorDescription as he } from "./list/ListNoRows.js";
38
- import { useFilterValueLabels as ge } from "./list/use-filter-value-labels.js";
39
- import { useCallback as F, useEffect as I, useMemo as L, useRef as R, useState as z } from "react";
40
- import { Fragment as _e, jsx as B, jsxs as V } from "react/jsx-runtime";
41
- import { useSearchParams as ve } from "react-router";
11
+ import { RetryButton as p } from "../primitives/RetryButton.js";
12
+ import { useResponsiveMode as te } from "../../hooks/useResponsiveMode.js";
13
+ import { Spinner as ne } from "../primitives/Spinner.js";
14
+ import { TextInput as m } from "../primitives/Fields.js";
15
+ import { readDisplayState as h } from "../../lib/read-display-state.js";
16
+ import { pageInsetX as re } from "../../lib/page-inset.js";
17
+ import { readableSort as ie } from "../../lib/field-classification.js";
18
+ import { stripUnsupportedSortSegments as ae } from "../../lib/sort.js";
19
+ import { useObject as g } from "../../hooks/useObject.js";
20
+ import { useDebounce as oe } from "../../hooks/useDebounce.js";
21
+ import { FileDraftScope as _, useFileDraftScope as v } from "../file-widgets/draft-scope.js";
22
+ import { getEntityFileField as se, getSchemaFieldValue as y, renderSchemaField as b, schemaFieldHasValue as x, serializeSchemaFieldValue as S } from "../file-widgets/host.js";
23
+ import { buildFilesPayload as C, collectCommittedFileIds as ce } from "../file-widgets/payload.js";
24
+ import { useUpdateObject as le } from "../../hooks/useMutations.js";
25
+ import { useSetStatus as ue } from "../../hooks/useObjectStatus.js";
26
+ import { useSetProperty as de } from "../../hooks/useProperties.js";
27
+ import { countActiveFilters as fe, parseFilterURLState as pe, removeFilterAtPath as me, setFiltersInURL as w } from "../../lib/filters.js";
28
+ import { useScreenBack as T } from "../../hooks/useScreenBack.js";
29
+ import { useRegisterScreenTab as E } from "../../hooks/useRegisterScreenTab.js";
30
+ import { useTabSearchMirror as D } from "../../hooks/useTabSearchMirror.js";
31
+ import { DetailSkeleton as O } from "../shared/LoadingSkeleton.js";
32
+ import { FilterDrawer as k } from "../filters/FilterDrawer.js";
33
+ import { FilterChips as A } from "../filters/FilterChips.js";
34
+ import { useRowTenant as j } from "../../hooks/useRowTenant.js";
35
+ import { LayoutRenderer as M } from "../detail-layout/LayoutRenderer.js";
36
+ import { resolveCard as N, resolveListProjection as P } from "./list/cardProjection.js";
37
+ import { useListFilterPresentation as F } from "./list/useListFilterPresentation.js";
38
+ import { FilterOmittedNotice as he } from "../filters/FilterOmittedNotice.js";
39
+ import { useListQuery as ge } from "./list/useListQuery.js";
40
+ import { listLoadErrorDescription as _e } from "./list/ListNoRows.js";
41
+ import { useFilterValueLabels as ve } from "./list/use-filter-value-labels.js";
42
+ import { useCallback as I, useEffect as L, useMemo as R, useRef as z, useState as B } from "react";
43
+ import { Fragment as ye, jsx as V, jsxs as H } from "react/jsx-runtime";
44
+ import { useSearchParams as be } from "react-router";
42
45
  //#region src/components/pages/SmartRecordListPage.impl.tsx
43
- var ye = 200, H = "items:";
44
- function U({ screenCode: t }) {
45
- let n = f(), r = f("errors"), [i, a] = ve(), { data: c, refetch: te } = s(), m = ee(), [h, g] = z(!1), _ = c?.screens[t], v = _?.entity ? c?.entities[_.entity] : void 0, y = _?.entity;
46
- O(_, v, i.toString()), k(_?.route);
47
- let b = D(), x = i.get("selected") ?? null, oe = i.get("search") ?? "", se = ae(oe, 300), S = i.get("sort") ?? re(v, _?.sort_default) ?? "", C = L(() => le(i), [i]), { visibleFilterState: w, filterFieldMeta: ue, allFilterFieldMeta: M, filterFieldName: de } = pe(_, v, c?.entities, C.filters), H = w.filters, U = F((e) => {
46
+ var xe = 200, U = "items:";
47
+ function W({ screenCode: t }) {
48
+ let n = f(), r = f("errors"), [i, a] = be(), { data: c, refetch: l } = s(), p = te(), [ne, h] = B(!1), g = c?.screens[t], _ = g?.entity ? c?.entities[g.entity] : void 0, v = g?.entity;
49
+ E(g, _, i.toString()), D(g?.route);
50
+ let se = T(), y = i.get("selected") ?? null, b = i.get("search") ?? "", x = oe(b, 300), S = i.get("sort") ?? ie(_, g?.sort_default) ?? "", C = R(() => pe(i), [i]), { visibleFilterState: ce, filterFieldMeta: le, allFilterFieldMeta: ue, filterFieldName: de } = F(g, _, c?.entities, C.filters), O = ce.filters, j = I((e) => {
48
51
  a((t) => {
49
52
  let n = new URLSearchParams(t);
50
- return E(e, n), n;
53
+ return w(e, n), n;
51
54
  }, { replace: !0 });
52
- }, [a]), G = L(() => _?.columns ?? v?.fields.names().filter((e) => !v.fields.get(e)?.primary && !v.fields.get(e)?.auto && v.fields.get(e)?.display?.is_listable !== !1).slice(0, 4) ?? [], [_?.columns, v]), K = L(() => {
53
- let e = _?.responsive?.[m.category]?.presentation;
54
- return m.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
55
- }, [_?.responsive, m.category]), q = L(() => {
56
- let e = _?.responsive?.[m.category];
57
- return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation : m.category === "phone" ? "cards" : "table";
58
- }, [_?.responsive, m.category]), xe = _?.responsive?.[m.category]?.layout?.related_records, Se = L(() => N({
59
- entity: v,
60
- screen: _
61
- }), [v, _]), Ce = L(() => fe({
62
- entity: v,
63
- screen: _,
64
- presentation: q,
65
- visibleColumns: G,
66
- card: Se,
55
+ }, [a]), M = R(() => g?.columns ?? _?.fields.names().filter((e) => !_.fields.get(e)?.primary && !_.fields.get(e)?.auto && _.fields.get(e)?.display?.is_listable !== !1).slice(0, 4) ?? [], [g?.columns, _]), U = R(() => {
56
+ let e = g?.responsive?.[p.category]?.presentation;
57
+ return p.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
58
+ }, [g?.responsive, p.category]), W = R(() => {
59
+ let e = g?.responsive?.[p.category];
60
+ return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation : p.category === "phone" ? "cards" : "table";
61
+ }, [g?.responsive, p.category]), G = g?.responsive?.[p.category]?.layout?.related_records, K = R(() => N({
62
+ entity: _,
63
+ screen: g
64
+ }), [_, g]), q = R(() => P({
65
+ entity: _,
66
+ screen: g,
67
+ presentation: W,
68
+ visibleColumns: M,
69
+ card: K,
67
70
  sort: S
68
71
  }), [
69
- v,
70
72
  _,
71
- q,
72
- G,
73
- Se,
73
+ g,
74
+ W,
75
+ M,
76
+ K,
74
77
  S
75
- ]), J = me({
76
- entity: v,
77
- entityCode: y,
78
- screen: _,
78
+ ]), J = ge({
79
+ entity: _,
80
+ entityCode: v,
81
+ screen: g,
79
82
  screenCode: t,
80
83
  page: 1,
81
- perPage: ye,
82
- sortForRequest: ie(S),
83
- debouncedSearch: se,
84
- filters: H,
84
+ perPage: xe,
85
+ sortForRequest: ae(S),
86
+ debouncedSearch: x,
87
+ filters: O,
85
88
  includeDeleted: !1,
86
- expand: Ce.expandFields,
87
- select: Ce.selectFields,
88
- isHeld: !v,
89
+ expand: q.expandFields,
90
+ select: q.selectFields,
91
+ isHeld: !_,
89
92
  retryHeld: () => {
90
- te();
93
+ l();
91
94
  },
92
95
  runCountQuery: !1,
93
- urlKey: `${y ?? ""}|${i.toString()}`
94
- }), we = J.rows, Te = J.refs, Ee = J.isLoading;
95
- o(!Ee);
96
- let { labelFor: De, refs: Oe } = ge(M, H, Te, c?.entities), ke = L(() => v?.fields.names().find((e) => v.fields.get(e)?.primary) ?? "id", [v]), Ae = F((e, t) => {
96
+ urlKey: `${v ?? ""}|${i.toString()}`
97
+ }), we = J.rows, Te = J.refs, Y = J.isLoading;
98
+ o(!Y);
99
+ let { labelFor: Ee, refs: De } = ve(ue, O, Te, c?.entities), Oe = R(() => _?.fields.names().find((e) => _.fields.get(e)?.primary) ?? "id", [_]), ke = I((e, t) => {
97
100
  a((t) => {
98
101
  let n = new URLSearchParams(t);
99
102
  return e ? n.set("selected", e) : n.delete("selected"), n;
100
103
  }, { replace: t?.replace ?? !0 });
101
- }, [a]), je = F((e) => {
104
+ }, [a]), Ae = I((e) => {
102
105
  a((t) => {
103
106
  let n = new URLSearchParams(t);
104
107
  return e ? n.set("search", e) : n.delete("search"), n;
105
108
  }, { replace: !0 });
106
- }, [a]), Y = (_?.list_resizable ?? !1) && K === "split" && m.category !== "phone" && !m.touch, Me = R(null), [X, Z] = z(null), Ne = R(!1), Q = _?.list_width;
107
- I(() => {
108
- Y && Q?.endsWith("%") && Z(null);
109
+ }, [a]), X = (g?.list_resizable ?? !1) && U === "split" && p.category !== "phone" && !p.touch, je = z(null), [Z, Q] = B(null), Me = z(!1), $ = g?.list_width;
110
+ L(() => {
111
+ X && $?.endsWith("%") && Q(null);
109
112
  }, [
110
- Y,
111
- Q,
112
- m.width,
113
- m.height
114
- ]), I(() => {
115
- if (!Y || X !== null) return;
116
- let e = Me.current;
113
+ X,
114
+ $,
115
+ p.width,
116
+ p.height
117
+ ]), L(() => {
118
+ if (!X || Z !== null) return;
119
+ let e = je.current;
117
120
  if (e) {
118
- if (Q && Q.endsWith("%")) {
119
- let t = parseFloat(Q) / 100;
120
- Z(Math.round(e.getBoundingClientRect().width * t));
121
- } else Z(Q && parseInt(Q, 10) || 320);
121
+ if ($ && $.endsWith("%")) {
122
+ let t = parseFloat($) / 100;
123
+ Q(Math.round(e.getBoundingClientRect().width * t));
124
+ } else Q($ && parseInt($, 10) || 320);
122
125
  }
123
126
  }, [
124
- Y,
125
- Q,
126
127
  X,
127
- v
128
+ $,
129
+ Z,
130
+ _
128
131
  ]);
129
- let Pe = R(null);
130
- I(() => () => {
131
- Pe.current?.();
132
+ let Ne = z(null);
133
+ L(() => () => {
134
+ Ne.current?.();
132
135
  }, []);
133
- let Fe = F((e) => {
134
- e.preventDefault(), Ne.current = !0;
135
- let t = e.clientX, n = X ?? 320, r = (e) => {
136
- if (!Ne.current) return;
137
- let r = (Me.current?.getBoundingClientRect().width ?? window.innerWidth) - 300, i = Math.max(200, Math.min(r, n + e.clientX - t));
138
- Z(i);
136
+ let Pe = I((e) => {
137
+ e.preventDefault(), Me.current = !0;
138
+ let t = e.clientX, n = Z ?? 320, r = (e) => {
139
+ if (!Me.current) return;
140
+ let r = (je.current?.getBoundingClientRect().width ?? window.innerWidth) - 300, i = Math.max(200, Math.min(r, n + e.clientX - t));
141
+ Q(i);
139
142
  }, i = () => {
140
- Ne.current = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i), document.body.style.cursor = "", document.body.style.userSelect = "", Pe.current = null;
143
+ Me.current = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i), document.body.style.cursor = "", document.body.style.userSelect = "", Ne.current = null;
141
144
  };
142
- document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), Pe.current = i;
143
- }, [X]);
144
- if (!c || !_ || !v) return null;
145
- let Ie = ce(H), $ = K === "split" || K === "stacked" || !x, Le = K === "split" || K === "stacked" || !!x, Re = K !== "split" && x ? () => Ae(null, { replace: !0 }) : void 0, ze = K === "split" ? Y && X !== null ? X : _.list_width ?? "320px" : "100%";
146
- return /* @__PURE__ */ V("div", {
147
- ref: Me,
148
- "data-record-list-presentation": K,
145
+ document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), Ne.current = i;
146
+ }, [Z]);
147
+ if (!c || !g || !_) return null;
148
+ let Fe = fe(O), Ie = U === "split" || U === "stacked" || !y, Le = U === "split" || U === "stacked" || !!y, Re = U !== "split" && y ? () => ke(null, { replace: !0 }) : void 0, ze = U === "split" ? X && Z !== null ? Z : g.list_width ?? "320px" : "100%";
149
+ return /* @__PURE__ */ H("div", {
150
+ ref: je,
151
+ "data-record-list-presentation": U,
149
152
  style: {
150
153
  display: "flex",
151
- flexDirection: K === "stacked" ? "column" : "row",
154
+ flexDirection: U === "stacked" ? "column" : "row",
152
155
  height: "100%",
153
156
  minWidth: 0,
154
157
  overflow: "hidden"
155
158
  },
156
159
  children: [
157
- $ && /* @__PURE__ */ V("div", {
160
+ Ie && /* @__PURE__ */ H("div", {
158
161
  "data-testid": "record-list-panel",
159
162
  style: {
160
- flex: K === "split" ? "none" : "1 1 auto",
163
+ flex: U === "split" ? "none" : "1 1 auto",
161
164
  display: "flex",
162
165
  flexDirection: "column",
163
166
  overflow: "hidden",
164
- borderRight: K === "split" && !Y ? "1px solid var(--divider)" : "none",
165
- borderBottom: K === "stacked" ? "1px solid var(--divider)" : "none",
167
+ borderRight: U === "split" && !X ? "1px solid var(--divider)" : "none",
168
+ borderBottom: U === "stacked" ? "1px solid var(--divider)" : "none",
166
169
  width: ze,
167
170
  minWidth: 0,
168
- height: K === "stacked" ? "50%" : "100%"
171
+ height: U === "stacked" ? "50%" : "100%"
169
172
  },
170
- children: [/* @__PURE__ */ V("div", {
173
+ children: [/* @__PURE__ */ H("div", {
171
174
  style: {
172
175
  paddingTop: 12,
173
176
  paddingBottom: 12,
174
- ...ne(12),
177
+ ...re(12),
175
178
  display: "flex",
176
179
  flexDirection: "column",
177
180
  gap: 8,
178
181
  borderBottom: "1px solid var(--divider)"
179
182
  },
180
183
  children: [
181
- b.hasOriginBack && /* @__PURE__ */ V("div", {
184
+ se.hasOriginBack && /* @__PURE__ */ H("div", {
182
185
  style: {
183
186
  display: "flex",
184
187
  alignItems: "center",
185
188
  gap: 8
186
189
  },
187
- children: [/* @__PURE__ */ B(d, {
188
- icon: /* @__PURE__ */ B(l.back, { size: 14 }),
190
+ children: [/* @__PURE__ */ V(ee, {
191
+ icon: /* @__PURE__ */ V(u.back, { size: 14 }),
189
192
  title: n("list.header.back", "Back"),
190
- onClick: b.goBack
191
- }), /* @__PURE__ */ B("span", {
193
+ onClick: se.goBack
194
+ }), /* @__PURE__ */ V("span", {
192
195
  style: {
193
196
  fontSize: 12.5,
194
197
  fontWeight: 600,
195
198
  color: "var(--text)"
196
199
  },
197
- children: n(_.display?.name) || n(v.display.name_plural)
200
+ children: n(g.display?.name) || n(_.display.name_plural)
198
201
  })]
199
202
  }),
200
- /* @__PURE__ */ B(p, {
201
- value: oe,
202
- onChange: je,
203
- placeholder: n("list.toolbar.search_placeholder", "Search {name}…", { name: n(v.display.name_plural) }),
204
- prefix: /* @__PURE__ */ B(l.search, { size: 13 })
203
+ /* @__PURE__ */ V(m, {
204
+ value: b,
205
+ onChange: Ae,
206
+ placeholder: n("list.toolbar.search_placeholder", "Search {name}…", { name: n(_.display.name_plural) }),
207
+ prefix: /* @__PURE__ */ V(u.search, { size: 13 })
205
208
  }),
206
- C.error && /* @__PURE__ */ V("div", {
209
+ C.error && /* @__PURE__ */ H("div", {
207
210
  role: "alert",
208
211
  "data-testid": "record-list-filter-url-error",
209
212
  style: {
@@ -219,22 +222,22 @@ function U({ screenCode: t }) {
219
222
  n("list.filters.invalid_suffix", "Showing this list without URL filters.")
220
223
  ]
221
224
  }),
222
- /* @__PURE__ */ V(u, {
225
+ /* @__PURE__ */ H(d, {
223
226
  size: "xs",
224
- icon: /* @__PURE__ */ B(l.filter, { size: 12 }),
225
- onClick: () => g(!0),
226
- children: [n("filter.drawer.title", "Filters"), Ie > 0 ? ` (${Ie})` : ""]
227
+ icon: /* @__PURE__ */ V(u.filter, { size: 12 }),
228
+ onClick: () => h(!0),
229
+ children: [n("filter.drawer.title", "Filters"), Fe > 0 ? ` (${Fe})` : ""]
227
230
  }),
228
- w.omitted && /* @__PURE__ */ B(P, {}),
229
- /* @__PURE__ */ B(j, {
230
- filters: H,
231
- resolveValue: De,
231
+ ce.omitted && /* @__PURE__ */ V(he, {}),
232
+ /* @__PURE__ */ V(A, {
233
+ filters: O,
234
+ resolveValue: Ee,
232
235
  fieldLabel: de,
233
- onRemoveAtPath: (e) => U(T(H, e)),
234
- onClearAll: () => U([]),
235
- onChipClick: () => g(!0)
236
+ onRemoveAtPath: (e) => j(me(O, e)),
237
+ onClearAll: () => j([]),
238
+ onChipClick: () => h(!0)
236
239
  }),
237
- /* @__PURE__ */ B("div", {
240
+ /* @__PURE__ */ V("div", {
238
241
  style: {
239
242
  display: "flex",
240
243
  alignItems: "center",
@@ -242,47 +245,64 @@ function U({ screenCode: t }) {
242
245
  fontSize: 11,
243
246
  color: "var(--text-3)"
244
247
  },
245
- children: /* @__PURE__ */ B("span", { children: Ee ? n("list.records.loading", "Loading…") : J.isError ? r("list.rows_unreadable", "The records could not be loaded.") : n("list.records.count", "{count} {name}", {
248
+ children: /* @__PURE__ */ V("span", { children: Y ? n("list.records.loading", "Loading…") : J.isError ? r("list.rows_unreadable", "The records could not be loaded.") : n("list.records.count", "{count} {name}", {
246
249
  count: we.length,
247
- name: n(v.display.name_plural)
250
+ name: n(_.display.name_plural)
248
251
  }) })
249
252
  })
250
253
  ]
251
- }), /* @__PURE__ */ B("div", {
254
+ }), /* @__PURE__ */ V("div", {
252
255
  style: {
253
256
  flex: 1,
254
257
  overflowY: "auto",
255
- padding: q === "cards" ? 10 : 0,
256
- display: q === "cards" ? "flex" : "block",
258
+ padding: W === "cards" ? 10 : 0,
259
+ display: W === "cards" ? "flex" : "block",
257
260
  flexDirection: "column",
258
- gap: q === "cards" ? 10 : void 0
261
+ gap: W === "cards" ? 10 : void 0
259
262
  },
260
- children: Ee ? /* @__PURE__ */ B("div", {
263
+ children: Y && J.isLoadingStale ? /* @__PURE__ */ H("div", {
264
+ role: "alert",
265
+ style: {
266
+ padding: 16,
267
+ color: "var(--text-2)"
268
+ },
269
+ children: [
270
+ n("list.rows.loading_slow_title", "Still loading data"),
271
+ " ",
272
+ /* @__PURE__ */ V(d, {
273
+ size: "xs",
274
+ onClick: () => {
275
+ J.retry();
276
+ },
277
+ children: n("list.rows.retry", "Retry")
278
+ })
279
+ ]
280
+ }) : Y ? /* @__PURE__ */ V("div", {
261
281
  style: {
262
282
  padding: 12,
263
283
  display: "flex",
264
284
  flexDirection: "column",
265
285
  gap: 6
266
286
  },
267
- children: Array.from({ length: 8 }).map((e, t) => /* @__PURE__ */ B("div", { style: {
287
+ children: Array.from({ length: 8 }).map((e, t) => /* @__PURE__ */ V("div", { style: {
268
288
  height: 48,
269
289
  borderRadius: "var(--radius-md)",
270
290
  background: "var(--surface-3)"
271
291
  } }, t))
272
- }) : J.isError ? /* @__PURE__ */ V("div", {
292
+ }) : J.isError ? /* @__PURE__ */ H("div", {
273
293
  role: "alert",
274
294
  style: {
275
295
  padding: 16,
276
296
  color: "var(--text-2)"
277
297
  },
278
- children: [he(n, r, v, J.error), /* @__PURE__ */ B(u, {
298
+ children: [_e(n, r, _, J.error), /* @__PURE__ */ V(d, {
279
299
  size: "xs",
280
300
  onClick: () => {
281
301
  J.retry();
282
302
  },
283
303
  children: n("list.rows.retry", "Retry")
284
304
  })]
285
- }) : we.length === 0 ? /* @__PURE__ */ B("div", {
305
+ }) : we.length === 0 ? /* @__PURE__ */ V("div", {
286
306
  style: {
287
307
  padding: 28,
288
308
  textAlign: "center",
@@ -290,19 +310,19 @@ function U({ screenCode: t }) {
290
310
  color: "var(--text-3)"
291
311
  },
292
312
  children: n("list.records.none", "No records found")
293
- }) : /* @__PURE__ */ V(_e, { children: [we.map((t) => {
294
- let n = e(t[ke]);
295
- return /* @__PURE__ */ B(W, {
313
+ }) : /* @__PURE__ */ H(ye, { children: [we.map((t) => {
314
+ let n = e(t[Oe]);
315
+ return /* @__PURE__ */ V(Se, {
296
316
  record: t,
297
- entity: v,
298
- columns: G,
299
- card: Se,
300
- presentation: q,
317
+ entity: _,
318
+ columns: M,
319
+ card: K,
320
+ presentation: W,
301
321
  refs: Te,
302
- isSelected: n === x,
303
- onClick: () => Ae(n, { replace: K === "split" })
322
+ isSelected: n === y,
323
+ onClick: () => ke(n, { replace: U === "split" })
304
324
  }, n);
305
- }), J.isCursor && J.hasMorePages && /* @__PURE__ */ B("button", {
325
+ }), J.isCursor && J.hasMorePages && /* @__PURE__ */ V("button", {
306
326
  type: "button",
307
327
  "data-testid": "record-list-load-more",
308
328
  onClick: J.fetchNextPage,
@@ -321,9 +341,9 @@ function U({ screenCode: t }) {
321
341
  })] })
322
342
  })]
323
343
  }),
324
- Y && /* @__PURE__ */ B("div", {
344
+ X && /* @__PURE__ */ V("div", {
325
345
  "data-testid": "record-list-resize-handle",
326
- onMouseDown: Fe,
346
+ onMouseDown: Pe,
327
347
  style: {
328
348
  flex: "none",
329
349
  width: 1,
@@ -334,7 +354,7 @@ function U({ screenCode: t }) {
334
354
  onMouseEnter: (e) => e.currentTarget.style.background = "var(--border-strong)",
335
355
  onMouseLeave: (e) => e.currentTarget.style.background = "var(--divider)"
336
356
  }),
337
- Le && /* @__PURE__ */ V("div", {
357
+ Le && /* @__PURE__ */ H("div", {
338
358
  "data-testid": "record-detail-panel",
339
359
  style: {
340
360
  flex: 1,
@@ -342,23 +362,23 @@ function U({ screenCode: t }) {
342
362
  flexDirection: "column",
343
363
  minWidth: 0,
344
364
  overflow: "hidden",
345
- height: K === "stacked" ? "50%" : "100%"
365
+ height: U === "stacked" ? "50%" : "100%"
346
366
  },
347
- children: [!$ && w.omitted && /* @__PURE__ */ B(P, { className: "p-4" }), /* @__PURE__ */ B("div", {
367
+ children: [!Ie && ce.omitted && /* @__PURE__ */ V(he, { className: "p-4" }), /* @__PURE__ */ V("div", {
348
368
  style: {
349
369
  flex: 1,
350
370
  minHeight: 0
351
371
  },
352
- children: x ? /* @__PURE__ */ B(be, {
353
- entityCode: y,
354
- recordId: x,
355
- items: _.items,
372
+ children: y ? /* @__PURE__ */ V(Ce, {
373
+ entityCode: v,
374
+ recordId: y,
375
+ items: g.items,
356
376
  schema: c,
357
- entity: v,
377
+ entity: _,
358
378
  onBackToList: Re,
359
- onOpenFilters: $ ? void 0 : () => g(!0),
360
- relatedRecordsPresentation: xe
361
- }, x) : /* @__PURE__ */ B("div", {
379
+ onOpenFilters: Ie ? void 0 : () => h(!0),
380
+ relatedRecordsPresentation: G
381
+ }, y) : /* @__PURE__ */ V("div", {
362
382
  style: {
363
383
  display: "flex",
364
384
  alignItems: "center",
@@ -366,33 +386,33 @@ function U({ screenCode: t }) {
366
386
  height: "100%",
367
387
  color: "var(--text-3)"
368
388
  },
369
- children: /* @__PURE__ */ B("p", {
389
+ children: /* @__PURE__ */ V("p", {
370
390
  style: { fontSize: 12.5 },
371
- children: n("list.detail.select_prompt", "Select a {name} to view details", { name: n(v.display.name) })
391
+ children: n("list.detail.select_prompt", "Select a {name} to view details", { name: n(_.display.name) })
372
392
  })
373
393
  })
374
394
  })]
375
395
  }),
376
- /* @__PURE__ */ B(A, {
377
- open: h,
378
- onClose: () => g(!1),
379
- filters: H,
380
- onApply: U,
381
- availableFields: ue,
382
- allFields: M,
396
+ /* @__PURE__ */ V(k, {
397
+ open: ne,
398
+ onClose: () => h(!1),
399
+ filters: O,
400
+ onApply: j,
401
+ availableFields: le,
402
+ allFields: ue,
383
403
  fieldLabel: de,
384
- resolveValue: De,
385
- defaultFilters: _.default_filters,
386
- refs: Oe
404
+ resolveValue: Ee,
405
+ defaultFilters: g.default_filters,
406
+ refs: De
387
407
  })
388
408
  ]
389
409
  });
390
410
  }
391
- function W({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a, isSelected: o, onClick: s }) {
411
+ function Se({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a, isSelected: o, onClick: s }) {
392
412
  let c = f();
393
413
  if (i === "cards") {
394
- let n = r.badgeFields.filter((n) => b(t, e, n)), i = r.bodyFields.filter((n) => b(t, e, n)), l = r.metaFields.filter((n) => b(t, e, n));
395
- return /* @__PURE__ */ V("button", {
414
+ let n = r.badgeFields.filter((n) => x(t, e, n)), i = r.bodyFields.filter((n) => x(t, e, n)), l = r.metaFields.filter((n) => x(t, e, n));
415
+ return /* @__PURE__ */ H("button", {
396
416
  type: "button",
397
417
  "data-testid": "record-list-card",
398
418
  "aria-current": o ? "true" : void 0,
@@ -412,19 +432,19 @@ function W({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a
412
432
  boxShadow: o ? "inset 3px 0 0 var(--accent)" : "none"
413
433
  },
414
434
  children: [
415
- /* @__PURE__ */ B(G, {
435
+ /* @__PURE__ */ V(G, {
416
436
  entity: t,
417
437
  record: e,
418
438
  field: r.titleField,
419
439
  refs: a
420
440
  }),
421
- r.subtitleField && /* @__PURE__ */ B("div", {
441
+ r.subtitleField && /* @__PURE__ */ V("div", {
422
442
  style: {
423
443
  fontSize: 12,
424
444
  color: "var(--text-3)",
425
445
  overflowWrap: "anywhere"
426
446
  },
427
- children: y({
447
+ children: b({
428
448
  entity: t,
429
449
  fieldName: r.subtitleField,
430
450
  record: e,
@@ -433,13 +453,13 @@ function W({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a
433
453
  t: c
434
454
  })
435
455
  }),
436
- n.length > 0 && /* @__PURE__ */ B("div", {
456
+ n.length > 0 && /* @__PURE__ */ V("div", {
437
457
  style: {
438
458
  display: "flex",
439
459
  flexWrap: "wrap",
440
460
  gap: 6
441
461
  },
442
- children: n.map((n) => /* @__PURE__ */ B("span", {
462
+ children: n.map((n) => /* @__PURE__ */ V("span", {
443
463
  style: {
444
464
  border: "1px solid var(--border)",
445
465
  borderRadius: 999,
@@ -449,7 +469,7 @@ function W({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a
449
469
  maxWidth: "100%",
450
470
  overflowWrap: "anywhere"
451
471
  },
452
- children: y({
472
+ children: b({
453
473
  entity: t,
454
474
  fieldName: n,
455
475
  record: e,
@@ -459,21 +479,21 @@ function W({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a
459
479
  })
460
480
  }, n))
461
481
  }),
462
- i.length > 0 && /* @__PURE__ */ B("dl", {
482
+ i.length > 0 && /* @__PURE__ */ V("dl", {
463
483
  style: {
464
484
  display: "grid",
465
485
  gridTemplateColumns: "minmax(72px, max-content) minmax(0, 1fr)",
466
486
  gap: "5px 10px",
467
487
  margin: 0
468
488
  },
469
- children: i.map((n) => /* @__PURE__ */ B(K, {
489
+ children: i.map((n) => /* @__PURE__ */ V(K, {
470
490
  entity: t,
471
491
  record: e,
472
492
  fieldName: n,
473
493
  refs: a
474
494
  }, n))
475
495
  }),
476
- l.length > 0 && /* @__PURE__ */ B("div", {
496
+ l.length > 0 && /* @__PURE__ */ V("div", {
477
497
  style: {
478
498
  display: "flex",
479
499
  flexWrap: "wrap",
@@ -481,12 +501,12 @@ function W({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a
481
501
  fontSize: 11,
482
502
  color: "var(--text-3)"
483
503
  },
484
- children: l.map((n) => /* @__PURE__ */ B("span", {
504
+ children: l.map((n) => /* @__PURE__ */ V("span", {
485
505
  style: {
486
506
  minWidth: 0,
487
507
  overflowWrap: "anywhere"
488
508
  },
489
- children: y({
509
+ children: b({
490
510
  entity: t,
491
511
  fieldName: n,
492
512
  record: e,
@@ -500,7 +520,7 @@ function W({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a
500
520
  });
501
521
  }
502
522
  let l = n[0], u = n[1], d = n.slice(2, 4);
503
- return /* @__PURE__ */ V("button", {
523
+ return /* @__PURE__ */ H("button", {
504
524
  onClick: s,
505
525
  style: {
506
526
  width: "100%",
@@ -523,7 +543,7 @@ function W({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a
523
543
  onMouseLeave: (e) => {
524
544
  o || (e.currentTarget.style.background = "transparent");
525
545
  },
526
- children: [l && /* @__PURE__ */ B("div", {
546
+ children: [l && /* @__PURE__ */ V("div", {
527
547
  style: {
528
548
  fontSize: 12.5,
529
549
  fontWeight: 500,
@@ -532,7 +552,7 @@ function W({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a
532
552
  whiteSpace: "nowrap",
533
553
  color: "var(--text)"
534
554
  },
535
- children: y({
555
+ children: b({
536
556
  entity: t,
537
557
  fieldName: l,
538
558
  record: e,
@@ -540,13 +560,13 @@ function W({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a
540
560
  refs: a,
541
561
  t: c
542
562
  })
543
- }), /* @__PURE__ */ V("div", {
563
+ }), /* @__PURE__ */ H("div", {
544
564
  style: {
545
565
  display: "flex",
546
566
  alignItems: "center",
547
567
  gap: 6
548
568
  },
549
- children: [u && /* @__PURE__ */ B("div", {
569
+ children: [u && /* @__PURE__ */ V("div", {
550
570
  style: {
551
571
  fontSize: 11,
552
572
  color: "var(--text-3)",
@@ -555,7 +575,7 @@ function W({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a
555
575
  textOverflow: "ellipsis",
556
576
  whiteSpace: "nowrap"
557
577
  },
558
- children: y({
578
+ children: b({
559
579
  entity: t,
560
580
  fieldName: u,
561
581
  record: e,
@@ -563,16 +583,16 @@ function W({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a
563
583
  refs: a,
564
584
  t: c
565
585
  })
566
- }), /* @__PURE__ */ B("div", {
586
+ }), /* @__PURE__ */ V("div", {
567
587
  style: {
568
588
  display: "flex",
569
589
  alignItems: "center",
570
590
  gap: 4,
571
591
  flexShrink: 0
572
592
  },
573
- children: d.map((n) => v(t, e, n) == null ? null : /* @__PURE__ */ B("div", {
593
+ children: d.map((n) => y(t, e, n) == null ? null : /* @__PURE__ */ V("div", {
574
594
  style: { fontSize: 11 },
575
- children: y({
595
+ children: b({
576
596
  entity: t,
577
597
  fieldName: n,
578
598
  record: e,
@@ -586,7 +606,7 @@ function W({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a
586
606
  });
587
607
  }
588
608
  function G({ entity: e, record: t, field: r, refs: i }) {
589
- let a = f(), o = n(a, t, e), s = r ? y({
609
+ let a = f(), o = n(a, t, e), s = r ? b({
590
610
  entity: e,
591
611
  fieldName: r,
592
612
  record: t,
@@ -594,7 +614,7 @@ function G({ entity: e, record: t, field: r, refs: i }) {
594
614
  refs: i,
595
615
  t: a
596
616
  }) : o;
597
- return /* @__PURE__ */ B("div", {
617
+ return /* @__PURE__ */ V("div", {
598
618
  style: {
599
619
  fontSize: 13.5,
600
620
  fontWeight: 600,
@@ -605,10 +625,10 @@ function G({ entity: e, record: t, field: r, refs: i }) {
605
625
  });
606
626
  }
607
627
  function K({ entity: e, record: n, fieldName: r, refs: i }) {
608
- let a = f(), o = v(e, n, r);
628
+ let a = f(), o = y(e, n, r);
609
629
  if (o == null || o === "") return null;
610
630
  let s = e.fields.get(r);
611
- return s ? /* @__PURE__ */ V(_e, { children: [/* @__PURE__ */ B("dt", {
631
+ return s ? /* @__PURE__ */ H(ye, { children: [/* @__PURE__ */ V("dt", {
612
632
  style: {
613
633
  color: "var(--text-3)",
614
634
  fontSize: 11.5,
@@ -616,7 +636,7 @@ function K({ entity: e, record: n, fieldName: r, refs: i }) {
616
636
  overflowWrap: "anywhere"
617
637
  },
618
638
  children: t(a, s, r)
619
- }), /* @__PURE__ */ B("dd", {
639
+ }), /* @__PURE__ */ V("dd", {
620
640
  style: {
621
641
  margin: 0,
622
642
  color: "var(--text)",
@@ -624,7 +644,7 @@ function K({ entity: e, record: n, fieldName: r, refs: i }) {
624
644
  minWidth: 0,
625
645
  overflowWrap: "anywhere"
626
646
  },
627
- children: y({
647
+ children: b({
628
648
  entity: e,
629
649
  fieldName: r,
630
650
  record: n,
@@ -634,8 +654,8 @@ function K({ entity: e, record: n, fieldName: r, refs: i }) {
634
654
  })
635
655
  })] }) : null;
636
656
  }
637
- function be({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList: a, onOpenFilters: o, relatedRecordsPresentation: s }) {
638
- return /* @__PURE__ */ B(h, { children: /* @__PURE__ */ B(q, {
657
+ function Ce({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList: a, onOpenFilters: o, relatedRecordsPresentation: s }) {
658
+ return /* @__PURE__ */ V(_, { children: /* @__PURE__ */ V(q, {
639
659
  entityCode: e,
640
660
  recordId: t,
641
661
  items: n,
@@ -646,104 +666,119 @@ function be({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBack
646
666
  relatedRecordsPresentation: s
647
667
  }) });
648
668
  }
649
- function q({ entityCode: t, recordId: o, items: s, schema: ee, entity: p, onBackToList: re, onOpenFilters: ie, relatedRecordsPresentation: ae }) {
650
- let h = f(), y = M(p), b = L(() => o ? a(p, o) : void 0, [o, p]), { data: ce, isLoading: le } = m(t, b), T = S(t), E = g(), [D, O] = z(!1), [k, A] = z({}), j = ce?.data, N = i(p, "update", j, y.tenantId), fe = j?.$statuses, pe = j?.$properties, P = C(t, o), me = w(t, o), he = L(() => {
669
+ function q({ entityCode: t, recordId: o, items: s, schema: te, entity: m, onBackToList: ie, onOpenFilters: ae, relatedRecordsPresentation: oe }) {
670
+ let _ = f(), b = f("errors"), x = j(m), fe = R(() => o ? a(m, o) : void 0, [o, m]), pe = g(t, fe), me = pe.data, w = h(pe), T = le(t), E = v(), [D, k] = B(!1), [A, N] = B({}), P = me?.data, F = i(m, "update", P, x.tenantId), he = P?.$statuses, ge = P?.$properties, _e = ue(t, o), ve = de(t, o), L = R(() => {
651
671
  let e = /* @__PURE__ */ new Set();
652
- for (let [t, n] of p.fields) r(n) && e.add(t);
653
- for (let [t] of p.files ?? []) e.add(t);
672
+ for (let [t, n] of m.fields) r(n) && e.add(t);
673
+ for (let [t] of m.files ?? []) e.add(t);
654
674
  return e;
655
- }, [p]), ge = F(() => {
656
- if (j) {
675
+ }, [m]), z = I(() => {
676
+ if (P) {
657
677
  let e = {};
658
- he.forEach((t) => {
659
- let n = v(p, j, t);
660
- e[t] = _(p, t) ? n ?? null : n ?? "";
661
- }), A(e);
678
+ L.forEach((t) => {
679
+ let n = y(m, P, t);
680
+ e[t] = se(m, t) ? n ?? null : n ?? "";
681
+ }), N(e);
662
682
  }
663
- O(!0);
683
+ k(!0);
664
684
  }, [
665
- j,
666
- he,
667
- p
668
- ]), I = F(async () => {
669
- await E.flushAllDrafts(), O(!1), A({});
670
- }, [E]), R = F(() => {
671
- let e = {}, t = oe({
672
- entity: p,
673
- formData: k,
674
- record: j,
685
+ P,
686
+ L,
687
+ m
688
+ ]), be = I(async () => {
689
+ await E.flushAllDrafts(), k(!1), N({});
690
+ }, [E]), xe = I(() => {
691
+ let e = {}, t = C({
692
+ entity: m,
693
+ formData: A,
694
+ record: P,
675
695
  isNew: !1
676
- }), n = se(t);
677
- for (let [t, n] of Object.entries(k)) p.files?.has(t) || (e[t] = x(p, t, n));
678
- Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0 ? (O(!1), A({})) : T.mutate({
696
+ }), n = ce(t);
697
+ for (let [t, n] of Object.entries(A)) m.files?.has(t) || (e[t] = S(m, t, n));
698
+ Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0 ? (k(!1), N({})) : T.mutate({
679
699
  pkValues: o,
680
700
  data: e
681
701
  }, { onSuccess: () => {
682
- n.forEach((e) => E.markCommitted(e)), O(!1), A({});
702
+ n.forEach((e) => E.markCommitted(e)), k(!1), N({});
683
703
  } });
684
704
  }, [
685
705
  E,
686
706
  T,
687
707
  o,
688
- p,
689
- k,
690
- j
691
- ]), ve = F((e, t) => {
692
- A((n) => ({
708
+ m,
709
+ A,
710
+ P
711
+ ]), W = I((e, t) => {
712
+ N((n) => ({
693
713
  ...n,
694
714
  [e]: t
695
715
  }));
696
716
  }, []);
697
- if (le) return /* @__PURE__ */ B(ue, {});
698
- if (!j) return null;
699
- let ye = n(h, j, p), U = p.display?.display_field, W = ye ? void 0 : U ? j[U] : j[p.fields.names()[0]], G = ye || (W != null && typeof W != "object" ? e(W) : h(p.display.name)), K = j?.$refs, be = {
700
- schema: ee,
701
- entity: p,
717
+ if (w.loading) return /* @__PURE__ */ V(O, {});
718
+ if (!P && w.error !== null) return /* @__PURE__ */ H("p", {
719
+ role: "alert",
720
+ style: {
721
+ padding: 16,
722
+ color: "var(--danger)",
723
+ display: "flex",
724
+ alignItems: "center",
725
+ gap: 8
726
+ },
727
+ children: [
728
+ l(b, w.error),
729
+ " ",
730
+ /* @__PURE__ */ V(p, { onRetry: w.retry })
731
+ ]
732
+ });
733
+ if (!P) return null;
734
+ let Se = n(_, P, m), G = m.display?.display_field, K = Se ? void 0 : G ? P[G] : P[m.fields.names()[0]], Ce = Se || (K != null && typeof K != "object" ? e(K) : _(m.display.name)), q = P?.$refs, J = {
735
+ schema: te,
736
+ entity: m,
702
737
  entityCode: t,
703
738
  recordId: o,
704
739
  record: D ? {
705
- ...j,
706
- ...k
707
- } : j,
740
+ ...P,
741
+ ...A
742
+ } : P,
708
743
  isNew: !1,
709
744
  mode: D ? "edit" : "display",
710
- onFieldChange: D ? ve : void 0,
711
- refs: K,
712
- objectProperties: pe ?? void 0,
713
- onSetProperty: N ? (e, t) => me.mutate({
745
+ onFieldChange: D ? W : void 0,
746
+ refs: q,
747
+ objectProperties: ge ?? void 0,
748
+ onSetProperty: F ? (e, t) => ve.mutate({
714
749
  propertyCode: e,
715
750
  value: t
716
751
  }) : void 0,
717
- isPropertyPending: me.isPending,
718
- objectStatuses: fe ?? void 0,
719
- onSetStatus: N ? (e, t) => P.mutate({
752
+ isPropertyPending: ve.isPending,
753
+ objectStatuses: he ?? void 0,
754
+ onSetStatus: F ? (e, t) => _e.mutate({
720
755
  groupCode: e,
721
756
  statusCode: t
722
757
  }) : void 0,
723
- isStatusPending: P.isPending,
724
- relatedRecordsPresentation: ae
758
+ isStatusPending: _e.isPending,
759
+ relatedRecordsPresentation: oe
725
760
  };
726
- return /* @__PURE__ */ V("div", {
761
+ return /* @__PURE__ */ H("div", {
727
762
  style: {
728
763
  display: "flex",
729
764
  flexDirection: "column",
730
765
  height: "100%"
731
766
  },
732
- children: [/* @__PURE__ */ V("div", {
767
+ children: [/* @__PURE__ */ H("div", {
733
768
  style: {
734
769
  display: "flex",
735
770
  alignItems: "center",
736
771
  justifyContent: "space-between",
737
772
  paddingTop: 10,
738
773
  paddingBottom: 10,
739
- ...ne(16),
774
+ ...re(16),
740
775
  borderBottom: "1px solid var(--divider)",
741
776
  position: "sticky",
742
777
  top: 0,
743
778
  background: "var(--surface)",
744
779
  zIndex: 10
745
780
  },
746
- children: [/* @__PURE__ */ B("h2", {
781
+ children: [/* @__PURE__ */ V("h2", {
747
782
  style: {
748
783
  margin: 0,
749
784
  fontSize: 13,
@@ -753,67 +788,67 @@ function q({ entityCode: t, recordId: o, items: s, schema: ee, entity: p, onBack
753
788
  whiteSpace: "nowrap",
754
789
  color: "var(--text)"
755
790
  },
756
- children: G
757
- }), /* @__PURE__ */ V("div", {
791
+ children: Ce
792
+ }), /* @__PURE__ */ H("div", {
758
793
  style: {
759
794
  display: "flex",
760
795
  alignItems: "center",
761
796
  gap: 6
762
797
  },
763
798
  children: [
764
- re && /* @__PURE__ */ B(d, {
765
- icon: /* @__PURE__ */ B(l.back, { size: 14 }),
766
- title: h("list.detail.back_to_list", "Back to list"),
767
- onClick: re
768
- }),
769
- ie && /* @__PURE__ */ B(d, {
770
- icon: /* @__PURE__ */ B(l.filter, { size: 14 }),
771
- title: h("filter.drawer.title", "Filters"),
799
+ ie && /* @__PURE__ */ V(ee, {
800
+ icon: /* @__PURE__ */ V(u.back, { size: 14 }),
801
+ title: _("list.detail.back_to_list", "Back to list"),
772
802
  onClick: ie
773
803
  }),
774
- N && (D ? /* @__PURE__ */ V(_e, { children: [/* @__PURE__ */ B(u, {
804
+ ae && /* @__PURE__ */ V(ee, {
805
+ icon: /* @__PURE__ */ V(u.filter, { size: 14 }),
806
+ title: _("filter.drawer.title", "Filters"),
807
+ onClick: ae
808
+ }),
809
+ F && (D ? /* @__PURE__ */ H(ye, { children: [/* @__PURE__ */ V(d, {
775
810
  size: "xs",
776
- icon: /* @__PURE__ */ B(l.x, { size: 12 }),
777
- onClick: I,
778
- children: h("dialog.cancel", "Cancel")
779
- }), /* @__PURE__ */ B(u, {
811
+ icon: /* @__PURE__ */ V(u.x, { size: 12 }),
812
+ onClick: be,
813
+ children: _("dialog.cancel", "Cancel")
814
+ }), /* @__PURE__ */ V(d, {
780
815
  kind: "primary",
781
816
  size: "xs",
782
- icon: T.isPending ? /* @__PURE__ */ B(te, { size: 12 }) : /* @__PURE__ */ B(l.save, { size: 12 }),
783
- onClick: R,
817
+ icon: T.isPending ? /* @__PURE__ */ V(ne, { size: 12 }) : /* @__PURE__ */ V(u.save, { size: 12 }),
818
+ onClick: xe,
784
819
  disabled: T.isPending,
785
- children: T.isPending ? h("dialog.saving", "Saving…") : h("dialog.save", "Save")
786
- })] }) : /* @__PURE__ */ B(u, {
820
+ children: T.isPending ? _("dialog.saving", "Saving…") : _("dialog.save", "Save")
821
+ })] }) : /* @__PURE__ */ V(d, {
787
822
  size: "xs",
788
- icon: /* @__PURE__ */ B(l.edit, { size: 12 }),
789
- onClick: ge,
790
- children: h("list.record.edit", "Edit")
823
+ icon: /* @__PURE__ */ V(u.edit, { size: 12 }),
824
+ onClick: z,
825
+ children: _("list.record.edit", "Edit")
791
826
  }))
792
827
  ]
793
828
  })]
794
- }), /* @__PURE__ */ B("div", {
829
+ }), /* @__PURE__ */ V("div", {
795
830
  style: {
796
831
  flex: 1,
797
832
  overflowY: "auto",
798
833
  paddingTop: 16,
799
834
  paddingBottom: 16,
800
- ...ne(16),
835
+ ...re(16),
801
836
  display: "flex",
802
837
  flexDirection: "column",
803
838
  gap: 12
804
839
  },
805
- children: s && s.length > 0 ? /* @__PURE__ */ B(de, {
840
+ children: s && s.length > 0 ? /* @__PURE__ */ V(M, {
806
841
  nodes: s,
807
- ctx: be
808
- }) : /* @__PURE__ */ B("p", {
842
+ ctx: J
843
+ }) : /* @__PURE__ */ V("p", {
809
844
  style: {
810
845
  fontSize: 12.5,
811
846
  color: "var(--text-3)"
812
847
  },
813
- children: c(h("list.detail.no_layout", "No layout configured. Add {key} to the screen definition."), { key: /* @__PURE__ */ B("code", { children: H }) })
848
+ children: c(_("list.detail.no_layout", "No layout configured. Add {key} to the screen definition."), { key: /* @__PURE__ */ V("code", { children: U }) })
814
849
  })
815
850
  })]
816
851
  });
817
852
  }
818
853
  //#endregion
819
- export { U as SmartRecordListPage };
854
+ export { W as SmartRecordListPage };