@declarion/react 0.59.0 → 0.60.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 (36) hide show
  1. package/dist-lib/{AgentChatPanel.impl-DBH1Ff4G.js → AgentChatPanel.impl-BY-Ir7Sh.js} +39 -39
  2. package/dist-lib/{DetailAuditStrip-GNRA_eP5.js → DetailAuditStrip-B9p1XhjC.js} +26 -27
  3. package/dist-lib/{DraggableChildrenTable-4RZC351U.js → DraggableChildrenTable-CtL7rdT6.js} +34 -34
  4. package/dist-lib/{Grid-CQabaBLx.js → Grid-CYERLdXO.js} +1 -1
  5. package/dist-lib/{LayoutRenderer-DGKWZKpW.js → LayoutRenderer-B08IJKsZ.js} +465 -465
  6. package/dist-lib/{ListCardsBody-DfGmyNIu.js → ListCardsBody-Dje_rays.js} +26 -26
  7. package/dist-lib/{MarkdownRenderer-BDbzDv_y.js → MarkdownRenderer-N0IWjTH5.js} +1 -1
  8. package/dist-lib/{RefreshControl-Bhoib0ZA.js → RefreshControl-BEWSHtAC.js} +26 -26
  9. package/dist-lib/{SmartDetailPage.impl-Ds2RGg6K.js → SmartDetailPage.impl-CYiM-ITJ.js} +467 -467
  10. package/dist-lib/SmartListPage.impl-Db_Pv9Xc.js +3051 -0
  11. package/dist-lib/SmartRecordListPage.impl-hbbLglC1.js +780 -0
  12. package/dist-lib/{SortHeaderMenu-Cijxk4cX.js → SortHeaderMenu-DKKeCGTH.js} +1 -1
  13. package/dist-lib/{action-dispatch-DY0c8U81.js → action-dispatch-DbiOpvd6.js} +187 -187
  14. package/dist-lib/api/data.d.ts +5 -1
  15. package/dist-lib/{cardProjection-Bkl2SSYz.js → cardProjection-nveYLvHR.js} +1 -1
  16. package/dist-lib/components/chrome/headerActionZone.d.ts +27 -0
  17. package/dist-lib/components/pages/list/filter-meta.d.ts +1 -1
  18. package/dist-lib/components/pages/list/useActiveView.d.ts +9 -2
  19. package/dist-lib/components/pages/list/useListViews.d.ts +3 -2
  20. package/dist-lib/{failure-v-uGSpbX.js → failure-BT54OLHy.js} +5 -5
  21. package/dist-lib/{format-count-DA4wmmWR.js → format-count-DLFCdtME.js} +246 -246
  22. package/dist-lib/hooks/useObject.d.ts +3 -2
  23. package/dist-lib/index.js +1083 -1091
  24. package/dist-lib/lib/field-classification.d.ts +10 -1
  25. package/dist-lib/{peekDraftStore-D-cTbiIr.js → peekDraftStore-DSExeoAh.js} +6 -6
  26. package/dist-lib/{registry-Cb3W-czW.js → registry-CRPxNbkk.js} +444 -438
  27. package/dist-lib/testing.js +2 -2
  28. package/dist-lib/{useAgentConversation-D97IqE-J.js → useAgentConversation-BavrHfrU.js} +14 -14
  29. package/dist-lib/{useCurrentScreen-BL5NZFCw.js → useCurrentScreen-BPq7HMF1.js} +1083 -1017
  30. package/dist-lib/{useListQuery-BG1GyKtJ.js → useListQuery-CG1WM4cv.js} +5 -5
  31. package/dist-lib/{field-classification-C28XE-_P.js → useOwnRefresh-C18iWRgr.js} +132 -158
  32. package/dist-lib/{useProperties-4Lg3odrt.js → useProperties-C35JrjwQ.js} +2 -2
  33. package/dist-lib/{useTabSearchMirror-ZVLlINBX.js → useTabSearchMirror-DKktWWLB.js} +1 -1
  34. package/package.json +1 -1
  35. package/dist-lib/SmartListPage.impl-BrZLE_Gb.js +0 -3046
  36. package/dist-lib/SmartRecordListPage.impl-C1FJLr80.js +0 -780
