@declarion/react 0.40.0 → 0.40.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/{DraggableChildrenTable-Ctmn0liO.js → DraggableChildrenTable-BkqtkJuz.js} +29 -29
- package/dist-lib/{Grid-BsIkTp3u.js → Grid-CTxov4x2.js} +2 -2
- package/dist-lib/{LayoutRenderer-D4oTfZhV.js → LayoutRenderer-Cbh-pY26.js} +307 -307
- package/dist-lib/{MarkdownRenderer-B-2CrtjU.js → MarkdownRenderer-DeguFsZL.js} +1 -1
- package/dist-lib/{RefreshControl-VQf34HKZ.js → RefreshControl-DG2kMABB.js} +165 -165
- package/dist-lib/{SmartDetailPage.impl-HMaLVDlV.js → SmartDetailPage.impl-DCJ_V-Nh.js} +458 -458
- package/dist-lib/{SmartRecordListPage.impl-Cxm7qvlZ.js → SmartRecordListPage.impl-sYCMQw8V.js} +183 -183
- package/dist-lib/components/primitives/Fields.d.ts +7 -0
- package/dist-lib/components/primitives/index.d.ts +2 -2
- package/dist-lib/index.js +1927 -1894
- package/dist-lib/lib/filters.d.ts +5 -0
- package/dist-lib/{registry-DFtAh6zc.js → registry-DbZX1hy8.js} +410 -410
- package/dist-lib/testing.js +25 -25
- package/dist-lib/{useCurrentScreen-mw8TfE8q.js → useCurrentScreen-C33VZcNn.js} +1118 -967
- package/dist-lib/{useProperties-gMdnhdhO.js → useProperties-BgAEk8X9.js} +27 -27
- package/dist-lib/{value-t9ETvWIJ.js → value-VOi8Svry.js} +1 -1
- package/package.json +1 -1
package/dist-lib/{SmartRecordListPage.impl-Cxm7qvlZ.js → SmartRecordListPage.impl-sYCMQw8V.js}
RENAMED
|
@@ -1,84 +1,84 @@
|
|
|
1
1
|
import { s as e } from "./DynamicIcon-DeRpAaXm.js";
|
|
2
|
-
import { A as t, Cn as n, F as r, Fn as i,
|
|
3
|
-
import { G as
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import { useCallback as
|
|
7
|
-
import { useSearchParams as
|
|
8
|
-
import { Fragment as
|
|
2
|
+
import { A as t, Cn as n, F as r, Fn as i, N as a, Pn as o, Sn as s, Tn as c, Wn as l, X as u, Yn as d, bn as f, cr as p, it as m, jt as ee, q as te, qn as h, sr as ne, tr as re } from "./useCurrentScreen-C33VZcNn.js";
|
|
3
|
+
import { G as g, K as _, U as ie, W as v, Y as y, _ as ae, a as b, c as x, k as S, q as C, s as w, w as oe } from "./registry-DbZX1hy8.js";
|
|
4
|
+
import { _ as T, c as E, f as D, h as O, m as se, n as k, p as A, r as j, x as M } from "./useProperties-BgAEk8X9.js";
|
|
5
|
+
import { t as N } from "./LayoutRenderer-Cbh-pY26.js";
|
|
6
|
+
import { useCallback as P, useEffect as F, useMemo as I, useRef as L, useState as ce } from "react";
|
|
7
|
+
import { useSearchParams as le } from "react-router-dom";
|
|
8
|
+
import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/pages/SmartRecordListPage.impl.tsx
|
|
10
10
|
function V({ screenCode: t }) {
|
|
11
|
-
let [n, r] =
|
|
12
|
-
|
|
13
|
-
let
|
|
14
|
-
let e =
|
|
11
|
+
let [n, r] = le(), { data: a } = ee(), o = re(), d = a?.screens[t], f = d?.entity ? a?.entities[d.entity] : void 0, p = d?.entity;
|
|
12
|
+
O(d, f, n.toString()), T(d?.route);
|
|
13
|
+
let m = ae(), g = n.get("selected") ?? null, _ = n.get("search") ?? "", ie = te(_, 300), v = n.get("sort") ?? d?.sort_default ?? "", y = I(() => {
|
|
14
|
+
let e = D(n);
|
|
15
15
|
return e.length > 0 ? e : void 0;
|
|
16
|
-
}, [n]),
|
|
17
|
-
let e =
|
|
18
|
-
return
|
|
19
|
-
}, [
|
|
20
|
-
let e =
|
|
21
|
-
return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation :
|
|
22
|
-
}, [
|
|
23
|
-
entity:
|
|
24
|
-
screen:
|
|
25
|
-
}), [
|
|
26
|
-
entity:
|
|
27
|
-
screen:
|
|
28
|
-
presentation:
|
|
29
|
-
visibleColumns:
|
|
30
|
-
card:
|
|
31
|
-
sort:
|
|
16
|
+
}, [n]), b = I(() => d?.columns ?? f?.fields.names().filter((e) => !f.fields.get(e)?.primary && !f.fields.get(e)?.auto && f.fields.get(e)?.display?.is_listable !== !1).slice(0, 4) ?? [], [d?.columns, f]), S = I(() => {
|
|
17
|
+
let e = d?.responsive?.[o.category]?.presentation;
|
|
18
|
+
return o.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
|
|
19
|
+
}, [d?.responsive, o.category]), C = I(() => {
|
|
20
|
+
let e = d?.responsive?.[o.category];
|
|
21
|
+
return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation : o.category === "phone" ? "cards" : "table";
|
|
22
|
+
}, [d?.responsive, o.category]), oe = d?.responsive?.[o.category]?.layout?.related_records, k = I(() => w({
|
|
23
|
+
entity: f,
|
|
24
|
+
screen: d
|
|
25
|
+
}), [f, d]), j = I(() => x({
|
|
26
|
+
entity: f,
|
|
27
|
+
screen: d,
|
|
28
|
+
presentation: C,
|
|
29
|
+
visibleColumns: b,
|
|
30
|
+
card: k,
|
|
31
|
+
sort: v
|
|
32
32
|
}), [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
]),
|
|
33
|
+
f,
|
|
34
|
+
d,
|
|
35
|
+
C,
|
|
36
|
+
b,
|
|
37
|
+
k,
|
|
38
|
+
v
|
|
39
|
+
]), N = f?.list_pagination === "cursor", { data: V, isLoading: H } = u(p, {
|
|
40
40
|
page: 1,
|
|
41
41
|
per_page: 200,
|
|
42
|
-
sort:
|
|
43
|
-
search:
|
|
44
|
-
filters:
|
|
45
|
-
select:
|
|
46
|
-
expand:
|
|
42
|
+
sort: v || void 0,
|
|
43
|
+
search: ie || void 0,
|
|
44
|
+
filters: y,
|
|
45
|
+
select: j.selectFields,
|
|
46
|
+
expand: j.expandFields,
|
|
47
47
|
preview: !0,
|
|
48
|
-
screen:
|
|
49
|
-
}, !
|
|
50
|
-
sort:
|
|
51
|
-
search:
|
|
52
|
-
filters:
|
|
53
|
-
select:
|
|
54
|
-
expand:
|
|
48
|
+
screen: d?.fixed_filters ? t : void 0
|
|
49
|
+
}, !N), U = M(p, {
|
|
50
|
+
sort: v || void 0,
|
|
51
|
+
search: ie || void 0,
|
|
52
|
+
filters: y,
|
|
53
|
+
select: j.selectFields,
|
|
54
|
+
expand: j.expandFields,
|
|
55
55
|
preview: !0,
|
|
56
|
-
screen:
|
|
56
|
+
screen: d?.fixed_filters ? t : void 0,
|
|
57
57
|
limit: 200
|
|
58
|
-
},
|
|
58
|
+
}, N), W = N ? U.rows : V?.data ?? [], K = N ? U.refs : V?.$refs, q = N ? U.isLoading : H, de = I(() => f?.fields.names().find((e) => f.fields.get(e)?.primary) ?? "id", [f]), fe = P((e, t) => {
|
|
59
59
|
r((t) => {
|
|
60
60
|
let n = new URLSearchParams(t);
|
|
61
61
|
return e ? n.set("selected", e) : n.delete("selected"), n;
|
|
62
62
|
}, { replace: t?.replace ?? !0 });
|
|
63
|
-
}, [r]), pe =
|
|
63
|
+
}, [r]), pe = P((e) => {
|
|
64
64
|
r((t) => {
|
|
65
65
|
let n = new URLSearchParams(t);
|
|
66
66
|
return e ? n.set("search", e) : n.delete("search"), n;
|
|
67
67
|
}, { replace: !0 });
|
|
68
|
-
}, [r]), me =
|
|
68
|
+
}, [r]), me = P((e, t) => {
|
|
69
69
|
r((n) => {
|
|
70
|
-
let r = new URLSearchParams(n), i =
|
|
71
|
-
return a = t && t !== "__all__" ? [...
|
|
70
|
+
let r = new URLSearchParams(n), i = D(n), a;
|
|
71
|
+
return a = t && t !== "__all__" ? [...A(i, e), E(e, t)] : A(i, e), se(a, r), r;
|
|
72
72
|
}, { replace: !0 });
|
|
73
|
-
}, [r]), J = (
|
|
74
|
-
|
|
73
|
+
}, [r]), J = (d?.list_resizable ?? !1) && S === "split" && o.category !== "phone" && !o.touch, Y = L(null), [X, Z] = ce(null), Q = L(!1), $ = d?.list_width;
|
|
74
|
+
F(() => {
|
|
75
75
|
!J || !$?.endsWith("%") || Z(null);
|
|
76
76
|
}, [
|
|
77
77
|
J,
|
|
78
78
|
$,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
]),
|
|
79
|
+
o.width,
|
|
80
|
+
o.height
|
|
81
|
+
]), F(() => {
|
|
82
82
|
if (!J || X !== null) return;
|
|
83
83
|
let e = Y.current;
|
|
84
84
|
if (e) if ($ && $.endsWith("%")) {
|
|
@@ -89,13 +89,13 @@ function V({ screenCode: t }) {
|
|
|
89
89
|
J,
|
|
90
90
|
$,
|
|
91
91
|
X,
|
|
92
|
-
|
|
92
|
+
f
|
|
93
93
|
]);
|
|
94
|
-
let he =
|
|
95
|
-
|
|
94
|
+
let he = L(null);
|
|
95
|
+
F(() => () => {
|
|
96
96
|
he.current?.();
|
|
97
97
|
}, []);
|
|
98
|
-
let ge =
|
|
98
|
+
let ge = P((e) => {
|
|
99
99
|
e.preventDefault(), Q.current = !0;
|
|
100
100
|
let t = e.clientX, n = X ?? 320, r = (e) => {
|
|
101
101
|
if (!Q.current) return;
|
|
@@ -106,14 +106,14 @@ function V({ screenCode: t }) {
|
|
|
106
106
|
};
|
|
107
107
|
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), he.current = i;
|
|
108
108
|
}, [X]);
|
|
109
|
-
if (!a || !
|
|
110
|
-
let _e =
|
|
109
|
+
if (!a || !d || !f) return null;
|
|
110
|
+
let _e = y?.length ?? 0, ve = S === "split" || S === "stacked" || !g, ye = S === "split" || S === "stacked" || !!g, be = S !== "split" && g ? () => fe(null, { replace: !0 }) : void 0, xe = S === "split" ? J && X !== null ? X : d.list_width ?? "320px" : "100%";
|
|
111
111
|
return /* @__PURE__ */ B("div", {
|
|
112
112
|
ref: Y,
|
|
113
|
-
"data-record-list-presentation":
|
|
113
|
+
"data-record-list-presentation": S,
|
|
114
114
|
style: {
|
|
115
115
|
display: "flex",
|
|
116
|
-
flexDirection:
|
|
116
|
+
flexDirection: S === "stacked" ? "column" : "row",
|
|
117
117
|
height: "100%",
|
|
118
118
|
minWidth: 0,
|
|
119
119
|
overflow: "hidden"
|
|
@@ -122,15 +122,15 @@ function V({ screenCode: t }) {
|
|
|
122
122
|
ve && /* @__PURE__ */ B("div", {
|
|
123
123
|
"data-testid": "record-list-panel",
|
|
124
124
|
style: {
|
|
125
|
-
flex:
|
|
125
|
+
flex: S === "split" ? "none" : "1 1 auto",
|
|
126
126
|
display: "flex",
|
|
127
127
|
flexDirection: "column",
|
|
128
128
|
overflow: "hidden",
|
|
129
|
-
borderRight:
|
|
130
|
-
borderBottom:
|
|
129
|
+
borderRight: S === "split" && !J ? "1px solid var(--divider)" : "none",
|
|
130
|
+
borderBottom: S === "stacked" ? "1px solid var(--divider)" : "none",
|
|
131
131
|
width: xe,
|
|
132
132
|
minWidth: 0,
|
|
133
|
-
height:
|
|
133
|
+
height: S === "stacked" ? "50%" : "100%"
|
|
134
134
|
},
|
|
135
135
|
children: [/* @__PURE__ */ B("div", {
|
|
136
136
|
style: {
|
|
@@ -141,51 +141,51 @@ function V({ screenCode: t }) {
|
|
|
141
141
|
borderBottom: "1px solid var(--divider)"
|
|
142
142
|
},
|
|
143
143
|
children: [
|
|
144
|
-
|
|
144
|
+
m.hasOriginBack && /* @__PURE__ */ B("div", {
|
|
145
145
|
style: {
|
|
146
146
|
display: "flex",
|
|
147
147
|
alignItems: "center",
|
|
148
148
|
gap: 8
|
|
149
149
|
},
|
|
150
|
-
children: [/* @__PURE__ */ z(
|
|
150
|
+
children: [/* @__PURE__ */ z(ne, {
|
|
151
151
|
icon: /* @__PURE__ */ z(e.back, { size: 14 }),
|
|
152
152
|
title: "Back",
|
|
153
|
-
onClick:
|
|
153
|
+
onClick: m.goBack
|
|
154
154
|
}), /* @__PURE__ */ z("span", {
|
|
155
155
|
style: {
|
|
156
156
|
fontSize: 12.5,
|
|
157
157
|
fontWeight: 600,
|
|
158
158
|
color: "var(--text)"
|
|
159
159
|
},
|
|
160
|
-
children:
|
|
160
|
+
children: c(d.display?.name) || c(f.display.name_plural)
|
|
161
161
|
})]
|
|
162
162
|
}),
|
|
163
|
-
/* @__PURE__ */ z(
|
|
164
|
-
value:
|
|
163
|
+
/* @__PURE__ */ z(h, {
|
|
164
|
+
value: _,
|
|
165
165
|
onChange: pe,
|
|
166
|
-
placeholder: `Search ${
|
|
166
|
+
placeholder: `Search ${c(f.display.name_plural)}…`,
|
|
167
167
|
prefix: /* @__PURE__ */ z(e.search, { size: 13 })
|
|
168
168
|
}),
|
|
169
|
-
|
|
169
|
+
d.filters && d.filters.length > 0 && /* @__PURE__ */ z("div", {
|
|
170
170
|
style: {
|
|
171
171
|
display: "flex",
|
|
172
172
|
flexWrap: "wrap",
|
|
173
173
|
gap: 6
|
|
174
174
|
},
|
|
175
|
-
children:
|
|
176
|
-
let t =
|
|
175
|
+
children: d.filters.map((e) => {
|
|
176
|
+
let t = f.fields.get(e);
|
|
177
177
|
if (!t?.values) return null;
|
|
178
|
-
let n =
|
|
178
|
+
let n = y?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r = s(t, e, a.entities);
|
|
179
179
|
return /* @__PURE__ */ z("div", {
|
|
180
180
|
style: { minWidth: 120 },
|
|
181
|
-
children: /* @__PURE__ */ z(
|
|
181
|
+
children: /* @__PURE__ */ z(l, {
|
|
182
182
|
value: n,
|
|
183
183
|
options: [{
|
|
184
184
|
value: "__all__",
|
|
185
185
|
label: `All ${r}`
|
|
186
186
|
}, ...t.values.map((e) => ({
|
|
187
187
|
value: e.code,
|
|
188
|
-
label:
|
|
188
|
+
label: c(e.name) || e.code
|
|
189
189
|
}))],
|
|
190
190
|
onChange: (t) => me(e, t),
|
|
191
191
|
placeholder: r
|
|
@@ -201,7 +201,7 @@ function V({ screenCode: t }) {
|
|
|
201
201
|
fontSize: 11,
|
|
202
202
|
color: "var(--text-3)"
|
|
203
203
|
},
|
|
204
|
-
children: [/* @__PURE__ */ z("span", { children: q ? "Loading…" : `${W.length} ${
|
|
204
|
+
children: [/* @__PURE__ */ z("span", { children: q ? "Loading…" : `${W.length} ${c(f.display.name_plural)}` }), _e > 0 && /* @__PURE__ */ z("button", {
|
|
205
205
|
onClick: () => r((e) => {
|
|
206
206
|
let t = new URLSearchParams(e);
|
|
207
207
|
return t.delete("filters"), t;
|
|
@@ -223,10 +223,10 @@ function V({ screenCode: t }) {
|
|
|
223
223
|
style: {
|
|
224
224
|
flex: 1,
|
|
225
225
|
overflowY: "auto",
|
|
226
|
-
padding:
|
|
227
|
-
display:
|
|
226
|
+
padding: C === "cards" ? 10 : 0,
|
|
227
|
+
display: C === "cards" ? "flex" : "block",
|
|
228
228
|
flexDirection: "column",
|
|
229
|
-
gap:
|
|
229
|
+
gap: C === "cards" ? 10 : void 0
|
|
230
230
|
},
|
|
231
231
|
children: q ? /* @__PURE__ */ z("div", {
|
|
232
232
|
style: {
|
|
@@ -248,19 +248,19 @@ function V({ screenCode: t }) {
|
|
|
248
248
|
color: "var(--text-3)"
|
|
249
249
|
},
|
|
250
250
|
children: "No records found"
|
|
251
|
-
}) : /* @__PURE__ */ B(
|
|
251
|
+
}) : /* @__PURE__ */ B(R, { children: [W.map((e) => {
|
|
252
252
|
let t = i(e[de]);
|
|
253
253
|
return /* @__PURE__ */ z(ue, {
|
|
254
254
|
record: e,
|
|
255
|
-
entity:
|
|
256
|
-
columns:
|
|
257
|
-
card:
|
|
258
|
-
presentation:
|
|
255
|
+
entity: f,
|
|
256
|
+
columns: b,
|
|
257
|
+
card: k,
|
|
258
|
+
presentation: C,
|
|
259
259
|
refs: K,
|
|
260
|
-
isSelected: t ===
|
|
261
|
-
onClick: () => fe(t, { replace:
|
|
260
|
+
isSelected: t === g,
|
|
261
|
+
onClick: () => fe(t, { replace: S === "split" })
|
|
262
262
|
}, t);
|
|
263
|
-
}),
|
|
263
|
+
}), N && U.hasMore && /* @__PURE__ */ z("button", {
|
|
264
264
|
type: "button",
|
|
265
265
|
"data-testid": "record-list-load-more",
|
|
266
266
|
onClick: () => void U.fetchNextPage(),
|
|
@@ -298,17 +298,17 @@ function V({ screenCode: t }) {
|
|
|
298
298
|
flex: 1,
|
|
299
299
|
minWidth: 0,
|
|
300
300
|
overflow: "hidden",
|
|
301
|
-
height:
|
|
301
|
+
height: S === "stacked" ? "50%" : "100%"
|
|
302
302
|
},
|
|
303
|
-
children:
|
|
304
|
-
entityCode:
|
|
305
|
-
recordId:
|
|
306
|
-
items:
|
|
303
|
+
children: g ? /* @__PURE__ */ z(G, {
|
|
304
|
+
entityCode: p,
|
|
305
|
+
recordId: g,
|
|
306
|
+
items: d.items,
|
|
307
307
|
schema: a,
|
|
308
|
-
entity:
|
|
308
|
+
entity: f,
|
|
309
309
|
onBackToList: be,
|
|
310
|
-
relatedRecordsPresentation:
|
|
311
|
-
},
|
|
310
|
+
relatedRecordsPresentation: oe
|
|
311
|
+
}, g) : /* @__PURE__ */ z("div", {
|
|
312
312
|
style: {
|
|
313
313
|
display: "flex",
|
|
314
314
|
alignItems: "center",
|
|
@@ -320,7 +320,7 @@ function V({ screenCode: t }) {
|
|
|
320
320
|
style: { fontSize: 12.5 },
|
|
321
321
|
children: [
|
|
322
322
|
"Select a ",
|
|
323
|
-
|
|
323
|
+
c(f.display.name),
|
|
324
324
|
" to view details"
|
|
325
325
|
]
|
|
326
326
|
})
|
|
@@ -365,7 +365,7 @@ function ue({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
|
|
|
365
365
|
color: "var(--text-3)",
|
|
366
366
|
overflowWrap: "anywhere"
|
|
367
367
|
},
|
|
368
|
-
children:
|
|
368
|
+
children: C({
|
|
369
369
|
entity: n,
|
|
370
370
|
fieldName: i.subtitleField,
|
|
371
371
|
record: e,
|
|
@@ -390,7 +390,7 @@ function ue({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
|
|
|
390
390
|
maxWidth: "100%",
|
|
391
391
|
overflowWrap: "anywhere"
|
|
392
392
|
},
|
|
393
|
-
children:
|
|
393
|
+
children: C({
|
|
394
394
|
entity: n,
|
|
395
395
|
fieldName: t,
|
|
396
396
|
record: e,
|
|
@@ -428,7 +428,7 @@ function ue({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
|
|
|
428
428
|
minWidth: 0,
|
|
429
429
|
overflowWrap: "anywhere"
|
|
430
430
|
},
|
|
431
|
-
children:
|
|
431
|
+
children: C({
|
|
432
432
|
entity: n,
|
|
433
433
|
fieldName: t,
|
|
434
434
|
record: e,
|
|
@@ -474,7 +474,7 @@ function ue({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
|
|
|
474
474
|
whiteSpace: "nowrap",
|
|
475
475
|
color: "var(--text)"
|
|
476
476
|
},
|
|
477
|
-
children:
|
|
477
|
+
children: C({
|
|
478
478
|
entity: n,
|
|
479
479
|
fieldName: u,
|
|
480
480
|
record: e,
|
|
@@ -497,7 +497,7 @@ function ue({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
|
|
|
497
497
|
textOverflow: "ellipsis",
|
|
498
498
|
whiteSpace: "nowrap"
|
|
499
499
|
},
|
|
500
|
-
children:
|
|
500
|
+
children: C({
|
|
501
501
|
entity: n,
|
|
502
502
|
fieldName: d,
|
|
503
503
|
record: e,
|
|
@@ -512,9 +512,9 @@ function ue({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
|
|
|
512
512
|
gap: 4,
|
|
513
513
|
flexShrink: 0
|
|
514
514
|
},
|
|
515
|
-
children: f.map((t) =>
|
|
515
|
+
children: f.map((t) => _(n, e, t) == null ? null : /* @__PURE__ */ z("div", {
|
|
516
516
|
style: { fontSize: 11 },
|
|
517
|
-
children:
|
|
517
|
+
children: C({
|
|
518
518
|
entity: n,
|
|
519
519
|
fieldName: t,
|
|
520
520
|
record: e,
|
|
@@ -528,7 +528,7 @@ function ue({ record: e, entity: n, columns: r, card: i, presentation: a, refs:
|
|
|
528
528
|
});
|
|
529
529
|
}
|
|
530
530
|
function H(e, t, n) {
|
|
531
|
-
let r =
|
|
531
|
+
let r = _(e, t, n);
|
|
532
532
|
return !(r == null || r === "" || Array.isArray(r) && r.length === 0);
|
|
533
533
|
}
|
|
534
534
|
function U({ entity: e, record: r, field: i, refs: a }) {
|
|
@@ -540,28 +540,28 @@ function U({ entity: e, record: r, field: i, refs: a }) {
|
|
|
540
540
|
color: "var(--text)",
|
|
541
541
|
overflowWrap: "anywhere"
|
|
542
542
|
},
|
|
543
|
-
children: (i ?
|
|
543
|
+
children: (i ? C({
|
|
544
544
|
entity: e,
|
|
545
545
|
fieldName: i,
|
|
546
546
|
record: r,
|
|
547
547
|
mode: "display",
|
|
548
548
|
refs: a,
|
|
549
549
|
locale: o
|
|
550
|
-
}) : s) ||
|
|
550
|
+
}) : s) || c(e.display.name)
|
|
551
551
|
});
|
|
552
552
|
}
|
|
553
553
|
function W({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
|
|
554
|
-
let a =
|
|
554
|
+
let a = _(e, t, n);
|
|
555
555
|
if (a == null || a === "") return null;
|
|
556
556
|
let o = e.fields.get(n);
|
|
557
|
-
return o ? /* @__PURE__ */ B(
|
|
557
|
+
return o ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("dt", {
|
|
558
558
|
style: {
|
|
559
559
|
color: "var(--text-3)",
|
|
560
560
|
fontSize: 11.5,
|
|
561
561
|
minWidth: 0,
|
|
562
562
|
overflowWrap: "anywhere"
|
|
563
563
|
},
|
|
564
|
-
children:
|
|
564
|
+
children: s(o, n)
|
|
565
565
|
}), /* @__PURE__ */ z("dd", {
|
|
566
566
|
style: {
|
|
567
567
|
margin: 0,
|
|
@@ -570,7 +570,7 @@ function W({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
|
|
|
570
570
|
minWidth: 0,
|
|
571
571
|
overflowWrap: "anywhere"
|
|
572
572
|
},
|
|
573
|
-
children:
|
|
573
|
+
children: C({
|
|
574
574
|
entity: e,
|
|
575
575
|
fieldName: n,
|
|
576
576
|
record: t,
|
|
@@ -580,100 +580,100 @@ function W({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
|
|
|
580
580
|
})
|
|
581
581
|
})] }) : null;
|
|
582
582
|
}
|
|
583
|
-
function G({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList:
|
|
584
|
-
return /* @__PURE__ */ z(
|
|
583
|
+
function G({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList: o, relatedRecordsPresentation: s }) {
|
|
584
|
+
return /* @__PURE__ */ z(a, { children: /* @__PURE__ */ z(K, {
|
|
585
585
|
entityCode: e,
|
|
586
586
|
recordId: t,
|
|
587
587
|
items: n,
|
|
588
588
|
schema: r,
|
|
589
589
|
entity: i,
|
|
590
|
-
onBackToList:
|
|
591
|
-
relatedRecordsPresentation:
|
|
590
|
+
onBackToList: o,
|
|
591
|
+
relatedRecordsPresentation: s
|
|
592
592
|
}) });
|
|
593
593
|
}
|
|
594
|
-
function K({ entityCode: t, recordId:
|
|
595
|
-
let h =
|
|
594
|
+
function K({ entityCode: t, recordId: a, items: s, schema: l, entity: u, onBackToList: ee, relatedRecordsPresentation: te }) {
|
|
595
|
+
let h = f(u, "update"), { data: re, isLoading: ae } = b(t, I(() => a ? o(u, a) : void 0, [a, u])), x = S(t), C = r(), [w, T] = ce(!1), [E, D] = ce({}), O = re?.data, se = O?.$statuses, A = O?.$properties, M = j(t, a), F = k(t, a), L = I(() => {
|
|
596
596
|
let e = /* @__PURE__ */ new Set();
|
|
597
|
-
for (let [t, n] of
|
|
598
|
-
for (let [t] of
|
|
597
|
+
for (let [t, n] of u.fields) !n.auto && !n.primary && e.add(t);
|
|
598
|
+
for (let [t] of u.files ?? []) e.add(t);
|
|
599
599
|
return e;
|
|
600
|
-
}, [
|
|
601
|
-
if (
|
|
600
|
+
}, [u]), le = P(() => {
|
|
601
|
+
if (O) {
|
|
602
602
|
let e = {};
|
|
603
|
-
|
|
604
|
-
let n =
|
|
605
|
-
e[t] =
|
|
606
|
-
}),
|
|
603
|
+
L.forEach((t) => {
|
|
604
|
+
let n = _(u, O, t);
|
|
605
|
+
e[t] = g(u, t) ? n ?? null : n ?? "";
|
|
606
|
+
}), D(e);
|
|
607
607
|
}
|
|
608
|
-
|
|
608
|
+
T(!0);
|
|
609
609
|
}, [
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
]), V =
|
|
614
|
-
await
|
|
615
|
-
}, [
|
|
616
|
-
let e = {}, t =
|
|
617
|
-
entity:
|
|
618
|
-
formData:
|
|
619
|
-
record:
|
|
610
|
+
O,
|
|
611
|
+
L,
|
|
612
|
+
u
|
|
613
|
+
]), V = P(async () => {
|
|
614
|
+
await C.flushAllDrafts(), T(!1), D({});
|
|
615
|
+
}, [C]), ue = P(() => {
|
|
616
|
+
let e = {}, t = ie({
|
|
617
|
+
entity: u,
|
|
618
|
+
formData: E,
|
|
619
|
+
record: O,
|
|
620
620
|
isNew: !1
|
|
621
|
-
}), n =
|
|
622
|
-
for (let [t, n] of Object.entries(
|
|
621
|
+
}), n = v(t);
|
|
622
|
+
for (let [t, n] of Object.entries(E)) u.files?.has(t) || (e[t] = y(u, t, n));
|
|
623
623
|
if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0) {
|
|
624
|
-
|
|
624
|
+
T(!1), D({});
|
|
625
625
|
return;
|
|
626
626
|
}
|
|
627
|
-
|
|
628
|
-
pkValues:
|
|
627
|
+
x.mutate({
|
|
628
|
+
pkValues: a,
|
|
629
629
|
data: e
|
|
630
630
|
}, {
|
|
631
631
|
onSuccess: () => {
|
|
632
|
-
n.forEach((e) =>
|
|
632
|
+
n.forEach((e) => C.markCommitted(e)), T(!1), D({}), m.success("Saved");
|
|
633
633
|
},
|
|
634
634
|
onError: () => m.error("Failed to save")
|
|
635
635
|
});
|
|
636
636
|
}, [
|
|
637
|
-
T,
|
|
638
637
|
C,
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
638
|
+
x,
|
|
639
|
+
a,
|
|
640
|
+
u,
|
|
641
|
+
E,
|
|
642
|
+
O
|
|
643
|
+
]), H = P((e, t) => {
|
|
644
|
+
D((n) => ({
|
|
645
645
|
...n,
|
|
646
646
|
[e]: t
|
|
647
647
|
}));
|
|
648
648
|
}, []);
|
|
649
|
-
if (
|
|
650
|
-
if (!
|
|
651
|
-
let U = n(
|
|
649
|
+
if (ae) return /* @__PURE__ */ z(oe, {});
|
|
650
|
+
if (!O) return null;
|
|
651
|
+
let U = n(O, u), W = u.display?.display_field, G = U ? void 0 : W ? O[W] : O[u.fields.names()[0]], K = U || (G != null && typeof G != "object" ? i(G) : c(u.display.name)), q = O?.$refs, de = {
|
|
652
652
|
schema: l,
|
|
653
|
-
entity:
|
|
653
|
+
entity: u,
|
|
654
654
|
entityCode: t,
|
|
655
|
-
recordId:
|
|
656
|
-
record:
|
|
657
|
-
...
|
|
658
|
-
...
|
|
659
|
-
} :
|
|
655
|
+
recordId: a,
|
|
656
|
+
record: w ? {
|
|
657
|
+
...O,
|
|
658
|
+
...E
|
|
659
|
+
} : O,
|
|
660
660
|
isNew: !1,
|
|
661
|
-
mode:
|
|
662
|
-
onFieldChange:
|
|
661
|
+
mode: w ? "edit" : "display",
|
|
662
|
+
onFieldChange: w ? H : void 0,
|
|
663
663
|
refs: q,
|
|
664
|
-
objectProperties:
|
|
665
|
-
onSetProperty: h ? (e, t) =>
|
|
664
|
+
objectProperties: A ?? void 0,
|
|
665
|
+
onSetProperty: h ? (e, t) => F.mutate({
|
|
666
666
|
propertyCode: e,
|
|
667
667
|
value: t
|
|
668
668
|
}) : void 0,
|
|
669
|
-
isPropertyPending:
|
|
670
|
-
objectStatuses:
|
|
671
|
-
onSetStatus: h ? (e, t) =>
|
|
669
|
+
isPropertyPending: F.isPending,
|
|
670
|
+
objectStatuses: se ?? void 0,
|
|
671
|
+
onSetStatus: h ? (e, t) => M.mutate({
|
|
672
672
|
groupCode: e,
|
|
673
673
|
statusCode: t
|
|
674
674
|
}) : void 0,
|
|
675
|
-
isStatusPending:
|
|
676
|
-
relatedRecordsPresentation:
|
|
675
|
+
isStatusPending: M.isPending,
|
|
676
|
+
relatedRecordsPresentation: te
|
|
677
677
|
};
|
|
678
678
|
return /* @__PURE__ */ B("div", {
|
|
679
679
|
style: {
|
|
@@ -710,26 +710,26 @@ function K({ entityCode: t, recordId: o, items: s, schema: l, entity: d, onBackT
|
|
|
710
710
|
alignItems: "center",
|
|
711
711
|
gap: 6
|
|
712
712
|
},
|
|
713
|
-
children: [
|
|
713
|
+
children: [ee && /* @__PURE__ */ z(ne, {
|
|
714
714
|
icon: /* @__PURE__ */ z(e.back, { size: 14 }),
|
|
715
715
|
title: "Back to list",
|
|
716
|
-
onClick:
|
|
717
|
-
}), h && (
|
|
716
|
+
onClick: ee
|
|
717
|
+
}), h && (w ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(p, {
|
|
718
718
|
size: "xs",
|
|
719
719
|
icon: /* @__PURE__ */ z(e.x, { size: 12 }),
|
|
720
720
|
onClick: V,
|
|
721
721
|
children: "Cancel"
|
|
722
|
-
}), /* @__PURE__ */ z(
|
|
722
|
+
}), /* @__PURE__ */ z(p, {
|
|
723
723
|
kind: "primary",
|
|
724
724
|
size: "xs",
|
|
725
|
-
icon:
|
|
725
|
+
icon: x.isPending ? /* @__PURE__ */ z(d, { size: 12 }) : /* @__PURE__ */ z(e.save, { size: 12 }),
|
|
726
726
|
onClick: ue,
|
|
727
|
-
disabled:
|
|
728
|
-
children:
|
|
729
|
-
})] }) : /* @__PURE__ */ z(
|
|
727
|
+
disabled: x.isPending,
|
|
728
|
+
children: x.isPending ? "Saving…" : "Save"
|
|
729
|
+
})] }) : /* @__PURE__ */ z(p, {
|
|
730
730
|
size: "xs",
|
|
731
731
|
icon: /* @__PURE__ */ z(e.edit, { size: 12 }),
|
|
732
|
-
onClick:
|
|
732
|
+
onClick: le,
|
|
733
733
|
children: "Edit"
|
|
734
734
|
}))]
|
|
735
735
|
})]
|
|
@@ -742,7 +742,7 @@ function K({ entityCode: t, recordId: o, items: s, schema: l, entity: d, onBackT
|
|
|
742
742
|
flexDirection: "column",
|
|
743
743
|
gap: 12
|
|
744
744
|
},
|
|
745
|
-
children: s && s.length > 0 ? /* @__PURE__ */ z(
|
|
745
|
+
children: s && s.length > 0 ? /* @__PURE__ */ z(N, {
|
|
746
746
|
nodes: s,
|
|
747
747
|
ctx: de
|
|
748
748
|
}) : /* @__PURE__ */ B("p", {
|