@declarion/react 0.59.2 → 0.61.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/{AgentChatPanel.impl-DBH1Ff4G.js → AgentChatPanel.impl-rgkewyMl.js} +40 -40
- package/dist-lib/{DetailAuditStrip-9eJM2Fml.js → DetailAuditStrip-CSXZoy7v.js} +12 -12
- package/dist-lib/{DraggableChildrenTable-4RZC351U.js → DraggableChildrenTable-DruYOxKm.js} +35 -35
- package/dist-lib/{Grid-CQabaBLx.js → Grid-Dsf3I0xG.js} +3 -3
- package/dist-lib/{LayoutRenderer-DGKWZKpW.js → LayoutRenderer-QN7Wp2W6.js} +465 -465
- package/dist-lib/{ListCardsBody-DfGmyNIu.js → ListCardsBody-CNaZ0xwz.js} +27 -27
- package/dist-lib/{MarkdownRenderer-BDbzDv_y.js → MarkdownRenderer-BuO5hYJh.js} +2 -2
- package/dist-lib/{RefreshControl-Bhoib0ZA.js → RefreshControl-DO9rYcdq.js} +27 -27
- package/dist-lib/{SmartDetailPage.impl-DFjz29Ff.js → SmartDetailPage.impl-DFIIx80b.js} +471 -471
- package/dist-lib/SmartListPage.impl-D694R32H.js +3051 -0
- package/dist-lib/SmartRecordListPage.impl-CB5cuQJV.js +780 -0
- package/dist-lib/{SortHeaderMenu-Cijxk4cX.js → SortHeaderMenu-BV-aQbPy.js} +2 -2
- package/dist-lib/{action-dispatch-DY0c8U81.js → action-dispatch-gWmOYjOP.js} +189 -189
- package/dist-lib/api/data.d.ts +5 -1
- package/dist-lib/{cardProjection-Bkl2SSYz.js → cardProjection-BnmWukxk.js} +1 -1
- package/dist-lib/components/pages/list/filter-meta.d.ts +1 -1
- package/dist-lib/components/pages/list/useActiveView.d.ts +9 -2
- package/dist-lib/components/pages/list/useListViews.d.ts +3 -2
- package/dist-lib/components/primitives/Fields.d.ts +3 -1
- package/dist-lib/{failure-v-uGSpbX.js → failure-BUxXuP4c.js} +6 -6
- package/dist-lib/{format-count-DA4wmmWR.js → format-count-bXVfHzbI.js} +247 -247
- package/dist-lib/hooks/useObject.d.ts +3 -2
- package/dist-lib/index.js +1055 -1047
- package/dist-lib/lib/field-classification.d.ts +10 -1
- package/dist-lib/{peekDraftStore-D-cTbiIr.js → peekDraftStore-Dk1Ha5u3.js} +7 -7
- package/dist-lib/{registry-Cb3W-czW.js → registry-nSeHd5si.js} +445 -439
- package/dist-lib/testing.js +3 -3
- package/dist-lib/types/api.d.ts +0 -1
- package/dist-lib/{useAgentConversation-D97IqE-J.js → useAgentConversation-nT5UypJX.js} +15 -15
- package/dist-lib/{useCurrentScreen-BL5NZFCw.js → useCurrentScreen-0WBj7wT6.js} +1176 -1090
- package/dist-lib/{useListQuery-BG1GyKtJ.js → useListQuery-C7dq_sEo.js} +5 -5
- package/dist-lib/{field-classification-C28XE-_P.js → useOwnRefresh-q80kCMMh.js} +134 -160
- package/dist-lib/{useProperties-4Lg3odrt.js → useProperties-CeGKtq7Q.js} +3 -3
- package/dist-lib/{useTabSearchMirror-ZVLlINBX.js → useTabSearchMirror-CzNAj82Q.js} +2 -2
- package/dist-lib/{useText-BFDCTUSo.js → useText-BsedsJ-J.js} +2 -2
- package/dist-lib/{value-By1-WJ8J.js → value-Dwfyghtj.js} +1 -1
- package/package.json +9 -9
- package/dist-lib/SmartListPage.impl-BrZLE_Gb.js +0 -3046
- 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-0WBj7wT6.js";
|
|
3
|
+
import { d as g, f as ne, t as _ } from "./useText-BsedsJ-J.js";
|
|
4
|
+
import { c as v } from "./registry-nSeHd5si.js";
|
|
5
|
+
import { C as y, S as b, c as x, l as re, n as S, x as C } from "./useOwnRefresh-q80kCMMh.js";
|
|
6
|
+
import { f as w, h as T, p as E, u as D } from "./action-dispatch-gWmOYjOP.js";
|
|
7
|
+
import { n as O, r as k } from "./useProperties-CeGKtq7Q.js";
|
|
8
|
+
import { c as A, f as j, h as M, m as N, n as P, t as F } from "./useTabSearchMirror-CzNAj82Q.js";
|
|
9
|
+
import { t as I } from "./LayoutRenderer-QN7Wp2W6.js";
|
|
10
|
+
import { n as L, t as ie } from "./cardProjection-BnmWukxk.js";
|
|
11
|
+
import { t as ae } from "./useListQuery-C7dq_sEo.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 };
|