@@ -0,0 +1,780 @@
1
+ import { s as e } from "./DynamicIcon-DW5krHuX.js";
2
+ import { At as t, Dn as n, Jn as r, Mt as i, On as a, Ot as o, Rn as s, Tn as c, Vn as l, ct as u, fn as d, gn as f, ot as p, qn as ee, sn as te, un as m, v as h } from "./useCurrentScreen-BPq7HMF1.js";
3
+ import { d as g, f as ne, t as _ } from "./useText-BFDCTUSo.js";
4
+ import { c as v } from "./registry-CRPxNbkk.js";
5
+ import { C as y, S as b, c as x, l as re, n as S, x as C } from "./useOwnRefresh-C18iWRgr.js";
6
+ import { f as w, h as T, p as E, u as D } from "./action-dispatch-DbiOpvd6.js";
7
+ import { n as O, r as k } from "./useProperties-C35JrjwQ.js";
8
+ import { c as A, f as j, h as M, m as N, n as P, t as F } from "./useTabSearchMirror-DKktWWLB.js";
9
+ import { t as I } from "./LayoutRenderer-B08IJKsZ.js";
10
+ import { n as L, t as ie } from "./cardProjection-nveYLvHR.js";
11
+ import { t as ae } from "./useListQuery-CG1WM4cv.js";
12
+ import { useCallback as R, useEffect as z, useMemo as B, useRef as V, useState as oe } from "react";
13
+ import { useSearchParams as se } from "react-router";
14
+ import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
15
+ //#region src/components/pages/SmartRecordListPage.impl.tsx
16
+ var ce = 200, le = "items:";
17
+ function G({ screenCode: r }) {
18
+ let a = _(), s = _("errors"), [c, u] = se(), { data: d } = ne(), p = f(), g = d?.screens[r], v = g?.entity ? d?.entities[g.entity] : void 0, b = g?.entity;
19
+ P(g, v, c.toString()), F(g?.route);
20
+ let x = re(), S = c.get("selected") ?? null, C = c.get("search") ?? "", w = i(C, 300), T = c.get("sort") ?? t(v, g?.sort_default) ?? "", E = B(() => j(c), [c]), D = E.filters.length > 0 ? E.filters : void 0, O = B(() => g?.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) ?? [], [g?.columns, v]), k = B(() => {
21
+ let e = g?.responsive?.[p.category]?.presentation;
22
+ return p.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
23
+ }, [g?.responsive, p.category]), I = B(() => {
24
+ let e = g?.responsive?.[p.category];
25
+ 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";
26
+ }, [g?.responsive, p.category]), le = g?.responsive?.[p.category]?.layout?.related_records, G = B(() => ie({
27
+ entity: v,
28
+ screen: g
29
+ }), [v, g]), K = B(() => L({
30
+ entity: v,
31
+ screen: g,
32
+ presentation: I,
33
+ visibleColumns: O,
34
+ card: G,
35
+ sort: T
36
+ }), [
37
+ v,
38
+ g,
39
+ I,
40
+ O,
41
+ G,
42
+ T
43
+ ]), q = ae({
44
+ entity: v,
45
+ entityCode: b,
46
+ screen: g,
47
+ screenCode: r,
48
+ page: 1,
49
+ perPage: ce,
50
+ sortForRequest: h(T),
51
+ debouncedSearch: w,
52
+ filters: E.filters,
53
+ includeDeleted: !1,
54
+ expand: K.expandFields,
55
+ select: K.selectFields,
56
+ isHeld: !1,
57
+ retryHeld: () => void 0,
58
+ runCountQuery: !1,
59
+ urlKey: `${b ?? ""}|${c.toString()}`
60
+ }), J = q.rows, de = q.refs, fe = q.isLoading, pe = B(() => v?.fields.names().find((e) => v.fields.get(e)?.primary) ?? "id", [v]), me = R((e, t) => {
61
+ u((t) => {
62
+ let n = new URLSearchParams(t);
63
+ return e ? n.set("selected", e) : n.delete("selected"), n;
64
+ }, { replace: t?.replace ?? !0 });
65
+ }, [u]), he = R((e) => {
66
+ u((t) => {
67
+ let n = new URLSearchParams(t);
68
+ return e ? n.set("search", e) : n.delete("search"), n;
69
+ }, { replace: !0 });
70
+ }, [u]), ge = R((e, t) => {
71
+ u((n) => {
72
+ let r = new URLSearchParams(n), i = j(n).filters, a;
73
+ return a = t && t !== "__all__" ? [...N(i, e), A(e, t)] : N(i, e), M(a, r), r;
74
+ }, { replace: !0 });
75
+ }, [u]), X = (g?.list_resizable ?? !1) && k === "split" && p.category !== "phone" && !p.touch, _e = V(null), [Z, Q] = oe(null), ve = V(!1), $ = g?.list_width;
76
+ z(() => {
77
+ X && $?.endsWith("%") && Q(null);
78
+ }, [
79
+ X,
80
+ $,
81
+ p.width,
82
+ p.height
83
+ ]), z(() => {
84
+ if (!X || Z !== null) return;
85
+ let e = _e.current;
86
+ if (e) {
87
+ if ($ && $.endsWith("%")) {
88
+ let t = parseFloat($) / 100;
89
+ Q(Math.round(e.getBoundingClientRect().width * t));
90
+ } else Q($ && parseInt($, 10) || 320);
91
+ }
92
+ }, [
93
+ X,
94
+ $,
95
+ Z,
96
+ v
97
+ ]);
98
+ let ye = V(null);
99
+ z(() => () => {
100
+ ye.current?.();
101
+ }, []);
102
+ let be = R((e) => {
103
+ e.preventDefault(), ve.current = !0;
104
+ let t = e.clientX, n = Z ?? 320, r = (e) => {
105
+ if (!ve.current) return;
106
+ let r = (_e.current?.getBoundingClientRect().width ?? window.innerWidth) - 300, i = Math.max(200, Math.min(r, n + e.clientX - t));
107
+ Q(i);
108
+ }, i = () => {
109
+ ve.current = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i), document.body.style.cursor = "", document.body.style.userSelect = "", ye.current = null;
110
+ };
111
+ document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), ye.current = i;
112
+ }, [Z]);
113
+ if (!d || !g || !v) return null;
114
+ let xe = D?.length ?? 0, Se = k === "split" || k === "stacked" || !S, Ce = k === "split" || k === "stacked" || !!S, we = k !== "split" && S ? () => me(null, { replace: !0 }) : void 0, Te = k === "split" ? X && Z !== null ? Z : g.list_width ?? "320px" : "100%";
115
+ return /* @__PURE__ */ W("div", {
116
+ ref: _e,
117
+ "data-record-list-presentation": k,
118
+ style: {
119
+ display: "flex",
120
+ flexDirection: k === "stacked" ? "column" : "row",
121
+ height: "100%",
122
+ minWidth: 0,
123
+ overflow: "hidden"
124
+ },
125
+ children: [
126
+ Se && /* @__PURE__ */ W("div", {
127
+ "data-testid": "record-list-panel",
128
+ style: {
129
+ flex: k === "split" ? "none" : "1 1 auto",
130
+ display: "flex",
131
+ flexDirection: "column",
132
+ overflow: "hidden",
133
+ borderRight: k === "split" && !X ? "1px solid var(--divider)" : "none",
134
+ borderBottom: k === "stacked" ? "1px solid var(--divider)" : "none",
135
+ width: Te,
136
+ minWidth: 0,
137
+ height: k === "stacked" ? "50%" : "100%"
138
+ },
139
+ children: [/* @__PURE__ */ W("div", {
140
+ style: {
141
+ paddingTop: 12,
142
+ paddingBottom: 12,
143
+ ...y(12),
144
+ display: "flex",
145
+ flexDirection: "column",
146
+ gap: 8,
147
+ borderBottom: "1px solid var(--divider)"
148
+ },
149
+ children: [
150
+ x.hasOriginBack && /* @__PURE__ */ W("div", {
151
+ style: {
152
+ display: "flex",
153
+ alignItems: "center",
154
+ gap: 8
155
+ },
156
+ children: [/* @__PURE__ */ U(ee, {
157
+ icon: /* @__PURE__ */ U(e.back, { size: 14 }),
158
+ title: a("list.header.back", "Back"),
159
+ onClick: x.goBack
160
+ }), /* @__PURE__ */ U("span", {
161
+ style: {
162
+ fontSize: 12.5,
163
+ fontWeight: 600,
164
+ color: "var(--text)"
165
+ },
166
+ children: a(g.display?.name) || a(v.display.name_plural)
167
+ })]
168
+ }),
169
+ /* @__PURE__ */ U(m, {
170
+ value: C,
171
+ onChange: he,
172
+ placeholder: a("list.toolbar.search_placeholder", "Search {name}…", { name: a(v.display.name_plural) }),
173
+ prefix: /* @__PURE__ */ U(e.search, { size: 13 })
174
+ }),
175
+ E.error && /* @__PURE__ */ W("div", {
176
+ role: "alert",
177
+ "data-testid": "record-list-filter-url-error",
178
+ style: {
179
+ padding: "7px 9px",
180
+ border: "1px solid var(--danger)",
181
+ borderRadius: 6,
182
+ color: "var(--danger)",
183
+ fontSize: 11.5
184
+ },
185
+ children: [
186
+ s(E.errorCode ?? "", E.error),
187
+ " ",
188
+ a("list.filters.invalid_suffix", "Showing this list without URL filters.")
189
+ ]
190
+ }),
191
+ g.filters && g.filters.length > 0 && /* @__PURE__ */ U("div", {
192
+ style: {
193
+ display: "flex",
194
+ flexWrap: "wrap",
195
+ gap: 6
196
+ },
197
+ children: g.filters.map((e) => {
198
+ let t = v.fields.get(e);
199
+ if (!t?.values || !o(v, e)) return null;
200
+ let r = D?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", i = n(a, t, e, d.entities), s = [{
201
+ value: "__all__",
202
+ label: a("list.filters.all_values", "All {field}", { field: i })
203
+ }, ...t.values.map((e) => ({
204
+ value: e.code,
205
+ label: a(e.name) || e.code
206
+ }))];
207
+ return /* @__PURE__ */ U("div", {
208
+ style: { minWidth: 120 },
209
+ children: /* @__PURE__ */ U(te, {
210
+ value: r,
211
+ options: s,
212
+ onChange: (t) => ge(e, t),
213
+ placeholder: i
214
+ })
215
+ }, e);
216
+ })
217
+ }),
218
+ /* @__PURE__ */ W("div", {
219
+ style: {
220
+ display: "flex",
221
+ alignItems: "center",
222
+ justifyContent: "space-between",
223
+ fontSize: 11,
224
+ color: "var(--text-3)"
225
+ },
226
+ children: [/* @__PURE__ */ U("span", { children: fe ? a("list.records.loading", "Loading…") : a("list.records.count", "{count} {name}", {
227
+ count: J.length,
228
+ name: a(v.display.name_plural)
229
+ }) }), xe > 0 && /* @__PURE__ */ U("button", {
230
+ onClick: () => u((e) => {
231
+ let t = new URLSearchParams(e);
232
+ return t.delete("filters"), t;
233
+ }, { replace: !0 }),
234
+ style: {
235
+ background: "transparent",
236
+ border: 0,
237
+ color: "var(--accent)",
238
+ cursor: "pointer",
239
+ fontSize: 11,
240
+ textDecoration: "underline",
241
+ padding: 0
242
+ },
243
+ children: a("list.filters.clear", "Clear filters")
244
+ })]
245
+ })
246
+ ]
247
+ }), /* @__PURE__ */ U("div", {
248
+ style: {
249
+ flex: 1,
250
+ overflowY: "auto",
251
+ padding: I === "cards" ? 10 : 0,
252
+ display: I === "cards" ? "flex" : "block",
253
+ flexDirection: "column",
254
+ gap: I === "cards" ? 10 : void 0
255
+ },
256
+ children: fe ? /* @__PURE__ */ U("div", {
257
+ style: {
258
+ padding: 12,
259
+ display: "flex",
260
+ flexDirection: "column",
261
+ gap: 6
262
+ },
263
+ children: Array.from({ length: 8 }).map((e, t) => /* @__PURE__ */ U("div", { style: {
264
+ height: 48,
265
+ borderRadius: 6,
266
+ background: "var(--surface-3)"
267
+ } }, t))
268
+ }) : J.length === 0 ? /* @__PURE__ */ U("div", {
269
+ style: {
270
+ padding: 28,
271
+ textAlign: "center",
272
+ fontSize: 12.5,
273
+ color: "var(--text-3)"
274
+ },
275
+ children: a("list.records.none", "No records found")
276
+ }) : /* @__PURE__ */ W(H, { children: [J.map((e) => {
277
+ let t = l(e[pe]);
278
+ return /* @__PURE__ */ U(ue, {
279
+ record: e,
280
+ entity: v,
281
+ columns: O,
282
+ card: G,
283
+ presentation: I,
284
+ refs: de,
285
+ isSelected: t === S,
286
+ onClick: () => me(t, { replace: k === "split" })
287
+ }, t);
288
+ }), q.isCursor && q.hasMorePages && /* @__PURE__ */ U("button", {
289
+ type: "button",
290
+ "data-testid": "record-list-load-more",
291
+ onClick: q.fetchNextPage,
292
+ disabled: q.isFetchingNextPage,
293
+ style: {
294
+ width: "100%",
295
+ padding: "8px 12px",
296
+ fontSize: 12,
297
+ background: "transparent",
298
+ border: "none",
299
+ borderTop: "1px solid var(--divider)",
300
+ color: "var(--text-2)",
301
+ cursor: q.isFetchingNextPage ? "default" : "pointer"
302
+ },
303
+ children: q.isFetchingNextPage ? a("list.records.loading", "Loading…") : a("list.footer.load_more", "Load more")
304
+ })] })
305
+ })]
306
+ }),
307
+ X && /* @__PURE__ */ U("div", {
308
+ "data-testid": "record-list-resize-handle",
309
+ onMouseDown: be,
310
+ style: {
311
+ flex: "none",
312
+ width: 1,
313
+ cursor: "col-resize",
314
+ background: "var(--divider)",
315
+ transition: "background-color .12s"
316
+ },
317
+ onMouseEnter: (e) => e.currentTarget.style.background = "var(--border-strong)",
318
+ onMouseLeave: (e) => e.currentTarget.style.background = "var(--divider)"
319
+ }),
320
+ Ce && /* @__PURE__ */ U("div", {
321
+ "data-testid": "record-detail-panel",
322
+ style: {
323
+ flex: 1,
324
+ minWidth: 0,
325
+ overflow: "hidden",
326
+ height: k === "stacked" ? "50%" : "100%"
327
+ },
328
+ children: S ? /* @__PURE__ */ U(Y, {
329
+ entityCode: b,
330
+ recordId: S,
331
+ items: g.items,
332
+ schema: d,
333
+ entity: v,
334
+ onBackToList: we,
335
+ relatedRecordsPresentation: le
336
+ }, S) : /* @__PURE__ */ U("div", {
337
+ style: {
338
+ display: "flex",
339
+ alignItems: "center",
340
+ justifyContent: "center",
341
+ height: "100%",
342
+ color: "var(--text-3)"
343
+ },
344
+ children: /* @__PURE__ */ U("p", {
345
+ style: { fontSize: 12.5 },
346
+ children: a("list.detail.select_prompt", "Select a {name} to view details", { name: a(v.display.name) })
347
+ })
348
+ })
349
+ })
350
+ ]
351
+ });
352
+ }
353
+ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a, isSelected: o, onClick: s }) {
354
+ let c = _();
355
+ if (i === "cards") {
356
+ let n = r.badgeFields.filter((n) => K(t, e, n)), i = r.bodyFields.filter((n) => K(t, e, n)), l = r.metaFields.filter((n) => K(t, e, n));
357
+ return /* @__PURE__ */ W("button", {
358
+ type: "button",
359
+ "data-testid": "record-list-card",
360
+ "aria-current": o ? "true" : void 0,
361
+ onClick: s,
362
+ style: {
363
+ width: "100%",
364
+ textAlign: "left",
365
+ padding: 12,
366
+ border: "1px solid var(--border)",
367
+ borderRadius: 8,
368
+ background: o ? "var(--row-selected-bg)" : "var(--surface)",
369
+ color: "var(--text)",
370
+ cursor: "pointer",
371
+ display: "flex",
372
+ flexDirection: "column",
373
+ gap: 8,
374
+ boxShadow: o ? "inset 3px 0 0 var(--accent)" : "none"
375
+ },
376
+ children: [
377
+ /* @__PURE__ */ U(q, {
378
+ entity: t,
379
+ record: e,
380
+ field: r.titleField,
381
+ refs: a
382
+ }),
383
+ r.subtitleField && /* @__PURE__ */ U("div", {
384
+ style: {
385
+ fontSize: 12,
386
+ color: "var(--text-3)",
387
+ overflowWrap: "anywhere"
388
+ },
389
+ children: E({
390
+ entity: t,
391
+ fieldName: r.subtitleField,
392
+ record: e,
393
+ mode: "display",
394
+ refs: a,
395
+ t: c
396
+ })
397
+ }),
398
+ n.length > 0 && /* @__PURE__ */ U("div", {
399
+ style: {
400
+ display: "flex",
401
+ flexWrap: "wrap",
402
+ gap: 6
403
+ },
404
+ children: n.map((n) => /* @__PURE__ */ U("span", {
405
+ style: {
406
+ border: "1px solid var(--border)",
407
+ borderRadius: 999,
408
+ padding: "2px 7px",
409
+ fontSize: 11,
410
+ color: "var(--text-2)",
411
+ maxWidth: "100%",
412
+ overflowWrap: "anywhere"
413
+ },
414
+ children: E({
415
+ entity: t,
416
+ fieldName: n,
417
+ record: e,
418
+ mode: "display",
419
+ refs: a,
420
+ t: c
421
+ })
422
+ }, n))
423
+ }),
424
+ i.length > 0 && /* @__PURE__ */ U("dl", {
425
+ style: {
426
+ display: "grid",
427
+ gridTemplateColumns: "minmax(72px, max-content) minmax(0, 1fr)",
428
+ gap: "5px 10px",
429
+ margin: 0
430
+ },
431
+ children: i.map((n) => /* @__PURE__ */ U(J, {
432
+ entity: t,
433
+ record: e,
434
+ fieldName: n,
435
+ refs: a
436
+ }, n))
437
+ }),
438
+ l.length > 0 && /* @__PURE__ */ U("div", {
439
+ style: {
440
+ display: "flex",
441
+ flexWrap: "wrap",
442
+ gap: 8,
443
+ fontSize: 11,
444
+ color: "var(--text-3)"
445
+ },
446
+ children: l.map((n) => /* @__PURE__ */ U("span", {
447
+ style: {
448
+ minWidth: 0,
449
+ overflowWrap: "anywhere"
450
+ },
451
+ children: E({
452
+ entity: t,
453
+ fieldName: n,
454
+ record: e,
455
+ mode: "display",
456
+ refs: a,
457
+ t: c
458
+ })
459
+ }, n))
460
+ })
461
+ ]
462
+ });
463
+ }
464
+ let l = n[0], u = n[1], d = n.slice(2, 4);
465
+ return /* @__PURE__ */ W("button", {
466
+ onClick: s,
467
+ style: {
468
+ width: "100%",
469
+ textAlign: "left",
470
+ padding: "10px 12px",
471
+ borderBottom: "1px solid var(--divider)",
472
+ background: o ? "var(--row-selected-bg)" : "transparent",
473
+ borderLeft: o ? "2px solid var(--accent)" : "2px solid transparent",
474
+ cursor: "pointer",
475
+ transition: "background-color .12s",
476
+ display: "flex",
477
+ flexDirection: "column",
478
+ gap: 2,
479
+ border: "1px solid transparent",
480
+ borderBottomColor: "var(--divider)"
481
+ },
482
+ onMouseEnter: (e) => {
483
+ o || (e.currentTarget.style.background = "var(--surface-3)");
484
+ },
485
+ onMouseLeave: (e) => {
486
+ o || (e.currentTarget.style.background = "transparent");
487
+ },
488
+ children: [l && /* @__PURE__ */ U("div", {
489
+ style: {
490
+ fontSize: 12.5,
491
+ fontWeight: 500,
492
+ overflow: "hidden",
493
+ textOverflow: "ellipsis",
494
+ whiteSpace: "nowrap",
495
+ color: "var(--text)"
496
+ },
497
+ children: E({
498
+ entity: t,
499
+ fieldName: l,
500
+ record: e,
501
+ mode: "display",
502
+ refs: a,
503
+ t: c
504
+ })
505
+ }), /* @__PURE__ */ W("div", {
506
+ style: {
507
+ display: "flex",
508
+ alignItems: "center",
509
+ gap: 6
510
+ },
511
+ children: [u && /* @__PURE__ */ U("div", {
512
+ style: {
513
+ fontSize: 11,
514
+ color: "var(--text-3)",
515
+ flex: 1,
516
+ overflow: "hidden",
517
+ textOverflow: "ellipsis",
518
+ whiteSpace: "nowrap"
519
+ },
520
+ children: E({
521
+ entity: t,
522
+ fieldName: u,
523
+ record: e,
524
+ mode: "display",
525
+ refs: a,
526
+ t: c
527
+ })
528
+ }), /* @__PURE__ */ U("div", {
529
+ style: {
530
+ display: "flex",
531
+ alignItems: "center",
532
+ gap: 4,
533
+ flexShrink: 0
534
+ },
535
+ children: d.map((n) => w(t, e, n) == null ? null : /* @__PURE__ */ U("div", {
536
+ style: { fontSize: 11 },
537
+ children: E({
538
+ entity: t,
539
+ fieldName: n,
540
+ record: e,
541
+ mode: "display",
542
+ refs: a,
543
+ t: c
544
+ })
545
+ }, n))
546
+ })]
547
+ })]
548
+ });
549
+ }
550
+ function K(e, t, n) {
551
+ let r = w(e, t, n);
552
+ return !(r == null || r === "" || Array.isArray(r) && r.length === 0);
553
+ }
554
+ function q({ entity: e, record: t, field: n, refs: r }) {
555
+ let i = _(), o = a(i, t, e), s = n ? E({
556
+ entity: e,
557
+ fieldName: n,
558
+ record: t,
559
+ mode: "display",
560
+ refs: r,
561
+ t: i
562
+ }) : o;
563
+ return /* @__PURE__ */ U("div", {
564
+ style: {
565
+ fontSize: 13.5,
566
+ fontWeight: 600,
567
+ color: "var(--text)",
568
+ overflowWrap: "anywhere"
569
+ },
570
+ children: s || i(e.display.name)
571
+ });
572
+ }
573
+ function J({ entity: e, record: t, fieldName: r, refs: i }) {
574
+ let a = _(), o = w(e, t, r);
575
+ if (o == null || o === "") return null;
576
+ let s = e.fields.get(r);
577
+ return s ? /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("dt", {
578
+ style: {
579
+ color: "var(--text-3)",
580
+ fontSize: 11.5,
581
+ minWidth: 0,
582
+ overflowWrap: "anywhere"
583
+ },
584
+ children: n(a, s, r)
585
+ }), /* @__PURE__ */ U("dd", {
586
+ style: {
587
+ margin: 0,
588
+ color: "var(--text)",
589
+ fontSize: 12,
590
+ minWidth: 0,
591
+ overflowWrap: "anywhere"
592
+ },
593
+ children: E({
594
+ entity: e,
595
+ fieldName: r,
596
+ record: t,
597
+ mode: "display",
598
+ refs: i,
599
+ t: a
600
+ })
601
+ })] }) : null;
602
+ }
603
+ function Y({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList: a, relatedRecordsPresentation: o }) {
604
+ return /* @__PURE__ */ U(p, { children: /* @__PURE__ */ U(de, {
605
+ entityCode: e,
606
+ recordId: t,
607
+ items: n,
608
+ schema: r,
609
+ entity: i,
610
+ onBackToList: a,
611
+ relatedRecordsPresentation: o
612
+ }) });
613
+ }
614
+ function de({ entityCode: t, recordId: n, items: i, schema: o, entity: f, onBackToList: p, relatedRecordsPresentation: te }) {
615
+ let m = _(), h = c(f, "update"), ne = B(() => n ? s(f, n) : void 0, [n, f]), { data: re, isLoading: E } = v(t, ne), A = x(t), j = u(), [M, N] = oe(!1), [P, F] = oe({}), L = re?.data, ie = L?.$statuses, ae = L?.$properties, z = k(t, n), V = O(t, n), se = B(() => {
616
+ let e = /* @__PURE__ */ new Set();
617
+ for (let [t, n] of f.fields) !n.auto && !n.primary && e.add(t);
618
+ for (let [t] of f.files ?? []) e.add(t);
619
+ return e;
620
+ }, [f]), ce = R(() => {
621
+ if (L) {
622
+ let e = {};
623
+ se.forEach((t) => {
624
+ let n = w(f, L, t);
625
+ e[t] = D(f, t) ? n ?? null : n ?? "";
626
+ }), F(e);
627
+ }
628
+ N(!0);
629
+ }, [
630
+ L,
631
+ se,
632
+ f
633
+ ]), G = R(async () => {
634
+ await j.flushAllDrafts(), N(!1), F({});
635
+ }, [j]), ue = R(() => {
636
+ let e = {}, t = C({
637
+ entity: f,
638
+ formData: P,
639
+ record: L,
640
+ isNew: !1
641
+ }), r = b(t);
642
+ for (let [t, n] of Object.entries(P)) f.files?.has(t) || (e[t] = T(f, t, n));
643
+ if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0) {
644
+ N(!1), F({});
645
+ return;
646
+ }
647
+ A.mutate({
648
+ pkValues: n,
649
+ data: e
650
+ }, { onSuccess: () => {
651
+ r.forEach((e) => j.markCommitted(e)), N(!1), F({});
652
+ } });
653
+ }, [
654
+ j,
655
+ A,
656
+ n,
657
+ f,
658
+ P,
659
+ L
660
+ ]), K = R((e, t) => {
661
+ F((n) => ({
662
+ ...n,
663
+ [e]: t
664
+ }));
665
+ }, []);
666
+ if (E) return /* @__PURE__ */ U(S, {});
667
+ if (!L) return null;
668
+ let q = a(m, L, f), J = f.display?.display_field, Y = q ? void 0 : J ? L[J] : L[f.fields.names()[0]], de = q || (Y != null && typeof Y != "object" ? l(Y) : m(f.display.name)), fe = L?.$refs, pe = {
669
+ schema: o,
670
+ entity: f,
671
+ entityCode: t,
672
+ recordId: n,
673
+ record: M ? {
674
+ ...L,
675
+ ...P
676
+ } : L,
677
+ isNew: !1,
678
+ mode: M ? "edit" : "display",
679
+ onFieldChange: M ? K : void 0,
680
+ refs: fe,
681
+ objectProperties: ae ?? void 0,
682
+ onSetProperty: h ? (e, t) => V.mutate({
683
+ propertyCode: e,
684
+ value: t
685
+ }) : void 0,
686
+ isPropertyPending: V.isPending,
687
+ objectStatuses: ie ?? void 0,
688
+ onSetStatus: h ? (e, t) => z.mutate({
689
+ groupCode: e,
690
+ statusCode: t
691
+ }) : void 0,
692
+ isStatusPending: z.isPending,
693
+ relatedRecordsPresentation: te
694
+ };
695
+ return /* @__PURE__ */ W("div", {
696
+ style: {
697
+ display: "flex",
698
+ flexDirection: "column",
699
+ height: "100%"
700
+ },
701
+ children: [/* @__PURE__ */ W("div", {
702
+ style: {
703
+ display: "flex",
704
+ alignItems: "center",
705
+ justifyContent: "space-between",
706
+ paddingTop: 10,
707
+ paddingBottom: 10,
708
+ ...y(16),
709
+ borderBottom: "1px solid var(--divider)",
710
+ position: "sticky",
711
+ top: 0,
712
+ background: "var(--surface)",
713
+ zIndex: 10
714
+ },
715
+ children: [/* @__PURE__ */ U("h2", {
716
+ style: {
717
+ margin: 0,
718
+ fontSize: 13,
719
+ fontWeight: 600,
720
+ overflow: "hidden",
721
+ textOverflow: "ellipsis",
722
+ whiteSpace: "nowrap",
723
+ color: "var(--text)"
724
+ },
725
+ children: de
726
+ }), /* @__PURE__ */ W("div", {
727
+ style: {
728
+ display: "flex",
729
+ alignItems: "center",
730
+ gap: 6
731
+ },
732
+ children: [p && /* @__PURE__ */ U(ee, {
733
+ icon: /* @__PURE__ */ U(e.back, { size: 14 }),
734
+ title: m("list.detail.back_to_list", "Back to list"),
735
+ onClick: p
736
+ }), h && (M ? /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(r, {
737
+ size: "xs",
738
+ icon: /* @__PURE__ */ U(e.x, { size: 12 }),
739
+ onClick: G,
740
+ children: m("dialog.cancel", "Cancel")
741
+ }), /* @__PURE__ */ U(r, {
742
+ kind: "primary",
743
+ size: "xs",
744
+ icon: A.isPending ? /* @__PURE__ */ U(d, { size: 12 }) : /* @__PURE__ */ U(e.save, { size: 12 }),
745
+ onClick: ue,
746
+ disabled: A.isPending,
747
+ children: A.isPending ? m("dialog.saving", "Saving…") : m("dialog.save", "Save")
748
+ })] }) : /* @__PURE__ */ U(r, {
749
+ size: "xs",
750
+ icon: /* @__PURE__ */ U(e.edit, { size: 12 }),
751
+ onClick: ce,
752
+ children: m("list.record.edit", "Edit")
753
+ }))]
754
+ })]
755
+ }), /* @__PURE__ */ U("div", {
756
+ style: {
757
+ flex: 1,
758
+ overflowY: "auto",
759
+ paddingTop: 16,
760
+ paddingBottom: 16,
761
+ ...y(16),
762
+ display: "flex",
763
+ flexDirection: "column",
764
+ gap: 12
765
+ },
766
+ children: i && i.length > 0 ? /* @__PURE__ */ U(I, {
767
+ nodes: i,
768
+ ctx: pe
769
+ }) : /* @__PURE__ */ U("p", {
770
+ style: {
771
+ fontSize: 12.5,
772
+ color: "var(--text-3)"
773
+ },
774
+ children: g(m("list.detail.no_layout", "No layout configured. Add {key} to the screen definition."), { key: /* @__PURE__ */ U("code", { children: le }) })
775
+ })
776
+ })]
777
+ });
778
+ }
779
+ //#endregion
780
+ export { G as SmartRecordListPage };