@declarion/react 0.44.0 → 0.47.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/{DraggableChildrenTable-G4Sw1XAD.js → DraggableChildrenTable-B6KjWkwD.js} +39 -39
- package/dist-lib/{DynamicIcon-DeRpAaXm.js → DynamicIcon-Dc2j-rg_.js} +19 -17
- package/dist-lib/{Grid-CXn-IK3H.js → Grid-OdquWJNX.js} +2 -2
- package/dist-lib/{LayoutRenderer-DX8pFS5A.js → LayoutRenderer-CzAdhjNT.js} +794 -787
- package/dist-lib/{MarkdownRenderer-CreI9x2m.js → MarkdownRenderer-C6bhrAIe.js} +10 -10
- package/dist-lib/{RefreshControl-DFh0-gCb.js → RefreshControl-F9Ib9asP.js} +179 -179
- package/dist-lib/{SmartDetailPage.impl-K6Jj1-9z.js → SmartDetailPage.impl-DdSu3kmW.js} +631 -593
- package/dist-lib/{SmartRecordListPage.impl-DQW_uVfL.js → SmartRecordListPage.impl-SkIp0_Rd.js} +220 -209
- package/dist-lib/api/agents.d.ts +39 -7
- package/dist-lib/components/agents/AgentChatPanel.d.ts +6 -1
- package/dist-lib/components/agents/transcript-runs.d.ts +29 -0
- package/dist-lib/components/file-widgets/host.d.ts +1 -0
- package/dist-lib/components/list/QuickPeek.d.ts +1 -1
- package/dist-lib/components/pages/exportRequest.d.ts +3 -3
- package/dist-lib/components/pages/list/ListFloatbar.d.ts +4 -2
- package/dist-lib/components/pages/list/cardProjection.d.ts +2 -1
- package/dist-lib/components/pages/list/filter-meta.d.ts +22 -8
- package/dist-lib/components/shared/RowActionsKebab.d.ts +3 -2
- package/dist-lib/components/views/ViewSwitcher.d.ts +2 -1
- package/dist-lib/hooks/useAgentConversation.d.ts +7 -19
- package/dist-lib/hooks/useCursorEntityData.d.ts +3 -2
- package/dist-lib/hooks/useFilters.d.ts +1 -0
- package/dist-lib/icons.js +1 -1
- package/dist-lib/index.d.ts +8 -1
- package/dist-lib/index.js +3246 -2984
- package/dist-lib/lib/actions.d.ts +1 -1
- package/dist-lib/lib/anchor.d.ts +37 -0
- package/dist-lib/lib/filter-evaluator.d.ts +16 -0
- package/dist-lib/lib/filters.d.ts +10 -4
- package/dist-lib/lib/messages.d.ts +1 -0
- package/dist-lib/lib/variants.d.ts +7 -0
- package/dist-lib/{registry-r4hiflwC.js → registry-C2VD-5MD.js} +1103 -879
- package/dist-lib/testing.js +10 -10
- package/dist-lib/types/api.d.ts +3 -10
- package/dist-lib/types/schema.d.ts +51 -13
- package/dist-lib/{useCurrentScreen-CpQjVmrT.js → useCurrentScreen-ow4r-nWa.js} +1130 -1054
- package/dist-lib/{useProperties-CULxrNT4.js → useProperties-lEKfzm2X.js} +114 -83
- package/dist-lib/{value-fUHxMV4r.js → value-CXohNH6a.js} +1 -1
- package/dist-lib/vite/index.js +23 -22
- package/package.json +12 -12
package/dist-lib/{SmartRecordListPage.impl-DQW_uVfL.js → SmartRecordListPage.impl-SkIp0_Rd.js}
RENAMED
|
@@ -1,136 +1,135 @@
|
|
|
1
|
-
import { s as e } from "./DynamicIcon-
|
|
2
|
-
import { A as t, At as n,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as F } from "./LayoutRenderer-
|
|
1
|
+
import { s as e } from "./DynamicIcon-Dc2j-rg_.js";
|
|
2
|
+
import { A as t, At as n, Cn as r, F as i, Kn as a, Ln as o, N as s, Pn as c, Sn as l, Tn as u, X as d, Yn as f, Zn as p, bn as m, lr as ee, q as h, rr as te, rt as g, ur as _ } from "./useCurrentScreen-ow4r-nWa.js";
|
|
3
|
+
import { $ as v, A as y, Q as b, T as x, X as S, Z as C, a as w, c as ne, et as T, nt as E, s as D, v as O } from "./registry-C2VD-5MD.js";
|
|
4
|
+
import { S as k, c as A, f as j, g as M, h as N, m as re, n as ie, r as P, v as ae } from "./useProperties-lEKfzm2X.js";
|
|
5
|
+
import { t as F } from "./LayoutRenderer-CzAdhjNT.js";
|
|
6
6
|
import { useCallback as I, useEffect as L, useMemo as R, useRef as z, useState as oe } from "react";
|
|
7
7
|
import { useSearchParams as se } from "react-router";
|
|
8
8
|
import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/pages/SmartRecordListPage.impl.tsx
|
|
10
10
|
function U({ screenCode: t }) {
|
|
11
|
-
let [r,
|
|
12
|
-
|
|
13
|
-
let _ =
|
|
14
|
-
let e =
|
|
15
|
-
return
|
|
16
|
-
}, [
|
|
17
|
-
let e =
|
|
18
|
-
return
|
|
19
|
-
}, [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}, [
|
|
23
|
-
entity:
|
|
24
|
-
screen:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
visibleColumns: S,
|
|
30
|
-
card: j,
|
|
31
|
-
sort: b
|
|
11
|
+
let [r, i] = se(), { data: s } = n(), c = te(), p = s?.screens[t], m = p?.entity ? s?.entities[p.entity] : void 0, g = p?.entity;
|
|
12
|
+
M(p, m, r.toString()), ae(p?.route);
|
|
13
|
+
let _ = O(), v = r.get("selected") ?? null, y = r.get("search") ?? "", b = h(y, 300), x = r.get("sort") ?? p?.sort_default ?? "", S = R(() => j(r), [r]), C = S.filters.length > 0 ? S.filters : void 0, w = R(() => p?.columns ?? m?.fields.names().filter((e) => !m.fields.get(e)?.primary && !m.fields.get(e)?.auto && m.fields.get(e)?.display?.is_listable !== !1).slice(0, 4) ?? [], [p?.columns, m]), T = R(() => {
|
|
14
|
+
let e = p?.responsive?.[c.category]?.presentation;
|
|
15
|
+
return c.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
|
|
16
|
+
}, [p?.responsive, c.category]), E = R(() => {
|
|
17
|
+
let e = p?.responsive?.[c.category];
|
|
18
|
+
return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation : c.category === "phone" ? "cards" : "table";
|
|
19
|
+
}, [p?.responsive, c.category]), ie = p?.responsive?.[c.category]?.layout?.related_records, P = R(() => D({
|
|
20
|
+
entity: m,
|
|
21
|
+
screen: p
|
|
22
|
+
}), [m, p]), F = R(() => ne({
|
|
23
|
+
entity: m,
|
|
24
|
+
screen: p,
|
|
25
|
+
presentation: E,
|
|
26
|
+
visibleColumns: w,
|
|
27
|
+
card: P,
|
|
28
|
+
sort: x
|
|
32
29
|
}), [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
]),
|
|
30
|
+
m,
|
|
31
|
+
p,
|
|
32
|
+
E,
|
|
33
|
+
w,
|
|
34
|
+
P,
|
|
35
|
+
x
|
|
36
|
+
]), U = m?.list_pagination === "cursor", { data: W, isLoading: G } = d(g, {
|
|
40
37
|
page: 1,
|
|
41
38
|
per_page: 200,
|
|
42
|
-
sort:
|
|
43
|
-
search:
|
|
44
|
-
filters:
|
|
45
|
-
select:
|
|
46
|
-
expand:
|
|
39
|
+
sort: x || void 0,
|
|
40
|
+
search: b || void 0,
|
|
41
|
+
filters: S.error ? void 0 : C,
|
|
42
|
+
select: F.selectFields,
|
|
43
|
+
expand: F.expandFields,
|
|
47
44
|
preview: !0,
|
|
48
|
-
screen:
|
|
49
|
-
}, !
|
|
50
|
-
sort:
|
|
51
|
-
search:
|
|
52
|
-
filters:
|
|
53
|
-
select:
|
|
54
|
-
expand:
|
|
45
|
+
screen: p?.fixed_filters ? t : void 0
|
|
46
|
+
}, !U), K = k(g, {
|
|
47
|
+
sort: x || void 0,
|
|
48
|
+
search: b || void 0,
|
|
49
|
+
filters: S.error ? void 0 : C,
|
|
50
|
+
select: F.selectFields,
|
|
51
|
+
expand: F.expandFields,
|
|
55
52
|
preview: !0,
|
|
56
|
-
screen:
|
|
53
|
+
screen: p?.fixed_filters ? t : void 0,
|
|
57
54
|
limit: 200
|
|
58
|
-
},
|
|
59
|
-
|
|
55
|
+
}, U), J = U ? K.rows : W?.data ?? [], le = U ? K.refs : W?.$refs, ue = U ? K.isLoading : G, de = R(() => m?.fields.names().find((e) => m.fields.get(e)?.primary) ?? "id", [m]), fe = I((e, t) => {
|
|
56
|
+
i((t) => {
|
|
60
57
|
let n = new URLSearchParams(t);
|
|
61
58
|
return e ? n.set("selected", e) : n.delete("selected"), n;
|
|
62
59
|
}, { replace: t?.replace ?? !0 });
|
|
63
|
-
}, [
|
|
64
|
-
|
|
60
|
+
}, [i]), pe = I((e) => {
|
|
61
|
+
i((t) => {
|
|
65
62
|
let n = new URLSearchParams(t);
|
|
66
63
|
return e ? n.set("search", e) : n.delete("search"), n;
|
|
67
64
|
}, { replace: !0 });
|
|
68
|
-
}, [
|
|
69
|
-
|
|
70
|
-
let r = new URLSearchParams(n), i =
|
|
71
|
-
return a = t && t !== "__all__" ? [...
|
|
65
|
+
}, [i]), me = I((e, t) => {
|
|
66
|
+
i((n) => {
|
|
67
|
+
let r = new URLSearchParams(n), i = j(n).filters, a;
|
|
68
|
+
return a = t && t !== "__all__" ? [...re(i, e), A(e, t)] : re(i, e), N(a, r), r;
|
|
72
69
|
}, { replace: !0 });
|
|
73
|
-
}, [
|
|
70
|
+
}, [i]), Y = (p?.list_resizable ?? !1) && T === "split" && c.category !== "phone" && !c.touch, he = z(null), [X, Z] = oe(null), Q = z(!1), $ = p?.list_width;
|
|
74
71
|
L(() => {
|
|
75
72
|
!Y || !$?.endsWith("%") || Z(null);
|
|
76
73
|
}, [
|
|
77
74
|
Y,
|
|
78
75
|
$,
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
c.width,
|
|
77
|
+
c.height
|
|
81
78
|
]), L(() => {
|
|
82
79
|
if (!Y || X !== null) return;
|
|
83
|
-
let e =
|
|
84
|
-
if (e)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
let e = he.current;
|
|
81
|
+
if (e) {
|
|
82
|
+
if ($ && $.endsWith("%")) {
|
|
83
|
+
let t = parseFloat($) / 100;
|
|
84
|
+
Z(Math.round(e.getBoundingClientRect().width * t));
|
|
85
|
+
} else Z($ && parseInt($, 10) || 320);
|
|
86
|
+
}
|
|
88
87
|
}, [
|
|
89
88
|
Y,
|
|
90
89
|
$,
|
|
91
90
|
X,
|
|
92
|
-
|
|
91
|
+
m
|
|
93
92
|
]);
|
|
94
|
-
let
|
|
93
|
+
let ge = z(null);
|
|
95
94
|
L(() => () => {
|
|
96
|
-
|
|
95
|
+
ge.current?.();
|
|
97
96
|
}, []);
|
|
98
|
-
let
|
|
97
|
+
let _e = I((e) => {
|
|
99
98
|
e.preventDefault(), Q.current = !0;
|
|
100
99
|
let t = e.clientX, n = X ?? 320, r = (e) => {
|
|
101
100
|
if (!Q.current) return;
|
|
102
|
-
let r = (
|
|
101
|
+
let r = (he.current?.getBoundingClientRect().width ?? window.innerWidth) - 300, i = Math.max(200, Math.min(r, n + e.clientX - t));
|
|
103
102
|
Z(i);
|
|
104
103
|
}, i = () => {
|
|
105
|
-
Q.current = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i), document.body.style.cursor = "", document.body.style.userSelect = "",
|
|
104
|
+
Q.current = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i), document.body.style.cursor = "", document.body.style.userSelect = "", ge.current = null;
|
|
106
105
|
};
|
|
107
|
-
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i),
|
|
106
|
+
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), ge.current = i;
|
|
108
107
|
}, [X]);
|
|
109
|
-
if (!
|
|
110
|
-
let
|
|
108
|
+
if (!s || !p || !m) return null;
|
|
109
|
+
let ve = C?.length ?? 0, ye = T === "split" || T === "stacked" || !v, be = T === "split" || T === "stacked" || !!v, xe = T !== "split" && v ? () => fe(null, { replace: !0 }) : void 0, Se = T === "split" ? Y && X !== null ? X : p.list_width ?? "320px" : "100%";
|
|
111
110
|
return /* @__PURE__ */ H("div", {
|
|
112
|
-
ref:
|
|
113
|
-
"data-record-list-presentation":
|
|
111
|
+
ref: he,
|
|
112
|
+
"data-record-list-presentation": T,
|
|
114
113
|
style: {
|
|
115
114
|
display: "flex",
|
|
116
|
-
flexDirection:
|
|
115
|
+
flexDirection: T === "stacked" ? "column" : "row",
|
|
117
116
|
height: "100%",
|
|
118
117
|
minWidth: 0,
|
|
119
118
|
overflow: "hidden"
|
|
120
119
|
},
|
|
121
120
|
children: [
|
|
122
|
-
|
|
121
|
+
ye && /* @__PURE__ */ H("div", {
|
|
123
122
|
"data-testid": "record-list-panel",
|
|
124
123
|
style: {
|
|
125
|
-
flex:
|
|
124
|
+
flex: T === "split" ? "none" : "1 1 auto",
|
|
126
125
|
display: "flex",
|
|
127
126
|
flexDirection: "column",
|
|
128
127
|
overflow: "hidden",
|
|
129
|
-
borderRight:
|
|
130
|
-
borderBottom:
|
|
131
|
-
width:
|
|
128
|
+
borderRight: T === "split" && !Y ? "1px solid var(--divider)" : "none",
|
|
129
|
+
borderBottom: T === "stacked" ? "1px solid var(--divider)" : "none",
|
|
130
|
+
width: Se,
|
|
132
131
|
minWidth: 0,
|
|
133
|
-
height:
|
|
132
|
+
height: T === "stacked" ? "50%" : "100%"
|
|
134
133
|
},
|
|
135
134
|
children: [/* @__PURE__ */ H("div", {
|
|
136
135
|
style: {
|
|
@@ -157,37 +156,49 @@ function U({ screenCode: t }) {
|
|
|
157
156
|
fontWeight: 600,
|
|
158
157
|
color: "var(--text)"
|
|
159
158
|
},
|
|
160
|
-
children:
|
|
159
|
+
children: u(p.display?.name) || u(m.display.name_plural)
|
|
161
160
|
})]
|
|
162
161
|
}),
|
|
163
|
-
/* @__PURE__ */ V(
|
|
162
|
+
/* @__PURE__ */ V(f, {
|
|
164
163
|
value: y,
|
|
165
|
-
onChange:
|
|
166
|
-
placeholder: `Search ${
|
|
164
|
+
onChange: pe,
|
|
165
|
+
placeholder: `Search ${u(m.display.name_plural)}…`,
|
|
167
166
|
prefix: /* @__PURE__ */ V(e.search, { size: 13 })
|
|
168
167
|
}),
|
|
169
|
-
|
|
168
|
+
S.error && /* @__PURE__ */ H("div", {
|
|
169
|
+
role: "alert",
|
|
170
|
+
"data-testid": "record-list-filter-url-error",
|
|
171
|
+
style: {
|
|
172
|
+
padding: "7px 9px",
|
|
173
|
+
border: "1px solid var(--danger)",
|
|
174
|
+
borderRadius: 6,
|
|
175
|
+
color: "var(--danger)",
|
|
176
|
+
fontSize: 11.5
|
|
177
|
+
},
|
|
178
|
+
children: [S.error, " Showing this list without URL filters."]
|
|
179
|
+
}),
|
|
180
|
+
p.filters && p.filters.length > 0 && /* @__PURE__ */ V("div", {
|
|
170
181
|
style: {
|
|
171
182
|
display: "flex",
|
|
172
183
|
flexWrap: "wrap",
|
|
173
184
|
gap: 6
|
|
174
185
|
},
|
|
175
|
-
children:
|
|
176
|
-
let t =
|
|
186
|
+
children: p.filters.map((e) => {
|
|
187
|
+
let t = m.fields.get(e);
|
|
177
188
|
if (!t?.values) return null;
|
|
178
|
-
let n =
|
|
189
|
+
let n = C?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r = l(t, e, s.entities), i = [{
|
|
190
|
+
value: "__all__",
|
|
191
|
+
label: `All ${r}`
|
|
192
|
+
}, ...t.values.map((e) => ({
|
|
193
|
+
value: e.code,
|
|
194
|
+
label: u(e.name) || e.code
|
|
195
|
+
}))];
|
|
179
196
|
return /* @__PURE__ */ V("div", {
|
|
180
197
|
style: { minWidth: 120 },
|
|
181
|
-
children: /* @__PURE__ */ V(
|
|
198
|
+
children: /* @__PURE__ */ V(a, {
|
|
182
199
|
value: n,
|
|
183
|
-
options:
|
|
184
|
-
|
|
185
|
-
label: `All ${r}`
|
|
186
|
-
}, ...t.values.map((e) => ({
|
|
187
|
-
value: e.code,
|
|
188
|
-
label: h(e.name) || e.code
|
|
189
|
-
}))],
|
|
190
|
-
onChange: (t) => pe(e, t),
|
|
200
|
+
options: i,
|
|
201
|
+
onChange: (t) => me(e, t),
|
|
191
202
|
placeholder: r
|
|
192
203
|
})
|
|
193
204
|
}, e);
|
|
@@ -201,8 +212,8 @@ function U({ screenCode: t }) {
|
|
|
201
212
|
fontSize: 11,
|
|
202
213
|
color: "var(--text-3)"
|
|
203
214
|
},
|
|
204
|
-
children: [/* @__PURE__ */ V("span", { children:
|
|
205
|
-
onClick: () =>
|
|
215
|
+
children: [/* @__PURE__ */ V("span", { children: ue ? "Loading…" : `${J.length} ${u(m.display.name_plural)}` }), ve > 0 && /* @__PURE__ */ V("button", {
|
|
216
|
+
onClick: () => i((e) => {
|
|
206
217
|
let t = new URLSearchParams(e);
|
|
207
218
|
return t.delete("filters"), t;
|
|
208
219
|
}, { replace: !0 }),
|
|
@@ -223,12 +234,12 @@ function U({ screenCode: t }) {
|
|
|
223
234
|
style: {
|
|
224
235
|
flex: 1,
|
|
225
236
|
overflowY: "auto",
|
|
226
|
-
padding:
|
|
227
|
-
display:
|
|
237
|
+
padding: E === "cards" ? 10 : 0,
|
|
238
|
+
display: E === "cards" ? "flex" : "block",
|
|
228
239
|
flexDirection: "column",
|
|
229
|
-
gap:
|
|
240
|
+
gap: E === "cards" ? 10 : void 0
|
|
230
241
|
},
|
|
231
|
-
children:
|
|
242
|
+
children: ue ? /* @__PURE__ */ V("div", {
|
|
232
243
|
style: {
|
|
233
244
|
padding: 12,
|
|
234
245
|
display: "flex",
|
|
@@ -240,7 +251,7 @@ function U({ screenCode: t }) {
|
|
|
240
251
|
borderRadius: 6,
|
|
241
252
|
background: "var(--surface-3)"
|
|
242
253
|
} }, t))
|
|
243
|
-
}) :
|
|
254
|
+
}) : J.length === 0 ? /* @__PURE__ */ V("div", {
|
|
244
255
|
style: {
|
|
245
256
|
padding: 28,
|
|
246
257
|
textAlign: "center",
|
|
@@ -248,23 +259,23 @@ function U({ screenCode: t }) {
|
|
|
248
259
|
color: "var(--text-3)"
|
|
249
260
|
},
|
|
250
261
|
children: "No records found"
|
|
251
|
-
}) : /* @__PURE__ */ H(B, { children: [
|
|
252
|
-
let t =
|
|
262
|
+
}) : /* @__PURE__ */ H(B, { children: [J.map((e) => {
|
|
263
|
+
let t = o(e[de]);
|
|
253
264
|
return /* @__PURE__ */ V(ce, {
|
|
254
265
|
record: e,
|
|
255
|
-
entity:
|
|
256
|
-
columns:
|
|
257
|
-
card:
|
|
258
|
-
presentation:
|
|
259
|
-
refs:
|
|
266
|
+
entity: m,
|
|
267
|
+
columns: w,
|
|
268
|
+
card: P,
|
|
269
|
+
presentation: E,
|
|
270
|
+
refs: le,
|
|
260
271
|
isSelected: t === v,
|
|
261
|
-
onClick: () =>
|
|
272
|
+
onClick: () => fe(t, { replace: T === "split" })
|
|
262
273
|
}, t);
|
|
263
|
-
}),
|
|
274
|
+
}), U && K.hasMore && /* @__PURE__ */ V("button", {
|
|
264
275
|
type: "button",
|
|
265
276
|
"data-testid": "record-list-load-more",
|
|
266
|
-
onClick: () => void
|
|
267
|
-
disabled:
|
|
277
|
+
onClick: () => void K.fetchNextPage(),
|
|
278
|
+
disabled: K.isFetchingNextPage,
|
|
268
279
|
style: {
|
|
269
280
|
width: "100%",
|
|
270
281
|
padding: "8px 12px",
|
|
@@ -273,15 +284,15 @@ function U({ screenCode: t }) {
|
|
|
273
284
|
border: "none",
|
|
274
285
|
borderTop: "1px solid var(--divider)",
|
|
275
286
|
color: "var(--text-2)",
|
|
276
|
-
cursor:
|
|
287
|
+
cursor: K.isFetchingNextPage ? "default" : "pointer"
|
|
277
288
|
},
|
|
278
|
-
children:
|
|
289
|
+
children: K.isFetchingNextPage ? "Loading…" : "Load more"
|
|
279
290
|
})] })
|
|
280
291
|
})]
|
|
281
292
|
}),
|
|
282
293
|
Y && /* @__PURE__ */ V("div", {
|
|
283
294
|
"data-testid": "record-list-resize-handle",
|
|
284
|
-
onMouseDown:
|
|
295
|
+
onMouseDown: _e,
|
|
285
296
|
style: {
|
|
286
297
|
flex: "none",
|
|
287
298
|
width: 1,
|
|
@@ -292,21 +303,21 @@ function U({ screenCode: t }) {
|
|
|
292
303
|
onMouseEnter: (e) => e.currentTarget.style.background = "var(--border-strong)",
|
|
293
304
|
onMouseLeave: (e) => e.currentTarget.style.background = "var(--divider)"
|
|
294
305
|
}),
|
|
295
|
-
|
|
306
|
+
be && /* @__PURE__ */ V("div", {
|
|
296
307
|
"data-testid": "record-detail-panel",
|
|
297
308
|
style: {
|
|
298
309
|
flex: 1,
|
|
299
310
|
minWidth: 0,
|
|
300
311
|
overflow: "hidden",
|
|
301
|
-
height:
|
|
312
|
+
height: T === "stacked" ? "50%" : "100%"
|
|
302
313
|
},
|
|
303
314
|
children: v ? /* @__PURE__ */ V(q, {
|
|
304
|
-
entityCode:
|
|
315
|
+
entityCode: g,
|
|
305
316
|
recordId: v,
|
|
306
|
-
items:
|
|
307
|
-
schema:
|
|
308
|
-
entity:
|
|
309
|
-
onBackToList:
|
|
317
|
+
items: p.items,
|
|
318
|
+
schema: s,
|
|
319
|
+
entity: m,
|
|
320
|
+
onBackToList: xe,
|
|
310
321
|
relatedRecordsPresentation: ie
|
|
311
322
|
}, v) : /* @__PURE__ */ V("div", {
|
|
312
323
|
style: {
|
|
@@ -320,7 +331,7 @@ function U({ screenCode: t }) {
|
|
|
320
331
|
style: { fontSize: 12.5 },
|
|
321
332
|
children: [
|
|
322
333
|
"Select a ",
|
|
323
|
-
|
|
334
|
+
u(m.display.name),
|
|
324
335
|
" to view details"
|
|
325
336
|
]
|
|
326
337
|
})
|
|
@@ -441,7 +452,7 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
|
|
|
441
452
|
]
|
|
442
453
|
});
|
|
443
454
|
}
|
|
444
|
-
let u = r[0], d = r[1],
|
|
455
|
+
let u = r[0], d = r[1], f = r.slice(2, 4);
|
|
445
456
|
return /* @__PURE__ */ H("button", {
|
|
446
457
|
onClick: c,
|
|
447
458
|
style: {
|
|
@@ -512,7 +523,7 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
|
|
|
512
523
|
gap: 4,
|
|
513
524
|
flexShrink: 0
|
|
514
525
|
},
|
|
515
|
-
children:
|
|
526
|
+
children: f.map((t) => v(n, e, t) == null ? null : /* @__PURE__ */ V("div", {
|
|
516
527
|
style: { fontSize: 11 },
|
|
517
528
|
children: T({
|
|
518
529
|
entity: n,
|
|
@@ -528,11 +539,18 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
|
|
|
528
539
|
});
|
|
529
540
|
}
|
|
530
541
|
function W(e, t, n) {
|
|
531
|
-
let r =
|
|
542
|
+
let r = v(e, t, n);
|
|
532
543
|
return !(r == null || r === "" || Array.isArray(r) && r.length === 0);
|
|
533
544
|
}
|
|
534
|
-
function G({ entity: e, record: n, field:
|
|
535
|
-
let
|
|
545
|
+
function G({ entity: e, record: n, field: i, refs: a }) {
|
|
546
|
+
let o = t(), s = r(n, e), c = i ? T({
|
|
547
|
+
entity: e,
|
|
548
|
+
fieldName: i,
|
|
549
|
+
record: n,
|
|
550
|
+
mode: "display",
|
|
551
|
+
refs: a,
|
|
552
|
+
locale: o
|
|
553
|
+
}) : s;
|
|
536
554
|
return /* @__PURE__ */ V("div", {
|
|
537
555
|
style: {
|
|
538
556
|
fontSize: 13.5,
|
|
@@ -540,18 +558,11 @@ function G({ entity: e, record: n, field: r, refs: i }) {
|
|
|
540
558
|
color: "var(--text)",
|
|
541
559
|
overflowWrap: "anywhere"
|
|
542
560
|
},
|
|
543
|
-
children:
|
|
544
|
-
entity: e,
|
|
545
|
-
fieldName: r,
|
|
546
|
-
record: n,
|
|
547
|
-
mode: "display",
|
|
548
|
-
refs: i,
|
|
549
|
-
locale: a
|
|
550
|
-
}) : o) || h(e.display.name)
|
|
561
|
+
children: c || u(e.display.name)
|
|
551
562
|
});
|
|
552
563
|
}
|
|
553
564
|
function K({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
|
|
554
|
-
let a =
|
|
565
|
+
let a = v(e, t, n);
|
|
555
566
|
if (a == null || a === "") return null;
|
|
556
567
|
let o = e.fields.get(n);
|
|
557
568
|
return o ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("dt", {
|
|
@@ -561,7 +572,7 @@ function K({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
|
|
|
561
572
|
minWidth: 0,
|
|
562
573
|
overflowWrap: "anywhere"
|
|
563
574
|
},
|
|
564
|
-
children:
|
|
575
|
+
children: l(o, n)
|
|
565
576
|
}), /* @__PURE__ */ V("dd", {
|
|
566
577
|
style: {
|
|
567
578
|
margin: 0,
|
|
@@ -591,89 +602,89 @@ function q({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackT
|
|
|
591
602
|
relatedRecordsPresentation: o
|
|
592
603
|
}) });
|
|
593
604
|
}
|
|
594
|
-
function J({ entityCode: t, recordId: n, items:
|
|
595
|
-
let
|
|
605
|
+
function J({ entityCode: t, recordId: n, items: a, schema: s, entity: l, onBackToList: d, relatedRecordsPresentation: f }) {
|
|
606
|
+
let h = m(l, "update"), te = R(() => n ? c(l, n) : void 0, [n, l]), { data: ne, isLoading: T } = w(t, te), D = y(t), O = i(), [k, A] = oe(!1), [j, M] = oe({}), N = ne?.data, re = N?.$statuses, ae = N?.$properties, L = P(t, n), z = ie(t, n), se = R(() => {
|
|
596
607
|
let e = /* @__PURE__ */ new Set();
|
|
597
|
-
for (let [t, n] of
|
|
598
|
-
for (let [t] of
|
|
608
|
+
for (let [t, n] of l.fields) !n.auto && !n.primary && e.add(t);
|
|
609
|
+
for (let [t] of l.files ?? []) e.add(t);
|
|
599
610
|
return e;
|
|
600
|
-
}, [
|
|
601
|
-
if (
|
|
611
|
+
}, [l]), U = I(() => {
|
|
612
|
+
if (N) {
|
|
602
613
|
let e = {};
|
|
603
|
-
|
|
604
|
-
let n =
|
|
605
|
-
e[t] =
|
|
606
|
-
}),
|
|
614
|
+
se.forEach((t) => {
|
|
615
|
+
let n = v(l, N, t);
|
|
616
|
+
e[t] = b(l, t) ? n ?? null : n ?? "";
|
|
617
|
+
}), M(e);
|
|
607
618
|
}
|
|
608
|
-
|
|
619
|
+
A(!0);
|
|
609
620
|
}, [
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
]),
|
|
614
|
-
await
|
|
615
|
-
}, [
|
|
616
|
-
let e = {}, t =
|
|
617
|
-
entity:
|
|
618
|
-
formData:
|
|
619
|
-
record:
|
|
621
|
+
N,
|
|
622
|
+
se,
|
|
623
|
+
l
|
|
624
|
+
]), ce = I(async () => {
|
|
625
|
+
await O.flushAllDrafts(), A(!1), M({});
|
|
626
|
+
}, [O]), W = I(() => {
|
|
627
|
+
let e = {}, t = S({
|
|
628
|
+
entity: l,
|
|
629
|
+
formData: j,
|
|
630
|
+
record: N,
|
|
620
631
|
isNew: !1
|
|
621
|
-
}), r =
|
|
622
|
-
for (let [t, n] of Object.entries(
|
|
632
|
+
}), r = C(t);
|
|
633
|
+
for (let [t, n] of Object.entries(j)) l.files?.has(t) || (e[t] = E(l, t, n));
|
|
623
634
|
if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0) {
|
|
624
|
-
|
|
635
|
+
A(!1), M({});
|
|
625
636
|
return;
|
|
626
637
|
}
|
|
627
|
-
|
|
638
|
+
D.mutate({
|
|
628
639
|
pkValues: n,
|
|
629
640
|
data: e
|
|
630
641
|
}, {
|
|
631
642
|
onSuccess: () => {
|
|
632
|
-
r.forEach((e) =>
|
|
643
|
+
r.forEach((e) => O.markCommitted(e)), A(!1), M({}), g.success("Saved");
|
|
633
644
|
},
|
|
634
|
-
onError: () =>
|
|
645
|
+
onError: () => g.error("Failed to save")
|
|
635
646
|
});
|
|
636
647
|
}, [
|
|
637
|
-
T,
|
|
638
|
-
C,
|
|
639
|
-
n,
|
|
640
|
-
s,
|
|
641
648
|
O,
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
649
|
+
D,
|
|
650
|
+
n,
|
|
651
|
+
l,
|
|
652
|
+
j,
|
|
653
|
+
N
|
|
654
|
+
]), G = I((e, t) => {
|
|
655
|
+
M((n) => ({
|
|
645
656
|
...n,
|
|
646
657
|
[e]: t
|
|
647
658
|
}));
|
|
648
659
|
}, []);
|
|
649
|
-
if (
|
|
650
|
-
if (!
|
|
651
|
-
let
|
|
652
|
-
schema:
|
|
653
|
-
entity:
|
|
660
|
+
if (T) return /* @__PURE__ */ V(x, {});
|
|
661
|
+
if (!N) return null;
|
|
662
|
+
let K = r(N, l), q = l.display?.display_field, J = K ? void 0 : q ? N[q] : N[l.fields.names()[0]], le = K || (J != null && typeof J != "object" ? o(J) : u(l.display.name)), ue = N?.$refs, de = {
|
|
663
|
+
schema: s,
|
|
664
|
+
entity: l,
|
|
654
665
|
entityCode: t,
|
|
655
666
|
recordId: n,
|
|
656
|
-
record:
|
|
657
|
-
...
|
|
658
|
-
...
|
|
659
|
-
} :
|
|
667
|
+
record: k ? {
|
|
668
|
+
...N,
|
|
669
|
+
...j
|
|
670
|
+
} : N,
|
|
660
671
|
isNew: !1,
|
|
661
|
-
mode:
|
|
662
|
-
onFieldChange:
|
|
663
|
-
refs:
|
|
664
|
-
objectProperties:
|
|
665
|
-
onSetProperty:
|
|
672
|
+
mode: k ? "edit" : "display",
|
|
673
|
+
onFieldChange: k ? G : void 0,
|
|
674
|
+
refs: ue,
|
|
675
|
+
objectProperties: ae ?? void 0,
|
|
676
|
+
onSetProperty: h ? (e, t) => z.mutate({
|
|
666
677
|
propertyCode: e,
|
|
667
678
|
value: t
|
|
668
679
|
}) : void 0,
|
|
669
|
-
isPropertyPending:
|
|
670
|
-
objectStatuses:
|
|
671
|
-
onSetStatus:
|
|
680
|
+
isPropertyPending: z.isPending,
|
|
681
|
+
objectStatuses: re ?? void 0,
|
|
682
|
+
onSetStatus: h ? (e, t) => L.mutate({
|
|
672
683
|
groupCode: e,
|
|
673
684
|
statusCode: t
|
|
674
685
|
}) : void 0,
|
|
675
|
-
isStatusPending:
|
|
676
|
-
relatedRecordsPresentation:
|
|
686
|
+
isStatusPending: L.isPending,
|
|
687
|
+
relatedRecordsPresentation: f
|
|
677
688
|
};
|
|
678
689
|
return /* @__PURE__ */ H("div", {
|
|
679
690
|
style: {
|
|
@@ -703,33 +714,33 @@ function J({ entityCode: t, recordId: n, items: i, schema: o, entity: s, onBackT
|
|
|
703
714
|
whiteSpace: "nowrap",
|
|
704
715
|
color: "var(--text)"
|
|
705
716
|
},
|
|
706
|
-
children:
|
|
717
|
+
children: le
|
|
707
718
|
}), /* @__PURE__ */ H("div", {
|
|
708
719
|
style: {
|
|
709
720
|
display: "flex",
|
|
710
721
|
alignItems: "center",
|
|
711
722
|
gap: 6
|
|
712
723
|
},
|
|
713
|
-
children: [
|
|
724
|
+
children: [d && /* @__PURE__ */ V(ee, {
|
|
714
725
|
icon: /* @__PURE__ */ V(e.back, { size: 14 }),
|
|
715
726
|
title: "Back to list",
|
|
716
|
-
onClick:
|
|
717
|
-
}),
|
|
727
|
+
onClick: d
|
|
728
|
+
}), h && (k ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(_, {
|
|
718
729
|
size: "xs",
|
|
719
730
|
icon: /* @__PURE__ */ V(e.x, { size: 12 }),
|
|
720
|
-
onClick:
|
|
731
|
+
onClick: ce,
|
|
721
732
|
children: "Cancel"
|
|
722
|
-
}), /* @__PURE__ */ V(
|
|
733
|
+
}), /* @__PURE__ */ V(_, {
|
|
723
734
|
kind: "primary",
|
|
724
735
|
size: "xs",
|
|
725
|
-
icon:
|
|
726
|
-
onClick:
|
|
727
|
-
disabled:
|
|
728
|
-
children:
|
|
729
|
-
})] }) : /* @__PURE__ */ V(
|
|
736
|
+
icon: D.isPending ? /* @__PURE__ */ V(p, { size: 12 }) : /* @__PURE__ */ V(e.save, { size: 12 }),
|
|
737
|
+
onClick: W,
|
|
738
|
+
disabled: D.isPending,
|
|
739
|
+
children: D.isPending ? "Saving…" : "Save"
|
|
740
|
+
})] }) : /* @__PURE__ */ V(_, {
|
|
730
741
|
size: "xs",
|
|
731
742
|
icon: /* @__PURE__ */ V(e.edit, { size: 12 }),
|
|
732
|
-
onClick:
|
|
743
|
+
onClick: U,
|
|
733
744
|
children: "Edit"
|
|
734
745
|
}))]
|
|
735
746
|
})]
|
|
@@ -742,9 +753,9 @@ function J({ entityCode: t, recordId: n, items: i, schema: o, entity: s, onBackT
|
|
|
742
753
|
flexDirection: "column",
|
|
743
754
|
gap: 12
|
|
744
755
|
},
|
|
745
|
-
children:
|
|
746
|
-
nodes:
|
|
747
|
-
ctx:
|
|
756
|
+
children: a && a.length > 0 ? /* @__PURE__ */ V(F, {
|
|
757
|
+
nodes: a,
|
|
758
|
+
ctx: de
|
|
748
759
|
}) : /* @__PURE__ */ H("p", {
|
|
749
760
|
style: {
|
|
750
761
|
fontSize: 12.5,
|