@declarion/react 0.45.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-BDnJK0AU.js → DraggableChildrenTable-B6KjWkwD.js} +2 -2
- package/dist-lib/{DynamicIcon-DeRpAaXm.js → DynamicIcon-Dc2j-rg_.js} +19 -17
- package/dist-lib/{Grid-CcCveEE7.js → Grid-OdquWJNX.js} +2 -2
- package/dist-lib/{LayoutRenderer-BReuhVdX.js → LayoutRenderer-CzAdhjNT.js} +525 -518
- package/dist-lib/{MarkdownRenderer-DPKDFR60.js → MarkdownRenderer-C6bhrAIe.js} +10 -10
- package/dist-lib/{RefreshControl-KddgOhUG.js → RefreshControl-F9Ib9asP.js} +18 -18
- package/dist-lib/{SmartDetailPage.impl-D_hMxiHy.js → SmartDetailPage.impl-DdSu3kmW.js} +305 -294
- package/dist-lib/{SmartRecordListPage.impl-GIo_mPIJ.js → SmartRecordListPage.impl-SkIp0_Rd.js} +165 -154
- 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/list/ListFloatbar.d.ts +4 -2
- package/dist-lib/components/pages/list/cardProjection.d.ts +2 -1
- 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/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 +3031 -2674
- package/dist-lib/lib/actions.d.ts +1 -1
- 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-DJKp0yaV.js → registry-C2VD-5MD.js} +571 -347
- package/dist-lib/testing.js +1 -1
- package/dist-lib/types/schema.d.ts +26 -0
- package/dist-lib/{useCurrentScreen-A3xZDs7U.js → useCurrentScreen-ow4r-nWa.js} +721 -693
- package/dist-lib/{useProperties-TlltWwLv.js → useProperties-lEKfzm2X.js} +92 -61
- package/dist-lib/{value-CHY7LgZ-.js → value-CXohNH6a.js} +1 -1
- package/dist-lib/vite/index.js +23 -22
- package/package.json +12 -12
package/dist-lib/{SmartRecordListPage.impl-GIo_mPIJ.js → SmartRecordListPage.impl-SkIp0_Rd.js}
RENAMED
|
@@ -1,115 +1,114 @@
|
|
|
1
|
-
import { s as e } from "./DynamicIcon-
|
|
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-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import { useCallback as
|
|
7
|
-
import { useSearchParams as
|
|
8
|
-
import { Fragment as
|
|
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
|
+
import { useCallback as I, useEffect as L, useMemo as R, useRef as z, useState as oe } from "react";
|
|
7
|
+
import { useSearchParams as se } from "react-router";
|
|
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, i] =
|
|
12
|
-
|
|
13
|
-
let _ =
|
|
14
|
-
let e = A(r);
|
|
15
|
-
return e.length > 0 ? e : void 0;
|
|
16
|
-
}, [r]), C = z(() => 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 = z(() => {
|
|
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(() => {
|
|
17
14
|
let e = p?.responsive?.[c.category]?.presentation;
|
|
18
15
|
return c.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
|
|
19
|
-
}, [p?.responsive, c.category]), E =
|
|
16
|
+
}, [p?.responsive, c.category]), E = R(() => {
|
|
20
17
|
let e = p?.responsive?.[c.category];
|
|
21
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";
|
|
22
|
-
}, [p?.responsive, c.category]),
|
|
19
|
+
}, [p?.responsive, c.category]), ie = p?.responsive?.[c.category]?.layout?.related_records, P = R(() => D({
|
|
23
20
|
entity: m,
|
|
24
21
|
screen: p
|
|
25
|
-
}), [m, p]),
|
|
22
|
+
}), [m, p]), F = R(() => ne({
|
|
26
23
|
entity: m,
|
|
27
24
|
screen: p,
|
|
28
25
|
presentation: E,
|
|
29
|
-
visibleColumns:
|
|
30
|
-
card:
|
|
26
|
+
visibleColumns: w,
|
|
27
|
+
card: P,
|
|
31
28
|
sort: x
|
|
32
29
|
}), [
|
|
33
30
|
m,
|
|
34
31
|
p,
|
|
35
32
|
E,
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
w,
|
|
34
|
+
P,
|
|
38
35
|
x
|
|
39
|
-
]),
|
|
36
|
+
]), U = m?.list_pagination === "cursor", { data: W, isLoading: G } = d(g, {
|
|
40
37
|
page: 1,
|
|
41
38
|
per_page: 200,
|
|
42
39
|
sort: x || void 0,
|
|
43
40
|
search: b || void 0,
|
|
44
|
-
filters: S,
|
|
45
|
-
select:
|
|
46
|
-
expand:
|
|
41
|
+
filters: S.error ? void 0 : C,
|
|
42
|
+
select: F.selectFields,
|
|
43
|
+
expand: F.expandFields,
|
|
47
44
|
preview: !0,
|
|
48
45
|
screen: p?.fixed_filters ? t : void 0
|
|
49
|
-
}, !
|
|
46
|
+
}, !U), K = k(g, {
|
|
50
47
|
sort: x || void 0,
|
|
51
48
|
search: b || void 0,
|
|
52
|
-
filters: S,
|
|
53
|
-
select:
|
|
54
|
-
expand:
|
|
49
|
+
filters: S.error ? void 0 : C,
|
|
50
|
+
select: F.selectFields,
|
|
51
|
+
expand: F.expandFields,
|
|
55
52
|
preview: !0,
|
|
56
53
|
screen: p?.fixed_filters ? t : void 0,
|
|
57
54
|
limit: 200
|
|
58
|
-
},
|
|
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) => {
|
|
59
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
|
-
}, [i]),
|
|
60
|
+
}, [i]), pe = I((e) => {
|
|
64
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
|
-
}, [i]),
|
|
65
|
+
}, [i]), me = I((e, t) => {
|
|
69
66
|
i((n) => {
|
|
70
|
-
let r = new URLSearchParams(n), i =
|
|
71
|
-
return a = t && t !== "__all__" ? [...
|
|
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
|
-
}, [i]), Y = (p?.list_resizable ?? !1) && T === "split" && c.category !== "phone" && !c.touch,
|
|
74
|
-
|
|
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;
|
|
71
|
+
L(() => {
|
|
75
72
|
!Y || !$?.endsWith("%") || Z(null);
|
|
76
73
|
}, [
|
|
77
74
|
Y,
|
|
78
75
|
$,
|
|
79
76
|
c.width,
|
|
80
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
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
let ge = z(null);
|
|
94
|
+
L(() => () => {
|
|
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
108
|
if (!s || !p || !m) return null;
|
|
110
|
-
let
|
|
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:
|
|
111
|
+
ref: he,
|
|
113
112
|
"data-record-list-presentation": T,
|
|
114
113
|
style: {
|
|
115
114
|
display: "flex",
|
|
@@ -119,7 +118,7 @@ function U({ screenCode: t }) {
|
|
|
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
124
|
flex: T === "split" ? "none" : "1 1 auto",
|
|
@@ -128,7 +127,7 @@ function U({ screenCode: t }) {
|
|
|
128
127
|
overflow: "hidden",
|
|
129
128
|
borderRight: T === "split" && !Y ? "1px solid var(--divider)" : "none",
|
|
130
129
|
borderBottom: T === "stacked" ? "1px solid var(--divider)" : "none",
|
|
131
|
-
width:
|
|
130
|
+
width: Se,
|
|
132
131
|
minWidth: 0,
|
|
133
132
|
height: T === "stacked" ? "50%" : "100%"
|
|
134
133
|
},
|
|
@@ -162,10 +161,22 @@ function U({ screenCode: t }) {
|
|
|
162
161
|
}),
|
|
163
162
|
/* @__PURE__ */ V(f, {
|
|
164
163
|
value: y,
|
|
165
|
-
onChange:
|
|
164
|
+
onChange: pe,
|
|
166
165
|
placeholder: `Search ${u(m.display.name_plural)}…`,
|
|
167
166
|
prefix: /* @__PURE__ */ V(e.search, { size: 13 })
|
|
168
167
|
}),
|
|
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
|
+
}),
|
|
169
180
|
p.filters && p.filters.length > 0 && /* @__PURE__ */ V("div", {
|
|
170
181
|
style: {
|
|
171
182
|
display: "flex",
|
|
@@ -175,19 +186,19 @@ function U({ screenCode: t }) {
|
|
|
175
186
|
children: p.filters.map((e) => {
|
|
176
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
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: u(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,7 +212,7 @@ function U({ screenCode: t }) {
|
|
|
201
212
|
fontSize: 11,
|
|
202
213
|
color: "var(--text-3)"
|
|
203
214
|
},
|
|
204
|
-
children: [/* @__PURE__ */ V("span", { children:
|
|
215
|
+
children: [/* @__PURE__ */ V("span", { children: ue ? "Loading…" : `${J.length} ${u(m.display.name_plural)}` }), ve > 0 && /* @__PURE__ */ V("button", {
|
|
205
216
|
onClick: () => i((e) => {
|
|
206
217
|
let t = new URLSearchParams(e);
|
|
207
218
|
return t.delete("filters"), t;
|
|
@@ -228,7 +239,7 @@ function U({ screenCode: t }) {
|
|
|
228
239
|
flexDirection: "column",
|
|
229
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(
|
|
252
|
-
let t = o(e[
|
|
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
266
|
entity: m,
|
|
256
|
-
columns:
|
|
257
|
-
card:
|
|
267
|
+
columns: w,
|
|
268
|
+
card: P,
|
|
258
269
|
presentation: E,
|
|
259
|
-
refs:
|
|
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,7 +303,7 @@ 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,
|
|
@@ -306,8 +317,8 @@ function U({ screenCode: t }) {
|
|
|
306
317
|
items: p.items,
|
|
307
318
|
schema: s,
|
|
308
319
|
entity: m,
|
|
309
|
-
onBackToList:
|
|
310
|
-
relatedRecordsPresentation:
|
|
320
|
+
onBackToList: xe,
|
|
321
|
+
relatedRecordsPresentation: ie
|
|
311
322
|
}, v) : /* @__PURE__ */ V("div", {
|
|
312
323
|
style: {
|
|
313
324
|
display: "flex",
|
|
@@ -365,7 +376,7 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
|
|
|
365
376
|
color: "var(--text-3)",
|
|
366
377
|
overflowWrap: "anywhere"
|
|
367
378
|
},
|
|
368
|
-
children:
|
|
379
|
+
children: T({
|
|
369
380
|
entity: n,
|
|
370
381
|
fieldName: i.subtitleField,
|
|
371
382
|
record: e,
|
|
@@ -390,7 +401,7 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
|
|
|
390
401
|
maxWidth: "100%",
|
|
391
402
|
overflowWrap: "anywhere"
|
|
392
403
|
},
|
|
393
|
-
children:
|
|
404
|
+
children: T({
|
|
394
405
|
entity: n,
|
|
395
406
|
fieldName: t,
|
|
396
407
|
record: e,
|
|
@@ -428,7 +439,7 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
|
|
|
428
439
|
minWidth: 0,
|
|
429
440
|
overflowWrap: "anywhere"
|
|
430
441
|
},
|
|
431
|
-
children:
|
|
442
|
+
children: T({
|
|
432
443
|
entity: n,
|
|
433
444
|
fieldName: t,
|
|
434
445
|
record: e,
|
|
@@ -474,7 +485,7 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
|
|
|
474
485
|
whiteSpace: "nowrap",
|
|
475
486
|
color: "var(--text)"
|
|
476
487
|
},
|
|
477
|
-
children:
|
|
488
|
+
children: T({
|
|
478
489
|
entity: n,
|
|
479
490
|
fieldName: u,
|
|
480
491
|
record: e,
|
|
@@ -497,7 +508,7 @@ function ce({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
|
|
|
497
508
|
textOverflow: "ellipsis",
|
|
498
509
|
whiteSpace: "nowrap"
|
|
499
510
|
},
|
|
500
|
-
children:
|
|
511
|
+
children: T({
|
|
501
512
|
entity: n,
|
|
502
513
|
fieldName: d,
|
|
503
514
|
record: e,
|
|
@@ -512,9 +523,9 @@ 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: f.map((t) =>
|
|
526
|
+
children: f.map((t) => v(n, e, t) == null ? null : /* @__PURE__ */ V("div", {
|
|
516
527
|
style: { fontSize: 11 },
|
|
517
|
-
children:
|
|
528
|
+
children: T({
|
|
518
529
|
entity: n,
|
|
519
530
|
fieldName: t,
|
|
520
531
|
record: e,
|
|
@@ -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
545
|
function G({ entity: e, record: n, field: i, refs: a }) {
|
|
535
|
-
let o = t(), s = r(n, e)
|
|
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,21 +558,14 @@ function G({ entity: e, record: n, field: i, refs: a }) {
|
|
|
540
558
|
color: "var(--text)",
|
|
541
559
|
overflowWrap: "anywhere"
|
|
542
560
|
},
|
|
543
|
-
children:
|
|
544
|
-
entity: e,
|
|
545
|
-
fieldName: i,
|
|
546
|
-
record: n,
|
|
547
|
-
mode: "display",
|
|
548
|
-
refs: a,
|
|
549
|
-
locale: o
|
|
550
|
-
}) : s) || u(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
|
-
return o ? /* @__PURE__ */ H(
|
|
568
|
+
return o ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("dt", {
|
|
558
569
|
style: {
|
|
559
570
|
color: "var(--text-3)",
|
|
560
571
|
fontSize: 11.5,
|
|
@@ -570,7 +581,7 @@ function K({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
|
|
|
570
581
|
minWidth: 0,
|
|
571
582
|
overflowWrap: "anywhere"
|
|
572
583
|
},
|
|
573
|
-
children:
|
|
584
|
+
children: T({
|
|
574
585
|
entity: e,
|
|
575
586
|
fieldName: n,
|
|
576
587
|
record: t,
|
|
@@ -592,87 +603,87 @@ function q({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackT
|
|
|
592
603
|
}) });
|
|
593
604
|
}
|
|
594
605
|
function J({ entityCode: t, recordId: n, items: a, schema: s, entity: l, onBackToList: d, relatedRecordsPresentation: f }) {
|
|
595
|
-
let h = m(l, "update"),
|
|
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
608
|
for (let [t, n] of l.fields) !n.auto && !n.primary && e.add(t);
|
|
598
609
|
for (let [t] of l.files ?? []) e.add(t);
|
|
599
610
|
return e;
|
|
600
|
-
}, [l]),
|
|
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
|
-
|
|
621
|
+
N,
|
|
622
|
+
se,
|
|
612
623
|
l
|
|
613
|
-
]),
|
|
614
|
-
await
|
|
615
|
-
}, [
|
|
616
|
-
let e = {}, t =
|
|
624
|
+
]), ce = I(async () => {
|
|
625
|
+
await O.flushAllDrafts(), A(!1), M({});
|
|
626
|
+
}, [O]), W = I(() => {
|
|
627
|
+
let e = {}, t = S({
|
|
617
628
|
entity: l,
|
|
618
|
-
formData:
|
|
619
|
-
record:
|
|
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
645
|
onError: () => g.error("Failed to save")
|
|
635
646
|
});
|
|
636
647
|
}, [
|
|
637
|
-
|
|
638
|
-
|
|
648
|
+
O,
|
|
649
|
+
D,
|
|
639
650
|
n,
|
|
640
651
|
l,
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
]),
|
|
644
|
-
|
|
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
|
|
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 = {
|
|
652
663
|
schema: s,
|
|
653
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: h ? (e, t) =>
|
|
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: h ? (e, t) =>
|
|
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:
|
|
686
|
+
isStatusPending: L.isPending,
|
|
676
687
|
relatedRecordsPresentation: f
|
|
677
688
|
};
|
|
678
689
|
return /* @__PURE__ */ H("div", {
|
|
@@ -703,7 +714,7 @@ function J({ entityCode: t, recordId: n, items: a, schema: s, entity: l, 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",
|
|
@@ -714,22 +725,22 @@ function J({ entityCode: t, recordId: n, items: a, schema: s, entity: l, onBackT
|
|
|
714
725
|
icon: /* @__PURE__ */ V(e.back, { size: 14 }),
|
|
715
726
|
title: "Back to list",
|
|
716
727
|
onClick: d
|
|
717
|
-
}), h && (
|
|
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
733
|
}), /* @__PURE__ */ V(_, {
|
|
723
734
|
kind: "primary",
|
|
724
735
|
size: "xs",
|
|
725
|
-
icon:
|
|
726
|
-
onClick:
|
|
727
|
-
disabled:
|
|
728
|
-
children:
|
|
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"
|
|
729
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: a, schema: s, entity: l, onBackT
|
|
|
742
753
|
flexDirection: "column",
|
|
743
754
|
gap: 12
|
|
744
755
|
},
|
|
745
|
-
children: a && a.length > 0 ? /* @__PURE__ */ V(
|
|
756
|
+
children: a && a.length > 0 ? /* @__PURE__ */ V(F, {
|
|
746
757
|
nodes: a,
|
|
747
|
-
ctx:
|
|
758
|
+
ctx: de
|
|
748
759
|
}) : /* @__PURE__ */ H("p", {
|
|
749
760
|
style: {
|
|
750
761
|
fontSize: 12.5,
|