@declarion/react 0.59.2 → 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.
- package/dist-lib/{AgentChatPanel.impl-DBH1Ff4G.js → AgentChatPanel.impl-BY-Ir7Sh.js} +39 -39
- package/dist-lib/{DetailAuditStrip-9eJM2Fml.js → DetailAuditStrip-B9p1XhjC.js} +11 -11
- package/dist-lib/{DraggableChildrenTable-4RZC351U.js → DraggableChildrenTable-CtL7rdT6.js} +34 -34
- package/dist-lib/{Grid-CQabaBLx.js → Grid-CYERLdXO.js} +1 -1
- package/dist-lib/{LayoutRenderer-DGKWZKpW.js → LayoutRenderer-B08IJKsZ.js} +465 -465
- package/dist-lib/{ListCardsBody-DfGmyNIu.js → ListCardsBody-Dje_rays.js} +26 -26
- package/dist-lib/{MarkdownRenderer-BDbzDv_y.js → MarkdownRenderer-N0IWjTH5.js} +1 -1
- package/dist-lib/{RefreshControl-Bhoib0ZA.js → RefreshControl-BEWSHtAC.js} +26 -26
- package/dist-lib/{SmartDetailPage.impl-DFjz29Ff.js → SmartDetailPage.impl-CYiM-ITJ.js} +470 -470
- package/dist-lib/SmartListPage.impl-Db_Pv9Xc.js +3051 -0
- package/dist-lib/SmartRecordListPage.impl-hbbLglC1.js +780 -0
- package/dist-lib/{SortHeaderMenu-Cijxk4cX.js → SortHeaderMenu-DKKeCGTH.js} +1 -1
- package/dist-lib/{action-dispatch-DY0c8U81.js → action-dispatch-DbiOpvd6.js} +187 -187
- package/dist-lib/api/data.d.ts +5 -1
- package/dist-lib/{cardProjection-Bkl2SSYz.js → cardProjection-nveYLvHR.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/{failure-v-uGSpbX.js → failure-BT54OLHy.js} +5 -5
- package/dist-lib/{format-count-DA4wmmWR.js → format-count-DLFCdtME.js} +246 -246
- package/dist-lib/hooks/useObject.d.ts +3 -2
- package/dist-lib/index.js +613 -613
- package/dist-lib/lib/field-classification.d.ts +10 -1
- package/dist-lib/{peekDraftStore-D-cTbiIr.js → peekDraftStore-DSExeoAh.js} +6 -6
- package/dist-lib/{registry-Cb3W-czW.js → registry-CRPxNbkk.js} +444 -438
- package/dist-lib/testing.js +2 -2
- package/dist-lib/{useAgentConversation-D97IqE-J.js → useAgentConversation-BavrHfrU.js} +14 -14
- package/dist-lib/{useCurrentScreen-BL5NZFCw.js → useCurrentScreen-BPq7HMF1.js} +1083 -1017
- package/dist-lib/{useListQuery-BG1GyKtJ.js → useListQuery-CG1WM4cv.js} +5 -5
- package/dist-lib/{field-classification-C28XE-_P.js → useOwnRefresh-C18iWRgr.js} +132 -158
- package/dist-lib/{useProperties-4Lg3odrt.js → useProperties-C35JrjwQ.js} +2 -2
- package/dist-lib/{useTabSearchMirror-ZVLlINBX.js → useTabSearchMirror-DKktWWLB.js} +1 -1
- package/package.json +1 -1
- package/dist-lib/SmartListPage.impl-BrZLE_Gb.js +0 -3046
- package/dist-lib/SmartRecordListPage.impl-C1FJLr80.js +0 -780
|
@@ -1,780 +0,0 @@
|
|
|
1
|
-
import { s as e } from "./DynamicIcon-DW5krHuX.js";
|
|
2
|
-
import { Ln as t, On as n, Rn as r, St as i, Zt as a, _n as o, ct as s, en as c, hn as l, jn as u, nn as d, on as f, ot as p, v as ee, vn as m } from "./useCurrentScreen-BL5NZFCw.js";
|
|
3
|
-
import { d as h, f as g, t as _ } from "./useText-BFDCTUSo.js";
|
|
4
|
-
import { c as v } from "./registry-Cb3W-czW.js";
|
|
5
|
-
import { A as te, O as y, g as b, h as ne, k as x, l as re } from "./field-classification-C28XE-_P.js";
|
|
6
|
-
import { f as S, h as C, p as w, u as ie } from "./action-dispatch-DY0c8U81.js";
|
|
7
|
-
import { n as T, r as E } from "./useProperties-4Lg3odrt.js";
|
|
8
|
-
import { c as ae, f as D, h as O, m as k, n as A, t as j } from "./useTabSearchMirror-ZVLlINBX.js";
|
|
9
|
-
import { t as M } from "./LayoutRenderer-DGKWZKpW.js";
|
|
10
|
-
import { n as N, t as P } from "./cardProjection-Bkl2SSYz.js";
|
|
11
|
-
import { t as F } from "./useListQuery-BG1GyKtJ.js";
|
|
12
|
-
import { useCallback as I, useEffect as L, useMemo as R, useRef as z, useState as oe } from "react";
|
|
13
|
-
import { useSearchParams as se } from "react-router";
|
|
14
|
-
import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
15
|
-
//#region src/components/pages/SmartRecordListPage.impl.tsx
|
|
16
|
-
var ce = 200, le = "items:";
|
|
17
|
-
function U({ screenCode: n }) {
|
|
18
|
-
let r = _(), s = _("errors"), [l, d] = se(), { data: p } = g(), m = f(), h = p?.screens[n], v = h?.entity ? p?.entities[h.entity] : void 0, y = h?.entity;
|
|
19
|
-
A(h, v, l.toString()), j(h?.route);
|
|
20
|
-
let ne = b(), x = l.get("selected") ?? null, re = l.get("search") ?? "", S = i(re, 300), C = l.get("sort") ?? h?.sort_default ?? "", w = R(() => D(l), [l]), ie = w.filters.length > 0 ? w.filters : void 0, T = R(() => h?.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) ?? [], [h?.columns, v]), E = R(() => {
|
|
21
|
-
let e = h?.responsive?.[m.category]?.presentation;
|
|
22
|
-
return m.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
|
|
23
|
-
}, [h?.responsive, m.category]), M = R(() => {
|
|
24
|
-
let e = h?.responsive?.[m.category];
|
|
25
|
-
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";
|
|
26
|
-
}, [h?.responsive, m.category]), le = h?.responsive?.[m.category]?.layout?.related_records, U = R(() => P({
|
|
27
|
-
entity: v,
|
|
28
|
-
screen: h
|
|
29
|
-
}), [v, h]), W = R(() => N({
|
|
30
|
-
entity: v,
|
|
31
|
-
screen: h,
|
|
32
|
-
presentation: M,
|
|
33
|
-
visibleColumns: T,
|
|
34
|
-
card: U,
|
|
35
|
-
sort: C
|
|
36
|
-
}), [
|
|
37
|
-
v,
|
|
38
|
-
h,
|
|
39
|
-
M,
|
|
40
|
-
T,
|
|
41
|
-
U,
|
|
42
|
-
C
|
|
43
|
-
]), G = F({
|
|
44
|
-
entity: v,
|
|
45
|
-
entityCode: y,
|
|
46
|
-
screen: h,
|
|
47
|
-
screenCode: n,
|
|
48
|
-
page: 1,
|
|
49
|
-
perPage: ce,
|
|
50
|
-
sortForRequest: ee(C),
|
|
51
|
-
debouncedSearch: S,
|
|
52
|
-
filters: w.filters,
|
|
53
|
-
includeDeleted: !1,
|
|
54
|
-
expand: W.expandFields,
|
|
55
|
-
select: W.selectFields,
|
|
56
|
-
isHeld: !1,
|
|
57
|
-
retryHeld: () => void 0,
|
|
58
|
-
runCountQuery: !1,
|
|
59
|
-
urlKey: `${y ?? ""}|${l.toString()}`
|
|
60
|
-
}), K = G.rows, q = G.refs, J = G.isLoading, fe = R(() => v?.fields.names().find((e) => v.fields.get(e)?.primary) ?? "id", [v]), pe = I((e, t) => {
|
|
61
|
-
d((t) => {
|
|
62
|
-
let n = new URLSearchParams(t);
|
|
63
|
-
return e ? n.set("selected", e) : n.delete("selected"), n;
|
|
64
|
-
}, { replace: t?.replace ?? !0 });
|
|
65
|
-
}, [d]), me = I((e) => {
|
|
66
|
-
d((t) => {
|
|
67
|
-
let n = new URLSearchParams(t);
|
|
68
|
-
return e ? n.set("search", e) : n.delete("search"), n;
|
|
69
|
-
}, { replace: !0 });
|
|
70
|
-
}, [d]), he = I((e, t) => {
|
|
71
|
-
d((n) => {
|
|
72
|
-
let r = new URLSearchParams(n), i = D(n).filters, a;
|
|
73
|
-
return a = t && t !== "__all__" ? [...k(i, e), ae(e, t)] : k(i, e), O(a, r), r;
|
|
74
|
-
}, { replace: !0 });
|
|
75
|
-
}, [d]), Y = (h?.list_resizable ?? !1) && E === "split" && m.category !== "phone" && !m.touch, ge = z(null), [X, Z] = oe(null), _e = z(!1), Q = h?.list_width;
|
|
76
|
-
L(() => {
|
|
77
|
-
Y && Q?.endsWith("%") && Z(null);
|
|
78
|
-
}, [
|
|
79
|
-
Y,
|
|
80
|
-
Q,
|
|
81
|
-
m.width,
|
|
82
|
-
m.height
|
|
83
|
-
]), L(() => {
|
|
84
|
-
if (!Y || X !== null) return;
|
|
85
|
-
let e = ge.current;
|
|
86
|
-
if (e) {
|
|
87
|
-
if (Q && Q.endsWith("%")) {
|
|
88
|
-
let t = parseFloat(Q) / 100;
|
|
89
|
-
Z(Math.round(e.getBoundingClientRect().width * t));
|
|
90
|
-
} else Z(Q && parseInt(Q, 10) || 320);
|
|
91
|
-
}
|
|
92
|
-
}, [
|
|
93
|
-
Y,
|
|
94
|
-
Q,
|
|
95
|
-
X,
|
|
96
|
-
v
|
|
97
|
-
]);
|
|
98
|
-
let $ = z(null);
|
|
99
|
-
L(() => () => {
|
|
100
|
-
$.current?.();
|
|
101
|
-
}, []);
|
|
102
|
-
let ve = I((e) => {
|
|
103
|
-
e.preventDefault(), _e.current = !0;
|
|
104
|
-
let t = e.clientX, n = X ?? 320, r = (e) => {
|
|
105
|
-
if (!_e.current) return;
|
|
106
|
-
let r = (ge.current?.getBoundingClientRect().width ?? window.innerWidth) - 300, i = Math.max(200, Math.min(r, n + e.clientX - t));
|
|
107
|
-
Z(i);
|
|
108
|
-
}, i = () => {
|
|
109
|
-
_e.current = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i), document.body.style.cursor = "", document.body.style.userSelect = "", $.current = null;
|
|
110
|
-
};
|
|
111
|
-
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), $.current = i;
|
|
112
|
-
}, [X]);
|
|
113
|
-
if (!p || !h || !v) return null;
|
|
114
|
-
let ye = ie?.length ?? 0, be = E === "split" || E === "stacked" || !x, xe = E === "split" || E === "stacked" || !!x, Se = E !== "split" && x ? () => pe(null, { replace: !0 }) : void 0, Ce = E === "split" ? Y && X !== null ? X : h.list_width ?? "320px" : "100%";
|
|
115
|
-
return /* @__PURE__ */ H("div", {
|
|
116
|
-
ref: ge,
|
|
117
|
-
"data-record-list-presentation": E,
|
|
118
|
-
style: {
|
|
119
|
-
display: "flex",
|
|
120
|
-
flexDirection: E === "stacked" ? "column" : "row",
|
|
121
|
-
height: "100%",
|
|
122
|
-
minWidth: 0,
|
|
123
|
-
overflow: "hidden"
|
|
124
|
-
},
|
|
125
|
-
children: [
|
|
126
|
-
be && /* @__PURE__ */ H("div", {
|
|
127
|
-
"data-testid": "record-list-panel",
|
|
128
|
-
style: {
|
|
129
|
-
flex: E === "split" ? "none" : "1 1 auto",
|
|
130
|
-
display: "flex",
|
|
131
|
-
flexDirection: "column",
|
|
132
|
-
overflow: "hidden",
|
|
133
|
-
borderRight: E === "split" && !Y ? "1px solid var(--divider)" : "none",
|
|
134
|
-
borderBottom: E === "stacked" ? "1px solid var(--divider)" : "none",
|
|
135
|
-
width: Ce,
|
|
136
|
-
minWidth: 0,
|
|
137
|
-
height: E === "stacked" ? "50%" : "100%"
|
|
138
|
-
},
|
|
139
|
-
children: [/* @__PURE__ */ H("div", {
|
|
140
|
-
style: {
|
|
141
|
-
paddingTop: 12,
|
|
142
|
-
paddingBottom: 12,
|
|
143
|
-
...te(12),
|
|
144
|
-
display: "flex",
|
|
145
|
-
flexDirection: "column",
|
|
146
|
-
gap: 8,
|
|
147
|
-
borderBottom: "1px solid var(--divider)"
|
|
148
|
-
},
|
|
149
|
-
children: [
|
|
150
|
-
ne.hasOriginBack && /* @__PURE__ */ H("div", {
|
|
151
|
-
style: {
|
|
152
|
-
display: "flex",
|
|
153
|
-
alignItems: "center",
|
|
154
|
-
gap: 8
|
|
155
|
-
},
|
|
156
|
-
children: [/* @__PURE__ */ V(t, {
|
|
157
|
-
icon: /* @__PURE__ */ V(e.back, { size: 14 }),
|
|
158
|
-
title: r("list.header.back", "Back"),
|
|
159
|
-
onClick: ne.goBack
|
|
160
|
-
}), /* @__PURE__ */ V("span", {
|
|
161
|
-
style: {
|
|
162
|
-
fontSize: 12.5,
|
|
163
|
-
fontWeight: 600,
|
|
164
|
-
color: "var(--text)"
|
|
165
|
-
},
|
|
166
|
-
children: r(h.display?.name) || r(v.display.name_plural)
|
|
167
|
-
})]
|
|
168
|
-
}),
|
|
169
|
-
/* @__PURE__ */ V(c, {
|
|
170
|
-
value: re,
|
|
171
|
-
onChange: me,
|
|
172
|
-
placeholder: r("list.toolbar.search_placeholder", "Search {name}…", { name: r(v.display.name_plural) }),
|
|
173
|
-
prefix: /* @__PURE__ */ V(e.search, { size: 13 })
|
|
174
|
-
}),
|
|
175
|
-
w.error && /* @__PURE__ */ H("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(w.errorCode ?? "", w.error),
|
|
187
|
-
" ",
|
|
188
|
-
r("list.filters.invalid_suffix", "Showing this list without URL filters.")
|
|
189
|
-
]
|
|
190
|
-
}),
|
|
191
|
-
h.filters && h.filters.length > 0 && /* @__PURE__ */ V("div", {
|
|
192
|
-
style: {
|
|
193
|
-
display: "flex",
|
|
194
|
-
flexWrap: "wrap",
|
|
195
|
-
gap: 6
|
|
196
|
-
},
|
|
197
|
-
children: h.filters.map((e) => {
|
|
198
|
-
let t = v.fields.get(e);
|
|
199
|
-
if (!t?.values) return null;
|
|
200
|
-
let n = ie?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", i = o(r, t, e, p.entities), s = [{
|
|
201
|
-
value: "__all__",
|
|
202
|
-
label: r("list.filters.all_values", "All {field}", { field: i })
|
|
203
|
-
}, ...t.values.map((e) => ({
|
|
204
|
-
value: e.code,
|
|
205
|
-
label: r(e.name) || e.code
|
|
206
|
-
}))];
|
|
207
|
-
return /* @__PURE__ */ V("div", {
|
|
208
|
-
style: { minWidth: 120 },
|
|
209
|
-
children: /* @__PURE__ */ V(a, {
|
|
210
|
-
value: n,
|
|
211
|
-
options: s,
|
|
212
|
-
onChange: (t) => he(e, t),
|
|
213
|
-
placeholder: i
|
|
214
|
-
})
|
|
215
|
-
}, e);
|
|
216
|
-
})
|
|
217
|
-
}),
|
|
218
|
-
/* @__PURE__ */ H("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__ */ V("span", { children: J ? r("list.records.loading", "Loading…") : r("list.records.count", "{count} {name}", {
|
|
227
|
-
count: K.length,
|
|
228
|
-
name: r(v.display.name_plural)
|
|
229
|
-
}) }), ye > 0 && /* @__PURE__ */ V("button", {
|
|
230
|
-
onClick: () => d((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: r("list.filters.clear", "Clear filters")
|
|
244
|
-
})]
|
|
245
|
-
})
|
|
246
|
-
]
|
|
247
|
-
}), /* @__PURE__ */ V("div", {
|
|
248
|
-
style: {
|
|
249
|
-
flex: 1,
|
|
250
|
-
overflowY: "auto",
|
|
251
|
-
padding: M === "cards" ? 10 : 0,
|
|
252
|
-
display: M === "cards" ? "flex" : "block",
|
|
253
|
-
flexDirection: "column",
|
|
254
|
-
gap: M === "cards" ? 10 : void 0
|
|
255
|
-
},
|
|
256
|
-
children: J ? /* @__PURE__ */ V("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__ */ V("div", { style: {
|
|
264
|
-
height: 48,
|
|
265
|
-
borderRadius: 6,
|
|
266
|
-
background: "var(--surface-3)"
|
|
267
|
-
} }, t))
|
|
268
|
-
}) : K.length === 0 ? /* @__PURE__ */ V("div", {
|
|
269
|
-
style: {
|
|
270
|
-
padding: 28,
|
|
271
|
-
textAlign: "center",
|
|
272
|
-
fontSize: 12.5,
|
|
273
|
-
color: "var(--text-3)"
|
|
274
|
-
},
|
|
275
|
-
children: r("list.records.none", "No records found")
|
|
276
|
-
}) : /* @__PURE__ */ H(B, { children: [K.map((e) => {
|
|
277
|
-
let t = u(e[fe]);
|
|
278
|
-
return /* @__PURE__ */ V(ue, {
|
|
279
|
-
record: e,
|
|
280
|
-
entity: v,
|
|
281
|
-
columns: T,
|
|
282
|
-
card: U,
|
|
283
|
-
presentation: M,
|
|
284
|
-
refs: q,
|
|
285
|
-
isSelected: t === x,
|
|
286
|
-
onClick: () => pe(t, { replace: E === "split" })
|
|
287
|
-
}, t);
|
|
288
|
-
}), G.isCursor && G.hasMorePages && /* @__PURE__ */ V("button", {
|
|
289
|
-
type: "button",
|
|
290
|
-
"data-testid": "record-list-load-more",
|
|
291
|
-
onClick: G.fetchNextPage,
|
|
292
|
-
disabled: G.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: G.isFetchingNextPage ? "default" : "pointer"
|
|
302
|
-
},
|
|
303
|
-
children: G.isFetchingNextPage ? r("list.records.loading", "Loading…") : r("list.footer.load_more", "Load more")
|
|
304
|
-
})] })
|
|
305
|
-
})]
|
|
306
|
-
}),
|
|
307
|
-
Y && /* @__PURE__ */ V("div", {
|
|
308
|
-
"data-testid": "record-list-resize-handle",
|
|
309
|
-
onMouseDown: ve,
|
|
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
|
-
xe && /* @__PURE__ */ V("div", {
|
|
321
|
-
"data-testid": "record-detail-panel",
|
|
322
|
-
style: {
|
|
323
|
-
flex: 1,
|
|
324
|
-
minWidth: 0,
|
|
325
|
-
overflow: "hidden",
|
|
326
|
-
height: E === "stacked" ? "50%" : "100%"
|
|
327
|
-
},
|
|
328
|
-
children: x ? /* @__PURE__ */ V(de, {
|
|
329
|
-
entityCode: y,
|
|
330
|
-
recordId: x,
|
|
331
|
-
items: h.items,
|
|
332
|
-
schema: p,
|
|
333
|
-
entity: v,
|
|
334
|
-
onBackToList: Se,
|
|
335
|
-
relatedRecordsPresentation: le
|
|
336
|
-
}, x) : /* @__PURE__ */ V("div", {
|
|
337
|
-
style: {
|
|
338
|
-
display: "flex",
|
|
339
|
-
alignItems: "center",
|
|
340
|
-
justifyContent: "center",
|
|
341
|
-
height: "100%",
|
|
342
|
-
color: "var(--text-3)"
|
|
343
|
-
},
|
|
344
|
-
children: /* @__PURE__ */ V("p", {
|
|
345
|
-
style: { fontSize: 12.5 },
|
|
346
|
-
children: r("list.detail.select_prompt", "Select a {name} to view details", { name: r(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) => W(t, e, n)), i = r.bodyFields.filter((n) => W(t, e, n)), l = r.metaFields.filter((n) => W(t, e, n));
|
|
357
|
-
return /* @__PURE__ */ H("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__ */ V(G, {
|
|
378
|
-
entity: t,
|
|
379
|
-
record: e,
|
|
380
|
-
field: r.titleField,
|
|
381
|
-
refs: a
|
|
382
|
-
}),
|
|
383
|
-
r.subtitleField && /* @__PURE__ */ V("div", {
|
|
384
|
-
style: {
|
|
385
|
-
fontSize: 12,
|
|
386
|
-
color: "var(--text-3)",
|
|
387
|
-
overflowWrap: "anywhere"
|
|
388
|
-
},
|
|
389
|
-
children: w({
|
|
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__ */ V("div", {
|
|
399
|
-
style: {
|
|
400
|
-
display: "flex",
|
|
401
|
-
flexWrap: "wrap",
|
|
402
|
-
gap: 6
|
|
403
|
-
},
|
|
404
|
-
children: n.map((n) => /* @__PURE__ */ V("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: w({
|
|
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__ */ V("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__ */ V(K, {
|
|
432
|
-
entity: t,
|
|
433
|
-
record: e,
|
|
434
|
-
fieldName: n,
|
|
435
|
-
refs: a
|
|
436
|
-
}, n))
|
|
437
|
-
}),
|
|
438
|
-
l.length > 0 && /* @__PURE__ */ V("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__ */ V("span", {
|
|
447
|
-
style: {
|
|
448
|
-
minWidth: 0,
|
|
449
|
-
overflowWrap: "anywhere"
|
|
450
|
-
},
|
|
451
|
-
children: w({
|
|
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__ */ H("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__ */ V("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: w({
|
|
498
|
-
entity: t,
|
|
499
|
-
fieldName: l,
|
|
500
|
-
record: e,
|
|
501
|
-
mode: "display",
|
|
502
|
-
refs: a,
|
|
503
|
-
t: c
|
|
504
|
-
})
|
|
505
|
-
}), /* @__PURE__ */ H("div", {
|
|
506
|
-
style: {
|
|
507
|
-
display: "flex",
|
|
508
|
-
alignItems: "center",
|
|
509
|
-
gap: 6
|
|
510
|
-
},
|
|
511
|
-
children: [u && /* @__PURE__ */ V("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: w({
|
|
521
|
-
entity: t,
|
|
522
|
-
fieldName: u,
|
|
523
|
-
record: e,
|
|
524
|
-
mode: "display",
|
|
525
|
-
refs: a,
|
|
526
|
-
t: c
|
|
527
|
-
})
|
|
528
|
-
}), /* @__PURE__ */ V("div", {
|
|
529
|
-
style: {
|
|
530
|
-
display: "flex",
|
|
531
|
-
alignItems: "center",
|
|
532
|
-
gap: 4,
|
|
533
|
-
flexShrink: 0
|
|
534
|
-
},
|
|
535
|
-
children: d.map((n) => S(t, e, n) == null ? null : /* @__PURE__ */ V("div", {
|
|
536
|
-
style: { fontSize: 11 },
|
|
537
|
-
children: w({
|
|
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 W(e, t, n) {
|
|
551
|
-
let r = S(e, t, n);
|
|
552
|
-
return !(r == null || r === "" || Array.isArray(r) && r.length === 0);
|
|
553
|
-
}
|
|
554
|
-
function G({ entity: e, record: t, field: n, refs: r }) {
|
|
555
|
-
let i = _(), a = m(i, t, e), o = n ? w({
|
|
556
|
-
entity: e,
|
|
557
|
-
fieldName: n,
|
|
558
|
-
record: t,
|
|
559
|
-
mode: "display",
|
|
560
|
-
refs: r,
|
|
561
|
-
t: i
|
|
562
|
-
}) : a;
|
|
563
|
-
return /* @__PURE__ */ V("div", {
|
|
564
|
-
style: {
|
|
565
|
-
fontSize: 13.5,
|
|
566
|
-
fontWeight: 600,
|
|
567
|
-
color: "var(--text)",
|
|
568
|
-
overflowWrap: "anywhere"
|
|
569
|
-
},
|
|
570
|
-
children: o || i(e.display.name)
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
|
-
function K({ entity: e, record: t, fieldName: n, refs: r }) {
|
|
574
|
-
let i = _(), a = S(e, t, n);
|
|
575
|
-
if (a == null || a === "") return null;
|
|
576
|
-
let s = e.fields.get(n);
|
|
577
|
-
return s ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("dt", {
|
|
578
|
-
style: {
|
|
579
|
-
color: "var(--text-3)",
|
|
580
|
-
fontSize: 11.5,
|
|
581
|
-
minWidth: 0,
|
|
582
|
-
overflowWrap: "anywhere"
|
|
583
|
-
},
|
|
584
|
-
children: o(i, s, n)
|
|
585
|
-
}), /* @__PURE__ */ V("dd", {
|
|
586
|
-
style: {
|
|
587
|
-
margin: 0,
|
|
588
|
-
color: "var(--text)",
|
|
589
|
-
fontSize: 12,
|
|
590
|
-
minWidth: 0,
|
|
591
|
-
overflowWrap: "anywhere"
|
|
592
|
-
},
|
|
593
|
-
children: w({
|
|
594
|
-
entity: e,
|
|
595
|
-
fieldName: n,
|
|
596
|
-
record: t,
|
|
597
|
-
mode: "display",
|
|
598
|
-
refs: r,
|
|
599
|
-
t: i
|
|
600
|
-
})
|
|
601
|
-
})] }) : null;
|
|
602
|
-
}
|
|
603
|
-
function de({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList: a, relatedRecordsPresentation: o }) {
|
|
604
|
-
return /* @__PURE__ */ V(p, { children: /* @__PURE__ */ V(q, {
|
|
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 q({ entityCode: i, recordId: a, items: o, schema: c, entity: f, onBackToList: p, relatedRecordsPresentation: ee }) {
|
|
615
|
-
let g = _(), b = l(f, "update"), w = R(() => a ? n(f, a) : void 0, [a, f]), { data: ae, isLoading: D } = v(i, w), O = ne(i), k = s(), [A, j] = oe(!1), [N, P] = oe({}), F = ae?.data, L = F?.$statuses, z = F?.$properties, se = E(i, a), ce = T(i, a), U = R(() => {
|
|
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]), ue = I(() => {
|
|
621
|
-
if (F) {
|
|
622
|
-
let e = {};
|
|
623
|
-
U.forEach((t) => {
|
|
624
|
-
let n = S(f, F, t);
|
|
625
|
-
e[t] = ie(f, t) ? n ?? null : n ?? "";
|
|
626
|
-
}), P(e);
|
|
627
|
-
}
|
|
628
|
-
j(!0);
|
|
629
|
-
}, [
|
|
630
|
-
F,
|
|
631
|
-
U,
|
|
632
|
-
f
|
|
633
|
-
]), W = I(async () => {
|
|
634
|
-
await k.flushAllDrafts(), j(!1), P({});
|
|
635
|
-
}, [k]), G = I(() => {
|
|
636
|
-
let e = {}, t = y({
|
|
637
|
-
entity: f,
|
|
638
|
-
formData: N,
|
|
639
|
-
record: F,
|
|
640
|
-
isNew: !1
|
|
641
|
-
}), n = x(t);
|
|
642
|
-
for (let [t, n] of Object.entries(N)) f.files?.has(t) || (e[t] = C(f, t, n));
|
|
643
|
-
if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0) {
|
|
644
|
-
j(!1), P({});
|
|
645
|
-
return;
|
|
646
|
-
}
|
|
647
|
-
O.mutate({
|
|
648
|
-
pkValues: a,
|
|
649
|
-
data: e
|
|
650
|
-
}, { onSuccess: () => {
|
|
651
|
-
n.forEach((e) => k.markCommitted(e)), j(!1), P({});
|
|
652
|
-
} });
|
|
653
|
-
}, [
|
|
654
|
-
k,
|
|
655
|
-
O,
|
|
656
|
-
a,
|
|
657
|
-
f,
|
|
658
|
-
N,
|
|
659
|
-
F
|
|
660
|
-
]), K = I((e, t) => {
|
|
661
|
-
P((n) => ({
|
|
662
|
-
...n,
|
|
663
|
-
[e]: t
|
|
664
|
-
}));
|
|
665
|
-
}, []);
|
|
666
|
-
if (D) return /* @__PURE__ */ V(re, {});
|
|
667
|
-
if (!F) return null;
|
|
668
|
-
let de = m(g, F, f), q = f.display?.display_field, J = de ? void 0 : q ? F[q] : F[f.fields.names()[0]], fe = de || (J != null && typeof J != "object" ? u(J) : g(f.display.name)), pe = F?.$refs, me = {
|
|
669
|
-
schema: c,
|
|
670
|
-
entity: f,
|
|
671
|
-
entityCode: i,
|
|
672
|
-
recordId: a,
|
|
673
|
-
record: A ? {
|
|
674
|
-
...F,
|
|
675
|
-
...N
|
|
676
|
-
} : F,
|
|
677
|
-
isNew: !1,
|
|
678
|
-
mode: A ? "edit" : "display",
|
|
679
|
-
onFieldChange: A ? K : void 0,
|
|
680
|
-
refs: pe,
|
|
681
|
-
objectProperties: z ?? void 0,
|
|
682
|
-
onSetProperty: b ? (e, t) => ce.mutate({
|
|
683
|
-
propertyCode: e,
|
|
684
|
-
value: t
|
|
685
|
-
}) : void 0,
|
|
686
|
-
isPropertyPending: ce.isPending,
|
|
687
|
-
objectStatuses: L ?? void 0,
|
|
688
|
-
onSetStatus: b ? (e, t) => se.mutate({
|
|
689
|
-
groupCode: e,
|
|
690
|
-
statusCode: t
|
|
691
|
-
}) : void 0,
|
|
692
|
-
isStatusPending: se.isPending,
|
|
693
|
-
relatedRecordsPresentation: ee
|
|
694
|
-
};
|
|
695
|
-
return /* @__PURE__ */ H("div", {
|
|
696
|
-
style: {
|
|
697
|
-
display: "flex",
|
|
698
|
-
flexDirection: "column",
|
|
699
|
-
height: "100%"
|
|
700
|
-
},
|
|
701
|
-
children: [/* @__PURE__ */ H("div", {
|
|
702
|
-
style: {
|
|
703
|
-
display: "flex",
|
|
704
|
-
alignItems: "center",
|
|
705
|
-
justifyContent: "space-between",
|
|
706
|
-
paddingTop: 10,
|
|
707
|
-
paddingBottom: 10,
|
|
708
|
-
...te(16),
|
|
709
|
-
borderBottom: "1px solid var(--divider)",
|
|
710
|
-
position: "sticky",
|
|
711
|
-
top: 0,
|
|
712
|
-
background: "var(--surface)",
|
|
713
|
-
zIndex: 10
|
|
714
|
-
},
|
|
715
|
-
children: [/* @__PURE__ */ V("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: fe
|
|
726
|
-
}), /* @__PURE__ */ H("div", {
|
|
727
|
-
style: {
|
|
728
|
-
display: "flex",
|
|
729
|
-
alignItems: "center",
|
|
730
|
-
gap: 6
|
|
731
|
-
},
|
|
732
|
-
children: [p && /* @__PURE__ */ V(t, {
|
|
733
|
-
icon: /* @__PURE__ */ V(e.back, { size: 14 }),
|
|
734
|
-
title: g("list.detail.back_to_list", "Back to list"),
|
|
735
|
-
onClick: p
|
|
736
|
-
}), b && (A ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(r, {
|
|
737
|
-
size: "xs",
|
|
738
|
-
icon: /* @__PURE__ */ V(e.x, { size: 12 }),
|
|
739
|
-
onClick: W,
|
|
740
|
-
children: g("dialog.cancel", "Cancel")
|
|
741
|
-
}), /* @__PURE__ */ V(r, {
|
|
742
|
-
kind: "primary",
|
|
743
|
-
size: "xs",
|
|
744
|
-
icon: O.isPending ? /* @__PURE__ */ V(d, { size: 12 }) : /* @__PURE__ */ V(e.save, { size: 12 }),
|
|
745
|
-
onClick: G,
|
|
746
|
-
disabled: O.isPending,
|
|
747
|
-
children: O.isPending ? g("dialog.saving", "Saving…") : g("dialog.save", "Save")
|
|
748
|
-
})] }) : /* @__PURE__ */ V(r, {
|
|
749
|
-
size: "xs",
|
|
750
|
-
icon: /* @__PURE__ */ V(e.edit, { size: 12 }),
|
|
751
|
-
onClick: ue,
|
|
752
|
-
children: g("list.record.edit", "Edit")
|
|
753
|
-
}))]
|
|
754
|
-
})]
|
|
755
|
-
}), /* @__PURE__ */ V("div", {
|
|
756
|
-
style: {
|
|
757
|
-
flex: 1,
|
|
758
|
-
overflowY: "auto",
|
|
759
|
-
paddingTop: 16,
|
|
760
|
-
paddingBottom: 16,
|
|
761
|
-
...te(16),
|
|
762
|
-
display: "flex",
|
|
763
|
-
flexDirection: "column",
|
|
764
|
-
gap: 12
|
|
765
|
-
},
|
|
766
|
-
children: o && o.length > 0 ? /* @__PURE__ */ V(M, {
|
|
767
|
-
nodes: o,
|
|
768
|
-
ctx: me
|
|
769
|
-
}) : /* @__PURE__ */ V("p", {
|
|
770
|
-
style: {
|
|
771
|
-
fontSize: 12.5,
|
|
772
|
-
color: "var(--text-3)"
|
|
773
|
-
},
|
|
774
|
-
children: h(g("list.detail.no_layout", "No layout configured. Add {key} to the screen definition."), { key: /* @__PURE__ */ V("code", { children: le }) })
|
|
775
|
-
})
|
|
776
|
-
})]
|
|
777
|
-
});
|
|
778
|
-
}
|
|
779
|
-
//#endregion
|
|
780
|
-
export { U as SmartRecordListPage };
|