@declarion/react 0.39.0 → 0.40.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-DziCVhq6.js → DraggableChildrenTable-Ctmn0liO.js} +27 -27
- package/dist-lib/{Grid-BTX2tkCT.js → Grid-BsIkTp3u.js} +42 -42
- package/dist-lib/{LayoutRenderer-CwMERoPJ.js → LayoutRenderer-D4oTfZhV.js} +562 -562
- package/dist-lib/{MarkdownRenderer-dHOTEhUa.js → MarkdownRenderer-B-2CrtjU.js} +1 -1
- package/dist-lib/{RefreshControl--UAgflh7.js → RefreshControl-VQf34HKZ.js} +201 -201
- package/dist-lib/SmartDetailPage.impl-HMaLVDlV.js +1802 -0
- package/dist-lib/{SmartRecordListPage.impl-CZXzVhPC.js → SmartRecordListPage.impl-Cxm7qvlZ.js} +239 -239
- package/dist-lib/components/shared/ActionButton.d.ts +1 -7
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/index.js +1788 -1666
- package/dist-lib/lib/actions.d.ts +27 -0
- package/dist-lib/{registry-DXNFRlbB.js → registry-DFtAh6zc.js} +1798 -2427
- package/dist-lib/testing.js +27 -27
- package/dist-lib/{useCurrentScreen-BA2lb-d7.js → useCurrentScreen-mw8TfE8q.js} +563 -361
- package/dist-lib/{useProperties-Br2DeOQh.js → useProperties-gMdnhdhO.js} +50 -50
- package/dist-lib/{value-C91loRXp.js → value-t9ETvWIJ.js} +4 -4
- package/package.json +1 -1
- package/dist-lib/SmartDetailPage.impl-Bj7MtHxi.js +0 -1827
- package/dist-lib/components/shared/ActionConfirmDialog.d.ts +0 -10
package/dist-lib/{SmartRecordListPage.impl-CZXzVhPC.js → SmartRecordListPage.impl-Cxm7qvlZ.js}
RENAMED
|
@@ -1,84 +1,84 @@
|
|
|
1
1
|
import { s as e } from "./DynamicIcon-DeRpAaXm.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { b as
|
|
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, Jn as a, Kn as o, N as s, Pn as c, Sn as l, Tn as u, Un as d, X as f, bn as p, er as ee, it as m, jt as h, or as te, q as ne, sr as g } from "./useCurrentScreen-mw8TfE8q.js";
|
|
3
|
+
import { G as _, K as v, U as y, W as b, Y as x, _ as re, a as S, c as C, k as w, q as T, s as E, w as ie } from "./registry-DFtAh6zc.js";
|
|
4
|
+
import { b as D, d as O, f as k, g as A, m as ae, n as j, p as oe, r as M, s as N } from "./useProperties-gMdnhdhO.js";
|
|
5
|
+
import { t as P } from "./LayoutRenderer-D4oTfZhV.js";
|
|
6
|
+
import { useCallback as F, useEffect as I, useMemo as L, useRef as R, useState as se } from "react";
|
|
7
|
+
import { useSearchParams as ce } from "react-router-dom";
|
|
8
|
+
import { Fragment as le, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/pages/SmartRecordListPage.impl.tsx
|
|
10
|
-
function V({ screenCode:
|
|
11
|
-
let [
|
|
12
|
-
|
|
13
|
-
let
|
|
14
|
-
let e =
|
|
10
|
+
function V({ screenCode: t }) {
|
|
11
|
+
let [n, r] = ce(), { data: a } = h(), s = ee(), c = a?.screens[t], p = c?.entity ? a?.entities[c.entity] : void 0, m = c?.entity;
|
|
12
|
+
ae(c, p, n.toString()), A(c?.route);
|
|
13
|
+
let g = re(), _ = n.get("selected") ?? null, v = n.get("search") ?? "", y = ne(v, 300), b = n.get("sort") ?? c?.sort_default ?? "", x = L(() => {
|
|
14
|
+
let e = O(n);
|
|
15
15
|
return e.length > 0 ? e : void 0;
|
|
16
|
-
}, [
|
|
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:
|
|
16
|
+
}, [n]), S = L(() => c?.columns ?? p?.fields.names().filter((e) => !p.fields.get(e)?.primary && !p.fields.get(e)?.auto && p.fields.get(e)?.display?.is_listable !== !1).slice(0, 4) ?? [], [c?.columns, p]), w = L(() => {
|
|
17
|
+
let e = c?.responsive?.[s.category]?.presentation;
|
|
18
|
+
return s.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
|
|
19
|
+
}, [c?.responsive, s.category]), T = L(() => {
|
|
20
|
+
let e = c?.responsive?.[s.category];
|
|
21
|
+
return e?.list?.presentation === "table" || e?.list?.presentation === "cards" ? e.list.presentation : e?.presentation === "table" || e?.presentation === "cards" ? e.presentation : s.category === "phone" ? "cards" : "table";
|
|
22
|
+
}, [c?.responsive, s.category]), ie = c?.responsive?.[s.category]?.layout?.related_records, j = L(() => E({
|
|
23
|
+
entity: p,
|
|
24
|
+
screen: c
|
|
25
|
+
}), [p, c]), M = L(() => C({
|
|
26
|
+
entity: p,
|
|
27
|
+
screen: c,
|
|
28
|
+
presentation: T,
|
|
29
29
|
visibleColumns: S,
|
|
30
|
-
card:
|
|
30
|
+
card: j,
|
|
31
31
|
sort: b
|
|
32
32
|
}), [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
p,
|
|
34
|
+
c,
|
|
35
|
+
T,
|
|
36
36
|
S,
|
|
37
|
-
|
|
37
|
+
j,
|
|
38
38
|
b
|
|
39
|
-
]),
|
|
39
|
+
]), P = p?.list_pagination === "cursor", { data: V, isLoading: H } = f(m, {
|
|
40
40
|
page: 1,
|
|
41
41
|
per_page: 200,
|
|
42
42
|
sort: b || void 0,
|
|
43
|
-
search:
|
|
43
|
+
search: y || void 0,
|
|
44
44
|
filters: x,
|
|
45
|
-
select:
|
|
46
|
-
expand:
|
|
45
|
+
select: M.selectFields,
|
|
46
|
+
expand: M.expandFields,
|
|
47
47
|
preview: !0,
|
|
48
|
-
screen:
|
|
49
|
-
}, !
|
|
48
|
+
screen: c?.fixed_filters ? t : void 0
|
|
49
|
+
}, !P), U = D(m, {
|
|
50
50
|
sort: b || void 0,
|
|
51
|
-
search:
|
|
51
|
+
search: y || void 0,
|
|
52
52
|
filters: x,
|
|
53
|
-
select:
|
|
54
|
-
expand:
|
|
53
|
+
select: M.selectFields,
|
|
54
|
+
expand: M.expandFields,
|
|
55
55
|
preview: !0,
|
|
56
|
-
screen:
|
|
56
|
+
screen: c?.fixed_filters ? t : void 0,
|
|
57
57
|
limit: 200
|
|
58
|
-
},
|
|
59
|
-
|
|
58
|
+
}, P), W = P ? U.rows : V?.data ?? [], K = P ? U.refs : V?.$refs, q = P ? U.isLoading : H, de = L(() => p?.fields.names().find((e) => p.fields.get(e)?.primary) ?? "id", [p]), fe = F((e, t) => {
|
|
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
|
-
}, [
|
|
64
|
-
|
|
63
|
+
}, [r]), pe = F((e) => {
|
|
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
|
-
}, [
|
|
69
|
-
|
|
70
|
-
let r = new URLSearchParams(n), i =
|
|
71
|
-
return a = t && t !== "__all__" ? [...
|
|
68
|
+
}, [r]), me = F((e, t) => {
|
|
69
|
+
r((n) => {
|
|
70
|
+
let r = new URLSearchParams(n), i = O(n), a;
|
|
71
|
+
return a = t && t !== "__all__" ? [...k(i, e), N(e, t)] : k(i, e), oe(a, r), r;
|
|
72
72
|
}, { replace: !0 });
|
|
73
|
-
}, [
|
|
74
|
-
|
|
73
|
+
}, [r]), J = (c?.list_resizable ?? !1) && w === "split" && s.category !== "phone" && !s.touch, Y = R(null), [X, Z] = se(null), Q = R(!1), $ = c?.list_width;
|
|
74
|
+
I(() => {
|
|
75
75
|
!J || !$?.endsWith("%") || Z(null);
|
|
76
76
|
}, [
|
|
77
77
|
J,
|
|
78
78
|
$,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
]),
|
|
79
|
+
s.width,
|
|
80
|
+
s.height
|
|
81
|
+
]), I(() => {
|
|
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: r }) {
|
|
|
89
89
|
J,
|
|
90
90
|
$,
|
|
91
91
|
X,
|
|
92
|
-
|
|
92
|
+
p
|
|
93
93
|
]);
|
|
94
|
-
let he =
|
|
95
|
-
|
|
94
|
+
let he = R(null);
|
|
95
|
+
I(() => () => {
|
|
96
96
|
he.current?.();
|
|
97
97
|
}, []);
|
|
98
|
-
let ge =
|
|
98
|
+
let ge = F((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: r }) {
|
|
|
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 (!
|
|
110
|
-
let _e = x?.length ?? 0, ve =
|
|
109
|
+
if (!a || !c || !p) return null;
|
|
110
|
+
let _e = x?.length ?? 0, ve = w === "split" || w === "stacked" || !_, ye = w === "split" || w === "stacked" || !!_, be = w !== "split" && _ ? () => fe(null, { replace: !0 }) : void 0, xe = w === "split" ? J && X !== null ? X : c.list_width ?? "320px" : "100%";
|
|
111
111
|
return /* @__PURE__ */ B("div", {
|
|
112
112
|
ref: Y,
|
|
113
|
-
"data-record-list-presentation":
|
|
113
|
+
"data-record-list-presentation": w,
|
|
114
114
|
style: {
|
|
115
115
|
display: "flex",
|
|
116
|
-
flexDirection:
|
|
116
|
+
flexDirection: w === "stacked" ? "column" : "row",
|
|
117
117
|
height: "100%",
|
|
118
118
|
minWidth: 0,
|
|
119
119
|
overflow: "hidden"
|
|
@@ -122,15 +122,15 @@ function V({ screenCode: r }) {
|
|
|
122
122
|
ve && /* @__PURE__ */ B("div", {
|
|
123
123
|
"data-testid": "record-list-panel",
|
|
124
124
|
style: {
|
|
125
|
-
flex:
|
|
125
|
+
flex: w === "split" ? "none" : "1 1 auto",
|
|
126
126
|
display: "flex",
|
|
127
127
|
flexDirection: "column",
|
|
128
128
|
overflow: "hidden",
|
|
129
|
-
borderRight:
|
|
130
|
-
borderBottom:
|
|
129
|
+
borderRight: w === "split" && !J ? "1px solid var(--divider)" : "none",
|
|
130
|
+
borderBottom: w === "stacked" ? "1px solid var(--divider)" : "none",
|
|
131
131
|
width: xe,
|
|
132
132
|
minWidth: 0,
|
|
133
|
-
height:
|
|
133
|
+
height: w === "stacked" ? "50%" : "100%"
|
|
134
134
|
},
|
|
135
135
|
children: [/* @__PURE__ */ B("div", {
|
|
136
136
|
style: {
|
|
@@ -141,51 +141,51 @@ function V({ screenCode: r }) {
|
|
|
141
141
|
borderBottom: "1px solid var(--divider)"
|
|
142
142
|
},
|
|
143
143
|
children: [
|
|
144
|
-
|
|
144
|
+
g.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(te, {
|
|
151
151
|
icon: /* @__PURE__ */ z(e.back, { size: 14 }),
|
|
152
152
|
title: "Back",
|
|
153
|
-
onClick:
|
|
153
|
+
onClick: g.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: u(c.display?.name) || u(p.display.name_plural)
|
|
161
161
|
})]
|
|
162
162
|
}),
|
|
163
|
-
/* @__PURE__ */ z(
|
|
163
|
+
/* @__PURE__ */ z(o, {
|
|
164
164
|
value: v,
|
|
165
165
|
onChange: pe,
|
|
166
|
-
placeholder: `Search ${
|
|
166
|
+
placeholder: `Search ${u(p.display.name_plural)}…`,
|
|
167
167
|
prefix: /* @__PURE__ */ z(e.search, { size: 13 })
|
|
168
168
|
}),
|
|
169
|
-
|
|
169
|
+
c.filters && c.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: c.filters.map((e) => {
|
|
176
|
+
let t = p.fields.get(e);
|
|
177
177
|
if (!t?.values) return null;
|
|
178
|
-
let n = x?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r =
|
|
178
|
+
let n = x?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r = l(t, e, a.entities);
|
|
179
179
|
return /* @__PURE__ */ z("div", {
|
|
180
180
|
style: { minWidth: 120 },
|
|
181
|
-
children: /* @__PURE__ */ z(
|
|
181
|
+
children: /* @__PURE__ */ z(d, {
|
|
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: u(e.name) || e.code
|
|
189
189
|
}))],
|
|
190
190
|
onChange: (t) => me(e, t),
|
|
191
191
|
placeholder: r
|
|
@@ -201,8 +201,8 @@ function V({ screenCode: r }) {
|
|
|
201
201
|
fontSize: 11,
|
|
202
202
|
color: "var(--text-3)"
|
|
203
203
|
},
|
|
204
|
-
children: [/* @__PURE__ */ z("span", { children: q ? "Loading…" : `${W.length} ${
|
|
205
|
-
onClick: () =>
|
|
204
|
+
children: [/* @__PURE__ */ z("span", { children: q ? "Loading…" : `${W.length} ${u(p.display.name_plural)}` }), _e > 0 && /* @__PURE__ */ z("button", {
|
|
205
|
+
onClick: () => r((e) => {
|
|
206
206
|
let t = new URLSearchParams(e);
|
|
207
207
|
return t.delete("filters"), t;
|
|
208
208
|
}, { replace: !0 }),
|
|
@@ -223,10 +223,10 @@ function V({ screenCode: r }) {
|
|
|
223
223
|
style: {
|
|
224
224
|
flex: 1,
|
|
225
225
|
overflowY: "auto",
|
|
226
|
-
padding:
|
|
227
|
-
display:
|
|
226
|
+
padding: T === "cards" ? 10 : 0,
|
|
227
|
+
display: T === "cards" ? "flex" : "block",
|
|
228
228
|
flexDirection: "column",
|
|
229
|
-
gap:
|
|
229
|
+
gap: T === "cards" ? 10 : void 0
|
|
230
230
|
},
|
|
231
231
|
children: q ? /* @__PURE__ */ z("div", {
|
|
232
232
|
style: {
|
|
@@ -248,19 +248,19 @@ function V({ screenCode: r }) {
|
|
|
248
248
|
color: "var(--text-3)"
|
|
249
249
|
},
|
|
250
250
|
children: "No records found"
|
|
251
|
-
}) : /* @__PURE__ */ B(
|
|
252
|
-
let t =
|
|
251
|
+
}) : /* @__PURE__ */ B(le, { children: [W.map((e) => {
|
|
252
|
+
let t = i(e[de]);
|
|
253
253
|
return /* @__PURE__ */ z(ue, {
|
|
254
254
|
record: e,
|
|
255
|
-
entity:
|
|
255
|
+
entity: p,
|
|
256
256
|
columns: S,
|
|
257
|
-
card:
|
|
258
|
-
presentation:
|
|
257
|
+
card: j,
|
|
258
|
+
presentation: T,
|
|
259
259
|
refs: K,
|
|
260
260
|
isSelected: t === _,
|
|
261
|
-
onClick: () => fe(t, { replace:
|
|
261
|
+
onClick: () => fe(t, { replace: w === "split" })
|
|
262
262
|
}, t);
|
|
263
|
-
}),
|
|
263
|
+
}), P && U.hasMore && /* @__PURE__ */ z("button", {
|
|
264
264
|
type: "button",
|
|
265
265
|
"data-testid": "record-list-load-more",
|
|
266
266
|
onClick: () => void U.fetchNextPage(),
|
|
@@ -298,16 +298,16 @@ function V({ screenCode: r }) {
|
|
|
298
298
|
flex: 1,
|
|
299
299
|
minWidth: 0,
|
|
300
300
|
overflow: "hidden",
|
|
301
|
-
height:
|
|
301
|
+
height: w === "stacked" ? "50%" : "100%"
|
|
302
302
|
},
|
|
303
303
|
children: _ ? /* @__PURE__ */ z(G, {
|
|
304
|
-
entityCode:
|
|
304
|
+
entityCode: m,
|
|
305
305
|
recordId: _,
|
|
306
|
-
items:
|
|
307
|
-
schema:
|
|
308
|
-
entity:
|
|
306
|
+
items: c.items,
|
|
307
|
+
schema: a,
|
|
308
|
+
entity: p,
|
|
309
309
|
onBackToList: be,
|
|
310
|
-
relatedRecordsPresentation:
|
|
310
|
+
relatedRecordsPresentation: ie
|
|
311
311
|
}, _) : /* @__PURE__ */ z("div", {
|
|
312
312
|
style: {
|
|
313
313
|
display: "flex",
|
|
@@ -320,7 +320,7 @@ function V({ screenCode: r }) {
|
|
|
320
320
|
style: { fontSize: 12.5 },
|
|
321
321
|
children: [
|
|
322
322
|
"Select a ",
|
|
323
|
-
|
|
323
|
+
u(p.display.name),
|
|
324
324
|
" to view details"
|
|
325
325
|
]
|
|
326
326
|
})
|
|
@@ -329,58 +329,58 @@ function V({ screenCode: r }) {
|
|
|
329
329
|
]
|
|
330
330
|
});
|
|
331
331
|
}
|
|
332
|
-
function ue({ record: e, entity:
|
|
333
|
-
let
|
|
334
|
-
if (
|
|
335
|
-
let
|
|
332
|
+
function ue({ record: e, entity: n, columns: r, card: i, presentation: a, refs: o, isSelected: s, onClick: c }) {
|
|
333
|
+
let l = t();
|
|
334
|
+
if (a === "cards") {
|
|
335
|
+
let t = i.badgeFields.filter((t) => H(n, e, t)), r = i.bodyFields.filter((t) => H(n, e, t)), a = i.metaFields.filter((t) => H(n, e, t));
|
|
336
336
|
return /* @__PURE__ */ B("button", {
|
|
337
337
|
type: "button",
|
|
338
338
|
"data-testid": "record-list-card",
|
|
339
|
-
"aria-current":
|
|
340
|
-
onClick:
|
|
339
|
+
"aria-current": s ? "true" : void 0,
|
|
340
|
+
onClick: c,
|
|
341
341
|
style: {
|
|
342
342
|
width: "100%",
|
|
343
343
|
textAlign: "left",
|
|
344
344
|
padding: 12,
|
|
345
345
|
border: "1px solid var(--border)",
|
|
346
346
|
borderRadius: 8,
|
|
347
|
-
background:
|
|
347
|
+
background: s ? "var(--row-selected-bg)" : "var(--surface)",
|
|
348
348
|
color: "var(--text)",
|
|
349
349
|
cursor: "pointer",
|
|
350
350
|
display: "flex",
|
|
351
351
|
flexDirection: "column",
|
|
352
352
|
gap: 8,
|
|
353
|
-
boxShadow:
|
|
353
|
+
boxShadow: s ? "inset 3px 0 0 var(--accent)" : "none"
|
|
354
354
|
},
|
|
355
355
|
children: [
|
|
356
356
|
/* @__PURE__ */ z(U, {
|
|
357
|
-
entity:
|
|
357
|
+
entity: n,
|
|
358
358
|
record: e,
|
|
359
|
-
field:
|
|
360
|
-
refs:
|
|
359
|
+
field: i.titleField,
|
|
360
|
+
refs: o
|
|
361
361
|
}),
|
|
362
|
-
|
|
362
|
+
i.subtitleField && /* @__PURE__ */ z("div", {
|
|
363
363
|
style: {
|
|
364
364
|
fontSize: 12,
|
|
365
365
|
color: "var(--text-3)",
|
|
366
366
|
overflowWrap: "anywhere"
|
|
367
367
|
},
|
|
368
|
-
children:
|
|
369
|
-
entity:
|
|
370
|
-
fieldName:
|
|
368
|
+
children: T({
|
|
369
|
+
entity: n,
|
|
370
|
+
fieldName: i.subtitleField,
|
|
371
371
|
record: e,
|
|
372
372
|
mode: "display",
|
|
373
|
-
refs:
|
|
374
|
-
locale:
|
|
373
|
+
refs: o,
|
|
374
|
+
locale: l
|
|
375
375
|
})
|
|
376
376
|
}),
|
|
377
|
-
|
|
377
|
+
t.length > 0 && /* @__PURE__ */ z("div", {
|
|
378
378
|
style: {
|
|
379
379
|
display: "flex",
|
|
380
380
|
flexWrap: "wrap",
|
|
381
381
|
gap: 6
|
|
382
382
|
},
|
|
383
|
-
children:
|
|
383
|
+
children: t.map((t) => /* @__PURE__ */ z("span", {
|
|
384
384
|
style: {
|
|
385
385
|
border: "1px solid var(--border)",
|
|
386
386
|
borderRadius: 999,
|
|
@@ -390,32 +390,32 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
390
390
|
maxWidth: "100%",
|
|
391
391
|
overflowWrap: "anywhere"
|
|
392
392
|
},
|
|
393
|
-
children:
|
|
394
|
-
entity:
|
|
395
|
-
fieldName:
|
|
393
|
+
children: T({
|
|
394
|
+
entity: n,
|
|
395
|
+
fieldName: t,
|
|
396
396
|
record: e,
|
|
397
397
|
mode: "display",
|
|
398
|
-
refs:
|
|
399
|
-
locale:
|
|
398
|
+
refs: o,
|
|
399
|
+
locale: l
|
|
400
400
|
})
|
|
401
|
-
},
|
|
401
|
+
}, t))
|
|
402
402
|
}),
|
|
403
|
-
|
|
403
|
+
r.length > 0 && /* @__PURE__ */ z("dl", {
|
|
404
404
|
style: {
|
|
405
405
|
display: "grid",
|
|
406
406
|
gridTemplateColumns: "minmax(72px, max-content) minmax(0, 1fr)",
|
|
407
407
|
gap: "5px 10px",
|
|
408
408
|
margin: 0
|
|
409
409
|
},
|
|
410
|
-
children:
|
|
411
|
-
entity:
|
|
410
|
+
children: r.map((t) => /* @__PURE__ */ z(W, {
|
|
411
|
+
entity: n,
|
|
412
412
|
record: e,
|
|
413
|
-
fieldName:
|
|
414
|
-
refs:
|
|
415
|
-
locale:
|
|
416
|
-
},
|
|
413
|
+
fieldName: t,
|
|
414
|
+
refs: o,
|
|
415
|
+
locale: l
|
|
416
|
+
}, t))
|
|
417
417
|
}),
|
|
418
|
-
|
|
418
|
+
a.length > 0 && /* @__PURE__ */ z("div", {
|
|
419
419
|
style: {
|
|
420
420
|
display: "flex",
|
|
421
421
|
flexWrap: "wrap",
|
|
@@ -423,34 +423,34 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
423
423
|
fontSize: 11,
|
|
424
424
|
color: "var(--text-3)"
|
|
425
425
|
},
|
|
426
|
-
children:
|
|
426
|
+
children: a.map((t) => /* @__PURE__ */ z("span", {
|
|
427
427
|
style: {
|
|
428
428
|
minWidth: 0,
|
|
429
429
|
overflowWrap: "anywhere"
|
|
430
430
|
},
|
|
431
|
-
children:
|
|
432
|
-
entity:
|
|
433
|
-
fieldName:
|
|
431
|
+
children: T({
|
|
432
|
+
entity: n,
|
|
433
|
+
fieldName: t,
|
|
434
434
|
record: e,
|
|
435
435
|
mode: "display",
|
|
436
|
-
refs:
|
|
437
|
-
locale:
|
|
436
|
+
refs: o,
|
|
437
|
+
locale: l
|
|
438
438
|
})
|
|
439
|
-
},
|
|
439
|
+
}, t))
|
|
440
440
|
})
|
|
441
441
|
]
|
|
442
442
|
});
|
|
443
443
|
}
|
|
444
|
-
let
|
|
444
|
+
let u = r[0], d = r[1], f = r.slice(2, 4);
|
|
445
445
|
return /* @__PURE__ */ B("button", {
|
|
446
|
-
onClick:
|
|
446
|
+
onClick: c,
|
|
447
447
|
style: {
|
|
448
448
|
width: "100%",
|
|
449
449
|
textAlign: "left",
|
|
450
450
|
padding: "10px 12px",
|
|
451
451
|
borderBottom: "1px solid var(--divider)",
|
|
452
|
-
background:
|
|
453
|
-
borderLeft:
|
|
452
|
+
background: s ? "var(--row-selected-bg)" : "transparent",
|
|
453
|
+
borderLeft: s ? "2px solid var(--accent)" : "2px solid transparent",
|
|
454
454
|
cursor: "pointer",
|
|
455
455
|
transition: "background-color .12s",
|
|
456
456
|
display: "flex",
|
|
@@ -460,12 +460,12 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
460
460
|
borderBottomColor: "var(--divider)"
|
|
461
461
|
},
|
|
462
462
|
onMouseEnter: (e) => {
|
|
463
|
-
|
|
463
|
+
s || (e.currentTarget.style.background = "var(--surface-3)");
|
|
464
464
|
},
|
|
465
465
|
onMouseLeave: (e) => {
|
|
466
|
-
|
|
466
|
+
s || (e.currentTarget.style.background = "transparent");
|
|
467
467
|
},
|
|
468
|
-
children: [
|
|
468
|
+
children: [u && /* @__PURE__ */ z("div", {
|
|
469
469
|
style: {
|
|
470
470
|
fontSize: 12.5,
|
|
471
471
|
fontWeight: 500,
|
|
@@ -474,13 +474,13 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
474
474
|
whiteSpace: "nowrap",
|
|
475
475
|
color: "var(--text)"
|
|
476
476
|
},
|
|
477
|
-
children:
|
|
478
|
-
entity:
|
|
479
|
-
fieldName:
|
|
477
|
+
children: T({
|
|
478
|
+
entity: n,
|
|
479
|
+
fieldName: u,
|
|
480
480
|
record: e,
|
|
481
481
|
mode: "display",
|
|
482
|
-
refs:
|
|
483
|
-
locale:
|
|
482
|
+
refs: o,
|
|
483
|
+
locale: l
|
|
484
484
|
})
|
|
485
485
|
}), /* @__PURE__ */ B("div", {
|
|
486
486
|
style: {
|
|
@@ -488,7 +488,7 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
488
488
|
alignItems: "center",
|
|
489
489
|
gap: 6
|
|
490
490
|
},
|
|
491
|
-
children: [
|
|
491
|
+
children: [d && /* @__PURE__ */ z("div", {
|
|
492
492
|
style: {
|
|
493
493
|
fontSize: 11,
|
|
494
494
|
color: "var(--text-3)",
|
|
@@ -497,13 +497,13 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
497
497
|
textOverflow: "ellipsis",
|
|
498
498
|
whiteSpace: "nowrap"
|
|
499
499
|
},
|
|
500
|
-
children:
|
|
501
|
-
entity:
|
|
502
|
-
fieldName:
|
|
500
|
+
children: T({
|
|
501
|
+
entity: n,
|
|
502
|
+
fieldName: d,
|
|
503
503
|
record: e,
|
|
504
504
|
mode: "display",
|
|
505
|
-
refs:
|
|
506
|
-
locale:
|
|
505
|
+
refs: o,
|
|
506
|
+
locale: l
|
|
507
507
|
})
|
|
508
508
|
}), /* @__PURE__ */ z("div", {
|
|
509
509
|
style: {
|
|
@@ -512,17 +512,17 @@ function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs:
|
|
|
512
512
|
gap: 4,
|
|
513
513
|
flexShrink: 0
|
|
514
514
|
},
|
|
515
|
-
children:
|
|
515
|
+
children: f.map((t) => v(n, e, t) == null ? null : /* @__PURE__ */ z("div", {
|
|
516
516
|
style: { fontSize: 11 },
|
|
517
|
-
children:
|
|
518
|
-
entity:
|
|
519
|
-
fieldName:
|
|
517
|
+
children: T({
|
|
518
|
+
entity: n,
|
|
519
|
+
fieldName: t,
|
|
520
520
|
record: e,
|
|
521
521
|
mode: "display",
|
|
522
|
-
refs:
|
|
523
|
-
locale:
|
|
522
|
+
refs: o,
|
|
523
|
+
locale: l
|
|
524
524
|
})
|
|
525
|
-
},
|
|
525
|
+
}, t))
|
|
526
526
|
})]
|
|
527
527
|
})]
|
|
528
528
|
});
|
|
@@ -531,8 +531,8 @@ function H(e, t, n) {
|
|
|
531
531
|
let r = v(e, t, n);
|
|
532
532
|
return !(r == null || r === "" || Array.isArray(r) && r.length === 0);
|
|
533
533
|
}
|
|
534
|
-
function U({ entity: e, record:
|
|
535
|
-
let
|
|
534
|
+
function U({ entity: e, record: r, field: i, refs: a }) {
|
|
535
|
+
let o = t(), s = n(r, e);
|
|
536
536
|
return /* @__PURE__ */ z("div", {
|
|
537
537
|
style: {
|
|
538
538
|
fontSize: 13.5,
|
|
@@ -540,28 +540,28 @@ function U({ entity: e, record: t, field: n, refs: r }) {
|
|
|
540
540
|
color: "var(--text)",
|
|
541
541
|
overflowWrap: "anywhere"
|
|
542
542
|
},
|
|
543
|
-
children: (
|
|
543
|
+
children: (i ? T({
|
|
544
544
|
entity: e,
|
|
545
|
-
fieldName:
|
|
546
|
-
record:
|
|
545
|
+
fieldName: i,
|
|
546
|
+
record: r,
|
|
547
547
|
mode: "display",
|
|
548
|
-
refs:
|
|
549
|
-
locale:
|
|
550
|
-
}) :
|
|
548
|
+
refs: a,
|
|
549
|
+
locale: o
|
|
550
|
+
}) : s) || u(e.display.name)
|
|
551
551
|
});
|
|
552
552
|
}
|
|
553
553
|
function W({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
|
|
554
554
|
let a = v(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(le, { 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: l(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: T({
|
|
574
574
|
entity: e,
|
|
575
575
|
fieldName: n,
|
|
576
576
|
record: t,
|
|
@@ -581,7 +581,7 @@ function W({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
|
|
|
581
581
|
})] }) : null;
|
|
582
582
|
}
|
|
583
583
|
function G({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList: a, relatedRecordsPresentation: o }) {
|
|
584
|
-
return /* @__PURE__ */ z(
|
|
584
|
+
return /* @__PURE__ */ z(s, { children: /* @__PURE__ */ z(K, {
|
|
585
585
|
entityCode: e,
|
|
586
586
|
recordId: t,
|
|
587
587
|
items: n,
|
|
@@ -591,89 +591,89 @@ function G({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackT
|
|
|
591
591
|
relatedRecordsPresentation: o
|
|
592
592
|
}) });
|
|
593
593
|
}
|
|
594
|
-
function K({ entityCode: t, recordId:
|
|
595
|
-
let
|
|
594
|
+
function K({ entityCode: t, recordId: o, items: s, schema: l, entity: d, onBackToList: f, relatedRecordsPresentation: ee }) {
|
|
595
|
+
let h = p(d, "update"), { data: ne, isLoading: re } = S(t, L(() => o ? c(d, o) : void 0, [o, d])), C = w(t), T = r(), [E, D] = se(!1), [O, k] = se({}), A = ne?.data, ae = A?.$statuses, oe = A?.$properties, N = M(t, o), I = j(t, o), R = L(() => {
|
|
596
596
|
let e = /* @__PURE__ */ new Set();
|
|
597
|
-
for (let [t, n] of
|
|
598
|
-
for (let [t] of
|
|
597
|
+
for (let [t, n] of d.fields) !n.auto && !n.primary && e.add(t);
|
|
598
|
+
for (let [t] of d.files ?? []) e.add(t);
|
|
599
599
|
return e;
|
|
600
|
-
}, [
|
|
601
|
-
if (
|
|
600
|
+
}, [d]), ce = F(() => {
|
|
601
|
+
if (A) {
|
|
602
602
|
let e = {};
|
|
603
|
-
|
|
604
|
-
let n = v(
|
|
605
|
-
e[t] =
|
|
606
|
-
}),
|
|
603
|
+
R.forEach((t) => {
|
|
604
|
+
let n = v(d, A, t);
|
|
605
|
+
e[t] = _(d, t) ? n ?? null : n ?? "";
|
|
606
|
+
}), k(e);
|
|
607
607
|
}
|
|
608
|
-
|
|
608
|
+
D(!0);
|
|
609
609
|
}, [
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
]), V =
|
|
614
|
-
await
|
|
615
|
-
}, [
|
|
616
|
-
let e = {}, t =
|
|
617
|
-
entity:
|
|
618
|
-
formData:
|
|
619
|
-
record:
|
|
610
|
+
A,
|
|
611
|
+
R,
|
|
612
|
+
d
|
|
613
|
+
]), V = F(async () => {
|
|
614
|
+
await T.flushAllDrafts(), D(!1), k({});
|
|
615
|
+
}, [T]), ue = F(() => {
|
|
616
|
+
let e = {}, t = y({
|
|
617
|
+
entity: d,
|
|
618
|
+
formData: O,
|
|
619
|
+
record: A,
|
|
620
620
|
isNew: !1
|
|
621
|
-
}), n =
|
|
622
|
-
for (let [t, n] of Object.entries(
|
|
621
|
+
}), n = b(t);
|
|
622
|
+
for (let [t, n] of Object.entries(O)) d.files?.has(t) || (e[t] = x(d, t, n));
|
|
623
623
|
if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0) {
|
|
624
|
-
|
|
624
|
+
D(!1), k({});
|
|
625
625
|
return;
|
|
626
626
|
}
|
|
627
|
-
|
|
628
|
-
pkValues:
|
|
627
|
+
C.mutate({
|
|
628
|
+
pkValues: o,
|
|
629
629
|
data: e
|
|
630
630
|
}, {
|
|
631
631
|
onSuccess: () => {
|
|
632
|
-
n.forEach((e) =>
|
|
632
|
+
n.forEach((e) => T.markCommitted(e)), D(!1), k({}), m.success("Saved");
|
|
633
633
|
},
|
|
634
|
-
onError: () =>
|
|
634
|
+
onError: () => m.error("Failed to save")
|
|
635
635
|
});
|
|
636
636
|
}, [
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
]), H =
|
|
644
|
-
|
|
637
|
+
T,
|
|
638
|
+
C,
|
|
639
|
+
o,
|
|
640
|
+
d,
|
|
641
|
+
O,
|
|
642
|
+
A
|
|
643
|
+
]), H = F((e, t) => {
|
|
644
|
+
k((n) => ({
|
|
645
645
|
...n,
|
|
646
646
|
[e]: t
|
|
647
647
|
}));
|
|
648
648
|
}, []);
|
|
649
|
-
if (re) return /* @__PURE__ */ z(
|
|
650
|
-
if (!
|
|
651
|
-
let U =
|
|
652
|
-
schema:
|
|
653
|
-
entity:
|
|
649
|
+
if (re) return /* @__PURE__ */ z(ie, {});
|
|
650
|
+
if (!A) return null;
|
|
651
|
+
let U = n(A, d), W = d.display?.display_field, G = U ? void 0 : W ? A[W] : A[d.fields.names()[0]], K = U || (G != null && typeof G != "object" ? i(G) : u(d.display.name)), q = A?.$refs, de = {
|
|
652
|
+
schema: l,
|
|
653
|
+
entity: d,
|
|
654
654
|
entityCode: t,
|
|
655
|
-
recordId:
|
|
656
|
-
record:
|
|
657
|
-
...
|
|
658
|
-
...
|
|
659
|
-
} :
|
|
655
|
+
recordId: o,
|
|
656
|
+
record: E ? {
|
|
657
|
+
...A,
|
|
658
|
+
...O
|
|
659
|
+
} : A,
|
|
660
660
|
isNew: !1,
|
|
661
|
-
mode:
|
|
662
|
-
onFieldChange:
|
|
661
|
+
mode: E ? "edit" : "display",
|
|
662
|
+
onFieldChange: E ? H : void 0,
|
|
663
663
|
refs: q,
|
|
664
|
-
objectProperties:
|
|
665
|
-
onSetProperty:
|
|
664
|
+
objectProperties: oe ?? void 0,
|
|
665
|
+
onSetProperty: h ? (e, t) => I.mutate({
|
|
666
666
|
propertyCode: e,
|
|
667
667
|
value: t
|
|
668
668
|
}) : void 0,
|
|
669
|
-
isPropertyPending:
|
|
670
|
-
objectStatuses:
|
|
671
|
-
onSetStatus:
|
|
669
|
+
isPropertyPending: I.isPending,
|
|
670
|
+
objectStatuses: ae ?? void 0,
|
|
671
|
+
onSetStatus: h ? (e, t) => N.mutate({
|
|
672
672
|
groupCode: e,
|
|
673
673
|
statusCode: t
|
|
674
674
|
}) : void 0,
|
|
675
|
-
isStatusPending:
|
|
676
|
-
relatedRecordsPresentation:
|
|
675
|
+
isStatusPending: N.isPending,
|
|
676
|
+
relatedRecordsPresentation: ee
|
|
677
677
|
};
|
|
678
678
|
return /* @__PURE__ */ B("div", {
|
|
679
679
|
style: {
|
|
@@ -710,26 +710,26 @@ function K({ entityCode: t, recordId: i, items: o, schema: ee, entity: f, onBack
|
|
|
710
710
|
alignItems: "center",
|
|
711
711
|
gap: 6
|
|
712
712
|
},
|
|
713
|
-
children: [
|
|
713
|
+
children: [f && /* @__PURE__ */ z(te, {
|
|
714
714
|
icon: /* @__PURE__ */ z(e.back, { size: 14 }),
|
|
715
715
|
title: "Back to list",
|
|
716
|
-
onClick:
|
|
717
|
-
}),
|
|
716
|
+
onClick: f
|
|
717
|
+
}), h && (E ? /* @__PURE__ */ B(le, { children: [/* @__PURE__ */ z(g, {
|
|
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(g, {
|
|
723
723
|
kind: "primary",
|
|
724
724
|
size: "xs",
|
|
725
|
-
icon:
|
|
725
|
+
icon: C.isPending ? /* @__PURE__ */ z(a, { size: 12 }) : /* @__PURE__ */ z(e.save, { size: 12 }),
|
|
726
726
|
onClick: ue,
|
|
727
|
-
disabled:
|
|
728
|
-
children:
|
|
729
|
-
})] }) : /* @__PURE__ */ z(
|
|
727
|
+
disabled: C.isPending,
|
|
728
|
+
children: C.isPending ? "Saving…" : "Save"
|
|
729
|
+
})] }) : /* @__PURE__ */ z(g, {
|
|
730
730
|
size: "xs",
|
|
731
731
|
icon: /* @__PURE__ */ z(e.edit, { size: 12 }),
|
|
732
|
-
onClick:
|
|
732
|
+
onClick: ce,
|
|
733
733
|
children: "Edit"
|
|
734
734
|
}))]
|
|
735
735
|
})]
|
|
@@ -742,8 +742,8 @@ function K({ entityCode: t, recordId: i, items: o, schema: ee, entity: f, onBack
|
|
|
742
742
|
flexDirection: "column",
|
|
743
743
|
gap: 12
|
|
744
744
|
},
|
|
745
|
-
children:
|
|
746
|
-
nodes:
|
|
745
|
+
children: s && s.length > 0 ? /* @__PURE__ */ z(P, {
|
|
746
|
+
nodes: s,
|
|
747
747
|
ctx: de
|
|
748
748
|
}) : /* @__PURE__ */ B("p", {
|
|
749
749
|
style: {
|