@declarion/react 0.52.0 → 0.53.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-CJCjc_cd.js → DraggableChildrenTable-BQZTvZaU.js} +35 -35
- package/dist-lib/{Grid-DUjbQg3r.js → Grid-B9Tiytbd.js} +28 -28
- package/dist-lib/{LayoutRenderer-DbdxC-Bq.js → LayoutRenderer-D_v9OD_A.js} +920 -922
- package/dist-lib/{ListCardsBody-C8ofksQb.js → ListCardsBody-dRnXsQ7A.js} +14 -14
- package/dist-lib/{MarkdownRenderer-B9_5fwuE.js → MarkdownRenderer-BCyrsLrd.js} +10 -10
- package/dist-lib/{record-documents-key-8fdm7C10.js → RecordIdBadge-CGxPR-8q.js} +1 -4
- package/dist-lib/{RefreshControl-C-8UCyau.js → RefreshControl-CV8nGACW.js} +120 -122
- package/dist-lib/{SmartDetailPage.impl-DWjNQ052.js → SmartDetailPage.impl-DWprVNMb.js} +376 -377
- package/dist-lib/{SmartListPage.impl-yKBK7a8b.js → SmartListPage.impl-BwWURGwa.js} +1098 -1099
- package/dist-lib/{SmartRecordListPage.impl-DRpU_DOC.js → SmartRecordListPage.impl-BKKBShAg.js} +183 -183
- package/dist-lib/{SortHeaderMenu-CbihbEGd.js → SortHeaderMenu-pgi4sxMs.js} +1 -1
- package/dist-lib/{action-dispatch-C28UhXXA.js → action-dispatch-DlHTYag7.js} +382 -382
- package/dist-lib/api/events.d.ts +27 -5
- package/dist-lib/{cardProjection-Bp_ZPLUE.js → cardProjection-C7Orz841.js} +146 -204
- package/dist-lib/components/pages/DocumentsMenu.d.ts +1 -1
- package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +2 -2
- package/dist-lib/components/pages/list/useListQuery.d.ts +6 -1
- package/dist-lib/components/shared/RefreshControl.d.ts +7 -1
- package/dist-lib/components/shared/useOwnRefresh.d.ts +9 -0
- package/dist-lib/{field-classification-CeYJlsNq.js → field-classification-EY8CFF3P.js} +301 -320
- package/dist-lib/{format-count-C3N-WxEy.js → format-count-BHkaDr9V.js} +245 -245
- package/dist-lib/hooks/useMutations.d.ts +1 -1
- package/dist-lib/hooks/useSSE.d.ts +24 -4
- package/dist-lib/index.js +1541 -1832
- package/dist-lib/lib/document-templates.d.ts +1 -1
- package/dist-lib/lib/realtime-reconcile.d.ts +43 -0
- package/dist-lib/{peekDraftStore-D3sowXga.js → peekDraftStore-1pIajluX.js} +36 -36
- package/dist-lib/{registry-p6CejATt.js → registry-C5ug25M8.js} +507 -507
- package/dist-lib/stores/realtime.d.ts +20 -0
- package/dist-lib/testing.js +35 -35
- package/dist-lib/{useCurrentScreen-74x5yJNb.js → useCurrentScreen-BdnZq8vZ.js} +2504 -1557
- package/dist-lib/{useListQuery-D75bgLLz.js → useListQuery-BxgrPZIB.js} +13 -10
- package/dist-lib/{useProperties-C5fZp12D.js → useProperties-Bhi9Wn5O.js} +25 -25
- package/dist-lib/useTabSearchMirror-Dl5x0xKu.js +177 -0
- package/dist-lib/{value-DKekzcjz.js → value-Rp-5W3o8.js} +25 -25
- package/package.json +7 -7
- package/dist-lib/useTabSearchMirror-D_wzoYRz.js +0 -406
package/dist-lib/{SmartRecordListPage.impl-DRpU_DOC.js → SmartRecordListPage.impl-BKKBShAg.js}
RENAMED
|
@@ -1,117 +1,117 @@
|
|
|
1
1
|
import { s as e } from "./DynamicIcon-DW5krHuX.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as _ } from "./registry-
|
|
4
|
-
import {
|
|
5
|
-
import { f as y, h as b, p as x, u as S } from "./action-dispatch-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { n as oe,
|
|
9
|
-
import { t as
|
|
10
|
-
import { t as
|
|
2
|
+
import { Cr as t, Dr as n, Fr as r, Ir as i, Jn as a, Kn as o, Mt as s, Yn as c, Zn as l, an as u, at as d, h as f, lr as ee, nt as p, or as m, st as h, vr as te, xr as g, yt as ne } from "./useCurrentScreen-BdnZq8vZ.js";
|
|
3
|
+
import { a as _ } from "./registry-C5ug25M8.js";
|
|
4
|
+
import { T as re, l as ie, p as v } from "./field-classification-EY8CFF3P.js";
|
|
5
|
+
import { f as y, h as b, p as x, u as S } from "./action-dispatch-DlHTYag7.js";
|
|
6
|
+
import { a as C, c as w, n as T, s as E, t as D } from "./cardProjection-C7Orz841.js";
|
|
7
|
+
import { n as ae, r as O } from "./useProperties-Bhi9Wn5O.js";
|
|
8
|
+
import { c as k, f as A, h as j, m as M, n as oe, t as se } from "./useTabSearchMirror-Dl5x0xKu.js";
|
|
9
|
+
import { t as N } from "./LayoutRenderer-D_v9OD_A.js";
|
|
10
|
+
import { t as P } from "./useListQuery-BxgrPZIB.js";
|
|
11
11
|
import { useCallback as F, useEffect as I, useMemo as L, useRef as R, useState as z } from "react";
|
|
12
12
|
import { useSearchParams as ce } from "react-router";
|
|
13
13
|
import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
14
14
|
//#region src/components/pages/SmartRecordListPage.impl.tsx
|
|
15
15
|
var le = 200;
|
|
16
16
|
function U({ screenCode: t }) {
|
|
17
|
-
let [
|
|
18
|
-
|
|
19
|
-
let h =
|
|
20
|
-
let e =
|
|
17
|
+
let [i, o] = ce(), { data: s } = u(), c = n(), d = s?.screens[t], p = d?.entity ? s?.entities[d.entity] : void 0, m = d?.entity;
|
|
18
|
+
oe(d, p, i.toString()), se(d?.route);
|
|
19
|
+
let h = ie(), _ = i.get("selected") ?? null, v = i.get("search") ?? "", y = ne(v, 300), b = i.get("sort") ?? d?.sort_default ?? "", x = L(() => A(i), [i]), S = x.filters.length > 0 ? x.filters : void 0, C = L(() => d?.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) ?? [], [d?.columns, p]), w = L(() => {
|
|
20
|
+
let e = d?.responsive?.[c.category]?.presentation;
|
|
21
21
|
return c.category === "phone" ? "drilldown" : e === "split" || e === "drilldown" || e === "stacked" ? e : "split";
|
|
22
|
-
}, [
|
|
23
|
-
let e =
|
|
22
|
+
}, [d?.responsive, c.category]), E = L(() => {
|
|
23
|
+
let e = d?.responsive?.[c.category];
|
|
24
24
|
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";
|
|
25
|
-
}, [
|
|
26
|
-
entity:
|
|
27
|
-
screen:
|
|
28
|
-
}), [
|
|
29
|
-
entity:
|
|
30
|
-
screen:
|
|
25
|
+
}, [d?.responsive, c.category]), ae = d?.responsive?.[c.category]?.layout?.related_records, O = L(() => D({
|
|
26
|
+
entity: p,
|
|
27
|
+
screen: d
|
|
28
|
+
}), [p, d]), N = L(() => T({
|
|
29
|
+
entity: p,
|
|
30
|
+
screen: d,
|
|
31
31
|
presentation: E,
|
|
32
32
|
visibleColumns: C,
|
|
33
|
-
card:
|
|
33
|
+
card: O,
|
|
34
34
|
sort: b
|
|
35
35
|
}), [
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
p,
|
|
37
|
+
d,
|
|
38
38
|
E,
|
|
39
39
|
C,
|
|
40
|
-
|
|
40
|
+
O,
|
|
41
41
|
b
|
|
42
|
-
]), U =
|
|
43
|
-
entity:
|
|
44
|
-
entityCode:
|
|
45
|
-
screen:
|
|
42
|
+
]), U = P({
|
|
43
|
+
entity: p,
|
|
44
|
+
entityCode: m,
|
|
45
|
+
screen: d,
|
|
46
46
|
screenCode: t,
|
|
47
47
|
page: 1,
|
|
48
48
|
perPage: le,
|
|
49
|
-
sortForRequest:
|
|
49
|
+
sortForRequest: f(b),
|
|
50
50
|
debouncedSearch: y,
|
|
51
51
|
filters: x.filters,
|
|
52
52
|
filterError: !!x.error,
|
|
53
53
|
includeDeleted: !1,
|
|
54
|
-
expand:
|
|
55
|
-
select:
|
|
54
|
+
expand: N.expandFields,
|
|
55
|
+
select: N.selectFields,
|
|
56
56
|
runCountQuery: !1,
|
|
57
|
-
urlKey: `${
|
|
58
|
-
}), W = U.rows, G = U.refs, K = U.isLoading, q = L(() =>
|
|
59
|
-
|
|
57
|
+
urlKey: `${m ?? ""}|${i.toString()}`
|
|
58
|
+
}), W = U.rows, G = U.refs, K = U.isLoading, q = L(() => p?.fields.names().find((e) => p.fields.get(e)?.primary) ?? "id", [p]), J = F((e, t) => {
|
|
59
|
+
o((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
|
+
}, [o]), fe = F((e) => {
|
|
64
|
+
o((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
|
-
|
|
68
|
+
}, [o]), pe = F((e, t) => {
|
|
69
|
+
o((n) => {
|
|
70
70
|
let r = new URLSearchParams(n), i = A(n).filters, a;
|
|
71
71
|
return a = t && t !== "__all__" ? [...M(i, e), k(e, t)] : M(i, e), j(a, r), r;
|
|
72
72
|
}, { replace: !0 });
|
|
73
|
-
}, [
|
|
73
|
+
}, [o]), Y = (d?.list_resizable ?? !1) && w === "split" && c.category !== "phone" && !c.touch, X = R(null), [Z, Q] = z(null), me = R(!1), $ = d?.list_width;
|
|
74
74
|
I(() => {
|
|
75
|
-
!Y ||
|
|
75
|
+
!Y || !$?.endsWith("%") || Q(null);
|
|
76
76
|
}, [
|
|
77
77
|
Y,
|
|
78
|
-
|
|
78
|
+
$,
|
|
79
79
|
c.width,
|
|
80
80
|
c.height
|
|
81
81
|
]), I(() => {
|
|
82
|
-
if (!Y ||
|
|
83
|
-
let e =
|
|
82
|
+
if (!Y || Z !== null) return;
|
|
83
|
+
let e = X.current;
|
|
84
84
|
if (e) {
|
|
85
|
-
if (
|
|
86
|
-
let t = parseFloat(
|
|
87
|
-
|
|
88
|
-
} else
|
|
85
|
+
if ($ && $.endsWith("%")) {
|
|
86
|
+
let t = parseFloat($) / 100;
|
|
87
|
+
Q(Math.round(e.getBoundingClientRect().width * t));
|
|
88
|
+
} else Q($ && parseInt($, 10) || 320);
|
|
89
89
|
}
|
|
90
90
|
}, [
|
|
91
91
|
Y,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
$,
|
|
93
|
+
Z,
|
|
94
|
+
p
|
|
95
95
|
]);
|
|
96
|
-
let
|
|
96
|
+
let he = R(null);
|
|
97
97
|
I(() => () => {
|
|
98
|
-
|
|
98
|
+
he.current?.();
|
|
99
99
|
}, []);
|
|
100
100
|
let ge = F((e) => {
|
|
101
|
-
e.preventDefault(),
|
|
102
|
-
let t = e.clientX, n =
|
|
103
|
-
if (!
|
|
104
|
-
let r = (
|
|
105
|
-
|
|
101
|
+
e.preventDefault(), me.current = !0;
|
|
102
|
+
let t = e.clientX, n = Z ?? 320, r = (e) => {
|
|
103
|
+
if (!me.current) return;
|
|
104
|
+
let r = (X.current?.getBoundingClientRect().width ?? window.innerWidth) - 300, i = Math.max(200, Math.min(r, n + e.clientX - t));
|
|
105
|
+
Q(i);
|
|
106
106
|
}, i = () => {
|
|
107
|
-
|
|
107
|
+
me.current = !1, document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", i), document.body.style.cursor = "", document.body.style.userSelect = "", he.current = null;
|
|
108
108
|
};
|
|
109
|
-
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i),
|
|
110
|
-
}, [
|
|
111
|
-
if (!
|
|
112
|
-
let _e = S?.length ?? 0, ve = w === "split" || w === "stacked" || !_, ye = w === "split" || w === "stacked" || !!_, be = w !== "split" && _ ? () => J(null, { replace: !0 }) : void 0, xe = w === "split" ? Y &&
|
|
109
|
+
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", r), document.addEventListener("mouseup", i), he.current = i;
|
|
110
|
+
}, [Z]);
|
|
111
|
+
if (!s || !d || !p) return null;
|
|
112
|
+
let _e = S?.length ?? 0, ve = w === "split" || w === "stacked" || !_, ye = w === "split" || w === "stacked" || !!_, be = w !== "split" && _ ? () => J(null, { replace: !0 }) : void 0, xe = w === "split" ? Y && Z !== null ? Z : d.list_width ?? "320px" : "100%";
|
|
113
113
|
return /* @__PURE__ */ H("div", {
|
|
114
|
-
ref:
|
|
114
|
+
ref: X,
|
|
115
115
|
"data-record-list-presentation": w,
|
|
116
116
|
style: {
|
|
117
117
|
display: "flex",
|
|
@@ -138,7 +138,7 @@ function U({ screenCode: t }) {
|
|
|
138
138
|
style: {
|
|
139
139
|
paddingTop: 12,
|
|
140
140
|
paddingBottom: 12,
|
|
141
|
-
...
|
|
141
|
+
...re(12),
|
|
142
142
|
display: "flex",
|
|
143
143
|
flexDirection: "column",
|
|
144
144
|
gap: 8,
|
|
@@ -151,7 +151,7 @@ function U({ screenCode: t }) {
|
|
|
151
151
|
alignItems: "center",
|
|
152
152
|
gap: 8
|
|
153
153
|
},
|
|
154
|
-
children: [/* @__PURE__ */ V(
|
|
154
|
+
children: [/* @__PURE__ */ V(r, {
|
|
155
155
|
icon: /* @__PURE__ */ V(e.back, { size: 14 }),
|
|
156
156
|
title: "Back",
|
|
157
157
|
onClick: h.goBack
|
|
@@ -161,13 +161,13 @@ function U({ screenCode: t }) {
|
|
|
161
161
|
fontWeight: 600,
|
|
162
162
|
color: "var(--text)"
|
|
163
163
|
},
|
|
164
|
-
children:
|
|
164
|
+
children: l(d.display?.name) || l(p.display.name_plural)
|
|
165
165
|
})]
|
|
166
166
|
}),
|
|
167
|
-
/* @__PURE__ */ V(
|
|
167
|
+
/* @__PURE__ */ V(g, {
|
|
168
168
|
value: v,
|
|
169
169
|
onChange: fe,
|
|
170
|
-
placeholder: `Search ${
|
|
170
|
+
placeholder: `Search ${l(p.display.name_plural)}…`,
|
|
171
171
|
prefix: /* @__PURE__ */ V(e.search, { size: 13 })
|
|
172
172
|
}),
|
|
173
173
|
x.error && /* @__PURE__ */ H("div", {
|
|
@@ -182,27 +182,27 @@ function U({ screenCode: t }) {
|
|
|
182
182
|
},
|
|
183
183
|
children: [x.error, " Showing this list without URL filters."]
|
|
184
184
|
}),
|
|
185
|
-
|
|
185
|
+
d.filters && d.filters.length > 0 && /* @__PURE__ */ V("div", {
|
|
186
186
|
style: {
|
|
187
187
|
display: "flex",
|
|
188
188
|
flexWrap: "wrap",
|
|
189
189
|
gap: 6
|
|
190
190
|
},
|
|
191
|
-
children:
|
|
192
|
-
let t =
|
|
191
|
+
children: d.filters.map((e) => {
|
|
192
|
+
let t = p.fields.get(e);
|
|
193
193
|
if (!t?.values) return null;
|
|
194
|
-
let n = S?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r =
|
|
194
|
+
let n = S?.find((t) => t.field === e && t.op === "eq")?.value ?? "__all__", r = a(t, e, s.entities), i = [{
|
|
195
195
|
value: "__all__",
|
|
196
196
|
label: `All ${r}`
|
|
197
197
|
}, ...t.values.map((e) => ({
|
|
198
198
|
value: e.code,
|
|
199
|
-
label:
|
|
199
|
+
label: l(e.name) || e.code
|
|
200
200
|
}))];
|
|
201
201
|
return /* @__PURE__ */ V("div", {
|
|
202
202
|
style: { minWidth: 120 },
|
|
203
|
-
children: /* @__PURE__ */ V(
|
|
203
|
+
children: /* @__PURE__ */ V(te, {
|
|
204
204
|
value: n,
|
|
205
|
-
options:
|
|
205
|
+
options: i,
|
|
206
206
|
onChange: (t) => pe(e, t),
|
|
207
207
|
placeholder: r
|
|
208
208
|
})
|
|
@@ -217,8 +217,8 @@ function U({ screenCode: t }) {
|
|
|
217
217
|
fontSize: 11,
|
|
218
218
|
color: "var(--text-3)"
|
|
219
219
|
},
|
|
220
|
-
children: [/* @__PURE__ */ V("span", { children: K ? "Loading…" : `${W.length} ${
|
|
221
|
-
onClick: () =>
|
|
220
|
+
children: [/* @__PURE__ */ V("span", { children: K ? "Loading…" : `${W.length} ${l(p.display.name_plural)}` }), _e > 0 && /* @__PURE__ */ V("button", {
|
|
221
|
+
onClick: () => o((e) => {
|
|
222
222
|
let t = new URLSearchParams(e);
|
|
223
223
|
return t.delete("filters"), t;
|
|
224
224
|
}, { replace: !0 }),
|
|
@@ -265,12 +265,12 @@ function U({ screenCode: t }) {
|
|
|
265
265
|
},
|
|
266
266
|
children: "No records found"
|
|
267
267
|
}) : /* @__PURE__ */ H(B, { children: [W.map((e) => {
|
|
268
|
-
let t =
|
|
268
|
+
let t = ee(e[q]);
|
|
269
269
|
return /* @__PURE__ */ V(ue, {
|
|
270
270
|
record: e,
|
|
271
|
-
entity:
|
|
271
|
+
entity: p,
|
|
272
272
|
columns: C,
|
|
273
|
-
card:
|
|
273
|
+
card: O,
|
|
274
274
|
presentation: E,
|
|
275
275
|
refs: G,
|
|
276
276
|
isSelected: t === _,
|
|
@@ -317,13 +317,13 @@ function U({ screenCode: t }) {
|
|
|
317
317
|
height: w === "stacked" ? "50%" : "100%"
|
|
318
318
|
},
|
|
319
319
|
children: _ ? /* @__PURE__ */ V(de, {
|
|
320
|
-
entityCode:
|
|
320
|
+
entityCode: m,
|
|
321
321
|
recordId: _,
|
|
322
|
-
items:
|
|
323
|
-
schema:
|
|
324
|
-
entity:
|
|
322
|
+
items: d.items,
|
|
323
|
+
schema: s,
|
|
324
|
+
entity: p,
|
|
325
325
|
onBackToList: be,
|
|
326
|
-
relatedRecordsPresentation:
|
|
326
|
+
relatedRecordsPresentation: ae
|
|
327
327
|
}, _) : /* @__PURE__ */ V("div", {
|
|
328
328
|
style: {
|
|
329
329
|
display: "flex",
|
|
@@ -336,7 +336,7 @@ function U({ screenCode: t }) {
|
|
|
336
336
|
style: { fontSize: 12.5 },
|
|
337
337
|
children: [
|
|
338
338
|
"Select a ",
|
|
339
|
-
|
|
339
|
+
l(p.display.name),
|
|
340
340
|
" to view details"
|
|
341
341
|
]
|
|
342
342
|
})
|
|
@@ -345,37 +345,37 @@ function U({ screenCode: t }) {
|
|
|
345
345
|
]
|
|
346
346
|
});
|
|
347
347
|
}
|
|
348
|
-
function ue({ record: e, entity: t, columns:
|
|
349
|
-
let
|
|
350
|
-
if (
|
|
351
|
-
let n =
|
|
348
|
+
function ue({ record: e, entity: t, columns: n, card: r, presentation: i, refs: a, isSelected: o, onClick: s }) {
|
|
349
|
+
let c = p();
|
|
350
|
+
if (i === "cards") {
|
|
351
|
+
let n = r.badgeFields.filter((n) => W(t, e, n)), i = r.bodyFields.filter((n) => W(t, e, n)), l = r.metaFields.filter((n) => W(t, e, n));
|
|
352
352
|
return /* @__PURE__ */ H("button", {
|
|
353
353
|
type: "button",
|
|
354
354
|
"data-testid": "record-list-card",
|
|
355
|
-
"aria-current":
|
|
356
|
-
onClick:
|
|
355
|
+
"aria-current": o ? "true" : void 0,
|
|
356
|
+
onClick: s,
|
|
357
357
|
style: {
|
|
358
358
|
width: "100%",
|
|
359
359
|
textAlign: "left",
|
|
360
360
|
padding: 12,
|
|
361
361
|
border: "1px solid var(--border)",
|
|
362
362
|
borderRadius: 8,
|
|
363
|
-
background:
|
|
363
|
+
background: o ? "var(--row-selected-bg)" : "var(--surface)",
|
|
364
364
|
color: "var(--text)",
|
|
365
365
|
cursor: "pointer",
|
|
366
366
|
display: "flex",
|
|
367
367
|
flexDirection: "column",
|
|
368
368
|
gap: 8,
|
|
369
|
-
boxShadow:
|
|
369
|
+
boxShadow: o ? "inset 3px 0 0 var(--accent)" : "none"
|
|
370
370
|
},
|
|
371
371
|
children: [
|
|
372
372
|
/* @__PURE__ */ V(G, {
|
|
373
373
|
entity: t,
|
|
374
374
|
record: e,
|
|
375
|
-
field:
|
|
376
|
-
refs:
|
|
375
|
+
field: r.titleField,
|
|
376
|
+
refs: a
|
|
377
377
|
}),
|
|
378
|
-
|
|
378
|
+
r.subtitleField && /* @__PURE__ */ V("div", {
|
|
379
379
|
style: {
|
|
380
380
|
fontSize: 12,
|
|
381
381
|
color: "var(--text-3)",
|
|
@@ -383,11 +383,11 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
|
|
|
383
383
|
},
|
|
384
384
|
children: x({
|
|
385
385
|
entity: t,
|
|
386
|
-
fieldName:
|
|
386
|
+
fieldName: r.subtitleField,
|
|
387
387
|
record: e,
|
|
388
388
|
mode: "display",
|
|
389
|
-
refs:
|
|
390
|
-
locale:
|
|
389
|
+
refs: a,
|
|
390
|
+
locale: c
|
|
391
391
|
})
|
|
392
392
|
}),
|
|
393
393
|
n.length > 0 && /* @__PURE__ */ V("div", {
|
|
@@ -411,27 +411,27 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
|
|
|
411
411
|
fieldName: n,
|
|
412
412
|
record: e,
|
|
413
413
|
mode: "display",
|
|
414
|
-
refs:
|
|
415
|
-
locale:
|
|
414
|
+
refs: a,
|
|
415
|
+
locale: c
|
|
416
416
|
})
|
|
417
417
|
}, n))
|
|
418
418
|
}),
|
|
419
|
-
|
|
419
|
+
i.length > 0 && /* @__PURE__ */ V("dl", {
|
|
420
420
|
style: {
|
|
421
421
|
display: "grid",
|
|
422
422
|
gridTemplateColumns: "minmax(72px, max-content) minmax(0, 1fr)",
|
|
423
423
|
gap: "5px 10px",
|
|
424
424
|
margin: 0
|
|
425
425
|
},
|
|
426
|
-
children:
|
|
426
|
+
children: i.map((n) => /* @__PURE__ */ V(K, {
|
|
427
427
|
entity: t,
|
|
428
428
|
record: e,
|
|
429
429
|
fieldName: n,
|
|
430
|
-
refs:
|
|
431
|
-
locale:
|
|
430
|
+
refs: a,
|
|
431
|
+
locale: c
|
|
432
432
|
}, n))
|
|
433
433
|
}),
|
|
434
|
-
|
|
434
|
+
l.length > 0 && /* @__PURE__ */ V("div", {
|
|
435
435
|
style: {
|
|
436
436
|
display: "flex",
|
|
437
437
|
flexWrap: "wrap",
|
|
@@ -439,7 +439,7 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
|
|
|
439
439
|
fontSize: 11,
|
|
440
440
|
color: "var(--text-3)"
|
|
441
441
|
},
|
|
442
|
-
children:
|
|
442
|
+
children: l.map((n) => /* @__PURE__ */ V("span", {
|
|
443
443
|
style: {
|
|
444
444
|
minWidth: 0,
|
|
445
445
|
overflowWrap: "anywhere"
|
|
@@ -449,24 +449,24 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
|
|
|
449
449
|
fieldName: n,
|
|
450
450
|
record: e,
|
|
451
451
|
mode: "display",
|
|
452
|
-
refs:
|
|
453
|
-
locale:
|
|
452
|
+
refs: a,
|
|
453
|
+
locale: c
|
|
454
454
|
})
|
|
455
455
|
}, n))
|
|
456
456
|
})
|
|
457
457
|
]
|
|
458
458
|
});
|
|
459
459
|
}
|
|
460
|
-
let
|
|
460
|
+
let l = n[0], u = n[1], d = n.slice(2, 4);
|
|
461
461
|
return /* @__PURE__ */ H("button", {
|
|
462
|
-
onClick:
|
|
462
|
+
onClick: s,
|
|
463
463
|
style: {
|
|
464
464
|
width: "100%",
|
|
465
465
|
textAlign: "left",
|
|
466
466
|
padding: "10px 12px",
|
|
467
467
|
borderBottom: "1px solid var(--divider)",
|
|
468
|
-
background:
|
|
469
|
-
borderLeft:
|
|
468
|
+
background: o ? "var(--row-selected-bg)" : "transparent",
|
|
469
|
+
borderLeft: o ? "2px solid var(--accent)" : "2px solid transparent",
|
|
470
470
|
cursor: "pointer",
|
|
471
471
|
transition: "background-color .12s",
|
|
472
472
|
display: "flex",
|
|
@@ -476,12 +476,12 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
|
|
|
476
476
|
borderBottomColor: "var(--divider)"
|
|
477
477
|
},
|
|
478
478
|
onMouseEnter: (e) => {
|
|
479
|
-
|
|
479
|
+
o || (e.currentTarget.style.background = "var(--surface-3)");
|
|
480
480
|
},
|
|
481
481
|
onMouseLeave: (e) => {
|
|
482
|
-
|
|
482
|
+
o || (e.currentTarget.style.background = "transparent");
|
|
483
483
|
},
|
|
484
|
-
children: [
|
|
484
|
+
children: [l && /* @__PURE__ */ V("div", {
|
|
485
485
|
style: {
|
|
486
486
|
fontSize: 12.5,
|
|
487
487
|
fontWeight: 500,
|
|
@@ -492,11 +492,11 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
|
|
|
492
492
|
},
|
|
493
493
|
children: x({
|
|
494
494
|
entity: t,
|
|
495
|
-
fieldName:
|
|
495
|
+
fieldName: l,
|
|
496
496
|
record: e,
|
|
497
497
|
mode: "display",
|
|
498
|
-
refs:
|
|
499
|
-
locale:
|
|
498
|
+
refs: a,
|
|
499
|
+
locale: c
|
|
500
500
|
})
|
|
501
501
|
}), /* @__PURE__ */ H("div", {
|
|
502
502
|
style: {
|
|
@@ -504,7 +504,7 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
|
|
|
504
504
|
alignItems: "center",
|
|
505
505
|
gap: 6
|
|
506
506
|
},
|
|
507
|
-
children: [
|
|
507
|
+
children: [u && /* @__PURE__ */ V("div", {
|
|
508
508
|
style: {
|
|
509
509
|
fontSize: 11,
|
|
510
510
|
color: "var(--text-3)",
|
|
@@ -515,11 +515,11 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
|
|
|
515
515
|
},
|
|
516
516
|
children: x({
|
|
517
517
|
entity: t,
|
|
518
|
-
fieldName:
|
|
518
|
+
fieldName: u,
|
|
519
519
|
record: e,
|
|
520
520
|
mode: "display",
|
|
521
|
-
refs:
|
|
522
|
-
locale:
|
|
521
|
+
refs: a,
|
|
522
|
+
locale: c
|
|
523
523
|
})
|
|
524
524
|
}), /* @__PURE__ */ V("div", {
|
|
525
525
|
style: {
|
|
@@ -528,15 +528,15 @@ function ue({ record: e, entity: t, columns: r, card: i, presentation: a, refs:
|
|
|
528
528
|
gap: 4,
|
|
529
529
|
flexShrink: 0
|
|
530
530
|
},
|
|
531
|
-
children:
|
|
531
|
+
children: d.map((n) => y(t, e, n) == null ? null : /* @__PURE__ */ V("div", {
|
|
532
532
|
style: { fontSize: 11 },
|
|
533
533
|
children: x({
|
|
534
534
|
entity: t,
|
|
535
535
|
fieldName: n,
|
|
536
536
|
record: e,
|
|
537
537
|
mode: "display",
|
|
538
|
-
refs:
|
|
539
|
-
locale:
|
|
538
|
+
refs: a,
|
|
539
|
+
locale: c
|
|
540
540
|
})
|
|
541
541
|
}, n))
|
|
542
542
|
})]
|
|
@@ -547,15 +547,15 @@ function W(e, t, n) {
|
|
|
547
547
|
let r = y(e, t, n);
|
|
548
548
|
return !(r == null || r === "" || Array.isArray(r) && r.length === 0);
|
|
549
549
|
}
|
|
550
|
-
function G({ entity: e, record: t, field:
|
|
551
|
-
let
|
|
550
|
+
function G({ entity: e, record: t, field: n, refs: r }) {
|
|
551
|
+
let i = p(), a = c(t, e), o = n ? x({
|
|
552
552
|
entity: e,
|
|
553
|
-
fieldName:
|
|
553
|
+
fieldName: n,
|
|
554
554
|
record: t,
|
|
555
555
|
mode: "display",
|
|
556
|
-
refs:
|
|
557
|
-
locale:
|
|
558
|
-
}) :
|
|
556
|
+
refs: r,
|
|
557
|
+
locale: i
|
|
558
|
+
}) : a;
|
|
559
559
|
return /* @__PURE__ */ V("div", {
|
|
560
560
|
style: {
|
|
561
561
|
fontSize: 13.5,
|
|
@@ -563,21 +563,21 @@ function G({ entity: e, record: t, field: r, refs: a }) {
|
|
|
563
563
|
color: "var(--text)",
|
|
564
564
|
overflowWrap: "anywhere"
|
|
565
565
|
},
|
|
566
|
-
children:
|
|
566
|
+
children: o || l(e.display.name)
|
|
567
567
|
});
|
|
568
568
|
}
|
|
569
569
|
function K({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
|
|
570
|
-
let
|
|
571
|
-
if (
|
|
572
|
-
let
|
|
573
|
-
return
|
|
570
|
+
let o = y(e, t, n);
|
|
571
|
+
if (o == null || o === "") return null;
|
|
572
|
+
let s = e.fields.get(n);
|
|
573
|
+
return s ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("dt", {
|
|
574
574
|
style: {
|
|
575
575
|
color: "var(--text-3)",
|
|
576
576
|
fontSize: 11.5,
|
|
577
577
|
minWidth: 0,
|
|
578
578
|
overflowWrap: "anywhere"
|
|
579
579
|
},
|
|
580
|
-
children:
|
|
580
|
+
children: a(s, n)
|
|
581
581
|
}), /* @__PURE__ */ V("dd", {
|
|
582
582
|
style: {
|
|
583
583
|
margin: 0,
|
|
@@ -597,7 +597,7 @@ function K({ entity: e, record: t, fieldName: n, refs: r, locale: i }) {
|
|
|
597
597
|
})] }) : null;
|
|
598
598
|
}
|
|
599
599
|
function de({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBackToList: a, relatedRecordsPresentation: o }) {
|
|
600
|
-
return /* @__PURE__ */ V(
|
|
600
|
+
return /* @__PURE__ */ V(d, { children: /* @__PURE__ */ V(q, {
|
|
601
601
|
entityCode: e,
|
|
602
602
|
recordId: t,
|
|
603
603
|
items: n,
|
|
@@ -607,53 +607,53 @@ function de({ entityCode: e, recordId: t, items: n, schema: r, entity: i, onBack
|
|
|
607
607
|
relatedRecordsPresentation: o
|
|
608
608
|
}) });
|
|
609
609
|
}
|
|
610
|
-
function q({ entityCode: n, recordId:
|
|
611
|
-
let g =
|
|
610
|
+
function q({ entityCode: n, recordId: a, items: u, schema: d, entity: f, onBackToList: p, relatedRecordsPresentation: te }) {
|
|
611
|
+
let g = o(f, "update"), ne = L(() => a ? m(f, a) : void 0, [a, f]), { data: re, isLoading: ie } = _(n, ne), x = v(n), T = h(), [D, k] = z(!1), [A, j] = z({}), M = re?.data, oe = M?.$statuses, se = M?.$properties, P = O(n, a), I = ae(n, a), R = L(() => {
|
|
612
612
|
let e = /* @__PURE__ */ new Set();
|
|
613
|
-
for (let [t, n] of
|
|
614
|
-
for (let [t] of
|
|
613
|
+
for (let [t, n] of f.fields) !n.auto && !n.primary && e.add(t);
|
|
614
|
+
for (let [t] of f.files ?? []) e.add(t);
|
|
615
615
|
return e;
|
|
616
|
-
}, [
|
|
616
|
+
}, [f]), ce = F(() => {
|
|
617
617
|
if (M) {
|
|
618
618
|
let e = {};
|
|
619
619
|
R.forEach((t) => {
|
|
620
|
-
let n = y(
|
|
621
|
-
e[t] = S(
|
|
620
|
+
let n = y(f, M, t);
|
|
621
|
+
e[t] = S(f, t) ? n ?? null : n ?? "";
|
|
622
622
|
}), j(e);
|
|
623
623
|
}
|
|
624
624
|
k(!0);
|
|
625
625
|
}, [
|
|
626
626
|
M,
|
|
627
627
|
R,
|
|
628
|
-
|
|
628
|
+
f
|
|
629
629
|
]), le = F(async () => {
|
|
630
|
-
await
|
|
631
|
-
}, [
|
|
630
|
+
await T.flushAllDrafts(), k(!1), j({});
|
|
631
|
+
}, [T]), U = F(() => {
|
|
632
632
|
let e = {}, t = E({
|
|
633
|
-
entity:
|
|
633
|
+
entity: f,
|
|
634
634
|
formData: A,
|
|
635
635
|
record: M,
|
|
636
636
|
isNew: !1
|
|
637
637
|
}), n = w(t);
|
|
638
|
-
for (let [t, n] of Object.entries(A))
|
|
638
|
+
for (let [t, n] of Object.entries(A)) f.files?.has(t) || (e[t] = b(f, t, n));
|
|
639
639
|
if (Object.keys(t).length > 0 && (e.$files = t), Object.keys(e).length === 0) {
|
|
640
640
|
k(!1), j({});
|
|
641
641
|
return;
|
|
642
642
|
}
|
|
643
|
-
|
|
644
|
-
pkValues:
|
|
643
|
+
x.mutate({
|
|
644
|
+
pkValues: a,
|
|
645
645
|
data: e
|
|
646
646
|
}, {
|
|
647
647
|
onSuccess: () => {
|
|
648
|
-
n.forEach((e) =>
|
|
648
|
+
n.forEach((e) => T.markCommitted(e)), k(!1), j({}), s.success("Saved");
|
|
649
649
|
},
|
|
650
|
-
onError: () =>
|
|
650
|
+
onError: () => s.error("Failed to save")
|
|
651
651
|
});
|
|
652
652
|
}, [
|
|
653
|
-
D,
|
|
654
653
|
T,
|
|
655
|
-
|
|
656
|
-
|
|
654
|
+
x,
|
|
655
|
+
a,
|
|
656
|
+
f,
|
|
657
657
|
A,
|
|
658
658
|
M
|
|
659
659
|
]), ue = F((e, t) => {
|
|
@@ -662,34 +662,34 @@ function q({ entityCode: n, recordId: r, items: s, schema: c, entity: d, onBackT
|
|
|
662
662
|
[e]: t
|
|
663
663
|
}));
|
|
664
664
|
}, []);
|
|
665
|
-
if (
|
|
665
|
+
if (ie) return /* @__PURE__ */ V(C, {});
|
|
666
666
|
if (!M) return null;
|
|
667
|
-
let W =
|
|
668
|
-
schema:
|
|
669
|
-
entity:
|
|
667
|
+
let W = c(M, f), G = f.display?.display_field, K = W ? void 0 : G ? M[G] : M[f.fields.names()[0]], de = W || (K != null && typeof K != "object" ? ee(K) : l(f.display.name)), q = M?.$refs, J = {
|
|
668
|
+
schema: d,
|
|
669
|
+
entity: f,
|
|
670
670
|
entityCode: n,
|
|
671
|
-
recordId:
|
|
672
|
-
record:
|
|
671
|
+
recordId: a,
|
|
672
|
+
record: D ? {
|
|
673
673
|
...M,
|
|
674
674
|
...A
|
|
675
675
|
} : M,
|
|
676
676
|
isNew: !1,
|
|
677
|
-
mode:
|
|
678
|
-
onFieldChange:
|
|
677
|
+
mode: D ? "edit" : "display",
|
|
678
|
+
onFieldChange: D ? ue : void 0,
|
|
679
679
|
refs: q,
|
|
680
|
-
objectProperties:
|
|
680
|
+
objectProperties: se ?? void 0,
|
|
681
681
|
onSetProperty: g ? (e, t) => I.mutate({
|
|
682
682
|
propertyCode: e,
|
|
683
683
|
value: t
|
|
684
684
|
}) : void 0,
|
|
685
685
|
isPropertyPending: I.isPending,
|
|
686
|
-
objectStatuses:
|
|
687
|
-
onSetStatus: g ? (e, t) =>
|
|
686
|
+
objectStatuses: oe ?? void 0,
|
|
687
|
+
onSetStatus: g ? (e, t) => P.mutate({
|
|
688
688
|
groupCode: e,
|
|
689
689
|
statusCode: t
|
|
690
690
|
}) : void 0,
|
|
691
|
-
isStatusPending:
|
|
692
|
-
relatedRecordsPresentation:
|
|
691
|
+
isStatusPending: P.isPending,
|
|
692
|
+
relatedRecordsPresentation: te
|
|
693
693
|
};
|
|
694
694
|
return /* @__PURE__ */ H("div", {
|
|
695
695
|
style: {
|
|
@@ -726,23 +726,23 @@ function q({ entityCode: n, recordId: r, items: s, schema: c, entity: d, onBackT
|
|
|
726
726
|
alignItems: "center",
|
|
727
727
|
gap: 6
|
|
728
728
|
},
|
|
729
|
-
children: [
|
|
729
|
+
children: [p && /* @__PURE__ */ V(r, {
|
|
730
730
|
icon: /* @__PURE__ */ V(e.back, { size: 14 }),
|
|
731
731
|
title: "Back to list",
|
|
732
|
-
onClick:
|
|
733
|
-
}), g && (
|
|
732
|
+
onClick: p
|
|
733
|
+
}), g && (D ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(i, {
|
|
734
734
|
size: "xs",
|
|
735
735
|
icon: /* @__PURE__ */ V(e.x, { size: 12 }),
|
|
736
736
|
onClick: le,
|
|
737
737
|
children: "Cancel"
|
|
738
|
-
}), /* @__PURE__ */ V(
|
|
738
|
+
}), /* @__PURE__ */ V(i, {
|
|
739
739
|
kind: "primary",
|
|
740
740
|
size: "xs",
|
|
741
|
-
icon:
|
|
741
|
+
icon: x.isPending ? /* @__PURE__ */ V(t, { size: 12 }) : /* @__PURE__ */ V(e.save, { size: 12 }),
|
|
742
742
|
onClick: U,
|
|
743
|
-
disabled:
|
|
744
|
-
children:
|
|
745
|
-
})] }) : /* @__PURE__ */ V(
|
|
743
|
+
disabled: x.isPending,
|
|
744
|
+
children: x.isPending ? "Saving…" : "Save"
|
|
745
|
+
})] }) : /* @__PURE__ */ V(i, {
|
|
746
746
|
size: "xs",
|
|
747
747
|
icon: /* @__PURE__ */ V(e.edit, { size: 12 }),
|
|
748
748
|
onClick: ce,
|
|
@@ -758,8 +758,8 @@ function q({ entityCode: n, recordId: r, items: s, schema: c, entity: d, onBackT
|
|
|
758
758
|
flexDirection: "column",
|
|
759
759
|
gap: 12
|
|
760
760
|
},
|
|
761
|
-
children:
|
|
762
|
-
nodes:
|
|
761
|
+
children: u && u.length > 0 ? /* @__PURE__ */ V(N, {
|
|
762
|
+
nodes: u,
|
|
763
763
|
ctx: J
|
|
764
764
|
}) : /* @__PURE__ */ H("p", {
|
|
765
765
|
style: {
|